1 |
- System.register([],(function(t,e){"use strict";return{execute:function(){function i(t){var e,i;return e=(t>65535)<<4,e|=i=((t>>>=e)>255)<<3,e|=i=((t>>>=i)>15)<<2,(e|=i=((t>>>=i)>3)<<1)|(t>>>=i)>>1}function n(t){return 16843009*((t=(858993459&(t-=t>>>1&1431655765))+(t>>>2&858993459))+(t>>>4)&252645135)>>>24}function r(t){var e=32;return(t&=-t)&&e--,65535&t&&(e-=16),16711935&t&&(e-=8),252645135&t&&(e-=4),858993459&t&&(e-=2),1431655765&t&&(e-=1),e}function s(t){return--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,1+(t|=t>>>16)}t({AntiAliasing:void 0,BitMask:ce,CCClass:hi,CacheMode:void 0,DebugMode:void 0,DeviceType:void 0,Enum:_e,Eventify:Da,ExtrapolationMode:void 0,HorizontalTextAlignment:void 0,InstanceMaterialType:void 0,KeyCode:void 0,NodeEventType:void 0,NodeSpace:void 0,Overflow:void 0,PipelineEventType:void 0,QuatInterpolationMode:void 0,RealInterpolationMode:void 0,SystemEventType:void 0,TangentWeightMode:void 0,TransformBit:void 0,VerticalTextAlignment:void 0,WorldNode3DToLocalNodeUI:ux,WorldNode3DToWorldNodeUI:hx,XrKeyboardEventType:void 0,XrUIPressEventType:void 0,__checkObsoleteInNamespace__:function(t){return ct||(ct="undefined"==typeof Proxy?{}:new Proxy(t,{get:function(t,e,i){return dt(e),Reflect.get(t,e,i)}})),ct},__checkObsolete__:function(t){for(var e,i=y(t);!(e=i()).done;)dt(e.value)},absMax:Ni,absMaxComponent:Bi,approx:gi,assert:U,assertID:Z,bezier:qf,bezierByTime:fd,buildShadowPass:uF,buildShadowPasses:lF,ccenum:pe,clamp:vi,clamp01:yi,color:ki,computeRatioByType:QJ,createDefaultPipeline:_L,debug:G,deprecateModuleExportedName:ft,deserialize:e_,earcut:OY,enumerableProps:Mi,equals:mi,error:F,errorID:K,find:qw,fragmentText:KU,getBaselineOffset:function(){return 0},getCameraUniqueID:fF,getEnglishWordPartAtFirst:jU,getEnglishWordPartAtLast:YU,getError:J,getLoadOpOfClearFlag:dF,getPathFromRoot:function(t,e){for(var i=t,n="";null!==i&&i!==e;)n=i.name+"/"+n,i=i.parent;return n.slice(0,-1)},getRenderArea:oF,getSerializationMetadata:function(t){return t[yh]},getWorldTransformUntilRoot:function(t,e,i){for(un.identity(i);t!==e;)un.fromRTS(L1,t.rotation,t.position,t.scale),un.multiply(i,L1,i),t=t.parent;return i},instantiate:v_,inverseLerp:Di,isDisplayStats:$,isEnglishWordPartAtFirst:function(t){return zU.test(t)},isEnglishWordPartAtLast:function(t){return kU.test(t)},isUnicodeCJK:HU,isUnicodeSpace:VU,isValid:Ra,lerp:Ei,log:M,logID:W,markAsWarning:void 0,mat4:cn,murmurhash2_32_gc:Vs,nextPow2:Oi,pingPong:Pi,pseudoRandom:Ci,pseudoRandomRange:wi,pseudoRandomRangeInt:Ii,quat:an,randomRange:Ri,randomRangeInt:bi,rect:En,removeProperty:void 0,repeat:xi,replaceProperty:void 0,safeMeasureText:WU,sampleAnimationCurve:qJ,setDefaultLogTimes:function(t){t>0&&(ut=t)},setDisplayStats:tt,size:vn,toDegree:Si,toRadian:Ti,tween:p8,tweenUtil:m8,v2:pn,v3:qi,v4:Fi,validPunctualLightsCulling:mF,warn:L,warnID:j});var a=new Array(256);!function(t){for(var e=0;e<256;++e){var i=e,n=e,r=7;for(i>>>=1;i;i>>>=1)n<<=1,n|=1&i,--r;t[e]=n<<r&255}}(a);var o=Object.freeze({__proto__:null,INT_BITS:32,INT_MAX:2147483647,INT_MIN:-2147483648,sign:function(t){return(t>0)-(t<0)},abs:function(t){var e=t>>31;return(t^e)-e},min:function(t,e){return e^(t^e)&-(t<e)},max:function(t,e){return t^(t^e)&-(t<e)},isPow2:function(t){return!(t&t-1||!t)},log2:i,log10:function(t){return t>=1e9?9:t>=1e8?8:t>=1e7?7:t>=1e6?6:t>=1e5?5:t>=1e4?4:t>=1e3?3:t>=100?2:t>=10?1:0},popCount:n,countTrailingZeros:r,nextPow2:s,prevPow2:function(t){return t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)-(t>>>1)},parity:function(t){return t^=t>>>16,t^=t>>>8,t^=t>>>4,27030>>>(t&=15)&1},reverse:function(t){return a[255&t]<<24|a[t>>>8&255]<<16|a[t>>>16&255]<<8|a[t>>>24&255]},interleave2:function(t,e){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t&=65535)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e&=65535)|e<<8))|e<<4))|e<<2))|e<<1))<<1},deinterleave2:function(t,e){return(t=65535&((t=16711935&((t=252645135&((t=858993459&((t=t>>>e&1431655765)|t>>>1))|t>>>2))|t>>>4))|t>>>16))<<16>>16},interleave3:function(t,e,i){return t=1227133513&((t=3272356035&((t=251719695&((t=4278190335&((t&=1023)|t<<16))|t<<8))|t<<4))|t<<2),(t|=(e=1227133513&((e=3272356035&((e=251719695&((e=4278190335&((e&=1023)|e<<16))|e<<8))|e<<4))|e<<2))<<1)|(i=1227133513&((i=3272356035&((i=251719695&((i=4278190335&((i&=1023)|i<<16))|i<<8))|i<<4))|i<<2))<<2},deinterleave3:function(t,e){return(t=1023&((t=4278190335&((t=251719695&((t=3272356035&((t=t>>>e&1227133513)|t>>>2))|t>>>4))|t>>>8))|t>>>16))<<22>>22},nextCombination:function(t){var e=t|t-1;return e+1|(~e&-~e)-1>>>r(t)+1}});function u(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function h(t,e,i){return e&&u(t.prototype,e),i&&u(t,i),t}function l(){return(l=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t}).apply(this,arguments)}function c(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,f(t,e)}function _(t){return(_=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function f(t,e){return(f=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function d(){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(t){return!1}}function p(t,e,i){return(p=d()?Reflect.construct:function(t,e,i){var n=[null];n.push.apply(n,e);var r=new(Function.bind.apply(t,n));return i&&f(r,i.prototype),r}).apply(null,arguments)}function m(t){var e="function"==typeof Map?new Map:void 0;return(m=function(t){if(null===t||(i=t,-1===Function.toString.call(i).indexOf("[native code]")))return t;var i;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return p(t,arguments,_(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),f(n,t)})(t)}function g(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function v(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}function y(t,e){var i;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(i=function(t,e){if(t){if("string"==typeof t)return v(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?v(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[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=t[Symbol.iterator]()).next.bind(i)}function E(t,e,i,n){i&&Object.defineProperty(t,e,{enumerable:i.enumerable,configurable:i.configurable,writable:i.writable,value:i.initializer?i.initializer.call(n):void 0})}function T(t,e,i,n,r){var s={};return Object.keys(n).forEach((function(t){s[t]=n[t]})),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(t,e,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(t,e,s),s=null),s}function S(t,e){const i="undefined"==typeof window?global:window;return void 0===i[t]?i[t]=e:i[t]}t("bits",o),S("CC_WECHAT",!1),S("CC_BAIDU",!1),S("CC_XIAOMI",!1),S("CC_ALIPAY",!1),S("CC_BYTEDANCE",!1),S("CC_OPPO",!1),S("CC_VIVO",!1),S("CC_HUAWEI",!1),S("CC_COCOSPLAY",!1),S("CC_QTT",!1),S("CC_LINKSURE",!1);const A=!1;S("CC_EDITOR",!1),S("CC_PREVIEW",!1),S("CC_BUILD",!0),S("CC_TEST",!1),S("CC_DEBUG",!1),S("CC_DEV",!1),S("CC_MINIGAME",!1),S("CC_RUNTIME_BASED",!1),S("CC_SUPPORT_JIT",!0),S("CC_JSB",!1);var R="undefined"==typeof window?global:window,b=t("cclegacy",{_global:R});b.internal={};var C=t("VERSION","3.6.2");R.CocosEngine=b.ENGINE_VERSION=C,R.cc=b;var w="https://github.com/cocos-creator/engine/blob/develop/EngineErrorMap.md",I=null,O=console.log.bind(console),x=O,P=O,D=function(t,e){if(!t){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: "+N.apply(void 0,[e].concat(n)))}},B=O;function N(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];return b.js.formatStr.apply(null,[t].concat(i))}function M(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];return O.apply(void 0,[t].concat(i))}function L(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];return x.apply(void 0,[t].concat(i))}function F(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];return P.apply(void 0,[t].concat(i))}function U(t,e){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,[t,e].concat(n))}function G(){return B.apply(void 0,arguments)}function k(t){if(O=x=P=D=B=function(){},t!==q.NONE){if(t>q.ERROR){var e=function(t){if(b.game.canvas){if(!I){var e=document.createElement("Div");e.setAttribute("id","logInfoDiv"),e.setAttribute("width","200"),e.setAttribute("height",b.game.canvas.height);var i=e.style;i.zIndex="99999",i.position="absolute",i.top=i.left="0",(I=document.createElement("textarea")).setAttribute("rows","20"),I.setAttribute("cols","30"),I.setAttribute("disabled","true");var n=I.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",e.appendChild(I),b.game.canvas.parentNode.appendChild(e)}I.value=I.value+t+"\r\n",I.scrollTop=I.scrollHeight}};P=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];e("ERROR : "+N.apply(void 0,[t].concat(n)))},D=function(t,i){if(!t){for(var n=arguments.length,r=new Array(n>2?n-2:0),s=2;s<n;s++)r[s-2]=arguments[s];e("ASSERT: "+N.apply(void 0,[i].concat(r)))}},t!==q.ERROR_FOR_WEB_PAGE&&(x=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];e("WARN : "+N.apply(void 0,[t].concat(n)))}),t===q.INFO_FOR_WEB_PAGE&&(O=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];e(N.apply(void 0,[t].concat(n)))})}else console&&(console.error||(console.error=console.log),console.warn||(console.warn=console.log),P=console.error.bind?console.error.bind(console):function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];return console.error.apply(console,[t].concat(i))},D=function(t,e){if(!t){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=N.apply(void 0,[e].concat(n));throw new Error(s)}});if(t!==q.ERROR&&(x=console.warn.bind?console.warn.bind(console):function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];return console.warn.apply(console,[t].concat(i))}),t<=q.INFO&&(O=console.log.bind?console.log.bind(console):function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];return console.log.apply(console,[t].concat(i))}),t<=q.VERBOSE&&"function"==typeof console.debug){var i=console.debug.bind(console);B=function(){return i.apply(void 0,arguments)}}}}function z(t){F(t.stack||t)}function H(t){return function(e){for(var i=t+" "+e+", please go to "+w+"#"+e+" 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 V=H("Log");function W(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];M(V.apply(void 0,[t].concat(i)))}var X=H("Warning");function j(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];L(X.apply(void 0,[t].concat(i)))}var Y=H("Error");function K(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];F(Y.apply(void 0,[t].concat(i)))}var q,Q=H("Assert");function Z(t,e){if(!t){for(var i=arguments.length,n=new Array(i>2?i-2:0),r=2;r<i;r++)n[r-2]=arguments[r];U(!1,Q.apply(void 0,[e].concat(n)))}}function J(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];return Y.apply(void 0,[t].concat(i))}function $(){return!!b.profiler&&b.profiler.isShowingStats()}function tt(t){b.profiler&&(t?b.profiler.showStats():b.profiler.hideStats())}!function(t){t[t.NONE=0]="NONE",t[t.VERBOSE=1]="VERBOSE",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.INFO_FOR_WEB_PAGE=5]="INFO_FOR_WEB_PAGE",t[t.WARN_FOR_WEB_PAGE=6]="WARN_FOR_WEB_PAGE",t[t.ERROR_FOR_WEB_PAGE=7]="ERROR_FOR_WEB_PAGE"}(q||(q=t("DebugMode",{})));var et,it,nt,rt,st,at,ot=Object.freeze({__proto__:null,log:M,warn:L,error:F,assert:U,debug:G,_resetDebugSetting:k,_throw:z,logID:W,warnID:j,errorID:K,assertID:Z,get DebugMode(){return q},getError:J,isDisplayStats:$,setDisplayStats:tt}),ut=10,ht=0,lt=new Map;rt=function(t,e,i,n,r,s,a){var o=lt.get(s);o&&o.logTimes>o.count&&(r("'%s' is deprecated, please use '%s' instead. "+a,t+"."+e,i+"."+n),o.count++)},et=t("replaceProperty",(function(t,e,i){null!=t&&i.forEach((function(i){var n=ht++;lt.set(n,{id:n,count:0,logTimes:void 0!==i.logTimes?i.logTimes:ut});var r=null!=i.target?i.target:t,s=null!=i.newName?i.newName:i.name,a=null!=i.targetName?i.targetName:e,o=r===t,u=i.suggest?"("+i.suggest+")":"";if(null!=i.customFunction)t[i.name]=function(){var t;return rt(e,i.name,a,s,L,n,u),(t=i.customFunction).call.apply(t,[this].concat(Array.prototype.slice.call(arguments)))};else if(null!=i.customSetter||null!=i.customGetter){var h=null!=i.customSetter,l=null!=i.customGetter;h&&l?Object.defineProperty(t,i.name,{get:function(){return rt(e,i.name,a,s,L,n,u),i.customGetter.call(this)},set:function(t){rt(e,i.name,a,s,L,n,u),i.customSetter.call(this,t)},enumerable:!1}):h?Object.defineProperty(t,i.name,{set:function(t){rt(e,i.name,a,s,L,n,u),i.customSetter.call(this,t)},enumerable:!1}):l&&Object.defineProperty(t,i.name,{get:function(){return rt(e,i.name,a,s,L,n,u),i.customGetter.call(this)},enumerable:!1})}else Object.defineProperty(t,i.name,{get:function(){return rt(e,i.name,a,s,L,n,u),o?this[s]:r[s]},set:function(t){rt(e,i.name,a,s,L,n,u),o?this[s]=t:r[s]=t},enumerable:!1})}))})),at=function(t,e,i,n,r){var s=lt.get(n);s&&s.logTimes>s.count&&(i("'%s' has been removed. "+r,t+"."+e),s.count++)},it=t("removeProperty",(function(t,e,i){null!=t&&i.forEach((function(i){var n=ht++;lt.set(n,{id:n,count:0,logTimes:void 0!==i.logTimes?i.logTimes:ut});var r=i.suggest?"("+i.suggest+")":"";Object.defineProperty(t,i.name,{get:function(){return at(e,i.name,F,n,r)},set:function(){at(e,i.name,F,n,r)},enumerable:!1})}))})),st=function(t,e,i,n,r){var s=lt.get(n);s&&s.logTimes>s.count&&(i("'%s' is deprecated. "+r,t+"."+e),s.count++)},nt=t("markAsWarning",(function(t,e,i){null!=t&&i.forEach((function(i){var n=i.name,r=Object.getOwnPropertyDescriptor(t,n);if(r&&r.configurable){var s=ht++;lt.set(s,{id:s,count:0,logTimes:void 0!==i.logTimes?i.logTimes:ut});var a=i.suggest?"("+i.suggest+")":"";if(void 0!==r.value)if("function"==typeof r.value){var o=r.value;t[n]=function(){return st(e,n,L,s,a),o.call.apply(o,[this].concat(Array.prototype.slice.call(arguments)))}}else{var u=r.value;Object.defineProperty(t,n,{configurable:!0,get:function(){return st(e,n,L,s,a),u}}),r.writable&&Object.defineProperty(t,n,{set:function(t){st(e,n,L,s,a),u=t}})}else!function(e,i,n,r,s,a){if(e.get){var o=e.get;e.get=function(){return st(i,n,r,s,a),o.call(this)}}if(e.set){var u=e.set;e.set=function(t){st(i,n,r,s,a),u.call(this,t)}}Object.defineProperty(t,n,e)}(r,e,n,L,s,a);Object.defineProperty(t,n,{enumerable:!1})}}))}));var ct,_t={};function ft(t){for(var e in t){var i=t[e];_t[e]=i}}function dt(t){var e=_t[t];if(e){var i=e.newName,n=e.since;e.removed?i?K(16003,t,n,i):K(16002,t,n):i?j(16001,t,n,i):j(16e3,t,n)}}var pt=function(){function t(t){this.i=0,this.array=t}var e=t.prototype;return e.remove=function(t){var e=this.array.indexOf(t);e>=0&&this.removeAt(e)},e.removeAt=function(t){this.array.splice(t,1),t<=this.i&&--this.i},e.fastRemove=function(t){var e=this.array.indexOf(t);e>=0&&this.fastRemoveAt(e)},e.fastRemoveAt=function(t){var e=this.array;e[t]=e[e.length-1],--e.length,t<=this.i&&--this.i},e.push=function(t){this.array.push(t)},h(t,[{key:"length",get:function(){return this.array.length},set:function(t){this.array.length=t,this.i>=t&&(this.i=t-1)}}]),t}();function mt(t,e){t.splice(e,1)}function gt(t,e){var i=t.length;e<0||e>=i||(t[e]=t[i-1],t.length=i-1)}function vt(t,e){var i=t.indexOf(e);return i>=0&&(mt(t,i),!0)}function yt(t,e){return t.indexOf(e)>=0}var Et=Object.freeze({__proto__:null,removeAt:mt,fastRemoveAt:gt,remove:vt,fastRemove:function(t,e){var i=t.indexOf(e);i>=0&&(t[i]=t[t.length-1],--t.length)},removeIf:function(t,e){var i=t.findIndex(e);if(i>=0){var n=t[i];return mt(t,i),n}},verifyType:function(t,e){if(t&&t.length>0)for(var i,n=y(t);!(i=n()).done;)if(!(i.value instanceof e))return W(1300),!1;return!0},removeArray:function(t,e){for(var i=0,n=e.length;i<n;i++)vt(t,e[i])},appendObjectsAt:function(t,e,i){return t.splice.apply(t,[i,0].concat(e)),t},contains:yt,copy:function(t){for(var e=t.length,i=new Array(e),n=0;n<e;n+=1)i[n]=t[n];return i},MutableForwardIterator:pt}),Tt=function(){function t(t){this.id=void 0,this.prefix=void 0,this.id=0|998*Math.random(),this.prefix=t?t+".":""}return t.prototype.getNewId=function(){return this.prefix+ ++this.id},t}();Tt.global=new Tt("global");var St=new Tt("TmpCId."),At="undefined"==typeof Symbol?"__aliases__":Symbol("[[Aliases]]"),Rt="__cid__";function bt(t){return"number"==typeof t||t instanceof Number}function Ct(t){return"string"==typeof t||t instanceof String}function wt(t){for(var e in t)return!1;return!0}var It,Ot=(It={value:void 0,enumerable:!1,writable:!1,configurable:!0},function(t,e,i,n,r){It.value=i,It.writable=n,It.enumerable=r,Object.defineProperty(t,e,It),It.value=void 0}),xt=function(){var t={get:void 0,set:void 0,enumerable:!1};return function(e,i,n,r,s,a){void 0===s&&(s=!1),void 0===a&&(a=!1),"boolean"==typeof r&&(s=r,r=void 0),t.get=n,t.set=r,t.enumerable=s,t.configurable=a,Object.defineProperty(e,i,t),t.get=void 0,t.set=void 0}}(),Pt=function(){var t={get:void 0,enumerable:!1,configurable:!1};return function(e,i,n,r,s){t.get=n,t.enumerable=r,t.configurable=s,Object.defineProperty(e,i,t),t.get=void 0}}(),Dt=function(){var t={set:void 0,enumerable:!1,configurable:!1};return function(e,i,n,r,s){t.set=n,t.enumerable=r,t.configurable=s,Object.defineProperty(e,i,t),t.set=void 0}}();function Bt(t){var e=Object.create(null);return t&&(e["."]=1,e["/"]=1,delete e["."],delete e["/"]),e}function Nt(t){if("function"==typeof t){var e=t.prototype;if(e&&e.hasOwnProperty("__classname__")&&e.__classname__)return e.__classname__;var i="";if(t.name&&(i=t.name),t.toString){var n,r=t.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 t&&t.constructor?Nt(t.constructor):""}function Mt(t,e,i,n){var r=/([^.]+)$/,s=r.exec(e)[0],a=r.exec(i)[0];function o(){return this[a]}n?xt(t,s,o,(function(t){this[a]=t})):Pt(t,s,o)}function Lt(t,e,i,n){for(var r in i)Mt(t,e+"."+r,i[r],n)}var Ft=/(%d)|(%s)/,Ut=/%s/;function Gt(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];if(0===arguments.length)return"";if(0===i.length)return""+t;var r="string"==typeof t&&Ft.test(t);if(r)for(var s,a=y(i);!(s=a()).done;){var o=s.value,u="number"==typeof o?Ft:Ut;if(u.test(t)){var h=""+o;t=t.replace(u,h)}else t+=" "+o}else for(var l,c=y(i);!(l=c()).done;){var _=l.value;t+=" "+_}return t}function kt(){for(var t=arguments.length-1,e=new Array(t),i=0;i<t;++i)e[i]=arguments[i+1];return e}function zt(t,e){for(;t;){var i=Object.getOwnPropertyDescriptor(t,e);if(i)return i;t=Object.getPrototypeOf(t)}return null}function Ht(t,e,i){var n=zt(e,t);n&&Object.defineProperty(i,t,n)}function Vt(t){t=t||{};for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;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){K(5402,a);continue}for(var o in a)o in t||Ht(o,a,t)}}return t}function Wt(t){t=t||{};for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;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){K(5403,a);continue}for(var o in a)Ht(o,a,t)}}return t}function Xt(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);return t.prototype=Object.create(e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),t}function jt(t){var e=t.prototype,i=e&&Object.getPrototypeOf(e);return i&&i.constructor}function Yt(t,e){if(t&&e){if("function"!=typeof t)return!1;if("function"!=typeof e)return!1;if(t===e)return!0;for(;;){if(!(t=jt(t)))return!1;if(t===e)return!0}}return!1}function Kt(t){for(var e=0,i=Object.keys(t);e<i.length;e++)delete t[i[e]]}var qt=Bt(!0),Qt=Bt(!0);function Zt(t,e,i){return function(n,r){if(r.prototype.hasOwnProperty(t)&&delete e[r.prototype[t]],Ot(r.prototype,t,n),n){var s=e[n];!i&&s&&s!==r?F("A Class already exists with the same "+t+' : "'+n+'".'):e[n]=r}}}var Jt=Zt("__cid__",qt,!1),$t=Zt("__classname__",Qt,!0);function te(t,e){if($t(t,e),!e.prototype.hasOwnProperty(Rt)){var i=t||St.getNewId();i&&Jt(i,e)}}function ee(t,e){var i=Qt[e],n=qt[e],r=!0;if(i&&i!==t&&(F('"'+e+'" has already been set as name or alias of another class.'),r=!1),n&&n!==t&&(F('"'+e+'" has already been set as id or alias of another class.'),r=!1),r){var s=t[At];s||(s=[],t[At]=s),s.push(e),Qt[e]=t,qt[e]=t}}function ie(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];for(var n=0,r=e;n<r.length;n++){var s=r[n],a=s.prototype,o=a.__cid__;o&&delete qt[o];var u=a.__classname__;u&&delete Qt[u];var h=a[At];if(h)for(var l=0;l<h.length;++l){var c=h[l];delete Qt[c],delete qt[c]}}}function ne(t){return re(t)}function re(t){return qt[t]}function se(t){return Qt[t]}function ae(t,e){return oe(t,e)}function oe(t,e){if(e=void 0===e||e,"function"==typeof t&&t.prototype.hasOwnProperty(Rt))return t.prototype.__cid__;if(t&&t.constructor){var i=t.constructor.prototype;if(i&&i.hasOwnProperty(Rt))return t.__cid__}return""}var ue=function(){var t=e.prototype;function e(t,e){this.count=void 0,this._pool=void 0,this._cleanup=void 0;var i=void 0===e?t:e,n=void 0===e?null:t;this.count=0,this._pool=new Array(i),this._cleanup=n}return t.get=function(){return this._get()},t._get=function(){if(this.count>0){--this.count;var t=this._pool[this.count];return this._pool[this.count]=null,t}return null},t.put=function(t){var e=this._pool;if(this.count<e.length){if(this._cleanup&&!1===this._cleanup(t))return;e[this.count]=t,++this.count}},t.resize=function(t){t>=0&&(this._pool.length=t,this.count>t&&(this.count=t))},e}(),he=Et,le={IDGenerator:Tt,Pool:ue,array:Et,isNumber:bt,isString:Ct,isEmptyObject:wt,getPropertyDescriptor:zt,addon:Vt,mixin:Wt,extend:Xt,getSuper:jt,isChildClassOf:Yt,clear:Kt,value:Ot,getset:xt,get:Pt,set:Dt,unregisterClass:ie,getClassName:Nt,setClassName:te,setClassAlias:ee,getClassByName:se,getClassById:re,get _registeredClassNames(){return l({},Qt)},set _registeredClassNames(t){Kt(Qt),Object.assign(Qt,t)},get _registeredClassIds(){return l({},qt)},set _registeredClassIds(t){Kt(qt),Object.assign(qt,t)},_getClassId:ae,getClassId:oe,_setClassId:Jt,_getClassById:ne,obsolete:Mt,obsoletes:Lt,formatStr:Gt,shiftArguments:kt,createMap:Bt};function ce(t){if("__bitmask__"in t)return t;Ot(t,"__bitmask__",null,!0);for(var e=-1,i=Object.keys(t),n=0;n<i.length;n++){var r=i[n],s=t[r];if(-1===s)s=++e,t[r]=s;else if("number"==typeof s)e=s;else if("string"==typeof s&&Number.isInteger(parseFloat(r)))continue;var a=""+s;r!==a&&Ot(t,a,r)}return t}function _e(t){return"__enums__"in t?t:(Ot(t,"__enums__",null,!0),_e.update(t))}function fe(t){t.hasOwnProperty("__enums__")}function de(t){fe(t);var e=t.__enums__||[];for(var i in e.length=0,t){var n=t[i];Number.isInteger(n)&&e.push({name:i,value:n})}return e.sort((function(t,e){return t.value-e.value})),t.__enums__=e,e}function pe(t){"__enums__"in t||Ot(t,"__enums__",null,!0)}b.js=le,t("js",Object.freeze({__proto__:null,array:he,js:le,IDGenerator:Tt,Pool:ue,isNumber:bt,isString:Ct,isEmptyObject:wt,value:Ot,getset:xt,get:Pt,set:Dt,createMap:Bt,getClassName:Nt,obsolete:Mt,obsoletes:Lt,formatStr:Gt,shiftArguments:kt,getPropertyDescriptor:zt,copyAllProperties:function(t,e,i){for(var n=Object.getOwnPropertyNames(t),r=0,s=n.length;r<s;++r){var a=n[r];-1===i.indexOf(a)&&Ht(a,t,e)}},addon:Vt,mixin:Wt,extend:Xt,getSuper:jt,isChildClassOf:Yt,clear:Kt,_idToClass:qt,_nameToClass:Qt,_setClassId:Jt,setClassName:te,setClassAlias:ee,unregisterClass:ie,_getClassById:ne,getClassById:re,getClassByName:se,_getClassId:ae,getClassId:oe})),ce.isBitMask=function(t){return t&&t.hasOwnProperty("__bitmask__")},ce.getList=function(t){if(t.__bitmask__)return t.__bitmask__;var e=t.__bitmask__=[];for(var i in t){var n=t[i];Number.isInteger(n)&&e.push({name:i,value:n})}return e.sort((function(t,e){return t.value-e.value})),e},b.BitMask=ce,_e.update=function(t){for(var e=-1,i=Object.keys(t),n=0;n<i.length;n++){var r=i[n],s=t[r];if(-1===s)s=++e,t[r]=s;else if("number"==typeof s)e=s;else if("string"==typeof s&&Number.isInteger(parseFloat(r)))continue;var a=""+s;r!==a&&Ot(t,a,r)}return Array.isArray(t.__enums__)&&de(t),t},_e||(_e=t("Enum",{})),_e.isEnum=function(t){return t&&t.hasOwnProperty("__enums__")},_e.getList=function(t){return fe(t),t.__enums__?t.__enums__:de(t)},b.Enum=_e;var me,ge=t("ValueType",function(){function t(){}var e=t.prototype;return e.clone=function(){return K(100,Nt(this)+".clone"),this},e.equals=function(){return!1},e.set=function(){K(100,Nt(this)+".set")},e.toString=function(){return""},t}());te("cc.ValueType",ge),b.ValueType=ge,function(t){t.PATH="path",t.ENGINE="engine",t.ASSETS="assets",t.SCRIPTING="scripting",t.PHYSICS="physics",t.RENDERING="rendering",t.LAUNCH="launch",t.SCREEN="screen",t.SPLASH_SCREEN="splashScreen",t.ANIMATION="animation",t.PROFILING="profiling",t.PLUGINS="plugins"}(me||(me={}));var ve=t("Settings",function(){function t(){this._settings={},this._override={}}var e=t.prototype;return e.init=function(t,e){var i=this;for(var n in void 0===t&&(t=""),void 0===e&&(e={}),e){var r=e[n];if(r)for(var s in r)this.overrideSettings(n,s,r[s])}return t?new Promise((function(e,n){var r=new XMLHttpRequest;r.open("GET",t),r.responseType="text",r.onload=function(){i._settings=JSON.parse(r.response),e()},r.onerror=function(){n(new Error("request settings failed!"))},r.send(null)})):Promise.resolve()},e.overrideSettings=function(t,e,i){t in this._override||(this._override[t]={}),this._override[t][e]=i},e.querySettings=function(t,e){if(t in this._override){var i=this._override[t];if(i&&e in i)return i[e]}if(t in this._settings){var n=this._settings[t];if(n&&e in n)return n[e]}return null},t}());ve.Category=me;var ye=t("settings",new ve);b.settings=ye;var Ee=t("macro",{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 t=ye.querySettings(ve.Category.ENGINE,"macros");if(t)for(var e in t)Ee[e]=t[e]}});b.macro=Ee;for(var Te=/^(?:cc|dragonBones|sp|ccsg)\..+/,Se=new Array(123),Ae=0;Ae<123;++Ae)Se[Ae]=64;for(var Re=0;Re<64;++Re)Se["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charCodeAt(Re)]=Re;var be=Se;function Ce(t,e,i){function n(t,e,i,n){var r=Object.getOwnPropertyDescriptor(t,e);if(r)r.get&&(t[i]=r.get),r.set&&n&&(t[n]=r.set);else{var s=t[i];xt(t,e,s,t[n])}}for(var r,s=t.prototype,a=0;a<e.length;a++){var o=(r=e[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 we(t,e,i,n){var r=t[e];r?Array.isArray(r)?n?(r.push(r[0]),r[0]=i):r.push(i):t[e]=n?[i,r]:[r,i]:t[e]=i}function Ie(t,e){if("function"==typeof t.contains)return t.contains(e);if("function"==typeof t.compareDocumentPosition)return!!(16&t.compareDocumentPosition(e));var i=e.parentNode;if(i)do{if(i===t)return!0;i=i.parentNode}while(null!==i);return!1}function Oe(t){return"object"==typeof window&&"function"==typeof Node?t instanceof Node:!!t&&"object"==typeof t&&"number"==typeof t.nodeType&&"string"==typeof t.nodeName}function xe(t,e,i){t&&setTimeout((function(){t(e,i)}),0)}function Pe(t){return!(!t||t.constructor!==Object)&&wt(t)}function De(t,e,i){if(e>i){var n=e;e=i,i=n}return t<e?e:t<i?t:i}function Be(t){return t*Ee.RAD}function Ne(t){return t*Ee.DEG}b.misc={BUILTIN_CLASSID_RE:Te,BASE64_VALUES:be,propertyDefine:Ce,pushToMap:we,contains:Ie,isDomNode:Oe,callInNextTick:xe,isPlainEmptyObj_DEV:Pe,clampf:De,degreesToRadians:Be,radiansToDegrees:Ne},t("misc",Object.freeze({__proto__:null,BUILTIN_CLASSID_RE:Te,BASE64_VALUES:be,propertyDefine:Ce,pushToMap:we,contains:Ie,isDomNode:Oe,callInNextTick:xe,tryCatchFunctor_EDITOR:function(t){return Function("target","try {\n target."+t+"();\n}\ncatch (e) {\n cc._throw(e);\n}")},isPlainEmptyObj_DEV:Pe,clampf:De,degreesToRadians:Be,radiansToDegrees:Ne}));var Me="$_$";function Le(t,e){var i=e?Object.create(e):{};return Ot(t,"__attrs__",i),i}function Fe(t){if("function"!=typeof t)return Le(t,Ge(t.constructor));for(var e,i=b.Class.getInheritanceChain(t),n=i.length-1;n>=0;n--){var r=i[n];r.hasOwnProperty("__attrs__")&&r.__attrs__||Le(r,(e=i[n+1])&&e.__attrs__)}return Le(t,(e=i[0])&&e.__attrs__),t.__attrs__}function Ue(t,e){var i=Ge(t),n=e+Me,r={};for(var s in i)s.startsWith(n)&&(r[s.slice(n.length)]=i[s]);return r}function Ge(t){return t.hasOwnProperty("__attrs__")&&t.__attrs__||Fe(t)}function ke(t,e,i,n){Ge(t)[e+Me+i]=n}var ze=function(){function t(t,e){this.name=void 0,this.default=void 0,this.name=t,this.default=e}return t.prototype.toString=function(){return this.name},t}(),He=t("CCInteger",new ze("Integer",0));b.Integer=He,b.CCInteger=He;var Ve=t("CCFloat",new ze("Float",0));b.Float=Ve,b.CCFloat=Ve;var We=t("CCBoolean",new ze("Boolean",!1));b.Boolean=We,b.CCBoolean=We;var Xe=t("CCString",new ze("String",""));function je(t,e){return function(i,n){var r='"'+Nt(i)+"."+n+'"',s=Ue(i,n),a=s.type;if(a===He||a===Ve?a="Number":a!==Xe&&a!==We||(a=""+a),a===t){if(s.hasOwnProperty("default")){var o=s.default;if(void 0!==o&&!Array.isArray(o)&&!Pe(o)){var u=typeof o,h=t.toLowerCase();if(u===h)if("object"===h){if(!o||o instanceof s.ctor)return;j(3605,r,Nt(s.ctor))}else"Number"!==t&&j(3606,e,r,t);else{if("function"===u)return;t===Xe.default&&null==o?j(3607,r):j(3611,e,r,u)}delete s.type}}}else j(3604,r)}}b.String=Xe,b.CCString=Xe;var Ye=Object.freeze({__proto__:null,DELIMETER:Me,createAttrsSingle:Le,createAttrs:Fe,attr:Ue,getClassAttrs:Ge,setClassAttr:ke,PrimitiveType:ze,CCInteger:He,CCFloat:Ve,CCBoolean:We,CCString:Xe,getTypeChecker_ET:je,getObjTypeChecker_ET:function(t){return function(e,i){je("Object","type")(e,i);var n=Ge(e)[i+Me+"default"],r=b.Class.getDefault(n);if(!Array.isArray(r)&&Yt(t,b.ValueType)){var s=Nt(t),a=Gt('No need to specify the "type" of "%s.%s" because %s is a child class of ValueType.',Nt(e),i,s);n?M(a):j(3612,a,s,Nt(e),i,s)}}}}),Ke={default:{},serializable:{},editorOnly:{},formerlySerializedAs:{}};function qe(t,e,i,n){if(!t.get&&!t.set&&t.hasOwnProperty("default")){var r="_N$"+e;t.get=function(){return this[r]},t.set=function(t){var e=this[r];this[r]=t,i.call(this,e)};var s={};for(var a in n[r]=s,Ke){var o=Ke[a];t.hasOwnProperty(a)&&(s[a]=t[a],o.canUsedInGet||delete t[a])}}}function Qe(t,e,i,n){if(Array.isArray(e)){if(!(e.length>0))return K(5508,i,n);t.type=e=e[0]}"function"==typeof e&&(e===String?t.type=b.String:e===Boolean?t.type=b.Boolean:e===Number&&(t.type=b.Float))}function Ze(t,e,i){var n=t?{_short:!0}:{_short:!0,default:e};return i&&(n.type=i),n}function Je(t,e){if(!t||t.constructor!==Object){if(Array.isArray(t)&&t.length>0)return Ze(e,[],t);if("function"==typeof t){var i=t;return Ze(e,Yt(i,b.ValueType)?new i:null,i)}return Ze(e,t instanceof ze?t.default:t)}return null}var $e,ti=[];function ei(){return ti[ti.length-1]}b._RF={push:function(t,e,i,n){void 0===i&&(i=e,e=""),ti.push({uuid:e,script:i,module:t,exports:t.exports,beh:null,importMeta:n})},pop:function(){var t=ti.pop(),e=t.module,i=e.exports;if(i===t.exports){for(var n in i)return;e.exports=i=t.cls}},peek:ei},function(t){t[t.STANDALONE=1]="STANDALONE",t[t.IMPLICIT_VISIBLE=2]="IMPLICIT_VISIBLE",t[t.IMPLICIT_SERIALIZABLE=4]="IMPLICIT_SERIALIZABLE"}($e||($e={}));var ii=Me,ni="__ctors__",ri="Enum",si="BitMask";function ai(t,e,i,n){!function(t,e){!function(t,e){t.indexOf(e)<0&&t.push(e)}(t.__props__,e)}(t,i),_i(t,n,e,i)}function oi(t,e,i,n){var r=n.get;n.set,r&&(_i(t,n,e,i),ke(t,i,"serializable",!1))}function ui(t){return"function"==typeof t?t():t}function hi(t){var e=t.name,i=t.extends,n=function(t,e,i){var n=b.Component,r=ei();if(r&&Yt(e,n)){if(Yt(r.cls,n))return K(3615),null;t=t||r.script}var s=function(t,e,i){var n=i.ctor;return Ot(n,ni,!0,!0),n.prototype,e&&(n.$super=e),te(t,n),n}(t,e,i);if(r)if(Yt(e,n)){var a=r.uuid;a&&Jt(a,s),r.cls=s}else Yt(r.cls,n)||(r.cls=s);return s}(e,i,t);e||(e=b.js.getClassName(n)),n._sealed=!0,i&&(i._sealed=!1),function(t,e,i,n){if(t.__props__=[],n&&n.__props__&&(t.__props__=n.__props__.slice()),i)for(var r in function(t,e){for(var i in t){var n=t[i],r=Je(n,!1);if(r&&(n=t[i]=r),n){var s=n.notify;s&&qe(n,i,s,t),"type"in n&&Qe(n,n.type,e,i)}}}(i,e),i){var s=i[r];s.get||s.set?oi(t,e,r,s):ai(t,e,r,s)}var a=Ge(t);t.__values__=t.__props__.filter((function(t){return!1!==a[t+ii+"serializable"]}))}(n,e,t.properties,i);var r=t.editor;return r&&Yt(i,b.Component)&&b.Component._registerEditorProps(n,r),n}function li(t){var e;return null==t||null===(e=t.hasOwnProperty)||void 0===e?void 0:e.call(t,"__values__")}hi._isCCClass=function(t){var e;return null==t||null===(e=t.hasOwnProperty)||void 0===e?void 0:e.call(t,ni)},hi.fastDefine=function(t,e,i){te(t,e);for(var n=e.__props__=e.__values__=Object.keys(i),r=Ge(e),s=0;s<n.length;s++){var a=n[s];r[a+ii+"visible"]=!1,r[a+ii+"default"]=i[a]}},hi.Attr=Ye,hi.attr=Ue,hi.isCCClassOrFastDefined=li,hi.getInheritanceChain=function(t){for(var e=[];t=jt(t);)t!==Object&&e.push(t);return e};var ci={Integer:"Number",Float:"Number",Boolean:"Boolean",String:"String"};function _i(t,e,i,n){var r=null,s="";function a(){return s=n+ii,r=Ge(t)}"type"in e&&void 0===e.type&&j(3660,n,i);var o=e.type;o&&(ci[o]?(r||a())[s+"type"]=o:"Object"===o||("object"==typeof o?_e.isEnum(o)?((r||a())[s+"type"]=ri,r[s+"enumList"]=_e.getList(o)):ce.isBitMask(o)&&((r||a())[s+"type"]=si,r[s+"bitmaskList"]=ce.getList(o)):"function"==typeof o&&((r||a())[s+"type"]="Object",r[s+"ctor"]=o))),"default"in e&&((r||a())[s+"default"]=e.default);var u,h=function(t,i){if(t in e){var n=e[t];typeof n===i&&((r||a())[s+t]=n)}};e.editorOnly&&((r||a())[s+"editorOnly"]=!0),e.__internalFlags&$e.STANDALONE?u=!0===e.serializable||0!=(e.__internalFlags&$e.IMPLICIT_SERIALIZABLE):!1===e.serializable&&(u=!1),void 0!==u&&((r||a())[s+"serializable"]=u),h("formerlySerializedAs","string");var l=e.range;l&&Array.isArray(l)&&l.length>=2&&((r||a())[s+"min"]=l[0],r[s+"max"]=l[1],l.length>2&&(r[s+"step"]=l[2])),h("min","number"),h("max","number"),h("step","number")}hi.isArray=function(t){return t=ui(t),Array.isArray(t)},hi.getDefault=ui,hi.escapeForJS=function(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")},hi.IDENTIFIER_RE=/^[A-Za-z_$][0-9A-Za-z_$]*$/,hi.getNewValueTypeCode=function(t){for(var e=Nt(t),i=t.constructor,n="new "+e+"(",r=0;r<i.__props__.length;r++)n+=t[i.__props__[r]],r<i.__props__.length-1&&(n+=",");return n+")"},b.Class=hi;var fi=Math.PI/180,di=180/Math.PI,pi=t("EPSILON",1e-6);function mi(t,e){return Math.abs(t-e)<=pi*Math.max(1,Math.abs(t),Math.abs(e))}function gi(t,e,i){return i=i||pi,Math.abs(t-e)<=i}function vi(t,e,i){if(e>i){var n=e;e=i,i=n}return t<e?e:t>i?i:t}function yi(t){return t<0?0:t>1?1:t}function Ei(t,e,i){return t+(e-t)*i}function Ti(t){return t*fi}function Si(t){return t*di}var Ai=t("random",Math.random);function Ri(t,e){return Math.random()*(e-t)+t}function bi(t,e){return Math.floor(Ri(t,e))}function Ci(t){return(t=(9301*t+49297)%233280)/233280}function wi(t,e,i){return Ci(t)*(i-e)+e}function Ii(t,e,i){return Math.floor(wi(t,e,i))}function Oi(t){return--t,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t}function xi(t,e){return t-Math.floor(t/e)*e}function Pi(t,e){return t=xi(t,2*e),e-Math.abs(t-e)}function Di(t,e,i){return(i-t)/(e-t)}function Bi(t){return Math.abs(t.x)>Math.abs(t.y)?Math.abs(t.x)>Math.abs(t.z)?t.x:t.z:Math.abs(t.y)>Math.abs(t.z)?t.y:t.z}function Ni(t,e){return Math.abs(t)>Math.abs(e)?t:e}function Mi(t,e){e.forEach((function(e){Object.defineProperty(t,e,{enumerable:!0})}))}var Li=t("Vec4",function(t){function e(e,i,n,r){var s;return s=t.call(this)||this,e&&"object"==typeof e?(s.x=e.x,s.y=e.y,s.z=e.z,s.w=e.w):(s.x=e||0,s.y=i||0,s.z=n||0,s.w=r||0),s}c(e,t),e.clone=function(t){return new e(t.x,t.y,t.z,t.w)},e.copy=function(t,e){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t},e.set=function(t,e,i,n,r){return t.x=e,t.y=i,t.z=n,t.w=r,t},e.add=function(t,e,i){return t.x=e.x+i.x,t.y=e.y+i.y,t.z=e.z+i.z,t.w=e.w+i.w,t},e.subtract=function(t,e,i){return t.x=e.x-i.x,t.y=e.y-i.y,t.z=e.z-i.z,t.w=e.w-i.w,t},e.multiply=function(t,e,i){return t.x=e.x*i.x,t.y=e.y*i.y,t.z=e.z*i.z,t.w=e.w*i.w,t},e.divide=function(t,e,i){return t.x=e.x/i.x,t.y=e.y/i.y,t.z=e.z/i.z,t.w=e.w/i.w,t},e.ceil=function(t,e){return t.x=Math.ceil(e.x),t.y=Math.ceil(e.y),t.z=Math.ceil(e.z),t.w=Math.ceil(e.w),t},e.floor=function(t,e){return t.x=Math.floor(e.x),t.y=Math.floor(e.y),t.z=Math.floor(e.z),t.w=Math.floor(e.w),t},e.min=function(t,e,i){return t.x=Math.min(e.x,i.x),t.y=Math.min(e.y,i.y),t.z=Math.min(e.z,i.z),t.w=Math.min(e.w,i.w),t},e.max=function(t,e,i){return t.x=Math.max(e.x,i.x),t.y=Math.max(e.y,i.y),t.z=Math.max(e.z,i.z),t.w=Math.max(e.w,i.w),t},e.round=function(t,e){return t.x=Math.round(e.x),t.y=Math.round(e.y),t.z=Math.round(e.z),t.w=Math.round(e.w),t},e.multiplyScalar=function(t,e,i){return t.x=e.x*i,t.y=e.y*i,t.z=e.z*i,t.w=e.w*i,t},e.scaleAndAdd=function(t,e,i,n){return t.x=e.x+i.x*n,t.y=e.y+i.y*n,t.z=e.z+i.z*n,t.w=e.w+i.w*n,t},e.distance=function(t,e){var i=e.x-t.x,n=e.y-t.y,r=e.z-t.z,s=e.w-t.w;return Math.sqrt(i*i+n*n+r*r+s*s)},e.squaredDistance=function(t,e){var i=e.x-t.x,n=e.y-t.y,r=e.z-t.z,s=e.w-t.w;return i*i+n*n+r*r+s*s},e.len=function(t){var e=t.x,i=t.y,n=t.z,r=t.w;return Math.sqrt(e*e+i*i+n*n+r*r)},e.lengthSqr=function(t){var e=t.x,i=t.y,n=t.z,r=t.w;return e*e+i*i+n*n+r*r},e.negate=function(t,e){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t},e.inverse=function(t,e){return t.x=1/e.x,t.y=1/e.y,t.z=1/e.z,t.w=1/e.w,t},e.inverseSafe=function(t,e){var i=e.x,n=e.y,r=e.z,s=e.w;return Math.abs(i)<pi?t.x=0:t.x=1/i,Math.abs(n)<pi?t.y=0:t.y=1/n,Math.abs(r)<pi?t.z=0:t.z=1/r,Math.abs(s)<pi?t.w=0:t.w=1/s,t},e.normalize=function(t,e){var i=e.x,n=e.y,r=e.z,s=e.w,a=i*i+n*n+r*r+s*s;return a>0&&(a=1/Math.sqrt(a),t.x=i*a,t.y=n*a,t.z=r*a,t.w=s*a),t},e.dot=function(t,e){return t.x*e.x+t.y*e.y+t.z*e.z+t.w*e.w},e.lerp=function(t,e,i,n){return t.x=e.x+n*(i.x-e.x),t.y=e.y+n*(i.y-e.y),t.z=e.z+n*(i.z-e.z),t.w=e.w+n*(i.w-e.w),t},e.random=function(t,e){e=e||1;var i=2*Ai()*Math.PI,n=2*Ai()-1,r=Math.sqrt(1-n*n);return t.x=r*Math.cos(i)*e,t.y=r*Math.sin(i)*e,t.z=n*e,t.w=0,t},e.transformMat4=function(t,e,i){var n=e.x,r=e.y,s=e.z,a=e.w;return t.x=i.m00*n+i.m04*r+i.m08*s+i.m12*a,t.y=i.m01*n+i.m05*r+i.m09*s+i.m13*a,t.z=i.m02*n+i.m06*r+i.m10*s+i.m14*a,t.w=i.m03*n+i.m07*r+i.m11*s+i.m15*a,t},e.transformAffine=function(t,e,i){var n=e.x,r=e.y,s=e.z,a=e.w;return t.x=i.m00*n+i.m04*r+i.m08*s+i.m12*a,t.y=i.m01*n+i.m05*r+i.m09*s+i.m13*a,t.z=i.m02*n+i.m06*r+i.m10*s+i.m14*a,t.w=e.w,t},e.transformQuat=function(t,e,i){var n=e.x,r=e.y,s=e.z,a=i.x,o=i.y,u=i.z,h=i.w,l=h*n+o*s-u*r,c=h*r+u*n-a*s,_=h*s+a*r-o*n,f=-a*n-o*r-u*s;return t.x=l*h+f*-a+c*-u-_*-o,t.y=c*h+f*-o+_*-a-l*-u,t.z=_*h+f*-u+l*-o-c*-a,t.w=e.w,t},e.toArray=function(t,e,i){return void 0===i&&(i=0),t[i+0]=e.x,t[i+1]=e.y,t[i+2]=e.z,t[i+3]=e.w,t},e.fromArray=function(t,e,i){return void 0===i&&(i=0),t.x=e[i+0],t.y=e[i+1],t.z=e[i+2],t.w=e[i+3],t},e.strictEquals=function(t,e){return t.x===e.x&&t.y===e.y&&t.z===e.z&&t.w===e.w},e.equals=function(t,e,i){return void 0===i&&(i=pi),Math.abs(t.x-e.x)<=i*Math.max(1,Math.abs(t.x),Math.abs(e.x))&&Math.abs(t.y-e.y)<=i*Math.max(1,Math.abs(t.y),Math.abs(e.y))&&Math.abs(t.z-e.z)<=i*Math.max(1,Math.abs(t.z),Math.abs(e.z))&&Math.abs(t.w-e.w)<=i*Math.max(1,Math.abs(t.w),Math.abs(e.w))};var i=e.prototype;return i.clone=function(){return new e(this.x,this.y,this.z,this.w)},i.set=function(t,e,i,n){return t&&"object"==typeof t?(this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w):(this.x=t||0,this.y=e||0,this.z=i||0,this.w=n||0),this},i.equals=function(t,e){return void 0===e&&(e=pi),Math.abs(this.x-t.x)<=e*Math.max(1,Math.abs(this.x),Math.abs(t.x))&&Math.abs(this.y-t.y)<=e*Math.max(1,Math.abs(this.y),Math.abs(t.y))&&Math.abs(this.z-t.z)<=e*Math.max(1,Math.abs(this.z),Math.abs(t.z))&&Math.abs(this.w-t.w)<=e*Math.max(1,Math.abs(this.w),Math.abs(t.w))},i.equals4f=function(t,e,i,n,r){return void 0===r&&(r=pi),Math.abs(this.x-t)<=r*Math.max(1,Math.abs(this.x),Math.abs(t))&&Math.abs(this.y-e)<=r*Math.max(1,Math.abs(this.y),Math.abs(e))&&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(t){return this.x===t.x&&this.y===t.y&&this.z===t.z&&this.w===t.w},i.strictEquals4f=function(t,e,i,n){return this.x===t&&this.y===e&&this.z===i&&this.w===n},i.lerp=function(t,e){var i=this.x,n=this.y,r=this.z,s=this.w;return this.x=i+e*(t.x-i),this.y=n+e*(t.y-n),this.z=r+e*(t.z-r),this.w=s+e*(t.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(t,e){return this.x=vi(this.x,t.x,e.x),this.y=vi(this.y,t.y,e.y),this.z=vi(this.z,t.z,e.z),this.w=vi(this.w,t.w,e.w),this},i.add=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this},i.add4f=function(t,e,i,n){return this.x+=t,this.y+=e,this.z+=i,this.w+=n,this},i.subtract=function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this},i.subtract4f=function(t,e,i,n){return this.x-=t,this.y-=e,this.z-=i,this.w-=n,this},i.multiplyScalar=function(t){return"object"==typeof t&&console.warn("should use Vec4.multiply for vector * vector operation"),this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},i.multiply=function(t){return"object"!=typeof t&&console.warn("should use Vec4.scale for vector * scalar operation"),this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this},i.multiply4f=function(t,e,i,n){return this.x*=t,this.y*=e,this.z*=i,this.w*=n,this},i.divide=function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this},i.divide4f=function(t,e,i,n){return this.x/=t,this.y/=e,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(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},i.cross=function(t){var e=this.x,i=this.y,n=this.z,r=t.x,s=t.y,a=t.z;return this.x=i*a-n*s,this.y=n*r-e*a,this.z=e*s-i*r,this},i.length=function(){var t=this.x,e=this.y,i=this.z,n=this.w;return Math.sqrt(t*t+e*e+i*i+n*n)},i.lengthSqr=function(){var t=this.x,e=this.y,i=this.z,n=this.w;return t*t+e*e+i*i+n*n},i.normalize=function(){var t=this.x,e=this.y,i=this.z,n=this.w,r=t*t+e*e+i*i+n*n;return r>0&&(r=1/Math.sqrt(r),this.x=t*r,this.y=e*r,this.z=i*r,this.w=n*r),this},i.transformMat4=function(t){var e=this.x,i=this.y,n=this.z,r=this.w;return this.x=t.m00*e+t.m04*i+t.m08*n+t.m12*r,this.y=t.m01*e+t.m05*i+t.m09*n+t.m13*r,this.z=t.m02*e+t.m06*i+t.m10*n+t.m14*r,this.w=t.m03*e+t.m07*i+t.m11*n+t.m15*r,this},e}(ge));function Fi(t,e,i,n){return new Li(t,e,i,n)}Li.ZERO=Object.freeze(new Li(0,0,0,0)),Li.ONE=Object.freeze(new Li(1,1,1,1)),Li.NEG_ONE=Object.freeze(new Li(-1,-1,-1,-1)),hi.fastDefine("cc.Vec4",Li,{x:0,y:0,z:0,w:0}),b.Vec4=Li,b.v4=Fi;var Ui=1/255,Gi=t("Color",function(t){function e(e,i,n,r){var s;return(s=t.call(this)||this)._val=0,"string"==typeof e?s.fromHEX(e):void 0!==i?s.set(e,i,n,r):s.set(e),s}c(e,t),e.clone=function(t){var i=new e;return t._val?i._val=t._val:i._val=(t.a<<24>>>0)+(t.b<<16)+(t.g<<8)+t.r,i},e.copy=function(t,e){return t.r=e.r,t.g=e.g,t.b=e.b,t.a=e.a,t},e.set=function(t,e,i,n,r){return t.r=e,t.g=i,t.b=n,t.a=r,t},e.toVec4=function(t,e){return(e=void 0!==e?e:new Li).x=zi(t.r),e.y=zi(t.g),e.z=zi(t.b),e.w=zi(t.a),e},e.fromVec4=function(t,i){return(i=void 0===i?new e:i).r=Hi(t.x),i.g=Hi(t.y),i.b=Hi(t.z),i.a=Hi(t.w),i},e.fromHEX=function(t,e){e=0===e.indexOf("#")?e.substring(1):e,t.r=parseInt(e.substr(0,2),16)||0,t.g=parseInt(e.substr(2,2),16)||0,t.b=parseInt(e.substr(4,2),16)||0;var i=parseInt(e.substr(6,2),16);return t.a=Number.isNaN(i)?255:i,t._val=(t.a<<24>>>0)+(t.b<<16)+(t.g<<8)+t.r,t},e.add=function(t,e,i){return t.r=e.r+i.r,t.g=e.g+i.g,t.b=e.b+i.b,t.a=e.a+i.a,t},e.subtract=function(t,e,i){return t.r=e.r-i.r,t.g=e.g-i.g,t.b=e.b-i.b,t.a=e.a-i.a,t},e.multiply=function(t,e,i){return t.r=e.r*i.r,t.g=e.g*i.g,t.b=e.b*i.b,t.a=e.a*i.a,t},e.divide=function(t,e,i){return t.r=e.r/i.r,t.g=e.g/i.g,t.b=e.b/i.b,t.a=e.a/i.a,t},e.scale=function(t,e,i){return t.r=e.r*i,t.g=e.g*i,t.b=e.b*i,t.a=e.a*i,t},e.lerp=function(t,e,i,n){var r=e.r,s=e.g,a=e.b,o=e.a;return r+=(i.r-r)*n,s+=(i.g-s)*n,a+=(i.b-a)*n,o+=(i.a-o)*n,t._val=Math.floor((o<<24>>>0)+(a<<16)+(s<<8)+r),t},e.toArray=function(t,i,n){void 0===n&&(n=0);var r=i instanceof e||i.a>1?1/255:1;return t[n+0]=i.r*r,t[n+1]=i.g*r,t[n+2]=i.b*r,t[n+3]=i.a*r,t},e.fromArray=function(t,e,i){return void 0===i&&(i=0),e.r=255*t[i+0],e.g=255*t[i+1],e.b=255*t[i+2],e.a=255*t[i+3],e},e.strictEquals=function(t,e){return t.r===e.r&&t.g===e.g&&t.b===e.b&&t.a===e.a},e.equals=function(t,e,i){return void 0===i&&(i=pi),Math.abs(t.r-e.r)<=i*Math.max(1,Math.abs(t.r),Math.abs(e.r))&&Math.abs(t.g-e.g)<=i*Math.max(1,Math.abs(t.g),Math.abs(e.g))&&Math.abs(t.b-e.b)<=i*Math.max(1,Math.abs(t.b),Math.abs(e.b))&&Math.abs(t.a-e.a)<=i*Math.max(1,Math.abs(t.a),Math.abs(e.a))},e.hex=function(t){return(255*t.r<<24|255*t.g<<16|255*t.b<<8|255*t.a)>>>0};var i=e.prototype;return i.clone=function(){var t=new e;return t._val=this._val,t},i.equals=function(t){return t&&this._val===t._val},i.lerp=function(t,e){var i=this.r,n=this.g,r=this.b,s=this.a;return i+=(t.r-i)*e,n+=(t.g-n)*e,r+=(t.b-r)*e,s+=(t.a-s)*e,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(t){return void 0===t&&(t="rgba"),"rgba"===t?"rgba("+this.r+","+this.g+","+this.b+","+(this.a*Ui).toFixed(2)+")":"rgb"===t?"rgb("+this.r+","+this.g+","+this.b+")":"#"+this.toHEX(t)},i.fromHEX=function(t){t=0===t.indexOf("#")?t.substring(1):t;var e=parseInt(t.substr(0,2),16)||0,i=parseInt(t.substr(2,2),16)||0,n=parseInt(t.substr(4,2),16)||0,r=parseInt(t.substr(6,2),16);return r=Number.isNaN(r)?255:r,this._val=(r<<24>>>0)+(n<<16)+(i<<8)+(0|e),this},i.toHEX=function(t){void 0===t&&(t="#rrggbb");var e="0",i=[(this.r<16?e:"")+this.r.toString(16),(this.g<16?e:"")+this.g.toString(16),(this.b<16?e:"")+this.b.toString(16)];return"#rgb"===t?(i[0]=i[0][0],i[1]=i[1][0],i[2]=i[2][0]):"#rrggbbaa"===t&&i.push((this.a<16?e:"")+this.a.toString(16)),i.join("")},i.toRGBValue=function(){return 16777215&this._val},i.fromHSV=function(t,e,i){var n=0,r=0,s=0;if(0===e)n=r=s=i;else if(0===i)n=r=s=0;else{1===t&&(t=0),t*=6;var a=Math.floor(t),o=t-a,u=i*(1-e),h=i*(1-e*o),l=i*(1-e*(1-o));switch(a){default:case 0:n=i,r=l,s=u;break;case 1:n=h,r=i,s=u;break;case 2:n=u,r=i,s=l;break;case 3:n=u,r=h,s=i;break;case 4:n=l,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 t=this.r*Ui,e=this.g*Ui,i=this.b*Ui,n={h:0,s:0,v:0},r=Math.max(t,e,i),s=Math.min(t,e,i),a=0;return n.v=r,n.s=r?(r-s)/r:0,n.s?(a=r-s,n.h=t===r?(e-i)/a:e===r?2+(i-t)/a:4+(t-e)/a,n.h/=6,n.h<0&&(n.h+=1)):n.h=0,n},i.set=function(t,e,i,n){return"object"==typeof t?null!=t._val?this._val=t._val:(e=t.g||0,i=t.b||0,n="number"==typeof t.a?t.a:255,t=t.r||0,this._val=(n<<24>>>0)+(i<<16)+(e<<8)+(0|t)):(t=t||0,e=e||0,i=i||0,n="number"==typeof n?n:255,this._val=(n<<24>>>0)+(i<<16)+(e<<8)+(0|t)),this},i.multiply=function(t){var e=(255&this._val)*t.r>>8,i=(65280&this._val)*t.g>>8,n=(16711680&this._val)*t.b>>8,r=((4278190080&this._val)>>>8)*t.a;return this._val=4278190080&r|16711680&n|65280&i|255&e,this},i._set_r_unsafe=function(t){return this._val=(4294967040&this._val|t)>>>0,this},i._set_g_unsafe=function(t){return this._val=(4294902015&this._val|t<<8)>>>0,this},i._set_b_unsafe=function(t){return this._val=(4278255615&this._val|t<<16)>>>0,this},i._set_a_unsafe=function(t){return this._val=(16777215&this._val|t<<24)>>>0,this},h(e,[{key:"r",get:function(){return 255&this._val},set:function(t){t=~~vi(t,0,255),this._val=(4294967040&this._val|t)>>>0}},{key:"g",get:function(){return(65280&this._val)>>8},set:function(t){t=~~vi(t,0,255),this._val=(4294902015&this._val|t<<8)>>>0}},{key:"b",get:function(){return(16711680&this._val)>>16},set:function(t){t=~~vi(t,0,255),this._val=(4278255615&this._val|t<<16)>>>0}},{key:"a",get:function(){return(4278190080&this._val)>>>24},set:function(t){t=~~vi(t,0,255),this._val=(16777215&this._val|t<<24)>>>0}},{key:"x",get:function(){return this.r*Ui},set:function(t){this.r=255*t}},{key:"y",get:function(){return this.g*Ui},set:function(t){this.g=255*t}},{key:"z",get:function(){return this.b*Ui},set:function(t){this.b=255*t}},{key:"w",get:function(){return this.a*Ui},set:function(t){this.a=255*t}}]),e}(ge));function ki(t,e,i,n){return new Gi(t,e,i,n)}function zi(t){if((0|t)!==t||t>>>8!=0)throw new RangeError("Value out of 8-bit range");return Wi[t]}function Hi(t){if(t<=0)return 0;var e=Wi;if(t>=1)return e.length-1;for(var i=0,n=e.length>>>1;0!==n;n>>>=1)e[i|n]<=t&&(i|=n);return t-e[i]<=e[i+1]-t?i:i+1}Gi.WHITE=Object.freeze(new Gi(255,255,255,255)),Gi.GRAY=Object.freeze(new Gi(127,127,127,255)),Gi.BLACK=Object.freeze(new Gi(0,0,0,255)),Gi.TRANSPARENT=Object.freeze(new Gi(0,0,0,0)),Gi.RED=Object.freeze(new Gi(255,0,0,255)),Gi.GREEN=Object.freeze(new Gi(0,255,0,255)),Gi.BLUE=Object.freeze(new Gi(0,0,255,255)),Gi.CYAN=Object.freeze(new Gi(0,255,255,255)),Gi.MAGENTA=Object.freeze(new Gi(255,0,255,255)),Gi.YELLOW=Object.freeze(new Gi(255,255,0,255)),hi.fastDefine("cc.Color",Gi,{r:0,g:0,b:0,a:255}),b.Color=Gi,b.color=ki;for(var Vi,Wi=[],Xi=0;Xi<256;Xi++)Wi.push((Vi=Xi/255)<=0?0:Vi>=1?1:Vi<.04045?Vi/12.92:Math.pow((Vi+.055)/1.055,2.4));var ji=t("Vec3",function(t){function e(e,i,n){var r;return r=t.call(this)||this,e&&"object"==typeof e?(r.x=e.x,r.y=e.y,r.z=e.z):(r.x=e||0,r.y=i||0,r.z=n||0),r}c(e,t),e.zero=function(t){return t.x=0,t.y=0,t.z=0,t},e.clone=function(t){return new e(t.x,t.y,t.z)},e.copy=function(t,e){return t.x=e.x,t.y=e.y,t.z=e.z,t},e.set=function(t,e,i,n){return t.x=e,t.y=i,t.z=n,t},e.add=function(t,e,i){return t.x=e.x+i.x,t.y=e.y+i.y,t.z=e.z+i.z,t},e.subtract=function(t,e,i){return t.x=e.x-i.x,t.y=e.y-i.y,t.z=e.z-i.z,t},e.multiply=function(t,e,i){return t.x=e.x*i.x,t.y=e.y*i.y,t.z=e.z*i.z,t},e.divide=function(t,e,i){return t.x=e.x/i.x,t.y=e.y/i.y,t.z=e.z/i.z,t},e.ceil=function(t,e){return t.x=Math.ceil(e.x),t.y=Math.ceil(e.y),t.z=Math.ceil(e.z),t},e.floor=function(t,e){return t.x=Math.floor(e.x),t.y=Math.floor(e.y),t.z=Math.floor(e.z),t},e.min=function(t,e,i){return t.x=Math.min(e.x,i.x),t.y=Math.min(e.y,i.y),t.z=Math.min(e.z,i.z),t},e.max=function(t,e,i){return t.x=Math.max(e.x,i.x),t.y=Math.max(e.y,i.y),t.z=Math.max(e.z,i.z),t},e.round=function(t,e){return t.x=Math.round(e.x),t.y=Math.round(e.y),t.z=Math.round(e.z),t},e.multiplyScalar=function(t,e,i){return t.x=e.x*i,t.y=e.y*i,t.z=e.z*i,t},e.scaleAndAdd=function(t,e,i,n){return t.x=e.x+i.x*n,t.y=e.y+i.y*n,t.z=e.z+i.z*n,t},e.distance=function(t,e){var i=e.x-t.x,n=e.y-t.y,r=e.z-t.z;return Math.sqrt(i*i+n*n+r*r)},e.squaredDistance=function(t,e){var i=e.x-t.x,n=e.y-t.y,r=e.z-t.z;return i*i+n*n+r*r},e.len=function(t){var e=t.x,i=t.y,n=t.z;return Math.sqrt(e*e+i*i+n*n)},e.lengthSqr=function(t){var e=t.x,i=t.y,n=t.z;return e*e+i*i+n*n},e.negate=function(t,e){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t},e.invert=function(t,e){return t.x=1/e.x,t.y=1/e.y,t.z=1/e.z,t},e.invertSafe=function(t,e){var i=e.x,n=e.y,r=e.z;return Math.abs(i)<pi?t.x=0:t.x=1/i,Math.abs(n)<pi?t.y=0:t.y=1/n,Math.abs(r)<pi?t.z=0:t.z=1/r,t},e.normalize=function(t,e){var i=e.x,n=e.y,r=e.z,s=i*i+n*n+r*r;return s>0&&(s=1/Math.sqrt(s),t.x=i*s,t.y=n*s,t.z=r*s),t},e.dot=function(t,e){return t.x*e.x+t.y*e.y+t.z*e.z},e.cross=function(t,e,i){var n=e.x,r=e.y,s=e.z,a=i.x,o=i.y,u=i.z;return t.x=r*u-s*o,t.y=s*a-n*u,t.z=n*o-r*a,t},e.lerp=function(t,e,i,n){return t.x=e.x+n*(i.x-e.x),t.y=e.y+n*(i.y-e.y),t.z=e.z+n*(i.z-e.z),t},e.random=function(t,e){e=e||1;var i=2*Ai()*Math.PI,n=2*Ai()-1,r=Math.sqrt(1-n*n);return t.x=r*Math.cos(i)*e,t.y=r*Math.sin(i)*e,t.z=n*e,t},e.transformMat4=function(t,e,i){var n=e.x,r=e.y,s=e.z,a=i.m03*n+i.m07*r+i.m11*s+i.m15;return a=a?Math.abs(1/a):1,t.x=(i.m00*n+i.m04*r+i.m08*s+i.m12)*a,t.y=(i.m01*n+i.m05*r+i.m09*s+i.m13)*a,t.z=(i.m02*n+i.m06*r+i.m10*s+i.m14)*a,t},e.transformMat4Normal=function(t,e,i){var n=e.x,r=e.y,s=e.z,a=i.m03*n+i.m07*r+i.m11*s;return a=a?Math.abs(1/a):1,t.x=(i.m00*n+i.m04*r+i.m08*s)*a,t.y=(i.m01*n+i.m05*r+i.m09*s)*a,t.z=(i.m02*n+i.m06*r+i.m10*s)*a,t},e.transformMat3=function(t,e,i){var n=e.x,r=e.y,s=e.z;return t.x=n*i.m00+r*i.m03+s*i.m06,t.y=n*i.m01+r*i.m04+s*i.m07,t.z=n*i.m02+r*i.m05+s*i.m08,t},e.transformAffine=function(t,e,i){var n=e.x,r=e.y,s=e.z;return t.x=i.m00*n+i.m04*r+i.m08*s+i.m12,t.y=i.m01*n+i.m05*r+i.m09*s+i.m13,t.z=i.m02*n+i.m06*r+i.m10*s+i.m14,t},e.transformQuat=function(t,e,i){var n=i.w*e.x+i.y*e.z-i.z*e.y,r=i.w*e.y+i.z*e.x-i.x*e.z,s=i.w*e.z+i.x*e.y-i.y*e.x,a=-i.x*e.x-i.y*e.y-i.z*e.z;return t.x=n*i.w+a*-i.x+r*-i.z-s*-i.y,t.y=r*i.w+a*-i.y+s*-i.x-n*-i.z,t.z=s*i.w+a*-i.z+n*-i.y-r*-i.x,t},e.transformRTS=function(t,e,i,n,r){var s=e.x*r.x,a=e.y*r.y,o=e.z*r.z,u=i.w*s+i.y*o-i.z*a,h=i.w*a+i.z*s-i.x*o,l=i.w*o+i.x*a-i.y*s,c=-i.x*s-i.y*a-i.z*o;return t.x=u*i.w+c*-i.x+h*-i.z-l*-i.y+n.x,t.y=h*i.w+c*-i.y+l*-i.x-u*-i.z+n.y,t.z=l*i.w+c*-i.z+u*-i.y-h*-i.x+n.z,t},e.transformInverseRTS=function(t,e,i,n,r){var s=e.x-n.x,a=e.y-n.y,o=e.z-n.z,u=i.w*s-i.y*o+i.z*a,h=i.w*a-i.z*s+i.x*o,l=i.w*o-i.x*a+i.y*s,c=i.x*s+i.y*a+i.z*o;return t.x=(u*i.w+c*i.x+h*i.z-l*i.y)/r.x,t.y=(h*i.w+c*i.y+l*i.x-u*i.z)/r.y,t.z=(l*i.w+c*i.z+u*i.y-h*i.x)/r.z,t},e.rotateX=function(t,e,i,n){var r=e.x-i.x,s=e.y-i.y,a=e.z-i.z,o=Math.cos(n),u=Math.sin(n),h=r,l=s*o-a*u,c=s*u+a*o;return t.x=h+i.x,t.y=l+i.y,t.z=c+i.z,t},e.rotateY=function(t,e,i,n){var r=e.x-i.x,s=e.y-i.y,a=e.z-i.z,o=Math.cos(n),u=Math.sin(n),h=a*u+r*o,l=s,c=a*o-r*u;return t.x=h+i.x,t.y=l+i.y,t.z=c+i.z,t},e.rotateZ=function(t,e,i,n){var r=e.x-i.x,s=e.y-i.y,a=e.z-i.z,o=Math.cos(n),u=Math.sin(n),h=r*o-s*u,l=r*u+s*o,c=a;return t.x=h+i.x,t.y=l+i.y,t.z=c+i.z,t},e.toArray=function(t,e,i){return void 0===i&&(i=0),t[i+0]=e.x,t[i+1]=e.y,t[i+2]=e.z,t},e.fromArray=function(t,e,i){return void 0===i&&(i=0),t.x=e[i+0],t.y=e[i+1],t.z=e[i+2],t},e.strictEquals=function(t,e){return t.x===e.x&&t.y===e.y&&t.z===e.z},e.equals=function(t,e,i){void 0===i&&(i=pi);var n=t.x,r=t.y,s=t.z,a=e.x,o=e.y,u=e.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))},e.angle=function(t,i){e.normalize(Yi,t),e.normalize(Ki,i);var n=e.dot(Yi,Ki);return n>1?0:n<-1?Math.PI:Math.acos(n)},e.projectOnPlane=function(t,i,n){return e.subtract(t,i,e.project(t,i,n))},e.project=function(t,i,n){var r=e.lengthSqr(n);return r<1e-6?e.set(t,0,0,0):e.multiplyScalar(t,n,e.dot(i,n)/r)};var i=e.prototype;return i.clone=function(){return new e(this.x,this.y,this.z)},i.set=function(t,e,i){return t&&"object"==typeof t?(this.x=t.x,this.y=t.y,this.z=t.z):(this.x=t||0,this.y=e||0,this.z=i||0),this},i.equals=function(t,e){return void 0===e&&(e=pi),Math.abs(this.x-t.x)<=e*Math.max(1,Math.abs(this.x),Math.abs(t.x))&&Math.abs(this.y-t.y)<=e*Math.max(1,Math.abs(this.y),Math.abs(t.y))&&Math.abs(this.z-t.z)<=e*Math.max(1,Math.abs(this.z),Math.abs(t.z))},i.equals3f=function(t,e,i,n){return void 0===n&&(n=pi),Math.abs(this.x-t)<=n*Math.max(1,Math.abs(this.x),Math.abs(t))&&Math.abs(this.y-e)<=n*Math.max(1,Math.abs(this.y),Math.abs(e))&&Math.abs(this.z-i)<=n*Math.max(1,Math.abs(this.z),Math.abs(i))},i.strictEquals=function(t){return this.x===t.x&&this.y===t.y&&this.z===t.z},i.strictEquals3f=function(t,e,i){return this.x===t&&this.y===e&&this.z===i},i.toString=function(){return"("+this.x.toFixed(2)+", "+this.y.toFixed(2)+", "+this.z.toFixed(2)+")"},i.lerp=function(t,e){return this.x+=e*(t.x-this.x),this.y+=e*(t.y-this.y),this.z+=e*(t.z-this.z),this},i.add=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this},i.add3f=function(t,e,i){return this.x+=t,this.y+=e,this.z+=i,this},i.subtract=function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this},i.subtract3f=function(t,e,i){return this.x-=t,this.y-=e,this.z-=i,this},i.multiplyScalar=function(t){return"object"==typeof t&&console.warn("should use Vec3.multiply for vector * vector operation"),this.x*=t,this.y*=t,this.z*=t,this},i.multiply=function(t){return"object"!=typeof t&&console.warn("should use Vec3.scale for vector * scalar operation"),this.x*=t.x,this.y*=t.y,this.z*=t.z,this},i.multiply3f=function(t,e,i){return this.x*=t,this.y*=e,this.z*=i,this},i.divide=function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},i.divide3f=function(t,e,i){return this.x/=t,this.y/=e,this.z/=i,this},i.negative=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},i.clampf=function(t,e){return this.x=vi(this.x,t.x,e.x),this.y=vi(this.y,t.y,e.y),this.z=vi(this.z,t.z,e.z),this},i.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},i.cross=function(t){var e=this.x,i=this.y,n=this.z,r=t.x,s=t.y,a=t.z;return this.x=i*a-n*s,this.y=n*r-e*a,this.z=e*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 t=this.x,e=this.y,i=this.z,n=t*t+e*e+i*i;return n>0&&(n=1/Math.sqrt(n),this.x=t*n,this.y=e*n,this.z=i*n),this},i.transformMat4=function(t){var e=this.x,i=this.y,n=this.z,r=t.m03*e+t.m07*i+t.m11*n+t.m15;return r=r?1/r:1,this.x=(t.m00*e+t.m04*i+t.m08*n+t.m12)*r,this.y=(t.m01*e+t.m05*i+t.m09*n+t.m13)*r,this.z=(t.m02*e+t.m06*i+t.m10*n+t.m14)*r,this},e}(ge));ji.UNIT_X=Object.freeze(new ji(1,0,0)),ji.UNIT_Y=Object.freeze(new ji(0,1,0)),ji.UNIT_Z=Object.freeze(new ji(0,0,1)),ji.RIGHT=Object.freeze(new ji(1,0,0)),ji.UP=Object.freeze(new ji(0,1,0)),ji.FORWARD=Object.freeze(new ji(0,0,-1)),ji.ZERO=Object.freeze(new ji(0,0,0)),ji.ONE=Object.freeze(new ji(1,1,1)),ji.NEG_ONE=Object.freeze(new ji(-1,-1,-1));var Yi=new ji,Ki=new ji;function qi(t,e,i){return new ji(t,e,i)}hi.fastDefine("cc.Vec3",ji,{x:0,y:0,z:0}),b.Vec3=ji,b.v3=qi;var Qi=t("Mat3",function(t){function e(e,i,n,r,s,a,o,u,h){var l;return void 0===e&&(e=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),l=t.call(this)||this,"object"==typeof e?(l.m00=e.m00,l.m01=e.m01,l.m02=e.m02,l.m03=e.m03,l.m04=e.m04,l.m05=e.m05,l.m06=e.m06,l.m07=e.m07,l.m08=e.m08):(l.m00=e,l.m01=i,l.m02=n,l.m03=r,l.m04=s,l.m05=a,l.m06=o,l.m07=u,l.m08=h),l}c(e,t),e.clone=function(t){return new e(t.m00,t.m01,t.m02,t.m03,t.m04,t.m05,t.m06,t.m07,t.m08)},e.copy=function(t,e){return t.m00=e.m00,t.m01=e.m01,t.m02=e.m02,t.m03=e.m03,t.m04=e.m04,t.m05=e.m05,t.m06=e.m06,t.m07=e.m07,t.m08=e.m08,t},e.set=function(t,e,i,n,r,s,a,o,u,h){return t.m00=e,t.m01=i,t.m02=n,t.m03=r,t.m04=s,t.m05=a,t.m06=o,t.m07=u,t.m08=h,t},e.identity=function(t){return t.m00=1,t.m01=0,t.m02=0,t.m03=0,t.m04=1,t.m05=0,t.m06=0,t.m07=0,t.m08=1,t},e.transpose=function(t,e){if(t===e){var i=e.m01,n=e.m02,r=e.m05;t.m01=e.m03,t.m02=e.m06,t.m03=i,t.m05=e.m07,t.m06=n,t.m07=r}else t.m00=e.m00,t.m01=e.m03,t.m02=e.m06,t.m03=e.m01,t.m04=e.m04,t.m05=e.m07,t.m06=e.m02,t.m07=e.m05,t.m08=e.m08;return t},e.invert=function(t,e){var i=e.m00,n=e.m01,r=e.m02,s=e.m03,a=e.m04,o=e.m05,u=e.m06,h=e.m07,l=e.m08,c=l*a-o*h,_=-l*s+o*u,f=h*s-a*u,d=i*c+n*_+r*f;return 0===d?(t.m00=0,t.m01=0,t.m02=0,t.m03=0,t.m04=0,t.m05=0,t.m06=0,t.m07=0,t.m08=0,t):(d=1/d,t.m00=c*d,t.m01=(-l*n+r*h)*d,t.m02=(o*n-r*a)*d,t.m03=_*d,t.m04=(l*i-r*u)*d,t.m05=(-o*i+r*s)*d,t.m06=f*d,t.m07=(-h*i+n*u)*d,t.m08=(a*i-n*s)*d,t)},e.determinant=function(t){var e=t.m00,i=t.m01,n=t.m02,r=t.m03,s=t.m04,a=t.m05,o=t.m06,u=t.m07,h=t.m08;return e*(h*s-a*u)+i*(-h*r+a*o)+n*(u*r-s*o)},e.multiply=function(t,e,i){var n=e.m00,r=e.m01,s=e.m02,a=e.m03,o=e.m04,u=e.m05,h=e.m06,l=e.m07,c=e.m08,_=i.m00,f=i.m01,d=i.m02,p=i.m03,m=i.m04,g=i.m05,v=i.m06,y=i.m07,E=i.m08;return t.m00=_*n+f*a+d*h,t.m01=_*r+f*o+d*l,t.m02=_*s+f*u+d*c,t.m03=p*n+m*a+g*h,t.m04=p*r+m*o+g*l,t.m05=p*s+m*u+g*c,t.m06=v*n+y*a+E*h,t.m07=v*r+y*o+E*l,t.m08=v*s+y*u+E*c,t},e.multiplyMat4=function(t,e,i){var n=e.m00,r=e.m01,s=e.m02,a=e.m03,o=e.m04,u=e.m05,h=e.m06,l=e.m07,c=e.m08,_=i.m00,f=i.m01,d=i.m02,p=i.m04,m=i.m05,g=i.m06,v=i.m08,y=i.m09,E=i.m10;return t.m00=_*n+f*a+d*h,t.m01=_*r+f*o+d*l,t.m02=_*s+f*u+d*c,t.m03=p*n+m*a+g*h,t.m04=p*r+m*o+g*l,t.m05=p*s+m*u+g*c,t.m06=v*n+y*a+E*h,t.m07=v*r+y*o+E*l,t.m08=v*s+y*u+E*c,t},e.transform=function(t,e,i){var n=e.m00,r=e.m01,s=e.m02,a=e.m03,o=e.m04,u=e.m05,h=e.m06,l=e.m07,c=e.m08,_=i.x,f=i.y;return t.m00=n,t.m01=r,t.m02=s,t.m03=a,t.m04=o,t.m05=u,t.m06=_*n+f*a+h,t.m07=_*r+f*o+l,t.m08=_*s+f*u+c,t},e.scale=function(t,e,i){var n=i.x,r=i.y;return t.m00=n*e.m00,t.m01=n*e.m01,t.m02=n*e.m02,t.m03=r*e.m03,t.m04=r*e.m04,t.m05=r*e.m05,t.m06=e.m06,t.m07=e.m07,t.m08=e.m08,t},e.rotate=function(t,e,i){var n=e.m00,r=e.m01,s=e.m02,a=e.m03,o=e.m04,u=e.m05,h=e.m06,l=e.m07,c=e.m08,_=Math.sin(i),f=Math.cos(i);return t.m00=f*n+_*a,t.m01=f*r+_*o,t.m02=f*s+_*u,t.m03=f*a-_*n,t.m04=f*o-_*r,t.m05=f*u-_*s,t.m06=h,t.m07=l,t.m08=c,t},e.fromMat4=function(t,e){return t.m00=e.m00,t.m01=e.m01,t.m02=e.m02,t.m03=e.m04,t.m04=e.m05,t.m05=e.m06,t.m06=e.m08,t.m07=e.m09,t.m08=e.m10,t},e.fromViewUp=function(t,i,n){return ji.lengthSqr(i)<pi*pi?(e.identity(t),t):(n=n||ji.UNIT_Y,ji.normalize(Zi,ji.cross(Zi,n,i)),ji.lengthSqr(Zi)<pi*pi?(e.identity(t),t):(ji.cross(Ji,i,Zi),e.set(t,Zi.x,Zi.y,Zi.z,Ji.x,Ji.y,Ji.z,i.x,i.y,i.z),t))},e.fromTranslation=function(t,e){return t.m00=1,t.m01=0,t.m02=0,t.m03=0,t.m04=1,t.m05=0,t.m06=e.x,t.m07=e.y,t.m08=1,t},e.fromScaling=function(t,e){return t.m00=e.x,t.m01=0,t.m02=0,t.m03=0,t.m04=e.y,t.m05=0,t.m06=0,t.m07=0,t.m08=1,t},e.fromRotation=function(t,e){var i=Math.sin(e),n=Math.cos(e);return t.m00=n,t.m01=i,t.m02=0,t.m03=-i,t.m04=n,t.m05=0,t.m06=0,t.m07=0,t.m08=1,t},e.fromQuat=function(t,e){var i=e.x,n=e.y,r=e.z,s=e.w,a=i+i,o=n+n,u=r+r,h=i*a,l=n*a,c=n*o,_=r*a,f=r*o,d=r*u,p=s*a,m=s*o,g=s*u;return t.m00=1-c-d,t.m03=l-g,t.m06=_+m,t.m01=l+g,t.m04=1-h-d,t.m07=f-p,t.m02=_-m,t.m05=f+p,t.m08=1-h-c,t},e.inverseTransposeMat4=function(t,e){var i=e.m00,n=e.m01,r=e.m02,s=e.m03,a=e.m04,o=e.m05,u=e.m06,h=e.m07,l=e.m08,c=e.m09,_=e.m10,f=e.m11,d=e.m12,p=e.m13,m=e.m14,g=e.m15,v=i*o-n*a,y=i*u-r*a,E=i*h-s*a,T=n*u-r*o,S=n*h-s*o,A=r*h-s*u,R=l*p-c*d,b=l*m-_*d,C=l*g-f*d,w=c*m-_*p,I=c*g-f*p,O=_*g-f*m,x=v*O-y*I+E*w+T*C-S*b+A*R;return x?(x=1/x,t.m00=(o*O-u*I+h*w)*x,t.m01=(u*C-a*O-h*b)*x,t.m02=(a*I-o*C+h*R)*x,t.m03=(r*I-n*O-s*w)*x,t.m04=(i*O-r*C+s*b)*x,t.m05=(n*C-i*I-s*R)*x,t.m06=(p*A-m*S+g*T)*x,t.m07=(m*E-d*A-g*y)*x,t.m08=(d*S-p*E+g*v)*x,t):null},e.toArray=function(t,e,i){return void 0===i&&(i=0),t[i+0]=e.m00,t[i+1]=e.m01,t[i+2]=e.m02,t[i+3]=e.m03,t[i+4]=e.m04,t[i+5]=e.m05,t[i+6]=e.m06,t[i+7]=e.m07,t[i+8]=e.m08,t},e.fromArray=function(t,e,i){return void 0===i&&(i=0),t.m00=e[i+0],t.m01=e[i+1],t.m02=e[i+2],t.m03=e[i+3],t.m04=e[i+4],t.m05=e[i+5],t.m06=e[i+6],t.m07=e[i+7],t.m08=e[i+8],t},e.add=function(t,e,i){return t.m00=e.m00+i.m00,t.m01=e.m01+i.m01,t.m02=e.m02+i.m02,t.m03=e.m03+i.m03,t.m04=e.m04+i.m04,t.m05=e.m05+i.m05,t.m06=e.m06+i.m06,t.m07=e.m07+i.m07,t.m08=e.m08+i.m08,t},e.subtract=function(t,e,i){return t.m00=e.m00-i.m00,t.m01=e.m01-i.m01,t.m02=e.m02-i.m02,t.m03=e.m03-i.m03,t.m04=e.m04-i.m04,t.m05=e.m05-i.m05,t.m06=e.m06-i.m06,t.m07=e.m07-i.m07,t.m08=e.m08-i.m08,t},e.multiplyScalar=function(t,e,i){return t.m00=e.m00*i,t.m01=e.m01*i,t.m02=e.m02*i,t.m03=e.m03*i,t.m04=e.m04*i,t.m05=e.m05*i,t.m06=e.m06*i,t.m07=e.m07*i,t.m08=e.m08*i,t},e.multiplyScalarAndAdd=function(t,e,i,n){return t.m00=i.m00*n+e.m00,t.m01=i.m01*n+e.m01,t.m02=i.m02*n+e.m02,t.m03=i.m03*n+e.m03,t.m04=i.m04*n+e.m04,t.m05=i.m05*n+e.m05,t.m06=i.m06*n+e.m06,t.m07=i.m07*n+e.m07,t.m08=i.m08*n+e.m08,t},e.strictEquals=function(t,e){return t.m00===e.m00&&t.m01===e.m01&&t.m02===e.m02&&t.m03===e.m03&&t.m04===e.m04&&t.m05===e.m05&&t.m06===e.m06&&t.m07===e.m07&&t.m08===e.m08},e.equals=function(t,e,i){return void 0===i&&(i=pi),Math.abs(t.m00-e.m00)<=i*Math.max(1,Math.abs(t.m00),Math.abs(e.m00))&&Math.abs(t.m01-e.m01)<=i*Math.max(1,Math.abs(t.m01),Math.abs(e.m01))&&Math.abs(t.m02-e.m02)<=i*Math.max(1,Math.abs(t.m02),Math.abs(e.m02))&&Math.abs(t.m03-e.m03)<=i*Math.max(1,Math.abs(t.m03),Math.abs(e.m03))&&Math.abs(t.m04-e.m04)<=i*Math.max(1,Math.abs(t.m04),Math.abs(e.m04))&&Math.abs(t.m05-e.m05)<=i*Math.max(1,Math.abs(t.m05),Math.abs(e.m05))&&Math.abs(t.m06-e.m06)<=i*Math.max(1,Math.abs(t.m06),Math.abs(e.m06))&&Math.abs(t.m07-e.m07)<=i*Math.max(1,Math.abs(t.m07),Math.abs(e.m07))&&Math.abs(t.m08-e.m08)<=i*Math.max(1,Math.abs(t.m08),Math.abs(e.m08))};var i=e.prototype;return i.clone=function(){var t=this;return new e(t.m00,t.m01,t.m02,t.m03,t.m04,t.m05,t.m06,t.m07,t.m08)},i.set=function(t,e,i,n,r,s,a,o,u){return void 0===t&&(t=1),void 0===e&&(e=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 t?(this.m00=t.m00,this.m01=t.m01,this.m02=t.m02,this.m03=t.m03,this.m04=t.m04,this.m05=t.m05,this.m06=t.m06,this.m07=t.m07,this.m08=t.m08):(this.m00=t,this.m01=e,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(t,e){return void 0===e&&(e=pi),Math.abs(this.m00-t.m00)<=e*Math.max(1,Math.abs(this.m00),Math.abs(t.m00))&&Math.abs(this.m01-t.m01)<=e*Math.max(1,Math.abs(this.m01),Math.abs(t.m01))&&Math.abs(this.m02-t.m02)<=e*Math.max(1,Math.abs(this.m02),Math.abs(t.m02))&&Math.abs(this.m03-t.m03)<=e*Math.max(1,Math.abs(this.m03),Math.abs(t.m03))&&Math.abs(this.m04-t.m04)<=e*Math.max(1,Math.abs(this.m04),Math.abs(t.m04))&&Math.abs(this.m05-t.m05)<=e*Math.max(1,Math.abs(this.m05),Math.abs(t.m05))&&Math.abs(this.m06-t.m06)<=e*Math.max(1,Math.abs(this.m06),Math.abs(t.m06))&&Math.abs(this.m07-t.m07)<=e*Math.max(1,Math.abs(this.m07),Math.abs(t.m07))&&Math.abs(this.m08-t.m08)<=e*Math.max(1,Math.abs(this.m08),Math.abs(t.m08))},i.strictEquals=function(t){return this.m00===t.m00&&this.m01===t.m01&&this.m02===t.m02&&this.m03===t.m03&&this.m04===t.m04&&this.m05===t.m05&&this.m06===t.m06&&this.m07===t.m07&&this.m08===t.m08},i.toString=function(){var t=this;return"[\n"+t.m00+", "+t.m01+", "+t.m02+",\n"+t.m03+",\n"+t.m04+", "+t.m05+",\n"+t.m06+", "+t.m07+",\n"+t.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 t=this.m01,e=this.m02,i=this.m05;return this.m01=this.m03,this.m02=this.m06,this.m03=t,this.m05=this.m07,this.m06=e,this.m07=i,this},i.invert=function(){var t=this.m00,e=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,l=-u*n+s*a,c=o*n-r*a,_=t*h+e*l+i*c;return 0===_?(this.set(0,0,0,0,0,0,0,0,0),this):(_=1/_,this.m00=h*_,this.m01=(-u*e+i*o)*_,this.m02=(s*e-i*r)*_,this.m03=l*_,this.m04=(u*t-i*a)*_,this.m05=(-s*t+i*n)*_,this.m06=c*_,this.m07=(-o*t+e*a)*_,this.m08=(r*t-e*n)*_,this)},i.determinant=function(){var t=this.m00,e=this.m01,i=this.m02,n=this.m03,r=this.m04,s=this.m05,a=this.m06,o=this.m07,u=this.m08;return t*(u*r-s*o)+e*(-u*n+s*a)+i*(o*n-r*a)},i.add=function(t){return this.m00+=t.m00,this.m01+=t.m01,this.m02+=t.m02,this.m03+=t.m03,this.m04+=t.m04,this.m05+=t.m05,this.m06+=t.m06,this.m07+=t.m07,this.m08+=t.m08,this},i.subtract=function(t){return this.m00-=t.m00,this.m01-=t.m01,this.m02-=t.m02,this.m03-=t.m03,this.m04-=t.m04,this.m05-=t.m05,this.m06-=t.m06,this.m07-=t.m07,this.m08-=t.m08,this},i.multiply=function(t){var e=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,l=t.m00,c=t.m01,_=t.m02,f=t.m03,d=t.m04,p=t.m05,m=t.m06,g=t.m07,v=t.m08;return this.m00=l*e+c*r+_*o,this.m01=l*i+c*s+_*u,this.m02=l*n+c*a+_*h,this.m03=f*e+d*r+p*o,this.m04=f*i+d*s+p*u,this.m05=f*n+d*a+p*h,this.m06=m*e+g*r+v*o,this.m07=m*i+g*s+v*u,this.m08=m*n+g*a+v*h,this},i.multiplyScalar=function(t){return this.m00*=t,this.m01*=t,this.m02*=t,this.m03*=t,this.m04*=t,this.m05*=t,this.m06*=t,this.m07*=t,this.m08*=t,this},i.scale=function(t){var e=t.x,i=t.y;return this.m00=e*this.m00,this.m01=e*this.m01,this.m02=e*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(t){var e=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,l=Math.sin(t),c=Math.cos(t);return this.m00=c*e+l*r,this.m01=c*i+l*s,this.m02=c*n+l*a,this.m03=c*r-l*e,this.m04=c*s-l*i,this.m05=c*a-l*n,this.m06=o,this.m07=u,this.m08=h,this},i.fromQuat=function(t){var e=t.x,i=t.y,n=t.z,r=t.w,s=e+e,a=i+i,o=n+n,u=e*s,h=i*s,l=i*a,c=n*s,_=n*a,f=n*o,d=r*s,p=r*a,m=r*o;return this.m00=1-l-f,this.m03=h-m,this.m06=c+p,this.m01=h+m,this.m04=1-u-f,this.m07=_-d,this.m02=c-p,this.m05=_+d,this.m08=1-u-l,this},e}(ge));Qi.IDENTITY=Object.freeze(new Qi);var Zi=new ji,Ji=new ji;hi.fastDefine("cc.Mat3",Qi,{m00:1,m01:0,m02:0,m03:0,m04:1,m05:0,m06:0,m07:0,m08:1}),b.Mat3=Qi;var $i=t("Quat",function(t){function e(e,i,n,r){var s;return s=t.call(this)||this,e&&"object"==typeof e?(s.x=e.x,s.y=e.y,s.z=e.z,s.w=e.w):(s.x=e||0,s.y=i||0,s.z=n||0,s.w=null!=r?r:1),s}c(e,t),e.clone=function(t){return new e(t.x,t.y,t.z,t.w)},e.copy=function(t,e){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t},e.set=function(t,e,i,n,r){return t.x=e,t.y=i,t.z=n,t.w=r,t},e.identity=function(t){return t.x=0,t.y=0,t.z=0,t.w=1,t},e.rotationTo=function(t,i,n){var r=ji.dot(i,n);return r<-.999999?(ji.cross(nn,ji.UNIT_X,i),nn.length()<1e-6&&ji.cross(nn,ji.UNIT_Y,i),ji.normalize(nn,nn),e.fromAxisAngle(t,nn,Math.PI),t):r>.999999?(t.x=0,t.y=0,t.z=0,t.w=1,t):(ji.cross(nn,i,n),t.x=nn.x,t.y=nn.y,t.z=nn.z,t.w=1+r,e.normalize(t,t))},e.getAxisAngle=function(t,e){var i=2*Math.acos(e.w),n=Math.sin(i/2);return 0!==n?(t.x=e.x/n,t.y=e.y/n,t.z=e.z/n):(t.x=1,t.y=0,t.z=0),i},e.multiply=function(t,e,i){var n=e.x*i.w+e.w*i.x+e.y*i.z-e.z*i.y,r=e.y*i.w+e.w*i.y+e.z*i.x-e.x*i.z,s=e.z*i.w+e.w*i.z+e.x*i.y-e.y*i.x,a=e.w*i.w-e.x*i.x-e.y*i.y-e.z*i.z;return t.x=n,t.y=r,t.z=s,t.w=a,t},e.multiplyScalar=function(t,e,i){return t.x=e.x*i,t.y=e.y*i,t.z=e.z*i,t.w=e.w*i,t},e.scaleAndAdd=function(t,e,i,n){return t.x=e.x+i.x*n,t.y=e.y+i.y*n,t.z=e.z+i.z*n,t.w=e.w+i.w*n,t},e.rotateX=function(t,e,i){i*=.5;var n=Math.sin(i),r=Math.cos(i),s=e.x,a=e.y,o=e.z,u=e.w;return t.x=s*r+u*n,t.y=a*r+o*n,t.z=o*r-a*n,t.w=u*r-s*n,t},e.rotateY=function(t,e,i){i*=.5;var n=Math.sin(i),r=Math.cos(i),s=e.x,a=e.y,o=e.z,u=e.w;return t.x=s*r-o*n,t.y=a*r+u*n,t.z=o*r+s*n,t.w=u*r-a*n,t},e.rotateZ=function(t,e,i){i*=.5;var n=Math.sin(i),r=Math.cos(i),s=e.x,a=e.y,o=e.z,u=e.w;return t.x=s*r+a*n,t.y=a*r-s*n,t.z=o*r+u*n,t.w=u*r-o*n,t},e.rotateAround=function(t,i,n,r){return e.invert(tn,i),ji.transformQuat(nn,n,tn),e.fromAxisAngle(tn,nn,r),e.multiply(t,i,tn),t},e.rotateAroundLocal=function(t,i,n,r){return e.fromAxisAngle(tn,n,r),e.multiply(t,i,tn),t},e.calculateW=function(t,e){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=Math.sqrt(Math.abs(1-e.x*e.x-e.y*e.y-e.z*e.z)),t},e.dot=function(t,e){return t.x*e.x+t.y*e.y+t.z*e.z+t.w*e.w},e.lerp=function(t,e,i,n){return t.x=e.x+n*(i.x-e.x),t.y=e.y+n*(i.y-e.y),t.z=e.z+n*(i.z-e.z),t.w=e.w+n*(i.w-e.w),t},e.slerp=function(t,e,i,n){var r=0,s=0,a=i.x,o=i.y,u=i.z,h=i.w,l=e.x*i.x+e.y*i.y+e.z*i.z+e.w*i.w;if(l<0&&(l=-l,a=-a,o=-o,u=-u,h=-h),1-l>1e-6){var c=Math.acos(l),_=Math.sin(c);r=Math.sin((1-n)*c)/_,s=Math.sin(n*c)/_}else r=1-n,s=n;return t.x=r*e.x+s*a,t.y=r*e.y+s*o,t.z=r*e.z+s*u,t.w=r*e.w+s*h,t},e.sqlerp=function(t,i,n,r,s,a){return e.slerp(tn,i,s,a),e.slerp(en,n,r,a),e.slerp(t,tn,en,2*a*(1-a)),t},e.invert=function(t,e){var i=e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w,n=i?1/i:0;return t.x=-e.x*n,t.y=-e.y*n,t.z=-e.z*n,t.w=e.w*n,t},e.conjugate=function(t,e){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=e.w,t},e.len=function(t){return Math.sqrt(t.x*t.x+t.y*t.y+t.z*t.z+t.w*t.w)},e.lengthSqr=function(t){return t.x*t.x+t.y*t.y+t.z*t.z+t.w*t.w},e.normalize=function(t,e){var i=e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w;return i>0&&(i=1/Math.sqrt(i),t.x=e.x*i,t.y=e.y*i,t.z=e.z*i,t.w=e.w*i),t},e.fromAxes=function(t,i,n,r){return Qi.set(rn,i.x,i.y,i.z,n.x,n.y,n.z,r.x,r.y,r.z),e.normalize(t,e.fromMat3(t,rn))},e.fromViewUp=function(t,i,n){return Qi.fromViewUp(rn,i,n),e.normalize(t,e.fromMat3(t,rn))},e.fromAxisAngle=function(t,e,i){i*=.5;var n=Math.sin(i);return t.x=n*e.x,t.y=n*e.y,t.z=n*e.z,t.w=Math.cos(i),t},e.fromMat3=function(t,e){var i=e.m00,n=e.m03,r=e.m06,s=e.m01,a=e.m04,o=e.m07,u=e.m02,h=e.m05,l=e.m08,c=i+a+l;if(c>0){var _=.5/Math.sqrt(c+1);t.w=.25/_,t.x=(h-o)*_,t.y=(r-u)*_,t.z=(s-n)*_}else if(i>a&&i>l){var f=2*Math.sqrt(1+i-a-l);t.w=(h-o)/f,t.x=.25*f,t.y=(n+s)/f,t.z=(r+u)/f}else if(a>l){var d=2*Math.sqrt(1+a-i-l);t.w=(r-u)/d,t.x=(n+s)/d,t.y=.25*d,t.z=(o+h)/d}else{var p=2*Math.sqrt(1+l-i-a);t.w=(s-n)/p,t.x=(r+u)/p,t.y=(o+h)/p,t.z=.25*p}return t},e.fromEuler=function(t,e,i,n){e*=sn,i*=sn,n*=sn;var r=Math.sin(e),s=Math.cos(e),a=Math.sin(i),o=Math.cos(i),u=Math.sin(n),h=Math.cos(n);return t.x=r*o*h+s*a*u,t.y=s*a*h+r*o*u,t.z=s*o*u-r*a*h,t.w=s*o*h-r*a*u,t},e.fromAngleZ=function(t,e){return e*=sn,t.x=t.y=0,t.z=Math.sin(e),t.w=Math.cos(e),t},e.toAxisX=function(t,e){var i=2*e.y,n=2*e.z;return t.x=1-i*e.y-n*e.z,t.y=i*e.x+n*e.w,t.z=n*e.x+i*e.w,t},e.toAxisY=function(t,e){var i=2*e.x,n=2*e.y,r=2*e.z;return t.x=n*e.x-r*e.w,t.y=1-i*e.x-r*e.z,t.z=r*e.y+i*e.w,t},e.toAxisZ=function(t,e){var i=2*e.x,n=2*e.y,r=2*e.z;return t.x=r*e.x-n*e.w,t.y=r*e.y-i*e.w,t.z=1-i*e.x-n*e.y,t},e.toEuler=function(t,e,i){var n=e.x,r=e.y,s=e.z,a=e.w,o=0,u=0,h=0,l=n*r+s*a;if(l>.499999)o=0,u=Si(2*Math.atan2(n,a)),h=90;else if(l<-.499999)o=0,u=-Si(2*Math.atan2(n,a)),h=-90;else{var c=n*n,_=r*r,f=s*s;o=Si(Math.atan2(2*n*a-2*r*s,1-2*c-2*f)),u=Si(Math.atan2(2*r*a-2*n*s,1-2*_-2*f)),h=Si(Math.asin(2*l)),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 t.x=o,t.y=u,t.z=h,t},e.toArray=function(t,e,i){return void 0===i&&(i=0),t[i+0]=e.x,t[i+1]=e.y,t[i+2]=e.z,t[i+3]=e.w,t},e.fromArray=function(t,e,i){return void 0===i&&(i=0),t.x=e[i+0],t.y=e[i+1],t.z=e[i+2],t.w=e[i+3],t},e.strictEquals=function(t,e){return t.x===e.x&&t.y===e.y&&t.z===e.z&&t.w===e.w},e.equals=function(t,e,i){return void 0===i&&(i=pi),Math.abs(t.x-e.x)<=i*Math.max(1,Math.abs(t.x),Math.abs(e.x))&&Math.abs(t.y-e.y)<=i*Math.max(1,Math.abs(t.y),Math.abs(e.y))&&Math.abs(t.z-e.z)<=i*Math.max(1,Math.abs(t.z),Math.abs(e.z))&&Math.abs(t.w-e.w)<=i*Math.max(1,Math.abs(t.w),Math.abs(e.w))};var i=e.prototype;return i.clone=function(){return new e(this.x,this.y,this.z,this.w)},i.set=function(t,e,i,n){return t&&"object"==typeof t?(this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w):(this.x=t||0,this.y=e||0,this.z=i||0,this.w=null!=n?n:1),this},i.equals=function(t,e){return void 0===e&&(e=pi),Math.abs(this.x-t.x)<=e*Math.max(1,Math.abs(this.x),Math.abs(t.x))&&Math.abs(this.y-t.y)<=e*Math.max(1,Math.abs(this.y),Math.abs(t.y))&&Math.abs(this.z-t.z)<=e*Math.max(1,Math.abs(this.z),Math.abs(t.z))&&Math.abs(this.w-t.w)<=e*Math.max(1,Math.abs(this.w),Math.abs(t.w))},i.strictEquals=function(t){return t&&this.x===t.x&&this.y===t.y&&this.z===t.z&&this.w===t.w},i.getEulerAngles=function(t){return e.toEuler(t,this)},i.lerp=function(t,e){return this.x+=e*(t.x-this.x),this.y+=e*(t.y-this.y),this.z+=e*(t.z-this.z),this.w+=e*(t.w-this.w),this},i.slerp=function(t,i){return e.slerp(this,this,t,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},e}(ge));$i.IDENTITY=Object.freeze(new $i);var tn=new $i,en=new $i,nn=new ji,rn=new Qi,sn=.5*Math.PI/180;function an(t,e,i,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1),new $i(t,e,i,n)}hi.fastDefine("cc.Quat",$i,{x:0,y:0,z:0,w:1}),b.Quat=$i,b.quat=an;var on=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])]),un=t("Mat4",function(t){function e(e,i,n,r,s,a,o,u,h,l,c,_,f,d,p,m){var g;return void 0===e&&(e=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===l&&(l=0),void 0===c&&(c=1),void 0===_&&(_=0),void 0===f&&(f=0),void 0===d&&(d=0),void 0===p&&(p=0),void 0===m&&(m=1),(g=t.call(this)||this).m00=void 0,g.m01=void 0,g.m02=void 0,g.m03=void 0,g.m04=void 0,g.m05=void 0,g.m06=void 0,g.m07=void 0,g.m08=void 0,g.m09=void 0,g.m10=void 0,g.m11=void 0,g.m12=void 0,g.m13=void 0,g.m14=void 0,g.m15=void 0,"object"==typeof e?(g.m00=e.m00,g.m01=e.m01,g.m02=e.m02,g.m03=e.m03,g.m04=e.m04,g.m05=e.m05,g.m06=e.m06,g.m07=e.m07,g.m08=e.m08,g.m09=e.m09,g.m10=e.m10,g.m11=e.m11,g.m12=e.m12,g.m13=e.m13,g.m14=e.m14,g.m15=e.m15):(g.m00=e,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=l,g.m10=c,g.m11=_,g.m12=f,g.m13=d,g.m14=p,g.m15=m),g}c(e,t),e.clone=function(t){return new e(t.m00,t.m01,t.m02,t.m03,t.m04,t.m05,t.m06,t.m07,t.m08,t.m09,t.m10,t.m11,t.m12,t.m13,t.m14,t.m15)},e.copy=function(t,e){return t.m00=e.m00,t.m01=e.m01,t.m02=e.m02,t.m03=e.m03,t.m04=e.m04,t.m05=e.m05,t.m06=e.m06,t.m07=e.m07,t.m08=e.m08,t.m09=e.m09,t.m10=e.m10,t.m11=e.m11,t.m12=e.m12,t.m13=e.m13,t.m14=e.m14,t.m15=e.m15,t},e.set=function(t,e,i,n,r,s,a,o,u,h,l,c,_,f,d,p,m){return t.m00=e,t.m01=i,t.m02=n,t.m03=r,t.m04=s,t.m05=a,t.m06=o,t.m07=u,t.m08=h,t.m09=l,t.m10=c,t.m11=_,t.m12=f,t.m13=d,t.m14=p,t.m15=m,t},e.identity=function(t){return t.m00=1,t.m01=0,t.m02=0,t.m03=0,t.m04=0,t.m05=1,t.m06=0,t.m07=0,t.m08=0,t.m09=0,t.m10=1,t.m11=0,t.m12=0,t.m13=0,t.m14=0,t.m15=1,t},e.transpose=function(t,e){if(t===e){var i=e.m01,n=e.m02,r=e.m03,s=e.m06,a=e.m07,o=e.m11;t.m01=e.m04,t.m02=e.m08,t.m03=e.m12,t.m04=i,t.m06=e.m09,t.m07=e.m13,t.m08=n,t.m09=s,t.m11=e.m14,t.m12=r,t.m13=a,t.m14=o}else t.m00=e.m00,t.m01=e.m04,t.m02=e.m08,t.m03=e.m12,t.m04=e.m01,t.m05=e.m05,t.m06=e.m09,t.m07=e.m13,t.m08=e.m02,t.m09=e.m06,t.m10=e.m10,t.m11=e.m14,t.m12=e.m03,t.m13=e.m07,t.m14=e.m11,t.m15=e.m15;return t},e.invert=function(t,e){var i=e.m00,n=e.m01,r=e.m02,s=e.m03,a=e.m04,o=e.m05,u=e.m06,h=e.m07,l=e.m08,c=e.m09,_=e.m10,f=e.m11,d=e.m12,p=e.m13,m=e.m14,g=e.m15,v=i*o-n*a,y=i*u-r*a,E=i*h-s*a,T=n*u-r*o,S=n*h-s*o,A=r*h-s*u,R=l*p-c*d,b=l*m-_*d,C=l*g-f*d,w=c*m-_*p,I=c*g-f*p,O=_*g-f*m,x=v*O-y*I+E*w+T*C-S*b+A*R;return 0===x?(t.m00=0,t.m01=0,t.m02=0,t.m03=0,t.m04=0,t.m05=0,t.m06=0,t.m07=0,t.m08=0,t.m09=0,t.m10=0,t.m11=0,t.m12=0,t.m13=0,t.m14=0,t.m15=0,t):(x=1/x,t.m00=(o*O-u*I+h*w)*x,t.m01=(r*I-n*O-s*w)*x,t.m02=(p*A-m*S+g*T)*x,t.m03=(_*S-c*A-f*T)*x,t.m04=(u*C-a*O-h*b)*x,t.m05=(i*O-r*C+s*b)*x,t.m06=(m*E-d*A-g*y)*x,t.m07=(l*A-_*E+f*y)*x,t.m08=(a*I-o*C+h*R)*x,t.m09=(n*C-i*I-s*R)*x,t.m10=(d*S-p*E+g*v)*x,t.m11=(c*E-l*S-f*v)*x,t.m12=(o*b-a*w-u*R)*x,t.m13=(i*w-n*b+r*R)*x,t.m14=(p*y-d*T-m*v)*x,t.m15=(l*T-c*y+_*v)*x,t)},e.determinant=function(t){var e=t.m00,i=t.m01,n=t.m02,r=t.m03,s=t.m04,a=t.m05,o=t.m06,u=t.m07,h=t.m08,l=t.m09,c=t.m10,_=t.m11,f=t.m12,d=t.m13,p=t.m14,m=t.m15;return(e*a-i*s)*(c*m-_*p)-(e*o-n*s)*(l*m-_*d)+(e*u-r*s)*(l*p-c*d)+(i*o-n*a)*(h*m-_*f)-(i*u-r*a)*(h*p-c*f)+(n*u-r*o)*(h*d-l*f)},e.multiply=function(t,e,i){var n=e.m00,r=e.m01,s=e.m02,a=e.m03,o=e.m04,u=e.m05,h=e.m06,l=e.m07,c=e.m08,_=e.m09,f=e.m10,d=e.m11,p=e.m12,m=e.m13,g=e.m14,v=e.m15,y=i.m00,E=i.m01,T=i.m02,S=i.m03;return t.m00=y*n+E*o+T*c+S*p,t.m01=y*r+E*u+T*_+S*m,t.m02=y*s+E*h+T*f+S*g,t.m03=y*a+E*l+T*d+S*v,y=i.m04,E=i.m05,T=i.m06,S=i.m07,t.m04=y*n+E*o+T*c+S*p,t.m05=y*r+E*u+T*_+S*m,t.m06=y*s+E*h+T*f+S*g,t.m07=y*a+E*l+T*d+S*v,y=i.m08,E=i.m09,T=i.m10,S=i.m11,t.m08=y*n+E*o+T*c+S*p,t.m09=y*r+E*u+T*_+S*m,t.m10=y*s+E*h+T*f+S*g,t.m11=y*a+E*l+T*d+S*v,y=i.m12,E=i.m13,T=i.m14,S=i.m15,t.m12=y*n+E*o+T*c+S*p,t.m13=y*r+E*u+T*_+S*m,t.m14=y*s+E*h+T*f+S*g,t.m15=y*a+E*l+T*d+S*v,t},e.transform=function(t,e,i){var n=i.x,r=i.y,s=i.z;if(e===t)t.m12=e.m00*n+e.m04*r+e.m08*s+e.m12,t.m13=e.m01*n+e.m05*r+e.m09*s+e.m13,t.m14=e.m02*n+e.m06*r+e.m10*s+e.m14,t.m15=e.m03*n+e.m07*r+e.m11*s+e.m15;else{var a=e.m00,o=e.m01,u=e.m02,h=e.m03,l=e.m04,c=e.m05,_=e.m06,f=e.m07,d=e.m08,p=e.m09,m=e.m10,g=e.m11;e.m12,e.m13,e.m14,e.m15,t.m00=a,t.m01=o,t.m02=u,t.m03=h,t.m04=l,t.m05=c,t.m06=_,t.m07=f,t.m08=d,t.m09=p,t.m10=m,t.m11=g,t.m12=a*n+l*r+d*s+e.m12,t.m13=o*n+c*r+p*s+e.m13,t.m14=u*n+_*r+m*s+e.m14,t.m15=h*n+f*r+g*s+e.m15}return t},e.translate=function(t,e,i){return e===t?(t.m12+=i.x,t.m13+=i.y,t.m14+=i.z):(t.m00=e.m00,t.m01=e.m01,t.m02=e.m02,t.m03=e.m03,t.m04=e.m04,t.m05=e.m05,t.m06=e.m06,t.m07=e.m07,t.m08=e.m08,t.m09=e.m09,t.m10=e.m10,t.m11=e.m11,t.m12+=i.x,t.m13+=i.y,t.m14+=i.z,t.m15=e.m15),t},e.scale=function(t,e,i){var n=i.x,r=i.y,s=i.z;return t.m00=e.m00*n,t.m01=e.m01*n,t.m02=e.m02*n,t.m03=e.m03*n,t.m04=e.m04*r,t.m05=e.m05*r,t.m06=e.m06*r,t.m07=e.m07*r,t.m08=e.m08*s,t.m09=e.m09*s,t.m10=e.m10*s,t.m11=e.m11*s,t.m12=e.m12,t.m13=e.m13,t.m14=e.m14,t.m15=e.m15,t},e.rotate=function(t,e,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)<pi)return null;r*=o=1/o,s*=o,a*=o;var u=Math.sin(i),h=Math.cos(i),l=1-h,c=e.m00,_=e.m01,f=e.m02,d=e.m03,p=e.m04,m=e.m05,g=e.m06,v=e.m07,y=e.m08,E=e.m09,T=e.m10,S=e.m11,A=r*r*l+h,R=s*r*l+a*u,b=a*r*l-s*u,C=r*s*l-a*u,w=s*s*l+h,I=a*s*l+r*u,O=r*a*l+s*u,x=s*a*l-r*u,P=a*a*l+h;return t.m00=c*A+p*R+y*b,t.m01=_*A+m*R+E*b,t.m02=f*A+g*R+T*b,t.m03=d*A+v*R+S*b,t.m04=c*C+p*w+y*I,t.m05=_*C+m*w+E*I,t.m06=f*C+g*w+T*I,t.m07=d*C+v*w+S*I,t.m08=c*O+p*x+y*P,t.m09=_*O+m*x+E*P,t.m10=f*O+g*x+T*P,t.m11=d*O+v*x+S*P,e!==t&&(t.m12=e.m12,t.m13=e.m13,t.m14=e.m14,t.m15=e.m15),t},e.rotateX=function(t,e,i){var n=Math.sin(i),r=Math.cos(i),s=e.m04,a=e.m05,o=e.m06,u=e.m07,h=e.m08,l=e.m09,c=e.m10,_=e.m11;return e!==t&&(t.m00=e.m00,t.m01=e.m01,t.m02=e.m02,t.m03=e.m03,t.m12=e.m12,t.m13=e.m13,t.m14=e.m14,t.m15=e.m15),t.m04=s*r+h*n,t.m05=a*r+l*n,t.m06=o*r+c*n,t.m07=u*r+_*n,t.m08=h*r-s*n,t.m09=l*r-a*n,t.m10=c*r-o*n,t.m11=_*r-u*n,t},e.rotateY=function(t,e,i){var n=Math.sin(i),r=Math.cos(i),s=e.m00,a=e.m01,o=e.m02,u=e.m03,h=e.m08,l=e.m09,c=e.m10,_=e.m11;return e!==t&&(t.m04=e.m04,t.m05=e.m05,t.m06=e.m06,t.m07=e.m07,t.m12=e.m12,t.m13=e.m13,t.m14=e.m14,t.m15=e.m15),t.m00=s*r-h*n,t.m01=a*r-l*n,t.m02=o*r-c*n,t.m03=u*r-_*n,t.m08=s*n+h*r,t.m09=a*n+l*r,t.m10=o*n+c*r,t.m11=u*n+_*r,t},e.rotateZ=function(t,e,i){var n=Math.sin(i),r=Math.cos(i),s=e.m00,a=e.m01,o=e.m02,u=e.m03,h=e.m04,l=e.m05,c=e.m06,_=e.m07;return e!==t&&(t.m08=e.m08,t.m09=e.m09,t.m10=e.m10,t.m11=e.m11,t.m12=e.m12,t.m13=e.m13,t.m14=e.m14,t.m15=e.m15),t.m00=s*r+h*n,t.m01=a*r+l*n,t.m02=o*r+c*n,t.m03=u*r+_*n,t.m04=h*r-s*n,t.m05=l*r-a*n,t.m06=c*r-o*n,t.m07=_*r-u*n,t},e.fromTranslation=function(t,e){return t.m00=1,t.m01=0,t.m02=0,t.m03=0,t.m04=0,t.m05=1,t.m06=0,t.m07=0,t.m08=0,t.m09=0,t.m10=1,t.m11=0,t.m12=e.x,t.m13=e.y,t.m14=e.z,t.m15=1,t},e.fromScaling=function(t,e){return t.m00=e.x,t.m01=0,t.m02=0,t.m03=0,t.m04=0,t.m05=e.y,t.m06=0,t.m07=0,t.m08=0,t.m09=0,t.m10=e.z,t.m11=0,t.m12=0,t.m13=0,t.m14=0,t.m15=1,t},e.fromRotation=function(t,e,i){var n=i.x,r=i.y,s=i.z,a=Math.sqrt(n*n+r*r+s*s);if(Math.abs(a)<pi)return null;n*=a=1/a,r*=a,s*=a;var o=Math.sin(e),u=Math.cos(e),h=1-u;return t.m00=n*n*h+u,t.m01=r*n*h+s*o,t.m02=s*n*h-r*o,t.m03=0,t.m04=n*r*h-s*o,t.m05=r*r*h+u,t.m06=s*r*h+n*o,t.m07=0,t.m08=n*s*h+r*o,t.m09=r*s*h-n*o,t.m10=s*s*h+u,t.m11=0,t.m12=0,t.m13=0,t.m14=0,t.m15=1,t},e.fromXRotation=function(t,e){var i=Math.sin(e),n=Math.cos(e);return t.m00=1,t.m01=0,t.m02=0,t.m03=0,t.m04=0,t.m05=n,t.m06=i,t.m07=0,t.m08=0,t.m09=-i,t.m10=n,t.m11=0,t.m12=0,t.m13=0,t.m14=0,t.m15=1,t},e.fromYRotation=function(t,e){var i=Math.sin(e),n=Math.cos(e);return t.m00=n,t.m01=0,t.m02=-i,t.m03=0,t.m04=0,t.m05=1,t.m06=0,t.m07=0,t.m08=i,t.m09=0,t.m10=n,t.m11=0,t.m12=0,t.m13=0,t.m14=0,t.m15=1,t},e.fromZRotation=function(t,e){var i=Math.sin(e),n=Math.cos(e);return t.m00=n,t.m01=i,t.m02=0,t.m03=0,t.m04=-i,t.m05=n,t.m06=0,t.m07=0,t.m08=0,t.m09=0,t.m10=1,t.m11=0,t.m12=0,t.m13=0,t.m14=0,t.m15=1,t},e.fromRT=function(t,e,i){var n=e.x,r=e.y,s=e.z,a=e.w,o=n+n,u=r+r,h=s+s,l=n*o,c=n*u,_=n*h,f=r*u,d=r*h,p=s*h,m=a*o,g=a*u,v=a*h;return t.m00=1-(f+p),t.m01=c+v,t.m02=_-g,t.m03=0,t.m04=c-v,t.m05=1-(l+p),t.m06=d+m,t.m07=0,t.m08=_+g,t.m09=d-m,t.m10=1-(l+f),t.m11=0,t.m12=i.x,t.m13=i.y,t.m14=i.z,t.m15=1,t},e.getTranslation=function(t,e){return t.x=e.m12,t.y=e.m13,t.z=e.m14,t},e.getScaling=function(t,e){var i=ln.m00=e.m00,n=ln.m01=e.m01,r=ln.m02=e.m02,s=ln.m03=e.m04,a=ln.m04=e.m05,o=ln.m05=e.m06,u=ln.m06=e.m08,h=ln.m07=e.m09,l=ln.m08=e.m10;return t.x=Math.sqrt(i*i+n*n+r*r),t.y=Math.sqrt(s*s+a*a+o*o),t.z=Math.sqrt(u*u+h*h+l*l),Qi.determinant(ln)<0&&(t.x*=-1),t},e.getRotation=function(t,e){var i=e.m00+e.m05+e.m10,n=0;return i>0?(n=2*Math.sqrt(i+1),t.w=.25*n,t.x=(e.m06-e.m09)/n,t.y=(e.m08-e.m02)/n,t.z=(e.m01-e.m04)/n):e.m00>e.m05&&e.m00>e.m10?(n=2*Math.sqrt(1+e.m00-e.m05-e.m10),t.w=(e.m06-e.m09)/n,t.x=.25*n,t.y=(e.m01+e.m04)/n,t.z=(e.m08+e.m02)/n):e.m05>e.m10?(n=2*Math.sqrt(1+e.m05-e.m00-e.m10),t.w=(e.m08-e.m02)/n,t.x=(e.m01+e.m04)/n,t.y=.25*n,t.z=(e.m06+e.m09)/n):(n=2*Math.sqrt(1+e.m10-e.m00-e.m05),t.w=(e.m01-e.m04)/n,t.x=(e.m08+e.m02)/n,t.y=(e.m06+e.m09)/n,t.z=.25*n),t},e.toRTS=function(t,e,i,n){n.x=ji.set(hn,t.m00,t.m01,t.m02).length(),ln.m00=t.m00/n.x,ln.m01=t.m01/n.x,ln.m02=t.m02/n.x,n.y=ji.set(hn,t.m04,t.m05,t.m06).length(),ln.m03=t.m04/n.y,ln.m04=t.m05/n.y,ln.m05=t.m06/n.y,n.z=ji.set(hn,t.m08,t.m09,t.m10).length(),ln.m06=t.m08/n.z,ln.m07=t.m09/n.z,ln.m08=t.m10/n.z,Qi.determinant(ln)<0&&(n.x*=-1,ln.m00*=-1,ln.m01*=-1,ln.m02*=-1),$i.fromMat3(e,ln),ji.set(i,t.m12,t.m13,t.m14)},e.fromRTS=function(t,e,i,n){var r=e.x,s=e.y,a=e.z,o=e.w,u=r+r,h=s+s,l=a+a,c=r*u,_=r*h,f=r*l,d=s*h,p=s*l,m=a*l,g=o*u,v=o*h,y=o*l,E=n.x,T=n.y,S=n.z;return t.m00=(1-(d+m))*E,t.m01=(_+y)*E,t.m02=(f-v)*E,t.m03=0,t.m04=(_-y)*T,t.m05=(1-(c+m))*T,t.m06=(p+g)*T,t.m07=0,t.m08=(f+v)*S,t.m09=(p-g)*S,t.m10=(1-(c+d))*S,t.m11=0,t.m12=i.x,t.m13=i.y,t.m14=i.z,t.m15=1,t},e.fromRTSOrigin=function(t,e,i,n,r){var s=e.x,a=e.y,o=e.z,u=e.w,h=s+s,l=a+a,c=o+o,_=s*h,f=s*l,d=s*c,p=a*l,m=a*c,g=o*c,v=u*h,y=u*l,E=u*c,T=n.x,S=n.y,A=n.z,R=r.x,b=r.y,C=r.z;return t.m00=(1-(p+g))*T,t.m01=(f+E)*T,t.m02=(d-y)*T,t.m03=0,t.m04=(f-E)*S,t.m05=(1-(_+g))*S,t.m06=(m+v)*S,t.m07=0,t.m08=(d+y)*A,t.m09=(m-v)*A,t.m10=(1-(_+p))*A,t.m11=0,t.m12=i.x+R-(t.m00*R+t.m04*b+t.m08*C),t.m13=i.y+b-(t.m01*R+t.m05*b+t.m09*C),t.m14=i.z+C-(t.m02*R+t.m06*b+t.m10*C),t.m15=1,t},e.fromQuat=function(t,e){var i=e.x,n=e.y,r=e.z,s=e.w,a=i+i,o=n+n,u=r+r,h=i*a,l=n*a,c=n*o,_=r*a,f=r*o,d=r*u,p=s*a,m=s*o,g=s*u;return t.m00=1-c-d,t.m01=l+g,t.m02=_-m,t.m03=0,t.m04=l-g,t.m05=1-h-d,t.m06=f+p,t.m07=0,t.m08=_+m,t.m09=f-p,t.m10=1-h-c,t.m11=0,t.m12=0,t.m13=0,t.m14=0,t.m15=1,t},e.frustum=function(t,e,i,n,r,s,a){var o=1/(i-e),u=1/(r-n),h=1/(s-a);return t.m00=2*s*o,t.m01=0,t.m02=0,t.m03=0,t.m04=0,t.m05=2*s*u,t.m06=0,t.m07=0,t.m08=(i+e)*o,t.m09=(r+n)*u,t.m10=(a+s)*h,t.m11=-1,t.m12=0,t.m13=0,t.m14=a*s*2*h,t.m15=0,t},e.perspective=function(t,e,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(e/2),l=1/(n-r),c=s?h/i:h,_=(s?h:h*i)*o,f=on[u];return t.m00=c*f[0],t.m01=c*f[1],t.m02=0,t.m03=0,t.m04=_*f[2],t.m05=_*f[3],t.m06=0,t.m07=0,t.m08=0,t.m09=0,t.m10=(r-a*n)*l,t.m11=-1,t.m12=0,t.m13=0,t.m14=r*n*l*(1-a),t.m15=0,t},e.ortho=function(t,e,i,n,r,s,a,o,u,h){void 0===o&&(o=-1),void 0===u&&(u=1),void 0===h&&(h=0);var l=1/(e-i),c=1/(n-r)*u,_=1/(s-a),f=-2*l,d=-2*c,p=(e+i)*l,m=(r+n)*c,g=on[h];return t.m00=f*g[0],t.m01=f*g[1],t.m02=0,t.m03=0,t.m04=d*g[2],t.m05=d*g[3],t.m06=0,t.m07=0,t.m08=0,t.m09=0,t.m10=_*(1-o),t.m11=0,t.m12=p*g[0]+m*g[2],t.m13=p*g[1]+m*g[3],t.m14=(s-o*a)*_,t.m15=1,t},e.lookAt=function(t,e,i,n){var r=e.x,s=e.y,a=e.z,o=n.x,u=n.y,h=n.z,l=r-i.x,c=s-i.y,_=a-i.z,f=1/Math.sqrt(l*l+c*c+_*_),d=u*(_*=f)-h*(c*=f),p=h*(l*=f)-o*_,m=o*c-u*l,g=c*(m*=f=1/Math.sqrt(d*d+p*p+m*m))-_*(p*=f),v=_*(d*=f)-l*m,y=l*p-c*d;return t.m00=d,t.m01=g,t.m02=l,t.m03=0,t.m04=p,t.m05=v,t.m06=c,t.m07=0,t.m08=m,t.m09=y,t.m10=_,t.m11=0,t.m12=-(d*r+p*s+m*a),t.m13=-(g*r+v*s+y*a),t.m14=-(l*r+c*s+_*a),t.m15=1,t},e.inverseTranspose=function(t,e){var i=e.m00,n=e.m01,r=e.m02,s=e.m03,a=e.m04,o=e.m05,u=e.m06,h=e.m07,l=e.m08,c=e.m09,_=e.m10,f=e.m11,d=e.m12,p=e.m13,m=e.m14,g=e.m15,v=i*o-n*a,y=i*u-r*a,E=i*h-s*a,T=n*u-r*o,S=n*h-s*o,A=r*h-s*u,R=l*p-c*d,b=l*m-_*d,C=l*g-f*d,w=c*m-_*p,I=c*g-f*p,O=_*g-f*m,x=v*O-y*I+E*w+T*C-S*b+A*R;return x?(x=1/x,t.m00=(o*O-u*I+h*w)*x,t.m01=(u*C-a*O-h*b)*x,t.m02=(a*I-o*C+h*R)*x,t.m03=0,t.m04=(r*I-n*O-s*w)*x,t.m05=(i*O-r*C+s*b)*x,t.m06=(n*C-i*I-s*R)*x,t.m07=0,t.m08=(p*A-m*S+g*T)*x,t.m09=(m*E-d*A-g*y)*x,t.m10=(d*S-p*E+g*v)*x,t.m11=0,t.m12=0,t.m13=0,t.m14=0,t.m15=1,t):null},e.toArray=function(t,e,i){return void 0===i&&(i=0),t[i+0]=e.m00,t[i+1]=e.m01,t[i+2]=e.m02,t[i+3]=e.m03,t[i+4]=e.m04,t[i+5]=e.m05,t[i+6]=e.m06,t[i+7]=e.m07,t[i+8]=e.m08,t[i+9]=e.m09,t[i+10]=e.m10,t[i+11]=e.m11,t[i+12]=e.m12,t[i+13]=e.m13,t[i+14]=e.m14,t[i+15]=e.m15,t},e.fromArray=function(t,e,i){return void 0===i&&(i=0),t.m00=e[i+0],t.m01=e[i+1],t.m02=e[i+2],t.m03=e[i+3],t.m04=e[i+4],t.m05=e[i+5],t.m06=e[i+6],t.m07=e[i+7],t.m08=e[i+8],t.m09=e[i+9],t.m10=e[i+10],t.m11=e[i+11],t.m12=e[i+12],t.m13=e[i+13],t.m14=e[i+14],t.m15=e[i+15],t},e.add=function(t,e,i){return t.m00=e.m00+i.m00,t.m01=e.m01+i.m01,t.m02=e.m02+i.m02,t.m03=e.m03+i.m03,t.m04=e.m04+i.m04,t.m05=e.m05+i.m05,t.m06=e.m06+i.m06,t.m07=e.m07+i.m07,t.m08=e.m08+i.m08,t.m09=e.m09+i.m09,t.m10=e.m10+i.m10,t.m11=e.m11+i.m11,t.m12=e.m12+i.m12,t.m13=e.m13+i.m13,t.m14=e.m14+i.m14,t.m15=e.m15+i.m15,t},e.subtract=function(t,e,i){return t.m00=e.m00-i.m00,t.m01=e.m01-i.m01,t.m02=e.m02-i.m02,t.m03=e.m03-i.m03,t.m04=e.m04-i.m04,t.m05=e.m05-i.m05,t.m06=e.m06-i.m06,t.m07=e.m07-i.m07,t.m08=e.m08-i.m08,t.m09=e.m09-i.m09,t.m10=e.m10-i.m10,t.m11=e.m11-i.m11,t.m12=e.m12-i.m12,t.m13=e.m13-i.m13,t.m14=e.m14-i.m14,t.m15=e.m15-i.m15,t},e.multiplyScalar=function(t,e,i){return t.m00=e.m00*i,t.m01=e.m01*i,t.m02=e.m02*i,t.m03=e.m03*i,t.m04=e.m04*i,t.m05=e.m05*i,t.m06=e.m06*i,t.m07=e.m07*i,t.m08=e.m08*i,t.m09=e.m09*i,t.m10=e.m10*i,t.m11=e.m11*i,t.m12=e.m12*i,t.m13=e.m13*i,t.m14=e.m14*i,t.m15=e.m15*i,t},e.multiplyScalarAndAdd=function(t,e,i,n){return t.m00=e.m00+i.m00*n,t.m01=e.m01+i.m01*n,t.m02=e.m02+i.m02*n,t.m03=e.m03+i.m03*n,t.m04=e.m04+i.m04*n,t.m05=e.m05+i.m05*n,t.m06=e.m06+i.m06*n,t.m07=e.m07+i.m07*n,t.m08=e.m08+i.m08*n,t.m09=e.m09+i.m09*n,t.m10=e.m10+i.m10*n,t.m11=e.m11+i.m11*n,t.m12=e.m12+i.m12*n,t.m13=e.m13+i.m13*n,t.m14=e.m14+i.m14*n,t.m15=e.m15+i.m15*n,t},e.strictEquals=function(t,e){return t.m00===e.m00&&t.m01===e.m01&&t.m02===e.m02&&t.m03===e.m03&&t.m04===e.m04&&t.m05===e.m05&&t.m06===e.m06&&t.m07===e.m07&&t.m08===e.m08&&t.m09===e.m09&&t.m10===e.m10&&t.m11===e.m11&&t.m12===e.m12&&t.m13===e.m13&&t.m14===e.m14&&t.m15===e.m15},e.equals=function(t,e,i){return void 0===i&&(i=pi),Math.abs(t.m00-e.m00)<=i*Math.max(1,Math.abs(t.m00),Math.abs(e.m00))&&Math.abs(t.m01-e.m01)<=i*Math.max(1,Math.abs(t.m01),Math.abs(e.m01))&&Math.abs(t.m02-e.m02)<=i*Math.max(1,Math.abs(t.m02),Math.abs(e.m02))&&Math.abs(t.m03-e.m03)<=i*Math.max(1,Math.abs(t.m03),Math.abs(e.m03))&&Math.abs(t.m04-e.m04)<=i*Math.max(1,Math.abs(t.m04),Math.abs(e.m04))&&Math.abs(t.m05-e.m05)<=i*Math.max(1,Math.abs(t.m05),Math.abs(e.m05))&&Math.abs(t.m06-e.m06)<=i*Math.max(1,Math.abs(t.m06),Math.abs(e.m06))&&Math.abs(t.m07-e.m07)<=i*Math.max(1,Math.abs(t.m07),Math.abs(e.m07))&&Math.abs(t.m08-e.m08)<=i*Math.max(1,Math.abs(t.m08),Math.abs(e.m08))&&Math.abs(t.m09-e.m09)<=i*Math.max(1,Math.abs(t.m09),Math.abs(e.m09))&&Math.abs(t.m10-e.m10)<=i*Math.max(1,Math.abs(t.m10),Math.abs(e.m10))&&Math.abs(t.m11-e.m11)<=i*Math.max(1,Math.abs(t.m11),Math.abs(e.m11))&&Math.abs(t.m12-e.m12)<=i*Math.max(1,Math.abs(t.m12),Math.abs(e.m12))&&Math.abs(t.m13-e.m13)<=i*Math.max(1,Math.abs(t.m13),Math.abs(e.m13))&&Math.abs(t.m14-e.m14)<=i*Math.max(1,Math.abs(t.m14),Math.abs(e.m14))&&Math.abs(t.m15-e.m15)<=i*Math.max(1,Math.abs(t.m15),Math.abs(e.m15))};var i=e.prototype;return i.clone=function(){return new e(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(t,e,i,n,r,s,a,o,u,h,l,c,_,f,d,p){return void 0===t&&(t=1),void 0===e&&(e=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===l&&(l=1),void 0===c&&(c=0),void 0===_&&(_=0),void 0===f&&(f=0),void 0===d&&(d=0),void 0===p&&(p=1),"object"==typeof t?(this.m01=t.m01,this.m02=t.m02,this.m03=t.m03,this.m04=t.m04,this.m05=t.m05,this.m06=t.m06,this.m07=t.m07,this.m08=t.m08,this.m09=t.m09,this.m10=t.m10,this.m11=t.m11,this.m12=t.m12,this.m13=t.m13,this.m14=t.m14,this.m15=t.m15,this.m00=t.m00):(this.m01=e,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=l,this.m11=c,this.m12=_,this.m13=f,this.m14=d,this.m15=p,this.m00=t),this},i.equals=function(t,e){return void 0===e&&(e=pi),Math.abs(this.m00-t.m00)<=e*Math.max(1,Math.abs(this.m00),Math.abs(t.m00))&&Math.abs(this.m01-t.m01)<=e*Math.max(1,Math.abs(this.m01),Math.abs(t.m01))&&Math.abs(this.m02-t.m02)<=e*Math.max(1,Math.abs(this.m02),Math.abs(t.m02))&&Math.abs(this.m03-t.m03)<=e*Math.max(1,Math.abs(this.m03),Math.abs(t.m03))&&Math.abs(this.m04-t.m04)<=e*Math.max(1,Math.abs(this.m04),Math.abs(t.m04))&&Math.abs(this.m05-t.m05)<=e*Math.max(1,Math.abs(this.m05),Math.abs(t.m05))&&Math.abs(this.m06-t.m06)<=e*Math.max(1,Math.abs(this.m06),Math.abs(t.m06))&&Math.abs(this.m07-t.m07)<=e*Math.max(1,Math.abs(this.m07),Math.abs(t.m07))&&Math.abs(this.m08-t.m08)<=e*Math.max(1,Math.abs(this.m08),Math.abs(t.m08))&&Math.abs(this.m09-t.m09)<=e*Math.max(1,Math.abs(this.m09),Math.abs(t.m09))&&Math.abs(this.m10-t.m10)<=e*Math.max(1,Math.abs(this.m10),Math.abs(t.m10))&&Math.abs(this.m11-t.m11)<=e*Math.max(1,Math.abs(this.m11),Math.abs(t.m11))&&Math.abs(this.m12-t.m12)<=e*Math.max(1,Math.abs(this.m12),Math.abs(t.m12))&&Math.abs(this.m13-t.m13)<=e*Math.max(1,Math.abs(this.m13),Math.abs(t.m13))&&Math.abs(this.m14-t.m14)<=e*Math.max(1,Math.abs(this.m14),Math.abs(t.m14))&&Math.abs(this.m15-t.m15)<=e*Math.max(1,Math.abs(this.m15),Math.abs(t.m15))},i.strictEquals=function(t){return this.m00===t.m00&&this.m01===t.m01&&this.m02===t.m02&&this.m03===t.m03&&this.m04===t.m04&&this.m05===t.m05&&this.m06===t.m06&&this.m07===t.m07&&this.m08===t.m08&&this.m09===t.m09&&this.m10===t.m10&&this.m11===t.m11&&this.m12===t.m12&&this.m13===t.m13&&this.m14===t.m14&&this.m15===t.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 t=this.m01,e=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=t,this.m06=this.m09,this.m07=this.m13,this.m08=e,this.m09=n,this.m11=this.m14,this.m12=i,this.m13=r,this.m14=s,this},i.invert=function(){var t=this.m00,e=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,l=this.m10,c=this.m11,_=this.m12,f=this.m13,d=this.m14,p=this.m15,m=t*s-e*r,g=t*a-i*r,v=t*o-n*r,y=e*a-i*s,E=e*o-n*s,T=i*o-n*a,S=u*f-h*_,A=u*d-l*_,R=u*p-c*_,b=h*d-l*f,C=h*p-c*f,w=l*p-c*d,I=m*w-g*C+v*b+y*R-E*A+T*S;return 0===I?(this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),this):(I=1/I,this.m00=(s*w-a*C+o*b)*I,this.m01=(i*C-e*w-n*b)*I,this.m02=(f*T-d*E+p*y)*I,this.m03=(l*E-h*T-c*y)*I,this.m04=(a*R-r*w-o*A)*I,this.m05=(t*w-i*R+n*A)*I,this.m06=(d*v-_*T-p*g)*I,this.m07=(u*T-l*v+c*g)*I,this.m08=(r*C-s*R+o*S)*I,this.m09=(e*R-t*C-n*S)*I,this.m10=(_*E-f*v+p*m)*I,this.m11=(h*v-u*E-c*m)*I,this.m12=(s*A-r*b-a*S)*I,this.m13=(t*b-e*A+i*S)*I,this.m14=(f*g-_*y-d*m)*I,this.m15=(u*y-h*g+l*m)*I,this)},i.determinant=function(){var t=this.m00,e=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,l=this.m10,c=this.m11,_=this.m12,f=this.m13,d=this.m14,p=this.m15;return(t*s-e*r)*(l*p-c*d)-(t*a-i*r)*(h*p-c*f)+(t*o-n*r)*(h*d-l*f)+(e*a-i*s)*(u*p-c*_)-(e*o-n*s)*(u*d-l*_)+(i*o-n*a)*(u*f-h*_)},i.add=function(t){return this.m00+=t.m00,this.m01+=t.m01,this.m02+=t.m02,this.m03+=t.m03,this.m04+=t.m04,this.m05+=t.m05,this.m06+=t.m06,this.m07+=t.m07,this.m08+=t.m08,this.m09+=t.m09,this.m10+=t.m10,this.m11+=t.m11,this.m12+=t.m12,this.m13+=t.m13,this.m14+=t.m14,this.m15+=t.m15,this},i.subtract=function(t){return this.m00-=t.m00,this.m01-=t.m01,this.m02-=t.m02,this.m03-=t.m03,this.m04-=t.m04,this.m05-=t.m05,this.m06-=t.m06,this.m07-=t.m07,this.m08-=t.m08,this.m09-=t.m09,this.m10-=t.m10,this.m11-=t.m11,this.m12-=t.m12,this.m13-=t.m13,this.m14-=t.m14,this.m15-=t.m15,this},i.multiply=function(t){var e=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,l=this.m09,c=this.m10,_=this.m11,f=this.m12,d=this.m13,p=this.m14,m=this.m15,g=t.m00,v=t.m01,y=t.m02,E=t.m03;return this.m00=g*e+v*s+y*h+E*f,this.m01=g*i+v*a+y*l+E*d,this.m02=g*n+v*o+y*c+E*p,this.m03=g*r+v*u+y*_+E*m,g=t.m04,v=t.m05,y=t.m06,E=t.m07,this.m04=g*e+v*s+y*h+E*f,this.m05=g*i+v*a+y*l+E*d,this.m06=g*n+v*o+y*c+E*p,this.m07=g*r+v*u+y*_+E*m,g=t.m08,v=t.m09,y=t.m10,E=t.m11,this.m08=g*e+v*s+y*h+E*f,this.m09=g*i+v*a+y*l+E*d,this.m10=g*n+v*o+y*c+E*p,this.m11=g*r+v*u+y*_+E*m,g=t.m12,v=t.m13,y=t.m14,E=t.m15,this.m12=g*e+v*s+y*h+E*f,this.m13=g*i+v*a+y*l+E*d,this.m14=g*n+v*o+y*c+E*p,this.m15=g*r+v*u+y*_+E*m,this},i.multiplyScalar=function(t){return this.m00*=t,this.m01*=t,this.m02*=t,this.m03*=t,this.m04*=t,this.m05*=t,this.m06*=t,this.m07*=t,this.m08*=t,this.m09*=t,this.m10*=t,this.m11*=t,this.m12*=t,this.m13*=t,this.m14*=t,this.m15*=t,this},i.translate=function(t){return this.m12+=t.x,this.m13+=t.y,this.m14+=t.z,this},i.scale=function(t){var e=t.x,i=t.y,n=t.z;return this.m00*=e,this.m01*=e,this.m02*=e,this.m03*=e,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(t,e){var i=e.x,n=e.y,r=e.z,s=Math.sqrt(i*i+n*n+r*r);if(Math.abs(s)<pi)return null;i*=s=1/s,n*=s,r*=s;var a=Math.sin(t),o=Math.cos(t),u=1-o,h=this.m00,l=this.m01,c=this.m02,_=this.m03,f=this.m04,d=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,S=n*i*u+r*a,A=r*i*u-n*a,R=i*n*u-r*a,b=n*n*u+o,C=r*n*u+i*a,w=i*r*u+n*a,I=n*r*u-i*a,O=r*r*u+o;return this.m00=h*T+f*S+g*A,this.m01=l*T+d*S+v*A,this.m02=c*T+p*S+y*A,this.m03=_*T+m*S+E*A,this.m04=h*R+f*b+g*C,this.m05=l*R+d*b+v*C,this.m06=c*R+p*b+y*C,this.m07=_*R+m*b+E*C,this.m08=h*w+f*I+g*O,this.m09=l*w+d*I+v*O,this.m10=c*w+p*I+y*O,this.m11=_*w+m*I+E*O,this},i.getTranslation=function(t){return t.x=this.m12,t.y=this.m13,t.z=this.m14,t},i.getScale=function(t){var e=ln.m00=this.m00,i=ln.m01=this.m01,n=ln.m02=this.m02,r=ln.m03=this.m04,s=ln.m04=this.m05,a=ln.m05=this.m06,o=ln.m06=this.m08,u=ln.m07=this.m09,h=ln.m08=this.m10;return t.x=Math.sqrt(e*e+i*i+n*n),t.y=Math.sqrt(r*r+s*s+a*a),t.z=Math.sqrt(o*o+u*u+h*h),Qi.determinant(ln)<0&&(t.x*=-1),t},i.getRotation=function(t){var e=this.m00+this.m05+this.m10,i=0;return e>0?(i=2*Math.sqrt(e+1),t.w=.25*i,t.x=(this.m06-this.m09)/i,t.y=(this.m08-this.m02)/i,t.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),t.w=(this.m06-this.m09)/i,t.x=.25*i,t.y=(this.m01+this.m04)/i,t.z=(this.m08+this.m02)/i):this.m05>this.m10?(i=2*Math.sqrt(1+this.m05-this.m00-this.m10),t.w=(this.m08-this.m02)/i,t.x=(this.m01+this.m04)/i,t.y=.25*i,t.z=(this.m06+this.m09)/i):(i=2*Math.sqrt(1+this.m10-this.m00-this.m05),t.w=(this.m01-this.m04)/i,t.x=(this.m08+this.m02)/i,t.y=(this.m06+this.m09)/i,t.z=.25*i),t},i.fromRTS=function(t,e,i){var n=t.x,r=t.y,s=t.z,a=t.w,o=n+n,u=r+r,h=s+s,l=n*o,c=n*u,_=n*h,f=r*u,d=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-(f+p))*y,this.m01=(c+v)*y,this.m02=(_-g)*y,this.m03=0,this.m04=(c-v)*E,this.m05=(1-(l+p))*E,this.m06=(d+m)*E,this.m07=0,this.m08=(_+g)*T,this.m09=(d-m)*T,this.m10=(1-(l+f))*T,this.m11=0,this.m12=e.x,this.m13=e.y,this.m14=e.z,this.m15=1,this},i.fromQuat=function(t){var e=t.x,i=t.y,n=t.z,r=t.w,s=e+e,a=i+i,o=n+n,u=e*s,h=i*s,l=i*a,c=n*s,_=n*a,f=n*o,d=r*s,p=r*a,m=r*o;return this.m00=1-l-f,this.m01=h+m,this.m02=c-p,this.m03=0,this.m04=h-m,this.m05=1-u-f,this.m06=_+d,this.m07=0,this.m08=c+p,this.m09=_-d,this.m10=1-u-l,this.m11=0,this.m12=0,this.m13=0,this.m14=0,this.m15=1,this},e}(ge));un.IDENTITY=Object.freeze(new un);var hn=new ji,ln=new Qi;function cn(t,e,i,n,r,s,a,o,u,h,l,c,_,f,d,p){return new un(t,e,i,n,r,s,a,o,u,h,l,c,_,f,d,p)}hi.fastDefine("cc.Mat4",un,{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}),b.Mat4=un,b.mat4=cn;var _n=t("Vec2",function(t){function e(e,i){var n;return n=t.call(this)||this,e&&"object"==typeof e?(n.x=e.x,n.y=e.y):(n.x=e||0,n.y=i||0),n}c(e,t),e.clone=function(t){return new e(t.x,t.y)},e.copy=function(t,e){return t.x=e.x,t.y=e.y,t},e.set=function(t,e,i){return t.x=e,t.y=i,t},e.add=function(t,e,i){return t.x=e.x+i.x,t.y=e.y+i.y,t},e.subtract=function(t,e,i){return t.x=e.x-i.x,t.y=e.y-i.y,t},e.multiply=function(t,e,i){return t.x=e.x*i.x,t.y=e.y*i.y,t},e.divide=function(t,e,i){return t.x=e.x/i.x,t.y=e.y/i.y,t},e.ceil=function(t,e){return t.x=Math.ceil(e.x),t.y=Math.ceil(e.y),t},e.floor=function(t,e){return t.x=Math.floor(e.x),t.y=Math.floor(e.y),t},e.min=function(t,e,i){return t.x=Math.min(e.x,i.x),t.y=Math.min(e.y,i.y),t},e.max=function(t,e,i){return t.x=Math.max(e.x,i.x),t.y=Math.max(e.y,i.y),t},e.round=function(t,e){return t.x=Math.round(e.x),t.y=Math.round(e.y),t},e.multiplyScalar=function(t,e,i){return t.x=e.x*i,t.y=e.y*i,t},e.scaleAndAdd=function(t,e,i,n){return t.x=e.x+i.x*n,t.y=e.y+i.y*n,t},e.distance=function(t,e){var i=e.x-t.x,n=e.y-t.y;return Math.sqrt(i*i+n*n)},e.squaredDistance=function(t,e){var i=e.x-t.x,n=e.y-t.y;return i*i+n*n},e.len=function(t){var e=t.x,i=t.y;return Math.sqrt(e*e+i*i)},e.lengthSqr=function(t){var e=t.x,i=t.y;return e*e+i*i},e.negate=function(t,e){return t.x=-e.x,t.y=-e.y,t},e.inverse=function(t,e){return t.x=1/e.x,t.y=1/e.y,t},e.inverseSafe=function(t,e){var i=e.x,n=e.y;return Math.abs(i)<pi?t.x=0:t.x=1/i,Math.abs(n)<pi?t.y=0:t.y=1/n,t},e.normalize=function(t,e){var i=e.x,n=e.y,r=i*i+n*n;return r>0&&(r=1/Math.sqrt(r),t.x=i*r,t.y=n*r),t},e.dot=function(t,e){return t.x*e.x+t.y*e.y},e.cross=function(t,e,i){return t instanceof ji?(t.x=t.y=0,t.z=e.x*i.y-e.y*i.x,t):t.x*e.y-t.y*e.x},e.lerp=function(t,e,i,n){var r=e.x,s=e.y;return t.x=r+n*(i.x-r),t.y=s+n*(i.y-s),t},e.random=function(t,e){e=e||1;var i=2*Ai()*Math.PI;return t.x=Math.cos(i)*e,t.y=Math.sin(i)*e,t},e.transformMat3=function(t,e,i){var n=e.x,r=e.y;return t.x=i.m00*n+i.m03*r+i.m06,t.y=i.m01*n+i.m04*r+i.m07,t},e.transformMat4=function(t,e,i){var n=e.x,r=e.y;return t.x=i.m00*n+i.m04*r+i.m12,t.y=i.m01*n+i.m05*r+i.m13,t},e.str=function(t){return"Vec2("+t.x+", "+t.y+")"},e.toArray=function(t,e,i){return void 0===i&&(i=0),t[i+0]=e.x,t[i+1]=e.y,t},e.fromArray=function(t,e,i){return void 0===i&&(i=0),t.x=e[i+0],t.y=e[i+1],t},e.strictEquals=function(t,e){return t.x===e.x&&t.y===e.y},e.equals=function(t,e,i){return void 0===i&&(i=pi),Math.abs(t.x-e.x)<=i*Math.max(1,Math.abs(t.x),Math.abs(e.x))&&Math.abs(t.y-e.y)<=i*Math.max(1,Math.abs(t.y),Math.abs(e.y))},e.angle=function(t,i){e.normalize(fn,t),e.normalize(dn,i);var n=e.dot(fn,dn);return n>1?0:n<-1?Math.PI:Math.acos(n)};var i=e.prototype;return i.clone=function(){return new e(this.x,this.y)},i.set=function(t,e){return t&&"object"==typeof t?(this.x=t.x,this.y=t.y):(this.x=t||0,this.y=e||0),this},i.equals=function(t,e){return void 0===e&&(e=pi),Math.abs(this.x-t.x)<=e*Math.max(1,Math.abs(this.x),Math.abs(t.x))&&Math.abs(this.y-t.y)<=e*Math.max(1,Math.abs(this.y),Math.abs(t.y))},i.equals2f=function(t,e,i){return void 0===i&&(i=pi),Math.abs(this.x-t)<=i*Math.max(1,Math.abs(this.x),Math.abs(t))&&Math.abs(this.y-e)<=i*Math.max(1,Math.abs(this.y),Math.abs(e))},i.strictEquals=function(t){return t&&this.x===t.x&&this.y===t.y},i.strictEquals2f=function(t,e){return this.x===t&&this.y===e},i.toString=function(){return"("+this.x.toFixed(2)+", "+this.y.toFixed(2)+")"},i.lerp=function(t,e){var i=this.x,n=this.y;return this.x=i+e*(t.x-i),this.y=n+e*(t.y-n),this},i.clampf=function(t,e){return this.x=vi(this.x,t.x,e.x),this.y=vi(this.y,t.y,e.y),this},i.add=function(t){return this.x+=t.x,this.y+=t.y,this},i.add2f=function(t,e){return this.x+=t,this.y+=e,this},i.subtract=function(t){return this.x-=t.x,this.y-=t.y,this},i.subtract2f=function(t,e){return this.x-=t,this.y-=e,this},i.multiplyScalar=function(t){return"object"==typeof t&&console.warn("should use Vec2.multiply for vector * vector operation"),this.x*=t,this.y*=t,this},i.multiply=function(t){return"object"!=typeof t&&console.warn("should use Vec2.scale for vector * scalar operation"),this.x*=t.x,this.y*=t.y,this},i.multiply2f=function(t,e){return this.x*=t,this.y*=e,this},i.divide=function(t){return this.x/=t.x,this.y/=t.y,this},i.divide2f=function(t,e){return this.x/=t,this.y/=e,this},i.negative=function(){return this.x=-this.x,this.y=-this.y,this},i.dot=function(t){return this.x*t.x+this.y*t.y},i.cross=function(t){return this.x*t.y-this.y*t.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 t=this.x,e=this.y,i=t*t+e*e;return i>0&&(i=1/Math.sqrt(i),this.x*=i,this.y*=i),this},i.angle=function(t){var e=this.lengthSqr(),i=t.lengthSqr();if(0===e||0===i)return console.warn("Can't get angle between zero vector"),0;var n=this.dot(t)/Math.sqrt(e*i);return n=vi(n,-1,1),Math.acos(n)},i.signAngle=function(t){var e=this.angle(t);return this.cross(t)<0?-e:e},i.rotate=function(t){var e=this.x,i=this.y,n=Math.sin(t),r=Math.cos(t);return this.x=r*e-n*i,this.y=n*e+r*i,this},i.project=function(t){var e=this.dot(t)/t.dot(t);return this.x=t.x*e,this.y=t.y*e,this},i.transformMat4=function(t){var e=this.x,i=this.y;return this.x=t.m00*e+t.m04*i+t.m12,this.y=t.m01*e+t.m05*i+t.m13,this},e}(ge));_n.ZERO=Object.freeze(new _n(0,0)),_n.ONE=Object.freeze(new _n(1,1)),_n.NEG_ONE=Object.freeze(new _n(-1,-1)),_n.UNIT_X=Object.freeze(new _n(1,0)),_n.UNIT_Y=Object.freeze(new _n(0,1));var fn=new _n,dn=new _n;function pn(t,e){return new _n(t,e)}hi.fastDefine("cc.Vec2",_n,{x:0,y:0}),b.Vec2=_n,b.v2=pn,et(_n,"Vec2",[{name:"sub",newName:"subtract",target:_n,targetName:"Vec2"},{name:"mul",newName:"multiply",target:_n,targetName:"Vec2"},{name:"div",newName:"divide",target:_n,targetName:"Vec2"},{name:"dist",newName:"distance",target:_n,targetName:"Vec2"},{name:"sqrDist",newName:"squaredDistance",target:_n,targetName:"Vec2"},{name:"mag",newName:"len",target:_n,targetName:"Vec2"},{name:"sqrMag",newName:"lengthSqr",target:_n,targetName:"Vec2"},{name:"scale",newName:"multiplyScalar",target:_n,targetName:"Vec2"},{name:"exactEquals",newName:"strictEquals",target:_n,targetName:"Vec2"}]),et(_n.prototype,"Vec2",[{name:"mag",newName:"length",target:_n.prototype,targetName:"Vec2"},{name:"magSqr",newName:"lengthSqr",target:_n.prototype,targetName:"Vec2"},{name:"scale",newName:"multiplyScalar",target:_n.prototype,targetName:"Vec2"},{name:"exactEquals",newName:"strictEquals",target:_n.prototype,targetName:"Vec2"}]),et(ji,"Vec3",[{name:"sub",newName:"subtract",target:ji,targetName:"Vec3"},{name:"mul",newName:"multiply",target:ji,targetName:"Vec3"},{name:"div",newName:"divide",target:ji,targetName:"Vec3"},{name:"dist",newName:"distance",target:ji,targetName:"Vec3"},{name:"sqrDist",newName:"squaredDistance",target:ji,targetName:"Vec3"},{name:"mag",newName:"len",target:ji,targetName:"Vec3"},{name:"sqrMag",newName:"lengthSqr",target:ji,targetName:"Vec3"},{name:"scale",newName:"multiplyScalar",target:ji,targetName:"Vec3"},{name:"exactEquals",newName:"strictEquals",target:ji,targetName:"Vec3"}]),et(ji.prototype,"Vec3",[{name:"mag",newName:"length",target:ji.prototype,targetName:"Vec3"},{name:"magSqr",newName:"lengthSqr",target:ji.prototype,targetName:"Vec3"},{name:"scale",newName:"multiplyScalar",target:ji.prototype,targetName:"Vec3"},{name:"exactEquals",newName:"strictEquals",target:ji.prototype,targetName:"Vec3"}]),et(Li,"Vec4",[{name:"sub",newName:"subtract",target:Li,targetName:"Vec4"},{name:"mul",newName:"multiply",target:Li,targetName:"Vec4"},{name:"div",newName:"divide",target:Li,targetName:"Vec4"},{name:"dist",newName:"distance",target:Li,targetName:"Vec4"},{name:"sqrDist",newName:"squaredDistance",target:Li,targetName:"Vec4"},{name:"mag",newName:"len",target:Li,targetName:"Vec4"},{name:"sqrMag",newName:"lengthSqr",target:Li,targetName:"Vec4"},{name:"scale",newName:"multiplyScalar",target:Li,targetName:"Vec4"},{name:"exactEquals",newName:"strictEquals",target:Li,targetName:"Vec4"}]),et(Li.prototype,"Vec4",[{name:"mag",newName:"length",target:Li.prototype,targetName:"Vec4"},{name:"magSqr",newName:"lengthSqr",target:Li.prototype,targetName:"Vec4"},{name:"scale",newName:"multiplyScalar",target:Li.prototype,targetName:"Vec4"},{name:"exactEquals",newName:"strictEquals",target:Li.prototype,targetName:"Vec4"}]),et($i,"Quat",[{name:"mag",newName:"len",target:$i,targetName:"Quat"},{name:"mul",newName:"multiply",target:$i,targetName:"Quat"},{name:"sqrMag",newName:"lengthSqr",target:$i,targetName:"Quat"},{name:"scale",newName:"multiplyScalar",target:$i,targetName:"Quat"},{name:"exactEquals",newName:"strictEquals",target:$i,targetName:"Quat"}]),et($i.prototype,"Quat",[{name:"scale",newName:"multiplyScalar",target:$i.prototype,targetName:"Quat"},{name:"exactEquals",newName:"strictEquals",target:$i.prototype,targetName:"Quat"}]),et(Gi,"Color",[{name:"sub",newName:"subtract",target:Gi,targetName:"Color"},{name:"mul",newName:"multiply",target:Gi,targetName:"Color"},{name:"div",newName:"divide",target:Gi,targetName:"Color"},{name:"exactEquals",newName:"strictEquals",target:Gi,targetName:"Color"},{name:"fromHex",newName:"fromHEX",customFunction:function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];var n=e[1].toString(16);return b.Color.fromHEX(e[0],n)}}]),et(Qi,"Mat3",[{name:"sub",newName:"subtract",target:Qi,targetName:"Mat3"},{name:"mul",newName:"multiply",target:Qi,targetName:"Mat3"},{name:"exactEquals",newName:"strictEquals",target:Qi,targetName:"Mat3"},{name:"transfrom",newName:"transform",target:Qi,targetName:"Mat3"}]),et(Qi.prototype,"Mat3",[{name:"sub",newName:"subtract",target:Qi.prototype,targetName:"Mat3"},{name:"mul",newName:"multiply",target:Qi.prototype,targetName:"Mat3"},{name:"mulScalar",newName:"multiplyScalar",target:Qi.prototype,targetName:"Mat3"},{name:"exactEquals",newName:"strictEquals",target:Qi.prototype,targetName:"Mat3"}]),et(un,"Mat4",[{name:"sub",newName:"subtract",target:un,targetName:"Mat4"},{name:"mul",newName:"multiply",target:un,targetName:"Mat4"},{name:"exactEquals",newName:"strictEquals",target:un,targetName:"Mat4"}]),et(un.prototype,"Mat4",[{name:"sub",newName:"subtract",target:un.prototype,targetName:"Mat4"},{name:"mul",newName:"multiply",target:un.prototype,targetName:"Mat4"},{name:"mulScalar",newName:"multiplyScalar",target:un.prototype,targetName:"Mat4"},{name:"exactEquals",newName:"strictEquals",target:un.prototype,targetName:"Mat4"}]);var mn=t("AffineTransform",function(){function t(t,e,i,n,r,s){void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1),void 0===r&&(r=0),void 0===s&&(s=0),this.a=t,this.b=e,this.c=i,this.d=n,this.tx=r,this.ty=s}return t.identity=function(){return new t},t.clone=function(e){return new t(e.a,e.b,e.c,e.d,e.tx,e.ty)},t.concat=function(t,e,i){var n=e.a,r=e.b,s=e.c,a=e.d,o=e.tx,u=e.ty;t.a=n*i.a+r*i.c,t.b=n*i.b+r*i.d,t.c=s*i.a+a*i.c,t.d=s*i.b+a*i.d,t.tx=o*i.a+u*i.c+i.tx,t.ty=o*i.b+u*i.d+i.ty},t.invert=function(t,e){var i=1/(e.a*e.d-e.b*e.c);t.a=i*e.d,t.b=-i*e.b,t.c=-i*e.c,t.d=i*e.a,t.tx=i*(e.c*e.ty-e.d*e.tx),t.ty=i*(e.b*e.tx-e.a*e.ty)},t.fromMat4=function(t,e){t.a=e.m00,t.b=e.m01,t.c=e.m04,t.d=e.m05,t.tx=e.m12,t.ty=e.m13},t.transformVec2=function(t,e,i,n){var r,s;n?(r=e,s=i):(n=i,r=e.x,s=e.y),t.x=n.a*r+n.c*s+n.tx,t.y=n.b*r+n.d*s+n.ty},t.transformSize=function(t,e,i){t.width=i.a*e.width+i.c*e.height,t.height=i.b*e.width+i.d*e.height},t.transformRect=function(t,e,i){var n=e.x+e.width,r=e.y+e.height,s=i.a*e.x+i.c*e.y+i.tx,a=i.b*e.x+i.d*e.y+i.ty,o=i.a*n+i.c*e.y+i.tx,u=i.b*n+i.d*e.y+i.ty,h=i.a*e.x+i.c*r+i.tx,l=i.b*e.x+i.d*r+i.ty,c=i.a*n+i.c*r+i.tx,_=i.b*n+i.d*r+i.ty,f=Math.min(s,o,h,c),d=Math.max(s,o,h,c),p=Math.min(a,u,l,_),m=Math.max(a,u,l,_);t.x=f,t.y=p,t.width=d-f,t.height=m-p},t.transformObb=function(t,e,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,l=s.c*r.height,c=s.d*r.height;e.x=a,e.y=o,i.x=u+a,i.y=h+o,t.x=l+a,t.y=c+o,n.x=u+l+a,n.y=h+c+o},t}());b.AffineTransform=mn;var gn=t("Size",function(t){function e(e,i){var n;return n=t.call(this)||this,e&&"object"==typeof e?(n.width=e.width,n.height=e.height):(n.width=e||0,n.height=i||0),n}c(e,t),e.lerp=function(t,e,i,n){return t.width=e.width+(i.width-e.width)*n,t.height=e.height+(i.height-e.height)*n,t};var i=e.prototype;return i.clone=function(){return new e(this.width,this.height)},i.set=function(t,e){return t&&"object"==typeof t?(this.height=t.height,this.width=t.width):(this.width=t||0,this.height=e||0),this},i.equals=function(t){return this.width===t.width&&this.height===t.height},i.lerp=function(t,e){return this.width+=(t.width-this.width)*e,this.height+=(t.height-this.height)*e,this},i.toString=function(){return"("+this.width.toFixed(2)+", "+this.height.toFixed(2)+")"},h(e,[{key:"x",get:function(){return this.width},set:function(t){this.width=t}},{key:"y",get:function(){return this.height},set:function(t){this.height=t}}]),e}(ge));function vn(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),new gn(t,e)}gn.ZERO=Object.freeze(new gn(0,0)),gn.ONE=Object.freeze(new gn(1,1)),hi.fastDefine("cc.Size",gn,{width:0,height:0}),b.size=vn,b.Size=gn;var yn=t("Rect",function(t){function e(e,i,n,r){var s;return s=t.call(this)||this,e&&"object"==typeof e?(s.y=e.y,s.width=e.width,s.height=e.height,s.x=e.x):(s.x=e||0,s.y=i||0,s.width=n||0,s.height=r||0),s}c(e,t),e.fromMinMax=function(t,e,i){var n=Math.min(e.x,i.x),r=Math.min(e.y,i.y),s=Math.max(e.x,i.x),a=Math.max(e.y,i.y);return t.x=n,t.y=r,t.width=s-n,t.height=a-r,t},e.lerp=function(t,e,i,n){var r=e.x,s=e.y,a=e.width,o=e.height;return t.x=r+(i.x-r)*n,t.y=s+(i.y-s)*n,t.width=a+(i.width-a)*n,t.height=o+(i.height-o)*n,t},e.intersection=function(t,e,i){var n=e.x,r=e.y,s=e.x+e.width,a=e.y+e.height,o=i.x,u=i.y,h=i.x+i.width,l=i.y+i.height;return t.x=Math.max(n,o),t.y=Math.max(r,u),t.width=Math.min(s,h)-t.x,t.height=Math.min(a,l)-t.y,t},e.union=function(t,e,i){var n=e.x,r=e.y,s=e.width,a=e.height,o=i.x,u=i.y,h=i.width,l=i.height;return t.x=Math.min(n,o),t.y=Math.min(r,u),t.width=Math.max(n+s,o+h)-t.x,t.height=Math.max(r+a,u+l)-t.y,t};var i=e.prototype;return i.clone=function(){return new e(this.x,this.y,this.width,this.height)},i.set=function(t,e,i,n){return t&&"object"==typeof t?(this.y=t.y,this.width=t.width,this.height=t.height,this.x=t.x):(this.x=t||0,this.y=e||0,this.width=i||0,this.height=n||0),this},i.equals=function(t){return this.x===t.x&&this.y===t.y&&this.width===t.width&&this.height===t.height},i.lerp=function(t,e){var i=this.x,n=this.y,r=this.width,s=this.height;return this.x=i+(t.x-i)*e,this.y=n+(t.y-n)*e,this.width=r+(t.width-r)*e,this.height=s+(t.height-s)*e,this},i.toString=function(){return"("+this.x.toFixed(2)+", "+this.y.toFixed(2)+", "+this.width.toFixed(2)+", "+this.height.toFixed(2)+")"},i.intersects=function(t){var e=this.x+this.width,i=this.y+this.height,n=t.x+t.width,r=t.y+t.height;return!(e<t.x||n<this.x||i<t.y||r<this.y)},i.contains=function(t){return this.x<=t.x&&this.x+this.width>=t.x&&this.y<=t.y&&this.y+this.height>=t.y},i.containsRect=function(t){return this.x<=t.x&&this.x+this.width>=t.x+t.width&&this.y<=t.y&&this.y+this.height>=t.y+t.height},i.transformMat4=function(t){var e=this.x,i=this.y,n=e+this.width,r=i+this.height,s=t.m00*e+t.m04*i+t.m12,a=t.m01*e+t.m05*i+t.m13,o=t.m00*n+t.m04*i+t.m12,u=t.m01*n+t.m05*i+t.m13,h=t.m00*e+t.m04*r+t.m12,l=t.m01*e+t.m05*r+t.m13,c=t.m00*n+t.m04*r+t.m12,_=t.m01*n+t.m05*r+t.m13,f=Math.min(s,o,h,c),d=Math.max(s,o,h,c),p=Math.min(a,u,l,_),m=Math.max(a,u,l,_);return this.x=f,this.y=p,this.width=d-f,this.height=m-p,this},i.transformMat4ToPoints=function(t,e,i,n,r){var s=this.x,a=this.y,o=s+this.width,u=a+this.height;e.x=t.m00*s+t.m04*a+t.m12,e.y=t.m01*s+t.m05*a+t.m13,r.x=t.m00*o+t.m04*a+t.m12,r.y=t.m01*o+t.m05*a+t.m13,i.x=t.m00*s+t.m04*u+t.m12,i.y=t.m01*s+t.m05*u+t.m13,n.x=t.m00*o+t.m04*u+t.m12,n.y=t.m01*o+t.m05*u+t.m13},h(e,[{key:"xMin",get:function(){return this.x},set:function(t){this.width+=this.x-t,this.x=t}},{key:"yMin",get:function(){return this.y},set:function(t){this.height+=this.y-t,this.y=t}},{key:"xMax",get:function(){return this.x+this.width},set:function(t){this.width=t-this.x}},{key:"yMax",get:function(){return this.y+this.height},set:function(t){this.height=t-this.y}},{key:"center",get:function(){return new _n(this.x+.5*this.width,this.y+.5*this.height)},set:function(t){this.x=t.x-.5*this.width,this.y=t.y-.5*this.height}},{key:"origin",get:function(){return new _n(this.x,this.y)},set:function(t){this.x=t.x,this.y=t.y}},{key:"size",get:function(){return new gn(this.width,this.height)},set:function(t){this.width=t.width,this.height=t.height}},{key:"z",get:function(){return this.width},set:function(t){this.width=t}},{key:"w",get:function(){return this.height},set:function(t){this.height=t}}]),e}(ge));function En(t,e,i,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),new yn(t,e,i,n)}hi.fastDefine("cc.Rect",yn,{x:0,y:0,width:0,height:0}),b.Rect=yn,b.rect=En;var Tn=t("MATH_FLOAT_ARRAY",Float64Array),Sn=t("MathBase",function(t){function e(){return t.apply(this,arguments)||this}return c(e,t),e.createFloatArray=function(t){return new Tn(t)},h(e,[{key:"array",get:function(){return this._array}}]),e}(ge)),An=Object.freeze({__proto__:null,bits:o,Vec2:_n,v2:pn,Vec3:ji,v3:qi,Vec4:Li,v4:Fi,Quat:$i,quat:an,Mat3:Qi,Mat4:un,mat4:cn,AffineTransform:mn,Size:gn,size:vn,Rect:yn,rect:En,Color:Gi,color:ki,EPSILON:pi,equals:mi,approx:gi,clamp:vi,clamp01:yi,lerp:Ei,toRadian:Ti,toDegree:Si,random:Ai,randomRange:Ri,randomRangeInt:bi,pseudoRandom:Ci,pseudoRandomRange:wi,pseudoRandomRangeInt:Ii,nextPow2:Oi,repeat:xi,pingPong:Pi,inverseLerp:Di,absMaxComponent:Bi,absMax:Ni,enumerableProps:Mi,MATH_FLOAT_ARRAY:Tn,MathBase:Sn});t("math",An);var Rn,bn,Cn,wn,In,On,xn,Pn,Dn,Bn,Nn,Mn,Ln,Fn,Un,Gn,kn,zn,Hn,Vn,Wn,Xn,jn,Yn,Kn,qn,Qn,Zn,Jn,$n,tr,er,ir,nr,rr,sr,ar,or,ur,hr,lr,cr,_r,fr,dr=new(function(){function t(){this._finalizationRegistry=null,this._gcObjects=new WeakMap}var e=t.prototype;return e.registerGCObject=function(t){return t},e.init=function(){},e.finalizationRegistryCallback=function(t){var e=this._gcObjects.get(t);e&&(this._gcObjects.delete(t),e.destroy()),this._finalizationRegistry.unregister(t)},e.destroy=function(){},t}()),pr=function(){function t(){return dr.registerGCObject(this)}return t.prototype.destroy=function(){},t}(),mr=function(t,e,i){for(var n=0;n<e.length;++n)t.length<=n&&t.push(new i),t[n].copy(e[n]);t.length=e.length};!function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.SWAPCHAIN=1]="SWAPCHAIN",t[t.BUFFER=2]="BUFFER",t[t.TEXTURE=3]="TEXTURE",t[t.RENDER_PASS=4]="RENDER_PASS",t[t.FRAMEBUFFER=5]="FRAMEBUFFER",t[t.SAMPLER=6]="SAMPLER",t[t.SHADER=7]="SHADER",t[t.DESCRIPTOR_SET_LAYOUT=8]="DESCRIPTOR_SET_LAYOUT",t[t.PIPELINE_LAYOUT=9]="PIPELINE_LAYOUT",t[t.PIPELINE_STATE=10]="PIPELINE_STATE",t[t.DESCRIPTOR_SET=11]="DESCRIPTOR_SET",t[t.INPUT_ASSEMBLER=12]="INPUT_ASSEMBLER",t[t.COMMAND_BUFFER=13]="COMMAND_BUFFER",t[t.QUEUE=14]="QUEUE",t[t.QUERY_POOL=15]="QUERY_POOL",t[t.GLOBAL_BARRIER=16]="GLOBAL_BARRIER",t[t.TEXTURE_BARRIER=17]="TEXTURE_BARRIER",t[t.BUFFER_BARRIER=18]="BUFFER_BARRIER",t[t.COUNT=19]="COUNT"}(Rn||(Rn={})),function(t){t[t.UNREADY=0]="UNREADY",t[t.FAILED=1]="FAILED",t[t.SUCCESS=2]="SUCCESS"}(bn||(bn={})),function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.GLES2=1]="GLES2",t[t.GLES3=2]="GLES3",t[t.METAL=3]="METAL",t[t.VULKAN=4]="VULKAN",t[t.NVN=5]="NVN",t[t.WEBGL=6]="WEBGL",t[t.WEBGL2=7]="WEBGL2",t[t.WEBGPU=8]="WEBGPU"}(Cn||(Cn={})),function(t){t[t.IDENTITY=0]="IDENTITY",t[t.ROTATE_90=1]="ROTATE_90",t[t.ROTATE_180=2]="ROTATE_180",t[t.ROTATE_270=3]="ROTATE_270"}(wn||(wn={})),function(t){t[t.ELEMENT_INDEX_UINT=0]="ELEMENT_INDEX_UINT",t[t.INSTANCED_ARRAYS=1]="INSTANCED_ARRAYS",t[t.MULTIPLE_RENDER_TARGETS=2]="MULTIPLE_RENDER_TARGETS",t[t.BLEND_MINMAX=3]="BLEND_MINMAX",t[t.COMPUTE_SHADER=4]="COMPUTE_SHADER",t[t.INPUT_ATTACHMENT_BENEFIT=5]="INPUT_ATTACHMENT_BENEFIT",t[t.COUNT=6]="COUNT"}(In||(In={})),function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.A8=1]="A8",t[t.L8=2]="L8",t[t.LA8=3]="LA8",t[t.R8=4]="R8",t[t.R8SN=5]="R8SN",t[t.R8UI=6]="R8UI",t[t.R8I=7]="R8I",t[t.R16F=8]="R16F",t[t.R16UI=9]="R16UI",t[t.R16I=10]="R16I",t[t.R32F=11]="R32F",t[t.R32UI=12]="R32UI",t[t.R32I=13]="R32I",t[t.RG8=14]="RG8",t[t.RG8SN=15]="RG8SN",t[t.RG8UI=16]="RG8UI",t[t.RG8I=17]="RG8I",t[t.RG16F=18]="RG16F",t[t.RG16UI=19]="RG16UI",t[t.RG16I=20]="RG16I",t[t.RG32F=21]="RG32F",t[t.RG32UI=22]="RG32UI",t[t.RG32I=23]="RG32I",t[t.RGB8=24]="RGB8",t[t.SRGB8=25]="SRGB8",t[t.RGB8SN=26]="RGB8SN",t[t.RGB8UI=27]="RGB8UI",t[t.RGB8I=28]="RGB8I",t[t.RGB16F=29]="RGB16F",t[t.RGB16UI=30]="RGB16UI",t[t.RGB16I=31]="RGB16I",t[t.RGB32F=32]="RGB32F",t[t.RGB32UI=33]="RGB32UI",t[t.RGB32I=34]="RGB32I",t[t.RGBA8=35]="RGBA8",t[t.BGRA8=36]="BGRA8",t[t.SRGB8_A8=37]="SRGB8_A8",t[t.RGBA8SN=38]="RGBA8SN",t[t.RGBA8UI=39]="RGBA8UI",t[t.RGBA8I=40]="RGBA8I",t[t.RGBA16F=41]="RGBA16F",t[t.RGBA16UI=42]="RGBA16UI",t[t.RGBA16I=43]="RGBA16I",t[t.RGBA32F=44]="RGBA32F",t[t.RGBA32UI=45]="RGBA32UI",t[t.RGBA32I=46]="RGBA32I",t[t.R5G6B5=47]="R5G6B5",t[t.R11G11B10F=48]="R11G11B10F",t[t.RGB5A1=49]="RGB5A1",t[t.RGBA4=50]="RGBA4",t[t.RGB10A2=51]="RGB10A2",t[t.RGB10A2UI=52]="RGB10A2UI",t[t.RGB9E5=53]="RGB9E5",t[t.DEPTH=54]="DEPTH",t[t.DEPTH_STENCIL=55]="DEPTH_STENCIL",t[t.BC1=56]="BC1",t[t.BC1_ALPHA=57]="BC1_ALPHA",t[t.BC1_SRGB=58]="BC1_SRGB",t[t.BC1_SRGB_ALPHA=59]="BC1_SRGB_ALPHA",t[t.BC2=60]="BC2",t[t.BC2_SRGB=61]="BC2_SRGB",t[t.BC3=62]="BC3",t[t.BC3_SRGB=63]="BC3_SRGB",t[t.BC4=64]="BC4",t[t.BC4_SNORM=65]="BC4_SNORM",t[t.BC5=66]="BC5",t[t.BC5_SNORM=67]="BC5_SNORM",t[t.BC6H_UF16=68]="BC6H_UF16",t[t.BC6H_SF16=69]="BC6H_SF16",t[t.BC7=70]="BC7",t[t.BC7_SRGB=71]="BC7_SRGB",t[t.ETC_RGB8=72]="ETC_RGB8",t[t.ETC2_RGB8=73]="ETC2_RGB8",t[t.ETC2_SRGB8=74]="ETC2_SRGB8",t[t.ETC2_RGB8_A1=75]="ETC2_RGB8_A1",t[t.ETC2_SRGB8_A1=76]="ETC2_SRGB8_A1",t[t.ETC2_RGBA8=77]="ETC2_RGBA8",t[t.ETC2_SRGB8_A8=78]="ETC2_SRGB8_A8",t[t.EAC_R11=79]="EAC_R11",t[t.EAC_R11SN=80]="EAC_R11SN",t[t.EAC_RG11=81]="EAC_RG11",t[t.EAC_RG11SN=82]="EAC_RG11SN",t[t.PVRTC_RGB2=83]="PVRTC_RGB2",t[t.PVRTC_RGBA2=84]="PVRTC_RGBA2",t[t.PVRTC_RGB4=85]="PVRTC_RGB4",t[t.PVRTC_RGBA4=86]="PVRTC_RGBA4",t[t.PVRTC2_2BPP=87]="PVRTC2_2BPP",t[t.PVRTC2_4BPP=88]="PVRTC2_4BPP",t[t.ASTC_RGBA_4X4=89]="ASTC_RGBA_4X4",t[t.ASTC_RGBA_5X4=90]="ASTC_RGBA_5X4",t[t.ASTC_RGBA_5X5=91]="ASTC_RGBA_5X5",t[t.ASTC_RGBA_6X5=92]="ASTC_RGBA_6X5",t[t.ASTC_RGBA_6X6=93]="ASTC_RGBA_6X6",t[t.ASTC_RGBA_8X5=94]="ASTC_RGBA_8X5",t[t.ASTC_RGBA_8X6=95]="ASTC_RGBA_8X6",t[t.ASTC_RGBA_8X8=96]="ASTC_RGBA_8X8",t[t.ASTC_RGBA_10X5=97]="ASTC_RGBA_10X5",t[t.ASTC_RGBA_10X6=98]="ASTC_RGBA_10X6",t[t.ASTC_RGBA_10X8=99]="ASTC_RGBA_10X8",t[t.ASTC_RGBA_10X10=100]="ASTC_RGBA_10X10",t[t.ASTC_RGBA_12X10=101]="ASTC_RGBA_12X10",t[t.ASTC_RGBA_12X12=102]="ASTC_RGBA_12X12",t[t.ASTC_SRGBA_4X4=103]="ASTC_SRGBA_4X4",t[t.ASTC_SRGBA_5X4=104]="ASTC_SRGBA_5X4",t[t.ASTC_SRGBA_5X5=105]="ASTC_SRGBA_5X5",t[t.ASTC_SRGBA_6X5=106]="ASTC_SRGBA_6X5",t[t.ASTC_SRGBA_6X6=107]="ASTC_SRGBA_6X6",t[t.ASTC_SRGBA_8X5=108]="ASTC_SRGBA_8X5",t[t.ASTC_SRGBA_8X6=109]="ASTC_SRGBA_8X6",t[t.ASTC_SRGBA_8X8=110]="ASTC_SRGBA_8X8",t[t.ASTC_SRGBA_10X5=111]="ASTC_SRGBA_10X5",t[t.ASTC_SRGBA_10X6=112]="ASTC_SRGBA_10X6",t[t.ASTC_SRGBA_10X8=113]="ASTC_SRGBA_10X8",t[t.ASTC_SRGBA_10X10=114]="ASTC_SRGBA_10X10",t[t.ASTC_SRGBA_12X10=115]="ASTC_SRGBA_12X10",t[t.ASTC_SRGBA_12X12=116]="ASTC_SRGBA_12X12",t[t.COUNT=117]="COUNT"}(On||(On={})),function(t){t[t.NONE=0]="NONE",t[t.UNORM=1]="UNORM",t[t.SNORM=2]="SNORM",t[t.UINT=3]="UINT",t[t.INT=4]="INT",t[t.UFLOAT=5]="UFLOAT",t[t.FLOAT=6]="FLOAT"}(xn||(xn={})),function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.BOOL=1]="BOOL",t[t.BOOL2=2]="BOOL2",t[t.BOOL3=3]="BOOL3",t[t.BOOL4=4]="BOOL4",t[t.INT=5]="INT",t[t.INT2=6]="INT2",t[t.INT3=7]="INT3",t[t.INT4=8]="INT4",t[t.UINT=9]="UINT",t[t.UINT2=10]="UINT2",t[t.UINT3=11]="UINT3",t[t.UINT4=12]="UINT4",t[t.FLOAT=13]="FLOAT",t[t.FLOAT2=14]="FLOAT2",t[t.FLOAT3=15]="FLOAT3",t[t.FLOAT4=16]="FLOAT4",t[t.MAT2=17]="MAT2",t[t.MAT2X3=18]="MAT2X3",t[t.MAT2X4=19]="MAT2X4",t[t.MAT3X2=20]="MAT3X2",t[t.MAT3=21]="MAT3",t[t.MAT3X4=22]="MAT3X4",t[t.MAT4X2=23]="MAT4X2",t[t.MAT4X3=24]="MAT4X3",t[t.MAT4=25]="MAT4",t[t.SAMPLER1D=26]="SAMPLER1D",t[t.SAMPLER1D_ARRAY=27]="SAMPLER1D_ARRAY",t[t.SAMPLER2D=28]="SAMPLER2D",t[t.SAMPLER2D_ARRAY=29]="SAMPLER2D_ARRAY",t[t.SAMPLER3D=30]="SAMPLER3D",t[t.SAMPLER_CUBE=31]="SAMPLER_CUBE",t[t.SAMPLER=32]="SAMPLER",t[t.TEXTURE1D=33]="TEXTURE1D",t[t.TEXTURE1D_ARRAY=34]="TEXTURE1D_ARRAY",t[t.TEXTURE2D=35]="TEXTURE2D",t[t.TEXTURE2D_ARRAY=36]="TEXTURE2D_ARRAY",t[t.TEXTURE3D=37]="TEXTURE3D",t[t.TEXTURE_CUBE=38]="TEXTURE_CUBE",t[t.IMAGE1D=39]="IMAGE1D",t[t.IMAGE1D_ARRAY=40]="IMAGE1D_ARRAY",t[t.IMAGE2D=41]="IMAGE2D",t[t.IMAGE2D_ARRAY=42]="IMAGE2D_ARRAY",t[t.IMAGE3D=43]="IMAGE3D",t[t.IMAGE_CUBE=44]="IMAGE_CUBE",t[t.SUBPASS_INPUT=45]="SUBPASS_INPUT",t[t.COUNT=46]="COUNT"}(Pn||(Pn={})),function(t){t[t.NONE=0]="NONE",t[t.TRANSFER_SRC=1]="TRANSFER_SRC",t[t.TRANSFER_DST=2]="TRANSFER_DST",t[t.INDEX=4]="INDEX",t[t.VERTEX=8]="VERTEX",t[t.UNIFORM=16]="UNIFORM",t[t.STORAGE=32]="STORAGE",t[t.INDIRECT=64]="INDIRECT"}(Dn||(Dn={})),function(t){t[t.NONE=0]="NONE"}(Bn||(Bn={})),function(t){t[t.NONE=0]="NONE",t[t.READ_ONLY=1]="READ_ONLY",t[t.WRITE_ONLY=2]="WRITE_ONLY",t[t.READ_WRITE=3]="READ_WRITE"}(Nn||(Nn={})),function(t){t[t.NONE=0]="NONE",t[t.DEVICE=1]="DEVICE",t[t.HOST=2]="HOST"}(Mn||(Mn={})),function(t){t[t.TEX1D=0]="TEX1D",t[t.TEX2D=1]="TEX2D",t[t.TEX3D=2]="TEX3D",t[t.CUBE=3]="CUBE",t[t.TEX1D_ARRAY=4]="TEX1D_ARRAY",t[t.TEX2D_ARRAY=5]="TEX2D_ARRAY"}(Ln||(Ln={})),function(t){t[t.NONE=0]="NONE",t[t.TRANSFER_SRC=1]="TRANSFER_SRC",t[t.TRANSFER_DST=2]="TRANSFER_DST",t[t.SAMPLED=4]="SAMPLED",t[t.STORAGE=8]="STORAGE",t[t.COLOR_ATTACHMENT=16]="COLOR_ATTACHMENT",t[t.DEPTH_STENCIL_ATTACHMENT=32]="DEPTH_STENCIL_ATTACHMENT",t[t.INPUT_ATTACHMENT=64]="INPUT_ATTACHMENT"}(Fn||(Fn={})),function(t){t[t.NONE=0]="NONE",t[t.GEN_MIPMAP=1]="GEN_MIPMAP",t[t.GENERAL_LAYOUT=2]="GENERAL_LAYOUT"}(Un||(Un={})),function(t){t[t.NONE=0]="NONE",t[t.RENDER_TARGET=1]="RENDER_TARGET",t[t.SAMPLED_TEXTURE=2]="SAMPLED_TEXTURE",t[t.LINEAR_FILTER=4]="LINEAR_FILTER",t[t.STORAGE_TEXTURE=8]="STORAGE_TEXTURE",t[t.VERTEX_ATTRIBUTE=16]="VERTEX_ATTRIBUTE"}(Gn||(Gn={})),function(t){t[t.ONE=0]="ONE",t[t.MULTIPLE_PERFORMANCE=1]="MULTIPLE_PERFORMANCE",t[t.MULTIPLE_BALANCE=2]="MULTIPLE_BALANCE",t[t.MULTIPLE_QUALITY=3]="MULTIPLE_QUALITY"}(kn||(kn={})),function(t){t[t.OFF=0]="OFF",t[t.ON=1]="ON",t[t.RELAXED=2]="RELAXED",t[t.MAILBOX=3]="MAILBOX",t[t.HALF=4]="HALF"}(zn||(zn={})),function(t){t[t.NONE=0]="NONE",t[t.POINT=1]="POINT",t[t.LINEAR=2]="LINEAR",t[t.ANISOTROPIC=3]="ANISOTROPIC"}(Hn||(Hn={})),function(t){t[t.WRAP=0]="WRAP",t[t.MIRROR=1]="MIRROR",t[t.CLAMP=2]="CLAMP",t[t.BORDER=3]="BORDER"}(Vn||(Vn={})),function(t){t[t.NEVER=0]="NEVER",t[t.LESS=1]="LESS",t[t.EQUAL=2]="EQUAL",t[t.LESS_EQUAL=3]="LESS_EQUAL",t[t.GREATER=4]="GREATER",t[t.NOT_EQUAL=5]="NOT_EQUAL",t[t.GREATER_EQUAL=6]="GREATER_EQUAL",t[t.ALWAYS=7]="ALWAYS"}(Wn||(Wn={})),function(t){t[t.ZERO=0]="ZERO",t[t.KEEP=1]="KEEP",t[t.REPLACE=2]="REPLACE",t[t.INCR=3]="INCR",t[t.DECR=4]="DECR",t[t.INVERT=5]="INVERT",t[t.INCR_WRAP=6]="INCR_WRAP",t[t.DECR_WRAP=7]="DECR_WRAP"}(Xn||(Xn={})),function(t){t[t.ZERO=0]="ZERO",t[t.ONE=1]="ONE",t[t.SRC_ALPHA=2]="SRC_ALPHA",t[t.DST_ALPHA=3]="DST_ALPHA",t[t.ONE_MINUS_SRC_ALPHA=4]="ONE_MINUS_SRC_ALPHA",t[t.ONE_MINUS_DST_ALPHA=5]="ONE_MINUS_DST_ALPHA",t[t.SRC_COLOR=6]="SRC_COLOR",t[t.DST_COLOR=7]="DST_COLOR",t[t.ONE_MINUS_SRC_COLOR=8]="ONE_MINUS_SRC_COLOR",t[t.ONE_MINUS_DST_COLOR=9]="ONE_MINUS_DST_COLOR",t[t.SRC_ALPHA_SATURATE=10]="SRC_ALPHA_SATURATE",t[t.CONSTANT_COLOR=11]="CONSTANT_COLOR",t[t.ONE_MINUS_CONSTANT_COLOR=12]="ONE_MINUS_CONSTANT_COLOR",t[t.CONSTANT_ALPHA=13]="CONSTANT_ALPHA",t[t.ONE_MINUS_CONSTANT_ALPHA=14]="ONE_MINUS_CONSTANT_ALPHA"}(jn||(jn={})),function(t){t[t.ADD=0]="ADD",t[t.SUB=1]="SUB",t[t.REV_SUB=2]="REV_SUB",t[t.MIN=3]="MIN",t[t.MAX=4]="MAX"}(Yn||(Yn={})),function(t){t[t.NONE=0]="NONE",t[t.R=1]="R",t[t.G=2]="G",t[t.B=4]="B",t[t.A=8]="A",t[t.ALL=15]="ALL"}(Kn||(Kn={})),function(t){t[t.NONE=0]="NONE",t[t.VERTEX=1]="VERTEX",t[t.CONTROL=2]="CONTROL",t[t.EVALUATION=4]="EVALUATION",t[t.GEOMETRY=8]="GEOMETRY",t[t.FRAGMENT=16]="FRAGMENT",t[t.COMPUTE=32]="COMPUTE",t[t.ALL=63]="ALL"}(qn||(qn={})),function(t){t[t.LOAD=0]="LOAD",t[t.CLEAR=1]="CLEAR",t[t.DISCARD=2]="DISCARD"}(Qn||(Qn={})),function(t){t[t.STORE=0]="STORE",t[t.DISCARD=1]="DISCARD"}(Zn||(Zn={})),function(t){t[t.NONE=0]="NONE",t[t.INDIRECT_BUFFER=1]="INDIRECT_BUFFER",t[t.INDEX_BUFFER=2]="INDEX_BUFFER",t[t.VERTEX_BUFFER=4]="VERTEX_BUFFER",t[t.VERTEX_SHADER_READ_UNIFORM_BUFFER=8]="VERTEX_SHADER_READ_UNIFORM_BUFFER",t[t.VERTEX_SHADER_READ_TEXTURE=16]="VERTEX_SHADER_READ_TEXTURE",t[t.VERTEX_SHADER_READ_OTHER=32]="VERTEX_SHADER_READ_OTHER",t[t.FRAGMENT_SHADER_READ_UNIFORM_BUFFER=64]="FRAGMENT_SHADER_READ_UNIFORM_BUFFER",t[t.FRAGMENT_SHADER_READ_TEXTURE=128]="FRAGMENT_SHADER_READ_TEXTURE",t[t.FRAGMENT_SHADER_READ_COLOR_INPUT_ATTACHMENT=256]="FRAGMENT_SHADER_READ_COLOR_INPUT_ATTACHMENT",t[t.FRAGMENT_SHADER_READ_DEPTH_STENCIL_INPUT_ATTACHMENT=512]="FRAGMENT_SHADER_READ_DEPTH_STENCIL_INPUT_ATTACHMENT",t[t.FRAGMENT_SHADER_READ_OTHER=1024]="FRAGMENT_SHADER_READ_OTHER",t[t.COLOR_ATTACHMENT_READ=2048]="COLOR_ATTACHMENT_READ",t[t.DEPTH_STENCIL_ATTACHMENT_READ=4096]="DEPTH_STENCIL_ATTACHMENT_READ",t[t.COMPUTE_SHADER_READ_UNIFORM_BUFFER=8192]="COMPUTE_SHADER_READ_UNIFORM_BUFFER",t[t.COMPUTE_SHADER_READ_TEXTURE=16384]="COMPUTE_SHADER_READ_TEXTURE",t[t.COMPUTE_SHADER_READ_OTHER=32768]="COMPUTE_SHADER_READ_OTHER",t[t.TRANSFER_READ=65536]="TRANSFER_READ",t[t.HOST_READ=131072]="HOST_READ",t[t.PRESENT=262144]="PRESENT",t[t.VERTEX_SHADER_WRITE=524288]="VERTEX_SHADER_WRITE",t[t.FRAGMENT_SHADER_WRITE=1048576]="FRAGMENT_SHADER_WRITE",t[t.COLOR_ATTACHMENT_WRITE=2097152]="COLOR_ATTACHMENT_WRITE",t[t.DEPTH_STENCIL_ATTACHMENT_WRITE=4194304]="DEPTH_STENCIL_ATTACHMENT_WRITE",t[t.COMPUTE_SHADER_WRITE=8388608]="COMPUTE_SHADER_WRITE",t[t.TRANSFER_WRITE=16777216]="TRANSFER_WRITE",t[t.HOST_PREINITIALIZED=33554432]="HOST_PREINITIALIZED",t[t.HOST_WRITE=67108864]="HOST_WRITE"}(Jn||(Jn={})),function(t){t[t.NONE=0]="NONE",t[t.SAMPLE_ZERO=1]="SAMPLE_ZERO",t[t.AVERAGE=2]="AVERAGE",t[t.MIN=3]="MIN",t[t.MAX=4]="MAX"}($n||($n={})),function(t){t[t.GRAPHICS=0]="GRAPHICS",t[t.COMPUTE=1]="COMPUTE",t[t.RAY_TRACING=2]="RAY_TRACING"}(tr||(tr={})),function(t){t[t.POINT_LIST=0]="POINT_LIST",t[t.LINE_LIST=1]="LINE_LIST",t[t.LINE_STRIP=2]="LINE_STRIP",t[t.LINE_LOOP=3]="LINE_LOOP",t[t.LINE_LIST_ADJACENCY=4]="LINE_LIST_ADJACENCY",t[t.LINE_STRIP_ADJACENCY=5]="LINE_STRIP_ADJACENCY",t[t.ISO_LINE_LIST=6]="ISO_LINE_LIST",t[t.TRIANGLE_LIST=7]="TRIANGLE_LIST",t[t.TRIANGLE_STRIP=8]="TRIANGLE_STRIP",t[t.TRIANGLE_FAN=9]="TRIANGLE_FAN",t[t.TRIANGLE_LIST_ADJACENCY=10]="TRIANGLE_LIST_ADJACENCY",t[t.TRIANGLE_STRIP_ADJACENCY=11]="TRIANGLE_STRIP_ADJACENCY",t[t.TRIANGLE_PATCH_ADJACENCY=12]="TRIANGLE_PATCH_ADJACENCY",t[t.QUAD_PATCH_LIST=13]="QUAD_PATCH_LIST"}(er||(er={})),function(t){t[t.FILL=0]="FILL",t[t.POINT=1]="POINT",t[t.LINE=2]="LINE"}(ir||(ir={})),function(t){t[t.GOURAND=0]="GOURAND",t[t.FLAT=1]="FLAT"}(nr||(nr={})),function(t){t[t.NONE=0]="NONE",t[t.FRONT=1]="FRONT",t[t.BACK=2]="BACK"}(rr||(rr={})),function(t){t[t.NONE=0]="NONE",t[t.LINE_WIDTH=1]="LINE_WIDTH",t[t.DEPTH_BIAS=2]="DEPTH_BIAS",t[t.BLEND_CONSTANTS=4]="BLEND_CONSTANTS",t[t.DEPTH_BOUNDS=8]="DEPTH_BOUNDS",t[t.STENCIL_WRITE_MASK=16]="STENCIL_WRITE_MASK",t[t.STENCIL_COMPARE_MASK=32]="STENCIL_COMPARE_MASK"}(sr||(sr={})),function(t){t[t.FRONT=1]="FRONT",t[t.BACK=2]="BACK",t[t.ALL=3]="ALL"}(ar||(ar={})),function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.UNIFORM_BUFFER=1]="UNIFORM_BUFFER",t[t.DYNAMIC_UNIFORM_BUFFER=2]="DYNAMIC_UNIFORM_BUFFER",t[t.STORAGE_BUFFER=4]="STORAGE_BUFFER",t[t.DYNAMIC_STORAGE_BUFFER=8]="DYNAMIC_STORAGE_BUFFER",t[t.SAMPLER_TEXTURE=16]="SAMPLER_TEXTURE",t[t.SAMPLER=32]="SAMPLER",t[t.TEXTURE=64]="TEXTURE",t[t.STORAGE_IMAGE=128]="STORAGE_IMAGE",t[t.INPUT_ATTACHMENT=256]="INPUT_ATTACHMENT"}(or||(or={})),function(t){t[t.GRAPHICS=0]="GRAPHICS",t[t.COMPUTE=1]="COMPUTE",t[t.TRANSFER=2]="TRANSFER"}(ur||(ur={})),function(t){t[t.OCCLUSION=0]="OCCLUSION",t[t.PIPELINE_STATISTICS=1]="PIPELINE_STATISTICS",t[t.TIMESTAMP=2]="TIMESTAMP"}(hr||(hr={})),function(t){t[t.PRIMARY=0]="PRIMARY",t[t.SECONDARY=1]="SECONDARY"}(lr||(lr={})),function(t){t[t.NONE=0]="NONE",t[t.COLOR=1]="COLOR",t[t.DEPTH=2]="DEPTH",t[t.STENCIL=4]="STENCIL",t[t.DEPTH_STENCIL=6]="DEPTH_STENCIL",t[t.ALL=7]="ALL"}(cr||(cr={})),function(t){t[t.FULL=0]="FULL",t[t.SPLIT_BEGIN=1]="SPLIT_BEGIN",t[t.SPLIT_END=2]="SPLIT_END"}(_r||(_r={})),function(t){t[t.RASTER=0]="RASTER",t[t.COMPUTE=1]="COMPUTE",t[t.COPY=2]="COPY",t[t.MOVE=3]="MOVE",t[t.RAYTRACE=4]="RAYTRACE",t[t.PRESENT=5]="PRESENT"}(fr||(fr={}));var gr,vr=function(){function t(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this.x=t,this.y=e,this.z=i}return t.prototype.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},t}(),yr=function(){function t(t,e,i,n,r,s,a,o,u,h,l,c,_,f,d,p,m,g,v,y,E,T){void 0===t&&(t=0),void 0===e&&(e=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===l&&(l=0),void 0===c&&(c=0),void 0===_&&(_=0),void 0===f&&(f=1),void 0===d&&(d=0),void 0===p&&(p=0),void 0===m&&(m=new vr),void 0===g&&(g=new vr),void 0===v&&(v=!1),void 0===y&&(y=-1),void 0===E&&(E=1),void 0===T&&(T=1),this.maxVertexAttributes=t,this.maxVertexUniformVectors=e,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=l,this.maxTextureSize=c,this.maxCubeMapTextureSize=_,this.uboOffsetAlignment=f,this.maxComputeSharedMemorySize=d,this.maxComputeWorkGroupInvocations=p,this.maxComputeWorkGroupSize=m,this.maxComputeWorkGroupCount=g,this.supportQuery=v,this.clipSpaceMinZ=y,this.screenSpaceSignY=E,this.clipSpaceSignY=T}return t.prototype.copy=function(t){return this.maxVertexAttributes=t.maxVertexAttributes,this.maxVertexUniformVectors=t.maxVertexUniformVectors,this.maxFragmentUniformVectors=t.maxFragmentUniformVectors,this.maxTextureUnits=t.maxTextureUnits,this.maxImageUnits=t.maxImageUnits,this.maxVertexTextureUnits=t.maxVertexTextureUnits,this.maxColorRenderTargets=t.maxColorRenderTargets,this.maxShaderStorageBufferBindings=t.maxShaderStorageBufferBindings,this.maxShaderStorageBlockSize=t.maxShaderStorageBlockSize,this.maxUniformBufferBindings=t.maxUniformBufferBindings,this.maxUniformBlockSize=t.maxUniformBlockSize,this.maxTextureSize=t.maxTextureSize,this.maxCubeMapTextureSize=t.maxCubeMapTextureSize,this.uboOffsetAlignment=t.uboOffsetAlignment,this.maxComputeSharedMemorySize=t.maxComputeSharedMemorySize,this.maxComputeWorkGroupInvocations=t.maxComputeWorkGroupInvocations,this.maxComputeWorkGroupSize.copy(t.maxComputeWorkGroupSize),this.maxComputeWorkGroupCount.copy(t.maxComputeWorkGroupCount),this.supportQuery=t.supportQuery,this.clipSpaceMinZ=t.clipSpaceMinZ,this.screenSpaceSignY=t.screenSpaceSignY,this.clipSpaceSignY=t.clipSpaceSignY,this},t}(),Er=function(){function t(t){void 0===t&&(t=!0),this.enableBarrierDeduce=t}return t.prototype.copy=function(t){return this.enableBarrierDeduce=t.enableBarrierDeduce,this},t}(),Tr=function(){function t(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this.x=t,this.y=e,this.z=i}return t.prototype.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},t}(),Sr=function(){function t(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),this.x=t,this.y=e,this.width=i,this.height=n}return t.prototype.copy=function(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this},t}(),Ar=function(){function t(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=1),this.width=t,this.height=e,this.depth=i}return t.prototype.copy=function(t){return this.width=t.width,this.height=t.height,this.depth=t.depth,this},t}(),Rr=function(){function t(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=1),this.mipLevel=t,this.baseArrayLayer=e,this.layerCount=i}return t.prototype.copy=function(t){return this.mipLevel=t.mipLevel,this.baseArrayLayer=t.baseArrayLayer,this.layerCount=t.layerCount,this},t}(),br=function(){function t(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=1),void 0===i&&(i=0),void 0===n&&(n=1),this.baseMipLevel=t,this.levelCount=e,this.baseArrayLayer=i,this.layerCount=n}return t.prototype.copy=function(t){return this.baseMipLevel=t.baseMipLevel,this.levelCount=t.levelCount,this.baseArrayLayer=t.baseArrayLayer,this.layerCount=t.layerCount,this},t}(),Cr=function(){function t(t,e,i,n,r){void 0===t&&(t=new Rr),void 0===e&&(e=new Tr),void 0===i&&(i=new Rr),void 0===n&&(n=new Tr),void 0===r&&(r=new Ar),this.srcSubres=t,this.srcOffset=e,this.dstSubres=i,this.dstOffset=n,this.extent=r}return t.prototype.copy=function(t){return this.srcSubres.copy(t.srcSubres),this.srcOffset.copy(t.srcOffset),this.dstSubres.copy(t.dstSubres),this.dstOffset.copy(t.dstOffset),this.extent.copy(t.extent),this},t}(),wr=function(){function t(t,e,i,n,r,s){void 0===t&&(t=new Rr),void 0===e&&(e=new Tr),void 0===i&&(i=new Ar),void 0===n&&(n=new Rr),void 0===r&&(r=new Tr),void 0===s&&(s=new Ar),this.srcSubres=t,this.srcOffset=e,this.srcExtent=i,this.dstSubres=n,this.dstOffset=r,this.dstExtent=s}return t.prototype.copy=function(t){return this.srcSubres.copy(t.srcSubres),this.srcOffset.copy(t.srcOffset),this.srcExtent.copy(t.srcExtent),this.dstSubres.copy(t.dstSubres),this.dstOffset.copy(t.dstOffset),this.dstExtent.copy(t.dstExtent),this},t}(),Ir=function(){function t(t,e,i,n,r,s){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=new Tr),void 0===r&&(r=new Ar),void 0===s&&(s=new Rr),this.buffOffset=t,this.buffStride=e,this.buffTexHeight=i,this.texOffset=n,this.texExtent=r,this.texSubres=s}return t.prototype.copy=function(t){return this.buffOffset=t.buffOffset,this.buffStride=t.buffStride,this.buffTexHeight=t.buffTexHeight,this.texOffset.copy(t.texOffset),this.texExtent.copy(t.texExtent),this.texSubres.copy(t.texSubres),this},t}(),Or=function(){function t(t,e,i,n,r,s){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=1),this.left=t,this.top=e,this.width=i,this.height=n,this.minDepth=r,this.maxDepth=s}return t.prototype.copy=function(t){return this.left=t.left,this.top=t.top,this.width=t.width,this.height=t.height,this.minDepth=t.minDepth,this.maxDepth=t.maxDepth,this},t}(),Pr=function(){function t(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),this.x=t,this.y=e,this.z=i,this.w=n}return t.prototype.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},t}(),Dr=function(){function t(t,e,i,n,r,s,a,o){void 0===t&&(t=[0]),void 0===e&&(e=[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=t,this.maxSamplerTextureCounts=e,this.maxSamplerCounts=i,this.maxTextureCounts=n,this.maxBufferCounts=r,this.maxImageCounts=s,this.maxSubpassInputCounts=a,this.setIndices=o}return t.prototype.copy=function(t){return this.maxBlockCounts=t.maxBlockCounts.slice(),this.maxSamplerTextureCounts=t.maxSamplerTextureCounts.slice(),this.maxSamplerCounts=t.maxSamplerCounts.slice(),this.maxTextureCounts=t.maxTextureCounts.slice(),this.maxBufferCounts=t.maxBufferCounts.slice(),this.maxImageCounts=t.maxImageCounts.slice(),this.maxSubpassInputCounts=t.maxSubpassInputCounts.slice(),this.setIndices=t.setIndices.slice(),this},t}(),Br=function(){function t(t,e,i,n){void 0===t&&(t=null),void 0===e&&(e=zn.ON),void 0===i&&(i=0),void 0===n&&(n=0),this.windowHandle=t,this.vsyncMode=e,this.width=i,this.height=n}return t.prototype.copy=function(t){return this.windowHandle=t.windowHandle,this.vsyncMode=t.vsyncMode,this.width=t.width,this.height=t.height,this},t}(),Nr=function(){function t(t){void 0===t&&(t=new Dr),this.bindingMappingInfo=t}return t.prototype.copy=function(t){return this.bindingMappingInfo.copy(t.bindingMappingInfo),this},t}(),Mr=function(){function t(t,e,i,n,r){void 0===t&&(t=Dn.NONE),void 0===e&&(e=Mn.NONE),void 0===i&&(i=0),void 0===n&&(n=1),void 0===r&&(r=Bn.NONE),this.usage=t,this.memUsage=e,this.size=i,this.stride=n,this.flags=r}return t.prototype.copy=function(t){return this.usage=t.usage,this.memUsage=t.memUsage,this.size=t.size,this.stride=t.stride,this.flags=t.flags,this},t}(),Lr=function(){function t(t,e,i){void 0===t&&(t=null),void 0===e&&(e=0),void 0===i&&(i=0),this.buffer=t,this.offset=e,this.range=i}return t.prototype.copy=function(t){return this.buffer=t.buffer,this.offset=t.offset,this.range=t.range,this},t}(),Fr=function(){function t(t,e,i,n,r,s,a){void 0===t&&(t=0),void 0===e&&(e=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=t,this.firstVertex=e,this.indexCount=i,this.firstIndex=n,this.vertexOffset=r,this.instanceCount=s,this.firstInstance=a}return t.prototype.copy=function(t){return this.vertexCount=t.vertexCount,this.firstVertex=t.firstVertex,this.indexCount=t.indexCount,this.firstIndex=t.firstIndex,this.vertexOffset=t.vertexOffset,this.instanceCount=t.instanceCount,this.firstInstance=t.firstInstance,this},t}(),Ur=function(){function t(t,e,i,n,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=null),void 0===r&&(r=0),this.groupCountX=t,this.groupCountY=e,this.groupCountZ=i,this.indirectBuffer=n,this.indirectOffset=r}return t.prototype.copy=function(t){return this.groupCountX=t.groupCountX,this.groupCountY=t.groupCountY,this.groupCountZ=t.groupCountZ,this.indirectBuffer=t.indirectBuffer,this.indirectOffset=t.indirectOffset,this},t}(),Gr=function(){function t(t){void 0===t&&(t=[]),this.drawInfos=t}return t.prototype.copy=function(t){return mr(this.drawInfos,t.drawInfos,Fr),this},t}(),kr=function(){function t(t,e,i,n,r,s,a,o,u,h,l){void 0===t&&(t=Ln.TEX2D),void 0===e&&(e=Fn.NONE),void 0===i&&(i=On.UNKNOWN),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=Un.NONE),void 0===a&&(a=1),void 0===o&&(o=1),void 0===u&&(u=kn.ONE),void 0===h&&(h=1),void 0===l&&(l=0),this.type=t,this.usage=e,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=l}return t.prototype.copy=function(t){return this.type=t.type,this.usage=t.usage,this.format=t.format,this.width=t.width,this.height=t.height,this.flags=t.flags,this.layerCount=t.layerCount,this.levelCount=t.levelCount,this.samples=t.samples,this.depth=t.depth,this.externalRes=t.externalRes,this},t}(),zr=function(){function t(t,e,i,n,r,s,a){void 0===t&&(t=null),void 0===e&&(e=Ln.TEX2D),void 0===i&&(i=On.UNKNOWN),void 0===n&&(n=0),void 0===r&&(r=1),void 0===s&&(s=0),void 0===a&&(a=1),this.texture=t,this.type=e,this.format=i,this.baseLevel=n,this.levelCount=r,this.baseLayer=s,this.layerCount=a}return t.prototype.copy=function(t){return this.texture=t.texture,this.type=t.type,this.format=t.format,this.baseLevel=t.baseLevel,this.levelCount=t.levelCount,this.baseLayer=t.baseLayer,this.layerCount=t.layerCount,this},t}(),Hr=function(){function t(t,e,i,n,r,s,a,o){void 0===t&&(t=Hn.LINEAR),void 0===e&&(e=Hn.LINEAR),void 0===i&&(i=Hn.NONE),void 0===n&&(n=Vn.WRAP),void 0===r&&(r=Vn.WRAP),void 0===s&&(s=Vn.WRAP),void 0===a&&(a=0),void 0===o&&(o=Wn.ALWAYS),this.minFilter=t,this.magFilter=e,this.mipFilter=i,this.addressU=n,this.addressV=r,this.addressW=s,this.maxAnisotropy=a,this.cmpFunc=o}return t.prototype.copy=function(t){return this.minFilter=t.minFilter,this.magFilter=t.magFilter,this.mipFilter=t.mipFilter,this.addressU=t.addressU,this.addressV=t.addressV,this.addressW=t.addressW,this.maxAnisotropy=t.maxAnisotropy,this.cmpFunc=t.cmpFunc,this},t}(),Vr=function(){function t(t,e,i){void 0===t&&(t=""),void 0===e&&(e=Pn.UNKNOWN),void 0===i&&(i=0),this.name=t,this.type=e,this.count=i}return t.prototype.copy=function(t){return this.name=t.name,this.type=t.type,this.count=t.count,this},t}(),Wr=function(){function t(t,e,i,n,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=""),void 0===n&&(n=[]),void 0===r&&(r=0),this.set=t,this.binding=e,this.name=i,this.members=n,this.count=r}return t.prototype.copy=function(t){return this.set=t.set,this.binding=t.binding,this.name=t.name,mr(this.members,t.members,Vr),this.count=t.count,this},t}(),Xr=function(){function t(t,e,i,n,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=""),void 0===n&&(n=Pn.UNKNOWN),void 0===r&&(r=0),this.set=t,this.binding=e,this.name=i,this.type=n,this.count=r}return t.prototype.copy=function(t){return this.set=t.set,this.binding=t.binding,this.name=t.name,this.type=t.type,this.count=t.count,this},t}(),jr=function(){function t(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=""),void 0===n&&(n=0),this.set=t,this.binding=e,this.name=i,this.count=n}return t.prototype.copy=function(t){return this.set=t.set,this.binding=t.binding,this.name=t.name,this.count=t.count,this},t}(),Yr=function(){function t(t,e,i,n,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=""),void 0===n&&(n=Pn.UNKNOWN),void 0===r&&(r=0),this.set=t,this.binding=e,this.name=i,this.type=n,this.count=r}return t.prototype.copy=function(t){return this.set=t.set,this.binding=t.binding,this.name=t.name,this.type=t.type,this.count=t.count,this},t}(),Kr=function(){function t(t,e,i,n,r,s){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=""),void 0===n&&(n=Pn.UNKNOWN),void 0===r&&(r=0),void 0===s&&(s=Nn.READ_WRITE),this.set=t,this.binding=e,this.name=i,this.type=n,this.count=r,this.memoryAccess=s}return t.prototype.copy=function(t){return this.set=t.set,this.binding=t.binding,this.name=t.name,this.type=t.type,this.count=t.count,this.memoryAccess=t.memoryAccess,this},t}(),qr=function(){function t(t,e,i,n,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=""),void 0===n&&(n=0),void 0===r&&(r=Nn.READ_WRITE),this.set=t,this.binding=e,this.name=i,this.count=n,this.memoryAccess=r}return t.prototype.copy=function(t){return this.set=t.set,this.binding=t.binding,this.name=t.name,this.count=t.count,this.memoryAccess=t.memoryAccess,this},t}(),Qr=function(){function t(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=""),void 0===n&&(n=0),this.set=t,this.binding=e,this.name=i,this.count=n}return t.prototype.copy=function(t){return this.set=t.set,this.binding=t.binding,this.name=t.name,this.count=t.count,this},t}(),Zr=function(){function t(t,e){void 0===t&&(t=qn.NONE),void 0===e&&(e=""),this.stage=t,this.source=e}return t.prototype.copy=function(t){return this.stage=t.stage,this.source=t.source,this},t}(),Jr=function(){function t(t,e,i,n,r,s){void 0===t&&(t=""),void 0===e&&(e=On.UNKNOWN),void 0===i&&(i=!1),void 0===n&&(n=0),void 0===r&&(r=!1),void 0===s&&(s=0),this.name=t,this.format=e,this.isNormalized=i,this.stream=n,this.isInstanced=r,this.location=s}return t.prototype.copy=function(t){return this.name=t.name,this.format=t.format,this.isNormalized=t.isNormalized,this.stream=t.stream,this.isInstanced=t.isInstanced,this.location=t.location,this},t}(),$r=function(){function t(t,e,i,n,r,s,a,o,u,h){void 0===t&&(t=""),void 0===e&&(e=[]),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=t,this.stages=e,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 t.prototype.copy=function(t){return this.name=t.name,mr(this.stages,t.stages,Zr),mr(this.attributes,t.attributes,Jr),mr(this.blocks,t.blocks,Wr),mr(this.buffers,t.buffers,qr),mr(this.samplerTextures,t.samplerTextures,Xr),mr(this.samplers,t.samplers,jr),mr(this.textures,t.textures,Yr),mr(this.images,t.images,Kr),mr(this.subpassInputs,t.subpassInputs,Qr),this},t}(),ts=function(){function t(t,e,i,n){void 0===t&&(t=[]),void 0===e&&(e=[]),void 0===i&&(i=null),void 0===n&&(n=null),this.attributes=t,this.vertexBuffers=e,this.indexBuffer=i,this.indirectBuffer=n}return t.prototype.copy=function(t){return mr(this.attributes,t.attributes,Jr),this.vertexBuffers=t.vertexBuffers.slice(),this.indexBuffer=t.indexBuffer,this.indirectBuffer=t.indirectBuffer,this},t}(),es=function(){function t(t,e,i,n,r,s){void 0===t&&(t=On.UNKNOWN),void 0===e&&(e=kn.ONE),void 0===i&&(i=Qn.CLEAR),void 0===n&&(n=Zn.STORE),void 0===r&&(r=null),void 0===s&&(s=!1),this.format=t,this.sampleCount=e,this.loadOp=i,this.storeOp=n,this.barrier=r,this.isGeneralLayout=s}return t.prototype.copy=function(t){return this.format=t.format,this.sampleCount=t.sampleCount,this.loadOp=t.loadOp,this.storeOp=t.storeOp,this.barrier=t.barrier,this.isGeneralLayout=t.isGeneralLayout,this},t}(),is=function(){function t(t,e,i,n,r,s,a,o){void 0===t&&(t=On.UNKNOWN),void 0===e&&(e=kn.ONE),void 0===i&&(i=Qn.CLEAR),void 0===n&&(n=Zn.STORE),void 0===r&&(r=Qn.CLEAR),void 0===s&&(s=Zn.STORE),void 0===a&&(a=null),void 0===o&&(o=!1),this.format=t,this.sampleCount=e,this.depthLoadOp=i,this.depthStoreOp=n,this.stencilLoadOp=r,this.stencilStoreOp=s,this.barrier=a,this.isGeneralLayout=o}return t.prototype.copy=function(t){return this.format=t.format,this.sampleCount=t.sampleCount,this.depthLoadOp=t.depthLoadOp,this.depthStoreOp=t.depthStoreOp,this.stencilLoadOp=t.stencilLoadOp,this.stencilStoreOp=t.stencilStoreOp,this.barrier=t.barrier,this.isGeneralLayout=t.isGeneralLayout,this},t}(),ns=function(){function t(t,e,i,n,r,s,a,o){void 0===t&&(t=[]),void 0===e&&(e=[]),void 0===i&&(i=[]),void 0===n&&(n=[]),void 0===r&&(r=-1),void 0===s&&(s=-1),void 0===a&&(a=$n.NONE),void 0===o&&(o=$n.NONE),this.inputs=t,this.colors=e,this.resolves=i,this.preserves=n,this.depthStencil=r,this.depthStencilResolve=s,this.depthResolveMode=a,this.stencilResolveMode=o}return t.prototype.copy=function(t){return this.inputs=t.inputs.slice(),this.colors=t.colors.slice(),this.resolves=t.resolves.slice(),this.preserves=t.preserves.slice(),this.depthStencil=t.depthStencil,this.depthStencilResolve=t.depthStencilResolve,this.depthResolveMode=t.depthResolveMode,this.stencilResolveMode=t.stencilResolveMode,this},t}(),rs=function(){function t(t,e,i,n,r,s,a,o,u){void 0===t&&(t=0),void 0===e&&(e=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=t,this.dstSubpass=e,this.generalBarrier=i,this.bufferBarriers=n,this.buffers=r,this.bufferBarrierCount=s,this.textureBarriers=a,this.textures=o,this.textureBarrierCount=u}return t.prototype.copy=function(t){return this.srcSubpass=t.srcSubpass,this.dstSubpass=t.dstSubpass,this.generalBarrier=t.generalBarrier,this.bufferBarriers=t.bufferBarriers,this.buffers=t.buffers,this.bufferBarrierCount=t.bufferBarrierCount,this.textureBarriers=t.textureBarriers,this.textures=t.textures,this.textureBarrierCount=t.textureBarrierCount,this},t}(),ss=function(){function t(t,e,i,n){void 0===t&&(t=[]),void 0===e&&(e=new is),void 0===i&&(i=[]),void 0===n&&(n=[]),this.colorAttachments=t,this.depthStencilAttachment=e,this.subpasses=i,this.dependencies=n}return t.prototype.copy=function(t){return mr(this.colorAttachments,t.colorAttachments,es),this.depthStencilAttachment.copy(t.depthStencilAttachment),mr(this.subpasses,t.subpasses,ns),mr(this.dependencies,t.dependencies,rs),this},t}(),as=function(){function t(t,e,i){void 0===t&&(t=Jn.NONE),void 0===e&&(e=Jn.NONE),void 0===i&&(i=_r.FULL),this.prevAccesses=t,this.nextAccesses=e,this.type=i}return t.prototype.copy=function(t){return this.prevAccesses=t.prevAccesses,this.nextAccesses=t.nextAccesses,this.type=t.type,this},t}(),os=function(){function t(t,e,i,n,r,s,a,o,u,h){void 0===t&&(t=Jn.NONE),void 0===e&&(e=Jn.NONE),void 0===i&&(i=_r.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=t,this.nextAccesses=e,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 t.prototype.copy=function(t){return this.prevAccesses=t.prevAccesses,this.nextAccesses=t.nextAccesses,this.type=t.type,this.baseMipLevel=t.baseMipLevel,this.levelCount=t.levelCount,this.baseSlice=t.baseSlice,this.sliceCount=t.sliceCount,this.discardContents=t.discardContents,this.srcQueue=t.srcQueue,this.dstQueue=t.dstQueue,this},t}(),us=function(){function t(t,e,i,n,r,s,a,o){void 0===t&&(t=Jn.NONE),void 0===e&&(e=Jn.NONE),void 0===i&&(i=_r.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=t,this.nextAccesses=e,this.type=i,this.offset=n,this.size=r,this.discardContents=s,this.srcQueue=a,this.dstQueue=o}return t.prototype.copy=function(t){return this.prevAccesses=t.prevAccesses,this.nextAccesses=t.nextAccesses,this.type=t.type,this.offset=t.offset,this.size=t.size,this.discardContents=t.discardContents,this.srcQueue=t.srcQueue,this.dstQueue=t.dstQueue,this},t}(),hs=function(){function t(t,e,i){void 0===t&&(t=null),void 0===e&&(e=[]),void 0===i&&(i=null),this.renderPass=t,this.colorTextures=e,this.depthStencilTexture=i}return t.prototype.copy=function(t){return this.renderPass=t.renderPass,this.colorTextures=t.colorTextures.slice(),this.depthStencilTexture=t.depthStencilTexture,this},t}(),ls=function(){function t(t,e,i,n,r){void 0===t&&(t=-1),void 0===e&&(e=or.UNKNOWN),void 0===i&&(i=0),void 0===n&&(n=qn.NONE),void 0===r&&(r=[]),this.binding=t,this.descriptorType=e,this.count=i,this.stageFlags=n,this.immutableSamplers=r}return t.prototype.copy=function(t){return this.binding=t.binding,this.descriptorType=t.descriptorType,this.count=t.count,this.stageFlags=t.stageFlags,this.immutableSamplers=t.immutableSamplers.slice(),this},t}(),cs=function(){function t(t){void 0===t&&(t=[]),this.bindings=t}return t.prototype.copy=function(t){return mr(this.bindings,t.bindings,ls),this},t}(),_s=function(){function t(t){void 0===t&&(t=null),this.layout=t}return t.prototype.copy=function(t){return this.layout=t.layout,this},t}(),fs=function(){function t(t){void 0===t&&(t=[]),this.setLayouts=t}return t.prototype.copy=function(t){return this.setLayouts=t.setLayouts.slice(),this},t}(),ds=function(){function t(t){void 0===t&&(t=[]),this.attributes=t}return t.prototype.copy=function(t){return mr(this.attributes,t.attributes,Jr),this},t}(),ps=function(){function t(t,e){void 0===t&&(t=null),void 0===e&&(e=lr.PRIMARY),this.queue=t,this.type=e}return t.prototype.copy=function(t){return this.queue=t.queue,this.type=t.type,this},t}(),ms=function(){function t(t){void 0===t&&(t=ur.GRAPHICS),this.type=t}return t.prototype.copy=function(t){return this.type=t.type,this},t}(),gs=function(){function t(t,e,i){void 0===t&&(t=hr.OCCLUSION),void 0===e&&(e=32767),void 0===i&&(i=!0),this.type=t,this.maxQueryObjects=e,this.forceWait=i}return t.prototype.copy=function(t){return this.type=t.type,this.maxQueryObjects=t.maxQueryObjects,this.forceWait=t.forceWait,this},t}(),vs=function(t,e,i,n,r,s,a,o){void 0===t&&(t=""),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=xn.NONE),void 0===r&&(r=!1),void 0===s&&(s=!1),void 0===a&&(a=!1),void 0===o&&(o=!1),this.name=t,this.size=e,this.count=i,this.type=n,this.hasAlpha=r,this.hasDepth=s,this.hasStencil=a,this.isCompressed=o},ys=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.bufferSize=t,this.textureSize=e}return t.prototype.copy=function(t){return this.bufferSize=t.bufferSize,this.textureSize=t.textureSize,this},t}(),Es=function(){function t(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this.writeMask=t,this.compareMask=e,this.reference=i}return t.prototype.copy=function(t){return this.writeMask=t.writeMask,this.compareMask=t.compareMask,this.reference=t.reference,this},t}(),Ts=function(){function t(t,e,i,n,r,s,a,o,u,h,l){void 0===t&&(t=new Or),void 0===e&&(e=new Sr),void 0===i&&(i=new Pr),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 Es),void 0===l&&(l=new Es),this.viewport=t,this.scissor=e,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=l}return t.prototype.copy=function(t){return this.viewport.copy(t.viewport),this.scissor.copy(t.scissor),this.blendConstant.copy(t.blendConstant),this.lineWidth=t.lineWidth,this.depthBiasConstant=t.depthBiasConstant,this.depthBiasClamp=t.depthBiasClamp,this.depthBiasSlope=t.depthBiasSlope,this.depthMinBounds=t.depthMinBounds,this.depthMaxBounds=t.depthMaxBounds,this.stencilStatesFront.copy(t.stencilStatesFront),this.stencilStatesBack.copy(t.stencilStatesBack),this},t}(),Ss=function(t){function e(i){var n;return(n=t.call(this)||this)._objectType=Rn.UNKNOWN,n._objectID=0,n._typedID=0,n._objectType=i,n._objectID=e._idTable[Rn.UNKNOWN]++,n._typedID=e._idTable[i]++,n}return c(e,t),h(e,[{key:"objectType",get:function(){return this._objectType}},{key:"objectID",get:function(){return this._objectID}},{key:"typedID",get:function(){return this._typedID}}]),e}(pr);Ss._idTable=Array(Rn.COUNT).fill(65536),function(t){t.ATTR_POSITION="a_position",t.ATTR_NORMAL="a_normal",t.ATTR_TANGENT="a_tangent",t.ATTR_BITANGENT="a_bitangent",t.ATTR_WEIGHTS="a_weights",t.ATTR_JOINTS="a_joints",t.ATTR_COLOR="a_color",t.ATTR_COLOR1="a_color1",t.ATTR_COLOR2="a_color2",t.ATTR_TEX_COORD="a_texCoord",t.ATTR_TEX_COORD1="a_texCoord1",t.ATTR_TEX_COORD2="a_texCoord2",t.ATTR_TEX_COORD3="a_texCoord3",t.ATTR_TEX_COORD4="a_texCoord4",t.ATTR_TEX_COORD5="a_texCoord5",t.ATTR_TEX_COORD6="a_texCoord6",t.ATTR_TEX_COORD7="a_texCoord7",t.ATTR_TEX_COORD8="a_texCoord8",t.ATTR_BATCH_ID="a_batch_id",t.ATTR_BATCH_UV="a_batch_uv"}(gr||(gr={}));var As=Object.freeze([new vs("UNKNOWN",0,0,xn.NONE,!1,!1,!1,!1),new vs("A8",1,1,xn.UNORM,!0,!1,!1,!1),new vs("L8",1,1,xn.UNORM,!1,!1,!1,!1),new vs("LA8",1,2,xn.UNORM,!0,!1,!1,!1),new vs("R8",1,1,xn.UNORM,!1,!1,!1,!1),new vs("R8SN",1,1,xn.SNORM,!1,!1,!1,!1),new vs("R8UI",1,1,xn.UINT,!1,!1,!1,!1),new vs("R8I",1,1,xn.INT,!1,!1,!1,!1),new vs("R16F",2,1,xn.FLOAT,!1,!1,!1,!1),new vs("R16UI",2,1,xn.UINT,!1,!1,!1,!1),new vs("R16I",2,1,xn.INT,!1,!1,!1,!1),new vs("R32F",4,1,xn.FLOAT,!1,!1,!1,!1),new vs("R32UI",4,1,xn.UINT,!1,!1,!1,!1),new vs("R32I",4,1,xn.INT,!1,!1,!1,!1),new vs("RG8",2,2,xn.UNORM,!1,!1,!1,!1),new vs("RG8SN",2,2,xn.SNORM,!1,!1,!1,!1),new vs("RG8UI",2,2,xn.UINT,!1,!1,!1,!1),new vs("RG8I",2,2,xn.INT,!1,!1,!1,!1),new vs("RG16F",4,2,xn.FLOAT,!1,!1,!1,!1),new vs("RG16UI",4,2,xn.UINT,!1,!1,!1,!1),new vs("RG16I",4,2,xn.INT,!1,!1,!1,!1),new vs("RG32F",8,2,xn.FLOAT,!1,!1,!1,!1),new vs("RG32UI",8,2,xn.UINT,!1,!1,!1,!1),new vs("RG32I",8,2,xn.INT,!1,!1,!1,!1),new vs("RGB8",3,3,xn.UNORM,!1,!1,!1,!1),new vs("SRGB8",3,3,xn.UNORM,!1,!1,!1,!1),new vs("RGB8SN",3,3,xn.SNORM,!1,!1,!1,!1),new vs("RGB8UI",3,3,xn.UINT,!1,!1,!1,!1),new vs("RGB8I",3,3,xn.INT,!1,!1,!1,!1),new vs("RGB16F",6,3,xn.FLOAT,!1,!1,!1,!1),new vs("RGB16UI",6,3,xn.UINT,!1,!1,!1,!1),new vs("RGB16I",6,3,xn.INT,!1,!1,!1,!1),new vs("RGB32F",12,3,xn.FLOAT,!1,!1,!1,!1),new vs("RGB32UI",12,3,xn.UINT,!1,!1,!1,!1),new vs("RGB32I",12,3,xn.INT,!1,!1,!1,!1),new vs("RGBA8",4,4,xn.UNORM,!0,!1,!1,!1),new vs("BGRA8",4,4,xn.UNORM,!0,!1,!1,!1),new vs("SRGB8_A8",4,4,xn.UNORM,!0,!1,!1,!1),new vs("RGBA8SN",4,4,xn.SNORM,!0,!1,!1,!1),new vs("RGBA8UI",4,4,xn.UINT,!0,!1,!1,!1),new vs("RGBA8I",4,4,xn.INT,!0,!1,!1,!1),new vs("RGBA16F",8,4,xn.FLOAT,!0,!1,!1,!1),new vs("RGBA16UI",8,4,xn.UINT,!0,!1,!1,!1),new vs("RGBA16I",8,4,xn.INT,!0,!1,!1,!1),new vs("RGBA32F",16,4,xn.FLOAT,!0,!1,!1,!1),new vs("RGBA32UI",16,4,xn.UINT,!0,!1,!1,!1),new vs("RGBA32I",16,4,xn.INT,!0,!1,!1,!1),new vs("R5G6B5",2,3,xn.UNORM,!1,!1,!1,!1),new vs("R11G11B10F",4,3,xn.FLOAT,!1,!1,!1,!1),new vs("RGB5A1",2,4,xn.UNORM,!0,!1,!1,!1),new vs("RGBA4",2,4,xn.UNORM,!0,!1,!1,!1),new vs("RGB10A2",2,4,xn.UNORM,!0,!1,!1,!1),new vs("RGB10A2UI",2,4,xn.UINT,!0,!1,!1,!1),new vs("RGB9E5",2,4,xn.FLOAT,!0,!1,!1,!1),new vs("DEPTH",4,1,xn.FLOAT,!1,!0,!1,!1),new vs("DEPTH_STENCIL",5,2,xn.FLOAT,!1,!0,!0,!1),new vs("BC1",1,3,xn.UNORM,!1,!1,!1,!0),new vs("BC1_ALPHA",1,4,xn.UNORM,!0,!1,!1,!0),new vs("BC1_SRGB",1,3,xn.UNORM,!1,!1,!1,!0),new vs("BC1_SRGB_ALPHA",1,4,xn.UNORM,!0,!1,!1,!0),new vs("BC2",1,4,xn.UNORM,!0,!1,!1,!0),new vs("BC2_SRGB",1,4,xn.UNORM,!0,!1,!1,!0),new vs("BC3",1,4,xn.UNORM,!0,!1,!1,!0),new vs("BC3_SRGB",1,4,xn.UNORM,!0,!1,!1,!0),new vs("BC4",1,1,xn.UNORM,!1,!1,!1,!0),new vs("BC4_SNORM",1,1,xn.SNORM,!1,!1,!1,!0),new vs("BC5",1,2,xn.UNORM,!1,!1,!1,!0),new vs("BC5_SNORM",1,2,xn.SNORM,!1,!1,!1,!0),new vs("BC6H_UF16",1,3,xn.UFLOAT,!1,!1,!1,!0),new vs("BC6H_SF16",1,3,xn.FLOAT,!1,!1,!1,!0),new vs("BC7",1,4,xn.UNORM,!0,!1,!1,!0),new vs("BC7_SRGB",1,4,xn.UNORM,!0,!1,!1,!0),new vs("ETC_RGB8",1,3,xn.UNORM,!1,!1,!1,!0),new vs("ETC2_RGB8",1,3,xn.UNORM,!1,!1,!1,!0),new vs("ETC2_SRGB8",1,3,xn.UNORM,!1,!1,!1,!0),new vs("ETC2_RGB8_A1",1,4,xn.UNORM,!0,!1,!1,!0),new vs("ETC2_SRGB8_A1",1,4,xn.UNORM,!0,!1,!1,!0),new vs("ETC2_RGBA8",2,4,xn.UNORM,!0,!1,!1,!0),new vs("ETC2_SRGB8_A8",2,4,xn.UNORM,!0,!1,!1,!0),new vs("EAC_R11",1,1,xn.UNORM,!1,!1,!1,!0),new vs("EAC_R11SN",1,1,xn.SNORM,!1,!1,!1,!0),new vs("EAC_RG11",2,2,xn.UNORM,!1,!1,!1,!0),new vs("EAC_RG11SN",2,2,xn.SNORM,!1,!1,!1,!0),new vs("PVRTC_RGB2",2,3,xn.UNORM,!1,!1,!1,!0),new vs("PVRTC_RGBA2",2,4,xn.UNORM,!0,!1,!1,!0),new vs("PVRTC_RGB4",2,3,xn.UNORM,!1,!1,!1,!0),new vs("PVRTC_RGBA4",2,4,xn.UNORM,!0,!1,!1,!0),new vs("PVRTC2_2BPP",2,4,xn.UNORM,!0,!1,!1,!0),new vs("PVRTC2_4BPP",2,4,xn.UNORM,!0,!1,!1,!0),new vs("ASTC_RGBA_4x4",1,4,xn.UNORM,!0,!1,!1,!0),new vs("ASTC_RGBA_5x4",1,4,xn.UNORM,!0,!1,!1,!0),new vs("ASTC_RGBA_5x5",1,4,xn.UNORM,!0,!1,!1,!0),new vs("ASTC_RGBA_6x5",1,4,xn.UNORM,!0,!1,!1,!0),new vs("ASTC_RGBA_6x6",1,4,xn.UNORM,!0,!1,!1,!0),new vs("ASTC_RGBA_8x5",1,4,xn.UNORM,!0,!1,!1,!0),new vs("ASTC_RGBA_8x6",1,4,xn.UNORM,!0,!1,!1,!0),new vs("ASTC_RGBA_8x8",1,4,xn.UNORM,!0,!1,!1,!0),new vs("ASTC_RGBA_10x5",1,4,xn.UNORM,!0,!1,!1,!0),new vs("ASTC_RGBA_10x6",1,4,xn.UNORM,!0,!1,!1,!0),new vs("ASTC_RGBA_10x8",1,4,xn.UNORM,!0,!1,!1,!0),new vs("ASTC_RGBA_10x10",1,4,xn.UNORM,!0,!1,!1,!0),new vs("ASTC_RGBA_12x10",1,4,xn.UNORM,!0,!1,!1,!0),new vs("ASTC_RGBA_12x12",1,4,xn.UNORM,!0,!1,!1,!0),new vs("ASTC_SRGBA_4x4",1,4,xn.UNORM,!0,!1,!1,!0),new vs("ASTC_SRGBA_5x4",1,4,xn.UNORM,!0,!1,!1,!0),new vs("ASTC_SRGBA_5x5",1,4,xn.UNORM,!0,!1,!1,!0),new vs("ASTC_SRGBA_6x5",1,4,xn.UNORM,!0,!1,!1,!0),new vs("ASTC_SRGBA_6x6",1,4,xn.UNORM,!0,!1,!1,!0),new vs("ASTC_SRGBA_8x5",1,4,xn.UNORM,!0,!1,!1,!0),new vs("ASTC_SRGBA_8x6",1,4,xn.UNORM,!0,!1,!1,!0),new vs("ASTC_SRGBA_8x8",1,4,xn.UNORM,!0,!1,!1,!0),new vs("ASTC_SRGBA_10x5",1,4,xn.UNORM,!0,!1,!1,!0),new vs("ASTC_SRGBA_10x6",1,4,xn.UNORM,!0,!1,!1,!0),new vs("ASTC_SRGBA_10x8",1,4,xn.UNORM,!0,!1,!1,!0),new vs("ASTC_SRGBA_10x10",1,4,xn.UNORM,!0,!1,!1,!0),new vs("ASTC_SRGBA_12x10",1,4,xn.UNORM,!0,!1,!1,!0),new vs("ASTC_SRGBA_12x12",1,4,xn.UNORM,!0,!1,!1,!0)]),Rs=or.UNIFORM_BUFFER|or.DYNAMIC_UNIFORM_BUFFER|or.STORAGE_BUFFER|or.DYNAMIC_STORAGE_BUFFER,bs=or.SAMPLER_TEXTURE|or.SAMPLER|or.TEXTURE|or.STORAGE_IMAGE|or.INPUT_ATTACHMENT,Cs=or.DYNAMIC_STORAGE_BUFFER|or.DYNAMIC_UNIFORM_BUFFER;function ws(t){return t>0&&0==(t&t-1)}function Is(t,e,i,n){if(!As[t].isCompressed)return e*i*n*As[t].size;switch(t){case On.BC1:case On.BC1_ALPHA:case On.BC1_SRGB:case On.BC1_SRGB_ALPHA:return Math.ceil(e/4)*Math.ceil(i/4)*8*n;case On.BC2:case On.BC2_SRGB:case On.BC3:case On.BC3_SRGB:case On.BC4:case On.BC4_SNORM:case On.BC6H_SF16:case On.BC6H_UF16:case On.BC7:case On.BC7_SRGB:return Math.ceil(e/4)*Math.ceil(i/4)*16*n;case On.BC5:case On.BC5_SNORM:return Math.ceil(e/4)*Math.ceil(i/4)*32*n;case On.ETC_RGB8:case On.ETC2_RGB8:case On.ETC2_SRGB8:case On.ETC2_RGB8_A1:case On.EAC_R11:case On.EAC_R11SN:return Math.ceil(e/4)*Math.ceil(i/4)*8*n;case On.ETC2_RGBA8:case On.ETC2_SRGB8_A1:case On.EAC_RG11:case On.EAC_RG11SN:return Math.ceil(e/4)*Math.ceil(i/4)*16*n;case On.PVRTC_RGB2:case On.PVRTC_RGBA2:case On.PVRTC2_2BPP:return Math.ceil(e/8)*Math.ceil(i/4)*8*n;case On.PVRTC_RGB4:case On.PVRTC_RGBA4:case On.PVRTC2_4BPP:return Math.ceil(e/4)*Math.ceil(i/4)*8*n;case On.ASTC_RGBA_4X4:case On.ASTC_SRGBA_4X4:return Math.ceil(e/4)*Math.ceil(i/4)*16*n;case On.ASTC_RGBA_5X4:case On.ASTC_SRGBA_5X4:return Math.ceil(e/5)*Math.ceil(i/4)*16*n;case On.ASTC_RGBA_5X5:case On.ASTC_SRGBA_5X5:return Math.ceil(e/5)*Math.ceil(i/5)*16*n;case On.ASTC_RGBA_6X5:case On.ASTC_SRGBA_6X5:return Math.ceil(e/6)*Math.ceil(i/5)*16*n;case On.ASTC_RGBA_6X6:case On.ASTC_SRGBA_6X6:return Math.ceil(e/6)*Math.ceil(i/6)*16*n;case On.ASTC_RGBA_8X5:case On.ASTC_SRGBA_8X5:return Math.ceil(e/8)*Math.ceil(i/5)*16*n;case On.ASTC_RGBA_8X6:case On.ASTC_SRGBA_8X6:return Math.ceil(e/8)*Math.ceil(i/6)*16*n;case On.ASTC_RGBA_8X8:case On.ASTC_SRGBA_8X8:return Math.ceil(e/8)*Math.ceil(i/8)*16*n;case On.ASTC_RGBA_10X5:case On.ASTC_SRGBA_10X5:return Math.ceil(e/10)*Math.ceil(i/5)*16*n;case On.ASTC_RGBA_10X6:case On.ASTC_SRGBA_10X6:return Math.ceil(e/10)*Math.ceil(i/6)*16*n;case On.ASTC_RGBA_10X8:case On.ASTC_SRGBA_10X8:return Math.ceil(e/10)*Math.ceil(i/8)*16*n;case On.ASTC_RGBA_10X10:case On.ASTC_SRGBA_10X10:return Math.ceil(e/10)*Math.ceil(i/10)*16*n;case On.ASTC_RGBA_12X10:case On.ASTC_SRGBA_12X10:return Math.ceil(e/12)*Math.ceil(i/10)*16*n;case On.ASTC_RGBA_12X12:case On.ASTC_SRGBA_12X12:return Math.ceil(e/12)*Math.ceil(i/12)*16*n;default:return 0}}function Os(t,e,i,n,r){for(var s=0,a=0;a<r;++a)s+=Is(t,e,i,n),e=Math.max(e>>1,1),i=Math.max(i>>1,1);return s}var xs=[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 Ps(t){return xs[t]||0}function Ds(t){if(t.isCompressed)return Uint8Array;var e=t.size/t.count;switch(t.type){case xn.UNORM:case xn.UINT:switch(e){case 1:return Uint8Array;case 2:return Uint16Array;case 4:return Uint32Array;default:return Uint8Array}case xn.SNORM:case xn.INT:switch(e){case 1:return Int8Array;case 2:return Int16Array;case 4:return Int32Array;default:return Int8Array}case xn.FLOAT:return Float32Array}return Float32Array}function Bs(t){switch(t){case On.BC1:case On.BC1_ALPHA:case On.BC1_SRGB:case On.BC1_SRGB_ALPHA:case On.BC2:case On.BC2_SRGB:case On.BC3:case On.BC3_SRGB:case On.BC4:case On.BC4_SNORM:case On.BC6H_SF16:case On.BC6H_UF16:case On.BC7:case On.BC7_SRGB:case On.BC5:case On.BC5_SNORM:case On.ETC_RGB8:case On.ETC2_RGB8:case On.ETC2_SRGB8:case On.ETC2_RGB8_A1:case On.EAC_R11:case On.EAC_R11SN:case On.ETC2_RGBA8:case On.ETC2_SRGB8_A1:case On.EAC_RG11:case On.EAC_RG11SN:return{width:4,height:4};case On.PVRTC_RGB2:case On.PVRTC_RGBA2:case On.PVRTC2_2BPP:return{width:8,height:4};case On.PVRTC_RGB4:case On.PVRTC_RGBA4:case On.PVRTC2_4BPP:return{width:4,height:4};case On.ASTC_RGBA_4X4:case On.ASTC_SRGBA_4X4:return{width:4,height:4};case On.ASTC_RGBA_5X4:case On.ASTC_SRGBA_5X4:return{width:5,height:4};case On.ASTC_RGBA_5X5:case On.ASTC_SRGBA_5X5:return{width:5,height:5};case On.ASTC_RGBA_6X5:case On.ASTC_SRGBA_6X5:return{width:6,height:5};case On.ASTC_RGBA_6X6:case On.ASTC_SRGBA_6X6:return{width:6,height:6};case On.ASTC_RGBA_8X5:case On.ASTC_SRGBA_8X5:return{width:8,height:5};case On.ASTC_RGBA_8X6:case On.ASTC_SRGBA_8X6:return{width:8,height:6};case On.ASTC_RGBA_8X8:case On.ASTC_SRGBA_8X8:return{width:8,height:8};case On.ASTC_RGBA_10X5:case On.ASTC_SRGBA_10X5:return{width:10,height:5};case On.ASTC_RGBA_10X6:case On.ASTC_SRGBA_10X6:return{width:10,height:6};case On.ASTC_RGBA_10X8:case On.ASTC_SRGBA_10X8:return{width:10,height:8};case On.ASTC_RGBA_10X10:case On.ASTC_SRGBA_10X10:return{width:10,height:10};case On.ASTC_RGBA_12X10:case On.ASTC_SRGBA_12X10:return{width:12,height:10};case On.ASTC_RGBA_12X12:case On.ASTC_SRGBA_12X12:return{width:12,height:12};default:return{width:1,height:1}}}function Ns(t,e){return Math.ceil(t/e)*e}var Ms=Object.freeze({__proto__:null,get ObjectType(){return Rn},get Status(){return bn},get API(){return Cn},get SurfaceTransform(){return wn},get Feature(){return In},get Format(){return On},get FormatType(){return xn},get Type(){return Pn},get BufferUsageBit(){return Dn},get BufferFlagBit(){return Bn},get MemoryAccessBit(){return Nn},get MemoryUsageBit(){return Mn},get TextureType(){return Ln},get TextureUsageBit(){return Fn},get TextureFlagBit(){return Un},get FormatFeatureBit(){return Gn},get SampleCount(){return kn},get VsyncMode(){return zn},get Filter(){return Hn},get Address(){return Vn},get ComparisonFunc(){return Wn},get StencilOp(){return Xn},get BlendFactor(){return jn},get BlendOp(){return Yn},get ColorMask(){return Kn},get ShaderStageFlagBit(){return qn},get LoadOp(){return Qn},get StoreOp(){return Zn},get AccessFlagBit(){return Jn},get ResolveMode(){return $n},get PipelineBindPoint(){return tr},get PrimitiveMode(){return er},get PolygonMode(){return ir},get ShadeModel(){return nr},get CullMode(){return rr},get DynamicStateFlagBit(){return sr},get StencilFace(){return ar},get DescriptorType(){return or},get QueueType(){return ur},get QueryType(){return hr},get CommandBufferType(){return lr},get ClearFlagBit(){return cr},get BarrierType(){return _r},get PassType(){return fr},Size:vr,DeviceCaps:yr,DeviceOptions:Er,Offset:Tr,Rect:Sr,Extent:Ar,TextureSubresLayers:Rr,TextureSubresRange:br,TextureCopy:Cr,TextureBlit:wr,BufferTextureCopy:Ir,Viewport:Or,Color:Pr,BindingMappingInfo:Dr,SwapchainInfo:Br,DeviceInfo:Nr,BufferInfo:Mr,BufferViewInfo:Lr,DrawInfo:Fr,DispatchInfo:Ur,IndirectBuffer:Gr,TextureInfo:kr,TextureViewInfo:zr,SamplerInfo:Hr,Uniform:Vr,UniformBlock:Wr,UniformSamplerTexture:Xr,UniformSampler:jr,UniformTexture:Yr,UniformStorageImage:Kr,UniformStorageBuffer:qr,UniformInputAttachment:Qr,ShaderStage:Zr,Attribute:Jr,ShaderInfo:$r,InputAssemblerInfo:ts,ColorAttachment:es,DepthStencilAttachment:is,SubpassInfo:ns,SubpassDependency:rs,RenderPassInfo:ss,GeneralBarrierInfo:as,TextureBarrierInfo:os,BufferBarrierInfo:us,FramebufferInfo:hs,DescriptorSetLayoutBinding:ls,DescriptorSetLayoutInfo:cs,DescriptorSetInfo:_s,PipelineLayoutInfo:fs,InputState:ds,CommandBufferInfo:ps,QueueInfo:ms,QueryPoolInfo:gs,FormatInfo:vs,MemoryStatus:ys,DynamicStencilStates:Es,DynamicStates:Ts,GFXObject:Ss,get AttributeName(){return gr},FormatInfos:As,DESCRIPTOR_BUFFER_TYPE:Rs,DESCRIPTOR_SAMPLER_TYPE:bs,DESCRIPTOR_DYNAMIC_TYPE:Cs,DRAW_INFO_SIZE:28,IsPowerOf2:ws,FormatSize:Is,FormatSurfaceSize:Os,GetTypeSize:Ps,getTypedArrayConstructor:Ds,formatAlignment:Bs,alignTo:Ns}),Ls=function(t){function e(){var e;return(e=t.call(this,Rn.BUFFER)||this)._usage=Dn.NONE,e._memUsage=Mn.NONE,e._size=0,e._stride=1,e._count=0,e._flags=Bn.NONE,e._isBufferView=!1,e}return c(e,t),h(e,[{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}}]),e}(Ss),Fs=function(t){function e(){var e;return(e=t.call(this,Rn.COMMAND_BUFFER)||this)._queue=null,e._type=lr.PRIMARY,e._numDrawCalls=0,e._numInstances=0,e._numTris=0,e}return c(e,t),h(e,[{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}}]),e}(Ss),Us=function(){function t(){this._gfxAPI=Cn.UNKNOWN,this._renderer="",this._vendor="",this._features=new Array(In.COUNT),this._formatFeatures=new Array(On.COUNT),this._queue=null,this._cmdBuff=null,this._numDrawCalls=0,this._numInstances=0,this._numTris=0,this._memoryStatus=new ys,this._caps=new yr,this._bindingMappingInfo=new Dr,this._samplers=new Map,this._generalBarrierss=new Map,this._textureBarriers=new Map,this._bufferBarriers=new Map}var e=t.prototype;return e.hasFeature=function(t){return this._features[t]},e.getFormatFeatures=function(t){return this._formatFeatures[t]},h(t,[{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}}]),t}();Us.canvas=void 0;var Gs=function(t){function e(){var e;return(e=t.call(this,Rn.SWAPCHAIN)||this)._transform=wn.IDENTITY,e._colorTexture=null,e._depthStencilTexture=null,e}return c(e,t),h(e,[{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}}]),e}(Ss),ks=function(t){function e(){var e;return(e=t.call(this,Rn.FRAMEBUFFER)||this)._renderPass=null,e._colorTextures=[],e._depthStencilTexture=null,e}return c(e,t),h(e,[{key:"renderPass",get:function(){return this._renderPass}},{key:"colorTextures",get:function(){return this._colorTextures}},{key:"depthStencilTexture",get:function(){return this._depthStencilTexture}}]),e}(Ss),zs=String.prototype.charCodeAt;function Hs(t){return this[t]}function Vs(t,e){for(var i=t.length,n=e^i,r=0,s="string"==typeof t?zs:Hs;i>=4;){var a=255&s.call(t,r)|(255&s.call(t,++r))<<8|(255&s.call(t,++r))<<16|(255&s.call(t,++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(t,r+2))<<16;case 2:n^=(255&s.call(t,r+1))<<8;case 1:n=1540483477*(65535&(n^=255&s.call(t,r)))+((1540483477*(n>>>16)&65535)<<16)}return n=1540483477*(65535&(n^=n>>>13))+((1540483477*(n>>>16)&65535)<<16),(n^=n>>>15)>>>0}var Ws=function(t){function e(){var e;return(e=t.call(this,Rn.INPUT_ASSEMBLER)||this)._attributes=[],e._attributesHash=0,e._vertexBuffers=[],e._indexBuffer=null,e._indirectBuffer=null,e._drawInfo=new Fr,e}c(e,t);var i=e.prototype;return i.getVertexBuffer=function(t){return void 0===t&&(t=0),t<this._vertexBuffers.length?this._vertexBuffers[t]:null},i.computeAttributesHash=function(){for(var t="attrs",e=0;e<this.attributes.length;++e){var i=this.attributes[e];t+=","+i.name+","+i.format+","+i.isNormalized+","+i.stream+","+i.isInstanced+","+i.location}return Vs(t,666)},h(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:"attributesHash",get:function(){return this._attributesHash}},{key:"vertexCount",get:function(){return this._drawInfo.vertexCount},set:function(t){this._drawInfo.vertexCount=t}},{key:"firstVertex",get:function(){return this._drawInfo.firstVertex},set:function(t){this._drawInfo.firstVertex=t}},{key:"indexCount",get:function(){return this._drawInfo.indexCount},set:function(t){this._drawInfo.indexCount=t}},{key:"firstIndex",get:function(){return this._drawInfo.firstIndex},set:function(t){this._drawInfo.firstIndex=t}},{key:"vertexOffset",get:function(){return this._drawInfo.vertexOffset},set:function(t){this._drawInfo.vertexOffset=t}},{key:"instanceCount",get:function(){return this._drawInfo.instanceCount},set:function(t){this._drawInfo.instanceCount=t}},{key:"firstInstance",get:function(){return this._drawInfo.firstInstance},set:function(t){this._drawInfo.firstInstance=t}},{key:"drawInfo",get:function(){return this._drawInfo},set:function(t){this._drawInfo=t}}]),e}(Ss),Xs=function(t){function e(){var e;return(e=t.call(this,Rn.DESCRIPTOR_SET)||this)._layout=null,e._buffers=[],e._textures=[],e._samplers=[],e._isDirty=!1,e}c(e,t);var i=e.prototype;return i.bindBuffer=function(t,e,i){void 0===i&&(i=0);var n=this._layout.bindingIndices[t],r=this._layout.bindings[n];if(r&&r.descriptorType&Rs){var s=this._layout.descriptorIndices[t];this._buffers[s+i]!==e&&(this._buffers[s+i]=e,this._isDirty=!0)}},i.bindSampler=function(t,e,i){void 0===i&&(i=0);var n=this._layout.bindingIndices[t],r=this._layout.bindings[n];if(r&&r.descriptorType&bs){var s=this._layout.descriptorIndices[t];this._samplers[s+i]!==e&&(this._samplers[s+i]=e,this._isDirty=!0)}},i.bindTexture=function(t,e,i){void 0===i&&(i=0);var n=this._layout.bindingIndices[t],r=this._layout.bindings[n];if(r&&r.descriptorType&bs){var s=this._layout.descriptorIndices[t];this._textures[s+i]!==e&&(this._textures[s+i]=e,this._isDirty=!0)}},i.getBuffer=function(t,e){void 0===e&&(e=0);var i=this._layout.descriptorIndices[t];return this._buffers[i+e]},i.getSampler=function(t,e){void 0===e&&(e=0);var i=this._layout.descriptorIndices[t];return this._samplers[i+e]},i.getTexture=function(t,e){void 0===e&&(e=0);var i=this._layout.descriptorIndices[t];return this._textures[i+e]},h(e,[{key:"layout",get:function(){return this._layout}}]),e}(Ss),js=function(t){function e(){var e;return(e=t.call(this,Rn.DESCRIPTOR_SET_LAYOUT)||this)._bindings=[],e._bindingIndices=[],e._descriptorIndices=[],e}return c(e,t),h(e,[{key:"bindings",get:function(){return this._bindings}},{key:"bindingIndices",get:function(){return this._bindingIndices}},{key:"descriptorIndices",get:function(){return this._descriptorIndices}}]),e}(Ss),Ys=function(t){function e(){var e;return(e=t.call(this,Rn.PIPELINE_LAYOUT)||this)._setLayouts=[],e}return c(e,t),h(e,[{key:"setLayouts",get:function(){return this._setLayouts}}]),e}(Ss),Ks=function(){function t(t,e,i,n,r,s,a,o,u,h,l,c){void 0===t&&(t=!1),void 0===e&&(e=ir.FILL),void 0===i&&(i=nr.GOURAND),void 0===n&&(n=rr.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===l&&(l=!1),void 0===c&&(c=1),this.isDiscard=t,this.polygonMode=e,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=l,this.lineWidth=c}var e=t.prototype;return e.reset=function(){this.isDiscard=!1,this.polygonMode=ir.FILL,this.shadeModel=nr.GOURAND,this.cullMode=rr.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},e.assign=function(t){Object.assign(this,t)},e.destroy=function(){},h(t,[{key:"native",get:function(){return this}}]),t}(),qs=function(){function t(t,e,i,n,r,s,a,o,u,h,l,c,_,f,d,p,m,g,v){void 0===t&&(t=!0),void 0===e&&(e=!0),void 0===i&&(i=Wn.LESS),void 0===n&&(n=!1),void 0===r&&(r=Wn.ALWAYS),void 0===s&&(s=65535),void 0===a&&(a=65535),void 0===o&&(o=Xn.KEEP),void 0===u&&(u=Xn.KEEP),void 0===h&&(h=Xn.KEEP),void 0===l&&(l=1),void 0===c&&(c=!1),void 0===_&&(_=Wn.ALWAYS),void 0===f&&(f=65535),void 0===d&&(d=65535),void 0===p&&(p=Xn.KEEP),void 0===m&&(m=Xn.KEEP),void 0===g&&(g=Xn.KEEP),void 0===v&&(v=1),this.depthTest=t,this.depthWrite=e,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=l,this.stencilTestBack=c,this.stencilFuncBack=_,this.stencilReadMaskBack=f,this.stencilWriteMaskBack=d,this.stencilFailOpBack=p,this.stencilZFailOpBack=m,this.stencilPassOpBack=g,this.stencilRefBack=v}var e=t.prototype;return e.reset=function(){this.depthTest=!0,this.depthWrite=!0,this.depthFunc=Wn.LESS,this.stencilTestFront=!1,this.stencilFuncFront=Wn.ALWAYS,this.stencilReadMaskFront=65535,this.stencilWriteMaskFront=65535,this.stencilFailOpFront=Xn.KEEP,this.stencilZFailOpFront=Xn.KEEP,this.stencilPassOpFront=Xn.KEEP,this.stencilRefFront=1,this.stencilTestBack=!1,this.stencilFuncBack=Wn.ALWAYS,this.stencilReadMaskBack=65535,this.stencilWriteMaskBack=65535,this.stencilFailOpBack=Xn.KEEP,this.stencilZFailOpBack=Xn.KEEP,this.stencilPassOpBack=Xn.KEEP,this.stencilRefBack=1},e.assign=function(t){Object.assign(this,t)},e.destroy=function(){},h(t,[{key:"native",get:function(){return this}}]),t}(),Qs=function(){function t(t,e,i,n,r,s,a,o){void 0===t&&(t=!1),void 0===e&&(e=jn.ONE),void 0===i&&(i=jn.ZERO),void 0===n&&(n=Yn.ADD),void 0===r&&(r=jn.ONE),void 0===s&&(s=jn.ZERO),void 0===a&&(a=Yn.ADD),void 0===o&&(o=Kn.ALL),this.blend=t,this.blendSrc=e,this.blendDst=i,this.blendEq=n,this.blendSrcAlpha=r,this.blendDstAlpha=s,this.blendAlphaEq=a,this.blendColorMask=o}var e=t.prototype;return e.reset=function(){this.blend=!1,this.blendSrc=jn.ONE,this.blendDst=jn.ZERO,this.blendEq=Yn.ADD,this.blendSrcAlpha=jn.ONE,this.blendDstAlpha=jn.ZERO,this.blendAlphaEq=Yn.ADD,this.blendColorMask=Kn.ALL},e.assign=function(t){Object.assign(this,t)},e.destroy=function(){},t}(),Zs=function(){function t(t,e,i,n){void 0===t&&(t=!1),void 0===e&&(e=!1),void 0===i&&(i=new Pr),void 0===n&&(n=[new Qs]),this.isA2C=t,this.isIndepend=e,this.blendColor=i,this.targets=n}var e=t.prototype;return e.setTarget=function(t,e){var i=this.targets[t];i||(i=this.targets[t]=new Qs),Object.assign(i,e)},e.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()},e.destroy=function(){},h(t,[{key:"native",get:function(){return this}}]),t}(),Js=function(t,e,i,n,r,s,a,o,u,h){void 0===t&&(t=null),void 0===e&&(e=null),void 0===i&&(i=null),void 0===n&&(n=new ds),void 0===r&&(r=new Ks),void 0===s&&(s=new qs),void 0===a&&(a=new Zs),void 0===o&&(o=er.TRIANGLE_LIST),void 0===u&&(u=sr.NONE),void 0===h&&(h=tr.GRAPHICS),this.shader=t,this.pipelineLayout=e,this.renderPass=i,this.inputState=n,this.rasterizerState=r,this.depthStencilState=s,this.blendState=a,this.primitive=o,this.dynamicStates=u,this.bindPoint=h},$s=function(t){function e(){var e;return(e=t.call(this,Rn.PIPELINE_STATE)||this)._shader=null,e._pipelineLayout=null,e._primitive=er.TRIANGLE_LIST,e._is=null,e._rs=new Ks,e._dss=new qs,e._bs=new Zs,e._dynamicStates=sr.NONE,e._renderPass=null,e}return c(e,t),h(e,[{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}}]),e}(Ss),ta=function(t){function e(){var e;return(e=t.call(this,Rn.QUEUE)||this)._type=ur.GRAPHICS,e}return c(e,t),h(e,[{key:"type",get:function(){return this._type}}]),e}(Ss),ea=function(t){function e(){var e;return(e=t.call(this,Rn.RENDER_PASS)||this)._colorInfos=[],e._depthStencilInfo=null,e._subpasses=[],e._hash=0,e}return c(e,t),e.prototype.computeHash=function(){var t="";if(this._subpasses.length)for(var e=0;e<this._subpasses.length;++e){var i=this._subpasses[e];if(i.inputs.length){t+="ia";for(var n=0;n<i.inputs.length;++n){var r=this._colorInfos[i.inputs[n]];t+=","+r.format+","+r.sampleCount}}if(i.colors.length){t+="ca";for(var s=0;s<i.inputs.length;++s){var a=this._colorInfos[i.inputs[s]];t+=","+a.format+","+a.sampleCount}}if(i.depthStencil>=0){var o=this._colorInfos[i.depthStencil];t+="ds,"+o.format+","+o.sampleCount}}else{t+="ca";for(var u=0;u<this._colorInfos.length;++u){var h=this._colorInfos[u];t+=","+h.format+","+h.sampleCount}var l=this._depthStencilInfo;l&&(t+="ds,"+l.format+","+l.sampleCount)}return Vs(t,666)},h(e,[{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}}]),e}(Ss),ia=function(t){function e(e,i){var n;return(n=t.call(this,Rn.SAMPLER)||this)._info=new Hr,n._hash=0,n._info.copy(e),n._hash=i,n}return c(e,t),e.computeHash=function(t){var e=t.minFilter;return e|=t.magFilter<<2,e|=t.mipFilter<<4,e|=t.addressU<<6,e|=t.addressV<<8,e|=t.addressW<<10,(e|=t.maxAnisotropy<<12)|t.cmpFunc<<16},e.unpackFromHash=function(t){var e=new Hr;return e.minFilter=(3&t)>>0,e.magFilter=(3&t)>>2,e.mipFilter=(3&t)>>4,e.addressU=(3&t)>>6,e.addressV=(3&t)>>8,e.addressW=(3&t)>>10,e.maxAnisotropy=(15&t)>>12,e.cmpFunc=(7&t)>>16,e},h(e,[{key:"info",get:function(){return this._info}},{key:"hash",get:function(){return this._hash}}]),e}(Ss),na=function(t){function e(){var e;return(e=t.call(this,Rn.SHADER)||this)._name="",e._stages=[],e._attributes=[],e._blocks=[],e._samplers=[],e}return c(e,t),h(e,[{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}}]),e}(Ss),ra=function(t){function e(){var e;return(e=t.call(this,Rn.TEXTURE)||this)._info=new kr,e._viewInfo=new zr,e._isPowerOf2=!1,e._isTextureView=!1,e._size=0,e}return c(e,t),e.getLevelCount=function(t,e){return Math.floor(Math.log2(Math.max(t,e)))},h(e,[{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}}]),e}(Ss),sa=function(t){function e(e,i){var n;return(n=t.call(this,Rn.GLOBAL_BARRIER)||this)._info=new as,n._hash=0,n._info.copy(e),n._hash=i,n}return c(e,t),e.computeHash=function(t){return Vs(t.prevAccesses+" "+t.nextAccesses+" "+t.type,666)},h(e,[{key:"info",get:function(){return this._info}},{key:"hash",get:function(){return this._hash}}]),e}(Ss),aa=function(t){function e(e,i){var n;return(n=t.call(this,Rn.TEXTURE_BARRIER)||this)._info=new os,n._hash=0,n._info.copy(e),n._hash=i,n}return c(e,t),e.computeHash=function(t){var e=t.prevAccesses+" "+t.nextAccesses;return e+=t.type,e+=t.baseMipLevel,e+=t.levelCount,e+=t.baseSlice,e+=t.sliceCount,e+=t.discardContents,e+=t.srcQueue?t.srcQueue.type:0,Vs(e+=t.dstQueue?t.dstQueue.type:0,666)},h(e,[{key:"info",get:function(){return this._info}},{key:"hash",get:function(){return this._hash}}]),e}(Ss),oa=function(t){function e(e,i){var n;return(n=t.call(this,Rn.BUFFER_BARRIER)||this)._info=new us,n._hash=0,n._info.copy(e),n._hash=i,n}return c(e,t),e.computeHash=function(t){var e=t.prevAccesses+" "+t.nextAccesses;return e+=t.type,e+=t.offset,e+=t.size,e+=t.discardContents,e+=t.srcQueue?t.srcQueue.type:0,Vs(e+=t.dstQueue?t.dstQueue.type:0,666)},h(e,[{key:"info",get:function(){return this._info}},{key:"hash",get:function(){return this._hash}}]),e}(Ss),ua={Device:Us,Swapchain:Gs,Buffer:Ls,Texture:ra,Sampler:ia,Shader:na,InputAssembler:Ws,RenderPass:ea,Framebuffer:ks,DescriptorSet:Xs,DescriptorSetLayout:js,PipelineLayout:Ys,PipelineState:$s,CommandBuffer:Fs,Queue:ta,GeneralBarrier:sa,TextureBarrier:aa,BufferBarrier:oa,RasterizerState:Ks,BlendState:Zs,BlendTarget:Qs,DepthStencilState:qs,PipelineStateInfo:Js};Object.assign(ua,Ms),b.gfx=ua;var ha={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 la in ha){var ca=ha[la];!0===ca?ca=la.slice(3):!1===ca&&(ca=la),et(b,"cc",[{name:la,newName:ca,target:b.gfx,targetName:"cc.gfx"}])}it(b,"cc",[{name:"GFX_MAX_VERTEX_ATTRIBUTES"},{name:"GFX_MAX_TEXTURE_UNITS"},{name:"GFX_MAX_ATTACHMENTS"},{name:"GFX_MAX_BUFFER_BINDINGS"},{name:"GFXTextureLayout"}]),it(In,"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;"}]),it(es.prototype,"ColorAttachment",[{name:"beginAccesses",suggest:"Please assign to ColorAttachment.barrier instead"},{name:"endAccesses",suggest:"Please assign to ColorAttachment.barrier instead"}]),it(is.prototype,"DepthStencilAttachment",[{name:"beginAccesses",suggest:"Please assign to DepthStencilAttachment.barrier instead"},{name:"endAccesses",suggest:"Please assign to DepthStencilAttachment.barrier instead"}]),et(Us.prototype,"Device",[{name:"getGlobalBarrier",newName:"getGeneralBarrier"}]);var _a=new(function(){function t(){this._pools=[],this._lastShrinkPassed=0,this.shrinkTimeSpan=5}var e=t.prototype;return e.addContainer=function(t){-1===t._poolHandle&&(t._poolHandle=this._pools.length,this._pools.push(t))},e.removeContainer=function(t){-1!==t._poolHandle&&(this._pools[this._pools.length-1]._poolHandle=t._poolHandle,gt(this._pools,t._poolHandle),t._poolHandle=-1)},e.tryShrink=function(){for(var t=0;t<this._pools.length;t++)this._pools[t].tryShrink()},e.update=function(t){this._lastShrinkPassed+=t,this._lastShrinkPassed>this.shrinkTimeSpan&&(this.tryShrink(),this._lastShrinkPassed-=this.shrinkTimeSpan)},t}()),fa=function(){function t(){this._poolHandle=-1,_a.addContainer(this)}return t.prototype.destroy=function(){_a.removeContainer(this)},t}(),da=t("Pool",function(t){function e(e,i,n){var r;(r=t.call(this)||this)._ctor=void 0,r._elementsPerBatch=void 0,r._nextAvail=void 0,r._freepool=[],r._dtor=void 0,r._ctor=e,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(e());return r}c(e,t);var i=e.prototype;return i.alloc=function(){if(this._nextAvail<0){this._freepool.length=this._elementsPerBatch;for(var t=0;t<this._elementsPerBatch;t++)this._freepool[t]=this._ctor();this._nextAvail=this._elementsPerBatch-1}return this._freepool[this._nextAvail--]},i.free=function(t){this._freepool[++this._nextAvail]=t},i.freeArray=function(t){this._freepool.length=this._nextAvail+1,Array.prototype.push.apply(this._freepool,t),this._nextAvail+=t.length},i.tryShrink=function(){if(this._nextAvail>>1>this._elementsPerBatch){if(this._dtor)for(var t=this._nextAvail>>1;t<=this._nextAvail;t++)this._dtor(this._freepool[t]);this._freepool.length=this._nextAvail>>1,this._nextAvail=this._freepool.length-1}},i.destroy=function(){var e=arguments.length>0?arguments[0]:null;e&&j(14100);var i=e||this._dtor;if(i)for(var n=0;n<=this._nextAvail;n++)i(this._freepool[n]);this._freepool.length=0,this._nextAvail=-1,t.prototype.destroy.call(this)},e}(fa)),pa=t("RecyclePool",function(t){function e(e,i,n){var r;(r=t.call(this)||this)._fn=void 0,r._dtor=null,r._count=0,r._data=void 0,r._initSize=0,r._fn=e,r._dtor=n||null,r._data=new Array(i),r._initSize=i;for(var s=0;s<i;++s)r._data[s]=e();return r}c(e,t);var i=e.prototype;return i.reset=function(){this._count=0},i.resize=function(t){if(t>this._data.length)for(var e=this._data.length;e<t;++e)this._data[e]=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 e=0;e<this._data.length;e++)this._dtor(this._data[e]);this._data.length=0,this._count=0,t.prototype.destroy.call(this)},i.tryShrink=function(){if(this._data.length>>2>this._count){var t=Math.max(this._initSize,this._data.length>>1);if(this._dtor)for(var e=t;e<this._data.length;e++)this._dtor(this._data[e]);this._data.length=t}},i.removeAt=function(t){if(!(t>=this._count)){var e=this._count-1,i=this._data[t];this._data[t]=this._data[e],this._data[e]=i,this._count-=1}},h(e,[{key:"length",get:function(){return this._count}},{key:"data",get:function(){return this._data}}]),e}(fa)),ma=t("CachedArray",function(t){function e(e,i){var n;return(n=t.call(this)||this).array=void 0,n.length=0,n._compareFn=void 0,n._initSize=0,n.array=new Array(e),n._initSize=e,n.length=0,n._compareFn=i,n}c(e,t);var i=e.prototype;return i.push=function(t){this.array[this.length++]=t},i.pop=function(){return this.array[--this.length]},i.get=function(t){return this.array[t]},i.clear=function(){this.length=0},i.destroy=function(){this.length=0,this.array.length=0,t.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(t){for(var e=0;e<t.length;++e)this.array[this.length++]=t[e]},i.fastRemove=function(t){if(!(t>=this.length||t<0)){var e=--this.length;this.array[t]=this.array[e]}},i.indexOf=function(t){for(var e=0,i=this.length;e<i;++e)if(this.array[e]===t)return e;return-1},e}(fa));t("memop",Object.freeze({__proto__:null,Pool:da,RecyclePool:pa,CachedArray:ma}));var ga,va=t("editorExtrasTag","__editorExtras__"),ya=1<<22,Ea=[],Ta=t("CCObject",function(){function t(t){void 0===t&&(t=""),this._objFlags=void 0,this._name=void 0,this._name=t,this._objFlags=0}t._deferredDestroy=function(){for(var t=Ea.length,e=0;e<t;++e){var i=Ea[e];1&i._objFlags||i._destroyImmediate()}t===Ea.length?Ea.length=0:Ea.splice(0,t)};var e=t.prototype;return e.destroy=function(){return 1&this._objFlags?(j(5e3),!1):!(4&this._objFlags||(this._objFlags|=4,Ea.push(this),0))},e._destruct=function(){var t=this.constructor,e=t.__destruct__;e||(e=function(t,e){var i,n=t instanceof b._BaseNode||t instanceof b.Component,r=n?"_id":null,s={};for(i in t)if(t.hasOwnProperty(i)){if(i===r)continue;switch(typeof t[i]){case"string":s[i]="";break;case"object":case"function":s[i]=null}}if(hi._isCCClass(e))for(var a=b.Class.Attr.getClassAttrs(e),o=e.__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 l="";for(i in s){var c;c=hi.IDENTIFIER_RE.test(i)?"o."+i+"=":"o["+hi.escapeForJS(i)+"]=";var _=s[i];""===_&&(_='""'),l+=c+_+";\n"}return Function("o",l)}(this,t),Ot(t,"__destruct__",e,!0)),e(this)},e._destroyImmediate=function(){1&this._objFlags?K(5e3):(this._onPreDestroy&&this._onPreDestroy(),this._destruct(),this._objFlags|=1)},h(t,[{key:"name",get:function(){return this._name},set:function(t){this._name=t}},{key:"hideFlags",get:function(){return this._objFlags&t.Flags.AllHideMasks},set:function(e){var i=e&t.Flags.AllHideMasks;this._objFlags=this._objFlags&~t.Flags.AllHideMasks|i}},{key:"replicated",get:function(){return!!(this._objFlags&ya)},set:function(t){t?this._objFlags|=ya:this._objFlags&=-4194305}},{key:"isValid",get:function(){return!(1&this._objFlags)}}]),t}()),Sa=Ta.prototype;function Aa(t){return t instanceof Ta}function Ra(t,e){return"object"==typeof t?!(!t||t._objFlags&(e?5:1)):void 0!==t}Sa._deserialize=null,Sa._onPreDestroy=null,hi.fastDefine("cc.Object",Ta,((ga={_name:"",_objFlags:0})[va]={},ga)),hi.Attr.setClassAttr(Ta,va,"editorOnly",!0),hi.Attr.setClassAttr(Ta,"replicated","visible",!1),Ot(Ta,"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}),b.isValid=Ra,b.Object=Ta;var ba=he.fastRemoveAt;function Ca(){}var wa=function(){function t(){this.callback=Ca,this.target=void 0,this.once=!1}var e=t.prototype;return e.set=function(t,e,i){this.callback=t||Ca,this.target=e,this.once=!!i},e.reset=function(){this.target=void 0,this.callback=Ca,this.once=!1},e.check=function(){return!(Aa(this.target)&&!Ra(this.target,!0))},t}(),Ia=new da((function(){return new wa}),32),Oa=function(){function t(){this.callbackInfos=[],this.isInvoking=!1,this.containCanceled=!1}var e=t.prototype;return e.removeByCallback=function(t){for(var e=0;e<this.callbackInfos.length;++e){var i=this.callbackInfos[e];i&&i.callback===t&&(i.reset(),Ia.free(i),ba(this.callbackInfos,e),--e)}},e.removeByTarget=function(t){for(var e=0;e<this.callbackInfos.length;++e){var i=this.callbackInfos[e];i&&i.target===t&&(i.reset(),Ia.free(i),ba(this.callbackInfos,e),--e)}},e.cancel=function(t){var e=this.callbackInfos[t];e&&(e.reset(),this.isInvoking?this.callbackInfos[t]=null:ba(this.callbackInfos,t),Ia.free(e)),this.containCanceled=!0},e.cancelAll=function(){for(var t=0;t<this.callbackInfos.length;t++){var e=this.callbackInfos[t];e&&(e.reset(),Ia.free(e),this.callbackInfos[t]=null)}this.containCanceled=!0},e.purgeCanceled=function(){for(var t=this.callbackInfos.length-1;t>=0;--t)this.callbackInfos[t]||ba(this.callbackInfos,t);this.containCanceled=!1},e.clear=function(){this.cancelAll(),this.callbackInfos.length=0,this.isInvoking=!1,this.containCanceled=!1},t}(),xa=new da((function(){return new Oa}),16),Pa=function(){function t(){this._callbackTable=Bt(!0),this._offCallback=void 0}var e=t.prototype;return e.on=function(t,e,i,n){if(!this.hasEventListener(t,e,i)){var r=this._callbackTable[t];r||(r=this._callbackTable[t]=xa.alloc());var s=Ia.alloc();s.set(e,i,n),r.callbackInfos.push(s)}return e},e.hasEventListener=function(t,e,i){var n=this._callbackTable&&this._callbackTable[t];if(!n)return!1;var r=n.callbackInfos;if(!e){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===e&&o.target===i)return!0}return!1},e.removeAll=function(t){var e=typeof t;if("string"===e||"number"===e){var i=this._callbackTable&&this._callbackTable[t];i&&(i.isInvoking?i.cancelAll():(i.clear(),xa.free(i),delete this._callbackTable[t]))}else if(t)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===t&&r.cancel(a)}else r.removeByTarget(t)}},e.off=function(t,e,i){var n,r=this._callbackTable&&this._callbackTable[t];if(r){var s=r.callbackInfos;if(e)for(var a=0;a<s.length;++a){var o=s[a];if(o&&o.callback===e&&o.target===i){r.cancel(a);break}}else this.removeAll(t)}null===(n=this._offCallback)||void 0===n||n.call(this)},e.emit=function(t,e,i,n,r,s){var a=this._callbackTable&&this._callbackTable[t];if(a){var o=!a.isInvoking;a.isInvoking=!0;for(var u=a.callbackInfos,h=0,l=u.length;h<l;++h){var c=u[h];if(c){var _=c.callback,f=c.target;c.once&&this.off(t,_,f),c.check()?f?_.call(f,e,i,n,r,s):_(e,i,n,r,s):this.off(t,_,f)}}o&&(a.isInvoking=!1,a.containCanceled&&a.purgeCanceled())}},e.clear=function(){for(var t in this._callbackTable){var e=this._callbackTable[t];e&&(e.clear(),xa.free(e),delete this._callbackTable[t])}},e._registerOffCallback=function(t){this._offCallback=t},t}();function Da(t){for(var e=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._callbackTable=Bt(!0),e}c(e,t);var i=e.prototype;return i.once=function(t,e,i){return this.on(t,e,i,!0)},i.targetOff=function(t){this.removeAll(t)},e}(t),i=Pa.prototype,n=Object.getOwnPropertyNames(i).concat(Object.getOwnPropertySymbols(i)),r=0;r<n.length;++r){var s=n[r];if(!(s in e.prototype)){var a=Object.getOwnPropertyDescriptor(i,s);a&&Object.defineProperty(e.prototype,s,a)}}return e}var Ba=t("EventTarget",Da((function(){})));b.EventTarget=Ba;var Na,Ma,La,Fa,Ua,Ga,ka=t("AsyncDelegate",function(){function t(){this._delegates=[]}var e=t.prototype;return e.add=function(t){this._delegates.includes(t)||this._delegates.push(t)},e.hasListener=function(t){return this._delegates.includes(t)},e.remove=function(t){le.array.fastRemove(this._delegates,t)},e.dispatch=function(){for(var t=arguments,e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return Promise.all(this._delegates.map((function(e){return e.apply(void 0,t)})).filter(Boolean))},t}());!function(t){t.UNKNOWN="unknown",t.WECHAT="wechat",t.ANDROID="androidbrowser",t.IE="ie",t.EDGE="edge",t.QQ="qqbrowser",t.MOBILE_QQ="mqqbrowser",t.UC="ucbrowser",t.UCBS="ucbs",t.BROWSER_360="360browser",t.BAIDU_APP="baiduboxapp",t.BAIDU="baidubrowser",t.MAXTHON="maxthon",t.OPERA="opera",t.OUPENG="oupeng",t.MIUI="miuibrowser",t.FIREFOX="firefox",t.SAFARI="safari",t.CHROME="chrome",t.LIEBAO="liebao",t.QZONE="qzone",t.SOUGOU="sogou",t.HUAWEI="huawei"}(Na||(Na={})),function(t){t.UNKNOWN="unknown",t.ENGLISH="en",t.CHINESE="zh",t.FRENCH="fr",t.ITALIAN="it",t.GERMAN="de",t.SPANISH="es",t.DUTCH="du",t.RUSSIAN="ru",t.KOREAN="ko",t.JAPANESE="ja",t.HUNGARIAN="hu",t.PORTUGUESE="pt",t.ARABIC="ar",t.NORWEGIAN="no",t.POLISH="pl",t.TURKISH="tr",t.UKRAINIAN="uk",t.ROMANIAN="ro",t.BULGARIAN="bg"}(Ma||(Ma={})),function(t){t[t.NONE=0]="NONE",t[t.LAN=1]="LAN",t[t.WWAN=2]="WWAN"}(La||(La={})),function(t){t.UNKNOWN="Unknown",t.IOS="iOS",t.ANDROID="Android",t.WINDOWS="Windows",t.LINUX="Linux",t.OSX="OS X",t.OHOS="OHOS"}(Fa||(Fa={})),function(t){t.UNKNOWN="UNKNOWN",t.EDITOR_PAGE="EDITOR_PAGE",t.EDITOR_CORE="EDITOR_CORE",t.MOBILE_BROWSER="MOBILE_BROWSER",t.DESKTOP_BROWSER="DESKTOP_BROWSER",t.WIN32="WIN32",t.ANDROID="ANDROID",t.IOS="IOS",t.MACOS="MACOS",t.OHOS="OHOS",t.WECHAT_GAME="WECHAT_GAME",t.BAIDU_MINI_GAME="BAIDU_MINI_GAME",t.XIAOMI_QUICK_GAME="XIAOMI_QUICK_GAME",t.ALIPAY_MINI_GAME="ALIPAY_MINI_GAME",t.BYTEDANCE_MINI_GAME="BYTEDANCE_MINI_GAME",t.OPPO_MINI_GAME="OPPO_MINI_GAME",t.VIVO_MINI_GAME="VIVO_MINI_GAME",t.HUAWEI_QUICK_GAME="HUAWEI_QUICK_GAME",t.COCOSPLAY="COCOSPLAY",t.LINKSURE_MINI_GAME="LINKSURE_MINI_GAME",t.QTT_MINI_GAME="QTT_MINI_GAME"}(Ua||(Ua={})),function(t){t.WEBP="WEBP",t.IMAGE_BITMAP="IMAGE_BITMAP",t.WEB_VIEW="WEB_VIEW",t.VIDEO_PLAYER="VIDEO_PLAYER",t.SAFE_AREA="SAFE_AREA",t.INPUT_TOUCH="INPUT_TOUCH",t.EVENT_KEYBOARD="EVENT_KEYBOARD",t.EVENT_MOUSE="EVENT_MOUSE",t.EVENT_TOUCH="EVENT_TOUCH",t.EVENT_ACCELEROMETER="EVENT_ACCELEROMETER",t.EVENT_GAMEPAD="EVENT_GAMEPAD",t.EVENT_HANDLE="EVENT_HANDLE",t.EVENT_HMD="EVENT_HMD"}(Ga||(Ga={}));var za,Ha=new(function(t){function e(){var e,i,n;(n=t.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;var r,s=window.navigator,a=s.userAgent.toLowerCase();null===(e=s.getBattery)||void 0===e||e.call(s).then((function(t){n._battery=t})),n.networkType=La.LAN,n.isNative=!1,n.isBrowser=!0,n.isMobile=/mobile|android|iphone|ipad/.test(a),n.platform=n.isMobile?Ua.MOBILE_BROWSER:Ua.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]:Ma.ENGLISH,n.language=o;var u=!1,h=!1,l="",c=0,_=/android\s*(\d+(?:\.\d+)*)/i.exec(a)||/android\s*(\d+(?:\.\d+)*)/i.exec(s.platform);_&&(u=!0,l=_[1]||"",c=parseInt(l)||0),(_=/(iPad|iPhone|iPod).*OS ((\d+_?){2,3})/i.exec(a))?(h=!0,l=_[2]||"",c=parseInt(l)||0):(/(iPhone|iPad|iPod)/.exec(s.platform)||"MacIntel"===s.platform&&s.maxTouchPoints&&s.maxTouchPoints>1)&&(h=!0,l="",c=0);var f=Fa.UNKNOWN;-1!==s.appVersion.indexOf("Win")?f=Fa.WINDOWS:h?f=Fa.IOS:-1!==s.appVersion.indexOf("Mac")?f=Fa.OSX:-1!==s.appVersion.indexOf("X11")&&-1===s.appVersion.indexOf("Linux")?f=Fa.LINUX:u?f=Fa.ANDROID:-1===s.appVersion.indexOf("Linux")&&-1===a.indexOf("ubuntu")||(f=Fa.LINUX),n.os=f,n.osVersion=l,n.osMainVersion=c,n.browserType=Na.UNKNOWN;var d=/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=d?d[0].toLowerCase():Fa.UNKNOWN;("safari"===p&&u||"qq"===p&&/android.*applewebkit/i.test(a))&&(p=Na.ANDROID);var m={micromessenger:Na.WECHAT,wechat:Na.WECHAT,weixin:Na.WECHAT,trident:Na.IE,edge:Na.EDGE,"360 aphone":Na.BROWSER_360,mxbrowser:Na.MAXTHON,"opr/":Na.OPERA,ubrowser:Na.UC,huaweibrowser:Na.HUAWEI};n.browserType=m[p]||p,n.browserVersion="";var g=/(mqqbrowser|micromessenger|qqbrowser|sogou|qzone|liebao|maxthon|uc|ucbs|360 aphone|360|baiduboxapp|baidu|maxthon|mxbrowser|miui(?:.hybrid)?)(mobile)?(browser)?\/?([\d.]+)/i.exec(a);g||(g=/(qq|chrome|safari|firefox|trident|opera|opr\/|oupeng)(mobile)?(browser)?\/?([\d.]+)/i.exec(a)),n.browserVersion=g?g[4]:"",n.isXR=!1;var v,y=document.createElement("canvas");y.getContext("2d");try{v=y.toDataURL("image/webp").startsWith("data:image/webp")}catch(t){v=!1}if(n.browserType===Na.SAFARI){var E,T=null===(E=/ version\/(\d+)/.exec(a))||void 0===E?void 0:E[1];"string"==typeof T&&Number.parseInt(T)>=14&&(v=!0)}var S=!1;"undefined"!=typeof createImageBitmap&&"undefined"!=typeof Blob&&(y.width=y.height=2,createImageBitmap(y,{}).then((function(t){S=!0,null==t||t.close()})).catch((function(){})));var R=void 0!==document.documentElement.ontouchstart||void 0!==document.ontouchstart||A,b=void 0!==document.documentElement.onmouseup||A;return n._featureMap=((i={})[Ga.WEBP]=v,i[Ga.IMAGE_BITMAP]=S,i[Ga.WEB_VIEW]=!0,i[Ga.VIDEO_PLAYER]=!0,i[Ga.SAFE_AREA]=!1,i[Ga.INPUT_TOUCH]=R,i[Ga.EVENT_KEYBOARD]=void 0!==document.documentElement.onkeyup||A,i[Ga.EVENT_MOUSE]=b,i[Ga.EVENT_TOUCH]=R||b,i[Ga.EVENT_ACCELEROMETER]=void 0!==window.DeviceMotionEvent||void 0!==window.DeviceOrientationEvent,i[Ga.EVENT_GAMEPAD]=void 0!==navigator.getGamepads||void 0!==navigator.webkitGetGamepads,i[Ga.EVENT_HANDLE]=n.isXR,i[Ga.EVENT_HMD]=n.isXR,i),n._registerEvent(),n}c(e,t);var i=e.prototype;return i._registerEvent=function(){var t,e=this;t=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,e.emit("hide"))},r=function(t,n,r,s,a){i&&(i=!1,e.emit("show",t,n,r,s,a))};if(t)for(var s=["visibilitychange","mozvisibilitychange","msvisibilitychange","webkitvisibilitychange","qbrowserVisibilityChange"],a=0;a<s.length;a++)document.addEventListener(s[a],(function(e){var i=document[t];(i=i||e.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.hasFeature=function(t){return this._featureMap[t]},i.getBatteryLevel=function(){return this._battery?this._battery.level:1},i.triggerGC=function(){},i.openURL=function(t){window.open(t)},i.now=function(){return Date.now?Date.now():+new Date},i.restartJSVM=function(){},i.close=function(){this.emit("close"),window.close()},e}(Ba));!function(t){t[t.PORTRAIT=1]="PORTRAIT",t[t.PORTRAIT_UPSIDE_DOWN=2]="PORTRAIT_UPSIDE_DOWN",t[t.LANDSCAPE_LEFT=4]="LANDSCAPE_LEFT",t[t.LANDSCAPE_RIGHT=8]="LANDSCAPE_RIGHT",t[t.LANDSCAPE=12]="LANDSCAPE",t[t.AUTO=13]="AUTO"}(za||(za={}));var Va,Wa={auto:za.AUTO,landscape:za.LANDSCAPE,portrait:za.PORTRAIT};!function(t){t[t.Unknown=0]="Unknown",t[t.SubFrame=1]="SubFrame",t[t.BrowserWindow=2]="BrowserWindow",t[t.Fullscreen=3]="Fullscreen"}(Va||(Va={}));var Xa=new(function(t){function e(){var e,i,n,r,s,a;(e=t.call(this)||this).isFrameRotated=!1,e.handleResizeEvent=!0,e._gameFrame=void 0,e._gameContainer=void 0,e._gameCanvas=void 0,e._isProportionalToFrame=!1,e._cachedFrameStyle={width:"0px",height:"0px"},e._cachedContainerStyle={width:"0px",height:"0px"},e._cbToUpdateFrameBuffer=void 0,e._supportFullScreen=!1,e._touchEventName=void 0,e._onFullscreenChange=void 0,e._onFullscreenError=void 0,e._orientationChangeTimeoutId=-1,e._cachedFrameSize=new gn(0,0),e._exactFitScreen=!1,e._fn={},e._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"]],e._resolutionScale=1,e._orientation=za.AUTO,e._gameFrame=document.getElementById("GameDiv"),e._gameContainer=document.getElementById("Cocos3dGameContainer"),e._gameCanvas=document.getElementById("GameCanvas"),e._gameFrame||(e._gameFrame=document.createElement("div"),e._gameFrame.setAttribute("id","GameDiv"),null===(i=e._gameCanvas)||void 0===i||null===(n=i.parentNode)||void 0===n||n.insertBefore(e._gameFrame,e._gameCanvas),e._gameFrame.appendChild(e._gameCanvas)),e._gameContainer||(e._gameContainer=document.createElement("div"),e._gameContainer.setAttribute("id","Cocos3dGameContainer"),null===(r=e._gameCanvas)||void 0===r||null===(s=r.parentNode)||void 0===s||s.insertBefore(e._gameContainer,e._gameCanvas),e._gameContainer.appendChild(e._gameCanvas));for(var o=e._fnGroup,u=0;u<o.length;u++)if(a=o[u],void 0!==document[a[1]]){for(var h=0;h<a.length;h++)e._fn[o[0][h]]=a[h];break}return e._supportFullScreen=void 0!==e._fn.requestFullscreen,e._touchEventName="ontouchstart"in window?"touchend":"mousedown",e._registerEvent(),e}c(e,t);var i=e.prototype;return i.init=function(t,e){this._cbToUpdateFrameBuffer=e,this.orientation=Wa[t.configOrientation],this._exactFitScreen=t.exactFitScreen,this._resizeFrame()},i.requestFullScreen=function(){var t=this;return new Promise((function(e,i){t.isFullScreen?e():(t._cachedFrameSize=t.windowSize,t._doRequestFullScreen().then((function(){e()})).catch((function(){var n=t._getFullscreenTarget();n?n.addEventListener(t._touchEventName,(function(){t._doRequestFullScreen().then((function(){e()})).catch(i)}),{once:!0,capture:!0}):i(new Error("Cannot access fullscreen target"))})))}))},i.exitFullScreen=function(){var t=this;return new Promise((function(e,i){var n=document[t._fn.exitFullscreen]();window.Promise&&n instanceof Promise?n.then((function(){t.windowSize=t._cachedFrameSize,e()})).catch(i):(t.windowSize=t._cachedFrameSize,e())}))},i._registerEvent=function(){var t=this;document.addEventListener(this._fn.fullscreenerror,(function(){var e;null===(e=t._onFullscreenError)||void 0===e||e.call(t)})),window.addEventListener("resize",(function(){t.handleResizeEvent&&t._resizeFrame()})),"function"==typeof window.matchMedia&&function e(){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(){t.emit("window-resize"),e()}),{once:!0})}(),window.addEventListener("orientationchange",(function(){-1!==t._orientationChangeTimeoutId&&clearTimeout(t._orientationChangeTimeoutId),t._orientationChangeTimeoutId=setTimeout((function(){t.handleResizeEvent&&(t._updateFrameState(),t._resizeFrame(),t.emit("orientation-change"),t._orientationChangeTimeoutId=-1)}),200)})),document.addEventListener(this._fn.fullscreenchange,(function(){var e;null===(e=t._onFullscreenChange)||void 0===e||e.call(t),t.emit("fullscreen-change")}))},i._convertToSizeInCssPixels=function(t){var e=t.clone(),i=this.devicePixelRatio;return e.width/=i,e.height/=i,e},i._resizeFrame=function(t){if(this._gameFrame){if(this._gameFrame.style.display="flex",this._gameFrame.style["justify-content"]="center",this._gameFrame.style["align-items"]="center",this._windowType===Va.SubFrame){if(!t)return void this._updateContainer();this._gameFrame.style.width=t.width+"px",this._gameFrame.style.height=t.height+"px"}else{var e=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 "+e+"px",this._gameFrame.style.width=i+"px",this._gameFrame.style.height=e+"px"):(this._gameFrame.style["-webkit-transform"]="rotate(0deg)",this._gameFrame.style.transform="rotate(0deg)",this._gameFrame.style.margin="0px auto",this._gameFrame.style.width=e+"px",this._gameFrame.style.height=i+"px")}this._updateContainer()}},i._getFullscreenTarget=function(){var t=this._windowType;return t===Va.Fullscreen?document[this._fn.fullscreenElement]:t===Va.SubFrame?this._gameFrame:document.body},i._doRequestFullScreen=function(){var t=this;return new Promise((function(e,i){if(t._supportFullScreen){var n=t._getFullscreenTarget();if(n){t._onFullscreenChange=void 0,t._onFullscreenError=void 0;var r=n[t._fn.requestFullscreen]();window.Promise&&r instanceof Promise?r.then(e).catch(i):(t._onFullscreenChange=e,t._onFullscreenError=i)}else i(new Error("Cannot access fullscreen target"))}else i(new Error("fullscreen is not supported"))}))},i._updateFrameState=function(){var t=this.orientation,e=window.innerWidth>window.innerHeight;this.isFrameRotated=Ha.isMobile&&(e&&t===za.PORTRAIT||!e&&t===za.LANDSCAPE)},i._updateContainer=function(){if(this._gameContainer){if(this.isProportionalToFrame){if(!this._gameFrame)return void j(9201);var t,e,i=b.view.getDesignResolutionSize(),n=this._gameFrame,r=n.clientWidth,s=n.clientHeight,a=i.width,o=i.height,u=r/a,h=s/o,l=this._gameContainer.style;u<h?(t=r,e=o*u):(t=a*h,e=s),l.width=t+"px",l.height=e+"px"}else{var c=this._gameContainer.style;c.width="100%",c.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._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 j(9201)},h(e,[{key:"supportFullScreen",get:function(){return this._supportFullScreen}},{key:"isFullScreen",get:function(){return!!this._supportFullScreen&&!!document[this._fn.fullscreenElement]}},{key:"devicePixelRatio",get:function(){var t;return Math.min(null!==(t=window.devicePixelRatio)&&void 0!==t?t:1,2)}},{key:"windowSize",get:function(){var t=this._windowSizeInCssPixels,e=this.devicePixelRatio;return t.width*=e,t.height*=e,t},set:function(t){this._windowType===Va.SubFrame?this._resizeFrame(this._convertToSizeInCssPixels(t)):j(9202)}},{key:"resolution",get:function(){var t=this.windowSize,e=this.resolutionScale;return new gn(t.width*e,t.height*e)}},{key:"resolutionScale",get:function(){return this._resolutionScale},set:function(t){var e;t!==this._resolutionScale&&(this._resolutionScale=t,null===(e=this._cbToUpdateFrameBuffer)||void 0===e||e.call(this))}},{key:"orientation",get:function(){return this._orientation},set:function(t){this._orientation!==t&&(this._orientation=t,this._updateFrameState())}},{key:"safeAreaEdge",get:function(){return{top:0,bottom:0,left:0,right:0}}},{key:"isProportionalToFrame",get:function(){return this._isProportionalToFrame},set:function(t){this._isProportionalToFrame!==t&&(this._isProportionalToFrame=t,this._updateContainer())}},{key:"_windowSizeInCssPixels",get:function(){if(this.isProportionalToFrame)return this._gameContainer?new gn(this._gameContainer.clientWidth,this._gameContainer.clientHeight):(j(9201),new gn(0,0));var t,e,i;switch(this._windowType){case Va.SubFrame:return this._gameFrame?new gn(this._gameFrame.clientWidth,this._gameFrame.clientHeight):(j(9201),new gn(0,0));case Va.Fullscreen:return t=this._getFullscreenTarget(),e=this.isFrameRotated?t.clientHeight:t.clientWidth,i=this.isFrameRotated?t.clientWidth:t.clientHeight,new gn(e,i);case Va.BrowserWindow:return e=this.isFrameRotated?window.innerHeight:window.innerWidth,i=this.isFrameRotated?window.innerWidth:window.innerHeight,new gn(e,i);case Va.Unknown:default:return new gn(0,0)}}},{key:"_windowType",get:function(){return this.isFullScreen?Va.Fullscreen:this._gameFrame?this._exactFitScreen?Va.BrowserWindow:Va.SubFrame:(j(9201),Va.Unknown)}}]),e}(Ba)),ja=function(){function t(){}var e=t.prototype;return e.init=function(){var t,e,i=null===(t=ye.querySettings(ve.Category.SCREEN,"exactFitScreen"))||void 0===t||t,n=null!==(e=ye.querySettings(ve.Category.SCREEN,"orientation"))&&void 0!==e?e:"auto";Xa.init({exactFitScreen:i,configOrientation:n},(function(){var t,e=b.director;(null===(t=e.root)||void 0===t?void 0:t.pipeline)?e.root.pipeline.shadingScale=Xa.resolutionScale:j(1220)}))},e.fullScreen=function(){return Xa.isFullScreen},e.requestFullScreen=function(t,e,i){return arguments.length>0&&j(1400,"screen.requestFullScreen(element, onFullScreenChange?, onFullScreenError?)","screen.requestFullScreen(): Promise"),Xa.requestFullScreen().then((function(){null==e||e()})).catch((function(t){console.error(t),null==i||i()}))},e.exitFullScreen=function(){return Xa.exitFullScreen()},e.autoFullScreen=function(t,e){var i;null===(i=this.requestFullScreen(t,e))||void 0===i||i.catch((function(){}))},e.disableAutoFullScreen=function(){},h(t,[{key:"devicePixelRatio",get:function(){return Xa.devicePixelRatio}},{key:"windowSize",get:function(){return Xa.windowSize},set:function(t){Xa.windowSize=t}},{key:"resolution",get:function(){return Xa.resolution}},{key:"supportsFullScreen",get:function(){return Xa.supportFullScreen}}]),t}(),Ya=t("screen",new ja);b.screen=Ya;var Ka,qa,Qa=t("sys",{Feature:Ga,hasFeature:function(t){return Ha.hasFeature(t)},NetworkType:La,Language:Ma,OS:Fa,Platform:Ua,BrowserType:Na,isNative:Ha.isNative,isBrowser:Ha.isBrowser,isMobile:Ha.isMobile,isLittleEndian:Ha.isLittleEndian,platform:Ha.platform,language:Ha.language,languageCode:Ha.nativeLanguage,os:Ha.os,osVersion:Ha.osVersion,osMainVersion:Ha.osMainVersion,browserType:Ha.browserType,browserVersion:Ha.browserVersion,isXR:Ha.isXR,windowPixelResolution:Ya.windowSize,capabilities:{canvas:!0,opengl:!0,webp:Ha.hasFeature(Ga.WEBP),imageBitmap:Ha.hasFeature(Ga.IMAGE_BITMAP),touches:Ha.hasFeature(Ga.INPUT_TOUCH),mouse:Ha.hasFeature(Ga.EVENT_MOUSE),keyboard:Ha.hasFeature(Ga.EVENT_KEYBOARD),accelerometer:Ha.hasFeature(Ga.EVENT_ACCELEROMETER)},localStorage:{},getNetworkType:function(){return Ha.networkType},getBatteryLevel:function(){return Ha.getBatteryLevel()},garbageCollect:function(){Ha.triggerGC()},isObjectValid:function(t){return null!=t},dump:function(){var t="";t+="isMobile : "+this.isMobile+"\r\n",t+="language : "+this.language+"\r\n",t+="browserType : "+this.browserType+"\r\n",t+="browserVersion : "+this.browserVersion+"\r\n",t+="capabilities : "+JSON.stringify(this.capabilities)+"\r\n",t+="os : "+this.os+"\r\n",t+="osVersion : "+this.osVersion+"\r\n",t+="platform : "+this.platform+"\r\n",M(t+="Using "+(b.game.renderType===b.game.RENDER_TYPE_WEBGL?"WEBGL":"CANVAS")+" renderer.\r\n")},openURL:function(t){Ha.openURL(t)},init:function(){try{var t=Qa.localStorage=window.localStorage;t.setItem("storage",""),t.removeItem("storage"),t=null}catch(t){var e=function(){j(5200)};this.localStorage={getItem:e,setItem:e,clear:e,removeItem:e}}this.__isWebIOS14OrIPadOS14Env=(Qa.os===Fa.IOS||Qa.os===Fa.OSX)&&Ha.isBrowser&&/(OS 14)|(Version\/14)/.test(window.navigator.userAgent)},now:function(){return Ha.now()},restartVM:function(){Ha.restartJSVM()},getSafeAreaRect:function(){var t=b.view,e=Xa.safeAreaEdge,i=Xa.windowSize,n=new _n(e.left,e.bottom),r=new _n(i.width-e.right,i.height-e.top);t._convertToUISpace(n),t._convertToUISpace(r);var s=n.x,a=n.y,o=r.x-n.x,u=r.y-n.y;return new yn(s,a,o,u)}});b.sys=Qa,function(t){t[t.AUTO=0]="AUTO",t[t.CANVAS=1]="CANVAS",t[t.WEBGL=2]="WEBGL",t[t.HEADLESS=3]="HEADLESS"}(Ka||(Ka={})),function(t){t[t.UNKNOWN=-1]="UNKNOWN",t[t.CANVAS=0]="CANVAS",t[t.WEBGL=1]="WEBGL",t[t.OPENGL=2]="OPENGL",t[t.HEADLESS=3]="HEADLESS"}(qa||(qa={}));var Za=function(){function t(){this.initialized=!1,this._canvas=null,this._renderType=qa.UNKNOWN}var e=t.prototype;return e.init=function(t,e){if(!this.initialized){var i=ye.querySettings(ve.Category.RENDERING,"renderMode");if(this._canvas=t,this._renderType=this._determineRenderType(i),this._renderType===qa.WEBGL){var n=new Nr(e),r=!!window.WebGL2RenderingContext,s=window.navigator.userAgent.toLowerCase();(-1!==s.indexOf("safari")&&-1===s.indexOf("chrome")||Qa.browserType===Na.UC)&&(r=!1);var a=[];r&&b.WebGL2Device&&a.push(b.WebGL2Device),b.WebGLDevice&&a.push(b.WebGLDevice),b.EmptyDevice&&a.push(b.EmptyDevice),Us.canvas=t;for(var o=0;o<a.length&&(this._gfxDevice=new a[o],!this._gfxDevice.initialize(n));o++);}else this._renderType===qa.HEADLESS&&b.EmptyDevice&&(this._gfxDevice=new b.EmptyDevice,this._gfxDevice.initialize(new Nr(e)));if(!this._gfxDevice)return F("can not support canvas rendering in 3D"),void(this._renderType=qa.UNKNOWN);var u=new Br(this._canvas),h=Ya.windowSize;u.width=h.width,u.height=h.height,this._swapchain=this._gfxDevice.createSwapchain(u),this._canvas&&(this._canvas.oncontextmenu=function(){return!1})}},e._determineRenderType=function(t){("number"!=typeof t||t>qa.HEADLESS||t<Ka.AUTO)&&(t=Ka.AUTO);var e=qa.CANVAS,i=!1;if(t===Ka.CANVAS?(e=qa.CANVAS,i=!0):t===Ka.AUTO||t===Ka.WEBGL?(e=qa.WEBGL,i=!0):t===Ka.HEADLESS&&(e=qa.HEADLESS,i=!0),!i)throw new Error(J(3820,t));return e},h(t,[{key:"gfxDevice",get:function(){return this._gfxDevice}},{key:"swapchain",get:function(){return this._swapchain}}]),t}(),Ja=new Za;t("gfx",Object.freeze({__proto__:null,DescriptorSet:Xs,Buffer:Ls,CommandBuffer:Fs,get ObjectType(){return Rn},get Status(){return bn},get API(){return Cn},get SurfaceTransform(){return wn},get Feature(){return In},get Format(){return On},get FormatType(){return xn},get Type(){return Pn},get BufferUsageBit(){return Dn},get BufferFlagBit(){return Bn},get MemoryAccessBit(){return Nn},get MemoryUsageBit(){return Mn},get TextureType(){return Ln},get TextureUsageBit(){return Fn},get TextureFlagBit(){return Un},get FormatFeatureBit(){return Gn},get SampleCount(){return kn},get VsyncMode(){return zn},get Filter(){return Hn},get Address(){return Vn},get ComparisonFunc(){return Wn},get StencilOp(){return Xn},get BlendFactor(){return jn},get BlendOp(){return Yn},get ColorMask(){return Kn},get ShaderStageFlagBit(){return qn},get LoadOp(){return Qn},get StoreOp(){return Zn},get AccessFlagBit(){return Jn},get ResolveMode(){return $n},get PipelineBindPoint(){return tr},get PrimitiveMode(){return er},get PolygonMode(){return ir},get ShadeModel(){return nr},get CullMode(){return rr},get DynamicStateFlagBit(){return sr},get StencilFace(){return ar},get DescriptorType(){return or},get QueueType(){return ur},get QueryType(){return hr},get CommandBufferType(){return lr},get ClearFlagBit(){return cr},get BarrierType(){return _r},get PassType(){return fr},Size:vr,DeviceCaps:yr,DeviceOptions:Er,Offset:Tr,Rect:Sr,Extent:Ar,TextureSubresLayers:Rr,TextureSubresRange:br,TextureCopy:Cr,TextureBlit:wr,BufferTextureCopy:Ir,Viewport:Or,Color:Pr,BindingMappingInfo:Dr,SwapchainInfo:Br,DeviceInfo:Nr,BufferInfo:Mr,BufferViewInfo:Lr,DrawInfo:Fr,DispatchInfo:Ur,IndirectBuffer:Gr,TextureInfo:kr,TextureViewInfo:zr,SamplerInfo:Hr,Uniform:Vr,UniformBlock:Wr,UniformSamplerTexture:Xr,UniformSampler:jr,UniformTexture:Yr,UniformStorageImage:Kr,UniformStorageBuffer:qr,UniformInputAttachment:Qr,ShaderStage:Zr,Attribute:Jr,ShaderInfo:$r,InputAssemblerInfo:ts,ColorAttachment:es,DepthStencilAttachment:is,SubpassInfo:ns,SubpassDependency:rs,RenderPassInfo:ss,GeneralBarrierInfo:as,TextureBarrierInfo:os,BufferBarrierInfo:us,FramebufferInfo:hs,DescriptorSetLayoutBinding:ls,DescriptorSetLayoutInfo:cs,DescriptorSetInfo:_s,PipelineLayoutInfo:fs,InputState:ds,CommandBufferInfo:ps,QueueInfo:ms,QueryPoolInfo:gs,FormatInfo:vs,MemoryStatus:ys,DynamicStencilStates:Es,DynamicStates:Ts,GFXObject:Ss,get AttributeName(){return gr},FormatInfos:As,DESCRIPTOR_BUFFER_TYPE:Rs,DESCRIPTOR_SAMPLER_TYPE:bs,DESCRIPTOR_DYNAMIC_TYPE:Cs,DRAW_INFO_SIZE:28,IsPowerOf2:ws,FormatSize:Is,FormatSurfaceSize:Os,GetTypeSize:Ps,getTypedArrayConstructor:Ds,formatAlignment:Bs,alignTo:Ns,Device:Us,Swapchain:Gs,Framebuffer:ks,InputAssembler:Ws,DescriptorSetLayout:js,PipelineLayout:Ys,RasterizerState:Ks,DepthStencilState:qs,BlendTarget:Qs,BlendState:Zs,PipelineStateInfo:Js,PipelineState:$s,Queue:ta,RenderPass:ea,Sampler:ia,Shader:na,Texture:ra,GeneralBarrier:sa,TextureBarrier:aa,get LegacyRenderMode(){return Ka},get RenderType(){return qa},DeviceManager:Za,deviceManager:Ja}));var $a=new ji,to=new ji,eo=new ji,io=new ji,no=new ji,ro=new ji,so=new Array(3),ao=new Array(3);function oo(t,e){return ji.dot(e.n,t)-e.d}function uo(t,e,i){return ji.copy(t,e),ji.subtract(no,i.center,i.halfExtents),ji.add(ro,i.center,i.halfExtents),t.x=t.x<no.x?no.x:t.x,t.y=t.y<no.y?no.y:t.y,t.z=t.z<no.z?no.z:t.z,t.x=t.x>ro.x?ro.x:t.x,t.y=t.y>ro.y?ro.y:t.y,t.z=t.z>ro.z?ro.z:t.z,t}function ho(t,e,i){ji.set($a,i.orientation.m00,i.orientation.m01,i.orientation.m02),ji.set(to,i.orientation.m03,i.orientation.m04,i.orientation.m05),ji.set(eo,i.orientation.m06,i.orientation.m07,i.orientation.m08),so[0]=$a,so[1]=to,so[2]=eo,ao[0]=i.halfExtents.x,ao[1]=i.halfExtents.y,ao[2]=i.halfExtents.z,ji.subtract(io,e,i.center),ji.set(t,i.center.x,i.center.y,i.center.z);for(var n=0;n<3;n++){var r=ji.dot(io,so[n]);r>ao[n]&&(r=ao[n]),r<-ao[n]&&(r=-ao[n]),t.x+=r*so[n].x,t.y+=r*so[n].y,t.z+=r*so[n].z}return t}var lo=Object.freeze({__proto__:null,point_plane:oo,pt_point_plane:function(t,e,i){var n=oo(e,i);return ji.subtract(t,e,ji.multiplyScalar(t,i.n,n))},pt_point_aabb:uo,pt_point_obb:ho,pt_point_line:function(t,e,i,n){ji.subtract($a,i,n);var r=$a,s=ji.lengthSqr(r);if(0==s)ji.copy(t,i);else{ji.subtract($a,e,i);var a=ji.dot($a,r)/s;a<0?ji.copy(t,i):a>1?ji.copy(t,n):ji.scaleAndAdd(t,i,r,a)}}}),co={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},_o=function(){function t(t,e,i,n,r,s){void 0===t&&(t=0),void 0===e&&(e=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=co.SHAPE_LINE,this.s=new ji(t,e,i),this.e=new ji(n,r,s)}return t.create=function(e,i,n,r,s,a){return new t(e,i,n,r,s,a)},t.clone=function(e){return new t(e.s.x,e.s.y,e.s.z,e.e.x,e.e.y,e.e.z)},t.copy=function(t,e){return ji.copy(t.s,e.s),ji.copy(t.e,e.e),t},t.fromPoints=function(t,e,i){return ji.copy(t.s,e),ji.copy(t.e,i),t},t.set=function(t,e,i,n,r,s,a){return t.s.x=e,t.s.y=i,t.s.z=n,t.e.x=r,t.e.y=s,t.e.z=a,t},t.len=function(t){return ji.distance(t.s,t.e)},t.prototype.length=function(){return ji.distance(this.s,this.e)},h(t,[{key:"type",get:function(){return this._type}}]),t}(),fo=function(){function t(t,e,i,n,r,s){void 0===t&&(t=0),void 0===e&&(e=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=co.SHAPE_RAY,this.o=new ji(t,e,i),this.d=new ji(n,r,s)}return t.create=function(e,i,n,r,s,a){return void 0===e&&(e=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 t(e,i,n,r,s,a)},t.clone=function(e){return new t(e.o.x,e.o.y,e.o.z,e.d.x,e.d.y,e.d.z)},t.copy=function(t,e){return ji.copy(t.o,e.o),ji.copy(t.d,e.d),t},t.fromPoints=function(t,e,i){return ji.copy(t.o,e),ji.normalize(t.d,ji.subtract(t.d,i,e)),t},t.set=function(t,e,i,n,r,s,a){return t.o.x=e,t.o.y=i,t.o.z=n,t.d.x=r,t.d.y=s,t.d.z=a,t},t.prototype.computeHit=function(t,e){ji.normalize(t,this.d),ji.scaleAndAdd(t,this.o,t,e)},h(t,[{key:"type",get:function(){return this._type}}]),t}(),po=new ji,mo=new ji,go=new ji,vo=new ji;function yo(t){return Math.max(Math.max(t.x,t.y),t.z)}var Eo,To=function(){function t(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1),this._center=new ji(0,0,0),this._radius=0,this._type=void 0,this._type=co.SHAPE_SPHERE,this._center=new ji(t,e,i),this._radius=n}t.create=function(e,i,n,r){return new t(e,i,n,r)},t.clone=function(e){return new t(e.center.x,e.center.y,e.center.z,e.radius)},t.copy=function(t,e){return ji.copy(t.center,e.center),t.radius=e.radius,t},t.fromPoints=function(t,e,i){return ji.multiplyScalar(t.center,ji.add(po,e,i),.5),t.radius=.5*ji.subtract(po,i,e).length(),t},t.set=function(t,e,i,n,r){return t.center.x=e,t.center.y=i,t.center.z=n,t.radius=r,t};var e=t.prototype;return e.destroy=function(){},e.clone=function(){return t.clone(this)},e.copy=function(e){return t.copy(this,e)},e.getBoundary=function(t,e){ji.set(t,this.center.x-this.radius,this.center.y-this.radius,this.center.z-this.radius),ji.set(e,this.center.x+this.radius,this.center.y+this.radius,this.center.z+this.radius)},e.transform=function(t,e,i,n,r){ji.transformMat4(r.center,this.center,t),r.radius=this.radius*yo(n)},e.translateAndRotate=function(t,e,i){ji.transformMat4(i.center,this.center,t)},e.setScale=function(t,e){e.radius=this.radius*yo(t)},e.mergePoint=function(t){this.radius<0&&(this.center.set(t),this.radius=0),ji.subtract(mo,t,this.center);var e=mo.length();if(e>this.radius){var i=.5*(e-this.radius);this.radius+=i,ji.multiplyScalar(mo,mo,i/e),ji.add(this.center,this.center,mo)}},e.mergePoints=function(t){var e=t.length;if(!(e<1)){this.radius=-1;for(var i=0;i<e;i++)this.mergePoint(t[i])}},e.mergeAABB=function(t){t.getBoundary(go,vo),this.mergePoint(go),this.mergePoint(vo)},h(t,[{key:"center",get:function(){return this._center},set:function(t){this._center=t}},{key:"radius",get:function(){return this._radius},set:function(t){this._radius=t}},{key:"type",get:function(){return this._type}}]),t}(),So=function(){function t(t,e,i,n,r,s,a,o,u){void 0===t&&(t=0),void 0===e&&(e=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=co.SHAPE_TRIANGLE,this.a=new ji(t,e,i),this.b=new ji(n,r,s),this.c=new ji(a,o,u)}return t.create=function(e,i,n,r,s,a,o,u,h){return void 0===e&&(e=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 t(e,i,n,r,s,a,o,u,h)},t.clone=function(e){return new t(e.a.x,e.a.y,e.a.z,e.b.x,e.b.y,e.b.z,e.c.x,e.c.y,e.c.z)},t.copy=function(t,e){return ji.copy(t.a,e.a),ji.copy(t.b,e.b),ji.copy(t.c,e.c),t},t.fromPoints=function(t,e,i,n){return ji.copy(t.a,e),ji.copy(t.b,i),ji.copy(t.c,n),t},t.set=function(t,e,i,n,r,s,a,o,u,h){return t.a.x=e,t.a.y=i,t.a.z=n,t.b.x=r,t.b.y=s,t.b.z=a,t.c.x=o,t.c.y=u,t.c.z=h,t},h(t,[{key:"type",get:function(){return this._type}}]),t}();!function(t){t[t.ALL=0]="ALL",t[t.CLOSEST=1]="CLOSEST",t[t.ANY=2]="ANY"}(Eo||(Eo={}));var Ao,Ro,bo,Co,wo,Io,Oo,xo,Po=(Ao=new ji(0,0,0),function(t,e){var i=ji.dot(t.d,e.n);if(Math.abs(i)<Number.EPSILON)return 0;ji.multiplyScalar(Ao,e.n,e.d);var n=ji.dot(ji.subtract(Ao,Ao,t.o),e.n)/i;return n<0?0:n}),Do=(Ro=new ji(0,0,0),bo=new ji(0,0,0),Co=new ji(0,0,0),wo=new ji(0,0,0),Io=new ji(0,0,0),function(t,e,i){ji.subtract(Ro,e.b,e.a),ji.subtract(bo,e.c,e.a),ji.cross(Co,t.d,bo);var n=ji.dot(Ro,Co);if(n<Number.EPSILON&&(!i||n>-Number.EPSILON))return 0;var r=1/n;ji.subtract(wo,t.o,e.a);var s=ji.dot(wo,Co)*r;if(s<0||s>1)return 0;ji.cross(Io,wo,Ro);var a=ji.dot(t.d,Io)*r;if(a<0||s+a>1)return 0;var o=ji.dot(bo,Io)*r;return o<0?0:o}),Bo=function(){var t=new ji(0,0,0);return function(e,i){var n=i.radius,r=i.center,s=e.o,a=e.d,o=n*n;ji.subtract(t,r,s);var u=t.lengthSqr(),h=ji.dot(t,a),l=o-(u-h*h);if(l<0)return 0;var c=Math.sqrt(l),_=u<o?h+c:h-c;return _<0?0:_}}(),No=(Oo=new ji,xo=new ji,function(t,e){return ji.subtract(Oo,e.center,e.halfExtents),ji.add(xo,e.center,e.halfExtents),Mo(t,Oo,xo)});function Mo(t,e,i){var n=t.o,r=t.d,s=1/r.x,a=1/r.y,o=1/r.z,u=(e.x-n.x)*s,h=(i.x-n.x)*s,l=(e.y-n.y)*a,c=(i.y-n.y)*a,_=(e.z-n.z)*o,f=(i.z-n.z)*o,d=Math.max(Math.max(Math.min(u,h),Math.min(l,c)),Math.min(_,f)),p=Math.min(Math.min(Math.max(u,h),Math.max(l,c)),Math.max(_,f));return p<0||d>p?0:d>0?d:p}var Lo,Fo,Uo,Go,ko=function(){var t=new ji,e=new ji,i=new ji,n=new ji,r=new ji,s=new ji,a=new ji,o=new Array(3),u=new Array(3),h=new Array(3),l=new Array(6);return function(c,_){o[0]=_.halfExtents.x,o[1]=_.halfExtents.y,o[2]=_.halfExtents.z,t=_.center,e=c.o,i=c.d,ji.set(n,_.orientation.m00,_.orientation.m01,_.orientation.m02),ji.set(r,_.orientation.m03,_.orientation.m04,_.orientation.m05),ji.set(s,_.orientation.m06,_.orientation.m07,_.orientation.m08),ji.subtract(a,t,e),u[0]=ji.dot(n,i),u[1]=ji.dot(r,i),u[2]=ji.dot(s,i),h[0]=ji.dot(n,a),h[1]=ji.dot(r,a),h[2]=ji.dot(s,a);for(var f=0;f<3;++f){if(0===u[f]){if(-h[f]-o[f]>0||-h[f]+o[f]<0)return 0;u[f]=1e-7}l[2*f+0]=(h[f]+o[f])/u[f],l[2*f+1]=(h[f]-o[f])/u[f]}var d=Math.max(Math.max(Math.min(l[0],l[1]),Math.min(l[2],l[3])),Math.min(l[4],l[5])),p=Math.min(Math.min(Math.max(l[0],l[1]),Math.max(l[2],l[3])),Math.max(l[4],l[5]));return p<0||d>p?0:d>0?d:p}}(),zo=function(){var t=new ji,e=new ji,i=new ji,n=new ji,r=new ji,s=new ji,a=new ji,o=new To;return function(u,h){var l=h.radius*h.radius,c=ji.normalize(t,u.d),_=h.ellipseCenter0,f=h.ellipseCenter1,d=ji.subtract(e,f,_);if(d.equals(ji.ZERO))return o.radius=h.radius,o.center.set(h.ellipseCenter0),bu.raySphere(u,o);var p=u.o,m=ji.subtract(i,p,_),g=ji.cross(n,c,d),v=g.lengthSqr();if(0===v){o.radius=h.radius;var y=ji.subtract(r,f,p);return m.lengthSqr()<y.lengthSqr()?o.center.set(h.ellipseCenter0):o.center.set(h.ellipseCenter1),bu.raySphere(u,o)}var E=ji.cross(r,m,d),T=d.lengthSqr(),S=2*ji.dot(g,E),A=S*S-4*v*(E.lengthSqr()-l*T);if(A<0)return 0;var R=(-S-Math.sqrt(A))/(2*v);if(R<0){o.radius=h.radius;var b=ji.subtract(s,f,p);return m.lengthSqr()<b.lengthSqr()?o.center.set(h.ellipseCenter0):o.center.set(h.ellipseCenter1),bu.raySphere(u,o)}var C=ji.scaleAndAdd(s,u.o,c,R),w=ji.subtract(a,C,_),I=ji.dot(w,d)/T;return I>=0&&I<=1?R:I<0?(o.radius=h.radius,o.center.set(h.ellipseCenter0),bu.raySphere(u,o)):I>1?(o.radius=h.radius,o.center.set(h.ellipseCenter1),bu.raySphere(u,o)):0}}(),Ho=(Lo=So.create(),Fo={distance:1/0,doubleSided:!1,mode:Eo.ANY},Uo=0,Go=function(t,e,i,n,r,s){t===Eo.CLOSEST?(Uo>e||0===Uo)&&(Uo=e,s&&(0===s.length?s.push({distance:e,vertexIndex0:i/3,vertexIndex1:n/3,vertexIndex2:r/3}):(s[0].distance=e,s[0].vertexIndex0=i/3,s[0].vertexIndex1=n/3,s[0].vertexIndex2=r/3))):(Uo=e,s&&s.push({distance:e,vertexIndex0:i/3,vertexIndex1:n/3,vertexIndex2:r/3}))},function(t,e,i){if(Uo=0,0===e.geometricInfo.positions.length)return Uo;var n=void 0===i?Fo:i;if(Mo(t,e.geometricInfo.boundingBox.min,e.geometricInfo.boundingBox.max)){var r=e.primitiveMode,s=e.geometricInfo;!function(t,e,i,n,r){if(i===er.TRIANGLE_LIST)for(var s=e.length,a=0;a<s;a+=3){var o=3*e[a],u=3*e[a+1],h=3*e[a+2];ji.set(Lo.a,t[o],t[o+1],t[o+2]),ji.set(Lo.b,t[u],t[u+1],t[u+2]),ji.set(Lo.c,t[h],t[h+1],t[h+2]);var l=bu.rayTriangle(n,Lo,r.doubleSided);if(!(0===l||l>r.distance)&&(Go(r.mode,l,o,u,h,r.result),r.mode===Eo.ANY))return l}else if(i===er.TRIANGLE_STRIP)for(var c=e.length-2,_=0,f=0;f<c;f+=1){var d=3*e[f-_],p=3*e[f+_+1],m=3*e[f+2];ji.set(Lo.a,t[d],t[d+1],t[d+2]),ji.set(Lo.b,t[p],t[p+1],t[p+2]),ji.set(Lo.c,t[m],t[m+1],t[m+2]),_=~_;var g=bu.rayTriangle(n,Lo,r.doubleSided);if(!(0===g||g>r.distance)&&(Go(r.mode,g,d,p,m,r.result),r.mode===Eo.ANY))return g}else if(i===er.TRIANGLE_FAN){var v=e.length-1,y=3*e[0];ji.set(Lo.a,t[y],t[y+1],t[y+2]);for(var E=1;E<v;E+=1){var T=3*e[E],S=3*e[E+1];ji.set(Lo.b,t[T],t[T+1],t[T+2]),ji.set(Lo.c,t[S],t[S+1],t[S+2]);var A=bu.rayTriangle(n,Lo,r.doubleSided);if(!(0===A||A>r.distance)&&(Go(r.mode,A,y,T,S,r.result),r.mode===Eo.ANY))return A}}}(s.positions,s.indices,r,t,n)}return Uo}),Vo=function(){var t=0,e={distance:1/0,doubleSided:!1,mode:Eo.ANY};return function(i,n,r){t=0;var s=void 0===r?e:r,a=n.renderingSubMeshes.length,o=n.struct.minPosition,u=n.struct.maxPosition;if(o&&u&&!Mo(i,o,u))return t;for(var h=0;h<a;h++){var l=n.renderingSubMeshes[h],c=Ho(i,l,s);if(c)if(s.mode===Eo.CLOSEST)(0===t||t>c)&&(t=c,s.subIndices&&(s.subIndices[0]=h));else if(t=c,s.subIndices&&s.subIndices.push(h),s.mode===Eo.ANY)return c}return t&&s.mode===Eo.CLOSEST&&(s.result&&(s.result[0].distance=t,s.result.length=1),s.subIndices&&(s.subIndices.length=1)),t}}(),Wo=function(){var t=0,e={distance:1/0,doubleSided:!1,mode:Eo.ANY},i=new fo,n=new un;return function(r,s,a){t=0;var o=void 0===a?e:a,u=s.worldBounds;if(u&&!No(r,u))return t;fo.copy(i,r),s.node&&(un.invert(n,s.node.getWorldMatrix(n)),ji.transformMat4(i.o,r.o,n),ji.transformMat4Normal(i.d,r.d,n));for(var h=s.subModels,l=0;l<h.length;l++){var c=h[l].subMesh,_=Ho(i,c,o);if(_)if(o.mode===Eo.CLOSEST)(0===t||t>_)&&(t=_,o.subIndices&&(o.subIndices[0]=l));else if(t=_,o.subIndices&&o.subIndices.push(l),o.mode===Eo.ANY)return _}return t&&o.mode===Eo.CLOSEST&&(o.result&&(o.result[0].distance=t,o.result.length=1),o.subIndices&&(o.subIndices.length=1)),t}}(),Xo=function(){var t=new ji(0,0,0);return function(e,i){ji.subtract(t,e.e,e.s);var n=(i.d-ji.dot(e.s,i.n))/ji.dot(t,i.n);return n<0||n>1?0:n}}(),jo=function(){var t=new ji(0,0,0),e=new ji(0,0,0),i=new ji(0,0,0),n=new ji(0,0,0),r=new ji(0,0,0),s=new ji(0,0,0);return function(a,o,u){ji.subtract(t,o.b,o.a),ji.subtract(e,o.c,o.a),ji.subtract(i,a.s,a.e),ji.cross(r,t,e);var h=ji.dot(i,r);if(h<=0)return 0;ji.subtract(n,a.s,o.a);var l=ji.dot(n,r);if(l<0||l>h)return 0;ji.cross(s,i,n);var c=ji.dot(e,s);if(c<0||c>h)return 0;var _=-ji.dot(t,s);if(_<0||c+_>h)return 0;if(u){var f=1/h,d=1-(c*=f)-(_*=f);ji.set(u,o.a.x*d+o.b.x*c+o.c.x*_,o.a.y*d+o.b.y*c+o.c.y*_,o.a.z*d+o.b.z*c+o.c.z*_)}return 1}}(),Yo=new fo;function Ko(t,e){Yo.o.set(t.s),ji.subtract(Yo.d,t.e,t.s),Yo.d.normalize();var i=No(Yo,e);return i<=t.length()?i:0}function qo(t,e){Yo.o.set(t.s),ji.subtract(Yo.d,t.e,t.s),Yo.d.normalize();var i=ko(Yo,e);return i<=t.length()?i:0}function Qo(t,e){Yo.o.set(t.s),ji.subtract(Yo.d,t.e,t.s),Yo.d.normalize();var i=Bo(Yo,e);return i<=t.length()?i:0}var Zo,Jo,$o,tu,eu=(Zo=new ji,Jo=new ji,$o=new ji,tu=new ji,function(t,e){return ji.subtract(Zo,t.center,t.halfExtents),ji.add(Jo,t.center,t.halfExtents),ji.subtract($o,e.center,e.halfExtents),ji.add(tu,e.center,e.halfExtents),Zo.x<=tu.x&&Jo.x>=$o.x&&Zo.y<=tu.y&&Jo.y>=$o.y&&Zo.z<=tu.z&&Jo.z>=$o.z});function iu(t,e,i,n,r,s){ji.set(s[0],t.x+i.x*e.x+n.x*e.y+r.x*e.z,t.y+i.y*e.x+n.y*e.y+r.y*e.z,t.z+i.z*e.x+n.z*e.y+r.z*e.z),ji.set(s[1],t.x-i.x*e.x+n.x*e.y+r.x*e.z,t.y-i.y*e.x+n.y*e.y+r.y*e.z,t.z-i.z*e.x+n.z*e.y+r.z*e.z),ji.set(s[2],t.x+i.x*e.x-n.x*e.y+r.x*e.z,t.y+i.y*e.x-n.y*e.y+r.y*e.z,t.z+i.z*e.x-n.z*e.y+r.z*e.z),ji.set(s[3],t.x+i.x*e.x+n.x*e.y-r.x*e.z,t.y+i.y*e.x+n.y*e.y-r.y*e.z,t.z+i.z*e.x+n.z*e.y-r.z*e.z),ji.set(s[4],t.x-i.x*e.x-n.x*e.y-r.x*e.z,t.y-i.y*e.x-n.y*e.y-r.y*e.z,t.z-i.z*e.x-n.z*e.y-r.z*e.z),ji.set(s[5],t.x+i.x*e.x-n.x*e.y-r.x*e.z,t.y+i.y*e.x-n.y*e.y-r.y*e.z,t.z+i.z*e.x-n.z*e.y-r.z*e.z),ji.set(s[6],t.x-i.x*e.x+n.x*e.y-r.x*e.z,t.y-i.y*e.x+n.y*e.y-r.y*e.z,t.z-i.z*e.x+n.z*e.y-r.z*e.z),ji.set(s[7],t.x-i.x*e.x-n.x*e.y+r.x*e.z,t.y-i.y*e.x-n.y*e.y+r.y*e.z,t.z-i.z*e.x-n.z*e.y+r.z*e.z)}function nu(t,e){for(var i=ji.dot(e,t[0]),n=i,r=1;r<8;++r){var s=ji.dot(e,t[r]);i=s<i?s:i,n=s>n?s:n}return[i,n]}var ru,su,au,ou=function(){for(var t=new Array(15),e=0;e<15;e++)t[e]=new ji(0,0,0);for(var i=new Array(8),n=new Array(8),r=0;r<8;r++)i[r]=new ji(0,0,0),n[r]=new ji(0,0,0);var s=new ji,a=new ji;return function(e,r){ji.set(t[0],1,0,0),ji.set(t[1],0,1,0),ji.set(t[2],0,0,1),ji.set(t[3],r.orientation.m00,r.orientation.m01,r.orientation.m02),ji.set(t[4],r.orientation.m03,r.orientation.m04,r.orientation.m05),ji.set(t[5],r.orientation.m06,r.orientation.m07,r.orientation.m08);for(var o=0;o<3;++o)ji.cross(t[6+3*o],t[o],t[3]),ji.cross(t[7+3*o],t[o],t[4]),ji.cross(t[7+3*o],t[o],t[5]);ji.subtract(s,e.center,e.halfExtents),ji.add(a,e.center,e.halfExtents),function(t,e,i){ji.set(i[0],t.x,e.y,e.z),ji.set(i[1],t.x,e.y,t.z),ji.set(i[2],t.x,t.y,e.z),ji.set(i[3],t.x,t.y,t.z),ji.set(i[4],e.x,e.y,e.z),ji.set(i[5],e.x,e.y,t.z),ji.set(i[6],e.x,t.y,e.z),ji.set(i[7],e.x,t.y,t.z)}(s,a,i),iu(r.center,r.halfExtents,t[3],t[4],t[5],n);for(var u=0;u<15;++u){var h=nu(i,t[u]),l=nu(n,t[u]);if(l[0]>h[1]||h[0]>l[1])return 0}return 1}}(),uu=function(t,e){var i=t.halfExtents.x*Math.abs(e.n.x)+t.halfExtents.y*Math.abs(e.n.y)+t.halfExtents.z*Math.abs(e.n.z),n=ji.dot(e.n,t.center);return n+i<e.d?-1:n-i>e.d?0:1},hu=function(t,e){for(var i=0;i<e.planes.length;i++)if(-1===uu(t,e.planes[i]))return 0;return 1},lu=function(){for(var t=new Array(8),e=0,i=0,n=0;n<t.length;n++)t[n]=new ji(0,0,0);return function(n,r){for(var s=0,a=!1,o=0;o<r.planes.length;o++){if(-1===(s=uu(n,r.planes[o])))return 0;1===s&&(a=!0)}if(!a)return 1;for(var u=0;u<r.vertices.length;u++)ji.subtract(t[u],r.vertices[u],n.center);e=0,i=0;for(var h=0;h<r.vertices.length;h++)t[h].x>n.halfExtents.x?e++:t[h].x<-n.halfExtents.x&&i++;if(e===r.vertices.length||i===r.vertices.length)return 0;e=0,i=0;for(var l=0;l<r.vertices.length;l++)t[l].y>n.halfExtents.y?e++:t[l].y<-n.halfExtents.y&&i++;if(e===r.vertices.length||i===r.vertices.length)return 0;e=0,i=0;for(var c=0;c<r.vertices.length;c++)t[c].z>n.halfExtents.z?e++:t[c].z<-n.halfExtents.z&&i++;return e===r.vertices.length||i===r.vertices.length?0:1}}(),cu=(ru=new ji(0,0,0),su=new Qi,function(t,e){return ji.subtract(ru,e,t.center),ji.transformMat3(ru,ru,Qi.transpose(su,t.orientation)),i=ru,n=t.halfExtents,Math.abs(i.x)<n.x&&Math.abs(i.y)<n.y&&Math.abs(i.z)<n.z;var i,n}),_u=(au=function(t,e,i,n){return Math.abs(t.x*e+t.y*i+t.z*n)},function(t,e){var i=t.halfExtents.x*au(e.n,t.orientation.m00,t.orientation.m01,t.orientation.m02)+t.halfExtents.y*au(e.n,t.orientation.m03,t.orientation.m04,t.orientation.m05)+t.halfExtents.z*au(e.n,t.orientation.m06,t.orientation.m07,t.orientation.m08),n=ji.dot(e.n,t.center);return n+i<e.d?-1:n-i>e.d?0:1}),fu=function(t,e){for(var i=0;i<e.planes.length;i++)if(-1===_u(t,e.planes[i]))return 0;return 1},du=function(){for(var t=new Array(8),e=0,i=0,n=0,r=0;r<t.length;r++)t[r]=new ji(0,0,0);var s=function(t,e,i,n){return t.x*e+t.y*i+t.z*n};return function(r,a){for(var o=0,u=!1,h=0;h<a.planes.length;h++){if(-1===(o=_u(r,a.planes[h])))return 0;1===o&&(u=!0)}if(!u)return 1;for(var l=0;l<a.vertices.length;l++)ji.subtract(t[l],a.vertices[l],r.center);i=0,n=0;for(var c=0;c<a.vertices.length;c++)(e=s(t[c],r.orientation.m00,r.orientation.m01,r.orientation.m02))>r.halfExtents.x?i++:e<-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;_++)(e=s(t[_],r.orientation.m03,r.orientation.m04,r.orientation.m05))>r.halfExtents.y?i++:e<-r.halfExtents.y&&n++;if(i===a.vertices.length||n===a.vertices.length)return 0;i=0,n=0;for(var f=0;f<a.vertices.length;f++)(e=s(t[f],r.orientation.m06,r.orientation.m07,r.orientation.m08))>r.halfExtents.z?i++:e<-r.halfExtents.z&&n++;return i===a.vertices.length||n===a.vertices.length?0:1}}(),pu=function(){for(var t=new Array(15),e=0;e<15;e++)t[e]=new ji(0,0,0);for(var i=new Array(8),n=new Array(8),r=0;r<8;r++)i[r]=new ji(0,0,0),n[r]=new ji(0,0,0);return function(e,r){ji.set(t[0],e.orientation.m00,e.orientation.m01,e.orientation.m02),ji.set(t[1],e.orientation.m03,e.orientation.m04,e.orientation.m05),ji.set(t[2],e.orientation.m06,e.orientation.m07,e.orientation.m08),ji.set(t[3],r.orientation.m00,r.orientation.m01,r.orientation.m02),ji.set(t[4],r.orientation.m03,r.orientation.m04,r.orientation.m05),ji.set(t[5],r.orientation.m06,r.orientation.m07,r.orientation.m08);for(var s=0;s<3;++s)ji.cross(t[6+3*s],t[s],t[3]),ji.cross(t[7+3*s],t[s],t[4]),ji.cross(t[8+3*s],t[s],t[5]);iu(e.center,e.halfExtents,t[0],t[1],t[2],i),iu(r.center,r.halfExtents,t[3],t[4],t[5],n);for(var a=0;a<15;++a){var o=nu(i,t[a]),u=nu(n,t[a]);if(u[0]>o[1]||o[0]>u[1])return 0}return 1}}(),mu=function(){for(var t=new To,e=new ji,i=new ji,n=new ji,r=new Array(8),s=0;s<8;s++)r[s]=new ji;for(var a=new Array(8),o=0;o<8;o++)a[o]=new ji;return function(s,o){if(0===ji.squaredDistance(o.ellipseCenter0,o.ellipseCenter1))return t.radius=o.radius,t.center.set(o.ellipseCenter0),bu.sphereOBB(t,s);e.x=s.orientation.m00,e.y=s.orientation.m01,e.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,iu(s.center,s.halfExtents,e,i,n,r);var u=a,h=ji.copy(u[0],e),l=ji.copy(u[1],i),c=ji.copy(u[2],n);ji.subtract(u[3],o.center,s.center).normalize();var _=ji.subtract(u[4],o.ellipseCenter0,o.ellipseCenter1);_.normalize(),ji.cross(u[5],h,_),ji.cross(u[6],l,_),ji.cross(u[7],c,_);for(var f=0;f<8;++f){var d=nu(r,u[f]),p=ji.dot(u[f],o.ellipseCenter0),m=ji.dot(u[f],o.ellipseCenter1),g=Math.max(p,m),v=Math.min(p,m)-o.radius,y=g+o.radius;if(v>d[1]||d[0]>y)return 0}return 1}}(),gu=function(t,e){var i=ji.dot(e.n,t.center),n=t.radius*e.n.length();return i+n<e.d?-1:i-n>e.d?0:1},vu=function(t,e){for(var i=0;i<e.planes.length;i++)if(-1===gu(t,e.planes[i]))return 0;return 1},yu=function(){var t=new ji(0,0,0),e=[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,l=ji.dot(u,o);if(l+a<h)return 0;if(!(l-a>h)){ji.add(t,o,ji.multiplyScalar(t,u,a));for(var c=0;c<6;c++)if(c!==r&&c!==r+e[r]){var _=n.planes[c];if(ji.dot(_.n,t)<_.d)return 0}}}return 1}}(),Eu=function(t,e){var i=t.radius+e.radius;return ji.squaredDistance(t.center,e.center)<i*i},Tu=function(){var t=new ji;return function(e,i){return uo(t,e.center,i),ji.squaredDistance(e.center,t)<e.radius*e.radius}}(),Su=function(){var t=new ji;return function(e,i){return ho(t,e.center,i),ji.squaredDistance(e.center,t)<e.radius*e.radius}}(),Au=function(){var t=new ji,e=new ji;return function(i,n){var r=i.radius+n.radius,s=r*r,a=ji.squaredDistance(n.ellipseCenter0,n.ellipseCenter1);if(0===a)return ji.squaredDistance(i.center,n.center)<s;ji.subtract(t,i.center,n.ellipseCenter0),ji.subtract(e,n.ellipseCenter1,n.ellipseCenter0);var o=ji.dot(t,e)/a;return o<0?ji.squaredDistance(i.center,n.ellipseCenter0)<s:o>1?ji.squaredDistance(i.center,n.ellipseCenter1)<s:(ji.scaleAndAdd(t,n.ellipseCenter0,e,o),ji.squaredDistance(i.center,t)<s)}}(),Ru=function(){var t=new ji,e=new ji,i=new ji,n=new ji,r=new ji,s=new ji;return function(a,o){var u,h,l=ji.subtract(t,a.ellipseCenter1,a.ellipseCenter0),c=ji.subtract(e,o.ellipseCenter1,o.ellipseCenter0),_=ji.subtract(i,a.ellipseCenter0,o.ellipseCenter0),f=ji.dot(l,l),d=ji.dot(l,c),p=ji.dot(c,c),m=ji.dot(l,_),g=ji.dot(c,_),v=f*p-d*d,y=v,E=v;v<pi?(u=0,y=1,h=g,E=p):(h=f*g-d*m,(u=d*g-p*m)<0?(u=0,h=g,E=p):u>y&&(u=y,h=g+d,E=p)),h<0?(h=0,-m<0?u=0:-m>f?u=y:(u=-m,y=f)):h>E&&(h=E,-m+d<0?u=0:-m+d>f?u=y:(u=-m+d,y=f));var T=Math.abs(u)<pi?0:u/y,S=Math.abs(h)<pi?0:h/E,A=n;A.set(_),A.add(ji.multiplyScalar(r,l,T)),A.subtract(ji.multiplyScalar(s,c,S));var R=a.radius+o.radius;return A.lengthSqr()<R*R}}(),bu={raySphere:Bo,rayAABB:No,rayOBB:ko,rayPlane:Po,rayTriangle:Do,rayCapsule:zo,raySubMesh:Ho,rayMesh:Vo,rayModel:Wo,lineSphere:Qo,lineAABB:Ko,lineOBB:qo,linePlane:Xo,lineTriangle:jo,sphereWithSphere:Eu,sphereAABB:Tu,sphereOBB:Su,spherePlane:gu,sphereFrustum:vu,sphereFrustumAccurate:yu,sphereCapsule:Au,aabbWithAABB:eu,aabbWithOBB:ou,aabbPlane:uu,aabbFrustum:hu,aabbFrustumAccurate:lu,obbWithOBB:pu,obbPlane:_u,obbFrustum:fu,obbFrustumAccurate:du,obbPoint:cu,obbCapsule:mu,aabbFrustumCompletelyInside:function(t,e){for(var i=0;i<e.planes.length;i++)if(0!==uu(t,e.planes[i]))return 0;return 1},capsuleWithCapsule:Ru,resolve:function(t,e,i){void 0===i&&(i=null);var n=t._type,r=e._type,s=this[n|r];return n<r?s(t,e,i):s(e,t,i)}};bu[co.SHAPE_RAY|co.SHAPE_SPHERE]=Bo,bu[co.SHAPE_RAY|co.SHAPE_AABB]=No,bu[co.SHAPE_RAY|co.SHAPE_OBB]=ko,bu[co.SHAPE_RAY|co.SHAPE_PLANE]=Po,bu[co.SHAPE_RAY|co.SHAPE_TRIANGLE]=Do,bu[co.SHAPE_RAY|co.SHAPE_CAPSULE]=zo,bu[co.SHAPE_LINE|co.SHAPE_SPHERE]=Qo,bu[co.SHAPE_LINE|co.SHAPE_AABB]=Ko,bu[co.SHAPE_LINE|co.SHAPE_OBB]=qo,bu[co.SHAPE_LINE|co.SHAPE_PLANE]=Xo,bu[co.SHAPE_LINE|co.SHAPE_TRIANGLE]=jo,bu[co.SHAPE_SPHERE]=Eu,bu[co.SHAPE_SPHERE|co.SHAPE_AABB]=Tu,bu[co.SHAPE_SPHERE|co.SHAPE_OBB]=Su,bu[co.SHAPE_SPHERE|co.SHAPE_PLANE]=gu,bu[co.SHAPE_SPHERE|co.SHAPE_FRUSTUM]=vu,bu[co.SHAPE_SPHERE|co.SHAPE_FRUSTUM_ACCURATE]=yu,bu[co.SHAPE_SPHERE|co.SHAPE_CAPSULE]=Au,bu[co.SHAPE_AABB]=eu,bu[co.SHAPE_AABB|co.SHAPE_OBB]=ou,bu[co.SHAPE_AABB|co.SHAPE_PLANE]=uu,bu[co.SHAPE_AABB|co.SHAPE_FRUSTUM]=hu,bu[co.SHAPE_AABB|co.SHAPE_FRUSTUM_ACCURATE]=lu,bu[co.SHAPE_OBB]=pu,bu[co.SHAPE_OBB|co.SHAPE_PLANE]=_u,bu[co.SHAPE_OBB|co.SHAPE_FRUSTUM]=fu,bu[co.SHAPE_OBB|co.SHAPE_FRUSTUM_ACCURATE]=du,bu[co.SHAPE_OBB|co.SHAPE_CAPSULE]=mu,bu[co.SHAPE_CAPSULE]=Ru,et(_o.prototype,"line",[{name:"mag",newName:"len"},{name:"magnitude",newName:"len"}]),it(bu,"intersect",[{name:"line_quad"}]);var Cu=new ji(0,0,0),wu=new ji(0,0,0),Iu=b.mat4(),Ou=b.v4(),xu=function(){function t(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=1),void 0===i&&(i=0),void 0===n&&(n=0),this.n=void 0,this.d=void 0,this._type=void 0,this._type=co.SHAPE_PLANE,this.n=new ji(t,e,i),this.d=n}return t.create=function(e,i,n,r){return new t(e,i,n,r)},t.clone=function(e){return new t(e.n.x,e.n.y,e.n.z,e.d)},t.copy=function(t,e){return ji.copy(t.n,e.n),t.d=e.d,t},t.fromPoints=function(t,e,i,n){return ji.subtract(Cu,i,e),ji.subtract(wu,n,e),ji.normalize(t.n,ji.cross(t.n,Cu,wu)),t.d=ji.dot(t.n,e),t},t.set=function(t,e,i,n,r){return t.n.x=e,t.n.y=i,t.n.z=n,t.d=r,t},t.fromNormalAndPoint=function(t,e,i){return ji.copy(t.n,e),t.d=ji.dot(e,i),t},t.normalize=function(t,e){var i=e.n.length();return ji.normalize(t.n,e.n),i>0&&(t.d=e.d/i),t},t.prototype.transform=function(t){un.invert(Iu,t),un.transpose(Iu,Iu),Li.set(Ou,this.n.x,this.n.y,this.n.z,this.d),Li.transformMat4(Ou,Ou,Iu),ji.set(this.n,Ou.x,Ou.y,Ou.z),this.d=Ou.w},h(t,[{key:"type",get:function(){return this._type}},{key:"x",get:function(){return this.n.x},set:function(t){this.n.x=t}},{key:"y",get:function(){return this.n.y},set:function(t){this.n.y=t}},{key:"z",get:function(){return this.n.z},set:function(t){this.n.z=t}},{key:"w",get:function(){return this.d},set:function(t){this.d=t}}]),t}(),Pu=new ji,Du=new ji,Bu=new ji,Nu=new ji,Mu=new Qi,Lu=function(t,e,i){Mu.m00=Math.abs(i.m00),Mu.m01=Math.abs(i.m01),Mu.m02=Math.abs(i.m02),Mu.m03=Math.abs(i.m04),Mu.m04=Math.abs(i.m05),Mu.m05=Math.abs(i.m06),Mu.m06=Math.abs(i.m08),Mu.m07=Math.abs(i.m09),Mu.m08=Math.abs(i.m10),ji.transformMat3(t,e,Mu)},Fu=function(){function t(t,e,i,n,r,s){void 0===t&&(t=0),void 0===e&&(e=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=co.SHAPE_AABB,this.center=new ji(t,e,i),this.halfExtents=new ji(n,r,s)}t.create=function(e,i,n,r,s,a){return new t(e,i,n,r,s,a)},t.clone=function(e){return new t(e.center.x,e.center.y,e.center.z,e.halfExtents.x,e.halfExtents.y,e.halfExtents.z)},t.copy=function(t,e){return ji.copy(t.center,e.center),ji.copy(t.halfExtents,e.halfExtents),t},t.fromPoints=function(t,e,i){return ji.add(Pu,i,e),ji.subtract(Du,i,e),ji.multiplyScalar(t.center,Pu,.5),ji.multiplyScalar(t.halfExtents,Du,.5),t},t.set=function(t,e,i,n,r,s,a){return t.center.set(e,i,n),t.halfExtents.set(r,s,a),t},t.merge=function(e,i,n){return ji.subtract(Pu,i.center,i.halfExtents),ji.subtract(Du,n.center,n.halfExtents),ji.add(Bu,i.center,i.halfExtents),ji.add(Nu,n.center,n.halfExtents),ji.max(Nu,Bu,Nu),ji.min(Bu,Pu,Du),t.fromPoints(e,Bu,Nu)},t.toBoundingSphere=function(t,e){return t.center.set(e.center),t.radius=e.halfExtents.length(),t},t.transform=function(t,e,i){return ji.transformMat4(t.center,e.center,i),Lu(t.halfExtents,e.halfExtents,i),t};var e=t.prototype;return e.getBoundary=function(t,e){ji.subtract(t,this.center,this.halfExtents),ji.add(e,this.center,this.halfExtents)},e.transform=function(t,e,i,n,r){ji.transformMat4(r.center,this.center,t),Lu(r.halfExtents,this.halfExtents,t)},e.clone=function(){return t.clone(this)},e.copy=function(e){return t.copy(this,e)},e.mergePoint=function(t){this.getBoundary(Pu,Du),t.x<Pu.x&&(Pu.x=t.x),t.y<Pu.y&&(Pu.y=t.y),t.z<Pu.z&&(Pu.z=t.z),t.x>Du.x&&(Du.x=t.x),t.y>Du.y&&(Du.y=t.y),t.z>Du.z&&(Du.z=t.z),ji.add(Bu,Pu,Du),this.center.set(ji.multiplyScalar(Bu,Bu,.5)),this.halfExtents.set(Du.x-Bu.x,Du.y-Bu.y,Du.z-Bu.z)},e.mergePoints=function(t){if(!(t.length<1))for(var e=0;e<t.length;e++)this.mergePoint(t[e])},e.mergeFrustum=function(t){return this.mergePoints(t.vertices)},h(t,[{key:"type",get:function(){return this._type}}]),t}(),Uu=new ji,Gu=new ji,ku=new Qi,zu=function(){function t(t,e,i,n,r,s,a,o,u,h,l,c,_,f,d){void 0===t&&(t=0),void 0===e&&(e=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===l&&(l=1),void 0===c&&(c=0),void 0===_&&(_=0),void 0===f&&(f=0),void 0===d&&(d=1),this.center=void 0,this.halfExtents=void 0,this.orientation=void 0,this._type=void 0,this._type=co.SHAPE_OBB,this.center=new ji(t,e,i),this.halfExtents=new ji(n,r,s),this.orientation=new Qi(a,o,u,h,l,c,_,f,d)}t.create=function(e,i,n,r,s,a,o,u,h,l,c,_,f,d,p){return new t(e,i,n,r,s,a,o,u,h,l,c,_,f,d,p)},t.clone=function(e){return new t(e.center.x,e.center.y,e.center.z,e.halfExtents.x,e.halfExtents.y,e.halfExtents.z,e.orientation.m00,e.orientation.m01,e.orientation.m02,e.orientation.m03,e.orientation.m04,e.orientation.m05,e.orientation.m06,e.orientation.m07,e.orientation.m08)},t.copy=function(t,e){return ji.copy(t.center,e.center),ji.copy(t.halfExtents,e.halfExtents),Qi.copy(t.orientation,e.orientation),t},t.fromPoints=function(t,e,i){return ji.multiplyScalar(t.center,ji.add(Uu,e,i),.5),ji.multiplyScalar(t.halfExtents,ji.subtract(Gu,i,e),.5),Qi.identity(t.orientation),t},t.set=function(t,e,i,n,r,s,a,o,u,h,l,c,_,f,d,p){return ji.set(t.center,e,i,n),ji.set(t.halfExtents,r,s,a),Qi.set(t.orientation,o,u,h,l,c,_,f,d,p),t};var e=t.prototype;return e.getBoundary=function(t,e){!function(t,e,i){ku.m00=Math.abs(i.m00),ku.m01=Math.abs(i.m01),ku.m02=Math.abs(i.m02),ku.m03=Math.abs(i.m03),ku.m04=Math.abs(i.m04),ku.m05=Math.abs(i.m05),ku.m06=Math.abs(i.m06),ku.m07=Math.abs(i.m07),ku.m08=Math.abs(i.m08),ji.transformMat3(t,e,ku)}(Uu,this.halfExtents,this.orientation),ji.subtract(t,this.center,Uu),ji.add(e,this.center,Uu)},e.transform=function(t,e,i,n,r){ji.transformMat4(r.center,this.center,t),Qi.fromQuat(r.orientation,i),ji.multiply(r.halfExtents,this.halfExtents,n)},e.translateAndRotate=function(t,e,i){ji.transformMat4(i.center,this.center,t),Qi.fromQuat(i.orientation,e)},e.setScale=function(t,e){ji.multiply(e.halfExtents,this.halfExtents,t)},h(t,[{key:"type",get:function(){return this._type}}]),t}(),Hu=function(){function t(t,e,i){void 0===t&&(t=.5),void 0===e&&(e=.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=co.SHAPE_CAPSULE,this.radius=t,this.halfHeight=e,this.axis=i,this.center=new ji,this.rotation=new $i,this.ellipseCenter0=new ji(0,e,0),this.ellipseCenter1=new ji(0,-e,0),this.updateCache()}var e=t.prototype;return e.transform=function(t,e,i,n,r){var s=n,a=Bi(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,ji.transformMat4(r.center,this.center,t),$i.multiply(r.rotation,this.rotation,i),r.updateCache()},e.updateCache=function(){this.updateLocalCenter(),ji.transformQuat(this.ellipseCenter0,this.ellipseCenter0,this.rotation),ji.transformQuat(this.ellipseCenter1,this.ellipseCenter1,this.rotation),this.ellipseCenter0.add(this.center),this.ellipseCenter1.add(this.center)},e.updateLocalCenter=function(){var t=this.halfHeight;switch(this.axis){case 0:this.ellipseCenter0.set(t,0,0),this.ellipseCenter1.set(-t,0,0);break;case 1:this.ellipseCenter0.set(0,t,0),this.ellipseCenter1.set(0,-t,0);break;case 2:this.ellipseCenter0.set(0,0,t),this.ellipseCenter1.set(0,0,-t)}},h(t,[{key:"type",get:function(){return this._type}}]),t}(),Vu=new Array(8);Vu[0]=new ji(1,1,1),Vu[1]=new ji(-1,1,1),Vu[2]=new ji(-1,-1,1),Vu[3]=new ji(1,-1,1),Vu[4]=new ji(1,1,-1),Vu[5]=new ji(-1,1,-1),Vu[6]=new ji(-1,-1,-1),Vu[7]=new ji(1,-1,-1);var Wu,Xu,ju=new ji,Yu=new ji,Ku=new ji,qu=function(){function t(){this.planes=void 0,this.vertices=void 0,this._type=void 0,this._type=co.SHAPE_FRUSTUM,this.planes=new Array(6);for(var t=0;t<6;++t)this.planes[t]=xu.create(0,0,0,0);this.vertices=new Array(8);for(var e=0;e<8;++e)this.vertices[e]=new ji}t.createFromAABB=function(t,e){var i=new ji,n=new ji;return ji.subtract(i,e.center,e.halfExtents),ji.add(n,e.center,e.halfExtents),t.vertices[0].set(i.x,n.y,i.z),t.vertices[1].set(n.x,n.y,i.z),t.vertices[2].set(n.x,i.y,i.z),t.vertices[3].set(i.x,i.y,i.z),t.vertices[4].set(i.x,n.y,n.z),t.vertices[5].set(n.x,n.y,n.z),t.vertices[6].set(n.x,i.y,n.z),t.vertices[7].set(i.x,i.y,n.z),t._type!==co.SHAPE_FRUSTUM_ACCURATE||t.updatePlanes(),t},t.split=function(t,e,i,n,r){var s=Math.tan(.5*e.fov),a=s*e.aspect;ju.set(n*a,n*s,n),Yu.set(r*a,r*s,r);var o=t.vertices;return Ku.set(ju.x,ju.y,ju.z),ji.transformMat4(o[0],Ku,i),Ku.set(-ju.x,ju.y,ju.z),ji.transformMat4(o[1],Ku,i),Ku.set(-ju.x,-ju.y,ju.z),ji.transformMat4(o[2],Ku,i),Ku.set(ju.x,-ju.y,ju.z),ji.transformMat4(o[3],Ku,i),Ku.set(Yu.x,Yu.y,Yu.z),ji.transformMat4(o[4],Ku,i),Ku.set(-Yu.x,Yu.y,Yu.z),ji.transformMat4(o[5],Ku,i),Ku.set(-Yu.x,-Yu.y,Yu.z),ji.transformMat4(o[6],Ku,i),Ku.set(Yu.x,-Yu.y,Yu.z),ji.transformMat4(o[7],Ku,i),t.updatePlanes(),t},t.create=function(){return new t},t.clone=function(e){return t.copy(new t,e)},t.copy=function(t,e){t._type=e.type;for(var i=0;i<6;++i)xu.copy(t.planes[i],e.planes[i]);for(var n=0;n<8;++n)ji.copy(t.vertices[n],e.vertices[n]);return t};var e=t.prototype;return e.update=function(t,e){if(ji.set(this.planes[0].n,t.m03+t.m00,t.m07+t.m04,t.m11+t.m08),this.planes[0].d=-(t.m15+t.m12),ji.set(this.planes[1].n,t.m03-t.m00,t.m07-t.m04,t.m11-t.m08),this.planes[1].d=-(t.m15-t.m12),ji.set(this.planes[2].n,t.m03+t.m01,t.m07+t.m05,t.m11+t.m09),this.planes[2].d=-(t.m15+t.m13),ji.set(this.planes[3].n,t.m03-t.m01,t.m07-t.m05,t.m11-t.m09),this.planes[3].d=-(t.m15-t.m13),ji.set(this.planes[4].n,t.m03+t.m02,t.m07+t.m06,t.m11+t.m10),this.planes[4].d=-(t.m15+t.m14),ji.set(this.planes[5].n,t.m03-t.m02,t.m07-t.m06,t.m11-t.m10),this.planes[5].d=-(t.m15-t.m14),this._type===co.SHAPE_FRUSTUM_ACCURATE){for(var i=0;i<6;i++){var n=this.planes[i],r=1/n.n.length();ji.multiplyScalar(n.n,n.n,r),n.d*=r}for(var s=0;s<8;s++)ji.transformMat4(this.vertices[s],Vu[s],e)}},e.transform=function(t){if(this._type===co.SHAPE_FRUSTUM_ACCURATE){for(var e=0;e<8;e++)ji.transformMat4(this.vertices[e],this.vertices[e],t);this.updatePlanes()}},e.zero=function(){for(var t=0;t<8;t++)this.vertices[t].set(0,0,0);this.updatePlanes()},e.updatePlanes=function(){xu.fromPoints(this.planes[0],this.vertices[1],this.vertices[6],this.vertices[5]),xu.fromPoints(this.planes[1],this.vertices[3],this.vertices[4],this.vertices[7]),xu.fromPoints(this.planes[2],this.vertices[6],this.vertices[3],this.vertices[7]),xu.fromPoints(this.planes[3],this.vertices[0],this.vertices[5],this.vertices[4]),xu.fromPoints(this.planes[4],this.vertices[2],this.vertices[0],this.vertices[3]),xu.fromPoints(this.planes[5],this.vertices[7],this.vertices[5],this.vertices[6])},h(t,[{key:"accurate",set:function(t){this._type=t?co.SHAPE_FRUSTUM_ACCURATE:co.SHAPE_FRUSTUM}},{key:"type",get:function(){return this._type}}]),t}();qu.createOrtho=function(t,e,i,n,r,s){var a=e/2,o=i/2;ji.set(Ku,a,o,-n),ji.transformMat4(t.vertices[0],Ku,s),ji.set(Ku,-a,o,-n),ji.transformMat4(t.vertices[1],Ku,s),ji.set(Ku,-a,-o,-n),ji.transformMat4(t.vertices[2],Ku,s),ji.set(Ku,a,-o,-n),ji.transformMat4(t.vertices[3],Ku,s),ji.set(Ku,a,o,-r),ji.transformMat4(t.vertices[4],Ku,s),ji.set(Ku,-a,o,-r),ji.transformMat4(t.vertices[5],Ku,s),ji.set(Ku,-a,-o,-r),ji.transformMat4(t.vertices[6],Ku,s),ji.set(Ku,a,-o,-r),ji.transformMat4(t.vertices[7],Ku,s),xu.fromPoints(t.planes[0],t.vertices[1],t.vertices[6],t.vertices[5]),xu.fromPoints(t.planes[1],t.vertices[3],t.vertices[4],t.vertices[7]),xu.fromPoints(t.planes[2],t.vertices[6],t.vertices[3],t.vertices[7]),xu.fromPoints(t.planes[3],t.vertices[0],t.vertices[5],t.vertices[4]),xu.fromPoints(t.planes[4],t.vertices[2],t.vertices[0],t.vertices[3]),xu.fromPoints(t.planes[5],t.vertices[7],t.vertices[5],t.vertices[6])},function(t){t[t.Default=0]="Default",t[t.Normal=1]="Normal",t[t.Loop=2]="Loop",t[t.ShouldWrap=4]="ShouldWrap",t[t.Clamp=8]="Clamp",t[t.PingPong=22]="PingPong",t[t.Reverse=36]="Reverse"}(Wu||(Wu={})),function(t){t[t.Default=Wu.Default]="Default",t[t.Normal=Wu.Normal]="Normal",t[t.Reverse=Wu.Reverse]="Reverse",t[t.Loop=Wu.Loop]="Loop",t[t.LoopReverse=Wu.Loop|Wu.Reverse]="LoopReverse",t[t.PingPong=Wu.PingPong]="PingPong",t[t.PingPongReverse=Wu.PingPong|Wu.Reverse]="PingPongReverse"}(Xu||(Xu={})),pe(Xu);var Qu,Zu=function(){function t(t){this.ratio=0,this.time=0,this.direction=1,this.stopped=!0,this.iterations=0,this.frameIndex=void 0,t&&this.set(t)}return t.prototype.set=function(t){this.ratio=t.ratio,this.time=t.time,this.direction=t.direction,this.stopped=t.stopped,this.iterations=t.iterations,this.frameIndex=t.frameIndex},t}();function Ju(t,e,i){void 0===i&&(i=1e-6);for(var n=0,r=t.length-1,s=r>>>1;n<=r;s=n+r>>>1){var a=t[s];if(a>e+i)r=s-1;else{if(!(a<e-i))return s;n=s+1}}return~n}Qu=Symbol.iterator;var $u,th,eh,ih=function(){function t(){this._times=[],this._values=[]}var e=t.prototype;return e[Qu]=function(){var t=this,e=0;return{next:function(){if(e>=t._times.length)return{done:!0,value:void 0};var i=[t._times[e],t._values[e]];return++e,{done:!1,value:i}}}},e.keyframes=function(){return this},e.times=function(){return this._times},e.values=function(){return this._values},e.getKeyframeTime=function(t){return this._times[t]},e.getKeyframeValue=function(t){return this._values[t]},e.addKeyFrame=function(t,e){return this._insertNewKeyframe(t,e)},e.removeKeyframe=function(t){this._times.splice(t,1),this._values.splice(t,1)},e.indexOfKeyframe=function(t){return Ju(this._times,t)},e.updateTime=function(t,e){var i=this._values[t];this.removeKeyframe(t),this._insertNewKeyframe(e,i)},e.assignSorted=function(t,e){if(void 0!==e)this.setKeyframes(t.slice(),e.slice());else{var i=Array.from(t);this.setKeyframes(i.map((function(t){return t[0]})),i.map((function(t){return t[1]})))}},e.clear=function(){this._times.length=0,this._values.length=0},e.searchKeyframe=function(t){return Ju(this._times,t)},e.setKeyframes=function(t,e){t.length,e.length,function(t){t.every((function(t,e,i){return 0===e||t>i[e-1]||gi(t,i[e-1],1e-6)}))}(t),this._times=t,this._values=e},e._insertNewKeyframe=function(t,e){var i=this._times,n=this._values,r=i.length,s=Ju(i,t);if(s>=0)return s;var a=~s;return 0===a?(i.unshift(t),n.unshift(e)):a===r?(i.push(t),n.push(e)):(i.splice(a-1,0,t),n.splice(a-1,0,e)),a},h(t,[{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]}}]),t}();function nh(t){return t>-1e-9&&t<1e-9}hi.fastDefine("cc.KeyframeCurve",ih,{_times:[],_values:[]}),function(t){t[t.LINEAR=0]="LINEAR",t[t.CONSTANT=1]="CONSTANT",t[t.CUBIC=2]="CUBIC"}($u||($u=t("RealInterpolationMode",{}))),function(t){t[t.LINEAR=0]="LINEAR",t[t.CLAMP=1]="CLAMP",t[t.LOOP=2]="LOOP",t[t.PING_PONG=3]="PING_PONG"}(th||(th=t("ExtrapolationMode",{}))),function(t){t[t.NONE=0]="NONE",t[t.LEFT=1]="LEFT",t[t.RIGHT=2]="RIGHT",t[t.BOTH=3]="BOTH"}(eh||(eh=t("TangentWeightMode",{})));var rh=function(){},sh=function(){return rh},ah=oh((function(){}));function oh(t){return function(e){return"function"==typeof e?t(e):function(i){return t(i,e)}}}function uh(t){return function(e){return function(i){!function(t,e,i){var n=lh(t);if(n){var r=ch(n,"proto");ch(r,"editor")[e]=i}}(i,t,e)}}}var hh="__ccclassCache__";function lh(t){return ch(t,hh)}function ch(t,e){return t[e]||(t[e]={})}var _h=oh((function(t,e){var i=le.getSuper(t);i===Object&&(i=null);var n={name:e,extends:i,ctor:t},r=t[hh];if(r){var s=r.proto;s&&le.mixin(n,s),t[hh]=void 0}return hi(n)})),fh=uh("requireComponent"),dh=uh("executionOrder"),ph=ah;function mh(t,e,i){var n=null;function r(t,e,i){!function(t,e,i,n,r,s){var a,o=s&&(s.get||s.set);r&&(a=Je(r,o));var u=le.mixin(e,a||r||{});o?(s.get&&(u.get=s.get),s.set&&(u.set=s.set)):vh(t,u,i,n,s)}(function(t){return lh(t.constructor)}(t),function(t,e){var i,n,r=ch(lh(t.constructor),"proto"),s=ch(r,"properties");return null!==(n=s[i=e])&&void 0!==n?n:s[i]={}}(t,e),t.constructor,e,n,i)}return void 0===t?mh({type:void 0}):void 0===e?(n=t,r):void r(t,e,i)}function gh(t,e,i){var n,r,s=lh(t.constructor),a=ch(s,"proto"),o=ch(a,"properties"),u=null!==(r=o[n=e])&&void 0!==r?r:o[n]={};return u.__internalFlags|=$e.STANDALONE,i&&(i.get||i.set)?(i.get&&(u.get=i.get),i.set&&(u.set=i.set)):vh(s,u,t.constructor,e,i),u}function vh(t,e,i,n,r){if(r)r.initializer&&(e.default=function(t){var e;try{e=t()}catch(e){return t}return"object"!=typeof e||null===e?e:t}(r.initializer));else{var s=t.default||(t.default=function(t){var e;try{e=new t}catch(t){return{}}return e}(i));s.hasOwnProperty(n)&&(e.default=s[n])}}var yh=Symbol("cc:SerializationMetadata"),Eh=function(t,e,i){Ah(gh(t,e,i))};function Th(t){return function(e,i,n){var r=gh(e,i,n);r.formerlySerializedAs=t,Ah(r)}}var Sh=function(t,e,i){var n=gh(t,e,i);n.editorOnly=!0,Ah(n)};function Ah(t){t.__internalFlags|=$e.IMPLICIT_SERIALIZABLE}var Rh=rh,bh=ah,Ch=sh,wh=ah,Ih=sh,Oh=sh,xh=sh,Ph=rh,Dh=sh,Bh=rh,Nh=sh,Mh=sh,Lh=sh,Fh=sh,Uh=sh,Gh=sh,kh=rh,zh=sh,Hh=rh,Vh=rh,Wh=Kh(He),Xh=Kh(Ve),jh=Kh(We),Yh=Kh(Xe);function Kh(t){return mh({type:t})}var qh=function(t,e,i){gh(t,e,i).override=!0},Qh=function(){},Zh=Object.freeze({__proto__:null,uniquelyReferenced:Rh,ccclass:_h,property:mh,requireComponent:fh,executionOrder:dh,disallowMultiple:ph,allowReplicated:function(t){hi.Attr.setClassAttr(t,"replicated","visible",!0)},executeInEditMode:bh,menu:Ch,playOnFocus:wh,inspector:Ih,icon:Oh,help:xh,type:Kh,integer:Wh,float:Xh,boolean:jh,string:Yh});t("_decorator",Zh);var Jh=function(){function t(t){this._map=null,this._count=0,t?(this._map=t,this._count=Object.keys(t).length):(this._map=le.createMap(!0),this._count=0)}var e=t.prototype;return e.add=function(t,e){return t in this._map||this._count++,this._map[t]=e},e.get=function(t){return this._map[t]},e.has=function(t){return t in this._map},e.remove=function(t){var e=this._map[t];return t in this._map&&(delete this._map[t],this._count--),e},e.clear=function(){0!==this._count&&(this._map=le.createMap(!0),this._count=0)},e.forEach=function(t){for(var e in this._map)t(this._map[e],e)},e.find=function(t){for(var e in this._map)if(t(this._map[e],e))return this._map[e];return null},e.destroy=function(){this._map=null},h(t,[{key:"count",get:function(){return this._count}}]),t}(),$h=function(){function t(e,i){this.id=t._pipelineId++,this.name="",this.pipes=[],this.name=e;for(var n=0,r=i.length;n<r;n++)this.pipes.push(i[n])}var e=t.prototype;return e.insert=function(t,e){return e>this.pipes.length?(j(4921),this):(this.pipes.splice(e,0,t),this)},e.append=function(t){return this.pipes.push(t),this},e.remove=function(t){return this.pipes.splice(t,1),this},e.sync=function(t){var e=this.pipes;if(0===e.length)return null;t.isFinish=!1;for(var i=0,n=e.length;i<n;){var r=(0,e[i])(t);if(r)return t.isFinish=!0,r;++i!==n&&(t.input=t.output,t.output=null)}return t.isFinish=!0,t.output},e.async=function(t){0!==this.pipes.length&&(t.isFinish=!1,this._flow(0,t))},e._flow=function(t,e){var i=this;(0,this.pipes[t])(e,(function(n){n?(e.isFinish=!0,e.dispatch("complete",n)):++t<i.pipes.length?(e.input=e.output,e.output=null,i._flow(t,e)):(e.isFinish=!0,e.dispatch("complete",n,e.output))}))},t}();$h._pipelineId=0,function(){function t(t){if(this._weakMap={},void 0===window.WeakRef)throw new Error("this platform does not support WeakRef!");if(t)for(var e in t)this._weakMap[e]=new WeakRef(t[e])}var e=t.prototype;e.add=function(t,e){return this._weakMap[t]=new WeakRef(e),e},e.has=function(t){return t in this._weakMap&&!!this._weakMap[t].deref()},e.get=function(t){return this._weakMap[t]&&this._weakMap[t].deref()},e.remove=function(t){var e=this._weakMap[t];return delete this._weakMap[t],e&&e.deref()},e.clear=function(){this._weakMap=le.createMap(!0)},e.forEach=function(t){for(var e in this._weakMap){var i=this.get(e);i&&t(i,e)}},e.find=function(t){for(var e in this._weakMap){var i=this.get(e);if(i&&t(i,e))return this._weakMap[e].deref()}return null},e.destroy=function(){this._weakMap={}},h(t,[{key:"count",get:function(){return Object.values(this._weakMap).filter((function(t){return t.deref()})).length}}])}();var tl,el=new Jh,il=new Jh,nl=new Jh,rl=new Jh,sl=new $h("normal load",[]),al=new $h("fetch",[]),ol=new $h("transform url",[]),ul=new Map;!function(t){t.UUID="uuid",t.PATH="path",t.DIR="dir",t.URL="url",t.SCENE="scene"}(tl||(tl={}));var hl,ll={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(t){t.INTERNAL="internal",t.RESOURCES="resources",t.MAIN="main",t.START_SCENE="start-scene"}(hl||(hl={}));var cl=function(){function t(e){this.id=t._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.isFinish=!0,this.set(e)}t.create=function(e){var i;return 0!==t._deadPool.length?(i=t._deadPool.pop()).set(e):i=new t(e),i};var e=t.prototype;return e.set=function(t){void 0===t&&(t=Object.create(null)),this.onComplete=t.onComplete||null,this.onProgress=t.onProgress||null,this.onError=t.onError||null,this.source=this.input=t.input,this.output=null,this.progress=t.progress,this.options=t.options||Object.create(null)},e.dispatch=function(t,e,i,n,r){switch(t){case"complete":this.onComplete&&this.onComplete(e,i);break;case"progress":this.onProgress&&this.onProgress(e,i,n,r);break;case"error":this.onError&&this.onError(e,i,n,r);break;default:var s="on"+t[0].toUpperCase()+t.substr(1);"function"==typeof this[s]&&this[s](e,i,n,r)}},e.recycle=function(){t._deadPool.length!==t.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,t._deadPool.push(this))},t}();cl.MAX_DEAD_NUM=500,cl._taskId=0,cl._deadPool=[];var _l="0123456789abcdef".split(""),fl=["","","",""],dl=fl.concat(fl,"-",fl,"-",fl,"-",fl,"-",fl,fl,fl),pl=dl.map((function(t,e){return"-"===t?NaN:e})).filter(isFinite);function ml(t){var e=t.split("@")[0];if(22!==e.length)return t;dl[0]=t[0],dl[1]=t[1];for(var i=2,n=2;i<22;i+=2){var r=be[t.charCodeAt(i)],s=be[t.charCodeAt(i+1)];dl[pl[n++]]=_l[r>>2],dl[pl[n++]]=_l[(3&r)<<2|s>>4],dl[pl[n++]]=_l[15&s]}return t.replace(e,dl.join(""))}var gl=/.*[/\\][0-9a-fA-F]{2}[/\\]([0-9a-fA-F-@]{8,}).*/;function vl(t){var e=gl.exec(t);return e?e[1]:""}function yl(t,e){(e=e||Object.create(null)).__isNative__=e.isNative,e.nativeExt&&(e.ext=e.nativeExt);var i=rl.find((function(e){return!!e.getAssetInfo(t)}));return i&&(e.bundle=i.name),Sl(t,e)}function El(t){return!!t&&(t instanceof b.SceneAsset||t instanceof b.Scene)}function Tl(t){return t&&(46===t.charCodeAt(0)&&47===t.charCodeAt(1)?t=t.slice(2):47===t.charCodeAt(0)&&(t=t.slice(1))),t}function Sl(t,e){var i=cl.create({input:t,options:e}),n=[];try{for(var r,s=y(ol.sync(i));!(r=s()).done;){var a=r.value,o=a.url;a.recycle(),n.push(o)}}catch(t){for(var u,h=y(i.output);!(u=h()).done;)u.value.recycle();F(t.message,t.stack)}return i.recycle(),n.length>1?n:n[0]}var Al,Rl,bl,Cl,wl=Object.freeze({__proto__:null,getUuidFromURL:vl,getUrlWithUuid:yl,isScene:El,normalize:Tl,transform:Sl,decodeUuid:ml}),Il=/(\.[^\.\/\?\\]*)(\?.*)?$/,Ol=/((.*)(\/|\\|\\\\))?(.*?\..*$)?/,xl=/[^\.\/]+\/\.\.\//;function Pl(){for(var t="",e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];for(var r=0,s=i;r<s.length;r++){var a=s[r];t=(t+(""===t?"":"/")+a).replace(/(\/|\\\\)$/,"")}return t}function Dl(t){var e=Il.exec(t);return e?e[1]:""}function Bl(t){if(t){var e=t.lastIndexOf(".");if(-1!==e)return t.substring(0,e)}return t}function Nl(t,e){var i=t.indexOf("?");i>0&&(t=t.substring(0,i));var n=/(\/|\\)([^\/\\]+)$/g.exec(t.replace(/(\/|\\)$/,""));if(!n)return t;var r=n[2];return e&&t.substring(t.length-e.length).toLowerCase()===e.toLowerCase()?r.substring(0,r.length-e.length):r}function Ml(t){var e=Ol.exec(t);return e?e[2]:""}function Ll(t,e){e=e||"";var i=t.indexOf("?"),n="";return i>0&&(n=t.substring(i),t=t.substring(0,i)),(i=t.lastIndexOf("."))<0?t+e+n:t.substring(0,i)+e+n}function Fl(t,e,i){if(0===e.indexOf("."))return Ll(t,e);var n=t.indexOf("?"),r="",s=i?Dl(t):"";return n>0&&(r=t.substring(n),t=t.substring(0,n)),n=(n=t.lastIndexOf("/"))<=0?0:n+1,t.substring(0,n)+e+s+r}function Ul(t){var e=t=String(t);do{e=t,t=t.replace(xl,"")}while(e.length!==t.length);return t}function Gl(t){return t.replace(/[\/\\]$/,"")}function kl(){return Ha.os===Fa.WINDOWS?"\\":"/"}t("path",Object.freeze({__proto__:null,join:Pl,extname:Dl,mainFileName:Bl,basename:Nl,dirname:Ml,changeExtname:Ll,changeBasename:Fl,_normalize:Ul,stripSep:Gl,getSeperator:kl}));var zl,Hl,Vl,Wl=t("Asset",_h("cc.Asset")((Cl=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).loaded=!0,E(e,"_native",bl,g(e)),e._nativeUrl="",e._file=null,e._ref=0,Object.defineProperty(g(e),"_uuid",{value:"",writable:!0}),e}c(e,t),e.deserialize=function(t){return b.deserialize(t)};var i=e.prototype;return i.toString=function(){return this.nativeUrl},i.serialize=function(){},i._setRawAsset=function(t,e){void 0===e&&(e=!0),this._native=!1!==e?t||"":"/"+t},i.addRef=function(){return this._ref++,this},i.decRef=function(t){return void 0===t&&(t=!0),this._ref>0&&this._ref--,t&&b.assetManager._releaseManager.tryRelease(this),this},i.onLoaded=function(){},i.initDefault=function(t){t&&(this._uuid=t),this.isDefault=!0},i.validate=function(){return!0},i.destroy=function(){return G(J(12101,this._uuid)),t.prototype.destroy.call(this)},h(e,[{key:"nativeUrl",get:function(){if(!this._nativeUrl){if(!this._native)return"";var t=this._native;if(47===t.charCodeAt(0))return t.slice(1);46===t.charCodeAt(0)?this._nativeUrl=yl(this._uuid,{nativeExt:t,isNative:!0}):this._nativeUrl=yl(this._uuid,{__nativeName__:t,nativeExt:Dl(t),isNative:!0})}return this._nativeUrl}},{key:"_nativeAsset",get:function(){return this._file},set:function(t){this._file=t}},{key:"_nativeDep",get:function(){if(this._native)return{__isNative__:!0,uuid:this._uuid,ext:this._native}}},{key:"refCount",get:function(){return this._ref}}]),e}(Da(Ta)),bl=T((Rl=Cl).prototype,"_native",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),T(Rl.prototype,"_nativeAsset",[mh],Object.getOwnPropertyDescriptor(Rl.prototype,"_nativeAsset"),Rl.prototype),Al=Rl))||Al);Wl.prototype.createNode=null,b.Asset=Wl;var Xl=t("Script",_h("cc.Script")(zl=function(t){function e(){return t.apply(this,arguments)||this}return c(e,t),e}(Wl))||zl);b._Script=Xl;var jl=t("JavaScript",_h("cc.JavaScript")(Hl=function(t){function e(){return t.apply(this,arguments)||this}return c(e,t),e}(Xl))||Hl);b._JavaScript=jl;var Yl,Kl,ql,Ql,Zl,Jl,$l,tc,ec,ic,nc,rc,sc,ac=t("TypeScript",_h("cc.TypeScript")(Vl=function(t){function e(){return t.apply(this,arguments)||this}return c(e,t),e}(Xl))||Vl);b._TypeScript=ac;var oc,uc,hc,lc,cc,_c,fc,dc,pc,mc,gc,vc,yc,Ec,Tc,Sc=t("EventHandler",(Yl=_h("cc.ClickEvent"),Kl=Mh(),ql=Mh(),Ql=Mh(),Zl=Mh(),Yl((sc=function(){function t(){E(this,"target",tc,this),E(this,"component",ec,this),E(this,"_componentId",ic,this),E(this,"handler",nc,this),E(this,"customEventData",rc,this)}t.emitEvents=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];for(var s=0,a=e.length;s<a;s++){var o=e[s];o instanceof t&&o.emit(n)}};var e=t.prototype;return e.emit=function(t){var e=this.target;if(b.isValid(e)){this._genCompIdIfNeeded();var i=b.js.getClassById(this._componentId),n=e.getComponent(i);if(b.isValid(n)){var r=n[this.handler];"function"==typeof r&&(null!=this.customEventData&&""!==this.customEventData&&(t=t.slice()).push(this.customEventData),r.apply(n,t))}}},e._compName2Id=function(t){var e=b.js.getClassByName(t);return b.js.getClassId(e)},e._compId2Name=function(t){var e=b.js.getClassById(t);return b.js.getClassName(e)},e._genCompIdIfNeeded=function(){this._componentId||(this._componentName=this.component,this.component="")},h(t,[{key:"_componentName",get:function(){return this._genCompIdIfNeeded(),this._compId2Name(this._componentId)},set:function(t){this._componentId=this._compName2Id(t)}}]),t}(),tc=T(($l=sc).prototype,"target",[Eh,Kl],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),ec=T($l.prototype,"component",[Eh,Ph,ql],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),ic=T($l.prototype,"_componentId",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),nc=T($l.prototype,"handler",[Eh,Ph,Ql],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),rc=T($l.prototype,"customEventData",[Eh,Ph,Zl],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),Jl=$l))||Jl)),Ac=new Tt("Comp"),Rc=Ta.Flags.IsOnLoadCalled,bc=t("Component",(oc=_h("cc.Component"),uc=Nh(),hc=Kh(Xl),lc=Mh(),oc((gc=mc=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return E(e=t.call.apply(t,[this].concat(n))||this,"node",fc,g(e)),E(e,"_enabled",dc,g(e)),E(e,"__prefab",pc,g(e)),e._sceneGetter=null,e._id=Ac.getNewId(),e}c(e,t);var i=e.prototype;return i._getRenderScene=function(){return this._sceneGetter?this._sceneGetter():this.node.scene.renderScene},i.addComponent=function(t){return this.node.addComponent(t)},i.getComponent=function(t){return this.node.getComponent(t)},i.getComponents=function(t){return this.node.getComponents(t)},i.getComponentInChildren=function(t){return this.node.getComponentInChildren(t)},i.getComponentsInChildren=function(t){return this.node.getComponentsInChildren(t)},i.destroy=function(){return!!t.prototype.destroy.call(this)&&(this._enabled&&this.node.activeInHierarchy&&b.director._compScheduler.disableComp(this),!0)},i._onPreDestroy=function(){this.unscheduleAllCallbacks(),b.director._nodeActivator.destroyComp(this),this.node._removeComponent(this)},i._instantiate=function(t){return t||(t=b.instantiate._clone(this,this)),t&&(t.node=null),t},i.schedule=function(t,e,i,n){void 0===e&&(e=0),void 0===i&&(i=b.macro.REPEAT_FOREVER),void 0===n&&(n=0),Z(t,1619),Z((e=e||0)>=0,1620),i=Number.isNaN(i)?b.macro.REPEAT_FOREVER:i,n=n||0;var r=b.director.getScheduler(),s=r.isTargetPaused(this);r.schedule(t,this,e,i,n,s)},i.scheduleOnce=function(t,e){void 0===e&&(e=0),this.schedule(t,0,0,e)},i.unschedule=function(t){t&&b.director.getScheduler().unschedule(t,this)},i.unscheduleAllCallbacks=function(){b.director.getScheduler().unscheduleAllForTarget(this)},h(e,[{key:"name",get:function(){if(this._name)return this._name;var t=Nt(this),e=t.lastIndexOf(".");return e>=0&&(t=t.slice(e+1)),this.node?this.node.name+"<"+t+">":t},set:function(t){this._name=t}},{key:"uuid",get:function(){return this._id}},{key:"__scriptAsset",get:function(){return null}},{key:"enabled",get:function(){return this._enabled},set:function(t){if(this._enabled!==t&&(this._enabled=t,this.node.activeInHierarchy)){var e=b.director._compScheduler;t?e.enableComp(this):e.disableComp(this)}}},{key:"enabledInHierarchy",get:function(){return this._enabled&&this.node&&this.node.activeInHierarchy}},{key:"_isOnLoadCalled",get:function(){return this._objFlags&Rc}}]),e}(Ta),mc.EventHandler=Sc,mc.system=null,T((_c=gc).prototype,"__scriptAsset",[uc,hc,lc,Vh],Object.getOwnPropertyDescriptor(_c.prototype,"__scriptAsset"),_c.prototype),fc=T(_c.prototype,"node",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),dc=T(_c.prototype,"_enabled",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),pc=T(_c.prototype,"__prefab",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),cc=_c))||cc)),Cc=bc.prototype;Cc.update=null,Cc.lateUpdate=null,Cc.__preload=null,Cc.onLoad=null,Cc.start=null,Cc.onEnable=null,Cc.onDisable=null,Cc.onDestroy=null,Cc.onFocusInEditor=null,Cc.onLostFocusInEditor=null,Cc.resetInEditor=null,Cc._getLocalBounds=null,Cc.onRestore=null,bc._requireComponent=null,bc._executionOrder=0,Ot(bc,"_registerEditorProps",(function(t,e){var i=e.requireComponent;i&&(Array.isArray(i)&&(i=i.filter(Boolean)),t._requireComponent=i);var n=e.executionOrder;n&&"number"==typeof n&&(t._executionOrder=n)})),b.Component=bc;var wc=t("MissingScript",_h("cc.MissingScript")(vc=Ih()((Tc=function(t){function e(){var e;return E(e=t.call(this)||this,"_$erialized",Ec,g(e)),e}return c(e,t),e.safeFindClass=function(t){var e=re(t);if(e)return e;b.deserialize.reportMissingClass(t)},e.prototype.onLoad=function(){j(4600,this.node.name)},e}(bc),Ec=T((yc=Tc).prototype,"_$erialized",[Eh,Sh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),vc=yc))||vc)||vc);b._MissingScript=wc;try{var Ic=wc.__values__;0!==Ic.length&&"_$erialized"===Ic[Ic.length-1]||(F("The '_$erialized' prop in MissingScript is missing. Please contact jare."),F(" Error props: ['"+Ic+"']"))}catch(ao){F("Error when checking MissingScript 5, "+ao)}var Oc=t("serializeTag",Symbol("[[Serialize]]")),xc=t("deserializeTag",Symbol("[[Deserialize]]")),Pc=function(){function t(t,e){this._document=void 0,this._chunks=void 0,this._document=t,this._chunks=e}return h(t,[{key:"document",get:function(){return this._document}},{key:"chunks",get:function(){return this._chunks}}]),t}();function Dc(t){var e=t;return{chunks:e.chunks,document:e.document}}function Bc(t){if(t.length<16)throw new Nc(J(13102));var e=new DataView(t.buffer,t.byteOffset,t.byteLength);if(1313817411!==e.getUint32(0,!0))throw new Nc(J(13100));var i=e.getUint32(4,!0);if(1!==i)throw new Nc(J(13101,i));if(e.getUint32(8,!0)!==e.byteLength)throw new Nc(J(13102));var n=12,r=e.getUint32(n,!0);n+=4;var s=new Uint8Array(e.buffer,n+e.byteOffset,r);n+=r;var a,o=function(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);if("Buffer"in globalThis)return globalThis.Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString();throw new Error(J(13104))}(s);try{a=JSON.parse(o)}catch(t){throw new Nc(t)}for(var u=[];n<e.byteLength;){n%8!=0&&(n+=8-n%8);var h=e.getUint32(n,!0);n+=4,u.push(new Uint8Array(e.buffer,n+e.byteOffset,h)),n+=h}if(n!==e.byteLength)throw new Nc(J(13102));return new Pc(a,u)}var Nc=function(t){function e(){return t.apply(this,arguments)||this}return c(e,t),e}(m(Error));function Mc(t,e,i,n,r){if(e instanceof b.ValueType){r||t.push("if(prop){");var s=Nt(e);t.push("s._deserializeFastDefinedObject(o"+i+",prop,"+s+");"),r||t.push("}else o"+i+"=null;")}else t.push("\nif (prop) {\n s._deserializeAndAssignField(o, prop, "+n+");\n} else {\n o"+i+"=null;\n}\n")}!function(){function t(){this._viewOrPaddings=[],this._length=0}var e=t.prototype;e.alignAs=function(t){if(0!==t){var e=this._length%t;if(0!==e){var i=t-e;return this._viewOrPaddings.push(i),this._length+=i,i}}return 0},e.append=function(t){var e=this._length;return this._viewOrPaddings.push(t),this._length+=t.byteLength,e},e.get=function(){var t=new Uint8Array(this._length),e=0;return this._viewOrPaddings.forEach((function(i){"number"==typeof i?e+=i:(t.set(new Uint8Array(i.buffer,i.byteOffset,i.byteLength),e),e+=i.byteLength)})),t},h(t,[{key:"byteLength",get:function(){return this._length}}])}(),b.internal.parseCCONJson=Dc,b.internal.decodeCCONBinary=Bc,b.internal.CCON=Pc;var Lc="$_$default",Fc="$_$formerlySerializedAs",Uc=function(t){function e(){return t.call(this,(function(t){t.clear()}),1)||this}return c(e,t),e.prototype.get=function(t,e,i,n,r){var s=this._get();return s?(s.reset(t,e,i,n,r),s):new Gc(t,e,i,n,r)},e}(ue),Gc=function(){function t(t,e,i,n){this.deserializedList=void 0,this.deserializedData=void 0,this._ignoreEditorOnly=void 0,this.result=t,this.customEnv=n,this.deserializedList=[],this.deserializedData=null,this._classFinder=e,this._reportMissingClass=i,this._onDereferenced=null==e?void 0:e.onDereferenced}var e=t.prototype;return e.reset=function(t,e,i,n){this.result=t,this.customEnv=n,this._classFinder=e,this._reportMissingClass=i,this._onDereferenced=null==e?void 0:e.onDereferenced},e.clear=function(){this.result=null,this.customEnv=null,this.deserializedList.length=0,this.deserializedData=null,this._classFinder=null,this._reportMissingClass=null,this._onDereferenced=null},e.deserialize=function(t){var e,i=!1;t instanceof Pc?(i=!0,e=t.document,t.chunks.length>0&&(t.chunks.length,this._mainBinChunk=t.chunks[0])):e=t,this._serializedData=e,this._context={fromCCON:i};var n=Array.isArray(e)?e[0]:e;return this.deserializedData=this._deserializeObject(n,0),this._serializedData=void 0,this._mainBinChunk=void 0,this._context=void 0,this.deserializedData},e._deserializeObject=function(t,e,i,n){switch(t.__type__){case"TypedArray":return this._deserializeTypedArrayView(t);case"TypedArrayRef":return this._deserializeTypedArrayViewRef(t);default:return t.__type__?this._deserializeTypeTaggedObject(t,e,i,n):Array.isArray(t)?this._deserializeArray(t):this._deserializePlainObject(t)}},e._deserializeTypedArrayView=function(t){return globalThis[t.ctor].from(t.array)},e._deserializeTypedArrayViewRef=function(t){var e=t.offset,i=t.length,n=t.ctor;return new globalThis[n](this._mainBinChunk.buffer,this._mainBinChunk.byteOffset+e,i)},e._deserializeArray=function(t){for(var e,i=new Array(t.length),n=0;n<t.length;n++)"object"==typeof(e=t[n])&&e?this._deserializeAndAssignField(i,e,""+n)&&(i[n]=null):i[n]=e;return i},e._deserializePlainObject=function(t){var e={};return this._fillPlainObject(e,t),e},e._deserializeTypeTaggedObject=function(t,e,i,n){var r=this,s=t.__type__,a=this._classFinder(s,t,i,n);if(!a)return this._classFinder===re&&this._reportMissingClass(s),null;var o=function(t){var i=new t;return e>=0&&(r.deserializedList[e]=i),i}(a);return this._deserializeInto(t,o,a),o},e._deserializeInto=function(t,e,i,n){void 0===n&&(n=!1),n||!e[xc]?e._deserialize?e._deserialize(t.content,this):b.Class._isCCClass(i)?this._deserializeFireClass(e,t,i):this._deserializeFastDefinedObject(e,t,i):this._runCustomizedDeserialize(t,e,i)},e._runCustomizedDeserialize=function(t,e,i){var n=this,r={readProperty:function(e){var i=t[e];return"object"==typeof i&&i?n._deserializeObjectField(i):i},readThis:function(){n._deserializeInto(t,e,i,!0)},readSuper:function(){var r=jt(i);r&&n._deserializeInto(t,e,r)}};e[xc](r,this._context)},e._deserializeFireClass=function(t,e,i){var n;if(i.hasOwnProperty("__deserialize__"))n=i.__deserialize__;else{n=function(t,e){for(var i=Ge(e),n=e.__values__,r=["var prop;"],s=Te.test(oe(e)),a=0;a<n.length;a++){var o=n[a],u=void 0,h=void 0;hi.IDENTIFIER_RE.test(o)?(h='"'+o+'"',u="."+o):u="["+(h=hi.escapeForJS(o))+"]";var l=u;if(i[o+Fc]){var c=i[o+Fc];l=hi.IDENTIFIER_RE.test(c)?"."+c:"["+hi.escapeForJS(c)+"]"}r.push("prop=d"+l+";"),r.push('if(typeof prop!=="undefined"){');var _=hi.getDefault(i[o+Lc]),f=i[o+"$_$type"];if(s&&(void 0!==_||f)){var d=void 0;if(void 0===_)d=f instanceof ze||f===ri||f===si;else{var p=typeof _;d="string"===p||"number"===p||"boolean"===p}d?r.push("o"+u+"=prop;"):Mc(r,_,u,h,!0)}else r.push('if(typeof prop!=="object"){o'+u+"=prop;}else{"),Mc(r,_,u,h,!1),r.push("}");r.push("}")}return(b.js.isChildClassOf(e,b._BaseNode)||b.js.isChildClassOf(e,b.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===wc){var r=i.__values__;0!==r.length&&"_$erialized"===r[r.length-1]||(F("The '_$erialized' prop of MissingScript is missing. Will force the raw data to be save."),F(" Error props: ['"+r+"']. Please contact jare."));var s=n;n=function(t,e,i,n){s(t,e,i,n),e._$erialized||F("Unable to stash previously serialized data. "+JSON.stringify(i))}}}catch(t){F("Error when checking MissingScript 6, "+t)}Ot(i,"__deserialize__",n,!0)}n(this,t,e,i)},e._deserializeAndAssignField=function(t,e,i){var n=e.__id__;if("number"==typeof n){var r=this.deserializedList[n];if(r)t[i]=r;else{var s,a=this._serializedData[n];t[i]=this._deserializeObject(a,n,void 0,i),null===(s=this._onDereferenced)||void 0===s||s.call(this,this.deserializedList,n,t,i)}}else{var o=e.__uuid__;if(o){var u=e.__expectedType__;this.result.push(t,i,o,u)}else t[i]=this._deserializeObject(e,-1)}return!1},e._deserializeObjectField=function(t){var e=t.__id__;if("number"==typeof e){var i=this.deserializedList[e];if(i)return i;var n=this._serializedData[e];return this._deserializeObject(n,e,void 0,void 0)}if(t.__uuid__)throw t.__expectedType__,new Error("Asset reference field serialization is currently not supported in custom serialization.");return this._deserializeObject(t,-1)},e._fillPlainObject=function(t,e){for(var i in e)if(e.hasOwnProperty(i)){var n=e[i];"object"!=typeof n?"__type__"!==i&&(t[i]=n):n?this._deserializeAndAssignField(t,n,i)&&(t[i]=null):t[i]=null}},e._deserializeFastDefinedObject=function(t,e,i){if(i===b.Vec2)return t.x=e.x||0,void(t.y=e.y||0);if(i===b.Vec3)return t.x=e.x||0,t.y=e.y||0,void(t.z=e.z||0);if(i!==b.Color){if(i===b.Size)return t.width=e.width||0,void(t.height=e.height||0);for(var n=Ge(i),r=i.__values__,s=0;s<r.length;s++){var a=r[s],o=e[a];void 0!==o||e.hasOwnProperty(a)||(o=hi.getDefault(n[a+Lc])),"object"!=typeof o?t[a]=o:o?this._deserializeAndAssignField(t,o,a):t[a]=null}}else{t.r=e.r||0,t.g=e.g||0,t.b=e.b||0;var u=e.a;t.a=void 0===u?255:u}},t}();Gc.pool=new Uc;var kc=[_n,ji,Li,$i,Gi,gn,yn,un];function zc(t,e){t.x=e[1],t.y=e[2],t.z=e[3],t.w=e[4]}var Hc=[function(t,e){t.x=e[1],t.y=e[2]},function(t,e){t.x=e[1],t.y=e[2],t.z=e[3]},zc,zc,function(t,e){t._val=e[1]},function(t,e){t.width=e[1],t.height=e[2]},function(t,e){t.x=e[1],t.y=e[2],t.width=e[3],t.height=e[4]},function(t,e){un.fromArray(t,e,1)}],Vc=t("Details",function(){function t(){this.uuidObjList=null,this.uuidPropList=null,this.uuidList=null,this.uuidTypeList=[]}var e=t.prototype;return e.init=function(t){t?(this.uuidObjList=t[8],this.uuidPropList=t[9],this.uuidList=t[10]):this.uuidList||(this.uuidList=[],this.uuidObjList=[],this.uuidPropList=[],this.uuidTypeList=[])},e.reset=function(){this.uuidList&&(this.uuidList.length=0,this.uuidObjList.length=0,this.uuidPropList.length=0,this.uuidTypeList.length=0)},e.push=function(t,e,i,n){this.uuidObjList.push(t),this.uuidPropList.push(e),this.uuidList.push(i),this.uuidTypeList.push(n||"")},t}());function Wc(t,e){for(var i=t[4][e[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]]]=e[u];for(;u<e.length;++u){var h=s[i[u]],l=n[i[u]+a];(0,Qc[l])(t,r,h,e[u])}return r}function Xc(t,e,i){var n=new e;return n._deserialize?n._deserialize(i,t[0]):K(5303,Nt(e)),n}function jc(t,e,i,n){n>=0?e[i]=t[5][n]:t[7][3*~n]=e}function Yc(t){return function(e,i,n,r){i[n]=r;for(var s=0;s<r.length;++s)t(e,r,s,r[s])}}function Kc(t,e,i,n){e[i]=null,t[8][n]=e}function qc(t,e,i,n){e[i]=Wc(t,n)}Vc.pool=new ue((function(t){t.reset()}),5),Vc.pool.get=function(){return this._get()||new Vc};var Qc=new Array(13);function Zc(t,e,i){return t||i(e),Object}function Jc(t,e,i,n,r,s,a){var o=t(e);if(!o){if(r)return void(i[n]=function(e,i,n){return function(){var r=t(n)||Zc(s,n,a);return e[i]=r,new r}}(i,n,e));o=Zc(s,e,a)}i[n]=o}function $c(t,e,i,n){for(var r=i||re,s=t[3],a=0;a<s.length;++a){var o=s[a];"string"!=typeof o?Jc(r,o[0],o,0,e,i,n):Jc(r,o,s,a,e,i,n)}}function t_(t){var e=t[4];if(e)for(var i=t[3],n=0;n<e.length;++n){var r=e[n];r[0]=i[r[0]]}}function e_(t,e,i){"string"==typeof t&&(t=JSON.parse(t));var n,r=!e;if(e=e||Vc.pool.get(),function(t){if(Array.isArray(t)){var e=t[0];return"number"==typeof e||e instanceof i_}return!1}(t)){e.init(t),i=i||{};var s,a=t[0],o=!1;if("object"==typeof a&&(o=a.preprocessed,a=a.version),a<1)throw new Error(J(5304,a));i._version=a,i.result=e,t[0]=i,o||($c(t,!1,i.classFinder,null!==(s=i.reportMissingClass)&&void 0!==s?s:e_.reportMissingClass),t_(t)),b.game._isCloning=!0;var u=t[5],h=function(t){var e=t[5],i=t[6],n=0===i?0:i.length,r=e[e.length-1],s=e.length-n;"number"!=typeof r?r=0:(r<0&&(r=~r),--s);for(var a=0;a<s;++a)e[a]=Wc(t,e[a]);for(var o=t[3],u=0;u<n;++u,++a){var h=i[u],l=e[a];if(h>=0){var c=o[h];e[a]=Xc(t,c,l)}else(0,Qc[h=~h])(t,e,a,l)}return r}(t);b.game._isCloning=!1,t[7]&&function(t,e,i){for(var n=t.length-1,r=0,s=3*t[n];r<s;r+=3){var a=t[r],o=e[t[r+2]],u=t[r+1];u>=0?a[i[u]]=o:a[~u]=o}for(;r<n;r+=3){var h=e[t[r]],l=e[t[r+2]],c=t[r+1];c>=0?h[i[c]]=l:h[~c]=l}}(t[7],u,t[2]),function(t){for(var e=t[5],i=t[2],n=t[1],r=t[8],s=t[9],a=t[10],o=0;o<r.length;++o){var u=r[o];"number"==typeof u&&(r[o]=e[u]);var h=s[o];"number"==typeof h&&(h=h>=0?i[h]:~h,s[o]=h);var l=a[o];"number"==typeof l&&(a[o]=n[l])}}(t),n=u[h]}else n=function(t,e,i){var n,r=(i=i||{}).classFinder||re,s=i.createAssetRefs||Qa.platform===Ua.EDITOR_CORE,a=i.customEnv,o=i.ignoreEditorOnly,u=null!==(n=i.reportMissingClass)&&void 0!==n?n:b.deserialize.reportMissingClass;e.init();var h=Gc.pool.get(e,r,u,a,o);b.game._isCloning=!0;var l=h.deserialize(t);return b.game._isCloning=!1,Gc.pool.put(h),s&&e.assignAssetsBy((function(t,e){return EditorExtends.serialize.asAsset(t,e.type)})),l}(t,e,i);return r&&Vc.pool.put(e),n}Qc[0]=function(t,e,i,n){e[i]=n},Qc[1]=jc,Qc[2]=Yc(jc),Qc[3]=Yc(Kc),Qc[4]=qc,Qc[5]=function(t,e,i,n){Hc[n[0]](e[i],n)},Qc[6]=Kc,Qc[7]=function(t,e,i,n){e[i].set(n)},Qc[8]=function(t,e,i,n){var r=new kc[n[0]];Hc[n[0]](r,n),e[i]=r},Qc[9]=Yc(qc),Qc[10]=function(t,e,i,n){var r=t[3][n[0]];e[i]=Xc(t,r,n[1])},Qc[11]=function(t,e,i,n){var r=n[0];e[i]=r;for(var s=1;s<n.length;s+=3){var a=n[s],o=n[s+1],u=n[s+2];(0,Qc[o])(t,r,a,u)}},Qc[12]=function(t,e,i,n){var r=n[0];e[i]=r;for(var s=0;s<r.length;++s){var a=r[s],o=n[s+1];0!==o&&(0,Qc[o])(t,r,s,a)}},e_.Details=Vc,e_.reportMissingClass=function(t){K(5302,t)};var i_=function(t){this.preprocessed=!0,this.version=t};function n_(t,e,i){return[1,0,0,[t],0,i?[e,-1]:[e],[0],0,[],[],[]]}b.deserialize=e_;var r_,s_,a_,o_,u_,h_,l_,c_,__,f_,d_,p_=Ta.Flags.Destroyed,m_=Ta.Flags.PersistentMask,g_=[];function v_(t){var e;if(Aa(t)){if(t._instantiate)return b.game._isCloning=!0,e=t._instantiate(null,!0),b.game._isCloning=!1,e;if(t instanceof b.Asset)throw new TypeError(J(6903))}return b.game._isCloning=!0,e=y_(t),b.game._isCloning=!1,e}function y_(t,e){var i;E_(t,i=t._iN$t?t._iN$t:t.constructor?new(0,t.constructor):Object.create(null),e);for(var n=0,r=g_.length;n<r;++n)g_[n]._iN$t=null;return g_.length=0,i}function E_(t,e,i){le.value(t,"_iN$t",e,!0),g_.push(t);var n=t.constructor;if(li(n))!function(t,e,i,n){for(var r=t.__values__,s=0;s<r.length;s++){var a=r[s],o=e[a];if("object"==typeof o&&o){var u=i[a];u instanceof ge&&u.constructor===o.constructor?u.set(o):i[a]=o._iN$t||T_(o,n)}else i[a]=o}}(n,t,e,i);else for(var r in t)if(t.hasOwnProperty(r)&&(95!==r.charCodeAt(0)||95!==r.charCodeAt(1)||"__type__"===r||"__prefab"===r)){var s=t[r];if("object"==typeof s&&s){if(s===e)continue;e[r]=s._iN$t||T_(s,i)}else e[r]=s}Aa(t)&&(e._objFlags&=m_)}function T_(t,e){if(t instanceof ge)return t.clone();if(t instanceof b.Asset)return t;var i;if(ArrayBuffer.isView(t)){var n=t.length;i=new t.constructor(n),t._iN$t=i,g_.push(t);for(var r=0;r<n;++r)i[r]=t[r];return i}if(Array.isArray(t)){var s=t.length;i=new Array(s),t._iN$t=i,g_.push(t);for(var a=0;a<s;++a){var o=t[a];i[a]="object"==typeof o&&o?o._iN$t||T_(o,e):o}return i}if(t._objFlags&p_)return null;var u=t.constructor;if(li(u)){if(e)if(e instanceof b.Component){if(t instanceof b._BaseNode||t instanceof b.Component)return t}else if(e instanceof b._BaseNode)if(t instanceof b._BaseNode){if(!t.isChildOf(e))return t}else if(t instanceof b.Component&&t.node&&!t.node.isChildOf(e))return t;i=new u}else if(u===Object)i={};else{if(u)return t;i=Object.create(null)}return E_(t,i,e),i}function S_(t,e){return(e<<3)+t}function A_(t){return b_[t]}function R_(t){switch(t){case f_.Uint8:return Uint8Array;case f_.Uint16:return Uint16Array;case f_.Uint32:return Uint32Array;case f_.Int8:return Int8Array;case f_.Int16:return Int16Array;case f_.Int32:return Int32Array;case f_.Float32:return Float32Array;case f_.Float64:return Float64Array}}v_._clone=y_,b.instantiate=v_,function(t){t[t.Uint8=0]="Uint8",t[t.Uint16=1]="Uint16",t[t.Uint32=2]="Uint32",t[t.Int8=3]="Int8",t[t.Int16=4]="Int16",t[t.Int32=5]="Int32",t[t.Float32=6]="Float32",t[t.Float64=7]="Float64"}(f_||(f_={})),function(t){t[t.Scalar=0]="Scalar",t[t.Vec2=1]="Vec2",t[t.Vec3=2]="Vec3",t[t.Vec4=3]="Vec4",t[t.Quat=4]="Quat",t[t.Mat4=5]="Mat4"}(d_||(d_={})),t("CompactValueTypeArray",_h("cc.CompactValueTypeArray")((c_=l_=function(){function t(){E(this,"_byteOffset",a_,this),E(this,"_unitCount",o_,this),E(this,"_unitElement",u_,this),E(this,"_length",h_,this)}return t.lengthFor=function(t,e,i){return A_(e).requiredUnits*t.length*R_(i).BYTES_PER_ELEMENT},t.compress=function(e,i,n,r,s,a){for(var o=A_(i),u=R_(n),h=o.requiredUnits*e.length,l=new u(r,s,h),c=0;c<e.length;++c)o.compress(l,c,e[c]);var _=new t;return _._unitElement=S_(n,i),_._byteOffset=a,_._unitCount=h,_._length=e.length,_},t.prototype.decompress=function(t){for(var e,i={storageUnit:7&(e=this._unitElement),elementType:e>>3},n=i.storageUnit,r=A_(i.elementType),s=new(R_(n))(t,this._byteOffset,this._unitCount),a=new Array(this._length),o=0;o<this._length;++o)a[o]=r.decompress(s,o);return a},t}(),l_.StorageUnit=f_,l_.ElementType=d_,a_=T((s_=c_).prototype,"_byteOffset",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),o_=T(s_.prototype,"_unitCount",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),u_=T(s_.prototype,"_unitElement",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return S_(f_.Uint8,d_.Scalar)}}),h_=T(s_.prototype,"_length",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),r_=s_))||r_);var b_=((__={})[d_.Scalar]={requiredUnits:1,compress:function(t,e,i){t[e]=i},decompress:function(t,e){return t[e]}},__[d_.Vec2]={requiredUnits:2,compress:function(t,e,i){t[2*e]=i.x,t[2*e+1]=i.y},decompress:function(t,e){return new ji(t[2*e],t[2*e+1])}},__[d_.Vec3]={requiredUnits:3,compress:function(t,e,i){t[3*e]=i.x,t[3*e+1]=i.y,t[3*e+2]=i.z},decompress:function(t,e){return new ji(t[3*e],t[3*e+1],t[3*e+2])}},__[d_.Vec4]={requiredUnits:4,compress:function(t,e,i){t[4*e]=i.x,t[4*e+1]=i.y,t[4*e+2]=i.z,t[4*e+3]=i.w},decompress:function(t,e){return new Li(t[4*e],t[4*e+1],t[4*e+2],t[4*e+3])}},__[d_.Quat]={requiredUnits:4,compress:function(t,e,i){t[4*e]=i.x,t[4*e+1]=i.y,t[4*e+2]=i.z,t[4*e+3]=i.w},decompress:function(t,e){return new $i(t[4*e],t[4*e+1],t[4*e+2],t[4*e+3])}},__[d_.Mat4]={requiredUnits:16,compress:function(t,e,i){un.toArray(t,i,16*e)},decompress:function(t,e){return un.fromArray(new un,t,16*e)}},__);function C_(){return 0}function w_(t){return t}function I_(t){return t*t}function O_(t){return t*(2-t)}function x_(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)}function P_(t){return t*t*t}function D_(t){return--t*t*t+1}function B_(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)}function N_(t){return t*t*t*t}function M_(t){return 1- --t*t*t*t}function L_(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)}function F_(t){return t*t*t*t*t}function U_(t){return--t*t*t*t*t+1}function G_(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)}function k_(t){return 1===t?1:1-Math.cos(t*Math.PI/2)}function z_(t){return Math.sin(t*Math.PI/2)}function H_(t){return.5*(1-Math.cos(Math.PI*t))}function V_(t){return 0===t?0:Math.pow(1024,t-1)}function W_(t){return 1===t?1:1-Math.pow(2,-10*t)}function X_(t){return 0===t?0:1===t?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(2-Math.pow(2,-10*(t-1)))}function j_(t){return 1-Math.sqrt(1-t*t)}function Y_(t){return Math.sqrt(1- --t*t)}function K_(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}function q_(t){var e,i=.1;return 0===t?0:1===t?1:(!i||i<1?(i=1,e=.1):e=.4*Math.asin(1/i)/(2*Math.PI),-i*Math.pow(2,10*(t-=1))*Math.sin(2*(t-e)*Math.PI/.4))}function Q_(t){var e,i=.1;return 0===t?0:1===t?1:(!i||i<1?(i=1,e=.1):e=.4*Math.asin(1/i)/(2*Math.PI),i*Math.pow(2,-10*t)*Math.sin(2*(t-e)*Math.PI/.4)+1)}function Z_(t){var e,i=.1;return 0===t?0:1===t?1:(!i||i<1?(i=1,e=.1):e=.4*Math.asin(1/i)/(2*Math.PI),(t*=2)<1?i*Math.pow(2,10*(t-=1))*Math.sin(2*(t-e)*Math.PI/.4)*-.5:i*Math.pow(2,-10*(t-=1))*Math.sin(2*(t-e)*Math.PI/.4)*.5+1)}function J_(t){if(1===t)return 1;var e=1.70158;return t*t*((e+1)*t-e)}function $_(t){if(0===t)return 0;var e=1.70158;return--t*t*((e+1)*t+e)+1}function tf(t){var e=2.5949095;return(t*=2)<1?t*t*((e+1)*t-e)*.5:.5*((t-=2)*t*((e+1)*t+e)+2)}function ef(t){return 1-nf(1-t)}function nf(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}function rf(t){return t<.5?.5*ef(2*t):.5*nf(2*t-1)+.5}function sf(t){return t<=0?0:t>=1?1:t*t*(3-2*t)}function af(t){return t<=0?0:t>=1?1:t*t*t*(t*(6*t-15)+10)}b._decorator=Zh;var of=gf(I_,O_),uf=gf(P_,D_),hf=gf(N_,M_),lf=gf(F_,U_),cf=gf(k_,z_),_f=gf(V_,W_),ff=gf(j_,Y_),df=gf(q_,Q_),pf=gf(J_,$_),mf=gf(ef,nf);function gf(t,e){return function(i){return i<.5?e(2*i)/2:t(2*i-1)/2+.5}}var vf,yf,Ef=Object.freeze({__proto__:null,constant:C_,linear:w_,quadIn:I_,quadOut:O_,quadInOut:x_,cubicIn:P_,cubicOut:D_,cubicInOut:B_,quartIn:N_,quartOut:M_,quartInOut:L_,quintIn:F_,quintOut:U_,quintInOut:G_,sineIn:k_,sineOut:z_,sineInOut:H_,expoIn:V_,expoOut:W_,expoInOut:X_,circIn:j_,circOut:Y_,circInOut:K_,elasticIn:q_,elasticOut:Q_,elasticInOut:Z_,backIn:J_,backOut:$_,backInOut:tf,bounceIn:ef,bounceOut:nf,bounceInOut:rf,smooth:sf,fade:af,quadOutIn:of,cubicOutIn:uf,quartOutIn:hf,quintOutIn:lf,sineOutIn:cf,expoOutIn:_f,circOutIn:ff,elasticOutIn:df,backOutIn:pf,bounceOutIn:mf});t("easing",Ef),function(t){t[t.LINEAR=0]="LINEAR",t[t.CONSTANT=1]="CONSTANT",t[t.QUAD_IN=2]="QUAD_IN",t[t.QUAD_OUT=3]="QUAD_OUT",t[t.QUAD_IN_OUT=4]="QUAD_IN_OUT",t[t.QUAD_OUT_IN=5]="QUAD_OUT_IN",t[t.CUBIC_IN=6]="CUBIC_IN",t[t.CUBIC_OUT=7]="CUBIC_OUT",t[t.CUBIC_IN_OUT=8]="CUBIC_IN_OUT",t[t.CUBIC_OUT_IN=9]="CUBIC_OUT_IN",t[t.QUART_IN=10]="QUART_IN",t[t.QUART_OUT=11]="QUART_OUT",t[t.QUART_IN_OUT=12]="QUART_IN_OUT",t[t.QUART_OUT_IN=13]="QUART_OUT_IN",t[t.QUINT_IN=14]="QUINT_IN",t[t.QUINT_OUT=15]="QUINT_OUT",t[t.QUINT_IN_OUT=16]="QUINT_IN_OUT",t[t.QUINT_OUT_IN=17]="QUINT_OUT_IN",t[t.SINE_IN=18]="SINE_IN",t[t.SINE_OUT=19]="SINE_OUT",t[t.SINE_IN_OUT=20]="SINE_IN_OUT",t[t.SINE_OUT_IN=21]="SINE_OUT_IN",t[t.EXPO_IN=22]="EXPO_IN",t[t.EXPO_OUT=23]="EXPO_OUT",t[t.EXPO_IN_OUT=24]="EXPO_IN_OUT",t[t.EXPO_OUT_IN=25]="EXPO_OUT_IN",t[t.CIRC_IN=26]="CIRC_IN",t[t.CIRC_OUT=27]="CIRC_OUT",t[t.CIRC_IN_OUT=28]="CIRC_IN_OUT",t[t.CIRC_OUT_IN=29]="CIRC_OUT_IN",t[t.ELASTIC_IN=30]="ELASTIC_IN",t[t.ELASTIC_OUT=31]="ELASTIC_OUT",t[t.ELASTIC_IN_OUT=32]="ELASTIC_IN_OUT",t[t.ELASTIC_OUT_IN=33]="ELASTIC_OUT_IN",t[t.BACK_IN=34]="BACK_IN",t[t.BACK_OUT=35]="BACK_OUT",t[t.BACK_IN_OUT=36]="BACK_IN_OUT",t[t.BACK_OUT_IN=37]="BACK_OUT_IN",t[t.BOUNCE_IN=38]="BOUNCE_IN",t[t.BOUNCE_OUT=39]="BOUNCE_OUT",t[t.BOUNCE_IN_OUT=40]="BOUNCE_IN_OUT",t[t.BOUNCE_OUT_IN=41]="BOUNCE_OUT_IN",t[t.SMOOTH=42]="SMOOTH",t[t.FADE=43]="FADE"}(yf||(yf={}));var Tf,Sf=((vf={})[yf.CONSTANT]=C_,vf[yf.LINEAR]=w_,vf[yf.QUAD_IN]=I_,vf[yf.QUAD_OUT]=O_,vf[yf.QUAD_IN_OUT]=x_,vf[yf.QUAD_OUT_IN]=of,vf[yf.CUBIC_IN]=P_,vf[yf.CUBIC_OUT]=D_,vf[yf.CUBIC_IN_OUT]=B_,vf[yf.CUBIC_OUT_IN]=uf,vf[yf.QUART_IN]=N_,vf[yf.QUART_OUT]=M_,vf[yf.QUART_IN_OUT]=L_,vf[yf.QUART_OUT_IN]=hf,vf[yf.QUINT_IN]=F_,vf[yf.QUINT_OUT]=U_,vf[yf.QUINT_IN_OUT]=G_,vf[yf.QUINT_OUT_IN]=lf,vf[yf.SINE_IN]=k_,vf[yf.SINE_OUT]=z_,vf[yf.SINE_IN_OUT]=H_,vf[yf.SINE_OUT_IN]=cf,vf[yf.EXPO_IN]=V_,vf[yf.EXPO_OUT]=W_,vf[yf.EXPO_IN_OUT]=X_,vf[yf.EXPO_OUT_IN]=_f,vf[yf.CIRC_IN]=j_,vf[yf.CIRC_OUT]=Y_,vf[yf.CIRC_IN_OUT]=K_,vf[yf.CIRC_OUT_IN]=ff,vf[yf.ELASTIC_IN]=q_,vf[yf.ELASTIC_OUT]=Q_,vf[yf.ELASTIC_IN_OUT]=Z_,vf[yf.ELASTIC_OUT_IN]=df,vf[yf.BACK_IN]=J_,vf[yf.BACK_OUT]=$_,vf[yf.BACK_IN_OUT]=tf,vf[yf.BACK_OUT_IN]=pf,vf[yf.BOUNCE_IN]=ef,vf[yf.BOUNCE_OUT]=nf,vf[yf.BOUNCE_IN_OUT]=rf,vf[yf.BOUNCE_OUT_IN]=mf,vf[yf.SMOOTH]=sf,vf[yf.FADE]=af,vf);function Af(t){return Sf[t]}n(255),n(65280);var Rf,bf,Cf,wf=$u.LINEAR<<0|eh.NONE<<8|yf.LINEAR<<16,If=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).value=0,e.rightTangent=0,e.rightTangentWeight=0,e.leftTangent=0,e.leftTangentWeight=0,e._flags=wf,e}return c(e,t),h(e,[{key:"interpolationMode",get:function(){return(255&this._flags)>>0},set:function(t){this._flags&=-256,this._flags|=t<<0}},{key:"tangentWeightMode",get:function(){return(65280&this._flags)>>8},set:function(t){this._flags&=-65281,this._flags|=t<<8}},{key:"easingMethod",get:function(){return(16711680&this._flags)>>16},set:function(t){this._flags&=-16711681,this._flags|=t<<16}}]),e}(Qh);function Of(t){var e=new If;if("number"==typeof t)e.value=t;else{var i=t.interpolationMode,n=t.tangentWeightMode,r=t.value,s=t.rightTangent,a=t.rightTangentWeight,o=t.leftTangent,u=t.leftTangentWeight,h=t.easingMethod,l=t[va];e.value=null!=r?r:e.value,e.rightTangent=null!=s?s:e.rightTangent,e.rightTangentWeight=null!=a?a:e.rightTangentWeight,e.leftTangent=null!=o?o:e.leftTangent,e.leftTangentWeight=null!=u?u:e.leftTangentWeight,e.interpolationMode=null!=i?i:e.interpolationMode,e.tangentWeightMode=null!=n?n:e.tangentWeightMode,e.easingMethod=null!=h?h:e.easingMethod,l&&(e[va]=l)}return e}hi.fastDefine("cc.RealKeyframeValue",If,((Tf={interpolationMode:$u.LINEAR,tangentWeightMode:eh.NONE,value:0,rightTangent:0,rightTangentWeight:0,leftTangent:0,leftTangentWeight:0,easingMethod:yf.LINEAR})[va]=void 0,Tf)),hi.Attr.setClassAttr(If,va,"editorOnly",!0),(Rf=If,null!==(Cf=(bf=Rf)[yh])&&void 0!==Cf?Cf:bf[yh]={}).uniquelyReferenced=!0;var xf,Pf=t("RealCurve",function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).preExtrapolation=th.CLAMP,e.postExtrapolation=th.CLAMP,e}c(e,t);var i=e.prototype;return i.evaluate=function(t){var e=this._times,i=this._values,n=e.length;if(0===n)return 0;var r=e[0],s=e[n-1];if(t<r){var a=this.preExtrapolation,o=i[0];if(a===th.CLAMP||n<2)return o.value;switch(a){case th.LINEAR:return Yf(r,i[0].value,e[1],i[1].value,t);case th.LOOP:t=Xf(t,r,s);break;case th.PING_PONG:t=jf(t,r,s);break;default:return o.value}}else if(t>s){var u=this.postExtrapolation,h=i[n-1];if(u===th.CLAMP||n<2)return h.value;switch(u){case th.LINEAR:return Yf(s,h.value,e[n-2],i[n-2].value,t);case th.LOOP:t=Xf(t,r,s);break;case th.PING_PONG:t=jf(t,r,s);break;default:return h.value}}var l=Ju(e,t);if(l>=0)return i[l].value;var c=~l,_=c-1,f=e[_],d=i[_],p=e[c];return function(t,e,i,n,r){var s=i-t;switch(e.interpolationMode){default:case $u.CONSTANT:return e.value;case $u.LINEAR:var a=e.easingMethod===yf.LINEAR?r:Af(e.easingMethod)(r);return Ei(e.value,n.value,a);case $u.CUBIC:var o=1/3,u=e.rightTangent,h=e.rightTangentWeight,l=0!=(e.tangentWeightMode&eh.RIGHT),c=n.leftTangent,_=n.leftTangentWeight,f=0!=(n.tangentWeightMode&eh.LEFT);if(l||f){var d=0;if(l)d=h;else{var p=s,m=s*u;d=Math.sqrt(p*p+m*m)*o}var g=Math.atan(u),v=Math.cos(g)*d+t,y=Math.sin(g)*d+e.value,E=0;if(f)E=_;else{var T=s,S=s*c;E=Math.sqrt(T*T+S*S)*o}var A=Math.atan(c),R=(v-t)/s,b=(-Math.cos(A)*E+i-t)/s,C=y,w=-Math.sin(A)*E+n.value,I=[0,0,0],O=function(t,e,i,n,r){var s=i/n,a=e/n,o=s*s,u=1/3*(-1/3*o+a),h=.5*(2/27*s*o-1/3*s*a+t/n),l=u*u*u,c=h*h+l,_=0;if(nh(c)){if(nh(h))return r[0]=0,1;var f=Math.cbrt(-h);return r[0]=2*f,r[1]=-f,2}if(c<0){var d=1/3*Math.acos(-h/Math.sqrt(-l)),p=2*Math.sqrt(-u);r[0]=p*Math.cos(d),r[1]=-p*Math.cos(d+Math.PI/3),r[2]=-p*Math.cos(d-Math.PI/3),_=3}else{var m=Math.sqrt(c),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*b-6*R,3*(R-b)+1,I),x=function(t,e,i){var n=i;if(1===e)n=t[0];else{n=-1/0;for(var r=0;r<e;++r){var s=t[r];s>=0&&s<=1&&s>n&&(n=s)}n===-1/0&&(n=0)}return n}(I,O,r);return Kf(e.value,C,w,n.value,x)}var P=e.value+o*u*s,D=n.value-o*c*s;return Kf(e.value,P,D,n.value,r)}}(f,d,p,i[c],(t-f)/(p-f))},i.addKeyFrame=function(e,i){return t.prototype.addKeyFrame.call(this,e,Of(i))},i.assignSorted=function(t,e){if(void 0!==e)this.setKeyframes(t.slice(),e.map((function(t){return Of(t)})));else{var i=Array.from(t);this.setKeyframes(i.map((function(t){return t[0]})),i.map((function(t){return Of(t[1])})))}},i.isConstant=function(t){if(this._values.length<=1)return!0;var e=this._values[0].value;return this._values.every((function(i){return gi(i.value,e,t)}))},i[Oc]=function(t,e){if(e.toCCON){var i=this._times,n=this._values,r=i.length,s=new DataView(new ArrayBuffer(0+Df+Df+Bf+Nf*r+Hf*r)),a=0;s.setUint8(a,this.preExtrapolation),a+=Df,s.setUint8(a,this.postExtrapolation),a+=Df,s.setUint32(a,r,!0),a+=Bf,i.forEach((function(t,e){return s.setFloat32(a+Nf*e,t,!0)})),a+=Nf*r;for(var o,u=y(n);!(o=u()).done;){var h=o.value;a=Vf(s,h,a)}var l=new Uint8Array(s.buffer,0,a);t.writeProperty("bytes",l);var c=n.map((function(t){return t[va]}));c.some((function(t){return void 0!==t}))&&t.writeProperty("keyframeValueEditorExtras",c)}else t.writeThis()},i[xc]=function(t,e){if(e.fromCCON){var i=t.readProperty("bytes"),n=new DataView(i.buffer,i.byteOffset,i.byteLength),r=0;this.preExtrapolation=n.getUint8(r),r+=Df,this.postExtrapolation=n.getUint8(r),r+=Df;var s=n.getUint32(r,!0);r+=Bf;var a=Array.from({length:s},(function(t,e){return n.getFloat32(r+Nf*e,!0)}));r+=Nf*s;for(var o=new Array(s),u=0;u<s;++u){var h=Of({});r=Wf(n,h,r),o[u]=h}i.byteLength;var l=t.readProperty("keyframeValueEditorExtras");l&&(l.length,l.forEach((function(t,e){return o[e][va]=t}))),this._times=a,this._values=o}else t.readThis()},e}(ih));hi.fastDefine("cc.RealCurve",Pf,{_times:[],_values:[],preExtrapolation:th.CLAMP,postExtrapolation:th.CLAMP}),function(t){t[t.VALUE=1]="VALUE",t[t.INTERPOLATION_MODE=2]="INTERPOLATION_MODE",t[t.TANGENT_WEIGHT_MODE=4]="TANGENT_WEIGHT_MODE",t[t.LEFT_TANGENT=8]="LEFT_TANGENT",t[t.LEFT_TANGENT_WEIGHT=16]="LEFT_TANGENT_WEIGHT",t[t.RIGHT_TANGENT=32]="RIGHT_TANGENT",t[t.RIGHT_TANGENT_WEIGHT=64]="RIGHT_TANGENT_WEIGHT"}(xf||(xf={}));var Df=1,Bf=4,Nf=4,Mf=Of({}),Lf=Mf.interpolationMode,Ff=Mf.tangentWeightMode,Uf=Mf.leftTangent,Gf=Mf.leftTangentWeight,kf=Mf.rightTangent,zf=Mf.rightTangentWeight,Hf=26;function Vf(t,e,i){var n=0,r=i,s=r;r+=4;var a=e.value,o=e.interpolationMode,u=e.tangentWeightMode,h=e.rightTangent,l=e.rightTangentWeight,c=e.leftTangent,_=e.leftTangentWeight,f=e.easingMethod;return t.setFloat32(r,a,!0),r+=4,o!==Lf&&(n|=xf.INTERPOLATION_MODE,t.setUint8(r,o),r+=1),u!==Ff&&(n|=xf.TANGENT_WEIGHT_MODE,t.setUint8(r,u),r+=1),c!==Uf&&(n|=xf.LEFT_TANGENT,t.setFloat32(r,c,!0),r+=4),_!==Gf&&(n|=xf.LEFT_TANGENT_WEIGHT,t.setFloat32(r,_,!0),r+=4),h!==kf&&(n|=xf.RIGHT_TANGENT,t.setFloat32(r,h,!0),r+=4),l!==zf&&(n|=xf.RIGHT_TANGENT_WEIGHT,t.setFloat32(r,l,!0),r+=4),n|=f<<8,t.setUint32(s,n,!0),r}function Wf(t,e,i){var n=i,r=t.getUint32(n,!0);n+=4,e.value=t.getFloat32(n,!0),n+=4,r&xf.INTERPOLATION_MODE&&(e.interpolationMode=t.getUint8(n),n+=1),r&xf.TANGENT_WEIGHT_MODE&&(e.tangentWeightMode=t.getUint8(n),n+=1),r&xf.LEFT_TANGENT&&(e.leftTangent=t.getFloat32(n,!0),n+=4),r&xf.LEFT_TANGENT_WEIGHT&&(e.leftTangentWeight=t.getFloat32(n,!0),n+=4),r&xf.RIGHT_TANGENT&&(e.rightTangent=t.getFloat32(n,!0),n+=4),r&xf.RIGHT_TANGENT_WEIGHT&&(e.rightTangentWeight=t.getFloat32(n,!0),n+=4);var s=(65280&r)>>8;return e.easingMethod=s,n}function Xf(t,e,i){return e+xi(t-e,i-e)}function jf(t,e,i){return e+Pi(t-e,i-e)}function Yf(t,e,i,n,r){return e+(n-e)/(i-t)*(r-t)}function Kf(t,e,i,n,r){var s=1-r;return s*s*s*t+3*s*s*r*e+3*s*r*r*i+r*r*r*n}function qf(t,e,i,n,r){var s=1-r;return s*(s*(t+(3*e-t)*r)+3*i*r*r)+n*r*r*r}b.bezier=qf;var Qf,Zf,Jf,$f,td,ed,id,nd,rd,sd,ad,od=Math.cos,ud=Math.acos,hd=Math.max,ld=2*Math.PI,cd=Math.sqrt;function _d(t){return t<0?-Math.pow(-t,1/3):Math.pow(t,1/3)}function fd(t,e){var i=function(t,e){var i,n,r,s,a=e-0,o=e-t[0],u=3*a,h=3*o,l=3*(e-t[2]),c=1/(-a+h-l+(e-1)),_=1/3,f=(u-6*o+l)*c,d=f*_,p=(-u+h)*c,m=(3*p-f*f)*_,g=m*_,v=(2*f*f*f-9*f*p+a*c*27)/27,y=v/2,E=y*y+g*g*g;if(E<0){var T=-m*_,S=cd(T*T*T),A=-v/(2*S),R=ud(A<-1?-1:A>1?1:A),b=2*_d(S);return n=b*od(R*_)-d,r=b*od((R+ld)*_)-d,s=b*od((R+2*ld)*_)-d,n>=0&&n<=1?r>=0&&r<=1?s>=0&&s<=1?hd(n,r,s):hd(n,r):s>=0&&s<=1?hd(n,s):n:r>=0&&r<=1?s>=0&&s<=1?hd(r,s):r:s}if(0===E)return r=-(i=y<0?_d(-y):-_d(y))-d,(n=2*i-d)>=0&&n<=1?r>=0&&r<=1?hd(n,r):n:r;var C=cd(E);return(i=_d(-y+C))-_d(y+C)-d}(t,e),n=t[1];return((1-i)*(n+(t[3]-n)*i)*3+i*i)*i}b.bezierByTime=fd,function(t){t[t.SLERP=0]="SLERP",t[t.CONSTANT=1]="CONSTANT"}(ad||(ad=t("QuatInterpolationMode",{})));var dd=_h("cc.QuatKeyframeValue")(Qf=Rh((Jf=T((Zf=function(t){var e=void 0===t?{}:t,i=e.value,n=e.interpolationMode,r=e.easingMethod;E(this,"interpolationMode",Jf,this),E(this,"value",$f,this),E(this,"easingMethod",td,this),this.value=i?$i.clone(i):this.value,this.interpolationMode=null!=n?n:this.interpolationMode,this.easingMethod=null!=r?r:this.easingMethod}).prototype,"interpolationMode",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return ad.SLERP}}),$f=T(Zf.prototype,"value",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return $i.clone($i.IDENTITY)}}),td=T(Zf.prototype,"easingMethod",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return yf.LINEAR}}),Qf=Zf))||Qf)||Qf;function pd(t){return new dd(t)}var md,gd=t("QuatCurve",_h("cc.QuatCurve")((sd=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return E(e=t.call.apply(t,[this].concat(n))||this,"preExtrapolation",nd,g(e)),E(e,"postExtrapolation",rd,g(e)),e}c(e,t);var i=e.prototype;return i.evaluate=function(t,e){var i;null!==(i=e)&&void 0!==i||(e=new $i);var n=this._times,r=this._values,s=this.postExtrapolation,a=this.preExtrapolation,o=n.length;if(0===o)return e;var u=n[0],h=n[o-1];if(t<u){var l=r[0];switch(a){case th.LOOP:t=u+xi(t-u,h-u);break;case th.PING_PONG:t=u+Pi(t-u,h-u);break;case th.CLAMP:default:return $i.copy(e,l.value)}}else if(t>h){var c=r[o-1];switch(s){case th.LOOP:t=u+xi(t-u,h-u);break;case th.PING_PONG:t=u+Pi(t-u,h-u);break;case th.CLAMP:default:return $i.copy(e,c.value)}}var _=Ju(n,t);if(_>=0)return $i.copy(e,r[_].value);var f=~_,d=f-1,p=n[d],m=r[d],g=n[f],v=r[f],y=(t-p)/(g-p);switch(m.interpolationMode){default:case ad.CONSTANT:return $i.copy(e,m.value);case ad.SLERP:var E=m.easingMethod,T=E===yf.LINEAR?y:Array.isArray(E)?fd(E,y):Af(E)(y);return $i.slerp(e,m.value,v.value,T)}},i.addKeyFrame=function(e,i){var n=new dd(i);return t.prototype.addKeyFrame.call(this,e,n)},i.assignSorted=function(t,e){if(void 0!==e)this.setKeyframes(t.slice(),e.map((function(t){return pd(t)})));else{var i=Array.from(t);this.setKeyframes(i.map((function(t){return t[0]})),i.map((function(t){return pd(t[1])})))}},i[Oc]=function(t,e){if(e.toCCON){var i=this._times,n=this._values,r=!0;n.forEach((function(t,e,i){var n=i[0];r&&t.interpolationMode!==n.interpolationMode&&(r=!1)}));var s=i.length,a=Ad*(r?1:s),o=n.reduce((function(t,e){var i=e.easingMethod;return t+(Array.isArray(i)?Rd+4*Cd:Rd)}),0),u=0,h=new DataView(new ArrayBuffer(u+=yd+Ed+Td*s+4*Sd*s+o+a+0)),l=0,c=0;r&&(c|=md.INTERPOLATION_MODE),h.setUint32(l,c,!0),l+=yd,h.setUint32(l,s,!0),l+=Ed,i.forEach((function(t,e){return h.setFloat32(l+Td*e,t,!0)})),l+=Td*s,n.forEach((function(t,e){var i=t.value,n=i.x,r=i.y,s=i.z,a=i.w,o=l+4*Sd*e;h.setFloat32(o+0*Sd,n,!0),h.setFloat32(o+1*Sd,r,!0),h.setFloat32(o+2*Sd,s,!0),h.setFloat32(o+3*Sd,a,!0)})),l+=4*Sd*s,n.forEach((function(t){var e=t.easingMethod;Array.isArray(e)?(h.setUint8(l,bd),++l,h.setFloat32(l+0*Cd,e[0],!0),h.setFloat32(l+1*Cd,e[1],!0),h.setFloat32(l+2*Cd,e[2],!0),h.setFloat32(l+3*Cd,e[3],!0),l+=4*Cd):(h.setUint8(l,e),++l)}));var _=l;l+=a;var f=_;n.forEach((function(t){var e=t.interpolationMode;h.setUint8(f,e),r||(f+=Ad)}));var d=new Uint8Array(h.buffer);t.writeProperty("bytes",d)}else t.writeThis()},i[xc]=function(t,e){if(e.fromCCON){var i=t.readProperty("bytes"),n=new DataView(i.buffer,i.byteOffset,i.byteLength),r=0,s=n.getUint32(r,!0);r+=yd;var a=s&md.INTERPOLATION_MODE,o=n.getUint32(r,!0);r+=Ed;var u=Array.from({length:o},(function(t,e){return n.getFloat32(r+Td*e,!0)})),h=r+=Td*o;r+=4*Sd*o;var l=Array.from({length:o},(function(t,e){var i=h+4*Sd*e,s=n.getFloat32(i+0*Sd,!0),a=n.getFloat32(i+1*Sd,!0),o=n.getFloat32(i+2*Sd,!0),u=n.getFloat32(i+3*Sd,!0),l=n.getUint8(r);++r;var c=pd({value:{x:s,y:a,z:o,w:u}});return l!==bd?c.easingMethod=l:(c.easingMethod=[n.getFloat32(r+0*Cd,!0),n.getFloat32(r+1*Cd,!0),n.getFloat32(r+2*Cd,!0),n.getFloat32(r+3*Cd,!0)],r+=4*Cd),c}));if(a){var c=n.getUint8(r);++r;for(var _=0;_<o;++_)l[_].interpolationMode=c}else{for(var f=0;f<o;++f){var d=n.getUint8(r+f);l[f].interpolationMode=d}r+=o}this._times=u,this._values=l}else t.readThis()},e}(ih),nd=T((id=sd).prototype,"preExtrapolation",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return th.CLAMP}}),rd=T(id.prototype,"postExtrapolation",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return th.CLAMP}}),ed=id))||ed);!function(t){t[t.INTERPOLATION_MODE=1]="INTERPOLATION_MODE"}(md||(md={}));var vd,yd=1,Ed=4,Td=4,Sd=4,Ad=1,Rd=1,bd=255,Cd=4,wd=t("ObjectCurve",_h("cc.ObjectCurve")(vd=function(t){function e(){return t.apply(this,arguments)||this}return c(e,t),e.prototype.evaluate=function(t){var e=this.searchKeyframe(t);if(e>=0)return this._values[e];var i=vi(~e-1,0,this._values.length-1);return this._values[i]},e}(ih))||vd),Id=function(){this.time=0,this.value=0,this.inTangent=0,this.outTangent=0};hi.fastDefine("cc.Keyframe",Id,{time:0,value:0,inTangent:0,outTangent:0});var Od,xd=function(){function t(){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 t.prototype.evaluate=function(t){return e=t-this.time,i=this.coefficient,e*(e*(e*i[0]+i[1])+i[2])+i[3];var e,i},t}(),Pd=function(){function t(t){if(void 0===t&&(t=null),this.cachedKey=void 0,t instanceof Pf)this._curve=t;else{var e=new Pf;this._curve=e,e.preExtrapolation=th.LOOP,e.postExtrapolation=th.CLAMP,t?e.assignSorted(t.map((function(t){return[t.time,{interpolationMode:$u.CUBIC,value:t.value,leftTangent:t.inTangent,rightTangent:t.outTangent}]}))):e.assignSorted([[0,{interpolationMode:$u.CUBIC,value:1}],[1,{interpolationMode:$u.CUBIC,value:1}]])}this.cachedKey=new xd}var e=t.prototype;return e.addKey=function(t){t?this._curve.addKeyFrame(t.time,{interpolationMode:$u.CUBIC,value:t.value,leftTangent:t.inTangent,rightTangent:t.outTangent}):this._curve.clear()},e.evaluate_slow=function(t){return this._curve.evaluate(t)},e.evaluate=function(t){var e=this.cachedKey,i=this._curve,n=i.keyFramesCount-1,r=t,s=t<0?i.preExtrapolation:i.postExtrapolation,a=i.getKeyframeTime(0),o=i.getKeyframeTime(n);switch(s){case th.LOOP:r=xi(t-a,o-a)+a;break;case th.PING_PONG:r=Pi(t-a,o-a)+a;break;case th.CLAMP:default:r=vi(t,a,o)}if(r>=e.time&&r<e.endTime)return e.evaluate(r);var u=this.findIndex(e,r),h=Math.min(u+1,n);return this.calcOptimizedKey(e,u,h),e.evaluate(r)},e.calcOptimizedKey=function(t,e,i){var n=this._curve.getKeyframeTime(e),r=this._curve.getKeyframeTime(i),s=this._curve.getKeyframeValue(e),a=s.value,o=s.leftTangent,u=this._curve.getKeyframeValue(i),h=u.value,l=u.rightTangent;t.index=e,t.time=n,t.endTime=r;var c=r-n,_=h-a,f=1/(c*c),d=o*c,p=l*c;t.coefficient[0]=(d+p-_-_)*f/c,t.coefficient[1]=(_+_+_-d-d-p)*f,t.coefficient[2]=o,t.coefficient[3]=a},e.findIndex=function(t,e){var i=this._curve,n=i.keyFramesCount,r=t.index;if(-1!==r)if(e>i.getKeyframeTime(r))for(var s=0;s<3;s++){var a=r+s;if(a+1<n&&i.getKeyframeTime(a+1)>e)return a}else for(var o=0;o<3;o++){var u=r-o;if(u>=0&&i.getKeyframeTime(u-1)<=e)return u-1}for(var h,l=0,c=n;c-l>1;)h=Math.floor((l+c)/2),i.getKeyframeTime(h)>=e?c=h:l=h;return l},h(t,[{key:"_internalCurve",get:function(){return this._curve}},{key:"keyFrames",get:function(){return Array.from(this._curve.keyframes()).map((function(t){var e=t[0],i=t[1],n=new Id;return n.time=e,n.value=i.value,n.inTangent=i.leftTangent,n.outTangent=i.rightTangent,n}))},set:function(t){this._curve.assignSorted(t.map((function(t){return[t.time,{interpolationMode:$u.CUBIC,value:t.value,leftTangent:t.inTangent,rightTangent:t.outTangent}]})))}},{key:"preWrapMode",get:function(){return Bd(this._curve.preExtrapolation)},set:function(t){this._curve.preExtrapolation=Dd(t)}},{key:"postWrapMode",get:function(){return Bd(this._curve.postExtrapolation)},set:function(t){this._curve.postExtrapolation=Dd(t)}}]),t}();function Dd(t){switch(t){default:case Wu.Default:case Wu.Normal:case Wu.Clamp:return th.CLAMP;case Wu.PingPong:return th.PING_PONG;case Wu.Loop:return th.LOOP}}function Bd(t){switch(t){default:case th.LINEAR:case th.CLAMP:return Wu.Clamp;case th.PING_PONG:return Wu.PingPong;case th.LOOP:return Wu.Loop}}Pd.defaultKF=[{time:0,value:1,inTangent:0,outTangent:0},{time:1,value:1,inTangent:0,outTangent:0}],hi.fastDefine("cc.AnimationCurve",Pd,{_curve:null}),function(t){t[t.LINEAR=0]="LINEAR",t[t.BEZIER=1]="BEZIER",t[t.CATMULL_ROM=2]="CATMULL_ROM"}(Od||(Od={}));var Nd=4294967295,Md=new ji,Ld=new ji,Fd=new ji,Ud=new ji,Gd=function(){function t(t,e){void 0===t&&(t=Od.CATMULL_ROM),void 0===e&&(e=[]),this._type=void 0,this._mode=Od.CATMULL_ROM,this._knots=[],this._type=co.SHAPE_SPLINE,this._mode=t;for(var i=0;i<e.length;i++)this._knots[i]=new ji(e[i])}t.create=function(e,i){return void 0===i&&(i=[]),new t(e,i)},t.clone=function(e){return new t(e.mode,e.knots)},t.copy=function(t,e){t._mode=e.mode,t._knots.length=0;for(var i=e.knots,n=i.length,r=0;r<n;r++)t._knots[r]=new ji(i[r]);return t};var e=t.prototype;return e.setModeAndKnots=function(t,e){this._mode=t,this._knots.length=0;for(var i=0;i<e.length;i++)this._knots[i]=new ji(e[i])},e.clearKnots=function(){this._knots.length=0},e.getKnotCount=function(){return this._knots.length},e.addKnot=function(t){this._knots.push(new ji(t))},e.insertKnot=function(t,e){var i=new ji(e);t>=this._knots.length?this._knots.push(i):this._knots.splice(t,0,i)},e.removeKnot=function(t){t>=0&&this._knots.length,this._knots.splice(t,1)},e.setKnot=function(t,e){t>=0&&this._knots.length,this._knots[t].set(e)},e.getKnot=function(t){return t>=0&&this._knots.length,this._knots[t]},e.getPoint=function(e,i){void 0===i&&(i=Nd),e=vi(e,0,1);var n=this.getSegments();if(0==n)return new ji(0,0,0);if(i==Nd){var r=1/n;i=Math.floor(e/r),e=e%r/r}if(i>=n)return new ji(this._knots[this._knots.length-1]);switch(this._mode){case Od.LINEAR:return t.calcLinear(this._knots[i],this._knots[i+1],e);case Od.BEZIER:return t.calcBezier(this._knots[4*i],this._knots[4*i+1],this._knots[4*i+2],this._knots[4*i+3],e);case Od.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 t.calcCatmullRom(s,this._knots[i],this._knots[i+1],a,e);default:return new ji(0,0,0)}},e.getPoints=function(t,e){if(void 0===e&&(e=Nd),0==t)return[];if(1==t)return[this.getPoint(0,e)];for(var i=[],n=1/(t-1),r=0;r<t;r++){var s=r*n,a=this.getPoint(s,e);i.push(a)}return i},e.getSegments=function(){var t=this._knots.length;switch(this._mode){case Od.LINEAR:case Od.CATMULL_ROM:return t<2?(j(14300),0):t-1;case Od.BEZIER:return t<4||t%4!=0?(j(14301),0):t/4}},t.calcLinear=function(t,e,i){var n=new ji;return ji.multiplyScalar(Md,t,1-i),ji.multiplyScalar(Ld,e,i),ji.add(n,Md,Ld),n},t.calcBezier=function(t,e,i,n,r){var s=new ji,a=1-r;return ji.multiplyScalar(Md,t,a*a*a),ji.multiplyScalar(Ld,e,3*r*a*a),ji.multiplyScalar(Fd,i,3*r*r*a),ji.multiplyScalar(Ud,n,r*r*r),ji.add(Md,Md,Ld),ji.add(Fd,Fd,Ud),ji.add(s,Md,Fd),s},t.calcCatmullRom=function(t,e,i,n,r){var s=new ji,a=r*r,o=a*r;return ji.multiplyScalar(Md,t,-.5*o+a-.5*r),ji.multiplyScalar(Ld,e,1.5*o-2.5*a+1),ji.multiplyScalar(Fd,i,-1.5*o+2*a+.5*r),ji.multiplyScalar(Ud,n,.5*o-.5*a),ji.add(Md,Md,Ld),ji.add(Fd,Fd,Ud),ji.add(s,Md,Fd),s},h(t,[{key:"type",get:function(){return this._type}},{key:"mode",get:function(){return this._mode}},{key:"knots",get:function(){return this._knots}}]),t}();function kd(t,e){console.warn(t+" is deprecated, please use "+e+" instead.")}et(bu,"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 zd=function(t){function e(){var e;return e=t.call(this)||this,kd("line","Line"),e}return c(e,t),e}(_o),Hd=function(t){function e(){var e;return e=t.call(this)||this,kd("plane","Plane"),e}return c(e,t),e}(xu),Vd=function(t){function e(){var e;return e=t.call(this)||this,kd("ray","Ray"),e}return c(e,t),e}(fo),Wd=function(t){function e(){var e;return e=t.call(this)||this,kd("triangle","Triangle"),e}return c(e,t),e}(So),Xd=function(t){function e(){var e;return e=t.call(this)||this,kd("sphere","Sphere"),e}return c(e,t),e}(To),jd=function(t){function e(){var e;return e=t.call(this)||this,kd("aabb","AABB"),e}return c(e,t),e}(Fu),Yd=function(t){function e(){var e;return e=t.call(this)||this,kd("obb","OBB"),e}return c(e,t),e}(zu),Kd=function(t){function e(){var e;return e=t.call(this)||this,kd("capsule","Capsule"),e}return c(e,t),e}(Hu),qd=function(t){function e(){var e;return e=t.call(this)||this,kd("frustum","Frustum"),e}return c(e,t),e}(qu),Qd=Object.freeze({__proto__:null,distance:lo,enums:co,intersect:bu,Line:_o,Plane:xu,Ray:fo,Triangle:So,Sphere:To,AABB:Fu,OBB:zu,Capsule:Hu,Frustum:qu,Keyframe:Id,AnimationCurve:Pd,get SplineMode(){return Od},Spline:Gd,get ERaycastMode(){return Eo},line:zd,plane:Hd,ray:Vd,triangle:Wd,sphere:Xd,aabb:jd,obb:Yd,capsule:Kd,frustum:qd});t("geometry",Qd);var Zd={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},Jd=t("Layers",function(){function t(){}return t.init=function(){var e=ye.querySettings(ve.Category.ENGINE,"customLayers");if(e)for(var i=0;i<e.length;i++){var n=e[i];t.addLayer(n.name,n.bit)}},t.makeMaskInclude=function(t){for(var e,i=0,n=y(t);!(e=n()).done;)i|=e.value;return i},t.makeMaskExclude=function(e){return~t.makeMaskInclude(e)},t.addLayer=function(e,i){if(void 0!==i)if(i>19||i<0)console.warn("maximum layers reached.");else{var n=1<<i;t.Enum[e],J(2104,e),t.Enum[e]=n,le.value(t.Enum,String(n),e),t.BitMask[e]=n,le.value(t.BitMask,String(n),e)}else console.warn("bitNum can't be undefined")},t.deleteLayer=function(e){if(e>19||e<0)console.warn("do not change buildin layers.");else{var i=1<<e;delete t.Enum[t.Enum[i]],delete t.Enum[i],delete t.BitMask[t.BitMask[i]],delete t.BitMask[i]}},t.nameToLayer=function(e){return void 0===e?(console.warn("name can't be undefined"),-1):i(t.Enum[e])},t.layerToName=function(e){return e>31||e<0?(console.warn("Unable to access unknown layer."),""):t.Enum[1<<e]},t}());Jd.Enum=_e(Zd),Jd.BitMask=ce(l({},Zd)),b.Layers=Jd;var $d,tp,ep="MainFlow",ip="ForwardFlow",np="ShadowFlow";!function(t){t[t.DEFAULT=100]="DEFAULT",t[t.UI=200]="UI"}($d||($d={})),b.RenderPassStage=$d,function(t){t[t.MIN=0]="MIN",t[t.MAX=255]="MAX",t[t.DEFAULT=128]="DEFAULT"}(tp||(tp={}));var rp,sp={bindings:[],layouts:{}},ap={bindings:[],layouts:{}};!function(t){t[t.UBO_GLOBAL=0]="UBO_GLOBAL",t[t.UBO_CAMERA=1]="UBO_CAMERA",t[t.UBO_SHADOW=2]="UBO_SHADOW",t[t.UBO_CSM=3]="UBO_CSM",t[t.SAMPLER_SHADOWMAP=4]="SAMPLER_SHADOWMAP",t[t.SAMPLER_ENVIRONMENT=5]="SAMPLER_ENVIRONMENT",t[t.SAMPLER_SPOT_SHADOW_MAP=6]="SAMPLER_SPOT_SHADOW_MAP",t[t.SAMPLER_DIFFUSEMAP=7]="SAMPLER_DIFFUSEMAP",t[t.COUNT=8]="COUNT"}(rp||(rp={}));var op,up=rp.SAMPLER_SHADOWMAP,hp=rp.COUNT-up;!function(t){t[t.UBO_LOCAL=0]="UBO_LOCAL",t[t.UBO_FORWARD_LIGHTS=1]="UBO_FORWARD_LIGHTS",t[t.UBO_SKINNING_ANIMATION=2]="UBO_SKINNING_ANIMATION",t[t.UBO_SKINNING_TEXTURE=3]="UBO_SKINNING_TEXTURE",t[t.UBO_MORPH=4]="UBO_MORPH",t[t.UBO_UI_LOCAL=5]="UBO_UI_LOCAL",t[t.SAMPLER_JOINTS=6]="SAMPLER_JOINTS",t[t.SAMPLER_MORPH_POSITION=7]="SAMPLER_MORPH_POSITION",t[t.SAMPLER_MORPH_NORMAL=8]="SAMPLER_MORPH_NORMAL",t[t.SAMPLER_MORPH_TANGENT=9]="SAMPLER_MORPH_TANGENT",t[t.SAMPLER_LIGHTMAP=10]="SAMPLER_LIGHTMAP",t[t.SAMPLER_SPRITE=11]="SAMPLER_SPRITE",t[t.SAMPLER_REFLECTION=12]="SAMPLER_REFLECTION",t[t.STORAGE_REFLECTION=13]="STORAGE_REFLECTION",t[t.COUNT=14]="COUNT"}(op||(op={}));var lp,cp=op.SAMPLER_JOINTS,_p=op.STORAGE_REFLECTION-cp,fp=op.COUNT-cp-_p;!function(t){t[t.GLOBAL=0]="GLOBAL",t[t.MATERIAL=1]="MATERIAL",t[t.LOCAL=2]="LOCAL"}(lp||(lp={}));var dp=new Dr([up,0,cp],[hp,0,_p],[0,0,0],[0,0,0],[0,0,0],[0,0,fp],[0,0,0],[0,2,1]),pp=function(){};pp.SIZE=4*(pp.COUNT=4+(pp.DEBUG_VIEW_COMPOSITE_PACK_3_OFFSET=4+(pp.DEBUG_VIEW_COMPOSITE_PACK_2_OFFSET=4+(pp.DEBUG_VIEW_COMPOSITE_PACK_1_OFFSET=4+(pp.DEBUG_VIEW_MODE_OFFSET=4+(pp.NATIVE_SIZE_OFFSET=4+(pp.SCREEN_SIZE_OFFSET=4+(pp.TIME_OFFSET=0)))))))),pp.NAME="CCGlobal",pp.BINDING=rp.UBO_GLOBAL,pp.DESCRIPTOR=new ls(pp.BINDING,or.UNIFORM_BUFFER,1,qn.ALL),pp.LAYOUT=new Wr(lp.GLOBAL,pp.BINDING,pp.NAME,[new Vr("cc_time",Pn.FLOAT4,1),new Vr("cc_screenSize",Pn.FLOAT4,1),new Vr("cc_nativeSize",Pn.FLOAT4,1),new Vr("cc_debug_view_mode",Pn.FLOAT,4),new Vr("cc_debug_view_composite_pack_1",Pn.FLOAT,4),new Vr("cc_debug_view_composite_pack_2",Pn.FLOAT,4),new Vr("cc_debug_view_composite_pack_3",Pn.FLOAT,4)],1),sp.layouts[pp.NAME]=pp.LAYOUT,sp.bindings[pp.BINDING]=pp.DESCRIPTOR;var mp=function(){};mp.SIZE=4*(mp.COUNT=4+(mp.VIEW_PORT_OFFSET=4+(mp.NEAR_FAR_OFFSET=4+(mp.GLOBAL_FOG_ADD_OFFSET=4+(mp.GLOBAL_FOG_BASE_OFFSET=4+(mp.GLOBAL_FOG_COLOR_OFFSET=4+(mp.AMBIENT_GROUND_OFFSET=4+(mp.AMBIENT_SKY_OFFSET=4+(mp.MAIN_LIT_COLOR_OFFSET=4+(mp.MAIN_LIT_DIR_OFFSET=4+(mp.EXPOSURE_OFFSET=4+(mp.SCREEN_SCALE_OFFSET=4+(mp.SURFACE_TRANSFORM_OFFSET=4+(mp.CAMERA_POS_OFFSET=16+(mp.MAT_VIEW_PROJ_INV_OFFSET=16+(mp.MAT_VIEW_PROJ_OFFSET=16+(mp.MAT_PROJ_INV_OFFSET=16+(mp.MAT_PROJ_OFFSET=16+(mp.MAT_VIEW_INV_OFFSET=16+(mp.MAT_VIEW_OFFSET=0)))))))))))))))))))),mp.NAME="CCCamera",mp.BINDING=rp.UBO_CAMERA,mp.DESCRIPTOR=new ls(mp.BINDING,or.UNIFORM_BUFFER,1,qn.ALL),mp.LAYOUT=new Wr(lp.GLOBAL,mp.BINDING,mp.NAME,[new Vr("cc_matView",Pn.MAT4,1),new Vr("cc_matViewInv",Pn.MAT4,1),new Vr("cc_matProj",Pn.MAT4,1),new Vr("cc_matProjInv",Pn.MAT4,1),new Vr("cc_matViewProj",Pn.MAT4,1),new Vr("cc_matViewProjInv",Pn.MAT4,1),new Vr("cc_cameraPos",Pn.FLOAT4,1),new Vr("cc_surfaceTransform",Pn.FLOAT4,1),new Vr("cc_screenScale",Pn.FLOAT4,1),new Vr("cc_exposure",Pn.FLOAT4,1),new Vr("cc_mainLitDir",Pn.FLOAT4,1),new Vr("cc_mainLitColor",Pn.FLOAT4,1),new Vr("cc_ambientSky",Pn.FLOAT4,1),new Vr("cc_ambientGround",Pn.FLOAT4,1),new Vr("cc_fogColor",Pn.FLOAT4,1),new Vr("cc_fogBase",Pn.FLOAT4,1),new Vr("cc_fogAdd",Pn.FLOAT4,1),new Vr("cc_nearFar",Pn.FLOAT4,1),new Vr("cc_viewPort",Pn.FLOAT4,1)],1),sp.layouts[mp.NAME]=mp.LAYOUT,sp.bindings[mp.BINDING]=mp.DESCRIPTOR;var gp=function(){};gp.SIZE=4*(gp.COUNT=4+(gp.PLANAR_NORMAL_DISTANCE_INFO_OFFSET=4+(gp.SHADOW_COLOR_OFFSET=4+(gp.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET=4+(gp.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET=4+(gp.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET=4+(gp.SHADOW_PROJ_INFO_OFFSET=4+(gp.SHADOW_PROJ_DEPTH_INFO_OFFSET=4+(gp.SHADOW_INV_PROJ_DEPTH_INFO_OFFSET=16+(gp.MAT_LIGHT_VIEW_PROJ_OFFSET=16+(gp.MAT_LIGHT_VIEW_OFFSET=0))))))))))),gp.NAME="CCShadow",gp.BINDING=rp.UBO_SHADOW,gp.DESCRIPTOR=new ls(gp.BINDING,or.UNIFORM_BUFFER,1,qn.ALL),gp.LAYOUT=new Wr(lp.GLOBAL,gp.BINDING,gp.NAME,[new Vr("cc_matLightView",Pn.MAT4,1),new Vr("cc_matLightViewProj",Pn.MAT4,1),new Vr("cc_shadowInvProjDepthInfo",Pn.FLOAT4,1),new Vr("cc_shadowProjDepthInfo",Pn.FLOAT4,1),new Vr("cc_shadowProjInfo",Pn.FLOAT4,1),new Vr("cc_shadowNFLSInfo",Pn.FLOAT4,1),new Vr("cc_shadowWHPBInfo",Pn.FLOAT4,1),new Vr("cc_shadowLPNNInfo",Pn.FLOAT4,1),new Vr("cc_shadowColor",Pn.FLOAT4,1),new Vr("cc_planarNDInfo",Pn.FLOAT4,1)],1),sp.layouts[gp.NAME]=gp.LAYOUT,sp.bindings[gp.BINDING]=gp.DESCRIPTOR;var vp=function(){};vp.CSM_LEVEL_COUNT=4,vp.SIZE=4*(vp.COUNT=4+(vp.CSM_SPLITS_INFO_OFFSET=(vp.CSM_PROJ_INFO_OFFSET=(vp.CSM_PROJ_DEPTH_INFO_OFFSET=(vp.MAT_CSM_VIEW_PROJ_OFFSET=(vp.CSM_ATLAS_OFFSET=(vp.CSM_VIEW_DIR_2_OFFSET=(vp.CSM_VIEW_DIR_1_OFFSET=(vp.CSM_VIEW_DIR_0_OFFSET=0)+4*vp.CSM_LEVEL_COUNT)+4*vp.CSM_LEVEL_COUNT)+4*vp.CSM_LEVEL_COUNT)+4*vp.CSM_LEVEL_COUNT)+16*vp.CSM_LEVEL_COUNT)+4*vp.CSM_LEVEL_COUNT)+4*vp.CSM_LEVEL_COUNT)),vp.NAME="CCCSM",vp.BINDING=rp.UBO_CSM,vp.DESCRIPTOR=new ls(vp.BINDING,or.UNIFORM_BUFFER,1,qn.ALL),vp.LAYOUT=new Wr(lp.GLOBAL,vp.BINDING,vp.NAME,[new Vr("cc_csmViewDir0",Pn.FLOAT4,vp.CSM_LEVEL_COUNT),new Vr("cc_csmViewDir1",Pn.FLOAT4,vp.CSM_LEVEL_COUNT),new Vr("cc_csmViewDir2",Pn.FLOAT4,vp.CSM_LEVEL_COUNT),new Vr("cc_csmAtlas",Pn.FLOAT4,vp.CSM_LEVEL_COUNT),new Vr("cc_matCSMViewProj",Pn.MAT4,vp.CSM_LEVEL_COUNT),new Vr("cc_csmProjDepthInfo",Pn.FLOAT4,vp.CSM_LEVEL_COUNT),new Vr("cc_csmProjInfo",Pn.FLOAT4,vp.CSM_LEVEL_COUNT),new Vr("cc_csmSplitsInfo",Pn.FLOAT4,1)],1),sp.layouts[vp.NAME]=vp.LAYOUT,sp.bindings[vp.BINDING]=vp.DESCRIPTOR;var yp=rp.SAMPLER_SHADOWMAP,Ep=new ls(yp,or.SAMPLER_TEXTURE,1,qn.FRAGMENT),Tp=new Xr(lp.GLOBAL,yp,"cc_shadowMap",Pn.SAMPLER2D,1);sp.layouts.cc_shadowMap=Tp,sp.bindings[yp]=Ep;var Sp=rp.SAMPLER_ENVIRONMENT,Ap=new ls(Sp,or.SAMPLER_TEXTURE,1,qn.FRAGMENT),Rp=new Xr(lp.GLOBAL,Sp,"cc_environment",Pn.SAMPLER_CUBE,1);sp.layouts.cc_environment=Rp,sp.bindings[Sp]=Ap;var bp=rp.SAMPLER_DIFFUSEMAP,Cp=new ls(bp,or.SAMPLER_TEXTURE,1,qn.FRAGMENT),wp=new Xr(lp.GLOBAL,bp,"cc_diffuseMap",Pn.SAMPLER_CUBE,1);sp.layouts.cc_diffuseMap=wp,sp.bindings[bp]=Cp;var Ip=rp.SAMPLER_SPOT_SHADOW_MAP,Op=new ls(Ip,or.SAMPLER_TEXTURE,1,qn.FRAGMENT),xp=new Xr(lp.GLOBAL,Ip,"cc_spotShadowMap",Pn.SAMPLER2D,1);sp.layouts.cc_spotShadowMap=xp,sp.bindings[Ip]=Op;var Pp=function(){};Pp.SIZE=4*(Pp.COUNT=4+(Pp.LOCAL_SHADOW_BIAS=4+(Pp.LIGHTINGMAP_UVPARAM=16+(Pp.MAT_WORLD_IT_OFFSET=16+(Pp.MAT_WORLD_OFFSET=0))))),Pp.NAME="CCLocal",Pp.BINDING=op.UBO_LOCAL,Pp.DESCRIPTOR=new ls(Pp.BINDING,or.UNIFORM_BUFFER,1,qn.VERTEX|qn.COMPUTE),Pp.LAYOUT=new Wr(lp.LOCAL,Pp.BINDING,Pp.NAME,[new Vr("cc_matWorld",Pn.MAT4,1),new Vr("cc_matWorldIT",Pn.MAT4,1),new Vr("cc_lightingMapUVParam",Pn.FLOAT4,1),new Vr("cc_localShadowBias",Pn.FLOAT4,1)],1),ap.layouts[Pp.NAME]=Pp.LAYOUT,ap.bindings[Pp.BINDING]=Pp.DESCRIPTOR;var Dp=function(){};Dp.SIZE=4*(Dp.COUNT=4+(Dp.WORLD_BOUND_HALF_EXTENTS=4+(Dp.WORLD_BOUND_CENTER=0))),Dp.NAME="CCWorldBound",Dp.BINDING=op.UBO_LOCAL,Dp.DESCRIPTOR=new ls(Dp.BINDING,or.UNIFORM_BUFFER,1,qn.VERTEX|qn.COMPUTE),Dp.LAYOUT=new Wr(lp.LOCAL,Dp.BINDING,Dp.NAME,[new Vr("cc_worldBoundCenter",Pn.FLOAT4,1),new Vr("cc_worldBoundHalfExtents",Pn.FLOAT4,1)],1),ap.layouts[Dp.NAME]=Dp.LAYOUT,ap.bindings[Dp.BINDING]=Dp.DESCRIPTOR;var Bp="a_matWorld0",Np=function(){};Np.BATCHING_COUNT=10,Np.MAT_WORLDS_OFFSET=0,Np.SIZE=4*(Np.COUNT=16*Np.BATCHING_COUNT),Np.NAME="CCLocalBatched",Np.BINDING=op.UBO_LOCAL,Np.DESCRIPTOR=new ls(Np.BINDING,or.UNIFORM_BUFFER,1,qn.VERTEX|qn.COMPUTE),Np.LAYOUT=new Wr(lp.LOCAL,Np.BINDING,Np.NAME,[new Vr("cc_matWorlds",Pn.MAT4,Np.BATCHING_COUNT)],1),ap.layouts[Np.NAME]=Np.LAYOUT,ap.bindings[Np.BINDING]=Np.DESCRIPTOR;var Mp=function(){};Mp.LIGHTS_PER_PASS=1,Mp.SIZE=4*(Mp.COUNT=(Mp.LIGHT_DIR_OFFSET=(Mp.LIGHT_SIZE_RANGE_ANGLE_OFFSET=(Mp.LIGHT_COLOR_OFFSET=(Mp.LIGHT_POS_OFFSET=0)+4*Mp.LIGHTS_PER_PASS)+4*Mp.LIGHTS_PER_PASS)+4*Mp.LIGHTS_PER_PASS)+4*Mp.LIGHTS_PER_PASS),Mp.NAME="CCForwardLight",Mp.BINDING=op.UBO_FORWARD_LIGHTS,Mp.DESCRIPTOR=new ls(Mp.BINDING,or.DYNAMIC_UNIFORM_BUFFER,1,qn.FRAGMENT),Mp.LAYOUT=new Wr(lp.LOCAL,Mp.BINDING,Mp.NAME,[new Vr("cc_lightPos",Pn.FLOAT4,Mp.LIGHTS_PER_PASS),new Vr("cc_lightColor",Pn.FLOAT4,Mp.LIGHTS_PER_PASS),new Vr("cc_lightSizeRangeAngle",Pn.FLOAT4,Mp.LIGHTS_PER_PASS),new Vr("cc_lightDir",Pn.FLOAT4,Mp.LIGHTS_PER_PASS)],1),ap.layouts[Mp.NAME]=Mp.LAYOUT,ap.bindings[Mp.BINDING]=Mp.DESCRIPTOR;var Lp=function(){};Lp.LIGHTS_PER_PASS=10;var Fp=function(){};Fp.SIZE=4*(Fp.COUNT=4+(Fp.JOINTS_TEXTURE_INFO_OFFSET=0)),Fp.NAME="CCSkinningTexture",Fp.BINDING=op.UBO_SKINNING_TEXTURE,Fp.DESCRIPTOR=new ls(Fp.BINDING,or.UNIFORM_BUFFER,1,qn.VERTEX),Fp.LAYOUT=new Wr(lp.LOCAL,Fp.BINDING,Fp.NAME,[new Vr("cc_jointTextureInfo",Pn.FLOAT4,1)],1),ap.layouts[Fp.NAME]=Fp.LAYOUT,ap.bindings[Fp.BINDING]=Fp.DESCRIPTOR;var Up=function(){};Up.SIZE=4*(Up.COUNT=4+(Up.JOINTS_ANIM_INFO_OFFSET=0)),Up.NAME="CCSkinningAnimation",Up.BINDING=op.UBO_SKINNING_ANIMATION,Up.DESCRIPTOR=new ls(Up.BINDING,or.UNIFORM_BUFFER,1,qn.VERTEX),Up.LAYOUT=new Wr(lp.LOCAL,Up.BINDING,Up.NAME,[new Vr("cc_jointAnimInfo",Pn.FLOAT4,1)],1),ap.layouts[Up.NAME]=Up.LAYOUT,ap.bindings[Up.BINDING]=Up.DESCRIPTOR;var Gp=function(){function t(){}return t.initLayout=function(e){t._jointUniformCapacity=e,t._count=12*e,t._size=4*t._count,t.LAYOUT.members[0].count=3*e},h(t,null,[{key:"JOINT_UNIFORM_CAPACITY",get:function(){return t._jointUniformCapacity}},{key:"COUNT",get:function(){return t._count}},{key:"SIZE",get:function(){return t._size}}]),t}();function kp(t){Gp.initLayout(t),ap.layouts[Gp.NAME]=Gp.LAYOUT,ap.bindings[Gp.BINDING]=Gp.DESCRIPTOR}Gp._jointUniformCapacity=0,Gp._count=0,Gp._size=0,Gp.NAME="CCSkinning",Gp.BINDING=op.UBO_SKINNING_TEXTURE,Gp.DESCRIPTOR=new ls(Gp.BINDING,or.UNIFORM_BUFFER,1,qn.VERTEX),Gp.LAYOUT=new Wr(lp.LOCAL,Gp.BINDING,Gp.NAME,[new Vr("cc_joints",Pn.FLOAT4,1)],1);var zp=function(){};zp.MAX_MORPH_TARGET_COUNT=60,zp.OFFSET_OF_WEIGHTS=0,zp.OFFSET_OF_VERTICES_COUNT=4+(zp.OFFSET_OF_DISPLACEMENT_TEXTURE_HEIGHT=4+(zp.OFFSET_OF_DISPLACEMENT_TEXTURE_WIDTH=4*zp.MAX_MORPH_TARGET_COUNT)),zp.COUNT_BASE_4_BYTES=4*Math.ceil(zp.MAX_MORPH_TARGET_COUNT/4)+4,zp.SIZE=4*zp.COUNT_BASE_4_BYTES,zp.NAME="CCMorph",zp.BINDING=op.UBO_MORPH,zp.DESCRIPTOR=new ls(zp.BINDING,or.UNIFORM_BUFFER,1,qn.VERTEX),zp.LAYOUT=new Wr(lp.LOCAL,zp.BINDING,zp.NAME,[new Vr("cc_displacementWeights",Pn.FLOAT4,zp.MAX_MORPH_TARGET_COUNT/4),new Vr("cc_displacementTextureInfo",Pn.FLOAT4,1)],1),ap.layouts[zp.NAME]=zp.LAYOUT,ap.bindings[zp.BINDING]=zp.DESCRIPTOR;var Hp=function(){};Hp.NAME="CCUILocal",Hp.BINDING=op.UBO_UI_LOCAL,Hp.DESCRIPTOR=new ls(Hp.BINDING,or.DYNAMIC_UNIFORM_BUFFER,1,qn.VERTEX),Hp.LAYOUT=new Wr(lp.LOCAL,Hp.BINDING,Hp.NAME,[new Vr("cc_local_data",Pn.FLOAT4,1)],1),ap.layouts[Hp.NAME]=Hp.LAYOUT,ap.bindings[Hp.BINDING]=Hp.DESCRIPTOR;var Vp=op.SAMPLER_JOINTS,Wp=new ls(Vp,or.SAMPLER_TEXTURE,1,qn.VERTEX),Xp=new Xr(lp.LOCAL,Vp,"cc_jointTexture",Pn.SAMPLER2D,1);ap.layouts.cc_jointTexture=Xp,ap.bindings[Vp]=Wp;var jp=op.SAMPLER_JOINTS,Yp=new ls(jp,or.SAMPLER_TEXTURE,1,qn.VERTEX),Kp=new Xr(lp.LOCAL,jp,"cc_realtimeJoint",Pn.SAMPLER2D,1);ap.layouts.cc_realtimeJoint=Kp,ap.bindings[jp]=Yp;var qp=op.SAMPLER_MORPH_POSITION,Qp=new ls(qp,or.SAMPLER_TEXTURE,1,qn.VERTEX),Zp=new Xr(lp.LOCAL,qp,"cc_PositionDisplacements",Pn.SAMPLER2D,1);ap.layouts.cc_PositionDisplacements=Zp,ap.bindings[qp]=Qp;var Jp=op.SAMPLER_MORPH_NORMAL,$p=new ls(Jp,or.SAMPLER_TEXTURE,1,qn.VERTEX),tm=new Xr(lp.LOCAL,Jp,"cc_NormalDisplacements",Pn.SAMPLER2D,1);ap.layouts.cc_NormalDisplacements=tm,ap.bindings[Jp]=$p;var em=op.SAMPLER_MORPH_TANGENT,im=new ls(em,or.SAMPLER_TEXTURE,1,qn.VERTEX),nm=new Xr(lp.LOCAL,em,"cc_TangentDisplacements",Pn.SAMPLER2D,1);ap.layouts.cc_TangentDisplacements=nm,ap.bindings[em]=im;var rm=op.SAMPLER_LIGHTMAP,sm=new ls(rm,or.SAMPLER_TEXTURE,1,qn.FRAGMENT),am=new Xr(lp.LOCAL,rm,"cc_lightingMap",Pn.SAMPLER2D,1);ap.layouts.cc_lightingMap=am,ap.bindings[rm]=sm;var om=op.SAMPLER_SPRITE,um=new ls(om,or.SAMPLER_TEXTURE,1,qn.FRAGMENT),hm=new Xr(lp.LOCAL,om,"cc_spriteTexture",Pn.SAMPLER2D,1);ap.layouts.cc_spriteTexture=hm,ap.bindings[om]=um;var lm=op.SAMPLER_REFLECTION,cm=new ls(lm,or.SAMPLER_TEXTURE,1,qn.FRAGMENT),_m=new Xr(lp.LOCAL,lm,"cc_reflectionTexture",Pn.SAMPLER2D,1);ap.layouts.cc_reflectionTexture=_m,ap.bindings[lm]=cm;var fm=op.STORAGE_REFLECTION,dm=new ls(fm,or.STORAGE_IMAGE,1,qn.COMPUTE),pm=new Kr(lp.LOCAL,fm,"cc_reflectionStorage",Pn.IMAGE2D,1);ap.layouts.cc_reflectionStorage=pm,ap.bindings[fm]=dm;var mm,gm,vm=Jd.makeMaskExclude([Jd.BitMask.UI_2D,Jd.BitMask.GIZMOS,Jd.BitMask.EDITOR,Jd.BitMask.SCENE_GIZMO,Jd.BitMask.PROFILER]),ym=Jd.makeMaskExclude([Jd.BitMask.UI_2D,Jd.BitMask.PROFILER]),Em=Jd.Enum.ALL;function Tm(t){return(t.getFormatFeatures(On.R32F)&(Gn.RENDER_TARGET|Gn.SAMPLED_TEXTURE))==(Gn.RENDER_TARGET|Gn.SAMPLED_TEXTURE)&&!(t.gfxAPI===Cn.WEBGL)}t("pipeline",Object.freeze({__proto__:null,PIPELINE_FLOW_MAIN:ep,PIPELINE_FLOW_FORWARD:ip,PIPELINE_FLOW_SHADOW:np,PIPELINE_FLOW_SMAA:"SMAAFlow",PIPELINE_FLOW_TONEMAP:"ToneMapFlow",get RenderPassStage(){return $d},get RenderPriority(){return tp},globalDescriptorSetLayout:sp,localDescriptorSetLayout:ap,get PipelineGlobalBindings(){return rp},get ModelLocalBindings(){return op},get SetIndex(){return lp},bindingMappingInfo:dp,UBOGlobal:pp,UBOCamera:mp,UBOShadow:gp,UBOCSM:vp,UNIFORM_SHADOWMAP_BINDING:yp,UNIFORM_ENVIRONMENT_BINDING:Sp,UNIFORM_DIFFUSEMAP_BINDING:bp,UNIFORM_SPOT_SHADOW_MAP_TEXTURE_BINDING:Ip,UBOLocal:Pp,UBOWorldBound:Dp,INST_MAT_WORLD:Bp,UBOLocalBatched:Np,UBOForwardLight:Mp,UBODeferredLight:Lp,JOINT_UNIFORM_CAPACITY:30,UBOSkinningTexture:Fp,UBOSkinningAnimation:Up,INST_JOINT_ANIM_INFO:"a_jointAnimInfo",UBOSkinning:Gp,localDescriptorSetLayout_ResizeMaxJoints:kp,UBOMorph:zp,UBOUILocal:Hp,UNIFORM_JOINT_TEXTURE_BINDING:Vp,UNIFORM_REALTIME_JOINT_TEXTURE_BINDING:jp,UNIFORM_POSITION_MORPH_TEXTURE_BINDING:qp,UNIFORM_NORMAL_MORPH_TEXTURE_BINDING:Jp,UNIFORM_TANGENT_MORPH_TEXTURE_BINDING:em,UNIFORM_LIGHTMAP_TEXTURE_BINDING:rm,UNIFORM_SPRITE_TEXTURE_BINDING:om,UNIFORM_REFLECTION_TEXTURE_BINDING:lm,UNIFORM_REFLECTION_STORAGE_BINDING:fm,CAMERA_DEFAULT_MASK:vm,CAMERA_EDITOR_MASK:ym,MODEL_ALWAYS_MASK:Em,supportsR16HalfFloatTexture:function(t){return(t.getFormatFeatures(On.R16F)&(Gn.RENDER_TARGET|Gn.SAMPLED_TEXTURE))==(Gn.RENDER_TARGET|Gn.SAMPLED_TEXTURE)},supportsR32FloatTexture:Tm}));var Sm=4227858432,Am=66060288,Rm=1044480,bm=function(t,e,i,n){return void 0===n&&(n=0),e<<26&Sm|t<<20&Am|i<<12&Rm|4095&n},Cm=function(t){return(t&Sm)>>>26},wm=function(t){return(t&Am)>>>20},Im=function(t){return(t&Rm)>>>12},Om=function(t){return 4095&t},xm=function(t,e){return 67108863&t|e<<26&Sm},Pm=((mm={})[Pn.UNKNOWN]=function(){return console.warn("illegal uniform handle")},mm[Pn.INT]=function(t,e,i){return void 0===i&&(i=0),t[i]},mm[Pn.INT2]=function(t,e,i){return void 0===i&&(i=0),_n.fromArray(e,t,i)},mm[Pn.INT3]=function(t,e,i){return void 0===i&&(i=0),ji.fromArray(e,t,i)},mm[Pn.INT4]=function(t,e,i){return void 0===i&&(i=0),Li.fromArray(e,t,i)},mm[Pn.FLOAT]=function(t,e,i){return void 0===i&&(i=0),t[i]},mm[Pn.FLOAT2]=function(t,e,i){return void 0===i&&(i=0),_n.fromArray(e,t,i)},mm[Pn.FLOAT3]=function(t,e,i){return void 0===i&&(i=0),ji.fromArray(e,t,i)},mm[Pn.FLOAT4]=function(t,e,i){return void 0===i&&(i=0),Li.fromArray(e,t,i)},mm[Pn.MAT3]=function(t,e,i){return void 0===i&&(i=0),Qi.fromArray(e,t,i)},mm[Pn.MAT4]=function(t,e,i){return void 0===i&&(i=0),un.fromArray(e,t,i)},mm),Dm=((gm={})[Pn.UNKNOWN]=function(){return console.warn("illegal uniform handle")},gm[Pn.INT]=function(t,e,i){return void 0===i&&(i=0),t[i]=e},gm[Pn.INT2]=function(t,e,i){return void 0===i&&(i=0),_n.toArray(t,e,i)},gm[Pn.INT3]=function(t,e,i){return void 0===i&&(i=0),ji.toArray(t,e,i)},gm[Pn.INT4]=function(t,e,i){return void 0===i&&(i=0),Li.toArray(t,e,i)},gm[Pn.FLOAT]=function(t,e,i){return void 0===i&&(i=0),t[i]=e},gm[Pn.FLOAT2]=function(t,e,i){return void 0===i&&(i=0),_n.toArray(t,e,i)},gm[Pn.FLOAT3]=function(t,e,i){return void 0===i&&(i=0),ji.toArray(t,e,i)},gm[Pn.FLOAT4]=function(t,e,i){return void 0===i&&(i=0),Li.toArray(t,e,i)},gm[Pn.MAT3]=function(t,e,i){return void 0===i&&(i=0),Qi.toArray(t,e,i)},gm[Pn.MAT4]=function(t,e,i){return void 0===i&&(i=0),un.toArray(t,e,i)},gm),Bm=[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 Nm(t){switch(t){case Pn.BOOL:case Pn.INT:case Pn.UINT:case Pn.FLOAT:return Bm[0];case Pn.BOOL2:case Pn.INT2:case Pn.UINT2:case Pn.FLOAT2:return Bm[1];case Pn.BOOL4:case Pn.INT4:case Pn.UINT4:case Pn.FLOAT4:return Bm[2];case Pn.MAT4:return Bm[3];case Pn.SAMPLER2D:return"default-texture";case Pn.SAMPLER_CUBE:return"default-cube-texture";case Pn.SAMPLER2D_ARRAY:return"default-array-texture";case Pn.SAMPLER3D:return"default-3d-texture"}return Bm[0]}function Mm(t){switch(t){case Pn.SAMPLER2D:return"-texture";case Pn.SAMPLER_CUBE:return"-cube-texture";case Pn.SAMPLER2D_ARRAY:return"-array-texture";case Pn.SAMPLER3D:return"-3d-texture";default:return"-unknown"}}function Lm(t,e){for(var i=Object.entries(e),n=!1,r=0;r<i.length;r++)t[i[r][0]]!==i[r][1]&&(t[i[r][0]]=i[r][1],n=!0);return n}var Fm=new cs;function Um(t){return Math.ceil(Math.log2(Math.max(t,2)))}function Gm(t,e){switch(t.type){case"boolean":return"number"==typeof e?e.toString():e?"1":"0";case"string":return void 0!==e?e:t.options[0];case"number":return void 0!==e?e.toString():t.range[0].toString();default:return console.warn("unknown define type '"+t.type+"'"),"-1"}}function km(t,e,i,n,r){for(var s=t.builtins[n],a=[],o=function(t){var e=s.blocks[t],n=i.layouts[e.name],o=n&&i.bindings.find((function(t){return t.binding===n.binding}));if(!(n&&o&&o.descriptorType&Rs))return console.warn("builtin UBO '"+e.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(e.shaderInfo.blocks,a);for(var h=[],l=function(t){var e=s.samplerTextures[t],n=i.layouts[e.name],a=n&&i.bindings.find((function(t){return t.binding===n.binding}));if(!(n&&a&&a.descriptorType&bs))return console.warn("builtin samplerTexture '"+e.name+"' not available!"),"continue";h.push(n),r&&!r.includes(a)&&r.push(a)},c=0;c<s.samplerTextures.length;c++)l(c);Array.prototype.unshift.apply(e.shaderInfo.samplerTextures,h),r&&r.sort((function(t,e){return t.binding-e.binding}))}function zm(t){return t.members.reduce((function(t,e){return t+Ps(e.type)*e.count}),0)}function Hm(t,e){for(var i=0;i<t.length;i++){var n=t[i];if("!"===n[0]){if(e[n.slice(1)])return!1}else if(!e[n])return!1}return!0}function Vm(t){switch(t.gfxAPI){case Cn.GLES2:case Cn.WEBGL:return"glsl1";case Cn.GLES3:case Cn.WEBGL2:return"glsl3";default:return"glsl4"}}var Wm,Xm,jm,Ym,Km,qm,Qm,Zm,Jm=new(function(){function t(){this._templates={},this._cache={},this._templateInfos={}}var e=t.prototype;return e.register=function(t){for(var e=0;e<t.shaders.length;e++)this.define(t.shaders[e]).effectName=t.name;for(var i=0;i<t.techniques.length;i++)for(var n=t.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)}},e.define=function(t){var e=this._templates[t.name];if(e&&e.hash===t.hash)return e;for(var i=l({},t),n=0,r=function(t){var e=i.defines[t],r=1;if("number"===e.type){var s=e.range;r=Um(s[1]-s[0]+1),e._map=function(t){return t-s[0]}}else"string"===e.type?(r=Um(e.options.length),e._map=function(t){return Math.max(0,e.options.findIndex((function(e){return e===t})))}):"boolean"===e.type&&(e._map=function(t){return t?1:0});e._offset=n,n+=r},s=0;s<i.defines.length;s++)r(s);for(var a in n>31&&(i.uber=!0),i.constantMacros="",i.builtins.statistics)i.constantMacros+="#define "+a+" "+i.builtins.statistics[a]+"\n";if(this._templates[t.name]=i,!this._templateInfos[i.hash]){var o={};o.samplerStartBinding=i.blocks.length,o.shaderInfo=new $r,o.blockSizes=[],o.bindings=[];for(var u=0;u<i.blocks.length;u++){var h=i.blocks[u];o.blockSizes.push(zm(h)),o.bindings.push(new ls(h.binding,or.UNIFORM_BUFFER,1,h.stageFlags)),o.shaderInfo.blocks.push(new Wr(lp.MATERIAL,h.binding,h.name,h.members.map((function(t){return new Vr(t.name,t.type,t.count)})),1))}for(var c=0;c<i.samplerTextures.length;c++){var _=i.samplerTextures[c];o.bindings.push(new ls(_.binding,or.SAMPLER_TEXTURE,_.count,_.stageFlags)),o.shaderInfo.samplerTextures.push(new Xr(lp.MATERIAL,_.binding,_.name,_.type,_.count))}for(var f=0;f<i.samplers.length;f++){var d=i.samplers[f];o.bindings.push(new ls(d.binding,or.SAMPLER,d.count,d.stageFlags)),o.shaderInfo.samplers.push(new jr(lp.MATERIAL,d.binding,d.name,d.count))}for(var p=0;p<i.textures.length;p++){var m=i.textures[p];o.bindings.push(new ls(m.binding,or.TEXTURE,m.count,m.stageFlags)),o.shaderInfo.textures.push(new Yr(lp.MATERIAL,m.binding,m.name,m.type,m.count))}for(var g=0;g<i.buffers.length;g++){var v=i.buffers[g];o.bindings.push(new ls(v.binding,or.STORAGE_BUFFER,1,v.stageFlags)),o.shaderInfo.buffers.push(new qr(lp.MATERIAL,v.binding,v.name,1,v.memoryAccess))}for(var y=0;y<i.images.length;y++){var E=i.images[y];o.bindings.push(new ls(E.binding,or.STORAGE_IMAGE,E.count,E.stageFlags)),o.shaderInfo.images.push(new Kr(lp.MATERIAL,E.binding,E.name,E.type,E.count,E.memoryAccess))}for(var T=0;T<i.subpassInputs.length;T++){var S=i.subpassInputs[T];o.bindings.push(new ls(S.binding,or.INPUT_ATTACHMENT,S.count,S.stageFlags)),o.shaderInfo.subpassInputs.push(new Qr(lp.MATERIAL,S.binding,S.name,S.count))}o.gfxAttributes=[];for(var A=0;A<i.attributes.length;A++){var R=i.attributes[A];o.gfxAttributes.push(new Jr(R.name,R.format,R.isNormalized,0,R.isInstanced,R.location))}km(i,o,ap,"locals"),o.shaderInfo.stages.push(new Zr(qn.VERTEX,"")),o.shaderInfo.stages.push(new Zr(qn.FRAGMENT,"")),o.handleMap=function(t){for(var e={},i=0;i<t.blocks.length;i++)for(var n=t.blocks[i],r=n.members,s=0,a=0;a<r.length;a++){var o=r[a];e[o.name]=bm(n.binding,o.type,o.count,s),s+=(Ps(o.type)>>2)*o.count}for(var u=0;u<t.samplerTextures.length;u++){var h=t.samplerTextures[u];e[h.name]=bm(h.binding,h.type,h.count)}return e}(i),o.setLayouts=[],this._templateInfos[i.hash]=o}return i},e.getTemplate=function(t){return this._templates[t]},e.getTemplateInfo=function(t){var e=this._templates[t].hash;return this._templateInfos[e]},e.getDescriptorSetLayout=function(t,e,i){void 0===i&&(i=!1);var n=this._templates[e],r=this._templateInfos[n.hash];return r.setLayouts.length||(Fm.bindings=r.bindings,r.setLayouts[lp.MATERIAL]=t.createDescriptorSetLayout(Fm),Fm.bindings=ap.bindings,r.setLayouts[lp.LOCAL]=t.createDescriptorSetLayout(Fm)),r.setLayouts[i?lp.LOCAL:lp.MATERIAL]},e.hasProgram=function(t){return void 0!==this._templates[t]},e.getKey=function(t,e){var i=this._templates[t],n=i.defines;if(i.uber){for(var r="",s=0;s<n.length;s++){var a=n[s],o=e[a.name];if(o&&a._map){var u=a._map(o);r+=""+a._offset+u+"|"}}return""+r+i.hash}for(var h=0,l=0;l<n.length;l++){var c=n[l],_=e[c.name];_&&c._map&&(h|=c._map(_)<<c._offset)}return h.toString(16)+"|"+i.hash},e.destroyShaderByDefines=function(t){var e=this,i=Object.keys(t);if(i.length)for(var n=i.map((function(e){var i=t[e];return"boolean"==typeof i&&(i=i?"1":"0"),new RegExp(""+e+i)})),r=Object.keys(this._cache).filter((function(t){return n.every((function(i){return i.test(e._cache[t].name)}))})),s=0;s<r.length;s++){var a=r[s],o=this._cache[a];G("destroyed shader "+o.name),o.destroy(),delete this._cache[a]}},e.getGFXShader=function(t,e,i,n,r){Object.assign(i,n.macros),r||(r=this.getKey(e,i));var s=this._cache[r];if(s)return s;var a=this._templates[e],o=this._templateInfos[a.hash];o.pipelineLayout||(this.getDescriptorSetLayout(t,e),km(a,o,sp,"globals"),o.setLayouts[lp.GLOBAL]=n.descriptorSetLayout,o.pipelineLayout=t.createPipelineLayout(new fs(o.setLayouts)));var u=function(t,e){for(var i=[],n=0;n<e.length;n++){var r=e[n],s=r.name,a=t[s],o=Gm(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(t,e){return t+"#define "+e.name+" "+e.value+"\n"}),""),l=a.glsl3,c=Vm(t);return c?l=a[c]:console.error("Invalid GFX API!"),o.shaderInfo.stages[0].source=h+l.vert,o.shaderInfo.stages[1].source=h+l.frag,o.shaderInfo.attributes=function(t,e,i){for(var n=[],r=t.attributes,s=e.gfxAttributes,a=0;a<r.length;a++)Hm(r[a].defines,i)&&n.push(s[a]);return n}(a,o,i),o.shaderInfo.name=function(t,e){return t+e.reduce((function(t,e){return e.isDefault?t:t+"|"+e.name+e.value}),"")}(e,u),this._cache[r]=t.createShader(o.shaderInfo)},t}());b.programLib=Jm;var $m=["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"],tg=t("EffectAsset",_h("cc.EffectAsset")((Zm=Qm=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return E(e=t.call.apply(t,[this].concat(n))||this,"techniques",jm,g(e)),E(e,"shaders",Ym,g(e)),E(e,"combinations",Km,g(e)),E(e,"hideInEditor",qm,g(e)),e}c(e,t),e.register=function(t){e._effects[t.name]=t,e._layoutValid=!1},e.remove=function(t){if("string"!=typeof t)e._effects[t.name]&&e._effects[t.name]===t&&delete e._effects[t.name];else{if(e._effects[t])return void delete e._effects[t];for(var i in e._effects)if(e._effects[i]._uuid===t)return void delete e._effects[i]}},e.get=function(t){if(e._effects[t])return e._effects[t];for(var i in e._effects)if(e._effects[i]._uuid===t)return e._effects[i];return $m.includes(t)&&j(16101,t),null},e.getAll=function(){return e._effects},e.isLayoutValid=function(){return e._layoutValid},e.setLayoutValid=function(){e._layoutValid=!0};var i=e.prototype;return i.onLoaded=function(){Jm.register(this),e.register(this),b.game.once(b.Game.EVENT_RENDERER_INITED,this._precompile,this)},i._precompile=function(){for(var t=this,e=b.director.root,i=function(i){var n=t.shaders[i],r=t.combinations[i];if(!r)return"continue";Object.keys(r).reduce((function(t,e){return t.reduce((function(t,i){for(var n=r[e],s=0;s<n.length;++s){var a=l({},i);a[e]=n[s],t.push(a)}return t}),[])}),[{}]).forEach((function(t){return Jm.getGFXShader(Ja.gfxDevice,n.name,t,e.pipeline)}))},n=0;n<this.shaders.length;n++)i(n)},i.destroy=function(){return e.remove(this),t.prototype.destroy.call(this)},i.initDefault=function(i){t.prototype.initDefault.call(this,i);var n=e.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},e}(Wl),Qm._effects={},Qm._layoutValid=!0,jm=T((Xm=Zm).prototype,"techniques",[Eh,Ph],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),Ym=T(Xm.prototype,"shaders",[Eh,Ph],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),Km=T(Xm.prototype,"combinations",[Eh,Ph],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),qm=T(Xm.prototype,"hideInEditor",[Eh,Sh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),Wm=Xm))||Wm);b.EffectAsset=tg;var eg,ig,ng,rg,sg,ag,og,ug,hg,lg,cg,_g,fg,dg,pg;!function(t){t[t.RGB565=On.R5G6B5]="RGB565",t[t.RGB5A1=On.RGB5A1]="RGB5A1",t[t.RGBA4444=On.RGBA4]="RGBA4444",t[t.RGB888=On.RGB8]="RGB888",t[t.RGB32F=On.RGB32F]="RGB32F",t[t.RGBA8888=On.RGBA8]="RGBA8888",t[t.RGBA32F=On.RGBA32F]="RGBA32F",t[t.A8=On.A8]="A8",t[t.I8=On.L8]="I8",t[t.AI8=On.LA8]="AI8",t[t.RGB_PVRTC_2BPPV1=On.PVRTC_RGB2]="RGB_PVRTC_2BPPV1",t[t.RGBA_PVRTC_2BPPV1=On.PVRTC_RGBA2]="RGBA_PVRTC_2BPPV1",t[t.RGB_A_PVRTC_2BPPV1=1024]="RGB_A_PVRTC_2BPPV1",t[t.RGB_PVRTC_4BPPV1=On.PVRTC_RGB4]="RGB_PVRTC_4BPPV1",t[t.RGBA_PVRTC_4BPPV1=On.PVRTC_RGBA4]="RGBA_PVRTC_4BPPV1",t[t.RGB_A_PVRTC_4BPPV1=1025]="RGB_A_PVRTC_4BPPV1",t[t.RGB_ETC1=On.ETC_RGB8]="RGB_ETC1",t[t.RGBA_ETC1=1026]="RGBA_ETC1",t[t.RGB_ETC2=On.ETC2_RGB8]="RGB_ETC2",t[t.RGBA_ETC2=On.ETC2_RGBA8]="RGBA_ETC2",t[t.RGBA_ASTC_4x4=On.ASTC_RGBA_4X4]="RGBA_ASTC_4x4",t[t.RGBA_ASTC_5x4=On.ASTC_RGBA_5X4]="RGBA_ASTC_5x4",t[t.RGBA_ASTC_5x5=On.ASTC_RGBA_5X5]="RGBA_ASTC_5x5",t[t.RGBA_ASTC_6x5=On.ASTC_RGBA_6X5]="RGBA_ASTC_6x5",t[t.RGBA_ASTC_6x6=On.ASTC_RGBA_6X6]="RGBA_ASTC_6x6",t[t.RGBA_ASTC_8x5=On.ASTC_RGBA_8X5]="RGBA_ASTC_8x5",t[t.RGBA_ASTC_8x6=On.ASTC_RGBA_8X6]="RGBA_ASTC_8x6",t[t.RGBA_ASTC_8x8=On.ASTC_RGBA_8X8]="RGBA_ASTC_8x8",t[t.RGBA_ASTC_10x5=On.ASTC_RGBA_10X5]="RGBA_ASTC_10x5",t[t.RGBA_ASTC_10x6=On.ASTC_RGBA_10X6]="RGBA_ASTC_10x6",t[t.RGBA_ASTC_10x8=On.ASTC_RGBA_10X8]="RGBA_ASTC_10x8",t[t.RGBA_ASTC_10x10=On.ASTC_RGBA_10X10]="RGBA_ASTC_10x10",t[t.RGBA_ASTC_12x10=On.ASTC_RGBA_12X10]="RGBA_ASTC_12x10",t[t.RGBA_ASTC_12x12=On.ASTC_RGBA_12X12]="RGBA_ASTC_12x12"}(eg||(eg={})),function(t){t[t.REPEAT=Vn.WRAP]="REPEAT",t[t.CLAMP_TO_EDGE=Vn.CLAMP]="CLAMP_TO_EDGE",t[t.MIRRORED_REPEAT=Vn.MIRROR]="MIRRORED_REPEAT",t[t.CLAMP_TO_BORDER=Vn.BORDER]="CLAMP_TO_BORDER"}(ig||(ig={})),function(t){t[t.NONE=Hn.NONE]="NONE",t[t.LINEAR=Hn.LINEAR]="LINEAR",t[t.NEAREST=Hn.POINT]="NEAREST"}(ng||(ng={})),pe(On);var mg,gg,vg,yg,Eg=new Tt("Tex"),Tg=_h("cc.TextureBase")((pg=dg=function(t){function e(){var e;return E(e=t.call(this)||this,"_format",ag,g(e)),E(e,"_minFilter",og,g(e)),E(e,"_magFilter",ug,g(e)),E(e,"_mipFilter",hg,g(e)),E(e,"_wrapS",lg,g(e)),E(e,"_wrapT",cg,g(e)),E(e,"_wrapR",_g,g(e)),E(e,"_anisotropy",fg,g(e)),e._width=1,e._height=1,e._id=void 0,e._samplerInfo=new Hr,e._gfxSampler=null,e._gfxDevice=null,e._textureHash=0,e._id=Eg.getNewId(),e._gfxDevice=e._getGFXDevice(),e._textureHash=Vs(e._id,666),e}c(e,t);var i=e.prototype;return i.getId=function(){return this._id},i.getPixelFormat=function(){return this._format},i.getAnisotropy=function(){return this._anisotropy},i.setWrapMode=function(t,e,i){void 0===i&&(i=t),this._wrapS=t,this._samplerInfo.addressU=t,this._wrapT=e,this._samplerInfo.addressV=e,this._wrapR=i,this._samplerInfo.addressW=i,this._gfxDevice&&(this._gfxSampler=this._gfxDevice.getSampler(this._samplerInfo))},i.setFilters=function(t,e){this._minFilter=t,this._samplerInfo.minFilter=t,this._magFilter=e,this._samplerInfo.magFilter=e,this._gfxDevice&&(this._gfxSampler=this._gfxDevice.getSampler(this._samplerInfo))},i.setMipFilter=function(t){this._mipFilter=t,this._samplerInfo.mipFilter=t,this._gfxDevice&&(this._gfxSampler=this._gfxDevice.getSampler(this._samplerInfo))},i.setAnisotropy=function(t){this._anisotropy=t,this._samplerInfo.maxAnisotropy=t,this._gfxDevice&&(this._gfxSampler=this._gfxDevice.getSampler(this._samplerInfo))},i.destroy=function(){var e,i=t.prototype.destroy.call(this);return i&&(null===(e=b.director.root)||void 0===e?void 0:e.batcher2D)&&b.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):K(9302)),this._gfxSampler},i._serialize=function(){return""},i._deserialize=function(t){var e=t.split(",");e.unshift(""),e.length>=5&&(this.setFilters(parseInt(e[1]),parseInt(e[2])),this.setWrapMode(parseInt(e[3]),parseInt(e[4]))),e.length>=7&&(this.setMipFilter(parseInt(e[5])),this.setAnisotropy(parseInt(e[6])))},i._getGFXDevice=function(){return Ja.gfxDevice},i._getGFXFormat=function(){return this._getGFXPixelFormat(this._format)},i._setGFXFormat=function(t){this._format=void 0===t?eg.RGBA8888:t},i._getGFXPixelFormat=function(t){return t===eg.RGBA_ETC1?t=eg.RGB_ETC1:t===eg.RGB_A_PVRTC_4BPPV1?t=eg.RGB_PVRTC_4BPPV1:t===eg.RGB_A_PVRTC_2BPPV1&&(t=eg.RGB_PVRTC_2BPPV1),t},h(e,[{key:"isCompressed",get:function(){return this._format>=eg.RGB_ETC1&&this._format<=eg.RGBA_ASTC_12x12||this._format>=eg.RGB_A_PVRTC_2BPPV1&&this._format<=eg.RGBA_ETC1}},{key:"width",get:function(){return this._width}},{key:"height",get:function(){return this._height}}]),e}(Wl),dg.PixelFormat=eg,dg.WrapMode=ig,dg.Filter=ng,ag=T((sg=pg).prototype,"_format",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return eg.RGBA8888}}),og=T(sg.prototype,"_minFilter",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return ng.LINEAR}}),ug=T(sg.prototype,"_magFilter",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return ng.LINEAR}}),hg=T(sg.prototype,"_mipFilter",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return ng.NONE}}),lg=T(sg.prototype,"_wrapS",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return ig.REPEAT}}),cg=T(sg.prototype,"_wrapT",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return ig.REPEAT}}),_g=T(sg.prototype,"_wrapR",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return ig.REPEAT}}),fg=T(sg.prototype,"_anisotropy",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),rg=sg))||rg;function Sg(t){return!!(Qa.hasFeature(Qa.Feature.IMAGE_BITMAP)&&t instanceof ImageBitmap)}b.TextureBase=Tg;var Ag=t("ImageAsset",_h("cc.ImageAsset")((yg=vg=function(t){function e(e){var i;return(i=t.call(this)||this)._nativeData=void 0,i._exportedExts=void 0,i._format=eg.RGBA8888,i._width=0,i._height=0,i._nativeData={_data:null,width:0,height:0,format:0,_compressed:!1},void 0!==e&&i.reset(e),i}c(e,t);var i=e.prototype;return i.reset=function(t){Sg(t)||t instanceof HTMLElement?this._nativeData=t:(this._nativeData=t,this._format=t.format)},i.destroy=function(){return this.data&&this.data instanceof HTMLImageElement?(this.data.src="",this._setRawAsset("")):Sg(this.data)&&this.data.close&&this.data.close(),t.prototype.destroy.call(this)},i._serialize=function(){},i._deserialize=function(t){var i="";"string"==typeof t?i=t:(this._width=t.w,this._height=t.h,i=t.fmt);for(var n,r=Ja.gfxDevice,s=i.split("_"),a=Number.MAX_VALUE,o=this._format,u="",h=Ee.SUPPORT_TEXTURE_FORMATS,l=y(s);!(n=l()).done;){var c=n.value.split("@"),_=parseInt(c[0],void 0),f=e.extnames[_]||c[0],d=h.indexOf(f);if(-1!==d&&d<a){var p=c[1]?parseInt(c[1]):this._format;if(!(".astc"!==f||r&&r.getFormatFeatures(On.ASTC_RGBA_4X4)&Gn.SAMPLED_TEXTURE))continue;if(!(".pvr"!==f||r&&r.getFormatFeatures(On.PVRTC_RGBA4)&Gn.SAMPLED_TEXTURE))continue;if(!(p!==eg.RGB_ETC1&&p!==eg.RGBA_ETC1||r&&r.getFormatFeatures(On.ETC_RGB8)&Gn.SAMPLED_TEXTURE))continue;if(!(p!==eg.RGB_ETC2&&p!==eg.RGBA_ETC2||r&&r.getFormatFeatures(On.ETC2_RGB8)&Gn.SAMPLED_TEXTURE))continue;if(".webp"===f&&!Qa.hasFeature(Qa.Feature.WEBP))continue;a=d,u=f,o=p}}u?(this._setRawAsset(u),this._format=o):j(3121)},i.initDefault=function(i){if(t.prototype.initDefault.call(this,i),e._sharedPlaceHolderCanvas)this.reset(e._sharedPlaceHolderCanvas);else{var n=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),e._sharedPlaceHolderCanvas=n}},i.validate=function(){return!!this.data},h(e,[{key:"_nativeAsset",get:function(){return this._nativeData},set:function(t){t instanceof HTMLElement||Sg(t)||(t.format=t.format||this._format),this.reset(t)}},{key:"data",get:function(){return this._nativeData&&((t=this._nativeData)instanceof HTMLImageElement||t instanceof HTMLCanvasElement||Sg(t))?this._nativeData:this._nativeData&&this._nativeData._data;var t}},{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>=eg.RGB_ETC1&&this._format<=eg.RGBA_ASTC_12x12||this._format>=eg.RGB_A_PVRTC_2BPPV1&&this._format<=eg.RGBA_ETC1}},{key:"url",get:function(){return this.nativeUrl}}]),e}(Wl),vg.extnames=[".png",".jpg",".jpeg",".bmp",".webp",".pvr",".pkm",".astc"],vg._sharedPlaceHolderCanvas=null,T((gg=yg).prototype,"_nativeAsset",[qh],Object.getOwnPropertyDescriptor(gg.prototype,"_nativeAsset"),gg.prototype),mg=gg))||mg);b.ImageAsset=Ag;var Rg=new WeakMap,bg=new WeakSet,Cg=new WeakSet;function wg(t,e){var i;i=wc.safeFindClass;var n,r=Vc.pool.get();try{n=e_(t,r,{classFinder:i,customEnv:e})}catch(t){throw F(t),Vc.pool.put(r),t}n._uuid=e.__uuid__||"";for(var s=r.uuidList,a=r.uuidObjList,o=r.uuidPropList,u=r.uuidTypeList||[],h=[],l=0;l<s.length;l++){var c=s[l];h[l]={uuid:ml(c),owner:a[l],prop:o[l],type:le.getClassById(u[l])}}return Rg.set(n,h),n._native&&bg.add(n),Vc.pool.put(r),n}var Ig,Og=new(function(){function t(){this._depends=new Jh}var e=t.prototype;return e.init=function(){this._depends.clear()},e.getNativeDep=function(t){var e=this._depends.get(t);return e&&e.nativeDep?l({},e.nativeDep):null},e.getDeps=function(t){return this._depends.has(t)?this._depends.get(t).deps:[]},e.getDepsRecursively=function(t){var e=Object.create(null),i=[];return this._descend(t,e,i),i},e.remove=function(t){this._depends.remove(t)},e.parse=function(t,e){var i,n,r=null;if(Array.isArray(e)||e.__type__||e instanceof Pc){if(this._depends.has(t))return this._depends.get(t);if(!Array.isArray(e)||"number"==typeof(n=(i=e[5])[i.length-1])&&n<0)try{var s=wg(e,{__uuid__:t});(r=this._parseDepsFromAsset(s)).nativeDep&&(r.nativeDep.uuid=t),nl.add(t+"@import",s)}catch(e){il.remove(t+"@import"),r={deps:[]}}else r={deps:this._parseDepsFromJson(e)}}else{if(this._depends.has(t)&&(r=this._depends.get(t)).parsedFromExistAsset)return r;r=this._parseDepsFromAsset(e)}return this._depends.add(t,r),r},e._parseDepsFromAsset=function(t){for(var e={deps:[],parsedFromExistAsset:!0},i=Rg.get(t),n=0,r=i.length;n<r;n++)e.deps.push(i[n].uuid);return bg.has(t)&&(e.nativeDep=t._nativeDep),e},e._parseDepsFromJson=function(t){var e=function(t){return i=(e=t)[1],e[10].map((function(t){return i[t]}));var e,i}(t);return e.forEach((function(t,i){return e[i]=ml(t)})),e},e._descend=function(t,e,i){for(var n=this.getDeps(t),r=0;r<n.length;r++){var s=n[r];e[s]||(e[s]=!0,i.push(s),this._descend(s,e,i))}},t}()),xg=[new Ir];function Pg(t){return t&&0==(t&t-1)}var Dg,Bg,Ng,Mg,Lg,Fg,Ug=_h("cc.SimpleTexture")(Ig=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._gfxTexture=null,e._gfxTextureView=null,e._mipmapLevel=1,e._textureWidth=0,e._textureHeight=0,e._baseLevel=0,e._maxLevel=1e3,e}c(e,t);var i=e.prototype;return i.getGFXTexture=function(){return this._gfxTextureView},i.destroy=function(){return this._tryDestroyTextureView(),this._tryDestroyTexture(),t.prototype.destroy.call(this)},i.updateImage=function(){this.updateMipmaps(0)},i.updateMipmaps=function(){},i.uploadData=function(t,e,i){if(void 0===e&&(e=0),void 0===i&&(i=0),this._gfxTexture&&!(this._mipmapLevel<=e)){var n=this._getGFXDevice();if(n){var r=xg[0];r.texExtent.width=this._textureWidth>>e,r.texExtent.height=this._textureHeight>>e,r.texSubres.mipLevel=e,r.texSubres.baseArrayLayer=i,ArrayBuffer.isView(t)?n.copyBuffersToTexture([t],this._gfxTexture,xg):n.copyTexImagesToTexture([t],this._gfxTexture,xg)}}},i._assignImage=function(t,e,i){var n=t.data;if(n&&(this.uploadData(n,e,i),this._checkTextureLoaded(),Ee.CLEANUP_IMAGE_CACHE)){var r=Og.getDeps(this._uuid),s=r.indexOf(t._uuid);-1!==s&&(gt(r,s),t.decRef())}},i._checkTextureLoaded=function(){this._textureReady()},i._textureReady=function(){this.loaded=!0,this.emit("load")},i._setMipmapLevel=function(t){this._mipmapLevel=t<1?1:t},i._setMipRange=function(t,e){this._baseLevel=t<1?0:t,this._maxLevel=e<1?0:e},i.setMipRange=function(t,e){Z(t<=e,3124),this._setMipRange(t,e);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 t=this._getGFXDevice();t&&(this._createTexture(t),this._gfxTextureView=this._createTextureView(t))}},i.isUsingOfflineMipmaps=function(){return!1},i._createTexture=function(t){if(0!==this._width&&0!==this._height){var e=Un.NONE;this._mipFilter!==ng.NONE&&function(t,e,i){return!(t.gfxAPI===Cn.WEBGL)||Pg(e)&&Pg(i)}(t,this._width,this._height)&&(this._mipmapLevel=function(t,e){for(var i=Math.max(t,e),n=0;i;)i>>=1,n++;return n}(this._width,this._height),this.isUsingOfflineMipmaps()||(e=Un.GEN_MIPMAP));var i=this._getGfxTextureCreateInfo({usage:Fn.SAMPLED|Fn.TRANSFER_DST,format:this._getGFXFormat(),levelCount:this._mipmapLevel,flags:e});if(i){var n=t.createTexture(i);this._textureWidth=i.width,this._textureHeight=i.height,this._gfxTexture=n}}},i._createTextureView=function(t){if(!this._gfxTexture)return null;var e=this._maxLevel<this._mipmapLevel?this._maxLevel:this._mipmapLevel-1,i=this._getGfxTextureViewCreateInfo({texture:this._gfxTexture,format:this._getGFXFormat(),baseLevel:this._baseLevel,levelCount:e-this._baseLevel+1});return i?t.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)},h(e,[{key:"mipmapLevel",get:function(){return this._mipmapLevel}}]),e}(Tg))||Ig;b.SimpleTexture=Ug;var Gg,kg,zg,Hg,Vg,Wg,Xg,jg,Yg,Kg,qg=t("Texture2D",(Dg=_h("cc.Texture2D"),Bg=Kh([Ag]),Dg((Fg=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return E(e=t.call.apply(t,[this].concat(n))||this,"_mipmaps",Lg,g(e)),e}c(e,t);var i=e.prototype;return i.initialize=function(){this.mipmaps=this._mipmaps},i.onLoaded=function(){this.initialize()},i.reset=function(t){this._width=t.width,this._height=t.height,this._setGFXFormat(t.format);var e=void 0===t.mipmapLevel?1:t.mipmapLevel;this._setMipmapLevel(e);var i=void 0===t.baseLevel?0:t.baseLevel,n=void 0===t.maxLevel?1e3:t.maxLevel;this._setMipRange(i,n),this._tryReset()},i.create=function(t,e,i,n,r,s){void 0===i&&(i=eg.RGBA8888),void 0===n&&(n=1),void 0===r&&(r=0),void 0===s&&(s=1e3),this.reset({width:t,height:e,format:i,mipmapLevel:n,baseLevel:r,maxLevel:s})},i.toString=function(){return 0!==this._mipmaps.length?this._mipmaps[0].url:""},i.updateMipmaps=function(t,e){if(void 0===t&&(t=0),!(t>=this._mipmaps.length))for(var i=Math.min(void 0===e?this._mipmaps.length:e,this._mipmaps.length-t),n=0;n<i;++n){var r=t+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=[],t.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(e,i){var n=e;t.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 Ag,n.mipmaps[r]){var s=n.mipmaps[r];i.result.push(this._mipmaps,""+r,s,le.getClassId(Ag))}},i._getGfxTextureCreateInfo=function(t){var e=new kr(Ln.TEX2D);return e.width=this._width,e.height=this._height,Object.assign(e,t),e},i._getGfxTextureViewCreateInfo=function(t){var e=new zr;return e.type=Ln.TEX2D,Object.assign(e,t),e},i.initDefault=function(e){t.prototype.initDefault.call(this,e);var i=new Ag;i.initDefault(),this.image=i},i.validate=function(){return this.mipmaps&&0!==this.mipmaps.length},h(e,[{key:"mipmaps",get:function(){return this._mipmaps},set:function(t){var e=this;if(this._mipmaps=t,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(t,i){e._assignImage(t,i)}))}else this.reset({width:0,height:0,mipmapLevel:this._mipmaps.length,baseLevel:this._baseLevel,maxLevel:this._maxLevel})}},{key:"image",get:function(){return 0===this._mipmaps.length?null:this._mipmaps[0]},set:function(t){this.mipmaps=t?[t]:[]}}]),e}(Ug),Lg=T((Mg=Fg).prototype,"_mipmaps",[Bg],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),Ng=Mg))||Ng));b.Texture2D=qg,function(t){t[t.right=0]="right",t[t.left=1]="left",t[t.top=2]="top",t[t.bottom=3]="bottom",t[t.front=4]="front",t[t.back=5]="back"}(Yg||(Yg={})),function(t){t[t.NONE=0]="NONE",t[t.AUTO=1]="AUTO",t[t.BAKED_CONVOLUTION_MAP=2]="BAKED_CONVOLUTION_MAP"}(Kg||(Kg={}));var Qg=t("TextureCube",_h("cc.TextureCube")((jg=Xg=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return E(e=t.call.apply(t,[this].concat(n))||this,"isRGBE",zg,g(e)),E(e,"_mipmapAtlas",Hg,g(e)),E(e,"_mipmapMode",Vg,g(e)),E(e,"_mipmaps",Wg,g(e)),e}c(e,t);var i=e.prototype;return i.isUsingOfflineMipmaps=function(){return this._mipmapMode===Kg.BAKED_CONVOLUTION_MAP},e.fromTexture2DArray=function(t,i){for(var n=[],r=t.length/6,s=0;s<r;s++){var a=6*s;n.push({front:t[a+Yg.front].image,back:t[a+Yg.back].image,left:t[a+Yg.left].image,right:t[a+Yg.right].image,top:t[a+Yg.top].image,bottom:t[a+Yg.bottom].image})}return(i=i||new e).mipmaps=n,i},i.onLoaded=function(){this._mipmapMode===Kg.BAKED_CONVOLUTION_MAP?this.mipmapAtlas=this._mipmapAtlas:this.mipmaps=this._mipmaps},i.reset=function(t){this._width=t.width,this._height=t.height,this._setGFXFormat(t.format);var e=void 0===t.mipmapLevel?1:t.mipmapLevel;this._setMipmapLevel(e);var i=void 0===t.baseLevel?0:t.baseLevel,n=void 0===t.maxLevel?1e3:t.maxLevel;this._setMipRange(i,n),this._tryReset()},i.updateMipmaps=function(t,e){var i=this;if(void 0===t&&(t=0),!(t>=this._mipmaps.length))for(var n=Math.min(void 0===e?this._mipmaps.length:e,this._mipmaps.length-t),r=function(e){var n=t+e;Zg(i._mipmaps[n],(function(t,e){i._assignImage(t,n,e)}))},s=0;s<n;++s)r(s)},i.destroy=function(){return this._mipmaps=[],this._mipmapAtlas=null,t.prototype.destroy.call(this)},i.releaseTexture=function(){this.mipmaps=[],this._mipmapAtlas=null},i._serialize=function(){return null},i._deserialize=function(e,i){var n=e;if(t.prototype._deserialize.call(this,n.base,i),this.isRGBE=n.rgbe,this._mipmapMode=n.mipmapMode,this._mipmapMode===Kg.BAKED_CONVOLUTION_MAP){var r=n.mipmapAtlas,s=n.mipmapLayout;this._mipmapAtlas={atlas:{},layout:s},this._mipmapAtlas.atlas={front:new Ag,back:new Ag,left:new Ag,right:new Ag,top:new Ag,bottom:new Ag};var a=le.getClassId(Ag);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 Ag,back:new Ag,left:new Ag,right:new Ag,top:new Ag,bottom:new Ag};var u=n.mipmaps[o],h=le.getClassId(Ag);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(t){var e=new kr(Ln.CUBE);return e.width=this._width,e.height=this._height,e.layerCount=6,Object.assign(e,t),e},i._getGfxTextureViewCreateInfo=function(t){var e=new zr;return e.type=Ln.CUBE,e.baseLayer=0,e.layerCount=6,Object.assign(e,t),e},i.initDefault=function(e){t.prototype.initDefault.call(this,e);var i=new Ag;i.initDefault(),this.mipmaps=[{front:i,back:i,top:i,bottom:i,left:i,right:i}]},i.validate=function(){if(this._mipmapMode===Kg.BAKED_CONVOLUTION_MAP){if(null===this.mipmapAtlas||0===this.mipmapAtlas.layout.length)return!1;var t=this.mipmapAtlas.atlas;return!!(t.top&&t.bottom&&t.front&&t.back&&t.left&&t.right)}return 0!==this._mipmaps.length&&!this._mipmaps.find((function(t){return!(t.top&&t.bottom&&t.front&&t.back&&t.left&&t.right)}))},h(e,[{key:"mipmaps",get:function(){return this._mipmaps},set:function(t){var e=this;if(this._mipmaps=t,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(t,i){Zg(t,(function(t,n){e._assignImage(t,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(t){var e=this;if(this._mipmapAtlas=t,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(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(t){var s=r[t];Zg(n,(function(t,n){a.clearRect(0,0,i.width,i.height);var r=t.data;a.drawImage(r,0,0);var o=a.getImageData(s.left,s.top,s.width,s.height),u=new Ag({_data:o.data,_compressed:t.isCompressed,width:o.width,height:o.height,format:t.format});e._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(t){this.mipmaps=t?[t]:[]}}]),e}(Ug),Xg.FaceIndex=Yg,zg=T((kg=jg).prototype,"isRGBE",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),Hg=T(kg.prototype,"_mipmapAtlas",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),Vg=T(kg.prototype,"_mipmapMode",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Kg.NONE}}),Wg=T(kg.prototype,"_mipmaps",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),Gg=kg))||Gg);function Zg(t,e){e(t.front,Yg.front),e(t.back,Yg.back),e(t.left,Yg.left),e(t.right,Yg.right),e(t.top,Yg.top),e(t.bottom,Yg.bottom)}b.TextureCube=Qg;var Jg=function(){function t(){this.name="",this.base="",this.importBase="",this.nativeBase="",this.deps=null,this.assetInfos=new Jh,this.scenes=new Jh,this.paths=new Jh}var e=t.prototype;return e.init=function(t){var e=this;!function(t){var e=t.uuids,i=t.paths,n=t.types,r=t.deps,s=t.paths=Object.create(null);if(!1===t.debug){for(var a=0,o=e.length;a<o;a++)e[a]=ml(e[a]);for(var u in i){var h=i[u],l=h[1];h[1]=n[l]}}else{for(var c=Object.create(null),_=0,f=e.length;_<f;_++){var d=e[_];e[_]=c[d]=ml(d)}e=c}for(var p in i){var m=i[p];s[e[p]]=m}var g=t.scenes;for(var v in g){var y=g[v];g[v]=e[y]}var E=t.packs;for(var T in E)for(var S=E[T],A=0;A<S.length;++A)S[A]=e[S[A]];var R=t.versions;if(R)for(var b in R)for(var C=R[b],w=0;w<C.length;w+=2){var I=C[w];C[w]=e[I]||I}var O=t.redirect;if(O)for(var x=0;x<O.length;x+=2)O[x]=e[O[x]],O[x+1]=r[O[x+1]];if(t.extensionMap){var P=function(i){if(!Object.prototype.hasOwnProperty.call(t.extensionMap,i))return"continue";t.extensionMap[i].forEach((function(n,r){t.extensionMap[i][r]=e[n]||n}))};for(var D in t.extensionMap)P(D)}}(t),this.importBase=t.importBase||"",this.nativeBase=t.nativeBase||"",this.base=t.base||"",this.name=t.name||"",this.deps=t.deps||[],this._initUuid(t.uuids),this._initPath(t.paths),this._initScene(t.scenes),this._initPackage(t.packs),this._initVersion(t.versions),this._initRedirect(t.redirect);var i=function(i){if(!Object.prototype.hasOwnProperty.call(t.extensionMap,i))return"continue";t.extensionMap[i].forEach((function(t){var n=e.assetInfos.get(t);n&&(n.extension=i)}))};for(var n in t.extensionMap)i(n)},e.getInfoWithPath=function(t,e){if(!t)return null;t=Tl(t);var i=this.paths.get(t);if(i){if(!e)return i[0];for(var n=0,r=i.length;n<r;n++){var s=i[n];if(le.isChildClassOf(s.ctor,e))return s}}return null},e.getDirWithPath=function(t,e,i){"/"===(t=Tl(t))[t.length-1]&&(t=t.slice(0,-1));var n=i||[];return this.paths.forEach((function(i,r){if(r.startsWith(t)&&function(t,e){return!(t.length>e.length)||47===t.charCodeAt(e.length)}(r,t)||!t)for(var s=0,a=i.length;s<a;s++){var o=i[s];e&&!le.isChildClassOf(o.ctor,e)||n.push(o)}})),n},e.getAssetInfo=function(t){return this.assetInfos.get(t)||null},e.getSceneInfo=function(t){return t.endsWith(".scene")||(t+=".scene"),"/"===t[0]||t.startsWith("db://")||(t="/"+t),this.scenes.find((function(e,i){return i.endsWith(t)}))},e.destroy=function(){this.paths.destroy(),this.scenes.destroy(),this.assetInfos.destroy()},e._initUuid=function(t){if(t){this.assetInfos.clear();for(var e=0,i=t.length;e<i;e++){var n=t[e];this.assetInfos.add(n,{uuid:n})}}},e._initPath=function(t){if(t){var e=this.paths;for(var i in e.clear(),t){var n=t[i],r=n[0],s=n[1],a=3===n.length,o=this.assetInfos.get(i);o.path=r,o.ctor=le.getClassById(s),e.has(r)?a?e.get(r).push(o):e.get(r).unshift(o):e.add(r,[o])}}},e._initScene=function(t){if(t){var e=this.scenes;e.clear();var i=this.assetInfos;for(var n in t){var r=t[n],s=i.get(r);s.url=n,e.add(n,s)}}},e._initPackage=function(t){if(t){var e=this.assetInfos;for(var i in t){var n=t[i],r={uuid:i,packedUuids:n,ext:".json"};e.add(i,r);for(var s=0,a=n.length;s<a;s++){var o=n[s],u=e.get(o),h=u.packs;h?1===a?h.unshift(r):h.push(r):u.packs=[r]}}}},e._initVersion=function(t){if(t){var e=this.assetInfos,i=t.import;if(i)for(var n=0,r=i.length;n<r;n+=2){var s=i[n];e.get(s).ver=i[n+1]}if(i=t.native)for(var a=0,o=i.length;a<o;a+=2){var u=i[a];e.get(u).nativeVer=i[a+1]}}},e._initRedirect=function(t){if(t)for(var e=this.assetInfos,i=0,n=t.length;i<n;i+=2){var r=t[i];e.get(r).redirect=t[i+1]}},t}();function $g(t,e){t._uuid&&e.push(t._uuid)}function tv(t,e){for(var i=Object.getOwnPropertyNames(t),n=0;n<i.length;n++){var r=i[n];if("node"!==r&&"__eventTargets"!==r){var s=t[r];if("object"==typeof s&&s)if(Array.isArray(s))for(var a=0;a<s.length;a++){var o=s[a];o instanceof Wl&&$g(o,e)}else if(s.constructor&&s.constructor!==Object)s instanceof Wl&&$g(s,e);else for(var u=Object.getOwnPropertyNames(s),h=0;h<u.length;h++){var l=s[u[h]];l instanceof Wl&&$g(l,e)}}}}function ev(t,e){for(var i=0;i<t._components.length;i++)tv(t._components[i],e);for(var n=0;n<t._children.length;n++)ev(t._children[n],e)}function iv(t,e,i,n){i.push(t._uuid);for(var r=Og.getDeps(t._uuid),s=0,a=r.length;s<a;s++){var o=el.get(r[s]);if(o){var u=o._uuid;u in e?e[u]+=n:e[u]=o.refCount+n,i.includes(u)||iv(o,e,i,n)}}}var nv=[],rv=new(function(){function t(){this._persistNodeDeps=new Jh,this._toDelete=new Jh,this._eventListener=!1,this._dontDestroyAssets=[]}var e=t.prototype;return e.addIgnoredAsset=function(t){this._dontDestroyAssets.push(t._uuid)},e.init=function(){this._persistNodeDeps.clear(),this._toDelete.clear()},e._addPersistNodeRef=function(t){var e=[];ev(t,e);for(var i=0,n=e.length;i<n;i++){var r=el.get(e[i]);r&&r.addRef()}this._persistNodeDeps.add(t.uuid,e)},e._removePersistNodeRef=function(t){if(this._persistNodeDeps.has(t.uuid)){for(var e=this._persistNodeDeps.get(t.uuid),i=0,n=e.length;i<n;i++){var r=el.get(e[i]);r&&r.decRef()}this._persistNodeDeps.remove(t.uuid)}},e._autoRelease=function(t,e,i){if(t){for(var n=Og.getDeps(t.uuid),r=0,s=n.length;r<s;r++){var a=el.get(n[r]);a&&a.decRef(t.autoReleaseAssets)}var o=Og._depends.get(t.uuid);if(o&&o.persistDeps)for(var u=o.persistDeps,h=0,l=u.length;h<l;h++){var c=el.get(u[h]);c&&c.decRef(t.autoReleaseAssets)}t.uuid!==e.uuid&&Og.remove(t.uuid)}var _=Og._depends.get(e.uuid);for(var f in _&&(_.persistDeps=[]),i){for(var d,p,m=i[f],g=this._persistNodeDeps.get(m.uuid),v=y(g);!(p=v()).done;){var E=p.value,T=el.get(E);T&&T.addRef()}_&&(d=_.persistDeps).push.apply(d,g)}},e.tryRelease=function(t,e){void 0===e&&(e=!1),t instanceof Wl&&(e?this._free(t,e):(this._toDelete.add(t._uuid,t),this._eventListener||(this._eventListener=!0,xe(this._freeAssets.bind(this)))))},e._freeAssets=function(){var t=this;this._eventListener=!1,this._toDelete.forEach((function(e){t._free(e)})),this._toDelete.clear()},e._free=function(t,e){void 0===e&&(e=!1);var i=t._uuid;if(this._toDelete.remove(i),Ra(t,!0)&&-1===this._dontDestroyAssets.indexOf(i)&&!(!e&&t.refCount>0&&function(t){var e=Object.create(null);if(e[t._uuid]=t.refCount,iv(t,e,nv,-1),nv.length=0,0!==e[t._uuid])return e[t._uuid];for(var i in e)0!==e[i]&&iv(el.get(i),e,nv,1);return nv.length=0,e[t._uuid]}(t)>0)){el.remove(i);for(var n=Og.getDeps(i),r=0,s=n.length;r<s;r++){var a=el.get(n[r]);a&&(a.decRef(!1),this._free(a,!1))}t.destroy(),Og.remove(i)}},t}()),sv=null;function av(t,e){for(var i=0,n=t.input.length;i<n;i++){var r=t.input[i];e&&!r.isNative&&r.content instanceof Wl&&r.content.decRef(!1),r.recycle()}t.input=null}function ov(t,e){return e?/\?/.test(t)?t+"&_t="+Date.now():t+"?_t="+Date.now():t}function uv(t,e,i,n,r){void 0===r&&(r=0),t(r,(function(s,a){r++,!s||r>e?n&&n(s,a):setTimeout((function(){uv(t,e,i,n,r)}),i)}))}function hv(t,e,i,n,r){try{for(var s=Og.parse(t,e),a=0,o=s.deps.length;a<o;a++){var u=s.deps[a];u in i||(i[u]=!0,n.push({uuid:u,bundle:r&&r.name}))}s.nativeDep&&(r&&(s.nativeDep.bundle=r.name),n.push(l({},s.nativeDep)))}catch(t){F(t.message,t.stack)}}function lv(t,e,i){e&&(i=void 0!==i?i:b.assetManager.cacheAsset,El(e)||!i||e.isDefault||el.add(t,e))}function cv(t,e,i){var n=0,r=[],s=t.length;0===s&&i&&i(r);for(var a=function(t){t&&r.push(t),++n===s&&i&&i(r)},o=0;o<s;o++)e(t[o],a)}function _v(t,e,i){var n=t,r=e,s=i;if(void 0===i){var a="function"==typeof t;e?(s=e,a||(r=null)):void 0===e&&a&&(s=t,n=null,r=null),void 0!==e&&a&&(r=t,n=null)}return{options:n||Object.create(null),onProgress:r,onComplete:s}}function fv(t,e,i){var n=t,r=e,s=i;if(void 0===i){var a=le.isChildClassOf(t,Wl);e?(s=e,a&&(r=null)):void 0!==e||a||(s=t,r=null,n=null),void 0===e||a||(r=t,n=null)}return{type:n,onProgress:r||sv,onComplete:s}}function dv(t,e,i,n){if(void 0===n&&(n={}),!i[e]||n[e])return!1;n[e]=!0;var r=!1,s=Og.getDeps(e);if(s)for(var a=0,o=s.length;a<o;a++){var u=s[a];if(u===t||dv(t,u,i,n)){r=!0;break}}return r}function pv(t){return function(e,i){if(t){var n=[];Array.isArray(i)?i.forEach((function(t){return t instanceof Wl&&n.push(t.addRef())})):i instanceof Wl&&n.push(i.addRef()),xe((function(){n.forEach((function(t){return t.decRef(!1)})),t(e,i)}))}}}var mv=function(){function t(){this._config=new Jg}var e=t.prototype;return e.getInfoWithPath=function(t,e){return this._config.getInfoWithPath(t,e)},e.getDirWithPath=function(t,e,i){return this._config.getDirWithPath(t,e,i)},e.getAssetInfo=function(t){return this._config.getAssetInfo(t)},e.getSceneInfo=function(t){return this._config.getSceneInfo(t)},e.init=function(t){this._config.init(t),rl.add(t.name,this)},e.load=function(t,e,i,n){var r=fv(e,i,n),s=r.type,a=r.onProgress,o=r.onComplete,u={__requestType__:tl.PATH,type:s,bundle:this.name,__outputAsArray__:Array.isArray(t)};b.assetManager.loadAny(t,u,a,o)},e.preload=function(t,e,i,n){var r=fv(e,i,n),s=r.type,a=r.onProgress,o=r.onComplete;b.assetManager.preloadAny(t,{__requestType__:tl.PATH,type:s,bundle:this.name},a,o)},e.loadDir=function(t,e,i,n){var r=fv(e,i,n),s=r.type,a=r.onProgress,o=r.onComplete;b.assetManager.loadAny(t,{__requestType__:tl.DIR,type:s,bundle:this.name,__outputAsArray__:!0},a,o)},e.preloadDir=function(t,e,i,n){var r=fv(e,i,n),s=r.type,a=r.onProgress,o=r.onComplete;b.assetManager.preloadAny(t,{__requestType__:tl.DIR,type:s,bundle:this.name},a,o)},e.loadScene=function(t,e,i,n){var r=_v(e,i,n),s=r.options,a=r.onProgress,o=r.onComplete;s.preset=s.preset||"scene",s.bundle=this.name,b.assetManager.loadAny({scene:t},s,a,(function(t,e){if(t)F(t.message,t.stack);else if(e.scene){var i=e.scene;i._id=e._uuid,i.name=e.name}else t=new Error("The asset "+e._uuid+" is not a scene");o&&o(t,e)}))},e.preloadScene=function(t,e,i,n){var r=_v(e,i,n),s=r.options,a=r.onProgress,o=r.onComplete;s.bundle=this.name,b.assetManager.preloadAny({scene:t},s,a,(function(e){e&&K(1210,t,e.message),o&&o(e)}))},e.get=function(t,e){var i=this.getInfoWithPath(t,e);return i&&el.get(i.uuid)||null},e.release=function(t,e){var i=this.get(t,e);i&&rv.tryRelease(i,!0)},e.releaseUnusedAssets=function(){var t=this;el.forEach((function(e){var i=t.getAssetInfo(e._uuid);i&&!i.redirect&&rv.tryRelease(e)}))},e.releaseAll=function(){var t=this;el.forEach((function(e){var i=t.getAssetInfo(e._uuid);i&&!i.redirect&&rv.tryRelease(e,!0)}))},e._destroy=function(){this._config.destroy()},h(t,[{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}}]),t}(),gv=t("resources",new mv);function vv(t,e,i){var n=new 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(J(4930,t)))}return"file:"!==window.location.protocol&&(n.crossOrigin="anonymous"),n.addEventListener("load",r),n.addEventListener("error",s),n.src=t,n}function yv(t,e,i,n){var r=new XMLHttpRequest,s="download failed: "+t+", status: ";if(r.open("GET",t,!0),void 0!==e.xhrResponseType&&(r.responseType=e.xhrResponseType),void 0!==e.xhrWithCredentials&&(r.withCredentials=e.xhrWithCredentials),void 0!==e.xhrMimeType&&r.overrideMimeType&&r.overrideMimeType(e.xhrMimeType),void 0!==e.xhrTimeout&&(r.timeout=e.xhrTimeout),e.xhrHeader)for(var a in e.xhrHeader)r.setRequestHeader(a,e.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(t){t.lengthComputable&&i(t.loaded,t.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}b.resources=gv;var Ev={};function Tv(t,e,i){if(Ev[t])return i&&i(null),null;var n=document.createElement("script");function r(){n.parentNode.removeChild(n),n.removeEventListener("load",r,!1),n.removeEventListener("error",s,!1),Ev[t]=!0,i&&i(null)}function s(){n.parentNode.removeChild(n),n.removeEventListener("load",r,!1),n.removeEventListener("error",s,!1),i&&i(new Error(J(4928,t)))}return"file:"!==window.location.protocol&&(n.crossOrigin="anonymous"),n.async=e.scriptAsyncLoading||!1,n.src=t,n.addEventListener("load",r,!1),n.addEventListener("error",s,!1),document.body.appendChild(n),n}var Sv,Av,Rv,bv,Cv,wv,Iv,Ov,xv=/^(?:\w+:\/\/|\.+\/).+/,Pv=function(t,e,i){(Qa.hasFeature(Qa.Feature.IMAGE_BITMAP)&&b.assetManager.allowImageBitmap?Dv:vv)(t,e,i)},Dv=function(t,e,i){e.xhrResponseType="blob",yv(t,e,e.onFileProgress,i)},Bv=function(t,e,i){e.xhrResponseType="json",yv(t,e,e.onFileProgress,i)},Nv=function(t,e,i){e.xhrResponseType="arraybuffer",yv(t,e,e.onFileProgress,i)},Mv=function(t,e,i){Bv(t,e,(function(e,n){if(e)i(e);else{var r=Dc(n);Promise.all(r.chunks.map((function(i){return new Promise((function(n,r){Nv(""+Bl(t)+i,{},(function(t,i){e?r(e):n(new Uint8Array(i))}))}))}))).then((function(t){var e=new Pc(r.document,t);i(null,e)})).catch((function(t){i(t)}))}}))},Lv=function(t,e,i){Nv(t,e,(function(t,e){if(t)i(t);else try{var n=Bc(new Uint8Array(e));i(null,n)}catch(t){i(t)}}))},Fv=function(t,e,i){e.xhrResponseType="text",yv(t,e,e.onFileProgress,i)},Uv=function(t,e,i){var n=Nl(t),r=t;xv.test(r)||(r=-1!==Gv.remoteBundles.indexOf(n)?Gv.remoteServerAddress+"remote/"+n:"assets/"+n);var s=e.version||Gv.bundleVers[n],a=0,o=null,u=null;Bv(r+"/config."+(s?s+".":"")+"json",e,(function(t,e){u=t,(o=e)&&(o.base=r+"/"),2==++a&&i(u,o)})),Tv(r+"/index."+(s?s+".":"")+"js",e,(function(t){u=t,2==++a&&i(t,o)}))},Gv=new(function(){function t(){this.maxConcurrency=6,this.maxRequestsPerFrame=6,this.maxRetryCount=3,this.appendTimeStamp=!1,this.limited=!0,this.retryInterval=2e3,this.bundleVers=null,this.remoteBundles=[],this.downloadDomImage=vv,this.downloadDomAudio=null,this.downloadFile=yv,this.downloadScript=Tv,this._downloaders={".png":Pv,".jpg":Pv,".bmp":Pv,".jpeg":Pv,".gif":Pv,".ico":Pv,".tiff":Pv,".webp":Pv,".image":Pv,".pvr":Nv,".pkm":Nv,".astc":Nv,".txt":Fv,".xml":Fv,".vsh":Fv,".fsh":Fv,".atlas":Fv,".tmx":Fv,".tsx":Fv,".json":Bv,".ExportJson":Bv,".plist":Fv,".ccon":Mv,".cconb":Lv,".fnt":Fv,".binary":Nv,".bin":Nv,".dbbin":Nv,".skel":Nv,".js":Tv,bundle:Uv,default:Fv},this._downloading=new Jh,this._queue=[],this._queueDirty=!1,this._totalNum=0,this._totalNumThisPeriod=0,this._lastDate=-1,this._checkNextPeriod=!1,this._remoteServerAddress="",this._maxInterval=1/30}var e=t.prototype;return e.init=function(t,e,i){void 0===t&&(t=""),void 0===e&&(e={}),void 0===i&&(i=[]),this._downloading.clear(),this._queue.length=0,this._remoteServerAddress=t,this.bundleVers=e,this.remoteBundles=i},e.register=function(t,e){"object"==typeof t?le.mixin(this._downloaders,t):this._downloaders[t]=e},e.download=function(t,e,i,n,r){var s=this,a=il.get(t);if(a)r(null,a);else{var o=this._downloading.get(t);if(o){o.push(r);var u=this._queue.find((function(e){return e.id===t}));if(!u)return;var h=n.priority||0;u.priority<h&&(u.priority=h,this._queueDirty=!0)}else{var l=void 0!==n.maxRetryCount?n.maxRetryCount:this.maxRetryCount,c=void 0!==n.maxConcurrency?n.maxConcurrency:this.maxConcurrency,_=void 0!==n.maxRequestsPerFrame?n.maxRequestsPerFrame:this.maxRequestsPerFrame,f=this._downloaders[i]||this._downloaders.default;uv((function(i,a){if(0===i&&s._downloading.add(t,[r]),s.limited){s._updateTime();var o=function(t,e){s._totalNum--,s._handleQueueInNextFrame(c,_),a(t,e)};s._totalNum<c&&s._totalNumThisPeriod<_?(f(ov(e,s.appendTimeStamp),n,o),s._totalNum++,s._totalNumThisPeriod++):(s._queue.push({id:t,priority:n.priority||0,url:e,options:n,done:o,handler:f}),s._queueDirty=!0,s._totalNum<c&&s._handleQueueInNextFrame(c,_))}else f(ov(e,s.appendTimeStamp),n,a)}),l,this.retryInterval,(function(e,i){e||il.add(t,i);for(var n=s._downloading.remove(t),r=0,a=n.length;r<a;r++)n[r](e,i)}))}}},e.loadSubpackage=function(t,e){b.assetManager.loadBundle(t,null,e)},e._updateTime=function(){var t=performance.now(),e=b.game.deltaTime,i=e>this._maxInterval?this._maxInterval:e;t-this._lastDate>1e3*i&&(this._totalNumThisPeriod=0,this._lastDate=t)},e._handleQueue=function(t,e){for(this._checkNextPeriod=!1,this._updateTime();this._queue.length>0&&this._totalNum<t&&this._totalNumThisPeriod<e;){this._queueDirty&&(this._queue.sort((function(t,e){return t.priority-e.priority})),this._queueDirty=!1);var i=this._queue.pop();if(!i)break;this._totalNum++,this._totalNumThisPeriod++,i.handler(ov(i.url,this.appendTimeStamp),i.options,i.done)}this._handleQueueInNextFrame(t,e)},e._handleQueueInNextFrame=function(t,e){!this._checkNextPeriod&&this._queue.length>0&&(xe(this._handleQueue.bind(this),t,e),this._checkNextPeriod=!0)},h(t,[{key:"remoteServerAddress",get:function(){return this._remoteServerAddress}}]),t}()),kv=t("JsonAsset",_h("cc.JsonAsset")((bv=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return E(e=t.call.apply(t,[this].concat(n))||this,"json",Rv,g(e)),e}return c(e,t),e}(Wl),Rv=T((Av=bv).prototype,"json",[Eh,Ph],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),Sv=Av))||Sv);b.JsonAsset=kv;var zv,Hv,Vv=t("TextAsset",_h("cc.TextAsset")((Ov=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return E(e=t.call.apply(t,[this].concat(n))||this,"text",Iv,g(e)),e}return c(e,t),e.prototype.toString=function(){return this.text},e}(Wl),Iv=T((wv=Ov).prototype,"text",[Eh,Ph],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),Cv=wv))||Cv);b.TextAsset=Vv;var Wv=t("BufferAsset",_h("cc.BufferAsset")((T((Hv=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._buffer=null,e}c(e,t);var i=e.prototype;return i.buffer=function(){return this._buffer,this._buffer},i.validate=function(){return!!this.buffer},h(e,[{key:"_nativeAsset",get:function(){return this._buffer},set:function(t){t instanceof ArrayBuffer?this._buffer=t:this._buffer=t.buffer}}]),e}(Wl)).prototype,"_nativeAsset",[qh],Object.getOwnPropertyDescriptor(Hv.prototype,"_nativeAsset"),Hv.prototype),zv=Hv))||zv);function Xv(t,e,i,n){var r=null,s=null;try{(r=new Ag)._nativeUrl=t,r._nativeAsset=e}catch(t){s=t}n(s,r)}function jv(t,e,i,n){var r=new kv;r.json=e,n(null,r)}function Yv(t,e,i,n){var r=new Vv;r.text=e,n(null,r)}function Kv(t,e,i,n){var r=new Wv;r._nativeUrl=t,r._nativeAsset=e,n(null,r)}function qv(t,e,i,n){var r=new Wl;r._nativeUrl=t,r._nativeAsset=e,n(null,r)}function Qv(t,i,n,r){var s=rl.get(i.name);s||(s=i.name===hl.RESOURCES?gv:new mv,i.base=i.base||t+"/",s.init(i)),e.import("virtual:///prerequisite-imports/"+s.name).then((function(){r(null,s)})).catch(r)}b.BufferAsset=Wv;var Zv=new(function(){function t(){this._creating=new Jh,this._producers={".png":Xv,".jpg":Xv,".bmp":Xv,".jpeg":Xv,".gif":Xv,".ico":Xv,".tiff":Xv,".webp":Xv,".image":Xv,".pvr":Xv,".pkm":Xv,".txt":Yv,".xml":Yv,".vsh":Yv,".fsh":Yv,".atlas":Yv,".tmx":Yv,".tsx":Yv,".fnt":Yv,".json":jv,".ExportJson":jv,".binary":Kv,".bin":Kv,".dbbin":Kv,".skel":Kv,bundle:Qv,default:qv}}var e=t.prototype;return e.register=function(t,e){"object"==typeof t?le.mixin(this._producers,t):this._producers[t]=e},e.create=function(t,e,i,n,r){var s=this,a=this._producers[i]||this._producers.default,o=el.get(t);if(n.reloadAsset||!o){var u=this._creating.get(t);u?u.push(r):(this._creating.add(t,[r]),a(t,e,n,(function(e,i){!e&&i instanceof Wl&&(i._uuid=t,lv(t,i,n.cacheAsset));for(var r=s._creating.remove(t),a=0,o=r.length;a<o;a++)r[a](e,i)})))}else r(null,o)},t}()),Jv=new(function(){function t(){this._loading=new Jh,this._unpackers={".json":this.unpackJson}}var e=t.prototype;return e.unpackJson=function(t,e,i,n){var r=le.createMap(!0),s=null;if(Array.isArray(e)){(e=function(t){if(t[0]<1)throw new Error(J(5304,t[0]));$c(t,!0,void 0,e_.reportMissingClass),t_(t);for(var e=new i_(t[0]),i=t[1],n=t[2],r=t[3],s=t[4],a=t[5],o=0;o<a.length;++o)a[o].unshift(e,i,n,r,s);return a}(e)).length!==t.length&&K(4915);for(var a=0;a<t.length;a++)r[t[a]+"@import"]=e[a]}else{var o=le.getClassId(qg),u=le.getClassId(Ag);if(e.type===o&&e.data){var h=e.data;h.length!==t.length&&K(4915);for(var l=0;l<t.length;l++)r[t[l]+"@import"]=n_(o,{base:h[l][0],mipmaps:h[l][1]})}else if(e.type===u&&e.data){var c=e.data;c.length!==t.length&&K(4915);for(var _=0;_<t.length;_++)r[t[_]+"@import"]=c[_]}else s=new Error("unmatched type pack!"),r=null}n(s,r)},e.init=function(){this._loading.clear()},e.register=function(t,e){"object"==typeof t?le.mixin(this._unpackers,t):this._unpackers[t]=e},e.unpack=function(t,e,i,n,r){e?(0,this._unpackers[i])(t,e,n,r):r(new Error("package data is wrong!"))},e.load=function(t,e,i){var n=this;if(!t.isNative&&t.info&&t.info.packs)if(il.has(t.id))i(null,il.get(t.id));else{var r=t.info.packs,s=r.find((function(t){return n._loading.has(t.uuid)}));if(s)this._loading.get(s.uuid).push({onComplete:i,id:t.id});else{s=r[0],this._loading.add(s.uuid,[{onComplete:i,id:t.id}]);var a=Sl(s.uuid,{ext:s.ext,bundle:t.config.name});Gv.download(s.uuid,a,s.ext,t.options,(function(e,i){il.remove(s.uuid),e&&F(e.message,e.stack),n.unpack(s.packedUuids,i,s.ext,t.options,(function(t,i){if(!t)for(var r in i)il.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(e||t)h.onComplete(e||t);else{var l=i[h.id];l?h.onComplete(null,l):h.onComplete(new Error("can not retrieve data from package"))}}}))}))}}else Gv.download(t.id,t.url,t.ext,t.options,i)},t}());function $v(t,e){var i=!1;t.progress||(t.progress={finish:0,total:t.input.length,canInvoke:!0},i=!0);var n=t.options,r=t.progress,s=[],a=r.total,o=n.__exclude__=n.__exclude__||Object.create(null);t.output=[],cv(t.input,(function(n,u){if(!n.isNative&&el.has(n.uuid)){var h=el.get(n.uuid);return n.content=h.addRef(),t.output.push(n),r.canInvoke&&t.dispatch("progress",++r.finish,r.total,n),void u()}Jv.load(n,t.options,(function(h,l){h?t.isFinish||(!b.assetManager.force||i?(F(h.message,h.stack),r.canInvoke=!1,e(h)):(t.output.push(n),r.canInvoke&&t.dispatch("progress",++r.finish,r.total,n))):t.isFinish||(n.file=l,t.output.push(n),n.isNative||(o[n.uuid]=!0,hv(n.uuid,l,o,s,n.config),r.total=a+s.length),r.canInvoke&&t.dispatch("progress",++r.finish,r.total,n)),u()}))}),(function(){if(t.isFinish)return av(t,!0),void t.dispatch("error");if(s.length>0){var a=cl.create({input:s,progress:r,options:n,onProgress:t.onProgress,onError:cl.prototype.recycle,onComplete:function(n){var r;n||((r=t.output).push.apply(r,a.output),a.recycle()),i&&ty(t),e(n)}});al.async(a)}else i&&ty(t),e()}))}function ty(t){for(var e=t.output,i=0,n=e.length;i<n;i++)e[i].content&&e[i].content.decRef(!1)}var ey=new(function(t){function e(){return t.apply(this,arguments)||this}c(e,t);var i=e.prototype;return i.parse=function(t){var e=this._parseXML(t).documentElement;if("plist"!==e.tagName)return j(5100),{};for(var i=null,n=0,r=e.childNodes.length;n<r&&1!==(i=e.childNodes[n]).nodeType;n++);return this._parseNode(i)},i._parseNode=function(t){var e=null,i=t.tagName;if("dict"===i)e=this._parseDict(t);else if("array"===i)e=this._parseArray(t);else if("string"===i)if(1===t.childNodes.length)e=t.firstChild.nodeValue;else{e="";for(var n=0;n<t.childNodes.length;n++)e+=t.childNodes[n].nodeValue}else"false"===i?e=!1:"true"===i?e=!0:"real"===i?e=parseFloat(t.firstChild.nodeValue):"integer"===i&&(e=parseInt(t.firstChild.nodeValue,10));return e},i._parseArray=function(t){for(var e=[],i=0,n=t.childNodes.length;i<n;i++){var r=t.childNodes[i];1===r.nodeType&&e.push(this._parseNode(r))}return e},i._parseDict=function(t){for(var e={},i="",n=0,r=t.childNodes.length;n<r;n++){var s=t.childNodes[n];1===s.nodeType&&("key"===s.tagName?i=s.firstChild.nodeValue:e[i]=this._parseNode(s))}return e},e}(function(){function t(){this._parser=null,window.DOMParser&&(this._parser=new DOMParser)}var e=t.prototype;return e.parse=function(t){return this._parseXML(t)},e._parseXML=function(t){if(this._parser)return this._parser.parseFromString(t,"text/xml");throw new Error("Dom parser is not supported in this platform!")},t}()));function iy(t,e){return t[e]<<8|t[e+1]}var ny=new(function(){function t(){this._parsing=new Jh,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 e=t.prototype;return e.parseImage=function(t,e,i){t instanceof HTMLImageElement?i(null,t):createImageBitmap(t,{premultiplyAlpha:"none"}).then((function(t){i(null,t)}),(function(t){i(t,null)}))},e.parsePVRTex=function(t,e,i){var n=null,r=null;try{var s=t instanceof ArrayBuffer?t:t.buffer,a=new Int32Array(s,0,13);if(55727696===a[0]){var o=a[7],u=a[6],h=a[12]+52;r={_data:new Uint8Array(s,h),_compressed:!0,width:o,height:u,format:0}}else{if(559044176!==a[11])throw new Error("Invalid magic number in PVR header");var l=a[0],c=a[1],_=a[2];r={_data:new Uint8Array(s,l),_compressed:!0,width:_,height:c,format:0}}}catch(t){n=t}i(n,r)},e.parsePKMTex=function(t,e,i){var n=null,r=null;try{var s=t instanceof ArrayBuffer?t:t.buffer,a=new Uint8Array(s),o=iy(a,6);if(0!==o&&1!==o&&3!==o)throw new Error("Invalid magic number in ETC header");var u=iy(a,12),h=iy(a,14);iy(a,8),iy(a,10),r={_data:new Uint8Array(s,16),_compressed:!0,width:u,height:h,format:0}}catch(t){n=t}i(n,r)},e.parseASTCTex=function(t,e,i){var n=null,r=null;try{var s=t instanceof ArrayBuffer?t:t.buffer,a=new Uint8Array(s);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 l=function(t,e){return 4===t?eg.RGBA_ASTC_4x4:5===t?4===e?eg.RGBA_ASTC_5x4:eg.RGBA_ASTC_5x5:6===t?5===e?eg.RGBA_ASTC_6x5:eg.RGBA_ASTC_6x6:8===t?5===e?eg.RGBA_ASTC_8x5:6===e?eg.RGBA_ASTC_8x6:eg.RGBA_ASTC_8x8:10===t?5===e?eg.RGBA_ASTC_10x5:6===e?eg.RGBA_ASTC_10x6:8===e?eg.RGBA_ASTC_10x8:eg.RGBA_ASTC_10x10:10===e?eg.RGBA_ASTC_12x10:eg.RGBA_ASTC_12x12}(o,u),c=a[7]+(a[8]<<8)+(a[9]<<16),_=a[10]+(a[11]<<8)+(a[12]<<16);a[13],a[14],a[15],r={_data:new Uint8Array(s,16),_compressed:!0,width:c,height:_,format:l}}catch(t){n=t}i(n,r)},e.parsePlist=function(t,e,i){var n=null,r=ey.parse(t);r||(n=new Error("parse failed")),i(n,r)},e.parseImport=function(t,e,i){if(t){var n=null,r=null;try{n=wg(t,e)}catch(t){r=t}i(r,n)}else i(new Error("The json file of asset "+e.__uuid__+" is empty or missing"))},e.init=function(){this._parsing.clear()},e.register=function(t,e){"object"==typeof t?le.mixin(this._parsers,t):this._parsers[t]=e},e.parse=function(t,e,i,n,r){var s=this,a=nl.get(t);if(a)r(null,a);else{var o=this._parsing.get(t);if(o)o.push(r);else{var u=this._parsers[i];u?(this._parsing.add(t,[r]),u(e,n,(function(e,i){e?il.remove(t):El(i)||nl.add(t,i);for(var n=s._parsing.remove(t),r=0,a=n.length;r<a;r++)n[r](e,i)}))):r(null,e)}}},t}());function ry(t,e){var i=!1;t.progress||(t.progress={finish:0,total:t.input.length,canInvoke:!0},i=!0);var n=t.options,r=t.progress;n.__exclude__=n.__exclude__||Object.create(null),t.output=[],cv(t.input,(function(s,a){var o=cl.create({input:s,onProgress:t.onProgress,options:n,progress:r,onComplete:function(n,u){n&&!t.isFinish&&(!b.assetManager.force||i?(F(n.message,n.stack),r.canInvoke=!1,e(n)):r.canInvoke&&t.dispatch("progress",++r.finish,r.total,s)),t.output.push(u),o.recycle(),a(null)}});sy.async(o)}),(function(){if(n.__exclude__=null,t.isFinish)return av(t,!0),void t.dispatch("error");!function(t){var e=t.source;if(t.options.__outputAsArray__||1!==e.length)for(var i=t.output=[],n=0,r=e.length;n<r;n++)i.push(e[n].content);else t.output=e[0].content}(t),av(t,!0),e()}))}var sy=new $h("loadOneAsset",[function(t,e){var i=t.output=t.input,n=i.options,r=i.isNative,s=i.uuid,a=i.file,o=n.reloadAsset;a||!o&&!r&&el.has(s)?e():Jv.load(i,t.options,(function(t,n){i.file=n,e(t)}))},function(t,e){var i=t.output=t.input,n=t.progress,r=t.options.__exclude__,s=i.id,a=i.file,o=i.options;if(i.isNative)ny.parse(s,a,i.ext,o,(function(r,a){r?e(r):(i.content=a,n.canInvoke&&t.dispatch("progress",++n.finish,n.total,i),il.remove(s),nl.remove(s),e())}));else{var u=i.uuid;if(u in r){var h=r[u],l=h.finish,c=h.content,_=h.err,f=h.callbacks;n.canInvoke&&t.dispatch("progress",++n.finish,n.total,i),l||dv(u,u,r)?(c&&c.addRef(),i.content=c,e(_)):f.push({done:e,item:i})}else if(!o.reloadAsset&&el.has(u)){var d=el.get(u);i.content=d.addRef(),n.canInvoke&&t.dispatch("progress",++n.finish,n.total,i),e()}else o.__uuid__=u,ny.parse(s,a,"import",o,(function(i,n){i?e(i):function(t,e,i){var n=t.input,r=t.progress,s=n,a=s.uuid,o=s.id,u=s.options,h=s.config,l=u.cacheAsset,c=[];e.addRef&&e.addRef(),hv(a,e,Object.create(null),c,h),r.canInvoke&&t.dispatch("progress",++r.finish,r.total+=c.length,n);var _=t.options.__exclude__[a]={content:e,finish:!1,callbacks:[{done:i,item:n}]},f=cl.create({input:c,options:t.options,onProgress:t.onProgress,onError:cl.prototype.recycle,progress:r,onComplete:function(t){if(e.decRef&&e.decRef(!1),_.finish=!0,_.err=t,!t){for(var i,n=Array.isArray(f.output)?f.output:[f.output],r=Object.create(null),s=y(n);!(i=s()).done;){var u=i.value;u&&(r[u instanceof Wl?u._uuid+"@import":a+"@native"]=u)}!function(t,e,i){var n=Rg.get(e);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(F("The asset "+a.uuid+" is missing!"),a.type&&a.type!==Wl){var u=new a.type;u.initDefault(a.uuid),a.owner[a.prop]=u}!0}}Rg.delete(e)}bg.has(e)&&(i[t+"@native"]?e._nativeAsset=i[t+"@native"]:(!0,console.error("the native asset of "+t+" is missing!")),bg.delete(e))}(a,e,r);try{"function"!=typeof e.onLoaded||Cg.has(e)||bg.has(e)||(e.onLoaded(),Cg.add(e))}catch(t){F("The asset "+a+" is invalid for some reason, detail message: "+t.message+", stack: "+t.stack)}il.remove(o),nl.remove(o),lv(a,e,l),f.recycle()}for(var h=_.callbacks,c=0,d=h.length;c<d;c++){var p=h[c];e.addRef&&e.addRef(),p.item.content=e,p.done(t)}h.length=0}});sl.async(f)}(t,n,e)}))}}]);function ay(t,e){var i=t.options,n=Object.create(null),r=Object.create(null);for(var s in i)switch(s){case tl.PATH:case tl.UUID:case tl.DIR:case tl.SCENE:case tl.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]}t.options=r;var a=cl.create({input:t.input,options:n}),o=null;try{t.output=t.source=ol.sync(a)}catch(t){o=t;for(var u=0,h=a.output.length;u<h;u++)a.output[u].recycle()}a.recycle(),e(o)}var oy=function(){function t(){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 t.create=function(){return 0!==t._deadPool.length?t._deadPool.pop():new t},t.prototype.recycle=function(){t._deadPool.length!==t.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),t._deadPool.push(this))},h(t,[{key:"id",get:function(){return this._id||(this._id=(this.overrideUuid||this.uuid)+"@"+(this.isNative?"native":"import")),this._id}}]),t}();oy.MAX_DEAD_NUM=500,oy._deadPool=[];var uy=[];function hy(t){var e=t.options,i=Array.isArray(t.input)?t.input:[t.input];t.output=[];for(var n=function(n){var r,s=i[n],a=oy.create(),o=null,u=null;if("string"==typeof s&&((s=Object.create(null))[e.__requestType__||tl.UUID]=i[n]),"object"==typeof s)for(var h in le.addon(s,e),s.preset&&le.addon(s,ll[s.preset]),s){switch(h){case tl.UUID:if("break"===function(){var t,e=a.uuid=ml(s.uuid);if(!s.bundle){var i=rl.find((function(t){return!!t.getAssetInfo(e)}));s.bundle=i&&i.name}if(rl.has(s.bundle)){if(o=rl.get(s.bundle).config,(u=o.getAssetInfo(e))&&u.redirect){if(!rl.has(u.redirect))throw new Error("Please load bundle "+u.redirect+" first");o=rl.get(u.redirect).config,u=o.getAssetInfo(e)}a.config=o,a.info=u}return a.ext=s.ext||(null===(t=u)||void 0===t?void 0:t.extension)||".json","break"}())break;case"__requestType__":case"ext":case"bundle":case"preset":case"type":break;case tl.DIR:if(rl.has(s.bundle)){rl.get(s.bundle).config.getDirWithPath(s.dir,s.type,uy);for(var l,c=y(uy);!(l=c()).done;){var _=l.value;i.push({uuid:_.uuid,__isNative__:!1,ext:_.extension||".json",bundle:s.bundle})}uy.length=0}a.recycle(),a=null;break;case tl.PATH:if(rl.has(s.bundle)){if(o=rl.get(s.bundle).config,(u=o.getInfoWithPath(s.path,s.type))&&u.redirect){if(!rl.has(u.redirect))throw new Error("you need to load bundle "+u.redirect+" first");o=rl.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 tl.SCENE:if(!s.bundle){var f=rl.find((function(t){return!!t.getSceneInfo(s.scene)}));s.bundle=f&&f.name}if(rl.has(s.bundle)){if(o=rl.get(s.bundle).config,(u=o.getSceneInfo(s.scene))&&u.redirect){if(!rl.has(u.redirect))throw new Error("you need to load bundle "+u.redirect+" first");o=rl.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 tl.URL:a.url=s.url,a.uuid=s.uuid||s.url,a.ext=s.ext||Dl(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(t.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 ly(t){for(var e=t.output=t.input,i=0;i<e.length;i++){var n=e[i];!ul.has(n.uuid)||function(){var t=ul.get(n.uuid),e=rl.find((function(e){return!!e.getAssetInfo(t)}));if(e){var i;n.overrideUuid=t;var r=e.config,s=r.getAssetInfo(t);if(s&&s.redirect){if(!rl.has(s.redirect))throw new Error("Please load bundle "+s.redirect+" first");s=(r=rl.get(s.redirect).config).getAssetInfo(t)}n.config=r,n.info=s,n.ext=n.isNative?n.ext:(null===(i=s)||void 0===i?void 0:i.extension)||".json"}else j(16201,t,n.uuid)}()}}function cy(t){for(var e=t.output=t.input,i=0;i<e.length;i++){var n=e[i];if(!n.url){var r,s,a=n.config;s=n.isNative?a&&a.nativeBase?a.base+a.nativeBase:b.assetManager.generalNativeBase:a&&a.importBase?a.base+a.importBase:b.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 _y=t("AssetManager",function(){function t(){this.pipeline=sl.append(ay).append(ry),this.fetchPipeline=al.append(ay).append($v),this.transformPipeline=ol.append(hy).append(ly).append(cy),this.bundles=rl,this.assets=el,this.assetsOverrideMap=ul,this.generalImportBase="",this.generalNativeBase="",this.dependUtil=Og,this.force=!1,this.allowImageBitmap=!Qa.isMobile,this.utils=wl,this.downloader=Gv,this.parser=ny,this.packManager=Jv,this.cacheAsset=!0,this.cacheManager=null,this.presets=ll,this.factory=Zv,this.preprocessPipe=ay,this.fetchPipe=$v,this.loadPipe=ry,this.references=null,this._releaseManager=rv,this._files=il,this._parsed=nl,this._parsePipeline=null,this._projectBundles=[]}var e=t.prototype;return e.init=function(t){void 0===t&&(t={});var e=t.server||ye.querySettings(ve.Category.ASSETS,"server")||"",i=t.bundleVers||ye.querySettings(ve.Category.ASSETS,"bundleVers")||{},n=t.remoteBundles||ye.querySettings(ve.Category.ASSETS,"remoteBundles")||[];this._files.clear(),this._parsed.clear(),this._releaseManager.init(),this.assets.clear(),this.bundles.clear(),this.packManager.init(),this.downloader.init(e,i,n),this.parser.init(),this.dependUtil.init();var r=t.importBase||ye.querySettings(ve.Category.ASSETS,"importBase")||"";r&&r.endsWith("/")&&(r=r.substr(0,r.length-1));var s=t.nativeBase||ye.querySettings(ve.Category.ASSETS,"nativeBase")||"";s&&s.endsWith("/")&&(s=s.substr(0,s.length-1)),this.generalImportBase=r,this.generalNativeBase=s,this._projectBundles=ye.querySettings(ve.Category.ASSETS,"projectBundles")||[];var a=ye.querySettings(ve.Category.ASSETS,"assetsOverrides")||{};for(var o in a)this.assetsOverrideMap.set(o,a[o])},e.getBundle=function(t){return rl.get(t)||null},e.removeBundle=function(t){t._destroy(),rl.remove(t.name)},e.loadAny=function(t,e,i,n){var r=_v(e,i,n),s=r.options,a=r.onProgress,o=r.onComplete;s.preset=s.preset||"default",t=Array.isArray(t)?t.slice():t;var u=cl.create({input:t,onProgress:a,onComplete:pv(o),options:s});sl.async(u)},e.preloadAny=function(t,e,i,n){var r=_v(e,i,n),s=r.options,a=r.onProgress,o=r.onComplete;s.preset=s.preset||"preload",t=Array.isArray(t)?t.slice():t;var u=cl.create({input:t,onProgress:a,onComplete:pv(o),options:s});al.async(u)},e.loadRemote=function(t,e,i){var n=_v(e,void 0,i),r=n.options,s=n.onComplete;r.reloadAsset||!this.assets.has(t)?(r.__isNative__=!0,r.preset=r.preset||"remote",this.loadAny({url:t},r,null,(function(e,i){e?(F(e.message,e.stack),s&&s(e,i)):Zv.create(t,i,r.ext||Dl(t),r,(function(t,e){s&&s(t,e)}))}))):pv(s)(null,this.assets.get(t))},e.loadBundle=function(t,e,i){var n=_v(e,void 0,i),r=n.options,s=n.onComplete,a=Nl(t);this.bundles.has(a)?pv(s)(null,this.getBundle(a)):(r.preset=r.preset||"bundle",r.ext="bundle",r.__isNative__=!0,this.loadAny({url:t},r,null,(function(e,i){e?(F(e.message,e.stack),s&&s(e,i)):Zv.create(t,i,"bundle",r,(function(t,e){s&&s(t,e)}))})))},e.releaseAsset=function(t){rv.tryRelease(t,!0)},e.releaseUnusedAssets=function(){el.forEach((function(t){rv.tryRelease(t)}))},e.releaseAll=function(){el.forEach((function(t){rv.tryRelease(t,!0)}))},e.loadWithJson=function(){throw new Error("Only valid in Editor")},h(t,[{key:"main",get:function(){return rl.get(hl.MAIN)||null}},{key:"resources",get:function(){return rl.get(hl.RESOURCES)||null}}]),t}());_y.Pipeline=$h,_y.Task=cl,_y.Cache=Jh,_y.RequestItem=oy,_y.Bundle=mv,_y.BuiltinBundleName=hl;var fy=t("assetManager",b.assetManager=new _y);b.AssetManager=_y;var dy,py,my,gy=function(){function t(){this._resources={},this._materialsToBeCompiled=[]}var e=t.prototype;return e.init=function(){for(var t=this._resources,e=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++)e[a]=0,e[a+1]=0,e[a+2]=0,e[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 l=0;l<8;l++){for(var c=0;c<8;c++)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 f=0;f<8;f++)u[a]=85,u[a+1]=85,u[a+2]=85,u[a+3]=255,a+=4;a+=32}var d={width:2,height:2,_data:e,_compressed:!1,format:qg.PixelFormat.RGBA8888},p={width:2,height:2,_data:i,_compressed:!1,format:qg.PixelFormat.RGBA8888},m={width:2,height:2,_data:n,_compressed:!1,format:qg.PixelFormat.RGBA8888},g={width:2,height:2,_data:r,_compressed:!1,format:qg.PixelFormat.RGBA8888},v={width:2,height:2,_data:s,_compressed:!1,format:qg.PixelFormat.RGBA8888},y={width:16,height:16,_data:u,_compressed:!1,format:qg.PixelFormat.RGBA8888},E=new Ag(d),T=new qg;T._uuid="black-texture",T.image=E,t[T._uuid]=T;var S=new Ag(p),A=new qg;A._uuid="empty-texture",A.image=S,t[A._uuid]=A;var R=new Qg;R._uuid="black-cube-texture",R.setMipFilter(Qg.Filter.NEAREST),R.image={front:new Ag(d),back:new Ag(d),left:new Ag(d),right:new Ag(d),top:new Ag(d),bottom:new Ag(d)},t[R._uuid]=R;var C=new Ag(m),w=new qg;w._uuid="grey-texture",w.image=C,t[w._uuid]=w;var I=new Qg;I._uuid="grey-cube-texture",I.setMipFilter(Qg.Filter.NEAREST),I.image={front:new Ag(m),back:new Ag(m),left:new Ag(m),right:new Ag(m),top:new Ag(m),bottom:new Ag(m)},t[I._uuid]=I;var O=new Ag(g),x=new qg;x._uuid="white-texture",x.image=O,t[x._uuid]=x;var P=new Qg;P._uuid="white-cube-texture",P.setMipFilter(Qg.Filter.NEAREST),P.image={front:new Ag(g),back:new Ag(g),left:new Ag(g),right:new Ag(g),top:new Ag(g),bottom:new Ag(g)},t[P._uuid]=P;var D=new Ag(v),B=new qg;B._uuid="normal-texture",B.image=D,t[B._uuid]=B;var N=new Ag(y),M=new qg;M._uuid="default-texture",M.image=N,t[M._uuid]=M;var L=new Qg;if(L.setMipFilter(Qg.Filter.NEAREST),L._uuid="default-cube-texture",L.image={front:new Ag(y),back:new Ag(y),left:new Ag(y),right:new Ag(y),top:new Ag(y),bottom:new Ag(y)},t[L._uuid]=L,b.SpriteFrame){var F=new b.SpriteFrame,U=E,G=new qg;G.image=U,F.texture=G,F._uuid="default-spriteframe",t[F._uuid]=F}},e.addAsset=function(t,e){this._resources[t]=e},e.get=function(t){return this._resources[t]},e.loadBuiltinAssets=function(){var t=this,e=ye.querySettings(ve.Category.ENGINE,"builtinAssets");if(!e)return Promise.resolve();var i=this._resources;return new Promise((function(n,r){fy.loadBundle(hl.INTERNAL,(function(s){s?r(s):fy.loadAny(e,(function(e,s){e?r(e):(s.forEach((function(e){i[e.name]=e,rv.addIgnoredAsset(e),e instanceof b.Material&&t._materialsToBeCompiled.push(e)})),n())}))}))}))},e.compileBuiltinMaterial=function(){for(var t=0;t<this._materialsToBeCompiled.length;++t)for(var e=this._materialsToBeCompiled[t],i=0;i<e.passes.length;++i)e.passes[i].tryCompile();this._materialsToBeCompiled.length=0},t}(),vy=t("builtinResMgr",b.builtinResMgr=new gy),yy=t("getPhaseID",(dy=new Map,py=0,function(t){return"number"==typeof t?t:(dy.has(t)||(dy.set(t,1<<py),py++),dy.get(t))})),Ey=t("InstancedBuffer",function(){function t(t){this.instances=[],this.pass=void 0,this.hasPendingModels=!1,this.dynamicOffsets=[],this._device=void 0,this._device=t.device,this.pass=t}var e=t.prototype;return e.destroy=function(){for(var t=0;t<this.instances.length;++t){var e=this.instances[t];e.vb.destroy(),e.ia.destroy()}this.instances.length=0},e.merge=function(t,e,i){void 0===i&&(i=null);var n=t.instancedAttributeBlock,r=n.buffer.length;if(r){var s=t.inputAssembler,a=t.descriptorSet.getTexture(rm),o=i;o||(o=t.shaders[e]);for(var u=t.descriptorSet,h=0;h<this.instances.length;++h){var l,c,_=this.instances[h];if(!((null===(l=_.ia.indexBuffer)||void 0===l?void 0:l.objectID)!==(null===(c=s.indexBuffer)||void 0===c?void 0:c.objectID)||_.count>=1024)&&_.lightingMap.objectID===a.objectID&&_.stride===r){if(_.count>=_.capacity){_.capacity<<=1;var f=_.stride*_.capacity,d=_.data;_.data=new Uint8Array(f),_.data.set(d),_.vb.resize(f)}return _.shader=o,_.descriptorSet=u,_.data.set(n.buffer,_.stride*_.count++),void(this.hasPendingModels=!0)}}for(var p=this._device.createBuffer(new Mr(Dn.VERTEX|Dn.TRANSFER_DST,Mn.HOST|Mn.DEVICE,32*r,r)),m=new Uint8Array(32*r),g=s.vertexBuffers.slice(),v=s.attributes.slice(),y=s.indexBuffer,E=0;E<n.attributes.length;E++){var T=n.attributes[E],S=new Jr(T.name,T.format,T.isNormalized,g.length,!0);v.push(S)}m.set(n.buffer),g.push(p);var A=new ts(v,g,y),R=this._device.createInputAssembler(A);this.instances.push({count:1,capacity:32,vb:p,data:m,ia:R,stride:r,shader:o,descriptorSet:u,lightingMap:a}),this.hasPendingModels=!0}},e.uploadBuffers=function(t){for(var e=0;e<this.instances.length;++e){var i=this.instances[e];i.count&&(i.ia.instanceCount=i.count,t.updateBuffer(i.vb,i.data))}},e.clear=function(){for(var t=0;t<this.instances.length;++t)this.instances[t].count=0;this.hasPendingModels=!1},t}()),Ty=function(){function t(t){this.batches=[],this.dynamicOffsets=[],this._device=void 0,this._device=t.device}var e=t.prototype;return e.destroy=function(){for(var t=0;t<this.batches.length;++t){for(var e=this.batches[t],i=0;i<e.vbs.length;++i)e.vbs[i].destroy();e.vbIdx.destroy(),e.ia.destroy(),e.ubo.destroy()}this.batches.length=0},e.merge=function(t,e,i){var n=t.subMesh.flatBuffers;if(0!==n.length){for(var r=0,s=0,a=n[0].count,o=t.passes[e],u=t.shaders[e],h=t.descriptorSet,l=!1,c=0;c<this.batches.length;++c){var _=this.batches[c];if(_.vbs.length===n.length&&_.mergeCount<Np.BATCHING_COUNT){l=!0;for(var f=0;f<_.vbs.length;++f)if(_.vbs[f].stride!==n[f].stride){l=!1;break}if(l){for(var d=0;d<_.vbs.length;++d){var p=n[d],m=_.vbs[d],g=_.vbDatas[d];(r=(a+_.vbCount)*p.stride)>m.size&&(m.resize(r),_.vbDatas[d]=new Uint8Array(r),_.vbDatas[d].set(g)),_.vbDatas[d].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 S=y;S<E;S++)v[S]=T+.1;return un.toArray(_.uboData,i.transform.worldMatrix,Np.MAT_WORLDS_OFFSET+16*_.mergeCount),_.mergeCount||(h.bindBuffer(Np.BINDING,_.ubo),h.update(),_.pass=o,_.shader=u,_.descriptorSet=h),++_.mergeCount,_.vbCount+=a,void(_.ia.vertexCount+=a)}}}for(var A=[],R=[],b=[],C=0;C<n.length;++C){var w=n[C],I=this._device.createBuffer(new Mr(Dn.VERTEX|Dn.TRANSFER_DST,Mn.HOST|Mn.DEVICE,w.count*w.stride,w.stride));I.update(w.buffer.buffer),A.push(I),R.push(new Uint8Array(I.size)),b.push(I)}var O=this._device.createBuffer(new Mr(Dn.VERTEX|Dn.TRANSFER_DST,Mn.HOST|Mn.DEVICE,4*a,4)),x=new Float32Array(a);x.fill(0),O.update(x),b.push(O);for(var P=t.inputAssembler.attributes,D=new Array(P.length+1),B=0;B<P.length;++B)D[B]=P[B];D[P.length]=new Jr("a_dyn_batch_id",On.R32F,!1,n.length);var N=new ts(D,b),M=this._device.createInputAssembler(N),L=this._device.createBuffer(new Mr(Dn.UNIFORM|Dn.TRANSFER_DST,Mn.HOST|Mn.DEVICE,Np.SIZE,Np.SIZE));h.bindBuffer(Np.BINDING,L),h.update();var F=new Float32Array(Np.COUNT);un.toArray(F,i.transform.worldMatrix,Np.MAT_WORLDS_OFFSET),this.batches.push({mergeCount:1,vbs:A,vbDatas:R,vbIdx:O,vbIdxData:x,vbCount:a,ia:M,ubo:L,uboData:F,pass:o,shader:u,descriptorSet:h})}},e.clear=function(){for(var t=0;t<this.batches.length;++t){var e=this.batches[t];e.vbCount=0,e.mergeCount=0,e.ia.vertexCount=0}},t}(),Sy=new Mr(Dn.UNIFORM|Dn.TRANSFER_DST,Mn.DEVICE),Ay=new Lr(null),Ry=new _s(null);!function(t){t[t.NONE=0]="NONE",t[t.INSTANCING=1]="INSTANCING",t[t.VB_MERGING=2]="VB_MERGING"}(my||(my={}));var by=function(){function t(t){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 Zs,this._dss=new qs,this._rs=new Ks,this._priority=tp.DEFAULT,this._stage=$d.DEFAULT,this._phase=yy("default"),this._primitive=er.TRIANGLE_LIST,this._batchingScheme=my.NONE,this._dynamicStates=sr.NONE,this._instancedBuffers={},this._batchedBuffers={},this._hash=0,this._root=void 0,this._device=void 0,this._rootBufferDirty=!1,this._root=t,this._device=Ja.gfxDevice}t.fillPipelineInfo=function(t,e){void 0!==e.priority&&(t._priority=e.priority),void 0!==e.primitive&&(t._primitive=e.primitive),void 0!==e.stage&&(t._stage=e.stage),void 0!==e.dynamicStates&&(t._dynamicStates=e.dynamicStates),void 0!==e.phase&&(t._phase=yy(e.phase));var i=t._bs;if(e.blendState){var n=e.blendState,r=n.targets;r&&r.forEach((function(t,e){i.setTarget(e,t)})),void 0!==n.isA2C&&(i.isA2C=n.isA2C),void 0!==n.isIndepend&&(i.isIndepend=n.isIndepend),void 0!==n.blendColor&&(i.blendColor=n.blendColor)}t._rs.assign(e.rasterizerState),t._dss.assign(e.depthStencilState)},t.getPassHash=function(t){var e,i=Jm.getKey(t.program,t.defines)+","+t._primitive+","+t._dynamicStates;return i+=function(t){for(var e,i=",bs,"+t.isA2C,n=y(t.targets);!(e=n()).done;){var r=e.value;i+=",bt,"+r.blend+","+r.blendEq+","+r.blendAlphaEq+","+r.blendColorMask,i+=","+r.blendSrc+","+r.blendDst+","+r.blendSrcAlpha+","+r.blendDstAlpha}return i}(t._bs),i+=function(t){var e=",dss,"+t.depthTest+","+t.depthWrite+","+t.depthFunc;return e+=","+t.stencilTestFront+","+t.stencilFuncFront+","+t.stencilRefFront+","+t.stencilReadMaskFront,e+=","+t.stencilFailOpFront+","+t.stencilZFailOpFront+","+t.stencilPassOpFront+","+t.stencilWriteMaskFront,(e+=","+t.stencilTestBack+","+t.stencilFuncBack+","+t.stencilRefBack+","+t.stencilReadMaskBack)+","+t.stencilFailOpBack+","+t.stencilZFailOpBack+","+t.stencilPassOpBack+","+t.stencilWriteMaskBack}(t._dss),Vs(i+=",rs,"+(e=t._rs).cullMode+","+e.depthBias+","+e.isFrontFaceCCW,666)};var e=t.prototype;return e.initialize=function(t){this._doInit(t),this.resetUBOs(),this.resetTextures(),this.tryCompile()},e.getHandle=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=Pn.UNKNOWN);var n=this._propertyHandleMap[t];return n?(i?n=xm(n,i):e&&(n=xm(n,Cm(n)-e)),n+e):0},e.getBinding=function(e){var i=this.getHandle(e);return i?t.getBindingFromHandle(i):-1},e.setUniform=function(e,i){var n=t.getBindingFromHandle(e),r=t.getTypeFromHandle(e),s=t.getOffsetFromHandle(e),a=this._getBlockView(r,n);Dm[r](a,i,s),this._rootBufferDirty=!0},e.getUniform=function(e,i){var n=t.getBindingFromHandle(e),r=t.getTypeFromHandle(e),s=t.getOffsetFromHandle(e),a=this._getBlockView(r,n);return Pm[r](a,i,s)},e.setUniformArray=function(e,i){for(var n=t.getBindingFromHandle(e),r=t.getTypeFromHandle(e),s=Ps(r)>>2,a=this._getBlockView(r,n),o=t.getOffsetFromHandle(e),u=0;u<i.length;u++,o+=s)null!==i[u]&&Dm[r](a,i[u],o);this._rootBufferDirty=!0},e.bindTexture=function(t,e,i){this._descriptorSet.bindTexture(t,e,i||0)},e.bindSampler=function(t,e,i){this._descriptorSet.bindSampler(t,e,i||0)},e.setDynamicState=function(t,e){var i=this._dynamics[t];i&&i.value===e||(i.value=e,i.dirty=!0)},e.overridePipelineStates=function(){console.warn("base pass cannot override states, please use pass instance instead.")},e._setRootBufferDirty=function(t){this._rootBufferDirty=t},e.update=function(){this._descriptorSet?(this._rootBuffer&&this._rootBufferDirty&&(this._rootBuffer.update(this._rootBlock),this._rootBufferDirty=!1),this._descriptorSet.update()):K(12006)},e.getInstancedBuffer=function(t){return void 0===t&&(t=0),this._instancedBuffers[t]||(this._instancedBuffers[t]=new Ey(this))},e.getBatchedBuffer=function(t){return void 0===t&&(t=0),this._batchedBuffers[t]||(this._batchedBuffers[t]=new Ty(this))},e.destroy=function(){for(var t=0;t<this._shaderInfo.blocks.length;t++){var e=this._shaderInfo.blocks[t];this._buffers[e.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()},e.resetUniform=function(e){var i=this.getHandle(e);if(i){for(var n=t.getTypeFromHandle(i),r=t.getBindingFromHandle(i),s=t.getOffsetFromHandle(i),a=t.getCountFromHandle(i),o=this._getBlockView(n,r),u=this._properties[e],h=u&&u.value||Nm(n),l=(Ps(n)>>2)*a,c=0;c+h.length<=l;c+=h.length)o.set(h,s+c);this._rootBufferDirty=!0}},e.resetTexture=function(e,i){var n=this.getHandle(e);if(n){var r=t.getTypeFromHandle(n),s=t.getBindingFromHandle(n),a=this._properties[e],o=a&&a.value,u=o?""+o+Mm(r):Nm(r),h=vy.get(u),l=h&&h.getGFXTexture(),c=a&&void 0!==a.samplerHash?ia.unpackFromHash(a.samplerHash):h&&h.getSamplerInfo(),_=this._device.getSampler(c);this._descriptorSet.bindSampler(s,_,i||0),this._descriptorSet.bindTexture(s,l,i||0)}},e.resetUBOs=function(){for(var t=0;t<this._shaderInfo.blocks.length;t++)for(var e=this._shaderInfo.blocks[t],i=0,n=0;n<e.members.length;n++){for(var r=e.members[n],s=this._getBlockView(r.type,e.binding),a=this._properties[r.name],o=a&&a.value||Nm(r.type),u=(Ps(r.type)>>2)*r.count,h=0;h+o.length<=u;h+=o.length)s.set(o,i+h);i+=u}this._rootBufferDirty=!0},e.resetTextures=function(){for(var t=0;t<this._shaderInfo.samplerTextures.length;t++)for(var e=this._shaderInfo.samplerTextures[t],i=0;i<e.count;i++)this.resetTexture(e.name,i)},e.tryCompile=function(){var e=this._root.pipeline;if(!e)return!1;this._syncBatchingScheme();var i=Jm.getGFXShader(this._device,this._programName,this._defines,e);return i?(this._shader=i,this._pipelineLayout=Jm.getTemplateInfo(this._programName).pipelineLayout,this._hash=t.getPassHash(this),!0):(console.warn("create shader "+this._programName+" failed"),!1)},e.getShaderVariant=function(t){if(void 0===t&&(t=null),!this._shader&&!this.tryCompile())return console.warn("pass resources incomplete"),null;if(!t)return this._shader;for(var e=this._root.pipeline,i=0;i<t.length;i++){var n=t[i];this._defines[n.name]=n.value}for(var r=Jm.getGFXShader(this._device,this._programName,this._defines,e),s=0;s<t.length;s++){var a=t[s];delete this._defines[a.name]}return r},e.beginChangeStatesSilently=function(){},e.endChangeStatesSilently=function(){},e._doInit=function(e,i){void 0===i&&(i=!1),this._priority=tp.DEFAULT,this._stage=$d.DEFAULT,this._phase=yy("default"),this._primitive=er.TRIANGLE_LIST,this._passIndex=e.passIndex,this._propertyIndex=void 0!==e.propertyIndex?e.propertyIndex:e.passIndex,this._programName=e.program,this._defines=i?l({},e.defines):e.defines,this._shaderInfo=Jm.getTemplate(e.program),this._properties=e.properties||this._properties;var n=this._device;t.fillPipelineInfo(this,e),e.stateOverrides&&t.fillPipelineInfo(this,e.stateOverrides),Ry.layout=Jm.getDescriptorSetLayout(this._device,e.program),this._descriptorSet=this._device.createDescriptorSet(Ry);for(var r=this._shaderInfo.blocks,s=Jm.getTemplateInfo(e.program),a=s.blockSizes,o=s.handleMap,u=n.capabilities.uboOffsetAlignment,h=[],c=0,_=0,f=0;f<r.length;f++){var d=a[f];h.push(_),_+=Math.ceil(d/u)*u,c=d}var p=h[h.length-1]+c;p&&(Sy.size=16*Math.ceil(p/16),this._rootBuffer=n.createBuffer(Sy),this._rootBlock=new ArrayBuffer(p));for(var m=0,g=0;m<r.length;m++){var v=r[m].binding,y=a[m];Ay.buffer=this._rootBuffer,Ay.offset=h[g++],Ay.range=16*Math.ceil(y/16);var E=this._buffers[v]=n.createBuffer(Ay);this._blocks[v]=new Float32Array(this._rootBlock,Ay.offset,y/Float32Array.BYTES_PER_ELEMENT),this._blocksInt[v]=new Int32Array(this._blocks[v].buffer,this._blocks[v].byteOffset,this._blocks[v].length),this._descriptorSet.bindBuffer(v,E)}var T=this._propertyHandleMap=o,S={};for(var A in this._properties){var R=this._properties[A];R.handleInfo&&(S[A]=this.getHandle.apply(this,R.handleInfo))}Object.assign(T,S)},e._syncBatchingScheme=function(){this._defines.USE_INSTANCING?this._device.hasFeature(In.INSTANCED_ARRAYS)?this._batchingScheme=my.INSTANCING:(this._defines.USE_INSTANCING=!1,this._batchingScheme=my.NONE):this._defines.USE_BATCHING?this._batchingScheme=my.VB_MERGING:this._batchingScheme=my.NONE},e._getBlockView=function(t,e){return t<Pn.FLOAT?this._blocksInt[e]:this._blocks[e]},e._initPassFromTarget=function(t,e,i){this._priority=t.priority,this._stage=t.stage,this._phase=t.phase,this._batchingScheme=t.batchingScheme,this._primitive=t.primitive,this._dynamicStates=t.dynamicStates,this._bs=t.blendState,this._dss=e,this._descriptorSet=t.descriptorSet,this._rs=t.rasterizerState,this._passIndex=t.passIndex,this._propertyIndex=t.propertyIndex,this._programName=t.program,this._defines=t.defines,this._shaderInfo=t._shaderInfo,this._properties=t._properties,this._blocks=t._blocks,this._blocksInt=t._blocksInt,this._dynamics=t._dynamics,this._shader=t._shader,this._pipelineLayout=Jm.getTemplateInfo(this._programName).pipelineLayout,this._hash=t._hash^i},e._updatePassHash=function(){this._hash=t.getPassHash(this)},h(t,[{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 Jm.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:"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}}]),t}();by.getTypeFromHandle=Cm,by.getBindingFromHandle=wm,by.getCountFromHandle=Im,by.getOffsetFromHandle=Om;var Cy=t("PipelineStateManager",function(){function t(){}return t.getOrCreatePipelineState=function(t,e,i,n,r){var s=e.hash^n.hash^r.attributesHash^i.typedID,a=this._PSOHashMap.get(s);if(!a){var o=e.pipelineLayout,u=new ds(r.attributes),h=new Js(i,o,n,u,e.rasterizerState,e.depthStencilState,e.blendState,e.primitive,e.dynamicStates);a=t.createPipelineState(h),this._PSOHashMap.set(s,a)}return a},t}());Cy._PSOHashMap=new Map;var wy=new Or,Iy=new Sr;function Oy(t,e){t.x=e.x*e.x,t.y=e.y*e.y,t.z=e.z*e.z}var xy,Py,Dy,By,Ny,My,Ly,Fy,Uy,Gy,ky=null;function zy(t,e,i,n,r){if(n&&n.enabled&&r===ky){var s=n.subModels[0],a=s.inputAssembler,o=s.passes,u=s.shaders,h=s.descriptorSet;wy.width=Iy.width=r.window.width,wy.height=Iy.height=r.window.height;var l=Cy.getOrCreatePipelineState(t,o[0],u[0],e,a);i.setViewport(wy),i.setScissor(Iy),i.bindPipelineState(l),i.bindDescriptorSet(lp.MATERIAL,o[0].descriptorSet),i.bindDescriptorSet(lp.LOCAL,h),i.bindInputAssembler(a),i.draw(a)}}var Hy=new Li,Vy=t("Material",(xy=_h("cc.Material"),Py=Kh(tg),xy((Gy=function(t){function e(){var e;return E(e=t.call(this)||this,"_effectAsset",Ny,g(e)),E(e,"_techIdx",My,g(e)),E(e,"_defines",Ly,g(e)),E(e,"_states",Fy,g(e)),E(e,"_props",Uy,g(e)),e._passes=[],e._hash=0,e}c(e,t),e.getHash=function(t){for(var e,i=0,n=y(t.passes);!(e=n()).done;)i^=e.value.hash;return i};var i=e.prototype;return i.initialize=function(t){this._passes.length?j(12005):(this._defines||(this._defines=[]),this._states||(this._states=[]),this._props||(this._props=[]),this._fillInfo(t),this._update())},i.reset=function(t){this.initialize(t)},i.destroy=function(){return this._doDestroy(),t.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(t){void 0===t&&(t=!0),this._props.length=this._passes.length;for(var e=0;e<this._props.length;e++)this._props[e]={};if(t)for(var i,n=y(this._passes);!(i=n()).done;){var r=i.value;r.resetUBOs(),r.resetTextures()}},i.setProperty=function(t,e,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,t,e)&&(this._props[o.propertyIndex][t]=e,n=!0)}else{if(i>=this._passes.length)return void console.warn("illegal pass index: "+i+".");var u=this._passes[i];this._uploadProperty(u,t,e)&&(this._props[u.propertyIndex][t]=e,n=!0)}n||console.warn("illegal property name: "+t+".")},i.getProperty=function(t,e){if(void 0===e)for(var i=this._props,n=i.length,r=0;r<n;r++){var s=i[r];if(t in s)return s[t]}else{if(e>=this._props.length)return console.warn("illegal pass index: "+e+"."),null;var a=this._props[this._passes[e].propertyIndex];if(t in a)return a[t]}return null},i.copy=function(t,e){this._techIdx=t._techIdx,this._props.length=t._props.length;for(var i=0;i<t._props.length;i++)this._props[i]=l({},t._props[i]);this._defines.length=t._defines.length;for(var n=0;n<t._defines.length;n++)this._defines[n]=l({},t._defines[n]);this._states.length=t._states.length;for(var r=0;r<t._states.length;r++)this._states[r]=l({},t._states[r]);this._effectAsset=t._effectAsset,e&&this._fillInfo(e),this._update()},i._fillInfo=function(t){void 0!==t.technique&&(this._techIdx=t.technique),t.effectAsset?this._effectAsset=t.effectAsset:t.effectName&&(this._effectAsset=tg.get(t.effectName)),t.defines&&this._prepareInfo(t.defines,this._defines),t.states&&this._prepareInfo(t.states,this._states)},i._prepareInfo=function(t,e){var i=t;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(e[r]||(e[r]={}),i[r])},i._createPasses=function(){var t=this._effectAsset.techniques[this._techIdx||0];if(!t)return[];for(var e=t.passes.length,i=[],n=0;n<e;++n){var r=t.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 by(b.director.root);o.initialize(r),i.push(o)}}return i},i._update=function(t){var i=this;if(void 0===t&&(t=!0),this._effectAsset){this._passes=this._createPasses();var n=this._effectAsset.techniques[this._techIdx].passes.length;if(this._props.length=n,t)this._passes.forEach((function(t,e){var n=i._props[e];for(var r in n||(n=i._props[e]={}),void 0!==t.propertyIndex&&Object.assign(n,i._props[t.propertyIndex]),n)i._uploadProperty(t,r,n[r])}));else for(var r=0;r<this._props.length;r++)this._props[r]={}}this._hash=e.getHash(this)},i._uploadProperty=function(t,e,i){var n=t.getHandle(e);if(!n)return!1;if(by.getTypeFromHandle(n)<Pn.SAMPLER1D)if(Array.isArray(i))t.setUniformArray(n,i);else if(null!==i){var r;if(null===(r=t.properties[e])||void 0===r?void 0:r.linear){var s=i;Oy(Hy,s),Hy.w=s.w,i=Hy}t.setUniform(n,i)}else t.resetUniform(e);else if(Array.isArray(i))for(var a=0;a<i.length;a++)this._bindTexture(t,n,i[a],a);else i?this._bindTexture(t,n,i):t.resetTexture(e);return!0},i._bindTexture=function(t,e,i,n){var r=by.getBindingFromHandle(e);if(i instanceof ra)t.bindTexture(r,i,n);else if(i instanceof Tg){var s=i.getGFXTexture();if(!s||!s.width||!s.height)return;t.bindTexture(r,s,n),t.bindSampler(r,i.getGFXSampler(),n)}},i._doDestroy=function(){if(this._passes&&this._passes.length)for(var t,e=y(this._passes);!(t=e()).done;)t.value.destroy();this._passes.length=0},i.initDefault=function(e){t.prototype.initDefault.call(this,e),this.initialize({effectName:"builtin-unlit",defines:{USE_COLOR:!0},technique:0}),this.setProperty("mainColor",new Gi("#ff00ff"))},i.validate=function(){return!!this._effectAsset&&!this._effectAsset.isDefault&&this.passes.length>0},h(e,[{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}}]),e}(Wl),Ny=T((By=Gy).prototype,"_effectAsset",[Py],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),My=T(By.prototype,"_techIdx",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),Ly=T(By.prototype,"_defines",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),Fy=T(By.prototype,"_states",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),Uy=T(By.prototype,"_props",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),Dy=By))||Dy));function Wy(t,e){for(var i,n=y(e);!(i=n()).done;){var r=i.value;Array.isArray(r)?Wy(t,r):t.push(r)}}function Xy(t){var e=[];return Wy(e,t),e.join("")}b.Material=Vy,ft({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 jy=Ta.Flags.Destroyed,Yy=Ta.Flags.PersistentMask,Ky=hi.IDENTIFIER_RE,qy="var ",Qy="o",Zy={"cc.ClickEvent":!1,"cc.PrefabInfo":!1},Jy=hi.escapeForJS,$y=function(){function t(t,e){this.varName=void 0,this.expression=void 0,this.varName=t,this.expression=e}return t.prototype.toString=function(){return qy+this.varName+"="+this.expression+";"},t}();function tE(t,e){return e instanceof $y?new $y(e.varName,t+e.expression):t+e}function eE(t,e,i){Array.isArray(i)?(i[0]=tE(e,i[0]),t.push(i)):t.push(tE(e,i)+";")}var iE=function(){function t(t){this._exps=void 0,this._targetExp=void 0,this._exps=[],this._targetExp=t}var e=t.prototype;return e.append=function(t,e){this._exps.push([t,e])},e.writeCode=function(t){var e;if(this._exps.length>1)t.push("t="+this._targetExp+";"),e="t";else{if(1!==this._exps.length)return;e=this._targetExp}for(var i=0;i<this._exps.length;i++){var n=this._exps[i];eE(t,e+nE(n[0])+"=",n[1])}},t}();function nE(t){return Ky.test(t)?"."+t:"["+Jy(t)+"]"}iE.pool=void 0,iE.pool=new ue((function(t){t._exps.length=0,t._targetExp=null}),1),iE.pool.get=function(t){var e=this._get()||new iE;return e._targetExp=t,e};var rE=function(){function t(t,e){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=e,this.objsToClear_iN$t=[],this.codeArray=[],this.objs=[],this.funcs=[],this.funcModuleCache=Bt(),Wt(this.funcModuleCache,Zy),this.globalVariables=[],this.globalVariableId=0,this.localVariableId=0,this.codeArray.push("var o,t;","if(R){","o=R;","}else{","o=R=new "+this.getFuncModule(t.constructor,!0)+"();","}"),t._iN$t={globalVar:"R"},this.objsToClear_iN$t.push(t),this.enumerateObject(this.codeArray,t),this.globalVariables.length>0&&(i=qy+this.globalVariables.join(",")+";");var n=Xy(["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 e=t.prototype;return e.getFuncModule=function(t,e){var i=Nt(t);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=t===Function("return "+i)())return this.funcModuleCache[i]=i,i}catch(t){}}}var s=this.funcs.indexOf(t);s<0&&(s=this.funcs.length,this.funcs.push(t));var a="F["+s+"]";return e&&(a="("+a+")"),this.funcModuleCache[i]=a,a},e.getObjRef=function(t){var e=this.objs.indexOf(t);return e<0&&(e=this.objs.length,this.objs.push(t)),"O["+e+"]"},e.setValueType=function(t,e,i,n){var r=iE.pool.get(n),s=e.constructor.__props__;s||(s=Object.keys(e));for(var a=0;a<s.length;a++){var o=s[a],u=i[o];if(e[o]!==u){var h=this.enumerateField(i,o,u);r.append(o,h)}}r.writeCode(t),iE.pool.put(r)},e.enumerateCCClass=function(t,e,i){for(var n=i.__values__,r=Ge(i),s=0;s<n.length;s++){var a=n[s],o=e[a],u=r[a+"$_$default"];if(!sE(u,o))if("object"==typeof o&&o instanceof b.ValueType&&(u=hi.getDefault(u))&&u.constructor===o.constructor){var h=Qy+nE(a);this.setValueType(t,u,o,h)}else this.setObjProp(t,e,a,o)}},e.instantiateArray=function(t){if(0===t.length)return"[]";var e="a"+ ++this.localVariableId,i=[new $y(e,"new Array("+t.length+")")];t._iN$t={globalVar:"",source:i},this.objsToClear_iN$t.push(t);for(var n=0;n<t.length;++n)eE(i,e+"["+n+"]=",this.enumerateField(t,n,t[n]));return i},e.instantiateTypedArray=function(t){var e=t.constructor.name;if(0===t.length)return"new "+e;var i="a"+ ++this.localVariableId,n=[new $y(i,"new "+e+"("+t.length+")")];t._iN$t={globalVar:"",source:n},this.objsToClear_iN$t.push(t);for(var r=0;r<t.length;++r)0!==t[r]&&eE(n,i+"["+r+"]=",t[r]);return n},e.enumerateField=function(t,e,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]=tE(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?Jy(i):("_objFlags"===e&&Aa(t)&&(i&=Yy),i)},e.setObjProp=function(t,e,i,n){eE(t,Qy+nE(i)+"=",this.enumerateField(e,i,n))},e.enumerateObject=function(t,e){var i=e.constructor;if(li(i))this.enumerateCCClass(t,e,i);else for(var n in e)if(e.hasOwnProperty(n)&&(95!==n.charCodeAt(0)||95!==n.charCodeAt(1)||"__type__"===n)){var r=e[n];"object"==typeof r&&r&&r===e._iN$t||this.setObjProp(t,e,n,r)}},e.instantiateObj=function(t){if(t instanceof b.ValueType)return hi.getNewValueTypeCode(t);if(t instanceof b.Asset)return this.getObjRef(t);if(t._objFlags&jy)return null;var e,i=t.constructor;if(li(i)){if(this.parent)if(this.parent instanceof b.Component){if(t instanceof b._BaseNode||t instanceof b.Component)return this.getObjRef(t)}else if(this.parent instanceof b._BaseNode)if(t instanceof b._BaseNode){if(!t.isChildOf(this.parent))return this.getObjRef(t)}else if(t instanceof b.Component){var n;if(!(null===(n=t.node)||void 0===n?void 0:n.isChildOf(this.parent)))return this.getObjRef(t)}e=new $y(Qy,"new "+this.getFuncModule(i,!0)+"()")}else if(i===Object)e=new $y(Qy,"{}");else{if(i)return this.getObjRef(t);e=new $y(Qy,"Object.create(null)")}var r=[e];return t._iN$t={globalVar:"",source:r},this.objsToClear_iN$t.push(t),this.enumerateObject(r,t),["(function(){",r,"return o;})();"]},t}();function sE(t,e){if("function"==typeof t)try{t=t()}catch(t){return!1}if(t===e)return!0;if(t&&e&&"object"==typeof t&&"object"==typeof e&&t.constructor===e.constructor)if(t instanceof b.ValueType){if(t.equals(e))return!0}else{if(Array.isArray(t))return 0===t.length&&0===e.length;if(t.constructor===Object)return wt(t)&&wt(e)}return!1}var aE,oE,uE,hE,lE,cE,_E,fE,dE,pE,mE=function(){function t(t){this._uiComp=null,this._opacity=1,this._localOpacity=1,this.colorDirty=!0,this._uiTransformComp=null,this._node=void 0,this._node=t}return t.prototype.applyOpacity=function(t){this._opacity=this._localOpacity*t},t.markOpacityTree=function(){},h(t,[{key:"uiTransformComp",get:function(){return this._uiTransformComp||(this._uiTransformComp=this._node.getComponent("cc.UITransform")),this._uiTransformComp},set:function(t){this._uiTransformComp=t}},{key:"uiComp",get:function(){return this._uiComp},set:function(t){this._uiComp&&t?j(12002):this._uiComp=t}},{key:"opacity",get:function(){return this._opacity}},{key:"localOpacity",get:function(){return this._localOpacity},set:function(t){this._localOpacity=t,this.colorDirty=!0}}]),t}();Ta.Flags.Destroying,function(t){t.TOUCH_START="touch-start",t.TOUCH_MOVE="touch-move",t.TOUCH_END="touch-end",t.TOUCH_CANCEL="touch-cancel",t.MOUSE_DOWN="mouse-down",t.MOUSE_MOVE="mouse-move",t.MOUSE_UP="mouse-up",t.MOUSE_WHEEL="mouse-wheel",t.MOUSE_ENTER="mouse-enter",t.MOUSE_LEAVE="mouse-leave",t.KEY_DOWN="keydown",t.KEY_UP="keyup",t.DEVICEMOTION="devicemotion",t.TRANSFORM_CHANGED="transform-changed",t.SCENE_CHANGED_FOR_PERSISTS="scene-changed-for-persists",t.SIZE_CHANGED="size-changed",t.ANCHOR_CHANGED="anchor-changed",t.COLOR_CHANGED="color-changed",t.CHILD_ADDED="child-added",t.CHILD_REMOVED="child-removed",t.PARENT_CHANGED="parent-changed",t.NODE_DESTROYED="node-destroyed",t.LAYER_CHANGED="layer-changed",t.SIBLING_ORDER_CHANGED="sibling-order-changed",t.ACTIVE_IN_HIERARCHY_CHANGED="active-in-hierarchy-changed",t.COMPONENT_ADDED="component-added",t.COMPONENT_REMOVED="component-removed"}(aE||(aE=t("NodeEventType",{})));var gE=Ta.Flags.Destroying,vE=Ta.Flags.DontDestroy,yE=Ta.Flags.Deactivating,EE=new Tt("Node");function TE(t){return t?"string"==typeof t?se(t):t:(K(3804),null)}var SE,AE,RE,bE,CE,wE,IE,OE,xE,PE,DE,BE,NE,ME=t("BaseNode",_h("cc.BaseNode")((pE=dE=function(t){c(i,t),i._setScene=function(t){t._updateScene()},i._findComponent=function(t,e){var i=e,n=t._components;if(i._sealed)for(var r=0;r<n.length;++r){var s=n[r];if(s.constructor===e)return s}else for(var a=0;a<n.length;++a){var o=n[a];if(o instanceof e)return o}return null},i._findComponents=function(t,e,i){var n=e,r=t._components;if(n._sealed)for(var s=0;s<r.length;++s){var a=r[s];a.constructor===e&&i.push(a)}else for(var o=0;o<r.length;++o){var u=r[o];u instanceof e&&i.push(u)}},i._findChildComponent=function(t,e){for(var n=0;n<t.length;++n){var r=t[n],s=i._findComponent(r,e);if(s)return s;if(r._children.length>0&&(s=i._findChildComponent(r._children,e)))return s}return null},i._findChildComponents=function(t,e,n){for(var r=0;r<t.length;++r){var s=t[r];i._findComponents(s,e,n),s._children.length>0&&i._findChildComponents(s._children,e,n)}};var e=i.prototype;function i(e){var i;return E(i=t.call(this,e)||this,"_parent",hE,g(i)),E(i,"_children",lE,g(i)),E(i,"_active",cE,g(i)),E(i,"_components",_E,g(i)),E(i,"_prefab",fE,g(i)),i._scene=null,i._activeInHierarchy=!1,i._id=EE.getNewId(),i._name=void 0,i._eventProcessor=new b.NodeEventProcessor(g(i)),i._eventMask=0,i._siblingIndex=0,i._originalSceneId="",i._name=void 0!==e?e:"New Node",i}return e._updateScene=function(){null==this._parent?F("Node %s(%s) has not attached to a scene.",this.name,this.uuid):this._scene=this._parent._scene},e.attr=function(t){Wt(this,t)},e.getParent=function(){return this._parent},e.setParent=function(t,e){if(void 0===e&&(e=!1),this._parent!==t){var i=this._parent,n=t;if(this._parent=n,this._siblingIndex=0,this._onSetParent(i,e),this.emit&&this.emit(aE.PARENT_CHANGED,i),i&&!(i._objFlags&gE)){var r=i._children.indexOf(this);i._children.splice(r,1),i._updateSiblingIndex(),i.emit&&i.emit(aE.CHILD_REMOVED,this)}n&&(n._children.push(this),this._siblingIndex=n._children.length-1,n.emit&&n.emit(aE.CHILD_ADDED,this)),this._onHierarchyChanged(i)}},e.getChildByUuid=function(t){if(!t)return M("Invalid uuid"),null;for(var e=this._children,i=0,n=e.length;i<n;i++)if(e[i]._id===t)return e[i];return null},e.getChildByName=function(t){if(!t)return M("Invalid name"),null;for(var e=this._children,i=0,n=e.length;i<n;i++)if(e[i]._name===t)return e[i];return null},e.getChildByPath=function(t){for(var e=t.split("/"),i=this,n=function(t){var n=e[t];if(0===n.length)return"continue";var r=i.children.find((function(t){return t.name===n}));if(!r)return{v:null};i=r},r=0;r<e.length;++r){var s=n(r);if("continue"!==s&&"object"==typeof s)return s.v}return i},e.addChild=function(t){t.setParent(this)},e.insertChild=function(t,e){t.setParent(this),t.setSiblingIndex(e)},e.getSiblingIndex=function(){return this._siblingIndex},e.setSiblingIndex=function(t){if(this._parent)if(this._parent._objFlags&yE)K(3821);else{var e=this._parent._children;t=-1!==t?t:e.length-1;var i=e.indexOf(this);t!==i&&(e.splice(i,1),t<e.length?e.splice(t,0,this):e.push(this),this._parent._updateSiblingIndex(),this._onSiblingIndexChanged&&this._onSiblingIndexChanged(t))}},e.walk=function(t,e){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&&t?t(s):h&&e&&e(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--},e.removeFromParent=function(){this._parent&&this._parent.removeChild(this)},e.removeChild=function(t){this._children.indexOf(t)>-1&&(t.parent=null)},e.removeAllChildren=function(){for(var t=this._children,e=t.length-1;e>=0;e--){var i=t[e];i&&(i.parent=null)}this._children.length=0},e.isChildOf=function(t){var e=this;do{if(e===t)return!0;e=e._parent}while(e);return!1},e.getComponent=function(t){var e=TE(t);return e?i._findComponent(this,e):null},e.getComponents=function(t){var e=TE(t),n=[];return e&&i._findComponents(this,e,n),n},e.getComponentInChildren=function(t){var e=TE(t);return e?i._findChildComponent(this._children,e):null},e.getComponentsInChildren=function(t){var e=TE(t),n=[];return e&&(i._findComponents(this,e,n),i._findChildComponents(this._children,e,n)),n},e.addComponent=function(t){var e;if("string"==typeof t){if(!(e=se(t)))throw b._RF.peek()&&K(3808,t),TypeError(J(3807,t))}else{if(!t)throw TypeError(J(3804));e=t}if("function"!=typeof e)throw TypeError(J(3809));if(!Yt(e,b.Component))throw TypeError(J(3810));var i=e._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 e;return a.node=this,this._components.push(a),this.emit(aE.COMPONENT_ADDED,a),this._activeInHierarchy&&b.director._nodeActivator.activateComp(a),a},e.removeComponent=function(t){if(t){var e=null;(e=t instanceof bc?t:this.getComponent(t))&&e.destroy()}else K(3813)},e.on=function(t,e,i,n){switch(void 0===n&&(n=!1),t){case aE.TRANSFORM_CHANGED:this._eventMask|=1}this._eventProcessor.on(t,e,i,n)},e.off=function(t,e,i,n){if(void 0===n&&(n=!1),this._eventProcessor.off(t,e,i,n),!this._eventProcessor.hasEventListener(t))switch(t){case aE.TRANSFORM_CHANGED:this._eventMask&=-2}},e.once=function(t,e,i,n){this._eventProcessor.once(t,e,i,n)},e.emit=function(t,e,i,n,r,s){this._eventProcessor.emit(t,e,i,n,r,s)},e.dispatchEvent=function(t){this._eventProcessor.dispatchEvent(t)},e.hasEventListener=function(t,e,i){return this._eventProcessor.hasEventListener(t,e,i)},e.targetOff=function(t){this._eventProcessor.targetOff(t),1&this._eventMask&&!this._eventProcessor.hasEventListener(aE.TRANSFORM_CHANGED)&&(this._eventMask&=-2)},e.destroy=function(){return!!t.prototype.destroy.call(this)&&(this.active=!1,!0)},e.destroyAllChildren=function(){for(var t=this._children,e=0;e<t.length;++e)t[e].destroy()},e._removeComponent=function(t){if(t){if(!(this._objFlags&gE)){var e=this._components.indexOf(t);-1!==e?(this._components.splice(e,1),this.emit(aE.COMPONENT_REMOVED,t)):t.node!==this&&K(3815)}}else K(3814)},e._updateSiblingIndex=function(){for(var t=0;t<this._children.length;++t)this._children[t]._siblingIndex=t;this.emit(aE.SIBLING_ORDER_CHANGED)},e._onSetParent=function(t){this._parent&&(null!=t&&t._scene===this._parent._scene||null==this._parent._scene||this.walk(i._setScene))},e._onPostActivated=function(){},e._onBatchCreated=function(){this._parent&&(this._siblingIndex=this._parent._children.indexOf(this))},e._onPreDestroy=function(){this._onPreDestroyBase()},e._onHierarchyChanged=function(t){return this._onHierarchyChangedBase(t)},e._instantiate=function(t,e){return t||(t=b.instantiate._clone(this,this)),t._prefab,t._parent=null,t._onBatchCreated(e),t},e._onHierarchyChangedBase=function(){var t=this._parent;!this._persistNode||t instanceof b.Scene||b.game.removePersistRootNode(this);var e=this._active&&!(!t||!t._activeInHierarchy);this._activeInHierarchy!==e&&b.director._nodeActivator.activateNode(this,e)},e._onPreDestroyBase=function(){this._objFlags|=gE;var t=this._parent,e=!!t&&0!=(t._objFlags&gE);if(this._persistNode&&b.game.removePersistRootNode(this),!e&&t){this.emit(aE.PARENT_CHANGED,this);var i=t._children.indexOf(this);t._children.splice(i,1),this._siblingIndex=0,t._updateSiblingIndex(),t.emit&&t.emit(aE.CHILD_REMOVED,this)}this.emit(aE.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 e},h(i,[{key:"components",get:function(){return this._components}},{key:"_persistNode",get:function(){return(this._objFlags&vE)>0},set:function(t){t?this._objFlags|=vE:this._objFlags&=~vE}},{key:"name",get:function(){return this._name},set:function(t){this._name=t}},{key:"uuid",get:function(){return this._id}},{key:"children",get:function(){return this._children}},{key:"active",get:function(){return this._active},set:function(t){if(t=!!t,this._active!==t){this._active=t;var e=this._parent;e&&e._activeInHierarchy&&b.director._nodeActivator.activateNode(this,t)}}},{key:"activeInHierarchy",get:function(){return this._activeInHierarchy}},{key:"parent",get:function(){return this._parent},set:function(t){this.setParent(t)}},{key:"scene",get:function(){return this._scene}},{key:"eventProcessor",get:function(){return this._eventProcessor}}]),i}(Ta),dE.idGenerator=EE,dE._stacks=[[]],dE._stackId=0,T((uE=pE).prototype,"_persistNode",[mh],Object.getOwnPropertyDescriptor(uE.prototype,"_persistNode"),uE.prototype),T(uE.prototype,"name",[Ph],Object.getOwnPropertyDescriptor(uE.prototype,"name"),uE.prototype),T(uE.prototype,"children",[Ph],Object.getOwnPropertyDescriptor(uE.prototype,"children"),uE.prototype),T(uE.prototype,"active",[Ph],Object.getOwnPropertyDescriptor(uE.prototype,"active"),uE.prototype),T(uE.prototype,"activeInHierarchy",[Ph],Object.getOwnPropertyDescriptor(uE.prototype,"activeInHierarchy"),uE.prototype),T(uE.prototype,"parent",[Ph],Object.getOwnPropertyDescriptor(uE.prototype,"parent"),uE.prototype),hE=T(uE.prototype,"_parent",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),lE=T(uE.prototype,"_children",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),cE=T(uE.prototype,"_active",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),_E=T(uE.prototype,"_components",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),fE=T(uE.prototype,"_prefab",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),oE=uE))||oE);b._BaseNode=ME,function(t){t[t.LOCAL=0]="LOCAL",t[t.WORLD=1]="WORLD"}(SE||(SE=t("NodeSpace",{}))),function(t){t[t.NONE=0]="NONE",t[t.POSITION=1]="POSITION",t[t.ROTATION=2]="ROTATION",t[t.SCALE=4]="SCALE",t[t.RS=t.ROTATION|t.SCALE]="RS",t[t.TRS=t.POSITION|t.ROTATION|t.SCALE]="TRS",t[t.TRS_MASK=~t.TRS]="TRS_MASK"}(AE||(AE=t("TransformBit",{}))),b.internal.TransformBit=AE;var LE=new ji,FE=new $i,UE=new $i,GE=new $i,kE=new Qi,zE=new Qi,HE=new un,VE=[],WE=Symbol("ReserveContentsForAllSyncablePrefab"),XE=0,jE=t("Node",(RE=_h("cc.Node"),bE=Kh(ji),RE((NE=BE=function(t){function e(e){var i;return(i=t.call(this,e)||this)._uiProps=new mE(g(i)),i._static=!1,E(i,"_lpos",IE,g(i)),E(i,"_lrot",OE,g(i)),E(i,"_lscale",xE,g(i)),E(i,"_layer",PE,g(i)),E(i,"_euler",DE,g(i)),i._dirtyFlags=AE.NONE,i._eulerDirty=!1,i._flagChangeVersion=0,i._hasChangedFlags=0,i._pos=new ji,i._rot=new $i,i._scale=new ji(1,1,1),i._mat=new un,i}c(e,t),e.isNode=function(t){return t instanceof e&&(t.constructor===e||!(t instanceof b.Scene))};var i=e.prototype;return i._onPreDestroy=function(){return this._onPreDestroyBase()},i[Oc]=function(t){t.writeThis()},i.setParent=function(e,i){void 0===i&&(i=!1),i&&this.updateWorldTransform(),t.prototype.setParent.call(this,e,i)},i._onSetParent=function(e,i){if(t.prototype._onSetParent.call(this,e,i),i){var n=this._parent;n?(n.updateWorldTransform(),gi(un.determinant(n._mat),0,pi)?(j(14300),this._dirtyFlags|=AE.TRS,this.updateWorldTransform()):(un.multiply(HE,un.invert(HE,n._mat),this._mat),un.toRTS(HE,this._lrot,this._lpos,this._lscale))):(ji.copy(this._lpos,this._pos),$i.copy(this._lrot,this._rot),ji.copy(this._lscale,this._scale)),this._eulerDirty=!0}this.invalidateChildren(AE.TRS)},i._onHierarchyChanged=function(e){this.eventProcessor.reattach(),t.prototype._onHierarchyChangedBase.call(this,e)},i._onBatchCreated=function(t){this.hasChangedFlags=AE.TRS,this._dirtyFlags|=AE.TRS;for(var e=this._children.length,i=0;i<e;++i)this._children[i]._siblingIndex=i,this._children[i]._onBatchCreated(t)},i._onBeforeSerialize=function(){this.eulerAngles},i._onPostActivated=function(t){t?(this._eventProcessor.setEnabled(!0),this.invalidateChildren(AE.TRS),this._uiProps&&this._uiProps.uiComp&&(this._uiProps.uiComp.setNodeDirty(),this._uiProps.uiComp.setTextureDirty(),this._uiProps.uiComp.markForUpdateRenderData())):this._eventProcessor.setEnabled(!1)},i.translate=function(t,e){var i=e||SE.LOCAL;if(i===SE.LOCAL)ji.transformQuat(LE,t,this._lrot),this._lpos.x+=LE.x,this._lpos.y+=LE.y,this._lpos.z+=LE.z;else if(i===SE.WORLD)if(this._parent){$i.invert(FE,this._parent.worldRotation),ji.transformQuat(LE,t,FE);var n=this.worldScale;this._lpos.x+=LE.x/n.x,this._lpos.y+=LE.y/n.y,this._lpos.z+=LE.z/n.z}else this._lpos.x+=t.x,this._lpos.y+=t.y,this._lpos.z+=t.z;this.invalidateChildren(AE.POSITION),1&this._eventMask&&this.emit(aE.TRANSFORM_CHANGED,AE.POSITION)},i.rotate=function(t,e){var i=e||SE.LOCAL;if($i.normalize(FE,t),i===SE.LOCAL)$i.multiply(this._lrot,this._lrot,FE);else if(i===SE.WORLD){var n=this.worldRotation;$i.multiply(UE,FE,n),$i.invert(FE,n),$i.multiply(UE,FE,UE),$i.multiply(this._lrot,this._lrot,UE)}this._eulerDirty=!0,this.invalidateChildren(AE.ROTATION),1&this._eventMask&&this.emit(aE.TRANSFORM_CHANGED,AE.ROTATION)},i.lookAt=function(t,e){this.getWorldPosition(LE),ji.subtract(LE,LE,t),ji.normalize(LE,LE),$i.fromViewUp(FE,LE,e),this.setWorldRotation(FE)},i.invalidateChildren=function(t){var e,i,n=0,r=0,s=0,a=0,o=t|AE.POSITION;for(VE[0]=this;n>=0;){if(a=(e=VE[n--]).hasChangedFlags,e.isValid&&(e._dirtyFlags&a&t)!==t)for(e._dirtyFlags|=t,e.hasChangedFlags=a|t,s=(i=e._children).length,r=0;r<s;r++)VE[++n]=i[r];t=o}},i.updateWorldTransform=function(){if(this._dirtyFlags){for(var t,e=this,i=0;e&&e._dirtyFlags;)VE[i++]=e,e=e._parent;for(var n=0;i;)n|=(t=VE[--i])._dirtyFlags,e?(n&AE.POSITION&&(ji.transformMat4(t._pos,t._lpos,e._mat),t._mat.m12=t._pos.x,t._mat.m13=t._pos.y,t._mat.m14=t._pos.z),n&AE.RS&&(un.fromRTS(t._mat,t._lrot,t._lpos,t._lscale),un.multiply(t._mat,e._mat,t._mat),n&AE.ROTATION&&$i.multiply(t._rot,e._rot,t._lrot),Qi.fromQuat(kE,$i.conjugate(GE,t._rot)),Qi.multiplyMat4(kE,kE,t._mat),t._scale.x=kE.m00,t._scale.y=kE.m04,t._scale.z=kE.m08)):(n&AE.POSITION&&(ji.copy(t._pos,t._lpos),t._mat.m12=t._pos.x,t._mat.m13=t._pos.y,t._mat.m14=t._pos.z),n&AE.RS&&(n&AE.ROTATION&&$i.copy(t._rot,t._lrot),n&AE.SCALE&&(ji.copy(t._scale,t._lscale),un.fromRTS(t._mat,t._rot,t._pos,t._scale)))),t._dirtyFlags=AE.NONE,e=t}},i.setPosition=function(t,e,i){void 0===e&&void 0===i?ji.copy(this._lpos,t):void 0===i?ji.set(this._lpos,t,e,this._lpos.z):ji.set(this._lpos,t,e,i),this.invalidateChildren(AE.POSITION),1&this._eventMask&&this.emit(aE.TRANSFORM_CHANGED,AE.POSITION)},i.getPosition=function(t){return t?ji.set(t,this._lpos.x,this._lpos.y,this._lpos.z):ji.copy(new ji,this._lpos)},i.setRotation=function(t,e,i,n){void 0===e||void 0===i||void 0===n?$i.copy(this._lrot,t):$i.set(this._lrot,t,e,i,n),this._eulerDirty=!0,this.invalidateChildren(AE.ROTATION),1&this._eventMask&&this.emit(aE.TRANSFORM_CHANGED,AE.ROTATION)},i.setRotationFromEuler=function(t,e,i){var n=void 0===i?this._euler.z:i;void 0===e?(ji.copy(this._euler,t),$i.fromEuler(this._lrot,t.x,t.y,t.z)):(ji.set(this._euler,t,e,n),$i.fromEuler(this._lrot,t,e,n)),this._eulerDirty=!1,this.invalidateChildren(AE.ROTATION),1&this._eventMask&&this.emit(aE.TRANSFORM_CHANGED,AE.ROTATION)},i.getRotation=function(t){return t?$i.set(t,this._lrot.x,this._lrot.y,this._lrot.z,this._lrot.w):$i.copy(new $i,this._lrot)},i.setScale=function(t,e,i){void 0===e&&void 0===i?ji.copy(this._lscale,t):void 0===i?ji.set(this._lscale,t,e,this._lscale.z):ji.set(this._lscale,t,e,i),this.invalidateChildren(AE.SCALE),1&this._eventMask&&this.emit(aE.TRANSFORM_CHANGED,AE.SCALE)},i.getScale=function(t){return t?ji.set(t,this._lscale.x,this._lscale.y,this._lscale.z):ji.copy(new ji,this._lscale)},i.inverseTransformPoint=function(t,e){ji.copy(t,e);for(var i=this,n=0;i._parent;)VE[n++]=i,i=i._parent;for(;n>=0;)ji.transformInverseRTS(t,t,i._lrot,i._lpos,i._lscale),i=VE[--n];return t},i.setWorldPosition=function(t,e,i){void 0===e||void 0===i?ji.copy(this._pos,t):ji.set(this._pos,t,e,i);var n=this._parent,r=this._lpos;n?(n.updateWorldTransform(),ji.transformMat4(r,this._pos,un.invert(HE,n._mat))):ji.copy(r,this._pos),this.invalidateChildren(AE.POSITION),1&this._eventMask&&this.emit(aE.TRANSFORM_CHANGED,AE.POSITION)},i.getWorldPosition=function(t){return this.updateWorldTransform(),t?ji.copy(t,this._pos):ji.copy(new ji,this._pos)},i.setWorldRotation=function(t,e,i,n){void 0===e||void 0===i||void 0===n?$i.copy(this._rot,t):$i.set(this._rot,t,e,i,n),this._parent?(this._parent.updateWorldTransform(),$i.multiply(this._lrot,$i.conjugate(this._lrot,this._parent._rot),this._rot)):$i.copy(this._lrot,this._rot),this._eulerDirty=!0,this.invalidateChildren(AE.ROTATION),1&this._eventMask&&this.emit(aE.TRANSFORM_CHANGED,AE.ROTATION)},i.setWorldRotationFromEuler=function(t,e,i){$i.fromEuler(this._rot,t,e,i),this._parent?(this._parent.updateWorldTransform(),$i.multiply(this._lrot,$i.conjugate(this._lrot,this._parent._rot),this._rot)):$i.copy(this._lrot,this._rot),this._eulerDirty=!0,this.invalidateChildren(AE.ROTATION),1&this._eventMask&&this.emit(aE.TRANSFORM_CHANGED,AE.ROTATION)},i.getWorldRotation=function(t){return this.updateWorldTransform(),t?$i.copy(t,this._rot):$i.copy(new $i,this._rot)},i.setWorldScale=function(t,e,i){void 0===e||void 0===i?ji.copy(this._scale,t):ji.set(this._scale,t,e,i);var n=this._parent;n?(n.updateWorldTransform(),Qi.fromQuat(kE,$i.conjugate(GE,n._rot)),Qi.multiplyMat4(kE,kE,n._mat),zE.m00=this._scale.x,zE.m04=this._scale.y,zE.m08=this._scale.z,Qi.multiply(kE,zE,Qi.invert(kE,kE)),this._lscale.x=ji.set(LE,kE.m00,kE.m01,kE.m02).length(),this._lscale.y=ji.set(LE,kE.m03,kE.m04,kE.m05).length(),this._lscale.z=ji.set(LE,kE.m06,kE.m07,kE.m08).length()):ji.copy(this._lscale,this._scale),this.invalidateChildren(AE.SCALE),1&this._eventMask&&this.emit(aE.TRANSFORM_CHANGED,AE.SCALE)},i.getWorldScale=function(t){return this.updateWorldTransform(),t?ji.copy(t,this._scale):ji.copy(new ji,this._scale)},i.getWorldMatrix=function(t){this.updateWorldTransform();var e=t||new un;return un.copy(e,this._mat)},i.getWorldRS=function(t){this.updateWorldTransform();var e=t||new un;return un.copy(e,this._mat),e.m12=0,e.m13=0,e.m14=0,e},i.getWorldRT=function(t){this.updateWorldTransform();var e=t||new un;return un.fromRT(e,this._rot,this._pos)},i.setRTS=function(t,e,i){var n=0;t&&(n|=AE.ROTATION,void 0!==t.w?($i.copy(this._lrot,t),this._eulerDirty=!0):(ji.copy(this._euler,t),$i.fromEuler(this._lrot,t.x,t.y,t.z),this._eulerDirty=!1)),e&&(ji.copy(this._lpos,e),n|=AE.POSITION),i&&(ji.copy(this._lscale,i),n|=AE.SCALE),n&&(this.invalidateChildren(n),1&this._eventMask&&this.emit(aE.TRANSFORM_CHANGED,n))},i.pauseSystemEvents=function(t){this._eventProcessor.setEnabled(!1,t)},i.resumeSystemEvents=function(t){this._eventProcessor.setEnabled(!0,t)},e.resetHasChangedFlags=function(){XE+=1},e.clearNodeArray=function(){e.ClearFrame<e.ClearRound?e.ClearFrame++:(e.ClearFrame=0,VE.length=0)},i.getPathInHierarchy=function(){for(var t=this.name,i=this.parent;i&&i instanceof e;)t=i.name+"/"+t,i=i.parent;return t},h(e,[{key:"position",get:function(){return this._lpos},set:function(t){this.setPosition(t)}},{key:"worldPosition",get:function(){return this.updateWorldTransform(),this._pos},set:function(t){this.setWorldPosition(t)}},{key:"rotation",get:function(){return this._lrot},set:function(t){this.setRotation(t)}},{key:"eulerAngles",get:function(){return this._eulerDirty&&($i.toEuler(this._euler,this._lrot),this._eulerDirty=!1),this._euler},set:function(t){this.setRotationFromEuler(t.x,t.y,t.z)}},{key:"angle",get:function(){return this._euler.z},set:function(t){ji.set(this._euler,0,0,t),$i.fromAngleZ(this._lrot,t),this._eulerDirty=!1,this.invalidateChildren(AE.ROTATION),1&this._eventMask&&this.emit(aE.TRANSFORM_CHANGED,AE.ROTATION)}},{key:"worldRotation",get:function(){return this.updateWorldTransform(),this._rot},set:function(t){this.setWorldRotation(t)}},{key:"scale",get:function(){return this._lscale},set:function(t){this.setScale(t)}},{key:"worldScale",get:function(){return this.updateWorldTransform(),this._scale},set:function(t){this.setWorldScale(t)}},{key:"matrix",set:function(t){un.toRTS(t,this._lrot,this._lpos,this._lscale),this.invalidateChildren(AE.TRS),this._eulerDirty=!0,1&this._eventMask&&this.emit(aE.TRANSFORM_CHANGED,AE.TRS)}},{key:"worldMatrix",get:function(){return this.updateWorldTransform(),this._mat}},{key:"forward",get:function(){return ji.transformQuat(new ji,ji.FORWARD,this.worldRotation)},set:function(t){var e=t.length();ji.multiplyScalar(LE,t,-1/e),$i.fromViewUp(FE,LE),this.setWorldRotation(FE)}},{key:"up",get:function(){return ji.transformQuat(new ji,ji.UP,this.worldRotation)}},{key:"right",get:function(){return ji.transformQuat(new ji,ji.RIGHT,this.worldRotation)}},{key:"layer",get:function(){return this._layer},set:function(t){this._layer=t,this._uiProps&&this._uiProps.uiComp&&(this._uiProps.uiComp.setNodeDirty(),this._uiProps.uiComp.markForUpdateRenderData()),this.emit(aE.LAYER_CHANGED,this._layer)}},{key:"hasChangedFlags",get:function(){return this._flagChangeVersion===XE?this._hasChangedFlags:0},set:function(t){this._flagChangeVersion=XE,this._hasChangedFlags=t}}]),e}(ME),BE.EventType=aE,BE.NodeSpace=SE,BE.TransformDirtyBit=AE,BE.TransformBit=AE,BE.reserveContentsForAllSyncablePrefabTag=WE,BE.ClearFrame=0,BE.ClearRound=1e3,IE=T((wE=NE).prototype,"_lpos",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new ji}}),OE=T(wE.prototype,"_lrot",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new $i}}),xE=T(wE.prototype,"_lscale",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new ji(1,1,1)}}),PE=T(wE.prototype,"_layer",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Jd.Enum.DEFAULT}}),DE=T(wE.prototype,"_euler",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new ji}}),T(wE.prototype,"eulerAngles",[bE],Object.getOwnPropertyDescriptor(wE.prototype,"eulerAngles"),wE.prototype),T(wE.prototype,"angle",[Ph],Object.getOwnPropertyDescriptor(wE.prototype,"angle"),wE.prototype),T(wE.prototype,"layer",[Ph],Object.getOwnPropertyDescriptor(wE.prototype,"layer"),wE.prototype),CE=wE))||CE));b.Node=jE,hi.Attr.setClassAttr(Sc,"target","type","Object"),hi.Attr.setClassAttr(Sc,"target","ctor",jE);var YE,KE=t("System",function(){function t(){this._id="",this._priority=0,this._executeInEditMode=!1}t.sortByPriority=function(t,e){return t._priority<e._priority?1:t._priority>e.priority?-1:0};var e=t.prototype;return e.init=function(){},e.update=function(){},e.postUpdate=function(){},e.destroy=function(){},h(t,[{key:"priority",get:function(){return this._priority},set:function(t){this._priority=t}},{key:"id",get:function(){return this._id},set:function(t){this._id=t}}]),t}());KE.Priority=_e({LOW:0,MEDIUM:100,HIGH:200,SCHEDULER:1<<31>>>0});var qE=new es;qE.format=On.RGBA8;var QE=new is;QE.format=On.DEPTH_STENCIL;var ZE,JE,$E,tT,eT,iT,nT,rT=new ss([qE],QE),sT={width:1,height:1,renderPassInfo:rT},aT=t("RenderTexture",_h("cc.RenderTexture")(YE=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._window=null,e}c(e,t);var i=e.prototype;return i.initialize=function(t){this._name=t.name||"",this._width=t.width,this._height=t.height,this._initWindow(t)},i.reset=function(t){this.initialize(t)},i.destroy=function(){if(this._window){var e=b.director.root;null==e||e.destroyWindow(this._window),this._window=null}return t.prototype.destroy.call(this)},i.resize=function(t,e){this._width=Math.floor(vi(t,1,2048)),this._height=Math.floor(vi(e,1,2048)),this._window&&this._window.resize(this._width,this._height),this.emit("resize",this._window)},i._serialize=function(){return{}},i._deserialize=function(e,i){var n=e;this._width=n.w,this._height=n.h,this._name=n.n,t.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(t){var e=b.director.root;sT.title=this._name,sT.width=this._width,sT.height=this._height,sT.renderPassInfo=t&&t.passInfo?t.passInfo:rT,qE.barrier=Ja.gfxDevice.getGeneralBarrier(new as(Jn.FRAGMENT_SHADER_READ_TEXTURE,Jn.FRAGMENT_SHADER_READ_TEXTURE)),this._window?(this._window.destroy(),this._window.initialize(Ja.gfxDevice,sT)):this._window=e.createWindow(sT)},i.initDefault=function(e){t.prototype.initDefault.call(this,e),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(t,e,i,n,r){void 0===t&&(t=0),void 0===e&&(e=0),i=i||this.width,n=n||this.height;var s=this.getGFXTexture();if(!s)return K(7606),null;var a=4*i*n;if(void 0===r)r=new Uint8Array(a);else if(r.length<a)return K(7607,a),null;var o=this._getGFXDevice(),u=[],h=[],l=new Ir;return l.texOffset.x=t,l.texOffset.y=e,l.texExtent.width=i,l.texExtent.height=n,h.push(l),u.push(r),null==o||o.copyTextureToBuffers(s,u,h),r},h(e,[{key:"window",get:function(){return this._window}}]),e}(Tg))||YE);b.RenderTexture=aT,function(t){t[t.VERTICAL=0]="VERTICAL",t[t.HORIZONTAL=1]="HORIZONTAL"}(ZE||(ZE={})),function(t){t[t.ORTHO=0]="ORTHO",t[t.PERSPECTIVE=1]="PERSPECTIVE"}(JE||(JE={})),function(t){t[t.F1_8=0]="F1_8",t[t.F2_0=1]="F2_0",t[t.F2_2=2]="F2_2",t[t.F2_5=3]="F2_5",t[t.F2_8=4]="F2_8",t[t.F3_2=5]="F3_2",t[t.F3_5=6]="F3_5",t[t.F4_0=7]="F4_0",t[t.F4_5=8]="F4_5",t[t.F5_0=9]="F5_0",t[t.F5_6=10]="F5_6",t[t.F6_3=11]="F6_3",t[t.F7_1=12]="F7_1",t[t.F8_0=13]="F8_0",t[t.F9_0=14]="F9_0",t[t.F10_0=15]="F10_0",t[t.F11_0=16]="F11_0",t[t.F13_0=17]="F13_0",t[t.F14_0=18]="F14_0",t[t.F16_0=19]="F16_0",t[t.F18_0=20]="F18_0",t[t.F20_0=21]="F20_0",t[t.F22_0=22]="F22_0"}($E||($E={})),function(t){t[t.ISO100=0]="ISO100",t[t.ISO200=1]="ISO200",t[t.ISO400=2]="ISO400",t[t.ISO800=3]="ISO800"}(tT||(tT={})),function(t){t[t.D1=0]="D1",t[t.D2=1]="D2",t[t.D4=2]="D4",t[t.D8=3]="D8",t[t.D15=4]="D15",t[t.D30=5]="D30",t[t.D60=6]="D60",t[t.D125=7]="D125",t[t.D250=8]="D250",t[t.D500=9]="D500",t[t.D1000=10]="D1000",t[t.D2000=11]="D2000",t[t.D4000=12]="D4000"}(eT||(eT={})),function(t){t[t.DEFAULT=-1]="DEFAULT",t[t.LEFT_EYE=0]="LEFT_EYE",t[t.RIGHT_EYE=1]="RIGHT_EYE",t[t.MAIN=2]="MAIN"}(iT||(iT={})),function(t){t[t.NO_TRACKING=0]="NO_TRACKING",t[t.POSITION_AND_ROTATION=1]="POSITION_AND_ROTATION",t[t.POSITION=2]="POSITION",t[t.ROTATION=3]="ROTATION"}(nT||(nT={}));var oT,uT,hT,lT,cT,_T,fT,dT,pT,mT,gT,vT,yT,ET,TT,ST,AT,RT,bT,CT,wT,IT,OT,xT,PT,DT,BT,NT,MT,LT,FT,UT,GT,kT,zT,HT,VT,WT,XT,jT,YT,KT,qT,QT,ZT,JT,$T,tS,eS,iS,nS,rS,sS,aS,oS,uS,hS,lS,cS,_S,fS,dS,pS,mS,gS,vS,yS,ES,TS,SS,AS,RS,bS,CS=[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],wS=[1,.5,1/4,1/8,1/15,1/30,1/60,.008,.004,.002,.001,5e-4,1/4e3],IS=[100,200,400,800],OS=new ji,xS=new ji,PS=new un,DS=cr.STENCIL<<1,BS=[],NS=function(){function t(t){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=ZE.VERTICAL,this._fov=Ti(45),this._nearClip=1,this._farClip=1e3,this._clearColor=new Pr(.2,.2,.2,1),this._viewport=new yn(0,0,1,1),this._orientedViewport=new yn(0,0,1,1),this._curTransform=wn.IDENTITY,this._isProjDirty=!0,this._matView=new un,this._matProj=new un,this._matProjInv=new un,this._matViewProj=new un,this._matViewProjInv=new un,this._frustum=new qu,this._forward=new ji,this._position=new ji,this._priority=0,this._aperture=$E.F16_0,this._apertureValue=void 0,this._shutter=eT.D125,this._shutterValue=0,this._iso=tT.ISO100,this._isoValue=0,this._window=null,this._width=1,this._height=1,this._clearFlag=cr.NONE,this._clearDepth=1,this._visibility=vm,this._exposure=0,this._clearStencil=0,this._geometryRenderer=null,this._cameraType=iT.DEFAULT,this._trackingType=nT.NO_TRACKING,this._device=t,this._apertureValue=CS[this._aperture],this._shutterValue=wS[this._shutter],this._isoValue=IS[this._iso],this._aspect=this.screenScale=1,this._frustum.accurate=!0,!BS.length){var e=t.capabilities.clipSpaceSignY;BS[wn.IDENTITY]=new un(1,0,0,0,0,e),BS[wn.ROTATE_90]=new un(0,1,0,0,-e,0),BS[wn.ROTATE_180]=new un(-1,0,0,0,0,-e),BS[wn.ROTATE_270]=new un(0,-1,0,0,e,0)}}var e=t.prototype;return e._updateAspect=function(t){if(void 0===t&&(t=!0),this._aspect=this.window.width*this._viewport.width/(this.window.height*this._viewport.height),t){var e=this.window.swapchain;(e&&e.surfaceTransform||wn.IDENTITY)%2&&(this._aspect=1/this._aspect)}this._isProjDirty=!0},e.initialize=function(t){void 0!==t.trackingType&&(this._trackingType=t.trackingType),void 0!==t.cameraType&&(this._cameraType=t.cameraType),this.node=t.node,this._width=1,this._height=1,this.clearFlag=cr.NONE,this.clearDepth=1,this.visibility=vm,this._name=t.name,this._proj=t.projection,this._priority=t.priority||0,this._aspect=this.screenScale=1,this.updateExposure(),this.changeTargetWindow(t.window)},e.destroy=function(){var t;this._node=null,this.detachFromScene(),this._window&&(this._window.detachCamera(this),this.window=null),this._name=null,null===(t=this._geometryRenderer)||void 0===t||t.destroy()},e.attachToScene=function(t){this._enabled=!0,this._scene=t},e.detachFromScene=function(){this._enabled=!1,this._scene=null},e.resize=function(t,e){this._window&&(this._width=t,this._width=t,this._height=e,this._aspect=t*this._viewport.width/(e*this._viewport.height),this._isProjDirty=!0)},e.setFixedSize=function(t,e){this._width=t,this._height=e,this._updateAspect(),this.isWindowSize=!1},e.syncCameraEditor=function(){},e.update=function(t){var e;if(void 0===t&&(t=!1),this._node){var i=!1;(this._node.hasChangedFlags||t)&&(un.invert(this._matView,this._node.worldMatrix),this._forward.x=-this._matView.m02,this._forward.y=-this._matView.m06,this._forward.z=-this._matView.m10,un.multiply(this._matView,(new un).scale(this._node.worldScale),this._matView),this._node.getWorldPosition(this._position),i=!0);var n=null===(e=this.window)||void 0===e?void 0:e.swapchain,r=n&&n.surfaceTransform||wn.IDENTITY;if(this._isProjDirty||this._curTransform!==r){this._curTransform=r;var s=this._device.capabilities.clipSpaceSignY;if(this._proj===JE.PERSPECTIVE)un.perspective(this._matProj,this._fov,this._aspect,this._nearClip,this._farClip,this._fovAxis===ZE.VERTICAL,this._device.capabilities.clipSpaceMinZ,s,r);else{var a=this._orthoHeight*this._aspect,o=this._orthoHeight;un.ortho(this._matProj,-a,a,-o,o,this._nearClip,this._farClip,this._device.capabilities.clipSpaceMinZ,s,r)}un.invert(this._matProjInv,this._matProj),i=!0,this._isProjDirty=!1}i&&(un.multiply(this._matViewProj,this._matProj,this._matView),un.invert(this._matViewProjInv,this._matViewProj),this._frustum.update(this._matViewProj,this._matViewProjInv))}},e.setViewportInOrientedSpace=function(t){var e,i=t.x,n=t.width,r=t.height,s=this._device.capabilities.screenSpaceSignY<0?1-t.y-r:t.y,a=null===(e=this.window)||void 0===e?void 0:e.swapchain;switch(a&&a.surfaceTransform||wn.IDENTITY){case wn.ROTATE_90:this._viewport.x=1-s-r,this._viewport.y=i,this._viewport.width=r,this._viewport.height=n;break;case wn.ROTATE_180:this._viewport.x=1-i-n,this._viewport.y=1-s-r,this._viewport.width=n,this._viewport.height=r;break;case wn.ROTATE_270:this._viewport.x=s,this._viewport.y=1-i-n,this._viewport.width=r,this._viewport.height=n;break;case wn.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)},e.initGeometryRenderer=function(){var t;this._geometryRenderer||(this._geometryRenderer=b.internal.GeometryRenderer?new b.internal.GeometryRenderer:null,null===(t=this._geometryRenderer)||void 0===t||t.activate(this._device))},e.changeTargetWindow=function(t){void 0===t&&(t=null),this._window&&this._window.detachCamera(this);var e=t||b.director.root.mainWindow;if(e){e.attachCamera(this),this.window=e;var i=e.swapchain;(i&&i.surfaceTransform||wn.IDENTITY)%2?this.resize(e.height,e.width):this.resize(e.width,e.height)}},e.detachCamera=function(){this._window&&this._window.detachCamera(this)},e.screenPointToRay=function(t,e,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===JE.PERSPECTIVE,l=this._device.capabilities.clipSpaceSignY,c=on[this._curTransform];ji.set(OS,(e-s)/o*2-1,(i-a)/u*2-1,h?1:-1);var _=OS.x,f=OS.y;return OS.x=_*c[0]+f*c[2]*l,OS.y=_*c[1]+f*c[3]*l,ji.transformMat4(h?OS:t.o,OS,this._matViewProjInv),h?(this._node.getWorldPosition(xS),fo.fromPoints(t,xS,OS)):ji.transformQuat(t.d,ji.FORWARD,this._node.worldRotation),t},e.screenToWorld=function(t,e){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=on[this._curTransform];if(this._proj===JE.PERSPECTIVE){ji.set(t,(e.x-r)/a*2-1,(e.y-s)/o*2-1,1);var l=t.x,c=t.y;t.x=l*h[0]+c*h[2]*u,t.y=l*h[1]+c*h[3]*u,ji.transformMat4(t,t,this._matViewProjInv),this._node&&this._node.getWorldPosition(OS),ji.lerp(t,OS,t,Ei(this._nearClip/this._farClip,1,e.z))}else{ji.set(t,(e.x-r)/a*2-1,(e.y-s)/o*2-1,2*e.z-1);var _=t.x,f=t.y;t.x=_*h[0]+f*h[2]*u,t.y=_*h[1]+f*h[3]*u,ji.transformMat4(t,t,this._matViewProjInv)}return t},e.worldToScreen=function(t,e){var i=this._device.capabilities.clipSpaceSignY,n=on[this._curTransform];ji.transformMat4(t,e,this._matViewProj);var r=t.x,s=t.y;t.x=r*n[0]+s*n[2]*i,t.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,l=this._orientedViewport.width*a,c=this._orientedViewport.height*o;return t.x=u+.5*(t.x+1)*l,t.y=h+.5*(t.y+1)*c,t.z=.5*t.z+.5,t},e.worldMatrixToScreen=function(t,e,i,n){un.multiply(t,this._matViewProj,e),un.multiply(t,BS[this._curTransform],t);var r=i/2,s=n/2;return un.identity(PS),un.transform(PS,PS,ji.set(OS,r,s,0)),un.scale(PS,PS,ji.set(OS,r,s,1)),un.multiply(t,PS,t),t},e.setExposure=function(t){this._exposure=.833333/Math.pow(2,t)},e.updateExposure=function(){var t=Math.log2(this._apertureValue*this._apertureValue/this._shutterValue*100/this._isoValue);this.setExposure(t)},h(t,[{key:"name",get:function(){return this._name}},{key:"scene",get:function(){return this._scene}},{key:"node",get:function(){return this._node},set:function(t){this._node=t}},{key:"window",get:function(){return this._window},set:function(t){this._window=t}},{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled=t}},{key:"visibility",get:function(){return this._visibility},set:function(t){this._visibility=t}},{key:"priority",get:function(){return this._priority},set:function(t){this._priority=t}},{key:"width",get:function(){return this._width}},{key:"height",get:function(){return this._height}},{key:"position",get:function(){return this._position},set:function(t){this._position=t}},{key:"forward",get:function(){return this._forward},set:function(t){this._forward=t}},{key:"aperture",get:function(){return this._aperture},set:function(t){this._aperture=t,this._apertureValue=CS[this._aperture],this.updateExposure()}},{key:"apertureValue",get:function(){return this._apertureValue}},{key:"shutter",get:function(){return this._shutter},set:function(t){this._shutter=t,this._shutterValue=wS[this._shutter],this.updateExposure()}},{key:"shutterValue",get:function(){return this._shutterValue}},{key:"iso",get:function(){return this._iso},set:function(t){this._iso=t,this._isoValue=IS[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(t){this._clearFlag=t}},{key:"clearColor",get:function(){return this._clearColor},set:function(t){this._clearColor.x=t.x,this._clearColor.y=t.y,this._clearColor.z=t.z,this._clearColor.w=t.w}},{key:"clearDepth",get:function(){return this._clearDepth},set:function(t){this._clearDepth=t}},{key:"clearStencil",get:function(){return this._clearStencil},set:function(t){this._clearStencil=t}},{key:"projectionType",get:function(){return this._proj},set:function(t){this._proj=t,this._isProjDirty=!0}},{key:"aspect",get:function(){return this._aspect}},{key:"orthoHeight",get:function(){return this._orthoHeight},set:function(t){this._orthoHeight=t,this._isProjDirty=!0}},{key:"fovAxis",get:function(){return this._fovAxis},set:function(t){this._fovAxis=t,this._isProjDirty=!0}},{key:"fov",get:function(){return this._fov},set:function(t){this._fov=t,this._isProjDirty=!0}},{key:"nearClip",get:function(){return this._nearClip},set:function(t){this._nearClip=t,this._isProjDirty=!0}},{key:"farClip",get:function(){return this._farClip},set:function(t){this._farClip=t,this._isProjDirty=!0}},{key:"viewport",get:function(){return this._viewport},set:function(t){j(8302),this.setViewportInOrientedSpace(t)}},{key:"frustum",get:function(){return this._frustum},set:function(t){this._frustum=t}},{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(t){this._cameraType=t}},{key:"trackingType",get:function(){return this._trackingType},set:function(t){this._trackingType=t}}],[{key:"standardExposureValue",get:function(){return 1/38400}},{key:"standardLightMeterScale",get:function(){return 1e4}}]),t}(),MS=new ji,LS=_e(JE),FS=_e(ZE),US=_e($E),GS=_e(eT),kS=_e(tT),zS=_e({SKYBOX:DS|cr.DEPTH_STENCIL,SOLID_COLOR:cr.ALL,DEPTH_ONLY:cr.DEPTH_STENCIL,DONT_CLEAR:cr.NONE}),HS=(oT=_h("cc.Camera"),uT=xh(),hT=Ch(),lT=zh(),cT=Mh(),_T=Kh(Jd.BitMask),fT=zh(),dT=Mh(),pT=Kh(zS),mT=zh(),gT=Mh(),vT=zh(),yT=Mh(),ET=zh(),TT=Mh(),ST=zh(),AT=Mh(),RT=Kh(LS),bT=zh(),CT=Mh(),wT=Kh(FS),IT=zh(),OT=Dh(),xT=Mh(),PT=zh(),DT=Dh(),BT=Mh(),NT=zh(),MT=Dh(),LT=Mh(),FT=zh(),UT=Mh(),GT=zh(),kT=Mh(),zT=Kh(US),HT=zh(),VT=Mh(),WT=Kh(GS),XT=zh(),jT=Mh(),YT=Kh(kS),KT=zh(),qT=Mh(),QT=zh(),ZT=Mh(),JT=Kh(aT),$T=zh(),tS=Mh(),bS=oT(eS=uT(eS=hT(eS=bh((RS=AS=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return E(e=t.call.apply(t,[this].concat(n))||this,"_projection",nS,g(e)),E(e,"_priority",rS,g(e)),E(e,"_fov",sS,g(e)),E(e,"_fovAxis",aS,g(e)),E(e,"_orthoHeight",oS,g(e)),E(e,"_near",uS,g(e)),E(e,"_far",hS,g(e)),E(e,"_color",lS,g(e)),E(e,"_depth",cS,g(e)),E(e,"_stencil",_S,g(e)),E(e,"_clearFlags",fS,g(e)),E(e,"_rect",dS,g(e)),E(e,"_aperture",pS,g(e)),E(e,"_shutter",mS,g(e)),E(e,"_iso",gS,g(e)),E(e,"_screenScale",vS,g(e)),E(e,"_visibility",yS,g(e)),E(e,"_targetTexture",ES,g(e)),e._camera=null,e._inEditorMode=!1,e._flows=void 0,E(e,"_cameraType",TS,g(e)),E(e,"_trackingType",SS,g(e)),e}c(e,t);var i=e.prototype;return i.onLoad=function(){this._createCamera()},i.onEnable=function(){this.node.hasChangedFlags|=AE.POSITION,this._camera&&this._attachToScene()},i.onDisable=function(){this._camera&&this._detachFromScene()},i.onDestroy=function(){this._camera&&(this._camera.destroy(),this._camera=null),this._targetTexture&&this._targetTexture.off("resize")},i.screenPointToRay=function(t,e,i){return i||(i=fo.create()),this._camera&&this._camera.screenPointToRay(i,t,e),i},i.worldToScreen=function(t,e){return e||(e=new ji),this._camera&&this._camera.worldToScreen(e,t),e},i.screenToWorld=function(t,e){return e||(e=this.node.getWorldPosition()),this._camera&&this._camera.screenToWorld(e,t),e},i.convertToUINode=function(t,e,i){if(i||(i=new ji),!this._camera)return i;this.worldToScreen(t,MS);var n=e.getComponent("cc.UITransform"),r=b.view.getVisibleSize(),s=MS.x-.5*this._camera.width,a=MS.y-.5*this._camera.height;return MS.x=s/b.view.getScaleX()+.5*r.width,MS.y=a/b.view.getScaleY()+.5*r.height,n&&n.convertToNodeSpaceAR(MS,i),i},i._createCamera=function(){this._camera||(this._camera=b.director.root.createCamera(),this._camera.initialize({name:this.node.name,node:this.node,projection:this._projection,window:this._inEditorMode?b.director.root&&b.director.root.mainWindow:b.director.root&&b.director.root.tempWindow,priority:this._priority,cameraType:this.cameraType,trackingType:this.trackingType}),this._camera.setViewportInOrientedSpace(this._rect),this._camera.fovAxis=this._fovAxis,this._camera.fov=Ti(this._fov),this._camera.orthoHeight=this._orthoHeight,this._camera.nearClip=this._near,this._camera.farClip=this._far,this._camera.clearColor=this._color,this._camera.clearDepth=this._depth,this._camera.clearStencil=this._stencil,this._camera.clearFlag=this._clearFlags,this._camera.visibility=this._visibility,this._camera.aperture=this._aperture,this._camera.shutter=this._shutter,this._camera.iso=this._iso),this._updateTargetTexture()},i._attachToScene=function(){this.node.scene&&this._camera&&(this._camera&&this._camera.scene&&this._camera.scene.removeCamera(this._camera),this._getRenderScene().addCamera(this._camera))},i._detachFromScene=function(){this._camera&&this._camera.scene&&this._camera.scene.removeCamera(this._camera)},i._checkTargetTextureEvent=function(t){var e=this;t&&t.off("resize"),this._targetTexture&&this._targetTexture.on("resize",(function(t){e._camera&&e._camera.setFixedSize(t.width,t.height)}),this)},i._updateTargetTexture=function(){if(this._camera&&this._targetTexture){var t=this._targetTexture.window;this._camera.changeTargetWindow(t),this._camera.setFixedSize(t.width,t.height)}},h(e,[{key:"camera",get:function(){return this._camera}},{key:"priority",get:function(){return this._priority},set:function(t){this._priority=t,this._camera&&(this._camera.priority=t)}},{key:"visibility",get:function(){return this._visibility},set:function(t){this._visibility=t,this._camera&&(this._camera.visibility=t)}},{key:"clearFlags",get:function(){return this._clearFlags},set:function(t){this._clearFlags=t,this._camera&&(this._camera.clearFlag=t)}},{key:"clearColor",get:function(){return this._color},set:function(t){this._color.set(t),this._camera&&(this._camera.clearColor=this._color)}},{key:"clearDepth",get:function(){return this._depth},set:function(t){this._depth=t,this._camera&&(this._camera.clearDepth=t)}},{key:"clearStencil",get:function(){return this._stencil},set:function(t){this._stencil=t,this._camera&&(this._camera.clearStencil=t)}},{key:"projection",get:function(){return this._projection},set:function(t){this._projection=t,this._camera&&(this._camera.projectionType=t)}},{key:"fovAxis",get:function(){return this._fovAxis},set:function(t){t!==this._fovAxis&&(this._fovAxis=t,this._camera&&(this._camera.fovAxis=t,t===ZE.VERTICAL?this.fov=this._fov*this._camera.aspect:this.fov=this._fov/this._camera.aspect))}},{key:"fov",get:function(){return this._fov},set:function(t){this._fov=t,this._camera&&(this._camera.fov=Ti(t))}},{key:"orthoHeight",get:function(){return this._orthoHeight},set:function(t){this._orthoHeight=t,this._camera&&(this._camera.orthoHeight=t)}},{key:"near",get:function(){return this._near},set:function(t){this._near=t,this._camera&&(this._camera.nearClip=t)}},{key:"far",get:function(){return this._far},set:function(t){this._far=t,this._camera&&(this._camera.farClip=t)}},{key:"aperture",get:function(){return this._aperture},set:function(t){this._aperture=t,this._camera&&(this._camera.aperture=t)}},{key:"shutter",get:function(){return this._shutter},set:function(t){this._shutter=t,this._camera&&(this._camera.shutter=t)}},{key:"iso",get:function(){return this._iso},set:function(t){this._iso=t,this._camera&&(this._camera.iso=t)}},{key:"rect",get:function(){return this._rect},set:function(t){this._rect=t,this._camera&&this._camera.setViewportInOrientedSpace(t)}},{key:"targetTexture",get:function(){return this._targetTexture},set:function(t){if(this._targetTexture!==t){var i=this._targetTexture;this._targetTexture=t,this._checkTargetTextureEvent(i),this._updateTargetTexture(),!t&&this._camera&&(this._camera.changeTargetWindow(null),this._camera.isWindowSize=!0),this.node.emit(e.TARGET_TEXTURE_CHANGE,this)}}},{key:"screenScale",get:function(){return this._screenScale},set:function(t){this._screenScale=t,this._camera&&(this._camera.screenScale=t)}},{key:"inEditorMode",get:function(){return this._inEditorMode},set:function(t){this._inEditorMode=t,this._camera&&this._camera.changeTargetWindow(t?b.director.root&&b.director.root.mainWindow:b.director.root&&b.director.root.tempWindow)}},{key:"cameraType",get:function(){return this._cameraType},set:function(t){this._cameraType!==t&&(this._cameraType=t,this.camera&&(this.camera.cameraType=t))}},{key:"trackingType",get:function(){return this._trackingType},set:function(t){this._trackingType!==t&&(this._trackingType=t,this.camera&&(this.camera.trackingType=t))}}]),e}(bc),AS.ProjectionType=LS,AS.FOVAxis=FS,AS.ClearFlag=zS,AS.Aperture=US,AS.Shutter=GS,AS.ISO=kS,AS.TARGET_TEXTURE_CHANGE="tex-change",nS=T((iS=RS).prototype,"_projection",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return LS.PERSPECTIVE}}),rS=T(iS.prototype,"_priority",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),sS=T(iS.prototype,"_fov",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 45}}),aS=T(iS.prototype,"_fovAxis",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return FS.VERTICAL}}),oS=T(iS.prototype,"_orthoHeight",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 10}}),uS=T(iS.prototype,"_near",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 1}}),hS=T(iS.prototype,"_far",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 1e3}}),lS=T(iS.prototype,"_color",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new Gi("#333333")}}),cS=T(iS.prototype,"_depth",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 1}}),_S=T(iS.prototype,"_stencil",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),fS=T(iS.prototype,"_clearFlags",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return zS.SOLID_COLOR}}),dS=T(iS.prototype,"_rect",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new yn(0,0,1,1)}}),pS=T(iS.prototype,"_aperture",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return US.F16_0}}),mS=T(iS.prototype,"_shutter",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return GS.D125}}),gS=T(iS.prototype,"_iso",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return kS.ISO100}}),vS=T(iS.prototype,"_screenScale",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 1}}),yS=T(iS.prototype,"_visibility",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return vm}}),ES=T(iS.prototype,"_targetTexture",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),TS=T(iS.prototype,"_cameraType",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return iT.DEFAULT}}),SS=T(iS.prototype,"_trackingType",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return nT.NO_TRACKING}}),T(iS.prototype,"priority",[lT,cT],Object.getOwnPropertyDescriptor(iS.prototype,"priority"),iS.prototype),T(iS.prototype,"visibility",[_T,fT,dT],Object.getOwnPropertyDescriptor(iS.prototype,"visibility"),iS.prototype),T(iS.prototype,"clearFlags",[pT,mT,gT],Object.getOwnPropertyDescriptor(iS.prototype,"clearFlags"),iS.prototype),T(iS.prototype,"clearColor",[vT,yT],Object.getOwnPropertyDescriptor(iS.prototype,"clearColor"),iS.prototype),T(iS.prototype,"clearDepth",[ET,TT],Object.getOwnPropertyDescriptor(iS.prototype,"clearDepth"),iS.prototype),T(iS.prototype,"clearStencil",[ST,AT],Object.getOwnPropertyDescriptor(iS.prototype,"clearStencil"),iS.prototype),T(iS.prototype,"projection",[RT,bT,CT],Object.getOwnPropertyDescriptor(iS.prototype,"projection"),iS.prototype),T(iS.prototype,"fovAxis",[wT,IT,OT,xT],Object.getOwnPropertyDescriptor(iS.prototype,"fovAxis"),iS.prototype),T(iS.prototype,"fov",[PT,DT,BT],Object.getOwnPropertyDescriptor(iS.prototype,"fov"),iS.prototype),T(iS.prototype,"orthoHeight",[NT,MT,LT],Object.getOwnPropertyDescriptor(iS.prototype,"orthoHeight"),iS.prototype),T(iS.prototype,"near",[FT,UT],Object.getOwnPropertyDescriptor(iS.prototype,"near"),iS.prototype),T(iS.prototype,"far",[GT,kT],Object.getOwnPropertyDescriptor(iS.prototype,"far"),iS.prototype),T(iS.prototype,"aperture",[zT,HT,VT],Object.getOwnPropertyDescriptor(iS.prototype,"aperture"),iS.prototype),T(iS.prototype,"shutter",[WT,XT,jT],Object.getOwnPropertyDescriptor(iS.prototype,"shutter"),iS.prototype),T(iS.prototype,"iso",[YT,KT,qT],Object.getOwnPropertyDescriptor(iS.prototype,"iso"),iS.prototype),T(iS.prototype,"rect",[QT,ZT],Object.getOwnPropertyDescriptor(iS.prototype,"rect"),iS.prototype),T(iS.prototype,"targetTexture",[JT,$T,tS],Object.getOwnPropertyDescriptor(iS.prototype,"targetTexture"),iS.prototype),eS=iS))||eS)||eS)||eS)||eS,t({Camera:bS,CameraComponent:bS}),bS);b.Camera=HS;var VS,WS,XS,jS,YS,KS,qS,QS,ZS,JS,$S,tA,eA=function(t){function e(e,i){var n;(n=t.call(this,e.root)||this)._parent=void 0,n._owner=void 0,n._dontNotify=!1,n._parent=e,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 l=n._shaderInfo.samplerTextures[h],c=0;c<l.count;c++){var _=u._descriptorSet.getSampler(l.binding,c),f=u._descriptorSet.getTexture(l.binding,c);n._descriptorSet.bindSampler(l.binding,_,c),n._descriptorSet.bindTexture(l.binding,f,c)}return t.prototype.tryCompile.call(g(n)),n}c(e,t);var i=e.prototype;return i.overridePipelineStates=function(t,e){this._bs.reset(),this._rs.reset(),this._dss.reset(),by.fillPipelineInfo(this,t),by.fillPipelineInfo(this,e),this._onStateChange()},i.tryCompile=function(e){if(e&&!Lm(this._defines,e))return!1;var i=t.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=my.NONE},i._onStateChange=function(){this._hash=by.getPassHash(this),this._owner.onPassStateChange(this._dontNotify)},h(e,[{key:"parent",get:function(){return this._parent}}]),e}(by),iA=function(t){function e(e){var i;return(i=t.call(this)||this)._passes=[],i._parent=void 0,i._owner=void 0,i._subModelIdx=0,i._parent=e.parent,i._owner=e.owner||null,i._subModelIdx=e.subModelIdx||0,i.copy(i._parent),i}c(e,t);var i=e.prototype;return i.recompileShaders=function(t,e){if(this._passes&&this.effectAsset)if(void 0===e)for(var i,n=y(this._passes);!(i=n()).done;)i.value.tryCompile(t);else this._passes[e].tryCompile(t)},i.overridePipelineStates=function(t,e){if(this._passes&&this.effectAsset){var i=this.effectAsset.techniques[this.technique].passes;if(void 0===e)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 t)s[a]=t[a];r.overridePipelineStates(i[r.passIndex],s)}else{var o=this._states[e]||(this._states[e]={});for(var u in t)o[u]=t[u];this._passes[e].overridePipelineStates(i[e],o)}}},i.destroy=function(){return this._doDestroy(),!0},i.onPassStateChange=function(t){this._hash=Vy.getHash(this),!t&&this._owner&&this._owner._onRebuildPSO(this._subModelIdx,this)},i._createPasses=function(){var t=[],e=this._parent.passes;if(!e)return t;for(var i=0;i<e.length;++i)t.push(new eA(e[i],this));return t},h(e,[{key:"parent",get:function(){return this._parent}},{key:"owner",get:function(){return this._owner}}]),e}(Vy),nA={parent:null,owner:null,subModelIdx:0},rA=t("Renderer",(VS=_h("cc.Renderer"),WS=Kh(Vy),XS=zh(),jS=Nh(),YS=Kh([Vy]),VS(KS=ph((T((qS=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return E(e=t.call.apply(t,[this].concat(n))||this,"_materials",QS,g(e)),e._materialInstances=[],e}c(e,t);var i=e.prototype;return i.getMaterial=function(t){return t<0||t>=this._materials.length?null:this._materials[t]},i.setMaterial=function(t,e){t&&t instanceof iA&&console.error("Can't set a material instance to a sharedMaterial slot"),this._materials[e]=t;var i=this._materialInstances[e];i&&(i.destroy(),this._materialInstances[e]=null),this._onMaterialModified(e,this._materials[e])},i.getMaterialInstance=function(t){if(!this._materials[t])return null;if(!this._materialInstances[t]){nA.parent=this._materials[t],nA.owner=this,nA.subModelIdx=t;var e=new iA(nA);nA.parent=null,nA.owner=null,nA.subModelIdx=0,this.setMaterialInstance(e,t)}return this._materialInstances[t]},i.setMaterialInstance=function(t,e){if("number"==typeof t){j(12007);var i=t;t=e,e=i}var n=this._materialInstances[e];t&&t.parent?t!==n&&(this._materialInstances[e]=t,this._onMaterialModified(e,t)):(t!==this._materials[e]||n)&&this.setMaterial(t,e)},i.getRenderMaterial=function(t){return this._materialInstances[t]||this._materials[t]},i._onMaterialModified=function(){},i._onRebuildPSO=function(){},i._clearMaterials=function(){},h(e,[{key:"sharedMaterial",get:function(){return this.getMaterial(0)}},{key:"sharedMaterials",get:function(){return this._materials},set:function(t){for(var e=0;e<t.length;e++)t[e]!==this._materials[e]&&this.setMaterial(t[e],e);if(t.length<this._materials.length){for(var i=t.length;i<this._materials.length;i++)this.setMaterial(null,i);this._materials.splice(t.length)}}},{key:"material",get:function(){return this.getMaterialInstance(0)},set:function(t){(1!==this._materials.length||this._materialInstances[0]||this._materials[0]!==t)&&this.setMaterialInstance(t,0)}},{key:"materials",get:function(){for(var t=0;t<this._materials.length;t++)this._materialInstances[t]=this.getMaterialInstance(t);return this._materialInstances},set:function(t){for(var e=t.length,i=this._materials.length,n=e;n<i;n++)this.setMaterialInstance(null,n);this._materials.length=e,this._materialInstances.length=e;for(var r=0;r<e;r++)this._materialInstances[r]!=t[r]&&this.setMaterialInstance(t[r],r)}}]),e}(bc)).prototype,"sharedMaterials",[WS,XS,jS],Object.getOwnPropertyDescriptor(qS.prototype,"sharedMaterials"),qS.prototype),QS=T(qS.prototype,"_materials",[YS],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),KS=qS))||KS)||KS)),sA=function(e){return t({ModelRenderer:e,RenderableComponent:e}),e}(_h("cc.ModelRenderer")((tA=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return E(e=t.call.apply(t,[this].concat(n))||this,"_visFlags",$S,g(e)),e._models=[],e._priority=0,e}c(e,t);var i=e.prototype;return i._collectModels=function(){return this._models},i.onEnable=function(){this._updatePriority()},i._attachToScene=function(){},i._detachFromScene=function(){},i._onVisibilityChange=function(){},i._updatePriority=function(){if(this._models.length>0)for(var t=0;t<this._models.length;t++)this._models[t].priority=this._priority},h(e,[{key:"visibility",get:function(){return this._visFlags},set:function(t){this._visFlags=t,this._onVisibilityChange(t)}},{key:"priority",get:function(){return this._priority},set:function(t){t!==this._priority&&(this._priority=t,this._updatePriority())}}]),e}(rA),$S=T((JS=tA).prototype,"_visFlags",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Jd.Enum.NONE}}),ZS=JS))||ZS);et(HS,"Camera",[{name:"CameraClearFlag",newName:"ClearFlag"}]),et(HS.prototype,"Camera.prototype",[{name:"color",newName:"clearColor"},{name:"depth",newName:"clearDepth"},{name:"stencil",newName:"clearStencil"}]),b.CameraComponent=HS,le.setClassAlias(HS,"cc.CameraComponent"),b.RenderableComponent=sA,le.setClassAlias(sA,"cc.RenderableComponent");var aA,oA,uA=t("Event",function(){function t(t,e){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=t,this.bubbles=!!e}var e=t.prototype;return e.unuse=function(){this.type=t.NO_TYPE,this.target=null,this.currentTarget=null,this.eventPhase=t.NONE,this.propagationStopped=!1,this.propagationImmediateStopped=!1},e.reuse=function(t,e){this.type=t,this.bubbles=e||!1},e.isStopped=function(){return this.propagationStopped||this.propagationImmediateStopped},e.getCurrentTarget=function(){return this.currentTarget},e.getType=function(){return this.type},t}());uA.NO_TYPE="no_type",uA.TOUCH="touch",uA.MOUSE="mouse",uA.KEYBOARD="keyboard",uA.ACCELERATION="acceleration",uA.NONE=0,uA.CAPTURING_PHASE=1,uA.AT_TARGET=2,uA.BUBBLING_PHASE=3,b.Event=uA,function(t){t.TOUCH_START="touch-start",t.TOUCH_MOVE="touch-move",t.TOUCH_END="touch-end",t.TOUCH_CANCEL="touch-cancel",t.MOUSE_DOWN="mouse-down",t.MOUSE_MOVE="mouse-move",t.MOUSE_UP="mouse-up",t.MOUSE_WHEEL="mouse-wheel",t.MOUSE_ENTER="mouse-enter",t.MOUSE_LEAVE="mouse-leave",t.KEY_DOWN="keydown",t.KEY_UP="keyup",t.DEVICEMOTION="devicemotion",t.TRANSFORM_CHANGED="transform-changed",t.SCENE_CHANGED_FOR_PERSISTS="scene-changed-for-persists",t.SIZE_CHANGED="size-changed",t.ANCHOR_CHANGED="anchor-changed",t.COLOR_CHANGED="color-changed",t.CHILD_ADDED="child-added",t.CHILD_REMOVED="child-removed",t.PARENT_CHANGED="parent-changed",t.NODE_DESTROYED="node-destroyed",t.LAYER_CHANGED="layer-changed",t.SIBLING_ORDER_CHANGED="sibling-order-changed"}(aA||(aA=t("SystemEventType",{}))),function(t){t.TOUCH_START="touch-start",t.TOUCH_MOVE="touch-move",t.TOUCH_END="touch-end",t.TOUCH_CANCEL="touch-cancel",t.MOUSE_DOWN="mouse-down",t.MOUSE_MOVE="mouse-move",t.MOUSE_UP="mouse-up",t.MOUSE_WHEEL="mouse-wheel",t.KEY_DOWN="keydown",t.KEY_PRESSING="key-pressing",t.KEY_UP="keyup",t.DEVICEMOTION="devicemotion",t.GAMEPAD_INPUT="gamepad-input",t.GAMEPAD_CHANGE="gamepad-change",t.HANDLE_INPUT="handle-input",t.HANDLE_POSE_INPUT="handle-pose-input",t.HMD_POSE_INPUT="hmd-pose-input"}(oA||(oA={})),b.SystemEventType=aA;var hA=t("EventAcceleration",function(t){function e(e,i){var n;return(n=t.call(this,aA.DEVICEMOTION,i)||this).acc=void 0,n.acc=e,n}return c(e,t),e}(uA));uA.EventAcceleration=hA;var lA=t("EventKeyboard",function(t){function e(e,i,n){var r;return"boolean"==typeof i&&(i=i?aA.KEY_DOWN:aA.KEY_UP),(r=t.call(this,i,n)||this).keyCode=void 0,r.rawEvent=void 0,r._isPressed=void 0,r._isPressed=i!==aA.KEY_UP,"number"==typeof e?r.keyCode=e:(r.keyCode=e.keyCode,r.rawEvent=e),r}return c(e,t),h(e,[{key:"isPressed",get:function(){return this._isPressed}}]),e}(uA));uA.EventKeyboard=lA;var cA=t("EventMouse",function(t){function e(i,n,r){var s;return(s=t.call(this,i,n)||this).movementX=0,s.movementY=0,s.preventSwallow=!1,s._eventType=void 0,s._button=e.BUTTON_MISSING,s._x=0,s._y=0,s._prevX=0,s._prevY=0,s._scrollX=0,s._scrollY=0,s._eventType=i,r&&(s._prevX=r.x,s._prevY=r.y),s}c(e,t);var i=e.prototype;return i.setScrollData=function(t,e){this._scrollX=t,this._scrollY=e},i.getScrollX=function(){return this._scrollX},i.getScrollY=function(){return this._scrollY},i.setLocation=function(t,e){this._x=t,this._y=e},i.getLocation=function(t){return t||(t=new _n),_n.set(t,this._x,this._y),t},i.getLocationInView=function(t){return t||(t=new _n),_n.set(t,this._x,b.view._designResolutionSize.height-this._y),t},i.getUILocation=function(t){return t||(t=new _n),_n.set(t,this._x,this._y),b.view._convertToUISpace(t),t},i.getPreviousLocation=function(t){return t||(t=new _n),_n.set(t,this._prevX,this._prevY),t},i.getUIPreviousLocation=function(t){return t||(t=new _n),_n.set(t,this._prevX,this._prevY),b.view._convertToUISpace(t),t},i.getDelta=function(t){return t||(t=new _n),_n.set(t,this._x-this._prevX,this._y-this._prevY),t},i.getDeltaX=function(){return this._x-this._prevX},i.getDeltaY=function(){return this._y-this._prevY},i.getUIDelta=function(t){return t||(t=new _n),_n.set(t,(this._x-this._prevX)/b.view.getScaleX(),(this._y-this._prevY)/b.view.getScaleY()),t},i.getUIDeltaX=function(){return(this._x-this._prevX)/b.view.getScaleX()},i.getUIDeltaY=function(){return(this._y-this._prevY)/b.view.getScaleY()},i.setButton=function(t){this._button=t},i.getButton=function(){return this._button},i.getLocationX=function(){return this._x},i.getLocationY=function(){return this._y},i.getUILocationX=function(){var t=b.view.getViewportRect();return(this._x-t.x)/b.view.getScaleX()},i.getUILocationY=function(){var t=b.view.getViewportRect();return(this._y-t.y)/b.view.getScaleY()},h(e,[{key:"eventType",get:function(){return this._eventType}}]),e}(uA));cA.BUTTON_MISSING=-1,cA.BUTTON_LEFT=0,cA.BUTTON_RIGHT=2,cA.BUTTON_MIDDLE=1,cA.BUTTON_4=3,cA.BUTTON_5=4,cA.BUTTON_6=5,cA.BUTTON_7=6,cA.BUTTON_8=7,uA.EventMouse=cA;var _A=new _n,fA=t("EventTouch",function(t){function e(e,i,n,r){var s;return void 0===r&&(r=[]),(s=t.call(this,n,i)||this).touch=null,s.simulate=!1,s.preventSwallow=!1,s._eventCode=void 0,s._touches=void 0,s._allTouches=void 0,s._eventCode=n,s._touches=e||[],s._allTouches=r,s}c(e,t);var i=e.prototype;return i.getEventCode=function(){return this._eventCode},i.getTouches=function(){return this._touches},i.getAllTouches=function(){return this._allTouches},i.setLocation=function(t,e){this.touch&&this.touch.setTouchInfo(this.touch.getID(),t,e)},i.getLocation=function(t){return this.touch?this.touch.getLocation(t):new _n},i.getUILocation=function(t){return this.touch?this.touch.getUILocation(t):new _n},i.getLocationInView=function(t){return this.touch?this.touch.getLocationInView(t):new _n},i.getPreviousLocation=function(t){return this.touch?this.touch.getPreviousLocation(t):new _n},i.getStartLocation=function(t){return this.touch?this.touch.getStartLocation(t):new _n},i.getUIStartLocation=function(t){return this.touch?this.touch.getUIStartLocation(t):new _n},i.getID=function(){return this.touch?this.touch.getID():null},i.getDelta=function(t){return this.touch?this.touch.getDelta(t):new _n},i.getUIDelta=function(t){return this.touch?this.touch.getUIDelta(t):new _n},i.getDeltaX=function(){return this.touch?this.touch.getDelta(_A).x:0},i.getDeltaY=function(){return this.touch?this.touch.getDelta(_A).y:0},i.getLocationX=function(){return this.touch?this.touch.getLocationX():0},i.getLocationY=function(){return this.touch?this.touch.getLocationY():0},e}(uA));fA.MAX_TOUCHES=5,uA.EventTouch=fA;var dA,pA=t("EventGamepad",function(t){function e(e,i){var n;return(n=t.call(this,e,!1)||this).gamepad=void 0,n.gamepad=i,n}return c(e,t),e}(uA)),mA=t("EventHandle",function(t){function e(e,i){var n;return(n=t.call(this,e,!1)||this).handleInputDevice=void 0,n.handleInputDevice=i,n}return c(e,t),e}(uA)),gA=(t("EventHMD",function(t){function e(e,i){var n;return(n=t.call(this,e,!1)||this).hmdInputDevice=void 0,n.hmdInputDevice=i,n}return c(e,t),e}(uA)),t("Acceleration",(function(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=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=t,this.y=e,this.z=i,this.timestamp=n})));!function(t){t[t.NONE=0]="NONE",t[t.MOBILE_BACK=6]="MOBILE_BACK",t[t.BACKSPACE=8]="BACKSPACE",t[t.TAB=9]="TAB",t[t.ENTER=13]="ENTER",t[t.SHIFT_LEFT=16]="SHIFT_LEFT",t[t.CTRL_LEFT=17]="CTRL_LEFT",t[t.ALT_LEFT=18]="ALT_LEFT",t[t.PAUSE=19]="PAUSE",t[t.CAPS_LOCK=20]="CAPS_LOCK",t[t.ESCAPE=27]="ESCAPE",t[t.SPACE=32]="SPACE",t[t.PAGE_UP=33]="PAGE_UP",t[t.PAGE_DOWN=34]="PAGE_DOWN",t[t.END=35]="END",t[t.HOME=36]="HOME",t[t.ARROW_LEFT=37]="ARROW_LEFT",t[t.ARROW_UP=38]="ARROW_UP",t[t.ARROW_RIGHT=39]="ARROW_RIGHT",t[t.ARROW_DOWN=40]="ARROW_DOWN",t[t.INSERT=45]="INSERT",t[t.DELETE=46]="DELETE",t[t.DIGIT_0=48]="DIGIT_0",t[t.DIGIT_1=49]="DIGIT_1",t[t.DIGIT_2=50]="DIGIT_2",t[t.DIGIT_3=51]="DIGIT_3",t[t.DIGIT_4=52]="DIGIT_4",t[t.DIGIT_5=53]="DIGIT_5",t[t.DIGIT_6=54]="DIGIT_6",t[t.DIGIT_7=55]="DIGIT_7",t[t.DIGIT_8=56]="DIGIT_8",t[t.DIGIT_9=57]="DIGIT_9",t[t.KEY_A=65]="KEY_A",t[t.KEY_B=66]="KEY_B",t[t.KEY_C=67]="KEY_C",t[t.KEY_D=68]="KEY_D",t[t.KEY_E=69]="KEY_E",t[t.KEY_F=70]="KEY_F",t[t.KEY_G=71]="KEY_G",t[t.KEY_H=72]="KEY_H",t[t.KEY_I=73]="KEY_I",t[t.KEY_J=74]="KEY_J",t[t.KEY_K=75]="KEY_K",t[t.KEY_L=76]="KEY_L",t[t.KEY_M=77]="KEY_M",t[t.KEY_N=78]="KEY_N",t[t.KEY_O=79]="KEY_O",t[t.KEY_P=80]="KEY_P",t[t.KEY_Q=81]="KEY_Q",t[t.KEY_R=82]="KEY_R",t[t.KEY_S=83]="KEY_S",t[t.KEY_T=84]="KEY_T",t[t.KEY_U=85]="KEY_U",t[t.KEY_V=86]="KEY_V",t[t.KEY_W=87]="KEY_W",t[t.KEY_X=88]="KEY_X",t[t.KEY_Y=89]="KEY_Y",t[t.KEY_Z=90]="KEY_Z",t[t.NUM_0=96]="NUM_0",t[t.NUM_1=97]="NUM_1",t[t.NUM_2=98]="NUM_2",t[t.NUM_3=99]="NUM_3",t[t.NUM_4=100]="NUM_4",t[t.NUM_5=101]="NUM_5",t[t.NUM_6=102]="NUM_6",t[t.NUM_7=103]="NUM_7",t[t.NUM_8=104]="NUM_8",t[t.NUM_9=105]="NUM_9",t[t.NUM_MULTIPLY=106]="NUM_MULTIPLY",t[t.NUM_PLUS=107]="NUM_PLUS",t[t.NUM_SUBTRACT=109]="NUM_SUBTRACT",t[t.NUM_DECIMAL=110]="NUM_DECIMAL",t[t.NUM_DIVIDE=111]="NUM_DIVIDE",t[t.F1=112]="F1",t[t.F2=113]="F2",t[t.F3=114]="F3",t[t.F4=115]="F4",t[t.F5=116]="F5",t[t.F6=117]="F6",t[t.F7=118]="F7",t[t.F8=119]="F8",t[t.F9=120]="F9",t[t.F10=121]="F10",t[t.F11=122]="F11",t[t.F12=123]="F12",t[t.NUM_LOCK=144]="NUM_LOCK",t[t.SCROLL_LOCK=145]="SCROLL_LOCK",t[t.SEMICOLON=186]="SEMICOLON",t[t.EQUAL=187]="EQUAL",t[t.COMMA=188]="COMMA",t[t.DASH=189]="DASH",t[t.PERIOD=190]="PERIOD",t[t.SLASH=191]="SLASH",t[t.BACK_QUOTE=192]="BACK_QUOTE",t[t.BRACKET_LEFT=219]="BRACKET_LEFT",t[t.BACKSLASH=220]="BACKSLASH",t[t.BRACKET_RIGHT=221]="BRACKET_RIGHT",t[t.QUOTE=222]="QUOTE",t[t.SHIFT_RIGHT=2e3]="SHIFT_RIGHT",t[t.CTRL_RIGHT=2001]="CTRL_RIGHT",t[t.ALT_RIGHT=2002]="ALT_RIGHT",t[t.NUM_ENTER=2003]="NUM_ENTER"}(dA||(dA=t("KeyCode",{})));var vA=new _n,yA=t("Touch",function(){function t(t,e,i){void 0===i&&(i=0),this._point=new _n,this._prevPoint=new _n,this._lastModified=0,this._id=0,this._startPoint=new _n,this._startPointCaptured=!1,this.setTouchInfo(i,t,e)}var e=t.prototype;return e.getLocation=function(t){return t||(t=new _n),t.set(this._point.x,this._point.y),t},e.getLocationX=function(){return this._point.x},e.getLocationY=function(){return this._point.y},e.getUILocation=function(t){return t||(t=new _n),t.set(this._point.x,this._point.y),b.view._convertToUISpace(t),t},e.getUILocationX=function(){var t=b.view.getViewportRect();return(this._point.x-t.x)/b.view.getScaleX()},e.getUILocationY=function(){var t=b.view.getViewportRect();return(this._point.y-t.y)/b.view.getScaleY()},e.getPreviousLocation=function(t){return t||(t=new _n),t.set(this._prevPoint.x,this._prevPoint.y),t},e.getUIPreviousLocation=function(t){return t||(t=new _n),t.set(this._prevPoint.x,this._prevPoint.y),b.view._convertToUISpace(t),t},e.getStartLocation=function(t){return t||(t=new _n),t.set(this._startPoint.x,this._startPoint.y),t},e.getUIStartLocation=function(t){return t||(t=new _n),t.set(this._startPoint.x,this._startPoint.y),b.view._convertToUISpace(t),t},e.getDelta=function(t){return t||(t=new _n),t.set(this._point),t.subtract(this._prevPoint),t},e.getUIDelta=function(t){return t||(t=new _n),vA.set(this._point),vA.subtract(this._prevPoint),t.set(b.view.getScaleX(),b.view.getScaleY()),_n.divide(t,vA,t),t},e.getLocationInView=function(t){return t||(t=new _n),t.set(this._point.x,b.view._designResolutionSize.height-this._point.y),t},e.getPreviousLocationInView=function(t){return t||(t=new _n),t.set(this._prevPoint.x,b.view._designResolutionSize.height-this._prevPoint.y),t},e.getStartLocationInView=function(t){return t||(t=new _n),t.set(this._startPoint.x,b.view._designResolutionSize.height-this._startPoint.y),t},e.getID=function(){return this._id},e.setTouchInfo=function(t,e,i){void 0===t&&(t=0),this._prevPoint=this._point,this._point=new _n(e||0,i||0),this._id=t,this._startPointCaptured||(this._startPoint=new _n(this._point),this._startPointCaptured=!0)},e.setPoint=function(t,e){"object"==typeof t?(this._point.x=t.x,this._point.y=t.y):(this._point.x=t||0,this._point.y=e||0),this._lastModified=b.game.frameStartTime},e.setPrevPoint=function(t,e){this._prevPoint="object"==typeof t?new _n(t.x,t.y):new _n(t||0,e||0),this._lastModified=b.game.frameStartTime},h(t,[{key:"lastModified",get:function(){return this._lastModified}}]),t}());b.Touch=yA;var EA,TA=new Array(16),SA=null,AA=new _n,RA=[aE.TOUCH_START,aE.TOUCH_MOVE,aE.TOUCH_END,aE.TOUCH_CANCEL],bA=[aE.MOUSE_DOWN,aE.MOUSE_ENTER,aE.MOUSE_MOVE,aE.MOUSE_LEAVE,aE.MOUSE_UP,aE.MOUSE_WHEEL];!function(t){t[t.ADD_POINTER_EVENT_PROCESSOR=0]="ADD_POINTER_EVENT_PROCESSOR",t[t.REMOVE_POINTER_EVENT_PROCESSOR=1]="REMOVE_POINTER_EVENT_PROCESSOR",t[t.MARK_LIST_DIRTY=2]="MARK_LIST_DIRTY"}(EA||(EA={}));var CA=function(){function t(t){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=t}var e=t.prototype;return e.setEnabled=function(e,i){if(void 0===i&&(i=!1),this._isEnabled!==e){this._isEnabled=e;var n=this.node.children;if(e&&this._attachMask(),t.callbacksInvoker.emit(EA.MARK_LIST_DIRTY),i&&n.length>0)for(var r=0;r<n.length;++r)n[r]._eventProcessor.setEnabled(e,!0)}},e.reattach=function(){var e,i=this;this.node.walk((function(n){e||(e=i._searchComponentsInParent(t._maskComp)),n.eventProcessor.maskList=e}))},e.destroy=function(){if(SA===this._node&&(SA=null),this.capturingTarget&&this.capturingTarget.clear(),this.bubblingTarget&&this.bubblingTarget.clear(),t.callbacksInvoker.emit(EA.REMOVE_POINTER_EVENT_PROCESSOR,this),this._dispatchingTouch){var e=new fA([this._dispatchingTouch],!0,oA.TOUCH_CANCEL);e.touch=this._dispatchingTouch,this.dispatchEvent(e),this._dispatchingTouch=null}},e.on=function(t,e,i,n){var r,s;return this._tryEmittingAddEvent(t),((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(t,e,i),e},e.once=function(t,e,i,n){var r,s;return this._tryEmittingAddEvent(t),((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(t,e,i,!0),e},e.off=function(t,e,i,n){var r;null===(r=(n=!!n)?this.capturingTarget:this.bubblingTarget)||void 0===r||r.off(t,e,i)},e.targetOff=function(e){var i,n;null===(i=this.capturingTarget)||void 0===i||i.removeAll(e),null===(n=this.bubblingTarget)||void 0===n||n.removeAll(e),this.shouldHandleEventTouch&&!this._hasTouchListeners()&&(this.shouldHandleEventTouch=!1),this.shouldHandleEventMouse&&!this._hasMouseListeners()&&(this.shouldHandleEventMouse=!1),this._hasPointerListeners()||t.callbacksInvoker.emit(EA.REMOVE_POINTER_EVENT_PROCESSOR,this)},e.emit=function(t,e,i,n,r,s){var a;null===(a=this.bubblingTarget)||void 0===a||a.emit(t,e,i,n,r,s)},e.dispatchEvent=function(t){var e,i=this.node,n=0;for(t.target=i,TA.length=0,this.getCapturingTargets(t.type,TA),t.eventPhase=1,n=TA.length-1;n>=0;--n)if((e=TA[n]).eventProcessor.capturingTarget&&(t.currentTarget=e,e.eventProcessor.capturingTarget.emit(t.type,t,TA),t.propagationStopped))return void(TA.length=0);if(TA.length=0,t.eventPhase=2,t.currentTarget=i,this.capturingTarget&&this.capturingTarget.emit(t.type,t),!t.propagationImmediateStopped&&this.bubblingTarget&&this.bubblingTarget.emit(t.type,t),!t.propagationStopped&&t.bubbles)for(this.getBubblingTargets(t.type,TA),t.eventPhase=3,n=0;n<TA.length;++n)if((e=TA[n]).eventProcessor.bubblingTarget&&(t.currentTarget=e,e.eventProcessor.bubblingTarget.emit(t.type,t),t.propagationStopped))return void(TA.length=0);TA.length=0},e.hasEventListener=function(t,e,i){var n=!1;return this.bubblingTarget&&(n=this.bubblingTarget.hasEventListener(t,e,i)),!n&&this.capturingTarget&&(n=this.capturingTarget.hasEventListener(t,e,i)),n},e.getCapturingTargets=function(t,e){for(var i=this._node.parent;i;){var n;(null===(n=i.eventProcessor.capturingTarget)||void 0===n?void 0:n.hasEventListener(t))&&e.push(i),i=i.parent}},e.getBubblingTargets=function(t,e){for(var i=this._node.parent;i;){var n;(null===(n=i.eventProcessor.bubblingTarget)||void 0===n?void 0:n.hasEventListener(t))&&e.push(i),i=i.parent}},e._searchComponentsInParent=function(t){var e=this.node;if(t){for(var i=0,n=[],r=e;r&&jE.isNode(r);r=r.parent,++i){var s=r.getComponent(t);if(s){var a={index:i,comp:s};n?n.push(a):n=[a]}}return n.length>0?n:null}return null},e._attachMask=function(){this.maskList=this._searchComponentsInParent(t._maskComp)},e._isTouchEvent=function(t){return-1!==RA.indexOf(t)},e._isMouseEvent=function(t){return-1!==bA.indexOf(t)},e._hasTouchListeners=function(){for(var t=0;t<RA.length;++t){var e=RA[t];if(this.hasEventListener(e))return!0}return!1},e._hasMouseListeners=function(){for(var t=0;t<bA.length;++t){var e=bA[t];if(this.hasEventListener(e))return!0}return!1},e._hasPointerListeners=function(){return!!this._hasTouchListeners()||this._hasMouseListeners()},e._tryEmittingAddEvent=function(e){var i=this._isTouchEvent(e),n=this._isMouseEvent(e);i?this.shouldHandleEventTouch=!0:n&&(this.shouldHandleEventMouse=!0),!i&&!n||this._hasPointerListeners()||t.callbacksInvoker.emit(EA.ADD_POINTER_EVENT_PROCESSOR,this)},e._newCallbacksInvoker=function(){var e=this,i=new Pa;return i._registerOffCallback((function(){e.shouldHandleEventTouch&&!e._hasTouchListeners()&&(e.shouldHandleEventTouch=!1),e.shouldHandleEventMouse&&!e._hasMouseListeners()&&(e.shouldHandleEventMouse=!1),e._hasPointerListeners()||t.callbacksInvoker.emit(EA.REMOVE_POINTER_EVENT_PROCESSOR,e)})),i},e._handleEventMouse=function(t){switch(t.type){case oA.MOUSE_DOWN:return this._handleMouseDown(t);case oA.MOUSE_MOVE:return this._handleMouseMove(t);case oA.MOUSE_UP:return this._handleMouseUp(t);case oA.MOUSE_WHEEL:return this._handleMouseWheel(t);default:return!1}},e._handleMouseDown=function(t){var e=this._node;return!(!e||!e._uiProps.uiTransformComp||(t.getLocation(AA),!e._uiProps.uiTransformComp.hitTest(AA)||(t.type=aE.MOUSE_DOWN,t.bubbles=!0,e.dispatchEvent(t),t.propagationStopped=!0,0)))},e._handleMouseMove=function(t){var e=this._node;return!(!e||!e._uiProps.uiTransformComp||(t.getLocation(AA),e._uiProps.uiTransformComp.hitTest(AA)?(this.previousMouseIn||(SA&&SA!==e&&(t.type=aE.MOUSE_LEAVE,SA.dispatchEvent(t),SA.eventProcessor.previousMouseIn=!1),SA=e,t.type=aE.MOUSE_ENTER,e.dispatchEvent(t),this.previousMouseIn=!0),t.type=aE.MOUSE_MOVE,t.bubbles=!0,e.dispatchEvent(t),t.propagationStopped=!0,0):(this.previousMouseIn&&(t.type=aE.MOUSE_LEAVE,e.dispatchEvent(t),this.previousMouseIn=!1,SA=null),1)))},e._handleMouseUp=function(t){var e=this._node;return!(!e||!e._uiProps.uiTransformComp||(t.getLocation(AA),!e._uiProps.uiTransformComp.hitTest(AA)||(t.type=aE.MOUSE_UP,t.bubbles=!0,e.dispatchEvent(t),t.propagationStopped=!0,0)))},e._handleMouseWheel=function(t){var e=this._node;return!(!e||!e._uiProps.uiTransformComp||(t.getLocation(AA),!e._uiProps.uiTransformComp.hitTest(AA)||(t.type=aE.MOUSE_WHEEL,t.bubbles=!0,e.dispatchEvent(t),t.propagationStopped=!0,0)))},e._handleEventTouch=function(t){switch(t.type){case oA.TOUCH_START:return this._handleTouchStart(t);case oA.TOUCH_MOVE:return this._handleTouchMove(t);case oA.TOUCH_END:return this._handleTouchEnd(t);case oA.TOUCH_CANCEL:return this._handleTouchCancel(t);default:return!1}},e._handleTouchStart=function(t){var e=this.node;return!(!e||!e._uiProps.uiTransformComp||(t.getLocation(AA),!e._uiProps.uiTransformComp.hitTest(AA)||(t.type=aE.TOUCH_START,t.bubbles=!0,this._dispatchingTouch=t.touch,e.dispatchEvent(t),0)))},e._handleTouchMove=function(t){var e=this.node;return!(!e||!e._uiProps.uiTransformComp||(t.type=aE.TOUCH_MOVE,t.bubbles=!0,this._dispatchingTouch=t.touch,e.dispatchEvent(t),0))},e._handleTouchEnd=function(t){var e=this.node;e&&e._uiProps.uiTransformComp&&(t.getLocation(AA),e._uiProps.uiTransformComp.hitTest(AA)?t.type=aE.TOUCH_END:t.type=aE.TOUCH_CANCEL,t.bubbles=!0,e.dispatchEvent(t),this._dispatchingTouch=null)},e._handleTouchCancel=function(t){var e=this.node;e&&e._uiProps.uiTransformComp&&(t.type=aE.TOUCH_CANCEL,t.bubbles=!0,e.dispatchEvent(t))},h(t,[{key:"isEnabled",get:function(){return this._isEnabled}},{key:"node",get:function(){return this._node}}]),t}();CA._maskComp=null,CA.callbacksInvoker=new Pa,b.NodeEventProcessor=CA;var wA=function(){function t(){this._groundAlbedoHDR=new Li(.2,.2,.2,1),this._skyColorHDR=new Li(.2,.5,.8,1),this._skyIllumHDR=0,this._groundAlbedoLDR=new Li(.2,.2,.2,1),this._skyColorLDR=new Li(.2,.5,.8,1),this._skyIllumLDR=0,this._mipmapCount=1,this._enabled=!1}return t.prototype.initialize=function(t){this._skyColorHDR=t.skyColorHDR,this._groundAlbedoHDR.set(t.groundAlbedoHDR),this._skyIllumHDR=t.skyIllumHDR,this._skyColorLDR=t.skyColorLDR,this._groundAlbedoLDR.set(t.groundAlbedoLDR),this._skyIllumLDR=t.skyIllumLDR},h(t,[{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled=t}},{key:"skyColor",get:function(){return b.director.root.pipeline.pipelineSceneData.isHDR?this._skyColorHDR:this._skyColorLDR},set:function(t){b.director.root.pipeline.pipelineSceneData.isHDR?this._skyColorHDR.set(t):this._skyColorLDR.set(t)}},{key:"skyIllum",get:function(){return b.director.root.pipeline.pipelineSceneData.isHDR?this._skyIllumHDR:this._skyIllumLDR},set:function(t){b.director.root.pipeline.pipelineSceneData.isHDR?this._skyIllumHDR=t:this._skyIllumLDR=t}},{key:"groundAlbedo",get:function(){return b.director.root.pipeline.pipelineSceneData.isHDR?this._groundAlbedoHDR:this._groundAlbedoLDR},set:function(t){b.director.root.pipeline.pipelineSceneData.isHDR?this._groundAlbedoHDR.set(t):this._groundAlbedoLDR.set(t)}}]),t}();wA.SUN_ILLUM=65e3,wA.SKY_ILLUM=2e4,b.Ambient=wA;var IA=_e({Low_256x256:256,Medium_512x512:512,High_1024x1024:1024,Ultra_2048x2048:2048}),OA=_e({Planar:0,ShadowMap:1}),xA=_e({HARD:0,SOFT:1,SOFT_2X:2,SOFT_4X:3}),PA=_e({LEVEL_1:1,LEVEL_2:2,LEVEL_3:3,LEVEL_4:4}),DA=_e({NONE:1,RemoveDuplicates:2,DisableRotationFix:3}),BA=OA.ShadowMap+1,NA=function(){function t(){this.fixedSphere=new To(0,0,0,.01),this.maxReceived=4,this._matLight=new un,this._material=null,this._instancingMaterial=null,this._enabled=!1,this._type=BA,this._distance=0,this._normal=new ji(0,1,0),this._shadowColor=new Gi(0,0,0,76),this._size=new _n(1024,1024),this._shadowMapDirty=!1}var e=t.prototype;return e.getPlanarShader=function(t){this._material||(this._material=new Vy,this._material.initialize({effectName:"pipeline/planar-shadow"}));var e=this._material.passes;return e.length>0?e[0].getShaderVariant(t):null},e.getPlanarInstanceShader=function(t){this._instancingMaterial||(this._instancingMaterial=new Vy,this._instancingMaterial.initialize({effectName:"pipeline/planar-shadow",defines:{USE_INSTANCING:!0}}));var e=this._instancingMaterial.passes;return e.length>0?e[0].getShaderVariant(t):null},e.initialize=function(t){this._enabled=t.enabled,this._type=this.enabled?t.type:BA,this.normal=t.planeDirection,this.distance=t.planeHeight,this.shadowColor=t.shadowColor,this.maxReceived=t.maxReceived,t.shadowMapSize!==this._size.x&&(this.size.set(t.shadowMapSize,t.shadowMapSize),this._shadowMapDirty=!0)},e.activate=function(){if(this._enabled)if(this.type===OA.Planar)this._updatePlanarInfo();else{var t=b.director.root;t.pipeline.macros.CC_SHADOW_TYPE=2,t.onGlobalPipelineStateChanged()}else{var e=b.director.root;e.pipeline.macros.CC_SHADOW_TYPE=0,e.onGlobalPipelineStateChanged()}},e._updatePlanarInfo=function(){this._material||(this._material=new Vy,this._material.initialize({effectName:"pipeline/planar-shadow"})),this._instancingMaterial||(this._instancingMaterial=new Vy,this._instancingMaterial.initialize({effectName:"pipeline/planar-shadow",defines:{USE_INSTANCING:!0}}));var t=b.director.root;t.pipeline.macros.CC_SHADOW_TYPE=1,t.onGlobalPipelineStateChanged()},e.destroy=function(){this._material&&this._material.destroy(),this._instancingMaterial&&this._instancingMaterial.destroy(),this.fixedSphere.destroy()},h(t,[{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled=t,this.activate()}},{key:"type",get:function(){return this._type},set:function(t){this._type=this.enabled?t:BA,this.activate()}},{key:"normal",get:function(){return this._normal},set:function(t){ji.copy(this._normal,t)}},{key:"distance",get:function(){return this._distance},set:function(t){this._distance=t}},{key:"shadowColor",get:function(){return this._shadowColor},set:function(t){this._shadowColor=t}},{key:"size",get:function(){return this._size},set:function(t){this._size.set(t)}},{key:"shadowMapDirty",get:function(){return this._shadowMapDirty},set:function(t){this._shadowMapDirty=t}},{key:"matLight",get:function(){return this._matLight}},{key:"material",get:function(){return this._material}},{key:"instancingMaterial",get:function(){return this._instancingMaterial}}]),t}();NA.MAX_FAR=2e3,NA.COEFFICIENT_OF_EXPANSION=2*Math.sqrt(3),b.Shadows=NA;var MA=null,LA=null,FA=_e({HEMISPHERE_DIFFUSE:0,AUTOGEN_HEMISPHERE_DIFFUSE_WITH_REFLECTION:1,DIFFUSEMAP_WITH_REFLECTION:2}),UA=function(){function t(){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 e=t.prototype;return e.initialize=function(t){this._activated=!1,this._enabled=t.enabled,this._useIBL=t.useIBL,this._useDiffuseMap=t.applyDiffuseMap,this._useHDR=t.useHDR},e.setEnvMaps=function(t,e){this._envmapHDR=t,this._envmapLDR=e,this._updateGlobalBinding(),this._updatePipeline()},e.setDiffuseMaps=function(t,e){this._diffuseMapHDR=t,this._diffuseMapLDR=e,this._updateGlobalBinding(),this._updatePipeline()},e.setSkyboxMaterial=function(t){t?(this._editableMaterial=new iA({parent:t}),this._editableMaterial.recompileShaders({USE_RGBE_CUBEMAP:this.isRGBE})):this._editableMaterial=null,this._updatePipeline()},e.setReflectionMaps=function(t,e){this._reflectionHDR=t,this._reflectionLDR=e,this._updateGlobalBinding(),this._updatePipeline()},e.setRotationAngle=function(t){this._rotationAngle=t},e.getRotationAngle=function(){return this._rotationAngle},e.updateMaterialRenderInfo=function(){this._updateGlobalBinding(),this._updatePipeline()},e.activate=function(){var t=b.director.root.pipeline;this._globalDSManager=t.globalDSManager,this._default=vy.get("default-cube-texture"),this._model||(this._model=b.director.root.createModel(b.renderer.scene.Model));var e=this._default.isRGBE;if(this._default.isUsingOfflineMipmaps(),this.envmap&&(e=this.envmap.isRGBE,this.envmap.isUsingOfflineMipmaps()),!LA){var i=new Vy;i.initialize({effectName:"pipeline/skybox",defines:{USE_RGBE_CUBEMAP:e}}),LA=new iA({parent:i})}this.enabled&&(MA||(MA=b.utils.createMesh(b.primitives.box({width:2,height:2,length:2}))),this._editableMaterial?this._model.initSubModel(0,MA.renderingSubMeshes[0],this._editableMaterial):this._model.initSubModel(0,MA.renderingSubMeshes[0],LA)),this.envmap||(this.envmap=this._default),this.diffuseMap||(this.diffuseMap=this._default),this._updateGlobalBinding(),this._updatePipeline(),this._activated=!0},e._updatePipeline=function(){var t=b.director.root,e=t.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(e.macros.CC_USE_IBL===i&&e.macros.CC_USE_DIFFUSEMAP===n&&e.macros.CC_USE_HDR===r&&e.macros.CC_IBL_CONVOLUTED===s||(e.macros.CC_USE_IBL=i,e.macros.CC_USE_DIFFUSEMAP=n,e.macros.CC_USE_HDR=r,e.macros.CC_IBL_CONVOLUTED=s,this._activated&&t.onGlobalPipelineStateChanged()),this.enabled){var a=this.envmap?this.envmap:this._default,o=this._editableMaterial?this._editableMaterial:LA;o&&(o.setProperty("environmentMap",a),o.recompileShaders({USE_RGBE_CUBEMAP:this.isRGBE})),this._model&&(this._model.setSubModelMaterial(0,o),this._updateSubModes())}},e._updateGlobalBinding=function(){if(this._globalDSManager){var t=Ja.gfxDevice;if(this.reflectionMap){var e=this.reflectionMap.getGFXTexture(),i=t.getSampler(this.reflectionMap.getSamplerInfo());this._globalDSManager.bindSampler(Sp,i),this._globalDSManager.bindTexture(Sp,e)}else{var n=this.envmap?this.envmap:this._default;if(n){var r=n.getGFXTexture(),s=t.getSampler(n.getSamplerInfo());this._globalDSManager.bindSampler(Sp,s),this._globalDSManager.bindTexture(Sp,r)}}var a=this.diffuseMap?this.diffuseMap:this._default;if(a){var o=a.getGFXTexture(),u=t.getSampler(a.getSamplerInfo());this._globalDSManager.bindSampler(bp,u),this._globalDSManager.bindTexture(bp,o)}this._globalDSManager.update()}},e._updateSubModes=function(){if(this._model)for(var t=this._model.subModels,e=0;e<t.length;e++)t[e].update()},h(t,[{key:"model",get:function(){return this._model}},{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled=t,t?this.activate():this._updatePipeline()}},{key:"useHDR",get:function(){return this._useHDR},set:function(t){this._useHDR=t,this.setEnvMaps(this._envmapHDR,this._envmapLDR)}},{key:"useIBL",get:function(){return this._useIBL},set:function(t){this._useIBL=t,this._updatePipeline()}},{key:"useDiffuseMap",get:function(){return this._useDiffuseMap},set:function(t){this._useDiffuseMap=t,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 b.director.root.pipeline.pipelineSceneData.isHDR?this._envmapHDR:this._envmapLDR},set:function(t){b.director.root.pipeline.pipelineSceneData.isHDR?this.setEnvMaps(t,this._envmapLDR):this.setEnvMaps(this._envmapHDR,t)}},{key:"diffuseMap",get:function(){return b.director.root.pipeline.pipelineSceneData.isHDR?this._diffuseMapHDR:this._diffuseMapLDR},set:function(t){b.director.root.pipeline.pipelineSceneData.isHDR?this.setDiffuseMaps(t,this._diffuseMapLDR):this.setDiffuseMaps(this._diffuseMapHDR,t)}},{key:"reflectionMap",get:function(){return b.director.root.pipeline.pipelineSceneData.isHDR?this._reflectionHDR:this._reflectionLDR}}]),t}();b.Skybox=UA;var GA,kA,zA,HA,VA,WA,XA,jA,YA,KA,qA,QA,ZA,JA,$A,tR,eR,iR,nR,rR,sR,aR,oR,uR,hR,lR,cR,_R,fR,dR,pR,mR,gR,vR,yR,ER,TR,SR,AR,RR,bR,CR,wR,IR,OR,xR,PR,DR,BR,NR,MR,LR,FR,UR,GR,kR,zR,HR,VR,WR,XR,jR,YR,KR,qR,QR,ZR,JR,$R,tb,eb,ib,nb,rb,sb,ab,ob,ub,hb,lb,cb,_b,fb,db,pb,mb,gb,vb,yb,Eb,Tb,Sb,Ab,Rb,bb,Cb,wb,Ib,Ob,xb,Pb,Db,Bb,Nb,Mb,Lb,Fb,Ub,Gb,kb,zb,Hb,Vb,Wb,Xb,jb,Yb,Kb,qb,Qb,Zb,Jb,$b,tC,eC,iC,nC,rC,sC,aC,oC,uC,hC,lC,cC,_C,fC,dC,pC,mC,gC,vC,yC,EC,TC,SC,AC,RC,bC,CC,wC,IC,OC,xC,PC,DC,BC,NC,MC=new Li,LC=_e({LINEAR:0,EXP:1,EXP_SQUARED:2,LAYERED:3}),FC=LC.LAYERED+1,UC=function(){function t(){this._fogColor=new Gi("#C8C8C8"),this._colorArray=new Li(.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 e=t.prototype;return e.initialize=function(t){this._activated=!1,this.fogColor=t.fogColor,this._enabled=t.enabled,this._type=this.enabled?t.type:FC,this._accurate=t.accurate,this.fogDensity=t.fogDensity,this.fogStart=t.fogStart,this.fogEnd=t.fogEnd,this.fogAtten=t.fogAtten,this.fogTop=t.fogTop,this.fogRange=t.fogRange},e.activate=function(){this._updatePipeline(),this._activated=!0},e._updatePipeline=function(){var t=b.director.root,e=this.enabled?this.type:FC,i=this.accurate?1:0,n=t.pipeline;n.macros.CC_USE_FOG===e&&n.macros.CC_USE_ACCURATE_FOG===i||(n.macros.CC_USE_FOG=e,n.macros.CC_USE_ACCURATE_FOG=i,this._activated&&t.onGlobalPipelineStateChanged())},h(t,[{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled=t,t?this.activate():(this._type=FC,this._updatePipeline())}},{key:"accurate",get:function(){return this._accurate},set:function(t){this._accurate=t,this._updatePipeline()}},{key:"fogColor",get:function(){return this._fogColor},set:function(t){this._fogColor.set(t),MC.set(t.x,t.y,t.z,t.w),Oy(this._colorArray,MC)}},{key:"type",get:function(){return this._type},set:function(t){this._type=this.enabled?t:FC,this.enabled&&this._updatePipeline()}},{key:"fogDensity",get:function(){return this._fogDensity},set:function(t){this._fogDensity=t}},{key:"fogStart",get:function(){return this._fogStart},set:function(t){this._fogStart=t}},{key:"fogEnd",get:function(){return this._fogEnd},set:function(t){this._fogEnd=t}},{key:"fogAtten",get:function(){return this._fogAtten},set:function(t){this._fogAtten=t}},{key:"fogTop",get:function(){return this._fogTop},set:function(t){this._fogTop=t}},{key:"fogRange",get:function(){return this._fogRange},set:function(t){this._fogRange=t}},{key:"colorArray",get:function(){return this._colorArray}}]),t}();b.Fog=UC;var GC=new ji(0,1,0),kC=new ji,zC=new Li,HC=new Gi,VC=new $i,WC=function(t){var e=1/Math.max(Math.max(Math.max(t.x,t.y),t.z),1e-4);e<1&&(t.x*=e,t.y*=e,t.z*=e)},XC=t("AmbientInfo",(GA=_h("cc.AmbientInfo"),kA=Dh(),zA=Mh(),HA=Kh(Ve),VA=Mh(),WA=Dh(),XA=Mh(),jA=Th("_skyColor"),YA=Th("_skyIllum"),KA=Th("_groundAlbedo"),GA((T((QA=function(){function t(){E(this,"_skyColorHDR",ZA,this),E(this,"_skyIllumHDR",JA,this),E(this,"_groundAlbedoHDR",$A,this),E(this,"_skyColorLDR",tR,this),E(this,"_skyIllumLDR",eR,this),E(this,"_groundAlbedoLDR",iR,this),this._resource=null}return t.prototype.activate=function(t){this._resource=t,this._resource.initialize(this)},h(t,[{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 t=b.director.root.pipeline.pipelineSceneData.isHDR;return zC.set(t?this._skyColorHDR:this._skyColorLDR),WC(zC),HC.set(255*zC.x,255*zC.y,255*zC.z,255)},set:function(t){zC.set(t.x,t.y,t.z,t.w),b.director.root.pipeline.pipelineSceneData.isHDR?this._skyColorHDR.set(zC):this._skyColorLDR.set(zC),this._resource&&this._resource.skyColor.set(zC)}},{key:"skyColor",set:function(t){b.director.root.pipeline.pipelineSceneData.isHDR?this._skyColorHDR.set(t):this._skyColorLDR.set(t),this._resource&&this._resource.skyColor.set(t)}},{key:"skyIllum",get:function(){return b.director.root.pipeline.pipelineSceneData.isHDR?this._skyIllumHDR:this._skyIllumLDR},set:function(t){b.director.root.pipeline.pipelineSceneData.isHDR?this._skyIllumHDR=t:this._skyIllumLDR=t,this._resource&&(this._resource.skyIllum=t)}},{key:"groundLightingColor",get:function(){var t=b.director.root.pipeline.pipelineSceneData.isHDR;return zC.set(t?this._groundAlbedoHDR:this._groundAlbedoLDR),WC(zC),HC.set(255*zC.x,255*zC.y,255*zC.z,255)},set:function(t){zC.set(t.x,t.y,t.z,t.w),b.director.root.pipeline.pipelineSceneData.isHDR?this._groundAlbedoHDR.set(zC):this._groundAlbedoLDR.set(zC),this._resource&&this._resource.groundAlbedo.set(zC)}},{key:"groundAlbedo",set:function(t){b.director.root.pipeline.pipelineSceneData.isHDR?this._groundAlbedoHDR.set(t):this._groundAlbedoLDR.set(t),this._resource&&this._resource.groundAlbedo.set(t)}}]),t}()).prototype,"skyLightingColor",[kA,Ph,zA],Object.getOwnPropertyDescriptor(QA.prototype,"skyLightingColor"),QA.prototype),T(QA.prototype,"skyIllum",[Ph,HA,VA],Object.getOwnPropertyDescriptor(QA.prototype,"skyIllum"),QA.prototype),T(QA.prototype,"groundLightingColor",[WA,Ph,XA],Object.getOwnPropertyDescriptor(QA.prototype,"groundLightingColor"),QA.prototype),ZA=T(QA.prototype,"_skyColorHDR",[Eh,jA],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new Li(.2,.5,.8,1)}}),JA=T(QA.prototype,"_skyIllumHDR",[Eh,YA],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return wA.SKY_ILLUM}}),$A=T(QA.prototype,"_groundAlbedoHDR",[Eh,KA],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new Li(.2,.2,.2,1)}}),tR=T(QA.prototype,"_skyColorLDR",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new Li(.2,.5,.8,1)}}),eR=T(QA.prototype,"_skyIllumLDR",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return wA.SKY_ILLUM}}),iR=T(QA.prototype,"_groundAlbedoLDR",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new Li(.2,.2,.2,1)}}),qA=QA))||qA));b.AmbientInfo=XC;var jC=t("SkyboxInfo",(nR=_h("cc.SkyboxInfo"),rR=Mh(),sR=Kh(FA),aR=Mh(),oR=Mh(),uR=Kh(Qg),hR=Mh(),lR=Kh(Ve),cR=Lh(),_R=Gh(),fR=Mh(),dR=Dh(),pR=Kh(Qg),mR=zh(),gR=Dh(),vR=Kh(Qg),yR=zh(),ER=Kh(Vy),TR=Mh(),SR=Kh(Qg),AR=Th("_envmap"),RR=Kh(Qg),bR=Kh(Qg),CR=Kh(Qg),wR=Kh(Vy),IR=Kh(Qg),OR=Kh(Qg),nR((T((PR=function(){function t(){E(this,"_envLightingType",DR,this),E(this,"_envmapHDR",BR,this),E(this,"_envmapLDR",NR,this),E(this,"_diffuseMapHDR",MR,this),E(this,"_diffuseMapLDR",LR,this),E(this,"_enabled",FR,this),E(this,"_useHDR",UR,this),E(this,"_editableMaterial",GR,this),E(this,"_reflectionHDR",kR,this),E(this,"_reflectionLDR",zR,this),E(this,"_rotationAngle",HR,this),this._resource=null}return t.prototype.activate=function(t){this.envLightingType=this._envLightingType,this._resource=t,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()},h(t,[{key:"applyDiffuseMap",get:function(){return FA.DIFFUSEMAP_WITH_REFLECTION===this._envLightingType},set:function(t){this._resource&&(this._resource.useDiffuseMap=t)}},{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled!==t&&(this._enabled=t,this._resource&&(this._resource.enabled=this._enabled))}},{key:"envLightingType",get:function(){return this._envLightingType},set:function(t){this.envmap||FA.HEMISPHERE_DIFFUSE===t?(FA.HEMISPHERE_DIFFUSE===t?(this.useIBL=!1,this.applyDiffuseMap=!1):FA.AUTOGEN_HEMISPHERE_DIFFUSE_WITH_REFLECTION===t?(this.useIBL=!0,this.applyDiffuseMap=!1):FA.DIFFUSEMAP_WITH_REFLECTION===t&&(this.useIBL=!0,this.applyDiffuseMap=!0),this._envLightingType=t):(this.useIBL=!1,this.applyDiffuseMap=!1,this._envLightingType=FA.HEMISPHERE_DIFFUSE,j(15001))}},{key:"useIBL",get:function(){return FA.HEMISPHERE_DIFFUSE!==this._envLightingType},set:function(t){this._resource&&(this._resource.useIBL=t)}},{key:"useHDR",get:function(){return b.director.root.pipeline.pipelineSceneData.isHDR=this._useHDR,this._useHDR},set:function(t){b.director.root.pipeline.pipelineSceneData.isHDR=t,this._useHDR=t,this._resource&&this.envLightingType===FA.DIFFUSEMAP_WITH_REFLECTION&&(null===this.diffuseMap?(this.envLightingType=FA.AUTOGEN_HEMISPHERE_DIFFUSE_WITH_REFLECTION,j(15e3)):this.diffuseMap.isDefault&&j(15002)),this._resource&&(this._resource.useHDR=this._useHDR,this._resource.updateMaterialRenderInfo())}},{key:"envmap",get:function(){return b.director.root.pipeline.pipelineSceneData.isHDR?this._envmapHDR:this._envmapLDR},set:function(t){var e=b.director.root.pipeline.pipelineSceneData.isHDR;e?(this._envmapHDR=t,this._reflectionHDR=null):(this._envmapLDR=t,this._reflectionLDR=null),t||(e?this._diffuseMapHDR=null:this._diffuseMapLDR=null,this.applyDiffuseMap=!1,this.useIBL=!1,this.envLightingType=FA.HEMISPHERE_DIFFUSE,j(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=t)}},{key:"rotationAngle",get:function(){return this._rotationAngle},set:function(t){this._rotationAngle=t,this._resource&&this._resource.setRotationAngle(this._rotationAngle)}},{key:"diffuseMap",get:function(){return b.director.root.pipeline.pipelineSceneData.isHDR?this._diffuseMapHDR:this._diffuseMapLDR},set:function(t){b.director.root.pipeline.pipelineSceneData.isHDR?this._diffuseMapHDR=t:this._diffuseMapLDR=t,this._resource&&this._resource.setDiffuseMaps(this._diffuseMapHDR,this._diffuseMapLDR)}},{key:"reflectionMap",get:function(){return b.director.root.pipeline.pipelineSceneData.isHDR?this._reflectionHDR:this._reflectionLDR},set:function(t){b.director.root.pipeline.pipelineSceneData.isHDR?this._reflectionHDR=t:this._reflectionLDR=t,this._resource&&this._resource.setReflectionMaps(this._reflectionHDR,this._reflectionLDR)}},{key:"skyboxMaterial",get:function(){return this._editableMaterial},set:function(t){this._editableMaterial=t,this._resource&&this._resource.setSkyboxMaterial(this._editableMaterial)}}]),t}()).prototype,"enabled",[Ph,rR],Object.getOwnPropertyDescriptor(PR.prototype,"enabled"),PR.prototype),T(PR.prototype,"envLightingType",[Ph,sR,aR],Object.getOwnPropertyDescriptor(PR.prototype,"envLightingType"),PR.prototype),T(PR.prototype,"useHDR",[Ph,oR],Object.getOwnPropertyDescriptor(PR.prototype,"useHDR"),PR.prototype),T(PR.prototype,"envmap",[Ph,uR,hR],Object.getOwnPropertyDescriptor(PR.prototype,"envmap"),PR.prototype),T(PR.prototype,"rotationAngle",[lR,cR,_R,kh,fR],Object.getOwnPropertyDescriptor(PR.prototype,"rotationAngle"),PR.prototype),T(PR.prototype,"diffuseMap",[dR,Ph,Bh,pR,mR],Object.getOwnPropertyDescriptor(PR.prototype,"diffuseMap"),PR.prototype),T(PR.prototype,"reflectionMap",[gR,Ph,Bh,vR,yR],Object.getOwnPropertyDescriptor(PR.prototype,"reflectionMap"),PR.prototype),T(PR.prototype,"skyboxMaterial",[Ph,ER,TR],Object.getOwnPropertyDescriptor(PR.prototype,"skyboxMaterial"),PR.prototype),DR=T(PR.prototype,"_envLightingType",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return FA.HEMISPHERE_DIFFUSE}}),BR=T(PR.prototype,"_envmapHDR",[Eh,SR,AR],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),NR=T(PR.prototype,"_envmapLDR",[Eh,RR],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),MR=T(PR.prototype,"_diffuseMapHDR",[Eh,bR],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),LR=T(PR.prototype,"_diffuseMapLDR",[Eh,CR],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),FR=T(PR.prototype,"_enabled",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),UR=T(PR.prototype,"_useHDR",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),GR=T(PR.prototype,"_editableMaterial",[Eh,wR],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),kR=T(PR.prototype,"_reflectionHDR",[Eh,IR],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),zR=T(PR.prototype,"_reflectionLDR",[Eh,OR],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),HR=T(PR.prototype,"_rotationAngle",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),xR=PR))||xR));b.SkyboxInfo=jC;var YC=t("FogInfo",(VR=_h("cc.FogInfo"),WR=Mh(),XR=zh(),jR=Mh(),YR=zh(),KR=Mh(),qR=Kh(LC),QR=zh(),ZR=Mh(),JR=Dh(),$R=Kh(Ve),tb=Lh(),eb=Gh(),ib=Mh(),nb=Dh(),rb=Kh(Ve),sb=Gh(),ab=Mh(),ob=Dh(),ub=Kh(Ve),hb=Gh(),lb=Mh(),cb=Dh(),_b=Kh(Ve),fb=Fh(),db=Gh(),pb=Mh(),mb=Dh(),gb=Kh(Ve),vb=Gh(),yb=Mh(),Eb=Dh(),Tb=Kh(Ve),Sb=Gh(),Ab=Mh(),VR((Fb=Lb=function(){function t(){E(this,"_type",Cb,this),E(this,"_fogColor",wb,this),E(this,"_enabled",Ib,this),E(this,"_fogDensity",Ob,this),E(this,"_fogStart",xb,this),E(this,"_fogEnd",Pb,this),E(this,"_fogAtten",Db,this),E(this,"_fogTop",Bb,this),E(this,"_fogRange",Nb,this),E(this,"_accurate",Mb,this),this._resource=null}return t.prototype.activate=function(t){this._resource=t,this._resource.initialize(this),this._resource.activate()},h(t,[{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled!==t&&(this._enabled=t,this._resource&&(this._resource.enabled=t,t&&(this._resource.type=this._type)))}},{key:"accurate",get:function(){return this._accurate},set:function(t){this._accurate!==t&&(this._accurate=t,this._resource&&(this._resource.accurate=t,t&&(this._resource.type=this._type)))}},{key:"fogColor",get:function(){return this._fogColor},set:function(t){this._fogColor.set(t),this._resource&&(this._resource.fogColor=this._fogColor)}},{key:"type",get:function(){return this._type},set:function(t){this._type=t,this._resource&&(this._resource.type=t)}},{key:"fogDensity",get:function(){return this._fogDensity},set:function(t){this._fogDensity=t,this._resource&&(this._resource.fogDensity=t)}},{key:"fogStart",get:function(){return this._fogStart},set:function(t){this._fogStart=t,this._resource&&(this._resource.fogStart=t)}},{key:"fogEnd",get:function(){return this._fogEnd},set:function(t){this._fogEnd=t,this._resource&&(this._resource.fogEnd=t)}},{key:"fogAtten",get:function(){return this._fogAtten},set:function(t){this._fogAtten=t,this._resource&&(this._resource.fogAtten=t)}},{key:"fogTop",get:function(){return this._fogTop},set:function(t){this._fogTop=t,this._resource&&(this._resource.fogTop=t)}},{key:"fogRange",get:function(){return this._fogRange},set:function(t){this._fogRange=t,this._resource&&(this._resource.fogRange=t)}}]),t}(),Lb.FogType=LC,T((bb=Fb).prototype,"enabled",[Ph,WR,XR],Object.getOwnPropertyDescriptor(bb.prototype,"enabled"),bb.prototype),T(bb.prototype,"accurate",[Ph,jR,YR],Object.getOwnPropertyDescriptor(bb.prototype,"accurate"),bb.prototype),T(bb.prototype,"fogColor",[Ph,KR],Object.getOwnPropertyDescriptor(bb.prototype,"fogColor"),bb.prototype),T(bb.prototype,"type",[Ph,qR,QR,ZR],Object.getOwnPropertyDescriptor(bb.prototype,"type"),bb.prototype),T(bb.prototype,"fogDensity",[JR,$R,tb,eb,kh,ib],Object.getOwnPropertyDescriptor(bb.prototype,"fogDensity"),bb.prototype),T(bb.prototype,"fogStart",[nb,rb,sb,ab],Object.getOwnPropertyDescriptor(bb.prototype,"fogStart"),bb.prototype),T(bb.prototype,"fogEnd",[ob,ub,hb,lb],Object.getOwnPropertyDescriptor(bb.prototype,"fogEnd"),bb.prototype),T(bb.prototype,"fogAtten",[cb,_b,fb,db,pb],Object.getOwnPropertyDescriptor(bb.prototype,"fogAtten"),bb.prototype),T(bb.prototype,"fogTop",[mb,gb,vb,yb],Object.getOwnPropertyDescriptor(bb.prototype,"fogTop"),bb.prototype),T(bb.prototype,"fogRange",[Eb,Tb,Sb,Ab],Object.getOwnPropertyDescriptor(bb.prototype,"fogRange"),bb.prototype),Cb=T(bb.prototype,"_type",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return LC.LINEAR}}),wb=T(bb.prototype,"_fogColor",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new Gi("#C8C8C8")}}),Ib=T(bb.prototype,"_enabled",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),Ob=T(bb.prototype,"_fogDensity",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return.3}}),xb=T(bb.prototype,"_fogStart",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return.5}}),Pb=T(bb.prototype,"_fogEnd",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 300}}),Db=T(bb.prototype,"_fogAtten",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 5}}),Bb=T(bb.prototype,"_fogTop",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 1.5}}),Nb=T(bb.prototype,"_fogRange",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 1.2}}),Mb=T(bb.prototype,"_accurate",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),Rb=bb))||Rb)),KC=t("ShadowsInfo",(Ub=_h("cc.ShadowsInfo"),Gb=Mh(),kb=Mh(),zb=Kh(OA),Hb=Mh(),Vb=Dh(),Wb=Mh(),Xb=Dh(),jb=Mh(),Yb=Kh(Ve),Kb=Dh(),qb=Mh(),Qb=Kh(He),Zb=Dh(),Jb=Mh(),$b=Kh(IA),tC=Dh(),Ub((T((iC=function(){function t(){E(this,"_enabled",nC,this),E(this,"_type",rC,this),E(this,"_normal",sC,this),E(this,"_distance",aC,this),E(this,"_shadowColor",oC,this),E(this,"_maxReceived",uC,this),E(this,"_size",hC,this),this._resource=null}var e=t.prototype;return e.setPlaneFromNode=function(t){t.getWorldRotation(VC),this.planeDirection=ji.transformQuat(kC,GC,VC),t.getWorldPosition(kC),this.planeHeight=ji.dot(this._normal,kC)},e.activate=function(t){this._resource=t,this._resource.initialize(this),this._resource.activate()},h(t,[{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled!==t&&(this._enabled=t,this._resource&&(this._resource.enabled=t,t&&(this._resource.type=this._type)))}},{key:"type",get:function(){return this._type},set:function(t){this._type=t,this._resource&&(this._resource.type=t)}},{key:"shadowColor",get:function(){return this._shadowColor},set:function(t){this._shadowColor.set(t),this._resource&&(this._resource.shadowColor=t)}},{key:"planeDirection",get:function(){return this._normal},set:function(t){ji.copy(this._normal,t),this._resource&&(this._resource.normal=t)}},{key:"planeHeight",get:function(){return this._distance},set:function(t){this._distance=t,this._resource&&(this._resource.distance=t)}},{key:"maxReceived",get:function(){return this._maxReceived},set:function(t){this._maxReceived=t,this._resource&&(this._resource.maxReceived=t)}},{key:"shadowMapSize",get:function(){return this._size.x},set:function(t){this._size.set(t,t),this._resource&&(this._resource.size.set(t,t),this._resource.shadowMapDirty=!0)}}]),t}()).prototype,"enabled",[Ph,Gb],Object.getOwnPropertyDescriptor(iC.prototype,"enabled"),iC.prototype),T(iC.prototype,"type",[kb,Ph,zb],Object.getOwnPropertyDescriptor(iC.prototype,"type"),iC.prototype),T(iC.prototype,"shadowColor",[Hb,Vb],Object.getOwnPropertyDescriptor(iC.prototype,"shadowColor"),iC.prototype),T(iC.prototype,"planeDirection",[Wb,Xb],Object.getOwnPropertyDescriptor(iC.prototype,"planeDirection"),iC.prototype),T(iC.prototype,"planeHeight",[jb,Ph,Yb,Kb],Object.getOwnPropertyDescriptor(iC.prototype,"planeHeight"),iC.prototype),T(iC.prototype,"maxReceived",[qb,Qb,Zb],Object.getOwnPropertyDescriptor(iC.prototype,"maxReceived"),iC.prototype),T(iC.prototype,"shadowMapSize",[Jb,$b,tC],Object.getOwnPropertyDescriptor(iC.prototype,"shadowMapSize"),iC.prototype),nC=T(iC.prototype,"_enabled",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),rC=T(iC.prototype,"_type",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return OA.Planar}}),sC=T(iC.prototype,"_normal",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new ji(0,1,0)}}),aC=T(iC.prototype,"_distance",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),oC=T(iC.prototype,"_shadowColor",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new Gi(0,0,0,76)}}),uC=T(iC.prototype,"_maxReceived",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 4}}),hC=T(iC.prototype,"_size",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new _n(1024,1024)}}),eC=iC))||eC));b.ShadowsInfo=KC;var qC=t("DEFAULT_WORLD_MIN_POS",new ji(-1024,-1024,-1024)),QC=t("DEFAULT_WORLD_MAX_POS",new ji(1024,1024,1024)),ZC=t("DEFAULT_OCTREE_DEPTH",8),JC=t("OctreeInfo",(lC=_h("cc.OctreeInfo"),cC=Mh(),_C=Mh(),fC=Nh(),dC=Mh(),pC=Nh(),mC=Lh(),gC=Kh(He),vC=Mh(),lC((T((EC=function(){function t(){E(this,"_enabled",TC,this),E(this,"_minPos",SC,this),E(this,"_maxPos",AC,this),E(this,"_depth",RC,this),this._resource=null}return t.prototype.activate=function(t){this._resource=t,this._resource.initialize(this)},h(t,[{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled!==t&&(this._enabled=t,this._resource&&(this._resource.enabled=t))}},{key:"minPos",get:function(){return this._minPos},set:function(t){this._minPos=t,this._resource&&(this._resource.minPos=t)}},{key:"maxPos",get:function(){return this._maxPos},set:function(t){this._maxPos=t,this._resource&&(this._resource.maxPos=t)}},{key:"depth",get:function(){return this._depth},set:function(t){this._depth=t,this._resource&&(this._resource.depth=t)}}]),t}()).prototype,"enabled",[Ph,cC],Object.getOwnPropertyDescriptor(EC.prototype,"enabled"),EC.prototype),T(EC.prototype,"minPos",[Ph,_C,fC],Object.getOwnPropertyDescriptor(EC.prototype,"minPos"),EC.prototype),T(EC.prototype,"maxPos",[Ph,dC,pC],Object.getOwnPropertyDescriptor(EC.prototype,"maxPos"),EC.prototype),T(EC.prototype,"depth",[Ph,mC,kh,gC,vC],Object.getOwnPropertyDescriptor(EC.prototype,"depth"),EC.prototype),TC=T(EC.prototype,"_enabled",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),SC=T(EC.prototype,"_minPos",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new ji(qC)}}),AC=T(EC.prototype,"_maxPos",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new ji(QC)}}),RC=T(EC.prototype,"_depth",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return ZC}}),yC=EC))||yC)),$C=t("SceneGlobals",(bC=_h("cc.SceneGlobals"),CC=Kh(jC),bC((NC=function(){function t(){E(this,"ambient",OC,this),E(this,"shadows",xC,this),E(this,"_skybox",PC,this),E(this,"fog",DC,this),E(this,"octree",BC,this)}return t.prototype.activate=function(){var t=b.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),b.director.root.onGlobalPipelineStateChanged()},h(t,[{key:"skybox",get:function(){return this._skybox},set:function(t){this._skybox=t}}]),t}(),OC=T((IC=NC).prototype,"ambient",[Eh,Ph],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new XC}}),xC=T(IC.prototype,"shadows",[Eh,Ph],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new KC}}),PC=T(IC.prototype,"_skybox",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new jC}}),DC=T(IC.prototype,"fog",[Ph,Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new YC}}),T(IC.prototype,"skybox",[Ph,CC],Object.getOwnPropertyDescriptor(IC.prototype,"skybox"),IC.prototype),BC=T(IC.prototype,"octree",[Ph,Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new JC}}),wC=IC))||wC));b.SceneGlobals=$C,ft({SystemEventType:{newName:"Input.EventType",since:"3.3.0",removed:!1}}),ft({SystemEvent:{newName:"Input",since:"3.4.0",removed:!1},systemEvent:{newName:"input",since:"3.4.0",removed:!1}});var tw=function(){function t(){this._intervalInMileSeconds=200,this._accelTimer=0,this._eventTarget=new Ba,this._deviceEventName=void 0,this._globalEventClass=void 0,this._didAccelerateFunc=void 0,this._globalEventClass=window.DeviceMotionEvent||window.DeviceOrientationEvent,Ha.browserType===Na.MOBILE_QQ&&(this._globalEventClass=window.DeviceOrientationEvent),this._deviceEventName=this._globalEventClass===window.DeviceMotionEvent?"devicemotion":"deviceorientation",this._didAccelerateFunc=this._didAccelerate.bind(this)}var e=t.prototype;return e._registerEvent=function(){this._accelTimer=performance.now(),window.addEventListener(this._deviceEventName,this._didAccelerateFunc,!1)},e._unregisterEvent=function(){this._accelTimer=0,window.removeEventListener(this._deviceEventName,this._didAccelerateFunc,!1)},e._didAccelerate=function(t){var e=performance.now();if(!(e-this._accelTimer<this._intervalInMileSeconds)){this._accelTimer=e;var i=0,n=0,r=0;if(this._globalEventClass===window.DeviceMotionEvent){var s=t.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=t;i=(a.gamma||0)/90*.981,n=-(a.beta||0)/90*.981,r=(a.alpha||0)/90*.981}if(Xa.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),Ha.os===Fa.ANDROID&&Ha.browserType!==Na.MOBILE_QQ&&(i=-i,n=-n);var h=performance.now(),l=new gA(i,n,r,h),c=new hA(l);this._eventTarget.emit(oA.DEVICEMOTION,c)}},e.start=function(){var t=this;window.DeviceMotionEvent&&"function"==typeof DeviceMotionEvent.requestPermission?DeviceMotionEvent.requestPermission().then((function(e){"granted"===e&&t._registerEvent()})).catch((function(){})):this._registerEvent()},e.stop=function(){this._unregisterEvent()},e.setInterval=function(t){this._intervalInMileSeconds=t},e.on=function(t,e,i){this._eventTarget.on(t,e,i)},t}(),ew=function(){},iw=function(t){function e(){return t.apply(this,arguments)||this}return c(e,t),e.prototype.getValue=function(){throw new Error("Method not implemented.")},e}(ew),nw=function(t){function e(){return t.apply(this,arguments)||this}return c(e,t),e.prototype.getValue=function(){throw new Error("Method not implemented.")},e}(ew),rw=function(t){function e(){return t.apply(this,arguments)||this}return c(e,t),e.prototype.getValue=function(){throw new Error("Method not implemented.")},e}(ew),sw=function(t){function e(){return t.apply(this,arguments)||this}return c(e,t),e.prototype.getValue=function(){throw new Error("Method not implemented.")},e}(ew),aw=function(t){function e(e){var i;return(i=t.call(this)||this).positive=void 0,i.negative=void 0,i.positive=e.positive,i.negative=e.negative,i}return c(e,t),e.prototype.getValue=function(){var t=this.positive.getValue(),e=this.negative.getValue();return Math.abs(t)>Math.abs(e)?t:-e},e}(iw),ow=function(t){function e(e){var i;return(i=t.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=e.up,i.down=e.down,i.left=e.left,i.right=e.right,i.xAxis=new aw({positive:i.right,negative:i.left}),i.yAxis=new aw({positive:i.up,negative:i.down}),i}return c(e,t),e.prototype.getValue=function(){return new _n(this.xAxis.getValue(),this.yAxis.getValue())},e}(nw),uw=(function(t){function e(e){var i;return(i=t.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=e.up,i.down=e.down,i.left=e.left,i.right=e.right,i.forward=e.forward,i.backward=e.backward,i.xAxis=new aw({positive:i.right,negative:i.left}),i.yAxis=new aw({positive:i.up,negative:i.down}),i.zAxis=new aw({positive:i.forward,negative:i.backward}),i}c(e,t),e.prototype.getValue=function(){return new ji(this.xAxis.getValue(),this.yAxis.getValue(),this.zAxis.getValue())}}(rw),function(t){function e(){return t.apply(this,arguments)||this}return c(e,t),e.prototype.getValue=function(){return t.prototype.getValue.call(this)},e}(iw)),hw=function(t){function e(){return t.apply(this,arguments)||this}return c(e,t),e}(ow),lw=function(t){function e(){return t.apply(this,arguments)||this}return c(e,t),e}(ow),cw=function(t){function e(){return t.apply(this,arguments)||this}return c(e,t),e.prototype.getValue=function(){return t.prototype.getValue.call(this)},e}(sw),_w=function(t){function e(){return t.apply(this,arguments)||this}return c(e,t),e.prototype.getValue=function(){return t.prototype.getValue.call(this)},e}(rw),fw=function(){function t(t){this._deviceId=-1,this._connected=!1,this._deviceId=t,this._initInputSource()}t._init=function(){Ha.hasFeature(Ga.EVENT_GAMEPAD)&&t._registerEvent()},t._on=function(e,i,n){t._eventTarget.on(e,i,n)},t._removeInputDevice=function(e){var i=t.all.findIndex((function(t){return t.deviceId===e}));-1!==i&>(t.all,i)},t._getOrCreateInputDevice=function(e,i){var n=t.all.find((function(t){return t.deviceId===e}));return n||(n=new t(e),t.all.push(n)),n._connected=i,n},t._ensureDirectorDefined=function(){return new Promise((function(e){t._intervalId=setInterval((function(){b.director&&b.Director&&(clearInterval(t._intervalId),t._intervalId=-1,e())}),50)}))},t._registerEvent=function(){t._ensureDirectorDefined().then((function(){b.director.on(b.Director.EVENT_BEGIN_FRAME,t._scanGamepads)})).catch((function(){})),window.addEventListener("gamepadconnected",(function(e){t._cachedWebGamepads[e.gamepad.index]=e.gamepad;var i=t._getOrCreateInputDevice(e.gamepad.index,!0);t._eventTarget.emit(oA.GAMEPAD_CHANGE,new pA(oA.GAMEPAD_CHANGE,i))})),window.addEventListener("gamepaddisconnected",(function(e){t._cachedWebGamepads[e.gamepad.index]=null;var i=t._getOrCreateInputDevice(e.gamepad.index,!1);t._removeInputDevice(e.gamepad.index),t._eventTarget.emit(oA.GAMEPAD_CHANGE,new pA(oA.GAMEPAD_CHANGE,i))}))},t._scanGamepads=function(){var e=t._getWebGamePads();if(e){for(var i=[],n=0;n<e.length;++n){var r=null==e?void 0:e[n];if(r){var s=t._cachedWebGamepads[r.index];if(s){for(var a=void 0,o=s.buttons,u=0;u<o.length;++u){var h=o[u],l=r.buttons[u];if(Math.abs(h.value-l.value)>.01){a=t._getOrCreateInputDevice(r.index,!0);break}}if(a){i.push(a);continue}for(var c=s.axes,_=0;_<c.length;++_){var f=c[_],d=r.axes[_];if(Math.abs(f-d)>.01){a=t._getOrCreateInputDevice(r.index,!0);break}}if(a){i.push(a);continue}}}}t._cachedWebGamepads=e;for(var p=0;p<i.length;++p){var m=i[p];t._eventTarget.emit(oA.GAMEPAD_INPUT,new pA(oA.GAMEPAD_INPUT,m))}}},t._getWebGamePads=function(){return"function"==typeof navigator.getGamepads?navigator.getGamepads():"function"==typeof navigator.webkitGetGamepads?navigator.webkitGetGamepads():[]},t._getWebGamepad=function(e){for(var i=t._getWebGamePads(),n=0;n<i.length;++n){var r=i[n];if(r&&r.index===e)return r}};var e=t.prototype;return e._axisToButtons=function(t){var e=Math.abs(t);return t>0?{negative:0,positive:e}:t<0?{negative:e,positive:0}:{negative:0,positive:0}},e._initInputSource=function(){var e=this;this._buttonNorth=new uw,this._buttonNorth.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[3].value:0},this._buttonEast=new uw,this._buttonEast.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[1].value:0},this._buttonWest=new uw,this._buttonWest.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[2].value:0},this._buttonSouth=new uw,this._buttonSouth.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[0].value:0},this._buttonL1=new uw,this._buttonL1.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[4].value:0},this._buttonL2=new uw,this._buttonL2.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[6].value:0},this._buttonL3=new uw,this._buttonL3.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[10].value:0},this._buttonR1=new uw,this._buttonR1.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[5].value:0},this._buttonR2=new uw,this._buttonR2.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[7].value:0},this._buttonR3=new uw,this._buttonR3.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[11].value:0},this._buttonShare=new uw,this._buttonShare.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[8].value:0},this._buttonOptions=new uw,this._buttonOptions.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[9].value:0};var i=new uw;i.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[12].value:0};var n=new uw;n.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[13].value:0};var r=new uw;r.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[14].value:0};var s=new uw;s.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[15].value:0},this._dpad=new hw({up:i,down:n,left:r,right:s});var a=new uw;a.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?e._axisToButtons(i.axes[1]).negative:0};var o=new uw;o.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?e._axisToButtons(i.axes[1]).positive:0};var u=new uw;u.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?e._axisToButtons(i.axes[0]).negative:0};var h=new uw;h.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?e._axisToButtons(i.axes[0]).positive:0},this._leftStick=new lw({up:a,down:o,left:u,right:h});var l=new uw;l.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?e._axisToButtons(i.axes[3]).negative:0};var c=new uw;c.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?e._axisToButtons(i.axes[3]).positive:0};var _=new uw;_.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?e._axisToButtons(i.axes[2]).negative:0};var f=new uw;f.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?e._axisToButtons(i.axes[2]).positive:0},this._rightStick=new lw({up:l,down:c,left:_,right:f}),this._buttonStart=new uw,this._buttonStart.getValue=function(){return 0}},h(t,[{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}}]),t}();fw.all=[],fw._eventTarget=new Ba,fw._cachedWebGamepads=[],fw._intervalId=-1;var dw,pw,mw=function(){function t(){this._eventTarget=new Ba,this._initInputSource()}var e=t.prototype;return e._on=function(t,e,i){this._eventTarget.on(t,e,i)},e._initInputSource=function(){this._buttonNorth=new uw,this._buttonNorth.getValue=function(){return 0},this._buttonEast=new uw,this._buttonEast.getValue=function(){return 0},this._buttonWest=new uw,this._buttonWest.getValue=function(){return 0},this._buttonSouth=new uw,this._buttonSouth.getValue=function(){return 0},this._buttonTriggerLeft=new uw,this._buttonTriggerLeft.getValue=function(){return 0},this._buttonTriggerRight=new uw,this._buttonTriggerRight.getValue=function(){return 0},this._triggerLeft=new uw,this._triggerLeft.getValue=function(){return 0},this._triggerRight=new uw,this._triggerRight.getValue=function(){return 0},this._gripLeft=new uw,this._gripLeft.getValue=function(){return 0},this._gripRight=new uw,this._gripRight.getValue=function(){return 0},this._buttonLeftStick=new uw,this._buttonLeftStick.getValue=function(){return 0};var t=new uw;t.getValue=function(){return 0};var e=new uw;e.getValue=function(){return 0};var i=new uw;i.getValue=function(){return 0};var n=new uw;n.getValue=function(){return 0},this._leftStick=new lw({up:t,down:e,left:i,right:n}),this._buttonRightStick=new uw,this._buttonRightStick.getValue=function(){return 0};var r=new uw;r.getValue=function(){return 0};var s=new uw;s.getValue=function(){return 0};var a=new uw;a.getValue=function(){return 0};var o=new uw;o.getValue=function(){return 0},this._rightStick=new lw({up:r,down:s,left:a,right:o}),this._handLeftPosition=new _w,this._handLeftPosition.getValue=function(){return ji.ZERO},this._handLeftOrientation=new cw,this._handLeftOrientation.getValue=function(){return $i.IDENTITY},this._handRightPosition=new _w,this._handRightPosition.getValue=function(){return ji.ZERO},this._handRightOrientation=new cw,this._handRightOrientation.getValue=function(){return $i.IDENTITY},this._aimLeftPosition=new _w,this._aimLeftPosition.getValue=function(){return ji.ZERO},this._aimLeftOrientation=new cw,this._aimLeftOrientation.getValue=function(){return $i.IDENTITY},this._aimRightPosition=new _w,this._aimRightPosition.getValue=function(){return ji.ZERO},this._aimRightOrientation=new cw,this._aimRightOrientation.getValue=function(){return $i.IDENTITY}},h(t,[{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:"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}}]),t}(),gw=function(){function t(){this._eventTarget=new Ba,this._initInputSource()}var e=t.prototype;return e._on=function(t,e,i){this._eventTarget.on(t,e,i)},e._initInputSource=function(){this._viewLeftPosition=new _w,this._viewLeftPosition.getValue=function(){return ji.ZERO},this._viewLeftOrientation=new cw,this._viewLeftOrientation.getValue=function(){return $i.IDENTITY},this._viewRightPosition=new _w,this._viewRightPosition.getValue=function(){return ji.ZERO},this._viewRightOrientation=new cw,this._viewRightOrientation.getValue=function(){return $i.IDENTITY},this._headMiddlePosition=new _w,this._headMiddlePosition.getValue=function(){return ji.ZERO},this._headMiddleOrientation=new cw,this._headMiddleOrientation.getValue=function(){return $i.IDENTITY}},h(t,[{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}}]),t}(),vw={Backspace:dA.BACKSPACE,Tab:dA.TAB,Enter:dA.ENTER,ShiftLeft:dA.SHIFT_LEFT,ControlLeft:dA.CTRL_LEFT,AltLeft:dA.ALT_LEFT,ShiftRight:dA.SHIFT_RIGHT,ControlRight:dA.CTRL_RIGHT,AltRight:dA.ALT_RIGHT,Pause:dA.PAUSE,CapsLock:dA.CAPS_LOCK,Escape:dA.ESCAPE,Space:dA.SPACE,PageUp:dA.PAGE_UP,PageDown:dA.PAGE_DOWN,End:dA.END,Home:dA.HOME,ArrowLeft:dA.ARROW_LEFT,ArrowUp:dA.ARROW_UP,ArrowRight:dA.ARROW_RIGHT,ArrowDown:dA.ARROW_DOWN,Insert:dA.INSERT,Delete:dA.DELETE,Digit0:dA.DIGIT_0,Digit1:dA.DIGIT_1,Digit2:dA.DIGIT_2,Digit3:dA.DIGIT_3,Digit4:dA.DIGIT_4,Digit5:dA.DIGIT_5,Digit6:dA.DIGIT_6,Digit7:dA.DIGIT_7,Digit8:dA.DIGIT_8,Digit9:dA.DIGIT_9,KeyA:dA.KEY_A,KeyB:dA.KEY_B,KeyC:dA.KEY_C,KeyD:dA.KEY_D,KeyE:dA.KEY_E,KeyF:dA.KEY_F,KeyG:dA.KEY_G,KeyH:dA.KEY_H,KeyI:dA.KEY_I,KeyJ:dA.KEY_J,KeyK:dA.KEY_K,KeyL:dA.KEY_L,KeyM:dA.KEY_M,KeyN:dA.KEY_N,KeyO:dA.KEY_O,KeyP:dA.KEY_P,KeyQ:dA.KEY_Q,KeyR:dA.KEY_R,KeyS:dA.KEY_S,KeyT:dA.KEY_T,KeyU:dA.KEY_U,KeyV:dA.KEY_V,KeyW:dA.KEY_W,KeyX:dA.KEY_X,KeyY:dA.KEY_Y,KeyZ:dA.KEY_Z,Numpad0:dA.NUM_0,Numpad1:dA.NUM_1,Numpad2:dA.NUM_2,Numpad3:dA.NUM_3,Numpad4:dA.NUM_4,Numpad5:dA.NUM_5,Numpad6:dA.NUM_6,Numpad7:dA.NUM_7,Numpad8:dA.NUM_8,Numpad9:dA.NUM_9,NumpadMultiply:dA.NUM_MULTIPLY,NumpadAdd:dA.NUM_PLUS,NumpadSubtract:dA.NUM_SUBTRACT,NumpadDecimal:dA.NUM_DECIMAL,NumpadDivide:dA.NUM_DIVIDE,NumpadEnter:dA.NUM_ENTER,F1:dA.F1,F2:dA.F2,F3:dA.F3,F4:dA.F4,F5:dA.F5,F6:dA.F6,F7:dA.F7,F8:dA.F8,F9:dA.F9,F10:dA.F10,F11:dA.F11,F12:dA.F12,NumLock:dA.NUM_LOCK,ScrollLock:dA.SCROLL_LOCK,Semicolon:dA.SEMICOLON,Equal:dA.EQUAL,Comma:dA.COMMA,Minus:dA.DASH,Period:dA.PERIOD,Slash:dA.SLASH,Backquote:dA.BACK_QUOTE,BracketLeft:dA.BRACKET_LEFT,Backslash:dA.BACKSLASH,BracketRight:dA.BRACKET_RIGHT,Quote:dA.QUOTE},yw=function(){function t(){this._eventTarget=new Ba,this._registerEvent()}var e=t.prototype;return e.dispatchKeyboardDownEvent=function(t){this._handleKeyboardDown(t)},e.dispatchKeyboardUpEvent=function(t){this._handleKeyboardUp(t)},e.on=function(t,e,i){this._eventTarget.on(t,e,i)},e._registerEvent=function(){var t=document.getElementById("GameCanvas");null==t||t.addEventListener("keydown",this._handleKeyboardDown.bind(this)),null==t||t.addEventListener("keyup",this._handleKeyboardUp.bind(this))},e._getInputEvent=function(t,e){var i,n=(i=t.code,vw[i]||dA.NONE);return new lA(n,e)},e._handleKeyboardDown=function(t){if(t.stopPropagation(),t.preventDefault(),t.repeat){var e=this._getInputEvent(t,oA.KEY_PRESSING);this._eventTarget.emit(oA.KEY_PRESSING,e)}else{var i=this._getInputEvent(t,oA.KEY_DOWN);this._eventTarget.emit(oA.KEY_DOWN,i)}},e._handleKeyboardUp=function(t){var e=this._getInputEvent(t,oA.KEY_UP);t.stopPropagation(),t.preventDefault(),this._eventTarget.emit(oA.KEY_UP,e)},t}(),Ew=function(){function t(){this._canvas=void 0,this._eventTarget=new Ba,this._pointLocked=!1,this._isPressed=!1,this._preMousePos=new _n,this._handleMouseDown=void 0,this._handleMouseMove=void 0,this._handleMouseUp=void 0,Ha.hasFeature(Ga.EVENT_MOUSE)&&(this._canvas=document.getElementById("GameCanvas"),this._canvas||console.warn("failed to access canvas"),this._handleMouseDown=this._createCallback(oA.MOUSE_DOWN),this._handleMouseMove=this._createCallback(oA.MOUSE_MOVE),this._handleMouseUp=this._createCallback(oA.MOUSE_UP),this._registerEvent())}var e=t.prototype;return e.dispatchMouseDownEvent=function(t){this._handleMouseDown(t)},e.dispatchMouseMoveEvent=function(t){this._handleMouseMove(t)},e.dispatchMouseUpEvent=function(t){this._handleMouseUp(t)},e.dispatchScrollEvent=function(t){this._handleMouseWheel(t)},e.on=function(t,e,i){this._eventTarget.on(t,e,i)},e._getCanvasRect=function(){var t=this._canvas,e=null==t?void 0:t.getBoundingClientRect();return e?new yn(e.x,e.y,e.width,e.height):new yn(0,0,0,0)},e._getLocation=function(t){var e=this._getCanvasRect(),i=Xa.devicePixelRatio,n=this._pointLocked?this._preMousePos.x/i+t.movementX:t.clientX-e.x,r=this._pointLocked?this._preMousePos.y/i-t.movementY:e.y+e.height-t.clientY;return new _n(n*=i,r*=i)},e._registerEvent=function(){var t,e,i,n,r=this;window.addEventListener("mousedown",(function(){r._isPressed=!0})),null===(t=this._canvas)||void 0===t||t.addEventListener("mousedown",this._handleMouseDown),null===(e=this._canvas)||void 0===e||e.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()},e._registerPointerLockEvent=function(){var t=this,e=function(){var e=t._canvas;document.pointerLockElement===e||document.mozPointerLockElement===e?t._pointLocked=!0:t._pointLocked=!1};"onpointerlockchange"in document?document.addEventListener("pointerlockchange",e,!1):"onmozpointerlockchange"in document&&document.addEventListener("mozpointerlockchange",e,!1)},e._createCallback=function(t){var e=this;return function(i){var n,r=e._getLocation(i),s=i.button,a=i.buttons,o=s;switch(t){case oA.MOUSE_DOWN:null===(n=e._canvas)||void 0===n||n.focus(),e._isPressed=!0;break;case oA.MOUSE_UP:e._isPressed=!1;break;case oA.MOUSE_MOVE:o=1&a?cA.BUTTON_LEFT:2&a?cA.BUTTON_RIGHT:4&a?cA.BUTTON_MIDDLE:cA.BUTTON_MISSING}var u=new cA(t,!1,e._preMousePos);u.setLocation(r.x,r.y),u.setButton(o),u.movementX=i.movementX,u.movementY=i.movementY,e._preMousePos.set(r.x,r.y),i.stopPropagation(),i.target===e._canvas&&i.preventDefault(),e._eventTarget.emit(t,u)}},e._handleMouseWheel=function(t){var e=oA.MOUSE_WHEEL,i=this._getLocation(t),n=t.button,r=new cA(e,!1,this._preMousePos);r.setLocation(i.x,i.y),r.setButton(n),r.movementX=t.movementX,r.movementY=t.movementY,r.setScrollData(5*t.deltaX,5*-t.deltaY),this._preMousePos.set(i.x,i.y),t.stopPropagation(),t.target===this._canvas&&t.preventDefault(),this._eventTarget.emit(e,r)},t}(),Tw=new _n,Sw=new(function(){function t(){this._touchMap=void 0,this._maxTouches=8,this._touchMap=new Map}var e=t.prototype;return e._cloneTouch=function(t){var e=t.getID();t.getStartLocation(Tw);var i=new yA(Tw.x,Tw.y,e);return t.getLocation(Tw),i.setPoint(Tw.x,Tw.y),t.getPreviousLocation(Tw),i.setPrevPoint(Tw),i},e._createTouch=function(t,e,i){if(this._touchMap.has(t))console.log("Cannot create the same touch object.");else{if(!this._checkTouchMapSizeMoreThanMax(t)){var n=new yA(e,i,t);return this._touchMap.set(t,n),this._updateTouch(n,e,i),this._cloneTouch(n)}console.log("The touches is more than MAX_TOUCHES.")}},e.releaseTouch=function(t){this._touchMap.has(t)&&this._touchMap.delete(t)},e.getTouch=function(t,e,i){var n=this._touchMap.get(t);return n?this._updateTouch(n,e,i):n=this._createTouch(t,e,i),n?this._cloneTouch(n):void 0},e.getAllTouches=function(){var t=this,e=[];return this._touchMap.forEach((function(i){if(i){var n=t._cloneTouch(i);e.push(n)}})),e},e._updateTouch=function(t,e,i){t.getLocation(Tw),t.setPrevPoint(Tw),t.setPoint(e,i)},e._checkTouchMapSizeMoreThanMax=function(t){var e=this;if(this._touchMap.has(t))return!1;var i=Ee.ENABLE_MULTI_TOUCH?this._maxTouches:1;if(this._touchMap.size<i)return!1;var n=performance.now();return this._touchMap.forEach((function(t){n-t.lastModified>Ee.TOUCH_TIMEOUT&&(console.log("The touches is more than MAX_TOUCHES, release touch id "+t.getID()+"."),e.releaseTouch(t.getID()))})),i>=this._touchMap.size},t}()),Aw=function(){function t(){this._canvas=void 0,this._eventTarget=new Ba,Ha.hasFeature(Ga.INPUT_TOUCH)&&(this._canvas=document.getElementById("GameCanvas"),this._canvas||console.warn("failed to access canvas"),this._registerEvent())}var e=t.prototype;return e._registerEvent=function(){var t,e,i,n;null===(t=this._canvas)||void 0===t||t.addEventListener("touchstart",this._createCallback(oA.TOUCH_START)),null===(e=this._canvas)||void 0===e||e.addEventListener("touchmove",this._createCallback(oA.TOUCH_MOVE)),null===(i=this._canvas)||void 0===i||i.addEventListener("touchend",this._createCallback(oA.TOUCH_END)),null===(n=this._canvas)||void 0===n||n.addEventListener("touchcancel",this._createCallback(oA.TOUCH_CANCEL))},e._createCallback=function(t){var e=this;return function(i){for(var n,r=e._getCanvasRect(),s=[],a=i.changedTouches.length,o=0;o<a;++o){var u=i.changedTouches[o],h=u.identifier;if(null!==h){var l=e._getLocation(u,r),c=Sw.getTouch(h,l.x,l.y);c&&(t!==oA.TOUCH_END&&t!==oA.TOUCH_CANCEL||Sw.releaseTouch(h),s.push(c))}}if(i.stopPropagation(),i.target===e._canvas&&i.preventDefault(),t===oA.TOUCH_START&&(null===(n=e._canvas)||void 0===n||n.focus()),s.length>0){var _=new fA(s,!1,t,Ee.ENABLE_MULTI_TOUCH?Sw.getAllTouches():s);e._eventTarget.emit(t,_)}}},e._getCanvasRect=function(){var t=this._canvas,e=null==t?void 0:t.getBoundingClientRect();return e?new yn(e.x,e.y,e.width,e.height):new yn(0,0,0,0)},e._getLocation=function(t,e){var i=t.clientX-e.x,n=e.y+e.height-t.clientY;if(Xa.isFrameRotated){var r=i;i=e.height-n,n=r}var s=Xa.devicePixelRatio;return new _n(i*=s,n*=s)},e.on=function(t,e,i){this._eventTarget.on(t,e,i)},t}();!function(t){t[t.GLOBAL=0]="GLOBAL",t[t.UI=1]="UI"}(pw||(pw={}));var Rw=function(){function t(t){this.priority=pw.GLOBAL,this._inputEventTarget=void 0,this._inputEventTarget=t}return t.prototype.dispatchEvent=function(t){return this._inputEventTarget.emit(t.type,t),!0},t}(),bw=((dw={})[oA.MOUSE_DOWN]=oA.TOUCH_START,dw[oA.MOUSE_MOVE]=oA.TOUCH_MOVE,dw[oA.MOUSE_UP]=oA.TOUCH_END,dw),Cw=t("Input",function(){function t(){this._dispatchImmediately=!0,this._eventTarget=new Ba,this._touchInput=new Aw,this._mouseInput=new Ew,this._keyboardInput=new yw,this._accelerometerInput=new tw,this._handleInput=new mw,this._hmdInput=new gw,this._eventTouchList=[],this._eventMouseList=[],this._eventKeyboardList=[],this._eventAccelerationList=[],this._eventGamepadList=[],this._eventHandleList=[],this._eventHMDList=[],this._needSimulateTouchMoveEvent=!1,this._inputEventDispatcher=void 0,this._eventDispatcherList=[],this._registerEvent(),this._inputEventDispatcher=new Rw(this._eventTarget),this._registerEventDispatcher(this._inputEventDispatcher),fw._init()}var e=t.prototype;return e._dispatchMouseDownEvent=function(t){var e,i;null===(e=(i=this._mouseInput).dispatchMouseDownEvent)||void 0===e||e.call(i,t)},e._dispatchMouseMoveEvent=function(t){var e,i;null===(e=(i=this._mouseInput).dispatchMouseMoveEvent)||void 0===e||e.call(i,t)},e._dispatchMouseUpEvent=function(t){var e,i;null===(e=(i=this._mouseInput).dispatchMouseUpEvent)||void 0===e||e.call(i,t)},e._dispatchMouseScrollEvent=function(t){var e,i;null===(e=(i=this._mouseInput).dispatchScrollEvent)||void 0===e||e.call(i,t)},e._dispatchKeyboardDownEvent=function(t){var e,i;null===(e=(i=this._keyboardInput).dispatchKeyboardDownEvent)||void 0===e||e.call(i,t)},e._dispatchKeyboardUpEvent=function(t){var e,i;null===(e=(i=this._keyboardInput).dispatchKeyboardUpEvent)||void 0===e||e.call(i,t)},e.on=function(t,e,i){return this._eventTarget.on(t,e,i),e},e.once=function(t,e,i){return this._eventTarget.once(t,e,i),e},e.off=function(t,e,i){this._eventTarget.off(t,e,i)},e.setAccelerometerEnabled=function(t){t?this._accelerometerInput.start():this._accelerometerInput.stop()},e.setAccelerometerInterval=function(t){this._accelerometerInput.setInterval(t)},e._simulateEventTouch=function(t){var e=bw[t.type],i=Sw.getTouch(0,t.getLocationX(),t.getLocationY());if(i){var n=[i],r=new fA(n,!1,e,e===oA.TOUCH_END?[]:n);e===oA.TOUCH_END&&Sw.releaseTouch(0),this._dispatchOrPushEventTouch(r,this._eventTouchList)}},e._registerEventDispatcher=function(t){this._eventDispatcherList.push(t),this._eventDispatcherList.sort((function(t,e){return e.priority-t.priority}))},e._emitEvent=function(t){for(var e=this._eventDispatcherList.length,i=0;i<e&&this._eventDispatcherList[i].dispatchEvent(t);++i);},e._registerEvent=function(){var t=this;if(Qa.hasFeature(Qa.Feature.INPUT_TOUCH)){var e=this._eventTouchList;this._touchInput.on(oA.TOUCH_START,(function(i){t._dispatchOrPushEventTouch(i,e)})),this._touchInput.on(oA.TOUCH_MOVE,(function(i){t._dispatchOrPushEventTouch(i,e)})),this._touchInput.on(oA.TOUCH_END,(function(i){t._dispatchOrPushEventTouch(i,e)})),this._touchInput.on(oA.TOUCH_CANCEL,(function(i){t._dispatchOrPushEventTouch(i,e)}))}if(Qa.hasFeature(Qa.Feature.EVENT_MOUSE)){var i=this._eventMouseList;this._mouseInput.on(oA.MOUSE_DOWN,(function(e){t._needSimulateTouchMoveEvent=!0,t._simulateEventTouch(e),t._dispatchOrPushEvent(e,i)})),this._mouseInput.on(oA.MOUSE_MOVE,(function(e){t._needSimulateTouchMoveEvent&&t._simulateEventTouch(e),t._dispatchOrPushEvent(e,i)})),this._mouseInput.on(oA.MOUSE_UP,(function(e){t._needSimulateTouchMoveEvent=!1,t._simulateEventTouch(e),t._dispatchOrPushEvent(e,i)})),this._mouseInput.on(oA.MOUSE_WHEEL,(function(e){t._dispatchOrPushEvent(e,i)}))}if(Qa.hasFeature(Qa.Feature.EVENT_KEYBOARD)){var n=this._eventKeyboardList;this._keyboardInput.on(oA.KEY_DOWN,(function(e){t._dispatchOrPushEvent(e,n)})),this._keyboardInput.on(oA.KEY_PRESSING,(function(e){t._dispatchOrPushEvent(e,n)})),this._keyboardInput.on(oA.KEY_UP,(function(e){t._dispatchOrPushEvent(e,n)}))}if(Qa.hasFeature(Qa.Feature.EVENT_ACCELEROMETER)){var r=this._eventAccelerationList;this._accelerometerInput.on(oA.DEVICEMOTION,(function(e){t._dispatchOrPushEvent(e,r)}))}if(Qa.hasFeature(Qa.Feature.EVENT_GAMEPAD)){var s=this._eventGamepadList;fw._on(oA.GAMEPAD_CHANGE,(function(e){t._dispatchOrPushEvent(e,s)})),fw._on(oA.GAMEPAD_INPUT,(function(e){t._dispatchOrPushEvent(e,s)}))}if(Qa.hasFeature(Qa.Feature.EVENT_HANDLE)){var a=this._eventHandleList;this._handleInput._on(oA.HANDLE_INPUT,(function(e){t._dispatchOrPushEvent(e,a)})),this._handleInput._on(oA.HANDLE_POSE_INPUT,(function(e){t._dispatchOrPushEvent(e,a)}))}if(Qa.hasFeature(Qa.Feature.EVENT_HMD)){var o=this._eventHMDList;this._hmdInput._on(oA.HMD_POSE_INPUT,(function(e){t._dispatchOrPushEvent(e,o)}))}},e._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},e._dispatchOrPushEvent=function(t,e){this._dispatchImmediately?this._emitEvent(t):e.push(t)},e._dispatchOrPushEventTouch=function(t,e){if(this._dispatchImmediately)for(var i=t.getTouches(),n=i.length,r=0;r<n;++r)t.touch=i[r],t.propagationStopped=t.propagationImmediateStopped=!1,this._emitEvent(t);else e.push(t)},e._frameDispatchEvents=function(){for(var t=this._eventMouseList,e=0,i=t.length;e<i;++e){var n=t[e];this._emitEvent(n)}for(var r=this._eventTouchList,s=0,a=r.length;s<a;++s)for(var o=r[s],u=o.getTouches(),h=u.length,l=0;l<h;++l)o.touch=u[l],o.propagationStopped=o.propagationImmediateStopped=!1,this._emitEvent(o);for(var c=this._eventKeyboardList,_=0,f=c.length;_<f;++_){var d=c[_];this._emitEvent(d)}for(var p=this._eventAccelerationList,m=0,g=p.length;m<g;++m){var v=p[m];this._emitEvent(v)}for(var y=this._eventGamepadList,E=0,T=y.length;E<T;++E){var S=y[E];this._emitEvent(S)}for(var A=this._eventHandleList,R=0,b=A.length;R<b;++R){var C=A[R];this._emitEvent(C)}for(var w=this._eventHMDList,I=0,O=w.length;I<O;++I){var x=w[I];this._emitEvent(x)}this._clearEvents()},t}());Cw.EventType=oA;var ww=t("input",new Cw),Iw=t("SystemEvent",function(t){function e(){var e;return e=t.call(this)||this,ww.on(oA.MOUSE_DOWN,(function(t){e.emit(aA.MOUSE_DOWN,t)})),ww.on(oA.MOUSE_MOVE,(function(t){e.emit(aA.MOUSE_MOVE,t)})),ww.on(oA.MOUSE_UP,(function(t){e.emit(aA.MOUSE_UP,t)})),ww.on(oA.MOUSE_WHEEL,(function(t){e.emit(aA.MOUSE_WHEEL,t)})),ww.on(oA.TOUCH_START,(function(t){e.emit(aA.TOUCH_START,t.touch,t)})),ww.on(oA.TOUCH_MOVE,(function(t){e.emit(aA.TOUCH_MOVE,t.touch,t)})),ww.on(oA.TOUCH_END,(function(t){e.emit(aA.TOUCH_END,t.touch,t)})),ww.on(oA.TOUCH_CANCEL,(function(t){e.emit(aA.TOUCH_CANCEL,t.touch,t)})),ww.on(oA.KEY_DOWN,(function(t){e.emit(aA.KEY_DOWN,t)})),ww.on(oA.KEY_PRESSING,(function(t){e.emit(aA.KEY_DOWN,t)})),ww.on(oA.KEY_UP,(function(t){e.emit(aA.KEY_UP,t)})),ww.on(oA.DEVICEMOTION,(function(t){e.emit(aA.DEVICEMOTION,t)})),e}c(e,t);var i=e.prototype;return i.setAccelerometerEnabled=function(t){ww.setAccelerometerEnabled(t)},i.setAccelerometerInterval=function(t){ww.setAccelerometerInterval(t)},i.on=function(e,i,n,r){return t.prototype.on.call(this,e,i,n,r),i},i.off=function(e,i,n){t.prototype.off.call(this,e,i,n)},e}(Ba));Iw.EventType=aA,b.SystemEvent=Iw;var Ow,xw=t("systemEvent",new Iw);b.systemEvent=xw,et(aA,"Node.EventType",[{name:"POSITION_PART",newName:"TRANSFORM_CHANGED"},{name:"ROTATION_PART",newName:"TRANSFORM_CHANGED"},{name:"SCALE_PART",newName:"TRANSFORM_CHANGED"}]),et(uA,"Event",[{name:"ACCELERATION",newName:"DEVICEMOTION",target:Iw.EventType,targetName:"SystemEvent.EventType"}]),nt(uA,"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"}]),et(cA,"EventMouse",["DOWN","UP","MOVE"].map((function(t){return{name:t,newName:"MOUSE_"+t,target:Iw.EventType,targetName:"SystemEvent.EventType"}}))),et(cA,"EventMouse",[{name:"SCROLL",newName:"MOUSE_WHEEL",target:Iw.EventType,targetName:"SystemEvent.EventType"}]),nt(cA.prototype,"EventMouse.prototype",[{name:"eventType",suggest:"please use EventMouse.prototype.type instead"}]),et(fA,"EventTouch",[{name:"BEGAN",newName:"TOUCH_START",target:Iw.EventType,targetName:"SystemEvent.EventType"}]),et(fA,"EventTouch",[{name:"MOVED",newName:"TOUCH_MOVE",target:Iw.EventType,targetName:"SystemEvent.EventType"}]),et(fA,"EventTouch",[{name:"ENDED",newName:"TOUCH_END",target:Iw.EventType,targetName:"SystemEvent.EventType"}]),et(fA,"EventTouch",[{name:"CANCELLED",newName:"TOUCH_CANCEL",target:Iw.EventType,targetName:"SystemEvent.EventType"}]),nt(fA.prototype,"EventTouch.prototype",[{name:"getEventCode",suggest:"please use EventTouch.prototype.type instead"}]),et(fA.prototype,"EventTouch.prototype",[{name:"getUILocationInView",newName:"getLocationInView",target:fA,targetName:"EventTouch"}]),nt(Ee.KEY,"macro.KEY",["back","menu","0","1","2","3","4","5","6","7","8","9","0","*","+","-","/",";","=",",",".","[","]","dpadLeft","dpadRight","dpadUp","dpadDown","dpadCenter"].map((function(t){return{name:t}}))),nt(Ee.KEY,"macro.KEY",[{name:"shift",suggest:"please use KeyCode.SHIFT_LEFT instead"}]),nt(Ee.KEY,"macro.KEY",[{name:"ctrl",suggest:"please use KeyCode.CTRL_LEFT instead"}]),nt(Ee.KEY,"macro.KEY",[{name:"alt",suggest:"please use KeyCode.ALT_LEFT instead"}]),nt(Ee,"macro",[{name:"KEY",suggest:"please use KeyCode instead"}]),et(ME.prototype,"BaseNode",[{name:"childrenCount",newName:"children.length",customGetter:function(){return this.children.length}}]),et(jE.prototype,"Node",[{name:"width",targetName:"node.getComponent(UITransform)",customGetter:function(){return this._uiProps.uiTransformComp.width},customSetter:function(t){this._uiProps.uiTransformComp.width=t}},{name:"height",targetName:"node.getComponent(UITransform)",customGetter:function(){return this._uiProps.uiTransformComp.height},customSetter:function(t){this._uiProps.uiTransformComp.height=t}},{name:"anchorX",targetName:"node.getComponent(UITransform)",customGetter:function(){return this._uiProps.uiTransformComp.anchorX},customSetter:function(t){this._uiProps.uiTransformComp.anchorX=t}},{name:"anchorY",targetName:"node.getComponent(UITransform)",customGetter:function(){return this._uiProps.uiTransformComp.anchorY},customSetter:function(t){this._uiProps.uiTransformComp.anchorY=t}},{name:"getAnchorPoint",targetName:"node.getComponent(UITransform)",customFunction:function(t){return t||(t=new _n),t.set(this._uiProps.uiTransformComp.anchorPoint),t}},{name:"setAnchorPoint",targetName:"node.getComponent(UITransform)",customFunction:function(t,e){this._uiProps.uiTransformComp.setAnchorPoint(t,e)}},{name:"getContentSize",targetName:"node.getComponent(UITransform)",customFunction:function(t){return t||(t=new gn),t.set(this._uiProps.uiTransformComp.contentSize),t}},{name:"setContentSize",targetName:"node.getComponent(UITransform)",customFunction:function(t,e){"number"==typeof t?this._uiProps.uiTransformComp.setContentSize(t,e):this._uiProps.uiTransformComp.setContentSize(t)}}]),it($C.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"}]),et($C.prototype,"SceneGlobals.prototype",[{name:"distance",newName:"planeHeight"},{name:"normal",newName:"planeDirection"},{name:"size",newName:"shadowMapSize"}]),it(jE.prototype,"Node.prototype",[{name:"addLayer"},{name:"removeLayer"}]),et(mE.prototype,"NodeUIProperties",[{name:"opacityDirty",newName:"colorDirty"}]),it(Jd,"Layers",[{name:"All"},{name:"RaycastMask"},{name:"check"}]),et(Jd,"Layers",[{name:"Default",newName:"DEFAULT",target:Jd.Enum,targetName:"Layers.Enum"},{name:"Always",newName:"ALWAYS",target:Jd.Enum,targetName:"Layers.Enum"},{name:"IgnoreRaycast",newName:"IGNORE_RAYCAST",target:Jd.Enum,targetName:"Layers.Enum"},{name:"Gizmos",newName:"GIZMOS",target:Jd.Enum,targetName:"Layers.Enum"},{name:"Editor",newName:"EDITOR",target:Jd.Enum,targetName:"Layers.Enum"},{name:"UI",newName:"UI_3D",target:Jd.Enum,targetName:"Layers.Enum"},{name:"UI2D",newName:"UI_2D",target:Jd.Enum,targetName:"Layers.Enum"},{name:"SceneGizmo",newName:"SCENE_GIZMO",target:Jd.Enum,targetName:"Layers.Enum"},{name:"makeInclusiveMask",newName:"makeMaskInclude",target:Jd,targetName:"Layers"},{name:"makeExclusiveMask",newName:"makeMaskExclude",target:Jd,targetName:"Layers"}]),it(Jd.Enum,"Layers.Enum",[{name:"ALWAYS"}]),it(Jd.BitMask,"Layers.BitMask",[{name:"ALWAYS"}]);var Pw,Dw,Bw,Nw,Mw=Ta.Flags.HideInHierarchy,Lw=Ta.Flags.DontSave,Fw=t("PrivateNode",_h("cc.PrivateNode")(Ow=function(t){function e(e){var i;return j(12003,(i=t.call(this,e)||this).name),i.hideFlags|=Lw|Mw,i}return c(e,t),e}(jE))||Ow);function Uw(t){var e=t._prefab;if(e&&e.instance){if(!e.asset)return K(3701,t.name),void(e.instance=void 0);var i=t._objFlags,n=t._parent,r=t._id,s=t._prefab;t[va],b.game._isCloning=!0,e.asset._doInstantiate(t),b.game._isCloning=!1,t._objFlags=i,t._parent=n,t._id=r,t._prefab&&(t._prefab.instance=null==s?void 0:s.instance)}}function Gw(t,e,i){var n;if(e&&t){var r=e,s=null===(n=t._prefab)||void 0===n?void 0:n.instance;!i&&s&&(e[s.fileId]={},r=e[s.fileId]);var a=t._prefab;a&&(r[a.fileId]=t);for(var o=t.components,u=0;u<o.length;u++){var h=o[u];h.__prefab&&(r[h.__prefab.fileId]=h)}for(var l=0;l<t.children.length;l++)Gw(t.children[l],r,!1)}}function kw(t,e){if(!t)return null;for(var i=e,n=0;n<t.length;n++){if(!i)return null;i=i[t[n]]}return i}function zw(t,e,i){if(e)for(var n=0;n<e.length;n++){var r=e[n];if(r&&r.targetInfo){var s=kw(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 l=r.nodes[h];l&&!s._children.includes(l)&&(s._children.push(l),l._parent=s,Gw(l,a,!1),l._siblingIndex=s._children.length-1,jw(l,!0))}}}}function Hw(t,e,i){if(e)for(var n=0;n<e.length;n++){var r=e[n];if(r&&r.targetInfo){var s=kw(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 Vw(t,e,i){if(e)for(var n=0;n<e.length;n++){var r=e[n];if(r){var s=kw(r.localID,i);if(!s||!s.node)continue;var a=s.node.components.indexOf(s);a>=0&&s.node._components.splice(a,1)}}}function Ww(t,e,i){if(!(e.length<=0))for(var n=null,r=0;r<e.length;r++){var s=e[r];if(s&&s.targetInfo){if(!(n=kw(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 l=Number.parseInt(u);Number.isInteger(l)&&l<a.length&&(a[u]=s.value)}else a[u]instanceof ge?a[u].set(s.value):a[u]=s.value}}}}function Xw(t){var e,i=null===(e=t._prefab)||void 0===e?void 0:e.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,l,c=null===(h=a.source)||void 0===h||null===(l=h._prefab)||void 0===l?void 0:l.instance;c&&c.targetMap&&(o=kw(u.localID,c.targetMap))}if(o){var _,f=a.targetInfo;if(f){var d=null===(r=a.target)||void 0===r||null===(s=r._prefab)||void 0===s?void 0:s.instance;if(d&&d.targetMap&&(_=kw(f.localID,d.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 jw(t,e){void 0===e&&(e=!1);var i=t._prefab,n=null==i?void 0:i.instance;if(n&&!n.expanded){Uw(t),e&&t&&t.children&&t.children.forEach((function(t){jw(t,!0)}));var r={};n.targetMap=r,Gw(t,r,!0),zw(0,n.mountedChildren,r),Vw(0,n.removedComponents,r),Hw(0,n.mountedComponents,r),Ww(0,n.propertyOverrides,r),n.expanded=!0}else e&&t&&t.children&&t.children.forEach((function(t){jw(t,!0)}))}function Yw(t){var e=t._prefab;e&&e.nestedPrefabInstanceRoots&&e.nestedPrefabInstanceRoots.forEach((function(t){jw(t)}))}et(aA,"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(t){return{name:t,target:jE.EventType,targetName:"Node.EventType"}}))),et(jE.EventType,"Node.EventType",[{name:"DEVICEMOTION",target:Iw.EventType,targetName:"SystemEvent.EventType"},{name:"KEY_DOWN",target:Iw.EventType,targetName:"SystemEvent.EventType"},{name:"KEY_UP",target:Iw.EventType,targetName:"SystemEvent.EventType"}]),b.PrivateNode=Fw;var Kw=t("Scene",_h("cc.Scene")((T((Dw=function(t){c(i,t);var e=i.prototype;function i(e){var i;return E(i=t.call(this,e)||this,"autoReleaseAssets",Bw,g(i)),E(i,"_globals",Nw,g(i)),i.dependAssets=null,i._renderScene=null,i._inited=void 0,i._prefabSyncedInLiveReload=!1,i._pos=ji.ZERO,i._rot=$i.IDENTITY,i._scale=ji.ONE,i._mat=un.IDENTITY,i._dirtyFlags=0,i._lpos=ji.ZERO,i._lrot=$i.IDENTITY,i._lscale=ji.ONE,i._activeInHierarchy=!1,b.director&&b.director.root&&(i._renderScene=b.director.root.createScene({})),i._inited=!b.game||!b.game._isCloning,i}return e._updateScene=function(){this._scene=this},e.destroy=function(){var t=Ta.prototype.destroy.call(this);if(t)for(var e=this._children,i=0;i<e.length;++i)e[i].active=!1;return this._renderScene&&b.director.root.destroyScene(this._renderScene),this._active=!1,this._activeInHierarchy=!1,t},e.addComponent=function(){throw new Error(J(3822))},e._onHierarchyChanged=function(){},e._onBatchCreated=function(e){t.prototype._onBatchCreated.call(this,e);for(var i=this._children.length,n=0;n<i;++n)this._children[n]._siblingIndex=n,this._children[n]._onBatchCreated(e)},e.getPosition=function(t){return ji.copy(t||new ji,ji.ZERO)},e.getRotation=function(t){return $i.copy(t||new $i,$i.IDENTITY)},e.getScale=function(t){return ji.copy(t||new ji,ji.ONE)},e.getWorldPosition=function(t){return ji.copy(t||new ji,ji.ZERO)},e.getWorldRotation=function(t){return $i.copy(t||new $i,$i.IDENTITY)},e.getWorldScale=function(t){return ji.copy(t||new ji,ji.ONE)},e.getWorldMatrix=function(t){return un.copy(t||new un,un.IDENTITY)},e.getWorldRS=function(t){return un.copy(t||new un,un.IDENTITY)},e.getWorldRT=function(t){return un.copy(t||new un,un.IDENTITY)},e.updateWorldTransform=function(){},e._instantiate=function(){},e._load=function(){this._inited||(Yw(this),Xw(this),this._onBatchCreated(A),this._inited=!0),this.walk(ME._setScene)},e._activate=function(t){t=!1!==t,b.director._nodeActivator.activateNode(this,t),this._globals.activate()},h(i,[{key:"renderScene",get:function(){return this._renderScene}},{key:"globals",get:function(){return this._globals}},{key:"position",get:function(){return ji.ZERO}},{key:"worldPosition",get:function(){return ji.ZERO}},{key:"rotation",get:function(){return $i.IDENTITY}},{key:"worldRotation",get:function(){return $i.IDENTITY}},{key:"scale",get:function(){return ji.ONE}},{key:"worldScale",get:function(){return ji.ONE}},{key:"eulerAngles",get:function(){return ji.ZERO}},{key:"worldMatrix",get:function(){return un.IDENTITY}}]),i}(ME)).prototype,"globals",[Ph],Object.getOwnPropertyDescriptor(Dw.prototype,"globals"),Dw.prototype),Bw=T(Dw.prototype,"autoReleaseAssets",[Eh,Ph],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),Nw=T(Dw.prototype,"_globals",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new $C}}),Pw=Dw))||Pw);function qw(t,e){if(!e){var i=b.director.getScene();if(!i)return null;e=i}return e.getChildByPath(t)}b.Scene=Kw,b.find=qw;var Qw=he.fastRemoveAt,Zw=Ta.Flags.IsStartCalled,Jw=Ta.Flags.IsOnEnableCalled;function $w(t,e){for(var i=e.constructor._executionOrder,n=e._id,r=0,s=t.length-1,a=s>>>1;r<=s;a=r+s>>>1){var o=t[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 tI(t,e){for(var i=t.array,n=t.i+1;n<i.length;){var r=i[n];r.node._activeInHierarchy?++n:(t.removeAt(n),e&&(r._objFlags&=~e))}}Ta.Flags.IsEditorOnEnableCalled;var eI=function(t){this._zero=void 0,this._neg=void 0,this._pos=void 0,this._invoke=void 0;var e=pt;this._zero=new e([]),this._neg=new e([]),this._pos=new e([]),this._invoke=t};function iI(t,e){return t.constructor._executionOrder-e.constructor._executionOrder}eI.stableRemoveInactive=tI;var nI=function(t){function e(){return t.apply(this,arguments)||this}c(e,t);var i=e.prototype;return i.add=function(t){var e=t.constructor._executionOrder;(0===e?this._zero:e<0?this._neg:this._pos).array.push(t)},i.remove=function(t){var e=t.constructor._executionOrder;(0===e?this._zero:e<0?this._neg:this._pos).fastRemove(t)},i.cancelInactive=function(t){tI(this._zero,t),tI(this._neg,t),tI(this._pos,t)},i.invoke=function(){var t=this._neg;t.array.length>0&&(t.array.sort(iI),this._invoke(t),t.array.length=0),this._invoke(this._zero),this._zero.array.length=0;var e=this._pos;e.array.length>0&&(e.array.sort(iI),this._invoke(e),e.array.length=0)},e}(eI),rI=function(t){function e(){return t.apply(this,arguments)||this}c(e,t);var i=e.prototype;return i.add=function(t){var e=t.constructor._executionOrder;if(0===e)this._zero.array.push(t);else{var i=e<0?this._neg.array:this._pos.array,n=$w(i,t);n<0&&i.splice(~n,0,t)}},i.remove=function(t){var e=t.constructor._executionOrder;if(0===e)this._zero.fastRemove(t);else{var i=e<0?this._neg:this._pos,n=$w(i.array,t);n>=0&&i.removeAt(n)}},i.invoke=function(t){this._neg.array.length>0&&this._invoke(this._neg,t),this._invoke(this._zero,t),this._pos.array.length>0&&this._invoke(this._pos,t)},e}(eI);function sI(t,e,i){var n="var a=it.array;for(it.i=0;it.i<a.length;++it.i){var c=a[it.i];"+t+"}",r=e?Function("it","dt",n):Function("it",n);return function(t,e,i){return function(n,r){try{e(n,r)}catch(e){b._throw(e);var s=n.array;for(i&&(s[n.i]._objFlags|=i),++n.i;n.i<s.length;++n.i)try{t(s[n.i],r)}catch(t){b._throw(t),i&&(s[n.i]._objFlags|=i)}}}}(Function("c","dt",t),r,i)}var aI=sI("c.start();c._objFlags|="+Zw,!1,Zw),oI=sI("c.update(dt)",!0),uI=sI("c.lateUpdate(dt)",!0),hI=function(t){var e=b.director._compScheduler,i=t.array;for(t.i=0;t.i<i.length;++t.i){var n=i[t.i];n._enabled&&(n.onEnable(),!n.node._activeInHierarchy||e._onEnabled(n))}},lI=function(){function t(){this._deferredComps=[],this.unscheduleAll()}var e=t.prototype;return e.unscheduleAll=function(){this.startInvoker=new nI(aI),this.updateInvoker=new rI(oI),this.lateUpdateInvoker=new rI(uI),this._updating=!1},e._onEnabled=function(t){b.director.getScheduler().resumeTarget(t),t._objFlags|=Jw,this._updating?this._deferredComps.push(t):this._scheduleImmediate(t)},e._onDisabled=function(t){b.director.getScheduler().pauseTarget(t),t._objFlags&=~Jw;var e=this._deferredComps.indexOf(t);e>=0?Qw(this._deferredComps,e):(!t.start||t._objFlags&Zw||this.startInvoker.remove(t),t.update&&this.updateInvoker.remove(t),t.lateUpdate&&this.lateUpdateInvoker.remove(t))},e.enableComp=function(t,e){if(!(t._objFlags&Jw)){if(t.onEnable){if(e)return void e.add(t);if(t.onEnable(),!t.node._activeInHierarchy)return}this._onEnabled(t)}},e.disableComp=function(t){t._objFlags&Jw&&(t.onDisable&&t.onDisable(),this._onDisabled(t))},e.startPhase=function(){this._updating=!0,this.startInvoker.invoke(),this._startForNewComps()},e.updatePhase=function(t){this.updateInvoker.invoke(t)},e.lateUpdatePhase=function(t){this.lateUpdateInvoker.invoke(t),this._updating=!1,this._startForNewComps()},e._startForNewComps=function(){this._deferredComps.length>0&&(this._deferredSchedule(),this.startInvoker.invoke())},e._scheduleImmediate=function(t){"function"!=typeof t.start||t._objFlags&Zw||this.startInvoker.add(t),"function"==typeof t.update&&this.updateInvoker.add(t),"function"==typeof t.lateUpdate&&this.lateUpdateInvoker.add(t)},e._deferredSchedule=function(){for(var t=this._deferredComps,e=0,i=t.length;e<i;e++)this._scheduleImmediate(t[e]);t.length=0},t}(),cI=Ta.Flags.IsPreloadStarted,_I=Ta.Flags.IsOnLoadStarted,fI=Ta.Flags.IsOnLoadCalled,dI=Ta.Flags.Deactivating,pI=function(t){function e(){return t.apply(this,arguments)||this}c(e,t);var i=e.prototype;return i.add=function(t){this._zero.array.push(t)},i.remove=function(t){this._zero.fastRemove(t)},i.cancelInactive=function(t){eI.stableRemoveInactive(this._zero,t)},i.invoke=function(){this._invoke(this._zero),this._zero.array.length=0},e}(eI),mI=sI("c.__preload();"),gI=sI("c.onLoad();c._objFlags|="+fI,!1,fI),vI=new ue(4);function yI(t,e,i){K(3817,t.name,i),console.log("Corrupted component value:",e),e?t._removeComponent(e):he.removeAt(t._components,i)}vI.get=function(){var t=this._get()||{preload:new pI(mI),onLoad:new nI(gI),onEnable:new nI(hI)};t.preload._zero.i=-1;var e=t.onLoad;return e._zero.i=-1,e._neg.i=-1,e._pos.i=-1,(e=t.onEnable)._zero.i=-1,e._neg.i=-1,e._pos.i=-1,t};var EI,TI,SI,AI,RI,bI,CI,wI,II,OI,xI,PI,DI,BI,NI,MI,LI,FI,UI,GI,kI,zI,HI,VI,WI,XI,jI,YI,KI,qI,QI,ZI,JI,$I,tO,eO,iO,nO,rO,sO,aO,oO,uO,hO,lO,cO,_O,fO,dO,pO,mO,gO,vO,yO,EO,TO,SO,AO,RO,bO,CO,wO,IO,OO,xO,PO,DO,BO,NO,MO=t("NodeActivator",function(){function t(){this.resetComp=void 0,this.reset()}var e=t.prototype;return e.reset=function(){this._activatingStack=[]},e.activateNode=function(t,e){if(e){var i=vI.get();this._activatingStack.push(i),this._activateNodeRecursively(t,i.preload,i.onLoad,i.onEnable),i.preload.invoke(),i.onLoad.invoke(),i.onEnable.invoke(),this._activatingStack.pop(),vI.put(i)}else{this._deactivateNodeRecursively(t);for(var n,r=y(this._activatingStack);!(n=r()).done;){var s=n.value;s.preload.cancelInactive(cI),s.onLoad.cancelInactive(_I),s.onEnable.cancelInactive()}}t.emit(aE.ACTIVE_IN_HIERARCHY_CHANGED,t)},e.activateComp=function(t,e,i,n){if(Ra(t,!0)&&(t._objFlags&cI||(t._objFlags|=cI,t.__preload&&(e?e.add(t):t.__preload())),t._objFlags&_I||(t._objFlags|=_I,t.onLoad?i?i.add(t):(t.onLoad(),t._objFlags|=fI):t._objFlags|=fI),t._enabled)){if(!t.node._activeInHierarchy)return;b.director._compScheduler.enableComp(t,n)}},e.destroyComp=function(t){b.director._compScheduler.disableComp(t),t.onDestroy&&t._objFlags&fI&&t.onDestroy()},e._activateNodeRecursively=function(t,e,i,n){if(t._objFlags&dI)K(3816,t.name);else{t._activeInHierarchy=!0;for(var r=t._components.length,s=0;s<r;++s){var a=t._components[s];a instanceof b.Component?this.activateComp(a,e,i,n):(yI(t,a,s),--s,--r)}for(var o=0,u=t._children.length;o<u;++o){var h=t._children[o];h._active&&this._activateNodeRecursively(h,e,i,n)}t._onPostActivated(!0)}},e._deactivateNodeRecursively=function(t){t._objFlags|=dI,t._activeInHierarchy=!1;for(var e=t._components.length,i=0;i<e;++i){var n=t._components[i];if(n._enabled&&(b.director._compScheduler.disableComp(n),t._activeInHierarchy))return void(t._objFlags&=~dI)}for(var r=0,s=t._children.length;r<s;++r){var a=t._children[r];if(a._activeInHierarchy&&(this._deactivateNodeRecursively(a),t._activeInHierarchy))return void(t._objFlags&=~dI)}t._onPostActivated(!1),t._objFlags&=~dI},t}()),LO=_h("cc.TargetInfo")((SI=T((TI=function(){E(this,"localID",SI,this)}).prototype,"localID",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),EI=TI))||EI,FO=(AI=_h("cc.TargetOverrideInfo"),RI=Kh(Ta),bI=Kh(LO),CI=Kh(jE),wI=Kh(LO),AI((xI=T((OI=function(){E(this,"source",xI,this),E(this,"sourceInfo",PI,this),E(this,"propertyPath",DI,this),E(this,"target",BI,this),E(this,"targetInfo",NI,this)}).prototype,"source",[Eh,RI],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),PI=T(OI.prototype,"sourceInfo",[Eh,bI],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),DI=T(OI.prototype,"propertyPath",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),BI=T(OI.prototype,"target",[Eh,CI],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),NI=T(OI.prototype,"targetInfo",[Eh,wI],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),II=OI))||II),UO=_h("cc.CompPrefabInfo")((FI=T((LI=function(){E(this,"fileId",FI,this)}).prototype,"fileId",[Eh,Ph],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),MI=LI))||MI,GO=(UI=_h("CCPropertyOverrideInfo"),GI=Kh(LO),UI((XI=function(){function t(){E(this,"targetInfo",HI,this),E(this,"propertyPath",VI,this),E(this,"value",WI,this)}return t.prototype.isTarget=function(){},t}(),HI=T((zI=XI).prototype,"targetInfo",[Eh,GI],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),VI=T(zI.prototype,"propertyPath",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),WI=T(zI.prototype,"value",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),kI=zI))||kI),kO=(jI=_h("cc.MountedChildrenInfo"),YI=Kh(LO),KI=Kh([jE]),jI(($I=function(){function t(){E(this,"targetInfo",ZI,this),E(this,"nodes",JI,this)}return t.prototype.isTarget=function(){},t}(),ZI=T((QI=$I).prototype,"targetInfo",[Eh,YI],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),JI=T(QI.prototype,"nodes",[Eh,KI],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),qI=QI))||qI),zO=(tO=_h("cc.MountedComponentsInfo"),eO=Kh(LO),iO=Kh([bc]),tO((oO=function(){function t(){E(this,"targetInfo",sO,this),E(this,"components",aO,this)}return t.prototype.isTarget=function(){},t}(),sO=T((rO=oO).prototype,"targetInfo",[Eh,eO],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),aO=T(rO.prototype,"components",[Eh,iO],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),nO=rO))||nO),HO=(uO=_h("cc.PrefabInstance"),hO=Kh(jE),lO=Kh([kO]),cO=Kh([zO]),_O=Kh([GO]),fO=Kh([LO]),uO((SO=function(){function t(){E(this,"fileId",mO,this),E(this,"prefabRootNode",gO,this),E(this,"mountedChildren",vO,this),E(this,"mountedComponents",yO,this),E(this,"propertyOverrides",EO,this),E(this,"removedComponents",TO,this),this.targetMap={},this.expanded=!1}var e=t.prototype;return e.findPropertyOverride=function(){},e.removePropertyOverride=function(){},t}(),mO=T((pO=SO).prototype,"fileId",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),gO=T(pO.prototype,"prefabRootNode",[Eh,hO],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),vO=T(pO.prototype,"mountedChildren",[Eh,lO],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),yO=T(pO.prototype,"mountedComponents",[Eh,cO],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),EO=T(pO.prototype,"propertyOverrides",[Eh,_O],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),TO=T(pO.prototype,"removedComponents",[Eh,fO],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),dO=pO))||dO),VO=(AO=_h("cc.PrefabInfo"),RO=Kh(jE),bO=Kh(HO),CO=Kh([FO]),AO((OO=T((IO=function(){E(this,"root",OO,this),E(this,"asset",xO,this),E(this,"fileId",PO,this),E(this,"instance",DO,this),E(this,"targetOverrides",BO,this),E(this,"nestedPrefabInstanceRoots",NO,this)}).prototype,"root",[Eh,RO],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),xO=T(IO.prototype,"asset",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),PO=T(IO.prototype,"fileId",[Eh,Ph],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),DO=T(IO.prototype,"instance",[Eh,bO],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),BO=T(IO.prototype,"targetOverrides",[Eh,CO],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),NO=T(IO.prototype,"nestedPrefabInstanceRoots",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),wO=IO))||wO);b._PrefabInfo=VO;var WO,XO,jO,YO,KO,qO,QO,ZO,JO,$O,tx,ex,ix,nx,rx=Object.freeze({__proto__:null,TargetInfo:LO,TargetOverrideInfo:FO,CompPrefabInfo:UO,PropertyOverrideInfo:GO,MountedChildrenInfo:kO,MountedComponentsInfo:zO,PrefabInstance:HO,PrefabInfo:VO,createNodeWithPrefab:Uw,generateTargetMap:Gw,getTarget:kw,applyMountedChildren:zw,applyMountedComponents:Hw,applyRemovedComponents:Vw,applyPropertyOverrides:Ww,applyTargetOverrides:Xw,expandPrefabInstanceNode:jw,expandNestedPrefabInstanceNode:Yw,applyNodeAndComponentId:function t(e,i){for(var n=e.components,r=e.children,s=0;s<n.length;s++){var a,o=n[s];o._id=""+i+(null===(a=o.__prefab)||void 0===a?void 0:a.fileId)}for(var u=0;u<r.length;u++){var h,l=r[u];l._id=""+i+(null===(h=l._prefab)||void 0===h?void 0:h.fileId),t(l,i)}}}),sx=_e({AUTO:0,SINGLE_INSTANCE:1,MULTI_INSTANCE:2}),ax=t("Prefab",_h("cc.Prefab")((QO=qO=function(t){function e(){var e;return E(e=t.call(this)||this,"data",jO,g(e)),E(e,"optimizationPolicy",YO,g(e)),E(e,"persistent",KO,g(e)),e._createFunction=void 0,e._instantiatedTimes=void 0,e._createFunction=null,e._instantiatedTimes=0,e}c(e,t);var i=e.prototype;return i.createNode=function(t){var e=b.instantiate(this);e.name=this.name,t(null,e)},i.compileCreateFunction=function(){var t,e;this._createFunction=(e=(t=this.data)instanceof b._BaseNode&&t,new rE(t,e).result)},i._doInstantiate=function(t){return this.data._prefab||j(3700),this._createFunction||this.compileCreateFunction(),this._createFunction(t)},i._instantiate=function(){var t;return this.optimizationPolicy!==sx.SINGLE_INSTANCE&&(this.optimizationPolicy===sx.MULTI_INSTANCE||this._instantiatedTimes+1>=e.OptimizationPolicyThreshold)?(t=this._doInstantiate(),this.data._instantiate(t)):t=this.data._instantiate(),++this._instantiatedTimes,t},i.initDefault=function(e){t.prototype.initDefault.call(this,e),this.data=new jE,this.data.name="(Missing Node)";var i=new b._PrefabInfo;i.asset=this,i.root=this.data,this.data._prefab=i},i.validate=function(){return!!this.data},i.onLoaded=function(){var t=this.data;Yw(t),Xw(t)},e}(Wl),qO.OptimizationPolicy=sx,qO.OptimizationPolicyThreshold=3,jO=T((XO=QO).prototype,"data",[Eh,Ph],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),YO=T(XO.prototype,"optimizationPolicy",[Eh,Ph],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return sx.AUTO}}),KO=T(XO.prototype,"persistent",[Eh,Ph],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),WO=XO))||WO);le.value(ax,"_utils",rx),b.Prefab=ax,Mt(b,"cc._Prefab","Prefab"),t("PrefabLink",(ZO=_h("cc.PrefabLink"),JO=Kh(ax),$O=Dh(),ZO((nx=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return E(e=t.call.apply(t,[this].concat(n))||this,"prefab",ix,g(e)),e}return c(e,t),e}(bc),ix=T((ex=nx).prototype,"prefab",[JO,Eh,$O],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),tx=ex))||tx));var ox=new ji;function ux(t,e,i,n){n||(n=new ji),t.convertToUINode(e,i,n);var r=i.position;return n.add(r),n}function hx(t,e,i){return i||(i=new ji),t.worldToScreen(e,i),i.x/=b.view.getScaleX(),i.y/=b.view.getScaleY(),i}var lx=t("convertUtils",{WorldNode3DToLocalNodeUI:ux,WorldNode3DToWorldNodeUI:hx});b.pipelineUtils=lx,et(b.pipelineUtils,"cc.pipelineUtils",[{name:"WorldNode3DToLocalNodeUI",newName:"convertToUINode",targetName:"cc.Camera.prototype",customFunction:function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];var n=e[0],r=e[3]||ox;return n.convertToUINode(e[1],e[2],r),r.add(e[2].position),e[3]||r.clone()}}]);var cx=new ji,_x=To.create(0,0,0,1),fx=new da((function(){return{model:null,depth:0}}),128);function dx(t,e){var i=0;t.node&&(ji.subtract(cx,t.node.worldPosition,e.position),i=ji.dot(cx,e.forward));var n=fx.alloc();return n.model=t,n.depth=i,n}function px(t,e){var i=t.pipelineSceneData.validPunctualLights;i.length=0;for(var n=e.scene.spotLights,r=0;r<n.length;r++){var s=n[r];s.baked||(To.set(_x,s.position.x,s.position.y,s.position.z,s.range),bu.sphereFrustum(_x,e.frustum)&&i.push(s))}for(var a=e.scene.sphereLights,o=0;o<a.length;o++){var u=a[o];u.baked||(To.set(_x,u.position.x,u.position.y,u.position.z,u.range),bu.sphereFrustum(_x,e.frustum)&&i.push(u))}}function mx(t,e){var i=e.scene,n=i.mainLight,r=t.pipelineSceneData,s=r.shadows,a=r.skybox,o=r.csmLayers,u=r.renderObjects;fx.freeArray(u),u.length=0;var h=o.castShadowObjects;h.length=0;var l=o.layerObjects;l.clear(),s.enabled&&(t.pipelineUBO.updateShadowUBORange(gp.SHADOW_COLOR_OFFSET,s.shadowColor),s.type===OA.ShadowMap&&n&&n.node&&o.update(r,e)),e.clearFlag&DS&&(a.enabled&&a.model?u.push(dx(a.model,e)):e.clearFlag===DS&&b.warnID(15100,e.name));for(var c=i.models,_=e.visibility,f=0;f<c.length;f++){var d=c[f];if(d.enabled&&(d.castShadow&&(h.push(dx(d,e)),l.push(dx(d,e))),d.node&&(_&d.node.layer)===d.node.layer||_&d.visFlags)){if(d.worldBounds&&!bu.aabbFrustum(d.worldBounds,e.frustum))continue;u.push(dx(d,e))}}}var gx,vx=new Hr(Hn.LINEAR,Hn.LINEAR,Hn.NONE,Vn.CLAMP,Vn.CLAMP,Vn.CLAMP),yx=new Hr(Hn.POINT,Hn.POINT,Hn.NONE,Vn.CLAMP,Vn.CLAMP,Vn.CLAMP),Ex=function(){function t(t){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=t,this._linearSampler=this._device.getSampler(vx),this._pointSampler=this._device.getSampler(yx);var e=new cs(sp.bindings);this._descriptorSetLayout=this._device.createDescriptorSetLayout(e),this._globalDescriptorSet=this._device.createDescriptorSet(new _s(this._descriptorSetLayout))}var e=t.prototype;return e.regenLayout=function(){var t=new cs(sp.bindings);this._descriptorSetLayout=this._device.createDescriptorSetLayout(t),this._globalDescriptorSet=this._device.createDescriptorSet(new _s(this._descriptorSetLayout))},e.bindBuffer=function(t,e){this._globalDescriptorSet.bindBuffer(t,e);for(var i=this._descriptorSetMap.values(),n=i.next();!n.done;)n.value.bindBuffer(t,e),n=i.next()},e.bindSampler=function(t,e){this._globalDescriptorSet.bindSampler(t,e);for(var i=this._descriptorSetMap.values(),n=i.next();!n.done;)n.value.bindSampler(t,e),n=i.next()},e.bindTexture=function(t,e){this._globalDescriptorSet.bindTexture(t,e);for(var i=this._descriptorSetMap.values(),n=i.next();!n.done;)n.value.bindTexture(t,e),n=i.next()},e.update=function(){this._globalDescriptorSet.update();for(var t=this._descriptorSetMap.values(),e=t.next();!e.done;)e.value.update(),e=t.next()},e.getOrCreateDescriptorSet=function(t){var e=this._device;if(!this._descriptorSetMap.has(t)){var i=this._globalDescriptorSet,n=e.createDescriptorSet(new _s(this._descriptorSetLayout));this._descriptorSetMap.set(t,n);for(var r=rp.UBO_GLOBAL;r<rp.COUNT;r++)n.bindBuffer(r,i.getBuffer(r)),n.bindSampler(r,i.getSampler(r)),n.bindTexture(r,i.getTexture(r));var s=e.createBuffer(new Mr(Dn.UNIFORM|Dn.TRANSFER_DST,Mn.HOST|Mn.DEVICE,gp.SIZE,gp.SIZE));n.bindBuffer(gp.BINDING,s),n.update()}return this._descriptorSetMap.get(t)},e.destroy=function(){this._descriptorSetLayout.destroy()},h(t,[{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}}]),t}();function Tx(t,e){e<1e3?e=1e3:e>15e3&&(e=15e3);var i=e*e,n=(.860117757+.000154118254*e+1.28641212e-7*i)/(1+.000842420235*e+7.08145163e-7*i),r=(.317398726+422806245e-13*e+4.20481691e-8*i)/(1-289741816e-13*e+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);t.x=3.2404542*u-1.5371385+-.4985314*h,t.y=-.969266*u+1.8760108+.041556*h,t.z=.0556434*u-.2040259+1.0572252*h}!function(t){t[t.DIRECTIONAL=0]="DIRECTIONAL",t[t.SPHERE=1]="SPHERE",t[t.SPOT=2]="SPOT",t[t.UNKNOWN=3]="UNKNOWN"}(gx||(gx={}));var Sx,Ax,Rx,bx,Cx,wx,Ix,Ox,xx,Px,Dx=function(t){return 4*Math.PI*Math.PI*t*t},Bx=function(){function t(){this._baked=!1,this._color=new ji(1,1,1),this._colorTemp=6550,this._colorTempRGB=new ji(1,1,1),this._scene=null,this._node=null,this._name=null,this._useColorTemperature=!1,this._type=gx.UNKNOWN}var e=t.prototype;return e.initialize=function(){this.color=new ji(1,1,1),this.colorTemperature=6550},e.attachToScene=function(t){this._scene=t},e.detachFromScene=function(){this._scene=null},e.destroy=function(){this._name=null,this._node=null},e.update=function(){},h(t,[{key:"baked",get:function(){return this._baked},set:function(t){this._baked=t}},{key:"color",get:function(){return this._color},set:function(t){this._color.set(t)}},{key:"useColorTemperature",get:function(){return this._useColorTemperature},set:function(t){this._useColorTemperature=t}},{key:"colorTemperature",get:function(){return this._colorTemp},set:function(t){this._colorTemp=t,Tx(this._colorTempRGB,this._colorTemp)}},{key:"colorTemperatureRGB",get:function(){return this._colorTempRGB}},{key:"node",get:function(){return this._node},set:function(t){this._node=t,this._node&&(this._node.hasChangedFlags|=AE.ROTATION)}},{key:"type",get:function(){return this._type}},{key:"name",get:function(){return this._name},set:function(t){this._name=t}},{key:"scene",get:function(){return this._scene}}]),t}(),Nx=t("DebugView",function(){function t(){this._singleMode=0,this._compositeModeValue=0,this._lightingWithAlbedo=!0,this._csmLayerColoration=!1,this._nativeConfig=null,this._activate()}var e=t.prototype;return e.isCompositeModeEnabled=function(t){return 0!=(this._compositeModeValue&1<<t)},e.enableCompositeMode=function(t,e){this._enableCompositeMode(t,e),this._updatePipeline()},e.enableAllCompositeMode=function(t){this._enableAllCompositeMode(t),this._updatePipeline()},e.isEnabled=function(){return 0!==this._getType()},e.reset=function(){this._activate(),this._updatePipeline()},e._activate=function(){this._singleMode=0,this._enableAllCompositeMode(!0),this._lightingWithAlbedo=!0,this._csmLayerColoration=!1},e._updatePipeline=function(){var t=b.director.root,e=t.pipeline,i=this._getType();e.macros.CC_USE_DEBUG_VIEW!==i&&(e.macros.CC_USE_DEBUG_VIEW=i,t.onGlobalPipelineStateChanged())},e._enableCompositeMode=function(t,e){e?this._compositeModeValue|=1<<t:this._compositeModeValue&=~(1<<t)},e._enableAllCompositeMode=function(t){for(var e=0;e<12;e++)t?this._compositeModeValue|=1<<e:this._compositeModeValue&=~(1<<e)},e._getType=function(){if(0!==this._singleMode)return 1;if(!0!==this._lightingWithAlbedo||!1!==this._csmLayerColoration)return 2;for(var t=0;t<12;t++)if(!this.isCompositeModeEnabled(t))return 2;return 0},h(t,[{key:"singleMode",get:function(){return this._singleMode},set:function(t){this._singleMode=t,this._updatePipeline()}},{key:"lightingWithAlbedo",get:function(){return this._lightingWithAlbedo},set:function(t){this._lightingWithAlbedo=t,this._updatePipeline()}},{key:"csmLayerColoration",get:function(){return this._csmLayerColoration},set:function(t){this._csmLayerColoration=t,this._updatePipeline()}}]),t}()),Mx=new un,Lx=new un,Fx=new un,Ux=new Li,Gx=new Li(0,0,1,0),kx=new ji,zx=function(){function t(){this._globalUBO=new Float32Array(pp.COUNT),this._cameraUBO=new Float32Array(mp.COUNT),this._shadowUBO=new Float32Array(gp.COUNT),this._csmUBO=new Float32Array(vp.COUNT)}t.updateGlobalUBOView=function(t,e){var i=b.director,n=i.root,r=e,s=Math.floor(t.width),a=Math.floor(t.height);r[pp.TIME_OFFSET]=n.cumulativeTime,r[pp.TIME_OFFSET+1]=n.frameTime,r[pp.TIME_OFFSET+2]=i.getTotalFrames(),r[pp.SCREEN_SIZE_OFFSET]=s,r[pp.SCREEN_SIZE_OFFSET+1]=a,r[pp.SCREEN_SIZE_OFFSET+2]=1/s,r[pp.SCREEN_SIZE_OFFSET+3]=1/a,r[pp.NATIVE_SIZE_OFFSET]=s,r[pp.NATIVE_SIZE_OFFSET+1]=a,r[pp.NATIVE_SIZE_OFFSET+2]=1/r[pp.NATIVE_SIZE_OFFSET],r[pp.NATIVE_SIZE_OFFSET+3]=1/r[pp.NATIVE_SIZE_OFFSET+1];var o=n.debugView;if(o){r[pp.DEBUG_VIEW_MODE_OFFSET]=o.singleMode,r[pp.DEBUG_VIEW_MODE_OFFSET+1]=o.lightingWithAlbedo?1:0,r[pp.DEBUG_VIEW_MODE_OFFSET+2]=o.csmLayerColoration?1:0;for(var u=0;u<12;u++)r[pp.DEBUG_VIEW_COMPOSITE_PACK_1_OFFSET+u]=o.isCompositeModeEnabled(u)?1:0}else{r[pp.DEBUG_VIEW_MODE_OFFSET]=0,r[pp.DEBUG_VIEW_MODE_OFFSET+1]=1,r[pp.DEBUG_VIEW_MODE_OFFSET+2]=0;for(var h=0;h<12;h++)r[pp.DEBUG_VIEW_COMPOSITE_PACK_1_OFFSET+h]=1}},t.updateCameraUBOView=function(t,e,i){var n,r=(i.scene?i.scene:b.director.getScene().renderScene).mainLight,s=t.pipelineSceneData,a=s.ambient,o=s.skybox,u=s.fog,h=s.shadows,l=e,c=i.exposure,_=s.isHDR;if(l[mp.SCREEN_SCALE_OFFSET]=s.shadingScale,l[mp.SCREEN_SCALE_OFFSET+1]=s.shadingScale,l[mp.SCREEN_SCALE_OFFSET+2]=1/l[mp.SCREEN_SCALE_OFFSET],l[mp.SCREEN_SCALE_OFFSET+3]=1/l[mp.SCREEN_SCALE_OFFSET+1],l[mp.EXPOSURE_OFFSET]=c,l[mp.EXPOSURE_OFFSET+1]=1/c,l[mp.EXPOSURE_OFFSET+2]=_?1:0,l[mp.EXPOSURE_OFFSET+3]=1/NS.standardExposureValue,r){var f=r.shadowEnabled&&h.type===OA.ShadowMap?1:0,d=r.direction;if(Gx.set(d.x,d.y,d.z,f),Li.toArray(l,Gx,mp.MAIN_LIT_DIR_OFFSET),ji.toArray(l,r.color,mp.MAIN_LIT_COLOR_OFFSET),r.useColorTemperature){var p=r.colorTemperatureRGB;l[mp.MAIN_LIT_COLOR_OFFSET]*=p.x,l[mp.MAIN_LIT_COLOR_OFFSET+1]*=p.y,l[mp.MAIN_LIT_COLOR_OFFSET+2]*=p.z}l[mp.MAIN_LIT_COLOR_OFFSET+3]=_?r.illuminance*c:r.illuminance}else Gx.set(0,0,1,0),Li.toArray(l,Gx,mp.MAIN_LIT_DIR_OFFSET),Li.toArray(l,Li.ZERO,mp.MAIN_LIT_COLOR_OFFSET);var m=a.skyColor;m.w=_?a.skyIllum*c:a.skyIllum,l[mp.AMBIENT_SKY_OFFSET+0]=m.x,l[mp.AMBIENT_SKY_OFFSET+1]=m.y,l[mp.AMBIENT_SKY_OFFSET+2]=m.z,l[mp.AMBIENT_SKY_OFFSET+3]=m.w,l[mp.AMBIENT_GROUND_OFFSET+0]=a.groundAlbedo.x,l[mp.AMBIENT_GROUND_OFFSET+1]=a.groundAlbedo.y,l[mp.AMBIENT_GROUND_OFFSET+2]=a.groundAlbedo.z,l[mp.AMBIENT_GROUND_OFFSET+3]=o.envmap?null===(n=o.envmap)||void 0===n?void 0:n.mipmapLevel:1,un.toArray(l,i.matView,mp.MAT_VIEW_OFFSET),un.toArray(l,i.node.worldMatrix,mp.MAT_VIEW_INV_OFFSET),ji.toArray(l,i.position,mp.CAMERA_POS_OFFSET),un.toArray(l,i.matProj,mp.MAT_PROJ_OFFSET),un.toArray(l,i.matProjInv,mp.MAT_PROJ_INV_OFFSET),un.toArray(l,i.matViewProj,mp.MAT_VIEW_PROJ_OFFSET),un.toArray(l,i.matViewProjInv,mp.MAT_VIEW_PROJ_INV_OFFSET),l[mp.CAMERA_POS_OFFSET+3]=this.getCombineSignY(),l[mp.SURFACE_TRANSFORM_OFFSET]=i.surfaceTransform,l[mp.SURFACE_TRANSFORM_OFFSET+2]=Math.cos(Ti(s.skybox.getRotationAngle())),l[mp.SURFACE_TRANSFORM_OFFSET+3]=Math.sin(Ti(s.skybox.getRotationAngle()));var g=u.colorArray;l[mp.GLOBAL_FOG_COLOR_OFFSET]=g.x,l[mp.GLOBAL_FOG_COLOR_OFFSET+1]=g.y,l[mp.GLOBAL_FOG_COLOR_OFFSET+2]=g.z,l[mp.GLOBAL_FOG_COLOR_OFFSET+3]=g.z,l[mp.GLOBAL_FOG_BASE_OFFSET]=u.fogStart,l[mp.GLOBAL_FOG_BASE_OFFSET+1]=u.fogEnd,l[mp.GLOBAL_FOG_BASE_OFFSET+2]=u.fogDensity,l[mp.GLOBAL_FOG_ADD_OFFSET]=u.fogTop,l[mp.GLOBAL_FOG_ADD_OFFSET+1]=u.fogRange,l[mp.GLOBAL_FOG_ADD_OFFSET+2]=u.fogAtten,l[mp.NEAR_FAR_OFFSET]=i.nearClip,l[mp.NEAR_FAR_OFFSET+1]=i.farClip,l[mp.VIEW_PORT_OFFSET]=s.shadingScale*i.window.width*i.viewport.x,l[mp.VIEW_PORT_OFFSET+1]=s.shadingScale*i.window.height*i.viewport.y,l[mp.VIEW_PORT_OFFSET+2]=s.shadingScale*i.window.width*i.viewport.z,l[mp.VIEW_PORT_OFFSET+3]=s.shadingScale*i.window.height*i.viewport.w},t.getPCFRadius=function(t,e){var i=t.size.x;switch(e.shadowPcf){case xA.HARD:return 0;case xA.SOFT:return 1/(.5*i);case xA.SOFT_2X:return 2/(.5*i);case xA.SOFT_4X:return 3/(.5*i)}return 0},t.updatePlanarNormalAndDistance=function(t,e){ji.normalize(kx,t.normal),e[gp.PLANAR_NORMAL_DISTANCE_INFO_OFFSET+0]=kx.x,e[gp.PLANAR_NORMAL_DISTANCE_INFO_OFFSET+1]=kx.y,e[gp.PLANAR_NORMAL_DISTANCE_INFO_OFFSET+2]=kx.z,e[gp.PLANAR_NORMAL_DISTANCE_INFO_OFFSET+3]=-t.distance},t.updateShadowUBOView=function(e,i,n,r){var s=e.device,a=r.scene.mainLight,o=e.pipelineSceneData,u=o.shadows,h=o.csmLayers,l=i,c=n,_=o.csmSupported,f=Tm(s)?0:1;if(a&&u.enabled){if(u.type===OA.ShadowMap){if(a.shadowEnabled){if(a.shadowFixedArea||a.csmLevel===PA.LEVEL_1||!_){var d=h.specialLayer.matShadowView,p=h.specialLayer.matShadowProj,m=h.specialLayer.matShadowViewProj,g=a.shadowNear,v=a.shadowFar;un.toArray(l,d,gp.MAT_LIGHT_VIEW_OFFSET),l[gp.SHADOW_PROJ_DEPTH_INFO_OFFSET+0]=p.m10,l[gp.SHADOW_PROJ_DEPTH_INFO_OFFSET+1]=p.m14,l[gp.SHADOW_PROJ_DEPTH_INFO_OFFSET+2]=p.m11,l[gp.SHADOW_PROJ_DEPTH_INFO_OFFSET+3]=p.m15,l[gp.SHADOW_PROJ_INFO_OFFSET+0]=p.m00,l[gp.SHADOW_PROJ_INFO_OFFSET+1]=p.m05,l[gp.SHADOW_PROJ_INFO_OFFSET+2]=1/p.m00,l[gp.SHADOW_PROJ_INFO_OFFSET+3]=1/p.m05,un.toArray(l,m,gp.MAT_LIGHT_VIEW_PROJ_OFFSET),Ux.set(g,v,0,1-a.shadowSaturation),Li.toArray(l,Ux,gp.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET),Ux.set(0,f,a.shadowNormalBias,0),Li.toArray(l,Ux,gp.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].matShadowView;Ux.set(T.m00,T.m04,T.m08,y),Li.toArray(c,Ux,vp.CSM_VIEW_DIR_0_OFFSET+4*E),Ux.set(T.m01,T.m05,T.m09,0),Li.toArray(c,Ux,vp.CSM_VIEW_DIR_1_OFFSET+4*E),Ux.set(T.m02,T.m06,T.m10,0),Li.toArray(c,Ux,vp.CSM_VIEW_DIR_2_OFFSET+4*E);var S=h.layers[E].csmAtlas;Li.toArray(c,S,vp.CSM_ATLAS_OFFSET+4*E),c[vp.CSM_SPLITS_INFO_OFFSET+E]=h.layers[E].splitCameraFar/a.shadowDistance;var A=h.layers[E].matShadowViewProj;un.toArray(c,A,vp.MAT_CSM_VIEW_PROJ_OFFSET+16*E);var R=h.layers[E].matShadowProj;c[vp.CSM_PROJ_DEPTH_INFO_OFFSET+0+4*E]=R.m10,c[vp.CSM_PROJ_DEPTH_INFO_OFFSET+1+4*E]=R.m14,c[vp.CSM_PROJ_DEPTH_INFO_OFFSET+2+4*E]=R.m11,c[vp.CSM_PROJ_DEPTH_INFO_OFFSET+3+4*E]=R.m15,c[vp.CSM_PROJ_INFO_OFFSET+0+4*E]=R.m00,c[vp.CSM_PROJ_INFO_OFFSET+1+4*E]=R.m05,c[vp.CSM_PROJ_INFO_OFFSET+2+4*E]=1/R.m00,c[vp.CSM_PROJ_INFO_OFFSET+3+4*E]=1/R.m05}Ux.set(0,0,0,1-a.shadowSaturation),Li.toArray(l,Ux,gp.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET),Ux.set(0,f,a.shadowNormalBias,a.csmLevel),Li.toArray(l,Ux,gp.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET)}Ux.set(u.size.x,u.size.y,a.shadowPcf,a.shadowBias),Li.toArray(l,Ux,gp.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET)}}else t.updatePlanarNormalAndDistance(u,l);Gi.toArray(l,u.shadowColor,gp.SHADOW_COLOR_OFFSET)}},t.updateShadowUBOLightView=function(t,e,i,n){var r=t.device,s=t.pipelineSceneData,a=s.shadows,o=s.csmLayers,u=e,h=Tm(r)?0:1,l=t.device.capabilities,c=s.csmSupported;switch(i.type){case gx.DIRECTIONAL:var _=i;if(a.enabled&&_&&_.shadowEnabled&&a.type===OA.ShadowMap){var f,d,p,m=.1,g=0,v=0;if(_.shadowFixedArea||_.csmLevel===PA.LEVEL_1||!c)f=o.specialLayer.matShadowView,d=o.specialLayer.matShadowProj,p=o.specialLayer.matShadowViewProj,_.shadowFixedArea?(m=_.shadowNear,g=_.shadowFar,v=0):(m=.1,g=o.specialLayer.shadowCameraFar,v=1),Ux.set(0,h,_.shadowNormalBias,0),Li.toArray(u,Ux,gp.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET);else{var y=o.layers[n];f=y.matShadowView,d=y.matShadowProj,p=y.matShadowViewProj,m=y.splitCameraNear,g=y.splitCameraFar,v=_.csmLevel}un.toArray(u,f,gp.MAT_LIGHT_VIEW_OFFSET),u[gp.SHADOW_PROJ_DEPTH_INFO_OFFSET+0]=d.m10,u[gp.SHADOW_PROJ_DEPTH_INFO_OFFSET+1]=d.m14,u[gp.SHADOW_PROJ_DEPTH_INFO_OFFSET+2]=d.m11,u[gp.SHADOW_PROJ_DEPTH_INFO_OFFSET+3]=d.m15,u[gp.SHADOW_PROJ_INFO_OFFSET+0]=d.m00,u[gp.SHADOW_PROJ_INFO_OFFSET+1]=d.m05,u[gp.SHADOW_PROJ_INFO_OFFSET+2]=1/d.m00,u[gp.SHADOW_PROJ_INFO_OFFSET+3]=1/d.m05,un.toArray(u,p,gp.MAT_LIGHT_VIEW_PROJ_OFFSET),Ux.set(m,g,0,1-_.shadowSaturation),Li.toArray(u,Ux,gp.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET),Ux.set(0,h,_.shadowNormalBias,v),Li.toArray(u,Ux,gp.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET),Ux.set(a.size.x,a.size.y,_.shadowPcf,_.shadowBias),Li.toArray(u,Ux,gp.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET)}break;case gx.SPOT:var E=i;a.enabled&&E&&E.shadowEnabled&&(un.invert(Mx,i.node.getWorldMatrix()),un.toArray(u,Mx,gp.MAT_LIGHT_VIEW_OFFSET),un.perspective(Lx,i.angle,1,.001,i.range,!0,l.clipSpaceMinZ,l.clipSpaceSignY,0),un.multiply(Fx,Lx,Mx),un.toArray(u,Fx,gp.MAT_LIGHT_VIEW_PROJ_OFFSET),Ux.set(.01,i.range,0,0),Li.toArray(u,Ux,gp.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET),Ux.set(a.size.x,a.size.y,E.shadowPcf,E.shadowBias),Li.toArray(u,Ux,gp.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET),Ux.set(1,h,E.shadowNormalBias,0),Li.toArray(u,Ux,gp.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET))}Gi.toArray(u,a.shadowColor,gp.SHADOW_COLOR_OFFSET)},t.getCombineSignY=function(){return t._combineSignY};var e=t.prototype;return e._initCombineSignY=function(){var e=this._device;t._combineSignY=.5*e.capabilities.screenSpaceSignY+.5<<1|.5*e.capabilities.clipSpaceSignY+.5},e.activate=function(t,e){this._device=t,this._pipeline=e;var i=this._pipeline.descriptorSet;this._initCombineSignY();var n=t.createBuffer(new Mr(Dn.UNIFORM|Dn.TRANSFER_DST,Mn.HOST|Mn.DEVICE,pp.SIZE,pp.SIZE));i.bindBuffer(pp.BINDING,n);var r=t.createBuffer(new Mr(Dn.UNIFORM|Dn.TRANSFER_DST,Mn.HOST|Mn.DEVICE,mp.SIZE,mp.SIZE));i.bindBuffer(mp.BINDING,r);var s=t.createBuffer(new Mr(Dn.UNIFORM|Dn.TRANSFER_DST,Mn.HOST|Mn.DEVICE,gp.SIZE,gp.SIZE));i.bindBuffer(gp.BINDING,s);var a=t.createBuffer(new Mr(Dn.UNIFORM|Dn.TRANSFER_DST,Mn.HOST|Mn.DEVICE,vp.SIZE,vp.SIZE));i.bindBuffer(vp.BINDING,a)},e.updateGlobalUBO=function(e){var i=this._pipeline.globalDSManager,n=this._pipeline.descriptorSet,r=this._pipeline.commandBuffers;n.update(),t.updateGlobalUBOView(e,this._globalUBO),r[0].updateBuffer(n.getBuffer(pp.BINDING),this._globalUBO),i.bindBuffer(pp.BINDING,n.getBuffer(pp.BINDING)),i.update()},e.updateCameraUBO=function(e){var i=this._pipeline.globalDSManager,n=this._pipeline.descriptorSet,r=this._pipeline.commandBuffers;t.updateCameraUBOView(this._pipeline,this._cameraUBO,e),r[0].updateBuffer(n.getBuffer(mp.BINDING),this._cameraUBO),i.bindBuffer(mp.BINDING,n.getBuffer(mp.BINDING)),i.update()},e.updateShadowUBO=function(e){var i=this._pipeline.pipelineSceneData;if(i.shadows.enabled){var n=this._pipeline.descriptorSet,r=this._pipeline.commandBuffers,s=i.shadowFrameBufferMap,a=e.scene.mainLight;a&&s.has(a)&&n.bindTexture(yp,s.get(a).colorTextures[0]),t.updateShadowUBOView(this._pipeline,this._shadowUBO,this._csmUBO,e),n.update(),r[0].updateBuffer(n.getBuffer(gp.BINDING),this._shadowUBO),r[0].updateBuffer(n.getBuffer(vp.BINDING),this._csmUBO)}},e.updateShadowUBOLight=function(e,i,n){void 0===n&&(n=0),t.updateShadowUBOLightView(this._pipeline,this._shadowUBO,i,n),e.bindTexture(yp,vy.get("default-texture").getGFXTexture()),e.bindTexture(Ip,vy.get("default-texture").getGFXTexture()),e.update(),this._pipeline.commandBuffers[0].updateBuffer(e.getBuffer(gp.BINDING),this._shadowUBO)},e.updateShadowUBORange=function(t,e){e instanceof un?un.toArray(this._shadowUBO,e,t):e instanceof Gi&&Gi.toArray(this._shadowUBO,e,t)},e.destroy=function(){},t}();zx._combineSignY=0;var Hx,Vx,Wx,Xx,jx,Yx,Kx,qx,Qx,Zx,Jx,$x,tP,eP=t("RenderStage",(Sx=_h("RenderStage"),Ax=zh(),Rx=zh(),bx=zh(),Sx((Px=function(){function t(){E(this,"_name",Ix,this),E(this,"_priority",Ox,this),this._enabled=!0,E(this,"_tag",xx,this)}var e=t.prototype;return e.initialize=function(t){return this._name=t.name,this._priority=t.priority,t.tag&&(this._tag=t.tag),!0},e.activate=function(t,e){this._pipeline=t,this._flow=e},h(t,[{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(t){this._enabled=t}}]),t}(),Ix=T((wx=Px).prototype,"_name",[Ax,Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),Ox=T(wx.prototype,"_priority",[Rx,Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),xx=T(wx.prototype,"_tag",[bx,Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),Cx=wx))||Cx));b.RenderStage=eP;var iP,nP=t("RenderFlow",(Hx=_h("RenderFlow"),Vx=zh(),Wx=zh(),Xx=zh(),jx=zh(),Yx=Kh([eP]),Hx((tP=function(){function t(){E(this,"_name",Qx,this),E(this,"_priority",Zx,this),E(this,"_tag",Jx,this),E(this,"_stages",$x,this)}var e=t.prototype;return e.initialize=function(t){return this._name=t.name,this._priority=t.priority,this._stages=t.stages,t.tag&&(this._tag=t.tag),!0},e.activate=function(t){this._pipeline=t,this._stages.sort((function(t,e){return t.priority-e.priority}));for(var e=0,i=this._stages.length;e<i;e++)this._stages[e].activate(t,this)},e.render=function(t){for(var e=0,i=this._stages.length;e<i;e++)this._stages[e].enabled&&this._stages[e].render(t)},e.destroy=function(){for(var t=0,e=this._stages.length;t<e;t++)this._stages[t].destroy();this._stages.length=0},h(t,[{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}}]),t}(),Qx=T((qx=tP).prototype,"_name",[Vx,Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),Zx=T(qx.prototype,"_priority",[Wx,Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),Jx=T(qx.prototype,"_tag",[Xx,Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),$x=T(qx.prototype,"_stages",[jx,Yx,Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),Kx=qx))||Kx));b.RenderFlow=nP,function(t){t.RENDER_FRAME_BEGIN="render-frame-begin",t.RENDER_FRAME_END="render-frame-end",t.RENDER_CAMERA_BEGIN="render-camera-begin",t.RENDER_CAMERA_END="render-camera-end",t.ATTACHMENT_SCALE_CAHNGED="attachment-scale-changed"}(iP||(iP=t("PipelineEventType",{})));var rP,sP,aP,oP,uP,hP,lP,cP,_P,fP,dP,pP,mP,gP,vP,yP,EP,TP,SP,AP,RP,bP,CP,wP,IP,OP,xP,PP,DP,BP,NP,MP,LP,FP,UP,GP,kP,zP,HP,VP,WP,XP,jP,YP,KP,qP,QP,ZP,JP,$P,tD,eD,iD,nD,rD,sD,aD,oD,uD,hD,lD,cD,_D,fD,dD,pD,mD,gD,vD,yD,ED,TD,SD,AD,RD,bD,CD,wD,ID,OD,xD,PD,DD,BD,ND,MD,LD,FD,UD,GD,kD,zD,HD,VD=t("PipelineEventProcessor",function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).eventTargetOn=t.prototype.on,e.eventTargetOnce=t.prototype.once,e}c(e,t);var i=e.prototype;return i.on=function(t,e,i,n){return this.eventTargetOn(t,e,i,n)},i.once=function(t,e,i){return this.eventTargetOnce(t,e,i)},e}(Ba)),WD=new Sr,XD=new Or,jD=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},YD=function(){this.quadIB=null,this.quadVB=null,this.quadIA=null},KD=t("RenderPipeline",(rP=_h("cc.RenderPipeline"),sP=zh(),aP=zh(),oP=Kh([nP]),rP((_P=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return E(e=t.call.apply(t,[this].concat(n))||this,"_tag",lP,g(e)),E(e,"_flows",cP,g(e)),e._quadIB=null,e._quadVBOnscreen=null,e._quadVBOffscreen=null,e._quadIAOnscreen=null,e._quadIAOffscreen=null,e._eventProcessor=new VD,e._commandBuffers=[],e._pipelineUBO=new zx,e._macros={},e._constantMacros="",e._profiler=null,e._geometryRenderer=null,e._pipelineRenderData=null,e._renderPasses=new Map,e._width=0,e._height=0,e._lastUsedRenderArea=new Sr,e._clusterEnabled=!1,e._bloomEnabled=!1,e}c(e,t);var i=e.prototype;return i.getPipelineRenderData=function(){return this._pipelineRenderData},i.initialize=function(t){return this._flows=t.flows,t.tag&&(this._tag=t.tag),!0},i.createRenderPass=function(t,e,i){var n=this._device,r=new es,s=new is;r.format=e,s.format=i,s.stencilStoreOp=Zn.DISCARD,s.depthStoreOp=Zn.DISCARD,t&cr.COLOR||(t&DS?r.loadOp=Qn.CLEAR:(r.loadOp=Qn.LOAD,r.barrier=n.getGeneralBarrier(new as(Jn.COLOR_ATTACHMENT_WRITE,Jn.COLOR_ATTACHMENT_WRITE)))),(t&cr.DEPTH_STENCIL)!==cr.DEPTH_STENCIL&&(t&cr.DEPTH||(s.depthLoadOp=Qn.LOAD),t&cr.STENCIL||(s.stencilLoadOp=Qn.LOAD)),s.barrier=n.getGeneralBarrier(new as(Jn.DEPTH_STENCIL_ATTACHMENT_WRITE,Jn.DEPTH_STENCIL_ATTACHMENT_WRITE));var a=new ss([r],s);return n.createRenderPass(a)},i.getRenderPass=function(t,e){var i=function(t){for(var e,i=666,n=y(t.colorTextures);!(e=n()).done;){var r=e.value,s=null==r?void 0:r.info;i=Vs(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(t.depthStencilTexture){var a=t.depthStencilTexture.info;i=Vs(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}(e),n=Vs(i+"_"+t,666),r=this._renderPasses.get(n);return r||(r=this.createRenderPass(t,e.colorTextures[0].format,e.depthStencilTexture.format),this._renderPasses.set(n,r),r)},i.newFramebufferByRatio=function(t){for(var e=this.pipelineSceneData,i=this._width*e.shadingScale,n=this._height*e.shadingScale,r=t.colorTextures,s=0;s<r.length;s++)r[s].resize(i,n);t.depthStencilTexture&&t.depthStencilTexture.resize(i,n);var a=this._device.createFramebuffer(new hs(t.renderPass,r,t.depthStencilTexture));return t.destroy(),a},i.generateRenderArea=function(t,e){var i=t.viewport,n=t.window.width,r=t.window.height;e.x=i.x*n,e.y=i.y*r,e.width=i.width*n,e.height=i.height*r},i.generateViewport=function(t,e){this.generateRenderArea(t,WD),e||(e=XD);var i=this.pipelineSceneData.shadingScale;return e.left=WD.x*i,e.top=WD.y*i,e.width=WD.width*i,e.height=WD.height*i,e},i.generateScissor=function(t,e){e||(e=WD),this.generateRenderArea(t,e);var i=this.pipelineSceneData.shadingScale;return e.x*=i,e.y*=i,e.width*=i,e.height*=i,e},i.getMacroString=function(t){var e=this._macros[t];return void 0===e?"":e},i.getMacroInt=function(t){var e=this._macros[t];return void 0===e?0:e},i.getMacroBool=function(t){var e=this._macros[t];return void 0!==e&&e},i.setMacroString=function(t,e){this._macros[t]=e},i.setMacroInt=function(t,e){this._macros[t]=e},i.setMacroBool=function(t,e){this._macros[t]=e},i.activate=function(){this._device=Ja.gfxDevice,this._generateConstantMacros(),this._globalDSManager=new Ex(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 t=0;t<this._flows.length;t++)this._flows[t].activate(this);return!0},i._ensureEnoughSize=function(){},i.render=function(t){if(0!==t.length){this.updateGeometryRenderer(t),this._commandBuffers[0].begin(),this.emit(iP.RENDER_FRAME_BEGIN,t),this._ensureEnoughSize(t),function(t){for(var e=t.length-1;e>=0;--e){var i=t[e];if(i.window.swapchain)return void(ky=i)}ky=null}(t);for(var e=0;e<t.length;e++){var i=t[e];if(i.scene){this.emit(iP.RENDER_CAMERA_BEGIN,i),px(this,i),mx(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(iP.RENDER_CAMERA_END,i)}}this.emit(iP.RENDER_FRAME_END,t),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 t,e=this._pipelineRenderData.bloom;if(null!==e){e.prefiterTex&&e.prefiterTex.destroy(),e.prefilterFramebuffer&&e.prefilterFramebuffer.destroy();for(var i=0;i<e.downsampleTexs.length;++i)e.downsampleTexs[i].destroy(),e.downsampleFramebuffers[i].destroy();e.downsampleTexs.length=0,e.downsampleFramebuffers.length=0;for(var n=0;n<e.upsampleTexs.length;++n)e.upsampleTexs[n].destroy(),e.upsampleFramebuffers[n].destroy();e.upsampleTexs.length=0,e.upsampleFramebuffers.length=0,e.combineTex&&e.combineTex.destroy(),e.combineFramebuffer&&e.combineFramebuffer.destroy(),null===(t=e.renderPass)||void 0===t||t.destroy(),this._pipelineRenderData.bloom=null}},i._genQuadVertexData=function(t,e){var i=new Float32Array(16),n=e.x/this._width,r=(e.x+e.width)/this._width,s=e.y/this._height,a=(e.y+e.height)/this._height;if(this.device.capabilities.screenSpaceSignY>0){var o=a;a=s,s=o}var u=0;switch(t){case wn.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 wn.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 wn.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 wn.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 t=new YD,e=4*Float32Array.BYTES_PER_ELEMENT,i=4*e,n=this._device.createBuffer(new Mr(Dn.VERTEX|Dn.TRANSFER_DST,Mn.DEVICE|Mn.HOST,i,e));if(!n)return t;var r=Uint8Array.BYTES_PER_ELEMENT,s=6*r,a=this._device.createBuffer(new Mr(Dn.INDEX|Dn.TRANSFER_DST,Mn.DEVICE,s,r));if(!a)return t;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 Jr("a_position",On.RG32F),u[1]=new Jr("a_texCoord",On.RG32F);var h=this._device.createInputAssembler(new ts(u,[n],a));return t.quadIB=a,t.quadVB=n,t.quadIA=h,t},i.updateQuadVertexData=function(t,e){var i=this._lastUsedRenderArea;if(i.x!==t.x||i.y!==t.y||i.width!==t.width||i.height!==t.height){var n=this._genQuadVertexData(wn.IDENTITY,t);this._quadVBOffscreen.update(n);var r=this._genQuadVertexData(e.swapchain&&e.swapchain.surfaceTransform||wn.IDENTITY,t);this._quadVBOnscreen.update(r),i.copy(t)}},i.destroy=function(){for(var e,i,n=0;n<this._flows.length;n++)this._flows[n].destroy();this._flows.length=0,this._descriptorSet&&this._descriptorSet.destroy(),null===(e=this._globalDSManager)||void 0===e||e.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(),t.prototype.destroy.call(this)},i.onGlobalPipelineStateChanged=function(){},i._generateConstantMacros=function(){var t="";t+="#define CC_DEVICE_SUPPORT_FLOAT_TEXTURE "+(this.device.getFormatFeatures(On.RGBA32F)&(Gn.RENDER_TARGET|Gn.SAMPLED_TEXTURE)?1:0)+"\n",t+="#define CC_ENABLE_CLUSTERED_LIGHT_CULLING "+(this._clusterEnabled?1:0)+"\n",t+="#define CC_DEVICE_MAX_VERTEX_UNIFORM_VECTORS "+this.device.capabilities.maxVertexUniformVectors+"\n",t+="#define CC_DEVICE_MAX_FRAGMENT_UNIFORM_VECTORS "+this.device.capabilities.maxFragmentUniformVectors+"\n",t+="#define CC_DEVICE_CAN_BENEFIT_FROM_INPUT_ATTACHMENT "+(this.device.hasFeature(In.INPUT_ATTACHMENT_BENEFIT)?1:0)+"\n",t+="#define CC_PLATFORM_ANDROID_AND_WEBGL "+(Ha.os===Fa.ANDROID&&Ha.isBrowser?1:0)+"\n",t+="#define CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES "+(Ee.ENABLE_WEBGL_HIGHP_STRUCT_VALUES?1:0)+"\n",t+="#define CC_JOINT_UNIFORM_CAPACITY "+Gp.JOINT_UNIFORM_CAPACITY+"\n",this._constantMacros=t},i.updateGeometryRenderer=function(t){if(!this._geometryRenderer)for(var e=0;e<t.length;e++){var i=t[e];if(i&&i.window&&i.window.swapchain)return i.initGeometryRenderer(),void(this._geometryRenderer=i.geometryRenderer)}},i.generateBloomRenderData=function(){if(null==this._pipelineRenderData.bloom){var t=this._pipelineRenderData.bloom=new jD,e=this.device,i=new es;i.format=On.RGBA8,i.loadOp=Qn.CLEAR,i.storeOp=Zn.STORE,i.barrier=e.getGeneralBarrier(new as(Jn.NONE,Jn.COLOR_ATTACHMENT_WRITE)),t.renderPass=e.createRenderPass(new ss([i]));var n=this._width,r=this._height;t.prefiterTex=e.createTexture(new kr(Ln.TEX2D,Fn.COLOR_ATTACHMENT|Fn.SAMPLED,On.RGBA8,n>>1,r>>1)),t.prefilterFramebuffer=e.createFramebuffer(new hs(t.renderPass,[t.prefiterTex])),n>>=1,r>>=1;for(var s=0;s<6;++s)t.downsampleTexs.push(e.createTexture(new kr(Ln.TEX2D,Fn.COLOR_ATTACHMENT|Fn.SAMPLED,On.RGBA8,n>>1,r>>1))),t.downsampleFramebuffers[s]=e.createFramebuffer(new hs(t.renderPass,[t.downsampleTexs[s]])),t.upsampleTexs.push(e.createTexture(new kr(Ln.TEX2D,Fn.COLOR_ATTACHMENT|Fn.SAMPLED,On.RGBA8,n,r))),t.upsampleFramebuffers[s]=e.createFramebuffer(new hs(t.renderPass,[t.upsampleTexs[s]])),n>>=1,r>>=1;t.combineTex=e.createTexture(new kr(Ln.TEX2D,Fn.COLOR_ATTACHMENT|Fn.SAMPLED,On.RGBA8,this._width,this._height)),t.combineFramebuffer=e.createFramebuffer(new hs(t.renderPass,[t.combineTex])),t.sampler=this.globalDSManager.linearSampler}},i.on=function(t,e,i,n){return this._eventProcessor.on(t,e,i,n)},i.once=function(t,e,i){return this._eventProcessor.once(t,e,i)},i.off=function(t,e,i){this._eventProcessor.off(t,e,i)},i.emit=function(t,e,i,n,r,s){this._eventProcessor.emit(t,e,i,n,r,s)},i.targetOff=function(t){this._eventProcessor.targetOff(t)},i.removeAll=function(t){this._eventProcessor.removeAll(t)},i.hasEventListener=function(t,e,i){return this._eventProcessor.hasEventListener(t,e,i)},h(e,[{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(t){this._profiler=t}},{key:"geometryRenderer",get:function(){return this._geometryRenderer}},{key:"clusterEnabled",get:function(){return this._clusterEnabled},set:function(t){this._clusterEnabled=t}},{key:"bloomEnabled",get:function(){return this._bloomEnabled},set:function(t){this._bloomEnabled=t}},{key:"shadingScale",get:function(){return this._pipelineSceneData.shadingScale},set:function(t){this._pipelineSceneData.shadingScale!==t&&(this._pipelineSceneData.shadingScale=t,this.emit(iP.ATTACHMENT_SCALE_CAHNGED,t))}}]),e}(Wl),lP=T((hP=_P).prototype,"_tag",[sP,Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),cP=T(hP.prototype,"_flows",[aP,oP,Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),uP=hP))||uP));b.RenderPipeline=KD,nt(KD.prototype,"RenderPipeline.prototype",[{name:"geometryRenderer",suggest:"please use camera.geometryRenderer instead."}]),function(t){t[t.BLOOM=18]="BLOOM",t[t.POST_PROCESS=19]="POST_PROCESS",t[t.UI=20]="UI"}(fP||(fP={})),function(t){t[t.FORWARD=10]="FORWARD"}(dP||(dP={})),function(t){t[t.SHADOW=0]="SHADOW",t[t.FORWARD=1]="FORWARD",t[t.UI=10]="UI"}(pP||(pP={})),function(t){t[t.GBUFFER=10]="GBUFFER",t[t.LIGHTING=15]="LIGHTING",t[t.TRANSPARENT=18]="TRANSPARENT"}(mP||(mP={})),function(t){t[t.SHADOW=0]="SHADOW",t[t.MAIN=1]="MAIN",t[t.UI=10]="UI"}(gP||(gP={})),pe(Ln),pe(Fn),pe(Zn),pe(Qn),pe(Jn),pe(On),function(t){t[t.SCENE=0]="SCENE",t[t.POSTPROCESS=1]="POSTPROCESS",t[t.UI=2]="UI"}(HD||(HD={})),pe(HD),vP=_h("RenderTextureDesc"),yP=Kh(Ln),EP=Kh(Fn),TP=Kh(On),vP((AP=T((SP=function(){E(this,"name",AP,this),E(this,"type",RP,this),E(this,"usage",bP,this),E(this,"format",CP,this),E(this,"width",wP,this),E(this,"height",IP,this)}).prototype,"name",[Eh,Ph],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),RP=T(SP.prototype,"type",[yP],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Ln.TEX2D}}),bP=T(SP.prototype,"usage",[EP],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Fn.COLOR_ATTACHMENT}}),CP=T(SP.prototype,"format",[TP],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return On.UNKNOWN}}),wP=T(SP.prototype,"width",[Eh,Ph],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return-1}}),IP=T(SP.prototype,"height",[Eh,Ph],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return-1}}),SP));var qD,QD=(OP=_h("RenderTextureConfig"),xP=Kh(aT),OP((BP=T((DP=function(){E(this,"name",BP,this),E(this,"texture",NP,this)}).prototype,"name",[Eh,Ph],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),NP=T(DP.prototype,"texture",[xP],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),PP=DP))||PP),ZD=(MP=_h("MaterialConfig"),LP=Kh(Vy),MP((UP=T((FP=function(){E(this,"name",UP,this),E(this,"material",GP,this)}).prototype,"name",[Eh,Ph],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),GP=T(FP.prototype,"material",[LP],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),FP)),kP=_h("FrameBufferDesc"),zP=Kh([Xe]),HP=Kh(aT),kP((WP=T((VP=function(){E(this,"name",WP,this),E(this,"renderPass",XP,this),E(this,"colorTextures",jP,this),E(this,"depthStencilTexture",YP,this),E(this,"texture",KP,this)}).prototype,"name",[Eh,Ph],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),XP=T(VP.prototype,"renderPass",[Eh,Ph],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),jP=T(VP.prototype,"colorTextures",[zP],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),YP=T(VP.prototype,"depthStencilTexture",[Eh,Ph],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),KP=T(VP.prototype,"texture",[HP],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),VP)),qP=_h("ColorDesc"),QP=Kh(On),ZP=Kh(Qn),JP=Kh(Zn),$P=Kh([Jn]),tD=Kh([Jn]),qP((nD=T((iD=function(){E(this,"format",nD,this),E(this,"loadOp",rD,this),E(this,"storeOp",sD,this),E(this,"sampleCount",aD,this),E(this,"beginAccesses",oD,this),E(this,"endAccesses",uD,this)}).prototype,"format",[QP],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return On.UNKNOWN}}),rD=T(iD.prototype,"loadOp",[ZP],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Qn.CLEAR}}),sD=T(iD.prototype,"storeOp",[JP],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Zn.STORE}}),aD=T(iD.prototype,"sampleCount",[Eh,Ph],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 1}}),oD=T(iD.prototype,"beginAccesses",[$P],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Jn.NONE}}),uD=T(iD.prototype,"endAccesses",[tD],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Jn.COLOR_ATTACHMENT_WRITE}}),eD=iD))||eD),JD=(hD=_h("DepthStencilDesc"),lD=Kh(On),cD=Kh(Qn),_D=Kh(Zn),fD=Kh(Qn),dD=Kh(Zn),pD=Kh(Jn),mD=Kh(Jn),hD((yD=T((vD=function(){E(this,"format",yD,this),E(this,"depthLoadOp",ED,this),E(this,"depthStoreOp",TD,this),E(this,"stencilLoadOp",SD,this),E(this,"stencilStoreOp",AD,this),E(this,"sampleCount",RD,this),E(this,"beginAccesses",bD,this),E(this,"endAccesses",CD,this)}).prototype,"format",[lD],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return On.UNKNOWN}}),ED=T(vD.prototype,"depthLoadOp",[cD],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Qn.CLEAR}}),TD=T(vD.prototype,"depthStoreOp",[_D],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Zn.STORE}}),SD=T(vD.prototype,"stencilLoadOp",[fD],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Qn.CLEAR}}),AD=T(vD.prototype,"stencilStoreOp",[dD],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Zn.STORE}}),RD=T(vD.prototype,"sampleCount",[Eh,Ph],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 1}}),bD=T(vD.prototype,"beginAccesses",[pD],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Jn.NONE}}),CD=T(vD.prototype,"endAccesses",[mD],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Jn.DEPTH_STENCIL_ATTACHMENT_WRITE}}),gD=vD))||gD);wD=_h("RenderPassDesc"),ID=Kh([ZD]),OD=Kh(JD),wD((PD=T((xD=function(){E(this,"index",PD,this),E(this,"colorAttachments",DD,this),E(this,"depthStencilAttachment",BD,this)}).prototype,"index",[Eh,Ph],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return-1}}),DD=T(xD.prototype,"colorAttachments",[ID],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),BD=T(xD.prototype,"depthStencilAttachment",[OD],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new JD}}),xD)),function(t){t[t.FRONT_TO_BACK=0]="FRONT_TO_BACK",t[t.BACK_TO_FRONT=1]="BACK_TO_FRONT"}(qD||(qD={})),pe(qD);var $D=(ND=_h("RenderQueueDesc"),MD=Kh(qD),LD=Kh([Xe]),ND((GD=T((UD=function(){E(this,"isTransparent",GD,this),E(this,"sortMode",kD,this),E(this,"stages",zD,this)}).prototype,"isTransparent",[Eh,Ph],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),kD=T(UD.prototype,"sortMode",[MD],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return qD.FRONT_TO_BACK}}),zD=T(UD.prototype,"stages",[LD],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),FD=UD))||FD);function tB(t,e){return t.hash-e.hash||t.depth-e.depth||t.shaderId-e.shaderId}function eB(t,e){return t.priority-e.priority||t.hash-e.hash||e.depth-t.depth||t.shaderId-e.shaderId}var iB=function(){function t(t){this.queue=void 0,this._passDesc=void 0,this._passPool=void 0,this._passDesc=t,this._passPool=new pa((function(){return{priority:0,hash:0,depth:0,shaderId:0,subModel:null,passIdx:0}}),64),this.queue=new ma(64,this._passDesc.sortFunc)}var e=t.prototype;return e.clear=function(){this.queue.clear(),this._passPool.reset()},e.insertRenderPass=function(t,e,i){var n=t.model.subModels[e],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=t.model.priority,o.hash=a,o.depth=t.depth||0,o.shaderId=s.typedID,o.subModel=n,o.passIdx=i,this.queue.push(o),!0},e.sort=function(){this.queue.sort()},e.recordCommandBuffer=function(t,e,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],l=Cy.getOrCreatePipelineState(t,u,h,e,o);i.bindPipelineState(l),i.bindDescriptorSet(lp.MATERIAL,u.descriptorSet),i.bindDescriptorSet(lp.LOCAL,s.descriptorSet),i.bindInputAssembler(o),i.draw(o)}},t}();function nB(t){for(var e=0,i=0;i<t.stages.length;i++)e|=yy(t.stages[i]);var n=tB;switch(t.sortMode){case qD.BACK_TO_FRONT:n=eB;break;case qD.FRONT_TO_BACK:n=tB}return new iB({isTransparent:t.isTransparent,phases:e,sortFunc:n})}function rB(t){t.clear()}function sB(t){t.sort()}var aB,oB=function(){function t(){this.queue=new Set}var e=t.prototype;return e.clear=function(){for(var t=this.queue.values(),e=t.next();!e.done;)e.value.clear(),e=t.next();this.queue.clear()},e.uploadBuffers=function(t){for(var e=this.queue.values(),i=e.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]);t.updateBuffer(r.vbIdx,r.vbIdxData.buffer),t.updateBuffer(r.ubo,r.uboData)}}i=e.next()}},e.recordCommandBuffer=function(t,e,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 l=h.shader,c=Cy.getOrCreatePipelineState(t,h.pass,l,e,h.ia);i.bindPipelineState(c),i.bindDescriptorSet(lp.MATERIAL,h.pass.descriptorSet),o=!0}n&&i.bindDescriptorSet(lp.GLOBAL,n),r?i.bindDescriptorSet(lp.LOCAL,h.descriptorSet,r):i.bindDescriptorSet(lp.LOCAL,h.descriptorSet,a.value.dynamicOffsets),i.bindInputAssembler(h.ia),i.draw(h.ia)}}a=s.next()}},t}(),uB=function(){function t(){this.queue=new Set,this._renderQueue=[]}var e=t.prototype;return e.clear=function(){for(var t=this.queue.values(),e=t.next();!e.done;)e.value.clear(),e=t.next();this._renderQueue=[],this.queue.clear()},e.sort=function(){for(var t=this.queue.values(),e=t.next();!e.done;)e.value.pass.blendState.targets[0].blend||this._renderQueue.push(e.value),e=t.next();for(e=(t=this.queue.values()).next();!e.done;)e.value.pass.blendState.targets[0].blend&&this._renderQueue.push(e.value),e=t.next()},e.uploadBuffers=function(t){for(var e=this.queue.values(),i=e.next();!i.done;)i.value.hasPendingModels&&i.value.uploadBuffers(t),i=e.next()},e.recordCommandBuffer=function(t,e,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(lp.MATERIAL,h.descriptorSet);for(var l=null,c=0;c<u.length;++c){var _=u[c];if(_.count){var f=_.shader,d=Cy.getOrCreatePipelineState(t,h,f,e,_.ia);l!==d&&(i.bindPipelineState(d),l=d),n&&i.bindDescriptorSet(lp.GLOBAL,n),r?i.bindDescriptorSet(lp.LOCAL,_.descriptorSet,r):i.bindDescriptorSet(lp.LOCAL,_.descriptorSet,a.value.dynamicOffsets),i.bindInputAssembler(_.ia),i.draw(_.ia)}}}a=s.next()}},t}(),hB=new _s(null),lB=function(){function t(){this._device=null,this._passes=null,this._shaders=null,this._subMesh=null,this._patches=null,this._priority=tp.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}var e=t.prototype;return e.initialize=function(t,e,i){void 0===i&&(i=null);var n=b.director.root;this._device=Ja.gfxDevice,hB.layout=e[0].localSetLayout,this._inputAssembler=this._device.createInputAssembler(t.iaInfo),this._descriptorSet=this._device.createDescriptorSet(hB);var r=b.director.root.pipeline.pipelineSceneData.getOcclusionQueryPass();if(r){var s=new _s(null);s.layout=r.localSetLayout,this._worldBoundDescriptorSet=this._device.createDescriptorSet(s)}if(this._subMesh=t,this._patches=i,this._passes=e,this._flushPassInfo(),e[0].batchingScheme===my.VB_MERGING&&this.subMesh.genFlatBuffers(),this.priority=tp.DEFAULT,e[0].phase===yy("reflection")){var a=n.mainWindow.width,o=n.mainWindow.height,u=512;o<a?(a=u*a/o,o=u):o=u*o/(a=u),this._reflectionTex=this._device.createTexture(new kr(Ln.TEX2D,Fn.STORAGE|Fn.TRANSFER_SRC|Fn.SAMPLED,On.RGBA8,a,o)),this.descriptorSet.bindTexture(lm,this._reflectionTex),this._reflectionSampler=this._device.getSampler(new Hr(Hn.LINEAR,Hn.LINEAR,Hn.NONE,Vn.CLAMP,Vn.CLAMP,Vn.CLAMP)),this.descriptorSet.bindSampler(lm,this._reflectionSampler),this.descriptorSet.bindTexture(fm,this._reflectionTex)}},e.initPlanarShadowShader=function(){var t=b.director.root.pipeline.pipelineSceneData.shadows;this._planarShader=t.getPlanarShader(this._patches)},e.initPlanarShadowInstanceShader=function(){var t=b.director.root.pipeline.pipelineSceneData.shadows;this._planarInstanceShader=t.getPlanarInstanceShader(this._patches)},e.destroy=function(){var t;this._descriptorSet.destroy(),this._descriptorSet=null,this._inputAssembler.destroy(),this._inputAssembler=null,null===(t=this._worldBoundDescriptorSet)||void 0===t||t.destroy(),this._worldBoundDescriptorSet=null,this.priority=tp.DEFAULT,this._patches=null,this._subMesh=null,this._passes=null,this._shaders=null,this._reflectionTex&&this._reflectionTex.destroy(),this._reflectionTex=null,this._reflectionSampler=null},e.update=function(){for(var t,e=0;e<this._passes.length;++e)this._passes[e].update();this._descriptorSet.update(),null===(t=this._worldBoundDescriptorSet)||void 0===t||t.update()},e.onPipelineStateChanged=function(){var t=this._passes;if(t){for(var e=0;e<t.length;e++){var i=t[e];i.beginChangeStatesSilently(),i.tryCompile(),i.endChangeStatesSilently()}this._flushPassInfo()}},e.onMacroPatchesStateChanged=function(t){this._patches=t;var e=this._passes;if(e){for(var i=0;i<e.length;i++){var n=e[i];n.beginChangeStatesSilently(),n.tryCompile(),n.endChangeStatesSilently()}this._flushPassInfo()}},e.onGeometryChanged=function(){if(this._subMesh){var t=this._subMesh.drawInfo;if(this._inputAssembler&&t){var e=this._inputAssembler.drawInfo;Object.keys(t).forEach((function(i){e[i]=t[i]})),this._inputAssembler.drawInfo=e}}},e.getInstancedAttributeIndex=function(t){for(var e=this.instancedAttributeBlock.attributes,i=0;i<e.length;i++)if(e[i].name===t)return i;return-1},e.updateInstancedWorldMatrix=function(t,e){var i=this.instancedAttributeBlock.views,n=i[e],r=i[e+1],s=i[e+2];n[0]=t.m00,n[1]=t.m01,n[2]=t.m02,n[3]=t.m12,r[0]=t.m04,r[1]=t.m05,r[2]=t.m06,r[3]=t.m13,s[0]=t.m08,s[1]=t.m09,s[2]=t.m10,s[3]=t.m14},e.UpdateInstancedAttributes=function(t){this.instancedWorldMatrixIndex=-1;var e=this.passes[0];if(e.device.hasFeature(In.INSTANCED_ARRAYS)){for(var i=0,n=0;n<t.length;n++){var r=t[n];r.isInstanced&&(i+=As[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<t.length;o++){var u=t[o];if(u.isInstanced){var h=new Jr;h.format=u.format,h.name=u.name,h.isNormalized=u.isNormalized,h.location=u.location,s.attributes.push(h);var l=As[u.format],c=new(Ds(l))(s.buffer.buffer,a,l.count);s.views.push(c),a+=l.size}}e.batchingScheme===my.INSTANCING&&e.getInstancedBuffer().destroy(),this.instancedWorldMatrixIndex=this.getInstancedAttributeIndex(Bp)}},e._flushPassInfo=function(){var t=this._passes;if(t){this._shaders||(this._shaders=[]),this._shaders.length=t.length;for(var e=0,i=t.length;e<i;e++)this._shaders[e]=t[e].getShaderVariant(this.patches)}},h(t,[{key:"passes",get:function(){return this._passes},set:function(t){t.length>8?K(12004,8):(this._passes=t,this._flushPassInfo(),this._passes[0].batchingScheme===my.VB_MERGING&&this.subMesh.genFlatBuffers(),this._descriptorSet&&(this._descriptorSet.destroy(),hB.layout=t[0].localSetLayout,this._descriptorSet=this._device.createDescriptorSet(hB)))}},{key:"shaders",get:function(){return this._shaders}},{key:"subMesh",get:function(){return this._subMesh},set:function(t){this._inputAssembler.destroy(),this._inputAssembler=this._device.createInputAssembler(t.iaInfo),this._passes[0].batchingScheme===my.VB_MERGING&&this.subMesh.genFlatBuffers(),this._subMesh=t}},{key:"priority",get:function(){return this._priority},set:function(t){this._priority=t}},{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(t){this._instancedWorldMatrixIndex=t}}]),t}(),cB=new un,_B=[{name:"CC_RECEIVE_SHADOW",value:!0}],fB=[{name:"CC_USE_LIGHTMAP",value:!0}];!function(t){t[t.DEFAULT=0]="DEFAULT",t[t.SKINNING=1]="SKINNING",t[t.BAKED_SKINNING=2]="BAKED_SKINNING",t[t.BATCH_2D=3]="BATCH_2D",t[t.PARTICLE_BATCH=4]="PARTICLE_BATCH",t[t.LINE=5]="LINE"}(aB||(aB={}));var dB=new Hr(Hn.LINEAR,Hn.LINEAR,Hn.NONE,Vn.CLAMP,Vn.CLAMP,Vn.CLAMP),pB=new Hr(Hn.LINEAR,Hn.LINEAR,Hn.LINEAR,Vn.CLAMP,Vn.CLAMP,Vn.CLAMP),mB=function(){function t(){this.type=aB.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(Pp.COUNT),this._localBuffer=null,this._lightmap=null,this._lightmapUVParam=new Li,this._worldBoundBuffer=null,this._receiveShadow=!1,this._castShadow=!1,this._shadowBias=0,this._shadowNormalBias=0,this._enabled=!0,this._visFlags=Jd.Enum.NONE,this._priority=0,this._device=Ja.gfxDevice}var e=t.prototype;return e.initialize=function(){this._inited||(this._receiveShadow=!0,this.castShadow=!1,this.enabled=!0,this.visFlags=Jd.Enum.NONE,this._inited=!0)},e.destroy=function(){for(var t=this._subModels,e=0;e<t.length;e++)this._subModels[e].destroy();this._localBuffer&&(this._localBuffer.destroy(),this._localBuffer=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},e.attachToScene=function(t){this.scene=t,this._localDataUpdated=!0},e.detachFromScene=function(){this.scene=null},e.updateTransform=function(){var t=this.transform;if(t.hasChangedFlags||t._dirtyFlags){t.updateWorldTransform(),this._localDataUpdated=!0;var e=this._worldBounds;this._modelBounds&&e&&this._modelBounds.transform(t._mat,t._pos,t._rot,t._scale,e)}},e.updateWorldBound=function(){var t=this.transform;if(null!==t){t.updateWorldTransform(),this._localDataUpdated=!0;var e=this._worldBounds;this._modelBounds&&e&&this._modelBounds.transform(t._mat,t._pos,t._rot,t._scale,e)}},e.updateUBOs=function(t){for(var e=this._subModels,i=0;i<e.length;i++)e[i].update();if(this._updateStamp=t,this._localDataUpdated){this._localDataUpdated=!1;for(var n=this.transform._mat,r=!1,s=0;s<e.length;s++){var a=e[s],o=a.instancedWorldMatrixIndex;o>=0?a.updateInstancedWorldMatrix(n,o):r=!0}r&&this._localBuffer&&(un.toArray(this._localData,n,Pp.MAT_WORLD_OFFSET),un.inverseTranspose(cB,n),un.toArray(this._localData,cB,Pp.MAT_WORLD_IT_OFFSET),this._localBuffer.update(this._localData))}},e.createBoundingShape=function(t,e){t&&e&&(this._modelBounds=Fu.fromPoints(Fu.create(),t,e),this._worldBounds=Fu.clone(this._modelBounds))},e._createSubModel=function(){return new lB},e.initSubModel=function(t,e,i){this.initialize(),null==this._subModels[t]?this._subModels[t]=this._createSubModel():this._subModels[t].destroy(),this._subModels[t].initialize(e,i.passes,this.getMacroPatches(t)),this._subModels[t].initPlanarShadowShader(),this._subModels[t].initPlanarShadowInstanceShader(),this._updateAttributesAndBinding(t)},e.setSubModelMesh=function(t,e){this._subModels[t]&&(this._subModels[t].subMesh=e)},e.setSubModelMaterial=function(t,e){this._subModels[t]&&(this._subModels[t].passes=e.passes,this._updateAttributesAndBinding(t))},e.onGlobalPipelineStateChanged=function(){for(var t=this._subModels,e=0;e<t.length;e++)t[e].onPipelineStateChanged()},e.onMacroPatchesStateChanged=function(){for(var t=this._subModels,e=0;e<t.length;e++)t[e].onMacroPatchesStateChanged(this.getMacroPatches(e))},e.onGeometryChanged=function(){for(var t=this._subModels,e=0;e<t.length;e++)t[e].onGeometryChanged()},e.initLightingmap=function(t,e){this._lightmap=t,this._lightmapUVParam=e},e.updateLightingmap=function(t,e){Li.toArray(this._localData,e,Pp.LIGHTINGMAP_UVPARAM),this._localDataUpdated=!0,this._lightmap=t,this._lightmapUVParam=e,this.onMacroPatchesStateChanged(),t||(t=vy.get("empty-texture"));var i=t.getGFXTexture();if(i)for(var n=this._device.getSampler(t.mipmaps.length>1?pB:dB),r=this._subModels,s=0;s<r.length;s++){var a=r[s].descriptorSet;a.bindTexture(rm,i),a.bindSampler(rm,n),a.update()}},e.updateLocalShadowBias=function(){var t=this._localData;t[Pp.LOCAL_SHADOW_BIAS+0]=this._shadowBias,t[Pp.LOCAL_SHADOW_BIAS+1]=this._shadowNormalBias,t[Pp.LOCAL_SHADOW_BIAS+2]=0,t[Pp.LOCAL_SHADOW_BIAS+3]=0,this._localDataUpdated=!0},e.getMacroPatches=function(){var t=this.receiveShadow?_B:null;return null!=this._lightmap&&(t=t?t.concat(fB):fB),t},e._updateAttributesAndBinding=function(t){var e=this._subModels[t];if(e){this._initLocalDescriptors(t),this._updateLocalDescriptors(t,e.descriptorSet),this._initWorldBoundDescriptors(t),e.worldBoundDescriptorSet&&this._updateWorldBoundDescriptors(t,e.worldBoundDescriptorSet);var i=e.passes[0].getShaderVariant(e.patches);this._updateInstancedAttributes(i.attributes,e)}},e._updateInstancedAttributes=function(t,e){e.UpdateInstancedAttributes(t),this._localDataUpdated=!0},e._initLocalDescriptors=function(){this._localBuffer||(this._localBuffer=this._device.createBuffer(new Mr(Dn.UNIFORM|Dn.TRANSFER_DST,Mn.DEVICE,Pp.SIZE,Pp.SIZE)))},e._initWorldBoundDescriptors=function(){this._worldBoundBuffer||(this._worldBoundBuffer=this._device.createBuffer(new Mr(Dn.UNIFORM|Dn.TRANSFER_DST,Mn.DEVICE,Dp.SIZE,Dp.SIZE)))},e._updateLocalDescriptors=function(t,e){this._localBuffer&&e.bindBuffer(Pp.BINDING,this._localBuffer)},e._updateWorldBoundDescriptors=function(t,e){this._worldBoundBuffer&&e.bindBuffer(Dp.BINDING,this._worldBoundBuffer)},h(t,[{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:"worldBoundBuffer",get:function(){return this._worldBoundBuffer}},{key:"updateStamp",get:function(){return this._updateStamp}},{key:"shadowBias",get:function(){return this._shadowBias},set:function(t){this._shadowBias=t}},{key:"shadowNormalBias",get:function(){return this._shadowNormalBias},set:function(t){this._shadowNormalBias=t}},{key:"receiveShadow",get:function(){return this._receiveShadow},set:function(t){this._receiveShadow=t,this.onMacroPatchesStateChanged()}},{key:"castShadow",get:function(){return this._castShadow},set:function(t){this._castShadow=t}},{key:"node",get:function(){return this._node},set:function(t){this._node=t}},{key:"transform",get:function(){return this._transform},set:function(t){this._transform=t}},{key:"visFlags",get:function(){return this._visFlags},set:function(t){this._visFlags=t}},{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled=t}},{key:"priority",get:function(){return this._priority},set:function(t){this._priority=t}}]),t}(),gB=function(){function t(){this._enabled=!1,this._minPos=new ji(0,0,0),this._maxPos=new ji(0,0,0),this._depth=0}return t.prototype.initialize=function(t){this._enabled=t.enabled,this._minPos=t.minPos,this._maxPos=t.maxPos,this._depth=t.depth},h(t,[{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled=t}},{key:"minPos",get:function(){return this._minPos},set:function(t){this._minPos=t}},{key:"maxPos",get:function(){return this._maxPos},set:function(t){this._maxPos=t}},{key:"depth",get:function(){return this._depth},set:function(t){this._depth=t}}]),t}(),vB=new ji(0,0,-1),yB=new ji,EB=function(t){function e(){var e;return(e=t.call(this)||this)._dir=new ji(1,-1,-1),e._illuminanceHDR=wA.SUN_ILLUM,e._illuminanceLDR=1,e._shadowEnabled=!1,e._shadowPcf=xA.HARD,e._shadowBias=1e-5,e._shadowNormalBias=0,e._shadowSaturation=1,e._shadowDistance=50,e._shadowInvisibleOcclusionRange=200,e._csmLevel=PA.LEVEL_4,e._csmNeedUpdate=!1,e._csmLayerLambda=.75,e._csmOptimizationMode=DA.DisableRotationFix,e._shadowFixedArea=!1,e._shadowNear=.1,e._shadowFar=10,e._shadowOrthoSize=5,e._type=gx.DIRECTIONAL,e}c(e,t);var i=e.prototype;return i.initialize=function(){t.prototype.initialize.call(this),this.illuminance=wA.SUN_ILLUM,this.direction=new ji(1,-1,-1)},i.update=function(){this._node&&this._node.hasChangedFlags&&(this.direction=ji.transformQuat(yB,vB,this._node.worldRotation))},i._activate=function(){var t=b.director.root,e=t.pipeline;this._shadowEnabled?(this._shadowFixedArea||!e.pipelineSceneData.csmSupported?e.macros.CC_DIR_LIGHT_SHADOW_TYPE=1:e.macros.CC_DIR_LIGHT_SHADOW_TYPE=this.csmLevel>1?2:1,e.macros.CC_DIR_SHADOW_PCF_TYPE=this._shadowPcf):e.macros.CC_DIR_LIGHT_SHADOW_TYPE=0,t.onGlobalPipelineStateChanged()},h(e,[{key:"direction",get:function(){return this._dir},set:function(t){ji.normalize(this._dir,t)}},{key:"illuminance",get:function(){return b.director.root.pipeline.pipelineSceneData.isHDR?this._illuminanceHDR:this._illuminanceLDR},set:function(t){b.director.root.pipeline.pipelineSceneData.isHDR?this.illuminanceHDR=t:this.illuminanceLDR=t}},{key:"illuminanceHDR",get:function(){return this._illuminanceHDR},set:function(t){this._illuminanceHDR=t}},{key:"illuminanceLDR",get:function(){return this._illuminanceLDR},set:function(t){this._illuminanceLDR=t}},{key:"shadowEnabled",get:function(){return this._shadowEnabled},set:function(t){this._shadowEnabled=t,this._activate()}},{key:"shadowPcf",get:function(){return this._shadowPcf},set:function(t){this._shadowPcf=t,this._activate()}},{key:"shadowBias",get:function(){return this._shadowBias},set:function(t){this._shadowBias=t}},{key:"shadowNormalBias",get:function(){return this._shadowNormalBias},set:function(t){this._shadowNormalBias=t}},{key:"shadowSaturation",get:function(){return this._shadowSaturation},set:function(t){this._shadowSaturation=t}},{key:"shadowDistance",get:function(){return this._shadowDistance},set:function(t){this._shadowDistance=Math.min(t,NA.MAX_FAR)}},{key:"shadowInvisibleOcclusionRange",get:function(){return this._shadowInvisibleOcclusionRange},set:function(t){this._shadowInvisibleOcclusionRange=Math.min(t,NA.MAX_FAR)}},{key:"csmLevel",get:function(){return this._csmLevel},set:function(t){this._csmLevel=t,this._activate()}},{key:"csmNeedUpdate",get:function(){return this._csmNeedUpdate},set:function(t){this._csmNeedUpdate=t}},{key:"csmLayerLambda",get:function(){return this._csmLayerLambda},set:function(t){this._csmLayerLambda=t}},{key:"csmOptimizationMode",get:function(){return this._csmOptimizationMode},set:function(t){this._csmOptimizationMode=t}},{key:"shadowFixedArea",get:function(){return this._shadowFixedArea},set:function(t){this._shadowFixedArea=t,this._activate()}},{key:"shadowNear",get:function(){return this._shadowNear},set:function(t){this._shadowNear=t}},{key:"shadowFar",get:function(){return this._shadowFar},set:function(t){this._shadowFar=Math.min(t,NA.MAX_FAR)}},{key:"shadowOrthoSize",get:function(){return this._shadowOrthoSize},set:function(t){this._shadowOrthoSize=t}}]),e}(Bx),TB=function(t){function e(){var e;return(e=t.call(this)||this)._needUpdate=!1,e._size=.15,e._range=1,e._luminanceHDR=0,e._luminanceLDR=0,e._pos=void 0,e._aabb=void 0,e._aabb=Fu.create(),e._pos=new ji,e._type=gx.SPHERE,e}c(e,t);var i=e.prototype;return i.initialize=function(){t.prototype.initialize.call(this),this.size=.15,this.range=1,this.luminanceHDR=1700/Dx(.15),this.luminanceLDR=1},i.update=function(){if(this._node&&(this._node.hasChangedFlags||this._needUpdate)){this._node.getWorldPosition(this._pos);var t=this._range;Fu.set(this._aabb,this._pos.x,this._pos.y,this._pos.z,t,t,t),this._needUpdate=!1}},h(e,[{key:"position",get:function(){return this._pos}},{key:"size",get:function(){return this._size},set:function(t){this._size=t}},{key:"range",get:function(){return this._range},set:function(t){this._range=t,this._needUpdate=!0}},{key:"luminance",get:function(){return b.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){b.director.root.pipeline.pipelineSceneData.isHDR?this.luminanceHDR=t:this.luminanceLDR=t}},{key:"luminanceHDR",get:function(){return this._luminanceHDR},set:function(t){this._luminanceHDR=t}},{key:"luminanceLDR",set:function(t){this._luminanceLDR=t}},{key:"aabb",get:function(){return this._aabb}}]),e}(Bx),SB=new ji(0,0,-1),AB=new $i,RB=new un,bB=new un,CB=new un,wB=new un,IB=function(t){function e(){var e;return(e=t.call(this)||this)._dir=new ji(1,-1,-1),e._range=5,e._spotAngle=Math.cos(Math.PI/6),e._pos=void 0,e._aabb=void 0,e._frustum=void 0,e._angle=0,e._needUpdate=!1,e._size=.15,e._luminanceHDR=0,e._luminanceLDR=0,e._shadowEnabled=!1,e._shadowPcf=xA.HARD,e._shadowBias=1e-5,e._shadowNormalBias=0,e._aabb=Fu.create(),e._frustum=qu.create(),e._pos=new ji,e._type=gx.SPOT,e}c(e,t);var i=e.prototype;return i.initialize=function(){t.prototype.initialize.call(this),this.size=.15,this.luminanceHDR=1700/Dx(.15),this.luminanceLDR=1,this.range=Math.cos(Math.PI/6),this._dir.set(new ji(1,-1,-1))},i.update=function(){this._node&&(this._node.hasChangedFlags||this._needUpdate)&&(this._node.getWorldPosition(this._pos),ji.transformQuat(this._dir,SB,this._node.getWorldRotation(AB)),ji.normalize(this._dir,this._dir),Fu.set(this._aabb,this._pos.x,this._pos.y,this._pos.z,this._range,this._range,this._range),this._node.getWorldRT(RB),un.invert(RB,RB),un.perspective(bB,this._angle,1,.001,this._range),un.multiply(CB,bB,RB),this._frustum.update(CB,wB),this._needUpdate=!1)},h(e,[{key:"position",get:function(){return this._pos}},{key:"size",get:function(){return this._size},set:function(t){this._size=t}},{key:"range",get:function(){return this._range},set:function(t){this._range=t,this._needUpdate=!0}},{key:"luminance",get:function(){return b.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){b.director.root.pipeline.pipelineSceneData.isHDR?this.luminanceHDR=t:this.luminanceLDR=t}},{key:"luminanceHDR",get:function(){return this._luminanceHDR},set:function(t){this._luminanceHDR=t}},{key:"luminanceLDR",get:function(){return this._luminanceLDR},set:function(t){this._luminanceLDR=t}},{key:"direction",get:function(){return this._dir}},{key:"spotAngle",get:function(){return this._spotAngle},set:function(t){this._angle=t,this._spotAngle=Math.cos(.5*t),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(t){this._shadowEnabled=t}},{key:"shadowPcf",get:function(){return this._shadowPcf},set:function(t){this._shadowPcf=t}},{key:"shadowBias",get:function(){return this._shadowBias},set:function(t){this._shadowBias=t}},{key:"shadowNormalBias",get:function(){return this._shadowNormalBias},set:function(t){this._shadowNormalBias=t}}]),e}(Bx),OB=Object.freeze({__proto__:null,get CameraFOVAxis(){return ZE},get CameraProjection(){return JE},get CameraAperture(){return $E},get CameraISO(){return tT},get CameraShutter(){return eT},get CameraType(){return iT},get TrackingType(){return nT},SKYBOX_FLAG:DS,Camera:NS,get ModelType(){return aB},Model:mB,SubModel:lB,Ambient:wA,EnvironmentLightingType:FA,Skybox:UA,ShadowSize:IA,ShadowType:OA,PCFType:xA,CSMLevel:PA,CSMOptimizationMode:DA,Shadows:NA,FogType:LC,Fog:UC,Octree:gB,ColorTemperatureToRGB:Tx,get LightType(){return gx},nt2lm:Dx,Light:Bx,DirectionalLight:EB,SphereLight:TB,SpotLight:IB}),xB=new da((function(){return{subModel:null,passIdx:-1,dynamicOffsets:[],lights:[]}}),16),PB=new Float32Array(4),DB=[],BB=[],NB=new un,MB=new un;function LB(t,e){return!(!e.worldBounds||bu.aabbWithAABB(e.worldBounds,t.aabb))}function FB(t,e){return!(!e.worldBounds||bu.aabbWithAABB(e.worldBounds,t.aabb)&&bu.aabbFrustum(e.worldBounds,t.frustum))}var UB=yy("forward-add"),GB=[];function kB(t,e){e.length=0;for(var i=!1,n=0;n<t.length;n++){for(var r=t[n].passes,s=-1,a=0;a<r.length;a++)if(r[a].phase===UB){s=a,i=!0;break}e.push(s)}return i}var zB,HB,VB,WB,XB,jB,YB,KB,qB,QB,ZB,JB=function(){function t(t){this._pipeline=void 0,this._device=void 0,this._lightPasses=[],this._instancedLightPassPool=xB.alloc(),this._batchedLightPassPool=xB.alloc(),this._shadowUBO=new Float32Array(gp.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=t,this._device=t.device,this._instancedQueue=new uB,this._batchedQueue=new oB;var e=this._device.capabilities.uboOffsetAlignment;this._lightBufferStride=Math.ceil(Mp.SIZE/e)*e,this._lightBufferElementCount=this._lightBufferStride/Float32Array.BYTES_PER_ELEMENT,this._lightBuffer=this._device.createBuffer(new Mr(Dn.UNIFORM|Dn.TRANSFER_DST,Mn.HOST|Mn.DEVICE,this._lightBufferStride*this._lightBufferCount,this._lightBufferStride)),this._firstLightBufferView=this._device.createBuffer(new Lr(this._lightBuffer,0,Mp.SIZE)),this._lightBufferData=new Float32Array(this._lightBufferElementCount*this._lightBufferCount)}var e=t.prototype;return e.clear=function(){this._instancedQueue.clear(),this._batchedQueue.clear();for(var t=0;t<this._lightPasses.length;t++){var e=this._lightPasses[t];e.dynamicOffsets.length=0,e.lights.length=0}xB.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},e.destroy=function(){for(var t=this._pipeline.globalDSManager.descriptorSetMap,e=t.keys,i=0;i<e.length;i++){var n=e[i],r=t.get(n);r&&(r.getBuffer(gp.BINDING).destroy(),r.getTexture(yp).destroy(),r.getTexture(Ip).destroy(),r.destroy()),t.delete(n)}},e.gatherLightPasses=function(t,e){this.clear();var i=this._pipeline.pipelineSceneData.validPunctualLights;if(i.length){this._updateUBOs(t,e),this._updateLightDescriptorSet(t,e);for(var n=this._pipeline.pipelineSceneData.renderObjects,r=0;r<n.length;r++){var s=n[r].model,a=s.subModels;if(kB(a,GB)&&(BB.length=0,this._lightCulling(s,i),BB.length))for(var o=0;o<a.length;o++){var u=GB[o];if(!(u<0)){var h=a[o],l=h.passes[u];h.passes[0].blendState.targets[0].blend||(h.descriptorSet.bindBuffer(Mp.BINDING,this._firstLightBufferView),h.descriptorSet.update(),this._addRenderQueue(l,h,s,u))}}}for(var c=0;c<i.length;c++){var _=i[c];this._instancedLightPassPool.lights.push(_),this._instancedLightPassPool.dynamicOffsets.push(this._lightBufferStride*c),this._batchedLightPassPool.lights.push(_),this._batchedLightPassPool.dynamicOffsets.push(this._lightBufferStride*c)}this._instancedQueue.uploadBuffers(e),this._batchedQueue.uploadBuffers(e)}},e.recordCommandBuffer=function(t,e,i){for(var n=this._pipeline.globalDSManager,r=0;r<this._instancedLightPassPool.lights.length;++r){var s=this._instancedLightPassPool.lights[r];DB[0]=this._instancedLightPassPool.dynamicOffsets[r];var a=n.getOrCreateDescriptorSet(s);this._instancedQueue.recordCommandBuffer(t,e,i,a,DB)}for(var o=0;o<this._batchedLightPassPool.lights.length;++o){var u=this._batchedLightPassPool.lights[o];DB[0]=this._batchedLightPassPool.dynamicOffsets[o];var h=n.getOrCreateDescriptorSet(u);this._batchedQueue.recordCommandBuffer(t,e,i,h,DB)}for(var l=0;l<this._lightPasses.length;l++){var c=this._lightPasses[l],_=c.subModel,f=c.passIdx,d=c.dynamicOffsets,p=c.lights,m=_.passes[f],g=_.shaders[f],v=_.inputAssembler,y=Cy.getOrCreatePipelineState(t,m,g,e,v),E=m.descriptorSet,T=_.descriptorSet;i.bindPipelineState(y),i.bindDescriptorSet(lp.MATERIAL,E),i.bindInputAssembler(v);for(var S=0;S<d.length;++S){var A=p[S],R=n.getOrCreateDescriptorSet(A);DB[0]=d[S],i.bindDescriptorSet(lp.GLOBAL,R),i.bindDescriptorSet(lp.LOCAL,T,DB),i.draw(v)}}},e._lightCulling=function(t,e){for(var i=!1,n=!function(t){for(var e=t.subModels,i=0;i<e.length;++i)for(var n=e[i].passes,r=0;r<n.length;++r){var s=n[r].batchingScheme;if(s===my.INSTANCING)return!0;if(s===my.VB_MERGING)return!0}return!1}(t),r=0;r<e.length;r++){var s=e[r];switch(s.type){case gx.SPHERE:n&&(i=LB(s,t));break;case gx.SPOT:n&&(i=FB(s,t))}i||BB.push(r)}},e._addRenderQueue=function(t,e,i,n){var r=this._pipeline.pipelineSceneData.validPunctualLights,s=t.batchingScheme;if(s===my.INSTANCING){var a=t.getInstancedBuffer();a.merge(e,n),a.dynamicOffsets[0]=this._lightBufferStride,this._instancedQueue.queue.add(a)}else if(s===my.VB_MERGING){var o=t.getBatchedBuffer();o.merge(e,n,i),o.dynamicOffsets[0]=this._lightBufferStride,this._batchedQueue.queue.add(o)}else{var u=xB.alloc();u.subModel=e,u.passIdx=n;for(var h=0;h<BB.length;h++){var l=BB[h],c=r[l];u.lights.push(c),u.dynamicOffsets.push(this._lightBufferStride*l)}this._lightPasses.push(u)}},e._updateLightDescriptorSet=function(t,e){for(var i=this._pipeline.device,n=this._pipeline.pipelineSceneData,r=n.shadows,s=n.shadowFrameBufferMap,a=t.scene.mainLight,o=Tm(i)?0:1,u=this._pipeline.globalDSManager,h=n.validPunctualLights,l=this._pipeline.device.capabilities,c=0;c<h.length;c++){var _=h[c],f=u.getOrCreateDescriptorSet(_);if(f){var d=void 0,p=void 0;switch(_.type){case gx.SPHERE:a&&zx.updatePlanarNormalAndDistance(r,this._shadowUBO),this._shadowUBO[gp.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+0]=r.size.x,this._shadowUBO[gp.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+1]=r.size.y,this._shadowUBO[gp.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+2]=1,this._shadowUBO[gp.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+3]=0,this._shadowUBO[gp.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+0]=2,this._shadowUBO[gp.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+1]=o,this._shadowUBO[gp.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+2]=0,this._shadowUBO[gp.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+3]=0,Gi.toArray(this._shadowUBO,r.shadowColor,gp.SHADOW_COLOR_OFFSET);break;case gx.SPOT:var m=_;if(a&&zx.updatePlanarNormalAndDistance(r,this._shadowUBO),un.invert(NB,_.node.getWorldMatrix()),un.perspective(MB,_.angle,1,.001,_.range,!0,l.clipSpaceMinZ,l.clipSpaceSignY,0),d=MB.clone(),p=MB.clone().invert(),un.multiply(MB,MB,NB),un.toArray(this._shadowUBO,NB,gp.MAT_LIGHT_VIEW_OFFSET),un.toArray(this._shadowUBO,MB,gp.MAT_LIGHT_VIEW_PROJ_OFFSET),this._shadowUBO[gp.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET+0]=.01,this._shadowUBO[gp.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET+1]=_.range,this._shadowUBO[gp.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET+2]=0,this._shadowUBO[gp.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET+3]=0,this._shadowUBO[gp.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+0]=r.size.x,this._shadowUBO[gp.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+1]=r.size.y,this._shadowUBO[gp.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+2]=m.shadowPcf,this._shadowUBO[gp.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+3]=m.shadowBias,this._shadowUBO[gp.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+0]=1,this._shadowUBO[gp.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+1]=o,this._shadowUBO[gp.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+2]=m.shadowNormalBias,this._shadowUBO[gp.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+3]=0,this._shadowUBO[gp.SHADOW_PROJ_DEPTH_INFO_OFFSET+0]=d.m10,this._shadowUBO[gp.SHADOW_PROJ_DEPTH_INFO_OFFSET+1]=d.m14,this._shadowUBO[gp.SHADOW_PROJ_DEPTH_INFO_OFFSET+2]=d.m11,this._shadowUBO[gp.SHADOW_PROJ_DEPTH_INFO_OFFSET+3]=d.m15,this._shadowUBO[gp.SHADOW_INV_PROJ_DEPTH_INFO_OFFSET+0]=p.m10,this._shadowUBO[gp.SHADOW_INV_PROJ_DEPTH_INFO_OFFSET+1]=p.m14,this._shadowUBO[gp.SHADOW_INV_PROJ_DEPTH_INFO_OFFSET+2]=p.m11,this._shadowUBO[gp.SHADOW_INV_PROJ_DEPTH_INFO_OFFSET+3]=p.m15,this._shadowUBO[gp.SHADOW_PROJ_INFO_OFFSET+0]=d.m00,this._shadowUBO[gp.SHADOW_PROJ_INFO_OFFSET+1]=d.m05,this._shadowUBO[gp.SHADOW_PROJ_INFO_OFFSET+2]=1/d.m00,this._shadowUBO[gp.SHADOW_PROJ_INFO_OFFSET+3]=1/d.m05,Gi.toArray(this._shadowUBO,r.shadowColor,gp.SHADOW_COLOR_OFFSET),s.has(_)){var g,v=null===(g=s.get(_))||void 0===g?void 0:g.colorTextures[0];v&&f.bindTexture(Ip,v)}}f.update(),e.updateBuffer(f.getBuffer(gp.BINDING),this._shadowUBO)}}},e._updateUBOs=function(t,e){var i=t.exposure,n=this._pipeline.pipelineSceneData,r=n.isHDR,s=n.shadows,a=n.validPunctualLights;a.length>this._lightBufferCount&&(this._firstLightBufferView.destroy(),this._lightBufferCount=Oi(a.length),this._lightBuffer.resize(this._lightBufferStride*this._lightBufferCount),this._lightBufferData=new Float32Array(this._lightBufferElementCount*this._lightBufferCount),this._firstLightBufferView.initialize(new Lr(this._lightBuffer,0,Mp.SIZE)));for(var o=0,u=0;o<a.length;o++,u+=this._lightBufferElementCount){var h=a[o];switch(h.type){case gx.SPHERE:if(ji.toArray(PB,h.position),PB[3]=0,this._lightBufferData.set(PB,u+Mp.LIGHT_POS_OFFSET),PB[0]=h.size,PB[1]=h.range,PB[2]=0,PB[3]=0,this._lightBufferData.set(PB,u+Mp.LIGHT_SIZE_RANGE_ANGLE_OFFSET),ji.toArray(PB,h.color),h.useColorTemperature){var l=h.colorTemperatureRGB;PB[0]*=l.x,PB[1]*=l.y,PB[2]*=l.z}PB[3]=r?h.luminance*i*this._lightMeterScale:h.luminance,this._lightBufferData.set(PB,u+Mp.LIGHT_COLOR_OFFSET);break;case gx.SPOT:if(ji.toArray(PB,h.position),PB[3]=1,this._lightBufferData.set(PB,u+Mp.LIGHT_POS_OFFSET),PB[0]=h.size,PB[1]=h.range,PB[2]=h.spotAngle,PB[3]=s.enabled&&h.shadowEnabled&&s.type===OA.ShadowMap?1:0,this._lightBufferData.set(PB,u+Mp.LIGHT_SIZE_RANGE_ANGLE_OFFSET),ji.toArray(PB,h.direction),this._lightBufferData.set(PB,u+Mp.LIGHT_DIR_OFFSET),ji.toArray(PB,h.color),h.useColorTemperature){var c=h.colorTemperatureRGB;PB[0]*=c.x,PB[1]*=c.y,PB[2]*=c.z}PB[3]=r?h.luminance*i*this._lightMeterScale:h.luminance,this._lightBufferData.set(PB,u+Mp.LIGHT_COLOR_OFFSET)}}e.updateBuffer(this._lightBuffer,this._lightBufferData)},t}(),$B=new Fu,tN=function(){function t(t){this._pendingSubModels=[],this._castModels=[],this._instancedQueue=new uB,this._pipeline=void 0,this._pipeline=t}var e=t.prototype;return e.gatherShadowPasses=function(t,e){var i=this._pipeline.pipelineSceneData.shadows;if(this._instancedQueue.clear(),this._pendingSubModels.length=0,this._castModels.length=0,i.enabled&&i.type===OA.Planar&&!(i.normal.length()<1e-6)){var n=t.scene,r=t.frustum,s=0!=(t.visibility&Jd.BitMask.DEFAULT);if(n.mainLight&&s){for(var a=n.models,o=0;o<a.length;o++){var u=a[o];u.enabled&&u.node&&u.castShadow&&this._castModels.push(u)}var h=i.instancingMaterial.passes[0].getInstancedBuffer();this._instancedQueue.queue.add(h);for(var l=0;l<this._castModels.length;l++){var c=this._castModels[l];if(!c.worldBounds||(Fu.transform($B,c.worldBounds,i.matLight),bu.aabbFrustum($B,r)))for(var _=c.subModels,f=0;f<_.length;f++)for(var d=_[f],p=d.passes,m=0;m<p.length;m++)p[m].batchingScheme===my.INSTANCING?(h.merge(d,m,d.planarShader),this._instancedQueue.queue.add(h)):this._pendingSubModels.push(d)}this._instancedQueue.uploadBuffers(e)}}},e.recordCommandBuffer=function(t,e,i){var n=this._pipeline.pipelineSceneData.shadows;if(n.enabled&&n.type===OA.Planar&&(this._instancedQueue.recordCommandBuffer(t,e,i),this._pendingSubModels.length)){var r=n.material.passes[0],s=r.descriptorSet;i.bindDescriptorSet(lp.MATERIAL,s);for(var a=this._pendingSubModels,o=0;o<a.length;o++){var u=a[o],h=u.planarShader,l=u.inputAssembler,c=Cy.getOrCreatePipelineState(t,r,h,e,l);i.bindPipelineState(c),i.bindDescriptorSet(lp.LOCAL,u.descriptorSet),i.bindInputAssembler(l),i.draw(l)}}},t}(),eN=function(){function t(){this._phaseID=yy("default")}var e=t.prototype;return e.activate=function(t){this._pipeline=t},e.render=function(t,e){for(var i=this._pipeline,n=i.device,r=i.commandBuffers[0],s=t.scene.batches,a=0;a<s.length;a++){var o=s[a],u=!1;if(t.visibility&o.visFlags&&(u=!0),u)for(var h=o.shaders.length,l=0;l<h;l++){var c=o.passes[l];if(c.phase===this._phaseID){var _=o.shaders[l],f=o.inputAssembler,d=Cy.getOrCreatePipelineState(n,c,_,e,f);r.bindPipelineState(d),r.bindDescriptorSet(lp.MATERIAL,c.descriptorSet);var p=o.descriptorSet;r.bindDescriptorSet(lp.LOCAL,p),r.bindInputAssembler(f),r.draw(f)}}}},t}(),iN=[new Pr(0,0,0,1)],nN=t("ForwardStage",(zB=_h("ForwardStage"),HB=Kh([$D]),VB=zh(),zB((KB=YB=function(t){function e(){var e;return E(e=t.call(this)||this,"renderQueues",jB,g(e)),e._renderQueues=[],e._renderArea=new Sr,e._batchedQueue=void 0,e._instancedQueue=void 0,e._phaseID=yy("default"),e._clearFlag=4294967295,e.additiveInstanceQueues=[],e._batchedQueue=new oB,e._instancedQueue=new uB,e._uiPhase=new eN,e}c(e,t);var i=e.prototype;return i.addRenderInstancedQueue=function(t){this.additiveInstanceQueues.includes(t)||this.additiveInstanceQueues.push(t)},i.removeRenderInstancedQueue=function(t){var e=this.additiveInstanceQueues.indexOf(t);e>-1&&this.additiveInstanceQueues.splice(e,1)},i.initialize=function(e){return t.prototype.initialize.call(this,e),e.renderQueues&&(this.renderQueues=e.renderQueues),!0},i.activate=function(e,i){t.prototype.activate.call(this,e,i);for(var n=0;n<this.renderQueues.length;n++)this._renderQueues[n]=nB(this.renderQueues[n]);this._additiveLightQueue=new JB(this._pipeline),this._planarQueue=new tN(this._pipeline),this._uiPhase.activate(e)},i.destroy=function(){},i.render=function(t){var e;this._instancedQueue.clear(),this._batchedQueue.clear();var i=this._pipeline,n=i.device;this._renderQueues.forEach(rB);for(var r=i.pipelineSceneData.renderObjects,s=0,a=0,o=0,u=0;u<r.length;++u){var h=r[u],l=h.model.subModels;for(s=0;s<l.length;++s){var c=l[s],_=c.passes;for(a=0;a<_.length;++a){var f=_[a];if(f.phase===this._phaseID){var d=f.batchingScheme;if(d===my.INSTANCING){var p=f.getInstancedBuffer();p.merge(c,a),this._instancedQueue.queue.add(p)}else if(d===my.VB_MERGING){var m=f.getBatchedBuffer();m.merge(c,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(sB);var g=i.commandBuffers[0];i.pipelineUBO.updateShadowUBO(t);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(t,g),this._planarQueue.gatherShadowPasses(t,g),t.clearFlag&cr.COLOR&&(iN[0].x=t.clearColor.x,iN[0].y=t.clearColor.y,iN[0].z=t.clearColor.z,iN[0].w=t.clearColor.w),i.generateRenderArea(t,this._renderArea);var y=t.window.framebuffer,E=i.getRenderPass(t.clearFlag&this._clearFlag,y);g.beginRenderPass(E,y,this._renderArea,iN,t.clearDepth,t.clearStencil),g.bindDescriptorSet(lp.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(lp.GLOBAL,i.descriptorSet),this._planarQueue.recordCommandBuffer(n,E,g),this._renderQueues[1].recordCommandBuffer(n,E,g),null===(e=t.geometryRenderer)||void 0===e||e.render(E,g,i.pipelineSceneData),this._uiPhase.render(t,E),zy(n,E,g,i.profiler,t),g.endRenderPass()},e}(eP),YB.initInfo={name:"ForwardStage",priority:dP.FORWARD,tag:0,renderQueues:[{isTransparent:!1,sortMode:qD.FRONT_TO_BACK,stages:["default"]},{isTransparent:!0,sortMode:qD.BACK_TO_FRONT,stages:["default","planarShadow"]}]},jB=T((XB=KB).prototype,"renderQueues",[HB,Eh,VB],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),WB=XB))||WB)),rN=t("ForwardFlow",_h("ForwardFlow")((ZB=QB=function(t){function e(){return t.apply(this,arguments)||this}c(e,t);var i=e.prototype;return i.initialize=function(e){if(t.prototype.initialize.call(this,e),0===this._stages.length){var i=new nN;i.initialize(nN.initInfo),this._stages.push(i)}return!0},i.activate=function(e){t.prototype.activate.call(this,e)},i.render=function(e){t.prototype.render.call(this,e)},i.destroy=function(){t.prototype.destroy.call(this)},e}(nP),QB.initInfo={name:ip,priority:pP.FORWARD,stages:[]},qB=ZB))||qB),sN=yy("shadow-caster");function aN(t){for(var e=t.passes,i=0;i<e.length;i++)if(e[i].phase===sN)return i;return-1}var oN,uN,hN,lN,cN,_N,fN,dN=function(){function t(t){this._pipeline=void 0,this._subModelsArray=[],this._passArray=[],this._shaderArray=[],this._instancedQueue=void 0,this._batchedQueue=void 0,this._pipeline=t,this._instancedQueue=new uB,this._batchedQueue=new oB}var e=t.prototype;return e.gatherLightPasses=function(t,e,i,n){void 0===n&&(n=0),this.clear();var r=this._pipeline.pipelineSceneData,s=r.shadows;if(e&&s.enabled&&s.type===OA.ShadowMap){switch(e.type){case gx.DIRECTIONAL:var a=e;if(a.shadowEnabled){var o,u=r.csmLayers;!function(t,e,i){var n=t.scene.mainLight,r=e.csmLayers.layerObjects,s=i.validFrustum,a=i.shadowObjects;a.length=0;for(var o=t.visibility,u=r.length-1;u>=0;u--){var h=r.array[u];if(h){var l=h.model;l.enabled&&l.node&&(o&l.node.layer)===l.node.layer&&null!=a&&l.castShadow&&l.worldBounds&&bu.aabbFrustum(l.worldBounds,s)&&(a.push(h),i.level<n.csmLevel&&n.csmOptimizationMode===DA.RemoveDuplicates&&bu.aabbFrustumCompletelyInside(l.worldBounds,s)&&r.fastRemove(u))}}}(t,r,o=a.shadowFixedArea?u.specialLayer:u.layers[n]);for(var h=o.shadowObjects,l=0;l<h.length;l++){var c=h[l].model;this.add(c)}}break;case gx.SPOT:var _=e;if(_.shadowEnabled)for(var f=r.csmLayers.castShadowObjects,d=0;d<f.length;d++){var p=f[d].model;p.worldBounds&&!bu.aabbFrustum(p.worldBounds,_.frustum)||this.add(p)}}this._instancedQueue.uploadBuffers(i),this._batchedQueue.uploadBuffers(i)}},e.clear=function(){this._subModelsArray.length=0,this._shaderArray.length=0,this._passArray.length=0,this._instancedQueue.clear(),this._batchedQueue.clear()},e.add=function(t){for(var e=t.subModels,i=0;i<e.length;i++){var n=e[i],r=aN(n);if(!(r<0)){var s=n.passes[r];if(s.batchingScheme===my.INSTANCING){var a=s.getInstancedBuffer();a.merge(n,r),this._instancedQueue.queue.add(a)}else if(s.batchingScheme===my.VB_MERGING){var o=s.getBatchedBuffer();o.merge(n,r,t),this._batchedQueue.queue.add(o)}else{var u=n.shaders[r];this._subModelsArray.push(n),u&&this._shaderArray.push(u),this._passArray.push(s)}}}},e.recordCommandBuffer=function(t,e,i){this._instancedQueue.recordCommandBuffer(t,e,i),this._batchedQueue.recordCommandBuffer(t,e,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=Cy.getOrCreatePipelineState(t,a,s,e,o),h=a.descriptorSet;i.bindPipelineState(u),i.bindDescriptorSet(lp.MATERIAL,h),i.bindDescriptorSet(lp.LOCAL,r.descriptorSet),i.bindInputAssembler(o),i.draw(o)}},t}(),pN=[new Pr(1,1,1,1)],mN=t("ShadowStage",_h("ShadowStage")((hN=uN=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._shadowFrameBuffer=null,e._renderArea=new Sr,e._light=null,e._globalDS=null,e._level=0,e}c(e,t);var i=e.prototype;return i.setUsage=function(t,e,i,n){void 0===n&&(n=0),this._globalDS=t,this._light=e,this._shadowFrameBuffer=i,this._level=n},i.destroy=function(){var t;this._shadowFrameBuffer=null,this._globalDS=null,this._light=null,null===(t=this._additiveShadowQueue)||void 0===t||t.clear()},i.clearFramebuffer=function(t){if(this._light&&this._shadowFrameBuffer){pN[0].w=t.clearColor.w;var e=this._pipeline,i=e.pipelineSceneData,n=i.shadingScale,r=i.shadows,s=t.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=e.commandBuffers[0],u=this._shadowFrameBuffer.renderPass;o.beginRenderPass(u,this._shadowFrameBuffer,this._renderArea,pN,t.clearDepth,t.clearStencil),o.endRenderPass()}},i.render=function(t){var e=this._pipeline,i=e.pipelineSceneData,n=i.shadows,r=this._globalDS,s=e.commandBuffers[0],a=this._level,o=e.device;if(this._light&&this._shadowFrameBuffer){this._pipeline.pipelineUBO.updateShadowUBOLight(r,this._light,a),this._additiveShadowQueue.gatherLightPasses(t,this._light,s,a);var u=n.size;switch(this._light.type){case gx.DIRECTIONAL:var h=this._light;if(h.shadowFixedArea||h.csmLevel===PA.LEVEL_1||!i.csmSupported)this._renderArea.x=0,this._renderArea.y=0,this._renderArea.width=u.x,this._renderArea.height=u.y;else{var l=o.capabilities.screenSpaceSignY;this._renderArea.x=a%2*.5*u.x,this._renderArea.y=l>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 gx.SPOT:this._renderArea.x=0,this._renderArea.y=0,this._renderArea.width=u.x,this._renderArea.height=u.y}var c=this._shadowFrameBuffer.renderPass;s.beginRenderPass(c,this._shadowFrameBuffer,this._renderArea,pN,t.clearDepth,t.clearStencil),s.bindDescriptorSet(lp.GLOBAL,r),this._additiveShadowQueue.recordCommandBuffer(o,c,s),s.endRenderPass()}},i.activate=function(e,i){t.prototype.activate.call(this,e,i),this._additiveShadowQueue=new dN(e)},e}(eP),uN.initInfo={name:"ShadowStage",priority:dP.FORWARD,tag:0},oN=hN))||oN),gN=[],vN=t("ShadowFlow",_h("ShadowFlow")((_N=cN=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._shadowRenderPass=null,e}c(e,t);var i=e.prototype;return i.initialize=function(e){if(t.prototype.initialize.call(this,e),0===this._stages.length){var i=new mN;i.initialize(mN.initInfo),this._stages.push(i)}return!0},i.activate=function(e){t.prototype.activate.call(this,e);var i=Tm(e.device)?0:1;e.macros.CC_SHADOWMAP_FORMAT=i;var n=e.device.gfxAPI===Cn.WEBGL?1:0;e.macros.CC_SHADOWMAP_USE_LINEAR_DEPTH=n,e.pipelineSceneData.csmSupported=e.device.capabilities.maxFragmentUniformVectors>=(pp.COUNT+mp.COUNT+gp.COUNT+vp.COUNT)/4,e.macros.CC_SUPPORT_CASCADED_SHADOW_MAP=e.pipelineSceneData.csmSupported,e.macros.CC_SHADOW_TYPE=0,e.macros.CC_DIR_SHADOW_PCF_TYPE=xA.HARD,e.macros.CC_DIR_LIGHT_SHADOW_TYPE=0,e.onGlobalPipelineStateChanged()},i.render=function(t){var e=this._pipeline,i=e.pipelineSceneData.shadows,n=e.pipelineSceneData.csmLayers,r=e.pipelineSceneData.shadowFrameBufferMap,s=n.castShadowObjects,a=this._pipeline.pipelineSceneData.validPunctualLights;if(i.enabled&&i.type===OA.ShadowMap){for(var o=0,u=0;o<i.maxReceived&&u<a.length;){var h=a[u];h.type===gx.SPOT&&h.shadowEnabled&&(gN.push(h),o++),u++}if(0!==s.length){i.shadowMapDirty&&this.resizeShadowMap();var l=t.scene.mainLight;if(l&&l.shadowEnabled){var c=e.descriptorSet;r.has(l)||this._initShadowFrameBuffer(e,l,t.window.swapchain);var _=r.get(l);if(l.shadowFixedArea)this._renderStage(t,l,_,c);else for(var f=e.pipelineSceneData.csmSupported?l.csmLevel:1,d=0;d<f;d++)this._renderStage(t,l,_,c,d)}for(var p=0;p<gN.length;p++){var m=gN[p],g=e.globalDSManager.getOrCreateDescriptorSet(m);r.has(m)||this._initShadowFrameBuffer(e,m,t.window.swapchain);var v=r.get(m);this._renderStage(t,m,v,g)}gN.length=0}else this.clearShadowMap(gN,t)}},i.destroy=function(){if(t.prototype.destroy.call(this),this._pipeline){for(var e=this._pipeline.pipelineSceneData.shadowFrameBufferMap,i=Array.from(e.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()}}e.clear()}this._shadowRenderPass&&this._shadowRenderPass.destroy()},i._initShadowFrameBuffer=function(t,e){var i=t.device,n=t.pipelineSceneData.shadows.size,r=t.pipelineSceneData.shadowFrameBufferMap,s=Tm(i)?On.R32F:On.RGBA8;if(!this._shadowRenderPass){var a=new es;a.format=s,a.loadOp=Qn.CLEAR,a.storeOp=Zn.STORE,a.sampleCount=1;var o=new is;o.format=On.DEPTH_STENCIL,o.depthLoadOp=Qn.CLEAR,o.depthStoreOp=Zn.DISCARD,o.stencilLoadOp=Qn.CLEAR,o.stencilStoreOp=Zn.DISCARD,o.sampleCount=1;var u=new ss([a],o);this._shadowRenderPass=i.createRenderPass(u)}var h=[];h.push(i.createTexture(new kr(Ln.TEX2D,Fn.COLOR_ATTACHMENT|Fn.SAMPLED,s,n.x,n.y)));var l=i.createTexture(new kr(Ln.TEX2D,Fn.DEPTH_STENCIL_ATTACHMENT,On.DEPTH_STENCIL,n.x,n.y)),c=i.createFramebuffer(new hs(this._shadowRenderPass,h,l));r.set(e,c)},i._renderStage=function(t,e,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,e,i,r),a.render(t)}},i.clearShadowMap=function(t,e){var i=this._pipeline,n=i.pipelineSceneData,r=e.scene.mainLight;if(r){var s=this._pipeline.descriptorSet;n.shadowFrameBufferMap.has(r)||this._initShadowFrameBuffer(this._pipeline,r,e.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(e)}}for(var h=0;h<t.length;h++){var l=t[h],c=i.globalDSManager.getOrCreateDescriptorSet(l);n.shadowFrameBufferMap.has(l)||this._initShadowFrameBuffer(this._pipeline,l,e.window.swapchain);for(var _=n.shadowFrameBufferMap.get(l),f=0;f<this._stages.length;f++){var d=this._stages[f];d.setUsage(c,l,_),d.clearFramebuffer(e)}}},i.resizeShadowMap=function(){for(var t,e=this._pipeline.pipelineSceneData.shadows,i=e.size,n=this._pipeline,r=n.device,s=n.pipelineSceneData.shadowFrameBufferMap,a=Tm(r)?On.R32F:On.RGBA8,o=y(s.keys());!(t=o()).done;){var u=t.value,h=s.get(u);if(h){var l=[];l.push(n.device.createTexture(new kr(Ln.TEX2D,Fn.COLOR_ATTACHMENT|Fn.SAMPLED,a,i.x,i.y)));var c=h.depthStencilTexture;c&&c.resize(i.x,i.y);var _=h.renderPass;h.destroy();var f=r.createFramebuffer(new hs(_,l,c));s.set(u,f)}}e.shadowMapDirty=!1},e}(nP),cN.initInfo={name:np,priority:pP.SHADOW,tag:HD.SCENE,stages:[]},lN=_N))||lN);it(Tg.prototype,"TextureBase.prototype",[{name:"hasPremultipliedAlpha"},{name:"setPremultiplyAlpha"},{name:"setFlipY"}]),et(aT.prototype,"RenderTexture.prototype",[{name:"getGFXWindow",customFunction:function(){return this._window}}]);var yN=((fN={})[xn.UNORM]="Uint",fN[xn.SNORM]="Int",fN[xn.UINT]="Uint",fN[xn.INT]="Int",fN[xn.UFLOAT]="Float",fN[xn.FLOAT]="Float",fN.default="Uint",fN);function EN(t){return""+(yN[t.type]||yN.default)+t.size/t.count*8}function TN(t,e,i,n,r){void 0===i&&(i=On.R32F),void 0===n&&(n=0),void 0===r&&(r=0);var s=As[i];r||(r=s.size);for(var a="set"+EN(s),o=s.size/s.count,u=Math.floor(e.length/s.count),h=Qa.isLittleEndian,l=0;l<u;++l)for(var c=n+r*l,_=0;_<s.count;++_){var f=c+o*_;t[a](f,e[s.count*l+_],h)}}function SN(t,e,i,n,r,s,a){void 0===i&&(i=On.R32F),void 0===n&&(n=0),void 0===r&&(r=t.byteLength-n),void 0===s&&(s=0),a||(a=new DataView(t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)));var o=As[i];s||(s=o.size);for(var u="set"+EN(o),h="get"+EN(o),l=o.size/o.count,c=Math.floor(r/s),_=Qa.isLittleEndian,f=0;f<c;++f)for(var d=n+s*f,p=0;p<o.count;++p){var m=d+l*p,g=t[h](m,_);a[u](m,e(g,p,t),_)}return a}var AN,RN,bN,CN,wN=t("RenderingSubMesh",function(){function t(t,e,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=e,this._vertexBuffers=t,this._indexBuffer=n,this._indirectBuffer=r,this._primitiveMode=i,this._iaInfo=new ts(e,t,n,r),this._isOwnerOfIndexBuffer=s}var e=t.prototype;return e.invalidateGeometricInfo=function(){this._geometricInfo=void 0},e.genFlatBuffers=function(){if(!this._flatBuffers.length&&this.mesh&&void 0!==this.subMeshIdx){var t=this.mesh,e=0,i=t.struct.primitives[this.subMeshIdx];i.indexView&&(e=i.indexView.count);for(var n=0;n<i.vertexBundelIndices.length;n++){var r=i.vertexBundelIndices[n],s=t.struct.vertexBundles[r],a=i.indexView?i.indexView.count:s.view.count,o=s.view.stride,u=o*a,h=new Uint8Array(t.data.buffer,s.view.offset,s.view.length),l=new Uint8Array(i.indexView?u:s.view.length);if(i.indexView){for(var c=t.readIndices(this.subMeshIdx),_=0;_<e;++_)for(var f=_*o,d=c[_]*o,p=0;p<o;++p)l[f+p]=h[d+p];this._flatBuffers.push({stride:o,count:a,buffer:l})}else l.set(t.data.subarray(s.view.offset,s.view.offset+s.view.length)),this._flatBuffers.push({stride:o,count:a,buffer:l})}}},e.destroy=function(){for(var t=0;t<this.vertexBuffers.length;t++)this.vertexBuffers[t].destroy();if(this.vertexBuffers.length=0,this._indexBuffer&&(this._isOwnerOfIndexBuffer&&this._indexBuffer.destroy(),this._indexBuffer=null),this._jointMappedBuffers&&this._jointMappedBufferIndices){for(var e=0;e<this._jointMappedBufferIndices.length;e++)this._jointMappedBuffers[this._jointMappedBufferIndices[e]].destroy();this._jointMappedBuffers=void 0,this._jointMappedBufferIndices=void 0}this._indirectBuffer&&(this._indirectBuffer.destroy(),this._indirectBuffer=null)},e.enableVertexIdChannel=function(t){if(!this._vertexIdChannel){var e=this.vertexBuffers.length,i=this.attributes.length,n=this._allocVertexIdBuffer(t);this._vertexBuffers.push(n),this._attributes.push(new Jr("a_vertexId",On.R32F,!1,e)),this._iaInfo.attributes=this._attributes,this._iaInfo.vertexBuffers=this._vertexBuffers,this._vertexIdChannel={stream:e,index:i}}},e._allocVertexIdBuffer=function(t){for(var e=0===this.vertexBuffers.length||0===this.vertexBuffers[0].stride?0:this.vertexBuffers[0].size/this.vertexBuffers[0].stride,i=new Float32Array(e),n=0;n<e;++n)i[n]=n+.5;var r=t.createBuffer(new Mr(Dn.VERTEX|Dn.TRANSFER_DST,Mn.DEVICE,i.byteLength,i.BYTES_PER_ELEMENT));return r.update(i),r},h(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:"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:ji.ZERO,max:ji.ZERO}};if(void 0===this.subMeshIdx)return{positions:new Float32Array,indices:new Uint8Array,boundingBox:{min:ji.ZERO,max:ji.ZERO}};var t=this.mesh,e=this.subMeshIdx,i=t.readAttribute(e,gr.ATTR_POSITION),n=t.readIndices(e),r=new ji,s=new ji,a=this.attributes.find((function(t){return t.name===gr.ATTR_POSITION}));if(a){var o=As[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(t){this._drawInfo=t}},{key:"flatBuffers",get:function(){return this._flatBuffers}},{key:"jointMappedBuffers",get:function(){var t=this;if(this._jointMappedBuffers)return this._jointMappedBuffers;var e=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=b.director.root.device,u=0;u<a.vertexBundelIndices.length;u++){var h=s.vertexBundles[a.vertexBundelIndices[u]];r=0,n=On.UNKNOWN;for(var l=0;l<h.attributes.length;l++){var c=h.attributes[l];if(c.name===gr.ATTR_JOINTS){n=c.format;break}r+=As[c.format].size}n?function(){var l=new Uint8Array(t.mesh.data.buffer,h.view.offset,h.view.length),c=new DataView(l.slice().buffer),_=s.jointMaps[a.jointMapIndex];SN(c,(function(t){return _.indexOf(t)}),n,r,h.view.length,h.view.stride,c);var f=o.createBuffer(new Mr(Dn.VERTEX|Dn.TRANSFER_DST,Mn.DEVICE,h.view.length,h.view.stride));f.update(c.buffer),e.push(f),i.push(u)}():e.push(this.vertexBuffers[a.vertexBundelIndices[u]])}return this._vertexIdChannel&&e.push(this._allocVertexIdBuffer(o)),e}},{key:"iaInfo",get:function(){return this._iaInfo}}]),t}()),IN=t("SceneAsset",_h("cc.SceneAsset")((CN=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return E(e=t.call.apply(t,[this].concat(n))||this,"scene",bN,g(e)),e}c(e,t);var i=e.prototype;return i.initDefault=function(e){t.prototype.initDefault.call(this,e),this.scene=new Kw("New Scene")},i.validate=function(){return!!this.scene},e}(Wl),bN=T((RN=CN).prototype,"scene",[Ph,Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),AN=RN))||AN);b.SceneAsset=IN;var ON,xN,PN,DN,BN,NN,MN,LN,FN,UN,GN,kN,zN,HN,VN,WN,XN,jN,YN,KN,qN,QN,ZN,JN,$N,tM,eM,iM,nM,rM,sM,aM,oM,uM,hM,lM,cM,_M,fM=new un,dM=new un,pM=new un,mM=new un,gM=new un,vM=new un,yM=new un,EM=new ji(0,0,0),TM=new ji,SM=new _n,AM=new ji,RM=new ji,bM=new ji(1e7,1e7,1e7),CM=new ji(-1e7,-1e7,-1e7),wM=new ji,IM=0,OM=0,xM=function(){function t(t){this._shadowObjects=[],this._shadowCameraFar=0,this._level=void 0,this._matShadowView=new un,this._matShadowProj=new un,this._matShadowViewProj=new un,this._validFrustum=new qu,this._splitFrustum=new qu,this._lightViewFrustum=new qu,this._castLightViewBoundingBox=new Fu,this._level=t,this._validFrustum.accurate=!0,this._splitFrustum.accurate=!0,this._lightViewFrustum.accurate=!0}var e=t.prototype;return e.copyToValidFrustum=function(t){qu.copy(this._validFrustum,t)},e.calculateValidFrustumOrtho=function(t,e,i,n,r){qu.createOrtho(this._validFrustum,t,e,i,n,r)},e.calculateSplitFrustum=function(t,e,i,n){qu.split(this._splitFrustum,t,e,i,n)},e.destroy=function(){this._shadowObjects.length=0},e.createMatrix=function(t,e,i){var n=b.director.root.device,r=t.shadowInvisibleOcclusionRange;qu.copy(this._lightViewFrustum,this._splitFrustum),un.fromRT(dM,t.node.rotation,EM),un.invert(pM,dM);var s,a,o=pM.clone();this._lightViewFrustum.transform(pM),Fu.fromPoints(this._castLightViewBoundingBox,bM,CM),this._castLightViewBoundingBox.mergeFrustum(this._lightViewFrustum),t.csmOptimizationMode===DA.DisableRotationFix?(s=2*this._castLightViewBoundingBox.halfExtents.x,a=2*this._castLightViewBoundingBox.halfExtents.y):s=a=ji.distance(this._lightViewFrustum.vertices[0],this._lightViewFrustum.vertices[6]);var u=b.director.root.pipeline.pipelineSceneData.csmSupported?t.csmLevel:1;if(u>1&&t.csmOptimizationMode===DA.RemoveDuplicates)if(this._level>=u-1)OM=this._castLightViewBoundingBox.halfExtents.z,IM=this._castLightViewBoundingBox.center.z;else{var h=Math.abs(this._castLightViewBoundingBox.center.z-IM)+OM;this._castLightViewBoundingBox.halfExtents.z=Math.max(this._castLightViewBoundingBox.center.z,h)}var l=this._castLightViewBoundingBox.halfExtents.z;this._shadowCameraFar=2*l+r;var c=this._castLightViewBoundingBox.center;if(wM.set(c.x,c.y,c.z+l+r),ji.transformMat4(wM,wM,dM),un.fromRT(dM,t.node.rotation,wM),un.invert(pM,dM),!i){var _=.5*s,f=.5*a;un.ortho(mM,-_,_,-f,f,.1,this._shadowCameraFar,n.capabilities.clipSpaceMinZ,n.capabilities.clipSpaceSignY),un.multiply(vM,mM,o),ji.transformMat4(TM,wM,vM);var d=2/e;SM.set(d,d);var p=TM.x%SM.x,m=TM.y%SM.y;AM.set(TM.x-p,TM.y-m,TM.z),un.invert(yM,vM),ji.transformMat4(RM,AM,yM),un.fromRT(dM,t.node.rotation,RM),un.invert(pM,dM),un.multiply(gM,mM,pM),un.copy(this._matShadowView,pM),un.copy(this._matShadowProj,mM),un.copy(this._matShadowViewProj,gM)}qu.createOrtho(this._validFrustum,s,a,.1,this._shadowCameraFar,dM)},h(t,[{key:"level",get:function(){return this._level}},{key:"shadowObjects",get:function(){return this._shadowObjects}},{key:"shadowCameraFar",get:function(){return this._shadowCameraFar},set:function(t){this._shadowCameraFar=t}},{key:"matShadowView",get:function(){return this._matShadowView},set:function(t){this._matShadowView=t}},{key:"matShadowProj",get:function(){return this._matShadowProj},set:function(t){this._matShadowProj=t}},{key:"matShadowViewProj",get:function(){return this._matShadowViewProj},set:function(t){this._matShadowViewProj=t}},{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}}]),t}(),PM=function(t){function e(e){var i;return(i=t.call(this,e)||this)._splitCameraNear=0,i._splitCameraFar=0,i._csmAtlas=new Li,i._calculateAtlas(e),i}c(e,t);var i=e.prototype;return i.destroy=function(){t.prototype.destroy.call(this)},i._calculateAtlas=function(t){var e=b.director.root.device.capabilities.clipSpaceSignY,i=t%2-.5,n=(.5-Math.floor(t/2))*e;this._csmAtlas.set(.5,.5,i,n)},h(e,[{key:"splitCameraNear",get:function(){return this._splitCameraNear},set:function(t){this._splitCameraNear=t}},{key:"splitCameraFar",get:function(){return this._splitCameraFar},set:function(t){this._splitCameraFar=t}},{key:"csmAtlas",get:function(){return this._csmAtlas},set:function(t){this._csmAtlas=t}}]),e}(xM),DM=function(){function t(){this._castShadowObjects=[],this._layerObjects=new ma(64),this._layers=[],this._levelCount=0,this._specialLayer=new xM(1),this._shadowDistance=0;for(var t=0;t<PA.LEVEL_4;t++)this._layers[t]=new PM(t)}var e=t.prototype;return e.update=function(t,e){var i=e.scene.mainLight;if(null!==i){var n=t.shadows,r=b.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(e,i,n)))}},e.destroy=function(){this._castShadowObjects.length=0;for(var t=0;t<this._layers.length;t++)this._layers[t].destroy();this._layers.length=0},e._updateFixedArea=function(t){var e=b.director.root.device,i=t.shadowOrthoSize,n=t.shadowOrthoSize,r=t.shadowNear,s=t.shadowFar;un.fromRT(dM,t.node.getWorldRotation(),t.node.getWorldPosition()),un.invert(pM,dM),un.ortho(mM,-i,i,-n,n,r,s,e.capabilities.clipSpaceMinZ,e.capabilities.clipSpaceSignY),un.multiply(gM,mM,pM),this._specialLayer.matShadowView=pM,this._specialLayer.matShadowProj=mM,this._specialLayer.matShadowViewProj=gM,this._specialLayer.calculateValidFrustumOrtho(2*i,2*n,r,s,dM)},e._splitFrustumLevels=function(t){var e=.1,i=t.shadowDistance,n=i/e,r=b.director.root.pipeline.pipelineSceneData.csmSupported?t.csmLevel:1,s=t.csmLayerLambda;this._layers[0].splitCameraNear=e;for(var a=1;a<r;a++){var o=a/r,u=s*e*Math.pow(n,o)+(1-s)*(e+(i-e)*o),h=1.005*u;this._layers[a].splitCameraNear=u,this._layers[a-1].splitCameraFar=h}this._layers[r-1].splitCameraFar=i,t.csmNeedUpdate=!1},e._calculateCSM=function(t,e,i){var n=b.director.root.pipeline.pipelineSceneData.csmSupported?e.csmLevel:1,r=n>1?.5*i.size.x:i.size.x;if(!(r<0)){this._getCameraWorldMatrix(fM,t);for(var s=n-1;s>=0;s--){var a=this._layers[s],o=a.splitCameraNear,u=a.splitCameraFar;a.calculateSplitFrustum(t,fM,o,u),a.createMatrix(e,r,!1)}n===PA.LEVEL_1?(this._specialLayer.shadowCameraFar=this._layers[0].shadowCameraFar,un.copy(this._specialLayer.matShadowView,this._layers[0].matShadowView),un.copy(this._specialLayer.matShadowProj,this._layers[0].matShadowProj),un.copy(this._specialLayer.matShadowViewProj,this._layers[0].matShadowViewProj),this._specialLayer.copyToValidFrustum(this._layers[0].validFrustum)):(this._specialLayer.calculateSplitFrustum(t,fM,.1,e.shadowDistance),this._specialLayer.createMatrix(e,r,!0))}},e._getCameraWorldMatrix=function(t,e){if(e.node){var i=e.node,n=i.getWorldPosition(),r=i.getWorldRotation();un.fromRT(t,r,n),t.m08*=-1,t.m09*=-1,t.m10*=-1}},h(t,[{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}}]),t}(),BM=t("PipelineSceneData",function(){function t(){this.fog=new UC,this.ambient=new wA,this.skybox=new UA,this.shadows=new NA,this.csmLayers=new DM,this.octree=new gB,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 e=t.prototype;return e.activate=function(t){return this._device=t,this.initGeometryRendererMaterials(),this.initOcclusionQuery(),!0},e.initGeometryRendererMaterials=function(){for(var t=0,e=0;e<6;e++){this._geometryRendererMaterials[e]=new Vy,this._geometryRendererMaterials[e]._uuid="geometry-renderer-material-"+e,this._geometryRendererMaterials[e].initialize({effectName:"builtin-geometry-renderer",technique:e});for(var i=0;i<this._geometryRendererMaterials[e].passes.length;++i)this._geometryRendererPasses[t]=this._geometryRendererMaterials[e].passes[i],this._geometryRendererShaders[t]=this._geometryRendererMaterials[e].passes[i].getShaderVariant(),t++}},e.initOcclusionQuery=function(){if(this._occlusionQueryInputAssembler||(this._occlusionQueryInputAssembler=this._createOcclusionQueryIA()),!this._occlusionQueryMaterial){var t=new Vy;t._uuid="default-occlusion-query-material",t.initialize({effectName:"builtin-occlusion-query"}),this._occlusionQueryMaterial=t,t.passes.length>0&&(this._occlusionQueryShader=t.passes[0].getShaderVariant())}},e.getOcclusionQueryPass=function(){return this._occlusionQueryMaterial&&this._occlusionQueryMaterial.passes.length>0?this._occlusionQueryMaterial.passes[0]:null},e.updatePipelineSceneData=function(){},e.destroy=function(){var t,e,i;this.shadows.destroy(),this.csmLayers.destroy(),this.validPunctualLights.length=0,null===(t=this._occlusionQueryInputAssembler)||void 0===t||t.destroy(),this._occlusionQueryInputAssembler=null,null===(e=this._occlusionQueryVertexBuffer)||void 0===e||e.destroy(),this._occlusionQueryVertexBuffer=null,null===(i=this._occlusionQueryIndicesBuffer)||void 0===i||i.destroy(),this._occlusionQueryIndicesBuffer=null},e._createOcclusionQueryIA=function(){var t=this._device,e=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=t.createBuffer(new Mr(Dn.VERTEX|Dn.TRANSFER_DST,Mn.DEVICE,n,i)),this._occlusionQueryVertexBuffer.update(e);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=t.createBuffer(new Mr(Dn.INDEX|Dn.TRANSFER_DST,Mn.DEVICE,a,s)),this._occlusionQueryIndicesBuffer.update(r);var o=[new Jr("a_position",On.RGB32F)],u=new ts(o,[this._occlusionQueryVertexBuffer],this._occlusionQueryIndicesBuffer);return t.createInputAssembler(u)},h(t,[{key:"isHDR",get:function(){return this._isHDR},set:function(t){this._isHDR=t}},{key:"shadingScale",get:function(){return this._shadingScale},set:function(t){this._shadingScale=t}},{key:"csmSupported",get:function(){return this._csmSupported},set:function(t){this._csmSupported=t}},{key:"geometryRendererPasses",get:function(){return this._geometryRendererPasses}},{key:"geometryRendererShaders",get:function(){return this._geometryRendererShaders}}]),t}()),NM=t("ForwardPipeline",(ON=_h("ForwardPipeline"),xN=Kh([QD]),PN=zh(),ON((MN=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return E(e=t.call.apply(t,[this].concat(n))||this,"renderTextures",NN,g(e)),e._postRenderPass=null,e}c(e,t);var i=e.prototype;return i.initialize=function(e){if(t.prototype.initialize.call(this,e),0===this._flows.length){var i=new vN;i.initialize(vN.initInfo),this._flows.push(i);var n=new rN;n.initialize(rN.initInfo),this._flows.push(n)}return!0},i.activate=function(e){return this._macros={CC_PIPELINE_TYPE:0},this._pipelineSceneData=new BM,!(!t.prototype.activate.call(this,e)||!this._activeRenderer(e)&&(K(2402),1))},i._ensureEnoughSize=function(t){for(var e=this._width,i=this._height,n=0;n<t.length;++n){var r=t[n].window;e=Math.max(r.width,e),i=Math.max(r.height,i)}e===this._width&&i===this._height||(this._width=e,this._height=i)},i.destroy=function(){this._destroyUBOs(),this._destroyQuadInputAssembler();for(var e=this._renderPasses.values(),i=e.next();!i.done;)i.value.destroy(),i=e.next();return this._commandBuffers.length=0,t.prototype.destroy.call(this)},i._activeRenderer=function(){var t=this.device;this._commandBuffers.push(t.commandBuffer);var e=this.globalDSManager.pointSampler;return this._descriptorSet.bindSampler(yp,e),this._descriptorSet.bindTexture(yp,vy.get("default-texture").getGFXTexture()),this._descriptorSet.bindSampler(Ip,e),this._descriptorSet.bindTexture(Ip,vy.get("default-texture").getGFXTexture()),this._descriptorSet.update(),!0},i._destroyUBOs=function(){this._descriptorSet&&(this._descriptorSet.getBuffer(pp.BINDING).destroy(),this._descriptorSet.getBuffer(gp.BINDING).destroy(),this._descriptorSet.getBuffer(mp.BINDING).destroy(),this._descriptorSet.getTexture(yp).destroy(),this._descriptorSet.getTexture(Ip).destroy())},h(e,[{key:"postRenderPass",get:function(){return this._postRenderPass}}]),e}(KD),NN=T((BN=MN).prototype,"renderTextures",[xN,Eh,PN],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),DN=BN))||DN)),MM=[new Pr(0,0,0,0),new Pr(0,0,0,0),new Pr(0,0,0,0)],LM=t("GbufferStage",(LN=_h("GbufferStage"),FN=Kh([$D]),UN=zh(),LN((VN=HN=function(t){function e(){var e;return E(e=t.call(this)||this,"renderQueues",zN,g(e)),e._renderQueues=[],e._renderArea=new Sr,e._batchedQueue=void 0,e._instancedQueue=void 0,e._phaseID=yy("default"),e._batchedQueue=new oB,e._instancedQueue=new uB,e}c(e,t);var i=e.prototype;return i.initialize=function(e){return t.prototype.initialize.call(this,e),e.renderQueues&&(this.renderQueues=e.renderQueues),!0},i.activate=function(e,i){t.prototype.activate.call(this,e,i);for(var n=0;n<this.renderQueues.length;n++)this._renderQueues[n]=nB(this.renderQueues[n])},i.destroy=function(){},i.render=function(t){this._instancedQueue.clear(),this._batchedQueue.clear();var e=this._pipeline,i=e.device;this._renderQueues.forEach(rB),e.generateRenderArea(t,this._renderArea),e.updateQuadVertexData(this._renderArea,t.window);for(var n=e.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 l=h[r],c=l.passes;for(s=0;s<c.length;++s){var _=c[s];if(_.phase===this._phaseID){var f=_.batchingScheme;if(f===my.INSTANCING){var d=_.getInstancedBuffer();d.merge(l,s),this._instancedQueue.queue.add(d)}else if(f===my.VB_MERGING){var p=_.getBatchedBuffer();p.merge(l,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(sB);var m=e.commandBuffers[0];this._instancedQueue.uploadBuffers(m),this._batchedQueue.uploadBuffers(m),t.clearFlag&cr.COLOR&&(e.pipelineSceneData.isHDR?Oy(MM[0],t.clearColor):(MM[0].x=t.clearColor.x,MM[0].y=t.clearColor.y,MM[0].z=t.clearColor.z)),MM[0].w=t.clearColor.w;var g=e.getPipelineRenderData().gbufferFrameBuffer,v=g.renderPass;m.beginRenderPass(v,g,this._renderArea,MM,t.clearDepth,t.clearStencil),m.setScissor(e.generateScissor(t)),m.setViewport(e.generateViewport(t)),m.bindDescriptorSet(lp.GLOBAL,e.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()},e}(eP),HN.initInfo={name:"GbufferStage",priority:mP.GBUFFER,tag:0,renderQueues:[{isTransparent:!1,sortMode:qD.FRONT_TO_BACK,stages:["default"]},{isTransparent:!0,sortMode:qD.BACK_TO_FRONT,stages:["default"]}]},zN=T((kN=VN).prototype,"renderQueues",[FN,Eh,UN],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),GN=kN))||GN)),FM=[new Pr(0,0,0,1)],UM=t("LightingStage",(WN=_h("LightingStage"),XN=Kh(Vy),jN=zh(),YN=Kh([$D]),KN=zh(),WN((tM=$N=function(t){function e(){var e;return(e=t.call(this)||this)._deferredLitsBufs=null,e._maxDeferredLights=Lp.LIGHTS_PER_PASS,e._lightMeterScale=1e4,e._descriptorSet=null,e._renderArea=new Sr,e._uiPhase=void 0,E(e,"_deferredMaterial",ZN,g(e)),E(e,"renderQueues",JN,g(e)),e._phaseID=yy("default"),e._renderQueues=[],e._uiPhase=new eN,e}c(e,t);var i=e.prototype;return i.initialize=function(e){return t.prototype.initialize.call(this,e),!0},i.gatherLights=function(t){for(var e=this._pipeline,i=e.commandBuffers[0],n=t.scene.sphereLights,r=t.scene.spotLights,s=To.create(0,0,0,1),a=new Float32Array(4),o=t.exposure,u=0,h=Li.length,l=h*this._maxDeferredLights,c=0;c<n.length&&u<this._maxDeferredLights;c++,++u){var _=n[c];if(To.set(s,_.position.x,_.position.y,_.position.z,_.range),bu.sphereFrustum(s,t.frustum)){if(ji.toArray(a,_.position),a[3]=0,this._lightBufferData.set(a,u*h),ji.toArray(a,_.color),_.useColorTemperature){var f=_.colorTemperatureRGB;a[0]*=f.x,a[1]*=f.y,a[2]*=f.z}e.pipelineSceneData.isHDR?a[3]=_.luminance*o*this._lightMeterScale:a[3]=_.luminance,this._lightBufferData.set(a,u*h+1*l),a[0]=_.size,a[1]=_.range,a[2]=0,this._lightBufferData.set(a,u*h+2*l)}}for(var d=0;d<r.length&&u<this._maxDeferredLights;d++,++u){var p=r[d];if(To.set(s,p.position.x,p.position.y,p.position.z,p.range),bu.sphereFrustum(s,t.frustum)){if(ji.toArray(a,p.position),a[3]=1,this._lightBufferData.set(a,u*h+0*l),ji.toArray(a,p.color),p.useColorTemperature){var m=p.colorTemperatureRGB;a[0]*=m.x,a[1]*=m.y,a[2]*=m.z}e.pipelineSceneData.isHDR?a[3]=p.luminance*o*this._lightMeterScale:a[3]=p.luminance,this._lightBufferData.set(a,u*h+1*l),a[0]=p.size,a[1]=p.range,a[2]=p.spotAngle,this._lightBufferData.set(a,u*h+2*l),ji.toArray(a,p.direction),this._lightBufferData.set(a,u*h+3*l)}}var g=3*l+3;this._lightBufferData.set([u],g),i.updateBuffer(this._deferredLitsBufs,this._lightBufferData)},i._createStageDescriptor=function(t){var e=this._pipeline.device,i=16*Float32Array.BYTES_PER_ELEMENT*this._maxDeferredLights;i=Math.ceil(i/e.capabilities.uboOffsetAlignment)*e.capabilities.uboOffsetAlignment,this._deferredLitsBufs=e.createBuffer(new Mr(Dn.UNIFORM|Dn.TRANSFER_DST,Mn.HOST|Mn.DEVICE,i,e.capabilities.uboOffsetAlignment));var n=e.createBuffer(new Lr(this._deferredLitsBufs,0,i));this._lightBufferData=new Float32Array(i/Float32Array.BYTES_PER_ELEMENT),this._descriptorSet=e.createDescriptorSet(new _s(t.localSetLayout)),this._descriptorSet.bindBuffer(Mp.BINDING,n);var r=e.createBuffer(new Mr(Dn.UNIFORM|Dn.TRANSFER_DST,Mn.DEVICE,Pp.SIZE,Pp.SIZE));this._descriptorSet.bindBuffer(Pp.BINDING,r)},i.activate=function(e,i){t.prototype.activate.call(this,e,i),this._uiPhase.activate(e);for(var n=0;n<this.renderQueues.length;n++)this._renderQueues[n]=nB(this.renderQueues[n]);this._planarQueue=new tN(this._pipeline),this._deferredMaterial&&(e.pipelineSceneData.deferredLightingMaterial=this._deferredMaterial)},i.destroy=function(){var t;null===(t=this._deferredLitsBufs)||void 0===t||t.destroy(),this._deferredLitsBufs=null,this._descriptorSet=null},i.render=function(t){var e,i=this._pipeline,n=i.device,r=i.commandBuffers[0],s=i.pipelineSceneData,a=s.renderObjects;this._planarQueue.gatherShadowPasses(t,r),i.generateRenderArea(t,this._renderArea);for(var o=i.getPipelineRenderData(),u=s.deferredLightingMaterial.passes[0],h=u.getShaderVariant(),l=0;l<3;++l)u.descriptorSet.bindTexture(l,o.gbufferRenderTargets[l]),u.descriptorSet.bindSampler(l,o.sampler);u.descriptorSet.bindTexture(3,o.outputDepth),u.descriptorSet.bindSampler(3,o.sampler),u.descriptorSet.update(),this._descriptorSet||this._createStageDescriptor(u),this.gatherLights(t),t.clearFlag&cr.COLOR&&(FM[0].x=t.clearColor.x,FM[0].y=t.clearColor.y,FM[0].z=t.clearColor.z),FM[0].w=0;var c=o.outputFrameBuffer,_=c.renderPass;i.pipelineUBO.updateShadowUBO(t),r.beginRenderPass(_,c,this._renderArea,FM,t.clearDepth,t.clearStencil),r.setScissor(i.generateScissor(t)),r.setViewport(i.generateViewport(t)),r.bindDescriptorSet(lp.GLOBAL,i.descriptorSet);var f=i.quadIAOffscreen,d=null;null!=u&&null!=h&&null!=f&&(d=Cy.getOrCreatePipelineState(n,u,h,_,f)),null!=d&&(this._descriptorSet.update(),r.bindPipelineState(d),r.bindDescriptorSet(lp.MATERIAL,u.descriptorSet),r.bindDescriptorSet(lp.LOCAL,this._descriptorSet),r.bindInputAssembler(f),r.draw(f)),this._renderQueues.forEach(rB);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(sB);for(var S=0;S<this._renderQueues.length;S++)this._renderQueues[S].recordCommandBuffer(n,_,r);this._planarQueue.recordCommandBuffer(n,_,r)}null===(e=t.geometryRenderer)||void 0===e||e.render(_,r,i.pipelineSceneData),this._uiPhase.render(t,_),r.endRenderPass()},e}(eP),$N.initInfo={name:"LightingStage",priority:mP.LIGHTING,tag:0},ZN=T((QN=tM).prototype,"_deferredMaterial",[XN,Eh,jN],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),JN=T(QN.prototype,"renderQueues",[YN,Eh,KN],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),qN=QN))||qN)),GM=[new Pr(0,0,0,1)],kM=t("PostProcessStage",(eM=_h("PostProcessStage"),iM=Kh(Vy),nM=zh(),rM=Kh([$D]),sM=zh(),eM((cM=lM=function(t){function e(){var e;return E(e=t.call(this)||this,"_postProcessMaterial",uM,g(e)),E(e,"renderQueues",hM,g(e)),e._renderArea=new Sr,e._stageDesc=void 0,e._localUBO=void 0,e._uiPhase=new eN,e}c(e,t);var i=e.prototype;return i.initialize=function(e){return t.prototype.initialize.call(this,e),!0},i.activate=function(e,i){t.prototype.activate.call(this,e,i),this._postProcessMaterial&&(e.pipelineSceneData.postprocessMaterial=this._postProcessMaterial),this._uiPhase.activate(e)},i.destroy=function(){},i.render=function(t){var e=this._pipeline,i=e.device,n=e.pipelineSceneData,r=e.commandBuffers[0];e.pipelineUBO.updateCameraUBO(t);var s=t.viewport;this._renderArea.x=s.x*t.window.width,this._renderArea.y=s.y*t.window.height,this._renderArea.width=s.width*t.window.width,this._renderArea.height=s.height*t.window.height;var a=e.getPipelineRenderData(),o=t.window.framebuffer,u=e.getRenderPass(t.clearFlag,o);t.clearFlag&cr.COLOR&&(GM[0].x=t.clearColor.x,GM[0].y=t.clearColor.y,GM[0].z=t.clearColor.z),GM[0].w=t.clearColor.w,r.beginRenderPass(u,o,this._renderArea,GM,t.clearDepth,t.clearStencil),r.bindDescriptorSet(lp.GLOBAL,e.descriptorSet);var h=n.postprocessMaterial.passes[0],l=h.getShaderVariant();e.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 c=t.window.swapchain?e.quadIAOnscreen:e.quadIAOffscreen,_=null;null!=h&&null!=l&&null!=c&&(_=Cy.getOrCreatePipelineState(i,h,l,u,c));var f=e.pipelineSceneData.renderObjects;null!=_&&f.length>0&&(this._stageDesc||(this._stageDesc=i.createDescriptorSet(new _s(h.localSetLayout)),this._localUBO=i.createBuffer(new Mr(Dn.UNIFORM|Dn.TRANSFER_DST,Mn.DEVICE,Pp.SIZE,Pp.SIZE)),this._stageDesc.bindBuffer(Pp.BINDING,this._localUBO)),this._stageDesc.update(),r.bindPipelineState(_),r.bindDescriptorSet(lp.MATERIAL,h.descriptorSet),r.bindDescriptorSet(lp.LOCAL,this._stageDesc),r.bindInputAssembler(c),r.draw(c)),this._uiPhase.render(t,u),zy(i,u,r,e.profiler,t),r.endRenderPass()},e}(eP),lM.initInfo={name:"PostProcessStage",priority:fP.POST_PROCESS,tag:0},uM=T((oM=cM).prototype,"_postProcessMaterial",[iM,Eh,nM],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),hM=T(oM.prototype,"renderQueues",[rM,Eh,sM],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),aM=oM))||aM));!function(t){t[t.NONE=0]="NONE",t[t.FXAA=1]="FXAA"}(_M||(_M={}));var zM,HM,VM,WM,XM,jM,YM,KM,qM=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._antiAliasing=_M.NONE,e}c(e,t);var i=e.prototype;return i.updatePipelineSceneData=function(){this.updatePipelinePassInfo()},i.updateBloomPass=function(){if(this._bloomMaterial){var t=this._bloomMaterial.passes[0];t.beginChangeStatesSilently(),t.tryCompile(),t.endChangeStatesSilently();for(var e=0;e<6;++e){var i=this._bloomMaterial.passes[1+e];i.beginChangeStatesSilently(),i.tryCompile(),i.endChangeStatesSilently();var n=this._bloomMaterial.passes[7+e];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 t=this.postprocessMaterial.passes[0];t.beginChangeStatesSilently(),t.tryCompile(),t.endChangeStatesSilently()}},i.initPipelinePassInfo=function(){var t=new Vy;t._uuid="builtin-deferred-material",t.initialize({effectName:"pipeline/deferred-lighting"});for(var e=0;e<t.passes.length;++e)t.passes[e].tryCompile();this._deferredLightingMaterial=t;var i=new Vy;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 Vy;r._uuid="builtin-post-process-material",Ee.ENABLE_ANTIALIAS_FXAA&&(this._antiAliasing=_M.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(e){return t.prototype.activate.call(this,e),this.initPipelinePassInfo(),!0},i.updateDeferredPassInfo=function(){this.updateDeferredLightPass()},i.updateDeferredLightPass=function(){if(this._deferredLightingMaterial){b.director.root.pipeline.macros.CC_RECEIVE_SHADOW=1;var t=this._deferredLightingMaterial.passes[0];t.beginChangeStatesSilently(),t.tryCompile(),t.endChangeStatesSilently()}},h(e,[{key:"antiAliasing",get:function(){return this._antiAliasing},set:function(t){if(this._antiAliasing=t,this._postprocessMaterial){var e=this._postprocessMaterial.passes[0].defines;Object.assign(e,{ANTIALIAS_TYPE:t});var i=new Vy;i.initialize({effectAsset:this._postprocessMaterial.effectAsset,defines:e});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(t){this._bloomMaterial!==t&&t&&(this._bloomMaterial=t,this.updatePipelinePassInfo())}},{key:"postprocessMaterial",get:function(){return this._postprocessMaterial},set:function(t){this._postprocessMaterial!==t&&t&&(this._postprocessMaterial=t,this.updatePipelinePassInfo())}},{key:"deferredLightingMaterial",get:function(){return this._deferredLightingMaterial},set:function(t){this._deferredLightingMaterial!==t&&t&&(this._deferredLightingMaterial=t,this.updatePipelinePassInfo())}}]),e}(BM),QM=[new Pr(0,0,0,1)],ZM=function(){};ZM.SIZE=4*(ZM.COUNT=4+(ZM.TEXTURE_SIZE_OFFSET=0));var JM,$M,tL,eL,iL,nL,rL,sL,aL,oL,uL=t("BloomStage",(zM=_h("BloomStage"),HM=Kh(Vy),VM=zh(),zM((KM=YM=function(t){function e(){var e;return(e=t.call(this)||this).threshold=1,e.intensity=.8,e.iterations=2,E(e,"_bloomMaterial",jM,g(e)),e._renderArea=new Sr,e._bloomUBO=[],e}c(e,t);var i=e.prototype;return i.initialize=function(e){return t.prototype.initialize.call(this,e),!0},i.activate=function(e,i){t.prototype.activate.call(this,e,i),this._bloomMaterial&&(e.pipelineSceneData.bloomMaterial=this._bloomMaterial)},i.destroy=function(){},i.render=function(t){var e,i=this._pipeline;if(i.generateBloomRenderData(),((null===(e=t.window)||void 0===e?void 0:e.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 Mr(Dn.UNIFORM|Dn.TRANSFER_DST,Mn.HOST|Mn.DEVICE,ZM.SIZE,ZM.SIZE));t.clearFlag&cr.COLOR&&(QM[0].x=t.clearColor.x,QM[0].y=t.clearColor.y,QM[0].z=t.clearColor.z),QM[0].w=t.clearColor.w,this._prefilterPass(t,i),this._downsamplePass(t,i),this._upsamplePass(t,i),this._combinePass(t,i)}},i._prefilterPass=function(t,e){e.generateRenderArea(t,this._renderArea),this._renderArea.width>>=1,this._renderArea.height>>=1;var i=e.commandBuffers[0],n=e.pipelineSceneData.bloomMaterial.passes[0],r=e.getPipelineRenderData(),s=r.bloom,a=new Float32Array(ZM.COUNT);a[ZM.TEXTURE_SIZE_OFFSET+2]=this.threshold,i.updateBuffer(this._bloomUBO[0],a),i.beginRenderPass(s.renderPass,s.prefilterFramebuffer,this._renderArea,QM,0,0),i.bindDescriptorSet(lp.GLOBAL,e.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(lp.MATERIAL,n.descriptorSet);var o=t.window.swapchain?e.quadIAOffscreen:e.quadIAOnscreen,u=null,h=n.getShaderVariant();null!=n&&null!=h&&null!=o&&(u=Cy.getOrCreatePipelineState(e.device,n,h,s.renderPass,o)),null!=u&&(i.bindPipelineState(u),i.bindInputAssembler(o),i.draw(o)),i.endRenderPass()},i._downsamplePass=function(t,e){e.generateRenderArea(t,this._renderArea),this._renderArea.width>>=1,this._renderArea.height>>=1;for(var i=e.commandBuffers[0],n=e.pipelineSceneData.bloomMaterial,r=e.getPipelineRenderData().bloom,s=new Float32Array(ZM.COUNT),a=0;a<this.iterations;++a){s[ZM.TEXTURE_SIZE_OFFSET+0]=this._renderArea.width,s[ZM.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,QM,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(lp.MATERIAL,o.descriptorSet);var h=t.window.swapchain?e.quadIAOffscreen:e.quadIAOnscreen,l=null;null!=o&&null!=u&&null!=h&&(l=Cy.getOrCreatePipelineState(e.device,o,u,r.renderPass,h)),null!=l&&(i.bindPipelineState(l),i.bindInputAssembler(h),i.draw(h)),i.endRenderPass()}},i._upsamplePass=function(t,e){var i=e.getPipelineRenderData().bloom;e.generateRenderArea(t,this._renderArea),this._renderArea.width>>=this.iterations+1,this._renderArea.height>>=this.iterations+1;for(var n=e.commandBuffers[0],r=e.pipelineSceneData.bloomMaterial,s=new Float32Array(ZM.COUNT),a=0;a<this.iterations;++a){var o=a+6+1;s[ZM.TEXTURE_SIZE_OFFSET+0]=this._renderArea.width,s[ZM.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,QM,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(lp.MATERIAL,u.descriptorSet);var l=t.window.swapchain?e.quadIAOffscreen:e.quadIAOnscreen,c=null;null!=u&&null!=h&&null!=l&&(c=Cy.getOrCreatePipelineState(e.device,u,h,i.renderPass,l)),null!=c&&(n.bindPipelineState(c),n.bindInputAssembler(l),n.draw(l)),n.endRenderPass()}},i._combinePass=function(t,e){e.generateRenderArea(t,this._renderArea);var i=e.commandBuffers[0],n=e.pipelineSceneData.bloomMaterial,r=e.getPipelineRenderData(),s=r.bloom,a=new Float32Array(ZM.COUNT);a[ZM.TEXTURE_SIZE_OFFSET+3]=this.intensity,i.updateBuffer(this._bloomUBO[13],a),i.beginRenderPass(s.renderPass,s.combineFramebuffer,this._renderArea,QM,0,0),i.bindDescriptorSet(lp.GLOBAL,e.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(lp.MATERIAL,o.descriptorSet);var u=t.window.swapchain?e.quadIAOffscreen:e.quadIAOnscreen,h=null,l=o.getShaderVariant();null!=o&&null!=l&&null!=u&&(h=Cy.getOrCreatePipelineState(e.device,o,l,s.renderPass,u)),null!=h&&(i.bindPipelineState(h),i.bindInputAssembler(u),i.draw(u)),i.endRenderPass()},e}(eP),YM.initInfo={name:"BloomStage",priority:fP.BLOOM,tag:0},jM=T((XM=KM).prototype,"_bloomMaterial",[HM,Eh,VM],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),WM=XM))||WM)),hL=t("MainFlow",_h("MainFlow")((tL=$M=function(t){function e(){return t.apply(this,arguments)||this}c(e,t);var i=e.prototype;return i.initialize=function(e){if(t.prototype.initialize.call(this,e),0===this._stages.length){var i=new LM;i.initialize(LM.initInfo),this._stages.push(i);var n=new UM;n.initialize(UM.initInfo),this._stages.push(n);var r=new uL;r.initialize(uL.initInfo),this._stages.push(r);var s=new kM;s.initialize(kM.initInfo),this._stages.push(s)}return!0},i.activate=function(e){t.prototype.activate.call(this,e)},i.render=function(e){t.prototype.render.call(this,e)},i.destroy=function(){t.prototype.destroy.call(this)},e}(nP),$M.initInfo={name:ep,priority:gP.MAIN,stages:[]},JM=tL))||JM),lL=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).gbufferFrameBuffer=null,e.gbufferRenderTargets=[],e}return c(e,t),e}((function(){this.outputFrameBuffer=null,this.outputRenderTargets=[],this.outputDepth=null,this.sampler=null,this.bloom=null})),cL=t("DeferredPipeline",(eL=_h("DeferredPipeline"),iL=Kh([QD]),nL=zh(),eL((oL=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._gbufferRenderPass=null,e._lightingRenderPass=null,E(e,"renderTextures",aL,g(e)),e}c(e,t);var i=e.prototype;return i.initialize=function(e){if(t.prototype.initialize.call(this,e),0===this._flows.length){var i=new vN;i.initialize(vN.initInfo),this._flows.push(i);var n=new hL;n.initialize(hL.initInfo),this._flows.push(n)}return!0},i.activate=function(e){return this._macros={CC_PIPELINE_TYPE:1},this._pipelineSceneData=new qM,!(!t.prototype.activate.call(this,e)||!this._activeRenderer(e)&&(K(2402),1))},i.destroy=function(){this._destroyUBOs(),this._destroyQuadInputAssembler(),this._destroyDeferredData();for(var e=this._renderPasses.values(),i=e.next();!i.done;)i.value.destroy(),i=e.next();return this._commandBuffers.length=0,t.prototype.destroy.call(this)},i.onGlobalPipelineStateChanged=function(){this.pipelineSceneData.updatePipelineSceneData()},i.getPipelineRenderData=function(){return this._pipelineRenderData||this._generateDeferredRenderData(),this._pipelineRenderData},i._activeRenderer=function(t){var e=this.device;this._commandBuffers.push(e.commandBuffer);var i=this.globalDSManager.pointSampler;this._descriptorSet.bindSampler(yp,i),this._descriptorSet.bindTexture(yp,vy.get("default-texture").getGFXTexture()),this._descriptorSet.bindSampler(Ip,i),this._descriptorSet.bindTexture(Ip,vy.get("default-texture").getGFXTexture()),this._descriptorSet.update();var n=new YD;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 es;s.format=On.RGBA16F,s.loadOp=Qn.CLEAR,s.storeOp=Zn.STORE;var a=new es;a.format=On.RGBA16F,a.loadOp=Qn.CLEAR,a.storeOp=Zn.STORE;var o=new es;o.format=On.RGBA16F,o.loadOp=Qn.CLEAR,o.storeOp=Zn.STORE;var u=new is;u.format=On.DEPTH_STENCIL,u.depthLoadOp=Qn.CLEAR,u.depthStoreOp=Zn.STORE,u.stencilLoadOp=Qn.CLEAR,u.stencilStoreOp=Zn.STORE;var h=new ss([s,a,o],u);this._gbufferRenderPass=e.createRenderPass(h)}if(!this._lightingRenderPass){var l=new es;l.format=On.RGBA8,l.loadOp=Qn.CLEAR,l.storeOp=Zn.STORE,l.barrier=e.getGeneralBarrier(new as(Jn.NONE,Jn.COLOR_ATTACHMENT_WRITE));var c=new is;c.format=On.DEPTH_STENCIL,c.depthLoadOp=Qn.LOAD,c.depthStoreOp=Zn.DISCARD,c.stencilLoadOp=Qn.LOAD,c.stencilStoreOp=Zn.DISCARD,l.barrier=e.getGeneralBarrier(new as(Jn.DEPTH_STENCIL_ATTACHMENT_WRITE,Jn.DEPTH_STENCIL_ATTACHMENT_WRITE));var _=new ss([l],c);this._lightingRenderPass=e.createRenderPass(_)}return this._width=t.width,this._height=t.height,this._generateDeferredRenderData(),!0},i._destroyUBOs=function(){this._descriptorSet&&(this._descriptorSet.getBuffer(pp.BINDING).destroy(),this._descriptorSet.getBuffer(gp.BINDING).destroy(),this._descriptorSet.getBuffer(mp.BINDING).destroy(),this._descriptorSet.getTexture(yp).destroy(),this._descriptorSet.getTexture(Ip).destroy())},i._destroyDeferredData=function(){var t=this._pipelineRenderData;if(t){t.gbufferFrameBuffer&&t.gbufferFrameBuffer.destroy(),t.outputFrameBuffer&&t.outputFrameBuffer.destroy(),t.outputDepth&&t.outputDepth.destroy();for(var e=0;e<t.gbufferRenderTargets.length;e++)t.gbufferRenderTargets[e].destroy();t.gbufferRenderTargets.length=0;for(var i=0;i<t.outputRenderTargets.length;i++)t.outputRenderTargets[i].destroy();t.outputRenderTargets.length=0,this._destroyBloomData()}this._pipelineRenderData=null},i._ensureEnoughSize=function(t){for(var e=this._width,i=this._height,n=0;n<t.length;++n){var r=t[n].window;e=Math.max(r.width,e),i=Math.max(r.height,i)}e===this._width&&i===this._height||(this._width=e,this._height=i,this._destroyDeferredData(),this._generateDeferredRenderData())},i._generateDeferredRenderData=function(){for(var t=this,e=this.device,i=this._pipelineRenderData=new lL,n=this.pipelineSceneData,r=0;r<3;++r)i.gbufferRenderTargets.push(e.createTexture(new kr(Ln.TEX2D,Fn.COLOR_ATTACHMENT|Fn.SAMPLED,On.RGBA16F,this._width*n.shadingScale,this._height*n.shadingScale)));i.outputDepth=e.createTexture(new kr(Ln.TEX2D,Fn.DEPTH_STENCIL_ATTACHMENT|Fn.SAMPLED,On.DEPTH_STENCIL,this._width*n.shadingScale,this._height*n.shadingScale)),i.gbufferFrameBuffer=e.createFramebuffer(new hs(this._gbufferRenderPass,i.gbufferRenderTargets,i.outputDepth)),i.outputRenderTargets.push(e.createTexture(new kr(Ln.TEX2D,Fn.COLOR_ATTACHMENT|Fn.SAMPLED,On.RGBA16F,this._width*n.shadingScale,this._height*n.shadingScale))),i.outputFrameBuffer=e.createFramebuffer(new hs(this._lightingRenderPass,i.outputRenderTargets,null)),i.sampler=this.globalDSManager.pointSampler,this.on(iP.ATTACHMENT_SCALE_CAHNGED,(function(e){i.sampler=e<1?t.globalDSManager.pointSampler:t.globalDSManager.linearSampler,i.gbufferFrameBuffer=t.newFramebufferByRatio(i.gbufferFrameBuffer),i.gbufferFrameBuffer=t.newFramebufferByRatio(i.outputFrameBuffer)}))},e}(KD),aL=T((sL=oL).prototype,"renderTextures",[iL,Eh,nL],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),rL=sL))||rL));function _L(){var t=new NM;return t.initialize({flows:[]}),t}var fL=new _n,dL=function(){var t=e.prototype;function e(){this._curTime=0}return t.init=function(){var t,e,i,n,r,s,a,o=this;return this.settings={enabled:null===(t=ye.querySettings(ve.Category.SPLASH_SCREEN,"enabled"))||void 0===t||t,totalTime:null!==(e=ye.querySettings(ve.Category.SPLASH_SCREEN,"totalTime"))&&void 0!==e?e:3e3,base64src:null!==(i=ye.querySettings(ve.Category.SPLASH_SCREEN,"base64src"))&&void 0!==i?i:"",effect:null!==(n=ye.querySettings(ve.Category.SPLASH_SCREEN,"effect"))&&void 0!==n?n:"FADE-INOUT",clearColor:null!==(r=ye.querySettings(ve.Category.SPLASH_SCREEN,"clearColor"))&&void 0!==r?r:new Pr(.88,.88,.88,1),displayRatio:null!==(s=ye.querySettings(ve.Category.SPLASH_SCREEN,"displayRatio"))&&void 0!==s?s:.4,displayWatermark:null===(a=ye.querySettings(ve.Category.SPLASH_SCREEN,"displayWatermark"))||void 0===a||a},this._curTime=0,!this.settings.enabled||""===this.settings.base64src||this.settings.totalTime<=0?(this.settings.totalTime=0,Promise.resolve()):(this.device=b.director.root.device,this.swapchain=b.director.root.mainWindow.swapchain,this.framebuffer=b.director.root.mainWindow.framebuffer,this.preInit(),this.settings.displayWatermark&&this.initWarterMark(),new Promise((function(t,e){o.logoImage=new Image,o.logoImage.onload=function(){o.initLogo(),t()},o.logoImage.onerror=function(){e()},o.logoImage.src=o.settings.base64src})))},t.preInit=function(){var t=this.settings.clearColor;this.clearColors=[new Pr(t.x,t.y,t.z,t.w)];var e=this.device,i=this.swapchain;this.renderArea=new Sr(0,0,i.width,i.height),this.cmdBuff=e.commandBuffer;var n=new Float32Array([.5,.5,1,0,-.5,.5,0,0,.5,-.5,1,1,-.5,-.5,0,1]),r=4*Float32Array.BYTES_PER_ELEMENT,s=4*r;this.vertexBuffers=e.createBuffer(new Mr(Dn.VERTEX|Dn.TRANSFER_DST,Mn.DEVICE,s,r)),this.vertexBuffers.update(n);var a=new Uint16Array([0,1,2,1,3,2]),o=Uint16Array.BYTES_PER_ELEMENT,u=6*o;this.indicesBuffers=e.createBuffer(new Mr(Dn.INDEX|Dn.TRANSFER_DST,Mn.DEVICE,u,o)),this.indicesBuffers.update(a);var h=[new Jr("a_position",On.RG32F),new Jr("a_texCoord",On.RG32F)],l=new ts(h,[this.vertexBuffers],this.indicesBuffers);this.quadAssmebler=e.createInputAssembler(l),this.projection=new un,un.ortho(this.projection,-1,1,-1,1,-1,1,e.capabilities.clipSpaceMinZ,e.capabilities.clipSpaceSignY,i.surfaceTransform)},t.update=function(t){var e=this.settings,i=this.device,n=this.swapchain;un.ortho(this.projection,-1,1,-1,1,-1,1,i.capabilities.clipSpaceMinZ,i.capabilities.clipSpaceSignY,n.surfaceTransform);var r=n.width,s=n.height,a=r<s?r:s;this._curTime+=1e3*t;var o=D_(yi(this._curTime/e.totalTime));"NONE"===e.effect&&(o=1);var u=this.logoTexture.width,h=this.logoTexture.height,l=a*e.displayRatio,c=l*u/h,_=l;if(n.surfaceTransform!==wn.ROTATE_90&&n.surfaceTransform!==wn.ROTATE_270||(c=l*r/s,_=l*h/u*s/r),this.logoMat.setProperty("resolution",fL.set(r,s),0),this.logoMat.setProperty("scale",fL.set(c,_),0),this.logoMat.setProperty("translate",fL.set(.5*r,.5*s),0),this.logoMat.setProperty("percent",o),this.logoMat.setProperty("u_projection",this.projection),this.logoMat.passes[0].update(),e.displayWatermark&&this.watermarkMat){var f=.5*a,d=this.watermarkTexture.width,p=f,m=f*this.watermarkTexture.height/d;n.surfaceTransform!==wn.ROTATE_90&&n.surfaceTransform!==wn.ROTATE_270||(p=.5*f,m=f*r/s*.5),this.watermarkMat.setProperty("resolution",fL.set(r,s),0),this.watermarkMat.setProperty("scale",fL.set(p,m),0),this.watermarkMat.setProperty("translate",fL.set(.5*r,.1*s),0),this.watermarkMat.setProperty("percent",o),this.watermarkMat.setProperty("u_projection",this.projection),this.watermarkMat.passes[0].update()}this.frame()},t.initLogo=function(){var t=this.device;this.logoMat=new Vy,this.logoMat.initialize({effectName:"util/splash-screen"});var e=new Hr;e.addressU=Vn.CLAMP,e.addressV=Vn.CLAMP,e.addressW=Vn.CLAMP,this.sampler=t.getSampler(e),this.logoTexture=t.createTexture(new kr(Ln.TEX2D,Fn.SAMPLED|Fn.TRANSFER_DST,On.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 Ir;s.texExtent.width=this.logoImage.width,s.texExtent.height=this.logoImage.height,s.texExtent.depth=1,t.copyTexImagesToTexture([this.logoImage],this.logoTexture,[s])},t.initWarterMark=function(){var t=document.createElement("canvas");t.width=330,t.height=30,t.style.width=""+t.width,t.style.height=""+t.height;var e=t.getContext("2d");e.font="18px Arial",e.textBaseline="top",e.textAlign="left",e.fillStyle="`#424242`";var i="Powered by Cocos Creator",n=e.measureText(i);e.fillText(i,(330-n.width)/2,6);var r=new Ir;r.texExtent.width=t.width,r.texExtent.height=t.height,r.texExtent.depth=1,this.watermarkTexture=this.device.createTexture(new kr(Ln.TEX2D,Fn.SAMPLED|Fn.TRANSFER_DST,On.RGBA8,t.width,t.height)),this.device.copyTexImagesToTexture([t],this.watermarkTexture,[r]),this.watermarkMat=new Vy,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()},t.frame=function(){var t=this.device,e=this.swapchain;if(!Qa.isXR||xr.entry.isRenderAllowable())for(var i=Qa.isXR?2:1,n=0;n<i;n++){Qa.isXR&&xr.entry.renderLoopStart(n),t.acquire([e]);var r=this.cmdBuff,s=this.framebuffer,a=this.renderArea;a.width=e.width,a.height=e.height,r.begin(),r.beginRenderPass(s.renderPass,s,a,this.clearColors,1,0);var o=this.logoMat.passes[0],u=Cy.getOrCreatePipelineState(t,o,this.shader,s.renderPass,this.quadAssmebler);if(r.bindPipelineState(u),r.bindDescriptorSet(lp.MATERIAL,o.descriptorSet),r.bindInputAssembler(this.quadAssmebler),r.draw(this.quadAssmebler),this.settings.displayWatermark&&this.watermarkMat){var h=this.watermarkMat.passes[0],l=Cy.getOrCreatePipelineState(t,h,this.shader,s.renderPass,this.quadAssmebler);r.bindPipelineState(l),r.bindDescriptorSet(lp.MATERIAL,h.descriptorSet),r.bindInputAssembler(this.quadAssmebler),r.draw(this.quadAssmebler)}r.endRenderPass(),r.end(),t.flushCommands([r]),t.queue.submit([r]),t.present(),Qa.isXR&&xr.entry.renderLoopEnd(n)}},t.destroy=function(){this.device=null,this.swapchain=null,this.clearColors=null,this.logoImage.destroy&&this.logoImage.destroy(),this.logoImage=null,this.framebuffer=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},h(e,[{key:"isFinished",get:function(){return this._curTime>=this.settings.totalTime}},{key:"curTime",get:function(){return this._curTime},set:function(t){this._curTime=t}}],[{key:"instance",get:function(){return e._ins||(e._ins=new e),e._ins}}]),e}();dL._ins=void 0,b.internal.SplashScreen=dL;var pL=new Tt("Scheduler"),mL=function(t,e,i,n){this.target=void 0,this.priority=void 0,this.paused=void 0,this.markedForDeletion=void 0,this.target=t,this.priority=e,this.paused=i,this.markedForDeletion=n};mL.get=function(t,e,i,n){var r=mL._listEntries.pop();return r?(r.target=t,r.priority=e,r.paused=i,r.markedForDeletion=n):r=new mL(t,e,i,n),r},mL.put=function(t){mL._listEntries.length<20&&(t.target=null,mL._listEntries.push(t))},mL._listEntries=[];var gL=function(t,e,i,n){this.list=void 0,this.entry=void 0,this.target=void 0,this.callback=void 0,this.list=t,this.entry=e,this.target=i,this.callback=n};gL.get=function(t,e,i,n){var r=gL._hashUpdateEntries.pop();return r?(r.list=t,r.entry=e,r.target=i,r.callback=n):r=new gL(t,e,i,n),r},gL.put=function(t){gL._hashUpdateEntries.length<20&&(t.list=t.entry=t.target=t.callback=null,gL._hashUpdateEntries.push(t))},gL._hashUpdateEntries=[];var vL=function(t,e,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=t,this.target=e,this.timerIndex=i,this.currentTimer=n,this.currentTimerSalvaged=r,this.paused=s};vL.get=function(t,e,i,n,r,s){var a=vL._hashTimerEntries.pop();return a?(a.timers=t,a.target=e,a.timerIndex=i,a.currentTimer=n,a.currentTimerSalvaged=r,a.paused=s):a=new vL(t,e,i,n,r,s),a},vL.put=function(t){vL._hashTimerEntries.length<20&&(t.timers=t.target=t.currentTimer=null,vL._hashTimerEntries.push(t))},vL._hashTimerEntries=[];var yL=function(){function t(){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 e=t.prototype;return e.initWithCallback=function(t,e,i,n,r,s){return this._lock=!1,this._scheduler=t,this._target=i,this._callback=e,this._elapsed=-1,this._interval=n,this._delay=s,this._useDelay=this._delay>0,this._repeat=r,this._runForever=this._repeat===b.macro.REPEAT_FOREVER,!0},e.getInterval=function(){return this._interval},e.setInterval=function(t){this._interval=t},e.update=function(t){-1===this._elapsed?(this._elapsed=0,this._timesExecuted=0):(this._elapsed+=t,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()))},e.getCallback=function(){return this._callback},e.trigger=function(){this._target&&this._callback&&(this._lock=!0,this._callback.call(this._target,this._elapsed),this._lock=!1)},e.cancel=function(){this._scheduler.unschedule(this._callback,this._target)},t}();yL._timers=[],yL.get=function(){return yL._timers.pop()||new yL},yL.put=function(t){yL._timers.length<20&&!t._lock&&(t._scheduler=t._target=t._callback=null,yL._timers.push(t))};var EL=t("Scheduler",function(t){function e(){var e;return(e=t.call(this)||this)._timeScale=void 0,e._updatesNegList=void 0,e._updates0List=void 0,e._updatesPosList=void 0,e._hashForUpdates=void 0,e._hashForTimers=void 0,e._currentTarget=void 0,e._currentTargetSalvaged=void 0,e._updateHashLocked=void 0,e._arrayForTimers=void 0,e._timeScale=1,e._updatesNegList=[],e._updates0List=[],e._updatesPosList=[],e._hashForUpdates=Bt(!0),e._hashForTimers=Bt(!0),e._currentTarget=null,e._currentTargetSalvaged=!1,e._updateHashLocked=!1,e._arrayForTimers=[],e}c(e,t),e.enableForTarget=function(t){var e=!1;(t.uuid||t.id)&&(e=!0),e||(t.__instanceId?j(1513):t.id=pL.getNewId())};var i=e.prototype;return i.setTimeScale=function(t){this._timeScale=t},i.getTimeScale=function(){return this._timeScale},i.update=function(t){var e,i,n,r,s;for(this._updateHashLocked=!0,1!==this._timeScale&&(t*=this._timeScale),e=0,n=(i=this._updatesNegList).length;e<n;e++)(r=i[e]).paused||r.markedForDeletion||r.target.update(t);for(e=0,n=(i=this._updates0List).length;e<n;e++)(r=i[e]).paused||r.markedForDeletion||r.target.update(t);for(e=0,n=(i=this._updatesPosList).length;e<n;e++)(r=i[e]).paused||r.markedForDeletion||r.target.update(t);var a=this._arrayForTimers;for(e=0;e<a.length;e++){if(s=a[e],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(t),s.currentTimer=null;this._currentTargetSalvaged&&0===this._currentTarget.timers.length&&(this._removeHashElement(this._currentTarget),--e)}for(e=0,i=this._updatesNegList;e<i.length;)(r=i[e]).markedForDeletion?this._removeUpdateFromHash(r):e++;for(e=0,i=this._updates0List;e<i.length;)(r=i[e]).markedForDeletion?this._removeUpdateFromHash(r):e++;for(e=0,i=this._updatesPosList;e<i.length;)(r=i[e]).markedForDeletion?this._removeUpdateFromHash(r):e++;this._updateHashLocked=!1,this._currentTarget=null},i.schedule=function(t,e,i,n,r,s){if("function"!=typeof t){var a=t;t=e,e=a}3!==arguments.length&&4!==arguments.length&&5!==arguments.length||(s=!!n,n=b.macro.REPEAT_FOREVER,r=0),Z(e,1502);var o=e.uuid||e.id;if(o){var u,h,l=this._hashForTimers[o];if(l?l.paused!==s&&j(1511):(l=vL.get(null,e,0,null,null,s),this._arrayForTimers.push(l),this._hashForTimers[o]=l),null==l.timers)l.timers=[];else for(h=0;h<l.timers.length;++h)if((u=l.timers[h])&&t===u._callback)return W(1507,u.getInterval(),i),void(u._interval=i);(u=yL.get()).initWithCallback(this,t,e,i,n,r),l.timers.push(u),this._currentTarget===l&&this._currentTargetSalvaged&&(this._currentTargetSalvaged=!1)}else K(1510)},i.scheduleUpdate=function(t,e,i){var n=t.uuid||t.id;if(n){var r=this._hashForUpdates[n];if(r&&r.entry){if(r.entry.priority===e)return r.entry.markedForDeletion=!1,void(r.entry.paused=i);if(this._updateHashLocked)return W(1506),r.entry.markedForDeletion=!1,void(r.entry.paused=i);this.unscheduleUpdate(t)}var s,a=mL.get(t,e,i,!1);0===e?(s=this._updates0List,this._appendIn(s,a)):(s=e<0?this._updatesNegList:this._updatesPosList,this._priorityIn(s,a,e)),this._hashForUpdates[n]=gL.get(s,a,t,null)}else K(1510)},i.unschedule=function(t,e){if(e&&t){var i=e.uuid||e.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(t===o._callback)return o!==n.currentTimer||n.currentTimerSalvaged||(n.currentTimerSalvaged=!0),r.splice(s,1),yL.put(o),n.timerIndex>=s&&n.timerIndex--,void(0===r.length&&(this._currentTarget===n?this._currentTargetSalvaged=!0:this._removeHashElement(n)))}}else K(1510)}},i.unscheduleUpdate=function(t){if(t){var e=t.uuid||t.id;if(e){var i=this._hashForUpdates[e];i&&(this._updateHashLocked?i.entry.markedForDeletion=!0:this._removeUpdateFromHash(i.entry))}else K(1510)}},i.unscheduleAllForTarget=function(t){if(t){var e=t.uuid||t.id;if(e){var i=this._hashForTimers[e];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++)yL.put(n[r]);n.length=0,this._currentTarget===i?this._currentTargetSalvaged=!0:this._removeHashElement(i)}this.unscheduleUpdate(t)}else K(1510)}},i.unscheduleAll=function(){this.unscheduleAllWithMinPriority(KE.Priority.SCHEDULER)},i.unscheduleAllWithMinPriority=function(t){var e,i,n,r=this._arrayForTimers;for(e=r.length-1;e>=0;e--)i=r[e],this.unscheduleAllForTarget(i.target);var s=0;if(t<0)for(e=0;e<this._updatesNegList.length;)s=this._updatesNegList.length,(n=this._updatesNegList[e])&&n.priority>=t&&this.unscheduleUpdate(n.target),s===this._updatesNegList.length&&e++;if(t<=0)for(e=0;e<this._updates0List.length;)s=this._updates0List.length,(n=this._updates0List[e])&&this.unscheduleUpdate(n.target),s===this._updates0List.length&&e++;for(e=0;e<this._updatesPosList.length;)s=this._updatesPosList.length,(n=this._updatesPosList[e])&&n.priority>=t&&this.unscheduleUpdate(n.target),s===this._updatesPosList.length&&e++},i.isScheduled=function(t,e){Z(t,1508),Z(e,1509);var i=e.uuid||e.id;if(!i)return K(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(t===r[s]._callback)return!0;return!1},i.pauseAllTargets=function(){return this.pauseAllTargetsWithMinPriority(KE.Priority.SCHEDULER)},i.pauseAllTargetsWithMinPriority=function(t){var e,i,n,r,s=[],a=this._arrayForTimers;for(i=0,n=a.length;i<n;i++)(e=a[i])&&(e.paused=!0,s.push(e.target));if(t<0)for(i=0;i<this._updatesNegList.length;i++)(r=this._updatesNegList[i])&&r.priority>=t&&(r.paused=!0,s.push(r.target));if(t<=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>=t&&(r.paused=!0,s.push(r.target));return s},i.resumeTargets=function(t){if(t)for(var e=0;e<t.length;e++)this.resumeTarget(t[e])},i.pauseTarget=function(t){Z(t,1503);var e=t.uuid||t.id;if(e){var i=this._hashForTimers[e];i&&(i.paused=!0);var n=this._hashForUpdates[e];n&&(n.entry.paused=!0)}else K(1510)},i.resumeTarget=function(t){Z(t,1504);var e=t.uuid||t.id;if(e){var i=this._hashForTimers[e];i&&(i.paused=!1);var n=this._hashForUpdates[e];n&&(n.entry.paused=!1)}else K(1510)},i.isTargetPaused=function(t){Z(t,1505);var e=t.uuid||t.id;if(!e)return K(1510),!1;var i=this._hashForTimers[e];if(i)return i.paused;var n=this._hashForUpdates[e];return!!n&&n.entry.paused},i._removeHashElement=function(t){var e=t.target.uuid||t.target.id;delete this._hashForTimers[e];for(var i=this._arrayForTimers,n=0,r=i.length;n<r;n++)if(i[n]===t){i.splice(n,1);break}vL.put(t)},i._removeUpdateFromHash=function(t){var e=t.target.uuid||t.target.id,i=this._hashForUpdates[e];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[e],mL.put(r),gL.put(i)}},i._priorityIn=function(t,e,i){for(var n=0;n<t.length;n++)if(i<t[n].priority)return void t.splice(n,0,e);t.push(e)},i._appendIn=function(t,e){t.push(e)},e}(KE));EL.ID="scheduler",b.Scheduler=EL;var TL,SL=function(){function t(t){this._root=void 0,this._name="",this._cameras=[],this._models=[],this._batches=[],this._directionalLights=[],this._sphereLights=[],this._spotLights=[],this._mainLight=null,this._modelId=0,this._root=t}t.registerCreateFunc=function(e){e._createSceneFun=function(e){return new t(e)}};var e=t.prototype;return e.initialize=function(t){return this._name=t.name,!0},e.update=function(t){var e=this._mainLight;e&&e.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(t),u.updateUBOs(t))}},e.destroy=function(){this.removeCameras(),this.removeSphereLights(),this.removeSpotLights(),this.removeModels()},e.addCamera=function(t){t.attachToScene(this),this._cameras.push(t)},e.removeCamera=function(t){for(var e=0;e<this._cameras.length;++e)if(this._cameras[e]===t)return this._cameras.splice(e,1),void t.detachFromScene()},e.removeCameras=function(){for(var t,e=y(this._cameras);!(t=e()).done;)t.value.detachFromScene();this._cameras.splice(0)},e.setMainLight=function(t){this._mainLight=t},e.unsetMainLight=function(t){if(this._mainLight===t){var e=this._directionalLights;if(e.length)return this.setMainLight(e[e.length-1]),void(this._mainLight.node&&(this._mainLight.node.hasChangedFlags|=AE.ROTATION));this.setMainLight(null)}},e.addDirectionalLight=function(t){t.attachToScene(this),this._directionalLights.push(t)},e.removeDirectionalLight=function(t){for(var e=0;e<this._directionalLights.length;++e)if(this._directionalLights[e]===t)return t.detachFromScene(),void this._directionalLights.splice(e,1)},e.addSphereLight=function(t){t.attachToScene(this),this._sphereLights.push(t)},e.removeSphereLight=function(t){for(var e=0;e<this._sphereLights.length;++e)if(this._sphereLights[e]===t)return t.detachFromScene(),void this._sphereLights.splice(e,1)},e.addSpotLight=function(t){t.attachToScene(this),this._spotLights.push(t)},e.removeSpotLight=function(t){for(var e=0;e<this._spotLights.length;++e)if(this._spotLights[e]===t)return t.detachFromScene(),void this._spotLights.splice(e,1)},e.removeSphereLights=function(){for(var t=0;t<this._sphereLights.length;++t)this._sphereLights[t].detachFromScene();this._sphereLights.length=0},e.removeSpotLights=function(){for(var t=0;t<this._spotLights.length;++t)this._spotLights[t].detachFromScene();this._spotLights=[]},e.addModel=function(t){t.attachToScene(this),this._models.push(t)},e.removeModel=function(t){for(var e=0;e<this._models.length;++e)if(this._models[e]===t)return t.detachFromScene(),void this._models.splice(e,1)},e.removeModels=function(){for(var t,e=y(this._models);!(t=e()).done;){var i=t.value;i.detachFromScene(),i.destroy()}this._models.length=0},e.addBatch=function(t){this._batches.push(t)},e.removeBatch=function(t){for(var e=0;e<this._batches.length;++e)if(this._batches[e]===t)return void this._batches.splice(e,1)},e.removeBatches=function(){this._batches.length=0},e.onGlobalPipelineStateChanged=function(){for(var t,e=y(this._models);!(t=e()).done;)t.value.onGlobalPipelineStateChanged()},e.generateModelId=function(){return this._modelId++},h(t,[{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}}]),t}(),AL=((TL={})[za.PORTRAIT]=wn.IDENTITY,TL[za.LANDSCAPE_RIGHT]=wn.ROTATE_90,TL[za.PORTRAIT_UPSIDE_DOWN]=wn.ROTATE_180,TL[za.LANDSCAPE_LEFT]=wn.ROTATE_270,TL),RL=function(){function t(){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}t.registerCreateFunc=function(e){e._createWindowFun=function(e){return new t(e)}};var e=t.prototype;return e.initialize=function(t,e){if(void 0!==e.title&&(this._title=e.title),void 0!==e.swapchain&&(this._swapchain=e.swapchain),this._width=e.width,this._height=e.height,this._device=t,this._renderPass=t.createRenderPass(e.renderPassInfo),e.swapchain)this._swapchain=e.swapchain,this._colorTextures.push(e.swapchain.colorTexture),this._depthStencilTexture=e.swapchain.depthStencilTexture;else{for(var i=0;i<e.renderPassInfo.colorAttachments.length;i++)this._colorTextures.push(t.createTexture(new kr(Ln.TEX2D,Fn.COLOR_ATTACHMENT|Fn.SAMPLED|Fn.TRANSFER_SRC,e.renderPassInfo.colorAttachments[i].format,this._width,this._height)));e.renderPassInfo.depthStencilAttachment.format!==On.UNKNOWN&&(this._depthStencilTexture=t.createTexture(new kr(Ln.TEX2D,Fn.DEPTH_STENCIL_ATTACHMENT|Fn.SAMPLED,e.renderPassInfo.depthStencilAttachment.format,this._width,this._height)),this._hasOffScreenAttachments=!0)}return this._framebuffer=t.createFramebuffer(new hs(this._renderPass,this._colorTextures,this._depthStencilTexture)),!0},e.destroy=function(){this.clearCameras(),this._framebuffer&&(this._framebuffer.destroy(),this._framebuffer=null),this._depthStencilTexture&&(this._depthStencilTexture.destroy(),this._depthStencilTexture=null);for(var t=0;t<this._colorTextures.length;t++){var e=this._colorTextures[t];e&&e.destroy()}this._colorTextures.length=0,this._device=null},e.resize=function(t,e){if(this._swapchain)this._swapchain.resize(t,e,AL[Xa.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(t,e);this._depthStencilTexture&&this._depthStencilTexture.resize(t,e),this._width=t,this._height=e}this.framebuffer&&(this.framebuffer.destroy(),this._framebuffer=this._device.createFramebuffer(new hs(this._renderPass,this._colorTextures,this._depthStencilTexture)));for(var n,r=y(this._cameras);!(n=r()).done;)n.value.resize(t,e)},e.extractRenderCameras=function(t){for(var e=0;e<this._cameras.length;e++){var i=this._cameras[e];i.enabled&&(i.update(),t.push(i))}},e.attachCamera=function(t){for(var e=0;e<this._cameras.length;e++)if(this._cameras[e]===t)return;this._cameras.push(t),this.sortCameras()},e.detachCamera=function(t){for(var e=0;e<this._cameras.length;++e)if(this._cameras[e]===t)return void this._cameras.splice(e,1)},e.clearCameras=function(){this._cameras.length=0},e.sortCameras=function(){this._cameras.sort((function(t,e){return t.priority-e.priority}))},h(t,[{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}}]),t}(),bL=t("Root",function(){function t(t){var e=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 Nx,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._device=t,this._dataPoolMgr=b.internal.DataPoolManager&&new b.internal.DataPoolManager(t),SL.registerCreateFunc(this),RL.registerCreateFunc(this),this._cameraPool=new da((function(){return new NS(e._device)}),4,(function(t){return t.destroy()}))}var e=t.prototype;return e.initialize=function(){var t,e=Ja.swapchain,i=new es;i.format=e.colorTexture.format;var n=new is;n.format=e.depthStencilTexture.format,n.depthStoreOp=Zn.DISCARD,n.stencilStoreOp=Zn.DISCARD;var r=new ss([i],n);this._mainWindow=this.createWindow({title:"rootMainWindow",width:e.width,height:e.height,renderPassInfo:r,swapchain:e}),this._curWindow=this._mainWindow;var s=ye.querySettings(ve.Category.ANIMATION,"customJointTextureLayouts")||[];null===(t=this._dataPoolMgr)||void 0===t||t.jointTexturePool.registerCustomTextureLayouts(s),this._resizeMaxJointForDS()},e.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()},e.resize=function(t,e){for(var i,n=y(this._windows);!(i=n()).done;){var r=i.value;r.swapchain&&r.resize(t,e)}},e.setRenderPipeline=function(t){t instanceof cL&&(this._useDeferredPipeline=!0);var e=!1;if(t||(t=_L(),e=!0),this._useDeferredPipeline&&this.device.hasFeature(In.COMPUTE_SHADER)||(t.clusterEnabled=!1),t.bloomEnabled=!1,this.usesCustomPipeline&&b.internal.createCustomPipeline?(this._customPipeline=b.internal.createCustomPipeline(),e=!0,this._pipeline=this._customPipeline):(this._classicPipeline=t,this._pipeline=this._classicPipeline,this._pipelineEvent=this._classicPipeline,this._usesCustomPipeline=!1),!this._pipeline.activate(this._mainWindow.swapchain))return e&&this._pipeline.destroy(),this._classicPipeline=null,this._customPipeline=null,this._pipeline=null,this._pipelineEvent=null,!1;var i=b.director.getScene();return i&&i.globals.activate(),this.onGlobalPipelineStateChanged(),!(!this._batcher&&b.internal.Batcher2D&&(this._batcher=new b.internal.Batcher2D(this),!this._batcher.initialize())&&(this.destroy(),1))},e.onGlobalPipelineStateChanged=function(){for(var t=0;t<this._scenes.length;t++)this._scenes[t].onGlobalPipelineStateChanged();this._pipeline.onGlobalPipelineStateChanged()},e.activeWindow=function(t){this._curWindow=t},e.resetCumulativeTime=function(){this._cumulativeTime=0},e.frameMove=function(t){this._frameTime=t,++this._frameCount,this._cumulativeTime+=t,this._fpsTime+=t,this._fpsTime>1&&(this._fps=this._frameCount,this._frameCount=0,this._fpsTime=0);for(var e=0;e<this._scenes.length;++e)this._scenes[e].removeBatches();for(var i=this._windows,n=[],r=0;r<i.length;r++)i[r].extractRenderCameras(n);if(this._pipeline&&n.length>0){this._device.acquire([Ja.swapchain]);var s=this._scenes,a=b.director.getTotalFrames();this._batcher&&(this._batcher.update(),this._batcher.uploadBuffers());for(var o=0;o<s.length;o++)s[o].update(a);b.director.emit(b.Director.EVENT_BEFORE_COMMIT),n.sort((function(t,e){return t.priority-e.priority}));for(var u=0;u<n.length;++u){var h;null===(h=n[u].geometryRenderer)||void 0===h||h.update()}this._pipeline.render(n),this._device.present()}this._batcher&&this._batcher.reset()},e.createWindow=function(t){var e=this._createWindowFun(this);return e.initialize(this.device,t),this._windows.push(e),e},e.destroyWindow=function(t){for(var e=0;e<this._windows.length;++e)if(this._windows[e]===t)return t.destroy(),void this._windows.splice(e,1)},e.destroyWindows=function(){for(var t,e=y(this._windows);!(t=e()).done;)t.value.destroy();this._windows.length=0},e.createScene=function(t){var e=this._createSceneFun(this);return e.initialize(t),this._scenes.push(e),e},e.destroyScene=function(t){for(var e=0;e<this._scenes.length;++e)if(this._scenes[e]===t)return t.destroy(),void this._scenes.splice(e,1)},e.destroyScenes=function(){for(var t,e=y(this._scenes);!(t=e()).done;)t.value.destroy();this._scenes.length=0},e.createModel=function(t){var e=this._modelPools.get(t);e||(this._modelPools.set(t,new da((function(){return new t}),10,(function(t){return t.destroy()}))),e=this._modelPools.get(t));var i=e.alloc();return i.initialize(),i},e.destroyModel=function(t){var e=this._modelPools.get(t.constructor);e?(e.free(t),t.scene&&t.scene.removeModel(t)):j(1300,t.constructor.name),t.destroy()},e.createCamera=function(){return this._cameraPool.alloc()},e.createLight=function(t){var e=this._lightPools.get(t);e||(this._lightPools.set(t,new da((function(){return new t}),4,(function(t){return t.destroy()}))),e=this._lightPools.get(t));var i=e.alloc();return i.initialize(),i},e.destroyLight=function(t){if(t.scene)switch(t.type){case gx.DIRECTIONAL:t.scene.removeDirectionalLight(t);break;case gx.SPHERE:t.scene.removeSphereLight(t);break;case gx.SPOT:t.scene.removeSpotLight(t)}t.destroy()},e.recycleLight=function(t){var e=this._lightPools.get(t.constructor);if(e&&(e.free(t),t.scene))switch(t.type){case gx.DIRECTIONAL:t.scene.removeDirectionalLight(t);break;case gx.SPHERE:t.scene.removeSphereLight(t);break;case gx.SPOT:t.scene.removeSpotLight(t)}},e._resizeMaxJointForDS=function(){var t=Math.floor((Ja.gfxDevice.capabilities.maxVertexUniformVectors-38)/3);kp(t=t<256?t:256)},h(t,[{key:"device",get:function(){return this._device}},{key:"mainWindow",get:function(){return this._mainWindow}},{key:"curWindow",get:function(){return this._curWindow},set:function(t){this._curWindow=t}},{key:"tempWindow",get:function(){return this._tempWindow},set:function(t){this._tempWindow=t}},{key:"windows",get:function(){return this._windows}},{key:"usesCustomPipeline",get:function(){return this._usesCustomPipeline&&""!==Ee.CUSTOM_PIPELINE_NAME}},{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(t){t>0?(this._fixedFPS=t,this._fixedFPSFrameTime=1e3/t):this._fixedFPSFrameTime=0}},{key:"dataPoolManager",get:function(){return this._dataPoolMgr}},{key:"useDeferredPipeline",get:function(){return this._useDeferredPipeline}}]),t}());b.Root=bL;var CL=function(){function t(){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 e=t.prototype;return e.start=function(){var t=this;this._isPlaying||(60===this._targetFrameRate?this._rafHandle=this._rAF.call(window,(function e(){t._isPlaying&&(t._rafHandle=t._rAF.call(window,e)),t._onTick&&t._onTick()})):(this._startTime=performance.now(),this._stHandle=this._stTime((function e(){t._startTime=performance.now(),t._isPlaying&&(t._stHandle=t._stTime(e)),t._onTick&&t._onTick()}))),this._isPlaying=!0)},e.stop=function(){this._isPlaying&&(this._cAF.call(window,this._rafHandle),this._ctTime(this._stHandle),this._rafHandle=this._stHandle=0,this._isPlaying=!1)},e._stTime=function(t){var e=performance.now(),i=Math.max(0,e-this._startTime),n=Math.max(0,this._frameTime-i);return setTimeout(t,n)},e._ctTime=function(t){clearTimeout(t)},h(t,[{key:"targetFrameRate",get:function(){return this._targetFrameRate},set:function(t){this._targetFrameRate!==t&&(this._targetFrameRate=t,this._frameTime=1e3/this._targetFrameRate,this._isPlaying&&(this.stop(),this.start()))}},{key:"onTick",get:function(){return this._onTick},set:function(t){this._onTick=t}}]),t}(),wL=new(function(){function t(){this._allRenderers=[],this._dirtyRenderers=[],this._dirtyVersion=0}var e=t.prototype;return e.addRenderer=function(t){-1===t._internalId&&(t._internalId=this._allRenderers.length,this._allRenderers.push(t))},e.removeRenderer=function(t){if(-1!==t._internalId){var e=t._internalId;this._allRenderers[this._allRenderers.length-1]._internalId=e,le.array.fastRemoveAt(this._allRenderers,e),t._internalId=-1,t._dirtyVersion===this._dirtyVersion&&(le.array.fastRemove(this._dirtyRenderers,t),t._dirtyVersion=-1)}},e.markDirtyRenderer=function(t){t._dirtyVersion!==this._dirtyVersion&&-1!==t._internalId&&(this._dirtyRenderers.push(t),t._dirtyVersion=this._dirtyVersion)},e.updateAllDirtyRenderers=function(){for(var t=this._dirtyRenderers.length,e=this._dirtyRenderers,i=0;i<t;i++)e[i].updateRenderer();this._dirtyRenderers.length=0,this._dirtyVersion++},t}()),IL=t("Director",function(t){function e(){var e;return(e=t.call(this)||this)._compScheduler=void 0,e._nodeActivator=void 0,e._invalid=void 0,e._paused=void 0,e._root=void 0,e._loadingScene=void 0,e._scene=void 0,e._totalFrames=void 0,e._scheduler=void 0,e._systems=void 0,e._persistRootNodes={},e._invalid=!1,e._paused=!1,e._root=null,e._loadingScene="",e._scene=null,e._totalFrames=0,e._scheduler=new EL,e._compScheduler=new lI,e._nodeActivator=new MO,e._systems=[],e}c(e,t);var i=e.prototype;return i.calculateDeltaTime=function(){},i.end=function(){var t=this;this.once(e.EVENT_END_FRAME,(function(){t.purgeDirector()}))},i.pause=function(){this._paused||(this._paused=!0)},i.purgeDirector=function(){this._scheduler.unscheduleAll(),this._compScheduler.unscheduleAll(),this._nodeActivator.reset(),b.isValid(this._scene)&&this._scene.destroy(),this._scene=null,this.stopAnimation(),b.assetManager.releaseAll()},i.reset=function(){var t;for(var i in this.purgeDirector(),this._persistRootNodes)this.removePersistRootNode(this._persistRootNodes[i]);null===(t=this.getScene())||void 0===t||t.destroy(),this.emit(e.EVENT_RESET),this.startAnimation()},i.runSceneImmediate=function(t,i,n){var r=this;t instanceof IN&&(t=t.scene),Z(t instanceof Kw,1216),t._load();for(var s=Object.keys(this._persistRootNodes).map((function(t){return r._persistRootNodes[t]})),a=0;a<s.length;a++){var o=s[a];o.emit(jE.EventType.SCENE_CHANGED_FOR_PERSISTS,t.renderScene);var u=t.uuid===o._originalSceneId&&t.getChildByUuid(o.uuid);if(u){var h=u.getSiblingIndex();o.hideFlags&=~Ta.Flags.DontSave,o.hideFlags|=Ta.Flags.DontSave&u.hideFlags,u._destroyImmediate(),t.insertChild(o,h)}else o.hideFlags|=Ta.Flags.DontSave,o.parent=t}var l=this._scene;b.isValid(l)&&l.destroy(),b.assetManager._releaseManager._autoRelease(l,t,this._persistRootNodes),this._scene=null,Ta._deferredDestroy(),i&&i(),this.emit(e.EVENT_BEFORE_SCENE_LAUNCH,t),this._scene=t,t._activate(),this._root&&this._root.resetCumulativeTime(),this.startAnimation(),n&&n(null,t),this.emit(e.EVENT_AFTER_SCENE_LAUNCH,t)},i.runScene=function(t,i,n){var r=this;t instanceof IN&&(t=t.scene),Z(t,1205),Z(t instanceof Kw,1216),this.once(e.EVENT_END_FRAME,(function(){r.runSceneImmediate(t,i,n)}))},i.loadScene=function(t,i,n){var r=this;if(this._loadingScene)return j(1208,t,this._loadingScene),!1;var s=b.assetManager.bundles.find((function(e){return!!e.getSceneInfo(t)}));return s?(this.emit(e.EVENT_BEFORE_SCENE_LOADING,t),this._loadingScene=t,console.time("LoadScene "+t),s.loadScene(t,(function(e,s){console.timeEnd("LoadScene "+t),r._loadingScene="",e?(F(e),i&&i(e)):r.runSceneImmediate(s,n,i)})),!0):(K(1209,t),!1)},i.preloadScene=function(t,e,i){var n=b.assetManager.bundles.find((function(e){return!!e.getSceneInfo(t)}));if(n)n.preloadScene(t,null,e,i);else{var r='Can not preload the scene "'+t+'" because it is not in the build settings.';i&&i(new Error(r)),F("preloadScene: "+r)}},i.resume=function(){this._paused&&(this._paused=!1)},i.getScene=function(){return this._scene},i.getDeltaTime=function(){return b.game.deltaTime},i.getTotalTime=function(){return b.game.totalTime},i.getCurrentTime=function(){return b.game.frameStartTime},i.getTotalFrames=function(){return this._totalFrames},i.isPaused=function(){return this._paused},i.getScheduler=function(){return this._scheduler},i.setScheduler=function(t){this._scheduler!==t&&(this.unregisterSystem(this._scheduler),this._scheduler=t,this.registerSystem(EL.ID,t,200))},i.registerSystem=function(t,e,i){e.id=t,e.priority=i,this._systems.push(e),this._systems.sort(KE.sortByPriority)},i.unregisterSystem=function(t){le.array.fastRemove(this._systems,t),this._systems.sort(KE.sortByPriority)},i.getSystem=function(t){return this._systems.find((function(e){return e.id===t}))},i.getAnimationManager=function(){return this.getSystem(b.AnimationManager.ID)},i.startAnimation=function(){this._invalid=!1},i.stopAnimation=function(){this._invalid=!0},i.mainLoop=function(t){var e;e=b.game._calculateDT(t),this.tick(e)},i.tick=function(t){if(!this._invalid){if(this.emit(e.EVENT_BEGIN_FRAME),ww._frameDispatchEvents(),!this._paused){this.emit(e.EVENT_BEFORE_UPDATE),this._compScheduler.startPhase(),this._compScheduler.updatePhase(t);for(var i=0;i<this._systems.length;++i)this._systems[i].update(t);this._compScheduler.lateUpdatePhase(t),this.emit(e.EVENT_AFTER_UPDATE),Ta._deferredDestroy();for(var n=0;n<this._systems.length;++n)this._systems[n].postUpdate(t)}this.emit(e.EVENT_BEFORE_DRAW),wL.updateAllDirtyRenderers(),this._root.frameMove(t),this.emit(e.EVENT_AFTER_DRAW),jE.resetHasChangedFlags(),jE.clearNodeArray(),_a.update(t),this.emit(e.EVENT_END_FRAME),this._totalFrames++}},i.init=function(){this._totalFrames=0,this._paused=!1,this.registerSystem(EL.ID,this._scheduler,200),this._root=new bL(Ja.gfxDevice),this._root.initialize({});for(var t=0;t<this._systems.length;t++)this._systems[t].init();this.emit(e.EVENT_INIT)},i.addPersistRootNode=function(t){if(b.Node.isNode(t)&&t.uuid){var e=t.uuid;if(!this._persistRootNodes[e]){var i=this._scene;if(b.isValid(i))if(t.parent){if(!(t.parent instanceof Kw))return void j(3801);if(t.parent!==i)return void j(3802);t._originalSceneId=i.uuid}else t.parent=i,t._originalSceneId=i.uuid;this._persistRootNodes[e]=t,t._persistNode=!0,b.assetManager._releaseManager._addPersistNodeRef(t)}}else j(3800)},i.removePersistRootNode=function(t){var e=t.uuid||"";t===this._persistRootNodes[e]&&(delete this._persistRootNodes[e],t._persistNode=!1,t._originalSceneId="",b.assetManager._releaseManager._removePersistNodeRef(t))},i.isPersistRootNode=function(t){return!!t._persistNode},h(e,[{key:"root",get:function(){return this._root}}]),e}(Ba));IL.EVENT_INIT="director_init",IL.EVENT_RESET="director_reset",IL.EVENT_BEFORE_SCENE_LOADING="director_before_scene_loading",IL.EVENT_BEFORE_SCENE_LAUNCH="director_before_scene_launch",IL.EVENT_AFTER_SCENE_LAUNCH="director_after_scene_launch",IL.EVENT_BEFORE_UPDATE="director_before_update",IL.EVENT_AFTER_UPDATE="director_after_update",IL.EVENT_BEFORE_DRAW="director_before_draw",IL.EVENT_AFTER_DRAW="director_after_draw",IL.EVENT_BEFORE_COMMIT="director_before_commit",IL.EVENT_BEFORE_PHYSICS="director_before_physics",IL.EVENT_AFTER_PHYSICS="director_after_physics",IL.EVENT_BEGIN_FRAME="director_begin_frame",IL.EVENT_END_FRAME="director_end_frame",IL.instance=void 0,b.Director=IL;var OL=t("director",IL.instance=b.director=new IL),xL=t("Game",function(t){function i(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).frame=null,e.container=null,e.canvas=null,e.renderType=-1,e.eventTargetOn=t.prototype.on,e.eventTargetOnce=t.prototype.once,e.config={},e.onStart=null,e.frameTime=1e3/60,e._isCloning=!1,e._inited=!1,e._engineInited=!1,e._rendererInitialized=!1,e._paused=!0,e._frameRate=60,e._pacer=null,e._initTime=0,e._startTime=0,e._deltaTime=0,e._shouldLoadLaunchScene=!0,e.onPreBaseInitDelegate=new ka,e.onPostBaseInitDelegate=new ka,e.onPreInfrastructureInitDelegate=new ka,e.onPostInfrastructureInitDelegate=new ka,e.onPreSubsystemInitDelegate=new ka,e.onPostSubsystemInitDelegate=new ka,e.onPreProjectInitDelegate=new ka,e.onPostProjectInitDelegate=new ka,e}c(i,t);var n=i.prototype;return n.setFrameRate=function(t){this.frameRate=t},n.getFrameRate=function(){return this.frameRate},n.step=function(){OL.tick(this.frameTime/1e3)},n.pause=function(){var t;this._paused||(this._paused=!0,null===(t=this._pacer)||void 0===t||t.stop())},n.resume=function(){var t;this._paused&&(ww._clearEvents(),this._paused=!1,null===(t=this._pacer)||void 0===t||t.start())},n.isPaused=function(){return this._paused},n.restart=function(){var t=this;return new Promise((function(t){OL.once(IL.EVENT_END_FRAME,(function(){return t()}))})).then((function(){OL.reset(),b.Object._deferredDestroy(),t.pause(),t.resume(),t._shouldLoadLaunchScene=!0,dL.instance.curTime=0,t._safeEmit(i.EVENT_RESTART)}))},n.end=function(){Ha.close()},n.on=function(t,e,n,r){return(this._engineInited&&t===i.EVENT_ENGINE_INITED||this._inited&&t===i.EVENT_GAME_INITED||this._rendererInitialized&&t===i.EVENT_RENDERER_INITED)&&e.call(n),this.eventTargetOn(t,e,n,r)},n.once=function(t,e,n){return this._engineInited&&t===i.EVENT_ENGINE_INITED?e.call(n):this.eventTargetOnce(t,e,n)},n.init=function(t){var n=this;return this._compatibleWithOldParams(t),Promise.resolve().then((function(){return n.emit(i.EVENT_PRE_BASE_INIT),n.onPreBaseInitDelegate.dispatch()})).then((function(){k(t.debugMode||q.NONE),Qa.init(),n._initEvents()})).then((function(){return ye.init(t.settingsPath,t.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(){Ee.init(),n._initXR();var t={frame:document.querySelector("#GameDiv"),container:document.querySelector("#Cocos3dGameContainer"),canvas:document.querySelector("#GameCanvas")};t&&(n.canvas=t.canvas,n.frame=t.frame,n.container=t.container),Ya.init(),dr.init(),Ja.init(n.canvas,dp),fy.init(),vy.init(),Jd.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 OL.init(),vy.loadBuiltinAssets()})).then((function(){return n.emit(i.EVENT_POST_SUBSYSTEM_INIT),n.onPostSubsystemInitDelegate.dispatch()})).then((function(){M("Cocos Creator v"+C),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 t=ye.querySettings(ve.Category.PLUGINS,"jsList"),e=Promise.resolve();return t&&(ye.querySettings(ve.Category.PATH,"projectPath"),t.forEach((function(t){e=e.then((function(){return e="src/"+t,new Promise((function(t,i){var n;function r(t){t.filename===e&&(n=t.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 "+e))})),s.addEventListener("load",(function(){window.removeEventListener("error",r),document.head.removeChild(s),n?i(n):t()})),s.src=e.replace("#","%23"),document.head.appendChild(s)}));var e}))}))),e})).then((function(){var t=ye.querySettings(ve.Category.SCRIPTING,"scriptPackages");return t?Promise.all(t.map((function(t){return e.import(t)}))):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 vy.compileBuiltinMaterial(),dL.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)}))},n._initXR=function(){if(Qa.isXR){var t,e;xr.entry=xr.XrEntry.getInstance();var i=null!==(t=ye.querySettings(ve.Category.RENDERING,"msaa"))&&void 0!==t?t:1,n=null!==(e=ye.querySettings(ve.Category.RENDERING,"renderingScale"))&&void 0!==e?e:1;xr.entry.setMultisamplesRTT(i),xr.entry.setRenderingScale(n)}},n._compatibleWithOldParams=function(t){var e=t.overrideSettings=t.overrideSettings||{};"showFPS"in t&&(e.profiling=e.profiling||{},e.profiling.showFPS=t.showFPS),"frameRate"in t&&(e.screen=e.screen||{},e.screen.frameRate=t.frameRate),"renderMode"in t&&(e.rendering=e.rendering||{},e.rendering.renderMode=t.renderMode),"renderPipeline"in t&&(e.rendering=e.rendering||{},e.rendering.renderPipeline=t.renderPipeline),"assetOptions"in t&&(e.assets=e.assets||{},Object.assign(e.assets,t.assetOptions)),"customJointTextureLayouts"in t&&(e.animation=e.animation||{},e.animation.customJointTextureLayouts=t.customJointTextureLayouts),"physics"in t&&(e.physics=e.physics||{},Object.assign(e.physics,t.physics)),"orientation"in t&&(e.screen=e.screen||{},e.screen.orientation=t.orientation),"exactFitScreen"in t&&(e.screen=e.screen||{},e.screen.exactFitScreen=t.exactFitScreen)},n._loadPreloadAssets=function(){var t=ye.querySettings(ve.Category.ASSETS,"preloadAssets");return t?Promise.all(t.map((function(t){return new Promise((function(e,i){fy.loadAny(t,(function(t){t?i(t):e()}))}))}))):Promise.resolve([])},n._loadCCEScripts=function(){return new Promise((function(t){t()}))},n._loadProjectBundles=function(){var t=ye.querySettings(ve.Category.ASSETS,"preloadBundles");return t?Promise.all(t.map((function(t){var e=t.bundle,i=t.version;return new Promise((function(t,n){var r={};i&&(r.version=i),fy.loadBundle(e,r,(function(e){e?n(e):t()}))}))}))):Promise.resolve([])},n.run=function(t){t&&(this.onStart=t),this._inited&&this.resume()},n._calculateDT=function(){var t=performance.now();return this._deltaTime=t>this._startTime?(t-this._startTime)/1e3:0,this._deltaTime>i.DEBUG_DT_THRESHOLD&&(this._deltaTime=this.frameTime/1e3),this._startTime=t,this._deltaTime},n._updateCallback=function(){var t=this;if(this._inited)if(dL.instance.isFinished)if(this._shouldLoadLaunchScene){this._shouldLoadLaunchScene=!1;var e,i=ye.querySettings(ve.Category.LAUNCH,"launchScene");i?OL.loadScene(i,(function(){var e;console.log("Success to load scene: "+i),t._initTime=performance.now(),OL.startAnimation(),null===(e=t.onStart)||void 0===e||e.call(t)})):(this._initTime=performance.now(),OL.startAnimation(),null===(e=this.onStart)||void 0===e||e.call(this))}else OL.tick(this._calculateDT());else dL.instance.update(this._calculateDT())},n.initPacer=function(){var t,e=null!==(t=ye.querySettings(ve.Category.SCREEN,"frameRate"))&&void 0!==t?t:60;U("number"==typeof e),this._pacer=new CL,this._pacer.onTick=this._updateCallback.bind(this),this.frameRate=e},n._initEvents=function(){Ha.on("show",this._onShow,this),Ha.on("hide",this._onHide,this)},n._onHide=function(){this.emit(i.EVENT_HIDE),this.pause()},n._onShow=function(){this.emit(i.EVENT_SHOW),this.resume()},n.addPersistRootNode=function(t){OL.addPersistRootNode(t)},n.removePersistRootNode=function(t){OL.removePersistRootNode(t)},n.isPersistRootNode=function(t){return OL.isPersistRootNode(t)},n._setupRenderPipeline=function(){var t=this,e=ye.querySettings(ve.Category.RENDERING,"renderPipeline");return e?new Promise((function(t,i){fy.loadAny(e,(function(e,n){return!e&&n instanceof KD?t(n):i(e)}))})).then((function(e){t._setRenderPipeline(e)})).catch((function(i){L(i),L("Failed load render pipeline: "+e+", engine failed to initialize, will fallback to default pipeline"),t._setRenderPipeline()})):this._setRenderPipeline()},n._setRenderPipeline=function(t){OL.root.setRenderPipeline(t)||this._setRenderPipeline(),this._rendererInitialized=!0,this._safeEmit(i.EVENT_RENDERER_INITED)},n._safeEmit=function(t){this.emit(t)},h(i,[{key:"inited",get:function(){return this._inited}},{key:"frameRate",get:function(){return this._frameRate},set:function(t){"number"!=typeof t&&(t=parseInt(t,10),Number.isNaN(t)&&(t=60)),this._frameRate=t,this.frameTime=1e3/t,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}(Ba));xL.EVENT_HIDE="game_on_hide",xL.EVENT_SHOW="game_on_show",xL.EVENT_LOW_MEMORY="game_on_low_memory",xL.EVENT_GAME_INITED="game_inited",xL.EVENT_ENGINE_INITED="engine_inited",xL.EVENT_RENDERER_INITED="renderer_inited",xL.EVENT_PRE_BASE_INIT="pre_base_init",xL.EVENT_POST_BASE_INIT="post_base_init",xL.EVENT_PRE_INFRASTRUCTURE_INIT="pre_infrastructure_init",xL.EVENT_POST_INFRASTRUCTURE_INIT="post_infrastructure_init",xL.EVENT_PRE_SUBSYSTEM_INIT="pre_subsystem_init",xL.EVENT_POST_SUBSYSTEM_INIT="post_subsystem_init",xL.EVENT_PRE_PROJECT_INIT="pre_project_init",xL.EVENT_POST_PROJECT_INIT="post_project_init",xL.EVENT_RESTART="game_on_restart",xL.RENDER_TYPE_CANVAS=0,xL.RENDER_TYPE_WEBGL=1,xL.RENDER_TYPE_OPENGL=2,xL.RENDER_TYPE_HEADLESS=3,xL.DEBUG_DT_THRESHOLD=1,b.Game=xL;var PL=t("game",b.game=new xL),DL={};et(DL,"vmath",[{name:"vec2",newName:"Vec2",target:An,targetName:"math"},{name:"vec3",newName:"Vec3",target:An,targetName:"math"},{name:"vec4",newName:"Vec4",target:An,targetName:"math"},{name:"quat",newName:"Quat",target:An,targetName:"math"},{name:"mat3",newName:"Mat3",target:An,targetName:"math"},{name:"mat4",newName:"Mat4",target:An,targetName:"math"},{name:"color4",newName:"Color",target:An,targetName:"math"},{name:"rect",newName:"Rect",target:An,targetName:"math"},{name:"approx",newName:"approx",target:An,targetName:"math"},{name:"EPSILON",newName:"EPSILON",target:An,targetName:"math"},{name:"equals",newName:"equals",target:An,targetName:"math"},{name:"clamp",newName:"clamp",target:An,targetName:"math"},{name:"clamp01",newName:"clamp01",target:An,targetName:"math"},{name:"lerp",newName:"lerp",target:An,targetName:"math"},{name:"toRadian",newName:"toRadian",target:An,targetName:"math"},{name:"toDegree",newName:"toDegree",target:An,targetName:"math"},{name:"random",newName:"random",target:An,targetName:"math"},{name:"randomRange",newName:"randomRange",target:An,targetName:"math"},{name:"randomRangeInt",newName:"randomRangeInt",target:An,targetName:"math"},{name:"pseudoRandom",newName:"pseudoRandom",target:An,targetName:"math"},{name:"pseudoRandomRangeInt",newName:"pseudoRandomRangeInt",target:An,targetName:"math"},{name:"nextPow2",newName:"nextPow2",target:An,targetName:"math"},{name:"repeat",newName:"repeat",target:An,targetName:"math"},{name:"pingPong",newName:"pingPong",target:An,targetName:"math"},{name:"inverseLerp",newName:"inverseLerp",target:An,targetName:"math"}]),b.vmath=DL,et(EL.prototype,"Scheduler.prototype",[{name:"enableForTarget",newName:"enableForTarget",target:EL,targetName:"Scheduler"}]),et(EL,"Scheduler",[{name:"PRIORITY_SYSTEM",newName:"System.Priority.SCHEDULER",customGetter:function(){return KE.Priority.SCHEDULER}}]),it(EL,"Scheduler",[{name:"PRIORITY_NON_SYSTEM",suggest:"Use enum` System.Priority` instead"}]),et(lB.prototype,"SubModel.prototype",[{name:"subMeshData",newName:"subMesh"}]),it(lB.prototype,"SubModel.prototype",[{name:"getSubModel",suggest:"Use `subModels[i]` instead"},{name:"subModelNum",suggest:"Use `subModels.length` instead"}]),et(bL.prototype,"Root.prototype",[{name:"ui",newName:"batcher2D"}]),nt(PL,"game",[{name:"collisionMatrix"},{name:"groupList"}]),nt(IL.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"}]),it(IL.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"}]);var BL,NL={topLeft:b.v2(0,0),topRight:b.v2(0,0),top:b.v2(0,0),bottomLeft:b.v2(0,0),bottomRight:b.v2(0,0),bottom:b.v2(0,0),center:b.v2(0,0),left:b.v2(0,0),right:b.v2(0,0),width:0,height:0,init:function(t){var e=this.width=t.width,i=this.height=t.height,n=t.x,r=t.y,s=r+i,a=n+e;this.topLeft.x=n,this.topLeft.y=s,this.topRight.x=a,this.topRight.y=s,this.top.x=n+e/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+e/2,this.bottom.y=r,this.center.x=n+e/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}};b.visibleRect=NL;var ML=new gn,LL=((BL={})[Ee.ORIENTATION_AUTO]=za.AUTO,BL[Ee.ORIENTATION_LANDSCAPE]=za.LANDSCAPE,BL[Ee.ORIENTATION_PORTRAIT]=za.PORTRAIT,BL),FL=t("View",function(t){function e(){var e;(e=t.call(this)||this)._designResolutionSize=void 0,e._scaleX=void 0,e._scaleY=void 0,e._viewportRect=void 0,e._visibleRect=void 0,e._autoFullScreen=void 0,e._retinaEnabled=void 0,e._resizeCallback=void 0,e._resolutionPolicy=void 0,e._rpExactFit=void 0,e._rpShowAll=void 0,e._rpNoBorder=void 0,e._rpFixedHeight=void 0,e._rpFixedWidth=void 0;var i=UL,n=GL;return e._designResolutionSize=new gn(0,0),e._scaleX=1,e._scaleY=1,e._viewportRect=new yn(0,0,0,0),e._visibleRect=new yn(0,0,0,0),e._autoFullScreen=!1,e._retinaEnabled=!1,e._resizeCallback=null,e._rpExactFit=new kL(i.EQUAL_TO_FRAME,n.EXACT_FIT),e._rpShowAll=new kL(i.EQUAL_TO_FRAME,n.SHOW_ALL),e._rpNoBorder=new kL(i.EQUAL_TO_FRAME,n.NO_BORDER),e._rpFixedHeight=new kL(i.EQUAL_TO_FRAME,n.FIXED_HEIGHT),e._rpFixedWidth=new kL(i.EQUAL_TO_FRAME,n.FIXED_WIDTH),e._resolutionPolicy=e._rpShowAll,e}c(e,t);var i=e.prototype;return i.init=function(){var t=Ya.windowSize,e=t.width,i=t.height;this._designResolutionSize.width=e,this._designResolutionSize.height=i,this._viewportRect.width=e,this._viewportRect.height=i,this._visibleRect.width=e,this._visibleRect.height=i,ML.width=this._visibleRect.width,ML.height=this._visibleRect.height,NL&&NL.init(this._visibleRect),this.resizeWithBrowserSize(!0);var n=ye.querySettings(ve.Category.SCREEN,"designResolution");n&&this.setDesignResolutionSize(Number(n.width),Number(n.height),n.policy||kL.FIXED_HEIGHT),Xa.on("window-resize",this._updateAdaptResult,this),Xa.on("orientation-change",this._updateAdaptResult,this),Xa.on("fullscreen-change",this._updateAdaptResult,this)},i.resizeWithBrowserSize=function(t){Xa.handleResizeEvent=t},i.setResizeCallback=function(t){"function"!=typeof t&&null!=t||(this._resizeCallback=t)},i.setOrientation=function(t){Xa.orientation=LL[t]},i.adjustViewportMeta=function(){},i.enableRetina=function(t){this._retinaEnabled=!!t},i.isRetinaEnabled=function(){return this._retinaEnabled},i.enableAutoFullScreen=function(t){t!==this._autoFullScreen&&(this._autoFullScreen=t,t&&Ya.requestFullScreen().catch((function(){})))},i.isAutoFullScreenEnabled=function(){return this._autoFullScreen},i.setCanvasSize=function(t,e){Xa.resolutionScale=1;var i=Xa.devicePixelRatio,n=new gn(t*i,e*i);Ya.windowSize=n},i.getCanvasSize=function(){return Ya.windowSize},i.getFrameSize=function(){var t=Xa.devicePixelRatio,e=Ya.windowSize;return e.width/=t,e.height/=t,e},i.setFrameSize=function(t,e){var i=Xa.devicePixelRatio;Ya.windowSize=new gn(t*i,e*i)},i.getVisibleSize=function(){return new gn(this._visibleRect.width,this._visibleRect.height)},i.getVisibleSizeInPixel=function(){return new gn(this._visibleRect.width*this._scaleX,this._visibleRect.height*this._scaleY)},i.getVisibleOrigin=function(){return new _n(this._visibleRect.x,this._visibleRect.y)},i.getVisibleOriginInPixel=function(){return new _n(this._visibleRect.x*this._scaleX,this._visibleRect.y*this._scaleY)},i.getResolutionPolicy=function(){return this._resolutionPolicy},i._updateResolutionPolicy=function(t){if(t instanceof kL)this._resolutionPolicy=t;else{var e=kL;t===e.EXACT_FIT&&(this._resolutionPolicy=this._rpExactFit),t===e.SHOW_ALL&&(this._resolutionPolicy=this._rpShowAll),t===e.NO_BORDER&&(this._resolutionPolicy=this._rpNoBorder),t===e.FIXED_HEIGHT&&(this._resolutionPolicy=this._rpFixedHeight),t===e.FIXED_WIDTH&&(this._resolutionPolicy=this._rpFixedWidth)}},i.setResolutionPolicy=function(t){this._updateResolutionPolicy(t);var e=zL.getDesignResolutionSize();zL.setDesignResolutionSize(e.width,e.height,t)},i.setDesignResolutionSize=function(t,e,i){if(t>0&&e>0){this._updateResolutionPolicy(i);var n=this._resolutionPolicy;n&&n.preApply(this),this._designResolutionSize.width=t,this._designResolutionSize.height=e;var r=n.apply(this,this._designResolutionSize);if(r.scale&&2===r.scale.length&&(this._scaleX=r.scale[0],this._scaleY=r.scale[1]),r.viewport){var s=this._viewportRect,a=this._visibleRect,o=r.viewport;s.x=o.x,s.y=o.y,s.width=o.width,s.height=o.height,a.x=0,a.y=0,a.width=o.width/this._scaleX,a.height=o.height/this._scaleY}n.postApply(this),ML.width=this._visibleRect.width,ML.height=this._visibleRect.height,NL&&NL.init(this._visibleRect),this.emit("design-resolution-changed")}else K(2200)},i.getDesignResolutionSize=function(){return new gn(this._designResolutionSize.width,this._designResolutionSize.height)},i.setRealPixelResolution=function(t,e,i){document.documentElement.style.width=t+"px",document.body.style.width=t+"px",document.body.style.left="0px",document.body.style.top="0px",this.setDesignResolutionSize(t,e,i)},i.getViewportRect=function(){return this._viewportRect},i.getScaleX=function(){return this._scaleX},i.getScaleY=function(){return this._scaleY},i.getDevicePixelRatio=function(){return Xa.devicePixelRatio},i.convertToLocationInView=function(t,e,i,n){void 0===n&&(n=new _n);var r=Xa.devicePixelRatio*(t-i.left),s=Xa.devicePixelRatio*(i.top+i.height-e);return Xa.isFrameRotated?(n.x=Ya.windowSize.width-s,n.y=r):(n.x=r,n.y=s),n},i._convertToUISpace=function(t){var e=this._viewportRect;t.x=(t.x-e.x)/this._scaleX,t.y=(t.y-e.y)/this._scaleY},i._updateAdaptResult=function(){var t;b.director.root.resize(Ya.windowSize.width,Ya.windowSize.height);var e=this._designResolutionSize.width,i=this._designResolutionSize.height;e>0&&this.setDesignResolutionSize(e,i,this._resolutionPolicy),this.emit("canvas-resize"),null===(t=this._resizeCallback)||void 0===t||t.call(this)},e}(Da(KE)));FL.instance=void 0;var UL=function(){function t(){this.name="ContainerStrategy"}var e=t.prototype;return e.preApply=function(){},e.apply=function(){},e.postApply=function(){},e._setupCanvas=function(){var t=b.game.canvas;if(t){var e=Ya.windowSize;t.width=e.width,t.height=e.height}},t}();UL.EQUAL_TO_FRAME=void 0,UL.PROPORTION_TO_FRAME=void 0;var GL=function(){function t(){this.name="ContentStrategy",this._result=void 0,this._result={scale:[1,1],viewport:null}}var e=t.prototype;return e.preApply=function(){},e.apply=function(){return{scale:[1,1]}},e.postApply=function(){},e._buildResult=function(t,e,i,n,r,s){Math.abs(t-i)<2&&(i=t),Math.abs(e-n)<2&&(n=e);var a=new yn(Math.round((t-i)/2),Math.round((e-n)/2),i,n);return this._result.scale=[r,s],this._result.viewport=a,this._result},t}();GL.EXACT_FIT=void 0,GL.SHOW_ALL=void 0,GL.NO_BORDER=void 0,GL.FIXED_HEIGHT=void 0,GL.FIXED_WIDTH=void 0,function(){var t=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).name="EqualToFrame",e}return c(e,t),e.prototype.apply=function(){Xa.isProportionalToFrame=!1,this._setupCanvas()},e}(UL),e=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).name="ProportionalToFrame",e}return c(e,t),e.prototype.apply=function(){Xa.isProportionalToFrame=!0,this._setupCanvas()},e}(UL);UL.EQUAL_TO_FRAME=new t,UL.PROPORTION_TO_FRAME=new e;var i=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).name="ExactFit",e}return c(e,t),e.prototype.apply=function(t,e){var i=Ya.windowSize,n=i.width,r=i.height,s=n/e.width,a=r/e.height;return this._buildResult(n,r,n,r,s,a)},e}(GL),n=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).name="ShowAll",e}return c(e,t),e.prototype.apply=function(t,e){var i,n,r=Ya.windowSize,s=r.width,a=r.height,o=e.width,u=e.height,h=s/o,l=a/u,c=0;return h<l?(i=s,n=u*(c=h)):(i=o*(c=l),n=a),this._buildResult(s,a,i,n,c,c)},e}(GL),r=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).name="NoBorder",e}return c(e,t),e.prototype.apply=function(t,e){var i,n,r,s=Ya.windowSize,a=s.width,o=s.height,u=e.width,h=e.height,l=a/u,c=o/h;return l<c?(n=u*(i=c),r=o):(n=a,r=h*(i=l)),this._buildResult(a,o,n,r,i,i)},e}(GL),s=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).name="FixedHeight",e}return c(e,t),e.prototype.apply=function(t,e){var i=Ya.windowSize,n=i.width,r=i.height,s=r/e.height,a=n,o=r;return this._buildResult(n,r,a,o,s,s)},e}(GL),a=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).name="FixedWidth",e}return c(e,t),e.prototype.apply=function(t,e){var i=Ya.windowSize,n=i.width,r=i.height,s=n/e.width,a=n,o=r;return this._buildResult(n,r,a,o,s,s)},e}(GL);GL.EXACT_FIT=new i,GL.SHOW_ALL=new n,GL.NO_BORDER=new r,GL.FIXED_HEIGHT=new s,GL.FIXED_WIDTH=new a}();var kL=t("ResolutionPolicy",function(){function t(t,e){this.name="ResolutionPolicy",this._containerStrategy=void 0,this._contentStrategy=void 0,this._containerStrategy=null,this._contentStrategy=null,this.setContainerStrategy(t),this.setContentStrategy(e)}var e=t.prototype;return e.preApply=function(t){this._contentStrategy.preApply(t)},e.apply=function(t,e){return this._containerStrategy.apply(t,e),this._contentStrategy.apply(t,e)},e.postApply=function(t){this._contentStrategy.postApply(t)},e.setContainerStrategy=function(t){t instanceof UL&&(this._containerStrategy=t)},e.setContentStrategy=function(t){t instanceof GL&&(this._contentStrategy=t)},h(t,[{key:"canvasSize",get:function(){return Ya.windowSize}}]),t}());kL.EXACT_FIT=0,kL.NO_BORDER=1,kL.SHOW_ALL=2,kL.FIXED_HEIGHT=3,kL.FIXED_WIDTH=4,kL.UNKNOWN=5,kL.ContainerStrategy=UL,kL.ContentStrategy=GL,b.ResolutionPolicy=kL;var zL=t("view",FL.instance=b.view=new FL);OL.registerSystem("view",zL,0),b.winSize=ML,it(FL.prototype,"View.prototype",[{name:"isAntiAliasEnabled",suggest:"The API of Texture2d have been largely modified, no alternative"},{name:"enableAntiAlias",suggest:"The API of Texture2d have been largely modified, no alternative"}]),nt(FL.prototype,"View.prototype",[{name:"adjustViewportMeta"},{name:"enableAutoFullScreen",suggest:"use screen.requestFullScreen() instead."},{name:"isAutoFullScreenEnabled"},{name:"setCanvasSize",suggest:"setting size in CSS pixels is not recommended, please use screen.windowSize instead."},{name:"getCanvasSize",suggest:"please use screen.windowSize instead."},{name:"getFrameSize",suggest:"getting size in CSS pixels is not recommended, please use screen.windowSize instead."},{name:"setFrameSize",suggest:"setting size in CSS pixels is not recommended, please use screen.windowSize instead."},{name:"getDevicePixelRatio",suggest:"use screen.devicePixelRatio instead."},{name:"convertToLocationInView"},{name:"enableRetina"},{name:"isRetinaEnabled"},{name:"setRealPixelResolution"}]),nt(b,"cc",[{name:"winSize",suggest:"please use view.getVisibleSize() instead."}]),nt(Qa,"sys",[{name:"capabilities",suggest:"please use sys.hasFeature() method instead."}]),et(Qa,"sys",["UNKNOWN","ENGLISH","CHINESE","FRENCH","ITALIAN","GERMAN","SPANISH","DUTCH","RUSSIAN","KOREAN","JAPANESE","HUNGARIAN","PORTUGUESE","ARABIC","NORWEGIAN","POLISH","TURKISH","UKRAINIAN","ROMANIAN","BULGARIAN"].map((function(t){return{name:"LANGUAGE_"+t,newName:t,target:Qa.Language,targetName:"sys.Language"}}))),et(Qa,"sys",["UNKNOWN","IOS","ANDROID","WINDOWS","LINUX","OSX"].map((function(t){return{name:"OS_"+t,newName:t,target:Qa.OS,targetName:"sys.OS"}}))),et(Qa,"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(t){return{name:"BROWSER_TYPE_"+t,newName:t,target:Qa.BrowserType,targetName:"sys.BrowserType"}}))),et(Qa,"sys",[{name:"BROWSER_TYPE_360",newName:"BROWSER_360",target:Qa.BrowserType,targetName:"sys.BrowserType"}]),et(Qa,"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(t){return{name:t,target:Qa.Platform,targetName:"sys.Platform"}}))),et(Qa,"sys",[{name:"IPHONE",newName:"IOS",target:Qa.Platform,targetName:"sys.Platform"},{name:"IPAD",newName:"IOS",target:Qa.Platform,targetName:"sys.Platform"}]),it(Qa,"sys",["LINUX","BLACKBERRY","NACL","EMSCRIPTEN","TIZEN","WINRT","WP8","QQ_PLAY","FB_PLAYABLE_ADS"].map((function(t){return{name:t}}))),et(Qa,"sys",[{name:"windowPixelResolution",target:Ya,targetName:"screen",newName:"windowSize"}]),nt(Ya,"screen",[{name:"autoFullScreen",suggest:"please use screen.requestFullScreen() instead."},{name:"disableAutoFullScreen"}]);var HL=[".png",".jpg",".bmp",".jpeg",".gif",".ico",".tiff",".webp",".image",".pvr",".pkm",".astc"],VL=[".mp3",".ogg",".wav",".m4a"];function WL(){return!0}var XL={transformURL:function(t){var e=vl(t);if(!e)return t;var i=rl.find((function(t){return!!t.getAssetInfo(e)}));if(!i)return t;var n,r=i.getAssetInfo(e);if(!(n=t.startsWith(i.base+i.config.nativeBase)?r.nativeVer||"":r.ver||"")||-1!==t.indexOf(n))return t;var s=!1;if(".ttf"===Dl(t)&&(s=!0),s){var a=Ml(t),o=Nl(t);t=a+"."+n+"/"+o}else t=t.replace(/.*[/\\][0-9a-fA-F]{2}[/\\]([0-9a-fA-F-@]{8,})/,(function(t){return t+"."+n}));return t}},jL=t("CCLoader",function(){function t(){this._autoReleaseSetting=Object.create(null),this._parseLoadResArgs=fv}var e=t.prototype;return e.load=function(t,e,i){void 0===i&&void 0!==e&&(i=e,e=null);for(var n=Array.isArray(t)?t:[t],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=[];fy.loadAny(n,null,(function(t,i,n){n.content&&(HL.includes(n.ext)?a.push(n.content):VL.includes(n.ext)&&o.push(n.content)),e&&e(t,i,n)}),(function(t,e){var r=null;if(!t){e=Array.isArray(e)?e:[e];for(var s=function(t){var i=e[t];if(!(i instanceof Wl)){var r=i,s=n[t].url;a.includes(r)?Zv.create(s,i,".png",{},(function(i,n){r=e[t]=n})):o.includes(r)&&Zv.create(s,i,".mp3",{},(function(i,n){r=e[t]=n})),el.add(s,r)}},u=0;u<e.length;u++)s(u);if(e.length>1){var h=Object.create(null);e.forEach((function(t){h[t._uuid]=t})),r={isCompleted:WL,_map:h}}else r=e[0]}i&&i(t,r)}))},e.getXMLHttpRequest=function(){return new XMLHttpRequest},e.getItem=function(t){return fy.assets.has(t)?{content:fy.assets.get(t)}:null},e.loadRes=function(t,e,i,n){var r=this._parseLoadResArgs(e,i,n),s=r.type,a=r.onProgress,o=r.onComplete,u=Dl(t);u&&!gv.getInfoWithPath(t,s)&&(t=t.slice(0,-u.length)),gv.load(t,s,a,o)},e.loadResArray=function(t,e,i,n){var r=this._parseLoadResArgs(e,i,n),s=r.type,a=r.onProgress,o=r.onComplete;t.forEach((function(e,i){var n=Dl(e);n&&!gv.getInfoWithPath(e,s)&&(t[i]=e.slice(0,-n.length))})),gv.load(t,s,a,o)},e.loadResDir=function(t,e,i,n){var r=this._parseLoadResArgs(e,i,n),s=r.type,a=r.onProgress,o=r.onComplete;gv.loadDir(t,s,a,(function(e,i){var n=[];e||(n=gv.getDirWithPath(t,s).map((function(t){return t.path}))),o&&o(e,i,n)}))},e.getRes=function(t,e){return el.has(t)?el.get(t):gv.get(t,e)},e.getResCount=function(){return el.count},e.getDependsRecursively=function(t){if(!t)return[];var e="string"==typeof t?t:t._uuid;return Og.getDepsRecursively(e).concat([e])},e.addDownloadHandlers=function(t){var e=Object.create(null),i=function(i){var n=t[i];e["."+i]=function(t,e,i){n({url:t},i)}};for(var n in t)i(n);Gv.register(e)},e.addLoadHandlers=function(t){var e=Object.create(null),i=function(i){var n=t[i];e["."+i]=function(t,e,i){n({content:t},i)}};for(var n in t)i(n);ny.register(e)},e.release=function(t){if(Array.isArray(t))for(var e=0;e<t.length;e++){var i=t[e];"string"==typeof i&&(i=el.get(i)),fy.releaseAsset(i)}else t&&("string"==typeof t&&(t=el.get(t)),fy.releaseAsset(t))},e.releaseAsset=function(t){fy.releaseAsset(t)},e.releaseRes=function(t,e){gv.release(t,e)},e.releaseAll=function(){fy.releaseAll(),el.clear()},e.removeItem=function(t){return!!el.remove(t)},e.setAutoRelease=function(t,e){"object"==typeof t&&(t=t._uuid),this._autoReleaseSetting[t]=!!e},e.setAutoReleaseRecursively=function(t,e){"object"==typeof t&&(t=t._uuid),e=!!e,this._autoReleaseSetting[t]=e;for(var i=Og.getDepsRecursively(t),n=0;n<i.length;n++)this._autoReleaseSetting[i[n]]=e},e.isAutoRelease=function(t){return"object"==typeof t&&(t=t._uuid),!!this._autoReleaseSetting[t]},h(t,[{key:"onProgress",set:function(t){sv=t}},{key:"_cache",get:function(){if(el instanceof Jh)return el._map;var t={};return el.forEach((function(e,i){t[i]=e})),t}},{key:"md5Pipe",get:function(){return XL}},{key:"downloader",get:function(){return Gv}},{key:"loader",get:function(){return fy.parser}}]),t}()),YL=t("loader",new jL),KL=t("AssetLibrary",{init:function(t){t.importBase=t.libraryPath,t.nativeBase=t.rawAssetsBase,fy.init(t),t.rawAssets&&gv.init({base:"",deps:[],scenes:{},redirect:[],debug:!0,packs:{},types:[],versions:{import:[],native:[]},name:hl.RESOURCES,importBase:t.importBase,nativeBase:t.nativeBase,paths:t.rawAssets.assets,uuids:Object.keys(t.rawAssets.assets),extensionMap:{}})},loadAsset:function(t,e){fy.loadAny(t,e)}}),qL=t("url",{});et(qL,"url",[{name:"normalize",target:fy.utils,targetName:"assetManager.utils",newName:"normalize"},{name:"raw",targetName:"Asset.prototype",newName:"nativeUrl",customFunction:function(t){return t.startsWith("resources/")?Sl({path:Ll(t.substr(10)),bundle:hl.RESOURCES,__isNative__:!0,ext:Dl(t)}):""}}]),it(KL,"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"}]),it(YL,"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"}]),et(b,"cc",[{name:"loader",newName:"assetManager",logTimes:1,customGetter:function(){return YL}},{name:"AssetLibrary",newName:"assetManager",logTimes:1,customGetter:function(){return KL}},{name:"Pipeline",target:_y,targetName:"AssetManager",newName:"Pipeline",logTimes:1},{name:"url",targetName:"assetManager",newName:"utils",logTimes:1,customGetter:function(){return qL}}]),it(b,"cc",[{name:"LoadingItems",suggest:J(1400,"LoadingItems","AssetManager.Task")}]),et(Ee,"macro",[{name:"DOWNLOAD_MAX_CONCURRENT",target:Gv,targetName:"assetManager.downloader",newName:"maxConcurrency"}]),et(OL,"director",[{name:"_getSceneUuid",targetName:"assetManager.main",newName:"getSceneInfo",customFunction:function(t){var e;return fy.main?null===(e=fy.main.getSceneInfo(t))||void 0===e?void 0:e.uuid:""}}]),et(PL,"game",[{name:"_sceneInfos",targetName:"assetManager.main",newName:"getSceneInfo",customGetter:function(){var t=[];return fy.main&&fy.main.config.scenes.forEach((function(e){t.push(e)})),t}}]);var QL=rv._autoRelease;rv._autoRelease=function(t,e,i){QL.call(rv,t,e,i);for(var n=YL._autoReleaseSetting,r=Object.keys(n),s=0;s<r.length;s++){var a=r[s];if(!0===n[a]){var o=el.get(a);o&&rv.tryRelease(o)}}};var ZL,JL,$L,tF,eF,iF=function(t,e,i,n,r,s,a){void 0===t&&(t=""),void 0===e&&(e=2),void 0===i&&(i=0),void 0===n&&(n=Qn.LOAD),void 0===r&&(r=Zn.STORE),void 0===s&&(s=cr.ALL),void 0===a&&(a=new Pr),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.slotName=t,this.accessType=e,this.attachmentType=i,this.loadOp=n,this.storeOp=r,this.clearFlags=s,this.clearColor=a},nF=function(){this.name="",this.accessType=0,this.clearFlags=cr.NONE,this.clearColor=new Pr,this.clearValueType=0},rF=function(t,e){void 0===t&&(t=null),void 0===e&&(e=0),this.light=void 0,this.level=void 0,this.light=t,this.level=e},sF=function(){},aF=(c((function(){return eF.apply(this,arguments)||this}),eF=sF),c((function(){return tF.apply(this,arguments)||this}),tF=sF),c((function(){return $L.apply(this,arguments)||this}),$L=sF),c((function(){return JL.apply(this,arguments)||this}),JL=sF),c((function(){return ZL.apply(this,arguments)||this}),ZL=function(){}),function(){});function oF(t,e,i,n,r){void 0===n&&(n=null),void 0===r&&(r=0);var s=new Sr,a=t.viewport,o=e,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 gx.DIRECTIONAL:var h=n;h.shadowFixedArea||h.csmLevel===PA.LEVEL_1?(s.x=0,s.y=0,s.width=o,s.height=u):(s.x=r%2*.5*o,s.y=.5*(1-Math.floor(r/2))*u,s.width=.5*o,s.height=.5*u);break;case gx.SPOT:s.x=0,s.y=0,s.width=o,s.height=u}return s}function uF(t,e,i,n,r,s,a){var o=e.device,u=t;if(!e.containsResource(u)){var h=Tm(o)?On.R32F:On.RGBA8;e.addRenderTarget(u,h,s,a,0),e.addDepthStencil(u+"Depth",On.DEPTH_STENCIL,s,a,0)}var l=e.addRasterPass(s,a,"default",t);l.addRasterView(u,new iF("_",2,0,Qn.CLEAR,Zn.STORE,cr.COLOR,new Pr(1,1,1,i.clearColor.w))),l.addRasterView(u+"Depth",new iF("_",2,1,Qn.CLEAR,Zn.DISCARD,cr.DEPTH_STENCIL,new Pr(i.clearDepth,i.clearStencil,0,0)));var c=oF(i,s,a,n,r);l.setViewport(new Or(c.x,c.y,c.width,c.height)),l.addQueue(1).addSceneOfCamera(i,new rF(n,r),8)}var hF=function(){this.shadowEnabled=!1,this.mainLightShadowNames=new Array,this.spotLightShadowNames=new Array};function lF(t,e,i){var n=i,r=n.pipelineSceneData.shadows,s=i.pipelineSceneData.validPunctualLights,a=new hF,o=i.pipelineSceneData.shadows;if(!r.enabled||r.type!==OA.ShadowMap)return a;a.shadowEnabled=!0;for(var u=[],h=0,l=0;h<r.maxReceived&&l<s.length;){var c=s[l];c.type===gx.SPOT&&c.shadowEnabled&&(u.push(c),h++),l++}var _=e.scene.mainLight,f=o.size.x,d=o.size.y;if(_&&_.shadowEnabled)if(a.mainLightShadowNames[0]="MainLightShadow"+t,_.shadowFixedArea)uF(a.mainLightShadowNames[0],i,e,_,0,f,d);else for(var p=n.pipelineSceneData.csmSupported?_.csmLevel:1,m=0;m<p;m++)a.mainLightShadowNames[m]="MainLightShadow"+t,uF(a.mainLightShadowNames[m],i,e,_,m,f,d);for(var g=0;g<u.length;g++){var v=u[g],y="SpotLightShadow"+g.toString()+t;a.spotLightShadowNames[g]=y,uF(y,i,e,v,0,f,d)}return a}var cF,_F=[];function fF(t){return _F.includes(t)||_F.push(t),_F.indexOf(t)}function dF(t,e){var i=Qn.CLEAR;return t&cr.COLOR||0!==e||(i=t&DS?Qn.DISCARD:Qn.LOAD),(t&cr.DEPTH_STENCIL)!==cr.DEPTH_STENCIL&&1===e&&(t&cr.DEPTH||(i=Qn.LOAD),t&cr.STENCIL||(i=Qn.LOAD)),i}t("ForwardPipelineBuilder",function(t){function e(){return t.apply(this,arguments)||this}return c(e,t),e.prototype.setup=function(t,e){for(var i=0;i<t.length;i++){var n=t[i];if(null!==n.scene){mF(e,n);var r=fF(n),s="Camera"+r,a=lF(s,n,e),o=n.window.width,u=n.window.height,h="dsForwardPassColor"+s,l="dsForwardPassDS"+s;e.containsResource(h)||(e.addRenderTexture(h,On.RGBA8,o,u,n.window),e.addDepthStencil(l,On.DEPTH_STENCIL,o,u,0));for(var c,_=e.addRasterPass(o,u,"default","CameraForwardPass"+r),f=y(a.mainLightShadowNames);!(c=f()).done;){var d=c.value;if(e.containsResource(d)){var p=new nF;_.addComputeView(d,p)}}for(var m,g=y(a.spotLightShadowNames);!(m=g()).done;){var v=m.value;if(e.containsResource(v)){var E=new nF;_.addComputeView(v,E)}}var T=new iF("_",2,0,dF(n.clearFlag,0),Zn.STORE,n.clearFlag,new Pr(n.clearColor.x,n.clearColor.y,n.clearColor.z,n.clearColor.w)),S=new iF("_",2,1,dF(n.clearFlag,1),Zn.STORE,n.clearFlag,new Pr(n.clearDepth,n.clearStencil,0,0));_.addRasterView(h,T),_.addRasterView(l,S),_.addQueue(1).addSceneOfCamera(n,new rF,291),_.addQueue(3).addSceneOfCamera(n,new rF,1556)}}},e}(aF)),function(t){t[t.NONE=0]="NONE",t[t.FXAA=1]="FXAA"}(cF||(cF=t("AntiAliasing",{})));var pF=function(){this._deferredLightingMaterial=void 0,this._deferredPostMaterial=void 0,this._antiAliasing=cF.NONE,this._deferredLightingMaterial=new Vy,this._deferredLightingMaterial.name="builtin-deferred-material",this._deferredLightingMaterial.initialize({effectName:"pipeline/deferred-lighting",defines:{CC_RECEIVE_SHADOW:1}});for(var t=0;t<this._deferredLightingMaterial.passes.length;++t)this._deferredLightingMaterial.passes[t].tryCompile();this._deferredPostMaterial=new Vy,this._deferredPostMaterial.name="builtin-post-process-material",Ee.ENABLE_ANTIALIAS_FXAA&&(this._antiAliasing=cF.FXAA),this._deferredPostMaterial.initialize({effectName:"pipeline/post-process",defines:{ANTIALIAS_TYPE:this._antiAliasing}});for(var e=0;e<this._deferredPostMaterial.passes.length;++e)this._deferredPostMaterial.passes[e].tryCompile()};function mF(t,e){var i=t.pipelineSceneData.validPunctualLights;i.length=0;for(var n=To.create(0,0,0,1),r=e.scene.spotLights,s=0;s<r.length;s++){var a=r[s];a.baked||(To.set(n,a.position.x,a.position.y,a.position.z,a.range),bu.sphereFrustum(n,e.frustum)&&i.push(a))}for(var o=e.scene.sphereLights,u=0;u<o.length;u++){var h=o[u];h.baked||(To.set(n,h.position.x,h.position.y,h.position.z,h.range),bu.sphereFrustum(n,e.frustum)&&i.push(h))}}t("DeferredPipelineBuilder",function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._deferredData=new pF,e}return c(e,t),e.prototype.setup=function(t,e){for(var i=0;i<t.length;++i){var n=t[i];if(n.scene){mF(e,n);var r=fF(n),s=lF("Camera"+r,n,e),a=n.window.width,o=n.window.height,u="dsDeferredPassColorCamera",h="deferredGbufferPassNormal",l="deferredGbufferPassEmissive",c="dsDeferredPassDSCamera";if(!e.containsResource(u)){var _=On.RGBA16F;e.addRenderTarget(u,_,a,o,0),e.addRenderTarget(h,_,a,o,0),e.addRenderTarget(l,_,a,o,0),e.addDepthStencil(c,On.DEPTH_STENCIL,a,o,0)}var f=e.addRasterPass(a,o,"Geometry","CameraGbufferPass"+r),d=new Pr(0,0,0,0);n.clearFlag&cr.COLOR&&(e.pipelineSceneData.isHDR?Oy(d,n.clearColor):(d.x=n.clearColor.x,d.y=n.clearColor.y,d.z=n.clearColor.z));var p=new iF("_",2,0,Qn.CLEAR,Zn.STORE,n.clearFlag,d),m=new iF("_",2,0,Qn.CLEAR,Zn.STORE,n.clearFlag,new Pr(0,0,0,0)),g=new iF("_",2,0,Qn.CLEAR,Zn.STORE,n.clearFlag,new Pr(0,0,0,0)),v=new iF("_",2,1,Qn.CLEAR,Zn.STORE,n.clearFlag,new Pr(n.clearDepth,n.clearStencil,0,0));f.addRasterView(u,p),f.addRasterView(h,m),f.addRasterView(l,g),f.addRasterView(c,v),f.addQueue(1).addSceneOfCamera(n,new rF,3);var E="deferredLightingPassRTName";e.containsResource(E)||(e.addRenderTarget(E,On.RGBA8,a,o,0),e.addDepthStencil("deferredLightingPassDS",On.DEPTH_STENCIL,a,o,0));for(var T,S=e.addRasterPass(a,o,"Lighting","CameraLightingPass"+r),A=y(s.mainLightShadowNames);!(T=A()).done;){var R=T.value;if(e.containsResource(R)){var b=new nF;S.addComputeView(R,b)}}for(var C,w=y(s.spotLightShadowNames);!(C=w()).done;){var I=C.value;if(e.containsResource(I)){var O=new nF;S.addComputeView(I,O)}}if(e.containsResource(u)){var x=new nF;x.name="gbuffer_albedoMap",S.addComputeView(u,x);var P=new nF;P.name="gbuffer_normalMap",S.addComputeView(h,P);var D=new nF;D.name="gbuffer_emissiveMap",S.addComputeView(l,D);var B=new nF;B.name="depth_stencil",S.addComputeView(c,B)}var N=new Pr(0,0,0,0);n.clearFlag&cr.COLOR&&(N.x=n.clearColor.x,N.y=n.clearColor.y,N.z=n.clearColor.z),N.w=0;var M=new iF("_",2,0,Qn.CLEAR,Zn.STORE,n.clearFlag,N);S.addRasterView(E,M),S.addQueue(3).addCameraQuad(n,this._deferredData._deferredLightingMaterial,64),S.addQueue(3).addSceneOfCamera(n,new rF,772);var L="postprocessPassRTName"+r,F="postprocessPassDS"+r;e.containsResource(L)||(e.addRenderTexture(L,On.RGBA8,a,o,n.window),e.addDepthStencil(F,On.DEPTH_STENCIL,a,o,0));var U=e.addRasterPass(a,o,"Postprocess","CameraPostprocessPass"+r);if(e.containsResource(E)){var G=new nF;G.name="outputResultMap",U.addComputeView(E,G)}var k=new Pr(0,0,0,n.clearColor.w);n.clearFlag&cr.COLOR&&(k.x=n.clearColor.x,k.y=n.clearColor.y,k.z=n.clearColor.z);var z=new iF("_",2,0,dF(n.clearFlag,0),Zn.STORE,n.clearFlag,k),H=new iF("_",2,1,dF(n.clearFlag,1),Zn.STORE,n.clearFlag,new Pr(n.clearDepth,n.clearStencil,0,0));U.addRasterView(L,z),U.addRasterView(F,H),U.addQueue(0).addFullscreenQuad(this._deferredData._deferredPostMaterial,0),U.addQueue(3).addSceneOfCamera(n,new rF,1040)}}},e}(aF)),b.math=An,b.geometry=Qd;var gF=new un;function vF(t,e,i,n){var r=i.chunk,s=i.data,a=r.vb,o=i.vertexCount;t.getWorldMatrix(gF);for(var u=0,h=0;h<o;h++){var l=s[h],c=l.x,_=l.y,f=gF.m03*c+gF.m07*_+gF.m15;f=f?Math.abs(1/f):1,a[u+0]=(gF.m00*c+gF.m04*_+gF.m12)*f,a[u+1]=(gF.m01*c+gF.m05*_+gF.m13)*f,a[u+2]=(gF.m02*c+gF.m06*_+gF.m14)*f,Gi.toArray(a,n,u+5),u+=9}r.bufferId;for(var d=r.vertexOffset,p=r.meshBuffer,m=r.meshBuffer.iData,g=p.indexOffset,v=0,y=o/4;v<y;v++){var E=d+4*v;m[g++]=E,m[g++]=E+1,m[g++]=E+2,m[g++]=E+1,m[g++]=E+3,m[g++]=E+2}p.indexOffset+=i.indexCount,p.setDirty()}var yF={},EF=function(){function t(t,e){this._texture=void 0,this._width=void 0,this._height=void 0,this._x=void 0,this._y=void 0,this._nexty=void 0,this._innerTextureInfos={},this._innerSpriteFrames=void 0,this._count=void 0;var i=new TF;i.initWithSize(t,e),this._texture=i,this._width=t,this._height=e,this._x=2,this._y=2,this._nexty=2,this._innerTextureInfos={},this._innerSpriteFrames=[],this._count=0}var e=t.prototype;return e.insertSpriteFrame=function(t){var e=t.rect,i=t.texture,n=this._innerTextureInfos[i.getId()],r=e.x,s=e.y;if(n)r+=n.x,s+=n.y;else{var a=i.width,o=i.height;if(this._x+a+2>this._width&&(this._x=2,this._y=this._nexty),this._y+o+2>this._nexty&&(this._nexty=this._y+o+2),this._nexty>this._height)return null;b.internal.dynamicAtlasManager.textureBleeding&&((a<=8||o<=8)&&(this._texture.drawTextureAt(i.image,this._x-1,this._y-1),this._texture.drawTextureAt(i.image,this._x-1,this._y+1),this._texture.drawTextureAt(i.image,this._x+1,this._y-1),this._texture.drawTextureAt(i.image,this._x+1,this._y+1)),this._texture.drawTextureAt(i.image,this._x-1,this._y),this._texture.drawTextureAt(i.image,this._x+1,this._y),this._texture.drawTextureAt(i.image,this._x,this._y-1),this._texture.drawTextureAt(i.image,this._x,this._y+1)),this._texture.drawTextureAt(i.image,this._x,this._y),this._innerTextureInfos[i.getId()]={x:this._x,y:this._y,texture:i},this._count++,r+=this._x,s+=this._y,this._x+=a+2}var u={x:r,y:s,texture:this._texture};return this._innerSpriteFrames.push(t),u},e.deleteInnerTexture=function(t){t&&this._innerTextureInfos[t.getId()]&&(delete this._innerTextureInfos[t.getId()],this._count--)},e.isEmpty=function(){return this._count<=0},e.reset=function(){this._x=2,this._y=2,this._nexty=2;for(var t=this._innerSpriteFrames,e=0,i=t.length;e<i;e++){var n=t[e];n.isValid&&n._resetDynamicAtlasFrame()}this._innerSpriteFrames.length=0,this._innerTextureInfos={}},e.destroy=function(){this.reset(),this._texture.destroy()},t}(),TF=function(t){function e(){return t.apply(this,arguments)||this}c(e,t);var i=e.prototype;return i.initWithSize=function(t,e,i){void 0===i&&(i=eg.RGBA8888),this.reset({width:t,height:e,format:i})},i.drawTextureAt=function(t,e,i){var n=this.getGFXTexture();if(t&&n){var r=this._getGFXDevice();if(r){var s=new Ir;s.texOffset.x=e,s.texOffset.y=i,s.texExtent.width=t.width,s.texExtent.height=t.height,r.copyTexImagesToTexture([t.data],n,[s])}else console.warn("Unable to get device")}},e}(qg),SF=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._atlases=[],e._atlasIndex=-1,e._maxAtlasCount=5,e._textureSize=2048,e._maxFrameSize=512,e._textureBleeding=!0,e._enabled=!1,e}c(e,t);var i=e.prototype;return i.newAtlas=function(){var t=this._atlases[++this._atlasIndex];return t||(t=new EF(this._textureSize,this._textureSize),this._atlases.push(t)),t},i.beforeSceneLoad=function(){this.reset()},i.init=function(){this.enabled=!Ee.CLEANUP_IMAGE_CACHE},i.insertSpriteFrame=function(t){if(!this._enabled||this._atlasIndex===this._maxAtlasCount||!t||t._original)return null;if(!t.packable)return null;var e=t.texture.getSamplerInfo();if(e.minFilter!==ng.LINEAR||e.magFilter!==ng.LINEAR||e.mipFilter!==ng.NONE)return null;var i=this._atlases[this._atlasIndex];i||(i=this.newAtlas());var n=i.insertSpriteFrame(t);return n||this._atlasIndex===this._maxAtlasCount?n:(i=this.newAtlas()).insertSpriteFrame(t)},i.reset=function(){for(var t=0,e=this._atlases.length;t<e;t++)this._atlases[t].destroy();this._atlases.length=0,this._atlasIndex=-1},i.deleteAtlasSpriteFrame=function(t){if(t._original){for(var e,i=this._atlases.length-1;i>=0;i--)e=this._atlases[i],le.array.fastRemove(e._innerSpriteFrames,t);var n=t._original._texture;this.deleteAtlasTexture(n)}},i.deleteAtlasTexture=function(t){if(t)for(var e=this._atlases.length-1;e>=0;e--)this._atlases[e].deleteInnerTexture(t),this._atlases[e].isEmpty()&&(this._atlases[e].destroy(),this._atlases.splice(e,1),this._atlasIndex--)},i.packToDynamicAtlas=function(t,e){if(this._enabled&&e&&!e._original&&e.packable&&e.texture&&e.texture.width>0&&e.texture.height>0){var i=this.insertSpriteFrame(e);i&&e._setDynamicAtlasFrame(i)}},h(e,[{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled!==t&&(t?(this.reset(),b.director.on(b.Director.EVENT_BEFORE_SCENE_LAUNCH,this.beforeSceneLoad,this)):(this.reset(),b.director.off(b.Director.EVENT_BEFORE_SCENE_LAUNCH,this.beforeSceneLoad,this)),this._enabled=t)}},{key:"maxAtlasCount",get:function(){return this._maxAtlasCount},set:function(t){this._maxAtlasCount=t}},{key:"atlasCount",get:function(){return this._atlases.length}},{key:"textureBleeding",get:function(){return this._textureBleeding},set:function(t){this._textureBleeding=t}},{key:"textureSize",get:function(){return this._textureSize},set:function(t){this._textureSize=t}},{key:"maxFrameSize",get:function(){return this._maxFrameSize},set:function(t){this._maxFrameSize=t}}]),e}(KE);SF.instance=void 0;var AF,RF=t("dynamicAtlasManager",SF.instance=new SF);OL.registerSystem("dynamicAtlasManager",RF,0),b.internal.dynamicAtlasManager=RF,function(t){t[t.positions=gr.ATTR_POSITION]="positions",t[t.normals=gr.ATTR_NORMAL]="normals",t[t.uvs=gr.ATTR_TEX_COORD]="uvs",t[t.colors=gr.ATTR_COLOR]="colors"}(AF||(AF={}));var bF,CF,wF,IF,OF,xF,PF=function(){function t(){this._arrayBufferOrPaddings=[],this._length=0}var e=t.prototype;return e.setNextAlignment=function(t){if(0!==t){var e=this._length%t;if(0!==e){var i=t-e;this._arrayBufferOrPaddings.push(i),this._length+=i}}},e.addBuffer=function(t){var e=this._length;return this._arrayBufferOrPaddings.push(t),this._length+=t.byteLength,e},e.getLength=function(){return this._length},e.getCombined=function(){var t=new Uint8Array(this._length),e=0;return this._arrayBufferOrPaddings.forEach((function(i){"number"==typeof i?e+=i:(t.set(new Uint8Array(i),e),e+=i.byteLength)})),t.buffer},t}(),DF=function(){function t(t,e){if(this._mesh=void 0,this._subMeshRenderings=[],this._mesh=t,this._mesh.struct.morph){var i=this._mesh.struct.primitives.length;this._subMeshRenderings=new Array(i).fill(null);for(var n=0;n<i;++n){var r=this._mesh.struct.morph.subMeshMorphs[n];r&&(r.targets.length>zp.MAX_MORPH_TARGET_COUNT?this._subMeshRenderings[n]=new NF(this._mesh,n,this._mesh.struct.morph,e):this._subMeshRenderings[n]=new BF(this._mesh,n,this._mesh.struct.morph,e))}}}return t.prototype.createInstance=function(){for(var t=this,e=this._mesh.struct.primitives.length,i=new Array(e),n=0;n<e;++n){var r,s;i[n]=null!==(r=null===(s=this._subMeshRenderings[n])||void 0===s?void 0:s.createInstance())&&void 0!==r?r:null}return{setWeights:function(t,e){var n;null===(n=i[t])||void 0===n||n.setWeights(e)},requiredPatches:function(e){t._mesh.struct.morph;var n=t._mesh.struct.morph.subMeshMorphs[e],r=i[e];if(null===r)return null;var s=[{name:"CC_USE_MORPH",value:!0},{name:"CC_MORPH_TARGET_COUNT",value:n.targets.length}];return n.attributes.includes(gr.ATTR_POSITION)&&s.push({name:"CC_MORPH_TARGET_HAS_POSITION",value:!0}),n.attributes.includes(gr.ATTR_NORMAL)&&s.push({name:"CC_MORPH_TARGET_HAS_NORMAL",value:!0}),n.attributes.includes(gr.ATTR_TANGENT)&&s.push({name:"CC_MORPH_TARGET_HAS_TANGENT",value:!0}),s.push.apply(s,r.requiredPatches()),s},adaptPipelineState:function(t,e){var n;null===(n=i[t])||void 0===n||n.adaptPipelineState(e)},destroy:function(){for(var t,e=y(i);!(t=e()).done;){var n=t.value;null==n||n.destroy()}}}},t}(),BF=function(){function t(t,e,i,n){this._gfxDevice=void 0,this._subMeshMorph=void 0,this._textureInfo=void 0,this._attributes=void 0,this._verticesCount=void 0,this._gfxDevice=n;var r=i.subMeshMorphs[e];this._subMeshMorph=r,UF(t,e,n);var s=t.struct.vertexBundles[t.struct.primitives[e].vertexBundelIndices[0]].view.count;this._verticesCount=s;var a=r.targets.length,o=FF(n,s*a);this._textureInfo={width:o.width,height:o.height},this._attributes=r.attributes.map((function(e,i){var n=o.create(),a=n.valueView;return r.targets.forEach((function(e,n){for(var r=e.displacements[i],o=new Float32Array(t.data.buffer,t.data.byteOffset+r.offset,r.count),u=s*n*4,h=0;h<s;++h)a[u+4*h+0]=o[3*h+0],a[u+4*h+1]=o[3*h+1],a[u+4*h+2]=o[3*h+2]})),n.updatePixels(),{name:e,morphTexture:n}}))}var e=t.prototype;return e.destroy=function(){for(var t,e=y(this._attributes);!(t=e()).done;)t.value.morphTexture.destroy()},e.createInstance=function(){var t=this,e=new LF(this._gfxDevice,this._subMeshMorph.targets.length);return e.setMorphTextureInfo(this._textureInfo.width,this._textureInfo.height),e.setVerticesCount(this._verticesCount),e.commit(),{setWeights:function(t){e.setWeights(t),e.commit()},requiredPatches:function(){return[{name:"CC_MORPH_TARGET_USE_TEXTURE",value:!0}]},adaptPipelineState:function(i){for(var n,r=y(t._attributes);!(n=r()).done;){var s=n.value,a=void 0;switch(s.name){case gr.ATTR_POSITION:a=qp;break;case gr.ATTR_NORMAL:a=Jp;break;case gr.ATTR_TANGENT:a=em;break;default:L("Unexpected attribute!")}void 0!==a&&(i.bindSampler(a,s.morphTexture.sampler),i.bindTexture(a,s.morphTexture.texture))}i.bindBuffer(zp.BINDING,e.buffer),i.update()},destroy:function(){}}},t}(),NF=function(){function t(t,e,i,n){this._gfxDevice=void 0,this._attributes=[],this._gfxDevice=n;var r=i.subMeshMorphs[e];UF(t,e,n),this._attributes=r.attributes.map((function(e,i){return{name:e,targets:r.targets.map((function(e){return{displacements:new Float32Array(t.data.buffer,t.data.byteOffset+e.displacements[i].offset,e.displacements[i].count)}}))}}))}return t.prototype.createInstance=function(){return new MF(this,this._attributes[0].targets[0].displacements.length/3,this._gfxDevice)},h(t,[{key:"data",get:function(){return this._attributes}}]),t}(),MF=function(){function t(t,e,i){this._attributes=void 0,this._owner=void 0,this._morphUniforms=void 0,this._owner=t,this._morphUniforms=new LF(i,0);var n=FF(i,e);this._morphUniforms.setMorphTextureInfo(n.width,n.height),this._morphUniforms.commit(),this._attributes=this._owner.data.map((function(t){var e=n.create();return{attributeName:t.name,morphTexture:e}}))}var e=t.prototype;return e.setWeights=function(t){for(var e=0;e<this._attributes.length;++e){var i=this._attributes[e],n=i.morphTexture.valueView,r=this._owner.data[e];t.length,r.targets.length;for(var s=0;s<r.targets.length;++s){var a=r.targets[s].displacements,o=t[s],u=a.length/3;if(0===s)for(var h=0;h<u;++h)n[4*h+0]=a[3*h+0]*o,n[4*h+1]=a[3*h+1]*o,n[4*h+2]=a[3*h+2]*o;else if(0!==o)for(var l=0;l<u;++l)n[4*l+0]+=a[3*l+0]*o,n[4*l+1]+=a[3*l+1]*o,n[4*l+2]+=a[3*l+2]*o}i.morphTexture.updatePixels()}},e.requiredPatches=function(){return[{name:"CC_MORPH_TARGET_USE_TEXTURE",value:!0},{name:"CC_MORPH_PRECOMPUTED",value:!0}]},e.adaptPipelineState=function(t){for(var e,i=y(this._attributes);!(e=i()).done;){var n=e.value,r=void 0;switch(n.attributeName){case gr.ATTR_POSITION:r=qp;break;case gr.ATTR_NORMAL:r=Jp;break;case gr.ATTR_TANGENT:r=em;break;default:L("Unexpected attribute!")}void 0!==r&&(t.bindSampler(r,n.morphTexture.sampler),t.bindTexture(r,n.morphTexture.texture))}t.bindBuffer(zp.BINDING,this._morphUniforms.buffer),t.update()},e.destroy=function(){this._morphUniforms.destroy();for(var t=0;t<this._attributes.length;++t)this._attributes[t].morphTexture.destroy()},t}(),LF=function(){function t(t,e){this._targetCount=void 0,this._localBuffer=void 0,this._remoteBuffer=void 0,this._targetCount=e,this._localBuffer=new DataView(new ArrayBuffer(zp.SIZE)),this._remoteBuffer=t.createBuffer(new Mr(Dn.UNIFORM|Dn.TRANSFER_DST,Mn.HOST|Mn.DEVICE,zp.SIZE,zp.SIZE))}var e=t.prototype;return e.destroy=function(){this._remoteBuffer.destroy()},e.setWeights=function(t){t.length,this._targetCount;for(var e=0;e<t.length;++e)this._localBuffer.setFloat32(zp.OFFSET_OF_WEIGHTS+4*e,t[e],b.sys.isLittleEndian)},e.setMorphTextureInfo=function(t,e){this._localBuffer.setFloat32(zp.OFFSET_OF_DISPLACEMENT_TEXTURE_WIDTH,t,b.sys.isLittleEndian),this._localBuffer.setFloat32(zp.OFFSET_OF_DISPLACEMENT_TEXTURE_HEIGHT,e,b.sys.isLittleEndian)},e.setVerticesCount=function(t){this._localBuffer.setFloat32(zp.OFFSET_OF_VERTICES_COUNT,t,b.sys.isLittleEndian)},e.commit=function(){this._remoteBuffer.update(this._localBuffer.buffer)},h(t,[{key:"buffer",get:function(){return this._remoteBuffer}}]),t}();function FF(t,e){var n,r,a,o;t.getFormatFeatures(On.RGBA32F)&Gn.SAMPLED_TEXTURE?(n=e,a=16,r=qg.PixelFormat.RGBA32F,o=Float32Array):(n=4*e,a=4,r=qg.PixelFormat.RGBA8888,o=Uint8Array);var u=function(t){t<5&&(t=5);var e=i(s(t)),n=e>>1;return{width:1<<(1&e?n+1:n),height:1<<n}}(n),h=u.width,l=u.height;return{width:h,height:l,create:function(){var e=new ArrayBuffer(h*l*a),i=new Float32Array(e),n=o===Float32Array?i:new o(e),s=new Ag({width:h,height:l,_data:n,_compressed:!1,format:r}),u=new qg;u.setFilters(qg.Filter.NEAREST,qg.Filter.NEAREST),u.setMipFilter(qg.Filter.NONE),u.setWrapMode(qg.WrapMode.CLAMP_TO_EDGE,qg.WrapMode.CLAMP_TO_EDGE,qg.WrapMode.CLAMP_TO_EDGE),u.image=s,u.getGFXTexture()||L("Unexpected: failed to create morph texture?");var c=t.getSampler(u.getSamplerInfo());return{get texture(){return u.getGFXTexture()},get sampler(){return c},get valueView(){return i},destroy:function(){u.destroy()},updatePixels:function(){u.uploadData(n)}}}}}function UF(t,e,i){t.renderingSubMeshes[e].enableVertexIdChannel(i)}function GF(t){switch(t){case 1:return Uint8Array;case 2:return Uint16Array;case 4:return Uint32Array;default:return Uint8Array}}var kF=new ji,zF=new ji,HF=new Uint8Array,VF=_h("cc.Mesh")((xF=function(t){function e(){var e;return(e=t.call(this)||this).morphRendering=null,E(e,"_struct",wF,g(e)),E(e,"_hash",IF,g(e)),e._data=HF,e._initialized=!1,E(e,"_allowDataAccess",OF,g(e)),e._isMeshDataUploaded=!1,e._renderingSubMeshes=null,e._boneSpaceBounds=new Map,e._jointBufferIndices=null,e}c(e,t);var i=e.prototype;return i.onLoaded=function(){this.initialize()},i.initialize=function(){var t=this;if(!this._initialized)if(this._initialized=!0,this._struct.dynamic){for(var e=Ja.gfxDevice,i=[],n=[],r=0;r<this._struct.vertexBundles.length;r++){var s=this._struct.vertexBundles[r],a=e.createBuffer(new Mr(Dn.VERTEX|Dn.TRANSFER_DST,Mn.DEVICE,s.view.length,s.view.stride));i.push(a)}for(var o=0;o<this._struct.primitives.length;o++){var u=this._struct.primitives[o],h=u.indexView,l=null;h&&(l=e.createBuffer(new Mr(Dn.INDEX|Dn.TRANSFER_DST,Mn.DEVICE,h.length,h.stride)));for(var c=[],_=0;_<u.vertexBundelIndices.length;_++){var f=u.vertexBundelIndices[_];c.push(i[f])}for(var d=[],p=0;p<u.vertexBundelIndices.length;p++)for(var m,g=u.vertexBundelIndices[p],v=y(this._struct.vertexBundles[g].attributes);!(m=v()).done;){var E=m.value,T=new Jr;T.copy(E),d.push(T)}var S=new wN(c,d,u.primitiveMode,l);S.drawInfo=new Fr,S.mesh=this,S.subMeshIdx=o,n.push(S)}this._renderingSubMeshes=n}else!function(){for(var e=t._data.buffer,i=Ja.gfxDevice,n=t._createVertexBuffers(i,e),r=[],s=0;s<t._struct.primitives.length;s++){var a=t._struct.primitives[s];if(0!==a.vertexBundelIndices.length){var o=null,u=null;if(a.indexView){var h=a.indexView,l=h.stride,c=h.length;if(4===l&&!i.hasFeature(In.ELEMENT_INDEX_UINT)){var _=t._struct.vertexBundles[a.vertexBundelIndices[0]].view.count;if(_>=65536){j(10001,_,65536);continue}l>>=1,c>>=1}o=i.createBuffer(new Mr(Dn.INDEX,Mn.DEVICE,c,l)),u=new(GF(h.stride))(e,h.offset,h.count),h.stride!==l&&(u=GF(l).from(u)),o.update(u)}var f=a.vertexBundelIndices.map((function(t){return n[t]})),d=[];if(a.vertexBundelIndices.length>0)for(var p=a.vertexBundelIndices[0],m=t._struct.vertexBundles[p].attributes,g=0;g<m.length;++g){var v=m[g];d[g]=new Jr(v.name,v.format,v.isNormalized,v.stream,v.isInstanced,v.location)}var y=new wN(f,d,a.primitiveMode,o);y.mesh=t,y.subMeshIdx=s,r.push(y)}}t._renderingSubMeshes=r,t._struct.morph&&(t.morphRendering=function(t,e){return new DF(t,e)}(t,i)),t._isMeshDataUploaded=!0,t._allowDataAccess||t.releaseData()}()},i.updateSubMesh=function(t,e){if(this._struct.dynamic)if(t>=this._struct.primitives.length)j(14201);else{var i=[];if(e.positions.length>0&&i.push(e.positions),e.normals&&e.normals.length>0&&i.push(e.normals),e.uvs&&e.uvs.length>0&&i.push(e.uvs),e.tangents&&e.tangents.length>0&&i.push(e.tangents),e.colors&&e.colors.length>0&&i.push(e.colors),e.customAttributes)for(var n=0;n<e.customAttributes.length;n++)i.push(e.customAttributes[n].values);for(var r=this._struct.dynamic,s=r.info,a=this._struct.primitives[t],o=this._renderingSubMeshes[t],u=o.drawInfo,h=0;h<i.length;h++){var l=i[h],c=this._struct.vertexBundles[a.vertexBundelIndices[h]],_=c.view.stride,f=l.byteLength/_,d=l.byteLength,p=new Uint8Array(this._data.buffer,c.view.offset,d),m=new Uint8Array(l.buffer,l.byteOffset,d),g=o.vertexBuffers[h];s.maxSubMeshVertices,d>0&&(p.set(m),g.update(m,d)),c.view.count=f,u.vertexCount=f}if(a.indexView){var v=a.indexView,E=v.stride,T=2===E?e.indices16.length:e.indices32.length,S=T*E,A=new Uint8Array(this._data.buffer,v.offset,S),R=2===E?new Uint8Array(e.indices16.buffer,e.indices16.byteOffset,S):new Uint8Array(e.indices32.buffer,e.indices32.byteOffset,S),b=o.indexBuffer;s.maxSubMeshIndices,S>0&&(A.set(R),b.update(R,S)),v.count=T,u.indexCount=T}if(e.minPos&&e.maxPos){var C=new ji(e.minPos.x,e.minPos.y,e.minPos.z),w=new ji(e.maxPos.x,e.maxPos.y,e.maxPos.z);r.bounds[t]||(r.bounds[t]=new Fu),Fu.fromPoints(r.bounds[t],C,w);for(var I,O=new ji,x=new ji,P=y(r.bounds);!(I=P()).done;){var D=I.value;D&&(D.getBoundary(O,x),ji.min(C,O,C),ji.max(w,x,w))}this._struct.minPosition=new ji(C.x,C.y,C.z),this._struct.maxPosition=new ji(w.x,w.y,w.z)}o.invalidateGeometricInfo()}else j(14200)},i.destroy=function(){return this.destroyRenderingMesh(),t.prototype.destroy.call(this)},i.destroyRenderingMesh=function(){if(this._renderingSubMeshes){for(var t=0;t<this._renderingSubMeshes.length;t++)this._renderingSubMeshes[t].destroy();this._renderingSubMeshes=null,this._initialized=!1,this._isMeshDataUploaded=!1}},i.assign=function(t,e){this.reset({struct:t,data:e})},i.reset=function(t){this.destroyRenderingMesh(),this._struct=t.struct,this._data=t.data,this._hash=0},i.getBoneSpaceBounds=function(t){if(this._boneSpaceBounds.has(t.hash))return this._boneSpaceBounds.get(t.hash);var e=[];this._boneSpaceBounds.set(t.hash,e);for(var i=[],n=t.bindposes,r=0;r<n.length;r++)e.push(new Fu(1/0,1/0,1/0,-1/0,-1/0,-1/0)),i.push(!1);for(var s=this._struct.primitives,a=0;a<s.length;a++){var o=this.readAttribute(a,gr.ATTR_JOINTS),u=this.readAttribute(a,gr.ATTR_WEIGHTS),h=this.readAttribute(a,gr.ATTR_POSITION);if(o&&u&&h)for(var l=Math.min(o.length/4,u.length/4,h.length/3),c=0;c<l;c++){ji.set(kF,h[3*c+0],h[3*c+1],h[3*c+2]);for(var _=0;_<4;++_){var f=4*c+_,d=o[f];if(!(0===u[f]||d>=n.length)){ji.transformMat4(zF,kF,n[d]),i[d]=!0;var p=e[d];ji.min(p.center,p.center,zF),ji.max(p.halfExtents,p.halfExtents,zF)}}}}for(var m=0;m<n.length;m++){var g=e[m];i[m]?Fu.fromPoints(g,g.center,g.halfExtents):e[m]=null}return e},i.merge=function(t,e,i){if(i&&!this.validateMergingMesh(t))return!1;var n=new ji,r=e&&new $i,s=e&&new Fu;if(r&&e.getRotation(r),!this._initialized){var a=JSON.parse(JSON.stringify(t._struct)),o=t._data.slice();if(e){a.maxPosition&&a.minPosition&&(ji.add(s.center,a.maxPosition,a.minPosition),ji.multiplyScalar(s.center,s.center,.5),ji.subtract(s.halfExtents,a.maxPosition,a.minPosition),ji.multiplyScalar(s.halfExtents,s.halfExtents,.5),Fu.transform(s,s,e),ji.add(a.maxPosition,s.center,s.halfExtents),ji.subtract(a.minPosition,s.center,s.halfExtents));for(var u=0;u<a.vertexBundles.length;u++)for(var h=a.vertexBundles[u],l=0;l<h.attributes.length;l++)if(h.attributes[l].name===gr.ATTR_POSITION||h.attributes[l].name===gr.ATTR_NORMAL){var c=h.attributes[l].format,_=new DataView(o.buffer,h.view.offset+WF(h.attributes,l)),f=YF(_,c),d=KF(_,c);if(!f||!d)continue;for(var p=h.view.count,m=h.view.stride,g=jF(c),v=0;v<p;v++){var E=v*m,T=E+g,S=T+g;switch(n.set(f(E),f(T),f(S)),h.attributes[l].name){case gr.ATTR_POSITION:n.transformMat4(e);break;case gr.ATTR_NORMAL:ji.transformQuat(n,n,r)}d(E,n.x),d(T,n.y),d(S,n.z)}}}return this.reset({struct:a,data:o}),this.initialize(),!0}for(var A,R,b,C,w,I=new PF,O=0,x=0,P=0,D=0,B=0,N=0,M=0,L=0,F=!1,U=new Array(this._struct.vertexBundles.length),G=0;G<this._struct.vertexBundles.length;++G){var k=this._struct.vertexBundles[G],z=t._struct.vertexBundles[G];P=k.view.offset,D=z.view.offset,x=k.view.stride,O=k.view.count+z.view.count,A=new ArrayBuffer(O*x),R=new Uint8Array(A),P+=(b=this._data.subarray(P,P+k.view.length)).length,D+=(C=t._data.subarray(D,D+z.view.length)).length,R.set(b),B=0;for(var H,V=y(k.attributes);!(H=V()).done;){var W=H.value;M=0,F=!1;for(var X,j=y(z.attributes);!(X=j()).done;){var Y=X.value;if(W.name===Y.name&&W.format===Y.format){F=!0;break}M+=As[Y.format].size}if(F){L=As[W.format].size,N=k.view.length+B;for(var K=0;K<z.view.count;++K){if(w=C.subarray(M,M+L),R.set(w,N),(W.name===gr.ATTR_POSITION||W.name===gr.ATTR_NORMAL)&&e){var q=new Float32Array(R.buffer,N,3);switch(n.set(q[0],q[1],q[2]),W.name){case gr.ATTR_POSITION:n.transformMat4(e);break;case gr.ATTR_NORMAL:ji.transformQuat(n,n,r)}q[0]=n.x,q[1]=n.y,q[2]=n.z}N+=k.view.stride,M+=z.view.stride}}B+=As[W.format].size}U[G]={attributes:k.attributes,view:{offset:I.getLength(),length:A.byteLength,count:O,stride:x}},I.addBuffer(A)}for(var Q,Z,J,$=0,tt=2,et=0,it=new Array(this._struct.primitives.length),nt=0;nt<this._struct.primitives.length;++nt){var rt=this._struct.primitives[nt],st=t._struct.primitives[nt];it[nt]={primitiveMode:rt.primitiveMode,vertexBundelIndices:rt.vertexBundelIndices};for(var at,ot=y(rt.vertexBundelIndices);!(at=ot()).done;){var ut=at.value;et=Math.max(et,this._struct.vertexBundles[ut].view.count)}if(rt.indexView&&st.indexView){$=rt.indexView.count,$+=st.indexView.count,P=rt.indexView.offset,D=st.indexView.offset,tt=$<256?1:$<65536?2:4;var ht=new ArrayBuffer($*tt);if(Q=2===tt?new Uint16Array(ht):1===tt?new Uint8Array(ht):new Uint32Array(ht),Z=2===rt.indexView.stride?new Uint16Array(this._data.buffer,P,rt.indexView.count):1===rt.indexView.stride?new Uint8Array(this._data.buffer,P,rt.indexView.count):new Uint32Array(this._data.buffer,P,rt.indexView.count),tt===rt.indexView.stride)Q.set(Z);else for(var lt=0;lt<rt.indexView.count;++lt)Q[lt]=Z[lt];P+=rt.indexView.length,J=2===st.indexView.stride?new Uint16Array(t._data.buffer,D,st.indexView.count):1===st.indexView.stride?new Uint8Array(t._data.buffer,D,st.indexView.count):new Uint32Array(t._data.buffer,D,st.indexView.count);for(var ct=0;ct<st.indexView.count;++ct)Q[rt.indexView.count+ct]=et+J[ct];D+=st.indexView.length,it[nt].indexView={offset:I.getLength(),length:ht.byteLength,count:$,stride:tt},I.setNextAlignment(tt),I.addBuffer(ht)}}var _t={vertexBundles:U,primitives:it,minPosition:this._struct.minPosition,maxPosition:this._struct.maxPosition};return _t.minPosition&&t._struct.minPosition&&_t.maxPosition&&t._struct.maxPosition&&(e?(ji.add(s.center,t._struct.maxPosition,t._struct.minPosition),ji.multiplyScalar(s.center,s.center,.5),ji.subtract(s.halfExtents,t._struct.maxPosition,t._struct.minPosition),ji.multiplyScalar(s.halfExtents,s.halfExtents,.5),Fu.transform(s,s,e),ji.add(n,s.center,s.halfExtents),ji.max(_t.maxPosition,_t.maxPosition,n),ji.subtract(n,s.center,s.halfExtents),ji.min(_t.minPosition,_t.minPosition,n)):(ji.min(_t.minPosition,_t.minPosition,t._struct.minPosition),ji.max(_t.maxPosition,_t.maxPosition,t._struct.maxPosition))),this.reset({struct:_t,data:new Uint8Array(I.getCombined())}),this.initialize(),!0},i.validateMergingMesh=function(t){if(this._struct.dynamic||t._struct.dynamic)return!1;if(this._struct.vertexBundles.length!==t._struct.vertexBundles.length)return!1;for(var e=0;e<this._struct.vertexBundles.length;++e){var i=this._struct.vertexBundles[e],n=t._struct.vertexBundles[e];if(i.attributes.length!==n.attributes.length)return!1;for(var r=0;r<i.attributes.length;++r)if(i.attributes[r].format!==n.attributes[r].format)return!1}if(this._struct.primitives.length!==t._struct.primitives.length)return!1;for(var s=0;s<this._struct.primitives.length;++s){var a=this._struct.primitives[s],o=t._struct.primitives[s];if(a.vertexBundelIndices.length!==o.vertexBundelIndices.length)return!1;for(var u=0;u<a.vertexBundelIndices.length;++u)if(a.vertexBundelIndices[u]!==o.vertexBundelIndices[u])return!1;if(a.primitiveMode!==o.primitiveMode)return!1;if(a.indexView){if(void 0===o.indexView)return!1}else if(o.indexView)return!1}return!0},i.readAttribute=function(t,e){var i=this,n=null;return this._accessAttribute(t,e,(function(t,e){var r=t.view.count,s=t.attributes[e].format,a=Ds(As[s]);if(0!==r){var o=new DataView(i._data.buffer,t.view.offset+WF(t.attributes,e)),u=As[s],h=YF(o,s);if(a&&h){for(var l=u.count,c=new a(r*l),_=t.view.stride,f=0;f<r;++f)for(var d=0;d<l;++d)c[l*f+d]=h(_*f+c.BYTES_PER_ELEMENT*d);n=c}}})),n},i.copyAttribute=function(t,e,i,n,r){var s=this,a=!1;return this._accessAttribute(t,e,(function(t,e){var o=t.view.count;if(0!==o){var u=t.attributes[e].format,h=new DataView(s._data.buffer,t.view.offset+WF(t.attributes,e)),l=new DataView(i,r),c=As[u],_=YF(h,u),f=KF(l,u);if(_&&f){for(var d=c.count,p=t.view.stride,m=jF(u),g=n,v=m,y=0;y<o;++y)for(var E=0;E<d;++E)f(g*y+v*E,_(p*y+m*E));a=!0}}else a=!0})),a},i.readIndices=function(t){if(t>=this._struct.primitives.length)return null;var e=this._struct.primitives[t];if(!e.indexView)return null;var i=e.indexView.stride;return new(1===i?Uint8Array:2===i?Uint16Array:Uint32Array)(this._data.buffer,e.indexView.offset,e.indexView.count)},i.copyIndices=function(t,e){if(t>=this._struct.primitives.length)return!1;var i=this._struct.primitives[t];if(!i.indexView)return!1;for(var n=i.indexView.count,r=1===i.indexView.stride?On.R8UI:2===i.indexView.stride?On.R16UI:On.R32UI,s=YF(new DataView(this._data.buffer),r),a=0;a<n;++a)e[a]=s(i.indexView.offset+As[r].size*a);return!0},i.readAttributeFormat=function(t,e){var i=null;return this._accessAttribute(t,e,(function(t,e){var n=t.attributes[e].format;i=As[n]})),i},i._accessAttribute=function(t,e,i){if(!(t>=this._struct.primitives.length))for(var n,r=y(this._struct.primitives[t].vertexBundelIndices);!(n=r()).done;){var s=n.value,a=this._struct.vertexBundles[s],o=a.attributes.findIndex((function(t){return t.name===e}));if(!(o<0)){i(a,o);break}}},i._createVertexBuffers=function(t,e){return this._struct.vertexBundles.map((function(i){var n=t.createBuffer(new Mr(Dn.VERTEX,Mn.DEVICE,i.view.length,i.view.stride)),r=new Uint8Array(e,i.view.offset,i.view.length);return n.update(r),n}))},i.initDefault=function(e){t.prototype.initDefault.call(this,e),this.reset({struct:{vertexBundles:[],primitives:[]},data:HF})},i.releaseData=function(){this._data=HF},h(e,[{key:"_nativeAsset",get:function(){return this._data.buffer},set:function(t){this._data=new Uint8Array(t)}},{key:"subMeshCount",get:function(){var t=this.renderingSubMeshes;return t?t.length:0}},{key:"minPosition",get:function(){return this.struct.minPosition}},{key:"maxPosition",get:function(){return this.struct.maxPosition}},{key:"struct",get:function(){return this._struct}},{key:"data",get:function(){return this._data}},{key:"hash",get:function(){return this._hash||(this._hash=Vs(this._data,666)),this._hash}},{key:"jointBufferIndices",get:function(){return this._jointBufferIndices?this._jointBufferIndices:this._jointBufferIndices=this._struct.primitives.map((function(t){return t.jointMapIndex||0}))}},{key:"renderingSubMeshes",get:function(){return this.initialize(),this._renderingSubMeshes}},{key:"allowDataAccess",get:function(){return this._allowDataAccess},set:function(t){this._allowDataAccess=t,this._isMeshDataUploaded&&!this._allowDataAccess&&this.releaseData()}}]),e}(Wl),wF=T((CF=xF).prototype,"_struct",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return{vertexBundles:[],primitives:[]}}}),IF=T(CF.prototype,"_hash",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),OF=T(CF.prototype,"_allowDataAccess",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),bF=CF))||bF;function WF(t,e){for(var i=0,n=0;n<e;++n){var r=t[n];i+=As[r.format].size}return i}b.Mesh=VF;var XF=Qa.isLittleEndian;function jF(t){var e=As[t];return e.size/e.count}function YF(t,e){var i=As[e],n=i.size/i.count;switch(i.type){case xn.UNORM:switch(n){case 1:return function(e){return t.getUint8(e)};case 2:return function(e){return t.getUint16(e,XF)};case 4:return function(e){return t.getUint32(e,XF)}}break;case xn.SNORM:case xn.INT:switch(n){case 1:return function(e){return t.getInt8(e)};case 2:return function(e){return t.getInt16(e,XF)};case 4:return function(e){return t.getInt32(e,XF)}}break;case xn.UINT:switch(n){case 1:return function(e){return t.getUint8(e)};case 2:return function(e){return t.getUint16(e,XF)};case 4:return function(e){return t.getUint32(e,XF)}}break;case xn.FLOAT:return function(e){return t.getFloat32(e,XF)}}return null}function KF(t,e){var i=As[e],n=i.size/i.count;switch(i.type){case xn.UNORM:switch(n){case 1:return function(e,i){return t.setUint8(e,i)};case 2:return function(e,i){return t.setUint16(e,i,XF)};case 4:return function(e,i){return t.setUint32(e,i,XF)}}break;case xn.SNORM:case xn.INT:switch(n){case 1:return function(e,i){return t.setInt8(e,i)};case 2:return function(e,i){return t.setInt16(e,i,XF)};case 4:return function(e,i){return t.setInt32(e,i,XF)}}break;case xn.UINT:switch(n){case 1:return function(e,i){return t.setUint8(e,i)};case 2:return function(e,i){return t.setUint16(e,i,XF)};case 4:return function(e,i){return t.setUint32(e,i,XF)}}break;case xn.FLOAT:return function(e,i){return t.setFloat32(e,i,XF)}}return null}var qF,QF,ZF,JF=[new Jr(gr.ATTR_POSITION,On.RGB32F),new Jr(gr.ATTR_NORMAL,On.RGB32F),new Jr(gr.ATTR_TEX_COORD,On.RG32F),new Jr(gr.ATTR_TANGENT,On.RGBA32F),new Jr(gr.ATTR_COLOR,On.RGBA32F)],$F=new ji;function tU(t,e,i){i=i||{};var n,r=[],s=0,a=[],o=0,u=t.positions.slice();if(u.length>0){if(n=null,t.attributes)for(var h,l=y(t.attributes);!(h=l()).done;){var c=h.value;if(c.name===gr.ATTR_POSITION){n=c;break}}n||(n=JF[0]),r.push(n);var _=As[n.format];o=Math.max(o,Math.floor(u.length/_.count)),a.push({offset:s,data:u,attribute:n}),s+=_.size}if(t.normals&&t.normals.length>0){if(n=null,t.attributes)for(var f,d=y(t.attributes);!(f=d()).done;){var p=f.value;if(p.name===gr.ATTR_NORMAL){n=p;break}}n||(n=JF[1]);var m=As[n.format];r.push(n),o=Math.max(o,Math.floor(t.normals.length/m.count)),a.push({offset:s,data:t.normals,attribute:n}),s+=m.size}if(t.uvs&&t.uvs.length>0){if(n=null,t.attributes)for(var g,v=y(t.attributes);!(g=v()).done;){var E=g.value;if(E.name===gr.ATTR_TEX_COORD){n=E;break}}n||(n=JF[2]);var T=As[n.format];r.push(n),o=Math.max(o,Math.floor(t.uvs.length/T.count)),a.push({offset:s,data:t.uvs,attribute:n}),s+=T.size}if(t.tangents&&t.tangents.length>0){if(n=null,t.attributes)for(var S,A=y(t.attributes);!(S=A()).done;){var R=S.value;if(R.name===gr.ATTR_TANGENT){n=R;break}}n||(n=JF[3]);var b=As[n.format];r.push(n),o=Math.max(o,Math.floor(t.tangents.length/b.count)),a.push({offset:s,data:t.tangents,attribute:n}),s+=b.size}if(t.colors&&t.colors.length>0){if(n=null,t.attributes)for(var C,w=y(t.attributes);!(C=w()).done;){var I=C.value;if(I.name===gr.ATTR_COLOR){n=I;break}}n||(n=JF[4]);var O=As[n.format];r.push(n),o=Math.max(o,Math.floor(t.colors.length/O.count)),a.push({offset:s,data:t.colors,attribute:n}),s+=O.size}if(t.customAttributes)for(var x=0;x<t.customAttributes.length;x++){var P=t.customAttributes[x],D=As[P.attr.format];r.push(P.attr),o=Math.max(o,Math.floor(P.values.length/D.count)),a.push({offset:s,data:P.values,attribute:P.attr}),s+=D.size}for(var B=new PF,N=new ArrayBuffer(o*s),M=new DataView(N),L=0,F=a;L<F.length;L++){var U=F[L];TN(M,U.data,U.attribute.format,U.offset,s)}B.setNextAlignment(0);var G={attributes:r,view:{offset:B.getLength(),length:N.byteLength,count:o,stride:s}};B.addBuffer(N);var k=null,z=0;if(t.indices){var H=t.indices;z=H.length,k=new ArrayBuffer(2*z),TN(new DataView(k),H,On.R16UI)}var V={primitiveMode:t.primitiveMode||er.TRIANGLE_LIST,vertexBundelIndices:[0]};k&&(B.setNextAlignment(2),V.indexView={offset:B.getLength(),length:k.byteLength,count:z,stride:2},B.addBuffer(k));var W=t.minPos;if(!W&&i.calculateBounds){W=ji.set(new ji,1/0,1/0,1/0);for(var X=0;X<o;++X)ji.set($F,u[3*X+0],u[3*X+1],u[3*X+2]),ji.min(W,W,$F)}var j=t.maxPos;if(!j&&i.calculateBounds){j=ji.set(new ji,-1/0,-1/0,-1/0);for(var Y=0;Y<o;++Y)ji.set($F,u[3*Y+0],u[3*Y+1],u[3*Y+2]),ji.max(j,j,$F)}var K={vertexBundles:[G],primitives:[V]};return W&&(K.minPosition=new ji(W.x,W.y,W.z)),j&&(K.maxPosition=new ji(j.x,j.y,j.z)),e||(e=new VF),e.reset({struct:K,data:new Uint8Array(B.getCombined())}),e}var eU,iU=new ji,nU=new un;!function(t){t[t.RECT=0]="RECT",t[t.POLYGON=1]="POLYGON"}(eU||(eU={}));var rU,sU,aU,oU,uU=[{u:0,v:0},{u:0,v:0},{u:0,v:0},{u:0,v:0}],hU=t("SpriteFrame",_h("cc.SpriteFrame")((ZF=QF=function(t){function e(){var e;return(e=t.call(this)||this).vertices=null,e.uv=[],e.unbiasUV=[],e.uvSliced=[],e._rect=new yn,e._trimmedBorder=new Li,e._offset=new _n,e._originalSize=new gn,e._rotated=!1,e._capInsets=[0,0,0,0],e._atlasUuid="",e._texture=void 0,e._isFlipUVY=!1,e._isFlipUVX=!1,e._original=null,e._packable=!0,e._pixelsToUnit=100,e._pivot=new _n(.5,.5),e._meshType=eU.RECT,e._extrude=0,e._customOutLine=[],e._minPos=new ji,e._maxPos=new ji,e}c(e,t),e.createWithImage=function(t){var i=t instanceof Ag?t:new Ag(t),n=new qg;n.image=i;var r=new e;return r.texture=n,r};var i=e.prototype;return i.textureLoaded=function(){return!!this.texture},i.isRotated=function(){return this._rotated},i.setRotated=function(t){this.rotated=t},i.getRect=function(t){return t?(t.set(this._rect),t):this._rect.clone()},i.setRect=function(t){this.rect=t},i.getOriginalSize=function(t){return t?(t.set(this._originalSize),t):this._originalSize.clone()},i.setOriginalSize=function(t){this.originalSize=t},i.getOffset=function(t){return t?(t.set(this._offset),t):this._offset.clone()},i.setOffset=function(t){this.offset=t},i.getGFXTexture=function(){return this._texture.getGFXTexture()},i.getGFXSampler=function(){return this._texture.getGFXSampler()},i.getHash=function(){return this._texture.getHash()},i.getSamplerInfo=function(){return this._texture.getSamplerInfo()},i.reset=function(t,e){void 0===e&&(e=!1);var i=!1;e&&(this._originalSize.set(0,0),this._rect.set(0,0,0,0),this._offset.set(0,0),this._capInsets=[0,0,0,0],this._rotated=!1,i=!0),t&&(t.texture&&(this._rect.x=this._rect.y=0,this._rect.width=t.texture.width,this._rect.height=t.texture.height,this._refreshTexture(t.texture),this.checkRect(this._texture)),t.originalSize&&this._originalSize.set(t.originalSize),t.rect&&this._rect.set(t.rect),t.offset&&this._offset.set(t.offset),void 0!==t.borderTop&&(this._capInsets[1]=t.borderTop),void 0!==t.borderBottom&&(this._capInsets[3]=t.borderBottom),void 0!==t.borderLeft&&(this._capInsets[0]=t.borderLeft),void 0!==t.borderRight&&(this._capInsets[2]=t.borderRight),void 0!==t.isRotate&&(this._rotated=!!t.isRotate),void 0!==t.isFlipUv&&(this._isFlipUVY=!!t.isFlipUv),i=!0),i&&this.texture&&this._calculateUV(),this._calcTrimmedBorder()},i.checkRect=function(t){var e=this._rect,i=e.x,n=e.y;return this._rotated?(i+=e.height,n+=e.width):(i+=e.width,n+=e.height),i>t.width?(K(3300,this.name+"/"+t.name,i,t.width),!1):!(n>t.height&&(K(3301,this.name+"/"+t.name,n,t.height),1))},i._calcTrimmedBorder=function(){var t=this._originalSize.width,e=this._originalSize.height,i=.5*(t-this._rect.width),n=.5*(e-this._rect.height);this._trimmedBorder.x=this._offset.x+i,this._trimmedBorder.y=this._offset.x-i,this._trimmedBorder.z=this._offset.y+n,this._trimmedBorder.w=this._offset.y-n},i.ensureMeshData=function(){this._mesh||(this._initVertices(),this._createMesh())},i.destroy=function(){return this._packable&&RF&&RF.deleteAtlasSpriteFrame(this),t.prototype.destroy.call(this)},i._calculateSlicedUV=function(){var t=this._rect,i=this.texture,n=i.width,r=i.height,s=this._capInsets[0],a=this._capInsets[2],o=t.width-s-a,u=this._capInsets[1],h=this._capInsets[3],l=t.height-u-h,c=this.uvSliced;if(c.length=0,this._rotated){uU[0].u=t.x/n,uU[1].u=(t.x+h)/n,uU[2].u=(t.x+h+l)/n,uU[3].u=(t.x+t.height)/n,uU[3].v=t.y/r,uU[2].v=(t.y+s)/r,uU[1].v=(t.y+s+o)/r,uU[0].v=(t.y+t.width)/r;for(var _=0;_<4;++_)for(var f=uU[_],d=0;d<4;++d){var p=uU[3-d];c.push({u:f.u,v:p.v})}}else{uU[0].u=t.x/n,uU[1].u=(t.x+s)/n,uU[2].u=(t.x+s+o)/n,uU[3].u=(t.x+t.width)/n,uU[3].v=t.y/r,uU[2].v=(t.y+u)/r,uU[1].v=(t.y+u+l)/r,uU[0].v=(t.y+t.height)/r;for(var m=0;m<4;++m)for(var g=uU[m],v=0;v<4;++v){var y=uU[v];c.push({u:y.u,v:g.v})}}this.emit(e.EVENT_UV_UPDATED,this)},i._calculateUV=function(){var t=this._rect,e=this.uv,i=this.unbiasUV,n=this.texture,r=n.width,s=n.height;if(this._rotated){var a=0===r?0:t.x/r,o=0===r?1:(t.x+t.height)/r,u=0===s?0:t.y/s,h=0===s?1:(t.y+t.width)/s;this._isFlipUVX&&this._isFlipUVY?(e[0]=o,e[1]=h,e[2]=o,e[3]=u,e[4]=a,e[5]=h,e[6]=a,e[7]=u):this._isFlipUVX?(e[0]=o,e[1]=u,e[2]=o,e[3]=h,e[4]=a,e[5]=u,e[6]=a,e[7]=h):this._isFlipUVY?(e[0]=a,e[1]=h,e[2]=a,e[3]=u,e[4]=o,e[5]=h,e[6]=o,e[7]=u):(e[0]=a,e[1]=u,e[2]=a,e[3]=h,e[4]=o,e[5]=u,e[6]=o,e[7]=h);var l=0===r?0:t.x/r,c=0===r?1:(t.x+t.height)/r,_=0===s?0:t.y/s,f=0===s?1:(t.y+t.width)/s;this._isFlipUVX&&this._isFlipUVY?(i[0]=c,i[1]=f,i[2]=c,i[3]=_,i[4]=l,i[5]=f,i[6]=l,i[7]=_):this._isFlipUVX?(i[0]=c,i[1]=_,i[2]=c,i[3]=f,i[4]=l,i[5]=_,i[6]=l,i[7]=f):this._isFlipUVY?(i[0]=l,i[1]=f,i[2]=l,i[3]=_,i[4]=c,i[5]=f,i[6]=c,i[7]=_):(i[0]=l,i[1]=_,i[2]=l,i[3]=f,i[4]=c,i[5]=_,i[6]=c,i[7]=f)}else{var d=0===r?0:t.x/r,p=0===r?1:(t.x+t.width)/r,m=0===s?1:(t.y+t.height)/s,g=0===s?0:t.y/s;this._isFlipUVX&&this._isFlipUVY?(e[0]=p,e[1]=g,e[2]=d,e[3]=g,e[4]=p,e[5]=m,e[6]=d,e[7]=m):this._isFlipUVX?(e[0]=p,e[1]=m,e[2]=d,e[3]=m,e[4]=p,e[5]=g,e[6]=d,e[7]=g):this._isFlipUVY?(e[0]=d,e[1]=g,e[2]=p,e[3]=g,e[4]=d,e[5]=m,e[6]=p,e[7]=m):(e[0]=d,e[1]=m,e[2]=p,e[3]=m,e[4]=d,e[5]=g,e[6]=p,e[7]=g);var v=0===r?0:t.x/r,y=0===r?1:(t.x+t.width)/r,E=0===s?1:(t.y+t.height)/s,T=0===s?0:t.y/s;this._isFlipUVX&&this._isFlipUVY?(i[0]=y,i[1]=T,i[2]=v,i[3]=T,i[4]=y,i[5]=E,i[6]=v,i[7]=E):this._isFlipUVX?(i[0]=y,i[1]=E,i[2]=v,i[3]=E,i[4]=y,i[5]=T,i[6]=v,i[7]=T):this._isFlipUVY?(i[0]=v,i[1]=T,i[2]=y,i[3]=T,i[4]=v,i[5]=E,i[6]=y,i[7]=E):(i[0]=v,i[1]=E,i[2]=y,i[3]=E,i[4]=v,i[5]=T,i[6]=y,i[7]=T)}this._calculateSlicedUV()},i._setDynamicAtlasFrame=function(t){t&&(this._original={_texture:this._texture,_x:this._rect.x,_y:this._rect.y},this._texture=t.texture,this._rect.x=t.x,this._rect.y=t.y,this._calculateUV())},i._resetDynamicAtlasFrame=function(){this._original&&(this._rect.x=this._original._x,this._rect.y=this._original._y,this._texture=this._original._texture,this._original=null,this._calculateUV())},i._checkPackable=function(){var t=RF;if(t){var e=this._texture;if(e instanceof qg&&!e.isCompressed){var i=this.width,n=this.height;!e.image||i>t.maxFrameSize||n>t.maxFrameSize?this._packable=!1:e.image&&e.image instanceof HTMLCanvasElement&&(this._packable=!0)}else this._packable=!1}},i._serialize=function(){return null},i._deserialize=function(t){var e=t,i=e.rect;i&&(this._rect=new yn(i.x,i.y,i.width,i.height));var n=e.offset;e.offset&&(this._offset=new _n(n.x,n.y));var r=e.originalSize;e.originalSize&&(this._originalSize=new gn(r.width,r.height)),this._rotated=!!e.rotated,this._name=e.name,this._packable=!!e.packable,this._pixelsToUnit=e.pixelsToUnit;var s=e.pivot;s&&(this._pivot=new _n(s.x,s.y)),this._meshType=e.meshType;var a=e.capInsets;a&&(this._capInsets[0]=a[0],this._capInsets[1]=a[1],this._capInsets[2]=a[2],this._capInsets[3]=a[3]);var o=e.vertices;if(o){this.vertices||(this.vertices={rawPosition:[],positions:[],indexes:o.indexes,uv:o.uv,nuv:o.nuv,minPos:new ji(o.minPos.x,o.minPos.y,o.minPos.z),maxPos:new ji(o.maxPos.x,o.maxPos.y,o.maxPos.z)}),this.vertices.rawPosition.length=0;for(var u=o.rawPosition,h=0;h<u.length;h+=3)this.vertices.rawPosition.push(new ji(u[h],u[h+1],u[h+2]));this._updateMeshVertices()}},i.clone=function(){var t,i,n,r,s=new e,a=this.vertices;return s.vertices=a?{rawPosition:a.rawPosition.slice(0),positions:a.positions.slice(0),indexes:a.indexes.slice(0),uv:a.uv.slice(0),nuv:a.nuv.slice(0),minPos:a.minPos.clone(),maxPos:a.minPos.clone()}:null,(t=s.uv).splice.apply(t,[0,s.uv.length].concat(this.uv)),(i=s.unbiasUV).splice.apply(i,[0,s.unbiasUV.length].concat(this.unbiasUV)),(n=s.uvSliced).splice.apply(n,[0,s.uvSliced.length].concat(this.uvSliced)),s._rect.set(this._rect),s._offset.set(this._offset),s._originalSize.set(this._originalSize),s._rotated=this._rotated,(r=s._capInsets).splice.apply(r,[0,s._capInsets.length].concat(this._capInsets)),s._atlasUuid=this._atlasUuid,s._texture=this._texture,s._isFlipUVX=this._isFlipUVX,s._isFlipUVY=this._isFlipUVY,s._pixelsToUnit=this._pixelsToUnit,s._pivot.set(this._pivot),s._meshType=this._meshType,s},i._refreshTexture=function(t){this._texture=t;var e=this._texture,i={},n=!1;0!==this._rect.width&&0!==this._rect.height&&this.checkRect(e)||(i.rect=new yn(0,0,e.width,e.height),n=!0),(0===this._originalSize.width||0===this._originalSize.height||n)&&(i.originalSize=new gn(e.width,e.height),n=!0),n&&this.reset(i),this._checkPackable(),this._mesh&&this._updateMesh()},i.onLoaded=function(){this._calcTrimmedBorder()},i.initDefault=function(e){t.prototype.initDefault.call(this,e);var i=new qg;i.initDefault(),this._refreshTexture(i),this._calculateUV()},i.validate=function(){return this._texture&&this._rect&&0!==this._rect.width&&0!==this._rect.height},i._initVertices=function(){if(this.vertices?(this.vertices.rawPosition.length=0,this.vertices.positions.length=0,this.vertices.indexes.length=0,this.vertices.uv.length=0,this.vertices.nuv.length=0,this.vertices.minPos.set(0,0,0),this.vertices.maxPos.set(0,0,0)):this.vertices={rawPosition:[],positions:[],indexes:[],uv:[],nuv:[],minPos:new ji,maxPos:new ji},this._meshType===eU.POLYGON);else{var t=this.texture,e=t.width,i=t.height,n=this.rect,r=n.width,s=n.height,a=n.x,o=i-n.y-s,u=r/2,h=s/2,l=0===e?0:a/e,c=0===e?1:(a+r)/e,_=0===i?1:(o+s)/i,f=0===i?0:n.y/i;iU.set(-u,-h,0),this.vertices.rawPosition.push(iU.clone()),this.vertices.uv.push(a),this.vertices.uv.push(o+s),this.vertices.nuv.push(l),this.vertices.nuv.push(f),this.vertices.minPos.set(iU),iU.set(u,-h,0),this.vertices.rawPosition.push(iU.clone()),this.vertices.uv.push(a+r),this.vertices.uv.push(o+s),this.vertices.nuv.push(c),this.vertices.nuv.push(f),iU.set(-u,h,0),this.vertices.rawPosition.push(iU.clone()),this.vertices.uv.push(a),this.vertices.uv.push(o),this.vertices.nuv.push(l),this.vertices.nuv.push(_),iU.set(u,h,0),this.vertices.rawPosition.push(iU.clone()),this.vertices.uv.push(a+r),this.vertices.uv.push(o),this.vertices.nuv.push(c),this.vertices.nuv.push(_),this.vertices.maxPos.set(iU),this.vertices.indexes.push(0),this.vertices.indexes.push(1),this.vertices.indexes.push(2),this.vertices.indexes.push(2),this.vertices.indexes.push(1),this.vertices.indexes.push(3)}this._updateMeshVertices()},i._updateMeshVertices=function(){nU.identity();var t=1/this._pixelsToUnit,e=new ji(t,t,1);nU.scale(e);var i=-(this._pivot.x-.5)*this.rect.width*t,n=-(this._pivot.y-.5)*this.rect.height*t;e.set(i,n,0),nU.translate(e);for(var r=this.vertices,s=0;s<r.rawPosition.length;s++){var a=r.rawPosition[s];ji.transformMat4(e,a,nU),ji.toArray(r.positions,e,3*s)}ji.transformMat4(this._minPos,r.minPos,nU),ji.transformMat4(this._maxPos,r.maxPos,nU)},i._createMesh=function(){this._mesh=tU({primitiveMode:er.TRIANGLE_LIST,positions:this.vertices.positions,uvs:this.vertices.nuv,indices:this.vertices.indexes,minPos:this._minPos,maxPos:this._maxPos,attributes:[new Jr(gr.ATTR_POSITION,On.RGB32F),new Jr(gr.ATTR_TEX_COORD,On.RG32F)]})},i._updateMesh=function(){this._mesh&&this._mesh.destroy(),this._initVertices(),this._createMesh()},h(e,[{key:"insetTop",get:function(){return this._capInsets[1]},set:function(t){this._capInsets[1]!==t&&(this._capInsets[1]=t,this._texture&&this._calculateSlicedUV())}},{key:"insetBottom",get:function(){return this._capInsets[3]},set:function(t){this._capInsets[3]!==t&&(this._capInsets[3]=t,this._texture&&this._calculateSlicedUV())}},{key:"insetLeft",get:function(){return this._capInsets[0]},set:function(t){this._capInsets[0]!==t&&(this._capInsets[0]=t,this._texture&&this._calculateSlicedUV())}},{key:"insetRight",get:function(){return this._capInsets[2]},set:function(t){this._capInsets[2]!==t&&(this._capInsets[2]=t,this._texture&&this._calculateSlicedUV())}},{key:"rect",get:function(){return this._rect},set:function(t){this._rect.equals(t)||(this._rect.set(t),this._texture&&this._calculateUV(),this._calcTrimmedBorder())}},{key:"originalSize",get:function(){return this._originalSize},set:function(t){this._originalSize.equals(t)||(this._originalSize.set(t),this._texture&&this._calculateUV(),this._calcTrimmedBorder())}},{key:"offset",get:function(){return this._offset},set:function(t){this._offset.set(t),this._calcTrimmedBorder()}},{key:"rotated",get:function(){return this._rotated},set:function(t){this._rotated!==t&&(this._rotated=t,this._texture&&this._calculateUV())}},{key:"texture",get:function(){return this._texture},set:function(t){t?t!==this._texture&&this.reset({texture:t},!0):j(3122,this.name)}},{key:"atlasUuid",get:function(){return this._atlasUuid},set:function(t){this._atlasUuid=t}},{key:"width",get:function(){return this._texture.width}},{key:"height",get:function(){return this._texture.height}},{key:"_textureSource",set:function(t){window.Build?this._texture=t:t&&(this._refreshTexture(t),this._calculateUV())}},{key:"flipUVX",get:function(){return this._isFlipUVX},set:function(t){this._isFlipUVX=t,this._calculateUV()}},{key:"flipUVY",get:function(){return this._isFlipUVY},set:function(t){this._isFlipUVY=t,this._calculateUV()}},{key:"packable",get:function(){return this._packable},set:function(t){this._packable=t}},{key:"original",get:function(){return this._original}},{key:"pixelsToUnit",get:function(){return this._pixelsToUnit}},{key:"pivot",get:function(){return this._pivot}},{key:"mesh",get:function(){return this._mesh}},{key:"trimmedBorder",get:function(){return this._trimmedBorder}}]),e}(Wl),QF.EVENT_UV_UPDATED="uv_updated",QF.MeshType=eU,qF=ZF))||qF);b.SpriteFrame=hU;var lU,cU=t("SpriteAtlas",_h("cc.SpriteAtlas")((oU=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return E(e=t.call.apply(t,[this].concat(n))||this,"spriteFrames",aU,g(e)),e}c(e,t);var i=e.prototype;return i.getTexture=function(){var t=Object.keys(this.spriteFrames);if(t.length>0){var e=this.spriteFrames[t[0]];return e&&e.texture}return null},i.getSpriteFrame=function(t){var e=this.spriteFrames[t];return e?(e.name||(e.name=t),e):null},i.getSpriteFrames=function(){for(var t=[],e=this.spriteFrames,i=0,n=Object.keys(e);i<n.length;i++){var r=n[i];t.push(e[r])}return t},i._serialize=function(){},i._deserialize=function(t,e){var i=t;this._name=i.name;var n=i.spriteFrames;this.spriteFrames=Bt();for(var r=0;r<n.length;r+=2)e.result.push(this.spriteFrames,n[r],n[r+1],oe(hU))},e}(Wl),aU=T((sU=oU).prototype,"spriteFrames",[Eh,Ph],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Bt()}}),rU=sU))||rU);b.SpriteAtlas=cU;var _U,fU,dU,pU,mU=t("Font",_h("cc.Font")(lU=function(t){function e(){return t.apply(this,arguments)||this}return c(e,t),e}(Wl))||lU);b.Font=mU;var gU,vU,yU,EU,TU,SU,AU,RU,bU,CU=t("TTFFont",_h("cc.TTFFont")((pU=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return E(e=t.call.apply(t,[this].concat(n))||this,"_fontFamily",dU,g(e)),e}return c(e,t),e.prototype.initDefault=function(e){this._fontFamily="Arial",t.prototype.initDefault.call(this,e)},h(e,[{key:"_nativeAsset",get:function(){return this._fontFamily},set:function(t){this._fontFamily=t||"Arial"}},{key:"_nativeDep",get:function(){return{uuid:this._uuid,__nativeName__:this._native,ext:Dl(this._native),__isNative__:!0}}}]),e}(mU),dU=T((fU=pU).prototype,"_fontFamily",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),T(fU.prototype,"_nativeAsset",[qh,Yh],Object.getOwnPropertyDescriptor(fU.prototype,"_nativeAsset"),fU.prototype),T(fU.prototype,"_nativeDep",[qh],Object.getOwnPropertyDescriptor(fU.prototype,"_nativeDep"),fU.prototype),_U=fU))||_U);b.TTFFont=CU;var wU,IU=function(){this.u=0,this.v=0,this.w=0,this.h=0,this.offsetX=0,this.offsetY=0,this.textureID=0,this.valid=!1,this.xAdvance=0},OU=function(){function t(t){this.letterDefinitions={},this.texture=t}var e=t.prototype;return e.addLetterDefinitions=function(t,e){this.letterDefinitions[t]=e},e.cloneLetterDefinition=function(){for(var t={},e=0,i=Object.keys(this.letterDefinitions);e<i.length;e++){var n=i[e],r=new IU;Wt(r,this.letterDefinitions[n]),t[n]=r}return t},e.getTexture=function(){return this.texture},e.getLetter=function(t){return this.letterDefinitions[t]},e.getLetterDefinitionForChar=function(t){var e=t.charCodeAt(0);return this.letterDefinitions.hasOwnProperty(e)?this.letterDefinitions[e]:null},e.clear=function(){this.letterDefinitions={}},t}(),xU=t("BitmapFont",(gU=_h("cc.BitmapFont"),vU=Kh(hU),gU((bU=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return E(e=t.call.apply(t,[this].concat(n))||this,"fntDataStr",TU,g(e)),E(e,"spriteFrame",SU,g(e)),E(e,"fontSize",AU,g(e)),E(e,"fntConfig",RU,g(e)),e}return c(e,t),e.prototype.onLoaded=function(){var t=this.spriteFrame;!this.fontDefDictionary&&t&&(this.fontDefDictionary=new OU(t.texture));var e=this.fntConfig;if(e){var i=e.fontDefDictionary;for(var n in i){var r=new IU,s=i[n].rect;r.offsetX=i[n].xOffset,r.offsetY=i[n].yOffset,r.w=s.width,r.h=s.height,r.u=s.x,r.v=s.y,r.textureID=0,r.valid=!0,r.xAdvance=i[n].xAdvance,this.fontDefDictionary.addLetterDefinitions(n,r)}}else L("The fnt config is not exists!")},e}(mU),TU=T((EU=bU).prototype,"fntDataStr",[Eh,Ph],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),SU=T(EU.prototype,"spriteFrame",[vU],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),AU=T(EU.prototype,"fontSize",[Eh,Ph],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return-1}}),RU=T(EU.prototype,"fntConfig",[Eh,Ph],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),yU=EU))||yU));b.BitmapFont=xU;var PU=t("LabelAtlas",_h("cc.LabelAtlas")(wU=function(t){function e(){return t.apply(this,arguments)||this}return c(e,t),e}(xU))||wU);b.LabelAtlas=PU;var DU=t("BASELINE_RATIO",.26),BU=t("MIDDLE_RATIO",(DU+1)/2-DU);var NU=new ue(2);NU.get=function(){return this._get()||{key:"",value:0,prev:null,next:null}};var MU,LU=new(function(){function t(t){this.count=0,this.limit=0,this.datas={},this.limit=t}var e=t.prototype;return e.moveToHead=function(t){t.next=this.head,t.prev=null,this.head&&(this.head.prev=t),this.head=t,this.tail||(this.tail=t),this.count++,this.datas[t.key]=t},e.put=function(t,e){var i=NU.get();if(i.key=t,i.value=e,this.count>=this.limit){var n=this.tail;delete this.datas[n.key],this.count--,this.tail=n.prev,this.tail.next=null,n.prev=null,n.next=null,NU.put(n)}this.moveToHead(i)},e.remove=function(t){t.prev?t.prev.next=t.next:this.head=t.next,t.next?t.next.prev=t.prev:this.tail=t.prev,delete this.datas[t.key],this.count--},e.get=function(t){var e=this.datas[t];return e?(this.remove(e),this.moveToHead(e),e.value):null},e.clear=function(){this.count=0,this.datas={},this.head=null,this.tail=null},e.has=function(t){return!!this.datas[t]},e.delete=function(t){var e=this.datas[t];this.remove(e)},t}())(100),FU=/([a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûа-яА-ЯЁё]+|\S)/,UU=/^[!,.:;'}\]%\?>、‘“》?。,!]/,GU=/([a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûаíìÍÌïÁÀáàÉÈÒÓòóŐőÙÚŰúűñÑæÆœŒÃÂãÔõěščřžýáíéóúůťďňĚŠČŘŽÁÍÉÓÚŤżźśóńłęćąŻŹŚÓŃŁĘĆĄ-яА-ЯЁёáàảạãăắằẳẵặâấầẩẫậéèẻẽẹêếềểễệiíìỉĩịóòỏõọôốồổỗộơớờởỡợúùủũụưứừửữựýỳỷỹỵđÁÀẢẠÃĂẮẰẲẴẶÂẤẦẨẪẬÉÈẺẼẸÊẾỀỂỄỆIÍÌỈĨỊÓÒỎÕỌÔỐỒỔỖỘƠỚỜỞỠỢÚÙỦŨỤƯỨỪỬỮỰÝỲỶỸỴĐ]+|\S)$/,kU=/[a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûаíìÍÌïÁÀáàÉÈÒÓòóŐőÙÚŰúűñÑæÆœŒÃÂãÔõěščřžýáíéóúůťďňĚŠČŘŽÁÍÉÓÚŤżźśóńłęćąŻŹŚÓŃŁĘĆĄ-яА-ЯЁёáàảạãăắằẳẵặâấầẩẫậéèẻẽẹêếềểễệiíìỉĩịóòỏõọôốồổỗộơớờởỡợúùủũụưứừửữựýỳỷỹỵđÁÀẢẠÃĂẮẰẲẴẶÂẤẦẨẪẬÉÈẺẼẸÊẾỀỂỄỆIÍÌỈĨỊÓÒỎÕỌÔỐỒỔỖỘƠỚỜỞỠỢÚÙỦŨỤƯỨỪỬỮỰÝỲỶỸỴĐ]+$/,zU=/^[a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûаíìÍÌïÁÀáàÉÈÒÓòóŐőÙÚŰúűñÑæÆœŒÃÂãÔõěščřžýáíéóúůťďňĚŠČŘŽÁÍÉÓÚŤżźśóńłęćąŻŹŚÓŃŁĘĆĄ-яА-ЯЁёáàảạãăắằẳẵặâấầẩẫậéèẻẽẹêếềểễệiíìỉĩịóòỏõọôốồổỗộơớờởỡợúùủũụưứừửữựýỳỷỹỵđÁÀẢẠÃĂẮẰẲẴẶÂẤẦẨẪẬÉÈẺẼẸÊẾỀỂỄỆIÍÌỈĨỊÓÒỎÕỌÔỐỒỔỖỘƠỚỜỞỠỢÚÙỦŨỤƯỨỪỬỮỰÝỲỶỸỴĐ]/;function HU(t){return/^[\u4E00-\u9FFF\u3400-\u4DFF]+$/.test(t)||/[\u3000-\u303F]|[\u3040-\u309F]|[\u30A0-\u30FF]|[\uFF00-\uFFEF]|[\u4E00-\u9FAF]|[\u2605-\u2606]|[\u2190-\u2195]|\u203B/g.test(t)||/^[\u1100-\u11FF]|[\u3130-\u318F]|[\uA960-\uA97F]|[\uAC00-\uD7AF]|[\uD7B0-\uD7FF]+$/.test(t)}function VU(t){var e=t.charCodeAt(0);return e>=9&&e<=13||32===e||133===e||160===e||5760===e||e>=8192&&e<=8202||8232===e||8233===e||8239===e||8287===e||12288===e}function WU(t,e,i){var n=(i||t.font)+"🎮"+e,r=LU.get(n);if(null!==r)return r;var s=t.measureText(e),a=s&&s.width||0;return LU.put(n,a),a}function XU(t,e,i){var n=e,r=i,s=t[e];if(s>="\udc00"&&s<="\udfff"&&n--,void 0!==i)if(i-1!==e){var a=t[i-1];a>="\ud800"&&a<="\udbff"&&r--}else s>="\ud800"&&s<="\udbff"&&r++;return t.substring(n,r)}function jU(t){return zU.exec(t)}function YU(t){return kU.exec(t)}function KU(t,e,i,n){var r=[];if(0===t.length||i<0)return r.push(""),r;for(var s=t;e>i&&s.length>1;){for(var a=s.length*(i/e)|0,o=XU(s,a),u=e-n(o),h=o,l=0,c=0;u>i&&c++<100;)a*=i/u,u=e-n(o=XU(s,a|=0));for(c=0;o&&u<=i&&c++<100;){var _=FU.exec(o);h=o,u=e-n(o=XU(s,a+=l=_?_[0].length:1))}0==(a-=l)?(a=1,h=XU(s,1)):1===a&&s[0]>="\ud800"&&s[0]<="\udbff"&&(a=2,h=XU(s,2));var f=XU(s,0,a),d=void 0;UU.test(h||o)&&(0==(a-=(d=GU.exec(f))?d[0].length:0)&&(a=1),h=XU(s,a),f=XU(s,0,a)),zU.test(h)&&(d=kU.exec(f))&&f!==d[0]&&(h=XU(s,a-=d[0].length),f=XU(s,0,a)),(0===r.length||(f=f.trim()).length>0)&&r.push(f),e=n(s=h||o)}return(0===r.length||(s=s.trim()).length>0)&&r.push(s),r}var qU,QU=t("CanvasPool",function(){function t(){this.pool=[]}t.getInstance=function(){return MU||(MU=new t),MU};var e=t.prototype;return e.get=function(){var t=this.pool.pop();if(!t){var e=document.createElement("canvas"),i=e.getContext("2d");t={canvas:e,context:i}}return t},e.put=function(t){this.pool.length>=Ee.MAX_LABEL_CANVAS_POOL_SIZE||this.pool.push(t)},t}()),ZU=Gi.WHITE.clone(),JU=function(){this.u=0,this.v=0,this.w=0,this.h=0,this.texture=null,this.offsetX=0,this.offsetY=0,this.valid=!1,this.xAdvance=0},$U="rgba(255, 255, 255, "+(1/255).toFixed(3)+")",tG=function(){function t(t,e){this.image=null,this.labelInfo=void 0,this.char=void 0,this.data=null,this.canvas=null,this.context=null,this.width=0,this.height=0,this.offsetY=0,this.hash=void 0,this.char=t,this.labelInfo=e,this.hash=t.charCodeAt(0)+e.hash}var e=t.prototype;return e.updateRenderData=function(){this._updateProperties(),this._updateTexture()},e.destroy=function(){this.image=null,QU.getInstance().put(this.data)},e._updateProperties=function(){if(this.data=QU.getInstance().get(),this.canvas=this.data.canvas,this.context=this.data.context,this.context){this.context.font=this.labelInfo.fontDesc;var t=WU(this.context,this.char,this.labelInfo.fontDesc),e=2*this.labelInfo.margin+2;this.width=parseFloat(t.toFixed(2))+e,this.height=(1+DU)*this.labelInfo.fontSize+e,this.offsetY=-this.labelInfo.fontSize*DU/2}this.canvas.width!==this.width&&(this.canvas.width=this.width),this.canvas.height!==this.height&&(this.canvas.height=this.height),this.image||(this.image=new Ag),this.image.reset(this.canvas)},e._updateTexture=function(){if(this.context&&this.canvas){var t=this.context,e=this.labelInfo,i=this.canvas.width,n=this.canvas.height;t.textAlign="center",t.textBaseline="alphabetic",t.clearRect(0,0,i,n),t.fillStyle=$U,t.fillRect(0,0,i,n),t.font=e.fontDesc;var r=e.fontSize,s=i/2,a=n/2+r*BU+0*r,o=e.color;if(t.lineJoin="round",t.fillStyle="rgba("+o.r+", "+o.g+", "+o.b+", 1)",e.isOutlined){var u=e.out||ZU;t.strokeStyle="rgba("+u.r+", "+u.g+", "+u.b+", "+u.a/255+")",t.lineWidth=2*e.margin,t.strokeText(this.char,s,a)}t.fillText(this.char,s,a)}},t}(),eG=function(t){function e(){return t.apply(this,arguments)||this}c(e,t);var i=e.prototype;return i.initWithSize=function(t,e,i){void 0===i&&(i=eg.RGBA8888),this.reset({width:t,height:e,format:i})},i.drawTextureAt=function(t,e,i){var n=this.getGFXTexture();if(t&&n){var r=this._getGFXDevice();if(r){var s=new Ir;s.texOffset.x=e,s.texOffset.y=i,s.texExtent.width=t.width,s.texExtent.height=t.height,r.copyTexImagesToTexture([t.data],n,[s])}else console.warn("Unable to get device")}},e}(qg),iG=function(){function t(t,e){this._x=0,this._y=0,this._nextY=0,this._width=0,this._height=0,this._halfBleed=0,this._dirty=!1;var i=new eG;i.initWithSize(t,e),this.fontDefDictionary=new OU(i),this._halfBleed=1,this._width=t,this._height=e,OL.on(IL.EVENT_BEFORE_SCENE_LAUNCH,this.beforeSceneLoad,this)}var e=t.prototype;return e.insertLetterTexture=function(t){var e=t.image,i=OL.root.device;if(!e||!this.fontDefDictionary||!i)return null;var n=e.width,r=e.height;if(this._x+n+0>this._width&&(this._x=0,this._y=this._nextY),this._y+r>this._nextY&&(this._nextY=this._y+r+0),this._nextY>this._height)return j(12100),null;this.fontDefDictionary.texture.drawTextureAt(e,this._x,this._y),this._dirty=!0;var s=new JU;return s.u=this._x+this._halfBleed,s.v=this._y+this._halfBleed,s.texture=this.fontDefDictionary.texture,s.valid=!0,s.w=t.width-2,s.h=t.height-2,s.xAdvance=s.w,s.offsetY=t.offsetY,this._x+=n+0,this.fontDefDictionary.addLetterDefinitions(t.hash,s),s},e.update=function(){this._dirty&&(this._dirty=!1)},e.reset=function(){this._x=0,this._y=0,this._nextY=0,this.fontDefDictionary.clear()},e.destroy=function(){this.reset(),this.fontDefDictionary&&(this.fontDefDictionary.texture.destroy(),this.fontDefDictionary.texture=null)},e.getTexture=function(){return this.fontDefDictionary.getTexture()},e.beforeSceneLoad=function(){this.clearAllCache()},e.clearAllCache=function(){this.destroy();var t=new eG;t.initWithSize(this._width,this._height),this.fontDefDictionary.texture=t},e.getLetter=function(t){return this.fontDefDictionary.letterDefinitions[t]},e.getLetterDefinitionForChar=function(t,e){var i=t.charCodeAt(0)+e.hash,n=this.fontDefDictionary.letterDefinitions[i];if(!n){var r=new tG(t,e);r.updateRenderData(),n=this.insertLetterTexture(r),r.destroy()}return n},h(t,[{key:"width",get:function(){return this._width}},{key:"height",get:function(){return this._height}}]),t}(),nG={fontAtlas:null,fontSize:0,lineHeight:0,hAlign:0,vAlign:0,hash:"",fontFamily:"",fontDesc:"Arial",color:Gi.WHITE.clone(),isOutlined:!1,out:Gi.WHITE.clone(),margin:0},rG=[new Jr(gr.ATTR_POSITION,On.RGB32F)],sG=[new Jr(gr.ATTR_POSITION,On.RGB32F),new Jr(gr.ATTR_COLOR,On.RGBA32F)],aG=[new Jr(gr.ATTR_POSITION,On.RGB32F),new Jr(gr.ATTR_TEX_COORD,On.RG32F),new Jr(gr.ATTR_COLOR,On.RGBA32F)],oG=[new Jr(gr.ATTR_POSITION,On.RGB32F),new Jr(gr.ATTR_TEX_COORD,On.RG32F),new Jr(gr.ATTR_COLOR,On.RGBA8,!0)],uG=[new Jr(gr.ATTR_POSITION,On.RGB32F),new Jr(gr.ATTR_TEX_COORD,On.RG32F),new Jr(gr.ATTR_COLOR,On.RGBA32F),new Jr(gr.ATTR_COLOR2,On.RGBA32F)],hG=[new Jr(gr.ATTR_POSITION,On.RGB32F),new Jr(gr.ATTR_TEX_COORD,On.RG32F),new Jr(gr.ATTR_COLOR,On.RGBA8,!0),new Jr(gr.ATTR_COLOR2,On.RGBA8,!0)];function lG(t){for(var e=0,i=0;i<t.length;i++){var n=t[i];e+=As[n.format].count}return e}function cG(t){for(var e=0,i=0;i<t.length;i++){var n=t[i];e+=As[n.format].size}return e}b.internal.vfmtPosUvColor=aG,b.internal.vfmtPosUvTwoColor=uG,b.internal.vfmtPosUvColor4B=oG,b.internal.vfmtPosUvTwoColor4B=hG,t("UIVertexFormat",Object.freeze({__proto__:null,vfmt:rG,vfmtPosColor:sG,vfmtPosUvColor:aG,vfmtPosUvColor4B:oG,vfmtPosUvTwoColor:uG,vfmtPosUvTwoColor4B:hG,getComponentPerVertex:lG,getAttributeStride:cG})),function(t){t[t.byteOffset=0]="byteOffset",t[t.vertexOffset=1]="vertexOffset",t[t.indexOffset=2]="indexOffset",t[t.dirty=3]="dirty",t[t.count=4]="count"}(qU||(qU={}));var _G,fG,dG,pG,mG,gG,vG=t("MeshBuffer",function(){var t=e.prototype;function e(){this._byteOffset=0,this._vertexOffset=0,this._indexOffset=0,this._dirty=!1,this._floatsPerVertex=0,this._vData=null,this._iData=null,this._vertexFormatBytes=0,this._initVDataCount=0,this._initIDataCount=0,this._attributes=null,this._iaPool=[],this._iaInfo=null,this._nextFreeIAHandle=0,this.initSharedBuffer(),this.syncSharedBufferToNative()}return t.initSharedBuffer=function(){},t.syncSharedBufferToNative=function(){},t.initialize=function(t,e,i,n){this._initVDataCount=i,this._initIDataCount=n,this._attributes=e,this.floatsPerVertex=cG(e)>>2,this._initVDataCount,this._floatsPerVertex,J(9005),this.vData&&this.iData||(this.vData=new Float32Array(this._initVDataCount),this.iData=new Uint16Array(this._initIDataCount)),this._iaPool.push(this.createNewIA(t))},t.reset=function(){this._nextFreeIAHandle=0,this.dirty=!1},t.destroy=function(){this.reset(),this._attributes=null,this._iaInfo=null,this.vData=null,this.iData=null;for(var t=0;t<this._iaPool.length;++t){var e=this._iaPool[t];e.vertexBuffers[0]&&e.vertexBuffers[0].destroy(),e.indexBuffer&&e.indexBuffer.destroy(),e.ia.destroy()}this._iaPool.length=0},t.setDirty=function(){this.dirty=!0},t.request=function(){return j(9002),!1},t.requireFreeIA=function(t){return this._iaPool.length<=this._nextFreeIAHandle&&this._iaPool.push(this.createNewIA(t)),this._iaPool[this._nextFreeIAHandle++].ia},t.recycleIA=function(t){for(var e=this._iaPool,i=0;i<this._nextFreeIAHandle;++i)if(t===e[i].ia){var n=e[i];return e[i]=e[--this._nextFreeIAHandle],void(e[this._nextFreeIAHandle]=n)}},t.checkCapacity=function(t,e){var i=(this.vertexOffset+t)*this._floatsPerVertex,n=this.indexOffset+e;return!(i>this._initVDataCount||n>this._initIDataCount)},t.uploadBuffers=function(){if(0!==this.byteOffset&&this._dirty){for(var t=Qa.__isWebIOS14OrIPadOS14Env?this._nextFreeIAHandle:1,e=this.byteOffset,i=this.indexOffset,n=0;n<t;++n){var r=this._iaPool[n],s=new Float32Array(this.vData.buffer,0,e>>2),a=new Uint16Array(this.iData.buffer,0,i),o=r.vertexBuffers[0];e>o.size&&o.resize(e),o.update(s),2*i>r.indexBuffer.size&&r.indexBuffer.resize(2*i),r.indexBuffer.update(a)}this.dirty=!1}},t.createNewIA=function(t){var e,i,n;if(Qa.__isWebIOS14OrIPadOS14Env||!this._iaPool[0]){var r=this._vertexFormatBytes=this._floatsPerVertex*Float32Array.BYTES_PER_ELEMENT,s=Uint16Array.BYTES_PER_ELEMENT,a=t.createBuffer(new Mr(Dn.VERTEX|Dn.TRANSFER_DST,Mn.HOST|Mn.DEVICE,r,r));n=t.createBuffer(new Mr(Dn.INDEX|Dn.TRANSFER_DST,Mn.HOST|Mn.DEVICE,s,s)),i=[a],this._iaInfo=new ts(this._attributes,i,n),e=t.createInputAssembler(this._iaInfo)}else e=t.createInputAssembler(this._iaInfo),i=this._iaInfo.vertexBuffers,n=this._iaInfo.indexBuffer;return{ia:e,vertexBuffers:i,indexBuffer:n}},h(e,[{key:"attributes",get:function(){return this._attributes}},{key:"vertexFormatBytes",get:function(){return this._vertexFormatBytes}},{key:"byteOffset",get:function(){return this._byteOffset},set:function(t){this._byteOffset=t}},{key:"vertexOffset",get:function(){return this._vertexOffset},set:function(t){this._vertexOffset=t}},{key:"indexOffset",get:function(){return this._indexOffset},set:function(t){this._indexOffset=t}},{key:"dirty",get:function(){return this._dirty},set:function(t){this._dirty=t}},{key:"floatsPerVertex",get:function(){return this._floatsPerVertex},set:function(t){this._floatsPerVertex=t}},{key:"vData",get:function(){return this._vData},set:function(t){this._vData=t}},{key:"iData",get:function(){return this._iData},set:function(t){this._iData=t}},{key:"nativeObj",get:function(){return this._nativeObj}},{key:"sharedBuffer",get:function(){return this._sharedBuffer}}]),e}()),yG=function(){function t(t,e){this._device=null,this._attributes=null,this._vertexFormatBytes=void 0,this._floatsPerVertex=void 0,this._buffers=[],this._device=t,this._attributes=e,this._floatsPerVertex=cG(e)>>2,this._vertexFormatBytes=this._floatsPerVertex*Float32Array.BYTES_PER_ELEMENT}var e=t.prototype;return e.initialize=function(){},e.reset=function(){},e.request=function(){},e.appendBuffers=function(){},e.uploadBuffers=function(){},e.destroy=function(){this._attributes.length=0},h(t,[{key:"attributes",get:function(){return this._attributes}},{key:"vertexFormatBytes",get:function(){return this._vertexFormatBytes}},{key:"floatsPerVertex",get:function(){return this._floatsPerVertex}}]),t}(),EG=new da((function(){return{offset:0,length:0}}),32),TG=function(){function t(t,e,i,n,r,s){this._ib=void 0,this.vertexAccessor=t,this.bufferId=e,this.meshBuffer=i,this.vertexOffset=n,this.vb=r,this.indexCount=s,this._ib=new Uint16Array(s),t.getMeshBuffer(e)}return t.prototype.setIndexBuffer=function(){},h(t,[{key:"ib",get:function(){return this._ib}}]),t}(),SG=function(t){function e(i,n,r,s){var a;return(a=t.call(this,i,n)||this)._freeLists=[],a._vCount=0,a._iCount=0,a._id=0,a._vCount=r||Math.floor(1024*Ee.BATCHER2D_MEM_INCREMENT/a._vertexFormatBytes),a._iCount=s||a._vCount*e.IB_SCALE,a._id=e.generateID(),a._allocateBuffer(),a}c(e,t);var i=e.prototype;return i.destroy=function(){for(var e=0;e<this._buffers.length;++e){this._buffers[e].destroy();for(var i=this._freeLists[e],n=0;n<i.length;++n)EG.free(i[n])}this._buffers.length=0,this._freeLists.length=0,t.prototype.destroy.call(this)},i.reset=function(){for(var t=0;t<this._buffers.length;++t){var e=this._buffers[t];e.indexOffset=0,e.reset()}},i.getVertexBuffer=function(t){return this._buffers[t].vData},i.getIndexBuffer=function(t){return this._buffers[t].iData},i.getMeshBuffer=function(t){return this._buffers[t]},i.uploadBuffers=function(){for(var t=0;t<this._buffers.length;++t){var e=this._freeLists[t][0],i=this._buffers[t];(!e||e.length<i.vData.byteLength)&&i.uploadBuffers()}},i.appendIndices=function(t,e){var i=this._buffers[t];e.length&&(i.iData.set(e,i.indexOffset),i.indexOffset+=e.length)},i.allocateChunk=function(t,e){for(var i,n=t*this.vertexFormatBytes,r=null,s=0,a=-1,o=null,u=0;u<this._buffers.length;++u){r=this._buffers[u],i=this._freeLists[u];for(var h=0;h<i.length;++h)if(i[h].length>=n){o=i[h],s=u,a=h;break}if(o)break}if(o||(s=this._allocateBuffer(),(r=this._buffers[s])&&r.checkCapacity(t,e)&&(a=0,o=this._freeLists[s][a])),o){var l=o.offset/this.vertexFormatBytes,c=new Float32Array(r.vData.buffer,o.offset,n>>2).fill(0);return this._allocateChunkFromEntry(s,a,o,n),new TG(this,s,r,l,c,e)}return K(9004,n),null},i.recycleChunk=function(t){var e=this._freeLists[t.bufferId],i=this._buffers[t.bufferId],n=t.vertexOffset*this.vertexFormatBytes,r=t.vb.byteLength;if(0!==r){for(var s=!1,a=0,o=null,u=e[a];u&&u.offset<n;)o=u,u=e[++a];if(o&&0==n-(o.offset+o.length)&&(o.length+=r,n=o.offset,r=o.length,u&&u.offset-(n+r)==0&&(o.length+=u.length,e.splice(a,1),EG.free(u),u=null),s=!0),!s&&u){if(0==u.offset-(n+r))u.offset=n,u.length+=r;else{var h=EG.alloc();h.offset=n,h.length=r,e.splice(a,0,h)}s=!0}if(s)n+r===i.byteOffset&&(i.byteOffset=n);else{var l=EG.alloc();l.offset=n,l.length=r,e.push(l)}}},i._allocateChunkFromEntry=function(t,e,i,n){var r=i.length-n,s=i.offset+n,a=this._buffers[t];a.byteOffset<s&&(a.byteOffset=s),Z(r>=0,9004,t,i.offset,i.length),0===r?(this._freeLists[t].splice(e,1),EG.free(i)):(i.offset+=n,i.length=r)},i._allocateBuffer=function(){Z(this._buffers.length===this._freeLists.length,9003);var t=new vG,e=this._vCount*this._floatsPerVertex;t.initialize(this._device,this._attributes,e,this._iCount),this._buffers.push(t);var i=EG.alloc();i.offset=0,i.length=t.vData.byteLength;var n=[i];return this._freeLists.push(n),OL.root.batcher2D.syncMeshBuffersToNative(this.id,this._buffers),this._buffers.length-1},e.generateID=function(){return e.ID_COUNT++},h(e,[{key:"id",get:function(){return this._id}}]),e}(yG);SG.IB_SCALE=4,SG.ID_COUNT=0,function(t){t[t.DrawInfoType=0]="DrawInfoType",t[t.VertDirty=1]="VertDirty",t[t.IsMeshBuffer=2]="IsMeshBuffer",t[t.Stride=3]="Stride",t[t.Count=4]="Count"}(_G||(_G={})),function(t){t[t.BufferID=0]="BufferID",t[t.AccessorID=1]="AccessorID",t[t.Count=2]="Count"}(fG||(fG={})),function(t){t[t.VertexOffset=0]="VertexOffset",t[t.IndexOffset=1]="IndexOffset",t[t.VBCount=2]="VBCount",t[t.IBCount=3]="IBCount",t[t.DataHash=4]="DataHash",t[t.Count=5]="Count"}(dG||(dG={})),function(t){t[t.COMP=0]="COMP",t[t.MODEL=1]="MODEL",t[t.MIDDLEWARE=2]="MIDDLEWARE",t[t.SUB_NODE=3]="SUB_NODE"}(pG||(pG={})),function(){function t(t){this._accId=-1,this._bufferId=-1,this._vertexOffset=0,this._indexOffset=0,this._vb=null,this._ib=null,this._vData=null,this._iData=null,this._vertDirty=!1,this._vbCount=0,this._ibCount=0,this._dataHash=0,this._isMeshBuffer=!1,this._material=null,this._texture=null,this._sampler=null,this._stride=0,this._useLocal=!1,this._model=null,this._drawInfoType=pG.COMP,this._subNode=null,this._uint8SharedBuffer=void 0,this._uint16SharedBuffer=void 0,this._uint32SharedBuffer=void 0,this.init(t);var e=this._nativeObj.getAttrSharedBufferForJS(),i=0;this._uint8SharedBuffer=new Uint8Array(e,i,_G.Count),i+=_G.Count*Uint8Array.BYTES_PER_ELEMENT,this._uint16SharedBuffer=new Uint16Array(e,i,fG.Count),i+=fG.Count*Uint16Array.BYTES_PER_ELEMENT,this._uint32SharedBuffer=new Uint32Array(e,i,dG.Count)}var e=t.prototype;e.init=function(){},e.clear=function(){this._bufferId=0,this._vertexOffset=0,this._indexOffset=0,this._vertDirty=!1},e.setAccId=function(t){this._accId=t},e.setBufferId=function(t){this._bufferId=t},e.setAccAndBuffer=function(t,e){this._bufferId=e,this._accId=t},e.setVertexOffset=function(t){this._vertexOffset=t},e.setIndexOffset=function(t){this._indexOffset=t},e.setVB=function(){},e.setIB=function(){},e.setVData=function(){},e.setIData=function(){},e.setVBCount=function(t){this._vbCount=t},e.setIBCount=function(){},e.setVertDirty=function(t){this._vertDirty=t},e.setDataHash=function(t){this._dataHash=t},e.setIsMeshBuffer=function(t){this._isMeshBuffer=t},e.setMaterial=function(t){this._material=t},e.setTexture=function(t){this._texture=t},e.setSampler=function(t){this._sampler=t},e.setModel=function(){},e.setDrawInfoType=function(t){this._drawInfoType=t},e.setSubNode=function(t){this._subNode=t},e.setStride=function(t){this._stride=t},e.initRender2dBuffer=function(){},e.fillRender2dBuffer=function(){},h(t,[{key:"nativeObj",get:function(){return this._nativeObj}},{key:"render2dBuffer",get:function(){return this._render2dBuffer}}])}(),function(t){t[t.DISABLED=0]="DISABLED",t[t.CLEAR=1]="CLEAR",t[t.ENTER_LEVEL=2]="ENTER_LEVEL",t[t.ENABLED=3]="ENABLED",t[t.EXIT_LEVEL=4]="EXIT_LEVEL",t[t.CLEAR_INVERTED=5]="CLEAR_INVERTED",t[t.ENTER_LEVEL_INVERTED=6]="ENTER_LEVEL_INVERTED"}(mG||(mG={})),function(t){t[t.stencilTest=0]="stencilTest",t[t.func=1]="func",t[t.stencilMask=2]="stencilMask",t[t.writeMask=3]="writeMask",t[t.failOp=4]="failOp",t[t.zFailOp=5]="zFailOp",t[t.passOp=6]="passOp",t[t.ref=7]="ref",t[t.count=8]="count"}(gG||(gG={}));var AG,RG,bG,CG,wG,IG=t("StencilManager",function(){function t(){this._maskStack=[],this._stencilPattern={stencilTest:!0,func:Wn.ALWAYS,stencilMask:65535,writeMask:65535,failOp:Xn.KEEP,zFailOp:Xn.KEEP,passOp:Xn.KEEP,ref:1},this._stage=mG.DISABLED,this.stencilStateMap=new Map,this.stencilStateMapWithDepth=new Map}var e=t.prototype;return e.pushMask=function(t){this._maskStack.push(t)},e.clear=function(t){return t.stencilStage!==mG.ENTER_LEVEL?mG.CLEAR_INVERTED:mG.CLEAR},e.enableMask=function(){this.stage=mG.ENABLED},e.exitMask=function(){0!==this._maskStack.length&&(this._maskStack.pop(),0===this._maskStack.length?this.stage=mG.DISABLED:this.stage=mG.ENABLED)},e.getWriteMask=function(){return 1<<this._maskStack.length-1},e.getExitWriteMask=function(){return 1<<this._maskStack.length},e.getStencilRef=function(){for(var t=0,e=0;e<this._maskStack.length;++e)t+=1<<e;return t},e.getMaskStackSize=function(){return this._maskStack.length},e.reset=function(){this._maskStack.length=0,this.stage=mG.DISABLED},e.destroy=function(){this.stencilStateMap.forEach((function(t){t.destroy()})),this.stencilStateMap.clear()},e.getStencilStage=function(t,e){var i=0,n=!1,r=!1,s=Wn.LESS,a=this.stencilStateMap;if(e&&e.passes[0]){var o=e.passes[0].depthStencilState,u=0,h=0;o.depthTest&&(u=1),o.depthWrite&&(h=1),i=u|h<<1|o.depthFunc<<2|t<<6|this._maskStack.length<<9,n=o.depthTest,r=o.depthWrite,s=o.depthFunc,a=this.stencilStateMapWithDepth}else i=t<<16|this._maskStack.length;if(a&&a.has(i))return a.get(i);this.setStateFromStage(t);var l=new qs(n,r,s,this._stencilPattern.stencilTest,this._stencilPattern.func,this._stencilPattern.stencilMask,this._stencilPattern.writeMask,this._stencilPattern.failOp,this._stencilPattern.zFailOp,this._stencilPattern.passOp,this._stencilPattern.ref,this._stencilPattern.stencilTest,this._stencilPattern.func,this._stencilPattern.stencilMask,this._stencilPattern.writeMask,this._stencilPattern.failOp,this._stencilPattern.zFailOp,this._stencilPattern.passOp,this._stencilPattern.ref);return a.set(i,l),l},e.getStencilHash=function(t){return t<<8|this._maskStack.length},e.setStateFromStage=function(t){var e=this._stencilPattern;t===mG.DISABLED?(e.stencilTest=!1,e.func=Wn.ALWAYS,e.failOp=Xn.KEEP,e.stencilMask=e.writeMask=65535,e.ref=1):(e.stencilTest=!0,t===mG.ENABLED?(e.func=Wn.EQUAL,e.failOp=Xn.KEEP,e.stencilMask=e.ref=this.getStencilRef(),e.writeMask=this.getWriteMask()):t===mG.CLEAR?(e.func=Wn.NEVER,e.failOp=Xn.ZERO,e.writeMask=e.stencilMask=e.ref=this.getWriteMask()):t===mG.CLEAR_INVERTED||t===mG.ENTER_LEVEL?(e.func=Wn.NEVER,e.failOp=Xn.REPLACE,e.writeMask=e.stencilMask=e.ref=this.getWriteMask()):t===mG.ENTER_LEVEL_INVERTED&&(e.func=Wn.NEVER,e.failOp=Xn.ZERO,e.writeMask=e.stencilMask=e.ref=this.getWriteMask()))},h(t,[{key:"stage",get:function(){return this._stage},set:function(t){this._stage=t}},{key:"pattern",get:function(){return this._stencilPattern}}]),t}());IG.sharedManager=null,IG.sharedManager=new IG,function(t){t[t.STATIC=0]="STATIC",t[t.DYNAMIC=1]="DYNAMIC",t[t.CROSSED=2]="CROSSED"}(AG||(AG={})),function(t){t[t.localOpacity=0]="localOpacity",t[t.count=1]="count"}(RG||(RG={})),function(t){t[t.colorR=0]="colorR",t[t.colorG=1]="colorG",t[t.colorB=2]="colorB",t[t.colorA=3]="colorA",t[t.maskMode=4]="maskMode",t[t.count=5]="count"}(bG||(bG={})),function(t){t[t.colorDirty=0]="colorDirty",t[t.enabled=1]="enabled",t[t.useLocal=2]="useLocal",t[t.count=3]="count"}(CG||(CG={})),function(t){t[t.NONE=0]="NONE",t[t.MASK=1]="MASK",t[t.MASK_INVERTED=2]="MASK_INVERTED",t[t.MASK_NODE=3]="MASK_NODE",t[t.MASK_NODE_INVERTED=4]="MASK_NODE_INVERTED"}(wG||(wG={}));var OG,xG,PG,DG,BG,NG,MG,LG,FG,UG,GG,kG,zG,HG,VG,WG,XG,jG,YG,KG,qG,QG,ZG,JG,$G,tk,ek,ik,nk,rk,sk,ak,ok,uk,hk=function(){function t(){this._renderEntityType=AG.STATIC,this._dynamicDrawInfoArr=[],this._node=null,this._renderTransform=null,this._stencilStage=mG.DISABLED,this._useLocal=!1,this._maskMode=wG.NONE,this._color=Gi.WHITE,this._localOpacity=255,this._colorDirty=!0,this._enabled=!1}var e=t.prototype;return e.addDynamicRenderDrawInfo=function(){},e.removeDynamicRenderDrawInfo=function(){},e.clearDynamicRenderDrawInfos=function(){},e.clearStaticRenderDrawInfos=function(){},e.setDynamicRenderDrawInfo=function(){},e.setMaskMode=function(t){this._maskMode=t},e.getStaticRenderDrawInfo=function(){return null},e.setNode=function(t){this._node=t},e.setRenderTransform=function(t){this._renderTransform=t},e.setStencilStage=function(t){this._stencilStage=t},e.setUseLocal=function(t){this._useLocal=t},e.initSharedBuffer=function(){},h(t,[{key:"nativeObj",get:function(){return this._nativeObj}},{key:"renderDrawInfoArr",get:function(){return this._dynamicDrawInfoArr}},{key:"renderEntityType",get:function(){return this._renderEntityType}},{key:"color",get:function(){return this._color},set:function(t){this._color=t}},{key:"localOpacity",get:function(){return this._localOpacity},set:function(t){this._localOpacity=t}},{key:"colorDirty",get:function(){return this._colorDirty},set:function(t){this._colorDirty=t}},{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled=t}}]),t}(),lk=cG(aG)>>2,ck=new da((function(){return{x:0,y:0,z:0,u:0,v:0,color:Gi.WHITE.clone()}}),128),_k=t("BaseRenderData",function(){function t(t){void 0===t&&(t=aG),this.chunk=null,this._renderDrawInfo=null,this._material=null,this._dataHash=0,this._isMeshBuffer=!1,this._vc=0,this._ic=0,this._floatStride=0,this._vertexFormat=aG,this._drawInfoType=pG.COMP,this._multiOwner=!1,this._batcher=null,this._floatStride=t===aG?lk:cG(t)>>2,this._vertexFormat=t}var e=t.prototype;return e.isValid=function(){return this._ic>0&&this.chunk.vertexAccessor},e.initRenderDrawInfo=function(t,e){void 0===e&&(e=pG.COMP)},e.removeRenderDrawInfo=function(){},e.setRenderDrawInfoAttributes=function(){},h(t,[{key:"vertexCount",get:function(){return this._vc}},{key:"indexCount",get:function(){return this._ic}},{key:"stride",get:function(){return this._floatStride<<2}},{key:"floatStride",get:function(){return this._floatStride}},{key:"vertexFormat",get:function(){return this._vertexFormat}},{key:"drawInfoType",get:function(){return this._drawInfoType},set:function(t){this._drawInfoType=t,this._renderDrawInfo&&this._renderDrawInfo.setDrawInfoType(t)}},{key:"renderDrawInfo",get:function(){return this._renderDrawInfo}},{key:"material",get:function(){return this._material},set:function(t){this._material=t,this._renderDrawInfo&&this._renderDrawInfo.setMaterial(t)}},{key:"dataHash",get:function(){return this._dataHash},set:function(t){this._dataHash=t,this._renderDrawInfo&&this._renderDrawInfo.setDataHash(t)}},{key:"multiOwner",get:function(){return this._multiOwner},set:function(t){this._multiOwner=t}},{key:"batcher",get:function(){return this._batcher||(this._batcher=OL.root.batcher2D),this._batcher}}]),t}()),fk=t("RenderData",function(t){function e(e,i){var n;return void 0===e&&(e=aG),(n=t.call(this,e)||this)._vertDirty=!0,n._textureHash=0,n.indices=null,n.layer=0,n.nodeDirty=!0,n.passDirty=!0,n.textureDirty=!0,n.hashDirty=!0,n._data=[],n._pivotX=0,n._pivotY=0,n._width=0,n._height=0,n._frame=null,n._accessor=null,n.vertexRow=1,n.vertexCol=1,i||(i=n.batcher.switchBufferAccessor(n._vertexFormat)),n._accessor=i,n}c(e,t),e.add=function(t,i){void 0===t&&(t=aG);var n=new e(t,i);return i||(i=OL.root.batcher2D.switchBufferAccessor(n._vertexFormat)),n._accessor=i,n},e.remove=function(t){t.clear(),t._accessor=null};var i=e.prototype;return i.resize=function(t,e){t===this._vc&&e===this._ic&&this.chunk||(this._vc=t,this._ic=e,this.chunk&&(this._accessor.recycleChunk(this.chunk),this.chunk=null),this.chunk=this._accessor.allocateChunk(t,e),this.updateHash())},i.setRenderDrawInfoAttributes=function(){},i.fillDrawInfoAttributes=function(){},i.syncRender2dBuffer=function(){},i.resizeAndCopy=function(t,e){if(t!==this._vc||e!==this._ic||!this.chunk){this._vc=t,this._ic=e;var i=this.chunk;this.chunk=this._accessor.allocateChunk(t,e),i&&(this.chunk.vb.set(i.vb),this._accessor.recycleChunk(i)),this.updateHash()}},i.getMeshBuffer=function(){return this.chunk&&this._accessor?this._accessor.getMeshBuffer(this.chunk.bufferId):null},i.updateNode=function(t){this.layer=t.node.layer,this.nodeDirty=!1,this.hashDirty=!0},i.updatePass=function(t){this.material=t.getRenderMaterial(0),this.passDirty=!1,this.hashDirty=!0},i.updateTexture=function(t){this.frame=t,this.textureHash=t.getHash(),this.textureDirty=!1,this.hashDirty=!0},i.updateHash=function(){var t=""+(this.chunk?this.chunk.bufferId:-1)+this.layer+" "+this.textureHash;this.dataHash=Vs(t,666),this.hashDirty=!1},i.updateRenderData=function(t,e){if(this.passDirty&&(this.material=t.getRenderMaterial(0),this.passDirty=!1,this.hashDirty=!0,this._renderDrawInfo&&this._renderDrawInfo.setMaterial(this.material)),this.nodeDirty){var i=t.node.scene?t._getRenderScene():null;this.layer=t.node.layer,null!==i&&(this.nodeDirty=!1),this.hashDirty=!0}this.textureDirty&&(this.frame=e,this.textureHash=e.getHash(),this.textureDirty=!1,this.hashDirty=!0,this._renderDrawInfo&&(this._renderDrawInfo.setTexture(this.frame?this.frame.getGFXTexture():null),this._renderDrawInfo.setSampler(this.frame?this.frame.getGFXSampler():null))),this.hashDirty&&(this.updateHash(),this._renderDrawInfo&&this._renderDrawInfo.setDataHash(this.dataHash))},i.updateSizeNPivot=function(t,e,i,n){t===this._width&&e===this._height&&i===this._pivotX&&n===this._pivotY||(this._width=t,this._height=e,this._pivotX=i,this._pivotY=n,this.vertDirty=!0)},i.clear=function(){this.resize(0,0),this._data.length=0,this._pivotX=0,this._pivotY=0,this._width=0,this._height=0,this.indices=null,this.vertDirty=!0,this.material=null,this.nodeDirty=!0,this.passDirty=!0,this.textureDirty=!0,this.hashDirty=!0,this.layer=0,this.frame=null,this.textureHash=0,this.dataHash=0},e.createStaticVBAccessor=function(t,e,i){var n=OL.root.device;return new SG(n,t,e,i)},h(e,[{key:"dataLength",get:function(){return this._data.length},set:function(t){var e=this._data;if(e.length!==t){var i=e.length,n=0;for(n=t;n<i;n++)ck.free(e[n]);for(n=i;n<t;n++)e[n]=ck.alloc();e.length=t}this.syncRender2dBuffer()}},{key:"data",get:function(){return this._data}},{key:"vertDirty",get:function(){return this._vertDirty},set:function(t){this._vertDirty=t,this._renderDrawInfo&&t&&this._renderDrawInfo.setVertDirty(t)}},{key:"textureHash",get:function(){return this._textureHash},set:function(t){this._textureHash=t}},{key:"frame",get:function(){return this._frame},set:function(t){this._frame=t,this._renderDrawInfo&&(this._frame?(this._renderDrawInfo.setTexture(this._frame.getGFXTexture()),this._renderDrawInfo.setSampler(this._frame.getGFXSampler())):(this._renderDrawInfo.setTexture(null),this._renderDrawInfo.setSampler(null)))}},{key:"accessor",get:function(){return this._accessor}}]),e}(_k)),dk=t("MeshRenderData",function(t){function e(e){var i;return void 0===e&&(e=aG),(i=t.call(this,e)||this)._isMeshBuffer=!0,i.vData=void 0,i.iData=void 0,i.vertexStart=0,i.vertexRange=0,i.indexStart=0,i.indexRange=0,i.lastFilledIndex=0,i.lastFilledVertex=0,i.frame=void 0,i._byteLength=0,i._vertexBuffers=[],i._indexBuffer=null,i._iaPool=null,i._iaInfo=null,i.vData=new Float32Array(256*i.stride),i.iData=new Uint16Array(1536),i}c(e,t),e.add=function(t){void 0===t&&(t=aG);var i=new e;return i._floatStride=t===aG?lk:cG(t)>>2,i._vertexFormat=t,i},e.remove=function(t){t.clear()};var i=e.prototype;return i.request=function(t,e){var i=this._byteLength+t*this.stride;return!!this.reserve(t,e)&&(this._vc+=t,this._ic+=e,this._byteLength=i,this.vertexRange=this._vc,this.indexRange=this._ic,!0)},i.reserve=function(t,e){var i=this._byteLength+t*this.stride,n=this.indexCount+e;if(t+this.vertexCount>65535)return!1;var r=this.vData.byteLength,s=this.iData.length,a=this.vData.length,o=this.iData.length;if(i>r||n>s){for(;r<i||s<n;)r=4*(a*=2),s=o*=2;this._reallocBuffer(a,o)}return!0},i.resize=function(t,e){var i=t*this.stride;t>=0&&e>=0&&i<=this.vData.byteLength&&this.iData.length,this._vc=t,this._ic=e,this._byteLength=i,this.updateRange(0,t,0,e)},i.updateRange=function(t,e,i,n){e>=0&&n>=0&&e<=this._vc&&this._ic,this.vertexStart=t,this.indexStart=i,this.vertexRange=e,this.indexRange=n},i.requestIA=function(t){this._initIAInfo(t);var e=this._iaPool.add();return e.firstIndex=this.indexStart,e.indexCount=this.indexRange,e},i.uploadBuffers=function(){if(0!==this._byteLength&&this._vertexBuffers[0]&&this._indexBuffer){var t=this._ic,e=new Float32Array(this.vData.buffer,0,this._byteLength>>2),i=new Uint16Array(this.iData.buffer,0,t),n=this._vertexBuffers[0];this._byteLength>n.size&&n.resize(this._byteLength),n.update(e);var r=t<<1;r>this._indexBuffer.size&&this._indexBuffer.resize(r),this._indexBuffer.update(i)}},i.freeIAPool=function(){this._iaPool&&this._iaPool.reset()},i.reset=function(){this._vc=0,this._ic=0,this._byteLength=0,this.vertexStart=0,this.vertexRange=0,this.indexStart=0,this.indexRange=0,this.lastFilledIndex=0,this.lastFilledVertex=0,this.material=null,this.freeIAPool()},i.clear=function(){this.reset(),this._iaPool&&this._iaPool.destroy(),this._vertexBuffers[0]&&(this._vertexBuffers[0].destroy(),this._vertexBuffers=[]),this._iaInfo=null,this.vData=new Float32Array(256*this.stride),this.iData=new Uint16Array(1536)},i._initIAInfo=function(t){var e=this;if(!this._iaInfo){var i=this.stride,n=this._vertexBuffers;n.length||n.push(t.createBuffer(new Mr(Dn.VERTEX|Dn.TRANSFER_DST,Mn.DEVICE,i,i)));var r=Uint16Array.BYTES_PER_ELEMENT;this._indexBuffer||(this._indexBuffer=t.createBuffer(new Mr(Dn.INDEX|Dn.TRANSFER_DST,Mn.DEVICE,r,r))),this._iaInfo=new ts(this._vertexFormat,n,this._indexBuffer),this._iaPool=new pa((function(){return t.createInputAssembler(e._iaInfo)}),1,(function(t){t.destroy()}))}},i._reallocBuffer=function(t,e){var i=this.vData;this.vData=new Float32Array(t),i&&this.vData.set(i,0);var n=this.iData;this.iData=new Uint16Array(e),n&&this.iData.set(n,0)},i.setRenderDrawInfoAttributes=function(){},i.particleInitRenderDrawInfo=function(){},h(e,[{key:"formatByte",get:function(){return this.stride},set:function(){}},{key:"floatStride",get:function(){return this._floatStride}},{key:"vDataOffset",get:function(){return this._byteLength>>>2}}]),e}(_k)),pk=(new pa((function(){return new dk}),32),new _n),mk=new _n,gk=new ji,vk=new un,yk=new un,Ek=new un,Tk=new un(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),Sk=new yn,Ak=function(e){return t({UITransform:e,UITransformComponent:e}),e}((OG=_h("cc.UITransform"),xG=xh(),PG=dh(110),DG=Ch(),BG=zh(),NG=Mh(),MG=zh(),LG=Mh(),OG(FG=xG(FG=PG(FG=DG(FG=ph(FG=bh((HG=zG=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._priority=0,E(e,"_contentSize",GG,g(e)),E(e,"_anchorPoint",kG,g(e)),e}c(e,t);var i=e.prototype;return i.__preload=function(){this.node._uiProps.uiTransformComp=this},i.onLoad=function(){this.node.parent&&e.insertChangeMap(this.node.parent)},i.onEnable=function(){this.node.on(aE.PARENT_CHANGED,this._parentChanged,this),this._markRenderDataDirty()},i.onDisable=function(){this.node.off(aE.PARENT_CHANGED,this._parentChanged,this)},i.onDestroy=function(){this.node._uiProps.uiTransformComp=null},i.setContentSize=function(t,e){var i=this._contentSize;if(void 0===e){if(gi((t=t).width,i.width,pi)&&gi(t.height,i.height,pi))return;i.width=t.width,i.height=t.height}else{if(gi(t=t,i.width,pi)&&gi(e,i.height,pi))return;i.width=t,i.height=e}this.node.emit(aE.SIZE_CHANGED),this._markRenderDataDirty()},i.setAnchorPoint=function(t,e){var i=this._anchorPoint;if(void 0===e){if((t=t).x===i.x&&t.y===i.y)return;i.x=t.x,i.y=t.y}else{if(t===i.x&&e===i.y)return;i.x=t,i.y=e}this.node.emit(aE.ANCHOR_CHANGED,this._anchorPoint),this._markRenderDataDirty()},i.isHit=function(t){for(var e=this._contentSize.width,i=this._contentSize.height,n=pk,r=mk,s=this._getRenderScene().cameras,a=0;a<s.length;a++){var o=s[a];if(o.visibility&this.node.layer){o.node.getWorldRT(vk);var u=vk.m12,h=vk.m13,l=NL.center;if(vk.m12=l.x-(vk.m00*u+vk.m04*h),vk.m13=l.y-(vk.m01*u+vk.m05*h),un.invert(vk,vk),_n.transformMat4(n,t,vk),this.node.getWorldMatrix(Ek),un.invert(vk,Ek),!un.strictEquals(vk,Tk)){_n.transformMat4(r,n,vk),r.x+=this._anchorPoint.x*e,r.y+=this._anchorPoint.y*i;var c=!1;if(r.x>=0&&r.y>=0&&r.x<=e&&r.y<=i&&(c=this._maskTest(n)),c)return!0}}}return!1},i.hitTest=function(t){for(var e=this._contentSize.width,i=this._contentSize.height,n=gk,r=pk,s=mk,a=this._getRenderScene().cameras,o=0;o<a.length;o++){var u=a[o];if(u.visibility&this.node.layer&&(!u.window||u.window.swapchain)&&(ji.set(n,t.x,t.y,0),u.screenToWorld(n,n),_n.set(r,n.x,n.y),this.node.getWorldMatrix(Ek),un.invert(vk,Ek),!un.strictEquals(vk,Tk))){_n.transformMat4(s,r,vk),s.x+=this._anchorPoint.x*e,s.y+=this._anchorPoint.y*i;var h=!1;if(s.x>=0&&s.y>=0&&s.x<=e&&s.y<=i&&(h=this._maskTest(r)),h)return!0}}return!1},i._maskTest=function(t){var e,i,n=null===(e=this.node)||void 0===e||null===(i=e.eventProcessor)||void 0===i?void 0:i.maskList;if(n)for(var r=this.node,s=n.length,a=0,o=0;r&&o<s;++a,r=r.parent){var u=n[o];if(a===u.index){if(r!==u.comp.node){n.length=o;break}var h=u.comp;if(h&&h._enabled&&!h.isHit(t))return!1;o++}else if(a>u.index){n.length=o;break}}return!0},i.convertToNodeSpaceAR=function(t,e){return this.node.getWorldMatrix(Ek),un.invert(vk,Ek),e||(e=new ji),ji.transformMat4(e,t,vk)},i.convertToWorldSpaceAR=function(t,e){return this.node.getWorldMatrix(Ek),e||(e=new ji),ji.transformMat4(e,t,Ek)},i.getBoundingBox=function(){un.fromRTS(yk,this.node.getRotation(),this.node.getPosition(),this.node.getScale());var t=this._contentSize.width,e=this._contentSize.height,i=new yn(-this._anchorPoint.x*t,-this._anchorPoint.y*e,t,e);return i.transformMat4(yk),i},i.getBoundingBoxToWorld=function(){return this.node.parent?(this.node.parent.getWorldMatrix(Ek),this.getBoundingBoxTo(Ek)):this.getBoundingBox()},i.getBoundingBoxTo=function(t){un.fromRTS(yk,this.node.getRotation(),this.node.getPosition(),this.node.getScale());var i=this._contentSize.width,n=this._contentSize.height,r=new yn(-this._anchorPoint.x*i,-this._anchorPoint.y*n,i,n);if(un.multiply(Ek,t,yk),r.transformMat4(Ek),!this.node.children)return r;for(var s,a=y(this.node.children);!(s=a()).done;){var o=s.value;if(o&&o.active){var u=o.getComponent(e);if(u){var h=u.getBoundingBoxTo(t);h&&yn.union(r,r,h)}}}return r},i.getComputeAABB=function(t){var e=this._contentSize.width,i=this._contentSize.height;Sk.set(-this._anchorPoint.x*e,-this._anchorPoint.y*i,e,i),Sk.transformMat4(this.node.worldMatrix);var n=Sk.x+.5*Sk.width,r=Sk.y+.5*Sk.height,s=this.node.worldPosition.z,a=Sk.width/2,o=Sk.height/2;return null!=t?(Fu.set(t,n,r,s,a,o,.001),t):new Fu(n,r,s,a,o,.001)},i._parentChanged=function(){this.node.getComponent("cc.RenderRoot2D")||this.node.parent&&e.insertChangeMap(this.node.parent)},i._markRenderDataDirty=function(){var t=this.node._uiProps.uiComp;t&&t.markForUpdateRenderData()},e.insertChangeMap=function(t){var i=t.uuid;e.priorityChangeNodeMap.has(i)||e.priorityChangeNodeMap.set(i,t)},e._sortChildrenSibling=function(t){var e=t.children;e&&e.sort((function(t,e){var i=t._uiProps.uiTransformComp,n=e._uiProps.uiTransformComp,r=(i?i._priority:0)-(n?n._priority:0);return 0===r?t.getSiblingIndex()-e.getSiblingIndex():r}))},e._sortSiblings=function(){e.priorityChangeNodeMap.forEach((function(t){e._sortChildrenSibling(t),t._updateSiblingIndex(),t.emit("childrenSiblingOrderChanged")})),e.priorityChangeNodeMap.clear()},e._cleanChangeMap=function(){e.priorityChangeNodeMap.clear()},h(e,[{key:"contentSize",get:function(){return this._contentSize},set:function(t){this._contentSize.equals(t)||(this._contentSize.set(t),this.node.emit(aE.SIZE_CHANGED),this._markRenderDataDirty())}},{key:"width",get:function(){return this._contentSize.width},set:function(t){this._contentSize.width!==t&&(this._contentSize.width=t,this.node.emit(aE.SIZE_CHANGED),this._markRenderDataDirty())}},{key:"height",get:function(){return this._contentSize.height},set:function(t){this.contentSize.height!==t&&(this._contentSize.height=t,this.node.emit(aE.SIZE_CHANGED),this._markRenderDataDirty())}},{key:"anchorPoint",get:function(){return this._anchorPoint},set:function(t){this._anchorPoint.equals(t)||(this._anchorPoint.set(t),this.node.emit(aE.ANCHOR_CHANGED,this._anchorPoint),this._markRenderDataDirty())}},{key:"anchorX",get:function(){return this._anchorPoint.x},set:function(t){this._anchorPoint.x!==t&&(this._anchorPoint.x=t,this.node.emit(aE.ANCHOR_CHANGED,this._anchorPoint),this._markRenderDataDirty())}},{key:"anchorY",get:function(){return this._anchorPoint.y},set:function(t){this._anchorPoint.y!==t&&(this._anchorPoint.y=t,this.node.emit(aE.ANCHOR_CHANGED,this._anchorPoint),this._markRenderDataDirty())}},{key:"priority",get:function(){return this._priority},set:function(t){this._priority!==t&&(this.node.getComponent("cc.RenderRoot2D")?j(6706):(this._priority=t,this.node.parent&&e.insertChangeMap(this.node.parent)))}},{key:"visibility",get:function(){var t=OL.root.batcher2D.getFirstRenderCamera(this.node);return t?t.visibility:0}},{key:"cameraPriority",get:function(){var t=OL.root.batcher2D.getFirstRenderCamera(this.node);return t?t.priority:0}}]),e}(bc),zG.EventType=aE,zG.priorityChangeNodeMap=new Map,T((UG=HG).prototype,"contentSize",[BG,NG],Object.getOwnPropertyDescriptor(UG.prototype,"contentSize"),UG.prototype),T(UG.prototype,"anchorPoint",[MG,LG],Object.getOwnPropertyDescriptor(UG.prototype,"anchorPoint"),UG.prototype),GG=T(UG.prototype,"_contentSize",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new gn(100,100)}}),kG=T(UG.prototype,"_anchorPoint",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new _n(.5,.5)}}),FG=UG))||FG)||FG)||FG)||FG)||FG)||FG));OL.on(IL.EVENT_AFTER_UPDATE,Ak._sortSiblings),OL.on(IL.EVENT_BEFORE_SCENE_LAUNCH,Ak._cleanChangeMap),pe(jn),function(t){t[t.ADD_COLOR=0]="ADD_COLOR",t[t.ADD_COLOR_AND_TEXTURE=1]="ADD_COLOR_AND_TEXTURE",t[t.GRAYSCALE=2]="GRAYSCALE",t[t.USE_ALPHA_SEPARATED=3]="USE_ALPHA_SEPARATED",t[t.USE_ALPHA_SEPARATED_AND_GRAY=4]="USE_ALPHA_SEPARATED_AND_GRAY"}(uk||(uk=t("InstanceMaterialType",{})));var Rk,bk,Ck,wk,Ik,Ok,xk,Pk,Dk,Bk,Nk,Mk,Lk,Fk,Uk,Gk,kk,zk,Hk,Vk,Wk,Xk,jk,Yk,Kk,qk,Qk,Zk,Jk,$k,tz,ez,iz,nz,rz,sz,az,oz,uz,hz,lz,cz,_z,fz,dz,pz,mz,gz,vz,yz,Ez,Tz,Sz,Az,Rz,bz,Cz,wz,Iz,Oz,xz,Pz,Dz,Bz,Nz,Mz,Lz,Fz,Uz,Gz,kz=function(e){return t({UIRenderer:e,RenderComponent:e,UIRenderable:e,Renderable2D:e}),e}((VG=_h("cc.UIRenderer"),WG=fh(Ak),XG=Dh(),jG=Kh(Vy),YG=zh(),KG=Mh(),qG=Nh(),QG=zh(),ZG=Mh(),JG=Kh(Vy),VG($G=WG($G=bh((ok=ak=function(t){function e(){var e;return(e=t.call(this)||this)._renderData=null,E(e,"_materials",ek,g(e)),E(e,"_customMaterial",ik,g(e)),E(e,"_srcBlendFactor",nk,g(e)),E(e,"_dstBlendFactor",rk,g(e)),E(e,"_color",sk,g(e)),e._stencilStage=mG.DISABLED,e._assembler=null,e._postAssembler=null,e._renderDataFlag=!0,e._renderFlag=!0,e._renderEntity=void 0,e._instanceMaterialType=-1,e._srcBlendFactorCache=jn.SRC_ALPHA,e._dstBlendFactorCache=jn.ONE_MINUS_SRC_ALPHA,e._dirtyVersion=-1,e._internalId=-1,e._useVertexOpacity=!1,e._lastParent=null,e._renderEntity=e.createRenderEntity(),e}c(e,t);var i=e.prototype;return i.onLoad=function(){this._renderEntity.setNode(this.node)},i.__preload=function(){this.node._uiProps.uiComp=this,this._flushAssembler&&this._flushAssembler()},i.onEnable=function(){this.node.on(aE.ANCHOR_CHANGED,this._nodeStateChange,this),this.node.on(aE.SIZE_CHANGED,this._nodeStateChange,this),this.node.on(aE.PARENT_CHANGED,this._colorDirty,this),this.updateMaterial(),this._colorDirty(),wL.addRenderer(this),this.markForUpdateRenderData()},i.onRestore=function(){this.updateMaterial(),this.markForUpdateRenderData()},i.onDisable=function(){this.node.off(aE.ANCHOR_CHANGED,this._nodeStateChange,this),this.node.off(aE.SIZE_CHANGED,this._nodeStateChange,this),this.node.off(aE.PARENT_CHANGED,this._colorDirty,this),wL.removeRenderer(this),this._renderFlag=!1,this._renderEntity.enabled=!1},i.onDestroy=function(){if(this._renderEntity.setNode(null),this.node._uiProps.uiComp===this&&(this.node._uiProps.uiComp=null),this.destroyRenderData(),this._materialInstances)for(var t=0;t<this._materialInstances.length;t++){var e=this._materialInstances[t];e&&e.destroy()}},i.markForUpdateRenderData=function(t){if(void 0===t&&(t=!0),t){var e=this.renderData;e&&(e.vertDirty=!0),wL.markDirtyRenderer(this)}},i.requestRenderData=function(t){void 0===t&&(t=pG.COMP);var e=fk.add();return e.initRenderDrawInfo(this,t),this._renderData=e,e},i.destroyRenderData=function(){this.renderData&&(this.renderData.removeRenderDrawInfo(this),fk.remove(this.renderData),this._renderData=null)},i.updateRenderer=function(){this._assembler&&this._assembler.updateRenderData(this),this._renderFlag=this._canRender(),this._renderEntity.enabled=this._renderFlag},i.fillBuffers=function(t){this._renderFlag&&this._render(t)},i.postUpdateAssembler=function(t){this._postAssembler&&this._renderFlag&&this._postRender(t)},i._render=function(){},i._postRender=function(){},i._canRender=function(){return null!==this.getMaterial(0)&&this._enabled&&this._color.a>0},i._postCanRender=function(){},i.updateMaterial=function(){if(this._customMaterial)this.setMaterial(this._customMaterial,0);else{var t=this._updateBuiltinMaterial();this.setMaterial(t,0),this.stencilStage!==mG.ENTER_LEVEL&&this.stencilStage!==mG.ENTER_LEVEL_INVERTED||this.getMaterialInstance(0).recompileShaders({USE_ALPHA_TEST:!0}),this._updateBlendFunc()}},i._updateColor=function(){this.node._uiProps.colorDirty=!0,this.setEntityColorDirty(!0),this.setEntityColor(this._color),this.setEntityOpacity(this.node._uiProps.localOpacity),this._assembler&&(this._assembler.updateColor(this),this._renderFlag=this._canRender(),this.setEntityEnabled(this._renderFlag))},e.setEntityColorDirtyRecursively=function(t,i){var n=t._uiProps.uiComp;n&&n.color&&(n._renderEntity.colorDirty=i);for(var r=0;r<t.children.length;r++)e.setEntityColorDirtyRecursively(t.children[r],i)},i.setEntityColorDirty=function(){},i.setEntityColor=function(){},i.setEntityOpacity=function(){},i.setEntityEnabled=function(){},i._updateBlendFunc=function(){var t=this.getRenderMaterial(0).passes[0].blendState.targets[0];if(this._dstBlendFactorCache=t.blendDst,this._srcBlendFactorCache=t.blendSrc,this._dstBlendFactorCache!==this._dstBlendFactor||this._srcBlendFactorCache!==this._srcBlendFactor){(t=this.getMaterialInstance(0).passes[0].blendState.targets[0]).blend=!0,t.blendDstAlpha=jn.ONE_MINUS_SRC_ALPHA,t.blendDst=this._dstBlendFactor,t.blendSrc=this._srcBlendFactor;var e=this.getMaterialInstance(0).passes[0];e.blendState.setTarget(0,t),e._updatePassHash(),this._dstBlendFactorCache=this._dstBlendFactor,this._srcBlendFactorCache=this._srcBlendFactor}},i._nodeStateChange=function(){this.renderData&&this.markForUpdateRenderData();for(var t=0;t<this.node.children.length;++t){var i=this.node.children[t].getComponent(e);i&&i.markForUpdateRenderData()}},i._colorDirty=function(){this.node._uiProps.colorDirty=!0,this.setEntityColorDirty(!0)},i._onMaterialModified=function(e,i){this.renderData&&(this.markForUpdateRenderData(),this.renderData.passDirty=!0),t.prototype._onMaterialModified.call(this,e,i)},i._updateBuiltinMaterial=function(){var t;switch(this._instanceMaterialType){case uk.ADD_COLOR:t=vy.get("ui-base-material");break;case uk.GRAYSCALE:t=vy.get("ui-sprite-gray-material");break;case uk.USE_ALPHA_SEPARATED:t=vy.get("ui-sprite-alpha-sep-material");break;case uk.USE_ALPHA_SEPARATED_AND_GRAY:t=vy.get("ui-sprite-gray-alpha-sep-material");break;default:t=vy.get("ui-sprite-material")}return t},i.setNodeDirty=function(){this.renderData&&(this.renderData.nodeDirty=!0)},i.setTextureDirty=function(){this.renderData&&(this.renderData.textureDirty=!0)},i.createRenderEntity=function(){return new hk(AG.STATIC)},h(e,[{key:"sharedMaterials",get:function(){return this._materials},set:function(t){for(var e=0;e<t.length;e++)t[e]!==this._materials[e]&&this.setMaterial(t[e],e);if(t.length<this._materials.length){for(var i=t.length;i<this._materials.length;i++)this.setMaterial(null,i);this._materials.splice(t.length)}}},{key:"customMaterial",get:function(){return this._customMaterial},set:function(t){this._customMaterial=t,this.updateMaterial()}},{key:"color",get:function(){return this._color},set:function(t){this._color.equals(t)||(this._color.set(t),this._updateColor())}},{key:"renderData",get:function(){return this._renderData}},{key:"useVertexOpacity",get:function(){return this._useVertexOpacity}},{key:"stencilStage",get:function(){return this._stencilStage},set:function(t){this._stencilStage=t,this._renderEntity.setStencilStage(t)}},{key:"batcher",get:function(){return OL.root.batcher2D}},{key:"renderEntity",get:function(){return this._renderEntity}}]),e}(rA),ak.BlendState=jn,ak.Assembler=null,ak.PostAssembler=null,T((tk=ok).prototype,"sharedMaterials",[qh,XG],Object.getOwnPropertyDescriptor(tk.prototype,"sharedMaterials"),tk.prototype),T(tk.prototype,"customMaterial",[jG,YG,KG,qG,Vh],Object.getOwnPropertyDescriptor(tk.prototype,"customMaterial"),tk.prototype),T(tk.prototype,"color",[QG,ZG],Object.getOwnPropertyDescriptor(tk.prototype,"color"),tk.prototype),ek=T(tk.prototype,"_materials",[qh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),ik=T(tk.prototype,"_customMaterial",[JG],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),nk=T(tk.prototype,"_srcBlendFactor",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return jn.SRC_ALPHA}}),rk=T(tk.prototype,"_dstBlendFactor",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return jn.ONE_MINUS_SRC_ALPHA}}),sk=T(tk.prototype,"_color",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Gi.WHITE.clone()}}),$G=tk))||$G)||$G)||$G));b.internal.UIRenderer=kz,Gi.WHITE.clone(),function(t){t[t.LEFT=0]="LEFT",t[t.CENTER=1]="CENTER",t[t.RIGHT=2]="RIGHT"}(Lz||(Lz=t("HorizontalTextAlignment",{}))),pe(Lz),function(t){t[t.TOP=0]="TOP",t[t.CENTER=1]="CENTER",t[t.BOTTOM=2]="BOTTOM"}(Fz||(Fz=t("VerticalTextAlignment",{}))),pe(Fz),function(t){t[t.NONE=0]="NONE",t[t.CLAMP=1]="CLAMP",t[t.SHRINK=2]="SHRINK",t[t.RESIZE_HEIGHT=3]="RESIZE_HEIGHT"}(Uz||(Uz=t("Overflow",{}))),pe(Uz),function(t){t[t.NONE=0]="NONE",t[t.BITMAP=1]="BITMAP",t[t.CHAR=2]="CHAR"}(Gz||(Gz=t("CacheMode",{}))),pe(Gz);var zz=function(e){return t({Label:e,LabelComponent:e}),e}((Rk=_h("cc.Label"),bk=xh(),Ck=dh(110),wk=Ch(),Ik=zh(),Ok=Mh(),xk=Kh(Lz),Pk=zh(),Dk=Mh(),Bk=Kh(Fz),Nk=zh(),Mk=Mh(),Lk=zh(),Fk=Mh(),Uk=zh(),Gk=Mh(),kk=Dh(),zk=zh(),Hk=Mh(),Vk=Kh(Uz),Wk=zh(),Xk=Mh(),jk=zh(),Yk=Mh(),Kk=zh(),qk=Mh(),Qk=zh(),Zk=Dh(),Jk=Mh(),$k=Kh(mU),tz=zh(),ez=Dh(),iz=Mh(),nz=Kh(Gz),rz=zh(),sz=Mh(),az=zh(),oz=Mh(),uz=zh(),hz=Mh(),lz=zh(),cz=Mh(),_z=Dh(),fz=zh(),dz=Mh(),Rk(pz=bk(pz=Ck(pz=wk((Mz=Nz=function(t){function e(){var e;return E(e=t.call(this)||this,"_string",gz,g(e)),E(e,"_horizontalAlign",vz,g(e)),E(e,"_verticalAlign",yz,g(e)),E(e,"_actualFontSize",Ez,g(e)),E(e,"_fontSize",Tz,g(e)),E(e,"_fontFamily",Sz,g(e)),E(e,"_lineHeight",Az,g(e)),E(e,"_overflow",Rz,g(e)),E(e,"_enableWrapText",bz,g(e)),E(e,"_font",Cz,g(e)),E(e,"_isSystemFontUsed",wz,g(e)),E(e,"_spacingX",Iz,g(e)),E(e,"_isItalic",Oz,g(e)),E(e,"_isBold",xz,g(e)),E(e,"_isUnderline",Pz,g(e)),E(e,"_underlineHeight",Dz,g(e)),E(e,"_cacheMode",Bz,g(e)),e._N$file=null,e._texture=null,e._ttfSpriteFrame=null,e._userDefinedFont=null,e._assemblerData=null,e._fontAtlas=null,e._letterTexture=null,e._contentWidth=0,e._ttfSpriteFrame=null,e}c(e,t);var i=e.prototype;return i.onEnable=function(){t.prototype.onEnable.call(this),this._font||this._isSystemFontUsed||(this.useSystemFont=!0),this._isSystemFontUsed&&!this._fontFamily&&(this.fontFamily="Arial"),this._applyFontTexture()},i.onDestroy=function(){if(this._assembler&&this._assembler.resetAssemblerData&&this._assembler.resetAssemblerData(this._assemblerData),this._assemblerData=null,this._ttfSpriteFrame){this._ttfSpriteFrame._resetDynamicAtlasFrame();var e=this._ttfSpriteFrame.texture;if(this._ttfSpriteFrame.destroy(),e){var i=e;i.image&&i.image.destroy(),e.destroy()}this._ttfSpriteFrame=null}this._letterTexture=null,t.prototype.onDestroy.call(this)},i.updateRenderData=function(t){void 0===t&&(t=!1),t&&(this._flushAssembler(),this.renderData&&(this.renderData.vertDirty=!0),this._applyFontTexture()),this._assembler&&this._assembler.updateRenderData(this)},i._render=function(t){t.commitComp(this,this.renderData,this._texture,this._assembler,null)},i._updateColor=function(){t.prototype._updateColor.call(this),this.markForUpdateRenderData()},i.setEntityColor=function(){},i._canRender=function(){if(!t.prototype._canRender.call(this)||!this._string)return!1;var e=this._font;if(e&&e instanceof xU){var i=e.spriteFrame;if(!i||!i.texture)return!1}return!0},i._flushAssembler=function(){var t=e.Assembler.getAssembler(this);this._assembler!==t&&(this.destroyRenderData(),this._assembler=t),this.renderData||this._assembler&&this._assembler.createData&&(this._renderData=this._assembler.createData(this),this.renderData.material=this.material,this._updateColor())},i._applyFontTexture=function(){this.markForUpdateRenderData();var t=this._font;if(t instanceof xU){var e=t.spriteFrame;e&&e.texture&&(this._texture=e,this.renderData&&(this.renderData.textureDirty=!0),this.changeMaterialForDefine(),this._assembler&&this._assembler.updateRenderData(this))}else{if(this.cacheMode===Gz.CHAR)this._letterTexture=this._assembler.getAssemblerData(),this._texture=this._letterTexture;else if(!this._ttfSpriteFrame){this._ttfSpriteFrame=new hU,this._assemblerData=this._assembler.getAssemblerData();var i=new Ag(this._assemblerData.canvas),n=new qg;n.image=i,this._ttfSpriteFrame.texture=n}this.cacheMode!==Gz.CHAR&&(this._texture=this._ttfSpriteFrame),this.changeMaterialForDefine()}},i.changeMaterialForDefine=function(){if(this._texture){var t=!1;if(this.cacheMode!==Gz.CHAR){var e=this._texture.texture;if(e instanceof Tg){var i=e.getPixelFormat();t=i===eg.RGBA_ETC1||i===eg.RGB_A_PVRTC_4BPPV1||i===eg.RGB_A_PVRTC_2BPPV1}}this._instanceMaterialType=t?uk.USE_ALPHA_SEPARATED:uk.ADD_COLOR_AND_TEXTURE,this.updateMaterial()}},i._updateBlendFunc=function(){t.prototype._updateBlendFunc.call(this)},h(e,[{key:"string",get:function(){return this._string},set:function(t){t=null==t?"":t.toString(),this._string!==t&&(this._string=t,this.markForUpdateRenderData())}},{key:"horizontalAlign",get:function(){return this._horizontalAlign},set:function(t){this._horizontalAlign!==t&&(this._horizontalAlign=t,this.markForUpdateRenderData())}},{key:"verticalAlign",get:function(){return this._verticalAlign},set:function(t){this._verticalAlign!==t&&(this._verticalAlign=t,this.markForUpdateRenderData())}},{key:"actualFontSize",get:function(){return this._actualFontSize},set:function(t){this._actualFontSize=t}},{key:"fontSize",get:function(){return this._fontSize},set:function(t){this._fontSize!==t&&(this._fontSize=t,this.markForUpdateRenderData())}},{key:"lineHeight",get:function(){return this._lineHeight},set:function(t){this._lineHeight!==t&&(this._lineHeight=t,this.markForUpdateRenderData())}},{key:"spacingX",get:function(){return this._spacingX},set:function(t){this._spacingX!==t&&(this._spacingX=t,this.markForUpdateRenderData())}},{key:"overflow",get:function(){return this._overflow},set:function(t){this._overflow!==t&&(this._overflow=t,this.markForUpdateRenderData())}},{key:"enableWrapText",get:function(){return this._enableWrapText},set:function(t){this._enableWrapText!==t&&(this._enableWrapText=t,this.markForUpdateRenderData())}},{key:"useSystemFont",get:function(){return this._isSystemFontUsed},set:function(t){this._isSystemFontUsed!==t&&(this.destroyRenderData(),this._isSystemFontUsed=!!t,t&&(this.font=null),this._flushAssembler(),this.markForUpdateRenderData())}},{key:"fontFamily",get:function(){return this._fontFamily},set:function(t){this._fontFamily!==t&&(this._fontFamily=t,this.markForUpdateRenderData())}},{key:"font",get:function(){return this._font},set:function(t){this._font!==t&&(this._isSystemFontUsed=!t,this._font=t,this.destroyRenderData(),this._fontAtlas=null,this.updateRenderData(!0))}},{key:"cacheMode",get:function(){return this._cacheMode},set:function(t){this._cacheMode!==t&&(this._cacheMode!==Gz.BITMAP||this._font instanceof xU||!this._ttfSpriteFrame||this._ttfSpriteFrame._resetDynamicAtlasFrame(),this._cacheMode===Gz.CHAR&&(this._ttfSpriteFrame=null),this._cacheMode=t,this.updateRenderData(!0))}},{key:"isBold",get:function(){return this._isBold},set:function(t){this._isBold!==t&&(this._isBold=t,this.markForUpdateRenderData())}},{key:"isItalic",get:function(){return this._isItalic},set:function(t){this._isItalic!==t&&(this._isItalic=t,this.markForUpdateRenderData())}},{key:"isUnderline",get:function(){return this._isUnderline},set:function(t){this._isUnderline!==t&&(this._isUnderline=t,this.markForUpdateRenderData())}},{key:"underlineHeight",get:function(){return this._underlineHeight},set:function(t){this._underlineHeight!==t&&(this._underlineHeight=t,this.markForUpdateRenderData())}},{key:"spriteFrame",get:function(){return this._texture}},{key:"ttfSpriteFrame",get:function(){return this._ttfSpriteFrame}},{key:"assemblerData",get:function(){return this._assemblerData}},{key:"fontAtlas",get:function(){return this._fontAtlas},set:function(t){this._fontAtlas=t}},{key:"_bmFontOriginalSize",get:function(){return this._font instanceof xU?this._font.fontSize:-1}},{key:"contentWidth",get:function(){return this._contentWidth},set:function(t){this._contentWidth=t}}]),e}(kz),Nz.HorizontalAlign=Lz,Nz.VerticalAlign=Fz,Nz.Overflow=Uz,Nz.CacheMode=Gz,Nz._canvasPool=QU.getInstance(),T((mz=Mz).prototype,"string",[Ik,Ok,Hh],Object.getOwnPropertyDescriptor(mz.prototype,"string"),mz.prototype),T(mz.prototype,"horizontalAlign",[xk,Pk,Dk],Object.getOwnPropertyDescriptor(mz.prototype,"horizontalAlign"),mz.prototype),T(mz.prototype,"verticalAlign",[Bk,Nk,Mk],Object.getOwnPropertyDescriptor(mz.prototype,"verticalAlign"),mz.prototype),T(mz.prototype,"fontSize",[Lk,Fk],Object.getOwnPropertyDescriptor(mz.prototype,"fontSize"),mz.prototype),T(mz.prototype,"lineHeight",[Uk,Gk],Object.getOwnPropertyDescriptor(mz.prototype,"lineHeight"),mz.prototype),T(mz.prototype,"spacingX",[kk,zk,Hk],Object.getOwnPropertyDescriptor(mz.prototype,"spacingX"),mz.prototype),T(mz.prototype,"overflow",[Vk,Wk,Xk],Object.getOwnPropertyDescriptor(mz.prototype,"overflow"),mz.prototype),T(mz.prototype,"enableWrapText",[jk,Yk],Object.getOwnPropertyDescriptor(mz.prototype,"enableWrapText"),mz.prototype),T(mz.prototype,"useSystemFont",[Kk,qk],Object.getOwnPropertyDescriptor(mz.prototype,"useSystemFont"),mz.prototype),T(mz.prototype,"fontFamily",[Qk,Zk,Jk],Object.getOwnPropertyDescriptor(mz.prototype,"fontFamily"),mz.prototype),T(mz.prototype,"font",[$k,tz,ez,iz],Object.getOwnPropertyDescriptor(mz.prototype,"font"),mz.prototype),T(mz.prototype,"cacheMode",[nz,rz,sz],Object.getOwnPropertyDescriptor(mz.prototype,"cacheMode"),mz.prototype),T(mz.prototype,"isBold",[az,oz],Object.getOwnPropertyDescriptor(mz.prototype,"isBold"),mz.prototype),T(mz.prototype,"isItalic",[uz,hz],Object.getOwnPropertyDescriptor(mz.prototype,"isItalic"),mz.prototype),T(mz.prototype,"isUnderline",[lz,cz],Object.getOwnPropertyDescriptor(mz.prototype,"isUnderline"),mz.prototype),T(mz.prototype,"underlineHeight",[_z,Ph,fz,dz],Object.getOwnPropertyDescriptor(mz.prototype,"underlineHeight"),mz.prototype),gz=T(mz.prototype,"_string",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return"label"}}),vz=T(mz.prototype,"_horizontalAlign",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Lz.CENTER}}),yz=T(mz.prototype,"_verticalAlign",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Fz.CENTER}}),Ez=T(mz.prototype,"_actualFontSize",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),Tz=T(mz.prototype,"_fontSize",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 40}}),Sz=T(mz.prototype,"_fontFamily",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return"Arial"}}),Az=T(mz.prototype,"_lineHeight",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 40}}),Rz=T(mz.prototype,"_overflow",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Uz.NONE}}),bz=T(mz.prototype,"_enableWrapText",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),Cz=T(mz.prototype,"_font",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),wz=T(mz.prototype,"_isSystemFontUsed",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),Iz=T(mz.prototype,"_spacingX",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),Oz=T(mz.prototype,"_isItalic",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),xz=T(mz.prototype,"_isBold",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),Pz=T(mz.prototype,"_isUnderline",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),Dz=T(mz.prototype,"_underlineHeight",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 2}}),Bz=T(mz.prototype,"_cacheMode",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Gz.NONE}}),pz=mz))||pz)||pz)||pz)||pz));b.Label=zz;var Hz,Vz,Wz=0,Xz={};function jz(t){return--t,t|=t>>16,t|=t>>8,t|=t>>4,t|=t>>2,t|=t>>1,++t}function Yz(t,e){return Math.ceil(t/e)*e}!function(t){t[t.OPAQUE=0]="OPAQUE",t[t.TRANSPARENT=1]="TRANSPARENT",t[t.OVERLAY=2]="OVERLAY"}(Hz||(Hz={})),function(t){t[t.DEFAULT=1]="DEFAULT",t[t.FORWARD=2]="FORWARD",t[t.SHADOWCAST=4]="SHADOWCAST"}(Vz||(Vz={}));var Kz,qz,Qz,Zz,Jz,$z,tH,eH,iH,nH=function(){function t(t){this._device=void 0,this._format=On.UNKNOWN,this._formatSize=0,this._chunks=[],this._chunkCount=0,this._handles=[],this._region0=new Ir,this._region1=new Ir,this._region2=new Ir,this._roundUpFn=null,this._bufferViewCtor=Uint8Array,this._channels=4,this._alignment=1,this._device=t}var e=t.prototype;return e.initialize=function(t){var e=As[t.format];this._format=t.format,this._formatSize=e.size,this._channels=e.count,this._bufferViewCtor=Ds(e),this._roundUpFn=t.roundUpFn||null,this._alignment=t.alignment||1,t.inOrderFree&&(this.alloc=this._McDonaldAlloc)},e.destroy=function(){for(var t=0;t<this._chunkCount;++t)this._chunks[t].texture.destroy();this._chunks.length=0,this._handles.length=0},e.alloc=function(t,e){t=Yz(t,this._alignment);var i=-1,n=-1;if(void 0!==e&&(i=e,n=this._findAvailableSpace(t,i)),n<0)for(var r=0;r<this._chunkCount&&(i=r,!((n=this._findAvailableSpace(t,i))>=0));++r);if(n>=0){var s=this._chunks[i];s.start+=t;var a={chunkIdx:i,start:n,end:n+t,texture:s.texture};return this._handles.push(a),a}var o=Math.sqrt(t/this._formatSize),u=this._roundUpFn&&this._roundUpFn(o,this._formatSize)||Math.max(1024,jz(o)),h=this._chunks[this.createChunk(u)];h.start+=t;var l={chunkIdx:this._chunkCount-1,start:0,end:t,texture:h.texture};return this._handles.push(l),l},e.free=function(t){for(var e=0;e<this._handles.length;++e)if(this._handles[e]===t)return this._chunks[t.chunkIdx].end=t.end,void this._handles.splice(e,1)},e.createChunk=function(t){var e=t*t*this._formatSize;G("TextureBufferPool: Allocate chunk "+this._chunkCount+", size: "+e+", format: "+this._format);var i={texture:this._device.createTexture(new kr(Ln.TEX2D,Fn.SAMPLED|Fn.TRANSFER_DST,this._format,t,t)),size:e,start:0,end:e};return this._chunks[this._chunkCount]=i,this._chunkCount++},e.update=function(t,e){var i=[],n=[],r=t.start/this._formatSize,s=e.byteLength/this._formatSize,a=r%t.texture.width,o=Math.floor(r/t.texture.width),u=Math.min(t.texture.width-a,s),h=0;a>0&&(this._region0.texOffset.x=a,this._region0.texOffset.y=o,this._region0.texExtent.width=u,this._region0.texExtent.height=1,i.push(new this._bufferViewCtor(e,h*this._formatSize,u*this._channels)),n.push(this._region0),a=0,o+=1,s-=u,h+=u),s>0&&(this._region1.texOffset.x=a,this._region1.texOffset.y=o,s>t.texture.width?(this._region1.texExtent.width=t.texture.width,this._region1.texExtent.height=Math.floor(s/t.texture.width),u=this._region1.texExtent.width*this._region1.texExtent.height):(u=s,this._region1.texExtent.width=u,this._region1.texExtent.height=1),i.push(new this._bufferViewCtor(e,h*this._formatSize,u*this._channels)),n.push(this._region1),a=0,o+=this._region1.texExtent.height,s-=u,h+=u),s>0&&(this._region2.texOffset.x=a,this._region2.texOffset.y=o,this._region2.texExtent.width=s,this._region2.texExtent.height=1,i.push(new this._bufferViewCtor(e,h*this._formatSize,s*this._channels)),n.push(this._region2)),this._device.copyBuffersToTexture(i,t.texture,n)},e._findAvailableSpace=function(t,e){var i=this._chunks[e],n=!1,r=i.start;if(r+t<=i.size)n=!0;else{r=0;for(var s=this._handles.filter((function(t){return t.chunkIdx===e})).sort((function(t,e){return t.start-e.start})),a=0;a<s.length;a++){var o=s[a];if(r+t<=o.start){n=!0;break}r=o.end}!n&&r+t<=i.size&&(n=!0)}return n?r:-1},e._McDonaldAlloc=function(t){t=Yz(t,this._alignment);for(var e=0;e<this._chunkCount;++e){var i=this._chunks[e],n=!1,r=i.start;if(r+t<=i.end?n=!0:r>i.end?r+t<=i.size?n=!0:t<=i.end&&(i.start=r=0,n=!0):r===i.end&&(i.start=r=0,i.end=i.size,t<=i.end&&(n=!0)),n){i.start+=t;var s={chunkIdx:e,start:r,end:r+t,texture:i.texture};return this._handles.push(s),s}}var a=Math.sqrt(t/this._formatSize),o=this._roundUpFn&&this._roundUpFn(a,this._formatSize)||Math.max(1024,jz(a)),u=this._chunks[this.createChunk(o)];u.start+=t;var h={chunkIdx:this._chunkCount,start:0,end:t,texture:u.texture};return this._handles.push(h),h},t}(),rH=function(){function t(t,e,i){this._arrayBuffers=[],this._chunkSize=void 0,this._chunkSize=i*(1<<e)}return t.prototype.allocateNewChunk=function(){return new ArrayBuffer(this._chunkSize)},t}();!function(t){t[t.UINT32=0]="UINT32",t[t.FLOAT32=1]="FLOAT32",t[t.NEVER=2]="NEVER"}(iH||(iH={}));var sH,aH,oH=function(){function t(t,e,i,n,r){void 0===r&&(r=8),this._dataType=void 0,this._dataMembers=void 0,this._elementCount=void 0,this._entryBits=void 0,this._stride=void 0,this._entriesPerChunk=void 0,this._entryMask=void 0,this._chunkMask=void 0,this._poolFlag=void 0,this._arrayBuffers=[],this._freeLists=[],this._uint32BufferViews=[],this._float32BufferViews=[],this._hasUint32=!1,this._hasFloat32=!1,this._nativePool=void 0,this._elementCount=n.COUNT,this._entryBits=r,this._dataType=e,this._dataMembers=i,this._stride=4*this._elementCount,this._entriesPerChunk=1<<r,this._entryMask=this._entriesPerChunk-1,this._poolFlag=1<<30,this._chunkMask=~(this._entryMask|this._poolFlag),this._nativePool=new rH(t,r,this._stride);var s=iH.NEVER,a=!1,o=!1;for(var u in e){if(a=this._hasFloat32,(o=this._hasUint32)&&a)break;s=e[u],a||s!==iH.FLOAT32?o||s!==iH.UINT32||(this._hasUint32=!0):this._hasFloat32=!0}}var e=t.prototype;return e.alloc=function(){for(var t=0;t<this._freeLists.length;t++){var e=this._freeLists[t];if(e.length){var i=e[e.length-1];return e.length--,(t<<this._entryBits)+i+this._poolFlag}}for(var n=this._nativePool.allocateNewChunk(),r=[],s=[],a=[],o=this._hasFloat32,u=this._hasUint32,h=0;h<this._entriesPerChunk;h++)o&&r.push(new Float32Array(n,this._stride*h,this._elementCount)),u&&s.push(new Uint32Array(n,this._stride*h,this._elementCount)),h&&a.push(h);return u&&this._uint32BufferViews.push(s),o&&this._float32BufferViews.push(r),this._freeLists.push(a),this._arrayBuffers.push(n),(t<<this._entryBits)+this._poolFlag},e.getBuffer=function(t){var e=(this._chunkMask&t)>>this._entryBits,i=this._entryMask&t;return(this._hasFloat32?this._float32BufferViews:this._uint32BufferViews)[e][i]},e.getTypedArray=function(t,e){var i=(this._chunkMask&t)>>this._entryBits,n=this._entryMask&t,r=e,s=(this._dataType[e]===iH.UINT32?this._uint32BufferViews:this._float32BufferViews)[i][n],a=this._dataMembers[e];return s.subarray(r,r+a)},e.free=function(t){var e=(this._chunkMask&t)>>this._entryBits,i=this._entryMask&t;(this._hasUint32?this._uint32BufferViews:this._float32BufferViews)[e][i].fill(0),this._freeLists[e].push(i)},t}();!function(t){t[t.NODE=0]="NODE",t[t.PASS=1]="PASS",t[t.AABB=2]="AABB",t[t.RENDER2D=3]="RENDER2D"}(sH||(sH={})),function(t){t[t.POSITION=0]="POSITION",t[t.UV=3]="UV",t[t.COLOR=5]="COLOR",t[t.COUNT=9]="COUNT"}(aH||(aH={}));var uH,hH=((Kz={})[aH.POSITION]=iH.FLOAT32,Kz[aH.UV]=iH.FLOAT32,Kz[aH.COLOR]=iH.UINT32,Kz[aH.COUNT]=iH.NEVER,Kz),lH=((qz={})[aH.POSITION]=aH.UV-aH.POSITION,qz[aH.UV]=aH.COLOR-aH.UV,qz[aH.COLOR]=aH.COUNT-aH.COLOR,qz[aH.COUNT]=1,qz),cH=new oH(sH.RENDER2D,hH,lH,aH);!function(t){t[t.DIRTY_FLAG=0]="DIRTY_FLAG",t[t.LAYER=1]="LAYER",t[t.WORLD_SCALE=2]="WORLD_SCALE",t[t.WORLD_POSITION=5]="WORLD_POSITION",t[t.WORLD_ROTATION=8]="WORLD_ROTATION",t[t.WORLD_MATRIX=12]="WORLD_MATRIX",t[t.LOCAL_SCALE=28]="LOCAL_SCALE",t[t.LOCAL_POSITION=31]="LOCAL_POSITION",t[t.LOCAL_ROTATION=34]="LOCAL_ROTATION",t[t.COUNT=38]="COUNT"}(uH||(uH={}));var _H,fH=((Qz={})[uH.DIRTY_FLAG]=iH.UINT32,Qz[uH.LAYER]=iH.UINT32,Qz[uH.WORLD_SCALE]=iH.FLOAT32,Qz[uH.WORLD_POSITION]=iH.FLOAT32,Qz[uH.WORLD_ROTATION]=iH.FLOAT32,Qz[uH.WORLD_MATRIX]=iH.FLOAT32,Qz[uH.LOCAL_SCALE]=iH.FLOAT32,Qz[uH.LOCAL_POSITION]=iH.FLOAT32,Qz[uH.LOCAL_ROTATION]=iH.FLOAT32,Qz[uH.COUNT]=iH.NEVER,Qz),dH=((Zz={})[uH.DIRTY_FLAG]=uH.LAYER-uH.DIRTY_FLAG,Zz[uH.LAYER]=uH.WORLD_SCALE-uH.LAYER,Zz[uH.WORLD_SCALE]=uH.WORLD_POSITION-uH.WORLD_SCALE,Zz[uH.WORLD_POSITION]=uH.WORLD_ROTATION-uH.WORLD_POSITION,Zz[uH.WORLD_ROTATION]=uH.WORLD_MATRIX-uH.WORLD_ROTATION,Zz[uH.WORLD_MATRIX]=uH.LOCAL_SCALE-uH.WORLD_MATRIX,Zz[uH.LOCAL_SCALE]=uH.LOCAL_POSITION-uH.LOCAL_SCALE,Zz[uH.LOCAL_POSITION]=uH.LOCAL_ROTATION-uH.LOCAL_POSITION,Zz[uH.LOCAL_ROTATION]=uH.COUNT-uH.LOCAL_ROTATION,Zz[uH.COUNT]=1,Zz),pH=new oH(sH.NODE,fH,dH,uH);!function(t){t[t.PRIORITY=0]="PRIORITY",t[t.STAGE=1]="STAGE",t[t.PHASE=2]="PHASE",t[t.PRIMITIVE=3]="PRIMITIVE",t[t.BATCHING_SCHEME=4]="BATCHING_SCHEME",t[t.DYNAMIC_STATE=5]="DYNAMIC_STATE",t[t.HASH=6]="HASH",t[t.COUNT=7]="COUNT"}(_H||(_H={}));var mH,gH=((Jz={})[_H.PRIORITY]=iH.UINT32,Jz[_H.STAGE]=iH.UINT32,Jz[_H.PHASE]=iH.UINT32,Jz[_H.PRIMITIVE]=iH.UINT32,Jz[_H.BATCHING_SCHEME]=iH.UINT32,Jz[_H.DYNAMIC_STATE]=iH.UINT32,Jz[_H.HASH]=iH.UINT32,Jz[_H.COUNT]=iH.NEVER,Jz),vH=(($z={})[_H.PRIORITY]=_H.STAGE-_H.PRIORITY,$z[_H.STAGE]=_H.PHASE-_H.STAGE,$z[_H.PHASE]=_H.PRIMITIVE-_H.PHASE,$z[_H.PRIMITIVE]=_H.BATCHING_SCHEME-_H.PRIMITIVE,$z[_H.BATCHING_SCHEME]=_H.DYNAMIC_STATE-_H.BATCHING_SCHEME,$z[_H.DYNAMIC_STATE]=_H.HASH-_H.DYNAMIC_STATE,$z[_H.HASH]=_H.COUNT-_H.HASH,$z[_H.COUNT]=1,$z),yH=new oH(sH.PASS,gH,vH,_H);!function(t){t[t.CENTER=0]="CENTER",t[t.HALFEXTENTS=3]="HALFEXTENTS",t[t.COUNT=6]="COUNT"}(mH||(mH={}));var EH=((tH={})[mH.CENTER]=iH.FLOAT32,tH[mH.HALFEXTENTS]=iH.FLOAT32,tH[mH.COUNT]=iH.NEVER,tH),TH=((eH={})[mH.CENTER]=mH.HALFEXTENTS-mH.CENTER,eH[mH.HALFEXTENTS]=mH.COUNT-mH.HALFEXTENTS,eH[mH.COUNT]=1,eH),SH=new oH(sH.AABB,EH,TH,mH);it(SL.prototype,"RenderScene.prototype",[{name:"raycastUI2DNode"},{name:"raycastUINode"}]),it(SL.prototype,"RenderScene.prototype",[{name:"raycastAll",suggest:"using intersect.rayModel in geometry"},{name:"raycastAllModels",suggest:"using intersect.rayModel in geometry"},{name:"raycastSingleModel",suggest:"using intersect.rayModel in geometry"},{name:"raycastAllCanvas",suggest:"using intersect.rayAABB in geometry"},{name:"rayResultCanvas"},{name:"rayResultModels"},{name:"rayResultAll"},{name:"rayResultSingleModel"}]),it(mB.prototype,"Model.prototype",[{name:"isInstancingEnabled"},{name:"instancedAttributes"}]);var AH={};it(AH,"CameraVisFlags",[{name:"GENERAL"}]),et(AH,"CameraVisFlags",[{name:"PROFILER",newName:"PROFILER",target:Jd.BitMask,targetName:"PROFILER"},{name:"GIZMOS",newName:"GIZMOS",target:Jd.BitMask,targetName:"GIZMOS"},{name:"EDITOR",newName:"EDITOR",target:Jd.BitMask,targetName:"EDITOR"},{name:"UI",newName:"UI",target:Jd.BitMask,targetName:"UI_3D"},{name:"UI2D",newName:"UI2D",target:Jd.BitMask,targetName:"UI_2D"}]),b.CameraVisFlags=AH;var RH={};it(RH,"VisibilityFlags",[{name:"GENERAL"}]),et(RH,"VisibilityFlags",[{name:"ALWALS",newName:"ALWALS",target:Jd.Enum,targetName:"ALWALS"},{name:"PROFILER",newName:"PROFILER",target:Jd.Enum,targetName:"PROFILER"},{name:"GIZMOS",newName:"GIZMOS",target:Jd.Enum,targetName:"GIZMOS"},{name:"EDITOR",newName:"EDITOR",target:Jd.Enum,targetName:"EDITOR"},{name:"UI",newName:"UI",target:Jd.Enum,targetName:"UI_3D"},{name:"UI2D",newName:"UI2D",target:Jd.Enum,targetName:"UI_2D"}]),b.VisibilityFlags=RH,et(by.prototype,"Pass.prototype",[{name:"getBindingTypeFromHandle",newName:"getDescriptorTypeFromHandle"}]),it(NS.prototype,"Camera.prototype",[{name:"getSplitFrustum"},{name:"setMatView"},{name:"setMatViewInv"},{name:"setMatProjInv"},{name:"setMatViewProjInv"},{name:"setMatProj"},{name:"setMatViewProj"},{name:"getMatViewInv"}]),it(NA.prototype,"Shadows.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"}]),it(IB.prototype,"SpotLight.prototype",[{name:"aspect"}]);var bH,CH,wH,IH=function(t){if(void 0===Xz[t]){var e=1<<Wz;Xz[t]=e,Wz+=1}},OH=Object.freeze({__proto__:null,addStage:IH,scene:OB,createIA:function(t,e){if(!e.positions)return console.error("The data must have positions field"),null;for(var i=[],n=e.positions.length/3,r=0;r<n;++r)i.push(e.positions[3*r],e.positions[3*r+1],e.positions[3*r+2]),e.normals&&i.push(e.normals[3*r],e.normals[3*r+1],e.normals[3*r+2]),e.uvs&&i.push(e.uvs[2*r],e.uvs[2*r+1]),e.colors&&i.push(e.colors[3*r],e.colors[3*r+1],e.colors[3*r+2]);var s=[];s.push(new Jr(gr.ATTR_POSITION,On.RGB32F)),e.normals&&s.push(new Jr(gr.ATTR_NORMAL,On.RGB32F)),e.uvs&&s.push(new Jr(gr.ATTR_TEX_COORD,On.RG32F)),e.colors&&s.push(new Jr(gr.ATTR_COLOR,On.RGB32F));var a=t.createBuffer(new Mr(Dn.VERTEX|Dn.TRANSFER_DST,Mn.DEVICE,4*i.length,4*i.length/n));a.update(new Float32Array(i));var o=null;return e.indices&&(o=t.createBuffer(new Mr(Dn.INDEX|Dn.TRANSFER_DST,Mn.DEVICE,2*e.indices.length,2))).update(new Uint16Array(e.indices)),t.createInputAssembler(new ts(s,[a],o))},get RenderQueue(){return Hz},get PassStage(){return Vz},genHandle:bm,getTypeFromHandle:Cm,getBindingFromHandle:wm,getCountFromHandle:Im,getOffsetFromHandle:Om,customizeType:xm,type2reader:Pm,type2writer:Dm,getDefaultFromType:Nm,getStringFromType:Mm,overrideMacros:Lm,get BatchingSchemes(){return my},Pass:by,getDeviceShaderVersion:Vm,programLib:Jm,nearestPOT:jz,TextureBufferPool:nH,MaterialInstance:iA,PassInstance:eA,get PoolType(){return sH},NULL_HANDLE:0,get Render2dView(){return aH},Render2dPool:cH,get NodeView(){return uH},NodePool:pH,get PassView(){return _H},PassPool:yH,get AABBView(){return mH},AABBPool:SH,RenderScene:SL,CameraVisFlags:AH,VisibilityFlags:RH});t("renderer",OH),function(t){t[t.BUTT=0]="BUTT",t[t.ROUND=1]="ROUND",t[t.SQUARE=2]="SQUARE"}(bH||(bH={})),pe(bH),function(t){t[t.BEVEL=0]="BEVEL",t[t.ROUND=1]="ROUND",t[t.MITER=2]="MITER"}(CH||(CH={})),pe(CH),function(t){t[t.PT_CORNER=1]="PT_CORNER",t[t.PT_LEFT=2]="PT_LEFT",t[t.PT_BEVEL=4]="PT_BEVEL",t[t.PT_INNERBEVEL=8]="PT_INNERBEVEL"}(wH||(wH={})),pe(wH);var xH=Math.PI,PH=Math.min,DH=Math.max,BH=Math.cos,NH=Math.sin,MH=Math.abs,LH=Math.sign,FH=.5522847493;function UH(t,e,i,n,r){t.moveTo(e-n,i),t.bezierCurveTo(e-n,i+r*FH,e-n*FH,i+r,e,i+r),t.bezierCurveTo(e+n*FH,i+r,e+n,i+r*FH,e+n,i),t.bezierCurveTo(e+n,i-r*FH,e+n*FH,i-r,e,i-r),t.bezierCurveTo(e-n*FH,i-r,e-n,i-r*FH,e-n,i),t.close()}function GH(t,e,i,n,r,s,a,o,u,h,l){var c,_,f,d,p,m,g,v,y,E,T,S,A,R,b,C;h>10||(p=.5*(s+o),m=.5*(a+u),g=.5*((c=.5*(e+n))+(f=.5*(n+s))),v=.5*((_=.5*(i+r))+(d=.5*(r+a))),((b=MH((n-o)*(R=u-i)-(r-u)*(A=o-e)))+(C=MH((s-o)*R-(a-u)*A)))*(b+C)<t.tessTol*(A*A+R*R)?t.addPoint(o,u,0===l?l|wH.PT_BEVEL:l):(GH(t,e,i,c,_,g,v,T=.5*(g+(y=.5*(f+p))),S=.5*(v+(E=.5*(d+m))),h+1,0),GH(t,T,S,y,E,p,m,o,u,h+1,l)))}var kH,zH,HH,VH,WH,XH,jH,YH,KH,qH,QH,ZH,JH,$H,tV,eV,iV,nV,rV,sV,aV,oV,uV,hV,lV,cV,_V,fV,dV,pV,mV,gV,vV,yV,EV,TV,SV,AV,RV,bV,CV,wV,IV,OV,xV,PV,DV,BV,NV,MV,LV,FV,UV,GV,kV,zV,HV,VV,WV,XV,jV,YV,KV,qV,QV,ZV,JV,$V,tW,eW,iW,nW,rW,sW=function(t){function e(e,i){var n;return(n=t.call(this,e,i)||this).dx=0,n.dy=0,n.dmx=0,n.dmy=0,n.flags=0,n.len=0,n.reset(),n}return c(e,t),e.prototype.reset=function(){this.dx=0,this.dy=0,this.dmx=0,this.dmy=0,this.flags=0,this.len=0},e}(_n),aW=function(){function t(){this.closed=!1,this.bevel=0,this.complex=!0,this.points=[],this.reset()}return t.prototype.reset=function(){this.closed=!1,this.bevel=0,this.complex=!0,this.points?this.points.length=0:this.points=[]},t}(),oW=function(){function t(t){this.dataOffset=0,this.updatePathOffset=!1,this.pathLength=0,this.pathOffset=0,this.paths=[],this.tessTol=.25,this.distTol=.01,this.fillColor=Gi.WHITE.clone(),this.lineCap=bH.BUTT,this.strokeColor=Gi.BLACK.clone(),this.lineJoin=CH.MITER,this.lineWidth=0,this.pointsOffset=0,this._commandX=0,this._commandY=0,this._points=[],this._renderDataList=[],this._curPath=null,this._comp=void 0,this._comp=t}var e=t.prototype;return e.moveTo=function(t,e){this.updatePathOffset&&(this.pathOffset=this.pathLength,this.updatePathOffset=!1),this._addPath(),this.addPoint(t,e,wH.PT_CORNER),this._commandX=t,this._commandY=e},e.lineTo=function(t,e){this.addPoint(t,e,wH.PT_CORNER),this._commandX=t,this._commandY=e},e.bezierCurveTo=function(t,e,i,n,r,s){var a=this._curPath,o=a.points[a.points.length-1];o&&(o.x!==t||o.y!==e||i!==r||n!==s?(GH(this,o.x,o.y,t,e,i,n,r,s,0,wH.PT_CORNER),this._commandX=r,this._commandY=s):this.lineTo(r,s))},e.quadraticCurveTo=function(t,e,i,n){var r=this._commandX,s=this._commandY;this.bezierCurveTo(r+2/3*(t-r),s+2/3*(e-s),i+2/3*(t-i),n+2/3*(e-n),i,n)},e.arc=function(t,e,i,n,r,s){!function(t,e,i,n,r,s,a){var o,u,h=0,l=0,c=0,_=0,f=0,d=0,p=0,m=0,g=0,v=0,y=0,E=0,T=0,S=0;if(l=s-r,a=a||!1)if(MH(l)>=2*xH)l=2*xH;else for(;l<0;)l+=2*xH;else if(MH(l)>=2*xH)l=2*-xH;else for(;l>0;)l-=2*xH;for(u=0|DH(1,PH(MH(l)/(.5*xH)+.5,5)),c=MH(4/3*(1-BH(o=l/u/2))/NH(o)),a||(c=-c),S=0;S<=u;S++)d=e+(_=BH(h=r+l*(S/u)))*n,p=i+(f=NH(h))*n,m=-f*n*c,g=_*n*c,0===S?t.moveTo(d,p):t.bezierCurveTo(v+E,y+T,d-m,p-g,d,p),v=d,y=p,E=m,T=g}(this,t,e,i,n,r,s)},e.ellipse=function(t,e,i,n){UH(this,t,e,i,n),this._curPath.complex=!1},e.circle=function(t,e,i){UH(this,t,e,i,i),this._curPath.complex=!1},e.rect=function(t,e,i,n){this.moveTo(t,e),this.lineTo(t+i,e),this.lineTo(t+i,e+n),this.lineTo(t,e+n),this.close(),this._curPath.complex=!1},e.roundRect=function(t,e,i,n,r){!function(t,e,i,n,r,s){if(s<.1)t.rect(e,i,n,r);else{var a=PH(s,.5*MH(n))*LH(n),o=PH(s,.5*MH(r))*LH(r);t.moveTo(e,i+o),t.lineTo(e,i+r-o),t.bezierCurveTo(e,i+r-o*(1-FH),e+a*(1-FH),i+r,e+a,i+r),t.lineTo(e+n-a,i+r),t.bezierCurveTo(e+n-a*(1-FH),i+r,e+n,i+r-o*(1-FH),e+n,i+r-o),t.lineTo(e+n,i+o),t.bezierCurveTo(e+n,i+o*(1-FH),e+n-a*(1-FH),i,e+n-a,i),t.lineTo(e+a,i),t.bezierCurveTo(e+a*(1-FH),i,e,i+o*(1-FH),e,i+o),t.close()}}(this,t,e,i,n,r),this._curPath.complex=!1},e.clear=function(){this.pathLength=0,this.pathOffset=0,this.pointsOffset=0,this.dataOffset=0,this._curPath=null,this.paths.length=0,this._points.length=0;for(var t=this._renderDataList,e=0,i=t.length;e<i;e++){var n=t[e];n&&(dk.remove(n),n.removeRenderDrawInfo(this._comp))}this._renderDataList.length=0},e.close=function(){this._curPath.closed=!0},e.requestRenderData=function(){var t=dk.add();return this._renderDataList.push(t),t},e.getRenderDataList=function(){return 0===this._renderDataList.length&&this.requestRenderData(),this._renderDataList},e.addPoint=function(t,e,i){var n=this._curPath;if(n){var r=this._points,s=n.points,a=r[this.pointsOffset++];a?(a.x=t,a.y=e):(a=new sW(t,e),r.push(a)),a.flags=i,s.push(a)}},e._addPath=function(){var t=this.pathLength,e=this.paths[t];return e?e.reset():(e=new aW,this.paths.push(e)),this.pathLength++,this._curPath=e,e},t}(),uW=sG.concat([new Jr("a_dist",On.R32F)]),hW=lG(uW),lW=cG(uW),cW=function(e){return t({Graphics:e,GraphicsComponent:e}),e}((kH=_h("cc.Graphics"),zH=xh(),HH=dh(110),VH=Ch(),WH=Mh(),XH=Kh(CH),jH=Mh(),YH=Kh(bH),KH=Mh(),qH=Mh(),QH=Mh(),ZH=Mh(),JH=Dh(),kH($H=zH($H=HH($H=VH((uV=oV=function(t){function e(){var e;return(e=t.call(this)||this).impl=null,e.model=null,E(e,"_lineWidth",eV,g(e)),E(e,"_strokeColor",iV,g(e)),E(e,"_lineJoin",nV,g(e)),E(e,"_lineCap",rV,g(e)),E(e,"_fillColor",sV,g(e)),E(e,"_miterLimit",aV,g(e)),e._isDrawing=!1,e._isNeedUploadData=!0,e._graphicsUseSubMeshes=[],e._instanceMaterialType=uk.ADD_COLOR,e.impl=new oW(g(e)),e}c(e,t);var i=e.prototype;return i.onRestore=function(){this.impl||this._flushAssembler()},i.onLoad=function(){t.prototype.onLoad.call(this),this.model=OL.root.createModel(mB),this.model.node=this.model.transform=this.node,this._flushAssembler()},i.onEnable=function(){t.prototype.onEnable.call(this),this._updateMtlForGraphics()},i.onDestroy=function(){this._sceneGetter=null,this.model&&(OL.root.destroyModel(this.model),this.model=null);var e=this._graphicsUseSubMeshes.length;if(e>0){for(var i=0;i<e;++i)this._graphicsUseSubMeshes[i].destroy();this._graphicsUseSubMeshes.length=0}this.impl&&(this._isDrawing=!1,this.impl.clear(),this.impl=null),t.prototype.onDestroy.call(this)},i.moveTo=function(t,e){this.impl&&this.impl.moveTo(t,e)},i.lineTo=function(t,e){this.impl&&this.impl.lineTo(t,e)},i.bezierCurveTo=function(t,e,i,n,r,s){this.impl&&this.impl.bezierCurveTo(t,e,i,n,r,s)},i.quadraticCurveTo=function(t,e,i,n){this.impl&&this.impl.quadraticCurveTo(t,e,i,n)},i.arc=function(t,e,i,n,r,s){this.impl&&this.impl.arc(t,e,i,n,r,s)},i.ellipse=function(t,e,i,n){this.impl&&this.impl.ellipse(t,e,i,n)},i.circle=function(t,e,i){this.impl&&this.impl.circle(t,e,i)},i.rect=function(t,e,i,n){this.impl&&this.impl.rect(t,e,i,n)},i.roundRect=function(t,e,i,n,r){this.impl&&this.impl.roundRect(t,e,i,n,r)},i.fillRect=function(t,e,i,n){this.rect(t,e,i,n),this.fill()},i.clear=function(){if(this.impl){if(this.impl.clear(),this._isDrawing=!1,this.model)for(var t=0;t<this.model.subModels.length;t++)this.model.subModels[t].inputAssembler.indexCount=0;this.markForUpdateRenderData()}},i.close=function(){this.impl&&this.impl.close()},i.stroke=function(){this._assembler||this._flushAssembler(),this._isDrawing=!0,this._isNeedUploadData=!0,this._assembler.stroke(this)},i.fill=function(){this._assembler||this._flushAssembler(),this._isDrawing=!0,this._isNeedUploadData=!0,this._assembler.fill(this)},i._updateMtlForGraphics=function(){var t;this._customMaterial?t=this.getMaterialInstance(0):(t=vy.get("ui-graphics-material"),this.setMaterial(t,0),(t=this.getMaterialInstance(0)).recompileShaders({USE_LOCAL:!0}))},i.activeSubModel=function(t){if(this.model){if(this.model.subModels.length<=t){var e=Ja.gfxDevice,i=e.createBuffer(new Mr(Dn.VERTEX|Dn.TRANSFER_DST,Mn.DEVICE,65535*lW,lW)),n=e.createBuffer(new Mr(Dn.INDEX|Dn.TRANSFER_DST,Mn.DEVICE,131070*Uint16Array.BYTES_PER_ELEMENT,Uint16Array.BYTES_PER_ELEMENT)),r=new wN([i],uW,er.TRIANGLE_LIST,n);r.subMeshIdx=0,this.model.initSubModel(t,r,this.getMaterialInstance(0)),this._graphicsUseSubMeshes.push(r)}}else j(4500,this.node.name)},i._uploadData=function(){var t=this.impl;if(t){var e=t&&t.getRenderDataList();if(!(e.length<=0)&&this.model){for(var i=this.model.subModels,n=0;n<e.length;n++){var r=e[n],s=i[n].inputAssembler;if(r.lastFilledVertex!==r.vertexStart){var a=new Float32Array(r.vData.buffer,0,r.vertexStart*hW);s.vertexBuffers[0].update(a),s.vertexCount=r.vertexStart;var o=new Uint16Array(r.iData.buffer,0,r.indexStart);s.indexBuffer.update(o),s.indexCount=r.indexStart,r.lastFilledVertex=r.vertexStart,r.lastFilledIndex=r.indexStart}}this._isNeedUploadData=!1}}},i._render=function(t){if(this._isNeedUploadData){if(this.impl){var e=this.impl.getRenderDataList(),i=this.model.subModels.length;if(e.length>i)for(var n=i;n<e.length;n++)this.activeSubModel(n)}this._uploadData()}t.commitModel(this,this.model,this.getMaterialInstance(0))},i._flushAssembler=function(){var t=e.Assembler.getAssembler(this);this._assembler!==t&&(this._assembler=t)},i._canRender=function(){return!!t.prototype._canRender.call(this)&&!!this.model&&this._isDrawing},i.updateRenderer=function(){t.prototype.updateRenderer.call(this)},i.createRenderEntity=function(){return new hk(AG.DYNAMIC)},h(e,[{key:"lineWidth",get:function(){return this._lineWidth},set:function(t){this._lineWidth=t,this.impl&&(this.impl.lineWidth=t)}},{key:"lineJoin",get:function(){return this._lineJoin},set:function(t){this._lineJoin=t,this.impl&&(this.impl.lineJoin=t)}},{key:"lineCap",get:function(){return this._lineCap},set:function(t){this._lineCap=t,this.impl&&(this.impl.lineCap=t)}},{key:"strokeColor",get:function(){return this._strokeColor},set:function(t){this.impl&&(this._strokeColor.set(t),this.impl.strokeColor=this._strokeColor)}},{key:"fillColor",get:function(){return this._fillColor},set:function(t){this.impl&&(this._fillColor.set(t),this.impl.fillColor=this._fillColor)}},{key:"miterLimit",get:function(){return this._miterLimit},set:function(t){this._miterLimit=t}},{key:"color",get:function(){return this._color},set:function(t){this._color!==t&&this._color.set(t)}},{key:"srcBlendFactor",get:function(){return this._srcBlendFactor},set:function(){}},{key:"dstBlendFactor",get:function(){return this._dstBlendFactor},set:function(){}},{key:"graphicsNativeProxy",get:function(){return this._graphicsNativeProxy}}]),e}(kz),oV.LineJoin=CH,oV.LineCap=bH,T((tV=uV).prototype,"lineWidth",[Ph,WH],Object.getOwnPropertyDescriptor(tV.prototype,"lineWidth"),tV.prototype),T(tV.prototype,"lineJoin",[XH,jH],Object.getOwnPropertyDescriptor(tV.prototype,"lineJoin"),tV.prototype),T(tV.prototype,"lineCap",[YH,KH],Object.getOwnPropertyDescriptor(tV.prototype,"lineCap"),tV.prototype),T(tV.prototype,"strokeColor",[qH],Object.getOwnPropertyDescriptor(tV.prototype,"strokeColor"),tV.prototype),T(tV.prototype,"fillColor",[QH],Object.getOwnPropertyDescriptor(tV.prototype,"fillColor"),tV.prototype),T(tV.prototype,"miterLimit",[ZH],Object.getOwnPropertyDescriptor(tV.prototype,"miterLimit"),tV.prototype),T(tV.prototype,"color",[qh,JH],Object.getOwnPropertyDescriptor(tV.prototype,"color"),tV.prototype),eV=T(tV.prototype,"_lineWidth",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 1}}),iV=T(tV.prototype,"_strokeColor",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Gi.BLACK.clone()}}),nV=T(tV.prototype,"_lineJoin",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return CH.MITER}}),rV=T(tV.prototype,"_lineCap",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return bH.BUTT}}),sV=T(tV.prototype,"_fillColor",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Gi.WHITE.clone()}}),aV=T(tV.prototype,"_miterLimit",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 10}}),$H=tV))||$H)||$H)||$H)||$H));b.Graphics=cW,function(t){t[t.SIMPLE=0]="SIMPLE",t[t.SLICED=1]="SLICED",t[t.TILED=2]="TILED",t[t.FILLED=3]="FILLED"}(eW||(eW={})),pe(eW),function(t){t[t.HORIZONTAL=0]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL",t[t.RADIAL=2]="RADIAL"}(iW||(iW={})),pe(iW),function(t){t[t.CUSTOM=0]="CUSTOM",t[t.TRIMMED=1]="TRIMMED",t[t.RAW=2]="RAW"}(nW||(nW={})),pe(nW),function(t){t.SPRITE_FRAME_CHANGED="spriteframe-changed"}(rW||(rW={}));var _W,fW,dW,pW,mW,gW,vW,yW,EW,TW,SW,AW,RW,bW,CW,wW,IW,OW,xW,PW=function(e){return t({Sprite:e,SpriteComponent:e}),e}((hV=_h("cc.Sprite"),lV=xh(),cV=dh(110),_V=Ch(),fV=Kh(cU),dV=zh(),pV=Mh(),mV=Kh(hU),gV=zh(),vV=Mh(),yV=Kh(eW),EV=zh(),TV=Mh(),SV=Kh(iW),AV=zh(),RV=Mh(),bV=zh(),CV=Mh(),wV=Lh(),IV=zh(),OV=Mh(),xV=Lh(),PV=zh(),DV=Mh(),BV=Dh(),NV=zh(),MV=Mh(),LV=zh(),FV=Mh(),UV=Kh(nW),GV=zh(),kV=Mh(),hV(zV=lV(zV=cV(zV=_V((tW=$V=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return E(e=t.call.apply(t,[this].concat(n))||this,"_spriteFrame",VV,g(e)),E(e,"_type",WV,g(e)),E(e,"_fillType",XV,g(e)),E(e,"_sizeMode",jV,g(e)),E(e,"_fillCenter",YV,g(e)),E(e,"_fillStart",KV,g(e)),E(e,"_fillRange",qV,g(e)),E(e,"_isTrimmedMode",QV,g(e)),E(e,"_useGrayscale",ZV,g(e)),E(e,"_atlas",JV,g(e)),e}c(e,t);var i=e.prototype;return i.__preload=function(){this.changeMaterialForDefine(),t.prototype.__preload.call(this)},i.onEnable=function(){t.prototype.onEnable.call(this),this._activateMaterial();var e=this._spriteFrame;e&&(this._updateUVs(),this._type===eW.SLICED&&e.on(hU.EVENT_UV_UPDATED,this._updateUVs,this))},i.onDisable=function(){t.prototype.onDisable.call(this),this._spriteFrame&&this._type===eW.SLICED&&this._spriteFrame.off(hU.EVENT_UV_UPDATED,this._updateUVs,this)},i.onDestroy=function(){t.prototype.onDestroy.call(this)},i.changeSpriteFrameFromAtlas=function(t){if(this._atlas){var e=this._atlas.getSpriteFrame(t);this.spriteFrame=e}else console.warn("SpriteAtlas is null.")},i.changeMaterialForDefine=function(){var t,e=this._instanceMaterialType;this._spriteFrame&&(t=this._spriteFrame.texture);var i=!1;if(t instanceof Tg){var n=t.getPixelFormat();i=n===eg.RGBA_ETC1||n===eg.RGB_A_PVRTC_4BPPV1||n===eg.RGB_A_PVRTC_2BPPV1}i&&this.grayscale?this._instanceMaterialType=uk.USE_ALPHA_SEPARATED_AND_GRAY:i?this._instanceMaterialType=uk.USE_ALPHA_SEPARATED:this.grayscale?this._instanceMaterialType=uk.GRAYSCALE:this._instanceMaterialType=uk.ADD_COLOR_AND_TEXTURE,e!==this._instanceMaterialType&&this.updateMaterial()},i._updateBuiltinMaterial=function(){var e=t.prototype._updateBuiltinMaterial.call(this);if(this.spriteFrame&&this.spriteFrame.texture instanceof aT){var i=l({SAMPLE_FROM_RT:!0},e.passes[0].defines),n=new Vy;n.initialize({effectAsset:e.effectAsset,defines:i}),e=n}return e},i._render=function(t){t.commitComp(this,this.renderData,this._spriteFrame,this._assembler,null)},i._canRender=function(){if(!t.prototype._canRender.call(this))return!1;var e=this._spriteFrame;return!(!e||!e.texture)},i._flushAssembler=function(){var t=e.Assembler.getAssembler(this);this._assembler!==t&&(this.destroyRenderData(),this._assembler=t),this.renderData||this._assembler&&this._assembler.createData&&(this._renderData=this._assembler.createData(this),this.renderData.material=this.getRenderMaterial(0),this.markForUpdateRenderData(),this.spriteFrame&&this._assembler.updateUVs(this),this._updateColor()),this._spriteFrame&&(this._type===eW.SLICED?this._spriteFrame.on(hU.EVENT_UV_UPDATED,this._updateUVs,this):this._spriteFrame.off(hU.EVENT_UV_UPDATED,this._updateUVs,this))},i._applySpriteSize=function(){if(this._spriteFrame)if(nW.RAW===this._sizeMode){var t=this._spriteFrame.originalSize;this.node._uiProps.uiTransformComp.setContentSize(t)}else if(nW.TRIMMED===this._sizeMode){var e=this._spriteFrame.rect;this.node._uiProps.uiTransformComp.setContentSize(e.width,e.height)}},i._resized=function(){},i._activateMaterial=function(){var t=this._spriteFrame,e=this.getRenderMaterial(0);t&&e&&this.markForUpdateRenderData(),this.renderData&&(this.renderData.material=e)},i._updateUVs=function(){this._assembler&&this._assembler.updateUVs(this)},i._applySpriteFrame=function(t){var e=this._spriteFrame;t&&this._type===eW.SLICED&&t.off(hU.EVENT_UV_UPDATED,this._updateUVs,this);var i=!1;e&&(t&&t.texture===e.texture||(i=!0),i&&(this.renderData&&(this.renderData.textureDirty=!0),this.changeMaterialForDefine()),this._applySpriteSize(),this._type===eW.SLICED&&e.on(hU.EVENT_UV_UPDATED,this._updateUVs,this))},h(e,[{key:"spriteAtlas",get:function(){return this._atlas},set:function(t){this._atlas!==t&&(this._atlas=t)}},{key:"spriteFrame",get:function(){return this._spriteFrame},set:function(t){if(this._spriteFrame!==t){var e=this._spriteFrame;this._spriteFrame=t,this.markForUpdateRenderData(),this._applySpriteFrame(e)}}},{key:"type",get:function(){return this._type},set:function(t){this._type!==t&&(this._type=t,this._flushAssembler())}},{key:"fillType",get:function(){return this._fillType},set:function(t){this._fillType!==t&&(t===iW.RADIAL||this._fillType===iW.RADIAL?this.destroyRenderData():this.renderData&&this.markForUpdateRenderData(!0)),this._fillType=t,this._flushAssembler()}},{key:"fillCenter",get:function(){return this._fillCenter},set:function(t){this._fillCenter.x=t.x,this._fillCenter.y=t.y,this._type===eW.FILLED&&this.renderData&&this.markForUpdateRenderData()}},{key:"fillStart",get:function(){return this._fillStart},set:function(t){this._fillStart=vi(t,0,1),this._type===eW.FILLED&&this.renderData&&(this.markForUpdateRenderData(),this._updateUVs())}},{key:"fillRange",get:function(){return this._fillRange},set:function(t){this._fillRange=vi(t,-1,1),this._type===eW.FILLED&&this.renderData&&(this.markForUpdateRenderData(),this._updateUVs())}},{key:"trim",get:function(){return this._isTrimmedMode},set:function(t){this._isTrimmedMode!==t&&(this._isTrimmedMode=t,this._type===eW.SIMPLE&&this.renderData&&this.markForUpdateRenderData(!0))}},{key:"grayscale",get:function(){return this._useGrayscale},set:function(t){this._useGrayscale!==t&&(this._useGrayscale=t,this.changeMaterialForDefine(),this.updateMaterial())}},{key:"sizeMode",get:function(){return this._sizeMode},set:function(t){this._sizeMode!==t&&(this._sizeMode=t,t!==nW.CUSTOM&&this._applySpriteSize())}}]),e}(kz),$V.FillType=iW,$V.Type=eW,$V.SizeMode=nW,$V.EventType=rW,T((HV=tW).prototype,"spriteAtlas",[fV,dV,pV],Object.getOwnPropertyDescriptor(HV.prototype,"spriteAtlas"),HV.prototype),T(HV.prototype,"spriteFrame",[mV,gV,vV],Object.getOwnPropertyDescriptor(HV.prototype,"spriteFrame"),HV.prototype),T(HV.prototype,"type",[yV,EV,TV],Object.getOwnPropertyDescriptor(HV.prototype,"type"),HV.prototype),T(HV.prototype,"fillType",[SV,AV,RV],Object.getOwnPropertyDescriptor(HV.prototype,"fillType"),HV.prototype),T(HV.prototype,"fillCenter",[bV,CV],Object.getOwnPropertyDescriptor(HV.prototype,"fillCenter"),HV.prototype),T(HV.prototype,"fillStart",[wV,IV,OV],Object.getOwnPropertyDescriptor(HV.prototype,"fillStart"),HV.prototype),T(HV.prototype,"fillRange",[xV,PV,DV],Object.getOwnPropertyDescriptor(HV.prototype,"fillRange"),HV.prototype),T(HV.prototype,"trim",[BV,NV,MV],Object.getOwnPropertyDescriptor(HV.prototype,"trim"),HV.prototype),T(HV.prototype,"grayscale",[Ph,LV,FV],Object.getOwnPropertyDescriptor(HV.prototype,"grayscale"),HV.prototype),T(HV.prototype,"sizeMode",[UV,GV,kV],Object.getOwnPropertyDescriptor(HV.prototype,"sizeMode"),HV.prototype),VV=T(HV.prototype,"_spriteFrame",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),WV=T(HV.prototype,"_type",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return eW.SIMPLE}}),XV=T(HV.prototype,"_fillType",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return iW.HORIZONTAL}}),jV=T(HV.prototype,"_sizeMode",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return nW.TRIMMED}}),YV=T(HV.prototype,"_fillCenter",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new _n(0,0)}}),KV=T(HV.prototype,"_fillStart",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),qV=T(HV.prototype,"_fillRange",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),QV=T(HV.prototype,"_isTrimmedMode",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),ZV=T(HV.prototype,"_useGrayscale",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),JV=T(HV.prototype,"_atlas",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),zV=HV))||zV)||zV)||zV)||zV));b.Sprite=PW;var DW,BW=new un,NW=new _n,MW=new un,LW=[];!function(t){t[t.GRAPHICS_RECT=0]="GRAPHICS_RECT",t[t.GRAPHICS_ELLIPSE=1]="GRAPHICS_ELLIPSE",t[t.GRAPHICS_STENCIL=2]="GRAPHICS_STENCIL",t[t.SPRITE_STENCIL=3]="SPRITE_STENCIL"}(DW||(DW={})),pe(DW);var FW=function(e){return t({Mask:e,MaskComponent:e}),e}((_W=_h("cc.Mask"),fW=xh(),dW=dh(110),pW=Ch(),mW=Kh(DW),gW=Mh(),vW=zh(),yW=Mh(),EW=Dh(),TW=Dh(),SW=Lh(),_W(AW=fW(AW=dW(AW=pW(AW=bh((xW=OW=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return E(e=t.call.apply(t,[this].concat(n))||this,"_type",bW,g(e)),E(e,"_inverted",CW,g(e)),E(e,"_segments",wW,g(e)),E(e,"_alphaThreshold",IW,g(e)),e._sprite=null,e._graphics=null,e._stencilStage=mG.DISABLED,e}c(e,t);var i=e.prototype;return i.onLoad=function(){this._changeRenderType()},i.onEnable=function(){this._changeRenderType(),this._updateGraphics(),this._enableRender(),this.node.on(aE.ANCHOR_CHANGED,this._nodeStateChange,this),this.node.on(aE.SIZE_CHANGED,this._nodeStateChange,this)},i.onRestore=function(){this._changeRenderType(),this._updateGraphics()},i.onDisable=function(){this._disableRender(),this.node.off(aE.ANCHOR_CHANGED,this._nodeStateChange,this),this.node.off(aE.SIZE_CHANGED,this._nodeStateChange,this)},i.onDestroy=function(){this._removeMaskNode()},i.isHit=function(t){var e=this.node._uiProps.uiTransformComp,i=e.contentSize,n=i.width,r=i.height,s=NW;this.node.getWorldMatrix(BW),un.invert(MW,BW),_n.transformMat4(s,t,MW);var a=e.anchorPoint;s.x+=a.x*n,s.y+=a.y*r;var o=!1;if(this.type===DW.GRAPHICS_RECT||this.type===DW.GRAPHICS_STENCIL||this.type===DW.SPRITE_STENCIL)o=s.x>=0&&s.y>=0&&s.x<=n&&s.y<=r;else if(this.type===DW.GRAPHICS_ELLIPSE){var u=n/2,h=r/2,l=s.x-.5*n,c=s.y-.5*r;o=l*l/(u*u)+c*c/(h*h)<1}return this._inverted&&(o=!o),o},i._nodeStateChange=function(){this._updateGraphics()},i._changeRenderType=function(){this._type!==DW.SPRITE_STENCIL?this._createGraphics():this._createSprite()},i._createSprite=function(){if(!this._sprite){var t=this._sprite=this.node.getComponent(PW);if(!t){var e=this.node;t=this._sprite=e.addComponent(PW)}t.color=Gi.WHITE.clone(),t.sizeMode=0}this._sprite.stencilStage=this.inverted?mG.ENTER_LEVEL_INVERTED:mG.ENTER_LEVEL,this._sprite.updateMaterial()},i._createGraphics=function(){if(!this._graphics){var t=this._graphics=this.node.getComponent(cW);if(!t){var e=this.node;t=this._graphics=e.addComponent(cW)}t.lineWidth=1;var i=Gi.WHITE.clone();i.a=0,t.fillColor=i}this._graphics.stencilStage=this.inverted?mG.ENTER_LEVEL_INVERTED:mG.ENTER_LEVEL},i._updateGraphics=function(){if(this._graphics&&(this._type===DW.GRAPHICS_RECT||this._type===DW.GRAPHICS_ELLIPSE)){var t=this.node._uiProps.uiTransformComp,e=this._graphics;e.clear();var i=t.contentSize,n=i.width,r=i.height,s=t.anchorPoint,a=-n*s.x,o=-r*s.y;if(this._type===DW.GRAPHICS_RECT)e.rect(a,o,n,r);else if(this._type===DW.GRAPHICS_ELLIPSE){for(var u=function(t,e,i){LW.length=0;for(var n=2*Math.PI/i,r=0;r<i;++r)LW.push(new ji(e.x*Math.cos(n*r)+t.x,e.y*Math.sin(n*r)+t.y,0));return LW}(new ji(a+n/2,o+r/2,0),new ji(n/2,r/2,0),this._segments),h=0;h<u.length;++h){var l=u[h];0===h?e.moveTo(l.x,l.y):e.lineTo(l.x,l.y)}e.close()}e.fill()}},i._enableRender=function(){this.subComp&&(this.subComp.enabled=!0)},i._disableRender=function(){this.subComp&&(this.subComp.stencilStage=mG.DISABLED,this.subComp.updateMaterial(),this.node.activeInHierarchy&&(this.subComp.enabled=!1))},i._removeMaskNode=function(){this._sprite&&(this._sprite.destroy(),this._sprite=null),this._graphics&&(this._graphics.destroy(),this._graphics=null)},i.markForUpdateRenderData=function(t){void 0===t&&(t=!0),j(9007),this.subComp&&this.subComp.markForUpdateRenderData(t)},i.requestRenderData=function(){j(9007)},i.destroyRenderData=function(){j(9007)},i.updateRenderer=function(){j(9007),this.subComp&&this.subComp.updateRenderer()},i.fillBuffers=function(){j(9007)},i.postUpdateAssembler=function(){j(9007)},i.setNodeDirty=function(){j(9007),this.subComp&&this.subComp.setNodeDirty()},i.setTextureDirty=function(){j(9007),this.subComp&&this.subComp.setTextureDirty()},i.getMaterial=function(t){return j(9007),this.subComp?this.subComp.getMaterial(t):null},i.setMaterial=function(t,e){j(9007),this.subComp&&this.subComp.setMaterial(t,e)},i.getMaterialInstance=function(t){return j(9007),this.subComp?this.subComp.getMaterialInstance(t):null},i.setMaterialInstance=function(t,e){j(9007),this.subComp&&this.subComp.setMaterialInstance(t,e)},i.getRenderMaterial=function(t){return j(9007),this.subComp?this.subComp.getRenderMaterial(t):null},h(e,[{key:"type",get:function(){return this._type},set:function(t){this._type!==t&&(this._type=t,this._type!==DW.SPRITE_STENCIL?(this._sprite&&(this.node.removeComponent(PW),this._sprite._destroyImmediate(),this._sprite=null),this._changeRenderType(),this._updateGraphics()):(this._graphics&&(this._graphics.clear(),this.node.removeComponent(cW),this._graphics._destroyImmediate(),this._graphics=null),this._changeRenderType()))}},{key:"inverted",get:function(){return this._inverted},set:function(t){this._inverted=t,this.subComp.stencilStage=this.inverted?mG.ENTER_LEVEL_INVERTED:mG.ENTER_LEVEL}},{key:"segments",get:function(){return this._segments},set:function(t){this._segments!==t&&(this._segments=vi(t,3,1e4),this._updateGraphics())}},{key:"spriteFrame",get:function(){return this._sprite?this._sprite.spriteFrame:null},set:function(t){this._sprite?this._sprite.spriteFrame=t:console.error("please change type to sprite_stencil first")}},{key:"alphaThreshold",get:function(){return this._alphaThreshold},set:function(t){this._alphaThreshold!==t&&(this._alphaThreshold=t,this.type===DW.SPRITE_STENCIL&&this._sprite&&this._sprite.getMaterialInstance(0).setProperty("alphaThreshold",this._alphaThreshold))}},{key:"subComp",get:function(){return this._graphics||this._sprite}},{key:"customMaterial",get:function(){return j(9007),this.subComp?this.subComp.customMaterial:null},set:function(t){j(9007),this.subComp&&(this.subComp.customMaterial=t)}},{key:"color",get:function(){return j(9007),this.subComp?this.subComp.color:null},set:function(t){j(9007),this.subComp&&t&&(this.subComp.color=t)}},{key:"sharedMaterial",get:function(){return j(9007),this.subComp?this.subComp.sharedMaterial:null}},{key:"sharedMaterials",get:function(){return j(9007),this.subComp?this.subComp.sharedMaterials:null},set:function(t){j(9007),this.subComp&&t&&(this.subComp.sharedMaterials=t)}},{key:"material",get:function(){return j(9007),this.subComp?this.subComp.material:null},set:function(t){j(9007),this.subComp&&(this.subComp.material=t)}},{key:"materials",get:function(){return j(9007),this.subComp?this.subComp.materials:[null]},set:function(t){j(9007),this.subComp&&(this.subComp.materials=t)}}]),e}(bc),OW.Type=DW,T((RW=xW).prototype,"type",[mW,gW],Object.getOwnPropertyDescriptor(RW.prototype,"type"),RW.prototype),T(RW.prototype,"inverted",[vW,yW],Object.getOwnPropertyDescriptor(RW.prototype,"inverted"),RW.prototype),T(RW.prototype,"segments",[EW],Object.getOwnPropertyDescriptor(RW.prototype,"segments"),RW.prototype),T(RW.prototype,"alphaThreshold",[TW,SW,kh],Object.getOwnPropertyDescriptor(RW.prototype,"alphaThreshold"),RW.prototype),bW=T(RW.prototype,"_type",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return DW.GRAPHICS_RECT}}),CW=T(RW.prototype,"_inverted",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),wW=T(RW.prototype,"_segments",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 64}}),IW=T(RW.prototype,"_alphaThreshold",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return.1}}),AW=RW))||AW)||AW)||AW)||AW)||AW));CA._maskComp=FW,b.Mask=FW;var UW,GW,kW,zW,HW,VW,WW,XW,jW,YW,KW,qW,QW,ZW=/^(click)(\s)*=|(param)(\s)*=/,JW=/(\s)*src(\s)*=|(\s)*height(\s)*=|(\s)*width(\s)*=|(\s)*align(\s)*=|(\s)*offset(\s)*=|(\s)*click(\s)*=|(\s)*param(\s)*=/,$W=t("HtmlTextParser",function(){function t(){this._specialSymbolArray=[],this._stack=[],this._resultObjectArray=[],this._specialSymbolArray.push([/</g,"<"]),this._specialSymbolArray.push([/>/g,">"]),this._specialSymbolArray.push([/&/g,"&"]),this._specialSymbolArray.push([/"/g,'"']),this._specialSymbolArray.push([/'/g,"'"])}var e=t.prototype;return e.parse=function(t){this._resultObjectArray.length=0,this._stack.length=0;for(var e=0,i=t.length;e<i;){var n=t.indexOf(">",e),r=-1;if(n>=0&&(r=t.lastIndexOf("<",n))<e-1&&(r=t.indexOf("<",n+1),n=t.indexOf(">",r+1)),r<0)this._stack.pop(),this._processResult(t.substring(e)),e=i;else{var s=t.substring(e,r),a=t.substring(r+1,n);""===a&&(s=t.substring(e,n+1)),this._processResult(s),-1===n?n=r:"/"===t.charAt(r+1)?this._stack.pop():this._addToStack(a),e=n+1}}return this._resultObjectArray},e._attributeToObject=function(t){t=t.trim();var e={},i=/^(color|size)(\s)*=/.exec(t),n="",r=0,s="";if(i){if(n=i[0],""===(t=t.substring(n.length).trim()))return e;switch(r=t.indexOf(" "),n[0]){case"c":e.color=r>-1?t.substring(0,r).trim():t;break;case"s":e.size=parseInt(t)}return r>-1&&(s=t.substring(r+1).trim(),e.event=this._processEventHandler(s)),e}if((i=/^(br(\s)*\/)/.exec(t))&&i[0].length>0&&(n=i[0].trim()).startsWith("br")&&"/"===n[n.length-1])return e.isNewLine=!0,this._resultObjectArray.push({text:"",style:{isNewLine:!0}}),e;var a="",o=-1;if((i=/^(img(\s)*src(\s)*=[^>]+\/)/.exec(t))&&i[0].length>0&&(n=i[0].trim()).startsWith("img")&&"/"===n[n.length-1]){var u;i=JW.exec(t);for(var h=!1;i;){var l=(n=(t=t.substring(t.indexOf(i[0]))).substr(0,i[0].length)).length;if(n=(n=n.replace(/[^a-zA-Z]/g,"").trim()).toLowerCase(),a=t.substring(l).trim(),o="src"===n?this.getRightQuotationIndex(a):-1,u=(r=a.indexOf(" ",o+1>=a.length?-1:o+1))>-1?a.substr(0,r):a,t=a.substring(r).trim(),u.endsWith("/")&&(u=u.slice(0,-1)),"src"===n){switch(u.charCodeAt(0)){case 34:case 39:h=!0,u=u.slice(1,-1)}e.isImage=!0,e.src=u}else if("height"===n)e.imageHeight=parseInt(u);else if("width"===n)e.imageWidth=parseInt(u);else if("align"===n){switch(u.charCodeAt(0)){case 34:case 39:u=u.slice(1,-1)}e.imageAlign=u.toLowerCase()}else"offset"===n?e.imageOffset=u:"click"===n&&(e.event=this._processEventHandler(n+"="+u));e.event&&"param"===n&&(e.event[n]=u.replace(/^"|"$/g,"")),i=JW.exec(t)}return h&&e.isImage&&this._resultObjectArray.push({text:"",style:e}),{}}if(i=/^(outline(\s)*[^>]*)/.exec(t)){var c={color:"#ffffff",width:1};if(t=i[0].substring("outline".length).trim()){var _,f=/(\s)*color(\s)*=|(\s)*width(\s)*=|(\s)*click(\s)*=|(\s)*param(\s)*=/;for(i=f.exec(t);i;)n=(t=t.substring(t.indexOf(i[0]))).substr(0,i[0].length),_=(r=(a=t.substring(n.length).trim()).indexOf(" "))>-1?a.substr(0,r):a,n=(n=n.replace(/[^a-zA-Z]/g,"").trim()).toLowerCase(),t=a.substring(r).trim(),"click"===n?e.event=this._processEventHandler(n+"="+_):"color"===n?c.color=_:"width"===n&&(c.width=parseInt(_)),e.event&&"param"===n&&(e.event[n]=_.replace(/^"|"$/g,"")),i=f.exec(t)}e.outline=c}if((i=/^(on|u|b|i)(\s)*/.exec(t))&&i[0].length>0){switch(n=i[0],t=t.substring(n.length).trim(),n[0]){case"u":e.underline=!0;break;case"i":e.italic=!0;break;case"b":e.bold=!0}if(""===t)return e;e.event=this._processEventHandler(t)}return e},e.getRightQuotationIndex=function(t){var e=-1,i=-1,n=t.indexOf("'"),r=t.indexOf('"'),s=r>-1&&(r<n||-1===n);return n>-1&&(n<r||-1===r)?(e=n,i=t.indexOf("'",e+1>=t.length?-1:e+1)):s&&(e=r,i=t.indexOf('"',e+1>=t.length?-1:e+1)),i},e._processEventHandler=function(t){for(var e={},i=0,n=!1,r=ZW.exec(t);r;){var s=r[0],a="";if(n=!1,'"'===(t=t.substring(s.length).trim()).charAt(0))(i=t.indexOf('"',1))>-1&&(a=t.substring(1,i).trim(),n=!0),i++;else if("'"===t.charAt(0))(i=t.indexOf("'",1))>-1&&(a=t.substring(1,i).trim(),n=!0),i++;else{var o=/(\S)+/.exec(t);i=(a=o?o[0]:"").length}n&&(e[s=s.substring(0,s.length-1).trim()]=a),t=t.substring(i).trim(),r=ZW.exec(t)}return e},e._addToStack=function(t){var e=this._attributeToObject(t);if(0===this._stack.length)this._stack.push(e);else{if(e.isNewLine||e.isImage)return;var i=this._stack[this._stack.length-1];for(var n in i)e[n]||(e[n]=i[n]);this._stack.push(e)}},e._processResult=function(t){0!==t.length&&(t=this._escapeSpecialSymbol(t),this._stack.length>0?this._resultObjectArray.push({text:t,style:this._stack[this._stack.length-1]}):this._resultObjectArray.push({text:t}))},e._escapeSpecialSymbol=function(t){for(var e,i=y(this._specialSymbolArray);!(e=i()).done;){var n=e.value,r=n[0],s=n[1];t=t.replace(r,s)}return t},t}()),tX=function(e){return t({LabelOutline:e,LabelOutlineComponent:e}),e}((UW=_h("cc.LabelOutline"),GW=xh(),kW=dh(110),zW=Ch(),HW=fh(zz),VW=Mh(),WW=Mh(),UW(XW=GW(XW=kW(XW=zW(XW=HW(XW=bh((qW=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return E(e=t.call.apply(t,[this].concat(n))||this,"_color",YW,g(e)),E(e,"_width",KW,g(e)),e}c(e,t);var i=e.prototype;return i.onEnable=function(){this._updateRenderData()},i.onDisable=function(){this._updateRenderData()},i._updateRenderData=function(){var t=this.node.getComponent(zz);t&&t.updateRenderData(!0)},h(e,[{key:"color",get:function(){return this._color},set:function(t){this._color!==t&&(this._color.set(t),this._updateRenderData())}},{key:"width",get:function(){return this._width},set:function(t){this._width!==t&&(this._width=t,this._updateRenderData())}}]),e}(bc),YW=T((jW=qW).prototype,"_color",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new Gi(0,0,0,255)}}),KW=T(jW.prototype,"_width",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 2}}),T(jW.prototype,"color",[VW],Object.getOwnPropertyDescriptor(jW.prototype,"color"),jW.prototype),T(jW.prototype,"width",[WW],Object.getOwnPropertyDescriptor(jW.prototype,"width"),jW.prototype),XW=jW))||XW)||XW)||XW)||XW)||XW)||XW));b.LabelOutline=tX,ft({RenderComponent:{newName:"UIRenderer",since:"1.2.0",removed:!0},UITransformComponent:{newName:"UITransform",since:"1.2.0",removed:!1},CanvasComponent:{newName:"Canvas",since:"1.2.0",removed:!1}}),ft({UIRenderable:{newName:"UIRenderer",since:"3.0.0",removed:!0}}),ft({Renderable2D:{newName:"UIRenderer",since:"3.6.0",removed:!0}});var eX,iX,nX,rX,sX,aX,oX,uX,hX,lX,cX,_X,fX,dX,pX,mX,gX,vX,yX,EX,TX,SX,AX,RX,bX,CX,wX,IX,OX=t("RenderRoot2D",_h("cc.RenderRoot2D")(QW=dh(100)(QW=Ch()(QW=fh(Ak)(QW=ph(QW=bh(QW=function(t){function e(){return t.apply(this,arguments)||this}c(e,t);var i=e.prototype;return i.onEnable=function(){b.director.root.batcher2D.addScreen(this)},i.onDisable=function(){b.director.root.batcher2D.removeScreen(this)},i.onDestroy=function(){b.director.root.batcher2D.removeScreen(this)},e}(bc))||QW)||QW)||QW)||QW)||QW)||QW),xX=new ji,PX=_e({OVERLAY:0,INTERSPERSE:1}),DX=function(e){return t({Canvas:e,CanvasComponent:e}),e}((eX=_h("cc.Canvas"),iX=xh(),nX=dh(100),rX=Ch(),sX=Kh(HS),aX=Mh(),oX=Mh(),uX=Kh(HS),eX(hX=iX(hX=nX(hX=rX(hX=bh(hX=ph((T((lX=function(t){function e(){var e;return E(e=t.call(this)||this,"_cameraComponent",cX,g(e)),E(e,"_alignCanvasWithScreen",_X,g(e)),e._thisOnCameraResized=void 0,e._fitDesignResolution=void 0,e._pos=new ji,e._renderMode=PX.OVERLAY,e._thisOnCameraResized=e._onResizeCamera.bind(g(e)),e}c(e,t);var i=e.prototype;return i.__preload=function(){var t=this.getComponent("cc.Widget");t&&t.updateAlignment(),this._cameraComponent&&(this._cameraComponent._createCamera(),this._cameraComponent.node.on(HS.TARGET_TEXTURE_CHANGE,this._thisOnCameraResized)),this._onResizeCamera(),this.node.on(aE.TRANSFORM_CHANGED,this._thisOnCameraResized)},i.onEnable=function(){t.prototype.onEnable.call(this),this._cameraComponent&&this._cameraComponent.node.on(HS.TARGET_TEXTURE_CHANGE,this._thisOnCameraResized)},i.onDisable=function(){t.prototype.onDisable.call(this),this._cameraComponent&&this._cameraComponent.node.off(HS.TARGET_TEXTURE_CHANGE,this._thisOnCameraResized)},i.onDestroy=function(){t.prototype.onDestroy.call(this),this.node.off(aE.TRANSFORM_CHANGED,this._thisOnCameraResized)},i._onResizeCamera=function(){if(this._cameraComponent&&this._alignCanvasWithScreen){if(this._cameraComponent.targetTexture)this._cameraComponent.orthoHeight=NL.height/2;else{var t=Ya.windowSize;this._cameraComponent.orthoHeight=t.height/zL.getScaleY()/2}this.node.getWorldPosition(xX),this._cameraComponent.node.setWorldPosition(xX.x,xX.y,1e3)}},i._getViewPriority=function(){if(this._cameraComponent){var t,e=null===(t=this.cameraComponent)||void 0===t?void 0:t.priority;return this._renderMode===PX.OVERLAY?e|1<<30:e&~(1<<30)}return 0},h(e,[{key:"renderMode",get:function(){return this._renderMode},set:function(t){this._renderMode=t,this._cameraComponent&&(this._cameraComponent.priority=this._getViewPriority())}},{key:"cameraComponent",get:function(){return this._cameraComponent},set:function(t){this._cameraComponent!==t&&(this._cameraComponent=t,this._onResizeCamera())}},{key:"alignCanvasWithScreen",get:function(){return this._alignCanvasWithScreen},set:function(t){this._alignCanvasWithScreen=t,this._onResizeCamera()}}]),e}(OX)).prototype,"cameraComponent",[sX,aX],Object.getOwnPropertyDescriptor(lX.prototype,"cameraComponent"),lX.prototype),T(lX.prototype,"alignCanvasWithScreen",[oX],Object.getOwnPropertyDescriptor(lX.prototype,"alignCanvasWithScreen"),lX.prototype),cX=T(lX.prototype,"_cameraComponent",[uX],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),_X=T(lX.prototype,"_alignCanvasWithScreen",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),hX=lX))||hX)||hX)||hX)||hX)||hX)||hX));b.Canvas=DX,it(t("UIComponent",_h("cc.UIComponent")(fX=fh(Ak)(fX=dh(110)(fX=ph(fX=bh(fX=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._lastParent=null,e.stencilStage=mG.DISABLED,e}c(e,t);var i=e.prototype;return i.__preload=function(){this.node._uiProps.uiComp=this},i.onEnable=function(){},i.onDisable=function(){},i.onDestroy=function(){this.node._uiProps.uiComp===this&&(this.node._uiProps.uiComp=null)},i.postUpdateAssembler=function(){},i.markForUpdateRenderData=function(){},i.setNodeDirty=function(){},i.setTextureDirty=function(){},e}(bc))||fX)||fX)||fX)||fX)||fX).prototype,"UIComponent",[{name:"_visibility"},{name:"setVisibility"}]),it(kz.prototype,"Renderable2D.prototype",[{name:"srcBlendFactor"},{name:"dstBlendFactor"}]),et(DX.prototype,"Canvas.prototype",[{name:"camera",newName:"cameraComponent.camera",customGetter:function(){return this._cameraComponent.camera}},{name:"clearFlag",newName:"cameraComponent.clearFlags",customGetter:function(){return this._cameraComponent?this._cameraComponent.clearFlags:0},customSetter:function(t){this._cameraComponent&&(this._cameraComponent.clearFlags=t)}},{name:"color",newName:"cameraComponent.clearColor",customGetter:function(){return this._cameraComponent?this._cameraComponent.clearColor:Gi.BLACK},customSetter:function(t){this._cameraComponent&&(this._cameraComponent.clearColor=t)}},{name:"priority",newName:"cameraComponent.priority",customGetter:function(){return this._cameraComponent?this._cameraComponent.priority:0},customSetter:function(t){this._cameraComponent&&(this._cameraComponent.priority=t)}},{name:"targetTexture",newName:"cameraComponent.targetTexture",customGetter:function(){return this._cameraComponent?this._cameraComponent.targetTexture:null},customSetter:function(t){this._cameraComponent&&(this._cameraComponent.targetTexture=t)}},{name:"visibility",newName:"cameraComponent.visibility",customGetter:function(){return this._cameraComponent?this._cameraComponent.visibility:0}}]),nt(Ak.prototype,"UITransform.prototype",[{name:"priority",suggest:"Please use setSiblingIndex to change index of the current node in its parent's children array."}]),b.UITransformComponent=Ak,le.setClassAlias(Ak,"cc.UITransformComponent"),le.setClassAlias(kz,"cc.RenderComponent"),b.CanvasComponent=DX,le.setClassAlias(DX,"cc.CanvasComponent"),b.internal.Renderable2D=kz,le.setClassAlias(kz,"cc.Renderable2D"),function(t){t[t.SIMPLE=0]="SIMPLE",t[t.SLICED=1]="SLICED",t[t.TILED=2]="TILED"}(IX||(IX={})),t("SpriteRenderer",(dX=_h("cc.SpriteRenderer"),pX=xh(),mX=dh(100),gX=Ch(),vX=Kh(hU),yX=Dh(),dX(EX=pX(EX=mX(EX=gX(EX=bh((T((TX=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return E(e=t.call.apply(t,[this].concat(n))||this,"_spriteFrame",SX,g(e)),E(e,"_mode",AX,g(e)),E(e,"_color",RX,g(e)),E(e,"_flipX",bX,g(e)),E(e,"_flipY",CX,g(e)),E(e,"_size",wX,g(e)),e._model=null,e}c(e,t);var i=e.prototype;return i.onLoad=function(){this._spriteFrame&&(this._spriteFrame.mesh||this._spriteFrame.ensureMeshData(),this._spriteFrame.mesh.initialize()),this._updateModels()},i.onRestore=function(){this._updateModels(),this.enabledInHierarchy&&this._attachToScene()},i.onEnable=function(){this._model||this._updateModels(),this._attachToScene()},i.onDisable=function(){this._model&&this._detachFromScene()},i.onDestroy=function(){this._model&&(b.director.root.destroyModel(this._model),this._model=null,this._models.length=0)},i._updateModels=function(){if(this._spriteFrame){var t=this._model;if(t?(t.destroy(),t.initialize(),t.node=t.transform=this.node):this._createModel(),this._model){var e=this._spriteFrame.mesh;this._model.createBoundingShape(e.struct.minPosition,e.struct.maxPosition),this._updateModelParams(),this._onUpdateLocalDescriptorSet()}}},i._createModel=function(){var t=this._model=b.director.root.createModel(mB);t.visFlags=this.visibility,t.node=t.transform=this.node,this._models.length=0,this._models.push(this._model)},i._updateModelParams=function(){if(this._spriteFrame&&this._model){this._spriteFrame.ensureMeshData();var t=this._spriteFrame.mesh;this.node.hasChangedFlags|=AE.POSITION,this._model.transform.hasChangedFlags|=AE.POSITION;var e=t?t.renderingSubMeshes.length:0,i=t.renderingSubMeshes;if(i)for(var n=0;n<e;++n){var r=this.getRenderMaterial(n);r&&!r.isValid&&(r=null);var s=i[n];s&&this._model.initSubModel(n,s,r||this._getBuiltinMaterial())}this._model.enabled=!0}},i._getBuiltinMaterial=function(){return vy.get("missing-material")},i._onMaterialModified=function(e,i){t.prototype._onMaterialModified.call(this,e,i),this._spriteFrame&&this._model&&this._model.inited&&this._onRebuildPSO(e,i||this._getBuiltinMaterial())},i._onRebuildPSO=function(t,e){this._model&&this._model.inited&&(this._model.setSubModelMaterial(t,e),this._onUpdateLocalDescriptorSet())},i._onUpdateLocalDescriptorSet=function(){if(this._spriteFrame&&this._model&&this._model.inited)for(var t=this._spriteFrame.getGFXTexture(),e=this._spriteFrame.getGFXSampler(),i=this._model.subModels,n=op.SAMPLER_SPRITE,r=0;r<i.length;r++){var s=i[r].descriptorSet;s.bindTexture(n,t),s.bindSampler(n,e),s.update()}},i._attachToScene=function(){if(this.node.scene&&this._model){var t=this._getRenderScene();null!==this._model.scene&&this._detachFromScene(),t.addModel(this._model)}},i._detachFromScene=function(){this._model&&this._model.scene&&this._model.scene.removeModel(this._model)},h(e,[{key:"spriteFrame",get:function(){return this._spriteFrame},set:function(t){this._spriteFrame!==t&&(this._spriteFrame,this._spriteFrame=t,this._spriteFrame&&(this._spriteFrame.ensureMeshData(),this._spriteFrame.mesh.initialize()),this._updateModels(),this.enabledInHierarchy&&this._attachToScene())}},{key:"model",get:function(){return this._model}}]),e}(sA)).prototype,"spriteFrame",[vX],Object.getOwnPropertyDescriptor(TX.prototype,"spriteFrame"),TX.prototype),SX=T(TX.prototype,"_spriteFrame",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),AX=T(TX.prototype,"_mode",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return IX.SIMPLE}}),RX=T(TX.prototype,"_color",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Gi.WHITE.clone()}}),bX=T(TX.prototype,"_flipX",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),CX=T(TX.prototype,"_flipY",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),wX=T(TX.prototype,"_size",[yX,Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new _n}}),EX=TX))||EX)||EX)||EX)||EX)||EX));var BX,NX,MX,LX,FX,UX,GX,kX,zX,HX,VX,WX,XX,jX,YX,KX,qX,QX,ZX,JX,$X,tj,ej,ij,nj,rj,sj,aj,oj,uj,hj,lj,cj,_j,fj,dj,pj,mj,gj,vj=new $W,yj="RICHTEXT_CHILD",Ej="RICHTEXT_Image_CHILD",Tj=new ue((function(t){if(!b.isValid(t.node))return!1;var e=t.node.getComponent(tX);return e&&(e.width=0),!0}),20),Sj=new ue((function(t){return b.isValid(t.node)}),10);function Aj(t){return{node:new jE(t),comp:null,lineCount:0,styleIndex:0,imageOffset:"",clickParam:"",clickHandler:"",type:t}}function Rj(t,e){var i;t===yj?i=Tj._get():t===Ej&&(i=Sj._get());var n=(i=i||Aj(t)).node;return n||(n=new jE(t)),n.hideFlags|=Ta.Flags.DontSave|Ta.Flags.HideInHierarchy,t===Ej?(i.comp=n.getComponent(PW)||n.addComponent(PW),i.comp.spriteFrame=e,i.comp.type=PW.Type.SLICED,i.comp.sizeMode=PW.SizeMode.CUSTOM):(i.comp=n.getComponent(zz)||n.addComponent(zz),i.comp.string=e,i.comp.horizontalAlign=Lz.LEFT,i.comp.verticalAlign=Fz.TOP,i.comp.underlineHeight=2),n.setPosition(0,0,0),n._uiProps.uiTransformComp.setAnchorPoint(.5,.5),i.node=n,i.lineCount=0,i.styleIndex=0,i.imageOffset="",i.clickParam="",i.clickHandler="",i}var bj,Cj=function(e){return t({RichText:e,RichTextComponent:e}),e}((BX=_h("cc.RichText"),NX=xh(),MX=dh(110),LX=Ch(),FX=Mh(),UX=Kh(Lz),GX=Mh(),kX=Kh(Fz),zX=Mh(),HX=Mh(),VX=Mh(),WX=Kh(mU),XX=Mh(),jX=Mh(),YX=zh(),KX=Kh(Gz),qX=Mh(),QX=Mh(),ZX=Mh(),JX=Kh(cU),$X=Mh(),tj=Mh(),BX(ej=NX(ej=MX(ej=LX(ej=bh((gj=mj=function(t){function e(){var e;return E(e=t.call(this)||this,"_lineHeight",nj,g(e)),E(e,"_string",rj,g(e)),E(e,"_horizontalAlign",sj,g(e)),E(e,"_verticalAlign",aj,g(e)),E(e,"_fontSize",oj,g(e)),E(e,"_maxWidth",uj,g(e)),E(e,"_fontFamily",hj,g(e)),E(e,"_font",lj,g(e)),E(e,"_isSystemFontUsed",cj,g(e)),E(e,"_userDefinedFont",_j,g(e)),E(e,"_cacheMode",fj,g(e)),E(e,"_imageAtlas",dj,g(e)),E(e,"_handleTouchEvent",pj,g(e)),e._textArray=[],e._segments=[],e._labelSegmentsCache=[],e._linesWidth=[],e._lineCount=1,e._labelWidth=0,e._labelHeight=0,e._layoutDirty=!0,e._lineOffsetX=0,e._updateRichTextStatus=void 0,e._labelChildrenNum=0,e._updateRichTextStatus=e._updateRichText,e}c(e,t);var i=e.prototype;return i.onLoad=function(){this.node.on(aE.LAYER_CHANGED,this._applyLayer,this),this.node.on(aE.ANCHOR_CHANGED,this._updateRichTextPosition,this)},i.onEnable=function(){this.handleTouchEvent&&this._addEventListeners(),this._updateRichText(),this._activateChildren(!0)},i.onDisable=function(){this.handleTouchEvent&&this._removeEventListeners(),this._activateChildren(!1)},i.onRestore=function(){},i.onDestroy=function(){for(var t,e=y(this._segments);!(t=e()).done;){var i=t.value;i.node.removeFromParent(),i.type===yj?Tj.put(i):i.type===Ej&&Sj.put(i)}this.node.off(aE.ANCHOR_CHANGED,this._updateRichTextPosition,this),this.node.off(aE.LAYER_CHANGED,this._applyLayer,this)},i._addEventListeners=function(){this.node.on(aE.TOUCH_END,this._onTouchEnded,this)},i._removeEventListeners=function(){this.node.off(aE.TOUCH_END,this._onTouchEnded,this)},i._updateLabelSegmentTextAttributes=function(){var t=this;this._segments.forEach((function(e){t._applyTextAttribute(e)}))},i._createFontLabel=function(t){return Rj(yj,t)},i._createImage=function(t){return Rj(Ej,t)},i._onTTFLoaded=function(){this._font,this._layoutDirty=!0,this._updateRichText()},i.SplitLongStringApproximatelyIn2048=function(t,e){var i=[];if(this._calculateSize(e,t).x<2048)i.push(t);else for(var n=t.split("\n"),r=0;r<n.length;r++)if(this._calculateSize(e,n[r]).x<2048)i.push(n[r]);else{var s=this.splitLongStringOver2048(n[r],e);i.push.apply(i,s)}return i},i.splitLongStringOver2048=function(t,e){for(var i=[],n=t,r=0,s=n.length/2,a=n.substring(r,s),o=n.substring(s),u=this._calculateSize(e,a),h=(this._calculateSize(e,o),1*this.maxWidth);u.x>h;){if((s/=2)<1){s*=2;break}a=a.substring(r,s),o=n.substring(s),u=this._calculateSize(e,a)}for(var l=1e3,c=1;l&&r<t.length;){for(;l&&u.x<h;){var _=jU(o);_&&_.length>0&&(c=_[0].length),s+=c,a=n.substring(r,s),o=n.substring(s),u=this._calculateSize(e,a),l--}for(;l&&a.length>=2&&u.x>h;)s-=c,a=n.substring(r,s),u=this._calculateSize(e,a),c=1,l--;if(a.length>=2){var f=YU(a);f&&f.length>0&&a!==f[0]&&(s-=f[0].length,a=n.substring(r,s))}if(i.push(a),r=s,s+=a.length,a=n.substring(r,s),o=n.substring(s),l--,this._calculateSize(e,o).x<2048){r=t.length,s=t.length,a=o,i.push(a);break}u=this._calculateSize(e,a)}return i},i._measureText=function(t,e){var i=this,n=function(e){return i._calculateSize(t,e).width};return e?n(e):n},i._calculateSize=function(t,e){var i;return 0===this._labelSegmentsCache.length?(i=this._createFontLabel(e),this._labelSegmentsCache.push(i)):(i=this._labelSegmentsCache[0]).node.getComponent(zz).string=e,i.styleIndex=t,this._applyTextAttribute(i),i.node._uiProps.uiTransformComp.contentSize},i._onTouchEnded=function(t){for(var e,i=this,n=this.node.getComponents(bc),r=function(){var r=e.value,s=r.clickHandler,a=r.clickParam;s&&i._containsTouchLocation(r,t.touch.getUILocation())&&(n.forEach((function(e){var i=e[s];e.enabledInHierarchy&&i&&i.call(e,t,a)})),t.propagationStopped=!0)},s=y(this._segments);!(e=s()).done;)r()},i._containsTouchLocation=function(t,e){var i=t.node.getComponent(Ak);return!!i&&i.getBoundingBoxToWorld().contains(e)},i._resetState=function(){for(var t=this.node.children,e=t.length-1;e>=0;e--){var i=t[e];if(i.name===yj||i.name===Ej){i.parent=null;var n=Aj(i.name);n.node=i,i.name===yj?(n.comp=i.getComponent(zz),Tj.put(n)):(n.comp=i.getComponent(PW),Sj.put(n)),this._labelChildrenNum--}}this._segments.length=0,this._labelSegmentsCache.length=0,this._linesWidth.length=0,this._lineOffsetX=0,this._lineCount=1,this._labelWidth=0,this._labelHeight=0,this._layoutDirty=!0},i._activateChildren=function(t){for(var e=this.node.children.length-1;e>=0;e--){var i=this.node.children[e];i.name!==yj&&i.name!==Ej||(i.active=t)}},i._addLabelSegment=function(t,e){var i;if(0===this._labelSegmentsCache.length)i=this._createFontLabel(t);else{var n=(i=this._labelSegmentsCache.pop()).node.getComponent(zz);n&&(n.string=t)}var r=i.comp;return r.verticalAlign!==this._verticalAlign&&(r.verticalAlign=this._verticalAlign),i.styleIndex=e,i.lineCount=this._lineCount,i.node._uiProps.uiTransformComp.setAnchorPoint(0,0),i.node.layer=this.node.layer,this.node.insertChild(i.node,this._labelChildrenNum++),this._applyTextAttribute(i),this._segments.push(i),i},i._updateRichTextWithMaxWidth=function(t,e,i){var n=e;if(this._lineOffsetX>0&&n+this._lineOffsetX>this._maxWidth)for(var r=0;this._lineOffsetX<=this._maxWidth;){var s=this._getFirstWordLen(t,r,t.length),a=t.substr(r,s),o=this._measureText(i,a);if(!(this._lineOffsetX+o<=this._maxWidth)){if(r>0){var u=t.substr(0,r);this._addLabelSegment(u,i),t=t.substr(r,t.length),n=this._measureText(i,t)}this._updateLineInfo();break}this._lineOffsetX+=o,r+=s}if(n>this._maxWidth)for(var h=KU(t,n,this._maxWidth,this._measureText(i)),l=0;l<h.length;++l){var c=h[l],_=this._addLabelSegment(c,i).node._uiProps.uiTransformComp.contentSize;this._lineOffsetX+=_.width,h.length>1&&l<h.length-1&&this._updateLineInfo()}else this._lineOffsetX+=n,this._addLabelSegment(t,i)},i._isLastComponentCR=function(t){return t.length-1===t.lastIndexOf("\n")},i._updateLineInfo=function(){this._linesWidth.push(this._lineOffsetX),this._lineOffsetX=0,this._lineCount++},i._needsUpdateTextLayout=function(t){if(this._layoutDirty||!this._textArray||!t)return!0;if(this._textArray.length!==t.length)return!0;for(var e=0;e<this._textArray.length;e++){var i=this._textArray[e],n=t[e];if(i.text!==n.text)return!0;var r=i.style,s=n.style;if(r){if(s){if(!!s.outline!=!!r.outline)return!0;if(r.size!==s.size||r.italic!==s.italic||r.isImage!==s.isImage)return!0;if(r.src!==s.src||r.imageAlign!==s.imageAlign||r.imageHeight!==s.imageHeight||r.imageWidth!==s.imageWidth||r.imageOffset!==s.imageOffset)return!0}else if(r.size||r.italic||r.isImage||r.outline)return!0}else if(s&&(s.size||s.italic||s.isImage||s.outline))return!0}return!1},i._addRichTextImageElement=function(t){if(t.style){var e=t.style,i=e.src,n=this._imageAtlas&&i&&this._imageAtlas.getSpriteFrame(i);if(n){var r=this._createImage(n);switch(r.comp,e.imageAlign){case"top":r.node._uiProps.uiTransformComp.setAnchorPoint(0,1);break;case"center":r.node._uiProps.uiTransformComp.setAnchorPoint(0,.5);break;default:r.node._uiProps.uiTransformComp.setAnchorPoint(0,0)}e.imageOffset&&(r.imageOffset=e.imageOffset),r.node.layer=this.node.layer,this.node.insertChild(r.node,this._labelChildrenNum++),this._segments.push(r);var s=n.rect.clone(),a=1,o=s.width,u=s.height,h=e.imageWidth||0,l=e.imageHeight||0;l>0?(o*=a=l/u,u*=a):(o*=a=this._lineHeight/u,u*=a),h>0&&(o=h),this._maxWidth>0?(this._lineOffsetX+o>this._maxWidth&&this._updateLineInfo(),this._lineOffsetX+=o):(this._lineOffsetX+=o,this._lineOffsetX>this._labelWidth&&(this._labelWidth=this._lineOffsetX)),r.node._uiProps.uiTransformComp.setContentSize(o,u),r.lineCount=this._lineCount,r.clickHandler="",r.clickParam="";var c=e.event;c&&(r.clickHandler=c.click,r.clickParam=c.param)}else j(4400)}},i._updateRichText=function(){if(this.enabledInHierarchy){var t=vj.parse(this._string);if(!this._needsUpdateTextLayout(t))return this._textArray=t.slice(),void this._updateLabelSegmentTextAttributes();this._textArray=t.slice(),this._resetState();for(var e,i=!1,n=0;n<this._textArray.length;++n){var r=this._textArray[n],s=r.text;if(void 0!==s){if(""===s){if(r.style&&r.style.isNewLine){this._updateLineInfo();continue}if(r.style&&r.style.isImage&&this._imageAtlas){this._addRichTextImageElement(r);continue}}for(var a=(s=this.SplitLongStringApproximatelyIn2048(s,n).join("\n")).split("\n"),o=0;o<a.length;++o){var u=a[o];if(""!==u)if(i=!1,this._maxWidth>0){var h=this._measureText(n,u);this._updateRichTextWithMaxWidth(u,h,n),a.length>1&&o<a.length-1&&this._updateLineInfo()}else e=this._addLabelSegment(u,n),this._lineOffsetX+=e.node._uiProps.uiTransformComp.width,this._lineOffsetX>this._labelWidth&&(this._labelWidth=this._lineOffsetX),a.length>1&&o<a.length-1&&this._updateLineInfo();else{if(this._isLastComponentCR(s)&&o===a.length-1)continue;this._updateLineInfo(),i=!0}}}}i||this._linesWidth.push(this._lineOffsetX),this._maxWidth>0&&(this._labelWidth=this._maxWidth),this._labelHeight=(this._lineCount+DU)*this._lineHeight,this.node._uiProps.uiTransformComp.setContentSize(this._labelWidth,this._labelHeight),this._updateRichTextPosition(),this._layoutDirty=!1}},i._getFirstWordLen=function(t,e,i){var n=t.charAt(e);if(HU(n)||VU(n))return 1;for(var r=1,s=e+1;s<i&&!VU(n=t.charAt(s))&&!HU(n);++s)r++;return r},i._updateRichTextPosition=function(){for(var t=0,e=1,i=this._lineCount,n=this.node._uiProps.uiTransformComp,r=n.anchorX,s=n.anchorY,a=0;a<this._segments.length;++a){var o=this._segments[a],u=o.lineCount;u>e&&(t=0,e=u);var h=this._labelWidth*(.5*this._horizontalAlign-r);switch(this._horizontalAlign){case Lz.LEFT:break;case Lz.CENTER:h-=this._linesWidth[u-1]/2;break;case Lz.RIGHT:h-=this._linesWidth[u-1]}var l=o.node.position;if(o.node.setPosition(t+h,this._lineHeight*(i-u)-this._labelHeight*s,l.z),u===e&&(t+=o.node._uiProps.uiTransformComp.width),o.node.getComponent(PW)){var c=o.node.position.clone(),_=this._lineHeight,f=this._lineHeight*(1+DU);switch(o.node._uiProps.uiTransformComp.anchorY){case 1:c.y+=_+(f-_)/2;break;case.5:c.y+=f/2;break;default:c.y+=(f-_)/2}if(o.imageOffset){var d=o.imageOffset.split(",");if(1===d.length&&d[0]){var p=parseFloat(d[0]);Number.isInteger(p)&&(c.y+=p)}else if(2===d.length){var m=parseFloat(d[0]),g=parseFloat(d[1]);Number.isInteger(m)&&(c.x+=m),Number.isInteger(g)&&(c.y+=g)}}o.node.position=c}var v=o.node.getComponent(tX);if(v){var y=o.node.position.clone();y.y-=v.width,o.node.position=y}}},i._convertLiteralColorValue=function(t){var e=t.toUpperCase();return Gi[e]?Gi[e]:(new Gi).fromHEX(t)},i._applyTextAttribute=function(t){var e=t.node.getComponent(zz);if(e){this._resetLabelState(e);var i,n=t.styleIndex;if(this._textArray[n]&&(i=this._textArray[n].style),i){if(e.color=this._convertLiteralColorValue(i.color||"white"),e.isBold=!!i.bold,e.isItalic=!!i.italic,e.isUnderline=!!i.underline,i.outline){var r=t.node.getComponent(tX);r||(r=t.node.addComponent(tX)),r.color=this._convertLiteralColorValue(i.outline.color),r.width=i.outline.width}e.fontSize=i.size||this._fontSize,t.clickHandler="",t.clickParam="";var s=i.event;s&&(t.clickHandler=s.click||"",t.clickParam=s.param||"")}e.cacheMode=this._cacheMode,this._font instanceof mU&&!this._isSystemFontUsed?e.font=this._font:e.fontFamily=this._fontFamily,e.useSystemFont=this._isSystemFontUsed,e.lineHeight=this._lineHeight,e.updateRenderData(!0)}},i._applyLayer=function(){for(var t,e=y(this._segments);!(t=e()).done;)t.value.node.layer=this.node.layer},i._resetLabelState=function(t){t.fontSize=this._fontSize,t.color=Gi.WHITE,t.isBold=!1,t.isItalic=!1,t.isUnderline=!1},h(e,[{key:"string",get:function(){return this._string},set:function(t){this._string!==t&&(this._string=t,this._updateRichTextStatus())}},{key:"horizontalAlign",get:function(){return this._horizontalAlign},set:function(t){this.horizontalAlign!==t&&(this._horizontalAlign=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"verticalAlign",get:function(){return this._verticalAlign},set:function(t){this._verticalAlign!==t&&(this._verticalAlign=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"fontSize",get:function(){return this._fontSize},set:function(t){this._fontSize!==t&&(this._fontSize=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"fontFamily",get:function(){return this._fontFamily},set:function(t){this._fontFamily!==t&&(this._fontFamily=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"font",get:function(){return this._font},set:function(t){this._font!==t&&(this._font=t,this._layoutDirty=!0,this._font?(this.useSystemFont=!1,this._onTTFLoaded()):this.useSystemFont=!0,this._updateRichTextStatus())}},{key:"useSystemFont",get:function(){return this._isSystemFontUsed},set:function(t){this._isSystemFontUsed!==t&&(this._isSystemFontUsed=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"cacheMode",get:function(){return this._cacheMode},set:function(t){this._cacheMode!==t&&(this._cacheMode=t,this._updateRichTextStatus())}},{key:"maxWidth",get:function(){return this._maxWidth},set:function(t){this._maxWidth!==t&&(this._maxWidth=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"lineHeight",get:function(){return this._lineHeight},set:function(t){this._lineHeight!==t&&(this._lineHeight=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"imageAtlas",get:function(){return this._imageAtlas},set:function(t){this._imageAtlas!==t&&(this._imageAtlas=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"handleTouchEvent",get:function(){return this._handleTouchEvent},set:function(t){this._handleTouchEvent!==t&&(this._handleTouchEvent=t,this.enabledInHierarchy&&(this.handleTouchEvent?this._addEventListeners():this._removeEventListeners()))}}]),e}(bc),mj.HorizontalAlign=Lz,mj.VerticalAlign=Fz,T((ij=gj).prototype,"string",[Hh,FX],Object.getOwnPropertyDescriptor(ij.prototype,"string"),ij.prototype),T(ij.prototype,"horizontalAlign",[UX,GX],Object.getOwnPropertyDescriptor(ij.prototype,"horizontalAlign"),ij.prototype),T(ij.prototype,"verticalAlign",[kX,zX],Object.getOwnPropertyDescriptor(ij.prototype,"verticalAlign"),ij.prototype),T(ij.prototype,"fontSize",[HX],Object.getOwnPropertyDescriptor(ij.prototype,"fontSize"),ij.prototype),T(ij.prototype,"fontFamily",[VX],Object.getOwnPropertyDescriptor(ij.prototype,"fontFamily"),ij.prototype),T(ij.prototype,"font",[WX,XX],Object.getOwnPropertyDescriptor(ij.prototype,"font"),ij.prototype),T(ij.prototype,"useSystemFont",[jX,YX],Object.getOwnPropertyDescriptor(ij.prototype,"useSystemFont"),ij.prototype),T(ij.prototype,"cacheMode",[KX,qX],Object.getOwnPropertyDescriptor(ij.prototype,"cacheMode"),ij.prototype),T(ij.prototype,"maxWidth",[QX],Object.getOwnPropertyDescriptor(ij.prototype,"maxWidth"),ij.prototype),T(ij.prototype,"lineHeight",[ZX],Object.getOwnPropertyDescriptor(ij.prototype,"lineHeight"),ij.prototype),T(ij.prototype,"imageAtlas",[JX,$X],Object.getOwnPropertyDescriptor(ij.prototype,"imageAtlas"),ij.prototype),T(ij.prototype,"handleTouchEvent",[tj],Object.getOwnPropertyDescriptor(ij.prototype,"handleTouchEvent"),ij.prototype),nj=T(ij.prototype,"_lineHeight",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 40}}),rj=T(ij.prototype,"_string",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return"<color=#00ff00>Rich</color><color=#0fffff>Text</color>"}}),sj=T(ij.prototype,"_horizontalAlign",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Lz.LEFT}}),aj=T(ij.prototype,"_verticalAlign",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Fz.TOP}}),oj=T(ij.prototype,"_fontSize",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 40}}),uj=T(ij.prototype,"_maxWidth",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),hj=T(ij.prototype,"_fontFamily",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return"Arial"}}),lj=T(ij.prototype,"_font",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),cj=T(ij.prototype,"_isSystemFontUsed",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),_j=T(ij.prototype,"_userDefinedFont",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),fj=T(ij.prototype,"_cacheMode",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Gz.NONE}}),dj=T(ij.prototype,"_imageAtlas",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),pj=T(ij.prototype,"_handleTouchEvent",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),ej=ij))||ej)||ej)||ej)||ej)||ej));b.RichText=Cj;var wj=function(e){return t({UIMeshRenderer:e,UIModelComponent:e}),e}(_h("cc.UIMeshRenderer")(bj=xh()(bj=dh(110)(bj=Ch()(bj=bh(bj=function(t){function e(){var e;return(e=t.call(this)||this)._modelComponent=null,e.modelCount=0,e._dirtyVersion=-1,e._internalId=-1,e.stencilStage=mG.DISABLED,e._renderData=null,e._renderEntity=new hk(AG.DYNAMIC),e}c(e,t);var i=e.prototype;return i.__preload=function(){this.node._uiProps.uiComp=this},i.onEnable=function(){wL.addRenderer(this),this.markForUpdateRenderData()},i.onDisable=function(){wL.removeRenderer(this),this.renderEntity.enabled=this._canRender()},i.onLoad=function(){this.node._uiProps.uiTransformComp||this.node.addComponent("cc.UITransform"),this._modelComponent=this.getComponent("cc.ModelRenderer"),this._modelComponent?this.renderEntity.setNode(this.node):console.warn("node '"+(this.node&&this.node.name)+"' doesn't have any renderable component")},i.onDestroy=function(){this.renderEntity.setNode(null),this.node._uiProps.uiComp===this&&(this.node._uiProps.uiComp=null),this._modelComponent=this.getComponent("cc.ModelRenderer"),this._modelComponent&&(this._modelComponent._sceneGetter=null)},i._render=function(t){if(this._modelComponent){var e=this._modelComponent._collectModels();this._modelComponent._detachFromScene();for(var i=0;i<e.length;i++)e[i].enabled&&t.commitModel(this,e[i],this._modelComponent.material);return!0}return!1},i.fillBuffers=function(t){this.enabled&&this._render(t)},i.updateRenderer=function(){},i._uploadRenderData=function(){},i.postUpdateAssembler=function(){},i.update=function(){this._fitUIRenderQueue()},i._fitUIRenderQueue=function(){if(this._modelComponent)for(var t=this._modelComponent.sharedMaterials.length,e=0;e<t;e++){var i=this._modelComponent.getMaterialInstance(e);if(null!=i)for(var n=i.passes,r=n.length,s=0;s<r;s++)n[s]._priority=tp.MAX-11,i.recompileShaders({CC_FORCE_FORWARD_SHADING:!0},s)}},i.markForUpdateRenderData=function(){wL.markDirtyRenderer(this)},i.setNodeDirty=function(){},i.setTextureDirty=function(){},i._canRender=function(){return this.enabled&&null!==this._modelComponent},h(e,[{key:"modelComponent",get:function(){return this._modelComponent}},{key:"renderEntity",get:function(){return this._renderEntity}},{key:"renderData",get:function(){return this._renderData}}]),e}(bc))||bj)||bj)||bj)||bj)||bj);b.UIMeshRenderer=wj;var Ij,Oj,xj,Pj,Dj,Bj,Nj,Mj,Lj,Fj,Uj,Gj,kj,zj,Hj,Vj,Wj,Xj,jj,Yj,Kj,qj,Qj,Zj,Jj,$j,tY,eY,iY,nY=Jd.Enum.NONE|Jd.Enum.UI_3D,rY=function(){function t(){this.model=null,this.texture=null,this.sampler=null,this.useLocalData=null,this.isStatic=!1,this.textureHash=0,this.samplerHash=0,this._passes=[],this._shaders=[],this._visFlags=nY,this._inputAssembler=null,this._descriptorSet=null}var e=t.prototype;return e.destroy=function(){this._passes=[]},e.clear=function(){this._inputAssembler=null,this._descriptorSet=null,this.texture=null,this.sampler=null,this.textureHash=0,this.samplerHash=0,this.model=null,this.isStatic=!1,this.useLocalData=null,this.visFlags=nY},e.fillPasses=function(t,e,i,n){if(t){var r=t.passes;if(!r)return;this._shaders.length=r.length;for(var s=0;s<r.length;s++){this._passes[s]||(this._passes[s]=new by(b.director.root));var a=r[s],o=this._passes[s];a.update(),e||(e=a.depthStencilState,i=0),o._initPassFromTarget(a,e,i),this._shaders[s]=o.getShaderVariant(n)}}},h(t,[{key:"inputAssembler",get:function(){return this._inputAssembler},set:function(t){this._inputAssembler=t}},{key:"descriptorSet",get:function(){return this._descriptorSet},set:function(t){this._descriptorSet=t}},{key:"visFlags",get:function(){return this._visFlags},set:function(t){this._visFlags=t}},{key:"passes",get:function(){return this._passes}},{key:"shaders",get:function(){return this._shaders}}]),t}(),sY=function(e){return t({UIStaticBatch:e,UIStaticBatchComponent:e}),e}((Ij=_h("cc.UIStaticBatch"),Oj=xh(),xj=Ch(),Pj=dh(110),Dj=Dh(),Ij(Bj=Oj(Bj=xj(Bj=Pj((T((Nj=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._init=!1,e._bufferAccessor=null,e._dirty=!0,e._uiDrawBatchList=[],e}c(e,t);var i=e.prototype;return i.postUpdateAssembler=function(){},i.markAsDirty=function(){},i._requireDrawBatch=function(){var t=new rY;return t.isStatic=!0,this._uiDrawBatchList.push(t),t},i._clearData=function(){if(this._bufferAccessor){this._bufferAccessor.reset();for(var t=this._getBatcher(),e=0;e<this._uiDrawBatchList.length;e++)this._uiDrawBatchList[e].destroy(t)}this._uiDrawBatchList.length=0,this._init=!1},i._getBatcher=function(){return OL.root&&OL.root.batcher2D?OL.root.batcher2D:(j(9301),null)},h(e,[{key:"color",get:function(){return this._color},set:function(t){this._color!==t&&this._color.set(t)}},{key:"drawBatchList",get:function(){return this._uiDrawBatchList}}]),e}(kz)).prototype,"color",[qh,Dj],Object.getOwnPropertyDescriptor(Nj.prototype,"color"),Nj.prototype),Bj=Nj))||Bj)||Bj)||Bj)||Bj)),aY=t("LabelShadow",(Mj=_h("cc.LabelShadow"),Lj=xh(),Fj=dh(110),Uj=Ch(),Gj=fh(zz),kj=Mh(),zj=Mh(),Hj=Mh(),Mj(Vj=Lj(Vj=Fj(Vj=Uj(Vj=Gj(Vj=bh((Kj=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return E(e=t.call.apply(t,[this].concat(n))||this,"_color",Xj,g(e)),E(e,"_offset",jj,g(e)),E(e,"_blur",Yj,g(e)),e}c(e,t);var i=e.prototype;return i.onEnable=function(){this._updateRenderData()},i.onDisable=function(){this._updateRenderData()},i._updateRenderData=function(){var t=this.node.getComponent(zz);t&&t.updateRenderData(!0)},h(e,[{key:"color",get:function(){return this._color},set:function(t){this._color!==t&&(this._color.set(t),this._updateRenderData())}},{key:"offset",get:function(){return this._offset},set:function(t){this._offset=t,this._updateRenderData()}},{key:"blur",get:function(){return this._blur},set:function(t){this._blur=t,this._updateRenderData()}}]),e}(bc),Xj=T((Wj=Kj).prototype,"_color",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new Gi(0,0,0,255)}}),jj=T(Wj.prototype,"_offset",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new _n(2,2)}}),Yj=T(Wj.prototype,"_blur",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 2}}),T(Wj.prototype,"color",[kj],Object.getOwnPropertyDescriptor(Wj.prototype,"color"),Wj.prototype),T(Wj.prototype,"offset",[zj],Object.getOwnPropertyDescriptor(Wj.prototype,"offset"),Wj.prototype),T(Wj.prototype,"blur",[Hj],Object.getOwnPropertyDescriptor(Wj.prototype,"blur"),Wj.prototype),Vj=Wj))||Vj)||Vj)||Vj)||Vj)||Vj)||Vj)),oY=function(e){return t({UIOpacity:e,UIOpacityComponent:e}),e}((qj=_h("cc.UIOpacity"),Qj=xh(),Zj=dh(110),Jj=Ch(),$j=Mh(),qj(tY=Qj(tY=Zj(tY=Jj(tY=bh(tY=ph((T((eY=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return E(e=t.call.apply(t,[this].concat(n))||this,"_opacity",iY,g(e)),e}c(e,t);var i=e.prototype;return i.setEntityLocalOpacityDirtyRecursively=function(){},e.setEntityLocalOpacityDirtyRecursively=function(t,i,n){if(t.isValid){var r=t._uiProps.uiComp,s=t.getComponent(e),a=n;r&&r.color?(r.renderEntity.colorDirty=i,r.renderEntity.localOpacity=s?a*s.opacity/255:a,a=1):s&&(a=a*s.opacity/255);for(var o=0;o<t.children.length;o++)e.setEntityLocalOpacityDirtyRecursively(t.children[o],i||a<1,a)}},i.onEnable=function(){this.node._uiProps.localOpacity=this._opacity/255,this.setEntityLocalOpacityDirtyRecursively(!0)},i.onDisable=function(){this.node._uiProps.localOpacity=1,this.setEntityLocalOpacityDirtyRecursively(!0)},h(e,[{key:"opacity",get:function(){return this._opacity},set:function(t){this._opacity!==t&&(t=De(t,0,255),this._opacity=t,this.node._uiProps.localOpacity=t/255,this.setEntityLocalOpacityDirtyRecursively(!0))}}]),e}(bc)).prototype,"opacity",[Ph,$j],Object.getOwnPropertyDescriptor(eY.prototype,"opacity"),eY.prototype),iY=T(eY.prototype,"_opacity",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 255}}),tY=eY))||tY)||tY)||tY)||tY)||tY)||tY));b.MaskComponent=FW,le.setClassAlias(FW,"cc.MaskComponent"),b.LabelComponent=zz,le.setClassAlias(zz,"cc.LabelComponent"),b.LabelOutlineComponent=tX,le.setClassAlias(tX,"cc.LabelOutlineComponent"),b.RichTextComponent=Cj,le.setClassAlias(Cj,"cc.RichTextComponent"),b.SpriteComponent=PW,le.setClassAlias(PW,"cc.SpriteComponent"),b.UIModelComponent=wj,le.setClassAlias(wj,"cc.UIModelComponent"),b.GraphicsComponent=cW,le.setClassAlias(cW,"cc.GraphicsComponent"),le.setClassAlias(sY,"cc.UIStaticBatchComponent"),le.setClassAlias(oY,"cc.UIOpacityComponent"),et(FW.prototype,"Mask",[{name:"graphics",newName:"subComp",target:FW.prototype,targetName:"Mask"}]),et(DW,"MaskType",[{name:"RECT",newName:"GRAPHICS_RECT",target:DW,targetName:"MaskType"},{name:"ELLIPSE",newName:"GRAPHICS_ELLIPSE",target:DW,targetName:"MaskType"},{name:"IMAGE_STENCIL",newName:"SPRITE_STENCIL",target:DW,targetName:"MaskType"}]);var uY=function(t,e,i){this.i=void 0,this.x=void 0,this.y=void 0,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1,this.i=t,this.x=e,this.y=i};function hY(t,e,i,n,r){var s=0,a=null;if(r===function(t,e,i,n){for(var r=0,s=e,a=i-n;s<i;s+=n)r+=(t[a]-t[s])*(t[s+1]+t[a+1]),a=s;return r}(t,e,i,n)>0)for(s=e;s<i;s+=n)a=wY(s,t[s],t[s+1],a);else for(s=i-n;s>=e;s-=n)a=wY(s,t[s],t[s+1],a);return a&&AY(a,a.next)&&(IY(a),a=a.next),a}function lY(t,e){if(void 0===e&&(e=null),!t)return t;e||(e=t);var i=t,n=!1;do{if(n=!1,i.steiner||!AY(i,i.next)&&0!==SY(i.prev,i,i.next))i=i.next;else{if(IY(i),(i=e=i.prev)===i.next)return null;n=!0}}while(n||i!==e);return e}function cY(t,e,i,n,r,s,a){if(void 0===a&&(a=0),t){!a&&s&&function(t,e,i,n){var r=t;do{null===r.z&&(r.z=vY(r.x,r.y,e,i,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){var e=0,i=null,n=null,r=null,s=null,a=0,o=0,u=0,h=1;do{for(i=t,t=null,s=null,a=0;i;){for(a++,n=i,o=0,e=0;e<h&&(o++,n=n.nextZ);e++);for(u=h;o>0||u>0&&n;)0===o?(r=n,n=n.nextZ,u--):0!==u&&n?i.z<=n.z?(r=i,i=i.nextZ,o--):(r=n,n=n.nextZ,u--):(r=i,i=i.nextZ,o--),s?s.nextZ=r:t=r,r.prevZ=s,s=r;i=n}s.nextZ=null,h*=2}while(a>1)}(r)}(t,n,r,s);for(var o=t,u=null,h=null;t.prev!==t.next;)if(u=t.prev,h=t.next,s?fY(t,n,r,s):_Y(t))e.push(u.i/i),e.push(t.i/i),e.push(h.i/i),IY(t),t=h.next,o=h.next;else if((t=h)===o){a?1===a?cY(t=dY(t,e,i),e,i,n,r,s,2):2===a&&pY(t,e,i,n,r,s):cY(lY(t),e,i,n,r,s,1);break}}}function _Y(t){var e=t.prev,i=t,n=t.next;if(SY(e,i,n)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(EY(e.x,e.y,i.x,i.y,n.x,n.y,r.x,r.y)&&SY(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function fY(t,e,i,n){var r=t.prev,s=t,a=t.next;if(SY(r,s,a)>=0)return!1;for(var o=r.x<s.x?r.x<a.x?r.x:a.x:s.x<a.x?s.x:a.x,u=r.y<s.y?r.y<a.y?r.y:a.y:s.y<a.y?s.y:a.y,h=r.x>s.x?r.x>a.x?r.x:a.x:s.x>a.x?s.x:a.x,l=r.y>s.y?r.y>a.y?r.y:a.y:s.y>a.y?s.y:a.y,c=vY(o,u,e,i,n),_=vY(h,l,e,i,n),f=t.nextZ;f&&f.z<=_;){if(f!==t.prev&&f!==t.next&&EY(r.x,r.y,s.x,s.y,a.x,a.y,f.x,f.y)&&SY(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(f=t.prevZ;f&&f.z>=c;){if(f!==t.prev&&f!==t.next&&EY(r.x,r.y,s.x,s.y,a.x,a.y,f.x,f.y)&&SY(f.prev,f,f.next)>=0)return!1;f=f.prevZ}return!0}function dY(t,e,i){var n=t;do{var r=n.prev,s=n.next.next;!AY(r,s)&&RY(r,n,n.next,s)&&bY(r,s)&&bY(s,r)&&(e.push(r.i/i),e.push(n.i/i),e.push(s.i/i),IY(n),IY(n.next),n=t=s),n=n.next}while(n!==t);return n}function pY(t,e,i,n,r,s){var a=t;do{for(var o=a.next.next;o!==a.prev;){if(a.i!==o.i&&TY(a,o)){var u=CY(a,o);return a=lY(a,a.next),u=lY(u,u.next),cY(a,e,i,n,r,s),void cY(u,e,i,n,r,s)}o=o.next}a=a.next}while(a!==t)}function mY(t,e){return t.x-e.x}function gY(t,e){if(e=function(t,e){var i=e,n=t.x,r=t.y,s=-1/0,a=null;do{if(r<=i.y&&r>=i.next.y){var o=i.x+(r-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(o<=n&&o>s){if(s=o,o===n){if(r===i.y)return i;if(r===i.next.y)return i.next}a=i.x<i.next.x?i:i.next}}i=i.next}while(i!==e);if(!a)return null;if(n===s)return a.prev;var u,h=a,l=a.x,c=a.y,_=1/0;for(i=a.next;i!==h;)n>=i.x&&i.x>=l&&EY(r<c?n:s,r,l,c,r<c?s:n,r,i.x,i.y)&&((u=Math.abs(r-i.y)/(n-i.x))<_||u===_&&i.x>a.x)&&bY(i,t)&&(a=i,_=u),i=i.next;return a}(t,e)){var i=CY(e,t);lY(i,i.next)}}function vY(t,e,i,n,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)/r)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)/r)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function yY(t){var e=t,i=t;do{e.x<i.x&&(i=e),e=e.next}while(e!==t);return i}function EY(t,e,i,n,r,s,a,o){return(r-a)*(e-o)-(t-a)*(s-o)>=0&&(t-a)*(n-o)-(i-a)*(e-o)>=0&&(i-a)*(s-o)-(r-a)*(n-o)>=0}function TY(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&RY(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&bY(t,e)&&bY(e,t)&&function(t,e){var i=t,n=!1,r=(t.x+e.x)/2,s=(t.y+e.y)/2;do{i.y>s!=i.next.y>s&&r<(i.next.x-i.x)*(s-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n}(t,e)}function SY(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function AY(t,e){return t.x===e.x&&t.y===e.y}function RY(t,e,i,n){return!!(AY(t,e)&&AY(i,n)||AY(t,n)&&AY(i,e))||SY(t,e,i)>0!=SY(t,e,n)>0&&SY(i,n,t)>0!=SY(i,n,e)>0}function bY(t,e){return SY(t.prev,t,t.next)<0?SY(t,e,t.next)>=0&&SY(t,t.prev,e)>=0:SY(t,e,t.prev)<0||SY(t,t.next,e)<0}function CY(t,e){var i=new uY(t.i,t.x,t.y),n=new uY(e.i,e.x,e.y),r=t.next,s=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,n.next=i,i.prev=n,s.next=n,n.prev=s,n}function wY(t,e,i,n){var r=new uY(t,e,i);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function IY(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function OY(t,e,i){i=i||3;var n=e?e.length:0,r=n?e[0]*i:t.length,s=hY(t,0,r,i,!0),a=[];if(!s)return a;var o=0,u=0,h=0,l=0,c=0,_=0,f=0;if(n&&(s=function(t,e,i,n){var r,s=[],a=0,o=null;for(a=0,r=e.length;a<r;a++)(o=hY(t,e[a]*n,a<r-1?e[a+1]*n:t.length,n,!1))&&(o===o.next&&(o.steiner=!0),s.push(yY(o)));if(s.sort(mY),!i)return i;for(a=0;a<s.length;a++)gY(s[a],i),i=lY(i,i.next);return i}(t,e,s,i)),t.length>80*i){o=h=t[0],u=l=t[1];for(var d=i;d<r;d+=i)(c=t[d])<o&&(o=c),(_=t[d+1])<u&&(u=_),c>h&&(h=c),_>l&&(l=_);f=Math.max(h-o,l-u)}return cY(s,a,i,o,u,f),a}for(var xY=Math.PI,PY=Math.min,DY=Math.max,BY=Math.ceil,NY=Math.acos,MY=Math.cos,LY=Math.sin,FY=Math.atan2,UY=null,GY=null,kY=new Gi,zY=[],HY=0;HY<4;HY++)zY.push(new ji);function VY(t,e,i){return t<e?e:t>i?i:t}var WY={useModel:!0,updateRenderData:function(){},fillBuffers:function(){},renderIA:function(){},getRenderData:function(t,e){if(!GY)return null;var i=GY.getRenderDataList(),n=i[GY.dataOffset];if(!n)return null;var r=n,s=r?r.vertexStart+e:0;return(s>65535||3*s>131070)&&(++GY.dataOffset,GY.dataOffset<i.length?n=i[GY.dataOffset]:(n=GY.requestRenderData(),i[GY.dataOffset]=n),r=n),r&&r.vertexCount<s&&r.request(e,3*e),n},stroke:function(t){Gi.copy(kY,t.strokeColor),t.impl&&(this._flattenPaths(t.impl),this._expandStroke(t),t.impl.updatePathOffset=!0,this.end(t))},fill:function(t){Gi.copy(kY,t.fillColor),this._expandFill(t),t.impl&&(t.impl.updatePathOffset=!0),this.end(t)},end:function(t){t.markForUpdateRenderData()},_expandStroke:function(t){var e,i,n,r,s=.5*t.lineWidth,a=t.lineCap,o=t.lineJoin,u=t.miterLimit;if(GY=t.impl){var h=(e=s,i=xY,n=GY.tessTol,r=2*NY(e/(e+n)),DY(2,BY(i/r)));this._calculateJoins(GY,s,o,u);for(var l=GY.paths,c=0,_=GY.pathOffset,f=GY.pathLength;_<f;_++){var d=l[_],p=d.points.length;o===CH.ROUND?c+=2*(p+d.bevel*(h+2)+1):c+=2*(p+5*d.bevel+1),d.closed||(a===bH.ROUND?c+=2*(2*h+2):c+=12)}var m=UY=this.getRenderData(t,c);if(m){for(var g=m.vData,v=m.iData,y=GY.pathOffset,E=GY.pathLength;y<E;y++){var T=l[y],S=T.points,A=S.length,R=m.vertexStart,b=void 0,C=void 0,w=0,I=0,O=T.closed;if(O?(b=S[A-1],C=S[0],w=0,I=A):(b=S[0],C=S[1],w=1,I=A-1),C=C||b,!O){var x=new sW(C.x,C.y);x.subtract(b),x.normalize();var P=x.x,D=x.y;a===bH.BUTT?this._buttCapStart(b,P,D,s,0):a===bH.SQUARE?this._buttCapStart(b,P,D,s,s):a===bH.ROUND&&this._roundCapStart(b,P,D,s,h)}for(var B=w;B<I;++B)o===CH.ROUND?this._roundJoin(b,C,s,s,h):0!=(C.flags&(wH.PT_BEVEL|wH.PT_INNERBEVEL))?this._bevelJoin(b,C,s,s):(this._vSet(C.x+C.dmx*s,C.y+C.dmy*s,1),this._vSet(C.x-C.dmx*s,C.y-C.dmy*s,-1)),b=C,C=S[B+1];if(O){var N=8*R;this._vSet(g[N],g[N+1],1),this._vSet(g[N+8],g[N+8+1],-1)}else{var M=new sW(C.x,C.y);M.subtract(b),M.normalize();var L=M.x,F=M.y;a===bH.BUTT?this._buttCapEnd(C,L,F,s,0):a===bH.SQUARE?this._buttCapEnd(C,L,F,s,s):a===bH.ROUND&&this._roundCapEnd(C,L,F,s,h)}for(var U=m.indexStart,G=R+2,k=m.vertexStart;G<k;G++)v[U++]=G-2,v[U++]=G-1,v[U++]=G;m.indexStart=U}UY=null,GY=null}}},_expandFill:function(t){if(GY=t.impl){for(var e=GY.paths,i=0,n=GY.pathOffset,r=GY.pathLength;n<r;n++)i+=e[n].points.length;var s=UY=this.getRenderData(t,i);if(s){for(var a=s,o=a.vData,u=a.iData,h=GY.pathOffset,l=GY.pathLength;h<l;h++){var c=e[h],_=c.points,f=_.length;if(0!==f){for(var d=s.vertexStart,p=0;p<f;++p)this._vSet(_[p].x,_[p].y);var m=s.indexStart;if(c.complex){for(var g=[],v=d,y=s.vertexStart;v<y;v++){var E=8*v;g.push(o[E++]),g.push(o[E++]),g.push(o[E++])}var T=OY(g,null,3);if(!T||0===T.length)continue;for(var S=0,A=T.length;S<A;S++)u[m++]=T[S]+d}else for(var R=d,b=d+2,C=a.vertexStart;b<C;b++)u[m++]=R,u[m++]=b-1,u[m++]=b;a.indexStart=m}}UY=null,GY=null}}},_calculateJoins:function(t,e,i,n){var r=0;e>0&&(r=1/e);for(var s=t.paths,a=t.pathOffset,o=t.pathLength;a<o;a++){var u=s[a],h=u.points,l=h.length,c=h[l-1],_=h[0];u.bevel=0;for(var f=0;f<l;f++){var d,p,m=c.dy,g=-c.dx,v=_.dy,y=-_.dx;if(_.dmx=.5*(m+v),_.dmy=.5*(g+y),(d=_.dmx*_.dmx+_.dmy*_.dmy)>1e-6){var E=1/d;E>600&&(E=600),_.dmx*=E,_.dmy*=E}_.dx*c.dy-c.dx*_.dy>0&&(_.flags|=wH.PT_LEFT),d*(p=DY(11,PY(c.len,_.len)*r))*p<1&&(_.flags|=wH.PT_INNERBEVEL),_.flags&wH.PT_CORNER&&(d*n*n<1||i===CH.BEVEL||i===CH.ROUND)&&(_.flags|=wH.PT_BEVEL),0!=(_.flags&(wH.PT_BEVEL|wH.PT_INNERBEVEL))&&u.bevel++,c=_,_=h[f+1]}}},_flattenPaths:function(t){for(var e=t.paths,i=t.pathOffset,n=t.pathLength;i<n;i++){var r=e[i],s=r.points,a=s[s.length-1],o=s[0];s.length>2&&a.equals(o)&&(r.closed=!0,s.pop(),a=s[s.length-1]);for(var u=0,h=s.length;u<h;u++){var l=new sW(o.x,o.y);l.subtract(a),a.len=l.length(),(l.x||l.y)&&l.normalize(),a.dx=l.x,a.dy=l.y,a=o,o=s[u+1]}}},_chooseBevel:function(t,e,i,n){var r=i.x,s=i.y,a=0,o=0,u=0,h=0;return 0!==t?(a=r+e.dy*n,o=s-e.dx*n,u=r+i.dy*n,h=s-i.dx*n):(a=u=r+i.dmx*n,o=h=s+i.dmy*n),[a,o,u,h]},_buttCapStart:function(t,e,i,n,r){var s=t.x-e*r,a=t.y-i*r,o=i,u=-e;this._vSet(s+o*n,a+u*n,1),this._vSet(s-o*n,a-u*n,-1)},_buttCapEnd:function(t,e,i,n,r){var s=t.x+e*r,a=t.y+i*r,o=i,u=-e;this._vSet(s+o*n,a+u*n,1),this._vSet(s-o*n,a-u*n,-1)},_roundCapStart:function(t,e,i,n,r){for(var s=t.x,a=t.y,o=i,u=-e,h=0;h<r;h++){var l=h/(r-1)*xY,c=MY(l)*n,_=LY(l)*n;this._vSet(s-o*c-e*_,a-u*c-i*_,1),this._vSet(s,a,0)}this._vSet(s+o*n,a+u*n,1),this._vSet(s-o*n,a-u*n,-1)},_roundCapEnd:function(t,e,i,n,r){var s=t.x,a=t.y,o=i,u=-e;this._vSet(s+o*n,a+u*n,1),this._vSet(s-o*n,a-u*n,-1);for(var h=0;h<r;h++){var l=h/(r-1)*xY,c=MY(l)*n,_=LY(l)*n;this._vSet(s,a,0),this._vSet(s-o*c+e*_,a-u*c+i*_,1)}},_roundJoin:function(t,e,i,n,r){var s=t.dy,a=-t.dx,o=e.dy,u=-e.dx,h=e.x,l=e.y;if(0!=(e.flags&wH.PT_LEFT)){var c=this._chooseBevel(e.flags&wH.PT_INNERBEVEL,t,e,i),_=c[0],f=c[1],d=c[2],p=c[3],m=FY(-a,-s),g=FY(-u,-o);g>m&&(g-=2*xY),this._vSet(_,f,1),this._vSet(h-s*n,e.y-a*n,-1);for(var v=VY(BY((m-g)/xY)*r,2,r),y=0;y<v;y++){var E=m+y/(v-1)*(g-m),T=h+MY(E)*n,S=l+LY(E)*n;this._vSet(h,l,0),this._vSet(T,S,-1)}this._vSet(d,p,1),this._vSet(h-o*n,l-u*n,-1)}else{var A=this._chooseBevel(e.flags&wH.PT_INNERBEVEL,t,e,-n),R=A[0],b=A[1],C=A[2],w=A[3],I=FY(a,s),O=FY(u,o);O<I&&(O+=2*xY),this._vSet(h+s*n,l+a*n,1),this._vSet(R,b,-1);for(var x=VY(BY((O-I)/xY)*r,2,r),P=0;P<x;P++){var D=I+P/(x-1)*(O-I),B=h+MY(D)*i,N=l+LY(D)*i;this._vSet(B,N,1),this._vSet(h,l,0)}this._vSet(h+o*n,l+u*n,1),this._vSet(C,w,-1)}},_bevelJoin:function(t,e,i,n){var r=0,s=0,a=0,o=0,u=0,h=0,l=0,c=0,_=t.dy,f=-t.dx,d=e.dy,p=-e.dx;if(e.flags&wH.PT_LEFT){var m=this._chooseBevel(e.flags&wH.PT_INNERBEVEL,t,e,i);u=m[0],h=m[1],l=m[2],c=m[3],this._vSet(u,h,1),this._vSet(e.x-_*n,e.y-f*n,-1),this._vSet(l,c,1),this._vSet(e.x-d*n,e.y-p*n,-1)}else{var g=this._chooseBevel(e.flags&wH.PT_INNERBEVEL,t,e,-n);r=g[0],s=g[1],a=g[2],o=g[3],this._vSet(e.x+_*i,e.y+f*i,1),this._vSet(r,s,-1),this._vSet(e.x+d*i,e.y+p*i,1),this._vSet(a,o,-1)}},_vSet:function(t,e,i){if(void 0===i&&(i=0),UY){var n=UY,r=8*n.vertexStart,s=n.vData;s[r++]=t,s[r++]=e,s[r++]=0,Gi.toArray(s,kY,r),r+=4,s[r++]=i,n.vertexStart++}}},XY=t("graphicsAssembler",{getAssembler:function(){return WY}});cW.Assembler=XY;var jY,YY=function(){this.char="",this.valid=!0,this.x=0,this.y=0,this.line=0,this.hash=""},KY=new yn,qY=new iG(64,64),QY=new OU(null),ZY=null,JY=null,$Y=[],tK=[],eK=[],iK=[],nK=new gn,rK=new gn,sK=new _n,aK=null,oK=0,uK=0,hK=0,lK=0,cK=0,_K=1,fK=null,dK="",pK=0,mK=0,gK=0,vK=0,yK=0,EK=0,TK=0,SK=!1,AK=0,RK=0,bK=0,CK={updateRenderData:function(t){t.renderData&&ZY!==t&&(t.renderData.vertDirty&&(JY=(ZY=t).node._uiProps.uiTransformComp,this._updateFontFamily(t),this._updateProperties(t),this._updateLabelInfo(t),this._updateContent(),ZY.actualFontSize=pK,JY.setContentSize(rK),this.updateUVs(t),this.updateColor(t),ZY.renderData.vertDirty=!1,ZY=null,this._resetProperties()),t.spriteFrame&&t.renderData.updateRenderData(t,t.spriteFrame))},updateUVs:function(t){for(var e=t.renderData,i=e.chunk.vb,n=e.vertexCount,r=e.data,s=3,a=0;a<n;a++){var o=r[a];i[s]=o.u,i[s+1]=o.v,s+=9}},updateColor:function(){},_updateFontScale:function(){_K=pK/mK},_updateFontFamily:function(t){var e=t.font;fK=e.spriteFrame,aK=e.fntConfig,nG.fontAtlas=e.fontDefDictionary,nG.fontAtlas||(t.cacheMode===Gz.CHAR?nG.fontAtlas=qY:nG.fontAtlas=QY),RF.packToDynamicAtlas(t,fK)},_updateLabelInfo:function(){nG.hash="",nG.margin=0},_updateProperties:function(t){dK=t.string.toString(),pK=t.fontSize,mK=aK?aK.fontSize:t.fontSize,gK=t.horizontalAlign,vK=t.verticalAlign,yK=t.spacingX,TK=t.overflow,EK=t._lineHeight;var e=JY.contentSize;rK.width=e.width,rK.height=e.height,TK===Uz.NONE?(SK=!1,rK.width+=2*nG.margin,rK.height+=2*nG.margin):TK===Uz.RESIZE_HEIGHT?(SK=!0,rK.height+=2*nG.margin):SK=t.enableWrapText,nG.lineHeight=EK,nG.fontSize=pK,this._setupBMFontOverflowMetrics()},_resetProperties:function(){aK=null,fK=null,nG.hash="",nG.margin=0},_updateContent:function(){this._updateFontScale(),this._computeHorizontalKerningForText(),this._alignText()},_computeHorizontalKerningForText:function(){var t=dK,e=t.length,i=aK.kerningDict,n=$Y;if(i)for(var r=-1,s=0;s<e;++s){var a=t.charCodeAt(s),o=i[r<<16|65535&a]||0;n[s]=s<e-1?o:0,r=a}},_multilineTextWrap:function(t){for(var e=dK.length,i=0,n=0,r=0,s=0,a=0,o=0,u=0,h=null,l=0;l<e;){var c=dK.charAt(l);if("\n"!==c){for(var _=t(dK,l,e),f=o,d=u,p=a,m=n,g=!1,v=0;v<_;++v){var y=l+v;if("\r"!==(c=dK.charAt(y)))if(h=nG.fontAtlas.getLetterDefinitionForChar(c,nG)){var E=m+h.offsetX*_K-nG.margin;if(SK&&bK>0&&n>0&&E+h.w*_K>bK&&!VU(c)){eK.push(a),a=0,i++,n=0,r-=EK*this._getFontScale()+0,g=!0;break}sK.x=E,sK.y=r-h.offsetY*_K,this._recordLetterInfo(sK,c,y,i),y+1<$Y.length&&y<e-1&&(m+=$Y[y+1]),m+=h.xAdvance*_K+yK,p=sK.x+h.w*_K,f<sK.y&&(f=sK.y),d>sK.y-h.h*_K&&(d=sK.y-h.h*_K)}else this._recordPlaceholderInfo(y,c),console.log("Can't find letter definition in texture atlas "+aK.atlasName+" for letter:"+c);else this._recordPlaceholderInfo(y,c)}g||(n=m,o<f&&(o=f),u>d&&(u=d),s<(a=p)&&(s=a),l+=_)}else eK.push(a),a=0,i++,n=0,r-=EK*this._getFontScale()+0,this._recordPlaceholderInfo(l,c),l++}return eK.push(a),uK=(oK=i+1)*EK*this._getFontScale(),oK>1&&(uK+=0*(oK-1)),rK.width=AK,rK.height=RK,AK<=0&&(rK.width=parseFloat(s.toFixed(2))+2*nG.margin),RK<=0&&(rK.height=parseFloat(uK.toFixed(2))+2*nG.margin),lK=rK.height,cK=0,o>0&&(lK=rK.height+o),u<-uK&&(cK=uK+u),!0},_getFirstCharLen:function(){return 1},_getFontScale:function(){return TK===Uz.SHRINK?_K:1},_getFirstWordLen:function(t,e,i){var n=t.charAt(e);if(HU(n)||"\n"===n||VU(n))return 1;var r=1,s=nG.fontAtlas.getLetterDefinitionForChar(n,nG);if(!s)return r;for(var a=s.xAdvance*_K+yK,o=e+1;o<i&&(n=t.charAt(o),s=nG.fontAtlas.getLetterDefinitionForChar(n,nG));++o){if(a+s.offsetX*_K+s.w*_K>bK&&!VU(n)&&bK>0)return r;if(a+=s.xAdvance*_K+yK,"\n"===n||VU(n)||HU(n))break;r++}return r},_multilineTextWrapByWord:function(){return this._multilineTextWrap(this._getFirstWordLen)},_multilineTextWrapByChar:function(){return this._multilineTextWrap(this._getFirstCharLen)},_recordPlaceholderInfo:function(t,e){if(t>=tK.length){var i=new YY;tK.push(i)}tK[t].char=e,tK[t].hash=""+e.charCodeAt(0)+nG.hash,tK[t].valid=!1},_recordLetterInfo:function(t,e,i,n){if(i>=tK.length){var r=new YY;tK.push(r)}var s=""+e.charCodeAt(0)+nG.hash;tK[i].line=n,tK[i].char=e,tK[i].hash=s,tK[i].valid=nG.fontAtlas.getLetter(s).valid,tK[i].x=t.x,tK[i].y=t.y},_alignText:function(){uK=0,eK.length=0,this._multilineTextWrapByWord(),this._computeAlignmentOffset(),TK===Uz.SHRINK&&pK>0&&this._isVerticalClamp()&&this._shrinkLabelToContentSize(this._isVerticalClamp),this._updateQuads()||TK===Uz.SHRINK&&this._shrinkLabelToContentSize(this._isHorizontalClamp)},_scaleFontSizeDown:function(t){var e=!0;t||(t=.1,e=!1),pK=t,e&&this._updateContent()},_shrinkLabelToContentSize:function(t){for(var e=0,i=0|pK,n=0;e<i;){var r=n=e+i+1>>1;if(r<=0)break;_K=r/mK,this._multilineTextWrapByWord(),this._computeAlignmentOffset(),t()?i=n-1:e=n}e>=0&&this._scaleFontSizeDown(e)},_isVerticalClamp:function(){return uK>rK.height},_isHorizontalClamp:function(){for(var t=!1,e=0,i=dK.length;e<i;++e){var n=tK[e];if(n.valid){var r=nG.fontAtlas.getLetterDefinitionForChar(n.char,nG);if(!r)continue;var s=n.x+r.w*_K,a=n.line;if(AK>0)if(SK){if(eK[a]>rK.width&&(s>rK.width||s<0)){t=!0;break}}else if(s>rK.width){t=!0;break}}}return t},_isHorizontalClamped:function(t,e){var i=eK[e],n=t>rK.width||t<0;return SK?i>rK.width&&n:n},_updateQuads:function(){if(!ZY)return!1;var t=fK?fK.texture:nG.fontAtlas.getTexture(),e=ZY.renderData;e.dataLength=0,e.resize(0,0);for(var i=JY.anchorPoint,n=rK,r=i.x*n.width,s=i.y*n.height,a=!0,o=0,u=dK.length;o<u;++o){var h=tK[o];if(h.valid){var l=nG.fontAtlas.getLetter(h.hash);if(l){KY.height=l.h,KY.width=l.w,KY.x=l.u,KY.y=l.v;var c=h.y+hK;if(RK>0){if(c>lK){var _=c-lK;KY.y+=_,KY.height-=_,c-=_}c-KY.height*_K<cK&&TK===Uz.CLAMP&&(KY.height=c<cK?0:(c-cK)/_K)}var f=h.line,d=h.x+l.w/2*_K+iK[f];if(AK>0&&this._isHorizontalClamped(d,f))if(TK===Uz.CLAMP)KY.width=0;else if(TK===Uz.SHRINK){if(rK.width>l.w){a=!1;break}KY.width=0}if(KY.height>0&&KY.width>0){var p=this._determineRect(),m=h.x+iK[h.line];this.appendQuad(ZY,t,KY,p,m-r,c-s,_K)}}else console.warn("Can't find letter in this bitmap-font")}}var g=e.indexCount;return this.createQuadIndices(g),e.chunk.setIndexBuffer(jY),a},createQuadIndices:function(t){if(t%6==0){var e=t/6;jY=null,jY=new Uint16Array(t);for(var i=0,n=0;n<e;n++)jY[i++]=0+4*n,jY[i++]=1+4*n,jY[i++]=2+4*n,jY[i++]=1+4*n,jY[i++]=3+4*n,jY[i++]=2+4*n}else console.error("illegal index count!")},appendQuad:function(){},_determineRect:function(){var t=fK.isRotated(),e=fK.getOriginalSize(),i=fK.getRect(),n=fK.getOffset(),r=n.x+(e.width-i.width)/2,s=n.y-(e.height-i.height)/2;if(t){var a=KY.x;KY.x=i.x+i.height-KY.y-KY.height-s,KY.y=a+i.y-r,KY.y<0&&(KY.height+=s)}else KY.x+=i.x-r,KY.y+=i.y+s;return t},_computeAlignmentOffset:function(){switch(iK.length=0,gK){case Lz.LEFT:for(var t=0;t<oK;++t)iK.push(0);break;case Lz.CENTER:for(var e=0,i=eK.length;e<i;e++)iK.push((rK.width-eK[e])/2);break;case Lz.RIGHT:for(var n=0,r=eK.length;n<r;n++)iK.push(rK.width-eK[n])}if(hK=rK.height,vK!==Fz.TOP){var s=rK.height-uK+EK*this._getFontScale()-mK*_K;vK===Fz.BOTTOM?hK-=s:hK-=s/2}},_setupBMFontOverflowMetrics:function(){var t=rK.width,e=rK.height;TK===Uz.RESIZE_HEIGHT&&(e=0),TK===Uz.NONE&&(t=0,e=0),AK=t,RK=e,nK.width=t,nK.height=e,bK=t}},wK=new Gi(255,255,255,255),IK={createData:function(t){return t.requestRenderData()},fillBuffers:function(t){var e=t.node;wK.set(t.color),wK.a=255*e._uiProps.opacity,vF(e,0,t.renderData,wK)},appendQuad:function(t,e,i,n,r,s,a){var o=t.renderData;if(o){var u=o.dataLength;o.dataLength+=4,o.resize(o.dataLength,o.dataLength/2*3);var h=o.data,l=e.width,c=e.height,_=i.width,f=i.height,d=0,p=0,m=0,g=0;n?(d=i.x/l,g=(i.x+f)/l,p=(i.y+_)/c,m=i.y/c,h[u].u=d,h[u].v=m,h[u+1].u=d,h[u+1].v=p,h[u+2].u=g,h[u+2].v=m,h[u+3].u=g,h[u+3].v=p):(d=i.x/l,g=(i.x+_)/l,p=(i.y+f)/c,m=i.y/c,h[u].u=d,h[u].v=p,h[u+1].u=g,h[u+1].v=p,h[u+2].u=d,h[u+2].v=m,h[u+3].u=g,h[u+3].v=m),h[u].x=r,h[u].y=s-f*a,h[u+1].x=r+_*a,h[u+1].y=s-f*a,h[u+2].x=r,h[u+2].y=s,h[u+3].x=r+_*a,h[u+3].y=s}}};Vt(IK,CK);var OK=null,xK=Wt(CK,{getAssemblerData:function(){return OK||(OK=new iG(1024,1024)),OK.getTexture()},_updateFontFamily:function(t){nG.fontAtlas=OK,nG.fontFamily=this._getFontFamily(t);var e=t.getComponent(tX);e&&e.enabled?(nG.isOutlined=!0,nG.margin=e.width,nG.out=e.color.clone(),nG.out.a=e.color.a*t.color.a/255):(nG.isOutlined=!1,nG.margin=0)},_getFontFamily:function(t){var e="Arial";return t.useSystemFont?e=t.fontFamily||"Arial":t.font&&(e=t.font._nativeAsset||"Arial"),e},_updateLabelInfo:function(t){nG.fontDesc=this._getFontDesc(),nG.color=t.color,nG.hash=function(t){var e=t.color.toHEX(),i="";return t.isOutlined&&t.margin>0&&(i=i+t.margin+t.out.toHEX()),""+t.fontSize+t.fontFamily+e+i}(nG)},_getFontDesc:function(){return nG.fontSize.toString()+"px "+nG.fontFamily},_computeHorizontalKerningForText:function(){},_determineRect:function(){return!1}}),PK=new Gi(255,255,255,255),DK={createData:function(t){return t.requestRenderData()},fillBuffers:function(t){if(t.renderData){var e=t.node;PK.a=255*e._uiProps.opacity,vF(e,0,t.renderData,PK)}},appendQuad:IK.appendQuad};Vt(DK,xK);var BK=zz.Overflow,NK=(1/255).toFixed(3),MK=null,LK=null,FK=null,UK="",GK="",kK=0,zK=0,HK=[],VK=new gn,WK=0,XK=0,jK=0,YK=new Gi,KK="",qK=BK.NONE,QK=!1,ZK=null,JK=Gi.BLACK.clone(),$K=null,tq=Gi.BLACK.clone(),eq=new yn,iq=gn.ZERO.clone(),nq=gn.ZERO.clone(),rq=_n.ZERO.clone(),sq=_n.ZERO.clone(),aq=0,oq=0,uq=!1,hq=!1,lq=!1,cq=["left","center","right"],_q={getAssemblerData:function(){var t=zz._canvasPool.get();return t.canvas.width=t.canvas.height=1,t},resetAssemblerData:function(t){t&&zz._canvasPool.put(t)},updateRenderData:function(t){if(t.renderData){if(t.renderData.vertDirty){var e=t.node._uiProps.uiTransformComp;this._updateFontFamily(t),this._updateProperties(t,e),this._calculateLabelFont(),this._updateLabelDimensions(),this._updateTexture(t),this._calDynamicAtlas(t),t.actualFontSize=kK,e.setContentSize(VK),this.updateVertexData(t),this.updateUVs(t),t.renderData.vertDirty=!1,t.contentWidth=nq.width,MK=null,LK=null,FK=null}t.spriteFrame&&t.renderData.updateRenderData(t,t.spriteFrame)}},updateVertexData:function(){},updateUVs:function(){},_updateFontFamily:function(t){KK=t.useSystemFont?t.fontFamily||"Arial":t.font&&t.font._nativeAsset||"Arial"},_updateProperties:function(t,e){var i=t.assemblerData;i&&(MK=i.context,LK=i.canvas,FK=t.spriteFrame,GK=t.string.toString(),kK=t.fontSize,zK=kK,qK=t.overflow,nq.width=VK.width=e.width,nq.height=VK.height=e.height,oq=t.underlineHeight,WK=t.lineHeight,XK=t.horizontalAlign,jK=t.verticalAlign,YK=t.color,t.node._uiProps.opacity,uq=t.isBold,hq=t.isItalic,lq=t.isUnderline,QK=qK!==BK.NONE&&(qK===BK.RESIZE_HEIGHT||t.enableWrapText),(ZK=(ZK=tX&&t.getComponent(tX))&&ZK.enabled&&ZK.width>0?ZK:null)&&JK.set(ZK.color),($K=($K=aY&&t.getComponent(aY))&&$K.enabled?$K:null)&&tq.set($K.color),this._updatePaddingRect())},_updatePaddingRect:function(){var t=0,e=0,i=0,n=0,r=0;if(iq.width=iq.height=0,ZK&&(t=e=i=n=r=ZK.width,iq.width=iq.height=2*r),$K){var s=$K.blur+r,a=$K.offset.x,o=$K.offset.y;i=Math.max(i,-a+s),n=Math.max(n,a+s),t=Math.max(t,o+s),e=Math.max(e,-o+s)}if(hq){var u=zK*Math.tan(.20943951);n+=u,iq.width+=u}eq.x=i,eq.y=t,eq.width=i+n,eq.height=t+e},_calculateFillTextStartPosition:function(){var t=0;XK===Lz.RIGHT?t=VK.width-eq.width:XK===Lz.CENTER&&(t=(VK.width-eq.width)/2);var e=this._getLineHeight()*(HK.length-1),i=kK*(1-DU/2);if(jK!==Fz.TOP){var n=e+eq.height+kK-VK.height;jK===Fz.BOTTOM?i-=n+=DU/2*kK:i-=n/2}i+=0*kK,rq.set(t+eq.x,i+eq.y)},_updateTexture:function(t){if(MK&&LK){MK.clearRect(0,0,LK.width,LK.height),MK.font=UK,this._calculateFillTextStartPosition();var e=this._getLineHeight();MK.lineJoin="round",ZK?(MK.fillStyle="rgba("+JK.r+", "+JK.g+", "+JK.b+", "+NK+")",MK.fillRect(0,0,LK.width,LK.height)):t._srcBlendFactor===jn.SRC_ALPHA&&(MK.fillStyle="rgba("+YK.r+", "+YK.g+", "+YK.b+", "+NK+")",MK.fillRect(0,0,LK.width,LK.height)),MK.fillStyle="rgb("+YK.r+", "+YK.g+", "+YK.b+")";var i=rq.x,n=0;this._drawTextEffect(rq,e);for(var r=0;r<HK.length;++r)n=rq.y+r*e,ZK&&MK.strokeText(HK[r],i,n),MK.fillText(HK[r],i,n);$K&&(MK.shadowColor="transparent"),this._uploadTexture(t)}},_uploadTexture:function(t){if(t.cacheMode===zz.CacheMode.BITMAP){var e=t.ttfSpriteFrame;RF.deleteAtlasSpriteFrame(e),e._resetDynamicAtlasFrame()}var i;FK&&LK&&(i=FK instanceof hU?FK.texture:FK,0!==LK.width&&0!==LK.height&&(i.reset({width:LK.width,height:LK.height,mipmapLevel:1}),i.uploadData(LK),i.setWrapMode(ig.CLAMP_TO_EDGE,ig.CLAMP_TO_EDGE),FK instanceof hU&&(FK.rect=new yn(0,0,LK.width,LK.height),FK._calculateUV()),t.renderData&&(t.renderData.textureDirty=!0),b.director.root&&b.director.root.batcher2D&&b.director.root.batcher2D._releaseDescriptorSetCache(i.getHash())))},_calDynamicAtlas:function(t){if(!(t.cacheMode!==zz.CacheMode.BITMAP||!LK||LK.width<=0||LK.height<=0)){var e=t.ttfSpriteFrame;RF.packToDynamicAtlas(t,e)}},_setupOutline:function(){MK.strokeStyle="rgba("+JK.r+", "+JK.g+", "+JK.b+", "+JK.a/255+")",MK.lineWidth=2*ZK.width},_setupShadow:function(){MK.shadowColor="rgba("+tq.r+", "+tq.g+", "+tq.b+", "+tq.a/255+")",MK.shadowBlur=$K.blur,MK.shadowOffsetX=$K.offset.x,MK.shadowOffsetY=-$K.offset.y},_drawTextEffect:function(t,e){if($K||ZK||lq){var i=HK.length>1&&$K,n=this._measureText(MK,UK),r=0,s=0;$K&&this._setupShadow(),ZK&&this._setupOutline();for(var a=0;a<HK.length;++a)r=t.x,s=t.y+a*e,i&&(ZK&&MK.strokeText(HK[a],r,s),MK.fillText(HK[a],r,s)),lq&&(aq=n(HK[a]),XK===Lz.RIGHT?sq.x=t.x-aq:XK===Lz.CENTER?sq.x=t.x-aq/2:sq.x=t.x,sq.y=s+zK/8,MK.fillRect(sq.x,sq.y,aq,oq));i&&(MK.shadowColor="transparent")}},_updateLabelDimensions:function(){VK.width=Math.min(VK.width,2048),VK.height=Math.min(VK.height,2048);var t=!1;LK.width!==VK.width&&(LK.width=VK.width,t=!0),LK.height!==VK.height&&(LK.height=VK.height,t=!0),t&&(MK.font=UK),MK.textAlign=cq[XK],MK.textBaseline="alphabetic"},_getFontDesc:function(){var t=kK.toString()+"px ";return t+=KK,uq&&(t="bold "+t),hq&&(t="italic "+t),t},_getLineHeight:function(){return 0|(0===WK?kK:WK*kK/zK)},_calculateParagraphLength:function(t,e){for(var i,n=[],r=y(t);!(i=r()).done;){var s=WU(e,i.value,UK);n.push(s)}return n},_measureText:function(t,e){return function(i){return WU(t,i,e)}},_calculateShrinkFont:function(t){if(MK){var e=this._calculateParagraphLength(t,MK),i=0,n=0,r=0;if(QK){var s=nq.width,a=nq.height;if(s<0||a<0)return;n=a+1;for(var o=0,u=0|kK+1,h=0;o<u;){if((h=o+u+1>>1)<=0){W(4003);break}kK=h,UK=this._getFontDesc(),MK.font=UK;var l=this._getLineHeight();for(n=0,i=0;i<t.length;++i){var c=WU(MK,t[i],UK);n+=KU(t[i],c,s,this._measureText(MK,UK)).length*l}n>a?u=h-1:o=h}0===o?W(4003):(kK=o,UK=this._getFontDesc(),MK.font=UK)}else{for(n=t.length*this._getLineHeight(),i=0;i<t.length;++i)r<e[i]&&(r=e[i]);var _=(VK.width-eq.width)/r,f=VK.height/n;kK=zK*Math.min(1,_,f)|0,UK=this._getFontDesc(),MK.font=UK}}},_calculateWrapText:function(t){if(QK&&MK){HK=[];for(var e=nq.width,i=0;i<t.length;++i){var n=WU(MK,t[i],UK),r=KU(t[i],n,e,this._measureText(MK,UK));HK=HK.concat(r)}}},_calculateLabelFont:function(){if(MK){var t=GK.split("\n");switch(HK=t,UK=this._getFontDesc(),MK.font=UK,qK){case BK.NONE:for(var e=0,i=0,n=0;n<t.length;++n){var r=WU(MK,t[n],UK);e=e>r?e:r}i=(HK.length+DU)*this._getLineHeight();var s=parseFloat(e.toFixed(2)),a=parseFloat(i.toFixed(2));VK.width=s+eq.width,VK.height=a+eq.height,nq.width=s+iq.width,nq.height=a+iq.height;break;case BK.SHRINK:this._calculateShrinkFont(t),this._calculateWrapText(t);break;case BK.CLAMP:this._calculateWrapText(t);break;case BK.RESIZE_HEIGHT:this._calculateWrapText(t);var o=(HK.length+DU)*this._getLineHeight();VK.height=o+eq.height,nq.height=o+iq.height}}}},fq=Gi.WHITE.clone(),dq=Uint16Array.from([0,1,2,1,3,2]),pq={createData:function(t){var e=t.requestRenderData();e.dataLength=4,e.resize(4,6);var i=e.chunk.vb;i[3]=i[21]=i[22]=i[31]=0,i[4]=i[12]=i[13]=i[30]=1;for(var n=5,r=0;r<4;r++)Gi.toArray(i,fq,n),n+=9;return e.vertexRow=2,e.vertexCol=2,e.chunk.setIndexBuffer(dq),e},fillBuffers:function(t){for(var e=t.renderData,i=e.chunk,n=e.data,r=t.node,s=i.vb,a=r.worldMatrix,o=e.floatStride,u=0,h=n.length,l=0;l<h;l++){var c=n[l],_=c.x,f=c.y,d=a.m03*_+a.m07*f+a.m15;d=d?Math.abs(1/d):1,s[0+(u=l*o)]=(a.m00*_+a.m04*f+a.m12)*d,s[u+1]=(a.m01*_+a.m05*f+a.m13)*d,s[u+2]=(a.m02*_+a.m06*f+a.m14)*d}var p=i.vertexOffset,m=i.meshBuffer,g=i.meshBuffer.iData,v=m.indexOffset;g[v++]=p,g[v++]=p+1,g[v++]=p+2,g[v++]=p+2,g[v++]=p+1,g[v++]=p+3,m.indexOffset+=6},updateVertexData:function(t){var e=t.renderData;if(e){var i=t.node._uiProps.uiTransformComp,n=i.width,r=i.height,s=i.anchorX*n,a=i.anchorY*r,o=e.data;o[0].x=-s,o[0].y=-a,o[1].x=n-s,o[1].y=-a,o[2].x=-s,o[2].y=r-a,o[3].x=n-s,o[3].y=r-a}},updateUVs:function(t){var e=t.renderData;if(e&&t.ttfSpriteFrame){var i=e.chunk.vb,n=t.ttfSpriteFrame.uv;i[3]=n[0],i[4]=n[1],i[12]=n[2],i[13]=n[3],i[21]=n[4],i[22]=n[5],i[30]=n[6],i[31]=n[7]}},updateColor:function(){}};Vt(pq,_q);var mq=t("labelAssembler",{getAssembler:function(t){var e=pq;return t.font instanceof xU?e=IK:t.cacheMode===zz.CacheMode.CHAR&&(e=DK),e}});zz.Assembler=mq;var gq,vq=PW.FillType,yq=new un,Eq=Uint16Array.from([0,1,2,1,3,2]),Tq={updateRenderData:function(t){var e=t.spriteFrame;RF.packToDynamicAtlas(t,e);var i=t.renderData;if(i&&e){if(!i.vertDirty)return;var n=t.fillStart,r=t.fillRange;r<0&&(n+=r,r=-r),r=(r=(r=n+r)>1?1:r)<0?0:r;var s=(n=(n=n>1?1:n)<0?0:n)+(r=(r-=n)<0?0:r);s=s>1?1:s,this.updateUVs(t,n,s),this.updateVertexData(t,n,s),i.updateRenderData(t,e)}},updateUVs:function(t,e,i){var n=t.spriteFrame,r=t.renderData.chunk.vb,s=n.width,a=n.height,o=n.rect,u=0,h=0,l=0,c=0,_=0,f=0,d=0,p=0,m=0,g=0;switch(n.isRotated()?(u=o.x/s,h=(o.y+o.width)/a,l=_=u,d=m=(o.x+o.height)/s,f=g=h,c=p=o.y/a):(u=o.x/s,h=(o.y+o.height)/a,l=d=u,_=m=(o.x+o.width)/s,c=f=h,p=g=o.y/a),t.fillType){case vq.HORIZONTAL:r[3]=l+(_-l)*e,r[4]=c+(f-c)*e,r[12]=l+(_-l)*i,r[13]=c+(f-c)*i,r[21]=d+(m-d)*e,r[22]=p+(g-p)*e,r[30]=d+(m-d)*i,r[31]=p+(g-p)*i;break;case vq.VERTICAL:r[3]=l+(d-l)*e,r[4]=c+(p-c)*e,r[12]=_+(m-_)*e,r[13]=f+(g-f)*e,r[21]=l+(d-l)*i,r[22]=c+(p-c)*i,r[30]=_+(m-_)*i,r[31]=f+(g-f)*i;break;default:K(2626)}},updateVertexData:function(t,e,i){var n=t.renderData.data,r=t.node._uiProps.uiTransformComp,s=r.width,a=r.height,o=r.anchorX*s,u=r.anchorY*a,h=-o,l=-u,c=s-o,_=a-u,f=0;switch(t.fillType){case vq.HORIZONTAL:f=h+(c-h)*i,h+=(c-h)*e,c=f;break;case vq.VERTICAL:f=l+(_-l)*i,l+=(_-l)*e,_=f;break;default:K(2626)}n[0].x=h,n[0].y=l,n[1].x=c,n[1].y=l,n[2].x=h,n[2].y=_,n[3].x=c,n[3].y=_},createData:function(t){var e=t.requestRenderData();e.dataLength=4,e.resize(4,6),e.vertexRow=2,e.vertexCol=2,e.chunk.setIndexBuffer(Eq);for(var i,n=y(e.data);!(i=n()).done;)i.value.z=0;return e},updateWorldVertexData:function(t,e){t.node.getWorldMatrix(yq);for(var i=t.renderData.floatStride,n=t.renderData.data,r=e.vb,s=0,a=0;a<4;a++){var o=n[a],u=o.x,h=o.y,l=yq.m03*u+yq.m07*h+yq.m15;l=l?Math.abs(1/l):1,r[s=a*i]=(yq.m00*u+yq.m04*h+yq.m12)*l,r[s+1]=(yq.m01*u+yq.m05*h+yq.m13)*l,r[s+2]=(yq.m02*u+yq.m06*h+yq.m14)*l}},fillBuffers:function(t){var e=t.renderData,i=e.chunk;(t.node.hasChangedFlags||e.vertDirty)&&(this.updateWorldVertexData(t,i),e.vertDirty=!1),i.bufferId;var n=i.vertexOffset,r=i.meshBuffer,s=i.meshBuffer.iData,a=r.indexOffset;s[a++]=n,s[a++]=n+1,s[a++]=n+2,s[a++]=n+2,s[a++]=n+1,s[a++]=n+3,r.indexOffset+=6},updateColor:function(t){for(var e=t.renderData,i=e.chunk.vb,n=e.floatStride,r=5,s=t.color,a=s.r/255,o=s.g/255,u=s.b/255,h=t.node._uiProps.opacity,l=0;l<4;l++)i[r]=a,i[r+1]=o,i[r+2]=u,i[r+3]=h,r+=n}},Sq=2*Math.PI,Aq=1e-6,Rq=new un,bq=[new _n,new _n,new _n,new _n],Cq=new Array(4),wq=new Array(8),Iq=[new _n,new _n,new _n,new _n],Oq=[new _n,new _n,new _n,new _n],xq=new _n,Pq=[new _n,new _n,new _n,new _n];function Dq(t,e,i,n,r,s,a){var o=Math.sin(s);o=Math.abs(o)>Aq?o:0;var u=Math.cos(s),h=0,l=0;if(0!==(u=Math.abs(u)>Aq?u:0)){if(h=o/u,(t-r.x)*u>0){var c=r.y+h*(t-r.x);a[0].x=t,a[0].y=c}if((e-r.x)*u>0){var _=r.y+h*(e-r.x);a[2].x=e,a[2].y=_}}if(0!==o){if(l=u/o,(n-r.y)*o>0){var f=r.x+l*(n-r.y);a[3].x=f,a[3].y=n}if((i-r.y)*o>0){var d=r.x+l*(i-r.y);a[1].x=d,a[1].y=i}}}function Bq(t,e){var i=e.x-t.x,n=e.y-t.y;if(0===i&&0===n)return 0;if(0===i)return n>0?.5*Math.PI:1.5*Math.PI;var r=Math.atan(n/i);return i<0&&(r+=Math.PI),r}function Nq(t,e,i,n,r){var s=Cq,a=s[0],o=s[1],u=s[2],h=s[3];t[e].x=i.x,t[e].y=i.y,t[e+1].x=n.x,t[e+1].y=n.y,t[e+2].x=r.x,t[e+2].y=r.y,Mq((i.x-a)/(u-a),(i.y-o)/(h-o),t,e),Mq((n.x-a)/(u-a),(n.y-o)/(h-o),t,e+1),Mq((r.x-a)/(u-a),(r.y-o)/(h-o),t,e+2)}function Mq(t,e,i,n){var r=wq,s=r[0]+(r[2]-r[0])*t,a=r[4]+(r[6]-r[4])*t,o=r[1]+(r[3]-r[1])*t,u=r[5]+(r[7]-r[5])*t,h=i[n];h.u=s+(a-s)*e,h.v=o+(u-o)*e}for(var Lq={useModel:!1,createData:function(t){return t.requestRenderData()},updateRenderData:function(t){var e=t.spriteFrame;RF.packToDynamicAtlas(t,e),this.updateUVs(t);var i=t.renderData;if(i&&e){if(!i.vertDirty)return;var n=i.data,r=t.fillStart,s=t.fillRange;for(s<0&&(r+=s,s=-s);r>=1;)r-=1;for(;r<0;)r+=1;var a=(r*=Sq)+(s*=Sq);!function(t){var e=t.node._uiProps.uiTransformComp,i=e.width,n=e.height,r=e.anchorX*i,s=e.anchorY*n,a=-r,o=-s,u=i-r,h=n-s,l=Cq;l[0]=a,l[1]=o,l[2]=u,l[3]=h;var c=t.fillCenter,_=xq.x=Math.min(Math.max(0,c.x),1)*(u-a)+a,f=xq.y=Math.min(Math.max(0,c.y),1)*(h-o)+o;bq[0].x=bq[3].x=a,bq[1].x=bq[2].x=u,bq[0].y=bq[1].y=o,bq[2].y=bq[3].y=h;for(var d,p=y(Pq);!(d=p()).done;){var m=d.value;_n.set(m,0,0)}_!==l[0]&&_n.set(Pq[0],3,0),_!==l[2]&&_n.set(Pq[2],1,2),f!==l[1]&&_n.set(Pq[1],0,1),f!==l[3]&&_n.set(Pq[3],2,3)}(t),function(t){var e=t.width,i=t.height,n=t.getRect(),r=0,s=0,a=0,o=0,u=wq;t.isRotated()?(r=n.x/e,s=(n.x+n.height)/e,a=n.y/i,o=(n.y+n.width)/i,u[0]=u[2]=r,u[4]=u[6]=s,u[3]=u[7]=o,u[1]=u[5]=a):(r=n.x/e,s=(n.x+n.width)/e,a=n.y/i,o=(n.y+n.height)/i,u[0]=u[4]=r,u[2]=u[6]=s,u[1]=u[3]=o,u[5]=u[7]=a)}(e),Dq(Cq[0],Cq[2],Cq[1],Cq[3],xq,r,Iq),Dq(Cq[0],Cq[2],Cq[1],Cq[3],xq,r+s,Oq);for(var o=0,u=0;u<4;++u){var h=Pq[u];if(h)if(s>=Sq)i.dataLength=o+3,Nq(n,o,xq,bq[h.x],bq[h.y]),o+=3;else{var l=Bq(xq,bq[h.x]),c=Bq(xq,bq[h.y]);c<l&&(c+=Sq),l-=Sq,c-=Sq;for(var _=0;_<3;++_)l>=a||(l>=r?(i.dataLength=o+3,Nq(n,o,xq,bq[h.x],c>=a?Oq[u]:bq[h.y]),o+=3):c>r&&(c<=a?(i.dataLength=o+3,Nq(n,o,xq,Iq[u],bq[h.y]),o+=3):(i.dataLength=o+3,Nq(n,o,xq,Iq[u],Oq[u]),o+=3))),l+=Sq,c+=Sq}}0===o&&(i.dataLength=0),i.resize(o,o),i.updateRenderData(t,e)}},createQuadIndices:function(t){gq=null,gq=new Uint16Array(t);for(var e=0,i=0;i<t;i++)gq[e++]=i},fillBuffers:function(t){var e=t.node,i=t.renderData,n=i.chunk;(e.hasChangedFlags||i.vertDirty)&&(this.updateWorldVertexAndUVData(t,n),i.vertDirty=!1),this.updateColorLate(t),n.bufferId;for(var r=n.vertexOffset,s=n.meshBuffer,a=n.meshBuffer.iData,o=s.indexOffset,u=0;u<i.indexCount;u++)a[o+u]=r+u;s.indexOffset+=i.indexCount,s.setDirty()},updateWorldUVData:function(t){for(var e=t.renderData,i=e.floatStride,n=e.data,r=e.chunk.vb,s=0;s<n.length;s++){var a=s*i;r[a+3]=n[s].u,r[a+4]=n[s].v}},updateWorldVertexAndUVData:function(t,e){t.node.getWorldMatrix(Rq);for(var i=t.renderData,n=i.floatStride,r=t.renderData.data,s=e.vb,a=i.vertexCount,o=0,u=0;u<a;u++){var h=r[u],l=h.x,c=h.y,_=Rq.m03*l+Rq.m07*c+Rq.m15;_=_?Math.abs(1/_):1,s[o+0]=(Rq.m00*l+Rq.m04*c+Rq.m12)*_,s[o+1]=(Rq.m01*l+Rq.m05*c+Rq.m13)*_,s[o+2]=(Rq.m02*l+Rq.m06*c+Rq.m14)*_,s[o+3]=h.u,s[o+4]=h.v,o+=n}},updateUVs:function(t){t.renderData.vertDirty=!0,t.markForUpdateRenderData()},updateColorLate:function(t){for(var e=t.renderData,i=e.chunk.vb,n=e.floatStride,r=e.vertexCount,s=5,a=t.color,o=a.r/255,u=a.g/255,h=a.b/255,l=t.node._uiProps.opacity,c=0;c<r;c++)i[s]=o,i[s+1]=u,i[s+2]=h,i[s+3]=l,s+=n},updateColor:function(){}},Fq=Uint16Array.from([0,1,2,1,3,2]),Uq={createData:function(t){var e=t.requestRenderData();return e.dataLength=4,e.resize(4,6),e.vertexRow=2,e.vertexCol=2,e.chunk.setIndexBuffer(Fq),e},updateRenderData:function(t){var e=t.spriteFrame;RF.packToDynamicAtlas(t,e),this.updateUVs(t);var i=t.renderData;i&&e&&(i.vertDirty&&this.updateVertexData(t),i.updateRenderData(t,e))},updateWorldVerts:function(t,e){for(var i=t.renderData,n=e.vb,r=i.data,s=t.node.worldMatrix,a=i.floatStride,o=0,u=r.length,h=0;h<u;h++){var l=r[h],c=l.x,_=l.y,f=s.m03*c+s.m07*_+s.m15;f=f?Math.abs(1/f):1,n[0+(o=h*a)]=(s.m00*c+s.m04*_+s.m12)*f,n[o+1]=(s.m01*c+s.m05*_+s.m13)*f,n[o+2]=(s.m02*c+s.m06*_+s.m14)*f}},fillBuffers:function(t){if(null!==t){var e=t.renderData,i=e.chunk;(t.node.hasChangedFlags||e.vertDirty)&&(this.updateWorldVerts(t,i),e.vertDirty=!1),i.bufferId;for(var n=i.vertexOffset,r=i.meshBuffer,s=i.meshBuffer.iData,a=r.indexOffset,o=0;o<e.vertexRow-1;o++)for(var u=0;u<e.vertexCol-1;u++){var h=n+o*e.vertexCol+u;s[a++]=h,s[a++]=h+1,s[a++]=h+e.vertexCol,s[a++]=h+1,s[a++]=h+1+e.vertexCol,s[a++]=h+e.vertexCol,r.indexOffset+=6}}},updateVertexData:function(t){var e=t.renderData;if(e){var i=t.node._uiProps.uiTransformComp,n=e.data,r=i.width,s=i.height,a=i.anchorX*r,o=i.anchorY*s,u=0,h=0,l=0,c=0;if(t.trim)u=-a,h=-o,l=r-a,c=s-o;else{var _=t.spriteFrame,f=_.originalSize,d=r/f.width,p=s/f.height,m=_.trimmedBorder;u=m.x*d-a,h=m.z*p-o,l=r+m.y*d-a,c=s+m.w*p-o}n[0].x=u,n[0].y=h,n[1].x=l,n[1].y=h,n[2].x=u,n[2].y=c,n[3].x=l,n[3].y=c,e.vertDirty=!0}},updateUVs:function(t){if(t.spriteFrame){var e=t.renderData.chunk.vb,i=t.spriteFrame.uv;e[3]=i[0],e[4]=i[1],e[12]=i[2],e[13]=i[3],e[21]=i[4],e[22]=i[5],e[30]=i[6],e[31]=i[7]}},updateColor:function(t){for(var e=t.renderData,i=e.chunk.vb,n=5,r=t.color,s=r.r/255,a=r.g/255,o=r.b/255,u=r.a/255,h=0;h<4;h++,n+=e.floatStride)i[n]=s,i[n+1]=a,i[n+2]=o,i[n+3]=u}},Gq=new un,kq=[],zq=0;zq<4;zq++)kq.push({x:0,y:0,z:0,u:0,v:0,color:new Gi});var Hq,Vq,Wq,Xq,jq,Yq,Kq,qq,Qq={createData:function(t){var e=t.requestRenderData();return e.dataLength=16,e.resize(16,54),e.vertexRow=4,e.vertexCol=4,this.QUAD_INDICES=new Uint16Array(54),this.createQuadIndices(4,4),e.chunk.setIndexBuffer(this.QUAD_INDICES),e},createQuadIndices:function(t,e){for(var i=0,n=0;n<t-1;n++)for(var r=0;r<e-1;r++){var s=n*e+r;this.QUAD_INDICES[i++]=s,this.QUAD_INDICES[i++]=s+1,this.QUAD_INDICES[i++]=s+e,this.QUAD_INDICES[i++]=s+1,this.QUAD_INDICES[i++]=s+1+e,this.QUAD_INDICES[i++]=s+e}},updateRenderData:function(t){var e=t.spriteFrame;RF.packToDynamicAtlas(t,e),this.updateUVs(t);var i=t.renderData;i&&e&&(i.vertDirty&&this.updateVertexData(t),i.updateRenderData(t,e))},updateVertexData:function(t){var e=t.renderData,i=e.data,n=t.node._uiProps.uiTransformComp,r=n.width,s=n.height,a=n.anchorX*r,o=n.anchorY*s,u=t.spriteFrame,h=u.insetLeft,l=u.insetRight,c=u.insetTop,_=u.insetBottom,f=r-h-l,d=s-c-_,p=r/(h+l),m=s/(c+_);p=Number.isNaN(p)||p>1?1:p,m=Number.isNaN(m)||m>1?1:m,f=f<0?0:f,d=d<0?0:d,kq[0].x=-a,kq[0].y=-o,kq[1].x=h*p-a,kq[1].y=_*m-o,kq[2].x=kq[1].x+f,kq[2].y=kq[1].y+d,kq[3].x=r-a,kq[3].y=s-o;for(var g=0;g<e.vertexRow;g++)for(var v=0;v<e.vertexCol;v++){var y=g*e.vertexCol+v;y<e.dataLength&&g<kq.length&&v<kq.length&&(i[y].x=kq[v].x,i[y].y=kq[g].y)}},fillBuffers:function(t){var e=t.renderData,i=e.chunk;(t.node.hasChangedFlags||e.vertDirty)&&(this.updateWorldVertexData(t,i),e.vertDirty=!1),i.bufferId;for(var n=i.vertexOffset,r=i.meshBuffer,s=i.meshBuffer.iData,a=r.indexOffset,o=0;o<3;++o)for(var u=0;u<3;++u){var h=n+4*o+u;s[a++]=h,s[a++]=h+1,s[a++]=h+4,s[a++]=h+1,s[a++]=h+5,s[a++]=h+4}r.indexOffset=a},updateWorldVertexData:function(t,e){t.node.getWorldMatrix(Gq);for(var i=t.renderData,n=i.floatStride,r=i.data,s=e.vb,a=0,o=0;o<4;++o)for(var u=r[4*o],h=0;h<4;++h){var l=r[h].x,c=u.y,_=Gq.m03*l+Gq.m07*c+Gq.m15;_=_?Math.abs(1/_):1,s[0+(a=(4*o+h)*n)]=(Gq.m00*l+Gq.m04*c+Gq.m12)*_,s[a+1]=(Gq.m01*l+Gq.m05*c+Gq.m13)*_,s[a+2]=(Gq.m02*l+Gq.m06*c+Gq.m14)*_}},updateUVs:function(t){if(t.spriteFrame)for(var e=t.renderData,i=e.chunk.vb,n=e.floatStride,r=t.spriteFrame.uvSliced,s=3,a=0;a<16;a++)i[s]=r[a].u,i[s+1]=r[a].v,s+=n},updateColor:function(t){for(var e=t.renderData,i=e.chunk.vb,n=e.floatStride,r=5,s=t.color,a=s.r/255,o=s.g/255,u=s.b/255,h=t.node._uiProps.opacity,l=0;l<16;l++)i[r]=a,i[r+1]=o,i[r+2]=u,i[r+3]=h,r+=n}},Zq=new un,Jq=0,$q=[];function tQ(t){return t&&(t.insetTop>0||t.insetBottom>0||t.insetLeft>0||t.insetRight>0)?2:0}var eQ={createData:function(t){return t.requestRenderData()},updateRenderData:function(t){var e=t.renderData,i=t.spriteFrame;if(i&&e&&e.vertDirty){var n=t.node._uiProps.uiTransformComp,r=Math.abs(n.width),s=Math.abs(n.height),a=i.getRect(),o=i.insetLeft,u=i.insetRight,h=a.width-o-u,l=i.insetTop,c=i.insetBottom,_=a.height-l-c,f=r-o-u,d=s-l-c;f=f>0?f:0,d=d>0?d:0;var p=0===h?f:f/h,m=0===_?d:d/_,g=tQ(i),v=Math.ceil(m+g),y=Math.ceil(p+g);e.dataLength=4*v*y,this.updateVerts(t,f,d,v,y),e.vertexCount!==v*y*4&&(t.renderEntity.colorDirty=!0),e.resize(v*y*4,v*y*6),e.updateRenderData(t,i)}},createQuadIndices:function(t){if(t%6==0){var e=t/6;qq=null,qq=new Uint16Array(t);for(var i=0,n=0;n<e;n++)qq[i++]=0+4*n,qq[i++]=1+4*n,qq[i++]=2+4*n,qq[i++]=1+4*n,qq[i++]=3+4*n,qq[i++]=2+4*n}else console.error("illegal index count!")},updateUVs:function(t){t.renderData.vertDirty=!0,t.markForUpdateRenderData()},fillBuffers:function(t){var e=t.node,i=t.renderData,n=i.chunk;(e.hasChangedFlags||i.vertDirty)&&(this.updateWorldVertexAndUVData(t,n),i.vertDirty=!1),this.updateColorLate(t),n.bufferId;for(var r=n.vertexOffset,s=n.meshBuffer,a=n.meshBuffer.iData,o=s.indexOffset,u=0;u<i.indexCount;u+=6)a[o++]=r,a[o++]=r+1,a[o++]=r+2,a[o++]=r+1,a[o++]=r+3,a[o++]=r+2,r+=4,s.indexOffset+=6;s.setDirty()},updateWorldUVData:function(t){for(var e=t.renderData,i=e.floatStride,n=e.data,r=e.chunk.vb,s=0;s<n.length;s++){var a=s*i;r[a+3]=n[s].u,r[a+4]=n[s].v}},updateWorldVertexAndUVData:function(t,e){t.node.getWorldMatrix(Zq);for(var i=t.renderData,n=i.floatStride,r=i.data,s=e.vb,a=r.length,o=0;o<a;o++){var u=r[o].x,h=r[o].y,l=r[o].z,c=Zq.m03*u+Zq.m07*h+Zq.m11*l+Zq.m15;c=c?Math.abs(1/c):1;var _=o*n;s[_]=(Zq.m00*u+Zq.m04*h+Zq.m08*l+Zq.m12)*c,s[_+1]=(Zq.m01*u+Zq.m05*h+Zq.m09*l+Zq.m13)*c,s[_+2]=(Zq.m02*u+Zq.m06*h+Zq.m10*l+Zq.m14)*c}this.updateWorldUVData(t)},updateVerts:function(t,e,i,n,r){var s,a,o=t.node._uiProps.uiTransformComp,u=t.renderData.data,h=t.spriteFrame,l=h.rect,c=Math.abs(o.width),_=Math.abs(o.height),f=o.anchorX*c,d=o.anchorY*_,p=h.insetLeft,m=h.insetRight,g=l.width-p-m,v=h.insetTop,y=h.insetBottom,E=l.height-v-y,T=o.width/(p+m)>1?1:o.width/(p+m),S=o.height/(v+y)>1?1:o.height/(v+y);s=g>0?Math.floor(1e3*e)/1e3%g==0?g:e%g:e,a=E>0?Math.floor(1e3*i)/1e3%E==0?E:i%E:i,Jq=Math.max(n+1,r+1);for(var A=0;A<Jq;A++)$q.push({x:0,y:0,z:0,u:0,v:0,color:new Gi});var R=tQ(h);if(0===R)for(var b=0;b<Jq;b++)$q[b].x=b>=r?c-f:b*g-f,$q[b].y=b>=n?_-d:b*E-d;else for(var C=0;C<Jq;C++)0===C?$q[C].x=-f:1===C?$q[C].x=p*T-f:C>1&&C<r-1?$q[C].x=g>0?p*T-f+g*(C-1):p+e-f:C===r-1?$q[C].x=p*T-f+s+g*(C-2):C>=r&&($q[C].x=Math.min(p+e+m,c)-f),0===C?$q[C].y=-d:1===C?$q[C].y=y*S-d:C>1&&C<n-1?$q[C].y=E>0?y*S-d+E*(C-1):y+i-d:C===n-1?$q[C].y=y*S-d+a+E*(C-2):C>=n&&($q[C].y=Math.min(y+i+v,_)-d);for(var w=0,I=0,O=0,x=0,P=0;P<n;++P){O=$q[P].y,x=$q[P+1].y;for(var D=0;D<r;++D){w=$q[D].x,I=$q[D+1].x;var B=4*(P*r+D);u[B].x=w,u[B].y=O,u[B+1].x=I,u[B+1].y=O,u[B+2].x=w,u[B+2].y=x,u[B+3].x=I,u[B+3].y=x}}var N=h.rotated,M=(h.uv,h.uvSliced);Hq=M[0],Vq=M[1],Wq=M[2],Xq=M[3],jq=M[4],Yq=M[8],Kq=M[12];for(var L=0,F=0,U=0===g?e:e/g,G=0===E?i:i/E,k=[],z=[],H=0;H<n;++H){F=i>E?i>=(R>0?H:H+1)*E?1:G%1:G;for(var V=0;V<r;++V){L=e>g?e>=(R>0?V:V+1)*g?1:U%1:U,N?(0===R?(k[0]=jq.u,k[1]=jq.u,k[2]=jq.u+(Yq.u-jq.u)*F,z[0]=Vq.v,z[1]=Vq.v+(Wq.v-Vq.v)*L,z[2]=Vq.v):(0===H?(k[0]=Hq.u,k[1]=Hq.u,k[2]=jq.u):H<n-1?(k[0]=jq.u,k[1]=jq.u,k[2]=jq.u+(Yq.u-jq.u)*F):H===n-1&&(k[0]=Yq.u,k[1]=Yq.u,k[2]=Kq.u),0===V?(z[0]=Hq.v,z[1]=Vq.v,z[2]=Hq.v):V<r-1?(z[0]=Vq.v,z[1]=Vq.v+(Wq.v-Vq.v)*L,z[2]=Vq.v):V===r-1&&(z[0]=Wq.v,z[1]=Xq.v,z[2]=Wq.v)),k[3]=k[2],z[3]=z[1]):(0===R?(k[0]=Vq.u,k[1]=Vq.u+(Wq.u-Vq.u)*L,k[2]=Vq.u,z[0]=jq.v,z[1]=jq.v,z[2]=jq.v+(Yq.v-jq.v)*F):(0===V?(k[0]=Hq.u,k[1]=Vq.u,k[2]=Hq.u):V<r-1?(k[0]=Vq.u,k[1]=Vq.u+(Wq.u-Vq.u)*L,k[2]=Vq.u):V===r-1&&(k[0]=Wq.u,k[1]=Xq.u,k[2]=Wq.u),0===H?(z[0]=Hq.v,z[1]=Hq.v,z[2]=jq.v):H<n-1?(z[0]=jq.v,z[1]=jq.v,z[2]=jq.v+(Yq.v-jq.v)*F):H===n-1&&(z[0]=Yq.v,z[1]=Yq.v,z[2]=Kq.v)),k[3]=k[1],z[3]=z[2]);var W=4*(H*r+V);u[W].u=k[0],u[W].v=z[0],u[W+1].u=k[1],u[W+1].v=z[1],u[W+2].u=k[2],u[W+2].v=z[2],u[W+3].u=k[3],u[W+3].v=z[3]}}},updateColorLate:function(t){for(var e=t.renderData,i=e.chunk.vb,n=e.floatStride,r=e.vertexCount,s=5,a=t.color,o=a.r/255,u=a.g/255,h=a.b/255,l=t.node._uiProps.opacity,c=0;c<r;c++)i[s]=o,i[s+1]=u,i[s+2]=h,i[s+3]=l,s+=n},updateColor:function(){}},iQ=PW.Type,nQ=PW.FillType,rQ=t("spriteAssembler",{getAssembler:function(t){var e=Uq,i=t;switch(i.type){case iQ.SLICED:e=Qq;break;case iQ.TILED:e=eQ;break;case iQ.FILLED:e=i.fillType===nQ.RADIAL?Lq:Tq}return e}});PW.Assembler=rQ;var sQ=[Cw.EventType.MOUSE_DOWN,Cw.EventType.MOUSE_MOVE,Cw.EventType.MOUSE_UP,Cw.EventType.MOUSE_WHEEL],aQ=[Cw.EventType.TOUCH_START,Cw.EventType.TOUCH_MOVE,Cw.EventType.TOUCH_END,Cw.EventType.TOUCH_CANCEL],oQ=(new(function(){function t(){this.priority=pw.UI,this._isListDirty=!1,this._inDispatchCount=0,this._pointerEventProcessorList=[],this._processorListToAdd=[],this._processorListToRemove=[],ww._registerEventDispatcher(this),CA.callbacksInvoker.on(EA.ADD_POINTER_EVENT_PROCESSOR,this.addPointerEventProcessor,this),CA.callbacksInvoker.on(EA.REMOVE_POINTER_EVENT_PROCESSOR,this.removePointerEventProcessor,this),CA.callbacksInvoker.on(EA.MARK_LIST_DIRTY,this._markListDirty,this)}var e=t.prototype;return e.dispatchEvent=function(t){var e=t.type;return aQ.includes(e)?this.dispatchEventTouch(t):!sQ.includes(e)||this.dispatchEventMouse(t)},e.addPointerEventProcessor=function(t){0===this._inDispatchCount?this._pointerEventProcessorList.includes(t)||(this._pointerEventProcessorList.push(t),this._isListDirty=!0):this._processorListToAdd.includes(t)||this._processorListToAdd.push(t),le.array.remove(this._processorListToRemove,t)},e.removePointerEventProcessor=function(t){0===this._inDispatchCount?(le.array.remove(this._pointerEventProcessorList,t),this._isListDirty=!0):this._processorListToRemove.includes(t)||this._processorListToRemove.push(t),le.array.remove(this._processorListToAdd,t)},e.dispatchEventMouse=function(t){this._inDispatchCount++,this._sortPointerEventProcessorList();for(var e=this._pointerEventProcessorList,i=e.length,n=!0,r=0;r<i;++r){var s=e[r];if(s.isEnabled&&s.shouldHandleEventMouse&&s._handleEventMouse(t)){if(n=!1,!t.preventSwallow)break;t.preventSwallow=!1}}return--this._inDispatchCount<=0&&this._updatePointerEventProcessorList(),n},e.dispatchEventTouch=function(t){this._inDispatchCount++,this._sortPointerEventProcessorList();for(var e=this._pointerEventProcessorList,i=e.length,n=t.touch,r=!0,s=0;s<i;++s){var a=e[s];if(a.isEnabled&&a.shouldHandleEventTouch)if(t.type===oA.TOUCH_START){if(a._handleEventTouch(t)){if(a.claimedTouchIdList.push(n.getID()),r=!1,!t.preventSwallow)break;t.preventSwallow=!1}}else if(a.claimedTouchIdList.length>0){var o=a.claimedTouchIdList.indexOf(n.getID());if(-1!==o){if(a._handleEventTouch(t),t.type!==oA.TOUCH_END&&t.type!==oA.TOUCH_CANCEL||le.array.removeAt(a.claimedTouchIdList,o),r=!1,!t.preventSwallow)break;t.preventSwallow=!1}}}return--this._inDispatchCount<=0&&this._updatePointerEventProcessorList(),r},e._updatePointerEventProcessorList=function(){for(var t=this._processorListToAdd,e=t.length,i=0;i<e;++i)this.addPointerEventProcessor(t[i]);t.length=0;for(var n=this._processorListToRemove,r=n.length,s=0;s<r;++s)this.removePointerEventProcessor(n[s]);n.length=0},e._sortPointerEventProcessorList=function(){if(this._isListDirty){for(var t=this._pointerEventProcessorList,e=t.length,i=0;i<e;++i){var n=t[i],r=n.node;if(r._uiProps){var s=r._uiProps.uiTransformComp;n.cachedCameraPriority=s.cameraPriority}}t.sort(this._sortByPriority),this._isListDirty=!1}},e._sortByPriority=function(t,e){var i=t.node,n=e.node;if(!(e&&n&&n.activeInHierarchy&&n._uiProps.uiTransformComp))return-1;if(!(t&&i&&i.activeInHierarchy&&i._uiProps.uiTransformComp))return 1;if(t.cachedCameraPriority!==e.cachedCameraPriority)return e.cachedCameraPriority-t.cachedCameraPriority;for(var r=i,s=n,a=!1;(null===(o=r.parent)||void 0===o?void 0:o._id)!==(null===(u=s.parent)||void 0===u?void 0:u._id);){var o,u,h,l,c,_;r=null===(null===(h=r)||void 0===h||null===(l=h.parent)||void 0===l?void 0:l.parent)?(a=!0)&&n:r&&r.parent,s=null===(null===(c=s)||void 0===c||null===(_=c.parent)||void 0===_?void 0:_.parent)?(a=!0)&&i:s&&s.parent}if(r._id===s._id){if(r._id===n._id)return-1;if(r._id===i._id)return 1}var f=r?r.getSiblingIndex():0,d=s?s.getSiblingIndex():0;return a?f-d:d-f},e._markListDirty=function(){this._isListDirty=!0},t}()),new _s(null)),uQ=new un,hQ=t("UI",function(){function t(t){var e=this;this.device=void 0,this._screens=[],this._staticVBBuffer=null,this._bufferAccessors=new Map,this._drawBatchPool=void 0,this._batches=void 0,this._currBID=-1,this._indexStart=0,this._emptyMaterial=new Vy,this._currRenderData=null,this._currMaterial=this._emptyMaterial,this._currTexture=null,this._currSampler=null,this._currStaticRoot=null,this._currComponent=null,this._currTransform=null,this._currTextureHash=0,this._currSamplerHash=0,this._currLayer=0,this._currDepthStencilStateStage=null,this._currIsStatic=!1,this._currHash=0,this._currIsMiddleware=!1,this._middlewareEnableBatch=!1,this._middlewareBuffer=null,this._middlewareIndexStart=0,this._middlewareIndexCount=0,this._pOpacity=1,this._opacityDirty=0,this._descriptorSetCache=new cQ,this._meshDataArray=[],this._maskClearModel=null,this._maskClearMtl=null,this._maskModelMesh=null,this._root=t,this.device=t.device,this._batches=new ma(64),this._drawBatchPool=new da((function(){return new rY}),128,(function(t){return t.destroy(e)}))}var e=t.prototype;return e.initialize=function(){return!0},e.destroy=function(){for(var t=0;t<this._batches.length;t++)this._batches.array[t]&&this._batches.array[t].destroy(this);this._batches.destroy(),this._bufferAccessors.forEach((function(t){t.destroy()})),this._bufferAccessors.clear(),this._drawBatchPool&&this._drawBatchPool.destroy(),this._descriptorSetCache.destroy(),IG.sharedManager.destroy(),this._maskClearModel&&this._maskModelMesh&&(b.director.root.destroyModel(this._maskClearModel),this._maskModelMesh.destroy()),this._maskClearMtl&&this._maskClearMtl.destroy()},e.syncRootNodesToNative=function(){},e.addScreen=function(t){this._screens.push(t),this._screens.sort(this._screenSort)},e.removeScreen=function(t){var e=this._screens.indexOf(t);-1!==e&&this._screens.splice(e,1)},e.sortScreens=function(){this._screens.sort(this._screenSort)},e.getFirstRenderCamera=function(t){if(t.scene&&t.scene.renderScene)for(var e=t.scene.renderScene.cameras,i=0;i<e.length;i++){var n=e[i];if(n.visibility&t.layer)return n}return null},e.update=function(){for(var t=this._screens,e=0,i=0;i<t.length;++i){var n=t[i],r=n._getRenderScene();if(n.enabledInHierarchy&&r){this._opacityDirty=0,this._pOpacity=1,this.walk(n.node),this.autoMergeBatches(this._currComponent),this.resetRenderStates();var s=0;if(this._batches.length>e)for(;e<this._batches.length;++e){var a=this._batches.array[e];if(a.model)for(var o=a.model.subModels,u=0;u<o.length;u++)o[u].priority=s++;else a.descriptorSet=this._descriptorSetCache.getDescriptorSet(a);r.addBatch(a)}}}},e.uploadBuffers=function(){this._batches.length>0&&(this._meshDataArray.forEach((function(t){t.uploadBuffers()})),this._bufferAccessors.forEach((function(t){t.uploadBuffers(),t.reset()})),this._descriptorSetCache.update())},e.reset=function(){for(var t=0;t<this._batches.length;++t){var e=this._batches.array[t];e.isStatic||(e.clear(),this._drawBatchPool.free(e))}this._bufferAccessors.forEach((function(t){t.reset()})),this._meshDataArray.forEach((function(t){t.freeIAPool()})),this._meshDataArray.length=0,this._staticVBBuffer=null,this._currBID=-1,this._indexStart=0,this._currHash=0,this._currLayer=0,this._currRenderData=null,this._currMaterial=this._emptyMaterial,this._currTexture=null,this._currSampler=null,this._currComponent=null,this._currTransform=null,this._batches.clear(),IG.sharedManager.reset()},e.switchBufferAccessor=function(t){void 0===t&&(t=aG);var e=t===aG?36:cG(t);if(!this._staticVBBuffer||this._staticVBBuffer.vertexFormatBytes!==e){var i=this._bufferAccessors.get(e);i||(i=new SG(this.device,t),this._bufferAccessors.set(e,i)),this._staticVBBuffer=i,this._currBID=-1}return this._staticVBBuffer},e.registerBufferAccessor=function(t,e){this._bufferAccessors.set(t,e)},e.updateBuffer=function(t,e){var i=this.switchBufferAccessor(t);this._currBID!==e&&(this._currBID=e,this._indexStart=i.getMeshBuffer(e).indexOffset)},e.commitComp=function(t,e,i,n,r){var s,a=0,o=-1;if(e&&e.chunk){if(!e.isValid())return;a=e.dataHash,s=e.material,o=e.chunk.bufferId}t.stencilStage===mG.ENTER_LEVEL||t.stencilStage===mG.ENTER_LEVEL_INVERTED?this._insertMaskBatch(t):t.stencilStage=IG.sharedManager.stage;var u=t.stencilStage;this._currHash===a&&0!==a&&this._currMaterial===s&&this._currDepthStencilStateStage===u||(this.autoMergeBatches(this._currComponent),e&&!e._isMeshBuffer&&this.updateBuffer(e.vertexFormat,o),this._currRenderData=e,this._currHash=e?e.dataHash:0,this._currComponent=t,this._currTransform=r,this._currMaterial=t.getRenderMaterial(0),this._currDepthStencilStateStage=u,this._currLayer=t.node.layer,i?(this._currTexture=i.getGFXTexture(),this._currSampler=i.getGFXSampler(),this._currTextureHash=i.getHash(),this._currSamplerHash=this._currSampler.hash):(this._currTexture=null,this._currSampler=null,this._currTextureHash=0,this._currSamplerHash=0)),n.fillBuffers(t,this)},e.commitIA=function(t,e,i,n,r){var s;this._currMaterial!==this._emptyMaterial&&(this.autoMergeBatches(this._currComponent),this.resetRenderStates());var a=0;t&&(t.stencilStage=IG.sharedManager.stage,s=null!==t.customMaterial?IG.sharedManager.getStencilStage(t.stencilStage,n):IG.sharedManager.getStencilStage(t.stencilStage),a=IG.sharedManager.getStencilHash(t.stencilStage));var o=this._currStaticRoot?this._currStaticRoot._requireDrawBatch():this._drawBatchPool.alloc();o.visFlags=t.node.layer,o.inputAssembler=e,o.useLocalData=r||null,i&&(o.texture=i.getGFXTexture(),o.sampler=i.getGFXSampler(),o.textureHash=i.getHash(),o.samplerHash=o.sampler.hash),o.fillPasses(n||null,s,a,null),this._batches.push(o)},e.commitMiddleware=function(t,e,i,n,r,s,a){var o=r.getGFXTexture();a&&this._middlewareEnableBatch&&this._middlewareBuffer===e&&this._currTexture===o&&this._currMaterial.hash===s.hash&&this._middlewareIndexStart+this._middlewareIndexCount===i&&this._currLayer===t.node.layer?this._middlewareIndexCount+=n:(this.autoMergeBatches(this._currComponent),this.resetRenderStates(),this._currComponent=t,this._currTexture=o,this._currSampler=r.getGFXSampler(),this._currTextureHash=r.getHash(),this._currLayer=t.node.layer,this._currSamplerHash=this._currSampler.hash,this._currHash=0,this._currTransform=a?null:t.node,this._middlewareEnableBatch=a,this._middlewareBuffer=e,this._currMaterial=s,this._middlewareIndexStart=i,this._middlewareIndexCount=n),this._currIsMiddleware=!0},e.commitModel=function(t,e,i){var n;this._currMaterial!==this._emptyMaterial&&(this.autoMergeBatches(this._currComponent),this.resetRenderStates());var r=0;i&&(t.stencilStage===mG.ENTER_LEVEL||t.stencilStage===mG.ENTER_LEVEL_INVERTED?this._insertMaskBatch(t):t.stencilStage=IG.sharedManager.stage,n=IG.sharedManager.getStencilStage(t.stencilStage,i),r=IG.sharedManager.getStencilHash(t.stencilStage));var s=b.director.getTotalFrames();e&&(e.updateTransform(s),e.updateUBOs(s));for(var a=0;a<e.subModels.length;a++){var o=this._drawBatchPool.alloc(),u=e.subModels[a];o.visFlags=t.node.layer,o.model=e,o.texture=null,o.sampler=null,o.useLocalData=null,n||(n=null),o.fillPasses(i,n,r,u.patches),o.inputAssembler=u.inputAssembler,o.model.visFlags=o.visFlags,o.descriptorSet=u.descriptorSet,this._batches.push(o)}},e.setupStaticBatch=function(t,e){this.finishMergeBatches(),this._staticVBBuffer=e,this.currStaticRoot=t},e.endStaticBatch=function(){this.finishMergeBatches(),this.currStaticRoot=null,this._staticVBBuffer=null,this.switchBufferAccessor()},e.commitStaticBatch=function(t){this._batches.concat(t.drawBatchList),this.finishMergeBatches()},e.autoMergeBatches=function(t){if(this._currIsMiddleware)this.mergeBatchesForMiddleware(t);else{var e=this._currMaterial;if(e){var i,n=this._currRenderData,r=this._staticVBBuffer;if(n&&n._isMeshBuffer)i=n.requestIA(this.device),-1===this._meshDataArray.indexOf(n)&&this._meshDataArray.push(n);else if(r){var s=this._currBID,a=r.getMeshBuffer(s);if(!a)return;var o=a.indexOffset-this._indexStart;if(o<=0)return;this._indexStart,a.indexOffset,a.setDirty(),(i=a.requireFreeIA(this.device)).firstIndex=this._indexStart,i.indexCount=o,this._indexStart=a.indexOffset}if(this._currBID=-1,i){var u,h=0;t&&(u=null!==t.customMaterial?IG.sharedManager.getStencilStage(t.stencilStage,e):IG.sharedManager.getStencilStage(t.stencilStage),h=IG.sharedManager.getStencilHash(t.stencilStage));var l=this._currStaticRoot?this._currStaticRoot._requireDrawBatch():this._drawBatchPool.alloc();l.visFlags=this._currLayer,l.texture=this._currTexture,l.sampler=this._currSampler,l.inputAssembler=i,l.useLocalData=this._currTransform,l.textureHash=this._currTextureHash,l.samplerHash=this._currSamplerHash,l.fillPasses(e,u,h,null),this._batches.push(l)}}}},e.mergeBatchesForMiddleware=function(t){var e,i;t.stencilStage=IG.sharedManager.stage,e=null!==t.customMaterial?IG.sharedManager.getStencilStage(t.stencilStage,this._currMaterial):IG.sharedManager.getStencilStage(t.stencilStage),i=IG.sharedManager.getStencilHash(t.stencilStage);var n=this._currStaticRoot?this._currStaticRoot._requireDrawBatch():this._drawBatchPool.alloc();n.visFlags=t.node.layer;var r=this._middlewareBuffer.requireFreeIA(this.device);r.firstIndex=this._middlewareIndexStart,r.indexCount=this._middlewareIndexCount,n.inputAssembler=r,n.useLocalData=this._currTransform,n.texture=this._currTexture,n.sampler=this._currSampler,n.textureHash=this._currTextureHash,n.samplerHash=this._currSamplerHash,n.fillPasses(this._currMaterial||null,e,i,null),this._batches.push(n),this._currIsMiddleware=!1,this._middlewareBuffer=null},e.forceMergeBatches=function(t,e,i){this._currMaterial=t,e?(this._currTexture=e.getGFXTexture(),this._currSampler=e.getGFXSampler(),this._currTextureHash=e.getHash(),this._currSamplerHash=this._currSampler.hash):(this._currTexture=this._currSampler=null,this._currTextureHash=this._currSamplerHash=0),this._currLayer=i.node.layer,this.autoMergeBatches(i)},e.resetRenderStates=function(){this._currMaterial=this._emptyMaterial,this._currRenderData=null,this._currTexture=null,this._currComponent=null,this._currTransform=null,this._currTextureHash=0,this._currSamplerHash=0,this._currLayer=0},e.finishMergeBatches=function(){this.autoMergeBatches(),this.resetRenderStates()},e.flushMaterial=function(t){this._currMaterial=t},e.walk=function(t,e){if(void 0===e&&(e=0),t.activeInHierarchy){var i=t.children,n=t._uiProps,r=n.uiComp,s=this._pOpacity,a=s,o=r&&r.color?r.color.a/255:1;if(this._pOpacity=a*=o*n.localOpacity,n._opacity=a,n.colorDirty&&this._opacityDirty++,r&&r.enabledInHierarchy&&r.fillBuffers(this),this._opacityDirty&&r&&!r.useVertexOpacity&&r.renderData&&r.renderData.vertexCount>0){!function(t,e){for(var i,n,r,s=t.vertexFormat,a=t.chunk.vb,o=0,u=0;u<s.length;++u){if(i=s[u],(n=As[i.format]).hasAlpha)if(r=t.floatStride,n.size/n.count==1)for(var h=~~vi(Math.round(255*e),0,255),l=o;l<a.length;l+=r)a[l]=(4294967040&a[l]|h)>>>0;else if(n.size/n.count==4)for(var c=o+3;c<a.length;c+=r)a[c]=e;o+=n.size>>2}}(r.renderData,a);var u=r.renderData.getMeshBuffer();u&&u.setDirty()}if(i.length>0&&!t._static)for(var h=0;h<i.length;++h){var l=i[h];this.walk(l,e)}n.colorDirty&&(this._opacityDirty--,n.colorDirty=!1),this._pOpacity=s,r&&r.enabledInHierarchy&&(r.postUpdateAssembler(this),(r.stencilStage===mG.ENTER_LEVEL||r.stencilStage===mG.ENTER_LEVEL_INVERTED)&&IG.sharedManager.getMaskStackSize()>0&&(this.autoMergeBatches(this._currComponent),this.resetRenderStates(),IG.sharedManager.exitMask())),e+=1}},e._screenSort=function(t,e){return t.node.getSiblingIndex()-e.node.getSiblingIndex()},e._releaseDescriptorSetCache=function(t){this._descriptorSetCache.releaseDescriptorSetCache(t)},e._createClearModel=function(){if(!this._maskClearModel){this._maskClearMtl=vy.get("default-clear-stencil"),this._maskClearModel=b.director.root.createModel(mB);var t=cG(rG),e=Ja.gfxDevice,i=e.createBuffer(new Mr(Dn.VERTEX|Dn.TRANSFER_DST,Mn.DEVICE,4*t,t)),n=new Float32Array([-1,-1,0,1,-1,0,-1,1,0,1,1,0]);i.update(n);var r=e.createBuffer(new Mr(Dn.INDEX|Dn.TRANSFER_DST,Mn.DEVICE,6*Uint16Array.BYTES_PER_ELEMENT,Uint16Array.BYTES_PER_ELEMENT)),s=new Uint16Array([0,1,2,2,1,3]);r.update(s),this._maskModelMesh=new wN([i],rG,er.TRIANGLE_LIST,r),this._maskModelMesh.subMeshIdx=0,this._maskClearModel.initSubModel(0,this._maskModelMesh,this._maskClearMtl)}},e._insertMaskBatch=function(t){this.autoMergeBatches(this._currComponent),this.resetRenderStates(),this._createClearModel(),this._maskClearModel.node=this._maskClearModel.transform=t.node;var e=IG.sharedManager;e.pushMask(1);var i,n=e.clear(t),r=0,s=this._maskClearMtl;s&&(i=e.getStencilStage(n,s),r=e.getStencilHash(n));var a=this._maskClearModel,o=b.director.getTotalFrames();a&&(a.updateTransform(o),a.updateUBOs(o));for(var u=0;u<a.subModels.length;u++){var h=this._drawBatchPool.alloc(),l=a.subModels[u];h.visFlags=t.node.layer,h.model=a,h.texture=null,h.sampler=null,h.useLocalData=null,i||(i=null),h.fillPasses(s,i,r,l.patches),h.inputAssembler=l.inputAssembler,h.model.visFlags=h.visFlags,h.descriptorSet=l.descriptorSet,this._batches.push(h)}e.enableMask()},e.syncMeshBuffersToNative=function(){},h(t,[{key:"nativeObj",get:function(){return this._nativeObj}},{key:"currBufferAccessor",get:function(){return this._staticVBBuffer||(this._staticVBBuffer=this.switchBufferAccessor()),this._staticVBBuffer}},{key:"batches",get:function(){return this._batches}},{key:"currStaticRoot",set:function(t){this._currStaticRoot=t}},{key:"currIsStatic",set:function(t){this._currIsStatic=t}}]),t}()),lQ=function(){function t(){this._descriptorSet=null,this._transform=null,this._textureHash=0,this._samplerHash=0,this._localBuffer=null,this._transformUpdate=!0;var t=Ja.gfxDevice;this._localData=new Float32Array(Pp.COUNT),this._localBuffer=t.createBuffer(new Mr(Dn.UNIFORM|Dn.TRANSFER_DST,Mn.HOST|Mn.DEVICE,Pp.SIZE,Pp.SIZE))}var e=t.prototype;return e.initialize=function(t){var e=Ja.gfxDevice;this._transform=t.useLocalData,this._textureHash=t.textureHash,this._samplerHash=t.samplerHash,oQ.layout=t.passes[0].localSetLayout,this._descriptorSet=e.createDescriptorSet(oQ),this._descriptorSet.bindBuffer(Pp.BINDING,this._localBuffer);var i=op.SAMPLER_SPRITE;this._descriptorSet.bindTexture(i,t.texture),this._descriptorSet.bindSampler(i,t.sampler),this._descriptorSet.update(),this._transformUpdate=!0},e.updateTransform=function(t){t!==this._transform&&(this._transform=t,this._transformUpdate=!0,this.uploadLocalData())},e.equals=function(t,e,i){return this._transform===t&&this._textureHash===e&&this._samplerHash===i},e.reset=function(){this._transform=null,this._textureHash=0,this._samplerHash=0},e.destroy=function(){this._localBuffer&&(this._localBuffer.destroy(),this._localBuffer=null),this._descriptorSet&&(this._descriptorSet.destroy(),this._descriptorSet=null),this._localData=null},e.isValid=function(){return this._transform&&this._transform.isValid},e.uploadLocalData=function(){var t=this._transform;if((t.hasChangedFlags||t._dirtyFlags)&&(t.updateWorldTransform(),this._transformUpdate=!0),this._transformUpdate){var e=t.worldMatrix;un.toArray(this._localData,e,Pp.MAT_WORLD_OFFSET),un.inverseTranspose(uQ,e);var i=un.determinant(uQ),n=1/Math.sqrt(i);un.multiplyScalar(uQ,uQ,n),un.toArray(this._localData,uQ,Pp.MAT_WORLD_IT_OFFSET),this._localBuffer.update(this._localData),this._transformUpdate=!1}},h(t,[{key:"descriptorSet",get:function(){return this._descriptorSet}}]),t}(),cQ=function(){function t(){this._descriptorSetCache=new Map,this._dsCacheHashByTexture=new Map,this._localDescriptorSetCache=[],this._localCachePool=void 0,this._localCachePool=new da((function(){return new lQ}),16,(function(t){return t.destroy()}))}var e=t.prototype;return e.getDescriptorSet=function(t){var e;if(b.director.root,t.useLocalData){for(var i=this._localDescriptorSetCache,n=0,r=i.length;n<r;n++){var s=i[n];if(s.equals(t.useLocalData,t.textureHash,t.samplerHash))return s.descriptorSet}var a=this._localCachePool.alloc();return a.initialize(t),this._localDescriptorSetCache.push(a),a.descriptorSet}if(e=t.textureHash^t.samplerHash,this._descriptorSetCache.has(e))return this._descriptorSetCache.get(e);oQ.layout=t.passes[0].localSetLayout;var o=Ja.gfxDevice.createDescriptorSet(oQ),u=op.SAMPLER_SPRITE;return o.bindTexture(u,t.texture),o.bindSampler(u,t.sampler),o.update(),this._descriptorSetCache.set(e,o),this._dsCacheHashByTexture.set(t.textureHash,e),o},e.update=function(){var t=this._localDescriptorSetCache,e=[];t.forEach((function(i){if(i.isValid())i.uploadLocalData();else{i.reset();var n=t.indexOf(i);e.push(n)}}));for(var i=e.length-1;i>=0;i--)t.splice(e[i],1)},e.reset=function(){var t=this;this._localDescriptorSetCache.forEach((function(e){t._localCachePool.free(e)})),this._localDescriptorSetCache.length=0},e.releaseDescriptorSetCache=function(t){var e=this._dsCacheHashByTexture.get(t);e&&this._descriptorSetCache.has(e)&&(this._descriptorSetCache.get(e).destroy(),this._descriptorSetCache.delete(e),this._dsCacheHashByTexture.delete(t))},e.destroy=function(){this._descriptorSetCache.forEach((function(t){t.destroy()})),this._descriptorSetCache.clear(),this._dsCacheHashByTexture.clear(),this._localDescriptorSetCache.length=0,this._localCachePool.destroy()},t}();b.internal.Batcher2D=hQ,t("UIDrawBatch",function(t){function e(){return t.apply(this,arguments)||this}return c(e,t),e}(rY)),nt(vG.prototype,"MeshBuffer",["byteStart","vertexStart","indicesStart","request"].map((function(t){return{name:t,suggest:"please use meshBuffer.accessor."+t+" instead"}}))),et(vG.prototype,"MeshBuffer",[{name:"indicesOffset",newName:"indexOffset"}]),it(vG.prototype,"MeshBuffer",[{name:"vertexBuffers"},{name:"indexBuffer"}]),et(hQ.prototype,"Batcher2D",[{name:"currBufferBatch",newName:"currBufferAccessor"},{name:"acquireBufferBatch",newName:"switchBufferAccessor"}]),it(dk.prototype,"MeshRenderData",[{name:"formatByte"},{name:"byteStart"},{name:"byteCount"}]),et(dk.prototype,"MeshRenderData",[{name:"indicesStart",newName:"indexStart"}]),t("QuadRenderData",function(t){function e(e){var i;return i=t.call(this,e)||this,j(9006),i}return c(e,t),e}(dk));var _Q,fQ=null,dQ=-1,pQ="BES bswy:->@123丁ぁᄁ",mQ=Object.create(null),gQ=[],vQ=3e3;function yQ(){for(var t=!0,e=Date.now(),i=gQ.length-1;i>=0;i--){var n=gQ[i],r=n.fontFamilyName;if(e-n.startTime>vQ)j(4933,r),n.onComplete(null,r),gQ.splice(i,1);else{var s=n.refWidth,a="40px "+r;fQ.font=a,s!==WU(fQ,pQ,a)?(gQ.splice(i,1),n.onComplete(null,r)):t=!1}}t&&(clearInterval(dQ),dQ=-1)}function EQ(t,e,i){var n=function(t){var e=t.lastIndexOf(".ttf");if(-1===e)return t;var i,n=t.lastIndexOf("/");return-1!==(i=-1===n?t.substring(0,e)+"_LABEL":t.substring(n+1,e)+"_LABEL").indexOf(" ")&&(i='"'+i+'"'),i}(t);if(mQ[n])i(null,n);else{if(!fQ){var r=document.createElement("canvas");r.width=100,r.height=100,fQ=r.getContext("2d")}var s=WU(fQ,pQ,"40px "+n),a=document.createElement("style");a.type="text/css";var o="";Number.isNaN(n)?o+="@font-face { font-family:"+n+"; src:":o+='@font-face { font-family:"'+n+'"; src:',o+='url("'+t+'");',a.textContent=o+"}",document.body.appendChild(a);var u=document.createElement("div"),h=u.style;if(h.fontFamily=n,u.innerHTML=".",h.position="absolute",h.left="-100px",h.top="-100px",document.body.appendChild(u),function(){if(void 0===_Q)if("FontFace"in window){var t=/Gecko.*Firefox\/(\d+)/.exec(window.navigator.userAgent),e=/OS X.*Version\/10\..*Safari/.exec(window.navigator.userAgent)&&/Apple/.exec(window.navigator.vendor);_Q=t?parseInt(t[1],10)>42:!e}else _Q=!1;return _Q}())!function(t,e,i){var n=new Promise((function(i,n){!function r(){Date.now()-t>=vQ?n():document.fonts.load("40px "+e).then((function(t){t.length>=1?i():setTimeout(r,100)}),(function(){n()}))}()})),r=null,s=new Promise((function(t,e){r=setTimeout(e,vQ)}));Promise.race([s,n]).then((function(){r&&(clearTimeout(r),r=null),i(null,e)}),(function(){j(4933,e),i(null,e)}))}(Date.now(),n,i);else{var l={fontFamilyName:n,refWidth:s,onComplete:i,startTime:Date.now()};gQ.push(l),-1===dQ&&(dQ=setInterval(yQ,100))}mQ[n]=a}}function TQ(t,e,i,n){var r=new CU;r._nativeUrl=t,r._nativeAsset=e,n(null,r)}Gv.register({".font":EQ,".eot":EQ,".ttf":EQ,".woff":EQ,".svg":EQ,".ttc":EQ}),Zv.register({".font":TQ,".eot":TQ,".ttf":TQ,".woff":TQ,".svg":TQ,".ttc":TQ}),b.UI={MeshBuffer:vG,spriteAssembler:rQ,graphicsAssembler:XY,labelAssembler:mq,RenderData:fk,MeshRenderData:dk};var SQ,AQ,RQ,bQ,CQ,wQ,IQ,OQ=Symbol("CreateEval"),xQ=(_h("cc.animation.EmbeddedPlayer")((wQ=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return E(e=t.call.apply(t,[this].concat(n))||this,"begin",AQ,g(e)),E(e,"end",RQ,g(e)),E(e,"reconciledSpeed",bQ,g(e)),E(e,"playable",CQ,g(e)),e}return c(e,t),e}(Qh),AQ=T((SQ=wQ).prototype,"begin",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),RQ=T(SQ.prototype,"end",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),bQ=T(SQ.prototype,"reconciledSpeed",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),CQ=T(SQ.prototype,"playable",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),SQ)),function(){}),PQ=function(){function t(t){this._randomAccess=t}return t.prototype.setTime=function(){},h(t,[{key:"randomAccess",get:function(){return this._randomAccess}}]),t}(),DQ=function(){function t(){this._isPlaying=!1,this._isPaused=!1,this._stepOnce=!1}var e=t.prototype;return e.play=function(){this._isPlaying?this._isPaused?(this._isPaused=!1,this.onResume()):this.onError(J(3912)):(this._isPlaying=!0,this.onPlay())},e.stop=function(){this._isPlaying&&(this._isPlaying=!1,this.onStop(),this._isPaused=!1)},e.pause=function(){this._isPlaying&&!this._isPaused&&(this._isPaused=!0,this.onPause())},e.resume=function(){this._isPlaying&&this._isPaused&&(this._isPaused=!1,this.onResume())},e.step=function(){this.pause(),this._stepOnce=!0,this._isPlaying||this.play()},e.update=function(){},e.onPlay=function(){},e.onPause=function(){},e.onResume=function(){},e.onStop=function(){},e.onError=function(){},h(t,[{key:"isPlaying",get:function(){return this._isPlaying}},{key:"isPaused",get:function(){return this._isPaused}},{key:"isMotionless",get:function(){return!this.isPlaying||this.isPaused}}]),t}(),BQ=function(){function t(t){this.weight=0,this._pose=void 0,this._blendStateWriters=[],this._pose=t}var e=t.prototype;return e.destroy=function(){for(var t=0;t<this._blendStateWriters.length;++t)this._pose.destroyWriter(this._blendStateWriters[t]);this._blendStateWriters.length=0},e.createPoseWriter=function(t,e,i){var n=this._pose.createWriter(t,e,this,i);return this._blendStateWriters.push(n),n},t}();function NQ(){return b.director.getAnimationManager()}!function(t){t.PLAY="play",t.STOP="stop",t.PAUSE="pause",t.RESUME="resume",t.LASTFRAME="lastframe",t.FINISHED="finished"}(IQ||(IQ={})),pe(IQ);var MQ,LQ,FQ,UQ,GQ=t("AnimationState",function(t){function e(e,i){var n;return void 0===i&&(i=""),(n=t.call(this)||this).duration=1,n.time=0,n.frameRate=0,n._targetNode=null,n._curveLoaded=!1,n._clip=void 0,n._speed=1,n._useSimpleProcess=!1,n._target=null,n._wrapMode=Xu.Normal,n._repeatCount=1,n._delay=0,n._delayTime=0,n._currentFramePlayed=!1,n._name=void 0,n._lastIterations=NaN,n._lastWrapInfo=null,n._wrappedInfo=new Zu,n._allowLastFrame=!1,n._blendStateWriterHost={weight:0},n._playbackDuration=0,n._invDuration=1,n._poseOutput=null,n._weight=1,n._clipEval=void 0,n._clipEventEval=void 0,n._clipEmbeddedPlayerEval=void 0,n._doNotCreateEval=!1,n._clip=e,n._name=i||e&&e.name,n._playbackRange={min:0,max:e.duration},n._playbackDuration=e.duration,e.duration||G("Clip "+e.name+" has zero duration."),n}c(e,t);var i=e.prototype;return i.initialize=function(t,e,i){if(!this._curveLoaded){this._curveLoaded=!0,this._poseOutput&&(this._poseOutput.destroy(),this._poseOutput=null),this._clipEval&&(this._clipEval=void 0),this._clipEventEval&&(this._clipEventEval=void 0),this._clipEmbeddedPlayerEval&&(this._clipEmbeddedPlayerEval.destroy(),this._clipEmbeddedPlayerEval=void 0),this._targetNode=t;var n=this._clip;if(this.duration=n.duration,this._invDuration=1/this.duration,this._speed=n.speed,this.wrapMode=n.wrapMode,this.frameRate=n.sample,this._playbackRange.min=0,this._playbackRange.max=n.duration,this._playbackDuration=n.duration,(this.wrapMode&Wu.Loop)===Wu.Loop?this.repeatCount=1/0:this.repeatCount=1,!this._doNotCreateEval){var r,s,a,o=null!==(r=null!=e?e:null===(s=NQ())||void 0===s?void 0:s.blendState)&&void 0!==r?r:null;o&&(this._poseOutput=new BQ(o)),this._clipEval=n.createEvaluator({target:t,pose:null!==(a=this._poseOutput)&&void 0!==a?a:void 0,mask:i})}n.containsAnyEvent()&&(this._clipEventEval=n.createEventEvaluator(this._targetNode)),n.containsAnyEmbeddedPlayer()&&(this._clipEmbeddedPlayerEval=n.createEmbeddedPlayerEvaluator(this._targetNode),this._clipEmbeddedPlayerEval.notifyHostSpeedChanged(this._speed))}},i.destroy=function(){this.isMotionless||NQ().removeAnimation(this),this._poseOutput&&(this._poseOutput.destroy(),this._poseOutput=null),this._clipEval=void 0},i.emit=function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];NQ().pushDelayEvent(this._emit,this,e)},i.on=function(t,e,i){return this._target&&this._target.isValid?this._target.on(t,e,i):null},i.once=function(t,e,i){return this._target&&this._target.isValid?this._target.once(t,e,i):null},i.off=function(t,e,i){this._target&&this._target.isValid&&this._target.off(t,e,i)},i.allowLastFrameEvent=function(t){this._allowLastFrame=t},i._setEventTarget=function(t){this._target=t},i.setTime=function(t){this._currentFramePlayed=!1,this.time=t||0;var e,i=this.getWrappedInfo(t,this._wrappedInfo);null===(e=this._clipEventEval)||void 0===e||e.ignore(i.ratio,i.direction)},i.update=function(t){this._delayTime>0&&(this._delayTime-=t,this._delayTime>0)||(this._currentFramePlayed?this.time+=t*this._speed:this._currentFramePlayed=!0,this._process())},i.sample=function(){var t=this.getWrappedInfo(this.time,this._wrappedInfo);return this._sampleCurves(t.time),this._sampleEvents(t),this._sampleEmbeddedPlayers(t),t},i.onPlay=function(){var t;this.setTime(this._getPlaybackStart()),this._delayTime=this._delay,this._onReplayOrResume(),this.emit(IQ.PLAY,this),null===(t=this._clipEmbeddedPlayerEval)||void 0===t||t.notifyHostPlay(this.current)},i.onStop=function(){var t;this.isPaused||this._onPauseOrStop(),this.emit(IQ.STOP,this),null===(t=this._clipEmbeddedPlayerEval)||void 0===t||t.notifyHostStop()},i.onResume=function(){var t;this._onReplayOrResume(),this.emit(IQ.RESUME,this),null===(t=this._clipEmbeddedPlayerEval)||void 0===t||t.notifyHostPlay(this.current)},i.onPause=function(){var t;this._onPauseOrStop(),this.emit(IQ.PAUSE,this),null===(t=this._clipEmbeddedPlayerEval)||void 0===t||t.notifyHostPause(this.current)},i._sampleCurves=function(t){var e=this._poseOutput,i=this._clipEval;e&&(e.weight=this.weight),i&&i.evaluate(t)},i._process=function(){this._useSimpleProcess?this.simpleProcess():this.process()},i.process=function(){var t,e=this.sample();this._allowLastFrame&&(t=this._lastWrapInfo?this._lastWrapInfo:this._lastWrapInfo=new Zu(e),this.repeatCount>1&&(0|e.iterations)>(0|t.iterations)&&this.emit(IQ.LASTFRAME,this),t.set(e)),e.stopped&&(this.stop(),this.emit(IQ.FINISHED,this))},i.simpleProcess=function(){var t=this._playbackRange.min,e=this._playbackDuration,i=0,n=0;if(0!==e&&((i=this.time%e)<0&&(i+=e),n=(t+i)*this._invDuration),this._sampleCurves(t+i),this._clipEventEval||this._clipEmbeddedPlayerEval){var r=this.getWrappedInfo(this.time,this._wrappedInfo);this._sampleEvents(r),this._sampleEmbeddedPlayers(r)}this._allowLastFrame&&(Number.isNaN(this._lastIterations)&&(this._lastIterations=n),(this.time>0&&this._lastIterations>n||this.time<0&&this._lastIterations<n)&&this.emit(IQ.LASTFRAME,this),this._lastIterations=n)},i._needReverse=function(t){var e=this.wrapMode,i=!1;return(e&Wu.PingPong)===Wu.PingPong&&(t-(0|t)==0&&t>0&&(t-=1),1&t&&(i=!i)),(e&Wu.Reverse)===Wu.Reverse&&(i=!i),i},i.getWrappedInfo=function(t,e){e=e||new Zu;var i=this._playbackRange.min,n=this._playbackDuration,r=this.repeatCount;if(0===n)return e.time=0,e.ratio=0,e.direction=1,e.stopped=!!Number.isFinite(r),e.iterations=0,e;var s=!1,a=(t-=i)>0?t/n:-t/n;if(a>=r){a=r,s=!0;var o=r-(0|r);0===o&&(o=1),t=o*n*(t>0?1:-1)}if(t>n){var u=t%n;t=0===u?n:u}else t<0&&0!=(t%=n)&&(t+=n);var h=!1,l=this._wrapMode&Wu.ShouldWrap;l&&(h=this._needReverse(a));var c=h?-1:1;return this.speed<0&&(c*=-1),l&&h&&(t=n-t),e.time=i+t,e.ratio=e.time/this.duration,e.direction=c,e.stopped=s,e.iterations=a,e},i._getPlaybackStart=function(){return this._playbackRange.min},i._sampleEvents=function(t){var e;null===(e=this._clipEventEval)||void 0===e||e.sample(t.ratio,t.direction,t.iterations)},i._sampleEmbeddedPlayers=function(t){var e;null===(e=this._clipEmbeddedPlayerEval)||void 0===e||e.evaluate(t.time,Math.trunc(t.iterations))},i._emit=function(t,e){this._target&&this._target.isValid&&this._target.emit(t,t,e)},i._onReplayOrResume=function(){NQ().addAnimation(this)},i._onPauseOrStop=function(){NQ().removeAnimation(this)},h(e,[{key:"clip",get:function(){return this._clip}},{key:"name",get:function(){return this._name}},{key:"length",get:function(){return this.duration}},{key:"wrapMode",get:function(){return this._wrapMode},set:function(t){var e;this._wrapMode=t,this.time=0,t&Wu.Loop?this.repeatCount=1/0:this.repeatCount=1,null===(e=this._clipEventEval)||void 0===e||e.setWrapMode(t)}},{key:"repeatCount",get:function(){return this._repeatCount},set:function(t){this._repeatCount=t;var e=this._wrapMode&Wu.ShouldWrap,i=(this.wrapMode&Wu.Reverse)===Wu.Reverse;this._useSimpleProcess=t===1/0&&!e&&!i}},{key:"delay",get:function(){return this._delay},set:function(t){this._delayTime=this._delay=t}},{key:"playbackRange",get:function(){return this._playbackRange},set:function(t){t.max,t.min,this._playbackRange.min=Math.max(t.min,0),this._playbackRange.max=Math.min(t.max,this.duration),this._playbackDuration=this._playbackRange.max-this._playbackRange.min,this.setTime(0)}},{key:"speed",get:function(){return this._speed},set:function(t){var e;this._speed=t,null===(e=this._clipEmbeddedPlayerEval)||void 0===e||e.notifyHostSpeedChanged(t)}},{key:"current",get:function(){return this.getWrappedInfo(this.time).time}},{key:"ratio",get:function(){return 0===this.duration?0:this.current/this.duration}},{key:"weight",get:function(){return this._weight},set:function(t){this._weight=t,this._poseOutput&&(this._poseOutput.weight=t)}},{key:"curveLoaded",get:function(){return this._curveLoaded}}]),e}(DQ));b.AnimationState=GQ,_h("cc.animation.EmbeddedAnimationClipPlayable")((UQ=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return E(e=t.call.apply(t,[this].concat(n))||this,"path",LQ,g(e)),E(e,"clip",FQ,g(e)),e}return c(e,t),e.prototype.instantiate=function(t){var e=this.clip,i=this.path;if(!e)return null;var n=t.getChildByPath(i);if(!n)return K(3938,i,t.getPathInHierarchy(),e.name),null;var r=new GQ(e);return r.initialize(n),new ZQ(r)},e}(xQ),LQ=T((MQ=UQ).prototype,"path",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),FQ=T(MQ.prototype,"clip",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),MQ));var kQ,zQ,HQ,VQ,WQ,XQ,jQ,YQ,KQ,qQ,QQ,ZQ=function(t){function e(e){var i;return(i=t.call(this,!0)||this)._animationState=void 0,i._animationState=e,i}c(e,t);var i=e.prototype;return i.destroy=function(){this._animationState.destroy()},i.play=function(){this._animationState.play()},i.pause=function(){this._animationState.pause()},i.stop=function(){this._animationState.stop()},i.setSpeed=function(t){this._animationState.speed=t},i.setTime=function(t){this._animationState.time=t},e}(PQ),JQ=(_h("cc.animation.EmbeddedParticleSystemPlayable")((HQ=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return E(e=t.call.apply(t,[this].concat(n))||this,"path",zQ,g(e)),e}return c(e,t),e.prototype.instantiate=function(t){var e=t.getChildByPath(this.path);if(!e)return L("Hierarchy path "+this.path+" does not exists."),null;var i=se("cc.ParticleSystem");if(!i)return L("Particle system is required for embedded particle system player."),null;var n=e.getComponent(i);return n?new JQ(n):(L(this.path+" does not includes a particle system component."),null)},e}(xQ),zQ=T((kQ=HQ).prototype,"path",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),kQ)),function(t){function e(e){var i;return(i=t.call(this,!1)||this)._particleSystem=void 0,i._particleSystem=e,i}c(e,t);var i=e.prototype;return i.destroy=function(){},i.play=function(){this._particleSystem.play()},i.pause=function(){this._particleSystem.stopEmitting()},i.stop=function(){this._particleSystem.stopEmitting()},i.setSpeed=function(t){this._particleSystem.simulationSpeed=t},e}(PQ));function $Q(t){return"string"==typeof t||"number"==typeof t}var tZ,eZ,iZ,nZ,rZ,sZ,aZ,oZ,uZ,hZ,lZ,cZ,_Z,fZ,dZ,pZ,mZ,gZ,vZ,yZ,EZ,TZ,SZ,AZ,RZ,bZ,CZ,wZ,IZ,OZ,xZ,PZ,DZ,BZ,NZ,MZ,LZ,FZ,UZ,GZ,kZ,zZ,HZ,VZ,WZ,XZ,jZ,YZ=_h("cc.animation.HierarchyPath")((jQ=function(){function t(t){E(this,"path",XQ,this),this.path=t||""}return t.prototype.get=function(t){return t instanceof jE?t.getChildByPath(this.path)||(j(3926,t.name,this.path),null):(j(3925),null)},t}(),XQ=T((WQ=jQ).prototype,"path",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),VQ=WQ))||VQ,KZ=_h("cc.animation.ComponentPath")((QQ=function(){function t(t){E(this,"component",qQ,this),this.component=t||""}return t.prototype.get=function(t){return t instanceof jE?t.getComponent(this.component)||(j(3928,t.name,this.component),null):(j(3927),null)},t}(),qQ=T((KQ=QQ).prototype,"component",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),YQ=KQ))||YQ,qZ=Symbol("NormalizedFollow"),QZ=Symbol("ConvertAsTrsPath"),ZZ=Symbol("TrackBinding"),JZ=_h("cc.animation.TrackPath")((nZ=function(){function t(){E(this,"_paths",iZ,this)}var e=t.prototype;return e.toProperty=function(t){return this._paths.push(t),this},e.toElement=function(t){return this._paths.push(t),this},e.toHierarchy=function(t){return this._paths.push(new YZ(t)),this},e.toComponent=function(t){var e=new KZ("string"==typeof t?t:le.getClassName(t));return this._paths.push(e),this},e.toCustomized=function(t){return this._paths.push(t),this},e.append=function(){for(var t,e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];var r=(t=this._paths).concat.apply(t,i.map((function(t){return t._paths})));return this._paths=r,this},e.isPropertyAt=function(t){return"string"==typeof this._paths[t]},e.parsePropertyAt=function(t){return this._paths[t]},e.isElementAt=function(t){return"number"==typeof this._paths[t]},e.parseElementAt=function(t){return this._paths[t]},e.isHierarchyAt=function(t){return this._paths[t]instanceof YZ},e.parseHierarchyAt=function(t){return this.isHierarchyAt(t),this._paths[t].path},e.isComponentAt=function(t){return this._paths[t]instanceof KZ},e.parseComponentAt=function(t){return this.isComponentAt(t),this._paths[t].component},e.slice=function(e,i){var n=new t;return n._paths=this._paths.slice(e,i),n},e.trace=function(t,e,i){var n,r;return null!==(n=e)&&void 0!==n||(e=0),null!==(r=i)&&void 0!==r||(i=this._paths.length),this[qZ](t,e,i)},e[QZ]=function(){for(var t,e=this._paths,i=e.length,n=0,r="";n<i;++n){var s=e[n];if(!(s instanceof YZ))break;s.path&&(r?r+="/"+s.path:r=s.path)}if(n===i)return null;if(n!==i-1)return null;switch(e[n]){case"position":case"scale":case"rotation":case"eulerAngles":t=e[n];break;default:return null}return{node:r,property:t}},e[qZ]=function(t,e,i){for(var n=this._paths,r=t,s=e;s<i;++s){var a=n[s];if($Q(a)){if(!(a in r))return j(3929,a),null;r=r[a]}else r=a.get(r);if(null===r)break}return r},h(t,[{key:"length",get:function(){return this._paths.length}}]),t}(),iZ=T((eZ=nZ).prototype,"_paths",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),tZ=eZ))||tZ,$Z=_h("cc.animation.TrackBinding")(rZ=Rh((hZ=uZ=function(){function t(){E(this,"path",aZ,this),E(this,"proxy",oZ,this)}var e=t.prototype;return e.parseTrsPath=function(){return this.proxy?null:this.path[QZ]()},e.createRuntimeBinding=function(e,i,n){var r=this.path,s=this.proxy,a=r.length,o=a-1;if(0===a||!r.isPropertyAt(o)&&!r.isElementAt(o)||s){if(s){var u=r[qZ](e,0,a);if(null===u)return null;var h=s.forTarget(u),l={setValue:function(t){h.set(t)}},c=h.get;return c&&(l.getValue=function(){return c.call(h)}),l}return K(3921),null}var _=r.isPropertyAt(o)?r.parsePropertyAt(o):r.parseElementAt(o),f=r[qZ](e,0,a-1);if(null===f)return null;if(i&&f instanceof jE&&function(t){return"position"===t||"rotation"===t||"scale"===t||"eulerAngles"===t}(_))return i.createPoseWriter(f,_,n);var d=t._animationFunctions.get(f.constructor);d||(d=new Map,t._animationFunctions.set(f.constructor,d));var p=d.get(_);return p||(p={setValue:Function("value","this.target."+_+" = value;"),getValue:Function("return this.target."+_+";")},d.set(_,p)),{target:f,setValue:p.setValue,getValue:p.getValue}},e.isMaskedOff=function(t){var e=this.parseTrsPath();if(!e)return!1;for(var i=t.joints[Symbol.iterator](),n=i.next();!n.done;n=i.next()){var r=n.value;if(r.path===e.node)return!r.enabled}return!1},t}(),uZ._animationFunctions=new WeakMap,aZ=T((sZ=hZ).prototype,"path",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new JZ}}),oZ=T(sZ.prototype,"proxy",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),rZ=sZ))||rZ)||rZ,tJ=_h("cc.animation.Track")((fZ=function(){function t(){E(this,"_binding",_Z,this)}var e=t.prototype;return e.channels=function(){return[]},e.range=function(){for(var t,e={min:1/0,max:-1/0},i=y(this.channels());!(t=i()).done;){var n=t.value;e.min=Math.min(e.min,n.curve.rangeMin),e.max=Math.max(e.max,n.curve.rangeMax)}return e},h(t,[{key:"path",get:function(){return this._binding.path},set:function(t){this._binding.path=t}},{key:"proxy",get:function(){return this._binding.proxy},set:function(t){this._binding.proxy=t}},{key:ZZ,get:function(){return this._binding}}]),t}(),_Z=T((cZ=fZ).prototype,"_binding",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new $Z}}),lZ=cZ))||lZ,eJ=_h("cc.animation.Channel")((gZ=function(){function t(t){this.name="",E(this,"_curve",mZ,this),this._curve=t}return h(t,[{key:"curve",get:function(){return this._curve}}]),t}(),mZ=T((pZ=gZ).prototype,"_curve",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),dZ=pZ))||dZ,iJ=_h("cc.animation.SingleChannelTrack")((TZ=function(t){function e(){var e;return E(e=t.call(this)||this,"_channel",EZ,g(e)),e._channel=new eJ(e.createCurve()),e}c(e,t);var i=e.prototype;return i.channels=function(){return[this._channel]},i.createCurve=function(){throw new Error("Not impl")},i[OQ]=function(){var t=this._channel.curve;return new nJ(t)},h(e,[{key:"channel",get:function(){return this._channel}}]),e}(tJ),EZ=T((yZ=TZ).prototype,"_channel",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),vZ=yZ))||vZ,nJ=function(){function t(t){this._curve=t}return t.prototype.evaluate=function(t){return this._curve.evaluate(t)},t}(),rJ=(_h("cc.animation.RealArrayTrack")((RZ=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return E(e=t.call.apply(t,[this].concat(n))||this,"_channels",AZ,g(e)),e}c(e,t);var i=e.prototype;return i.channels=function(){return this._channels},i[OQ]=function(){return new rJ(this._channels.map((function(t){return t.curve})))},h(e,[{key:"elementCount",get:function(){return this._channels.length},set:function(t){var e=this._channels.length;if(t<e)this._channels.splice(t);else if(t>e){var i;(i=this._channels).push.apply(i,Array.from({length:t-e},(function(){return new eJ(new Pf)})))}}}]),e}(tJ),AZ=T((SZ=RZ).prototype,"_channels",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),SZ)),function(){function t(t){this._curves=t,this._result=new Array(t.length).fill(0)}return t.prototype.evaluate=function(t){for(var e=this._result,i=e.length,n=0;n<i;++n)e[n]=this._curves[n].evaluate(t);return this._result},t}()),sJ=_h("cc.animation.UniformProxyFactory")((xZ=function(){function t(t,e){E(this,"passIndex",wZ,this),E(this,"uniformName",IZ,this),E(this,"channelIndex",OZ,this),this.passIndex=e||0,this.uniformName=t||""}return t.prototype.forTarget=function(t){var e=t.passes[this.passIndex],i=e.getHandle(this.uniformName);if(!i)throw new Error('Material "'+t.name+'" has no uniform "'+this.uniformName+'"');if(by.getTypeFromHandle(i)<Pn.SAMPLER1D){var n=void 0===this.channelIndex?i:e.getHandle(this.uniformName,this.channelIndex,Pn.FLOAT);if(!n)throw new Error('Uniform "'+this.uniformName+" (in material "+t.name+") has no channel "+this.channelIndex+'"');return function(t,e){for(var i,n=y(t.shaderInfo.blocks);!(i=n()).done;)for(var r,s=y(i.value.members);!(r=s()).done;){var a=r.value;if(a.name===e)return a.count>1}return!1}(e,this.uniformName)?{set:function(t){e.setUniformArray(n,t)}}:{set:function(t){e.setUniform(n,t)}}}var r=by.getBindingFromHandle(i),s=e.properties[this.uniformName],a=s&&s.value?""+s.value+Mm(s.type):Nm(s.type),o=vy.get(a);return o||(L("Illegal texture default value: "+a+"."),o=vy.get("default-texture")),{set:function(t){t||(t=o);var i=t.getGFXTexture();i&&i.width&&i.height&&(e.bindTexture(r,i),t instanceof Tg&&e.bindSampler(r,Ja.gfxDevice.getSampler(t.getSamplerInfo())))}}},t}(),wZ=T((CZ=xZ).prototype,"passIndex",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),IZ=T(CZ.prototype,"uniformName",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),OZ=T(CZ.prototype,"channelIndex",[Xh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){}}),bZ=CZ))||bZ,aJ=_h("cc.animation.MorphWeightValueProxy")((MZ=function(){function t(){E(this,"subMeshIndex",BZ,this),E(this,"shapeIndex",NZ,this)}return t.prototype.forTarget=function(t){var e=this;return{set:function(i){t.setWeight(i,e.subMeshIndex,e.shapeIndex)}}},t}(),BZ=T((DZ=MZ).prototype,"subMeshIndex",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),NZ=T(DZ.prototype,"shapeIndex",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),PZ=DZ))||PZ,oJ=_h("cc.animation.MorphWeightsValueProxy")((GZ=function(){function t(){E(this,"subMeshIndex",UZ,this)}return t.prototype.forTarget=function(t){var e=this;return{set:function(i){t.setWeights(i,e.subMeshIndex)}}},t}(),UZ=T((FZ=GZ).prototype,"subMeshIndex",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),LZ=FZ))||LZ,uJ=_h("cc.animation.MorphWeightsAllValueProxy")(kZ=function(){function t(){}return t.prototype.forTarget=function(t){return{set:function(e){for(var i,n,r=null!==(i=null===(n=t.mesh)||void 0===n?void 0:n.struct.primitives.length)&&void 0!==i?i:0,s=0;s<r;++s)t.setWeights(e,s)}}},t}())||kZ;function hJ(t,e,i,n){var r,s,a,o,u,h,l=new e,c=new e,_=new e,f=_h(t)((h=function(){function t(t,i,n){E(this,"dataPoint",a,this),E(this,"inTangent",o,this),E(this,"outTangent",u,this),this.dataPoint=t||new e,this.inTangent=i||new e,this.outTangent=n||new e}var r=t.prototype;return r.lerp=function(t,e,r){var s=this.dataPoint,a=t.dataPoint;c=i(c,this.inTangent,r),_=i(_,t.outTangent,r);var o=e*e*e,u=e*e,h=o-2*u+e,f=-2*o+3*u,d=o-u;return l=i(l,s,2*o-3*u+1),l=n(l,l,c,h),l=n(l,l,a,f),l=n(l,l,_,d)},r.getNoLerp=function(){return this.dataPoint},t}(),a=T((s=h).prototype,"dataPoint",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new e}}),o=T(s.prototype,"inTangent",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new e}}),u=T(s.prototype,"outTangent",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new e}}),r=s))||r;if(e===$i){var d=f.prototype.lerp;f.prototype.lerp=function(t,e,i){var n=d.call(this,t,e,i);return $i.normalize(n,n),n}}return f}var lJ,cJ,_J,fJ,dJ,pJ,mJ=hJ("cc.CubicSplineVec2Value",_n,_n.multiplyScalar,_n.scaleAndAdd),gJ=hJ("cc.CubicSplineVec3Value",ji,ji.multiplyScalar,ji.scaleAndAdd),vJ=hJ("cc.CubicSplineVec4Value",Li,Li.multiplyScalar,Li.scaleAndAdd),yJ=hJ("cc.CubicSplineQuatValue",$i,$i.multiplyScalar,$i.scaleAndAdd),EJ=_h("cc.CubicSplineNumberValue")((jZ=function(){function t(t,e,i){E(this,"dataPoint",VZ,this),E(this,"inTangent",WZ,this),E(this,"outTangent",XZ,this),this.dataPoint=t,this.inTangent=e,this.outTangent=i}var e=t.prototype;return e.lerp=function(t,e,i){var n=this.dataPoint,r=t.dataPoint,s=e*e*e,a=e*e;return n*(2*s-3*a+1)+this.outTangent*i*(s-2*a+e)+r*(-2*s+3*a)+t.inTangent*i*(s-a)},e.getNoLerp=function(){return this.dataPoint},t}(),VZ=T((HZ=jZ).prototype,"dataPoint",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),WZ=T(HZ.prototype,"inTangent",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),XZ=T(HZ.prototype,"outTangent",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),zZ=HZ))||zZ,TJ=_h("cc.animation.RealTrack")(lJ=function(t){function e(){return t.apply(this,arguments)||this}return c(e,t),e.prototype.createCurve=function(){return new Pf},e}(iJ))||lJ;function SJ(t){return 0===t.keyFramesCount?void 0:t}var AJ,RJ,bJ,CJ,wJ,IJ,OJ,xJ,PJ,DJ,BJ=["X","Y","Z","W"],NJ=_h("cc.animation.VectorTrack")((pJ=function(t){function e(){var e;E(e=t.call(this)||this,"_channels",fJ,g(e)),E(e,"_nComponents",dJ,g(e)),e._channels=new Array(4);for(var i=0;i<e._channels.length;++i){var n=new eJ(new Pf);n.name=BJ[i],e._channels[i]=n}return e}c(e,t);var i=e.prototype;return i.channels=function(){return this._channels},i[OQ]=function(){switch(this._nComponents){default:case 2:return new MJ(SJ(this._channels[0].curve),SJ(this._channels[1].curve));case 3:return new LJ(SJ(this._channels[0].curve),SJ(this._channels[1].curve),SJ(this._channels[2].curve));case 4:return new FJ(SJ(this._channels[0].curve),SJ(this._channels[1].curve),SJ(this._channels[2].curve),SJ(this._channels[3].curve))}},h(e,[{key:"componentsCount",get:function(){return this._nComponents},set:function(t){this._nComponents=t}}]),e}(tJ),fJ=T((_J=pJ).prototype,"_channels",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),dJ=T(_J.prototype,"_nComponents",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 4}}),cJ=_J))||cJ,MJ=function(){function t(t,e){this._result=new _n,this._x=t,this._y=e}return t.prototype.evaluate=function(t,e){return this._x&&this._y||!e.getValue||_n.copy(this._result,e.getValue()),this._x&&(this._result.x=this._x.evaluate(t)),this._y&&(this._result.y=this._y.evaluate(t)),this._result},t}(),LJ=function(){function t(t,e,i){this._result=new ji,this._x=t,this._y=e,this._z=i}return t.prototype.evaluate=function(t,e){return this._x&&this._y&&this._z||!e.getValue||ji.copy(this._result,e.getValue()),this._x&&(this._result.x=this._x.evaluate(t)),this._y&&(this._result.y=this._y.evaluate(t)),this._z&&(this._result.z=this._z.evaluate(t)),this._result},t}(),FJ=function(){function t(t,e,i,n){this._result=new Li,this._x=t,this._y=e,this._z=i,this._w=n}return t.prototype.evaluate=function(t,e){return this._x&&this._y&&this._z&&this._w||!e.getValue||Li.copy(this._result,e.getValue()),this._x&&(this._result.x=this._x.evaluate(t)),this._y&&(this._result.y=this._y.evaluate(t)),this._z&&(this._result.z=this._z.evaluate(t)),this._w&&(this._result.w=this._w.evaluate(t)),this._result},t}(),UJ=_h("cc.animation.QuatTrack")(AJ=function(t){function e(){return t.apply(this,arguments)||this}c(e,t);var i=e.prototype;return i.createCurve=function(){return new gd},i[OQ]=function(){return new GJ(this.channels()[0].curve)},e}(iJ))||AJ,GJ=function(){function t(t){this._result=new $i,this._curve=t}return t.prototype.evaluate=function(t){return this._curve.evaluate(t,this._result),this._result},t}(),kJ=["Red","Green","Blue","Alpha"],zJ=_h("cc.animation.ColorTrack")((wJ=function(t){function e(){var e;E(e=t.call(this)||this,"_channels",CJ,g(e)),e._channels=new Array(4);for(var i=0;i<e._channels.length;++i){var n=new eJ(new Pf);n.name=kJ[i],e._channels[i]=n}return e}c(e,t);var i=e.prototype;return i.channels=function(){return this._channels},i[OQ]=function(){return new HJ(SJ(this._channels[0].curve),SJ(this._channels[1].curve),SJ(this._channels[2].curve),SJ(this._channels[3].curve))},e}(tJ),CJ=T((bJ=wJ).prototype,"_channels",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),RJ=bJ))||RJ,HJ=function(){function t(t,e,i,n){this._result=new Gi,this._x=t,this._y=e,this._z=i,this._w=n}return t.prototype.evaluate=function(t,e){return this._x&&this._y&&this._z&&this._w||!e.getValue||Gi.copy(this._result,e.getValue()),this._x&&(this._result.r=this._x.evaluate(t)),this._y&&(this._result.g=this._y.evaluate(t)),this._z&&(this._result.b=this._z.evaluate(t)),this._w&&(this._result.a=this._w.evaluate(t)),this._result},t}(),VJ=["Width","Height"],WJ=_h("cc.animation.SizeTrack")((PJ=function(t){function e(){var e;E(e=t.call(this)||this,"_channels",xJ,g(e)),e._channels=new Array(2);for(var i=0;i<e._channels.length;++i){var n=new eJ(new Pf);n.name=VJ[i],e._channels[i]=n}return e}c(e,t);var i=e.prototype;return i.channels=function(){return this._channels},i[OQ]=function(){return new XJ(SJ(this._channels[0].curve),SJ(this._channels[1].curve))},e}(tJ),xJ=T((OJ=PJ).prototype,"_channels",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),IJ=OJ))||IJ,XJ=function(){function t(t,e){this._result=new gn,this._width=t,this._height=e}return t.prototype.evaluate=function(t,e){if((!this._width||!this._height)&&e.getValue){var i=e.getValue();this._result.x=i.x,this._result.y=i.y}return this._width&&(this._result.width=this._width.evaluate(t)),this._height&&(this._result.height=this._height.evaluate(t)),this._result},t}(),jJ=_h("cc.animation.ObjectTrack")(DJ=function(t){function e(){return t.apply(this,arguments)||this}return c(e,t),e.prototype.createCurve=function(){return new wd},e}(iJ))||DJ;t("animation",Object.freeze({__proto__:null,UniformProxyFactory:sJ,MorphWeightValueProxy:aJ,MorphWeightsValueProxy:oJ,MorphWeightsAllValueProxy:uJ,Track:tJ,TrackPath:JZ,RealTrack:TJ,VectorTrack:NJ,QuatTrack:UJ,ColorTrack:zJ,SizeTrack:WJ,ObjectTrack:jJ,isPropertyPath:$Q,isCustomPath:function(t,e){return t instanceof e},HierarchyPath:YZ,ComponentPath:KZ,CubicSplineVec2Value:mJ,CubicSplineVec3Value:gJ,CubicSplineVec4Value:vJ,CubicSplineQuatValue:yJ,CubicSplineNumberValue:EJ}));var YJ=t("RatioSampler",function(){function t(t){var e,i;this.ratios=void 0,this._findRatio=void 0,this.ratios=t;for(var n=!0,r=1,s=t.length;r<s;r++)if(e=t[r]-t[r-1],1===r)i=e;else if(Math.abs(e-i)>1e-6){n=!1;break}this._findRatio=n?ZJ:Ju}return t.prototype.sample=function(t){return this._findRatio(this.ratios,t)},t}());b.RatioSampler=YJ;var KJ=t("AnimCurve",function(){function t(e,i){this.types=void 0,this.type=null,this._values=[],this._lerp=void 0,this._duration=void 0,this._array=void 0,this._duration=i,this._values=e.values;var n=function(e){return"string"==typeof e?e:Array.isArray(e)?e[0]===e[1]&&e[2]===e[3]?t.Linear:t.Bezier(e):t.Linear};if(void 0!==e.easingMethod)this.type=n(e.easingMethod);else if(Array.isArray(e.easingMethods))this.types=e.easingMethods.map(n);else if(void 0!==e.easingMethods){this.types=new Array(this._values.length).fill(null);for(var r=0,s=Object.keys(e.easingMethods);r<s.length;r++){var a=s[r];this.types[a]=n(e.easingMethods[a])}}else this.type=null;var o=e.values[0];(void 0===e.interpolate||e.interpolate)&&(this._lerp=a$(o)),void 0!==e._arrayLength&&(this._array=new Array(e._arrayLength))}t.Bezier=function(t){return t};var e=t.prototype;return e.hasLerp=function(){return!!this._lerp},e.valueAt=function(t){if(void 0===this._array){var e=this._values[t];return e&&e.getNoLerp?e.getNoLerp():e}for(var i=0;i<this._array.length;++i)this._array[i]=this._values[this._array.length*t+i];return this._array},e.valueBetween=function(t,e,i,n,r){if(this._lerp){var s=this.types?this.types[e]:this.type,a=r-i,o=(t-i)/a;if(s&&(o=QJ(o,s)),void 0===this._array){var u=this._values[e],h=this._values[n];return this._lerp(u,h,o,a*this._duration)}for(var l=0;l<this._array.length;++l){var c=this._values[this._array.length*e+l],_=this._values[this._array.length*n+l];this._array[l]=this._lerp(c,_,o,a*this._duration)}return this._array}if(void 0===this._array)return this.valueAt(e);for(var f=0;f<this._array.length;++f)this._array[f]=this._values[this._array.length*e+f];return this._array},e.empty=function(){return 0===this._values.length},e.constant=function(){return 1===this._values.length},t}());function qJ(t,e,i){var n=e.sample(i);if(n<0)if((n=~n)<=0)n=0;else{if(!(n>=e.ratios.length))return t.valueBetween(i,n-1,e.ratios[n-1],n,e.ratios[n]);n=e.ratios.length-1}return t.valueAt(n)}function QJ(t,e){if("string"==typeof e){var i=Ef[e];i?t=i(t):K(3906,e)}else Array.isArray(e)&&(t=fd(e,t));return t}function ZJ(t,e){var i=t.length-1;if(0===i)return 0;var n=t[0];if(e<n)return 0;var r=t[i];if(e>r)return i;var s=(e=(e-n)/(r-n))/(1/i),a=0|s,o=1e-6;return s-a<o?a:a+1-s<o?a+1:~(a+1)}KJ.Linear=null,b.AnimCurve=KJ,t("EventInfo",function(){function t(){this.events=[]}return t.prototype.add=function(t,e){this.events.push({func:t||"",params:e||[]})},t}()),b.sampleAnimationCurve=qJ;var JJ,$J,t$,e$,i$,n$,r$,s$,a$=function(){function t(t,e,i,n){return t.lerp(e,i,n)}return function(e){if(null!==e){if("number"==typeof e)return Ei;if("object"==typeof e&&e.constructor){if(e instanceof $i)return i=new $i,function(t,e,n){return $i.slerp(i,t,e,n)};if(e instanceof ge)return function(t){var e=new t;return function(i,n,r){return t.lerp(e,i,n,r),e}}(e.constructor);if(e.constructor===Number)return Ei;if("function"==typeof e.lerp)return t}var i}}}(),o$=Symbol("BakeNodeCurves"),u$=function(){function t(){}return t.getOrExtract=function(e){var i=t.pool.get(e);if(!i||i.samples!==e.sample){i&&b.director.root.dataPoolManager.releaseAnimationClip(e);var n=Math.ceil(e.sample*e.duration)+1,r=e.sample;i=e[o$](0,r,n),t.pool.set(e,i)}return i},t.destroy=function(e){t.pool.delete(e)},t}();u$.pool=new Map;var h$=_h("cc.animation.UntypedTrackChannel")((e$=function(t){function e(){var e;return E(e=t.call(this,new Pf)||this,"property",t$,g(e)),e}return c(e,t),e}(eJ),t$=T(($J=e$).prototype,"property",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),JJ=$J))||JJ,l$=_h("cc.animation.UntypedTrack")((s$=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return E(e=t.call.apply(t,[this].concat(n))||this,"_channels",r$,g(e)),e}c(e,t);var i=e.prototype;return i.channels=function(){return this._channels},i[OQ]=function(t){var e=this;if(!t.getValue)throw new Error(J(3930));var i=function(t){var i;return null===(i=e._channels.find((function(e){return e.property===t})))||void 0===i?void 0:i.curve},n=t.getValue();switch(!0){default:throw new Error(J(3931));case n instanceof _n:return new MJ(i("x"),i("y"));case n instanceof ji:return new LJ(i("x"),i("y"),i("z"));case n instanceof Li:return new FJ(i("x"),i("y"),i("z"),i("w"));case n instanceof Gi:return new HJ(i("r"),i("g"),i("b"),i("a"));case n instanceof gn:return new XJ(i("width"),i("height"))}},i.addChannel=function(t){var e=new h$;return e.property=t,this._channels.push(e),e},i.upgrade=function(t){var e=this,i=function(t,i){var n=e.channels().find((function(e){return e.property===t}));n&&(i.name=n.name,i.curve.assignSorted(Array.from(n.curve.times()),Array.from(n.curve.values())))},n=t(this.path,this.proxy);switch(n){default:break;case"vec2":case"vec3":case"vec4":var r=new NJ;r.path=this.path,r.proxy=this.proxy,r.componentsCount="vec2"===n?2:"vec3"===n?3:4;var s=r.channels(),a=s[0],o=s[1],u=s[2],h=s[3];switch(n){case"vec4":i("w",h);case"vec3":i("z",u);default:case"vec2":i("x",a),i("y",o)}return r;case"color":var l=new zJ,c=l.channels(),_=c[0],f=c[1],d=c[2],p=c[3];return i("r",_),i("g",f),i("b",d),i("a",p),i("x",_),i("y",f),i("z",d),i("w",p),l;case"size":}return null},e}(tJ),r$=T((n$=s$).prototype,"_channels",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),i$=n$))||i$,c$=function(){function t(t){this._keys=[],this._curves=[],this._commonTargets=[],this._ratioSamplers=[],this._runtimeCurves=void 0,this._data=null,this._duration=void 0,this._duration=t}var e=t.prototype;return e.getPropertyCurves=function(){return this._runtimeCurves||this._createPropertyCurves(),this._runtimeCurves},e.toTracks=function(){for(var t,e=[],i=this.keys,n=this.curves,r=this.commonTargets,s=function(t,e,i){for(var n,r=new JZ,s=y(e);!(n=s()).done;){var a=n.value;"string"==typeof a?r.toProperty(a):"number"==typeof a?r.toElement(a):a instanceof YZ?r.toHierarchy(a.path):a instanceof KZ?r.toComponent(a.component):r.toCustomized(a)}t.path=r,t.proxy=i},a=r.map((function(t){var i=new l$;return s(i,t.modifiers,t.valueAdapter),e.push(i),i})),o=function(){var n,r=t.value,o=r.data,u=o.values;if(0===u.length)return"continue";var h=o.keys<0?[0]:i[o.keys],l=u[0],c=null===(n=o.interpolate)||void 0===n||n;o._arrayLength;var _=new f$(o,h.length),f=function(t){s(t,r.modifiers,r.valueAdapter)},d=void 0;if("number"==typeof r.commonTarget){if(!u.every((function(t){return"number"==typeof t})))return j(3932),"continue";if(r.valueAdapter||1!==r.modifiers.length||"string"!=typeof r.modifiers[0])return j(3933),"continue";var p=r.modifiers[0],m=a[r.commonTarget].addChannel(p).curve;d=m}!function(){if("number"==typeof l){if(!u.every((function(t){return"number"==typeof t})))return void j(3934);var t;if(d)t=d;else{var i=new TJ;f(i),e.push(i),t=i.channel.curve}var n=c?$u.LINEAR:$u.CONSTANT;return t.assignSorted(h,u.map((function(t){return{value:t,interpolationMode:n}}))),void _.convert(t)}if("object"==typeof l)switch(!0){default:break;case _$(u,_n):case _$(u,ji):case _$(u,Li):var r=l instanceof _n?2:l instanceof ji?3:4,s=new NJ;f(s),s.componentsCount=r;var a=s.channels(),o=a[0].curve,p=a[1].curve,m=a[2].curve,g=a[3].curve,v=c?$u.LINEAR:$u.CONSTANT,y=function(t){return{value:t,interpolationMode:v}};switch(r){case 4:g.assignSorted(h,u.map((function(t){return y(t.w)}))),_.convert(g);case 3:m.assignSorted(h,u.map((function(t){return y(t.z)}))),_.convert(m);default:o.assignSorted(h,u.map((function(t){return y(t.x)}))),_.convert(o),p.assignSorted(h,u.map((function(t){return y(t.y)}))),_.convert(p)}return void e.push(s);case _$(u,$i):var E=new UJ;f(E);var T=c?ad.SLERP:ad.CONSTANT;return E.channel.curve.assignSorted(h,u.map((function(t){return{value:$i.clone(t),interpolationMode:T}}))),_.convertQuatCurve(E.channel.curve),void e.push(E);case _$(u,Gi):var S=new zJ;f(S);var A=S.channels(),R=A[0].curve,b=A[1].curve,C=A[2].curve,w=A[3].curve,I=c?$u.LINEAR:$u.CONSTANT,O=function(t){return{value:t,interpolationMode:I}};return R.assignSorted(h,u.map((function(t){return O(t.r)}))),_.convert(R),b.assignSorted(h,u.map((function(t){return O(t.g)}))),_.convert(b),C.assignSorted(h,u.map((function(t){return O(t.b)}))),_.convert(C),w.assignSorted(h,u.map((function(t){return O(t.a)}))),_.convert(w),void e.push(S);case _$(u,gn):var x=new WJ;f(x);var P=x.channels(),D=P[0].curve,B=P[1].curve,N=c?$u.LINEAR:$u.CONSTANT,M=function(t){return{value:t,interpolationMode:N}};return D.assignSorted(h,u.map((function(t){return M(t.width)}))),_.convert(D),B.assignSorted(h,u.map((function(t){return M(t.height)}))),_.convert(B),void e.push(x);case _$(u,EJ):var L=new TJ;f(L);var F=c?$u.CUBIC:$u.CONSTANT;return L.channel.curve.assignSorted(h,u.map((function(t){return{value:t.dataPoint,leftTangent:t.inTangent,rightTangent:t.outTangent,interpolationMode:F}}))),void e.push(L);case _$(u,mJ):case _$(u,gJ):case _$(u,vJ):var U=l instanceof mJ?2:l instanceof gJ?3:4,G=new NJ;f(G),G.componentsCount=U;var k=G.channels(),z=k[0],H=k[1],V=k[2],W=k[3],X=c?$u.LINEAR:$u.CONSTANT,Y=function(t,e,i){return{value:t,leftTangent:e,rightTangent:i,interpolationMode:X}};switch(U){case 4:W.curve.assignSorted(h,u.map((function(t){return Y(t.dataPoint.w,t.inTangent.w,t.outTangent.w)})));case 3:V.curve.assignSorted(h,u.map((function(t){return Y(t.dataPoint.z,t.inTangent.z,t.outTangent.z)})));default:z.curve.assignSorted(h,u.map((function(t){return Y(t.dataPoint.y,t.inTangent.y,t.outTangent.y)}))),H.curve.assignSorted(h,u.map((function(t){return Y(t.dataPoint.x,t.inTangent.x,t.outTangent.x)})))}return void e.push(G);case u.every((function(t){return t instanceof yJ})):j(3935)}var K=new jJ;f(K),K.channel.curve.assignSorted(h,u),e.push(K)}()},u=y(n);!(t=u()).done;)o();return e},e._createPropertyCurves=function(){var t=this;this._ratioSamplers=this._keys.map((function(e){return new YJ(e.map((function(e){return e/t._duration})))})),this._runtimeCurves=this._curves.map((function(e){return{curve:new KJ(e.data,t._duration),modifiers:e.modifiers,valueAdapter:e.valueAdapter,sampler:t._ratioSamplers[e.data.keys],commonTarget:e.commonTarget}}))},h(t,[{key:"keys",get:function(){return this._keys},set:function(t){this._keys=t}},{key:"curves",get:function(){return this._curves},set:function(t){this._curves=t,delete this._runtimeCurves}},{key:"commonTargets",get:function(){return this._commonTargets},set:function(t){this._commonTargets=t}},{key:"data",get:function(){return this._data}}]),t}();function _$(t,e){return t.every((function(t){return t instanceof e}))}var f$=function(){function t(t,e){this._easingMethods=void 0;var i=t.easingMethods;Array.isArray(i)?0===i.length&&0!==e?this._easingMethods=new Array(e).fill(null):this._easingMethods=i:this._easingMethods=void 0===i?new Array(e).fill(t.easingMethod):Array.from({length:e},(function(t,e){var n;return null!==(n=i[e])&&void 0!==n?n:null}))}var e=t.prototype;return e.convert=function(t){var e,i,n,r,s,a,o,u,h,l,c,_,f,d,p,m,g,v,y,E,T,S,A=this._easingMethods;if(A){var R=t.keyFramesCount;if(!(t.keyFramesCount<2)){Array.isArray(A)&&A.length;for(var b=R-1,C=0;C<b;++C){var w=A[C];w&&(Array.isArray(w)?(e=w,i=t.getKeyframeTime(C),n=t.getKeyframeValue(C),r=t.getKeyframeTime(C+1),s=t.getKeyframeValue(C+1),a=void 0,o=void 0,u=void 0,h=void 0,l=void 0,c=void 0,_=void 0,f=void 0,d=void 0,p=void 0,m=void 0,g=void 0,v=void 0,y=void 0,E=void 0,T=void 0,S=void 0,o=e[0],u=e[1],h=e[2],l=e[3],c=n.value,_=3*(r-i),f=3*(s.value-c),m=(1-h)*_,g=(1-l)*f,v=1/3,y=(p=u*f)/(d=o*_),E=Math.sqrt(d*d+p*p)*v,T=g/m,S=Math.sqrt(m*m+g*g)*v,n.interpolationMode=$u.CUBIC,n.tangentWeightMode=(a=n.tangentWeightMode)===eh.NONE?eh.RIGHT:a===eh.LEFT?eh.BOTH:a,n.rightTangent=y,n.rightTangentWeight=E,s.tangentWeightMode=function(t){return t===eh.NONE?eh.LEFT:t===eh.RIGHT?eh.BOTH:t}(s.tangentWeightMode),s.leftTangent=T,s.leftTangentWeight=S):d$(w,t,C))}}}},e.convertQuatCurve=function(t){var e=this._easingMethods;if(e){var i=t.keyFramesCount;if(!(t.keyFramesCount<2)){Array.isArray(e)&&e.length;for(var n=i-1,r=0;r<n;++r){var s=e[r];s&&(Array.isArray(s)?t.getKeyframeValue(r).easingMethod=s.slice():p$(s,t,r))}}}},h(t,[{key:"nil",get:function(){return!this._easingMethods||this._easingMethods.every((function(t){return null==t}))}}]),t}();function d$(t,e,i){e.keyFramesCount;var n=e.getKeyframeValue(i),r=X$[t];r===yf.CONSTANT?n.interpolationMode=$u.CONSTANT:(n.interpolationMode=$u.LINEAR,n.easingMethod=r)}function p$(t,e,i){e.keyFramesCount;var n=e.getKeyframeValue(i),r=X$[t];n.easingMethod=r}var m$,g$,v$,y$,E$,T$,S$,A$,R$,b$,C$,w$,I$,O$,x$,P$,D$,B$,N$,M$,L$,F$,U$,G$,k$,z$,H$,V$,W$,X$={constant:yf.CONSTANT,linear:yf.LINEAR,quadIn:yf.QUAD_IN,quadOut:yf.QUAD_OUT,quadInOut:yf.QUAD_IN_OUT,quadOutIn:yf.QUAD_OUT_IN,cubicIn:yf.CUBIC_IN,cubicOut:yf.CUBIC_OUT,cubicInOut:yf.CUBIC_IN_OUT,cubicOutIn:yf.CUBIC_OUT_IN,quartIn:yf.QUART_IN,quartOut:yf.QUART_OUT,quartInOut:yf.QUART_IN_OUT,quartOutIn:yf.QUART_OUT_IN,quintIn:yf.QUINT_IN,quintOut:yf.QUINT_OUT,quintInOut:yf.QUINT_IN_OUT,quintOutIn:yf.QUINT_OUT_IN,sineIn:yf.SINE_IN,sineOut:yf.SINE_OUT,sineInOut:yf.SINE_IN_OUT,sineOutIn:yf.SINE_OUT_IN,expoIn:yf.EXPO_IN,expoOut:yf.EXPO_OUT,expoInOut:yf.EXPO_IN_OUT,expoOutIn:yf.EXPO_OUT_IN,circIn:yf.CIRC_IN,circOut:yf.CIRC_OUT,circInOut:yf.CIRC_IN_OUT,circOutIn:yf.CIRC_OUT_IN,elasticIn:yf.ELASTIC_IN,elasticOut:yf.ELASTIC_OUT,elasticInOut:yf.ELASTIC_IN_OUT,elasticOutIn:yf.ELASTIC_OUT_IN,backIn:yf.BACK_IN,backOut:yf.BACK_OUT,backInOut:yf.BACK_IN_OUT,backOutIn:yf.BACK_OUT_IN,bounceIn:yf.BOUNCE_IN,bounceOut:yf.BOUNCE_OUT,bounceInOut:yf.BOUNCE_IN_OUT,bounceOutIn:yf.BOUNCE_OUT_IN,smooth:yf.SMOOTH,fade:yf.FADE};function j$(){throw new Error("split() only valid in Editor.")}_h("cc.animation.ExoticAnimation")((v$=function(){function t(){E(this,"_nodeAnimations",g$,this)}var e=t.prototype;return e.createEvaluator=function(t){return new i0(this._nodeAnimations,t)},e.addNodeAnimation=function(t){var e=new Y$(t);return this._nodeAnimations.push(e),e},e.collectAnimatedJoints=function(){return Array.from(new Set(this._nodeAnimations.map((function(t){return t.path}))))},e.split=function(){return j$()},e.toHashString=function(){return this._nodeAnimations.map((function(t){return t.toHashString()})).join("\n")},t}(),g$=T((m$=v$).prototype,"_nodeAnimations",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),m$));var Y$=_h("cc.animation.ExoticNodeAnimation")((b$=function(){function t(t){E(this,"_path",T$,this),E(this,"_position",S$,this),E(this,"_rotation",A$,this),E(this,"_scale",R$,this),this._path=t}var e=t.prototype;return e.createPosition=function(t,e){this._position=new $$(t,new Z$(e))},e.createRotation=function(t,e){this._rotation=new $$(t,new J$(e))},e.createScale=function(t,e){this._scale=new $$(t,new Z$(e))},e.createEvaluator=function(t){return new n0(this._path,this._position,this._rotation,this._scale,t)},e.split=function(){return j$()},e.toHashString=function(){var t,e,i,n,r,s;return this._path+"\n"+(null!==(t=null===(e=this._position)||void 0===e?void 0:e.toHashString())&&void 0!==t?t:"")+(null!==(i=null===(n=this._scale)||void 0===n?void 0:n.toHashString())&&void 0!==i?i:"")+(null!==(r=null===(s=this._rotation)||void 0===s?void 0:s.toHashString())&&void 0!==r?r:"")},h(t,[{key:"path",get:function(){return this._path}}]),t}(),T$=T((E$=b$).prototype,"_path",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),S$=T(E$.prototype,"_position",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),A$=T(E$.prototype,"_rotation",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),R$=T(E$.prototype,"_scale",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),y$=E$))||y$;function K$(t){return t.toPrecision(2)}function q$(t){return t.map(K$).join(" ")}var Q$=_h("cc.animation.ExoticVectorLikeTrackValues")((x$=function(){function t(t){E(this,"_values",I$,this),E(this,"_isQuantized",O$,this),this._values=t,this._isQuantized=!1}var e=t.prototype;return e.quantize=function(t){this._isQuantized,this._values=function(t,e){var i=s0[e],n=1<<i.BYTES_PER_ELEMENT,r=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY;t.forEach((function(t){r=Math.min(t,r),s=Math.max(t,s)}));var a=s-r,o=i.from(t,(function(t){return(t-r)/a*n}));return new T0(a0(t),o,a,r)}(this._values,t),this._isQuantized=!0},e.toHashString=function(){var t=this._isQuantized,e=this._values;return t+" "+(t?e.toHashString():q$(e))},h(t,[{key:"precision",get:function(){return this._isQuantized?this._values.originalPrecision:a0(this._values)}}]),t}(),I$=T((w$=x$).prototype,"_values",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),O$=T(w$.prototype,"_isQuantized",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),C$=w$))||C$,Z$=_h("cc.animation.ExoticVec3TrackValues")(P$=function(t){function e(){return t.apply(this,arguments)||this}c(e,t),e.imitate=function(t,i){var n=new e(t);return i._isQuantized&&n.quantize(i._values.quantizationType),n};var i=e.prototype;return i.get=function(t,e){var i=this._values;this._isQuantized?R0(i,t,e):ji.fromArray(e,i,3*t)},i.lerp=function(t,e,i,n,r,s){var a=this._values;this._isQuantized?(R0(a,t,n),R0(a,e,r)):(ji.fromArray(n,a,3*t),ji.fromArray(r,a,3*e)),ji.lerp(s,n,r,i)},e}(Q$))||P$,J$=_h("cc.animation.ExoticQuatTrackValues")(D$=function(t){function e(){return t.apply(this,arguments)||this}c(e,t),e.imitate=function(t,i){var n=new e(t);return i._isQuantized&&n.quantize(i._values.quantizationType),n};var i=e.prototype;return i.get=function(t,e){var i=this._values;this._isQuantized?b0(i,t,e):$i.fromArray(e,i,4*t)},i.lerp=function(t,e,i,n,r,s){var a=this._values;this._isQuantized?(b0(a,t,n),b0(a,e,r)):($i.fromArray(n,a,4*t),$i.fromArray(r,a,4*e)),$i.slerp(s,n,r,i)},e}(Q$))||D$,$$=_h("cc.animation.ExoticTrack")((F$=function(){function t(t,e){E(this,"times",M$,this),E(this,"values",L$,this),this.times=t,this.values=e}return t.prototype.toHashString=function(){var t=this.times,e=this.values;return"times: "+q$(t)+"; values: "+e.toHashString()},t}(),M$=T((N$=F$).prototype,"times",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),L$=T(N$.prototype,"values",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),B$=N$))||B$;function t0(t,e){t.length,t.length;var i=0,n=0,r=Ju(t,e);if(r>=0)i=r;else{var s=~r,a=s-1;i=a;var o=t[s],u=t[a];n=(e-u)/(o-u)}return{index:i,ratio:n}}!function(){function t(){this._reset()}var e=t.prototype;e.transformTime=function(t){return t-this._timeOffset},e.calculate=function(t,e,i){this._reset();var n=t.length;if(n){var r=t[0],s=t[n-1],a=vi(e,r,s),o=vi(i,r,s);this._timeOffset=a;var u=function(t,e,i){var n=t.length;i>=e&&e>=t[0]&&t[n-1];var r=t0(t,e),s=r.index,a=r.ratio,o=t0(t,i);return{fromIndex:s,fromRatio:a,toIndex:o.index,toRatio:o.ratio}}(t,a,o),h=u.fromIndex,l=u.fromRatio,c=u.toIndex,_=u.toRatio,f=!l,d=!_;h!==c||l!==_?(f||(this.preLerpIndex=h,this.preLerpRatio=l),this.directKeyframesBegin=f?h:h+1,this.directKeyframesEnd=c+1,d||(this.postLerpIndex=c,this.postLerpRatio=_)):f?(this.directKeyframesBegin=h,this.directKeyframesEnd=h+1):(this.preLerpIndex=h,this.preLerpRatio=l)}},e._reset=function(){this.preLerpIndex=-1,this.preLerpRatio=0,this.directKeyframesBegin=0,this.directKeyframesEnd=0,this.postLerpIndex=-1,this.postLerpRatio=0,this._timeOffset=0},h(t,[{key:"keyframesCount",get:function(){var t=this.preLerpIndex,e=this.directKeyframesBegin;return 0+(t<0?0:1)+(this.directKeyframesEnd-e)+(this.postLerpIndex<0?0:1)}}])}();var e0,i0=function(){function t(t,e){this._nodeEvaluations=void 0,this._nodeEvaluations=t.map((function(t){return t.createEvaluator(e)}))}return t.prototype.evaluate=function(t){this._nodeEvaluations.forEach((function(e){e.evaluate(t)}))},t}(),n0=function(){function t(t,e,i,n,r){this._position=null,this._rotation=null,this._scale=null,e&&(this._position=A0(e.times,e.values,ji,t,"position",r)),i&&(this._rotation=A0(i.times,i.values,$i,t,"rotation",r)),n&&(this._scale=A0(n.times,n.values,ji,t,"scale",r))}return t.prototype.evaluate=function(t){if(this._position){var e=this._position.evaluator.evaluate(t);this._position.runtimeBinding.setValue(e)}if(this._rotation){var i=this._rotation.evaluator.evaluate(t);this._rotation.runtimeBinding.setValue(i)}if(this._scale){var n=this._scale.evaluator.evaluate(t);this._scale.runtimeBinding.setValue(n)}},t}(),r0=function(){function t(t,e,i){this._times=void 0,this._inputSampleResultCache={just:!1,index:-1,nextIndex:-1,ratio:0},this._values=void 0,this._prevValue=void 0,this._nextValue=void 0,this._resultValue=void 0,this._times=t,this._values=e,this._prevValue=new i,this._nextValue=new i,this._resultValue=new i}return t.prototype.evaluate=function(t){var e=this._times,i=this._values,n=this._resultValue;if(0===e.length)return n;var r=function(t,e,i){var n=t.length,r=t[0],s=t[n-1];if(e<r)i.just=!0,i.index=0;else if(e>s)i.just=!0,i.index=n-1;else{var a=Ju(t,e);if(a>=0)i.just=!0,i.index=a;else{var o=~a,u=o-1,h=t[u],l=t[o],c=(e-t[u])/(l-h);i.just=!1,i.index=u,i.nextIndex=o,i.ratio=c}}return i}(e,t,this._inputSampleResultCache);return r.just?i.get(r.index,n):i.lerp(r.index,r.nextIndex,r.ratio,this._prevValue,this._nextValue,n),n},t}(),s0={uint8:Uint8Array,uint16:Uint16Array};function a0(t){switch(t.BYTES_PER_ELEMENT){default:case 4:return e0.FLOAT_32;case 8:return e0.FLOAT_64}}!function(t){t[t.FLOAT_32=0]="FLOAT_32",t[t.FLOAT_64=1]="FLOAT_64"}(e0||(e0={}));var o0,u0,h0,l0,c0,_0,f0,d0,p0,m0,g0,v0,y0,E0,T0=_h("cc.animation.QuantizedFloatArray")((W$=function(){function t(t,e,i,n){void 0===n&&(n=0),E(this,"originalPrecision",k$,this),E(this,"min",z$,this),E(this,"extent",H$,this),E(this,"values",V$,this),this.originalPrecision=t,this.values=e,this.extent=i,this.min=n}return t.prototype.toHashString=function(){var t=this.originalPrecision,e=this.min,i=this.extent,n=this.values;return t+" "+K$(e)+" "+K$(i)+" "+n.join(" ")},h(t,[{key:"quantizationType",get:function(){switch(this.values.BYTES_PER_ELEMENT){default:case 1:return"uint8";case 2:return"uint16"}}}]),t}(),k$=T((G$=W$).prototype,"originalPrecision",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),z$=T(G$.prototype,"min",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),H$=T(G$.prototype,"extent",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),V$=T(G$.prototype,"values",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),U$=G$))||U$;function S0(t,e){return t.values[e]/(1<<t.values.BYTES_PER_ELEMENT)*t.extent+t.min}function A0(t,e,i,n,r,s){var a=new $Z;a.path=(new JZ).toHierarchy(n).toProperty(r);var o=s(a);return o?{runtimeBinding:o,evaluator:new r0(t,e,i)}:null}function R0(t,e,i){ji.set(i,S0(t,3*e+0),S0(t,3*e+1),S0(t,3*e+2))}function b0(t,e,i){$i.set(i,S0(t,4*e+0),S0(t,4*e+1),S0(t,4*e+2),S0(t,4*e+3))}var C0=Symbol("SearchForRootBonePath"),w0=Symbol("ExoticAnimation"),I0=Symbol("[[EmbeddedPlayerCount]]"),O0=Symbol("[[GetEmbeddedPlayers]]"),x0=Symbol("[[AddEmbeddedPlayer]]"),P0=Symbol("[[RemoveEmbeddedPlayer]]"),D0=Symbol("[[ClearEmbeddedPlayers]]"),B0=t("AnimationClip",_h("cc.AnimationClip")((E0=y0=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return E(e=t.call.apply(t,[this].concat(n))||this,"sample",h0,g(e)),E(e,"speed",l0,g(e)),E(e,"wrapMode",c0,g(e)),E(e,"enableTrsBlending",_0,g(e)),E(e,"_duration",f0,g(e)),E(e,"_hash",d0,g(e)),e.frameRate=0,E(e,"_tracks",p0,g(e)),E(e,"_exoticAnimation",m0,g(e)),e._legacyData=void 0,e._legacyDataDirty=!1,E(e,"_events",g0,g(e)),E(e,"_embeddedPlayers",v0,g(e)),e._runtimeEvents={ratios:[],eventGroups:[]},e}c(e,t),e.createWithSpriteFrames=function(t,i){var n=new e;n.sample=i||n.sample,n.duration=t.length/n.sample;var r=1/n.sample,s=new jJ;return s.path=(new JZ).toComponent("cc.Sprite").toProperty("spriteFrame"),s.channels()[0].curve.assignSorted(t.map((function(t,e){return[r*e,t]}))),n.addTrack(s),n};var i=e.prototype;return i.onLoaded=function(){this.frameRate=this.sample,this.events=this._events},i.range=function(){for(var t={min:1/0,max:-1/0},e=this._tracks,i=e.length,n=0;n<i;++n){var r=e[n].range();t.min=Math.min(t.min,r.min),t.max=Math.max(t.max,r.max)}return t},i.getTrack=function(t){return this._tracks[t]},i.addTrack=function(t){var e=this._tracks.length;return this._tracks.push(t),e},i.removeTrack=function(t){this._tracks.splice(t,1)},i.clearTracks=function(){this._tracks.length=0},i.containsAnyEvent=function(){return 0!==this._events.length},i.createEventEvaluator=function(t){return new H0(t,this._runtimeEvents.ratios,this._runtimeEvents.eventGroups,this.wrapMode)},i.containsAnyEmbeddedPlayer=function(){return 0!==this._embeddedPlayers.length},i.createEmbeddedPlayerEvaluator=function(t){return new N0(this._embeddedPlayers,t)},i.createEvaluator=function(t){var e=this,i=t.target;return this._createEvalWithBinder(i,(function(n){if(!t.mask||!n.isMaskedOff(t.mask)){var r=n.createRuntimeBinding(i,e.enableTrsBlending?t.pose:void 0,!1);return null!=r?r:void 0}}),t.rootMotion)},i.destroy=function(){var e;return(null===(e=b.director.root)||void 0===e?void 0:e.dataPoolManager)&&b.director.root.dataPoolManager.releaseAnimationClip(this),u$.destroy(this),t.prototype.destroy.call(this)},i[o$]=function(t,e,i){for(var n=1/e,r=this._collectAnimatedJoints(),s=r.length,a={},o=0;o<s;++o)a[r[o]]={transforms:Array.from({length:i},(function(){return new un}))};var u=r.reduce((function(t,e){return t[e]=new F0,t}),{});for(var h in u){var l=u[h],c=h.lastIndexOf("/");if(c>=0){var _=h.substring(0,c),f=u[_];f&&(l.parent=f)}}for(var d=this._createEvalWithBinder(void 0,(function(t){var e=t.parseTrsPath();if(e){var i=u[e.node];if(i)return z0(i,e.property)}}),void 0),p=0;p<i;++p){var m=t+n*p;d.evaluate(m);for(var g=0;g<s;++g){var v=r[g];un.copy(a[v].transforms[p],u[v].globalTransform)}for(var y=0;y<s;++y){var E=r[y];u[E].invalidate()}}return{samples:e,frames:i,joints:a}},i.upgradeUntypedTracks=function(t){for(var e=[],i=[],n=this._tracks,r=n.length,s=0;s<r;++s){var a=n[s];if(a instanceof l$){var o=a.upgrade(t);o&&(e.push(o),i.push(a))}}for(var u=i.length,h=0;h<u;++h)he.remove(n,i[h]);n.push.apply(n,e)},i[C0]=function(){return this._searchForRootBonePath()},i.getPropertyCurves=function(){return this._getLegacyData().getPropertyCurves()},i.updateEventDatas=function(){this.events=this._events},i.hasEvents=function(){return 0!==this.events.length},i.syncLegacyData=function(){this._legacyData&&(this._fromLegacy(this._legacyData),this._legacyData=void 0)},i[O0]=function(){return this._embeddedPlayers},i[x0]=function(t){this._embeddedPlayers.push(t)},i[P0]=function(t){var e=this._embeddedPlayers.indexOf(t);e>=0&&this._embeddedPlayers.splice(e,1)},i[D0]=function(){this._embeddedPlayers.length=0},i._createEvalWithBinder=function(t,e,i){this._legacyDataDirty&&(this._legacyDataDirty=!1,this.syncLegacyData());var n,r=[];i&&(n=this._createRootMotionEvaluation(t,i,r));for(var s,a=[],o=this._tracks,u=o.length,h=0;h<u;++h){var l=o[h];if(!r.includes(l)&&!Array.from(l.channels()).every((function(t){return 0===t.curve.keyFramesCount}))){var c=e(l[ZZ]);if(c){var _=l[OQ](c);a.push({binding:c,trackEval:_})}}}return this._exoticAnimation&&(s=this._exoticAnimation.createEvaluator(e)),new M0(a,s,n)},i._createRootMotionEvaluation=function(t,e,i){if(t instanceof jE){var n=this._searchForRootBonePath();if(n){var r=t.getChildByPath(n);if(r){for(var s=new L0,a=[],o=this._tracks,u=o.length,h=0;h<u;++h){var l=o[h],c=l[ZZ].parseTrsPath();if(c&&c.node===n){i.push(l);var _=z0(s,c.property);if(_){var f=l[OQ](_);a.push({binding:_,trackEval:f})}}}return new G0(r,this._duration,s,a)}j(3924)}else j(3923)}else K(3920)},i._searchForRootBonePath=function(){var t=this._tracks.map((function(t){var e=t[ZZ].parseTrsPath();if(e){var i=e.node;return{path:i,rank:i.split("/").length}}return{path:"",rank:0}}));t.sort((function(t,e){return t.rank-e.rank}));var e=t.findIndex((function(t){return 0!==t.rank}));if(e<0)return"";for(var i=t.length,n=t[e],r=!0,s=e+1;s<i;++s){var a=t[s];if(a.rank!==n.rank)break;if(a.path!==n.path){r=!1;break}}return r?n.path:""},i._getLegacyData=function(){return this._legacyData||(this._legacyData=this._toLegacy()),this._legacyData},i._toLegacy=function(){var t=new c$(this._duration);return t.keys=[],t.curves=[],t.commonTargets=[],t},i._fromLegacy=function(t){for(var e=t.toTracks(),i=e.length,n=0;n<i;++n)this.addTrack(e[n])},i._collectAnimatedJoints=function(){for(var t=new Set,e=this._tracks,i=e.length,n=0;n<i;++n){var r=e[n][ZZ].parseTrsPath();r&&t.add(r.node)}if(this._exoticAnimation)for(var s=this._exoticAnimation.collectAnimatedJoints(),a=s.length,o=0;o<a;++o)t.add(s[o]);return Array.from(t)},h(e,[{key:"duration",get:function(){return this._duration},set:function(t){this._duration=t}},{key:"tracksCount",get:function(){return this._tracks.length}},{key:"tracks",get:function(){return this._tracks}},{key:"hash",get:function(){var t,e;if(this._hash)return this._hash;var i="Exotic:"+(null!==(t=null===(e=this._exoticAnimation)||void 0===e?void 0:e.toHashString())&&void 0!==t?t:"");return this._hash=Vs(i,666)}},{key:"events",get:function(){return this._events},set:function(t){var e=this;this._events=t;for(var i=[],n=[],r=this.events.sort((function(t,e){return t.frame-e.frame})),s=r.length,a=function(t){var s=r[t],a=s.frame/e._duration,o=i.findIndex((function(t){return t===a}));o<0&&(o=i.length,i.push(a),n.push({events:[]})),n[o].events.push({functionName:s.func,parameters:s.params})},o=0;o<s;++o)a(o);this._runtimeEvents={ratios:i,eventGroups:n}}},{key:w0,get:function(){return this._exoticAnimation}},{key:w0,set:function(t){this._exoticAnimation=t}},{key:"keys",get:function(){return this._getLegacyData().keys}},{key:"keys",set:function(t){this._legacyDataDirty=!0,this._getLegacyData().keys=t}},{key:"curves",get:function(){return this._legacyDataDirty=!0,this._getLegacyData().curves}},{key:"curves",set:function(t){this._getLegacyData().curves=t}},{key:"commonTargets",get:function(){return this._getLegacyData().commonTargets}},{key:"commonTargets",set:function(t){this._legacyDataDirty=!0,this._getLegacyData().commonTargets=t}},{key:"data",get:function(){return this._getLegacyData().data}},{key:"eventGroups",get:function(){return this._runtimeEvents.eventGroups}},{key:I0,get:function(){return this._embeddedPlayers.length}}]),e}(Wl),y0.WrapMode=Xu,h0=T((u0=E0).prototype,"sample",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 60}}),l0=T(u0.prototype,"speed",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 1}}),c0=T(u0.prototype,"wrapMode",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Xu.Normal}}),_0=T(u0.prototype,"enableTrsBlending",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),f0=T(u0.prototype,"_duration",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),d0=T(u0.prototype,"_hash",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),p0=T(u0.prototype,"_tracks",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),m0=T(u0.prototype,"_exoticAnimation",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),g0=T(u0.prototype,"_events",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),v0=T(u0.prototype,"_embeddedPlayers",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),o0=u0))||o0);b.AnimationClip=B0;var N0=function(){function t(t,e){this._embeddedPlayers=t,this._embeddedPlayerEvaluationInfos=t.map((function(t){var i=t.playable;if(!i)return null;var n=i.instantiate(e);return n?{instantiatedPlayer:n,entered:!1,hostPauseTime:0,lastIterations:0}:null}))}var e=t.prototype;return e.destroy=function(){for(var t=this._embeddedPlayerEvaluationInfos,e=t.length,i=0;i<e;++i){var n;null===(n=t[i])||void 0===n||n.instantiatedPlayer.destroy()}this._embeddedPlayerEvaluationInfos.length=0},e.evaluate=function(t,e){for(var i=this._embeddedPlayers,n=this._embeddedPlayerEvaluationInfos,r=i.length,s=0;s<r;++s){var a=n[s];if(a){var o=a.entered,u=a.instantiatedPlayer,h=a.lastIterations,l=i[s],c=l.begin,_=l.end;if(t>=c&&t<=_?o?e!==h&&(u.stop(),u.play(),a.entered=!0):(u.play(),a.entered=!0):o&&(u.stop(),a.entered=!1),a.lastIterations=e,a.entered){var f=t-c;a.instantiatedPlayer.setTime(f)}}}},e.notifyHostSpeedChanged=function(t){for(var e=this._embeddedPlayers,i=this._embeddedPlayerEvaluationInfos,n=e.length,r=0;r<n;++r){var s=i[r];if(s){var a=s.instantiatedPlayer;e[r].reconciledSpeed&&a.setSpeed(t)}}},e.notifyHostPlay=function(t){for(var e=this._embeddedPlayers,i=this._embeddedPlayerEvaluationInfos,n=e.length,r=0;r<n;++r){var s=i[r];if(s){var a=e[r],o=a.begin,u=a.end,h=s.instantiatedPlayer;if(s.entered){var l=s.hostPauseTime;if(h.randomAccess||gi(l,t,1e-5)){var c=vi(t,o,u);h.play(),h.setTime(c-o)}else h.stop()}}}},e.notifyHostPause=function(t){for(var e=this._embeddedPlayers,i=this._embeddedPlayerEvaluationInfos,n=e.length,r=0;r<n;++r){var s=i[r];if(s){var a=s.instantiatedPlayer;s.entered&&(a.pause(),s.hostPauseTime=t)}}},e.notifyHostStop=function(){for(var t=this._embeddedPlayers,e=this._embeddedPlayerEvaluationInfos,i=t.length,n=0;n<i;++n){var r=e[n];if(r){var s=r.instantiatedPlayer;r.entered&&(r.entered=!1,s.stop())}}},t}(),M0=function(){function t(t,e,i){this._exoticAnimationEvaluator=void 0,this._trackEvalStatues=[],this._rootMotionEvaluation=void 0,this._trackEvalStatues=t,this._exoticAnimationEvaluator=e,this._rootMotionEvaluation=i}var e=t.prototype;return e.evaluate=function(t){for(var e=this._trackEvalStatues,i=this._exoticAnimationEvaluator,n=e.length,r=0;r<n;++r){var s=e[r],a=s.trackEval,o=s.binding,u=a.evaluate(t,o);o.setValue(u)}i&&i.evaluate(t)},e.evaluateRootMotion=function(t,e){var i=this._rootMotionEvaluation;i&&i.evaluate(t,e)},t}(),L0=function(){function t(){this.position=new ji,this.scale=new ji(1,1,1),this.rotation=new $i,this.eulerAngles=new ji}return t.prototype.getTransform=function(t){un.fromRTS(t,this.rotation,this.position,this.scale)},t}(),F0=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).parent=null,e._dirty=!0,e._transform=new un,e}return c(e,t),e.prototype.invalidate=function(){this._dirty=!0},h(e,[{key:"globalTransform",get:function(){var t=this._transform;return this._dirty&&(this._dirty=!1,un.fromRTS(t,this.rotation,this.position,this.scale),this.parent&&un.multiply(t,this.parent.globalTransform,t)),this._transform}}]),e}(L0),U0=new un,G0=function(){function t(t,e,i,n){this._initialTransformCache=new un,this._clipEndTransformCache=new un,this._startTransformCache=new un,this._endTransformCache=new un,this._motionTransformCache=new un,this._translationMotionCache=new ji,this._rotationMotionCache=new $i,this._scaleMotionCache=new ji,this._rootBone=t,this._duration=e,this._boneTransform=i,this._trackEvalStatuses=n}var e=t.prototype;return e.evaluate=function(t,e){var i=this._calcMotionTransform(t,e,this._motionTransformCache),n=this._translationMotionCache,r=this._rotationMotionCache,s=this._scaleMotionCache,a=this._rootBone;un.toRTS(i,r,n,s),ji.add(n,n,a.position),a.setPosition(n),$i.multiply(r,r,a.rotation),a.setRotation(r),ji.multiply(s,s,a.scale),a.setScale(s)},e._calcMotionTransform=function(t,e,i){var n=this._duration,r=n-t,s=this._evaluateAt(t,this._startTransformCache);if(e<r){var a=this._evaluateAt(t+e,this._endTransformCache);k0(i,s,a)}else{un.identity(i);var o=function(t,e){k0(U0,t,e),un.multiply(i,i,U0)},u=e-r,h=Math.floor(u/n),l=u-h*n,c=this._evaluateAt(0,this._initialTransformCache),_=this._evaluateAt(n,this._clipEndTransformCache),f=this._evaluateAt(l,this._endTransformCache);o(s,_),k0(U0,c,_);for(var d=0;d<h;++d)un.multiply(i,i,U0);o(c,f)}return i},e._evaluateAt=function(t,e){for(var i=this._trackEvalStatuses,n=i.length,r=0;r<n;++r){var s=i[r],a=s.trackEval,o=s.binding,u=a.evaluate(t,o);o.setValue(u)}return this._boneTransform.getTransform(e),e},t}();function k0(t,e,i){un.invert(t,e),un.multiply(t,i,t)}function z0(t,e){switch(e){default:return;case"position":return{setValue:function(e){ji.copy(t.position,e)}};case"rotation":return{setValue:function(e){$i.copy(t.rotation,e)}};case"scale":return{setValue:function(e){ji.copy(t.scale,e)}};case"eulerAngles":return{setValue:function(e){ji.copy(t.eulerAngles,e)}}}}var H0=function(){function t(t,e,i,n){this._lastFrameIndex=-1,this._lastIterations=0,this._lastDirection=0,this._ignoreIndex=-1,this._sampled=!1,this._targetNode=t,this._ratios=e,this._eventGroups=i,this._wrapMode=n}var e=t.prototype;return e.setWrapMode=function(t){this._wrapMode=t},e.ignore=function(t,e){this._ignoreIndex=-1,this._sampled=!1;var i=W0(t,this._ratios);i<0&&(i=~i-1,e<0&&(i+=1),this._ignoreIndex=i)},e.sample=function(t,e,i){var n=this._eventGroups.length,r=W0(t,this._ratios);if(r<0&&(r=~r-1,e<0&&(r+=1)),this._ignoreIndex!==r&&(this._ignoreIndex=-1),!this._sampled)return this._sampled=!0,this._doFire(r,!1),this._lastFrameIndex=r,this._lastIterations=i,void(this._lastDirection=e);var s=this._wrapMode,a=V0(i),o=V0(this._lastIterations),u=this._lastFrameIndex,h=this._lastDirection,l=-1!==o&&a!==o;if(u===r&&l&&1===n)this._doFire(0,!1);else if(u!==r||l){e=h;do{if(u!==r){if(-1===e&&0===u&&r>0?((s&Wu.PingPong)===Wu.PingPong?e*=-1:u=n,o++):1===e&&u===n-1&&r<n-1&&((s&Wu.PingPong)===Wu.PingPong?e*=-1:u=-1,o++),u===r)break;if(o>a)break}u+=e,this._doFire(u,!0)}while(u!==r&&u>-1&&u<n)}this._lastFrameIndex=r,this._lastIterations=i,this._lastDirection=e},e._doFire=function(t,e){e?NQ().pushDelayEvent(this._checkAndFire,this,[t]):this._checkAndFire(t)},e._checkAndFire=function(t){if(this._targetNode&&this._targetNode.isValid){var e=this._eventGroups;if(!(t<0||t>=e.length||this._ignoreIndex===t))for(var i=e[t],n=this._targetNode.components,r=i.events.length,s=0;s<r;++s)for(var a=i.events[s],o=a.functionName,u=n.length,h=0;h<u;++h){var l=n[h],c=l[o];"function"==typeof c&&c.apply(l,a.parameters)}}},t}();function V0(t){return t-(0|t)==0&&(t-=1),0|t}function W0(t,e){return Ju(e,t)}var X0,j0=function(){function t(){this._nodeBlendStates=new Map}var e=t.prototype;return e.createWriter=function(t,e,i,n){var r=this.ref(t,e);return new Y0(t,e,r,i,n)},e.destroyWriter=function(t){var e=t;this.deRef(e.node,e.property)},e.ref=function(t,e){var i=this._nodeBlendStates.get(t);return i||(i=this.createNodeBlendState(),this._nodeBlendStates.set(t,i)),i.refProperty(t,e)},e.deRef=function(t,e){var i=this._nodeBlendStates.get(t);i&&(i.deRefProperty(e),i.empty&&this._nodeBlendStates.delete(t))},e.apply=function(){this._nodeBlendStates.forEach((function(t,e){t.apply(e)}))},t}(),Y0=function(){function t(t,e,i,n,r){this._node=t,this._property=e,this._propertyBlendState=i,this._host=n,this._constants=r}var e=t.prototype;return e.getValue=function(){return this._node[this._property]},e.setValue=function(t){var e=this._propertyBlendState,i=this._host.weight;e.blend(t,i)},h(t,[{key:"node",get:function(){return this._node}},{key:"property",get:function(){return this._property}}]),t}();!function(t){t[t.POSITION=1]="POSITION",t[t.ROTATION=2]="ROTATION",t[t.SCALE=4]="SCALE",t[t.EULER_ANGLES=8]="EULER_ANGLES"}(X0||(X0={}));var K0=X0.POSITION|X0.ROTATION|X0.SCALE|X0.EULER_ANGLES,q0=function(){function t(){this.refCount=0,this.accumulatedWeight=0,this.result=new ji}var e=t.prototype;return e.blend=function(t,e){this.accumulatedWeight=n1(this.result,this.result,this.accumulatedWeight,t,e)},e.reset=function(){this.accumulatedWeight=0,ji.zero(this.result)},t}(),Q0=function(){function t(){this.refCount=0,this.accumulatedWeight=0,this.result=new $i}var e=t.prototype;return e.blend=function(t,e){this.accumulatedWeight=r1(this.result,this.result,this.accumulatedWeight,t,e)},e.reset=function(){this.accumulatedWeight=0,$i.identity(this.result)},t}(),Z0=function(){function t(){this._transformApplyFlags=0,this._properties={}}var e=t.prototype;return e.refProperty=function(t,e){var i,n,r,s=this._properties;switch(e){default:case"position":case"scale":case"eulerAngles":r=null!==(i=s[e])&&void 0!==i?i:s[e]=this._createVec3BlendState(t[e]);break;case"rotation":r=null!==(n=s[e])&&void 0!==n?n:s[e]=this._createQuatBlendState(t.rotation)}return++r.refCount,r},e.deRefProperty=function(t){var e=this._properties,i=e[t];i&&(--i.refCount,i.refCount>0||delete e[t])},e.apply=function(t){var e,i,n,r=this._transformApplyFlags,s=this._properties,a=s.position,o=s.scale,u=s.rotation,h=s.eulerAngles;r&&(a&&r&X0.POSITION&&(e=a.result),o&&r&X0.SCALE&&(i=o.result),h&&r&X0.EULER_ANGLES&&(n=h.result),u&&r&X0.ROTATION&&(n=u.result),(n||e||i)&&t.setRTS(n,e,i),this._transformApplyFlags=0)},h(t,[{key:"empty",get:function(){var t=this._properties;return!(t.position||t.rotation||t.eulerAngles||t.scale)}}]),t}(),J0=function(t){function e(){return t.apply(this,arguments)||this}c(e,t);var i=e.prototype;return i.apply=function(e){var i=this._properties,n=i.position,r=i.scale,s=i.rotation,a=i.eulerAngles;n&&n.accumulatedWeight&&(this._transformApplyFlags|=X0.POSITION,n.accumulatedWeight<1&&n.blend(e.position,1-n.accumulatedWeight)),r&&r.accumulatedWeight&&(this._transformApplyFlags|=X0.SCALE,r.accumulatedWeight<1&&r.blend(e.scale,1-r.accumulatedWeight)),a&&a.accumulatedWeight&&(this._transformApplyFlags|=X0.EULER_ANGLES,a.accumulatedWeight<1&&a.blend(e.eulerAngles,1-a.accumulatedWeight)),s&&s.accumulatedWeight&&(this._transformApplyFlags|=X0.ROTATION,s.accumulatedWeight<1&&s.blend(e.rotation,1-s.accumulatedWeight)),t.prototype.apply.call(this,e),null==n||n.reset(),null==r||r.reset(),null==s||s.reset(),null==a||a.reset()},i._createVec3BlendState=function(){return new q0},i._createQuatBlendState=function(){return new Q0},e}(Z0),$0=function(t){function e(){return t.apply(this,arguments)||this}return c(e,t),e.prototype.createNodeBlendState=function(){return new J0},e}(j0),t1=function(){function t(t){this.refCount=0,this.result=new ji,this._defaultValue=new ji,this._clipBlendResult=new ji,this._accumulatedWeight=0,ji.copy(this._defaultValue,t),ji.copy(this.result,t)}var e=t.prototype;return e.blend=function(t,e){this._accumulatedWeight=n1(this._clipBlendResult,this._clipBlendResult,this._accumulatedWeight,t,e)},e.commitLayerChange=function(t){var e=this.result,i=this._clipBlendResult,n=this._accumulatedWeight;n<1&&this.blend(this._defaultValue,1-n),ji.lerp(e,e,i,t),ji.zero(this._clipBlendResult),this._accumulatedWeight=0},e.reset=function(){ji.copy(this.result,this._defaultValue)},t}(),e1=function(){function t(t){this.refCount=0,this.result=new $i,this._defaultValue=new $i,this._clipBlendResult=new $i,this._accumulatedWeight=0,$i.copy(this._defaultValue,t),$i.copy(this.result,t)}var e=t.prototype;return e.blend=function(t,e){this._accumulatedWeight=r1(this._clipBlendResult,this._clipBlendResult,this._accumulatedWeight,t,e)},e.commitLayerChange=function(t){var e=this.result,i=this._clipBlendResult,n=this._accumulatedWeight;n<1&&this.blend(this._defaultValue,1-n),$i.slerp(e,e,i,t),$i.identity(this._clipBlendResult),this._accumulatedWeight=0},e.reset=function(){$i.copy(this.result,this._defaultValue)},t}(),i1=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._layerMask=-1>>>0,e}c(e,t);var i=e.prototype;return i.setLayerMask=function(t){this._layerMask&=~(1<<t)},i.commitLayerChanges=function(t,e){if(this._layerMask&1<<t){var i=this._properties,n=i.position,r=i.scale,s=i.rotation,a=i.eulerAngles;n&&n.commitLayerChange(e),r&&r.commitLayerChange(e),s&&s.commitLayerChange(e),a&&a.commitLayerChange(e)}},i.apply=function(e){this._transformApplyFlags=K0,t.prototype.apply.call(this,e);var i=this._properties,n=i.position,r=i.scale,s=i.rotation,a=i.eulerAngles;null==n||n.reset(),null==r||r.reset(),null==s||s.reset(),null==a||a.reset()},i._createVec3BlendState=function(t){return new t1(t)},i._createQuatBlendState=function(t){return new e1(t)},e}(Z0);function n1(t,e,i,n,r){var s=i+r;if(1!==r||i){if(s){var a=r/s;ji.lerp(t,t,n,a)}}else ji.copy(t,n);return s}function r1(t,e,i,n,r){var s=i+r;if(1!==r||i){if(s){var a=r/s;$i.slerp(t,e,n,a)}}else $i.copy(t,n);return s}!function(t){function e(){return t.apply(this,arguments)||this}c(e,t);var i=e.prototype;i.setMask=function(t,e){this._nodeBlendStates.forEach((function(i,n){e.has(n)&&i.setLayerMask(t)}))},i.commitLayerChanges=function(t,e){this._nodeBlendStates.forEach((function(i){i.commitLayerChanges(t,e)}))},i.createNodeBlendState=function(){return new i1}}(j0);var s1,a1,o1,u1=[],h1=new Map;function l1(t,e){for(var i=0,n=un.IDENTITY;t;){if(t.stamp===e||t.stamp+1===e&&!t.node.hasChangedFlags){n=t.world,t.stamp=e;break}t.stamp=e,u1[i++]=t,t=t.parent}for(;i>0;){t=u1[--i],u1[i]=null;var r=t.node;un.fromRTS(t.local,r.rotation,r.position,r.scale),n=un.multiply(t.world,n,t.local)}return n}function c1(t){for(var e=h1.get(t.uuid)||null;e;)h1.delete(e.node.uuid),e=e.parent}var _1=t("AnimationManager",_h((o1=a1=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._anims=new pt([]),e._crossFades=new pt([]),e._delayEvents=[],e._blendStateBuffer=new $0,e._sockets=[],e}c(e,t);var i=e.prototype;return i.addCrossFade=function(t){-1===this._crossFades.array.indexOf(t)&&this._crossFades.push(t)},i.removeCrossFade=function(t){var e=this._crossFades.array.indexOf(t);e>=0?this._crossFades.fastRemoveAt(e):K(3907)},i.update=function(t){var e=this._delayEvents,i=this._crossFades,n=this._sockets,r=i.array;for(i.i=0;i.i<r.length;++i.i)r[i.i].update(t);var s=this._anims,a=s.array;for(s.i=0;s.i<a.length;++s.i){var o=a[s.i];o.isMotionless||o.update(t)}this._blendStateBuffer.apply();for(var u=b.director.getTotalFrames(),h=0,l=n.length;h<l;h++){var c=n[h],_=c.target,f=c.transform;_.matrix=l1(f,u)}for(var d=0,p=e.length;d<p;d++){var m=e[d];m.fn.apply(m.thisArg,m.args)}e.length=0},i.destruct=function(){},i.addAnimation=function(t){-1===this._anims.array.indexOf(t)&&this._anims.push(t)},i.removeAnimation=function(t){var e=this._anims.array.indexOf(t);e>=0?this._anims.fastRemoveAt(e):K(3907)},i.pushDelayEvent=function(t,e,i){this._delayEvents.push({fn:t,thisArg:e,args:i})},i.addSockets=function(t,e){for(var i=this,n=function(n){var r=e[n];if(i._sockets.find((function(t){return t.target===r.target})))return"continue";var s=t.getChildByPath(r.path),a=r.target&&s&&function(t,e){for(var i,n=null,r=0;t!==e;){var s=t.uuid;if(h1.has(s)){n=h1.get(s);break}n={node:t,local:new un,world:new un,stamp:-1,parent:null},h1.set(s,n),u1[r++]=n,t=t.parent,n=null}for(;r>0;)i=u1[--r],u1[r]=null,i.parent=n,n=i;return n}(s,t);a&&i._sockets.push({target:r.target,transform:a})},r=0;r<e.length;++r)n(r)},i.removeSockets=function(t,e){for(var i=0;i<e.length;++i)for(var n=e[i],r=0;r<this._sockets.length;++r){var s=this._sockets[r];if(s.target===n.target){c1(s.transform.node),this._sockets[r]=this._sockets[this._sockets.length-1],this._sockets.length--;break}}},h(e,[{key:"blendState",get:function(){return this._blendStateBuffer}}]),e}(KE),a1.ID="animation",s1=o1))||s1);OL.on(IL.EVENT_INIT,(function(){var t=new _1;OL.registerSystem(_1.ID,t,KE.Priority.HIGH)})),b.AnimationManager=_1;var f1,d1,p1,m1,g1,v1,y1,E1,T1,S1,A1,R1,b1,C1,w1,I1,O1,x1=function(t){function e(e){var i;return(i=t.call(this)||this)._managedStates=[],i._fadings=[],i._scheduled=!1,i._scheduler=null!=e?e:NQ(),i}c(e,t);var i=e.prototype;return i.update=function(t){if(!this.isMotionless){var e=this._managedStates,i=this._fadings;if(1===e.length&&1===i.length){var n=e[0].state;n&&(n.weight=1)}else this._calculateWeights(t);1===e.length&&1===i.length&&this._unscheduleThis()}},i.crossFade=function(t,e){var i;0===this._managedStates.length&&(e=0),0===e&&this.clear();var n=this._managedStates.find((function(e){return e.state===t}));n?(null===(i=n.state)||void 0===i?void 0:i.isMotionless)&&n.state.play():(n={state:t,reference:0},t&&t.play(),this._managedStates.push(n)),++n.reference,this._fadings.unshift({easeDuration:e,easeTime:0,target:n}),this.isMotionless||this._scheduleThis()},i.clear=function(){for(var t=0;t<this._managedStates.length;++t){var e=this._managedStates[t].state;e&&e.stop()}this._managedStates.length=0,this._fadings.length=0},i.onPlay=function(){t.prototype.onPlay.call(this),this._scheduleThis()},i.onPause=function(){t.prototype.onPause.call(this);for(var e=0;e<this._managedStates.length;++e){var i=this._managedStates[e].state;i&&i.pause()}this._unscheduleThis()},i.onResume=function(){t.prototype.onResume.call(this);for(var e=0;e<this._managedStates.length;++e){var i=this._managedStates[e].state;i&&i.resume()}this._scheduleThis()},i.onStop=function(){t.prototype.onStop.call(this),this.clear()},i._calculateWeights=function(t){for(var e=this._managedStates,i=this._fadings,n=0;n<e.length;++n){var r=e[n].state;r&&(r.weight=0)}for(var s=1,a=i.length,o=0;o<i.length;++o){var u=i[o];u.easeTime+=t;var h=0===u.easeDuration?1:yi(u.easeTime/u.easeDuration),l=h*s;if(s*=1-h,u.target.state&&(u.target.state.weight+=l),u.easeTime>=u.easeDuration){a=o+1,u.easeTime=u.easeDuration;break}}if(a!==i.length){for(var c=a;c<i.length;++c){var _=i[c];--_.target.reference,_.target.reference<=0&&(_.target.state&&_.target.state.stop(),vt(this._managedStates,_.target))}i.splice(a)}},i._scheduleThis=function(){this._scheduled||(this._scheduler.addCrossFade(this),this._scheduled=!0)},i._unscheduleThis=function(){this._scheduled&&(this._scheduler.removeCrossFade(this),this._scheduled=!1)},e}(DQ),P1=function(e){return t({Animation:e,AnimationComponent:e}),e}((f1=_h("cc.Animation"),d1=xh(),p1=dh(99),m1=Ch(),g1=Kh([B0]),v1=Mh(),y1=Kh(B0),E1=Mh(),T1=Mh(),S1=Kh([B0]),f1(A1=d1(A1=p1(A1=bh(A1=m1((O1=I1=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return E(e=t.call.apply(t,[this].concat(n))||this,"playOnLoad",b1,g(e)),e._crossFade=new x1,e._nameToState=Bt(!0),E(e,"_clips",C1,g(e)),E(e,"_defaultClip",w1,g(e)),e._hasBeenPlayed=!1,e}c(e,t);var i=e.prototype;return i.onLoad=function(){for(var t in this.clips=this._clips,this._nameToState)this._nameToState[t].initialize(this.node)},i.start=function(){this.playOnLoad&&!this._hasBeenPlayed&&this._defaultClip&&this.crossFade(this._defaultClip.name,0)},i.onEnable=function(){this._crossFade.resume()},i.onDisable=function(){this._crossFade.pause()},i.onDestroy=function(){for(var t in this._crossFade.stop(),this._nameToState)this._nameToState[t].destroy();this._nameToState=Bt(!0)},i.play=function(t){if(this._hasBeenPlayed=!0,!t){if(!this._defaultClip)return;t=this._defaultClip.name}this.crossFade(t,0)},i.crossFade=function(t,e){void 0===e&&(e=.3),this._hasBeenPlayed=!0;var i=this._nameToState[t];i&&this.doPlayOrCrossFade(i,e)},i.pause=function(){this._crossFade.pause()},i.resume=function(){this._crossFade.resume()},i.stop=function(){this._crossFade.stop()},i.getState=function(t){var e=this._nameToState[t];return e&&!e.curveLoaded&&e.initialize(this.node),e||null},i.createState=function(t,e){return e=e||t.name,this.removeState(e),this._doCreateState(t,e)},i.removeState=function(t){var e=this._nameToState[t];e&&(e.allowLastFrameEvent(!1),e.stop(),delete this._nameToState[t])},i.addClip=function(t,e){return yt(this._clips,t)||this._clips.push(t),this.createState(t,e)},i.removeClip=function(t,e){var i;for(var n in this._nameToState){var r=this._nameToState[n];if(r.clip===t){i=r;break}}if(t===this._defaultClip){if(!e)return void j(3902);this._defaultClip=null}if(i&&i.isPlaying){if(!e)return void j(3903);i.stop()}this._clips=this._clips.filter((function(e){return e!==t})),i&&delete this._nameToState[i.name]},i.on=function(e,i,n,r){var s=t.prototype.on.call(this,e,i,n,r);return e===IQ.LASTFRAME&&this._syncAllowLastFrameEvent(),s},i.once=function(e,i,n){var r=t.prototype.once.call(this,e,i,n);return e===IQ.LASTFRAME&&this._syncAllowLastFrameEvent(),r},i.off=function(e,i,n){t.prototype.off.call(this,e,i,n),e===IQ.LASTFRAME&&this._syncDisallowLastFrameEvent()},i._createState=function(t,e){return new GQ(t,e)},i._doCreateState=function(t,e){var i=this._createState(t,e);return i._setEventTarget(this),i.allowLastFrameEvent(this.hasEventListener(IQ.LASTFRAME)),this.node&&i.initialize(this.node),this._nameToState[i.name]=i,i},i.doPlayOrCrossFade=function(t,e){this._crossFade.play(),this._crossFade.crossFade(t,e)},i._removeStateOfAutomaticClip=function(t){for(var e in this._nameToState){var i=this._nameToState[e];D1(t,i.clip)&&(i.stop(),delete this._nameToState[e])}},i._syncAllowLastFrameEvent=function(){if(this.hasEventListener(IQ.LASTFRAME))for(var t in this._nameToState)this._nameToState[t].allowLastFrameEvent(!0)},i._syncDisallowLastFrameEvent=function(){if(!this.hasEventListener(IQ.LASTFRAME))for(var t in this._nameToState)this._nameToState[t].allowLastFrameEvent(!1)},h(e,[{key:"clips",get:function(){return this._clips},set:function(t){var e=this;this._crossFade&&this._crossFade.clear();for(var i,n=y(this._clips);!(i=n()).done;){var r=i.value;r&&this._removeStateOfAutomaticClip(r)}for(var s,a=y(t);!(s=a()).done;){var o=s.value;o&&this.createState(o)}var u=t.find((function(t){return D1(t,e._defaultClip)}));this._defaultClip=u||null,this._clips=t}},{key:"defaultClip",get:function(){return this._defaultClip},set:function(t){this._defaultClip=t,t&&(this._clips.findIndex((function(e){return D1(e,t)}))>=0||(this._clips.push(t),this.createState(t)))}}]),e}(Da(bc)),I1.EventType=IQ,T((R1=O1).prototype,"clips",[g1,v1],Object.getOwnPropertyDescriptor(R1.prototype,"clips"),R1.prototype),T(R1.prototype,"defaultClip",[y1,E1],Object.getOwnPropertyDescriptor(R1.prototype,"defaultClip"),R1.prototype),b1=T(R1.prototype,"playOnLoad",[Eh,T1],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),C1=T(R1.prototype,"_clips",[S1],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),w1=T(R1.prototype,"_defaultClip",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),A1=R1))||A1)||A1)||A1)||A1)||A1));function D1(t,e){return t===e||!!t&&!!e&&t._uuid===e._uuid&&t._uuid}b.Animation=P1,b.AnimationComponent=P1,le.setClassAlias(P1,"cc.AnimationComponent");var B1,N1,M1,L1=new un;b.easing=Ef,function(t){t.PLAYED="play",t.PAUSED="pause",t.STOPPED="stop",t.SEEKED="seeked",t.ENDED="ended",t.INTERRUPTION_BEGIN="interruptionBegin",t.INTERRUPTION_END="interruptionEnd",t.USER_GESTURE="on_gesture"}(B1||(B1={})),function(t){t[t.DOM_AUDIO=0]="DOM_AUDIO",t[t.WEB_AUDIO=1]="WEB_AUDIO",t[t.MINIGAME_AUDIO=2]="MINIGAME_AUDIO",t[t.NATIVE_AUDIO=3]="NATIVE_AUDIO",t[t.UNKNOWN_AUDIO=4]="UNKNOWN_AUDIO"}(N1||(N1={})),function(t){t[t.INIT=0]="INIT",t[t.PLAYING=1]="PLAYING",t[t.PAUSED=2]="PAUSED",t[t.STOPPED=3]="STOPPED",t[t.INTERRUPTED=4]="INTERRUPTED"}(M1||(M1={}));var F1,U1=t("AudioPCMDataView",function(){function t(){if(this._bufferView=void 0,this._normalizeFactor=1,2===arguments.length)this._bufferView=arguments.length<=0?void 0:arguments[0],this._normalizeFactor=arguments.length<=1?void 0:arguments[1];else{var t=arguments.length<=0?void 0:arguments[0],e=arguments.length<=1?void 0:arguments[1],i=arguments.length<=2?void 0:arguments[2];this._bufferView=new e(t),this._normalizeFactor=i}}return t.prototype.getData=function(t){return this._bufferView[t]*this._normalizeFactor},h(t,[{key:"length",get:function(){return this._bufferView.length}}]),t}()),G1=0;function k1(t,e){var i;e.invoking||(e.invoking=!0,(i=e.func).call.apply(i,[t].concat(e.args)).then((function(){e.invoking=!1,t._operationQueue.shift(),t._eventTarget.emit(e.id.toString());var i=t._operationQueue[0];i&&k1(t,i)})).catch((function(){})))}function z1(t,e,i){var n=i.value;i.value=function(){for(var t=this,e=arguments.length,i=new Array(e),r=0;r<e;r++)i[r]=arguments[r];return new Promise((function(e){var r=G1++,s=t;s._operationQueue.push({id:r,func:n,args:i,invoking:!1}),s._eventTarget.once(r.toString(),e),k1(s,s._operationQueue[0])}))}}function H1(t){return new Promise((function(e){var i=t.play();return void 0===i?e():(i.then(e).catch((function(){var i=function(){t.play().catch((function(){})),e()},n=document.getElementById("GameCanvas");null==n||n.addEventListener("touchend",i,{once:!0}),null==n||n.addEventListener("mousedown",i,{once:!0})})),null)}))}var V1,W1,X1=function(){function t(t,e){this._domAudio=void 0,this._onPlayCb=void 0,this._onEndCb=void 0,this._domAudio=t,t.volume=e}var e=t.prototype;return e.play=function(){var t=this;H1(this._domAudio).then((function(){var e;null===(e=t.onPlay)||void 0===e||e.call(t)})).catch((function(){}))},e.stop=function(){this._domAudio.pause()},h(t,[{key:"onPlay",get:function(){return this._onPlayCb},set:function(t){this._onPlayCb=t}},{key:"onEnd",get:function(){return this._onEndCb},set:function(t){this._onEndCb&&this._domAudio.removeEventListener("ended",this._onEndCb),this._onEndCb=t,t&&this._domAudio.addEventListener("ended",t)}}]),t}(),j1=(T((F1=function(){function t(t){var e=this;this._domAudio=void 0,this._state=M1.INIT,this._onEnded=void 0,this._eventTarget=new Ba,this._operationQueue=[],this._domAudio=t,Ha.on("hide",this._onHide,this),Ha.on("show",this._onShow,this),this._onEnded=function(){e.seek(0).catch((function(){})),e._state=M1.INIT,e._eventTarget.emit(B1.ENDED)},this._domAudio.addEventListener("ended",this._onEnded)}var e=t.prototype;return e.destroy=function(){Ha.off("hide",this._onHide,this),Ha.off("show",this._onShow,this),this._domAudio.removeEventListener("ended",this._onEnded),this._domAudio=null},t.load=function(e){return new Promise((function(i){t.loadNative(e).then((function(e){i(new t(e))})).catch((function(){}))}))},t.loadNative=function(t){return new Promise((function(e,i){var n=document.createElement("audio"),r="canplaythrough";Ha.os===Fa.IOS?r="loadedmetadata":Ha.browserType===Na.FIREFOX&&(r="canplay");var s=setTimeout((function(){0===n.readyState?u():o()}),8e3),a=function(){clearTimeout(s),n.removeEventListener(r,o,!1),n.removeEventListener("error",u,!1)},o=function(){a(),e(n)},u=function(){a(),i("load audio failure - "+t)};n.addEventListener(r,o,!1),n.addEventListener("error",u,!1),n.src=t}))},t.loadOneShotAudio=function(e,i){return new Promise((function(n,r){t.loadNative(e).then((function(t){var e=new X1(t,i);n(e)})).catch(r)}))},e._onHide=function(){var t=this;this._state===M1.PLAYING&&this.pause().then((function(){t._state=M1.INTERRUPTED,t._eventTarget.emit(B1.INTERRUPTION_BEGIN)})).catch((function(){}))},e._onShow=function(){var t=this;this._state===M1.INTERRUPTED&&this.play().then((function(){t._eventTarget.emit(B1.INTERRUPTION_END)})).catch((function(){}))},e.getPCMData=function(){},e.seek=function(t){return t=vi(t,0,this.duration),this._domAudio.currentTime=t,Promise.resolve()},e.play=function(){var t=this;return new Promise((function(e){H1(t._domAudio).then((function(){t._state=M1.PLAYING,e()})).catch((function(){}))}))},e.pause=function(){return this._domAudio.pause(),this._state=M1.PAUSED,Promise.resolve()},e.stop=function(){var t=this;return new Promise((function(e){t._domAudio.pause(),t._domAudio.currentTime=0,t._state=M1.STOPPED,e()}))},e.onInterruptionBegin=function(t){this._eventTarget.on(B1.INTERRUPTION_BEGIN,t)},e.offInterruptionBegin=function(t){this._eventTarget.off(B1.INTERRUPTION_BEGIN,t)},e.onInterruptionEnd=function(t){this._eventTarget.on(B1.INTERRUPTION_END,t)},e.offInterruptionEnd=function(t){this._eventTarget.off(B1.INTERRUPTION_END,t)},e.onEnded=function(t){this._eventTarget.on(B1.ENDED,t)},e.offEnded=function(t){this._eventTarget.off(B1.ENDED,t)},h(t,[{key:"src",get:function(){return this._domAudio?this._domAudio.src:""}},{key:"type",get:function(){return N1.DOM_AUDIO}},{key:"state",get:function(){return this._state}},{key:"loop",get:function(){return this._domAudio.loop},set:function(t){this._domAudio.loop=t}},{key:"volume",get:function(){return this._domAudio.volume},set:function(t){t=yi(t),this._domAudio.volume=t}},{key:"duration",get:function(){return this._domAudio.duration}},{key:"currentTime",get:function(){return this._domAudio.currentTime}},{key:"sampleRate",get:function(){return 0}}]),t}()).prototype,"seek",[z1],Object.getOwnPropertyDescriptor(F1.prototype,"seek"),F1.prototype),T(F1.prototype,"play",[z1],Object.getOwnPropertyDescriptor(F1.prototype,"play"),F1.prototype),T(F1.prototype,"pause",[z1],Object.getOwnPropertyDescriptor(F1.prototype,"pause"),F1.prototype),T(F1.prototype,"stop",[z1],Object.getOwnPropertyDescriptor(F1.prototype,"stop"),F1.prototype),F1),Y1=function(){function t(t){this._nativeAudio=void 0,this._startTime=0,this._startOffset=0,this._isPaused=!0,this._nativeAudio=t}var e=t.prototype;return e.destroy=function(){this._nativeAudio=void 0},e._now=function(){return performance.now()/1e3},e._calculateCurrentTime=function(){var t=this._now()-this._startTime,e=this._startOffset+t;return e>=this.duration&&(this._startTime=this._now(),this._startOffset=0),e%this.duration},e.start=function(){this._isPaused=!1,this._startTime=this._now()},e.pause=function(){this._isPaused||(this._isPaused=!0,this._startOffset=this._calculateCurrentTime())},e.stop=function(){this._isPaused=!0,this._startOffset=0},e.seek=function(t){this._startTime=this._now(),this._startOffset=vi(t,0,this.duration)},h(t,[{key:"duration",get:function(){return this._nativeAudio.duration}},{key:"currentTime",get:function(){return this._isPaused?this._startOffset:this._calculateCurrentTime()}}]),t}(),K1=new(function(){function t(){this._audioBufferDataMap={}}var e=t.prototype;return e.addCache=function(t,e){this._audioBufferDataMap[t]?console.warn("Audio buffer "+t+" has been cached"):this._audioBufferDataMap[t]={usedCount:1,audioBuffer:e}},e.retainCache=function(t){var e=this._audioBufferDataMap[t];e?e.usedCount++:console.warn("Audio buffer cache "+t+" has not been added.")},e.getCache=function(t){var e=this._audioBufferDataMap[t];return null==e?void 0:e.audioBuffer},e.tryReleasingCache=function(t){var e=this._audioBufferDataMap[t];e?--e.usedCount<=0&&delete this._audioBufferDataMap[t]:console.warn("Audio buffer cache "+t+" has not been added.")},t}()),q1=window.AudioContext||window.webkitAudioContext||window.mozAudioContext,Q1="on-context-running",Z1=function(){function t(){var t=this;this._eventTarget=void 0,this._context=void 0,this._isRunning=!1,this._context=new(window.AudioContext||window.webkitAudioContext||window.mozAudioContext),this._eventTarget=new Ba,this._context.onstatechange=function(){"running"===t._context.state?(t._isRunning=!0,t._eventTarget.emit(Q1)):t._isRunning=!1}}var e=t.prototype;return e.onceRunning=function(t,e){this._eventTarget.once(Q1,t,e)},e.offRunning=function(t,e){this._eventTarget.off(Q1,t,e)},e.decodeAudioData=function(t){var e=this;return new Promise((function(i){var n=e._context.decodeAudioData(t,(function(t){i(t)}),(function(t){console.error("failed to load Web Audio",t)}));null==n||n.catch((function(){}))}))},e.runContext=function(){var t=this;return new Promise((function(e){if(t.isRunning)e();else{var i=t._context;if(i.resume)if(i.resume().catch((function(){})),"running"!==i.state){var n=document.getElementById("GameCanvas"),r=function(){i.resume().then(e).catch((function(){}))};null==n||n.addEventListener("touchend",r,{once:!0,capture:!0}),null==n||n.addEventListener("mouseup",r,{once:!0,capture:!0})}else e();else e()}}))},e.createBufferSource=function(t,e){var i=this._context.createBufferSource();return void 0!==t&&(i.buffer=t),void 0!==e&&(i.loop=e),i},e.createGain=function(t){void 0===t&&(t=1);var e=this._context.createGain();return this.setGainValue(e,t),e},e.setGainValue=function(t,e){if(t.gain.setTargetAtTime)try{t.gain.setTargetAtTime(e,this._context.currentTime,0)}catch(i){t.gain.setTargetAtTime(e,this._context.currentTime,.01)}else t.gain.value=e},e.connectContext=function(t){this._context&&t.connect(this._context.destination)},h(t,[{key:"isRunning",get:function(){return this._isRunning}},{key:"currentTime",get:function(){return this._context.currentTime}}]),t}();Z1.support=!!q1,Z1.support&&(W1=new Z1);var J1,$1,t2,e2,i2,n2=function(){function t(t,e,i){this._duration=void 0,this._bufferSourceNode=void 0,this._onPlayCb=void 0,this._currentTimer=0,this._url=void 0,this._onEndCb=void 0,this._duration=t.duration,this._url=i,this._bufferSourceNode=W1.createBufferSource(t,!1);var n=W1.createGain(e);this._bufferSourceNode.connect(n),W1.connectContext(n)}var e=t.prototype;return e.play=function(){var t=this;this._bufferSourceNode.start(),W1.runContext().then((function(){var e;null===(e=t.onPlay)||void 0===e||e.call(t),t._currentTimer=window.setTimeout((function(){var e;K1.tryReleasingCache(t._url),null===(e=t.onEnd)||void 0===e||e.call(t)}),1e3*t._duration)})).catch((function(){}))},e.stop=function(){clearTimeout(this._currentTimer),K1.tryReleasingCache(this._url),this._bufferSourceNode.stop(),this._bufferSourceNode.buffer=null},h(t,[{key:"onPlay",get:function(){return this._onPlayCb},set:function(t){this._onPlayCb=t}},{key:"onEnd",get:function(){return this._onEndCb},set:function(t){this._onEndCb=t}}]),t}(),r2=(T((V1=function(){function t(t,e){this._src=void 0,this._audioBuffer=void 0,this._sourceNode=void 0,this._gainNode=void 0,this._currentTimer=0,this._volume=1,this._loop=!1,this._state=M1.INIT,this._audioTimer=void 0,this._eventTarget=new Ba,this._operationQueue=[],this._audioBuffer=t,this._audioTimer=new Y1(t),this._gainNode=W1.createGain(),W1.connectContext(this._gainNode),this._src=e,Ha.on("hide",this._onHide,this),Ha.on("show",this._onShow,this)}var e=t.prototype;return e.destroy=function(){this._audioTimer.destroy(),this._audioBuffer&&(this._audioBuffer=null),K1.tryReleasingCache(this._src),Ha.off("hide",this._onHide,this),Ha.off("show",this._onShow,this)},t.load=function(e){return new Promise((function(i){t.loadNative(e).then((function(n){i(new t(n,e))})).catch((function(){}))}))},t.loadNative=function(t){return new Promise((function(e,i){var n=K1.getCache(t);if(n)return K1.retainCache(t),void e(n);var r=new XMLHttpRequest,s="load audio failed: "+t+", status: ";r.open("GET",t,!0),r.responseType="arraybuffer",r.onload=function(){200===r.status||0===r.status?W1.decodeAudioData(r.response).then((function(i){K1.addCache(t,i),e(i)})).catch((function(){})):i(new Error(""+s+r.status+"(no response)"))},r.onerror=function(){i(new Error(""+s+r.status+"(error)"))},r.ontimeout=function(){i(new Error(""+s+r.status+"(time out)"))},r.onabort=function(){i(new Error(""+s+r.status+"(abort)"))},r.send(null)}))},t.loadOneShotAudio=function(e,i){return new Promise((function(n,r){t.loadNative(e).then((function(t){var r=new n2(t,i,e);n(r)})).catch(r)}))},e.getPCMData=function(t){return new U1(this._audioBuffer.getChannelData(t),1)},e._onHide=function(){var t=this;this._state===M1.PLAYING&&this.pause().then((function(){t._state=M1.INTERRUPTED,t._eventTarget.emit(B1.INTERRUPTION_BEGIN)})).catch((function(){}))},e._onShow=function(){var t=this;this._state===M1.INTERRUPTED&&this.play().then((function(){t._eventTarget.emit(B1.INTERRUPTION_END)})).catch((function(){}))},e.seek=function(t){var e=this;return new Promise((function(i){W1.offRunning(),e._audioTimer.seek(t),e._state===M1.PLAYING?e._doPlay().then(i).catch((function(){})):i()}))},e.play=function(){return W1.offRunning(),this._doPlay()},e._doPlay=function(){var t=this;return new Promise((function(e){W1.isRunning?(t._startSourceNode(),e()):(W1.onceRunning((function(){t._startSourceNode(),e()})),W1.runContext().catch((function(){})))}))},e._startSourceNode=function(){var t=this;this._stopSourceNode(),this._sourceNode=W1.createBufferSource(this._audioBuffer,this.loop),this._sourceNode.connect(this._gainNode),this._sourceNode.start(0,this._audioTimer.currentTime),this._state=M1.PLAYING,this._audioTimer.start(),window.clearTimeout(this._currentTimer),this._currentTimer=window.setTimeout((function e(){t.loop?t._currentTimer=window.setTimeout(e,1e3*t._audioBuffer.duration):(t._audioTimer.stop(),t._eventTarget.emit(B1.ENDED),t._state=M1.INIT)}),1e3*(this._audioBuffer.duration-this._audioTimer.currentTime))},e._stopSourceNode=function(){try{this._sourceNode&&(this._sourceNode.stop(),this._sourceNode.buffer=null)}catch(t){}},e.pause=function(){return W1.offRunning(),this._state===M1.PLAYING&&this._sourceNode?(this._audioTimer.pause(),this._state=M1.PAUSED,window.clearTimeout(this._currentTimer),this._stopSourceNode(),Promise.resolve()):Promise.resolve()},e.stop=function(){return W1.offRunning(),this._sourceNode?(this._audioTimer.stop(),this._state=M1.STOPPED,window.clearTimeout(this._currentTimer),this._stopSourceNode(),Promise.resolve()):Promise.resolve()},e.onInterruptionBegin=function(t){this._eventTarget.on(B1.INTERRUPTION_BEGIN,t)},e.offInterruptionBegin=function(t){this._eventTarget.off(B1.INTERRUPTION_BEGIN,t)},e.onInterruptionEnd=function(t){this._eventTarget.on(B1.INTERRUPTION_END,t)},e.offInterruptionEnd=function(t){this._eventTarget.off(B1.INTERRUPTION_END,t)},e.onEnded=function(t){this._eventTarget.on(B1.ENDED,t)},e.offEnded=function(t){this._eventTarget.off(B1.ENDED,t)},h(t,[{key:"sampleRate",get:function(){return this._audioBuffer.sampleRate}},{key:"src",get:function(){return this._src}},{key:"type",get:function(){return N1.WEB_AUDIO}},{key:"state",get:function(){return this._state}},{key:"loop",get:function(){return this._loop},set:function(t){this._loop=t,this._sourceNode&&(this._sourceNode.loop=t)}},{key:"volume",get:function(){return this._volume},set:function(t){t=yi(t),this._volume=t,W1.setGainValue(this._gainNode,t)}},{key:"duration",get:function(){return this._audioBuffer.duration}},{key:"currentTime",get:function(){return this._audioTimer.currentTime}}]),t}()).prototype,"seek",[z1],Object.getOwnPropertyDescriptor(V1.prototype,"seek"),V1.prototype),T(V1.prototype,"play",[z1],Object.getOwnPropertyDescriptor(V1.prototype,"play"),V1.prototype),T(V1.prototype,"pause",[z1],Object.getOwnPropertyDescriptor(V1.prototype,"pause"),V1.prototype),T(V1.prototype,"stop",[z1],Object.getOwnPropertyDescriptor(V1.prototype,"stop"),V1.prototype),V1),s2=function(){function t(t){this._audio=void 0,this._audio=t}var e=t.prototype;return e.play=function(){this._audio.play()},e.stop=function(){this._audio.stop()},h(t,[{key:"onPlay",get:function(){return this._audio.onPlay},set:function(t){this._audio.onPlay=t}},{key:"onEnd",get:function(){return this._audio.onEnd},set:function(t){this._audio.onEnd=t}}]),t}(),a2=function(){function t(t){this._player=void 0,this._player=t}t.load=function(e,i){return new Promise((function(n){(null==i?void 0:i.audioLoadMode)!==N1.DOM_AUDIO&&Z1.support?r2.load(e).then((function(e){n(new t(e))})).catch((function(){})):(Z1.support||j(5201),j1.load(e).then((function(e){n(new t(e))})).catch((function(){})))}))};var e=t.prototype;return e.destroy=function(){this._player.destroy()},t.loadNative=function(t,e){return(null==e?void 0:e.audioLoadMode)!==N1.DOM_AUDIO&&Z1.support?r2.loadNative(t):(Z1.support||j(5201),j1.loadNative(t))},t.loadOneShotAudio=function(t,e,i){return new Promise((function(n,r){(null==i?void 0:i.audioLoadMode)!==N1.DOM_AUDIO&&Z1.support?r2.loadOneShotAudio(t,e).then((function(t){n(new s2(t))})).catch(r):(Z1.support||j(5201),j1.loadOneShotAudio(t,e).then((function(t){n(new s2(t))})).catch(r))}))},e.getPCMData=function(t){return this._player.getPCMData(t)},e.seek=function(t){return this._player.seek(t)},e.play=function(){return this._player.play()},e.pause=function(){return this._player.pause()},e.stop=function(){return this._player.stop()},e.onInterruptionBegin=function(t){this._player.onInterruptionBegin(t)},e.offInterruptionBegin=function(t){this._player.offInterruptionBegin(t)},e.onInterruptionEnd=function(t){this._player.onInterruptionEnd(t)},e.offInterruptionEnd=function(t){this._player.offInterruptionEnd(t)},e.onEnded=function(t){this._player.onEnded(t)},e.offEnded=function(t){this._player.offEnded(t)},h(t,[{key:"src",get:function(){return this._player.src}},{key:"type",get:function(){return this._player.type}},{key:"state",get:function(){return this._player.state}},{key:"loop",get:function(){return this._player.loop},set:function(t){this._player.loop=t}},{key:"volume",get:function(){return this._player.volume},set:function(t){this._player.volume=t}},{key:"duration",get:function(){return this._player.duration}},{key:"currentTime",get:function(){return this._player.currentTime}},{key:"sampleRate",get:function(){return this._player.sampleRate}}]),t}();a2.maxAudioChannel=24;var o2=t("AudioClip",_h("cc.AudioClip")((i2=e2=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return E(e=t.call.apply(t,[this].concat(n))||this,"_duration",t2,g(e)),e._loadMode=N1.UNKNOWN_AUDIO,e._meta=null,e._player=null,e}c(e,t);var i=e.prototype;return i.destroy=function(){var e,i=t.prototype.destroy.call(this);return null===(e=this._player)||void 0===e||e.destroy(),this._player=null,this._meta&&(this._meta.player=null),i},i.validate=function(){return!!this._meta},i.getDuration=function(){return this._duration?this._duration:this._meta?this._meta.duration:0},i.getCurrentTime=function(){return this._player?this._player.currentTime:0},i.getVolume=function(){return this._player?this._player.volume:0},i.getLoop=function(){return!!this._player&&this._player.loop},i.setCurrentTime=function(t){var e;null===(e=this._player)||void 0===e||e.seek(t).catch((function(){}))},i.setVolume=function(t){this._player&&(this._player.volume=t)},i.setLoop=function(t){this._player&&(this._player.loop=t)},i.play=function(){var t;null===(t=this._player)||void 0===t||t.play().catch((function(){}))},i.pause=function(){var t;null===(t=this._player)||void 0===t||t.pause().catch((function(){}))},i.stop=function(){var t;null===(t=this._player)||void 0===t||t.stop().catch((function(){}))},i.playOneShot=function(t){void 0===t&&(t=1),this._nativeAsset&&a2.loadOneShotAudio(this._nativeAsset.url,t).then((function(t){t.play()})).catch((function(){}))},h(e,[{key:"_nativeAsset",get:function(){return this._meta},set:function(t){this._meta=t,t?(this._loadMode=t.type,this._player=t.player):(this._meta=null,this._loadMode=N1.UNKNOWN_AUDIO,this._duration=0)}},{key:"_nativeDep",get:function(){return{uuid:this._uuid,audioLoadMode:this.loadMode,ext:this._native,__isNative__:!0}}},{key:"loadMode",get:function(){return this._loadMode}},{key:"state",get:function(){return this._player?this._player.state:M1.INIT}}]),e}(Wl),e2.AudioType=N1,t2=T(($1=i2).prototype,"_duration",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),T($1.prototype,"_nativeDep",[qh],Object.getOwnPropertyDescriptor($1.prototype,"_nativeDep"),$1.prototype),J1=$1))||J1);function u2(t,e,i){a2.load(t,{audioLoadMode:e.audioLoadMode}).then((function(e){var n={player:e,url:t,duration:e.duration,type:e.type};i(null,n)})).catch((function(t){i(t)}))}function h2(t,e,i,n){var r=new o2;r._nativeUrl=t,r._nativeAsset=e,r._duration=e.duration,n(null,r)}b.AudioClip=o2,Gv.register({".mp3":u2,".ogg":u2,".wav":u2,".m4a":u2}),Zv.register({".mp3":h2,".ogg":h2,".wav":h2,".m4a":h2});var l2,c2,_2,f2,d2,p2,m2,g2,v2,y2,E2,T2,S2,A2,R2,b2,C2,w2,I2,O2=new(function(){function t(){this._oneShotAudioInfoList=[],this._audioPlayerInfoList=[]}var e=t.prototype;return e._findIndex=function(t,e){return t.findIndex((function(t){return t.audio===e}))},e._tryAddPlaying=function(t,e){var i=this._findIndex(t,e);return i>-1?(t[i].playTime=performance.now(),!1):(t.push({audio:e,playTime:performance.now()}),!0)},e.addPlaying=function(t){if(t instanceof a2){if(this._tryAddPlaying(this._audioPlayerInfoList,t))return}else this._tryAddPlaying(this._oneShotAudioInfoList,t)},e._tryRemovePlaying=function(t,e){var i=this._findIndex(t,e);return-1!==i&&(gt(t,i),!0)},e.removePlaying=function(t){if(t instanceof a2){if(this._tryRemovePlaying(this._audioPlayerInfoList,t))return}else this._tryRemovePlaying(this._oneShotAudioInfoList,t)},e.discardOnePlayingIfNeeded=function(){var t;this._audioPlayerInfoList.length+this._oneShotAudioInfoList.length<a2.maxAudioChannel||(this._oneShotAudioInfoList.length>0?this._oneShotAudioInfoList.forEach((function(e){(!t||e.playTime<t.playTime)&&(t=e)})):this._audioPlayerInfoList.forEach((function(e){(!t||e.playTime<t.playTime)&&(t=e)})),t&&(t.audio.stop(),this.removePlaying(t.audio)))},t}()),x2="audiosource-loaded";!function(t){t.STARTED="started",t.ENDED="ended"}(I2||(I2={}));var P2=function(e){return t({AudioSource:e,AudioSourceComponent:e}),e}((l2=_h("cc.AudioSource"),c2=xh(),_2=Ch(),f2=Kh(o2),d2=Kh(o2),p2=Mh(),m2=Mh(),g2=Mh(),v2=Lh(),y2=Mh(),l2(E2=c2(E2=_2((w2=C2=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return E(e=t.call.apply(t,[this].concat(n))||this,"_clip",S2,g(e)),e._player=null,E(e,"_loop",A2,g(e)),E(e,"_playOnAwake",R2,g(e)),E(e,"_volume",b2,g(e)),e._cachedCurrentTime=0,e._operationsBeforeLoading=[],e._isLoaded=!1,e._lastSetClip=null,e}c(e,t);var i=e.prototype;return i._resetPlayer=function(){this._player&&(O2.removePlaying(this._player),this._player.offEnded(),this._player.offInterruptionBegin(),this._player.offInterruptionEnd(),this._player.destroy(),this._player=null)},i._syncPlayer=function(){var t=this,e=this._clip;if(this._isLoaded=!1,this._lastSetClip!==e)return e?void(e._nativeAsset?(this._lastSetClip=e,this._operationsBeforeLoading.length=0,a2.load(e._nativeAsset.url,{audioLoadMode:e.loadMode}).then((function(i){var n;t._lastSetClip===e?(t._isLoaded=!0,t._resetPlayer(),t._player=i,i.onEnded((function(){var e;O2.removePlaying(i),null===(e=t.node)||void 0===e||e.emit(I2.ENDED,t)})),i.onInterruptionBegin((function(){O2.removePlaying(i)})),i.onInterruptionEnd((function(){O2.addPlaying(i)})),t._syncStates(),null===(n=t.node)||void 0===n||n.emit(x2)):i.destroy()})).catch((function(){}))):console.error("Invalid audio clip")):(this._lastSetClip=null,void this._resetPlayer())},i.onLoad=function(){this._syncPlayer()},i.onEnable=function(){this._playOnAwake&&!this.playing&&this.play()},i.onDisable=function(){var t=this._getRootNode();(null==t?void 0:t._persistNode)||this.pause()},i.onDestroy=function(){var t;this.stop(),null===(t=this._player)||void 0===t||t.destroy(),this._player=null},i.getPCMData=function(t){var e=this;return new Promise((function(i){if(0!==t&&1!==t)return console.warn("Only support channel index 0 or 1 to get buffer"),void i(void 0);var n;e._player?i(e._player.getPCMData(t)):null===(n=e.node)||void 0===n||n.once(x2,(function(){var n;i(null===(n=e._player)||void 0===n?void 0:n.getPCMData(t))}))}))},i.getSampleRate=function(){var t=this;return new Promise((function(e){var i;t._player?e(t._player.sampleRate):null===(i=t.node)||void 0===i||i.once(x2,(function(){e(t._player.sampleRate)}))}))},i._getRootNode=function(){for(var t,e,i=this.node,n=null===(t=i)||void 0===t||null===(e=t.parent)||void 0===e?void 0:e.parent;n;){var r,s,a;n=null===(s=i=null===(r=i)||void 0===r?void 0:r.parent)||void 0===s||null===(a=s.parent)||void 0===a?void 0:a.parent}return i},i.play=function(){var t,e=this;if(this._isLoaded||!this.clip){var i;O2.discardOnePlayingIfNeeded(),this.state===M1.PLAYING&&(null===(i=this._player)||void 0===i||i.stop().catch((function(){})));var n=this._player;null===(t=this._player)||void 0===t||t.play().then((function(){var t;O2.addPlaying(n),null===(t=e.node)||void 0===t||t.emit(I2.STARTED,e)})).catch((function(){}))}else this._operationsBeforeLoading.push("play")},i.pause=function(){var t;if(this._isLoaded||!this.clip){var e=this._player;null===(t=this._player)||void 0===t||t.pause().then((function(){O2.removePlaying(e)})).catch((function(){}))}else this._operationsBeforeLoading.push("pause")},i.stop=function(){var t;if(this._isLoaded||!this.clip){var e=this._player;null===(t=this._player)||void 0===t||t.stop().then((function(){O2.removePlaying(e)})).catch((function(){}))}else this._operationsBeforeLoading.push("stop")},i.playOneShot=function(t,e){void 0===e&&(e=1),t._nativeAsset?a2.loadOneShotAudio(t._nativeAsset.url,this._volume*e,{audioLoadMode:t.loadMode}).then((function(t){O2.discardOnePlayingIfNeeded(),t.onPlay=function(){O2.addPlaying(t)},t.onEnd=function(){O2.removePlaying(t)},t.play()})).catch((function(){})):console.error("Invalid audio clip")},i._syncStates=function(){var t=this;this._player&&this._player.seek(this._cachedCurrentTime).then((function(){t._player&&(t._player.loop=t._loop,t._player.volume=t._volume,t._operationsBeforeLoading.forEach((function(e){var i;null===(i=t[e])||void 0===i||i.call(t)})),t._operationsBeforeLoading.length=0)})).catch((function(){}))},h(e,[{key:"clip",get:function(){return this._clip},set:function(t){t!==this._clip&&(this._clip=t,this._syncPlayer())}},{key:"loop",get:function(){return this._loop},set:function(t){this._loop=t,this._player&&(this._player.loop=t)}},{key:"playOnAwake",get:function(){return this._playOnAwake},set:function(t){this._playOnAwake=t}},{key:"volume",get:function(){return this._volume},set:function(t){Number.isNaN(t)?console.warn("illegal audio volume!"):(t=vi(t,0,1),this._player?(this._player.volume=t,this._volume=this._player.volume):this._volume=t)}},{key:"currentTime",get:function(){return this._player?this._player.currentTime:this._cachedCurrentTime},set:function(t){var e;Number.isNaN(t)?console.warn("illegal audio time!"):(t=vi(t,0,this.duration),this._cachedCurrentTime=t,null===(e=this._player)||void 0===e||e.seek(this._cachedCurrentTime).catch((function(){})))}},{key:"duration",get:function(){var t,e;return null!==(t=null===(e=this._clip)||void 0===e?void 0:e.getDuration())&&void 0!==t?t:this._player?this._player.duration:0}},{key:"state",get:function(){return this._player?this._player.state:M1.INIT}},{key:"playing",get:function(){return this.state===e.AudioState.PLAYING}}],[{key:"maxAudioChannel",get:function(){return a2.maxAudioChannel}}]),e}(bc),C2.AudioState=M1,C2.EventType=I2,S2=T((T2=w2).prototype,"_clip",[f2],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),A2=T(T2.prototype,"_loop",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),R2=T(T2.prototype,"_playOnAwake",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),b2=T(T2.prototype,"_volume",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 1}}),T(T2.prototype,"clip",[d2,p2],Object.getOwnPropertyDescriptor(T2.prototype,"clip"),T2.prototype),T(T2.prototype,"loop",[m2],Object.getOwnPropertyDescriptor(T2.prototype,"loop"),T2.prototype),T(T2.prototype,"playOnAwake",[g2],Object.getOwnPropertyDescriptor(T2.prototype,"playOnAwake"),T2.prototype),T(T2.prototype,"volume",[v2,y2],Object.getOwnPropertyDescriptor(T2.prototype,"volume"),T2.prototype),E2=T2))||E2)||E2)||E2));et(o2,"AudioClip",[{name:"PlayingState",newName:"AudioState",target:P2,targetName:"AudioSource"}]),nt(o2.prototype,"AudioClip.prototype",["state","play","pause","stop","playOneShot","setCurrentTime","setVolume","setLoop","getCurrentTime","getVolume","getLoop"].map((function(t){return{name:t,suggest:"please use AudioSource.prototype."+t+" instead"}}))),b.AudioSourceComponent=P2,le.setClassAlias(P2,"cc.AudioSourceComponent"),b.log=M,b.warn=L,b.error=F,b.assert=U,b._throw=z,b.logID=W,b.warnID=j,b.errorID=K,b.assertID=Z,b.debug=ot,b.path={join:Pl,extname:Dl,mainFileName:Bl,basename:Nl,dirname:Ml,changeExtname:Ll,changeBasename:Fl,_normalize:Ul,stripSep:Gl,get sep(){return kl()}};var D2,B2,N2=t("NodePool",function(){function t(t){this.poolHandlerComp=void 0,this._pool=void 0,this.poolHandlerComp=t,this._pool=[]}var e=t.prototype;return e.size=function(){return this._pool.length},e.clear=function(){for(var t=this._pool.length,e=0;e<t;++e)this._pool[e].destroy();this._pool.length=0},e.put=function(t){if(t&&-1===this._pool.indexOf(t)){t.removeFromParent();var e=this.poolHandlerComp?t.getComponent(this.poolHandlerComp):null;e&&e.unuse&&e.unuse(),this._pool.push(t)}},e.get=function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];var n=this._pool.length-1;if(n<0)return null;var r=this._pool[n];this._pool.length=n;var s=this.poolHandlerComp?r.getComponent(this.poolHandlerComp):null;return s&&s.reuse&&s.reuse(arguments),r},t}());b.NodePool=N2;var M2=null!==(D2=globalThis.jsb)&&void 0!==D2?D2:{};t("native",{DownloaderHints:M2.DownloaderHints,Downloader:M2.Downloader,zipUtils:M2.zipUtils,fileUtils:M2.fileUtils,DebugRenderer:M2.DebugRenderer,copyTextToClipboard:null===(B2=M2.copyTextToClipboard)||void 0===B2?void 0:B2.bind(M2),garbageCollect:M2.garbageCollect,reflection:M2.reflection,bridge:M2.bridge,jsbBridgeWrapper:M2.jsbBridgeWrapper,AssetsManager:M2.AssetsManager,EventAssetsManager:M2.EventAssetsManager,Manifest:M2.Manifest,saveImageData:M2.saveImageData}),b.renderer=OH;var L2,F2=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._gpuDescriptorSet=null,e}c(e,t);var i=e.prototype;return i.initialize=function(t){this._layout=t.layout;var e=t.layout.gpuDescriptorSetLayout,i=e.bindings,n=e.descriptorIndices,r=e.descriptorCount;this._buffers=Array(r).fill(null),this._textures=Array(r).fill(null),this._samplers=Array(r).fill(null);var s=[];this._gpuDescriptorSet={gpuDescriptors:s,descriptorIndices:n};for(var a=0;a<i.length;++a)for(var o=i[a],u=0;u<o.count;u++)s.push({type:o.descriptorType,gpuBuffer:null,gpuTexture:null,gpuSampler:null})},i.destroy=function(){this._layout=null,this._gpuDescriptorSet=null},i.update=function(){if(this._isDirty&&this._gpuDescriptorSet){for(var t=this._gpuDescriptorSet.gpuDescriptors,e=0;e<t.length;++e)if(t[e].type&Rs){var i=this._buffers[e];i&&(t[e].gpuBuffer=i.gpuBuffer||i.gpuBufferView)}else t[e].type&bs&&(this._textures[e]&&(t[e].gpuTexture=this._textures[e].gpuTexture),this._samplers[e]&&(t[e].gpuSampler=this._samplers[e].gpuSampler));this._isDirty=!1}},h(e,[{key:"gpuDescriptorSet",get:function(){return this._gpuDescriptorSet}}]),e}(Xs);!function(t){t[t.RGBA16F_EXT=34842]="RGBA16F_EXT",t[t.RGB16F_EXT=34843]="RGB16F_EXT",t[t.RGBA32F_EXT=34836]="RGBA32F_EXT",t[t.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT=33297]="FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT",t[t.UNSIGNED_NORMALIZED_EXT=35863]="UNSIGNED_NORMALIZED_EXT",t[t.UNSIGNED_INT_24_8_WEBGL=34042]="UNSIGNED_INT_24_8_WEBGL",t[t.HALF_FLOAT_OES=36193]="HALF_FLOAT_OES",t[t.SRGB_EXT=35904]="SRGB_EXT",t[t.SRGB_ALPHA_EXT=35906]="SRGB_ALPHA_EXT",t[t.SRGB8_ALPHA8_EXT=35907]="SRGB8_ALPHA8_EXT",t[t.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",t[t.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",t[t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",t[t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",t[t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",t[t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",t[t.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",t[t.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",t[t.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",t[t.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",t[t.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",t[t.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",t[t.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",t[t.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",t[t.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",t[t.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",t[t.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",t[t.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",t[t.COMPRESSED_RGBA_ASTC_5x4_KHR=37809]="COMPRESSED_RGBA_ASTC_5x4_KHR",t[t.COMPRESSED_RGBA_ASTC_5x5_KHR=37810]="COMPRESSED_RGBA_ASTC_5x5_KHR",t[t.COMPRESSED_RGBA_ASTC_6x5_KHR=37811]="COMPRESSED_RGBA_ASTC_6x5_KHR",t[t.COMPRESSED_RGBA_ASTC_6x6_KHR=37812]="COMPRESSED_RGBA_ASTC_6x6_KHR",t[t.COMPRESSED_RGBA_ASTC_8x5_KHR=37813]="COMPRESSED_RGBA_ASTC_8x5_KHR",t[t.COMPRESSED_RGBA_ASTC_8x6_KHR=37814]="COMPRESSED_RGBA_ASTC_8x6_KHR",t[t.COMPRESSED_RGBA_ASTC_8x8_KHR=37815]="COMPRESSED_RGBA_ASTC_8x8_KHR",t[t.COMPRESSED_RGBA_ASTC_10x5_KHR=37816]="COMPRESSED_RGBA_ASTC_10x5_KHR",t[t.COMPRESSED_RGBA_ASTC_10x6_KHR=37817]="COMPRESSED_RGBA_ASTC_10x6_KHR",t[t.COMPRESSED_RGBA_ASTC_10x8_KHR=37818]="COMPRESSED_RGBA_ASTC_10x8_KHR",t[t.COMPRESSED_RGBA_ASTC_10x10_KHR=37819]="COMPRESSED_RGBA_ASTC_10x10_KHR",t[t.COMPRESSED_RGBA_ASTC_12x10_KHR=37820]="COMPRESSED_RGBA_ASTC_12x10_KHR",t[t.COMPRESSED_RGBA_ASTC_12x12_KHR=37821]="COMPRESSED_RGBA_ASTC_12x12_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=37840]="COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR=37841]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR=37842]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR=37843]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR=37844]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR=37845]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR=37846]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR=37847]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR=37848]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR=37849]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR=37850]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR=37851]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR=37852]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR=37853]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR"}(L2||(L2={}));var U2=function(){function t(){}return t.setInstance=function(e){t._instance=e},h(t,null,[{key:"instance",get:function(){return t._instance}}]),t}();function G2(t,e){switch(t){case On.R8:return e.UNSIGNED_BYTE;case On.R8SN:return e.BYTE;case On.R8UI:return e.UNSIGNED_BYTE;case On.R8I:return e.BYTE;case On.R16F:return L2.HALF_FLOAT_OES;case On.R16UI:return e.UNSIGNED_SHORT;case On.R16I:return e.SHORT;case On.R32F:return e.FLOAT;case On.R32UI:return e.UNSIGNED_INT;case On.R32I:return e.INT;case On.RG8:return e.UNSIGNED_BYTE;case On.RG8SN:return e.BYTE;case On.RG8UI:return e.UNSIGNED_BYTE;case On.RG8I:return e.BYTE;case On.RG16F:return L2.HALF_FLOAT_OES;case On.RG16UI:return e.UNSIGNED_SHORT;case On.RG16I:return e.SHORT;case On.RG32F:return e.FLOAT;case On.RG32UI:return e.UNSIGNED_INT;case On.RG32I:return e.INT;case On.RGB8:case On.SRGB8:return e.UNSIGNED_BYTE;case On.RGB8SN:return e.BYTE;case On.RGB8UI:return e.UNSIGNED_BYTE;case On.RGB8I:return e.BYTE;case On.RGB16F:return L2.HALF_FLOAT_OES;case On.RGB16UI:return e.UNSIGNED_SHORT;case On.RGB16I:return e.SHORT;case On.RGB32F:return e.FLOAT;case On.RGB32UI:return e.UNSIGNED_INT;case On.RGB32I:return e.INT;case On.BGRA8:case On.RGBA8:case On.SRGB8_A8:return e.UNSIGNED_BYTE;case On.RGBA8SN:return e.BYTE;case On.RGBA8UI:return e.UNSIGNED_BYTE;case On.RGBA8I:return e.BYTE;case On.RGBA16F:return L2.HALF_FLOAT_OES;case On.RGBA16UI:return e.UNSIGNED_SHORT;case On.RGBA16I:return e.SHORT;case On.RGBA32F:return e.FLOAT;case On.RGBA32UI:return e.UNSIGNED_INT;case On.RGBA32I:return e.INT;case On.R5G6B5:return e.UNSIGNED_SHORT_5_6_5;case On.R11G11B10F:return e.FLOAT;case On.RGB5A1:return e.UNSIGNED_SHORT_5_5_5_1;case On.RGBA4:return e.UNSIGNED_SHORT_4_4_4_4;case On.RGB10A2:return e.UNSIGNED_BYTE;case On.RGB10A2UI:return e.UNSIGNED_INT;case On.RGB9E5:return e.UNSIGNED_BYTE;case On.DEPTH:return e.UNSIGNED_INT;case On.DEPTH_STENCIL:return L2.UNSIGNED_INT_24_8_WEBGL;case On.BC1:case On.BC1_SRGB:case On.BC2:case On.BC2_SRGB:case On.BC3:case On.BC3_SRGB:case On.BC4:return e.UNSIGNED_BYTE;case On.BC4_SNORM:return e.BYTE;case On.BC5:return e.UNSIGNED_BYTE;case On.BC5_SNORM:return e.BYTE;case On.BC6H_SF16:case On.BC6H_UF16:return e.FLOAT;case On.BC7:case On.BC7_SRGB:case On.ETC_RGB8:case On.ETC2_RGB8:case On.ETC2_SRGB8:case On.ETC2_RGB8_A1:case On.ETC2_SRGB8_A1:case On.EAC_R11:return e.UNSIGNED_BYTE;case On.EAC_R11SN:return e.BYTE;case On.EAC_RG11:return e.UNSIGNED_BYTE;case On.EAC_RG11SN:return e.BYTE;case On.PVRTC_RGB2:case On.PVRTC_RGBA2:case On.PVRTC_RGB4:case On.PVRTC_RGBA4:case On.PVRTC2_2BPP:case On.PVRTC2_4BPP:return e.UNSIGNED_BYTE;case On.ASTC_RGBA_4X4:case On.ASTC_RGBA_5X4:case On.ASTC_RGBA_5X5:case On.ASTC_RGBA_6X5:case On.ASTC_RGBA_6X6:case On.ASTC_RGBA_8X5:case On.ASTC_RGBA_8X6:case On.ASTC_RGBA_8X8:case On.ASTC_RGBA_10X5:case On.ASTC_RGBA_10X6:case On.ASTC_RGBA_10X8:case On.ASTC_RGBA_10X10:case On.ASTC_RGBA_12X10:case On.ASTC_RGBA_12X12:case On.ASTC_SRGBA_4X4:case On.ASTC_SRGBA_5X4:case On.ASTC_SRGBA_5X5:case On.ASTC_SRGBA_6X5:case On.ASTC_SRGBA_6X6:case On.ASTC_SRGBA_8X5:case On.ASTC_SRGBA_8X6:case On.ASTC_SRGBA_8X8:case On.ASTC_SRGBA_10X5:case On.ASTC_SRGBA_10X6:case On.ASTC_SRGBA_10X8:case On.ASTC_SRGBA_10X10:case On.ASTC_SRGBA_12X10:case On.ASTC_SRGBA_12X12:default:return e.UNSIGNED_BYTE}}function k2(t,e){switch(t){case Pn.BOOL:return e.BOOL;case Pn.BOOL2:return e.BOOL_VEC2;case Pn.BOOL3:return e.BOOL_VEC3;case Pn.BOOL4:return e.BOOL_VEC4;case Pn.INT:return e.INT;case Pn.INT2:return e.INT_VEC2;case Pn.INT3:return e.INT_VEC3;case Pn.INT4:return e.INT_VEC4;case Pn.UINT:return e.UNSIGNED_INT;case Pn.FLOAT:return e.FLOAT;case Pn.FLOAT2:return e.FLOAT_VEC2;case Pn.FLOAT3:return e.FLOAT_VEC3;case Pn.FLOAT4:return e.FLOAT_VEC4;case Pn.MAT2:return e.FLOAT_MAT2;case Pn.MAT3:return e.FLOAT_MAT3;case Pn.MAT4:return e.FLOAT_MAT4;case Pn.SAMPLER2D:return e.SAMPLER_2D;case Pn.SAMPLER_CUBE:return e.SAMPLER_CUBE;default:return console.error("Unsupported GLType, convert to GL type failed."),Pn.UNKNOWN}}function z2(t){switch(t){case Pn.BOOL:case Pn.BOOL2:case Pn.BOOL3:case Pn.BOOL4:case Pn.INT:case Pn.INT2:case Pn.INT3:case Pn.INT4:case Pn.UINT:return Int32Array;case Pn.FLOAT:case Pn.FLOAT2:case Pn.FLOAT3:case Pn.FLOAT4:case Pn.MAT2:case Pn.MAT3:case Pn.MAT4:return Float32Array;default:return console.error("Unsupported GLType, convert to TypedArrayConstructor failed."),Float32Array}}function H2(t,e){switch(t){case e.BOOL:return Pn.BOOL;case e.BOOL_VEC2:return Pn.BOOL2;case e.BOOL_VEC3:return Pn.BOOL3;case e.BOOL_VEC4:return Pn.BOOL4;case e.INT:return Pn.INT;case e.INT_VEC2:return Pn.INT2;case e.INT_VEC3:return Pn.INT3;case e.INT_VEC4:return Pn.INT4;case e.UNSIGNED_INT:return Pn.UINT;case e.FLOAT:return Pn.FLOAT;case e.FLOAT_VEC2:return Pn.FLOAT2;case e.FLOAT_VEC3:return Pn.FLOAT3;case e.FLOAT_VEC4:return Pn.FLOAT4;case e.FLOAT_MAT2:return Pn.MAT2;case e.FLOAT_MAT3:return Pn.MAT3;case e.FLOAT_MAT4:return Pn.MAT4;case e.SAMPLER_2D:return Pn.SAMPLER2D;case e.SAMPLER_CUBE:return Pn.SAMPLER_CUBE;default:return console.error("Unsupported GLType, convert to Type failed."),Pn.UNKNOWN}}function V2(t,e){switch(t){case e.BOOL:return 4;case e.BOOL_VEC2:return 8;case e.BOOL_VEC3:return 12;case e.BOOL_VEC4:return 16;case e.INT:return 4;case e.INT_VEC2:return 8;case e.INT_VEC3:return 12;case e.INT_VEC4:return 16;case e.UNSIGNED_INT:case e.FLOAT:return 4;case e.FLOAT_VEC2:return 8;case e.FLOAT_VEC3:return 12;case e.FLOAT_VEC4:case e.FLOAT_MAT2:return 16;case e.FLOAT_MAT3:return 36;case e.FLOAT_MAT4:return 64;case e.SAMPLER_2D:case e.SAMPLER_CUBE:return 4;default:return console.error("Unsupported GLType, get type failed."),0}}function W2(t,e){switch(t){case e.FLOAT_MAT2:return 2;case e.FLOAT_MAT3:return 3;case e.FLOAT_MAT4:return 4;default:return 1}}U2._instance=null;var X2,j2=[512,513,514,515,516,517,518,519],Y2=[0,7680,7681,7682,7683,5386,34055,34056],K2=[32774,32778,32779,32775,32776],q2=[0,1,770,772,771,773,768,774,769,775,776,32769,32770,32771,32772];!function(t){t[t.BEGIN_RENDER_PASS=0]="BEGIN_RENDER_PASS",t[t.END_RENDER_PASS=1]="END_RENDER_PASS",t[t.BIND_STATES=2]="BIND_STATES",t[t.DRAW=3]="DRAW",t[t.UPDATE_BUFFER=4]="UPDATE_BUFFER",t[t.COPY_BUFFER_TO_TEXTURE=5]="COPY_BUFFER_TO_TEXTURE",t[t.COUNT=6]="COUNT"}(X2||(X2={}));var Q2=function(t){this.cmdType=void 0,this.refCount=0,this.cmdType=t},Z2=function(t){function e(){var e;return(e=t.call(this,X2.BEGIN_RENDER_PASS)||this).gpuRenderPass=null,e.gpuFramebuffer=null,e.renderArea=new Sr,e.clearFlag=cr.NONE,e.clearColors=[],e.clearDepth=1,e.clearStencil=0,e}return c(e,t),e.prototype.clear=function(){this.gpuFramebuffer=null,this.clearColors.length=0},e}(Q2),J2=function(t){function e(){var e;return(e=t.call(this,X2.BIND_STATES)||this).gpuPipelineState=null,e.gpuInputAssembler=null,e.gpuDescriptorSets=[],e.dynamicOffsets=[],e.dynamicStates=new Ts,e}return c(e,t),e.prototype.clear=function(){this.gpuPipelineState=null,this.gpuDescriptorSets.length=0,this.gpuInputAssembler=null,this.dynamicOffsets.length=0},e}(Q2),$2=function(t){function e(){var e;return(e=t.call(this,X2.DRAW)||this).drawInfo=new Fr,e}return c(e,t),e.prototype.clear=function(){},e}(Q2),t3=function(t){function e(){var e;return(e=t.call(this,X2.UPDATE_BUFFER)||this).gpuBuffer=null,e.buffer=null,e.offset=0,e.size=0,e}return c(e,t),e.prototype.clear=function(){this.gpuBuffer=null,this.buffer=null},e}(Q2),e3=function(t){function e(){var e;return(e=t.call(this,X2.COPY_BUFFER_TO_TEXTURE)||this).gpuTexture=null,e.buffers=[],e.regions=[],e}return c(e,t),e.prototype.clear=function(){this.gpuTexture=null,this.buffers.length=0,this.regions.length=0},e}(Q2),i3=function(){function t(){this.cmds=new ma(1),this.beginRenderPassCmds=new ma(1),this.bindStatesCmds=new ma(1),this.drawCmds=new ma(1),this.updateBufferCmds=new ma(1),this.copyBufferToTextureCmds=new ma(1)}return t.prototype.clearCmds=function(t){this.beginRenderPassCmds.length&&(t.beginRenderPassCmdPool.freeCmds(this.beginRenderPassCmds),this.beginRenderPassCmds.clear()),this.bindStatesCmds.length&&(t.bindStatesCmdPool.freeCmds(this.bindStatesCmds),this.bindStatesCmds.clear()),this.drawCmds.length&&(t.drawCmdPool.freeCmds(this.drawCmds),this.drawCmds.clear()),this.updateBufferCmds.length&&(t.updateBufferCmdPool.freeCmds(this.updateBufferCmds),this.updateBufferCmds.clear()),this.copyBufferToTextureCmds.length&&(t.copyBufferToTextureCmdPool.freeCmds(this.copyBufferToTextureCmds),this.copyBufferToTextureCmds.clear()),this.cmds.clear()},t}();function n3(t,e,i,n,r){if(e.usage&Dn.UNIFORM)ArrayBuffer.isView(i)?e.vf32.set(i,n/Float32Array.BYTES_PER_ELEMENT):e.vf32.set(new Float32Array(i),n/Float32Array.BYTES_PER_ELEMENT);else if(e.usage&Dn.INDIRECT){e.indirects.clearDraws();for(var s=i.drawInfos,a=0;a<s.length;++a)e.indirects.setDrawInfo(n+a,s[a])}else{var o=i,u=t.gl,h=t.stateCache;switch(e.glTarget){case u.ARRAY_BUFFER:t.extensions.useVAO&&h.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),h.glVAO=null),r3.gpuInputAssembler=null,t.stateCache.glArrayBuffer!==e.glBuffer&&(u.bindBuffer(u.ARRAY_BUFFER,e.glBuffer),t.stateCache.glArrayBuffer=e.glBuffer);break;case u.ELEMENT_ARRAY_BUFFER:t.extensions.useVAO&&h.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),h.glVAO=null),r3.gpuInputAssembler=null,t.stateCache.glElementArrayBuffer!==e.glBuffer&&(u.bindBuffer(u.ELEMENT_ARRAY_BUFFER,e.glBuffer),t.stateCache.glElementArrayBuffer=e.glBuffer);break;default:return void console.error("Unsupported BufferType, update buffer failed.")}r===o.byteLength?u.bufferSubData(e.glTarget,n,o):u.bufferSubData(e.glTarget,n,o.slice(0,r))}}var r3={gpuPipelineState:null,gpuInputAssembler:null,glPrimitive:0},s3=new Sr;function a3(t,e,i,n,r,s,a){var o=t.gl,u=t.stateCache,h=0;if(i&&(s3.x=n.x<<i.lodLevel,s3.y=n.y<<i.lodLevel,s3.width=n.width<<i.lodLevel,s3.height=n.height<<i.lodLevel),i&&e){u.glFramebuffer!==i.glFramebuffer&&(o.bindFramebuffer(o.FRAMEBUFFER,i.glFramebuffer),u.glFramebuffer=i.glFramebuffer),u.viewport.left===s3.x&&u.viewport.top===s3.y&&u.viewport.width===s3.width&&u.viewport.height===s3.height||(o.viewport(s3.x,s3.y,s3.width,s3.height),u.viewport.left=s3.x,u.viewport.top=s3.y,u.viewport.width=s3.width,u.viewport.height=s3.height),u.scissorRect.x===s3.x&&u.scissorRect.y===s3.y&&u.scissorRect.width===s3.width&&u.scissorRect.height===s3.height||(o.scissor(s3.x,s3.y,s3.width,s3.height),u.scissorRect.x=s3.x,u.scissorRect.y=s3.y,u.scissorRect.width=s3.width,u.scissorRect.height=s3.height);var l=r.length;t.extensions.WEBGL_draw_buffers||(l=1);for(var c=0;c<l;++c){var _=e.colorAttachments[c];if(_.format!==On.UNKNOWN)switch(_.loadOp){case Qn.LOAD:break;case Qn.CLEAR:u.bs.targets[0].blendColorMask!==Kn.ALL&&o.colorMask(!0,!0,!0,!0);var f=r[0];o.clearColor(f.x,f.y,f.z,f.w),h|=o.COLOR_BUFFER_BIT;break;case Qn.DISCARD:}}if(e.depthStencilAttachment&&e.depthStencilAttachment.format!==On.UNKNOWN){switch(e.depthStencilAttachment.depthLoadOp){case Qn.LOAD:break;case Qn.CLEAR:u.dss.depthWrite||o.depthMask(!0),o.clearDepth(s),h|=o.DEPTH_BUFFER_BIT;break;case Qn.DISCARD:}if(As[e.depthStencilAttachment.format].hasStencil)switch(e.depthStencilAttachment.stencilLoadOp){case Qn.LOAD:break;case Qn.CLEAR:u.dss.stencilWriteMaskFront||o.stencilMaskSeparate(o.FRONT,65535),u.dss.stencilWriteMaskBack||o.stencilMaskSeparate(o.BACK,65535),o.clearStencil(a),h|=o.STENCIL_BUFFER_BIT;break;case Qn.DISCARD:}}if(h&&o.clear(h),h&o.COLOR_BUFFER_BIT){var d=u.bs.targets[0].blendColorMask;if(d!==Kn.ALL){var p=(d&Kn.R)!==Kn.NONE,m=(d&Kn.G)!==Kn.NONE,g=(d&Kn.B)!==Kn.NONE,v=(d&Kn.A)!==Kn.NONE;o.colorMask(p,m,g,v)}}h&o.DEPTH_BUFFER_BIT&&!u.dss.depthWrite&&o.depthMask(!1),h&o.STENCIL_BUFFER_BIT&&(u.dss.stencilWriteMaskFront||o.stencilMaskSeparate(o.FRONT,0),u.dss.stencilWriteMaskBack||o.stencilMaskSeparate(o.BACK,0))}}function o3(t,e,i,n,r,s){var a,o,u,h=t.gl,l=t.stateCache,c=e&&e.gpuShader,_=!1;if(e&&r3.gpuPipelineState!==e){if(r3.gpuPipelineState=e,r3.glPrimitive=e.glPrimitive,e.gpuShader){var f=e.gpuShader.glProgram;l.glProgram!==f&&(h.useProgram(f),l.glProgram=f,_=!0)}var d=e.rs;if(d){if(l.rs.cullMode!==d.cullMode){switch(d.cullMode){case rr.NONE:h.disable(h.CULL_FACE);break;case rr.FRONT:h.enable(h.CULL_FACE),h.cullFace(h.FRONT);break;case rr.BACK:h.enable(h.CULL_FACE),h.cullFace(h.BACK)}l.rs.cullMode=d.cullMode}var p=d.isFrontFaceCCW;l.rs.isFrontFaceCCW!==p&&(h.frontFace(p?h.CCW:h.CW),l.rs.isFrontFaceCCW=p),l.rs.depthBias===d.depthBias&&l.rs.depthBiasSlop===d.depthBiasSlop||(h.polygonOffset(d.depthBias,d.depthBiasSlop),l.rs.depthBias=d.depthBias,l.rs.depthBiasSlop=d.depthBiasSlop),l.rs.lineWidth!==d.lineWidth&&(h.lineWidth(d.lineWidth),l.rs.lineWidth=d.lineWidth)}var m=e.dss;m&&(l.dss.depthTest!==m.depthTest&&(m.depthTest?h.enable(h.DEPTH_TEST):h.disable(h.DEPTH_TEST),l.dss.depthTest=m.depthTest),l.dss.depthWrite!==m.depthWrite&&(h.depthMask(m.depthWrite),l.dss.depthWrite=m.depthWrite),l.dss.depthFunc!==m.depthFunc&&(h.depthFunc(j2[m.depthFunc]),l.dss.depthFunc=m.depthFunc),l.dss.stencilTestFront===m.stencilTestFront&&l.dss.stencilTestBack===m.stencilTestBack||(m.stencilTestFront||m.stencilTestBack?h.enable(h.STENCIL_TEST):h.disable(h.STENCIL_TEST),l.dss.stencilTestFront=m.stencilTestFront,l.dss.stencilTestBack=m.stencilTestBack),l.dss.stencilFuncFront===m.stencilFuncFront&&l.dss.stencilRefFront===m.stencilRefFront&&l.dss.stencilReadMaskFront===m.stencilReadMaskFront||(h.stencilFuncSeparate(h.FRONT,j2[m.stencilFuncFront],m.stencilRefFront,m.stencilReadMaskFront),l.dss.stencilFuncFront=m.stencilFuncFront,l.dss.stencilRefFront=m.stencilRefFront,l.dss.stencilReadMaskFront=m.stencilReadMaskFront),l.dss.stencilFailOpFront===m.stencilFailOpFront&&l.dss.stencilZFailOpFront===m.stencilZFailOpFront&&l.dss.stencilPassOpFront===m.stencilPassOpFront||(h.stencilOpSeparate(h.FRONT,Y2[m.stencilFailOpFront],Y2[m.stencilZFailOpFront],Y2[m.stencilPassOpFront]),l.dss.stencilFailOpFront=m.stencilFailOpFront,l.dss.stencilZFailOpFront=m.stencilZFailOpFront,l.dss.stencilPassOpFront=m.stencilPassOpFront),l.dss.stencilWriteMaskFront!==m.stencilWriteMaskFront&&(h.stencilMaskSeparate(h.FRONT,m.stencilWriteMaskFront),l.dss.stencilWriteMaskFront=m.stencilWriteMaskFront),l.dss.stencilFuncBack===m.stencilFuncBack&&l.dss.stencilRefBack===m.stencilRefBack&&l.dss.stencilReadMaskBack===m.stencilReadMaskBack||(h.stencilFuncSeparate(h.BACK,j2[m.stencilFuncBack],m.stencilRefBack,m.stencilReadMaskBack),l.dss.stencilFuncBack=m.stencilFuncBack,l.dss.stencilRefBack=m.stencilRefBack,l.dss.stencilReadMaskBack=m.stencilReadMaskBack),l.dss.stencilFailOpBack===m.stencilFailOpBack&&l.dss.stencilZFailOpBack===m.stencilZFailOpBack&&l.dss.stencilPassOpBack===m.stencilPassOpBack||(h.stencilOpSeparate(h.BACK,Y2[m.stencilFailOpBack],Y2[m.stencilZFailOpBack],Y2[m.stencilPassOpBack]),l.dss.stencilFailOpBack=m.stencilFailOpBack,l.dss.stencilZFailOpBack=m.stencilZFailOpBack,l.dss.stencilPassOpBack=m.stencilPassOpBack),l.dss.stencilWriteMaskBack!==m.stencilWriteMaskBack&&(h.stencilMaskSeparate(h.BACK,m.stencilWriteMaskBack),l.dss.stencilWriteMaskBack=m.stencilWriteMaskBack));var g=e.bs;if(g){l.bs.isA2C!==g.isA2C&&(g.isA2C?h.enable(h.SAMPLE_ALPHA_TO_COVERAGE):h.disable(h.SAMPLE_ALPHA_TO_COVERAGE),l.bs.isA2C=g.isA2C),l.bs.blendColor.x===g.blendColor.x&&l.bs.blendColor.y===g.blendColor.y&&l.bs.blendColor.z===g.blendColor.z&&l.bs.blendColor.w===g.blendColor.w||(h.blendColor(g.blendColor.x,g.blendColor.y,g.blendColor.z,g.blendColor.w),l.bs.blendColor.x=g.blendColor.x,l.bs.blendColor.y=g.blendColor.y,l.bs.blendColor.z=g.blendColor.z,l.bs.blendColor.w=g.blendColor.w);var v=g.targets[0],y=l.bs.targets[0];y.blend!==v.blend&&(v.blend?h.enable(h.BLEND):h.disable(h.BLEND),y.blend=v.blend),y.blendEq===v.blendEq&&y.blendAlphaEq===v.blendAlphaEq||(h.blendEquationSeparate(K2[v.blendEq],K2[v.blendAlphaEq]),y.blendEq=v.blendEq,y.blendAlphaEq=v.blendAlphaEq),y.blendSrc===v.blendSrc&&y.blendDst===v.blendDst&&y.blendSrcAlpha===v.blendSrcAlpha&&y.blendDstAlpha===v.blendDstAlpha||(h.blendFuncSeparate(q2[v.blendSrc],q2[v.blendDst],q2[v.blendSrcAlpha],q2[v.blendDstAlpha]),y.blendSrc=v.blendSrc,y.blendDst=v.blendDst,y.blendSrcAlpha=v.blendSrcAlpha,y.blendDstAlpha=v.blendDstAlpha),y.blendColorMask!==v.blendColorMask&&(h.colorMask((v.blendColorMask&Kn.R)!==Kn.NONE,(v.blendColorMask&Kn.G)!==Kn.NONE,(v.blendColorMask&Kn.B)!==Kn.NONE,(v.blendColorMask&Kn.A)!==Kn.NONE),y.blendColorMask=v.blendColorMask)}}if(e&&e.gpuPipelineLayout&&c){for(var E=c.glBlocks.length,T=e.gpuPipelineLayout.dynamicOffsetIndices,S=0;S<E;S++){var A=c.glBlocks[S],R=n[A.set],b=R&&R.descriptorIndices[A.binding],C=b>=0&&R.gpuDescriptors[b],w=null,I=0;if(C&&C.gpuBuffer){var O=C.gpuBuffer,x=T[A.set],P=x&&x[A.binding];P>=0&&(I=r[P]),"vf32"in O?w=O.vf32:(I+=O.offset,w=O.gpuBuffer.vf32),I>>=2}if(w)for(var D=A.glActiveUniforms.length,B=0;B<D;B++){var N=A.glActiveUniforms[B];switch(N.glType){case h.BOOL:case h.INT:for(var M=0;M<N.array.length;++M){var L=N.offset+I+M;if(w[L]!==N.array[M]){for(var U=M,G=L;U<N.array.length;++U,++G)N.array[U]=w[G];h.uniform1iv(N.glLoc,N.array);break}}break;case h.BOOL_VEC2:case h.INT_VEC2:for(var k=0;k<N.array.length;++k){var z=N.offset+I+k;if(w[z]!==N.array[k]){for(var H=k,V=z;H<N.array.length;++H,++V)N.array[H]=w[V];h.uniform2iv(N.glLoc,N.array);break}}break;case h.BOOL_VEC3:case h.INT_VEC3:for(var W=0;W<N.array.length;++W){var X=N.offset+I+W;if(w[X]!==N.array[W]){for(var j=W,Y=X;j<N.array.length;++j,++Y)N.array[j]=w[Y];h.uniform3iv(N.glLoc,N.array);break}}break;case h.BOOL_VEC4:case h.INT_VEC4:for(var K=0;K<N.array.length;++K){var q=N.offset+I+K;if(w[q]!==N.array[K]){for(var Q=K,Z=q;Q<N.array.length;++Q,++Z)N.array[Q]=w[Z];h.uniform4iv(N.glLoc,N.array);break}}break;case h.FLOAT:for(var J=0;J<N.array.length;++J){var $=N.offset+I+J;if(w[$]!==N.array[J]){for(var tt=J,et=$;tt<N.array.length;++tt,++et)N.array[tt]=w[et];h.uniform1fv(N.glLoc,N.array);break}}break;case h.FLOAT_VEC2:for(var it=0;it<N.array.length;++it){var nt=N.offset+I+it;if(w[nt]!==N.array[it]){for(var rt=it,st=nt;rt<N.array.length;++rt,++st)N.array[rt]=w[st];h.uniform2fv(N.glLoc,N.array);break}}break;case h.FLOAT_VEC3:for(var at=0;at<N.array.length;++at){var ot=N.offset+I+at;if(w[ot]!==N.array[at]){for(var ut=at,ht=ot;ut<N.array.length;++ut,++ht)N.array[ut]=w[ht];h.uniform3fv(N.glLoc,N.array);break}}break;case h.FLOAT_VEC4:for(var lt=0;lt<N.array.length;++lt){var ct=N.offset+I+lt;if(w[ct]!==N.array[lt]){for(var _t=lt,ft=ct;_t<N.array.length;++_t,++ft)N.array[_t]=w[ft];h.uniform4fv(N.glLoc,N.array);break}}break;case h.FLOAT_MAT2:for(var dt=0;dt<N.array.length;++dt){var pt=N.offset+I+dt;if(w[pt]!==N.array[dt]){for(var mt=dt,gt=pt;mt<N.array.length;++mt,++gt)N.array[mt]=w[gt];h.uniformMatrix2fv(N.glLoc,!1,N.array);break}}break;case h.FLOAT_MAT3:for(var vt=0;vt<N.array.length;++vt){var yt=N.offset+I+vt;if(w[yt]!==N.array[vt]){for(var Et=vt,Tt=yt;Et<N.array.length;++Et,++Tt)N.array[Et]=w[Tt];h.uniformMatrix3fv(N.glLoc,!1,N.array);break}}break;case h.FLOAT_MAT4:for(var St=0;St<N.array.length;++St){var At=N.offset+I+St;if(w[At]!==N.array[St]){for(var Rt=St,bt=At;Rt<N.array.length;++Rt,++bt)N.array[Rt]=w[bt];h.uniformMatrix4fv(N.glLoc,!1,N.array);break}}}}else F("Buffer binding '"+A.name+"' at set "+A.set+" binding "+A.binding+" is not bounded")}for(var Ct=c.glSamplerTextures.length,wt=0;wt<Ct;wt++)for(var It=c.glSamplerTextures[wt],Ot=n[It.set],xt=Ot&&Ot.descriptorIndices[It.binding],Pt=xt>=0&&Ot.gpuDescriptors[xt],Dt=It.units.length,Bt=0;Bt<Dt;Bt++){var Nt=It.units[Bt];if(Pt&&Pt.gpuSampler){if(Pt.gpuTexture&&Pt.gpuTexture.size>0){var Mt=Pt.gpuTexture,Lt=l.glTexUnits[Nt];Lt.glTexture!==Mt.glTexture&&(l.texUnit!==Nt&&(h.activeTexture(h.TEXTURE0+Nt),l.texUnit=Nt),Mt.glTexture?h.bindTexture(Mt.glTarget,Mt.glTexture):h.bindTexture(Mt.glTarget,t.nullTex2D.gpuTexture.glTexture),Lt.glTexture=Mt.glTexture);var Ft=Pt.gpuSampler;Mt.isPowerOf2?(a=Ft.glWrapS,o=Ft.glWrapT):(a=h.CLAMP_TO_EDGE,o=h.CLAMP_TO_EDGE),u=Mt.isPowerOf2?Mt.mipLevel<=1&&(Ft.glMinFilter===h.LINEAR_MIPMAP_NEAREST||Ft.glMinFilter===h.LINEAR_MIPMAP_LINEAR)?h.LINEAR:Ft.glMinFilter:Ft.glMinFilter===h.LINEAR||Ft.glMinFilter===h.LINEAR_MIPMAP_NEAREST||Ft.glMinFilter===h.LINEAR_MIPMAP_LINEAR?h.LINEAR:h.NEAREST,Mt.glWrapS!==a&&(l.texUnit!==Nt&&(h.activeTexture(h.TEXTURE0+Nt),l.texUnit=Nt),h.texParameteri(Mt.glTarget,h.TEXTURE_WRAP_S,a),Mt.glWrapS=a),Mt.glWrapT!==o&&(l.texUnit!==Nt&&(h.activeTexture(h.TEXTURE0+Nt),l.texUnit=Nt),h.texParameteri(Mt.glTarget,h.TEXTURE_WRAP_T,o),Mt.glWrapT=o),Mt.glMinFilter!==u&&(l.texUnit!==Nt&&(h.activeTexture(h.TEXTURE0+Nt),l.texUnit=Nt),h.texParameteri(Mt.glTarget,h.TEXTURE_MIN_FILTER,u),Mt.glMinFilter=u),Mt.glMagFilter!==Ft.glMagFilter&&(l.texUnit!==Nt&&(h.activeTexture(h.TEXTURE0+Nt),l.texUnit=Nt),h.texParameteri(Mt.glTarget,h.TEXTURE_MAG_FILTER,Ft.glMagFilter),Mt.glMagFilter=Ft.glMagFilter)}Pt=Ot.gpuDescriptors[++xt]}else F("Sampler binding '"+It.name+"' at set "+It.set+" binding "+It.binding+" index "+Bt+" is not bounded")}}if(i&&c&&(_||r3.gpuInputAssembler!==i)){r3.gpuInputAssembler=i;var Ut=t.extensions.ANGLE_instanced_arrays;if(t.extensions.useVAO){var Gt=t.extensions.OES_vertex_array_object,kt=i.glVAOs.get(c.glProgram);if(!kt){var zt;kt=Gt.createVertexArrayOES(),i.glVAOs.set(c.glProgram,kt),Gt.bindVertexArrayOES(kt),h.bindBuffer(h.ARRAY_BUFFER,null),h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,null),l.glArrayBuffer=null,l.glElementArrayBuffer=null;for(var Ht=c.glInputs.length,Vt=0;Vt<Ht;Vt++){var Wt=c.glInputs[Vt];zt=null;for(var Xt=i.glAttribs.length,jt=0;jt<Xt;jt++){var Yt=i.glAttribs[jt];if(Yt.name===Wt.name){zt=Yt;break}}if(zt){l.glArrayBuffer!==zt.glBuffer&&(h.bindBuffer(h.ARRAY_BUFFER,zt.glBuffer),l.glArrayBuffer=zt.glBuffer);for(var Kt=0;Kt<zt.componentCount;++Kt){var qt=Wt.glLoc+Kt,Qt=zt.offset+zt.size*Kt;h.enableVertexAttribArray(qt),l.glCurrentAttribLocs[qt]=!0,h.vertexAttribPointer(qt,zt.count,zt.glType,zt.isNormalized,zt.stride,Qt),Ut&&Ut.vertexAttribDivisorANGLE(qt,zt.isInstanced?1:0)}}}var Zt=i.gpuIndexBuffer;Zt&&h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,Zt.glBuffer),Gt.bindVertexArrayOES(null),h.bindBuffer(h.ARRAY_BUFFER,null),h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,null),l.glArrayBuffer=null,l.glElementArrayBuffer=null}l.glVAO!==kt&&(Gt.bindVertexArrayOES(kt),l.glVAO=kt)}else{for(var Jt=0;Jt<t.capabilities.maxVertexAttributes;++Jt)l.glCurrentAttribLocs[Jt]=!1;for(var $t=c.glInputs.length,te=0;te<$t;te++){for(var ee=c.glInputs[te],ie=null,ne=i.glAttribs.length,re=0;re<ne;re++){var se=i.glAttribs[re];if(se.name===ee.name){ie=se;break}}if(ie){l.glArrayBuffer!==ie.glBuffer&&(h.bindBuffer(h.ARRAY_BUFFER,ie.glBuffer),l.glArrayBuffer=ie.glBuffer);for(var ae=0;ae<ie.componentCount;++ae){var oe=ee.glLoc+ae,ue=ie.offset+ie.size*ae;!l.glEnabledAttribLocs[oe]&&oe>=0&&(h.enableVertexAttribArray(oe),l.glEnabledAttribLocs[oe]=!0),l.glCurrentAttribLocs[oe]=!0,h.vertexAttribPointer(oe,ie.count,ie.glType,ie.isNormalized,ie.stride,ue),Ut&&Ut.vertexAttribDivisorANGLE(oe,ie.isInstanced?1:0)}}}var he=i.gpuIndexBuffer;he&&l.glElementArrayBuffer!==he.glBuffer&&(h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,he.glBuffer),l.glElementArrayBuffer=he.glBuffer);for(var le=0;le<t.capabilities.maxVertexAttributes;++le)l.glEnabledAttribLocs[le]!==l.glCurrentAttribLocs[le]&&(h.disableVertexAttribArray(le),l.glEnabledAttribLocs[le]=!1)}}if(e&&e.dynamicStates.length)for(var ce=e.dynamicStates.length,_e=0;_e<ce;_e++)switch(e.dynamicStates[_e]){case sr.LINE_WIDTH:l.rs.lineWidth!==s.lineWidth&&(h.lineWidth(s.lineWidth),l.rs.lineWidth=s.lineWidth);break;case sr.DEPTH_BIAS:l.rs.depthBias===s.depthBiasConstant&&l.rs.depthBiasSlop===s.depthBiasSlope||(h.polygonOffset(s.depthBiasConstant,s.depthBiasSlope),l.rs.depthBias=s.depthBiasConstant,l.rs.depthBiasSlop=s.depthBiasSlope);break;case sr.BLEND_CONSTANTS:var fe=s.blendConstant;l.bs.blendColor.x===fe.x&&l.bs.blendColor.y===fe.y&&l.bs.blendColor.z===fe.z&&l.bs.blendColor.w===fe.w||(h.blendColor(fe.x,fe.y,fe.z,fe.w),l.bs.blendColor.copy(fe));break;case sr.STENCIL_WRITE_MASK:var de=s.stencilStatesFront,pe=s.stencilStatesBack;l.dss.stencilWriteMaskFront!==de.writeMask&&(h.stencilMaskSeparate(h.FRONT,de.writeMask),l.dss.stencilWriteMaskFront=de.writeMask),l.dss.stencilWriteMaskBack!==pe.writeMask&&(h.stencilMaskSeparate(h.BACK,pe.writeMask),l.dss.stencilWriteMaskBack=pe.writeMask);break;case sr.STENCIL_COMPARE_MASK:var me=s.stencilStatesFront,ge=s.stencilStatesBack;l.dss.stencilRefFront===me.reference&&l.dss.stencilReadMaskFront===me.compareMask||(h.stencilFuncSeparate(h.FRONT,j2[l.dss.stencilFuncFront],me.reference,me.compareMask),l.dss.stencilRefFront=me.reference,l.dss.stencilReadMaskFront=me.compareMask),l.dss.stencilRefBack===ge.reference&&l.dss.stencilReadMaskBack===ge.compareMask||(h.stencilFuncSeparate(h.BACK,j2[l.dss.stencilFuncBack],ge.reference,ge.compareMask),l.dss.stencilRefBack=ge.reference,l.dss.stencilReadMaskBack=ge.compareMask)}}function u3(t,e){var i=t.gl,n=t.extensions,r=n.ANGLE_instanced_arrays,s=n.WEBGL_multi_draw,a=r3.gpuInputAssembler,o=r3.glPrimitive;if(a){var u=a.gpuIndexBuffer;if(a.gpuIndirectBuffer){var h=a.gpuIndirectBuffer.indirects;if(h.drawByIndex){for(var l=0;l<h.drawCount;l++)h.byteOffsets[l]=h.offsets[l]*u.stride;if(s)h.instancedDraw?s.multiDrawElementsInstancedWEBGL(o,h.counts,0,a.glIndexType,h.byteOffsets,0,h.instances,0,h.drawCount):s.multiDrawElementsWEBGL(o,h.counts,0,a.glIndexType,h.byteOffsets,0,h.drawCount);else for(var c=0;c<h.drawCount;c++)h.instances[c]&&r?r.drawElementsInstancedANGLE(o,h.counts[c],a.glIndexType,h.byteOffsets[c],h.instances[c]):i.drawElements(o,h.counts[c],a.glIndexType,h.byteOffsets[c])}else if(s)h.instancedDraw?s.multiDrawArraysInstancedWEBGL(o,h.offsets,0,h.counts,0,h.instances,0,h.drawCount):s.multiDrawArraysWEBGL(o,h.offsets,0,h.counts,0,h.drawCount);else for(var _=0;_<h.drawCount;_++)h.instances[_]&&r?r.drawArraysInstancedANGLE(o,h.offsets[_],h.counts[_],h.instances[_]):i.drawArrays(o,h.offsets[_],h.counts[_])}else if(e.instanceCount&&r)if(u){if(e.indexCount>0){var f=e.firstIndex*u.stride;r.drawElementsInstancedANGLE(o,e.indexCount,a.glIndexType,f,e.instanceCount)}}else e.vertexCount>0&&r.drawArraysInstancedANGLE(o,e.firstVertex,e.vertexCount,e.instanceCount);else if(u){if(e.indexCount>0){var d=e.firstIndex*u.stride;i.drawElements(o,e.indexCount,a.glIndexType,d)}}else e.vertexCount>0&&i.drawArrays(o,e.firstVertex,e.vertexCount)}}var h3=new Array(X2.COUNT);function l3(t,e){h3.fill(0);for(var i=0;i<e.cmds.length;++i){var n=e.cmds.array[i],r=h3[n]++;switch(n){case X2.BEGIN_RENDER_PASS:var s=e.beginRenderPassCmds.array[r];a3(t,s.gpuRenderPass,s.gpuFramebuffer,s.renderArea,s.clearColors,s.clearDepth,s.clearStencil);break;case X2.BIND_STATES:var a=e.bindStatesCmds.array[r];o3(t,a.gpuPipelineState,a.gpuInputAssembler,a.gpuDescriptorSets,a.dynamicOffsets,a.dynamicStates);break;case X2.DRAW:u3(t,e.drawCmds.array[r].drawInfo);break;case X2.UPDATE_BUFFER:var o=e.updateBufferCmds.array[r];n3(t,o.gpuBuffer,o.buffer,o.offset,o.size);break;case X2.COPY_BUFFER_TO_TEXTURE:var u=e.copyBufferToTextureCmds.array[r];f3(t,u.buffers,u.gpuTexture,u.regions)}}}var c3=new Uint8Array(1);function _3(t,e,i,n,r){var s=Bs(e).height,a=Is(e,r.width,r.height,r.depth),o=Is(e,n.width,1,1),u=Is(e,n.width,n.height,1),h=Is(e,r.width,1,1),l=Ds(As[e]);c3.byteLength<a&&(c3=new Uint8Array(a));for(var c=0,_=i,f=0;f<r.depth;f++){_=i+u*f;for(var d=0;d<r.height;d+=s)c3.subarray(c,c+h).set(new Uint8Array(t.buffer,t.byteOffset+_,h)),c+=h,_+=o}return new l(c3.buffer)}function f3(t,e,i,n){var r=t.gl,s=t.stateCache.glTexUnits[t.stateCache.texUnit];s.glTexture!==i.glTexture&&(r.bindTexture(i.glTarget,i.glTexture),s.glTexture=i.glTexture);var a=0,o=0,u=As[i.format],h=Ds(u),l=u.isCompressed,c=Bs(i.format),_=new Ar,f=new Tr,d=new Ar;switch(i.glTarget){case r.TEXTURE_2D:for(var p=0;p<n.length;p++){var m=n[p],g=m.texSubres.mipLevel;f.x=0===m.texOffset.x?0:Ns(m.texOffset.x,c.width),f.y=0===m.texOffset.y?0:Ns(m.texOffset.y,c.height),_.width=m.texExtent.width<c.width?m.texExtent.width:Ns(m.texExtent.width,c.width),_.height=m.texExtent.height<c.height?m.texExtent.width:Ns(m.texExtent.height,c.height),d.width=m.buffStride>0?m.buffStride:_.width,d.height=m.buffTexHeight>0?m.buffTexHeight:_.height;var v,y=m.texExtent.width+f.x===i.width>>g?m.texExtent.width:_.width,E=m.texExtent.height+f.y===i.height>>g?m.texExtent.height:_.height,T=e[a++];v=d.width===_.width&&d.height===_.height?new h(T.buffer,T.byteOffset+m.buffOffset):_3(T,i.format,m.buffOffset,d,_),l?i.glInternalFmt===L2.COMPRESSED_RGB_ETC1_WEBGL||t.extensions.noCompressedTexSubImage2D?r.compressedTexImage2D(r.TEXTURE_2D,g,i.glInternalFmt,y,E,0,v):r.compressedTexSubImage2D(r.TEXTURE_2D,g,f.x,f.y,y,E,i.glFormat,v):r.texSubImage2D(r.TEXTURE_2D,g,f.x,f.y,y,E,i.glFormat,i.glType,v)}break;case r.TEXTURE_CUBE_MAP:for(var S=0;S<n.length;S++){var A=n[S],R=A.texSubres.mipLevel;f.x=0===A.texOffset.x?0:Ns(A.texOffset.x,c.width),f.y=0===A.texOffset.y?0:Ns(A.texOffset.y,c.height),_.width=A.texExtent.width<c.width?A.texExtent.width:Ns(A.texExtent.width,c.width),_.height=A.texExtent.height<c.height?A.texExtent.width:Ns(A.texExtent.height,c.height),d.width=A.buffStride>0?A.buffStride:_.width,d.height=A.buffTexHeight>0?A.buffTexHeight:_.height;var b=A.texExtent.width+f.x===i.width>>R?A.texExtent.width:_.width,C=A.texExtent.height+f.y===i.height>>R?A.texExtent.height:_.height,w=A.texSubres.baseArrayLayer+A.texSubres.layerCount;for(o=A.texSubres.baseArrayLayer;o<w;++o){var I,O=e[a++];I=d.width===_.width&&d.height===_.height?new h(O.buffer,O.byteOffset+A.buffOffset):_3(O,i.format,A.buffOffset,d,_),l?i.glInternalFmt===L2.COMPRESSED_RGB_ETC1_WEBGL||t.extensions.noCompressedTexSubImage2D?r.compressedTexImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+o,R,i.glInternalFmt,b,C,0,I):r.compressedTexSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+o,R,f.x,f.y,b,C,i.glFormat,I):r.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+o,R,f.x,f.y,b,C,i.glFormat,i.glType,I)}}break;default:console.error("Unsupported GL texture type, copy buffer to texture failed.")}i.flags&Un.GEN_MIPMAP&&r.generateMipmap(i.glTarget)}var d3=function(){function t(){this.counts=void 0,this.offsets=void 0,this.instances=void 0,this.drawCount=0,this.drawByIndex=!1,this.instancedDraw=!1,this.byteOffsets=void 0,this._capacity=4,this.counts=new Int32Array(this._capacity),this.offsets=new Int32Array(this._capacity),this.instances=new Int32Array(this._capacity),this.byteOffsets=new Int32Array(this._capacity)}var e=t.prototype;return e.clearDraws=function(){this.drawCount=0,this.drawByIndex=!1,this.instancedDraw=!1},e.setDrawInfo=function(t,e){this._ensureCapacity(t),this.drawByIndex=e.indexCount>0,this.instancedDraw=!!e.instanceCount,this.drawCount=Math.max(t+1,this.drawCount),this.drawByIndex?(this.counts[t]=e.indexCount,this.offsets[t]=e.firstIndex):(this.counts[t]=e.vertexCount,this.offsets[t]=e.firstVertex),this.instances[t]=Math.max(1,e.instanceCount)},e._ensureCapacity=function(t){if(!(this._capacity>t)){this._capacity=s(t);var e=new Int32Array(this._capacity),i=new Int32Array(this._capacity),n=new Int32Array(this._capacity);this.byteOffsets=new Int32Array(this._capacity),e.set(this.counts),i.set(this.offsets),n.set(this.instances),this.counts=e,this.offsets=i,this.instances=n}},t}(),p3=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._gpuBuffer=null,e._gpuBufferView=null,e._uniformBuffer=null,e}c(e,t);var i=e.prototype;return i.initialize=function(t){if("buffer"in t){this._isBufferView=!0;var e=t.buffer;this._usage=e.usage,this._memUsage=e.memUsage,this._size=this._stride=t.range,this._count=1,this._flags=e.flags,this._gpuBufferView={gpuBuffer:e.gpuBuffer,offset:t.offset,range:t.range}}else this._usage=t.usage,this._memUsage=t.memUsage,this._size=t.size,this._stride=Math.max(t.stride||this._size,1),this._count=this._size/this._stride,this._flags=t.flags,this._usage&Dn.UNIFORM&&this._size>0&&(this._uniformBuffer=new Uint8Array(this._size)),this._gpuBuffer={usage:this._usage,memUsage:this._memUsage,size:this._size,stride:this._stride,buffer:null,vf32:null,indirects:new d3,glTarget:0,glBuffer:null},this._usage&Dn.UNIFORM&&(this._gpuBuffer.buffer=this._uniformBuffer),function(t,e){var i=t.gl,n=t.stateCache,r=e.memUsage&Mn.HOST?i.DYNAMIC_DRAW:i.STATIC_DRAW;if(e.usage&Dn.VERTEX){e.glTarget=i.ARRAY_BUFFER;var s=i.createBuffer();s&&(e.glBuffer=s,e.size>0&&(t.extensions.useVAO&&n.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),n.glVAO=null),r3.gpuInputAssembler=null,t.stateCache.glArrayBuffer!==e.glBuffer&&(i.bindBuffer(i.ARRAY_BUFFER,e.glBuffer),t.stateCache.glArrayBuffer=e.glBuffer),i.bufferData(i.ARRAY_BUFFER,e.size,r),i.bindBuffer(i.ARRAY_BUFFER,null),t.stateCache.glArrayBuffer=null))}else if(e.usage&Dn.INDEX){e.glTarget=i.ELEMENT_ARRAY_BUFFER;var a=i.createBuffer();a&&(e.glBuffer=a,e.size>0&&(t.extensions.useVAO&&n.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),n.glVAO=null),r3.gpuInputAssembler=null,t.stateCache.glElementArrayBuffer!==e.glBuffer&&(i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.glBuffer),t.stateCache.glElementArrayBuffer=e.glBuffer),i.bufferData(i.ELEMENT_ARRAY_BUFFER,e.size,r),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,null),t.stateCache.glElementArrayBuffer=null))}else e.usage&Dn.UNIFORM?(e.glTarget=i.NONE,e.buffer&&(e.vf32=new Float32Array(e.buffer.buffer))):(e.usage&Dn.INDIRECT||e.usage&Dn.TRANSFER_DST||e.usage&Dn.TRANSFER_SRC||console.error("Unsupported BufferType, create buffer failed."),e.glTarget=i.NONE)}(U2.instance,this._gpuBuffer),U2.instance.memoryStatus.bufferSize+=this._size},i.destroy=function(){this._gpuBuffer&&(function(t,e){var i=t.gl,n=t.stateCache;if(e.glBuffer){switch(e.glTarget){case i.ARRAY_BUFFER:t.extensions.useVAO&&n.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),t.stateCache.glVAO=null),r3.gpuInputAssembler=null,i.bindBuffer(i.ARRAY_BUFFER,null),t.stateCache.glArrayBuffer=null;break;case i.ELEMENT_ARRAY_BUFFER:t.extensions.useVAO&&n.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),t.stateCache.glVAO=null),r3.gpuInputAssembler=null,i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,null),t.stateCache.glElementArrayBuffer=null}i.deleteBuffer(e.glBuffer),e.glBuffer=null}}(U2.instance,this._gpuBuffer),U2.instance.memoryStatus.bufferSize-=this._size,this._gpuBuffer=null),this._gpuBufferView&&(this._gpuBufferView=null)},i.resize=function(t){if(this._isBufferView)console.warn("cannot resize buffer views!");else{var e=this._size;e!==t&&(this._size=t,this._count=this._size/this._stride,this._uniformBuffer&&(this._uniformBuffer=new Uint8Array(t)),this._gpuBuffer&&(this._uniformBuffer&&(this._gpuBuffer.buffer=this._uniformBuffer),this._gpuBuffer.size=t,t>0&&(function(t,e){var i=t.gl,n=t.stateCache,r=e.memUsage&Mn.HOST?i.DYNAMIC_DRAW:i.STATIC_DRAW;e.usage&Dn.VERTEX?(t.extensions.useVAO&&n.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),n.glVAO=null),r3.gpuInputAssembler=null,t.stateCache.glArrayBuffer!==e.glBuffer&&i.bindBuffer(i.ARRAY_BUFFER,e.glBuffer),e.buffer?i.bufferData(i.ARRAY_BUFFER,e.buffer,r):i.bufferData(i.ARRAY_BUFFER,e.size,r),i.bindBuffer(i.ARRAY_BUFFER,null),t.stateCache.glArrayBuffer=null):e.usage&Dn.INDEX?(t.extensions.useVAO&&n.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),n.glVAO=null),r3.gpuInputAssembler=null,t.stateCache.glElementArrayBuffer!==e.glBuffer&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.glBuffer),e.buffer?i.bufferData(i.ELEMENT_ARRAY_BUFFER,e.buffer,r):i.bufferData(i.ELEMENT_ARRAY_BUFFER,e.size,r),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,null),t.stateCache.glElementArrayBuffer=null):e.usage&Dn.UNIFORM?e.buffer&&(e.vf32=new Float32Array(e.buffer.buffer)):(e.usage&Dn.INDIRECT||e.usage&Dn.TRANSFER_DST||e.usage&Dn.TRANSFER_SRC||console.error("Unsupported BufferType, create buffer failed."),e.glTarget=i.NONE)}(U2.instance,this._gpuBuffer),U2.instance.memoryStatus.bufferSize-=e,U2.instance.memoryStatus.bufferSize+=t)))}},i.update=function(t,e){var i;this._isBufferView?console.warn("cannot update through buffer views!"):(i=void 0!==e?e:this._usage&Dn.INDIRECT?0:t.byteLength,n3(U2.instance,this._gpuBuffer,t,0,i))},h(e,[{key:"gpuBuffer",get:function(){return this._gpuBuffer}},{key:"gpuBufferView",get:function(){return this._gpuBufferView}}]),e}(Ls),m3=function(){function t(t,e){this._frees=void 0,this._freeIdx=0,this._freeCmds=void 0,this._frees=new Array(e),this._freeCmds=new ma(e);for(var i=0;i<e;++i)this._frees[i]=new t;this._freeIdx=e-1}var e=t.prototype;return e.alloc=function(t){if(this._freeIdx<0){var e=2*this._frees.length,i=this._frees;this._frees=new Array(e);for(var n=e-i.length,r=0;r<n;++r)this._frees[r]=new t;for(var s=n,a=0;s<e;++s,++a)this._frees[s]=i[a];this._freeIdx+=n}var o=this._frees[this._freeIdx];return this._frees[this._freeIdx--]=null,++o.refCount,o},e.free=function(t){0==--t.refCount&&this._freeCmds.push(t)},e.freeCmds=function(t){for(var e=0;e<t.length;++e)0==--t.array[e].refCount&&this._freeCmds.push(t.array[e])},e.release=function(){for(var t=0;t<this._freeCmds.length;++t){var e=this._freeCmds.array[t];e.clear(),this._frees[++this._freeIdx]=e}this._freeCmds.clear()},t}(),g3=function(){function t(){this.beginRenderPassCmdPool=void 0,this.bindStatesCmdPool=void 0,this.drawCmdPool=void 0,this.updateBufferCmdPool=void 0,this.copyBufferToTextureCmdPool=void 0,this.beginRenderPassCmdPool=new m3(Z2,1),this.bindStatesCmdPool=new m3(J2,1),this.drawCmdPool=new m3($2,1),this.updateBufferCmdPool=new m3(t3,1),this.copyBufferToTextureCmdPool=new m3(e3,1)}var e=t.prototype;return e.clearCmds=function(t){t.beginRenderPassCmds.length&&(this.beginRenderPassCmdPool.freeCmds(t.beginRenderPassCmds),t.beginRenderPassCmds.clear()),t.bindStatesCmds.length&&(this.bindStatesCmdPool.freeCmds(t.bindStatesCmds),t.bindStatesCmds.clear()),t.drawCmds.length&&(this.drawCmdPool.freeCmds(t.drawCmds),t.drawCmds.clear()),t.updateBufferCmds.length&&(this.updateBufferCmdPool.freeCmds(t.updateBufferCmds),t.updateBufferCmds.clear()),t.copyBufferToTextureCmds.length&&(this.copyBufferToTextureCmdPool.freeCmds(t.copyBufferToTextureCmds),t.copyBufferToTextureCmds.clear()),t.cmds.clear()},e.releaseCmds=function(){this.beginRenderPassCmdPool.release(),this.bindStatesCmdPool.release(),this.drawCmdPool.release(),this.updateBufferCmdPool.release(),this.copyBufferToTextureCmdPool.release()},t}(),v3=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).cmdPackage=new i3,e._cmdAllocator=new g3,e._isInRenderPass=!1,e._curGPUPipelineState=null,e._curGPUInputAssembler=null,e._curGPUDescriptorSets=[],e._curDynamicOffsets=Array(8).fill(0),e._curDynamicStates=new Ts,e._isStateInvalied=!1,e}c(e,t);var i=e.prototype;return i.initialize=function(t){this._type=t.type,this._queue=t.queue;for(var e=U2.instance.bindingMappings.blockOffsets.length,i=0;i<e;i++)this._curGPUDescriptorSets.push(null)},i.destroy=function(){this._cmdAllocator.clearCmds(this.cmdPackage)},i.begin=function(){this._cmdAllocator.clearCmds(this.cmdPackage),this._curGPUPipelineState=null,this._curGPUInputAssembler=null,this._curGPUDescriptorSets.length=0,this._numDrawCalls=0,this._numInstances=0,this._numTris=0},i.end=function(){this._isStateInvalied&&this.bindStates(),this._isInRenderPass=!1},i.beginRenderPass=function(t,e,i,n,r,s){var a=this._cmdAllocator.beginRenderPassCmdPool.alloc(Z2);a.gpuRenderPass=t.gpuRenderPass,a.gpuFramebuffer=e.gpuFramebuffer,a.renderArea.copy(i),a.clearColors.length=n.length;for(var o=0;o<n.length;++o)a.clearColors[o]=n[o];a.clearDepth=r,a.clearStencil=s,this.cmdPackage.beginRenderPassCmds.push(a),this.cmdPackage.cmds.push(X2.BEGIN_RENDER_PASS),this._isInRenderPass=!0},i.endRenderPass=function(){this._isInRenderPass=!1},i.bindPipelineState=function(t){var e=t.gpuPipelineState;e!==this._curGPUPipelineState&&(this._curGPUPipelineState=e,this._isStateInvalied=!0)},i.bindDescriptorSet=function(t,e,i){var n=e.gpuDescriptorSet;if(n!==this._curGPUDescriptorSets[t]&&(this._curGPUDescriptorSets[t]=n,this._isStateInvalied=!0),i){var r,s=null===(r=this._curGPUPipelineState)||void 0===r?void 0:r.gpuPipelineLayout;if(s){for(var a=this._curDynamicOffsets,o=s.dynamicOffsetOffsets[t],u=0;u<i.length;u++)a[o+u]=i[u];this._isStateInvalied=!0}}},i.bindInputAssembler=function(t){var e=t.gpuInputAssembler;this._curGPUInputAssembler=e,this._isStateInvalied=!0},i.setViewport=function(t){var e=this._curDynamicStates.viewport;e.left===t.left&&e.top===t.top&&e.width===t.width&&e.height===t.height&&e.minDepth===t.minDepth&&e.maxDepth===t.maxDepth||(e.left=t.left,e.top=t.top,e.width=t.width,e.height=t.height,e.minDepth=t.minDepth,e.maxDepth=t.maxDepth,this._isStateInvalied=!0)},i.setScissor=function(t){var e=this._curDynamicStates.scissor;e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height||(e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height,this._isStateInvalied=!0)},i.setLineWidth=function(t){this._curDynamicStates.lineWidth!==t&&(this._curDynamicStates.lineWidth=t,this._isStateInvalied=!0)},i.setDepthBias=function(t,e,i){var n=this._curDynamicStates;n.depthBiasConstant===t&&n.depthBiasClamp===e&&n.depthBiasSlope===i||(n.depthBiasConstant=t,n.depthBiasClamp=e,n.depthBiasSlope=i,this._isStateInvalied=!0)},i.setBlendConstants=function(t){var e=this._curDynamicStates.blendConstant;e.x===t.x&&e.y===t.y&&e.z===t.z&&e.w===t.w||(e.copy(t),this._isStateInvalied=!0)},i.setDepthBound=function(t,e){var i=this._curDynamicStates;i.depthMinBounds===t&&i.depthMaxBounds===e||(i.depthMinBounds=t,i.depthMaxBounds=e,this._isStateInvalied=!0)},i.setStencilWriteMask=function(t,e){var i=this._curDynamicStates.stencilStatesFront,n=this._curDynamicStates.stencilStatesBack;t&ar.FRONT&&i.writeMask!==e&&(i.writeMask=e,this._isStateInvalied=!0),t&ar.BACK&&n.writeMask!==e&&(n.writeMask=e,this._isStateInvalied=!0)},i.setStencilCompareMask=function(t,e,i){var n=this._curDynamicStates.stencilStatesFront,r=this._curDynamicStates.stencilStatesBack;t&ar.FRONT&&(n.compareMask===i&&n.reference===e||(n.reference=e,n.compareMask=i,this._isStateInvalied=!0)),t&ar.BACK&&(r.compareMask===i&&r.reference===e||(r.reference=e,r.compareMask=i,this._isStateInvalied=!0))},i.draw=function(t){if(this._type===lr.PRIMARY&&this._isInRenderPass||this._type===lr.SECONDARY){this._isStateInvalied&&this.bindStates();var e="drawInfo"in t?t.drawInfo:t,i=this._cmdAllocator.drawCmdPool.alloc($2);i.drawInfo.copy(e),this.cmdPackage.drawCmds.push(i),this.cmdPackage.cmds.push(X2.DRAW),++this._numDrawCalls,this._numInstances+=e.instanceCount;var n=e.indexCount||e.vertexCount;if(this._curGPUPipelineState)switch(this._curGPUPipelineState.glPrimitive){case 4:this._numTris+=n/3*Math.max(e.instanceCount,1);break;case 5:case 6:this._numTris+=(n-2)*Math.max(e.instanceCount,1)}}else console.error("Command 'draw' must be recorded inside a render pass.")},i.updateBuffer=function(t,e,i){if(this._type===lr.PRIMARY&&!this._isInRenderPass||this._type===lr.SECONDARY){var n=t.gpuBuffer;if(n){var r,s=this._cmdAllocator.updateBufferCmdPool.alloc(t3),a=0;t.usage&Dn.INDIRECT||(a=void 0!==i?i:e.byteLength),r=e,s.gpuBuffer=n,s.buffer=r,s.offset=0,s.size=a,this.cmdPackage.updateBufferCmds.push(s),this.cmdPackage.cmds.push(X2.UPDATE_BUFFER)}}else console.error("Command 'updateBuffer' must be recorded outside a render pass.")},i.copyBuffersToTexture=function(t,e,i){if(this._type===lr.PRIMARY&&!this._isInRenderPass||this._type===lr.SECONDARY){var n=e.gpuTexture;if(n){var r=this._cmdAllocator.copyBufferToTextureCmdPool.alloc(e3);r&&(r.gpuTexture=n,r.regions=i,r.buffers=t,this.cmdPackage.copyBufferToTextureCmds.push(r),this.cmdPackage.cmds.push(X2.COPY_BUFFER_TO_TEXTURE))}}else console.error("Command 'copyBufferToTexture' must be recorded outside a render pass.")},i.execute=function(t,e){for(var i=0;i<e;++i){for(var n=t[i],r=0;r<n.cmdPackage.beginRenderPassCmds.length;++r){var s=n.cmdPackage.beginRenderPassCmds.array[r];++s.refCount,this.cmdPackage.beginRenderPassCmds.push(s)}for(var a=0;a<n.cmdPackage.bindStatesCmds.length;++a){var o=n.cmdPackage.bindStatesCmds.array[a];++o.refCount,this.cmdPackage.bindStatesCmds.push(o)}for(var u=0;u<n.cmdPackage.drawCmds.length;++u){var h=n.cmdPackage.drawCmds.array[u];++h.refCount,this.cmdPackage.drawCmds.push(h)}for(var l=0;l<n.cmdPackage.updateBufferCmds.length;++l){var c=n.cmdPackage.updateBufferCmds.array[l];++c.refCount,this.cmdPackage.updateBufferCmds.push(c)}for(var _=0;_<n.cmdPackage.copyBufferToTextureCmds.length;++_){var f=n.cmdPackage.copyBufferToTextureCmds.array[_];++f.refCount,this.cmdPackage.copyBufferToTextureCmds.push(f)}this.cmdPackage.cmds.concat(n.cmdPackage.cmds.array),this._numDrawCalls+=n._numDrawCalls,this._numInstances+=n._numInstances,this._numTris+=n._numTris}},i.pipelineBarrier=function(){},i.bindStates=function(){var t=this._cmdAllocator.bindStatesCmdPool.alloc(J2);t&&(t.gpuPipelineState=this._curGPUPipelineState,Array.prototype.push.apply(t.gpuDescriptorSets,this._curGPUDescriptorSets),Array.prototype.push.apply(t.dynamicOffsets,this._curDynamicOffsets),t.gpuInputAssembler=this._curGPUInputAssembler,t.dynamicStates.copy(this._curDynamicStates),this.cmdPackage.bindStatesCmds.push(t),this.cmdPackage.cmds.push(X2.BIND_STATES),this._isStateInvalied=!1)},e}(Fs),y3=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._gpuFramebuffer=null,e}c(e,t);var i=e.prototype;return i.initialize=function(t){this._renderPass=t.renderPass,this._colorTextures=t.colorTextures||[],this._depthStencilTexture=t.depthStencilTexture||null;for(var e=0,i=[],n=0;n<t.colorTextures.length;++n){var r=t.colorTextures[n];r&&(i.push(r.gpuTexture),e=r.lodLevel)}var s=null;t.depthStencilTexture&&(s=t.depthStencilTexture.gpuTexture,e=t.depthStencilTexture.lodLevel);var a=Number.MAX_SAFE_INTEGER,o=Number.MAX_SAFE_INTEGER;this._gpuFramebuffer={gpuRenderPass:t.renderPass.gpuRenderPass,gpuColorTextures:i,gpuDepthStencilTexture:s,glFramebuffer:null,isOffscreen:!0,get width(){return this.isOffscreen?a:this.gpuColorTextures[0].width},set width(t){a=t},get height(){return this.isOffscreen?o:this.gpuColorTextures[0].height},set height(t){o=t},lodLevel:e},function(t,e){for(var i=0;i<e.gpuColorTextures.length;++i)if(e.gpuColorTextures[i].isSwapchainTexture)return void(e.isOffscreen=!1);var n=t.gl,r=[],s=n.createFramebuffer();if(s){e.glFramebuffer=s,t.stateCache.glFramebuffer!==e.glFramebuffer&&n.bindFramebuffer(n.FRAMEBUFFER,e.glFramebuffer);for(var a=0;a<e.gpuColorTextures.length;++a){var o=e.gpuColorTextures[a];o&&(o.glTexture?n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+a,o.glTarget,o.glTexture,0):n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+a,n.RENDERBUFFER,o.glRenderbuffer),r.push(n.COLOR_ATTACHMENT0+a),e.width=Math.min(e.width,o.width),e.height=Math.min(e.height,o.height))}var u=e.gpuDepthStencilTexture;if(u){var h=As[u.format].hasStencil?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;u.glTexture?n.framebufferTexture2D(n.FRAMEBUFFER,h,u.glTarget,u.glTexture,0):n.framebufferRenderbuffer(n.FRAMEBUFFER,h,n.RENDERBUFFER,u.glRenderbuffer),e.width=Math.min(e.width,u.width),e.height=Math.min(e.height,u.height)}t.extensions.WEBGL_draw_buffers&&t.extensions.WEBGL_draw_buffers.drawBuffersWEBGL(r);var l=n.checkFramebufferStatus(n.FRAMEBUFFER);if(l!==n.FRAMEBUFFER_COMPLETE)switch(l){case n.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:console.error("glCheckFramebufferStatus() - FRAMEBUFFER_INCOMPLETE_ATTACHMENT");break;case n.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:console.error("glCheckFramebufferStatus() - FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT");break;case n.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:console.error("glCheckFramebufferStatus() - FRAMEBUFFER_INCOMPLETE_DIMENSIONS");break;case n.FRAMEBUFFER_UNSUPPORTED:console.error("glCheckFramebufferStatus() - FRAMEBUFFER_UNSUPPORTED")}t.stateCache.glFramebuffer!==e.glFramebuffer&&n.bindFramebuffer(n.FRAMEBUFFER,t.stateCache.glFramebuffer)}}(U2.instance,this._gpuFramebuffer)},i.destroy=function(){var t,e;this._gpuFramebuffer&&(t=U2.instance,(e=this._gpuFramebuffer).glFramebuffer&&(t.gl.deleteFramebuffer(e.glFramebuffer),t.stateCache.glFramebuffer===e.glFramebuffer&&(t.gl.bindFramebuffer(t.gl.FRAMEBUFFER,null),t.stateCache.glFramebuffer=null),e.glFramebuffer=null),this._gpuFramebuffer=null)},h(e,[{key:"gpuFramebuffer",get:function(){return this._gpuFramebuffer}}]),e}(ks),E3=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._gpuInputAssembler=null,e}c(e,t);var i=e.prototype;return i.initialize=function(t){if(0!==t.vertexBuffers.length){if(this._attributes=t.attributes,this._attributesHash=this.computeAttributesHash(),this._vertexBuffers=t.vertexBuffers,t.indexBuffer)this._indexBuffer=t.indexBuffer,this._drawInfo.indexCount=this._indexBuffer.size/this._indexBuffer.stride,this._drawInfo.firstIndex=0;else{var e=this._vertexBuffers[0];this._drawInfo.vertexCount=e.size/e.stride,this._drawInfo.firstVertex=0,this._drawInfo.vertexOffset=0}this._drawInfo.instanceCount=0,this._drawInfo.firstInstance=0,this._indirectBuffer=t.indirectBuffer||null;for(var i=new Array(t.vertexBuffers.length),n=0;n<t.vertexBuffers.length;++n){var r=t.vertexBuffers[n];r.gpuBuffer&&(i[n]=r.gpuBuffer)}var s=null,a=0;if(t.indexBuffer&&(s=t.indexBuffer.gpuBuffer))switch(s.stride){case 1:a=5121;break;case 2:a=5123;break;case 4:a=5125;break;default:console.error("Error index buffer stride.")}var o=null;t.indirectBuffer&&(o=t.indirectBuffer.gpuBuffer),this._gpuInputAssembler={attributes:t.attributes,gpuVertexBuffers:i,gpuIndexBuffer:s,gpuIndirectBuffer:o,glAttribs:[],glIndexType:a,glVAOs:new Map},function(t,e){var i=t.gl;e.glAttribs=new Array(e.attributes.length);for(var n=[0,0,0,0,0,0,0,0],r=0;r<e.attributes.length;++r){var s=e.attributes[r],a=void 0!==s.stream?s.stream:0,o=e.gpuVertexBuffers[a],u=G2(s.format,i),h=As[s.format].size;e.glAttribs[r]={name:s.name,glBuffer:o.glBuffer,glType:u,size:h,count:As[s.format].count,stride:o.stride,componentCount:W2(u,i),isNormalized:void 0!==s.isNormalized&&s.isNormalized,isInstanced:void 0!==s.isInstanced&&s.isInstanced,offset:n[a]},n[a]+=h}}(U2.instance,this._gpuInputAssembler)}else console.error("InputAssemblerInfo.vertexBuffers is null.")},i.destroy=function(){var t=U2.instance;this._gpuInputAssembler&&t.extensions.useVAO&&function(t,e){for(var i=e.glVAOs.values(),n=i.next(),r=t.extensions.OES_vertex_array_object,s=t.stateCache.glVAO;!n.done;)r.deleteVertexArrayOES(n.value),s===n.value&&(r.bindVertexArrayOES(null),s=null),n=i.next();t.stateCache.glVAO=s,e.glVAOs.clear()}(t,this._gpuInputAssembler),this._gpuInputAssembler=null},h(e,[{key:"gpuInputAssembler",get:function(){return this._gpuInputAssembler}}]),e}(Ws),T3=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._gpuDescriptorSetLayout=null,e}c(e,t);var i=e.prototype;return i.initialize=function(t){Array.prototype.push.apply(this._bindings,t.bindings);for(var e=0,i=-1,n=[],r=0;r<this._bindings.length;r++){var s=this._bindings[r];n.push(e),e+=s.count,s.binding>i&&(i=s.binding)}this._bindingIndices=Array(i+1).fill(-1);for(var a=this._descriptorIndices=Array(i+1).fill(-1),o=0;o<this._bindings.length;o++){var u=this._bindings[o];this._bindingIndices[u.binding]=o,a[u.binding]=n[o]}for(var h=[],l=0;l<this._bindings.length;l++){var c=this._bindings[l];if(c.descriptorType&Cs)for(var _=0;_<c.count;_++)h.push(c.binding)}this._gpuDescriptorSetLayout={bindings:this._bindings,dynamicBindings:h,descriptorIndices:a,descriptorCount:e}},i.destroy=function(){this._bindings.length=0},h(e,[{key:"gpuDescriptorSetLayout",get:function(){return this._gpuDescriptorSetLayout}}]),e}(js),S3=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._gpuPipelineLayout=null,e}c(e,t);var i=e.prototype;return i.initialize=function(t){Array.prototype.push.apply(this._setLayouts,t.setLayouts);for(var e=[],i=[],n=0,r=[],s=0;s<this._setLayouts.length;s++){for(var a=this._setLayouts[s],o=a.gpuDescriptorSetLayout.dynamicBindings,u=Array(a.bindingIndices.length).fill(-1),h=0;h<o.length;h++){var l=o[h];u[l]<0&&(u[l]=n+h)}i.push(a.gpuDescriptorSetLayout),e.push(u),r.push(n),n+=o.length}this._gpuPipelineLayout={gpuSetLayouts:i,dynamicOffsetIndices:e,dynamicOffsetCount:n,dynamicOffsetOffsets:r}},i.destroy=function(){this._setLayouts.length=0},h(e,[{key:"gpuPipelineLayout",get:function(){return this._gpuPipelineLayout}}]),e}(Ys),A3=[0,1,3,2,0,0,0,4,5,6,0,0,0,0],R3=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._gpuPipelineState=null,e}c(e,t);var i=e.prototype;return i.initialize=function(t){this._primitive=t.primitive,this._shader=t.shader,this._pipelineLayout=t.pipelineLayout;var e=this._bs;if(t.blendState){var i=t.blendState,n=i.targets;n&&n.forEach((function(t,i){e.setTarget(i,t)})),void 0!==i.isA2C&&(e.isA2C=i.isA2C),void 0!==i.isIndepend&&(e.isIndepend=i.isIndepend),void 0!==i.blendColor&&(e.blendColor=i.blendColor)}Object.assign(this._rs,t.rasterizerState),Object.assign(this._dss,t.depthStencilState),this._is=t.inputState,this._renderPass=t.renderPass,this._dynamicStates=t.dynamicStates;for(var r=[],s=0;s<31;s++)this._dynamicStates&1<<s&&r.push(1<<s);this._gpuPipelineState={glPrimitive:A3[t.primitive],gpuShader:t.shader.gpuShader,gpuPipelineLayout:t.pipelineLayout.gpuPipelineLayout,rs:t.rasterizerState,dss:t.depthStencilState,bs:t.blendState,gpuRenderPass:t.renderPass.gpuRenderPass,dynamicStates:r}},i.destroy=function(){this._gpuPipelineState=null},h(e,[{key:"gpuPipelineState",get:function(){return this._gpuPipelineState}}]),e}($s),b3=function(t){function e(){return t.apply(this,arguments)||this}c(e,t);var i=e.prototype;return i.beginRenderPass=function(t,e,i,n,r,s){a3(U2.instance,t.gpuRenderPass,e.gpuFramebuffer,i,n,r,s),this._isInRenderPass=!0},i.draw=function(t){if(this._isInRenderPass){this._isStateInvalied&&this.bindStates();var e="drawInfo"in t?t.drawInfo:t;u3(U2.instance,e),++this._numDrawCalls,this._numInstances+=e.instanceCount;var i=e.indexCount||e.vertexCount;if(this._curGPUPipelineState)switch(this._curGPUPipelineState.glPrimitive){case 4:this._numTris+=i/3*Math.max(e.instanceCount,1);break;case 5:case 6:this._numTris+=(i-2)*Math.max(e.instanceCount,1)}}else console.error("Command 'draw' must be recorded inside a render pass.")},i.setViewport=function(t){var e=U2.instance,i=e.stateCache,n=e.gl;i.viewport.left===t.left&&i.viewport.top===t.top&&i.viewport.width===t.width&&i.viewport.height===t.height||(n.viewport(t.left,t.top,t.width,t.height),i.viewport.left=t.left,i.viewport.top=t.top,i.viewport.width=t.width,i.viewport.height=t.height)},i.setScissor=function(t){var e=U2.instance,i=e.stateCache,n=e.gl;i.scissorRect.x===t.x&&i.scissorRect.y===t.y&&i.scissorRect.width===t.width&&i.scissorRect.height===t.height||(n.scissor(t.x,t.y,t.width,t.height),i.scissorRect.x=t.x,i.scissorRect.y=t.y,i.scissorRect.width=t.width,i.scissorRect.height=t.height)},i.updateBuffer=function(t,e,i){if(this._isInRenderPass)console.error("Command 'updateBuffer' must be recorded outside a render pass.");else{var n,r=t.gpuBuffer;r&&(n=void 0!==i?i:t.usage&Dn.INDIRECT?0:e.byteLength,n3(U2.instance,r,e,0,n))}},i.copyBuffersToTexture=function(t,e,i){if(this._isInRenderPass)console.error("Command 'copyBufferToTexture' must be recorded outside a render pass.");else{var n=e.gpuTexture;n&&f3(U2.instance,t,n,i)}},i.execute=function(t,e){for(var i=0;i<e;++i){var n=t[i];l3(U2.instance,n.cmdPackage),this._numDrawCalls+=n._numDrawCalls,this._numInstances+=n._numInstances,this._numTris+=n._numTris}},i.bindStates=function(){o3(U2.instance,this._curGPUPipelineState,this._curGPUInputAssembler,this._curGPUDescriptorSets,this._curDynamicOffsets,this._curDynamicStates),this._isStateInvalied=!1},e}(v3),C3=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).numDrawCalls=0,e.numInstances=0,e.numTris=0,e}c(e,t);var i=e.prototype;return i.initialize=function(t){this._type=t.type},i.destroy=function(){},i.submit=function(t){for(var e=t.length,i=0;i<e;i++){var n=t[i];this.numDrawCalls+=n.numDrawCalls,this.numInstances+=n.numInstances,this.numTris+=n.numTris}},i.clear=function(){this.numDrawCalls=0,this.numInstances=0,this.numTris=0},e}(ta),w3=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._gpuRenderPass=null,e}c(e,t);var i=e.prototype;return i.initialize=function(t){this._colorInfos=t.colorAttachments,this._depthStencilInfo=t.depthStencilAttachment,this._subpasses=t.subpasses,this._gpuRenderPass={colorAttachments:this._colorInfos,depthStencilAttachment:this._depthStencilInfo},this._hash=this.computeHash()},i.destroy=function(){this._gpuRenderPass=null},h(e,[{key:"gpuRenderPass",get:function(){return this._gpuRenderPass}}]),e}(ea),I3=[10497,33648,33071,33071],O3=function(t){function e(e,i){var n;(n=t.call(this,e,i)||this)._gpuSampler=null;var r,s,a=n._info.minFilter,o=n._info.magFilter,u=n._info.mipFilter;r=a===Hn.LINEAR||a===Hn.ANISOTROPIC?u===Hn.LINEAR||u===Hn.ANISOTROPIC?9987:u===Hn.POINT?9985:9729:u===Hn.LINEAR||u===Hn.ANISOTROPIC?9986:u===Hn.POINT?9984:9728,s=o===Hn.LINEAR||o===Hn.ANISOTROPIC?9729:9728;var h=I3[n._info.addressU],l=I3[n._info.addressV],c=I3[n._info.addressW];return n._gpuSampler={glMinFilter:r,glMagFilter:s,glWrapS:h,glWrapT:l,glWrapR:c},n}return c(e,t),h(e,[{key:"gpuSampler",get:function(){return this._gpuSampler}}]),e}(ia),x3=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._gpuShader=null,e}c(e,t);var i=e.prototype;return i.initialize=function(t){this._name=t.name,this._stages=t.stages,this._attributes=t.attributes,this._blocks=t.blocks,this._samplers=t.samplers,this._gpuShader={name:t.name,blocks:t.blocks.slice(),samplerTextures:t.samplerTextures.slice(),subpassInputs:t.subpassInputs.slice(),gpuStages:new Array(t.stages.length),glProgram:null,glInputs:[],glUniforms:[],glBlocks:[],glSamplerTextures:[]};for(var e=0;e<t.stages.length;++e){var i=t.stages[e];this._gpuShader.gpuStages[e]={type:i.stage,source:i.source,glShader:null}}},i.destroy=function(){this._gpuShader&&(function(t,e){if(e.glProgram){var i=t.gl;if(!t.extensions.destroyShadersImmediately)for(var n=0;n<e.gpuStages.length;n++){var r=e.gpuStages[n];r.glShader&&(i.detachShader(e.glProgram,r.glShader),i.deleteShader(r.glShader),r.glShader=null)}i.deleteProgram(e.glProgram),t.stateCache.glProgram===e.glProgram&&(t.gl.useProgram(null),t.stateCache.glProgram=null),e.glProgram=null}}(U2.instance,this._gpuShader),this._gpuShader=null)},h(e,[{key:"gpuShader",get:function(){return null===this._gpuShader.glProgram&&function(t,e){for(var i=t.gl,n=function(t){var n=e.gpuStages[t],r=0,s="",a=1;switch(n.type){case qn.VERTEX:s="VertexShader",r=i.VERTEX_SHADER;break;case qn.FRAGMENT:s="FragmentShader",r=i.FRAGMENT_SHADER;break;default:return console.error("Unsupported ShaderType."),{v:void 0}}var o=i.createShader(r);if(o&&(n.glShader=o,i.shaderSource(n.glShader,n.source),i.compileShader(n.glShader),!i.getShaderParameter(n.glShader,i.COMPILE_STATUS))){console.error(s+" in '"+e.name+"' compilation failed."),console.error("Shader source dump:",n.source.replace(/^|\n/g,(function(){return"\n"+a+++" "}))),console.error(i.getShaderInfoLog(n.glShader));for(var u=0;u<e.gpuStages.length;u++){var h=e.gpuStages[t];h.glShader&&(i.deleteShader(h.glShader),h.glShader=null)}return{v:void 0}}},r=0;r<e.gpuStages.length;r++){var s=n(r);if("object"==typeof s)return s.v}var a=i.createProgram();if(a){e.glProgram=a;for(var o=0;o<e.gpuStages.length;o++){var u=e.gpuStages[o];i.attachShader(e.glProgram,u.glShader)}if(i.linkProgram(e.glProgram),t.extensions.destroyShadersImmediately)for(var h=0;h<e.gpuStages.length;h++){var l=e.gpuStages[h];l.glShader&&(i.detachShader(e.glProgram,l.glShader),i.deleteShader(l.glShader),l.glShader=null)}if(!i.getProgramParameter(e.glProgram,i.LINK_STATUS))return console.error("Failed to link shader '"+e.name+"'."),void console.error(i.getProgramInfoLog(e.glProgram));G("Shader '"+e.name+"' compilation succeeded.");var c=i.getProgramParameter(e.glProgram,i.ACTIVE_ATTRIBUTES);e.glInputs=new Array(c);for(var _=0;_<c;++_){var f=i.getActiveAttrib(e.glProgram,_);if(f){var d,p=f.name.indexOf("[");d=-1!==p?f.name.substr(0,p):f.name;var m=i.getAttribLocation(e.glProgram,d),g=H2(f.type,i),v=V2(f.type,i);e.glInputs[_]={binding:m,name:d,type:g,stride:v,count:f.size,size:v*f.size,glType:f.type,glLoc:m}}}if(e.blocks.length>0){e.glBlocks=new Array(e.blocks.length);for(var y=0;y<e.blocks.length;++y){var E=e.blocks[y],T={set:E.set,binding:E.binding,name:E.name,size:0,glUniforms:new Array(E.members.length),glActiveUniforms:[]};e.glBlocks[y]=T;for(var S=0;S<E.members.length;++S){var A=E.members[S],R=k2(A.type,i),b=V2(R,i),C=b*A.count;T.glUniforms[S]={binding:-1,name:A.name,type:A.type,stride:b,count:A.count,size:C,offset:0,glType:R,glLoc:null,array:null}}}}for(var w=0;w<e.subpassInputs.length;++w){var I=e.subpassInputs[w];e.samplerTextures.push(new Xr(I.set,I.binding,I.name,Pn.SAMPLER2D,I.count))}if(e.samplerTextures.length>0){e.glSamplerTextures=new Array(e.samplerTextures.length);for(var O=0;O<e.samplerTextures.length;++O){var x=e.samplerTextures[O];e.glSamplerTextures[O]={set:x.set,binding:x.binding,name:x.name,type:x.type,count:x.count,units:[],glUnits:null,glType:k2(x.type,i),glLoc:null}}}for(var P=i.getProgramParameter(e.glProgram,i.ACTIVE_UNIFORMS),D=0;D<P;++D){var B=i.getActiveUniform(e.glProgram,D);if(B&&B.type!==i.SAMPLER_2D&&B.type!==i.SAMPLER_CUBE){var N=i.getUniformLocation(e.glProgram,B.name);if(t.extensions.isLocationActive(N)){var M,L=B.name.indexOf("[");M=-1!==L?B.name.substr(0,L):B.name;for(var F=0;F<e.glBlocks.length;F++)for(var U=e.glBlocks[F],k=0;k<U.glUniforms.length;k++){var z=U.glUniforms[k];if(z.name===M){z.glLoc=N,z.count=B.size,z.size=z.stride*z.count,z.array=new(z2(z.type))(z.size/4),U.glActiveUniforms.push(z);break}}}}}for(var H=0;H<e.glBlocks.length;H++)for(var V=e.glBlocks[H],W=0;W<V.glUniforms.length;W++){var X=V.glUniforms[W];X.offset=V.size/4,V.size+=X.size}for(var j=[],Y=[],K=t.bindingMappings,q=t.stateCache.texUnitCacheMap,Q=0,Z=0;Z<e.blocks.length;++Z)e.blocks[Z].set===K.flexibleSet&&Q++;for(var J=0,$=0;$<e.samplerTextures.length;++$){var tt=e.samplerTextures[$],et=i.getUniformLocation(e.glProgram,tt.name);if(t.extensions.isLocationActive(et)&&(j.push(e.glSamplerTextures[$]),Y.push(et)),void 0===q[tt.name]){var it=tt.binding+K.samplerTextureOffsets[tt.set]+J;tt.set===K.flexibleSet&&(it-=Q),q[tt.name]=it%t.capabilities.maxTextureUnits,J+=tt.count-1}}if(j.length){for(var nt=[],rt=0;rt<j.length;++rt){var st=j[rt],at=q[st.name];if(void 0!==at){st.glLoc=Y[rt];for(var ot=0;ot<st.count;++ot){for(;nt[at];)at=(at+1)%t.capabilities.maxTextureUnits;st.units.push(at),nt[at]=!0}}}for(var ut=0,ht=0;ht<j.length;++ht){var lt=j[ht];if(!t.extensions.isLocationActive(lt.glLoc)){lt.glLoc=Y[ht];for(var ct=0;ct<lt.count;++ct){for(;nt[ut];)ut=(ut+1)%t.capabilities.maxTextureUnits;void 0===q[lt.name]&&(q[lt.name]=ut),lt.units.push(ut),nt[ut]=!0}}}t.stateCache.glProgram!==e.glProgram&&i.useProgram(e.glProgram);for(var _t=0;_t<j.length;_t++){var ft=j[_t];ft.glUnits=new Int32Array(ft.units),i.uniform1iv(ft.glLoc,ft.glUnits)}t.stateCache.glProgram!==e.glProgram&&i.useProgram(t.stateCache.glProgram)}for(var dt=0;dt<e.glBlocks.length;)e.glBlocks[dt].glActiveUniforms.length?dt++:(e.glBlocks[dt]=e.glBlocks[e.glBlocks.length-1],e.glBlocks.length--);e.glSamplerTextures=j}}(U2.instance,this._gpuShader),this._gpuShader}}]),e}(na),P3=function(){function t(){this.glArrayBuffer=null,this.glElementArrayBuffer=null,this.glVAO=null,this.texUnit=0,this.glTexUnits=[],this.glRenderbuffer=null,this.glFramebuffer=null,this.viewport=new Or,this.scissorRect=new Sr(0,0,0,0),this.rs=new Ks,this.dss=new qs,this.bs=new Zs,this.glProgram=null,this.glEnabledAttribLocs=[],this.glCurrentAttribLocs=[],this.texUnitCacheMap={}}return t.prototype.initialize=function(t,e){for(var i=0;i<t;++i)this.glTexUnits.push({glTexture:null});this.glEnabledAttribLocs.length=e,this.glEnabledAttribLocs.fill(!1),this.glCurrentAttribLocs.length=e,this.glCurrentAttribLocs.fill(!1)},t}(),D3=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._gpuTexture=null,e._lodLevel=0,e}c(e,t);var i=e.prototype;return i.initialize=function(t,e){var i=t,n=t;"texture"in t&&(i=n.texture.info,this._isTextureView=!0),this._info.copy(i),this._isPowerOf2=ws(this._info.width)&&ws(this._info.height),this._size=Os(this._info.format,this.width,this.height,this.depth,this._info.levelCount)*this._info.layerCount,this._isTextureView?(this._viewInfo.copy(n),this._lodLevel=n.baseLevel,this._gpuTexture=n.texture._gpuTexture):(this._gpuTexture={type:i.type,format:i.format,usage:i.usage,width:i.width,height:i.height,depth:i.depth,size:this._size,arrayLayer:i.layerCount,mipLevel:i.levelCount,samples:i.samples,flags:i.flags,isPowerOf2:this._isPowerOf2,glTarget:0,glInternalFmt:0,glFormat:0,glType:0,glUsage:0,glTexture:null,glRenderbuffer:null,glWrapS:0,glWrapT:0,glMinFilter:0,glMagFilter:0,isSwapchainTexture:e||!1},function(t,e){var i=t.gl;e.glFormat=e.glInternalFmt=function(t,e){switch(t){case On.A8:return e.ALPHA;case On.L8:return e.LUMINANCE;case On.LA8:return e.LUMINANCE_ALPHA;case On.RGB8:case On.RGB16F:case On.RGB32F:return e.RGB;case On.BGRA8:case On.RGBA8:case On.SRGB8_A8:case On.RGBA16F:case On.RGBA32F:return e.RGBA;case On.R5G6B5:return e.RGB;case On.RGB5A1:case On.RGBA4:return e.RGBA;case On.DEPTH:return e.DEPTH_COMPONENT;case On.DEPTH_STENCIL:return e.DEPTH_STENCIL;case On.BC1:return L2.COMPRESSED_RGB_S3TC_DXT1_EXT;case On.BC1_ALPHA:return L2.COMPRESSED_RGBA_S3TC_DXT1_EXT;case On.BC1_SRGB:return L2.COMPRESSED_SRGB_S3TC_DXT1_EXT;case On.BC1_SRGB_ALPHA:return L2.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;case On.BC2:return L2.COMPRESSED_RGBA_S3TC_DXT3_EXT;case On.BC2_SRGB:return L2.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;case On.BC3:return L2.COMPRESSED_RGBA_S3TC_DXT5_EXT;case On.BC3_SRGB:return L2.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;case On.ETC_RGB8:return L2.COMPRESSED_RGB_ETC1_WEBGL;case On.ETC2_RGB8:return L2.COMPRESSED_RGB8_ETC2;case On.ETC2_SRGB8:return L2.COMPRESSED_SRGB8_ETC2;case On.ETC2_RGB8_A1:return L2.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2;case On.ETC2_SRGB8_A1:return L2.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2;case On.ETC2_RGBA8:return L2.COMPRESSED_RGBA8_ETC2_EAC;case On.ETC2_SRGB8_A8:return L2.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC;case On.EAC_R11:return L2.COMPRESSED_R11_EAC;case On.EAC_R11SN:return L2.COMPRESSED_SIGNED_R11_EAC;case On.EAC_RG11:return L2.COMPRESSED_RG11_EAC;case On.EAC_RG11SN:return L2.COMPRESSED_SIGNED_RG11_EAC;case On.PVRTC_RGB2:return L2.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;case On.PVRTC_RGBA2:return L2.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;case On.PVRTC_RGB4:return L2.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;case On.PVRTC_RGBA4:return L2.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;case On.ASTC_RGBA_4X4:return L2.COMPRESSED_RGBA_ASTC_4x4_KHR;case On.ASTC_RGBA_5X4:return L2.COMPRESSED_RGBA_ASTC_5x4_KHR;case On.ASTC_RGBA_5X5:return L2.COMPRESSED_RGBA_ASTC_5x5_KHR;case On.ASTC_RGBA_6X5:return L2.COMPRESSED_RGBA_ASTC_6x5_KHR;case On.ASTC_RGBA_6X6:return L2.COMPRESSED_RGBA_ASTC_6x6_KHR;case On.ASTC_RGBA_8X5:return L2.COMPRESSED_RGBA_ASTC_8x5_KHR;case On.ASTC_RGBA_8X6:return L2.COMPRESSED_RGBA_ASTC_8x6_KHR;case On.ASTC_RGBA_8X8:return L2.COMPRESSED_RGBA_ASTC_8x8_KHR;case On.ASTC_RGBA_10X5:return L2.COMPRESSED_RGBA_ASTC_10x5_KHR;case On.ASTC_RGBA_10X6:return L2.COMPRESSED_RGBA_ASTC_10x6_KHR;case On.ASTC_RGBA_10X8:return L2.COMPRESSED_RGBA_ASTC_10x8_KHR;case On.ASTC_RGBA_10X10:return L2.COMPRESSED_RGBA_ASTC_10x10_KHR;case On.ASTC_RGBA_12X10:return L2.COMPRESSED_RGBA_ASTC_12x10_KHR;case On.ASTC_RGBA_12X12:return L2.COMPRESSED_RGBA_ASTC_12x12_KHR;case On.ASTC_SRGBA_4X4:return L2.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR;case On.ASTC_SRGBA_5X4:return L2.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR;case On.ASTC_SRGBA_5X5:return L2.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR;case On.ASTC_SRGBA_6X5:return L2.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR;case On.ASTC_SRGBA_6X6:return L2.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR;case On.ASTC_SRGBA_8X5:return L2.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR;case On.ASTC_SRGBA_8X6:return L2.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR;case On.ASTC_SRGBA_8X8:return L2.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR;case On.ASTC_SRGBA_10X5:return L2.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR;case On.ASTC_SRGBA_10X6:return L2.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR;case On.ASTC_SRGBA_10X8:return L2.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR;case On.ASTC_SRGBA_10X10:return L2.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR;case On.ASTC_SRGBA_12X10:return L2.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR;case On.ASTC_SRGBA_12X12:return L2.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR;default:return console.error("Unsupported Format, convert to WebGL format failed."),e.RGBA}}(e.format,i),e.glType=G2(e.format,i);var n=e.width,r=e.height;switch(e.type){case Ln.TEX2D:if(e.glTarget=i.TEXTURE_2D,e.isSwapchainTexture)break;var s=Math.max(n,r);if(s>t.capabilities.maxTextureSize&&K(9100,s,t.capabilities.maxTextureSize),t.textureExclusive[e.format]||t.extensions.WEBGL_depth_texture||!As[e.format].hasDepth){if(e.glTexture=i.createTexture(),e.size>0){var a=t.stateCache.glTexUnits[t.stateCache.texUnit];if(a.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_2D,e.glTexture),a.glTexture=e.glTexture),As[e.format].isCompressed)for(var o=0;o<e.mipLevel;++o){var u=Is(e.format,n,r,1),h=new Uint8Array(u);i.compressedTexImage2D(i.TEXTURE_2D,o,e.glInternalFmt,n,r,0,h),n=Math.max(1,n>>1),r=Math.max(1,r>>1)}else for(var l=0;l<e.mipLevel;++l)i.texImage2D(i.TEXTURE_2D,l,e.glInternalFmt,n,r,0,e.glFormat,e.glType,null),n=Math.max(1,n>>1),r=Math.max(1,r>>1);e.isPowerOf2?(e.glWrapS=i.REPEAT,e.glWrapT=i.REPEAT):(e.glWrapS=i.CLAMP_TO_EDGE,e.glWrapT=i.CLAMP_TO_EDGE),e.glMinFilter=i.LINEAR,e.glMagFilter=i.LINEAR,i.texParameteri(e.glTarget,i.TEXTURE_WRAP_S,e.glWrapS),i.texParameteri(e.glTarget,i.TEXTURE_WRAP_T,e.glWrapT),i.texParameteri(e.glTarget,i.TEXTURE_MIN_FILTER,e.glMinFilter),i.texParameteri(e.glTarget,i.TEXTURE_MAG_FILTER,e.glMagFilter)}}else e.glInternalFmt=function(t,e){switch(t){case On.R5G6B5:return e.RGB565;case On.RGB5A1:return e.RGB5_A1;case On.RGBA4:return e.RGBA4;case On.RGBA16F:return L2.RGBA16F_EXT;case On.RGBA32F:return L2.RGBA32F_EXT;case On.SRGB8_A8:return L2.SRGB8_ALPHA8_EXT;case On.DEPTH:return e.DEPTH_COMPONENT16;case On.DEPTH_STENCIL:return e.DEPTH_STENCIL;default:return console.error("Unsupported Format, convert to WebGL internal format failed."),e.RGBA}}(e.format,i),e.glRenderbuffer=i.createRenderbuffer(),e.size>0&&(t.stateCache.glRenderbuffer!==e.glRenderbuffer&&(i.bindRenderbuffer(i.RENDERBUFFER,e.glRenderbuffer),t.stateCache.glRenderbuffer=e.glRenderbuffer),i.renderbufferStorage(i.RENDERBUFFER,e.glInternalFmt,n,r));break;case Ln.CUBE:e.glTarget=i.TEXTURE_CUBE_MAP;var c=Math.max(n,r);if(c>t.capabilities.maxCubeMapTextureSize&&K(9100,c,t.capabilities.maxTextureSize),e.glTexture=i.createTexture(),e.size>0){var _=t.stateCache.glTexUnits[t.stateCache.texUnit];if(_.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_CUBE_MAP,e.glTexture),_.glTexture=e.glTexture),As[e.format].isCompressed)for(var f=0;f<6;++f){n=e.width,r=e.height;for(var d=0;d<e.mipLevel;++d){var p=Is(e.format,n,r,1),m=new Uint8Array(p);i.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+f,d,e.glInternalFmt,n,r,0,m),n=Math.max(1,n>>1),r=Math.max(1,r>>1)}}else for(var g=0;g<6;++g){n=e.width,r=e.height;for(var v=0;v<e.mipLevel;++v)i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+g,v,e.glInternalFmt,n,r,0,e.glFormat,e.glType,null),n=Math.max(1,n>>1),r=Math.max(1,r>>1)}e.isPowerOf2?(e.glWrapS=i.REPEAT,e.glWrapT=i.REPEAT):(e.glWrapS=i.CLAMP_TO_EDGE,e.glWrapT=i.CLAMP_TO_EDGE),e.glMinFilter=i.LINEAR,e.glMagFilter=i.LINEAR,i.texParameteri(e.glTarget,i.TEXTURE_WRAP_S,e.glWrapS),i.texParameteri(e.glTarget,i.TEXTURE_WRAP_T,e.glWrapT),i.texParameteri(e.glTarget,i.TEXTURE_MIN_FILTER,e.glMinFilter),i.texParameteri(e.glTarget,i.TEXTURE_MAG_FILTER,e.glMagFilter)}break;default:console.error("Unsupported TextureType, create texture failed."),e.type=Ln.TEX2D,e.glTarget=i.TEXTURE_2D}}(U2.instance,this._gpuTexture),U2.instance.memoryStatus.textureSize+=this._size,this._viewInfo.texture=this,this._viewInfo.type=t.type,this._viewInfo.format=t.format,this._viewInfo.baseLevel=0,this._viewInfo.levelCount=t.levelCount,this._viewInfo.baseLayer=0,this._viewInfo.layerCount=t.layerCount)},i.destroy=function(){!this._isTextureView&&this._gpuTexture&&(function(t,e){var i=t.gl;if(e.glTexture){var n=t.stateCache.glTexUnits,r=t.stateCache.texUnit;i.deleteTexture(e.glTexture);for(var s=0;s<n.length;s++)n[s].glTexture===e.glTexture&&(i.activeTexture(i.TEXTURE0+s),r=s,i.bindTexture(e.glTarget,null),n[s].glTexture=null);t.stateCache.texUnit=r,e.glTexture=null}if(e.glRenderbuffer){var a=t.stateCache.glRenderbuffer;i.deleteRenderbuffer(e.glRenderbuffer),a===e.glRenderbuffer&&(i.bindRenderbuffer(i.RENDERBUFFER,null),a=null),e.glRenderbuffer=null}}(U2.instance,this._gpuTexture),U2.instance.memoryStatus.textureSize-=this._size,this._gpuTexture=null)},i.resize=function(t,i){if(this._info.width!==t||this._info.height!==i){this._info.levelCount===e.getLevelCount(this._info.width,this._info.height)?this._info.levelCount=e.getLevelCount(t,i):this._info.levelCount>1&&(this._info.levelCount=Math.min(this._info.levelCount,e.getLevelCount(t,i)));var n=this._size;this._info.width=t,this._info.height=i,this._size=Os(this._info.format,this.width,this.height,this.depth,this._info.levelCount)*this._info.layerCount,!this._isTextureView&&this._gpuTexture&&(this._gpuTexture.width=t,this._gpuTexture.height=i,this._gpuTexture.size=this._size,function(t,e){if(e.size){var i=t.gl,n=e.width,r=e.height;switch(e.type){case Ln.TEX2D:e.glTarget=i.TEXTURE_2D;var s=Math.max(n,r);if(s>t.capabilities.maxTextureSize&&K(9100,s,t.capabilities.maxTextureSize),e.glRenderbuffer)t.stateCache.glRenderbuffer!==e.glRenderbuffer&&(i.bindRenderbuffer(i.RENDERBUFFER,e.glRenderbuffer),t.stateCache.glRenderbuffer=e.glRenderbuffer),i.renderbufferStorage(i.RENDERBUFFER,e.glInternalFmt,n,r);else if(e.glTexture){var a=t.stateCache.glTexUnits[t.stateCache.texUnit];if(a.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_2D,e.glTexture),a.glTexture=e.glTexture),As[e.format].isCompressed)for(var o=0;o<e.mipLevel;++o){var u=Is(e.format,n,r,1),h=new Uint8Array(u);i.compressedTexImage2D(i.TEXTURE_2D,o,e.glInternalFmt,n,r,0,h),n=Math.max(1,n>>1),r=Math.max(1,r>>1)}else for(var l=0;l<e.mipLevel;++l)i.texImage2D(i.TEXTURE_2D,l,e.glInternalFmt,n,r,0,e.glFormat,e.glType,null),n=Math.max(1,n>>1),r=Math.max(1,r>>1)}break;case Ln.CUBE:e.glTarget=i.TEXTURE_CUBE_MAP;var c=Math.max(n,r);c>t.capabilities.maxCubeMapTextureSize&&K(9100,c,t.capabilities.maxTextureSize);var _=t.stateCache.glTexUnits[t.stateCache.texUnit];if(_.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_CUBE_MAP,e.glTexture),_.glTexture=e.glTexture),As[e.format].isCompressed)for(var f=0;f<6;++f){n=e.width,r=e.height;for(var d=0;d<e.mipLevel;++d){var p=Is(e.format,n,r,1),m=new Uint8Array(p);i.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+f,d,e.glInternalFmt,n,r,0,m),n=Math.max(1,n>>1),r=Math.max(1,r>>1)}}else for(var g=0;g<6;++g){n=e.width,r=e.height;for(var v=0;v<e.mipLevel;++v)i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+g,v,e.glInternalFmt,n,r,0,e.glFormat,e.glType,null),n=Math.max(1,n>>1),r=Math.max(1,r>>1)}break;default:console.error("Unsupported TextureType, create texture failed."),e.type=Ln.TEX2D,e.glTarget=i.TEXTURE_2D}}}(U2.instance,this._gpuTexture),U2.instance.memoryStatus.textureSize-=n,U2.instance.memoryStatus.textureSize+=this._size)}},i.initAsSwapchainTexture=function(t){var e=new kr;e.format=t.format,e.usage=As[t.format].hasDepth?Fn.DEPTH_STENCIL_ATTACHMENT:Fn.COLOR_ATTACHMENT,e.width=t.width,e.height=t.height,this.initialize(e,!0)},h(e,[{key:"gpuTexture",get:function(){return this._gpuTexture}},{key:"lodLevel",get:function(){return this._lodLevel}}]),e}(ra),B3="webglcontextlost";function N3(t,e){for(var i=["","WEBKIT_","MOZ_"],n=0;n<i.length;++n){var r=t.getExtension(i[n]+e);if(r)return r}return null}function M3(t){var e={EXT_texture_filter_anisotropic:N3(t,"EXT_texture_filter_anisotropic"),EXT_blend_minmax:N3(t,"EXT_blend_minmax"),EXT_frag_depth:N3(t,"EXT_frag_depth"),EXT_shader_texture_lod:N3(t,"EXT_shader_texture_lod"),EXT_sRGB:N3(t,"EXT_sRGB"),OES_vertex_array_object:N3(t,"OES_vertex_array_object"),EXT_color_buffer_half_float:N3(t,"EXT_color_buffer_half_float"),WEBGL_color_buffer_float:N3(t,"WEBGL_color_buffer_float"),WEBGL_compressed_texture_etc1:N3(t,"WEBGL_compressed_texture_etc1"),WEBGL_compressed_texture_etc:N3(t,"WEBGL_compressed_texture_etc"),WEBGL_compressed_texture_pvrtc:N3(t,"WEBGL_compressed_texture_pvrtc"),WEBGL_compressed_texture_s3tc:N3(t,"WEBGL_compressed_texture_s3tc"),WEBGL_compressed_texture_s3tc_srgb:N3(t,"WEBGL_compressed_texture_s3tc_srgb"),WEBGL_debug_shaders:N3(t,"WEBGL_debug_shaders"),WEBGL_draw_buffers:N3(t,"WEBGL_draw_buffers"),WEBGL_lose_context:N3(t,"WEBGL_lose_context"),WEBGL_depth_texture:N3(t,"WEBGL_depth_texture"),OES_texture_half_float:N3(t,"OES_texture_half_float"),OES_texture_half_float_linear:N3(t,"OES_texture_half_float_linear"),OES_texture_float:N3(t,"OES_texture_float"),OES_texture_float_linear:N3(t,"OES_texture_float_linear"),OES_standard_derivatives:N3(t,"OES_standard_derivatives"),OES_element_index_uint:N3(t,"OES_element_index_uint"),ANGLE_instanced_arrays:N3(t,"ANGLE_instanced_arrays"),WEBGL_debug_renderer_info:N3(t,"WEBGL_debug_renderer_info"),WEBGL_multi_draw:null,WEBGL_compressed_texture_astc:null,destroyShadersImmediately:!0,noCompressedTexSubImage2D:!1,isLocationActive:function(t){return!!t},useVAO:!1};return Ha.os===Fa.IOS&&14===Ha.osMainVersion&&Ha.isBrowser||(e.WEBGL_compressed_texture_astc=N3(t,"WEBGL_compressed_texture_astc")),Ha.os!==Fa.ANDROID&&Ha.os!==Fa.IOS&&(e.WEBGL_multi_draw=N3(t,"WEBGL_multi_draw")),Ha.browserType===Na.UC&&(e.ANGLE_instanced_arrays=null),Ha.os===Fa.IOS&&Ha.osMainVersion<=10&&(e.destroyShadersImmediately=!1),e.OES_vertex_array_object&&(e.useVAO=!0),e}var L3=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).stateCache=new P3,e.cmdAllocator=new g3,e.nullTex2D=null,e.nullTexCube=null,e._canvas=null,e._webGLContextLostHandler=null,e._extensions=null,e}c(e,t);var i=e.prototype;return i.initialize=function(t){this._canvas=t.windowHandle,this._webGLContextLostHandler=this._onWebGLContextLost.bind(this),this._canvas.addEventListener(B3,this._onWebGLContextLost);var e=U2.instance.gl;this.stateCache.initialize(U2.instance.capabilities.maxTextureUnits,U2.instance.capabilities.maxVertexAttributes),this._extensions=M3(e),function(t){t.activeTexture(t.TEXTURE0),t.pixelStorei(t.PACK_ALIGNMENT,1),t.pixelStorei(t.UNPACK_ALIGNMENT,1),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,!1),t.bindFramebuffer(t.FRAMEBUFFER,null),t.enable(t.SCISSOR_TEST),t.enable(t.CULL_FACE),t.cullFace(t.BACK),t.frontFace(t.CCW),t.disable(t.POLYGON_OFFSET_FILL),t.polygonOffset(0,0),t.enable(t.DEPTH_TEST),t.depthMask(!0),t.depthFunc(t.LESS),t.depthRange(0,1),t.stencilFuncSeparate(t.FRONT,t.ALWAYS,1,65535),t.stencilOpSeparate(t.FRONT,t.KEEP,t.KEEP,t.KEEP),t.stencilMaskSeparate(t.FRONT,65535),t.stencilFuncSeparate(t.BACK,t.ALWAYS,1,65535),t.stencilOpSeparate(t.BACK,t.KEEP,t.KEEP,t.KEEP),t.stencilMaskSeparate(t.BACK,65535),t.disable(t.STENCIL_TEST),t.disable(t.SAMPLE_ALPHA_TO_COVERAGE),t.disable(t.BLEND),t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.ONE,t.ZERO,t.ONE,t.ZERO),t.colorMask(!0,!0,!0,!0),t.blendColor(0,0,0,0)}(e);var i=On.RGBA8,n=On.DEPTH_STENCIL,r=e.getParameter(e.DEPTH_BITS),s=e.getParameter(e.STENCIL_BITS);r&&s?n=On.DEPTH_STENCIL:r&&(n=On.DEPTH),this._colorTexture=new D3,this._colorTexture.initAsSwapchainTexture({swapchain:this,format:i,width:t.width,height:t.height}),this._depthStencilTexture=new D3,this._depthStencilTexture.initAsSwapchainTexture({swapchain:this,format:n,width:t.width,height:t.height}),this.nullTex2D=U2.instance.createTexture(new kr(Ln.TEX2D,Fn.SAMPLED,On.RGBA8,2,2,Un.GEN_MIPMAP)),this.nullTexCube=U2.instance.createTexture(new kr(Ln.CUBE,Fn.SAMPLED,On.RGBA8,2,2,Un.GEN_MIPMAP,6));var a=new Ir;a.texExtent.width=2,a.texExtent.height=2;var o=new Uint8Array(this.nullTex2D.size);o.fill(0),U2.instance.copyBuffersToTexture([o],this.nullTex2D,[a]),a.texSubres.layerCount=6,U2.instance.copyBuffersToTexture([o,o,o,o,o,o],this.nullTexCube,[a])},i.destroy=function(){this._canvas&&this._webGLContextLostHandler&&(this._canvas.removeEventListener(B3,this._webGLContextLostHandler),this._webGLContextLostHandler=null),this.nullTex2D&&(this.nullTex2D.destroy(),this.nullTex2D=null),this.nullTexCube&&(this.nullTexCube.destroy(),this.nullTexCube=null),this._extensions=null,this._canvas=null},i.resize=function(t,e){this._colorTexture.width===t&&this._colorTexture.height===e||(G("Resizing swapchain: "+t+"x"+e),this._canvas.width=t,this._canvas.height=e,this._colorTexture.resize(t,e),this._depthStencilTexture.resize(t,e))},i._onWebGLContextLost=function(t){j(11e3),L(t)},h(e,[{key:"extensions",get:function(){return this._extensions}}]),e}(Gs),F3=t("WebGLDevice",function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._swapchain=null,e._context=null,e._bindingMappings=null,e._textureExclusive=new Array(On.COUNT),e}c(e,t);var i=e.prototype;return i.initialize=function(t){U2.setInstance(this),this._gfxAPI=Cn.WEBGL;var e=this._bindingMappingInfo=t.bindingMappingInfo,i=[],n=[],r=e.setIndices[0];i[r]=0,n[r]=0;for(var s=1;s<e.setIndices.length;++s){var a=e.setIndices[s],o=e.setIndices[s-1];i[a]=e.maxBlockCounts[o]+i[o],n[a]=e.maxSamplerTextureCounts[o]+n[o]}for(var u=0;u<e.setIndices.length;++u){var h=e.setIndices[u];n[h]-=e.maxBlockCounts[h]}this._bindingMappings={blockOffsets:i,samplerTextureOffsets:n,flexibleSet:e.setIndices[e.setIndices.length-1]};var l=this._context=function(t){var e=null;try{var i={alpha:Ee.ENABLE_TRANSPARENT_CANVAS,antialias:Ee.ENABLE_WEBGL_ANTIALIAS,depth:!0,stencil:!0,premultipliedAlpha:!1,preserveDrawingBuffer:!1,powerPreference:"default",failIfMajorPerformanceCaveat:!1};e=t.getContext("webgl",i)}catch(t){return null}return e}(Us.canvas);if(!l)return console.error("This device does not support WebGL."),!1;this._queue=this.createQueue(new ms(ur.GRAPHICS)),this._cmdBuff=this.createCommandBuffer(new ps(this._queue)),this._caps.maxVertexAttributes=l.getParameter(l.MAX_VERTEX_ATTRIBS),this._caps.maxVertexUniformVectors=l.getParameter(l.MAX_VERTEX_UNIFORM_VECTORS),this._caps.maxFragmentUniformVectors=l.getParameter(l.MAX_FRAGMENT_UNIFORM_VECTORS),this._caps.maxTextureUnits=l.getParameter(l.MAX_TEXTURE_IMAGE_UNITS),this._caps.maxVertexTextureUnits=l.getParameter(l.MAX_VERTEX_TEXTURE_IMAGE_UNITS),this._caps.maxTextureSize=l.getParameter(l.MAX_TEXTURE_SIZE),this._caps.maxCubeMapTextureSize=l.getParameter(l.MAX_CUBE_MAP_TEXTURE_SIZE),this._caps.maxUniformBufferBindings=16;var c=l.getSupportedExtensions(),_="";if(c)for(var f,d=y(c);!(f=d()).done;)_+=f.value+" ";var p=M3(l);p.WEBGL_debug_renderer_info?(this._renderer=l.getParameter(p.WEBGL_debug_renderer_info.UNMASKED_RENDERER_WEBGL),this._vendor=l.getParameter(p.WEBGL_debug_renderer_info.UNMASKED_VENDOR_WEBGL)):(this._renderer=l.getParameter(l.RENDERER),this._vendor=l.getParameter(l.VENDOR));var m=l.getParameter(l.VERSION);this._features.fill(!1),this.initFormatFeatures(p),p.EXT_blend_minmax&&(this._features[In.BLEND_MINMAX]=!0),p.OES_element_index_uint&&(this._features[In.ELEMENT_INDEX_UINT]=!0),p.ANGLE_instanced_arrays&&(this._features[In.INSTANCED_ARRAYS]=!0),p.WEBGL_draw_buffers&&(this._features[In.MULTIPLE_RENDER_TARGETS]=!0);var g="";return this.getFormatFeatures(On.ETC_RGB8)&&(g+="etc1 "),this.getFormatFeatures(On.ETC2_RGB8)&&(g+="etc2 "),this.getFormatFeatures(On.BC1)&&(g+="dxt "),this.getFormatFeatures(On.PVRTC_RGB2)&&(g+="pvrtc "),this.getFormatFeatures(On.ASTC_RGBA_4X4)&&(g+="astc "),G("WebGL device initialized."),G("RENDERER: "+this._renderer),G("VENDOR: "+this._vendor),G("VERSION: "+m),G("COMPRESSED_FORMAT: "+g),G("EXTENSIONS: "+_),!0},i.destroy=function(){this._queue&&(this._queue.destroy(),this._queue=null),this._cmdBuff&&(this._cmdBuff.destroy(),this._cmdBuff=null),this._swapchain=null},i.flushCommands=function(){},i.acquire=function(){},i.present=function(){var t=this._queue;this._numDrawCalls=t.numDrawCalls,this._numInstances=t.numInstances,this._numTris=t.numTris,t.clear()},i.initFormatFeatures=function(t){this._formatFeatures.fill(Gn.NONE),this._textureExclusive.fill(!0);var e=Gn.RENDER_TARGET|Gn.SAMPLED_TEXTURE|Gn.LINEAR_FILTER;this._formatFeatures[On.RGB8]=e,this._formatFeatures[On.R5G6B5]=e,this._textureExclusive[On.R5G6B5]=!1,this._formatFeatures[On.RGBA8]=e,this._formatFeatures[On.RGBA4]=e,this._textureExclusive[On.RGBA4]=!1,this._formatFeatures[On.RGB5A1]=e,this._textureExclusive[On.RGB5A1]=!1,this._formatFeatures[On.DEPTH]=Gn.RENDER_TARGET,this._textureExclusive[On.DEPTH]=!1,this._formatFeatures[On.DEPTH_STENCIL]=Gn.RENDER_TARGET,this._textureExclusive[On.DEPTH_STENCIL]=!1,this._formatFeatures[On.R8I]|=Gn.VERTEX_ATTRIBUTE,this._formatFeatures[On.RG8I]|=Gn.VERTEX_ATTRIBUTE,this._formatFeatures[On.RGB8I]|=Gn.VERTEX_ATTRIBUTE,this._formatFeatures[On.RGBA8I]|=Gn.VERTEX_ATTRIBUTE,this._formatFeatures[On.R8UI]|=Gn.VERTEX_ATTRIBUTE,this._formatFeatures[On.RG8UI]|=Gn.VERTEX_ATTRIBUTE,this._formatFeatures[On.RGB8UI]|=Gn.VERTEX_ATTRIBUTE,this._formatFeatures[On.RGBA8UI]|=Gn.VERTEX_ATTRIBUTE,this._formatFeatures[On.R8I]|=Gn.VERTEX_ATTRIBUTE,this._formatFeatures[On.RG8I]|=Gn.VERTEX_ATTRIBUTE,this._formatFeatures[On.RGB8I]|=Gn.VERTEX_ATTRIBUTE,this._formatFeatures[On.RGBA8I]|=Gn.VERTEX_ATTRIBUTE,this._formatFeatures[On.R8UI]|=Gn.VERTEX_ATTRIBUTE,this._formatFeatures[On.RG8UI]|=Gn.VERTEX_ATTRIBUTE,this._formatFeatures[On.RGB8UI]|=Gn.VERTEX_ATTRIBUTE,this._formatFeatures[On.RGBA8UI]|=Gn.VERTEX_ATTRIBUTE,this._formatFeatures[On.R32F]|=Gn.VERTEX_ATTRIBUTE,this._formatFeatures[On.RG32F]|=Gn.VERTEX_ATTRIBUTE,this._formatFeatures[On.RGB32F]|=Gn.VERTEX_ATTRIBUTE,this._formatFeatures[On.RGBA32F]|=Gn.VERTEX_ATTRIBUTE,t.EXT_sRGB&&(this._formatFeatures[On.SRGB8]=e,this._formatFeatures[On.SRGB8_A8]=e,this._textureExclusive[On.SRGB8_A8]=!1),t.WEBGL_depth_texture&&(this._formatFeatures[On.DEPTH]|=e,this._formatFeatures[On.DEPTH_STENCIL]|=e),t.WEBGL_color_buffer_float&&(this._formatFeatures[On.RGB32F]|=Gn.RENDER_TARGET,this._formatFeatures[On.RGBA32F]|=Gn.RENDER_TARGET,this._textureExclusive[On.RGB32F]=!1,this._textureExclusive[On.RGBA32F]=!1),t.EXT_color_buffer_half_float&&(this._formatFeatures[On.RGB16F]|=Gn.RENDER_TARGET,this._formatFeatures[On.RGBA16F]|=Gn.RENDER_TARGET,this._textureExclusive[On.RGB16F]=!1,this._textureExclusive[On.RGBA16F]=!1),t.OES_texture_float&&(this._formatFeatures[On.RGB32F]|=Gn.RENDER_TARGET|Gn.SAMPLED_TEXTURE,this._formatFeatures[On.RGBA32F]|=Gn.RENDER_TARGET|Gn.SAMPLED_TEXTURE),t.OES_texture_half_float&&(this._formatFeatures[On.RGB16F]|=Gn.RENDER_TARGET|Gn.SAMPLED_TEXTURE,this._formatFeatures[On.RGBA16F]|=Gn.RENDER_TARGET|Gn.SAMPLED_TEXTURE),t.OES_texture_float_linear&&(this._formatFeatures[On.RGB32F]|=Gn.LINEAR_FILTER,this._formatFeatures[On.RGBA32F]|=Gn.LINEAR_FILTER),t.OES_texture_half_float_linear&&(this._formatFeatures[On.RGB16F]|=Gn.LINEAR_FILTER,this._formatFeatures[On.RGBA16F]|=Gn.LINEAR_FILTER);var i=Gn.SAMPLED_TEXTURE|Gn.LINEAR_FILTER;t.WEBGL_compressed_texture_etc1&&(this._formatFeatures[On.ETC_RGB8]=i),t.WEBGL_compressed_texture_etc&&(this._formatFeatures[On.ETC2_RGB8]=i,this._formatFeatures[On.ETC2_RGBA8]=i,this._formatFeatures[On.ETC2_SRGB8]=i,this._formatFeatures[On.ETC2_SRGB8_A8]=i,this._formatFeatures[On.ETC2_RGB8_A1]=i,this._formatFeatures[On.ETC2_SRGB8_A1]=i),t.WEBGL_compressed_texture_s3tc&&(this._formatFeatures[On.BC1]=i,this._formatFeatures[On.BC1_ALPHA]=i,this._formatFeatures[On.BC1_SRGB]=i,this._formatFeatures[On.BC1_SRGB_ALPHA]=i,this._formatFeatures[On.BC2]=i,this._formatFeatures[On.BC2_SRGB]=i,this._formatFeatures[On.BC3]=i,this._formatFeatures[On.BC3_SRGB]=i),t.WEBGL_compressed_texture_pvrtc&&(this._formatFeatures[On.PVRTC_RGB2]|=i,this._formatFeatures[On.PVRTC_RGBA2]|=i,this._formatFeatures[On.PVRTC_RGB4]|=i,this._formatFeatures[On.PVRTC_RGBA4]|=i),t.WEBGL_compressed_texture_astc&&(this._formatFeatures[On.ASTC_RGBA_4X4]|=i,this._formatFeatures[On.ASTC_RGBA_5X4]|=i,this._formatFeatures[On.ASTC_RGBA_5X5]|=i,this._formatFeatures[On.ASTC_RGBA_6X5]|=i,this._formatFeatures[On.ASTC_RGBA_6X6]|=i,this._formatFeatures[On.ASTC_RGBA_8X5]|=i,this._formatFeatures[On.ASTC_RGBA_8X6]|=i,this._formatFeatures[On.ASTC_RGBA_8X8]|=i,this._formatFeatures[On.ASTC_RGBA_10X5]|=i,this._formatFeatures[On.ASTC_RGBA_10X6]|=i,this._formatFeatures[On.ASTC_RGBA_10X8]|=i,this._formatFeatures[On.ASTC_RGBA_10X10]|=i,this._formatFeatures[On.ASTC_RGBA_12X10]|=i,this._formatFeatures[On.ASTC_RGBA_12X12]|=i,this._formatFeatures[On.ASTC_SRGBA_4X4]|=i,this._formatFeatures[On.ASTC_SRGBA_5X4]|=i,this._formatFeatures[On.ASTC_SRGBA_5X5]|=i,this._formatFeatures[On.ASTC_SRGBA_6X5]|=i,this._formatFeatures[On.ASTC_SRGBA_6X6]|=i,this._formatFeatures[On.ASTC_SRGBA_8X5]|=i,this._formatFeatures[On.ASTC_SRGBA_8X6]|=i,this._formatFeatures[On.ASTC_SRGBA_8X8]|=i,this._formatFeatures[On.ASTC_SRGBA_10X5]|=i,this._formatFeatures[On.ASTC_SRGBA_10X6]|=i,this._formatFeatures[On.ASTC_SRGBA_10X8]|=i,this._formatFeatures[On.ASTC_SRGBA_10X10]|=i,this._formatFeatures[On.ASTC_SRGBA_12X10]|=i,this._formatFeatures[On.ASTC_SRGBA_12X12]|=i)},i.createCommandBuffer=function(t){var e=new(t.type===lr.PRIMARY?b3:v3);return e.initialize(t),e},i.createSwapchain=function(t){var e=new L3;return this._swapchain=e,e.initialize(t),e},i.createBuffer=function(t){var e=new p3;return e.initialize(t),e},i.createTexture=function(t){var e=new D3;return e.initialize(t),e},i.createDescriptorSet=function(t){var e=new F2;return e.initialize(t),e},i.createShader=function(t){var e=new x3;return e.initialize(t),e},i.createInputAssembler=function(t){var e=new E3;return e.initialize(t),e},i.createRenderPass=function(t){var e=new w3;return e.initialize(t),e},i.createFramebuffer=function(t){var e=new y3;return e.initialize(t),e},i.createDescriptorSetLayout=function(t){var e=new T3;return e.initialize(t),e},i.createPipelineLayout=function(t){var e=new S3;return e.initialize(t),e},i.createPipelineState=function(t){var e=new R3;return e.initialize(t),e},i.createQueue=function(t){var e=new C3;return e.initialize(t),e},i.getSampler=function(t){var e=ia.computeHash(t);return this._samplers.has(e)||this._samplers.set(e,new O3(t,e)),this._samplers.get(e)},i.getSwapchains=function(){return[this._swapchain]},i.getGeneralBarrier=function(t){var e=sa.computeHash(t);return this._generalBarrierss.has(e)||this._generalBarrierss.set(e,new sa(t,e)),this._generalBarrierss.get(e)},i.getTextureBarrier=function(t){var e=aa.computeHash(t);return this._textureBarriers.has(e)||this._textureBarriers.set(e,new aa(t,e)),this._textureBarriers.get(e)},i.getBufferBarrier=function(t){var e=oa.computeHash(t);return this._bufferBarriers.has(e)||this._bufferBarriers.set(e,new oa(t,e)),this._bufferBarriers.get(e)},i.copyBuffersToTexture=function(t,e,i){f3(this,t,e.gpuTexture,i)},i.copyTextureToBuffers=function(t,e,i){!function(t,e,i,n){var r=t.gl,s=t.stateCache,a=r.createFramebuffer();r.bindFramebuffer(r.FRAMEBUFFER,a);var o=0,u=0,h=1,l=1;switch(e.glTarget){case r.TEXTURE_2D:for(var c=0;c<n.length;c++){var _=n[c];r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,e.glTarget,e.glTexture,_.texSubres.mipLevel),o=_.texOffset.x,u=_.texOffset.y,h=_.texExtent.width,l=_.texExtent.height,r.readPixels(o,u,h,l,e.glFormat,e.glType,i[c])}break;default:console.error("Unsupported GL texture type, copy texture to buffers failed.")}r.bindFramebuffer(r.FRAMEBUFFER,null),s.glFramebuffer=null,r.deleteFramebuffer(a)}(this,t.gpuTexture,e,i)},i.copyTexImagesToTexture=function(t,e,i){!function(t,e,i,n){var r=t.gl,s=t.stateCache.glTexUnits[t.stateCache.texUnit];s.glTexture!==i.glTexture&&(r.bindTexture(i.glTarget,i.glTexture),s.glTexture=i.glTexture);var a=0,o=0;switch(i.glTarget){case r.TEXTURE_2D:for(var u=0;u<n.length;u++){var h=n[u];r.texSubImage2D(r.TEXTURE_2D,h.texSubres.mipLevel,h.texOffset.x,h.texOffset.y,i.glFormat,i.glType,e[a++])}break;case r.TEXTURE_CUBE_MAP:for(var l=0;l<n.length;l++){var c=n[l],_=c.texSubres.baseArrayLayer+c.texSubres.layerCount;for(o=c.texSubres.baseArrayLayer;o<_;++o)r.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+o,c.texSubres.mipLevel,c.texOffset.x,c.texOffset.y,i.glFormat,i.glType,e[a++])}break;default:console.error("Unsupported GL texture type, copy buffer to texture failed.")}i.flags&Un.GEN_MIPMAP&&i.isPowerOf2&&r.generateMipmap(i.glTarget)}(this,t,e.gpuTexture,i)},h(e,[{key:"gl",get:function(){return this._context}},{key:"extensions",get:function(){return this._swapchain.extensions}},{key:"stateCache",get:function(){return this._swapchain.stateCache}},{key:"nullTex2D",get:function(){return this._swapchain.nullTex2D}},{key:"nullTexCube",get:function(){return this._swapchain.nullTexCube}},{key:"textureExclusive",get:function(){return this._textureExclusive}},{key:"bindingMappings",get:function(){return this._bindingMappings}}]),e}(Us));b.WebGLDevice=F3;var U3,G3=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._gpuDescriptorSet=null,e}c(e,t);var i=e.prototype;return i.initialize=function(t){this._layout=t.layout;var e=t.layout.gpuDescriptorSetLayout,i=e.bindings,n=e.descriptorIndices,r=e.descriptorCount;this._buffers=Array(r).fill(null),this._textures=Array(r).fill(null),this._samplers=Array(r).fill(null);var s=[];this._gpuDescriptorSet={gpuDescriptors:s,descriptorIndices:n};for(var a=0;a<i.length;++a)for(var o=i[a],u=0;u<o.count;u++)s.push({type:o.descriptorType,gpuBuffer:null,gpuTextureView:null,gpuSampler:null})},i.destroy=function(){this._layout=null,this._gpuDescriptorSet=null},i.update=function(){if(this._isDirty&&this._gpuDescriptorSet){for(var t=this._gpuDescriptorSet.gpuDescriptors,e=0;e<t.length;++e)t[e].type&Rs?this._buffers[e]&&(t[e].gpuBuffer=this._buffers[e].gpuBuffer):t[e].type&bs&&(this._textures[e]&&(t[e].gpuTextureView=this._textures[e].gpuTextureView),this._samplers[e]&&(t[e].gpuSampler=this._samplers[e].gpuSampler));this._isDirty=!1}},h(e,[{key:"gpuDescriptorSet",get:function(){return this._gpuDescriptorSet}}]),e}(Xs);!function(t){t[t.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",t[t.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",t[t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",t[t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",t[t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",t[t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",t[t.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",t[t.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",t[t.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",t[t.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",t[t.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",t[t.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",t[t.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",t[t.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",t[t.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",t[t.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",t[t.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",t[t.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",t[t.COMPRESSED_RGBA_ASTC_5x4_KHR=37809]="COMPRESSED_RGBA_ASTC_5x4_KHR",t[t.COMPRESSED_RGBA_ASTC_5x5_KHR=37810]="COMPRESSED_RGBA_ASTC_5x5_KHR",t[t.COMPRESSED_RGBA_ASTC_6x5_KHR=37811]="COMPRESSED_RGBA_ASTC_6x5_KHR",t[t.COMPRESSED_RGBA_ASTC_6x6_KHR=37812]="COMPRESSED_RGBA_ASTC_6x6_KHR",t[t.COMPRESSED_RGBA_ASTC_8x5_KHR=37813]="COMPRESSED_RGBA_ASTC_8x5_KHR",t[t.COMPRESSED_RGBA_ASTC_8x6_KHR=37814]="COMPRESSED_RGBA_ASTC_8x6_KHR",t[t.COMPRESSED_RGBA_ASTC_8x8_KHR=37815]="COMPRESSED_RGBA_ASTC_8x8_KHR",t[t.COMPRESSED_RGBA_ASTC_10x5_KHR=37816]="COMPRESSED_RGBA_ASTC_10x5_KHR",t[t.COMPRESSED_RGBA_ASTC_10x6_KHR=37817]="COMPRESSED_RGBA_ASTC_10x6_KHR",t[t.COMPRESSED_RGBA_ASTC_10x8_KHR=37818]="COMPRESSED_RGBA_ASTC_10x8_KHR",t[t.COMPRESSED_RGBA_ASTC_10x10_KHR=37819]="COMPRESSED_RGBA_ASTC_10x10_KHR",t[t.COMPRESSED_RGBA_ASTC_12x10_KHR=37820]="COMPRESSED_RGBA_ASTC_12x10_KHR",t[t.COMPRESSED_RGBA_ASTC_12x12_KHR=37821]="COMPRESSED_RGBA_ASTC_12x12_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=37840]="COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR=37841]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR=37842]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR=37843]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR=37844]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR=37845]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR=37846]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR=37847]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR=37848]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR=37849]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR=37850]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR=37851]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR=37852]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR=37853]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR"}(U3||(U3={}));var k3=function(){function t(){}return t.setInstance=function(e){t._instance=e},h(t,null,[{key:"instance",get:function(){return t._instance}}]),t}();k3._instance=null;var z3=[10497,33648,33071,33071],H3=new Float32Array(4);function V3(t,e){switch(t){case On.R8:return e.UNSIGNED_BYTE;case On.R8SN:return e.BYTE;case On.R8UI:return e.UNSIGNED_BYTE;case On.R8I:return e.BYTE;case On.R16F:return e.HALF_FLOAT;case On.R16UI:return e.UNSIGNED_SHORT;case On.R16I:return e.SHORT;case On.R32F:return e.FLOAT;case On.R32UI:return e.UNSIGNED_INT;case On.R32I:return e.INT;case On.RG8:return e.UNSIGNED_BYTE;case On.RG8SN:return e.BYTE;case On.RG8UI:return e.UNSIGNED_BYTE;case On.RG8I:return e.BYTE;case On.RG16F:return e.HALF_FLOAT;case On.RG16UI:return e.UNSIGNED_SHORT;case On.RG16I:return e.SHORT;case On.RG32F:return e.FLOAT;case On.RG32UI:return e.UNSIGNED_INT;case On.RG32I:return e.INT;case On.RGB8:case On.SRGB8:return e.UNSIGNED_BYTE;case On.RGB8SN:return e.BYTE;case On.RGB8UI:return e.UNSIGNED_BYTE;case On.RGB8I:return e.BYTE;case On.RGB16F:return e.HALF_FLOAT;case On.RGB16UI:return e.UNSIGNED_SHORT;case On.RGB16I:return e.SHORT;case On.RGB32F:return e.FLOAT;case On.RGB32UI:return e.UNSIGNED_INT;case On.RGB32I:return e.INT;case On.BGRA8:case On.RGBA8:case On.SRGB8_A8:return e.UNSIGNED_BYTE;case On.RGBA8SN:return e.BYTE;case On.RGBA8UI:return e.UNSIGNED_BYTE;case On.RGBA8I:return e.BYTE;case On.RGBA16F:return e.HALF_FLOAT;case On.RGBA16UI:return e.UNSIGNED_SHORT;case On.RGBA16I:return e.SHORT;case On.RGBA32F:return e.FLOAT;case On.RGBA32UI:return e.UNSIGNED_INT;case On.RGBA32I:return e.INT;case On.R5G6B5:return e.UNSIGNED_SHORT_5_6_5;case On.R11G11B10F:return e.UNSIGNED_INT_10F_11F_11F_REV;case On.RGB5A1:return e.UNSIGNED_SHORT_5_5_5_1;case On.RGBA4:return e.UNSIGNED_SHORT_4_4_4_4;case On.RGB10A2:case On.RGB10A2UI:return e.UNSIGNED_INT_2_10_10_10_REV;case On.RGB9E5:case On.DEPTH:return e.FLOAT;case On.DEPTH_STENCIL:return e.UNSIGNED_INT_24_8;case On.BC1:case On.BC1_SRGB:case On.BC2:case On.BC2_SRGB:case On.BC3:case On.BC3_SRGB:case On.BC4:return e.UNSIGNED_BYTE;case On.BC4_SNORM:return e.BYTE;case On.BC5:return e.UNSIGNED_BYTE;case On.BC5_SNORM:return e.BYTE;case On.BC6H_SF16:case On.BC6H_UF16:return e.FLOAT;case On.BC7:case On.BC7_SRGB:case On.ETC_RGB8:case On.ETC2_RGB8:case On.ETC2_SRGB8:case On.ETC2_RGB8_A1:case On.ETC2_SRGB8_A1:case On.EAC_R11:return e.UNSIGNED_BYTE;case On.EAC_R11SN:return e.BYTE;case On.EAC_RG11:return e.UNSIGNED_BYTE;case On.EAC_RG11SN:return e.BYTE;case On.PVRTC_RGB2:case On.PVRTC_RGBA2:case On.PVRTC_RGB4:case On.PVRTC_RGBA4:case On.PVRTC2_2BPP:case On.PVRTC2_4BPP:return e.UNSIGNED_BYTE;case On.ASTC_RGBA_4X4:case On.ASTC_RGBA_5X4:case On.ASTC_RGBA_5X5:case On.ASTC_RGBA_6X5:case On.ASTC_RGBA_6X6:case On.ASTC_RGBA_8X5:case On.ASTC_RGBA_8X6:case On.ASTC_RGBA_8X8:case On.ASTC_RGBA_10X5:case On.ASTC_RGBA_10X6:case On.ASTC_RGBA_10X8:case On.ASTC_RGBA_10X10:case On.ASTC_RGBA_12X10:case On.ASTC_RGBA_12X12:case On.ASTC_SRGBA_4X4:case On.ASTC_SRGBA_5X4:case On.ASTC_SRGBA_5X5:case On.ASTC_SRGBA_6X5:case On.ASTC_SRGBA_6X6:case On.ASTC_SRGBA_8X5:case On.ASTC_SRGBA_8X6:case On.ASTC_SRGBA_8X8:case On.ASTC_SRGBA_10X5:case On.ASTC_SRGBA_10X6:case On.ASTC_SRGBA_10X8:case On.ASTC_SRGBA_10X10:case On.ASTC_SRGBA_12X10:case On.ASTC_SRGBA_12X12:default:return e.UNSIGNED_BYTE}}function W3(t,e){switch(t){case Pn.BOOL:return e.BOOL;case Pn.BOOL2:return e.BOOL_VEC2;case Pn.BOOL3:return e.BOOL_VEC3;case Pn.BOOL4:return e.BOOL_VEC4;case Pn.INT:return e.INT;case Pn.INT2:return e.INT_VEC2;case Pn.INT3:return e.INT_VEC3;case Pn.INT4:return e.INT_VEC4;case Pn.UINT:return e.UNSIGNED_INT;case Pn.FLOAT:return e.FLOAT;case Pn.FLOAT2:return e.FLOAT_VEC2;case Pn.FLOAT3:return e.FLOAT_VEC3;case Pn.FLOAT4:return e.FLOAT_VEC4;case Pn.MAT2:return e.FLOAT_MAT2;case Pn.MAT2X3:return e.FLOAT_MAT2x3;case Pn.MAT2X4:return e.FLOAT_MAT2x4;case Pn.MAT3X2:return e.FLOAT_MAT3x2;case Pn.MAT3:return e.FLOAT_MAT3;case Pn.MAT3X4:return e.FLOAT_MAT3x4;case Pn.MAT4X2:return e.FLOAT_MAT4x2;case Pn.MAT4X3:return e.FLOAT_MAT4x3;case Pn.MAT4:return e.FLOAT_MAT4;case Pn.SAMPLER2D:return e.SAMPLER_2D;case Pn.SAMPLER2D_ARRAY:return e.SAMPLER_2D_ARRAY;case Pn.SAMPLER3D:return e.SAMPLER_3D;case Pn.SAMPLER_CUBE:return e.SAMPLER_CUBE;default:return console.error("Unsupported GLType, convert to GL type failed."),Pn.UNKNOWN}}function X3(t,e){switch(t){case e.BOOL:return Pn.BOOL;case e.BOOL_VEC2:return Pn.BOOL2;case e.BOOL_VEC3:return Pn.BOOL3;case e.BOOL_VEC4:return Pn.BOOL4;case e.INT:return Pn.INT;case e.INT_VEC2:return Pn.INT2;case e.INT_VEC3:return Pn.INT3;case e.INT_VEC4:return Pn.INT4;case e.UNSIGNED_INT:return Pn.UINT;case e.UNSIGNED_INT_VEC2:return Pn.UINT2;case e.UNSIGNED_INT_VEC3:return Pn.UINT3;case e.UNSIGNED_INT_VEC4:return Pn.UINT4;case e.FLOAT:return Pn.FLOAT;case e.FLOAT_VEC2:return Pn.FLOAT2;case e.FLOAT_VEC3:return Pn.FLOAT3;case e.FLOAT_VEC4:return Pn.FLOAT4;case e.FLOAT_MAT2:return Pn.MAT2;case e.FLOAT_MAT2x3:return Pn.MAT2X3;case e.FLOAT_MAT2x4:return Pn.MAT2X4;case e.FLOAT_MAT3x2:return Pn.MAT3X2;case e.FLOAT_MAT3:return Pn.MAT3;case e.FLOAT_MAT3x4:return Pn.MAT3X4;case e.FLOAT_MAT4x2:return Pn.MAT4X2;case e.FLOAT_MAT4x3:return Pn.MAT4X3;case e.FLOAT_MAT4:return Pn.MAT4;case e.SAMPLER_2D:return Pn.SAMPLER2D;case e.SAMPLER_2D_ARRAY:return Pn.SAMPLER2D_ARRAY;case e.SAMPLER_3D:return Pn.SAMPLER3D;case e.SAMPLER_CUBE:return Pn.SAMPLER_CUBE;default:return console.error("Unsupported GLType, convert to Type failed."),Pn.UNKNOWN}}function j3(t,e){switch(t){case e.BOOL:return 4;case e.BOOL_VEC2:return 8;case e.BOOL_VEC3:return 12;case e.BOOL_VEC4:return 16;case e.INT:return 4;case e.INT_VEC2:return 8;case e.INT_VEC3:return 12;case e.INT_VEC4:return 16;case e.UNSIGNED_INT:return 4;case e.UNSIGNED_INT_VEC2:return 8;case e.UNSIGNED_INT_VEC3:return 12;case e.UNSIGNED_INT_VEC4:return 16;case e.FLOAT:return 4;case e.FLOAT_VEC2:return 8;case e.FLOAT_VEC3:return 12;case e.FLOAT_VEC4:case e.FLOAT_MAT2:return 16;case e.FLOAT_MAT2x3:return 24;case e.FLOAT_MAT2x4:return 32;case e.FLOAT_MAT3x2:return 24;case e.FLOAT_MAT3:return 36;case e.FLOAT_MAT3x4:return 48;case e.FLOAT_MAT4x2:return 32;case e.FLOAT_MAT4x3:return 48;case e.FLOAT_MAT4:return 64;case e.SAMPLER_2D:case e.SAMPLER_2D_ARRAY:case e.SAMPLER_2D_ARRAY_SHADOW:case e.SAMPLER_3D:case e.SAMPLER_CUBE:case e.INT_SAMPLER_2D:case e.INT_SAMPLER_2D_ARRAY:case e.INT_SAMPLER_3D:case e.INT_SAMPLER_CUBE:case e.UNSIGNED_INT_SAMPLER_2D:case e.UNSIGNED_INT_SAMPLER_2D_ARRAY:case e.UNSIGNED_INT_SAMPLER_3D:case e.UNSIGNED_INT_SAMPLER_CUBE:return 4;default:return console.error("Unsupported GLType, get type failed."),0}}function Y3(t,e){switch(t){case e.FLOAT_MAT2:case e.FLOAT_MAT2x3:case e.FLOAT_MAT2x4:return 2;case e.FLOAT_MAT3x2:case e.FLOAT_MAT3:case e.FLOAT_MAT3x4:return 3;case e.FLOAT_MAT4x2:case e.FLOAT_MAT4x3:case e.FLOAT_MAT4:return 4;default:return 1}}var K3,q3=[512,513,514,515,516,517,518,519],Q3=[0,7680,7681,7682,7683,5386,34055,34056],Z3=[32774,32778,32779,32775,32776],J3=[0,1,770,772,771,773,768,774,769,775,776,32769,32770,32771,32772];!function(t){t[t.BEGIN_RENDER_PASS=0]="BEGIN_RENDER_PASS",t[t.END_RENDER_PASS=1]="END_RENDER_PASS",t[t.BIND_STATES=2]="BIND_STATES",t[t.DRAW=3]="DRAW",t[t.UPDATE_BUFFER=4]="UPDATE_BUFFER",t[t.COPY_BUFFER_TO_TEXTURE=5]="COPY_BUFFER_TO_TEXTURE",t[t.COUNT=6]="COUNT"}(K3||(K3={}));var $3=function(t){this.cmdType=void 0,this.refCount=0,this.cmdType=t},t4=function(t){function e(){var e;return(e=t.call(this,K3.BEGIN_RENDER_PASS)||this).gpuRenderPass=null,e.gpuFramebuffer=null,e.renderArea=new Sr,e.clearColors=[],e.clearDepth=1,e.clearStencil=0,e}return c(e,t),e.prototype.clear=function(){this.gpuFramebuffer=null,this.clearColors.length=0},e}($3),e4=function(t){function e(){var e;return(e=t.call(this,K3.BIND_STATES)||this).gpuPipelineState=null,e.gpuInputAssembler=null,e.gpuDescriptorSets=[],e.dynamicOffsets=[],e.dynamicStates=new Ts,e}return c(e,t),e.prototype.clear=function(){this.gpuPipelineState=null,this.gpuInputAssembler=null,this.gpuDescriptorSets.length=0,this.dynamicOffsets.length=0},e}($3),i4=function(t){function e(){var e;return(e=t.call(this,K3.DRAW)||this).drawInfo=new Fr,e}return c(e,t),e.prototype.clear=function(){},e}($3),n4=function(t){function e(){var e;return(e=t.call(this,K3.UPDATE_BUFFER)||this).gpuBuffer=null,e.buffer=null,e.offset=0,e.size=0,e}return c(e,t),e.prototype.clear=function(){this.gpuBuffer=null,this.buffer=null},e}($3),r4=function(t){function e(){var e;return(e=t.call(this,K3.COPY_BUFFER_TO_TEXTURE)||this).gpuTexture=null,e.buffers=[],e.regions=[],e}return c(e,t),e.prototype.clear=function(){this.gpuTexture=null,this.buffers.length=0,this.regions.length=0},e}($3),s4=function(){function t(){this.cmds=new ma(1),this.beginRenderPassCmds=new ma(1),this.bindStatesCmds=new ma(1),this.drawCmds=new ma(1),this.updateBufferCmds=new ma(1),this.copyBufferToTextureCmds=new ma(1)}return t.prototype.clearCmds=function(t){this.beginRenderPassCmds.length&&(t.beginRenderPassCmdPool.freeCmds(this.beginRenderPassCmds),this.beginRenderPassCmds.clear()),this.bindStatesCmds.length&&(t.bindStatesCmdPool.freeCmds(this.bindStatesCmds),this.bindStatesCmds.clear()),this.drawCmds.length&&(t.drawCmdPool.freeCmds(this.drawCmds),this.drawCmds.clear()),this.updateBufferCmds.length&&(t.updateBufferCmdPool.freeCmds(this.updateBufferCmds),this.updateBufferCmds.clear()),this.copyBufferToTextureCmds.length&&(t.copyBufferToTextureCmdPool.freeCmds(this.copyBufferToTextureCmds),this.copyBufferToTextureCmds.clear()),this.cmds.clear()},t}();function a4(t,e,i,n,r){if(e.usage&Dn.INDIRECT){e.indirects.clearDraws();for(var s=i.drawInfos,a=0;a<s.length;++a)e.indirects.setDrawInfo(n+a,s[a])}else{var o=i,u=t.gl,h=t.stateCache;switch(e.glTarget){case u.ARRAY_BUFFER:t.extensions.useVAO&&h.glVAO&&(u.bindVertexArray(null),h.glVAO=null),h4.gpuInputAssembler=null,h.glArrayBuffer!==e.glBuffer&&(u.bindBuffer(u.ARRAY_BUFFER,e.glBuffer),h.glArrayBuffer=e.glBuffer),r===o.byteLength?u.bufferSubData(e.glTarget,n,o):u.bufferSubData(e.glTarget,n,o.slice(0,r));break;case u.ELEMENT_ARRAY_BUFFER:t.extensions.useVAO&&h.glVAO&&(u.bindVertexArray(null),h.glVAO=null),h4.gpuInputAssembler=null,h.glElementArrayBuffer!==e.glBuffer&&(u.bindBuffer(u.ELEMENT_ARRAY_BUFFER,e.glBuffer),h.glElementArrayBuffer=e.glBuffer),r===o.byteLength?u.bufferSubData(e.glTarget,n,o):u.bufferSubData(e.glTarget,n,o.slice(0,r));break;case u.UNIFORM_BUFFER:h.glUniformBuffer!==e.glBuffer&&(u.bindBuffer(u.UNIFORM_BUFFER,e.glBuffer),h.glUniformBuffer=e.glBuffer),r===o.byteLength?u.bufferSubData(e.glTarget,n,o):u.bufferSubData(e.glTarget,n,new Float32Array(o,0,r/4));break;default:console.error("Unsupported BufferType, update buffer failed.")}}}function o4(t,e){var i=t.gl;e.glInternalFmt=function(t,e){switch(t){case On.A8:return e.ALPHA;case On.L8:return e.LUMINANCE;case On.LA8:return e.LUMINANCE_ALPHA;case On.R8:return e.R8;case On.R8SN:return e.R8_SNORM;case On.R8UI:return e.R8UI;case On.R8I:return e.R8I;case On.RG8:return e.RG8;case On.RG8SN:return e.RG8_SNORM;case On.RG8UI:return e.RG8UI;case On.RG8I:return e.RG8I;case On.RGB8:return e.RGB8;case On.RGB8SN:return e.RGB8_SNORM;case On.RGB8UI:return e.RGB8UI;case On.RGB8I:return e.RGB8I;case On.BGRA8:case On.RGBA8:return e.RGBA8;case On.RGBA8SN:return e.RGBA8_SNORM;case On.RGBA8UI:return e.RGBA8UI;case On.RGBA8I:return e.RGBA8I;case On.R16I:return e.R16I;case On.R16UI:return e.R16UI;case On.R16F:return e.R16F;case On.RG16I:return e.RG16I;case On.RG16UI:return e.RG16UI;case On.RG16F:return e.RG16F;case On.RGB16I:return e.RGB16I;case On.RGB16UI:return e.RGB16UI;case On.RGB16F:return e.RGB16F;case On.RGBA16I:return e.RGBA16I;case On.RGBA16UI:return e.RGBA16UI;case On.RGBA16F:return e.RGBA16F;case On.R32I:return e.R32I;case On.R32UI:return e.R32UI;case On.R32F:return e.R32F;case On.RG32I:return e.RG32I;case On.RG32UI:return e.RG32UI;case On.RG32F:return e.RG32F;case On.RGB32I:return e.RGB32I;case On.RGB32UI:return e.RGB32UI;case On.RGB32F:return e.RGB32F;case On.RGBA32I:return e.RGBA32I;case On.RGBA32UI:return e.RGBA32UI;case On.RGBA32F:return e.RGBA32F;case On.R5G6B5:return e.RGB565;case On.RGB5A1:return e.RGB5_A1;case On.RGBA4:return e.RGBA4;case On.SRGB8:return e.SRGB8;case On.SRGB8_A8:return e.SRGB8_ALPHA8;case On.RGB10A2:return e.RGB10_A2;case On.RGB10A2UI:return e.RGB10_A2UI;case On.R11G11B10F:return e.R11F_G11F_B10F;case On.DEPTH:return e.DEPTH_COMPONENT32F;case On.DEPTH_STENCIL:return e.DEPTH24_STENCIL8;case On.BC1:return U3.COMPRESSED_RGB_S3TC_DXT1_EXT;case On.BC1_ALPHA:return U3.COMPRESSED_RGBA_S3TC_DXT1_EXT;case On.BC1_SRGB:return U3.COMPRESSED_SRGB_S3TC_DXT1_EXT;case On.BC1_SRGB_ALPHA:return U3.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;case On.BC2:return U3.COMPRESSED_RGBA_S3TC_DXT3_EXT;case On.BC2_SRGB:return U3.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;case On.BC3:return U3.COMPRESSED_RGBA_S3TC_DXT5_EXT;case On.BC3_SRGB:return U3.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;case On.ETC_RGB8:return U3.COMPRESSED_RGB_ETC1_WEBGL;case On.ETC2_RGB8:return U3.COMPRESSED_RGB8_ETC2;case On.ETC2_SRGB8:return U3.COMPRESSED_SRGB8_ETC2;case On.ETC2_RGB8_A1:return U3.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2;case On.ETC2_SRGB8_A1:return U3.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2;case On.ETC2_RGBA8:return U3.COMPRESSED_RGBA8_ETC2_EAC;case On.ETC2_SRGB8_A8:return U3.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC;case On.EAC_R11:return U3.COMPRESSED_R11_EAC;case On.EAC_R11SN:return U3.COMPRESSED_SIGNED_R11_EAC;case On.EAC_RG11:return U3.COMPRESSED_RG11_EAC;case On.EAC_RG11SN:return U3.COMPRESSED_SIGNED_RG11_EAC;case On.PVRTC_RGB2:return U3.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;case On.PVRTC_RGBA2:return U3.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;case On.PVRTC_RGB4:return U3.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;case On.PVRTC_RGBA4:return U3.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;case On.ASTC_RGBA_4X4:return U3.COMPRESSED_RGBA_ASTC_4x4_KHR;case On.ASTC_RGBA_5X4:return U3.COMPRESSED_RGBA_ASTC_5x4_KHR;case On.ASTC_RGBA_5X5:return U3.COMPRESSED_RGBA_ASTC_5x5_KHR;case On.ASTC_RGBA_6X5:return U3.COMPRESSED_RGBA_ASTC_6x5_KHR;case On.ASTC_RGBA_6X6:return U3.COMPRESSED_RGBA_ASTC_6x6_KHR;case On.ASTC_RGBA_8X5:return U3.COMPRESSED_RGBA_ASTC_8x5_KHR;case On.ASTC_RGBA_8X6:return U3.COMPRESSED_RGBA_ASTC_8x6_KHR;case On.ASTC_RGBA_8X8:return U3.COMPRESSED_RGBA_ASTC_8x8_KHR;case On.ASTC_RGBA_10X5:return U3.COMPRESSED_RGBA_ASTC_10x5_KHR;case On.ASTC_RGBA_10X6:return U3.COMPRESSED_RGBA_ASTC_10x6_KHR;case On.ASTC_RGBA_10X8:return U3.COMPRESSED_RGBA_ASTC_10x8_KHR;case On.ASTC_RGBA_10X10:return U3.COMPRESSED_RGBA_ASTC_10x10_KHR;case On.ASTC_RGBA_12X10:return U3.COMPRESSED_RGBA_ASTC_12x10_KHR;case On.ASTC_RGBA_12X12:return U3.COMPRESSED_RGBA_ASTC_12x12_KHR;case On.ASTC_SRGBA_4X4:return U3.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR;case On.ASTC_SRGBA_5X4:return U3.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR;case On.ASTC_SRGBA_5X5:return U3.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR;case On.ASTC_SRGBA_6X5:return U3.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR;case On.ASTC_SRGBA_6X6:return U3.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR;case On.ASTC_SRGBA_8X5:return U3.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR;case On.ASTC_SRGBA_8X6:return U3.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR;case On.ASTC_SRGBA_8X8:return U3.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR;case On.ASTC_SRGBA_10X5:return U3.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR;case On.ASTC_SRGBA_10X6:return U3.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR;case On.ASTC_SRGBA_10X8:return U3.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR;case On.ASTC_SRGBA_10X10:return U3.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR;case On.ASTC_SRGBA_12X10:return U3.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR;case On.ASTC_SRGBA_12X12:return U3.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR;default:return console.error("Unsupported Format, convert to WebGL internal format failed."),e.RGBA}}(e.format,i),e.glFormat=function(t,e){switch(t){case On.A8:return e.ALPHA;case On.L8:return e.LUMINANCE;case On.LA8:return e.LUMINANCE_ALPHA;case On.R8:case On.R8SN:return e.RED;case On.R8UI:case On.R8I:return e.RED;case On.RG8:case On.RG8SN:case On.RG8UI:case On.RG8I:return e.RG;case On.RGB8:case On.RGB8SN:case On.RGB8UI:case On.RGB8I:return e.RGB;case On.BGRA8:case On.RGBA8:case On.RGBA8SN:case On.RGBA8UI:case On.RGBA8I:return e.RGBA;case On.R16UI:case On.R16I:case On.R16F:return e.RED;case On.RG16UI:case On.RG16I:case On.RG16F:return e.RG;case On.RGB16UI:case On.RGB16I:case On.RGB16F:return e.RGB;case On.RGBA16UI:case On.RGBA16I:case On.RGBA16F:return e.RGBA;case On.R32UI:case On.R32I:case On.R32F:return e.RED;case On.RG32UI:case On.RG32I:case On.RG32F:return e.RG;case On.RGB32UI:case On.RGB32I:case On.RGB32F:return e.RGB;case On.RGBA32UI:case On.RGBA32I:case On.RGBA32F:case On.RGB10A2:return e.RGBA;case On.R11G11B10F:case On.R5G6B5:return e.RGB;case On.RGB5A1:case On.RGBA4:return e.RGBA;case On.SRGB8:return e.RGB;case On.SRGB8_A8:return e.RGBA;case On.DEPTH:return e.DEPTH_COMPONENT;case On.DEPTH_STENCIL:return e.DEPTH_STENCIL;case On.BC1:return U3.COMPRESSED_RGB_S3TC_DXT1_EXT;case On.BC1_ALPHA:return U3.COMPRESSED_RGBA_S3TC_DXT1_EXT;case On.BC1_SRGB:return U3.COMPRESSED_SRGB_S3TC_DXT1_EXT;case On.BC1_SRGB_ALPHA:return U3.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;case On.BC2:return U3.COMPRESSED_RGBA_S3TC_DXT3_EXT;case On.BC2_SRGB:return U3.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;case On.BC3:return U3.COMPRESSED_RGBA_S3TC_DXT5_EXT;case On.BC3_SRGB:return U3.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;case On.ETC_RGB8:return U3.COMPRESSED_RGB_ETC1_WEBGL;case On.ETC2_RGB8:return U3.COMPRESSED_RGB8_ETC2;case On.ETC2_SRGB8:return U3.COMPRESSED_SRGB8_ETC2;case On.ETC2_RGB8_A1:return U3.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2;case On.ETC2_SRGB8_A1:return U3.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2;case On.ETC2_RGBA8:return U3.COMPRESSED_RGBA8_ETC2_EAC;case On.ETC2_SRGB8_A8:return U3.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC;case On.EAC_R11:return U3.COMPRESSED_R11_EAC;case On.EAC_R11SN:return U3.COMPRESSED_SIGNED_R11_EAC;case On.EAC_RG11:return U3.COMPRESSED_RG11_EAC;case On.EAC_RG11SN:return U3.COMPRESSED_SIGNED_RG11_EAC;case On.PVRTC_RGB2:return U3.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;case On.PVRTC_RGBA2:return U3.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;case On.PVRTC_RGB4:return U3.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;case On.PVRTC_RGBA4:return U3.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;case On.ASTC_RGBA_4X4:return U3.COMPRESSED_RGBA_ASTC_4x4_KHR;case On.ASTC_RGBA_5X4:return U3.COMPRESSED_RGBA_ASTC_5x4_KHR;case On.ASTC_RGBA_5X5:return U3.COMPRESSED_RGBA_ASTC_5x5_KHR;case On.ASTC_RGBA_6X5:return U3.COMPRESSED_RGBA_ASTC_6x5_KHR;case On.ASTC_RGBA_6X6:return U3.COMPRESSED_RGBA_ASTC_6x6_KHR;case On.ASTC_RGBA_8X5:return U3.COMPRESSED_RGBA_ASTC_8x5_KHR;case On.ASTC_RGBA_8X6:return U3.COMPRESSED_RGBA_ASTC_8x6_KHR;case On.ASTC_RGBA_8X8:return U3.COMPRESSED_RGBA_ASTC_8x8_KHR;case On.ASTC_RGBA_10X5:return U3.COMPRESSED_RGBA_ASTC_10x5_KHR;case On.ASTC_RGBA_10X6:return U3.COMPRESSED_RGBA_ASTC_10x6_KHR;case On.ASTC_RGBA_10X8:return U3.COMPRESSED_RGBA_ASTC_10x8_KHR;case On.ASTC_RGBA_10X10:return U3.COMPRESSED_RGBA_ASTC_10x10_KHR;case On.ASTC_RGBA_12X10:return U3.COMPRESSED_RGBA_ASTC_12x10_KHR;case On.ASTC_RGBA_12X12:return U3.COMPRESSED_RGBA_ASTC_12x12_KHR;case On.ASTC_SRGBA_4X4:return U3.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR;case On.ASTC_SRGBA_5X4:return U3.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR;case On.ASTC_SRGBA_5X5:return U3.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR;case On.ASTC_SRGBA_6X5:return U3.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR;case On.ASTC_SRGBA_6X6:return U3.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR;case On.ASTC_SRGBA_8X5:return U3.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR;case On.ASTC_SRGBA_8X6:return U3.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR;case On.ASTC_SRGBA_8X8:return U3.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR;case On.ASTC_SRGBA_10X5:return U3.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR;case On.ASTC_SRGBA_10X6:return U3.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR;case On.ASTC_SRGBA_10X8:return U3.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR;case On.ASTC_SRGBA_10X10:return U3.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR;case On.ASTC_SRGBA_12X10:return U3.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR;case On.ASTC_SRGBA_12X12:return U3.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR;default:return console.error("Unsupported Format, convert to WebGL format failed."),e.RGBA}}(e.format,i),e.glType=V3(e.format,i);var n=e.width,r=e.height;switch(e.type){case Ln.TEX2D:if(e.glTarget=i.TEXTURE_2D,e.isSwapchainTexture)break;var s=Math.max(n,r);if(s>t.capabilities.maxTextureSize&&K(9100,s,t.capabilities.maxTextureSize),e.samples===kn.ONE){if(e.glTexture=i.createTexture(),e.size>0){var a=t.stateCache.glTexUnits[t.stateCache.texUnit];if(a.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_2D,e.glTexture),a.glTexture=e.glTexture),As[e.format].isCompressed)for(var o=0;o<e.mipLevel;++o){var u=Is(e.format,n,r,1),h=new Uint8Array(u);i.compressedTexImage2D(i.TEXTURE_2D,o,e.glInternalFmt,n,r,0,h),n=Math.max(1,n>>1),r=Math.max(1,r>>1)}else i.texStorage2D(i.TEXTURE_2D,e.mipLevel,e.glInternalFmt,n,r)}}else e.glRenderbuffer=i.createRenderbuffer(),e.size>0&&(t.stateCache.glRenderbuffer!==e.glRenderbuffer&&(i.bindRenderbuffer(i.RENDERBUFFER,e.glRenderbuffer),t.stateCache.glRenderbuffer=e.glRenderbuffer),i.renderbufferStorageMultisample(i.RENDERBUFFER,e.samples,e.glInternalFmt,e.width,e.height));break;case Ln.CUBE:e.glTarget=i.TEXTURE_CUBE_MAP;var l=Math.max(n,r);if(l>t.capabilities.maxCubeMapTextureSize&&K(9100,l,t.capabilities.maxTextureSize),e.glTexture=i.createTexture(),e.size>0){var c=t.stateCache.glTexUnits[t.stateCache.texUnit];if(c.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_CUBE_MAP,e.glTexture),c.glTexture=e.glTexture),As[e.format].isCompressed)for(var _=0;_<e.mipLevel;++_){for(var f=Is(e.format,n,r,1),d=new Uint8Array(f),p=0;p<6;++p)i.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+p,_,e.glInternalFmt,n,r,0,d);n=Math.max(1,n>>1),r=Math.max(1,r>>1)}else i.texStorage2D(i.TEXTURE_CUBE_MAP,e.mipLevel,e.glInternalFmt,n,r)}break;default:console.error("Unsupported TextureType, create texture failed."),e.type=Ln.TEX2D,e.glTarget=i.TEXTURE_2D}}function u4(t,e){var i=t.gl;if(e.glTexture){var n=t.stateCache.glTexUnits,r=t.stateCache.texUnit;i.deleteTexture(e.glTexture);for(var s=0;s<n.length;++s)n[s].glTexture===e.glTexture&&(i.activeTexture(i.TEXTURE0+s),r=s,i.bindTexture(e.glTarget,null),n[s].glTexture=null);t.stateCache.texUnit=r,e.glTexture=null}if(e.glRenderbuffer){var a=t.stateCache.glRenderbuffer;i.deleteRenderbuffer(e.glRenderbuffer),a===e.glRenderbuffer&&(i.bindRenderbuffer(i.RENDERBUFFER,null),a=null),e.glRenderbuffer=null}}var h4={gpuPipelineState:null,gpuInputAssembler:null,glPrimitive:0,invalidateAttachments:[]};function l4(t,e,i,n,r,s,a){var o=t.gl,u=t.stateCache,h=0;if(i&&e){u.glFramebuffer!==i.glFramebuffer&&(o.bindFramebuffer(o.FRAMEBUFFER,i.glFramebuffer),u.glFramebuffer=i.glFramebuffer),u.viewport.left===n.x&&u.viewport.top===n.y&&u.viewport.width===n.width&&u.viewport.height===n.height||(o.viewport(n.x,n.y,n.width,n.height),u.viewport.left=n.x,u.viewport.top=n.y,u.viewport.width=n.width,u.viewport.height=n.height),u.scissorRect.x===n.x&&u.scissorRect.y===n.y&&u.scissorRect.width===n.width&&u.scissorRect.height===n.height||(o.scissor(n.x,n.y,n.width,n.height),u.scissorRect.x=n.x,u.scissorRect.y=n.y,u.scissorRect.width=n.width,u.scissorRect.height=n.height),h4.invalidateAttachments.length=0;for(var l=0;l<r.length;++l){var c=e.colorAttachments[l];if(c.format!==On.UNKNOWN)switch(c.loadOp){case Qn.LOAD:break;case Qn.CLEAR:if(u.bs.targets[0].blendColorMask!==Kn.ALL&&o.colorMask(!0,!0,!0,!0),i.isOffscreen)H3[0]=r[l].x,H3[1]=r[l].y,H3[2]=r[l].z,H3[3]=r[l].w,o.clearBufferfv(o.COLOR,l,H3);else{var _=r[0];o.clearColor(_.x,_.y,_.z,_.w),h|=o.COLOR_BUFFER_BIT}break;case Qn.DISCARD:h4.invalidateAttachments.push(o.COLOR_ATTACHMENT0+l)}}if(e.depthStencilAttachment&&e.depthStencilAttachment.format!==On.UNKNOWN){switch(e.depthStencilAttachment.depthLoadOp){case Qn.LOAD:break;case Qn.CLEAR:u.dss.depthWrite||o.depthMask(!0),o.clearDepth(s),h|=o.DEPTH_BUFFER_BIT;break;case Qn.DISCARD:h4.invalidateAttachments.push(o.DEPTH_ATTACHMENT)}if(As[e.depthStencilAttachment.format].hasStencil)switch(e.depthStencilAttachment.stencilLoadOp){case Qn.LOAD:break;case Qn.CLEAR:u.dss.stencilWriteMaskFront||o.stencilMaskSeparate(o.FRONT,65535),u.dss.stencilWriteMaskBack||o.stencilMaskSeparate(o.BACK,65535),o.clearStencil(a),h|=o.STENCIL_BUFFER_BIT;break;case Qn.DISCARD:h4.invalidateAttachments.push(o.STENCIL_ATTACHMENT)}}if(i.glFramebuffer&&h4.invalidateAttachments.length&&o.invalidateFramebuffer(o.FRAMEBUFFER,h4.invalidateAttachments),h&&o.clear(h),h&o.COLOR_BUFFER_BIT){var f=u.bs.targets[0].blendColorMask;if(f!==Kn.ALL){var d=(f&Kn.R)!==Kn.NONE,p=(f&Kn.G)!==Kn.NONE,m=(f&Kn.B)!==Kn.NONE,g=(f&Kn.A)!==Kn.NONE;o.colorMask(d,p,m,g)}}h&o.DEPTH_BUFFER_BIT&&!u.dss.depthWrite&&o.depthMask(!1),h&o.STENCIL_BUFFER_BIT&&(u.dss.stencilWriteMaskFront||o.stencilMaskSeparate(o.FRONT,0),u.dss.stencilWriteMaskBack||o.stencilMaskSeparate(o.BACK,0))}}function c4(t,e,i,n,r,s){var a=t.gl,o=t.stateCache,u=e&&e.gpuShader,h=!1;if(e&&h4.gpuPipelineState!==e){if(h4.gpuPipelineState=e,h4.glPrimitive=e.glPrimitive,u){var l=u.glProgram;o.glProgram!==l&&(a.useProgram(l),o.glProgram=l,h=!0)}var c=e.rs;if(c){if(o.rs.cullMode!==c.cullMode){switch(c.cullMode){case rr.NONE:a.disable(a.CULL_FACE);break;case rr.FRONT:a.enable(a.CULL_FACE),a.cullFace(a.FRONT);break;case rr.BACK:a.enable(a.CULL_FACE),a.cullFace(a.BACK)}t.stateCache.rs.cullMode=c.cullMode}var _=c.isFrontFaceCCW;t.stateCache.rs.isFrontFaceCCW!==_&&(a.frontFace(_?a.CCW:a.CW),t.stateCache.rs.isFrontFaceCCW=_),t.stateCache.rs.depthBias===c.depthBias&&t.stateCache.rs.depthBiasSlop===c.depthBiasSlop||(a.polygonOffset(c.depthBias,c.depthBiasSlop),t.stateCache.rs.depthBias=c.depthBias,t.stateCache.rs.depthBiasSlop=c.depthBiasSlop),t.stateCache.rs.lineWidth!==c.lineWidth&&(a.lineWidth(c.lineWidth),t.stateCache.rs.lineWidth=c.lineWidth)}var f=e.dss;f&&(o.dss.depthTest!==f.depthTest&&(f.depthTest?a.enable(a.DEPTH_TEST):a.disable(a.DEPTH_TEST),o.dss.depthTest=f.depthTest),o.dss.depthWrite!==f.depthWrite&&(a.depthMask(f.depthWrite),o.dss.depthWrite=f.depthWrite),o.dss.depthFunc!==f.depthFunc&&(a.depthFunc(q3[f.depthFunc]),o.dss.depthFunc=f.depthFunc),o.dss.stencilTestFront===f.stencilTestFront&&o.dss.stencilTestBack===f.stencilTestBack||(f.stencilTestFront||f.stencilTestBack?a.enable(a.STENCIL_TEST):a.disable(a.STENCIL_TEST),o.dss.stencilTestFront=f.stencilTestFront,o.dss.stencilTestBack=f.stencilTestBack),o.dss.stencilFuncFront===f.stencilFuncFront&&o.dss.stencilRefFront===f.stencilRefFront&&o.dss.stencilReadMaskFront===f.stencilReadMaskFront||(a.stencilFuncSeparate(a.FRONT,q3[f.stencilFuncFront],f.stencilRefFront,f.stencilReadMaskFront),o.dss.stencilFuncFront=f.stencilFuncFront,o.dss.stencilRefFront=f.stencilRefFront,o.dss.stencilReadMaskFront=f.stencilReadMaskFront),o.dss.stencilFailOpFront===f.stencilFailOpFront&&o.dss.stencilZFailOpFront===f.stencilZFailOpFront&&o.dss.stencilPassOpFront===f.stencilPassOpFront||(a.stencilOpSeparate(a.FRONT,Q3[f.stencilFailOpFront],Q3[f.stencilZFailOpFront],Q3[f.stencilPassOpFront]),o.dss.stencilFailOpFront=f.stencilFailOpFront,o.dss.stencilZFailOpFront=f.stencilZFailOpFront,o.dss.stencilPassOpFront=f.stencilPassOpFront),o.dss.stencilWriteMaskFront!==f.stencilWriteMaskFront&&(a.stencilMaskSeparate(a.FRONT,f.stencilWriteMaskFront),o.dss.stencilWriteMaskFront=f.stencilWriteMaskFront),o.dss.stencilFuncBack===f.stencilFuncBack&&o.dss.stencilRefBack===f.stencilRefBack&&o.dss.stencilReadMaskBack===f.stencilReadMaskBack||(a.stencilFuncSeparate(a.BACK,q3[f.stencilFuncBack],f.stencilRefBack,f.stencilReadMaskBack),o.dss.stencilFuncBack=f.stencilFuncBack,o.dss.stencilRefBack=f.stencilRefBack,o.dss.stencilReadMaskBack=f.stencilReadMaskBack),o.dss.stencilFailOpBack===f.stencilFailOpBack&&o.dss.stencilZFailOpBack===f.stencilZFailOpBack&&o.dss.stencilPassOpBack===f.stencilPassOpBack||(a.stencilOpSeparate(a.BACK,Q3[f.stencilFailOpBack],Q3[f.stencilZFailOpBack],Q3[f.stencilPassOpBack]),o.dss.stencilFailOpBack=f.stencilFailOpBack,o.dss.stencilZFailOpBack=f.stencilZFailOpBack,o.dss.stencilPassOpBack=f.stencilPassOpBack),o.dss.stencilWriteMaskBack!==f.stencilWriteMaskBack&&(a.stencilMaskSeparate(a.BACK,f.stencilWriteMaskBack),o.dss.stencilWriteMaskBack=f.stencilWriteMaskBack));var d=e.bs;if(d){o.bs.isA2C!==d.isA2C&&(d.isA2C?a.enable(a.SAMPLE_ALPHA_TO_COVERAGE):a.disable(a.SAMPLE_ALPHA_TO_COVERAGE),o.bs.isA2C=d.isA2C),o.bs.blendColor.x===d.blendColor.x&&o.bs.blendColor.y===d.blendColor.y&&o.bs.blendColor.z===d.blendColor.z&&o.bs.blendColor.w===d.blendColor.w||(a.blendColor(d.blendColor.x,d.blendColor.y,d.blendColor.z,d.blendColor.w),o.bs.blendColor.x=d.blendColor.x,o.bs.blendColor.y=d.blendColor.y,o.bs.blendColor.z=d.blendColor.z,o.bs.blendColor.w=d.blendColor.w);var p=d.targets[0],m=o.bs.targets[0];m.blend!==p.blend&&(p.blend?a.enable(a.BLEND):a.disable(a.BLEND),m.blend=p.blend),m.blendEq===p.blendEq&&m.blendAlphaEq===p.blendAlphaEq||(a.blendEquationSeparate(Z3[p.blendEq],Z3[p.blendAlphaEq]),m.blendEq=p.blendEq,m.blendAlphaEq=p.blendAlphaEq),m.blendSrc===p.blendSrc&&m.blendDst===p.blendDst&&m.blendSrcAlpha===p.blendSrcAlpha&&m.blendDstAlpha===p.blendDstAlpha||(a.blendFuncSeparate(J3[p.blendSrc],J3[p.blendDst],J3[p.blendSrcAlpha],J3[p.blendDstAlpha]),m.blendSrc=p.blendSrc,m.blendDst=p.blendDst,m.blendSrcAlpha=p.blendSrcAlpha,m.blendDstAlpha=p.blendDstAlpha),m.blendColorMask!==p.blendColorMask&&(a.colorMask((p.blendColorMask&Kn.R)!==Kn.NONE,(p.blendColorMask&Kn.G)!==Kn.NONE,(p.blendColorMask&Kn.B)!==Kn.NONE,(p.blendColorMask&Kn.A)!==Kn.NONE),m.blendColorMask=p.blendColorMask)}}if(e&&e.gpuPipelineLayout&&u){for(var g=u.glBlocks.length,v=e.gpuPipelineLayout.dynamicOffsetIndices,y=0;y<g;y++){var E=u.glBlocks[y],T=n[E.set],S=T&&T.descriptorIndices[E.binding],A=S>=0&&T.gpuDescriptors[S];if(A&&A.gpuBuffer){var R=v[E.set],b=R&&R[E.binding],C=A.gpuBuffer.glOffset;b>=0&&(C+=r[b]),o.glBindUBOs[E.glBinding]===A.gpuBuffer.glBuffer&&o.glBindUBOOffsets[E.glBinding]===C||(C?a.bindBufferRange(a.UNIFORM_BUFFER,E.glBinding,A.gpuBuffer.glBuffer,C,A.gpuBuffer.size):a.bindBufferBase(a.UNIFORM_BUFFER,E.glBinding,A.gpuBuffer.glBuffer),o.glUniformBuffer=o.glBindUBOs[E.glBinding]=A.gpuBuffer.glBuffer,o.glBindUBOOffsets[E.glBinding]=C)}else F("Buffer binding '"+E.name+"' at set "+E.set+" binding "+E.binding+" is not bounded")}for(var w=u.glSamplerTextures.length,I=0;I<w;I++)for(var O=u.glSamplerTextures[I],x=n[O.set],P=x&&x.descriptorIndices[O.binding],D=P>=0&&x.gpuDescriptors[P],B=0;B<O.units.length;B++){var N=O.units[B],M=o.glTexUnits[N];if(D&&D.gpuTextureView&&D.gpuTextureView.gpuTexture&&D.gpuSampler){var L=D.gpuTextureView,U=L.gpuTexture,G=L.baseLevel,k=G+L.levelCount;if(U.size>0){M.glTexture!==U.glTexture&&(o.texUnit!==N&&(a.activeTexture(a.TEXTURE0+N),o.texUnit=N),U.glTexture?a.bindTexture(U.glTarget,U.glTexture):a.bindTexture(U.glTarget,t.nullTex2D.gpuTexture.glTexture),M.glTexture=U.glTexture);var z=D.gpuSampler.getGLSampler(t,G,k);o.glSamplerUnits[N]!==z&&(a.bindSampler(N,z),o.glSamplerUnits[N]=z)}D=x.gpuDescriptors[++P]}else F("Sampler binding '"+O.name+"' at set "+O.set+" binding "+O.binding+" index "+B+" is not bounded")}}if(i&&u&&(h||h4.gpuInputAssembler!==i))if(h4.gpuInputAssembler=i,t.extensions.useVAO){var H=i.glVAOs.get(u.glProgram);if(!H){var V;H=a.createVertexArray(),i.glVAOs.set(u.glProgram,H),a.bindVertexArray(H),a.bindBuffer(a.ARRAY_BUFFER,null),a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,null),o.glArrayBuffer=null,o.glElementArrayBuffer=null;for(var W=0;W<u.glInputs.length;W++){var X=u.glInputs[W];V=null;for(var j=0;j<i.glAttribs.length;j++){var Y=i.glAttribs[j];if(Y.name===X.name){V=Y;break}}if(V){o.glArrayBuffer!==V.glBuffer&&(a.bindBuffer(a.ARRAY_BUFFER,V.glBuffer),o.glArrayBuffer=V.glBuffer);for(var K=0;K<V.componentCount;++K){var q=X.glLoc+K,Q=V.offset+V.size*K;a.enableVertexAttribArray(q),o.glCurrentAttribLocs[q]=!0,a.vertexAttribPointer(q,V.count,V.glType,V.isNormalized,V.stride,Q),a.vertexAttribDivisor(q,V.isInstanced?1:0)}}}var Z=i.gpuIndexBuffer;Z&&a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,Z.glBuffer),a.bindVertexArray(null),a.bindBuffer(a.ARRAY_BUFFER,null),a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,null),o.glArrayBuffer=null,o.glElementArrayBuffer=null}o.glVAO!==H&&(a.bindVertexArray(H),o.glVAO=H)}else{for(var J=0;J<t.capabilities.maxVertexAttributes;++J)o.glCurrentAttribLocs[J]=!1;for(var $=0;$<u.glInputs.length;$++){for(var tt=u.glInputs[$],et=null,it=0;it<i.glAttribs.length;it++){var nt=i.glAttribs[it];if(nt.name===tt.name){et=nt;break}}if(et){o.glArrayBuffer!==et.glBuffer&&(a.bindBuffer(a.ARRAY_BUFFER,et.glBuffer),o.glArrayBuffer=et.glBuffer);for(var rt=0;rt<et.componentCount;++rt){var st=tt.glLoc+rt,at=et.offset+et.size*rt;!o.glEnabledAttribLocs[st]&&st>=0&&(a.enableVertexAttribArray(st),o.glEnabledAttribLocs[st]=!0),o.glCurrentAttribLocs[st]=!0,a.vertexAttribPointer(st,et.count,et.glType,et.isNormalized,et.stride,at),a.vertexAttribDivisor(st,et.isInstanced?1:0)}}}var ot=i.gpuIndexBuffer;ot&&o.glElementArrayBuffer!==ot.glBuffer&&(a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,ot.glBuffer),o.glElementArrayBuffer=ot.glBuffer);for(var ut=0;ut<t.capabilities.maxVertexAttributes;++ut)o.glEnabledAttribLocs[ut]!==o.glCurrentAttribLocs[ut]&&(a.disableVertexAttribArray(ut),o.glEnabledAttribLocs[ut]=!1)}if(e&&e.dynamicStates.length)for(var ht=e.dynamicStates.length,lt=0;lt<ht;lt++)switch(e.dynamicStates[lt]){case sr.LINE_WIDTH:o.rs.lineWidth!==s.lineWidth&&(a.lineWidth(s.lineWidth),o.rs.lineWidth=s.lineWidth);break;case sr.DEPTH_BIAS:o.rs.depthBias===s.depthBiasConstant&&o.rs.depthBiasSlop===s.depthBiasSlope||(a.polygonOffset(s.depthBiasConstant,s.depthBiasSlope),o.rs.depthBias=s.depthBiasConstant,o.rs.depthBiasSlop=s.depthBiasSlope);break;case sr.BLEND_CONSTANTS:var ct=s.blendConstant;o.bs.blendColor.x===ct.x&&o.bs.blendColor.y===ct.y&&o.bs.blendColor.z===ct.z&&o.bs.blendColor.w===ct.w||(a.blendColor(ct.x,ct.y,ct.z,ct.w),o.bs.blendColor.copy(ct));break;case sr.STENCIL_WRITE_MASK:var _t=s.stencilStatesFront,ft=s.stencilStatesBack;o.dss.stencilWriteMaskFront!==_t.writeMask&&(a.stencilMaskSeparate(a.FRONT,_t.writeMask),o.dss.stencilWriteMaskFront=_t.writeMask),o.dss.stencilWriteMaskBack!==ft.writeMask&&(a.stencilMaskSeparate(a.BACK,ft.writeMask),o.dss.stencilWriteMaskBack=ft.writeMask);break;case sr.STENCIL_COMPARE_MASK:var dt=s.stencilStatesFront,pt=s.stencilStatesBack;o.dss.stencilRefFront===dt.reference&&o.dss.stencilReadMaskFront===dt.compareMask||(a.stencilFuncSeparate(a.FRONT,q3[o.dss.stencilFuncFront],dt.reference,dt.compareMask),o.dss.stencilRefFront=dt.reference,o.dss.stencilReadMaskFront=dt.compareMask),o.dss.stencilRefBack===pt.reference&&o.dss.stencilReadMaskBack===pt.compareMask||(a.stencilFuncSeparate(a.BACK,q3[o.dss.stencilFuncBack],pt.reference,pt.compareMask),o.dss.stencilRefBack=pt.reference,o.dss.stencilReadMaskBack=pt.compareMask)}}function _4(t,e){var i=t.gl,n=h4.gpuInputAssembler,r=h4.glPrimitive,s=t.extensions.WEBGL_multi_draw;if(n){var a=n.gpuIndexBuffer;if(n.gpuIndirectBuffer){var o=n.gpuIndirectBuffer.indirects;if(o.drawByIndex){for(var u=0;u<o.drawCount;u++)o.byteOffsets[u]=o.offsets[u]*a.stride;if(s)o.instancedDraw?s.multiDrawElementsInstancedWEBGL(r,o.counts,0,n.glIndexType,o.byteOffsets,0,o.instances,0,o.drawCount):s.multiDrawElementsWEBGL(r,o.counts,0,n.glIndexType,o.byteOffsets,0,o.drawCount);else for(var h=0;h<o.drawCount;h++)o.instances[h]?i.drawElementsInstanced(r,o.counts[h],n.glIndexType,o.byteOffsets[h],o.instances[h]):i.drawElements(r,o.counts[h],n.glIndexType,o.byteOffsets[h])}else if(s)o.instancedDraw?s.multiDrawArraysInstancedWEBGL(r,o.offsets,0,o.counts,0,o.instances,0,o.drawCount):s.multiDrawArraysWEBGL(r,o.offsets,0,o.counts,0,o.drawCount);else for(var l=0;l<o.drawCount;l++)o.instances[l]?i.drawArraysInstanced(r,o.offsets[l],o.counts[l],o.instances[l]):i.drawArrays(r,o.offsets[l],o.counts[l])}else if(e.instanceCount)if(a){if(e.indexCount>0){var c=e.firstIndex*a.stride;i.drawElementsInstanced(r,e.indexCount,n.glIndexType,c,e.instanceCount)}}else e.vertexCount>0&&i.drawArraysInstanced(r,e.firstVertex,e.vertexCount,e.instanceCount);else if(a){if(e.indexCount>0){var _=e.firstIndex*a.stride;i.drawElements(r,e.indexCount,n.glIndexType,_)}}else e.vertexCount>0&&i.drawArrays(r,e.firstVertex,e.vertexCount)}}var f4=new Array(K3.COUNT);function d4(t,e){f4.fill(0);for(var i=0;i<e.cmds.length;++i){var n=e.cmds.array[i],r=f4[n]++;switch(n){case K3.BEGIN_RENDER_PASS:var s=e.beginRenderPassCmds.array[r];l4(t,s.gpuRenderPass,s.gpuFramebuffer,s.renderArea,s.clearColors,s.clearDepth,s.clearStencil);break;case K3.BIND_STATES:var a=e.bindStatesCmds.array[r];c4(t,a.gpuPipelineState,a.gpuInputAssembler,a.gpuDescriptorSets,a.dynamicOffsets,a.dynamicStates);break;case K3.DRAW:_4(t,e.drawCmds.array[r].drawInfo);break;case K3.UPDATE_BUFFER:var o=e.updateBufferCmds.array[r];a4(t,o.gpuBuffer,o.buffer,o.offset,o.size);break;case K3.COPY_BUFFER_TO_TEXTURE:var u=e.copyBufferToTextureCmds.array[r];g4(t,u.buffers,u.gpuTexture,u.regions)}}}var p4=new Uint8Array(1);function m4(t,e,i,n,r){var s=Bs(e).height,a=Is(e,r.width,r.height,r.depth),o=Is(e,n.width,1,1),u=Is(e,n.width,n.height,1),h=Is(e,r.width,1,1),l=Ds(As[e]);p4.byteLength<a&&(p4=new Uint8Array(a));for(var c=0,_=i,f=0;f<r.depth;f++){_=i+u*f;for(var d=0;d<r.height;d+=s)p4.subarray(c,c+h).set(new Uint8Array(t.buffer,t.byteOffset+_,h)),c+=h,_+=o}return new l(p4.buffer)}function g4(t,e,i,n){var r=t.gl,s=t.stateCache.glTexUnits[t.stateCache.texUnit];s.glTexture!==i.glTexture&&(r.bindTexture(i.glTarget,i.glTexture),s.glTexture=i.glTexture);var a=0,o=0,u=As[i.format],h=Ds(u),l=u.isCompressed,c=Bs(i.format),_=new Ar,f=new Tr,d=new Ar;switch(i.glTarget){case r.TEXTURE_2D:for(var p=0;p<n.length;p++){var m=n[p],g=m.texSubres.mipLevel;f.x=0===m.texOffset.x?0:Ns(m.texOffset.x,c.width),f.y=0===m.texOffset.y?0:Ns(m.texOffset.y,c.height),_.width=m.texExtent.width<c.width?m.texExtent.width:Ns(m.texExtent.width,c.width),_.height=m.texExtent.height<c.height?m.texExtent.width:Ns(m.texExtent.height,c.height),d.width=m.buffStride>0?m.buffStride:_.width,d.height=m.buffTexHeight>0?m.buffTexHeight:_.height;var v,y=m.texExtent.width+f.x===i.width>>g?m.texExtent.width:_.width,E=m.texExtent.height+f.y===i.height>>g?m.texExtent.height:_.height,T=e[a++];v=d.width===_.width&&d.height===_.height?new h(T.buffer,T.byteOffset+m.buffOffset):m4(T,i.format,m.buffOffset,d,_),l?i.glInternalFmt!==U3.COMPRESSED_RGB_ETC1_WEBGL?r.compressedTexSubImage2D(r.TEXTURE_2D,g,f.x,f.y,y,E,i.glFormat,v):r.compressedTexImage2D(r.TEXTURE_2D,g,i.glInternalFmt,y,E,0,v):r.texSubImage2D(r.TEXTURE_2D,g,f.x,f.y,y,E,i.glFormat,i.glType,v)}break;case r.TEXTURE_2D_ARRAY:for(var S=0;S<n.length;S++){var A=n[S],R=A.texSubres.mipLevel;f.x=0===A.texOffset.x?0:Ns(A.texOffset.x,c.width),f.y=0===A.texOffset.y?0:Ns(A.texOffset.y,c.height),_.width=A.texExtent.width<c.width?A.texExtent.width:Ns(A.texExtent.width,c.width),_.height=A.texExtent.height<c.height?A.texExtent.width:Ns(A.texExtent.height,c.height),_.depth=1,d.width=A.buffStride>0?A.buffStride:_.width,d.height=A.buffTexHeight>0?A.buffTexHeight:_.height;var b=A.texExtent.width+f.x===i.width>>R?A.texExtent.width:_.width,C=A.texExtent.height+f.y===i.height>>R?A.texExtent.height:_.height,w=A.texSubres.baseArrayLayer+A.texSubres.layerCount;for(o=A.texSubres.baseArrayLayer;o<w;++o){f.z=o;var I,O=e[a++];I=d.width===_.width&&d.height===_.height?new h(O.buffer,O.byteOffset+A.buffOffset):m4(O,i.format,A.buffOffset,d,_),l?i.glInternalFmt!==U3.COMPRESSED_RGB_ETC1_WEBGL?r.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,R,f.x,f.y,f.z,b,C,_.depth,i.glFormat,I):r.compressedTexImage3D(r.TEXTURE_2D_ARRAY,R,i.glInternalFmt,b,C,_.depth,0,I):r.texSubImage3D(r.TEXTURE_2D_ARRAY,R,f.x,f.y,f.z,b,C,_.depth,i.glFormat,i.glType,I)}}break;case r.TEXTURE_3D:for(var x=0;x<n.length;x++){var P=n[x],D=P.texSubres.mipLevel;f.x=0===P.texOffset.x?0:Ns(P.texOffset.x,c.width),f.y=0===P.texOffset.y?0:Ns(P.texOffset.y,c.height),f.z=P.texOffset.z,_.width=P.texExtent.width<c.width?P.texExtent.width:Ns(P.texExtent.width,c.width),_.height=P.texExtent.height<c.height?P.texExtent.width:Ns(P.texExtent.height,c.height),_.depth=P.texExtent.depth,d.width=P.buffStride>0?P.buffStride:_.width,d.height=P.buffTexHeight>0?P.buffTexHeight:_.height;var B,N=P.texExtent.width+f.x===i.width>>D?P.texExtent.width:_.width,M=P.texExtent.height+f.y===i.height>>D?P.texExtent.height:_.height,L=e[a++];B=d.width===_.width&&d.height===_.height?new h(L.buffer,L.byteOffset+P.buffOffset):m4(L,i.format,P.buffOffset,d,_),l?i.glInternalFmt!==U3.COMPRESSED_RGB_ETC1_WEBGL?r.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,D,f.x,f.y,f.z,N,M,_.depth,i.glFormat,B):r.compressedTexImage3D(r.TEXTURE_2D_ARRAY,D,i.glInternalFmt,N,M,_.depth,0,B):r.texSubImage3D(r.TEXTURE_2D_ARRAY,D,f.x,f.y,f.z,N,M,_.depth,i.glFormat,i.glType,B)}break;case r.TEXTURE_CUBE_MAP:for(var F=0;F<n.length;F++){var U=n[F],G=U.texSubres.mipLevel;f.x=0===U.texOffset.x?0:Ns(U.texOffset.x,c.width),f.y=0===U.texOffset.y?0:Ns(U.texOffset.y,c.height),_.width=U.texExtent.width<c.width?U.texExtent.width:Ns(U.texExtent.width,c.width),_.height=U.texExtent.height<c.height?U.texExtent.width:Ns(U.texExtent.height,c.height),d.width=U.buffStride>0?U.buffStride:_.width,d.height=U.buffTexHeight>0?U.buffTexHeight:_.height;var k=U.texExtent.width+f.x===i.width>>G?U.texExtent.width:_.width,z=U.texExtent.height+f.y===i.height>>G?U.texExtent.height:_.height,H=U.texSubres.baseArrayLayer+U.texSubres.layerCount;for(o=U.texSubres.baseArrayLayer;o<H;++o){var V,W=e[a++];V=d.width===_.width&&d.height===_.height?new h(W.buffer,W.byteOffset+U.buffOffset):m4(W,i.format,U.buffOffset,d,_),l?i.glInternalFmt!==U3.COMPRESSED_RGB_ETC1_WEBGL?r.compressedTexSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+o,G,f.x,f.y,k,z,i.glFormat,V):r.compressedTexImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+o,G,i.glInternalFmt,k,z,0,V):r.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+o,G,f.x,f.y,k,z,i.glFormat,i.glType,V)}}break;default:console.error("Unsupported GL texture type, copy buffer to texture failed.")}i.flags&Un.GEN_MIPMAP&&r.generateMipmap(i.glTarget)}var v4=function(){function t(){this.counts=void 0,this.offsets=void 0,this.instances=void 0,this.drawCount=0,this.drawByIndex=!1,this.instancedDraw=!1,this.byteOffsets=void 0,this._capacity=4,this.counts=new Int32Array(this._capacity),this.offsets=new Int32Array(this._capacity),this.instances=new Int32Array(this._capacity),this.byteOffsets=new Int32Array(this._capacity)}var e=t.prototype;return e.clearDraws=function(){this.drawCount=0,this.drawByIndex=!1,this.instancedDraw=!1},e.setDrawInfo=function(t,e){this._ensureCapacity(t),this.drawByIndex=e.indexCount>0,this.instancedDraw=!!e.instanceCount,this.drawCount=Math.max(t+1,this.drawCount),this.drawByIndex?(this.counts[t]=e.indexCount,this.offsets[t]=e.firstIndex):(this.counts[t]=e.vertexCount,this.offsets[t]=e.firstVertex),this.instances[t]=Math.max(1,e.instanceCount)},e._ensureCapacity=function(t){if(!(this._capacity>t)){this._capacity=s(t);var e=new Int32Array(this._capacity),i=new Int32Array(this._capacity),n=new Int32Array(this._capacity);this.byteOffsets=new Int32Array(this._capacity),e.set(this.counts),i.set(this.offsets),n.set(this.instances),this.counts=e,this.offsets=i,this.instances=n}},t}(),y4=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._gpuBuffer=null,e}c(e,t);var i=e.prototype;return i.initialize=function(t){if("buffer"in t){this._isBufferView=!0;var e=t.buffer;this._usage=e.usage,this._memUsage=e.memUsage,this._size=this._stride=t.range,this._count=1,this._flags=e.flags,this._gpuBuffer={usage:this._usage,memUsage:this._memUsage,size:this._size,stride:this._stride,buffer:null,indirects:e.gpuBuffer.indirects,glTarget:e.gpuBuffer.glTarget,glBuffer:e.gpuBuffer.glBuffer,glOffset:t.offset}}else this._usage=t.usage,this._memUsage=t.memUsage,this._size=t.size,this._stride=Math.max(t.stride||this._size,1),this._count=this._size/this._stride,this._flags=t.flags,this._gpuBuffer={usage:this._usage,memUsage:this._memUsage,size:this._size,stride:this._stride,buffer:null,indirects:new v4,glTarget:0,glBuffer:null,glOffset:0},function(t,e){var i=t.gl,n=t.stateCache,r=e.memUsage&Mn.HOST?i.DYNAMIC_DRAW:i.STATIC_DRAW;if(e.usage&Dn.VERTEX){e.glTarget=i.ARRAY_BUFFER;var s=i.createBuffer();s&&(e.glBuffer=s,e.size>0&&(t.extensions.useVAO&&n.glVAO&&(i.bindVertexArray(null),n.glVAO=null),h4.gpuInputAssembler=null,t.stateCache.glArrayBuffer!==e.glBuffer&&(i.bindBuffer(i.ARRAY_BUFFER,e.glBuffer),t.stateCache.glArrayBuffer=e.glBuffer),i.bufferData(i.ARRAY_BUFFER,e.size,r),i.bindBuffer(i.ARRAY_BUFFER,null),t.stateCache.glArrayBuffer=null))}else if(e.usage&Dn.INDEX){e.glTarget=i.ELEMENT_ARRAY_BUFFER;var a=i.createBuffer();a&&(e.glBuffer=a,e.size>0&&(t.extensions.useVAO&&n.glVAO&&(i.bindVertexArray(null),n.glVAO=null),h4.gpuInputAssembler=null,t.stateCache.glElementArrayBuffer!==e.glBuffer&&(i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.glBuffer),t.stateCache.glElementArrayBuffer=e.glBuffer),i.bufferData(i.ELEMENT_ARRAY_BUFFER,e.size,r),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,null),t.stateCache.glElementArrayBuffer=null))}else if(e.usage&Dn.UNIFORM){e.glTarget=i.UNIFORM_BUFFER;var o=i.createBuffer();o&&e.size>0&&(e.glBuffer=o,t.stateCache.glUniformBuffer!==e.glBuffer&&(i.bindBuffer(i.UNIFORM_BUFFER,e.glBuffer),t.stateCache.glUniformBuffer=e.glBuffer),i.bufferData(i.UNIFORM_BUFFER,e.size,r),i.bindBuffer(i.UNIFORM_BUFFER,null),t.stateCache.glUniformBuffer=null)}else e.usage&Dn.INDIRECT||e.usage&Dn.TRANSFER_DST||e.usage&Dn.TRANSFER_SRC||console.error("Unsupported BufferType, create buffer failed."),e.glTarget=i.NONE}(k3.instance,this._gpuBuffer),k3.instance.memoryStatus.bufferSize+=this._size},i.destroy=function(){this._gpuBuffer&&(this._isBufferView||(function(t,e){var i=t.gl,n=t.stateCache;if(e.glBuffer){switch(e.glTarget){case i.ARRAY_BUFFER:t.extensions.useVAO&&n.glVAO&&(i.bindVertexArray(null),t.stateCache.glVAO=null),h4.gpuInputAssembler=null,i.bindBuffer(i.ARRAY_BUFFER,null),t.stateCache.glArrayBuffer=null;break;case i.ELEMENT_ARRAY_BUFFER:t.extensions.useVAO&&n.glVAO&&(i.bindVertexArray(null),t.stateCache.glVAO=null),h4.gpuInputAssembler=null,i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,null),t.stateCache.glElementArrayBuffer=null;break;case i.UNIFORM_BUFFER:i.bindBuffer(i.UNIFORM_BUFFER,null),t.stateCache.glUniformBuffer=null}i.deleteBuffer(e.glBuffer),e.glBuffer=null}}(k3.instance,this._gpuBuffer),k3.instance.memoryStatus.bufferSize-=this._size),this._gpuBuffer=null)},i.resize=function(t){if(this._isBufferView)console.warn("cannot resize buffer views!");else{var e=this._size;e!==t&&(this._size=t,this._count=this._size/this._stride,this._gpuBuffer&&(this._gpuBuffer.size=t,t>0&&(function(t,e){var i=t.gl,n=t.stateCache,r=e.memUsage&Mn.HOST?i.DYNAMIC_DRAW:i.STATIC_DRAW;e.usage&Dn.VERTEX?(t.extensions.useVAO&&n.glVAO&&(i.bindVertexArray(null),n.glVAO=null),h4.gpuInputAssembler=null,n.glArrayBuffer!==e.glBuffer&&i.bindBuffer(i.ARRAY_BUFFER,e.glBuffer),e.buffer?i.bufferData(i.ARRAY_BUFFER,e.buffer,r):i.bufferData(i.ARRAY_BUFFER,e.size,r),i.bindBuffer(i.ARRAY_BUFFER,null),n.glArrayBuffer=null):e.usage&Dn.INDEX?(t.extensions.useVAO&&n.glVAO&&(i.bindVertexArray(null),n.glVAO=null),h4.gpuInputAssembler=null,t.stateCache.glElementArrayBuffer!==e.glBuffer&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.glBuffer),e.buffer?i.bufferData(i.ELEMENT_ARRAY_BUFFER,e.buffer,r):i.bufferData(i.ELEMENT_ARRAY_BUFFER,e.size,r),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,null),t.stateCache.glElementArrayBuffer=null):e.usage&Dn.UNIFORM?(t.stateCache.glUniformBuffer!==e.glBuffer&&i.bindBuffer(i.UNIFORM_BUFFER,e.glBuffer),i.bufferData(i.UNIFORM_BUFFER,e.size,r),i.bindBuffer(i.UNIFORM_BUFFER,null),t.stateCache.glUniformBuffer=null):(e.usage&Dn.INDIRECT||e.usage&Dn.TRANSFER_DST||e.usage&Dn.TRANSFER_SRC||console.error("Unsupported BufferType, create buffer failed."),e.glTarget=i.NONE)}(k3.instance,this._gpuBuffer),k3.instance.memoryStatus.bufferSize-=e,k3.instance.memoryStatus.bufferSize+=t)))}},i.update=function(t,e){var i;this._isBufferView?console.warn("cannot update through buffer views!"):(i=void 0!==e?e:this._usage&Dn.INDIRECT?0:t.byteLength,a4(k3.instance,this._gpuBuffer,t,0,i))},h(e,[{key:"gpuBuffer",get:function(){return this._gpuBuffer}}]),e}(Ls),E4=function(){function t(t,e){this._frees=void 0,this._freeIdx=0,this._freeCmds=void 0,this._frees=new Array(e),this._freeCmds=new ma(e);for(var i=0;i<e;++i)this._frees[i]=new t;this._freeIdx=e-1}var e=t.prototype;return e.alloc=function(t){if(this._freeIdx<0){var e=2*this._frees.length,i=this._frees;this._frees=new Array(e);for(var n=e-i.length,r=0;r<n;++r)this._frees[r]=new t;for(var s=n,a=0;s<e;++s,++a)this._frees[s]=i[a];this._freeIdx+=n}var o=this._frees[this._freeIdx];return this._frees[this._freeIdx--]=null,++o.refCount,o},e.free=function(t){0==--t.refCount&&this._freeCmds.push(t)},e.freeCmds=function(t){for(var e=0;e<t.length;++e)0==--t.array[e].refCount&&this._freeCmds.push(t.array[e])},e.release=function(){for(var t=0;t<this._freeCmds.length;++t){var e=this._freeCmds.array[t];e.clear(),this._frees[++this._freeIdx]=e}this._freeCmds.clear()},t}(),T4=function(){function t(){this.beginRenderPassCmdPool=void 0,this.bindStatesCmdPool=void 0,this.drawCmdPool=void 0,this.updateBufferCmdPool=void 0,this.copyBufferToTextureCmdPool=void 0,this.beginRenderPassCmdPool=new E4(t4,1),this.bindStatesCmdPool=new E4(e4,1),this.drawCmdPool=new E4(i4,1),this.updateBufferCmdPool=new E4(n4,1),this.copyBufferToTextureCmdPool=new E4(r4,1)}var e=t.prototype;return e.clearCmds=function(t){t.beginRenderPassCmds.length&&(this.beginRenderPassCmdPool.freeCmds(t.beginRenderPassCmds),t.beginRenderPassCmds.clear()),t.bindStatesCmds.length&&(this.bindStatesCmdPool.freeCmds(t.bindStatesCmds),t.bindStatesCmds.clear()),t.drawCmds.length&&(this.drawCmdPool.freeCmds(t.drawCmds),t.drawCmds.clear()),t.updateBufferCmds.length&&(this.updateBufferCmdPool.freeCmds(t.updateBufferCmds),t.updateBufferCmds.clear()),t.copyBufferToTextureCmds.length&&(this.copyBufferToTextureCmdPool.freeCmds(t.copyBufferToTextureCmds),t.copyBufferToTextureCmds.clear()),t.cmds.clear()},e.releaseCmds=function(){this.beginRenderPassCmdPool.release(),this.bindStatesCmdPool.release(),this.drawCmdPool.release(),this.updateBufferCmdPool.release(),this.copyBufferToTextureCmdPool.release()},t}(),S4=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).cmdPackage=new s4,e._cmdAllocator=new T4,e._isInRenderPass=!1,e._curGPUPipelineState=null,e._curGPUDescriptorSets=[],e._curGPUInputAssembler=null,e._curDynamicOffsets=Array(8).fill(0),e._curDynamicStates=new Ts,e._isStateInvalied=!1,e}c(e,t);var i=e.prototype;return i.initialize=function(t){this._type=t.type,this._queue=t.queue;for(var e=k3.instance.bindingMappings.blockOffsets.length,i=0;i<e;i++)this._curGPUDescriptorSets.push(null)},i.destroy=function(){this._cmdAllocator.clearCmds(this.cmdPackage)},i.begin=function(){this._cmdAllocator.clearCmds(this.cmdPackage),this._curGPUPipelineState=null,this._curGPUInputAssembler=null,this._curGPUDescriptorSets.length=0,this._numDrawCalls=0,this._numInstances=0,this._numTris=0},i.end=function(){this._isStateInvalied&&this.bindStates(),this._isInRenderPass=!1},i.beginRenderPass=function(t,e,i,n,r,s){var a=this._cmdAllocator.beginRenderPassCmdPool.alloc(t4);a.gpuRenderPass=t.gpuRenderPass,a.gpuFramebuffer=e.gpuFramebuffer,a.renderArea.copy(i);for(var o=0;o<n.length;++o)a.clearColors[o]=n[o];a.clearDepth=r,a.clearStencil=s,this.cmdPackage.beginRenderPassCmds.push(a),this.cmdPackage.cmds.push(K3.BEGIN_RENDER_PASS),this._isInRenderPass=!0},i.endRenderPass=function(){this._isInRenderPass=!1},i.bindPipelineState=function(t){var e=t.gpuPipelineState;e!==this._curGPUPipelineState&&(this._curGPUPipelineState=e,this._isStateInvalied=!0)},i.bindDescriptorSet=function(t,e,i){var n=e.gpuDescriptorSet;if(n!==this._curGPUDescriptorSets[t]&&(this._curGPUDescriptorSets[t]=n,this._isStateInvalied=!0),i){var r,s=null===(r=this._curGPUPipelineState)||void 0===r?void 0:r.gpuPipelineLayout;if(s){for(var a=this._curDynamicOffsets,o=s.dynamicOffsetOffsets[t],u=0;u<i.length;u++)a[o+u]=i[u];this._isStateInvalied=!0}}},i.bindInputAssembler=function(t){var e=t.gpuInputAssembler;this._curGPUInputAssembler=e,this._isStateInvalied=!0},i.setViewport=function(t){var e=this._curDynamicStates.viewport;e.left===t.left&&e.top===t.top&&e.width===t.width&&e.height===t.height&&e.minDepth===t.minDepth&&e.maxDepth===t.maxDepth||(e.left=t.left,e.top=t.top,e.width=t.width,e.height=t.height,e.minDepth=t.minDepth,e.maxDepth=t.maxDepth,this._isStateInvalied=!0)},i.setScissor=function(t){var e=this._curDynamicStates.scissor;e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height||(e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height,this._isStateInvalied=!0)},i.setLineWidth=function(t){this._curDynamicStates.lineWidth!==t&&(this._curDynamicStates.lineWidth=t,this._isStateInvalied=!0)},i.setDepthBias=function(t,e,i){var n=this._curDynamicStates;n.depthBiasConstant===t&&n.depthBiasClamp===e&&n.depthBiasSlope===i||(n.depthBiasConstant=t,n.depthBiasClamp=e,n.depthBiasSlope=i,this._isStateInvalied=!0)},i.setBlendConstants=function(t){var e=this._curDynamicStates.blendConstant;e.x===t.x&&e.y===t.y&&e.z===t.z&&e.w===t.w||(e.copy(t),this._isStateInvalied=!0)},i.setDepthBound=function(t,e){var i=this._curDynamicStates;i.depthMinBounds===t&&i.depthMaxBounds===e||(i.depthMinBounds=t,i.depthMaxBounds=e,this._isStateInvalied=!0)},i.setStencilWriteMask=function(t,e){var i=this._curDynamicStates.stencilStatesFront,n=this._curDynamicStates.stencilStatesBack;t&ar.FRONT&&i.writeMask!==e&&(i.writeMask=e,this._isStateInvalied=!0),t&ar.BACK&&n.writeMask!==e&&(n.writeMask=e,this._isStateInvalied=!0)},i.setStencilCompareMask=function(t,e,i){var n=this._curDynamicStates.stencilStatesFront,r=this._curDynamicStates.stencilStatesBack;t&ar.FRONT&&(n.compareMask===i&&n.reference===e||(n.reference=e,n.compareMask=i,this._isStateInvalied=!0)),t&ar.BACK&&(r.compareMask===i&&r.reference===e||(r.reference=e,r.compareMask=i,this._isStateInvalied=!0))},i.draw=function(t){if(this._type===lr.PRIMARY&&this._isInRenderPass||this._type===lr.SECONDARY){this._isStateInvalied&&this.bindStates();var e="drawInfo"in t?t.drawInfo:t,i=this._cmdAllocator.drawCmdPool.alloc(i4);i.drawInfo.copy(e),this.cmdPackage.drawCmds.push(i),this.cmdPackage.cmds.push(K3.DRAW),++this._numDrawCalls,this._numInstances+=e.instanceCount;var n=e.indexCount||e.vertexCount;if(this._curGPUPipelineState)switch(this._curGPUPipelineState.glPrimitive){case 4:this._numTris+=n/3*Math.max(e.instanceCount,1);break;case 5:case 6:this._numTris+=(n-2)*Math.max(e.instanceCount,1)}}else console.error("Command 'draw' must be recorded inside a render pass.")},i.updateBuffer=function(t,e,i){if(this._type===lr.PRIMARY&&!this._isInRenderPass||this._type===lr.SECONDARY){var n=t.gpuBuffer;if(n){var r,s=this._cmdAllocator.updateBufferCmdPool.alloc(n4),a=0;t.usage&Dn.INDIRECT||(a=void 0!==i?i:e.byteLength),r=e,s.gpuBuffer=n,s.buffer=r,s.offset=0,s.size=a,this.cmdPackage.updateBufferCmds.push(s),this.cmdPackage.cmds.push(K3.UPDATE_BUFFER)}}else console.error("Command 'updateBuffer' must be recorded outside a render pass.")},i.copyBuffersToTexture=function(t,e,i){if(this._type===lr.PRIMARY&&!this._isInRenderPass||this._type===lr.SECONDARY){var n=e.gpuTexture;if(n){var r=this._cmdAllocator.copyBufferToTextureCmdPool.alloc(r4);r.gpuTexture=n,r.regions=i,r.buffers=t,this.cmdPackage.copyBufferToTextureCmds.push(r),this.cmdPackage.cmds.push(K3.COPY_BUFFER_TO_TEXTURE)}}else console.error("Command 'copyBufferToTexture' must be recorded outside a render pass.")},i.execute=function(t,e){for(var i=0;i<e;++i){for(var n=t[i],r=0;r<n.cmdPackage.beginRenderPassCmds.length;++r){var s=n.cmdPackage.beginRenderPassCmds.array[r];++s.refCount,this.cmdPackage.beginRenderPassCmds.push(s)}for(var a=0;a<n.cmdPackage.bindStatesCmds.length;++a){var o=n.cmdPackage.bindStatesCmds.array[a];++o.refCount,this.cmdPackage.bindStatesCmds.push(o)}for(var u=0;u<n.cmdPackage.drawCmds.length;++u){var h=n.cmdPackage.drawCmds.array[u];++h.refCount,this.cmdPackage.drawCmds.push(h)}for(var l=0;l<n.cmdPackage.updateBufferCmds.length;++l){var c=n.cmdPackage.updateBufferCmds.array[l];++c.refCount,this.cmdPackage.updateBufferCmds.push(c)}for(var _=0;_<n.cmdPackage.copyBufferToTextureCmds.length;++_){var f=n.cmdPackage.copyBufferToTextureCmds.array[_];++f.refCount,this.cmdPackage.copyBufferToTextureCmds.push(f)}this.cmdPackage.cmds.concat(n.cmdPackage.cmds.array),this._numDrawCalls+=n._numDrawCalls,this._numInstances+=n._numInstances,this._numTris+=n._numTris}},i.pipelineBarrier=function(){},i.bindStates=function(){var t=this._cmdAllocator.bindStatesCmdPool.alloc(e4);t.gpuPipelineState=this._curGPUPipelineState,Array.prototype.push.apply(t.gpuDescriptorSets,this._curGPUDescriptorSets),Array.prototype.push.apply(t.dynamicOffsets,this._curDynamicOffsets),t.gpuInputAssembler=this._curGPUInputAssembler,t.dynamicStates=this._curDynamicStates,this.cmdPackage.bindStatesCmds.push(t),this.cmdPackage.cmds.push(K3.BIND_STATES),this._isStateInvalied=!1},e}(Fs),A4=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._gpuFramebuffer=null,e}c(e,t);var i=e.prototype;return i.initialize=function(t){this._renderPass=t.renderPass,this._colorTextures=t.colorTextures||[],this._depthStencilTexture=t.depthStencilTexture||null;for(var e=[],i=0;i<t.colorTextures.length;i++){var n=t.colorTextures[i];n&&e.push(n.gpuTextureView)}var r=null;t.depthStencilTexture&&(r=t.depthStencilTexture.gpuTextureView);var s=Number.MAX_SAFE_INTEGER;this._gpuFramebuffer={gpuRenderPass:t.renderPass.gpuRenderPass,gpuColorViews:e,gpuDepthStencilView:r,glFramebuffer:null,isOffscreen:!0,get width(){return this.isOffscreen?s:this.gpuColorViews.length>0?this.gpuColorViews[0].gpuTexture.width:this.gpuDepthStencilView.gpuTexture.width},set width(t){s=t},get height(){return this.isOffscreen?s:this.gpuColorViews.length>0?this.gpuColorViews[0].gpuTexture.height:this.gpuDepthStencilView.gpuTexture.height},set height(t){}},function(t,e){for(var i=0;i<e.gpuColorViews.length;++i)if(e.gpuColorViews[i].gpuTexture.isSwapchainTexture)return void(e.isOffscreen=!1);var n=t.gl,r=[],s=n.createFramebuffer();if(s){e.glFramebuffer=s,t.stateCache.glFramebuffer!==e.glFramebuffer&&n.bindFramebuffer(n.FRAMEBUFFER,e.glFramebuffer);for(var a=0;a<e.gpuColorViews.length;++a){var o=e.gpuColorViews[a],u=o.gpuTexture;u&&(u.glTexture?n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+a,u.glTarget,u.glTexture,o.baseLevel):n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+a,n.RENDERBUFFER,u.glRenderbuffer),r.push(n.COLOR_ATTACHMENT0+a),e.width=Math.min(e.width,u.width>>o.baseLevel),e.height=Math.min(e.height,u.height>>o.baseLevel))}var h=e.gpuDepthStencilView;if(h){var l=h.gpuTexture,c=As[l.format].hasStencil?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;l.glTexture?n.framebufferTexture2D(n.FRAMEBUFFER,c,l.glTarget,l.glTexture,e.gpuDepthStencilView.baseLevel):n.framebufferRenderbuffer(n.FRAMEBUFFER,c,n.RENDERBUFFER,l.glRenderbuffer),e.width=Math.min(e.width,l.width>>h.baseLevel),e.height=Math.min(e.height,l.height>>h.baseLevel)}n.drawBuffers(r);var _=n.checkFramebufferStatus(n.FRAMEBUFFER);if(_!==n.FRAMEBUFFER_COMPLETE)switch(_){case n.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:console.error("glCheckFramebufferStatus() - FRAMEBUFFER_INCOMPLETE_ATTACHMENT");break;case n.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:console.error("glCheckFramebufferStatus() - FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT");break;case n.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:console.error("glCheckFramebufferStatus() - FRAMEBUFFER_INCOMPLETE_DIMENSIONS");break;case n.FRAMEBUFFER_UNSUPPORTED:console.error("glCheckFramebufferStatus() - FRAMEBUFFER_UNSUPPORTED")}t.stateCache.glFramebuffer!==e.glFramebuffer&&n.bindFramebuffer(n.FRAMEBUFFER,t.stateCache.glFramebuffer)}}(k3.instance,this._gpuFramebuffer)},i.destroy=function(){var t,e;this._gpuFramebuffer&&(t=k3.instance,(e=this._gpuFramebuffer).glFramebuffer&&(t.gl.deleteFramebuffer(e.glFramebuffer),t.stateCache.glFramebuffer===e.glFramebuffer&&(t.gl.bindFramebuffer(t.gl.FRAMEBUFFER,null),t.stateCache.glFramebuffer=null),e.glFramebuffer=null),this._gpuFramebuffer=null)},h(e,[{key:"gpuFramebuffer",get:function(){return this._gpuFramebuffer}}]),e}(ks),R4=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._gpuInputAssembler=null,e}c(e,t);var i=e.prototype;return i.initialize=function(t){if(0!==t.vertexBuffers.length){if(this._attributes=t.attributes,this._attributesHash=this.computeAttributesHash(),this._vertexBuffers=t.vertexBuffers,t.indexBuffer)this._indexBuffer=t.indexBuffer,this._drawInfo.indexCount=this._indexBuffer.size/this._indexBuffer.stride,this._drawInfo.firstIndex=0;else{var e=this._vertexBuffers[0];this._drawInfo.vertexCount=e.size/e.stride,this._drawInfo.firstVertex=0,this._drawInfo.vertexOffset=0}this._drawInfo.instanceCount=0,this._drawInfo.firstInstance=0,this._indirectBuffer=t.indirectBuffer||null;for(var i=new Array(t.vertexBuffers.length),n=0;n<t.vertexBuffers.length;++n){var r=t.vertexBuffers[n];r.gpuBuffer&&(i[n]=r.gpuBuffer)}var s=null,a=0;if(t.indexBuffer&&(s=t.indexBuffer.gpuBuffer))switch(s.stride){case 1:a=5121;break;case 2:a=5123;break;case 4:a=5125;break;default:console.error("Illegal index buffer stride.")}var o=null;t.indirectBuffer&&(o=t.indirectBuffer.gpuBuffer),this._gpuInputAssembler={attributes:t.attributes,gpuVertexBuffers:i,gpuIndexBuffer:s,gpuIndirectBuffer:o,glAttribs:[],glIndexType:a,glVAOs:new Map},function(t,e){var i=t.gl;e.glAttribs=new Array(e.attributes.length);for(var n=[0,0,0,0,0,0,0,0],r=0;r<e.attributes.length;++r){var s=e.attributes[r],a=void 0!==s.stream?s.stream:0,o=e.gpuVertexBuffers[a],u=V3(s.format,i),h=As[s.format].size;e.glAttribs[r]={name:s.name,glBuffer:o.glBuffer,glType:u,size:h,count:As[s.format].count,stride:o.stride,componentCount:Y3(u,i),isNormalized:void 0!==s.isNormalized&&s.isNormalized,isInstanced:void 0!==s.isInstanced&&s.isInstanced,offset:n[a]},n[a]+=h}}(k3.instance,this._gpuInputAssembler)}else console.error("InputAssemblerInfo.vertexBuffers is null.")},i.destroy=function(){var t=k3.instance;this._gpuInputAssembler&&t.extensions.useVAO&&function(t,e){for(var i=e.glVAOs.values(),n=i.next(),r=t.gl,s=t.stateCache.glVAO;!n.done;)r.deleteVertexArray(n.value),s===n.value&&(r.bindVertexArray(null),s=null),n=i.next();t.stateCache.glVAO=s,e.glVAOs.clear()}(t,this._gpuInputAssembler),this._gpuInputAssembler=null},h(e,[{key:"gpuInputAssembler",get:function(){return this._gpuInputAssembler}}]),e}(Ws),b4=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._gpuDescriptorSetLayout=null,e}c(e,t);var i=e.prototype;return i.initialize=function(t){Array.prototype.push.apply(this._bindings,t.bindings);for(var e=0,i=-1,n=[],r=0;r<this._bindings.length;r++){var s=this._bindings[r];n.push(e),e+=s.count,s.binding>i&&(i=s.binding)}this._bindingIndices=Array(i+1).fill(-1);for(var a=this._descriptorIndices=Array(i+1).fill(-1),o=0;o<this._bindings.length;o++){var u=this._bindings[o];this._bindingIndices[u.binding]=o,a[u.binding]=n[o]}for(var h=[],l=0;l<this._bindings.length;l++){var c=this._bindings[l];if(c.descriptorType&Cs)for(var _=0;_<c.count;_++)h.push(c.binding)}this._gpuDescriptorSetLayout={bindings:this._bindings,dynamicBindings:h,descriptorIndices:a,descriptorCount:e}},i.destroy=function(){this._bindings.length=0},h(e,[{key:"gpuDescriptorSetLayout",get:function(){return this._gpuDescriptorSetLayout}}]),e}(js),C4=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._gpuPipelineLayout=null,e}c(e,t);var i=e.prototype;return i.initialize=function(t){Array.prototype.push.apply(this._setLayouts,t.setLayouts);for(var e=[],i=[],n=0,r=[],s=0;s<this._setLayouts.length;s++){for(var a=this._setLayouts[s],o=a.gpuDescriptorSetLayout.dynamicBindings,u=Array(a.bindingIndices.length).fill(-1),h=0;h<o.length;h++){var l=o[h];u[l]<0&&(u[l]=n+h)}i.push(a.gpuDescriptorSetLayout),e.push(u),r.push(n),n+=o.length}this._gpuPipelineLayout={gpuSetLayouts:i,dynamicOffsetIndices:e,dynamicOffsetCount:n,dynamicOffsetOffsets:r}},i.destroy=function(){this._setLayouts.length=0},h(e,[{key:"gpuPipelineLayout",get:function(){return this._gpuPipelineLayout}}]),e}(Ys),w4=[0,1,3,2,0,0,0,4,5,6,0,0,0,0],I4=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._gpuPipelineState=null,e}c(e,t);var i=e.prototype;return i.initialize=function(t){this._primitive=t.primitive,this._shader=t.shader,this._pipelineLayout=t.pipelineLayout;var e=this._bs;if(t.blendState){var i=t.blendState,n=i.targets;n&&n.forEach((function(t,i){e.setTarget(i,t)})),void 0!==i.isA2C&&(e.isA2C=i.isA2C),void 0!==i.isIndepend&&(e.isIndepend=i.isIndepend),void 0!==i.blendColor&&(e.blendColor=i.blendColor)}Object.assign(this._rs,t.rasterizerState),Object.assign(this._dss,t.depthStencilState),this._is=t.inputState,this._renderPass=t.renderPass,this._dynamicStates=t.dynamicStates;for(var r=[],s=0;s<31;s++)this._dynamicStates&1<<s&&r.push(1<<s);this._gpuPipelineState={glPrimitive:w4[t.primitive],gpuShader:t.shader.gpuShader,gpuPipelineLayout:t.pipelineLayout.gpuPipelineLayout,rs:t.rasterizerState,dss:t.depthStencilState,bs:t.blendState,gpuRenderPass:t.renderPass.gpuRenderPass,dynamicStates:r}},i.destroy=function(){this._gpuPipelineState=null},h(e,[{key:"gpuPipelineState",get:function(){return this._gpuPipelineState}}]),e}($s),O4=function(t){function e(){return t.apply(this,arguments)||this}c(e,t);var i=e.prototype;return i.beginRenderPass=function(t,e,i,n,r,s){l4(k3.instance,t.gpuRenderPass,e.gpuFramebuffer,i,n,r,s),this._isInRenderPass=!0},i.draw=function(t){if(this._isInRenderPass){this._isStateInvalied&&this.bindStates();var e="drawInfo"in t?t.drawInfo:t;_4(k3.instance,e),++this._numDrawCalls,this._numInstances+=e.instanceCount;var i=e.indexCount||e.vertexCount;if(this._curGPUPipelineState)switch(this._curGPUPipelineState.glPrimitive){case 4:this._numTris+=i/3*Math.max(e.instanceCount,1);break;case 5:case 6:this._numTris+=(i-2)*Math.max(e.instanceCount,1)}}else console.error("Command 'draw' must be recorded inside a render pass.")},i.setViewport=function(t){var e=k3.instance,i=e.stateCache,n=e.gl;i.viewport.left===t.left&&i.viewport.top===t.top&&i.viewport.width===t.width&&i.viewport.height===t.height||(n.viewport(t.left,t.top,t.width,t.height),i.viewport.left=t.left,i.viewport.top=t.top,i.viewport.width=t.width,i.viewport.height=t.height)},i.setScissor=function(t){var e=k3.instance,i=e.stateCache,n=e.gl;i.scissorRect.x===t.x&&i.scissorRect.y===t.y&&i.scissorRect.width===t.width&&i.scissorRect.height===t.height||(n.scissor(t.x,t.y,t.width,t.height),i.scissorRect.x=t.x,i.scissorRect.y=t.y,i.scissorRect.width=t.width,i.scissorRect.height=t.height)},i.updateBuffer=function(t,e,i){if(this._isInRenderPass)console.error("Command 'updateBuffer' must be recorded outside a render pass.");else{var n,r=t.gpuBuffer;r&&(n=void 0!==i?i:t.usage&Dn.INDIRECT?0:e.byteLength,a4(k3.instance,r,e,0,n))}},i.copyBuffersToTexture=function(t,e,i){if(this._isInRenderPass)console.error("Command 'copyBufferToTexture' must be recorded outside a render pass.");else{var n=e.gpuTexture;n&&g4(k3.instance,t,n,i)}},i.execute=function(t,e){for(var i=0;i<e;++i){var n=t[i];d4(k3.instance,n.cmdPackage),this._numDrawCalls+=n._numDrawCalls,this._numInstances+=n._numInstances,this._numTris+=n._numTris}},i.bindStates=function(){c4(k3.instance,this._curGPUPipelineState,this._curGPUInputAssembler,this._curGPUDescriptorSets,this._curDynamicOffsets,this._curDynamicStates),this._isStateInvalied=!1},e}(S4),x4=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).numDrawCalls=0,e.numInstances=0,e.numTris=0,e}c(e,t);var i=e.prototype;return i.initialize=function(t){this._type=t.type},i.destroy=function(){},i.submit=function(t){for(var e=0;e<t.length;e++){var i=t[e];this.numDrawCalls+=i.numDrawCalls,this.numInstances+=i.numInstances,this.numTris+=i.numTris}},i.clear=function(){this.numDrawCalls=0,this.numInstances=0,this.numTris=0},e}(ta),P4=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._gpuRenderPass=null,e}c(e,t);var i=e.prototype;return i.initialize=function(t){this._colorInfos=t.colorAttachments,this._depthStencilInfo=t.depthStencilAttachment,this._subpasses=t.subpasses,this._gpuRenderPass={colorAttachments:this._colorInfos,depthStencilAttachment:this._depthStencilInfo},this._hash=this.computeHash()},i.destroy=function(){this._gpuRenderPass=null},h(e,[{key:"gpuRenderPass",get:function(){return this._gpuRenderPass}}]),e}(ea),D4=function(t){function e(e,i){var n,r,s,a;return(n=t.call(this,e,i)||this)._gpuSampler=null,n._gpuSampler={glSamplers:new Map,minFilter:n._info.minFilter,magFilter:n._info.magFilter,mipFilter:n._info.mipFilter,addressU:n._info.addressU,addressV:n._info.addressV,addressW:n._info.addressW,glMinFilter:0,glMagFilter:0,glWrapS:0,glWrapT:0,glWrapR:0,getGLSampler:function(t,e,i){var n=t.gl,r=e<<16|i;if(!this.glSamplers.has(r)){var s=n.createSampler();s&&(this.glSamplers.set(r,s),n.samplerParameteri(s,n.TEXTURE_MIN_FILTER,this.glMinFilter),n.samplerParameteri(s,n.TEXTURE_MAG_FILTER,this.glMagFilter),n.samplerParameteri(s,n.TEXTURE_WRAP_S,this.glWrapS),n.samplerParameteri(s,n.TEXTURE_WRAP_T,this.glWrapT),n.samplerParameteri(s,n.TEXTURE_WRAP_R,this.glWrapR),n.samplerParameterf(s,n.TEXTURE_MIN_LOD,e),n.samplerParameterf(s,n.TEXTURE_MAX_LOD,i))}return this.glSamplers.get(r)}},r=k3.instance,s=n._gpuSampler,a=r.gl,s.minFilter===Hn.LINEAR||s.minFilter===Hn.ANISOTROPIC?s.mipFilter===Hn.LINEAR||s.mipFilter===Hn.ANISOTROPIC?s.glMinFilter=a.LINEAR_MIPMAP_LINEAR:s.mipFilter===Hn.POINT?s.glMinFilter=a.LINEAR_MIPMAP_NEAREST:s.glMinFilter=a.LINEAR:s.mipFilter===Hn.LINEAR||s.mipFilter===Hn.ANISOTROPIC?s.glMinFilter=a.NEAREST_MIPMAP_LINEAR:s.mipFilter===Hn.POINT?s.glMinFilter=a.NEAREST_MIPMAP_NEAREST:s.glMinFilter=a.NEAREST,s.magFilter===Hn.LINEAR||s.magFilter===Hn.ANISOTROPIC?s.glMagFilter=a.LINEAR:s.glMagFilter=a.NEAREST,s.glWrapS=z3[s.addressU],s.glWrapT=z3[s.addressV],s.glWrapR=z3[s.addressW],n}return c(e,t),e.prototype.destroy=function(){this._gpuSampler&&(function(t,e){for(var i=t.gl,n=e.glSamplers.values().next();!n.done;){i.deleteSampler(n.value);for(var r=t.stateCache.glSamplerUnits,s=0;s<r.length;++s)r[s]===n.value&&(i.bindSampler(s,null),r[s]=null)}e.glSamplers.clear()}(k3.instance,this._gpuSampler),this._gpuSampler=null)},h(e,[{key:"gpuSampler",get:function(){return this._gpuSampler}}]),e}(ia),B4=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._gpuShader=null,e}c(e,t);var i=e.prototype;return i.initialize=function(t){this._name=t.name,this._stages=t.stages,this._attributes=t.attributes,this._blocks=t.blocks,this._samplers=t.samplers,this._gpuShader={name:t.name,blocks:t.blocks.slice(),samplerTextures:t.samplerTextures.slice(),subpassInputs:t.subpassInputs.slice(),gpuStages:new Array(t.stages.length),glProgram:null,glInputs:[],glUniforms:[],glBlocks:[],glSamplerTextures:[]};for(var e=0;e<t.stages.length;++e){var i=t.stages[e];this._gpuShader.gpuStages[e]={type:i.stage,source:i.source,glShader:null}}},i.destroy=function(){var t,e;this._gpuShader&&(t=k3.instance,(e=this._gpuShader).glProgram&&(t.gl.deleteProgram(e.glProgram),t.stateCache.glProgram===e.glProgram&&(t.gl.useProgram(null),t.stateCache.glProgram=null),e.glProgram=null),this._gpuShader=null)},h(e,[{key:"gpuShader",get:function(){return null===this._gpuShader.glProgram&&function(t,e){for(var i=t.gl,n=function(t){var n=e.gpuStages[t],r=0,s="",a=1;switch(n.type){case qn.VERTEX:s="VertexShader",r=i.VERTEX_SHADER;break;case qn.FRAGMENT:s="FragmentShader",r=i.FRAGMENT_SHADER;break;default:return console.error("Unsupported ShaderType."),{v:void 0}}var o=i.createShader(r);if(o&&(n.glShader=o,i.shaderSource(n.glShader,"#version 300 es\n"+n.source),i.compileShader(n.glShader),!i.getShaderParameter(n.glShader,i.COMPILE_STATUS))){console.error(s+" in '"+e.name+"' compilation failed."),console.error("Shader source dump:",n.source.replace(/^|\n/g,(function(){return"\n"+a+++" "}))),console.error(i.getShaderInfoLog(n.glShader));for(var u=0;u<e.gpuStages.length;u++){var h=e.gpuStages[t];h.glShader&&(i.deleteShader(h.glShader),h.glShader=null)}return{v:void 0}}},r=0;r<e.gpuStages.length;r++){var s=n(r);if("object"==typeof s)return s.v}var a=i.createProgram();if(a){e.glProgram=a;for(var o=0;o<e.gpuStages.length;o++){var u=e.gpuStages[o];i.attachShader(e.glProgram,u.glShader)}i.linkProgram(e.glProgram);for(var h=0;h<e.gpuStages.length;h++){var l=e.gpuStages[h];l.glShader&&(i.detachShader(e.glProgram,l.glShader),i.deleteShader(l.glShader),l.glShader=null)}if(!i.getProgramParameter(e.glProgram,i.LINK_STATUS))return console.error("Failed to link shader '"+e.name+"'."),void console.error(i.getProgramInfoLog(e.glProgram));G("Shader '"+e.name+"' compilation succeeded.");var c=i.getProgramParameter(e.glProgram,i.ACTIVE_ATTRIBUTES);e.glInputs=new Array(c);for(var _=0;_<c;++_){var f=i.getActiveAttrib(e.glProgram,_);if(f){var d,p=f.name.indexOf("[");d=-1!==p?f.name.substr(0,p):f.name;var m=i.getAttribLocation(e.glProgram,d),g=X3(f.type,i),v=j3(f.type,i);e.glInputs[_]={name:d,type:g,stride:v,count:f.size,size:v*f.size,glType:f.type,glLoc:m}}}var y,E,T,S,A=i.getProgramParameter(e.glProgram,i.ACTIVE_UNIFORM_BLOCKS);if(A){e.glBlocks=new Array(A);for(var R=0;R<A;++R){var b=(y=i.getActiveUniformBlockName(e.glProgram,R)).indexOf("[");-1!==b&&(y=y.substr(0,b)),S=null;for(var C=0;C<e.blocks.length;C++)if(e.blocks[C].name===y){S=e.blocks[C];break}if(S){E=R,T=i.getActiveUniformBlockParameter(e.glProgram,E,i.UNIFORM_BLOCK_DATA_SIZE);var w=S.binding+(t.bindingMappings.blockOffsets[S.set]||0);i.uniformBlockBinding(e.glProgram,E,w),e.glBlocks[R]={set:S.set,binding:S.binding,idx:E,name:y,size:T,glBinding:w}}else F("Block '"+y+"' does not bound")}}for(var I=0;I<e.subpassInputs.length;++I){var O=e.subpassInputs[I];e.samplerTextures.push(new Xr(O.set,O.binding,O.name,Pn.SAMPLER2D,O.count))}if(e.samplerTextures.length>0){e.glSamplerTextures=new Array(e.samplerTextures.length);for(var x=0;x<e.samplerTextures.length;++x){var P=e.samplerTextures[x];e.glSamplerTextures[x]={set:P.set,binding:P.binding,name:P.name,type:P.type,count:P.count,units:[],glUnits:null,glType:W3(P.type,i),glLoc:null}}}for(var D=[],B=[],N=t.stateCache.texUnitCacheMap,M=0,L=0;L<e.blocks.length;++L)e.blocks[L].set===t.bindingMappings.flexibleSet&&M++;for(var U=0,k=0;k<e.samplerTextures.length;++k){var z=e.samplerTextures[k],H=i.getUniformLocation(e.glProgram,z.name);if(H&&-1!==H.id&&(D.push(e.glSamplerTextures[k]),B.push(H)),void 0===N[z.name]){var V=z.binding+t.bindingMappings.samplerTextureOffsets[z.set]+U;z.set===t.bindingMappings.flexibleSet&&(V-=M),N[z.name]=V%t.capabilities.maxTextureUnits,U+=z.count-1}}if(D.length){for(var W=[],X=0;X<D.length;++X){var j=D[X],Y=N[j.name];if(void 0!==Y){j.glLoc=B[X];for(var K=0;K<j.count;++K){for(;W[Y];)Y=(Y+1)%t.capabilities.maxTextureUnits;j.units.push(Y),W[Y]=!0}}}for(var q=0,Q=0;Q<D.length;++Q){var Z=D[Q];if(!Z.glLoc){for(Z.glLoc=B[Q];W[q];)q++;for(var J=0;J<Z.count;++J){for(;W[q];)q=(q+1)%t.capabilities.maxTextureUnits;void 0===N[Z.name]&&(N[Z.name]=q),Z.units.push(q),W[q]=!0}}}t.stateCache.glProgram!==e.glProgram&&i.useProgram(e.glProgram);for(var $=0;$<D.length;$++){var tt=D[$];tt.glUnits=new Int32Array(tt.units),i.uniform1iv(tt.glLoc,tt.glUnits)}t.stateCache.glProgram!==e.glProgram&&i.useProgram(t.stateCache.glProgram)}e.glSamplerTextures=D}}(k3.instance,this._gpuShader),this._gpuShader}}]),e}(na),N4=function(){function t(){this.glArrayBuffer=null,this.glElementArrayBuffer=null,this.glUniformBuffer=null,this.glBindUBOs=[],this.glBindUBOOffsets=[],this.glVAO=null,this.texUnit=0,this.glTexUnits=[],this.glSamplerUnits=[],this.glRenderbuffer=null,this.glFramebuffer=null,this.glReadFramebuffer=null,this.viewport=new Or,this.scissorRect=new Sr(0,0,0,0),this.rs=new Ks,this.dss=new qs,this.bs=new Zs,this.glProgram=null,this.glEnabledAttribLocs=[],this.glCurrentAttribLocs=[],this.texUnitCacheMap={}}return t.prototype.initialize=function(t,e,i){for(var n=0;n<t;++n)this.glTexUnits.push({glTexture:null});this.glSamplerUnits.length=t,this.glSamplerUnits.fill(null),this.glBindUBOs.length=e,this.glBindUBOs.fill(null),this.glBindUBOOffsets.length=e,this.glBindUBOOffsets.fill(0),this.glEnabledAttribLocs.length=i,this.glEnabledAttribLocs.fill(!1),this.glCurrentAttribLocs.length=i,this.glCurrentAttribLocs.fill(!1)},t}(),M4=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._gpuTexture=null,e._gpuTextureView=null,e}c(e,t);var i=e.prototype;return i.initialize=function(t,e){var i=t,n=t;if("texture"in t&&(i=n.texture.info,this._isTextureView=!0),this._info.copy(i),this._isPowerOf2=ws(this._info.width)&&ws(this._info.height),this._size=Os(this._info.format,this.width,this.height,this.depth,this._info.levelCount)*this._info.layerCount,this._isTextureView){var r;if(this._viewInfo.copy(n),this._gpuTexture=n.texture._gpuTexture,(null===(r=this._gpuTexture)||void 0===r?void 0:r.format)!==i.format)return void console.log("GPU memory alias is not supported");this._gpuTextureView={gpuTexture:this._gpuTexture,type:n.type,format:n.format,baseLevel:n.baseLevel,levelCount:n.levelCount}}else this._gpuTexture={type:i.type,format:i.format,usage:i.usage,width:i.width,height:i.height,depth:i.depth,size:this._size,arrayLayer:i.layerCount,mipLevel:i.levelCount,samples:i.samples,flags:i.flags,isPowerOf2:this._isPowerOf2,glTarget:0,glInternalFmt:0,glFormat:0,glType:0,glUsage:0,glTexture:null,glRenderbuffer:null,glWrapS:0,glWrapT:0,glMinFilter:0,glMagFilter:0,isSwapchainTexture:e||!1},o4(k3.instance,this._gpuTexture),k3.instance.memoryStatus.textureSize+=this._size,this._viewInfo.texture=this,this._viewInfo.type=t.type,this._viewInfo.format=t.format,this._viewInfo.baseLevel=0,this._viewInfo.levelCount=t.levelCount,this._viewInfo.baseLayer=0,this._viewInfo.layerCount=t.layerCount,this._gpuTextureView={gpuTexture:this._gpuTexture,type:this._viewInfo.type,format:this._viewInfo.format,baseLevel:this._viewInfo.baseLevel,levelCount:this._viewInfo.levelCount}},i.destroy=function(){!this._isTextureView&&this._gpuTexture&&(u4(k3.instance,this._gpuTexture),k3.instance.memoryStatus.textureSize-=this._size,this._gpuTexture=null)},i.resize=function(t,i){if(this._info.width!==t||this._info.height!==i){this._info.levelCount===e.getLevelCount(this._info.width,this._info.height)?this._info.levelCount=e.getLevelCount(t,i):this._info.levelCount>1&&(this._info.levelCount=Math.min(this._info.levelCount,e.getLevelCount(t,i)));var n=this._size;this._info.width=t,this._info.height=i,this._size=Os(this._info.format,this.width,this.height,this.depth,this._info.levelCount)*this._info.layerCount,!this._isTextureView&&this._gpuTexture&&(this._gpuTexture.width=t,this._gpuTexture.height=i,this._gpuTexture.size=this._size,function(t,e){if(e.size){var i=t.gl,n=e.width,r=e.height;switch(e.type){case Ln.TEX2D:e.glTarget=i.TEXTURE_2D;var s=Math.max(n,r);if(s>t.capabilities.maxTextureSize&&K(9100,s,t.capabilities.maxTextureSize),e.samples===kn.ONE){var a=t.stateCache.glTexUnits[t.stateCache.texUnit];if(a.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_2D,e.glTexture),a.glTexture=e.glTexture),As[e.format].isCompressed)for(var o=0;o<e.mipLevel;++o){var u=Is(e.format,n,r,1),h=new Uint8Array(u);i.compressedTexImage2D(i.TEXTURE_2D,o,e.glInternalFmt,n,r,0,h),n=Math.max(1,n>>1),r=Math.max(1,r>>1)}else u4(t,e),o4(t,e)}else e.glRenderbuffer&&(t.stateCache.glRenderbuffer!==e.glRenderbuffer&&(i.bindRenderbuffer(i.RENDERBUFFER,e.glRenderbuffer),t.stateCache.glRenderbuffer=e.glRenderbuffer),i.renderbufferStorageMultisample(i.RENDERBUFFER,e.samples,e.glInternalFmt,e.width,e.height));break;case Ln.CUBE:e.type=Ln.CUBE,e.glTarget=i.TEXTURE_CUBE_MAP;var l=Math.max(n,r);l>t.capabilities.maxCubeMapTextureSize&&K(9100,l,t.capabilities.maxTextureSize);var c=t.stateCache.glTexUnits[t.stateCache.texUnit];if(c.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_CUBE_MAP,e.glTexture),c.glTexture=e.glTexture),As[e.format].isCompressed)for(var _=0;_<6;++_){n=e.width,r=e.height;for(var f=0;f<e.mipLevel;++f){var d=Is(e.format,n,r,1),p=new Uint8Array(d);i.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+_,f,e.glInternalFmt,n,r,0,p),n=Math.max(1,n>>1),r=Math.max(1,r>>1)}}else u4(t,e),o4(t,e);break;default:console.error("Unsupported TextureType, create texture failed."),e.type=Ln.TEX2D,e.glTarget=i.TEXTURE_2D}}}(k3.instance,this._gpuTexture),k3.instance.memoryStatus.textureSize-=n,k3.instance.memoryStatus.textureSize+=this._size)}},i.initAsSwapchainTexture=function(t){var e=new kr;e.format=t.format,e.usage=As[t.format].hasDepth?Fn.DEPTH_STENCIL_ATTACHMENT:Fn.COLOR_ATTACHMENT,e.width=t.width,e.height=t.height,this.initialize(e,!0)},h(e,[{key:"gpuTexture",get:function(){return this._gpuTexture}},{key:"gpuTextureView",get:function(){return this._gpuTextureView}}]),e}(ra),L4="webglcontextlost";function F4(t,e){for(var i=["","WEBKIT_","MOZ_"],n=0;n<i.length;++n){var r=t.getExtension(i[n]+e);if(r)return r}return null}function U4(t){var e={EXT_texture_filter_anisotropic:F4(t,"EXT_texture_filter_anisotropic"),EXT_color_buffer_half_float:F4(t,"EXT_color_buffer_half_float"),EXT_color_buffer_float:F4(t,"EXT_color_buffer_float"),WEBGL_compressed_texture_etc1:F4(t,"WEBGL_compressed_texture_etc1"),WEBGL_compressed_texture_etc:F4(t,"WEBGL_compressed_texture_etc"),WEBGL_compressed_texture_pvrtc:F4(t,"WEBGL_compressed_texture_pvrtc"),WEBGL_compressed_texture_astc:F4(t,"WEBGL_compressed_texture_astc"),WEBGL_compressed_texture_s3tc:F4(t,"WEBGL_compressed_texture_s3tc"),WEBGL_compressed_texture_s3tc_srgb:F4(t,"WEBGL_compressed_texture_s3tc_srgb"),WEBGL_debug_shaders:F4(t,"WEBGL_debug_shaders"),WEBGL_lose_context:F4(t,"WEBGL_lose_context"),WEBGL_debug_renderer_info:F4(t,"WEBGL_debug_renderer_info"),OES_texture_half_float_linear:F4(t,"OES_texture_half_float_linear"),OES_texture_float_linear:F4(t,"OES_texture_float_linear"),WEBGL_multi_draw:null,useVAO:!0};return Ha.os!==Fa.ANDROID&&Ha.os!==Fa.IOS&&(e.WEBGL_multi_draw=F4(t,"WEBGL_multi_draw")),e}var G4=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).stateCache=new N4,e.nullTex2D=null,e.nullTexCube=null,e._canvas=null,e._webGL2ContextLostHandler=null,e._extensions=null,e}c(e,t);var i=e.prototype;return i.initialize=function(t){this._canvas=t.windowHandle,this._webGL2ContextLostHandler=this._onWebGLContextLost.bind(this),this._canvas.addEventListener(L4,this._onWebGLContextLost);var e=k3.instance.gl;this.stateCache.initialize(k3.instance.capabilities.maxTextureUnits,k3.instance.capabilities.maxUniformBufferBindings,k3.instance.capabilities.maxVertexAttributes),this._extensions=U4(e),function(t){t.activeTexture(t.TEXTURE0),t.pixelStorei(t.PACK_ALIGNMENT,1),t.pixelStorei(t.UNPACK_ALIGNMENT,1),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,!1),t.bindFramebuffer(t.FRAMEBUFFER,null),t.enable(t.SCISSOR_TEST),t.enable(t.CULL_FACE),t.cullFace(t.BACK),t.frontFace(t.CCW),t.polygonOffset(0,0),t.enable(t.DEPTH_TEST),t.depthMask(!0),t.depthFunc(t.LESS),t.stencilFuncSeparate(t.FRONT,t.ALWAYS,1,65535),t.stencilOpSeparate(t.FRONT,t.KEEP,t.KEEP,t.KEEP),t.stencilMaskSeparate(t.FRONT,65535),t.stencilFuncSeparate(t.BACK,t.ALWAYS,1,65535),t.stencilOpSeparate(t.BACK,t.KEEP,t.KEEP,t.KEEP),t.stencilMaskSeparate(t.BACK,65535),t.disable(t.STENCIL_TEST),t.disable(t.SAMPLE_ALPHA_TO_COVERAGE),t.disable(t.BLEND),t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.ONE,t.ZERO,t.ONE,t.ZERO),t.colorMask(!0,!0,!0,!0),t.blendColor(0,0,0,0)}(e);var i=On.RGBA8,n=On.DEPTH_STENCIL,r=e.getParameter(e.DEPTH_BITS),s=e.getParameter(e.STENCIL_BITS);r&&s?n=On.DEPTH_STENCIL:r&&(n=On.DEPTH),this._colorTexture=new M4,this._colorTexture.initAsSwapchainTexture({swapchain:this,format:i,width:t.width,height:t.height}),this._depthStencilTexture=new M4,this._depthStencilTexture.initAsSwapchainTexture({swapchain:this,format:n,width:t.width,height:t.height}),this.nullTex2D=k3.instance.createTexture(new kr(Ln.TEX2D,Fn.SAMPLED,On.RGBA8,2,2,Un.NONE)),this.nullTexCube=k3.instance.createTexture(new kr(Ln.CUBE,Fn.SAMPLED,On.RGBA8,2,2,Un.NONE,6));var a=new Ir;a.texExtent.width=2,a.texExtent.height=2;var o=new Uint8Array(this.nullTex2D.size);o.fill(0),k3.instance.copyBuffersToTexture([o],this.nullTex2D,[a]),a.texSubres.layerCount=6,k3.instance.copyBuffersToTexture([o,o,o,o,o,o],this.nullTexCube,[a])},i.destroy=function(){this._canvas&&this._webGL2ContextLostHandler&&(this._canvas.removeEventListener(L4,this._webGL2ContextLostHandler),this._webGL2ContextLostHandler=null),this.nullTex2D&&(this.nullTex2D.destroy(),this.nullTex2D=null),this.nullTexCube&&(this.nullTexCube.destroy(),this.nullTexCube=null),this._extensions=null,this._canvas=null},i.resize=function(t,e){this._colorTexture.width===t&&this._colorTexture.height===e||(G("Resizing swapchain: "+t+"x"+e),this._canvas.width=t,this._canvas.height=e,this._colorTexture.resize(t,e),this._depthStencilTexture.resize(t,e))},i._onWebGLContextLost=function(t){j(11e3),L(t)},h(e,[{key:"extensions",get:function(){return this._extensions}}]),e}(Gs),k4=t("WebGL2Device",function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._swapchain=null,e._context=null,e._bindingMappings=null,e._textureExclusive=new Array(On.COUNT),e}c(e,t);var i=e.prototype;return i.initialize=function(t){k3.setInstance(this),this._gfxAPI=Cn.WEBGL2;var e=this._bindingMappingInfo=t.bindingMappingInfo,i=[],n=[],r=e.setIndices[0];i[r]=0,n[r]=0;for(var s=1;s<e.setIndices.length;++s){var a=e.setIndices[s],o=e.setIndices[s-1];i[a]=e.maxBlockCounts[o]+i[o],n[a]=e.maxSamplerTextureCounts[o]+n[o]}for(var u=0;u<e.setIndices.length;++u){var h=e.setIndices[u];n[h]-=e.maxBlockCounts[h]}this._bindingMappings={blockOffsets:i,samplerTextureOffsets:n,flexibleSet:e.setIndices[e.setIndices.length-1]};var l=this._context=function(t){var e=null;try{var i={alpha:Ee.ENABLE_TRANSPARENT_CANVAS,antialias:Ee.ENABLE_WEBGL_ANTIALIAS,depth:!0,stencil:!0,premultipliedAlpha:!1,preserveDrawingBuffer:!1,powerPreference:"default",failIfMajorPerformanceCaveat:!1};e=t.getContext("webgl2",i)}catch(t){return null}return e}(Us.canvas);if(!l)return console.error("This device does not support WebGL."),!1;this._queue=this.createQueue(new ms(ur.GRAPHICS)),this._cmdBuff=this.createCommandBuffer(new ps(this._queue)),this._caps.maxVertexAttributes=l.getParameter(l.MAX_VERTEX_ATTRIBS),this._caps.maxVertexUniformVectors=l.getParameter(l.MAX_VERTEX_UNIFORM_VECTORS),this._caps.maxFragmentUniformVectors=l.getParameter(l.MAX_FRAGMENT_UNIFORM_VECTORS),this._caps.maxTextureUnits=l.getParameter(l.MAX_TEXTURE_IMAGE_UNITS),this._caps.maxVertexTextureUnits=l.getParameter(l.MAX_VERTEX_TEXTURE_IMAGE_UNITS),this._caps.maxUniformBufferBindings=l.getParameter(l.MAX_UNIFORM_BUFFER_BINDINGS),this._caps.maxUniformBlockSize=l.getParameter(l.MAX_UNIFORM_BLOCK_SIZE),this._caps.maxTextureSize=l.getParameter(l.MAX_TEXTURE_SIZE),this._caps.maxCubeMapTextureSize=l.getParameter(l.MAX_CUBE_MAP_TEXTURE_SIZE),this._caps.uboOffsetAlignment=l.getParameter(l.UNIFORM_BUFFER_OFFSET_ALIGNMENT);var c=l.getSupportedExtensions(),_="";if(c)for(var f,d=y(c);!(f=d()).done;)_+=f.value+" ";var p=U4(l);p.WEBGL_debug_renderer_info?(this._renderer=l.getParameter(p.WEBGL_debug_renderer_info.UNMASKED_RENDERER_WEBGL),this._vendor=l.getParameter(p.WEBGL_debug_renderer_info.UNMASKED_VENDOR_WEBGL)):(this._renderer=l.getParameter(l.RENDERER),this._vendor=l.getParameter(l.VENDOR));var m=l.getParameter(l.VERSION);this._features.fill(!1),this.initFormatFeatures(p),this._features[In.ELEMENT_INDEX_UINT]=!0,this._features[In.INSTANCED_ARRAYS]=!0,this._features[In.MULTIPLE_RENDER_TARGETS]=!0,this._features[In.BLEND_MINMAX]=!0;var g="";return this.getFormatFeatures(On.ETC_RGB8)&&(g+="etc1 "),this.getFormatFeatures(On.ETC2_RGB8)&&(g+="etc2 "),this.getFormatFeatures(On.BC1)&&(g+="dxt "),this.getFormatFeatures(On.PVRTC_RGB2)&&(g+="pvrtc "),this.getFormatFeatures(On.ASTC_RGBA_4X4)&&(g+="astc "),G("WebGL2 device initialized."),G("RENDERER: "+this._renderer),G("VENDOR: "+this._vendor),G("VERSION: "+m),G("COMPRESSED_FORMAT: "+g),G("EXTENSIONS: "+_),!0},i.destroy=function(){this._queue&&(this._queue.destroy(),this._queue=null),this._cmdBuff&&(this._cmdBuff.destroy(),this._cmdBuff=null);for(var t=this._samplers.values(),e=t.next();!e.done;)e.value.destroy(),e=t.next();this._swapchain=null},i.flushCommands=function(){},i.acquire=function(){},i.present=function(){var t=this._queue;this._numDrawCalls=t.numDrawCalls,this._numInstances=t.numInstances,this._numTris=t.numTris,t.clear()},i.initFormatFeatures=function(t){this._formatFeatures.fill(Gn.NONE),this._textureExclusive.fill(!0);var e=Gn.RENDER_TARGET|Gn.SAMPLED_TEXTURE|Gn.STORAGE_TEXTURE|Gn.LINEAR_FILTER|Gn.VERTEX_ATTRIBUTE;this._formatFeatures[On.R8]=e,this._formatFeatures[On.RG8]=e,this._formatFeatures[On.RGB8]=e,this._formatFeatures[On.RGBA8]=e,e=Gn.RENDER_TARGET|Gn.SAMPLED_TEXTURE|Gn.STORAGE_TEXTURE|Gn.LINEAR_FILTER,this._formatFeatures[On.R8SN]=e,this._formatFeatures[On.RG8SN]=e,this._formatFeatures[On.RGB8SN]=e,this._formatFeatures[On.RGBA8SN]=e,this._formatFeatures[On.R5G6B5]=e,this._formatFeatures[On.RGBA4]=e,this._formatFeatures[On.RGB5A1]=e,this._formatFeatures[On.RGB10A2]=e,this._formatFeatures[On.SRGB8]=e,this._formatFeatures[On.SRGB8_A8]=e,this._formatFeatures[On.R11G11B10F]=e,this._formatFeatures[On.RGB9E5]=e,this._formatFeatures[On.DEPTH]=e,this._formatFeatures[On.DEPTH_STENCIL]=e,this._formatFeatures[On.RGB10A2UI]=Gn.RENDER_TARGET|Gn.STORAGE_TEXTURE|Gn.SAMPLED_TEXTURE|Gn.LINEAR_FILTER,e=Gn.RENDER_TARGET|Gn.SAMPLED_TEXTURE|Gn.STORAGE_TEXTURE|Gn.VERTEX_ATTRIBUTE,this._formatFeatures[On.R16F]=e,this._formatFeatures[On.RG16F]=e,this._formatFeatures[On.RGB16F]=e,this._formatFeatures[On.RGBA16F]=e,e=Gn.STORAGE_TEXTURE|Gn.SAMPLED_TEXTURE|Gn.VERTEX_ATTRIBUTE,this._formatFeatures[On.R32F]=e,this._formatFeatures[On.RG32F]=e,this._formatFeatures[On.RGB32F]=e,this._formatFeatures[On.RGBA32F]=e,this._formatFeatures[On.RGB10A2UI]=Gn.RENDER_TARGET|Gn.STORAGE_TEXTURE|Gn.SAMPLED_TEXTURE|Gn.LINEAR_FILTER,e=Gn.RENDER_TARGET|Gn.STORAGE_TEXTURE|Gn.SAMPLED_TEXTURE|Gn.LINEAR_FILTER|Gn.VERTEX_ATTRIBUTE,this._formatFeatures[On.R8I]=e,this._formatFeatures[On.R8UI]=e,this._formatFeatures[On.R16I]=e,this._formatFeatures[On.R16UI]=e,this._formatFeatures[On.R32I]=e,this._formatFeatures[On.R32UI]=e,this._formatFeatures[On.RG8I]=e,this._formatFeatures[On.RG8UI]=e,this._formatFeatures[On.RG16I]=e,this._formatFeatures[On.RG16UI]=e,this._formatFeatures[On.RG32I]=e,this._formatFeatures[On.RG32UI]=e,this._formatFeatures[On.RGB8I]=e,this._formatFeatures[On.RGB8UI]=e,this._formatFeatures[On.RGB16I]=e,this._formatFeatures[On.RGB16UI]=e,this._formatFeatures[On.RGB32I]=e,this._formatFeatures[On.RGB32UI]=e,this._formatFeatures[On.RGBA8I]=e,this._formatFeatures[On.RGBA8UI]=e,this._formatFeatures[On.RGBA16I]=e,this._formatFeatures[On.RGBA16UI]=e,this._formatFeatures[On.RGBA32I]=e,this._formatFeatures[On.RGBA32UI]=e,this._textureExclusive[On.R8]=!1,this._textureExclusive[On.RG8]=!1,this._textureExclusive[On.RGB8]=!1,this._textureExclusive[On.R5G6B5]=!1,this._textureExclusive[On.RGBA4]=!1,this._textureExclusive[On.RGB5A1]=!1,this._textureExclusive[On.RGBA8]=!1,this._textureExclusive[On.RGB10A2]=!1,this._textureExclusive[On.RGB10A2UI]=!1,this._textureExclusive[On.SRGB8_A8]=!1,this._textureExclusive[On.R8I]=!1,this._textureExclusive[On.R8UI]=!1,this._textureExclusive[On.R16I]=!1,this._textureExclusive[On.R16UI]=!1,this._textureExclusive[On.R32I]=!1,this._textureExclusive[On.R32UI]=!1,this._textureExclusive[On.RG8I]=!1,this._textureExclusive[On.RG8UI]=!1,this._textureExclusive[On.RG16I]=!1,this._textureExclusive[On.RG16UI]=!1,this._textureExclusive[On.RG32I]=!1,this._textureExclusive[On.RG32UI]=!1,this._textureExclusive[On.RGBA8I]=!1,this._textureExclusive[On.RGBA8UI]=!1,this._textureExclusive[On.RGBA16I]=!1,this._textureExclusive[On.RGBA16UI]=!1,this._textureExclusive[On.RGBA32I]=!1,this._textureExclusive[On.RGBA32UI]=!1,this._textureExclusive[On.DEPTH]=!1,this._textureExclusive[On.DEPTH_STENCIL]=!1,t.EXT_color_buffer_float&&(this._formatFeatures[On.R32F]|=Gn.RENDER_TARGET,this._formatFeatures[On.RG32F]|=Gn.RENDER_TARGET,this._formatFeatures[On.RGBA32F]|=Gn.RENDER_TARGET,this._textureExclusive[On.R32F]=!1,this._textureExclusive[On.RG32F]=!1,this._textureExclusive[On.RGBA32F]=!1),t.EXT_color_buffer_half_float&&(this._textureExclusive[On.R16F]=!1,this._textureExclusive[On.RG16F]=!1,this._textureExclusive[On.RGBA16F]=!1),t.OES_texture_float_linear&&(this._formatFeatures[On.RGB32F]|=Gn.LINEAR_FILTER,this._formatFeatures[On.RGBA32F]|=Gn.LINEAR_FILTER,this._formatFeatures[On.R32F]|=Gn.LINEAR_FILTER,this._formatFeatures[On.RG32F]|=Gn.LINEAR_FILTER),t.OES_texture_half_float_linear&&(this._formatFeatures[On.RGB16F]|=Gn.LINEAR_FILTER,this._formatFeatures[On.RGBA16F]|=Gn.LINEAR_FILTER,this._formatFeatures[On.R16F]|=Gn.LINEAR_FILTER,this._formatFeatures[On.RG16F]|=Gn.LINEAR_FILTER);var i=Gn.SAMPLED_TEXTURE|Gn.LINEAR_FILTER;t.WEBGL_compressed_texture_etc1&&(this._formatFeatures[On.ETC_RGB8]=i),t.WEBGL_compressed_texture_etc&&(this._formatFeatures[On.ETC2_RGB8]=i,this._formatFeatures[On.ETC2_RGBA8]=i,this._formatFeatures[On.ETC2_SRGB8]=i,this._formatFeatures[On.ETC2_SRGB8_A8]=i,this._formatFeatures[On.ETC2_RGB8_A1]=i,this._formatFeatures[On.ETC2_SRGB8_A1]=i),t.WEBGL_compressed_texture_s3tc&&(this._formatFeatures[On.BC1]=i,this._formatFeatures[On.BC1_ALPHA]=i,this._formatFeatures[On.BC1_SRGB]=i,this._formatFeatures[On.BC1_SRGB_ALPHA]=i,this._formatFeatures[On.BC2]=i,this._formatFeatures[On.BC2_SRGB]=i,this._formatFeatures[On.BC3]=i,this._formatFeatures[On.BC3_SRGB]=i),t.WEBGL_compressed_texture_pvrtc&&(this._formatFeatures[On.PVRTC_RGB2]=i,this._formatFeatures[On.PVRTC_RGBA2]=i,this._formatFeatures[On.PVRTC_RGB4]=i,this._formatFeatures[On.PVRTC_RGBA4]=i),t.WEBGL_compressed_texture_astc&&(this._formatFeatures[On.ASTC_RGBA_4X4]=i,this._formatFeatures[On.ASTC_RGBA_5X4]=i,this._formatFeatures[On.ASTC_RGBA_5X5]=i,this._formatFeatures[On.ASTC_RGBA_6X5]=i,this._formatFeatures[On.ASTC_RGBA_6X6]=i,this._formatFeatures[On.ASTC_RGBA_8X5]=i,this._formatFeatures[On.ASTC_RGBA_8X6]=i,this._formatFeatures[On.ASTC_RGBA_8X8]=i,this._formatFeatures[On.ASTC_RGBA_10X5]=i,this._formatFeatures[On.ASTC_RGBA_10X6]=i,this._formatFeatures[On.ASTC_RGBA_10X8]=i,this._formatFeatures[On.ASTC_RGBA_10X10]=i,this._formatFeatures[On.ASTC_RGBA_12X10]=i,this._formatFeatures[On.ASTC_RGBA_12X12]=i,this._formatFeatures[On.ASTC_SRGBA_4X4]=i,this._formatFeatures[On.ASTC_SRGBA_5X4]=i,this._formatFeatures[On.ASTC_SRGBA_5X5]=i,this._formatFeatures[On.ASTC_SRGBA_6X5]=i,this._formatFeatures[On.ASTC_SRGBA_6X6]=i,this._formatFeatures[On.ASTC_SRGBA_8X5]=i,this._formatFeatures[On.ASTC_SRGBA_8X6]=i,this._formatFeatures[On.ASTC_SRGBA_8X8]=i,this._formatFeatures[On.ASTC_SRGBA_10X5]=i,this._formatFeatures[On.ASTC_SRGBA_10X6]=i,this._formatFeatures[On.ASTC_SRGBA_10X8]=i,this._formatFeatures[On.ASTC_SRGBA_10X10]=i,this._formatFeatures[On.ASTC_SRGBA_12X10]=i,this._formatFeatures[On.ASTC_SRGBA_12X12]=i)},i.createCommandBuffer=function(t){var e=new(t.type===lr.PRIMARY?O4:S4);return e.initialize(t),e},i.createSwapchain=function(t){var e=new G4;return this._swapchain=e,e.initialize(t),e},i.createBuffer=function(t){var e=new y4;return e.initialize(t),e},i.createTexture=function(t){var e=new M4;return e.initialize(t),e},i.createDescriptorSet=function(t){var e=new G3;return e.initialize(t),e},i.createShader=function(t){var e=new B4;return e.initialize(t),e},i.createInputAssembler=function(t){var e=new R4;return e.initialize(t),e},i.createRenderPass=function(t){var e=new P4;return e.initialize(t),e},i.createFramebuffer=function(t){var e=new A4;return e.initialize(t),e},i.createDescriptorSetLayout=function(t){var e=new b4;return e.initialize(t),e},i.createPipelineLayout=function(t){var e=new C4;return e.initialize(t),e},i.createPipelineState=function(t){var e=new I4;return e.initialize(t),e},i.createQueue=function(t){var e=new x4;return e.initialize(t),e},i.getSampler=function(t){var e=ia.computeHash(t);return this._samplers.has(e)||this._samplers.set(e,new D4(t,e)),this._samplers.get(e)},i.getSwapchains=function(){return[this._swapchain]},i.getGeneralBarrier=function(t){var e=sa.computeHash(t);return this._generalBarrierss.has(e)||this._generalBarrierss.set(e,new sa(t,e)),this._generalBarrierss.get(e)},i.getTextureBarrier=function(t){var e=aa.computeHash(t);return this._textureBarriers.has(e)||this._textureBarriers.set(e,new aa(t,e)),this._textureBarriers.get(e)},i.getBufferBarrier=function(t){var e=oa.computeHash(t);return this._bufferBarriers.has(e)||this._bufferBarriers.set(e,new oa(t,e)),this._bufferBarriers.get(e)},i.copyBuffersToTexture=function(t,e,i){g4(this,t,e.gpuTexture,i)},i.copyTextureToBuffers=function(t,e,i){!function(t,e,i,n){var r=t.gl,s=t.stateCache,a=r.createFramebuffer();r.bindFramebuffer(r.FRAMEBUFFER,a);var o=0,u=0,h=1,l=1;switch(e.glTarget){case r.TEXTURE_2D:for(var c=0;c<n.length;c++){var _=n[c];r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,e.glTarget,e.glTexture,_.texSubres.mipLevel),o=_.texOffset.x,u=_.texOffset.y,h=_.texExtent.width,l=_.texExtent.height,r.readPixels(o,u,h,l,e.glFormat,e.glType,i[c])}break;default:console.error("Unsupported GL texture type, copy texture to buffers failed.")}r.bindFramebuffer(r.FRAMEBUFFER,null),s.glFramebuffer=null,r.deleteFramebuffer(a)}(this,t.gpuTexture,e,i)},i.copyTexImagesToTexture=function(t,e,i){!function(t,e,i,n){var r=t.gl,s=t.stateCache.glTexUnits[t.stateCache.texUnit];s.glTexture!==i.glTexture&&(r.bindTexture(i.glTarget,i.glTexture),s.glTexture=i.glTexture);var a=0,o=0;switch(i.glTarget){case r.TEXTURE_2D:for(var u=0;u<n.length;u++){var h=n[u];r.texSubImage2D(r.TEXTURE_2D,h.texSubres.mipLevel,h.texOffset.x,h.texOffset.y,i.glFormat,i.glType,e[a++])}break;case r.TEXTURE_CUBE_MAP:for(var l=0;l<n.length;l++){var c=n[l],_=c.texSubres.baseArrayLayer+c.texSubres.layerCount;for(o=c.texSubres.baseArrayLayer;o<_;++o)r.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+o,c.texSubres.mipLevel,c.texOffset.x,c.texOffset.y,i.glFormat,i.glType,e[a++])}break;default:console.error("Unsupported GL texture type, copy buffer to texture failed.")}i.flags&Un.GEN_MIPMAP&&r.generateMipmap(i.glTarget)}(this,t,e.gpuTexture,i)},h(e,[{key:"gl",get:function(){return this._context}},{key:"extensions",get:function(){return this._swapchain.extensions}},{key:"stateCache",get:function(){return this._swapchain.stateCache}},{key:"nullTex2D",get:function(){return this._swapchain.nullTex2D}},{key:"nullTexCube",get:function(){return this._swapchain.nullTexCube}},{key:"textureExclusive",get:function(){return this._textureExclusive}},{key:"bindingMappings",get:function(){return this._bindingMappings}}]),e}(Us));b.WebGL2Device=k4;var z4,H4,V4,W4,X4,j4,Y4,K4,q4,Q4,Z4,J4,$4,t5,e5,i5,n5,r5,s5,a5,o5,u5,h5,l5,c5,_5,f5,d5,p5,m5,g5,v5,y5,E5,T5,S5,A5,R5,b5,C5,w5,I5,O5=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._morphRenderingInstance=null,e._usedMaterials=new Set,e}c(e,t);var i=e.prototype;return i.getMacroPatches=function(e){var i=t.prototype.getMacroPatches.call(this,e);if(this._morphRenderingInstance){var n=this._morphRenderingInstance.requiredPatches(e);if(n)return n.concat(null!=i?i:[])}return i},i.initSubModel=function(e,i,n){return t.prototype.initSubModel.call(this,e,i,this._launderMaterial(n))},i.destroy=function(){t.prototype.destroy.call(this),this._morphRenderingInstance=null},i.setSubModelMaterial=function(e,i){return t.prototype.setSubModelMaterial.call(this,e,this._launderMaterial(i))},i.setMorphRendering=function(t){this._morphRenderingInstance=t},i._updateLocalDescriptors=function(e,i){t.prototype._updateLocalDescriptors.call(this,e,i),this._morphRenderingInstance&&this._morphRenderingInstance.adaptPipelineState(e,i)},i._launderMaterial=function(t){return t},e}(mB),x5=_e({OFF:0,ON:1}),P5=_e({OFF:0,ON:1}),D5=(z4=_h("cc.ModelLightmapSettings"),H4=Th("_recieveShadow"),z4((Z4=function(){function t(){E(this,"texture",X4,this),E(this,"uvParam",j4,this),E(this,"_bakeable",Y4,this),E(this,"_castShadow",K4,this),E(this,"_receiveShadow",q4,this),E(this,"_lightmapSize",Q4,this)}return h(t,[{key:"bakeable",get:function(){return this._bakeable},set:function(t){this._bakeable=t}},{key:"castShadow",get:function(){return this._castShadow},set:function(t){this._castShadow=t}},{key:"receiveShadow",get:function(){return this._receiveShadow},set:function(t){this._receiveShadow=t}},{key:"lightmapSize",get:function(){return this._lightmapSize},set:function(t){this._lightmapSize=t}}]),t}(),X4=T((W4=Z4).prototype,"texture",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),j4=T(W4.prototype,"uvParam",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new Li}}),Y4=T(W4.prototype,"_bakeable",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),K4=T(W4.prototype,"_castShadow",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),q4=T(W4.prototype,"_receiveShadow",[H4],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),Q4=T(W4.prototype,"_lightmapSize",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 64}}),T(W4.prototype,"bakeable",[Ph],Object.getOwnPropertyDescriptor(W4.prototype,"bakeable"),W4.prototype),T(W4.prototype,"castShadow",[Ph],Object.getOwnPropertyDescriptor(W4.prototype,"castShadow"),W4.prototype),T(W4.prototype,"receiveShadow",[Ph],Object.getOwnPropertyDescriptor(W4.prototype,"receiveShadow"),W4.prototype),T(W4.prototype,"lightmapSize",[Ph],Object.getOwnPropertyDescriptor(W4.prototype,"lightmapSize"),W4.prototype),V4=W4))||V4),B5=(J4=_h("cc.MeshRenderer"),$4=xh(),t5=dh(100),e5=Ch(),i5=Kh(Ve),n5=Mh(),r5=mh({group:{name:"DynamicShadowSettings",displayOrder:0}}),s5=Kh(Ve),a5=Mh(),o5=mh({group:{name:"DynamicShadowSettings",displayOrder:1}}),u5=Kh(x5),h5=Mh(),l5=mh({group:{name:"DynamicShadowSettings",displayOrder:2}}),c5=Kh(P5),_5=Mh(),f5=mh({group:{name:"DynamicShadowSettings",displayOrder:3}}),d5=Kh(VF),p5=Mh(),m5=Dh(),J4(g5=$4(g5=t5(g5=e5(g5=bh((w5=C5=function(t){function e(){var e;return E(e=t.call(this)||this,"lightmapSettings",y5,g(e)),E(e,"_mesh",E5,g(e)),E(e,"_shadowCastingMode",T5,g(e)),E(e,"_shadowReceivingMode",S5,g(e)),E(e,"_shadowBias",A5,g(e)),E(e,"_shadowNormalBias",R5,g(e)),e._subMeshShapesWeights=[],e._modelType=void 0,e._model=null,e._morphInstance=null,E(e,"_enableMorph",b5,g(e)),e._modelType=mB,e}c(e,t);var i=e.prototype;return i.onLoad=function(){this._mesh&&this._mesh.initialize(),this._validateShapeWeights()||this._initSubMeshShapesWeights(),this._watchMorphInMesh(),this._updateModels(),this._updateCastShadow(),this._updateReceiveShadow(),this._updateShadowBias(),this._updateShadowNormalBias()},i.onRestore=function(){this._updateModels(),this.enabledInHierarchy&&this._attachToScene(),this._updateCastShadow(),this._updateReceiveShadow(),this._updateShadowBias(),this._updateShadowNormalBias()},i.onEnable=function(){t.prototype.onEnable.call(this),this._model||this._updateModels(),this._updateCastShadow(),this._updateReceiveShadow(),this._updateShadowBias(),this._updateShadowNormalBias(),this._onUpdateLocalShadowBias(),this._attachToScene()},i.onDisable=function(){this._model&&this._detachFromScene()},i.onDestroy=function(){this._model&&(b.director.root.destroyModel(this._model),this._model=null,this._models.length=0),this._morphInstance&&this._morphInstance.destroy()},i.onGeometryChanged=function(){if(this._model&&this._mesh){var t=this._mesh.struct;this._model.createBoundingShape(t.minPosition,t.maxPosition),this._model.updateWorldBound(),this._model.onGeometryChanged()}},i.getWeight=function(t,e){this._subMeshShapesWeights.length;var i=this._subMeshShapesWeights[t];return i.length,i[e]},i.setWeights=function(t,e){var i=this._subMeshShapesWeights;e>=i.length||i[e].length===t.length&&(i[e]=t.slice(0),this._uploadSubMeshShapesWeights(e))},i.setWeight=function(t,e,i){var n=this._subMeshShapesWeights;if(!(e>=n.length)){var r=n[e];i>=r.length||(r[i]=t,this._uploadSubMeshShapesWeights(e))}},i.setInstancedAttribute=function(t,e){if(this.model)for(var i=this.model.subModels,n=0;n<i.length;n++)for(var r=i[n].instancedAttributeBlock,s=r.attributes,a=r.views,o=0;o<s.length;o++)if(s[o].name===t){a[o].set(e);break}},i._updateLightmap=function(t,e,i,n,r){this.lightmapSettings.texture=t,this.lightmapSettings.uvParam.x=e,this.lightmapSettings.uvParam.y=i,this.lightmapSettings.uvParam.z=n,this.lightmapSettings.uvParam.w=r,this._onUpdateLightingmap()},i._updateModels=function(){if(this.enabledInHierarchy){var t=this._model;if(t?(t.destroy(),t.initialize(),t.node=t.transform=this.node):this._createModel(),this._model){if(this._mesh){var e=this._mesh.struct;this._model.createBoundingShape(e.minPosition,e.maxPosition)}this._model.initLightingmap(this.lightmapSettings.texture,this.lightmapSettings.uvParam),this._updateModelParams(),this._onUpdateLightingmap(),this._onUpdateLocalShadowBias()}}},i._createModel=function(){var t=this._morphInstance&&this._modelType===mB?O5:this._modelType,e=this._model=b.director.root.createModel(t);e.visFlags=this.visibility,e.node=e.transform=this.node,this._models.length=0,this._models.push(this._model),this._morphInstance&&e instanceof O5&&e.setMorphRendering(this._morphInstance)},i._attachToScene=function(){if(this.node.scene&&this._model){var t=this._getRenderScene();null!==this._model.scene&&this._detachFromScene(),t.addModel(this._model)}},i._detachFromScene=function(){this._model&&this._model.scene&&this._model.scene.removeModel(this._model)},i._updateModelParams=function(){if(this._mesh&&this._model){this.node.hasChangedFlags|=AE.POSITION,this._model.transform.hasChangedFlags|=AE.POSITION,this._model.isDynamicBatching=this._isBatchingEnabled();var t=this._mesh?this._mesh.renderingSubMeshes.length:0,e=this._mesh.renderingSubMeshes;if(e)for(var i=0;i<t;++i){var n=this.getRenderMaterial(i);n&&!n.isValid&&(n=null);var r=e[i];r&&this._model.initSubModel(i,r,n||this._getBuiltinMaterial())}this._model.enabled=!0}},i._onUpdateLightingmap=function(){null!==this.model&&this.model.updateLightingmap(this.lightmapSettings.texture,this.lightmapSettings.uvParam),this.setInstancedAttribute("a_lightingMapUVParam",[this.lightmapSettings.uvParam.x,this.lightmapSettings.uvParam.y,this.lightmapSettings.uvParam.z,this.lightmapSettings.uvParam.w])},i._onUpdateLocalShadowBias=function(){null!==this.model&&this.model.updateLocalShadowBias(),this.setInstancedAttribute("a_localShadowBias",[this._shadowBias,this._shadowNormalBias])},i._onMaterialModified=function(t,e){this._model&&this._model.inited&&this._onRebuildPSO(t,e||this._getBuiltinMaterial())},i._onRebuildPSO=function(t,e){this._model&&this._model.inited&&(this._model.isDynamicBatching=this._isBatchingEnabled(),this._model.setSubModelMaterial(t,e),this._onUpdateLightingmap(),this._onUpdateLocalShadowBias())},i._onMeshChanged=function(){},i._clearMaterials=function(){if(this._model)for(var t=this._model.subModels,e=0;e<t.length;++e)this._onMaterialModified(e,null)},i._getBuiltinMaterial=function(){return vy.get("missing-material")},i._onVisibilityChange=function(t){this._model&&(this._model.visFlags=t)},i._updateShadowBias=function(){this._model&&(this._model.shadowBias=this._shadowBias)},i._updateShadowNormalBias=function(){this._model&&(this._model.shadowNormalBias=this._shadowNormalBias)},i._updateCastShadow=function(){this._model&&(this._shadowCastingMode===x5.OFF?this._model.castShadow=!1:(this._shadowCastingMode,x5.ON,this._shadowCastingMode,this._model.castShadow=!0))},i._updateReceiveShadow=function(){this._model&&(this._shadowReceivingMode===P5.OFF?this._model.receiveShadow=!1:this._model.receiveShadow=!0)},i._isBatchingEnabled=function(){for(var t=0;t<this._materials.length;++t){var e=this._materials[t];if(e)for(var i=0;i<e.passes.length;++i)if(e.passes[i].batchingScheme)return!0}return!1},i._watchMorphInMesh=function(){if(this._morphInstance&&(this._morphInstance.destroy(),this._morphInstance=null),this._enableMorph&&this._mesh&&this._mesh.struct.morph&&this._mesh.morphRendering){this._morphInstance=this._mesh.morphRendering.createInstance();for(var t=this._mesh.struct.primitives.length,e=0;e<t;++e)this._uploadSubMeshShapesWeights(e);this._model&&this._model instanceof O5&&this._model.setMorphRendering(this._morphInstance)}},i._initSubMeshShapesWeights=function(){var t=this._mesh;if(this._subMeshShapesWeights.length=0,t){var e=t.struct.morph;if(e){var i=e.weights;this._subMeshShapesWeights=e.subMeshMorphs.map((function(t){return t?t.weights?t.weights.slice(0):i?(i.length,t.targets.length,i.slice(0)):new Array(t.targets.length).fill(0):[]}))}}},i._validateShapeWeights=function(){var t=this._mesh,e=this._subMeshShapesWeights;if(!t||!t.struct.morph)return 0===e.length;var i=t.struct.morph;return i.subMeshMorphs.length===e.length&&e.every((function(t,e){var n,r,s=t.length;return(null!==(n=null===(r=i.subMeshMorphs[e])||void 0===r?void 0:r.targets.length)&&void 0!==n?n:0)===s}))},i._uploadSubMeshShapesWeights=function(t){var e;null===(e=this._morphInstance)||void 0===e||e.setWeights(t,this._subMeshShapesWeights[t])},h(e,[{key:"shadowBias",get:function(){return this._shadowBias},set:function(t){this._shadowBias=t,this._updateShadowBias(),this._onUpdateLocalShadowBias()}},{key:"shadowNormalBias",get:function(){return this._shadowNormalBias},set:function(t){this._shadowNormalBias=t,this._updateShadowNormalBias(),this._onUpdateLocalShadowBias()}},{key:"shadowCastingMode",get:function(){return this._shadowCastingMode},set:function(t){this._shadowCastingMode=t,this._updateCastShadow()}},{key:"receiveShadow",get:function(){return this._shadowReceivingMode},set:function(t){this._shadowReceivingMode=t,this._updateReceiveShadow()}},{key:"mesh",get:function(){return this._mesh},set:function(t){var e=this._mesh,i=this._mesh=t;null==i||i.initialize(),this._initSubMeshShapesWeights(),this._watchMorphInMesh(),this._onMeshChanged(e),this._updateModels(),this.enabledInHierarchy&&this._attachToScene(),this._updateCastShadow(),this._updateReceiveShadow()}},{key:"model",get:function(){return this._model}},{key:"enableMorph",get:function(){return this._enableMorph},set:function(t){this._enableMorph=t}}]),e}(sA),C5.ShadowCastingMode=x5,C5.ShadowReceivingMode=P5,y5=T((v5=w5).prototype,"lightmapSettings",[Eh,Ph,Vh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new D5}}),E5=T(v5.prototype,"_mesh",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),T5=T(v5.prototype,"_shadowCastingMode",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return x5.OFF}}),S5=T(v5.prototype,"_shadowReceivingMode",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return P5.ON}}),A5=T(v5.prototype,"_shadowBias",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),R5=T(v5.prototype,"_shadowNormalBias",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),T(v5.prototype,"shadowBias",[i5,n5,r5,Vh],Object.getOwnPropertyDescriptor(v5.prototype,"shadowBias"),v5.prototype),T(v5.prototype,"shadowNormalBias",[s5,a5,o5,Vh],Object.getOwnPropertyDescriptor(v5.prototype,"shadowNormalBias"),v5.prototype),T(v5.prototype,"shadowCastingMode",[u5,h5,l5,Vh],Object.getOwnPropertyDescriptor(v5.prototype,"shadowCastingMode"),v5.prototype),T(v5.prototype,"receiveShadow",[c5,_5,f5,Vh],Object.getOwnPropertyDescriptor(v5.prototype,"receiveShadow"),v5.prototype),T(v5.prototype,"mesh",[d5,p5],Object.getOwnPropertyDescriptor(v5.prototype,"mesh"),v5.prototype),T(v5.prototype,"enableMorph",[m5,Vh],Object.getOwnPropertyDescriptor(v5.prototype,"enableMorph"),v5.prototype),b5=T(v5.prototype,"_enableMorph",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),g5=v5))||g5)||g5)||g5)||g5)||g5),N5=function(){function t(t,e,i){this._id=void 0,this._opts=void 0,this._accumStart=void 0,this._total=0,this._value=0,this._averageValue=0,this._accumValue=0,this._accumSamples=0,this._id=t,this._opts=e,this._accumStart=i}var e=t.prototype;return e.sample=function(t){this._average(this._value,t)},e.human=function(){var t=this._opts,e=t.average,i=t.isInteger,n=e?this._averageValue:this._value;return i?Math.round(n):Math.round(100*n)/100},e.alarm=function(){return this._opts.below&&this._value<this._opts.below||this._opts.over&&this._value>this._opts.over},e._average=function(t,e){if(void 0===e&&(e=0),this._opts.average){this._accumValue+=t,++this._accumSamples;var i=e;i-this._accumStart>=this._opts.average&&(this._averageValue=this._accumValue/this._accumSamples,this._accumValue=0,this._accumStart=i,this._accumSamples=0)}},h(t,[{key:"value",get:function(){return this._value},set:function(t){this._value=t}}]),t}(),M5=_h("cc.PerfCounter")(I5=function(t){function e(e,i,n){var r;return(r=t.call(this,e,i,n)||this)._time=void 0,r._time=n,r}c(e,t);var i=e.prototype;return i.start=function(t){void 0===t&&(t=0),this._time=t},i.end=function(t){void 0===t&&(t=0),this._value=t-this._time,this._average(this._value)},i.tick=function(){this.end(),this.start()},i.frame=function(t){var e=t,i=e-this._time;this._total++,i>(this._opts.average||1e3)&&(this._value=1e3*this._total/i,this._total=0,this._time=e,this._average(this._value))},e}(N5))||I5,L5="0123456789. ",F5=500,U5={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,".":10},G5={fps:{desc:"Framerate (FPS)",below:30,average:F5,isInteger:!0},draws:{desc:"Draw call",isInteger:!0},frame:{desc:"Frame time (ms)",min:0,max:50,average:F5},instances:{desc:"Instance Count",isInteger:!0},tricount:{desc:"Triangle",isInteger:!0},logic:{desc:"Game Logic (ms)",min:0,max:50,average:F5,color:"#080"},physics:{desc:"Physics (ms)",min:0,max:50,average:F5},render:{desc:"Renderer (ms)",min:0,max:50,average:F5,color:"#f90"},textureMemory:{desc:"GFX Texture Mem(M)"},bufferMemory:{desc:"GFX Buffer Mem(M)"}},k5=t("Profiler",function(t){function e(){var e;return(e=t.call(this)||this)._stats=null,e._showFPS=!1,e._rootNode=null,e._device=null,e._swapchain=null,e._pipeline=null,e._meshRenderer=null,e._canvas=null,e._ctx=null,e._texture=null,e._region=new Ir,e._canvasArr=[],e._regionArr=[e._region],e.digitsData=null,e.offsetData=null,e.pass=null,e._canvasDone=!1,e._statsDone=!1,e._inited=!1,e._lineHeight=256/(Object.keys(G5).length+1),e._wordHeight=0,e._eachNumWidth=0,e._totalLines=0,e.lastTime=0,e._canvas=document.createElement("canvas"),e._ctx=e._canvas.getContext("2d"),e._canvasArr.push(e._canvas),e}c(e,t);var i=e.prototype;return i.init=function(){ye.querySettings(ve.Category.PROFILING,"showFPS")?this.showStats():this.hideStats()},i.isShowingStats=function(){return this._showFPS},i.hideStats=function(){this._showFPS&&(this._rootNode&&(this._rootNode.active=!1),b.director.off(b.Director.EVENT_BEFORE_UPDATE,this.beforeUpdate,this),b.director.off(b.Director.EVENT_AFTER_UPDATE,this.afterUpdate,this),b.director.off(b.Director.EVENT_BEFORE_PHYSICS,this.beforePhysics,this),b.director.off(b.Director.EVENT_AFTER_PHYSICS,this.afterPhysics,this),b.director.off(b.Director.EVENT_BEFORE_DRAW,this.beforeDraw,this),b.director.off(b.Director.EVENT_AFTER_DRAW,this.afterDraw,this),this._showFPS=!1,OL.root.pipeline.profiler=null,b.game.config.showFPS=!1)},i.showStats=function(){if(!this._showFPS){if(!this._device){var t=b.director.root;this._device=Ja.gfxDevice,this._swapchain=t.mainWindow.swapchain,this._pipeline=t.pipeline}this.generateCanvas(),this.generateStats(),b.game.once(b.Game.EVENT_ENGINE_INITED,this.generateNode,this),b.game.on(b.Game.EVENT_RESTART,this.generateNode,this),this._rootNode&&(this._rootNode.active=!0),b.director.on(b.Director.EVENT_BEFORE_UPDATE,this.beforeUpdate,this),b.director.on(b.Director.EVENT_AFTER_UPDATE,this.afterUpdate,this),b.director.on(b.Director.EVENT_BEFORE_PHYSICS,this.beforePhysics,this),b.director.on(b.Director.EVENT_AFTER_PHYSICS,this.afterPhysics,this),b.director.on(b.Director.EVENT_BEFORE_DRAW,this.beforeDraw,this),b.director.on(b.Director.EVENT_AFTER_DRAW,this.afterDraw,this),this._showFPS=!0,this._canvasDone=!0,this._statsDone=!0,b.game.config.showFPS=!0}},i.generateCanvas=function(){if(!this._canvasDone){this._ctx&&this._canvas&&(this._canvas.width=256,this._canvas.height=256,this._canvas.style.width=""+this._canvas.width,this._canvas.style.height=""+this._canvas.height,this._ctx.font="23px Arial",this._ctx.textBaseline="top",this._ctx.fillStyle="#fff",this._texture=this._device.createTexture(new kr(Ln.TEX2D,Fn.SAMPLED|Fn.TRANSFER_DST,On.RGBA8,256,256)),this._region.texExtent.width=256,this._region.texExtent.height=256)}},i.generateStats=function(){if(!this._statsDone&&this._ctx&&this._canvas){this._stats=null;var t=performance.now();this._ctx.textAlign="left";var e=0;for(var i in G5){var n=G5[i];this._ctx.fillText(n.desc,0,e*this._lineHeight),n.counter=new M5(i,n,t),e++}this._totalLines=e,this._wordHeight=this._totalLines*this._lineHeight/this._canvas.height;for(var r=0;r<L5.length;++r){var s=this._ctx.measureText(L5[r]).width;this._eachNumWidth=Math.max(this._eachNumWidth,s)}for(var a=0;a<L5.length;++a)this._ctx.fillText(L5[a],a*this._eachNumWidth,this._totalLines*this._lineHeight);this._eachNumWidth/=this._canvas.width,this._stats=G5,this._canvasArr[0]=this._canvas,this._device.copyTexImagesToTexture(this._canvasArr,this._texture,this._regionArr)}},i.generateNode=function(){if(!this._rootNode||!this._rootNode.isValid){this._rootNode=new jE("PROFILER_NODE"),this._rootNode._objFlags=b.Object.Flags.DontSave|b.Object.Flags.HideInHierarchy,b.game.addPersistRootNode(this._rootNode);var t=new jE("Profiler_Root");t.parent=this._rootNode;for(var e=.4,i=e/this._totalLines,n=e/this._wordHeight,r=i/23,s=this._eachNumWidth*this._canvas.width*r,a=[0,e,0,n,e,0,n,0,0,0,0,0],o=[0,2,1,0,3,2],u=[0,0,-1,0,1,0,-1,0,1,this._wordHeight,-1,0,0,this._wordHeight,-1,0],h=0,l=0;l<this._totalLines;l++)for(var c=0;c<8;c++){a.push(n+c*s,e-l*i,0),a.push(n+(c+1)*s,e-l*i,0),a.push(n+(c+1)*s,e-(l+1)*i,0),a.push(n+c*s,e-(l+1)*i,0),h=4*(8*l+c+1),o.push(0+h,2+h,1+h,0+h,3+h,2+h);var _=8*l+c,f=Math.floor(_/4),d=_-4*f;u.push(0,this._wordHeight,f,d),u.push(this._eachNumWidth,this._wordHeight,f,d),u.push(this._eachNumWidth,1,f,d),u.push(0,1,f,d)}this._meshRenderer=t.addComponent(B5),this._meshRenderer.mesh=tU({positions:a,indices:o,colors:u});var p=new Vy;p.initialize({effectName:"util/profiler"});var m=this.pass=p.passes[0],g=m.getBinding("mainTexture"),v=m.getBinding("digits"),y=m.getBinding("offset");m.bindTexture(g,this._texture),this.digitsData=m.blocks[v],this.offsetData=m.blocks[y],this.offsetData[3]=-1,this._meshRenderer.material=p,this._meshRenderer.node.layer=Jd.Enum.PROFILER,this._inited=!0}},i.beforeUpdate=function(){if(this._stats){var t=performance.now();this._stats.frame.counter.start(t),this._stats.logic.counter.start(t)}},i.afterUpdate=function(){if(this._stats){var t=performance.now();b.director.isPaused()?this._stats.frame.counter.start(t):this._stats.logic.counter.end(t)}},i.beforePhysics=function(){if(this._stats){var t=performance.now();this._stats.physics.counter.start(t)}},i.afterPhysics=function(){if(this._stats){var t=performance.now();this._stats.physics.counter.end(t)}},i.beforeDraw=function(){if(this._stats&&this._inited){var t=this._swapchain.surfaceTransform,e=this._device.capabilities.clipSpaceSignY;if(t!==this.offsetData[3]){var i=on[t],n=-.9,r=-.9*e;Qa.isXR&&(n=-.5,r=-.5*e),this.offsetData[0]=n*i[0]+r*i[2],this.offsetData[1]=n*i[1]+r*i[3],this.offsetData[2]=this._eachNumWidth,this.offsetData[3]=t}this.pass._rootBufferDirty=!0,this._meshRenderer.model?OL.root.pipeline.profiler=this._meshRenderer.model:OL.root.pipeline.profiler=null;var s=performance.now();this._stats.render.counter.start(s)}},i.afterDraw=function(){if(this._stats&&this._inited){var t=performance.now();if(this._stats.frame.counter.end(t),this._stats.fps.counter.frame(t),this._stats.render.counter.end(t),!(t-this.lastTime<F5)){this.lastTime=t;var e=this._device;this._stats.draws.counter.value=e.numDrawCalls,this._stats.instances.counter.value=e.numInstances,this._stats.bufferMemory.counter.value=e.memoryStatus.bufferSize/1048576,this._stats.textureMemory.counter.value=e.memoryStatus.textureSize/1048576,this._stats.tricount.counter.value=e.numTris;var i=0,n=this.digitsData;for(var r in this._stats){var s=this._stats[r];s.counter.sample(t);for(var a=s.counter.human().toString(),o=7;o>=0;o--){var u=8*i+o,h=a[a.length-(8-o)],l=U5[h];void 0===l&&(l=11),n[u]=l}i++}}}},e}(KE)),z5=t("profiler",new k5);OL.registerSystem("profiler",z5,0),b.profiler=z5;var H5=function(){function t(){this.originalTarget=null,this.target=null,this.tag=t.TAG_INVALID}var e=t.prototype;return e.clone=function(){var e=new t;return e.originalTarget=null,e.target=null,e.tag=this.tag,e},e.isDone=function(){return!0},e.startWithTarget=function(t){this.originalTarget=t,this.target=t},e.stop=function(){this.target=null},e.step=function(){W(1006)},e.update=function(){W(1007)},e.getTarget=function(){return this.target},e.setTarget=function(t){this.target=t},e.getOriginalTarget=function(){return this.originalTarget},e.setOriginalTarget=function(t){this.originalTarget=t},e.getTag=function(){return this.tag},e.setTag=function(t){this.tag=t},e.reverse=function(){return W(1008),null},e.retain=function(){},e.release=function(){},t}();H5.TAG_INVALID=-1;var V5=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._duration=0,e._timesForRepeat=1,e}c(e,t);var i=e.prototype;return i.getDuration=function(){return this._duration*(this._timesForRepeat||1)},i.setDuration=function(t){this._duration=t},i.clone=function(){return new e},e}(H5),W5=(function(t){function e(e,i){var n;return void 0===i&&(i=1),(n=t.call(this)||this)._speed=0,n._innerAction=null,e&&n.initWithAction(e,i),n}c(e,t);var i=e.prototype;i.getSpeed=function(){return this._speed},i.setSpeed=function(t){this._speed=t},i.initWithAction=function(t,e){return t?(this._innerAction=t,this._speed=e,!0):(K(1021),!1)},i.clone=function(){var t=new e;return t.initWithAction(this._innerAction.clone(),this._speed),t},i.startWithTarget=function(t){H5.prototype.startWithTarget.call(this,t),this._innerAction.startWithTarget(t)},i.stop=function(){this._innerAction.stop(),H5.prototype.stop.call(this)},i.step=function(t){this._innerAction.step(t*this._speed)},i.isDone=function(){return this._innerAction.isDone()},i.reverse=function(){return new e(this._innerAction.reverse(),this._speed)},i.setInnerAction=function(t){this._innerAction!==t&&(this._innerAction=t)},i.getInnerAction=function(){return this._innerAction}}(H5),0),X5=function(){this.actions=[],this.target=null,this.actionIndex=0,this.currentAction=null,this.paused=!1,this.lock=!1},j5=function(){function t(){this._hashTargets=new Map,this._arrayTargets=[],this._elementPool=[]}var e=t.prototype;return e._searchElementByTarget=function(t,e){for(var i=0;i<t.length;i++)if(e===t[i].target)return t[i];return null},e._getElement=function(t,e){var i=this._elementPool.pop();return i||(i=new X5),i.target=t,i.paused=!!e,i},e._putElement=function(t){t.actions.length=0,t.actionIndex=0,t.currentAction=null,t.paused=!1,t.target=null,t.lock=!1,this._elementPool.push(t)},e.addAction=function(t,e,i){if(t&&e){null==e.uuid&&(e.uuid="_TWEEN_UUID_"+W5++);var n=this._hashTargets.get(e);n?n.actions||(n.actions=[]):(n=this._getElement(e,i),this._hashTargets.set(e,n),this._arrayTargets.push(n)),n.target=e,n.actions.push(t),t.startWithTarget(e)}else K(1e3)},e.removeAllActions=function(){for(var t=this._arrayTargets,e=0;e<t.length;e++){var i=t[e];i&&this._putElement(i)}this._arrayTargets.length=0,this._hashTargets=new Map},e.removeAllActionsFromTarget=function(t){if(null!=t){var e=this._hashTargets.get(t);e&&(e.actions.length=0,this._deleteHashElement(e))}},e.removeAction=function(t){if(null!=t){var e=t.getOriginalTarget(),i=this._hashTargets.get(e);if(i)for(var n=0;n<i.actions.length;n++)if(i.actions[n]===t){i.actions.splice(n,1),i.actionIndex>=n&&i.actionIndex--;break}}},e._removeActionByTag=function(t,e,i){for(var n=0,r=e.actions.length;n<r;++n){var s=e.actions[n];if(s&&s.getTag()===t){if(i&&s.getOriginalTarget()!==i)continue;this._removeActionAtIndex(n,e);break}}},e._removeAllActionsByTag=function(t,e,i){for(var n=e.actions.length-1;n>=0;--n){var r=e.actions[n];if(r&&r.getTag()===t){if(i&&r.getOriginalTarget()!==i)continue;this._removeActionAtIndex(n,e)}}},e.removeActionByTag=function(t,e){var i=this;t===H5.TAG_INVALID&&W(1002);var n=this._hashTargets;if(e){var r=n.get(e);r&&this._removeActionByTag(t,r,e)}else n.forEach((function(e){i._removeActionByTag(t,e)}))},e.removeAllActionsByTag=function(t,e){var i=this;t===H5.TAG_INVALID&&W(1002);var n=this._hashTargets;if(e){var r=n.get(e);r&&this._removeAllActionsByTag(t,r,e)}else n.forEach((function(e){i._removeAllActionsByTag(t,e)}))},e.getActionByTag=function(t,e){t===H5.TAG_INVALID&&W(1004);var i=this._hashTargets.get(e);if(i){if(null!=i.actions)for(var n=0;n<i.actions.length;++n){var r=i.actions[n];if(r&&r.getTag()===t)return r}W(1005,t)}return null},e.getNumberOfRunningActionsInTarget=function(t){var e=this._hashTargets.get(t);return e&&e.actions?e.actions.length:0},e.pauseTarget=function(t){var e=this._hashTargets.get(t);e&&(e.paused=!0)},e.resumeTarget=function(t){var e=this._hashTargets.get(t);e&&(e.paused=!1)},e.pauseAllRunningActions=function(){for(var t=[],e=this._arrayTargets,i=0;i<e.length;i++){var n=e[i];n&&!n.paused&&(n.paused=!0,t.push(n.target))}return t},e.resumeTargets=function(t){if(t)for(var e=0;e<t.length;e++)t[e]&&this.resumeTarget(t[e])},e.pauseTargets=function(t){if(t)for(var e=0;e<t.length;e++)t[e]&&this.pauseTarget(t[e])},e.purgeSharedManager=function(){b.director.getScheduler().unscheduleUpdate(this)},e._removeActionAtIndex=function(t,e){e.actions[t],e.actions.splice(t,1),e.actionIndex>=t&&e.actionIndex--,0===e.actions.length&&this._deleteHashElement(e)},e._deleteHashElement=function(t){var e=!1;if(t&&!t.lock&&this._hashTargets.get(t.target)){this._hashTargets.delete(t.target);for(var i=this._arrayTargets,n=0,r=i.length;n<r;n++)if(i[n]===t){i.splice(n,1);break}this._putElement(t),e=!0}return e},e.update=function(t){for(var e,i=this._arrayTargets,n=0;n<i.length;n++){this._currentTarget=i[n];var r=(e=this._currentTarget).target;if(!Aa(r)||r.isValid){if(!e.paused&&e.actions){for(e.lock=!0,e.actionIndex=0;e.actionIndex<e.actions.length;e.actionIndex++)if(e.currentAction=e.actions[e.actionIndex],e.currentAction){if(e.currentAction.step(t*(e.currentAction._speedMethod?e.currentAction._speed:1)),e.currentAction&&e.currentAction.isDone()){e.currentAction.stop();var s=e.currentAction;e.currentAction=null,this.removeAction(s)}e.currentAction=null}e.lock=!1}0===e.actions.length&&this._deleteHashElement(e)&&n--}else this.removeAllActionsFromTarget(r),n--}},t}(),Y5=t("TweenSystem",function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).actionMgr=new j5,e}return c(e,t),e.prototype.update=function(t){this.actionMgr.update(t)},h(e,[{key:"ActionManager",get:function(){return this.actionMgr}}]),e}(KE));Y5.ID="TWEEN",Y5.instance=void 0,OL.on(IL.EVENT_INIT,(function(){var t=new Y5;Y5.instance=t,OL.registerSystem(Y5.ID,t,KE.Priority.MEDIUM)}));var K5=function(t){function e(){return t.apply(this,arguments)||this}c(e,t);var i=e.prototype;return i.isDone=function(){return!0},i.step=function(){this.update(1)},i.update=function(){},i.reverse=function(){return this.clone()},i.clone=function(){return new e},e}(V5),q5=function(t){function e(){return t.apply(this,arguments)||this}c(e,t);var i=e.prototype;return i.update=function(){for(var t=this.target.getComponentsInChildren(rA),e=0;e<t.length;++e)t[e].enabled=!0},i.reverse=function(){return new Q5},i.clone=function(){return new e},e}(K5),Q5=function(t){function e(){return t.apply(this,arguments)||this}c(e,t);var i=e.prototype;return i.update=function(){for(var t=this.target.getComponentsInChildren(rA),e=0;e<t.length;++e)t[e].enabled=!1},i.reverse=function(){return new q5},i.clone=function(){return new e},e}(K5);!function(t){function e(){return t.apply(this,arguments)||this}c(e,t);var i=e.prototype;i.update=function(){for(var t=this.target.getComponentsInChildren(rA),e=0;e<t.length;++e){var i=t[e];i.enabled=!i.enabled}},i.reverse=function(){return new e},i.clone=function(){return new e}}(K5);var Z5=function(t){function e(e){var i;return(i=t.call(this)||this)._isNeedCleanUp=!0,void 0!==e&&i.init(e),i}c(e,t);var i=e.prototype;return i.update=function(){this.target.removeFromParent(),this._isNeedCleanUp&&this.target.destroy()},i.init=function(t){return this._isNeedCleanUp=t,!0},i.reverse=function(){return new e(this._isNeedCleanUp)},i.clone=function(){return new e(this._isNeedCleanUp)},e}(K5),J5=function(t){function e(e,i,n){var r;return(r=t.call(this)||this)._selectorTarget=null,r._function=null,r._data=null,r.initWithFunction(e,i,n),r}c(e,t);var i=e.prototype;return i.initWithFunction=function(t,e,i){return t&&(this._function=t),e&&(this._selectorTarget=e),void 0!==i&&(this._data=i),!0},i.execute=function(){this._function&&this._function.call(this._selectorTarget,this.target,this._data)},i.update=function(){this.execute()},i.getTargetCallback=function(){return this._selectorTarget},i.setTargetCallback=function(t){t!==this._selectorTarget&&(this._selectorTarget&&(this._selectorTarget=null),this._selectorTarget=t)},i.clone=function(){var t=new e;return t.initWithFunction(this._function,this._selectorTarget,this._data),t},e}(K5),$5=function(t){function e(e){var i;return(i=t.call(this)||this).MAX_VALUE=2,i._elapsed=0,i._firstTick=!1,i._easeList=[],i._speed=1,i._repeatForever=!1,i._repeatMethod=!1,i._speedMethod=!1,void 0===e||isNaN(e)||i.initWithDuration(e),i}c(e,t);var i=e.prototype;return i.getElapsed=function(){return this._elapsed},i.initWithDuration=function(t){return this._duration=0===t?Ee.FLT_EPSILON:t,this._elapsed=0,this._firstTick=!0,!0},i.isDone=function(){return this._elapsed>=this._duration},i._cloneDecoration=function(t){t._repeatForever=this._repeatForever,t._speed=this._speed,t._timesForRepeat=this._timesForRepeat,t._easeList=this._easeList,t._speedMethod=this._speedMethod,t._repeatMethod=this._repeatMethod},i._reverseEaseList=function(t){if(this._easeList){t._easeList=[];for(var e=0;e<this._easeList.length;e++)t._easeList.push(this._easeList[e])}},i.clone=function(){var t=new e(this._duration);return this._cloneDecoration(t),t},i.easing=function(t){this._easeList?this._easeList.length=0:this._easeList=[];for(var e=0;e<arguments.length;e++)this._easeList.push(arguments[e]);return this},i._computeEaseTime=function(t){return t},i.step=function(t){this._firstTick?(this._firstTick=!1,this._elapsed=0):this._elapsed+=t;var e=this._elapsed/(this._duration>1.192092896e-7?this._duration:1.192092896e-7);e=e<1?e:1,this.update(e>0?e:0),this._repeatMethod&&this._timesForRepeat>1&&this.isDone()&&(this._repeatForever||this._timesForRepeat--,this.startWithTarget(this.target),this.step(this._elapsed-this._duration))},i.startWithTarget=function(t){H5.prototype.startWithTarget.call(this,t),this._elapsed=0,this._firstTick=!0},i.reverse=function(){return W(1010),this},i.setAmplitudeRate=function(){W(1011)},i.getAmplitudeRate=function(){return W(1012),0},i.speed=function(t){return t<=0?(W(1013),this):(this._speedMethod=!0,this._speed*=t,this)},i.getSpeed=function(){return this._speed},i.setSpeed=function(t){return this._speed=t,this},i.repeat=function(t){return t=Math.round(t),isNaN(t)||t<1?(W(1014),this):(this._repeatMethod=!0,this._timesForRepeat*=t,this)},i.repeatForever=function(){return this._repeatMethod=!0,this._timesForRepeat=this.MAX_VALUE,this._repeatForever=!0,this},e}(V5),t8=function(t){function e(i){var n;(n=t.call(this)||this)._actions=[],n._split=0,n._last=0,n._reversed=!1;var r=i instanceof Array?i:arguments;if(1===r.length)return K(1019),g(n);var s=r.length-1;if(s>=0&&null==r[s]&&W(1015),s>=0){for(var a,o=r[0],u=1;u<s;u++)r[u]&&(a=o,o=e._actionOneTwo(a,r[u]));n.initWithTwoActions(o,r[s])}return n}c(e,t);var i=e.prototype;return i.initWithTwoActions=function(t,e){if(!t||!e)return K(1025),!1;var i=t._duration,n=e._duration,r=(i*=t._repeatMethod?t._timesForRepeat:1)+(n*=e._repeatMethod?e._timesForRepeat:1);return this.initWithDuration(r),this._actions[0]=t,this._actions[1]=e,!0},i.clone=function(){var t=new e;return this._cloneDecoration(t),t.initWithTwoActions(this._actions[0].clone(),this._actions[1].clone()),t},i.startWithTarget=function(t){$5.prototype.startWithTarget.call(this,t),this._split=this._actions[0]._duration/this._duration,this._split*=this._actions[0]._repeatMethod?this._actions[0]._timesForRepeat:1,this._last=-1},i.stop=function(){-1!==this._last&&this._actions[this._last].stop(),H5.prototype.stop.call(this)},i.update=function(t){var e,i,n=0,r=this._split,s=this._actions,a=this._last;(t=this._computeEaseTime(t))<r?(e=0!==r?t/r:1,0===n&&1===a&&this._reversed&&(s[1].update(0),s[1].stop())):(n=1,e=1===r?1:(t-r)/(1-r),-1===a&&(s[0].startWithTarget(this.target),s[0].update(1),s[0].stop()),0===a&&(s[0].update(1),s[0].stop())),i=s[n],a===n&&i.isDone()||(a!==n&&i.startWithTarget(this.target),e*=i._timesForRepeat,i.update(e>1?e%1:e),this._last=n)},i.reverse=function(){var t=e._actionOneTwo(this._actions[1].reverse(),this._actions[0].reverse());return this._cloneDecoration(t),this._reverseEaseList(t),t._reversed=!0,t},e}($5);function e8(t){var e=t instanceof Array?t:arguments;if(1===e.length)return K(1019),null;var i=e.length-1;i>=0&&null==e[i]&&W(1015);var n=null;if(i>=0){n=e[0];for(var r=1;r<=i;r++)e[r]&&(n=t8._actionOneTwo(n,e[r]))}return n}t8._actionOneTwo=function(t,e){var i=new t8;return i.initWithTwoActions(t,e),i};var i8=function(t){function e(e,i){var n;return(n=t.call(this)||this)._times=0,n._total=0,n._nextDt=0,n._actionInstant=!1,n._innerAction=null,void 0!==i&&n.initWithAction(e,i),n}c(e,t);var i=e.prototype;return i.initWithAction=function(t,e){var i=t._duration*e;return!!this.initWithDuration(i)&&(this._times=e,this._innerAction=t,t instanceof K5&&(this._actionInstant=!0,this._times-=1),this._total=0,!0)},i.clone=function(){var t=new e;return this._cloneDecoration(t),t.initWithAction(this._innerAction.clone(),this._times),t},i.startWithTarget=function(t){this._total=0,this._nextDt=this._innerAction._duration/this._duration,$5.prototype.startWithTarget.call(this,t),this._innerAction.startWithTarget(t)},i.stop=function(){this._innerAction.stop(),H5.prototype.stop.call(this)},i.update=function(t){t=this._computeEaseTime(t);var e=this._innerAction,i=this._duration,n=this._times,r=this._nextDt;if(t>=r){for(;t>r&&this._total<n;)e.update(1),this._total++,e.stop(),e.startWithTarget(this.target),r+=e._duration/i,this._nextDt=r>1?1:r;t>=1&&this._total<n&&(e.update(1),this._total++),this._actionInstant||(this._total===n?e.stop():e.update(t-(r-e._duration/i)))}else e.update(t*n%1)},i.isDone=function(){return this._total===this._times},i.reverse=function(){var t=new e(this._innerAction.reverse(),this._times);return this._cloneDecoration(t),this._reverseEaseList(t),t},i.setInnerAction=function(t){this._innerAction!==t&&(this._innerAction=t)},i.getInnerAction=function(){return this._innerAction},e}($5),n8=function(t){function e(e){var i;return(i=t.call(this)||this)._innerAction=null,e&&i.initWithAction(e),i}c(e,t);var i=e.prototype;return i.initWithAction=function(t){return t?(this._innerAction=t,!0):(K(1026),!1)},i.clone=function(){var t=new e;return this._cloneDecoration(t),t.initWithAction(this._innerAction.clone()),t},i.startWithTarget=function(t){$5.prototype.startWithTarget.call(this,t),this._innerAction.startWithTarget(t)},i.step=function(t){var e=this._innerAction;e.step(t),e.isDone()&&(e.startWithTarget(this.target),e.step(e.getElapsed()-e._duration))},i.isDone=function(){return!1},i.reverse=function(){var t=new e(this._innerAction.reverse());return this._cloneDecoration(t),this._reverseEaseList(t),t},i.setInnerAction=function(t){this._innerAction!==t&&(this._innerAction=t)},i.getInnerAction=function(){return this._innerAction},e}($5),r8=function(t){function e(i){var n;(n=t.call(this)||this)._one=null,n._two=null;var r=i instanceof Array?i:arguments;if(1===r.length)return K(1020),g(n);var s=r.length-1;if(s>=0&&null==r[s]&&W(1015),s>=0){for(var a,o=r[0],u=1;u<s;u++)r[u]&&(a=o,o=e._actionOneTwo(a,r[u]));n.initWithTwoActions(o,r[s])}return n}c(e,t);var i=e.prototype;return i.initWithTwoActions=function(t,e){if(!t||!e)return K(1027),!1;var i=!1,n=t._duration,r=e._duration;return this.initWithDuration(Math.max(n,r))&&(this._one=t,this._two=e,n>r?this._two=t8._actionOneTwo(e,o8(n-r)):n<r&&(this._one=t8._actionOneTwo(t,o8(r-n))),i=!0),i},i.clone=function(){var t=new e;return this._cloneDecoration(t),t.initWithTwoActions(this._one.clone(),this._two.clone()),t},i.startWithTarget=function(t){$5.prototype.startWithTarget.call(this,t),this._one.startWithTarget(t),this._two.startWithTarget(t)},i.stop=function(){this._one.stop(),this._two.stop(),H5.prototype.stop.call(this)},i.update=function(t){t=this._computeEaseTime(t),this._one&&this._one.update(t),this._two&&this._two.update(t)},i.reverse=function(){var t=e._actionOneTwo(this._one.reverse(),this._two.reverse());return this._cloneDecoration(t),this._reverseEaseList(t),t},e}($5);function s8(t){var e=t instanceof Array?t:arguments;if(1===e.length)return K(1020),null;e.length>0&&null==e[e.length-1]&&W(1015);for(var i=e[0],n=1;n<e.length;n++)null!=e[n]&&(i=r8._actionOneTwo(i,e[n]));return i}r8._actionOneTwo=function(t,e){var i=new r8;return i.initWithTwoActions(t,e),i};var a8=function(t){function e(){return t.apply(this,arguments)||this}c(e,t);var i=e.prototype;return i.update=function(){},i.reverse=function(){var t=new e(this._duration);return this._cloneDecoration(t),this._reverseEaseList(t),t},i.clone=function(){var t=new e;return this._cloneDecoration(t),t.initWithDuration(this._duration),t},e}($5);function o8(t){return new a8(t)}var u8,h8,l8,c8=function(t){function e(e){var i;return(i=t.call(this)||this)._other=null,e&&i.initWithAction(e),i}c(e,t);var i=e.prototype;return i.initWithAction=function(t){return t?t===this._other?(K(1029),!1):!!$5.prototype.initWithDuration.call(this,t._duration)&&(this._other=t,!0):(K(1028),!1)},i.clone=function(){var t=new e;return this._cloneDecoration(t),t.initWithAction(this._other.clone()),t},i.startWithTarget=function(t){$5.prototype.startWithTarget.call(this,t),this._other.startWithTarget(t)},i.update=function(t){t=this._computeEaseTime(t),this._other&&this._other.update(1-t)},i.reverse=function(){return this._other.clone()},i.stop=function(){this._other.stop(),H5.prototype.stop.call(this)},e}($5),_8=t("TweenAction",function(t){function e(e,i,n){var r;if((r=t.call(this)||this)._opts=void 0,r._props=void 0,r._originProps=void 0,null==n)n=Object.create(null);else if(function(t){var e=" [Tween:] ",i=" option is not support in v + "+C,n=t;n.delay&&L(e+"delay"+i),n.repeat&&L(e+"repeat"+i),n.repeatDelay&&L(e+"repeatDelay"+i),n.interpolation&&L(e+"interpolation"+i),n.onStop&&L(e+"onStop"+i)}(n),n.easing&&"string"==typeof n.easing&&(n.easing=function(t){var e=t.charAt(0);if(/[A-Z]/.test(e)){var i=(t=t.replace(e,e.toLowerCase())).split("-");if(2===i.length){var n=i[0];if("linear"===n)t="linear";else{var r=i[1];switch(n){case"quadratic":t="quad"+r;break;case"quartic":t="quart"+r;break;case"quintic":t="quint"+r;break;case"sinusoidal":t="sine"+r;break;case"exponential":t="expo"+r;break;case"circular":t="circ"+r;break;default:t=n+r}}}}return t}(n.easing)),n.progress||(n.progress=r.progress),n.easing&&"string"==typeof n.easing){var s=n.easing;n.easing=Ef[s],n.easing||j(1031,s)}for(var a in r._opts=n,r._props=Object.create(null),i)if(i.hasOwnProperty(a)){var o=i[a];if("function"==typeof o&&(o=o()),null!=o&&"string"!=typeof o){var u=void 0,h=void 0;void 0!==o.value&&(o.easing||o.progress)&&("string"==typeof o.easing?(u=Ef[o.easing])||j(1031,o.easing):u=o.easing,h=o.progress,o=o.value);var l=Object.create(null);l.value=o,l.easing=u,l.progress=h,r._props[a]=l}}return r._originProps=i,r.initWithDuration(e),r}c(e,t);var i=e.prototype;return i.clone=function(){var t=new e(this._duration,this._originProps,this._opts);return this._cloneDecoration(t),t},i.startWithTarget=function(t){$5.prototype.startWithTarget.call(this,t);var e=!!this._opts.relative,i=this._props;for(var n in i){var r=t[n];if(void 0!==r){var s=i[n],a=s.value;if("number"==typeof r)s.start=r,s.current=r,s.end=e?r+a:a;else if("object"==typeof r)for(var o in null==s.start&&(s.start={},s.current={},s.end={}),a)isNaN(r[o])||(s.start[o]=r[o],s.current[o]=r[o],s.end[o]=e?r[o]+a[o]:a[o])}}this._opts.onStart&&this._opts.onStart(this.target)},i.update=function(t){var e=this.target;if(e){var i=this._props,n=this._opts,r=t;n.easing&&(r=n.easing(t));var s=n.progress;for(var a in i){var o=i[a],u=o.easing?o.easing(t):r,h=o.progress?o.progress:s,l=o.start,c=o.end;if("number"==typeof l)o.current=h(l,c,o.current,u);else if("object"==typeof l)for(var _ in l)o.current[_]=h(l[_],c[_],o.current[_],u);e[a]=o.current}n.onUpdate&&n.onUpdate(this.target,t),1===t&&n.onComplete&&n.onComplete(this.target)}},i.progress=function(t,e,i,n){return t+(e-t)*n},e}($5)),f8=function(t){function e(e){var i;return(i=t.call(this)||this)._props=void 0,i._props={},void 0!==e&&i.init(e),i}c(e,t);var i=e.prototype;return i.init=function(t){for(var e in t)this._props[e]=t[e];return!0},i.update=function(){var t=this._props,e=this.target;for(var i in t)e[i]=t[i]},i.clone=function(){var t=new e;return t.init(this._props),t},e}(K5),d8=t("Tween",function(){function t(t){this._actions=[],this._finalAction=null,this._target=null,this._tag=H5.TAG_INVALID,this._target=void 0===t?null:t}var e=t.prototype;return e.tag=function(t){return this._tag=t,this},e.then=function(t){return t instanceof H5?this._actions.push(t.clone()):this._actions.push(t._union()),this},e.target=function(t){return this._target=t,this},e.start=function(){return this._target?(this._finalAction&&Y5.instance.ActionManager.removeAction(this._finalAction),this._finalAction=this._union(),this._finalAction.setTag(this._tag),Y5.instance.ActionManager.addAction(this._finalAction,this._target,!1),this):(L("Please set target to tween first"),this)},e.stop=function(){return this._finalAction&&Y5.instance.ActionManager.removeAction(this._finalAction),this},e.clone=function(t){var e=this._union();return p8(t).then(e.clone())},e.union=function(){var t=this._union();return this._actions.length=0,this._actions.push(t),this},e.to=function(t,e,i){(i=i||Object.create(null)).relative=!1;var n=new _8(t,e,i);return this._actions.push(n),this},e.by=function(t,e,i){(i=i||Object.create(null)).relative=!0;var n=new _8(t,e,i);return this._actions.push(n),this},e.set=function(t){var e=new f8(t);return this._actions.push(e),this},e.delay=function(t){var e=o8(t);return this._actions.push(e),this},e.call=function(t){var e=new J5(t,undefined,undefined);return this._actions.push(e),this},e.sequence=function(){var e=t._wrappedSequence.apply(t,arguments);return this._actions.push(e),this},e.parallel=function(){var e=t._wrappedParallel.apply(t,arguments);return this._actions.push(e),this},e.repeat=function(e,i){if(e===1/0)return this.repeatForever(i);var n,r=this._actions;return n=i instanceof t?i._union():r.pop(),r.push(function(t,e){return new i8(t,e)}(n,e)),this},e.repeatForever=function(e){var i,n=this._actions;return i=e instanceof t?e._union():n.pop(),n.push(function(t){return new n8(t)}(i)),this},e.reverseTime=function(e){var i,n=this._actions;return i=e instanceof t?e._union():n.pop(),n.push(function(t){return new c8(t)}(i)),this},e.hide=function(){var t=new Q5;return this._actions.push(t),this},e.show=function(){var t=new q5;return this._actions.push(t),this},e.removeSelf=function(){var t=new Z5(!1);return this._actions.push(t),this},t.stopAll=function(){Y5.instance.ActionManager.removeAllActions()},t.stopAllByTag=function(t,e){Y5.instance.ActionManager.removeAllActionsByTag(t,e)},t.stopAllByTarget=function(t){Y5.instance.ActionManager.removeAllActionsFromTarget(t)},e._union=function(){var t=this._actions;return 1===t.length?t[0]:e8(t)},e._destroy=function(){this.stop()},t._wrappedSequence=function(){var e=t._tmp_args;e.length=0;for(var i=arguments.length,n=0;n<i;n++){var r=e[n]=n<0||arguments.length<=n?void 0:arguments[n];r instanceof t&&(e[n]=r._union())}return e8.apply(e8,e)},t._wrappedParallel=function(){var e=t._tmp_args;e.length=0;for(var i=arguments.length,n=0;n<i;n++){var r=e[n]=n<0||arguments.length<=n?void 0:arguments[n];r instanceof t&&(e[n]=r._union())}return s8.apply(s8,e)},t}());function p8(t){return new d8(t)}function m8(t){return L("tweenUtil' is deprecated, please use 'tween' instead "),new d8(t)}d8._tmp_args=[],b.Tween=d8,b.tween=p8,b.tweenUtil=m8,function(t){t[t.Other=0]="Other",t[t.Left=1]="Left",t[t.Right=2]="Right"}(u8||(u8=t("DeviceType",{}))),function(t){t.XRUI_HOVER_ENTERED="xrui-hover-entered",t.XRUI_HOVER_EXITED="xrui-hover-exited",t.XRUI_HOVER_STAY="xrui-hover-stay",t.XRUI_CLICK="xrui-click",t.XRUI_UNCLICK="xrui-unclick"}(h8||(h8=t("XrUIPressEventType",{}))),function(t){t.XR_CAPS_LOCK="xr-caps-lock",t.XR_KEYBOARD_INIT="xr-keyboard-init",t.XR_KEYBOARD_INPUT="xr-keyboard-input",t.TO_LATIN="to-latin",t.TO_SYMBOL="to-symbol",t.TO_MATH_SYMBOL="to-math-symbol"}(l8||(l8=t("XrKeyboardEventType",{}))),t("XrUIPressEvent",function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).deviceType=u8.Other,e.hitPoint=new ji,e}return c(e,t),e}(uA));var g8,v8,y8,E8,T8,S8,A8,R8,b8,C8,w8,I8,O8,x8,P8,D8,B8,N8,M8,L8,F8,U8,G8,k8,z8,H8,V8,W8,X8,j8,Y8,K8,q8,Q8,Z8,J8,$8,t6,e6,i6,n6,r6,s6,a6,o6,u6,h6,l6,c6,_6,f6,d6,p6,m6,g6,v6,y6,E6,T6,S6,A6,R6,b6,C6=new Gi;!function(t){t[t.NONE=0]="NONE",t[t.COLOR=1]="COLOR",t[t.SPRITE=2]="SPRITE",t[t.SCALE=3]="SCALE"}(A6||(A6={})),pe(A6),function(t){t.NORMAL="normal",t.HOVER="hover",t.PRESSED="pressed",t.DISABLED="disabled"}(R6||(R6={})),function(t){t.CLICK="click"}(b6||(b6={}));var w6=function(e){return t({Button:e,ButtonComponent:e}),e}((g8=_h("cc.Button"),v8=xh(),y8=dh(110),E8=Ch(),T8=fh(Ak),S8=Kh(jE),A8=zh(),R8=Mh(),b8=zh(),C8=Mh(),w8=Kh(A6),I8=zh(),O8=Mh(),x8=zh(),P8=Mh(),D8=zh(),B8=Mh(),N8=zh(),M8=Mh(),L8=zh(),F8=Mh(),U8=Fh(),G8=Uh(),k8=zh(),z8=Mh(),H8=zh(),V8=Mh(),W8=Kh(hU),X8=zh(),j8=Mh(),Y8=Kh(hU),K8=zh(),q8=Mh(),Q8=Kh(hU),Z8=zh(),J8=Mh(),$8=Kh(hU),t6=zh(),e6=Mh(),i6=Kh([Sc]),n6=zh(),r6=Mh(),g8(s6=v8(s6=y8(s6=E8(s6=T8(s6=bh((S6=T6=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return E(e=t.call.apply(t,[this].concat(n))||this,"clickEvents",o6,g(e)),E(e,"_interactable",u6,g(e)),E(e,"_transition",h6,g(e)),E(e,"_normalColor",l6,g(e)),E(e,"_hoverColor",c6,g(e)),E(e,"_pressedColor",_6,g(e)),E(e,"_disabledColor",f6,g(e)),E(e,"_normalSprite",d6,g(e)),E(e,"_hoverSprite",p6,g(e)),E(e,"_pressedSprite",m6,g(e)),E(e,"_disabledSprite",g6,g(e)),E(e,"_duration",v6,g(e)),E(e,"_zoomScale",y6,g(e)),E(e,"_target",E6,g(e)),e._pressed=!1,e._hovered=!1,e._fromColor=new Gi,e._toColor=new Gi,e._time=0,e._transitionFinished=!0,e._fromScale=new ji,e._toScale=new ji,e._originalScale=null,e._sprite=null,e._targetScale=new ji,e}c(e,t);var i=e.prototype;return i.__preload=function(){this.target||(this.target=this.node);var t=this.node.getComponent(PW);t&&(this._normalSprite=t.spriteFrame),this._applyTarget(),this._resetState()},i.onEnable=function(){this._registerNodeEvent()},i.onDisable=function(){this._resetState(),this._unregisterNodeEvent()},i.onDestroy=function(){this.target.isValid&&this._unregisterTargetEvent(this.target)},i.update=function(t){var e=this.target;if(!this._transitionFinished&&e&&(this._transition===A6.COLOR||this._transition===A6.SCALE)){this._time+=t;var i=1;if(this._duration>0&&(i=this._time/this._duration),i>=1&&(i=1),this._transition===A6.COLOR){var n=e._uiProps.uiComp;Gi.lerp(C6,this._fromColor,this._toColor,i),n&&(n.color=C6)}else this.transition===A6.SCALE&&(e.getScale(this._targetScale),this._targetScale.x=Ei(this._fromScale.x,this._toScale.x,i),this._targetScale.y=Ei(this._fromScale.y,this._toScale.y,i),e.setScale(this._targetScale));1===i&&(this._transitionFinished=!0)}},i._resizeNodeToTargetNode=function(){this.target&&this.target._uiProps.uiTransformComp},i._resetState=function(){this._pressed=!1,this._hovered=!1;var t=this.target;if(t){var e=this._transition;if(e===A6.COLOR&&this._interactable){var i=t.getComponent(kz);i&&(i.color=this._normalColor)}else e===A6.SCALE&&this._originalScale&&t.setScale(this._originalScale);this._transitionFinished=!0}},i._registerNodeEvent=function(){this.node.on(aE.TOUCH_START,this._onTouchBegan,this),this.node.on(aE.TOUCH_MOVE,this._onTouchMove,this),this.node.on(aE.TOUCH_END,this._onTouchEnded,this),this.node.on(aE.TOUCH_CANCEL,this._onTouchCancel,this),this.node.on(aE.MOUSE_ENTER,this._onMouseMoveIn,this),this.node.on(aE.MOUSE_LEAVE,this._onMouseMoveOut,this),this.node.on(h8.XRUI_HOVER_ENTERED,this._xrHoverEnter,this),this.node.on(h8.XRUI_HOVER_EXITED,this._xrHoverExit,this),this.node.on(h8.XRUI_CLICK,this._xrClick,this),this.node.on(h8.XRUI_UNCLICK,this._xrUnClick,this)},i._registerTargetEvent=function(t){t.on(aE.TRANSFORM_CHANGED,this._onTargetTransformChanged,this)},i._unregisterNodeEvent=function(){this.node.off(aE.TOUCH_START,this._onTouchBegan,this),this.node.off(aE.TOUCH_MOVE,this._onTouchMove,this),this.node.off(aE.TOUCH_END,this._onTouchEnded,this),this.node.off(aE.TOUCH_CANCEL,this._onTouchCancel,this),this.node.off(aE.MOUSE_ENTER,this._onMouseMoveIn,this),this.node.off(aE.MOUSE_LEAVE,this._onMouseMoveOut,this),this.node.off(h8.XRUI_HOVER_ENTERED,this._xrHoverEnter,this),this.node.off(h8.XRUI_HOVER_EXITED,this._xrHoverExit,this),this.node.off(h8.XRUI_CLICK,this._xrClick,this),this.node.off(h8.XRUI_UNCLICK,this._xrUnClick,this)},i._unregisterTargetEvent=function(t){t.off(aE.TRANSFORM_CHANGED)},i._getTargetSprite=function(t){var e=null;return t&&(e=t.getComponent(PW)),e},i._applyTarget=function(){this.target&&(this._sprite=this._getTargetSprite(this.target),this._originalScale||(this._originalScale=new ji),ji.copy(this._originalScale,this.target.getScale()),this._registerTargetEvent(this.target))},i._onTargetSpriteFrameChanged=function(t){this._transition===A6.SPRITE&&this._setCurrentStateSpriteFrame(t.spriteFrame)},i._setCurrentStateSpriteFrame=function(t){if(t)switch(this._getButtonState()){case R6.NORMAL:this._normalSprite=t;break;case R6.HOVER:this._hoverSprite=t;break;case R6.PRESSED:this._pressedSprite=t;break;case R6.DISABLED:this._disabledSprite=t}},i._onTargetColorChanged=function(t){this._transition===A6.COLOR&&this._setCurrentStateColor(t)},i._setCurrentStateColor=function(t){switch(this._getButtonState()){case R6.NORMAL:this._normalColor=t;break;case R6.HOVER:this._hoverColor=t;break;case R6.PRESSED:this._pressedColor=t;break;case R6.DISABLED:this._disabledColor=t}},i._onTargetTransformChanged=function(t){t&AE.SCALE&&this._originalScale&&this._transition===A6.SCALE&&this._transitionFinished&&ji.copy(this._originalScale,this.target.getScale())},i._onTouchBegan=function(t){this._interactable&&this.enabledInHierarchy&&(this._pressed=!0,this._updateState(),t&&(t.propagationStopped=!0))},i._onTouchMove=function(t){if(this._interactable&&this.enabledInHierarchy&&this._pressed&&t){var e=t.touch;if(e){var i,n=this.node._uiProps.uiTransformComp.hitTest(e.getLocation());this._transition===A6.SCALE&&this.target&&this._originalScale?n?(ji.copy(this._fromScale,this._originalScale),ji.multiplyScalar(this._toScale,this._originalScale,this._zoomScale),this._transitionFinished=!1):(this._time=0,this._transitionFinished=!0,this.target.setScale(this._originalScale)):(i=n?R6.PRESSED:R6.NORMAL,this._applyTransition(i)),t&&(t.propagationStopped=!0)}}},i._onTouchEnded=function(t){this._interactable&&this.enabledInHierarchy&&(this._pressed&&(Sc.emitEvents(this.clickEvents,t),this.node.emit(b6.CLICK,this)),this._pressed=!1,this._updateState(),t&&(t.propagationStopped=!0))},i._onTouchCancel=function(){this._interactable&&this.enabledInHierarchy&&(this._pressed=!1,this._updateState())},i._onMouseMoveIn=function(){!this._pressed&&this.interactable&&this.enabledInHierarchy&&(this._transition!==A6.SPRITE||this._hoverSprite)&&(this._hovered||(this._hovered=!0,this._updateState()))},i._onMouseMoveOut=function(){this._hovered&&(this._hovered=!1,this._updateState())},i._updateState=function(){var t=this._getButtonState();this._applyTransition(t)},i._getButtonState=function(){var t=R6.NORMAL;return this._interactable?this._pressed?t=R6.PRESSED:this._hovered&&(t=R6.HOVER):t=R6.DISABLED,t.toString()},i._updateColorTransition=function(t){var e,i=this[t+"Color"],n=null===(e=this.target)||void 0===e?void 0:e.getComponent(kz);n&&(t===R6.DISABLED?n.color=i:(this._fromColor=n.color.clone(),this._toColor=i,this._time=0,this._transitionFinished=!1))},i._updateSpriteTransition=function(t){var e=this[t+"Sprite"];this._sprite&&e&&(this._sprite.spriteFrame=e)},i._updateScaleTransition=function(t){this._interactable&&(t===R6.PRESSED?this._zoomUp():this._zoomBack())},i._zoomUp=function(){this._originalScale&&(ji.copy(this._fromScale,this._originalScale),ji.multiplyScalar(this._toScale,this._originalScale,this._zoomScale),this._time=0,this._transitionFinished=!1)},i._zoomBack=function(){this.target&&this._originalScale&&(ji.copy(this._fromScale,this.target.getScale()),ji.copy(this._toScale,this._originalScale),this._time=0,this._transitionFinished=!1)},i._applyTransition=function(t){var e=this._transition;e===A6.COLOR?this._updateColorTransition(t):e===A6.SPRITE?this._updateSpriteTransition(t):e===A6.SCALE&&this._updateScaleTransition(t)},i._xrHoverEnter=function(){this._onMouseMoveIn(),this._updateState()},i._xrHoverExit=function(){this._onMouseMoveOut(),this._pressed&&(this._pressed=!1,this._updateState())},i._xrClick=function(){this._interactable&&this.enabledInHierarchy&&(this._pressed=!0,this._updateState())},i._xrUnClick=function(){this._interactable&&this.enabledInHierarchy&&(this._pressed&&(Sc.emitEvents(this.clickEvents,this),this.node.emit(b6.CLICK,this)),this._pressed=!1,this._updateState())},h(e,[{key:"target",get:function(){return this._target||this.node},set:function(t){this._target!==t&&(this._target&&this._unregisterTargetEvent(this._target),this._target=t,this._applyTarget())}},{key:"interactable",get:function(){return this._interactable},set:function(t){this._interactable!==t&&(this._interactable=t,this._updateState(),this._interactable||this._resetState())}},{key:"_resizeToTarget",set:function(t){t&&this._resizeNodeToTargetNode()}},{key:"transition",get:function(){return this._transition},set:function(t){this._transition!==t&&(this._transition===A6.COLOR?this._updateColorTransition(R6.NORMAL):this._transition===A6.SPRITE&&this._updateSpriteTransition(R6.NORMAL),this._transition=t,this._updateState())}},{key:"normalColor",get:function(){return this._normalColor},set:function(t){this._normalColor!==t&&(this._normalColor.set(t),this._updateState())}},{key:"pressedColor",get:function(){return this._pressedColor},set:function(t){this._pressedColor!==t&&this._pressedColor.set(t)}},{key:"hoverColor",get:function(){return this._hoverColor},set:function(t){this._hoverColor!==t&&this._hoverColor.set(t)}},{key:"disabledColor",get:function(){return this._disabledColor},set:function(t){this._disabledColor!==t&&(this._disabledColor.set(t),this._updateState())}},{key:"duration",get:function(){return this._duration},set:function(t){this._duration!==t&&(this._duration=t)}},{key:"zoomScale",get:function(){return this._zoomScale},set:function(t){this._zoomScale!==t&&(this._zoomScale=t)}},{key:"normalSprite",get:function(){return this._normalSprite},set:function(t){if(this._normalSprite!==t){this._normalSprite=t;var e=this.node.getComponent(PW);e&&(e.spriteFrame=t),this._updateState()}}},{key:"pressedSprite",get:function(){return this._pressedSprite},set:function(t){this._pressedSprite!==t&&(this._pressedSprite=t,this._updateState())}},{key:"hoverSprite",get:function(){return this._hoverSprite},set:function(t){this._hoverSprite!==t&&(this._hoverSprite=t,this._updateState())}},{key:"disabledSprite",get:function(){return this._disabledSprite},set:function(t){this._disabledSprite!==t&&(this._disabledSprite=t,this._updateState())}}]),e}(bc),T6.Transition=A6,T6.EventType=b6,T((a6=S6).prototype,"target",[S8,A8,R8],Object.getOwnPropertyDescriptor(a6.prototype,"target"),a6.prototype),T(a6.prototype,"interactable",[b8,C8],Object.getOwnPropertyDescriptor(a6.prototype,"interactable"),a6.prototype),T(a6.prototype,"transition",[w8,I8,O8],Object.getOwnPropertyDescriptor(a6.prototype,"transition"),a6.prototype),T(a6.prototype,"normalColor",[x8,P8],Object.getOwnPropertyDescriptor(a6.prototype,"normalColor"),a6.prototype),T(a6.prototype,"pressedColor",[D8,B8],Object.getOwnPropertyDescriptor(a6.prototype,"pressedColor"),a6.prototype),T(a6.prototype,"hoverColor",[N8,M8],Object.getOwnPropertyDescriptor(a6.prototype,"hoverColor"),a6.prototype),T(a6.prototype,"disabledColor",[L8,F8],Object.getOwnPropertyDescriptor(a6.prototype,"disabledColor"),a6.prototype),T(a6.prototype,"duration",[U8,G8,k8,z8],Object.getOwnPropertyDescriptor(a6.prototype,"duration"),a6.prototype),T(a6.prototype,"zoomScale",[H8,V8],Object.getOwnPropertyDescriptor(a6.prototype,"zoomScale"),a6.prototype),T(a6.prototype,"normalSprite",[W8,X8,j8],Object.getOwnPropertyDescriptor(a6.prototype,"normalSprite"),a6.prototype),T(a6.prototype,"pressedSprite",[Y8,K8,q8],Object.getOwnPropertyDescriptor(a6.prototype,"pressedSprite"),a6.prototype),T(a6.prototype,"hoverSprite",[Q8,Z8,J8],Object.getOwnPropertyDescriptor(a6.prototype,"hoverSprite"),a6.prototype),T(a6.prototype,"disabledSprite",[$8,t6,e6],Object.getOwnPropertyDescriptor(a6.prototype,"disabledSprite"),a6.prototype),o6=T(a6.prototype,"clickEvents",[i6,Eh,n6,r6],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),u6=T(a6.prototype,"_interactable",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),h6=T(a6.prototype,"_transition",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return A6.NONE}}),l6=T(a6.prototype,"_normalColor",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Gi.WHITE.clone()}}),c6=T(a6.prototype,"_hoverColor",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new Gi(211,211,211,255)}}),_6=T(a6.prototype,"_pressedColor",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Gi.WHITE.clone()}}),f6=T(a6.prototype,"_disabledColor",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new Gi(124,124,124,255)}}),d6=T(a6.prototype,"_normalSprite",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),p6=T(a6.prototype,"_hoverSprite",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),m6=T(a6.prototype,"_pressedSprite",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),g6=T(a6.prototype,"_disabledSprite",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),v6=T(a6.prototype,"_duration",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return.1}}),y6=T(a6.prototype,"_zoomScale",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 1.2}}),E6=T(a6.prototype,"_target",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),s6=a6))||s6)||s6)||s6)||s6)||s6)||s6));b.Button=w6;var I6,O6,x6,P6=function(){function t(){}return t.add=function(t){var e=this._tabIndexList;-1===e.indexOf(t)&&e.push(t)},t.remove=function(t){var e=this._tabIndexList,i=e.indexOf(t);-1!==i&&e.splice(i,1)},t.resort=function(){this._tabIndexList.sort((function(t,e){return t._delegate.tabIndex-e._delegate.tabIndex}))},t.next=function(t){var e=this._tabIndexList,i=e.indexOf(t);if(t.setFocus(!1),-1!==i){var n=e[i+1];n&&n._delegate.tabIndex>=0&&n.setFocus(!0)}},t}();P6._tabIndexList=[],function(t){t[t.DEFAULT=0]="DEFAULT",t[t.DONE=1]="DONE",t[t.SEND=2]="SEND",t[t.SEARCH=3]="SEARCH",t[t.GO=4]="GO",t[t.NEXT=5]="NEXT"}(I6||(I6={})),_e(I6),function(t){t[t.ANY=0]="ANY",t[t.EMAIL_ADDR=1]="EMAIL_ADDR",t[t.NUMERIC=2]="NUMERIC",t[t.PHONE_NUMBER=3]="PHONE_NUMBER",t[t.URL=4]="URL",t[t.DECIMAL=5]="DECIMAL",t[t.SINGLE_LINE=6]="SINGLE_LINE"}(O6||(O6={})),_e(O6),function(t){t[t.PASSWORD=0]="PASSWORD",t[t.SENSITIVE=1]="SENSITIVE",t[t.INITIAL_CAPS_WORD=2]="INITIAL_CAPS_WORD",t[t.INITIAL_CAPS_SENTENCE=3]="INITIAL_CAPS_SENTENCE",t[t.INITIAL_CAPS_ALL_CHARACTERS=4]="INITIAL_CAPS_ALL_CHARACTERS",t[t.DEFAULT=5]="DEFAULT"}(x6||(x6={})),_e(x6);var D6,B6,N6,M6,L6,F6,U6,G6,k6,z6,H6,V6,W6,X6,j6,Y6,K6,q6,Q6,Z6,J6,$6,t7,e7,i7,n7,r7,s7,a7,o7,u7,h7,l7,c7,_7,f7,d7,p7,m7,g7,v7,y7,E7,T7,S7,A7,R7,b7,C7,w7,I7,O7,x7,P7,D7,B7,N7,M7,L7,F7,U7,G7=function(){function t(){this._editing=!1,this._delegate=null}var e=t.prototype;return e.init=function(){},e.onEnable=function(){},e.update=function(){},e.onDisable=function(){this._editing&&this.endEditing()},e.clear=function(){this._delegate=null},e.setTabIndex=function(){},e.setSize=function(){},e.setFocus=function(t){t?this.beginEditing():this.endEditing()},e.isFocused=function(){return this._editing},e.beginEditing=function(){},e.endEditing=function(){},t}(),k7=new un,z7=new un,H7=new ji,V7=null,W7=0,X7=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._delegate=null,e._inputMode=-1,e._inputFlag=-1,e._returnType=-1,e.__eventListeners={},e.__autoResize=!1,e.__orientationChanged=void 0,e._edTxt=null,e._isTextArea=!1,e._textLabelFont=null,e._textLabelFontSize=null,e._textLabelFontColor=null,e._textLabelAlign=null,e._placeholderLabelFont=null,e._placeholderLabelFontSize=null,e._placeholderLabelFontColor=null,e._placeholderLabelAlign=null,e._placeholderLineHeight=null,e._placeholderStyleSheet=null,e._domId="EditBoxId_"+ ++W7,e}c(e,t);var i=e.prototype;return i.init=function(t){t&&(this._delegate=t,t.inputMode===O6.ANY?this._createTextArea():this._createInput(),P6.add(this),this.setTabIndex(t.tabIndex),this._initStyleSheet(),this._registerEventListeners(),this._addDomToGameContainer())},i.clear=function(){this._removeEventListeners(),this._removeDomFromGameContainer(),P6.remove(this),V7===this&&(V7=null),this._delegate=null},i.update=function(){this._updateMatrix()},i.setTabIndex=function(t){this._edTxt.tabIndex=t,P6.resort()},i.setSize=function(t,e){var i=this._edTxt;i&&(i.style.width=t+"px",i.style.height=e+"px")},i.beginEditing=function(){V7&&V7!==this&&V7.setFocus(!1),this._editing=!0,V7=this,this._delegate._editBoxEditingDidBegan(),this._showDom(),this._edTxt.focus()},i.endEditing=function(){this._edTxt.blur()},i._createInput=function(){this._isTextArea=!1,this._edTxt=document.createElement("input")},i._createTextArea=function(){this._isTextArea=!0,this._edTxt=document.createElement("textarea")},i._addDomToGameContainer=function(){PL.container&&this._edTxt&&(PL.container.appendChild(this._edTxt),document.head.appendChild(this._placeholderStyleSheet))},i._removeDomFromGameContainer=function(){Ie(PL.container,this._edTxt)&&this._edTxt&&PL.container.removeChild(this._edTxt),Ie(document.head,this._placeholderStyleSheet)&&document.head.removeChild(this._placeholderStyleSheet),this._edTxt=null,this._placeholderStyleSheet=null},i._showDom=function(){this._updateMaxLength(),this._updateInputType(),this._updateStyleSheet(),this._edTxt&&this._delegate&&(this._edTxt.style.display="",this._delegate._hideLabels()),Qa.isMobile&&this._showDomOnMobile()},i._hideDom=function(){var t=this._edTxt;t&&this._delegate&&(t.style.display="none",this._delegate._showLabels()),Qa.isMobile&&this._hideDomOnMobile()},i._showDomOnMobile=function(){Qa.os!==Fa.ANDROID&&Qa.os!==Fa.OHOS||(Xa.handleResizeEvent=!1,this._adjustWindowScroll())},i._hideDomOnMobile=function(){Qa.os!==Fa.ANDROID&&Qa.os!==Fa.OHOS||(Xa.handleResizeEvent=!0),this._scrollBackWindow()},i._adjustWindowScroll=function(){var t=this;setTimeout((function(){window.scrollY<40&&t._edTxt.scrollIntoView({block:"start",inline:"nearest",behavior:"smooth"})}),400)},i._scrollBackWindow=function(){setTimeout((function(){Qa.browserType!==Na.WECHAT||Qa.os!==Fa.IOS?window.scrollTo(0,0):window.top&&window.top.scrollTo(0,0)}),400)},i._updateMatrix=function(){if(this._edTxt){var t=this._delegate.node,e=zL.getScaleX(),i=zL.getScaleY(),n=zL.getViewportRect(),r=Xa.devicePixelRatio;t.getWorldMatrix(k7);var s=t._uiProps.uiTransformComp;if(s&&ji.set(H7,-s.anchorX*s.width,-s.anchorY*s.height,H7.z),un.transform(k7,k7,H7),t._uiProps.uiTransformComp){var a=OL.root.batcher2D.getFirstRenderCamera(t);if(a){a.node.getWorldRT(z7);var o=z7.m12,u=z7.m13,h=NL.center;z7.m12=h.x-(z7.m00*o+z7.m04*u),z7.m13=h.y-(z7.m01*o+z7.m05*u),un.multiply(z7,z7,k7),e/=r,i/=r;var l=PL.container,c=z7.m00*e,_=k7.m01,f=k7.m04,d=z7.m05*i,p=parseInt(l&&l.style.paddingLeft||"0");p+=n.x/r;var m=parseInt(l&&l.style.paddingBottom||"0");m+=n.y/r;var g="matrix("+c+","+-_+","+-f+","+d+","+(z7.m12*e+p)+","+-(z7.m13*i+m)+")";this._edTxt.style.transform=g,this._edTxt.style["-webkit-transform"]=g,this._edTxt.style["transform-origin"]="0px 100% 0px",this._edTxt.style["-webkit-transform-origin"]="0px 100% 0px"}}}},i._updateInputType=function(){var t=this._delegate,e=t.inputMode,i=t.inputFlag,n=t.returnType,r=this._edTxt;if(this._inputMode!==e||this._inputFlag!==i||this._returnType!==n){if(this._inputMode=e,this._inputFlag=i,this._returnType=n,this._isTextArea){var s="none";return i===x6.INITIAL_CAPS_ALL_CHARACTERS?s="uppercase":i===x6.INITIAL_CAPS_WORD&&(s="capitalize"),void(r.style.textTransform=s)}if(r=r,i===x6.PASSWORD)return r.type="password",void(r.style.textTransform="none");var a=r.type;e===O6.EMAIL_ADDR?a="email":e===O6.NUMERIC||e===O6.DECIMAL?a="number":e===O6.PHONE_NUMBER?(a="number",r.pattern="[0-9]*",r.addEventListener("wheel",(function(){return!1}))):e===O6.URL?a="url":(a="text",n===I6.SEARCH&&(a="search")),r.type=a;var o="none";i===x6.INITIAL_CAPS_ALL_CHARACTERS?o="uppercase":i===x6.INITIAL_CAPS_WORD&&(o="capitalize"),r.style.textTransform=o}},i._updateMaxLength=function(){var t=this._delegate.maxLength;t<0&&(t=65535),this._edTxt.maxLength=t},i._initStyleSheet=function(){if(this._edTxt){var t=this._edTxt;t.style.color="#000000",t.style.border="0px",t.style.background="transparent",t.style.width="100%",t.style.height="100%",t.style.outline="medium",t.style.padding="0",t.style.textTransform="none",t.style.display="none",t.style.position="absolute",t.style.bottom="0px",t.style.left="2px",t.className="cocosEditBox",t.style.fontFamily="Arial",t.id=this._domId,this._isTextArea?(t.style.resize="none",t.style.overflowY="scroll"):((t=t).type="text",t.style["-moz-appearance"]="textfield"),this._placeholderStyleSheet=document.createElement("style")}},i._updateStyleSheet=function(){var t=this._delegate,e=this._edTxt;e&&t&&(e.value=t.string,this._updateTextLabel(t.textLabel))},i._updateTextLabel=function(t){if(t){var e=t.font;e=!e||e instanceof xU?t.fontFamily:e._fontFamily;var i=t.fontSize*t.node.scale.y;if((this._textLabelFont!==e||this._textLabelFontSize!==i||this._textLabelFontColor!==t.fontColor||this._textLabelAlign!==t.horizontalAlign)&&(this._textLabelFont=e,this._textLabelFontSize=i,this._textLabelFontColor=t.fontColor,this._textLabelAlign=t.horizontalAlign,this._edTxt)){var n=this._edTxt;switch(n.style.fontSize=i+"px",n.style.color=t.color.toCSS(),n.style.fontFamily=e,t.horizontalAlign){case zz.HorizontalAlign.LEFT:n.style.textAlign="left";break;case zz.HorizontalAlign.CENTER:n.style.textAlign="center";break;case zz.HorizontalAlign.RIGHT:n.style.textAlign="right"}}}},i._updatePlaceholderLabel=function(t){if(t){var e=t.font;e=!e||e instanceof xU?t.fontFamily:t.font._fontFamily;var i=t.fontSize*t.node.scale.y;if(this._placeholderLabelFont!==e||this._placeholderLabelFontSize!==i||this._placeholderLabelFontColor!==t.fontColor||this._placeholderLabelAlign!==t.horizontalAlign||this._placeholderLineHeight!==t.fontSize){this._placeholderLabelFont=e,this._placeholderLabelFontSize=i,this._placeholderLabelFontColor=t.fontColor,this._placeholderLabelAlign=t.horizontalAlign,this._placeholderLineHeight=t.fontSize;var n=this._placeholderStyleSheet,r=t.color.toCSS(),s=t.fontSize,a="";switch(t.horizontalAlign){case zz.HorizontalAlign.LEFT:a="left";break;case zz.HorizontalAlign.CENTER:a="center";break;case zz.HorizontalAlign.RIGHT:a="right"}n.innerHTML="#"+this._domId+"::-webkit-input-placeholder{text-transform: initial;-family: "+e+";font-size: "+i+"px;color: "+r+";line-height: "+s+"px;text-align: "+a+";}#"+this._domId+"::-moz-placeholder{text-transform: initial;-family: "+e+";font-size: "+i+"px;color: "+r+";line-height: "+s+"px;text-align: "+a+";}#"+this._domId+"::-ms-input-placeholder{text-transform: initial;-family: "+e+";font-size: "+i+"px;color: "+r+";line-height: "+s+"px;text-align: "+a+";}",Qa.browserType===Na.EDGE&&(n.innerHTML+="#"+this._domId+"::-ms-clear{display: none;}")}}},i._registerEventListeners=function(){var t=this;if(this._edTxt){var e=this._edTxt,i=!1,n=this.__eventListeners;n.compositionStart=function(){i=!0},n.compositionEnd=function(){i=!1,t._delegate._editBoxTextChanged(e.value)},n.onInput=function(){if(!i){var n=t._delegate,r=n.maxLength;r>=0&&(e.value=e.value.slice(0,r)),n._editBoxTextChanged(e.value)}},n.onClick=function(){t._editing&&Qa.isMobile&&t._adjustWindowScroll()},n.onKeydown=function(i){i.keyCode===dA.ENTER?(i.propagationStopped=!0,t._delegate._editBoxEditingReturn(),t._isTextArea||e.blur()):i.keyCode===dA.TAB&&(i.propagationStopped=!0,i.preventDefault(),P6.next(t))},n.onBlur=function(){Qa.isMobile&&i&&n.compositionEnd(),t._editing=!1,V7=null,t._hideDom(),t._delegate._editBoxEditingDidEnded()},e.addEventListener("compositionstart",n.compositionStart),e.addEventListener("compositionend",n.compositionEnd),e.addEventListener("input",n.onInput),e.addEventListener("keydown",n.onKeydown),e.addEventListener("blur",n.onBlur),e.addEventListener("touchstart",n.onClick)}},i._removeEventListeners=function(){if(this._edTxt){var t=this._edTxt,e=this.__eventListeners;t.removeEventListener("compositionstart",e.compositionStart),t.removeEventListener("compositionend",e.compositionEnd),t.removeEventListener("input",e.onInput),t.removeEventListener("keydown",e.onKeydown),t.removeEventListener("blur",e.onBlur),t.removeEventListener("touchstart",e.onClick),e.compositionStart=null,e.compositionEnd=null,e.onInput=null,e.onKeydown=null,e.onBlur=null,e.onClick=null}},e}(G7);!function(t){t.EDITING_DID_BEGAN="editing-did-began",t.EDITING_DID_ENDED="editing-did-ended",t.TEXT_CHANGED="text-changed",t.EDITING_RETURN="editing-return",t.XR_EDITING_DID_BEGAN="xr-editing-did-began",t.XR_EDITING_DID_ENDED="xr-editing-did-ended"}(U7||(U7={}));var j7,Y7,K7,q7,Q7,Z7,J7,$7,t9,e9,i9,n9,r9,s9,a9,o9,u9,h9,l9,c9,_9,f9,d9,p9,m9,g9,v9,y9,E9,T9,S9,A9,R9,b9,C9,w9,I9,O9,x9,P9,D9,B9,N9,M9,L9,F9,U9,G9,k9,z9,H9,V9,W9,X9,j9,Y9,K9,q9,Q9,Z9,J9,$9=function(e){return t({EditBox:e,EditBoxComponent:e}),e}((D6=_h("cc.EditBox"),B6=xh(),N6=dh(110),M6=Ch(),L6=fh(Ak),F6=zh(),U6=Mh(),G6=zh(),k6=Mh(),z6=Kh(zz),H6=zh(),V6=Mh(),W6=Kh(zz),X6=zh(),j6=Mh(),Y6=Kh(hU),K6=zh(),q6=Mh(),Q6=Kh(x6),Z6=zh(),J6=Mh(),$6=Kh(O6),t7=zh(),e7=Mh(),i7=Kh(I6),n7=zh(),r7=Mh(),s7=zh(),a7=Mh(),o7=zh(),u7=Mh(),h7=Kh([Sc]),l7=zh(),c7=Mh(),_7=Kh([Sc]),f7=zh(),d7=Mh(),p7=Kh([Sc]),m7=zh(),g7=Mh(),v7=Kh([Sc]),y7=zh(),E7=Mh(),D6(T7=B6(T7=N6(T7=M6(T7=L6(T7=bh((F7=L7=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return E(e=t.call.apply(t,[this].concat(n))||this,"editingDidBegan",A7,g(e)),E(e,"textChanged",R7,g(e)),E(e,"editingDidEnded",b7,g(e)),E(e,"editingReturn",C7,g(e)),e._impl=null,e._background=null,E(e,"_textLabel",w7,g(e)),E(e,"_placeholderLabel",I7,g(e)),E(e,"_returnType",O7,g(e)),E(e,"_string",x7,g(e)),E(e,"_tabIndex",P7,g(e)),E(e,"_backgroundImage",D7,g(e)),E(e,"_inputFlag",B7,g(e)),E(e,"_inputMode",N7,g(e)),E(e,"_maxLength",M7,g(e)),e._isLabelVisible=!1,e}c(e,t);var i=e.prototype;return i.__preload=function(){this._init()},i.onEnable=function(){this._registerEvent(),this._ensureBackgroundSprite(),this._impl&&this._impl.onEnable()},i.update=function(){this._impl&&this._impl.update()},i.onDisable=function(){this._unregisterEvent(),this._unregisterBackgroundEvent(),this._impl&&this._impl.onDisable()},i.onDestroy=function(){this._impl&&this._impl.clear()},i.setFocus=function(){this._impl&&this._impl.setFocus(!0)},i.focus=function(){this._impl&&this._impl.setFocus(!0)},i.blur=function(){this._impl&&this._impl.setFocus(!1)},i.isFocused=function(){return!!this._impl&&this._impl.isFocused()},i._editBoxEditingDidBegan=function(){Sc.emitEvents(this.editingDidBegan,this),this.node.emit(U7.EDITING_DID_BEGAN,this)},i._editBoxEditingDidEnded=function(){Sc.emitEvents(this.editingDidEnded,this),this.node.emit(U7.EDITING_DID_ENDED,this)},i._editBoxTextChanged=function(t){t=this._updateLabelStringStyle(t,!0),this.string=t,Sc.emitEvents(this.textChanged,t,this),this.node.emit(U7.TEXT_CHANGED,this)},i._editBoxEditingReturn=function(){Sc.emitEvents(this.editingReturn,this),this.node.emit(U7.EDITING_RETURN,this)},i._showLabels=function(){this._isLabelVisible=!0,this._updateLabels()},i._hideLabels=function(){this._isLabelVisible=!1,this._textLabel&&(this._textLabel.node.active=!1),this._placeholderLabel&&(this._placeholderLabel.node.active=!1)},i._onTouchBegan=function(t){t.propagationStopped=!0},i._onTouchCancel=function(t){t.propagationStopped=!0},i._onTouchEnded=function(t){this._impl&&this._impl.beginEditing(),t.propagationStopped=!0},i._init=function(){this._updatePlaceholderLabel(),this._updateTextLabel(),this._isLabelVisible=!0,this.node.on(aE.SIZE_CHANGED,this._resizeChildNodes,this),(this._impl=new e._EditBoxImpl).init(this),this._updateString(this._string),this._syncSize()},i._ensureBackgroundSprite=function(){if(!this._background){var t=this.node.getComponent(PW);t||(t=this.node.addComponent(PW)),t!==this._background&&(t.type=PW.Type.SLICED,t.spriteFrame=this._backgroundImage,this._background=t,this._registerBackgroundEvent())}},i._updateTextLabel=function(){var t=this._textLabel;if(!t){var e=this.node.getChildByName("TEXT_LABEL");e||((e=new jE("TEXT_LABEL")).layer=this.node.layer),(t=e.getComponent(zz))||(t=e.addComponent(zz)),e.parent=this.node,this._textLabel=t}this._textLabel.node._uiProps.uiTransformComp.setAnchorPoint(0,1),t.overflow=zz.Overflow.CLAMP,this._inputMode===O6.ANY?(t.verticalAlign=Fz.TOP,t.enableWrapText=!0):t.enableWrapText=!1,t.string=this._updateLabelStringStyle(this._string)},i._updatePlaceholderLabel=function(){var t=this._placeholderLabel;if(!t){var e=this.node.getChildByName("PLACEHOLDER_LABEL");e||((e=new jE("PLACEHOLDER_LABEL")).layer=this.node.layer),(t=e.getComponent(zz))||(t=e.addComponent(zz)),e.parent=this.node,this._placeholderLabel=t}this._placeholderLabel.node._uiProps.uiTransformComp.setAnchorPoint(0,1),this._inputMode===O6.ANY?t.enableWrapText=!0:t.enableWrapText=!1,t.string=this.placeholder},i._syncSize=function(){var t=this.node._uiProps.uiTransformComp,e=t.contentSize;if(this._background){var i=this._background.node._uiProps.uiTransformComp;i.anchorPoint=t.anchorPoint,i.setContentSize(e)}this._updateLabelPosition(e),this._impl&&this._impl.setSize(e.width,e.height)},i._updateLabels=function(){if(this._isLabelVisible){var t=this._string;this._textLabel&&(this._textLabel.node.active=""!==t),this._placeholderLabel&&(this._placeholderLabel.node.active=""===t)}},i._updateString=function(t){var e=this._textLabel;if(e){var i=t;i&&(i=this._updateLabelStringStyle(i)),e.string=i,this._updateLabels()}},i._updateLabelStringStyle=function(t,e){void 0===e&&(e=!1);var i,n=this._inputFlag;if(e||n!==x6.PASSWORD)n===x6.INITIAL_CAPS_ALL_CHARACTERS?t=t.toUpperCase():n===x6.INITIAL_CAPS_WORD?t=t.replace(/(?:^|\s)\S/g,(function(t){return t.toUpperCase()})):n===x6.INITIAL_CAPS_SENTENCE&&(t=(i=t).charAt(0).toUpperCase()+i.slice(1));else{for(var r="",s=t.length,a=0;a<s;++a)r+="●";t=r}return t},i._registerEvent=function(){this.node.on(aE.TOUCH_START,this._onTouchBegan,this),this.node.on(aE.TOUCH_END,this._onTouchEnded,this),this.node.on(h8.XRUI_UNCLICK,this._xrUnClick,this),this.node.on(l8.XR_KEYBOARD_INPUT,this._xrKeyBoardInput,this)},i._unregisterEvent=function(){this.node.off(aE.TOUCH_START,this._onTouchBegan,this),this.node.off(aE.TOUCH_END,this._onTouchEnded,this),this.node.off(h8.XRUI_UNCLICK,this._xrUnClick,this),this.node.off(l8.XR_KEYBOARD_INPUT,this._xrKeyBoardInput,this)},i._onBackgroundSpriteFrameChanged=function(){this._background&&(this.backgroundImage=this._background.spriteFrame)},i._registerBackgroundEvent=function(){var t=this._background&&this._background.node;null==t||t.on(PW.EventType.SPRITE_FRAME_CHANGED,this._onBackgroundSpriteFrameChanged,this)},i._unregisterBackgroundEvent=function(){var t=this._background&&this._background.node;null==t||t.off(PW.EventType.SPRITE_FRAME_CHANGED,this._onBackgroundSpriteFrameChanged,this)},i._updateLabelPosition=function(t){var e=this.node._uiProps.uiTransformComp,i=-e.anchorX*e.width,n=-e.anchorY*e.height,r=this._placeholderLabel,s=this._textLabel;s&&(s.node._uiProps.uiTransformComp.setContentSize(t.width-2,t.height),s.node.setPosition(i+2,n+t.height,s.node.position.z),this._inputMode===O6.ANY&&(s.verticalAlign=Fz.TOP),s.enableWrapText=this._inputMode===O6.ANY),r&&(r.node._uiProps.uiTransformComp.setContentSize(t.width-2,t.height),r.lineHeight=t.height,r.node.setPosition(i+2,n+t.height,r.node.position.z),r.enableWrapText=this._inputMode===O6.ANY)},i._resizeChildNodes=function(){var t=this.node._uiProps.uiTransformComp,e=this._textLabel&&this._textLabel.node;e&&(e.setPosition(-t.width/2,t.height/2,e.position.z),e._uiProps.uiTransformComp.setContentSize(t.contentSize));var i=this._placeholderLabel&&this._placeholderLabel.node;i&&(i.setPosition(-t.width/2,t.height/2,i.position.z),i._uiProps.uiTransformComp.setContentSize(t.contentSize));var n=this._background&&this._background.node;n&&n._uiProps.uiTransformComp.setContentSize(t.contentSize),this._syncSize()},i._xrUnClick=function(){this.node.emit(U7.XR_EDITING_DID_BEGAN,this._maxLength,this.string)},i._xrKeyBoardInput=function(t){this.string=t},h(e,[{key:"string",get:function(){return this._string},set:function(t){this._maxLength>=0&&t.length>=this._maxLength&&(t=t.slice(0,this._maxLength)),this._string!==t&&(this._string=t,this._updateString(t))}},{key:"placeholder",get:function(){return this._placeholderLabel?this._placeholderLabel.string:""},set:function(t){this._placeholderLabel&&(this._placeholderLabel.string=t)}},{key:"textLabel",get:function(){return this._textLabel},set:function(t){this._textLabel!==t&&(this._textLabel=t,this._textLabel&&(this._updateTextLabel(),this._updateLabels()))}},{key:"placeholderLabel",get:function(){return this._placeholderLabel},set:function(t){this._placeholderLabel!==t&&(this._placeholderLabel=t,this._placeholderLabel&&(this._updatePlaceholderLabel(),this._updateLabels()))}},{key:"backgroundImage",get:function(){return this._backgroundImage},set:function(t){this._backgroundImage!==t&&(this._backgroundImage=t,this._ensureBackgroundSprite(),this._background.spriteFrame=t)}},{key:"inputFlag",get:function(){return this._inputFlag},set:function(t){this._inputFlag!==t&&(this._inputFlag=t,this._updateString(this._string))}},{key:"inputMode",get:function(){return this._inputMode},set:function(t){this._inputMode!==t&&(this._inputMode=t,this._updateTextLabel(),this._updatePlaceholderLabel())}},{key:"returnType",get:function(){return this._returnType},set:function(t){this._returnType=t}},{key:"maxLength",get:function(){return this._maxLength},set:function(t){this._maxLength=t}},{key:"tabIndex",get:function(){return this._tabIndex},set:function(t){this._tabIndex!==t&&(this._tabIndex=t,this._impl&&this._impl.setTabIndex(t))}}]),e}(bc),L7._EditBoxImpl=G7,L7.KeyboardReturnType=I6,L7.InputFlag=x6,L7.InputMode=O6,L7.EventType=U7,T((S7=F7).prototype,"string",[F6,U6],Object.getOwnPropertyDescriptor(S7.prototype,"string"),S7.prototype),T(S7.prototype,"placeholder",[G6,k6],Object.getOwnPropertyDescriptor(S7.prototype,"placeholder"),S7.prototype),T(S7.prototype,"textLabel",[z6,H6,V6],Object.getOwnPropertyDescriptor(S7.prototype,"textLabel"),S7.prototype),T(S7.prototype,"placeholderLabel",[W6,X6,j6],Object.getOwnPropertyDescriptor(S7.prototype,"placeholderLabel"),S7.prototype),T(S7.prototype,"backgroundImage",[Y6,K6,q6],Object.getOwnPropertyDescriptor(S7.prototype,"backgroundImage"),S7.prototype),T(S7.prototype,"inputFlag",[Q6,Z6,J6],Object.getOwnPropertyDescriptor(S7.prototype,"inputFlag"),S7.prototype),T(S7.prototype,"inputMode",[$6,t7,e7],Object.getOwnPropertyDescriptor(S7.prototype,"inputMode"),S7.prototype),T(S7.prototype,"returnType",[i7,n7,r7],Object.getOwnPropertyDescriptor(S7.prototype,"returnType"),S7.prototype),T(S7.prototype,"maxLength",[s7,a7],Object.getOwnPropertyDescriptor(S7.prototype,"maxLength"),S7.prototype),T(S7.prototype,"tabIndex",[o7,u7],Object.getOwnPropertyDescriptor(S7.prototype,"tabIndex"),S7.prototype),A7=T(S7.prototype,"editingDidBegan",[h7,Eh,l7,c7],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),R7=T(S7.prototype,"textChanged",[_7,Eh,f7,d7],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),b7=T(S7.prototype,"editingDidEnded",[p7,Eh,m7,g7],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),C7=T(S7.prototype,"editingReturn",[v7,Eh,y7,E7],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),w7=T(S7.prototype,"_textLabel",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),I7=T(S7.prototype,"_placeholderLabel",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),O7=T(S7.prototype,"_returnType",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return I6.DEFAULT}}),x7=T(S7.prototype,"_string",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),P7=T(S7.prototype,"_tabIndex",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),D7=T(S7.prototype,"_backgroundImage",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),B7=T(S7.prototype,"_inputFlag",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return x6.DEFAULT}}),N7=T(S7.prototype,"_inputMode",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return O6.ANY}}),M7=T(S7.prototype,"_maxLength",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 20}}),T7=S7))||T7)||T7)||T7)||T7)||T7)||T7));"object"==typeof window&&"object"==typeof document&&($9._EditBoxImpl=X7),b.internal.EditBox=$9,function(t){t[t.NONE=0]="NONE",t[t.HORIZONTAL=1]="HORIZONTAL",t[t.VERTICAL=2]="VERTICAL",t[t.GRID=3]="GRID"}(Y9||(Y9={})),pe(Y9),function(t){t[t.NONE=0]="NONE",t[t.CONTAINER=1]="CONTAINER",t[t.CHILDREN=2]="CHILDREN"}(K9||(K9={})),pe(K9),function(t){t[t.HORIZONTAL=0]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(q9||(q9={})),pe(q9),function(t){t[t.BOTTOM_TO_TOP=0]="BOTTOM_TO_TOP",t[t.TOP_TO_BOTTOM=1]="TOP_TO_BOTTOM"}(Q9||(Q9={})),pe(Q9),function(t){t[t.LEFT_TO_RIGHT=0]="LEFT_TO_RIGHT",t[t.RIGHT_TO_LEFT=1]="RIGHT_TO_LEFT"}(Z9||(Z9={})),pe(Z9),function(t){t[t.NONE=0]="NONE",t[t.FIXED_ROW=1]="FIXED_ROW",t[t.FIXED_COL=2]="FIXED_COL"}(J9||(J9={})),pe(J9);var ttt,ett,itt,ntt,rtt,stt,att,ott,utt,htt,ltt,ctt,_tt,ftt,dtt,ptt,mtt,gtt,vtt,ytt,Ett,Ttt,Stt,Att=new ji,Rtt=function(e){return t({Layout:e,LayoutComponent:e}),e}((j7=_h("cc.Layout"),Y7=xh(),K7=dh(110),q7=Ch(),Q7=fh(Ak),Z7=Dh(),J7=Mh(),$7=Dh(),t9=Mh(),e9=Kh(Y9),i9=zh(),n9=Mh(),r9=Kh(K9),s9=Dh(),a9=Mh(),o9=Dh(),u9=Mh(),h9=Kh(q9),l9=Mh(),c9=Mh(),_9=Mh(),f9=Mh(),d9=Mh(),p9=Mh(),m9=Mh(),g9=Kh(Q9),v9=Mh(),y9=Kh(Z9),E9=Mh(),T9=Kh(J9),S9=Dh(),A9=Mh(),R9=Dh(),b9=Mh(),C9=Mh(),j7(w9=Y7(w9=K7(w9=q7(w9=Q7(w9=bh((j9=X9=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return E(e=t.call.apply(t,[this].concat(n))||this,"_resizeMode",O9,g(e)),E(e,"_layoutType",x9,g(e)),E(e,"_cellSize",P9,g(e)),E(e,"_startAxis",D9,g(e)),E(e,"_paddingLeft",B9,g(e)),E(e,"_paddingRight",N9,g(e)),E(e,"_paddingTop",M9,g(e)),E(e,"_paddingBottom",L9,g(e)),E(e,"_spacingX",F9,g(e)),E(e,"_spacingY",U9,g(e)),E(e,"_verticalDirection",G9,g(e)),E(e,"_horizontalDirection",k9,g(e)),E(e,"_constraint",z9,g(e)),E(e,"_constraintNum",H9,g(e)),E(e,"_affectedByScale",V9,g(e)),E(e,"_isAlign",W9,g(e)),e._layoutSize=new gn(300,200),e._layoutDirty=!0,e._childrenDirty=!1,e._usefulLayoutObj=[],e._init=!1,e}c(e,t);var i=e.prototype;return i.updateLayout=function(t){void 0===t&&(t=!1),(this._layoutDirty||t)&&this.node.children.length>0&&(this._doLayout(),this._layoutDirty=!1)},i.onEnable=function(){this._addEventListeners();var t=this.node._uiProps.uiTransformComp;t.contentSize.equals(gn.ZERO)&&t.setContentSize(this._layoutSize),this._childrenChanged()},i.onDisable=function(){this._usefulLayoutObj.length=0,this._removeEventListeners()},i._checkUsefulObj=function(){this._usefulLayoutObj.length=0;for(var t=this.node.children,e=0;e<t.length;++e){var i=t[e],n=i._uiProps.uiTransformComp;i.activeInHierarchy&&n&&this._usefulLayoutObj.push(n)}},i._addEventListeners=function(){OL.on(IL.EVENT_AFTER_UPDATE,this.updateLayout,this),this.node.on(aE.SIZE_CHANGED,this._resized,this),this.node.on(aE.ANCHOR_CHANGED,this._doLayoutDirty,this),this.node.on(aE.CHILD_ADDED,this._childAdded,this),this.node.on(aE.CHILD_REMOVED,this._childRemoved,this),this.node.on(aE.SIBLING_ORDER_CHANGED,this._childrenChanged,this),this.node.on("childrenSiblingOrderChanged",this.updateLayout,this),this._addChildrenEventListeners()},i._removeEventListeners=function(){OL.off(IL.EVENT_AFTER_UPDATE,this.updateLayout,this),this.node.off(aE.SIZE_CHANGED,this._resized,this),this.node.off(aE.ANCHOR_CHANGED,this._doLayoutDirty,this),this.node.off(aE.CHILD_ADDED,this._childAdded,this),this.node.off(aE.CHILD_REMOVED,this._childRemoved,this),this.node.off(aE.SIBLING_ORDER_CHANGED,this._childrenChanged,this),this.node.off("childrenSiblingOrderChanged",this.updateLayout,this),this._removeChildrenEventListeners()},i._addChildrenEventListeners=function(){for(var t=this.node.children,e=0;e<t.length;++e){var i=t[e];i.on(aE.SIZE_CHANGED,this._doLayoutDirty,this),i.on(aE.TRANSFORM_CHANGED,this._transformDirty,this),i.on(aE.ANCHOR_CHANGED,this._doLayoutDirty,this),i.on(aE.ACTIVE_IN_HIERARCHY_CHANGED,this._childrenChanged,this)}},i._removeChildrenEventListeners=function(){for(var t=this.node.children,e=0;e<t.length;++e){var i=t[e];i.off(aE.SIZE_CHANGED,this._doLayoutDirty,this),i.off(aE.TRANSFORM_CHANGED,this._transformDirty,this),i.off(aE.ANCHOR_CHANGED,this._doLayoutDirty,this),i.off(aE.ACTIVE_IN_HIERARCHY_CHANGED,this._childrenChanged,this)}},i._childAdded=function(t){t.on(aE.SIZE_CHANGED,this._doLayoutDirty,this),t.on(aE.TRANSFORM_CHANGED,this._transformDirty,this),t.on(aE.ANCHOR_CHANGED,this._doLayoutDirty,this),t.on(aE.ACTIVE_IN_HIERARCHY_CHANGED,this._childrenChanged,this),this._childrenChanged()},i._childRemoved=function(t){t.off(aE.SIZE_CHANGED,this._doLayoutDirty,this),t.off(aE.TRANSFORM_CHANGED,this._transformDirty,this),t.off(aE.ANCHOR_CHANGED,this._doLayoutDirty,this),t.off(aE.ACTIVE_IN_HIERARCHY_CHANGED,this._childrenChanged,this),this._childrenChanged()},i._resized=function(){this._layoutSize.set(this.node._uiProps.uiTransformComp.contentSize),this._doLayoutDirty()},i._doLayoutHorizontally=function(t,e,i,n){var r=this.node._uiProps.uiTransformComp.anchorPoint,s=this._getFixedBreakingNum(),a=1,o=this._paddingLeft;this._horizontalDirection===Z9.RIGHT_TO_LEFT&&(a=-1,o=this._paddingRight);var u=(this._horizontalDirection-r.x)*t+a*o,h=u-a*this._spacingX,l=0,c=0,_=0,f=0,d=!1,p=this._usefulLayoutObj.length,m=this._cellSize.width,g=this._getPaddingH();this._layoutType!==Y9.GRID&&this._resizeMode===K9.CHILDREN&&(m=(t-g-(p-1)*this._spacingX)/p);for(var v=this._usefulLayoutObj,y=0;y<v.length;++y){var E=v[y],T=E.node,S=T.scale,A=this._getUsedScaleValue(S.x),R=this._getUsedScaleValue(S.y);this._resizeMode===K9.CHILDREN&&(E.width=m/A,this._layoutType===Y9.GRID&&(E.height=this._cellSize.height/R));var b=Math.abs(this._horizontalDirection-E.anchorX),C=E.width*A,w=E.height*R;w>_&&(f=Math.max(_,f),c=_||w,_=w),h+=a*(b*C+this._spacingX);var I=a*(1-b)*C;if(e){if(s>0)(d=y/s>0&&y%s==0)&&(c=_>w?_:c);else if(C>t-g)h>u+a*b*C&&(d=!0);else{var O=(1-this._horizontalDirection-r.x)*t,x=h+I+a*(a>0?this._paddingRight:this._paddingLeft);d=Math.abs(x)>Math.abs(O)}d&&(h=u+a*b*C,w!==_&&(c=_),l+=c+this._spacingY,c=_=w)}var P=i(T,E,l);n&&T.setPosition(h,P),h+=I}return c=Math.max(c,_),Math.max(f,l+c)+this._getPaddingV()},i._doLayoutVertically=function(t,e,i,n){var r=this.node._uiProps.uiTransformComp.anchorPoint,s=this._getFixedBreakingNum(),a=1,o=this._paddingBottom;this._verticalDirection===Q9.TOP_TO_BOTTOM&&(a=-1,o=this._paddingTop);var u=(this._verticalDirection-r.y)*t+a*o,h=u-a*this._spacingY,l=0,c=0,_=0,f=0,d=!1,p=this._usefulLayoutObj.length,m=this._cellSize.height,g=this._getPaddingV();this._layoutType!==Y9.GRID&&this._resizeMode===K9.CHILDREN&&(m=(t-g-(p-1)*this._spacingY)/p);for(var v=this._usefulLayoutObj,y=0;y<v.length;++y){var E=v[y],T=E.node,S=T.scale,A=this._getUsedScaleValue(S.x),R=this._getUsedScaleValue(S.y);this._resizeMode===K9.CHILDREN&&(E.height=m/R,this._layoutType===Y9.GRID&&(E.width=this._cellSize.width/A));var b=Math.abs(this._verticalDirection-E.anchorY),C=E.width*A,w=E.height*R;C>l&&(c=Math.max(l,c),_=l||C,l=C),h+=a*(b*w+this._spacingY);var I=a*(1-b)*w;if(e){if(s>0)(d=y/s>0&&y%s==0)&&(_=l>w?l:_);else if(w>t-g)h>u+a*b*w&&(d=!0);else{var O=(1-this._verticalDirection-r.y)*t,x=h+I+a*(a>0?this._paddingTop:this._paddingBottom);d=Math.abs(x)>Math.abs(O)}d&&(h=u+a*b*w,C!==l&&(_=l),f+=_+this._spacingX,_=l=C)}var P=i(T,E,f);n&&(T.getPosition(Att),T.setPosition(P,h,Att.z)),h+=I}return _=Math.max(_,l),Math.max(c,f+_)+this._getPaddingH()},i._doLayoutGridAxisHorizontal=function(t,e){var i=this,n=e.width,r=1,s=-t.y*e.height,a=this._paddingBottom;this._verticalDirection===Q9.TOP_TO_BOTTOM&&(r=-1,s=(1-t.y)*e.height,a=this._paddingTop);var o=function(t,e,n){return s+r*(n+(1-e.anchorY)*e.height*i._getUsedScaleValue(t.scale.y)+a)},u=0;this._resizeMode===K9.CONTAINER&&(u=this._doLayoutHorizontally(n,!0,o,!1),s=-t.y*u,this._verticalDirection===Q9.TOP_TO_BOTTOM&&(r=-1,s=(1-t.y)*u)),this._doLayoutHorizontally(n,!0,o,!0),this._resizeMode===K9.CONTAINER&&this.node._uiProps.uiTransformComp.setContentSize(n,u)},i._doLayoutGridAxisVertical=function(t,e){var i=this,n=e.height,r=1,s=-t.x*e.width,a=this._paddingLeft;this._horizontalDirection===Z9.RIGHT_TO_LEFT&&(r=-1,s=(1-t.x)*e.width,a=this._paddingRight);var o=function(t,e,n){return s+r*(n+(1-e.anchorX)*e.width*i._getUsedScaleValue(t.scale.x)+a)},u=0;this._resizeMode===K9.CONTAINER&&(u=this._doLayoutVertically(n,!0,o,!1),s=-t.x*u,this._horizontalDirection===Z9.RIGHT_TO_LEFT&&(r=-1,s=(1-t.x)*u)),this._doLayoutVertically(n,!0,o,!0),this._resizeMode===K9.CONTAINER&&this.node._uiProps.uiTransformComp.setContentSize(u,n)},i._doLayoutGrid=function(){var t=this.node._uiProps.uiTransformComp,e=t.anchorPoint,i=t.contentSize;this.startAxis===q9.HORIZONTAL?this._doLayoutGridAxisHorizontal(e,i):this.startAxis===q9.VERTICAL&&this._doLayoutGridAxisVertical(e,i)},i._getHorizontalBaseWidth=function(){var t=this._usefulLayoutObj,e=0,i=t.length;if(this._resizeMode===K9.CONTAINER){for(var n=0;n<t.length;++n){var r=t[n],s=r.node.scale;e+=r.width*this._getUsedScaleValue(s.x)}e+=(i-1)*this._spacingX+this._getPaddingH()}else e=this.node._uiProps.uiTransformComp.width;return e},i._getVerticalBaseHeight=function(){var t=this._usefulLayoutObj,e=0,i=t.length;if(this._resizeMode===K9.CONTAINER){for(var n=0;n<t.length;++n){var r=t[n],s=r.node.scale;e+=r.height*this._getUsedScaleValue(s.y)}e+=(i-1)*this._spacingY+this._getPaddingV()}else e=this.node._uiProps.uiTransformComp.height;return e},i._doLayout=function(){var t=this;if(this._init&&!this._childrenDirty||(this._checkUsefulObj(),this._init=!0,this._childrenDirty=!1),this._layoutType===Y9.HORIZONTAL){var e=this._getHorizontalBaseWidth();this._doLayoutHorizontally(e,!1,(function(e){return(t._isAlign?ji.ZERO:e.position).y}),!0),this.node._uiProps.uiTransformComp.width=e}else if(this._layoutType===Y9.VERTICAL){var i=this._getVerticalBaseHeight();this._doLayoutVertically(i,!1,(function(e){return(t._isAlign?ji.ZERO:e.position).x}),!0),this.node._uiProps.uiTransformComp.height=i}else this._layoutType===Y9.GRID&&this._doLayoutGrid()},i._getUsedScaleValue=function(t){return this._affectedByScale?Math.abs(t):1},i._transformDirty=function(t){t&AE.SCALE&&t&AE.POSITION&&this._affectedByScale&&this._doLayoutDirty()},i._doLayoutDirty=function(){this._layoutDirty=!0},i._childrenChanged=function(){this._childrenDirty=!0,this._doLayoutDirty()},i._getPaddingH=function(){return this._paddingLeft+this._paddingRight},i._getPaddingV=function(){return this._paddingTop+this._paddingBottom},i._getFixedBreakingNum=function(){if(this._layoutType!==Y9.GRID||this._constraint===J9.NONE||this._constraintNum<=0)return 0;var t=this._constraint===J9.FIXED_ROW?Math.ceil(this._usefulLayoutObj.length/this._constraintNum):this._constraintNum;return this._startAxis===q9.VERTICAL&&(t=this._constraint===J9.FIXED_COL?Math.ceil(this._usefulLayoutObj.length/this._constraintNum):this._constraintNum),t},h(e,[{key:"alignHorizontal",get:function(){return this._isAlign},set:function(t){this._layoutType===Y9.HORIZONTAL&&(this._isAlign=t,this._doLayoutDirty())}},{key:"alignVertical",get:function(){return this._isAlign},set:function(t){this._layoutType===Y9.VERTICAL&&(this._isAlign=t,this._doLayoutDirty())}},{key:"type",get:function(){return this._layoutType},set:function(t){this._layoutType=t,this._doLayoutDirty()}},{key:"resizeMode",get:function(){return this._resizeMode},set:function(t){this._layoutType!==Y9.NONE&&(this._resizeMode=t,this._doLayoutDirty())}},{key:"cellSize",get:function(){return this._cellSize},set:function(t){this._cellSize!==t&&(this._cellSize.set(t),this._doLayoutDirty())}},{key:"startAxis",get:function(){return this._startAxis},set:function(t){this._startAxis!==t&&(this._startAxis=t,this._doLayoutDirty())}},{key:"paddingLeft",get:function(){return this._paddingLeft},set:function(t){this._paddingLeft!==t&&(this._paddingLeft=t,this._doLayoutDirty())}},{key:"paddingRight",get:function(){return this._paddingRight},set:function(t){this._paddingRight!==t&&(this._paddingRight=t,this._doLayoutDirty())}},{key:"paddingTop",get:function(){return this._paddingTop},set:function(t){this._paddingTop!==t&&(this._paddingTop=t,this._doLayoutDirty())}},{key:"paddingBottom",get:function(){return this._paddingBottom},set:function(t){this._paddingBottom!==t&&(this._paddingBottom=t,this._doLayoutDirty())}},{key:"spacingX",get:function(){return this._spacingX},set:function(t){this._spacingX!==t&&(this._spacingX=t,this._doLayoutDirty())}},{key:"spacingY",get:function(){return this._spacingY},set:function(t){this._spacingY!==t&&(this._spacingY=t,this._doLayoutDirty())}},{key:"verticalDirection",get:function(){return this._verticalDirection},set:function(t){this._verticalDirection!==t&&(this._verticalDirection=t,this._doLayoutDirty())}},{key:"horizontalDirection",get:function(){return this._horizontalDirection},set:function(t){this._horizontalDirection!==t&&(this._horizontalDirection=t,this._doLayoutDirty())}},{key:"padding",get:function(){return this._paddingLeft},set:function(t){this.paddingLeft===t&&this._paddingRight===t&&this._paddingTop===t&&this._paddingBottom===t||(this._paddingLeft=this._paddingRight=this._paddingTop=this._paddingBottom=t,this._doLayoutDirty())}},{key:"constraint",get:function(){return this._constraint},set:function(t){this._layoutType!==Y9.NONE&&this._constraint!==t&&(this._constraint=t,this._doLayoutDirty())}},{key:"constraintNum",get:function(){return this._constraintNum},set:function(t){this._constraint!==J9.NONE&&this._constraintNum!==t&&(t<=0&&L("Limit values to be greater than 0"),this._constraintNum=t,this._doLayoutDirty())}},{key:"affectedByScale",get:function(){return this._affectedByScale},set:function(t){this._affectedByScale=t,this._doLayoutDirty()}}]),e}(bc),X9.Type=Y9,X9.VerticalDirection=Q9,X9.HorizontalDirection=Z9,X9.ResizeMode=K9,X9.AxisDirection=q9,X9.Constraint=J9,T((I9=j9).prototype,"alignHorizontal",[Z7,J7],Object.getOwnPropertyDescriptor(I9.prototype,"alignHorizontal"),I9.prototype),T(I9.prototype,"alignVertical",[$7,t9],Object.getOwnPropertyDescriptor(I9.prototype,"alignVertical"),I9.prototype),T(I9.prototype,"type",[e9,i9,n9],Object.getOwnPropertyDescriptor(I9.prototype,"type"),I9.prototype),T(I9.prototype,"resizeMode",[r9,s9,a9],Object.getOwnPropertyDescriptor(I9.prototype,"resizeMode"),I9.prototype),T(I9.prototype,"cellSize",[o9,u9],Object.getOwnPropertyDescriptor(I9.prototype,"cellSize"),I9.prototype),T(I9.prototype,"startAxis",[h9,l9],Object.getOwnPropertyDescriptor(I9.prototype,"startAxis"),I9.prototype),T(I9.prototype,"paddingLeft",[c9],Object.getOwnPropertyDescriptor(I9.prototype,"paddingLeft"),I9.prototype),T(I9.prototype,"paddingRight",[_9],Object.getOwnPropertyDescriptor(I9.prototype,"paddingRight"),I9.prototype),T(I9.prototype,"paddingTop",[f9],Object.getOwnPropertyDescriptor(I9.prototype,"paddingTop"),I9.prototype),T(I9.prototype,"paddingBottom",[d9],Object.getOwnPropertyDescriptor(I9.prototype,"paddingBottom"),I9.prototype),T(I9.prototype,"spacingX",[p9],Object.getOwnPropertyDescriptor(I9.prototype,"spacingX"),I9.prototype),T(I9.prototype,"spacingY",[m9],Object.getOwnPropertyDescriptor(I9.prototype,"spacingY"),I9.prototype),T(I9.prototype,"verticalDirection",[g9,v9],Object.getOwnPropertyDescriptor(I9.prototype,"verticalDirection"),I9.prototype),T(I9.prototype,"horizontalDirection",[y9,E9],Object.getOwnPropertyDescriptor(I9.prototype,"horizontalDirection"),I9.prototype),T(I9.prototype,"constraint",[T9,S9,A9],Object.getOwnPropertyDescriptor(I9.prototype,"constraint"),I9.prototype),T(I9.prototype,"constraintNum",[R9,b9],Object.getOwnPropertyDescriptor(I9.prototype,"constraintNum"),I9.prototype),T(I9.prototype,"affectedByScale",[C9],Object.getOwnPropertyDescriptor(I9.prototype,"affectedByScale"),I9.prototype),O9=T(I9.prototype,"_resizeMode",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return K9.NONE}}),x9=T(I9.prototype,"_layoutType",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Y9.NONE}}),P9=T(I9.prototype,"_cellSize",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new gn(40,40)}}),D9=T(I9.prototype,"_startAxis",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return q9.HORIZONTAL}}),B9=T(I9.prototype,"_paddingLeft",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),N9=T(I9.prototype,"_paddingRight",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),M9=T(I9.prototype,"_paddingTop",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),L9=T(I9.prototype,"_paddingBottom",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),F9=T(I9.prototype,"_spacingX",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),U9=T(I9.prototype,"_spacingY",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),G9=T(I9.prototype,"_verticalDirection",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Q9.TOP_TO_BOTTOM}}),k9=T(I9.prototype,"_horizontalDirection",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Z9.LEFT_TO_RIGHT}}),z9=T(I9.prototype,"_constraint",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return J9.NONE}}),H9=T(I9.prototype,"_constraintNum",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 2}}),V9=T(I9.prototype,"_affectedByScale",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),W9=T(I9.prototype,"_isAlign",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),w9=I9))||w9)||w9)||w9)||w9)||w9)||w9));b.Layout=Rtt,function(t){t[t.HORIZONTAL=0]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL",t[t.FILLED=2]="FILLED"}(Stt||(Stt={})),_e(Stt);var btt,Ctt,wtt,Itt,Ott,xtt,Ptt,Dtt,Btt,Ntt,Mtt,Ltt,Ftt,Utt,Gtt,ktt,ztt,Htt,Vtt,Wtt,Xtt,jtt,Ytt,Ktt,qtt=function(e){return t({ProgressBar:e,ProgressBarComponent:e}),e}((ttt=_h("cc.ProgressBar"),ett=xh(),itt=dh(110),ntt=Ch(),rtt=fh(Ak),stt=Kh(PW),att=Mh(),ott=Kh(Stt),utt=Mh(),htt=Mh(),ltt=Lh(),ctt=Mh(),_tt=Mh(),ttt(ftt=ett(ftt=itt(ftt=ntt(ftt=rtt((Ttt=Ett=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return E(e=t.call.apply(t,[this].concat(n))||this,"_barSprite",ptt,g(e)),E(e,"_mode",mtt,g(e)),E(e,"_totalLength",gtt,g(e)),E(e,"_progress",vtt,g(e)),E(e,"_reverse",ytt,g(e)),e}c(e,t);var i=e.prototype;return i._initBarSprite=function(){if(this._barSprite){var t=this._barSprite.node;if(!t)return;var e=this.node._uiProps.uiTransformComp,i=e.contentSize,n=e.anchorPoint,r=t._uiProps.uiTransformComp.contentSize;if(this._barSprite.fillType===PW.FillType.RADIAL&&(this._mode=Stt.FILLED),this._mode===Stt.HORIZONTAL?this.totalLength=r.width:this._mode===Stt.VERTICAL?this.totalLength=r.height:this.totalLength=this._barSprite.fillRange,t.parent===this.node){var s=-i.width*n.x;t.setPosition(s,0,0)}}},i._updateBarStatus=function(){if(this._barSprite){var t=this._barSprite.node;if(!t)return;var e=t._uiProps.uiTransformComp,i=e.anchorPoint,n=e.contentSize,r=t.getPosition(),s=new _n(0,.5),a=yi(this._progress),o=this._totalLength*a,u=n,h=0,l=0;switch(this._mode){case Stt.HORIZONTAL:this._reverse&&(s=new _n(1,.5)),u=new gn(o,n.height),h=this._totalLength,l=n.height;break;case Stt.VERTICAL:s=this._reverse?new _n(.5,1):new _n(.5,0),u=new gn(n.width,o),h=n.width,l=this._totalLength}if(this._mode===Stt.FILLED)this._barSprite.type!==PW.Type.FILLED?L("ProgressBar FILLED mode only works when barSprite's Type is FILLED!"):(this._reverse&&(o*=-1),this._barSprite.fillRange=o);else if(this._barSprite.type!==PW.Type.FILLED){var c=s.x-i.x,_=s.y-i.y,f=new ji(h*c,l*_,0);t.setPosition(r.x+f.x,r.y+f.y,r.z),e.setAnchorPoint(s),e.setContentSize(u)}else L("ProgressBar non-FILLED mode only works when barSprite's Type is non-FILLED!")}},h(e,[{key:"barSprite",get:function(){return this._barSprite},set:function(t){this._barSprite!==t&&(this._barSprite=t,this._initBarSprite())}},{key:"mode",get:function(){return this._mode},set:function(t){if(this._mode!==t&&(this._mode=t,this._barSprite)){var e=this._barSprite.node;if(!e)return;var i=e._uiProps.uiTransformComp.contentSize;this._mode===Stt.HORIZONTAL?this.totalLength=i.width:this._mode===Stt.VERTICAL?this.totalLength=i.height:this._mode===Stt.FILLED&&(this.totalLength=this._barSprite.fillRange)}}},{key:"totalLength",get:function(){return this._totalLength},set:function(t){this._mode===Stt.FILLED&&(t=yi(t)),this._totalLength!==t&&(this._totalLength=t,this._updateBarStatus())}},{key:"progress",get:function(){return this._progress},set:function(t){this._progress!==t&&(this._progress=t,this._updateBarStatus())}},{key:"reverse",get:function(){return this._reverse},set:function(t){this._reverse!==t&&(this._reverse=t,this._barSprite&&(this._barSprite.fillStart=1-this._barSprite.fillStart),this._updateBarStatus())}}]),e}(bc),Ett.Mode=Stt,T((dtt=Ttt).prototype,"barSprite",[stt,att],Object.getOwnPropertyDescriptor(dtt.prototype,"barSprite"),dtt.prototype),T(dtt.prototype,"mode",[ott,utt],Object.getOwnPropertyDescriptor(dtt.prototype,"mode"),dtt.prototype),T(dtt.prototype,"totalLength",[htt],Object.getOwnPropertyDescriptor(dtt.prototype,"totalLength"),dtt.prototype),T(dtt.prototype,"progress",[ltt,kh,ctt],Object.getOwnPropertyDescriptor(dtt.prototype,"progress"),dtt.prototype),T(dtt.prototype,"reverse",[_tt],Object.getOwnPropertyDescriptor(dtt.prototype,"reverse"),dtt.prototype),ptt=T(dtt.prototype,"_barSprite",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),mtt=T(dtt.prototype,"_mode",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Stt.HORIZONTAL}}),gtt=T(dtt.prototype,"_totalLength",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 1}}),vtt=T(dtt.prototype,"_progress",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return.1}}),ytt=T(dtt.prototype,"_reverse",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),ftt=dtt))||ftt)||ftt)||ftt)||ftt)||ftt));b.ProgressBar=qtt;var Qtt,Ztt=new ji,Jtt=new ji,$tt=new ji,tet=new _n,eet=new Gi,iet=new _n;!function(t){t[t.HORIZONTAL=0]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(Qtt||(Qtt={})),pe(Qtt);var net,ret=function(e){return t({ScrollBar:e,ScrollBarComponent:e}),e}((btt=_h("cc.ScrollBar"),Ctt=xh(),wtt=dh(110),Itt=Ch(),Ott=fh(Ak),xtt=Kh(PW),Ptt=zh(),Dtt=Mh(),Btt=Kh(Qtt),Ntt=zh(),Mtt=Mh(),Ltt=zh(),Ftt=Mh(),Utt=zh(),Gtt=Mh(),btt(ktt=Ctt(ktt=wtt(ktt=Itt(ktt=Ott((Ktt=Ytt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return E(e=t.call.apply(t,[this].concat(n))||this,"_scrollView",Htt,g(e)),E(e,"_handle",Vtt,g(e)),E(e,"_direction",Wtt,g(e)),E(e,"_enableAutoHide",Xtt,g(e)),E(e,"_autoHideTime",jtt,g(e)),e._touching=!1,e._opacity=255,e._autoHideRemainingTime=0,e}c(e,t);var i=e.prototype;return i.hide=function(){this._autoHideRemainingTime=0,this._setOpacity(0)},i.show=function(){this._autoHideRemainingTime=this._autoHideTime,this._setOpacity(this._opacity)},i.onScroll=function(t){if(this._scrollView){var e=this._scrollView.content;if(e){var i=e._uiProps.uiTransformComp.contentSize,n=this._scrollView.node._uiProps.uiTransformComp.contentSize,r=this.node._uiProps.uiTransformComp.contentSize;if(!this._conditionalDisableScrollBar(i,n)){this._enableAutoHide&&(this._autoHideRemainingTime=this._autoHideTime,this._setOpacity(this._opacity));var s=0,a=0,o=0,u=0,h=0,l=iet;l.set(0,0),this._direction===Qtt.HORIZONTAL?(s=i.width,a=n.width,h=r.width,o=t.x,this._convertToScrollViewSpace(l,e),u=-l.x):this._direction===Qtt.VERTICAL&&(s=i.height,a=n.height,h=r.height,o=t.y,this._convertToScrollViewSpace(l,e),u=-l.y);var c=this._calculateLength(s,a,h,o),_=iet;this._calculatePosition(_,s,a,h,u,o,c),this._updateLength(c),this._updateHandlerPosition(_)}}}},i.setScrollView=function(t){this._scrollView=t},i.onTouchBegan=function(){this._enableAutoHide&&(this._touching=!0)},i.onTouchEnded=function(){if(this._enableAutoHide&&(this._touching=!1,!(this._autoHideTime<=0))){if(this._scrollView){var t=this._scrollView.content;if(t){var e=t._uiProps.uiTransformComp.contentSize,i=this._scrollView.node._uiProps.uiTransformComp.contentSize;if(this._conditionalDisableScrollBar(e,i))return}}this._autoHideRemainingTime=this._autoHideTime}},i.onEnable=function(){var t=this.node.getComponent(PW);t&&(this._opacity=t.color.a)},i.start=function(){this._enableAutoHide&&this._setOpacity(0)},i.update=function(t){this._processAutoHide(t)},i._convertToScrollViewSpace=function(t,e){var i=this._scrollView&&this._scrollView.node._uiProps.uiTransformComp,n=e._uiProps.uiTransformComp;if(i&&n){Ztt.set(-n.anchorX*n.width,-n.anchorY*n.height,0),n.convertToWorldSpaceAR(Ztt,Jtt);var r=i.convertToNodeSpaceAR(Jtt);r.x+=i.anchorX*i.width,r.y+=i.anchorY*i.height,t.set(r.x,r.y)}else t.set(_n.ZERO)},i._setOpacity=function(t){if(this._handle){var e=this.node.getComponent(PW);e&&(eet.set(e.color),eet.a=t,e.color=eet),(e=this._handle.getComponent(PW))&&(eet.set(e.color),eet.a=t,e.color=eet)}},i._updateHandlerPosition=function(t){if(this._handle){var e=$tt;this._fixupHandlerPosition(e),this._handle.node.setPosition(t.x+e.x,t.y+e.y,e.z)}},i._fixupHandlerPosition=function(t){var e=this.node._uiProps.uiTransformComp,i=e.contentSize,n=e.anchorPoint,r=this.handle.node._uiProps.uiTransformComp.contentSize,s=this.handle.node.parent;ji.set(Ztt,-i.width*n.x,-i.height*n.y,0);var a=this.node._uiProps.uiTransformComp.convertToWorldSpaceAR(Ztt,Jtt),o=t;o.set(0,0,0),s._uiProps.uiTransformComp.convertToNodeSpaceAR(a,o),this.direction===Qtt.HORIZONTAL?o.set(o.x,o.y+(i.height-r.height)/2,o.z):this.direction===Qtt.VERTICAL&&o.set(o.x+(i.width-r.width)/2,o.y,o.z),this.handle.node.setPosition(o)},i._conditionalDisableScrollBar=function(t,e){return t.width<=e.width&&this._direction===Qtt.HORIZONTAL||t.height<=e.height&&this._direction===Qtt.VERTICAL},i._calculateLength=function(t,e,i,n){var r=t;return n&&(r+=20*(n>0?n:-n)),i*(e/r)},i._calculatePosition=function(t,e,i,n,r,s,a){var o=e-i;s&&(o+=Math.abs(s));var u=0;o&&(u=yi(u=r/o));var h=(n-a)*u;this._direction===Qtt.VERTICAL?t.set(0,h):t.set(h,0)},i._updateLength=function(t){if(this._handle){var e=this._handle.node._uiProps.uiTransformComp,i=e.contentSize,n=e.anchorPoint;n.x===tet.x&&n.y===tet.y||e.setAnchorPoint(tet),this._direction===Qtt.HORIZONTAL?e.setContentSize(t,i.height):e.setContentSize(i.width,t)}},i._processAutoHide=function(t){if(this._enableAutoHide&&!(this._autoHideRemainingTime<=0)&&!this._touching&&(this._autoHideRemainingTime-=t,this._autoHideRemainingTime<=this._autoHideTime)){this._autoHideRemainingTime=Math.max(0,this._autoHideRemainingTime);var e=this._opacity*(this._autoHideRemainingTime/this._autoHideTime);this._setOpacity(e)}},h(e,[{key:"handle",get:function(){return this._handle},set:function(t){this._handle!==t&&(this._handle=t,this.onScroll(_n.ZERO))}},{key:"direction",get:function(){return this._direction},set:function(t){this._direction!==t&&(this._direction=t,this.onScroll(_n.ZERO))}},{key:"enableAutoHide",get:function(){return this._enableAutoHide},set:function(t){this._enableAutoHide!==t&&(this._enableAutoHide=t,this._enableAutoHide&&this._setOpacity(0))}},{key:"autoHideTime",get:function(){return this._autoHideTime},set:function(t){this._autoHideTime!==t&&(this._autoHideTime=t)}}]),e}(bc),Ytt.Direction=Qtt,T((ztt=Ktt).prototype,"handle",[xtt,Ptt,Dtt],Object.getOwnPropertyDescriptor(ztt.prototype,"handle"),ztt.prototype),T(ztt.prototype,"direction",[Btt,Ntt,Mtt],Object.getOwnPropertyDescriptor(ztt.prototype,"direction"),ztt.prototype),T(ztt.prototype,"enableAutoHide",[Ltt,Ftt],Object.getOwnPropertyDescriptor(ztt.prototype,"enableAutoHide"),ztt.prototype),T(ztt.prototype,"autoHideTime",[Utt,Gtt],Object.getOwnPropertyDescriptor(ztt.prototype,"autoHideTime"),ztt.prototype),Htt=T(ztt.prototype,"_scrollView",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),Vtt=T(ztt.prototype,"_handle",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),Wtt=T(ztt.prototype,"_direction",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Qtt.HORIZONTAL}}),Xtt=T(ztt.prototype,"_enableAutoHide",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),jtt=T(ztt.prototype,"_autoHideTime",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 1}}),ktt=ztt))||ktt)||ktt)||ktt)||ktt)||ktt));b.ScrollBar=ret;var set,aet,oet,uet,het,cet,_et,fet,det,pet,met,get,vet,yet,Eet,Tet,Aet,Ret,bet,Cet,wet,Iet,Oet,xet,Pet,Det,Bet,Net,Met,Let,Fet,Uet,Get,ket,zet,Het,Vet,Wet,Xet,jet,Yet,Ket,qet,Qet,Zet,Jet,$et,tit,eit=t("ViewGroup",_h("cc.ViewGroup")(net=dh(110)(net=function(t){function e(){return t.apply(this,arguments)||this}return c(e,t),e}(bc))||net)||net);b.ViewGroup=eit;var iit,nit,rit=1e-4,sit=new ji,ait=new ji,oit=new _n,uit=new _n,hit=function(){return(new Date).getMilliseconds()},lit={"scroll-to-top":0,"scroll-to-bottom":1,"scroll-to-left":2,"scroll-to-right":3,scrolling:4,"bounce-bottom":6,"bounce-left":7,"bounce-right":8,"bounce-top":5,"scroll-ended":9,"touch-up":10,"scroll-ended-with-threshold":11,"scroll-began":12};!function(t){t.SCROLL_TO_TOP="scroll-to-top",t.SCROLL_TO_BOTTOM="scroll-to-bottom",t.SCROLL_TO_LEFT="scroll-to-left",t.SCROLL_TO_RIGHT="scroll-to-right",t.SCROLL_BEGAN="scroll-began",t.SCROLL_ENDED="scroll-ended",t.BOUNCE_TOP="bounce-top",t.BOUNCE_BOTTOM="bounce-bottom",t.BOUNCE_LEFT="bounce-left",t.BOUNCE_RIGHT="bounce-right",t.SCROLLING="scrolling",t.SCROLL_ENG_WITH_THRESHOLD="scroll-ended-with-threshold",t.TOUCH_UP="touch-up"}(iit||(iit={})),function(t){t[t.NONE=0]="NONE",t[t.LEFT=1]="LEFT",t[t.RIGHT=2]="RIGHT"}(nit||(nit={}));var cit,_it,fit,dit,pit,mit,git,vit,yit,Eit,Tit,Sit,Ait,Rit,bit,Cit,wit,Iit,Oit,xit,Pit,Dit=function(e){return t({ScrollView:e,ScrollViewComponent:e}),e}((set=_h("cc.ScrollView"),aet=xh(),oet=dh(110),uet=Ch(),het=fh(Ak),cet=Lh(),_et=zh(),fet=Mh(),det=Lh(),pet=zh(),met=Mh(),get=zh(),vet=Mh(),yet=zh(),Eet=Mh(),Tet=Kh(jE),Aet=zh(),Ret=Mh(),bet=zh(),Cet=Mh(),wet=Kh(ret),Iet=zh(),Oet=Mh(),xet=zh(),Pet=Mh(),Det=Kh(ret),Bet=zh(),Net=Mh(),Met=zh(),Let=Mh(),Fet=Kh([Sc]),Uet=zh(),Get=Mh(),set(ket=aet(ket=oet(ket=uet(ket=het((tit=$et=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return E(e=t.call.apply(t,[this].concat(n))||this,"bounceDuration",Het,g(e)),E(e,"brake",Vet,g(e)),E(e,"elastic",Wet,g(e)),E(e,"inertia",Xet,g(e)),E(e,"horizontal",jet,g(e)),E(e,"vertical",Yet,g(e)),E(e,"cancelInnerEvents",Ket,g(e)),E(e,"scrollEvents",qet,g(e)),e._autoScrolling=!1,e._scrolling=!1,E(e,"_content",Qet,g(e)),E(e,"_horizontalScrollBar",Zet,g(e)),E(e,"_verticalScrollBar",Jet,g(e)),e._topBoundary=0,e._bottomBoundary=0,e._leftBoundary=0,e._rightBoundary=0,e._touchMoveDisplacements=[],e._touchMoveTimeDeltas=[],e._touchMovePreviousTimestamp=0,e._touchMoved=!1,e._autoScrollAttenuate=!1,e._autoScrollStartPosition=new ji,e._autoScrollTargetDelta=new ji,e._autoScrollTotalTime=0,e._autoScrollAccumulatedTime=0,e._autoScrollCurrentlyOutOfBoundary=!1,e._autoScrollBraking=!1,e._autoScrollBrakingStartPosition=new ji,e._outOfBoundaryAmount=new ji,e._outOfBoundaryAmountDirty=!0,e._stopMouseWheel=!1,e._mouseWheelEventElapsedTime=0,e._isScrollEndedWithThresholdEventFired=!1,e._scrollEventEmitMask=0,e._isBouncing=!1,e._contentPos=new ji,e._deltaPos=new ji,e._hoverIn=nit.NONE,e._scrollState=new _n(0,0),e}c(e,t);var i=e.prototype;return i.scrollToBottom=function(t,e){void 0===e&&(e=!0);var i=this._calculateMovePercentDelta({anchor:new _n(0,0),applyToHorizontal:!1,applyToVertical:!0});t?this._startAutoScroll(i,t,!1!==e):this._moveContent(i,!0)},i.scrollToTop=function(t,e){void 0===e&&(e=!0);var i=this._calculateMovePercentDelta({anchor:new _n(0,1),applyToHorizontal:!1,applyToVertical:!0});t?this._startAutoScroll(i,t,!1!==e):this._moveContent(i)},i.scrollToLeft=function(t,e){void 0===e&&(e=!0);var i=this._calculateMovePercentDelta({anchor:new _n(0,0),applyToHorizontal:!0,applyToVertical:!1});t?this._startAutoScroll(i,t,!1!==e):this._moveContent(i)},i.scrollToRight=function(t,e){void 0===e&&(e=!0);var i=this._calculateMovePercentDelta({anchor:new _n(1,0),applyToHorizontal:!0,applyToVertical:!1});t?this._startAutoScroll(i,t,!1!==e):this._moveContent(i)},i.scrollToTopLeft=function(t,e){void 0===e&&(e=!0);var i=this._calculateMovePercentDelta({anchor:new _n(0,1),applyToHorizontal:!0,applyToVertical:!0});t?this._startAutoScroll(i,t,!1!==e):this._moveContent(i)},i.scrollToTopRight=function(t,e){void 0===e&&(e=!0);var i=this._calculateMovePercentDelta({anchor:new _n(1,1),applyToHorizontal:!0,applyToVertical:!0});t?this._startAutoScroll(i,t,!1!==e):this._moveContent(i)},i.scrollToBottomLeft=function(t,e){void 0===e&&(e=!0);var i=this._calculateMovePercentDelta({anchor:new _n(0,0),applyToHorizontal:!0,applyToVertical:!0});t?this._startAutoScroll(i,t,!1!==e):this._moveContent(i)},i.scrollToBottomRight=function(t,e){void 0===e&&(e=!0);var i=this._calculateMovePercentDelta({anchor:new _n(1,0),applyToHorizontal:!0,applyToVertical:!0});t?this._startAutoScroll(i,t,!1!==e):this._moveContent(i)},i.scrollToOffset=function(t,e,i){void 0===i&&(i=!0);var n=this.getMaxScrollOffset(),r=new _n(0,0);0===n.x?r.x=0:r.x=t.x/n.x,0===n.y?r.y=1:r.y=(n.y-t.y)/n.y,this.scrollTo(r,e,i)},i.getScrollOffset=function(){var t=this._getContentTopBoundary()-this._topBoundary,e=this._getContentLeftBoundary()-this._leftBoundary;return new _n(e,t)},i.getMaxScrollOffset=function(){if(!this._content||!this.view)return _n.ZERO;var t=this._content._uiProps.uiTransformComp.contentSize,e=t.width-this.view.width,i=t.height-this.view.height;return new _n(e=e>=0?e:0,i=i>=0?i:0)},i.scrollToPercentHorizontal=function(t,e,i){var n=this._calculateMovePercentDelta({anchor:new _n(t,0),applyToHorizontal:!0,applyToVertical:!1});e?this._startAutoScroll(n,e,!1!==i):this._moveContent(n)},i.scrollTo=function(t,e,i){var n=this._calculateMovePercentDelta({anchor:new _n(t),applyToHorizontal:!0,applyToVertical:!0});e?this._startAutoScroll(n,e,i):this._moveContent(n)},i.scrollToPercentVertical=function(t,e,i){var n=this._calculateMovePercentDelta({anchor:new _n(0,t),applyToHorizontal:!1,applyToVertical:!0});e?this._startAutoScroll(n,e,i):this._moveContent(n)},i.stopAutoScroll=function(){this._autoScrolling=!1,this._autoScrollAccumulatedTime=this._autoScrollTotalTime},i.setContentPosition=function(t){this._setContentPosition(t)},i._setContentPosition=function(t){if(this._content){var e=this._getContentPosition();Math.abs(t.x-e.x)<rit&&Math.abs(t.y-e.y)<rit||(this._content.setPosition(t),this._outOfBoundaryAmountDirty=!0)}},i.getContentPosition=function(){return this._getContentPosition()},i._getContentPosition=function(){return this._content?(this._contentPos.set(this._content.position),this._contentPos):ji.ZERO.clone()},i.isScrolling=function(){return this._scrolling},i.isAutoScrolling=function(){return this._autoScrolling},i.getScrollEndedEventTiming=function(){return rit},i.start=function(){this._calculateBoundary(),this._content&&OL.once(IL.EVENT_BEFORE_DRAW,this._adjustContentOutOfBoundary,this)},i.onEnable=function(){this._registerEvent(),this._content&&(this._content.on(aE.SIZE_CHANGED,this._calculateBoundary,this),this._content.on(aE.TRANSFORM_CHANGED,this._scaleChanged,this),this.view&&(this.view.node.on(aE.TRANSFORM_CHANGED,this._scaleChanged,this),this.view.node.on(aE.SIZE_CHANGED,this._calculateBoundary,this))),this._calculateBoundary(),this._updateScrollBarState()},i.update=function(t){this._autoScrolling&&this._processAutoScrolling(t)},i.onDisable=function(){this._unregisterEvent(),this._content&&(this._content.off(aE.SIZE_CHANGED,this._calculateBoundary,this),this._content.off(aE.TRANSFORM_CHANGED,this._scaleChanged,this),this.view&&(this.view.node.off(aE.TRANSFORM_CHANGED,this._scaleChanged,this),this.view.node.off(aE.SIZE_CHANGED,this._calculateBoundary,this))),this._hideScrollBar(),this.stopAutoScroll()},i._registerEvent=function(){this.node.on(aE.TOUCH_START,this._onTouchBegan,this,!0),this.node.on(aE.TOUCH_MOVE,this._onTouchMoved,this,!0),this.node.on(aE.TOUCH_END,this._onTouchEnded,this,!0),this.node.on(aE.TOUCH_CANCEL,this._onTouchCancelled,this,!0),this.node.on(aE.MOUSE_WHEEL,this._onMouseWheel,this,!0),this.node.on(h8.XRUI_HOVER_ENTERED,this._xrHoverEnter,this),this.node.on(h8.XRUI_HOVER_EXITED,this._xrHoverExit,this),ww.on(Cw.EventType.HANDLE_INPUT,this._dispatchEventHandleInput,this),ww.on(Cw.EventType.GAMEPAD_INPUT,this._dispatchEventHandleInput,this)},i._unregisterEvent=function(){this.node.off(aE.TOUCH_START,this._onTouchBegan,this,!0),this.node.off(aE.TOUCH_MOVE,this._onTouchMoved,this,!0),this.node.off(aE.TOUCH_END,this._onTouchEnded,this,!0),this.node.off(aE.TOUCH_CANCEL,this._onTouchCancelled,this,!0),this.node.off(aE.MOUSE_WHEEL,this._onMouseWheel,this,!0),this.node.off(h8.XRUI_HOVER_ENTERED,this._xrHoverEnter,this),this.node.off(h8.XRUI_HOVER_EXITED,this._xrHoverExit,this),ww.off(Cw.EventType.HANDLE_INPUT,this._dispatchEventHandleInput,this),ww.off(Cw.EventType.GAMEPAD_INPUT,this._dispatchEventHandleInput,this)},i._onMouseWheel=function(t,e){if(this.enabledInHierarchy&&!this._hasNestedViewGroup(t,e)){var i=new ji,n=t.getScrollY();this.vertical?i.set(0,-.1*n,0):this.horizontal&&i.set(-.1*n,0,0),this._mouseWheelEventElapsedTime=0,this._processDeltaMove(i),this._stopMouseWheel||(this._handlePressLogic(),this.schedule(this._checkMouseWheel,1/60,NaN,0),this._stopMouseWheel=!0),this._stopPropagationIfTargetIsMe(t)}},i._onTouchBegan=function(t,e){this.enabledInHierarchy&&this._content&&(this._hasNestedViewGroup(t,e)||(this._handlePressLogic(),this._touchMoved=!1,this._stopPropagationIfTargetIsMe(t)))},i._onTouchMoved=function(t,e){if(this.enabledInHierarchy&&this._content&&!this._hasNestedViewGroup(t,e)){var i=t.touch;if(this._handleMoveLogic(i),this.cancelInnerEvents){var n=i.getUILocation(oit);if(n.subtract(i.getUIStartLocation(uit)),n.length()>7&&!this._touchMoved&&t.target!==this.node){var r=new fA(t.getTouches(),t.bubbles,aA.TOUCH_CANCEL);r.touch=t.touch,r.simulate=!0,t.target.dispatchEvent(r),this._touchMoved=!0}this._stopPropagationIfTargetIsMe(t)}}},i._onTouchEnded=function(t,e){if(this.enabledInHierarchy&&this._content&&t&&!this._hasNestedViewGroup(t,e)){this._dispatchEvent(iit.TOUCH_UP);var i=t.touch;this._handleReleaseLogic(i),this._touchMoved?t.propagationStopped=!0:this._stopPropagationIfTargetIsMe(t)}},i._onTouchCancelled=function(t,e){if(this.enabledInHierarchy&&this._content&&!this._hasNestedViewGroup(t,e)){if(t&&!t.simulate){var i=t.touch;this._handleReleaseLogic(i)}this._stopPropagationIfTargetIsMe(t)}},i._calculateBoundary=function(){if(this._content&&this.view){var t=this._content.getComponent(Rtt);t&&t.enabledInHierarchy&&t.updateLayout();var e=this.view,i=e.width*e.anchorX,n=e.height*e.anchorY;this._leftBoundary=-i,this._bottomBoundary=-n,this._rightBoundary=this._leftBoundary+e.width,this._topBoundary=this._bottomBoundary+e.height,this._moveContentToTopLeft(e.contentSize)}},i._hasNestedViewGroup=function(t,e){if(!t||t.eventPhase!==uA.CAPTURING_PHASE)return!1;if(e)for(var i,n=y(e);!(i=n()).done;){var r=i.value;if(this.node===r)return!(!t.target||!t.target.getComponent(eit));if(r.getComponent(eit))return!0}return!1},i._startInertiaScroll=function(t){var e=new ji(t);e.multiplyScalar(.7),this._startAttenuatingAutoScroll(e,t)},i._calculateAttenuatedFactor=function(t){return this.brake<=0?1-this.brake:(1-this.brake)*(1/(1+14e-6*t+t*t*8e-9))},i._startAttenuatingAutoScroll=function(t,e){var i=t.clone();if(i.normalize(),this._content&&this.view){var n=this._content._uiProps.uiTransformComp.contentSize,r=this.view.contentSize,s=n.width-r.width,a=n.height-r.height,o=this._calculateAttenuatedFactor(s),u=this._calculateAttenuatedFactor(a);i.x=i.x*s*(1-this.brake)*o,i.y=i.y*a*u*(1-this.brake),i.z=0}var h=t.length(),l=i.length()/h;if(i.add(t),this.brake>0&&l>7){l=Math.sqrt(l);var c=t.clone();c.multiplyScalar(l),i.set(c),i.add(t)}var _=this._calculateAutoScrollTimeByInitialSpeed(e.length());this.brake>0&&l>3&&(_*=l=3),0===this.brake&&l>1&&(_*=l),this._startAutoScroll(i,_,!0)},i._calculateAutoScrollTimeByInitialSpeed=function(t){return Math.sqrt(Math.sqrt(t/5))},i._startAutoScroll=function(t,e,i){void 0===i&&(i=!1);var n=this._flattenVectorByDirection(t);this._autoScrolling=!0,this._autoScrollTargetDelta=n,this._autoScrollAttenuate=i,ji.copy(this._autoScrollStartPosition,this._getContentPosition()),this._autoScrollTotalTime=e,this._autoScrollAccumulatedTime=0,this._autoScrollBraking=!1,this._isScrollEndedWithThresholdEventFired=!1,this._autoScrollBrakingStartPosition.set(0,0,0),this._getHowMuchOutOfBoundary().equals(ji.ZERO,rit)||(this._autoScrollCurrentlyOutOfBoundary=!0)},i._calculateTouchMoveVelocity=function(){var t=new ji,e=0;if((e=this._touchMoveTimeDeltas.reduce((function(t,e){return t+e}),e))<=0||e>=.5)t.set(ji.ZERO);else{var i=new ji;i=this._touchMoveDisplacements.reduce((function(t,e){return t.add(e),t}),i),t.set(i.x*(1-this.brake)/e,i.y*(1-this.brake)/e,i.z)}return t},i._flattenVectorByDirection=function(t){var e=t;return e.x=this.horizontal?e.x:0,e.y=this.vertical?e.y:0,e},i._moveContent=function(t,e){var i=this._flattenVectorByDirection(t);sit.set(this._getContentPosition()),sit.add(i),sit.set(Math.round(1e4*sit.x)*rit,Math.round(1e4*sit.y)*rit,sit.z),this._setContentPosition(sit);var n=this._getHowMuchOutOfBoundary();oit.set(n.x,n.y),this._updateScrollBar(oit),this.elastic&&e&&this._startBounceBackIfNeeded()},i._getContentLeftBoundary=function(){if(!this._content)return-1;var t=this._getContentPosition(),e=this._content._uiProps.uiTransformComp;return t.x-e.anchorX*e.width},i._getContentRightBoundary=function(){if(!this._content)return-1;var t=this._content._uiProps.uiTransformComp;return this._getContentLeftBoundary()+t.width},i._getContentTopBoundary=function(){if(!this._content)return-1;var t=this._content._uiProps.uiTransformComp;return this._getContentBottomBoundary()+t.height},i._getContentBottomBoundary=function(){if(!this._content)return-1;var t=this._getContentPosition(),e=this._content._uiProps.uiTransformComp;return t.y-e.anchorY*e.height},i._getHowMuchOutOfBoundary=function(t){if((t=t||new ji).equals(ji.ZERO,rit)&&!this._outOfBoundaryAmountDirty)return this._outOfBoundaryAmount;var e=new ji,i=this._getContentLeftBoundary(),n=this._getContentRightBoundary();i+t.x>this._leftBoundary?e.x=this._leftBoundary-(i+t.x):n+t.x<this._rightBoundary&&(e.x=this._rightBoundary-(n+t.x));var r=this._getContentTopBoundary(),s=this._getContentBottomBoundary();return r+t.y<this._topBoundary?e.y=this._topBoundary-(r+t.y):s+t.y>this._bottomBoundary&&(e.y=this._bottomBoundary-(s+t.y)),t.equals(ji.ZERO,rit)&&(this._outOfBoundaryAmount=e,this._outOfBoundaryAmountDirty=!1),this._clampDelta(e),e},i._updateScrollBar=function(t){this._horizontalScrollBar&&this._horizontalScrollBar.onScroll(t),this.verticalScrollBar&&this.verticalScrollBar.onScroll(t)},i._onScrollBarTouchBegan=function(){this._horizontalScrollBar&&this._horizontalScrollBar.onTouchBegan(),this.verticalScrollBar&&this.verticalScrollBar.onTouchBegan()},i._onScrollBarTouchEnded=function(){this._horizontalScrollBar&&this._horizontalScrollBar.onTouchEnded(),this.verticalScrollBar&&this.verticalScrollBar.onTouchEnded()},i._dispatchEvent=function(t){if(t===iit.SCROLL_ENDED)this._scrollEventEmitMask=0;else if(t===iit.SCROLL_TO_TOP||t===iit.SCROLL_TO_BOTTOM||t===iit.SCROLL_TO_LEFT||t===iit.SCROLL_TO_RIGHT){var e=1<<lit[t];if(this._scrollEventEmitMask&e)return;this._scrollEventEmitMask|=e}Sc.emitEvents(this.scrollEvents,this,lit[t]),this.node.emit(t,this)},i._adjustContentOutOfBoundary=function(){if(this._content&&(this._outOfBoundaryAmountDirty=!0,this._isOutOfBoundary())){var t=this._getHowMuchOutOfBoundary();sit.set(this._getContentPosition()),sit.add(t),this._content.setPosition(sit),this._updateScrollBar(_n.ZERO)}},i._hideScrollBar=function(){this._horizontalScrollBar&&this._horizontalScrollBar.hide(),this._verticalScrollBar&&this._verticalScrollBar.hide()},i._updateScrollBarState=function(){if(this._content&&this.view){var t=this.view,e=this._content._uiProps.uiTransformComp;this.verticalScrollBar&&(e.height<t.height?this.verticalScrollBar.hide():this.verticalScrollBar.show()),this.horizontalScrollBar&&(e.width<t.width?this.horizontalScrollBar.hide():this.horizontalScrollBar.show())}},i._stopPropagationIfTargetIsMe=function(t){t.eventPhase===uA.AT_TARGET&&t.target===this.node&&(t.propagationStopped=!0)},i._processDeltaMove=function(t){this._scrollChildren(t),this._gatherTouchMove(t)},i._handleMoveLogic=function(t){this._getLocalAxisAlignDelta(this._deltaPos,t),this._processDeltaMove(this._deltaPos)},i._handleReleaseLogic=function(t){this._getLocalAxisAlignDelta(this._deltaPos,t),this._gatherTouchMove(this._deltaPos),this._processInertiaScroll(),this._scrolling&&(this._scrolling=!1,this._autoScrolling||this._dispatchEvent(iit.SCROLL_ENDED))},i._getLocalAxisAlignDelta=function(t,e){var i=this.node._uiProps.uiTransformComp,n=new ji;i&&(e.getUILocation(oit),e.getUIPreviousLocation(uit),sit.set(oit.x,oit.y,0),ait.set(uit.x,uit.y,0),i.convertToNodeSpaceAR(sit,sit),i.convertToNodeSpaceAR(ait,ait),ji.subtract(n,sit,ait)),t.set(n)},i._scrollChildren=function(t){this._clampDelta(t);var e,i=t;this.elastic&&(e=this._getHowMuchOutOfBoundary(),i.x*=0===e.x?1:.5,i.y*=0===e.y?1:.5),this.elastic||(e=this._getHowMuchOutOfBoundary(i),i.add(e));var n="",r="";if(this._content){var s=this._content._uiProps.uiTransformComp,a=s.anchorX,o=s.anchorY,u=s.width,h=s.height,l=this._content.position||ji.ZERO;this.vertical&&(i.y>0?l.y-o*h+i.y>=this._bottomBoundary&&(n=iit.SCROLL_TO_BOTTOM):i.y<0&&l.y-o*h+h+i.y<=this._topBoundary&&(n=iit.SCROLL_TO_TOP)),this.horizontal&&(i.x<0?l.x-a*u+u+i.x<=this._rightBoundary&&(r=iit.SCROLL_TO_RIGHT):i.x>0&&l.x-a*u+i.x>=this._leftBoundary&&(r=iit.SCROLL_TO_LEFT))}this._moveContent(i,!1),(this.horizontal&&0!==i.x||this.vertical&&0!==i.y)&&(this._scrolling||(this._scrolling=!0,this._dispatchEvent(iit.SCROLL_BEGAN)),this._dispatchEvent(iit.SCROLLING)),""!==n&&this._dispatchEvent(n),""!==r&&this._dispatchEvent(r)},i._handlePressLogic=function(){this._autoScrolling&&this._dispatchEvent(iit.SCROLL_ENDED),this._autoScrolling=!1,this._isBouncing=!1,this._touchMovePreviousTimestamp=hit(),this._touchMoveDisplacements.length=0,this._touchMoveTimeDeltas.length=0,this._onScrollBarTouchBegan()},i._clampDelta=function(t){if(this._content&&this.view){var e=this.view.contentSize,i=this._content._uiProps.uiTransformComp;i.width<e.width&&(t.x=0),i.height<e.height&&(t.y=0)}},i._gatherTouchMove=function(t){var e=t.clone();for(this._clampDelta(e);this._touchMoveDisplacements.length>=5;)this._touchMoveDisplacements.shift(),this._touchMoveTimeDeltas.shift();this._touchMoveDisplacements.push(e);var i=hit();this._touchMoveTimeDeltas.push((i-this._touchMovePreviousTimestamp)/1e3),this._touchMovePreviousTimestamp=i},i._startBounceBackIfNeeded=function(){if(!this.elastic)return!1;var t=this._getHowMuchOutOfBoundary();if(this._clampDelta(t),t.equals(ji.ZERO,rit))return!1;var e=Math.max(this.bounceDuration,0);return this._startAutoScroll(t,e,!0),this._isBouncing||(t.y>0&&this._dispatchEvent(iit.BOUNCE_TOP),t.y<0&&this._dispatchEvent(iit.BOUNCE_BOTTOM),t.x>0&&this._dispatchEvent(iit.BOUNCE_RIGHT),t.x<0&&this._dispatchEvent(iit.BOUNCE_LEFT),this._isBouncing=!0),!0},i._processInertiaScroll=function(){if(!this._startBounceBackIfNeeded()&&this.inertia){var t=this._calculateTouchMoveVelocity();!t.equals(sit,rit)&&this.brake<1&&this._startInertiaScroll(t)}this._onScrollBarTouchEnded()},i._isOutOfBoundary=function(){return!this._getHowMuchOutOfBoundary().equals(ji.ZERO,rit)},i._isNecessaryAutoScrollBrake=function(){if(this._autoScrollBraking)return!0;if(this._isOutOfBoundary()){if(!this._autoScrollCurrentlyOutOfBoundary)return this._autoScrollCurrentlyOutOfBoundary=!0,this._autoScrollBraking=!0,ji.copy(this._autoScrollBrakingStartPosition,this._getContentPosition()),!0}else this._autoScrollCurrentlyOutOfBoundary=!1;return!1},i._processAutoScrolling=function(t){var e=this._isNecessaryAutoScrollBrake(),i=e?.05:1;this._autoScrollAccumulatedTime+=t*(1/i);var n,r=Math.min(1,this._autoScrollAccumulatedTime/this._autoScrollTotalTime);this._autoScrollAttenuate&&(n=r,r=(n-=1)*n*n*n*n+1);var s=this._autoScrollTargetDelta.clone();s.multiplyScalar(r);var a=this._autoScrollStartPosition.clone();a.add(s);var o=Math.abs(r-1)<=rit;if(Math.abs(r-1)<=this.getScrollEndedEventTiming()&&!this._isScrollEndedWithThresholdEventFired&&(this._dispatchEvent(iit.SCROLL_ENG_WITH_THRESHOLD),this._isScrollEndedWithThresholdEventFired=!0),this.elastic){var u=a.clone();u.subtract(this._autoScrollBrakingStartPosition),e&&u.multiplyScalar(i),a.set(this._autoScrollBrakingStartPosition),a.add(u)}else{var h=a.clone();h.subtract(this.getContentPosition());var l=this._getHowMuchOutOfBoundary(h);l.equals(ji.ZERO,rit)||(a.add(l),o=!0)}o&&(this._autoScrolling=!1);var c=a.clone();c.subtract(this._getContentPosition()),this._clampDelta(c),this._moveContent(c,o),this._dispatchEvent(iit.SCROLLING),this._autoScrolling||(this._isBouncing=!1,this._scrolling=!1,this._dispatchEvent(iit.SCROLL_ENDED))},i._checkMouseWheel=function(t){if(!this._getHowMuchOutOfBoundary().equals(ji.ZERO,rit))return this._processInertiaScroll(),this.unschedule(this._checkMouseWheel),this._dispatchEvent(iit.SCROLL_ENDED),void(this._stopMouseWheel=!1);this._mouseWheelEventElapsedTime+=t,this._mouseWheelEventElapsedTime>.1&&(this._onScrollBarTouchEnded(),this.unschedule(this._checkMouseWheel),this._dispatchEvent(iit.SCROLL_ENDED),this._stopMouseWheel=!1)},i._calculateMovePercentDelta=function(t){var e=t.anchor,i=t.applyToHorizontal,n=t.applyToVertical;this._calculateBoundary(),e.clampf(_n.ZERO,_n.ONE);var r=this._getContentBottomBoundary()-this._bottomBoundary;r=-r;var s=this._getContentLeftBoundary()-this._leftBoundary;s=-s;var a=new ji;if(this._content&&this.view){var o=0,u=this._content._uiProps.uiTransformComp.contentSize,h=this.view.contentSize;i&&(o=u.width-h.width,a.x=s-o*e.x),n&&(o=u.height-h.height,a.y=r-o*e.y)}return a},i._moveContentToTopLeft=function(t){var e=this._getContentBottomBoundary()-this._bottomBoundary;e=-e;var i=new ji,n=0,r=this._getContentLeftBoundary()-this._leftBoundary;if(r=-r,this._content){var s=this._content._uiProps.uiTransformComp.contentSize;s.height<t.height&&(n=s.height-t.height,i.y=e-n),s.width<t.width&&(n=s.width-t.width,i.x=r)}this._updateScrollBarState(),this._moveContent(i),this._adjustContentOutOfBoundary()},i._scaleChanged=function(t){t===AE.SCALE&&this._calculateBoundary()},i._xrHoverEnter=function(t){t.deviceType===u8.Left?this._hoverIn=nit.LEFT:t.deviceType===u8.Right&&(this._hoverIn=nit.RIGHT),this._autoScrolling=!1,this._dispatchEvent(iit.SCROLL_BEGAN)},i._xrHoverExit=function(){this._hoverIn=nit.NONE,this._autoScrolling=!0,this._dispatchEvent(iit.SCROLL_ENDED)},i._dispatchEventHandleInput=function(t){var e,i;t instanceof pA?e=t.gamepad:t instanceof mA&&(e=t.handleInputDevice),this.enabledInHierarchy&&this._hoverIn!==nit.NONE&&(this._hoverIn===nit.LEFT?(i=e.leftStick.getValue()).equals(_n.ZERO)||this._xrThumbStickMove(i):this._hoverIn===nit.RIGHT&&((i=e.rightStick.getValue()).equals(_n.ZERO)||this._xrThumbStickMove(i)),!i&&this._scrollState.equals(_n.ZERO)&&(this._xrThumbStickMoveEnd(),this._scrollState.set(i)))},i._xrThumbStickMove=function(t){var e=new ji,i=t.y;this.vertical?e.set(0,-62.5*i,0):this.horizontal&&e.set(-62.5*i,0,0),this._mouseWheelEventElapsedTime=0,this._processDeltaMove(e),this._dispatchEvent(iit.SCROLLING)},i._xrThumbStickMoveEnd=function(){this._autoScrolling=!0,this._dispatchEvent(iit.TOUCH_UP)},h(e,[{key:"content",get:function(){return this._content},set:function(t){if(this._content!==t){var e=t&&t.parent&&t.parent._uiProps.uiTransformComp;!t||t&&e?(this._content=t,this._calculateBoundary()):W(4302)}}},{key:"horizontalScrollBar",get:function(){return this._horizontalScrollBar},set:function(t){this._horizontalScrollBar!==t&&(this._horizontalScrollBar=t,this._horizontalScrollBar&&(this._horizontalScrollBar.setScrollView(this),this._updateScrollBar(_n.ZERO)))}},{key:"verticalScrollBar",get:function(){return this._verticalScrollBar},set:function(t){this._verticalScrollBar!==t&&(this._verticalScrollBar=t,this._verticalScrollBar&&(this._verticalScrollBar.setScrollView(this),this._updateScrollBar(_n.ZERO)))}},{key:"view",get:function(){var t=this._content&&this._content.parent;return t?t._uiProps.uiTransformComp:null}}]),e}(eit),$et.EventType=iit,Het=T((zet=tit).prototype,"bounceDuration",[Eh,cet,_et,fet],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 1}}),Vet=T(zet.prototype,"brake",[Eh,det,pet,met],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return.5}}),Wet=T(zet.prototype,"elastic",[Eh,get,vet],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),Xet=T(zet.prototype,"inertia",[Eh,yet,Eet],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),T(zet.prototype,"content",[Tet,Aet,Ret],Object.getOwnPropertyDescriptor(zet.prototype,"content"),zet.prototype),jet=T(zet.prototype,"horizontal",[Eh,bet,Cet],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),T(zet.prototype,"horizontalScrollBar",[wet,Iet,Oet],Object.getOwnPropertyDescriptor(zet.prototype,"horizontalScrollBar"),zet.prototype),Yet=T(zet.prototype,"vertical",[Eh,xet,Pet],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),T(zet.prototype,"verticalScrollBar",[Det,Bet,Net],Object.getOwnPropertyDescriptor(zet.prototype,"verticalScrollBar"),zet.prototype),Ket=T(zet.prototype,"cancelInnerEvents",[Eh,Met,Let],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),qet=T(zet.prototype,"scrollEvents",[Fet,Eh,Uet,Get],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),Qet=T(zet.prototype,"_content",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),Zet=T(zet.prototype,"_horizontalScrollBar",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),Jet=T(zet.prototype,"_verticalScrollBar",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),ket=zet))||ket)||ket)||ket)||ket)||ket));b.ScrollView=Dit;var Bit,Nit=new ji;!function(t){t[t.Horizontal=0]="Horizontal",t[t.Vertical=1]="Vertical"}(Bit||(Bit={})),pe(Bit);var Mit,Lit,Fit,Uit,Git,kit,zit,Hit,Vit,Wit,Xit,jit,Yit,Kit,qit,Qit,Zit,Jit,$it,tnt,ent=function(e){return t({Slider:e,SliderComponent:e}),e}((cit=_h("cc.Slider"),_it=xh(),fit=dh(110),dit=Ch(),pit=fh(Ak),mit=Kh(PW),git=Mh(),vit=Kh(Bit),yit=Mh(),Eit=Lh(),Tit=Mh(),Sit=Kh([Sc]),Ait=Mh(),cit(Rit=_it(Rit=fit(Rit=dit(Rit=pit((Pit=xit=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return E(e=t.call.apply(t,[this].concat(n))||this,"slideEvents",Cit,g(e)),E(e,"_handle",wit,g(e)),E(e,"_direction",Iit,g(e)),E(e,"_progress",Oit,g(e)),e._offset=new ji,e._dragging=!1,e._touchHandle=!1,e._handleLocalPos=new ji,e._touchPos=new ji,e}c(e,t);var i=e.prototype;return i.__preload=function(){this._updateHandlePosition()},i.onEnable=function(){this._updateHandlePosition(),this.node.on(aE.TOUCH_START,this._onTouchBegan,this),this.node.on(aE.TOUCH_MOVE,this._onTouchMoved,this),this.node.on(aE.TOUCH_END,this._onTouchEnded,this),this.node.on(aE.TOUCH_CANCEL,this._onTouchCancelled,this),this.node.on(h8.XRUI_HOVER_STAY,this._xrHoverStay,this),this.node.on(h8.XRUI_CLICK,this._xrClick,this),this.node.on(h8.XRUI_UNCLICK,this._xrUnClick,this),this._handle&&this._handle.isValid&&(this._handle.node.on(aE.TOUCH_START,this._onHandleDragStart,this),this._handle.node.on(aE.TOUCH_MOVE,this._onTouchMoved,this),this._handle.node.on(aE.TOUCH_END,this._onTouchEnded,this))},i.onDisable=function(){this.node.off(aE.TOUCH_START,this._onTouchBegan,this),this.node.off(aE.TOUCH_MOVE,this._onTouchMoved,this),this.node.off(aE.TOUCH_END,this._onTouchEnded,this),this.node.off(aE.TOUCH_CANCEL,this._onTouchCancelled,this),this.node.off(h8.XRUI_HOVER_STAY,this._xrHoverStay,this),this.node.off(h8.XRUI_CLICK,this._xrClick,this),this.node.off(h8.XRUI_UNCLICK,this._xrUnClick,this),this._handle&&this._handle.isValid&&(this._handle.node.off(aE.TOUCH_START,this._onHandleDragStart,this),this._handle.node.off(aE.TOUCH_MOVE,this._onTouchMoved,this),this._handle.node.off(aE.TOUCH_END,this._onTouchEnded,this))},i._onHandleDragStart=function(t){if(t&&this._handle&&this._handle.node._uiProps.uiTransformComp){this._dragging=!0,this._touchHandle=!0;var e=t.touch.getUILocation();ji.set(this._touchPos,e.x,e.y,0),this._handle.node._uiProps.uiTransformComp.convertToNodeSpaceAR(this._touchPos,this._offset),t.propagationStopped=!0}},i._onTouchBegan=function(t){this._handle&&t&&(this._dragging=!0,this._touchHandle||this._handleSliderLogic(t.touch),t.propagationStopped=!0)},i._onTouchMoved=function(t){this._dragging&&t&&(this._handleSliderLogic(t.touch),t.propagationStopped=!0)},i._onTouchEnded=function(t){this._dragging=!1,this._touchHandle=!1,this._offset=new ji,t&&(t.propagationStopped=!0)},i._onTouchCancelled=function(t){this._dragging=!1,t&&(t.propagationStopped=!0)},i._handleSliderLogic=function(t){this._updateProgress(t),this._emitSlideEvent()},i._emitSlideEvent=function(){Sc.emitEvents(this.slideEvents,this),this.node.emit("slide",this)},i._updateProgress=function(t){if(this._handle&&t){var e=t.getUILocation();ji.set(this._touchPos,e.x,e.y,0);var i=this.node._uiProps.uiTransformComp,n=i.convertToNodeSpaceAR(this._touchPos,Nit);this.direction===Bit.Horizontal?this.progress=yi(.5+(n.x-this._offset.x)/i.width):this.progress=yi(.5+(n.y-this._offset.y)/i.height)}},i._updateHandlePosition=function(){if(this._handle){this._handleLocalPos.set(this._handle.node.getPosition());var t=this.node._uiProps.uiTransformComp;this._direction===Bit.Horizontal?this._handleLocalPos.x=-t.width*t.anchorX+this.progress*t.width:this._handleLocalPos.y=-t.height*t.anchorY+this.progress*t.height,this._handle.node.setPosition(this._handleLocalPos)}},i._changeLayout=function(){var t=this.node._uiProps.uiTransformComp,e=t.contentSize;if(t.setContentSize(e.height,e.width),this._handle){var i=this._handle.node.position;this._direction===Bit.Horizontal?this._handle.node.setPosition(i.x,0,i.z):this._handle.node.setPosition(0,i.y,i.z),this._updateHandlePosition()}},i._xrHandleProgress=function(t){if(!this._touchHandle){var e=this.node._uiProps.uiTransformComp;e.convertToNodeSpaceAR(t,Nit),this.direction===Bit.Horizontal?this.progress=yi(.5+(Nit.x-this.node.position.x)/e.width):this.progress=yi(.5+(Nit.y-this.node.position.y)/e.height)}},i._xrClick=function(t){this._handle&&(this._dragging=!0,this._xrHandleProgress(t.hitPoint),this._emitSlideEvent())},i._xrUnClick=function(){this._dragging=!1,this._touchHandle=!1},i._xrHoverStay=function(t){this._dragging&&(this._xrHandleProgress(t.hitPoint),this._emitSlideEvent())},h(e,[{key:"handle",get:function(){return this._handle},set:function(t){this._handle!==t&&(this._handle=t)}},{key:"direction",get:function(){return this._direction},set:function(t){this._direction!==t&&(this._direction=t,this._changeLayout())}},{key:"progress",get:function(){return this._progress},set:function(t){this._progress!==t&&(this._progress=t,this._updateHandlePosition())}}]),e}(bc),xit.Direction=Bit,T((bit=Pit).prototype,"handle",[mit,git],Object.getOwnPropertyDescriptor(bit.prototype,"handle"),bit.prototype),T(bit.prototype,"direction",[vit,yit],Object.getOwnPropertyDescriptor(bit.prototype,"direction"),bit.prototype),T(bit.prototype,"progress",[kh,Eit,Tit],Object.getOwnPropertyDescriptor(bit.prototype,"progress"),bit.prototype),Cit=T(bit.prototype,"slideEvents",[Sit,Eh,Ait],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),wit=T(bit.prototype,"_handle",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),Iit=T(bit.prototype,"_direction",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Bit.Horizontal}}),Oit=T(bit.prototype,"_progress",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return.1}}),Rit=bit))||Rit)||Rit)||Rit)||Rit)||Rit));function int(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return Object.assign.apply(Object,[{}].concat(e))}b.Slider=ent,function(t){t.TOGGLE="toggle"}(tnt||(tnt={}));var nnt,rnt,snt,ant,ont,unt,hnt,lnt,cnt,_nt,fnt,dnt,pnt=function(e){return t({Toggle:e,ToggleComponent:e}),e}((Mit=_h("cc.Toggle"),Lit=xh(),Fit=dh(110),Uit=Ch(),Git=fh(Ak),kit=zh(),zit=Mh(),Hit=Kh(PW),Vit=zh(),Wit=Mh(),Xit=Kh([Sc]),jit=Mh(),Mit(Yit=Lit(Yit=Fit(Yit=Uit(Yit=Git(($it=Jit=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return E(e=t.call.apply(t,[this].concat(n))||this,"checkEvents",qit,g(e)),E(e,"_isChecked",Qit,g(e)),E(e,"_checkMark",Zit,g(e)),e}c(e,t);var i=e.prototype;return i._internalToggle=function(){this.isChecked=!this.isChecked},i._set=function(t,e){if(void 0===e&&(e=!0),this._isChecked!=t){this._isChecked=t;var i=this._toggleContainer;i&&i.enabled&&this.enabled&&(t||!i.anyTogglesChecked()&&!i.allowSwitchOff)&&(this._isChecked=!0,i.notifyToggleCheck(this,e)),this.playEffect(),e&&this._emitToggleEvents()}},i.playEffect=function(){this._checkMark&&(this._checkMark.node.active=this._isChecked)},i.setIsCheckedWithoutNotify=function(t){this._set(t,!1)},i.onEnable=function(){t.prototype.onEnable.call(this),this.playEffect(),this.node.on(e.EventType.CLICK,this._internalToggle,this)},i.onDisable=function(){t.prototype.onDisable.call(this),this.node.off(e.EventType.CLICK,this._internalToggle,this)},i.OnDestroy=function(){var t=this._toggleContainer;t&&t.ensureValidState()},i._emitToggleEvents=function(){this.node.emit(e.EventType.TOGGLE,this),this.checkEvents&&Sc.emitEvents(this.checkEvents,this)},h(e,[{key:"isChecked",get:function(){return this._isChecked},set:function(t){this._set(t)}},{key:"checkMark",get:function(){return this._checkMark},set:function(t){this._checkMark!==t&&(this._checkMark=t)}},{key:"_resizeToTarget",set:function(t){t&&this._resizeNodeToTargetNode()}},{key:"_toggleContainer",get:function(){var t=this.node.parent;return b.Node.isNode(t)?t.getComponent("cc.ToggleContainer"):null}}]),e}(w6),Jit.EventType=int(tnt,b6),T((Kit=$it).prototype,"isChecked",[kit,zit],Object.getOwnPropertyDescriptor(Kit.prototype,"isChecked"),Kit.prototype),T(Kit.prototype,"checkMark",[Hit,Vit,Wit],Object.getOwnPropertyDescriptor(Kit.prototype,"checkMark"),Kit.prototype),qit=T(Kit.prototype,"checkEvents",[Xit,Eh,jit],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),Qit=T(Kit.prototype,"_isChecked",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),Zit=T(Kit.prototype,"_checkMark",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),Yit=Kit))||Yit)||Yit)||Yit)||Yit)||Yit));b.Toggle=pnt;var mnt,gnt,vnt,ynt,Ent,Tnt,Snt,Ant,Rnt,bnt,Cnt,wnt,Int,Ont,xnt,Pnt,Dnt,Bnt,Nnt,Mnt,Lnt,Fnt,Unt,Gnt,knt,znt,Hnt,Vnt,Wnt,Xnt,jnt,Ynt,Knt,qnt,Qnt,Znt,Jnt,$nt,trt,ert,irt,nrt,rrt,srt,art,ort=function(e){return t({ToggleContainer:e,ToggleContainerComponent:e}),e}((nnt=_h("cc.ToggleContainer"),rnt=xh(),snt=dh(110),ant=Ch(),ont=Mh(),unt=Kh([Sc]),hnt=Mh(),nnt(lnt=rnt(lnt=snt(lnt=ant(lnt=bh((dnt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return E(e=t.call.apply(t,[this].concat(n))||this,"_allowSwitchOff",_nt,g(e)),E(e,"checkEvents",fnt,g(e)),e}c(e,t);var i=e.prototype;return i.onEnable=function(){this.ensureValidState(),this.node.on(aE.CHILD_ADDED,this.ensureValidState,this),this.node.on(aE.CHILD_REMOVED,this.ensureValidState,this)},i.onDisable=function(){this.node.off(aE.CHILD_ADDED,this.ensureValidState,this),this.node.off(aE.CHILD_REMOVED,this.ensureValidState,this)},i.activeToggles=function(){return this.toggleItems.filter((function(t){return t.isChecked}))},i.anyTogglesChecked=function(){return!!this.toggleItems.find((function(t){return t.isChecked}))},i.notifyToggleCheck=function(t,e){if(void 0===e&&(e=!0),this.enabledInHierarchy){for(var i=0;i<this.toggleItems.length;i++){var n=this.toggleItems[i];n!==t&&(e?n.isChecked=!1:n.setIsCheckedWithoutNotify(!1))}this.checkEvents&&b.Component.EventHandler.emitEvents(this.checkEvents,t)}},i.ensureValidState=function(){var t=this.toggleItems;if(!this._allowSwitchOff&&!this.anyTogglesChecked()&&0!==t.length){var e=t[0];e.isChecked=!0,this.notifyToggleCheck(e)}var i=this.activeToggles();if(i.length>1)for(var n=i[0],r=0;r<i.length;++r){var s=i[r];s!==n&&(s.isChecked=!1)}},h(e,[{key:"allowSwitchOff",get:function(){return this._allowSwitchOff},set:function(t){this._allowSwitchOff=t}},{key:"toggleItems",get:function(){return this.node.children.map((function(t){var e=t.getComponent("cc.Toggle");return e&&e.enabled?e:null})).filter(Boolean)}}]),e}(bc),_nt=T((cnt=dnt).prototype,"_allowSwitchOff",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),T(cnt.prototype,"allowSwitchOff",[ont],Object.getOwnPropertyDescriptor(cnt.prototype,"allowSwitchOff"),cnt.prototype),fnt=T(cnt.prototype,"checkEvents",[unt,Eh,hnt],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),lnt=cnt))||lnt)||lnt)||lnt)||lnt)||lnt));b.ToggleContainer=ort;var urt,hrt,lrt=new _n;function crt(t){return t instanceof Kw?NL:t._uiProps.uiTransformComp?t._uiProps.uiTransformComp.contentSize:gn.ZERO}function _rt(t,e,i,n){t.parent?lrt.set(t.parent.getScale().x,t.parent.getScale().y):lrt.set(0,0);for(var r=lrt.x,s=lrt.y,a=0,o=0,u=t.parent;;){if(!u)return i.x=i.y=0,void(n.x=n.y=1);var h=u.getPosition();if(a+=h.x,o+=h.y,(u=u.parent)===e)break;u?lrt.set(u.getScale().x,u.getScale().y):lrt.set(0,0);var l=lrt.x,c=lrt.y;a*=l,o*=c,r*=l,s*=c}n.x=0!==r?1/r:1,n.y=0!==s?1/s:1,i.x=-a,i.y=-o}!function(t){t[t.ONCE=0]="ONCE",t[t.ALWAYS=1]="ALWAYS",t[t.ON_WINDOW_RESIZE=2]="ON_WINDOW_RESIZE"}(urt||(urt={})),pe(urt),function(t){t[t.TOP=1]="TOP",t[t.MID=2]="MID",t[t.BOT=4]="BOT",t[t.LEFT=8]="LEFT",t[t.CENTER=16]="CENTER",t[t.RIGHT=32]="RIGHT",t[t.HORIZONTAL=56]="HORIZONTAL",t[t.VERTICAL=7]="VERTICAL"}(hrt||(hrt={}));var frt,drt,prt,mrt,grt,vrt,yrt,Ert,Trt,Srt,Art,Rrt,brt,Crt,wrt,Irt,Ort,xrt,Prt,Drt=hrt.TOP|hrt.BOT,Brt=hrt.LEFT|hrt.RIGHT,Nrt=function(e){return t({Widget:e,WidgetComponent:e}),e}((mnt=_h("cc.Widget"),gnt=xh(),vnt=dh(110),ynt=Ch(),Ent=fh(Ak),Tnt=Kh(jE),Snt=Mh(),Ant=Mh(),Rnt=Mh(),bnt=Mh(),Cnt=Mh(),wnt=Mh(),Int=Mh(),Ont=Dh(),xnt=Dh(),Pnt=Mh(),Dnt=Mh(),Bnt=Mh(),Nnt=Mh(),Mnt=Mh(),Lnt=Mh(),Fnt=Kh(urt),Unt=Mh(),mnt(Gnt=gnt(Gnt=vnt(Gnt=ynt(Gnt=Ent(Gnt=bh((art=srt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._lastPos=new ji,e._lastSize=new gn,e._dirty=!0,e._hadAlignOnce=!1,E(e,"_alignFlags",znt,g(e)),E(e,"_target",Hnt,g(e)),E(e,"_left",Vnt,g(e)),E(e,"_right",Wnt,g(e)),E(e,"_top",Xnt,g(e)),E(e,"_bottom",jnt,g(e)),E(e,"_horizontalCenter",Ynt,g(e)),E(e,"_verticalCenter",Knt,g(e)),E(e,"_isAbsLeft",qnt,g(e)),E(e,"_isAbsRight",Qnt,g(e)),E(e,"_isAbsTop",Znt,g(e)),E(e,"_isAbsBottom",Jnt,g(e)),E(e,"_isAbsHorizontalCenter",$nt,g(e)),E(e,"_isAbsVerticalCenter",trt,g(e)),E(e,"_originalWidth",ert,g(e)),E(e,"_originalHeight",irt,g(e)),E(e,"_alignMode",nrt,g(e)),E(e,"_lockFlags",rrt,g(e)),e}c(e,t);var i=e.prototype;return i.updateAlignment=function(){b._widgetManager.updateAlignment(this.node)},i._validateTargetInDEV=function(){},i.setDirty=function(){this._recursiveDirty()},i.onEnable=function(){this.node.getPosition(this._lastPos),this._lastSize.set(this.node._uiProps.uiTransformComp.contentSize),b._widgetManager.add(this),this._hadAlignOnce=!1,this._registerEvent(),this._registerTargetEvents()},i.onDisable=function(){b._widgetManager.remove(this),this._unregisterEvent(),this._unregisterTargetEvents()},i.onDestroy=function(){this._removeParentEvent()},i._adjustWidgetToAllowMovingInEditor=function(){},i._adjustWidgetToAllowResizingInEditor=function(){},i._adjustWidgetToAnchorChanged=function(){this.setDirty()},i._adjustTargetToParentChanged=function(t){t&&this._unregisterOldParentEvents(t),this.node.getParent()&&this._registerTargetEvents(),this._setDirtyByMode()},i._registerEvent=function(){this.node.on(aE.TRANSFORM_CHANGED,this._setDirtyByMode,this),this.node.on(aE.SIZE_CHANGED,this._setDirtyByMode,this),this.node.on(aE.ANCHOR_CHANGED,this._adjustWidgetToAnchorChanged,this),this.node.on(aE.PARENT_CHANGED,this._adjustTargetToParentChanged,this)},i._unregisterEvent=function(){this.node.off(aE.TRANSFORM_CHANGED,this._setDirtyByMode,this),this.node.off(aE.SIZE_CHANGED,this._setDirtyByMode,this),this.node.off(aE.ANCHOR_CHANGED,this._adjustWidgetToAnchorChanged,this)},i._removeParentEvent=function(){this.node.off(aE.PARENT_CHANGED,this._adjustTargetToParentChanged,this)},i._autoChangedValue=function(t,e){if((this._alignFlags&t)>0){var i=this.node.parent&&this.node.parent._uiProps,n=i&&i.uiTransformComp,r=n?n.contentSize:NL;this.isAlignLeft&&t===hrt.LEFT?this._left=e?this._left*r.width:this._left/r.width:this.isAlignRight&&t===hrt.RIGHT?this._right=e?this._right*r.width:this._right/r.width:this.isAlignHorizontalCenter&&t===hrt.CENTER?this._horizontalCenter=e?this._horizontalCenter*r.width:this._horizontalCenter/r.width:this.isAlignTop&&t===hrt.TOP?this._top=e?this._top*r.height:this._top/r.height:this.isAlignBottom&&t===hrt.BOT?this._bottom=e?this._bottom*r.height:this._bottom/r.height:this.isAbsoluteVerticalCenter&&t===hrt.MID&&(this._verticalCenter=this._verticalCenter/r.height),this._recursiveDirty()}},i._registerTargetEvents=function(){var t=this._target||this.node.parent;t&&t.getComponent(Ak)&&(t.on(aE.TRANSFORM_CHANGED,this._setDirtyByMode,this),t.on(aE.SIZE_CHANGED,this._setDirtyByMode,this),t.on(aE.ANCHOR_CHANGED,this._setDirtyByMode,this))},i._unregisterTargetEvents=function(){var t=this._target||this.node.parent;t&&(t.off(aE.TRANSFORM_CHANGED,this._setDirtyByMode,this),t.off(aE.SIZE_CHANGED,this._setDirtyByMode,this),t.off(aE.ANCHOR_CHANGED,this._setDirtyByMode,this))},i._unregisterOldParentEvents=function(t){var e=this._target||t;e&&(e.off(aE.TRANSFORM_CHANGED,this._setDirtyByMode,this),e.off(aE.SIZE_CHANGED,this._setDirtyByMode,this))},i._setDirtyByMode=function(){this.alignMode===urt.ALWAYS&&this._recursiveDirty()},i._setAlign=function(t,e){if(e!==(this._alignFlags&t)>0){var i=(t&Brt)>0,n=this.node._uiProps.uiTransformComp;e?(this._alignFlags|=t,i?(this.isAlignHorizontalCenter=!1,this.isStretchWidth&&(this._originalWidth=n.width)):(this.isAlignVerticalCenter=!1,this.isStretchHeight&&(this._originalHeight=n.height))):(i?this.isStretchWidth&&(n.width=this._originalWidth):this.isStretchHeight&&(n.height=this._originalHeight),this._alignFlags&=~t)}},i._recursiveDirty=function(){this._dirty||(this._dirty=!0)},h(e,[{key:"target",get:function(){return this._target},set:function(t){this._target!==t&&(this._unregisterTargetEvents(),this._target=t,this._registerTargetEvents(),this._validateTargetInDEV(),this._recursiveDirty())}},{key:"isAlignTop",get:function(){return(this._alignFlags&hrt.TOP)>0},set:function(t){this._setAlign(hrt.TOP,t),this._recursiveDirty()}},{key:"isAlignBottom",get:function(){return(this._alignFlags&hrt.BOT)>0},set:function(t){this._setAlign(hrt.BOT,t),this._recursiveDirty()}},{key:"isAlignLeft",get:function(){return(this._alignFlags&hrt.LEFT)>0},set:function(t){this._setAlign(hrt.LEFT,t),this._recursiveDirty()}},{key:"isAlignRight",get:function(){return(this._alignFlags&hrt.RIGHT)>0},set:function(t){this._setAlign(hrt.RIGHT,t),this._recursiveDirty()}},{key:"isAlignVerticalCenter",get:function(){return(this._alignFlags&hrt.MID)>0},set:function(t){t?(this.isAlignTop=!1,this.isAlignBottom=!1,this._alignFlags|=hrt.MID):this._alignFlags&=~hrt.MID,this._recursiveDirty()}},{key:"isAlignHorizontalCenter",get:function(){return(this._alignFlags&hrt.CENTER)>0},set:function(t){t?(this.isAlignLeft=!1,this.isAlignRight=!1,this._alignFlags|=hrt.CENTER):this._alignFlags&=~hrt.CENTER,this._recursiveDirty()}},{key:"isStretchWidth",get:function(){return(this._alignFlags&Brt)===Brt}},{key:"isStretchHeight",get:function(){return(this._alignFlags&Drt)===Drt}},{key:"top",get:function(){return this._top},set:function(t){this._top=t,this._recursiveDirty()}},{key:"editorTop",get:function(){return this._isAbsTop?this._top:100*this._top},set:function(t){this._top=this._isAbsTop?t:t/100,this._recursiveDirty()}},{key:"bottom",get:function(){return this._bottom},set:function(t){this._bottom=t,this._recursiveDirty()}},{key:"editorBottom",get:function(){return this._isAbsBottom?this._bottom:100*this._bottom},set:function(t){this._bottom=this._isAbsBottom?t:t/100,this._recursiveDirty()}},{key:"left",get:function(){return this._left},set:function(t){this._left=t,this._recursiveDirty()}},{key:"editorLeft",get:function(){return this._isAbsLeft?this._left:100*this._left},set:function(t){this._left=this._isAbsLeft?t:t/100,this._recursiveDirty()}},{key:"right",get:function(){return this._right},set:function(t){this._right=t,this._recursiveDirty()}},{key:"editorRight",get:function(){return this._isAbsRight?this._right:100*this._right},set:function(t){this._right=this._isAbsRight?t:t/100,this._recursiveDirty()}},{key:"horizontalCenter",get:function(){return this._horizontalCenter},set:function(t){this._horizontalCenter=t,this._recursiveDirty()}},{key:"editorHorizontalCenter",get:function(){return this._isAbsHorizontalCenter?this._horizontalCenter:100*this._horizontalCenter},set:function(t){this._horizontalCenter=this._isAbsHorizontalCenter?t:t/100,this._recursiveDirty()}},{key:"verticalCenter",get:function(){return this._verticalCenter},set:function(t){this._verticalCenter=t,this._recursiveDirty()}},{key:"editorVerticalCenter",get:function(){return this._isAbsVerticalCenter?this._verticalCenter:100*this._verticalCenter},set:function(t){this._verticalCenter=this._isAbsVerticalCenter?t:t/100,this._recursiveDirty()}},{key:"isAbsoluteTop",get:function(){return this._isAbsTop},set:function(t){this._isAbsTop!==t&&(this._isAbsTop=t,this._autoChangedValue(hrt.TOP,this._isAbsTop))}},{key:"isAbsoluteBottom",get:function(){return this._isAbsBottom},set:function(t){this._isAbsBottom!==t&&(this._isAbsBottom=t,this._autoChangedValue(hrt.BOT,this._isAbsBottom))}},{key:"isAbsoluteLeft",get:function(){return this._isAbsLeft},set:function(t){this._isAbsLeft!==t&&(this._isAbsLeft=t,this._autoChangedValue(hrt.LEFT,this._isAbsLeft))}},{key:"isAbsoluteRight",get:function(){return this._isAbsRight},set:function(t){this._isAbsRight!==t&&(this._isAbsRight=t,this._autoChangedValue(hrt.RIGHT,this._isAbsRight))}},{key:"isAbsoluteHorizontalCenter",get:function(){return this._isAbsHorizontalCenter},set:function(t){this._isAbsHorizontalCenter!==t&&(this._isAbsHorizontalCenter=t,this._autoChangedValue(hrt.CENTER,this._isAbsHorizontalCenter))}},{key:"isAbsoluteVerticalCenter",get:function(){return this._isAbsVerticalCenter},set:function(t){this._isAbsVerticalCenter!==t&&(this._isAbsVerticalCenter=t,this._autoChangedValue(hrt.MID,this._isAbsVerticalCenter))}},{key:"alignMode",get:function(){return this._alignMode},set:function(t){this._alignMode=t,this._recursiveDirty()}},{key:"alignFlags",get:function(){return this._alignFlags},set:function(t){this._alignFlags!==t&&(this._alignFlags=t,this._recursiveDirty())}}]),e}(bc),srt.AlignMode=urt,T((knt=art).prototype,"target",[Tnt,Snt],Object.getOwnPropertyDescriptor(knt.prototype,"target"),knt.prototype),T(knt.prototype,"isAlignTop",[Ant],Object.getOwnPropertyDescriptor(knt.prototype,"isAlignTop"),knt.prototype),T(knt.prototype,"isAlignBottom",[Rnt],Object.getOwnPropertyDescriptor(knt.prototype,"isAlignBottom"),knt.prototype),T(knt.prototype,"isAlignLeft",[bnt],Object.getOwnPropertyDescriptor(knt.prototype,"isAlignLeft"),knt.prototype),T(knt.prototype,"isAlignRight",[Cnt],Object.getOwnPropertyDescriptor(knt.prototype,"isAlignRight"),knt.prototype),T(knt.prototype,"isAlignVerticalCenter",[wnt],Object.getOwnPropertyDescriptor(knt.prototype,"isAlignVerticalCenter"),knt.prototype),T(knt.prototype,"isAlignHorizontalCenter",[Int],Object.getOwnPropertyDescriptor(knt.prototype,"isAlignHorizontalCenter"),knt.prototype),T(knt.prototype,"isStretchWidth",[Ont],Object.getOwnPropertyDescriptor(knt.prototype,"isStretchWidth"),knt.prototype),T(knt.prototype,"isStretchHeight",[xnt],Object.getOwnPropertyDescriptor(knt.prototype,"isStretchHeight"),knt.prototype),T(knt.prototype,"top",[Pnt],Object.getOwnPropertyDescriptor(knt.prototype,"top"),knt.prototype),T(knt.prototype,"editorTop",[Ph],Object.getOwnPropertyDescriptor(knt.prototype,"editorTop"),knt.prototype),T(knt.prototype,"bottom",[Dnt],Object.getOwnPropertyDescriptor(knt.prototype,"bottom"),knt.prototype),T(knt.prototype,"editorBottom",[Ph],Object.getOwnPropertyDescriptor(knt.prototype,"editorBottom"),knt.prototype),T(knt.prototype,"left",[Bnt],Object.getOwnPropertyDescriptor(knt.prototype,"left"),knt.prototype),T(knt.prototype,"editorLeft",[Ph],Object.getOwnPropertyDescriptor(knt.prototype,"editorLeft"),knt.prototype),T(knt.prototype,"right",[Nnt],Object.getOwnPropertyDescriptor(knt.prototype,"right"),knt.prototype),T(knt.prototype,"editorRight",[Ph],Object.getOwnPropertyDescriptor(knt.prototype,"editorRight"),knt.prototype),T(knt.prototype,"horizontalCenter",[Mnt],Object.getOwnPropertyDescriptor(knt.prototype,"horizontalCenter"),knt.prototype),T(knt.prototype,"editorHorizontalCenter",[Ph],Object.getOwnPropertyDescriptor(knt.prototype,"editorHorizontalCenter"),knt.prototype),T(knt.prototype,"verticalCenter",[Lnt],Object.getOwnPropertyDescriptor(knt.prototype,"verticalCenter"),knt.prototype),T(knt.prototype,"editorVerticalCenter",[Ph],Object.getOwnPropertyDescriptor(knt.prototype,"editorVerticalCenter"),knt.prototype),T(knt.prototype,"isAbsoluteTop",[Ph],Object.getOwnPropertyDescriptor(knt.prototype,"isAbsoluteTop"),knt.prototype),T(knt.prototype,"isAbsoluteBottom",[Ph],Object.getOwnPropertyDescriptor(knt.prototype,"isAbsoluteBottom"),knt.prototype),T(knt.prototype,"isAbsoluteLeft",[Ph],Object.getOwnPropertyDescriptor(knt.prototype,"isAbsoluteLeft"),knt.prototype),T(knt.prototype,"isAbsoluteRight",[Ph],Object.getOwnPropertyDescriptor(knt.prototype,"isAbsoluteRight"),knt.prototype),T(knt.prototype,"isAbsoluteHorizontalCenter",[Ph],Object.getOwnPropertyDescriptor(knt.prototype,"isAbsoluteHorizontalCenter"),knt.prototype),T(knt.prototype,"isAbsoluteVerticalCenter",[Ph],Object.getOwnPropertyDescriptor(knt.prototype,"isAbsoluteVerticalCenter"),knt.prototype),T(knt.prototype,"alignMode",[Fnt,Unt],Object.getOwnPropertyDescriptor(knt.prototype,"alignMode"),knt.prototype),T(knt.prototype,"alignFlags",[Ph],Object.getOwnPropertyDescriptor(knt.prototype,"alignFlags"),knt.prototype),znt=T(knt.prototype,"_alignFlags",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),Hnt=T(knt.prototype,"_target",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),Vnt=T(knt.prototype,"_left",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),Wnt=T(knt.prototype,"_right",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),Xnt=T(knt.prototype,"_top",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),jnt=T(knt.prototype,"_bottom",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),Ynt=T(knt.prototype,"_horizontalCenter",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),Knt=T(knt.prototype,"_verticalCenter",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),qnt=T(knt.prototype,"_isAbsLeft",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),Qnt=T(knt.prototype,"_isAbsRight",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),Znt=T(knt.prototype,"_isAbsTop",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),Jnt=T(knt.prototype,"_isAbsBottom",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),$nt=T(knt.prototype,"_isAbsHorizontalCenter",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),trt=T(knt.prototype,"_isAbsVerticalCenter",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),ert=T(knt.prototype,"_originalWidth",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),irt=T(knt.prototype,"_originalHeight",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),nrt=T(knt.prototype,"_alignMode",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return urt.ON_WINDOW_RESIZE}}),rrt=T(knt.prototype,"_lockFlags",[Eh,Sh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),Gnt=knt))||Gnt)||Gnt)||Gnt)||Gnt)||Gnt)||Gnt));b.internal.computeInverseTransForTarget=_rt,b.internal.getReadonlyNodeSize=crt,b.Widget=Nrt;var Mrt,Lrt=new Gi;!function(t){t[t.HORIZONTAL=0]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(Mrt||(Mrt={})),pe(Mrt);var Frt,Urt,Grt,krt,zrt,Hrt,Vrt,Wrt,Xrt,jrt,Yrt,Krt,qrt,Qrt,Zrt,Jrt,$rt,tst,est,ist,nst,rst,sst,ast,ost,ust,hst,lst,cst,_st,fst,dst,pst,mst,gst,vst,yst,Est,Tst,Sst,Ast,Rst,bst,Cst=function(e){return t({PageViewIndicator:e,PageViewIndicatorComponent:e}),e}((frt=_h("cc.PageViewIndicator"),drt=xh(),prt=dh(110),mrt=Ch(),grt=Kh(hU),vrt=Mh(),yrt=Kh(Mrt),Ert=Mh(),Trt=Kh(gn),Srt=Mh(),Art=Mh(),frt(Rrt=drt(Rrt=prt(Rrt=mrt((Prt=xrt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return E(e=t.call.apply(t,[this].concat(n))||this,"spacing",Crt,g(e)),E(e,"_spriteFrame",wrt,g(e)),E(e,"_direction",Irt,g(e)),E(e,"_cellSize",Ort,g(e)),e._layout=null,e._pageView=null,e._indicators=[],e}c(e,t);var i=e.prototype;return i.onLoad=function(){this._updateLayout()},i.setPageView=function(t){this._pageView=t,this._refresh()},i._updateLayout=function(){this._layout=this.getComponent(Rtt),this._layout||(this._layout=this.addComponent(Rtt));var t=this._layout;this.direction===Mrt.HORIZONTAL?(t.type=Rtt.Type.HORIZONTAL,t.spacingX=this.spacing):this.direction===Mrt.VERTICAL&&(t.type=Rtt.Type.VERTICAL,t.spacingY=this.spacing),t.resizeMode=Rtt.ResizeMode.CONTAINER},i._createIndicator=function(){var t=new jE;t.layer=this.node.layer;var e=t.addComponent(PW);return e.spriteFrame=this.spriteFrame,e.sizeMode=PW.SizeMode.CUSTOM,t.parent=this.node,t._uiProps.uiTransformComp.setContentSize(this._cellSize),t},i._changedState=function(){var t=this._indicators;if(0!==t.length&&this._pageView){var e=this._pageView.curPageIdx;if(!(e>=t.length)){for(var i=0;i<t.length;++i){var n=t[i];if(n._uiProps.uiComp){var r=n._uiProps.uiComp;Lrt.set(r.color),Lrt.a=127.5,r.color=Lrt}}if(t[e]._uiProps.uiComp){var s=t[e]._uiProps.uiComp;Lrt.set(s.color),Lrt.a=255,s.color=Lrt}}}},i._refresh=function(){if(this._pageView){var t=this._indicators,e=this._pageView.getPages();if(e.length!==t.length){var i=0;if(e.length>t.length)for(i=0;i<e.length;++i)t[i]||(t[i]=this._createIndicator());else for(i=t.length-e.length;i>0;--i){var n=t[i-1];this.node.removeChild(n),t.splice(i-1,1)}this._layout&&this._layout.enabledInHierarchy&&this._layout.updateLayout(),this._changedState()}}},h(e,[{key:"spriteFrame",get:function(){return this._spriteFrame},set:function(t){this._spriteFrame!==t&&(this._spriteFrame=t)}},{key:"direction",get:function(){return this._direction},set:function(t){this._direction!==t&&(this._direction=t)}},{key:"cellSize",get:function(){return this._cellSize},set:function(t){this._cellSize!==t&&(this._cellSize=t)}}]),e}(bc),xrt.Direction=Mrt,T((brt=Prt).prototype,"spriteFrame",[grt,vrt],Object.getOwnPropertyDescriptor(brt.prototype,"spriteFrame"),brt.prototype),T(brt.prototype,"direction",[yrt,Ert],Object.getOwnPropertyDescriptor(brt.prototype,"direction"),brt.prototype),T(brt.prototype,"cellSize",[Trt,Srt],Object.getOwnPropertyDescriptor(brt.prototype,"cellSize"),brt.prototype),Crt=T(brt.prototype,"spacing",[Eh,Art],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),wrt=T(brt.prototype,"_spriteFrame",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),Irt=T(brt.prototype,"_direction",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Mrt.HORIZONTAL}}),Ort=T(brt.prototype,"_cellSize",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new gn(20,20)}}),Rrt=brt))||Rrt)||Rrt)||Rrt)||Rrt));b.PageViewIndicator=Cst;var wst,Ist,Ost,xst=new _n;!function(t){t[t.Unified=0]="Unified",t[t.Free=1]="Free"}(wst||(wst={})),pe(wst),function(t){t[t.Horizontal=0]="Horizontal",t[t.Vertical=1]="Vertical"}(Ist||(Ist={})),pe(Ist),function(t){t.PAGE_TURNING="page-turning"}(Ost||(Ost={}));var Pst=function(e){return t({PageView:e,PageViewComponent:e}),e}((Frt=_h("cc.PageView"),Urt=xh(),Grt=dh(110),krt=Ch(),zrt=Kh(wst),Hrt=Mh(),Vrt=Kh(Ist),Wrt=Mh(),Xrt=Lh(),jrt=Mh(),Yrt=Lh(),Krt=Mh(),qrt=Kh(Cst),Qrt=Mh(),Zrt=Mh(),Jrt=Kh(ret),$rt=Dh(),tst=Kh(ret),est=Dh(),ist=Dh(),nst=Dh(),rst=Dh(),sst=Kh([Sc]),ast=Dh(),ost=Mh(),ust=Kh([Sc]),hst=Mh(),Frt(lst=Urt(lst=Grt(lst=krt((bst=Rst=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return E(e=t.call.apply(t,[this].concat(n))||this,"autoPageTurningThreshold",_st,g(e)),E(e,"horizontal",fst,g(e)),E(e,"vertical",dst,g(e)),E(e,"cancelInnerEvents",pst,g(e)),E(e,"scrollEvents",mst,g(e)),E(e,"pageTurningSpeed",gst,g(e)),E(e,"pageEvents",vst,g(e)),E(e,"_sizeMode",yst,g(e)),E(e,"_direction",Est,g(e)),E(e,"_scrollThreshold",Tst,g(e)),E(e,"_pageTurningEventTiming",Sst,g(e)),E(e,"_indicator",Ast,g(e)),e._curPageIdx=0,e._lastPageIdx=0,e._pages=[],e._initContentPos=new ji,e._scrollCenterOffsetX=[],e._scrollCenterOffsetY=[],e._touchBeganPosition=new _n,e._touchEndPosition=new _n,e}c(e,t);var i=e.prototype;return i.onEnable=function(){t.prototype.onEnable.call(this),this.node.on(aE.SIZE_CHANGED,this._updateAllPagesSize,this),this.node.on(e.EventType.SCROLL_ENG_WITH_THRESHOLD,this._dispatchPageTurningEvent,this)},i.onDisable=function(){t.prototype.onDisable.call(this),this.node.off(aE.SIZE_CHANGED,this._updateAllPagesSize,this),this.node.off(e.EventType.SCROLL_ENG_WITH_THRESHOLD,this._dispatchPageTurningEvent,this)},i.onLoad=function(){this._initPages(),this.indicator&&this.indicator.setPageView(this)},i.getCurrentPageIndex=function(){return this._curPageIdx},i.setCurrentPageIndex=function(t){this.scrollToPage(t,1)},i.getPages=function(){return this._pages},i.addPage=function(t){t&&-1===this._pages.indexOf(t)&&this.content&&(t._uiProps.uiTransformComp?(this.content.addChild(t),this._pages.push(t),this._updatePageView()):W(4301))},i.insertPage=function(t,e){if(!(e<0)&&t&&-1===this._pages.indexOf(t)&&this.content)if(e>=this._pages.length)this.addPage(t);else{if(!t._uiProps.uiTransformComp)return void W(4301);this._pages.splice(e,0,t),this.content.insertChild(t,e),this._updatePageView()}},i.removePage=function(t){if(t&&this.content){var e=this._pages.indexOf(t);-1!==e?this.removePageAtIndex(e):j(4300,t.name)}},i.removePageAtIndex=function(t){var e=this._pages;if(!(t<0||t>=e.length)){var i=e[t];i&&this.content&&(this.content.removeChild(i),e.splice(t,1),this._updatePageView())}},i.removeAllPages=function(){if(this.content){for(var t=this._pages,e=0,i=t.length;e<i;e++)this.content.removeChild(t[e]);this._pages.length=0,this._updatePageView()}},i.scrollToPage=function(t,e){void 0===e&&(e=.3),t<0||t>=this._pages.length||(this._curPageIdx=t,this.scrollToOffset(this._moveOffsetValue(t),e,!0),this.indicator&&this.indicator._changedState())},i.getScrollEndedEventTiming=function(){return this.pageTurningEventTiming},i._updatePageView=function(){if(this.content){var t=this.content.getComponent(Rtt);t&&t.enabled&&t.updateLayout();var e=this._pages.length;this._curPageIdx>=e&&(this._curPageIdx=0===e?0:e-1,this._lastPageIdx=this._curPageIdx);for(var i=this._initContentPos,n=0;n<e;++n){var r=this._pages[n].position;this.direction===Ist.Horizontal?this._scrollCenterOffsetX[n]=Math.abs(i.x+r.x):this._scrollCenterOffsetY[n]=Math.abs(i.y+r.y)}this.indicator&&this.indicator._refresh()}},i._updateAllPagesSize=function(){var t=this.view;if(this.content&&t&&this._sizeMode===wst.Unified)for(var e=this._pages,i=t.contentSize,n=0,r=e.length;n<r;n++)e[n]._uiProps.uiTransformComp.setContentSize(i)},i._handleReleaseLogic=function(){this._autoScrollToPage(),this._scrolling&&(this._scrolling=!1,this._autoScrolling||this._dispatchEvent(e.EventType.SCROLL_ENDED))},i._onTouchBegan=function(e,i){e.touch.getUILocation(xst),_n.set(this._touchBeganPosition,xst.x,xst.y),t.prototype._onTouchBegan.call(this,e,i)},i._onTouchMoved=function(e,i){t.prototype._onTouchMoved.call(this,e,i)},i._onTouchEnded=function(e,i){e.touch.getUILocation(xst),_n.set(this._touchEndPosition,xst.x,xst.y),t.prototype._onTouchEnded.call(this,e,i)},i._onTouchCancelled=function(e,i){e.touch.getUILocation(xst),_n.set(this._touchEndPosition,xst.x,xst.y),t.prototype._onTouchCancelled.call(this,e,i)},i._onMouseWheel=function(){},i._syncScrollDirection=function(){this.horizontal=this.direction===Ist.Horizontal,this.vertical=this.direction===Ist.Vertical},i._syncSizeMode=function(){var t=this.view;if(this.content&&t){var e=this.content.getComponent(Rtt);if(e){if(this._sizeMode===wst.Free&&this._pages.length>0){var i=this._pages[0]._uiProps.uiTransformComp,n=this._pages[this._pages.length-1]._uiProps.uiTransformComp;this.direction===Ist.Horizontal?(e.paddingLeft=(t.width-i.width)/2,e.paddingRight=(t.width-n.width)/2):this.direction===Ist.Vertical&&(e.paddingTop=(t.height-i.height)/2,e.paddingBottom=(t.height-n.height)/2)}e.updateLayout()}}},i._initPages=function(){if(this.content){this._initContentPos=this.content.position;for(var t=this.content.children,e=0;e<t.length;++e){var i=t[e];this._pages.indexOf(i)>=0||this._pages.push(i)}this._syncScrollDirection(),this._syncSizeMode(),this._updatePageView()}},i._dispatchPageTurningEvent=function(){this._lastPageIdx!==this._curPageIdx&&(this._lastPageIdx=this._curPageIdx,Sc.emitEvents(this.pageEvents,this,Ost.PAGE_TURNING),this.node.emit(Ost.PAGE_TURNING,this))},i._isQuicklyScrollable=function(t){if(this.direction===Ist.Horizontal){if(Math.abs(t.x)>this.autoPageTurningThreshold)return!0}else if(this.direction===Ist.Vertical&&Math.abs(t.y)>this.autoPageTurningThreshold)return!0;return!1},i._moveOffsetValue=function(t){var e=new _n;if(this._sizeMode===wst.Free)this.direction===Ist.Horizontal?e.x=this._scrollCenterOffsetX[t]:this.direction===Ist.Vertical&&(e.y=this._scrollCenterOffsetY[t]);else{var i=this.view;if(!i)return e;this.direction===Ist.Horizontal?e.x=t*i.width:this.direction===Ist.Vertical&&(e.y=t*i.height)}return e},i._getDragDirection=function(t){return this._direction===Ist.Horizontal?0===t.x?0:t.x>0?1:-1:0===t.y?0:t.y<0?1:-1},i._isScrollable=function(t,e,i){if(this._sizeMode===wst.Free){var n=0,r=0;if(this.direction===Ist.Horizontal)return n=this._scrollCenterOffsetX[e],r=this._scrollCenterOffsetX[i],Math.abs(t.x)>=Math.abs(n-r)*this.scrollThreshold;if(this.direction===Ist.Vertical)return n=this._scrollCenterOffsetY[e],r=this._scrollCenterOffsetY[i],Math.abs(t.y)>=Math.abs(n-r)*this.scrollThreshold}else{var s=this.view;if(!s)return!1;if(this.direction===Ist.Horizontal)return Math.abs(t.x)>=s.width*this.scrollThreshold;if(this.direction===Ist.Vertical)return Math.abs(t.y)>=s.height*this.scrollThreshold}return!1},i._autoScrollToPage=function(){if(this._startBounceBackIfNeeded()){var t=this._getHowMuchOutOfBoundary();this._clampDelta(t),(t.x>0||t.y<0)&&(this._curPageIdx=0===this._pages.length?0:this._pages.length-1),(t.x<0||t.y>0)&&(this._curPageIdx=0),this.indicator&&this.indicator._changedState()}else{var e=new _n;_n.subtract(e,this._touchBeganPosition,this._touchEndPosition);var i=this._curPageIdx,n=i+this._getDragDirection(e),r=this.pageTurningSpeed*Math.abs(i-n);if(n<this._pages.length){if(this._isScrollable(e,i,n))return void this.scrollToPage(n,r);var s=this._calculateTouchMoveVelocity();if(this._isQuicklyScrollable(s))return void this.scrollToPage(n,r)}this.scrollToPage(i,r)}},h(e,[{key:"sizeMode",get:function(){return this._sizeMode},set:function(t){this._sizeMode!==t&&(this._sizeMode=t,this._syncSizeMode())}},{key:"direction",get:function(){return this._direction},set:function(t){this._direction!==t&&(this._direction=t,this._syncScrollDirection())}},{key:"scrollThreshold",get:function(){return this._scrollThreshold},set:function(t){this._scrollThreshold!==t&&(this._scrollThreshold=t)}},{key:"pageTurningEventTiming",get:function(){return this._pageTurningEventTiming},set:function(t){this._pageTurningEventTiming!==t&&(this._pageTurningEventTiming=t)}},{key:"indicator",get:function(){return this._indicator},set:function(t){this._indicator!==t&&(this._indicator=t,this.indicator&&this.indicator.setPageView(this))}},{key:"curPageIdx",get:function(){return this._curPageIdx}},{key:"verticalScrollBar",get:function(){return t.prototype.verticalScrollBar},set:function(t){this.verticalScrollBar=t}},{key:"horizontalScrollBar",get:function(){return t.prototype.horizontalScrollBar},set:function(t){this.horizontalScrollBar=t}}]),e}(Dit),Rst.SizeMode=wst,Rst.Direction=Ist,Rst.EventType=int(Ost,iit),T((cst=bst).prototype,"sizeMode",[zrt,Hrt],Object.getOwnPropertyDescriptor(cst.prototype,"sizeMode"),cst.prototype),T(cst.prototype,"direction",[Vrt,Wrt],Object.getOwnPropertyDescriptor(cst.prototype,"direction"),cst.prototype),T(cst.prototype,"scrollThreshold",[kh,Xrt,jrt],Object.getOwnPropertyDescriptor(cst.prototype,"scrollThreshold"),cst.prototype),T(cst.prototype,"pageTurningEventTiming",[kh,Yrt,Krt],Object.getOwnPropertyDescriptor(cst.prototype,"pageTurningEventTiming"),cst.prototype),T(cst.prototype,"indicator",[qrt,Qrt],Object.getOwnPropertyDescriptor(cst.prototype,"indicator"),cst.prototype),_st=T(cst.prototype,"autoPageTurningThreshold",[Eh,Zrt],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 100}}),T(cst.prototype,"verticalScrollBar",[Jrt,qh,$rt],Object.getOwnPropertyDescriptor(cst.prototype,"verticalScrollBar"),cst.prototype),T(cst.prototype,"horizontalScrollBar",[tst,qh,est],Object.getOwnPropertyDescriptor(cst.prototype,"horizontalScrollBar"),cst.prototype),fst=T(cst.prototype,"horizontal",[qh,Eh,ist],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),dst=T(cst.prototype,"vertical",[qh,Eh,nst],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),pst=T(cst.prototype,"cancelInnerEvents",[qh,Eh,rst],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),mst=T(cst.prototype,"scrollEvents",[sst,Eh,qh,ast],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),gst=T(cst.prototype,"pageTurningSpeed",[Eh,Ph,ost],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return.3}}),vst=T(cst.prototype,"pageEvents",[ust,Eh,hst],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),yst=T(cst.prototype,"_sizeMode",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return wst.Unified}}),Est=T(cst.prototype,"_direction",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Ist.Horizontal}}),Tst=T(cst.prototype,"_scrollThreshold",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return.5}}),Sst=T(cst.prototype,"_pageTurningEventTiming",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return.1}}),Ast=T(cst.prototype,"_indicator",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),lst=cst))||lst)||lst)||lst)||lst));b.PageView=Pst;var Dst=new ji,Bst=new _n,Nst=new _n,Mst=new _n(1,1),Lst=new _n,Fst=new _n;function Ust(t,e){if(!e._hadAlignOnce){e.alignMode===urt.ONCE&&(e._hadAlignOnce=!0);var i,n=e.target,r=Nst,s=Mst;n?_rt(t,i=n,r,s):i=t.parent;var a=crt(i),o=i instanceof Kw||!i.getComponent(Ak),u=o?Bst:i.getComponent(Ak).anchorPoint,h=o;t.getPosition(Dst);var l=t._uiProps.uiTransformComp,c=Dst.x,_=Dst.y,f=l.anchorPoint,d=t.getScale();if(e.alignFlags&hrt.HORIZONTAL){var p=0,m=0,g=a.width;h?(p=NL.left.x,m=NL.right.x):m=(p=-u.x*g)+g,p+=e.isAbsoluteLeft?e.left:e.left*g,m-=e.isAbsoluteRight?e.right:e.right*g,n&&(p+=r.x,p*=s.x,m+=r.x,m*=s.x);var v=0,y=f.x,E=d.x;if(E<0&&(y=1-y,E=-E),e.isStretchWidth)v=m-p,0!==E&&(l.width=v/E),c=p+y*v;else if(v=l.width*E,e.isAlignHorizontalCenter){var T=e.isAbsoluteHorizontalCenter?e.horizontalCenter:e.horizontalCenter*g,S=(.5-u.x)*a.width;n&&(T*=s.x,S+=r.x,S*=s.x),c=S+(y-.5)*v+T}else c=e.isAlignLeft?p+y*v:m+(y-1)*v;e._lastSize.width=v}if(e.alignFlags&hrt.VERTICAL){var A=0,R=0,b=a.height;h?(R=NL.bottom.y,A=NL.top.y):A=(R=-u.y*b)+b,R+=e.isAbsoluteBottom?e.bottom:e.bottom*b,A-=e.isAbsoluteTop?e.top:e.top*b,n&&(R+=r.y,R*=s.y,A+=r.y,A*=s.y);var C=0,w=f.y,I=d.y;if(I<0&&(w=1-w,I=-I),e.isStretchHeight)C=A-R,0!==I&&(l.height=C/I),_=R+w*C;else if(C=l.height*I,e.isAlignVerticalCenter){var O=e.isAbsoluteVerticalCenter?e.verticalCenter:e.verticalCenter*b,x=(.5-u.y)*a.height;n&&(O*=s.y,x+=r.y,x*=s.y),_=x+(w-.5)*C+O}else _=e.isAlignBottom?R+w*C:A+(w-1)*C;e._lastSize.height=C}t.setPosition(c,_,Dst.z),ji.set(e._lastPos,c,_,Dst.z)}}function Gst(t){var e=t.getComponent(Nrt);if(e&&e.enabled){if(!b.isValid(t,!0))return;Hst.push(e)}for(var i,n=y(t.children);!(i=n()).done;){var r=i.value;r.active&&Gst(r)}}function kst(){var t=OL.getScene();if(t){Vst.isAligning=!0,Vst._nodesOrderDirty&&(Hst.length=0,Gst(t),Vst._nodesOrderDirty=!1);var e=null,i=Vst._activeWidgetsIterator;for(i.i=0;i.i<Hst.length;++i.i)(e=Hst[i.i])._dirty&&(Ust(e.node,e),e._dirty=!1);Vst.isAligning=!1}}var zst,Hst=[],Vst=t("widgetManager",b._widgetManager={isAligning:!1,_nodesOrderDirty:!1,_activeWidgetsIterator:new he.MutableForwardIterator(Hst),animationState:null,init:function(){OL.on(IL.EVENT_AFTER_SCENE_LAUNCH,kst),OL.on(IL.EVENT_AFTER_UPDATE,kst),FL.instance.on("design-resolution-changed",this.onResized,this);var t=this.onResized.bind(this);FL.instance.on("canvas-resize",t),Xa.on("orientation-change",t)},add:function(){this._nodesOrderDirty=!0},remove:function(t){this._activeWidgetsIterator.remove(t)},onResized:function(){var t=OL.getScene();t&&this.refreshWidgetOnResized(t)},refreshWidgetOnResized:function(t){var e=jE.isNode(t)&&t.getComponent(Nrt);e&&e.enabled&&(e.alignMode===urt.ON_WINDOW_RESIZE||e.alignMode===urt.ALWAYS)&&e.setDirty();for(var i,n=y(t.children);!(i=n()).done;){var r=i.value;this.refreshWidgetOnResized(r)}},updateOffsetsToStayPut:function(t,e){function i(t,e){return Math.abs(t-e)>1e-10?e:t}var n=t.node,r=n.parent;if(r){var s=Lst;s.set(0,0);var a=Fst;if(a.set(1,1),t.target&&_rt(n,r=t.target,s,a),!e)return;var o=r._uiProps&&r._uiProps.uiTransformComp,u=o?o.anchorPoint:Bst,h=n._uiProps.uiTransformComp,l=crt(r),c=h.anchorPoint,_=n.getPosition(),f=hrt,d=n.getScale(),p=0;if(e&f.LEFT){var m=-u.x*l.width;m+=s.x,m*=a.x,p=_.x-c.x*h.width*Math.abs(d.x)-m,t.isAbsoluteLeft||(p/=l.width),p/=a.x,t.left=i(t.left,p)}if(e&f.RIGHT){var g=(1-u.x)*l.width;g+=s.x,p=(g*=a.x)-(_.x+(1-c.x)*h.width*Math.abs(d.x)),t.isAbsoluteRight||(p/=l.width),p/=a.x,t.right=i(t.right,p)}if(e&f.TOP){var v=(1-u.y)*l.height;v+=s.y,p=(v*=a.y)-(_.y+(1-c.y)*h.height*Math.abs(d.y)),t.isAbsoluteTop||(p/=l.height),p/=a.y,t.top=i(t.top,p)}if(e&f.BOT){var y=-u.y*l.height;y+=s.y,y*=a.y,p=_.y-c.y*h.height*Math.abs(d.y)-y,t.isAbsoluteBottom||(p/=l.height),p/=a.y,t.bottom=i(t.bottom,p)}}},updateAlignment:function t(e){var i=e.parent;i&&jE.isNode(i)&&t(i);var n=e.getComponent(Nrt);n&&i&&Ust(e,n)},AlignMode:urt,AlignFlags:hrt});OL.on(IL.EVENT_INIT,(function(){Vst.init()}));var Wst,Xst,jst,Yst,Kst,qst,Qst,Zst,Jst,$st,tat,eat,iat,nat,rat,sat,aat,oat,uat,hat=function(e){return t({SafeArea:e,SafeAreaComponent:e}),e}(_h("cc.SafeArea")(zst=xh()(zst=dh(110)(zst=bh(zst=Ch()(zst=fh(Nrt)(zst=function(t){function e(){return t.apply(this,arguments)||this}c(e,t);var i=e.prototype;return i.onEnable=function(){this.updateArea(),Xa.on("window-resize",this.updateArea,this),Xa.on("orientation-change",this.updateArea,this)},i.onDisable=function(){Xa.off("window-resize",this.updateArea,this),Xa.off("orientation-change",this.updateArea,this)},i.updateArea=function(){var t=this.node.getComponent(Nrt),e=this.node.getComponent(Ak);if(t&&e){t.updateAlignment();var i=this.node.position.clone(),n=e.anchorPoint.clone();t.isAlignTop=t.isAlignBottom=t.isAlignLeft=t.isAlignRight=!0;var r=zL.getVisibleSize(),s=r.width,a=r.height,o=Qa.getSafeAreaRect();t.top=a-o.y-o.height,t.bottom=o.y,t.left=o.x,t.right=s-o.x-o.width,t.updateAlignment();var u=this.node.position.clone(),h=n.x-(u.x-i.x)/e.width,l=n.y-(u.y-i.y)/e.height;e.setAnchorPoint(h,l),Vst.add(t)}},e}(bc))||zst)||zst)||zst)||zst)||zst)||zst);b.SafeArea=hat;var lat,cat=function(e){return t({UICoordinateTracker:e,UICoordinateTrackerComponent:e}),e}((Wst=_h("cc.UICoordinateTracker"),Xst=xh(),jst=Ch(),Yst=dh(110),Kst=Kh(jE),qst=Mh(),Qst=Kh(HS),Zst=Mh(),Jst=Mh(),$st=Mh(),tat=Kh([Sc]),eat=Mh(),Wst(iat=Xst(iat=jst(iat=Yst((T((nat=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return E(e=t.call.apply(t,[this].concat(n))||this,"syncEvents",rat,g(e)),E(e,"_target",sat,g(e)),E(e,"_camera",aat,g(e)),E(e,"_useScale",oat,g(e)),E(e,"_distance",uat,g(e)),e._transformPos=new ji,e._viewPos=new ji,e._canMove=!0,e._lastWPos=new ji,e._lastCameraPos=new ji,e}c(e,t);var i=e.prototype;return i.onEnable=function(){this._checkCanMove()},i.update=function(){var t=this.node.worldPosition,e=this._camera;if(this._canMove&&e&&e.camera&&(!this._lastWPos.equals(t)||!this._lastCameraPos.equals(e.node.worldPosition))&&(this._lastWPos.set(t),this._lastCameraPos.set(e.node.worldPosition),e.camera.update(),e.convertToUINode(t,this._target,this._transformPos),this._useScale&&ji.transformMat4(this._viewPos,this.node.worldPosition,e.camera.matView),this.syncEvents.length>0)){var i=this._distance/Math.abs(this._viewPos.z);Sc.emitEvents(this.syncEvents,this._transformPos,i)}},i._checkCanMove=function(){this._canMove=!(!this._camera||!this._target)},h(e,[{key:"target",get:function(){return this._target},set:function(t){this._target!==t&&(this._target=t,this._checkCanMove())}},{key:"camera",get:function(){return this._camera},set:function(t){this._camera!==t&&(this._camera=t,this._checkCanMove())}},{key:"useScale",get:function(){return this._useScale},set:function(t){this._useScale!==t&&(this._useScale=t)}},{key:"distance",get:function(){return this._distance},set:function(t){this._distance!==t&&(this._distance=t)}}]),e}(bc)).prototype,"target",[Kst,qst],Object.getOwnPropertyDescriptor(nat.prototype,"target"),nat.prototype),T(nat.prototype,"camera",[Qst,Zst],Object.getOwnPropertyDescriptor(nat.prototype,"camera"),nat.prototype),T(nat.prototype,"useScale",[Jst],Object.getOwnPropertyDescriptor(nat.prototype,"useScale"),nat.prototype),T(nat.prototype,"distance",[$st],Object.getOwnPropertyDescriptor(nat.prototype,"distance"),nat.prototype),rat=T(nat.prototype,"syncEvents",[tat,Eh,eat],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),sat=T(nat.prototype,"_target",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),aat=T(nat.prototype,"_camera",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),oat=T(nat.prototype,"_useScale",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),uat=T(nat.prototype,"_distance",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 1}}),iat=nat))||iat)||iat)||iat)||iat)),_at=[aE.TOUCH_START,aE.TOUCH_END,aE.TOUCH_MOVE,aE.MOUSE_DOWN,aE.MOUSE_MOVE,aE.MOUSE_UP,aE.MOUSE_ENTER,aE.MOUSE_LEAVE,aE.MOUSE_WHEEL];function fat(t){t.propagationStopped=!0}var dat,pat,mat,gat,vat,yat,Eat,Tat,Sat,Aat,Rat,bat,Cat=function(e){return t({BlockInputEvents:e,BlockInputEventsComponent:e}),e}(_h("cc.BlockInputEvents")(lat=xh()(lat=Ch()(lat=function(t){function e(){return t.apply(this,arguments)||this}c(e,t);var i=e.prototype;return i.onEnable=function(){for(var t=0;t<_at.length;t++)this.node.on(_at[t],fat,this)},i.onDisable=function(){for(var t=0;t<_at.length;t++)this.node.off(_at[t],fat,this)},e}(bc))||lat)||lat)||lat),wat=t("SubContextView",(dat=_h("cc.SubContextView"),pat=xh(),mat=dh(110),gat=fh(Ak),vat=Ch(),yat=Mh(),Eat=Mh(),dat(Tat=pat(Tat=mat(Tat=gat(Tat=vat((T((Sat=function(t){function e(){var e;return E(e=t.call(this)||this,"_fps",Aat,g(e)),e._sprite=void 0,e._imageAsset=void 0,e._texture=void 0,e._updatedTime=0,e._updateInterval=0,e._openDataContext=void 0,e._content=void 0,E(e,"_designResolutionSize",Rat,g(e)),e._content=new jE("content"),e._content.hideFlags|=Ta.Flags.DontSave|Ta.Flags.HideInHierarchy,e._sprite=null,e._imageAsset=new Ag,e._openDataContext=null,e._updatedTime=performance.now(),e._texture=new qg,e}c(e,t);var i=e.prototype;return i.onLoad=function(){yF.getOpenDataContext?(this._updateInterval=1e3/this._fps,this._openDataContext=yF.getOpenDataContext(),this._initSharedCanvas(),this._initContentNode(),this._updateSubContextView(),this._updateContentLayer()):this.enabled=!1},i.onEnable=function(){this._registerNodeEvent()},i.onDisable=function(){this._unregisterNodeEvent()},i._initSharedCanvas=function(){if(this._openDataContext){var t=this._openDataContext.canvas,e=this._designResolutionSize.width,i=this._designResolutionSize.height;t.width=e,t.height=i}},i._initContentNode=function(){if(this._openDataContext){var t=this._openDataContext.canvas,e=this._imageAsset;if(e.reset(t),this._texture.image=e,this._texture.create(t.width,t.height),this._sprite=this._content.getComponent(PW),this._sprite||(this._sprite=this._content.addComponent(PW)),this._sprite.spriteFrame)this._sprite.spriteFrame.texture=this._texture;else{var i=new hU;i.texture=this._texture,this._sprite.spriteFrame=i}this._content.parent=this.node}},i._updateSubContextView=function(){if(this._openDataContext){var t=this.node.getComponent(Ak),e=this._content.getComponent(Ak),i=t.width/e.width,n=t.height/e.height,r=i>n?n:i;e.width*=r,e.height*=r;var s=zL.getViewportRect(),a=e.getBoundingBoxToWorld(),o=zL.getVisibleSize(),u=Xa.devicePixelRatio,h=(s.width*(a.x/o.width)+s.x)/u,l=(s.height*(a.y/o.height)+s.y)/u,c=s.width*(a.width/o.width)/u,_=s.height*(a.height/o.height)/u;this._openDataContext.postMessage({fromEngine:!0,type:"engine",event:"viewport",x:h,y:l,width:c,height:_})}},i._updateSubContextTexture=function(){var t=this._imageAsset;if(t&&this._openDataContext&&!(t.width<=0||t.height<=0)){var e=this._openDataContext.canvas;t.reset(e),(e.width>t.width||e.height>t.height)&&this._texture.create(e.width,e.height),this._texture.uploadData(e)}},i._registerNodeEvent=function(){this.node.on(aE.TRANSFORM_CHANGED,this._updateSubContextView,this),this.node.on(aE.SIZE_CHANGED,this._updateSubContextView,this),this.node.on(aE.LAYER_CHANGED,this._updateContentLayer,this)},i._unregisterNodeEvent=function(){this.node.off(aE.TRANSFORM_CHANGED,this._updateSubContextView,this),this.node.off(aE.SIZE_CHANGED,this._updateSubContextView,this),this.node.off(aE.LAYER_CHANGED,this._updateContentLayer,this)},i._updateContentLayer=function(){this._content.layer=this.node.layer},i.update=function(t){void 0===t?this._updateSubContextTexture():performance.now()-this._updatedTime>=this._updateInterval&&(this._updatedTime+=this._updateInterval,this._updateSubContextTexture())},i.onDestroy=function(){this._content.destroy(),this._texture.destroy(),this._sprite&&this._sprite.destroy(),this._imageAsset.destroy(),this._openDataContext=null},h(e,[{key:"designResolutionSize",get:function(){return this._designResolutionSize},set:function(){}},{key:"fps",get:function(){return this._fps},set:function(t){this._fps!==t&&(this._fps=t,this._updateInterval=1e3/t)}}]),e}(bc)).prototype,"designResolutionSize",[yat],Object.getOwnPropertyDescriptor(Sat.prototype,"designResolutionSize"),Sat.prototype),T(Sat.prototype,"fps",[Eat],Object.getOwnPropertyDescriptor(Sat.prototype,"fps"),Sat.prototype),Aat=T(Sat.prototype,"_fps",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 60}}),Rat=T(Sat.prototype,"_designResolutionSize",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new gn(640,960)}}),Tat=Sat))||Tat)||Tat)||Tat)||Tat)||Tat));b.SubContextView=wat,ft({ButtonComponent:{newName:"Button",since:"1.2.0",removed:!1},EditBoxComponent:{newName:"EditBox",since:"1.2.0",removed:!1},LayoutComponent:{newName:"Layout",since:"1.2.0",removed:!1},ProgressBarComponent:{newName:"ProgressBar",since:"1.2.0",removed:!1},ScrollViewComponent:{newName:"ScrollView",since:"1.2.0",removed:!1},ScrollBarComponent:{newName:"ScrollBar",since:"1.2.0",removed:!1},SliderComponent:{newName:"Slider",since:"1.2.0",removed:!1},ToggleComponent:{newName:"Toggle",since:"1.2.0",removed:!1},ToggleContainerComponent:{newName:"ToggleContainer",since:"1.2.0",removed:!1},WidgetComponent:{newName:"Widget",since:"1.2.0",removed:!1},PageViewComponent:{newName:"PageView",since:"1.2.0",removed:!1},PageViewIndicatorComponent:{newName:"PageViewIndicator",since:"1.2.0",removed:!1},SafeAreaComponent:{newName:"SafeArea",since:"1.2.0",removed:!1},UICoordinateTrackerComponent:{newName:"UICoordinateTracker",since:"1.2.0",removed:!1},BlockInputEventsComponent:{newName:"BlockInputEvents",since:"1.2.0",removed:!1}});var Iat=t("UIReorderComponent",_h("cc.UIReorderComponent")(bat=function(){j(1408,"UIReorderComponent")})||bat);b.UIReorderComponent=Iat,b.ButtonComponent=w6,le.setClassAlias(w6,"cc.ButtonComponent"),b.EditBoxComponent=$9,le.setClassAlias($9,"cc.EditBoxComponent"),b.LayoutComponent=Rtt,le.setClassAlias(Rtt,"cc.LayoutComponent"),b.ProgressBarComponent=qtt,le.setClassAlias(qtt,"cc.ProgressBarComponent"),b.ScrollViewComponent=Dit,le.setClassAlias(Dit,"cc.ScrollViewComponent"),b.ScrollBarComponent=ret,le.setClassAlias(ret,"cc.ScrollBarComponent"),b.SliderComponent=ent,le.setClassAlias(ent,"cc.SliderComponent"),b.ToggleComponent=pnt,le.setClassAlias(pnt,"cc.ToggleComponent"),b.ToggleContainerComponent=ort,le.setClassAlias(ort,"cc.ToggleContainerComponent"),b.WidgetComponent=Nrt,le.setClassAlias(Nrt,"cc.WidgetComponent"),b.PageViewComponent=Pst,le.setClassAlias(Pst,"cc.PageViewComponent"),b.PageViewIndicatorComponent=Cst,le.setClassAlias(Cst,"cc.PageViewIndicatorComponent"),b.SafeAreaComponent=hat,le.setClassAlias(hat,"cc.SafeAreaComponent"),le.setClassAlias(cat,"cc.UICoordinateTrackerComponent"),b.BlockInputEventsComponent=Cat,le.setClassAlias(Cat,"cc.BlockInputEventsComponent")}}}));
|