1 |
- System.register([],(function(t,e){"use strict";return{execute:function(){function i(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,(void 0,"symbol"==typeof(r=function(t,e){if("object"!=typeof t||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e);if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(n.key,"string"))?r:String(r)),n)}var r}function n(t,e,n){return e&&i(t.prototype,e),n&&i(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function r(){return(r=Object.assign?Object.assign.bind():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 s(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,o(t,e)}function a(t){return(a=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function o(t,e){return(o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function h(){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 u(t,e,i){return(u=h()?Reflect.construct.bind():function(t,e,i){var n=[null];n.push.apply(n,e);var r=new(Function.bind.apply(t,n));return i&&o(r,i.prototype),r}).apply(null,arguments)}function c(t){var e="function"==typeof Map?new Map:void 0;return(c=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 u(t,arguments,a(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),o(n,t)})(t)}function l(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _(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 f(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(i)return(i=i.call(t)).next.bind(i);if(Array.isArray(t)||(i=function(t,e){if(t){if("string"==typeof t)return _(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)?_(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.")}function d(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 p(t,e){const i="undefined"==typeof window?global:window;return void 0===i[t]?i[t]=e:i[t]}t({BitMask:le,CCClass:ci,Enum:fe,Eventify:Fu,WorldNode3DToLocalNodeUI:hc,WorldNode3DToWorldNodeUI:uc,__checkObsoleteInNamespace__:function(t){return lt||(lt="undefined"==typeof Proxy?{}:new Proxy(t,{get:function(t,e,i){return dt(e),Reflect.get(t,e,i)}})),lt},__checkObsolete__:function(t){for(var e,i=f(t);!(e=i()).done;)dt(e.value)},_resetDebugSetting:G,absMax:Fi,absMaxComponent:Bi,applyMixins:function(t,e){e.forEach((function(e){Object.getOwnPropertyNames(e.prototype).forEach((function(i){"constructor"!==i&&Object.defineProperty(t.prototype,i,Object.getOwnPropertyDescriptor(e.prototype,i))}))}))},approx:Ei,assert:U,assertID:Z,assertIsNonNullable:function(){},assertIsTrue:function(){},assertsArrayIndex:_e,bezier:$o,bezierByTime:mh,binarySearch:function(t,e){return ls(t,e,0)},binarySearchBy:function(t,e,i){for(var n=0,r=t.length-1,s=r>>>1;n<=r;s=n+r>>>1){var a=t[s];if(i(a,e)<0)r=s-1;else{if(!(i(a,e)>0))return s;n=s+1}}return~n},binarySearchEpsilon:ls,ccenum:me,clamp:Ti,clamp01:Si,color:Qi,createDefaultPipeline:kM,debug:k,deprecateModuleExportedName:ft,deserialize:yp,enumerableProps:Ui,equals:yi,error:F,errorID:K,find:oP,flattenCodeArray:Rc,formerlySerializedAs:Bs,fragmentText:GB,getBaselineOffset:function(){return 0},getEnglishWordPartAtFirst:UB,getEnglishWordPartAtLast:kB,getError:J,getSerializationMetadata:function(t){return t[Ps]},instantiate:Vj,inverseLerp:Li,isCCClassOrFastDefined:li,isCCObject:Sa,isDisplayStats:$,isEnglishWordPartAtFirst:function(t){return MB.test(t)},isEnglishWordPartAtLast:function(t){return DB.test(t)},isUnicodeCJK:PB,isUnicodeSpace:LB,isValid:Aa,lerp:Ai,log:L,logID:W,mat4:fn,murmurhash2_32_gc:vc,nextPow2:Di,pingPong:Pi,pseudoRandom:Oi,pseudoRandomRange:xi,pseudoRandomRangeInt:Ni,quat:hn,randomRange:Ii,randomRangeInt:wi,rect:Tn,repeat:Mi,safeMeasureText:BB,setDefaultLogTimes:function(t){t>0&&(ht=t)},setDisplayStats:et,shift:function(t,e,i){if(_e(t,e),_e(t,i),e===i)return t;var n=t[e];if(e<i)for(var r=e+1;r<=i;++r)t[r-1]=t[r];else for(var s=e;s!==i;--s)t[s]=t[s-1];return t[i]=n,t},size:yn,toDegree:Ci,toRadian:Ri,v2:mn,v3:Xi,v4:Gi,warn:B,warnID:j}),p("CC_WECHAT",!1),p("CC_BAIDU",!1),p("CC_XIAOMI",!1),p("CC_ALIPAY",!1),p("CC_BYTEDANCE",!0),p("CC_OPPO",!1),p("CC_VIVO",!1),p("CC_HUAWEI",!1),p("CC_COCOSPLAY",!1),p("CC_QTT",!1),p("CC_LINKSURE",!1);p("CC_EDITOR",!1),p("CC_PREVIEW",!1),p("CC_BUILD",!0),p("CC_TEST",!1),p("CC_DEBUG",!1),p("CC_DEV",!1),p("CC_MINIGAME",!0),p("CC_RUNTIME_BASED",!1),p("CC_SUPPORT_JIT",!1),p("CC_JSB",!1);var m="undefined"==typeof window?global:window,g=t("cclegacy",{_global:m});g.internal={};var v=t("VERSION","3.8.0");m.CocosEngine=g.ENGINE_VERSION=v,m.cc=g;var y=void 0!==globalThis.jsb&&void 0!==jsb.window?jsb.window:globalThis;function E(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 T(t){return 16843009*((t=(858993459&(t-=t>>>1&1431655765))+(t>>>2&858993459))+(t>>>4)&252645135)>>>24}function S(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 A(t){return--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,1+(t|=t>>>16)}m.ccwindow=y;var R=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}}(R);var C=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:E,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:T,countTrailingZeros:S,nextPow2:A,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 R[255&t]<<24|R[t>>>8&255]<<16|R[t>>>16&255]<<8|R[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>>>S(t)+1}});t("bits",C);var b=y.document,I="https://github.com/cocos-creator/engine/blob/develop/EngineErrorMap.md",w=null,O=console.log.bind(console),x=O,N=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: "+P.apply(void 0,[e].concat(n)))}},M=O;function P(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 g.js.formatStr.apply(null,[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 O.apply(void 0,[t].concat(i))}function B(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 N.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 k(){return M.apply(void 0,arguments)}function G(t){if(O=x=N=D=M=function(){},t!==q.NONE){if(t>q.ERROR){var e=function(t){if(g.game.canvas){if(!w){var e=b.createElement("Div");e.setAttribute("id","logInfoDiv"),e.setAttribute("width","200"),e.setAttribute("height",g.game.canvas.height);var i=e.style;i.zIndex="99999",i.position="absolute",i.top=i.left="0",(w=b.createElement("textarea")).setAttribute("rows","20"),w.setAttribute("cols","30"),w.setAttribute("disabled","true");var n=w.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(w),g.game.canvas.parentNode.appendChild(e)}w.value=w.value+t+"\r\n",w.scrollTop=w.scrollHeight}};N=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 : "+P.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: "+P.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 : "+P.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(P.apply(void 0,[t].concat(n)))})}else console&&(console.error||(console.error=console.log),console.warn||(console.warn=console.log),N=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=P.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);M=function(){return i.apply(void 0,arguments)}}}}function H(t){F(t.stack||t)}function z(t){return function(e){for(var i=t+" "+e+", please go to "+I+"#"+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=z("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];L(V.apply(void 0,[t].concat(i)))}var X=z("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];B(X.apply(void 0,[t].concat(i)))}var Y=z("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=z("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!!g.profiler&&g.profiler.isShowingStats()}function et(t){g.profiler&&(t?g.profiler.showStats():g.profiler.hideStats())}t("DebugMode",q),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||t("DebugMode",q={}));var it,nt,rt,st,at,ot=Object.freeze({__proto__:null,log:L,warn:B,error:F,assert:U,debug:k,_resetDebugSetting:G,_throw:H,logID:W,warnID:j,errorID:K,assertID:Z,get DebugMode(){return q},getError:J,isDisplayStats:$,setDisplayStats:et}),ht=10;t("replaceProperty",it),t("removeProperty",nt),t("markAsWarning",rt);var ut=0,ct=new Map;st=function(t,e,i,n,r,s,a){var o=ct.get(s);o&&o.logTimes>o.count&&(r("'%s' is deprecated, please use '%s' instead. "+a,t+"."+e,i+"."+n),o.count++)},t("replaceProperty",it=function(t,e,i){null!=t&&i.forEach((function(i){var n=ut++;ct.set(n,{id:n,count:0,logTimes:void 0!==i.logTimes?i.logTimes:ht});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,h=i.suggest?"("+i.suggest+")":"";if(null!=i.customFunction)t[i.name]=function(){var t;return st(e,i.name,a,s,B,n,h),(t=i.customFunction).call.apply(t,[this].concat(Array.prototype.slice.call(arguments)))};else if(null!=i.customSetter||null!=i.customGetter){var u=null!=i.customSetter,c=null!=i.customGetter;u&&c?Object.defineProperty(t,i.name,{get:function(){return st(e,i.name,a,s,B,n,h),i.customGetter.call(this)},set:function(t){st(e,i.name,a,s,B,n,h),i.customSetter.call(this,t)},enumerable:!1}):u?Object.defineProperty(t,i.name,{set:function(t){st(e,i.name,a,s,B,n,h),i.customSetter.call(this,t)},enumerable:!1}):c&&Object.defineProperty(t,i.name,{get:function(){return st(e,i.name,a,s,B,n,h),i.customGetter.call(this)},enumerable:!1})}else Object.defineProperty(t,i.name,{get:function(){return st(e,i.name,a,s,B,n,h),o?this[s]:r[s]},set:function(t){st(e,i.name,a,s,B,n,h),o?this[s]=t:r[s]=t},enumerable:!1})}))}),at=function(t,e,i,n,r){var s=ct.get(n);s&&s.logTimes>s.count&&(i("'%s' has been removed. "+r,t+"."+e),s.count++)},t("removeProperty",nt=function(t,e,i){null!=t&&i.forEach((function(i){var n=ut++;ct.set(n,{id:n,count:0,logTimes:void 0!==i.logTimes?i.logTimes:ht});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})}))}),t("markAsWarning",rt=function(){});var lt,_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.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).toString()},t}();pt.global=new pt("global");var mt=new pt("TmpCId."),gt="undefined"==typeof Symbol?"__aliases__":Symbol("[[Aliases]]"),vt="__cid__";function yt(t){return"number"==typeof t||t instanceof Number}function Et(t){return"string"==typeof t||t instanceof String}function Tt(t){for(var e in t)return!1;return!0}var St,At=(St={value:void 0,enumerable:!1,writable:!1,configurable:!0},function(t,e,i,n,r){St.value=i,St.writable=n,St.enumerable=r,Object.defineProperty(t,e,St),St.value=void 0}),Rt=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&&(console.log("Set `setter` to boolean is deprecated. Please don not use like this again."),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}}(),Ct=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}}(),bt=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 It(t){var e=Object.create(null);return t&&(e["."]=1,e["/"]=1,delete e["."],delete e["/"]),e}function wt(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?wt(t.constructor):""}function Ot(t,e,i,n){var r=/([^.]+)$/,s=r.exec(e)[0],a=r.exec(i)[0];function o(){return this[a]}n?Rt(t,s,o,(function(t){this[a]=t})):Ct(t,s,o)}function xt(t,e,i,n){for(var r in i)Ot(t,e+"."+r,i[r],n)}var Nt=/(%d)|(%s)/,Dt=/%s/;function Mt(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&&Nt.test(t);if(r)for(var s,a=f(i);!(s=a()).done;){var o=s.value,h="number"==typeof o?Nt:Dt;if(h.test(t)){var u=""+o;t=t.replace(h,u)}else t+=" "+o}else for(var c,l=f(i);!(c=l()).done;){var _=c.value;t+=" "+_}return t}function Pt(){for(var t=arguments.length-1,e=new Array(t),i=0;i<t;++i)e[i]=arguments[i+1];return e}function Lt(t,e){for(;t;){var i=Object.getOwnPropertyDescriptor(t,e);if(i)return i;t=Object.getPrototypeOf(t)}return null}function Bt(t,e,i){var n=Lt(e,t);n&&Object.defineProperty(i,t,n)}function Ft(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||Bt(o,a,t)}}return t}function Ut(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)Bt(o,a,t)}}return t}function kt(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 Gt(t){var e=t.prototype,i=e&&Object.getPrototypeOf(e);return i&&i.constructor}function Ht(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=Gt(t)))return!1;if(t===e)return!0}}return!1}function zt(t){for(var e=0,i=Object.keys(t);e<i.length;e++)delete t[i[e]]}var Vt=It(!0),Wt=It(!0);function Xt(t,e,i){return function(n,r){if(r.prototype.hasOwnProperty(t)&&delete e[r.prototype[t]],At(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=Xt("__cid__",Vt,!1),Yt=Xt("__classname__",Wt,!0);function Kt(t,e){if(Yt(t,e),!e.prototype.hasOwnProperty(vt)){var i=t||mt.getNewId();i&&jt(i,e)}}function qt(t,e){var i=Wt[e],n=Vt[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[gt];s||(s=[],t[gt]=s),s.push(e),Wt[e]=t,Vt[e]=t}}function Qt(){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 Vt[o];var h=a.__classname__;h&&delete Wt[h];var u=a[gt];if(u)for(var c=0;c<u.length;++c){var l=u[c];delete Wt[l],delete Vt[l]}}}function Zt(t){return Jt(t)}function Jt(t){return Vt[t]}function $t(t){return Wt[t]}function te(t,e){return ee(t,e)}function ee(t,e){if(e=void 0===e||e,"function"==typeof t&&t.prototype.hasOwnProperty(vt))return t.prototype.__cid__;if(t&&t.constructor){var i=t.constructor.prototype;if(i&&i.hasOwnProperty(vt))return t.__cid__}return""}var ie=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}(),ne=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)},n(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 re(t,e){t.splice(e,1)}function se(t,e){var i=t.length;e<0||e>=i||(t[e]=t[i-1],t.length=i-1)}function ae(t,e){var i=t.indexOf(e);return i>=0&&(re(t,i),!0)}function oe(t,e){var i=t.indexOf(e);i>=0&&(t[i]=t[t.length-1],--t.length)}var he=Object.freeze({__proto__:null,removeAt:re,fastRemoveAt:se,remove:ae,fastRemove:oe,removeIf:function(t,e){var i=t.findIndex(e);if(i>=0){var n=t[i];return re(t,i),n}},verifyType:function(t,e){if(t&&t.length>0)for(var i,n=f(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++)ae(t,e[i])},appendObjectsAt:function(t,e,i){return t.splice.apply(t,[i,0].concat(e)),t},contains:function(t,e){return t.indexOf(e)>=0},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:ne}),ue={IDGenerator:pt,Pool:ie,array:he,isNumber:yt,isString:Et,isEmptyObject:Tt,getPropertyDescriptor:Lt,addon:Ft,mixin:Ut,extend:kt,getSuper:Gt,isChildClassOf:Ht,clear:zt,value:At,getset:Rt,get:Ct,set:bt,unregisterClass:Qt,getClassName:wt,setClassName:Kt,setClassAlias:qt,getClassByName:$t,getClassById:Jt,get _registeredClassNames(){return r({},Wt)},set _registeredClassNames(t){zt(Wt),Object.assign(Wt,t)},get _registeredClassIds(){return r({},Vt)},set _registeredClassIds(t){zt(Vt),Object.assign(Vt,t)},_getClassId:te,getClassId:ee,_setClassId:jt,_getClassById:Zt,obsolete:Ot,obsoletes:xt,formatStr:Mt,shiftArguments:Pt,createMap:It};g.js=ue;var ce=Object.freeze({__proto__:null,array:he,js:ue,IDGenerator:pt,Pool:ie,isNumber:yt,isString:Et,isEmptyObject:Tt,value:At,getset:Rt,get:Ct,set:bt,createMap:It,getClassName:wt,obsolete:Ot,obsoletes:xt,formatStr:Mt,shiftArguments:Pt,getPropertyDescriptor:Lt,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)&&Bt(a,t,e)}},addon:Ft,mixin:Ut,extend:kt,getSuper:Gt,isChildClassOf:Ht,clear:zt,_idToClass:Vt,_nameToClass:Wt,_setClassId:jt,setClassName:Kt,setClassAlias:qt,unregisterClass:Qt,_getClassById:Zt,getClassById:Jt,getClassByName:$t,_getClassId:te,getClassId:ee});function le(t){if("__bitmask__"in t)return t;At(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&&At(t,a,r)}return t}function _e(t,e){e>=0&&t.length,t.length}function fe(t){return"__enums__"in t?t:(At(t,"__enums__",null,!0),fe.update(t))}function de(t){t.hasOwnProperty("__enums__")}function pe(t){de(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 me(t){"__enums__"in t||At(t,"__enums__",null,!0)}t("js",ce),le.isBitMask=function(t){return t&&t.hasOwnProperty("__bitmask__")},le.getList=function(t){return t.__bitmask__?t.__bitmask__:le.update(t)},le.update=function(t){Array.isArray(t.__bitmask__)||(t.__bitmask__=[]);var e=t.__bitmask__;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})),e},g.BitMask=le,fe.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&&At(t,a,r)}return Array.isArray(t.__enums__)&&pe(t),t},fe||t("Enum",fe={}),fe.isEnum=function(t){return t&&t.hasOwnProperty("__enums__")},fe.getList=function(t){return de(t),t.__enums__?t.__enums__:pe(t)},fe.sortList=function(t,e){de(t),Array.isArray(t.__enums__)&&t.__enums__.sort(e)},g.Enum=fe;var ge,ve=t("ValueType",function(){function t(){}var e=t.prototype;return e.clone=function(){return K(100,wt(this)+".clone"),this},e.equals=function(){return!1},e.set=function(){K(100,wt(this)+".set")},e.toString=function(){return""},t}());Kt("cc.ValueType",ve),g.ValueType=ve,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",t.XR="xr"}(ge||(ge={}));var ye=t("Settings",function(){function t(){this._settings={},this._override={}}var i=t.prototype;return i.init=function(t,i){var n=this;for(var r in void 0===t&&(t=""),void 0===i&&(i={}),i){var s=i[r];if(s)for(var a in s)this.overrideSettings(r,a,s[a])}return t?window.oh?new Promise((function(t,i){e.import("../settings.js").then((function(e){n._settings=e.default,t()})).catch((function(t){return i(t)}))})):new Promise((function(e,i){if(t.startsWith("http")){var r=new XMLHttpRequest;r.open("GET",t),r.responseType="text",r.onload=function(){n._settings=JSON.parse(r.response),e()},r.onerror=function(){i(new Error("request settings failed!"))},r.send(null)}else{var s=fsUtils.readJsonSync(t);s instanceof Error?i(s):(n._settings=s,e())}})):Promise.resolve()},i.overrideSettings=function(t,e,i){t in this._override||(this._override[t]={}),this._override[t][e]=i},i.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}());ye.Category=ge;var Ee=t("settings",new ye);g.settings=Ee;var Te=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_FLOAT_OUTPUT:!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(){this.CLEANUP_IMAGE_CACHE=!0;var t=Ee.querySettings(ye.Category.ENGINE,"macros");if(t)for(var e in t)Te[e]=t[e]}});g.macro=Te;for(var Se=/^(?:cc|dragonBones|sp|ccsg)\..+/,Ae=new Array(123),Re=0;Re<123;++Re)Ae[Re]=64;for(var Ce=0;Ce<64;++Ce)Ae["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charCodeAt(Ce)]=Ce;var be=Ae;function Ie(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];Rt(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 h=i[r];n(s,r,h[0],h[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 Oe(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 xe(t){return"object"==typeof window&&"function"==typeof Node?t instanceof Node:!!t&&"object"==typeof t&&"number"==typeof t.nodeType&&"string"==typeof t.nodeName}function Ne(t,e,i){t&&function(t,e){for(var i,n=arguments.length,r=new Array(n>2?n-2:0),s=2;s<n;s++)r[s-2]=arguments[s];var a=performance.now(),o=requestAnimationFrame||window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame;if(void 0===o||null!==(i=globalThis.__globalXR)&&void 0!==i&&i.isWebXR)return setTimeout.apply(void 0,[t,e].concat(r));var h=function i(){performance.now()-a<e?o(i):t.apply(void 0,r)};o(h)}((function(){t(e,i)}),0)}function De(t){return!(!t||t.constructor!==Object)&&Tt(t)}function Me(t,e,i){if(e>i){var n=e;e=i,i=n}return t<e?e:t<i?t:i}function Pe(t){return t*Te.RAD}function Le(t){return t*Te.DEG}g.misc={BUILTIN_CLASSID_RE:Se,BASE64_VALUES:be,propertyDefine:Ie,pushToMap:we,contains:Oe,isDomNode:xe,callInNextTick:Ne,isPlainEmptyObj_DEV:De,clampf:Me,degreesToRadians:Pe,radiansToDegrees:Le},t("misc",Object.freeze({__proto__:null,BUILTIN_CLASSID_RE:Se,BASE64_VALUES:be,propertyDefine:Ie,pushToMap:we,contains:Oe,isDomNode:xe,callInNextTick:Ne,tryCatchFunctor_EDITOR:function(t){return Function("target","try {\n target."+t+"();\n}\ncatch (e) {\n cc._throw(e);\n}")},isPlainEmptyObj_DEV:De,clampf:Me,degreesToRadians:Pe,radiansToDegrees:Le}));var Be="$_$";function Fe(t,e){var i=e?Object.create(e):{};return At(t,"__attrs__",i),i}function Ue(t){if("function"!=typeof t)return Fe(t,Ge(t.constructor));for(var e,i=g.Class.getInheritanceChain(t),n=i.length-1;n>=0;n--){var r=i[n];r.hasOwnProperty("__attrs__")&&r.__attrs__||Fe(r,(e=i[n+1])&&e.__attrs__)}return Fe(t,(e=i[0])&&e.__attrs__),t.__attrs__}function ke(t,e){var i=Ge(t),n=e+Be,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__||Ue(t)}function He(t,e,i,n){Ge(t)[e+Be+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}(),Ve=t("CCInteger",new ze("Integer",0));g.Integer=Ve,g.CCInteger=Ve;var We=t("CCFloat",new ze("Float",0));g.Float=We,g.CCFloat=We;var Xe=t("CCBoolean",new ze("Boolean",!1));g.Boolean=Xe,g.CCBoolean=Xe;var je=t("CCString",new ze("String",""));function Ye(t,e){return function(i,n){var r='"'+wt(i)+"."+n+'"',s=ke(i,n),a=s.type;if(a===Ve||a===We?a="Number":a!==je&&a!==Xe||(a=""+a),a===t){if(s.hasOwnProperty("default")){var o=s.default;if(void 0!==o&&!Array.isArray(o)&&!De(o)){var h=typeof o,u=t.toLowerCase();if(h===u)if("object"===u){if(!o||o instanceof s.ctor)return;j(3605,r,wt(s.ctor))}else"Number"!==t&&j(3606,e,r,t);else{if("function"===h)return;t===je.default&&null==o?j(3607,r):j(3611,e,r,h)}delete s.type}}}else j(3604,r)}}g.String=je,g.CCString=je;var Ke=Object.freeze({__proto__:null,DELIMETER:Be,createAttrsSingle:Fe,createAttrs:Ue,attr:ke,getClassAttrs:Ge,setClassAttr:He,PrimitiveType:ze,CCInteger:Ve,CCFloat:We,CCBoolean:Xe,CCString:je,getTypeChecker_ET:Ye,getObjTypeChecker_ET:function(t){return function(e,i){Ye("Object","type")(e,i);var n=Ge(e)[i+Be+"default"],r=g.Class.getDefault(n);if(!Array.isArray(r)&&Ht(t,g.ValueType)){var s=wt(t),a=Mt('No need to specify the "type" of "%s.%s" because %s is a child class of ValueType.',wt(e),i,s);n?L(a):j(3612,a,s,wt(e),i,s)}}}}),qe={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,qe){var o=qe[a];t.hasOwnProperty(a)&&(s[a]=t[a],o.canUsedInGet||delete t[a])}}}function Ze(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=g.String:e===Boolean?t.type=g.Boolean:e===Number&&(t.type=g.Float))}function Je(t,e,i){var n=t||void 0===e?{_short:!0}:{_short:!0,default:e};return i&&(n.type=i),n}function $e(t,e){if(!t||t.constructor!==Object){if(Array.isArray(t)&&t.length>0)return Je(e,[],t);if("function"==typeof t){var i=t;return Je(e,Ht(i,g.ValueType)?new i:null,i)}return t instanceof ze?Je(e,void 0,t):Je(e,t)}return null}var ti,ei=[];function ii(){return ei[ei.length-1]}g._RF={push:function(t,e,i,n){void 0===i&&(i=e,e=""),ei.push({uuid:e,script:i,module:t,exports:t.exports,beh:null,importMeta:n})},pop:function(){var t=ei.pop(),e=t.module,i=e.exports;if(i===t.exports){for(var n in i)return;e.exports=i=t.cls}},peek:ii},function(t){t[t.STANDALONE=1]="STANDALONE",t[t.IMPLICIT_VISIBLE=2]="IMPLICIT_VISIBLE",t[t.IMPLICIT_SERIALIZABLE=4]="IMPLICIT_SERIALIZABLE"}(ti||(ti={}));var ni=Be,ri="__ctors__",si=t("ENUM_TAG","Enum"),ai=t("BITMASK_TAG","BitMask");function oi(t,e,i,n){!function(t,e){!function(t,e){t.indexOf(e)<0&&t.push(e)}(t.__props__,e)}(t,i),fi(t,n,e,i)}function hi(t,e,i,n){var r=n.get;n.set,r&&(fi(t,n,e,i),He(t,i,"serializable",!1))}function ui(t){return"function"==typeof t?t():t}function ci(t){var e=t.name,i=t.extends,n=function(t,e,i){var n=g.Component,r=ii();if(r&&Ht(e,n)){if(Ht(r.cls,n))return K(3615),null;t=t||r.script}var s=function(t,e,i){var n=i.ctor;return At(n,ri,!0,!0),n.prototype,e&&(n.$super=e),Kt(t,n),n}(t,e,i);if(r)if(Ht(e,n)){var a=r.uuid;a&&jt(a,s),r.cls=s}else Ht(r.cls,n)||(r.cls=s);return s}(e,i,t);e||(e=g.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=$e(n,!1);if(r&&(n=t[i]=r),n){var s=n.notify;s&&Qe(n,i,s,t),"type"in n&&Ze(n,n.type,e,i)}}}(i,e),i){var s=i[r];s.get||s.set?hi(t,e,r,s):oi(t,e,r,s)}var a=Ge(t);t.__values__=t.__props__.filter((function(t){return!1!==a[t+ni+"serializable"]}))}(n,e,t.properties,i);var r=t.editor;return r&&Ht(i,g.Component)&&g.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__")}ci._isCCClass=function(t){var e;return null==t||null===(e=t.hasOwnProperty)||void 0===e?void 0:e.call(t,ri)},ci.fastDefine=function(t,e,i){Kt(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+ni+"visible"]=!1,r[a+ni+"default"]=i[a]}},ci.Attr=Ke,ci.attr=ke,ci.isCCClassOrFastDefined=li,ci.getInheritanceChain=function(t){for(var e=[];t=Gt(t);)t!==Object&&e.push(t);return e};var _i={Integer:"Number",Float:"Number",Boolean:"Boolean",String:"String"};function fi(t,e,i,n){var r=null,s="";function a(){return s=n+ni,r=Ge(t)}"type"in e&&void 0===e.type&&j(3660,n,i);var o=e.type;o&&(_i[o]?(r||a())[s+"type"]=o:"Object"===o||("object"==typeof o?fe.isEnum(o)?((r||a())[s+"type"]=si,r[s+"enumList"]=fe.getList(o)):le.isBitMask(o)&&((r||a())[s+"type"]=ai,r[s+"bitmaskList"]=le.getList(o)):"function"==typeof o&&((r||a())[s+"type"]="Object",r[s+"ctor"]=o))),"default"in e&&((r||a())[s+"default"]=e.default);var h,u=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&ti.STANDALONE?h=!0===e.serializable||0!=(e.__internalFlags&ti.IMPLICIT_SERIALIZABLE):!1===e.serializable&&(h=!1),void 0!==h&&((r||a())[s+"serializable"]=h),u("formerlySerializedAs","string");var c=e.range;c&&Array.isArray(c)&&c.length>=2&&((r||a())[s+"min"]=c[0],r[s+"max"]=c[1],c.length>2&&(r[s+"step"]=c[2])),u("min","number"),u("max","number"),u("step","number")}ci.isArray=function(t){return t=ui(t),Array.isArray(t)},ci.getDefault=ui,ci.escapeForJS=function(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")},ci.IDENTIFIER_RE=/^[A-Za-z_$][0-9A-Za-z_$]*$/,ci.getNewValueTypeCode=!1,g.Class=ci;var di=Math.PI/180,pi=180/Math.PI,mi=t("HALF_PI",.5*Math.PI),gi=t("TWO_PI",2*Math.PI),vi=t("EPSILON",1e-6);function yi(t,e){return Math.abs(t-e)<=vi*Math.max(1,Math.abs(t),Math.abs(e))}function Ei(t,e,i){return i=i||vi,Math.abs(t-e)<=i}function Ti(t,e,i){if(e>i){var n=e;e=i,i=n}return t<e?e:t>i?i:t}function Si(t){return t<0?0:t>1?1:t}function Ai(t,e,i){return t+(e-t)*i}function Ri(t){return t*di}function Ci(t){return t*pi}var bi=t("random",Math.random);function Ii(t,e){return Math.random()*(e-t)+t}function wi(t,e){return Math.floor(Ii(t,e))}function Oi(t){return(t=(9301*t+49297)%233280)/233280}function xi(t,e,i){return Oi(t)*(i-e)+e}function Ni(t,e,i){return Math.floor(xi(t,e,i))}function Di(t){return A(t)}function Mi(t,e){return t-Math.floor(t/e)*e}function Pi(t,e){return t=Mi(t,2*e),e-Math.abs(t-e)}function Li(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 Fi(t,e){return Math.abs(t)>Math.abs(e)?t:e}function Ui(t,e){e.forEach((function(e){Object.defineProperty(t,e,{enumerable:!0})}))}var ki=t("Vec4",function(t){function e(e,i,n,r){var s;return s=t.call(this)||this,"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}s(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.fromColor=function(t,e){return t.x=e.r,t.y=e.g,t.z=e.b,t.w=e.a,t},e.angle=function(t,e){var i=t.y*e.z-t.z*e.y,n=t.z*e.x-t.x*e.z,r=t.x*e.y-t.y*e.x,s=t.x*e.x+t.y*e.y+t.z*e.z;return Math.atan2(Math.sqrt(i*i+n*n+r*r),s)},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)<vi?t.x=0:t.x=1/i,Math.abs(n)<vi?t.y=0:t.y=1/n,Math.abs(r)<vi?t.z=0:t.z=1/r,Math.abs(s)<vi?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.x=0,t.y=0,t.z=0,t.w=0),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.scale=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.random=function(t,e){e=e||1;var i=2*bi()*Math.PI,n=2*bi()-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,h=i.z,u=i.w,c=u*n+o*s-h*r,l=u*r+h*n-a*s,_=u*s+a*r-o*n,f=-a*n-o*r-h*s;return t.x=c*u+f*-a+l*-h-_*-o,t.y=l*u+f*-o+_*-a-c*-h,t.z=_*u+f*-h+c*-o-l*-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=vi),!(Math.abs(t.x)===1/0||Math.abs(t.y)===1/0||Math.abs(t.z)===1/0||Math.abs(t.w)===1/0||Math.abs(e.x)===1/0||Math.abs(e.y)===1/0||Math.abs(e.z)===1/0||Math.abs(e.w)===1/0)&&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"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=vi),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=vi),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=Ti(this.x,t.x,e.x),this.y=Ti(this.y,t.y,e.y),this.z=Ti(this.z,t.z,e.z),this.w=Ti(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.scale=function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,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}(ve));function Gi(t,e,i,n){return new ki(t,e,i,n)}ki.ZERO=Object.freeze(new ki(0,0,0,0)),ki.ONE=Object.freeze(new ki(1,1,1,1)),ki.NEG_ONE=Object.freeze(new ki(-1,-1,-1,-1)),ki.UNIT_X=Object.freeze(new ki(1,0,0,0)),ki.UNIT_Y=Object.freeze(new ki(0,1,0,0)),ki.UNIT_Z=Object.freeze(new ki(0,0,1,0)),ki.UNIT_W=Object.freeze(new ki(0,0,0,1)),ci.fastDefine("cc.Vec4",ki,{x:0,y:0,z:0,w:0}),g.Vec4=ki,g.v4=Gi;var Hi,zi,Vi,Wi=t("Vec3",function(t){function e(e,i,n){var r;return r=t.call(this)||this,"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}s(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)<vi?t.x=0:t.x=1/i,Math.abs(n)<vi?t.y=0:t.y=1/n,Math.abs(r)<vi?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.x=0,t.y=0,t.z=0),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,h=i.z;return t.x=r*h-s*o,t.y=s*a-n*h,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*bi()*Math.PI,n=2*bi()-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?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?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,h=i.w*s+i.y*o-i.z*a,u=i.w*a+i.z*s-i.x*o,c=i.w*o+i.x*a-i.y*s,l=-i.x*s-i.y*a-i.z*o;return t.x=h*i.w+l*-i.x+u*-i.z-c*-i.y+n.x,t.y=u*i.w+l*-i.y+c*-i.x-h*-i.z+n.y,t.z=c*i.w+l*-i.z+h*-i.y-u*-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,h=i.w*s-i.y*o+i.z*a,u=i.w*a-i.z*s+i.x*o,c=i.w*o-i.x*a+i.y*s,l=i.x*s+i.y*a+i.z*o;return t.x=(h*i.w+l*i.x+u*i.z-c*i.y)/r.x,t.y=(u*i.w+l*i.y+c*i.x-h*i.z)/r.y,t.z=(c*i.w+l*i.z+h*i.y-u*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),h=Math.sin(n),u=r,c=s*o-a*h,l=s*h+a*o;return t.x=u+i.x,t.y=c+i.y,t.z=l+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),h=Math.sin(n),u=a*h+r*o,c=s,l=a*o-r*h;return t.x=u+i.x,t.y=c+i.y,t.z=l+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),h=Math.sin(n),u=r*o-s*h,c=r*h+s*o,l=a;return t.x=u+i.x,t.y=c+i.y,t.z=l+i.z,t},e.rotateN=function(t,e,i,n,r){var s=e.x-i.x,a=e.y-i.y,o=e.z-i.z,h=n.x,u=n.y,c=n.z,l=Math.cos(r),_=Math.sin(r),f=s*(h*h*(1-l)+l)+a*(h*u*(1-l)-h*_)+o*(h*c*(1-l)+u*_),d=s*(h*u*(1-l)+c*_)+a*(u*u*(1-l)+l)+o*(u*c*(1-l)-h*_),p=s*(h*c*(1-l)-u*_)+a*(u*c*(1-l)+h*_)+o*(c*c*(1-l)+l);return t.x=f+i.x,t.y=d+i.y,t.z=p+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=vi);var n=t.x,r=t.y,s=t.z,a=e.x,o=e.y,h=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-h)<=i*Math.max(1,Math.abs(s),Math.abs(h))},e.angle=function(t,e){var i=t.x*t.x+t.y*t.y+t.z*t.z,n=e.x*e.x+e.y*e.y+e.z*e.z;if(0===i||0===n)return 0;var r=(t.x*e.x+t.y*e.y+t.z*e.z)/Math.sqrt(i*n);return r=Ti(r,-1,1),Math.acos(r)},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)},e.moveTowards=function(t,e,i,n){var r=i.x-e.x,s=i.y-e.y,a=i.z-e.z,o=r*r+s*s+a*a;if(0===o||n>=0&&o<n*n)return t.x=i.x,t.y=i.y,t.z=i.z,t;var h=n/Math.sqrt(o);return t.x=e.x+r*h,t.y=e.y+s*h,t.z=e.z+a*h,t};var i=e.prototype;return i.clone=function(){return new e(this.x,this.y,this.z)},i.set=function(t,e,i){return"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=vi),Math.abs(this.x-t.x)<=e&&Math.abs(this.y-t.y)<=e&&Math.abs(this.z-t.z)<=e},i.equals3f=function(t,e,i,n){return void 0===n&&(n=vi),Math.abs(this.x-t)<=n&&Math.abs(this.y-e)<=n&&Math.abs(this.z-i)<=n},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=Ti(this.x,t.x,e.x),this.y=Ti(this.y,t.y,e.y),this.z=Ti(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}(ve));function Xi(t,e,i){return new Wi(t,e,i)}Wi.UNIT_X=Object.freeze(new Wi(1,0,0)),Wi.UNIT_Y=Object.freeze(new Wi(0,1,0)),Wi.UNIT_Z=Object.freeze(new Wi(0,0,1)),Wi.RIGHT=Object.freeze(new Wi(1,0,0)),Wi.UP=Object.freeze(new Wi(0,1,0)),Wi.FORWARD=Object.freeze(new Wi(0,0,-1)),Wi.ZERO=Object.freeze(new Wi(0,0,0)),Wi.ONE=Object.freeze(new Wi(1,1,1)),Wi.NEG_ONE=Object.freeze(new Wi(-1,-1,-1)),Wi.slerp=(Hi=new Wi,zi=new Wi,Vi=new Wi,function(t,e,i,n){var r=1e-5,s=Wi.len(e),a=Wi.len(i);if(s<r||a<r)return Wi.lerp(t,e,i,n);var o=Ai(s,a,n),h=Wi.dot(e,i)/(s*a);if(h>.99999)return Wi.lerp(t,e,i,n);if(h<-.99999){var u=Wi.multiplyScalar(Hi,e,1/s),c=function(t,e){var i=e.x,n=e.y,r=e.z,s=Math.abs(i),a=Math.abs(n),o=Math.abs(r);return s<a&&s<o?Wi.set(t,0,r,-n):a<o?Wi.set(t,r,0,-i):Wi.set(t,n,-i,0),Wi.normalize(t,t)}(zi,u),l=Math.PI*n;return Yi(Vi,u,c,l),Wi.multiplyScalar(t,Vi,o),t}var _=h,f=Math.acos(_)*n,d=Wi.multiplyScalar(Hi,e,1/s),p=Wi.multiplyScalar(zi,i,1/a);return Wi.scaleAndAdd(Vi,p,d,-_),Wi.normalize(Vi,Vi),Wi.multiplyScalar(Vi,Vi,Math.sin(f)),Wi.scaleAndAdd(Vi,Vi,d,Math.cos(f)),Wi.multiplyScalar(t,Vi,o),t}),ci.fastDefine("cc.Vec3",Wi,{x:0,y:0,z:0}),g.Vec3=Wi;var ji,Yi=(ji={x:0,y:0,z:0,w:0},function(t,e,i,n){var r=.5*n,s=Math.sin(r);return ji.x=s*i.x,ji.y=s*i.y,ji.z=s*i.z,ji.w=Math.cos(r),Wi.transformQuat(t,e,ji),t});g.v3=Xi;var Ki=1/255,qi=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}s(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 ki).x=t.r*Ki,e.y=t.g*Ki,e.z=t.b*Ki,e.w=t.a*Ki,e},e.fromVec4=function(t,i){return(i=void 0===i?new e:i).r=Math.floor(t.x/Ki),i.g=Math.floor(t.y/Ki),i.b=Math.floor(t.z/Ki),i.a=Math.floor(t.w/Ki),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.fromUint32=function(t,e){return t._val=e,t},e.toUint32=function(t){return t._val},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=vi),!(Math.abs(t.r)===1/0||Math.abs(t.g)===1/0||Math.abs(t.b)===1/0||Math.abs(t.a)===1/0)&&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*Ki).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,h=i*(1-e),u=i*(1-e*o),c=i*(1-e*(1-o));switch(a){default:case 0:n=i,r=c,s=h;break;case 1:n=u,r=i,s=h;break;case 2:n=h,r=i,s=c;break;case 3:n=h,r=u,s=i;break;case 4:n=c,r=h,s=i;break;case 5:n=i,r=h,s=u}}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*Ki,e=this.g*Ki,i=this.b*Ki,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},n(e,[{key:"r",get:function(){return 255&this._val},set:function(t){t=~~Ti(t,0,255),this._val=(4294967040&this._val|t)>>>0}},{key:"g",get:function(){return(65280&this._val)>>8},set:function(t){t=~~Ti(t,0,255),this._val=(4294902015&this._val|t<<8)>>>0}},{key:"b",get:function(){return(16711680&this._val)>>16},set:function(t){t=~~Ti(t,0,255),this._val=(4278255615&this._val|t<<16)>>>0}},{key:"a",get:function(){return(4278190080&this._val)>>>24},set:function(t){t=~~Ti(t,0,255),this._val=(16777215&this._val|t<<24)>>>0}},{key:"x",get:function(){return this.r*Ki},set:function(t){this.r=255*t}},{key:"y",get:function(){return this.g*Ki},set:function(t){this.g=255*t}},{key:"z",get:function(){return this.b*Ki},set:function(t){this.b=255*t}},{key:"w",get:function(){return this.a*Ki},set:function(t){this.a=255*t}}]),e}(ve));function Qi(t,e,i,n){return new qi(t,e,i,n)}function Zi(t){var e=t.clone();return e.x=Math.floor(t.x),e.y=Math.floor(t.y),e.z=Math.floor(t.z),e}qi.WHITE=Object.freeze(new qi(255,255,255,255)),qi.GRAY=Object.freeze(new qi(127,127,127,255)),qi.BLACK=Object.freeze(new qi(0,0,0,255)),qi.TRANSPARENT=Object.freeze(new qi(0,0,0,0)),qi.RED=Object.freeze(new qi(255,0,0,255)),qi.GREEN=Object.freeze(new qi(0,255,0,255)),qi.BLUE=Object.freeze(new qi(0,0,255,255)),qi.CYAN=Object.freeze(new qi(0,255,255,255)),qi.MAGENTA=Object.freeze(new qi(255,0,255,255)),qi.YELLOW=Object.freeze(new qi(255,255,0,255)),ci.fastDefine("cc.Color",qi,{r:0,g:0,b:0,a:255}),g.Color=qi,g.color=Qi;var Ji=t("Mat3",function(t){function e(e,i,n,r,s,a,o,h,u){var c;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===h&&(h=0),void 0===u&&(u=1),c=t.call(this)||this,"object"==typeof e?(c.m00=e.m00,c.m01=e.m01,c.m02=e.m02,c.m03=e.m03,c.m04=e.m04,c.m05=e.m05,c.m06=e.m06,c.m07=e.m07,c.m08=e.m08):(c.m00=e,c.m01=i,c.m02=n,c.m03=r,c.m04=s,c.m05=a,c.m06=o,c.m07=h,c.m08=u),c}s(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,h,u){return t.m00=e,t.m01=i,t.m02=n,t.m03=r,t.m04=s,t.m05=a,t.m06=o,t.m07=h,t.m08=u,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,h=e.m06,u=e.m07,c=e.m08,l=c*a-o*u,_=-c*s+o*h,f=u*s-a*h,d=i*l+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=l*d,t.m01=(-c*n+r*u)*d,t.m02=(o*n-r*a)*d,t.m03=_*d,t.m04=(c*i-r*h)*d,t.m05=(-o*i+r*s)*d,t.m06=f*d,t.m07=(-u*i+n*h)*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,h=t.m07,u=t.m08;return e*(u*s-a*h)+i*(-u*r+a*o)+n*(h*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,h=e.m05,u=e.m06,c=e.m07,l=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*u,t.m01=_*r+f*o+d*c,t.m02=_*s+f*h+d*l,t.m03=p*n+m*a+g*u,t.m04=p*r+m*o+g*c,t.m05=p*s+m*h+g*l,t.m06=v*n+y*a+E*u,t.m07=v*r+y*o+E*c,t.m08=v*s+y*h+E*l,t},e.multiplyMat4=function(t,e,i){var n=e.m00,r=e.m01,s=e.m02,a=e.m03,o=e.m04,h=e.m05,u=e.m06,c=e.m07,l=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*u,t.m01=_*r+f*o+d*c,t.m02=_*s+f*h+d*l,t.m03=p*n+m*a+g*u,t.m04=p*r+m*o+g*c,t.m05=p*s+m*h+g*l,t.m06=v*n+y*a+E*u,t.m07=v*r+y*o+E*c,t.m08=v*s+y*h+E*l,t},e.transform=function(t,e,i){this.translate(t,e,i)},e.translate=function(t,e,i){var n=e.m00,r=e.m01,s=e.m02,a=e.m03,o=e.m04,h=e.m05,u=e.m06,c=e.m07,l=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=h,t.m06=_*n+f*a+u,t.m07=_*r+f*o+c,t.m08=_*s+f*h+l,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,h=e.m05,u=e.m06,c=e.m07,l=e.m08,_=Math.sin(i),f=Math.cos(i);return t.m00=f*n+_*a,t.m01=f*r+_*o,t.m02=f*s+_*h,t.m03=f*a-_*n,t.m04=f*o-_*r,t.m05=f*h-_*s,t.m06=u,t.m07=c,t.m08=l,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 Wi.lengthSqr(i)<vi*vi?(e.identity(t),t):(n=n||Wi.UNIT_Y,Wi.normalize($i,Wi.cross($i,n,i)),Wi.lengthSqr($i)<vi*vi?(e.identity(t),t):(Wi.cross(tn,i,$i),e.set(t,$i.x,$i.y,$i.z,tn.x,tn.y,tn.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,h=r+r,u=i*a,c=n*a,l=n*o,_=r*a,f=r*o,d=r*h,p=s*a,m=s*o,g=s*h;return t.m00=1-l-d,t.m03=c-g,t.m06=_+m,t.m01=c+g,t.m04=1-u-d,t.m07=f-p,t.m02=_-m,t.m05=f+p,t.m08=1-u-l,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,h=e.m06,u=e.m07,c=e.m08,l=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*h-r*a,E=i*u-s*a,T=n*h-r*o,S=n*u-s*o,A=r*u-s*h,R=c*p-l*d,C=c*m-_*d,b=c*g-f*d,I=l*m-_*p,w=l*g-f*p,O=_*g-f*m,x=v*O-y*w+E*I+T*b-S*C+A*R;return x?(x=1/x,t.m00=(o*O-h*w+u*I)*x,t.m01=(h*b-a*O-u*C)*x,t.m02=(a*w-o*b+u*R)*x,t.m03=(r*w-n*O-s*I)*x,t.m04=(i*O-r*b+s*C)*x,t.m05=(n*b-i*w-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=vi),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))},e.toEuler=function(t,e){var i=t.m00,n=t.m01;t.m02;var r=t.m03,s=t.m04;t.m05;var a=t.m06,o=t.m07,h=t.m08;return o<.999?o>-.999?(e.x=Math.asin(-o),e.y=Math.atan2(a,h),e.z=Math.atan2(n,s),!0):(e.x=mi,e.y=Math.atan2(r,i),e.z=0,!1):(e.x=-mi,e.y=Math.atan2(-r,i),e.z=0,!1)};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,h){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===h&&(h=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=h),this},i.equals=function(t,e){return void 0===e&&(e=vi),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,h=this.m08,u=h*r-s*o,c=-h*n+s*a,l=o*n-r*a,_=t*u+e*c+i*l;return 0===_?(this.set(0,0,0,0,0,0,0,0,0),this):(_=1/_,this.m00=u*_,this.m01=(-h*e+i*o)*_,this.m02=(s*e-i*r)*_,this.m03=c*_,this.m04=(h*t-i*a)*_,this.m05=(-s*t+i*n)*_,this.m06=l*_,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,h=this.m08;return t*(h*r-s*o)+e*(-h*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,h=this.m07,u=this.m08,c=t.m00,l=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=c*e+l*r+_*o,this.m01=c*i+l*s+_*h,this.m02=c*n+l*a+_*u,this.m03=f*e+d*r+p*o,this.m04=f*i+d*s+p*h,this.m05=f*n+d*a+p*u,this.m06=m*e+g*r+v*o,this.m07=m*i+g*s+v*h,this.m08=m*n+g*a+v*u,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,h=this.m07,u=this.m08,c=Math.sin(t),l=Math.cos(t);return this.m00=l*e+c*r,this.m01=l*i+c*s,this.m02=l*n+c*a,this.m03=l*r-c*e,this.m04=l*s-c*i,this.m05=l*a-c*n,this.m06=o,this.m07=h,this.m08=u,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,h=e*s,u=i*s,c=i*a,l=n*s,_=n*a,f=n*o,d=r*s,p=r*a,m=r*o;return this.m00=1-c-f,this.m03=u-m,this.m06=l+p,this.m01=u+m,this.m04=1-h-f,this.m07=_-d,this.m02=l-p,this.m05=_+d,this.m08=1-h-c,this},e}(ve));Ji.IDENTITY=Object.freeze(new Ji);var $i=new Wi,tn=new Wi;ci.fastDefine("cc.Mat3",Ji,{m00:1,m01:0,m02:0,m03:0,m04:1,m05:0,m06:0,m07:0,m08:1}),g.Mat3=Ji;var en=t("Quat",function(t){function e(e,i,n,r){var s;return s=t.call(this)||this,"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}s(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=Wi.dot(i,n);return r<-.999999?(Wi.cross(sn,Wi.UNIT_X,i),sn.length()<1e-6&&Wi.cross(sn,Wi.UNIT_Y,i),Wi.normalize(sn,sn),e.fromAxisAngle(t,sn,Math.PI),t):r>.999999?(t.x=0,t.y=0,t.z=0,t.w=1,t):(Wi.cross(sn,i,n),t.x=sn.x,t.y=sn.y,t.z=sn.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,h=e.w;return t.x=s*r+h*n,t.y=a*r+o*n,t.z=o*r-a*n,t.w=h*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,h=e.w;return t.x=s*r-o*n,t.y=a*r+h*n,t.z=o*r+s*n,t.w=h*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,h=e.w;return t.x=s*r+a*n,t.y=a*r-s*n,t.z=o*r+h*n,t.w=h*r-o*n,t},e.rotateAround=function(t,i,n,r){return e.invert(nn,i),Wi.transformQuat(sn,n,nn),e.fromAxisAngle(nn,sn,r),e.multiply(t,i,nn),t},e.rotateAroundLocal=function(t,i,n,r){return e.fromAxisAngle(nn,n,r),e.multiply(t,i,nn),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,h=i.z,u=i.w,c=e.x*i.x+e.y*i.y+e.z*i.z+e.w*i.w;if(c<0&&(c=-c,a=-a,o=-o,h=-h,u=-u),1-c>1e-6){var l=Math.acos(c),_=Math.sin(l);r=Math.sin((1-n)*l)/_,s=Math.sin(n*l)/_}else r=1-n,s=n;return t.x=r*e.x+s*a,t.y=r*e.y+s*o,t.z=r*e.z+s*h,t.w=r*e.w+s*u,t},e.sqlerp=function(t,i,n,r,s,a){return e.slerp(nn,i,s,a),e.slerp(rn,n,r,a),e.slerp(t,nn,rn,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.x=0,t.y=0,t.z=0,t.w=0),t},e.fromAxes=function(t,i,n,r){return Ji.set(an,i.x,i.y,i.z,n.x,n.y,n.z,r.x,r.y,r.z),e.normalize(t,e.fromMat3(t,an))},e.fromViewUp=function(t,i,n){return Ji.fromViewUp(an,i,n),e.normalize(t,e.fromMat3(t,an))},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.m01,r=e.m02,s=e.m03,a=e.m04,o=e.m05,h=e.m06,u=e.m07,c=e.m08,l=i-a-c,_=a-i-c,f=c-i-a,d=0,p=i+a+c;l>p&&(p=l,d=1),_>p&&(p=_,d=2),f>p&&(p=f,d=3);var m=.5*Math.sqrt(p+1),g=.25/m;switch(d){case 0:t.w=m,t.x=(o-u)*g,t.y=(h-r)*g,t.z=(n-s)*g;break;case 1:t.w=(o-u)*g,t.x=m,t.y=(n+s)*g,t.z=(h+r)*g;break;case 2:t.w=(h-r)*g,t.x=(n+s)*g,t.y=m,t.z=(o+u)*g;break;case 3:t.w=(n-s)*g,t.x=(h+r)*g,t.y=(o+u)*g,t.z=m;break;default:t.w=1,t.x=0,t.y=0,t.z=0}return t},e.fromEuler=function(t,e,i,n){e*=on,i*=on,n*=on;var r=Math.sin(e),s=Math.cos(e),a=Math.sin(i),o=Math.cos(i),h=Math.sin(n),u=Math.cos(n);return t.x=r*o*u+s*a*h,t.y=s*a*u+r*o*h,t.z=s*o*h-r*a*u,t.w=s*o*u-r*a*h,t},e.fromAngleZ=function(t,e){return e*=on,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,h=0,u=0,c=n*r+s*a;if(c>.499999)o=0,h=Ci(2*Math.atan2(n,a)),u=90;else if(c<-.499999)o=0,h=-Ci(2*Math.atan2(n,a)),u=-90;else{var l=n*n,_=r*r,f=s*s;o=Ci(Math.atan2(2*n*a-2*r*s,1-2*l-2*f)),h=Ci(Math.atan2(2*r*a-2*n*s,1-2*_-2*f)),u=Ci(Math.asin(2*c)),i&&(o=-180*Math.sign(o+1e-6)+o,h=-180*Math.sign(h+1e-6)+h,u=180*Math.sign(u+1e-6)-u)}return t.x=o,t.y=h,t.z=u,t},e.toEulerInYXZOrder=function(t,e){Ji.fromQuat(an,e),Ji.toEuler(an,t),t.x=Ci(t.x),t.y=Ci(t.y),t.z=Ci(t.z)},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=vi),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))},e.angle=function(t,i){var n=Math.min(Math.abs(e.dot(t,i)),1);return 2*Math.acos(n)},e.rotateTowards=function(t,i,n,r){var s=e.angle(i,n);if(0===s)return t.x=n.x,t.y=n.y,t.z=n.z,t.w=n.w,t;var a=Math.min(r/Ci(s),1);return e.slerp(t,i,n,a)};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"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=vi),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}(ve));en.IDENTITY=Object.freeze(new en);var nn=new en,rn=new en,sn=new Wi,an=new Ji,on=.5*Math.PI/180;function hn(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 en(t,e,i,n)}ci.fastDefine("cc.Quat",en,{x:0,y:0,z:0,w:1}),g.Quat=en,g.quat=hn;var un=t("preTransforms",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])])),cn=t("Mat4",function(t){function e(e,i,n,r,s,a,o,h,u,c,l,_,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===h&&(h=0),void 0===u&&(u=0),void 0===c&&(c=0),void 0===l&&(l=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,"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=h,g.m08=u,g.m09=c,g.m10=l,g.m11=_,g.m12=f,g.m13=d,g.m14=p,g.m15=m),g}s(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,h,u,c,l,_,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=h,t.m08=u,t.m09=c,t.m10=l,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,h=e.m06,u=e.m07,c=e.m08,l=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*h-r*a,E=i*u-s*a,T=n*h-r*o,S=n*u-s*o,A=r*u-s*h,R=c*p-l*d,C=c*m-_*d,b=c*g-f*d,I=l*m-_*p,w=l*g-f*p,O=_*g-f*m,x=v*O-y*w+E*I+T*b-S*C+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-h*w+u*I)*x,t.m01=(r*w-n*O-s*I)*x,t.m02=(p*A-m*S+g*T)*x,t.m03=(_*S-l*A-f*T)*x,t.m04=(h*b-a*O-u*C)*x,t.m05=(i*O-r*b+s*C)*x,t.m06=(m*E-d*A-g*y)*x,t.m07=(c*A-_*E+f*y)*x,t.m08=(a*w-o*b+u*R)*x,t.m09=(n*b-i*w-s*R)*x,t.m10=(d*S-p*E+g*v)*x,t.m11=(l*E-c*S-f*v)*x,t.m12=(o*C-a*I-h*R)*x,t.m13=(i*I-n*C+r*R)*x,t.m14=(p*y-d*T-m*v)*x,t.m15=(c*T-l*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,h=t.m07,u=t.m08,c=t.m09,l=t.m10,_=t.m11,f=t.m12,d=t.m13,p=t.m14,m=t.m15;return(e*a-i*s)*(l*m-_*p)-(e*o-n*s)*(c*m-_*d)+(e*h-r*s)*(c*p-l*d)+(i*o-n*a)*(u*m-_*f)-(i*h-r*a)*(u*p-l*f)+(n*h-r*o)*(u*d-c*f)},e.multiply=function(t,e,i){var n=e.m00,r=e.m01,s=e.m02,a=e.m03,o=e.m04,h=e.m05,u=e.m06,c=e.m07,l=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*l+S*p,t.m01=y*r+E*h+T*_+S*m,t.m02=y*s+E*u+T*f+S*g,t.m03=y*a+E*c+T*d+S*v,y=i.m04,E=i.m05,T=i.m06,S=i.m07,t.m04=y*n+E*o+T*l+S*p,t.m05=y*r+E*h+T*_+S*m,t.m06=y*s+E*u+T*f+S*g,t.m07=y*a+E*c+T*d+S*v,y=i.m08,E=i.m09,T=i.m10,S=i.m11,t.m08=y*n+E*o+T*l+S*p,t.m09=y*r+E*h+T*_+S*m,t.m10=y*s+E*u+T*f+S*g,t.m11=y*a+E*c+T*d+S*v,y=i.m12,E=i.m13,T=i.m14,S=i.m15,t.m12=y*n+E*o+T*l+S*p,t.m13=y*r+E*h+T*_+S*m,t.m14=y*s+E*u+T*f+S*g,t.m15=y*a+E*c+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,h=e.m02,u=e.m03,c=e.m04,l=e.m05,_=e.m06,f=e.m07,d=e.m08,p=e.m09,m=e.m10,g=e.m11;t.m00=a,t.m01=o,t.m02=h,t.m03=u,t.m04=c,t.m05=l,t.m06=_,t.m07=f,t.m08=d,t.m09=p,t.m10=m,t.m11=g,t.m12=a*n+c*r+d*s+e.m12,t.m13=o*n+l*r+p*s+e.m13,t.m14=h*n+_*r+m*s+e.m14,t.m15=u*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=e.m12+i.x,t.m13=e.m13+i.y,t.m14=e.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)<vi)return null;r*=o=1/o,s*=o,a*=o;var h=Math.sin(i),u=Math.cos(i),c=1-u,l=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*c+u,R=s*r*c+a*h,C=a*r*c-s*h,b=r*s*c-a*h,I=s*s*c+u,w=a*s*c+r*h,O=r*a*c+s*h,x=s*a*c-r*h,N=a*a*c+u;return t.m00=l*A+p*R+y*C,t.m01=_*A+m*R+E*C,t.m02=f*A+g*R+T*C,t.m03=d*A+v*R+S*C,t.m04=l*b+p*I+y*w,t.m05=_*b+m*I+E*w,t.m06=f*b+g*I+T*w,t.m07=d*b+v*I+S*w,t.m08=l*O+p*x+y*N,t.m09=_*O+m*x+E*N,t.m10=f*O+g*x+T*N,t.m11=d*O+v*x+S*N,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,h=e.m07,u=e.m08,c=e.m09,l=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+u*n,t.m05=a*r+c*n,t.m06=o*r+l*n,t.m07=h*r+_*n,t.m08=u*r-s*n,t.m09=c*r-a*n,t.m10=l*r-o*n,t.m11=_*r-h*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,h=e.m03,u=e.m08,c=e.m09,l=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-u*n,t.m01=a*r-c*n,t.m02=o*r-l*n,t.m03=h*r-_*n,t.m08=s*n+u*r,t.m09=a*n+c*r,t.m10=o*n+l*r,t.m11=h*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,h=e.m03,u=e.m04,c=e.m05,l=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+u*n,t.m01=a*r+c*n,t.m02=o*r+l*n,t.m03=h*r+_*n,t.m04=u*r-s*n,t.m05=c*r-a*n,t.m06=l*r-o*n,t.m07=_*r-h*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)<vi)return null;n*=a=1/a,r*=a,s*=a;var o=Math.sin(e),h=Math.cos(e),u=1-h;return t.m00=n*n*u+h,t.m01=r*n*u+s*o,t.m02=s*n*u-r*o,t.m03=0,t.m04=n*r*u-s*o,t.m05=r*r*u+h,t.m06=s*r*u+n*o,t.m07=0,t.m08=n*s*u+r*o,t.m09=r*s*u-n*o,t.m10=s*s*u+h,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,h=r+r,u=s+s,c=n*o,l=n*h,_=n*u,f=r*h,d=r*u,p=s*u,m=a*o,g=a*h,v=a*u;return t.m00=1-(f+p),t.m01=l+v,t.m02=_-g,t.m03=0,t.m04=l-v,t.m05=1-(c+p),t.m06=d+m,t.m07=0,t.m08=_+g,t.m09=d-m,t.m10=1-(c+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=_n.m00=e.m00,n=_n.m01=e.m01,r=_n.m02=e.m02,s=_n.m03=e.m04,a=_n.m04=e.m05,o=_n.m05=e.m06,h=_n.m06=e.m08,u=_n.m07=e.m09,c=_n.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(h*h+u*u+c*c),Ji.determinant(_n)<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){var r=Wi.set(ln,t.m00,t.m01,t.m02).length(),s=Wi.set(ln,t.m04,t.m05,t.m06).length(),a=Wi.set(ln,t.m08,t.m09,t.m10).length();_n.m00=t.m00/r,_n.m01=t.m01/r,_n.m02=t.m02/r,_n.m03=t.m04/s,_n.m04=t.m05/s,_n.m05=t.m06/s,_n.m06=t.m08/a,_n.m07=t.m09/a,_n.m08=t.m10/a;var o=Ji.determinant(_n);n&&(Wi.set(n,r,s,a),o<0&&(n.x*=-1)),i&&Wi.set(i,t.m12,t.m13,t.m14),e&&(o<0&&(_n.m00*=-1,_n.m01*=-1,_n.m02*=-1),en.fromMat3(e,_n))},e.toSRT=function(t,e,i,n){var r=Wi.set(ln,t.m00,t.m01,t.m02).length(),s=Wi.set(ln,t.m04,t.m05,t.m06).length(),a=Wi.set(ln,t.m08,t.m09,t.m10).length();n&&(n.x=r,n.y=s,n.z=a),i&&Wi.set(i,t.m12,t.m13,t.m14),e&&(_n.m00=t.m00/r,_n.m01=t.m01/r,_n.m02=t.m02/r,_n.m03=t.m04/s,_n.m04=t.m05/s,_n.m05=t.m06/s,_n.m06=t.m08/a,_n.m07=t.m09/a,_n.m08=t.m10/a,Ji.determinant(_n)<0&&(n&&(n.x*=-1),_n.m00*=-1,_n.m01*=-1,_n.m02*=-1),en.fromMat3(e,_n))},e.toEuler=function(t,e){return Ji.set(_n,t.m00,t.m01,t.m02,t.m04,t.m05,t.m06,t.m08,t.m09,t.m10),Ji.toEuler(_n,e)},e.fromRTS=function(t,e,i,n){var r=e.x,s=e.y,a=e.z,o=e.w,h=r+r,u=s+s,c=a+a,l=r*h,_=r*u,f=r*c,d=s*u,p=s*c,m=a*c,g=o*h,v=o*u,y=o*c,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-(l+m))*T,t.m06=(p+g)*T,t.m07=0,t.m08=(f+v)*S,t.m09=(p-g)*S,t.m10=(1-(l+d))*S,t.m11=0,t.m12=i.x,t.m13=i.y,t.m14=i.z,t.m15=1,t},e.fromSRT=function(t,e,i,n){var r=e.x,s=e.y,a=e.z,o=e.w,h=r+r,u=s+s,c=a+a,l=r*h,_=r*u,f=r*c,d=s*u,p=s*c,m=a*c,g=o*h,v=o*u,y=o*c,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-(l+m))*T,t.m06=(p+g)*T,t.m07=0,t.m08=(f+v)*S,t.m09=(p-g)*S,t.m10=(1-(l+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,h=e.w,u=s+s,c=a+a,l=o+o,_=s*u,f=s*c,d=s*l,p=a*c,m=a*l,g=o*l,v=h*u,y=h*c,E=h*l,T=n.x,S=n.y,A=n.z,R=r.x,C=r.y,b=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*C+t.m08*b),t.m13=i.y+C-(t.m01*R+t.m05*C+t.m09*b),t.m14=i.z+b-(t.m02*R+t.m06*C+t.m10*b),t.m15=1,t},e.fromSRTOrigin=function(t,e,i,n,r){var s=e.x,a=e.y,o=e.z,h=e.w,u=s+s,c=a+a,l=o+o,_=s*u,f=s*c,d=s*l,p=a*c,m=a*l,g=o*l,v=h*u,y=h*c,E=h*l,T=n.x,S=n.y,A=n.z,R=r.x,C=r.y,b=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*C+t.m08*b),t.m13=i.y+C-(t.m01*R+t.m05*C+t.m09*b),t.m14=i.z+b-(t.m02*R+t.m06*C+t.m10*b),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,h=r+r,u=i*a,c=n*a,l=n*o,_=r*a,f=r*o,d=r*h,p=s*a,m=s*o,g=s*h;return t.m00=1-l-d,t.m01=c+g,t.m02=_-m,t.m03=0,t.m04=c-g,t.m05=1-u-d,t.m06=f+p,t.m07=0,t.m08=_+m,t.m09=f-p,t.m10=1-u-l,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),h=1/(r-n),u=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*h,t.m06=0,t.m07=0,t.m08=(i+e)*o,t.m09=(r+n)*h,t.m10=(a+s)*u,t.m11=-1,t.m12=0,t.m13=0,t.m14=a*s*2*u,t.m15=0,t},e.perspective=function(t,e,i,n,r,s,a,o,h){void 0===s&&(s=!0),void 0===a&&(a=-1),void 0===o&&(o=1),void 0===h&&(h=0);var u=1/Math.tan(e/2),c=1/(n-r),l=s?u/i:u,_=(s?u:u*i)*o,f=un[h];return t.m00=l*f[0],t.m01=l*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)*c,t.m11=-1,t.m12=0,t.m13=0,t.m14=r*n*c*(1-a),t.m15=0,t},e.ortho=function(t,e,i,n,r,s,a,o,h,u){void 0===o&&(o=-1),void 0===h&&(h=1),void 0===u&&(u=0);var c=1/(e-i),l=1/(n-r)*h,_=1/(s-a),f=-2*c,d=-2*l,p=(e+i)*c,m=(r+n)*l,g=un[u];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,h=n.y,u=n.z,c=r-i.x,l=s-i.y,_=a-i.z,f=1/Math.sqrt(c*c+l*l+_*_),d=h*(_*=f)-u*(l*=f),p=u*(c*=f)-o*_,m=o*l-h*c,g=l*(m*=f=1/Math.sqrt(d*d+p*p+m*m))-_*(p*=f),v=_*(d*=f)-c*m,y=c*p-l*d;return t.m00=d,t.m01=g,t.m02=c,t.m03=0,t.m04=p,t.m05=v,t.m06=l,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=-(c*r+l*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,h=e.m06,u=e.m07,c=e.m08,l=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*h-r*a,E=i*u-s*a,T=n*h-r*o,S=n*u-s*o,A=r*u-s*h,R=c*p-l*d,C=c*m-_*d,b=c*g-f*d,I=l*m-_*p,w=l*g-f*p,O=_*g-f*m,x=v*O-y*w+E*I+T*b-S*C+A*R;return x?(x=1/x,t.m00=(o*O-h*w+u*I)*x,t.m01=(h*b-a*O-u*C)*x,t.m02=(a*w-o*b+u*R)*x,t.m03=0,t.m04=(r*w-n*O-s*I)*x,t.m05=(i*O-r*b+s*C)*x,t.m06=(n*b-i*w-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=vi),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,h,u,c,l,_,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===h&&(h=0),void 0===u&&(u=0),void 0===c&&(c=1),void 0===l&&(l=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=h,this.m09=u,this.m10=c,this.m11=l,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=vi),!(Math.abs(this.m00)===1/0||Math.abs(this.m01)===1/0||Math.abs(this.m02)===1/0||Math.abs(this.m03)===1/0||Math.abs(this.m04)===1/0||Math.abs(this.m05)===1/0||Math.abs(this.m06)===1/0||Math.abs(this.m07)===1/0||Math.abs(this.m08)===1/0||Math.abs(this.m09)===1/0||Math.abs(this.m10)===1/0||Math.abs(this.m11)===1/0||Math.abs(this.m12)===1/0||Math.abs(this.m13)===1/0||Math.abs(this.m14)===1/0||Math.abs(this.m15)===1/0)&&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,h=this.m08,u=this.m09,c=this.m10,l=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=h*f-u*_,A=h*d-c*_,R=h*p-l*_,C=u*d-c*f,b=u*p-l*f,I=c*p-l*d,w=m*I-g*b+v*C+y*R-E*A+T*S;return 0===w?(this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),this):(w=1/w,this.m00=(s*I-a*b+o*C)*w,this.m01=(i*b-e*I-n*C)*w,this.m02=(f*T-d*E+p*y)*w,this.m03=(c*E-u*T-l*y)*w,this.m04=(a*R-r*I-o*A)*w,this.m05=(t*I-i*R+n*A)*w,this.m06=(d*v-_*T-p*g)*w,this.m07=(h*T-c*v+l*g)*w,this.m08=(r*b-s*R+o*S)*w,this.m09=(e*R-t*b-n*S)*w,this.m10=(_*E-f*v+p*m)*w,this.m11=(u*v-h*E-l*m)*w,this.m12=(s*A-r*C-a*S)*w,this.m13=(t*C-e*A+i*S)*w,this.m14=(f*g-_*y-d*m)*w,this.m15=(h*y-u*g+c*m)*w,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,h=this.m08,u=this.m09,c=this.m10,l=this.m11,_=this.m12,f=this.m13,d=this.m14,p=this.m15;return(t*s-e*r)*(c*p-l*d)-(t*a-i*r)*(u*p-l*f)+(t*o-n*r)*(u*d-c*f)+(e*a-i*s)*(h*p-l*_)-(e*o-n*s)*(h*d-c*_)+(i*o-n*a)*(h*f-u*_)},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,h=this.m07,u=this.m08,c=this.m09,l=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*u+E*f,this.m01=g*i+v*a+y*c+E*d,this.m02=g*n+v*o+y*l+E*p,this.m03=g*r+v*h+y*_+E*m,g=t.m04,v=t.m05,y=t.m06,E=t.m07,this.m04=g*e+v*s+y*u+E*f,this.m05=g*i+v*a+y*c+E*d,this.m06=g*n+v*o+y*l+E*p,this.m07=g*r+v*h+y*_+E*m,g=t.m08,v=t.m09,y=t.m10,E=t.m11,this.m08=g*e+v*s+y*u+E*f,this.m09=g*i+v*a+y*c+E*d,this.m10=g*n+v*o+y*l+E*p,this.m11=g*r+v*h+y*_+E*m,g=t.m12,v=t.m13,y=t.m14,E=t.m15,this.m12=g*e+v*s+y*u+E*f,this.m13=g*i+v*a+y*c+E*d,this.m14=g*n+v*o+y*l+E*p,this.m15=g*r+v*h+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.transform=function(t){var e=t.x,i=t.y,n=t.z,r=this.m00,s=this.m01,a=this.m02,o=this.m03,h=this.m04,u=this.m05,c=this.m06,l=this.m07,_=this.m08,f=this.m09,d=this.m10,p=this.m11;return this.m12=r*e+h*i+_*n+this.m12,this.m13=s*e+u*i+f*n+this.m13,this.m14=a*e+c*i+d*n+this.m14,this.m15=o*e+l*i+p*n+this.m15,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)<vi)return null;i*=s=1/s,n*=s,r*=s;var a=Math.sin(t),o=Math.cos(t),h=1-o,u=this.m00,c=this.m01,l=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*h+o,S=n*i*h+r*a,A=r*i*h-n*a,R=i*n*h-r*a,C=n*n*h+o,b=r*n*h+i*a,I=i*r*h+n*a,w=n*r*h-i*a,O=r*r*h+o;return this.m00=u*T+f*S+g*A,this.m01=c*T+d*S+v*A,this.m02=l*T+p*S+y*A,this.m03=_*T+m*S+E*A,this.m04=u*R+f*C+g*b,this.m05=c*R+d*C+v*b,this.m06=l*R+p*C+y*b,this.m07=_*R+m*C+E*b,this.m08=u*I+f*w+g*O,this.m09=c*I+d*w+v*O,this.m10=l*I+p*w+y*O,this.m11=_*I+m*w+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=_n.m00=this.m00,i=_n.m01=this.m01,n=_n.m02=this.m02,r=_n.m03=this.m04,s=_n.m04=this.m05,a=_n.m05=this.m06,o=_n.m06=this.m08,h=_n.m07=this.m09,u=_n.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+h*h+u*u),Ji.determinant(_n)<0&&(t.x*=-1),t},i.getRotation=function(t){var e=Wi.set(ln,this.m00,this.m01,this.m02).length(),i=Wi.set(ln,this.m04,this.m05,this.m06).length(),n=Wi.set(ln,this.m08,this.m09,this.m10).length();return _n.m00=this.m00/e,_n.m01=this.m01/e,_n.m02=this.m02/e,_n.m03=this.m04/i,_n.m04=this.m05/i,_n.m05=this.m06/i,_n.m06=this.m08/n,_n.m07=this.m09/n,_n.m08=this.m10/n,Ji.determinant(_n)<0&&(_n.m00*=-1,_n.m01*=-1,_n.m02*=-1),en.fromMat3(t,_n)},i.fromRTS=function(t,e,i){var n=t.x,r=t.y,s=t.z,a=t.w,o=n+n,h=r+r,u=s+s,c=n*o,l=n*h,_=n*u,f=r*h,d=r*u,p=s*u,m=a*o,g=a*h,v=a*u,y=i.x,E=i.y,T=i.z;return this.m00=(1-(f+p))*y,this.m01=(l+v)*y,this.m02=(_-g)*y,this.m03=0,this.m04=(l-v)*E,this.m05=(1-(c+p))*E,this.m06=(d+m)*E,this.m07=0,this.m08=(_+g)*T,this.m09=(d-m)*T,this.m10=(1-(c+f))*T,this.m11=0,this.m12=e.x,this.m13=e.y,this.m14=e.z,this.m15=1,this},i.fromSRT=function(t,e,i){var n=t.x,r=t.y,s=t.z,a=t.w,o=n+n,h=r+r,u=s+s,c=n*o,l=n*h,_=n*u,f=r*h,d=r*u,p=s*u,m=a*o,g=a*h,v=a*u,y=i.x,E=i.y,T=i.z;return this.m00=(1-(f+p))*y,this.m01=(l+v)*y,this.m02=(_-g)*y,this.m03=0,this.m04=(l-v)*E,this.m05=(1-(c+p))*E,this.m06=(d+m)*E,this.m07=0,this.m08=(_+g)*T,this.m09=(d-m)*T,this.m10=(1-(c+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,h=e*s,u=i*s,c=i*a,l=n*s,_=n*a,f=n*o,d=r*s,p=r*a,m=r*o;return this.m00=1-c-f,this.m01=u+m,this.m02=l-p,this.m03=0,this.m04=u-m,this.m05=1-h-f,this.m06=_+d,this.m07=0,this.m08=l+p,this.m09=_-d,this.m10=1-h-c,this.m11=0,this.m12=0,this.m13=0,this.m14=0,this.m15=1,this},e}(ve));cn.IDENTITY=Object.freeze(new cn);var ln=new Wi,_n=new Ji;function fn(t,e,i,n,r,s,a,o,h,u,c,l,_,f,d,p){return new cn(t,e,i,n,r,s,a,o,h,u,c,l,_,f,d,p)}ci.fastDefine("cc.Mat4",cn,{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}),g.Mat4=cn,g.mat4=fn;var dn,pn=t("Vec2",function(t){function e(e,i){var n;return n=t.call(this)||this,"object"==typeof e?(n.x=e.x,n.y=e.y):(n.x=e||0,n.y=i||0),n}s(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)<vi?t.x=0:t.x=1/i,Math.abs(n)<vi?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.x=0,t.y=0),t},e.dot=function(t,e){return t.x*e.x+t.y*e.y},e.cross=function(t,e,i){return t instanceof Wi?(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*bi()*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=vi),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,e){var i=t.x*t.x+t.y*t.y,n=e.x*e.x+e.y*e.y;if(0===i||0===n)return 0;var r=(t.x*e.x+t.y*e.y)/Math.sqrt(i*n);return r=Ti(r,-1,1),Math.acos(r)};var i=e.prototype;return i.clone=function(){return new e(this.x,this.y)},i.set=function(t,e){return"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=vi),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=vi),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=Ti(this.x,t.x,e.x),this.y=Ti(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 0;var n=this.dot(t)/Math.sqrt(e*i);return n=Ti(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}(ve));function mn(t,e){return new pn(t,e)}pn.ZERO=Object.freeze(new pn(0,0)),pn.ONE=Object.freeze(new pn(1,1)),pn.NEG_ONE=Object.freeze(new pn(-1,-1)),pn.UNIT_X=Object.freeze(new pn(1,0)),pn.UNIT_Y=Object.freeze(new pn(0,1)),ci.fastDefine("cc.Vec2",pn,{x:0,y:0}),g.Vec2=pn,g.v2=mn,it(pn,"Vec2",[{name:"sub",newName:"subtract",target:pn,targetName:"Vec2"},{name:"mul",newName:"multiply",target:pn,targetName:"Vec2"},{name:"div",newName:"divide",target:pn,targetName:"Vec2"},{name:"dist",newName:"distance",target:pn,targetName:"Vec2"},{name:"sqrDist",newName:"squaredDistance",target:pn,targetName:"Vec2"},{name:"mag",newName:"len",target:pn,targetName:"Vec2"},{name:"sqrMag",newName:"lengthSqr",target:pn,targetName:"Vec2"},{name:"scale",newName:"multiplyScalar",target:pn,targetName:"Vec2"},{name:"exactEquals",newName:"strictEquals",target:pn,targetName:"Vec2"}]),it(pn.prototype,"Vec2",[{name:"mag",newName:"length",target:pn.prototype,targetName:"Vec2"},{name:"magSqr",newName:"lengthSqr",target:pn.prototype,targetName:"Vec2"},{name:"scale",newName:"multiplyScalar",target:pn.prototype,targetName:"Vec2"},{name:"exactEquals",newName:"strictEquals",target:pn.prototype,targetName:"Vec2"}]),it(Wi,"Vec3",[{name:"sub",newName:"subtract",target:Wi,targetName:"Vec3"},{name:"mul",newName:"multiply",target:Wi,targetName:"Vec3"},{name:"div",newName:"divide",target:Wi,targetName:"Vec3"},{name:"dist",newName:"distance",target:Wi,targetName:"Vec3"},{name:"sqrDist",newName:"squaredDistance",target:Wi,targetName:"Vec3"},{name:"mag",newName:"len",target:Wi,targetName:"Vec3"},{name:"sqrMag",newName:"lengthSqr",target:Wi,targetName:"Vec3"},{name:"scale",newName:"multiplyScalar",target:Wi,targetName:"Vec3"},{name:"exactEquals",newName:"strictEquals",target:Wi,targetName:"Vec3"}]),it(Wi.prototype,"Vec3",[{name:"mag",newName:"length",target:Wi.prototype,targetName:"Vec3"},{name:"magSqr",newName:"lengthSqr",target:Wi.prototype,targetName:"Vec3"},{name:"scale",newName:"multiplyScalar",target:Wi.prototype,targetName:"Vec3"},{name:"exactEquals",newName:"strictEquals",target:Wi.prototype,targetName:"Vec3"}]),it(ki,"Vec4",[{name:"sub",newName:"subtract",target:ki,targetName:"Vec4"},{name:"mul",newName:"multiply",target:ki,targetName:"Vec4"},{name:"div",newName:"divide",target:ki,targetName:"Vec4"},{name:"dist",newName:"distance",target:ki,targetName:"Vec4"},{name:"sqrDist",newName:"squaredDistance",target:ki,targetName:"Vec4"},{name:"mag",newName:"len",target:ki,targetName:"Vec4"},{name:"sqrMag",newName:"lengthSqr",target:ki,targetName:"Vec4"},{name:"scale",newName:"multiplyScalar",target:ki,targetName:"Vec4"},{name:"exactEquals",newName:"strictEquals",target:ki,targetName:"Vec4"}]),it(ki.prototype,"Vec4",[{name:"mag",newName:"length",target:ki.prototype,targetName:"Vec4"},{name:"magSqr",newName:"lengthSqr",target:ki.prototype,targetName:"Vec4"},{name:"scale",newName:"multiplyScalar",target:ki.prototype,targetName:"Vec4"},{name:"exactEquals",newName:"strictEquals",target:ki.prototype,targetName:"Vec4"}]),it(en,"Quat",[{name:"mag",newName:"len",target:en,targetName:"Quat"},{name:"mul",newName:"multiply",target:en,targetName:"Quat"},{name:"sqrMag",newName:"lengthSqr",target:en,targetName:"Quat"},{name:"scale",newName:"multiplyScalar",target:en,targetName:"Quat"},{name:"exactEquals",newName:"strictEquals",target:en,targetName:"Quat"}]),it(en.prototype,"Quat",[{name:"scale",newName:"multiplyScalar",target:en.prototype,targetName:"Quat"},{name:"exactEquals",newName:"strictEquals",target:en.prototype,targetName:"Quat"}]),it(qi,"Color",[{name:"sub",newName:"subtract",target:qi,targetName:"Color"},{name:"mul",newName:"multiply",target:qi,targetName:"Color"},{name:"div",newName:"divide",target:qi,targetName:"Color"},{name:"exactEquals",newName:"strictEquals",target:qi,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 g.Color.fromHEX(e[0],n)}}]),it(Ji,"Mat3",[{name:"sub",newName:"subtract",target:Ji,targetName:"Mat3"},{name:"mul",newName:"multiply",target:Ji,targetName:"Mat3"},{name:"exactEquals",newName:"strictEquals",target:Ji,targetName:"Mat3"},{name:"transfrom",newName:"transform",target:Ji,targetName:"Mat3"}]),it(Ji.prototype,"Mat3",[{name:"sub",newName:"subtract",target:Ji.prototype,targetName:"Mat3"},{name:"mul",newName:"multiply",target:Ji.prototype,targetName:"Mat3"},{name:"mulScalar",newName:"multiplyScalar",target:Ji.prototype,targetName:"Mat3"},{name:"exactEquals",newName:"strictEquals",target:Ji.prototype,targetName:"Mat3"}]),it(cn,"Mat4",[{name:"sub",newName:"subtract",target:cn,targetName:"Mat4"},{name:"mul",newName:"multiply",target:cn,targetName:"Mat4"},{name:"exactEquals",newName:"strictEquals",target:cn,targetName:"Mat4"}]),it(cn.prototype,"Mat4",[{name:"sub",newName:"subtract",target:cn.prototype,targetName:"Mat4"},{name:"mul",newName:"multiply",target:cn.prototype,targetName:"Mat4"},{name:"mulScalar",newName:"multiplyScalar",target:cn.prototype,targetName:"Mat4"},{name:"exactEquals",newName:"strictEquals",target:cn.prototype,targetName:"Mat4"}]),function(t){t[t.VEC2=0]="VEC2",t[t.VEC3=1]="VEC3",t[t.VEC4=2]="VEC4",t[t.QUATERNION=3]="QUATERNION",t[t.MAT3=4]="MAT3",t[t.MAT4=5]="MAT4",t[t.SIZE=6]="SIZE",t[t.RECT=7]="RECT",t[t.COLOR=8]="COLOR"}(dn||(dn={}));var gn=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,h=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+h*i.c+i.tx,t.ty=o*i.b+h*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,h=i.b*n+i.d*e.y+i.ty,u=i.a*e.x+i.c*r+i.tx,c=i.b*e.x+i.d*r+i.ty,l=i.a*n+i.c*r+i.tx,_=i.b*n+i.d*r+i.ty,f=Math.min(s,o,u,l),d=Math.max(s,o,u,l),p=Math.min(a,h,c,_),m=Math.max(a,h,c,_);t.x=f,t.y=p,t.width=d-f,t.height=m-p},t.transformObb=function(t,e,i,n,r,s,a){void 0===a&&(a=!0);var o=s.a*r.x+s.c*r.y+s.tx,h=s.b*r.x+s.d*r.y+s.ty,u=s.a*r.width,c=s.b*r.width,l=s.c*r.height,_=s.d*r.height;a?(e.x=o,e.y=h,i.x=u+o,i.y=c+h,t.x=l+o,t.y=_+h,n.x=u+l+o,n.y=c+_+h):(t.x=o,t.y=h,n.x=u+o,n.y=c+h,e.x=l+o,e.y=_+h,i.x=u+l+o,i.y=c+_+h)},t}());g.AffineTransform=gn;var vn=t("Size",function(t){function e(e,i){var n;return n=t.call(this)||this,"object"==typeof e?(n.width=e.width,n.height=e.height):(n.width=e||0,n.height=i||0),n}s(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},e.equals=function(t,e){return t.width===e.width&&t.height===e.height};var i=e.prototype;return i.clone=function(){return new e(this.width,this.height)},i.set=function(t,e){return"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)+")"},n(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}(ve));function yn(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),new vn(t,e)}vn.ZERO=Object.freeze(new vn(0,0)),vn.ONE=Object.freeze(new vn(1,1)),ci.fastDefine("cc.Size",vn,{width:0,height:0}),g.size=yn,g.Size=vn;var En=t("Rect",function(t){function e(e,i,n,r){var s;return s=t.call(this)||this,"object"==typeof e?(s.x=e.x,s.y=e.y,s.width=e.width,s.height=e.height):(s.x=e||0,s.y=i||0,s.width=n||0,s.height=r||0),s}s(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,h=i.y,u=i.x+i.width,c=i.y+i.height;return t.x=Math.max(n,o),t.y=Math.max(r,h),t.width=Math.min(s,u)-t.x,t.height=Math.min(a,c)-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,h=i.y,u=i.width,c=i.height;return t.x=Math.min(n,o),t.y=Math.min(r,h),t.width=Math.max(n+s,o+u)-t.x,t.height=Math.max(r+a,h+c)-t.y,t},e.equals=function(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height};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"object"==typeof t?(this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height):(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,h=t.m01*n+t.m05*i+t.m13,u=t.m00*e+t.m04*r+t.m12,c=t.m01*e+t.m05*r+t.m13,l=t.m00*n+t.m04*r+t.m12,_=t.m01*n+t.m05*r+t.m13,f=Math.min(s,o,u,l),d=Math.max(s,o,u,l),p=Math.min(a,h,c,_),m=Math.max(a,h,c,_);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,h=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*h+t.m12,i.y=t.m01*s+t.m05*h+t.m13,n.x=t.m00*o+t.m04*h+t.m12,n.y=t.m01*o+t.m05*h+t.m13},n(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 pn(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 pn(this.x,this.y)},set:function(t){this.x=t.x,this.y=t.y}},{key:"size",get:function(){return new vn(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}(ve));function Tn(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 En(t,e,i,n)}ci.fastDefine("cc.Rect",En,{x:0,y:0,width:0,height:0}),g.Rect=En,g.rect=Tn;var Sn=t("MATH_FLOAT_ARRAY",Float64Array),An=t("MathBase",function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.createFloatArray=function(t){return new Sn(t)},n(e,[{key:"array",get:function(){return this._array}}]),e}(ve)),Rn=Object.freeze({__proto__:null,bits:C,Vec2:pn,v2:mn,Vec3:Wi,v3:Xi,Vec4:ki,v4:Gi,Quat:en,quat:hn,Mat3:Ji,Mat4:cn,mat4:fn,AffineTransform:gn,Size:vn,size:yn,Rect:En,rect:Tn,Color:qi,color:Qi,preTransforms:un,HALF_PI:mi,TWO_PI:gi,EPSILON:vi,equals:yi,approx:Ei,clamp:Ti,clamp01:Si,lerp:Ai,toRadian:Ri,toDegree:Ci,random:bi,randomRange:Ii,randomRangeInt:wi,pseudoRandom:Oi,pseudoRandomRange:xi,pseudoRandomRangeInt:Ni,nextPow2:Di,repeat:Mi,pingPong:Pi,inverseLerp:Li,absMaxComponent:Bi,absMax:Fi,enumerableProps:Ui,MATH_FLOAT_ARRAY:Sn,MathBase:An});t("math",Rn);var Cn=new Wi,bn=new Wi,In=new Wi,wn=new Wi,On=new Wi,xn=new Wi,Nn=new Array(3),Dn=new Array(3);function Mn(t,e){return Wi.dot(e.n,t)-e.d}function Pn(t,e,i){return Wi.copy(t,e),Wi.subtract(On,i.center,i.halfExtents),Wi.add(xn,i.center,i.halfExtents),t.x=t.x<On.x?On.x:t.x,t.y=t.y<On.y?On.y:t.y,t.z=t.z<On.z?On.z:t.z,t.x=t.x>xn.x?xn.x:t.x,t.y=t.y>xn.y?xn.y:t.y,t.z=t.z>xn.z?xn.z:t.z,t}function Ln(t,e,i){Wi.set(Cn,i.orientation.m00,i.orientation.m01,i.orientation.m02),Wi.set(bn,i.orientation.m03,i.orientation.m04,i.orientation.m05),Wi.set(In,i.orientation.m06,i.orientation.m07,i.orientation.m08),Nn[0]=Cn,Nn[1]=bn,Nn[2]=In,Dn[0]=i.halfExtents.x,Dn[1]=i.halfExtents.y,Dn[2]=i.halfExtents.z,Wi.subtract(wn,e,i.center),Wi.set(t,i.center.x,i.center.y,i.center.z);for(var n=0;n<3;n++){var r=Wi.dot(wn,Nn[n]);r>Dn[n]&&(r=Dn[n]),r<-Dn[n]&&(r=-Dn[n]),t.x+=r*Nn[n].x,t.y+=r*Nn[n].y,t.z+=r*Nn[n].z}return t}var Bn=Object.freeze({__proto__:null,point_plane:Mn,pt_point_plane:function(t,e,i){var n=Mn(e,i);return Wi.subtract(t,e,Wi.multiplyScalar(t,i.n,n))},pt_point_aabb:Pn,pt_point_obb:Ln,pt_point_line:function(t,e,i,n){Wi.subtract(Cn,i,n);var r=Cn.clone(),s=Wi.lengthSqr(r);if(0===s)Wi.copy(t,i);else{Wi.subtract(Cn,e,i);var a=Wi.dot(Cn,r)/s;a<0?Wi.copy(t,i):a>1?Wi.copy(t,n):Wi.scaleAndAdd(t,i,r,a)}}}),Fn={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},Un=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=Fn.SHAPE_LINE,this.s=new Wi(t,e,i),this.e=new Wi(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 Wi.copy(t.s,e.s),Wi.copy(t.e,e.e),t},t.fromPoints=function(t,e,i){return Wi.copy(t.s,e),Wi.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 Wi.distance(t.s,t.e)},t.prototype.length=function(){return Wi.distance(this.s,this.e)},n(t,[{key:"type",get:function(){return this._type}}]),t}(),kn=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=Fn.SHAPE_RAY,this.o=new Wi(t,e,i),this.d=new Wi(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 Wi.copy(t.o,e.o),Wi.copy(t.d,e.d),t},t.fromPoints=function(t,e,i){return Wi.copy(t.o,e),Wi.normalize(t.d,Wi.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){Wi.normalize(t,this.d),Wi.scaleAndAdd(t,this.o,t,e)},n(t,[{key:"type",get:function(){return this._type}}]),t}(),Gn=new Wi,Hn=new Wi,zn=new Wi,Vn=new Wi;function Wn(t){return Math.max(Math.max(t.x,t.y),t.z)}var Xn,jn,Yn,Kn,qn,Qn=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 Wi(0,0,0),this._radius=0,this._type=void 0,this._type=Fn.SHAPE_SPHERE,this._center=new Wi(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 Wi.copy(t.center,e.center),t.radius=e.radius,t},t.fromPoints=function(t,e,i){return Wi.multiplyScalar(t.center,Wi.add(Gn,e,i),.5),t.radius=.5*Wi.subtract(Gn,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){Wi.set(t,this.center.x-this.radius,this.center.y-this.radius,this.center.z-this.radius),Wi.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){Wi.transformMat4(r.center,this.center,t),r.radius=this.radius*Wn(n)},e.translateAndRotate=function(t,e,i){Wi.transformMat4(i.center,this.center,t)},e.setScale=function(t,e){e.radius=this.radius*Wn(t)},e.mergePoint=function(t){this.radius<0&&(this.center.set(t),this.radius=0),Wi.subtract(Hn,t,this.center);var e=Hn.length();if(e>this.radius){var i=.5*(e-this.radius);this.radius+=i,Wi.multiplyScalar(Hn,Hn,i/e),Wi.add(this.center,this.center,Hn)}},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(zn,Vn),this.mergePoint(zn),this.mergePoint(Vn)},n(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}(),Zn=function(t,e){var i=Wi.dot(t.d,e.n);if(Math.abs(i)<Number.EPSILON)return 0;var n=-Mn(t.o,e)/i;return n<0?0:n},Jn=(Xn=new Wi(0,0,0),jn=new Wi(0,0,0),Yn=new Wi(0,0,0),Kn=new Wi(0,0,0),qn=new Wi(0,0,0),function(t,e,i){Wi.subtract(Xn,e.b,e.a),Wi.subtract(jn,e.c,e.a),Wi.cross(Yn,t.d,jn);var n=Wi.dot(Xn,Yn);if(n<Number.EPSILON&&(!i||n>-Number.EPSILON))return 0;var r=1/n;Wi.subtract(Kn,t.o,e.a);var s=Wi.dot(Kn,Yn)*r;if(s<0||s>1)return 0;Wi.cross(qn,Kn,Xn);var a=Wi.dot(t.d,qn)*r;if(a<0||s+a>1)return 0;var o=Wi.dot(jn,qn)*r;return o<0?0:o}),$n=function(){var t=new Wi(0,0,0);return function(e,i){var n=i.radius,r=i.center,s=e.o,a=e.d,o=n*n;Wi.subtract(t,r,s);var h=t.lengthSqr(),u=Wi.dot(t,a),c=o-(h-u*u);if(c<0)return 0;var l=Math.sqrt(c),_=h<o?u+l:u-l;return _<0?0:_}}(),tr=function(){var t=new Wi,e=new Wi;return function(i,n){return Wi.subtract(t,n.center,n.halfExtents),Wi.add(e,n.center,n.halfExtents),function(t,e,i){var n=t.o,r=t.d,s=1/r.x,a=1/r.y,o=1/r.z,h=(e.x-n.x)*s,u=(i.x-n.x)*s,c=(e.y-n.y)*a,l=(i.y-n.y)*a,_=(e.z-n.z)*o,f=(i.z-n.z)*o,d=Math.max(Math.max(Math.min(h,u),Math.min(c,l)),Math.min(_,f)),p=Math.min(Math.min(Math.max(h,u),Math.max(c,l)),Math.max(_,f));return p<0||d>p?0:d>0?d:p}(i,t,e)}}(),er=function(){var t=new Wi,e=new Wi,i=new Wi,n=new Wi,r=new Wi,s=new Wi,a=new Wi,o=new Array(3),h=new Array(3),u=new Array(3),c=new Array(6);return function(l,_){o[0]=_.halfExtents.x,o[1]=_.halfExtents.y,o[2]=_.halfExtents.z,t=_.center,e=l.o,i=l.d,Wi.set(n,_.orientation.m00,_.orientation.m01,_.orientation.m02),Wi.set(r,_.orientation.m03,_.orientation.m04,_.orientation.m05),Wi.set(s,_.orientation.m06,_.orientation.m07,_.orientation.m08),Wi.subtract(a,t,e),h[0]=Wi.dot(n,i),h[1]=Wi.dot(r,i),h[2]=Wi.dot(s,i),u[0]=Wi.dot(n,a),u[1]=Wi.dot(r,a),u[2]=Wi.dot(s,a);for(var f=0;f<3;++f){if(0===h[f]){if(-u[f]-o[f]>0||-u[f]+o[f]<0)return 0;h[f]=1e-7}c[2*f+0]=(u[f]+o[f])/h[f],c[2*f+1]=(u[f]-o[f])/h[f]}var d=Math.max(Math.max(Math.min(c[0],c[1]),Math.min(c[2],c[3])),Math.min(c[4],c[5])),p=Math.min(Math.min(Math.max(c[0],c[1]),Math.max(c[2],c[3])),Math.max(c[4],c[5]));return p<0||d>p?0:d>0?d:p}}(),ir=function(){var t=new Wi,e=new Wi,i=new Wi,n=new Wi,r=new Wi,s=new Wi,a=new Wi,o=new Qn;return function(h,u){var c=u.ellipseCenter0,l=u.ellipseCenter1,_=Wi.subtract(e,l,c);if(_.length()<vi)return o.radius=u.radius,o.center.set(u.ellipseCenter0),Gr.raySphere(h,o);var f=h.o,d=Wi.subtract(i,f,c),p=Wi.normalize(t,h.d),m=Wi.cross(n,p,_),g=m.lengthSqr();if(0===g){o.radius=u.radius;var v=Wi.subtract(r,l,f);return d.lengthSqr()<v.lengthSqr()?o.center.set(c):o.center.set(l),Gr.raySphere(h,o)}var y=Wi.cross(r,d,_),E=_.lengthSqr(),T=2*Wi.dot(m,y),S=u.radius*u.radius,A=T*T-4*g*(y.lengthSqr()-S*E);if(A<0)return 0;var R=(-T-Math.sqrt(A))/(2*g);if(R<0){o.radius=u.radius;var C=Wi.subtract(s,l,f);return d.lengthSqr()<C.lengthSqr()?o.center.set(u.ellipseCenter0):o.center.set(u.ellipseCenter1),Gr.raySphere(h,o)}var b=Wi.scaleAndAdd(s,h.o,p,R),I=Wi.subtract(a,b,c),w=Wi.dot(I,_)/E;return w>=0&&w<=1?R:w<0?(o.radius=u.radius,o.center.set(u.ellipseCenter0),Gr.raySphere(h,o)):w>1?(o.radius=u.radius,o.center.set(u.ellipseCenter1),Gr.raySphere(h,o)):0}}(),nr=function(){var t=new Wi(0,0,0);return function(e,i){Wi.subtract(t,e.e,e.s);var n=-Mn(e.s,i)/Wi.dot(t,i.n);return n<0||n>1?0:n}}(),rr=function(){var t=new Wi(0,0,0),e=new Wi(0,0,0),i=new Wi(0,0,0),n=new Wi(0,0,0),r=new Wi(0,0,0),s=new Wi(0,0,0);return function(a,o,h){Wi.subtract(t,o.b,o.a),Wi.subtract(e,o.c,o.a),Wi.subtract(i,a.s,a.e),Wi.cross(r,t,e);var u=Wi.dot(i,r);if(u<=0)return 0;Wi.subtract(n,a.s,o.a);var c=Wi.dot(n,r);if(c<0||c>u)return 0;Wi.cross(s,i,n);var l=Wi.dot(e,s);if(l<0||l>u)return 0;var _=-Wi.dot(t,s);if(_<0||l+_>u)return 0;if(h){var f=1/u,d=1-(l*=f)-(_*=f);Wi.set(h,o.a.x*d+o.b.x*l+o.c.x*_,o.a.y*d+o.b.y*l+o.c.y*_,o.a.z*d+o.b.z*l+o.c.z*_)}return 1}}(),sr=new kn;function ar(t,e){sr.o.set(t.s),Wi.subtract(sr.d,t.e,t.s),sr.d.normalize();var i=tr(sr,e);return i<=t.length()?i:0}function or(t,e){sr.o.set(t.s),Wi.subtract(sr.d,t.e,t.s),sr.d.normalize();var i=er(sr,e);return i<=t.length()?i:0}function hr(t,e){sr.o.set(t.s),Wi.subtract(sr.d,t.e,t.s),sr.d.normalize();var i=$n(sr,e);return i<=t.length()?i:0}var ur,cr,lr,_r,fr=(ur=new Wi,cr=new Wi,lr=new Wi,_r=new Wi,function(t,e){return Wi.subtract(ur,t.center,t.halfExtents),Wi.add(cr,t.center,t.halfExtents),Wi.subtract(lr,e.center,e.halfExtents),Wi.add(_r,e.center,e.halfExtents),ur.x<=_r.x&&cr.x>=lr.x&&ur.y<=_r.y&&cr.y>=lr.y&&ur.z<=_r.z&&cr.z>=lr.z});function dr(t,e,i,n,r,s){Wi.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),Wi.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),Wi.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),Wi.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),Wi.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),Wi.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),Wi.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),Wi.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 pr(t,e){for(var i=Wi.dot(e,t[0]),n=i,r=1;r<8;++r){var s=Wi.dot(e,t[r]);i=s<i?s:i,n=s>n?s:n}return[i,n]}var mr,gr,vr,yr,Er,Tr=function(){for(var t=new Array(15),e=0;e<15;e++)t[e]=new Wi(0,0,0);for(var i=new Array(8),n=new Array(8),r=0;r<8;r++)i[r]=new Wi(0,0,0),n[r]=new Wi(0,0,0);var s=new Wi,a=new Wi;return function(e,r){Wi.set(t[0],1,0,0),Wi.set(t[1],0,1,0),Wi.set(t[2],0,0,1),Wi.set(t[3],r.orientation.m00,r.orientation.m01,r.orientation.m02),Wi.set(t[4],r.orientation.m03,r.orientation.m04,r.orientation.m05),Wi.set(t[5],r.orientation.m06,r.orientation.m07,r.orientation.m08);for(var o=0;o<3;++o)Wi.cross(t[6+3*o],t[o],t[3]),Wi.cross(t[7+3*o],t[o],t[4]),Wi.cross(t[7+3*o],t[o],t[5]);Wi.subtract(s,e.center,e.halfExtents),Wi.add(a,e.center,e.halfExtents),function(t,e,i){Wi.set(i[0],t.x,e.y,e.z),Wi.set(i[1],t.x,e.y,t.z),Wi.set(i[2],t.x,t.y,e.z),Wi.set(i[3],t.x,t.y,t.z),Wi.set(i[4],e.x,e.y,e.z),Wi.set(i[5],e.x,e.y,t.z),Wi.set(i[6],e.x,t.y,e.z),Wi.set(i[7],e.x,t.y,t.z)}(s,a,i),dr(r.center,r.halfExtents,t[3],t[4],t[5],n);for(var h=0;h<15;++h){var u=pr(i,t[h]),c=pr(n,t[h]);if(c[0]>u[1]||u[0]>c[1])return 0}return 1}}(),Sr=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=Wi.dot(e.n,t.center);return n+i<e.d?-1:n-i>e.d?0:1},Ar=function(t,e){for(var i=0;i<e.planes.length;i++)if(-1===Sr(t,e.planes[i]))return 0;return 1},Rr=function(){for(var t=new Array(8),e=0,i=0,n=0;n<t.length;n++)t[n]=new Wi(0,0,0);return function(n,r){for(var s=0,a=!1,o=0;o<r.planes.length;o++){if(-1===(s=Sr(n,r.planes[o])))return 0;1===s&&(a=!0)}if(!a)return 1;for(var h=0;h<r.vertices.length;h++)Wi.subtract(t[h],r.vertices[h],n.center);e=0,i=0;for(var u=0;u<r.vertices.length;u++)t[u].x>n.halfExtents.x?e++:t[u].x<-n.halfExtents.x&&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].y>n.halfExtents.y?e++:t[c].y<-n.halfExtents.y&&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].z>n.halfExtents.z?e++:t[l].z<-n.halfExtents.z&&i++;return e===r.vertices.length||i===r.vertices.length?0:1}}(),Cr=(mr=new Wi(0,0,0),gr=new Ji,function(t,e){return Wi.subtract(mr,e,t.center),Wi.transformMat3(mr,mr,Ji.transpose(gr,t.orientation)),i=mr,n=t.halfExtents,Math.abs(i.x)<n.x&&Math.abs(i.y)<n.y&&Math.abs(i.z)<n.z;var i,n}),br=(vr=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*vr(e.n,t.orientation.m00,t.orientation.m01,t.orientation.m02)+t.halfExtents.y*vr(e.n,t.orientation.m03,t.orientation.m04,t.orientation.m05)+t.halfExtents.z*vr(e.n,t.orientation.m06,t.orientation.m07,t.orientation.m08),n=Wi.dot(e.n,t.center);return n+i<e.d?-1:n-i>e.d?0:1}),Ir=function(t,e){for(var i=0;i<e.planes.length;i++)if(-1===br(t,e.planes[i]))return 0;return 1},wr=function(){for(var t=new Array(8),e=0,i=0,n=0,r=0;r<t.length;r++)t[r]=new Wi(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,h=!1,u=0;u<a.planes.length;u++){if(-1===(o=br(r,a.planes[u])))return 0;1===o&&(h=!0)}if(!h)return 1;for(var c=0;c<a.vertices.length;c++)Wi.subtract(t[c],a.vertices[c],r.center);i=0,n=0;for(var l=0;l<a.vertices.length;l++)(e=s(t[l],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}}(),Or=function(){for(var t=new Array(15),e=0;e<15;e++)t[e]=new Wi(0,0,0);for(var i=new Array(8),n=new Array(8),r=0;r<8;r++)i[r]=new Wi(0,0,0),n[r]=new Wi(0,0,0);return function(e,r){Wi.set(t[0],e.orientation.m00,e.orientation.m01,e.orientation.m02),Wi.set(t[1],e.orientation.m03,e.orientation.m04,e.orientation.m05),Wi.set(t[2],e.orientation.m06,e.orientation.m07,e.orientation.m08),Wi.set(t[3],r.orientation.m00,r.orientation.m01,r.orientation.m02),Wi.set(t[4],r.orientation.m03,r.orientation.m04,r.orientation.m05),Wi.set(t[5],r.orientation.m06,r.orientation.m07,r.orientation.m08);for(var s=0;s<3;++s)Wi.cross(t[6+3*s],t[s],t[3]),Wi.cross(t[7+3*s],t[s],t[4]),Wi.cross(t[8+3*s],t[s],t[5]);dr(e.center,e.halfExtents,t[0],t[1],t[2],i),dr(r.center,r.halfExtents,t[3],t[4],t[5],n);for(var a=0;a<15;++a){var o=pr(i,t[a]),h=pr(n,t[a]);if(h[0]>o[1]||o[0]>h[1])return 0}return 1}}(),Nr=function(){for(var t=new Qn,e=new Wi,i=new Wi,n=new Wi,r=new Array(8),s=0;s<8;s++)r[s]=new Wi;for(var a=new Array(8),o=0;o<8;o++)a[o]=new Wi;return function(s,o){if(0===Wi.squaredDistance(o.ellipseCenter0,o.ellipseCenter1))return t.radius=o.radius,t.center.set(o.ellipseCenter0),Gr.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,dr(s.center,s.halfExtents,e,i,n,r);var h=a,u=Wi.copy(h[0],e),c=Wi.copy(h[1],i),l=Wi.copy(h[2],n);Wi.subtract(h[3],o.center,s.center).normalize();var _=Wi.subtract(h[4],o.ellipseCenter0,o.ellipseCenter1);_.normalize(),Wi.cross(h[5],u,_),Wi.cross(h[6],c,_),Wi.cross(h[7],l,_);for(var f=0;f<8;++f){var d=pr(r,h[f]),p=Wi.dot(h[f],o.ellipseCenter0),m=Wi.dot(h[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}}(),Dr=function(t,e){var i=Wi.dot(e.n,t.center),n=t.radius*e.n.length();return i+n<e.d?-1:i-n>e.d?0:1},Mr=function(t,e){for(var i=0;i<e.planes.length;i++)if(-1===Dr(t,e.planes[i]))return 0;return 1},Pr=(yr=new Wi(0,0,0),Er=[1,-1,1,-1,1,-1],function(t,e){for(var i=0;i<6;i++){var n=e.planes[i],r=t.radius,s=t.center,a=n.n,o=n.d,h=Wi.dot(a,s);if(h+r<o)return 0;if(!(h-r>o)){Wi.add(yr,s,Wi.multiplyScalar(yr,a,r));for(var u=0;u<6;u++)if(u!==i&&u!==i+Er[i]){var c=e.planes[u];if(Wi.dot(c.n,yr)<c.d)return 0}}}return 1}),Lr=function(t,e){var i=t.radius+e.radius;return Wi.squaredDistance(t.center,e.center)<i*i},Br=function(){var t=new Wi;return function(e,i){return Pn(t,e.center,i),Wi.squaredDistance(e.center,t)<e.radius*e.radius}}(),Fr=function(){var t=new Wi;return function(e,i){return Ln(t,e.center,i),Wi.squaredDistance(e.center,t)<e.radius*e.radius}}(),Ur=function(){var t=new Wi,e=new Wi;return function(i,n){var r=i.radius+n.radius,s=r*r,a=Wi.squaredDistance(n.ellipseCenter0,n.ellipseCenter1);if(0===a)return Wi.squaredDistance(i.center,n.center)<s;Wi.subtract(t,i.center,n.ellipseCenter0),Wi.subtract(e,n.ellipseCenter1,n.ellipseCenter0);var o=Wi.dot(t,e)/a;return o<0?Wi.squaredDistance(i.center,n.ellipseCenter0)<s:o>1?Wi.squaredDistance(i.center,n.ellipseCenter1)<s:(Wi.scaleAndAdd(t,n.ellipseCenter0,e,o),Wi.squaredDistance(i.center,t)<s)}}(),kr=function(){var t=new Wi,e=new Wi,i=new Wi,n=new Wi,r=new Wi,s=new Wi;return function(a,o){var h,u,c=Wi.subtract(t,a.ellipseCenter1,a.ellipseCenter0),l=Wi.subtract(e,o.ellipseCenter1,o.ellipseCenter0),_=Wi.subtract(i,a.ellipseCenter0,o.ellipseCenter0),f=Wi.dot(c,c),d=Wi.dot(c,l),p=Wi.dot(l,l),m=Wi.dot(c,_),g=Wi.dot(l,_),v=f*p-d*d,y=v,E=v;v<vi?(h=0,y=1,u=g,E=p):(u=f*g-d*m,(h=d*g-p*m)<0?(h=0,u=g,E=p):h>y&&(h=y,u=g+d,E=p)),u<0?(u=0,-m<0?h=0:-m>f?h=y:(h=-m,y=f)):u>E&&(u=E,-m+d<0?h=0:-m+d>f?h=y:(h=-m+d,y=f));var T=Math.abs(h)<vi?0:h/y,S=Math.abs(u)<vi?0:u/E,A=n;A.set(_),A.add(Wi.multiplyScalar(r,c,T)),A.subtract(Wi.multiplyScalar(s,l,S));var R=a.radius+o.radius;return A.lengthSqr()<R*R}}(),Gr={raySphere:$n,rayAABB:tr,rayOBB:er,rayPlane:Zn,rayTriangle:Jn,rayCapsule:ir,raySubMesh:null,rayMesh:null,rayModel:null,lineSphere:hr,lineAABB:ar,lineOBB:or,linePlane:nr,lineTriangle:rr,sphereWithSphere:Lr,sphereAABB:Br,sphereOBB:Fr,spherePlane:Dr,sphereFrustum:Mr,sphereFrustumAccurate:Pr,sphereCapsule:Ur,aabbWithAABB:fr,aabbWithOBB:Tr,aabbPlane:Sr,aabbFrustum:Ar,aabbFrustumAccurate:Rr,obbWithOBB:Or,obbPlane:br,obbFrustum:Ir,obbFrustumAccurate:wr,obbPoint:Cr,obbCapsule:Nr,aabbFrustumCompletelyInside:function(t,e){for(var i=0;i<e.planes.length;i++)if(0!==Sr(t,e.planes[i]))return 0;return 1},capsuleWithCapsule:kr,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)}};Gr[Fn.SHAPE_RAY|Fn.SHAPE_SPHERE]=$n,Gr[Fn.SHAPE_RAY|Fn.SHAPE_AABB]=tr,Gr[Fn.SHAPE_RAY|Fn.SHAPE_OBB]=er,Gr[Fn.SHAPE_RAY|Fn.SHAPE_PLANE]=Zn,Gr[Fn.SHAPE_RAY|Fn.SHAPE_TRIANGLE]=Jn,Gr[Fn.SHAPE_RAY|Fn.SHAPE_CAPSULE]=ir,Gr[Fn.SHAPE_LINE|Fn.SHAPE_SPHERE]=hr,Gr[Fn.SHAPE_LINE|Fn.SHAPE_AABB]=ar,Gr[Fn.SHAPE_LINE|Fn.SHAPE_OBB]=or,Gr[Fn.SHAPE_LINE|Fn.SHAPE_PLANE]=nr,Gr[Fn.SHAPE_LINE|Fn.SHAPE_TRIANGLE]=rr,Gr[Fn.SHAPE_SPHERE]=Lr,Gr[Fn.SHAPE_SPHERE|Fn.SHAPE_AABB]=Br,Gr[Fn.SHAPE_SPHERE|Fn.SHAPE_OBB]=Fr,Gr[Fn.SHAPE_SPHERE|Fn.SHAPE_PLANE]=Dr,Gr[Fn.SHAPE_SPHERE|Fn.SHAPE_FRUSTUM]=Mr,Gr[Fn.SHAPE_SPHERE|Fn.SHAPE_FRUSTUM_ACCURATE]=Pr,Gr[Fn.SHAPE_SPHERE|Fn.SHAPE_CAPSULE]=Ur,Gr[Fn.SHAPE_AABB]=fr,Gr[Fn.SHAPE_AABB|Fn.SHAPE_OBB]=Tr,Gr[Fn.SHAPE_AABB|Fn.SHAPE_PLANE]=Sr,Gr[Fn.SHAPE_AABB|Fn.SHAPE_FRUSTUM]=Ar,Gr[Fn.SHAPE_AABB|Fn.SHAPE_FRUSTUM_ACCURATE]=Rr,Gr[Fn.SHAPE_OBB]=Or,Gr[Fn.SHAPE_OBB|Fn.SHAPE_PLANE]=br,Gr[Fn.SHAPE_OBB|Fn.SHAPE_FRUSTUM]=Ir,Gr[Fn.SHAPE_OBB|Fn.SHAPE_FRUSTUM_ACCURATE]=wr,Gr[Fn.SHAPE_OBB|Fn.SHAPE_CAPSULE]=Nr,Gr[Fn.SHAPE_CAPSULE]=kr,it(Un.prototype,"line",[{name:"mag",newName:"len"},{name:"magnitude",newName:"len"}]),nt(Gr,"intersect",[{name:"line_quad"}]);var Hr=new Wi(0,0,0),zr=new Wi(0,0,0),Vr=g.mat4(),Wr=g.v4(),Xr=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._type=Fn.SHAPE_PLANE,this.n=new Wi(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 Wi.copy(t.n,e.n),t.d=e.d,t},t.fromPoints=function(t,e,i,n){return Wi.subtract(Hr,i,e),Wi.subtract(zr,n,e),Wi.normalize(t.n,Wi.cross(t.n,Hr,zr)),t.d=Wi.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 Wi.copy(t.n,e),t.d=Wi.dot(e,i),t},t.normalize=function(t,e){var i=e.n.length();return Wi.normalize(t.n,e.n),i>0&&(t.d=e.d/i),t},t.prototype.transform=function(t){cn.invert(Vr,t),cn.transpose(Vr,Vr),ki.set(Wr,this.n.x,this.n.y,this.n.z,-this.d),ki.transformMat4(Wr,Wr,Vr),Wi.set(this.n,Wr.x,Wr.y,Wr.z),this.d=-Wr.w},n(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}(),jr=function(){function t(t,e,i,n,r,s,a,o,h){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===h&&(h=0),this.a=void 0,this.b=void 0,this.c=void 0,this._type=void 0,this._type=Fn.SHAPE_TRIANGLE,this.a=new Wi(t,e,i),this.b=new Wi(n,r,s),this.c=new Wi(a,o,h)}return t.create=function(e,i,n,r,s,a,o,h,u){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===h&&(h=0),void 0===u&&(u=1),new t(e,i,n,r,s,a,o,h,u)},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 Wi.copy(t.a,e.a),Wi.copy(t.b,e.b),Wi.copy(t.c,e.c),t},t.fromPoints=function(t,e,i,n){return Wi.copy(t.a,e),Wi.copy(t.b,i),Wi.copy(t.c,n),t},t.set=function(t,e,i,n,r,s,a,o,h,u){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=h,t.c.z=u,t},n(t,[{key:"type",get:function(){return this._type}}]),t}(),Yr=new Wi,Kr=new Wi,qr=new Wi,Qr=new Wi,Zr=new Ji,Jr=function(t,e,i){Zr.m00=Math.abs(i.m00),Zr.m01=Math.abs(i.m01),Zr.m02=Math.abs(i.m02),Zr.m03=Math.abs(i.m04),Zr.m04=Math.abs(i.m05),Zr.m05=Math.abs(i.m06),Zr.m06=Math.abs(i.m08),Zr.m07=Math.abs(i.m09),Zr.m08=Math.abs(i.m10),Wi.transformMat3(t,e,Zr)},$r=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=Fn.SHAPE_AABB,this.center=new Wi(t,e,i),this.halfExtents=new Wi(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 Wi.copy(t.center,e.center),Wi.copy(t.halfExtents,e.halfExtents),t},t.fromPoints=function(t,e,i){return Wi.add(Yr,i,e),Wi.subtract(Kr,i,e),Wi.multiplyScalar(t.center,Yr,.5),Wi.multiplyScalar(t.halfExtents,Kr,.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 Wi.subtract(Yr,i.center,i.halfExtents),Wi.subtract(Kr,n.center,n.halfExtents),Wi.add(qr,i.center,i.halfExtents),Wi.add(Qr,n.center,n.halfExtents),Wi.max(Qr,qr,Qr),Wi.min(qr,Yr,Kr),t.fromPoints(e,qr,Qr)},t.toBoundingSphere=function(t,e){return t.center.set(e.center),t.radius=e.halfExtents.length(),t},t.transform=function(t,e,i){return Wi.transformMat4(t.center,e.center,i),Jr(t.halfExtents,e.halfExtents,i),t};var e=t.prototype;return e.getBoundary=function(t,e){Wi.subtract(t,this.center,this.halfExtents),Wi.add(e,this.center,this.halfExtents)},e.transform=function(t,e,i,n,r){Wi.transformMat4(r.center,this.center,t),Jr(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(Yr,Kr),t.x<Yr.x&&(Yr.x=t.x),t.y<Yr.y&&(Yr.y=t.y),t.z<Yr.z&&(Yr.z=t.z),t.x>Kr.x&&(Kr.x=t.x),t.y>Kr.y&&(Kr.y=t.y),t.z>Kr.z&&(Kr.z=t.z),Wi.add(qr,Yr,Kr),this.center.set(Wi.multiplyScalar(qr,qr,.5)),this.halfExtents.set(Kr.x-qr.x,Kr.y-qr.y,Kr.z-qr.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){this.mergePoints(t.vertices)},n(t,[{key:"type",get:function(){return this._type}}]),t}(),ts=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=Fn.SHAPE_CAPSULE,this.radius=t,this.halfHeight=e,this.axis=i,this.center=new Wi,this.rotation=new en,this.ellipseCenter0=new Wi(0,e,0),this.ellipseCenter1=new Wi(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,Wi.transformMat4(r.center,this.center,t),en.multiply(r.rotation,this.rotation,i),r.updateCache()},e.updateCache=function(){this.updateLocalCenter(),Wi.transformQuat(this.ellipseCenter0,this.ellipseCenter0,this.rotation),Wi.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)}},n(t,[{key:"type",get:function(){return this._type}}]),t}(),es=new Array(8);es[0]=new Wi(1,1,1),es[1]=new Wi(-1,1,1),es[2]=new Wi(-1,-1,1),es[3]=new Wi(1,-1,1),es[4]=new Wi(1,1,-1),es[5]=new Wi(-1,1,-1),es[6]=new Wi(-1,-1,-1),es[7]=new Wi(1,-1,-1);var is,ns=new Wi,rs=new Wi,ss=new Wi,as=function(){e.createOrthographic=function(t,e,i,n,r,s){var a=e/2,o=i/2;Wi.set(ss,a,o,-n),Wi.transformMat4(t.vertices[0],ss,s),Wi.set(ss,-a,o,-n),Wi.transformMat4(t.vertices[1],ss,s),Wi.set(ss,-a,-o,-n),Wi.transformMat4(t.vertices[2],ss,s),Wi.set(ss,a,-o,-n),Wi.transformMat4(t.vertices[3],ss,s),Wi.set(ss,a,o,-r),Wi.transformMat4(t.vertices[4],ss,s),Wi.set(ss,-a,o,-r),Wi.transformMat4(t.vertices[5],ss,s),Wi.set(ss,-a,-o,-r),Wi.transformMat4(t.vertices[6],ss,s),Wi.set(ss,a,-o,-r),Wi.transformMat4(t.vertices[7],ss,s),t.updatePlanes()},e.createOrtho=function(t,i,n,r,s,a){return e.createOrthographic(t,i,n,r,s,a)},e.createPerspective=function(t,e,i,n,r,s){var a=Math.tan(.5*i),o=a*e;ns.set(n*o,n*a,n),rs.set(r*o,r*a,r);var h=t.vertices;ss.set(ns.x,ns.y,-ns.z),Wi.transformMat4(h[0],ss,s),ss.set(-ns.x,ns.y,-ns.z),Wi.transformMat4(h[1],ss,s),ss.set(-ns.x,-ns.y,-ns.z),Wi.transformMat4(h[2],ss,s),ss.set(ns.x,-ns.y,-ns.z),Wi.transformMat4(h[3],ss,s),ss.set(rs.x,rs.y,-rs.z),Wi.transformMat4(h[4],ss,s),ss.set(-rs.x,rs.y,-rs.z),Wi.transformMat4(h[5],ss,s),ss.set(-rs.x,-rs.y,-rs.z),Wi.transformMat4(h[6],ss,s),ss.set(rs.x,-rs.y,-rs.z),Wi.transformMat4(h[7],ss,s),t.updatePlanes()},e.createFromAABB=function(t,e){var i=new Wi,n=new Wi;return Wi.subtract(i,e.center,e.halfExtents),Wi.add(n,e.center,e.halfExtents),t.vertices[0].set(n.x,n.y,-i.z),t.vertices[1].set(i.x,n.y,-i.z),t.vertices[2].set(i.x,i.y,-i.z),t.vertices[3].set(n.x,i.y,-i.z),t.vertices[4].set(n.x,n.y,-n.z),t.vertices[5].set(i.x,n.y,-n.z),t.vertices[6].set(i.x,i.y,-n.z),t.vertices[7].set(n.x,i.y,-n.z),t.updatePlanes(),t};var t=e.prototype;function e(){this.planes=void 0,this.vertices=void 0,this._type=void 0,this._type=Fn.SHAPE_FRUSTUM,this.planes=new Array(6);for(var t=0;t<6;++t)this.planes[t]=Xr.create(0,0,0,0);this.vertices=new Array(8);for(var e=0;e<8;++e)this.vertices[e]=new Wi}return t.split=function(t,i,n,r,s){return e.createPerspective(this,n,r,t,i,s)},e.create=function(){return new e},e.clone=function(t){return e.copy(new e,t)},e.copy=function(t,e){t._type=e.type;for(var i=0;i<6;++i)Xr.copy(t.planes[i],e.planes[i]);for(var n=0;n<8;++n)Wi.copy(t.vertices[n],e.vertices[n]);return t},t.update=function(t,e){Wi.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),Wi.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),Wi.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),Wi.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),Wi.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),Wi.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);for(var i=0;i<6;i++){var n=this.planes[i],r=1/n.n.length();Wi.multiplyScalar(n.n,n.n,r),n.d*=r}for(var s=0;s<8;s++)Wi.transformMat4(this.vertices[s],es[s],e)},t.transform=function(t){for(var e=0;e<8;e++)Wi.transformMat4(this.vertices[e],this.vertices[e],t);this.updatePlanes()},t.zero=function(){for(var t=0;t<8;t++)this.vertices[t].set(0,0,0);for(var e=0;e<6;e++)Xr.set(this.planes[e],0,0,0,0)},t.updatePlanes=function(){Xr.fromPoints(this.planes[0],this.vertices[1],this.vertices[6],this.vertices[5]),Xr.fromPoints(this.planes[1],this.vertices[3],this.vertices[4],this.vertices[7]),Xr.fromPoints(this.planes[2],this.vertices[6],this.vertices[3],this.vertices[7]),Xr.fromPoints(this.planes[3],this.vertices[0],this.vertices[5],this.vertices[4]),Xr.fromPoints(this.planes[4],this.vertices[2],this.vertices[0],this.vertices[3]),Xr.fromPoints(this.planes[5],this.vertices[7],this.vertices[5],this.vertices[6])},n(e,[{key:"accurate",set:function(t){this._type=t?Fn.SHAPE_FRUSTUM_ACCURATE:Fn.SHAPE_FRUSTUM}},{key:"type",get:function(){return this._type}}]),e}(),os=new Wi,hs=new Wi,us=new Ji,cs=function(){function t(t,e,i,n,r,s,a,o,h,u,c,l,_,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===h&&(h=0),void 0===u&&(u=0),void 0===c&&(c=1),void 0===l&&(l=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=Fn.SHAPE_OBB,this.center=new Wi(t,e,i),this.halfExtents=new Wi(n,r,s),this.orientation=new Ji(a,o,h,u,c,l,_,f,d)}t.create=function(e,i,n,r,s,a,o,h,u,c,l,_,f,d,p){return new t(e,i,n,r,s,a,o,h,u,c,l,_,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 Wi.copy(t.center,e.center),Wi.copy(t.halfExtents,e.halfExtents),Ji.copy(t.orientation,e.orientation),t},t.fromPoints=function(t,e,i){return Wi.multiplyScalar(t.center,Wi.add(os,e,i),.5),Wi.multiplyScalar(t.halfExtents,Wi.subtract(hs,i,e),.5),Ji.identity(t.orientation),t},t.set=function(t,e,i,n,r,s,a,o,h,u,c,l,_,f,d,p){return Wi.set(t.center,e,i,n),Wi.set(t.halfExtents,r,s,a),Ji.set(t.orientation,o,h,u,c,l,_,f,d,p),t};var e=t.prototype;return e.getBoundary=function(t,e){!function(t,e,i){us.m00=Math.abs(i.m00),us.m01=Math.abs(i.m01),us.m02=Math.abs(i.m02),us.m03=Math.abs(i.m03),us.m04=Math.abs(i.m04),us.m05=Math.abs(i.m05),us.m06=Math.abs(i.m06),us.m07=Math.abs(i.m07),us.m08=Math.abs(i.m08),Wi.transformMat3(t,e,us)}(os,this.halfExtents,this.orientation),Wi.subtract(t,this.center,os),Wi.add(e,this.center,os)},e.transform=function(t,e,i,n,r){Wi.transformMat4(r.center,this.center,t),Ji.fromQuat(r.orientation,i),Wi.multiply(r.halfExtents,this.halfExtents,n)},e.translateAndRotate=function(t,e,i){Wi.transformMat4(i.center,this.center,t),Ji.fromQuat(i.orientation,e)},e.setScale=function(t,e){Wi.multiply(e.halfExtents,this.halfExtents,t)},n(t,[{key:"type",get:function(){return this._type}}]),t}();function ls(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}is=Symbol.iterator;var _s,fs,ds,ps=function(){function t(){this._times=[],this._values=[]}var e=t.prototype;return e[is]=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 ls(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 ls(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]||Ei(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=ls(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},n(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 ms(t){return t>-1e-9&&t<1e-9}function gs(t,e,i,n){return i.slice().reverse().reduce((function(i,n){return n(t,e,i)||i}),n)}ci.fastDefine("cc.KeyframeCurve",ps,{_times:[],_values:[]}),t("RealInterpolationMode",_s),function(t){t[t.LINEAR=0]="LINEAR",t[t.CONSTANT=1]="CONSTANT",t[t.CUBIC=2]="CUBIC"}(_s||t("RealInterpolationMode",_s={})),t("ExtrapolationMode",fs),function(t){t[t.LINEAR=0]="LINEAR",t[t.CLAMP=1]="CLAMP",t[t.LOOP=2]="LOOP",t[t.PING_PONG=3]="PING_PONG"}(fs||t("ExtrapolationMode",fs={})),t("TangentWeightMode",ds),function(t){t[t.NONE=0]="NONE",t[t.LEFT=1]="LEFT",t[t.RIGHT=2]="RIGHT",t[t.BOTH=3]="BOTH"}(ds||t("TangentWeightMode",ds={}));var vs=function(){},ys=function(){return vs},Es=Ts((function(){}));function Ts(t){return function(e){return"function"==typeof e?t(e):function(i){return t(i,e)}}}function Ss(t){return function(e){return function(i){!function(t,e,i){var n=Rs(t);if(n){var r=Cs(n,"proto");Cs(r,"editor")[e]=i}}(i,t,e)}}}var As="__ccclassCache__";function Rs(t){return Cs(t,As)}function Cs(t,e){return t[e]||(t[e]={})}var bs=Ts((function(t,e){var i=Gt(t);i===Object&&(i=null);var n={name:e,extends:i,ctor:t},r=t[As];if(r){var s=r.proto;s&&Ut(n,s),t[As]=void 0}return ci(n)})),Is=Ss("requireComponent"),ws=Ss("executionOrder"),Os=Es;function xs(t,e,i){var n=null;function r(t,e,i){!function(t,e,i,n,r,s){var a,o=s&&"function"!=typeof s&&(s.get||s.set);r&&(a=$e(r,o));var h=Ut(e,a||r||{});o?(s.get&&(h.get=s.get),s.set&&(h.set=s.set)):Ms(t,h,i,n,s)}(function(t){return Rs(t.constructor)}(t),function(t,e){var i,n,r=Cs(Rs(t.constructor),"proto"),s=Cs(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?xs({type:void 0}):void 0===e?(n=t,r):void r(t,e,i)}function Ns(t){var e;try{e=t()}catch(e){return t}return"object"!=typeof e||null===e?e:t}function Ds(t,e,i){var n,r,s=Rs(t.constructor),a=Cs(s,"proto"),o=Cs(a,"properties"),h=null!==(r=o[n=e])&&void 0!==r?r:o[n]={};return h.__internalFlags|=ti.STANDALONE,i&&"function"!=typeof i&&(i.get||i.set)?(i.get&&(h.get=i.get),i.set&&(h.set=i.set)):Ms(s,h,t.constructor,e,i),h}function Ms(t,e,i,n,r){if(void 0!==r)"function"==typeof r?e.default=Ns(r):null===r||r.initializer&&(e.default=Ns(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 Ps=Symbol("cc:SerializationMetadata"),Ls=t("serializable",(function(t,e,i){Us(Ds(t,e,i))}));function Bs(t){return function(e,i,n){var r=Ds(e,i,n);r.formerlySerializedAs=t,Us(r)}}var Fs=function(t,e,i){var n=Ds(t,e,i);n.editorOnly=!0,Us(n)};function Us(t){t.__internalFlags|=ti.IMPLICIT_SERIALIZABLE}var ks=vs,Gs=Es,Hs=ys,zs=Es,Vs=ys,Ws=ys,Xs=ys,js=t("editable",vs),Ys=t("visible",ys),Ks=t("displayName",ys),qs=t("tooltip",ys),Qs=t("range",ys),Zs=t("rangeStep",ys),Js=t("slide",vs),$s=t("displayOrder",ys),ta=t("disallowAnimation",vs),ea=sa(Ve),ia=sa(We),na=sa(Xe),ra=sa(je);function sa(t){return xs({type:t})}var aa=t("override",(function(t,e,i){Ds(t,e,i).override=!0})),oa=t("editorExtrasTag","__editorExtras__"),ha=t("EditorExtendable",(function(){})),ua=Object.freeze({__proto__:null,uniquelyReferenced:ks,ccclass:bs,property:xs,requireComponent:Is,executionOrder:ws,disallowMultiple:Os,executeInEditMode:Gs,menu:Hs,playOnFocus:zs,inspector:Vs,icon:Ws,help:Xs,type:sa,integer:ea,float:ia,boolean:na,string:ra,editable:js,tooltip:qs,visible:Ys,displayName:Ks,displayOrder:$s,range:Qs,rangeStep:Zs,slide:Js,disallowAnimation:ta,override:aa,formerlySerializedAs:Bs,serializable:Ls});t("_decorator",ua);var ca,la,_a,fa,da,pa,ma,ga,va,ya,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 g.Node||t instanceof g.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(ci._isCCClass(e))for(var a=g.Class.Attr.getClassAttrs(e),o=e.__props__,h=0;h<o.length;h++){var u=""+(i=o[h]);if(u in a){if(n&&"_id"===i)continue;switch(typeof a[u]){case"string":s[i]="";break;case"object":case"function":s[i]=null;break;case"undefined":s[i]=void 0}}}return function(t){for(var e in s)t[e]=s[e]}}(this,t),At(t,"__destruct__",e,!0)),e(this)},e._destroyImmediate=function(){var t;1&this._objFlags?K(5e3):(null===(t=this._onPreDestroy)||void 0===t||t.call(this),this._destruct(),this._objFlags|=1)},n(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:"isValid",get:function(){return!(1&this._objFlags)}}]),t}());function Sa(t){return t instanceof Ta}function Aa(t,e){return"object"==typeof t?!(!t||t._objFlags&(e?5:1)):void 0!==t}function Ra(t,e){return(e<<3)+t}function Ca(t){return Ia[t]}function ba(t){switch(t){case va.Uint8:return Uint8Array;case va.Uint16:return Uint16Array;case va.Uint32:return Uint32Array;case va.Int8:return Int8Array;case va.Int16:return Int16Array;case va.Int32:return Int32Array;case va.Float32:return Float32Array;case va.Float64:return Float64Array}}Ta.prototype._deserialize=null,ci.fastDefine("cc.Object",Ta,{_name:"",_objFlags:0}),At(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}),g.isValid=Aa,g.Object=Ta,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"}(va||(va={})),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"}(ya||(ya={})),t("CompactValueTypeArray",bs("cc.CompactValueTypeArray")(((ma=function(){function t(){this._byteOffset=_a&&_a(),this._unitCount=fa&&fa(),this._unitElement=da&&da(),this._length=pa&&pa()}return t.lengthFor=function(t,e,i){return Ca(e).requiredUnits*t.length*ba(i).BYTES_PER_ELEMENT},t.compress=function(e,i,n,r,s,a){for(var o=Ca(i),h=ba(n),u=o.requiredUnits*e.length,c=new h(r,s,u),l=0;l<e.length;++l)o.compress(c,l,e[l]);var _=new t;return _._unitElement=Ra(n,i),_._byteOffset=a,_._unitCount=u,_._length=e.length,_},t.prototype.decompress=function(t){for(var e,i={storageUnit:7&(e=this._unitElement),elementType:e>>3},n=i.storageUnit,r=Ca(i.elementType),s=new(ba(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}()).StorageUnit=va,ma.ElementType=ya,_a=gs((la=ma).prototype,"_byteOffset",[Ls],(function(){return 0})),fa=gs(la.prototype,"_unitCount",[Ls],(function(){return 0})),da=gs(la.prototype,"_unitElement",[Ls],(function(){return Ra(va.Uint8,ya.Scalar)})),pa=gs(la.prototype,"_length",[Ls],(function(){return 0})),ca=la))||ca);var Ia=((ga={})[ya.Scalar]={requiredUnits:1,compress:function(t,e,i){t[e]=i},decompress:function(t,e){return t[e]}},ga[ya.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 Wi(t[2*e],t[2*e+1])}},ga[ya.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 Wi(t[3*e],t[3*e+1],t[3*e+2])}},ga[ya.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 ki(t[4*e],t[4*e+1],t[4*e+2],t[4*e+3])}},ga[ya.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 en(t[4*e],t[4*e+1],t[4*e+2],t[4*e+3])}},ga[ya.Mat4]={requiredUnits:16,compress:function(t,e,i){cn.toArray(t,i,16*e)},decompress:function(t,e){return cn.fromArray(new cn,t,16*e)}},ga),wa=t("serializeTag",Symbol("[[Serialize]]")),Oa=t("deserializeTag",Symbol("[[Deserialize]]"));function xa(){return 0}function Na(t){return t}function Da(t){return t*t}function Ma(t){return t*(2-t)}function Pa(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)}function La(t){return t*t*t}function Ba(t){return--t*t*t+1}function Fa(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)}function Ua(t){return t*t*t*t}function ka(t){return 1- --t*t*t*t}function Ga(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)}function Ha(t){return t*t*t*t*t}function za(t){return--t*t*t*t*t+1}function Va(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)}function Wa(t){return 1===t?1:1-Math.cos(t*Math.PI/2)}function Xa(t){return Math.sin(t*Math.PI/2)}function ja(t){return.5*(1-Math.cos(Math.PI*t))}function Ya(t){return 0===t?0:Math.pow(1024,t-1)}function Ka(t){return 1===t?1:1-Math.pow(2,-10*t)}function qa(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 Qa(t){return 1-Math.sqrt(1-t*t)}function Za(t){return Math.sqrt(1- --t*t)}function Ja(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}function $a(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 to(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 eo(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 io(t){if(1===t)return 1;var e=1.70158;return t*t*((e+1)*t-e)}function no(t){if(0===t)return 0;var e=1.70158;return--t*t*((e+1)*t+e)+1}function ro(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 so(t){return 1-ao(1-t)}function ao(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 oo(t){return t<.5?.5*so(2*t):.5*ao(2*t-1)+.5}function ho(t){return t<=0?0:t>=1?1:t*t*(3-2*t)}function uo(t){return t<=0?0:t>=1?1:t*t*t*(t*(6*t-15)+10)}g._decorator=ua;var co=To(Da,Ma),lo=To(La,Ba),_o=To(Ua,ka),fo=To(Ha,za),po=To(Wa,Xa),mo=To(Ya,Ka),go=To(Qa,Za),vo=To($a,to),yo=To(io,no),Eo=To(so,ao);function To(t,e){return function(i){return i<.5?e(2*i)/2:t(2*i-1)/2+.5}}var So,Ao,Ro=Object.freeze({__proto__:null,constant:xa,linear:Na,quadIn:Da,quadOut:Ma,quadInOut:Pa,cubicIn:La,cubicOut:Ba,cubicInOut:Fa,quartIn:Ua,quartOut:ka,quartInOut:Ga,quintIn:Ha,quintOut:za,quintInOut:Va,sineIn:Wa,sineOut:Xa,sineInOut:ja,expoIn:Ya,expoOut:Ka,expoInOut:qa,circIn:Qa,circOut:Za,circInOut:Ja,elasticIn:$a,elasticOut:to,elasticInOut:eo,backIn:io,backOut:no,backInOut:ro,bounceIn:so,bounceOut:ao,bounceInOut:oo,smooth:ho,fade:uo,quadOutIn:co,cubicOutIn:lo,quartOutIn:_o,quintOutIn:fo,sineOutIn:po,expoOutIn:mo,circOutIn:go,elasticOutIn:vo,backOutIn:yo,bounceOutIn:Eo});t("easing",Ro),t("EasingMethod",Ao),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"}(Ao||t("EasingMethod",Ao={}));var Co,bo=((So={})[Ao.CONSTANT]=xa,So[Ao.LINEAR]=Na,So[Ao.QUAD_IN]=Da,So[Ao.QUAD_OUT]=Ma,So[Ao.QUAD_IN_OUT]=Pa,So[Ao.QUAD_OUT_IN]=co,So[Ao.CUBIC_IN]=La,So[Ao.CUBIC_OUT]=Ba,So[Ao.CUBIC_IN_OUT]=Fa,So[Ao.CUBIC_OUT_IN]=lo,So[Ao.QUART_IN]=Ua,So[Ao.QUART_OUT]=ka,So[Ao.QUART_IN_OUT]=Ga,So[Ao.QUART_OUT_IN]=_o,So[Ao.QUINT_IN]=Ha,So[Ao.QUINT_OUT]=za,So[Ao.QUINT_IN_OUT]=Va,So[Ao.QUINT_OUT_IN]=fo,So[Ao.SINE_IN]=Wa,So[Ao.SINE_OUT]=Xa,So[Ao.SINE_IN_OUT]=ja,So[Ao.SINE_OUT_IN]=po,So[Ao.EXPO_IN]=Ya,So[Ao.EXPO_OUT]=Ka,So[Ao.EXPO_IN_OUT]=qa,So[Ao.EXPO_OUT_IN]=mo,So[Ao.CIRC_IN]=Qa,So[Ao.CIRC_OUT]=Za,So[Ao.CIRC_IN_OUT]=Ja,So[Ao.CIRC_OUT_IN]=go,So[Ao.ELASTIC_IN]=$a,So[Ao.ELASTIC_OUT]=to,So[Ao.ELASTIC_IN_OUT]=eo,So[Ao.ELASTIC_OUT_IN]=vo,So[Ao.BACK_IN]=io,So[Ao.BACK_OUT]=no,So[Ao.BACK_IN_OUT]=ro,So[Ao.BACK_OUT_IN]=yo,So[Ao.BOUNCE_IN]=so,So[Ao.BOUNCE_OUT]=ao,So[Ao.BOUNCE_IN_OUT]=oo,So[Ao.BOUNCE_OUT_IN]=Eo,So[Ao.SMOOTH]=ho,So[Ao.FADE]=uo,So);function Io(t){return bo[t]}T(255),T(65280);var wo,Oo,xo,No=_s.LINEAR<<0|ds.NONE<<8|Ao.LINEAR<<16,Do=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=No,e}return s(e,t),n(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}(ha);function Mo(t){var e=new Do;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,h=t.leftTangentWeight,u=t.easingMethod,c=t[oa];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!=h?h:e.leftTangentWeight,e.interpolationMode=null!=i?i:e.interpolationMode,e.tangentWeightMode=null!=n?n:e.tangentWeightMode,e.easingMethod=null!=u?u:e.easingMethod,c&&(e[oa]=c)}return e}ci.fastDefine("cc.RealKeyframeValue",Do,((Co={interpolationMode:_s.LINEAR,tangentWeightMode:ds.NONE,value:0,rightTangent:0,rightTangentWeight:0,leftTangent:0,leftTangentWeight:0,easingMethod:Ao.LINEAR})[oa]=void 0,Co)),ci.Attr.setClassAttr(Do,oa,"editorOnly",!0),(wo=Do,null!==(xo=(Oo=wo)[Ps])&&void 0!==xo?xo:Oo[Ps]={}).uniquelyReferenced=!0;var Po,Lo=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=fs.CLAMP,e.postExtrapolation=fs.CLAMP,e}s(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===fs.CLAMP||n<2)return o.value;switch(a){case fs.LINEAR:return Zo(r,i[0].value,e[1],i[1].value,t);case fs.LOOP:t=qo(t,r,s);break;case fs.PING_PONG:t=Qo(t,r,s);break;default:return o.value}}else if(t>s){var h=this.postExtrapolation,u=i[n-1];if(h===fs.CLAMP||n<2)return u.value;switch(h){case fs.LINEAR:return Zo(s,u.value,e[n-2],i[n-2].value,t);case fs.LOOP:t=qo(t,r,s);break;case fs.PING_PONG:t=Qo(t,r,s);break;default:return u.value}}var c=ls(e,t);if(c>=0)return i[c].value;var l=~c,_=l-1,f=e[_],d=i[_],p=e[l];return function(t,e,i,n,r){var s=i-t;switch(e.interpolationMode){default:case _s.CONSTANT:return e.value;case _s.LINEAR:var a=e.easingMethod===Ao.LINEAR?r:Io(e.easingMethod)(r);return Ai(e.value,n.value,a);case _s.CUBIC:var o=1/3,h=e.rightTangent,u=e.rightTangentWeight,c=0!=(e.tangentWeightMode&ds.RIGHT),l=n.leftTangent,_=n.leftTangentWeight,f=0!=(n.tangentWeightMode&ds.LEFT);if(c||f){var d=0;if(c)d=u;else{var p=s,m=s*h;d=Math.sqrt(p*p+m*m)*o}var g=Math.atan(h),v=Math.cos(g)*d+t,y=Math.sin(g)*d+e.value,E=0;if(f)E=_;else{var T=s,S=s*l;E=Math.sqrt(T*T+S*S)*o}var A=Math.atan(l),R=(v-t)/s,C=(-Math.cos(A)*E+i-t)/s,b=y,I=-Math.sin(A)*E+n.value,w=[0,0,0],O=function(t,e,i,n,r){var s=i/n,a=e/n,o=s*s,h=1/3*(-1/3*o+a),u=.5*(2/27*s*o-1/3*s*a+t/n),c=h*h*h,l=u*u+c,_=0;if(ms(l)){if(ms(u))return r[0]=0,1;var f=Math.cbrt(-u);return r[0]=2*f,r[1]=-f,2}if(l<0){var d=1/3*Math.acos(-u/Math.sqrt(-c)),p=2*Math.sqrt(-h);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(l),g=Math.cbrt(m-u),v=-Math.cbrt(m+u);r[0]=g+v,_=1}for(var y=1/3*s,E=0;E<_;++E)r[E]-=y;return _}(0-r,3*R,3*C-6*R,3*(R-C)+1,w),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}(w,O,r);return Jo(e.value,b,I,n.value,x)}var N=e.value+o*h*s,D=n.value-o*l*s;return Jo(e.value,N,D,n.value,r)}}(f,d,p,i[l],(t-f)/(p-f))},i.addKeyFrame=function(e,i){return t.prototype.addKeyFrame.call(this,e,Mo(i))},i.assignSorted=function(t,e){if(void 0!==e)this.setKeyframes(t.slice(),e.map((function(t){return Mo(t)})));else{var i=Array.from(t);this.setKeyframes(i.map((function(t){return t[0]})),i.map((function(t){return Mo(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 Ei(i.value,e,t)}))},i[wa]=function(t,e){if(e.toCCON){var i=this._times,n=this._values,r=i.length,s=new DataView(new ArrayBuffer(0+Bo+Bo+Fo+Uo*r+jo*r)),a=0;s.setUint8(a,this.preExtrapolation),a+=Bo,s.setUint8(a,this.postExtrapolation),a+=Bo,s.setUint32(a,r,!0),a+=Fo,i.forEach((function(t,e){return s.setFloat32(a+Uo*e,t,!0)})),a+=Uo*r;for(var o,h=f(n);!(o=h()).done;){var u=o.value;a=Yo(s,u,a)}var c=new Uint8Array(s.buffer,0,a);t.writeProperty("bytes",c);var l=n.map((function(t){return t[oa]}));l.some((function(t){return void 0!==t}))&&t.writeProperty("keyframeValueEditorExtras",l)}else t.writeThis()},i[Oa]=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+=Bo,this.postExtrapolation=n.getUint8(r),r+=Bo;var s=n.getUint32(r,!0);r+=Fo;var a=Array.from({length:s},(function(t,e){return n.getFloat32(r+Uo*e,!0)}));r+=Uo*s;for(var o=new Array(s),h=0;h<s;++h){var u=Mo({});r=Ko(n,u,r),o[h]=u}i.byteLength;var c=t.readProperty("keyframeValueEditorExtras");c&&(c.length,c.forEach((function(t,e){return o[e][oa]=t}))),this._times=a,this._values=o}else t.readThis()},e}(ps));ci.fastDefine("cc.RealCurve",Lo,{_times:[],_values:[],preExtrapolation:fs.CLAMP,postExtrapolation:fs.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"}(Po||(Po={}));var Bo=1,Fo=4,Uo=4,ko=Mo({}),Go=ko.interpolationMode,Ho=ko.tangentWeightMode,zo=ko.leftTangent,Vo=ko.leftTangentWeight,Wo=ko.rightTangent,Xo=ko.rightTangentWeight,jo=26;function Yo(t,e,i){var n=0,r=i,s=r;r+=4;var a=e.value,o=e.interpolationMode,h=e.tangentWeightMode,u=e.rightTangent,c=e.rightTangentWeight,l=e.leftTangent,_=e.leftTangentWeight,f=e.easingMethod;return t.setFloat32(r,a,!0),r+=4,o!==Go&&(n|=Po.INTERPOLATION_MODE,t.setUint8(r,o),r+=1),h!==Ho&&(n|=Po.TANGENT_WEIGHT_MODE,t.setUint8(r,h),r+=1),l!==zo&&(n|=Po.LEFT_TANGENT,t.setFloat32(r,l,!0),r+=4),_!==Vo&&(n|=Po.LEFT_TANGENT_WEIGHT,t.setFloat32(r,_,!0),r+=4),u!==Wo&&(n|=Po.RIGHT_TANGENT,t.setFloat32(r,u,!0),r+=4),c!==Xo&&(n|=Po.RIGHT_TANGENT_WEIGHT,t.setFloat32(r,c,!0),r+=4),n|=f<<8,t.setUint32(s,n,!0),r}function Ko(t,e,i){var n=i,r=t.getUint32(n,!0);n+=4,e.value=t.getFloat32(n,!0),n+=4,r&Po.INTERPOLATION_MODE&&(e.interpolationMode=t.getUint8(n),n+=1),r&Po.TANGENT_WEIGHT_MODE&&(e.tangentWeightMode=t.getUint8(n),n+=1),r&Po.LEFT_TANGENT&&(e.leftTangent=t.getFloat32(n,!0),n+=4),r&Po.LEFT_TANGENT_WEIGHT&&(e.leftTangentWeight=t.getFloat32(n,!0),n+=4),r&Po.RIGHT_TANGENT&&(e.rightTangent=t.getFloat32(n,!0),n+=4),r&Po.RIGHT_TANGENT_WEIGHT&&(e.rightTangentWeight=t.getFloat32(n,!0),n+=4);var s=(65280&r)>>8;return e.easingMethod=s,n}function qo(t,e,i){return e+Mi(t-e,i-e)}function Qo(t,e,i){return e+Pi(t-e,i-e)}function Zo(t,e,i,n,r){return e+(n-e)/(i-t)*(r-t)}function Jo(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 $o(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}g.bezier=$o;var th,eh,ih,nh,rh,sh,ah,oh,hh,uh,ch=Math.cos,lh=Math.acos,_h=Math.max,fh=2*Math.PI,dh=Math.sqrt;function ph(t){return t<0?-Math.pow(-t,1/3):Math.pow(t,1/3)}function mh(t,e){var i=function(t,e){var i,n,r,s,a=e-0,o=e-t[0],h=3*a,u=3*o,c=3*(e-t[2]),l=1/(-a+u-c+(e-1)),_=1/3,f=(h-6*o+c)*l,d=f*_,p=(-h+u)*l,m=(3*p-f*f)*_,g=m*_,v=(2*f*f*f-9*f*p+a*l*27)/27,y=v/2,E=y*y+g*g*g;if(E<0){var T=-m*_,S=dh(T*T*T),A=-v/(2*S),R=lh(A<-1?-1:A>1?1:A),C=2*ph(S);return n=C*ch(R*_)-d,r=C*ch((R+fh)*_)-d,s=C*ch((R+2*fh)*_)-d,n>=0&&n<=1?r>=0&&r<=1?s>=0&&s<=1?_h(n,r,s):_h(n,r):s>=0&&s<=1?_h(n,s):n:r>=0&&r<=1?s>=0&&s<=1?_h(r,s):r:s}if(0===E)return r=-(i=y<0?ph(-y):-ph(y))-d,(n=2*i-d)>=0&&n<=1?r>=0&&r<=1?_h(n,r):n:r;var b=dh(E);return(i=ph(-y+b))-ph(y+b)-d}(t,e),n=t[1];return((1-i)*(n+(t[3]-n)*i)*3+i*i)*i}g.bezierByTime=mh,t("QuatInterpolationMode",uh),function(t){t[t.SLERP=0]="SLERP",t[t.CONSTANT=1]="CONSTANT"}(uh||t("QuatInterpolationMode",uh={}));var gh,vh=bs("cc.QuatKeyframeValue")(th=ks((eh=function(t){var e=void 0===t?{}:t,i=e.value,n=e.interpolationMode,r=e.easingMethod;this.interpolationMode=ih&&ih(),this.value=nh&&nh(),this.easingMethod=rh&&rh(),this.value=i?en.clone(i):this.value,this.interpolationMode=null!=n?n:this.interpolationMode,this.easingMethod=null!=r?r:this.easingMethod},ih=gs(eh.prototype,"interpolationMode",[Ls],(function(){return uh.SLERP})),nh=gs(eh.prototype,"value",[Ls],(function(){return en.clone(en.IDENTITY)})),rh=gs(eh.prototype,"easingMethod",[Ls],(function(){return Ao.LINEAR})),th=eh))||th)||th;function yh(t){return new vh(t)}t("QuatCurve",bs("cc.QuatCurve")((ah=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=oh&&oh(),e.postExtrapolation=hh&&hh(),e}s(e,t);var i=e.prototype;return i.evaluate=function(t,e){var i;null!==(i=e)&&void 0!==i||(e=new en);var n=this._times,r=this._values,s=this.postExtrapolation,a=this.preExtrapolation,o=n.length;if(0===o)return e;var h=n[0],u=n[o-1];if(t<h){var c=r[0];switch(a){case fs.LOOP:t=h+Mi(t-h,u-h);break;case fs.PING_PONG:t=h+Pi(t-h,u-h);break;case fs.CLAMP:default:return en.copy(e,c.value)}}else if(t>u){var l=r[o-1];switch(s){case fs.LOOP:t=h+Mi(t-h,u-h);break;case fs.PING_PONG:t=h+Pi(t-h,u-h);break;case fs.CLAMP:default:return en.copy(e,l.value)}}var _=ls(n,t);if(_>=0)return en.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 uh.CONSTANT:return en.copy(e,m.value);case uh.SLERP:var E=m.easingMethod,T=E===Ao.LINEAR?y:Array.isArray(E)?mh(E,y):Io(E)(y);return en.slerp(e,m.value,v.value,T)}},i.addKeyFrame=function(e,i){var n=new vh(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 yh(t)})));else{var i=Array.from(t);this.setKeyframes(i.map((function(t){return t[0]})),i.map((function(t){return yh(t[1])})))}},i[wa]=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=Ch*(r?1:s),o=n.reduce((function(t,e){var i=e.easingMethod;return t+(Array.isArray(i)?bh+4*wh:bh)}),0),h=0,u=new DataView(new ArrayBuffer(h+=Th+Sh+Ah*s+4*Rh*s+o+a+0)),c=0,l=0;r&&(l|=gh.INTERPOLATION_MODE),u.setUint32(c,l,!0),c+=Th,u.setUint32(c,s,!0),c+=Sh,i.forEach((function(t,e){return u.setFloat32(c+Ah*e,t,!0)})),c+=Ah*s,n.forEach((function(t,e){var i=t.value,n=i.x,r=i.y,s=i.z,a=i.w,o=c+4*Rh*e;u.setFloat32(o+0*Rh,n,!0),u.setFloat32(o+1*Rh,r,!0),u.setFloat32(o+2*Rh,s,!0),u.setFloat32(o+3*Rh,a,!0)})),c+=4*Rh*s,n.forEach((function(t){var e=t.easingMethod;Array.isArray(e)?(u.setUint8(c,Ih),++c,u.setFloat32(c+0*wh,e[0],!0),u.setFloat32(c+1*wh,e[1],!0),u.setFloat32(c+2*wh,e[2],!0),u.setFloat32(c+3*wh,e[3],!0),c+=4*wh):(u.setUint8(c,e),++c)}));var _=c;c+=a;var f=_;n.forEach((function(t){var e=t.interpolationMode;u.setUint8(f,e),r||(f+=Ch)}));var d=new Uint8Array(u.buffer);t.writeProperty("bytes",d)}else t.writeThis()},i[Oa]=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+=Th;var a=s&gh.INTERPOLATION_MODE,o=n.getUint32(r,!0);r+=Sh;var h=Array.from({length:o},(function(t,e){return n.getFloat32(r+Ah*e,!0)})),u=r+=Ah*o;r+=4*Rh*o;var c=Array.from({length:o},(function(t,e){var i=u+4*Rh*e,s=n.getFloat32(i+0*Rh,!0),a=n.getFloat32(i+1*Rh,!0),o=n.getFloat32(i+2*Rh,!0),h=n.getFloat32(i+3*Rh,!0),c=n.getUint8(r);++r;var l=yh({value:{x:s,y:a,z:o,w:h}});return c!==Ih?l.easingMethod=c:(l.easingMethod=[n.getFloat32(r+0*wh,!0),n.getFloat32(r+1*wh,!0),n.getFloat32(r+2*wh,!0),n.getFloat32(r+3*wh,!0)],r+=4*wh),l}));if(a){var l=n.getUint8(r);++r;for(var _=0;_<o;++_)c[_].interpolationMode=l}else{for(var f=0;f<o;++f){var d=n.getUint8(r+f);c[f].interpolationMode=d}r+=o}this._times=h,this._values=c}else t.readThis()},e}(ps),oh=gs(ah.prototype,"preExtrapolation",[Ls],(function(){return fs.CLAMP})),hh=gs(ah.prototype,"postExtrapolation",[Ls],(function(){return fs.CLAMP})),sh=ah))||sh),function(t){t[t.INTERPOLATION_MODE=1]="INTERPOLATION_MODE"}(gh||(gh={}));var Eh,Th=1,Sh=4,Ah=4,Rh=4,Ch=1,bh=1,Ih=255,wh=4,Oh=(t("ObjectCurve",bs("cc.ObjectCurve")(Eh=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.evaluate=function(t){var e=this.searchKeyframe(t);if(e>=0)return this._values[e];var i=Ti(~e-1,0,this._values.length-1);return this._values[i]},e}(ps))||Eh),fe({Blend:0,Fixed:1})),xh=t("ColorKey",(function(){this.color=qi.WHITE.clone(),this.time=0}));ci.fastDefine("cc.ColorKey",xh,{color:qi.WHITE.clone(),time:0}),ci.Attr.setClassAttr(xh,"color","visible",!0),ci.Attr.setClassAttr(xh,"time","visible",!0);var Nh=t("AlphaKey",(function(){this.alpha=1,this.time=0}));ci.fastDefine("cc.AlphaKey",Nh,{alpha:1,time:0}),ci.Attr.setClassAttr(Nh,"alpha","visible",!0),ci.Attr.setClassAttr(Nh,"time","visible",!0);var Dh=t("Gradient",function(){function t(){this.colorKeys=[],this.alphaKeys=[],this.mode=Oh.Blend}var e=t.prototype;return e.setKeys=function(t,e){this.colorKeys=t,this.alphaKeys=e},e.sortKeys=function(){this.colorKeys.length>1&&this.colorKeys.sort((function(t,e){return t.time-e.time})),this.alphaKeys.length>1&&this.alphaKeys.sort((function(t,e){return t.time-e.time}))},e.evaluate=function(t){return this.evaluateFast(new qi,t)},e.evaluateFast=function(t,e){return this.getRGB(t,e),t._set_a_unsafe(this.getAlpha(e)),t},e.randomColor=function(){return this.getRandomColor(new qi)},e.getRandomColor=function(t){var e=this.colorKeys[Math.trunc(Math.random()*this.colorKeys.length)],i=this.alphaKeys[Math.trunc(Math.random()*this.alphaKeys.length)];return t.set(e.color),t._set_a_unsafe(i.alpha),t},e.getRGB=function(t,e){var i=this.colorKeys,n=i.length;if(n>1){e=Mi(e,1+vi);for(var r=1;r<n;++r){var s=i[r-1].time,a=i[r].time;if(e>=s&&e<a){if(this.mode===Oh.Fixed)return qi.copy(t,i[r].color),t;var o=(e-s)/(a-s);return qi.lerp(t,i[r-1].color,i[r].color,o),t}}var h=n-1;Ei(e,i[h].time,vi)?qi.copy(t,i[h].color):e<i[0].time?qi.lerp(t,qi.BLACK,i[0].color,e/i[0].time):e>i[h].time&&qi.lerp(t,i[h].color,qi.BLACK,(e-i[h].time)/(1-i[h].time))}else 1===n?qi.copy(t,i[0].color):qi.copy(t,qi.WHITE);return t},e.getAlpha=function(t){var e=this.alphaKeys,i=e.length;if(i>1){t=Mi(t,1+vi);for(var n=1;n<i;++n){var r=e[n-1].time,s=e[n].time;if(t>=r&&t<s){if(this.mode===Oh.Fixed)return e[n].alpha;var a=(t-r)/(s-r);return Ai(e[n-1].alpha,e[n].alpha,a)}}var o=i-1;return Ei(t,e[o].time,vi)?e[o].alpha:t<e[0].time?Ai(0,e[0].alpha,t/e[0].time):t>e[o].time?Ai(e[o].alpha,0,(t-e[o].time)/(1-e[o].time)):255}return 1===i?e[0].alpha:255},t}());Dh.Mode=Oh,ci.fastDefine("cc.Gradient",Dh,{colorKeys:[],alphaKeys:[],mode:Oh.Blend}),ci.Attr.setClassAttr(Dh,"colorKeys","visible",!0),ci.Attr.setClassAttr(Dh,"alphaKeys","visible",!0),ci.Attr.setClassAttr(Dh,"mode","visible",!0);var Mh=function(){this.time=0,this.value=0,this.inTangent=0,this.outTangent=0};ci.fastDefine("cc.Keyframe",Mh,{time:0,value:0,inTangent:0,outTangent:0});var Ph=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 Lh(t-this.time,this.coefficient)},t}();function Lh(t,e){return t*(t*(t*e[0]+e[1])+e[2])+e[3]}var Bh,Fh,Uh=function(){function t(t){if(void 0===t&&(t=null),this._curve=void 0,this.cachedKey=void 0,t instanceof Lo)this._curve=t;else{var e=new Lo;this._curve=e,e.preExtrapolation=fs.LOOP,e.postExtrapolation=fs.CLAMP,t?e.assignSorted(t.map((function(t){return[t.time,{interpolationMode:_s.CUBIC,value:t.value,leftTangent:t.inTangent,rightTangent:t.outTangent}]}))):e.assignSorted([[0,{interpolationMode:_s.CUBIC,value:1}],[1,{interpolationMode:_s.CUBIC,value:1}]])}this.cachedKey=new Ph}var e=t.prototype;return e.addKey=function(t){t?this._curve.addKeyFrame(t.time,{interpolationMode:_s.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 fs.LOOP:r=Mi(t-a,o-a)+a;break;case fs.PING_PONG:r=Pi(t-a,o-a)+a;break;case fs.CLAMP:default:r=Ti(t,a,o)}if(r>=e.time&&r<e.endTime)return e.evaluate(r);var h=this.findIndex(e,r),u=Math.min(h+1,n);return this.calcOptimizedKey(e,h,u),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,h=this._curve.getKeyframeValue(i),u=h.value,c=h.rightTangent;t.index=e,t.time=n,t.endTime=r;var l=r-n,_=u-a,f=1/(l*l),d=o*l,p=c*l;t.coefficient[0]=(d+p-_-_)*f/l,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 h=r-o;if(h>=0&&i.getKeyframeTime(h-1)<=e)return h-1}for(var u,c=0,l=n;l-c>1;)u=Math.floor((c+l)/2),i.getKeyframeTime(u)>=e?l=u:c=u;return c},n(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 Mh;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:_s.CUBIC,value:t.value,leftTangent:t.inTangent,rightTangent:t.outTangent}]})))}},{key:"preWrapMode",get:function(){return Gh(this._curve.preExtrapolation)},set:function(t){this._curve.preExtrapolation=kh(t)}},{key:"postWrapMode",get:function(){return Gh(this._curve.postExtrapolation)},set:function(t){this._curve.postExtrapolation=kh(t)}}]),t}();function kh(t){switch(t){default:case Bh.Default:case Bh.Normal:case Bh.Clamp:return fs.CLAMP;case Bh.PingPong:return fs.PING_PONG;case Bh.Loop:return fs.LOOP}}function Gh(t){switch(t){default:case fs.LINEAR:case fs.CLAMP:return Bh.Clamp;case fs.PING_PONG:return Bh.PingPong;case fs.LOOP:return Bh.Loop}}Uh.defaultKF=[{time:0,value:1,inTangent:0,outTangent:0},{time:1,value:1,inTangent:0,outTangent:0}],ci.fastDefine("cc.AnimationCurve",Uh,{_curve:null}),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"}(Bh||(Bh={})),function(t){t[t.LINEAR=0]="LINEAR",t[t.BEZIER=1]="BEZIER",t[t.CATMULL_ROM=2]="CATMULL_ROM"}(Fh||(Fh={}));var Hh,zh=4294967295,Vh=new Wi,Wh=new Wi,Xh=new Wi,jh=new Wi,Yh=function(){function t(t,e){void 0===t&&(t=Fh.CATMULL_ROM),void 0===e&&(e=[]),this._type=void 0,this._mode=Fh.CATMULL_ROM,this._knots=[],this._type=Fn.SHAPE_SPLINE,this._mode=t;for(var i=0;i<e.length;i++)this._knots[i]=new Wi(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 Wi(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 Wi(e[i])},e.clearKnots=function(){this._knots.length=0},e.getKnotCount=function(){return this._knots.length},e.addKnot=function(t){this._knots.push(new Wi(t))},e.insertKnot=function(t,e){var i=new Wi(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=zh),e=Ti(e,0,1);var n=this.getSegments();if(0===n)return new Wi(0,0,0);if(i===zh){var r=1/n;i=Math.floor(e/r),e=e%r/r}if(i>=n)return new Wi(this._knots[this._knots.length-1]);switch(this._mode){case Fh.LINEAR:return t.calcLinear(this._knots[i],this._knots[i+1],e);case Fh.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 Fh.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 Wi(0,0,0)}},e.getPoints=function(t,e){if(void 0===e&&(e=zh),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 Fh.LINEAR:case Fh.CATMULL_ROM:return t<2?(j(14300),0):t-1;case Fh.BEZIER:return t<4||t%4!=0?(j(14301),0):t/4}},t.calcLinear=function(t,e,i){var n=new Wi;return Wi.multiplyScalar(Vh,t,1-i),Wi.multiplyScalar(Wh,e,i),Wi.add(n,Vh,Wh),n},t.calcBezier=function(t,e,i,n,r){var s=new Wi,a=1-r;return Wi.multiplyScalar(Vh,t,a*a*a),Wi.multiplyScalar(Wh,e,3*r*a*a),Wi.multiplyScalar(Xh,i,3*r*r*a),Wi.multiplyScalar(jh,n,r*r*r),Wi.add(Vh,Vh,Wh),Wi.add(Xh,Xh,jh),Wi.add(s,Vh,Xh),s},t.calcCatmullRom=function(t,e,i,n,r){var s=new Wi,a=r*r,o=a*r;return Wi.multiplyScalar(Vh,t,-.5*o+a-.5*r),Wi.multiplyScalar(Wh,e,1.5*o-2.5*a+1),Wi.multiplyScalar(Xh,i,-1.5*o+2*a+.5*r),Wi.multiplyScalar(jh,n,.5*o-.5*a),Wi.add(Vh,Vh,Wh),Wi.add(Xh,Xh,jh),Wi.add(s,Vh,Xh),s},n(t,[{key:"type",get:function(){return this._type}},{key:"mode",get:function(){return this._mode}},{key:"knots",get:function(){return this._knots}}]),t}();function Kh(t,e){console.warn(t+" is deprecated, please use "+e+" instead.")}!function(t){t[t.ALL=0]="ALL",t[t.CLOSEST=1]="CLOSEST",t[t.ANY=2]="ANY"}(Hh||(Hh={})),it(Gr,"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 qh=function(t){function e(){var e;return e=t.call(this)||this,Kh("line","Line"),e}return s(e,t),e}(Un),Qh=function(t){function e(){var e;return e=t.call(this)||this,Kh("plane","Plane"),e}return s(e,t),e}(Xr),Zh=function(t){function e(){var e;return e=t.call(this)||this,Kh("ray","Ray"),e}return s(e,t),e}(kn),Jh=function(t){function e(){var e;return e=t.call(this)||this,Kh("triangle","Triangle"),e}return s(e,t),e}(jr),$h=function(t){function e(){var e;return e=t.call(this)||this,Kh("sphere","Sphere"),e}return s(e,t),e}(Qn),tu=function(t){function e(){var e;return e=t.call(this)||this,Kh("aabb","AABB"),e}return s(e,t),e}($r),eu=function(t){function e(){var e;return e=t.call(this)||this,Kh("obb","OBB"),e}return s(e,t),e}(cs),iu=function(t){function e(){var e;return e=t.call(this)||this,Kh("capsule","Capsule"),e}return s(e,t),e}(ts),nu=function(t){function e(){var e;return e=t.call(this)||this,Kh("frustum","Frustum"),e}return s(e,t),e}(as),ru=Object.freeze({__proto__:null,distance:Bn,enums:Fn,intersect:Gr,Line:Un,Plane:Xr,Ray:kn,Triangle:jr,Sphere:Qn,AABB:$r,OBB:cs,Capsule:ts,Frustum:as,Keyframe:Mh,AnimationCurve:Uh,get WrapModeMask(){return Bh},get SplineMode(){return Fh},Spline:Yh,constructLegacyCurveAndConvert:function(){var t=new Lo;return t.assignSorted([[0,{interpolationMode:_s.CUBIC,value:1}],[1,{interpolationMode:_s.CUBIC,value:1}]]),t},OptimizedKey:Ph,evalOptCurve:Lh,get ERaycastMode(){return Hh},line:qh,plane:Qh,ray:Zh,triangle:Jh,sphere:$h,aabb:tu,obb:eu,capsule:iu,frustum:nu});t("geometry",ru);var su=function(){function t(){this._poolHandle=-1,au.addContainer(this)}return t.prototype.destroy=function(){au.removeContainer(this)},t}(),au=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,se(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}()),ou=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}s(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}(su)),hu=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}s(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}},n(e,[{key:"length",get:function(){return this._count}},{key:"data",get:function(){return this._data}}]),e}(su)),uu=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}s(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}(su));t("memop",Object.freeze({__proto__:null,Pool:ou,RecyclePool:hu,CachedArray:uu}));var cu=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(){},n(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}());cu.Priority=fe({LOW:0,MEDIUM:100,HIGH:200,SCHEDULER:1<<31>>>0});var lu=new pt("Scheduler"),_u=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};_u.get=function(t,e,i,n){var r=_u._listEntries.pop();return r?(r.target=t,r.priority=e,r.paused=i,r.markedForDeletion=n):r=new _u(t,e,i,n),r},_u.put=function(t){_u._listEntries.length<20&&(t.target=null,_u._listEntries.push(t))},_u._listEntries=[];var fu=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};fu.get=function(t,e,i,n){var r=fu._hashUpdateEntries.pop();return r?(r.list=t,r.entry=e,r.target=i,r.callback=n):r=new fu(t,e,i,n),r},fu.put=function(t){fu._hashUpdateEntries.length<20&&(t.list=t.entry=t.target=t.callback=null,fu._hashUpdateEntries.push(t))},fu._hashUpdateEntries=[];var du=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};du.get=function(t,e,i,n,r,s){var a=du._hashTimerEntries.pop();return a?(a.timers=t,a.target=e,a.timerIndex=i,a.currentTimer=n,a.currentTimerSalvaged=r,a.paused=s):a=new du(t,e,i,n,r,s),a},du.put=function(t){du._hashTimerEntries.length<20&&(t.timers=t.target=t.currentTimer=null,du._hashTimerEntries.push(t))},du._hashTimerEntries=[];var pu=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}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===g.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}();pu._timers=[],pu.get=function(){return pu._timers.pop()||new pu},pu.put=function(t){pu._timers.length<20&&!t._lock&&(t._scheduler=t._target=t._callback=null,pu._timers.push(t))};var mu=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=It(!0),e._hashForTimers=It(!0),e._currentTarget=null,e._currentTargetSalvaged=!1,e._updateHashLocked=!1,e._arrayForTimers=[],e}s(e,t),e.enableForTarget=function(t){var e=!1;(t.uuid||t.id)&&(e=!0),e||(t.id=lu.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){j(1514);var a=t;t=e,e=a}3!==arguments.length&&4!==arguments.length&&5!==arguments.length||(s=!!n,n=g.macro.REPEAT_FOREVER,r=0),Z(e,1502);var o=e.uuid||e.id;if(o){var h,u,c=this._hashForTimers[o];if(c?c.paused!==s&&j(1511):(c=du.get(null,e,0,null,null,s),this._arrayForTimers.push(c),this._hashForTimers[o]=c),null==c.timers)c.timers=[];else for(u=0;u<c.timers.length;++u)if((h=c.timers[u])&&t===h._callback)return W(1507,h.getInterval(),i),void(h._interval=i);(h=pu.get()).initWithCallback(this,t,e,i,n,r),c.timers.push(h),this._currentTarget===c&&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=_u.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]=fu.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),pu.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++)pu.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(cu.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(cu.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}du.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],_u.put(r),fu.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}(cu));mu.ID="scheduler",g.Scheduler=mu;var gu,vu,yu,Eu={};it(Eu,"vmath",[{name:"vec2",newName:"Vec2",target:Rn,targetName:"math"},{name:"vec3",newName:"Vec3",target:Rn,targetName:"math"},{name:"vec4",newName:"Vec4",target:Rn,targetName:"math"},{name:"quat",newName:"Quat",target:Rn,targetName:"math"},{name:"mat3",newName:"Mat3",target:Rn,targetName:"math"},{name:"mat4",newName:"Mat4",target:Rn,targetName:"math"},{name:"color4",newName:"Color",target:Rn,targetName:"math"},{name:"rect",newName:"Rect",target:Rn,targetName:"math"},{name:"approx",newName:"approx",target:Rn,targetName:"math"},{name:"EPSILON",newName:"EPSILON",target:Rn,targetName:"math"},{name:"equals",newName:"equals",target:Rn,targetName:"math"},{name:"clamp",newName:"clamp",target:Rn,targetName:"math"},{name:"clamp01",newName:"clamp01",target:Rn,targetName:"math"},{name:"lerp",newName:"lerp",target:Rn,targetName:"math"},{name:"toRadian",newName:"toRadian",target:Rn,targetName:"math"},{name:"toDegree",newName:"toDegree",target:Rn,targetName:"math"},{name:"random",newName:"random",target:Rn,targetName:"math"},{name:"randomRange",newName:"randomRange",target:Rn,targetName:"math"},{name:"randomRangeInt",newName:"randomRangeInt",target:Rn,targetName:"math"},{name:"pseudoRandom",newName:"pseudoRandom",target:Rn,targetName:"math"},{name:"pseudoRandomRangeInt",newName:"pseudoRandomRangeInt",target:Rn,targetName:"math"},{name:"nextPow2",newName:"nextPow2",target:Rn,targetName:"math"},{name:"repeat",newName:"repeat",target:Rn,targetName:"math"},{name:"pingPong",newName:"pingPong",target:Rn,targetName:"math"},{name:"inverseLerp",newName:"inverseLerp",target:Rn,targetName:"math"}]),g.vmath=Eu,it(mu.prototype,"Scheduler.prototype",[{name:"enableForTarget",newName:"enableForTarget",target:mu,targetName:"Scheduler"}]),it(mu,"Scheduler",[{name:"PRIORITY_SYSTEM",newName:"System.Priority.SCHEDULER",customGetter:function(){return cu.Priority.SCHEDULER}}]),nt(mu,"Scheduler",[{name:"PRIORITY_NON_SYSTEM",suggest:"Use enum` System.Priority` instead"}]),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}}),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"}(gu||(gu={}));var Tu,Su,Au={};Tu=Au,Su=tt,Object.keys(Su).forEach((function(t){"function"!=typeof Su[t]?Tu[t]=Su[t]:Tu[t]=Su[t].bind(Su)})),Au.tt={},Au.tt.getAudioContext=null===(vu=tt.getAudioContext)||void 0===vu?void 0:vu.bind(tt);var Ru=Au.getSystemInfoSync();Au.getSystemInfoSync=function(){return Ru},null===(yu=Au.onWindowResize)||void 0===yu||yu.call(Au,(function(){Ru=Au.getSystemInfoSync()})),Au.isDevTool="devtools"===Ru.platform,Au.isLandscape=Ru.screenWidth>Ru.screenHeight;var Cu,bu,Iu,wu,Ou=gu.LANDSCAPE_RIGHT;tt.onDeviceOrientationChange((function(t){"landscape"===t.value?Ou=gu.LANDSCAPE_RIGHT:"landscapeReverse"===t.value&&(Ou=gu.LANDSCAPE_LEFT)})),Object.defineProperty(Au,"orientation",{get:function(){return Au.isLandscape?Ou:gu.PORTRAIT}}),Au.onAccelerometerChange=function(t){Au.offAccelerometerChange(),Cu=function(e){var i=e.x,n=e.y;if(Au.isLandscape){var r=Ou===gu.LANDSCAPE_RIGHT?1:-1,s=i;i=-n*r,n=s*r}var a={x:i,y:n,z:e.z};t(a)}},Au.offAccelerometerChange=function(){Cu&&(tt.offAccelerometerChange(Cu),Cu=void 0)},Au.startAccelerometer=function(t){Cu&&tt.onAccelerometerChange(Cu),tt.startAccelerometer(t)},Au.createInnerAudioContext=(bu=tt,Iu={onPlay:!0,onPause:!0,onStop:!0,onSeek:!0},void 0===wu&&(wu=!1),function(){var t=bu.createInnerAudioContext();if(Iu.onPlay){var e=t.play,i=null;Object.defineProperty(t,"onPlay",{configurable:!0,value:function(t){i=t}}),Object.defineProperty(t,"play",{configurable:!0,value:function(){e.call(t),i&&(wu?setTimeout(i,0):i())}})}if(Iu.onPause){var n=t.pause,r=null;Object.defineProperty(t,"onPause",{configurable:!0,value:function(t){r=t}}),Object.defineProperty(t,"pause",{configurable:!0,value:function(){n.call(t),r&&(wu?setTimeout(r,0):r())}})}if(Iu.onStop){var s=t.stop,a=null;Object.defineProperty(t,"onStop",{configurable:!0,value:function(t){a=t}}),Object.defineProperty(t,"stop",{configurable:!0,value:function(){s.call(t),a&&(wu?setTimeout(a,0):a())}})}if(Iu.onSeek){var o=t.seek,h=null;Object.defineProperty(t,"onSeeked",{configurable:!0,value:function(t){h=t}}),Object.defineProperty(t,"seek",{configurable:!0,value:function(e){o.call(t,e),h&&(wu?setTimeout(h,0):h())}})}return t}),Au.getSafeArea=function(){var t=tt.getSystemInfoSync(),e=t.safeArea,i=e.top,n=e.left,r=e.right,s=t.safeArea,a=s.bottom,o=s.width,h=s.height;if("ios"===t.platform&&!Au.isDevTool&&Au.isLandscape){var u=i;i=n,n=u,r-=u}return{top:i,left:n,bottom:a,right:r,width:o,height:h}};var xu=se;function Nu(){}var Du=function(){function t(){this.callback=Nu,this.target=void 0,this.once=!1}var e=t.prototype;return e.set=function(t,e,i){this.callback=t||Nu,this.target=e,this.once=!!i},e.reset=function(){this.target=void 0,this.callback=Nu,this.once=!1},e.check=function(){return!(Sa(this.target)&&!Aa(this.target,!0))},t}(),Mu=new ou((function(){return new Du}),32),Pu=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(),Mu.free(i),xu(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(),Mu.free(i),xu(this.callbackInfos,e),--e)}},e.cancel=function(t){var e=this.callbackInfos[t];e&&(e.reset(),this.isInvoking?this.callbackInfos[t]=null:xu(this.callbackInfos,t),Mu.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(),Mu.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]||xu(this.callbackInfos,t);this.containCanceled=!1},e.clear=function(){this.cancelAll(),this.callbackInfos.length=0,this.isInvoking=!1,this.containCanceled=!1},t}(),Lu=new ou((function(){return new Pu}),16),Bu=t("CallbacksInvoker",function(){function t(){this._callbackTable=It(!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]=Lu.alloc());var s=Mu.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(),Lu.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 h=a.callbackInfos,u=0,c=h.length;u<c;++u){var l=h[u];if(l){var _=l.callback,f=l.target;l.once&&this.off(t,_,f),l.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(),Lu.free(e),delete this._callbackTable[t])}},e._registerOffCallback=function(t){this._offCallback=t},t}());function Fu(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=It(!0),e}s(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=Bu.prototype,n=Object.getOwnPropertyNames(i).concat(Object.getOwnPropertySymbols(i)),r=0;r<n.length;++r){var a=n[r];if(!(a in e.prototype)){var o=Object.getOwnPropertyDescriptor(i,a);o&&Object.defineProperty(e.prototype,a,o)}}return e}var Uu=t("EventTarget",Fu((function(){})));g.EventTarget=Uu;var ku,Gu,Hu,zu,Vu,Wu,Xu,ju=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){oe(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"}(ku||(ku={})),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",t.HINDI="hi"}(Gu||(Gu={})),function(t){t[t.NONE=0]="NONE",t[t.LAN=1]="LAN",t[t.WWAN=2]="WWAN"}(Hu||(Hu={})),function(t){t.UNKNOWN="Unknown",t.IOS="iOS",t.ANDROID="Android",t.WINDOWS="Windows",t.LINUX="Linux",t.OSX="OS X",t.OHOS="OHOS",t.OPENHARMONY="OpenHarmony"}(zu||(zu={})),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.OPENHARMONY="OPENHARMONY",t.WECHAT_GAME="WECHAT_GAME",t.WECHAT_MINI_PROGRAM="WECHAT_MINI_PROGRAM",t.BAIDU_MINI_GAME="BAIDU_MINI_GAME",t.XIAOMI_QUICK_GAME="XIAOMI_QUICK_GAME",t.ALIPAY_MINI_GAME="ALIPAY_MINI_GAME",t.TAOBAO_CREATIVE_APP="TAOBAO_CREATIVE_APP",t.TAOBAO_MINI_GAME="TAOBAO_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"}(Vu||(Vu={})),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.HPE="HPE",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",t.EVENT_HANDHELD="EVENT_HANDHELD",t.WASM="WASM"}(Wu||(Wu={})),Xu=Vu.BYTEDANCE_MINI_GAME;var Yu=new(function(t){function e(){var e,i;(i=t.call(this)||this).networkType=void 0,i.isNative=void 0,i.isBrowser=void 0,i.isMobile=void 0,i.isLittleEndian=void 0,i.platform=void 0,i.language=void 0,i.nativeLanguage=void 0,i.os=void 0,i.osVersion=void 0,i.osMainVersion=void 0,i.browserType=void 0,i.browserVersion=void 0,i.isXR=void 0,i._featureMap=void 0,i._initPromise=void 0;var n,r=Au.getSystemInfoSync();i.networkType=Hu.LAN,i.isNative=!1,i.isBrowser=!1,i.isLittleEndian=(n=new ArrayBuffer(2),new DataView(n).setInt16(0,256,!0),256===new Int16Array(n)[0]),i.nativeLanguage=r.language,i.language=r.language.substr(0,2);var s=r.platform.toLocaleLowerCase();i.os="android"===s?zu.ANDROID:"ios"===s?zu.IOS:"windows"===s?zu.WINDOWS:zu.UNKNOWN;var a=r.system.toLowerCase();"android p"===a&&(a="android p 9.0");var o=/[\d.]+/.exec(a);i.osVersion=o?o[0]:a,i.osMainVersion=parseInt(i.osVersion),i.platform=Xu,i.isMobile=i.os!==zu.WINDOWS,i.browserType=ku.UNKNOWN,i.browserVersion="",i.isXR=!1;return i._featureMap=((e={})[Wu.WEBP]=!1,e[Wu.IMAGE_BITMAP]=!1,e[Wu.WEB_VIEW]=!1,e[Wu.VIDEO_PLAYER]=!1,e[Wu.SAFE_AREA]=!0,e[Wu.HPE]=!1,e[Wu.INPUT_TOUCH]=!0,e[Wu.EVENT_KEYBOARD]=false,e[Wu.EVENT_MOUSE]=false,e[Wu.EVENT_TOUCH]=!0,e[Wu.EVENT_ACCELEROMETER]=!0,e[Wu.EVENT_GAMEPAD]=!1,e[Wu.EVENT_HANDLE]=i.isXR,e[Wu.EVENT_HMD]=i.isXR,e[Wu.EVENT_HANDHELD]=!1,e[Wu.WASM]=!1,e),i._initPromise=[],i._initPromise.push(i._supportsWebpPromise()),i._registerEvent(),i}s(e,t);var i=e.prototype;return i._supportsWebpPromise=function(){var t=this;return this._supportsWebp().then((function(e){t._setFeature(Wu.WEBP,e)}))},i._supportsWebp=function(){return new Promise((function(t){try{var e=document.createElement("img"),i=setTimeout((function(){t(!1)}),500);e.onload=function(){clearTimeout(i);var n=e.width>0&&e.height>0;t(n)},e.onerror=function(){clearTimeout(i),t(!1)},e.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA"}catch(e){t(!1)}}))},i._registerEvent=function(){var t=this;Au.onHide((function(){t.emit("hide")})),Au.onShow((function(){t.emit("show")}))},i._setFeature=function(t,e){return this._featureMap[t]=e},i.init=function(){return Promise.all(this._initPromise)},i.hasFeature=function(t){return this._featureMap[t]},i.getBatteryLevel=function(){return Au.getBatteryInfoSync().level/100},i.triggerGC=function(){var t;null===(t=Au.triggerGC)||void 0===t||t.call(Au)},i.openURL=function(){},i.now=function(){return Date.now?Date.now():+new Date},i.restartJSVM=function(){},i.close=function(){var t;null===(t=Au.exitMiniProgram)||void 0===t||t.call(Au)},e}(Uu)),Ku=/(\.[^\.\/\?\\]*)(\?.*)?$/,qu=/((.*)(\/|\\|\\\\))?(.*?\..*$)?/,Qu=/[^\.\/]+\/\.\.\//;function Zu(){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 Ju(t){var e=Ku.exec(t);return e?e[1]:""}function $u(t){if(t){var e=t.lastIndexOf(".");if(-1!==e)return t.substring(0,e)}return t}function tc(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 ec(t){var e=qu.exec(t);return e?e[2]:""}function ic(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 nc(t,e,i){if(0===e.indexOf("."))return ic(t,e);var n=t.indexOf("?"),r="",s=i?Ju(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 rc(t){var e=t=String(t);do{e=t,t=t.replace(Qu,"")}while(e.length!==t.length);return t}function sc(t){return t.replace(/[\/\\]$/,"")}function ac(){return Yu.os===zu.WINDOWS?"\\":"/"}t("path",Object.freeze({__proto__:null,join:Zu,extname:Ju,mainFileName:$u,basename:tc,dirname:ec,changeExtname:ic,changeBasename:nc,_normalize:rc,stripSep:sc,getSeperator:ac}));var oc=new Wi;function hc(t,e,i,n){n||(n=new Wi),t.convertToUINode(e,i,n);var r=i.position;return n.add(r),n}function uc(t,e,i){return i||(i=new Wi),t.worldToScreen(e,i),i.x/=g.view.getScaleX(),i.y/=g.view.getScaleY(),i}var cc=t("convertUtils",{WorldNode3DToLocalNodeUI:hc,WorldNode3DToWorldNodeUI:uc});g.pipelineUtils=cc,it(g.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]||oc;return n.convertToUINode(e[1],e[2],r),r.add(e[2].position),e[3]||r.clone()}}]),rt(ce,"js",[{name:"js",suggest:"'js.js' is deprecated since v3.7.0, please access 'js' directly instead."}]);var lc=new(function(t){function e(){var e;return(e=t.call(this)||this).isFrameRotated=!1,e.handleResizeEvent=!0,e._cbToUpdateFrameBuffer=void 0,e._resolutionScale=1,e._isProportionalToFrame=!1,e}s(e,t);var i=e.prototype;return i.init=function(t,e){this._cbToUpdateFrameBuffer=e,this._cbToUpdateFrameBuffer()},i.requestFullScreen=function(){return Promise.reject(new Error("request fullscreen is not supported on this platform."))},i.exitFullScreen=function(){return Promise.reject(new Error("exit fullscreen is not supported on this platform."))},n(e,[{key:"supportFullScreen",get:function(){return!1}},{key:"isFullScreen",get:function(){return!1}},{key:"devicePixelRatio",get:function(){return Au.getSystemInfoSync().pixelRatio}},{key:"windowSize",get:function(){var t=Au.getSystemInfoSync(),e=this.devicePixelRatio,i=t.windowWidth,n=t.windowHeight;return i=t.screenWidth,n=t.screenHeight,new vn(i*e,n*e)},set:function(){j(1221)}},{key:"resolution",get:function(){var t=this.windowSize,e=this.resolutionScale;return new vn(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 Au.orientation},set:function(){console.warn("Setting orientation is not supported yet.")}},{key:"safeAreaEdge",get:function(){var t=Au.getSafeArea(),e=this.windowSize,i=this.devicePixelRatio,n=t.top*i,r=e.height-t.bottom*i,s=t.left*i,a=e.width-t.right*i;return this.orientation===gu.PORTRAIT?n<r?n=r:r=n:s<a?s=a:a=s,{top:n,bottom:r,left:s,right:a}}},{key:"isProportionalToFrame",get:function(){return this._isProportionalToFrame},set:function(){}}]),e}(Uu)),_c=function(){function t(){}var e=t.prototype;return e.init=function(){var t,e,i=null===(t=Ee.querySettings(ye.Category.SCREEN,"exactFitScreen"))||void 0===t||t,n=null!==(e=Ee.querySettings(ye.Category.SCREEN,"orientation"))&&void 0!==e?e:"auto",r=3===Ee.querySettings(ye.Category.RENDERING,"renderMode");lc.init({exactFitScreen:i,configOrientation:n,isHeadlessMode:r},(function(){var t,e=g.director;null!==(t=e.root)&&void 0!==t&&t.pipeline?e.root.pipeline.shadingScale=lc.resolutionScale:j(1220)}))},e.fullScreen=function(){return lc.isFullScreen},e.requestFullScreen=function(t,e,i){return arguments.length>0&&j(1400,"screen.requestFullScreen(element, onFullScreenChange?, onFullScreenError?)","screen.requestFullScreen(): Promise"),lc.requestFullScreen().then((function(){null==e||e.call(document)})).catch((function(t){console.error(t),null==i||i.call(document)}))},e.exitFullScreen=function(){return lc.exitFullScreen()},e.autoFullScreen=function(t,e){var i;null===(i=this.requestFullScreen(t,e))||void 0===i||i.catch((function(){}))},e.disableAutoFullScreen=function(){},e.on=function(t,e,i){lc.on(t,e,i)},e.once=function(t,e,i){lc.once(t,e,i)},e.off=function(t,e,i){lc.off(t,e,i)},n(t,[{key:"devicePixelRatio",get:function(){return lc.devicePixelRatio}},{key:"windowSize",get:function(){return lc.windowSize},set:function(t){lc.windowSize=t}},{key:"resolution",get:function(){return lc.resolution}},{key:"supportsFullScreen",get:function(){return lc.supportFullScreen}}]),t}(),fc=t("screen",new _c);g.screen=fc;var dc=t("sys",{Feature:Wu,hasFeature:function(t){return Yu.hasFeature(t)},NetworkType:Hu,Language:Gu,OS:zu,Platform:Vu,BrowserType:ku,isNative:Yu.isNative,isBrowser:Yu.isBrowser,isMobile:Yu.isMobile,isLittleEndian:Yu.isLittleEndian,platform:Yu.platform,language:Yu.language,languageCode:Yu.nativeLanguage,os:Yu.os,osVersion:Yu.osVersion,osMainVersion:Yu.osMainVersion,browserType:Yu.browserType,browserVersion:Yu.browserVersion,isXR:Yu.isXR,windowPixelResolution:fc.windowSize,capabilities:{canvas:!0,opengl:!0,webp:Yu.hasFeature(Wu.WEBP),imageBitmap:Yu.hasFeature(Wu.IMAGE_BITMAP),touches:Yu.hasFeature(Wu.INPUT_TOUCH),mouse:Yu.hasFeature(Wu.EVENT_MOUSE),keyboard:Yu.hasFeature(Wu.EVENT_KEYBOARD),accelerometer:Yu.hasFeature(Wu.EVENT_ACCELEROMETER)},localStorage:{},getNetworkType:function(){return Yu.networkType},getBatteryLevel:function(){return Yu.getBatteryLevel()},garbageCollect:function(){Yu.triggerGC()},isObjectValid:function(t){return null!=t},__isWebIOS14OrIPadOS14Env:!1,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+="supports webp: "+dc.hasFeature(Wu.WEBP)+"\r\n",t+="supports bitmap: "+dc.hasFeature(Wu.IMAGE_BITMAP)+"\r\n",t+="supports touches: "+dc.hasFeature(Wu.INPUT_TOUCH)+"\r\n",t+="supports mouse: "+dc.hasFeature(Wu.EVENT_MOUSE)+"\r\n",t+="supports keyboard: "+dc.hasFeature(Wu.EVENT_KEYBOARD)+"\r\n",t+="supports accelerometer: "+dc.hasFeature(Wu.EVENT_ACCELEROMETER)+"\r\n",t+="os : "+this.os+"\r\n",t+="osVersion : "+this.osVersion+"\r\n",t+="platform : "+this.platform+"\r\n",L(t+="Using "+(g.game.renderType===g.game.RENDER_TYPE_WEBGL?"WEBGL":"CANVAS")+" renderer.\r\n")},openURL:function(t){Yu.openURL(t)},init:function(){var t=this;return Promise.resolve().then((function(){return Yu.init()})).then((function(){try{var e=dc.localStorage=window.localStorage;e.setItem("storage",""),e.removeItem("storage"),e=null}catch(e){var i=function(){j(5200)};t.localStorage={getItem:i,setItem:i,clear:i,removeItem:i,key:i,length:0}}t.__isWebIOS14OrIPadOS14Env=(dc.os===zu.IOS||dc.os===zu.OSX)&&Yu.isBrowser&&/(OS 14)|(Version\/14)/.test(window.navigator.userAgent)}))},now:function(){return Yu.now()},restartVM:function(){Yu.restartJSVM()},getSafeAreaRect:function(){var t=g.view,e=lc.safeAreaEdge,i=lc.windowSize,n=new pn(e.left,e.bottom),r=new pn(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,h=r.y-n.y;return new En(s,a,o,h)}});g.sys=dc,rt(g,"cc",[{name:"winSize",suggest:"please use view.getVisibleSize() instead."}]),rt(dc,"sys",[{name:"capabilities",suggest:"please use sys.hasFeature() method instead."}]),it(dc,"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:dc.Language,targetName:"sys.Language"}}))),it(dc,"sys",["UNKNOWN","IOS","ANDROID","WINDOWS","LINUX","OSX"].map((function(t){return{name:"OS_"+t,newName:t,target:dc.OS,targetName:"sys.OS"}}))),it(dc,"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:dc.BrowserType,targetName:"sys.BrowserType"}}))),it(dc,"sys",[{name:"BROWSER_TYPE_360",newName:"BROWSER_360",target:dc.BrowserType,targetName:"sys.BrowserType"}]),it(dc,"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:dc.Platform,targetName:"sys.Platform"}}))),it(dc,"sys",[{name:"IPHONE",newName:"IOS",target:dc.Platform,targetName:"sys.Platform"},{name:"IPAD",newName:"IOS",target:dc.Platform,targetName:"sys.Platform"}]),nt(dc,"sys",["LINUX","BLACKBERRY","NACL","EMSCRIPTEN","TIZEN","WINRT","WP8","QQ_PLAY","FB_PLAYABLE_ADS"].map((function(t){return{name:t}}))),it(dc,"sys",[{name:"windowPixelResolution",target:fc,targetName:"screen",newName:"windowSize"}]),rt(fc,"screen",[{name:"autoFullScreen",suggest:"please use screen.requestFullScreen() instead."},{name:"disableAutoFullScreen"}]);var pc=t("visibleRect",{topLeft:g.v2(0,0),topRight:g.v2(0,0),top:g.v2(0,0),bottomLeft:g.v2(0,0),bottomRight:g.v2(0,0),bottom:g.v2(0,0),center:g.v2(0,0),left:g.v2(0,0),right:g.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}});g.visibleRect=pc;var mc=String.prototype.charCodeAt;function gc(t){return this[t]}function vc(t,e){for(var i=t.length,n=e^i,r=0,s="string"==typeof t?mc:gc;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}function yc(){}g.easing=Ro,yc.prototype.once=function(t,e,i){return this.on(t,e,i,!0)},yc.prototype.targetOff=function(t){this.removeAll(t)},t("jsbUtils",Object.freeze({__proto__:null,syncNodeValues:function(t){var e=t._lpos;t.setPositionForJS(e.x,e.y,e.z);var i=t._lscale;t.setScaleForJS(i.x,i.y,i.z);var n=t._lrot;t.setRotationForJS(n.x,n.y,n.z,n.w);var r=t._euler;t.setRotationFromEulerForJS(r.x,r.y,r.z)},updateChildrenForDeserialize:function t(e){if(e){var i=e.children;if(i){var n=i.length;if(n){e._setChildren(i);for(var r=0;r<n;++r)t(i[r])}}}},ExtraEventMethods:yc}));var Ec=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}(),Tc=t("garbageCollectionManager",new Ec),Sc=t("GCObject",function(){function t(){return Tc.registerGCObject(this)}return t.prototype.destroy=function(){},t}());function Ac(t,e){for(var i,n=f(e);!(i=n()).done;){var r=i.value;Array.isArray(r)?Ac(t,r):t.push(r)}}function Rc(t){var e=[];return Ac(e,t),e.join("")}g.math=Rn,g.geometry=ru;var Cc,bc,Ic,wc,Oc,xc,Nc,Dc,Mc,Pc,Lc,Bc,Fc,Uc,kc,Gc,Hc,zc,Vc,Wc,Xc,jc,Yc,Kc,qc,Qc,Zc,Jc,$c,tl,el,il,nl,rl,sl,al,ol,hl,ul,cl,ll,_l,fl,dl,pl=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"}(Cc||(Cc={})),function(t){t[t.UNREADY=0]="UNREADY",t[t.FAILED=1]="FAILED",t[t.SUCCESS=2]="SUCCESS"}(bc||(bc={})),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"}(Ic||(Ic={})),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"}(wc||(wc={})),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.SUBPASS_COLOR_INPUT=6]="SUBPASS_COLOR_INPUT",t[t.SUBPASS_DEPTH_STENCIL_INPUT=7]="SUBPASS_DEPTH_STENCIL_INPUT",t[t.RASTERIZATION_ORDER_COHERENT=8]="RASTERIZATION_ORDER_COHERENT",t[t.COUNT=9]="COUNT"}(Oc||(Oc={})),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"}(xc||(xc={})),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"}(Nc||(Nc={})),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"}(Dc||(Dc={})),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"}(Mc||(Mc={})),function(t){t[t.NONE=0]="NONE"}(Pc||(Pc={})),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"}(Lc||(Lc={})),function(t){t[t.NONE=0]="NONE",t[t.DEVICE=1]="DEVICE",t[t.HOST=2]="HOST"}(Bc||(Bc={})),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"}(Fc||(Fc={})),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"}(Uc||(Uc={})),function(t){t[t.NONE=0]="NONE",t[t.GEN_MIPMAP=1]="GEN_MIPMAP",t[t.GENERAL_LAYOUT=2]="GENERAL_LAYOUT",t[t.EXTERNAL_OES=4]="EXTERNAL_OES",t[t.EXTERNAL_NORMAL=8]="EXTERNAL_NORMAL"}(kc||(kc={})),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"}(Gc||(Gc={})),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"}(Hc||(Hc={})),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"}(zc||(zc={})),function(t){t[t.NONE=0]="NONE",t[t.POINT=1]="POINT",t[t.LINEAR=2]="LINEAR",t[t.ANISOTROPIC=3]="ANISOTROPIC"}(Vc||(Vc={})),function(t){t[t.WRAP=0]="WRAP",t[t.MIRROR=1]="MIRROR",t[t.CLAMP=2]="CLAMP",t[t.BORDER=3]="BORDER"}(Wc||(Wc={})),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"}(Xc||(Xc={})),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"}(jc||(jc={})),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"}(Yc||(Yc={})),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"}(Kc||(Kc={})),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"}(qc||(qc={})),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"}(Qc||(Qc={})),function(t){t[t.LOAD=0]="LOAD",t[t.CLEAR=1]="CLEAR",t[t.DISCARD=2]="DISCARD"}(Zc||(Zc={})),function(t){t[t.STORE=0]="STORE",t[t.DISCARD=1]="DISCARD"}(Jc||(Jc={})),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"}($c||($c={})),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"}(tl||(tl={})),function(t){t[t.GRAPHICS=0]="GRAPHICS",t[t.COMPUTE=1]="COMPUTE",t[t.RAY_TRACING=2]="RAY_TRACING"}(el||(el={})),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"}(il||(il={})),function(t){t[t.FILL=0]="FILL",t[t.POINT=1]="POINT",t[t.LINE=2]="LINE"}(nl||(nl={})),function(t){t[t.GOURAND=0]="GOURAND",t[t.FLAT=1]="FLAT"}(rl||(rl={})),function(t){t[t.NONE=0]="NONE",t[t.FRONT=1]="FRONT",t[t.BACK=2]="BACK"}(sl||(sl={})),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"}(al||(al={})),function(t){t[t.FRONT=1]="FRONT",t[t.BACK=2]="BACK",t[t.ALL=3]="ALL"}(ol||(ol={})),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"}(hl||(hl={})),function(t){t[t.GRAPHICS=0]="GRAPHICS",t[t.COMPUTE=1]="COMPUTE",t[t.TRANSFER=2]="TRANSFER"}(ul||(ul={})),function(t){t[t.OCCLUSION=0]="OCCLUSION",t[t.PIPELINE_STATISTICS=1]="PIPELINE_STATISTICS",t[t.TIMESTAMP=2]="TIMESTAMP"}(cl||(cl={})),function(t){t[t.PRIMARY=0]="PRIMARY",t[t.SECONDARY=1]="SECONDARY"}(ll||(ll={})),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"}(_l||(_l={})),function(t){t[t.FULL=0]="FULL",t[t.SPLIT_BEGIN=1]="SPLIT_BEGIN",t[t.SPLIT_END=2]="SPLIT_END"}(fl||(fl={})),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"}(dl||(dl={}));var ml,gl=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}(),vl=function(){function t(t,e,i,n,r,s,a,o,h,u,c,l,_,f,d,p,m,g,v,y,E,T,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),void 0===o&&(o=0),void 0===h&&(h=0),void 0===u&&(u=0),void 0===c&&(c=0),void 0===l&&(l=0),void 0===_&&(_=0),void 0===f&&(f=0),void 0===d&&(d=0),void 0===p&&(p=1),void 0===m&&(m=0),void 0===g&&(g=0),void 0===v&&(v=new gl),void 0===y&&(y=new gl),void 0===E&&(E=!1),void 0===T&&(T=-1),void 0===S&&(S=1),void 0===A&&(A=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=h,this.maxUniformBufferBindings=u,this.maxUniformBlockSize=c,this.maxTextureSize=l,this.maxCubeMapTextureSize=_,this.maxArrayTextureLayers=f,this.max3DTextureSize=d,this.uboOffsetAlignment=p,this.maxComputeSharedMemorySize=m,this.maxComputeWorkGroupInvocations=g,this.maxComputeWorkGroupSize=v,this.maxComputeWorkGroupCount=y,this.supportQuery=E,this.clipSpaceMinZ=T,this.screenSpaceSignY=S,this.clipSpaceSignY=A}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.maxArrayTextureLayers=t.maxArrayTextureLayers,this.max3DTextureSize=t.max3DTextureSize,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}(),yl=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}(),El=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}(),Tl=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}(),Sl=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}(),Al=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}(),Rl=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}(),Cl=function(){function t(t,e,i,n,r){void 0===t&&(t=new Al),void 0===e&&(e=new El),void 0===i&&(i=new Al),void 0===n&&(n=new El),void 0===r&&(r=new Sl),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}(),bl=function(){function t(t,e,i,n,r,s){void 0===t&&(t=new Al),void 0===e&&(e=new El),void 0===i&&(i=new Sl),void 0===n&&(n=new Al),void 0===r&&(r=new El),void 0===s&&(s=new Sl),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}(),Il=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 El),void 0===r&&(r=new Sl),void 0===s&&(s=new Al),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}(),wl=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}(),Ol=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}var e=t.prototype;return e.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},e.set=function(t,e,i,n){return this.x=t,this.y=e,this.z=i,this.w=n,this},t}(),xl=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}(),Nl=function(){function t(t,e,i,n,r){void 0===t&&(t=0),void 0===e&&(e=null),void 0===i&&(i=zc.ON),void 0===n&&(n=0),void 0===r&&(r=0),this.windowId=t,this.windowHandle=e,this.vsyncMode=i,this.width=n,this.height=r}return t.prototype.copy=function(t){return this.windowId=t.windowId,this.windowHandle=t.windowHandle,this.vsyncMode=t.vsyncMode,this.width=t.width,this.height=t.height,this},t}(),Dl=function(){function t(t){void 0===t&&(t=new xl),this.bindingMappingInfo=t}return t.prototype.copy=function(t){return this.bindingMappingInfo.copy(t.bindingMappingInfo),this},t}(),Ml=function(){function t(t,e,i,n,r){void 0===t&&(t=Mc.NONE),void 0===e&&(e=Bc.NONE),void 0===i&&(i=0),void 0===n&&(n=1),void 0===r&&(r=Pc.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}(),Pl=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}(),Ll=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}(),Bl=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}(),Fl=function(){function t(t){void 0===t&&(t=[]),this.drawInfos=t}return t.prototype.copy=function(t){return pl(this.drawInfos,t.drawInfos,Ll),this},t}(),Ul=function(){function t(t,e,i,n,r,s,a,o,h,u,c){void 0===t&&(t=Fc.TEX2D),void 0===e&&(e=Uc.NONE),void 0===i&&(i=xc.UNKNOWN),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=kc.NONE),void 0===a&&(a=1),void 0===o&&(o=1),void 0===h&&(h=Hc.ONE),void 0===u&&(u=1),void 0===c&&(c=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=h,this.depth=u,this.externalRes=c}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}(),kl=function(){function t(t,e,i,n,r,s,a){void 0===t&&(t=null),void 0===e&&(e=Fc.TEX2D),void 0===i&&(i=xc.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}(),Gl=function(){function t(t,e,i,n,r,s,a,o){void 0===t&&(t=Vc.LINEAR),void 0===e&&(e=Vc.LINEAR),void 0===i&&(i=Vc.NONE),void 0===n&&(n=Wc.WRAP),void 0===r&&(r=Wc.WRAP),void 0===s&&(s=Wc.WRAP),void 0===a&&(a=0),void 0===o&&(o=Xc.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}(),Hl=function(){function t(t,e,i){void 0===t&&(t=""),void 0===e&&(e=Dc.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}(),zl=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=[]),void 0===r&&(r=0),void 0===s&&(s=0),this.set=t,this.binding=e,this.name=i,this.members=n,this.count=r,this.flattened=s}return t.prototype.copy=function(t){return this.set=t.set,this.binding=t.binding,this.name=t.name,pl(this.members,t.members,Hl),this.count=t.count,this.flattened=t.flattened,this},t}(),Vl=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=Dc.UNKNOWN),void 0===r&&(r=0),void 0===s&&(s=0),this.set=t,this.binding=e,this.name=i,this.type=n,this.count=r,this.flattened=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.flattened=t.flattened,this},t}(),Wl=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=0),this.set=t,this.binding=e,this.name=i,this.count=n,this.flattened=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.flattened=t.flattened,this},t}(),Xl=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=Dc.UNKNOWN),void 0===r&&(r=0),void 0===s&&(s=0),this.set=t,this.binding=e,this.name=i,this.type=n,this.count=r,this.flattened=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.flattened=t.flattened,this},t}(),jl=function(){function t(t,e,i,n,r,s,a){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=""),void 0===n&&(n=Dc.UNKNOWN),void 0===r&&(r=0),void 0===s&&(s=Lc.READ_WRITE),void 0===a&&(a=0),this.set=t,this.binding=e,this.name=i,this.type=n,this.count=r,this.memoryAccess=s,this.flattened=a}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.flattened=t.flattened,this},t}(),Yl=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=0),void 0===r&&(r=Lc.READ_WRITE),void 0===s&&(s=0),this.set=t,this.binding=e,this.name=i,this.count=n,this.memoryAccess=r,this.flattened=s}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.flattened=t.flattened,this},t}(),Kl=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=0),this.set=t,this.binding=e,this.name=i,this.count=n,this.flattened=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.flattened=t.flattened,this},t}(),ql=function(){function t(t,e){void 0===t&&(t=Qc.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}(),Ql=function(){function t(t,e,i,n,r,s){void 0===t&&(t=""),void 0===e&&(e=xc.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}(),Zl=function(){function t(t,e,i,n,r,s,a,o,h,u){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===h&&(h=[]),void 0===u&&(u=[]),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=h,this.subpassInputs=u}return t.prototype.copy=function(t){return this.name=t.name,pl(this.stages,t.stages,ql),pl(this.attributes,t.attributes,Ql),pl(this.blocks,t.blocks,zl),pl(this.buffers,t.buffers,Yl),pl(this.samplerTextures,t.samplerTextures,Vl),pl(this.samplers,t.samplers,Wl),pl(this.textures,t.textures,Xl),pl(this.images,t.images,jl),pl(this.subpassInputs,t.subpassInputs,Kl),this},t}(),Jl=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 pl(this.attributes,t.attributes,Ql),this.vertexBuffers=t.vertexBuffers.slice(),this.indexBuffer=t.indexBuffer,this.indirectBuffer=t.indirectBuffer,this},t}(),$l=function(){function t(t,e,i,n,r){void 0===t&&(t=xc.UNKNOWN),void 0===e&&(e=Hc.ONE),void 0===i&&(i=Zc.CLEAR),void 0===n&&(n=Jc.STORE),void 0===r&&(r=null),this.format=t,this.sampleCount=e,this.loadOp=i,this.storeOp=n,this.barrier=r}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},t}(),t_=function(){function t(t,e,i,n,r,s,a){void 0===t&&(t=xc.UNKNOWN),void 0===e&&(e=Hc.ONE),void 0===i&&(i=Zc.CLEAR),void 0===n&&(n=Jc.STORE),void 0===r&&(r=Zc.CLEAR),void 0===s&&(s=Jc.STORE),void 0===a&&(a=null),this.format=t,this.sampleCount=e,this.depthLoadOp=i,this.depthStoreOp=n,this.stencilLoadOp=r,this.stencilStoreOp=s,this.barrier=a}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},t}(),e_=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=tl.NONE),void 0===o&&(o=tl.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}(),i_=function(){function t(t,e,i,n,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=null),void 0===n&&(n=[$c.NONE]),void 0===r&&(r=[$c.NONE]),this.srcSubpass=t,this.dstSubpass=e,this.generalBarrier=i,this.prevAccesses=n,this.nextAccesses=r}return t.prototype.copy=function(t){return this.srcSubpass=t.srcSubpass,this.dstSubpass=t.dstSubpass,this.generalBarrier=t.generalBarrier,this.prevAccesses=t.prevAccesses.slice(),this.nextAccesses=t.nextAccesses.slice(),this},t}(),n_=function(){function t(t,e,i,n){void 0===t&&(t=[]),void 0===e&&(e=new t_),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 pl(this.colorAttachments,t.colorAttachments,$l),this.depthStencilAttachment.copy(t.depthStencilAttachment),pl(this.subpasses,t.subpasses,e_),pl(this.dependencies,t.dependencies,i_),this},t}(),r_=function(){function t(t,e,i){void 0===t&&(t=$c.NONE),void 0===e&&(e=$c.NONE),void 0===i&&(i=fl.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}(),s_=function(){function t(t,e,i,n,r,s,a,o,h,u){void 0===t&&(t=$c.NONE),void 0===e&&(e=$c.NONE),void 0===i&&(i=fl.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===h&&(h=null),void 0===u&&(u=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=h,this.dstQueue=u}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}(),a_=function(){function t(t,e,i,n,r,s,a,o){void 0===t&&(t=$c.NONE),void 0===e&&(e=$c.NONE),void 0===i&&(i=fl.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}(),o_=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}(),h_=function(){function t(t,e,i,n,r){void 0===t&&(t=-1),void 0===e&&(e=hl.UNKNOWN),void 0===i&&(i=0),void 0===n&&(n=Qc.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}(),u_=function(){function t(t){void 0===t&&(t=[]),this.bindings=t}return t.prototype.copy=function(t){return pl(this.bindings,t.bindings,h_),this},t}(),c_=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}(),l_=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}(),__=function(){function t(t){void 0===t&&(t=[]),this.attributes=t}return t.prototype.copy=function(t){return pl(this.attributes,t.attributes,Ql),this},t}(),f_=function(){function t(t,e){void 0===t&&(t=null),void 0===e&&(e=ll.PRIMARY),this.queue=t,this.type=e}return t.prototype.copy=function(t){return this.queue=t.queue,this.type=t.type,this},t}(),d_=function(){function t(t){void 0===t&&(t=ul.GRAPHICS),this.type=t}return t.prototype.copy=function(t){return this.type=t.type,this},t}(),p_=function(){function t(t,e,i){void 0===t&&(t=cl.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}(),m_=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=Nc.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},g_=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}(),v_=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}(),y_=function(){function t(t,e,i,n,r,s,a,o,h,u,c){void 0===t&&(t=new wl),void 0===e&&(e=new Tl),void 0===i&&(i=new Ol),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===h&&(h=0),void 0===u&&(u=new v_),void 0===c&&(c=new v_),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=h,this.stencilStatesFront=u,this.stencilStatesBack=c}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}(),E_=function(t){function e(i){var n;return(n=t.call(this)||this)._objectType=Cc.UNKNOWN,n._objectID=0,n._typedID=0,n._objectType=i,n._objectID=e._idTable[Cc.UNKNOWN]++,n._typedID=e._idTable[i]++,n}return s(e,t),n(e,[{key:"objectType",get:function(){return this._objectType}},{key:"objectID",get:function(){return this._objectID}},{key:"typedID",get:function(){return this._typedID}}]),e}(Sc);E_._idTable=Array(Cc.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"}(ml||(ml={}));var T_=Object.freeze([new m_("UNKNOWN",0,0,Nc.NONE,!1,!1,!1,!1),new m_("A8",1,1,Nc.UNORM,!0,!1,!1,!1),new m_("L8",1,1,Nc.UNORM,!1,!1,!1,!1),new m_("LA8",1,2,Nc.UNORM,!0,!1,!1,!1),new m_("R8",1,1,Nc.UNORM,!1,!1,!1,!1),new m_("R8SN",1,1,Nc.SNORM,!1,!1,!1,!1),new m_("R8UI",1,1,Nc.UINT,!1,!1,!1,!1),new m_("R8I",1,1,Nc.INT,!1,!1,!1,!1),new m_("R16F",2,1,Nc.FLOAT,!1,!1,!1,!1),new m_("R16UI",2,1,Nc.UINT,!1,!1,!1,!1),new m_("R16I",2,1,Nc.INT,!1,!1,!1,!1),new m_("R32F",4,1,Nc.FLOAT,!1,!1,!1,!1),new m_("R32UI",4,1,Nc.UINT,!1,!1,!1,!1),new m_("R32I",4,1,Nc.INT,!1,!1,!1,!1),new m_("RG8",2,2,Nc.UNORM,!1,!1,!1,!1),new m_("RG8SN",2,2,Nc.SNORM,!1,!1,!1,!1),new m_("RG8UI",2,2,Nc.UINT,!1,!1,!1,!1),new m_("RG8I",2,2,Nc.INT,!1,!1,!1,!1),new m_("RG16F",4,2,Nc.FLOAT,!1,!1,!1,!1),new m_("RG16UI",4,2,Nc.UINT,!1,!1,!1,!1),new m_("RG16I",4,2,Nc.INT,!1,!1,!1,!1),new m_("RG32F",8,2,Nc.FLOAT,!1,!1,!1,!1),new m_("RG32UI",8,2,Nc.UINT,!1,!1,!1,!1),new m_("RG32I",8,2,Nc.INT,!1,!1,!1,!1),new m_("RGB8",3,3,Nc.UNORM,!1,!1,!1,!1),new m_("SRGB8",3,3,Nc.UNORM,!1,!1,!1,!1),new m_("RGB8SN",3,3,Nc.SNORM,!1,!1,!1,!1),new m_("RGB8UI",3,3,Nc.UINT,!1,!1,!1,!1),new m_("RGB8I",3,3,Nc.INT,!1,!1,!1,!1),new m_("RGB16F",6,3,Nc.FLOAT,!1,!1,!1,!1),new m_("RGB16UI",6,3,Nc.UINT,!1,!1,!1,!1),new m_("RGB16I",6,3,Nc.INT,!1,!1,!1,!1),new m_("RGB32F",12,3,Nc.FLOAT,!1,!1,!1,!1),new m_("RGB32UI",12,3,Nc.UINT,!1,!1,!1,!1),new m_("RGB32I",12,3,Nc.INT,!1,!1,!1,!1),new m_("RGBA8",4,4,Nc.UNORM,!0,!1,!1,!1),new m_("BGRA8",4,4,Nc.UNORM,!0,!1,!1,!1),new m_("SRGB8_A8",4,4,Nc.UNORM,!0,!1,!1,!1),new m_("RGBA8SN",4,4,Nc.SNORM,!0,!1,!1,!1),new m_("RGBA8UI",4,4,Nc.UINT,!0,!1,!1,!1),new m_("RGBA8I",4,4,Nc.INT,!0,!1,!1,!1),new m_("RGBA16F",8,4,Nc.FLOAT,!0,!1,!1,!1),new m_("RGBA16UI",8,4,Nc.UINT,!0,!1,!1,!1),new m_("RGBA16I",8,4,Nc.INT,!0,!1,!1,!1),new m_("RGBA32F",16,4,Nc.FLOAT,!0,!1,!1,!1),new m_("RGBA32UI",16,4,Nc.UINT,!0,!1,!1,!1),new m_("RGBA32I",16,4,Nc.INT,!0,!1,!1,!1),new m_("R5G6B5",2,3,Nc.UNORM,!1,!1,!1,!1),new m_("R11G11B10F",4,3,Nc.FLOAT,!1,!1,!1,!1),new m_("RGB5A1",2,4,Nc.UNORM,!0,!1,!1,!1),new m_("RGBA4",2,4,Nc.UNORM,!0,!1,!1,!1),new m_("RGB10A2",2,4,Nc.UNORM,!0,!1,!1,!1),new m_("RGB10A2UI",2,4,Nc.UINT,!0,!1,!1,!1),new m_("RGB9E5",2,4,Nc.FLOAT,!0,!1,!1,!1),new m_("DEPTH",4,1,Nc.FLOAT,!1,!0,!1,!1),new m_("DEPTH_STENCIL",5,2,Nc.FLOAT,!1,!0,!0,!1),new m_("BC1",1,3,Nc.UNORM,!1,!1,!1,!0),new m_("BC1_ALPHA",1,4,Nc.UNORM,!0,!1,!1,!0),new m_("BC1_SRGB",1,3,Nc.UNORM,!1,!1,!1,!0),new m_("BC1_SRGB_ALPHA",1,4,Nc.UNORM,!0,!1,!1,!0),new m_("BC2",1,4,Nc.UNORM,!0,!1,!1,!0),new m_("BC2_SRGB",1,4,Nc.UNORM,!0,!1,!1,!0),new m_("BC3",1,4,Nc.UNORM,!0,!1,!1,!0),new m_("BC3_SRGB",1,4,Nc.UNORM,!0,!1,!1,!0),new m_("BC4",1,1,Nc.UNORM,!1,!1,!1,!0),new m_("BC4_SNORM",1,1,Nc.SNORM,!1,!1,!1,!0),new m_("BC5",1,2,Nc.UNORM,!1,!1,!1,!0),new m_("BC5_SNORM",1,2,Nc.SNORM,!1,!1,!1,!0),new m_("BC6H_UF16",1,3,Nc.UFLOAT,!1,!1,!1,!0),new m_("BC6H_SF16",1,3,Nc.FLOAT,!1,!1,!1,!0),new m_("BC7",1,4,Nc.UNORM,!0,!1,!1,!0),new m_("BC7_SRGB",1,4,Nc.UNORM,!0,!1,!1,!0),new m_("ETC_RGB8",1,3,Nc.UNORM,!1,!1,!1,!0),new m_("ETC2_RGB8",1,3,Nc.UNORM,!1,!1,!1,!0),new m_("ETC2_SRGB8",1,3,Nc.UNORM,!1,!1,!1,!0),new m_("ETC2_RGB8_A1",1,4,Nc.UNORM,!0,!1,!1,!0),new m_("ETC2_SRGB8_A1",1,4,Nc.UNORM,!0,!1,!1,!0),new m_("ETC2_RGBA8",2,4,Nc.UNORM,!0,!1,!1,!0),new m_("ETC2_SRGB8_A8",2,4,Nc.UNORM,!0,!1,!1,!0),new m_("EAC_R11",1,1,Nc.UNORM,!1,!1,!1,!0),new m_("EAC_R11SN",1,1,Nc.SNORM,!1,!1,!1,!0),new m_("EAC_RG11",2,2,Nc.UNORM,!1,!1,!1,!0),new m_("EAC_RG11SN",2,2,Nc.SNORM,!1,!1,!1,!0),new m_("PVRTC_RGB2",2,3,Nc.UNORM,!1,!1,!1,!0),new m_("PVRTC_RGBA2",2,4,Nc.UNORM,!0,!1,!1,!0),new m_("PVRTC_RGB4",2,3,Nc.UNORM,!1,!1,!1,!0),new m_("PVRTC_RGBA4",2,4,Nc.UNORM,!0,!1,!1,!0),new m_("PVRTC2_2BPP",2,4,Nc.UNORM,!0,!1,!1,!0),new m_("PVRTC2_4BPP",2,4,Nc.UNORM,!0,!1,!1,!0),new m_("ASTC_RGBA_4x4",1,4,Nc.UNORM,!0,!1,!1,!0),new m_("ASTC_RGBA_5x4",1,4,Nc.UNORM,!0,!1,!1,!0),new m_("ASTC_RGBA_5x5",1,4,Nc.UNORM,!0,!1,!1,!0),new m_("ASTC_RGBA_6x5",1,4,Nc.UNORM,!0,!1,!1,!0),new m_("ASTC_RGBA_6x6",1,4,Nc.UNORM,!0,!1,!1,!0),new m_("ASTC_RGBA_8x5",1,4,Nc.UNORM,!0,!1,!1,!0),new m_("ASTC_RGBA_8x6",1,4,Nc.UNORM,!0,!1,!1,!0),new m_("ASTC_RGBA_8x8",1,4,Nc.UNORM,!0,!1,!1,!0),new m_("ASTC_RGBA_10x5",1,4,Nc.UNORM,!0,!1,!1,!0),new m_("ASTC_RGBA_10x6",1,4,Nc.UNORM,!0,!1,!1,!0),new m_("ASTC_RGBA_10x8",1,4,Nc.UNORM,!0,!1,!1,!0),new m_("ASTC_RGBA_10x10",1,4,Nc.UNORM,!0,!1,!1,!0),new m_("ASTC_RGBA_12x10",1,4,Nc.UNORM,!0,!1,!1,!0),new m_("ASTC_RGBA_12x12",1,4,Nc.UNORM,!0,!1,!1,!0),new m_("ASTC_SRGBA_4x4",1,4,Nc.UNORM,!0,!1,!1,!0),new m_("ASTC_SRGBA_5x4",1,4,Nc.UNORM,!0,!1,!1,!0),new m_("ASTC_SRGBA_5x5",1,4,Nc.UNORM,!0,!1,!1,!0),new m_("ASTC_SRGBA_6x5",1,4,Nc.UNORM,!0,!1,!1,!0),new m_("ASTC_SRGBA_6x6",1,4,Nc.UNORM,!0,!1,!1,!0),new m_("ASTC_SRGBA_8x5",1,4,Nc.UNORM,!0,!1,!1,!0),new m_("ASTC_SRGBA_8x6",1,4,Nc.UNORM,!0,!1,!1,!0),new m_("ASTC_SRGBA_8x8",1,4,Nc.UNORM,!0,!1,!1,!0),new m_("ASTC_SRGBA_10x5",1,4,Nc.UNORM,!0,!1,!1,!0),new m_("ASTC_SRGBA_10x6",1,4,Nc.UNORM,!0,!1,!1,!0),new m_("ASTC_SRGBA_10x8",1,4,Nc.UNORM,!0,!1,!1,!0),new m_("ASTC_SRGBA_10x10",1,4,Nc.UNORM,!0,!1,!1,!0),new m_("ASTC_SRGBA_12x10",1,4,Nc.UNORM,!0,!1,!1,!0),new m_("ASTC_SRGBA_12x12",1,4,Nc.UNORM,!0,!1,!1,!0)]),S_=hl.UNIFORM_BUFFER|hl.DYNAMIC_UNIFORM_BUFFER|hl.STORAGE_BUFFER|hl.DYNAMIC_STORAGE_BUFFER,A_=hl.SAMPLER_TEXTURE|hl.SAMPLER|hl.TEXTURE|hl.STORAGE_IMAGE|hl.INPUT_ATTACHMENT,R_=hl.DYNAMIC_STORAGE_BUFFER|hl.DYNAMIC_UNIFORM_BUFFER;function C_(t){return t>0&&0==(t&t-1)}function b_(t,e,i,n){if(!T_[t].isCompressed)return e*i*n*T_[t].size;switch(t){case xc.BC1:case xc.BC1_ALPHA:case xc.BC1_SRGB:case xc.BC1_SRGB_ALPHA:return Math.ceil(e/4)*Math.ceil(i/4)*8*n;case xc.BC2:case xc.BC2_SRGB:case xc.BC3:case xc.BC3_SRGB:case xc.BC4:case xc.BC4_SNORM:case xc.BC6H_SF16:case xc.BC6H_UF16:case xc.BC7:case xc.BC7_SRGB:return Math.ceil(e/4)*Math.ceil(i/4)*16*n;case xc.BC5:case xc.BC5_SNORM:return Math.ceil(e/4)*Math.ceil(i/4)*32*n;case xc.ETC_RGB8:case xc.ETC2_RGB8:case xc.ETC2_SRGB8:case xc.ETC2_RGB8_A1:case xc.EAC_R11:case xc.EAC_R11SN:return Math.ceil(e/4)*Math.ceil(i/4)*8*n;case xc.ETC2_RGBA8:case xc.ETC2_SRGB8_A1:case xc.EAC_RG11:case xc.EAC_RG11SN:return Math.ceil(e/4)*Math.ceil(i/4)*16*n;case xc.PVRTC_RGB2:case xc.PVRTC_RGBA2:case xc.PVRTC2_2BPP:return Math.ceil(e/8)*Math.ceil(i/4)*8*n;case xc.PVRTC_RGB4:case xc.PVRTC_RGBA4:case xc.PVRTC2_4BPP:return Math.ceil(e/4)*Math.ceil(i/4)*8*n;case xc.ASTC_RGBA_4X4:case xc.ASTC_SRGBA_4X4:return Math.ceil(e/4)*Math.ceil(i/4)*16*n;case xc.ASTC_RGBA_5X4:case xc.ASTC_SRGBA_5X4:return Math.ceil(e/5)*Math.ceil(i/4)*16*n;case xc.ASTC_RGBA_5X5:case xc.ASTC_SRGBA_5X5:return Math.ceil(e/5)*Math.ceil(i/5)*16*n;case xc.ASTC_RGBA_6X5:case xc.ASTC_SRGBA_6X5:return Math.ceil(e/6)*Math.ceil(i/5)*16*n;case xc.ASTC_RGBA_6X6:case xc.ASTC_SRGBA_6X6:return Math.ceil(e/6)*Math.ceil(i/6)*16*n;case xc.ASTC_RGBA_8X5:case xc.ASTC_SRGBA_8X5:return Math.ceil(e/8)*Math.ceil(i/5)*16*n;case xc.ASTC_RGBA_8X6:case xc.ASTC_SRGBA_8X6:return Math.ceil(e/8)*Math.ceil(i/6)*16*n;case xc.ASTC_RGBA_8X8:case xc.ASTC_SRGBA_8X8:return Math.ceil(e/8)*Math.ceil(i/8)*16*n;case xc.ASTC_RGBA_10X5:case xc.ASTC_SRGBA_10X5:return Math.ceil(e/10)*Math.ceil(i/5)*16*n;case xc.ASTC_RGBA_10X6:case xc.ASTC_SRGBA_10X6:return Math.ceil(e/10)*Math.ceil(i/6)*16*n;case xc.ASTC_RGBA_10X8:case xc.ASTC_SRGBA_10X8:return Math.ceil(e/10)*Math.ceil(i/8)*16*n;case xc.ASTC_RGBA_10X10:case xc.ASTC_SRGBA_10X10:return Math.ceil(e/10)*Math.ceil(i/10)*16*n;case xc.ASTC_RGBA_12X10:case xc.ASTC_SRGBA_12X10:return Math.ceil(e/12)*Math.ceil(i/10)*16*n;case xc.ASTC_RGBA_12X12:case xc.ASTC_SRGBA_12X12:return Math.ceil(e/12)*Math.ceil(i/12)*16*n;default:return 0}}function I_(t,e,i,n,r){for(var s=0,a=0;a<r;++a)s+=b_(t,e,i,n),e=Math.max(e>>1,1),i=Math.max(i>>1,1);return s}var w_=[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 O_(t){return w_[t]||0}function x_(t){if(t.isCompressed)return Uint8Array;var e=t.size/t.count;switch(t.type){case Nc.UNORM:case Nc.UINT:switch(e){case 1:return Uint8Array;case 2:return Uint16Array;case 4:return Uint32Array;default:return Uint8Array}case Nc.SNORM:case Nc.INT:switch(e){case 1:return Int8Array;case 2:return Int16Array;case 4:return Int32Array;default:return Int8Array}case Nc.FLOAT:return Float32Array}return Float32Array}function N_(t){switch(t){case xc.BC1:case xc.BC1_ALPHA:case xc.BC1_SRGB:case xc.BC1_SRGB_ALPHA:case xc.BC2:case xc.BC2_SRGB:case xc.BC3:case xc.BC3_SRGB:case xc.BC4:case xc.BC4_SNORM:case xc.BC6H_SF16:case xc.BC6H_UF16:case xc.BC7:case xc.BC7_SRGB:case xc.BC5:case xc.BC5_SNORM:case xc.ETC_RGB8:case xc.ETC2_RGB8:case xc.ETC2_SRGB8:case xc.ETC2_RGB8_A1:case xc.EAC_R11:case xc.EAC_R11SN:case xc.ETC2_RGBA8:case xc.ETC2_SRGB8_A1:case xc.EAC_RG11:case xc.EAC_RG11SN:return{width:4,height:4};case xc.PVRTC_RGB2:case xc.PVRTC_RGBA2:case xc.PVRTC2_2BPP:return{width:8,height:4};case xc.PVRTC_RGB4:case xc.PVRTC_RGBA4:case xc.PVRTC2_4BPP:return{width:4,height:4};case xc.ASTC_RGBA_4X4:case xc.ASTC_SRGBA_4X4:return{width:4,height:4};case xc.ASTC_RGBA_5X4:case xc.ASTC_SRGBA_5X4:return{width:5,height:4};case xc.ASTC_RGBA_5X5:case xc.ASTC_SRGBA_5X5:return{width:5,height:5};case xc.ASTC_RGBA_6X5:case xc.ASTC_SRGBA_6X5:return{width:6,height:5};case xc.ASTC_RGBA_6X6:case xc.ASTC_SRGBA_6X6:return{width:6,height:6};case xc.ASTC_RGBA_8X5:case xc.ASTC_SRGBA_8X5:return{width:8,height:5};case xc.ASTC_RGBA_8X6:case xc.ASTC_SRGBA_8X6:return{width:8,height:6};case xc.ASTC_RGBA_8X8:case xc.ASTC_SRGBA_8X8:return{width:8,height:8};case xc.ASTC_RGBA_10X5:case xc.ASTC_SRGBA_10X5:return{width:10,height:5};case xc.ASTC_RGBA_10X6:case xc.ASTC_SRGBA_10X6:return{width:10,height:6};case xc.ASTC_RGBA_10X8:case xc.ASTC_SRGBA_10X8:return{width:10,height:8};case xc.ASTC_RGBA_10X10:case xc.ASTC_SRGBA_10X10:return{width:10,height:10};case xc.ASTC_RGBA_12X10:case xc.ASTC_SRGBA_12X10:return{width:12,height:10};case xc.ASTC_RGBA_12X12:case xc.ASTC_SRGBA_12X12:return{width:12,height:12};default:return{width:1,height:1}}}function D_(t,e){return Math.ceil(t/e)*e}var M_=Object.freeze({__proto__:null,get ObjectType(){return Cc},get Status(){return bc},get API(){return Ic},get SurfaceTransform(){return wc},get Feature(){return Oc},get Format(){return xc},get FormatType(){return Nc},get Type(){return Dc},get BufferUsageBit(){return Mc},get BufferFlagBit(){return Pc},get MemoryAccessBit(){return Lc},get MemoryUsageBit(){return Bc},get TextureType(){return Fc},get TextureUsageBit(){return Uc},get TextureFlagBit(){return kc},get FormatFeatureBit(){return Gc},get SampleCount(){return Hc},get VsyncMode(){return zc},get Filter(){return Vc},get Address(){return Wc},get ComparisonFunc(){return Xc},get StencilOp(){return jc},get BlendFactor(){return Yc},get BlendOp(){return Kc},get ColorMask(){return qc},get ShaderStageFlagBit(){return Qc},get LoadOp(){return Zc},get StoreOp(){return Jc},get AccessFlagBit(){return $c},get ResolveMode(){return tl},get PipelineBindPoint(){return el},get PrimitiveMode(){return il},get PolygonMode(){return nl},get ShadeModel(){return rl},get CullMode(){return sl},get DynamicStateFlagBit(){return al},get StencilFace(){return ol},get DescriptorType(){return hl},get QueueType(){return ul},get QueryType(){return cl},get CommandBufferType(){return ll},get ClearFlagBit(){return _l},get BarrierType(){return fl},get PassType(){return dl},Size:gl,DeviceCaps:vl,DeviceOptions:yl,Offset:El,Rect:Tl,Extent:Sl,TextureSubresLayers:Al,TextureSubresRange:Rl,TextureCopy:Cl,TextureBlit:bl,BufferTextureCopy:Il,Viewport:wl,Color:Ol,BindingMappingInfo:xl,SwapchainInfo:Nl,DeviceInfo:Dl,BufferInfo:Ml,BufferViewInfo:Pl,DrawInfo:Ll,DispatchInfo:Bl,IndirectBuffer:Fl,TextureInfo:Ul,TextureViewInfo:kl,SamplerInfo:Gl,Uniform:Hl,UniformBlock:zl,UniformSamplerTexture:Vl,UniformSampler:Wl,UniformTexture:Xl,UniformStorageImage:jl,UniformStorageBuffer:Yl,UniformInputAttachment:Kl,ShaderStage:ql,Attribute:Ql,ShaderInfo:Zl,InputAssemblerInfo:Jl,ColorAttachment:$l,DepthStencilAttachment:t_,SubpassInfo:e_,SubpassDependency:i_,RenderPassInfo:n_,GeneralBarrierInfo:r_,TextureBarrierInfo:s_,BufferBarrierInfo:a_,FramebufferInfo:o_,DescriptorSetLayoutBinding:h_,DescriptorSetLayoutInfo:u_,DescriptorSetInfo:c_,PipelineLayoutInfo:l_,InputState:__,CommandBufferInfo:f_,QueueInfo:d_,QueryPoolInfo:p_,FormatInfo:m_,MemoryStatus:g_,DynamicStencilStates:v_,DynamicStates:y_,GFXObject:E_,get AttributeName(){return ml},FormatInfos:T_,DESCRIPTOR_BUFFER_TYPE:S_,DESCRIPTOR_SAMPLER_TYPE:A_,DESCRIPTOR_DYNAMIC_TYPE:R_,DRAW_INFO_SIZE:28,IsPowerOf2:C_,FormatSize:b_,FormatSurfaceSize:I_,GetTypeSize:O_,getTypedArrayConstructor:x_,formatAlignment:N_,alignTo:D_}),P_=function(t){function e(){var e;return(e=t.call(this,Cc.BUFFER)||this)._usage=Mc.NONE,e._memUsage=Bc.NONE,e._size=0,e._stride=1,e._count=0,e._flags=Pc.NONE,e._isBufferView=!1,e}return s(e,t),n(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}(E_),L_=function(t){function e(){var e;return(e=t.call(this,Cc.COMMAND_BUFFER)||this)._queue=null,e._type=ll.PRIMARY,e._numDrawCalls=0,e._numInstances=0,e._numTris=0,e}return s(e,t),n(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}(E_),B_=function(){function t(){this._gfxAPI=Ic.UNKNOWN,this._renderer="",this._vendor="",this._features=new Array(Oc.COUNT),this._formatFeatures=new Array(xc.COUNT),this._queue=null,this._cmdBuff=null,this._numDrawCalls=0,this._numInstances=0,this._numTris=0,this._memoryStatus=new g_,this._caps=new vl,this._bindingMappingInfo=new xl,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]},e.enableAutoBarrier=function(){},n(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}();B_.canvas=void 0;var F_=function(){function t(t){this._texture2D=null,this._texture3D=null,this._textureCube=null,this._texture2DArray=null;var e=new Uint8Array(64);if(e.fill(255),t.capabilities.maxTextureSize>=2){this._texture2D=t.createTexture(new Ul(Fc.TEX2D,Uc.STORAGE|Uc.SAMPLED,xc.RGBA8,2,2,kc.NONE));var i=new Il(0,0,0,new El(0,0,0),new Sl(2,2,1));t.copyBuffersToTexture([e],this._texture2D,[i])}if(t.capabilities.maxTextureSize>=2){this._textureCube=t.createTexture(new Ul(Fc.CUBE,Uc.STORAGE|Uc.SAMPLED,xc.RGBA8,2,2,kc.NONE,6));var n=new Il(0,0,0,new El(0,0,0),new Sl(2,2,1));t.copyBuffersToTexture([e],this._textureCube,[n]),n.texSubres.baseArrayLayer=1,t.copyBuffersToTexture([e],this._textureCube,[n]),n.texSubres.baseArrayLayer=2,t.copyBuffersToTexture([e],this._textureCube,[n]),n.texSubres.baseArrayLayer=3,t.copyBuffersToTexture([e],this._textureCube,[n]),n.texSubres.baseArrayLayer=4,t.copyBuffersToTexture([e],this._textureCube,[n]),n.texSubres.baseArrayLayer=5,t.copyBuffersToTexture([e],this._textureCube,[n])}if(t.capabilities.max3DTextureSize>=2){this._texture3D=t.createTexture(new Ul(Fc.TEX3D,Uc.STORAGE|Uc.SAMPLED,xc.RGBA8,2,2,kc.NONE,1,1,Hc.ONE,2));var r=new Il(0,0,0,new El(0,0,0),new Sl(2,2,2),new Al(0,0,1));t.copyBuffersToTexture([e],this._texture3D,[r])}if(t.capabilities.maxArrayTextureLayers>=2){this._texture2DArray=t.createTexture(new Ul(Fc.TEX2D_ARRAY,Uc.STORAGE|Uc.SAMPLED,xc.RGBA8,2,2,kc.NONE,2));var s=new Il(0,0,0,new El(0,0,0),new Sl(2,2,1),new Al(0,0,1));t.copyBuffersToTexture([e],this._texture2DArray,[s]),s.texSubres.baseArrayLayer=1,t.copyBuffersToTexture([e],this._texture2DArray,[s])}}return t.prototype.getTexture=function(t){switch(t){case Fc.TEX2D:return this._texture2D;case Fc.TEX3D:return this._texture3D;case Fc.CUBE:return this._textureCube;case Fc.TEX2D_ARRAY:return this._texture2DArray;default:return null}},t}(),U_=function(t){function e(){var e;return(e=t.call(this,Cc.SWAPCHAIN)||this)._transform=wc.IDENTITY,e._colorTexture=null,e._depthStencilTexture=null,e}return s(e,t),n(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}(E_),k_=function(t){function e(){var e;return(e=t.call(this,Cc.FRAMEBUFFER)||this)._renderPass=null,e._colorTextures=[],e._depthStencilTexture=null,e}return s(e,t),n(e,[{key:"renderPass",get:function(){return this._renderPass}},{key:"colorTextures",get:function(){return this._colorTextures}},{key:"depthStencilTexture",get:function(){return this._depthStencilTexture}}]),e}(E_),G_=function(t){function e(){var e;return(e=t.call(this,Cc.INPUT_ASSEMBLER)||this)._attributes=[],e._attributesHash=0,e._vertexBuffers=[],e._indexBuffer=null,e._indirectBuffer=null,e._drawInfo=new Ll,e}s(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 vc(t,666)},n(e,[{key:"attributes",get:function(){return this._attributes}},{key:"vertexBuffers",get:function(){return this._vertexBuffers}},{key:"indexBuffer",get:function(){return this._indexBuffer}},{key:"indirectBuffer",get:function(){return this._indirectBuffer}},{key:"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}(E_),H_=function(t){function e(){var e;return(e=t.call(this,Cc.DESCRIPTOR_SET)||this)._layout=null,e._buffers=[],e._textures=[],e._samplers=[],e._isDirty=!1,e}s(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&S_){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&A_){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&A_){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]},n(e,[{key:"layout",get:function(){return this._layout}}]),e}(E_),z_=function(t){function e(){var e;return(e=t.call(this,Cc.DESCRIPTOR_SET_LAYOUT)||this)._bindings=[],e._bindingIndices=[],e._descriptorIndices=[],e}return s(e,t),n(e,[{key:"bindings",get:function(){return this._bindings}},{key:"bindingIndices",get:function(){return this._bindingIndices}},{key:"descriptorIndices",get:function(){return this._descriptorIndices}}]),e}(E_),V_=function(t){function e(){var e;return(e=t.call(this,Cc.PIPELINE_LAYOUT)||this)._setLayouts=[],e}return s(e,t),n(e,[{key:"setLayouts",get:function(){return this._setLayouts}}]),e}(E_),W_=function(){function t(t,e,i,n,r,s,a,o,h,u,c,l){void 0===t&&(t=!1),void 0===e&&(e=nl.FILL),void 0===i&&(i=rl.GOURAND),void 0===n&&(n=sl.BACK),void 0===r&&(r=!0),void 0===s&&(s=!1),void 0===a&&(a=0),void 0===o&&(o=0),void 0===h&&(h=0),void 0===u&&(u=!0),void 0===c&&(c=!1),void 0===l&&(l=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=h,this.isDepthClip=u,this.isMultisample=c,this.lineWidth=l}var e=t.prototype;return e.reset=function(){this.isDiscard=!1,this.polygonMode=nl.FILL,this.shadeModel=rl.GOURAND,this.cullMode=sl.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(){},n(t,[{key:"native",get:function(){return this}}]),t}(),X_=function(){function t(t,e,i,n,r,s,a,o,h,u,c,l,_,f,d,p,m,g,v){void 0===t&&(t=!0),void 0===e&&(e=!0),void 0===i&&(i=Xc.LESS),void 0===n&&(n=!1),void 0===r&&(r=Xc.ALWAYS),void 0===s&&(s=65535),void 0===a&&(a=65535),void 0===o&&(o=jc.KEEP),void 0===h&&(h=jc.KEEP),void 0===u&&(u=jc.KEEP),void 0===c&&(c=1),void 0===l&&(l=!1),void 0===_&&(_=Xc.ALWAYS),void 0===f&&(f=65535),void 0===d&&(d=65535),void 0===p&&(p=jc.KEEP),void 0===m&&(m=jc.KEEP),void 0===g&&(g=jc.KEEP),void 0===v&&(v=1),this.depthTest=t,this.depthWrite=e,this.depthFunc=i,this.stencilTestFront=n,this.stencilFuncFront=r,this.stencilReadMaskFront=s,this.stencilWriteMaskFront=a,this.stencilFailOpFront=o,this.stencilZFailOpFront=h,this.stencilPassOpFront=u,this.stencilRefFront=c,this.stencilTestBack=l,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=Xc.LESS,this.stencilTestFront=!1,this.stencilFuncFront=Xc.ALWAYS,this.stencilReadMaskFront=65535,this.stencilWriteMaskFront=65535,this.stencilFailOpFront=jc.KEEP,this.stencilZFailOpFront=jc.KEEP,this.stencilPassOpFront=jc.KEEP,this.stencilRefFront=1,this.stencilTestBack=!1,this.stencilFuncBack=Xc.ALWAYS,this.stencilReadMaskBack=65535,this.stencilWriteMaskBack=65535,this.stencilFailOpBack=jc.KEEP,this.stencilZFailOpBack=jc.KEEP,this.stencilPassOpBack=jc.KEEP,this.stencilRefBack=1},e.assign=function(t){Object.assign(this,t)},e.destroy=function(){},n(t,[{key:"native",get:function(){return this}}]),t}(),j_=function(){function t(t,e,i,n,r,s,a,o){void 0===t&&(t=!1),void 0===e&&(e=Yc.ONE),void 0===i&&(i=Yc.ZERO),void 0===n&&(n=Kc.ADD),void 0===r&&(r=Yc.ONE),void 0===s&&(s=Yc.ZERO),void 0===a&&(a=Kc.ADD),void 0===o&&(o=qc.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=Yc.ONE,this.blendDst=Yc.ZERO,this.blendEq=Kc.ADD,this.blendSrcAlpha=Yc.ONE,this.blendDstAlpha=Yc.ZERO,this.blendAlphaEq=Kc.ADD,this.blendColorMask=qc.ALL},e.assign=function(t){Object.assign(this,t)},e.destroy=function(){},t}(),Y_=function(){function t(t,e,i,n){void 0===t&&(t=!1),void 0===e&&(e=!1),void 0===i&&(i=new Ol),void 0===n&&(n=[new j_]),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 j_),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(){},n(t,[{key:"native",get:function(){return this}}]),t}(),K_=function(t,e,i,n,r,s,a,o,h,u){void 0===t&&(t=null),void 0===e&&(e=null),void 0===i&&(i=null),void 0===n&&(n=new __),void 0===r&&(r=new W_),void 0===s&&(s=new X_),void 0===a&&(a=new Y_),void 0===o&&(o=il.TRIANGLE_LIST),void 0===h&&(h=al.NONE),void 0===u&&(u=el.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=h,this.bindPoint=u},q_=function(t){function e(){var e;return(e=t.call(this,Cc.PIPELINE_STATE)||this)._shader=null,e._pipelineLayout=null,e._primitive=il.TRIANGLE_LIST,e._is=null,e._rs=new W_,e._dss=new X_,e._bs=new Y_,e._dynamicStates=al.NONE,e._renderPass=null,e}return s(e,t),n(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}(E_),Q_=function(t){function e(){var e;return(e=t.call(this,Cc.QUEUE)||this)._type=ul.GRAPHICS,e}return s(e,t),n(e,[{key:"type",get:function(){return this._type}}]),e}(E_),Z_=function(t){function e(){var e;return(e=t.call(this,Cc.RENDER_PASS)||this)._colorInfos=[],e._depthStencilInfo=null,e._subpasses=[],e._hash=0,e}return s(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 h=0;h<this._colorInfos.length;++h){var u=this._colorInfos[h];t+=","+u.format+","+u.sampleCount}var c=this._depthStencilInfo;c&&(t+="ds,"+c.format+","+c.sampleCount)}return vc(t,666)},n(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}(E_),J_=function(t){function e(e,i){var n;return(n=t.call(this,Cc.SAMPLER)||this)._info=new Gl,n._hash=0,n._info.copy(e),n._hash=i,n}return s(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 Gl;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},n(e,[{key:"info",get:function(){return this._info}},{key:"hash",get:function(){return this._hash}}]),e}(E_),$_=function(t){function e(){var e;return(e=t.call(this,Cc.SHADER)||this)._name="",e._stages=[],e._attributes=[],e._blocks=[],e._samplers=[],e}return s(e,t),n(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}(E_),tf=function(t){function e(){var e;return(e=t.call(this,Cc.TEXTURE)||this)._info=new Ul,e._viewInfo=new kl,e._isPowerOf2=!1,e._isTextureView=!1,e._size=0,e}return s(e,t),e.getLevelCount=function(t,e){return Math.floor(Math.log2(Math.max(t,e)))},n(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}(E_),ef=function(t){function e(e,i){var n;return(n=t.call(this,Cc.GLOBAL_BARRIER)||this)._info=new r_,n._hash=0,n._info.copy(e),n._hash=i,n}return s(e,t),e.computeHash=function(t){return vc(t.prevAccesses+" "+t.nextAccesses+" "+t.type,666)},n(e,[{key:"info",get:function(){return this._info}},{key:"hash",get:function(){return this._hash}}]),e}(E_),nf=function(t){function e(e,i){var n;return(n=t.call(this,Cc.TEXTURE_BARRIER)||this)._info=new s_,n._hash=0,n._info.copy(e),n._hash=i,n}return s(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,vc(e+=t.dstQueue?t.dstQueue.type:0,666)},n(e,[{key:"info",get:function(){return this._info}},{key:"hash",get:function(){return this._hash}}]),e}(E_),rf=function(t){function e(e,i){var n;return(n=t.call(this,Cc.BUFFER_BARRIER)||this)._info=new a_,n._hash=0,n._info.copy(e),n._hash=i,n}return s(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,vc(e+=t.dstQueue?t.dstQueue.type:0,666)},n(e,[{key:"info",get:function(){return this._info}},{key:"hash",get:function(){return this._hash}}]),e}(E_),sf={Device:B_,Swapchain:U_,Buffer:P_,Texture:tf,Sampler:J_,Shader:$_,InputAssembler:G_,RenderPass:Z_,Framebuffer:k_,DescriptorSet:H_,DescriptorSetLayout:z_,PipelineLayout:V_,PipelineState:q_,CommandBuffer:L_,Queue:Q_,GeneralBarrier:ef,TextureBarrier:nf,BufferBarrier:rf,RasterizerState:W_,BlendState:Y_,BlendTarget:j_,DepthStencilState:X_,PipelineStateInfo:K_};Object.assign(sf,M_),g.gfx=sf;var af,of,hf={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 uf in hf){var cf=hf[uf];!0===cf?cf=uf.slice(3):!1===cf&&(cf=uf),it(g,"cc",[{name:uf,newName:cf,target:g.gfx,targetName:"cc.gfx"}])}nt(g,"cc",[{name:"GFX_MAX_VERTEX_ATTRIBUTES"},{name:"GFX_MAX_TEXTURE_UNITS"},{name:"GFX_MAX_ATTACHMENTS"},{name:"GFX_MAX_BUFFER_BINDINGS"},{name:"GFXTextureLayout"}]),nt(Oc,"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;"}]),nt($l.prototype,"ColorAttachment",[{name:"beginAccesses",suggest:"Please assign to ColorAttachment.barrier instead"},{name:"endAccesses",suggest:"Please assign to ColorAttachment.barrier instead"}]),nt(t_.prototype,"DepthStencilAttachment",[{name:"beginAccesses",suggest:"Please assign to DepthStencilAttachment.barrier instead"},{name:"endAccesses",suggest:"Please assign to DepthStencilAttachment.barrier instead"}]),it(B_.prototype,"Device",[{name:"getGlobalBarrier",newName:"getGeneralBarrier"}]),function(t){t[t.AUTO=0]="AUTO",t[t.CANVAS=1]="CANVAS",t[t.WEBGL=2]="WEBGL",t[t.HEADLESS=3]="HEADLESS"}(af||(af={})),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"}(of||(of={}));var lf=function(){function t(){this.initialized=!1,this._gfxDevice=void 0,this._canvas=null,this._swapchain=void 0,this._renderType=of.UNKNOWN}var e=t.prototype;return e.init=function(t,e){if(!this.initialized){var i=Ee.querySettings(ye.Category.RENDERING,"renderMode");if(this._canvas=t,this._renderType=this._determineRenderType(i),this._renderType===of.WEBGL){var n=new Dl(e),r=!!globalThis.WebGL2RenderingContext;globalThis.navigator.userAgent.toLowerCase(),dc.browserType===ku.UC&&(r=!1);var s=[];r&&g.WebGL2Device&&s.push(g.WebGL2Device),g.WebGLDevice&&s.push(g.WebGLDevice),g.EmptyDevice&&s.push(g.EmptyDevice),B_.canvas=t;for(var a=0;a<s.length&&(this._gfxDevice=new s[a],!this._gfxDevice.initialize(n));a++);this._initSwapchain()}else this._renderType===of.HEADLESS&&g.EmptyDevice&&(this._gfxDevice=new g.EmptyDevice,this._gfxDevice.initialize(new Dl(e)),this._initSwapchain());if(!this._gfxDevice)return F("can not support canvas rendering in 3D"),void(this._renderType=of.UNKNOWN);this._canvas&&(this._canvas.oncontextmenu=function(){return!1})}},e._initSwapchain=function(){var t=new Nl(1,this._canvas),e=fc.windowSize;t.width=e.width,t.height=e.height,this._swapchain=this._gfxDevice.createSwapchain(t)},e._determineRenderType=function(t){("number"!=typeof t||t>of.HEADLESS||t<af.AUTO)&&(t=af.AUTO);var e=of.CANVAS,i=!1;if(t===af.CANVAS?(e=of.CANVAS,i=!0):t===af.AUTO||t===af.WEBGL?(e=of.WEBGL,i=!0):t===af.HEADLESS&&(e=of.HEADLESS,i=!0),!i)throw new Error(J(3820,t));return e},n(t,[{key:"gfxDevice",get:function(){return this._gfxDevice}},{key:"swapchain",get:function(){return this._swapchain}}]),t}(),_f=new lf;t("gfx",Object.freeze({__proto__:null,DescriptorSet:H_,Buffer:P_,CommandBuffer:L_,get ObjectType(){return Cc},get Status(){return bc},get API(){return Ic},get SurfaceTransform(){return wc},get Feature(){return Oc},get Format(){return xc},get FormatType(){return Nc},get Type(){return Dc},get BufferUsageBit(){return Mc},get BufferFlagBit(){return Pc},get MemoryAccessBit(){return Lc},get MemoryUsageBit(){return Bc},get TextureType(){return Fc},get TextureUsageBit(){return Uc},get TextureFlagBit(){return kc},get FormatFeatureBit(){return Gc},get SampleCount(){return Hc},get VsyncMode(){return zc},get Filter(){return Vc},get Address(){return Wc},get ComparisonFunc(){return Xc},get StencilOp(){return jc},get BlendFactor(){return Yc},get BlendOp(){return Kc},get ColorMask(){return qc},get ShaderStageFlagBit(){return Qc},get LoadOp(){return Zc},get StoreOp(){return Jc},get AccessFlagBit(){return $c},get ResolveMode(){return tl},get PipelineBindPoint(){return el},get PrimitiveMode(){return il},get PolygonMode(){return nl},get ShadeModel(){return rl},get CullMode(){return sl},get DynamicStateFlagBit(){return al},get StencilFace(){return ol},get DescriptorType(){return hl},get QueueType(){return ul},get QueryType(){return cl},get CommandBufferType(){return ll},get ClearFlagBit(){return _l},get BarrierType(){return fl},get PassType(){return dl},Size:gl,DeviceCaps:vl,DeviceOptions:yl,Offset:El,Rect:Tl,Extent:Sl,TextureSubresLayers:Al,TextureSubresRange:Rl,TextureCopy:Cl,TextureBlit:bl,BufferTextureCopy:Il,Viewport:wl,Color:Ol,BindingMappingInfo:xl,SwapchainInfo:Nl,DeviceInfo:Dl,BufferInfo:Ml,BufferViewInfo:Pl,DrawInfo:Ll,DispatchInfo:Bl,IndirectBuffer:Fl,TextureInfo:Ul,TextureViewInfo:kl,SamplerInfo:Gl,Uniform:Hl,UniformBlock:zl,UniformSamplerTexture:Vl,UniformSampler:Wl,UniformTexture:Xl,UniformStorageImage:jl,UniformStorageBuffer:Yl,UniformInputAttachment:Kl,ShaderStage:ql,Attribute:Ql,ShaderInfo:Zl,InputAssemblerInfo:Jl,ColorAttachment:$l,DepthStencilAttachment:t_,SubpassInfo:e_,SubpassDependency:i_,RenderPassInfo:n_,GeneralBarrierInfo:r_,TextureBarrierInfo:s_,BufferBarrierInfo:a_,FramebufferInfo:o_,DescriptorSetLayoutBinding:h_,DescriptorSetLayoutInfo:u_,DescriptorSetInfo:c_,PipelineLayoutInfo:l_,InputState:__,CommandBufferInfo:f_,QueueInfo:d_,QueryPoolInfo:p_,FormatInfo:m_,MemoryStatus:g_,DynamicStencilStates:v_,DynamicStates:y_,GFXObject:E_,get AttributeName(){return ml},FormatInfos:T_,DESCRIPTOR_BUFFER_TYPE:S_,DESCRIPTOR_SAMPLER_TYPE:A_,DESCRIPTOR_DYNAMIC_TYPE:R_,DRAW_INFO_SIZE:28,IsPowerOf2:C_,FormatSize:b_,FormatSurfaceSize:I_,GetTypeSize:O_,getTypedArrayConstructor:x_,formatAlignment:N_,alignTo:D_,Device:B_,DefaultResource:F_,Swapchain:U_,Framebuffer:k_,InputAssembler:G_,DescriptorSetLayout:z_,PipelineLayout:V_,BlendState:Y_,BlendTarget:j_,RasterizerState:W_,DepthStencilState:X_,PipelineStateInfo:K_,PipelineState:q_,Queue:Q_,RenderPass:Z_,Sampler:J_,Shader:$_,Texture:tf,GeneralBarrier:ef,TextureBarrier:nf,get LegacyRenderMode(){return af},get RenderType(){return of},DeviceManager:lf,deviceManager:_f}));var ff=new cn;function df(t,e,i,n){var r=i.chunk,s=i.data,a=r.vb,o=i.vertexCount;t.getWorldMatrix(ff);for(var h=0,u=0;u<o;u++){var c=s[u],l=c.x,_=c.y,f=ff.m03*l+ff.m07*_+ff.m15;f=f?1/f:1,a[h+0]=(ff.m00*l+ff.m04*_+ff.m12)*f,a[h+1]=(ff.m01*l+ff.m05*_+ff.m13)*f,a[h+2]=(ff.m02*l+ff.m06*_+ff.m14)*f,qi.toArray(a,n,h+5),h+=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 pf=function(){function t(t){this._map=null,this._count=0,t?(this._map=t,this._count=Object.keys(t).length):(this._map=It(!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=It(!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},n(t,[{key:"map",get:function(){return this._map}},{key:"count",get:function(){return this._count}}]),t}(),mf=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.isFinished=!1;for(var i=0,n=e.length;i<n;){var r=(0,e[i])(t);if(r)return t.isFinished=!0,r;++i!==n&&(t.input=t.output,t.output=null)}return t.isFinished=!0,t.output},e.async=function(t){0!==this.pipes.length&&(t.isFinished=!1,this._flow(0,t))},e._flow=function(t,e){var i=this;(0,this.pipes[t])(e,(function(n){n?(e.isFinished=!0,e.dispatch("complete",n)):++t<i.pipes.length?(e.input=e.output,e.output=null,i._flow(t,e)):(e.isFinished=!0,e.dispatch("complete",n,e.output))}))},t}();mf._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=It(!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={}},n(t,[{key:"count",get:function(){return Object.values(this._weakMap).filter((function(t){return t.deref()})).length}}])}();var gf,vf=new pf,yf=new pf,Ef=new pf,Tf=new pf,Sf=new mf("normal load",[]),Af=new mf("fetch",[]),Rf=new mf("transform url",[]),Cf=new Map;!function(t){t.UUID="uuid",t.PATH="path",t.DIR="dir",t.URL="url",t.SCENE="scene"}(gf||(gf={}));var bf,If={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"}(bf||(bf={}));var wf=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.isFinished=!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))},n(t,[{key:"isFinish",get:function(){return this.isFinished},set:function(t){this.isFinished=t}}]),t}();wf.MAX_DEAD_NUM=500,wf._taskId=0,wf._deadPool=[];var Of="0123456789abcdef".split(""),xf=["","","",""],Nf=xf.concat(xf,"-",xf,"-",xf,"-",xf,"-",xf,xf,xf),Df=Nf.map((function(t,e){return"-"===t?NaN:e})).filter(Number.isFinite);function Mf(t){var e=t.split("@")[0];if(22!==e.length)return t;Nf[0]=t[0],Nf[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)];Nf[Df[n++]]=Of[r>>2],Nf[Df[n++]]=Of[(3&r)<<2|s>>4],Nf[Df[n++]]=Of[15&s]}return t.replace(e,Nf.join(""))}var Pf=/.*[/\\][0-9a-fA-F]{2}[/\\]([0-9a-fA-F-@]{8,}).*/;function Lf(t){var e=Pf.exec(t);return e?e[1]:""}function Bf(t,e){(e=e||Object.create(null)).__isNative__=e.isNative,e.nativeExt&&(e.ext=e.nativeExt);var i=Tf.find((function(e){return!!e.getAssetInfo(t)}));return i&&(e.bundle=i.name),kf(t,e)}function Ff(t){return!!t&&(t instanceof g.SceneAsset||t instanceof g.Scene)}function Uf(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 kf(t,e){var i=wf.create({input:t,options:e}),n=[];try{for(var r,s=f(Rf.sync(i));!(r=s()).done;){var a=r.value,o=a.url;a.recycle(),n.push(o)}}catch(t){for(var h,u=f(i.output);!(h=u()).done;)h.value.recycle();F(t.message,t.stack)}return i.recycle(),n.length>1?n:n[0]}var Gf,Hf,zf,Vf=Object.freeze({__proto__:null,getUuidFromURL:Lf,getUrlWithUuid:Bf,isScene:Ff,normalize:Uf,transform:kf,decodeUuid:Mf}),Wf=Ls,Xf=xs,jf=t("Asset",bs("cc.Asset")((Hf=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._native=zf&&zf(),e._nativeUrl="",e._file=null,e._ref=0,Object.defineProperty(l(e),"_uuid",{value:"",writable:!0}),e}s(e,t),e.deserialize=function(t){return g.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&&g.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 k(J(12101,this._uuid)),t.prototype.destroy.call(this)},n(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=Bf(this._uuid,{nativeExt:t,isNative:!0}):this._nativeUrl=Bf(this._uuid,{__nativeName__:t,nativeExt:Ju(t),isNative:!0})}return this._nativeUrl}},{key:"uuid",get:function(){return this._uuid}},{key:"_nativeAsset",get:function(){return this._file},set:function(t){this._file=t}},{key:"nativeAsset",get:function(){return this._file}},{key:"_nativeDep",get:function(){if(this._native)return{__isNative__:!0,uuid:this._uuid,ext:this._native}}},{key:"refCount",get:function(){return this._ref}}]),e}(Fu(Ta)),zf=gs(Hf.prototype,"_native",[Wf],(function(){return""})),d(Hf.prototype,"_nativeAsset",[Xf],Object.getOwnPropertyDescriptor(Hf.prototype,"_nativeAsset"),Hf.prototype),Gf=Hf))||Gf);jf.prototype.createNode=null,g.Asset=jf;var Yf,Kf,qf,Qf,Zf,Jf;!function(t){t[t.RGB565=xc.R5G6B5]="RGB565",t[t.RGB5A1=xc.RGB5A1]="RGB5A1",t[t.RGBA4444=xc.RGBA4]="RGBA4444",t[t.RGB888=xc.RGB8]="RGB888",t[t.RGB32F=xc.RGB32F]="RGB32F",t[t.RGBA8888=xc.RGBA8]="RGBA8888",t[t.RGBA32F=xc.RGBA32F]="RGBA32F",t[t.A8=xc.A8]="A8",t[t.I8=xc.L8]="I8",t[t.AI8=xc.LA8]="AI8",t[t.RGB_PVRTC_2BPPV1=xc.PVRTC_RGB2]="RGB_PVRTC_2BPPV1",t[t.RGBA_PVRTC_2BPPV1=xc.PVRTC_RGBA2]="RGBA_PVRTC_2BPPV1",t[t.RGB_A_PVRTC_2BPPV1=1024]="RGB_A_PVRTC_2BPPV1",t[t.RGB_PVRTC_4BPPV1=xc.PVRTC_RGB4]="RGB_PVRTC_4BPPV1",t[t.RGBA_PVRTC_4BPPV1=xc.PVRTC_RGBA4]="RGBA_PVRTC_4BPPV1",t[t.RGB_A_PVRTC_4BPPV1=1025]="RGB_A_PVRTC_4BPPV1",t[t.RGB_ETC1=xc.ETC_RGB8]="RGB_ETC1",t[t.RGBA_ETC1=1026]="RGBA_ETC1",t[t.RGB_ETC2=xc.ETC2_RGB8]="RGB_ETC2",t[t.RGBA_ETC2=xc.ETC2_RGBA8]="RGBA_ETC2",t[t.RGBA_ASTC_4x4=xc.ASTC_RGBA_4X4]="RGBA_ASTC_4x4",t[t.RGBA_ASTC_5x4=xc.ASTC_RGBA_5X4]="RGBA_ASTC_5x4",t[t.RGBA_ASTC_5x5=xc.ASTC_RGBA_5X5]="RGBA_ASTC_5x5",t[t.RGBA_ASTC_6x5=xc.ASTC_RGBA_6X5]="RGBA_ASTC_6x5",t[t.RGBA_ASTC_6x6=xc.ASTC_RGBA_6X6]="RGBA_ASTC_6x6",t[t.RGBA_ASTC_8x5=xc.ASTC_RGBA_8X5]="RGBA_ASTC_8x5",t[t.RGBA_ASTC_8x6=xc.ASTC_RGBA_8X6]="RGBA_ASTC_8x6",t[t.RGBA_ASTC_8x8=xc.ASTC_RGBA_8X8]="RGBA_ASTC_8x8",t[t.RGBA_ASTC_10x5=xc.ASTC_RGBA_10X5]="RGBA_ASTC_10x5",t[t.RGBA_ASTC_10x6=xc.ASTC_RGBA_10X6]="RGBA_ASTC_10x6",t[t.RGBA_ASTC_10x8=xc.ASTC_RGBA_10X8]="RGBA_ASTC_10x8",t[t.RGBA_ASTC_10x10=xc.ASTC_RGBA_10X10]="RGBA_ASTC_10x10",t[t.RGBA_ASTC_12x10=xc.ASTC_RGBA_12X10]="RGBA_ASTC_12x10",t[t.RGBA_ASTC_12x12=xc.ASTC_RGBA_12X12]="RGBA_ASTC_12x12"}(Yf||(Yf={})),function(t){t[t.REPEAT=Wc.WRAP]="REPEAT",t[t.CLAMP_TO_EDGE=Wc.CLAMP]="CLAMP_TO_EDGE",t[t.MIRRORED_REPEAT=Wc.MIRROR]="MIRRORED_REPEAT",t[t.CLAMP_TO_BORDER=Wc.BORDER]="CLAMP_TO_BORDER"}(Kf||(Kf={})),function(t){t[t.NONE=Vc.NONE]="NONE",t[t.LINEAR=Vc.LINEAR]="LINEAR",t[t.NEAREST=Vc.POINT]="NEAREST"}(qf||(qf={}));var $f=1346981187,td=fe({PVR:0,PKM:1,ASTC:2});function ed(t,e){return t[e]<<8|t[e+1]}function id(t){return!!(dc.hasFeature(dc.Feature.IMAGE_BITMAP)&&t instanceof ImageBitmap)}var nd,rd,sd,ad,od,hd,ud,cd,ld,_d,fd,dd=t("ImageAsset",bs("cc.ImageAsset")(((Jf=function(t){s(i,t),i.mergeCompressedTextureMips=function(t){var e=new Uint8Array(0),i=null;try{for(var n,r=8+4*t.length,s=0,a=f(t);!(n=a()).done;)s+=n.value.byteLength;s+=r,e=new Uint8Array(s);var o=new DataView(e.buffer,e.byteOffset,e.byteLength);o.setUint32(0,$f,!0),o.setUint32(4,t.length,!0);for(var h=r,u=0;u<t.length;u++){var c=t[u];if(o.setUint32(8+4*u,c.byteLength,!0),c instanceof ArrayBuffer){var l=new Uint8Array(c);e.set(l,h)}else{var _=new Uint8Array(c.buffer,c.byteOffset,c.byteLength);e.set(_,h)}h+=c.byteLength}}catch(t){i=t,console.warn(i)}return e},i.parseCompressedTextures=function(t,e){var n={_data:new Uint8Array(0),_compressed:!0,width:0,height:0,format:0,mipmapLevelDataSize:[]},r=t instanceof ArrayBuffer?t:t.buffer,s=new DataView(r);if(s.getUint32(0,!0)===$f){var a=s.getUint32(4,!0),o=s.getUint32(8,!0),h=8+4*a;i.parseCompressedTexture(t,0,h,o,e,n);for(var u=h+o,c=1;c<a;c++){var l=s.getUint32(8+4*c,!0);i.parseCompressedTexture(t,c,u,l,e,n),u+=l}}else i.parseCompressedTexture(t,0,0,0,e,n);return n},i.parseCompressedTexture=function(t,e,n,r,s,a){switch(s){case td.PVR:i.parsePVRTexture(t,e,n,r,a);break;case td.PKM:i.parsePKMTexture(t,e,n,r,a);break;case td.ASTC:i.parseASTCTexture(t,e,n,r,a)}},i.parsePVRTexture=function(t,e,i,n,r){var s=t instanceof ArrayBuffer?t:t.buffer,a=new Int32Array(s,i,13);if(55727696===a[0]){var o=i+a[12]+52,h=n-a.byteLength;if(n>0){var u=new Uint8Array(s,o,h),c=new Uint8Array(r._data.byteLength+u.byteLength);c.set(r._data),c.set(u,r._data.byteLength),r._data=c,r.mipmapLevelDataSize[e]=h}else r._data=new Uint8Array(s,o);r.width=e>0?r.width:a[7],r.height=e>0?r.height:a[6]}else{if(559044176!==a[11])throw new Error("Invalid magic number in PVR header");var l=i+a[0],_=n-a.byteLength;if(n>0){var f=new Uint8Array(s,l,_),d=new Uint8Array(r._data.byteLength+f.byteLength);d.set(r._data),d.set(f,r._data.byteLength),r._data=d,r.mipmapLevelDataSize[e]=_}else r._data=new Uint8Array(s,l);r.width=e>0?r.width:a[1],r.height=e>0?r.height:a[2]}},i.parsePKMTexture=function(t,e,i,n,r){var s=t instanceof ArrayBuffer?t:t.buffer,a=new Uint8Array(s,i,16),o=ed(a,6);if(0!==o&&1!==o&&3!==o)throw new Error("Invalid magic number in ETC header");var h=i+16,u=n-16;if(n>0){var c=new Uint8Array(s,h,u),l=new Uint8Array(r._data.byteLength+c.byteLength);l.set(r._data),l.set(c,r._data.byteLength),r._data=l,r.mipmapLevelDataSize[e]=u}else r._data=new Uint8Array(s,h);r.width=e>0?r.width:ed(a,12),r.height=e>0?r.height:ed(a,14)},i.parseASTCTexture=function(t,e,i,n,r){var s=t instanceof ArrayBuffer?t:t.buffer,a=new Uint8Array(s,i,16);if(1554098963!==a[0]+(a[1]<<8)+(a[2]<<16)+(a[3]<<24))throw new Error("Invalid magic number in ASTC header");var o=a[4],h=a[5],u=a[6];if((o<3||o>6||h<3||h>6||u<3||u>6)&&(o<4||7===o||9===o||11===o||o>12||h<4||7===h||9===h||11===h||h>12||1!==u))throw new Error("Invalid block number in ASTC header");var c=function(t,e){return 4===t?Yf.RGBA_ASTC_4x4:5===t?4===e?Yf.RGBA_ASTC_5x4:Yf.RGBA_ASTC_5x5:6===t?5===e?Yf.RGBA_ASTC_6x5:Yf.RGBA_ASTC_6x6:8===t?5===e?Yf.RGBA_ASTC_8x5:6===e?Yf.RGBA_ASTC_8x6:Yf.RGBA_ASTC_8x8:10===t?5===e?Yf.RGBA_ASTC_10x5:6===e?Yf.RGBA_ASTC_10x6:8===e?Yf.RGBA_ASTC_10x8:Yf.RGBA_ASTC_10x10:10===e?Yf.RGBA_ASTC_12x10:Yf.RGBA_ASTC_12x12}(o,h),l=i+16,_=n-16;if(n>0){var f=new Uint8Array(s,l,_),d=new Uint8Array(r._data.byteLength+f.byteLength);d.set(r._data),d.set(f,r._data.byteLength),r._data=d,r.mipmapLevelDataSize[e]=_}else r._data=new Uint8Array(s,l);r.width=e>0?r.width:a[7]+(a[8]<<8)+(a[9]<<16),r.height=e>0?r.height:a[10]+(a[11]<<8)+(a[12]<<16),r.format=c};var e=i.prototype;function i(e){var i;return(i=t.call(this)||this)._nativeData=void 0,i._exportedExts=void 0,i._format=Yf.RGBA8888,i._width=0,i._height=0,i._nativeData={_data:null,width:0,height:0,format:0,_compressed:!1,mipmapLevelDataSize:[]},void 0!==e&&i.reset(e),i}return e.extractMipmap0=function(){if(this.mipmapLevelDataSize&&this.mipmapLevelDataSize.length>0){var t=this.mipmapLevelDataSize[0],e=this.data,n=new i({_data:new Uint8Array(e.buffer,0,t),_compressed:!0,width:this.width,height:this.height,format:this.format,mipmapLevelDataSize:[]});return n._uuid=""+this._uuid,n}return this},e.extractMipmaps=function(){var t=[];if(this.mipmapLevelDataSize&&this.mipmapLevelDataSize.length>0)for(var e,n=this.mipmapLevelDataSize,r=this.data,s=0,a=this.height,o=this.width,h=f(n);!(e=h()).done;){var u=e.value,c=new i({_data:new Uint8Array(r.buffer,s,u),_compressed:!0,width:o,height:a,format:this.format,mipmapLevelDataSize:[]});s+=u,c._uuid=""+this._uuid,o=Math.max(o>>1,1),a=Math.max(a>>1,1),t.push(c)}else t.push(this);return t},e.reset=function(t){id(t)||t instanceof HTMLElement?this._nativeData=t:(this._nativeData=t,this._format=t.format)},e.destroy=function(){if(this.data&&this.data instanceof HTMLImageElement)this.data.src="",this._setRawAsset("");else if(id(this.data)){var e;null===(e=this.data)||void 0===e||e.close()}return t.prototype.destroy.call(this)},e._serialize=function(){},e._deserialize=function(t){var e="";"string"==typeof t?e=t:(this._width=t.w,this._height=t.h,e=t.fmt);for(var n,r=_f.gfxDevice,s=e.split("_"),a=Number.MAX_VALUE,o=this._format,h="",u=Te.SUPPORT_TEXTURE_FORMATS,c=f(s);!(n=c()).done;){var l=n.value.split("@"),_=parseInt(l[0],void 0),d=i.extnames[_]||l[0],p=u.indexOf(d);if(-1!==p&&p<a){var m=l[1]?parseInt(l[1]):this._format;if(!(".astc"!==d||r&&r.getFormatFeatures(xc.ASTC_RGBA_4X4)&Gc.SAMPLED_TEXTURE))continue;if(!(".pvr"!==d||r&&r.getFormatFeatures(xc.PVRTC_RGBA4)&Gc.SAMPLED_TEXTURE))continue;if(!(m!==Yf.RGB_ETC1&&m!==Yf.RGBA_ETC1||r&&r.getFormatFeatures(xc.ETC_RGB8)&Gc.SAMPLED_TEXTURE))continue;if(!(m!==Yf.RGB_ETC2&&m!==Yf.RGBA_ETC2||r&&r.getFormatFeatures(xc.ETC2_RGB8)&Gc.SAMPLED_TEXTURE))continue;if(".webp"===d&&!dc.hasFeature(dc.Feature.WEBP))continue;a=p,h=d,o=m}}h?(this._setRawAsset(h),this._format=o):j(3121)},e.initDefault=function(e){if(t.prototype.initDefault.call(this,e),i._sharedPlaceHolderCanvas)this.reset(i._sharedPlaceHolderCanvas);else{var n=y.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),i._sharedPlaceHolderCanvas=n}},e.validate=function(){return!!this.data},n(i,[{key:"_nativeAsset",get:function(){return this._nativeData},set:function(t){t instanceof HTMLElement||id(t)||(t.format=t.format||this._format),this.reset(t)}},{key:"data",get:function(){return(t=this._nativeData)instanceof HTMLImageElement||t instanceof HTMLCanvasElement||id(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>=Yf.RGB_ETC1&&this._format<=Yf.RGBA_ASTC_12x12||this._format>=Yf.RGB_A_PVRTC_2BPPV1&&this._format<=Yf.RGBA_ETC1}},{key:"mipmapLevelDataSize",get:function(){return this._nativeData.mipmapLevelDataSize}},{key:"url",get:function(){return this.nativeUrl}}]),i}(jf)).extnames=[".png",".jpg",".jpeg",".bmp",".webp",".pvr",".pkm",".astc"],Jf._sharedPlaceHolderCanvas=null,d((Zf=Jf).prototype,"_nativeAsset",[aa],Object.getOwnPropertyDescriptor(Zf.prototype,"_nativeAsset"),Zf.prototype),Qf=Zf))||Qf);g.ImageAsset=dd,me(xc);var pd,md,gd,vd=new pt("Tex"),yd=bs("cc.TextureBase")(((fd=function(t){function e(){var e;return(e=t.call(this)||this)._format=sd&&sd(),e._minFilter=ad&&ad(),e._magFilter=od&&od(),e._mipFilter=hd&&hd(),e._wrapS=ud&&ud(),e._wrapT=cd&&cd(),e._wrapR=ld&&ld(),e._anisotropy=_d&&_d(),e._width=1,e._height=1,e._id=void 0,e._samplerInfo=new Gl,e._gfxSampler=null,e._gfxDevice=null,e._textureHash=0,e._id=vd.getNewId(),e._gfxDevice=e._getGFXDevice(),e._textureHash=vc(e._id,666),e}s(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=g.director.root)&&void 0!==e&&e.batcher2D&&g.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 _f.gfxDevice},i._getGFXFormat=function(){return this._getGFXPixelFormat(this._format)},i._setGFXFormat=function(t){this._format=void 0===t?Yf.RGBA8888:t},i._getGFXPixelFormat=function(t){return t===Yf.RGBA_ETC1?t=Yf.RGB_ETC1:t===Yf.RGB_A_PVRTC_4BPPV1?t=Yf.RGB_PVRTC_4BPPV1:t===Yf.RGB_A_PVRTC_2BPPV1&&(t=Yf.RGB_PVRTC_2BPPV1),t},n(e,[{key:"isCompressed",get:function(){return this._format>=Yf.RGB_ETC1&&this._format<=Yf.RGBA_ASTC_12x12||this._format>=Yf.RGB_A_PVRTC_2BPPV1&&this._format<=Yf.RGBA_ETC1}},{key:"width",get:function(){return this._width}},{key:"height",get:function(){return this._height}}]),e}(jf)).PixelFormat=Yf,fd.WrapMode=Kf,fd.Filter=qf,sd=gs((rd=fd).prototype,"_format",[Ls],(function(){return Yf.RGBA8888})),ad=gs(rd.prototype,"_minFilter",[Ls],(function(){return qf.LINEAR})),od=gs(rd.prototype,"_magFilter",[Ls],(function(){return qf.LINEAR})),hd=gs(rd.prototype,"_mipFilter",[Ls],(function(){return qf.NONE})),ud=gs(rd.prototype,"_wrapS",[Ls],(function(){return Kf.REPEAT})),cd=gs(rd.prototype,"_wrapT",[Ls],(function(){return Kf.REPEAT})),ld=gs(rd.prototype,"_wrapR",[Ls],(function(){return Kf.REPEAT})),_d=gs(rd.prototype,"_anisotropy",[Ls],(function(){return 0})),nd=rd))||nd;g.TextureBase=yd;var Ed=t("Script",bs("cc.Script")(pd=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(jf))||pd);g._Script=Ed;var Td=t("JavaScript",bs("cc.JavaScript")(md=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(Ed))||md);g._JavaScript=Td;var Sd,Ad,Rd,Cd,bd,Id,wd,Od=t("TypeScript",bs("cc.TypeScript")(gd=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(Ed))||gd);g._TypeScript=Od;var xd,Nd,Dd,Md,Pd,Ld,Bd,Fd,Ud,kd,Gd,Hd=t("EventHandler",bs("cc.ClickEvent")((Ad=function(){function t(){this.target=Rd&&Rd(),this.component=Cd&&Cd(),this._componentId=bd&&bd(),this.handler=Id&&Id(),this.customEventData=wd&&wd()}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(g.isValid(e)){this._genCompIdIfNeeded();var i=g.js.getClassById(this._componentId),n=e.getComponent(i);if(g.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=g.js.getClassByName(t);return g.js.getClassId(e)},e._compId2Name=function(t){var e=g.js.getClassById(t);return g.js.getClassName(e)},e._genCompIdIfNeeded=function(){this._componentId||(this._componentName=this.component,this.component="")},n(t,[{key:"_componentName",get:function(){return this._genCompIdIfNeeded(),this._compId2Name(this._componentId)},set:function(t){this._componentId=this._compName2Id(t)}}]),t}(),Rd=gs(Ad.prototype,"target",[Ls],(function(){return null})),Cd=gs(Ad.prototype,"component",[Ls],(function(){return""})),bd=gs(Ad.prototype,"_componentId",[Ls],(function(){return""})),Id=gs(Ad.prototype,"handler",[Ls],(function(){return""})),wd=gs(Ad.prototype,"customEventData",[Ls],(function(){return""})),Sd=Ad))||Sd),zd=new pt("Comp"),Vd=Ta.Flags.IsOnLoadCalled,Wd=t("Component",(xd=bs("cc.Component"),Nd=sa(Ed),xd(((Fd=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).node=Pd&&Pd(),e._enabled=Ld&&Ld(),e.__prefab=Bd&&Bd(),e._sceneGetter=null,e._id=zd.getNewId(),e}s(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&&g.director._compScheduler.disableComp(this),!0)},i._onPreDestroy=function(){this.unscheduleAllCallbacks(),g.director._nodeActivator.destroyComp(this),this.node._removeComponent(this)},i._instantiate=function(t){return t||(t=g.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=g.macro.REPEAT_FOREVER),void 0===n&&(n=0),Z(t,1619),Z((e=e||0)>=0,1620),i=Number.isNaN(i)?g.macro.REPEAT_FOREVER:i,n=n||0;var r=g.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&&g.director.getScheduler().unschedule(t,this)},i.unscheduleAllCallbacks=function(){g.director.getScheduler().unscheduleAllForTarget(this)},n(e,[{key:"name",get:function(){if(this._name)return this._name;var t=wt(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=g.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&Vd}}]),e}(Ta)).EventHandler=Hd,Fd.system=null,d((Md=Fd).prototype,"__scriptAsset",[Nd],Object.getOwnPropertyDescriptor(Md.prototype,"__scriptAsset"),Md.prototype),Pd=gs(Md.prototype,"node",[Ls],(function(){return null})),Ld=gs(Md.prototype,"_enabled",[Ls],(function(){return!0})),Bd=gs(Md.prototype,"__prefab",[Ls],(function(){return null})),Dd=Md))||Dd)),Xd=Wd.prototype;Xd.update=void 0,Xd.lateUpdate=void 0,Xd.__preload=void 0,Xd.onLoad=void 0,Xd.start=void 0,Xd.onEnable=void 0,Xd.onDisable=void 0,Xd.onDestroy=void 0,Xd.onFocusInEditor=void 0,Xd.onLostFocusInEditor=void 0,Xd.resetInEditor=void 0,Xd._getLocalBounds=void 0,Xd.onRestore=void 0,Wd._requireComponent=null,Wd._executionOrder=0,At(Wd,"_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)})),g.Component=Wd;var jd=t("MissingScript",bs("cc.MissingScript")((kd=function(t){function e(){var e;return(e=t.call(this)||this)._$erialized=Gd&&Gd(),e}return s(e,t),e.safeFindClass=function(t){var e=Jt(t);if(e)return e;g.deserialize.reportMissingClass(t)},e.prototype.onLoad=function(){j(4600,this.node.name)},e}(Wd),Gd=gs(kd.prototype,"_$erialized",[Ls,Fs],(function(){return null})),Ud=kd))||Ud);g._MissingScript=jd;try{var Yd=jd.__values__;0!==Yd.length&&"_$erialized"===Yd[Yd.length-1]||(F("The '_$erialized' prop in MissingScript is missing. Please contact jare."),F(" Error props: ['"+Yd+"']"))}catch(Dn){F("Error when checking MissingScript 5, "+Dn)}var Kd=function(){function t(t,e){this._document=void 0,this._chunks=void 0,this._document=t,this._chunks=e}return n(t,[{key:"document",get:function(){return this._document}},{key:"chunks",get:function(){return this._chunks}}]),t}();function qd(t){var e=t;return{chunks:e.chunks,document:e.document}}function Qd(t){if(t.length<16)throw new Zd(J(13102));var e=new DataView(t.buffer,t.byteOffset,t.byteLength);if(1313817411!==e.getUint32(0,!0))throw new Zd(J(13100));var i=e.getUint32(4,!0);if(1!==i)throw new Zd(J(13101,i));if(e.getUint32(8,!0)!==e.byteLength)throw new Zd(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 Zd(t)}for(var h=[];n<e.byteLength;){n%8!=0&&(n+=8-n%8);var u=e.getUint32(n,!0);n+=4,h.push(new Uint8Array(e.buffer,n+e.byteOffset,u)),n+=u}if(n!==e.byteLength)throw new Zd(J(13102));return new Kd(a,h)}var Zd=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(c(Error));!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},n(t,[{key:"byteLength",get:function(){return this._length}}])}(),g.internal.parseCCONJson=qd,g.internal.decodeCCONBinary=Qd,g.internal.CCON=Kd;var Jd=ci.Attr.DELIMETER,$d=Jd+"type",tp=Jd+"default",ep=Jd+"formerlySerializedAs",ip=function(t){function e(){return t.call(this,(function(t){t.clear()}),1)||this}return s(e,t),e}(ie);ip.prototype.get=function(t,e,i,n,r){var s=this._get();return s?(s.reset(t,e,i,n,r),s):new np(t,e,i,n,r)};var np=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 Kd?(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===Jt&&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[Oa]?e._deserialize?e._deserialize(t.content,this):g.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=Gt(i);r&&n._deserializeInto(t,e,r)}};e[Oa](r,this._context)},e._deserializeFireClass=function(t,e,i){var n;if(i.hasOwnProperty("__deserialize__"))n=i.__deserialize__;else{n=function(t,e){var i=Se.test(ee(e)),n=Ht(e,g.Node)||Ht(e,g.Component),r=!1,s=[],a=s,o=[],h=o,u=[];return function(){var t=e.__values__;r="_$erialized"===t[t.length-1];for(var n=ci.Attr.getClassAttrs(e),c=0;c<t.length;c++){var l=t[c],_=l;n[l+ep]&&(_=n[l+ep]);var f=ci.getDefault(n[l+tp]),d=n[l+$d],p=!1;if(i&&(void 0!==f||d))if(void 0===f)p=d instanceof ci.Attr.PrimitiveType||d===si||d===ai;else{var m=typeof f;p="string"===m||"number"===m||"boolean"===m}i&&p?(_!==l&&a===s&&(a=s.slice()),s.push(l),a!==s&&a.push(_)):(_!==l&&h===o&&(h=o.slice()),o.push(l),h!==o&&h.push(_),u.push(f instanceof g.ValueType&&f.constructor))}}(),function(t,e,c){for(var l=0;l<s.length;++l){var _=c[a[l]];void 0!==_&&(e[s[l]]=_)}for(var f=0;f<o.length;++f){var d=o[f],p=c[h[f]];if(void 0!==p)if(i||"object"==typeof p){var m=u[f];m?i||p?t._deserializeFastDefinedObject(e[d],p,m):e[d]=null:p?t._deserializeAndAssignField(e,p,d):e[d]=null}else e[d]=p}n&&c._id&&(e._id=c._id),r&&(e._$erialized=JSON.parse(JSON.stringify(c)),t._fillPlainObject(e._$erialized,c))}}(0,i);try{if(i===jd){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)}At(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 h=e.__expectedType__;this.result.push(t,i,o,h)}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===g.Vec2)return t.x=e.x||0,void(t.y=e.y||0);if(i===g.Vec3)return t.x=e.x||0,t.y=e.y||0,void(t.z=e.z||0);if(i!==g.Color){if(i===g.Size)return t.width=e.width||0,void(t.height=e.height||0);for(var n=ci.Attr.getClassAttrs(i),r=i.__values__,s=0;s<r.length;s++){var a=r[s],o=e[a];void 0!==o||e.hasOwnProperty(a)||(o=ci.getDefault(n[a+tp])),"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 h=e.a;t.a=void 0===h?255:h}},n(t,[{key:"ignoreEditorOnly",get:function(){return this._ignoreEditorOnly}}]),t}();np.pool=new ip;var rp=[pn,Wi,ki,en,qi,vn,En,cn];function sp(t,e){t.x=e[1],t.y=e[2],t.z=e[3],t.w=e[4]}var ap=[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]},sp,sp,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){cn.fromArray(t,e,1)}],op=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 hp(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],h=1;h<o;++h)r[s[i[h]]]=e[h];for(;h<e.length;++h){var u=s[i[h]],c=n[i[h]+a];(0,dp[c])(t,r,u,e[h])}return r}function up(t,e,i){var n=new e;return n._deserialize?n._deserialize(i,t[0]):K(5303,wt(e)),n}function cp(t,e,i,n){n>=0?e[i]=t[5][n]:t[7][3*~n]=e}function lp(t){return function(e,i,n,r){for(var s=0;s<r.length;++s)t(e,r,s,r[s]);i[n]=r}}function _p(t,e,i,n){e[i]=null,t[8][n]=e}function fp(t,e,i,n){e[i]=hp(t,n)}op.pool=new ie((function(t){t.reset()}),5),op.pool.get=function(){return this._get()||new op};var dp=new Array(13);function pp(t,e,i){return t||i(e),Object}function mp(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)||pp(s,n,a);return e[i]=r,new r}}(i,n,e));o=pp(s,e,a)}i[n]=o}function gp(t,e,i,n){for(var r=i||Jt,s=t[3],a=0;a<s.length;++a){var o=s[a];"string"!=typeof o?mp(r,o[0],o,0,e,i,n):mp(r,o,s,a,e,i,n)}}function vp(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 yp(t,e,i){"string"==typeof t&&(t=JSON.parse(t));var n,r=!e;if(e=e||op.pool.get(),function(t){if(Array.isArray(t)){var e=t[0];return"number"==typeof e||e instanceof Ep}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||(gp(t,!1,i.classFinder,null!==(s=i.reportMissingClass)&&void 0!==s?s:yp.reportMissingClass),vp(t)),g.game._isCloning=!0;var h=t[5],u=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]=hp(t,e[a]);for(var o=t[3],h=0;h<n;++h,++a){var u=i[h],c=e[a];if(u>=0){var l=o[u];e[a]=up(t,l,c)}else(0,dp[u=~u])(t,e,a,c)}return r}(t);g.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]],h=t[r+1];h>=0?a[i[h]]=o:a[~h]=o}for(;r<n;r+=3){var u=e[t[r]],c=e[t[r+2]],l=t[r+1];l>=0?u[i[l]]=c:u[~l]=c}}(t[7],h,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 h=r[o];"number"==typeof h&&(r[o]=e[h]);var u=s[o];"number"==typeof u&&(u=u>=0?i[u]:~u,s[o]=u);var c=a[o];"number"==typeof c&&(a[o]=n[c])}}(t),n=h[u]}else n=function(t,e,i){var n,r=(i=i||{}).classFinder||Jt,s=i.createAssetRefs||dc.platform===Vu.EDITOR_CORE,a=i.customEnv,o=i.ignoreEditorOnly,h=null!==(n=i.reportMissingClass)&&void 0!==n?n:g.deserialize.reportMissingClass;e.init();var u=np.pool.get(e,r,h,a,o);g.game._isCloning=!0;var c=u.deserialize(t);return g.game._isCloning=!1,np.pool.put(u),s&&e.assignAssetsBy((function(t,e){return EditorExtends.serialize.asAsset(t,e.type)})),c}(t,e,i);return r&&op.pool.put(e),n}dp[0]=function(t,e,i,n){e[i]=n},dp[1]=cp,dp[2]=lp(cp),dp[3]=lp(_p),dp[4]=fp,dp[5]=function(t,e,i,n){ap[n[0]](e[i],n)},dp[6]=_p,dp[7]=function(t,e,i,n){e[i].set(n)},dp[8]=function(t,e,i,n){var r=new rp[n[0]];ap[n[0]](r,n),e[i]=r},dp[9]=lp(fp),dp[10]=function(t,e,i,n){var r=t[3][n[0]];e[i]=up(t,r,n[1])},dp[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],h=n[s+2];(0,dp[o])(t,r,a,h)}},dp[12]=function(t,e,i,n){for(var r=n[0],s=0;s<r.length;++s){var a=r[s],o=n[s+1];0!==o&&(0,dp[o])(t,r,s,a)}e[i]=r},yp.Details=op,yp.reportMissingClass=function(t){K(5302,t)};var Ep=function(t){this.preprocessed=!0,this.version=t};function Tp(t,e,i){return[1,0,0,[t],0,i?[e,-1]:[e],[0],0,[],[],[]]}g.deserialize=yp;var Sp=new WeakMap,Ap=new WeakSet,Rp=new WeakSet;function Cp(t,e){var i;i=jd.safeFindClass;var n,r=op.pool.get();try{n=yp(t,r,{classFinder:i,customEnv:e})}catch(t){throw F(t),op.pool.put(r),t}n._uuid=e.__uuid__||"";for(var s=r.uuidList,a=r.uuidObjList,o=r.uuidPropList,h=r.uuidTypeList||[],u=[],c=0;c<s.length;c++){var l=s[c];u[c]={uuid:Mf(l),owner:a[c],prop:o[c],type:Jt(h[c])}}return Sp.set(n,u),n._native&&Ap.add(n),op.pool.put(r),n}var bp=function(){function t(){this._depends=new pf}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?r({},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 Kd){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=Cp(e,{__uuid__:t});(r=this._parseDepsFromAsset(s)).nativeDep&&(r.nativeDep.uuid=t),Ef.add(t+"@import",s)}catch(e){yf.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=Sp.get(t),n=0,r=i.length;n<r;n++)e.deps.push(i[n].uuid);return Ap.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]=Mf(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))}},n(t,null,[{key:"instance",get:function(){return this._instance||(this._instance=new t),this._instance}}]),t}();bp._instance=void 0;var Ip,wp=bp.instance,Op=[new Il];function xp(t){return t&&0==(t&t-1)}var Np,Dp,Mp,Pp,Lp,Bp=bs("cc.SimpleTexture")(Ip=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}s(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=Op[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,Op):n.copyTexImagesToTexture([t],this._gfxTexture,Op)}}},i._assignImage=function(t,e,i){var n=t.data;if(n&&(this.uploadData(n,e,i),this._checkTextureLoaded(),Te.CLEANUP_IMAGE_CACHE)){var r=wp.getDeps(this._uuid),s=r.indexOf(t._uuid);-1!==s&&(se(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=kc.NONE;this._mipFilter!==qf.NONE&&function(t,e,i){return!(t.gfxAPI===Ic.WEBGL)||xp(e)&&xp(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()||this.isCompressed||(e=kc.GEN_MIPMAP));var i=this._getGfxTextureCreateInfo({usage:Uc.SAMPLED|Uc.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)},n(e,[{key:"mipmapLevel",get:function(){return this._mipmapLevel}}]),e}(yd))||Ip;g.SimpleTexture=Bp;var Fp=t("Texture2D",(Np=bs("cc.Texture2D"),Dp=sa([dd]),Np((Pp=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)._mipmaps=Lp&&Lp(),e._generatedMipmaps=[],e}s(e,t);var i=e.prototype;return i._setMipmapParams=function(t){var e=this;if(this._generatedMipmaps=t,this._setMipmapLevel(this._generatedMipmaps.length),this._generatedMipmaps.length>0){var i=this._generatedMipmaps[0];this.reset({width:i.width,height:i.height,format:i.format,mipmapLevel:this._generatedMipmaps.length,baseLevel:this._baseLevel,maxLevel:this._maxLevel}),this._generatedMipmaps.forEach((function(t,i){e._assignImage(t,i)}))}else this.reset({width:0,height:0,mipmapLevel:this._generatedMipmaps.length,baseLevel:this._baseLevel,maxLevel:this._maxLevel})},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=Yf.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._generatedMipmaps.length))for(var i=Math.min(void 0===e?this._generatedMipmaps.length:e,this._generatedMipmaps.length-t),n=0;n<i;++n){var r=t+n;this._assignImage(this._generatedMipmaps[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=[],this._generatedMipmaps=[],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 dd,n.mipmaps[r]){var s=n.mipmaps[r];i.result.push(this._mipmaps,""+r,s,ee(dd))}},i._getGfxTextureCreateInfo=function(t){var e=new Ul(Fc.TEX2D);return e.width=this._width,e.height=this._height,Object.assign(e,t),e},i._getGfxTextureViewCreateInfo=function(t){var e=new kl;return e.type=Fc.TEX2D,Object.assign(e,t),e},i.initDefault=function(e){t.prototype.initDefault.call(this,e);var i=new dd;i.initDefault(),this.image=i},i.validate=function(){return this.mipmaps&&0!==this.mipmaps.length},n(e,[{key:"mipmaps",get:function(){return this._mipmaps},set:function(t){this._mipmaps=t;var e=[];if(1===t.length){var i=t[0];e.push.apply(e,i.extractMipmaps())}else if(t.length>1)for(var n=0;n<t.length;++n){var r=t[n];e.push(r.extractMipmap0())}this._setMipmapParams(e)}},{key:"image",get:function(){return 0===this._mipmaps.length?null:this._mipmaps[0]},set:function(t){this.mipmaps=t?[t]:[]}}]),e}(Bp),Lp=gs(Pp.prototype,"_mipmaps",[Dp],(function(){return[]})),Mp=Pp))||Mp));g.Texture2D=Fp;var Up=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 kp;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;g.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 h={x:r,y:s,texture:this._texture};return this._innerSpriteFrames.push(t),h},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}(),kp=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.initWithSize=function(t,e,i){void 0===i&&(i=Yf.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 Il;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}(Fp),Gp={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},Hp=t("Layers",function(){function t(){}return t.init=function(){var e=Ee.querySettings(ye.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=f(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,At(t.Enum,String(n),e),t.BitMask[e]=n,At(t.BitMask,String(n),e),le.update(t.BitMask),fe.update(t.Enum)}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],le.update(t.BitMask),fe.update(t.Enum)}},t.nameToLayer=function(e){return void 0===e?(console.warn("name can't be undefined"),-1):E(t.Enum[e])},t.layerToName=function(e){return e>31||e<0?(console.warn("Unable to access unknown layer."),""):t.Enum[1<<e]},t}());Hp.Enum=fe(Gp),Hp.BitMask=le(r({},Gp)),g.Layers=Hp;var zp,Vp,Wp=function(){var t=e.prototype;function e(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.setOpacity=function(t){this._opacity=t},t.applyOpacity=function(t){this._opacity=this._localOpacity*t},e.markOpacityTree=function(){},n(e,[{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}}]),e}();Ta.Flags.Destroying,g.GAME_VIEW,t("NodeSpace",zp),function(t){t[t.LOCAL=0]="LOCAL",t[t.WORLD=1]="WORLD"}(zp||t("NodeSpace",zp={})),t("TransformBit",Vp),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"}(Vp||t("TransformBit",Vp={})),g.internal.TransformBit=Vp;var Xp,jp,Yp,Kp,qp,Qp,Zp,Jp,$p,tm,em,im,nm,rm,sm,am,om,hm,um=t("MobilityMode",fe({Static:0,Stationary:1,Movable:2}));t("NodeEventType",Xp),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.MOBILITY_CHANGED="mobility-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",t.LIGHT_PROBE_CHANGED="light-probe-changed",t.LIGHT_PROBE_BAKING_CHANGED="light-probe-baking-changed"}(Xp||t("NodeEventType",Xp={}));var cm=Ta.Flags.Destroying,lm=Ta.Flags.DontDestroy,_m=Ta.Flags.Deactivating,fm=new pt("Node");function dm(t){return t?"string"==typeof t?$t(t):t:(K(3804),null)}var pm=new Wi,mm=new Wi,gm=new en,vm=new en,ym=new en,Em=new Ji;new Ji;var Tm,Sm,Am,Rm,Cm,bm,Im,wm,Om,xm=new cn,Nm=new cn,Dm=[],Mm=Symbol("ReserveContentsForAllSyncablePrefab"),Pm=0,Lm=(jp=bs("cc.Node"),Yp=sa(Wi),Kp=sa(um),jp(((hm=function(t){s(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 h=r[o];h instanceof e&&i.push(h)}},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(i=t.call(this,e)||this)._parent=Zp&&Zp(),i._children=Jp&&Jp(),i._active=$p&&$p(),i._components=tm&&tm(),i._prefab=em&&em(),i._scene=null,i._activeInHierarchy=!1,i._id=fm.getNewId(),i._name=void 0,i._eventProcessor=new g.NodeEventProcessor(l(i)),i._eventMask=0,i._siblingIndex=0,i._originalSceneId="",i._uiProps=new Wp(l(i)),i._static=!1,i._lpos=im&&im(),i._lrot=nm&&nm(),i._lscale=rm&&rm(),i._mobility=sm&&sm(),i._layer=am&&am(),i._euler=om&&om(),i._transformFlags=Vp.NONE,i._eulerDirty=!1,i._flagChangeVersion=0,i._hasChangedFlags=0,i._name=void 0!==e?e:"New Node",i._pos=new Wi,i._rot=new en,i._scale=new Wi(1,1,1),i._mat=new cn,i}return e.getWritableComponents=function(){return this._components},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){Ut(this,t)},e.getParent=function(){return this._parent},e.modifyParent=function(t){this._parent=t},e.setParent=function(t,e){if(void 0===e&&(e=!1),e&&this.updateWorldTransform(),this._parent!==t){var i=this._parent,n=t;if(this._parent=n,this._siblingIndex=0,this._onSetParent(i,e),this.emit&&this.emit(Xp.PARENT_CHANGED,i),i&&!(i._objFlags&cm)){var r=i._children.indexOf(this);i._children.splice(r,1),i._updateSiblingIndex(),i.emit&&i.emit(Xp.CHILD_REMOVED,this)}n&&(n._children.push(this),this._siblingIndex=n._children.length-1,n.emit&&n.emit(Xp.CHILD_ADDED,this)),this._onHierarchyChanged(i)}},e.getChildByUuid=function(t){if(!t)return L("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 L("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(){var t=e[r];if(0===t.length)return"continue";var n=i.children.find((function(e){return e.name===t}));if(!n)return{v:null};i=n},r=0;r<e.length;++r){var s=n();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&_m)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),this._eventProcessor.onUpdatingSiblingIndex())}},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 h=null,u=!1;n;)if(s=o[--n])if(!u&&t?t(s):u&&e&&e(s),o[n]=null,u){if(h===this._parent)break;if(u=!1,r)if(r[++a])o[n]=r[a],n++;else if(h&&(o[n]=h,n++,u=!0,h._parent?(a=(r=h._parent._children).indexOf(h),h=h._parent):(h=null,r=null),a<0))break}else s._children.length>0?(h=s,r=s._children,a=0,o[n]=r[a],n++):(o[n]=s,n++,u=!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=dm(t);return e?i._findComponent(this,e):null},e.getComponents=function(t){var e=dm(t),n=[];return e&&i._findComponents(this,e,n),n},e.getComponentInChildren=function(t){var e=dm(t);return e?i._findChildComponent(this._children,e):null},e.getComponentsInChildren=function(t){var e=dm(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=$t(t)))throw g._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(!Ht(e,g.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(Xp.COMPONENT_ADDED,a),this._activeInHierarchy&&g.director._nodeActivator.activateComp(a),a},e.removeComponent=function(t){if(t){var e=null;(e=t instanceof Wd?t:this.getComponent(t))&&e.destroy()}else K(3813)},e.on=function(t,e,i,n){switch(void 0===n&&(n=!1),t){case Xp.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 Xp.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(Xp.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&cm)){var e=this._components.indexOf(t);-1!==e?(this._components.splice(e,1),this.emit(Xp.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(Xp.SIBLING_ORDER_CHANGED)},e._instantiate=function(t,e){return t||(t=g.instantiate._clone(this,this)),t._prefab,t._parent=null,t._onBatchCreated(e),t},e._onHierarchyChangedBase=function(){var t=this._parent;!this._persistNode||t instanceof g.Scene||g.game.removePersistRootNode(this);var e=this._active&&!(!t||!t._activeInHierarchy);this._activeInHierarchy!==e&&g.director._nodeActivator.activateNode(this,e)},e._onPreDestroyBase=function(){this._objFlags|=cm;var t=this._parent,e=!!t&&0!=(t._objFlags&cm);if(this._persistNode&&g.game.removePersistRootNode(this),!e&&t){this.emit(Xp.PARENT_CHANGED,this);var i=t._children.indexOf(this);t._children.splice(i,1),this._siblingIndex=0,t._updateSiblingIndex(),t.emit&&t.emit(Xp.CHILD_REMOVED,this)}this.emit(Xp.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},i.isNode=function(t){return t instanceof i&&(t.constructor===i||!(t instanceof g.Scene))},e._onPreDestroy=function(){return this._onPreDestroyBase()},e[wa]=function(t){t.writeThis()},e._onSetParent=function(t,e){if(void 0===e&&(e=!1),this._parent&&(null!=t&&t._scene===this._parent._scene||null==this._parent._scene||this.walk(i._setScene)),e){var n=this._parent;n?(n.updateWorldTransform(),Ei(cn.determinant(n._mat),0,vi)?(j(14300),this._transformFlags|=Vp.TRS,this.updateWorldTransform()):(cn.multiply(xm,cn.invert(xm,n._mat),this._mat),cn.toRTS(xm,this._lrot,this._lpos,this._lscale))):(Wi.copy(this._lpos,this._pos),en.copy(this._lrot,this._rot),Wi.copy(this._lscale,this._scale)),this._eulerDirty=!0}this.invalidateChildren(Vp.TRS)},e._onHierarchyChanged=function(t){this.eventProcessor.reattach(),this._onHierarchyChangedBase(t)},e._onBatchCreated=function(t){this.hasChangedFlags=Vp.TRS,this._transformFlags|=Vp.TRS;for(var e=this._children.length,i=0;i<e;++i)this._children[i]._siblingIndex=i,this._children[i]._onBatchCreated(t)},e._onBeforeSerialize=function(){this.eulerAngles},e._onPostActivated=function(t){t?(this._eventProcessor.setEnabled(!0),this.invalidateChildren(Vp.TRS),this._uiProps&&this._uiProps.uiComp&&(this._uiProps.uiComp.setNodeDirty(),this._uiProps.uiComp.setTextureDirty(),this._uiProps.uiComp.markForUpdateRenderData())):this._eventProcessor.setEnabled(!1)},e.translate=function(t,e){var i=e||zp.LOCAL;if(i===zp.LOCAL)Wi.transformQuat(pm,t,this._lrot),this._lpos.x+=pm.x,this._lpos.y+=pm.y,this._lpos.z+=pm.z;else if(i===zp.WORLD)if(this._parent){en.invert(gm,this._parent.worldRotation),Wi.transformQuat(pm,t,gm);var n=this.worldScale;this._lpos.x+=pm.x/n.x,this._lpos.y+=pm.y/n.y,this._lpos.z+=pm.z/n.z}else this._lpos.x+=t.x,this._lpos.y+=t.y,this._lpos.z+=t.z;this.invalidateChildren(Vp.POSITION),1&this._eventMask&&this.emit(Xp.TRANSFORM_CHANGED,Vp.POSITION)},e.rotate=function(t,e){var i=e||zp.LOCAL;if(en.normalize(gm,t),i===zp.LOCAL)en.multiply(this._lrot,this._lrot,gm);else if(i===zp.WORLD){var n=this.worldRotation;en.multiply(vm,gm,n),en.invert(gm,n),en.multiply(vm,gm,vm),en.multiply(this._lrot,this._lrot,vm)}this._eulerDirty=!0,this.invalidateChildren(Vp.ROTATION),1&this._eventMask&&this.emit(Xp.TRANSFORM_CHANGED,Vp.ROTATION)},e.lookAt=function(t,e){this.getWorldPosition(pm),Wi.subtract(pm,pm,t),Wi.normalize(pm,pm),en.fromViewUp(gm,pm,e),this.setWorldRotation(gm)},e.invalidateChildren=function(t){var e,i,n=0,r=0,s=0,a=0,o=t|Vp.POSITION;for(Dm[0]=this;n>=0;){if(a=(e=Dm[n--]).hasChangedFlags,e.isValid&&(e._transformFlags&a&t)!==t)for(e._transformFlags|=t,e.hasChangedFlags=a|t,s=(i=e._children).length,r=0;r<s;r++)Dm[++n]=i[r];t=o}},e.updateWorldTransform=function(){if(this._transformFlags){for(var t,e=this,i=0;e&&e._transformFlags;)Dm[i++]=e,e=e._parent;for(var n=0;i;){if(n|=(t=Dm[--i])._transformFlags,e){if(n&Vp.POSITION&&(Wi.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&Vp.RS){cn.fromRTS(t._mat,t._lrot,t._lpos,t._lscale),cn.multiply(t._mat,e._mat,t._mat);var r=n&Vp.ROTATION?t._rot:null;cn.toRTS(t._mat,r,null,t._scale)}}else n&Vp.POSITION&&(Wi.copy(t._pos,t._lpos),t._mat.m12=t._pos.x,t._mat.m13=t._pos.y,t._mat.m14=t._pos.z),n&Vp.RS&&(n&Vp.ROTATION&&en.copy(t._rot,t._lrot),n&Vp.SCALE&&Wi.copy(t._scale,t._lscale),cn.fromRTS(t._mat,t._rot,t._pos,t._scale));t._transformFlags=Vp.NONE,e=t}}},e.setPosition=function(t,e,i){void 0===e&&void 0===i?Wi.copy(this._lpos,t):void 0===i?Wi.set(this._lpos,t,e,this._lpos.z):Wi.set(this._lpos,t,e,i),this.invalidateChildren(Vp.POSITION),1&this._eventMask&&this.emit(Xp.TRANSFORM_CHANGED,Vp.POSITION)},e.getPosition=function(t){return t?Wi.set(t,this._lpos.x,this._lpos.y,this._lpos.z):Wi.copy(new Wi,this._lpos)},e.setRotation=function(t,e,i,n){void 0===e||void 0===i||void 0===n?en.copy(this._lrot,t):en.set(this._lrot,t,e,i,n),this._eulerDirty=!0,this.invalidateChildren(Vp.ROTATION),1&this._eventMask&&this.emit(Xp.TRANSFORM_CHANGED,Vp.ROTATION)},e.setRotationFromEuler=function(t,e,i){var n=void 0===i?this._euler.z:i;void 0===e?(Wi.copy(this._euler,t),en.fromEuler(this._lrot,t.x,t.y,t.z)):(Wi.set(this._euler,t,e,n),en.fromEuler(this._lrot,t,e,n)),this._eulerDirty=!1,this.invalidateChildren(Vp.ROTATION),1&this._eventMask&&this.emit(Xp.TRANSFORM_CHANGED,Vp.ROTATION)},e.getRotation=function(t){return t?en.set(t,this._lrot.x,this._lrot.y,this._lrot.z,this._lrot.w):en.copy(new en,this._lrot)},e.setScale=function(t,e,i){void 0===e&&void 0===i?Wi.copy(this._lscale,t):void 0===i?Wi.set(this._lscale,t,e,this._lscale.z):Wi.set(this._lscale,t,e,i),this.invalidateChildren(Vp.SCALE),1&this._eventMask&&this.emit(Xp.TRANSFORM_CHANGED,Vp.SCALE)},e.getScale=function(t){return t?Wi.set(t,this._lscale.x,this._lscale.y,this._lscale.z):Wi.copy(new Wi,this._lscale)},e.inverseTransformPoint=function(t,e){Wi.copy(t,e);for(var i=this,n=0;i._parent;)Dm[n++]=i,i=i._parent;for(;n>=0;)Wi.transformInverseRTS(t,t,i._lrot,i._lpos,i._lscale),i=Dm[--n];return t},e.setWorldPosition=function(t,e,i){void 0===e||void 0===i?Wi.copy(this._pos,t):Wi.set(this._pos,t,e,i);var n=this._parent,r=this._lpos;n?(n.updateWorldTransform(),Wi.transformMat4(r,this._pos,cn.invert(xm,n._mat))):Wi.copy(r,this._pos),this.invalidateChildren(Vp.POSITION),1&this._eventMask&&this.emit(Xp.TRANSFORM_CHANGED,Vp.POSITION)},e.getWorldPosition=function(t){return this.updateWorldTransform(),t?Wi.copy(t,this._pos):Wi.copy(new Wi,this._pos)},e.setWorldRotation=function(t,e,i,n){void 0===e||void 0===i||void 0===n?en.copy(this._rot,t):en.set(this._rot,t,e,i,n),this._parent?(this._parent.updateWorldTransform(),en.multiply(this._lrot,en.conjugate(this._lrot,this._parent._rot),this._rot)):en.copy(this._lrot,this._rot),this._eulerDirty=!0,this.invalidateChildren(Vp.ROTATION),1&this._eventMask&&this.emit(Xp.TRANSFORM_CHANGED,Vp.ROTATION)},e.setWorldRotationFromEuler=function(t,e,i){en.fromEuler(this._rot,t,e,i),this._parent?(this._parent.updateWorldTransform(),en.multiply(this._lrot,en.conjugate(this._lrot,this._parent._rot),this._rot)):en.copy(this._lrot,this._rot),this._eulerDirty=!0,this.invalidateChildren(Vp.ROTATION),1&this._eventMask&&this.emit(Xp.TRANSFORM_CHANGED,Vp.ROTATION)},e.getWorldRotation=function(t){return this.updateWorldTransform(),t?en.copy(t,this._rot):en.copy(new en,this._rot)},e.setWorldScale=function(t,e,i){var n=this._parent;n&&this.updateWorldTransform(),void 0===e||void 0===i?Wi.copy(this._scale,t):Wi.set(this._scale,t,e,i),n?(pm.x=this._scale.x/Wi.set(mm,this._mat.m00,this._mat.m01,this._mat.m02).length(),pm.y=this._scale.y/Wi.set(mm,this._mat.m04,this._mat.m05,this._mat.m06).length(),pm.z=this._scale.z/Wi.set(mm,this._mat.m08,this._mat.m09,this._mat.m10).length(),cn.scale(xm,this._mat,pm),cn.multiply(Nm,cn.invert(Nm,n._mat),xm),Ji.fromQuat(Em,en.conjugate(ym,this._lrot)),Ji.multiplyMat4(Em,Em,Nm),this._lscale.x=Wi.set(pm,Em.m00,Em.m01,Em.m02).length(),this._lscale.y=Wi.set(pm,Em.m03,Em.m04,Em.m05).length(),this._lscale.z=Wi.set(pm,Em.m06,Em.m07,Em.m08).length()):Wi.copy(this._lscale,this._scale),this.invalidateChildren(Vp.SCALE),1&this._eventMask&&this.emit(Xp.TRANSFORM_CHANGED,Vp.SCALE)},e.getWorldScale=function(t){return this.updateWorldTransform(),t?Wi.copy(t,this._scale):Wi.copy(new Wi,this._scale)},e.getWorldMatrix=function(t){this.updateWorldTransform();var e=t||new cn;return cn.copy(e,this._mat)},e.getWorldRS=function(t){this.updateWorldTransform();var e=t||new cn;return cn.copy(e,this._mat),e.m12=0,e.m13=0,e.m14=0,e},e.getWorldRT=function(t){this.updateWorldTransform();var e=t||new cn;return cn.fromRT(e,this._rot,this._pos)},e.setRTS=function(t,e,i){var n=0;t&&(n|=Vp.ROTATION,void 0!==t.w?(en.copy(this._lrot,t),this._eulerDirty=!0):(Wi.copy(this._euler,t),en.fromEuler(this._lrot,t.x,t.y,t.z),this._eulerDirty=!1)),e&&(Wi.copy(this._lpos,e),n|=Vp.POSITION),i&&(Wi.copy(this._lscale,i),n|=Vp.SCALE),n&&(this.invalidateChildren(n),1&this._eventMask&&this.emit(Xp.TRANSFORM_CHANGED,n))},e.isTransformDirty=function(){return this._transformFlags!==Vp.NONE},e.pauseSystemEvents=function(t){this._eventProcessor.setEnabled(!1,t)},e.resumeSystemEvents=function(t){this._eventProcessor.setEnabled(!0,t)},i.resetHasChangedFlags=function(){Pm+=1},i.clearNodeArray=function(){i.ClearFrame<i.ClearRound?i.ClearFrame++:(i.ClearFrame=0,Dm.length=0)},e.getPathInHierarchy=function(){for(var t=this.name,e=this.parent;e&&!(e instanceof g.Scene);)t=e.name+"/"+t,e=e.parent;return t},n(i,[{key:"components",get:function(){return this._components}},{key:"_persistNode",get:function(){return(this._objFlags&lm)>0},set:function(t){t?this._objFlags|=lm:this._objFlags&=~lm}},{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&&g.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}},{key:"id",set:function(t){this._id=t}},{key:"siblingIndex",get:function(){return this._siblingIndex},set:function(t){this._siblingIndex=t}},{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&&(en.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){Wi.set(this._euler,0,0,t),en.fromAngleZ(this._lrot,t),this._eulerDirty=!1,this.invalidateChildren(Vp.ROTATION),1&this._eventMask&&this.emit(Xp.TRANSFORM_CHANGED,Vp.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){cn.toRTS(t,this._lrot,this._lpos,this._lscale),this.invalidateChildren(Vp.TRS),this._eulerDirty=!0,1&this._eventMask&&this.emit(Xp.TRANSFORM_CHANGED,Vp.TRS)}},{key:"worldMatrix",get:function(){return this.updateWorldTransform(),this._mat}},{key:"forward",get:function(){return Wi.transformQuat(new Wi,Wi.FORWARD,this.worldRotation)},set:function(t){var e=t.length();Wi.multiplyScalar(pm,t,-1/e),en.fromViewUp(gm,pm),this.setWorldRotation(gm)}},{key:"up",get:function(){return Wi.transformQuat(new Wi,Wi.UP,this.worldRotation)}},{key:"right",get:function(){return Wi.transformQuat(new Wi,Wi.RIGHT,this.worldRotation)}},{key:"mobility",get:function(){return this._mobility},set:function(t){this._mobility=t,this.emit(Xp.MOBILITY_CHANGED)}},{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(Xp.LAYER_CHANGED,this._layer)}},{key:"flagChangedVersion",get:function(){return this._flagChangeVersion}},{key:"hasChangedFlags",get:function(){return this._flagChangeVersion===Pm?this._hasChangedFlags:0},set:function(t){this._flagChangeVersion=Pm,this._hasChangedFlags=t}}]),i}(Ta)).idGenerator=fm,hm._stacks=[[]],hm._stackId=0,hm.EventType=Xp,hm.NodeSpace=zp,hm.TransformDirtyBit=Vp,hm.TransformBit=Vp,hm.reserveContentsForAllSyncablePrefabTag=Mm,hm.ClearFrame=0,hm.ClearRound=1e3,d((Qp=hm).prototype,"_persistNode",[xs],Object.getOwnPropertyDescriptor(Qp.prototype,"_persistNode"),Qp.prototype),Zp=gs(Qp.prototype,"_parent",[Ls],(function(){return null})),Jp=gs(Qp.prototype,"_children",[Ls],(function(){return[]})),$p=gs(Qp.prototype,"_active",[Ls],(function(){return!0})),tm=gs(Qp.prototype,"_components",[Ls],(function(){return[]})),em=gs(Qp.prototype,"_prefab",[Ls],(function(){return null})),im=gs(Qp.prototype,"_lpos",[Ls],(function(){return new Wi})),nm=gs(Qp.prototype,"_lrot",[Ls],(function(){return new en})),rm=gs(Qp.prototype,"_lscale",[Ls],(function(){return new Wi(1,1,1)})),sm=gs(Qp.prototype,"_mobility",[Ls],(function(){return um.Static})),am=gs(Qp.prototype,"_layer",[Ls],(function(){return Hp.Enum.DEFAULT})),om=gs(Qp.prototype,"_euler",[Ls],(function(){return new Wi})),d(Qp.prototype,"eulerAngles",[Yp],Object.getOwnPropertyDescriptor(Qp.prototype,"eulerAngles"),Qp.prototype),d(Qp.prototype,"mobility",[Kp],Object.getOwnPropertyDescriptor(Qp.prototype,"mobility"),Qp.prototype),qp=Qp))||qp);t({Node:Lm,BaseNode:Lm}),g.Node=Lm,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"}(wm||(wm={})),function(t){t[t.NONE=0]="NONE",t[t.AUTO=1]="AUTO",t[t.BAKED_CONVOLUTION_MAP=2]="BAKED_CONVOLUTION_MAP"}(Om||(Om={}));var Bm=t("TextureCube",bs("cc.TextureCube")(((Im=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).isRGBE=Am&&Am(),e._mipmapAtlas=Rm&&Rm(),e._mipmapMode=Cm&&Cm(),e._mipmaps=bm&&bm(),e._generatedMipmaps=[],e}s(e,t);var i=e.prototype;return i._setMipmapParams=function(t){var e=this;if(this._generatedMipmaps=t,this._setMipmapLevel(this._generatedMipmaps.length),this._generatedMipmaps.length>0){var i=this._generatedMipmaps[0].front;this.reset({width:i.width,height:i.height,format:i.format,mipmapLevel:this._generatedMipmaps.length,baseLevel:this._baseLevel,maxLevel:this._maxLevel}),this._generatedMipmaps.forEach((function(t,i){Fm(t,(function(t,n){e._assignImage(t,i,n)}))}))}else this.reset({width:0,height:0,mipmapLevel:this._generatedMipmaps.length,baseLevel:this._baseLevel,maxLevel:this._maxLevel})},i.isUsingOfflineMipmaps=function(){return this._mipmapMode===Om.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+wm.front].image,back:t[a+wm.back].image,left:t[a+wm.left].image,right:t[a+wm.right].image,top:t[a+wm.top].image,bottom:t[a+wm.bottom].image})}return(i=i||new e).mipmaps=n,i},i.onLoaded=function(){this._mipmapMode===Om.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._generatedMipmaps.length))for(var n=Math.min(void 0===e?this._generatedMipmaps.length:e,this._generatedMipmaps.length-t),r=function(){var e=t+s;Fm(i._generatedMipmaps[e],(function(t,n){i._assignImage(t,e,n)}))},s=0;s<n;++s)r()},i.destroy=function(){return this._mipmaps=[],this._generatedMipmaps=[],this._mipmapAtlas=null,t.prototype.destroy.call(this)},i.releaseTexture=function(){this.destroy()},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===Om.BAKED_CONVOLUTION_MAP){var r=n.mipmapAtlas,s=n.mipmapLayout;this._mipmapAtlas={atlas:{},layout:s},this._mipmapAtlas.atlas={front:new dd,back:new dd,left:new dd,right:new dd,top:new dd,bottom:new dd};var a=ee(dd);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 dd,back:new dd,left:new dd,right:new dd,top:new dd,bottom:new dd};var h=n.mipmaps[o],u=ee(dd);i.result.push(this._mipmaps[o],"front",h.front,u),i.result.push(this._mipmaps[o],"back",h.back,u),i.result.push(this._mipmaps[o],"left",h.left,u),i.result.push(this._mipmaps[o],"right",h.right,u),i.result.push(this._mipmaps[o],"top",h.top,u),i.result.push(this._mipmaps[o],"bottom",h.bottom,u)}}},i._getGfxTextureCreateInfo=function(t){var e=new Ul(Fc.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 kl;return e.type=Fc.CUBE,e.baseLayer=0,e.layerCount=6,Object.assign(e,t),e},i._uploadAtlas=function(){var t=this,e=this._mipmapAtlas.layout,i=e[0];this.reset({width:i.width,height:i.height,format:this._mipmapAtlas.atlas.front.format,mipmapLevel:e.length}),Fm(this._mipmapAtlas.atlas,(function(i,n){var r=new Fp;r.image=i,r.reset({width:i.width,height:i.height,format:i.format}),r.uploadData(i.data);for(var s=0;s<e.length;s++){var a=e[s],o=r.getGFXTexture().size,h=new Uint8Array(o),u=new Il;u.texOffset.x=a.left,u.texOffset.y=a.top,u.texExtent.width=a.width,u.texExtent.height=a.height,t._getGFXDevice().copyTextureToBuffers(r.getGFXTexture(),[h],[u]);var c=new dd({_data:h,_compressed:i.isCompressed,width:a.width,height:a.height,format:i.format});t._assignImage(c,a.level,n)}}))},i.initDefault=function(e){t.prototype.initDefault.call(this,e);var i=new dd;i.initDefault(),this.mipmaps=[{front:i,back:i,top:i,bottom:i,left:i,right:i}]},i.validate=function(){if(this._mipmapMode===Om.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)}))},n(e,[{key:"mipmaps",get:function(){return this._mipmaps},set:function(t){this._mipmaps=t;var e=[];if(1===t.length){var i=t[0],n=i.front.extractMipmaps(),r=i.back.extractMipmaps(),s=i.left.extractMipmaps(),a=i.right.extractMipmaps(),o=i.top.extractMipmaps(),h=i.bottom.extractMipmaps();if(n.length!==r.length||n.length!==s.length||n.length!==a.length||n.length!==o.length||n.length!==h.length)return console.error("The number of mipmaps of each face is different."),void this._setMipmapParams([]);for(var u=n.length,c=0;c<u;++c){var l={front:n[c],back:r[c],left:s[c],right:a[c],top:o[c],bottom:h[c]};e.push(l)}}else t.length>1&&t.forEach((function(t){var i={front:t.front.extractMipmap0(),back:t.back.extractMipmap0(),left:t.left.extractMipmap0(),right:t.right.extractMipmap0(),top:t.top.extractMipmap0(),bottom:t.bottom.extractMipmap0()};e.push(i)}));this._setMipmapParams(e)}},{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(y.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(){var t=r[h];Fm(n,(function(n,r){a.clearRect(0,0,i.width,i.height);var s=n.data;a.drawImage(s,0,0);var o=a.getImageData(t.left,t.top,t.width,t.height),h=new dd({_data:o.data,_compressed:n.isCompressed,width:o.width,height:o.height,format:n.format});e._assignImage(h,t.level,r)}))},h=0;h<r.length;h++)o()}}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}(Bp)).FaceIndex=wm,Am=gs((Sm=Im).prototype,"isRGBE",[Ls],(function(){return!1})),Rm=gs(Sm.prototype,"_mipmapAtlas",[Ls],(function(){return null})),Cm=gs(Sm.prototype,"_mipmapMode",[Ls],(function(){return Om.NONE})),bm=gs(Sm.prototype,"_mipmaps",[Ls],(function(){return[]})),Tm=Sm))||Tm);function Fm(t,e){e(t.front,wm.front),e(t.back,wm.back),e(t.left,wm.left),e(t.right,wm.right),e(t.top,wm.top),e(t.bottom,wm.bottom)}g.TextureCube=Bm;var Um=function(){function t(){this._groundAlbedoHDR=new ki(.2,.2,.2,1),this._skyColorHDR=new ki(.2,.5,.8,1),this._skyIllumHDR=0,this._groundAlbedoLDR=new ki(.2,.2,.2,1),this._skyColorLDR=new ki(.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},n(t,[{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled=t}},{key:"skyColor",get:function(){return g.director.root.pipeline.pipelineSceneData.isHDR?this._skyColorHDR:this._skyColorLDR},set:function(t){g.director.root.pipeline.pipelineSceneData.isHDR?this._skyColorHDR.set(t):this._skyColorLDR.set(t)}},{key:"skyIllum",get:function(){return g.director.root.pipeline.pipelineSceneData.isHDR?this._skyIllumHDR:this._skyIllumLDR},set:function(t){g.director.root.pipeline.pipelineSceneData.isHDR?this._skyIllumHDR=t:this._skyIllumLDR=t}},{key:"groundAlbedo",get:function(){return g.director.root.pipeline.pipelineSceneData.isHDR?this._groundAlbedoHDR:this._groundAlbedoLDR},set:function(t){g.director.root.pipeline.pipelineSceneData.isHDR?this._groundAlbedoHDR.set(t):this._groundAlbedoLDR.set(t)}}]),t}();Um.SUN_ILLUM=65e3,Um.SKY_ILLUM=2e4,g.Ambient=Um;var km,Gm,Hm="MainFlow",zm="ForwardFlow",Vm="ShadowFlow";!function(t){t[t.DEFAULT=100]="DEFAULT",t[t.UI=200]="UI"}(km||(km={})),g.RenderPassStage=km,function(t){t[t.MIN=0]="MIN",t[t.MAX=255]="MAX",t[t.DEFAULT=128]="DEFAULT"}(Gm||(Gm={}));var Wm,Xm={bindings:[],layouts:{}},jm={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"}(Wm||(Wm={}));var Ym,Km=Wm.SAMPLER_SHADOWMAP,qm=Wm.COUNT-Km;!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.UBO_SH=6]="UBO_SH",t[t.SAMPLER_JOINTS=7]="SAMPLER_JOINTS",t[t.SAMPLER_MORPH_POSITION=8]="SAMPLER_MORPH_POSITION",t[t.SAMPLER_MORPH_NORMAL=9]="SAMPLER_MORPH_NORMAL",t[t.SAMPLER_MORPH_TANGENT=10]="SAMPLER_MORPH_TANGENT",t[t.SAMPLER_LIGHTMAP=11]="SAMPLER_LIGHTMAP",t[t.SAMPLER_SPRITE=12]="SAMPLER_SPRITE",t[t.SAMPLER_REFLECTION=13]="SAMPLER_REFLECTION",t[t.STORAGE_REFLECTION=14]="STORAGE_REFLECTION",t[t.SAMPLER_REFLECTION_PROBE_CUBE=15]="SAMPLER_REFLECTION_PROBE_CUBE",t[t.SAMPLER_REFLECTION_PROBE_PLANAR=16]="SAMPLER_REFLECTION_PROBE_PLANAR",t[t.SAMPLER_REFLECTION_PROBE_DATA_MAP=17]="SAMPLER_REFLECTION_PROBE_DATA_MAP",t[t.SAMPLER_REFLECTION_PROBE_BLEND_CUBE=18]="SAMPLER_REFLECTION_PROBE_BLEND_CUBE",t[t.COUNT=19]="COUNT"}(Ym||(Ym={}));var Qm,Zm=Ym.SAMPLER_JOINTS,Jm=Ym.STORAGE_REFLECTION-Zm,$m=Ym.COUNT-Zm-Jm;!function(t){t[t.GLOBAL=0]="GLOBAL",t[t.MATERIAL=1]="MATERIAL",t[t.LOCAL=2]="LOCAL",t[t.COUNT=3]="COUNT"}(Qm||(Qm={}));var tg=new xl([Km,0,Zm,0],[qm,0,Jm,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,$m,0],[0,0,0,0],[0,2,1,3]),eg=function(){};eg.SIZE=4*(eg.COUNT=4+(eg.DEBUG_VIEW_MODE_OFFSET=4+(eg.PROBE_INFO_OFFSET=4+(eg.NATIVE_SIZE_OFFSET=4+(eg.SCREEN_SIZE_OFFSET=4+(eg.TIME_OFFSET=0)))))),eg.NAME="CCGlobal",eg.BINDING=Wm.UBO_GLOBAL,eg.DESCRIPTOR=new h_(eg.BINDING,hl.UNIFORM_BUFFER,1,Qc.ALL),eg.LAYOUT=new zl(Qm.GLOBAL,eg.BINDING,eg.NAME,[new Hl("cc_time",Dc.FLOAT4,1),new Hl("cc_screenSize",Dc.FLOAT4,1),new Hl("cc_nativeSize",Dc.FLOAT4,1),new Hl("cc_probeInfo",Dc.FLOAT4,1),new Hl("cc_debug_view_mode",Dc.FLOAT4,1)],1),Xm.layouts[eg.NAME]=eg.LAYOUT,Xm.bindings[eg.BINDING]=eg.DESCRIPTOR;var ig=function(){};ig.SIZE=4*(ig.COUNT=4+(ig.VIEW_PORT_OFFSET=4+(ig.NEAR_FAR_OFFSET=4+(ig.GLOBAL_FOG_ADD_OFFSET=4+(ig.GLOBAL_FOG_BASE_OFFSET=4+(ig.GLOBAL_FOG_COLOR_OFFSET=4+(ig.AMBIENT_GROUND_OFFSET=4+(ig.AMBIENT_SKY_OFFSET=4+(ig.MAIN_LIT_COLOR_OFFSET=4+(ig.MAIN_LIT_DIR_OFFSET=4+(ig.EXPOSURE_OFFSET=4+(ig.SCREEN_SCALE_OFFSET=4+(ig.SURFACE_TRANSFORM_OFFSET=4+(ig.CAMERA_POS_OFFSET=16+(ig.MAT_VIEW_PROJ_INV_OFFSET=16+(ig.MAT_VIEW_PROJ_OFFSET=16+(ig.MAT_PROJ_INV_OFFSET=16+(ig.MAT_PROJ_OFFSET=16+(ig.MAT_VIEW_INV_OFFSET=16+(ig.MAT_VIEW_OFFSET=0)))))))))))))))))))),ig.NAME="CCCamera",ig.BINDING=Wm.UBO_CAMERA,ig.DESCRIPTOR=new h_(ig.BINDING,hl.UNIFORM_BUFFER,1,Qc.ALL),ig.LAYOUT=new zl(Qm.GLOBAL,ig.BINDING,ig.NAME,[new Hl("cc_matView",Dc.MAT4,1),new Hl("cc_matViewInv",Dc.MAT4,1),new Hl("cc_matProj",Dc.MAT4,1),new Hl("cc_matProjInv",Dc.MAT4,1),new Hl("cc_matViewProj",Dc.MAT4,1),new Hl("cc_matViewProjInv",Dc.MAT4,1),new Hl("cc_cameraPos",Dc.FLOAT4,1),new Hl("cc_surfaceTransform",Dc.FLOAT4,1),new Hl("cc_screenScale",Dc.FLOAT4,1),new Hl("cc_exposure",Dc.FLOAT4,1),new Hl("cc_mainLitDir",Dc.FLOAT4,1),new Hl("cc_mainLitColor",Dc.FLOAT4,1),new Hl("cc_ambientSky",Dc.FLOAT4,1),new Hl("cc_ambientGround",Dc.FLOAT4,1),new Hl("cc_fogColor",Dc.FLOAT4,1),new Hl("cc_fogBase",Dc.FLOAT4,1),new Hl("cc_fogAdd",Dc.FLOAT4,1),new Hl("cc_nearFar",Dc.FLOAT4,1),new Hl("cc_viewPort",Dc.FLOAT4,1)],1),Xm.layouts[ig.NAME]=ig.LAYOUT,Xm.bindings[ig.BINDING]=ig.DESCRIPTOR;var ng=function(){};ng.SIZE=4*(ng.COUNT=4+(ng.PLANAR_NORMAL_DISTANCE_INFO_OFFSET=4+(ng.SHADOW_COLOR_OFFSET=4+(ng.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET=4+(ng.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET=4+(ng.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET=4+(ng.SHADOW_PROJ_INFO_OFFSET=4+(ng.SHADOW_PROJ_DEPTH_INFO_OFFSET=4+(ng.SHADOW_INV_PROJ_DEPTH_INFO_OFFSET=16+(ng.MAT_LIGHT_VIEW_PROJ_OFFSET=16+(ng.MAT_LIGHT_VIEW_OFFSET=0))))))))))),ng.NAME="CCShadow",ng.BINDING=Wm.UBO_SHADOW,ng.DESCRIPTOR=new h_(ng.BINDING,hl.UNIFORM_BUFFER,1,Qc.ALL),ng.LAYOUT=new zl(Qm.GLOBAL,ng.BINDING,ng.NAME,[new Hl("cc_matLightView",Dc.MAT4,1),new Hl("cc_matLightViewProj",Dc.MAT4,1),new Hl("cc_shadowInvProjDepthInfo",Dc.FLOAT4,1),new Hl("cc_shadowProjDepthInfo",Dc.FLOAT4,1),new Hl("cc_shadowProjInfo",Dc.FLOAT4,1),new Hl("cc_shadowNFLSInfo",Dc.FLOAT4,1),new Hl("cc_shadowWHPBInfo",Dc.FLOAT4,1),new Hl("cc_shadowLPNNInfo",Dc.FLOAT4,1),new Hl("cc_shadowColor",Dc.FLOAT4,1),new Hl("cc_planarNDInfo",Dc.FLOAT4,1)],1),Xm.layouts[ng.NAME]=ng.LAYOUT,Xm.bindings[ng.BINDING]=ng.DESCRIPTOR;var rg=function(){};rg.CSM_LEVEL_COUNT=4,rg.SIZE=4*(rg.COUNT=4+(rg.CSM_SPLITS_INFO_OFFSET=(rg.CSM_PROJ_INFO_OFFSET=(rg.CSM_PROJ_DEPTH_INFO_OFFSET=(rg.MAT_CSM_VIEW_PROJ_OFFSET=(rg.CSM_ATLAS_OFFSET=(rg.CSM_VIEW_DIR_2_OFFSET=(rg.CSM_VIEW_DIR_1_OFFSET=(rg.CSM_VIEW_DIR_0_OFFSET=0)+4*rg.CSM_LEVEL_COUNT)+4*rg.CSM_LEVEL_COUNT)+4*rg.CSM_LEVEL_COUNT)+4*rg.CSM_LEVEL_COUNT)+16*rg.CSM_LEVEL_COUNT)+4*rg.CSM_LEVEL_COUNT)+4*rg.CSM_LEVEL_COUNT)),rg.NAME="CCCSM",rg.BINDING=Wm.UBO_CSM,rg.DESCRIPTOR=new h_(rg.BINDING,hl.UNIFORM_BUFFER,1,Qc.FRAGMENT),rg.LAYOUT=new zl(Qm.GLOBAL,rg.BINDING,rg.NAME,[new Hl("cc_csmViewDir0",Dc.FLOAT4,rg.CSM_LEVEL_COUNT),new Hl("cc_csmViewDir1",Dc.FLOAT4,rg.CSM_LEVEL_COUNT),new Hl("cc_csmViewDir2",Dc.FLOAT4,rg.CSM_LEVEL_COUNT),new Hl("cc_csmAtlas",Dc.FLOAT4,rg.CSM_LEVEL_COUNT),new Hl("cc_matCSMViewProj",Dc.MAT4,rg.CSM_LEVEL_COUNT),new Hl("cc_csmProjDepthInfo",Dc.FLOAT4,rg.CSM_LEVEL_COUNT),new Hl("cc_csmProjInfo",Dc.FLOAT4,rg.CSM_LEVEL_COUNT),new Hl("cc_csmSplitsInfo",Dc.FLOAT4,1)],1),Xm.layouts[rg.NAME]=rg.LAYOUT,Xm.bindings[rg.BINDING]=rg.DESCRIPTOR;var sg=Wm.SAMPLER_SHADOWMAP,ag=new h_(sg,hl.SAMPLER_TEXTURE,1,Qc.FRAGMENT),og=new Vl(Qm.GLOBAL,sg,"cc_shadowMap",Dc.SAMPLER2D,1);Xm.layouts.cc_shadowMap=og,Xm.bindings[sg]=ag;var hg=Wm.SAMPLER_ENVIRONMENT,ug=new h_(hg,hl.SAMPLER_TEXTURE,1,Qc.FRAGMENT),cg=new Vl(Qm.GLOBAL,hg,"cc_environment",Dc.SAMPLER_CUBE,1);Xm.layouts.cc_environment=cg,Xm.bindings[hg]=ug;var lg=Wm.SAMPLER_DIFFUSEMAP,_g=new h_(lg,hl.SAMPLER_TEXTURE,1,Qc.FRAGMENT),fg=new Vl(Qm.GLOBAL,lg,"cc_diffuseMap",Dc.SAMPLER_CUBE,1);Xm.layouts.cc_diffuseMap=fg,Xm.bindings[lg]=_g;var dg=Wm.SAMPLER_SPOT_SHADOW_MAP,pg=new h_(dg,hl.SAMPLER_TEXTURE,1,Qc.FRAGMENT),mg=new Vl(Qm.GLOBAL,dg,"cc_spotShadowMap",Dc.SAMPLER2D,1);Xm.layouts.cc_spotShadowMap=mg,Xm.bindings[dg]=pg;var gg=function(){};gg.SIZE=4*(gg.COUNT=4+(gg.REFLECTION_PROBE_BLEND_DATA2=4+(gg.REFLECTION_PROBE_BLEND_DATA1=4+(gg.REFLECTION_PROBE_DATA2=4+(gg.REFLECTION_PROBE_DATA1=4+(gg.LOCAL_SHADOW_BIAS=4+(gg.LIGHTINGMAP_UVPARAM=16+(gg.MAT_WORLD_IT_OFFSET=16+(gg.MAT_WORLD_OFFSET=0))))))))),gg.NAME="CCLocal",gg.BINDING=Ym.UBO_LOCAL,gg.DESCRIPTOR=new h_(gg.BINDING,hl.UNIFORM_BUFFER,1,Qc.VERTEX|Qc.COMPUTE),gg.LAYOUT=new zl(Qm.LOCAL,gg.BINDING,gg.NAME,[new Hl("cc_matWorld",Dc.MAT4,1),new Hl("cc_matWorldIT",Dc.MAT4,1),new Hl("cc_lightingMapUVParam",Dc.FLOAT4,1),new Hl("cc_localShadowBias",Dc.FLOAT4,1),new Hl("cc_reflectionProbeData1",Dc.FLOAT4,1),new Hl("cc_reflectionProbeData2",Dc.FLOAT4,1),new Hl("cc_reflectionProbeBlendData1",Dc.FLOAT4,1),new Hl("cc_reflectionProbeBlendData2",Dc.FLOAT4,1)],1),jm.layouts[gg.NAME]=gg.LAYOUT,jm.bindings[gg.BINDING]=gg.DESCRIPTOR;var vg=function(){};vg.SIZE=4*(vg.COUNT=4+(vg.WORLD_BOUND_HALF_EXTENTS=4+(vg.WORLD_BOUND_CENTER=0))),vg.NAME="CCWorldBound",vg.BINDING=Ym.UBO_LOCAL,vg.DESCRIPTOR=new h_(vg.BINDING,hl.UNIFORM_BUFFER,1,Qc.VERTEX|Qc.COMPUTE),vg.LAYOUT=new zl(Qm.LOCAL,vg.BINDING,vg.NAME,[new Hl("cc_worldBoundCenter",Dc.FLOAT4,1),new Hl("cc_worldBoundHalfExtents",Dc.FLOAT4,1)],1),jm.layouts[vg.NAME]=vg.LAYOUT,jm.bindings[vg.BINDING]=vg.DESCRIPTOR;var yg="a_matWorld0",Eg="a_sh_linear_const_r",Tg=function(){};Tg.BATCHING_COUNT=10,Tg.MAT_WORLDS_OFFSET=0,Tg.SIZE=4*(Tg.COUNT=16*Tg.BATCHING_COUNT),Tg.NAME="CCLocalBatched",Tg.BINDING=Ym.UBO_LOCAL,Tg.DESCRIPTOR=new h_(Tg.BINDING,hl.UNIFORM_BUFFER,1,Qc.VERTEX|Qc.COMPUTE),Tg.LAYOUT=new zl(Qm.LOCAL,Tg.BINDING,Tg.NAME,[new Hl("cc_matWorlds",Dc.MAT4,Tg.BATCHING_COUNT)],1),jm.layouts[Tg.NAME]=Tg.LAYOUT,jm.bindings[Tg.BINDING]=Tg.DESCRIPTOR;var Sg=function(){};Sg.LIGHTS_PER_PASS=1,Sg.SIZE=4*(Sg.COUNT=(Sg.LIGHT_BOUNDING_SIZE_VS_OFFSET=(Sg.LIGHT_DIR_OFFSET=(Sg.LIGHT_SIZE_RANGE_ANGLE_OFFSET=(Sg.LIGHT_COLOR_OFFSET=(Sg.LIGHT_POS_OFFSET=0)+4*Sg.LIGHTS_PER_PASS)+4*Sg.LIGHTS_PER_PASS)+4*Sg.LIGHTS_PER_PASS)+4*Sg.LIGHTS_PER_PASS)+4*Sg.LIGHTS_PER_PASS),Sg.NAME="CCForwardLight",Sg.BINDING=Ym.UBO_FORWARD_LIGHTS,Sg.DESCRIPTOR=new h_(Sg.BINDING,hl.DYNAMIC_UNIFORM_BUFFER,1,Qc.FRAGMENT),Sg.LAYOUT=new zl(Qm.LOCAL,Sg.BINDING,Sg.NAME,[new Hl("cc_lightPos",Dc.FLOAT4,Sg.LIGHTS_PER_PASS),new Hl("cc_lightColor",Dc.FLOAT4,Sg.LIGHTS_PER_PASS),new Hl("cc_lightSizeRangeAngle",Dc.FLOAT4,Sg.LIGHTS_PER_PASS),new Hl("cc_lightDir",Dc.FLOAT4,Sg.LIGHTS_PER_PASS),new Hl("cc_lightBoundingSizeVS",Dc.FLOAT4,Sg.LIGHTS_PER_PASS)],1),jm.layouts[Sg.NAME]=Sg.LAYOUT,jm.bindings[Sg.BINDING]=Sg.DESCRIPTOR;var Ag=function(){};Ag.LIGHTS_PER_PASS=10;var Rg=function(){};Rg.SIZE=4*(Rg.COUNT=4+(Rg.JOINTS_TEXTURE_INFO_OFFSET=0)),Rg.NAME="CCSkinningTexture",Rg.BINDING=Ym.UBO_SKINNING_TEXTURE,Rg.DESCRIPTOR=new h_(Rg.BINDING,hl.UNIFORM_BUFFER,1,Qc.VERTEX),Rg.LAYOUT=new zl(Qm.LOCAL,Rg.BINDING,Rg.NAME,[new Hl("cc_jointTextureInfo",Dc.FLOAT4,1)],1),jm.layouts[Rg.NAME]=Rg.LAYOUT,jm.bindings[Rg.BINDING]=Rg.DESCRIPTOR;var Cg=function(){};Cg.SIZE=4*(Cg.COUNT=4+(Cg.JOINTS_ANIM_INFO_OFFSET=0)),Cg.NAME="CCSkinningAnimation",Cg.BINDING=Ym.UBO_SKINNING_ANIMATION,Cg.DESCRIPTOR=new h_(Cg.BINDING,hl.UNIFORM_BUFFER,1,Qc.VERTEX),Cg.LAYOUT=new zl(Qm.LOCAL,Cg.BINDING,Cg.NAME,[new Hl("cc_jointAnimInfo",Dc.FLOAT4,1)],1),jm.layouts[Cg.NAME]=Cg.LAYOUT,jm.bindings[Cg.BINDING]=Cg.DESCRIPTOR;var bg=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},n(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 Ig(t){bg.initLayout(t),jm.layouts[bg.NAME]=bg.LAYOUT,jm.bindings[bg.BINDING]=bg.DESCRIPTOR}bg._jointUniformCapacity=0,bg._count=0,bg._size=0,bg.NAME="CCSkinning",bg.BINDING=Ym.UBO_SKINNING_TEXTURE,bg.DESCRIPTOR=new h_(bg.BINDING,hl.UNIFORM_BUFFER,1,Qc.VERTEX),bg.LAYOUT=new zl(Qm.LOCAL,bg.BINDING,bg.NAME,[new Hl("cc_joints",Dc.FLOAT4,1)],1);var wg=function(){};wg.MAX_MORPH_TARGET_COUNT=60,wg.OFFSET_OF_WEIGHTS=0,wg.OFFSET_OF_VERTICES_COUNT=4+(wg.OFFSET_OF_DISPLACEMENT_TEXTURE_HEIGHT=4+(wg.OFFSET_OF_DISPLACEMENT_TEXTURE_WIDTH=4*wg.MAX_MORPH_TARGET_COUNT)),wg.COUNT_BASE_4_BYTES=4*Math.ceil(wg.MAX_MORPH_TARGET_COUNT/4)+4,wg.SIZE=4*wg.COUNT_BASE_4_BYTES,wg.NAME="CCMorph",wg.BINDING=Ym.UBO_MORPH,wg.DESCRIPTOR=new h_(wg.BINDING,hl.UNIFORM_BUFFER,1,Qc.VERTEX),wg.LAYOUT=new zl(Qm.LOCAL,wg.BINDING,wg.NAME,[new Hl("cc_displacementWeights",Dc.FLOAT4,wg.MAX_MORPH_TARGET_COUNT/4),new Hl("cc_displacementTextureInfo",Dc.FLOAT4,1)],1),jm.layouts[wg.NAME]=wg.LAYOUT,jm.bindings[wg.BINDING]=wg.DESCRIPTOR;var Og=function(){};Og.NAME="CCUILocal",Og.BINDING=Ym.UBO_UI_LOCAL,Og.DESCRIPTOR=new h_(Og.BINDING,hl.DYNAMIC_UNIFORM_BUFFER,1,Qc.VERTEX),Og.LAYOUT=new zl(Qm.LOCAL,Og.BINDING,Og.NAME,[new Hl("cc_local_data",Dc.FLOAT4,1)],1),jm.layouts[Og.NAME]=Og.LAYOUT,jm.bindings[Og.BINDING]=Og.DESCRIPTOR;var xg=function(){};xg.SIZE=4*(xg.COUNT=4+(xg.SH_QUADRATIC_A_OFFSET=4+(xg.SH_QUADRATIC_B_OFFSET=4+(xg.SH_QUADRATIC_G_OFFSET=4+(xg.SH_QUADRATIC_R_OFFSET=4+(xg.SH_LINEAR_CONST_B_OFFSET=4+(xg.SH_LINEAR_CONST_G_OFFSET=4+(xg.SH_LINEAR_CONST_R_OFFSET=0)))))))),xg.NAME="CCSH",xg.BINDING=Ym.UBO_SH,xg.DESCRIPTOR=new h_(xg.BINDING,hl.UNIFORM_BUFFER,1,Qc.FRAGMENT),xg.LAYOUT=new zl(Qm.LOCAL,xg.BINDING,xg.NAME,[new Hl("cc_sh_linear_const_r",Dc.FLOAT4,1),new Hl("cc_sh_linear_const_g",Dc.FLOAT4,1),new Hl("cc_sh_linear_const_b",Dc.FLOAT4,1),new Hl("cc_sh_quadratic_r",Dc.FLOAT4,1),new Hl("cc_sh_quadratic_g",Dc.FLOAT4,1),new Hl("cc_sh_quadratic_b",Dc.FLOAT4,1),new Hl("cc_sh_quadratic_a",Dc.FLOAT4,1)],1),jm.layouts[xg.NAME]=xg.LAYOUT,jm.bindings[xg.BINDING]=xg.DESCRIPTOR;var Ng=Ym.SAMPLER_JOINTS,Dg=new h_(Ng,hl.SAMPLER_TEXTURE,1,Qc.VERTEX),Mg=new Vl(Qm.LOCAL,Ng,"cc_jointTexture",Dc.SAMPLER2D,1);jm.layouts.cc_jointTexture=Mg,jm.bindings[Ng]=Dg;var Pg=Ym.SAMPLER_JOINTS,Lg=new h_(Pg,hl.SAMPLER_TEXTURE,1,Qc.VERTEX),Bg=new Vl(Qm.LOCAL,Pg,"cc_realtimeJoint",Dc.SAMPLER2D,1);jm.layouts.cc_realtimeJoint=Bg,jm.bindings[Pg]=Lg;var Fg=Ym.SAMPLER_MORPH_POSITION,Ug=new h_(Fg,hl.SAMPLER_TEXTURE,1,Qc.VERTEX),kg=new Vl(Qm.LOCAL,Fg,"cc_PositionDisplacements",Dc.SAMPLER2D,1);jm.layouts.cc_PositionDisplacements=kg,jm.bindings[Fg]=Ug;var Gg=Ym.SAMPLER_MORPH_NORMAL,Hg=new h_(Gg,hl.SAMPLER_TEXTURE,1,Qc.VERTEX),zg=new Vl(Qm.LOCAL,Gg,"cc_NormalDisplacements",Dc.SAMPLER2D,1);jm.layouts.cc_NormalDisplacements=zg,jm.bindings[Gg]=Hg;var Vg=Ym.SAMPLER_MORPH_TANGENT,Wg=new h_(Vg,hl.SAMPLER_TEXTURE,1,Qc.VERTEX),Xg=new Vl(Qm.LOCAL,Vg,"cc_TangentDisplacements",Dc.SAMPLER2D,1);jm.layouts.cc_TangentDisplacements=Xg,jm.bindings[Vg]=Wg;var jg=Ym.SAMPLER_LIGHTMAP,Yg=new h_(jg,hl.SAMPLER_TEXTURE,1,Qc.FRAGMENT),Kg=new Vl(Qm.LOCAL,jg,"cc_lightingMap",Dc.SAMPLER2D,1);jm.layouts.cc_lightingMap=Kg,jm.bindings[jg]=Yg;var qg=Ym.SAMPLER_SPRITE,Qg=new h_(qg,hl.SAMPLER_TEXTURE,1,Qc.FRAGMENT),Zg=new Vl(Qm.LOCAL,qg,"cc_spriteTexture",Dc.SAMPLER2D,1);jm.layouts.cc_spriteTexture=Zg,jm.bindings[qg]=Qg;var Jg=Ym.SAMPLER_REFLECTION,$g=new h_(Jg,hl.SAMPLER_TEXTURE,1,Qc.FRAGMENT),tv=new Vl(Qm.LOCAL,Jg,"cc_reflectionTexture",Dc.SAMPLER2D,1);jm.layouts.cc_reflectionTexture=tv,jm.bindings[Jg]=$g;var ev=Ym.STORAGE_REFLECTION,iv=new h_(ev,hl.STORAGE_IMAGE,1,Qc.COMPUTE),nv=new jl(Qm.LOCAL,ev,"cc_reflectionStorage",Dc.IMAGE2D,1);jm.layouts.cc_reflectionStorage=nv,jm.bindings[ev]=iv;var rv=Ym.SAMPLER_REFLECTION_PROBE_CUBE,sv=new h_(rv,hl.SAMPLER_TEXTURE,1,Qc.FRAGMENT),av=new Vl(Qm.LOCAL,rv,"cc_reflectionProbeCubemap",Dc.SAMPLER_CUBE,1);jm.layouts.cc_reflectionProbeCubemap=av,jm.bindings[rv]=sv;var ov=Ym.SAMPLER_REFLECTION_PROBE_PLANAR,hv=new h_(ov,hl.SAMPLER_TEXTURE,1,Qc.FRAGMENT),uv=new Vl(Qm.LOCAL,ov,"cc_reflectionProbePlanarMap",Dc.SAMPLER2D,1);jm.layouts.cc_reflectionProbePlanarMap=uv,jm.bindings[ov]=hv;var cv=Ym.SAMPLER_REFLECTION_PROBE_DATA_MAP,lv=new h_(cv,hl.SAMPLER_TEXTURE,1,Qc.FRAGMENT),_v=new Vl(Qm.LOCAL,cv,"cc_reflectionProbeDataMap",Dc.SAMPLER2D,1);jm.layouts.cc_reflectionProbeDataMap=_v,jm.bindings[cv]=lv;var fv=Ym.SAMPLER_REFLECTION_PROBE_BLEND_CUBE,dv=new h_(fv,hl.SAMPLER_TEXTURE,1,Qc.FRAGMENT),pv=new Vl(Qm.LOCAL,fv,"cc_reflectionProbeBlendCubemap",Dc.SAMPLER_CUBE,1);jm.layouts.cc_reflectionProbeBlendCubemap=pv,jm.bindings[fv]=dv;var mv,gv,vv,yv=Hp.makeMaskExclude([Hp.BitMask.UI_2D,Hp.BitMask.GIZMOS,Hp.BitMask.EDITOR,Hp.BitMask.SCENE_GIZMO,Hp.BitMask.PROFILER]),Ev=Hp.makeMaskExclude([Hp.BitMask.UI_2D,Hp.BitMask.PROFILER]),Tv=Hp.Enum.ALL;function Sv(t){return(t.getFormatFeatures(xc.R32F)&(Gc.RENDER_TARGET|Gc.SAMPLED_TEXTURE))==(Gc.RENDER_TARGET|Gc.SAMPLED_TEXTURE)&&!(t.gfxAPI===Ic.WEBGL)}function Av(t){return(t.getFormatFeatures(xc.RGBA16F)&(Gc.RENDER_TARGET|Gc.SAMPLED_TEXTURE))==(Gc.RENDER_TARGET|Gc.SAMPLED_TEXTURE)&&!(t.gfxAPI===Ic.WEBGL)}function Rv(){return!(!g.rendering||!g.rendering.enableEffectImport)}t("pipeline",Object.freeze({__proto__:null,PIPELINE_FLOW_MAIN:Hm,PIPELINE_FLOW_FORWARD:zm,PIPELINE_FLOW_SHADOW:Vm,PIPELINE_FLOW_SMAA:"SMAAFlow",PIPELINE_FLOW_TONEMAP:"ToneMapFlow",get RenderPassStage(){return km},get RenderPriority(){return Gm},globalDescriptorSetLayout:Xm,localDescriptorSetLayout:jm,get PipelineGlobalBindings(){return Wm},get ModelLocalBindings(){return Ym},get SetIndex(){return Qm},bindingMappingInfo:tg,UBOGlobal:eg,UBOCamera:ig,UBOShadow:ng,UBOCSM:rg,UNIFORM_SHADOWMAP_BINDING:sg,UNIFORM_ENVIRONMENT_BINDING:hg,UNIFORM_DIFFUSEMAP_BINDING:lg,UNIFORM_SPOT_SHADOW_MAP_TEXTURE_BINDING:dg,UBOLocal:gg,UBOWorldBound:vg,INST_MAT_WORLD:yg,INST_SH:Eg,UBOLocalBatched:Tg,UBOForwardLight:Sg,UBODeferredLight:Ag,JOINT_UNIFORM_CAPACITY:30,UBOSkinningTexture:Rg,UBOSkinningAnimation:Cg,INST_JOINT_ANIM_INFO:"a_jointAnimInfo",UBOSkinning:bg,localDescriptorSetLayout_ResizeMaxJoints:Ig,UBOMorph:wg,UBOUILocal:Og,UBOSH:xg,UNIFORM_JOINT_TEXTURE_BINDING:Ng,UNIFORM_REALTIME_JOINT_TEXTURE_BINDING:Pg,UNIFORM_POSITION_MORPH_TEXTURE_BINDING:Fg,UNIFORM_NORMAL_MORPH_TEXTURE_BINDING:Gg,UNIFORM_TANGENT_MORPH_TEXTURE_BINDING:Vg,UNIFORM_LIGHTMAP_TEXTURE_BINDING:jg,UNIFORM_SPRITE_TEXTURE_BINDING:qg,UNIFORM_REFLECTION_TEXTURE_BINDING:Jg,UNIFORM_REFLECTION_STORAGE_BINDING:ev,UNIFORM_REFLECTION_PROBE_CUBEMAP_BINDING:rv,UNIFORM_REFLECTION_PROBE_TEXTURE_BINDING:ov,UNIFORM_REFLECTION_PROBE_DATA_MAP_BINDING:cv,UNIFORM_REFLECTION_PROBE_BLEND_CUBEMAP_BINDING:fv,CAMERA_DEFAULT_MASK:yv,CAMERA_EDITOR_MASK:Ev,MODEL_ALWAYS_MASK:Tv,supportsR16HalfFloatTexture:function(t){return(t.getFormatFeatures(xc.R16F)&(Gc.RENDER_TARGET|Gc.SAMPLED_TEXTURE))==(Gc.RENDER_TARGET|Gc.SAMPLED_TEXTURE)},supportsR32FloatTexture:Sv,supportsRGBA16HalfFloatTexture:Av,supportsRGBA32FloatTexture:function(t){return(t.getFormatFeatures(xc.RGBA32F)&(Gc.RENDER_TARGET|Gc.SAMPLED_TEXTURE))==(Gc.RENDER_TARGET|Gc.SAMPLED_TEXTURE)&&!(t.gfxAPI===Ic.WEBGL)},isEnableEffect:Rv}));var Cv=4227858432,bv=66060288,Iv=1044480,wv=function(t,e,i,n){return void 0===n&&(n=0),e<<26&Cv|t<<20&bv|i<<12&Iv|4095&n},Ov=function(t){return(t&Cv)>>>26},xv=function(t){return(t&bv)>>>20},Nv=function(t){return(t&Iv)>>>12},Dv=function(t){return 4095&t},Mv=function(t,e){return 67108863&t|e<<26&Cv},Pv=((mv={})[Dc.UNKNOWN]=function(t,e,i){return void 0===i&&(i=0),j(12010,i)},mv[Dc.INT]=function(t,e,i){return void 0===i&&(i=0),t[i]},mv[Dc.INT2]=function(t,e,i){return void 0===i&&(i=0),pn.fromArray(e,t,i)},mv[Dc.INT3]=function(t,e,i){return void 0===i&&(i=0),Wi.fromArray(e,t,i)},mv[Dc.INT4]=function(t,e,i){return void 0===i&&(i=0),ki.fromArray(e,t,i)},mv[Dc.FLOAT]=function(t,e,i){return void 0===i&&(i=0),t[i]},mv[Dc.FLOAT2]=function(t,e,i){return void 0===i&&(i=0),pn.fromArray(e,t,i)},mv[Dc.FLOAT3]=function(t,e,i){return void 0===i&&(i=0),Wi.fromArray(e,t,i)},mv[Dc.FLOAT4]=function(t,e,i){return void 0===i&&(i=0),ki.fromArray(e,t,i)},mv[Dc.MAT3]=function(t,e,i){return void 0===i&&(i=0),Ji.fromArray(e,t,i)},mv[Dc.MAT4]=function(t,e,i){return void 0===i&&(i=0),cn.fromArray(e,t,i)},mv),Lv=((gv={})[Dc.UNKNOWN]=function(t,e,i){return void 0===i&&(i=0),j(12010,i)},gv[Dc.INT]=function(t,e,i){return void 0===i&&(i=0),t[i]=e},gv[Dc.INT2]=function(t,e,i){return void 0===i&&(i=0),pn.toArray(t,e,i)},gv[Dc.INT3]=function(t,e,i){return void 0===i&&(i=0),Wi.toArray(t,e,i)},gv[Dc.INT4]=function(t,e,i){return void 0===i&&(i=0),ki.toArray(t,e,i)},gv[Dc.FLOAT]=function(t,e,i){return void 0===i&&(i=0),t[i]=e},gv[Dc.FLOAT2]=function(t,e,i){return void 0===i&&(i=0),pn.toArray(t,e,i)},gv[Dc.FLOAT3]=function(t,e,i){return void 0===i&&(i=0),Wi.toArray(t,e,i)},gv[Dc.FLOAT4]=function(t,e,i){return void 0===i&&(i=0),ki.toArray(t,e,i)},gv[Dc.MAT3]=function(t,e,i){return void 0===i&&(i=0),Ji.toArray(t,e,i)},gv[Dc.MAT4]=function(t,e,i){return void 0===i&&(i=0),cn.toArray(t,e,i)},gv),Bv=((vv={})[Dc.INT]=function(t){return"number"==typeof t},vv[Dc.FLOAT]=function(t){return"number"==typeof t},vv[Dc.INT2]=function(t){return!!(t instanceof pn)},vv[Dc.FLOAT2]=function(t){return!!(t instanceof pn)},vv[Dc.INT3]=function(t){return!!(t instanceof Wi)},vv[Dc.FLOAT3]=function(t){return!!(t instanceof Wi)},vv[Dc.INT4]=function(t){return!!(t instanceof ki)},vv[Dc.FLOAT4]=function(t){return!!(t instanceof ki||t instanceof qi||t instanceof en)},vv[Dc.MAT3]=function(t){return!!(t instanceof Ji)},vv[Dc.MAT4]=function(t){return!!(t instanceof cn)},vv),Fv=[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 Uv(t){switch(t){case Dc.BOOL:case Dc.INT:case Dc.UINT:case Dc.FLOAT:return Fv[0];case Dc.BOOL2:case Dc.INT2:case Dc.UINT2:case Dc.FLOAT2:return Fv[1];case Dc.BOOL4:case Dc.INT4:case Dc.UINT4:case Dc.FLOAT4:return Fv[2];case Dc.MAT4:return Fv[3];case Dc.SAMPLER2D:return"default-texture";case Dc.SAMPLER_CUBE:return"default-cube-texture";case Dc.SAMPLER2D_ARRAY:return"default-array-texture";case Dc.SAMPLER3D:return"default-3d-texture"}return Fv[0]}function kv(t){switch(t){case Dc.SAMPLER2D:return"-texture";case Dc.SAMPLER_CUBE:return"-cube-texture";case Dc.SAMPLER2D_ARRAY:return"-array-texture";case Dc.SAMPLER3D:return"-3d-texture";default:return"-unknown"}}function Gv(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}function Hv(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 zv(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}var Vv=new Map;function Wv(t,e){if(e.count)return t+O_(e.type)*e.count;var i=Vv.get(e.name);return void 0!==i?t+O_(e.type)*i:(console.error("uniform '"+e.name+"' must have a count"),t)}function Xv(t){return Math.ceil(Math.log2(Math.max(t,2)))}Vv.set("cc_joints",bg.LAYOUT.members[0].count),Vv.set("cc_lightPos",Sg.LIGHTS_PER_PASS),Vv.set("cc_lightColor",Sg.LIGHTS_PER_PASS),Vv.set("cc_lightSizeRangeAngle",Sg.LIGHTS_PER_PASS),Vv.set("cc_lightDir",Sg.LIGHTS_PER_PASS),Vv.set("cc_lightBoundingSizeVS",Sg.LIGHTS_PER_PASS);var jv=new u_;function Yv(t,e,i,n,r){for(var s=t.builtins[n],a=[],o=function(){var t=s.blocks[h],e=i.layouts[t.name],n=e&&i.bindings.find((function(t){return t.binding===e.binding}));if(!(e&&n&&n.descriptorType&S_))return console.warn("builtin UBO '"+t.name+"' not available!"),"continue";a.push(e),r&&!r.includes(n)&&r.push(n)},h=0;h<s.blocks.length;h++)o();Array.prototype.unshift.apply(e.shaderInfo.blocks,a);for(var u=[],c=function(){var t=s.samplerTextures[l],e=i.layouts[t.name],n=e&&i.bindings.find((function(t){return t.binding===e.binding}));if(!(e&&n&&n.descriptorType&A_))return console.warn("builtin samplerTexture '"+t.name+"' not available!"),"continue";u.push(e),r&&!r.includes(n)&&r.push(n)},l=0;l<s.samplerTextures.length;l++)c();Array.prototype.unshift.apply(e.shaderInfo.samplerTextures,u),r&&r.sort((function(t,e){return t.binding-e.binding}))}function Kv(t){switch(t.gfxAPI){case Ic.GLES2:case Ic.WEBGL:return"glsl1";case Ic.GLES3:case Ic.WEBGL2:return"glsl3";default:return"glsl4"}}var qv,Qv,Zv,Jv,$v,ty,ey,iy=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;var i=r({},t);if(function(t){for(var e=0,i=function(){var i=t.defines[n],r=1;if("number"===i.type){var s=i.range;r=Xv(s[1]-s[0]+1),i._map=function(t){return t-s[0]}}else"string"===i.type?(r=Xv(i.options.length),i._map=function(t){return Math.max(0,i.options.findIndex((function(e){return e===t})))}):"boolean"===i.type&&(i._map=function(t){return t?1:0});i._offset=e,e+=r},n=0;n<t.defines.length;n++)i();for(var r in e>31&&(t.uber=!0),t.constantMacros="",t.builtins.statistics)t.constantMacros+="#define "+r+" "+t.builtins.statistics[r]+"\n"}(i),this._templates[t.name]=i,!this._templateInfos[i.hash]){var n={};n.samplerStartBinding=i.blocks.length,n.shaderInfo=new Zl,n.blockSizes=[],n.bindings=[];for(var s=0;s<i.blocks.length;s++){var a=i.blocks[s];n.blockSizes.push(a.members.reduce(Wv,0)),n.bindings.push(new h_(a.binding,hl.UNIFORM_BUFFER,1,a.stageFlags)),n.shaderInfo.blocks.push(new zl(Qm.MATERIAL,a.binding,a.name,a.members.map((function(t){return new Hl(t.name,t.type,t.count)})),1))}for(var o=0;o<i.samplerTextures.length;o++){var h=i.samplerTextures[o];n.bindings.push(new h_(h.binding,hl.SAMPLER_TEXTURE,h.count,h.stageFlags)),n.shaderInfo.samplerTextures.push(new Vl(Qm.MATERIAL,h.binding,h.name,h.type,h.count))}for(var u=0;u<i.samplers.length;u++){var c=i.samplers[u];n.bindings.push(new h_(c.binding,hl.SAMPLER,c.count,c.stageFlags)),n.shaderInfo.samplers.push(new Wl(Qm.MATERIAL,c.binding,c.name,c.count))}for(var l=0;l<i.textures.length;l++){var _=i.textures[l];n.bindings.push(new h_(_.binding,hl.TEXTURE,_.count,_.stageFlags)),n.shaderInfo.textures.push(new Xl(Qm.MATERIAL,_.binding,_.name,_.type,_.count))}for(var f=0;f<i.buffers.length;f++){var d=i.buffers[f];n.bindings.push(new h_(d.binding,hl.STORAGE_BUFFER,1,d.stageFlags)),n.shaderInfo.buffers.push(new Yl(Qm.MATERIAL,d.binding,d.name,1,d.memoryAccess))}for(var p=0;p<i.images.length;p++){var m=i.images[p];n.bindings.push(new h_(m.binding,hl.STORAGE_IMAGE,m.count,m.stageFlags)),n.shaderInfo.images.push(new jl(Qm.MATERIAL,m.binding,m.name,m.type,m.count,m.memoryAccess))}for(var g=0;g<i.subpassInputs.length;g++){var v=i.subpassInputs[g];n.bindings.push(new h_(v.binding,hl.INPUT_ATTACHMENT,v.count,v.stageFlags)),n.shaderInfo.subpassInputs.push(new Kl(Qm.MATERIAL,v.binding,v.name,v.count))}n.gfxAttributes=[];for(var y=0;y<i.attributes.length;y++){var E=i.attributes[y];n.gfxAttributes.push(new Ql(E.name,E.format,E.isNormalized,0,E.isInstanced,E.location))}Yv(i,n,jm,"locals"),n.shaderInfo.stages.push(new ql(Qc.VERTEX,"")),n.shaderInfo.stages.push(new ql(Qc.FRAGMENT,"")),n.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]=wv(n.binding,o.type,o.count,s),s+=(O_(o.type)>>2)*o.count}for(var h=0;h<t.samplerTextures.length;h++){var u=t.samplerTextures[h];e[u.name]=wv(u.binding,u.type,u.count)}return e}(i),n.setLayouts=[],this._templateInfos[i.hash]=n}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||(jv.bindings=r.bindings,r.setLayouts[Qm.MATERIAL]=t.createDescriptorSetLayout(jv),jv.bindings=jm.bindings,r.setLayouts[Qm.LOCAL]=t.createDescriptorSetLayout(jv)),r.setLayouts[i?Qm.LOCAL:Qm.MATERIAL]},e.hasProgram=function(t){return void 0!==this._templates[t]},e.getKey=function(t,e){return function(t,e){var i=t.defines;if(t.uber){for(var n="",r=0;r<i.length;r++){var s=i[r],a=e[s.name];if(a&&s._map){var o=s._map(a);n+=""+s._offset+o+"|"}}return""+n+t.hash}for(var h=0,u=0;u<i.length;u++){var c=i[u],l=e[c.name];l&&c._map&&(h|=c._map(l)<<c._offset)}return h.toString(16)+"|"+t.hash}(this._templates[t],e)},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];k("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),Yv(a,o,Xm,"globals"),o.setLayouts[Qm.GLOBAL]=n.descriptorSetLayout,o.pipelineLayout=t.createPipelineLayout(new l_(o.setLayouts)));var h=function(t,e){for(var i=[],n=0;n<e.length;n++){var r=e[n],s=r.name,a=t[s],o=Hv(r,a),h=!a||"0"===a;i.push({name:s,value:o,isDefault:h})}return i}(i,a.defines),u=n.constantMacros+a.constantMacros+h.reduce((function(t,e){return t+"#define "+e.name+" "+e.value+"\n"}),""),c=a.glsl3,l=Kv(t);l?c=a[l]:console.error("Invalid GFX API!"),o.shaderInfo.stages[0].source=u+c.vert,o.shaderInfo.stages[1].source=u+c.frag,o.shaderInfo.attributes=function(t,e,i){for(var n=[],r=t.attributes,s=0;s<r.length;s++)zv(r[s].defines,i)&&n.push(e[s]);return n}(a,o.gfxAttributes,i),o.shaderInfo.name=function(t,e){return t+e.reduce((function(t,e){return e.isDefault?t:t+"|"+e.name+e.value}),"")}(e,h);var _=o.shaderInfo;return this._cache[r]=t.createShader(_)},t}());g.programLib=iy;var ny=["planar-shadow","skybox","deferred-lighting","bloom","hbao","copy-pass","post-process","profiler","splash-screen","unlit","sprite","particle","particle-gpu","particle-trail","billboard","terrain","graphics","clear-stencil","spine","occlusion-query","geometry-renderer","debug-renderer","ssss-blur","tone-mapping"],ry=t("EffectAsset",bs("cc.EffectAsset")(((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=t.call.apply(t,[this].concat(n))||this).techniques=Zv&&Zv(),e.shaders=Jv&&Jv(),e.combinations=$v&&$v(),e.hideInEditor=ty&&ty(),e}s(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 ny.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(){g.rendering&&g.rendering.enableEffectImport?(function(t){for(var e=0;e<t.techniques.length;e++)for(var i=t.techniques[e],n=0;n<i.passes.length;n++){var r=i.passes[n];void 0!==r.propertyIndex&&void 0===r.properties&&(r.properties=i.passes[r.propertyIndex].properties)}}(this),g.rendering.programLib.addEffect(this)):iy.register(this),e.register(this),g.game.once(g.Game.EVENT_RENDERER_INITED,this._precompile,this)},i._precompile=function(){var t=this;if(g.rendering&&g.rendering.enableEffectImport)g.rendering.programLib.precompileEffect(_f.gfxDevice,this);else for(var e=g.director.root,i=function(){var i=t.shaders[n],s=t.combinations[n];if(!s)return"continue";(function(t){return Object.keys(t).reduce((function(e,i){return e.reduce((function(e,n){for(var s=t[i],a=0;a<s.length;++a){var o=r({},n);o[i]=s[a],e.push(o)}return e}),[])}),[{}])})(s).forEach((function(t){return iy.getGFXShader(_f.gfxDevice,i.name,t,e.pipeline)}))},n=0;n<this.shaders.length;n++)i()},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}(jf))._effects={},ey._layoutValid=!0,Zv=gs((Qv=ey).prototype,"techniques",[Ls],(function(){return[]})),Jv=gs(Qv.prototype,"shaders",[Ls],(function(){return[]})),$v=gs(Qv.prototype,"combinations",[Ls],(function(){return[]})),ty=gs(Qv.prototype,"hideInEditor",[Ls,Fs],(function(){return!1})),qv=Qv))||qv);g.EffectAsset=ry;var sy=function(){function t(){this.name="",this.base="",this.importBase="",this.nativeBase="",this.deps=null,this.assetInfos=new pf,this.scenes=new pf,this.paths=new pf}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]=Mf(e[a]);for(var h in i){var u=i[h],c=u[1];u[1]=n[c]}}else{for(var l=Object.create(null),_=0,f=e.length;_<f;_++){var d=e[_];e[_]=l[d]=Mf(d)}e=l}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 C in R)for(var b=R[C],I=0;I<b.length;I+=2){var w=b[I];b[I]=e[w]||w}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 N=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)N(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=Uf(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(Ht(s.ctor,e))return s}}return null},e.getDirWithPath=function(t,e,i){"/"===(t=Uf(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&&!Ht(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=Jt(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],h=e.get(o),u=h.packs;u?1===a?u.unshift(r):u.push(r):h.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 h=i[a];e.get(h).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 ay(t,e){t._uuid&&e.push(t._uuid)}function oy(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 jf&&ay(o,e)}else if(s.constructor&&s.constructor!==Object)s instanceof jf&&ay(s,e);else for(var h=Object.getOwnPropertyNames(s),u=0;u<h.length;u++){var c=s[h[u]];c instanceof jf&&ay(c,e)}}}}function hy(t,e){for(var i=0;i<t._components.length;i++)oy(t._components[i],e);for(var n=0;n<t._children.length;n++)hy(t._children[n],e)}function uy(t,e,i,n){i.push(t._uuid);for(var r=wp.getDeps(t._uuid),s=0,a=r.length;s<a;s++){var o=vf.get(r[s]);if(o){var h=o._uuid;h in e?e[h]+=n:e[h]=o.refCount+n,i.includes(h)||uy(o,e,i,n)}}}var cy=[],ly=new(function(){function t(){this._persistNodeDeps=new pf,this._toDelete=new pf,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=[];hy(t,e);for(var i=0,n=e.length;i<n;i++){var r=vf.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=vf.get(e[i]);r&&r.decRef()}this._persistNodeDeps.remove(t.uuid)}},e._autoRelease=function(t,e,i){if(t){for(var n=wp.getDeps(t.uuid),r=0,s=n.length;r<s;r++){var a=vf.get(n[r]);a&&a.decRef(t.autoReleaseAssets)}var o=wp._depends.get(t.uuid);if(o&&o.persistDeps)for(var h=o.persistDeps,u=0,c=h.length;u<c;u++){var l=vf.get(h[u]);l&&l.decRef(t.autoReleaseAssets)}t.uuid!==e.uuid&&wp.remove(t.uuid)}var _=wp._depends.get(e.uuid);for(var d in _&&(_.persistDeps=[]),i){for(var p,m,g=i[d],v=this._persistNodeDeps.get(g.uuid),y=f(v);!(m=y()).done;){var E=m.value,T=vf.get(E);T&&T.addRef()}_&&(p=_.persistDeps).push.apply(p,v)}},e.tryRelease=function(t,e){void 0===e&&(e=!1),t instanceof jf&&(e?this._free(t,e):(this._toDelete.add(t._uuid,t),this._eventListener||(this._eventListener=!0,Ne(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),Aa(t,!0)&&-1===this._dontDestroyAssets.indexOf(i)&&!(!e&&t.refCount>0&&function(t){var e=Object.create(null);if(e[t._uuid]=t.refCount,uy(t,e,cy,-1),cy.length=0,0!==e[t._uuid])return e[t._uuid];for(var i in e)0!==e[i]&&uy(vf.get(i),e,cy,1);return cy.length=0,e[t._uuid]}(t)>0)){vf.remove(i);for(var n=wp.getDeps(i),r=0,s=n.length;r<s;r++){var a=vf.get(n[r]);a&&(a.decRef(!1),this._free(a,!1))}t.destroy(),wp.remove(i)}},t}()),_y=null;function fy(t,e){for(var i=0,n=t.input.length;i<n;i++){var r=t.input[i];e&&!r.isNative&&r.content instanceof jf&&r.content.decRef(!1),r.recycle()}t.input=null}function dy(t,e){return e?/\?/.test(t)?t+"&_t="+Date.now():t+"?_t="+Date.now():t}function py(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(){py(t,e,i,n,r)}),i)}))}function my(t,e,i,n,s){try{for(var a=wp.parse(t,e),o=0,h=a.deps.length;o<h;o++){var u=a.deps[o];u in i||(i[u]=!0,n.push({uuid:u,bundle:s&&s.name}))}a.nativeDep&&(s&&(a.nativeDep.bundle=s.name),n.push(r({},a.nativeDep)))}catch(t){F(t.message,t.stack)}}function gy(t,e,i){e&&(i=void 0!==i?i:g.assetManager.cacheAsset,Ff(e)||!i||e.isDefault||vf.add(t,e))}function vy(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 yy(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 Ey(t,e,i){var n=t,r=e,s=i;if(void 0===i){var a=Ht(t,jf);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||_y,onComplete:s}}function Ty(t,e,i,n){if(void 0===n&&(n={}),!i[e]||n[e])return!1;n[e]=!0;var r=!1,s=wp.getDeps(e);if(s)for(var a=0,o=s.length;a<o;a++){var h=s[a];if(h===t||Ty(t,h,i,n)){r=!0;break}}return r}function Sy(t){return function(e,i){if(t){var n=[];Array.isArray(i)?i.forEach((function(t){return t instanceof jf&&n.push(t.addRef())})):i instanceof jf&&n.push(i.addRef()),Ne((function(){n.forEach((function(t){return t.decRef(!1)})),t(e,i)}))}}}var Ay=function(){function t(){this._config=new sy}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),Tf.add(t.name,this)},e.load=function(t,e,i,n){var r=Ey(e,i,n),s=r.type,a=r.onProgress,o=r.onComplete,h={__requestType__:gf.PATH,type:s,bundle:this.name,__outputAsArray__:Array.isArray(t)};g.assetManager.loadAny(t,h,a,o)},e.preload=function(t,e,i,n){var r=Ey(e,i,n),s=r.type,a=r.onProgress,o=r.onComplete;g.assetManager.preloadAny(t,{__requestType__:gf.PATH,type:s,bundle:this.name},a,o)},e.loadDir=function(t,e,i,n){var r=Ey(e,i,n),s=r.type,a=r.onProgress,o=r.onComplete;g.assetManager.loadAny(t,{__requestType__:gf.DIR,type:s,bundle:this.name,__outputAsArray__:!0},a,o)},e.preloadDir=function(t,e,i,n){var r=Ey(e,i,n),s=r.type,a=r.onProgress,o=r.onComplete;g.assetManager.preloadAny(t,{__requestType__:gf.DIR,type:s,bundle:this.name},a,o)},e.loadScene=function(t,e,i,n){var r=yy(e,i,n),s=r.options,a=r.onProgress,o=r.onComplete;s.preset=s.preset||"scene",s.bundle=this.name,g.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=yy(e,i,n),s=r.options,a=r.onProgress,o=r.onComplete;s.bundle=this.name,g.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&&vf.get(i.uuid)||null},e.release=function(t,e){var i=this.get(t,e);i&&ly.tryRelease(i,!0)},e.releaseUnusedAssets=function(){var t=this;vf.forEach((function(e){var i=t.getAssetInfo(e._uuid);i&&!i.redirect&&ly.tryRelease(e)}))},e.releaseAll=function(){var t=this;vf.forEach((function(e){var i=t.getAssetInfo(e._uuid);i&&!i.redirect&&ly.tryRelease(e,!0)}))},e._destroy=function(){this._config.destroy()},n(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}(),Ry=t("resources",new Ay);function Cy(t,e,i){var n=new y.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:"!==y.location.protocol&&(n.crossOrigin="anonymous"),n.addEventListener("load",r),n.addEventListener("error",s),n.src=t,n}function by(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}g.resources=Ry;var Iy=y.document,wy={};function Oy(t,e,i){if(wy[t])return i&&i(null),null;var n=Iy.createElement("script");function r(){n.parentNode.removeChild(n),n.removeEventListener("load",r,!1),n.removeEventListener("error",s,!1),wy[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:"!==y.location.protocol&&(n.crossOrigin="anonymous"),n.async=e.scriptAsyncLoading||!1,n.src=t,n.addEventListener("load",r,!1),n.addEventListener("error",s,!1),Iy.body.appendChild(n),n}var xy=/^(?:\w+:\/\/|\.+\/).+/,Ny=function(t,e,i){(dc.hasFeature(dc.Feature.IMAGE_BITMAP)&&g.assetManager.allowImageBitmap?Dy:Cy)(t,e,i)},Dy=function(t,e,i){e.xhrResponseType="blob",by(t,e,e.onFileProgress,i)},My=function(t,e,i){e.xhrResponseType="json",by(t,e,e.onFileProgress,i)},Py=function(t,e,i){e.xhrResponseType="arraybuffer",by(t,e,e.onFileProgress,i)},Ly=function(t,e,i){My(t,e,(function(e,n){if(e)i(e);else{var r=qd(n);Promise.all(r.chunks.map((function(i){return new Promise((function(n,r){Py(""+$u(t)+i,{},(function(t,i){e?r(e):n(new Uint8Array(i))}))}))}))).then((function(t){var e=new Kd(r.document,t);i(null,e)})).catch((function(t){i(t)}))}}))},By=function(t,e,i){Py(t,e,(function(t,e){if(t)i(t);else try{var n=Qd(new Uint8Array(e));i(null,n)}catch(t){i(t)}}))},Fy=function(t,e,i){e.xhrResponseType="text",by(t,e,e.onFileProgress,i)},Uy=function(t,e,i){var n=tc(t),r=t;xy.test(r)||(r=-1!==jy.remoteBundles.indexOf(n)?jy.remoteServerAddress+"remote/"+n:"assets/"+n);var s=e.version||jy.bundleVers[n],a=0,o=null,h=null;My(r+"/config."+(s?s+".":"")+"json",e,(function(t,e){h=t||h,(o=e)&&(o.base=r+"/"),2==++a&&i(h,o)})),Oy(r+"/index."+(s?s+".":"")+"js",e,(function(t){h=t||h,2==++a&&i(h,o)}))},ky=function(){var t=e.prototype;function e(){this.maxConcurrency=15,this.maxRequestsPerFrame=15,this.maxRetryCount=3,this.appendTimeStamp=!1,this.limited=!0,this.retryInterval=2e3,this.bundleVers={},this.remoteBundles=[],this.downloadDomImage=Cy,this.downloadDomAudio=null,this.downloadFile=by,this.downloadScript=Oy,this._downloaders={".png":Ny,".jpg":Ny,".bmp":Ny,".jpeg":Ny,".gif":Ny,".ico":Ny,".tiff":Ny,".webp":Ny,".image":Ny,".pvr":Py,".pkm":Py,".astc":Py,".txt":Fy,".xml":Fy,".vsh":Fy,".fsh":Fy,".atlas":Fy,".tmx":Fy,".tsx":Fy,".json":My,".ExportJson":My,".plist":Fy,".ccon":Ly,".cconb":By,".fnt":Fy,".binary":Py,".bin":Py,".dbbin":Py,".skel":Py,".js":Oy,bundle:Uy,default:Fy},this._downloading=new pf,this._queue=[],this._queueDirty=!1,this._totalNum=0,this._totalNumThisPeriod=0,this._lastDate=-1,this._checkNextPeriod=!1,this._remoteServerAddress="",this._maxInterval=1/30}return t.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},t.register=function(t,e){"object"==typeof t?Ut(this._downloaders,t):this._downloaders[t]=e},t.download=function(t,e,i,n,r){var s=this,a=yf.get(t);if(a)r(null,a);else{var o=this._downloading.get(t);if(o){o.push(r);var h=this._queue.find((function(e){return e.id===t}));if(!h)return;var u=n.priority||0;h.priority<u&&(h.priority=u,this._queueDirty=!0)}else{var c=void 0!==n.maxRetryCount?n.maxRetryCount:this.maxRetryCount,l=void 0!==n.maxConcurrency?n.maxConcurrency:this.maxConcurrency,_=void 0!==n.maxRequestsPerFrame?n.maxRequestsPerFrame:this.maxRequestsPerFrame,f=this._downloaders[i]||this._downloaders.default;py((function(i,a){if(0===i&&s._downloading.add(t,[r]),s.limited){s._updateTime();var o=function(t,e){s._totalNum--,s._handleQueueInNextFrame(l,_),a(t,e)};s._totalNum<l&&s._totalNumThisPeriod<_?(f(dy(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<l&&s._handleQueueInNextFrame(l,_))}else f(dy(e,s.appendTimeStamp),n,a)}),c,this.retryInterval,(function(e,i){e||yf.add(t,i);for(var n=s._downloading.remove(t),r=0,a=n.length;r<a;r++)n[r](e,i)}))}}},t.loadSubpackage=function(t,e){g.assetManager.loadBundle(t,null,e)},t._updateTime=function(){var t=performance.now(),e=g.game.deltaTime,i=e>this._maxInterval?this._maxInterval:e;t-this._lastDate>1e3*i&&(this._totalNumThisPeriod=0,this._lastDate=t)},t._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(dy(i.url,this.appendTimeStamp),i.options,i.done)}this._handleQueueInNextFrame(t,e)},t._handleQueueInNextFrame=function(t,e){!this._checkNextPeriod&&this._queue.length>0&&(Ne(this._handleQueue.bind(this),t,e),this._checkNextPeriod=!0)},n(e,[{key:"remoteServerAddress",get:function(){return this._remoteServerAddress}}],[{key:"instance",get:function(){return e._instance||(e._instance=new e),e._instance}}]),e}();ky._instance=void 0;var Gy,Hy,zy,Vy,Wy,Xy,jy=ky.instance,Yy=ky.instance,Ky=t("JsonAsset",bs("cc.JsonAsset")((Hy=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).json=zy&&zy(),e}return s(e,t),e}(jf),zy=gs(Hy.prototype,"json",[Ls],(function(){return null})),Gy=Hy))||Gy);g.JsonAsset=Ky;var qy,Qy,Zy=t("TextAsset",bs("cc.TextAsset")((Wy=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).text=Xy&&Xy(),e}return s(e,t),e.prototype.toString=function(){return this.text},e}(jf),Xy=gs(Wy.prototype,"text",[Ls],(function(){return""})),Vy=Wy))||Vy);g.TextAsset=Zy;var Jy=t("BufferAsset",bs("cc.BufferAsset")((d((Qy=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}s(e,t);var i=e.prototype;return i.buffer=function(){return this._buffer,this._buffer},i.validate=function(){return!!this._buffer},n(e,[{key:"_nativeAsset",get:function(){return this._buffer},set:function(t){t instanceof ArrayBuffer?this._buffer=t:this._buffer=t.buffer}}]),e}(jf)).prototype,"_nativeAsset",[aa],Object.getOwnPropertyDescriptor(Qy.prototype,"_nativeAsset"),Qy.prototype),qy=Qy))||qy);function $y(t,e,i,n){var r=null,s=null;try{(r=new dd)._nativeUrl=t,r._nativeAsset=e}catch(t){s=t}n(s,r)}function tE(t,e,i,n){var r=new Ky;r.json=e,n(null,r)}function eE(t,e,i,n){var r=new Zy;r.text=e,n(null,r)}function iE(t,e,i,n){var r=new Jy;r._nativeUrl=t,r._nativeAsset=e,n(null,r)}function nE(t,e,i,n){var r=new jf;r._nativeUrl=t,r._nativeAsset=e,n(null,r)}function rE(t,i,n,r){var s=Tf.get(i.name);s||(s=i.name===bf.RESOURCES?Ry:new Ay,i.base=i.base||t+"/",s.init(i)),e.import("virtual:///prerequisite-imports/"+s.name).then((function(){r(null,s)})).catch(r)}g.BufferAsset=Jy;var sE=new(function(){function t(){this._creating=new pf,this._producers={".png":$y,".jpg":$y,".bmp":$y,".jpeg":$y,".gif":$y,".ico":$y,".tiff":$y,".webp":$y,".image":$y,".pvr":$y,".pkm":$y,".txt":eE,".xml":eE,".vsh":eE,".fsh":eE,".atlas":eE,".tmx":eE,".tsx":eE,".fnt":eE,".json":tE,".ExportJson":tE,".binary":iE,".bin":iE,".dbbin":iE,".skel":iE,bundle:rE,default:nE}}var e=t.prototype;return e.register=function(t,e){"object"==typeof t?Ut(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=vf.get(t);if(n.reloadAsset||!o){var h=this._creating.get(t);h?h.push(r):(this._creating.add(t,[r]),a(t,e,n,(function(e,i){!e&&i instanceof jf&&(i._uuid=t,gy(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}()),aE=new(function(){function t(){this._loading=new pf,this._unpackers={".json":this.unpackJson}}var e=t.prototype;return e.unpackJson=function(t,e,i,n){var r=It(!0),s=null;if(Array.isArray(e)){(e=function(t){if(t[0]<1)throw new Error(J(5304,t[0]));gp(t,!0,void 0,yp.reportMissingClass),vp(t);for(var e=new Ep(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=ee(Fp),h=ee(dd);if(e.type===o&&e.data){var u=e.data;u.length!==t.length&&K(4915);for(var c=0;c<t.length;c++)r[t[c]+"@import"]=Tp(o,{base:u[c][0],mipmaps:u[c][1]})}else if(e.type===h&&e.data){var l=e.data;l.length!==t.length&&K(4915);for(var _=0;_<t.length;_++)r[t[_]+"@import"]=l[_]}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?Ut(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(yf.has(t.id))i(null,yf.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=kf(s.uuid,{ext:s.ext,bundle:t.config.name});Yy.download(s.uuid,a,s.ext,t.options,(function(e,i){yf.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)yf.add(r,i[r]);for(var a=n._loading.remove(s.uuid),o=0,h=a.length;o<h;o++){var u=a[o];if(e||t)u.onComplete(e||t);else{var c=i[u.id];c?u.onComplete(null,c):u.onComplete(new Error("can not retrieve data from package"))}}}))}))}}else Yy.download(t.id,t.url,t.ext,t.options,i)},t}());function oE(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=[],vy(t.input,(function(n,h){if(!n.isNative&&vf.has(n.uuid)){var u=vf.get(n.uuid);return n.content=u.addRef(),t.output.push(n),r.canInvoke&&t.dispatch("progress",++r.finish,r.total,n),void h()}aE.load(n,t.options,(function(u,c){u?t.isFinished||(!g.assetManager.force||i?(F(u.message,u.stack),r.canInvoke=!1,e(u)):(t.output.push(n),r.canInvoke&&t.dispatch("progress",++r.finish,r.total,n))):t.isFinished||(n.file=c,t.output.push(n),n.isNative||(o[n.uuid]=!0,my(n.uuid,c,o,s,n.config),r.total=a+s.length),r.canInvoke&&t.dispatch("progress",++r.finish,r.total,n)),h()}))}),(function(){if(t.isFinished)return fy(t,!0),void t.dispatch("error");if(s.length>0){var a=wf.create({input:s,progress:r,options:n,onProgress:t.onProgress,onError:wf.prototype.recycle,onComplete:function(n){var r;n||((r=t.output).push.apply(r,a.output),a.recycle()),i&&hE(t),e(n)}});Af.async(a)}else i&&hE(t),e()}))}function hE(t){for(var e=t.output,i=0,n=e.length;i<n;i++)e[i].content&&e[i].content.decRef(!1)}var uE=new(function(t){function e(){return t.apply(this,arguments)||this}s(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,globalThis.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}())),cE=function(){function t(){this._parsing=new pf,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{r=dd.parseCompressedTextures(t,0)}catch(t){n=t,console.warn(n)}i(n,r)},e.parsePKMTex=function(t,e,i){var n=null,r=null;try{r=dd.parseCompressedTextures(t,1)}catch(t){n=t,console.warn(n)}i(n,r)},e.parseASTCTex=function(t,e,i){var n=null,r=null;try{r=dd.parseCompressedTextures(t,2)}catch(t){n=t,console.warn(n)}i(n,r)},e.parsePlist=function(t,e,i){var n=null,r=uE.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=Cp(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?Ut(this._parsers,t):this._parsers[t]=e},e.parse=function(t,e,i,n,r){var s=this,a=Ef.get(t);if(a)r(null,a);else{var o=this._parsing.get(t);if(o)o.push(r);else{var h=this._parsers[i];h?(this._parsing.add(t,[r]),h(e,n,(function(e,i){e?yf.remove(t):Ff(i)||Ef.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)}}},n(t,null,[{key:"instance",get:function(){return this._instance||(this._instance=new t),this._instance}}]),t}();cE._instance=void 0;var lE=cE.instance;function _E(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=[],vy(t.input,(function(s,a){var o=wf.create({input:s,onProgress:t.onProgress,options:n,progress:r,onComplete:function(n,h){n&&!t.isFinished&&(!g.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(h),o.recycle(),a(null)}});fE.async(o)}),(function(){if(n.__exclude__=null,t.isFinished)return fy(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),fy(t,!0),e()}))}var fE=new mf("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&&vf.has(s)?e():aE.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)lE.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),yf.remove(s),Ef.remove(s),e())}));else{var h=i.uuid;if(h in r){var u=r[h],c=u.finish,l=u.content,_=u.err,d=u.callbacks;n.canInvoke&&t.dispatch("progress",++n.finish,n.total,i),c||Ty(h,h,r)?(l&&l.addRef(),i.content=l,e(_)):d.push({done:e,item:i})}else if(!o.reloadAsset&&vf.has(h)){var p=vf.get(h);i.content=p.addRef(),n.canInvoke&&t.dispatch("progress",++n.finish,n.total,i),e()}else o.__uuid__=h,lE.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,h=s.options,u=s.config,c=h.cacheAsset,l=[];e.addRef&&e.addRef(),my(a,e,Object.create(null),l,u),r.canInvoke&&t.dispatch("progress",++r.finish,r.total+=l.length,n);var _=t.options.__exclude__[a]={content:e,finish:!1,callbacks:[{done:i,item:n}]},d=wf.create({input:l,options:t.options,onProgress:t.onProgress,onError:wf.prototype.recycle,progress:r,onComplete:function(t){if(e.decRef&&e.decRef(!1),_.finish=!0,_.err=t,!t){for(var i,n=Array.isArray(d.output)?d.output:[d.output],r=Object.create(null),s=f(n);!(i=s()).done;){var h=i.value;h&&(r[h instanceof jf?h._uuid+"@import":a+"@native"]=h)}!function(t,e,i){var n=Sp.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!"),g.assetManager.dispatchAssetMissing(e,a.owner,a.prop,a.uuid),a.type&&a.type!==jf){var h=new a.type;h.initDefault(a.uuid),a.owner[a.prop]=h}!0}}Sp.delete(e)}Ap.has(e)&&(i[t+"@native"]?e._nativeAsset=i[t+"@native"]:(!0,console.error("the native asset of "+t+" is missing!")),Ap.delete(e))}(a,e,r);try{"function"!=typeof e.onLoaded||Rp.has(e)||Ap.has(e)||(e.onLoaded(),Rp.add(e))}catch(t){F("The asset "+a+" is invalid for some reason, detail message: "+t.message+", stack: "+t.stack)}yf.remove(o),Ef.remove(o),gy(a,e,c),d.recycle()}for(var u=_.callbacks,l=0,p=u.length;l<p;l++){var m=u[l];e.addRef&&e.addRef(),m.item.content=e,m.done(t)}u.length=0}});Sf.async(d)}(t,n,e)}))}}]);function dE(t,e){var i=t.options,n=Object.create(null),r=Object.create(null);for(var s in i)switch(s){case gf.PATH:case gf.UUID:case gf.DIR:case gf.SCENE:case gf.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=wf.create({input:t.input,options:n}),o=null;try{t.output=t.source=Rf.sync(a)}catch(t){o=t;for(var h=0,u=a.output.length;h<u;h++)a.output[h].recycle()}a.recycle(),e(o)}var pE=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))},n(t,[{key:"id",get:function(){return this._id||(this._id=(this.overrideUuid||this.uuid)+"@"+(this.isNative?"native":"import")),this._id}}]),t}();pE.MAX_DEAD_NUM=500,pE._deadPool=[];var mE=[];function gE(t){var e=t.options,i=Array.isArray(t.input)?t.input:[t.input];t.output=[];for(var n=function(){var n=i[r],s=pE.create(),a=null,o=null;if("string"==typeof n&&((n=Object.create(null))[e.__requestType__||gf.UUID]=i[r]),"object"==typeof n){Ft(n,e),n.preset&&Ft(n,If[n.preset]);var h=function(){var t;switch(u){case gf.UUID:var e,r=s.uuid=Mf(n.uuid);if(!n.bundle){var h=Tf.find((function(t){return!!t.getAssetInfo(r)}));n.bundle=h&&h.name}if(Tf.has(n.bundle)){if(a=Tf.get(n.bundle).config,(o=a.getAssetInfo(r))&&o.redirect){if(!Tf.has(o.redirect))throw new Error("Please load bundle "+o.redirect+" first");a=Tf.get(o.redirect).config,o=a.getAssetInfo(r)}s.config=a,s.info=o}s.ext=n.ext||(null===(e=o)||void 0===e?void 0:e.extension)||".json";break;case"__requestType__":case"ext":case"bundle":case"preset":case"type":break;case gf.DIR:if(Tf.has(n.bundle)){Tf.get(n.bundle).config.getDirWithPath(n.dir,n.type,mE);for(var c,l=f(mE);!(c=l()).done;){var _=c.value;i.push({uuid:_.uuid,__isNative__:!1,ext:_.extension||".json",bundle:n.bundle})}mE.length=0}s.recycle(),s=null;break;case gf.PATH:if(Tf.has(n.bundle)){if(a=Tf.get(n.bundle).config,(o=a.getInfoWithPath(n.path,n.type))&&o.redirect){if(!Tf.has(o.redirect))throw new Error("you need to load bundle "+o.redirect+" first");a=Tf.get(o.redirect).config,o=a.getAssetInfo(o.uuid)}if(!o)throw s.recycle(),new Error("Bundle "+n.bundle+" doesn't contain "+n.path);s.config=a,s.uuid=o.uuid,s.info=o}s.ext=n.ext||(null===(t=o)||void 0===t?void 0:t.extension)||".json";break;case gf.SCENE:if(!n.bundle){var d=Tf.find((function(t){return!!t.getSceneInfo(n.scene)}));n.bundle=d&&d.name}if(Tf.has(n.bundle)){if(a=Tf.get(n.bundle).config,(o=a.getSceneInfo(n.scene))&&o.redirect){if(!Tf.has(o.redirect))throw new Error("you need to load bundle "+o.redirect+" first");a=Tf.get(o.redirect).config,o=a.getAssetInfo(o.uuid)}if(!o)throw s.recycle(),new Error("Bundle "+a.name+" doesn't contain scene "+n.scene);s.config=a,s.uuid=o.uuid,s.info=o}break;case"__isNative__":s.isNative=n.__isNative__;break;case gf.URL:s.url=n.url,s.uuid=n.uuid||n.url,s.ext=n.ext||Ju(n.url),s.isNative=void 0===n.__isNative__||n.__isNative__;break;default:s.options[u]=n[u]}if(!s)return"break"};for(var u in n)if("break"===h())break}if(!s)return"continue";if(t.output.push(s),!s.uuid&&!s.url)throw new Error("Can not parse this input:"+JSON.stringify(n))},r=0;r<i.length;r++)n();return null}function vE(t){for(var e=t.output=t.input,i=function(){var t=e[n];if(Cf.has(t.uuid)){var i=Cf.get(t.uuid),r=Tf.find((function(t){return!!t.getAssetInfo(i)}));if(r){var s;t.overrideUuid=i;var a=r.config,o=a.getAssetInfo(i);if(o&&o.redirect){if(!Tf.has(o.redirect))throw new Error("Please load bundle "+o.redirect+" first");o=(a=Tf.get(o.redirect).config).getAssetInfo(i)}t.config=a,t.info=o,t.ext=t.isNative?t.ext:(null===(s=o)||void 0===s?void 0:s.extension)||".json"}else j(16201,i,t.uuid)}},n=0;n<e.length;n++)i()}function yE(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:g.assetManager.generalNativeBase:a&&a.importBase?a.base+a.importBase:g.assetManager.generalImportBase;var o=n.overrideUuid||n.uuid,h="";n.info&&(h=n.isNative?n.info.nativeVer?"."+n.info.nativeVer:"":n.info.ver?"."+n.info.ver:""),r=".ttf"===n.ext?s+"/"+o.slice(0,2)+"/"+o+h+"/"+n.options.__nativeName__:s+"/"+o.slice(0,2)+"/"+o+h+n.ext,n.url=r}}return null}var EE="asset-missing",TE=t("AssetManager",function(){function t(){this.pipeline=Sf.append(dE).append(_E),this.fetchPipeline=Af.append(dE).append(oE),this.transformPipeline=Rf.append(gE).append(vE).append(yE),this.bundles=Tf,this.assets=vf,this.assetsOverrideMap=Cf,this.generalImportBase="",this.generalNativeBase="",this.dependUtil=wp,this.force=!1,this.allowImageBitmap=!dc.isMobile,this.utils=Vf,this.downloader=Yy,this.parser=lE,this.packManager=aE,this.cacheAsset=!0,this.cacheManager=null,this.presets=If,this.factory=sE,this.preprocessPipe=dE,this.fetchPipe=oE,this.loadPipe=_E,this.references=null,this._releaseManager=ly,this._files=yf,this._parsed=Ef,this._parsePipeline=null,this._projectBundles=[],this._eventTarget=new Uu}var e=t.prototype;return e.onAssetMissing=function(t,e){this._eventTarget.on(EE,t,e)},e.offAssetMissing=function(t,e){this._eventTarget.off(EE,t,e)},e.dispatchAssetMissing=function(t,e,i,n){this._eventTarget.emit(EE,t,e,i,n)},e.init=function(t){void 0===t&&(t={});var e=t.server||Ee.querySettings(ye.Category.ASSETS,"server")||"",i=t.bundleVers||Ee.querySettings(ye.Category.ASSETS,"bundleVers")||{},n=t.remoteBundles||Ee.querySettings(ye.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||Ee.querySettings(ye.Category.ASSETS,"importBase")||"";r&&r.endsWith("/")&&(r=r.substr(0,r.length-1));var s=t.nativeBase||Ee.querySettings(ye.Category.ASSETS,"nativeBase")||"";s&&s.endsWith("/")&&(s=s.substr(0,s.length-1)),this.generalImportBase=r,this.generalNativeBase=s,this._projectBundles=Ee.querySettings(ye.Category.ASSETS,"projectBundles")||[];var a=Ee.querySettings(ye.Category.ASSETS,"assetsOverrides")||{};for(var o in a)this.assetsOverrideMap.set(o,a[o])},e.getBundle=function(t){return Tf.get(t)||null},e.removeBundle=function(t){t._destroy(),Tf.remove(t.name)},e.loadAny=function(t,e,i,n){var r=yy(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 h=wf.create({input:t,onProgress:a,onComplete:Sy(o),options:s});Sf.async(h)},e.preloadAny=function(t,e,i,n){var r=yy(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 h=wf.create({input:t,onProgress:a,onComplete:Sy(o),options:s});Af.async(h)},e.loadRemote=function(t,e,i){var n=yy(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)):sE.create(t,i,r.ext||Ju(t),r,(function(t,e){s&&s(t,e)}))}))):Sy(s)(null,this.assets.get(t))},e.loadBundle=function(t,e,i){var n=yy(e,void 0,i),r=n.options,s=n.onComplete,a=tc(t);this.bundles.has(a)?Sy(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)):sE.create(t,i,"bundle",r,(function(t,e){s&&s(t,e)}))})))},e.releaseAsset=function(t){ly.tryRelease(t,!0)},e.releaseUnusedAssets=function(){vf.forEach((function(t){ly.tryRelease(t)}))},e.releaseAll=function(){vf.forEach((function(t){ly.tryRelease(t,!0)}))},e.loadWithJson=function(){throw new Error("Only valid in Editor")},n(t,[{key:"main",get:function(){return Tf.get(bf.MAIN)||null}},{key:"resources",get:function(){return Tf.get(bf.RESOURCES)||null}}],[{key:"instance",get:function(){return this._instance||(this._instance=new t),this._instance}}]),t}());TE._instance=void 0,TE.Pipeline=mf,TE.Task=wf,TE.Cache=pf,TE.RequestItem=pE,TE.Bundle=Ay,TE.BuiltinBundleName=bf,TE.CacheManager=function(){this.cacheDir=void 0,this.cacheEnabled=void 0,this.autoClear=void 0,this.cacheInterval=void 0,this.deleteInterval=void 0,this.cachedFiles=void 0},TE.Downloader=ky,TE.Parser=cE,TE.DependUtil=bp;var SE=t("assetManager",g.assetManager=TE.instance);g.AssetManager=TE;var AE,RE,CE,bE=t("BuiltinResMgr",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 h=new Uint8Array(1024);a=0;for(var u=0;u<256;u++)h[a]=221,h[a+1]=221,h[a+2]=221,h[a+3]=255,a+=4;a=0;for(var c=0;c<8;c++){for(var l=0;l<8;l++)h[a]=85,h[a+1]=85,h[a+2]=85,h[a+3]=255,a+=4;a+=32}a+=32;for(var _=0;_<8;_++){for(var f=0;f<8;f++)h[a]=85,h[a+1]=85,h[a+2]=85,h[a+3]=255,a+=4;a+=32}var d={width:2,height:2,_data:e,_compressed:!1,format:Fp.PixelFormat.RGBA8888},p={width:2,height:2,_data:i,_compressed:!1,format:Fp.PixelFormat.RGBA8888},m={width:2,height:2,_data:n,_compressed:!1,format:Fp.PixelFormat.RGBA8888},v={width:2,height:2,_data:r,_compressed:!1,format:Fp.PixelFormat.RGBA8888},y={width:2,height:2,_data:s,_compressed:!1,format:Fp.PixelFormat.RGBA8888},E={width:16,height:16,_data:h,_compressed:!1,format:Fp.PixelFormat.RGBA8888},T=new dd(d),S=new Fp;S._uuid="black-texture",S.image=T,t[S._uuid]=S;var A=new dd(p),R=new Fp;R._uuid="empty-texture",R.image=A,t[R._uuid]=R;var C=new Bm;C._uuid="black-cube-texture",C.setMipFilter(Bm.Filter.NEAREST),C.image={front:new dd(d),back:new dd(d),left:new dd(d),right:new dd(d),top:new dd(d),bottom:new dd(d)},t[C._uuid]=C;var b=new dd(m),I=new Fp;I._uuid="grey-texture",I.image=b,t[I._uuid]=I;var w=new Bm;w._uuid="grey-cube-texture",w.setMipFilter(Bm.Filter.NEAREST),w.image={front:new dd(m),back:new dd(m),left:new dd(m),right:new dd(m),top:new dd(m),bottom:new dd(m)},t[w._uuid]=w;var O=new dd(v),x=new Fp;x._uuid="white-texture",x.image=O,t[x._uuid]=x;var N=new Bm;N._uuid="white-cube-texture",N.setMipFilter(Bm.Filter.NEAREST),N.image={front:new dd(v),back:new dd(v),left:new dd(v),right:new dd(v),top:new dd(v),bottom:new dd(v)},t[N._uuid]=N;var D=new dd(y),M=new Fp;M._uuid="normal-texture",M.image=D,t[M._uuid]=M;var P=new dd(E),L=new Fp;L._uuid="default-texture",L.image=P,t[L._uuid]=L;var B=new Bm;if(B.setMipFilter(Bm.Filter.NEAREST),B._uuid="default-cube-texture",B.image={front:new dd(E),back:new dd(E),left:new dd(E),right:new dd(E),top:new dd(E),bottom:new dd(E)},t[B._uuid]=B,g.SpriteFrame){var F=new g.SpriteFrame,U=T,k=new Fp;k.image=U,F.texture=k,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=Ee.querySettings(ye.Category.ENGINE,"builtinAssets");if(!e)return Promise.resolve();var i=this._resources;return new Promise((function(n,r){SE.loadBundle(bf.INTERNAL,(function(s){s?r(s):SE.loadAny(e,(function(e,s){e?r(e):(s.forEach((function(e){i[e.name]=e,ly.addIgnoredAsset(e),e instanceof g.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}()),IE=t("builtinResMgr",g.builtinResMgr=new bE),wE=t("getPhaseID",(AE=new Map,RE=0,function(t){return"number"==typeof t?t:(AE.has(t)||(AE.set(t,1<<RE),RE++),AE.get(t))})),OE=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(jg),o=t.descriptorSet.getTexture(rv),h=t.descriptorSet.getTexture(ov),u=t.descriptorSet.getTexture(fv),c=t.useReflectionProbeType,l=i;l||(l=t.shaders[e]);for(var _=t.descriptorSet,f=0;f<this.instances.length;++f){var d,p,m=this.instances[f];if(!((null===(d=m.ia.indexBuffer)||void 0===d?void 0:d.objectID)!==(null===(p=s.indexBuffer)||void 0===p?void 0:p.objectID)||m.count>=1024)&&m.lightingMap.objectID===a.objectID&&m.useReflectionProbeType===c&&m.reflectionProbeCubemap.objectID===o.objectID&&m.reflectionProbePlanarMap.objectID===h.objectID&&m.reflectionProbeBlendCubemap.objectID===u.objectID&&m.stride===r){if(m.count>=m.capacity){m.capacity<<=1;var g=m.stride*m.capacity,v=m.data;m.data=new Uint8Array(g),m.data.set(v),m.vb.resize(g)}return m.shader=l,m.descriptorSet=_,m.data.set(n.buffer,m.stride*m.count++),void(this.hasPendingModels=!0)}}for(var y=this._device.createBuffer(new Ml(Mc.VERTEX|Mc.TRANSFER_DST,Bc.HOST|Bc.DEVICE,32*r,r)),E=new Uint8Array(32*r),T=s.vertexBuffers.slice(),S=s.attributes.slice(),A=s.indexBuffer,R=0;R<n.attributes.length;R++){var C=n.attributes[R],b=new Ql(C.name,C.format,C.isNormalized,T.length,!0);S.push(b)}E.set(n.buffer),T.push(y);var I=new Jl(S,T,A),w=this._device.createInputAssembler(I);this.instances.push({count:1,capacity:32,vb:y,data:E,ia:w,stride:r,shader:l,descriptorSet:_,lightingMap:a,reflectionProbeCubemap:o,reflectionProbePlanarMap:h,useReflectionProbeType:c,reflectionProbeBlendCubemap:u}),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}()),xE=new Ml(Mc.UNIFORM|Mc.TRANSFER_DST,Bc.DEVICE),NE=new Pl(null),DE=new c_(null);!function(t){t[t.NONE=0]="NONE",t[t.INSTANCING=1]="INSTANCING"}(CE||(CE={}));var ME=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 Y_,this._dss=new X_,this._rs=new W_,this._priority=Gm.DEFAULT,this._stage=km.DEFAULT,this._phase=wE("default"),this._passID=4294967295,this._phaseID=4294967295,this._primitive=il.TRIANGLE_LIST,this._batchingScheme=CE.NONE,this._dynamicStates=al.NONE,this._instancedBuffers={},this._hash=0,this._root=void 0,this._device=void 0,this._rootBufferDirty=!1,this._root=t,this._device=_f.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=wE(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="";if(g.rendering&&g.rendering.enableEffectImport){var i=g.rendering.programLib.getKey(t._phaseID,t.program,t.defines);e=t._phaseID.toString()+","+i}else e=iy.getKey(t.program,t.defines);var n,r=e+","+t._primitive+","+t._dynamicStates;return r+=function(t){for(var e,i=",bs,"+t.isA2C,n=f(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),r+=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),vc(r+=",rs,"+(n=t._rs).cullMode+","+n.depthBias+","+n.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=Dc.UNKNOWN);var n=this._propertyHandleMap[t];return n?(i?n=Mv(n,i):e&&(n=Mv(n,Ov(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);Lv[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 Pv[r](a,i,s)},e.setUniformArray=function(e,i){for(var n=t.getBindingFromHandle(e),r=t.getTypeFromHandle(e),s=O_(r)>>2,a=this._getBlockView(r,n),o=t.getOffsetFromHandle(e),h=0;h<i.length;h++,o+=s)null!==i[h]&&Lv[r](a,i[h],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(){j(12102)},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 OE(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();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),h=this._properties[e],u=h&&h.value||Uv(n),c=(O_(n)>>2)*a,l=0;l+u.length<=c;l+=u.length)o.set(u,s+l);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,h=o?""+o+kv(r):Uv(r),u=IE.get(h),c=u&&u.getGFXTexture(),l=a&&void 0!==a.samplerHash?J_.unpackFromHash(a.samplerHash):u&&u.getSamplerInfo(),_=this._device.getSampler(l);this._descriptorSet.bindSampler(s,_,i||0),this._descriptorSet.bindTexture(s,c,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||Uv(r.type),h=(O_(r.type)>>2)*r.count,u=0;u+o.length<=h;u+=o.length)s.set(o,i+u);i+=h}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;if(this._syncBatchingScheme(),g.rendering&&g.rendering.enableEffectImport){var i=g.rendering.programLib,n=i.getProgramVariant(this._device,this._phaseID,this._programName,this._defines);if(!n)return j(12103,this._programName),!1;this._shader=n.shader,this._pipelineLayout=i.getPipelineLayout(this.device,this._phaseID,this._programName)}else{var r=iy.getGFXShader(this._device,this._programName,this._defines,e);if(!r)return j(12104,this._programName),!1;this._shader=r,this._pipelineLayout=iy.getTemplateInfo(this._programName).pipelineLayout}return this._hash=t.getPassHash(this),!0},e.getShaderVariant=function(t){if(void 0===t&&(t=null),!this._shader&&!this.tryCompile())return j(12105),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}var r=null;if(g.rendering&&g.rendering.enableEffectImport){var s=g.rendering.programLib.getProgramVariant(this._device,this._phaseID,this._programName,this._defines);s&&(r=s.shader)}else r=iy.getGFXShader(this._device,this._programName,this._defines,e);for(var a=0;a<t.length;a++){var o=t[a];delete this._defines[o.name]}return r},e.beginChangeStatesSilently=function(){},e.endChangeStatesSilently=function(){},e._doInit=function(e,i){if(void 0===i&&(i=!1),this._priority=Gm.DEFAULT,this._stage=km.DEFAULT,g.rendering&&g.rendering.enableEffectImport){var n=g.rendering;if("number"==typeof e.phase?(this._passID=e._passID,this._phaseID=e._phaseID):(this._passID=n.getPassID(e.pass),this._passID!==n.INVALID_ID&&(this._phaseID=n.getPhaseID(this._passID,e.phase))),this._passID===n.INVALID_ID)return void K(12107,e.program);if(this._phaseID===n.INVALID_ID)return void K(12108,e.program)}this._phase=wE("default"),this._primitive=il.TRIANGLE_LIST,this._passIndex=e.passIndex,this._propertyIndex=void 0!==e.propertyIndex?e.propertyIndex:e.passIndex,this._programName=e.program,this._defines=i?r({},e.defines):e.defines,g.rendering&&g.rendering.enableEffectImport?this._shaderInfo=g.rendering.programLib.getProgramInfo(this._phaseID,this._programName):this._shaderInfo=iy.getTemplate(e.program),this._properties=e.properties||this._properties;var s=this._device;t.fillPipelineInfo(this,e),e.stateOverrides&&t.fillPipelineInfo(this,e.stateOverrides),g.rendering&&g.rendering.enableEffectImport?DE.layout=g.rendering.programLib.getMaterialDescriptorSetLayout(this._device,this._phaseID,e.program):DE.layout=iy.getDescriptorSetLayout(this._device,e.program),this._descriptorSet=this._device.createDescriptorSet(DE);var a,o,h=this._shaderInfo.blocks;if(g.rendering&&g.rendering.enableEffectImport){var u=g.rendering.programLib;a=u.getBlockSizes(this._phaseID,this._programName),o=u.getHandleMap(this._phaseID,this._programName)}else{var c=iy.getTemplateInfo(e.program);a=c.blockSizes,o=c.handleMap}if(g.rendering&&g.rendering.enableEffectImport){var l=g.rendering.programLib.getShaderInfo(this._phaseID,this.program);this._buildMaterialUniformBlocks(s,l.blocks,a)}else this._buildUniformBlocks(s,h,a);var _=this._propertyHandleMap=o,f={};for(var d in this._properties){var p=this._properties[d];p.handleInfo&&(f[d]=this.getHandle.apply(this,p.handleInfo))}Object.assign(_,f)},e._buildUniformBlocks=function(t,e,i){for(var n=t.capabilities.uboOffsetAlignment,r=[],s=0,a=0,o=0;o<e.length;o++){var h=i[o];r.push(a),a+=Math.ceil(h/n)*n,s=h}var u=r[r.length-1]+s;u&&(xE.size=16*Math.ceil(u/16),this._rootBuffer=t.createBuffer(xE),this._rootBlock=new ArrayBuffer(u));for(var c=0,l=0;c<e.length;c++){var _=e[c].binding,f=i[c];NE.buffer=this._rootBuffer,NE.offset=r[l++],NE.range=16*Math.ceil(f/16);var d=this._buffers[_]=t.createBuffer(NE);this._blocks[_]=new Float32Array(this._rootBlock,NE.offset,f/Float32Array.BYTES_PER_ELEMENT),this._blocksInt[_]=new Int32Array(this._blocks[_].buffer,this._blocks[_].byteOffset,this._blocks[_].length),this._descriptorSet.bindBuffer(_,d)}},e._buildMaterialUniformBlocks=function(t,e,i){for(var n=t.capabilities.uboOffsetAlignment,r=[],s=0,a=0,o=0;o<e.length;o++)if(1===e[o].set){var h=i[o];r.push(a),a+=Math.ceil(h/n)*n,s=h}if(0!==s){var u=r[r.length-1]+s;u&&(xE.size=16*Math.ceil(u/16),this._rootBuffer=t.createBuffer(xE),this._rootBlock=new ArrayBuffer(u))}for(var c=0,l=0;c<e.length;c++)if(1===e[c].set){var _=e[c].binding,f=i[c];NE.buffer=this._rootBuffer,NE.offset=r[l++],NE.range=16*Math.ceil(f/16);var d=this._buffers[_]=t.createBuffer(NE);this._blocks[_]=new Float32Array(this._rootBlock,NE.offset,f/Float32Array.BYTES_PER_ELEMENT),this._blocksInt[_]=new Int32Array(this._blocks[_].buffer,this._blocks[_].byteOffset,this._blocks[_].length),this._descriptorSet.bindBuffer(_,d)}},e._syncBatchingScheme=function(){this._defines.USE_INSTANCING?this._device.hasFeature(Oc.INSTANCED_ARRAYS)?this._batchingScheme=CE.INSTANCING:(this._defines.USE_INSTANCING=!1,this._batchingScheme=CE.NONE):this._batchingScheme=CE.NONE},e._getBlockView=function(t,e){return t<Dc.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._phaseID=t._phaseID,this._passID=t._passID,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,g.rendering&&g.rendering.enableEffectImport?this._pipelineLayout=g.rendering.programLib.getPipelineLayout(this.device,this._phaseID,this._programName):this._pipelineLayout=iy.getTemplateInfo(this._programName).pipelineLayout,this._hash=t._hash^i},e._updatePassHash=function(){this._hash=t.getPassHash(this)},e.setRootBufferDirty=function(t){this._rootBufferDirty=t},e.setPriority=function(t){this._priority=t},n(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 g.rendering&&g.rendering.enableEffectImport?g.rendering.programLib.getLocalDescriptorSetLayout(this._device,this._phaseID,this._programName):iy.getDescriptorSetLayout(this._device,this._programName,!0)}},{key:"program",get:function(){return this._programName}},{key:"properties",get:function(){return this._properties}},{key:"defines",get:function(){return this._defines}},{key:"passIndex",get:function(){return this._passIndex}},{key:"propertyIndex",get:function(){return this._propertyIndex}},{key:"dynamics",get:function(){return this._dynamics}},{key:"blocks",get:function(){return this._blocks}},{key:"blocksInt",get:function(){return this._blocksInt}},{key:"rootBufferDirty",get:function(){return this._rootBufferDirty}},{key:"priority",get:function(){return this._priority}},{key:"primitive",get:function(){return this._primitive}},{key:"stage",get:function(){return this._stage}},{key:"phase",get:function(){return this._phase}},{key:"passID",get:function(){return this._passID}},{key:"phaseID",get:function(){return this._phaseID}},{key:"rasterizerState",get:function(){return this._rs}},{key:"depthStencilState",get:function(){return this._dss}},{key:"blendState",get:function(){return this._bs}},{key:"dynamicStates",get:function(){return this._dynamicStates}},{key:"batchingScheme",get:function(){return this._batchingScheme}},{key:"descriptorSet",get:function(){return this._descriptorSet}},{key:"hash",get:function(){return this._hash}},{key:"pipelineLayout",get:function(){return this._pipelineLayout}}]),t}();ME.getTypeFromHandle=Ov,ME.getBindingFromHandle=xv,ME.getCountFromHandle=Nv,ME.getOffsetFromHandle=Dv;var PE=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,h=new __(r.attributes),u=new K_(i,o,n,h,e.rasterizerState,e.depthStencilState,e.blendState,e.primitive,e.dynamicStates);a=t.createPipelineState(u),this._PSOHashMap.set(s,a)}return a},t}());PE._PSOHashMap=new Map;var LE=new wl,BE=new Tl;function FE(t,e){t.x=e.x*e.x,t.y=e.y*e.y,t.z=e.z*e.z}var UE,kE,GE,HE,zE,VE,WE,XE,jE,YE=null;function KE(){return YE}function qE(t,e,i,n,r){if(!Rv()&&n&&n.enabled&&r===YE){var s=n.subModels[0],a=s.inputAssembler,o=s.passes,h=s.shaders,u=s.descriptorSet;LE.width=BE.width=r.window.width,LE.height=BE.height=r.window.height;var c=PE.getOrCreatePipelineState(t,o[0],h[0],e,a);i.setViewport(LE),i.setScissor(BE),i.bindPipelineState(c),i.bindDescriptorSet(Qm.MATERIAL,o[0].descriptorSet),i.bindDescriptorSet(Qm.LOCAL,u),i.bindInputAssembler(a),i.draw(a)}}var QE=new ki,ZE=t("Material",(UE=bs("cc.Material"),kE=sa(ry),UE((HE=function(t){function e(){var e;return(e=t.call(this)||this)._effectAsset=zE&&zE(),e._techIdx=VE&&VE(),e._defines=WE&&WE(),e._states=XE&&XE(),e._props=jE&&jE(),e._passes=[],e._hash=0,e}s(e,t),e.getHash=function(t){for(var e,i=0,n=f(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=f(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 h=this._passes[i];this._uploadProperty(h,t,e)&&(this._props[h.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._passes.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]=r({},t._props[i]);this._defines.length=t._defines.length;for(var n=0;n<t._defines.length;n++)this._defines[n]=r({},t._defines[n]);this._states.length=t._states.length;for(var s=0;s<t._states.length;s++)this._states[s]=r({},t._states[s]);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=ry.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 ME(g.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(ME.getTypeFromHandle(n)<Dc.SAMPLER1D)if(Array.isArray(i))t.setUniformArray(n,i);else if(null!==i){var r;if(null!==(r=t.properties[e])&&void 0!==r&&r.linear){var s=i;FE(QE,s),QE.w=s.w,i=QE}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=ME.getBindingFromHandle(e);if(i instanceof tf)t.bindTexture(r,i,n);else if(i instanceof yd){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=f(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 qi("#ff00ff"))},i.validate=function(){return!!this._effectAsset&&!this._effectAsset.isDefault&&this.passes.length>0},n(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}(jf),zE=gs(HE.prototype,"_effectAsset",[kE],(function(){return null})),VE=gs(HE.prototype,"_techIdx",[Ls],(function(){return 0})),WE=gs(HE.prototype,"_defines",[Ls],(function(){return[]})),XE=gs(HE.prototype,"_states",[Ls],(function(){return[]})),jE=gs(HE.prototype,"_props",[Ls],(function(){return[]})),GE=HE))||GE));g.Material=ZE;var JE=fe({Low_256x256:256,Medium_512x512:512,High_1024x1024:1024,Ultra_2048x2048:2048}),$E=fe({Planar:0,ShadowMap:1}),tT=fe({HARD:0,SOFT:1,SOFT_2X:2,SOFT_4X:3}),eT=fe({LEVEL_1:1,LEVEL_2:2,LEVEL_3:3,LEVEL_4:4}),iT=fe({NONE:1,RemoveDuplicates:2,DisableRotationFix:3}),nT=$E.ShadowMap+1,rT=function(){function t(){this.fixedSphere=new Qn(0,0,0,.01),this.maxReceived=4,this._matLight=new cn,this._material=null,this._instancingMaterial=null,this._enabled=!1,this._type=nT,this._distance=0,this._normal=new Wi(0,1,0),this._shadowColor=new qi(0,0,0,76),this._size=new pn(1024,1024),this._shadowMapDirty=!1}var e=t.prototype;return e.getPlanarShader=function(t){this._material||(this._material=new ZE,this._material.initialize({effectName:"pipeline/planar-shadow"}));var e=this._material.passes;return e.length>0?e[0].getShaderVariant(t):null},e.initialize=function(t){this._enabled=t.enabled,this._type=this.enabled?t.type:nT,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===$E.Planar)this._updatePlanarInfo();else{var t=g.director.root;t.pipeline.macros.CC_SHADOW_TYPE=2,t.onGlobalPipelineStateChanged()}else{var e=g.director.root;e.pipeline.macros.CC_SHADOW_TYPE=0,e.onGlobalPipelineStateChanged()}},e._updatePlanarInfo=function(){this._material||(this._material=new ZE,this._material.initialize({effectName:"pipeline/planar-shadow"}));var t=g.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()},n(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:nT,this.activate()}},{key:"normal",get:function(){return this._normal},set:function(t){Wi.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}();rT.MAX_FAR=2e3,rT.COEFFICIENT_OF_EXPANSION=2*Math.sqrt(3),g.Shadows=rT;var sT=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 h=n._parent,u=0;u<n._shaderInfo.samplerTextures.length;u++)for(var c=n._shaderInfo.samplerTextures[u],_=0;_<c.count;_++){var f=h._descriptorSet.getSampler(c.binding,_),d=h._descriptorSet.getTexture(c.binding,_);n._descriptorSet.bindSampler(c.binding,f,_),n._descriptorSet.bindTexture(c.binding,d,_)}return t.prototype.tryCompile.call(l(n)),n}s(e,t);var i=e.prototype;return i.overridePipelineStates=function(t,e){this._bs.reset(),this._rs.reset(),this._dss.reset(),ME.fillPipelineInfo(this,t),ME.fillPipelineInfo(this,e),this._onStateChange()},i.tryCompile=function(e){if(e&&!Gv(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_INSTANCING=!1,this._batchingScheme=CE.NONE},i._onStateChange=function(){this._hash=ME.getPassHash(this),this._owner.onPassStateChange(this._dontNotify)},n(e,[{key:"parent",get:function(){return this._parent}}]),e}(ME),aT=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}s(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=f(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 h in t)o[h]=t[h];this._passes[e].overridePipelineStates(i[e],o)}}},i.destroy=function(){return this._doDestroy(),!0},i.onPassStateChange=function(t){this._hash=ZE.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 sT(e[i],this));return t},n(e,[{key:"parent",get:function(){return this._parent}},{key:"owner",get:function(){return this._owner}}]),e}(ZE),oT=null,hT=null,uT=fe({HEMISPHERE_DIFFUSE:0,AUTOGEN_HEMISPHERE_DIFFUSE_WITH_REFLECTION:1,DIFFUSEMAP_WITH_REFLECTION:2}),cT=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 aT({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=g.director.root.pipeline;this._globalDSManager=t.globalDSManager,this._default=IE.get("default-cube-texture"),this._model||(this._model=g.director.root.createModel(g.renderer.scene.Model));var e=this._default.isRGBE;if(this._default.isUsingOfflineMipmaps(),this.envmap&&(e=this.envmap.isRGBE,this.envmap.isUsingOfflineMipmaps()),!hT){var i=new ZE;i.initialize({effectName:"pipeline/skybox",defines:{USE_RGBE_CUBEMAP:e}}),hT=new aT({parent:i})}this.enabled&&(oT||(oT=g.utils.createMesh(g.primitives.box({width:2,height:2,length:2}))),this._editableMaterial?this._model.initSubModel(0,oT.renderingSubMeshes[0],this._editableMaterial):this._model.initSubModel(0,oT.renderingSubMeshes[0],hT)),this.envmap||(this.envmap=this._default),this.diffuseMap||(this.diffuseMap=this._default),this._updateGlobalBinding(),this._updatePipeline(),this._activated=!0},e._updatePipeline=function(){var t=g.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:hT;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=_f.gfxDevice;if(this.reflectionMap){var e=this.reflectionMap.getGFXTexture(),i=t.getSampler(this.reflectionMap.getSamplerInfo());this._globalDSManager.bindSampler(hg,i),this._globalDSManager.bindTexture(hg,e)}else{var n=this.envmap?this.envmap:this._default;if(n){var r=n.getGFXTexture(),s=t.getSampler(n.getSamplerInfo());this._globalDSManager.bindSampler(hg,s),this._globalDSManager.bindTexture(hg,r)}}var a=this.diffuseMap?this.diffuseMap:this._default;if(a){var o=a.getGFXTexture(),h=t.getSampler(a.getSamplerInfo());this._globalDSManager.bindSampler(lg,h),this._globalDSManager.bindTexture(lg,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()},n(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 g.director.root.pipeline.pipelineSceneData.isHDR?this._envmapHDR:this._envmapLDR},set:function(t){g.director.root.pipeline.pipelineSceneData.isHDR?this.setEnvMaps(t,this._envmapLDR):this.setEnvMaps(this._envmapHDR,t)}},{key:"diffuseMap",get:function(){return g.director.root.pipeline.pipelineSceneData.isHDR?this._diffuseMapHDR:this._diffuseMapLDR},set:function(t){g.director.root.pipeline.pipelineSceneData.isHDR?this.setDiffuseMaps(t,this._diffuseMapLDR):this.setDiffuseMaps(this._diffuseMapHDR,t)}},{key:"reflectionMap",get:function(){return g.director.root.pipeline.pipelineSceneData.isHDR?this._reflectionHDR:this._reflectionLDR}},{key:"editableMaterial",get:function(){return this._editableMaterial}}]),t}();g.Skybox=cT;var lT,_T,fT,dT,pT,mT,gT,vT,yT,ET,TT,ST,AT,RT,CT,bT,IT,wT,OT,xT,NT,DT,MT,PT,LT,BT,FT,UT,kT,GT,HT,zT,VT,WT,XT,jT,YT,KT,qT,QT,ZT,JT,$T,tS,eS,iS,nS,rS,sS,aS,oS,hS,uS,cS,lS,_S,fS,dS,pS,mS,gS,vS,yS,ES,TS,SS,AS,RS,CS,bS,IS,wS,OS,xS,NS,DS,MS,PS,LS,BS,FS,US,kS,GS,HS,zS,VS,WS,XS,jS,YS,KS,qS,QS,ZS,JS,$S,tA,eA,iA,nA,rA,sA,aA,oA,hA,uA,cA,lA,_A,fA,dA,pA,mA,gA,vA,yA,EA,TA,SA,AA,RA,CA=new ki,bA=fe({LINEAR:0,EXP:1,EXP_SQUARED:2,LAYERED:3}),IA=bA.LAYERED+1,wA=function(){function t(){this._fogColor=new qi("#C8C8C8"),this._colorArray=new ki(.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:IA,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=g.director.root,e=this.enabled?this.type:IA,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())},n(t,[{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled=t,t?this.activate():(this._type=IA,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),CA.set(t.x,t.y,t.z,t.w),FE(this._colorArray,CA)}},{key:"type",get:function(){return this._type},set:function(t){this._type=this.enabled?t:IA,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}();g.Fog=wA;var OA=new Wi(0,1,0),xA=new Wi,NA=new ki,DA=new qi,MA=new en,PA=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)},LA=t("AmbientInfo",(lT=bs("cc.AmbientInfo"),_T=sa(We),fT=Bs("_skyColor"),dT=Bs("_skyIllum"),pT=Bs("_groundAlbedo"),lT((d((gT=function(){function t(){this._skyColorHDR=vT&&vT(),this._skyIllumHDR=yT&&yT(),this._groundAlbedoHDR=ET&&ET(),this._skyColorLDR=TT&&TT(),this._skyIllumLDR=ST&&ST(),this._groundAlbedoLDR=AT&&AT(),this._resource=null}return t.prototype.activate=function(t){this._resource=t,this._resource.initialize(this)},n(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=g.director.root.pipeline.pipelineSceneData.isHDR;return NA.set(t?this._skyColorHDR:this._skyColorLDR),PA(NA),DA.set(255*NA.x,255*NA.y,255*NA.z,255)},set:function(t){NA.set(t.x,t.y,t.z,t.w),g.director.root.pipeline.pipelineSceneData.isHDR?this._skyColorHDR.set(NA):this._skyColorLDR.set(NA),this._resource&&this._resource.skyColor.set(NA)}},{key:"skyColor",set:function(t){g.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 g.director.root.pipeline.pipelineSceneData.isHDR?this._skyIllumHDR:this._skyIllumLDR},set:function(t){g.director.root.pipeline.pipelineSceneData.isHDR?this._skyIllumHDR=t:this._skyIllumLDR=t,this._resource&&(this._resource.skyIllum=t)}},{key:"groundLightingColor",get:function(){var t=g.director.root.pipeline.pipelineSceneData.isHDR;return NA.set(t?this._groundAlbedoHDR:this._groundAlbedoLDR),PA(NA),DA.set(255*NA.x,255*NA.y,255*NA.z,255)},set:function(t){NA.set(t.x,t.y,t.z,t.w),g.director.root.pipeline.pipelineSceneData.isHDR?this._groundAlbedoHDR.set(NA):this._groundAlbedoLDR.set(NA),this._resource&&this._resource.groundAlbedo.set(NA)}},{key:"groundAlbedo",set:function(t){g.director.root.pipeline.pipelineSceneData.isHDR?this._groundAlbedoHDR.set(t):this._groundAlbedoLDR.set(t),this._resource&&this._resource.groundAlbedo.set(t)}}]),t}()).prototype,"skyIllum",[_T],Object.getOwnPropertyDescriptor(gT.prototype,"skyIllum"),gT.prototype),vT=gs(gT.prototype,"_skyColorHDR",[Ls,fT],(function(){return new ki(.2,.5,.8,1)})),yT=gs(gT.prototype,"_skyIllumHDR",[Ls,dT],(function(){return Um.SKY_ILLUM})),ET=gs(gT.prototype,"_groundAlbedoHDR",[Ls,pT],(function(){return new ki(.2,.2,.2,1)})),TT=gs(gT.prototype,"_skyColorLDR",[Ls],(function(){return new ki(.2,.5,.8,1)})),ST=gs(gT.prototype,"_skyIllumLDR",[Ls],(function(){return Um.SKY_ILLUM})),AT=gs(gT.prototype,"_groundAlbedoLDR",[Ls],(function(){return new ki(.2,.2,.2,1)})),mT=gT))||mT));g.AmbientInfo=LA;var BA=t("SkyboxInfo",(RT=bs("cc.SkyboxInfo"),CT=sa(uT),bT=sa(Bm),IT=sa(We),wT=sa(Bm),OT=sa(Bm),xT=sa(ZE),NT=sa(Bm),DT=Bs("_envmap"),MT=sa(Bm),PT=sa(Bm),LT=sa(Bm),BT=sa(ZE),FT=sa(Bm),UT=sa(Bm),RT((d((GT=function(){function t(){this._envLightingType=HT&&HT(),this._envmapHDR=zT&&zT(),this._envmapLDR=VT&&VT(),this._diffuseMapHDR=WT&&WT(),this._diffuseMapLDR=XT&&XT(),this._enabled=jT&&jT(),this._useHDR=YT&&YT(),this._editableMaterial=KT&&KT(),this._reflectionHDR=qT&&qT(),this._reflectionLDR=QT&&QT(),this._rotationAngle=ZT&&ZT(),this._resource=null}var e=t.prototype;return e.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()},e.updateEnvMap=function(t){t||(this.applyDiffuseMap=!1,this.useIBL=!1,this.envLightingType=uT.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)},e.setMaterialProperty=function(t,e,i){this._resource&&this._resource.enabled&&this._resource.editableMaterial&&(this._resource.editableMaterial.setProperty(t,e,i),this._resource.editableMaterial.passes.forEach((function(t){t.update()})))},n(t,[{key:"applyDiffuseMap",get:function(){return uT.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||uT.HEMISPHERE_DIFFUSE===t?(uT.HEMISPHERE_DIFFUSE===t?(this.useIBL=!1,this.applyDiffuseMap=!1):uT.AUTOGEN_HEMISPHERE_DIFFUSE_WITH_REFLECTION===t?(this.useIBL=!0,this.applyDiffuseMap=!1):uT.DIFFUSEMAP_WITH_REFLECTION===t&&(this.useIBL=!0,this.applyDiffuseMap=!0),this._envLightingType=t):(this.useIBL=!1,this.applyDiffuseMap=!1,this._envLightingType=uT.HEMISPHERE_DIFFUSE,j(15001))}},{key:"useIBL",get:function(){return uT.HEMISPHERE_DIFFUSE!==this._envLightingType},set:function(t){this._resource&&(this._resource.useIBL=t)}},{key:"useHDR",get:function(){return g.director.root.pipeline.pipelineSceneData.isHDR=this._useHDR,this._useHDR},set:function(t){g.director.root.pipeline.pipelineSceneData.isHDR=t,this._useHDR=t,this._resource&&this.envLightingType===uT.DIFFUSEMAP_WITH_REFLECTION&&(null===this.diffuseMap?(this.envLightingType=uT.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 g.director.root.pipeline.pipelineSceneData.isHDR?this._envmapHDR:this._envmapLDR},set:function(t){var e=g.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=uT.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 g.director.root.pipeline.pipelineSceneData.isHDR?this._diffuseMapHDR:this._diffuseMapLDR},set:function(t){g.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 g.director.root.pipeline.pipelineSceneData.isHDR?this._reflectionHDR:this._reflectionLDR},set:function(t){g.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,"envLightingType",[CT],Object.getOwnPropertyDescriptor(GT.prototype,"envLightingType"),GT.prototype),d(GT.prototype,"envmap",[bT],Object.getOwnPropertyDescriptor(GT.prototype,"envmap"),GT.prototype),d(GT.prototype,"rotationAngle",[IT],Object.getOwnPropertyDescriptor(GT.prototype,"rotationAngle"),GT.prototype),d(GT.prototype,"diffuseMap",[wT],Object.getOwnPropertyDescriptor(GT.prototype,"diffuseMap"),GT.prototype),d(GT.prototype,"reflectionMap",[OT],Object.getOwnPropertyDescriptor(GT.prototype,"reflectionMap"),GT.prototype),d(GT.prototype,"skyboxMaterial",[xT],Object.getOwnPropertyDescriptor(GT.prototype,"skyboxMaterial"),GT.prototype),HT=gs(GT.prototype,"_envLightingType",[Ls],(function(){return uT.HEMISPHERE_DIFFUSE})),zT=gs(GT.prototype,"_envmapHDR",[Ls,NT,DT],(function(){return null})),VT=gs(GT.prototype,"_envmapLDR",[Ls,MT],(function(){return null})),WT=gs(GT.prototype,"_diffuseMapHDR",[Ls,PT],(function(){return null})),XT=gs(GT.prototype,"_diffuseMapLDR",[Ls,LT],(function(){return null})),jT=gs(GT.prototype,"_enabled",[Ls],(function(){return!1})),YT=gs(GT.prototype,"_useHDR",[Ls],(function(){return!0})),KT=gs(GT.prototype,"_editableMaterial",[Ls,BT],(function(){return null})),qT=gs(GT.prototype,"_reflectionHDR",[Ls,FT],(function(){return null})),QT=gs(GT.prototype,"_reflectionLDR",[Ls,UT],(function(){return null})),ZT=gs(GT.prototype,"_rotationAngle",[Ls],(function(){return 0})),kT=GT))||kT));g.SkyboxInfo=BA;var FA=t("FogInfo",(JT=bs("cc.FogInfo"),$T=sa(bA),tS=sa(We),eS=sa(We),iS=sa(We),nS=sa(We),rS=sa(We),sS=sa(We),JT(((vS=function(){function t(){this._type=hS&&hS(),this._fogColor=uS&&uS(),this._enabled=cS&&cS(),this._fogDensity=lS&&lS(),this._fogStart=_S&&_S(),this._fogEnd=fS&&fS(),this._fogAtten=dS&&dS(),this._fogTop=pS&&pS(),this._fogRange=mS&&mS(),this._accurate=gS&&gS(),this._resource=null}return t.prototype.activate=function(t){this._resource=t,this._resource.initialize(this),this._resource.activate()},n(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}()).FogType=bA,d((oS=vS).prototype,"type",[$T],Object.getOwnPropertyDescriptor(oS.prototype,"type"),oS.prototype),d(oS.prototype,"fogDensity",[tS],Object.getOwnPropertyDescriptor(oS.prototype,"fogDensity"),oS.prototype),d(oS.prototype,"fogStart",[eS],Object.getOwnPropertyDescriptor(oS.prototype,"fogStart"),oS.prototype),d(oS.prototype,"fogEnd",[iS],Object.getOwnPropertyDescriptor(oS.prototype,"fogEnd"),oS.prototype),d(oS.prototype,"fogAtten",[nS],Object.getOwnPropertyDescriptor(oS.prototype,"fogAtten"),oS.prototype),d(oS.prototype,"fogTop",[rS],Object.getOwnPropertyDescriptor(oS.prototype,"fogTop"),oS.prototype),d(oS.prototype,"fogRange",[sS],Object.getOwnPropertyDescriptor(oS.prototype,"fogRange"),oS.prototype),hS=gs(oS.prototype,"_type",[Ls],(function(){return bA.LINEAR})),uS=gs(oS.prototype,"_fogColor",[Ls],(function(){return new qi("#C8C8C8")})),cS=gs(oS.prototype,"_enabled",[Ls],(function(){return!1})),lS=gs(oS.prototype,"_fogDensity",[Ls],(function(){return.3})),_S=gs(oS.prototype,"_fogStart",[Ls],(function(){return.5})),fS=gs(oS.prototype,"_fogEnd",[Ls],(function(){return 300})),dS=gs(oS.prototype,"_fogAtten",[Ls],(function(){return 5})),pS=gs(oS.prototype,"_fogTop",[Ls],(function(){return 1.5})),mS=gs(oS.prototype,"_fogRange",[Ls],(function(){return 1.2})),gS=gs(oS.prototype,"_accurate",[Ls],(function(){return!1})),aS=oS))||aS)),UA=t("ShadowsInfo",(yS=bs("cc.ShadowsInfo"),ES=sa($E),TS=sa(We),SS=sa(Ve),AS=sa(JE),yS((d((CS=function(){function t(){this._enabled=bS&&bS(),this._type=IS&&IS(),this._normal=wS&&wS(),this._distance=OS&&OS(),this._shadowColor=xS&&xS(),this._maxReceived=NS&&NS(),this._size=DS&&DS(),this._resource=null}var e=t.prototype;return e.setPlaneFromNode=function(t){t.getWorldRotation(MA),this.planeDirection=Wi.transformQuat(xA,OA,MA),t.getWorldPosition(xA),this.planeHeight=Wi.dot(this._normal,xA)},e.activate=function(t){this._resource=t,this._resource.initialize(this),this._resource.activate()},n(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){Wi.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,"type",[ES],Object.getOwnPropertyDescriptor(CS.prototype,"type"),CS.prototype),d(CS.prototype,"planeHeight",[TS],Object.getOwnPropertyDescriptor(CS.prototype,"planeHeight"),CS.prototype),d(CS.prototype,"maxReceived",[SS],Object.getOwnPropertyDescriptor(CS.prototype,"maxReceived"),CS.prototype),d(CS.prototype,"shadowMapSize",[AS],Object.getOwnPropertyDescriptor(CS.prototype,"shadowMapSize"),CS.prototype),bS=gs(CS.prototype,"_enabled",[Ls],(function(){return!1})),IS=gs(CS.prototype,"_type",[Ls],(function(){return $E.Planar})),wS=gs(CS.prototype,"_normal",[Ls],(function(){return new Wi(0,1,0)})),OS=gs(CS.prototype,"_distance",[Ls],(function(){return 0})),xS=gs(CS.prototype,"_shadowColor",[Ls],(function(){return new qi(0,0,0,76)})),NS=gs(CS.prototype,"_maxReceived",[Ls],(function(){return 4})),DS=gs(CS.prototype,"_size",[Ls],(function(){return new pn(1024,1024)})),RS=CS))||RS));g.ShadowsInfo=UA;var kA=t("DEFAULT_WORLD_MIN_POS",new Wi(-1024,-1024,-1024)),GA=t("DEFAULT_WORLD_MAX_POS",new Wi(1024,1024,1024)),HA=t("DEFAULT_OCTREE_DEPTH",8),zA=t("OctreeInfo",(MS=bs("cc.OctreeInfo"),PS=sa(Ve),MS((d((BS=function(){function t(){this._enabled=FS&&FS(),this._minPos=US&&US(),this._maxPos=kS&&kS(),this._depth=GS&&GS(),this._resource=null}return t.prototype.activate=function(t){this._resource=t,this._resource.initialize(this)},n(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,"depth",[PS],Object.getOwnPropertyDescriptor(BS.prototype,"depth"),BS.prototype),FS=gs(BS.prototype,"_enabled",[Ls],(function(){return!1})),US=gs(BS.prototype,"_minPos",[Ls],(function(){return new Wi(kA)})),kS=gs(BS.prototype,"_maxPos",[Ls],(function(){return new Wi(GA)})),GS=gs(BS.prototype,"_depth",[Ls],(function(){return HA})),LS=BS))||LS));g.OctreeInfo=zA;var VA=t("SkinInfo",(HS=bs("cc.SkinInfo"),zS=sa(We),VS=sa(We),HS((d((XS=function(){function t(){this._enabled=jS&&jS(),this._blurRadius=YS&&YS(),this._sssIntensity=KS&&KS(),this._resource=null}return t.prototype.activate=function(t){this._resource=t,this._resource.initialize(this)},n(t,[{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled!==t&&(this._enabled=t,this._resource&&(this._resource.enabled=t))}},{key:"blurRadius",get:function(){return this._blurRadius},set:function(t){this._blurRadius=t,this._resource&&(this._resource.blurRadius=t)}},{key:"sssIntensity",get:function(){return this._sssIntensity},set:function(t){this._sssIntensity=t,this._resource&&(this._resource.sssIntensity=t)}}]),t}()).prototype,"blurRadius",[zS],Object.getOwnPropertyDescriptor(XS.prototype,"blurRadius"),XS.prototype),d(XS.prototype,"sssIntensity",[VS],Object.getOwnPropertyDescriptor(XS.prototype,"sssIntensity"),XS.prototype),jS=gs(XS.prototype,"_enabled",[Ls],(function(){return!0})),YS=gs(XS.prototype,"_blurRadius",[Ls],(function(){return.01})),KS=gs(XS.prototype,"_sssIntensity",[Ls],(function(){return 3})),WS=XS))||WS));g.SkinInfo=VA;var WA,XA,jA,YA,KA,qA,QA,ZA,JA,$A,tR,eR,iR,nR,rR,sR,aR,oR,hR,uR,cR,lR,_R,fR,dR,pR,mR,gR,vR,yR,ER,TR,SR,AR,RR,CR,bR,IR,wR,OR,xR,NR,DR,MR,PR,LR,BR,FR,UR,kR,GR,HR,zR,VR,WR,XR,jR,YR,KR,qR,QR,ZR,JR,$R,tC,eC,iC,nC,rC,sC=t("LightProbeInfo",(qS=bs("cc.LightProbeInfo"),QS=sa(We),ZS=sa(Ve),JS=sa(Ve),$S=sa(We),tA=sa(We),qS((d((iA=function(){function t(){this._giScale=nA&&nA(),this._giSamples=rA&&rA(),this._bounces=sA&&sA(),this._reduceRinging=aA&&aA(),this._showProbe=oA&&oA(),this._showWireframe=hA&&hA(),this._showConvex=uA&&uA(),this._data=cA&&cA(),this._lightProbeSphereVolume=lA&&lA(),this._nodes=[],this._scene=null,this._resource=null}var e=t.prototype;return e.activate=function(t,e){this._scene=t,this._resource=e,this._resource.initialize(this)},e.onProbeBakeFinished=function(){this.onProbeBakingChanged(this._scene)},e.onProbeBakeCleared=function(){this.clearSHCoefficients(),this.onProbeBakingChanged(this._scene)},e.onProbeBakingChanged=function(t){if(t){t.emit(Xp.LIGHT_PROBE_BAKING_CHANGED);for(var e=0;e<t.children.length;e++){var i=t.children[e];this.onProbeBakingChanged(i)}}},e.clearSHCoefficients=function(){if(this._data){for(var t=this._data.probes,e=0;e<t.length;e++)t[e].coefficients.length=0;this.clearAllSHUBOs()}},e.isUniqueNode=function(){return 1===this._nodes.length},e.addNode=function(t){if(!t)return!1;for(var e=0;e<this._nodes.length;e++)if(this._nodes[e].node===t)return!1;return this._nodes.push({node:t,probes:null}),!0},e.removeNode=function(t){if(!t)return!1;var e=this._nodes.findIndex((function(e){return e.node===t}));return-1!==e&&(this._nodes.splice(e,1),!0)},e.syncData=function(t,e){for(var i=0;i<this._nodes.length;i++)if(this._nodes[i].node===t)return void(this._nodes[i].probes=e)},e.update=function(t){if(void 0===t&&(t=!0),g.internal.LightProbesData){this._data||(this._data=new g.internal.LightProbesData,this._resource&&(this._resource.data=this._data));for(var e=[],i=0;i<this._nodes.length;i++){var n=this._nodes[i].node,r=this._nodes[i].probes,s=n.worldPosition;if(r)for(var a=0;a<r.length;a++){var o=new Wi(0,0,0);Wi.add(o,r[a],s),e.push(o)}}if(e.length<4)return this.resetAllTetraIndices(),void this._data.reset();this._data.updateProbes(e),t&&(this.resetAllTetraIndices(),this._data.updateTetrahedrons())}},e.clearAllSHUBOs=function(){if(this._scene){var t=this._scene.renderScene;if(t)for(var e=t.models,i=0;i<e.length;i++)e[i].clearSHUBOs()}},e.resetAllTetraIndices=function(){if(this._scene){var t=this._scene.renderScene;if(t)for(var e=t.models,i=0;i<e.length;i++)e[i].tetrahedronIndex=-1}},n(t,[{key:"giScale",get:function(){return this._giScale},set:function(t){this._giScale!==t&&(this._giScale=t,this._resource&&(this._resource.giScale=t))}},{key:"giSamples",get:function(){return this._giSamples},set:function(t){this._giSamples!==t&&(this._giSamples=t,this._resource&&(this._resource.giSamples=t))}},{key:"bounces",get:function(){return this._bounces},set:function(t){this._bounces!==t&&(this._bounces=t,this._resource&&(this._resource.bounces=t))}},{key:"reduceRinging",get:function(){return this._reduceRinging},set:function(t){this._reduceRinging!==t&&(this._reduceRinging=t,this._resource&&(this._resource.reduceRinging=t))}},{key:"showProbe",get:function(){return this._showProbe},set:function(t){this._showProbe!==t&&(this._showProbe=t,this._resource&&(this._resource.showProbe=t))}},{key:"showWireframe",get:function(){return this._showWireframe},set:function(t){this._showWireframe!==t&&(this._showWireframe=t,this._resource&&(this._resource.showWireframe=t))}},{key:"showConvex",get:function(){return this._showConvex},set:function(t){this._showConvex!==t&&(this._showConvex=t,this._resource&&(this._resource.showConvex=t))}},{key:"data",get:function(){return this._data},set:function(t){this._data!==t&&(this._data=t,this._resource&&(this._resource.data=t))}},{key:"lightProbeSphereVolume",get:function(){return this._lightProbeSphereVolume},set:function(t){this._lightProbeSphereVolume!==t&&(this._lightProbeSphereVolume=t,this._resource&&(this._resource.lightProbeSphereVolume=t))}}]),t}()).prototype,"giScale",[QS],Object.getOwnPropertyDescriptor(iA.prototype,"giScale"),iA.prototype),d(iA.prototype,"giSamples",[ZS],Object.getOwnPropertyDescriptor(iA.prototype,"giSamples"),iA.prototype),d(iA.prototype,"bounces",[JS],Object.getOwnPropertyDescriptor(iA.prototype,"bounces"),iA.prototype),d(iA.prototype,"reduceRinging",[$S],Object.getOwnPropertyDescriptor(iA.prototype,"reduceRinging"),iA.prototype),d(iA.prototype,"lightProbeSphereVolume",[tA],Object.getOwnPropertyDescriptor(iA.prototype,"lightProbeSphereVolume"),iA.prototype),nA=gs(iA.prototype,"_giScale",[Ls],(function(){return 1})),rA=gs(iA.prototype,"_giSamples",[Ls],(function(){return 1024})),sA=gs(iA.prototype,"_bounces",[Ls],(function(){return 2})),aA=gs(iA.prototype,"_reduceRinging",[Ls],(function(){return 0})),oA=gs(iA.prototype,"_showProbe",[Ls],(function(){return!0})),hA=gs(iA.prototype,"_showWireframe",[Ls],(function(){return!0})),uA=gs(iA.prototype,"_showConvex",[Ls],(function(){return!1})),cA=gs(iA.prototype,"_data",[Ls],(function(){return null})),lA=gs(iA.prototype,"_lightProbeSphereVolume",[Ls],(function(){return 1})),eA=iA))||eA)),aC=t("SceneGlobals",(_A=bs("cc.SceneGlobals"),fA=sa(BA),_A((pA=function(){function t(){this.ambient=mA&&mA(),this.shadows=gA&&gA(),this._skybox=vA&&vA(),this.fog=yA&&yA(),this.octree=EA&&EA(),this.skin=TA&&TA(),this.lightProbeInfo=SA&&SA(),this.bakedWithStationaryMainLight=AA&&AA(),this.bakedWithHighpLightmap=RA&&RA(),this.disableLightmap=!1}return t.prototype.activate=function(t){var e=g.director.root.pipeline.pipelineSceneData;this.skybox.activate(e.skybox),this.ambient.activate(e.ambient),this.shadows.activate(e.shadows),this.fog.activate(e.fog),this.octree.activate(e.octree),this.skin.activate(e.skin),this.lightProbeInfo&&e.lightProbes&&this.lightProbeInfo.activate(t,e.lightProbes),g.director.root.onGlobalPipelineStateChanged()},n(t,[{key:"skybox",get:function(){return this._skybox},set:function(t){this._skybox=t}}]),t}(),mA=gs(pA.prototype,"ambient",[Ls],(function(){return new LA})),gA=gs(pA.prototype,"shadows",[Ls],(function(){return new UA})),vA=gs(pA.prototype,"_skybox",[Ls],(function(){return new BA})),yA=gs(pA.prototype,"fog",[Ls],(function(){return new FA})),d(pA.prototype,"skybox",[fA],Object.getOwnPropertyDescriptor(pA.prototype,"skybox"),pA.prototype),EA=gs(pA.prototype,"octree",[Ls],(function(){return new zA})),TA=gs(pA.prototype,"skin",[Ls],(function(){return new VA})),SA=gs(pA.prototype,"lightProbeInfo",[Ls],(function(){return new sC})),AA=gs(pA.prototype,"bakedWithStationaryMainLight",[Ls],(function(){return!1})),RA=gs(pA.prototype,"bakedWithHighpLightmap",[Ls],(function(){return!1})),dA=pA))||dA));g.SceneGlobals=aC;var oC=(WA=bs("cc.TargetInfo"),XA=sa([je]),WA((YA=function(){this.localID=KA&&KA()},KA=gs(YA.prototype,"localID",[Ls,XA],(function(){return[]})),jA=YA))||jA),hC=(qA=bs("cc.TargetOverrideInfo"),QA=sa(Ta),ZA=sa(oC),JA=sa([je]),$A=sa(Lm),tR=sa(oC),qA((iR=function(){this.source=nR&&nR(),this.sourceInfo=rR&&rR(),this.propertyPath=sR&&sR(),this.target=aR&&aR(),this.targetInfo=oR&&oR()},nR=gs(iR.prototype,"source",[Ls,QA],(function(){return null})),rR=gs(iR.prototype,"sourceInfo",[Ls,ZA],(function(){return null})),sR=gs(iR.prototype,"propertyPath",[Ls,JA],(function(){return[]})),aR=gs(iR.prototype,"target",[Ls,$A],(function(){return null})),oR=gs(iR.prototype,"targetInfo",[Ls,tR],(function(){return null})),eR=iR))||eR),uC=bs("cc.CompPrefabInfo")((uR=function(){this.fileId=cR&&cR()},cR=gs(uR.prototype,"fileId",[Ls],(function(){return""})),hR=uR))||hR,cC=(lR=bs("CCPropertyOverrideInfo"),_R=sa(oC),fR=sa([je]),lR((pR=function(){function t(){this.targetInfo=mR&&mR(),this.propertyPath=gR&&gR(),this.value=vR&&vR()}return t.prototype.isTarget=function(){},t}(),mR=gs(pR.prototype,"targetInfo",[Ls,_R],(function(){return null})),gR=gs(pR.prototype,"propertyPath",[Ls,fR],(function(){return[]})),vR=gs(pR.prototype,"value",[Ls],null),dR=pR))||dR),lC=(yR=bs("cc.MountedChildrenInfo"),ER=sa(oC),TR=sa([Lm]),yR((AR=function(){function t(){this.targetInfo=RR&&RR(),this.nodes=CR&&CR()}return t.prototype.isTarget=function(){},t}(),RR=gs(AR.prototype,"targetInfo",[Ls,ER],(function(){return null})),CR=gs(AR.prototype,"nodes",[Ls,TR],(function(){return[]})),SR=AR))||SR),_C=(bR=bs("cc.MountedComponentsInfo"),IR=sa(oC),wR=sa([Wd]),bR((xR=function(){function t(){this.targetInfo=NR&&NR(),this.components=DR&&DR()}return t.prototype.isTarget=function(){},t}(),NR=gs(xR.prototype,"targetInfo",[Ls,IR],(function(){return null})),DR=gs(xR.prototype,"components",[Ls,wR],(function(){return[]})),OR=xR))||OR),fC=(MR=bs("cc.PrefabInstance"),PR=sa(Lm),LR=sa([lC]),BR=sa([_C]),FR=sa([cC]),UR=sa([oC]),MR((GR=function(){function t(){this.fileId=HR&&HR(),this.prefabRootNode=zR&&zR(),this.mountedChildren=VR&&VR(),this.mountedComponents=WR&&WR(),this.propertyOverrides=XR&&XR(),this.removedComponents=jR&&jR(),this.targetMap={},this.expanded=!1}var e=t.prototype;return e.findPropertyOverride=function(){},e.removePropertyOverride=function(){},t}(),HR=gs(GR.prototype,"fileId",[Ls],(function(){return""})),zR=gs(GR.prototype,"prefabRootNode",[Ls,PR],null),VR=gs(GR.prototype,"mountedChildren",[Ls,LR],(function(){return[]})),WR=gs(GR.prototype,"mountedComponents",[Ls,BR],(function(){return[]})),XR=gs(GR.prototype,"propertyOverrides",[Ls,FR],(function(){return[]})),jR=gs(GR.prototype,"removedComponents",[Ls,UR],(function(){return[]})),kR=GR))||kR),dC=(YR=bs("cc.PrefabInfo"),KR=sa(Lm),qR=sa(fC),QR=sa([hC]),YR((JR=function(){this.root=$R&&$R(),this.asset=tC&&tC(),this.fileId=eC&&eC(),this.instance=iC&&iC(),this.targetOverrides=nC&&nC(),this.nestedPrefabInstanceRoots=rC&&rC()},$R=gs(JR.prototype,"root",[Ls,KR],null),tC=gs(JR.prototype,"asset",[Ls],null),eC=gs(JR.prototype,"fileId",[Ls],(function(){return""})),iC=gs(JR.prototype,"instance",[Ls,qR],null),nC=gs(JR.prototype,"targetOverrides",[Ls,QR],null),rC=gs(JR.prototype,"nestedPrefabInstanceRoots",[Ls],null),ZR=JR))||ZR);function pC(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.getParent(),r=t.uuid,s=t._prefab;t[oa],g.game._isCloning=!0;var a=e.asset.data;a._iN$t=t,g.instantiate._clone(a,a),g.game._isCloning=!1,t._objFlags=i,t.modifyParent(n),t.id=r,t._prefab&&(t._prefab.instance=null==s?void 0:s.instance)}}function mC(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,h=0;h<o.length;h++){var u=o[h];u.__prefab&&(r[u.__prefab.fileId]=u)}for(var c=0;c<t.children.length;c++)mC(t.children[c],r,!1)}}function gC(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 vC(t,e,i){if(e)for(var n=0;n<e.length;n++){var r=e[n];if(r&&r.targetInfo){var s=gC(r.targetInfo.localID,i);if(!s)continue;var a=i,o=r.targetInfo.localID;if(o.length>0)for(var h=0;h<o.length-1;h++)a=a[o[h]];if(r.nodes)for(var u=0;u<r.nodes.length;u++){var c=r.nodes[u];c&&!s.children.includes(c)&&(s.children.push(c),c.modifyParent(s),mC(c,a,!1),c.siblingIndex=s.children.length-1,AC(c,!0))}}}}function yC(t,e,i){if(e)for(var n=0;n<e.length;n++){var r=e[n];if(r&&r.targetInfo){var s=gC(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.getWritableComponents().push(o))}}}}function EC(t,e,i){if(e)for(var n=0;n<e.length;n++){var r=e[n];if(r){var s=gC(r.localID,i);if(!s||!s.node)continue;var a=s.node.components.indexOf(s);a>=0&&s.node.getWritableComponents().splice(a,1)}}}function TC(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=gC(s.targetInfo.localID,i)))continue;var a=n,o=s.propertyPath.slice();if(o.length>0){var h=o.pop();if(!h)continue;for(var u=0;u<o.length&&(a=a[o[u]]);u++);if(!a)continue;if(Array.isArray(a))if("length"===h)a[h]=s.value;else{var c=Number.parseInt(h);Number.isInteger(c)&&c<a.length&&(a[h]=s.value)}else a[h]instanceof ve?a[h].set(s.value):a[h]=s.value}}}}function SC(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,h=a.sourceInfo;if(h){var u,c,l=null===(u=a.source)||void 0===u||null===(c=u._prefab)||void 0===c?void 0:c.instance;l&&l.targetMap&&(o=gC(h.localID,l.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&&(_=gC(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 AC(t,e){void 0===e&&(e=!1);var i=t._prefab,n=null==i?void 0:i.instance;if(n&&!n.expanded){pC(t),e&&t&&t.children&&t.children.forEach((function(t){AC(t,!0)}));var r={};n.targetMap=r,mC(t,r,!0),vC(0,n.mountedChildren,r),EC(0,n.removedComponents,r),yC(0,n.mountedComponents,r),TC(0,n.propertyOverrides,r),n.expanded=!0}else e&&t&&t.children&&t.children.forEach((function(t){AC(t,!0)}))}function RC(t){var e=t._prefab;e&&e.nestedPrefabInstanceRoots&&e.nestedPrefabInstanceRoots.forEach((function(t){var e,i,n;AC(t),CC(t,null!==(e=null===(i=t._prefab)||void 0===i||null===(n=i.instance)||void 0===n?void 0:n.fileId)&&void 0!==e?e:"")}))}function CC(t,e){for(var i=t.components,n=t.children,r=0;r<i.length;r++){var s,a,o=i[r],h=null!==(s=null===(a=o.__prefab)||void 0===a?void 0:a.fileId)&&void 0!==s?s:"";o._id=""+e+h}for(var u=0;u<n.length;u++){var c=n[u],l=c._prefab,_=null!=l&&l.instance?l.instance.fileId:null==l?void 0:l.fileId;_&&(c.id=""+e+_,null!=l&&l.instance||CC(c,e))}}g._PrefabInfo=dC;var bC,IC,wC,OC,xC,NC,DC,MC=Object.freeze({__proto__:null,createNodeWithPrefab:pC,generateTargetMap:mC,getTarget:gC,applyMountedChildren:vC,applyMountedComponents:yC,applyRemovedComponents:EC,applyPropertyOverrides:TC,applyTargetOverrides:SC,expandPrefabInstanceNode:AC,expandNestedPrefabInstanceNode:RC,applyNodeAndComponentId:CC,TargetInfo:oC,TargetOverrideInfo:hC,CompPrefabInfo:uC,PropertyOverrideInfo:cC,MountedChildrenInfo:lC,MountedComponentsInfo:_C,PrefabInstance:fC,PrefabInfo:dC}),PC=t("Scene",bs("cc.Scene")((IC=function(t){s(i,t);var e=i.prototype;function i(e){var i;return(i=t.call(this,e)||this).autoReleaseAssets=wC&&wC(),i._globals=OC&&OC(),i.dependAssets=null,i._renderScene=null,i._inited=void 0,i._prefabSyncedInLiveReload=!1,i._activeInHierarchy=!1,g.director&&g.director.root&&(i._renderScene=g.director.root.createScene({})),i._inited=!g.game||!g.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&&g.director.root.destroyScene(this._renderScene),this._active=!1,this._activeInHierarchy=!1,t},e.addComponent=function(){throw new Error(J(3822))},e._onHierarchyChanged=function(){},e._onPostActivated=function(){},e._onBatchCreated=function(t){for(var e=this._children.length,i=0;i<e;++i)this._children[i]._siblingIndex=i,this._children[i]._onBatchCreated(t)},e.updateWorldTransform=function(){},e._instantiate=function(){},e._load=function(){this._inited||(RC(this),SC(this),this._onBatchCreated(false),this._inited=!0),this.walk(Lm._setScene)},e._activate=function(t){void 0===t&&(t=!0),g.director._nodeActivator.activateNode(this,t),this._globals.activate(this)},n(i,[{key:"renderScene",get:function(){return this._renderScene}},{key:"globals",get:function(){return this._globals}}]),i}(Lm),wC=gs(IC.prototype,"autoReleaseAssets",[Ls],(function(){return!1})),OC=gs(IC.prototype,"_globals",[Ls],(function(){return new aC})),bC=IC))||bC);g.Scene=PC;var LC=t("SceneAsset",bs("cc.SceneAsset")((NC=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).scene=DC&&DC(),e}s(e,t);var i=e.prototype;return i.initDefault=function(e){t.prototype.initDefault.call(this,e),this.scene=new PC("New Scene")},i.validate=function(){return!!this.scene},e}(jf),DC=gs(NC.prototype,"scene",[Ls],(function(){return null})),xC=NC))||xC);g.SceneAsset=LC,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 BC,FC,UC=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}());UC.NO_TYPE="no_type",UC.TOUCH="touch",UC.MOUSE="mouse",UC.KEYBOARD="keyboard",UC.ACCELERATION="acceleration",UC.NONE=0,UC.CAPTURING_PHASE=1,UC.AT_TARGET=2,UC.BUBBLING_PHASE=3,g.Event=UC,t("SystemEventType",BC),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"}(BC||t("SystemEventType",BC={})),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",t.HANDHELD_POSE_INPUT="handheld-pose-input"}(FC||(FC={})),g.SystemEventType=BC;var kC=t("EventAcceleration",function(t){function e(e,i){var n;return(n=t.call(this,BC.DEVICEMOTION,i)||this).acc=void 0,n.acc=e,n}return s(e,t),e}(UC));UC.EventAcceleration=kC;var GC=t("EventKeyboard",function(t){function e(e,i,n){var r;return"boolean"==typeof i&&(i=i?BC.KEY_DOWN:BC.KEY_UP),(r=t.call(this,i,n)||this).windowId=void 0,r.keyCode=void 0,r.rawEvent=void 0,r._isPressed=void 0,r._isPressed=i!==BC.KEY_UP,"number"==typeof e?r.keyCode=e:(r.keyCode=e.keyCode,r.rawEvent=e),r.windowId=0,r}return s(e,t),n(e,[{key:"isPressed",get:function(){return this._isPressed}}]),e}(UC));UC.EventKeyboard=GC;var HC=t("EventMouse",function(t){function e(i,n,r,s){var a;return(a=t.call(this,i,n)||this).movementX=0,a.movementY=0,a.windowId=0,a.preventSwallow=!1,a._eventType=void 0,a._button=e.BUTTON_MISSING,a._x=0,a._y=0,a._prevX=0,a._prevY=0,a._scrollX=0,a._scrollY=0,a._eventType=i,r&&(a._prevX=r.x,a._prevY=r.y),a.windowId=null!=s?s:a.windowId,a}s(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 pn),pn.set(t,this._x,this._y),t},i.getLocationInView=function(t){return t||(t=new pn),pn.set(t,this._x,g.view._designResolutionSize.height-this._y),t},i.getUILocation=function(t){return t||(t=new pn),pn.set(t,this._x,this._y),g.view._convertToUISpace(t),t},i.getPreviousLocation=function(t){return t||(t=new pn),pn.set(t,this._prevX,this._prevY),t},i.getUIPreviousLocation=function(t){return t||(t=new pn),pn.set(t,this._prevX,this._prevY),g.view._convertToUISpace(t),t},i.getDelta=function(t){return t||(t=new pn),pn.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 pn),pn.set(t,(this._x-this._prevX)/g.view.getScaleX(),(this._y-this._prevY)/g.view.getScaleY()),t},i.getUIDeltaX=function(){return(this._x-this._prevX)/g.view.getScaleX()},i.getUIDeltaY=function(){return(this._y-this._prevY)/g.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=g.view.getViewportRect();return(this._x-t.x)/g.view.getScaleX()},i.getUILocationY=function(){var t=g.view.getViewportRect();return(this._y-t.y)/g.view.getScaleY()},n(e,[{key:"eventType",get:function(){return this._eventType}}]),e}(UC));HC.BUTTON_MISSING=-1,HC.BUTTON_LEFT=0,HC.BUTTON_RIGHT=2,HC.BUTTON_MIDDLE=1,HC.BUTTON_4=3,HC.BUTTON_5=4,HC.BUTTON_6=5,HC.BUTTON_7=6,HC.BUTTON_8=7,UC.EventMouse=HC;var zC=new pn,VC=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.windowId=0,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}s(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 pn},i.getUILocation=function(t){return this.touch?this.touch.getUILocation(t):new pn},i.getLocationInView=function(t){return this.touch?this.touch.getLocationInView(t):new pn},i.getPreviousLocation=function(t){return this.touch?this.touch.getPreviousLocation(t):new pn},i.getStartLocation=function(t){return this.touch?this.touch.getStartLocation(t):new pn},i.getUIStartLocation=function(t){return this.touch?this.touch.getUIStartLocation(t):new pn},i.getID=function(){return this.touch?this.touch.getID():null},i.getDelta=function(t){return this.touch?this.touch.getDelta(t):new pn},i.getUIDelta=function(t){return this.touch?this.touch.getUIDelta(t):new pn},i.getDeltaX=function(){return this.touch?this.touch.getDelta(zC).x:0},i.getDeltaY=function(){return this.touch?this.touch.getDelta(zC).y:0},i.getLocationX=function(){return this.touch?this.touch.getLocationX():0},i.getLocationY=function(){return this.touch?this.touch.getLocationY():0},e}(UC));VC.MAX_TOUCHES=5,UC.EventTouch=VC;var WC,XC=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 s(e,t),e}(UC)),jC=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 s(e,t),e}(UC)),YC=(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 s(e,t),e}(UC)),t("EventHandheld",function(t){function e(e,i){var n;return(n=t.call(this,e,!1)||this).handheldInputDevice=void 0,n.handheldInputDevice=i,n}return s(e,t),e}(UC)),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})));t("KeyCode",WC),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"}(WC||t("KeyCode",WC={}));var KC=new pn,qC=t("Touch",function(){function t(t,e,i){void 0===i&&(i=0),this._point=new pn,this._prevPoint=new pn,this._lastModified=0,this._id=0,this._startPoint=new pn,this._startPointCaptured=!1,this.setTouchInfo(i,t,e)}var e=t.prototype;return e.getLocation=function(t){return t||(t=new pn),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 pn),t.set(this._point.x,this._point.y),g.view._convertToUISpace(t),t},e.getUILocationX=function(){var t=g.view.getViewportRect();return(this._point.x-t.x)/g.view.getScaleX()},e.getUILocationY=function(){var t=g.view.getViewportRect();return(this._point.y-t.y)/g.view.getScaleY()},e.getPreviousLocation=function(t){return t||(t=new pn),t.set(this._prevPoint.x,this._prevPoint.y),t},e.getUIPreviousLocation=function(t){return t||(t=new pn),t.set(this._prevPoint.x,this._prevPoint.y),g.view._convertToUISpace(t),t},e.getStartLocation=function(t){return t||(t=new pn),t.set(this._startPoint.x,this._startPoint.y),t},e.getUIStartLocation=function(t){return t||(t=new pn),t.set(this._startPoint.x,this._startPoint.y),g.view._convertToUISpace(t),t},e.getDelta=function(t){return t||(t=new pn),t.set(this._point),t.subtract(this._prevPoint),t},e.getUIDelta=function(t){return t||(t=new pn),KC.set(this._point),KC.subtract(this._prevPoint),t.set(g.view.getScaleX(),g.view.getScaleY()),pn.divide(t,KC,t),t},e.getLocationInView=function(t){return t||(t=new pn),t.set(this._point.x,g.view._designResolutionSize.height-this._point.y),t},e.getPreviousLocationInView=function(t){return t||(t=new pn),t.set(this._prevPoint.x,g.view._designResolutionSize.height-this._prevPoint.y),t},e.getStartLocationInView=function(t){return t||(t=new pn),t.set(this._startPoint.x,g.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 pn(e||0,i||0),this._id=t,this._startPointCaptured||(this._startPoint=new pn(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=g.game.frameStartTime},e.setPrevPoint=function(t,e){this._prevPoint="object"==typeof t?new pn(t.x,t.y):new pn(t||0,e||0),this._lastModified=g.game.frameStartTime},n(t,[{key:"lastModified",get:function(){return this._lastModified}}]),t}());g.Touch=qC;var QC=function(){function t(){this._isStarted=!1,this._accelMode="normal",this._eventTarget=new Uu,this._didAccelerateFunc=void 0,this._didAccelerateFunc=this._didAccelerate.bind(this)}var e=t.prototype;return e._registerEvent=function(){Au.onAccelerometerChange(this._didAccelerateFunc)},e._unregisterEvent=function(){Au.offAccelerometerChange(this._didAccelerateFunc)},e._didAccelerate=function(t){var e=performance.now(),i=new YC(t.x,t.y,t.z,e),n=new kC(i);this._eventTarget.emit(FC.DEVICEMOTION,n)},e.start=function(){var t=this;this._registerEvent(),Au.startAccelerometer({interval:this._accelMode,success:function(){t._isStarted=!0}})},e.stop=function(){var t=this;Au.stopAccelerometer({success:function(){t._isStarted=!1},fail:function(){console.error("failed to stop accelerometer")}}),this._unregisterEvent()},e.setInterval=function(t){this._accelMode=t>=200?"normal":t>=60?"ui":"game",this._isStarted&&(this.stop(),this.start())},e.on=function(t,e,i){this._eventTarget.on(t,e,i)},t}(),ZC=function(){},JC=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.getValue=function(){throw new Error("Method not implemented.")},e}(ZC),$C=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.getValue=function(){throw new Error("Method not implemented.")},e}(ZC),tb=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.getValue=function(){throw new Error("Method not implemented.")},e}(ZC),eb=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.getValue=function(){throw new Error("Method not implemented.")},e}(ZC),ib=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 s(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}(JC),nb=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 ib({positive:i.right,negative:i.left}),i.yAxis=new ib({positive:i.up,negative:i.down}),i}return s(e,t),e.prototype.getValue=function(){return new pn(this.xAxis.getValue(),this.yAxis.getValue())},e}($C);!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 ib({positive:i.right,negative:i.left}),i.yAxis=new ib({positive:i.up,negative:i.down}),i.zAxis=new ib({positive:i.forward,negative:i.backward}),i}s(e,t),e.prototype.getValue=function(){return new Wi(this.xAxis.getValue(),this.yAxis.getValue(),this.zAxis.getValue())}}(tb);var rb=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.getValue=function(){return t.prototype.getValue.call(this)},e}(JC),sb=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(nb),ab=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(nb),ob=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.getValue=function(){return t.prototype.getValue.call(this)},e}(eb),hb=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.getValue=function(){return t.prototype.getValue.call(this)},e}(tb),ub=function(){function t(t){this._buttonNorth=void 0,this._buttonEast=void 0,this._buttonWest=void 0,this._buttonSouth=void 0,this._buttonL1=void 0,this._buttonL2=void 0,this._buttonL3=void 0,this._buttonR1=void 0,this._buttonR2=void 0,this._buttonR3=void 0,this._buttonShare=void 0,this._buttonOptions=void 0,this._dpad=void 0,this._leftStick=void 0,this._rightStick=void 0,this._buttonStart=void 0,this._gripLeft=void 0,this._gripRight=void 0,this._handLeftPosition=void 0,this._handLeftOrientation=void 0,this._handRightPosition=void 0,this._handRightOrientation=void 0,this._aimLeftPosition=void 0,this._aimLeftOrientation=void 0,this._aimRightPosition=void 0,this._aimRightOrientation=void 0,this._deviceId=-1,this._connected=!1,this._deviceId=t,this._initInputSource()}return t._init=function(){},t._on=function(e,i,n){t._eventTarget.on(e,i,n)},t.prototype._initInputSource=function(){this._buttonNorth=new rb,this._buttonNorth.getValue=function(){return 0},this._buttonEast=new rb,this._buttonEast.getValue=function(){return 0},this._buttonWest=new rb,this._buttonWest.getValue=function(){return 0},this._buttonSouth=new rb,this._buttonSouth.getValue=function(){return 0},this._buttonL1=new rb,this._buttonL1.getValue=function(){return 0},this._buttonL2=new rb,this._buttonL2.getValue=function(){return 0},this._buttonL3=new rb,this._buttonL3.getValue=function(){return 0},this._buttonR1=new rb,this._buttonR1.getValue=function(){return 0},this._buttonR2=new rb,this._buttonR2.getValue=function(){return 0},this._buttonR3=new rb,this._buttonR3.getValue=function(){return 0},this._buttonShare=new rb,this._buttonShare.getValue=function(){return 0},this._buttonOptions=new rb,this._buttonOptions.getValue=function(){return 0};var t=new rb;t.getValue=function(){return 0};var e=new rb;e.getValue=function(){return 0};var i=new rb;i.getValue=function(){return 0};var n=new rb;n.getValue=function(){return 0},this._dpad=new sb({up:t,down:e,left:i,right:n});var r=new rb;r.getValue=function(){return 0};var s=new rb;s.getValue=function(){return 0};var a=new rb;a.getValue=function(){return 0};var o=new rb;o.getValue=function(){return 0},this._leftStick=new ab({up:r,down:s,left:a,right:o});var h=new rb;h.getValue=function(){return 0};var u=new rb;u.getValue=function(){return 0};var c=new rb;c.getValue=function(){return 0};var l=new rb;l.getValue=function(){return 0},this._rightStick=new ab({up:h,down:u,left:c,right:l}),this._buttonStart=new rb,this._buttonStart.getValue=function(){return 0},this._gripLeft=new rb,this._gripLeft.getValue=function(){return 0},this._gripRight=new rb,this._gripRight.getValue=function(){return 0},this._handLeftPosition=new hb,this._handLeftPosition.getValue=function(){return Wi.ZERO},this._handLeftOrientation=new ob,this._handLeftOrientation.getValue=function(){return en.IDENTITY},this._handRightPosition=new hb,this._handRightPosition.getValue=function(){return Wi.ZERO},this._handRightOrientation=new ob,this._handRightOrientation.getValue=function(){return en.IDENTITY},this._aimLeftPosition=new hb,this._aimLeftPosition.getValue=function(){return Wi.ZERO},this._aimLeftOrientation=new ob,this._aimLeftOrientation.getValue=function(){return en.IDENTITY},this._aimRightPosition=new hb,this._aimRightPosition.getValue=function(){return Wi.ZERO},this._aimRightOrientation=new ob,this._aimRightOrientation.getValue=function(){return en.IDENTITY}},n(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:"gripLeft",get:function(){return this._gripLeft}},{key:"gripRight",get:function(){return this._gripRight}},{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}},{key:"deviceId",get:function(){return this._deviceId}},{key:"connected",get:function(){return this._connected}}]),t}();ub.all=[],ub.xr=null,ub._eventTarget=new Uu;var cb=function(){function t(){this._eventTarget=new Uu,this._buttonNorth=void 0,this._buttonEast=void 0,this._buttonWest=void 0,this._buttonSouth=void 0,this._buttonTriggerLeft=void 0,this._buttonTriggerRight=void 0,this._triggerLeft=void 0,this._triggerRight=void 0,this._gripLeft=void 0,this._gripRight=void 0,this._leftStick=void 0,this._rightStick=void 0,this._buttonLeftStick=void 0,this._buttonRightStick=void 0,this._buttonOptions=void 0,this._buttonStart=void 0,this._handLeftPosition=void 0,this._handLeftOrientation=void 0,this._handRightPosition=void 0,this._handRightOrientation=void 0,this._aimLeftPosition=void 0,this._aimLeftOrientation=void 0,this._aimRightPosition=void 0,this._aimRightOrientation=void 0,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 rb,this._buttonNorth.getValue=function(){return 0},this._buttonEast=new rb,this._buttonEast.getValue=function(){return 0},this._buttonWest=new rb,this._buttonWest.getValue=function(){return 0},this._buttonSouth=new rb,this._buttonSouth.getValue=function(){return 0},this._buttonTriggerLeft=new rb,this._buttonTriggerLeft.getValue=function(){return 0},this._buttonTriggerRight=new rb,this._buttonTriggerRight.getValue=function(){return 0},this._triggerLeft=new rb,this._triggerLeft.getValue=function(){return 0},this._triggerRight=new rb,this._triggerRight.getValue=function(){return 0},this._gripLeft=new rb,this._gripLeft.getValue=function(){return 0},this._gripRight=new rb,this._gripRight.getValue=function(){return 0},this._buttonLeftStick=new rb,this._buttonLeftStick.getValue=function(){return 0};var t=new rb;t.getValue=function(){return 0};var e=new rb;e.getValue=function(){return 0};var i=new rb;i.getValue=function(){return 0};var n=new rb;n.getValue=function(){return 0},this._leftStick=new ab({up:t,down:e,left:i,right:n}),this._buttonRightStick=new rb,this._buttonRightStick.getValue=function(){return 0};var r=new rb;r.getValue=function(){return 0};var s=new rb;s.getValue=function(){return 0};var a=new rb;a.getValue=function(){return 0};var o=new rb;o.getValue=function(){return 0},this._rightStick=new ab({up:r,down:s,left:a,right:o}),this._buttonOptions=new rb,this._buttonOptions.getValue=function(){return 0},this._buttonStart=new rb,this._buttonStart.getValue=function(){return 0},this._handLeftPosition=new hb,this._handLeftPosition.getValue=function(){return Wi.ZERO},this._handLeftOrientation=new ob,this._handLeftOrientation.getValue=function(){return en.IDENTITY},this._handRightPosition=new hb,this._handRightPosition.getValue=function(){return Wi.ZERO},this._handRightOrientation=new ob,this._handRightOrientation.getValue=function(){return en.IDENTITY},this._aimLeftPosition=new hb,this._aimLeftPosition.getValue=function(){return Wi.ZERO},this._aimLeftOrientation=new ob,this._aimLeftOrientation.getValue=function(){return en.IDENTITY},this._aimRightPosition=new hb,this._aimRightPosition.getValue=function(){return Wi.ZERO},this._aimRightOrientation=new ob,this._aimRightOrientation.getValue=function(){return en.IDENTITY}},n(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:"buttonOptions",get:function(){return this._buttonOptions}},{key:"buttonStart",get:function(){return this._buttonStart}},{key:"handLeftPosition",get:function(){return this._handLeftPosition}},{key:"handLeftOrientation",get:function(){return this._handLeftOrientation}},{key:"handRightPosition",get:function(){return this._handRightPosition}},{key:"handRightOrientation",get:function(){return this._handRightOrientation}},{key:"aimLeftPosition",get:function(){return this._aimLeftPosition}},{key:"aimLeftOrientation",get:function(){return this._aimLeftOrientation}},{key:"aimRightPosition",get:function(){return this._aimRightPosition}},{key:"aimRightOrientation",get:function(){return this._aimRightOrientation}}]),t}(),lb=function(){function t(){this._eventTarget=new Uu,this._viewLeftPosition=void 0,this._viewLeftOrientation=void 0,this._viewRightPosition=void 0,this._viewRightOrientation=void 0,this._headMiddlePosition=void 0,this._headMiddleOrientation=void 0,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 hb,this._viewLeftPosition.getValue=function(){return Wi.ZERO},this._viewLeftOrientation=new ob,this._viewLeftOrientation.getValue=function(){return en.IDENTITY},this._viewRightPosition=new hb,this._viewRightPosition.getValue=function(){return Wi.ZERO},this._viewRightOrientation=new ob,this._viewRightOrientation.getValue=function(){return en.IDENTITY},this._headMiddlePosition=new hb,this._headMiddlePosition.getValue=function(){return Wi.ZERO},this._headMiddleOrientation=new ob,this._headMiddleOrientation.getValue=function(){return en.IDENTITY}},n(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}(),_b=function(){function t(){this._eventTarget=new Uu,this._handheldPosition=void 0,this._handheldOrientation=void 0,this._initInputSource()}var e=t.prototype;return e._on=function(t,e,i){this._eventTarget.on(t,e,i)},e._initInputSource=function(){this._handheldPosition=new hb,this._handheldPosition.getValue=function(){return Wi.ZERO},this._handheldOrientation=new ob,this._handheldOrientation.getValue=function(){return en.IDENTITY}},n(t,[{key:"handheldPosition",get:function(){return this._handheldPosition}},{key:"handheldOrientation",get:function(){return this._handheldOrientation}}]),t}(),fb={Backspace:WC.BACKSPACE,Tab:WC.TAB,Enter:WC.ENTER,ShiftLeft:WC.SHIFT_LEFT,ControlLeft:WC.CTRL_LEFT,AltLeft:WC.ALT_LEFT,ShiftRight:WC.SHIFT_RIGHT,ControlRight:WC.CTRL_RIGHT,AltRight:WC.ALT_RIGHT,Pause:WC.PAUSE,CapsLock:WC.CAPS_LOCK,Escape:WC.ESCAPE,Space:WC.SPACE,PageUp:WC.PAGE_UP,PageDown:WC.PAGE_DOWN,End:WC.END,Home:WC.HOME,ArrowLeft:WC.ARROW_LEFT,ArrowUp:WC.ARROW_UP,ArrowRight:WC.ARROW_RIGHT,ArrowDown:WC.ARROW_DOWN,Insert:WC.INSERT,Delete:WC.DELETE,Digit0:WC.DIGIT_0,Digit1:WC.DIGIT_1,Digit2:WC.DIGIT_2,Digit3:WC.DIGIT_3,Digit4:WC.DIGIT_4,Digit5:WC.DIGIT_5,Digit6:WC.DIGIT_6,Digit7:WC.DIGIT_7,Digit8:WC.DIGIT_8,Digit9:WC.DIGIT_9,KeyA:WC.KEY_A,KeyB:WC.KEY_B,KeyC:WC.KEY_C,KeyD:WC.KEY_D,KeyE:WC.KEY_E,KeyF:WC.KEY_F,KeyG:WC.KEY_G,KeyH:WC.KEY_H,KeyI:WC.KEY_I,KeyJ:WC.KEY_J,KeyK:WC.KEY_K,KeyL:WC.KEY_L,KeyM:WC.KEY_M,KeyN:WC.KEY_N,KeyO:WC.KEY_O,KeyP:WC.KEY_P,KeyQ:WC.KEY_Q,KeyR:WC.KEY_R,KeyS:WC.KEY_S,KeyT:WC.KEY_T,KeyU:WC.KEY_U,KeyV:WC.KEY_V,KeyW:WC.KEY_W,KeyX:WC.KEY_X,KeyY:WC.KEY_Y,KeyZ:WC.KEY_Z,Numpad0:WC.NUM_0,Numpad1:WC.NUM_1,Numpad2:WC.NUM_2,Numpad3:WC.NUM_3,Numpad4:WC.NUM_4,Numpad5:WC.NUM_5,Numpad6:WC.NUM_6,Numpad7:WC.NUM_7,Numpad8:WC.NUM_8,Numpad9:WC.NUM_9,NumpadMultiply:WC.NUM_MULTIPLY,NumpadAdd:WC.NUM_PLUS,NumpadSubtract:WC.NUM_SUBTRACT,NumpadDecimal:WC.NUM_DECIMAL,NumpadDivide:WC.NUM_DIVIDE,NumpadEnter:WC.NUM_ENTER,F1:WC.F1,F2:WC.F2,F3:WC.F3,F4:WC.F4,F5:WC.F5,F6:WC.F6,F7:WC.F7,F8:WC.F8,F9:WC.F9,F10:WC.F10,F11:WC.F11,F12:WC.F12,NumLock:WC.NUM_LOCK,ScrollLock:WC.SCROLL_LOCK,Semicolon:WC.SEMICOLON,Equal:WC.EQUAL,Comma:WC.COMMA,Minus:WC.DASH,Period:WC.PERIOD,Slash:WC.SLASH,Backquote:WC.BACK_QUOTE,BracketLeft:WC.BRACKET_LEFT,Backslash:WC.BACKSLASH,BracketRight:WC.BRACKET_RIGHT,Quote:WC.QUOTE};function db(t){return fb[t]||WC.NONE}var pb,mb,gb=function(){function t(){this._eventTarget=new Uu,this._keyStateMap={},Yu.hasFeature(Wu.EVENT_KEYBOARD)&&this._registerEvent()}var e=t.prototype;return e._registerEvent=function(){var t,e,i,n,r=this;null===(t=Au.wx)||void 0===t||null===(e=t.onKeyDown)||void 0===e||e.call(t,(function(t){var e=db(t.code);if(r._keyStateMap[e]){var i=r._getInputEvent(t,FC.KEY_PRESSING);r._eventTarget.emit(FC.KEY_PRESSING,i)}else{var n=r._getInputEvent(t,FC.KEY_DOWN);r._eventTarget.emit(FC.KEY_DOWN,n)}r._keyStateMap[e]=!0})),null===(i=Au.wx)||void 0===i||null===(n=i.onKeyUp)||void 0===n||n.call(i,(function(t){var e=db(t.code),i=r._getInputEvent(t,FC.KEY_UP);r._keyStateMap[e]=!1,r._eventTarget.emit(FC.KEY_UP,i)}))},e._getInputEvent=function(t,e){var i=db(t.code);return new GC(i,e)},e.on=function(t,e,i){this._eventTarget.on(t,e,i)},t}(),vb=function(){function t(){this._eventTarget=new Uu,this._isPressed=!1,this._preMousePos=new pn,Yu.hasFeature(Wu.EVENT_MOUSE)&&this._registerEvent()}var e=t.prototype;return e._getLocation=function(t){var e=lc.windowSize,i=lc.devicePixelRatio,n=t.x*i,r=e.height-t.y*i;return new pn(n,r)},e._registerEvent=function(){var t,e,i,n,r,s,a,o;null===(t=Au.wx)||void 0===t||null===(e=t.onMouseDown)||void 0===e||e.call(t,this._createCallback(FC.MOUSE_DOWN)),null===(i=Au.wx)||void 0===i||null===(n=i.onMouseMove)||void 0===n||n.call(i,this._createCallback(FC.MOUSE_MOVE)),null===(r=Au.wx)||void 0===r||null===(s=r.onMouseUp)||void 0===s||s.call(r,this._createCallback(FC.MOUSE_UP)),null===(a=Au.wx)||void 0===a||null===(o=a.onWheel)||void 0===o||o.call(a,this._handleMouseWheel.bind(this))},e._createCallback=function(t){var e=this;return function(i){var n=e._getLocation(i),r=i.button;switch(t){case FC.MOUSE_DOWN:e._isPressed=!0;break;case FC.MOUSE_UP:e._isPressed=!1;break;case FC.MOUSE_MOVE:e._isPressed||(r=HC.BUTTON_MISSING)}var s=new HC(t,!1,e._preMousePos);s.setLocation(n.x,n.y),s.setButton(r),s.movementX=n.x-e._preMousePos.x,s.movementY=e._preMousePos.y-n.y,e._preMousePos.set(n.x,n.y),e._eventTarget.emit(t,s)}},e._handleMouseWheel=function(t){var e=FC.MOUSE_WHEEL,i=this._getLocation(t),n=t.button,r=new HC(e,!1,this._preMousePos);r.setLocation(i.x,i.y),r.setButton(n),r.movementX=i.x-this._preMousePos.x,r.movementY=this._preMousePos.y-i.y,r.setScrollData(t.deltaX,-t.deltaY),this._preMousePos.set(i.x,i.y),this._eventTarget.emit(FC.MOUSE_WHEEL,r)},e.on=function(t,e,i){this._eventTarget.on(t,e,i)},t}(),yb=new pn,Eb=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(yb);var i=new qC(yb.x,yb.y,e);return t.getLocation(yb),i.setPoint(yb.x,yb.y),t.getPreviousLocation(yb),i.setPrevPoint(yb),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 qC(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(yb),t.setPrevPoint(yb),t.setPoint(e,i)},e._checkTouchMapSizeMoreThanMax=function(t){var e=this;if(this._touchMap.has(t))return!1;var i=Te.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>Te.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}()),Tb=function(){function t(){this._eventTarget=new Uu,Yu.hasFeature(Wu.INPUT_TOUCH)&&this._registerEvent()}var e=t.prototype;return e._registerEvent=function(){Au.onTouchStart(this._createCallback(FC.TOUCH_START)),Au.onTouchMove(this._createCallback(FC.TOUCH_MOVE)),Au.onTouchEnd(this._createCallback(FC.TOUCH_END)),Au.onTouchCancel(this._createCallback(FC.TOUCH_CANCEL))},e._createCallback=function(t){var e=this;return function(i){for(var n=[],r=lc.windowSize,s=lc.devicePixelRatio,a=i.changedTouches.length,o=0;o<a;++o){var h=i.changedTouches[o],u=h.identifier;if(null!==u){var c=e._getLocation(h,r,s),l=Eb.getTouch(u,c.x,c.y);l&&(t!==FC.TOUCH_END&&t!==FC.TOUCH_CANCEL||Eb.releaseTouch(u),n.push(l))}}if(n.length>0){var _=new VC(n,!1,t,Te.ENABLE_MULTI_TOUCH?Eb.getAllTouches():n);e._eventTarget.emit(t,_)}}},e._getLocation=function(t,e,i){var n=t.clientX*i,r=e.height-t.clientY*i;return new pn(n,r)},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"}(mb||(mb={}));var Sb=function(){function t(t){this.priority=mb.GLOBAL,this._inputEventTarget=void 0,this._inputEventTarget=t}return t.prototype.dispatchEvent=function(t){return this._inputEventTarget.emit(t.type,t),!0},t}(),Ab=((pb={})[FC.MOUSE_DOWN]=FC.TOUCH_START,pb[FC.MOUSE_MOVE]=FC.TOUCH_MOVE,pb[FC.MOUSE_UP]=FC.TOUCH_END,pb),Rb=t("Input",function(){function t(){this._dispatchImmediately=!0,this._eventTarget=new Uu,this._touchInput=new Tb,this._mouseInput=new vb,this._keyboardInput=new gb,this._accelerometerInput=new QC,this._handleInput=new cb,this._hmdInput=new lb,this._handheldInput=new _b,this._eventTouchList=[],this._eventMouseList=[],this._eventKeyboardList=[],this._eventAccelerationList=[],this._eventGamepadList=[],this._eventHandleList=[],this._eventHMDList=[],this._eventHandheldList=[],this._needSimulateTouchMoveEvent=!1,this._inputEventDispatcher=void 0,this._eventDispatcherList=[],this._registerEvent(),this._inputEventDispatcher=new Sb(this._eventTarget),this._registerEventDispatcher(this._inputEventDispatcher),ub._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=Ab[t.type],i=Eb.getTouch(0,t.getLocationX(),t.getLocationY());if(i){var n=[i],r=new VC(n,!1,e,e===FC.TOUCH_END?[]:n);r.windowId=t.windowId,e===FC.TOUCH_END&&Eb.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;++i){var n=this._eventDispatcherList[i];try{if(!n.dispatchEvent(t))break}catch(e){console.error("Error occurs in an event listener: "+t.type),console.error(e)}}},e._registerEvent=function(){var t=this;if(dc.hasFeature(dc.Feature.INPUT_TOUCH)){var e=this._eventTouchList;this._touchInput.on(FC.TOUCH_START,(function(i){t._dispatchOrPushEventTouch(i,e)})),this._touchInput.on(FC.TOUCH_MOVE,(function(i){t._dispatchOrPushEventTouch(i,e)})),this._touchInput.on(FC.TOUCH_END,(function(i){t._dispatchOrPushEventTouch(i,e)})),this._touchInput.on(FC.TOUCH_CANCEL,(function(i){t._dispatchOrPushEventTouch(i,e)}))}if(dc.hasFeature(dc.Feature.EVENT_MOUSE)){var i=this._eventMouseList;this._mouseInput.on(FC.MOUSE_DOWN,(function(e){t._needSimulateTouchMoveEvent=!0,t._simulateEventTouch(e),t._dispatchOrPushEvent(e,i)})),this._mouseInput.on(FC.MOUSE_MOVE,(function(e){t._needSimulateTouchMoveEvent&&t._simulateEventTouch(e),t._dispatchOrPushEvent(e,i)})),this._mouseInput.on(FC.MOUSE_UP,(function(e){t._needSimulateTouchMoveEvent=!1,t._simulateEventTouch(e),t._dispatchOrPushEvent(e,i)})),this._mouseInput.on(FC.MOUSE_WHEEL,(function(e){t._dispatchOrPushEvent(e,i)}))}if(dc.hasFeature(dc.Feature.EVENT_KEYBOARD)){var n=this._eventKeyboardList;this._keyboardInput.on(FC.KEY_DOWN,(function(e){t._dispatchOrPushEvent(e,n)})),this._keyboardInput.on(FC.KEY_PRESSING,(function(e){t._dispatchOrPushEvent(e,n)})),this._keyboardInput.on(FC.KEY_UP,(function(e){t._dispatchOrPushEvent(e,n)}))}if(dc.hasFeature(dc.Feature.EVENT_ACCELEROMETER)){var r=this._eventAccelerationList;this._accelerometerInput.on(FC.DEVICEMOTION,(function(e){t._dispatchOrPushEvent(e,r)}))}if(dc.hasFeature(dc.Feature.EVENT_GAMEPAD)){var s=this._eventGamepadList;ub._on(FC.GAMEPAD_CHANGE,(function(e){t._dispatchOrPushEvent(e,s)})),ub._on(FC.GAMEPAD_INPUT,(function(e){t._dispatchOrPushEvent(e,s)})),ub._on(FC.HANDLE_POSE_INPUT,(function(e){t._dispatchOrPushEvent(e,s)}))}if(dc.hasFeature(dc.Feature.EVENT_HANDLE)){var a=this._eventHandleList;this._handleInput._on(FC.HANDLE_INPUT,(function(e){t._dispatchOrPushEvent(e,a)})),this._handleInput._on(FC.HANDLE_POSE_INPUT,(function(e){t._dispatchOrPushEvent(e,a)}))}if(dc.hasFeature(dc.Feature.EVENT_HMD)){var o=this._eventHMDList;this._hmdInput._on(FC.HMD_POSE_INPUT,(function(e){t._dispatchOrPushEvent(e,o)}))}if(dc.hasFeature(dc.Feature.EVENT_HANDHELD)){var h=this._eventHandheldList;this._handheldInput._on(FC.HANDHELD_POSE_INPUT,(function(e){t._dispatchOrPushEvent(e,h)}))}},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._eventHMDList,e=0,i=t.length;e<i;++e){var n=t[e];this._emitEvent(n)}for(var r=this._eventHandheldList,s=0,a=r.length;s<a;++s){var o=r[s];this._emitEvent(o)}for(var h=this._eventMouseList,u=0,c=h.length;u<c;++u){var l=h[u];this._emitEvent(l)}for(var _=this._eventTouchList,f=0,d=_.length;f<d;++f)for(var p=_[f],m=p.getTouches(),g=m.length,v=0;v<g;++v)p.touch=m[v],p.propagationStopped=p.propagationImmediateStopped=!1,this._emitEvent(p);for(var y=this._eventKeyboardList,E=0,T=y.length;E<T;++E){var S=y[E];this._emitEvent(S)}for(var A=this._eventAccelerationList,R=0,C=A.length;R<C;++R){var b=A[R];this._emitEvent(b)}for(var I=this._eventGamepadList,w=0,O=I.length;w<O;++w){var x=I[w];this._emitEvent(x)}for(var N=this._eventHandleList,D=0,M=N.length;D<M;++D){var P=N[D];this._emitEvent(P)}this._clearEvents()},t}());Rb.EventType=FC;var Cb=t("input",new Rb),bb=t("SystemEvent",function(t){function e(){var e;return e=t.call(this)||this,Cb.on(FC.MOUSE_DOWN,(function(t){e.emit(BC.MOUSE_DOWN,t)})),Cb.on(FC.MOUSE_MOVE,(function(t){e.emit(BC.MOUSE_MOVE,t)})),Cb.on(FC.MOUSE_UP,(function(t){e.emit(BC.MOUSE_UP,t)})),Cb.on(FC.MOUSE_WHEEL,(function(t){e.emit(BC.MOUSE_WHEEL,t)})),Cb.on(FC.TOUCH_START,(function(t){e.emit(BC.TOUCH_START,t.touch,t)})),Cb.on(FC.TOUCH_MOVE,(function(t){e.emit(BC.TOUCH_MOVE,t.touch,t)})),Cb.on(FC.TOUCH_END,(function(t){e.emit(BC.TOUCH_END,t.touch,t)})),Cb.on(FC.TOUCH_CANCEL,(function(t){e.emit(BC.TOUCH_CANCEL,t.touch,t)})),Cb.on(FC.KEY_DOWN,(function(t){e.emit(BC.KEY_DOWN,t)})),Cb.on(FC.KEY_PRESSING,(function(t){e.emit(BC.KEY_DOWN,t)})),Cb.on(FC.KEY_UP,(function(t){e.emit(BC.KEY_UP,t)})),Cb.on(FC.DEVICEMOTION,(function(t){e.emit(BC.DEVICEMOTION,t)})),e}s(e,t);var i=e.prototype;return i.setAccelerometerEnabled=function(t){Cb.setAccelerometerEnabled(t)},i.setAccelerometerInterval=function(t){Cb.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}(Uu));bb.EventType=BC,g.SystemEvent=bb;var Ib,wb,Ob,xb,Nb,Db,Mb,Pb,Lb=t("systemEvent",new bb);g.systemEvent=Lb,it(BC,"Node.EventType",[{name:"POSITION_PART",newName:"TRANSFORM_CHANGED"},{name:"ROTATION_PART",newName:"TRANSFORM_CHANGED"},{name:"SCALE_PART",newName:"TRANSFORM_CHANGED"}]),it(UC,"Event",[{name:"ACCELERATION",newName:"DEVICEMOTION",target:bb.EventType,targetName:"SystemEvent.EventType"}]),rt(UC,"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"}]),it(HC,"EventMouse",["DOWN","UP","MOVE"].map((function(t){return{name:t,newName:"MOUSE_"+t,target:bb.EventType,targetName:"SystemEvent.EventType"}}))),it(HC,"EventMouse",[{name:"SCROLL",newName:"MOUSE_WHEEL",target:bb.EventType,targetName:"SystemEvent.EventType"}]),rt(HC.prototype,"EventMouse.prototype",[{name:"eventType",suggest:"please use EventMouse.prototype.type instead"}]),it(VC,"EventTouch",[{name:"BEGAN",newName:"TOUCH_START",target:bb.EventType,targetName:"SystemEvent.EventType"}]),it(VC,"EventTouch",[{name:"MOVED",newName:"TOUCH_MOVE",target:bb.EventType,targetName:"SystemEvent.EventType"}]),it(VC,"EventTouch",[{name:"ENDED",newName:"TOUCH_END",target:bb.EventType,targetName:"SystemEvent.EventType"}]),it(VC,"EventTouch",[{name:"CANCELLED",newName:"TOUCH_CANCEL",target:bb.EventType,targetName:"SystemEvent.EventType"}]),rt(VC.prototype,"EventTouch.prototype",[{name:"getEventCode",suggest:"please use EventTouch.prototype.type instead"}]),it(VC.prototype,"EventTouch.prototype",[{name:"getUILocationInView",newName:"getLocationInView",target:VC,targetName:"EventTouch"}]),rt(Te.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}}))),rt(Te.KEY,"macro.KEY",[{name:"shift",suggest:"please use KeyCode.SHIFT_LEFT instead"}]),rt(Te.KEY,"macro.KEY",[{name:"ctrl",suggest:"please use KeyCode.CTRL_LEFT instead"}]),rt(Te.KEY,"macro.KEY",[{name:"alt",suggest:"please use KeyCode.ALT_LEFT instead"}]),rt(Te,"macro",[{name:"KEY",suggest:"please use KeyCode instead"}]),function(t){t[t.VERTICAL=0]="VERTICAL",t[t.HORIZONTAL=1]="HORIZONTAL"}(Ib||(Ib={})),function(t){t[t.ORTHO=0]="ORTHO",t[t.PERSPECTIVE=1]="PERSPECTIVE"}(wb||(wb={})),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"}(Ob||(Ob={})),function(t){t[t.ISO100=0]="ISO100",t[t.ISO200=1]="ISO200",t[t.ISO400=2]="ISO400",t[t.ISO800=3]="ISO800"}(xb||(xb={})),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"}(Nb||(Nb={})),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"}(Db||(Db={})),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"}(Mb||(Mb={})),function(t){t[t.EDITOR=0]="EDITOR",t[t.GAME_VIEW=1]="GAME_VIEW",t[t.SCENE_VIEW=2]="SCENE_VIEW",t[t.PREVIEW=3]="PREVIEW",t[t.GAME=100]="GAME"}(Pb||(Pb={}));var Bb=[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],Fb=[1,.5,1/4,1/8,1/15,1/30,1/60,.008,.004,.002,.001,5e-4,1/4e3],Ub=[100,200,400,800],kb=new Wi,Gb=new Wi,Hb=new cn,zb=_l.STENCIL<<1,Vb=[],Wb=function(){function t(t){if(this.isWindowSize=!0,this.screenScale=void 0,this.postProcess=null,this.usePostProcess=!1,this.pipeline="",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=Ib.VERTICAL,this._fov=Ri(45),this._nearClip=1,this._farClip=1e3,this._clearColor=new Ol(.2,.2,.2,1),this._viewport=new En(0,0,1,1),this._orientedViewport=new En(0,0,1,1),this._curTransform=wc.IDENTITY,this._isProjDirty=!0,this._matView=new cn,this._matProj=new cn,this._matProjInv=new cn,this._matViewProj=new cn,this._matViewProjInv=new cn,this._frustum=new as,this._forward=new Wi,this._position=new Wi,this._priority=0,this._aperture=Ob.F16_0,this._apertureValue=void 0,this._shutter=Nb.D125,this._shutterValue=0,this._iso=xb.ISO100,this._isoValue=0,this._window=null,this._width=1,this._height=1,this._clearFlag=_l.NONE,this._clearDepth=1,this._visibility=yv,this._exposure=0,this._clearStencil=0,this._geometryRenderer=null,this._windowId=0,this._cameraType=Db.DEFAULT,this._trackingType=Mb.NO_TRACKING,this._usage=Pb.GAME,this._device=t,this._apertureValue=Bb[this._aperture],this._shutterValue=Fb[this._shutter],this._isoValue=Ub[this._iso],this._aspect=this.screenScale=1,this._frustum.accurate=!0,!Vb.length){var e=t.capabilities.clipSpaceSignY;Vb[wc.IDENTITY]=new cn(1,0,0,0,0,e),Vb[wc.ROTATE_90]=new cn(0,1,0,0,-e,0),Vb[wc.ROTATE_180]=new cn(-1,0,0,0,0,-e),Vb[wc.ROTATE_270]=new cn(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||wc.IDENTITY)%2&&(this._aspect=1/this._aspect)}this._isProjDirty=!0},e.initialize=function(t){void 0!==t.usage?this._usage=t.usage:this.setDefaultUsage(),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=_l.NONE,this.clearDepth=1,this.visibility=yv,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._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,n=globalThis.__globalXR;if(n&&n.isWebXR&&n.webXRWindowMap&&n.updateViewport){var r=n.webXRMatProjs?1/n.webXRMatProjs.length:1,s=n.webXRWindowMap.get(this._window);this.setViewportInOrientedSpace(new En(r*s,0,r,1))}(this._node.hasChangedFlags||t)&&(cn.invert(this._matView,this._node.worldMatrix),this._forward.x=-this._matView.m02,this._forward.y=-this._matView.m06,this._forward.z=-this._matView.m10,cn.multiply(this._matView,(new cn).scale(this._node.worldScale),this._matView),this._node.getWorldPosition(this._position),i=!0);var a=null===(e=this.window)||void 0===e?void 0:e.swapchain,o=a&&a.surfaceTransform||wc.IDENTITY;if(this._isProjDirty||this._curTransform!==o){this._curTransform=o;var h=this._device.capabilities.clipSpaceSignY;if(this._proj===wb.PERSPECTIVE)if(n&&n.isWebXR&&n.webXRWindowMap&&n.webXRMatProjs){var u=n.webXRWindowMap.get(this._window);this._matProj.set(n.webXRMatProjs[u])}else cn.perspective(this._matProj,this._fov,this._aspect,this._nearClip,this._farClip,this._fovAxis===Ib.VERTICAL,this._device.capabilities.clipSpaceMinZ,h,o);else{var c=this._orthoHeight*this._aspect,l=this._orthoHeight;cn.ortho(this._matProj,-c,c,-l,l,this._nearClip,this._farClip,this._device.capabilities.clipSpaceMinZ,h,o)}cn.invert(this._matProjInv,this._matProj),i=!0,this._isProjDirty=!1}i&&(cn.multiply(this._matViewProj,this._matProj,this._matView),cn.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||wc.IDENTITY){case wc.ROTATE_90:this._viewport.x=1-s-r,this._viewport.y=i,this._viewport.width=r,this._viewport.height=n;break;case wc.ROTATE_180:this._viewport.x=1-i-n,this._viewport.y=1-s-r,this._viewport.width=n,this._viewport.height=r;break;case wc.ROTATE_270:this._viewport.x=s,this._viewport.y=1-i-n,this._viewport.width=r,this._viewport.height=n;break;case wc.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=g.internal.GeometryRenderer?new g.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||g.director.root.mainWindow;if(e){e.attachCamera(this),this.window=e;var i=e.swapchain;(i&&i.surfaceTransform||wc.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,h=this._orientedViewport.height*r,u=this._proj===wb.PERSPECTIVE,c=this._device.capabilities.clipSpaceSignY,l=un[this._curTransform];Wi.set(kb,(e-s)/o*2-1,(i-a)/h*2-1,u?1:-1);var _=kb.x,f=kb.y;return kb.x=_*l[0]+f*l[2]*c,kb.y=_*l[1]+f*l[3]*c,Wi.transformMat4(u?kb:t.o,kb,this._matViewProjInv),u?(this._node.getWorldPosition(Gb),kn.fromPoints(t,Gb,kb)):Wi.transformQuat(t.d,Wi.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,h=this._device.capabilities.clipSpaceSignY,u=un[this._curTransform];if(this._proj===wb.PERSPECTIVE){Wi.set(t,(e.x-r)/a*2-1,(e.y-s)/o*2-1,1);var c=t.x,l=t.y;t.x=c*u[0]+l*u[2]*h,t.y=c*u[1]+l*u[3]*h,Wi.transformMat4(t,t,this._matViewProjInv),this._node&&this._node.getWorldPosition(kb),Wi.lerp(t,kb,t,Ai(this._nearClip/this._farClip,1,e.z))}else{Wi.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=_*u[0]+f*u[2]*h,t.y=_*u[1]+f*u[3]*h,Wi.transformMat4(t,t,this._matViewProjInv)}return t},e.worldToScreen=function(t,e){var i=this._device.capabilities.clipSpaceSignY,n=un[this._curTransform];Wi.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,h=this._orientedViewport.x*a,u=this._orientedViewport.y*o,c=this._orientedViewport.width*a,l=this._orientedViewport.height*o;return t.x=h+.5*(t.x+1)*c,t.y=u+.5*(t.y+1)*l,t.z=.5*t.z+.5,t},e.worldMatrixToScreen=function(t,e,i,n){cn.multiply(t,this._matViewProj,e),cn.multiply(t,Vb[this._curTransform],t);var r=i/2,s=n/2;return cn.identity(Hb),cn.transform(Hb,Hb,Wi.set(kb,r,s,0)),cn.scale(Hb,Hb,Wi.set(kb,r,s,1)),cn.multiply(t,Hb,t),t},e.calculateObliqueMat=function(t){var e=new ki(Math.sign(t.x),Math.sign(t.y),1,1).transformMat4(this._matProjInv),i=new ki(this._matProj.m03,this._matProj.m07,this._matProj.m11,this._matProj.m15),n=2/ki.dot(t,e),r=t.multiplyScalar(n).subtract(i);this._matProj.m02=r.x,this._matProj.m06=r.y,this._matProj.m10=r.z,this._matProj.m14=r.w},e.getClipSpaceMinz=function(){return this._device.capabilities.clipSpaceMinZ},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)},e.setDefaultUsage=function(){this._usage=Pb.GAME},n(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:"systemWindowId",get:function(){return this._windowId}},{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=Bb[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=Fb[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=Ub[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:"cameraUsage",get:function(){return this._usage},set:function(t){this._usage=t}}],[{key:"standardExposureValue",get:function(){return 1/38400}},{key:"standardLightMeterScale",get:function(){return 1e4}}]),t}(),Xb=new Wi,jb=Qn.create(0,0,0,1),Yb=new $r(0,0,0,.5,.5,.5),Kb=new $r,qb=new ou((function(){return{model:null,depth:0}}),128);function Qb(t,e){var i=0;t.node&&(Wi.subtract(Xb,t.node.worldPosition,e.position),i=Wi.dot(Xb,e.forward));var n=qb.alloc();return n.model=t,n.depth=i,n}function Zb(t,e){var i=t.pipelineSceneData,n=i.validPunctualLights;n.length=0;for(var r=e.scene.spotLights,s=0;s<r.length;s++){var a=r[s];a.baked&&!e.node.scene.globals.disableLightmap||(Qn.set(jb,a.position.x,a.position.y,a.position.z,a.range),Gr.sphereFrustum(jb,e.frustum)&&n.push(a))}for(var o=e.scene.sphereLights,h=0;h<o.length;h++){var u=o[h];u.baked&&!e.node.scene.globals.disableLightmap||(Qn.set(jb,u.position.x,u.position.y,u.position.z,u.range),Gr.sphereFrustum(jb,e.frustum)&&n.push(u))}for(var c=e.scene.pointLights,l=0;l<c.length;l++){var _=c[l];_.baked||(Qn.set(jb,_.position.x,_.position.y,_.position.z,_.range),Gr.sphereFrustum(jb,e.frustum)&&n.push(_))}for(var f=e.scene.rangedDirLights,d=0;d<f.length;d++){var p=f[d];$r.transform(Kb,Yb,p.node.getWorldMatrix()),Gr.aabbFrustum(Kb,e.frustum)&&n.push(p)}i.validPunctualLights=n}function Jb(t,e){var i=e.scene,n=i.mainLight,r=t.pipelineSceneData,s=r.shadows,a=r.skybox,o=r.csmLayers,h=r.renderObjects;qb.freeArray(h),h.length=0;var u=o.castShadowObjects;u.length=0;var c=o.layerObjects;c.clear(),s.enabled&&(t.pipelineUBO.updateShadowUBORange(ng.SHADOW_COLOR_OFFSET,s.shadowColor),s.type===$E.ShadowMap&&n&&n.node&&o.update(r,e)),e.clearFlag&zb&&(a.enabled&&a.model?h.push(Qb(a.model,e)):e.cameraUsage!==Pb.EDITOR&&e.cameraUsage!==Pb.SCENE_VIEW&&g.warnID(15100,e.name));var l=i.models,_=e.visibility;function f(t){if(t.enabled){if(i.isCulledByLod(e,t))return;if(t.castShadow&&(u.push(Qb(t,e)),c.push(Qb(t,e))),t.node&&(_&t.node.layer)===t.node.layer||_&t.visFlags){if(t.worldBounds&&!Gr.aabbFrustum(t.worldBounds,e.frustum))return;h.push(Qb(t,e))}}}for(var d=0;d<l.length;d++)f(l[d])}var $b,tI=new c_(null),eI=function(){function t(){this._device=null,this._passes=null,this._shaders=null,this._subMesh=null,this._patches=null,this._priority=Gm.DEFAULT,this._inputAssembler=null,this._descriptorSet=null,this._worldBoundDescriptorSet=null,this._reflectionTex=null,this._reflectionSampler=null,this._instancedAttributeBlock={buffer:null,views:[],attributes:[]},this._instancedWorldMatrixIndex=-1,this._instancedSHIndex=-1,this._useReflectionProbeType=0}var e=t.prototype;return e.initialize=function(t,e,i){void 0===i&&(i=null);var n=g.director.root;this._device=_f.gfxDevice,tI.layout=e[0].localSetLayout,this._inputAssembler=this._device.createInputAssembler(t.iaInfo),this._descriptorSet=this._device.createDescriptorSet(tI);var r=g.director.root.pipeline.pipelineSceneData.getOcclusionQueryPass();if(r){var s=new c_(null);s.layout=r.localSetLayout,this._worldBoundDescriptorSet=this._device.createDescriptorSet(s)}this._subMesh=t,this._patches=i?i.sort():null,this._passes=e,this._flushPassInfo(),this.priority=Gm.DEFAULT;var a=g.rendering;if((!a||!a.enableEffectImport)&&e[0].phase===wE("reflection")||Rv()&&e[0].phaseID===a.getPhaseID(a.getPassID("default"),"reflection")){var o=n.mainWindow.width,h=n.mainWindow.height,u=512;h<o?(o=u*o/h,h=u):h=u*h/(o=u),this._reflectionTex=this._device.createTexture(new Ul(Fc.TEX2D,Uc.STORAGE|Uc.TRANSFER_SRC|Uc.SAMPLED,xc.RGBA8,o,h)),this.descriptorSet.bindTexture(Jg,this._reflectionTex),this._reflectionSampler=this._device.getSampler(new Gl(Vc.LINEAR,Vc.LINEAR,Vc.NONE,Wc.CLAMP,Wc.CLAMP,Wc.CLAMP)),this.descriptorSet.bindSampler(Jg,this._reflectionSampler),this.descriptorSet.bindTexture(ev,this._reflectionTex)}},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=Gm.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){if((t||this._patches)&&(!t||(t=t.sort(),!this._patches||t.length!==this._patches.length||JSON.stringify(t)!==JSON.stringify(this._patches)))){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.updateInstancedSH=function(t,e){for(var i=this.instancedAttributeBlock.views,n=(xg.SH_QUADRATIC_R_OFFSET-xg.SH_LINEAR_CONST_R_OFFSET)/4,r=0,s=e;s<e+n;s++)for(var a=0;a<4;a++)i[s][a]=t[r++]},e.UpdateInstancedAttributes=function(t){this.instancedWorldMatrixIndex=-1,this.instancedSHIndex=-1;var e=this.passes[0];if(e.device.hasFeature(Oc.INSTANCED_ARRAYS)){for(var i=0,n=0;n<t.length;n++){var r=t[n];r.isInstanced&&(i+=T_[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 h=t[o];if(h.isInstanced){var u=new Ql;u.format=h.format,u.name=h.name,u.isNormalized=h.isNormalized,u.location=h.location,s.attributes.push(u);var c=T_[h.format],l=new(x_(c))(s.buffer.buffer,a,c.count);s.views.push(l),a+=c.size}}e.batchingScheme===CE.INSTANCING&&e.getInstancedBuffer().destroy(),this.instancedWorldMatrixIndex=this.getInstancedAttributeIndex(yg),this.instancedSHIndex=this.getInstancedAttributeIndex(Eg)}},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)}},n(t,[{key:"passes",get:function(){return this._passes},set:function(t){t.length>8?K(12004,8):(this._passes=t,this._flushPassInfo(),this._descriptorSet&&(this._descriptorSet.destroy(),tI.layout=t[0].localSetLayout,this._descriptorSet=this._device.createDescriptorSet(tI)))}},{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._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:"instancedAttributeBlock",get:function(){return this._instancedAttributeBlock}},{key:"instancedWorldMatrixIndex",get:function(){return this._instancedWorldMatrixIndex},set:function(t){this._instancedWorldMatrixIndex=t}},{key:"instancedSHIndex",get:function(){return this._instancedSHIndex},set:function(t){this._instancedSHIndex=t}},{key:"useReflectionProbeType",get:function(){return this._useReflectionProbeType},set:function(t){this._useReflectionProbeType=t}}]),t}(),iI=new $l;iI.format=xc.RGBA8;var nI=new t_;nI.format=xc.DEPTH_STENCIL;var rI,sI,aI=new n_([iI],nI),oI={width:1,height:1,renderPassInfo:aI},hI=t("RenderTexture",bs("cc.RenderTexture")($b=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}s(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=g.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(Ti(t,1,2048)),this._height=Math.floor(Ti(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=g.director.root;oI.title=this._name,oI.width=this._width,oI.height=this._height,oI.renderPassInfo=t&&t.passInfo?t.passInfo:aI,oI.externalResLow=t&&t.externalResLow?t.externalResLow:0,oI.externalResHigh=t&&t.externalResHigh?t.externalResHigh:0,oI.externalFlag=t&&t.externalFlag?t.externalFlag:kc.NONE,iI.barrier=_f.gfxDevice.getGeneralBarrier(new r_($c.FRAGMENT_SHADER_READ_TEXTURE,$c.FRAGMENT_SHADER_READ_TEXTURE)),this._window?(this._window.destroy(),this._window.initialize(_f.gfxDevice,oI)):this._window=e.createWindow(oI)},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(),h=[],u=[],c=new Il;return c.texOffset.x=t,c.texOffset.y=e,c.texExtent.width=i,c.texExtent.height=n,u.push(c),h.push(r),null==o||o.copyTextureToBuffers(s,h,u),r},n(e,[{key:"window",get:function(){return this._window}}]),e}(yd))||$b);g.RenderTexture=hI,function(t){t[t.SKYBOX=zb|_l.DEPTH_STENCIL]="SKYBOX",t[t.SOLID_COLOR=_l.ALL]="SOLID_COLOR"}(rI||(rI={})),function(t){t[t.CUBE=0]="CUBE",t[t.PLANAR=1]="PLANAR"}(sI||(sI={}));var uI,cI=[new Wi(0,-90,0),new Wi(0,90,0),new Wi(90,0,0),new Wi(-90,0,0),new Wi(0,0,0),new Wi(0,180,0)],lI=function(){function t(t){this.bakedCubeTextures=[],this.realtimePlanarTexture=null,this._resolution=256,this._clearFlag=rI.SKYBOX,this._backgroundColor=new qi(0,0,0,255),this._visibility=yv,this._probeType=sI.CUBE,this._cubemap=null,this._size=new Wi(1,1,1),this._camera=null,this._probeId=0,this._needRefresh=!1,this._needRender=!1,this._node=null,this._cameraNode=null,this._boundingBox=null,this._cameraWorldPos=new Wi,this._cameraWorldRotation=new en,this._forward=new Wi,this._up=new Wi,this._previewSphere=null,this._previewPlane=null,this._probeId=t}var e=t.prototype;return e.initialize=function(t,e){this._node=t,this._cameraNode=e;var i=this.node.getWorldPosition();this._boundingBox=$r.create(i.x,i.y,i.z,this._size.x,this._size.y,this._size.z),this._createCamera(e)},e.initBakedTextures=function(){if(0===this.bakedCubeTextures.length)for(var t=0;t<6;t++){var e=this._createTargetTexture(this._resolution,this._resolution);this.bakedCubeTextures.push(e)}},e.captureCubemap=function(){this.initBakedTextures(),this._resetCameraParams(),this._needRender=!0},e.renderPlanarReflection=function(t){if(t){if(!this.realtimePlanarTexture){var e=g.view.getDesignResolutionSize();this.realtimePlanarTexture=this._createTargetTexture(e.width,e.height),g.internal.reflectionProbeManager.updatePlanarMap(this,this.realtimePlanarTexture.getGFXTexture())}this._syncCameraParams(t),this._transformReflectionCamera(t),this._needRender=!0}},e.switchProbeType=function(t,e){t===sI.CUBE?this._needRender=!1:null!==e&&this.renderPlanarReflection(e)},e.getProbeId=function(){return this._probeId},e.updateProbeId=function(t){this._probeId=t},e.renderArea=function(){return this._probeType===sI.PLANAR?new pn(this.realtimePlanarTexture.width,this.realtimePlanarTexture.height):new pn(this.resolution,this.resolution)},e.isFinishedRendering=function(){return!0},e.validate=function(){return null!==this.cubemap},e.destroy=function(){this._camera&&(this._camera.destroy(),this._camera=null);for(var t=0;t<this.bakedCubeTextures.length;t++)this.bakedCubeTextures[t].destroy();this.bakedCubeTextures=[],this.realtimePlanarTexture&&(this.realtimePlanarTexture.destroy(),this.realtimePlanarTexture=null)},e.enable=function(){},e.disable=function(){},e.updateCameraDir=function(t){this.cameraNode.setRotationFromEuler(cI[t]),this.camera.update(!0)},e.updateBoundingBox=function(){if(this.node){this.node.updateWorldTransform();var t=this.node.getWorldPosition();$r.set(this._boundingBox,t.x,t.y,t.z,this._size.x,this._size.y,this._size.z)}},e.hasFrameBuffer=function(t){if(this.probeType===sI.PLANAR){var e;if(!this.realtimePlanarTexture)return!1;if((null===(e=this.realtimePlanarTexture.window)||void 0===e?void 0:e.framebuffer)===t)return!0}else{if(0===this.bakedCubeTextures.length)return!1;for(var i=0;i<this.bakedCubeTextures.length;i++){var n;if((null===(n=this.bakedCubeTextures[i].window)||void 0===n?void 0:n.framebuffer)===t)return!0}}return!1},e.isRGBE=function(){return!0},e._syncCameraParams=function(t){this.camera.projectionType=t.projectionType,this.camera.orthoHeight=t.orthoHeight,this.camera.nearClip=t.nearClip,this.camera.farClip=t.farClip,this.camera.fov=t.fov,this.camera.visibility=t.visibility,this.camera.clearFlag=t.clearFlag,this.camera.clearColor=t.clearColor,this.camera.priority=t.priority-1,this.camera.resize(t.width,t.height)},e._createCamera=function(t){if(g.director.root,!this._camera){if(this._camera=g.director.root.createCamera(),!this._camera)return null;this._camera.initialize({name:t.name,node:t,projection:wb.PERSPECTIVE,window:g.director.root&&g.director.root.tempWindow,priority:0,cameraType:Db.DEFAULT,trackingType:Mb.NO_TRACKING})}return this._camera.setViewportInOrientedSpace(new En(0,0,1,1)),this._camera.fovAxis=Ib.VERTICAL,this._camera.fov=Ri(90),this._camera.orthoHeight=10,this._camera.nearClip=1,this._camera.farClip=1e3,this._camera.clearColor=this._backgroundColor,this._camera.clearDepth=1,this._camera.clearStencil=0,this._camera.clearFlag=this._clearFlag,this._camera.visibility=this._visibility,this._camera.aperture=Ob.F16_0,this._camera.shutter=Nb.D125,this._camera.iso=xb.ISO100,this._camera},e._resetCameraParams=function(){this.camera.projectionType=wb.PERSPECTIVE,this.camera.orthoHeight=10,this.camera.nearClip=1,this.camera.farClip=1e3,this.camera.fov=Ri(90),this.camera.priority=0,this.camera.resize(this.resolution,this.resolution),this.camera.visibility=this._visibility,this.camera.clearFlag=this._clearFlag,this.camera.clearColor=this._backgroundColor,this.cameraNode.worldPosition=this.node.worldPosition,this.cameraNode.worldRotation=this.node.worldRotation,this.camera.update(!0)},e._createTargetTexture=function(t,e){var i=new hI;return i.reset({width:t,height:e}),i},e._transformReflectionCamera=function(t){var e=Wi.dot(this.node.worldPosition,this.node.up);this._reflect(this._cameraWorldPos,t.node.worldPosition,this.node.up,e),this.cameraNode.worldPosition=this._cameraWorldPos,Wi.transformQuat(this._forward,Wi.FORWARD,t.node.worldRotation),this._reflect(this._forward,this._forward,this.node.up,0),this._forward.normalize(),this._forward.negative(),Wi.transformQuat(this._up,Wi.UP,t.node.worldRotation),this._reflect(this._up,this._up,this.node.up,0),this._up.normalize(),en.fromViewUp(this._cameraWorldRotation,this._forward,this._up),this.cameraNode.worldRotation=this._cameraWorldRotation,this.camera.update(!0);var i=new ki(this.node.up.x,this.node.up.y,this.node.up.z,-Wi.dot(this.node.up,this.node.worldPosition));i.transformMat4(this.camera.matView.clone().invert().transpose()),this.camera.calculateObliqueMat(i)},e._reflect=function(t,e,i,n){var r=Wi.clone(i);r.normalize();var s=Wi.dot(r,e)-n;return r.multiplyScalar(2*s),Wi.subtract(t,e,r),t},n(t,[{key:"probeType",get:function(){return this._probeType},set:function(t){this._probeType=t}},{key:"resolution",get:function(){return this._resolution},set:function(t){t!==this._resolution&&this.bakedCubeTextures.forEach((function(e){e.resize(t,t)})),this._resolution=t}},{key:"clearFlag",get:function(){return this._clearFlag},set:function(t){this._clearFlag=t,this.camera.clearFlag=this._clearFlag}},{key:"backgroundColor",get:function(){return this._backgroundColor},set:function(t){this._backgroundColor=t,this.camera.clearColor=this._backgroundColor}},{key:"visibility",get:function(){return this._visibility},set:function(t){this._visibility=t,this._camera.visibility=this._visibility}},{key:"size",get:function(){return this._size},set:function(t){this._size.set(t);var e=this.node.getWorldPosition();$r.set(this._boundingBox,e.x,e.y,e.z,this._size.x,this._size.y,this._size.z)}},{key:"cubemap",get:function(){return this._cubemap},set:function(t){this._cubemap=t}},{key:"node",get:function(){return this._node}},{key:"camera",get:function(){return this._camera}},{key:"needRefresh",get:function(){return this._needRefresh},set:function(t){this._needRefresh=t}},{key:"needRender",get:function(){return this._needRender},set:function(t){this._needRender=t}},{key:"boundingBox",get:function(){return this._boundingBox}},{key:"cameraNode",get:function(){return this._cameraNode},set:function(t){this._cameraNode=t}},{key:"previewSphere",get:function(){return this._previewSphere},set:function(t){this._previewSphere=t}},{key:"previewPlane",get:function(){return this._previewPlane},set:function(t){this._previewPlane=t}}]),t}();!function(t){t[t.NONE=0]="NONE",t[t.BAKED_CUBEMAP=1]="BAKED_CUBEMAP",t[t.PLANAR_REFLECTION=2]="PLANAR_REFLECTION",t[t.BLEND_PROBES=3]="BLEND_PROBES",t[t.BLEND_PROBES_AND_SKYBOX=4]="BLEND_PROBES_AND_SKYBOX"}(uI||(uI={}));var _I,fI=new cn,dI=[{name:"CC_RECEIVE_SHADOW",value:!0}],pI=[{name:"CC_USE_LIGHTMAP",value:1}],mI=[{name:"CC_USE_LIGHTMAP",value:2}],gI=[{name:"CC_LIGHT_MAP_VERSION",value:2}],vI=[{name:"CC_USE_LIGHT_PROBE",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"}(_I||(_I={}));var yI,EI=new Gl(Vc.LINEAR,Vc.LINEAR,Vc.NONE,Wc.CLAMP,Wc.CLAMP,Wc.CLAMP),TI=new Gl(Vc.LINEAR,Vc.LINEAR,Vc.LINEAR,Wc.CLAMP,Wc.CLAMP,Wc.CLAMP),SI=function(){function t(){this.type=_I.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(gg.COUNT),this._localBuffer=null,this._localSHData=null,this._localSHBuffer=null,this._lightmap=null,this._lightmapUVParam=new ki,this._tetrahedronIndex=-1,this._lastWorldBoundCenter=new Wi(1/0,1/0,1/0),this._useLightProbe=!1,this._worldBoundBuffer=null,this._receiveShadow=!1,this._castShadow=!1,this._receiveDirLight=!0,this._shadowBias=0,this._shadowNormalBias=0,this._reflectionProbeId=-1,this._reflectionProbeBlendId=-1,this._reflectionProbeBlendWeight=0,this._enabled=!0,this._visFlags=Hp.Enum.NONE,this._priority=0,this._bakeToReflectionProbe=!0,this._reflectionProbeType=uI.NONE,this._device=_f.gfxDevice}var e=t.prototype;return e.initialize=function(){this._inited||(this._receiveShadow=!0,this.castShadow=!1,this.enabled=!0,this.visFlags=Hp.Enum.NONE,this._inited=!0,this._bakeToReflectionProbe=!0,this._reflectionProbeType=uI.NONE)},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._localSHBuffer&&(this._localSHBuffer.destroy(),this._localSHBuffer=null),this._worldBoundBuffer&&(this._worldBoundBuffer.destroy(),this._worldBoundBuffer=null),this._worldBounds=null,this._modelBounds=null,this._subModels.length=0,this._inited=!1,this._localDataUpdated=!0,this._transform=null,this._node=null,this.isDynamicBatching=!1},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.isTransformDirty()){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();this._updateStamp=t,this.updateSHUBOs();var n=this.node.scene.globals.shadows.enabled&&this.node.scene.globals.shadows.type===$E.Planar;if(this._localDataUpdated){this._localDataUpdated=!1;for(var r=this.transform._mat,s=!1,a=0;a<e.length;a++){var o=e[a],h=o.instancedWorldMatrixIndex;h>=0?o.updateInstancedWorldMatrix(r,h):s=!0}(s||n)&&this._localBuffer&&(cn.toArray(this._localData,r,gg.MAT_WORLD_OFFSET),cn.invert(fI,r),cn.transpose(fI,fI),cn.toArray(this._localData,fI,gg.MAT_WORLD_IT_OFFSET),this._localBuffer.update(this._localData))}},e.showTetrahedron=function(){return this.isLightProbeAvailable()},e.isLightProbeAvailable=function(){if(!this._useLightProbe)return!1;var t=g.director.root.pipeline.pipelineSceneData.lightProbes;return!(!t||t.empty()||!this._worldBounds)},e.updateSHBuffer=function(){if(this._localSHData){for(var t=this._subModels,e=!1,i=0;i<t.length;i++){var n=t[i],r=n.instancedSHIndex;r>=0?n.updateInstancedSH(this._localSHData,r):e=!0}e&&this._localSHBuffer&&this._localSHBuffer.update(this._localSHData)}},e.clearSHUBOs=function(){if(this._localSHData){for(var t=0;t<xg.COUNT;t++)this._localSHData[t]=0;this.updateSHBuffer()}},e.updateSHUBOs=function(){if(this.isLightProbeAvailable()){var t=this._worldBounds.center;if(!t.equals(this._lastWorldBoundCenter,vi)){var e=[],i=new ki(0,0,0,0),n=g.director.root.pipeline.pipelineSceneData.lightProbes;this._lastWorldBoundCenter.set(t),this._tetrahedronIndex=n.data.getInterpolationWeights(t,this._tetrahedronIndex,i),n.data.getInterpolationSHCoefficients(this._tetrahedronIndex,i,e)&&this._localSHData&&(g.internal.SH.reduceRinging(e,n.reduceRinging),g.internal.SH.updateUBOData(this._localSHData,xg.SH_LINEAR_CONST_R_OFFSET,e),this.updateSHBuffer())}}},e.createBoundingShape=function(t,e){t&&e&&(this._modelBounds||(this._modelBounds=$r.create()),this._worldBounds||(this._worldBounds=$r.create()),$r.fromPoints(this._modelBounds,t,e),$r.copy(this._worldBounds,this._modelBounds))},e._createSubModel=function(){return new eI},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._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){ki.toArray(this._localData,e,gg.LIGHTINGMAP_UVPARAM),this._localDataUpdated=!0,this._lightmap=t,this._lightmapUVParam=e,this.onMacroPatchesStateChanged(),t||(t=IE.get("empty-texture"));var i=t.getGFXTexture();if(i)for(var n=this._device.getSampler(t.mipmaps.length>1?TI:EI),r=this._subModels,s=0;s<r.length;s++){var a=r[s].descriptorSet;a.bindTexture(jg,i),a.bindSampler(jg,n),a.update()}},e.updateReflectionProbeCubemap=function(t){this._localDataUpdated=!0,this.onMacroPatchesStateChanged(),t||(t=IE.get("default-cube-texture"));var e=t.getGFXTexture();if(e)for(var i=this._device.getSampler(t.getSamplerInfo()),n=this._subModels,r=0;r<n.length;r++){var s=n[r].descriptorSet;s&&(s.bindSampler(rv,i),s.bindTexture(rv,e),s.update())}},e.updateReflectionProbeBlendCubemap=function(t){this._localDataUpdated=!0,this.onMacroPatchesStateChanged(),t||(t=IE.get("default-cube-texture"));var e=t.getGFXTexture();if(e)for(var i=this._device.getSampler(t.getSamplerInfo()),n=this._subModels,r=0;r<n.length;r++){var s=n[r].descriptorSet;s&&(s.bindSampler(fv,i),s.bindTexture(fv,e),s.update())}},e.updateReflectionProbePlanarMap=function(t){this._localDataUpdated=!0,this.onMacroPatchesStateChanged();var e=this._device.getSampler(new Gl(Vc.LINEAR,Vc.LINEAR,Vc.NONE,Wc.CLAMP,Wc.CLAMP,Wc.CLAMP));if(t||(t=IE.get("empty-texture").getGFXTexture()),t)for(var i=this._subModels,n=0;n<i.length;n++){var r=i[n].descriptorSet;r&&(r.bindTexture(ov,t),r.bindSampler(ov,e),r.update())}},e.updateReflectionProbeDataMap=function(t){this._localDataUpdated=!0,this.onMacroPatchesStateChanged(),t||(t=IE.get("empty-texture"));var e=t.getGFXTexture();if(e)for(var i=this._subModels,n=0;n<i.length;n++){var r=i[n].descriptorSet;r&&(r.bindTexture(cv,e),r.bindSampler(cv,t.getGFXSampler()),r.update())}},e.updateLocalShadowBias=function(){var t=this._localData;t[gg.LOCAL_SHADOW_BIAS+0]=this._shadowBias,t[gg.LOCAL_SHADOW_BIAS+1]=this._shadowNormalBias,this._localDataUpdated=!0},e.updateReflectionProbeId=function(){var t=this._localData;t[gg.LOCAL_SHADOW_BIAS+2]=this._reflectionProbeId,t[gg.LOCAL_SHADOW_BIAS+3]=this._reflectionProbeBlendId;var e=null,i=null;if(g.internal.reflectionProbeManager&&(e=g.internal.reflectionProbeManager.getProbeById(this._reflectionProbeId),i=g.internal.reflectionProbeManager.getProbeById(this._reflectionProbeBlendId)),e){if(e.probeType===sI.PLANAR)t[gg.REFLECTION_PROBE_DATA1]=e.node.up.x,t[gg.REFLECTION_PROBE_DATA1+1]=e.node.up.y,t[gg.REFLECTION_PROBE_DATA1+2]=e.node.up.z,t[gg.REFLECTION_PROBE_DATA1+3]=1,t[gg.REFLECTION_PROBE_DATA2]=1,t[gg.REFLECTION_PROBE_DATA2+1]=0,t[gg.REFLECTION_PROBE_DATA2+2]=0,t[gg.REFLECTION_PROBE_DATA2+3]=1;else{t[gg.REFLECTION_PROBE_DATA1]=e.node.worldPosition.x,t[gg.REFLECTION_PROBE_DATA1+1]=e.node.worldPosition.y,t[gg.REFLECTION_PROBE_DATA1+2]=e.node.worldPosition.z,t[gg.REFLECTION_PROBE_DATA1+3]=0,t[gg.REFLECTION_PROBE_DATA2]=e.size.x,t[gg.REFLECTION_PROBE_DATA2+1]=e.size.y,t[gg.REFLECTION_PROBE_DATA2+2]=e.size.z;var n=e.isRGBE()?1e3:0;t[gg.REFLECTION_PROBE_DATA2+3]=e.cubemap?e.cubemap.mipmapLevel+n:1+n}if(this._reflectionProbeType===uI.BLEND_PROBES||this._reflectionProbeType===uI.BLEND_PROBES_AND_SKYBOX)if(i){t[gg.REFLECTION_PROBE_BLEND_DATA1]=i.node.worldPosition.x,t[gg.REFLECTION_PROBE_BLEND_DATA1+1]=i.node.worldPosition.y,t[gg.REFLECTION_PROBE_BLEND_DATA1+2]=i.node.worldPosition.z,t[gg.REFLECTION_PROBE_BLEND_DATA1+3]=this.reflectionProbeBlendWeight,t[gg.REFLECTION_PROBE_BLEND_DATA2]=i.size.x,t[gg.REFLECTION_PROBE_BLEND_DATA2+1]=i.size.y,t[gg.REFLECTION_PROBE_BLEND_DATA2+2]=i.size.z;var r=i.isRGBE()?1e3:0;t[gg.REFLECTION_PROBE_BLEND_DATA2+3]=i.cubemap?i.cubemap.mipmapLevel+r:1+r}else this._reflectionProbeType===uI.BLEND_PROBES_AND_SKYBOX&&(t[gg.REFLECTION_PROBE_BLEND_DATA1+3]=this.reflectionProbeBlendWeight)}this._localDataUpdated=!0},e.getMacroPatches=function(){var t=this.receiveShadow?dI:null;if(null!=this._lightmap&&this.node&&this.node.scene&&!this.node.scene.globals.disableLightmap){var e=this.node.scene.globals.bakedWithStationaryMainLight?mI:pI;t=t?t.concat(e):e,this.node.scene.globals.bakedWithHighpLightmap&&(t=t.concat(gI))}this._useLightProbe&&(t=t?t.concat(vI):vI);var i=[{name:"CC_USE_REFLECTION_PROBE",value:this._reflectionProbeType}];t=t?t.concat(i):i;var n=[{name:"CC_DISABLE_DIRECTIONAL_LIGHT",value:!this._receiveDirLight}];return t?t.concat(n):n},e._updateAttributesAndBinding=function(t){var e=this._subModels[t];if(e){this._initLocalDescriptors(t),this._updateLocalDescriptors(t,e.descriptorSet),this._initLocalSHDescriptors(t),this._updateLocalSHDescriptors(t,e.descriptorSet),this._initWorldBoundDescriptors(t),e.worldBoundDescriptorSet&&this._updateWorldBoundDescriptors(t,e.worldBoundDescriptorSet);for(var i,n=[],r=new Set,s=f(e.passes);!(i=s()).done;)for(var a,o=f(i.value.getShaderVariant(e.patches).attributes);!(a=o()).done;){var h=a.value;r.has(h.name)||(n.push(h),r.add(h.name))}this._updateInstancedAttributes(n,e)}},e._updateInstancedAttributes=function(t,e){e.UpdateInstancedAttributes(t),this._localDataUpdated=!0},e._initLocalDescriptors=function(){this._localBuffer||(this._localBuffer=this._device.createBuffer(new Ml(Mc.UNIFORM|Mc.TRANSFER_DST,Bc.DEVICE,gg.SIZE,gg.SIZE)))},e._initLocalSHDescriptors=function(){this._useLightProbe&&(this._localSHData||(this._localSHData=new Float32Array(xg.COUNT)),this._localSHBuffer||(this._localSHBuffer=this._device.createBuffer(new Ml(Mc.UNIFORM|Mc.TRANSFER_DST,Bc.DEVICE,xg.SIZE,xg.SIZE))))},e._initWorldBoundDescriptors=function(){this._worldBoundBuffer||(this._worldBoundBuffer=this._device.createBuffer(new Ml(Mc.UNIFORM|Mc.TRANSFER_DST,Bc.DEVICE,vg.SIZE,vg.SIZE)))},e._updateLocalDescriptors=function(t,e){this._localBuffer&&e.bindBuffer(gg.BINDING,this._localBuffer)},e._updateLocalSHDescriptors=function(t,e){this._localSHBuffer&&e.bindBuffer(xg.BINDING,this._localSHBuffer)},e._updateWorldBoundDescriptors=function(t,e){this._worldBoundBuffer&&e.bindBuffer(vg.BINDING,this._worldBoundBuffer)},n(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:"localSHBuffer",get:function(){return this._localSHBuffer}},{key:"worldBoundBuffer",get:function(){return this._worldBoundBuffer}},{key:"updateStamp",get:function(){return this._updateStamp}},{key:"useLightProbe",get:function(){return this._useLightProbe},set:function(t){this._useLightProbe=t,this.onMacroPatchesStateChanged()}},{key:"tetrahedronIndex",get:function(){return this._tetrahedronIndex},set:function(t){this._tetrahedronIndex=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}},{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:"receiveDirLight",get:function(){return this._receiveDirLight},set:function(t){this._receiveDirLight=t,this.onMacroPatchesStateChanged()}},{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}},{key:"bakeToReflectionProbe",get:function(){return this._bakeToReflectionProbe},set:function(t){this._bakeToReflectionProbe=t}},{key:"reflectionProbeType",get:function(){return this._reflectionProbeType},set:function(t){this._reflectionProbeType=t;for(var e=this._subModels,i=0;i<e.length;i++)e[i].useReflectionProbeType=t;this.onMacroPatchesStateChanged()}},{key:"reflectionProbeId",get:function(){return this._reflectionProbeId},set:function(t){this._reflectionProbeId=t}},{key:"reflectionProbeBlendId",get:function(){return this._reflectionProbeBlendId},set:function(t){this._reflectionProbeBlendId=t}},{key:"reflectionProbeBlendWeight",get:function(){return this._reflectionProbeBlendWeight},set:function(t){this._reflectionProbeBlendWeight=t}}]),t}(),AI=function(){function t(){this._enabled=!1,this._minPos=new Wi(0,0,0),this._maxPos=new Wi(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},n(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}(),RI=function(){function t(){this._enabled=!0,this._blurRadius=.01,this._sssIntensity=3}return t.prototype.initialize=function(t){this._enabled=t.enabled,this._blurRadius=t.blurRadius,this._sssIntensity=t.sssIntensity},n(t,[{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled=t}},{key:"blurRadius",get:function(){return this._blurRadius},set:function(t){this._blurRadius=t}},{key:"sssIntensity",get:function(){return this._sssIntensity},set:function(t){this._sssIntensity=t}}]),t}();function CI(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,h=1/o*a,u=1/o*(1-a-o);t.x=3.2404542*h-1.5371385+-.4985314*u,t.y=-.969266*h+1.8760108+.041556*u,t.z=.0556434*h-.2040259+1.0572252*u}!function(t){t[t.DIRECTIONAL=0]="DIRECTIONAL",t[t.SPHERE=1]="SPHERE",t[t.SPOT=2]="SPOT",t[t.POINT=3]="POINT",t[t.RANGED_DIRECTIONAL=4]="RANGED_DIRECTIONAL",t[t.UNKNOWN=5]="UNKNOWN"}(yI||(yI={}));var bI,II,wI,OI,xI,NI,DI,MI,PI,LI,BI,FI,UI=function(t){return 4*Math.PI*Math.PI*t*t},kI=function(){function t(){this._baked=!1,this._color=new Wi(1,1,1),this._colorTemp=6550,this._colorTempRGB=new Wi(1,1,1),this._finalColor=new Wi(1,1,1),this._scene=null,this._node=null,this._name=null,this._useColorTemperature=!1,this._type=yI.UNKNOWN,this._visibility=yv}var e=t.prototype;return e.initialize=function(){this.color=new Wi(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(){},n(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),this._useColorTemperature&&Wi.multiply(this._finalColor,this._color,this._colorTempRGB)}},{key:"useColorTemperature",get:function(){return this._useColorTemperature},set:function(t){this._useColorTemperature=t,t&&Wi.multiply(this._finalColor,this._color,this._colorTempRGB)}},{key:"colorTemperature",get:function(){return this._colorTemp},set:function(t){this._colorTemp=t,CI(this._colorTempRGB,this._colorTemp),this._useColorTemperature&&Wi.multiply(this._finalColor,this._color,this._colorTempRGB)}},{key:"colorTemperatureRGB",get:function(){return this._colorTempRGB}},{key:"finalColor",get:function(){return this._finalColor}},{key:"visibility",get:function(){return this._visibility},set:function(t){this._visibility=t}},{key:"node",get:function(){return this._node},set:function(t){this._node=t,this._node&&(this._node.hasChangedFlags|=Vp.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}(),GI=new Wi(0,0,-1),HI=new Wi,zI=function(t){function e(){var e;return(e=t.call(this)||this)._dir=new Wi(1,-1,-1),e._illuminanceHDR=Um.SUN_ILLUM,e._illuminanceLDR=1,e._shadowEnabled=!1,e._shadowPcf=tT.HARD,e._shadowBias=1e-5,e._shadowNormalBias=0,e._shadowSaturation=1,e._shadowDistance=50,e._shadowInvisibleOcclusionRange=200,e._csmLevel=eT.LEVEL_4,e._csmNeedUpdate=!1,e._csmLayerLambda=.75,e._csmOptimizationMode=iT.DisableRotationFix,e._csmLayersTransition=!1,e._csmTransitionRange=.05,e._shadowFixedArea=!1,e._shadowNear=.1,e._shadowFar=10,e._shadowOrthoSize=5,e._type=yI.DIRECTIONAL,e}s(e,t);var i=e.prototype;return i.initialize=function(){t.prototype.initialize.call(this),this.illuminance=Um.SUN_ILLUM,this.direction=new Wi(1,-1,-1)},i.update=function(){this._node&&this._node.hasChangedFlags&&(this.direction=Wi.transformQuat(HI,GI,this._node.worldRotation))},i.activate=function(){var t=g.director.root,e=t.pipeline;this._shadowEnabled?(this._shadowFixedArea||!e.pipelineSceneData.csmSupported?e.macros.CC_DIR_LIGHT_SHADOW_TYPE=1:this.csmLevel>1&&e.pipelineSceneData.csmSupported?(e.macros.CC_DIR_LIGHT_SHADOW_TYPE=2,e.macros.CC_CASCADED_LAYERS_TRANSITION=this._csmLayersTransition):e.macros.CC_DIR_LIGHT_SHADOW_TYPE=1,e.macros.CC_DIR_SHADOW_PCF_TYPE=this._shadowPcf):e.macros.CC_DIR_LIGHT_SHADOW_TYPE=0,t.onGlobalPipelineStateChanged()},n(e,[{key:"direction",get:function(){return this._dir},set:function(t){Wi.normalize(this._dir,t)}},{key:"illuminance",get:function(){return g.director.root.pipeline.pipelineSceneData.isHDR?this._illuminanceHDR:this._illuminanceLDR},set:function(t){g.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,rT.MAX_FAR)}},{key:"shadowInvisibleOcclusionRange",get:function(){return this._shadowInvisibleOcclusionRange},set:function(t){this._shadowInvisibleOcclusionRange=Math.min(t,rT.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,rT.MAX_FAR)}},{key:"shadowOrthoSize",get:function(){return this._shadowOrthoSize},set:function(t){this._shadowOrthoSize=t}},{key:"csmLayersTransition",get:function(){return this._csmLayersTransition},set:function(t){this._csmLayersTransition=t,this.activate()}},{key:"csmTransitionRange",get:function(){return this._csmTransitionRange},set:function(t){this._csmTransitionRange=t}}]),e}(kI),VI=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=$r.create(),e._pos=new Wi,e._type=yI.SPHERE,e}s(e,t);var i=e.prototype;return i.initialize=function(){t.prototype.initialize.call(this),this.size=.15,this.range=1,this.luminanceHDR=1700/UI(.15),this.luminanceLDR=1},i.update=function(){if(this._node&&(this._node.hasChangedFlags||this._needUpdate)){this._node.getWorldPosition(this._pos);var t=this._range;$r.set(this._aabb,this._pos.x,this._pos.y,this._pos.z,t,t,t),this._needUpdate=!1}},n(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 g.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){g.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}(kI),WI=new Wi(0,0,-1),XI=new en,jI=new cn,YI=new cn,KI=new cn,qI=new cn,QI=function(t){function e(){var e;return(e=t.call(this)||this)._dir=new Wi(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=tT.HARD,e._shadowBias=1e-5,e._shadowNormalBias=0,e._aabb=$r.create(),e._frustum=as.create(),e._pos=new Wi,e._type=yI.SPOT,e}s(e,t);var i=e.prototype;return i.initialize=function(){t.prototype.initialize.call(this),this.size=.15,this.luminanceHDR=1700/UI(.15),this.luminanceLDR=1,this.range=Math.cos(Math.PI/6),this._dir.set(new Wi(1,-1,-1))},i.update=function(){this._node&&(this._node.hasChangedFlags||this._needUpdate)&&(this._node.getWorldPosition(this._pos),Wi.transformQuat(this._dir,WI,this._node.getWorldRotation(XI)),Wi.normalize(this._dir,this._dir),$r.set(this._aabb,this._pos.x,this._pos.y,this._pos.z,this._range,this._range,this._range),this._node.getWorldRT(jI),cn.invert(jI,jI),cn.perspective(YI,this._angle,1,.001,this._range),cn.multiply(KI,YI,jI),this._frustum.update(KI,qI),this._needUpdate=!1)},n(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 g.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){g.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}(kI),ZI=function(t){function e(){var e;return(e=t.call(this)||this)._needUpdate=!1,e._range=1,e._luminanceHDR=0,e._luminanceLDR=0,e._pos=void 0,e._aabb=void 0,e._aabb=$r.create(),e._pos=new Wi,e._type=yI.POINT,e}s(e,t);var i=e.prototype;return i.initialize=function(){t.prototype.initialize.call(this),this.range=1,this.luminanceHDR=1700/UI(1),this.luminanceLDR=1},i.update=function(){if(this._node&&(this._node.hasChangedFlags||this._needUpdate)){this._node.getWorldPosition(this._pos);var t=this._range;$r.set(this._aabb,this._pos.x,this._pos.y,this._pos.z,t,t,t),this._needUpdate=!1}},n(e,[{key:"position",get:function(){return this._pos}},{key:"range",get:function(){return this._range},set:function(t){this._range=t,this._needUpdate=!0}},{key:"luminance",get:function(){return g.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){g.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}(kI),JI=new Wi(0,0,-1),$I=function(t){function e(){var e;return(e=t.call(this)||this)._dir=new Wi(0,0,-1),e._pos=new Wi(0,0,0),e._scale=new Wi(1,1,1),e._right=new Wi(1,0,0),e._illuminanceHDR=Um.SUN_ILLUM,e._illuminanceLDR=1,e._type=yI.RANGED_DIRECTIONAL,e}s(e,t);var i=e.prototype;return i.initialize=function(){t.prototype.initialize.call(this),this.illuminance=Um.SUN_ILLUM},i.update=function(){this._node&&this._node.hasChangedFlags&&(this._node.getWorldPosition(this._pos),this._node.getWorldScale(this._scale),Wi.transformQuat(this._dir,JI,this._node.worldRotation),Wi.transformQuat(this._right,Wi.RIGHT,this._node.worldRotation))},n(e,[{key:"direction",get:function(){return this._dir}},{key:"right",get:function(){return this._right}},{key:"position",get:function(){return this._pos}},{key:"scale",get:function(){return this._scale}},{key:"illuminance",get:function(){return g.director.root.pipeline.pipelineSceneData.isHDR?this._illuminanceHDR:this._illuminanceLDR},set:function(t){g.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}}]),e}(kI),tw=function(){function t(){this.screenUsagePercentage=1,this._models=[]}var e=t.prototype;return e.addModel=function(t){this._models.splice(0,0,t)},e.eraseModel=function(t){var e=this._models.indexOf(t);e>=0&&this._models.splice(e,1)},e.clearModels=function(){this._models.length=0},n(t,[{key:"models",get:function(){return this._models}}]),t}(),ew=function(){function t(){this.scene=void 0,this.node=null,this._device=void 0,this.enabled=!0,this._localBoundaryCenter=new Wi(0,0,0),this._objectSize=1,this._lodDataArray=[],this._lockedLODLevelVec=[],this._isLockLevelChanged=!1,this._device=_f.gfxDevice}var e=t.prototype;return e.attachToScene=function(t){this.scene=t},e.detachFromScene=function(){this.scene=null},e.lockLODLevels=function(t){if(t.length!==this._lockedLODLevelVec.length)this._isLockLevelChanged=!0;else for(var e=t.length,i=0;i<e;i++)if(t[i]!==this._lockedLODLevelVec[i]){this._isLockLevelChanged=!0;break}this._lockedLODLevelVec=t},e.isLockLevelChanged=function(){return this._isLockLevelChanged},e.resetLockChangeFlag=function(){this._isLockLevelChanged=!1},e.getLockedLODLevels=function(){return this._lockedLODLevelVec},e.clearLODs=function(){this._lodDataArray.length=0},e.insertLOD=function(t,e){this._lodDataArray.splice(t,0,e)},e.updateLOD=function(t,e){this._lodDataArray[t]=e},e.eraseLOD=function(t){this._lodDataArray.splice(t,1)},e.getVisibleLODLevel=function(t){for(var e=this.getScreenUsagePercentage(t),i=-1,n=0;n<this.lodCount;++n)if(e>=this.lodDataArray[n].screenUsagePercentage){i=n;break}return i},e.getScreenUsagePercentage=function(t){return this.node?(t.projectionType===wb.PERSPECTIVE&&(e=Wi.len(this.localBoundaryCenter.transformMat4(this.node.worldMatrix).subtract(t.node.worldPosition))),this.distanceToScreenUsagePercentage(t,e,this.getWorldSpaceSize())):0;var e},e.distanceToScreenUsagePercentage=function(t,e,i){return t.projectionType===wb.PERSPECTIVE?i*t.matProj.m05/(2*e):i*t.matProj.m05*.5},e.getWorldSpaceSize=function(){var t=this.node.scale;return Math.max(Math.abs(t.x),Math.abs(t.y),Math.abs(t.z))*this.objectSize},n(t,[{key:"localBoundaryCenter",get:function(){return this._localBoundaryCenter.clone()},set:function(t){this._localBoundaryCenter.set(t)}},{key:"lodCount",get:function(){return this._lodDataArray.length}},{key:"objectSize",get:function(){return this._objectSize},set:function(t){this._objectSize=t}},{key:"lodDataArray",get:function(){return this._lodDataArray}}]),t}(),iw=Object.freeze({__proto__:null,get CameraFOVAxis(){return Ib},get CameraProjection(){return wb},get CameraAperture(){return Ob},get CameraISO(){return xb},get CameraShutter(){return Nb},get CameraType(){return Db},get TrackingType(){return Mb},get CameraUsage(){return Pb},SKYBOX_FLAG:zb,Camera:Wb,get ModelType(){return _I},Model:SI,SubModel:eI,Ambient:Um,EnvironmentLightingType:uT,Skybox:cT,ShadowSize:JE,ShadowType:$E,PCFType:tT,CSMLevel:eT,CSMOptimizationMode:iT,Shadows:rT,FogType:bA,Fog:wA,Octree:AI,Skin:RI,ColorTemperatureToRGB:CI,get LightType(){return yI},nt2lm:UI,Light:kI,DirectionalLight:zI,SphereLight:VI,SpotLight:QI,PointLight:ZI,RangedDirectionalLight:$I,get ProbeClearFlag(){return rI},get ProbeType(){return sI},ReflectionProbe:lI,LODData:tw,LODGroup:ew});!function(t){t[t.PER_INSTANCE=0]="PER_INSTANCE",t[t.PER_BATCH=1]="PER_BATCH",t[t.PER_PHASE=2]="PER_PHASE",t[t.PER_PASS=3]="PER_PASS",t[t.COUNT=4]="COUNT"}(bI||(bI={})),function(t){t[t.CONSTANTS=0]="CONSTANTS",t[t.CBV=1]="CBV",t[t.UAV=2]="UAV",t[t.SRV=3]="SRV",t[t.TABLE=4]="TABLE",t[t.SSV=5]="SSV"}(II||(II={})),function(t){t[t.MANAGED=0]="MANAGED",t[t.MEMORYLESS=1]="MEMORYLESS",t[t.PERSISTENT=2]="PERSISTENT",t[t.EXTERNAL=3]="EXTERNAL",t[t.BACKBUFFER=4]="BACKBUFFER"}(wI||(wI={})),function(t){t[t.NONE=0]="NONE",t[t.OPAQUE=1]="OPAQUE",t[t.MASK=2]="MASK",t[t.BLEND=3]="BLEND",t[t.RENDER_OPAQUE=1]="RENDER_OPAQUE",t[t.RENDER_CUTOUT=2]="RENDER_CUTOUT",t[t.RENDER_TRANSPARENT=3]="RENDER_TRANSPARENT"}(OI||(OI={})),function(t){t[t.BUFFER=0]="BUFFER",t[t.TEXTURE1D=1]="TEXTURE1D",t[t.TEXTURE2D=2]="TEXTURE2D",t[t.TEXTURE3D=3]="TEXTURE3D"}(xI||(xI={})),function(t){t[t.NONE=0]="NONE",t[t.UNIFORM=1]="UNIFORM",t[t.INDIRECT=2]="INDIRECT",t[t.STORAGE=4]="STORAGE",t[t.SAMPLED=8]="SAMPLED",t[t.COLOR_ATTACHMENT=16]="COLOR_ATTACHMENT",t[t.DEPTH_STENCIL_ATTACHMENT=32]="DEPTH_STENCIL_ATTACHMENT",t[t.INPUT_ATTACHMENT=64]="INPUT_ATTACHMENT",t[t.SHADING_RATE=128]="SHADING_RATE"}(NI||(NI={})),function(t){t[t.SYNC=0]="SYNC",t[t.ASYNC=1]="ASYNC"}(DI||(DI={})),function(t){t[t.NONE=0]="NONE",t[t.OPAQUE=1]="OPAQUE",t[t.MASK=2]="MASK",t[t.BLEND=4]="BLEND",t[t.OPAQUE_OBJECT=1]="OPAQUE_OBJECT",t[t.CUTOUT_OBJECT=2]="CUTOUT_OBJECT",t[t.TRANSPARENT_OBJECT=4]="TRANSPARENT_OBJECT",t[t.SHADOW_CASTER=8]="SHADOW_CASTER",t[t.UI=16]="UI",t[t.DEFAULT_LIGHTING=32]="DEFAULT_LIGHTING",t[t.VOLUMETRIC_LIGHTING=64]="VOLUMETRIC_LIGHTING",t[t.CLUSTERED_LIGHTING=128]="CLUSTERED_LIGHTING",t[t.PLANAR_SHADOW=256]="PLANAR_SHADOW",t[t.GEOMETRY=512]="GEOMETRY",t[t.PROFILER=1024]="PROFILER",t[t.DRAW_INSTANCING=2048]="DRAW_INSTANCING",t[t.DRAW_NON_INSTANCING=4096]="DRAW_NON_INSTANCING",t[t.REFLECTION_PROBE=8192]="REFLECTION_PROBE",t[t.ALL=4294967295]="ALL"}(MI||(MI={})),function(t){t[t.NONE=0]="NONE",t[t.DEFAULT=1]="DEFAULT",t[t.CLUSTERED=2]="CLUSTERED"}(PI||(PI={})),function(t){t[t.RENDER_TARGET=0]="RENDER_TARGET",t[t.DEPTH_STENCIL=1]="DEPTH_STENCIL",t[t.SHADING_RATE=2]="SHADING_RATE"}(LI||(LI={})),function(t){t[t.READ=0]="READ",t[t.READ_WRITE=1]="READ_WRITE",t[t.WRITE=2]="WRITE"}(BI||(BI={})),function(t){t[t.NONE=0]="NONE",t[t.FLOAT_TYPE=1]="FLOAT_TYPE",t[t.INT_TYPE=2]="INT_TYPE"}(FI||(FI={}));var nw,rw,sw=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};!function(t){t[t.UNIFORM_BUFFER=0]="UNIFORM_BUFFER",t[t.DYNAMIC_UNIFORM_BUFFER=1]="DYNAMIC_UNIFORM_BUFFER",t[t.SAMPLER_TEXTURE=2]="SAMPLER_TEXTURE",t[t.SAMPLER=3]="SAMPLER",t[t.TEXTURE=4]="TEXTURE",t[t.STORAGE_BUFFER=5]="STORAGE_BUFFER",t[t.DYNAMIC_STORAGE_BUFFER=6]="DYNAMIC_STORAGE_BUFFER",t[t.STORAGE_IMAGE=7]="STORAGE_IMAGE",t[t.INPUT_ATTACHMENT=8]="INPUT_ATTACHMENT"}(nw||(nw={})),function(t){t[t.NONE=0]="NONE",t[t.COLOR=1]="COLOR",t[t.DEPTH=2]="DEPTH",t[t.STENCIL=4]="STENCIL"}(rw||(rw={}));var aw,ow=function(t,e,i,n,r,s,a){void 0===t&&(t=new Uint8Array(0)),void 0===e&&(e=""),void 0===i&&(i=4294967295),void 0===n&&(n=4294967295),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=0),this.source=void 0,this.target=void 0,this.mipLevels=void 0,this.numSlices=void 0,this.targetMostDetailedMip=void 0,this.targetFirstSlice=void 0,this.targetPlaneSlice=void 0,this.source=t,this.target=e,this.mipLevels=i,this.numSlices=n,this.targetMostDetailedMip=r,this.targetFirstSlice=s,this.targetPlaneSlice=a};nt(yd.prototype,"TextureBase.prototype",[{name:"hasPremultipliedAlpha"},{name:"setPremultiplyAlpha"},{name:"setFlipY"}]),it(hI.prototype,"RenderTexture.prototype",[{name:"getGFXWindow",customFunction:function(){return this.window}}]);var hw=((aw={})[Nc.UNORM]="Uint",aw[Nc.SNORM]="Int",aw[Nc.UINT]="Uint",aw[Nc.INT]="Int",aw[Nc.UFLOAT]="Float",aw[Nc.FLOAT]="Float",aw.default="Uint",aw);function uw(t){return""+(hw[t.type]||hw.default)+t.size/t.count*8}function cw(t,e,i,n,r){void 0===i&&(i=xc.R32F),void 0===n&&(n=0),void 0===r&&(r=0);var s=T_[i];r||(r=s.size);for(var a="set"+uw(s),o=s.size/s.count,h=Math.floor(e.length/s.count),u=dc.isLittleEndian,c=0;c<h;++c)for(var l=n+r*c,_=0;_<s.count;++_){var f=l+o*_;t[a](f,e[s.count*c+_],u)}}var lw,_w=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 Jl(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,h=o*a,u=new Uint8Array(t.data.buffer,s.view.offset,s.view.length),c=new Uint8Array(i.indexView?h:s.view.length);if(i.indexView){for(var l=t.readIndices(this.subMeshIdx),_=0;_<e;++_)for(var f=_*o,d=l[_]*o,p=0;p<o;++p)c[f+p]=u[d+p];this._flatBuffers.push({stride:o,count:a,buffer:c})}else c.set(t.data.subarray(s.view.offset,s.view.offset+s.view.length)),this._flatBuffers.push({stride:o,count:a,buffer:c})}}},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 Ql("a_vertexId",xc.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 Ml(Mc.VERTEX|Mc.TRANSFER_DST,Bc.DEVICE,i.byteLength,i.BYTES_PER_ELEMENT));return r.update(i),r},n(t,[{key:"attributes",get:function(){return this._attributes}},{key:"vertexBuffers",get:function(){return this._vertexBuffers}},{key:"indexBuffer",get:function(){return this._indexBuffer}},{key:"indirectBuffer",get:function(){return this._indirectBuffer}},{key:"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:Wi.ZERO,max:Wi.ZERO}};if(void 0===this.subMeshIdx)return{positions:new Float32Array,indices:new Uint8Array,boundingBox:{min:Wi.ZERO,max:Wi.ZERO}};var t=this.mesh,e=this.subMeshIdx,i=t.readAttribute(e,ml.ATTR_POSITION),n=t.readIndices(e),r=new Wi,s=new Wi,a=this.attributes.find((function(t){return t.name===ml.ATTR_POSITION}));if(a){var o=T_[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 h=0;h<i.length;h+=o)2===o?(r.x=i[h]>r.x?i[h]:r.x,r.y=i[h+1]>r.y?i[h+1]:r.y,s.x=i[h]<s.x?i[h]:s.x,s.y=i[h+1]<s.y?i[h+1]:s.y):(r.x=i[h]>r.x?i[h]:r.x,r.y=i[h+1]>r.y?i[h+1]:r.y,r.z=i[h+2]>r.z?i[h+2]:r.z,s.x=i[h]<s.x?i[h]:s.x,s.y=i[h+1]<s.y?i[h+1]:s.y,s.z=i[h+2]<s.z?i[h+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=g.director.root.device,h=function(){var h=s.vertexBundles[a.vertexBundelIndices[u]];r=0,n=xc.UNKNOWN;for(var c=0;c<h.attributes.length;c++){var l=h.attributes[c];if(l.name===ml.ATTR_JOINTS){n=l.format;break}r+=T_[l.format].size}if(n){var _=new Uint8Array(t.mesh.data.buffer,h.view.offset,h.view.length),f=new DataView(_.slice().buffer),d=s.jointMaps[a.jointMapIndex];!function(t,e,i,n,r,s,a){void 0===i&&(i=xc.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,h=T_[i];s||(s=h.size);for(var u="set"+uw(h),c="get"+uw(h),l=h.size/h.count,_=Math.floor(r/s),f=dc.isLittleEndian,p=0;p<_;++p)for(var m=n+s*p,g=0;g<h.count;++g){var v=m+l*g,y=t[c](v,f);a[u](v,(o=y,d.indexOf(o)),f)}}(f,0,n,r,h.view.length,h.view.stride,f);var p=o.createBuffer(new Ml(Mc.VERTEX|Mc.TRANSFER_DST,Bc.DEVICE,h.view.length,h.view.stride));p.update(f.buffer),e.push(p),i.push(u)}else e.push(t.vertexBuffers[a.vertexBundelIndices[u]])},u=0;u<a.vertexBundelIndices.length;u++)h();return this._vertexIdChannel&&e.push(this._allocVertexIdBuffer(o)),e}},{key:"iaInfo",get:function(){return this._iaInfo}}]),t}()),fw=t("DebugView",function(){function t(){this._singleMode=0,this._compositeModeValue=0,this._lightingWithAlbedo=!0,this._csmLayerColoration=!1,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=g.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<17;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<17;t++)if(!this.isCompositeModeEnabled(t))return 2;return 0},n(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}()),dw=new $r(0,0,0,.5,.5,.5),pw=new $r;function mw(t,e){var i=t.pipelineSceneData,n=i.validPunctualLights;n.length=0;for(var r=Qn.create(0,0,0,1),s=e.scene.spotLights,a=0;a<s.length;a++){var o=s[a];o.baked&&!e.node.scene.globals.disableLightmap||(Qn.set(r,o.position.x,o.position.y,o.position.z,o.range),Gr.sphereFrustum(r,e.frustum)&&n.push(o))}for(var h=e.scene.sphereLights,u=0;u<h.length;u++){var c=h[u];c.baked&&!e.node.scene.globals.disableLightmap||(Qn.set(r,c.position.x,c.position.y,c.position.z,c.range),Gr.sphereFrustum(r,e.frustum)&&n.push(c))}for(var l=e.scene.pointLights,_=0;_<l.length;_++){var f=l[_];f.baked||(Qn.set(r,f.position.x,f.position.y,f.position.z,f.range),Gr.sphereFrustum(r,e.frustum)&&n.push(f))}for(var d=e.scene.rangedDirLights,p=0;p<d.length;p++){var m=d[p];$r.transform(pw,dw,m.node.getWorldMatrix()),Gr.aabbFrustum(pw,e.frustum)&&n.push(m)}i.validPunctualLights=n}!function(t){t[t.NONE=0]="NONE",t[t.FXAA=1]="FXAA",t[t.FXAAHQ=2]="FXAAHQ"}(lw||(lw={}));var gw=[];function vw(t){return gw.includes(t)||gw.push(t),gw.indexOf(t)}function yw(t,e){var i=Zc.CLEAR;return t&_l.COLOR||e!==LI.RENDER_TARGET||(i=t&zb?Zc.CLEAR:Zc.LOAD),(t&_l.DEPTH_STENCIL)!==_l.DEPTH_STENCIL&&e===LI.DEPTH_STENCIL&&(t&_l.DEPTH||(i=Zc.LOAD),t&_l.STENCIL||(i=Zc.LOAD)),i}function Ew(t,e,i,n,r,s){void 0===n&&(n=null),void 0===r&&(r=0),s=s||new Tl;var a=t?t.viewport:new Tl(0,0,1,1),o=e,h=i;if(s.x=a.x*o,s.y=a.y*h,s.width=a.width*o,s.height=a.height*h,n)switch(n.type){case yI.DIRECTIONAL:var u=n;if(u.shadowFixedArea||u.csmLevel===eT.LEVEL_1)s.x=0,s.y=0,s.width=o,s.height=h;else{var c=g.director.root.device.capabilities.screenSpaceSignY;s.x=r%2*.5*o,s.y=c>0?.5*(1-Math.floor(r/2))*h:.5*Math.floor(r/2)*h,s.width=.5*o,s.height=.5*h}break;case yI.SPOT:s.x=0,s.y=0,s.width=o,s.height=h}return s}var Tw=function(){function t(t){void 0===t&&(t=lw.NONE),this.antiAliasing=lw.NONE,this.antiAliasing=t,this._init()}return t.prototype._init=function(){this.postMaterial=new ZE,this.postMaterial.name="builtin-post-process-material",this.postMaterial.initialize({effectName:"pipeline/post-process",defines:{ANTIALIAS_TYPE:this.antiAliasing}});for(var t=0;t<this.postMaterial.passes.length;++t)this.postMaterial.passes[t].tryCompile()},t}(),Sw=function(){function t(){this.shadowEnabled=!1,this.mainLightShadowNames=new Array,this.spotLightShadowNames=new Array,this.validLights=[]}return t.prototype.reset=function(){this.shadowEnabled=!1,this.mainLightShadowNames.length=0,this.spotLightShadowNames.length=0,this.validLights.length=0},t}();new Sw;var Aw=function(){function t(t){this.enableCluster=void 0,this.enableCluster=t?1:0,this._init()}return t.prototype._init=function(){this.deferredLightingMaterial=new ZE,this.deferredLightingMaterial.name="builtin-deferred-material",this.deferredLightingMaterial.initialize({effectName:"pipeline/deferred-lighting",defines:{CC_ENABLE_CLUSTERED_LIGHT_CULLING:this.enableCluster,CC_RECEIVE_SHADOW:1}});for(var t=0;t<this.deferredLightingMaterial.passes.length;++t)this.deferredLightingMaterial.passes[t].tryCompile()},t}();function Rw(t,e){for(var i,n=f(e.descriptorSetLayoutData.descriptorBlocks);!(i=n()).done;)for(var r=i.value,s=0;s!==r.descriptors.length;++s)if(t===r.descriptors[s].descriptorID)return r.offset+s;return-1}function Cw(t){for(var e,i=g.director.root.pipeline.layoutGraph,n=i.vertices(),r=i.attributeIndex.get(t),s=f(n);!(e=s()).done;)for(var a,o=e.value,h=f(i.getLayout(o).descriptorSets);!(a=h()).done;){var u=a.value;u[0];for(var c,l=u[1],_=f(l.descriptorSetLayoutData.descriptorBlocks);!(c=_()).done;)for(var d,p=f(c.value.descriptors);!(d=p()).done;)if(d.value.descriptorID===r)return Rw(r,l)}return-1}var bw=new Map;function Iw(t){var e=bw.get(t);if(e)return e;var i=g.director.root.pipeline,n=i.layoutGraph.locateChild(i.layoutGraph.nullVertex(),t);U(4294967295!==n);var r=i.layoutGraph.getLayout(n).descriptorSets.get(bI.PER_PASS);return bw.set(t,r),r}var ww=[.0484,.187,.567,1.99,7.41],Ow=[.1,.118,.113,.358,.078],xw=new Wi,Nw=new Wi,Dw=new ki,Mw=new ki;!function(){var t=e.prototype;function e(){this.ssssFov=45/57.3,this.ssssWidth=.01,this.boundingBox=.4,this.ssssScale=3,this._v3SSSSStrength=new Wi(.48,.41,.28),this._v3SSSSFallOff=new Wi(1,.37,.3),this._kernel=[],this._init()}t._gaussian=function(t,e,i){var n=i/(.001+this._v3SSSSFallOff.x);t.x=Math.exp(-n*n/(2*e))/(6.28*e);var r=i/(.001+this._v3SSSSFallOff.y);t.y=Math.exp(-r*r/(2*e))/(6.28*e);var s=i/(.001+this._v3SSSSFallOff.z);t.z=Math.exp(-s*s/(2*e))/(6.28*e)},t._profile=function(t,e){for(var i=0;i<5;i++)this._gaussian(Nw,ww[i],e),Nw.multiplyScalar(Ow[i]),t.add(Nw)},t._updateSampleCount=function(){for(var t=this._v3SSSSStrength,e=0;e<25;e++){var i=.25*e-3,n=i<0?-1:1;this._kernel[e].w=3*n*Math.abs(Math.pow(i,2))/Math.pow(3,2)}for(var r=0;r<25;r++){var s=((r>0?Math.abs(this._kernel[r].w-this._kernel[r-1].w):0)+(r<24?Math.abs(this._kernel[r].w-this._kernel[r+1].w):0))/2;xw.set(0),this._profile(xw,this._kernel[r].w),xw.multiplyScalar(s),this._kernel[r].x=xw.x,this._kernel[r].y=xw.y,this._kernel[r].z=xw.z}Dw.set(this._kernel[12]);for(var a=12;a>0;a--)Mw.set(this._kernel[a-1]),this._kernel[a].set(Mw);this._kernel[0].set(Dw),xw.set(0);for(var o=0;o<25;o++)xw.add3f(this._kernel[o].x,this._kernel[o].y,this._kernel[o].z);for(var h=0;h<25;h++)this._kernel[h].x/=xw.x,this._kernel[h].y/=xw.y,this._kernel[h].z/=xw.z;this._kernel[0].x=1*(1-t.x)+t.x*this._kernel[0].x,this._kernel[0].y=1*(1-t.y)+t.y*this._kernel[0].y,this._kernel[0].z=1*(1-t.z)+t.z*this._kernel[0].z;for(var u=1;u<25;u++)this._kernel[u].x*=t.x,this._kernel[u].y*=t.y,this._kernel[u].z*=t.z},t._updateBlurPass=function(){if(this.ssssBlurMaterial){var t=this.ssssBlurMaterial.passes[0];t.beginChangeStatesSilently(),t.tryCompile(),t.endChangeStatesSilently();var e=this.ssssBlurMaterial.passes[1];e.beginChangeStatesSilently(),e.tryCompile(),e.endChangeStatesSilently();var i=this.ssssBlurMaterial.passes[2];i.beginChangeStatesSilently(),i.tryCompile(),i.endChangeStatesSilently()}},t._init=function(){if(!this.ssssBlurMaterial){this.ssssBlurMaterial=new ZE,this.ssssBlurMaterial._uuid="builtin-ssssBlur-material",this.ssssBlurMaterial.initialize({effectName:"pipeline/ssss-blur"});for(var t=0;t<this.ssssBlurMaterial.passes.length;++t)this.ssssBlurMaterial.passes[t].tryCompile();this._updateBlurPass();for(var e=0;e<25;e++)this._kernel[e]=new ki;this._updateSampleCount()}},n(e,[{key:"ssssStrength",get:function(){return this._v3SSSSStrength},set:function(t){this._v3SSSSStrength=t,this._updateSampleCount()}},{key:"ssssFallOff",get:function(){return this._v3SSSSFallOff},set:function(t){this._v3SSSSFallOff=t,this._updateSampleCount()}},{key:"kernel",get:function(){return this._kernel}}])}(),function(){var t=e.prototype;function e(){this._uvDepthToEyePosParams=new ki,this._radiusParam=new ki,this._miscParam=new ki,this._blurParam=new ki,this._depthTexFullResolution=new pn(1024),this._depthTexResolution=new pn(1024),this._sceneScale=1,this._cameraFov=Ri(45),this._radiusScale=1,this._angleBiasDegree=10,this._aoStrength=1,this._blurSharpness=8,this._aoSaturation=1,this._randomDirAndJitter=[238,91,87,255,251,44,119,255,247,64,250,255,232,5,225,255,253,177,140,255,250,51,84,255,243,76,97,255,252,36,232,255,235,100,24,255,252,36,158,255,254,20,142,255,245,135,124,255,251,43,121,255,253,31,145,255,235,98,160,255,240,146,198,255],this._init(),this.update()}t._init=function(){if(!this.hbaoMaterial){this.hbaoMaterial=new ZE,this.hbaoMaterial.name="builtin-hbao-material",this.hbaoMaterial.initialize({effectName:"pipeline/post-process/hbao"});for(var t=0;t<this.hbaoMaterial.passes.length;++t)this.hbaoMaterial.passes[t].tryCompile();for(var e=Fp.PixelFormat.RGBA8888,i=new Uint8Array(64),n=0;n<this._randomDirAndJitter.length;n++)i[n]=this._randomDirAndJitter[n];var r=new dd({width:4,height:4,_data:i,_compressed:!1,format:e});this.randomTexture=new Fp,this.randomTexture.setFilters(Fp.Filter.NEAREST,Fp.Filter.NEAREST),this.randomTexture.setMipFilter(Fp.Filter.NONE),this.randomTexture.setWrapMode(Fp.WrapMode.REPEAT,Fp.WrapMode.REPEAT,Fp.WrapMode.REPEAT),this.randomTexture.image=r,this.hbaoMaterial.setProperty("RandomTex",this.randomTexture,0)}},t.update=function(){var t=this._radiusScale*this._sceneScale,e=t*t,i=-1/e,n=.1*Math.min(this._depthTexFullResolution.x,this._depthTexFullResolution.y);this._radiusParam.set(t,e,i,n);var r=new pn(this._depthTexResolution.y/this._depthTexResolution.x,1),s=new pn(r.x/Math.tan(.5*this._cameraFov),r.y/Math.tan(.5*this._cameraFov)),a=Math.tan(Ri(this._angleBiasDegree)),o=this._aoStrength;this._miscParam.set(s.x,s.y,a,o);var h=new pn(2/s.x,-2/s.y),u=new pn(-1/s.x,1/s.y);this._uvDepthToEyePosParams.set(h.x,h.y,u.x,u.y);var c=this._sceneScale/this._blurSharpness*1.6651092;this._blurParam.set(.11541560320000001,c,this._blurSharpness/8,this._aoSaturation)},n(e,[{key:"uvDepthToEyePosParams",get:function(){return this._uvDepthToEyePosParams}},{key:"radiusParam",get:function(){return this._radiusParam}},{key:"miscParam",get:function(){return this._miscParam}},{key:"blurParam",get:function(){return this._blurParam}},{key:"depthTexFullResolution",set:function(t){this._depthTexFullResolution.set(t)}},{key:"depthTexResolution",set:function(t){this._depthTexResolution.set(t)}},{key:"sceneScale",set:function(t){this._sceneScale=t}},{key:"cameraFov",set:function(t){this._cameraFov=t}},{key:"radiusScale",set:function(t){this._radiusScale=t}},{key:"angleBiasDegree",set:function(t){this._angleBiasDegree=t}},{key:"aoStrength",set:function(t){this._aoStrength=t}},{key:"blurSharpness",set:function(t){this._blurSharpness=t}},{key:"aoSaturation",set:function(t){this._aoSaturation=t}}])}(),new pn;var Pw=function(){var t=e.prototype;function e(){this.clusters_x_threads=16,this.clusters_y_threads=8,this.clusters_z_threads=1,this.dispatchX=1,this.dispatchY=1,this.dispatchZ=1,this._init()}return t._initMaterial=function(t,e){var i=new ZE;i.name=t,i.initialize({effectName:e});for(var n=0;n<i.passes.length;++n)i.passes[n].tryCompile();return i},t._init=function(){this.clusterBuildCS=this._initMaterial("builtin-cluster-build-cs-material","pipeline/cluster-build"),this.clusterLightCullingCS=this._initMaterial("builtin-cluster-culling-cs-material","pipeline/cluster-culling"),this.dispatchX=16/this.clusters_x_threads,this.dispatchY=8/this.clusters_y_threads,this.dispatchZ=24/this.clusters_z_threads},e}(),Lw=null;function Bw(t,e){!function(t,e){mw(e,t);var i=e.pipelineSceneData,n=80*Di(Math.max(i.validPunctualLights.length,1)),r=vw(t),s="clusterLightBuffer"+r,a="globalIndexBuffer"+r,o=e;o.containsResource(a)||o.addStorageBuffer(a,xc.UNKNOWN,4,wI.PERSISTENT),o.containsResource(s)||o.addStorageBuffer(s,xc.UNKNOWN,n,wI.PERSISTENT),o.updateStorageBuffer(s,n);var h=function(t,e,i,n){for(var r,s=new ArrayBuffer(t),a=new Float32Array(s),o=n.pipelineSceneData,h=i.exposure,u=0,c=f(o.validPunctualLights);!(r=c()).done;){var l=r.value,_=20*u,d=_+0,p=_+4,m=_+8,g=_+12,v=_+16,y=0,E=0,T=void 0;if(l.type===yI.POINT){var S=l;T=S.position,E=S.luminanceLDR,y=S.luminanceHDR,a[m]=0,a[m+1]=S.range,a[m+2]=0,a[m+3]=0}else if(l.type===yI.SPHERE){var A=l;T=A.position,E=A.luminanceLDR,y=A.luminanceHDR,a[m]=A.size,a[m+1]=A.range,a[m+2]=0,a[m+3]=0}else if(l.type===yI.SPOT){var R=l;T=R.position,E=R.luminanceLDR,y=R.luminanceHDR,a[m]=R.size,a[m+1]=R.range,a[m+2]=R.spotAngle,a[m+3]=0;var C=R.direction;a[g]=C.x,a[g+1]=C.y,a[g+2]=C.z,a[g+3]=0}else if(l.type===yI.RANGED_DIRECTIONAL){var b=l;T=b.position,E=b.illuminanceLDR,y=b.illuminanceHDR;var I=b.right;a[m]=I.x,a[m+1]=I.y,a[m+2]=I.z,a[m+3]=0;var w=b.direction;a[g]=w.x,a[g+1]=w.y,a[g+2]=w.z,a[g+3]=0;var O=b.scale;a[v]=.5*O.x,a[v+1]=.5*O.y,a[v+2]=.5*O.z,a[v+3]=0}a[d]=T.x,a[d+1]=T.y,a[d+2]=T.z,a[d+3]=l.type;var x=l.color;if(l.useColorTemperature){var N=l.colorTemperatureRGB;a[p]=x.x*N.x,a[p+1]=x.y*N.y,a[p+2]=x.z*N.z}else a[p]=x.x,a[p+1]=x.y,a[p+2]=x.z;a[p+3]=o.isHDR?y*h*1e4:E,u++}return a[15]=o.validPunctualLights.length,s}(n,0,t,e),u=new ArrayBuffer(4);new Uint32Array(u)[0]=0;var c=new ow(new Uint8Array(h),s),l=new ow(new Uint8Array(u),a);o.addUploadPass([c,l])}(t,e);var i=e;Lw||(Lw=new Pw),function(t,e,i){var n="clusterBuffer"+vw(t);i.containsResource(n)||i.addStorageBuffer(n,xc.UNKNOWN,98304,wI.MANAGED),i.updateStorageBuffer(n,98304);var r=i.addComputePass("cluster-build-cs");r.addStorageBuffer(n,BI.WRITE,"b_clustersBuffer"),r.addQueue().addDispatch(e.dispatchX,e.dispatchY,e.dispatchZ,e.clusterBuildCS,0);var s=t.width*i.pipelineSceneData.shadingScale,a=t.height*i.pipelineSceneData.shadingScale;r.setVec4("cc_nearFar",new ki(t.nearClip,t.farClip,t.getClipSpaceMinz(),0)),r.setVec4("cc_viewPort",new ki(0,0,s,a)),r.setVec4("cc_workGroup",new ki(16,8,24,0)),r.setMat4("cc_matView",t.matView),r.setMat4("cc_matProjInv",t.matProjInv)}(t,Lw,i),function(t,e,i){var n=vw(t),r="clusterBuffer"+n,s="clusterLightBuffer"+n,a="globalIndexBuffer"+n,o="clusterLightIndicesBuffer"+n,h="clusterLightGridBuffer"+n;i.containsResource(o)||i.addStorageBuffer(o,xc.UNKNOWN,1228800,wI.MANAGED),i.containsResource(h)||i.addStorageBuffer(h,xc.UNKNOWN,49152,wI.MANAGED);var u=i.addComputePass("cluster-culling-cs");u.addStorageBuffer(s,BI.READ,"b_ccLightsBuffer"),u.addStorageBuffer(r,BI.READ,"b_clustersBuffer"),u.addStorageBuffer(o,BI.WRITE,"b_clusterLightIndicesBuffer"),u.addStorageBuffer(h,BI.WRITE,"b_clusterLightGridBuffer"),u.addStorageBuffer(a,BI.WRITE,"b_globalIndexBuffer"),u.addQueue().addDispatch(e.dispatchX,e.dispatchY,e.dispatchZ,e.clusterLightCullingCS,0);var c=t.width*i.pipelineSceneData.shadingScale,l=t.height*i.pipelineSceneData.shadingScale;u.setVec4("cc_nearFar",new ki(t.nearClip,t.farClip,t.getClipSpaceMinz(),0)),u.setVec4("cc_viewPort",new ki(c,l,c,l)),u.setVec4("cc_workGroup",new ki(16,8,24,0)),u.setMat4("cc_matView",t.matView),u.setMat4("cc_matProjInv",t.matProjInv)}(t,Lw,i)}var Fw,Uw,kw,Gw,Hw,zw=new Gl(Vc.LINEAR,Vc.LINEAR,Vc.NONE,Wc.CLAMP,Wc.CLAMP,Wc.CLAMP),Vw=new Gl(Vc.POINT,Vc.POINT,Vc.NONE,Wc.CLAMP,Wc.CLAMP,Wc.CLAMP),Ww=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(zw),this._pointSampler=this._device.getSampler(Vw);var e=new u_(Xm.bindings);this._descriptorSetLayout=this._device.createDescriptorSetLayout(e),this._globalDescriptorSet=this._device.createDescriptorSet(new c_(this._descriptorSetLayout))}var e=t.prototype;return e.regenLayout=function(){var t=new u_(Xm.bindings);this._descriptorSetLayout=this._device.createDescriptorSetLayout(t),this._globalDescriptorSet=this._device.createDescriptorSet(new c_(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=Rv()?Iw("default").descriptorSet:this._globalDescriptorSet,n=e.createDescriptorSet(new c_(Rv()?Iw("default").descriptorSetLayout:this._descriptorSetLayout));this._descriptorSetMap.set(t,n);for(var r=Wm.UBO_GLOBAL;r<Wm.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 Ml(Mc.UNIFORM|Mc.TRANSFER_DST,Bc.HOST|Bc.DEVICE,ng.SIZE,ng.SIZE)),a=Rv()?Cw("CCShadow"):ng.BINDING;n.bindBuffer(a,s),n.update()}return this._descriptorSetMap.get(t)},e.destroy=function(){this._descriptorSetLayout.destroy()},n(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},set:function(t){this._globalDescriptorSet=t}}]),t}(),Xw=new cn,jw=new cn,Yw=new cn,Kw=new ki,qw=new ki(0,0,1,0),Qw=new Wi,Zw=function(){function t(){this._globalUBO=new Float32Array(eg.COUNT),this._cameraUBO=new Float32Array(ig.COUNT),this._shadowUBO=new Float32Array(ng.COUNT),this._csmUBO=new Float32Array(rg.COUNT)}t.updateGlobalUBOView=function(t,e){var i=g.director,n=i.root,r=e,s=Math.floor(t.width),a=Math.floor(t.height);r[eg.TIME_OFFSET]=n.cumulativeTime,r[eg.TIME_OFFSET+1]=n.frameTime,r[eg.TIME_OFFSET+2]=i.getTotalFrames(),r[eg.TIME_OFFSET+3]=n.cumulativeTime-Math.floor(n.frameTime),r[eg.SCREEN_SIZE_OFFSET]=s,r[eg.SCREEN_SIZE_OFFSET+1]=a,r[eg.SCREEN_SIZE_OFFSET+2]=1/s,r[eg.SCREEN_SIZE_OFFSET+3]=1/a,r[eg.NATIVE_SIZE_OFFSET]=s,r[eg.NATIVE_SIZE_OFFSET+1]=a,r[eg.NATIVE_SIZE_OFFSET+2]=1/r[eg.NATIVE_SIZE_OFFSET],r[eg.NATIVE_SIZE_OFFSET+3]=1/r[eg.NATIVE_SIZE_OFFSET+1],g.internal.reflectionProbeManager&&(r[eg.PROBE_INFO_OFFSET]=g.internal.reflectionProbeManager.getMaxProbeId()+1);var o=n.debugView;r[eg.DEBUG_VIEW_MODE_OFFSET]=o.singleMode;for(var h=1;h<=3;h++)r[eg.DEBUG_VIEW_MODE_OFFSET+h]=0;for(var u=0;u<17;u++){var c=u%8;r[eg.DEBUG_VIEW_MODE_OFFSET+1+(u>>3)]+=(o.isCompositeModeEnabled(u)?1:0)*Math.pow(10,c)}r[eg.DEBUG_VIEW_MODE_OFFSET+3]+=(o.lightingWithAlbedo?1:0)*Math.pow(10,6),r[eg.DEBUG_VIEW_MODE_OFFSET+3]+=(o.csmLayerColoration?1:0)*Math.pow(10,7)},t.updateCameraUBOView=function(t,e,i){var n,r=(i.scene?i.scene:g.director.getScene().renderScene).mainLight,s=t.pipelineSceneData,a=s.ambient,o=s.skybox,h=s.fog,u=s.shadows,c=e,l=i.exposure,_=s.isHDR;if(c[ig.SCREEN_SCALE_OFFSET]=s.shadingScale,c[ig.SCREEN_SCALE_OFFSET+1]=s.shadingScale,c[ig.SCREEN_SCALE_OFFSET+2]=1/c[ig.SCREEN_SCALE_OFFSET],c[ig.SCREEN_SCALE_OFFSET+3]=1/c[ig.SCREEN_SCALE_OFFSET+1],c[ig.EXPOSURE_OFFSET]=l,c[ig.EXPOSURE_OFFSET+1]=1/l,c[ig.EXPOSURE_OFFSET+2]=_?1:0,c[ig.EXPOSURE_OFFSET+3]=1/Wb.standardExposureValue,r){var f=r.shadowEnabled&&u.type===$E.ShadowMap?1:0,d=r.direction;if(qw.set(d.x,d.y,d.z,f),ki.toArray(c,qw,ig.MAIN_LIT_DIR_OFFSET),Wi.toArray(c,r.color,ig.MAIN_LIT_COLOR_OFFSET),r.useColorTemperature){var p=r.colorTemperatureRGB;c[ig.MAIN_LIT_COLOR_OFFSET]*=p.x,c[ig.MAIN_LIT_COLOR_OFFSET+1]*=p.y,c[ig.MAIN_LIT_COLOR_OFFSET+2]*=p.z}c[ig.MAIN_LIT_COLOR_OFFSET+3]=_?r.illuminance*l:r.illuminance}else qw.set(0,0,1,0),ki.toArray(c,qw,ig.MAIN_LIT_DIR_OFFSET),ki.toArray(c,ki.ZERO,ig.MAIN_LIT_COLOR_OFFSET);var m=a.skyColor;m.w=_?a.skyIllum*l:a.skyIllum,c[ig.AMBIENT_SKY_OFFSET+0]=m.x,c[ig.AMBIENT_SKY_OFFSET+1]=m.y,c[ig.AMBIENT_SKY_OFFSET+2]=m.z,c[ig.AMBIENT_SKY_OFFSET+3]=m.w,c[ig.AMBIENT_GROUND_OFFSET+0]=a.groundAlbedo.x,c[ig.AMBIENT_GROUND_OFFSET+1]=a.groundAlbedo.y,c[ig.AMBIENT_GROUND_OFFSET+2]=a.groundAlbedo.z,c[ig.AMBIENT_GROUND_OFFSET+3]=o.envmap?null===(n=o.envmap)||void 0===n?void 0:n.mipmapLevel:1,cn.toArray(c,i.matView,ig.MAT_VIEW_OFFSET),cn.toArray(c,i.node.worldMatrix,ig.MAT_VIEW_INV_OFFSET),Wi.toArray(c,i.position,ig.CAMERA_POS_OFFSET),cn.toArray(c,i.matProj,ig.MAT_PROJ_OFFSET),cn.toArray(c,i.matProjInv,ig.MAT_PROJ_INV_OFFSET),cn.toArray(c,i.matViewProj,ig.MAT_VIEW_PROJ_OFFSET),cn.toArray(c,i.matViewProjInv,ig.MAT_VIEW_PROJ_INV_OFFSET),c[ig.CAMERA_POS_OFFSET+3]=this.getCombineSignY(),c[ig.SURFACE_TRANSFORM_OFFSET]=i.surfaceTransform,c[ig.SURFACE_TRANSFORM_OFFSET+1]=i.cameraUsage,c[ig.SURFACE_TRANSFORM_OFFSET+2]=Math.cos(Ri(s.skybox.getRotationAngle())),c[ig.SURFACE_TRANSFORM_OFFSET+3]=Math.sin(Ri(s.skybox.getRotationAngle()));var v=h.colorArray;c[ig.GLOBAL_FOG_COLOR_OFFSET]=v.x,c[ig.GLOBAL_FOG_COLOR_OFFSET+1]=v.y,c[ig.GLOBAL_FOG_COLOR_OFFSET+2]=v.z,c[ig.GLOBAL_FOG_COLOR_OFFSET+3]=v.z,c[ig.GLOBAL_FOG_BASE_OFFSET]=h.fogStart,c[ig.GLOBAL_FOG_BASE_OFFSET+1]=h.fogEnd,c[ig.GLOBAL_FOG_BASE_OFFSET+2]=h.fogDensity,c[ig.GLOBAL_FOG_ADD_OFFSET]=h.fogTop,c[ig.GLOBAL_FOG_ADD_OFFSET+1]=h.fogRange,c[ig.GLOBAL_FOG_ADD_OFFSET+2]=h.fogAtten,c[ig.NEAR_FAR_OFFSET]=i.nearClip,c[ig.NEAR_FAR_OFFSET+1]=i.farClip,c[ig.NEAR_FAR_OFFSET+2]=i.getClipSpaceMinz(),c[ig.VIEW_PORT_OFFSET]=s.shadingScale*i.window.width*i.viewport.x,c[ig.VIEW_PORT_OFFSET+1]=s.shadingScale*i.window.height*i.viewport.y,c[ig.VIEW_PORT_OFFSET+2]=s.shadingScale*i.window.width*i.viewport.z,c[ig.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 tT.HARD:return 0;case tT.SOFT:return 1/(.5*i);case tT.SOFT_2X:return 2/(.5*i);case tT.SOFT_4X:return 3/(.5*i)}return 0},t.updatePlanarNormalAndDistance=function(t,e){Wi.normalize(Qw,t.normal),e[ng.PLANAR_NORMAL_DISTANCE_INFO_OFFSET+0]=Qw.x,e[ng.PLANAR_NORMAL_DISTANCE_INFO_OFFSET+1]=Qw.y,e[ng.PLANAR_NORMAL_DISTANCE_INFO_OFFSET+2]=Qw.z,e[ng.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,h=o.shadows,u=o.csmLayers,c=i,l=n,_=o.csmSupported,f=Sv(s)?0:1;if(a&&h.enabled){if(h.type===$E.ShadowMap){if(a.shadowEnabled){if(a.shadowFixedArea||a.csmLevel===eT.LEVEL_1||!_){var d=u.specialLayer.matShadowView,p=u.specialLayer.matShadowProj,m=u.specialLayer.matShadowViewProj,g=.1,v=0,y=0;a.shadowFixedArea?(g=a.shadowNear,v=a.shadowFar,y=0):(v=u.specialLayer.shadowCameraFar,y=1),cn.toArray(c,d,ng.MAT_LIGHT_VIEW_OFFSET),c[ng.SHADOW_PROJ_DEPTH_INFO_OFFSET+0]=p.m10,c[ng.SHADOW_PROJ_DEPTH_INFO_OFFSET+1]=p.m14,c[ng.SHADOW_PROJ_DEPTH_INFO_OFFSET+2]=p.m11,c[ng.SHADOW_PROJ_DEPTH_INFO_OFFSET+3]=p.m15,c[ng.SHADOW_PROJ_INFO_OFFSET+0]=p.m00,c[ng.SHADOW_PROJ_INFO_OFFSET+1]=p.m05,c[ng.SHADOW_PROJ_INFO_OFFSET+2]=1/p.m00,c[ng.SHADOW_PROJ_INFO_OFFSET+3]=1/p.m05,cn.toArray(c,m,ng.MAT_LIGHT_VIEW_PROJ_OFFSET),Kw.set(g,v,0,1-a.shadowSaturation),ki.toArray(c,Kw,ng.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET),Kw.set(yI.DIRECTIONAL,f,a.shadowNormalBias,y),ki.toArray(c,Kw,ng.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET)}else{for(var E=this.getPCFRadius(h,a),T=0;T<a.csmLevel;T++){var S=u.layers[T],A=S.matShadowView;Kw.set(A.m00,A.m04,A.m08,E),ki.toArray(l,Kw,rg.CSM_VIEW_DIR_0_OFFSET+4*T),Kw.set(A.m01,A.m05,A.m09,S.splitCameraNear),ki.toArray(l,Kw,rg.CSM_VIEW_DIR_1_OFFSET+4*T),Kw.set(A.m02,A.m06,A.m10,S.splitCameraFar),ki.toArray(l,Kw,rg.CSM_VIEW_DIR_2_OFFSET+4*T);var R=S.csmAtlas;ki.toArray(l,R,rg.CSM_ATLAS_OFFSET+4*T);var C=S.matShadowViewProj;cn.toArray(l,C,rg.MAT_CSM_VIEW_PROJ_OFFSET+16*T);var b=S.matShadowProj;l[rg.CSM_PROJ_DEPTH_INFO_OFFSET+0+4*T]=b.m10,l[rg.CSM_PROJ_DEPTH_INFO_OFFSET+1+4*T]=b.m14,l[rg.CSM_PROJ_DEPTH_INFO_OFFSET+2+4*T]=b.m11,l[rg.CSM_PROJ_DEPTH_INFO_OFFSET+3+4*T]=b.m15,l[rg.CSM_PROJ_INFO_OFFSET+0+4*T]=b.m00,l[rg.CSM_PROJ_INFO_OFFSET+1+4*T]=b.m05,l[rg.CSM_PROJ_INFO_OFFSET+2+4*T]=1/b.m00,l[rg.CSM_PROJ_INFO_OFFSET+3+4*T]=1/b.m05}Kw.set(a.csmTransitionRange,0,0,0),ki.toArray(l,Kw,rg.CSM_SPLITS_INFO_OFFSET),Kw.set(.1,a.shadowDistance,0,1-a.shadowSaturation),ki.toArray(c,Kw,ng.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET),Kw.set(yI.DIRECTIONAL,f,a.shadowNormalBias,a.csmLevel),ki.toArray(c,Kw,ng.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET)}Kw.set(h.size.x,h.size.y,a.shadowPcf,a.shadowBias),ki.toArray(c,Kw,ng.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET)}}else t.updatePlanarNormalAndDistance(h,c);qi.toArray(c,h.shadowColor,ng.SHADOW_COLOR_OFFSET)}},t.updateShadowUBOLightView=function(t,e,i,n){var r=t.device,s=t.pipelineSceneData,a=s.shadows,o=s.csmLayers,h=e,u=Sv(r)?0:1,c=t.device.capabilities,l=s.csmSupported;switch(i.type){case yI.DIRECTIONAL:var _=i;if(a.enabled&&_&&_.shadowEnabled&&a.type===$E.ShadowMap){var f,d,p,m=.1,g=0,v=0;if(_.shadowFixedArea||_.csmLevel===eT.LEVEL_1||!l)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),Kw.set(yI.DIRECTIONAL,u,_.shadowNormalBias,0),ki.toArray(h,Kw,ng.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}cn.toArray(h,f,ng.MAT_LIGHT_VIEW_OFFSET),h[ng.SHADOW_PROJ_DEPTH_INFO_OFFSET+0]=d.m10,h[ng.SHADOW_PROJ_DEPTH_INFO_OFFSET+1]=d.m14,h[ng.SHADOW_PROJ_DEPTH_INFO_OFFSET+2]=d.m11,h[ng.SHADOW_PROJ_DEPTH_INFO_OFFSET+3]=d.m15,h[ng.SHADOW_PROJ_INFO_OFFSET+0]=d.m00,h[ng.SHADOW_PROJ_INFO_OFFSET+1]=d.m05,h[ng.SHADOW_PROJ_INFO_OFFSET+2]=1/d.m00,h[ng.SHADOW_PROJ_INFO_OFFSET+3]=1/d.m05,cn.toArray(h,p,ng.MAT_LIGHT_VIEW_PROJ_OFFSET),Kw.set(m,g,0,1-_.shadowSaturation),ki.toArray(h,Kw,ng.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET),Kw.set(yI.DIRECTIONAL,u,_.shadowNormalBias,v),ki.toArray(h,Kw,ng.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET),Kw.set(a.size.x,a.size.y,_.shadowPcf,_.shadowBias),ki.toArray(h,Kw,ng.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET)}break;case yI.SPOT:var E=i;a.enabled&&E&&E.shadowEnabled&&(cn.invert(Xw,i.node.getWorldMatrix()),cn.toArray(h,Xw,ng.MAT_LIGHT_VIEW_OFFSET),cn.perspective(jw,i.angle,1,.001,i.range,!0,c.clipSpaceMinZ,c.clipSpaceSignY,0),cn.multiply(Yw,jw,Xw),cn.toArray(h,Yw,ng.MAT_LIGHT_VIEW_PROJ_OFFSET),Kw.set(.01,i.range,0,0),ki.toArray(h,Kw,ng.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET),Kw.set(a.size.x,a.size.y,E.shadowPcf,E.shadowBias),ki.toArray(h,Kw,ng.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET),Kw.set(yI.SPOT,u,E.shadowNormalBias,0),ki.toArray(h,Kw,ng.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET))}qi.toArray(h,a.shadowColor,ng.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;if(!Rv()){this._initCombineSignY();var n=t.createBuffer(new Ml(Mc.UNIFORM|Mc.TRANSFER_DST,Bc.HOST|Bc.DEVICE,eg.SIZE,eg.SIZE));i.bindBuffer(eg.BINDING,n);var r=t.createBuffer(new Ml(Mc.UNIFORM|Mc.TRANSFER_DST,Bc.HOST|Bc.DEVICE,ig.SIZE,ig.SIZE));i.bindBuffer(ig.BINDING,r);var s=t.createBuffer(new Ml(Mc.UNIFORM|Mc.TRANSFER_DST,Bc.HOST|Bc.DEVICE,ng.SIZE,ng.SIZE)),a=Rv()?Cw("CCShadow"):ng.BINDING;i.bindBuffer(a,s);var o=t.createBuffer(new Ml(Mc.UNIFORM|Mc.TRANSFER_DST,Bc.HOST|Bc.DEVICE,rg.SIZE,rg.SIZE)),h=Rv()?Cw("CCCSM"):rg.BINDING;i.bindBuffer(h,o)}},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(eg.BINDING),this._globalUBO),i.bindBuffer(eg.BINDING,n.getBuffer(eg.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(ig.BINDING),this._cameraUBO),i.bindBuffer(ig.BINDING,n.getBuffer(ig.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(sg,s.get(a).colorTextures[0]),t.updateShadowUBOView(this._pipeline,this._shadowUBO,this._csmUBO,e),n.update();var o=Rv()?Cw("CCShadow"):ng.BINDING;r[0].updateBuffer(n.getBuffer(o),this._shadowUBO);var h=Rv()?Cw("CCCSM"):rg.BINDING;r[0].updateBuffer(n.getBuffer(h),this._csmUBO)}},e.updateShadowUBOLight=function(e,i,n){void 0===n&&(n=0),t.updateShadowUBOLightView(this._pipeline,this._shadowUBO,i,n),e.bindTexture(sg,IE.get("default-texture").getGFXTexture()),e.bindTexture(dg,IE.get("default-texture").getGFXTexture()),e.update();var r=Rv()?Cw("CCShadow"):ng.BINDING;this._pipeline.commandBuffers[0].updateBuffer(e.getBuffer(r),this._shadowUBO)},e.updateShadowUBORange=function(t,e){e instanceof cn?cn.toArray(this._shadowUBO,e,t):e instanceof qi&&qi.toArray(this._shadowUBO,e,t)},e.destroy=function(){},t}();Zw._combineSignY=0;var Jw,$w,tO,eO,iO,nO,rO,sO,aO=t("RenderStage",bs("RenderStage")((Uw=function(){function t(){this._name=kw&&kw(),this._priority=Gw&&Gw(),this._enabled=!0,this._tag=Hw&&Hw(),this._pipeline=void 0,this._flow=void 0}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},n(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}(),kw=gs(Uw.prototype,"_name",[Ls],(function(){return""})),Gw=gs(Uw.prototype,"_priority",[Ls],(function(){return 0})),Hw=gs(Uw.prototype,"_tag",[Ls],(function(){return 0})),Fw=Uw))||Fw);g.RenderStage=aO;var oO,hO=t("RenderFlow",(Jw=bs("RenderFlow"),$w=sa([aO]),Jw((eO=function(){function t(){this._name=iO&&iO(),this._priority=nO&&nO(),this._tag=rO&&rO(),this._stages=sO&&sO(),this._pipeline=void 0}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},n(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}(),iO=gs(eO.prototype,"_name",[Ls],(function(){return""})),nO=gs(eO.prototype,"_priority",[Ls],(function(){return 0})),rO=gs(eO.prototype,"_tag",[Ls],(function(){return 0})),sO=gs(eO.prototype,"_stages",[$w,Ls],(function(){return[]})),tO=eO))||tO));g.RenderFlow=hO,t("PipelineEventType",oO),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"}(oO||t("PipelineEventType",oO={}));var uO,cO,lO,_O,fO,dO,pO,mO,gO,vO,yO,EO,TO,SO,AO,RO,CO,bO,IO,wO,OO,xO,NO,DO,MO,PO,LO,BO,FO,UO,kO,GO,HO,zO,VO,WO,XO,jO,YO,KO,qO,QO,ZO,JO,$O,tx,ex,ix,nx,rx,sx,ax,ox,hx,ux,cx,lx,_x,fx,dx,px,mx,gx,vx,yx,Ex,Tx,Sx,Ax,Rx,Cx,bx,Ix,wx,Ox,xx,Nx,Dx,Mx,Px,Lx,Bx,Fx,Ux,kx,Gx,Hx,zx,Vx,Wx,Xx=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}s(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}(Uu)),jx=new Tl,Yx=new wl,Kx=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},qx=function(){this.quadIB=null,this.quadVB=null,this.quadIA=null},Qx=t("RenderPipeline",(uO=bs("cc.RenderPipeline"),cO=sa([hO]),uO((_O=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)._tag=fO&&fO(),e._flows=dO&&dO(),e._quadIB=null,e._quadVBOnscreen=null,e._quadVBOffscreen=null,e._quadIAOnscreen=null,e._quadIAOffscreen=null,e._eventProcessor=new Xx,e._device=void 0,e._globalDSManager=void 0,e._descriptorSet=void 0,e._commandBuffers=[],e._pipelineUBO=new Zw,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 Tl,e._clusterEnabled=!1,e._bloomEnabled=!1,e}s(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 $l,s=new t_;r.format=e,s.format=i,s.stencilStoreOp=Jc.DISCARD,s.depthStoreOp=Jc.DISCARD,t&_l.COLOR||(t&zb?r.loadOp=Zc.CLEAR:(r.loadOp=Zc.LOAD,r.barrier=n.getGeneralBarrier(new r_($c.COLOR_ATTACHMENT_WRITE,$c.COLOR_ATTACHMENT_WRITE)))),(t&_l.DEPTH_STENCIL)!==_l.DEPTH_STENCIL&&(t&_l.DEPTH||(s.depthLoadOp=Zc.LOAD),t&_l.STENCIL||(s.stencilLoadOp=Zc.LOAD)),s.barrier=n.getGeneralBarrier(new r_($c.DEPTH_STENCIL_ATTACHMENT_WRITE,$c.DEPTH_STENCIL_ATTACHMENT_WRITE));var a=new n_([r],s);return n.createRenderPass(a)},i.getRenderPass=function(t,e){var i=function(t){for(var e,i=666,n=f(t.colorTextures);!(e=n()).done;){var r=e.value,s=null==r?void 0:r.info;i=vc(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=vc(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=vc(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 o_(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,jx),e||(e=Yx);var i=this.pipelineSceneData.shadingScale;return e.left=jx.x*i,e.top=jx.y*i,e.width=jx.width*i,e.height=jx.height*i,e},i.generateScissor=function(t,e){e||(e=jx),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=_f.gfxDevice,this._generateConstantMacros(),this._globalDSManager=new Ww(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(oO.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(YE=i)}YE=null}(t);for(var e=0;e<t.length;e++){var i=t[e];if(i.scene){this.emit(oO.RENDER_CAMERA_BEGIN,i),Zb(this,i),Jb(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(oO.RENDER_CAMERA_END,i)}}this.emit(oO.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 h=0;switch(t){case wc.IDENTITY:h=0,i[h++]=-1,i[h++]=-1,i[h++]=n,i[h++]=a,i[h++]=1,i[h++]=-1,i[h++]=r,i[h++]=a,i[h++]=-1,i[h++]=1,i[h++]=n,i[h++]=s,i[h++]=1,i[h++]=1,i[h++]=r,i[h++]=s;break;case wc.ROTATE_90:h=0,i[h++]=-1,i[h++]=-1,i[h++]=r,i[h++]=a,i[h++]=1,i[h++]=-1,i[h++]=r,i[h++]=s,i[h++]=-1,i[h++]=1,i[h++]=n,i[h++]=a,i[h++]=1,i[h++]=1,i[h++]=n,i[h++]=s;break;case wc.ROTATE_180:h=0,i[h++]=-1,i[h++]=-1,i[h++]=n,i[h++]=s,i[h++]=1,i[h++]=-1,i[h++]=r,i[h++]=s,i[h++]=-1,i[h++]=1,i[h++]=n,i[h++]=a,i[h++]=1,i[h++]=1,i[h++]=r,i[h++]=a;break;case wc.ROTATE_270:h=0,i[h++]=-1,i[h++]=-1,i[h++]=n,i[h++]=s,i[h++]=1,i[h++]=-1,i[h++]=n,i[h++]=a,i[h++]=-1,i[h++]=1,i[h++]=r,i[h++]=s,i[h++]=1,i[h++]=1,i[h++]=r,i[h++]=a}return i},i._createQuadInputAssembler=function(){var t=new qx,e=4*Float32Array.BYTES_PER_ELEMENT,i=4*e,n=this._device.createBuffer(new Ml(Mc.VERTEX|Mc.TRANSFER_DST,Bc.DEVICE|Bc.HOST,i,e));if(!n)return t;var r=Uint8Array.BYTES_PER_ELEMENT,s=6*r,a=this._device.createBuffer(new Ml(Mc.INDEX|Mc.TRANSFER_DST,Bc.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 h=new Array(2);h[0]=new Ql("a_position",xc.RG32F),h[1]=new Ql("a_texCoord",xc.RG32F);var u=this._device.createInputAssembler(new Jl(h,[n],a));return t.quadIB=a,t.quadVB=n,t.quadIA=u,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(wc.IDENTITY,t);this._quadVBOffscreen.update(n);var r=this._genQuadVertexData(e.swapchain&&e.swapchain.surfaceTransform||wc.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(xc.RGBA32F)&(Gc.RENDER_TARGET|Gc.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(Oc.INPUT_ATTACHMENT_BENEFIT)?1:0)+"\n",t+="#define CC_PLATFORM_ANDROID_AND_WEBGL "+(Yu.os===zu.ANDROID&&Yu.isBrowser?1:0)+"\n",t+="#define CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES "+(Te.ENABLE_WEBGL_HIGHP_STRUCT_VALUES?1:0)+"\n",t+="#define CC_JOINT_UNIFORM_CAPACITY "+bg.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 Kx,e=this.device,i=new $l;i.format=xc.RGBA8,i.loadOp=Zc.CLEAR,i.storeOp=Jc.STORE,i.barrier=e.getGeneralBarrier(new r_($c.NONE,$c.COLOR_ATTACHMENT_WRITE)),t.renderPass=e.createRenderPass(new n_([i]));var n=this._width,r=this._height;t.prefiterTex=e.createTexture(new Ul(Fc.TEX2D,Uc.COLOR_ATTACHMENT|Uc.SAMPLED,xc.RGBA8,n>>1,r>>1)),t.prefilterFramebuffer=e.createFramebuffer(new o_(t.renderPass,[t.prefiterTex])),n>>=1,r>>=1;for(var s=0;s<6;++s)t.downsampleTexs.push(e.createTexture(new Ul(Fc.TEX2D,Uc.COLOR_ATTACHMENT|Uc.SAMPLED,xc.RGBA8,n>>1,r>>1))),t.downsampleFramebuffers[s]=e.createFramebuffer(new o_(t.renderPass,[t.downsampleTexs[s]])),t.upsampleTexs.push(e.createTexture(new Ul(Fc.TEX2D,Uc.COLOR_ATTACHMENT|Uc.SAMPLED,xc.RGBA8,n,r))),t.upsampleFramebuffers[s]=e.createFramebuffer(new o_(t.renderPass,[t.upsampleTexs[s]])),n>>=1,r>>=1;t.combineTex=e.createTexture(new Ul(Fc.TEX2D,Uc.COLOR_ATTACHMENT|Uc.SAMPLED,xc.RGBA8,this._width,this._height)),t.combineFramebuffer=e.createFramebuffer(new o_(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)},n(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(oO.ATTACHMENT_SCALE_CAHNGED,t))}}]),e}(jf),fO=gs(_O.prototype,"_tag",[Ls],(function(){return 0})),dO=gs(_O.prototype,"_flows",[cO,Ls],(function(){return[]})),lO=_O))||lO));g.RenderPipeline=Qx,rt(Qx.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"}(pO||(pO={})),function(t){t[t.AR=5]="AR",t[t.FORWARD=10]="FORWARD"}(mO||(mO={})),function(t){t[t.SHADOW=0]="SHADOW",t[t.FORWARD=1]="FORWARD",t[t.UI=10]="UI"}(gO||(gO={})),function(t){t[t.GBUFFER=10]="GBUFFER",t[t.LIGHTING=15]="LIGHTING",t[t.TRANSPARENT=18]="TRANSPARENT"}(vO||(vO={})),function(t){t[t.SHADOW=0]="SHADOW",t[t.MAIN=1]="MAIN",t[t.UI=10]="UI"}(yO||(yO={})),me(Fc),me(Uc),me(Jc),me(Zc),me($c),me(xc),function(t){t[t.SCENE=0]="SCENE",t[t.POSTPROCESS=1]="POSTPROCESS",t[t.UI=2]="UI"}(Wx||(Wx={})),me(Wx),EO=bs("RenderTextureDesc"),TO=sa(Fc),SO=sa(Uc),AO=sa(xc),EO((RO=function(){this.name=CO&&CO(),this.type=bO&&bO(),this.usage=IO&&IO(),this.format=wO&&wO(),this.width=OO&&OO(),this.height=xO&&xO()},CO=gs(RO.prototype,"name",[Ls],(function(){return""})),bO=gs(RO.prototype,"type",[TO],(function(){return Fc.TEX2D})),IO=gs(RO.prototype,"usage",[SO],(function(){return Uc.COLOR_ATTACHMENT})),wO=gs(RO.prototype,"format",[AO],(function(){return xc.UNKNOWN})),OO=gs(RO.prototype,"width",[Ls],(function(){return-1})),xO=gs(RO.prototype,"height",[Ls],(function(){return-1})),RO));var Zx=(NO=bs("RenderTextureConfig"),DO=sa(hI),NO((PO=function(){this.name=LO&&LO(),this.texture=BO&&BO()},LO=gs(PO.prototype,"name",[Ls],(function(){return""})),BO=gs(PO.prototype,"texture",[DO],(function(){return null})),MO=PO))||MO);FO=bs("MaterialConfig"),UO=sa(ZE),FO((kO=function(){this.name=GO&&GO(),this.material=HO&&HO()},GO=gs(kO.prototype,"name",[Ls],(function(){return""})),HO=gs(kO.prototype,"material",[UO],(function(){return null})),kO)),zO=bs("FrameBufferDesc"),VO=sa([je]),WO=sa(hI),zO((XO=function(){this.name=jO&&jO(),this.renderPass=YO&&YO(),this.colorTextures=KO&&KO(),this.depthStencilTexture=qO&&qO(),this.texture=QO&&QO()},jO=gs(XO.prototype,"name",[Ls],(function(){return""})),YO=gs(XO.prototype,"renderPass",[Ls],(function(){return 0})),KO=gs(XO.prototype,"colorTextures",[VO],(function(){return[]})),qO=gs(XO.prototype,"depthStencilTexture",[Ls],(function(){return""})),QO=gs(XO.prototype,"texture",[WO],(function(){return null})),XO));var Jx,$x=(ZO=bs("ColorDesc"),JO=sa(xc),$O=sa(Zc),tx=sa(Jc),ex=sa($c),ix=sa($c),ZO((rx=function(){this.format=sx&&sx(),this.loadOp=ax&&ax(),this.storeOp=ox&&ox(),this.sampleCount=hx&&hx(),this.beginAccesses=ux&&ux(),this.endAccesses=cx&&cx()},sx=gs(rx.prototype,"format",[JO],(function(){return xc.UNKNOWN})),ax=gs(rx.prototype,"loadOp",[$O],(function(){return Zc.CLEAR})),ox=gs(rx.prototype,"storeOp",[tx],(function(){return Jc.STORE})),hx=gs(rx.prototype,"sampleCount",[Ls],(function(){return 1})),ux=gs(rx.prototype,"beginAccesses",[ex],(function(){return $c.NONE})),cx=gs(rx.prototype,"endAccesses",[ix],(function(){return $c.COLOR_ATTACHMENT_WRITE})),nx=rx))||nx),tN=(lx=bs("DepthStencilDesc"),_x=sa(xc),fx=sa(Zc),dx=sa(Jc),px=sa(Zc),mx=sa(Jc),gx=sa($c),vx=sa($c),lx((Ex=function(){this.format=Tx&&Tx(),this.depthLoadOp=Sx&&Sx(),this.depthStoreOp=Ax&&Ax(),this.stencilLoadOp=Rx&&Rx(),this.stencilStoreOp=Cx&&Cx(),this.sampleCount=bx&&bx(),this.beginAccesses=Ix&&Ix(),this.endAccesses=wx&&wx()},Tx=gs(Ex.prototype,"format",[_x],(function(){return xc.UNKNOWN})),Sx=gs(Ex.prototype,"depthLoadOp",[fx],(function(){return Zc.CLEAR})),Ax=gs(Ex.prototype,"depthStoreOp",[dx],(function(){return Jc.STORE})),Rx=gs(Ex.prototype,"stencilLoadOp",[px],(function(){return Zc.CLEAR})),Cx=gs(Ex.prototype,"stencilStoreOp",[mx],(function(){return Jc.STORE})),bx=gs(Ex.prototype,"sampleCount",[Ls],(function(){return 1})),Ix=gs(Ex.prototype,"beginAccesses",[gx],(function(){return $c.NONE})),wx=gs(Ex.prototype,"endAccesses",[vx],(function(){return $c.DEPTH_STENCIL_ATTACHMENT_WRITE})),yx=Ex))||yx);Ox=bs("RenderPassDesc"),xx=sa([$x]),Nx=sa(tN),Ox((Dx=function(){this.index=Mx&&Mx(),this.colorAttachments=Px&&Px(),this.depthStencilAttachment=Lx&&Lx()},Mx=gs(Dx.prototype,"index",[Ls],(function(){return-1})),Px=gs(Dx.prototype,"colorAttachments",[xx],(function(){return[]})),Lx=gs(Dx.prototype,"depthStencilAttachment",[Nx],(function(){return new tN})),Dx)),function(t){t[t.FRONT_TO_BACK=0]="FRONT_TO_BACK",t[t.BACK_TO_FRONT=1]="BACK_TO_FRONT"}(Jx||(Jx={})),me(Jx);var eN=(Bx=bs("RenderQueueDesc"),Fx=sa(Jx),Ux=sa([je]),Bx((Gx=function(){this.isTransparent=Hx&&Hx(),this.sortMode=zx&&zx(),this.stages=Vx&&Vx()},Hx=gs(Gx.prototype,"isTransparent",[Ls],(function(){return!1})),zx=gs(Gx.prototype,"sortMode",[Fx],(function(){return Jx.FRONT_TO_BACK})),Vx=gs(Gx.prototype,"stages",[Ux],(function(){return[]})),kx=Gx))||kx);function iN(t,e){return t.hash-e.hash||t.depth-e.depth||t.shaderId-e.shaderId}function nN(t,e){return t.priority-e.priority||t.hash-e.hash||e.depth-t.depth||t.shaderId-e.shaderId}var rN=function(){function t(t){this.queue=void 0,this._passDesc=void 0,this._passPool=void 0,this._passDesc=t,this._passPool=new hu((function(){return{priority:0,hash:0,depth:0,shaderId:0,subModel:null,passIdx:0}}),64),this.queue=new uu(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,h=s.passes[a],u=s.shaders[a],c=PE.getOrCreatePipelineState(t,h,u,e,o);i.bindPipelineState(c),i.bindDescriptorSet(Qm.MATERIAL,h.descriptorSet),i.bindDescriptorSet(Qm.LOCAL,s.descriptorSet),i.bindInputAssembler(o),i.draw(o)}},t}();function sN(t){for(var e=0,i=0;i<t.stages.length;i++)e|=wE(t.stages[i]);var n=iN;switch(t.sortMode){case Jx.BACK_TO_FRONT:n=nN;break;case Jx.FRONT_TO_BACK:n=iN}return new rN({isTransparent:t.isTransparent,phases:e,sortFunc:n})}function aN(t){t.clear()}function oN(t){t.sort()}var hN=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.length=0,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[Symbol.iterator](),a=s.next();!a.done;){var o=a.value,h=o.instances,u=o.pass;if(o.hasPendingModels){i.bindDescriptorSet(Qm.MATERIAL,u.descriptorSet);for(var c=null,l=0;l<h.length;++l){var _=h[l];if(_.count){var f=_.shader,d=PE.getOrCreatePipelineState(t,u,f,e,_.ia);c!==d&&(i.bindPipelineState(d),c=d),n&&i.bindDescriptorSet(Qm.GLOBAL,n),r?i.bindDescriptorSet(Qm.LOCAL,_.descriptorSet,r):i.bindDescriptorSet(Qm.LOCAL,_.descriptorSet,a.value.dynamicOffsets),i.bindInputAssembler(_.ia),i.draw(_.ia)}}}a=s.next()}},t}(),uN=new ou((function(){return{subModel:null,passIdx:-1,dynamicOffsets:[],lights:[]}}),16),cN=new Wi,lN=new Float32Array(4),_N=[],fN=[],dN=new cn,pN=new cn,mN=new $r(0,0,0,.5,.5,.5),gN=new $r;function vN(t,e){return!(!e.worldBounds||Gr.aabbWithAABB(e.worldBounds,t.aabb))}function yN(t,e){return!(!e.worldBounds||Gr.aabbWithAABB(e.worldBounds,t.aabb)&&Gr.aabbFrustum(e.worldBounds,t.frustum))}function EN(t,e){return!(!e.worldBounds||Gr.aabbWithAABB(e.worldBounds,t.aabb))}function TN(t,e){return $r.transform(gN,mN,t.node.getWorldMatrix()),!(!e.worldBounds||Gr.aabbWithAABB(e.worldBounds,gN))}var SN="forward-add",AN=wE(SN),RN=[];function CN(t,e,i){void 0===i&&(i="default");var n=g.rendering;Rv()&&(AN=n.getPhaseID(n.getPassID(i),SN)),e.length=0;for(var r=!1,s=0;s<t.length;s++){for(var a=t[s].passes,o=-1,h=0;h<a.length;h++)if((!n||!n.enableEffectImport)&&a[h].phase===AN||Rv()&&a[h].phaseID===AN){o=h,r=!0;break}e.push(o)}return r}var bN=function(){function t(t){this._pipeline=void 0,this._device=void 0,this._lightPasses=[],this._instancedLightPassPool=uN.alloc(),this._shadowUBO=new Float32Array(ng.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._instancedQueues=[],this._lightMeterScale=1e4,this._pipeline=t,this._device=t.device;var e=this._device.capabilities.uboOffsetAlignment;this._lightBufferStride=Math.ceil(Sg.SIZE/e)*e,this._lightBufferElementCount=this._lightBufferStride/Float32Array.BYTES_PER_ELEMENT,this._lightBuffer=this._device.createBuffer(new Ml(Mc.UNIFORM|Mc.TRANSFER_DST,Bc.HOST|Bc.DEVICE,this._lightBufferStride*this._lightBufferCount,this._lightBufferStride)),this._firstLightBufferView=this._device.createBuffer(new Pl(this._lightBuffer,0,Sg.SIZE)),this._lightBufferData=new Float32Array(this._lightBufferElementCount*this._lightBufferCount)}var e=t.prototype;return e.clear=function(){this._instancedQueues.forEach((function(t){t.clear()})),this._instancedQueues.length=0;for(var t=0;t<this._lightPasses.length;t++){var e=this._lightPasses[t];e.dynamicOffsets.length=0,e.lights.length=0}uN.freeArray(this._lightPasses),this._lightPasses.length=0,this._instancedLightPassPool.dynamicOffsets.length=0,this._instancedLightPassPool.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);if(r){var s=Rv()?Cw("CCShadow"):ng.BINDING;r.getBuffer(s).destroy(),r.getTexture(sg).destroy(),r.getTexture(dg).destroy(),r.destroy()}t.delete(n)}},e._bindForwardAddLight=function(t,e){void 0===e&&(e="default");for(var i=this._pipeline.pipelineSceneData.renderObjects,n=0;n<i.length;n++){var r=i[n].model,s=r.subModels;if(CN(s,RN,e)&&(fN.length=0,this._lightCulling(r,t),fN.length||!(t.length>0)))for(var a=0;a<s.length;a++){var o=RN[a];if(!(o<0)){var h=s[a],u=h.passes[o];h.passes[0].blendState.targets[0].blend||(Rv()&&Cw("CCForwardLight"),h.descriptorSet.bindBuffer(Sg.BINDING,this._firstLightBufferView),h.descriptorSet.update(),this._addRenderQueue(u,h,r,o))}}}},e.gatherLightPasses=function(t,e,i){void 0===i&&(i="default"),this.clear();var n=this._pipeline.pipelineSceneData.validPunctualLights;if(n.length){this._updateUBOs(t,e),this._updateLightDescriptorSet(t,e),this._bindForwardAddLight(n,i);for(var r=0;r<n.length;r++){var s=n[r];this._instancedLightPassPool.lights.push(s),this._instancedLightPassPool.dynamicOffsets.push(this._lightBufferStride*r)}this._instancedQueues.forEach((function(t){t.uploadBuffers(e)}))}else this._bindForwardAddLight(n,i)},e.recordCommandBuffer=function(t,e,i){for(var n=this._pipeline.globalDSManager,r=0;r<this._instancedQueues.length;++r){var s=this._instancedLightPassPool.lights[r];_N[0]=this._instancedLightPassPool.dynamicOffsets[r];var a=n.getOrCreateDescriptorSet(s);this._instancedQueues[r].recordCommandBuffer(t,e,i,a,_N)}for(var o=0;o<this._lightPasses.length;o++){var h=this._lightPasses[o],u=h.subModel,c=h.passIdx,l=h.dynamicOffsets,_=h.lights,f=u.passes[c],d=u.shaders[c],p=u.inputAssembler,m=PE.getOrCreatePipelineState(t,f,d,e,p),g=f.descriptorSet,v=u.descriptorSet;i.bindPipelineState(m),i.bindDescriptorSet(Qm.MATERIAL,g),i.bindInputAssembler(p);for(var y=0;y<l.length;++y){var E=_[y],T=n.getOrCreateDescriptorSet(E);_N[0]=l[y],i.bindDescriptorSet(Qm.GLOBAL,T),i.bindDescriptorSet(Qm.LOCAL,v,_N),i.draw(p)}}},e._lightCulling=function(t,e){for(var i=!1,n=0;n<e.length;n++){var r=e[n];switch(r.type){case yI.SPHERE:i=vN(r,t);break;case yI.SPOT:i=yN(r,t);break;case yI.POINT:i=EN(r,t);break;case yI.RANGED_DIRECTIONAL:i=TN(r,t)}i||fN.push(n)}},e._addRenderQueue=function(t,e,i,n){var r=this._pipeline.pipelineSceneData.validPunctualLights,s=t.batchingScheme,a=null;s===CE.NONE&&((a=uN.alloc()).subModel=e,a.passIdx=n);for(var o=0;o<fN.length;o++){var h=fN[o],u=r[h];if((u.visibility&i.node.layer)===i.node.layer)switch(s){case CE.INSTANCING:var c=t.getInstancedBuffer(o);c.merge(e,n),c.dynamicOffsets[0]=this._lightBufferStride,this._instancedQueues[o]||(this._instancedQueues[o]=new hN),this._instancedQueues[o].queue.add(c);break;default:a.lights.push(u),a.dynamicOffsets.push(this._lightBufferStride*h)}}s===CE.NONE&&this._lightPasses.push(a)},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=Sv(i)?0:1,h=this._pipeline.globalDSManager,u=n.validPunctualLights,c=this._pipeline.device.capabilities,l=0;l<u.length;l++){var _=u[l],f=h.getOrCreateDescriptorSet(_);if(f){var d=void 0,p=void 0;switch(_.type){case yI.SPHERE:a&&Zw.updatePlanarNormalAndDistance(r,this._shadowUBO),this._shadowUBO[ng.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+0]=r.size.x,this._shadowUBO[ng.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+1]=r.size.y,this._shadowUBO[ng.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+2]=1,this._shadowUBO[ng.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+3]=0,this._shadowUBO[ng.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+0]=yI.SPHERE,this._shadowUBO[ng.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+1]=o,this._shadowUBO[ng.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+2]=0,this._shadowUBO[ng.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+3]=0,qi.toArray(this._shadowUBO,r.shadowColor,ng.SHADOW_COLOR_OFFSET);break;case yI.SPOT:var m=_;if(a&&Zw.updatePlanarNormalAndDistance(r,this._shadowUBO),cn.invert(dN,_.node.getWorldMatrix()),cn.perspective(pN,_.angle,1,.001,_.range,!0,c.clipSpaceMinZ,c.clipSpaceSignY,0),d=pN.clone(),p=pN.clone().invert(),cn.multiply(pN,pN,dN),cn.toArray(this._shadowUBO,dN,ng.MAT_LIGHT_VIEW_OFFSET),cn.toArray(this._shadowUBO,pN,ng.MAT_LIGHT_VIEW_PROJ_OFFSET),this._shadowUBO[ng.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET+0]=.01,this._shadowUBO[ng.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET+1]=_.range,this._shadowUBO[ng.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET+2]=0,this._shadowUBO[ng.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET+3]=0,this._shadowUBO[ng.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+0]=r.size.x,this._shadowUBO[ng.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+1]=r.size.y,this._shadowUBO[ng.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+2]=m.shadowPcf,this._shadowUBO[ng.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+3]=m.shadowBias,this._shadowUBO[ng.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+0]=yI.SPOT,this._shadowUBO[ng.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+1]=o,this._shadowUBO[ng.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+2]=m.shadowNormalBias,this._shadowUBO[ng.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+3]=0,this._shadowUBO[ng.SHADOW_PROJ_DEPTH_INFO_OFFSET+0]=d.m10,this._shadowUBO[ng.SHADOW_PROJ_DEPTH_INFO_OFFSET+1]=d.m14,this._shadowUBO[ng.SHADOW_PROJ_DEPTH_INFO_OFFSET+2]=d.m11,this._shadowUBO[ng.SHADOW_PROJ_DEPTH_INFO_OFFSET+3]=d.m15,this._shadowUBO[ng.SHADOW_INV_PROJ_DEPTH_INFO_OFFSET+0]=p.m10,this._shadowUBO[ng.SHADOW_INV_PROJ_DEPTH_INFO_OFFSET+1]=p.m14,this._shadowUBO[ng.SHADOW_INV_PROJ_DEPTH_INFO_OFFSET+2]=p.m11,this._shadowUBO[ng.SHADOW_INV_PROJ_DEPTH_INFO_OFFSET+3]=p.m15,this._shadowUBO[ng.SHADOW_PROJ_INFO_OFFSET+0]=d.m00,this._shadowUBO[ng.SHADOW_PROJ_INFO_OFFSET+1]=d.m05,this._shadowUBO[ng.SHADOW_PROJ_INFO_OFFSET+2]=1/d.m00,this._shadowUBO[ng.SHADOW_PROJ_INFO_OFFSET+3]=1/d.m05,qi.toArray(this._shadowUBO,r.shadowColor,ng.SHADOW_COLOR_OFFSET),s.has(_)){var g,v=null===(g=s.get(_))||void 0===g?void 0:g.colorTextures[0];v&&f.bindTexture(dg,v)}break;case yI.POINT:a&&Zw.updatePlanarNormalAndDistance(r,this._shadowUBO),this._shadowUBO[ng.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+0]=r.size.x,this._shadowUBO[ng.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+1]=r.size.y,this._shadowUBO[ng.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+2]=1,this._shadowUBO[ng.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+3]=0,this._shadowUBO[ng.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+0]=yI.POINT,this._shadowUBO[ng.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+1]=o,this._shadowUBO[ng.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+2]=0,this._shadowUBO[ng.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+3]=0,qi.toArray(this._shadowUBO,r.shadowColor,ng.SHADOW_COLOR_OFFSET)}f.update();var y=Rv()?Cw("CCShadow"):ng.BINDING;e.updateBuffer(f.getBuffer(y),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=Di(a.length),this._lightBuffer.resize(this._lightBufferStride*this._lightBufferCount),this._lightBufferData=new Float32Array(this._lightBufferElementCount*this._lightBufferCount),this._firstLightBufferView.initialize(new Pl(this._lightBuffer,0,Sg.SIZE)));for(var o=0,h=0;o<a.length;o++,h+=this._lightBufferElementCount){var u=a[o];switch(u.type){case yI.SPHERE:if(Wi.toArray(lN,u.position),lN[3]=yI.SPHERE,this._lightBufferData.set(lN,h+Sg.LIGHT_POS_OFFSET),lN[0]=u.size,lN[1]=u.range,lN[2]=0,lN[3]=0,this._lightBufferData.set(lN,h+Sg.LIGHT_SIZE_RANGE_ANGLE_OFFSET),Wi.toArray(lN,u.color),u.useColorTemperature){var c=u.finalColor;lN[0]=c.x,lN[1]=c.y,lN[2]=c.z}lN[3]=r?u.luminance*i*this._lightMeterScale:u.luminance,this._lightBufferData.set(lN,h+Sg.LIGHT_COLOR_OFFSET);break;case yI.SPOT:if(Wi.toArray(lN,u.position),lN[3]=yI.SPOT,this._lightBufferData.set(lN,h+Sg.LIGHT_POS_OFFSET),lN[0]=u.size,lN[1]=u.range,lN[2]=u.spotAngle,lN[3]=s.enabled&&u.shadowEnabled&&s.type===$E.ShadowMap?1:0,this._lightBufferData.set(lN,h+Sg.LIGHT_SIZE_RANGE_ANGLE_OFFSET),Wi.toArray(lN,u.direction),this._lightBufferData.set(lN,h+Sg.LIGHT_DIR_OFFSET),Wi.toArray(lN,u.color),u.useColorTemperature){var l=u.finalColor;lN[0]=l.x,lN[1]=l.y,lN[2]=l.z}lN[3]=r?u.luminance*i*this._lightMeterScale:u.luminance,this._lightBufferData.set(lN,h+Sg.LIGHT_COLOR_OFFSET);break;case yI.POINT:if(Wi.toArray(lN,u.position),lN[3]=yI.POINT,this._lightBufferData.set(lN,h+Sg.LIGHT_POS_OFFSET),lN[0]=0,lN[1]=u.range,lN[2]=0,lN[3]=0,this._lightBufferData.set(lN,h+Sg.LIGHT_SIZE_RANGE_ANGLE_OFFSET),Wi.toArray(lN,u.color),u.useColorTemperature){var _=u.finalColor;lN[0]=_.x,lN[1]=_.y,lN[2]=_.z}lN[3]=r?u.luminance*i*this._lightMeterScale:u.luminance,this._lightBufferData.set(lN,h+Sg.LIGHT_COLOR_OFFSET);break;case yI.RANGED_DIRECTIONAL:Wi.toArray(lN,u.position),lN[3]=yI.RANGED_DIRECTIONAL,this._lightBufferData.set(lN,h+Sg.LIGHT_POS_OFFSET),Wi.toArray(lN,u.right),lN[3]=0,this._lightBufferData.set(lN,h+Sg.LIGHT_SIZE_RANGE_ANGLE_OFFSET),Wi.toArray(lN,u.direction),lN[3]=0,this._lightBufferData.set(lN,h+Sg.LIGHT_DIR_OFFSET);var f=u.scale;if(cN.set(.5*f.x,.5*f.y,.5*f.z),Wi.toArray(lN,cN),lN[3]=0,this._lightBufferData.set(lN,h+Sg.LIGHT_BOUNDING_SIZE_VS_OFFSET),Wi.toArray(lN,u.color),u.useColorTemperature){var d=u.finalColor;lN[0]=d.x,lN[1]=d.y,lN[2]=d.z}lN[3]=r?u.illuminance*i:u.illuminance,this._lightBufferData.set(lN,h+Sg.LIGHT_COLOR_OFFSET)}}e.updateBuffer(this._lightBuffer,this._lightBufferData)},t}(),IN=new $r,wN=wE("planar-shadow");function ON(t){var e=t.passes,i=g.rendering;Rv()&&(wN=i.getPhaseID(i.getPassID("default"),"planar-shadow"));for(var n=0;n<e.length;n++)if((!i||!i.enableEffectImport)&&e[n].phase===wN||Rv()&&e[n].phaseID===wN)return n;return-1}var xN,NN,DN,MN,PN,LN,BN,FN,UN=function(){function t(t){this._subModelArray=[],this._shaderArray=[],this._passArray=[],this._castModels=[],this._instancedQueue=new hN,this._pipeline=void 0,this._pipeline=t}var e=t.prototype;return e.clear=function(){this._subModelArray.length=0,this._shaderArray.length=0,this._passArray.length=0,this._instancedQueue.clear(),this._castModels.length=0},e.gatherShadowPasses=function(t,e){this.clear();var i=this._pipeline.pipelineSceneData.shadows;if(i.enabled&&i.type===$E.Planar&&!(i.normal.length()<1e-6)){var n=t.scene,r=t.frustum,s=0!=(t.visibility&Hp.BitMask.DEFAULT);if(n.mainLight&&s){for(var a=n.models,o=t.visibility,h=0;h<a.length;h++){var u=a[h];n.isCulledByLod(t,u)||u.enabled&&u.node&&u.castShadow&&u.node&&(o&u.node.layer)===u.node.layer&&this._castModels.push(u)}for(var c=0;c<this._castModels.length;c++){var l=this._castModels[c];if(!l.worldBounds||($r.transform(IN,l.worldBounds,i.matLight),Gr.aabbFrustum(IN,r)))for(var _=l.subModels,f=0;f<_.length;f++){var d=_[f],p=ON(d);if(p<0){this._subModelArray.push(d);var m=i.getPlanarShader(d.patches);if(!m)continue;this._shaderArray.push(m),this._passArray.push(i.material.passes[0])}else{var g=d.passes[p];if(g.batchingScheme===CE.INSTANCING){var v=g.getInstancedBuffer();v.merge(d,p),this._instancedQueue.queue.add(v)}else{var y=d.shaders[p];this._subModelArray.push(d),y&&this._shaderArray.push(y),this._passArray.push(g)}}}}this._instancedQueue.uploadBuffers(e)}}},e.recordCommandBuffer=function(t,e,i){var n=this._pipeline.pipelineSceneData.shadows;if(n.enabled&&n.type===$E.Planar){this._instancedQueue.recordCommandBuffer(t,e,i);for(var r=0;r<this._subModelArray.length;++r){var s=this._subModelArray[r],a=this._shaderArray[r],o=this._passArray[r],h=s.inputAssembler,u=PE.getOrCreatePipelineState(t,o,a,e,h),c=o.descriptorSet;i.bindPipelineState(u),i.bindDescriptorSet(Qm.MATERIAL,c),i.bindDescriptorSet(Qm.LOCAL,s.descriptorSet),i.bindInputAssembler(h),i.draw(h)}}},t}(),kN=function(){function t(){this._phaseID=wE("default");var t=g.rendering;Rv()&&(this._phaseID=t.getPhaseID(t.getPassID("default"),"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],h=!1;if(t.visibility&o.visFlags&&(h=!0),h)for(var u=o.shaders.length,c=0;c<u;c++){var l=o.passes[c];if(l.phase===this._phaseID){var _=o.shaders[c],f=o.inputAssembler,d=PE.getOrCreatePipelineState(n,l,_,e,f);r.bindPipelineState(d),r.bindDescriptorSet(Qm.MATERIAL,l.descriptorSet);var p=o.descriptorSet;r.bindDescriptorSet(Qm.LOCAL,p),r.bindInputAssembler(f),r.draw(f)}}}},t}(),GN=[new Ol(0,0,0,1)],HN=t("ForwardStage",(xN=bs("ForwardStage"),NN=sa([eN]),xN(((LN=function(t){function e(){var e;return(e=t.call(this)||this).renderQueues=PN&&PN(),e._renderQueues=[],e._renderArea=new Tl,e._instancedQueue=void 0,e._phaseID=wE("default"),e._clearFlag=4294967295,e.additiveInstanceQueues=[],e._instancedQueue=new hN,e._uiPhase=new kN,e}s(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]=sN(this.renderQueues[n]);this._additiveLightQueue=new bN(this._pipeline),this._planarQueue=new UN(this._pipeline),this._uiPhase.activate(e)},i.destroy=function(){},i.render=function(t){var e;this._instancedQueue.clear();var i=this._pipeline,n=i.device;this._renderQueues.forEach(aN);for(var r=i.pipelineSceneData.renderObjects,s=0,a=0,o=0,h=0;h<r.length;++h){var u=r[h],c=u.model.subModels;for(s=0;s<c.length;++s){var l=c[s],_=l.passes;for(a=0;a<_.length;++a){var f=_[a];if(f.phase===this._phaseID)if(f.batchingScheme===CE.INSTANCING){var d=f.getInstancedBuffer();d.merge(l,a),this._instancedQueue.queue.add(d)}else for(o=0;o<this._renderQueues.length;o++)this._renderQueues[o].insertRenderPass(u,s,a)}}}this._instancedQueue.sort(),this._renderQueues.forEach(oN);var p=i.commandBuffers[0];i.pipelineUBO.updateShadowUBO(t);for(var m=0;m<this.additiveInstanceQueues.length;m++)this.additiveInstanceQueues[m].uploadBuffers(p);this._instancedQueue.uploadBuffers(p),this._additiveLightQueue.gatherLightPasses(t,p),this._planarQueue.gatherShadowPasses(t,p),t.clearFlag&_l.COLOR&&(GN[0].x=t.clearColor.x,GN[0].y=t.clearColor.y,GN[0].z=t.clearColor.z,GN[0].w=t.clearColor.w),i.generateRenderArea(t,this._renderArea);var g=t.window.framebuffer,v=i.getRenderPass(t.clearFlag&this._clearFlag,g);p.beginRenderPass(v,g,this._renderArea,GN,t.clearDepth,t.clearStencil),p.bindDescriptorSet(Qm.GLOBAL,i.descriptorSet),this._renderQueues[0].recordCommandBuffer(n,v,p);for(var y=0;y<this.additiveInstanceQueues.length;y++)this.additiveInstanceQueues[y].recordCommandBuffer(n,v,p);this._instancedQueue.recordCommandBuffer(n,v,p),this._additiveLightQueue.recordCommandBuffer(n,v,p),p.bindDescriptorSet(Qm.GLOBAL,i.descriptorSet),this._planarQueue.recordCommandBuffer(n,v,p),this._renderQueues[1].recordCommandBuffer(n,v,p),null===(e=t.geometryRenderer)||void 0===e||e.render(v,p,i.pipelineSceneData),this._uiPhase.render(t,v),qE(n,v,p,i.profiler,t),p.endRenderPass()},e}(aO)).initInfo={name:"ForwardStage",priority:mO.FORWARD,tag:0,renderQueues:[{isTransparent:!1,sortMode:Jx.FRONT_TO_BACK,stages:["default"]},{isTransparent:!0,sortMode:Jx.BACK_TO_FRONT,stages:["default","planarShadow"]}]},PN=gs((MN=LN).prototype,"renderQueues",[NN,Ls],(function(){return[]})),DN=MN))||DN)),zN=t("ForwardFlow",bs("ForwardFlow")(((FN=function(t){function e(){return t.apply(this,arguments)||this}s(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 HN;i.initialize(HN.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}(hO)).initInfo={name:zm,priority:gO.FORWARD,stages:[]},BN=FN))||BN),VN=wE("shadow-caster");function WN(t){var e=t.passes,i=g.rendering;Rv()&&(VN=i.getPhaseID(i.getPassID("default"),"shadow-caster"));for(var n=0;n<e.length;n++)if((!i||!i.enableEffectImport)&&e[n].phase===VN||Rv()&&e[n].phaseID===VN)return n;return-1}var XN,jN,YN,KN,qN=function(){function t(t){this._pipeline=void 0,this._subModelsArray=[],this._passArray=[],this._shaderArray=[],this._instancedQueue=void 0,this._pipeline=t,this._instancedQueue=new hN}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===$E.ShadowMap){switch(e.type){case yI.DIRECTIONAL:var a=e;if(a.shadowEnabled){var o,h=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,h=r.length-1;h>=0;h--){var u=r.array[h];if(u){var c=u.model;c&&c.enabled&&c.node&&((o&c.node.layer)===c.node.layer||o&c.visFlags)&&c.worldBounds&&c.castShadow?Gr.aabbFrustum(c.worldBounds,s)&&(a.push(u),i.level<n.csmLevel&&n.csmOptimizationMode===iT.RemoveDuplicates&&Gr.aabbFrustumCompletelyInside(c.worldBounds,s)&&r.fastRemove(h)):r.fastRemove(h)}else r.fastRemove(h)}}(t,r,o=a.shadowFixedArea?h.specialLayer:h.layers[n]);for(var u=o.shadowObjects,c=0;c<u.length;c++){var l=u[c].model;this.add(l,n)}}break;case yI.SPOT:var _=e;if(_.shadowEnabled)for(var f=_.visibility,d=r.csmLayers.castShadowObjects,p=0;p<d.length;p++){var m=d[p].model;(!m.worldBounds||(f&m.node.layer)===m.node.layer&&Gr.aabbFrustum(m.worldBounds,_.frustum))&&this.add(m,n)}}this._instancedQueue.uploadBuffers(i)}},e.clear=function(){this._subModelsArray.length=0,this._shaderArray.length=0,this._passArray.length=0,this._instancedQueue.clear()},e.add=function(t,e){for(var i=t.subModels,n=0;n<i.length;n++){var r=i[n],s=WN(r);if(!(s<0)){var a=r.passes[s];if(a.batchingScheme===CE.INSTANCING){var o=a.getInstancedBuffer(e);o.merge(r,s),this._instancedQueue.queue.add(o)}else{var h=r.shaders[s];this._subModelsArray.push(r),h&&this._shaderArray.push(h),this._passArray.push(a)}}}},e.recordCommandBuffer=function(t,e,i){this._instancedQueue.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,h=PE.getOrCreatePipelineState(t,a,s,e,o),u=a.descriptorSet;i.bindPipelineState(h),i.bindDescriptorSet(Qm.MATERIAL,u),i.bindDescriptorSet(Qm.LOCAL,r.descriptorSet),i.bindInputAssembler(o),i.draw(o)}},t}(),QN=[new Ol(1,1,1,1)],ZN=t("ShadowStage",bs("ShadowStage")(((jN=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)._additiveShadowQueue=void 0,e._shadowFrameBuffer=null,e._renderArea=new Tl,e._light=null,e._globalDS=null,e._level=0,e._isShadowMapCleared=!1,e}s(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&&!this._isShadowMapCleared){QN[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],h=this._shadowFrameBuffer.renderPass;o.beginRenderPass(h,this._shadowFrameBuffer,this._renderArea,QN,t.clearDepth,t.clearStencil),o.endRenderPass(),this._isShadowMapCleared=!0}},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 h=n.size;switch(this._light.type){case yI.DIRECTIONAL:var u=this._light;if(u.shadowFixedArea||u.csmLevel===eT.LEVEL_1||!i.csmSupported)this._renderArea.x=0,this._renderArea.y=0,this._renderArea.width=h.x,this._renderArea.height=h.y;else{var c=o.capabilities.screenSpaceSignY;this._renderArea.x=a%2*.5*h.x,this._renderArea.y=c>0?.5*(1-Math.floor(a/2))*h.y:.5*Math.floor(a/2)*h.y,this._renderArea.width=.5*h.x,this._renderArea.height=.5*h.y}break;case yI.SPOT:this._renderArea.x=0,this._renderArea.y=0,this._renderArea.width=h.x,this._renderArea.height=h.y}var l=this._shadowFrameBuffer.renderPass;s.beginRenderPass(l,this._shadowFrameBuffer,this._renderArea,QN,t.clearDepth,t.clearStencil),s.bindDescriptorSet(Qm.GLOBAL,r),this._additiveShadowQueue.recordCommandBuffer(o,l,s),s.endRenderPass(),this._isShadowMapCleared=!1}},i.activate=function(e,i){t.prototype.activate.call(this,e,i),this._additiveShadowQueue=new qN(e),this._isShadowMapCleared=!1},e}(aO)).initInfo={name:"ShadowStage",priority:mO.FORWARD,tag:0},XN=jN))||XN),JN=[],$N=t("ShadowFlow",bs("ShadowFlow")(((KN=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}s(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 ZN;i.initialize(ZN.initInfo),this._stages.push(i)}return!0},i.activate=function(e){t.prototype.activate.call(this,e);var i=Sv(e.device)?0:1;e.macros.CC_SHADOWMAP_FORMAT=i;var n=e.device.gfxAPI===Ic.WEBGL?1:0;e.macros.CC_SHADOWMAP_USE_LINEAR_DEPTH=n,e.pipelineSceneData.csmSupported=e.device.capabilities.maxFragmentUniformVectors>=(eg.COUNT+ig.COUNT+ng.COUNT+rg.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=tT.HARD,e.macros.CC_DIR_LIGHT_SHADOW_TYPE=0,e.macros.CC_CASCADED_LAYERS_TRANSITION=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===$E.ShadowMap){for(var o=0,h=0;o<i.maxReceived&&h<a.length;){var u=a[h];u.type===yI.SPOT&&u.shadowEnabled&&(JN.push(u),o++),h++}if(0!==s.length){i.shadowMapDirty&&this.resizeShadowMap();var c=t.scene.mainLight;if(c&&c.shadowEnabled){var l=e.descriptorSet;r.has(c)||this._initShadowFrameBuffer(e,c,t.window.swapchain);var _=r.get(c);if(c.shadowFixedArea)this._renderStage(t,c,_,l);else for(var f=e.pipelineSceneData.csmSupported?c.csmLevel:1,d=0;d<f;d++)this._renderStage(t,c,_,l,d)}for(var p=0;p<JN.length;p++){var m=JN[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)}JN.length=0}else this.clearShadowMap(JN,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 h=r.depthStencilTexture;h&&h.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=Sv(i)?xc.R32F:xc.RGBA8;if(!this._shadowRenderPass){var a=new $l;a.format=s,a.loadOp=Zc.CLEAR,a.storeOp=Jc.STORE,a.sampleCount=1;var o=new t_;o.format=xc.DEPTH_STENCIL,o.depthLoadOp=Zc.CLEAR,o.depthStoreOp=Jc.DISCARD,o.stencilLoadOp=Zc.CLEAR,o.stencilStoreOp=Jc.DISCARD,o.sampleCount=1;var h=new n_([a],o);this._shadowRenderPass=i.createRenderPass(h)}var u=[];u.push(i.createTexture(new Ul(Fc.TEX2D,Uc.COLOR_ATTACHMENT|Uc.SAMPLED,s,n.x,n.y)));var c=i.createTexture(new Ul(Fc.TEX2D,Uc.DEPTH_STENCIL_ATTACHMENT,xc.DEPTH_STENCIL,n.x,n.y)),l=i.createFramebuffer(new o_(this._shadowRenderPass,u,c));r.set(e,l)},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 h=this._stages[o];h.setUsage(s,r,a),h.clearFramebuffer(e)}}for(var u=0;u<t.length;u++){var c=t[u],l=i.globalDSManager.getOrCreateDescriptorSet(c);n.shadowFrameBufferMap.has(c)||this._initShadowFrameBuffer(this._pipeline,c,e.window.swapchain);for(var _=n.shadowFrameBufferMap.get(c),f=0;f<this._stages.length;f++){var d=this._stages[f];d.setUsage(l,c,_),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=Sv(r)?xc.R32F:xc.RGBA8,o=f(s.keys());!(t=o()).done;){var h=t.value,u=s.get(h);if(u){var c=[];c.push(n.device.createTexture(new Ul(Fc.TEX2D,Uc.COLOR_ATTACHMENT|Uc.SAMPLED,a,i.x,i.y)));var l=u.depthStencilTexture;l&&l.resize(i.x,i.y);var _=u.renderPass;u.destroy();var d=r.createFramebuffer(new o_(_,c,l));s.set(h,d)}}e.shadowMapDirty=!1},e}(hO)).initInfo={name:Vm,priority:gO.SHADOW,tag:Wx.SCENE,stages:[]},YN=KN))||YN),tD=new cn,eD=new cn,iD=new cn,nD=new cn,rD=new cn,sD=new cn,aD=new cn,oD=new Wi(0,0,0),hD=new Wi,uD=new pn,cD=new Wi,lD=new Wi,_D=new Wi(1e7,1e7,1e7),fD=new Wi(-1e7,-1e7,-1e7),dD=new Wi,pD=0,mD=0,gD=function(){function t(t){this._shadowObjects=[],this._shadowCameraFar=0,this._level=void 0,this._matShadowView=new cn,this._matShadowProj=new cn,this._matShadowViewProj=new cn,this._validFrustum=new as,this._splitFrustum=new as,this._lightViewFrustum=new as,this._castLightViewBoundingBox=new $r,this._level=t,this._validFrustum.accurate=!0,this._splitFrustum.accurate=!0,this._lightViewFrustum.accurate=!0}var e=t.prototype;return e.copyToValidFrustum=function(t){as.copy(this._validFrustum,t)},e.calculateValidFrustumOrtho=function(t,e,i,n,r){as.createOrtho(this._validFrustum,t,e,i,n,r)},e.calculateSplitFrustum=function(t,e,i,n){this._splitFrustum.split(i,n,t.aspect,t.fov,e)},e.destroy=function(){this._shadowObjects.length=0},e.createMatrix=function(t,e,i){var n=g.director.root.device,r=t.shadowInvisibleOcclusionRange;as.copy(this._lightViewFrustum,this._splitFrustum),cn.fromRT(eD,t.node.rotation,oD),cn.invert(iD,eD);var s,a,o=iD.clone();this._lightViewFrustum.transform(iD),$r.fromPoints(this._castLightViewBoundingBox,_D,fD),this._castLightViewBoundingBox.mergeFrustum(this._lightViewFrustum),t.csmOptimizationMode===iT.DisableRotationFix?(s=2*this._castLightViewBoundingBox.halfExtents.x,a=2*this._castLightViewBoundingBox.halfExtents.y):s=a=Wi.distance(this._lightViewFrustum.vertices[0],this._lightViewFrustum.vertices[6]);var h=g.director.root.pipeline.pipelineSceneData.csmSupported?t.csmLevel:1;if(h>1&&t.csmOptimizationMode===iT.RemoveDuplicates)if(this._level>=h-1)mD=this._castLightViewBoundingBox.halfExtents.z,pD=this._castLightViewBoundingBox.center.z;else{var u=Math.abs(this._castLightViewBoundingBox.center.z-pD)+mD;this._castLightViewBoundingBox.halfExtents.z=Math.max(this._castLightViewBoundingBox.center.z,u)}var c=this._castLightViewBoundingBox.halfExtents.z;this._shadowCameraFar=2*c+r;var l=this._castLightViewBoundingBox.center;if(dD.set(l.x,l.y,l.z+c+r),Wi.transformMat4(dD,dD,eD),cn.fromRT(eD,t.node.rotation,dD),cn.invert(iD,eD),!i){var _=.5*s,f=.5*a;cn.ortho(nD,-_,_,-f,f,.1,this._shadowCameraFar,n.capabilities.clipSpaceMinZ,n.capabilities.clipSpaceSignY),cn.multiply(sD,nD,o),Wi.transformMat4(hD,dD,sD);var d=2/e;uD.set(d,d);var p=hD.x%uD.x,m=hD.y%uD.y;cD.set(hD.x-p,hD.y-m,hD.z),cn.invert(aD,sD),Wi.transformMat4(lD,cD,aD),cn.fromRT(eD,t.node.rotation,lD),cn.invert(iD,eD),cn.multiply(rD,nD,iD),cn.copy(this._matShadowView,iD),cn.copy(this._matShadowProj,nD),cn.copy(this._matShadowViewProj,rD)}as.createOrtho(this._validFrustum,s,a,.1,this._shadowCameraFar,eD)},n(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}(),vD=function(t){function e(e){var i;return(i=t.call(this,e)||this)._splitCameraNear=0,i._splitCameraFar=0,i._csmAtlas=new ki,i._calculateAtlas(e),i}s(e,t);var i=e.prototype;return i.destroy=function(){t.prototype.destroy.call(this)},i._calculateAtlas=function(t){var e=g.director.root.device.capabilities.clipSpaceSignY,i=t%2-.5,n=(.5-Math.floor(t/2))*e;this._csmAtlas.set(.5,.5,i,n)},n(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}(gD),yD=function(){function t(){this._castShadowObjects=[],this._layerObjects=new uu(64),this._layers=[],this._levelCount=0,this._specialLayer=new gD(1),this._shadowDistance=0;for(var t=0;t<eT.LEVEL_4;t++)this._layers[t]=new vD(t)}var e=t.prototype;return e.update=function(t,e){var i=e.scene.mainLight;if(null!==i){var n=t.shadows,r=g.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=g.director.root.device,i=t.shadowOrthoSize,n=t.shadowOrthoSize,r=t.shadowNear,s=t.shadowFar;cn.fromRT(eD,t.node.getWorldRotation(),t.node.getWorldPosition()),cn.invert(iD,eD),cn.ortho(nD,-i,i,-n,n,r,s,e.capabilities.clipSpaceMinZ,e.capabilities.clipSpaceSignY),cn.multiply(rD,nD,iD),this._specialLayer.matShadowView=iD,this._specialLayer.matShadowProj=nD,this._specialLayer.matShadowViewProj=rD,this._specialLayer.calculateValidFrustumOrtho(2*i,2*n,r,s,eD)},e._splitFrustumLevels=function(t){var e=.1,i=t.shadowDistance,n=i/e,r=g.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,h=s*e*Math.pow(n,o)+(1-s)*(e+(i-e)*o),u=1.005*h;this._layers[a].splitCameraNear=h,this._layers[a-1].splitCameraFar=u}this._layers[r-1].splitCameraFar=i,t.csmNeedUpdate=!1},e._calculateCSM=function(t,e,i){var n=g.director.root.pipeline.pipelineSceneData.csmSupported?e.csmLevel:1,r=n>1?.5*i.size.x:i.size.x;if(!(r<0)){this._getCameraWorldMatrix(tD,t);for(var s=n-1;s>=0;s--){var a=this._layers[s],o=a.splitCameraNear,h=a.splitCameraFar;a.calculateSplitFrustum(t,tD,o,h),a.createMatrix(e,r,!1)}n===eT.LEVEL_1?(this._specialLayer.shadowCameraFar=this._layers[0].shadowCameraFar,cn.copy(this._specialLayer.matShadowView,this._layers[0].matShadowView),cn.copy(this._specialLayer.matShadowProj,this._layers[0].matShadowProj),cn.copy(this._specialLayer.matShadowViewProj,this._layers[0].matShadowViewProj),this._specialLayer.copyToValidFrustum(this._layers[0].validFrustum)):(this._specialLayer.calculateSplitFrustum(t,tD,.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();cn.fromRT(t,r,n)}},n(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}(),ED=t("PipelineSceneData",function(){function t(){this.fog=new wA,this.ambient=new Um,this.skybox=new cT,this.shadows=new rT,this.csmLayers=new yD,this.octree=new AI,this.skin=new RI,this.lightProbes=g.internal.LightProbes?new g.internal.LightProbes:null,this.validPunctualLights=[],this.renderObjects=[],this.shadowFrameBufferMap=new Map,this._geometryRendererMaterials=[],this._geometryRendererPasses=[],this._geometryRendererShaders=[],this._occlusionQueryVertexBuffer=null,this._occlusionQueryIndicesBuffer=null,this._occlusionQueryInputAssembler=null,this._occlusionQueryMaterial=null,this._occlusionQueryShader=null,this._isHDR=!0,this._shadingScale=1,this._csmSupported=!0,this._standardSkinMeshRenderer=null,this._standardSkinModel=null,this._skinMaterialModel=null,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 ZE,this._geometryRendererMaterials[e]._uuid="geometry-renderer-material-"+e,this._geometryRendererMaterials[e].initialize({effectName:"internal/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 ZE;t._uuid="default-occlusion-query-material",t.initialize({effectName:"internal/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,this._standardSkinMeshRenderer=null,this._standardSkinModel=null,this._skinMaterialModel=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 Ml(Mc.VERTEX|Mc.TRANSFER_DST,Bc.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 Ml(Mc.INDEX|Mc.TRANSFER_DST,Bc.DEVICE,a,s)),this._occlusionQueryIndicesBuffer.update(r);var o=[new Ql("a_position",xc.RGB32F)],h=new Jl(o,[this._occlusionQueryVertexBuffer],this._occlusionQueryIndicesBuffer);return t.createInputAssembler(h)},n(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:"standardSkinModel",get:function(){return this._standardSkinModel},set:function(t){this._standardSkinModel=t}},{key:"standardSkinMeshRenderer",get:function(){return this._standardSkinMeshRenderer},set:function(t){this._standardSkinMeshRenderer&&this._standardSkinMeshRenderer!==t&&this._standardSkinMeshRenderer.clearGlobalStandardSkinObjectFlag(),this._standardSkinMeshRenderer=t,this.standardSkinModel=t?t.model:null}},{key:"skinMaterialModel",get:function(){return this._skinMaterialModel},set:function(t){this._skinMaterialModel=t}},{key:"geometryRendererPasses",get:function(){return this._geometryRendererPasses}},{key:"geometryRendererShaders",get:function(){return this._geometryRendererShaders}}]),t}()),TD=Hp.makeMaskExclude([Hp.BitMask.UI_2D,Hp.BitMask.UI_3D,Hp.BitMask.GIZMOS,Hp.BitMask.EDITOR,Hp.BitMask.SCENE_GIZMO,Hp.BitMask.PROFILER]),SD="CC_USE_RGBE_OUTPUT",AD=wE("default"),RD=wE("reflect-map");function CD(t){var e=t.passes,i=g.rendering;Rv()&&(AD=i.getPhaseID(i.getPassID("default"),"default"));for(var n=0;n<e.length;n++)if((!i||!i.enableEffectImport)&&e[n].phase===AD||Rv()&&e[n].phaseID===AD)return n;return-1}function bD(t){var e=t.passes,i=g.rendering;Rv()&&(RD=i.getPhaseID(i.getPassID("default"),"reflect-map"));for(var n=0;n<e.length;n++)if((!i||!i.enableEffectImport)&&e[n].phase===RD||Rv()&&e[n].phaseID===RD)return n;return-1}var ID,wD,OD,xD,ND,DD,MD,PD,LD,BD,FD,UD,kD,GD,HD,zD,VD,WD,XD,jD,YD,KD,qD,QD,ZD,JD,$D,tM,eM,iM,nM,rM,sM=function(){function t(t){this._pipeline=void 0,this._subModelsArray=[],this._passArray=[],this._shaderArray=[],this._rgbeSubModelsArray=[],this._instancedQueue=void 0,this._patches=[],this._pipeline=t,this._instancedQueue=new hN}var e=t.prototype;return e.gatherRenderObjects=function(t,e,i){this.clear();var n=e.scene,r=this._pipeline.pipelineSceneData.skybox;r.enabled&&r.model&&t.camera.clearFlag&zb&&this.add(r.model);for(var s=n.models,a=t.camera.visibility,o=0;o<s.length;o++){var h=s[o];n.isCulledByLod(e,h)||h.enabled&&h.node&&h.worldBounds&&h.bakeToReflectionProbe&&(t.probeType===sI.CUBE?((a&h.node.layer)===h.node.layer||a&h.visFlags)&&Gr.aabbWithAABB(h.worldBounds,t.boundingBox)&&this.add(h):((h.node.layer&TD)===h.node.layer||TD&h.visFlags)&&Gr.aabbFrustum(h.worldBounds,t.camera.frustum)&&this.add(h))}this._instancedQueue.uploadBuffers(i)},e.clear=function(){this._subModelsArray.length=0,this._shaderArray.length=0,this._passArray.length=0,this._instancedQueue.clear(),this._rgbeSubModelsArray.length=0},e.add=function(t){for(var e=t.subModels,i=0;i<e.length;i++){var n=e[i];if(!n.passes[0].blendState.targets[0].blend){var r=bD(n),s=!0;if(r<0&&(r=CD(n),s=!1),!(r<0)){var a=n.passes[r],o=a.batchingScheme;if(!s){this._patches=[],this._patches=this._patches.concat(n.patches);var h=[{name:SD,value:!0}];this._patches=this._patches.concat(h),n.onMacroPatchesStateChanged(this._patches),this._rgbeSubModelsArray.push(n)}if(o===CE.INSTANCING){var u=a.getInstancedBuffer();u.merge(n,r),this._instancedQueue.queue.add(u)}else{var c=n.shaders[r];this._subModelsArray.push(n),c&&this._shaderArray.push(c),this._passArray.push(a)}}}}},e.recordCommandBuffer=function(t,e,i){this._instancedQueue.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,h=PE.getOrCreatePipelineState(t,a,s,e,o),u=a.descriptorSet;i.bindPipelineState(h),i.bindDescriptorSet(Qm.MATERIAL,u),i.bindDescriptorSet(Qm.LOCAL,r.descriptorSet),i.bindInputAssembler(o),i.draw(o)}this.resetRGBEMacro(),this._instancedQueue.clear()},e.resetRGBEMacro=function(){for(var t=0;t<this._rgbeSubModelsArray.length;t++){this._patches=[];var e=this._rgbeSubModelsArray[t];if(this._patches=this._patches.concat(e.patches),this._patches){for(var i=0;i<this._patches.length;i++)if(this._patches[i].name===SD){this._patches.splice(i,1);break}e.onMacroPatchesStateChanged(this._patches)}}},t}(),aM=[new Ol(1,1,1,1)],oM=t("ReflectionProbeStage",bs("ReflectionProbeStage")(((wD=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)._frameBuffer=null,e._renderArea=new Tl,e._probe=null,e._probeRenderQueue=void 0,e._rgbeColor=new Wi,e}s(e,t);var i=e.prototype;return i.setUsageInfo=function(t,e){this._probe=t,this._frameBuffer=e},i.destroy=function(){var t;this._frameBuffer=null,null===(t=this._probeRenderQueue)||void 0===t||t.clear()},i.clearFramebuffer=function(t){if(this._frameBuffer){aM[0].w=t.clearColor.w;var e=this._pipeline,i=e.pipelineSceneData.shadingScale,n=t.viewport,r=this._probe.resolution;this._renderArea.x=n.x*r,this._renderArea.y=n.y*r,this._renderArea.width=n.width*r*i,this._renderArea.height=n.height*r*i;var s=e.commandBuffers[0],a=this._frameBuffer.renderPass;s.beginRenderPass(a,this._frameBuffer,this._renderArea,aM,t.clearDepth,t.clearStencil),s.endRenderPass()}},i.render=function(t){var e=this._pipeline,i=e.commandBuffers[0];this._probeRenderQueue.gatherRenderObjects(this._probe,t,i),e.pipelineUBO.updateCameraUBO(this._probe.camera),this._renderArea.x=0,this._renderArea.y=0,this._renderArea.width=this._probe.renderArea().x,this._renderArea.height=this._probe.renderArea().y;var n=this._frameBuffer.renderPass;if(this._probe.camera.clearFlag&_l.COLOR){this._rgbeColor.x=this._probe.camera.clearColor.x,this._rgbeColor.y=this._probe.camera.clearColor.y,this._rgbeColor.z=this._probe.camera.clearColor.z;var r=function(t){var e=Math.max(Math.max(t.x,t.y),t.z),i=128;e>1e-4&&(i=Math.log(e)/Math.log(1.1),i=Ti((i=Math.ceil(i))+128,0,255));var n=1/Math.pow(1.1,i-128),r=function(t,e,i){if(e>i){var n=e;e=i,i=n}return t<e?e:t>i?i:t}(t.multiplyScalar(n),new Wi(0,0,0),new Wi(1,1,1));r.multiplyScalar(255);var s,a,o=Zi(r).add((s=r.subtract(Zi(r)))<(a=new Wi(.5,.5,.5))?a:s);return new ki(o.x/255,o.y/255,o.z/255,i/255)}(this._rgbeColor);aM[0].x=r.x,aM[0].y=r.y,aM[0].z=r.z,aM[0].w=r.w}var s=e.device;i.beginRenderPass(n,this._frameBuffer,this._renderArea,aM,this._probe.camera.clearDepth,this._probe.camera.clearStencil),i.bindDescriptorSet(Qm.GLOBAL,e.descriptorSet),this._probeRenderQueue.recordCommandBuffer(s,n,i),i.endRenderPass(),e.pipelineUBO.updateCameraUBO(t)},i.activate=function(e,i){t.prototype.activate.call(this,e,i),this._probeRenderQueue=new sM(e)},e}(aO)).initInfo={name:"ReflectionProbeStage",priority:mO.FORWARD,tag:0},ID=wD))||ID),hM=t("ReflectionProbeFlow",bs("ReflectionProbeFlow")(((xD=function(t){function e(){return t.apply(this,arguments)||this}s(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 oM;i.initialize(oM.initInfo),this._stages.push(i)}return!0},i.activate=function(e){t.prototype.activate.call(this,e)},i.render=function(t){if(g.internal.reflectionProbeManager)for(var e=g.internal.reflectionProbeManager.getProbes(),i=0;i<e.length;i++)e[i].needRender&&e[i].probeType===sI.PLANAR&&this._renderStage(t,e[i])},i.destroy=function(){t.prototype.destroy.call(this)},i._renderStage=function(t,e){for(var i=0;i<this._stages.length;i++){var n=this._stages[i];if(e.probeType===sI.PLANAR)g.internal.reflectionProbeManager.updatePlanarMap(e,null),n.setUsageInfo(e,e.realtimePlanarTexture.window.framebuffer),n.render(t),g.internal.reflectionProbeManager.updatePlanarMap(e,e.realtimePlanarTexture.getGFXTexture());else{for(var r=0;r<6;r++){var s=e.bakedCubeTextures[r];if(!s)return;e.updateCameraDir(r),n.setUsageInfo(e,s.window.framebuffer),n.render(t)}e.needRender=!1}}},e}(hO)).initInfo={name:"PIPELINE_FLOW_RELECTION_PROBE",priority:0,tag:Wx.SCENE,stages:[]},OD=xD))||OD),uM=t("ForwardPipeline",(ND=bs("ForwardPipeline"),DD=sa([Zx]),ND((PD=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).renderTextures=LD&&LD(),e._postRenderPass=null,e}s(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 $N;i.initialize($N.initInfo),this._flows.push(i);var n=new hM;n.initialize(hM.initInfo),this._flows.push(n);var r=new zN;r.initialize(zN.initInfo),this._flows.push(r)}return!0},i.activate=function(e){return this._macros={CC_PIPELINE_TYPE:0},this._pipelineSceneData=new ED,!(!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(sg,e),this._descriptorSet.bindTexture(sg,IE.get("default-texture").getGFXTexture()),this._descriptorSet.bindSampler(dg,e),this._descriptorSet.bindTexture(dg,IE.get("default-texture").getGFXTexture()),this._descriptorSet.update(),!0},i._destroyUBOs=function(){this._descriptorSet&&(this._descriptorSet.getBuffer(eg.BINDING).destroy(),this._descriptorSet.getBuffer(ng.BINDING).destroy(),this._descriptorSet.getBuffer(ig.BINDING).destroy(),this._descriptorSet.getTexture(sg).destroy(),this._descriptorSet.getTexture(dg).destroy())},n(e,[{key:"postRenderPass",get:function(){return this._postRenderPass}}]),e}(Qx),LD=gs(PD.prototype,"renderTextures",[DD,Ls],(function(){return[]})),MD=PD))||MD)),cM=[new Ol(0,0,0,0),new Ol(0,0,0,0),new Ol(0,0,0,0)],lM=t("GbufferStage",(BD=bs("GbufferStage"),FD=sa([eN]),BD(((HD=function(t){function e(){var e;return(e=t.call(this)||this).renderQueues=GD&&GD(),e._renderQueues=[],e._renderArea=new Tl,e._instancedQueue=void 0,e._phaseID=wE("default"),e._instancedQueue=new hN,e}s(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]=sN(this.renderQueues[n])},i.destroy=function(){},i.render=function(t){this._instancedQueue.clear();var e=this._pipeline,i=e.device;this._renderQueues.forEach(aN),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 h=n[o],u=h.model.subModels;for(r=0;r<u.length;++r){var c=u[r],l=c.passes;for(s=0;s<l.length;++s){var _=l[s];if(_.phase===this._phaseID)if(_.batchingScheme===CE.INSTANCING){var f=_.getInstancedBuffer();f.merge(c,s),this._instancedQueue.queue.add(f)}else for(a=0;a<this._renderQueues.length;a++)this._renderQueues[a].insertRenderPass(h,r,s)}}}this._renderQueues.forEach(oN);var d=e.commandBuffers[0];this._instancedQueue.uploadBuffers(d),t.clearFlag&_l.COLOR&&(e.pipelineSceneData.isHDR?FE(cM[0],t.clearColor):(cM[0].x=t.clearColor.x,cM[0].y=t.clearColor.y,cM[0].z=t.clearColor.z)),cM[0].w=t.clearColor.w;var p=e.getPipelineRenderData().gbufferFrameBuffer,m=p.renderPass;d.beginRenderPass(m,p,this._renderArea,cM,t.clearDepth,t.clearStencil),d.setScissor(e.generateScissor(t)),d.setViewport(e.generateViewport(t)),d.bindDescriptorSet(Qm.GLOBAL,e.descriptorSet);for(var g=0;g<this.renderQueues.length;g++)this._renderQueues[g].recordCommandBuffer(i,m,d);this._instancedQueue.recordCommandBuffer(i,m,d),d.endRenderPass()},e}(aO)).initInfo={name:"GbufferStage",priority:vO.GBUFFER,tag:0,renderQueues:[{isTransparent:!1,sortMode:Jx.FRONT_TO_BACK,stages:["default"]},{isTransparent:!0,sortMode:Jx.BACK_TO_FRONT,stages:["default"]}]},GD=gs((kD=HD).prototype,"renderQueues",[FD,Ls],(function(){return[]})),UD=kD))||UD)),_M=new Wi,fM=new $r(0,0,0,.5,.5,.5),dM=new $r,pM=[new Ol(0,0,0,1)],mM=t("LightingStage",(zD=bs("LightingStage"),VD=sa(ZE),WD=sa([eN]),zD(((qD=function(t){function e(){var e;return(e=t.call(this)||this)._deferredLitsBufs=null,e._maxDeferredLights=Ag.LIGHTS_PER_PASS,e._lightBufferData=void 0,e._lightMeterScale=1e4,e._descriptorSet=null,e._descriptorSetLayout=void 0,e._renderArea=new Tl,e._uiPhase=void 0,e._deferredMaterial=YD&&YD(),e.renderQueues=KD&&KD(),e._phaseID=wE("default"),e._renderQueues=[],e._uiPhase=new kN,e}s(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=t.scene.pointLights,a=t.scene.rangedDirLights,o=Qn.create(0,0,0,1),h=new Float32Array(4),u=t.exposure,c=0,l=ki.length,_=l*this._maxDeferredLights,f=0;f<n.length&&c<this._maxDeferredLights;f++,++c){var d=n[f];if(Qn.set(o,d.position.x,d.position.y,d.position.z,d.range),Gr.sphereFrustum(o,t.frustum)){if(Wi.toArray(h,d.position),h[3]=yI.SPHERE,this._lightBufferData.set(h,c*l),Wi.toArray(h,d.color),d.useColorTemperature){var p=d.finalColor;h[0]=p.x,h[1]=p.y,h[2]=p.z}e.pipelineSceneData.isHDR?h[3]=d.luminance*u*this._lightMeterScale:h[3]=d.luminance,this._lightBufferData.set(h,c*l+1*_),h[0]=d.size,h[1]=d.range,h[2]=0,this._lightBufferData.set(h,c*l+2*_)}}for(var m=0;m<r.length&&c<this._maxDeferredLights;m++,++c){var g=r[m];if(Qn.set(o,g.position.x,g.position.y,g.position.z,g.range),Gr.sphereFrustum(o,t.frustum)){if(Wi.toArray(h,g.position),h[3]=yI.SPOT,this._lightBufferData.set(h,c*l+0*_),Wi.toArray(h,g.color),g.useColorTemperature){var v=g.finalColor;h[0]=v.x,h[1]=v.y,h[2]=v.z}e.pipelineSceneData.isHDR?h[3]=g.luminance*u*this._lightMeterScale:h[3]=g.luminance,this._lightBufferData.set(h,c*l+1*_),h[0]=g.size,h[1]=g.range,h[2]=g.spotAngle,this._lightBufferData.set(h,c*l+2*_),Wi.toArray(h,g.direction),this._lightBufferData.set(h,c*l+3*_)}}for(var y=0;y<s.length&&c<this._maxDeferredLights;y++,++c){var E=s[y];if(Qn.set(o,E.position.x,E.position.y,E.position.z,E.range),Gr.sphereFrustum(o,t.frustum)){if(Wi.toArray(h,E.position),h[3]=yI.POINT,this._lightBufferData.set(h,c*l),Wi.toArray(h,E.color),E.useColorTemperature){var T=E.finalColor;h[0]=T.x,h[1]=T.y,h[2]=T.z}e.pipelineSceneData.isHDR?h[3]=E.luminance*u*this._lightMeterScale:h[3]=E.luminance,this._lightBufferData.set(h,c*l+1*_),h[0]=0,h[1]=E.range,h[2]=0,this._lightBufferData.set(h,c*l+2*_)}}for(var S=0;S<a.length&&c<this._maxDeferredLights;S++,++c){var A=a[S];if($r.transform(dM,fM,A.node.getWorldMatrix()),Gr.aabbFrustum(dM,t.frustum)){if(Wi.toArray(h,A.position),h[3]=yI.RANGED_DIRECTIONAL,this._lightBufferData.set(h,c*l),Wi.toArray(h,A.color),A.useColorTemperature){var R=A.finalColor;h[0]=R.x,h[1]=R.y,h[2]=R.z}e.pipelineSceneData.isHDR?h[3]=A.illuminance*u:h[3]=A.illuminance,this._lightBufferData.set(h,c*l+1*_),Wi.toArray(h,A.right),h[3]=0,this._lightBufferData.set(h,c*l+2*_),Wi.toArray(h,A.direction),h[3]=0,this._lightBufferData.set(h,c*l+3*_);var C=A.scale;_M.set(.5*C.x,.5*C.y,.5*C.z),Wi.toArray(h,_M),h[3]=0,this._lightBufferData.set(h,c*l+4*_)}}var b=3*_+3;this._lightBufferData.set([c],b),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 Ml(Mc.UNIFORM|Mc.TRANSFER_DST,Bc.HOST|Bc.DEVICE,i,e.capabilities.uboOffsetAlignment));var n=e.createBuffer(new Pl(this._deferredLitsBufs,0,i));this._lightBufferData=new Float32Array(i/Float32Array.BYTES_PER_ELEMENT),this._descriptorSet=e.createDescriptorSet(new c_(t.localSetLayout)),this._descriptorSet.bindBuffer(Sg.BINDING,n);var r=e.createBuffer(new Ml(Mc.UNIFORM|Mc.TRANSFER_DST,Bc.DEVICE,gg.SIZE,gg.SIZE));this._descriptorSet.bindBuffer(gg.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]=sN(this.renderQueues[n]);this._planarQueue=new UN(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(),h=s.deferredLightingMaterial.passes[0],u=h.getShaderVariant(),c=0;c<3;++c)h.descriptorSet.bindTexture(c,o.gbufferRenderTargets[c]),h.descriptorSet.bindSampler(c,o.sampler);h.descriptorSet.bindTexture(3,o.outputDepth),h.descriptorSet.bindSampler(3,o.sampler),h.descriptorSet.update(),this._descriptorSet||this._createStageDescriptor(h),this.gatherLights(t),t.clearFlag&_l.COLOR&&(pM[0].x=t.clearColor.x,pM[0].y=t.clearColor.y,pM[0].z=t.clearColor.z),pM[0].w=0;var l=o.outputFrameBuffer,_=l.renderPass;i.pipelineUBO.updateShadowUBO(t),r.beginRenderPass(_,l,this._renderArea,pM,t.clearDepth,t.clearStencil),r.setScissor(i.generateScissor(t)),r.setViewport(i.generateViewport(t)),r.bindDescriptorSet(Qm.GLOBAL,i.descriptorSet);var f=i.quadIAOffscreen,d=null;null!=h&&null!=u&&null!=f&&(d=PE.getOrCreatePipelineState(n,h,u,_,f)),null!=d&&(this._descriptorSet.update(),r.bindPipelineState(d),r.bindDescriptorSet(Qm.MATERIAL,h.descriptorSet),r.bindDescriptorSet(Qm.LOCAL,this._descriptorSet),r.bindInputAssembler(f),r.draw(f)),this._renderQueues.forEach(aN);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(oN);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}(aO)).initInfo={name:"LightingStage",priority:vO.LIGHTING,tag:0},YD=gs((jD=qD).prototype,"_deferredMaterial",[VD,Ls],(function(){return null})),KD=gs(jD.prototype,"renderQueues",[WD,Ls],(function(){return[]})),XD=jD))||XD)),gM=[new Ol(0,0,0,1)],vM=t("PostProcessStage",(QD=bs("PostProcessStage"),ZD=sa(ZE),JD=sa([eN]),QD(((nM=function(t){function e(){var e;return(e=t.call(this)||this)._postProcessMaterial=eM&&eM(),e.renderQueues=iM&&iM(),e._renderArea=new Tl,e._stageDesc=void 0,e._localUBO=void 0,e._uiPhase=new kN,e}s(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,h=e.getRenderPass(t.clearFlag,o);t.clearFlag&_l.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(h,o,this._renderArea,gM,t.clearDepth,t.clearStencil),r.bindDescriptorSet(Qm.GLOBAL,e.descriptorSet);var u=n.postprocessMaterial.passes[0],c=u.getShaderVariant();e.bloomEnabled?u.descriptorSet.bindTexture(0,a.bloom.combineTex):u.descriptorSet.bindTexture(0,a.outputRenderTargets[0]),u.descriptorSet.bindSampler(0,a.sampler),u.descriptorSet.update();var l=t.window.swapchain?e.quadIAOnscreen:e.quadIAOffscreen,_=null;null!=u&&null!=c&&null!=l&&(_=PE.getOrCreatePipelineState(i,u,c,h,l));var f=e.pipelineSceneData.renderObjects;null!=_&&f.length>0&&(this._stageDesc||(this._stageDesc=i.createDescriptorSet(new c_(u.localSetLayout)),this._localUBO=i.createBuffer(new Ml(Mc.UNIFORM|Mc.TRANSFER_DST,Bc.DEVICE,gg.SIZE,gg.SIZE)),this._stageDesc.bindBuffer(gg.BINDING,this._localUBO)),this._stageDesc.update(),r.bindPipelineState(_),r.bindDescriptorSet(Qm.MATERIAL,u.descriptorSet),r.bindDescriptorSet(Qm.LOCAL,this._stageDesc),r.bindInputAssembler(l),r.draw(l)),this._uiPhase.render(t,h),qE(i,h,r,e.profiler,t),r.endRenderPass()},e}(aO)).initInfo={name:"PostProcessStage",priority:pO.POST_PROCESS,tag:0},eM=gs((tM=nM).prototype,"_postProcessMaterial",[ZD,Ls],(function(){return null})),iM=gs(tM.prototype,"renderQueues",[JD,Ls],(function(){return[]})),$D=tM))||$D));!function(t){t[t.NONE=0]="NONE",t[t.FXAA=1]="FXAA"}(rM||(rM={}));var yM,EM,TM,SM,AM,RM,CM=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=rM.NONE,e}s(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 ZE;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 ZE;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 ZE;r._uuid="builtin-post-process-material",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){g.director.root.pipeline.macros.CC_RECEIVE_SHADOW=1;var t=this._deferredLightingMaterial.passes[0];t.beginChangeStatesSilently(),t.tryCompile(),t.endChangeStatesSilently()}},n(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 ZE;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}(ED),bM=[new Ol(0,0,0,1)],IM=function(){};IM.SIZE=4*(IM.COUNT=4+(IM.TEXTURE_SIZE_OFFSET=0));var wM,OM,xM,NM,DM,MM,PM,LM=t("BloomStage",(yM=bs("BloomStage"),EM=sa(ZE),yM(((RM=function(t){function e(){var e;return(e=t.call(this)||this).threshold=1,e.intensity=.8,e.iterations=2,e._bloomMaterial=AM&&AM(),e._renderArea=new Tl,e._bloomUBO=[],e}s(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&&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 Ml(Mc.UNIFORM|Mc.TRANSFER_DST,Bc.HOST|Bc.DEVICE,IM.SIZE,IM.SIZE));t.clearFlag&_l.COLOR&&(bM[0].x=t.clearColor.x,bM[0].y=t.clearColor.y,bM[0].z=t.clearColor.z),bM[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(IM.COUNT);a[IM.TEXTURE_SIZE_OFFSET+2]=this.threshold,i.updateBuffer(this._bloomUBO[0],a),i.beginRenderPass(s.renderPass,s.prefilterFramebuffer,this._renderArea,bM,0,0),i.bindDescriptorSet(Qm.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(Qm.MATERIAL,n.descriptorSet);var o=t.window.swapchain?e.quadIAOffscreen:e.quadIAOnscreen,h=null,u=n.getShaderVariant();null!=n&&null!=u&&null!=o&&(h=PE.getOrCreatePipelineState(e.device,n,u,s.renderPass,o)),null!=h&&(i.bindPipelineState(h),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(IM.COUNT),a=0;a<this.iterations;++a){s[IM.TEXTURE_SIZE_OFFSET+0]=this._renderArea.width,s[IM.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,bM,0,0);var o=n.passes[1+a],h=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(Qm.MATERIAL,o.descriptorSet);var u=t.window.swapchain?e.quadIAOffscreen:e.quadIAOnscreen,c=null;null!=o&&null!=h&&null!=u&&(c=PE.getOrCreatePipelineState(e.device,o,h,r.renderPass,u)),null!=c&&(i.bindPipelineState(c),i.bindInputAssembler(u),i.draw(u)),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(IM.COUNT),a=0;a<this.iterations;++a){var o=a+6+1;s[IM.TEXTURE_SIZE_OFFSET+0]=this._renderArea.width,s[IM.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,bM,0,0);var h=r.passes[7+a],u=h.getShaderVariant();h.descriptorSet.bindBuffer(0,this._bloomUBO[o]),0===a?h.descriptorSet.bindTexture(1,i.downsampleTexs[this.iterations-1]):h.descriptorSet.bindTexture(1,i.upsampleTexs[this.iterations-a]),h.descriptorSet.bindSampler(1,i.sampler),h.descriptorSet.update(),n.bindDescriptorSet(Qm.MATERIAL,h.descriptorSet);var c=t.window.swapchain?e.quadIAOffscreen:e.quadIAOnscreen,l=null;null!=h&&null!=u&&null!=c&&(l=PE.getOrCreatePipelineState(e.device,h,u,i.renderPass,c)),null!=l&&(n.bindPipelineState(l),n.bindInputAssembler(c),n.draw(c)),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(IM.COUNT);a[IM.TEXTURE_SIZE_OFFSET+3]=this.intensity,i.updateBuffer(this._bloomUBO[13],a),i.beginRenderPass(s.renderPass,s.combineFramebuffer,this._renderArea,bM,0,0),i.bindDescriptorSet(Qm.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(Qm.MATERIAL,o.descriptorSet);var h=t.window.swapchain?e.quadIAOffscreen:e.quadIAOnscreen,u=null,c=o.getShaderVariant();null!=o&&null!=c&&null!=h&&(u=PE.getOrCreatePipelineState(e.device,o,c,s.renderPass,h)),null!=u&&(i.bindPipelineState(u),i.bindInputAssembler(h),i.draw(h)),i.endRenderPass()},e}(aO)).initInfo={name:"BloomStage",priority:pO.BLOOM,tag:0},AM=gs((SM=RM).prototype,"_bloomMaterial",[EM,Ls],(function(){return null})),TM=SM))||TM)),BM=t("MainFlow",bs("MainFlow")(((OM=function(t){function e(){return t.apply(this,arguments)||this}s(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 mM;n.initialize(mM.initInfo),this._stages.push(n);var r=new LM;r.initialize(LM.initInfo),this._stages.push(r);var s=new vM;s.initialize(vM.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}(hO)).initInfo={name:Hm,priority:yO.MAIN,stages:[]},wM=OM))||wM),FM=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 s(e,t),e}((function(){this.outputFrameBuffer=null,this.outputRenderTargets=[],this.outputDepth=null,this.sampler=null,this.bloom=null})),UM=t("DeferredPipeline",(xM=bs("DeferredPipeline"),NM=sa([Zx]),xM((MM=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.renderTextures=PM&&PM(),e}s(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 $N;i.initialize($N.initInfo),this._flows.push(i);var n=new BM;n.initialize(BM.initInfo),this._flows.push(n)}return!0},i.activate=function(e){return this._macros={CC_PIPELINE_TYPE:1},this._pipelineSceneData=new CM,!(!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(sg,i),this._descriptorSet.bindTexture(sg,IE.get("default-texture").getGFXTexture()),this._descriptorSet.bindSampler(dg,i),this._descriptorSet.bindTexture(dg,IE.get("default-texture").getGFXTexture()),this._descriptorSet.update();var n=new qx;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 $l;s.format=xc.RGBA16F,s.loadOp=Zc.CLEAR,s.storeOp=Jc.STORE;var a=new $l;a.format=xc.RGBA16F,a.loadOp=Zc.CLEAR,a.storeOp=Jc.STORE;var o=new $l;o.format=xc.RGBA16F,o.loadOp=Zc.CLEAR,o.storeOp=Jc.STORE;var h=new t_;h.format=xc.DEPTH_STENCIL,h.depthLoadOp=Zc.CLEAR,h.depthStoreOp=Jc.STORE,h.stencilLoadOp=Zc.CLEAR,h.stencilStoreOp=Jc.STORE;var u=new n_([s,a,o],h);this._gbufferRenderPass=e.createRenderPass(u)}if(!this._lightingRenderPass){var c=new $l;c.format=xc.RGBA8,c.loadOp=Zc.CLEAR,c.storeOp=Jc.STORE,c.barrier=e.getGeneralBarrier(new r_($c.NONE,$c.COLOR_ATTACHMENT_WRITE));var l=new t_;l.format=xc.DEPTH_STENCIL,l.depthLoadOp=Zc.LOAD,l.depthStoreOp=Jc.DISCARD,l.stencilLoadOp=Zc.LOAD,l.stencilStoreOp=Jc.DISCARD,c.barrier=e.getGeneralBarrier(new r_($c.DEPTH_STENCIL_ATTACHMENT_WRITE,$c.DEPTH_STENCIL_ATTACHMENT_WRITE));var _=new n_([c],l);this._lightingRenderPass=e.createRenderPass(_)}return this._width=t.width,this._height=t.height,this._generateDeferredRenderData(),!0},i._destroyUBOs=function(){this._descriptorSet&&(this._descriptorSet.getBuffer(eg.BINDING).destroy(),this._descriptorSet.getBuffer(ng.BINDING).destroy(),this._descriptorSet.getBuffer(ig.BINDING).destroy(),this._descriptorSet.getTexture(sg).destroy(),this._descriptorSet.getTexture(dg).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 FM,n=this.pipelineSceneData,r=0;r<3;++r)i.gbufferRenderTargets.push(e.createTexture(new Ul(Fc.TEX2D,Uc.COLOR_ATTACHMENT|Uc.SAMPLED,xc.RGBA16F,this._width*n.shadingScale,this._height*n.shadingScale)));i.outputDepth=e.createTexture(new Ul(Fc.TEX2D,Uc.DEPTH_STENCIL_ATTACHMENT|Uc.SAMPLED,xc.DEPTH_STENCIL,this._width*n.shadingScale,this._height*n.shadingScale)),i.gbufferFrameBuffer=e.createFramebuffer(new o_(this._gbufferRenderPass,i.gbufferRenderTargets,i.outputDepth)),i.outputRenderTargets.push(e.createTexture(new Ul(Fc.TEX2D,Uc.COLOR_ATTACHMENT|Uc.SAMPLED,xc.RGBA16F,this._width*n.shadingScale,this._height*n.shadingScale))),i.outputFrameBuffer=e.createFramebuffer(new o_(this._lightingRenderPass,i.outputRenderTargets,null)),i.sampler=this.globalDSManager.pointSampler,this.on(oO.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}(Qx),PM=gs(MM.prototype,"renderTextures",[NM,Ls],(function(){return[]})),DM=MM))||DM));function kM(){var t=new uM;return t.initialize({flows:[]}),t}var GM,HM,zM,VM,WM=function(){function t(t){this._root=void 0,this._name="",this._cameras=[],this._models=[],this._lodGroups=[],this._batches=[],this._directionalLights=[],this._sphereLights=[],this._spotLights=[],this._pointLights=[],this._rangedDirLights=[],this._mainLight=null,this._modelId=0,this._lodStateCache=null,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,this._lodStateCache=new jM(this),!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._pointLights,o=0;o<a.length;o++)a[o].update();for(var h=this._rangedDirLights,u=0;u<h.length;u++)h[u].update();for(var c=this._models,l=0;l<c.length;l++){var _=c[l];_.enabled&&(_.updateTransform(t),_.updateUBOs(t))}this._lodStateCache.updateLodState()},e.destroy=function(){this.removeCameras(),this.removeSphereLights(),this.removeSpotLights(),this.removeRangedDirLights(),this.removeModels(),this.removeLODGroups(),this._lodStateCache.clearCache()},e.isCulledByLod=function(t,e){return this._lodStateCache.isLodModelCulled(t,e)},e.addCamera=function(t){t.attachToScene(this),this._cameras.push(t),this._lodStateCache.addCamera(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),t.detachFromScene(),void this._lodStateCache.removeCamera(t)},e.removeCameras=function(){for(var t,e=f(this._cameras);!(t=e()).done;){var i=t.value;i.detachFromScene(),this._lodStateCache.removeCamera(i)}this._cameras.splice(0)},e.setMainLight=function(t){this._mainLight=t,this._mainLight&&this._mainLight.activate()},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|=Vp.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.length=0},e.addPointLight=function(t){t.attachToScene(this),this._pointLights.push(t)},e.removePointLight=function(t){for(var e=0;e<this._pointLights.length;++e)if(this._pointLights[e]===t)return t.detachFromScene(),void this._pointLights.splice(e,1)},e.removePointLights=function(){for(var t=0;t<this._pointLights.length;++t)this._pointLights[t].detachFromScene();this._pointLights.length=0},e.addRangedDirLight=function(t){t.attachToScene(this),this._rangedDirLights.push(t)},e.removeRangedDirLight=function(t){for(var e=0;e<this._rangedDirLights.length;++e)if(this._rangedDirLights[e]===t)return t.detachFromScene(),void this._rangedDirLights.splice(e,1)},e.removeRangedDirLights=function(){for(var t=0;t<this._rangedDirLights.length;++t)this._rangedDirLights[t].detachFromScene();this._rangedDirLights.length=0},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 this._lodStateCache.removeModel(t),t.detachFromScene(),void this._models.splice(e,1)},e.removeModels=function(){for(var t,e=f(this._models);!(t=e()).done;){var i=t.value;this._lodStateCache.removeModel(i),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.addLODGroup=function(t){this._lodGroups.push(t),t.attachToScene(this),this._lodStateCache.addLodGroup(t)},e.removeLODGroup=function(t){var e=this._lodGroups.indexOf(t);e>=0&&(this._lodGroups.splice(e,1),t.detachFromScene(),this._lodStateCache.removeLodGroup(t))},e.removeLODGroups=function(){for(var t,e=f(this._lodGroups);!(t=e()).done;){var i=t.value;this._lodStateCache.removeLodGroup(i)}this._lodGroups.length=0},e.onGlobalPipelineStateChanged=function(){for(var t,e=f(this._models);!(t=e()).done;)t.value.onGlobalPipelineStateChanged()},e.generateModelId=function(){return this._modelId++},n(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:"pointLights",get:function(){return this._pointLights}},{key:"rangedDirLights",get:function(){return this._rangedDirLights}},{key:"models",get:function(){return this._models}},{key:"batches",get:function(){return this._batches}},{key:"lodGroups",get:function(){return this._lodGroups}}]),t}(),XM=function(){this.usedLevel=-1,this.lastUsedLevel=-1,this.transformDirty=!0},jM=function(){function t(t){this._renderScene=null,this._modelsInLODGroup=new Map,this._lodStateInCamera=new Map,this._newAddedLodGroupVec=new Array,this._levelModels=new Map,this._renderScene=t}var e=t.prototype;return e.addCamera=function(t){for(var e,i=f(this._renderScene.lodGroups);!(e=i()).done;){var n=e.value.node.layer;if((t.visibility&n)===n){this._lodStateInCamera.has(t)||this._lodStateInCamera.set(t,new Map);break}}},e.removeCamera=function(t){this._lodStateInCamera.has(t)&&this._lodStateInCamera.delete(t)},e.addLodGroup=function(t){this._newAddedLodGroupVec.push(t);for(var e,i=f(this._renderScene.cameras);!(e=i()).done;){var n=e.value;if(!this._lodStateInCamera.has(n)){var r=t.node.layer;(n.visibility&r)===r&&this._lodStateInCamera.set(n,new Map)}}},e.removeLodGroup=function(t){for(var e=0;e<t.lodCount;e++)for(var i,n=f(t.lodDataArray[e].models);!(i=n()).done;){var r=i.value;this._modelsInLODGroup.delete(r)}for(var s,a=f(this._lodStateInCamera);!(s=a()).done;)s.value[1].delete(t);this._levelModels.delete(t)},e.removeModel=function(t){this._modelsInLODGroup.has(t)&&this._modelsInLODGroup.delete(t)},e.updateLodState=function(){for(var t,e=this,i=f(this._newAddedLodGroupVec);!(t=i()).done;){var n=t.value,r=this._levelModels.get(n);r||(r=new Map,this._levelModels.set(n,r));for(var s=0;s<n.lodCount;s++){var a=r.get(s);a||(a=new Array);for(var o,h=f(n.lodDataArray[s].models);!(o=h()).done;){var u=o.value,c=this._modelsInLODGroup.get(u);c||(c=new Map),this._modelsInLODGroup.set(u,c),a.push(u)}r.set(s,a)}}this._newAddedLodGroupVec.length=0;for(var l,_=function(){var t=l.value;if(t.enabled){var i=t.getLockedLODLevels();if(i.length>0){if(t.node.hasChangedFlags>0)for(var n,r=f(e._lodStateInCamera);!(n=r()).done;){var s=n.value,a=s[1].get(t);a||(a=new XM,s[1].set(t,a)),a.transformDirty=!0}if(t.isLockLevelChanged()){t.resetLockChangeFlag();var o=e._levelModels.get(t);if(o){o.forEach((function(t){t.forEach((function(t){var i=e._modelsInLODGroup.get(t);i&&i.clear()}))}));for(var h,u=f(i);!(h=u()).done;){var c=h.value,_=o.get(c);_&&_.forEach((function(t){var i=e._modelsInLODGroup.get(t);if(i&&t.node&&t.node.active)for(var n,r=f(e._lodStateInCamera);!(n=r()).done;){var s=n.value;i.set(s[0],!0)}}))}}}return"continue"}for(var d,p=!1,m=f(e._lodStateInCamera);!(d=m()).done;){var g=d.value,v=g[1].get(t);v||(v=new XM,g[1].set(t,v));var y=g[0].node.hasChangedFlags,E=t.node.hasChangedFlags;if(y>0||E>0||v.transformDirty){v.transformDirty&&(v.transformDirty=!1);var T=t.getVisibleLODLevel(g[0]);T!==v.usedLevel&&(v.lastUsedLevel=v.usedLevel,v.usedLevel=T,p=!0)}}var S=e._levelModels.get(t);if(!S)return"continue";t.isLockLevelChanged()?(t.resetLockChangeFlag(),S.forEach((function(t){t.forEach((function(t){var i=e._modelsInLODGroup.get(t);i&&i.clear()}))})),p=!0):p&&e._lodStateInCamera.forEach((function(i){var n=i.get(t);if(n&&n.usedLevel!==n.lastUsedLevel){var r=S.get(n.lastUsedLevel);r&&r.forEach((function(t){var i=e._modelsInLODGroup.get(t);i&&i.clear()}))}})),p&&e._lodStateInCamera.forEach((function(i,n){var r=i.get(t);if(r){var s=r.usedLevel,a=S.get(s);a&&a.forEach((function(t){var i=e._modelsInLODGroup.get(t);i&&t.node&&t.node.active&&i.set(n,!0)}))}}))}},d=f(this._renderScene.lodGroups);!(l=d()).done;)_()},e.isLodModelCulled=function(t,e){var i=this._modelsInLODGroup.get(e);return!!i&&!i.has(t)},e.clearCache=function(){this._levelModels.clear(),this._modelsInLODGroup.clear(),this._lodStateInCamera.clear(),this._newAddedLodGroupVec.length=0},e.isLodGroupVisibleByCamera=function(t,e){var i=t.node.layer;return(e.visibility&i)===i},t}(),YM=((GM={})[gu.PORTRAIT]=wc.IDENTITY,GM[gu.LANDSCAPE_RIGHT]=wc.ROTATE_90,GM[gu.PORTRAIT_UPSIDE_DOWN]=wc.ROTATE_180,GM[gu.LANDSCAPE_LEFT]=wc.ROTATE_270,GM),KM=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(){return new t}};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++){var n=new Ul(Fc.TEX2D,Uc.COLOR_ATTACHMENT|Uc.SAMPLED|Uc.TRANSFER_SRC,e.renderPassInfo.colorAttachments[i].format,this._width,this._height);e.externalFlag&&(e.externalFlag&kc.EXTERNAL_NORMAL||e.externalFlag&kc.EXTERNAL_OES)&&(n.flags|=e.externalFlag,n.externalRes=e.externalResLow?e.externalResLow:0),this._colorTextures.push(t.createTexture(n))}e.renderPassInfo.depthStencilAttachment.format!==xc.UNKNOWN&&(this._depthStencilTexture=t.createTexture(new Ul(Fc.TEX2D,Uc.DEPTH_STENCIL_ATTACHMENT|Uc.SAMPLED,e.renderPassInfo.depthStencilAttachment.format,this._width,this._height)),this._hasOffScreenAttachments=!0)}return this._framebuffer=t.createFramebuffer(new o_(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,YM[lc.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 o_(this._renderPass,this._colorTextures,this._depthStencilTexture)));for(var n,r=f(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}))},n(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}();!function(t){t[t.NONE=-1]="NONE",t[t.LEFT=0]="LEFT",t[t.RIGHT=1]="RIGHT"}(HM||(HM={})),function(t){t[t.SESSION_RUNNING=2]="SESSION_RUNNING",t[t.VIEW_COUNT=6]="VIEW_COUNT",t[t.SWAPCHAIN_WIDTH=7]="SWAPCHAIN_WIDTH",t[t.SWAPCHAIN_HEIGHT=8]="SWAPCHAIN_HEIGHT",t[t.DEVICE_IPD=37]="DEVICE_IPD",t[t.SPLIT_AR_GLASSES=42]="SPLIT_AR_GLASSES"}(zM||(zM={})),function(t){t[t.VIEW_LEFT=0]="VIEW_LEFT",t[t.HAND_LEFT=1]="HAND_LEFT",t[t.AIM_LEFT=2]="AIM_LEFT",t[t.VIEW_RIGHT=3]="VIEW_RIGHT",t[t.HAND_RIGHT=4]="HAND_RIGHT",t[t.AIM_RIGHT=5]="AIM_RIGHT",t[t.HEAD_MIDDLE=6]="HEAD_MIDDLE"}(VM||(VM={}));var qM=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 fw,this._fpsTime=0,this._frameCount=0,this._fps=0,this._fixedFPS=0,this._useDeferredPipeline=!1,this._fixedFPSFrameTime=0,this._cumulativeTime=0,this._frameTime=0,this._cameraList=[],this._device=t,this._dataPoolMgr=g.internal.DataPoolManager&&new g.internal.DataPoolManager(t),WM.registerCreateFunc(this),KM.registerCreateFunc(this),this._cameraPool=new ou((function(){return new Wb(e._device)}),4,(function(t){return t.destroy()}))}var e=t.prototype;return e.initialize=function(){var t,e=_f.swapchain,i=new $l;i.format=e.colorTexture.format;var n=new t_;n.format=e.depthStencilTexture.format,n.depthStoreOp=Jc.DISCARD,n.stencilStoreOp=Jc.DISCARD;var r=new n_([i],n);this._mainWindow=this.createWindow({title:"rootMainWindow",width:e.width,height:e.height,renderPassInfo:r,swapchain:e}),this._curWindow=this._mainWindow;var s=Ee.querySettings(ye.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(),g.rendering&&g.rendering.destroy()},e.resize=function(t,e){for(var i,n=f(this._windows);!(i=n()).done;){var r=i.value;r.swapchain&&r.resize(t,e)}},e.setRenderPipeline=function(t){var e=g.internal,i=g.director,n=g.rendering;t instanceof UM&&(this._useDeferredPipeline=!0);var r=!1;if(t||(t=kM(),r=!0),this._useDeferredPipeline&&this.device.hasFeature(Oc.COMPUTE_SHADER)||(t.clusterEnabled=!1),t.bloomEnabled=!1,""!==Te.CUSTOM_PIPELINE_NAME&&n&&this.usesCustomPipeline?(this._customPipeline=n.createCustomPipeline(),r=!0,this._pipeline=this._customPipeline,this._pipelineEvent=t):(this._classicPipeline=t,this._pipeline=this._classicPipeline,this._pipelineEvent=this._classicPipeline,this._usesCustomPipeline=!1),(Ee.querySettings(ye.Category.RENDERING,"renderMode")!==af.HEADLESS||this._classicPipeline)&&!this._pipeline.activate(this._mainWindow.swapchain))return r&&this._pipeline.destroy(),this._classicPipeline=null,this._customPipeline=null,this._pipeline=null,this._pipelineEvent=null,!1;var s=i.getScene();return s&&s.globals.activate(),this.onGlobalPipelineStateChanged(),!(!this._batcher&&e.Batcher2D&&(this._batcher=new e.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){var e;this._frameTime=t,++this._frameCount,this._cumulativeTime+=t,this._fpsTime+=t,this._fpsTime>1&&(this._fps=this._frameCount,this._frameCount=0,this._fpsTime=0),null!==(e=globalThis.__globalXR)&&void 0!==e&&e.isWebXR?this._doWebXRFrameMove():(this._frameMoveBegin(),this._frameMoveProcess(),this._frameMoveEnd())},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=f(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=f(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 ou((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 ou((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 yI.DIRECTIONAL:t.scene.removeDirectionalLight(t);break;case yI.SPHERE:t.scene.removeSphereLight(t);break;case yI.SPOT:t.scene.removeSpotLight(t);break;case yI.POINT:t.scene.removePointLight(t);break;case yI.RANGED_DIRECTIONAL:t.scene.removeRangedDirLight(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 yI.DIRECTIONAL:t.scene.removeDirectionalLight(t);break;case yI.SPHERE:t.scene.removeSphereLight(t);break;case yI.SPOT:t.scene.removeSpotLight(t);break;case yI.POINT:t.scene.removePointLight(t);break;case yI.RANGED_DIRECTIONAL:t.scene.removeRangedDirLight(t)}},e._doWebXRFrameMove=function(){var t=globalThis.__globalXR;if(t){var e=this._windows,i=this._cameraList,n=t.webXRMatProjs?t.webXRMatProjs.length:1;t.webXRWindowMap||(t.webXRWindowMap=new Map);for(var r=[],s=t.webxrHmdPoseInfos,a=0;a<n;a++){for(var o,h=f(e);!(o=h()).done;){var u=o.value;r=r.concat(u.cameras),u.swapchain&&t.webXRWindowMap.set(u,a)}if(s){for(var c=[0,0,0],l=0;l<s.length;l++){var _=s[l];if(_.code===VM.VIEW_LEFT&&a===HM.LEFT||_.code===VM.VIEW_RIGHT&&a===HM.RIGHT){c[0]=_.position.x,c[1]=_.position.y,c[2]=_.position.z;break}}for(var d,p=f(r);!(d=p()).done;){var m=d.value;m.trackingType!==Mb.NO_TRACKING&&m.node&&(m.trackingType===Mb.ROTATION&&(c=[0,0,0]),m.node.setPosition(c[0],c[1],c[2]))}}r.length=0,this._frameMoveBegin(),this._frameMoveProcess();for(var g=i.length-1;g>=0;g--){var v=i[g];(a===HM.LEFT&&v.cameraType===Db.RIGHT_EYE||a===HM.RIGHT&&v.cameraType===Db.LEFT_EYE)&&i.splice(g,1)}this._frameMoveEnd()}}},e._frameMoveBegin=function(){for(var t=0;t<this._scenes.length;++t)this._scenes[t].removeBatches();this._cameraList.length=0},e._frameMoveProcess=function(){for(var t=g.director,e=this._windows,i=this._cameraList,n=0;n<e.length;n++)e[n].extractRenderCameras(i);if(this._pipeline&&i.length>0){this._device.acquire([_f.swapchain]);var r=this._scenes,s=t.getTotalFrames();this._batcher&&(this._batcher.update(),this._batcher.uploadBuffers());for(var a=0;a<r.length;a++)r[a].update(s)}},e._frameMoveEnd=function(){var t=g.director,e=g.Director,i=this._cameraList;if(this._pipeline&&i.length>0){t.emit(e.EVENT_BEFORE_COMMIT),i.sort((function(t,e){return t.priority-e.priority}));for(var n=0;n<i.length;++n){var r;null===(r=i[n].geometryRenderer)||void 0===r||r.update()}t.emit(e.EVENT_BEFORE_RENDER),this._pipeline.render(i),t.emit(e.EVENT_AFTER_RENDER),this._device.present()}this._batcher&&this._batcher.reset()},e._resizeMaxJointForDS=function(){var t=Math.max((eg.COUNT+ig.COUNT+ng.COUNT+gg.COUNT+vg.COUNT)/4,100),e=Math.floor((_f.gfxDevice.capabilities.maxVertexUniformVectors-t)/3);Ig(e=e<256?e:256)},n(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}},{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}},{key:"cameraList",get:function(){return this._cameraList}}]),t}());g.Root=qM,ci.Attr.setClassAttr(Hd,"target","type","Object"),ci.Attr.setClassAttr(Hd,"target","ctor",Lm);var QM,ZM=new Array(16),JM=null,$M=new pn,tP=[Xp.TOUCH_START,Xp.TOUCH_MOVE,Xp.TOUCH_END,Xp.TOUCH_CANCEL],eP=[Xp.MOUSE_DOWN,Xp.MOUSE_ENTER,Xp.MOUSE_MOVE,Xp.MOUSE_LEAVE,Xp.MOUSE_UP,Xp.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"}(QM||(QM={}));var iP,nP=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(QM.MARK_LIST_DIRTY),i&&n.length>0)for(var r=0;r<n.length;++r)n[r]._eventProcessor.setEnabled(e,!0);if(this._dispatchingTouch&&!this._isEnabled){var s=new VC([this._dispatchingTouch],!0,FC.TOUCH_CANCEL);s.touch=this._dispatchingTouch,this.dispatchEvent(s),this.claimedTouchIdList.length=0,this._dispatchingTouch=null}}},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(JM===this._node&&(JM=null),this.capturingTarget&&this.capturingTarget.clear(),this.bubblingTarget&&this.bubblingTarget.clear(),t.callbacksInvoker.emit(QM.REMOVE_POINTER_EVENT_PROCESSOR,this),this._dispatchingTouch){var e=new VC([this._dispatchingTouch],!0,FC.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(QM.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,ZM.length=0,this.getCapturingTargets(t.type,ZM),t.eventPhase=1,n=ZM.length-1;n>=0;--n)if((e=ZM[n]).eventProcessor.capturingTarget&&(t.currentTarget=e,e.eventProcessor.capturingTarget.emit(t.type,t,ZM),t.propagationStopped))return void(ZM.length=0);if(ZM.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,ZM),t.eventPhase=3,n=0;n<ZM.length;++n)if((e=ZM[n]).eventProcessor.bubblingTarget&&(t.currentTarget=e,e.eventProcessor.bubblingTarget.emit(t.type,t),t.propagationStopped))return void(ZM.length=0);ZM.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&&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&&n.hasEventListener(t)&&e.push(i),i=i.parent}},e.onUpdatingSiblingIndex=function(){t.callbacksInvoker.emit(QM.MARK_LIST_DIRTY)},e._searchComponentsInParent=function(t){var e=this.node;if(t){for(var i=0,n=[],r=e;r&&Lm.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!==tP.indexOf(t)},e._isMouseEvent=function(t){return-1!==eP.indexOf(t)},e._hasTouchListeners=function(){for(var t=0;t<tP.length;++t){var e=tP[t];if(this.hasEventListener(e))return!0}return!1},e._hasMouseListeners=function(){for(var t=0;t<eP.length;++t){var e=eP[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(QM.ADD_POINTER_EVENT_PROCESSOR,this)},e._newCallbacksInvoker=function(){var e=this,i=new Bu;return i._registerOffCallback((function(){e.shouldHandleEventTouch&&!e._hasTouchListeners()&&(e.shouldHandleEventTouch=!1),e.shouldHandleEventMouse&&!e._hasMouseListeners()&&(e.shouldHandleEventMouse=!1),e._hasPointerListeners()||t.callbacksInvoker.emit(QM.REMOVE_POINTER_EVENT_PROCESSOR,e)})),i},e._handleEventMouse=function(t){switch(t.type){case FC.MOUSE_DOWN:return this._handleMouseDown(t);case FC.MOUSE_MOVE:return this._handleMouseMove(t);case FC.MOUSE_UP:return this._handleMouseUp(t);case FC.MOUSE_WHEEL:return this._handleMouseWheel(t);default:return!1}},e._handleMouseDown=function(t){var e=this._node;return!(!e||!e._uiProps.uiTransformComp||(t.getLocation($M),!e._uiProps.uiTransformComp.hitTest($M,t.windowId)||(t.type=Xp.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($M),e._uiProps.uiTransformComp.hitTest($M,t.windowId)?(this.previousMouseIn||(JM&&JM!==e&&(t.type=Xp.MOUSE_LEAVE,JM.dispatchEvent(t),JM.eventProcessor.previousMouseIn=!1),JM=e,t.type=Xp.MOUSE_ENTER,e.dispatchEvent(t),this.previousMouseIn=!0),t.type=Xp.MOUSE_MOVE,t.bubbles=!0,e.dispatchEvent(t),t.propagationStopped=!0,0):(this.previousMouseIn&&(t.type=Xp.MOUSE_LEAVE,e.dispatchEvent(t),this.previousMouseIn=!1,JM=null),1)))},e._handleMouseUp=function(t){var e=this._node;return!(!e||!e._uiProps.uiTransformComp||(t.getLocation($M),!e._uiProps.uiTransformComp.hitTest($M,t.windowId)||(t.type=Xp.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($M),!e._uiProps.uiTransformComp.hitTest($M,t.windowId)||(t.type=Xp.MOUSE_WHEEL,t.bubbles=!0,e.dispatchEvent(t),t.propagationStopped=!0,0)))},e._handleEventTouch=function(t){switch(t.type){case FC.TOUCH_START:return this._handleTouchStart(t);case FC.TOUCH_MOVE:return this._handleTouchMove(t);case FC.TOUCH_END:return this._handleTouchEnd(t);case FC.TOUCH_CANCEL:return this._handleTouchCancel(t);default:return!1}},e._handleTouchStart=function(t){var e=this.node;return!(!e||!e._uiProps.uiTransformComp||(t.getLocation($M),!e._uiProps.uiTransformComp.hitTest($M,t.windowId)||(t.type=Xp.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=Xp.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($M),e._uiProps.uiTransformComp.hitTest($M,t.windowId)?t.type=Xp.TOUCH_END:t.type=Xp.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=Xp.TOUCH_CANCEL,t.bubbles=!0,e.dispatchEvent(t))},n(t,[{key:"isEnabled",get:function(){return this._isEnabled}},{key:"node",get:function(){return this._node}}]),t}();nP._maskComp=null,nP.callbacksInvoker=new Bu,g.NodeEventProcessor=nP,it(Lm.prototype,"Node",[{name:"childrenCount",newName:"children.length",customGetter:function(){return this.children.length}}]),it(Lm.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 pn),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 vn),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)}}]),nt(aC.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"}]),it(aC.prototype,"SceneGlobals.prototype",[{name:"distance",newName:"planeHeight"},{name:"normal",newName:"planeDirection"},{name:"size",newName:"shadowMapSize"}]),nt(Lm.prototype,"Node.prototype",[{name:"addLayer"},{name:"removeLayer"}]),it(Wp.prototype,"NodeUIProperties",[{name:"opacityDirty",newName:"colorDirty"}]),nt(Hp,"Layers",[{name:"All"},{name:"RaycastMask"},{name:"check"}]),it(Hp,"Layers",[{name:"Default",newName:"DEFAULT",target:Hp.Enum,targetName:"Layers.Enum"},{name:"Always",newName:"ALWAYS",target:Hp.Enum,targetName:"Layers.Enum"},{name:"IgnoreRaycast",newName:"IGNORE_RAYCAST",target:Hp.Enum,targetName:"Layers.Enum"},{name:"Gizmos",newName:"GIZMOS",target:Hp.Enum,targetName:"Layers.Enum"},{name:"Editor",newName:"EDITOR",target:Hp.Enum,targetName:"Layers.Enum"},{name:"UI",newName:"UI_3D",target:Hp.Enum,targetName:"Layers.Enum"},{name:"UI2D",newName:"UI_2D",target:Hp.Enum,targetName:"Layers.Enum"},{name:"SceneGizmo",newName:"SCENE_GIZMO",target:Hp.Enum,targetName:"Layers.Enum"},{name:"makeInclusiveMask",newName:"makeMaskInclude",target:Hp,targetName:"Layers"},{name:"makeExclusiveMask",newName:"makeMaskExclude",target:Hp,targetName:"Layers"}]),nt(Hp.Enum,"Layers.Enum",[{name:"ALWAYS"}]),nt(Hp.BitMask,"Layers.BitMask",[{name:"ALWAYS"}]);var rP=Ta.Flags.HideInHierarchy,sP=Ta.Flags.DontSave,aP=t("PrivateNode",bs("cc.PrivateNode")(iP=function(t){function e(e){var i;return j(12003,(i=t.call(this,e)||this).name),i.hideFlags|=sP|rP,i}return s(e,t),e}(Lm))||iP);function oP(t,e){if(!e){var i=g.director.getScene();if(!i)return null;e=i}return e.getChildByPath(t)}it(BC,"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:Lm.EventType,targetName:"Node.EventType"}}))),it(Lm.EventType,"Node.EventType",[{name:"DEVICEMOTION",target:bb.EventType,targetName:"SystemEvent.EventType"},{name:"KEY_DOWN",target:bb.EventType,targetName:"SystemEvent.EventType"},{name:"KEY_UP",target:bb.EventType,targetName:"SystemEvent.EventType"}]),g.PrivateNode=aP,ft({BaseNode:{newName:"Node",since:"3.7.0",removed:!1}}),g.find=oP;var hP=se,uP=Ta.Flags.IsStartCalled,cP=Ta.Flags.IsOnEnableCalled;function lP(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],h=o.constructor._executionOrder;if(h>i)s=a-1;else if(h<i)r=a+1;else{var u=o._id;if(u>n)s=a-1;else{if(!(u<n))return a;r=a+1}}}return~r}function _P(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 fP=function(t){this._zero=void 0,this._neg=void 0,this._pos=void 0,this._invoke=void 0;var e=ne;this._zero=new e([]),this._neg=new e([]),this._pos=new e([]),this._invoke=t};function dP(t,e){return t.constructor._executionOrder-e.constructor._executionOrder}fP.stableRemoveInactive=_P;var pP=function(t){function e(){return t.apply(this,arguments)||this}s(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){_P(this._zero,t),_P(this._neg,t),_P(this._pos,t)},i.invoke=function(){var t=this._neg;t.array.length>0&&(t.array.sort(dP),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(dP),this._invoke(e),e.array.length=0)},e}(fP),mP=function(t){function e(){return t.apply(this,arguments)||this}s(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=lP(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=lP(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}(fP);function gP(t,e,i){return function(n,r){try{e(n,r)}catch(e){g._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){g._throw(t),i&&(s[n.i]._objFlags|=i)}}}}var vP=gP((function(t){t.start(),t._objFlags|=uP}),(function(t){var e=t.array;for(t.i=0;t.i<e.length;++t.i){var i=e[t.i];i.start(),i._objFlags|=uP}}),uP),yP=gP((function(t,e){t.update(e)}),(function(t,e){var i=t.array;for(t.i=0;t.i<i.length;++t.i)i[t.i].update(e)})),EP=gP((function(t,e){t.lateUpdate(e)}),(function(t,e){var i=t.array;for(t.i=0;t.i<i.length;++t.i)i[t.i].lateUpdate(e)})),TP=function(t){var e=g.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))}},SP=function(){function t(){this.startInvoker=void 0,this.updateInvoker=void 0,this.lateUpdateInvoker=void 0,this._deferredComps=[],this._updating=void 0,this.unscheduleAll()}var e=t.prototype;return e.unscheduleAll=function(){this.startInvoker=new pP(vP),this.updateInvoker=new mP(yP),this.lateUpdateInvoker=new mP(EP),this._updating=!1},e._onEnabled=function(t){g.director.getScheduler().resumeTarget(t),t._objFlags|=cP,this._updating?this._deferredComps.push(t):this._scheduleImmediate(t)},e._onDisabled=function(t){g.director.getScheduler().pauseTarget(t),t._objFlags&=~cP;var e=this._deferredComps.indexOf(t);e>=0?hP(this._deferredComps,e):(!t.start||t._objFlags&uP||this.startInvoker.remove(t),t.update&&this.updateInvoker.remove(t),t.lateUpdate&&this.lateUpdateInvoker.remove(t))},e.enableComp=function(t,e){if(!(t._objFlags&cP)){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&cP&&(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&uP||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}(),AP=Ta.Flags.IsPreloadStarted,RP=Ta.Flags.IsOnLoadStarted,CP=Ta.Flags.IsOnLoadCalled,bP=Ta.Flags.Deactivating,IP=function(t){function e(){return t.apply(this,arguments)||this}s(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){fP.stableRemoveInactive(this._zero,t)},i.invoke=function(){this._invoke(this._zero),this._zero.array.length=0},e}(fP),wP=gP((function(t){t.__preload()}),(function(t){var e=t.array;for(t.i=0;t.i<e.length;++t.i)e[t.i].__preload()})),OP=gP((function(t){t.onLoad(),t._objFlags|=CP}),(function(t){var e=t.array;for(t.i=0;t.i<e.length;++t.i){var i=e[t.i];i.onLoad(),i._objFlags|=CP}}),CP),xP=new ie(4);function NP(t,e,i){K(3817,t.name,i),console.log("Corrupted component value:",e),e?t._removeComponent(e):re(t._components,i)}xP.get=function(){var t=this._get()||{preload:new IP(wP),onLoad:new pP(OP),onEnable:new pP(TP)};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 DP=t("NodeActivator",function(){function t(){this.resetComp=void 0,this._activatingStack=void 0,this.reset()}var e=t.prototype;return e.reset=function(){this._activatingStack=[]},e.activateNode=function(t,e){if(e){var i=xP.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(),xP.put(i)}else{this._deactivateNodeRecursively(t);for(var n,r=f(this._activatingStack);!(n=r()).done;){var s=n.value;s.preload.cancelInactive(AP),s.onLoad.cancelInactive(RP),s.onEnable.cancelInactive()}}t.emit(Xp.ACTIVE_IN_HIERARCHY_CHANGED,t)},e.activateComp=function(t,e,i,n){if(Aa(t,!0)&&(t._objFlags&AP||(t._objFlags|=AP,t.__preload&&(e?e.add(t):t.__preload())),t._objFlags&RP||(t._objFlags|=RP,t.onLoad?i?i.add(t):(t.onLoad(),t._objFlags|=CP):t._objFlags|=CP),t._enabled)){if(!t.node._activeInHierarchy)return;g.director._compScheduler.enableComp(t,n)}},e.destroyComp=function(t){g.director._compScheduler.disableComp(t),t.onDestroy&&t._objFlags&CP&&t.onDestroy()},e._activateNodeRecursively=function(t,e,i,n){if(t._objFlags&bP)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 g.Component?this.activateComp(a,e,i,n):(NP(t,a,s),--s,--r)}for(var o=0,h=t._children.length;o<h;++o){var u=t._children[o];u._active&&this._activateNodeRecursively(u,e,i,n)}t._onPostActivated(!0)}},e._deactivateNodeRecursively=function(t){t._objFlags|=bP,t._activeInHierarchy=!1;for(var e=t._components.length,i=0;i<e;++i){var n=t._components[i];if(n._enabled&&(g.director._compScheduler.disableComp(n),t._activeInHierarchy))return void(t._objFlags&=~bP)}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&=~bP)}t._onPostActivated(!1),t._objFlags&=~bP},t}()),MP=Ta.Flags.Destroyed,PP=Ta.Flags.PersistentMask,LP=ci.Attr.DELIMETER+"default",BP=ci.IDENTIFIER_RE,FP="var ",UP="o",kP={"cc.ClickEvent":!1,"cc.PrefabInfo":!1},GP=ci.escapeForJS,HP=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 FP+this.varName+"="+this.expression+";"},t}();function zP(t,e){return e instanceof HP?new HP(e.varName,t+e.expression):t+e}function VP(t,e,i){Array.isArray(i)?(i[0]=zP(e,i[0]),t.push(i)):t.push(zP(e,i)+";")}var WP=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];VP(t,e+XP(n[0])+"=",n[1])}},t}();function XP(t){return BP.test(t)?"."+t:"["+GP(t)+"]"}WP.pool=void 0,WP.pool=new ie((function(t){t._exps.length=0,t._targetExp=null}),1),WP.pool.get=function(t){var e=this._get()||new WP;return e._targetExp=t,e};var jP,YP,KP,qP,QP,ZP,JP=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=It(),Ut(this.funcModuleCache,kP),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=FP+this.globalVariables.join(",")+";");var n=Rc(["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=wt(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=WP.pool.get(n),s=e.constructor.__props__;s||(s=Object.keys(e));for(var a=0;a<s.length;a++){var o=s[a],h=i[o];if(e[o]!==h){var u=this.enumerateField(i,o,h);r.append(o,u)}}r.writeCode(t),WP.pool.put(r)},e.enumerateCCClass=function(t,e,i){for(var n=i.__values__,r=ci.Attr.getClassAttrs(i),s=0;s<n.length;s++){var a=n[s],o=e[a],h=r[a+LP];if(!$P(h,o))if("object"==typeof o&&o instanceof g.ValueType&&(h=ci.getDefault(h))&&h.constructor===o.constructor){var u=UP+XP(a);this.setValueType(t,h,o,u)}else this.setObjProp(t,e,a,o)}},e.instantiateArray=function(t){if(0===t.length)return"[]";var e="a"+ ++this.localVariableId,i=[new HP(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)VP(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 HP(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]&&VP(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]=zP(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?GP(i):("_objFlags"===e&&Sa(t)&&(i&=PP),i)},e.setObjProp=function(t,e,i,n){VP(t,UP+XP(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 g.ValueType)return ci.getNewValueTypeCode(t);if(t instanceof g.Asset)return this.getObjRef(t);if(t._objFlags&MP)return null;var e,i=t.constructor;if(li(i)){if(this.parent)if(this.parent instanceof g.Component){if(t instanceof g.Node||t instanceof g.Component)return this.getObjRef(t)}else if(this.parent instanceof g.Node)if(t instanceof g.Node){if(!t.isChildOf(this.parent))return this.getObjRef(t)}else if(t instanceof g.Component){var n;if(null===(n=t.node)||void 0===n||!n.isChildOf(this.parent))return this.getObjRef(t)}e=new HP(UP,"new "+this.getFuncModule(i,!0)+"()")}else if(i===Object)e=new HP(UP,"{}");else{if(i)return this.getObjRef(t);e=new HP(UP,"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 $P(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 g.ValueType){if(t.equals(e))return!0}else{if(Array.isArray(t))return 0===t.length&&0===e.length;if(t.constructor===Object)return Tt(t)&&Tt(e)}return!1}var tL=fe({AUTO:0,SINGLE_INSTANCE:1,MULTI_INSTANCE:2}),eL=t("Prefab",bs("cc.Prefab")(((ZP=function(t){function e(){var e;return(e=t.call(this)||this).data=KP&&KP(),e.optimizationPolicy=qP&&qP(),e.persistent=QP&&QP(),e._createFunction=void 0,e._instantiatedTimes=void 0,e._createFunction=null,e._instantiatedTimes=0,e}s(e,t);var i=e.prototype;return i.createNode=function(t){var e=g.instantiate(this);e.name=this.name,t(null,e)},i.compileCreateFunction=function(){var t,e;this._createFunction=(e=(t=this.data)instanceof g.Node&&t,new JP(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 t=this.data._instantiate(),++this._instantiatedTimes,t},i.initDefault=function(e){t.prototype.initDefault.call(this,e),this.data=new Lm,this.data.name="(Missing Node)";var i=new g._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;RC(t),SC(t)},e}(jf)).OptimizationPolicy=tL,ZP.OptimizationPolicyThreshold=3,KP=gs((YP=ZP).prototype,"data",[Ls],(function(){return null})),qP=gs(YP.prototype,"optimizationPolicy",[Ls],(function(){return tL.AUTO})),QP=gs(YP.prototype,"persistent",[Ls],(function(){return!1})),jP=YP))||jP);At(eL,"_utils",MC),g.Prefab=eL,Ot(g,"cc._Prefab","Prefab");var iL=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,se(this._allRenderers,e),t._internalId=-1,t._dirtyVersion===this._dirtyVersion&&(oe(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}()),nL=[".png",".jpg",".bmp",".jpeg",".gif",".ico",".tiff",".webp",".image",".pvr",".pkm",".astc"],rL=[".mp3",".ogg",".wav",".m4a"];function sL(){return!0}var aL={transformURL:function(t){var e=Lf(t);if(!e)return t;var i=Tf.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"===Ju(t)&&(s=!0),s){var a=ec(t),o=tc(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}},oL=t("CCLoader",function(){function t(){this._autoReleaseSetting=Object.create(null),this._parseLoadResArgs=Ey}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=[];SE.loadAny(n,null,(function(t,i,n){n.content&&(nL.includes(n.ext)?a.push(n.content):rL.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 jf)){var r=i,s=n[t].url;a.includes(r)?sE.create(s,i,".png",{},(function(i,n){r=e[t]=n})):o.includes(r)&&sE.create(s,i,".mp3",{},(function(i,n){r=e[t]=n})),vf.add(s,r)}},h=0;h<e.length;h++)s(h);if(e.length>1){var u=Object.create(null);e.forEach((function(t){u[t._uuid]=t})),r={isCompleted:sL,_map:u}}else r=e[0]}i&&i(t,r)}))},e.getXMLHttpRequest=function(){return new XMLHttpRequest},e.getItem=function(t){return SE.assets.has(t)?{content:SE.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,h=Ju(t);h&&!Ry.getInfoWithPath(t,s)&&(t=t.slice(0,-h.length)),Ry.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=Ju(e);n&&!Ry.getInfoWithPath(e,s)&&(t[i]=e.slice(0,-n.length))})),Ry.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;Ry.loadDir(t,s,a,(function(e,i){var n=[];e||(n=Ry.getDirWithPath(t,s).map((function(t){return t.path}))),o&&o(e,i,n)}))},e.getRes=function(t,e){return vf.has(t)?vf.get(t):Ry.get(t,e)},e.getResCount=function(){return vf.count},e.getDependsRecursively=function(t){if(!t)return[];var e="string"==typeof t?t:t._uuid;return wp.getDepsRecursively(e).concat([e])},e.addDownloadHandlers=function(t){var e=Object.create(null),i=function(){var i=t[n];e["."+n]=function(t,e,n){i({url:t},n)}};for(var n in t)i();Yy.register(e)},e.addLoadHandlers=function(t){var e=Object.create(null),i=function(){var i=t[n];e["."+n]=function(t,e,n){i({content:t},n)}};for(var n in t)i();lE.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=vf.get(i)),SE.releaseAsset(i)}else t&&("string"==typeof t&&(t=vf.get(t)),SE.releaseAsset(t))},e.releaseAsset=function(t){SE.releaseAsset(t)},e.releaseRes=function(t,e){Ry.release(t,e)},e.releaseAll=function(){SE.releaseAll(),vf.clear()},e.removeItem=function(t){return!!vf.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=wp.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]},n(t,[{key:"onProgress",set:function(t){_y=t}},{key:"_cache",get:function(){if(vf instanceof pf)return vf.map;var t={};return vf.forEach((function(e,i){t[i]=e})),t}},{key:"md5Pipe",get:function(){return aL}},{key:"downloader",get:function(){return Yy}},{key:"loader",get:function(){return SE.parser}}]),t}()),hL=t("loader",new oL),uL=t("AssetLibrary",{init:function(t){t.importBase=t.libraryPath,t.nativeBase=t.rawAssetsBase,SE.init(t),t.rawAssets&&Ry.init({base:"",deps:[],scenes:{},redirect:[],debug:!0,packs:{},types:[],versions:{import:[],native:[]},name:bf.RESOURCES,importBase:t.importBase,nativeBase:t.nativeBase,paths:t.rawAssets.assets,uuids:Object.keys(t.rawAssets.assets),extensionMap:{}})},loadAsset:function(t,e){SE.loadAny(t,e)}}),cL=t("url",{});it(cL,"url",[{name:"normalize",target:SE.utils,targetName:"assetManager.utils",newName:"normalize"},{name:"raw",targetName:"Asset.prototype",newName:"nativeUrl",customFunction:function(t){return t.startsWith("resources/")?kf({path:ic(t.substr(10)),bundle:bf.RESOURCES,__isNative__:!0,ext:Ju(t)}):""}}]),nt(uL,"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"}]),nt(hL,"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"}]),it(g,"cc",[{name:"loader",newName:"assetManager",logTimes:1,customGetter:function(){return hL}},{name:"AssetLibrary",newName:"assetManager",logTimes:1,customGetter:function(){return uL}},{name:"Pipeline",target:TE,targetName:"AssetManager",newName:"Pipeline",logTimes:1},{name:"url",targetName:"assetManager",newName:"utils",logTimes:1,customGetter:function(){return cL}}]),nt(g,"cc",[{name:"LoadingItems",suggest:J(1400,"LoadingItems","AssetManager.Task")}]),it(Te,"macro",[{name:"DOWNLOAD_MAX_CONCURRENT",target:Yy,targetName:"assetManager.downloader",newName:"maxConcurrency"}]);var lL=ly._autoRelease;ly._autoRelease=function(t,e,i){lL.call(ly,t,e,i);for(var n=hL._autoReleaseSetting,r=Object.keys(n),s=0;s<r.length;s++){var a=r[s];if(!0===n[a]){var o=vf.get(a);o&&ly.tryRelease(o)}}};var _L=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 mu,e._compScheduler=new SP,e._nodeActivator=new DP,e._systems=[],e}s(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(),Aa(this._scene)&&this._scene.destroy(),this._scene=null,this.stopAnimation(),SE.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 LC&&(t=t.scene),Z(t instanceof PC,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(Lm.EventType.SCENE_CHANGED_FOR_PERSISTS,t.renderScene);var h=t.uuid===o._originalSceneId&&t.getChildByUuid(o.uuid);if(h){var u=h.getSiblingIndex();o.hideFlags&=~Ta.Flags.DontSave,o.hideFlags|=Ta.Flags.DontSave&h.hideFlags,h._destroyImmediate(),t.insertChild(o,u)}else o.hideFlags|=Ta.Flags.DontSave,o.parent=t}var c=this._scene;Aa(c)&&c.destroy(),ly._autoRelease(c,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 LC&&(t=t.scene),Z(t,1205),Z(t instanceof PC,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=SE.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=SE.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 g.game.deltaTime},i.getTotalTime=function(){return g.game.totalTime},i.getCurrentTime=function(){return g.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(mu.ID,t,200))},i.registerSystem=function(t,e,i){e.id=t,e.priority=i,this._systems.push(e),this._systems.sort(cu.sortByPriority)},i.unregisterSystem=function(t){oe(this._systems,t),this._systems.sort(cu.sortByPriority)},i.getSystem=function(t){return this._systems.find((function(e){return e.id===t}))},i.getAnimationManager=function(){return this.getSystem(g.AnimationManager.ID)},i.startAnimation=function(){this._invalid=!1},i.stopAnimation=function(){this._invalid=!0},i.mainLoop=function(t){var e;e=g.game._calculateDT(t),this.tick(e)},i.tick=function(t){if(!this._invalid){if(this.emit(e.EVENT_BEGIN_FRAME),Cb._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),iL.updateAllDirtyRenderers(),this._root.frameMove(t),this.emit(e.EVENT_AFTER_DRAW),Lm.resetHasChangedFlags(),Lm.clearNodeArray(),au.update(t),this.emit(e.EVENT_END_FRAME),this._totalFrames++}},i.buildRenderPipeline=function(){this._root&&(this._root.customPipeline.beginSetup(),g.rendering.getCustomPipeline(Te.CUSTOM_PIPELINE_NAME).setup(this._root.cameraList,this._root.customPipeline),this._root.customPipeline.endSetup())},i.setupRenderPipelineBuilder=function(){""!==Te.CUSTOM_PIPELINE_NAME&&g.rendering&&this._root&&this._root.usesCustomPipeline&&this.on(e.EVENT_BEFORE_RENDER,this.buildRenderPipeline,this)},i.init=function(){this._totalFrames=0,this._paused=!1,this.registerSystem(mu.ID,this._scheduler,200),this._root=new qM(_f.gfxDevice),this._root.initialize({}),this.setupRenderPipelineBuilder();for(var t=0;t<this._systems.length;t++)this._systems[t].init();this.emit(e.EVENT_INIT)},i.addPersistRootNode=function(t){if(Lm.isNode(t)&&t.uuid){var e=t.uuid;if(!this._persistRootNodes[e]){var i=this._scene;if(Aa(i))if(t.parent){if(!(t.parent instanceof PC))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,ly._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="",ly._removePersistNodeRef(t))},i.isPersistRootNode=function(t){return!!t._persistNode},n(e,[{key:"root",get:function(){return this._root}}]),e}(Uu));_L.EVENT_INIT="director_init",_L.EVENT_RESET="director_reset",_L.EVENT_BEFORE_SCENE_LOADING="director_before_scene_loading",_L.EVENT_BEFORE_SCENE_LAUNCH="director_before_scene_launch",_L.EVENT_AFTER_SCENE_LAUNCH="director_after_scene_launch",_L.EVENT_BEFORE_UPDATE="director_before_update",_L.EVENT_AFTER_UPDATE="director_after_update",_L.EVENT_BEFORE_DRAW="director_before_draw",_L.EVENT_AFTER_DRAW="director_after_draw",_L.EVENT_BEFORE_COMMIT="director_before_commit",_L.EVENT_BEFORE_RENDER="director_before_render",_L.EVENT_AFTER_RENDER="director_after_render",_L.EVENT_BEFORE_PHYSICS="director_before_physics",_L.EVENT_AFTER_PHYSICS="director_after_physics",_L.EVENT_BEGIN_FRAME="director_begin_frame",_L.EVENT_END_FRAME="director_end_frame",_L.instance=void 0,g.Director=_L;var fL=t("director",_L.instance=g.director=new _L),dL=function(){function t(){var t=this;this._rafHandle=0,this._onTick=null,this._updateCallback=void 0,this._targetFrameRate=60,this._isPlaying=!1,this._updateCallback=function(){t._isPlaying&&(t._rafHandle=requestAnimationFrame(t._updateCallback)),t._onTick&&t._onTick()}}var e=t.prototype;return e.start=function(){this._isPlaying||(this._rafHandle=requestAnimationFrame(this._updateCallback),this._isPlaying=!0)},e.stop=function(){this._isPlaying&&(cancelAnimationFrame(this._rafHandle),this._rafHandle=0,this._isPlaying=!1)},n(t,[{key:"targetFrameRate",get:function(){return this._targetFrameRate},set:function(t){this._targetFrameRate!==t&&(this._targetFrameRate=t,Au.setPreferredFramesPerSecond(this._targetFrameRate),this._isPlaying&&(this.stop(),this.start()))}},{key:"onTick",get:function(){return this._onTick},set:function(t){this._onTick=t}}]),t}(),pL=new pn,mL=function(){var t=e.prototype;function e(){this.settings=void 0,this._curTime=0,this.device=void 0,this.swapchain=void 0,this.shader=void 0,this.sampler=void 0,this.cmdBuff=void 0,this.quadAssmebler=void 0,this.vertexBuffers=void 0,this.indicesBuffers=void 0,this.renderArea=void 0,this.clearColors=void 0,this.projection=void 0,this.isMobile=!1,this.bgMat=void 0,this.bgImage=void 0,this.bgTexture=void 0,this.logoMat=void 0,this.logoImage=void 0,this.logoTexture=void 0,this.watermarkMat=void 0,this.watermarkTexture=void 0,this.bgWidth=1920,this.bgHeight=1080,this.bgRatio=16/9,this.logoWidthTemp=140,this.logoHeightTemp=200,this.logoWidth=0,this.logoHeight=0,this.logoXTrans=.5,this.logoYTrans=1/6+2.5/6,this.textSize=24,this.textHeight=24,this.textXTrans=.5,this.textYExtraTrans=32,this.textExpandSize=4,this.scaleSize=1}return t.init=function(){var t,e,i,n,r,s,a,o,h=this;if(this.settings={displayRatio:null!==(t=Ee.querySettings(ye.Category.SPLASH_SCREEN,"displayRatio"))&&void 0!==t?t:.4,totalTime:null!==(e=Ee.querySettings(ye.Category.SPLASH_SCREEN,"totalTime"))&&void 0!==e?e:3e3,watermarkLocation:null!==(i=Ee.querySettings(ye.Category.SPLASH_SCREEN,"watermarkLocation"))&&void 0!==i?i:"default",autoFit:null===(n=Ee.querySettings(ye.Category.SPLASH_SCREEN,"autoFit"))||void 0===n||n,url:null!==(r=Ee.querySettings(ye.Category.SPLASH_SCREEN,"url"))&&void 0!==r?r:"",type:null!==(s=Ee.querySettings(ye.Category.SPLASH_SCREEN,"type"))&&void 0!==s?s:"default",bgBase64:null!==(a=Ee.querySettings(ye.Category.SPLASH_SCREEN,"bgBase64"))&&void 0!==a?a:"",base64src:null!==(o=Ee.querySettings(ye.Category.SPLASH_SCREEN,"base64src"))&&void 0!==o?o:""},this._curTime=0,!(""===this.settings.base64src||this.settings.totalTime<=0)){this.device=g.director.root.device,this.swapchain=g.director.root.mainWindow.swapchain,this.preInit(),this.initLayout(),this.initWaterMark();var u=new Promise((function(t,e){h.bgImage=new y.Image,h.bgImage.onload=function(){h.initBG(),t()},h.bgImage.onerror=function(){e()},h.bgImage.src=h.settings.bgBase64})),c=new Promise((function(t,e){h.logoImage=new y.Image,h.logoImage.onload=function(){h.initLogo(),t()},h.logoImage.onerror=function(){e()},h.logoImage.src=h.settings.base64src}));return Promise.all([u,c])}return this.settings.totalTime=0,Promise.resolve([])},t.preInit=function(){this.clearColors=[new Ol(0,0,0,255)];var t=this.device,e=this.swapchain;this.renderArea=new Tl(0,0,e.width,e.height),this.cmdBuff=t.commandBuffer;var i=new Float32Array([.5,.5,1,0,-.5,.5,0,0,.5,-.5,1,1,-.5,-.5,0,1]),n=4*Float32Array.BYTES_PER_ELEMENT,r=4*n;this.vertexBuffers=t.createBuffer(new Ml(Mc.VERTEX|Mc.TRANSFER_DST,Bc.DEVICE,r,n)),this.vertexBuffers.update(i);var s=new Uint16Array([0,1,2,1,3,2]),a=Uint16Array.BYTES_PER_ELEMENT,o=6*a;this.indicesBuffers=t.createBuffer(new Ml(Mc.INDEX|Mc.TRANSFER_DST,Bc.DEVICE,o,a)),this.indicesBuffers.update(s);var h=[new Ql("a_position",xc.RG32F),new Ql("a_texCoord",xc.RG32F)],u=new Jl(h,[this.vertexBuffers],this.indicesBuffers);this.quadAssmebler=t.createInputAssembler(u),this.projection=new cn,cn.ortho(this.projection,-1,1,-1,1,-1,1,t.capabilities.clipSpaceMinZ,t.capabilities.clipSpaceSignY,e.surfaceTransform),this.isMobile=dc.isMobile},t.initLayout=function(){this.isMobile?(this.bgWidth=812,this.bgHeight=375,this.logoWidthTemp=70,this.logoHeightTemp=100,this.textSize=12,this.textHeight=this.textSize+this.textExpandSize,this.textXTrans=.5,this.textYExtraTrans=16):(this.bgWidth=1920,this.bgHeight=1080,this.logoWidthTemp=140,this.logoHeightTemp=200,this.textSize=24,this.textHeight=this.textSize+this.textExpandSize,this.textXTrans=.5,this.textYExtraTrans=32),this.logoXTrans=.5,this.logoYTrans=1/6+2.5/6,this.initScale()},t.initScale=function(){var t=this.swapchain.width,e=this.swapchain.height,i=this.isMobile?375:1080,n=this.isMobile?812:1920;if(t>e){var r=n;n=i,i=r}this.scaleSize=t/e>16/9?e/n:t/i},t.update=function(t){var e=this.settings,i=this.device,n=this.swapchain;cn.ortho(this.projection,-1,1,-1,1,-1,1,i.capabilities.clipSpaceMinZ,i.capabilities.clipSpaceSignY,n.surfaceTransform);var r=n.width,s=n.height;this.initScale(),this._curTime+=1e3*t;var a=Ba(Si(this._curTime/e.totalTime)),o=1,h=1;r<s?(o=s*this.bgRatio,h=s):(o=r,h=r*this.bgRatio),this.bgMat.setProperty("resolution",pL.set(r,s),0),this.bgMat.setProperty("scale",pL.set(o,h),0),this.bgMat.setProperty("translate",pL.set(.5*r,.5*s),0),this.bgMat.setProperty("percent",1),this.bgMat.setProperty("u_projection",this.projection),this.bgMat.passes[0].update(),o=1,h=1,o=this.logoWidth*this.scaleSize*e.displayRatio,h=this.logoHeight*this.scaleSize*e.displayRatio;var u=s*this.logoYTrans;if(this.logoMat.setProperty("resolution",pL.set(r,s),0),this.logoMat.setProperty("scale",pL.set(o,h),0),this.logoMat.setProperty("translate",pL.set(r*this.logoXTrans,u),0),this.logoMat.setProperty("percent",a),this.logoMat.setProperty("u_projection",this.projection),this.logoMat.passes[0].update(),this.watermarkMat){var c=this.watermarkTexture.width,l=this.watermarkTexture.height;o=c,h=l;var _=u-(.5*this.logoHeight*e.displayRatio+this.textYExtraTrans)*this.scaleSize-.5*l;this.watermarkMat.setProperty("resolution",pL.set(r,s),0),this.watermarkMat.setProperty("scale",pL.set(o,h),0),this.watermarkMat.setProperty("translate",pL.set(r*this.textXTrans,_),0),this.watermarkMat.setProperty("percent",a),this.watermarkMat.setProperty("u_projection",this.projection),this.watermarkMat.passes[0].update()}this.frame()},t.initBG=function(){var t=this.device;this.bgMat=new ZE,this.bgMat.initialize({effectName:"util/splash-screen"});var e=new Gl;e.addressU=Wc.CLAMP,e.addressV=Wc.CLAMP,e.addressW=Wc.CLAMP,this.sampler=t.getSampler(e),this.bgTexture=t.createTexture(new Ul(Fc.TEX2D,Uc.SAMPLED|Uc.TRANSFER_DST,xc.RGBA8,this.bgImage.width,this.bgImage.height));var i=this.bgMat.passes[0],n=i.getBinding("mainTexture");i.bindTexture(n,this.bgTexture),this.shader=i.getShaderVariant();var r=i.descriptorSet;r.bindSampler(n,this.sampler),r.update();var s=new Il;s.texExtent.width=this.bgImage.width,s.texExtent.height=this.bgImage.height,s.texExtent.depth=1,t.copyTexImagesToTexture([this.bgImage],this.bgTexture,[s])},t.initLogo=function(){var t=this.device;this.logoMat=new ZE,this.logoMat.initialize({effectName:"util/splash-screen"});var e=new Gl;e.addressU=Wc.CLAMP,e.addressV=Wc.CLAMP,e.addressW=Wc.CLAMP,this.sampler=t.getSampler(e),this.logoTexture=t.createTexture(new Ul(Fc.TEX2D,Uc.SAMPLED|Uc.TRANSFER_DST,xc.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 Il;s.texExtent.width=this.logoImage.width,s.texExtent.height=this.logoImage.height,s.texExtent.depth=1,t.copyTexImagesToTexture([this.logoImage],this.logoTexture,[s]);var a=this.logoImage.width/this.logoImage.height;a<1?(this.logoWidth=this.logoWidthTemp,this.logoHeight=this.logoWidthTemp/a):(this.logoWidth=this.logoHeightTemp*a,this.logoHeight=this.logoHeightTemp)},t.initWaterMark=function(){var t=y.document.createElement("canvas");t.height=this.textHeight*this.scaleSize,t.style.width=""+t.width,t.style.height=""+t.height;var e="Created with Cocos",i=t.getContext("2d");i.font=this.textSize*this.scaleSize+"px Arial",i.textBaseline="top",i.textAlign="center",i.fillStyle="#707070";var n=i.measureText(e).width+10;t.width=n,i.font=this.textSize*this.scaleSize+"px Arial",i.textBaseline="top",i.textAlign="center",i.fillStyle="#707070",i.fillText(e,t.width/2,0);var r=new Il;r.texExtent.width=t.width,r.texExtent.height=t.height,r.texExtent.depth=1,this.watermarkTexture=this.device.createTexture(new Ul(Fc.TEX2D,Uc.SAMPLED|Uc.TRANSFER_DST,xc.RGBA8,t.width,t.height)),this.device.copyTexImagesToTexture([t],this.watermarkTexture,[r]),this.watermarkMat=new ZE,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(!dc.isXR||xr.entry.isRenderAllowable())for(var i=dc.isXR?2:1,n=0;n<i;n++){if(dc.isXR){xr.entry.renderLoopStart(n);var r=xr.entry.getEyeFov(n),s=1,a=1;n===HM.LEFT?s=Math.abs(Math.tan(r[0]))/Math.abs(Math.tan(r[1])):n===HM.RIGHT&&(a=Math.abs(Math.tan(r[1]))/Math.abs(Math.tan(r[0]))),cn.ortho(this.projection,-s,a,-1,1,-1,1,t.capabilities.clipSpaceMinZ,t.capabilities.clipSpaceSignY,e.surfaceTransform),this.projection.m00=un[e.surfaceTransform][0],this.projection.m05=un[e.surfaceTransform][3]*t.capabilities.clipSpaceSignY,this.bgMat.setProperty("u_projection",this.projection),this.bgMat.passes[0].update(),this.logoMat.setProperty("u_projection",this.projection),this.logoMat.passes[0].update(),this.watermarkMat&&(this.watermarkMat.setProperty("u_projection",this.projection),this.watermarkMat.passes[0].update())}t.enableAutoBarrier(!0),t.acquire([e]);var o=this.cmdBuff,h=g.director.root.mainWindow.framebuffer,u=this.renderArea;u.width=e.width,u.height=e.height,o.begin(),o.beginRenderPass(h.renderPass,h,u,this.clearColors,1,0);var c=this.bgMat.passes[0],l=PE.getOrCreatePipelineState(t,c,this.shader,h.renderPass,this.quadAssmebler);o.bindPipelineState(l),o.bindDescriptorSet(Qm.MATERIAL,c.descriptorSet),o.bindInputAssembler(this.quadAssmebler),o.draw(this.quadAssmebler);var _=this.logoMat.passes[0],f=PE.getOrCreatePipelineState(t,_,this.shader,h.renderPass,this.quadAssmebler);if(o.bindPipelineState(f),o.bindDescriptorSet(Qm.MATERIAL,_.descriptorSet),o.bindInputAssembler(this.quadAssmebler),o.draw(this.quadAssmebler),this.watermarkMat){var d=this.watermarkMat.passes[0],p=PE.getOrCreatePipelineState(t,d,this.shader,h.renderPass,this.quadAssmebler);o.bindPipelineState(p),o.bindDescriptorSet(Qm.MATERIAL,d.descriptorSet),o.bindInputAssembler(this.quadAssmebler),o.draw(this.quadAssmebler)}o.endRenderPass(),o.end(),t.flushCommands([o]),t.queue.submit([o]),t.present(),t.enableAutoBarrier(!g.rendering),dc.isXR&&xr.entry.renderLoopEnd(n)}},t.destroy=function(){this.device=null,this.swapchain=null,this.clearColors=null,this.bgImage.destroy&&this.bgImage.destroy(),this.bgImage=null,this.bgMat.destroy(),this.bgMat=null,this.bgTexture.destroy(),this.bgTexture=null,this.logoImage.destroy&&this.logoImage.destroy(),this.logoImage=null,this.renderArea=null,this.cmdBuff=null,this.shader=null,this.logoMat.destroy(),this.logoMat=null,this.logoTexture.destroy(),this.logoTexture=null,this.quadAssmebler.destroy(),this.quadAssmebler=null,this.vertexBuffers.destroy(),this.vertexBuffers=null,this.indicesBuffers.destroy(),this.indicesBuffers=null,this.sampler=null,this.watermarkTexture&&(this.watermarkMat.destroy(),this.watermarkMat=null,this.watermarkTexture.destroy(),this.watermarkTexture=null),this.settings=null},n(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}();mL._ins=void 0,g.internal.SplashScreen=mL;var gL=new(function(){function t(){this._data=null}return t.prototype.init=function(t){var e=this;return void 0===t&&(t=""),g.rendering&&g.rendering.enableEffectImport&&t?new Promise((function(i,n){if(t.startsWith("http")){var r=new XMLHttpRequest;r.open("GET",t),r.responseType="arraybuffer",r.onload=function(){e._data=r.response,i()},r.onerror=function(){n(new Error("request effect settings failed!"))},r.send(null)}else fsUtils.readArrayBuffer(t,(function(t,r){t?n(t):(e._data=r,i())}))})):Promise.resolve()},n(t,[{key:"data",get:function(){return this._data}}]),t}());g.effectSettings=gL;var vL=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._pausedByEngine=!1,e._frameRate=60,e._pacer=null,e._initTime=0,e._startTime=0,e._deltaTime=0,e._useFixedDeltaTime=!1,e._shouldLoadLaunchScene=!0,e.onPreBaseInitDelegate=new ju,e.onPostBaseInitDelegate=new ju,e.onPreInfrastructureInitDelegate=new ju,e.onPostInfrastructureInitDelegate=new ju,e.onPreSubsystemInitDelegate=new ju,e.onPostSubsystemInitDelegate=new ju,e.onPreProjectInitDelegate=new ju,e.onPostProjectInitDelegate=new ju,e}s(i,t);var r=i.prototype;return r.setFrameRate=function(t){this.frameRate=t},r.getFrameRate=function(){return this.frameRate},r.step=function(){fL.tick(this._calculateDT(!0))},r.pauseByEngine=function(){this._paused||(this._pausedByEngine=!0,this.pause())},r.resumeByEngine=function(){this._pausedByEngine&&(this.resume(),this._pausedByEngine=!1)},r.pause=function(){var t;this._paused||(this._paused=!0,null===(t=this._pacer)||void 0===t||t.stop(),this.emit(i.EVENT_PAUSE))},r.resume=function(){var t;this._paused&&(Cb._clearEvents(),this._paused=!1,null===(t=this._pacer)||void 0===t||t.start(),this.emit(i.EVENT_RESUME))},r.isPaused=function(){return this._paused},r.restart=function(){var t=this;return new Promise((function(t){fL.once(_L.EVENT_END_FRAME,(function(){return t()}))})).then((function(){fL.reset(),g.Object._deferredDestroy(),t.pause(),t.resume(),t._shouldLoadLaunchScene=!0,mL.instance.curTime=0,t._safeEmit(i.EVENT_RESTART)}))},r.end=function(){Yu.close()},r.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)},r.once=function(t,e,n){return this._engineInited&&t===i.EVENT_ENGINE_INITED?e.call(n):this.eventTargetOnce(t,e,n)},r.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(){G(t.debugMode||q.NONE)})).then((function(){return dc.init()})).then((function(){n._initEvents()})).then((function(){return Ee.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(){Te.init(),n._initXR();var t,e={frame:t=document.createElement("div"),canvas:window.canvas,container:t};e&&(n.canvas=e.canvas,n.frame=e.frame,n.container=e.container),fc.init(),Tc.init(),_f.init(n.canvas,tg),""===Te.CUSTOM_PIPELINE_NAME&&(g.rendering=void 0),SE.init(),IE.init(),Hp.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 gL.init(Ee.querySettings(ye.Category.RENDERING,"effectSettingsPath"))})).then((function(){if(g.rendering&&g.rendering.enableEffectImport)if(Ee.querySettings(ye.Category.RENDERING,"renderMode")!==af.HEADLESS){var t=gL.data;null!==t?g.rendering.init(_f.gfxDevice,t):console.error("Effect settings not found, effects will not be imported.")}else g.rendering.init(_f.gfxDevice,null)})).then((function(){return fL.init(),IE.loadBuiltinAssets()})).then((function(){return n.emit(i.EVENT_POST_SUBSYSTEM_INIT),n.onPostSubsystemInitDelegate.dispatch()})).then((function(){console.log("Cocos Creator v"+v),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=Ee.querySettings(ye.Category.PLUGINS,"jsList"),e=Promise.resolve();return t&&t.forEach((function(t){e=e.then((function(){return require("../"+("src/"+t))}))})),e})).then((function(){var t=Ee.querySettings(ye.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 IE.compileBuiltinMaterial(),mL.instance.init()})).then((function(){return n.emit(i.EVENT_POST_PROJECT_INIT),n.onPostProjectInitDelegate.dispatch()})).then((function(){n._inited=!0,n._safeEmit(i.EVENT_GAME_INITED)}))},r._initXR=function(){var t;if(void 0===globalThis.__globalXR&&(globalThis.__globalXR={}),globalThis.__globalXR.webxrCompatible=null!==(t=Ee.querySettings(ye.Category.XR,"webxrCompatible"))&&void 0!==t&&t,dc.isXR){var e,i;xr.entry=xr.XrEntry.getInstance();var n=null!==(e=Ee.querySettings(ye.Category.RENDERING,"msaa"))&&void 0!==e?e:1,r=null!==(i=Ee.querySettings(ye.Category.RENDERING,"renderingScale"))&&void 0!==i?i:1;xr.entry.setMultisamplesRTT(n),xr.entry.setRenderingScale(r)}},r._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)},r._loadPreloadAssets=function(){var t=Ee.querySettings(ye.Category.ASSETS,"preloadAssets");return t?Promise.all(t.map((function(t){return new Promise((function(e,i){SE.loadAny(t,(function(t){t?i(t):e()}))}))}))):Promise.resolve([])},r._loadCCEScripts=function(){return new Promise((function(t){t()}))},r._loadProjectBundles=function(){var t=Ee.querySettings(ye.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),SE.loadBundle(e,r,(function(e){e?n(e):t()}))}))}))):Promise.resolve([])},r.run=function(t){t&&(this.onStart=t),this._inited&&this.resume()},r._calculateDT=function(t){if(this._useFixedDeltaTime=t,t)return this._startTime=performance.now(),this.frameTime/1e3;var e=performance.now();return this._deltaTime=e>this._startTime?(e-this._startTime)/1e3:0,this._deltaTime>i.DEBUG_DT_THRESHOLD&&(this._deltaTime=this.frameTime/1e3),this._startTime=e,this._deltaTime},r._updateCallback=function(){var t=this;if(this._inited)if(mL.instance.isFinished)if(this._shouldLoadLaunchScene){this._shouldLoadLaunchScene=!1;var e,i=Ee.querySettings(ye.Category.LAUNCH,"launchScene");i?fL.loadScene(i,(function(){var e;console.log("Success to load scene: "+i),t._initTime=performance.now(),fL.startAnimation(),null===(e=t.onStart)||void 0===e||e.call(t)})):(this._initTime=performance.now(),fL.startAnimation(),null===(e=this.onStart)||void 0===e||e.call(this))}else fL.tick(this._calculateDT(!1));else mL.instance.update(this._calculateDT(!1))},r.initPacer=function(){var t,e=null!==(t=Ee.querySettings(ye.Category.SCREEN,"frameRate"))&&void 0!==t?t:60;U("number"==typeof e),this._pacer=new dL,this._pacer.onTick=this._updateCallback.bind(this),this.frameRate=e},r._initEvents=function(){Yu.on("show",this._onShow,this),Yu.on("hide",this._onHide,this),Yu.on("close",this._onClose,this)},r._onHide=function(){this.emit(i.EVENT_HIDE),this.pauseByEngine()},r._onShow=function(){this.emit(i.EVENT_SHOW),this.resumeByEngine()},r._onClose=function(){this.emit(i.EVENT_CLOSE),Yu.exit()},r.addPersistRootNode=function(t){fL.addPersistRootNode(t)},r.removePersistRootNode=function(t){fL.removePersistRootNode(t)},r.isPersistRootNode=function(t){return fL.isPersistRootNode(t)},r._setupRenderPipeline=function(){var t=this,e=Ee.querySettings(ye.Category.RENDERING,"renderPipeline");return e?new Promise((function(t,i){SE.loadAny(e,(function(e,n){return!e&&n instanceof Qx?t(n):i(e)}))})).then((function(e){t._setRenderPipeline(e)})).catch((function(i){B(i),B("Failed load render pipeline: "+e+", engine failed to initialize, will fallback to default pipeline"),t._setRenderPipeline()})):this._setRenderPipeline()},r._setRenderPipeline=function(t){fL.root.setRenderPipeline(t)||this._setRenderPipeline(),this._rendererInitialized=!0,this._safeEmit(i.EVENT_RENDERER_INITED)},r._safeEmit=function(t){this.emit(t)},n(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._useFixedDeltaTime?this.frameTime/1e3:this._deltaTime}},{key:"totalTime",get:function(){return performance.now()-this._initTime}},{key:"frameStartTime",get:function(){return this._startTime}}]),i}(Uu));vL.EVENT_HIDE="game_on_hide",vL.EVENT_SHOW="game_on_show",vL.EVENT_LOW_MEMORY="game_on_low_memory",vL.EVENT_GAME_INITED="game_inited",vL.EVENT_ENGINE_INITED="engine_inited",vL.EVENT_RENDERER_INITED="renderer_inited",vL.EVENT_PRE_BASE_INIT="pre_base_init",vL.EVENT_POST_BASE_INIT="post_base_init",vL.EVENT_PRE_INFRASTRUCTURE_INIT="pre_infrastructure_init",vL.EVENT_POST_INFRASTRUCTURE_INIT="post_infrastructure_init",vL.EVENT_PRE_SUBSYSTEM_INIT="pre_subsystem_init",vL.EVENT_POST_SUBSYSTEM_INIT="post_subsystem_init",vL.EVENT_PRE_PROJECT_INIT="pre_project_init",vL.EVENT_POST_PROJECT_INIT="post_project_init",vL.EVENT_RESTART="game_on_restart",vL.EVENT_PAUSE="game_on_pause",vL.EVENT_RESUME="game_on_resume",vL.EVENT_CLOSE="game_on_close",vL.RENDER_TYPE_CANVAS=0,vL.RENDER_TYPE_WEBGL=1,vL.RENDER_TYPE_OPENGL=2,vL.RENDER_TYPE_HEADLESS=3,vL.DEBUG_DT_THRESHOLD=1,g.Game=vL;var yL=t("game",g.game=new vL);rt(_L.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"}]),nt(_L.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"}]),it(fL,"director",[{name:"_getSceneUuid",targetName:"assetManager.main",newName:"getSceneInfo",customFunction:function(t){var e;return SE.main?null===(e=SE.main.getSceneInfo(t))||void 0===e?void 0:e.uuid:""}}]),rt(yL,"game",[{name:"collisionMatrix"},{name:"groupList"}]),it(yL,"game",[{name:"_sceneInfos",targetName:"assetManager.main",newName:"getSceneInfo",customGetter:function(){var t=[];return SE.main&&SE.main.config.scenes.forEach((function(e){t.push(e)})),t}}]);var EL=t("DynamicAtlasManager",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}s(e,t);var i=e.prototype;return i.newAtlas=function(){var t=this._atlases[++this._atlasIndex];return t||(t=new Up(this._textureSize,this._textureSize),this._atlases.push(t)),t},i.beforeSceneLoad=function(){this.reset()},i.init=function(){this.enabled=!Te.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!==qf.LINEAR||e.magFilter!==qf.LINEAR||e.mipFilter!==qf.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=this._atlases.length-1;e>=0;e--)oe(this._atlases[e]._innerSpriteFrames,t);var i=t._original._texture;this.deleteAtlasTexture(i)}},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)}},n(e,[{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled!==t&&(t?(this.reset(),g.director.on(g.Director.EVENT_BEFORE_SCENE_LAUNCH,this.beforeSceneLoad,this)):(this.reset(),g.director.off(g.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}(cu));EL.instance=void 0;var TL,SL=t("dynamicAtlasManager",EL.instance=new EL);fL.registerSystem("dynamicAtlasManager",SL,0),g.internal.dynamicAtlasManager=SL,function(t){t[t.positions=ml.ATTR_POSITION]="positions",t[t.normals=ml.ATTR_NORMAL]="normals",t[t.uvs=ml.ATTR_TEX_COORD]="uvs",t[t.colors=ml.ATTR_COLOR]="colors"}(TL||(TL={}));var AL,RL,CL,bL,IL,wL=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}(),OL=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>wg.MAX_MORPH_TARGET_COUNT?this._subMeshRenderings[n]=new NL(this._mesh,n,this._mesh.struct.morph,e):this._subMeshRenderings[n]=new xL(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(ml.ATTR_POSITION)&&s.push({name:"CC_MORPH_TARGET_HAS_POSITION",value:!0}),n.attributes.includes(ml.ATTR_NORMAL)&&s.push({name:"CC_MORPH_TARGET_HAS_NORMAL",value:!0}),n.attributes.includes(ml.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=0,e=i;t<e.length;t++){var n=e[t];null==n||n.destroy()}}}},t}(),xL=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,LL(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=PL(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),h=s*n*4,u=0;u<s;++u)a[h+4*u+0]=o[3*u+0],a[h+4*u+1]=o[3*u+1],a[h+4*u+2]=o[3*u+2]})),n.updatePixels(),{name:e,morphTexture:n}}))}var e=t.prototype;return e.destroy=function(){for(var t,e=f(this._attributes);!(t=e()).done;)t.value.morphTexture.destroy()},e.createInstance=function(){var t=this,e=new ML(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=f(t._attributes);!(n=r()).done;){var s=n.value,a=void 0;switch(s.name){case ml.ATTR_POSITION:a=Fg;break;case ml.ATTR_NORMAL:a=Gg;break;case ml.ATTR_TANGENT:a=Vg;break;default:B("Unexpected attribute!")}void 0!==a&&(i.bindSampler(a,s.morphTexture.sampler),i.bindTexture(a,s.morphTexture.texture))}i.bindBuffer(wg.BINDING,e.buffer),i.update()},destroy:function(){}}},t}(),NL=function(){function t(t,e,i,n){this._gfxDevice=void 0,this._attributes=[],this._gfxDevice=n;var r=i.subMeshMorphs[e];LL(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 DL(this,this._attributes[0].targets[0].displacements.length/3,this._gfxDevice)},n(t,[{key:"data",get:function(){return this._attributes}}]),t}(),DL=function(){function t(t,e,i){this._attributes=void 0,this._owner=void 0,this._morphUniforms=void 0,this._owner=t,this._morphUniforms=new ML(i,0);var n=PL(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],h=a.length/3;if(0===s)for(var u=0;u<h;++u)n[4*u+0]=a[3*u+0]*o,n[4*u+1]=a[3*u+1]*o,n[4*u+2]=a[3*u+2]*o;else if(0!==o)for(var c=0;c<h;++c)n[4*c+0]+=a[3*c+0]*o,n[4*c+1]+=a[3*c+1]*o,n[4*c+2]+=a[3*c+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=f(this._attributes);!(e=i()).done;){var n=e.value,r=void 0;switch(n.attributeName){case ml.ATTR_POSITION:r=Fg;break;case ml.ATTR_NORMAL:r=Gg;break;case ml.ATTR_TANGENT:r=Vg;break;default:B("Unexpected attribute!")}void 0!==r&&(t.bindSampler(r,n.morphTexture.sampler),t.bindTexture(r,n.morphTexture.texture))}t.bindBuffer(wg.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}(),ML=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(wg.SIZE)),this._remoteBuffer=t.createBuffer(new Ml(Mc.UNIFORM|Mc.TRANSFER_DST,Bc.HOST|Bc.DEVICE,wg.SIZE,wg.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(wg.OFFSET_OF_WEIGHTS+4*e,t[e],g.sys.isLittleEndian)},e.setMorphTextureInfo=function(t,e){this._localBuffer.setFloat32(wg.OFFSET_OF_DISPLACEMENT_TEXTURE_WIDTH,t,g.sys.isLittleEndian),this._localBuffer.setFloat32(wg.OFFSET_OF_DISPLACEMENT_TEXTURE_HEIGHT,e,g.sys.isLittleEndian)},e.setVerticesCount=function(t){this._localBuffer.setFloat32(wg.OFFSET_OF_VERTICES_COUNT,t,g.sys.isLittleEndian)},e.commit=function(){this._remoteBuffer.update(this._localBuffer.buffer)},n(t,[{key:"buffer",get:function(){return this._remoteBuffer}}]),t}();function PL(t,e){var i,n,r,s;t.getFormatFeatures(xc.RGBA32F)&Gc.SAMPLED_TEXTURE?(i=e,r=16,n=Fp.PixelFormat.RGBA32F,s=Float32Array):(i=4*e,r=4,n=Fp.PixelFormat.RGBA8888,s=Uint8Array);var a=function(t){t<5&&(t=5);var e=E(Di(t)),i=e>>1;return{width:1<<(1&e?i+1:i),height:1<<i}}(i),o=a.width,h=a.height;return{width:o,height:h,create:function(){var e=new ArrayBuffer(o*h*r),i=new Float32Array(e),a=s===Float32Array?i:new s(e),u=new dd({width:o,height:h,_data:a,_compressed:!1,format:n}),c=new Fp;c.setFilters(Fp.Filter.NEAREST,Fp.Filter.NEAREST),c.setMipFilter(Fp.Filter.NONE),c.setWrapMode(Fp.WrapMode.CLAMP_TO_EDGE,Fp.WrapMode.CLAMP_TO_EDGE,Fp.WrapMode.CLAMP_TO_EDGE),c.image=u,c.getGFXTexture()||B("Unexpected: failed to create morph texture?");var l=t.getSampler(c.getSamplerInfo());return{get texture(){return c.getGFXTexture()},get sampler(){return l},get valueView(){return i},destroy:function(){c.destroy()},updatePixels:function(){c.uploadData(a)}}}}}function LL(t,e,i){t.renderingSubMeshes[e].enableVertexIdChannel(i)}function BL(t){switch(t){case 1:return Uint8Array;case 2:return Uint16Array;case 4:return Uint32Array;default:return Uint8Array}}var FL=new Wi,UL=new Wi,kL=new Uint8Array,GL=bs("cc.Mesh")((RL=function(t){function e(){var e;return(e=t.call(this)||this).morphRendering=null,e._struct=CL&&CL(),e._hash=bL&&bL(),e._data=kL,e._initialized=!1,e._allowDataAccess=IL&&IL(),e._isMeshDataUploaded=!1,e._renderingSubMeshes=null,e._boneSpaceBounds=new Map,e._jointBufferIndices=null,e}s(e,t);var i=e.prototype;return i.onLoaded=function(){this.initialize()},i.initialize=function(){if(!this._initialized)if(this._initialized=!0,this._struct.dynamic){for(var t=_f.gfxDevice,e=[],i=[],n=0;n<this._struct.vertexBundles.length;n++){var r=this._struct.vertexBundles[n],s=t.createBuffer(new Ml(Mc.VERTEX|Mc.TRANSFER_DST,Bc.DEVICE,r.view.length,r.view.stride));e.push(s)}for(var a=0;a<this._struct.primitives.length;a++){var o=this._struct.primitives[a],h=o.indexView,u=null;h&&(u=t.createBuffer(new Ml(Mc.INDEX|Mc.TRANSFER_DST,Bc.DEVICE,h.length,h.stride)));for(var c=[],l=0;l<o.vertexBundelIndices.length;l++){var _=o.vertexBundelIndices[l];c.push(e[_])}for(var d=[],p=0;p<o.vertexBundelIndices.length;p++)for(var m,g=o.vertexBundelIndices[p],v=f(this._struct.vertexBundles[g].attributes);!(m=v()).done;){var y=m.value,E=new Ql;E.copy(y),d.push(E)}var T=new _w(c,d,o.primitiveMode,u);T.drawInfo=new Ll,T.mesh=this,T.subMeshIdx=a,i.push(T)}this._renderingSubMeshes=i}else{for(var S=this._data.buffer,A=_f.gfxDevice,R=this._createVertexBuffers(A,S),C=[],b=[],I=0;I<this._struct.primitives.length;I++){var w=this._struct.primitives[I];if(0!==w.vertexBundelIndices.length){var O=null,x=null;if(w.indexView){var N=w.indexView,D=N.stride,M=N.length;if(4===D&&!A.hasFeature(Oc.ELEMENT_INDEX_UINT)){var P=this._struct.vertexBundles[w.vertexBundelIndices[0]].view.count;if(P>=65536){j(10001,P,65536);continue}D>>=1,M>>=1}O=A.createBuffer(new Ml(Mc.INDEX,Bc.DEVICE,M,D)),C.push(O),x=new(BL(N.stride))(S,N.offset,N.count),N.stride!==D&&(x=BL(D).from(x)),O.update(x)}var L=w.vertexBundelIndices.map((function(t){return R[t]})),B=[];if(w.vertexBundelIndices.length>0)for(var F=w.vertexBundelIndices[0],U=this._struct.vertexBundles[F].attributes,k=0;k<U.length;++k){var G=U[k];B[k]=new Ql(G.name,G.format,G.isNormalized,G.stream,G.isInstanced,G.location)}var H=new _w(L,B,w.primitiveMode,O);H.mesh=this,H.subMeshIdx=I,b.push(H)}}this._renderingSubMeshes=b,this._struct.morph&&(this.morphRendering=function(t,e){return new OL(t,e)}(this,A)),this._isMeshDataUploaded=!0,this._allowDataAccess||this.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],h=o.drawInfo,u=0;u<i.length;u++){var c=i[u],l=this._struct.vertexBundles[a.vertexBundelIndices[u]],_=l.view.stride,d=c.byteLength/_,p=c.byteLength,m=new Uint8Array(this._data.buffer,l.view.offset,p),g=new Uint8Array(c.buffer,c.byteOffset,p),v=o.vertexBuffers[u];s.maxSubMeshVertices,p>0&&(m.set(g),v.update(g,p)),l.view.count=d,h.vertexCount=d}if(a.indexView){var y=a.indexView,E=y.stride,T=2===E?e.indices16.length:e.indices32.length,S=T*E,A=new Uint8Array(this._data.buffer,y.offset,S),R=2===E?new Uint8Array(e.indices16.buffer,e.indices16.byteOffset,S):new Uint8Array(e.indices32.buffer,e.indices32.byteOffset,S),C=o.indexBuffer;s.maxSubMeshIndices,S>0&&(A.set(R),C.update(R,S)),y.count=T,h.indexCount=T}if(e.minPos&&e.maxPos){var b=new Wi(e.minPos.x,e.minPos.y,e.minPos.z),I=new Wi(e.maxPos.x,e.maxPos.y,e.maxPos.z);r.bounds[t]||(r.bounds[t]=new $r),$r.fromPoints(r.bounds[t],b,I);for(var w,O=new Wi,x=new Wi,N=f(r.bounds);!(w=N()).done;){var D=w.value;D&&(D.getBoundary(O,x),Wi.min(b,O,b),Wi.max(I,x,I))}this._struct.minPosition=new Wi(b.x,b.y,b.z),this._struct.maxPosition=new Wi(I.x,I.y,I.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 $r(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,ml.ATTR_JOINTS),h=this.readAttribute(a,ml.ATTR_WEIGHTS),u=this.readAttribute(a,ml.ATTR_POSITION);if(o&&h&&u)for(var c=Math.min(o.length/4,h.length/4,u.length/3),l=0;l<c;l++){Wi.set(FL,u[3*l+0],u[3*l+1],u[3*l+2]);for(var _=0;_<4;++_){var f=4*l+_,d=o[f];if(!(0===h[f]||d>=n.length)){Wi.transformMat4(UL,FL,n[d]),i[d]=!0;var p=e[d];Wi.min(p.center,p.center,UL),Wi.max(p.halfExtents,p.halfExtents,UL)}}}}for(var m=0;m<n.length;m++){var g=e[m];i[m]?$r.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 Wi,r=e&&new en,s=e&&new $r;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&&(Wi.add(s.center,a.maxPosition,a.minPosition),Wi.multiplyScalar(s.center,s.center,.5),Wi.subtract(s.halfExtents,a.maxPosition,a.minPosition),Wi.multiplyScalar(s.halfExtents,s.halfExtents,.5),$r.transform(s,s,e),Wi.add(a.maxPosition,s.center,s.halfExtents),Wi.subtract(a.minPosition,s.center,s.halfExtents));for(var h=0;h<a.vertexBundles.length;h++)for(var u=a.vertexBundles[h],c=0;c<u.attributes.length;c++)if(u.attributes[c].name===ml.ATTR_POSITION||u.attributes[c].name===ml.ATTR_NORMAL){var l=u.attributes[c].format,_=new DataView(o.buffer,u.view.offset+HL(u.attributes,c)),d=WL(_,l),p=XL(_,l);if(!d||!p)continue;for(var m=u.view.count,g=u.view.stride,v=VL(l),y=0;y<m;y++){var E=y*g,T=E+v,S=T+v;switch(n.set(d(E),d(T),d(S)),u.attributes[c].name){case ml.ATTR_POSITION:n.transformMat4(e);break;case ml.ATTR_NORMAL:Wi.transformQuat(n,n,r)}p(E,n.x),p(T,n.y),p(S,n.z)}}}return this.reset({struct:a,data:o}),this.initialize(),!0}for(var A,R,C,b,I,w=new wL,O=0,x=0,N=0,D=0,M=0,P=0,L=0,B=0,F=!1,U=new Array(this._struct.vertexBundles.length),k=0;k<this._struct.vertexBundles.length;++k){var G=this._struct.vertexBundles[k],H=t._struct.vertexBundles[k];N=G.view.offset,D=H.view.offset,x=G.view.stride,O=G.view.count+H.view.count,A=new ArrayBuffer(O*x),R=new Uint8Array(A),N+=(C=this._data.subarray(N,N+G.view.length)).length,D+=(b=t._data.subarray(D,D+H.view.length)).length,R.set(C),M=0;for(var z,V=f(G.attributes);!(z=V()).done;){var W=z.value;L=0,F=!1;for(var X,j=f(H.attributes);!(X=j()).done;){var Y=X.value;if(W.name===Y.name&&W.format===Y.format){F=!0;break}L+=T_[Y.format].size}if(F){B=T_[W.format].size,P=G.view.length+M;for(var K=0;K<H.view.count;++K){if(I=b.subarray(L,L+B),R.set(I,P),(W.name===ml.ATTR_POSITION||W.name===ml.ATTR_NORMAL)&&e){var q=new Float32Array(R.buffer,P,3);switch(n.set(q[0],q[1],q[2]),W.name){case ml.ATTR_POSITION:n.transformMat4(e);break;case ml.ATTR_NORMAL:Wi.transformQuat(n,n,r)}q[0]=n.x,q[1]=n.y,q[2]=n.z}P+=G.view.stride,L+=H.view.stride}}M+=T_[W.format].size}U[k]={attributes:G.attributes,view:{offset:w.getLength(),length:A.byteLength,count:O,stride:x}},w.addBuffer(A)}for(var Q,Z,J,$=0,tt=2,et=new Array(this._struct.primitives.length),it=0;it<this._struct.primitives.length;++it){var nt=this._struct.primitives[it],rt=t._struct.primitives[it];et[it]={primitiveMode:nt.primitiveMode,vertexBundelIndices:nt.vertexBundelIndices};for(var st,at=0,ot=f(nt.vertexBundelIndices);!(st=ot()).done;){var ht=st.value;at=Math.max(at,this._struct.vertexBundles[ht].view.count)}if(nt.indexView&&rt.indexView){$=nt.indexView.count,$+=rt.indexView.count,N=nt.indexView.offset,D=rt.indexView.offset,tt=$<256?1:$<65536?2:4;var ut=new ArrayBuffer($*tt);if(Q=2===tt?new Uint16Array(ut):1===tt?new Uint8Array(ut):new Uint32Array(ut),Z=2===nt.indexView.stride?new Uint16Array(this._data.buffer,N,nt.indexView.count):1===nt.indexView.stride?new Uint8Array(this._data.buffer,N,nt.indexView.count):new Uint32Array(this._data.buffer,N,nt.indexView.count),tt===nt.indexView.stride)Q.set(Z);else for(var ct=0;ct<nt.indexView.count;++ct)Q[ct]=Z[ct];N+=nt.indexView.length,J=2===rt.indexView.stride?new Uint16Array(t._data.buffer,D,rt.indexView.count):1===rt.indexView.stride?new Uint8Array(t._data.buffer,D,rt.indexView.count):new Uint32Array(t._data.buffer,D,rt.indexView.count);for(var lt=0;lt<rt.indexView.count;++lt)Q[nt.indexView.count+lt]=at+J[lt];D+=rt.indexView.length,et[it].indexView={offset:w.getLength(),length:ut.byteLength,count:$,stride:tt},w.setNextAlignment(tt),w.addBuffer(ut)}}var _t={vertexBundles:U,primitives:et,minPosition:this._struct.minPosition,maxPosition:this._struct.maxPosition};return _t.minPosition&&t._struct.minPosition&&_t.maxPosition&&t._struct.maxPosition&&(e?(Wi.add(s.center,t._struct.maxPosition,t._struct.minPosition),Wi.multiplyScalar(s.center,s.center,.5),Wi.subtract(s.halfExtents,t._struct.maxPosition,t._struct.minPosition),Wi.multiplyScalar(s.halfExtents,s.halfExtents,.5),$r.transform(s,s,e),Wi.add(n,s.center,s.halfExtents),Wi.max(_t.maxPosition,_t.maxPosition,n),Wi.subtract(n,s.center,s.halfExtents),Wi.min(_t.minPosition,_t.minPosition,n)):(Wi.min(_t.minPosition,_t.minPosition,t._struct.minPosition),Wi.max(_t.maxPosition,_t.maxPosition,t._struct.maxPosition))),this.reset({struct:_t,data:new Uint8Array(w.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 h=0;h<a.vertexBundelIndices.length;++h)if(a.vertexBundelIndices[h]!==o.vertexBundelIndices[h])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=x_(T_[s]);if(0!==r){var o=new DataView(i._data.buffer,t.view.offset+HL(t.attributes,e)),h=T_[s],u=WL(o,s);if(a&&u){for(var c=h.count,l=new a(r*c),_=t.view.stride,f=0;f<r;++f)for(var d=0;d<c;++d)l[c*f+d]=u(_*f+l.BYTES_PER_ELEMENT*d);n=l}}})),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 h=t.attributes[e].format,u=new DataView(s._data.buffer,t.view.offset+HL(t.attributes,e)),c=new DataView(i,r),l=T_[h],_=WL(u,h),f=XL(c,h);if(_&&f){for(var d=l.count,p=t.view.stride,m=VL(h),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?xc.R8UI:2===i.indexView.stride?xc.R16UI:xc.R32UI,s=WL(new DataView(this._data.buffer),r),a=0;a<n;++a)e[a]=s(i.indexView.offset+T_[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=T_[n]})),i},i._accessAttribute=function(t,e,i){if(!(t>=this._struct.primitives.length))for(var n,r=f(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 Ml(Mc.VERTEX,Bc.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:kL})},i.releaseData=function(){this._data=kL},n(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=vc(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}(jf),CL=gs(RL.prototype,"_struct",[Ls],(function(){return{vertexBundles:[],primitives:[]}})),bL=gs(RL.prototype,"_hash",[Ls],(function(){return 0})),IL=gs(RL.prototype,"_allowDataAccess",[Ls],(function(){return!0})),AL=RL))||AL;function HL(t,e){for(var i=0,n=0;n<e;++n){var r=t[n];i+=T_[r.format].size}return i}g.Mesh=GL;var zL=dc.isLittleEndian;function VL(t){var e=T_[t];return e.size/e.count}function WL(t,e){var i=T_[e],n=i.size/i.count;switch(i.type){case Nc.UNORM:switch(n){case 1:return function(e){return t.getUint8(e)};case 2:return function(e){return t.getUint16(e,zL)};case 4:return function(e){return t.getUint32(e,zL)}}break;case Nc.SNORM:case Nc.INT:switch(n){case 1:return function(e){return t.getInt8(e)};case 2:return function(e){return t.getInt16(e,zL)};case 4:return function(e){return t.getInt32(e,zL)}}break;case Nc.UINT:switch(n){case 1:return function(e){return t.getUint8(e)};case 2:return function(e){return t.getUint16(e,zL)};case 4:return function(e){return t.getUint32(e,zL)}}break;case Nc.FLOAT:return function(e){return t.getFloat32(e,zL)}}return null}function XL(t,e){var i=T_[e],n=i.size/i.count;switch(i.type){case Nc.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,zL)};case 4:return function(e,i){return t.setUint32(e,i,zL)}}break;case Nc.SNORM:case Nc.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,zL)};case 4:return function(e,i){return t.setInt32(e,i,zL)}}break;case Nc.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,zL)};case 4:return function(e,i){return t.setUint32(e,i,zL)}}break;case Nc.FLOAT:return function(e,i){return t.setFloat32(e,i,zL)}}return null}var jL,YL,KL,qL=[new Ql(ml.ATTR_POSITION,xc.RGB32F),new Ql(ml.ATTR_NORMAL,xc.RGB32F),new Ql(ml.ATTR_TEX_COORD,xc.RG32F),new Ql(ml.ATTR_TANGENT,xc.RGBA32F),new Ql(ml.ATTR_COLOR,xc.RGBA32F)],QL=new Wi,ZL=new Wi,JL=new cn;!function(t){t[t.RECT=0]="RECT",t[t.POLYGON=1]="POLYGON"}(KL||(KL={}));var $L,tB,eB,iB=[{u:0,v:0},{u:0,v:0},{u:0,v:0},{u:0,v:0}],nB=t("SpriteFrame",bs("cc.SpriteFrame")(((YL=function(t){function e(){var e;return(e=t.call(this)||this).vertices=null,e.uv=[],e.unbiasUV=[],e.uvSliced=[],e._rect=new En,e._trimmedBorder=new ki,e._offset=new pn,e._originalSize=new vn,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 pn(.5,.5),e._meshType=KL.RECT,e._extrude=0,e._customOutLine=[],e._minPos=new Wi,e._maxPos=new Wi,e}s(e,t),e.createWithImage=function(t){var i=t instanceof dd?t:new dd(t),n=new Fp;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&&SL&&SL.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,h=this._capInsets[1],u=this._capInsets[3],c=t.height-h-u,l=this.uvSliced;if(l.length=0,this._rotated){iB[0].u=t.x/n,iB[1].u=(t.x+u)/n,iB[2].u=(t.x+u+c)/n,iB[3].u=(t.x+t.height)/n,iB[3].v=t.y/r,iB[2].v=(t.y+s)/r,iB[1].v=(t.y+s+o)/r,iB[0].v=(t.y+t.width)/r;for(var _=0;_<4;++_)for(var f=iB[_],d=0;d<4;++d){var p=iB[3-d];l.push({u:f.u,v:p.v})}}else{iB[0].u=t.x/n,iB[1].u=(t.x+s)/n,iB[2].u=(t.x+s+o)/n,iB[3].u=(t.x+t.width)/n,iB[3].v=t.y/r,iB[2].v=(t.y+h)/r,iB[1].v=(t.y+h+c)/r,iB[0].v=(t.y+t.height)/r;for(var m=0;m<4;++m)for(var g=iB[m],v=0;v<4;++v){var y=iB[v];l.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,h=0===s?0:t.y/s,u=0===s?1:(t.y+t.width)/s;this._isFlipUVX&&this._isFlipUVY?(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._isFlipUVX?(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._isFlipUVY?(e[0]=a,e[1]=u,e[2]=a,e[3]=h,e[4]=o,e[5]=u,e[6]=o,e[7]=h):(e[0]=a,e[1]=h,e[2]=a,e[3]=u,e[4]=o,e[5]=h,e[6]=o,e[7]=u);var c=0===r?0:t.x/r,l=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]=l,i[1]=f,i[2]=l,i[3]=_,i[4]=c,i[5]=f,i[6]=c,i[7]=_):this._isFlipUVX?(i[0]=l,i[1]=_,i[2]=l,i[3]=f,i[4]=c,i[5]=_,i[6]=c,i[7]=f):this._isFlipUVY?(i[0]=c,i[1]=f,i[2]=c,i[3]=_,i[4]=l,i[5]=f,i[6]=l,i[7]=_):(i[0]=c,i[1]=_,i[2]=c,i[3]=f,i[4]=l,i[5]=_,i[6]=l,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=SL;if(t){var e=this._texture;if(e instanceof Fp&&!e.isCompressed){var i=this.width,n=this.height;if(!e.image||i>t.maxFrameSize||n>t.maxFrameSize)this._packable=!1;else{var r=y.HTMLCanvasElement;e.image&&e.image instanceof r&&(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 En(i.x,i.y,i.width,i.height));var n=e.offset;e.offset&&(this._offset=new pn(n.x,n.y));var r=e.originalSize;e.originalSize&&(this._originalSize=new vn(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 pn(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 Wi(o.minPos.x,o.minPos.y,o.minPos.z),maxPos:new Wi(o.maxPos.x,o.maxPos.y,o.maxPos.z)}),this.vertices.rawPosition.length=0;for(var h=o.rawPosition,u=0;u<h.length;u+=3)this.vertices.rawPosition.push(new Wi(h[u],h[u+1],h[u+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 En(0,0,e.width,e.height),n=!0),(0===this._originalSize.width||0===this._originalSize.height||n)&&(i.originalSize=new vn(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 Fp;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 Wi,maxPos:new Wi},this._meshType===KL.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,h=r/2,u=s/2,c=0===e?0:a/e,l=0===e?1:(a+r)/e,_=0===i?1:(o+s)/i,f=0===i?0:n.y/i;ZL.set(-h,-u,0),this.vertices.rawPosition.push(ZL.clone()),this.vertices.uv.push(a),this.vertices.uv.push(o+s),this.vertices.nuv.push(c),this.vertices.nuv.push(f),this.vertices.minPos.set(ZL),ZL.set(h,-u,0),this.vertices.rawPosition.push(ZL.clone()),this.vertices.uv.push(a+r),this.vertices.uv.push(o+s),this.vertices.nuv.push(l),this.vertices.nuv.push(f),ZL.set(-h,u,0),this.vertices.rawPosition.push(ZL.clone()),this.vertices.uv.push(a),this.vertices.uv.push(o),this.vertices.nuv.push(c),this.vertices.nuv.push(_),ZL.set(h,u,0),this.vertices.rawPosition.push(ZL.clone()),this.vertices.uv.push(a+r),this.vertices.uv.push(o),this.vertices.nuv.push(l),this.vertices.nuv.push(_),this.vertices.maxPos.set(ZL),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(){JL.identity();var t=1/this._pixelsToUnit,e=-(this._pivot.x-.5)*this.rect.width*t,i=-(this._pivot.y-.5)*this.rect.height*t,n=new Wi(e,i,0);JL.transform(n),n.set(t,t,1),JL.scale(n);for(var r=this.vertices,s=0;s<r.rawPosition.length;s++){var a=r.rawPosition[s];Wi.transformMat4(n,a,JL),Wi.toArray(r.positions,n,3*s)}Wi.transformMat4(this._minPos,r.minPos,JL),Wi.transformMat4(this._maxPos,r.maxPos,JL)},i._createMesh=function(){this._mesh=function(t,e,i){i=i||{};var n,r=[],s=0,a=[],o=0,h=t.positions.slice();if(h.length>0){if(n=null,t.attributes)for(var u,c=f(t.attributes);!(u=c()).done;){var l=u.value;if(l.name===ml.ATTR_POSITION){n=l;break}}n||(n=qL[0]),r.push(n);var _=T_[n.format];o=Math.max(o,Math.floor(h.length/_.count)),a.push({offset:s,data:h,attribute:n}),s+=_.size}if(t.normals&&t.normals.length>0){if(n=null,t.attributes)for(var d,p=f(t.attributes);!(d=p()).done;){var m=d.value;if(m.name===ml.ATTR_NORMAL){n=m;break}}n||(n=qL[1]);var g=T_[n.format];r.push(n),o=Math.max(o,Math.floor(t.normals.length/g.count)),a.push({offset:s,data:t.normals,attribute:n}),s+=g.size}if(t.uvs&&t.uvs.length>0){if(n=null,t.attributes)for(var v,y=f(t.attributes);!(v=y()).done;){var E=v.value;if(E.name===ml.ATTR_TEX_COORD){n=E;break}}n||(n=qL[2]);var T=T_[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=f(t.attributes);!(S=A()).done;){var R=S.value;if(R.name===ml.ATTR_TANGENT){n=R;break}}n||(n=qL[3]);var C=T_[n.format];r.push(n),o=Math.max(o,Math.floor(t.tangents.length/C.count)),a.push({offset:s,data:t.tangents,attribute:n}),s+=C.size}if(t.colors&&t.colors.length>0){if(n=null,t.attributes)for(var b,I=f(t.attributes);!(b=I()).done;){var w=b.value;if(w.name===ml.ATTR_COLOR){n=w;break}}n||(n=qL[4]);var O=T_[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 N=t.customAttributes[x],D=T_[N.attr.format];r.push(N.attr),o=Math.max(o,Math.floor(N.values.length/D.count)),a.push({offset:s,data:N.values,attribute:N.attr}),s+=D.size}for(var M=new wL,P=new ArrayBuffer(o*s),L=new DataView(P),B=0,F=a;B<F.length;B++){var U=F[B];cw(L,U.data,U.attribute.format,U.offset,s)}M.setNextAlignment(0);var k={attributes:r,view:{offset:M.getLength(),length:P.byteLength,count:o,stride:s}};M.addBuffer(P);var G=null,H=0;if(t.indices){var z=t.indices;H=z.length,G=new ArrayBuffer(2*H),cw(new DataView(G),z,xc.R16UI)}var V={primitiveMode:t.primitiveMode||il.TRIANGLE_LIST,vertexBundelIndices:[0]};G&&(M.setNextAlignment(2),V.indexView={offset:M.getLength(),length:G.byteLength,count:H,stride:2},M.addBuffer(G));var W=t.minPos;if(!W&&i.calculateBounds){W=Wi.set(new Wi,1/0,1/0,1/0);for(var X=0;X<o;++X)Wi.set(QL,h[3*X+0],h[3*X+1],h[3*X+2]),Wi.min(W,W,QL)}var j=t.maxPos;if(!j&&i.calculateBounds){j=Wi.set(new Wi,-1/0,-1/0,-1/0);for(var Y=0;Y<o;++Y)Wi.set(QL,h[3*Y+0],h[3*Y+1],h[3*Y+2]),Wi.max(j,j,QL)}var K={vertexBundles:[k],primitives:[V]};return W&&(K.minPosition=new Wi(W.x,W.y,W.z)),j&&(K.maxPosition=new Wi(j.x,j.y,j.z)),e||(e=new GL),e.reset({struct:K,data:new Uint8Array(M.getCombined())}),e}({primitiveMode:il.TRIANGLE_LIST,positions:this.vertices.positions,uvs:this.vertices.nuv,indices:this.vertices.indexes,minPos:this._minPos,maxPos:this._maxPos,attributes:[new Ql(ml.ATTR_POSITION,xc.RGB32F),new Ql(ml.ATTR_TEX_COORD,xc.RG32F)]})},i._updateMesh=function(){this._mesh&&this._mesh.destroy(),this._initVertices(),this._createMesh()},n(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){globalThis.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}(jf)).EVENT_UV_UPDATED="uv_updated",YL.MeshType=KL,jL=YL))||jL);g.SpriteFrame=nB;var rB,sB=t("SpriteAtlas",bs("cc.SpriteAtlas")((tB=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).spriteFrames=eB&&eB(),e}s(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=It();for(var r=0;r<n.length;r+=2)e.result.push(this.spriteFrames,n[r],n[r+1],ee(nB))},e}(jf),eB=gs(tB.prototype,"spriteFrames",[Ls],(function(){return It()})),$L=tB))||$L);g.SpriteAtlas=sB;var aB,oB,hB,uB=t("Font",bs("cc.Font")(rB=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(jf))||rB);g.Font=uB;var cB,lB,_B,fB,dB,pB,mB,gB,vB=t("TTFFont",bs("cc.TTFFont")((oB=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)._fontFamily=hB&&hB(),e}return s(e,t),e.prototype.initDefault=function(e){this._fontFamily="Arial",t.prototype.initDefault.call(this,e)},n(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:Ju(this._native),__isNative__:!0}}}]),e}(uB),hB=gs(oB.prototype,"_fontFamily",[Ls],(function(){return null})),d(oB.prototype,"_nativeAsset",[aa,ra],Object.getOwnPropertyDescriptor(oB.prototype,"_nativeAsset"),oB.prototype),d(oB.prototype,"_nativeDep",[aa],Object.getOwnPropertyDescriptor(oB.prototype,"_nativeDep"),oB.prototype),aB=oB))||aB);g.TTFFont=vB;var yB,EB=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},TB=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 EB;Ut(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}(),SB=t("BitmapFont",(cB=bs("cc.BitmapFont"),lB=sa(nB),cB((fB=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).fntDataStr=dB&&dB(),e.spriteFrame=pB&&pB(),e.fontSize=mB&&mB(),e.fntConfig=gB&&gB(),e}return s(e,t),e.prototype.onLoaded=function(){var t=this.spriteFrame;!this.fontDefDictionary&&t&&(this.fontDefDictionary=new TB(t.texture));var e=this.fntConfig;if(e){var i=e.fontDefDictionary;for(var n in i){var r=new EB,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 B("The fnt config is not exists!")},e}(uB),dB=gs(fB.prototype,"fntDataStr",[Ls],(function(){return""})),pB=gs(fB.prototype,"spriteFrame",[lB],(function(){return null})),mB=gs(fB.prototype,"fontSize",[Ls],(function(){return-1})),gB=gs(fB.prototype,"fntConfig",[Ls],(function(){return null})),_B=fB))||_B));g.BitmapFont=SB;var AB=t("LabelAtlas",bs("cc.LabelAtlas")(yB=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(SB))||yB);g.LabelAtlas=AB;var RB=t("BASELINE_RATIO",.26),CB=t("MIDDLE_RATIO",(RB+1)/2-RB);var bB=new ie(2);bB.get=function(){return this._get()||{key:"",value:0,prev:null,next:null}};var IB,wB=new(t("LRUCache",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=bB.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,bB.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),OB=/([a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûа-яА-ЯЁё]+|\S)/,xB=/^[!,.:;'}\]%\?>、‘“》?。,!]/,NB=/([a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûаíìÍÌïÁÀáàÉÈÒÓòóŐőÙÚŰúűñÑæÆœŒÃÂãÔõěščřžýáíéóúůťďňĚŠČŘŽÁÍÉÓÚŤżźśóńłę湯ŹŚÓŃŁĘĆĄ-яА-ЯЁёáàảạãăắằẳẵặâấầẩẫậéèẻẽẹêếềểễệiíìỉĩịóòỏõọôốồổỗộơớờởỡợúùủũụưứừửữựýỳỷỹỵđÁÀẢẠÃĂẮẰẲẴẶÂẤẦẨẪẬÉÈẺẼẸÊẾỀỂỄỆIÍÌỈĨỊÓÒỎÕỌÔỐỒỔỖỘƠỚỜỞỠỢÚÙỦŨỤƯỨỪỬỮỰÝỲỶỸỴĐ]+|\S)$/,DB=/[a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûаíìÍÌïÁÀáàÉÈÒÓòóŐőÙÚŰúűñÑæÆœŒÃÂãÔõěščřžýáíéóúůťďňĚŠČŘŽÁÍÉÓÚŤżźśóńłę湯ŹŚÓŃŁĘĆĄ-яА-ЯЁёáàảạãăắằẳẵặâấầẩẫậéèẻẽẹêếềểễệiíìỉĩịóòỏõọôốồổỗộơớờởỡợúùủũụưứừửữựýỳỷỹỵđÁÀẢẠÃĂẮẰẲẴẶÂẤẦẨẪẬÉÈẺẼẸÊẾỀỂỄỆIÍÌỈĨỊÓÒỎÕỌÔỐỒỔỖỘƠỚỜỞỠỢÚÙỦŨỤƯỨỪỬỮỰÝỲỶỸỴĐ]+$/,MB=/^[a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûаíìÍÌïÁÀáàÉÈÒÓòóŐőÙÚŰúűñÑæÆœŒÃÂãÔõěščřžýáíéóúůťďňĚŠČŘŽÁÍÉÓÚŤżźśóńłę湯ŹŚÓŃŁĘĆĄ-яА-ЯЁёáàảạãăắằẳẵặâấầẩẫậéèẻẽẹêếềểễệiíìỉĩịóòỏõọôốồổỗộơớờởỡợúùủũụưứừửữựýỳỷỹỵđÁÀẢẠÃĂẮẰẲẴẶÂẤẦẨẪẬÉÈẺẼẸÊẾỀỂỄỆIÍÌỈĨỊÓÒỎÕỌÔỐỒỔỖỘƠỚỜỞỠỢÚÙỦŨỤƯỨỪỬỮỰÝỲỶỸỴĐ]/;function PB(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 LB(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 BB(t,e,i){var n=(i||t.font)+"🎮"+e,r=wB.get(n);if(null!==r)return r;var s=t.measureText(e),a=s&&s.width||0;return wB.put(n,a),a}function FB(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 UB(t){return MB.exec(t)}function kB(t){return DB.exec(t)}function GB(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=FB(s,a),h=e-n(o),u=o,c=0,l=0;h>i&&l++<100;)a*=i/h,h=e-n(o=FB(s,a|=0));for(l=0;o&&h<=i&&l++<100;){var _=OB.exec(o);u=o,h=e-n(o=FB(s,a+=c=_?_[0].length:1))}0==(a-=c)?(a=1,u=FB(s,1)):1===a&&s[0]>="\ud800"&&s[0]<="\udbff"&&(a=2,u=FB(s,2));var f=FB(s,0,a),d=void 0;xB.test(u||o)&&(0==(a-=(d=NB.exec(f))?d[0].length:0)&&(a=1),u=FB(s,a),f=FB(s,0,a)),MB.test(u)&&(d=DB.exec(f))&&f!==d[0]&&(u=FB(s,a-=d[0].length),f=FB(s,0,a)),(0===r.length||(f=f.trim()).length>0)&&r.push(f),e=n(s=u||o)}return(0===r.length||(s=s.trim()).length>0)&&r.push(s),r}var HB,zB=function(){function t(){this.pool=[]}t.getInstance=function(){return IB||(IB=new t),IB};var e=t.prototype;return e.get=function(){var t=this.pool.pop();if(!t){var e=y.document.createElement("canvas"),i=e.getContext("2d");t={canvas:e,context:i}}return t},e.put=function(t){this.pool.length>=Te.MAX_LABEL_CANVAS_POOL_SIZE||this.pool.push(t)},t}(),VB=qi.WHITE.clone(),WB=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},XB="rgba(255, 255, 255, "+(1/255).toFixed(3)+")",jB=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,zB.getInstance().put(this.data)},e._updateProperties=function(){if(this.data=zB.getInstance().get(),this.canvas=this.data.canvas,this.context=this.data.context,this.context){var t=this.labelInfo.fontScale;this.context.font=this.labelInfo.fontDesc;var e=BB(this.context,this.char,this.labelInfo.fontDesc),i=2*this.labelInfo.margin+2;this.width=parseFloat(e.toFixed(2))*t+i,this.height=(1+RB)*this.labelInfo.fontSize*t+i,this.offsetY=-this.labelInfo.fontSize*RB*t/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 dd),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,r=e.fontScale;t.textAlign="center",t.textBaseline="alphabetic",t.clearRect(0,0,i,n),t.fillStyle=XB,t.fillRect(0,0,i,n),t.font=e.fontDesc.replace(/(\d+)(\.\d+)?(px|em|rem|pt)/g,(function(t,e,i,n){return(+e*r+(+i||0)*r).toString()+n}));var s=e.fontSize*r,a=i/2,o=n/2+s*CB+0*s,h=e.color;if(t.lineJoin="round",t.fillStyle="rgba("+h.r+", "+h.g+", "+h.b+", 1)",e.isOutlined){var u=e.out||VB;t.strokeStyle="rgba("+u.r+", "+u.g+", "+u.b+", "+u.a/255+")",t.lineWidth=2*e.margin*r,t.strokeText(this.char,a,o)}t.fillText(this.char,a,o)}},t}(),YB=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.initWithSize=function(t,e,i){void 0===i&&(i=Yf.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 Il;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}(Fp),KB=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 YB;i.initWithSize(t,e),this.fontDefDictionary=new TB(i),this._halfBleed=1,this._width=t,this._height=e,fL.on(_L.EVENT_BEFORE_SCENE_LAUNCH,this.beforeSceneLoad,this)}var e=t.prototype;return e.insertLetterTexture=function(t){var e=t.image,i=fL.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 WB;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 YB;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 jB(t,e);r.updateRenderData(),n=this.insertLetterTexture(r),r.destroy()}return n},n(t,[{key:"width",get:function(){return this._width}},{key:"height",get:function(){return this._height}}]),t}(),qB={fontAtlas:null,fontSize:0,lineHeight:0,hAlign:0,vAlign:0,hash:"",fontFamily:"",fontDesc:"Arial",color:qi.WHITE.clone(),isOutlined:!1,out:qi.WHITE.clone(),margin:0,fontScale:1},QB=[new Ql(ml.ATTR_POSITION,xc.RGB32F)],ZB=[new Ql(ml.ATTR_POSITION,xc.RGB32F),new Ql(ml.ATTR_COLOR,xc.RGBA32F)],JB=[new Ql(ml.ATTR_POSITION,xc.RGB32F),new Ql(ml.ATTR_TEX_COORD,xc.RG32F),new Ql(ml.ATTR_COLOR,xc.RGBA32F)],$B=[new Ql(ml.ATTR_POSITION,xc.RGB32F),new Ql(ml.ATTR_TEX_COORD,xc.RG32F),new Ql(ml.ATTR_COLOR,xc.RGBA8,!0)],tF=[new Ql(ml.ATTR_POSITION,xc.RGB32F),new Ql(ml.ATTR_TEX_COORD,xc.RG32F),new Ql(ml.ATTR_COLOR,xc.RGBA32F),new Ql(ml.ATTR_COLOR2,xc.RGBA32F)],eF=[new Ql(ml.ATTR_POSITION,xc.RGB32F),new Ql(ml.ATTR_TEX_COORD,xc.RG32F),new Ql(ml.ATTR_COLOR,xc.RGBA8,!0),new Ql(ml.ATTR_COLOR2,xc.RGBA8,!0)];function iF(t){for(var e=0,i=0;i<t.length;i++){var n=t[i];e+=T_[n.format].count}return e}function nF(t){for(var e=0,i=0;i<t.length;i++){var n=t[i];e+=T_[n.format].size}return e}g.internal.vfmtPosUvColor=JB,g.internal.vfmtPosUvTwoColor=tF,g.internal.vfmtPosUvColor4B=$B,g.internal.vfmtPosUvTwoColor4B=eF,t("UIVertexFormat",Object.freeze({__proto__:null,vfmt:QB,vfmtPosColor:ZB,vfmtPosUvColor:JB,vfmtPosUvColor4B:$B,vfmtPosUvTwoColor:tF,vfmtPosUvTwoColor4B:eF,getComponentPerVertex:iF,getAttributeStride:nF})),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"}(HB||(HB={}));var rF,sF,aF,oF,hF,uF,cF=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=nF(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){var t=dc.__isWebIOS14OrIPadOS14Env,e=t?this._nextFreeIAHandle:1;if(t&&e/this._iaPool.length<.5){for(var i=e/.5,n=this._iaPool.length-1;n>=i;n--){var r=this._iaPool[n];r.vertexBuffers[0]&&r.vertexBuffers[0].destroy(),r.indexBuffer&&r.indexBuffer.destroy(),r.ia.destroy()}this._iaPool.length=i}for(var s=this.byteOffset,a=this.indexOffset,o=0;o<e;++o){var h=this._iaPool[o],u=new Float32Array(this.vData.buffer,0,s>>2),c=new Uint16Array(this.iData.buffer,0,a),l=h.vertexBuffers[0];s>l.size&&l.resize(s),l.update(u),2*a>h.indexBuffer.size&&h.indexBuffer.resize(2*a),h.indexBuffer.update(c)}this.dirty=!1}},t.createNewIA=function(t){var e,i,n;if(dc.__isWebIOS14OrIPadOS14Env||!this._iaPool[0]){var r=this._vertexFormatBytes=this._floatsPerVertex*Float32Array.BYTES_PER_ELEMENT,s=Uint16Array.BYTES_PER_ELEMENT,a=t.createBuffer(new Ml(Mc.VERTEX|Mc.TRANSFER_DST,Bc.HOST|Bc.DEVICE,r,r));n=t.createBuffer(new Ml(Mc.INDEX|Mc.TRANSFER_DST,Bc.HOST|Bc.DEVICE,s,s)),i=[a],this._iaInfo=new Jl(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}},n(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}()),lF=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=nF(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},n(t,[{key:"attributes",get:function(){return this._attributes}},{key:"vertexFormatBytes",get:function(){return this._vertexFormatBytes}},{key:"floatsPerVertex",get:function(){return this._floatsPerVertex}}]),t}(),_F=new ou((function(){return{offset:0,length:0}}),32),fF=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(){},n(t,[{key:"ib",get:function(){return this._ib}}]),t}(),dF=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*Te.BATCHER2D_MEM_INCREMENT/a._vertexFormatBytes),a._iCount=s||a._vCount*e.IB_SCALE,a._id=e.generateID(),a._allocateBuffer(),a}s(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)_F.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];if(e.length){var n=i.indexOffset+e.length;if(i.iData.length<n){var r=Math.floor(1.25*n),s=new Uint16Array(r);s.set(i.iData),i.iData=s}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,h=0;h<this._buffers.length;++h){r=this._buffers[h],i=this._freeLists[h];for(var u=0;u<i.length;++u)if(i[u].length>=n){o=i[u],s=h,a=u;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 c=o.offset/this.vertexFormatBytes,l=new Float32Array(r.vData.buffer,o.offset,n>>2).fill(0);return this._allocateChunkFromEntry(s,a,o,n),new fF(this,s,r,c,l,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,h=e[a];h&&h.offset<n;)o=h,h=e[++a];if(o&&0==n-(o.offset+o.length)&&(o.length+=r,n=o.offset,r=o.length,h&&h.offset-(n+r)==0&&(o.length+=h.length,e.splice(a,1),_F.free(h),h=null),s=!0),!s&&h){if(0==h.offset-(n+r))h.offset=n,h.length+=r;else{var u=_F.alloc();u.offset=n,u.length=r,e.splice(a,0,u)}s=!0}if(s)n+r===i.byteOffset&&(i.byteOffset=n);else{var c=_F.alloc();c.offset=n,c.length=r,e.push(c)}}},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),_F.free(i)):(i.offset+=n,i.length=r)},i._allocateBuffer=function(){Z(this._buffers.length===this._freeLists.length,9003);var t=new cF,e=this._vCount*this._floatsPerVertex;t.initialize(this._device,this._attributes,e,this._iCount),this._buffers.push(t);var i=_F.alloc();i.offset=0,i.length=t.vData.byteLength;var n=[i];return this._freeLists.push(n),fL.root.batcher2D.syncMeshBuffersToNative(this.id,this._buffers),this._buffers.length-1},e.generateID=function(){return e.ID_COUNT++},n(e,[{key:"id",get:function(){return this._id}}]),e}(lF);dF.IB_SCALE=4,dF.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"}(rF||(rF={})),function(t){t[t.BufferID=0]="BufferID",t[t.AccessorID=1]="AccessorID",t[t.Count=2]="Count"}(sF||(sF={})),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"}(aF||(aF={})),function(t){t[t.COMP=0]="COMP",t[t.MODEL=1]="MODEL",t[t.MIDDLEWARE=2]="MIDDLEWARE",t[t.SUB_NODE=3]="SUB_NODE"}(oF||(oF={})),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=oF.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,rF.Count),i+=rF.Count*Uint8Array.BYTES_PER_ELEMENT,this._uint16SharedBuffer=new Uint16Array(e,i,sF.Count),i+=sF.Count*Uint16Array.BYTES_PER_ELEMENT,this._uint32SharedBuffer=new Uint32Array(e,i,aF.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(){},n(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"}(hF||(hF={})),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"}(uF||(uF={}));var pF,mF,gF,vF,yF,EF=t("StencilManager",function(){function t(){this._maskStack=[],this._stencilPattern={stencilTest:!0,func:Xc.ALWAYS,stencilMask:65535,writeMask:65535,failOp:jc.KEEP,zFailOp:jc.KEEP,passOp:jc.KEEP,ref:1},this._stage=hF.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!==hF.ENTER_LEVEL?hF.CLEAR_INVERTED:hF.CLEAR},e.enableMask=function(){this.stage=hF.ENABLED},e.exitMask=function(){0!==this._maskStack.length&&(this._maskStack.pop(),0===this._maskStack.length?this.stage=hF.DISABLED:this.stage=hF.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=hF.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=Xc.LESS,a=this.stencilStateMap;if(e&&e.passes[0]){var o=e.passes[0].depthStencilState,h=0,u=0;o.depthTest&&(h=1),o.depthWrite&&(u=1),i=h|u<<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 c=new X_(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,c),c},e.getStencilHash=function(t){return t<<8|this._maskStack.length},e.setStateFromStage=function(t){var e=this._stencilPattern;t===hF.DISABLED?(e.stencilTest=!1,e.func=Xc.ALWAYS,e.failOp=jc.KEEP,e.stencilMask=e.writeMask=65535,e.ref=1):(e.stencilTest=!0,t===hF.ENABLED?(e.func=Xc.EQUAL,e.failOp=jc.KEEP,e.stencilMask=e.ref=this.getStencilRef(),e.writeMask=this.getWriteMask()):t===hF.CLEAR?(e.func=Xc.NEVER,e.failOp=jc.ZERO,e.writeMask=e.stencilMask=e.ref=this.getWriteMask()):t===hF.CLEAR_INVERTED||t===hF.ENTER_LEVEL?(e.func=Xc.NEVER,e.failOp=jc.REPLACE,e.writeMask=e.stencilMask=e.ref=this.getWriteMask()):t===hF.ENTER_LEVEL_INVERTED&&(e.func=Xc.NEVER,e.failOp=jc.ZERO,e.writeMask=e.stencilMask=e.ref=this.getWriteMask()))},n(t,[{key:"stage",get:function(){return this._stage},set:function(t){this._stage=t}},{key:"pattern",get:function(){return this._stencilPattern}}]),t}());EF.sharedManager=null,EF.sharedManager=new EF,function(t){t[t.STATIC=0]="STATIC",t[t.DYNAMIC=1]="DYNAMIC",t[t.CROSSED=2]="CROSSED"}(pF||(pF={})),function(t){t[t.localOpacity=0]="localOpacity",t[t.count=1]="count"}(mF||(mF={})),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"}(gF||(gF={})),function(t){t[t.colorDirty=0]="colorDirty",t[t.enabled=1]="enabled",t[t.useLocal=2]="useLocal",t[t.count=3]="count"}(vF||(vF={})),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"}(yF||(yF={}));var TF,SF,AF,RF,CF,bF=function(){function t(){this._renderEntityType=pF.STATIC,this._dynamicDrawInfoArr=[],this._node=null,this._renderTransform=null,this._stencilStage=hF.DISABLED,this._useLocal=!1,this._maskMode=yF.NONE,this._color=qi.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(){},n(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}(),IF=nF(JB)>>2,wF=t("BaseRenderData",function(){function t(t){void 0===t&&(t=JB),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=JB,this._drawInfoType=oF.COMP,this._multiOwner=!1,this._batcher=null,this._floatStride=t===JB?IF:nF(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=oF.COMP)},e.removeRenderDrawInfo=function(){},e.setRenderDrawInfoAttributes=function(){},n(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=fL.root.batcher2D),this._batcher}}]),t}()),OF=t("RenderData",function(t){function e(e,i){var n;return void 0===e&&(e=JB),(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}s(e,t),e.add=function(t,i){void 0===t&&(t=JB);var n=new e(t,i);return i||(i=fL.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=vc(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=fL.root.device;return new dF(n,t,e,i)},n(e,[{key:"dataLength",get:function(){return this._data.length},set:function(t){var e=this._data;if(e.length!==t){for(var i=e.length;i<t;i++)e.push({x:0,y:0,z:0,u:0,v:0,color:qi.WHITE.clone()});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}(wF)),xF=t("MeshRenderData",function(t){function e(e){var i;return void 0===e&&(e=JB),(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}s(e,t),e.add=function(t){void 0===t&&(t=JB);var i=new e;return i._floatStride=t===JB?IF:nF(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 Ml(Mc.VERTEX|Mc.TRANSFER_DST,Bc.DEVICE,i,i)));var r=Uint16Array.BYTES_PER_ELEMENT;this._indexBuffer||(this._indexBuffer=t.createBuffer(new Ml(Mc.INDEX|Mc.TRANSFER_DST,Bc.DEVICE,r,r))),this._iaInfo=new Jl(this._vertexFormat,n,this._indexBuffer),this._iaPool=new hu((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(){},n(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}(wF));new hu((function(){return new xF}),32);var NF,DF,MF,PF,LF,BF,FF=new pn,UF=new pn,kF=new Wi,GF=new cn,HF=new cn,zF=new cn,VF=new cn(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),WF=new En,XF=bs("cc.UITransform")(TF=ws(110)(TF=Os(((CF=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._contentSize=AF&&AF(),e._anchorPoint=RF&&RF(),e}s(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(Xp.PARENT_CHANGED,this._parentChanged,this),this._markRenderDataDirty()},i.onDisable=function(){this.node.off(Xp.PARENT_CHANGED,this._parentChanged,this)},i.onDestroy=function(){this.node._uiProps.uiTransformComp=null},i.setContentSize=function(t,e){var i,n,r=this._contentSize;if(void 0===e){if(Ei((t=t).width,r.width,vi)&&Ei(t.height,r.height,vi))return;i=t.width,n=t.height}else{if(Ei(t=t,r.width,vi)&&Ei(e,r.height,vi))return;i=t,n=e}r.width=i,r.height=n,this.node.emit(Xp.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(Xp.ANCHOR_CHANGED,this._anchorPoint),this._markRenderDataDirty()},i.isHit=function(t){for(var e=this._contentSize.width,i=this._contentSize.height,n=FF,r=UF,s=this._getRenderScene().cameras,a=0;a<s.length;a++){var o=s[a];if(o.visibility&this.node.layer){o.node.getWorldRT(GF);var h=GF.m12,u=GF.m13,c=pc.center;if(GF.m12=c.x-(GF.m00*h+GF.m04*u),GF.m13=c.y-(GF.m01*h+GF.m05*u),cn.invert(GF,GF),pn.transformMat4(n,t,GF),this.node.getWorldMatrix(zF),cn.invert(GF,zF),!cn.strictEquals(GF,VF)){pn.transformMat4(r,n,GF),r.x+=this._anchorPoint.x*e,r.y+=this._anchorPoint.y*i;var l=!1;if(r.x>=0&&r.y>=0&&r.x<=e&&r.y<=i&&(l=this._maskTest(n)),l)return!0}}}return!1},i.hitTest=function(t,e){void 0===e&&(e=0);for(var i=this._contentSize.width,n=this._contentSize.height,r=kF,s=FF,a=UF,o=this._getRenderScene().cameras,h=0;h<o.length;h++){var u=o[h];if(u.visibility&this.node.layer&&(!u.window||u.window.swapchain)&&u.systemWindowId===e&&(Wi.set(r,t.x,t.y,0),u.screenToWorld(r,r),pn.set(s,r.x,r.y),this.node.getWorldMatrix(zF),cn.invert(GF,zF),!cn.strictEquals(GF,VF))){pn.transformMat4(a,s,GF),a.x+=this._anchorPoint.x*i,a.y+=this._anchorPoint.y*n;var c=!1;if(a.x>=0&&a.y>=0&&a.x<=i&&a.y<=n&&(c=this._maskTest(s)),c)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 h=n[o];if(a===h.index){if(r!==h.comp.node){n.length=o;break}var u=h.comp;if(u&&u._enabled&&!u.isHit(t))return!1;o++}else if(a>h.index){n.length=o;break}}return!0},i.convertToNodeSpaceAR=function(t,e){return this.node.getWorldMatrix(zF),cn.invert(GF,zF),e||(e=new Wi),Wi.transformMat4(e,t,GF)},i.convertToWorldSpaceAR=function(t,e){return this.node.getWorldMatrix(zF),e||(e=new Wi),Wi.transformMat4(e,t,zF)},i.getBoundingBox=function(){var t=new En;return this._selfBoundingBox(t),cn.fromSRT(HF,this.node.rotation,this.node.position,this.node.scale),t.transformMat4(HF),t},i.getBoundingBoxToWorld=function(){for(var t=new En,i=this.node.children,n=0;n<i.length;++n){var r=i[n];if(r&&r.active){var s=r.getComponent(e);s&&s.contentSize.width&&s.contentSize.height&&(s._selfBoundingBox(WF),WF.transformMat4(r.worldMatrix),0===t.width?t.set(WF):En.union(t,t,WF))}}return this._contentSize.width&&this._contentSize.height&&(this._selfBoundingBox(WF),WF.transformMat4(this.node.worldMatrix),0===t.width?t.set(WF):En.union(t,t,WF)),t},i.getBoundingBoxTo=function(t){var i=new En,n=this.node.children;cn.invert(GF,t);for(var r=0;r<n.length;++r){var s=n[r];if(s&&s.active){var a=s.getComponent(e);a&&a.contentSize.width&&a.contentSize.height&&(a._selfBoundingBox(WF),cn.multiply(HF,s.worldMatrix,GF),WF.transformMat4(HF),0===i.width?i.set(WF):En.union(i,i,WF))}}return this._contentSize.width&&this._contentSize.height&&(this._selfBoundingBox(WF),cn.multiply(HF,this.node.worldMatrix,GF),WF.transformMat4(HF),0===i.width?i.set(WF):En.union(i,i,WF)),i},i.getComputeAABB=function(t){var e=this._contentSize.width,i=this._contentSize.height;WF.set(-this._anchorPoint.x*e,-this._anchorPoint.y*i,e,i),WF.transformMat4(this.node.worldMatrix);var n=WF.x+.5*WF.width,r=WF.y+.5*WF.height,s=this.node.worldPosition.z,a=WF.width/2,o=WF.height/2;return null!=t?($r.set(t,n,r,s,a,o,.001),t):new $r(n,r,s,a,o,.001)},i._selfBoundingBox=function(t){var e=this._contentSize.width,i=this._contentSize.height;return t.set(-this._anchorPoint.x*e,-this._anchorPoint.y*i,e,i),t},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()},n(e,[{key:"contentSize",get:function(){return this._contentSize},set:function(t){this._contentSize.equals(t)||(this._contentSize.set(t),this.node.emit(Xp.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(Xp.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(Xp.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(Xp.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(Xp.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(Xp.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=fL.root.batcher2D.getFirstRenderCamera(this.node);return t?t.visibility:0}},{key:"cameraPriority",get:function(){var t=fL.root.batcher2D.getFirstRenderCamera(this.node);return t?t.priority:0}}]),e}(Wd)).EventType=Xp,CF.priorityChangeNodeMap=new Map,AF=gs((SF=CF).prototype,"_contentSize",[Ls],(function(){return new vn(100,100)})),RF=gs(SF.prototype,"_anchorPoint",[Ls],(function(){return new pn(.5,.5)})),TF=SF))||TF)||TF)||TF;t({UITransform:XF,UITransformComponent:XF}),fL.on(_L.EVENT_AFTER_UPDATE,XF._sortSiblings),fL.on(_L.EVENT_BEFORE_SCENE_LAUNCH,XF._cleanChangeMap);var jF,YF,KF,qF,QF,ZF,JF,$F,tU,eU,iU,nU,rU,sU={parent:null,owner:null,subModelIdx:0},aU=Os,oU=sa,hU=t("Renderer",(NF=bs("cc.Renderer"),DF=oU(ZE),MF=oU([ZE]),NF(PF=aU((d((LF=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)._materials=BF&&BF(),e._materialInstances=[],e}s(e,t);var i=e.prototype;return i.getMaterial=function(t){return this.getSharedMaterial(t)},i.getSharedMaterial=function(t){return t<0||t>=this._materials.length?null:this._materials[t]},i.setMaterial=function(t,e){t&&t instanceof aT&&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]){sU.parent=this._materials[t],sU.owner=this,sU.subModelIdx=t;var e=new aT(sU);sU.parent=null,sU.owner=null,sU.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(){},n(e,[{key:"sharedMaterial",get:function(){return this.getSharedMaterial(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}(Wd)).prototype,"sharedMaterials",[DF],Object.getOwnPropertyDescriptor(LF.prototype,"sharedMaterials"),LF.prototype),BF=gs(LF.prototype,"_materials",[MF],(function(){return[]})),PF=LF))||PF)||PF));me(Yc),me(Kc),me(qc),t("InstanceMaterialType",rU),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"}(rU||t("InstanceMaterialType",rU={}));var uU=(jF=bs("cc.UIRenderer"),YF=Is(XF),KF=sa(ZE),qF=sa(ZE),jF(QF=YF(((nU=function(t){function e(){var e;return(e=t.call(this)||this)._renderData=null,e._materials=JF&&JF(),e._customMaterial=$F&&$F(),e._srcBlendFactor=tU&&tU(),e._dstBlendFactor=eU&&eU(),e._color=iU&&iU(),e._stencilStage=hF.DISABLED,e._assembler=null,e._postAssembler=null,e._renderDataFlag=!0,e._renderFlag=!0,e._renderEntity=void 0,e._instanceMaterialType=-1,e._srcBlendFactorCache=Yc.SRC_ALPHA,e._dstBlendFactorCache=Yc.ONE_MINUS_SRC_ALPHA,e._dirtyVersion=-1,e._internalId=-1,e._useVertexOpacity=!1,e._lastParent=null,e._renderEntity=e.createRenderEntity(),e}s(e,t);var i=e.prototype;return i.setRenderData=function(t){this._renderData=t},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(Xp.ANCHOR_CHANGED,this._nodeStateChange,this),this.node.on(Xp.SIZE_CHANGED,this._nodeStateChange,this),this.node.on(Xp.PARENT_CHANGED,this._colorDirty,this),this.updateMaterial(),this._colorDirty(),iL.addRenderer(this),this.markForUpdateRenderData()},i.onRestore=function(){this.updateMaterial(),this.markForUpdateRenderData()},i.onDisable=function(){this.node.off(Xp.ANCHOR_CHANGED,this._nodeStateChange,this),this.node.off(Xp.SIZE_CHANGED,this._nodeStateChange,this),this.node.off(Xp.PARENT_CHANGED,this._colorDirty,this),iL.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),iL.markDirtyRenderer(this)}},i.requestRenderData=function(t){void 0===t&&(t=oF.COMP);var e=OF.add();return e.initRenderDrawInfo(this,t),this._renderData=e,e},i.destroyRenderData=function(){this._renderData&&(this._renderData.removeRenderDrawInfo(this),OF.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.getSharedMaterial(0)&&this._enabled&&this._color.a>0},i._postCanRender=function(){},i.updateMaterial=function(){if(this._customMaterial)this.getSharedMaterial(0)!==this._customMaterial&&this.setMaterial(this._customMaterial,0);else{var t=this._updateBuiltinMaterial();this.setMaterial(t,0),this.stencilStage!==hF.ENTER_LEVEL&&this.stencilStage!==hF.ENTER_LEVEL_INVERTED||this.getMaterialInstance(0).recompileShaders({USE_ALPHA_TEST:!0}),this._updateBlendFunc()}},i._updateColor=function(){if(this.node._uiProps.colorDirty=!0,this.setEntityColorDirty(!0),this.setEntityColor(this._color),this.setEntityOpacity(this.node._uiProps.localOpacity),this._assembler){this._assembler.updateColor(this);var t=this._renderFlag;if(this._renderFlag=this._canRender(),this.setEntityEnabled(this._renderFlag),t!==this._renderFlag){var e=this.renderData;e&&(e.vertDirty=!0)}}},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=Yc.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 rU.ADD_COLOR:t=IE.get("ui-base-material");break;case rU.GRAYSCALE:t=IE.get("ui-sprite-gray-material");break;case rU.USE_ALPHA_SEPARATED:t=IE.get("ui-sprite-alpha-sep-material");break;case rU.USE_ALPHA_SEPARATED_AND_GRAY:t=IE.get("ui-sprite-gray-alpha-sep-material");break;default:t=IE.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 bF(pF.STATIC)},n(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:"srcBlendFactor",get:function(){return this._srcBlendFactor},set:function(t){this._srcBlendFactor=t}},{key:"batcher",get:function(){return fL.root.batcher2D}},{key:"renderEntity",get:function(){return this._renderEntity}}]),e}(hU)).BlendState=Yc,nU.Assembler=null,nU.PostAssembler=null,d((ZF=nU).prototype,"sharedMaterials",[aa],Object.getOwnPropertyDescriptor(ZF.prototype,"sharedMaterials"),ZF.prototype),d(ZF.prototype,"customMaterial",[KF],Object.getOwnPropertyDescriptor(ZF.prototype,"customMaterial"),ZF.prototype),JF=gs(ZF.prototype,"_materials",[aa],(function(){return[]})),$F=gs(ZF.prototype,"_customMaterial",[qF],(function(){return null})),tU=gs(ZF.prototype,"_srcBlendFactor",[Ls],(function(){return Yc.SRC_ALPHA})),eU=gs(ZF.prototype,"_dstBlendFactor",[Ls],(function(){return Yc.ONE_MINUS_SRC_ALPHA})),iU=gs(ZF.prototype,"_color",[Ls],(function(){return qi.WHITE.clone()})),QF=ZF))||QF)||QF);t({UIRenderer:uU,RenderComponent:uU,UIRenderable:uU,Renderable2D:uU}),g.internal.UIRenderer=uU;var cU,lU,_U,fU,dU,pU,mU,gU,vU,yU,EU,TU,SU,AU,RU,CU,bU,IU,wU,OU,xU,NU,DU,MU,PU,LU,BU,FU,UU,kU,GU,HU=function(){function t(){this.isBold=!1,this.isItalic=!1,this.isUnderline=!1,this.underlineHeight=1,this.isOutlined=!1,this.outlineColor=qi.WHITE.clone(),this.outlineWidth=1,this.hasShadow=!1,this.shadowColor=qi.BLACK.clone(),this.shadowBlur=2,this.shadowOffsetX=0,this.shadowOffsetY=0,this.color=qi.WHITE.clone(),this.fontSize=40,this.actualFontSize=0,this.isSystemFontUsed=!1,this.originFontSize=0,this.bmfontScale=1,this.fontFamily="Arial",this.fontDesc="",this.fntConfig=null,this.spriteFrame=null,this.fontScale=1}return t.prototype.reset=function(){this.isBold=!1,this.isItalic=!1,this.isUnderline=!1,this.underlineHeight=1,this.isOutlined=!1,this.outlineColor.set(),this.outlineWidth=1,this.hasShadow=!1,this.shadowColor.set(),this.shadowBlur=2,this.shadowOffsetX=0,this.shadowOffsetY=0},t}(),zU=function(){function t(){this.horizontalAlign=0,this.verticalAlign=0,this.wrapping=!0,this.overFlow=0,this.lineHeight=10,this.maxLineWidth=0,this.spacingX=0,this.textWidthTemp=0,this.textHeightTemp=0,this.textDimensions=new vn,this.horizontalKerning=[],this.numberOfLines=1,this.linesOffsetX=[],this.letterOffsetY=0,this.tailoredTopY=0,this.tailoredBottomY=0,this.textDesiredHeight=0,this.linesWidth=[]}return t.prototype.reset=function(){this.horizontalAlign=0,this.verticalAlign=0,this.wrapping=!0,this.overFlow=0,this.lineHeight=10,this.maxLineWidth=0,this.spacingX=0,this.textWidthTemp=0,this.textHeightTemp=0,this.textDimensions.set(),this.horizontalKerning.length=0,this.numberOfLines=1,this.linesOffsetX.length=0,this.letterOffsetY=0,this.tailoredTopY=0,this.tailoredBottomY=0,this.textDesiredHeight=0,this.linesWidth.length=0},t}(),VU=function(){function t(){this.parsedString=[],this.nodeContentSize=vn.ZERO.clone(),this.canvasSize=new vn,this.canvasPadding=new En,this.contentSizeExtend=vn.ZERO.clone(),this.startPosition=pn.ZERO.clone()}return t.prototype.reset=function(){this.parsedString.length=0,this.nodeContentSize.set(0,0),this.canvasSize.set(),this.canvasPadding.set(),this.contentSizeExtend.set(),this.startPosition.set()},t}(),WU=function(){function t(){this.quadCount=0,this.vertexBuffer=[],this.texture=null,this.uiTransAnchorX=.5,this.uiTransAnchorY=.5}return t.prototype.reset=function(){this.quadCount=0,this.vertexBuffer.length=0,this.texture=null,this.uiTransAnchorX=.5,this.uiTransAnchorY=.5},t}();qi.WHITE.clone(),t("HorizontalTextAlignment",FU),function(t){t[t.LEFT=0]="LEFT",t[t.CENTER=1]="CENTER",t[t.RIGHT=2]="RIGHT"}(FU||t("HorizontalTextAlignment",FU={})),me(FU),t("VerticalTextAlignment",UU),function(t){t[t.TOP=0]="TOP",t[t.CENTER=1]="CENTER",t[t.BOTTOM=2]="BOTTOM"}(UU||t("VerticalTextAlignment",UU={})),me(UU),t("Overflow",kU),function(t){t[t.NONE=0]="NONE",t[t.CLAMP=1]="CLAMP",t[t.SHRINK=2]="SHRINK",t[t.RESIZE_HEIGHT=3]="RESIZE_HEIGHT"}(kU||t("Overflow",kU={})),me(kU),t("CacheMode",GU),function(t){t[t.NONE=0]="NONE",t[t.BITMAP=1]="BITMAP",t[t.CHAR=2]="CHAR"}(GU||t("CacheMode",GU={})),me(GU);var XU=(cU=bs("cc.Label"),lU=ws(110),_U=sa(FU),fU=sa(UU),dU=sa(kU),pU=sa(uB),mU=sa(GU),cU(gU=lU(((BU=function(t){function e(){var e;return(e=t.call(this)||this)._string=yU&&yU(),e._horizontalAlign=EU&&EU(),e._verticalAlign=TU&&TU(),e._actualFontSize=SU&&SU(),e._fontSize=AU&&AU(),e._fontFamily=RU&&RU(),e._lineHeight=CU&&CU(),e._overflow=bU&&bU(),e._enableWrapText=IU&&IU(),e._font=wU&&wU(),e._isSystemFontUsed=OU&&OU(),e._spacingX=xU&&xU(),e._isItalic=NU&&NU(),e._isBold=DU&&DU(),e._isUnderline=MU&&MU(),e._underlineHeight=PU&&PU(),e._cacheMode=LU&&LU(),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._textStyle=null,e._textLayout=null,e._textRenderData=null,e._textLayoutData=null,e._ttfSpriteFrame=null,e._textStyle=new HU,e._textLayout=new zU,e._textLayoutData=new VU,e._textRenderData=new WU,e}s(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 SB){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.textStyle.reset(),this.textLayout.reset(),this.textLayoutData.reset(),this.textRenderData.reset()),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 SB){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===GU.CHAR)this._letterTexture=this._assembler.getAssemblerData(),this._texture=this._letterTexture;else if(!this._ttfSpriteFrame){this._ttfSpriteFrame=new nB,this._assemblerData=this._assembler.getAssemblerData();var i=new dd(this._assemblerData.canvas),n=new Fp;n.image=i,this._ttfSpriteFrame.texture=n}this.cacheMode!==GU.CHAR&&(this._texture=this._ttfSpriteFrame),this.changeMaterialForDefine()}},i.changeMaterialForDefine=function(){if(this._texture){var t=!1;if(this.cacheMode!==GU.CHAR){var e=this._texture.texture;if(e instanceof yd){var i=e.getPixelFormat();t=i===Yf.RGBA_ETC1||i===Yf.RGB_A_PVRTC_4BPPV1||i===Yf.RGB_A_PVRTC_2BPPV1}}this._instanceMaterialType=t?rU.USE_ALPHA_SEPARATED:rU.ADD_COLOR_AND_TEXTURE,this.updateMaterial()}},i._updateBlendFunc=function(){var e=Au.getSystemInfoSync();Number.parseInt(e.SDKVersion[0])<2&&(this._srcBlendFactor!==Yc.SRC_ALPHA||Au.isDevTool||this._font instanceof SB||this._customMaterial||(this._srcBlendFactor=Yc.ONE)),t.prototype._updateBlendFunc.call(this)},n(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!==GU.BITMAP||this._font instanceof SB||!this._ttfSpriteFrame||this._ttfSpriteFrame._resetDynamicAtlasFrame(),this._cacheMode===GU.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 SB?this._font.fontSize:-1}},{key:"textStyle",get:function(){return this._textStyle}},{key:"textLayout",get:function(){return this._textLayout}},{key:"textRenderData",get:function(){return this._textRenderData}},{key:"textLayoutData",get:function(){return this._textLayoutData}},{key:"contentWidth",get:function(){return this._contentWidth},set:function(t){this._contentWidth=t}}]),e}(uU)).HorizontalAlign=FU,BU.VerticalAlign=UU,BU.Overflow=kU,BU.CacheMode=GU,BU._canvasPool=zB.getInstance(),d((vU=BU).prototype,"horizontalAlign",[_U],Object.getOwnPropertyDescriptor(vU.prototype,"horizontalAlign"),vU.prototype),d(vU.prototype,"verticalAlign",[fU],Object.getOwnPropertyDescriptor(vU.prototype,"verticalAlign"),vU.prototype),d(vU.prototype,"overflow",[dU],Object.getOwnPropertyDescriptor(vU.prototype,"overflow"),vU.prototype),d(vU.prototype,"font",[pU],Object.getOwnPropertyDescriptor(vU.prototype,"font"),vU.prototype),d(vU.prototype,"cacheMode",[mU],Object.getOwnPropertyDescriptor(vU.prototype,"cacheMode"),vU.prototype),yU=gs(vU.prototype,"_string",[Ls],(function(){return"label"})),EU=gs(vU.prototype,"_horizontalAlign",[Ls],(function(){return FU.CENTER})),TU=gs(vU.prototype,"_verticalAlign",[Ls],(function(){return UU.CENTER})),SU=gs(vU.prototype,"_actualFontSize",[Ls],(function(){return 0})),AU=gs(vU.prototype,"_fontSize",[Ls],(function(){return 40})),RU=gs(vU.prototype,"_fontFamily",[Ls],(function(){return"Arial"})),CU=gs(vU.prototype,"_lineHeight",[Ls],(function(){return 40})),bU=gs(vU.prototype,"_overflow",[Ls],(function(){return kU.NONE})),IU=gs(vU.prototype,"_enableWrapText",[Ls],(function(){return!0})),wU=gs(vU.prototype,"_font",[Ls],(function(){return null})),OU=gs(vU.prototype,"_isSystemFontUsed",[Ls],(function(){return!0})),xU=gs(vU.prototype,"_spacingX",[Ls],(function(){return 0})),NU=gs(vU.prototype,"_isItalic",[Ls],(function(){return!1})),DU=gs(vU.prototype,"_isBold",[Ls],(function(){return!1})),MU=gs(vU.prototype,"_isUnderline",[Ls],(function(){return!1})),PU=gs(vU.prototype,"_underlineHeight",[Ls],(function(){return 2})),LU=gs(vU.prototype,"_cacheMode",[Ls],(function(){return GU.NONE})),gU=vU))||gU)||gU);t({Label:XU,LabelComponent:XU}),g.Label=XU;var jU,YU,KU=0,qU={};function QU(t){return--t,t|=t>>16,t|=t>>8,t|=t>>4,t|=t>>2,t|=t>>1,++t}function ZU(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"}(jU||(jU={})),function(t){t[t.DEFAULT=1]="DEFAULT",t[t.FORWARD=2]="FORWARD",t[t.SHADOWCAST=4]="SHADOWCAST"}(YU||(YU={}));var JU,$U,tk,ek,ik,nk,rk,sk,ak,ok=function(){function t(t){this._device=void 0,this._format=xc.UNKNOWN,this._formatSize=0,this._chunks=[],this._chunkCount=0,this._handles=[],this._region0=new Il,this._region1=new Il,this._region2=new Il,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=T_[t.format];this._format=t.format,this._formatSize=e.size,this._channels=e.count,this._bufferViewCtor=x_(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=ZU(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),h=this._roundUpFn&&this._roundUpFn(o,this._formatSize)||Math.max(1024,QU(o)),u=this._chunks[this.createChunk(h)];u.start+=t;var c={chunkIdx:this._chunkCount-1,start:0,end:t,texture:u.texture};return this._handles.push(c),c},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;k("TextureBufferPool: Allocate chunk "+this._chunkCount+", size: "+e+", format: "+this._format);var i={texture:this._device.createTexture(new Ul(Fc.TEX2D,Uc.SAMPLED|Uc.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),h=Math.min(t.texture.width-a,s),u=0;a>0&&(this._region0.texOffset.x=a,this._region0.texOffset.y=o,this._region0.texExtent.width=h,this._region0.texExtent.height=1,i.push(new this._bufferViewCtor(e,u*this._formatSize,h*this._channels)),n.push(this._region0),a=0,o+=1,s-=h,u+=h),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),h=this._region1.texExtent.width*this._region1.texExtent.height):(h=s,this._region1.texExtent.width=h,this._region1.texExtent.height=1),i.push(new this._bufferViewCtor(e,u*this._formatSize,h*this._channels)),n.push(this._region1),a=0,o+=this._region1.texExtent.height,s-=h,u+=h),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,u*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=ZU(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,QU(a)),h=this._chunks[this.createChunk(o)];h.start+=t;var u={chunkIdx:this._chunkCount,start:0,end:t,texture:h.texture};return this._handles.push(u),u},t}(),hk=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"}(ak||(ak={}));var uk,ck,lk=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 hk(t,r,this._stride);var s=ak.NEVER,a=!1,o=!1;for(var h in e){if(a=this._hasFloat32,(o=this._hasUint32)&&a)break;s=e[h],a||s!==ak.FLOAT32?o||s!==ak.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,h=this._hasUint32,u=0;u<this._entriesPerChunk;u++)o&&r.push(new Float32Array(n,this._stride*u,this._elementCount)),h&&s.push(new Uint32Array(n,this._stride*u,this._elementCount)),u&&a.push(u);return h&&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]===ak.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"}(uk||(uk={})),function(t){t[t.POSITION=0]="POSITION",t[t.UV=3]="UV",t[t.COLOR=5]="COLOR",t[t.COUNT=9]="COUNT"}(ck||(ck={}));var _k,fk=((JU={})[ck.POSITION]=ak.FLOAT32,JU[ck.UV]=ak.FLOAT32,JU[ck.COLOR]=ak.UINT32,JU[ck.COUNT]=ak.NEVER,JU),dk=(($U={})[ck.POSITION]=ck.UV-ck.POSITION,$U[ck.UV]=ck.COLOR-ck.UV,$U[ck.COLOR]=ck.COUNT-ck.COLOR,$U[ck.COUNT]=1,$U),pk=new lk(uk.RENDER2D,fk,dk,ck);!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"}(_k||(_k={}));var mk,gk=((tk={})[_k.DIRTY_FLAG]=ak.UINT32,tk[_k.LAYER]=ak.UINT32,tk[_k.WORLD_SCALE]=ak.FLOAT32,tk[_k.WORLD_POSITION]=ak.FLOAT32,tk[_k.WORLD_ROTATION]=ak.FLOAT32,tk[_k.WORLD_MATRIX]=ak.FLOAT32,tk[_k.LOCAL_SCALE]=ak.FLOAT32,tk[_k.LOCAL_POSITION]=ak.FLOAT32,tk[_k.LOCAL_ROTATION]=ak.FLOAT32,tk[_k.COUNT]=ak.NEVER,tk),vk=((ek={})[_k.DIRTY_FLAG]=_k.LAYER-_k.DIRTY_FLAG,ek[_k.LAYER]=_k.WORLD_SCALE-_k.LAYER,ek[_k.WORLD_SCALE]=_k.WORLD_POSITION-_k.WORLD_SCALE,ek[_k.WORLD_POSITION]=_k.WORLD_ROTATION-_k.WORLD_POSITION,ek[_k.WORLD_ROTATION]=_k.WORLD_MATRIX-_k.WORLD_ROTATION,ek[_k.WORLD_MATRIX]=_k.LOCAL_SCALE-_k.WORLD_MATRIX,ek[_k.LOCAL_SCALE]=_k.LOCAL_POSITION-_k.LOCAL_SCALE,ek[_k.LOCAL_POSITION]=_k.LOCAL_ROTATION-_k.LOCAL_POSITION,ek[_k.LOCAL_ROTATION]=_k.COUNT-_k.LOCAL_ROTATION,ek[_k.COUNT]=1,ek),yk=new lk(uk.NODE,gk,vk,_k);!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"}(mk||(mk={}));var Ek,Tk=((ik={})[mk.PRIORITY]=ak.UINT32,ik[mk.STAGE]=ak.UINT32,ik[mk.PHASE]=ak.UINT32,ik[mk.PRIMITIVE]=ak.UINT32,ik[mk.BATCHING_SCHEME]=ak.UINT32,ik[mk.DYNAMIC_STATE]=ak.UINT32,ik[mk.HASH]=ak.UINT32,ik[mk.COUNT]=ak.NEVER,ik),Sk=((nk={})[mk.PRIORITY]=mk.STAGE-mk.PRIORITY,nk[mk.STAGE]=mk.PHASE-mk.STAGE,nk[mk.PHASE]=mk.PRIMITIVE-mk.PHASE,nk[mk.PRIMITIVE]=mk.BATCHING_SCHEME-mk.PRIMITIVE,nk[mk.BATCHING_SCHEME]=mk.DYNAMIC_STATE-mk.BATCHING_SCHEME,nk[mk.DYNAMIC_STATE]=mk.HASH-mk.DYNAMIC_STATE,nk[mk.HASH]=mk.COUNT-mk.HASH,nk[mk.COUNT]=1,nk),Ak=new lk(uk.PASS,Tk,Sk,mk);!function(t){t[t.CENTER=0]="CENTER",t[t.HALFEXTENTS=3]="HALFEXTENTS",t[t.COUNT=6]="COUNT"}(Ek||(Ek={}));var Rk=((rk={})[Ek.CENTER]=ak.FLOAT32,rk[Ek.HALFEXTENTS]=ak.FLOAT32,rk[Ek.COUNT]=ak.NEVER,rk),Ck=((sk={})[Ek.CENTER]=Ek.HALFEXTENTS-Ek.CENTER,sk[Ek.HALFEXTENTS]=Ek.COUNT-Ek.HALFEXTENTS,sk[Ek.COUNT]=1,sk),bk=new lk(uk.AABB,Rk,Ck,Ek);nt(WM.prototype,"RenderScene.prototype",[{name:"raycastUI2DNode"},{name:"raycastUINode"}]),nt(WM.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"}]),nt(SI.prototype,"Model.prototype",[{name:"isInstancingEnabled"},{name:"instancedAttributes"}]);var Ik={};nt(Ik,"CameraVisFlags",[{name:"GENERAL"}]),it(Ik,"CameraVisFlags",[{name:"PROFILER",newName:"PROFILER",target:Hp.BitMask,targetName:"PROFILER"},{name:"GIZMOS",newName:"GIZMOS",target:Hp.BitMask,targetName:"GIZMOS"},{name:"EDITOR",newName:"EDITOR",target:Hp.BitMask,targetName:"EDITOR"},{name:"UI",newName:"UI",target:Hp.BitMask,targetName:"UI_3D"},{name:"UI2D",newName:"UI2D",target:Hp.BitMask,targetName:"UI_2D"}]),g.CameraVisFlags=Ik;var wk={};nt(wk,"VisibilityFlags",[{name:"GENERAL"}]),it(wk,"VisibilityFlags",[{name:"ALWALS",newName:"ALWALS",target:Hp.Enum,targetName:"ALWALS"},{name:"PROFILER",newName:"PROFILER",target:Hp.Enum,targetName:"PROFILER"},{name:"GIZMOS",newName:"GIZMOS",target:Hp.Enum,targetName:"GIZMOS"},{name:"EDITOR",newName:"EDITOR",target:Hp.Enum,targetName:"EDITOR"},{name:"UI",newName:"UI",target:Hp.Enum,targetName:"UI_3D"},{name:"UI2D",newName:"UI2D",target:Hp.Enum,targetName:"UI_2D"}]),g.VisibilityFlags=wk,it(ME.prototype,"Pass.prototype",[{name:"getBindingTypeFromHandle",newName:"getDescriptorTypeFromHandle"}]),nt(Wb.prototype,"Camera.prototype",[{name:"getSplitFrustum"},{name:"setMatView"},{name:"setMatViewInv"},{name:"setMatProjInv"},{name:"setMatViewProjInv"},{name:"setMatProj"},{name:"setMatViewProj"},{name:"getMatViewInv"}]),nt(rT.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"}]),nt(QI.prototype,"SpotLight.prototype",[{name:"aspect"}]),it(eI.prototype,"SubModel.prototype",[{name:"subMeshData",newName:"subMesh"}]),nt(eI.prototype,"SubModel.prototype",[{name:"getSubModel",suggest:"Use `subModels[i]` instead"},{name:"subModelNum",suggest:"Use `subModels.length` instead"}]);var Ok,xk,Nk,Dk=function(t){if(void 0===qU[t]){var e=1<<KU;qU[t]=e,KU+=1}},Mk=Object.freeze({__proto__:null,addStage:Dk,scene:iw,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 Ql(ml.ATTR_POSITION,xc.RGB32F)),e.normals&&s.push(new Ql(ml.ATTR_NORMAL,xc.RGB32F)),e.uvs&&s.push(new Ql(ml.ATTR_TEX_COORD,xc.RG32F)),e.colors&&s.push(new Ql(ml.ATTR_COLOR,xc.RGB32F));var a=t.createBuffer(new Ml(Mc.VERTEX|Mc.TRANSFER_DST,Bc.DEVICE,4*i.length,4*i.length/n));a.update(new Float32Array(i));var o=null;return e.indices&&(o=t.createBuffer(new Ml(Mc.INDEX|Mc.TRANSFER_DST,Bc.DEVICE,2*e.indices.length,2))).update(new Uint16Array(e.indices)),t.createInputAssembler(new Jl(s,[a],o))},programLib:iy,getDeviceShaderVersion:Kv,get RenderQueue(){return jU},get PassStage(){return YU},genHandle:wv,getTypeFromHandle:Ov,getBindingFromHandle:xv,getCountFromHandle:Nv,getOffsetFromHandle:Dv,customizeType:Mv,type2reader:Pv,type2writer:Lv,type2validator:Bv,getDefaultFromType:Uv,getStringFromType:kv,overrideMacros:Gv,get BatchingSchemes(){return CE},Pass:ME,nearestPOT:QU,TextureBufferPool:ok,MaterialInstance:aT,PassInstance:sT,get PoolType(){return uk},NULL_HANDLE:0,get Render2dView(){return ck},Render2dPool:pk,get NodeView(){return _k},NodePool:yk,get PassView(){return mk},PassPool:Ak,get AABBView(){return Ek},AABBPool:bk,RenderScene:WM,CameraVisFlags:Ik,VisibilityFlags:wk});t("renderer",Mk),function(t){t[t.BUTT=0]="BUTT",t[t.ROUND=1]="ROUND",t[t.SQUARE=2]="SQUARE"}(Ok||(Ok={})),me(Ok),function(t){t[t.BEVEL=0]="BEVEL",t[t.ROUND=1]="ROUND",t[t.MITER=2]="MITER"}(xk||(xk={})),me(xk),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"}(Nk||(Nk={})),me(Nk);var Pk=Math.PI,Lk=Math.min,Bk=Math.max,Fk=Math.cos,Uk=Math.sin,kk=Math.abs,Gk=Math.sign,Hk=.5522847493;function zk(t,e,i,n,r){t.moveTo(e-n,i),t.bezierCurveTo(e-n,i+r*Hk,e-n*Hk,i+r,e,i+r),t.bezierCurveTo(e+n*Hk,i+r,e+n,i+r*Hk,e+n,i),t.bezierCurveTo(e+n,i-r*Hk,e+n*Hk,i-r,e,i-r),t.bezierCurveTo(e-n*Hk,i-r,e-n,i-r*Hk,e-n,i),t.close()}function Vk(t,e,i,n,r,s,a,o,h,u,c){var l,_,f,d,p,m,g,v,y,E,T,S,A,R,C,b;u>10||(p=.5*(s+o),m=.5*(a+h),g=.5*((l=.5*(e+n))+(f=.5*(n+s))),v=.5*((_=.5*(i+r))+(d=.5*(r+a))),((C=kk((n-o)*(R=h-i)-(r-h)*(A=o-e)))+(b=kk((s-o)*R-(a-h)*A)))*(C+b)<t.tessTol*(A*A+R*R)?t.addPoint(o,h,0===c?c|Nk.PT_BEVEL:c):(Vk(t,e,i,l,_,g,v,T=.5*(g+(y=.5*(f+p))),S=.5*(v+(E=.5*(d+m))),u+1,0),Vk(t,T,S,y,E,p,m,o,h,u+1,c)))}var Wk,Xk,jk,Yk,Kk,qk,Qk,Zk,Jk,$k,tG,eG,iG,nG,rG,sG,aG,oG,hG,uG,cG,lG,_G,fG,dG,pG,mG,gG,vG,yG,EG,TG,SG,AG,RG,CG,bG,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).dx=0,e.dy=0,e.dmx=0,e.dmy=0,e.flags=0,e.len=0,e}return s(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}(pn),wG=function(){function t(){this.closed=!1,this.bevel=0,this.complex=!0,this.points=[]}return t.prototype.reset=function(){this.closed=!1,this.bevel=0,this.complex=!0,this.points.length=0},t}(),OG=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=qi.WHITE.clone(),this.lineCap=Ok.BUTT,this.strokeColor=qi.BLACK.clone(),this.lineJoin=xk.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,Nk.PT_CORNER),this._commandX=t,this._commandY=e},e.lineTo=function(t,e){this.addPoint(t,e,Nk.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?(Vk(this,o.x,o.y,t,e,i,n,r,s,0,Nk.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,h,u=0,c=0,l=0,_=0,f=0,d=0,p=0,m=0,g=0,v=0,y=0,E=0,T=0,S=0;if(c=s-r,a=a||!1)if(kk(c)>=2*Pk)c=2*Pk;else for(;c<0;)c+=2*Pk;else if(kk(c)>=2*Pk)c=2*-Pk;else for(;c>0;)c-=2*Pk;for(h=0|Bk(1,Lk(kk(c)/(.5*Pk)+.5,5)),l=kk(4/3*(1-Fk(o=c/h/2))/Uk(o)),a||(l=-l),S=0;S<=h;S++)d=e+(_=Fk(u=r+c*(S/h)))*n,p=i+(f=Uk(u))*n,m=-f*n*l,g=_*n*l,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){zk(this,t,e,i,n),this._curPath.complex=!1},e.circle=function(t,e,i){zk(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=Lk(s,.5*kk(n))*Gk(n),o=Lk(s,.5*kk(r))*Gk(r);t.moveTo(e,i+o),t.lineTo(e,i+r-o),t.bezierCurveTo(e,i+r-o*(1-Hk),e+a*(1-Hk),i+r,e+a,i+r),t.lineTo(e+n-a,i+r),t.bezierCurveTo(e+n-a*(1-Hk),i+r,e+n,i+r-o*(1-Hk),e+n,i+r-o),t.lineTo(e+n,i+o),t.bezierCurveTo(e+n,i+o*(1-Hk),e+n-a*(1-Hk),i,e+n-a,i),t.lineTo(e+a,i),t.bezierCurveTo(e+a*(1-Hk),i,e,i+o*(1-Hk),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&&(xF.remove(n),n.removeRenderDrawInfo(this._comp))}this._renderDataList.length=0},e.close=function(){this._curPath.closed=!0},e.requestRenderData=function(){var t=xF.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 IG(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 wG,this.paths.push(e)),this.pathLength++,this._curPath=e,e},t}(),xG=ZB.concat([new Ql("a_dist",xc.R32F)]),NG=iF(xG),DG=nF(xG),MG=(Wk=bs("cc.Graphics"),Xk=ws(110),jk=sa(xk),Yk=sa(Ok),Wk(Kk=Xk(((iG=function(t){function e(){var e;return(e=t.call(this)||this).impl=null,e.model=null,e._lineWidth=Qk&&Qk(),e._strokeColor=Zk&&Zk(),e._lineJoin=Jk&&Jk(),e._lineCap=$k&&$k(),e._fillColor=tG&&tG(),e._miterLimit=eG&&eG(),e._isDrawing=!1,e._isNeedUploadData=!0,e._graphicsUseSubMeshes=[],e._instanceMaterialType=rU.ADD_COLOR,e.impl=new OG(l(e)),e}s(e,t);var i=e.prototype;return i.onRestore=function(){this.impl||this._flushAssembler()},i.onLoad=function(){t.prototype.onLoad.call(this),this.model=fL.root.createModel(SI),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&&(fL.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=IE.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=_f.gfxDevice,i=e.createBuffer(new Ml(Mc.VERTEX|Mc.TRANSFER_DST,Bc.DEVICE,65535*DG,DG)),n=e.createBuffer(new Ml(Mc.INDEX|Mc.TRANSFER_DST,Bc.DEVICE,131070*Uint16Array.BYTES_PER_ELEMENT,Uint16Array.BYTES_PER_ELEMENT)),r=new _w([i],xG,il.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*NG);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 bF(pF.DYNAMIC)},n(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:"graphicsNativeProxy",get:function(){return this._graphicsNativeProxy}}]),e}(uU)).LineJoin=xk,iG.LineCap=Ok,d((qk=iG).prototype,"lineJoin",[jk],Object.getOwnPropertyDescriptor(qk.prototype,"lineJoin"),qk.prototype),d(qk.prototype,"lineCap",[Yk],Object.getOwnPropertyDescriptor(qk.prototype,"lineCap"),qk.prototype),d(qk.prototype,"color",[aa],Object.getOwnPropertyDescriptor(qk.prototype,"color"),qk.prototype),Qk=gs(qk.prototype,"_lineWidth",[Ls],(function(){return 1})),Zk=gs(qk.prototype,"_strokeColor",[Ls],(function(){return qi.BLACK.clone()})),Jk=gs(qk.prototype,"_lineJoin",[Ls],(function(){return xk.MITER})),$k=gs(qk.prototype,"_lineCap",[Ls],(function(){return Ok.BUTT})),tG=gs(qk.prototype,"_fillColor",[Ls],(function(){return qi.WHITE.clone()})),eG=gs(qk.prototype,"_miterLimit",[Ls],(function(){return 10})),Kk=qk))||Kk)||Kk);t({Graphics:MG,GraphicsComponent:MG}),g.Graphics=MG,function(t){t[t.SIMPLE=0]="SIMPLE",t[t.SLICED=1]="SLICED",t[t.TILED=2]="TILED",t[t.FILLED=3]="FILLED"}(AG||(AG={})),me(AG),function(t){t[t.HORIZONTAL=0]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL",t[t.RADIAL=2]="RADIAL"}(RG||(RG={})),me(RG),function(t){t[t.CUSTOM=0]="CUSTOM",t[t.TRIMMED=1]="TRIMMED",t[t.RAW=2]="RAW"}(CG||(CG={})),me(CG),function(t){t.SPRITE_FRAME_CHANGED="spriteframe-changed"}(bG||(bG={}));var PG,LG,BG,FG,UG,kG,GG,HG,zG,VG,WG=(nG=bs("cc.Sprite"),rG=ws(110),sG=sa(sB),aG=sa(nB),oG=sa(AG),hG=sa(RG),uG=sa(CG),nG(cG=rG(((SG=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)._spriteFrame=_G&&_G(),e._type=fG&&fG(),e._fillType=dG&&dG(),e._sizeMode=pG&&pG(),e._fillCenter=mG&&mG(),e._fillStart=gG&&gG(),e._fillRange=vG&&vG(),e._isTrimmedMode=yG&&yG(),e._useGrayscale=EG&&EG(),e._atlas=TG&&TG(),e}s(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===AG.SLICED&&e.on(nB.EVENT_UV_UPDATED,this._updateUVs,this))},i.onDisable=function(){t.prototype.onDisable.call(this),this._spriteFrame&&this._type===AG.SLICED&&this._spriteFrame.off(nB.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 yd){var n=t.getPixelFormat();i=n===Yf.RGBA_ETC1||n===Yf.RGB_A_PVRTC_4BPPV1||n===Yf.RGB_A_PVRTC_2BPPV1}i&&this.grayscale?this._instanceMaterialType=rU.USE_ALPHA_SEPARATED_AND_GRAY:i?this._instanceMaterialType=rU.USE_ALPHA_SEPARATED:this.grayscale?this._instanceMaterialType=rU.GRAYSCALE:this._instanceMaterialType=rU.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 hI){var i=r({SAMPLE_FROM_RT:!0},e.passes[0].defines),n=new ZE;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===AG.SLICED?this._spriteFrame.on(nB.EVENT_UV_UPDATED,this._updateUVs,this):this._spriteFrame.off(nB.EVENT_UV_UPDATED,this._updateUVs,this))},i._applySpriteSize=function(){if(this._spriteFrame)if(CG.RAW===this._sizeMode){var t=this._spriteFrame.originalSize;this.node._uiProps.uiTransformComp.setContentSize(t)}else if(CG.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===AG.SLICED&&t.off(nB.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===AG.SLICED&&e.on(nB.EVENT_UV_UPDATED,this._updateUVs,this))},n(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===RG.RADIAL||this._fillType===RG.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===AG.FILLED&&this.renderData&&this.markForUpdateRenderData()}},{key:"fillStart",get:function(){return this._fillStart},set:function(t){this._fillStart=Ti(t,0,1),this._type===AG.FILLED&&this.renderData&&(this.markForUpdateRenderData(),this._updateUVs())}},{key:"fillRange",get:function(){return this._fillRange},set:function(t){this._fillRange=Ti(t,-1,1),this._type===AG.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===AG.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!==CG.CUSTOM&&this._applySpriteSize())}}]),e}(uU)).FillType=RG,SG.Type=AG,SG.SizeMode=CG,SG.EventType=bG,d((lG=SG).prototype,"spriteAtlas",[sG],Object.getOwnPropertyDescriptor(lG.prototype,"spriteAtlas"),lG.prototype),d(lG.prototype,"spriteFrame",[aG],Object.getOwnPropertyDescriptor(lG.prototype,"spriteFrame"),lG.prototype),d(lG.prototype,"type",[oG],Object.getOwnPropertyDescriptor(lG.prototype,"type"),lG.prototype),d(lG.prototype,"fillType",[hG],Object.getOwnPropertyDescriptor(lG.prototype,"fillType"),lG.prototype),d(lG.prototype,"sizeMode",[uG],Object.getOwnPropertyDescriptor(lG.prototype,"sizeMode"),lG.prototype),_G=gs(lG.prototype,"_spriteFrame",[Ls],(function(){return null})),fG=gs(lG.prototype,"_type",[Ls],(function(){return AG.SIMPLE})),dG=gs(lG.prototype,"_fillType",[Ls],(function(){return RG.HORIZONTAL})),pG=gs(lG.prototype,"_sizeMode",[Ls],(function(){return CG.TRIMMED})),mG=gs(lG.prototype,"_fillCenter",[Ls],(function(){return new pn(0,0)})),gG=gs(lG.prototype,"_fillStart",[Ls],(function(){return 0})),vG=gs(lG.prototype,"_fillRange",[Ls],(function(){return 0})),yG=gs(lG.prototype,"_isTrimmedMode",[Ls],(function(){return!0})),EG=gs(lG.prototype,"_useGrayscale",[Ls],(function(){return!1})),TG=gs(lG.prototype,"_atlas",[Ls],(function(){return null})),cG=lG))||cG)||cG);t({Sprite:WG,SpriteComponent:WG}),g.Sprite=WG;var XG,jG=new cn,YG=new pn,KG=new cn,qG=[];!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"}(XG||(XG={})),me(XG);var QG=(PG=bs("cc.Mask"),LG=ws(110),BG=sa(XG),PG(FG=LG(((VG=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)._type=kG&&kG(),e._inverted=GG&&GG(),e._segments=HG&&HG(),e._alphaThreshold=zG&&zG(),e._sprite=null,e._graphics=null,e._stencilStage=hF.DISABLED,e}s(e,t);var i=e.prototype;return i.onLoad=function(){this._changeRenderType()},i.onEnable=function(){this._changeRenderType(),this._updateGraphics(),this._enableRender(),this.node.on(Xp.ANCHOR_CHANGED,this._nodeStateChange,this),this.node.on(Xp.SIZE_CHANGED,this._nodeStateChange,this)},i.onRestore=function(){this._changeRenderType(),this._updateGraphics()},i.onDisable=function(){this._disableRender(),this.node.off(Xp.ANCHOR_CHANGED,this._nodeStateChange,this),this.node.off(Xp.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=YG;this.node.getWorldMatrix(jG),cn.invert(KG,jG),pn.transformMat4(s,t,KG);var a=e.anchorPoint;s.x+=a.x*n,s.y+=a.y*r;var o=!1;if(this.type===XG.GRAPHICS_RECT||this.type===XG.GRAPHICS_STENCIL||this.type===XG.SPRITE_STENCIL)o=s.x>=0&&s.y>=0&&s.x<=n&&s.y<=r;else if(this.type===XG.GRAPHICS_ELLIPSE){var h=n/2,u=r/2,c=s.x-.5*n,l=s.y-.5*r;o=c*c/(h*h)+l*l/(u*u)<1}return this._inverted&&(o=!o),o},i._nodeStateChange=function(){this._updateGraphics()},i._changeRenderType=function(){this._type!==XG.SPRITE_STENCIL?this._createGraphics():this._createSprite()},i._createSprite=function(){if(!this._sprite){var t=this._sprite=this.node.getComponent(WG);if(!t){var e=this.node;t=this._sprite=e.addComponent(WG)}t.color=qi.WHITE.clone(),t.sizeMode=0}this._sprite.stencilStage=this.inverted?hF.ENTER_LEVEL_INVERTED:hF.ENTER_LEVEL,this._sprite.updateMaterial()},i._createGraphics=function(){if(!this._graphics){var t=this._graphics=this.node.getComponent(MG);if(!t){var e=this.node;t=this._graphics=e.addComponent(MG)}t.lineWidth=1;var i=qi.WHITE.clone();i.a=0,t.fillColor=i}this._graphics.stencilStage=this.inverted?hF.ENTER_LEVEL_INVERTED:hF.ENTER_LEVEL},i._updateGraphics=function(){if(this._graphics&&(this._type===XG.GRAPHICS_RECT||this._type===XG.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===XG.GRAPHICS_RECT)e.rect(a,o,n,r);else if(this._type===XG.GRAPHICS_ELLIPSE){for(var h=function(t,e,i){qG.length=0;for(var n=2*Math.PI/i,r=0;r<i;++r)qG.push(new Wi(e.x*Math.cos(n*r)+t.x,e.y*Math.sin(n*r)+t.y,0));return qG}(new Wi(a+n/2,o+r/2,0),new Wi(n/2,r/2,0),this._segments),u=0;u<h.length;++u){var c=h[u];0===u?e.moveTo(c.x,c.y):e.lineTo(c.x,c.y)}e.close()}e.fill()}},i._enableRender=function(){this.subComp&&(this.subComp.enabled=!0)},i._disableRender=function(){this.subComp&&(this.subComp.stencilStage=hF.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.getSharedMaterial(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},n(e,[{key:"type",get:function(){return this._type},set:function(t){this._type!==t&&(this._type=t,this._type!==XG.SPRITE_STENCIL?(this._sprite&&(this.node.removeComponent(WG),this._sprite._destroyImmediate(),this._sprite=null),this._changeRenderType(),this._updateGraphics()):(this._graphics&&(this._graphics.clear(),this.node.removeComponent(MG),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?hF.ENTER_LEVEL_INVERTED:hF.ENTER_LEVEL}},{key:"segments",get:function(){return this._segments},set:function(t){this._segments!==t&&(this._segments=Ti(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===XG.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}(Wd)).Type=XG,d((UG=VG).prototype,"type",[BG],Object.getOwnPropertyDescriptor(UG.prototype,"type"),UG.prototype),kG=gs(UG.prototype,"_type",[Ls],(function(){return XG.GRAPHICS_RECT})),GG=gs(UG.prototype,"_inverted",[Ls],(function(){return!1})),HG=gs(UG.prototype,"_segments",[Ls],(function(){return 64})),zG=gs(UG.prototype,"_alphaThreshold",[Ls],(function(){return.1})),FG=UG))||FG)||FG);t({Mask:QG,MaskComponent:QG}),nP._maskComp=QG,g.Mask=QG;var ZG,JG,$G,tH,eH,iH,nH,rH,sH,aH,oH=/^(click)(\s)*=|(param)(\s)*=/,hH=/(\s)*src(\s)*=|(\s)*height(\s)*=|(\s)*width(\s)*=|(\s)*align(\s)*=|(\s)*offset(\s)*=|(\s)*click(\s)*=|(\s)*param(\s)*=/,uH=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 h;i=hH.exec(t);for(var u=!1;i;){var c=(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(c).trim(),o="src"===n?this.getRightQuotationIndex(a):-1,h=(r=a.indexOf(" ",o+1>=a.length?-1:o+1))>-1?a.substr(0,r):a,t=a.substring(r).trim(),h.endsWith("/")&&(h=h.slice(0,-1)),"src"===n){switch(h.charCodeAt(0)){case 34:case 39:u=!0,h=h.slice(1,-1)}e.isImage=!0,e.src=h}else if("height"===n)e.imageHeight=parseInt(h);else if("width"===n)e.imageWidth=parseInt(h);else if("align"===n){switch(h.charCodeAt(0)){case 34:case 39:h=h.slice(1,-1)}e.imageAlign=h.toLowerCase()}else"offset"===n?e.imageOffset=h:"click"===n&&(e.event=this._processEventHandler(n+"="+h));e.event&&"param"===n&&(e.event[n]=h.replace(/^"|"$/g,"")),i=hH.exec(t)}return u&&e.isImage&&this._resultObjectArray.push({text:"",style:e}),{}}if(i=/^(outline(\s)*[^>]*)/.exec(t)){var l={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?l.color=_:"width"===n&&(l.width=parseInt(_)),e.event&&"param"===n&&(e.event[n]=_.replace(/^"|"$/g,"")),i=f.exec(t)}e.outline=l}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=oH.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=oH.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=f(this._specialSymbolArray);!(e=i()).done;){var n=e.value,r=n[0],s=n[1];t=t.replace(r,s)}return t},t}()),cH=bs("cc.LabelOutline")(ZG=ws(110)(ZG=Is(XU)((JG=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)._color=$G&&$G(),e._width=tH&&tH(),e}s(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(XU);t&&t.updateRenderData(!0)},n(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}(Wd),$G=gs(JG.prototype,"_color",[Ls],(function(){return new qi(0,0,0,255)})),tH=gs(JG.prototype,"_width",[Ls],(function(){return 2})),ZG=JG))||ZG)||ZG)||ZG;t({LabelOutline:cH,LabelOutlineComponent:cH}),g.LabelOutline=cH,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:!1}});var lH,_H,fH,dH,pH,mH,gH,vH,yH,EH,TH,SH,AH,RH,CH,bH,IH,wH,OH,xH,NH,DH,MH,PH,LH,BH,FH,UH,kH,GH,HH,zH,VH,WH,XH,jH,YH=bs("cc.PostProcess")(eH=Os(((aH=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).global=nH&&nH(),e._shadingScale=rH&&rH(),e.enableShadingScaleInEditor=sH&&sH(),e.settings=new Map,e}s(e,t);var i=e.prototype;return i.addSetting=function(t){this.settings.set(t.constructor,t)},i.removeSetting=function(t){this.settings.delete(t.constructor)},i.getSetting=function(t){return this.settings.get(t)},i.onEnable=function(){e.all.push(this)},i.onDisable=function(){var t=e.all.indexOf(this);-1!==t&&e.all.splice(t,1)},n(e,[{key:"shadingScale",get:function(){return this._shadingScale},set:function(t){this._shadingScale=t}}]),e}(Wd)).all=[],nH=gs((iH=aH).prototype,"global",[xs],(function(){return!0})),rH=gs(iH.prototype,"_shadingScale",[xs],(function(){return 1})),d(iH.prototype,"shadingScale",[xs],Object.getOwnPropertyDescriptor(iH.prototype,"shadingScale"),iH.prototype),sH=gs(iH.prototype,"enableShadingScaleInEditor",[xs],(function(){return!1})),eH=iH))||eH)||eH,KH=new Wi,qH=fe(wb),QH=fe(Ib),ZH=fe(Ob),JH=fe(Nb),$H=fe(xb),tz=fe({SKYBOX:zb|_l.DEPTH_STENCIL,SOLID_COLOR:_l.ALL,DEPTH_ONLY:_l.DEPTH_STENCIL,DONT_CLEAR:_l.NONE}),ez=(lH=bs("cc.Camera"),_H=sa(Hp.BitMask),fH=sa(tz),dH=sa(qH),pH=sa(QH),mH=sa(ZH),gH=sa(JH),vH=sa($H),yH=sa(hI),EH=sa(YH),lH(((XH=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)._projection=AH&&AH(),e._priority=RH&&RH(),e._fov=CH&&CH(),e._fovAxis=bH&&bH(),e._orthoHeight=IH&&IH(),e._near=wH&&wH(),e._far=OH&&OH(),e._color=xH&&xH(),e._depth=NH&&NH(),e._stencil=DH&&DH(),e._clearFlags=MH&&MH(),e._rect=PH&&PH(),e._aperture=LH&&LH(),e._shutter=BH&&BH(),e._iso=FH&&FH(),e._screenScale=UH&&UH(),e._visibility=kH&&kH(),e._targetTexture=GH&&GH(),e._postProcess=HH&&HH(),e._usePostProcess=zH&&zH(),e._camera=null,e._inEditorMode=!1,e._flows=void 0,e._cameraType=VH&&VH(),e._trackingType=WH&&WH(),e}s(e,t);var i=e.prototype;return i.onLoad=function(){this._createCamera()},i.onEnable=function(){this.node.hasChangedFlags|=Vp.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=kn.create()),this._camera&&this._camera.screenPointToRay(i,t,e),i},i.worldToScreen=function(t,e){return e||(e=new Wi),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 Wi),!this._camera)return i;this.worldToScreen(t,KH);var n=e.getComponent("cc.UITransform"),r=g.view.getVisibleSize(),s=KH.x-.5*this._camera.width,a=KH.y-.5*this._camera.height;return KH.x=s/g.view.getScaleX()+.5*r.width,KH.y=a/g.view.getScaleY()+.5*r.height,n&&n.convertToNodeSpaceAR(KH,i),i},i._createCamera=function(){this._camera||(this._camera=g.director.root.createCamera(),this._camera.initialize({name:this.node.name,node:this.node,projection:this._projection,window:this._inEditorMode?g.director.root&&g.director.root.mainWindow:g.director.root&&g.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=Ri(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._camera.postProcess=this._postProcess,this._camera.usePostProcess=this._usePostProcess),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)}},n(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===Ib.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=Ri(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:"usePostProcess",get:function(){return this._usePostProcess},set:function(t){this._usePostProcess=t,this._camera&&(this._camera.usePostProcess=t)}},{key:"postProcess",get:function(){return this._postProcess},set:function(t){this._postProcess=t,this._camera&&(this._camera.postProcess=t)}},{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?g.director.root&&g.director.root.mainWindow:g.director.root&&g.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}(Wd)).ProjectionType=qH,XH.FOVAxis=QH,XH.ClearFlag=tz,XH.Aperture=ZH,XH.Shutter=JH,XH.ISO=$H,XH.TARGET_TEXTURE_CHANGE="tex-change",AH=gs((SH=XH).prototype,"_projection",[Ls],(function(){return qH.PERSPECTIVE})),RH=gs(SH.prototype,"_priority",[Ls],(function(){return 0})),CH=gs(SH.prototype,"_fov",[Ls],(function(){return 45})),bH=gs(SH.prototype,"_fovAxis",[Ls],(function(){return QH.VERTICAL})),IH=gs(SH.prototype,"_orthoHeight",[Ls],(function(){return 10})),wH=gs(SH.prototype,"_near",[Ls],(function(){return 1})),OH=gs(SH.prototype,"_far",[Ls],(function(){return 1e3})),xH=gs(SH.prototype,"_color",[Ls],(function(){return new qi("#333333")})),NH=gs(SH.prototype,"_depth",[Ls],(function(){return 1})),DH=gs(SH.prototype,"_stencil",[Ls],(function(){return 0})),MH=gs(SH.prototype,"_clearFlags",[Ls],(function(){return tz.SOLID_COLOR})),PH=gs(SH.prototype,"_rect",[Ls],(function(){return new En(0,0,1,1)})),LH=gs(SH.prototype,"_aperture",[Ls],(function(){return ZH.F16_0})),BH=gs(SH.prototype,"_shutter",[Ls],(function(){return JH.D125})),FH=gs(SH.prototype,"_iso",[Ls],(function(){return $H.ISO100})),UH=gs(SH.prototype,"_screenScale",[Ls],(function(){return 1})),kH=gs(SH.prototype,"_visibility",[Ls],(function(){return yv})),GH=gs(SH.prototype,"_targetTexture",[Ls],(function(){return null})),HH=gs(SH.prototype,"_postProcess",[Ls],(function(){return null})),zH=gs(SH.prototype,"_usePostProcess",[Ls],(function(){return!1})),VH=gs(SH.prototype,"_cameraType",[Ls],(function(){return Db.DEFAULT})),WH=gs(SH.prototype,"_trackingType",[Ls],(function(){return Mb.NO_TRACKING})),d(SH.prototype,"visibility",[_H],Object.getOwnPropertyDescriptor(SH.prototype,"visibility"),SH.prototype),d(SH.prototype,"clearFlags",[fH],Object.getOwnPropertyDescriptor(SH.prototype,"clearFlags"),SH.prototype),d(SH.prototype,"projection",[dH],Object.getOwnPropertyDescriptor(SH.prototype,"projection"),SH.prototype),d(SH.prototype,"fovAxis",[pH],Object.getOwnPropertyDescriptor(SH.prototype,"fovAxis"),SH.prototype),d(SH.prototype,"aperture",[mH],Object.getOwnPropertyDescriptor(SH.prototype,"aperture"),SH.prototype),d(SH.prototype,"shutter",[gH],Object.getOwnPropertyDescriptor(SH.prototype,"shutter"),SH.prototype),d(SH.prototype,"iso",[vH],Object.getOwnPropertyDescriptor(SH.prototype,"iso"),SH.prototype),d(SH.prototype,"targetTexture",[yH],Object.getOwnPropertyDescriptor(SH.prototype,"targetTexture"),SH.prototype),d(SH.prototype,"usePostProcess",[xs],Object.getOwnPropertyDescriptor(SH.prototype,"usePostProcess"),SH.prototype),d(SH.prototype,"postProcess",[EH],Object.getOwnPropertyDescriptor(SH.prototype,"postProcess"),SH.prototype),TH=SH))||TH);t({Camera:ez,CameraComponent:ez}),g.Camera=ez;var iz=new vn,nz=((jH={})[Te.ORIENTATION_AUTO]=gu.AUTO,jH[Te.ORIENTATION_LANDSCAPE]=gu.LANDSCAPE,jH[Te.ORIENTATION_PORTRAIT]=gu.PORTRAIT,jH),rz=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=sz,n=az;return e._designResolutionSize=new vn(0,0),e._scaleX=1,e._scaleY=1,e._viewportRect=new En(0,0,0,0),e._visibleRect=new En(0,0,0,0),e._autoFullScreen=!1,e._retinaEnabled=!1,e._resizeCallback=null,e._rpExactFit=new oz(i.EQUAL_TO_FRAME,n.EXACT_FIT),e._rpShowAll=new oz(i.EQUAL_TO_FRAME,n.SHOW_ALL),e._rpNoBorder=new oz(i.EQUAL_TO_FRAME,n.NO_BORDER),e._rpFixedHeight=new oz(i.EQUAL_TO_FRAME,n.FIXED_HEIGHT),e._rpFixedWidth=new oz(i.EQUAL_TO_FRAME,n.FIXED_WIDTH),e._resolutionPolicy=e._rpShowAll,e}s(e,t);var i=e.prototype;return i.init=function(){var t=fc.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,iz.width=this._visibleRect.width,iz.height=this._visibleRect.height,pc&&pc.init(this._visibleRect),this.resizeWithBrowserSize(!0);var n=Ee.querySettings(ye.Category.SCREEN,"designResolution");n&&this.setDesignResolutionSize(Number(n.width),Number(n.height),n.policy||oz.FIXED_HEIGHT),fc.on("window-resize",this._updateAdaptResult,this),fc.on("orientation-change",this._updateAdaptResult,this),fc.on("fullscreen-change",this._updateAdaptResult,this)},i.resizeWithBrowserSize=function(t){lc.handleResizeEvent=t},i.setResizeCallback=function(t){"function"!=typeof t&&null!=t||(this._resizeCallback=t)},i.setOrientation=function(t){lc.orientation=nz[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&&fc.requestFullScreen().catch((function(){})))},i.isAutoFullScreenEnabled=function(){return this._autoFullScreen},i.setCanvasSize=function(t,e){lc.resolutionScale=1;var i=lc.devicePixelRatio,n=new vn(t*i,e*i);fc.windowSize=n},i.getCanvasSize=function(){return fc.windowSize},i.getFrameSize=function(){var t=lc.devicePixelRatio,e=fc.windowSize;return e.width/=t,e.height/=t,e},i.setFrameSize=function(t,e){var i=lc.devicePixelRatio;fc.windowSize=new vn(t*i,e*i)},i.getVisibleSize=function(){return new vn(this._visibleRect.width,this._visibleRect.height)},i.getVisibleSizeInPixel=function(){return new vn(this._visibleRect.width*this._scaleX,this._visibleRect.height*this._scaleY)},i.getVisibleOrigin=function(){return new pn(this._visibleRect.x,this._visibleRect.y)},i.getVisibleOriginInPixel=function(){return new pn(this._visibleRect.x*this._scaleX,this._visibleRect.y*this._scaleY)},i.getResolutionPolicy=function(){return this._resolutionPolicy},i._updateResolutionPolicy=function(t){if(t instanceof oz)this._resolutionPolicy=t;else{var e=oz;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=uz.getDesignResolutionSize();uz.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),iz.width=this._visibleRect.width,iz.height=this._visibleRect.height,pc&&pc.init(this._visibleRect),this.emit("design-resolution-changed")}else K(2200)},i.getDesignResolutionSize=function(){return new vn(this._designResolutionSize.width,this._designResolutionSize.height)},i.setRealPixelResolution=function(t,e,i){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 lc.devicePixelRatio},i.convertToLocationInView=function(t,e,i,n){void 0===n&&(n=new pn);var r=lc.devicePixelRatio*(t-i.left),s=lc.devicePixelRatio*(i.top+i.height-e);return lc.isFrameRotated?(n.x=fc.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(t,e,i){var n;g.director.root.resize(t,e,void 0===i||0===i?1:i);var r=this._designResolutionSize.width,s=this._designResolutionSize.height;t>0&&this.setDesignResolutionSize(r,s,this._resolutionPolicy),this.emit("canvas-resize"),null===(n=this._resizeCallback)||void 0===n||n.call(this)},e}(Fu(cu)));rz.instance=void 0;var sz=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=g.game.canvas;if(t){var e=fc.windowSize;t.width!==e.width&&(t.width=e.width),t.height!==e.height&&(t.height=e.height)}},t}();sz.EQUAL_TO_FRAME=void 0,sz.PROPORTION_TO_FRAME=void 0;var az=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 En(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}();az.EXACT_FIT=void 0,az.SHOW_ALL=void 0,az.NO_BORDER=void 0,az.FIXED_HEIGHT=void 0,az.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 s(e,t),e.prototype.apply=function(){lc.isProportionalToFrame=!1,this._setupCanvas()},e}(sz),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 s(e,t),e.prototype.apply=function(){lc.isProportionalToFrame=!0,this._setupCanvas()},e}(sz);sz.EQUAL_TO_FRAME=new t,sz.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 s(e,t),e.prototype.apply=function(t,e){var i=fc.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}(az),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 s(e,t),e.prototype.apply=function(t,e){var i,n,r=fc.windowSize,s=r.width,a=r.height,o=e.width,h=e.height,u=s/o,c=a/h,l=0;return u<c?(i=s,n=h*(l=u)):(i=o*(l=c),n=a),this._buildResult(s,a,i,n,l,l)},e}(az),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 s(e,t),e.prototype.apply=function(t,e){var i,n,r,s=fc.windowSize,a=s.width,o=s.height,h=e.width,u=e.height,c=a/h,l=o/u;return c<l?(n=h*(i=l),r=o):(n=a,r=u*(i=c)),this._buildResult(a,o,n,r,i,i)},e}(az),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="FixedHeight",e}return s(e,t),e.prototype.apply=function(t,e){var i=fc.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}(az),o=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 s(e,t),e.prototype.apply=function(t,e){var i=fc.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}(az);az.EXACT_FIT=new i,az.SHOW_ALL=new n,az.NO_BORDER=new r,az.FIXED_HEIGHT=new a,az.FIXED_WIDTH=new o}();var oz=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 sz&&(this._containerStrategy=t)},e.setContentStrategy=function(t){t instanceof az&&(this._contentStrategy=t)},n(t,[{key:"canvasSize",get:function(){return fc.windowSize}}]),t}());oz.EXACT_FIT=0,oz.NO_BORDER=1,oz.SHOW_ALL=2,oz.FIXED_HEIGHT=3,oz.FIXED_WIDTH=4,oz.UNKNOWN=5,oz.ContainerStrategy=sz,oz.ContentStrategy=az,g.ResolutionPolicy=oz;var hz,uz=t("view",rz.instance=g.view=new rz);fL.registerSystem("view",uz,0),g.winSize=iz;var cz,lz,_z,fz,dz,pz,mz,gz,vz,yz=t("RenderRoot2D",bs("cc.RenderRoot2D")(hz=ws(100)(hz=Is(XF)(hz=Os(hz=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.onEnable=function(){g.director.root.batcher2D.addScreen(this)},i.onDisable=function(){g.director.root.batcher2D.removeScreen(this)},i.onDestroy=function(){g.director.root.batcher2D.removeScreen(this)},e}(Wd))||hz)||hz)||hz)||hz),Ez=new Wi,Tz=fe({OVERLAY:0,INTERSPERSE:1}),Sz=(cz=bs("cc.Canvas"),lz=ws(100),_z=sa(ez),fz=sa(ez),cz(dz=lz(dz=Os((d((pz=function(t){function e(){var e;return(e=t.call(this)||this)._cameraComponent=mz&&mz(),e._alignCanvasWithScreen=gz&&gz(),e._thisOnCameraResized=void 0,e._fitDesignResolution=void 0,e._pos=new Wi,e._renderMode=Tz.OVERLAY,e._thisOnCameraResized=e._onResizeCamera.bind(l(e)),e}s(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(ez.TARGET_TEXTURE_CHANGE,this._thisOnCameraResized)),this._onResizeCamera(),this.node.on(Xp.TRANSFORM_CHANGED,this._thisOnCameraResized)},i.onEnable=function(){t.prototype.onEnable.call(this),this._cameraComponent&&this._cameraComponent.node.on(ez.TARGET_TEXTURE_CHANGE,this._thisOnCameraResized)},i.onDisable=function(){t.prototype.onDisable.call(this),this._cameraComponent&&this._cameraComponent.node.off(ez.TARGET_TEXTURE_CHANGE,this._thisOnCameraResized)},i.onDestroy=function(){t.prototype.onDestroy.call(this),this.node.off(Xp.TRANSFORM_CHANGED,this._thisOnCameraResized)},i._onResizeCamera=function(){if(this._cameraComponent&&this._alignCanvasWithScreen){if(this._cameraComponent.targetTexture)this._cameraComponent.orthoHeight=pc.height/2;else{var t=fc.windowSize;this._cameraComponent.orthoHeight=t.height/uz.getScaleY()/2}this.node.getWorldPosition(Ez),this._cameraComponent.node.setWorldPosition(Ez.x,Ez.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===Tz.OVERLAY?e|1<<30:e&~(1<<30)}return 0},n(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}(yz)).prototype,"cameraComponent",[_z],Object.getOwnPropertyDescriptor(pz.prototype,"cameraComponent"),pz.prototype),mz=gs(pz.prototype,"_cameraComponent",[fz],(function(){return null})),gz=gs(pz.prototype,"_alignCanvasWithScreen",[Ls],(function(){return!0})),dz=pz))||dz)||dz)||dz);function Az(t,e,i){var n=t.o,r=t.d,s=1/r.x,a=1/r.y,o=1/r.z,h=(e.x-n.x)*s,u=(i.x-n.x)*s,c=(e.y-n.y)*a,l=(i.y-n.y)*a,_=(e.z-n.z)*o,f=(i.z-n.z)*o,d=Math.max(Math.max(Math.min(h,u),Math.min(c,l)),Math.min(_,f)),p=Math.min(Math.min(Math.max(h,u),Math.max(c,l)),Math.max(_,f));return p<0||d>p?0:d>0?d:p}t({Canvas:Sz,CanvasComponent:Sz}),g.Canvas=Sz,nt(t("UIComponent",bs("cc.UIComponent")(vz=Is(XF)(vz=ws(110)(vz=Os(vz=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=hF.DISABLED,e}s(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}(Wd))||vz)||vz)||vz)||vz).prototype,"UIComponent",[{name:"_visibility"},{name:"setVisibility"}]),it(Sz.prototype,"Canvas.prototype",[{name:"camera",newName:"cameraComponent.camera",customGetter:function(){var t;return null===(t=this._cameraComponent)||void 0===t?void 0:t.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:qi.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}}]),rt(XF.prototype,"UITransform.prototype",[{name:"priority",suggest:"Please use setSiblingIndex to change index of the current node in its parent's children array."}]),g.UITransformComponent=XF,qt(XF,"cc.UITransformComponent"),qt(uU,"cc.RenderComponent"),g.CanvasComponent=Sz,qt(Sz,"cc.CanvasComponent"),g.internal.Renderable2D=uU,qt(uU,"cc.Renderable2D");var Rz,Cz,bz,Iz,wz,Oz,xz,Nz=(Rz=jr.create(),Cz={distance:1/0,doubleSided:!1,mode:Hh.ANY},bz=0,Iz=function(t,e,i,n,r,s){t===Hh.CLOSEST?(bz>e||0===bz)&&(bz=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))):(bz=e,s&&s.push({distance:e,vertexIndex0:i/3,vertexIndex1:n/3,vertexIndex2:r/3}))},function(t,e,i){if(bz=0,0===e.geometricInfo.positions.length)return bz;var n=void 0===i?Cz:i;if(Az(t,e.geometricInfo.boundingBox.min,e.geometricInfo.boundingBox.max)){var r=e.primitiveMode,s=e.geometricInfo;!function(t,e,i,n,r){if(i===il.TRIANGLE_LIST)for(var s=e.length,a=0;a<s;a+=3){var o=3*e[a],h=3*e[a+1],u=3*e[a+2];Wi.set(Rz.a,t[o],t[o+1],t[o+2]),Wi.set(Rz.b,t[h],t[h+1],t[h+2]),Wi.set(Rz.c,t[u],t[u+1],t[u+2]);var c=Gr.rayTriangle(n,Rz,r.doubleSided);if(!(0===c||c>r.distance)&&(Iz(r.mode,c,o,h,u,r.result),r.mode===Hh.ANY))return c}else if(i===il.TRIANGLE_STRIP)for(var l=e.length-2,_=0,f=0;f<l;f+=1){var d=3*e[f-_],p=3*e[f+_+1],m=3*e[f+2];Wi.set(Rz.a,t[d],t[d+1],t[d+2]),Wi.set(Rz.b,t[p],t[p+1],t[p+2]),Wi.set(Rz.c,t[m],t[m+1],t[m+2]),_=~_;var g=Gr.rayTriangle(n,Rz,r.doubleSided);if(!(0===g||g>r.distance)&&(Iz(r.mode,g,d,p,m,r.result),r.mode===Hh.ANY))return g}else if(i===il.TRIANGLE_FAN){var v=e.length-1,y=3*e[0];Wi.set(Rz.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];Wi.set(Rz.b,t[T],t[T+1],t[T+2]),Wi.set(Rz.c,t[S],t[S+1],t[S+2]);var A=Gr.rayTriangle(n,Rz,r.doubleSided);if(!(0===A||A>r.distance)&&(Iz(r.mode,A,y,T,S,r.result),r.mode===Hh.ANY))return A}}}(s.positions,s.indices,r,t,n)}return bz}),Dz=function(){var t=0,e={distance:1/0,doubleSided:!1,mode:Hh.ANY};return function(i,n,r){t=0;var s=void 0===r?e:r,a=n.renderingSubMeshes.length,o=n.struct.minPosition,h=n.struct.maxPosition;if(o&&h&&!Az(i,o,h))return t;for(var u=0;u<a;u++){var c=n.renderingSubMeshes[u],l=Nz(i,c,s);if(l)if(s.mode===Hh.CLOSEST)(0===t||t>l)&&(t=l,s.subIndices&&(s.subIndices[0]=u));else if(t=l,s.subIndices&&s.subIndices.push(u),s.mode===Hh.ANY)return l}return t&&s.mode===Hh.CLOSEST&&(s.result&&(s.result[0].distance=t,s.result.length=1),s.subIndices&&(s.subIndices.length=1)),t}}(),Mz=function(){var t=0,e={distance:1/0,doubleSided:!1,mode:Hh.ANY},i=new kn,n=new cn;return function(r,s,a){t=0;var o=void 0===a?e:a,h=s.worldBounds;if(h&&!Gr.rayAABB(r,h))return t;kn.copy(i,r),s.node&&(cn.invert(n,s.node.getWorldMatrix(n)),Wi.transformMat4(i.o,r.o,n),Wi.transformMat4Normal(i.d,r.d,n));for(var u=s.subModels,c=0;c<u.length;c++){var l=u[c].subMesh,_=Nz(i,l,o);if(_)if(o.mode===Hh.CLOSEST)(0===t||t>_)&&(t=_,o.subIndices&&(o.subIndices[0]=c));else if(t=_,o.subIndices&&o.subIndices.push(c),o.mode===Hh.ANY)return _}return t&&o.mode===Hh.CLOSEST&&(o.result&&(o.result[0].distance=t,o.result.length=1),o.subIndices&&(o.subIndices.length=1)),t}}();Gr.rayModel=Mz,Gr.raySubMesh=Nz,Gr.rayMesh=Dz,wE("specular-pass");var Pz,Lz,Bz,Fz,Uz,kz=bs("cc.ModelRenderer")((Oz=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)._visFlags=xz&&xz(),e._models=[],e._priority=0,e}s(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},n(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}(hU),xz=gs(Oz.prototype,"_visFlags",[Ls],(function(){return Hp.Enum.NONE})),wz=Oz))||wz;t({ModelRenderer:kz,RenderableComponent:kz});var Gz,Hz,zz,Vz,Wz,Xz,jz,Yz,Kz,qz,Qz,Zz,Jz=Ls,$z=sa;t("PrefabLink",(Pz=bs("cc.PrefabLink"),Lz=$z(eL),Pz((Fz=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).prefab=Uz&&Uz(),e}return s(e,t),e}(Wd),Uz=gs(Fz.prototype,"prefab",[Lz,Jz],(function(){return null})),Bz=Fz))||Bz)),it(ez,"Camera",[{name:"CameraClearFlag",newName:"ClearFlag"}]),it(ez.prototype,"Camera.prototype",[{name:"color",newName:"clearColor"},{name:"depth",newName:"clearDepth"},{name:"stencil",newName:"clearStencil"}]),rt(hU.prototype,"Renderer.prototype",[{name:"getMaterial",suggest:"please use renderer.getSharedMaterial instead."}]),g.CameraComponent=ez,qt(ez,"cc.CameraComponent"),g.RenderableComponent=kz,qt(kz,"cc.RenderableComponent"),function(t){t[t.SIMPLE=0]="SIMPLE",t[t.SLICED=1]="SLICED",t[t.TILED=2]="TILED"}(Zz||(Zz={})),t("SpriteRenderer",(Gz=bs("cc.SpriteRenderer"),Hz=ws(100),zz=sa(nB),Gz(Vz=Hz((d((Wz=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)._spriteFrame=Xz&&Xz(),e._mode=jz&&jz(),e._color=Yz&&Yz(),e._flipX=Kz&&Kz(),e._flipY=qz&&qz(),e._size=Qz&&Qz(),e._model=null,e}s(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(){t.prototype.onEnable.call(this),this._model||this._updateModels(),this._attachToScene()},i.onDisable=function(){this._model&&this._detachFromScene()},i.onDestroy=function(){this._model&&(g.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=g.director.root.createModel(SI);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|=Vp.POSITION,this._model.transform.hasChangedFlags|=Vp.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 IE.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=Ym.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)},n(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}(kz)).prototype,"spriteFrame",[zz],Object.getOwnPropertyDescriptor(Wz.prototype,"spriteFrame"),Wz.prototype),Xz=gs(Wz.prototype,"_spriteFrame",[Ls],(function(){return null})),jz=gs(Wz.prototype,"_mode",[Ls],(function(){return Zz.SIMPLE})),Yz=gs(Wz.prototype,"_color",[Ls],(function(){return qi.WHITE.clone()})),Kz=gs(Wz.prototype,"_flipX",[Ls],(function(){return!1})),qz=gs(Wz.prototype,"_flipY",[Ls],(function(){return!1})),Qz=gs(Wz.prototype,"_size",[Ls],(function(){return new pn})),Vz=Wz))||Vz)||Vz));var tV,eV,iV,nV,rV,sV,aV,oV,hV,uV,cV,lV,_V,fV,dV,pV,mV,gV,vV,yV,EV,TV,SV,AV=new uH,RV="RICHTEXT_CHILD",CV="RICHTEXT_Image_CHILD",bV=new pn,IV=new pn,wV=new ie((function(t){if(!g.isValid(t.node))return!1;var e=t.node.getComponent(cH);return e&&(e.width=0),!0}),20),OV=new ie((function(t){return g.isValid(t.node)}),10);function xV(t){return{node:new Lm(t),comp:null,lineCount:0,styleIndex:0,imageOffset:"",clickParam:"",clickHandler:"",type:t}}function NV(t,e){var i;t===RV?i=wV._get():t===CV&&(i=OV._get());var n=(i=i||xV(t)).node;return n||(n=new Lm(t)),n.hideFlags|=Ta.Flags.DontSave|Ta.Flags.HideInHierarchy,n.active=!0,t===CV?(i.comp=n.getComponent(WG)||n.addComponent(WG),i.comp.spriteFrame=e,i.comp.type=WG.Type.SLICED,i.comp.sizeMode=WG.SizeMode.CUSTOM):(i.comp=n.getComponent(XU)||n.addComponent(XU),i.comp.string=e,i.comp.horizontalAlign=FU.LEFT,i.comp.verticalAlign=UU.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 DV,MV=(tV=bs("cc.RichText"),eV=ws(110),iV=sa(FU),nV=sa(UU),rV=sa(uB),sV=sa(GU),aV=sa(sB),tV(oV=eV(((SV=function(t){function e(){var e;return(e=t.call(this)||this)._lineHeight=uV&&uV(),e._string=cV&&cV(),e._horizontalAlign=lV&&lV(),e._verticalAlign=_V&&_V(),e._fontSize=fV&&fV(),e._maxWidth=dV&&dV(),e._fontFamily=pV&&pV(),e._font=mV&&mV(),e._isSystemFontUsed=gV&&gV(),e._userDefinedFont=vV&&vV(),e._cacheMode=yV&&yV(),e._imageAtlas=EV&&EV(),e._handleTouchEvent=TV&&TV(),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}s(e,t);var i=e.prototype;return i.onLoad=function(){this.node.on(Xp.LAYER_CHANGED,this._applyLayer,this),this.node.on(Xp.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=f(this._segments);!(t=e()).done;){var i=t.value;i.node.removeFromParent(),i.type===RV?wV.put(i):i.type===CV&&OV.put(i)}this.node.off(Xp.ANCHOR_CHANGED,this._updateRichTextPosition,this),this.node.off(Xp.LAYER_CHANGED,this._applyLayer,this)},i._addEventListeners=function(){this.node.on(Xp.TOUCH_END,this._onTouchEnded,this)},i._removeEventListeners=function(){this.node.off(Xp.TOUCH_END,this._onTouchEnded,this)},i._updateLabelSegmentTextAttributes=function(){var t=this;this._segments.forEach((function(e){t._applyTextAttribute(e)}))},i._createFontLabel=function(t){return NV(RV,t)},i._createImage=function(t){return NV(CV,t)},i._onTTFLoaded=function(){this._font,this._layoutDirty=!0,this._updateRichText()},i.splitLongStringApproximatelyIn2048=function(t,e){var i=[];if(t.length*this.fontSize<=1638.4)return i.push(t),i;if(this._calculateSize(bV,e,t),bV.x<2048)i.push(t);else for(var n=t.split("\n"),r=0;r<n.length;r++)if(this._calculateSize(bV,e,n[r]),bV.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){var i=[],n=t,r=0,s=n.length/2,a=n.substring(r,s),o=n.substring(s),h=this._calculateSize(bV,e,a),u=this._calculateSize(IV,e,o),c=this._maxWidth;0===this._maxWidth&&(c=2047.9);for(var l=1*c;h.x>l;){if((s/=2)<1){s*=2;break}a=a.substring(r,s),o=n.substring(s),this._calculateSize(h,e,a)}for(var _=1e3,f=1;_&&r<t.length;){for(;_&&h.x<l;){var d=UB(o);d&&d.length>0&&(f=d[0].length),s+=f,a=n.substring(r,s),o=n.substring(s),this._calculateSize(h,e,a),_--}for(;_&&a.length>=2&&h.x>l;)s-=f,a=n.substring(r,s),this._calculateSize(h,e,a),f=1,_--;if(a.length>=2){var p=kB(a);p&&p.length>0&&a!==p[0]&&(s-=p[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),this._calculateSize(u,e,o),this._calculateSize(h,e,a),_--,u.x<2048&&h.x<l){i.push(a),r=t.length,s=t.length,a=o,""!==o&&i.push(a);break}}return i},i._measureText=function(t,e){var i=this,n=function(e){return i._calculateSize(bV,t,e).x};return e?n(e):n},i._calculateSize=function(t,e,i){var n;0===this._labelSegmentsCache.length?(n=this._createFontLabel(i),this._labelSegmentsCache.push(n)):(n=this._labelSegmentsCache[0]).node.getComponent(XU).string=i,n.styleIndex=e,this._applyTextAttribute(n);var r=n.node._uiProps.uiTransformComp.contentSize;return pn.set(t,r.x,r.y),t},i._onTouchEnded=function(t){for(var e,i=this,n=this.node.getComponents(Wd),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=f(this._segments);!(e=s()).done;)r()},i._containsTouchLocation=function(t,e){var i=t.node.getComponent(XF);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===RV||i.name===CV){i.parent=null;var n=xV(i.name);n.node=i,i.name===RV?(n.comp=i.getComponent(XU),wV.put(n)):(n.comp=i.getComponent(WG),OV.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!==RV&&i.name!==CV||(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(XU);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 h=t.substr(0,r);this._addLabelSegment(h,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 u=GB(t,n,this._maxWidth,this._measureText(i)),c=0;c<u.length;++c){var l=u[c],_=this._addLabelSegment(l,i).node._uiProps.uiTransformComp.contentSize;this._lineOffsetX+=_.width,u.length>1&&c<u.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,h=s.height,u=e.imageWidth||0,c=e.imageHeight||0;c>0?(o*=a=c/h,h*=a):(o*=a=this._lineHeight/h,h*=a),u>0&&(o=u),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,h),r.lineCount=this._lineCount,r.clickHandler="",r.clickParam="";var l=e.event;l&&(r.clickHandler=l.click,r.clickParam=l.param)}else j(4400)}},i._updateRichText=function(){if(this.enabledInHierarchy){var t=AV.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 h=a[o];if(""!==h)if(i=!1,this._maxWidth>0){var u=this._measureText(n,h);this._updateRichTextWithMaxWidth(h,u,n),a.length>1&&o<a.length-1&&this._updateLineInfo()}else e=this._addLabelSegment(h,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+RB)*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(PB(n)||LB(n))return 1;for(var r=1,s=e+1;s<i&&!LB(n=t.charAt(s))&&!PB(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],h=o.lineCount;h>e&&(t=0,e=h);var u=this._labelWidth*(.5*this._horizontalAlign-r);switch(this._horizontalAlign){case FU.LEFT:break;case FU.CENTER:u-=this._linesWidth[h-1]/2;break;case FU.RIGHT:u-=this._linesWidth[h-1]}var c=o.node.position;if(o.node.setPosition(t+u,this._lineHeight*(i-h)-this._labelHeight*s,c.z),h===e&&(t+=o.node._uiProps.uiTransformComp.width),o.node.getComponent(WG)){var l=o.node.position.clone(),_=this._lineHeight,f=this._lineHeight*(1+RB);switch(o.node._uiProps.uiTransformComp.anchorY){case 1:l.y+=_+(f-_)/2;break;case.5:l.y+=f/2;break;default:l.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)&&(l.y+=p)}else if(2===d.length){var m=parseFloat(d[0]),g=parseFloat(d[1]);Number.isInteger(m)&&(l.x+=m),Number.isInteger(g)&&(l.y+=g)}}o.node.position=l}var v=o.node.getComponent(cH);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 qi[e]?qi[e]:(new qi).fromHEX(t)},i._applyTextAttribute=function(t){var e=t.node.getComponent(XU);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(cH);r||(r=t.node.addComponent(cH)),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 uB&&!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=f(this._segments);!(t=e()).done;)t.value.node.layer=this.node.layer},i._resetLabelState=function(t){t.fontSize=this._fontSize,t.color=qi.WHITE,t.isBold=!1,t.isItalic=!1,t.isUnderline=!1},n(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}(Wd)).HorizontalAlign=FU,SV.VerticalAlign=UU,d((hV=SV).prototype,"horizontalAlign",[iV],Object.getOwnPropertyDescriptor(hV.prototype,"horizontalAlign"),hV.prototype),d(hV.prototype,"verticalAlign",[nV],Object.getOwnPropertyDescriptor(hV.prototype,"verticalAlign"),hV.prototype),d(hV.prototype,"font",[rV],Object.getOwnPropertyDescriptor(hV.prototype,"font"),hV.prototype),d(hV.prototype,"cacheMode",[sV],Object.getOwnPropertyDescriptor(hV.prototype,"cacheMode"),hV.prototype),d(hV.prototype,"imageAtlas",[aV],Object.getOwnPropertyDescriptor(hV.prototype,"imageAtlas"),hV.prototype),uV=gs(hV.prototype,"_lineHeight",[Ls],(function(){return 40})),cV=gs(hV.prototype,"_string",[Ls],(function(){return"<color=#00ff00>Rich</color><color=#0fffff>Text</color>"})),lV=gs(hV.prototype,"_horizontalAlign",[Ls],(function(){return FU.LEFT})),_V=gs(hV.prototype,"_verticalAlign",[Ls],(function(){return UU.TOP})),fV=gs(hV.prototype,"_fontSize",[Ls],(function(){return 40})),dV=gs(hV.prototype,"_maxWidth",[Ls],(function(){return 0})),pV=gs(hV.prototype,"_fontFamily",[Ls],(function(){return"Arial"})),mV=gs(hV.prototype,"_font",[Ls],(function(){return null})),gV=gs(hV.prototype,"_isSystemFontUsed",[Ls],(function(){return!0})),vV=gs(hV.prototype,"_userDefinedFont",[Ls],(function(){return null})),yV=gs(hV.prototype,"_cacheMode",[Ls],(function(){return GU.NONE})),EV=gs(hV.prototype,"_imageAtlas",[Ls],(function(){return null})),TV=gs(hV.prototype,"_handleTouchEvent",[Ls],(function(){return!0})),oV=hV))||oV)||oV);t({RichText:MV,RichTextComponent:MV}),g.RichText=MV;var PV=bs("cc.UIMeshRenderer")(DV=ws(110)(DV=function(t){function e(){var e;return(e=t.call(this)||this)._modelComponent=null,e._dirtyVersion=-1,e._internalId=-1,e.stencilStage=hF.DISABLED,e._renderData=null,e._renderEntity=new bF(pF.DYNAMIC),e}s(e,t);var i=e.prototype;return i.__preload=function(){this.node._uiProps.uiComp=this},i.onEnable=function(){iL.addRenderer(this),this.markForUpdateRenderData()},i.onDisable=function(){iL.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].setPriority(Gm.MAX-11),i.recompileShaders({CC_FORCE_FORWARD_SHADING:!0},s)}},i.markForUpdateRenderData=function(){iL.markDirtyRenderer(this)},i.setNodeDirty=function(){},i.setTextureDirty=function(){},i._canRender=function(){return this.enabled&&null!==this._modelComponent},n(e,[{key:"modelComponent",get:function(){return this._modelComponent}},{key:"renderEntity",get:function(){return this._renderEntity}},{key:"renderData",get:function(){return this._renderData}}]),e}(Wd))||DV)||DV;t({UIMeshRenderer:PV,UIModelComponent:PV}),g.UIMeshRenderer=PV;var LV,BV,FV,UV,kV,GV,HV,zV=Hp.Enum.NONE|Hp.Enum.UI_3D,VV=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=zV,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=zV},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 ME(g.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)}}},n(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}(),WV=bs("cc.UIStaticBatch")(LV=ws(110)((d((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=t.call.apply(t,[this].concat(n))||this)._init=!1,e._bufferAccessor=null,e._dirty=!0,e._uiDrawBatchList=[],e}s(e,t);var i=e.prototype;return i.postUpdateAssembler=function(){},i.markAsDirty=function(){},i._requireDrawBatch=function(){var t=new VV;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 fL.root&&fL.root.batcher2D?fL.root.batcher2D:(j(9301),null)},n(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}(uU)).prototype,"color",[aa],Object.getOwnPropertyDescriptor(BV.prototype,"color"),BV.prototype),LV=BV))||LV)||LV;t({UIStaticBatch:WV,UIStaticBatchComponent:WV});var XV,jV,YV,KV=t("LabelShadow",bs("cc.LabelShadow")(FV=ws(110)(FV=Is(XU)((UV=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)._color=kV&&kV(),e._offset=GV&&GV(),e._blur=HV&&HV(),e}s(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(XU);t&&t.updateRenderData(!0)},n(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}(Wd),kV=gs(UV.prototype,"_color",[Ls],(function(){return new qi(0,0,0,255)})),GV=gs(UV.prototype,"_offset",[Ls],(function(){return new pn(2,2)})),HV=gs(UV.prototype,"_blur",[Ls],(function(){return 2})),FV=UV))||FV)||FV)||FV),qV=bs("cc.UIOpacity")(XV=ws(110)(XV=Os((jV=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)._opacity=YV&&YV(),e}s(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)},n(e,[{key:"opacity",get:function(){return this._opacity},set:function(t){this._opacity!==t&&(t=Me(t,0,255),this._opacity=t,this.node._uiProps.localOpacity=t/255,this.setEntityLocalOpacityDirtyRecursively(!0))}}]),e}(Wd),YV=gs(jV.prototype,"_opacity",[Ls],(function(){return 255})),XV=jV))||XV)||XV)||XV;t({UIOpacity:qV,UIOpacityComponent:qV}),g.MaskComponent=QG,qt(QG,"cc.MaskComponent"),g.LabelComponent=XU,qt(XU,"cc.LabelComponent"),g.LabelOutlineComponent=cH,qt(cH,"cc.LabelOutlineComponent"),g.RichTextComponent=MV,qt(MV,"cc.RichTextComponent"),g.SpriteComponent=WG,qt(WG,"cc.SpriteComponent"),g.UIModelComponent=PV,qt(PV,"cc.UIModelComponent"),g.GraphicsComponent=MG,qt(MG,"cc.GraphicsComponent"),qt(WV,"cc.UIStaticBatchComponent"),qt(qV,"cc.UIOpacityComponent"),it(QG.prototype,"Mask",[{name:"graphics",newName:"subComp",target:QG.prototype,targetName:"Mask"}]),it(XG,"MaskType",[{name:"RECT",newName:"GRAPHICS_RECT",target:XG,targetName:"MaskType"},{name:"ELLIPSE",newName:"GRAPHICS_ELLIPSE",target:XG,targetName:"MaskType"},{name:"IMAGE_STENCIL",newName:"SPRITE_STENCIL",target:XG,targetName:"MaskType"}]);var QV=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 ZV(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=pW(s,t[s],t[s+1],a);else for(s=i-n;s>=e;s-=n)a=pW(s,t[s],t[s+1],a);return a&&lW(a,a.next)&&(mW(a),a=a.next),a}function JV(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||!lW(i,i.next)&&0!==cW(i.prev,i,i.next))i=i.next;else{if(mW(i),(i=e=i.prev)===i.next)return null;n=!0}}while(n||i!==e);return e}function $V(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=aW(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,h=0,u=1;do{for(i=t,t=null,s=null,a=0;i;){for(a++,n=i,o=0,e=0;e<u&&(o++,n=n.nextZ);e++);for(h=u;o>0||h>0&&n;)0===o?(r=n,n=n.nextZ,h--):0!==h&&n?i.z<=n.z?(r=i,i=i.nextZ,o--):(r=n,n=n.nextZ,h--):(r=i,i=i.nextZ,o--),s?s.nextZ=r:t=r,r.prevZ=s,s=r;i=n}s.nextZ=null,u*=2}while(a>1)}(r)}(t,n,r,s);for(var o=t,h=null,u=null;t.prev!==t.next;)if(h=t.prev,u=t.next,s?eW(t,n,r,s):tW(t))e.push(h.i/i),e.push(t.i/i),e.push(u.i/i),mW(t),t=u.next,o=u.next;else if((t=u)===o){a?1===a?$V(t=iW(t,e,i),e,i,n,r,s,2):2===a&&nW(t,e,i,n,r,s):$V(JV(t),e,i,n,r,s,1);break}}}function tW(t){var e=t.prev,i=t,n=t.next;if(cW(e,i,n)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(hW(e.x,e.y,i.x,i.y,n.x,n.y,r.x,r.y)&&cW(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function eW(t,e,i,n){var r=t.prev,s=t,a=t.next;if(cW(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,h=r.y<s.y?r.y<a.y?r.y:a.y:s.y<a.y?s.y:a.y,u=r.x>s.x?r.x>a.x?r.x:a.x:s.x>a.x?s.x:a.x,c=r.y>s.y?r.y>a.y?r.y:a.y:s.y>a.y?s.y:a.y,l=aW(o,h,e,i,n),_=aW(u,c,e,i,n),f=t.nextZ;f&&f.z<=_;){if(f!==t.prev&&f!==t.next&&hW(r.x,r.y,s.x,s.y,a.x,a.y,f.x,f.y)&&cW(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(f=t.prevZ;f&&f.z>=l;){if(f!==t.prev&&f!==t.next&&hW(r.x,r.y,s.x,s.y,a.x,a.y,f.x,f.y)&&cW(f.prev,f,f.next)>=0)return!1;f=f.prevZ}return!0}function iW(t,e,i){var n=t;do{var r=n.prev,s=n.next.next;!lW(r,s)&&_W(r,n,n.next,s)&&fW(r,s)&&fW(s,r)&&(e.push(r.i/i),e.push(n.i/i),e.push(s.i/i),mW(n),mW(n.next),n=t=s),n=n.next}while(n!==t);return n}function nW(t,e,i,n,r,s){var a=t;do{for(var o=a.next.next;o!==a.prev;){if(a.i!==o.i&&uW(a,o)){var h=dW(a,o);return a=JV(a,a.next),h=JV(h,h.next),$V(a,e,i,n,r,s),void $V(h,e,i,n,r,s)}o=o.next}a=a.next}while(a!==t)}function rW(t,e){return t.x-e.x}function sW(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 h,u=a,c=a.x,l=a.y,_=1/0;for(i=a.next;i!==u;)n>=i.x&&i.x>=c&&hW(r<l?n:s,r,c,l,r<l?s:n,r,i.x,i.y)&&((h=Math.abs(r-i.y)/(n-i.x))<_||h===_&&i.x>a.x)&&fW(i,t)&&(a=i,_=h),i=i.next;return a}(t,e)){var i=dW(e,t);JV(i,i.next)}}function aW(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 oW(t){var e=t,i=t;do{e.x<i.x&&(i=e),e=e.next}while(e!==t);return i}function hW(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 uW(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&&_W(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&fW(t,e)&&fW(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 cW(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function lW(t,e){return t.x===e.x&&t.y===e.y}function _W(t,e,i,n){return!!(lW(t,e)&&lW(i,n)||lW(t,n)&&lW(i,e))||cW(t,e,i)>0!=cW(t,e,n)>0&&cW(i,n,t)>0!=cW(i,n,e)>0}function fW(t,e){return cW(t.prev,t,t.next)<0?cW(t,e,t.next)>=0&&cW(t,t.prev,e)>=0:cW(t,e,t.prev)<0||cW(t,t.next,e)<0}function dW(t,e){var i=new QV(t.i,t.x,t.y),n=new QV(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 pW(t,e,i,n){var r=new QV(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 mW(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 gW(t,e,i){i=i||3;var n=e?e.length:0,r=n?e[0]*i:t.length,s=ZV(t,0,r,i,!0),a=[];if(!s)return a;var o=0,h=0,u=0,c=0,l=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=ZV(t,e[a]*n,a<r-1?e[a+1]*n:t.length,n,!1))&&(o===o.next&&(o.steiner=!0),s.push(oW(o)));if(s.sort(rW),!i)return i;for(a=0;a<s.length;a++)sW(s[a],i),i=JV(i,i.next);return i}(t,e,s,i)),t.length>80*i){o=u=t[0],h=c=t[1];for(var d=i;d<r;d+=i)(l=t[d])<o&&(o=l),(_=t[d+1])<h&&(h=_),l>u&&(u=l),_>c&&(c=_);f=Math.max(u-o,c-h)}return $V(s,a,i,o,h,f),a}for(var vW=Math.PI,yW=Math.min,EW=Math.max,TW=Math.ceil,SW=Math.acos,AW=Math.cos,RW=Math.sin,CW=Math.atan2,bW=null,IW=null,wW=new qi,OW=[],xW=0;xW<4;xW++)OW.push(new Wi);function NW(t,e,i){return t<e?e:t>i?i:t}var DW={useModel:!0,updateRenderData:function(){},fillBuffers:function(){},renderIA:function(){},getRenderData:function(t,e){if(!IW)return null;var i=IW.getRenderDataList(),n=i[IW.dataOffset];if(!n)return null;var r=n,s=r?r.vertexStart+e:0;return(s>65535||3*s>131070)&&(++IW.dataOffset,IW.dataOffset<i.length?n=i[IW.dataOffset]:(n=IW.requestRenderData(),i[IW.dataOffset]=n),r=n),r&&r.vertexCount<s&&r.request(e,3*e),n},stroke:function(t){qi.copy(wW,t.strokeColor),t.impl&&(this._flattenPaths(t.impl),this._expandStroke(t),t.impl.updatePathOffset=!0,this.end(t))},fill:function(t){qi.copy(wW,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,h=t.miterLimit;if(IW=t.impl){var u=(e=s,i=vW,n=IW.tessTol,r=2*SW(e/(e+n)),EW(2,TW(i/r)));this._calculateJoins(IW,s,o,h);for(var c=IW.paths,l=0,_=IW.pathOffset,f=IW.pathLength;_<f;_++){var d=c[_],p=d.points.length;o===xk.ROUND?l+=2*(p+d.bevel*(u+2)+1):l+=2*(p+5*d.bevel+1),d.closed||(a===Ok.ROUND?l+=2*(2*u+2):l+=12)}var m=bW=this.getRenderData(t,l);if(m){for(var g=m.vData,v=m.iData,y=IW.pathOffset,E=IW.pathLength;y<E;y++){var T=c[y],S=T.points,A=S.length,R=m.vertexStart,C=void 0,b=void 0,I=0,w=0,O=T.closed;if(O?(C=S[A-1],b=S[0],I=0,w=A):(C=S[0],b=S[1],I=1,w=A-1),b=b||C,!O){var x=new IG(b.x,b.y);x.subtract(C),x.normalize();var N=x.x,D=x.y;a===Ok.BUTT?this._buttCapStart(C,N,D,s,0):a===Ok.SQUARE?this._buttCapStart(C,N,D,s,s):a===Ok.ROUND&&this._roundCapStart(C,N,D,s,u)}for(var M=I;M<w;++M)o===xk.ROUND?this._roundJoin(C,b,s,s,u):0!=(b.flags&(Nk.PT_BEVEL|Nk.PT_INNERBEVEL))?this._bevelJoin(C,b,s,s):(this._vSet(b.x+b.dmx*s,b.y+b.dmy*s,1),this._vSet(b.x-b.dmx*s,b.y-b.dmy*s,-1)),C=b,b=S[M+1];if(O){var P=8*R;this._vSet(g[P],g[P+1],1),this._vSet(g[P+8],g[P+8+1],-1)}else{var L=new IG(b.x,b.y);L.subtract(C),L.normalize();var B=L.x,F=L.y;a===Ok.BUTT?this._buttCapEnd(b,B,F,s,0):a===Ok.SQUARE?this._buttCapEnd(b,B,F,s,s):a===Ok.ROUND&&this._roundCapEnd(b,B,F,s,u)}for(var U=m.indexStart,k=R+2,G=m.vertexStart;k<G;k++)v[U++]=k-2,v[U++]=k-1,v[U++]=k;m.indexStart=U}bW=null,IW=null}}},_expandFill:function(t){if(IW=t.impl){for(var e=IW.paths,i=0,n=IW.pathOffset,r=IW.pathLength;n<r;n++)i+=e[n].points.length;var s=bW=this.getRenderData(t,i);if(s){for(var a=s,o=a.vData,h=a.iData,u=IW.pathOffset,c=IW.pathLength;u<c;u++){var l=e[u],_=l.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(l.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=gW(g,null,3);if(!T||0===T.length)continue;for(var S=0,A=T.length;S<A;S++)h[m++]=T[S]+d}else for(var R=d,C=d+2,b=a.vertexStart;C<b;C++)h[m++]=R,h[m++]=C-1,h[m++]=C;a.indexStart=m}}bW=null,IW=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 h=s[a],u=h.points,c=u.length,l=u[c-1],_=u[0];h.bevel=0;for(var f=0;f<c;f++){var d,p,m=l.dy,g=-l.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*l.dy-l.dx*_.dy>0&&(_.flags|=Nk.PT_LEFT),d*(p=EW(11,yW(l.len,_.len)*r))*p<1&&(_.flags|=Nk.PT_INNERBEVEL),_.flags&Nk.PT_CORNER&&(d*n*n<1||i===xk.BEVEL||i===xk.ROUND)&&(_.flags|=Nk.PT_BEVEL),0!=(_.flags&(Nk.PT_BEVEL|Nk.PT_INNERBEVEL))&&h.bevel++,l=_,_=u[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 h=0,u=s.length;h<u;h++){var c=new IG(o.x,o.y);c.subtract(a),a.len=c.length(),(c.x||c.y)&&c.normalize(),a.dx=c.x,a.dy=c.y,a=o,o=s[h+1]}}},_chooseBevel:function(t,e,i,n){var r=i.x,s=i.y,a=0,o=0,h=0,u=0;return 0!==t?(a=r+e.dy*n,o=s-e.dx*n,h=r+i.dy*n,u=s-i.dx*n):(a=h=r+i.dmx*n,o=u=s+i.dmy*n),[a,o,h,u]},_buttCapStart:function(t,e,i,n,r){var s=t.x-e*r,a=t.y-i*r,o=i,h=-e;this._vSet(s+o*n,a+h*n,1),this._vSet(s-o*n,a-h*n,-1)},_buttCapEnd:function(t,e,i,n,r){var s=t.x+e*r,a=t.y+i*r,o=i,h=-e;this._vSet(s+o*n,a+h*n,1),this._vSet(s-o*n,a-h*n,-1)},_roundCapStart:function(t,e,i,n,r){for(var s=t.x,a=t.y,o=i,h=-e,u=0;u<r;u++){var c=u/(r-1)*vW,l=AW(c)*n,_=RW(c)*n;this._vSet(s-o*l-e*_,a-h*l-i*_,1),this._vSet(s,a,0)}this._vSet(s+o*n,a+h*n,1),this._vSet(s-o*n,a-h*n,-1)},_roundCapEnd:function(t,e,i,n,r){var s=t.x,a=t.y,o=i,h=-e;this._vSet(s+o*n,a+h*n,1),this._vSet(s-o*n,a-h*n,-1);for(var u=0;u<r;u++){var c=u/(r-1)*vW,l=AW(c)*n,_=RW(c)*n;this._vSet(s,a,0),this._vSet(s-o*l+e*_,a-h*l+i*_,1)}},_roundJoin:function(t,e,i,n,r){var s=t.dy,a=-t.dx,o=e.dy,h=-e.dx,u=e.x,c=e.y;if(0!=(e.flags&Nk.PT_LEFT)){var l=this._chooseBevel(e.flags&Nk.PT_INNERBEVEL,t,e,i),_=l[0],f=l[1],d=l[2],p=l[3],m=CW(-a,-s),g=CW(-h,-o);g>m&&(g-=2*vW),this._vSet(_,f,1),this._vSet(u-s*n,e.y-a*n,-1);for(var v=NW(TW((m-g)/vW)*r,2,r),y=0;y<v;y++){var E=m+y/(v-1)*(g-m),T=u+AW(E)*n,S=c+RW(E)*n;this._vSet(u,c,0),this._vSet(T,S,-1)}this._vSet(d,p,1),this._vSet(u-o*n,c-h*n,-1)}else{var A=this._chooseBevel(e.flags&Nk.PT_INNERBEVEL,t,e,-n),R=A[0],C=A[1],b=A[2],I=A[3],w=CW(a,s),O=CW(h,o);O<w&&(O+=2*vW),this._vSet(u+s*n,c+a*n,1),this._vSet(R,C,-1);for(var x=NW(TW((O-w)/vW)*r,2,r),N=0;N<x;N++){var D=w+N/(x-1)*(O-w),M=u+AW(D)*i,P=c+RW(D)*i;this._vSet(M,P,1),this._vSet(u,c,0)}this._vSet(u+o*n,c+h*n,1),this._vSet(b,I,-1)}},_bevelJoin:function(t,e,i,n){var r=0,s=0,a=0,o=0,h=0,u=0,c=0,l=0,_=t.dy,f=-t.dx,d=e.dy,p=-e.dx;if(e.flags&Nk.PT_LEFT){var m=this._chooseBevel(e.flags&Nk.PT_INNERBEVEL,t,e,i);h=m[0],u=m[1],c=m[2],l=m[3],this._vSet(h,u,1),this._vSet(e.x-_*n,e.y-f*n,-1),this._vSet(c,l,1),this._vSet(e.x-d*n,e.y-p*n,-1)}else{var g=this._chooseBevel(e.flags&Nk.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),bW){var n=bW,r=8*n.vertexStart,s=n.vData;s[r++]=t,s[r++]=e,s[r++]=0,qi.toArray(s,wW,r),r+=4,s[r++]=i,n.vertexStart++}}},MW=t("graphicsAssembler",{getAssembler:function(){return DW}});MG.Assembler=MW;var PW=["left","center","right"],LW=2048,BW=(1/255).toFixed(3),FW=function(){this.char="",this.valid=!0,this.x=0,this.y=0,this.line=0,this.hash=""},UW=function(){function t(){this._context=null,this._canvas=null,this._canvasData=null,this._lettersInfo=[],this._tmpRect=new En,this._maxFontSize=100,this._fontScale=1,this._canvasData=zB.getInstance().get(),this._canvas=this._canvasData.canvas,this._context=this._canvasData.context}var e=t.prototype;return e.destroy=function(){zB.getInstance().put(this._canvasData),this._lettersInfo.length=0},e.processingString=function(t,e,i,n,r,s){if(t)e.fntConfig?this._fontScale=1:this._fontScale=this._getStyleFontScale(e.originFontSize,e.fontScale),qB.fontScale=this._fontScale,this._setupBMFontOverflowMetrics(i,n),this._updateFontScale(e),this._computeHorizontalKerningForText(e,i,r),this._alignText(e,i,n,r);else{var a=0;for(this._fontScale=this._getStyleFontScale(e.fontSize,e.fontScale),this._updatePaddingRect(e,n),this._calculateLabelFont(e,i,n,r);(n.canvasSize.width>LW||n.canvasSize.height>LW)&&a<=3;){if(++a>3)this._fontScale=1;else{var o=Math.max(n.canvasSize.width,n.canvasSize.height),h=LW/o;this._fontScale*=h,this._fontScale=Math.max(1,this._fontScale)}this._updatePaddingRect(e,n),this._calculateLabelFont(e,i,n,r)}}s&&(s=n.parsedString)},e.generateRenderInfo=function(t,e,i,n,r,s,a){t?(this._computeAlignmentOffset(e,i,n),this.generateVertexData(t,e,i,n,r,s,a)):(this._updateLabelDimensions(e,i,n),this._updateTexture(e,i,n,r),this.generateVertexData(t,e,i,n,r,s,a))},e.setCanvasUsed=function(t,e){this._canvas=t,this._context=e},e._getStyleFontScale=function(t,e){var i=e;return i*t>this._maxFontSize&&t<this._maxFontSize&&(i=this._maxFontSize/t),i<1&&(i=1),i},e._calculateLabelFont=function(t,e,i,n){if(this._context){t.actualFontSize=t.fontSize*this._fontScale;var r=n.split("\n"),s=i.parsedString=r,a=this._getFontDesc(t.actualFontSize,t.fontFamily,t.isBold,t.isItalic);switch(this._context.font=t.fontDesc=a,e.overFlow){case kU.NONE:for(var o=0,h=0;h<r.length;++h){var u=BB(this._context,r[h],a);o=o>u?o:u}var c=o,l=(s.length+RB)*this._getLineHeight(e.lineHeight,t.actualFontSize,t.fontSize);i.canvasSize.width=c+i.canvasPadding.width*this._fontScale,i.canvasSize.height=l+i.canvasPadding.height*this._fontScale,i.nodeContentSize.width=(c+i.contentSizeExtend.width*this._fontScale)/this._fontScale,i.nodeContentSize.height=(l+i.contentSizeExtend.height*this._fontScale)/this._fontScale;break;case kU.SHRINK:this._calculateShrinkFont(r,t,e,i),this._calculateWrapText(r,t,e,i),i.canvasSize.width=i.nodeContentSize.width*this._fontScale,i.canvasSize.height=i.nodeContentSize.height*this._fontScale;break;case kU.CLAMP:this._calculateWrapText(r,t,e,i),i.canvasSize.width=i.nodeContentSize.width*this._fontScale,i.canvasSize.height=i.nodeContentSize.height*this._fontScale;break;case kU.RESIZE_HEIGHT:this._calculateWrapText(r,t,e,i);var _=(i.parsedString.length+RB)*this._getLineHeight(e.lineHeight,t.actualFontSize,t.fontSize);i.canvasSize.width=i.nodeContentSize.width*this._fontScale,i.canvasSize.height=_+i.canvasPadding.height*this._fontScale,i.nodeContentSize.height=(_+i.contentSizeExtend.height*this._fontScale)/this._fontScale}}},e._getFontDesc=function(t,e,i,n){var r=t.toString()+"px ";return r+=e,i&&(r="bold "+r),n&&(r="italic "+r),r},e._getLineHeight=function(t,e,i){return 0===t?e:t*e/i},e._calculateShrinkFont=function(t,e,i,n){if(this._context){var r=this._getFontDesc(e.actualFontSize,e.fontFamily,e.isBold,e.isItalic);this._context.font=r;var s=this._calculateParagraphLength(t,this._context,r),a=0,o=0,h=0,u=e.actualFontSize;if(i.wrapping){var c=n.nodeContentSize.width*this._fontScale,l=n.nodeContentSize.height*this._fontScale;if(c<0||l<0)return;o=l+1;for(var _=0,f=0|e.actualFontSize+1,d=0;_<f;){if((d=_+f+1>>1)<=0){W(4003);break}u=d,r=this._getFontDesc(u,e.fontFamily,e.isBold,e.isItalic),this._context.font=r;var p=this._getLineHeight(i.lineHeight,u,e.fontSize);for(o=0,a=0;a<t.length;++a){var m=BB(this._context,t[a],r);o+=GB(t[a],m,c,this._measureText(this._context,r)).length*p}o>l?f=d-1:_=d}0===_?W(4003):(u=_,r=this._getFontDesc(u,e.fontFamily,e.isBold,e.isItalic),this._context.font=r)}else{for(o=t.length*this._getLineHeight(i.lineHeight,u,e.fontSize),a=0;a<t.length;++a)h<s[a]&&(h=s[a]);var g=(n.canvasSize.width-n.canvasPadding.width)*this._fontScale/h,v=n.canvasSize.height*this._fontScale/o;u=e.actualFontSize*Math.min(1,g,v)|0,r=this._getFontDesc(u,e.fontFamily,e.isBold,e.isItalic),this._context.font=r}e.actualFontSize=u,e.fontDesc=r}},e._calculateWrapText=function(t,e,i,n){if(i.wrapping&&this._context){var r=[],s=n.nodeContentSize.width*this._fontScale,a=this._getFontDesc(e.actualFontSize,e.fontFamily,e.isBold,e.isItalic);this._context.font=a;for(var o=0;o<t.length;++o){var h=BB(this._context,t[o],a),u=GB(t[o],h,s,this._measureText(this._context,a));r=r.concat(u)}n.parsedString=r,e.fontDesc=a}},e._measureText=function(t,e){return function(i){return BB(t,i,e)}},e._calculateParagraphLength=function(t,e,i){for(var n,r=[],s=f(t);!(n=s()).done;){var a=BB(e,n.value,i);r.push(a)}return r},e._updatePaddingRect=function(t,e){var i=0,n=0,r=0,s=0,a=0;if(e.contentSizeExtend.width=e.contentSizeExtend.height=0,t.isOutlined&&(i=n=r=s=a=t.outlineWidth,e.contentSizeExtend.width=e.contentSizeExtend.height=2*a),t.hasShadow){var o=t.shadowBlur+a,h=t.shadowOffsetX,u=t.shadowOffsetY;r=Math.max(r,-h+o),s=Math.max(s,h+o),i=Math.max(i,u+o),n=Math.max(n,-u+o)}if(t.isItalic){var c=t.fontSize*Math.tan(.20943951);s+=c,e.contentSizeExtend.width+=c}e.canvasPadding.x=r,e.canvasPadding.y=i,e.canvasPadding.width=r+s,e.canvasPadding.height=i+n},e._updateLabelDimensions=function(t,e,i){i.canvasSize.width=Math.min(i.canvasSize.width,LW),i.canvasSize.height=Math.min(i.canvasSize.height,LW),this._canvas.width=i.canvasSize.width,this._canvas.height=i.canvasSize.height,this._context.font=t.fontDesc,this._context.textAlign=PW[e.horizontalAlign],this._context.textBaseline="alphabetic"},e._calculateFillTextStartPosition=function(t,e,i){var n=0;e.horizontalAlign===FU.RIGHT?n=i.canvasSize.width-i.canvasPadding.width:e.horizontalAlign===FU.CENTER&&(n=(i.canvasSize.width-i.canvasPadding.width)/2);var r=this._getLineHeight(e.lineHeight,t.actualFontSize,t.fontSize)*(i.parsedString.length-1),s=t.actualFontSize*(1-RB/2);if(e.verticalAlign!==UU.TOP){var a=r+i.canvasPadding.height+t.actualFontSize-i.canvasSize.height;e.verticalAlign===UU.BOTTOM?s-=a+=RB/2*t.actualFontSize:s-=a/2}s+=0*t.actualFontSize,i.startPosition.set(n+i.canvasPadding.x,s+i.canvasPadding.y)},e._updateTexture=function(t,e,i,n){if(this._context&&this._canvas){this._context.clearRect(0,0,this._canvas.width,this._canvas.height),this._context.font=t.fontDesc,this._calculateFillTextStartPosition(t,e,i);var r=this._getLineHeight(e.lineHeight,t.actualFontSize,t.fontSize);this._context.lineJoin="round",t.isOutlined?(this._context.fillStyle="rgba("+t.outlineColor.r+", "+t.outlineColor.g+", "+t.outlineColor.b+", "+BW+")",this._context.fillRect(0,0,this._canvas.width,this._canvas.height)):(this._context.fillStyle="rgba("+t.color.r+", "+t.color.g+", "+t.color.b+", "+BW+")",this._context.fillRect(0,0,this._canvas.width,this._canvas.height)),this._context.fillStyle="rgb("+t.color.r+", "+t.color.g+", "+t.color.b+")";var s=new pn(i.startPosition.x,i.startPosition.y),a=s.x,o=0;this._drawTextEffect(s,r,t,e,i);for(var h=0;h<i.parsedString.length;++h)o=s.y+h*r,t.isOutlined&&this._context.strokeText(i.parsedString[h],a,o),this._context.fillText(i.parsedString[h],a,o);t.hasShadow&&(this._context.shadowColor="transparent"),this._uploadTexture(n)}},e._uploadTexture=function(t){var e;t.texture&&this._canvas&&(e=t.texture instanceof nB?t.texture.texture:t.texture,0!==this._canvas.width&&0!==this._canvas.height&&(e.reset({width:this._canvas.width,height:this._canvas.height,mipmapLevel:1}),e.uploadData(this._canvas),e.setWrapMode(Kf.CLAMP_TO_EDGE,Kf.CLAMP_TO_EDGE),t.texture instanceof nB&&(t.texture.rect=new En(0,0,this._canvas.width,this._canvas.height),t.texture._calculateUV()),g.director.root&&g.director.root.batcher2D&&g.director.root.batcher2D._releaseDescriptorSetCache(e.getHash())))},e._drawTextEffect=function(t,e,i,n,r){if(i.hasShadow||i.isOutlined||i.isUnderline){var s=r.parsedString.length>1&&i.hasShadow,a=this._measureText(this._context,i.fontDesc),o=0,h=0;i.hasShadow&&this._setupShadow(i),i.isOutlined&&this._setupOutline(i);for(var u=0;u<r.parsedString.length;++u)if(o=t.x,h=t.y+u*e,s&&(i.isOutlined&&this._context.strokeText(r.parsedString[u],o,h),this._context.fillText(r.parsedString[u],o,h)),i.isUnderline){var c=a(r.parsedString[u]),l=new pn;n.horizontalAlign===FU.RIGHT?l.x=t.x-c:n.horizontalAlign===FU.CENTER?l.x=t.x-c/2:l.x=t.x,l.y=h+i.actualFontSize/8,this._context.fillRect(l.x,l.y,c,i.underlineHeight*this._fontScale)}s&&(this._context.shadowColor="transparent")}},e._setupOutline=function(t){this._context.strokeStyle="rgba("+t.outlineColor.r+", "+t.outlineColor.g+", "+t.outlineColor.b+", "+t.outlineColor.a/255+")",this._context.lineWidth=2*t.outlineWidth*this._fontScale},e._setupShadow=function(t){var e=this._fontScale;this._context.shadowColor="rgba("+t.shadowColor.r+", "+t.shadowColor.g+", "+t.shadowColor.b+", "+t.shadowColor.a/255+")",this._context.shadowBlur=t.shadowBlur*e,this._context.shadowOffsetX=t.shadowOffsetX*e,this._context.shadowOffsetY=-t.shadowOffsetY*e},e.generateVertexData=function(t,e,i,n,r,s,a){t?this._updateQuads(e,i,n,r,s,a):(this.updateQuatCount(r),a(e,n,r))},e.updateQuatCount=function(t){var e=t.vertexBuffer,i=t.quadCount;if(e.length!==i){for(var n=e.length;n<i;n++)e.push({x:0,y:0,z:0,u:0,v:0,color:qi.WHITE.clone()});e.length=i}},e._setupBMFontOverflowMetrics=function(t,e){var i=e.nodeContentSize.width,n=e.nodeContentSize.height;t.overFlow===kU.RESIZE_HEIGHT&&(n=0),t.overFlow===kU.NONE&&(i=0,n=0),t.textWidthTemp=i,t.textHeightTemp=n,t.textDimensions.width=i,t.textDimensions.height=n,t.maxLineWidth=i},e._updateFontScale=function(t){t.bmfontScale=t.actualFontSize/(t.originFontSize*this._fontScale)},e._computeHorizontalKerningForText=function(t,e,i){var n=i,r=n.length;if(t.fntConfig){var s=t.fntConfig.kerningDict,a=e.horizontalKerning;if(s&&0!==s.length)for(var o=-1,h=0;h<r;++h){var u=n.charCodeAt(h),c=s[o<<16|65535&u]||0;a[h]=h<r-1?c:0,o=u}}},e._alignText=function(t,e,i,n){this._multilineTextWrap(t,e,i,n,this._getFirstWordLen),e.overFlow===kU.SHRINK&&(t.fontSize>0&&this._isVerticalClamp(t,e,i,n,this)&&this._shrinkLabelToContentSize(t,e,i,n,this._isVerticalClamp),t.fontSize>0&&this._isHorizontalNeedShrink(e,i)&&this._shrinkLabelToContentSize(t,e,i,n,this._isHorizontalClamp)),this._parsedString(i,n)},e._parsedString=function(t,e){for(var i=[],n="",r=0,s=0,a=e.length;r<a;++r){var o=this._lettersInfo[r];o.valid&&(s===o.line?n+=o.char:(i=i.concat(n),s=o.line,n=""))}i=i.concat(n),t.parsedString=i},e._multilineTextWrap=function(t,e,i,n,r){e.linesWidth.length=0;for(var s=n,a=s.length,o=0,h=0,u=0,c=0,l=0,_=0,f=0,d=null,p=0;p<a;){var m=s.charAt(p);if("\n"!==m){for(var g=r(t,e,s,p,a),v=_,y=f,E=l,T=h,S=!1,A=new pn,R=0;R<g;++R){var C=p+R;if("\r"!==(m=s.charAt(C)))if(d=qB.fontAtlas.getLetterDefinitionForChar(m,qB)){var b=T+d.offsetX*t.bmfontScale-qB.margin;if(e.wrapping&&e.maxLineWidth>0&&h>0&&b+d.w*t.bmfontScale>e.maxLineWidth&&!LB(m)){e.linesWidth.push(l),l=0,o++,h=0,u-=e.lineHeight*this._getFontScale(t,e)+0,S=!0;break}A.x=b,A.y=u-d.offsetY*t.bmfontScale,this._recordLetterInfo(A,m,C,o),C+1<e.horizontalKerning.length&&C<a-1&&(T+=e.horizontalKerning[C+1]*t.bmfontScale),T+=d.xAdvance*t.bmfontScale+e.spacingX,E=A.x+d.w*t.bmfontScale,v<A.y&&(v=A.y),y>A.y-d.h*t.bmfontScale&&(y=A.y-d.h*t.bmfontScale)}else this._recordPlaceholderInfo(C,m),L("Can't find letter definition in texture atlas "+t.fntConfig.atlasName+" for letter:"+m);else this._recordPlaceholderInfo(C,m)}S||(h=T,_<v&&(_=v),f>y&&(f=y),c<(l=E)&&(c=l),p+=g)}else e.linesWidth.push(l),l=0,o++,h=0,u-=e.lineHeight*this._getFontScale(t,e)+0,this._recordPlaceholderInfo(p,m),p++}return e.linesWidth.push(l),e.numberOfLines=o+1,e.textDesiredHeight=e.numberOfLines*e.lineHeight*this._getFontScale(t,e),e.numberOfLines>1&&(e.textDesiredHeight+=0*(e.numberOfLines-1)),i.nodeContentSize.width=e.textWidthTemp,i.nodeContentSize.height=e.textHeightTemp,e.textWidthTemp<=0&&(i.nodeContentSize.width=parseFloat(c.toFixed(2))+2*qB.margin),e.textHeightTemp<=0&&(i.nodeContentSize.height=parseFloat(e.textDesiredHeight.toFixed(2))+2*qB.margin),e.tailoredTopY=i.nodeContentSize.height,e.tailoredBottomY=0,_>0&&(e.tailoredTopY=i.nodeContentSize.height+_),f<-e.textDesiredHeight&&(e.tailoredBottomY=e.textDesiredHeight+f),!0},e._recordPlaceholderInfo=function(t,e){if(t>=this._lettersInfo.length){var i=new FW;this._lettersInfo.push(i)}this._lettersInfo[t].char=e,this._lettersInfo[t].hash=""+e.charCodeAt(0)+qB.hash,this._lettersInfo[t].valid=!1},e._recordLetterInfo=function(t,e,i,n){if(i>=this._lettersInfo.length){var r=new FW;this._lettersInfo.push(r)}var s=""+e.charCodeAt(0)+qB.hash;this._lettersInfo[i].line=n,this._lettersInfo[i].char=e,this._lettersInfo[i].hash=s,this._lettersInfo[i].valid=qB.fontAtlas.getLetter(s).valid,this._lettersInfo[i].x=t.x,this._lettersInfo[i].y=t.y},e._getFirstWordLen=function(t,e,i,n,r){var s=i.charAt(n);if(PB(s)||"\n"===s||LB(s))return 1;var a=1,o=qB.fontAtlas.getLetterDefinitionForChar(s,qB);if(!o)return a;for(var h=o.xAdvance*t.bmfontScale+e.spacingX,u=n+1;u<r&&(s=i.charAt(u),o=qB.fontAtlas.getLetterDefinitionForChar(s,qB));++u){if(h+o.offsetX*t.bmfontScale+o.w*t.bmfontScale>e.maxLineWidth&&!LB(s)&&e.maxLineWidth>0)return a;if(h+=o.xAdvance*t.bmfontScale+e.spacingX,"\n"===s||LB(s)||PB(s))break;a++}return a},e._computeAlignmentOffset=function(t,e,i){switch(e.linesOffsetX.length=0,e.letterOffsetY=0,e.horizontalAlign){case FU.LEFT:for(var n=0;n<e.numberOfLines;++n)e.linesOffsetX.push(0);break;case FU.CENTER:for(var r=0,s=e.linesWidth.length;r<s;r++)e.linesOffsetX.push((i.nodeContentSize.width-e.linesWidth[r])/2);break;case FU.RIGHT:for(var a=0,o=e.linesWidth.length;a<o;a++)e.linesOffsetX.push(i.nodeContentSize.width-e.linesWidth[a])}if(e.letterOffsetY=i.nodeContentSize.height,e.verticalAlign!==UU.TOP){var h=i.nodeContentSize.height-e.textDesiredHeight+e.lineHeight*this._getFontScale(t,e)-t.originFontSize*this._fontScale*t.bmfontScale;e.verticalAlign===UU.BOTTOM?e.letterOffsetY-=h:e.letterOffsetY-=h/2}},e._getFontScale=function(t,e){return e.overFlow===kU.SHRINK?t.bmfontScale:1},e._isVerticalClamp=function(t,e,i){return e.textDesiredHeight>i.nodeContentSize.height},e._isHorizontalClamp=function(t,e,i,n,r){for(var s=!1,a=0,o=n.length;a<o;++a){var h=r._lettersInfo[a];if(h.valid){var u=qB.fontAtlas.getLetterDefinitionForChar(h.char,qB);if(!u)continue;var c=h.x+u.w*t.bmfontScale,l=h.line;if(e.textWidthTemp>0)if(e.wrapping){if(e.linesWidth[l]>i.nodeContentSize.width&&(c>i.nodeContentSize.width||c<0)){s=!0;break}}else if(c>i.nodeContentSize.width){s=!0;break}}}return s},e._isHorizontalNeedShrink=function(t,e){for(var i=0,n=t.linesWidth.length;i<n;++i)if(t.linesWidth[i]>e.nodeContentSize.width)return!0;return!1},e._shrinkLabelToContentSize=function(t,e,i,n,r){for(var s=0,a=0|t.actualFontSize,o=0;s<a;){var h=o=s+a+1>>1;if(h<=0)break;t.bmfontScale=h/(t.originFontSize*this._fontScale),this._multilineTextWrap(t,e,i,n,this._getFirstWordLen),this._computeAlignmentOffset(t,e,i),r(t,e,i,n,this)?a=o-1:s=o}s>=0&&this._scaleFontSizeDown(t,e,i,n,s)},e._scaleFontSizeDown=function(t,e,i,n,r){var s=!0;r||(r=.1,s=!1),t.actualFontSize=r,s&&(this._updateFontScale(t),this._multilineTextWrap(t,e,i,n,this._getFirstWordLen))},e._updateQuads=function(t,e,i,n,r,s){for(var a=t.spriteFrame?t.spriteFrame.texture:qB.fontAtlas.getTexture(),o=n.uiTransAnchorX*i.nodeContentSize.width,h=n.uiTransAnchorY*i.nodeContentSize.height,u=0,c=r.length;u<c;++u){var l=this._lettersInfo[u];if(l.valid){var _=qB.fontAtlas.getLetter(l.hash);if(_){this._tmpRect.height=_.h,this._tmpRect.width=_.w,this._tmpRect.x=_.u,this._tmpRect.y=_.v;var f=l.y+e.letterOffsetY;if(e.textHeightTemp>0){if(f>e.tailoredTopY){var d=f-e.tailoredTopY;this._tmpRect.y+=d,this._tmpRect.height-=d,f-=d}f-this._tmpRect.height*t.bmfontScale<e.tailoredBottomY&&e.overFlow===kU.CLAMP&&(this._tmpRect.height=f<e.tailoredBottomY?0:(f-e.tailoredBottomY)/t.bmfontScale)}var p=l.line,m=l.x+_.w/2*t.bmfontScale+e.linesOffsetX[p];if(e.textWidthTemp>0&&this._isHorizontalClamped(e,i,m,p)&&e.overFlow===kU.CLAMP&&(this._tmpRect.width=0),this._tmpRect.height>0&&this._tmpRect.width>0){var g=this._determineRect(t),v=l.x+e.linesOffsetX[l.line],y=n.quadCount;n.quadCount+=4,this.updateQuatCount(n),s(t,i,n,y,a,this._tmpRect,g,v-o,f-h)}}else B("Can't find letter in this bitmap-font")}}return!0},e._isHorizontalClamped=function(t,e,i,n){var r=t.linesWidth[n],s=i>e.nodeContentSize.width||i<0;return t.wrapping?r>e.nodeContentSize.width&&s:s},e._determineRect=function(t){var e=t.spriteFrame;if(!e)return!1;var i=e.isRotated(),n=e.getOriginalSize(),r=e.getRect(),s=e.getOffset(),a=s.x+(n.width-r.width)/2,o=s.y-(n.height-r.height)/2;if(i){var h=this._tmpRect.x;this._tmpRect.x=r.x+r.height-this._tmpRect.y-this._tmpRect.height-o,this._tmpRect.y=h+r.y-a,this._tmpRect.y<0&&(this._tmpRect.height+=o)}else this._tmpRect.x+=r.x-a,this._tmpRect.y+=r.y+o;return i},t}();UW.instance=void 0,UW.instance=new UW;var kW,GW=new KB(64,64),HW=new TB(null),zW=null,VW=null,WW=null,XW=null,jW={updateProcessingData:function(t,e,i,n,r,s){t.fontSize=r.fontSize,t.actualFontSize=r.fontSize,t.originFontSize=WW?WW.fontSize:r.fontSize,e.horizontalAlign=r.horizontalAlign,e.verticalAlign=r.verticalAlign,e.spacingX=r.spacingX;var a=r.overflow;e.overFlow=a,e.lineHeight=r.lineHeight,i.nodeContentSize.width=s.width,i.nodeContentSize.height=s.height,a===kU.NONE?(e.wrapping=!1,i.nodeContentSize.width+=2*qB.margin,i.nodeContentSize.height+=2*qB.margin):a===kU.RESIZE_HEIGHT?(e.wrapping=!0,i.nodeContentSize.height+=2*qB.margin):e.wrapping=r.enableWrapText,n.uiTransAnchorX=s.anchorX,n.uiTransAnchorY=s.anchorY,qB.lineHeight=r.lineHeight,qB.fontSize=r.fontSize,t.spriteFrame=XW,t.fntConfig=WW,t.fontFamily=qB.fontFamily,t.color.set(r.color)},updateRenderData:function(t){if(t.renderData&&zW!==t){if(t.renderData.vertDirty){VW=(zW=t).node._uiProps.uiTransformComp;var e=t.renderData,i=UW.instance,n=t.textStyle,r=t.textLayout,s=t.textLayoutData,a=t.textRenderData;n.fontScale=uz.getScaleX(),this._updateFontFamily(t),this.updateProcessingData(n,r,s,a,t,VW),this._updateLabelInfo(t),n.fontDesc=qB.fontDesc,i.processingString(!0,n,r,s,t.string),this.resetRenderData(t),a.quadCount=0,i.generateRenderInfo(!0,n,r,s,a,t.string,this.generateVertexData),e.dataLength=a.quadCount,e.resize(e.dataLength,e.dataLength/2*3);for(var o=e.data,h=0,u=a.quadCount;h<u;h++)o[h]=a.vertexBuffer[h];var c=e.indexCount;this.createQuadIndices(c),e.chunk.setIndexBuffer(kW),zW.actualFontSize=n.actualFontSize,VW.setContentSize(s.nodeContentSize),this.updateUVs(t),this.updateColor(t),e.vertDirty=!1,zW=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(){},resetRenderData:function(t){var e=t.renderData;e.dataLength=0,e.resize(0,0)},generateVertexData:function(t,e,i,n,r,s,a,o,h){var u=n,c=t.bmfontScale,l=i.vertexBuffer,_=r.width,f=r.height,d=s.width,p=s.height,m=0,g=0,v=0,y=0;a?(m=s.x/_,y=(s.x+p)/_,g=(s.y+d)/f,v=s.y/f,l[u].u=m,l[u].v=v,l[u+1].u=m,l[u+1].v=g,l[u+2].u=y,l[u+2].v=v,l[u+3].u=y,l[u+3].v=g):(m=s.x/_,y=(s.x+d)/_,g=(s.y+p)/f,v=s.y/f,l[u].u=m,l[u].v=g,l[u+1].u=y,l[u+1].v=g,l[u+2].u=m,l[u+2].v=v,l[u+3].u=y,l[u+3].v=v),l[u].x=o,l[u].y=h-p*c,l[u+1].x=o+d*c,l[u+1].y=h-p*c,l[u+2].x=o,l[u+2].y=h,l[u+3].x=o+d*c,l[u+3].y=h},_updateFontFamily:function(t){var e=t.font;XW=e.spriteFrame,WW=e.fntConfig,qB.fontAtlas=e.fontDefDictionary,qB.fontAtlas||(t.cacheMode===GU.CHAR?qB.fontAtlas=GW:qB.fontAtlas=HW),SL.packToDynamicAtlas(t,XW)},_updateLabelInfo:function(){qB.hash="",qB.margin=0},_resetProperties:function(){WW=null,XW=null,qB.hash="",qB.margin=0},createQuadIndices:function(t){if(t%6==0){var e=t/6;kW=null,kW=new Uint16Array(t);for(var i=0,n=0;n<e;n++)kW[i++]=0+4*n,kW[i++]=1+4*n,kW[i++]=2+4*n,kW[i++]=1+4*n,kW[i++]=3+4*n,kW[i++]=2+4*n}else console.error("illegal index count!")}},YW=new qi(255,255,255,255),KW={createData:function(t){var e=t.requestRenderData();return e.resize(0,0),e},fillBuffers:function(t){var e=t.node;YW.set(t.color),YW.a=255*e._uiProps.opacity,df(e,0,t.renderData,YW)},appendQuad:function(t,e,i,n,r,s,a){var o=t.renderData;if(o){var h=o.dataLength;o.dataLength+=4,o.resize(o.dataLength,o.dataLength/2*3);var u=o.data,c=e.width,l=e.height,_=i.width,f=i.height,d=0,p=0,m=0,g=0;n?(d=i.x/c,g=(i.x+f)/c,p=(i.y+_)/l,m=i.y/l,u[h].u=d,u[h].v=m,u[h+1].u=d,u[h+1].v=p,u[h+2].u=g,u[h+2].v=m,u[h+3].u=g,u[h+3].v=p):(d=i.x/c,g=(i.x+_)/c,p=(i.y+f)/l,m=i.y/l,u[h].u=d,u[h].v=p,u[h+1].u=g,u[h+1].v=p,u[h+2].u=d,u[h+2].v=m,u[h+3].u=g,u[h+3].v=m),u[h].x=r,u[h].y=s-f*a,u[h+1].x=r+_*a,u[h+1].y=s-f*a,u[h+2].x=r,u[h+2].y=s,u[h+3].x=r+_*a,u[h+3].y=s}}};Ft(KW,jW);var qW=null,QW=Ut(jW,{getAssemblerData:function(){return qW||(qW=new KB(1024,1024)),qW.getTexture()},_updateFontFamily:function(t){qB.fontAtlas=qW,qB.fontFamily=this._getFontFamily(t);var e=t.getComponent(cH);e&&e.enabled?(qB.isOutlined=!0,qB.margin=e.width,qB.out=e.color.clone(),qB.out.a=e.color.a*t.color.a/255):(qB.isOutlined=!1,qB.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){qB.fontDesc=this._getFontDesc(),qB.color=t.color,qB.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}(qB)},_getFontDesc:function(){return qB.fontSize.toString()+"px "+qB.fontFamily}}),ZW=new qi(255,255,255,255),JW={createData:function(t){var e=t.requestRenderData();return e.resize(0,0),e},fillBuffers:function(t){if(t.renderData){var e=t.node;ZW.a=255*e._uiProps.opacity,df(e,0,t.renderData,ZW)}},updateColor:function(){}};Ft(JW,QW);var $W=XU.Overflow,tX={updateProcessingData:function(t,e,i,n,r,s){t.isSystemFontUsed=r.useSystemFont,t.fontSize=r.fontSize,i.nodeContentSize.width=i.canvasSize.width=s.width,i.nodeContentSize.height=i.canvasSize.height=s.height,e.lineHeight=r.lineHeight,e.overFlow=r.overflow,r.overflow===$W.NONE?e.wrapping=!1:r.overflow===$W.RESIZE_HEIGHT?e.wrapping=!0:e.wrapping=r.enableWrapText,t.isBold=r.isBold,t.isItalic=r.isItalic,t.isUnderline=r.isUnderline,t.underlineHeight=r.underlineHeight;var a=cH&&r.getComponent(cH);(a=a&&a.enabled&&a.width>0?a:null)?(t.isOutlined=!0,t.outlineColor.set(a.color),t.outlineWidth=a.width):t.isOutlined=!1;var o=KV&&r.getComponent(KV);(o=o&&o.enabled?o:null)?(t.hasShadow=!0,t.shadowColor.set(o.color),t.shadowBlur=o.blur,t.shadowOffsetX=o.offset.x,t.shadowOffsetY=o.offset.y):t.hasShadow=!1,t.color.set(r.color),n.texture=r.spriteFrame,n.uiTransAnchorX=s.anchorX,n.uiTransAnchorY=s.anchorY,e.horizontalAlign=r.horizontalAlign,e.verticalAlign=r.verticalAlign},getAssemblerData:function(){var t=XU._canvasPool.get();return t.canvas.width=t.canvas.height=1,t},resetAssemblerData:function(t){t&&XU._canvasPool.put(t)},updateRenderData:function(t){if(t.renderData){if(t.renderData.vertDirty){var e=t.node._uiProps.uiTransformComp,i=UW.instance,n=t.textStyle,r=t.textLayout,s=t.textLayoutData,a=t.textRenderData;n.fontScale=uz.getScaleX(),this.updateProcessingData(n,r,s,a,t,e),i.setCanvasUsed(t.assemblerData.canvas,t.assemblerData.context),n.fontFamily=this._updateFontFamily(t),this._resetDynamicAtlas(t),i.processingString(!1,n,r,s,t.string),i.generateRenderInfo(!1,n,r,s,a,t.string,this.generateVertexData);var o=t.renderData;o.textureDirty=!0,this._calDynamicAtlas(t,s),t.actualFontSize=n.actualFontSize,e.setContentSize(s.nodeContentSize);var h=o.data;h[0]=a.vertexBuffer[0],h[1]=a.vertexBuffer[1],h[2]=a.vertexBuffer[2],h[3]=a.vertexBuffer[3],this.updateUVs(t),t.renderData.vertDirty=!1,t.contentWidth=s.nodeContentSize.width}t.spriteFrame&&t.renderData.updateRenderData(t,t.spriteFrame)}},generateVertexData:function(t,e,i){var n=i.vertexBuffer,r=e.nodeContentSize.width,s=e.nodeContentSize.height,a=i.uiTransAnchorX*r,o=i.uiTransAnchorY*s;n[0].x=-a,n[0].y=-o,n[1].x=r-a,n[1].y=-o,n[2].x=-a,n[2].y=s-o,n[3].x=r-a,n[3].y=s-o},updateVertexData:function(){},updateUVs:function(){},_updateFontFamily:function(t){return t.useSystemFont?t.fontFamily||"Arial":t.font&&t.font._nativeAsset||"Arial"},_calDynamicAtlas:function(t,e){if(!(t.cacheMode!==XU.CacheMode.BITMAP||e.canvasSize.width<=0||e.canvasSize.height<=0)){var i=t.ttfSpriteFrame;SL.packToDynamicAtlas(t,i)}},_resetDynamicAtlas:function(t){if(t.cacheMode===XU.CacheMode.BITMAP){var e=t.ttfSpriteFrame;SL.deleteAtlasSpriteFrame(e),e._resetDynamicAtlasFrame()}}},eX=qi.WHITE.clone(),iX=Uint16Array.from([0,1,2,1,3,2]),nX={createData:function(t){var e=t.requestRenderData();e.dataLength=4,e.resize(4,6),t.textRenderData.quadCount=4;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++)qi.toArray(i,eX,n),n+=9;return e.vertexRow=2,e.vertexCol=2,e.chunk.setIndexBuffer(iX),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,h=0,u=n.length,c=0;c<u;c++){var l=n[c],_=l.x,f=l.y,d=a.m03*_+a.m07*f+a.m15;d=d?1/d:1,s[0+(h=c*o)]=(a.m00*_+a.m04*f+a.m12)*d,s[h+1]=(a.m01*_+a.m05*f+a.m13)*d,s[h+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(){}};Ft(nX,tX);var rX=t("labelAssembler",{getAssembler:function(t){var e=nX;return t.font instanceof SB?e=KW:t.cacheMode===XU.CacheMode.CHAR&&(e=JW),e}});XU.Assembler=rX;var sX,aX=WG.FillType,oX=new cn,hX=Uint16Array.from([0,1,2,1,3,2]),uX={updateRenderData:function(t){var e=t.spriteFrame;SL.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,h=0,u=0,c=0,l=0,_=0,f=0,d=0,p=0,m=0,g=0;switch(n.isRotated()?(h=o.x/s,u=(o.y+o.width)/a,c=_=h,d=m=(o.x+o.height)/s,f=g=u,l=p=o.y/a):(h=o.x/s,u=(o.y+o.height)/a,c=d=h,_=m=(o.x+o.width)/s,l=f=u,p=g=o.y/a),t.fillType){case aX.HORIZONTAL:r[3]=c+(_-c)*e,r[4]=l+(f-l)*e,r[12]=c+(_-c)*i,r[13]=l+(f-l)*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 aX.VERTICAL:r[3]=c+(d-c)*e,r[4]=l+(p-l)*e,r[12]=_+(m-_)*e,r[13]=f+(g-f)*e,r[21]=c+(d-c)*i,r[22]=l+(p-l)*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,h=r.anchorY*a,u=-o,c=-h,l=s-o,_=a-h,f=0;switch(t.fillType){case aX.HORIZONTAL:f=u+(l-u)*i,u+=(l-u)*e,l=f;break;case aX.VERTICAL:f=c+(_-c)*i,c+=(_-c)*e,_=f;break;default:K(2626)}n[0].x=u,n[0].y=c,n[1].x=l,n[1].y=c,n[2].x=u,n[2].y=_,n[3].x=l,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(hX);for(var i,n=f(e.data);!(i=n()).done;)i.value.z=0;return e},updateWorldVertexData:function(t,e){t.node.getWorldMatrix(oX);for(var i=t.renderData.floatStride,n=t.renderData.data,r=e.vb,s=0,a=0;a<4;a++){var o=n[a],h=o.x,u=o.y,c=oX.m03*h+oX.m07*u+oX.m15;c=c?1/c:1,r[s=a*i]=(oX.m00*h+oX.m04*u+oX.m12)*c,r[s+1]=(oX.m01*h+oX.m05*u+oX.m13)*c,r[s+2]=(oX.m02*h+oX.m06*u+oX.m14)*c}},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,h=s.b/255,u=t.node._uiProps.opacity,c=0;c<4;c++)i[r]=a,i[r+1]=o,i[r+2]=h,i[r+3]=u,r+=n}},cX=2*Math.PI,lX=1e-6,_X=new cn,fX=[new pn,new pn,new pn,new pn],dX=new Array(4),pX=new Array(8),mX=[new pn,new pn,new pn,new pn],gX=[new pn,new pn,new pn,new pn],vX=new pn,yX=[new pn,new pn,new pn,new pn];function EX(t,e,i,n,r,s,a){var o=Math.sin(s);o=Math.abs(o)>lX?o:0;var h=Math.cos(s),u=0,c=0;if(0!==(h=Math.abs(h)>lX?h:0)){if(u=o/h,(t-r.x)*h>0){var l=r.y+u*(t-r.x);a[0].x=t,a[0].y=l}if((e-r.x)*h>0){var _=r.y+u*(e-r.x);a[2].x=e,a[2].y=_}}if(0!==o){if(c=h/o,(n-r.y)*o>0){var f=r.x+c*(n-r.y);a[3].x=f,a[3].y=n}if((i-r.y)*o>0){var d=r.x+c*(i-r.y);a[1].x=d,a[1].y=i}}}function TX(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 SX(t,e,i,n,r){var s=dX,a=s[0],o=s[1],h=s[2],u=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,AX((i.x-a)/(h-a),(i.y-o)/(u-o),t,e),AX((n.x-a)/(h-a),(n.y-o)/(u-o),t,e+1),AX((r.x-a)/(h-a),(r.y-o)/(u-o),t,e+2)}function AX(t,e,i,n){var r=pX,s=r[0]+(r[2]-r[0])*t,a=r[4]+(r[6]-r[4])*t,o=r[1]+(r[3]-r[1])*t,h=r[5]+(r[7]-r[5])*t,u=i[n];u.u=s+(a-s)*e,u.v=o+(h-o)*e}for(var RX={useModel:!1,createData:function(t){return t.requestRenderData()},updateRenderData:function(t){var e=t.spriteFrame;SL.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*=cX)+(s*=cX);!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,h=i-r,u=n-s,c=dX;c[0]=a,c[1]=o,c[2]=h,c[3]=u;var l=t.fillCenter,_=vX.x=Math.min(Math.max(0,l.x),1)*(h-a)+a,f=vX.y=Math.min(Math.max(0,l.y),1)*(u-o)+o;fX[0].x=fX[3].x=a,fX[1].x=fX[2].x=h,fX[0].y=fX[1].y=o,fX[2].y=fX[3].y=u;for(var d=0,p=yX;d<p.length;d++){var m=p[d];pn.set(m,0,0)}_!==c[0]&&pn.set(yX[0],3,0),_!==c[2]&&pn.set(yX[2],1,2),f!==c[1]&&pn.set(yX[1],0,1),f!==c[3]&&pn.set(yX[3],2,3)}(t),function(t){var e=t.width,i=t.height,n=t.getRect(),r=0,s=0,a=0,o=0,h=pX;t.isRotated()?(r=n.x/e,s=(n.x+n.height)/e,a=n.y/i,o=(n.y+n.width)/i,h[0]=h[2]=r,h[4]=h[6]=s,h[3]=h[7]=o,h[1]=h[5]=a):(r=n.x/e,s=(n.x+n.width)/e,a=n.y/i,o=(n.y+n.height)/i,h[0]=h[4]=r,h[2]=h[6]=s,h[1]=h[3]=o,h[5]=h[7]=a)}(e),EX(dX[0],dX[2],dX[1],dX[3],vX,r,mX),EX(dX[0],dX[2],dX[1],dX[3],vX,r+s,gX);for(var o=0,h=0;h<4;++h){var u=yX[h];if(u)if(s>=cX)i.dataLength=o+3,SX(n,o,vX,fX[u.x],fX[u.y]),o+=3;else{var c=TX(vX,fX[u.x]),l=TX(vX,fX[u.y]);l<c&&(l+=cX),c-=cX,l-=cX;for(var _=0;_<3;++_)c>=a||(c>=r?(i.dataLength=o+3,SX(n,o,vX,fX[u.x],l>=a?gX[h]:fX[u.y]),o+=3):l>r&&(l<=a?(i.dataLength=o+3,SX(n,o,vX,mX[h],fX[u.y]),o+=3):(i.dataLength=o+3,SX(n,o,vX,mX[h],gX[h]),o+=3))),c+=cX,l+=cX}}0===o&&(i.dataLength=0),i.resize(o,o),i.updateRenderData(t,e)}},createQuadIndices:function(t){sX=null,sX=new Uint16Array(t);for(var e=0,i=0;i<t;i++)sX[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,h=0;h<i.indexCount;h++)a[o+h]=r+h;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(_X);for(var i=t.renderData,n=i.floatStride,r=t.renderData.data,s=e.vb,a=i.vertexCount,o=0,h=0;h<a;h++){var u=r[h],c=u.x,l=u.y,_=_X.m03*c+_X.m07*l+_X.m15;_=_?1/_:1,s[o+0]=(_X.m00*c+_X.m04*l+_X.m12)*_,s[o+1]=(_X.m01*c+_X.m05*l+_X.m13)*_,s[o+2]=(_X.m02*c+_X.m06*l+_X.m14)*_,s[o+3]=u.u,s[o+4]=u.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,h=a.g/255,u=a.b/255,c=t.node._uiProps.opacity,l=0;l<r;l++)i[s]=o,i[s+1]=h,i[s+2]=u,i[s+3]=c,s+=n},updateColor:function(){}},CX=Uint16Array.from([0,1,2,1,3,2]),bX={createData:function(t){var e=t.requestRenderData();return e.dataLength=4,e.resize(4,6),e.vertexRow=2,e.vertexCol=2,e.chunk.setIndexBuffer(CX),e},updateRenderData:function(t){var e=t.spriteFrame;SL.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,h=r.length,u=0;u<h;u++){var c=r[u],l=c.x,_=c.y,f=s.m03*l+s.m07*_+s.m15;f=f?1/f:1,n[0+(o=u*a)]=(s.m00*l+s.m04*_+s.m12)*f,n[o+1]=(s.m01*l+s.m05*_+s.m13)*f,n[o+2]=(s.m02*l+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 h=0;h<e.vertexCol-1;h++){var u=n+o*e.vertexCol+h;s[a++]=u,s[a++]=u+1,s[a++]=u+e.vertexCol,s[a++]=u+1,s[a++]=u+1+e.vertexCol,s[a++]=u+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,h=0,u=0,c=0,l=0;if(t.trim)h=-a,u=-o,c=r-a,l=s-o;else{var _=t.spriteFrame,f=_.originalSize,d=r/f.width,p=s/f.height,m=_.trimmedBorder;h=m.x*d-a,u=m.z*p-o,c=r+m.y*d-a,l=s+m.w*p-o}n[0].x=h,n[0].y=u,n[1].x=c,n[1].y=u,n[2].x=h,n[2].y=l,n[3].x=c,n[3].y=l,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,h=r.a/255,u=0;u<4;u++,n+=e.floatStride)i[n]=s,i[n+1]=a,i[n+2]=o,i[n+3]=h}},IX=new cn,wX=[],OX=0;OX<4;OX++)wX.push({x:0,y:0,z:0,u:0,v:0,color:new qi});var xX,NX,DX,MX,PX,LX,BX,FX,UX={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;SL.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,h=t.spriteFrame,u=h.insetLeft,c=h.insetRight,l=h.insetTop,_=h.insetBottom,f=r-u-c,d=s-l-_,p=r/(u+c),m=s/(l+_);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,wX[0].x=-a,wX[0].y=-o,wX[1].x=u*p-a,wX[1].y=_*m-o,wX[2].x=wX[1].x+f,wX[2].y=wX[1].y+d,wX[3].x=r-a,wX[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<wX.length&&v<wX.length&&(i[y].x=wX[v].x,i[y].y=wX[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 h=0;h<3;++h){var u=n+4*o+h;s[a++]=u,s[a++]=u+1,s[a++]=u+4,s[a++]=u+1,s[a++]=u+5,s[a++]=u+4}r.indexOffset=a},updateWorldVertexData:function(t,e){t.node.getWorldMatrix(IX);for(var i=t.renderData,n=i.floatStride,r=i.data,s=e.vb,a=0,o=0;o<4;++o)for(var h=r[4*o],u=0;u<4;++u){var c=r[u].x,l=h.y,_=IX.m03*c+IX.m07*l+IX.m15;_=_?1/_:1,s[0+(a=(4*o+u)*n)]=(IX.m00*c+IX.m04*l+IX.m12)*_,s[a+1]=(IX.m01*c+IX.m05*l+IX.m13)*_,s[a+2]=(IX.m02*c+IX.m06*l+IX.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,h=s.b/255,u=t.node._uiProps.opacity,c=0;c<16;c++)i[r]=a,i[r+1]=o,i[r+2]=h,i[r+3]=u,r+=n}},kX=new cn,GX=0,HX=[];function zX(t){return t&&(t.insetTop>0||t.insetBottom>0||t.insetLeft>0||t.insetRight>0)?2:0}var VX={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,h=i.insetRight,u=a.width-o-h,c=i.insetTop,l=i.insetBottom,_=a.height-c-l,f=r-o-h,d=s-c-l;f=f>0?f:0,d=d>0?d:0;var p=0===u?f:f/u,m=0===_?d:d/_,g=zX(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;FX=null,FX=new Uint16Array(t);for(var i=0,n=0;n<e;n++)FX[i++]=0+4*n,FX[i++]=1+4*n,FX[i++]=2+4*n,FX[i++]=1+4*n,FX[i++]=3+4*n,FX[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,h=0;h<i.indexCount;h+=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(kX);for(var i=t.renderData,n=i.floatStride,r=i.data,s=e.vb,a=r.length,o=0;o<a;o++){var h=r[o].x,u=r[o].y,c=r[o].z,l=kX.m03*h+kX.m07*u+kX.m11*c+kX.m15;l=l?1/l:1;var _=o*n;s[_]=(kX.m00*h+kX.m04*u+kX.m08*c+kX.m12)*l,s[_+1]=(kX.m01*h+kX.m05*u+kX.m09*c+kX.m13)*l,s[_+2]=(kX.m02*h+kX.m06*u+kX.m10*c+kX.m14)*l}this.updateWorldUVData(t)},updateVerts:function(t,e,i,n,r){var s,a,o=t.node._uiProps.uiTransformComp,h=t.renderData.data,u=t.spriteFrame,c=u.rect,l=Math.abs(o.width),_=Math.abs(o.height),f=o.anchorX*l,d=o.anchorY*_,p=u.insetLeft,m=u.insetRight,g=c.width-p-m,v=u.insetTop,y=u.insetBottom,E=c.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,HX.length=0,GX=Math.max(n+1,r+1);for(var A=0;A<GX;A++)HX.push({x:0,y:0,z:0,u:0,v:0,color:new qi});var R=zX(u);if(0===R)for(var C=0;C<GX;C++)HX[C].x=C>=r?l-f:C*g-f,HX[C].y=C>=n?_-d:C*E-d;else for(var b=0;b<GX;b++)0===b?HX[b].x=-f:1===b?HX[b].x=p*T-f:b>1&&b<r-1?HX[b].x=g>0?p*T-f+g*(b-1):p+e-f:b===r-1?HX[b].x=p*T-f+s+g*(b-2):b>=r&&(HX[b].x=Math.min(p+e+m,l)-f),0===b?HX[b].y=-d:1===b?HX[b].y=y*S-d:b>1&&b<n-1?HX[b].y=E>0?y*S-d+E*(b-1):y+i-d:b===n-1?HX[b].y=y*S-d+a+E*(b-2):b>=n&&(HX[b].y=Math.min(y+i+v,_)-d);for(var I=0,w=0,O=0,x=0,N=0;N<n;++N){O=HX[N].y,x=HX[N+1].y;for(var D=0;D<r;++D){I=HX[D].x,w=HX[D+1].x;var M=4*(N*r+D);h[M].x=I,h[M].y=O,h[M+1].x=w,h[M+1].y=O,h[M+2].x=I,h[M+2].y=x,h[M+3].x=w,h[M+3].y=x}}var P=u.rotated;u.uv;var L=u.uvSliced;xX=L[0],NX=L[1],DX=L[2],MX=L[3],PX=L[4],LX=L[8],BX=L[12];for(var B=0,F=0,U=0===g?e:e/g,k=0===E?i:i/E,G=[],H=[],z=0;z<n;++z){F=i>E?i>=(R>0?z:z+1)*E?1:k%1:k;for(var V=0;V<r;++V){B=e>g?e>=(R>0?V:V+1)*g?1:U%1:U,P?(0===R?(G[0]=PX.u,G[1]=PX.u,G[2]=PX.u+(LX.u-PX.u)*F,H[0]=NX.v,H[1]=NX.v+(DX.v-NX.v)*B,H[2]=NX.v):(0===z?(G[0]=xX.u,G[1]=xX.u,G[2]=PX.u):z<n-1?(G[0]=PX.u,G[1]=PX.u,G[2]=PX.u+(LX.u-PX.u)*F):z===n-1&&(G[0]=LX.u,G[1]=LX.u,G[2]=BX.u),0===V?(H[0]=xX.v,H[1]=NX.v,H[2]=xX.v):V<r-1?(H[0]=NX.v,H[1]=NX.v+(DX.v-NX.v)*B,H[2]=NX.v):V===r-1&&(H[0]=DX.v,H[1]=MX.v,H[2]=DX.v)),G[3]=G[2],H[3]=H[1]):(0===R?(G[0]=NX.u,G[1]=NX.u+(DX.u-NX.u)*B,G[2]=NX.u,H[0]=PX.v,H[1]=PX.v,H[2]=PX.v+(LX.v-PX.v)*F):(0===V?(G[0]=xX.u,G[1]=NX.u,G[2]=xX.u):V<r-1?(G[0]=NX.u,G[1]=NX.u+(DX.u-NX.u)*B,G[2]=NX.u):V===r-1&&(G[0]=DX.u,G[1]=MX.u,G[2]=DX.u),0===z?(H[0]=xX.v,H[1]=xX.v,H[2]=PX.v):z<n-1?(H[0]=PX.v,H[1]=PX.v,H[2]=PX.v+(LX.v-PX.v)*F):z===n-1&&(H[0]=LX.v,H[1]=LX.v,H[2]=BX.v)),G[3]=G[1],H[3]=H[2]);var W=4*(z*r+V);h[W].u=G[0],h[W].v=H[0],h[W+1].u=G[1],h[W+1].v=H[1],h[W+2].u=G[2],h[W+2].v=H[2],h[W+3].u=G[3],h[W+3].v=H[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,h=a.g/255,u=a.b/255,c=t.node._uiProps.opacity,l=0;l<r;l++)i[s]=o,i[s+1]=h,i[s+2]=u,i[s+3]=c,s+=n},updateColor:function(){}},WX=WG.Type,XX=WG.FillType,jX=t("spriteAssembler",{getAssembler:function(t){var e=bX,i=t;switch(i.type){case WX.SLICED:e=UX;break;case WX.TILED:e=VX;break;case WX.FILLED:e=i.fillType===XX.RADIAL?RX:uX}return e}});WG.Assembler=jX;var YX=[Rb.EventType.MOUSE_DOWN,Rb.EventType.MOUSE_MOVE,Rb.EventType.MOUSE_UP,Rb.EventType.MOUSE_WHEEL],KX=[Rb.EventType.TOUCH_START,Rb.EventType.TOUCH_MOVE,Rb.EventType.TOUCH_END,Rb.EventType.TOUCH_CANCEL];new(function(){function t(){this.priority=mb.UI,this._isListDirty=!1,this._inDispatchCount=0,this._pointerEventProcessorList=[],this._processorListToAdd=[],this._processorListToRemove=[],Cb._registerEventDispatcher(this),nP.callbacksInvoker.on(QM.ADD_POINTER_EVENT_PROCESSOR,this.addPointerEventProcessor,this),nP.callbacksInvoker.on(QM.REMOVE_POINTER_EVENT_PROCESSOR,this.removePointerEventProcessor,this),nP.callbacksInvoker.on(QM.MARK_LIST_DIRTY,this._markListDirty,this)}var e=t.prototype;return e.dispatchEvent=function(t){var e=t.type;return KX.includes(e)?this.dispatchEventTouch(t):!YX.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),ae(this._processorListToRemove,t)},e.removePointerEventProcessor=function(t){0===this._inDispatchCount?(ae(this._pointerEventProcessorList,t),this._isListDirty=!0):this._processorListToRemove.includes(t)||this._processorListToRemove.push(t),ae(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===FC.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!==FC.TOUCH_END&&t.type!==FC.TOUCH_CANCEL||re(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.uuid)!==(null===(h=s.parent)||void 0===h?void 0:h.uuid);){var o,h,u,c,l,_;r=null===(null===(u=r)||void 0===u||null===(c=u.parent)||void 0===c?void 0:c.parent)?(a=!0)&&n:r&&r.parent,s=null===(null===(l=s)||void 0===l||null===(_=l.parent)||void 0===_?void 0:_.parent)?(a=!0)&&i:s&&s.parent}if(r.uuid===s.uuid){if(r.uuid===n.uuid)return-1;if(r.uuid===i.uuid)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}());var qX=new c_(null),QX=new cn,ZX=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 ZE,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 $X,this._meshDataArray=[],this._maskClearModel=null,this._maskClearMtl=null,this._maskModelMesh=null,this._root=t,this.device=t.device,this._batches=new uu(64),this._drawBatchPool=new ou((function(){return new VV}),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();for(var e,i=f(this._bufferAccessors.values());!(e=i()).done;)e.value.destroy();this._bufferAccessors.clear(),this._drawBatchPool&&this._drawBatchPool.destroy(),this._descriptorSetCache.destroy(),EF.sharedManager.destroy(),this._maskClearModel&&this._maskModelMesh&&(g.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,h=0;h<o.length;h++)o[h].priority=s++;else a.descriptorSet=this._descriptorSetCache.getDescriptorSet(a);r.addBatch(a)}}}},e.uploadBuffers=function(){if(this._batches.length>0){for(var t=this._meshDataArray.length,e=0;e<t;e++)this._meshDataArray[e].uploadBuffers();for(var i,n=f(this._bufferAccessors.values());!(i=n()).done;){var r=i.value;r.uploadBuffers(),r.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))}for(var i,n=f(this._bufferAccessors.values());!(i=n()).done;)i.value.reset();for(var r=this._meshDataArray.length,s=0;s<r;s++)this._meshDataArray[s].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(),EF.sharedManager.reset()},e.switchBufferAccessor=function(t){void 0===t&&(t=JB);var e=t===JB?36:nF(t);if(!this._staticVBBuffer||this._staticVBBuffer.vertexFormatBytes!==e){var i=this._bufferAccessors.get(e);i||(i=new dF(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===hF.ENTER_LEVEL||t.stencilStage===hF.ENTER_LEVEL_INVERTED?this._insertMaskBatch(t):t.stencilStage=EF.sharedManager.stage;var h=t.stencilStage;this._currHash===a&&0!==a&&this._currMaterial===s&&this._currDepthStencilStateStage===h||(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=h,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=EF.sharedManager.stage,s=null!==t.customMaterial?EF.sharedManager.getStencilStage(t.stencilStage,n):EF.sharedManager.getStencilStage(t.stencilStage),a=EF.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===hF.ENTER_LEVEL||t.stencilStage===hF.ENTER_LEVEL_INVERTED?this._insertMaskBatch(t):t.stencilStage=EF.sharedManager.stage,n=EF.sharedManager.getStencilStage(t.stencilStage,i),r=EF.sharedManager.getStencilHash(t.stencilStage));var s=g.director.getTotalFrames();e&&(e.updateTransform(s),e.updateUBOs(s));for(var a=0;a<e.subModels.length;a++){var o=this._drawBatchPool.alloc(),h=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,h.patches),o.inputAssembler=h.inputAssembler,o.model.visFlags=o.visFlags,o.descriptorSet=h.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 h,u=0;t&&(h=null!==t.customMaterial?EF.sharedManager.getStencilStage(t.stencilStage,e):EF.sharedManager.getStencilStage(t.stencilStage),u=EF.sharedManager.getStencilHash(t.stencilStage));var c=this._currStaticRoot?this._currStaticRoot._requireDrawBatch():this._drawBatchPool.alloc();c.visFlags=this._currLayer,c.texture=this._currTexture,c.sampler=this._currSampler,c.inputAssembler=i,c.useLocalData=this._currTransform,c.textureHash=this._currTextureHash,c.samplerHash=this._currSamplerHash,c.fillPasses(e,h,u,null),this._batches.push(c)}}}},e.mergeBatchesForMiddleware=function(t){var e,i;t.stencilStage=EF.sharedManager.stage,e=null!==t.customMaterial?EF.sharedManager.getStencilStage(t.stencilStage,this._currMaterial):EF.sharedManager.getStencilStage(t.stencilStage),i=EF.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.setOpacity(a),!Ei(a,0,vi)){if(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,h=0;h<s.length;++h){if(i=s[h],(n=T_[i.format]).hasAlpha)if(r=t.floatStride,n.size/n.count==1)for(var u=~~Ti(Math.round(255*e),0,255),c=o;c<a.length;c+=r)a[c]=(4294967040&a[c]|u)>>>0;else if(n.size/n.count==4)for(var l=o+3;l<a.length;l+=r)a[l]=e;o+=n.size>>2}}(r.renderData,a);var h=r.renderData.getMeshBuffer();h&&h.setDirty()}if(i.length>0&&!t._static)for(var u=0;u<i.length;++u){var c=i[u];this.walk(c,e)}n.colorDirty&&(this._opacityDirty--,n.colorDirty=!1)}this._pOpacity=s,r&&r.enabledInHierarchy&&(r.postUpdateAssembler(this),(r.stencilStage===hF.ENTER_LEVEL||r.stencilStage===hF.ENTER_LEVEL_INVERTED)&&EF.sharedManager.getMaskStackSize()>0&&(this.autoMergeBatches(this._currComponent),this.resetRenderStates(),EF.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=IE.get("default-clear-stencil"),this._maskClearModel=g.director.root.createModel(SI);var t=nF(QB),e=_f.gfxDevice,i=e.createBuffer(new Ml(Mc.VERTEX|Mc.TRANSFER_DST,Bc.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 Ml(Mc.INDEX|Mc.TRANSFER_DST,Bc.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 _w([i],QB,il.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=EF.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=g.director.getTotalFrames();a&&(a.updateTransform(o),a.updateUBOs(o));for(var h=0;h<a.subModels.length;h++){var u=this._drawBatchPool.alloc(),c=a.subModels[h];u.visFlags=t.node.layer,u.model=a,u.texture=null,u.sampler=null,u.useLocalData=null,i||(i=null),u.fillPasses(s,i,r,c.patches),u.inputAssembler=c.inputAssembler,u.model.visFlags=u.visFlags,u.descriptorSet=c.descriptorSet,this._batches.push(u)}e.enableMask()},e.syncMeshBuffersToNative=function(){},n(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}()),JX=function(){function t(){this._descriptorSet=null,this._transform=null,this._textureHash=0,this._samplerHash=0,this._localBuffer=null,this._transformUpdate=!0;var t=_f.gfxDevice;this._localData=new Float32Array(gg.COUNT),this._localBuffer=t.createBuffer(new Ml(Mc.UNIFORM|Mc.TRANSFER_DST,Bc.HOST|Bc.DEVICE,gg.SIZE,gg.SIZE))}var e=t.prototype;return e.initialize=function(t){var e=_f.gfxDevice;this._transform=t.useLocalData,this._textureHash=t.textureHash,this._samplerHash=t.samplerHash,qX.layout=t.passes[0].localSetLayout,this._descriptorSet=e.createDescriptorSet(qX),this._descriptorSet.bindBuffer(gg.BINDING,this._localBuffer);var i=Ym.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.isTransformDirty())&&(t.updateWorldTransform(),this._transformUpdate=!0),this._transformUpdate){var e=t.worldMatrix;cn.toArray(this._localData,e,gg.MAT_WORLD_OFFSET),cn.invert(QX,e),cn.transpose(QX,QX);var i=cn.determinant(QX),n=1/Math.sqrt(i);cn.multiplyScalar(QX,QX,n),cn.toArray(this._localData,QX,gg.MAT_WORLD_IT_OFFSET),this._localBuffer.update(this._localData),this._transformUpdate=!1}},n(t,[{key:"descriptorSet",get:function(){return this._descriptorSet}}]),t}(),$X=function(){function t(){this._descriptorSetCache=new Map,this._dsCacheHashByTexture=new Map,this._localDescriptorSetCache=[],this._localCachePool=void 0,this._localCachePool=new ou((function(){return new JX}),16,(function(t){return t.destroy()}))}var e=t.prototype;return e.getDescriptorSet=function(t){var e;if(g.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);qX.layout=t.passes[0].localSetLayout;var o=_f.gfxDevice.createDescriptorSet(qX),h=Ym.SAMPLER_SPRITE;return o.bindTexture(h,t.texture),o.bindSampler(h,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.length;if(0!==e){for(var i=[],n=0;n<e;n++){var r=t[n];if(r.isValid())r.uploadLocalData();else{r.reset();var s=t.indexOf(r);i.push(s)}}for(var a=i.length-1;a>=0;a--){var o=i[a],h=t[o];t.splice(o,1),this._localCachePool.free(h)}}},e.reset=function(){for(var t=this._localDescriptorSetCache,e=t.length,i=0;i<e;i++){var n=t[i];this._localCachePool.free(n)}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(){for(var t,e=f(this._descriptorSetCache.values());!(t=e()).done;)t.value.destroy();this._descriptorSetCache.clear(),this._dsCacheHashByTexture.clear(),this._localDescriptorSetCache.length=0,this._localCachePool.destroy()},t}();g.internal.Batcher2D=ZX,t("UIDrawBatch",function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(VV)),rt(cF.prototype,"MeshBuffer",["byteStart","vertexStart","indicesStart","request"].map((function(t){return{name:t,suggest:"please use meshBuffer.accessor."+t+" instead"}}))),it(cF.prototype,"MeshBuffer",[{name:"indicesOffset",newName:"indexOffset"}]),nt(cF.prototype,"MeshBuffer",[{name:"vertexBuffers"},{name:"indexBuffer"}]),it(ZX.prototype,"Batcher2D",[{name:"currBufferBatch",newName:"currBufferAccessor"},{name:"acquireBufferBatch",newName:"switchBufferAccessor"}]),nt(xF.prototype,"MeshRenderData",[{name:"formatByte"},{name:"byteStart"},{name:"byteCount"}]),it(xF.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 s(e,t),e}(xF));var tj,ej=y.document,ij=null,nj=-1,rj="BES bswy:->@123丁ぁᄁ",sj=Object.create(null),aj=[],oj=3e3;function hj(){for(var t=!0,e=Date.now(),i=aj.length-1;i>=0;i--){var n=aj[i],r=n.fontFamilyName;if(e-n.startTime>oj)j(4933,r),n.onComplete(null,r),aj.splice(i,1);else{var s=n.refWidth,a="40px "+r;ij.font=a,s!==BB(ij,rj,a)?(aj.splice(i,1),n.onComplete(null,r)):t=!1}}t&&(clearInterval(nj),nj=-1)}function uj(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(sj[n])i(null,n);else{if(!ij){var r=ej.createElement("canvas");r.width=100,r.height=100,ij=r.getContext("2d")}var s=BB(ij,rj,"40px "+n),a=ej.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+"}",ej.body.appendChild(a);var h=ej.createElement("div"),u=h.style;if(u.fontFamily=n,h.innerHTML=".",u.position="absolute",u.left="-100px",u.top="-100px",ej.body.appendChild(h),function(){if(void 0===tj)if("FontFace"in y){var t=/Gecko.*Firefox\/(\d+)/.exec(y.navigator.userAgent),e=/OS X.*Version\/10\..*Safari/.exec(y.navigator.userAgent)&&/Apple/.exec(y.navigator.vendor);tj=t?parseInt(t[1],10)>42:!e}else tj=!1;return tj}())!function(t,e,i){var n=new Promise((function(i,n){!function r(){Date.now()-t>=oj?n():ej.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,oj)}));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 c={fontFamilyName:n,refWidth:s,onComplete:i,startTime:Date.now()};aj.push(c),-1===nj&&(nj=setInterval(hj,100))}sj[n]=a}}function cj(t,e,i,n){var r=new vB;r._nativeUrl=t,r._nativeAsset=e,n(null,r)}Yy.register({".font":uj,".eot":uj,".ttf":uj,".woff":uj,".svg":uj,".ttc":uj}),sE.register({".font":cj,".eot":cj,".ttf":cj,".woff":cj,".svg":cj,".ttc":cj}),g.UI={MeshBuffer:cF,spriteAssembler:jX,graphicsAssembler:MW,labelAssembler:rX,RenderData:OF,MeshRenderData:xF},yL.on(vL.EVENT_POST_SUBSYSTEM_INIT,(function(){gj.init()}));var lj,_j,fj,dj,pj,mj,gj=t("SortingLayers",function(){function t(){}return t.getSortingPriority=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),(t+32768<<16|e+32768)>>>0},t.getLayerIndex=function(t){void 0===t&&(t=0);var e=0;return this.indexMap.has(t)?e=this.indexMap.get(t):K(2105),e},t.getLayerIndexByName=function(t){var e=this.getLayerByName(t);return this.getLayerIndex(e)},t.getLayerName=function(t){void 0===t&&(t=0);var e="";return this.nameMap.has(t)?e=this.nameMap.get(t):K(2105),e},t.getLayerByName=function(t){for(var e=this.nameMap.size,i=this.nameMap.keys(),n=0,r=0;r<e;r++)if(n=i.next().value,this.nameMap.get(n)===t)return n;return K(2106),0},t.isLayerValid=function(t){return!!this.indexMap.has(t)||(K(2105),!1)},t.getBuiltinLayers=function(){return[{id:0,name:"default",value:0}]},t.init=function(){var e=Ee.querySettings(ye.Category.ENGINE,"sortingLayers");e&&0!==e.length||(e=this.getBuiltinLayers()),t.resetState();for(var i=0;i<e.length;i++){var n=e[i];t.setLayer(n.id,n.name,n.value),t.Enum[n.name]=n.id}fe.update(t.Enum),fe.sortList(t.Enum,(function(e,i){return t.getLayerIndex(e.value)-t.getLayerIndex(i.value)}))},t.setLayer=function(t,e,i){this.nameMap.set(t,e),this.indexMap.set(t,i)},t.resetState=function(){for(var e=Object.keys(t.Enum),i=0;i<e.length;i++)delete t.Enum[t.Enum[e[i]]],delete t.Enum[e[i]];t.indexMap.clear(),t.nameMap.clear()},t}());function vj(t){for(var e=t.scene.batches,i=0;e&&i<e.length;i++){var n=e[i];if(t.visibility&n.visFlags)return!0}return!1}gj.nameMap=new Map,gj.indexMap=new Map,gj.Enum=fe({default:0}),t("Sorting",(lj=bs("cc.Sorting"),_j=sa(gj.Enum),lj(fj=Os((d((dj=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)._sortingLayer=pj&&pj(),e._sortingOrder=mj&&mj(),e._modelRenderer=null,e}s(e,t);var i=e.prototype;return i.__preload=function(){this._modelRenderer=this.getComponent("cc.ModelRenderer"),this._modelRenderer||j(16301,this.node.name),this._updateSortingPriority()},i._updateSortingPriority=function(){var t=gj.getLayerIndex(this._sortingLayer),e=gj.getSortingPriority(t,this._sortingOrder);this._modelRenderer&&this._modelRenderer.isValid&&(this._modelRenderer.priority=e)},n(e,[{key:"sortingLayer",get:function(){return this._sortingLayer},set:function(t){t!==this._sortingLayer&&gj.isLayerValid(t)&&(this._sortingLayer=t,this._updateSortingPriority())}},{key:"sortingOrder",get:function(){return this._sortingOrder},set:function(t){t!==this._sortingOrder&&(this._sortingOrder=Ti(t,-32768,32767),this._updateSortingPriority())}}]),e}(Wd)).prototype,"sortingLayer",[_j],Object.getOwnPropertyDescriptor(dj.prototype,"sortingLayer"),dj.prototype),pj=gs(dj.prototype,"_sortingLayer",[Ls],(function(){return gj.Enum.default})),mj=gs(dj.prototype,"_sortingOrder",[Ls],(function(){return 0})),fj=dj))||fj)||fj)),g.log=L,g.warn=B,g.error=F,g.assert=U,g._throw=H,g.logID=W,g.warnID=j,g.errorID=K,g.assertID=Z,g.debug=ot,g.path={join:Zu,extname:Ju,mainFileName:$u,basename:tc,dirname:ec,changeExtname:ic,changeBasename:nc,_normalize:rc,stripSep:sc,get sep(){return ac()}};var yj=function(t,e,i,n,r){this.camera=void 0,this.id=4294967295,this.windowID=4294967295,this.width=0,this.height=0,this.camera=t,this.id=e,this.windowID=i,this.width=n,this.height=r},Ej=new Map,Tj=new Map;function Sj(t){var e=Tj.get(t.window);return void 0===e&&(e=Tj.size,Tj.set(t.window,e)),e}function Aj(t,e,i,n){var r=Ej.get(e);if(void 0!==r)return e.window.width,e.window.height,Sj(e),n(t,r),r;var s=Sj(e);return i(t,r=new yj(e,Ej.size,s,e.window.width?e.window.width:1,e.window.height?e.window.height:1)),Ej.set(e,r),r}function Rj(t,e,i,n){var r=i,s=n,a=e,o=t.device;if(!t.containsResource(a)){var h=Sv(o)?xc.R32F:xc.RGBA8;t.addRenderTarget(a,h,r,s,wI.MANAGED),t.addDepthStencil(a+"Depth",xc.DEPTH_STENCIL,r,s,wI.MANAGED)}t.updateRenderTarget(a,r,s),t.updateDepthStencil(a+"Depth",r,s)}var Cj=new Sw;function bj(t,e){var i=e.camera;mw(t,i);var n=t,r=n.pipelineSceneData.shadows,s=t.pipelineSceneData.validPunctualLights,a=t.pipelineSceneData.shadows;if(Cj.reset(),!r.enabled||r.type!==$E.ShadowMap)return Cj;Cj.shadowEnabled=!0;for(var o=Cj.validLights,h=0,u=0;h<r.maxReceived&&u<s.length;){var c=s[u];c.type===yI.SPOT&&c.shadowEnabled&&(o.push(c),h++),u++}var l=i.scene.mainLight,_=a.size.x,f=a.size.y;if(l&&l.shadowEnabled)if(Cj.mainLightShadowNames[0]="MainLightShadow"+e.id,l.shadowFixedArea)Rj(t,Cj.mainLightShadowNames[0],_,f);else{var d=n.pipelineSceneData.csmSupported?l.csmLevel:1;Cj.mainLightShadowNames[0]="MainLightShadow"+e.id;for(var p=0;p<d;p++)Rj(t,Cj.mainLightShadowNames[0],_,f)}for(var m=0;m<o.length;m++){o[m];var g="SpotLightShadow"+m.toString()+e.id;Cj.spotLightShadowNames[m]=g,Rj(t,Cj.spotLightShadowNames[m],_,f)}return Cj}var Ij,wj=bj;function Oj(t,e,i,n,r,s,a){var o=s,h=a,u=Ew(i,s,a,n,r);s=u.width,a=u.height;var c=t;r||((Ij=e.addRenderPass(s,a,"default")).name=t,Ij.setViewport(new wl(0,0,o,h)),Ij.addRenderTarget(c,Zc.CLEAR,Jc.STORE,new Ol(1,1,1,i.clearColor.w)),Ij.addDepthStencil(c+"Depth",Zc.CLEAR,Jc.DISCARD,i.clearDepth,i.clearStencil,_l.DEPTH_STENCIL));var l=Ij.addQueue(OI.RENDER_OPAQUE,"shadow-caster");l.addSceneOfCamera(i,new sw(n,r),MI.SHADOW_CASTER),l.setViewport(new wl(u.x,u.y,u.width,u.height))}function xj(t,e){if(Cj.shadowEnabled){var i=e.camera,n=t.pipelineSceneData.shadows,r=n.size.x,s=n.size.y,a=i.scene.mainLight;if(a&&a.shadowEnabled)if(Cj.mainLightShadowNames[0]="MainLightShadow"+e.id,a.shadowFixedArea)Oj(Cj.mainLightShadowNames[0],t,i,a,0,r,s);else{var o=t.pipelineSceneData.csmSupported?a.csmLevel:1;Cj.mainLightShadowNames[0]="MainLightShadow"+e.id;for(var h=0;h<o;h++)Oj(Cj.mainLightShadowNames[0],t,i,a,h,r,s)}for(var u=0;u<Cj.validLights.length;u++){var c=Cj.validLights[u],l="SpotLightShadow"+u.toString()+e.id;Cj.spotLightShadowNames[u]=l,Oj(l,t,i,c,0,r,s)}}}function Nj(t,e,i){var n=Ew(e.camera,e.camera.window.width,e.camera.window.height),r=n.width,s=n.height,a=t.addRenderPass(r,s,"default"),o=e.camera;a.addRenderTarget(i,Zc.LOAD,Jc.STORE),a.addDepthStencil(Lj.ds,Zc.LOAD,Jc.DISCARD);for(var h,u=f(Cj.mainLightShadowNames);!(h=u()).done;){var c=h.value;t.containsResource(c)&&a.addTexture(c,"cc_shadowMap")}for(var l,_=f(Cj.spotLightShadowNames);!(l=_()).done;){var d=l.value;t.containsResource(d)&&a.addTexture(d,"cc_spotShadowMap")}a.addQueue(OI.RENDER_OPAQUE,"deferred-forward").addSceneOfCamera(o,new sw,MI.OPAQUE_OBJECT|MI.PLANAR_SHADOW|MI.CUTOUT_OBJECT|MI.DEFAULT_LIGHTING|MI.DRAW_INSTANCING),a.addQueue(OI.RENDER_TRANSPARENT,"deferred-forward").addSceneOfCamera(o,new sw,MI.TRANSPARENT_OBJECT|MI.GEOMETRY)}function Dj(t,e,i,n){void 0===i&&(i=!1),void 0===n&&(n=!0),xj(t,e);var r=e.id,s=Ew(e.camera,e.camera.window.width,e.camera.window.height),a=s.width,o=s.height,h=t.addRenderPass(a,o,"default");h.name="ForwardPass"+r,h.setViewport(new wl(s.x,s.y,a,o));for(var u,c=f(Cj.mainLightShadowNames);!(u=c()).done;){var l=u.value;t.containsResource(l)&&h.addTexture(l,"cc_shadowMap")}for(var _,d=f(Cj.spotLightShadowNames);!(_=d()).done;){var p=_.value;t.containsResource(p)&&h.addTexture(p,"cc_spotShadowMap")}var m=e.camera;h.addRenderTarget("ForwardColor"+e.id,i?Zc.CLEAR:yw(m.clearFlag,LI.RENDER_TARGET),Jc.STORE,new Ol(m.clearColor.x,m.clearColor.y,m.clearColor.z,m.clearColor.w)),h.addDepthStencil("ForwardDepthStencil"+e.id,i?Zc.CLEAR:yw(m.clearFlag,LI.DEPTH_STENCIL),i?Jc.DISCARD:Jc.STORE,m.clearDepth,m.clearStencil,m.clearFlag),h.addQueue(OI.RENDER_OPAQUE).addSceneOfCamera(m,new sw,MI.OPAQUE_OBJECT|MI.PLANAR_SHADOW|MI.CUTOUT_OBJECT|MI.DEFAULT_LIGHTING|MI.DRAW_INSTANCING);var g=MI.TRANSPARENT_OBJECT|MI.GEOMETRY;return i||(g|=MI.UI,h.showStatistics=!0),n&&h.addQueue(OI.RENDER_TRANSPARENT).addSceneOfCamera(m,new sw,g),{rtName:"ForwardColor"+e.id,dsName:"ForwardDepthStencil"+e.id}}var Mj,Pj,Lj=new function(){this.color=void 0,this.normal=void 0,this.emissive=void 0,this.ds=void 0};function Bj(t,e){var i=e.camera,n=Ew(i,i.window.width,i.window.height),r=n.width,s=n.height,a=Lj.color,o=Lj.normal,h=Lj.emissive,u=Lj.ds,c=t.addRenderPass(r,s,"gbuffer");c.name="CameraGBufferPass"+e.id,c.setViewport(new wl(n.x,n.y,r,s));var l=new Ol(0,0,0,0);return i.clearFlag&_l.COLOR&&(t.pipelineSceneData.isHDR?FE(l,i.clearColor):(l.x=i.clearColor.x,l.y=i.clearColor.y,l.z=i.clearColor.z)),c.addRenderTarget(a,Zc.CLEAR,Jc.STORE,l),c.addRenderTarget(h,Zc.CLEAR,Jc.STORE,new Ol(0,0,0,0)),c.addRenderTarget(o,Zc.CLEAR,Jc.STORE,new Ol(0,0,0,0)),c.addDepthStencil(u,Zc.CLEAR,Jc.STORE,i.clearDepth,i.clearStencil,i.clearFlag),c.addQueue(OI.RENDER_OPAQUE,"gbuffer").addSceneOfCamera(i,new sw,MI.OPAQUE_OBJECT|MI.CUTOUT_OBJECT),c}function Fj(t,e,i){xj(t,e),Mj||(Mj=new Aw(i));var n=t,r=e.camera,s=Ew(r,r.window.width,r.window.height),a=s.width,o=s.height,h=vw(r),u="deferredLightingPassRTName"+e.id,c=n.addRenderPass(a,o,"deferred-lighting");c.name="CameraLightingPass"+e.id,c.setViewport(new wl(s.x,s.y,a,o));for(var l,_=f(Cj.mainLightShadowNames);!(l=_()).done;){var d=l.value;n.containsResource(d)&&c.addTexture(d,"cc_shadowMap")}for(var p,m=f(Cj.spotLightShadowNames);!(p=m()).done;){var g=p.value;n.containsResource(g)&&c.addTexture(g,"cc_spotShadowMap")}n.containsResource(Lj.color)&&(c.addTexture(Lj.color,"albedoMap"),c.addTexture(Lj.normal,"normalMap"),c.addTexture(Lj.emissive,"emissiveMap"),c.addTexture(Lj.ds,"depthStencil"));var v="clusterLightBuffer"+h,y="clusterLightIndicesBuffer"+h,E="clusterLightGridBuffer"+h;n.containsResource(v)&&(c.addStorageBuffer(v,BI.READ,"b_ccLightsBuffer"),c.addStorageBuffer(y,BI.READ,"b_clusterLightIndicesBuffer"),c.addStorageBuffer(E,BI.READ,"b_clusterLightGridBuffer"));var T=new Ol(0,0,0,0);return r.clearFlag&_l.COLOR&&(T.x=r.clearColor.x,T.y=r.clearColor.y,T.z=r.clearColor.z),T.w=0,c.addRenderTarget(u,Zc.CLEAR,Jc.STORE,T),c.addQueue(OI.RENDER_TRANSPARENT).addCameraQuad(r,Mj.deferredLightingMaterial,0,MI.VOLUMETRIC_LIGHTING),{rtName:u}}function Uj(t,e,i){Pj||(Pj=new Tw);var n=e.id,r=e.camera,s=Ew(r,r.window.width,r.window.height),a=s.width,o=s.height,h="postprocessPassRTName"+n,u="postprocessPassDS"+n,c=t.addRenderPass(a,o,"post-process");c.name="CameraPostprocessPass"+n,c.setViewport(new wl(s.x,s.y,s.width,s.height)),t.containsResource(i)&&c.addTexture(i,"outputResultMap");var l=new Ol(0,0,0,r.clearColor.w);return r.clearFlag&_l.COLOR&&(l.x=r.clearColor.x,l.y=r.clearColor.y,l.z=r.clearColor.z),c.addRenderTarget(h,yw(r.clearFlag,LI.RENDER_TARGET),Jc.STORE,l),c.addDepthStencil(u,yw(r.clearFlag,LI.DEPTH_STENCIL),Jc.STORE,r.clearDepth,r.clearStencil,r.clearFlag),c.addQueue(OI.NONE).addCameraQuad(r,Pj.postMaterial,0,MI.NONE),KE()===r&&(c.showStatistics=!0),{rtName:h,dsName:u}}function kj(t,e){var i=e.camera,n=Ew(i,i.window.width,i.window.height),r=n.width,s=n.height,a="dsUIAndProfilerPassColor"+e.id,o="dsUIAndProfilerPassDS"+e.id,h=t.addRenderPass(r,s,"default");h.name="CameraUIAndProfilerPass"+e.id,h.setViewport(new wl(n.x,n.y,r,s)),h.addRenderTarget(a,yw(i.clearFlag,LI.RENDER_TARGET),Jc.STORE,new Ol(i.clearColor.x,i.clearColor.y,i.clearColor.z,i.clearColor.w)),h.addDepthStencil(o,yw(i.clearFlag,LI.DEPTH_STENCIL),Jc.STORE,i.clearDepth,i.clearStencil,i.clearFlag);var u=MI.UI;h.addQueue(OI.RENDER_TRANSPARENT).addSceneOfCamera(i,new sw,u),KE()===i&&(h.showStatistics=!0)}new Ol(0,0,0,0),t("ForwardPipelineBuilder",function(){function t(){}var e=t.prototype;return e.setup=function(t,e){for(var i=0;i<t.length;i++){var n=t[i];null!==n.scene&&(e.update(n),Dj(e,Aj(e,n,this.initResource,this.updateResource)))}},e.initResource=function(t,e){!function(t,e,i){void 0===i&&(i=!1);var n=e.camera,r=Ew(n,n.window.width,n.window.height),s=r.width,a=r.height;bj(t,e),i?t.addRenderTarget("ForwardColor"+e.id,function(t){var e=t.getMacroBool("CC_USE_FLOAT_OUTPUT");return t.pipelineSceneData.isHDR&&e&&Av(t.device)?xc.RGBA16F:xc.RGBA8}(t),s,a,wI.PERSISTENT):t.addRenderWindow("ForwardColor"+e.id,xc.BGRA8,s,a,e.camera.window),t.addDepthStencil("ForwardDepthStencil"+e.id,xc.DEPTH_STENCIL,s,a)}(t,e)},e.updateResource=function(t,e){!function(t,e,i){void 0===i&&(i=!1);var n=e.camera,r=Ew(n,n.window.width,n.window.height),s=r.width,a=r.height;wj(t,e),i?t.updateRenderTarget("ForwardColor"+e.id,s,a):t.updateRenderWindow("ForwardColor"+e.id,e.camera.window),t.updateDepthStencil("ForwardDepthStencil"+e.id,s,a)}(t,e)},t}()),t("DeferredPipelineBuilder",function(){function t(){}var e=t.prototype;return e.setup=function(t,e){for(var i=0;i<t.length;++i){var n=t[i];if(n.scene){e.update(n);var r=e.device.hasFeature(Oc.COMPUTE_SHADER),s=n.cameraUsage===Pb.GAME||n.cameraUsage===Pb.GAME_VIEW,a=Aj(e,n,this.initResource,this.updateResource);if(s)if(vj(n))kj(e,a);else{r&&Bw(n,e),Bj(e,a);var o=Fj(e,a,r);Nj(e,a,o.rtName),Uj(e,a,o.rtName)}else Dj(e,a)}}},e.initResource=function(t,e){vj(e.camera)?function(t,e){var i=e.camera,n=Ew(i,i.window.width,i.window.height),r=n.width,s=n.height,a="dsUIAndProfilerPassColor"+e.id,o="dsUIAndProfilerPassDS"+e.id;t.addRenderWindow(a,xc.BGRA8,r,s,i.window),t.addDepthStencil(o,xc.DEPTH_STENCIL,r,s,wI.MANAGED)}(t,e):(function(t,e){var i=e.camera,n=Ew(i,i.window.width,i.window.height),r=n.width,s=n.height,a="gBufferPassColorCamera"+e.id,o="gBufferPassNormal"+e.id,h="gBufferPassEmissive"+e.id,u="gBufferPassDSCamera"+e.id,c=xc.RGBA16F;t.addRenderTarget(a,c,r,s,wI.MANAGED),t.addRenderTarget(h,c,r,s,wI.MANAGED),t.addRenderTarget(o,c,r,s,wI.MANAGED),t.addDepthStencil(u,xc.DEPTH_STENCIL,r,s,wI.MANAGED),Lj.color=a,Lj.normal=o,Lj.emissive=h,Lj.ds=u}(t,e),function(t,e){bj(t,e);var i=e.camera,n=Ew(i,i.window.width,i.window.height),r=n.width,s=n.height,a="deferredLightingPassRTName"+e.id;t.addRenderTarget(a,xc.RGBA8,r,s,wI.MANAGED)}(t,e),function(t,e){var i=e.id,n=e.camera,r=Ew(n,n.window.width,n.window.height),s=r.width,a=r.height,o="postprocessPassRTName"+i,h="postprocessPassDS"+i;t.addRenderWindow(o,xc.BGRA8,s,a,n.window),t.addDepthStencil(h,xc.DEPTH_STENCIL,s,a,wI.MANAGED)}(t,e))},e.updateResource=function(t,e){vj(e.camera)?function(t,e){var i=e.camera,n=Ew(i,i.window.width,i.window.height),r=n.width,s=n.height,a="dsUIAndProfilerPassColor"+e.id,o="dsUIAndProfilerPassDS"+e.id;t.updateRenderWindow(a,i.window),t.updateDepthStencil(o,r,s)}(t,e):(function(t,e){var i=e.camera,n=Ew(i,i.window.width,i.window.height),r=n.width,s=n.height,a="gBufferPassColorCamera"+e.id,o="gBufferPassNormal"+e.id,h="gBufferPassEmissive"+e.id,u="gBufferPassDSCamera"+e.id;t.updateRenderTarget(a,r,s),t.updateRenderTarget(h,r,s),t.updateRenderTarget(o,r,s),t.updateDepthStencil(u,r,s)}(t,e),function(t,e){wj(t,e);var i=e.camera,n=Ew(i,i.window.width,i.window.height),r=n.width,s=n.height,a="deferredLightingPassRTName"+e.id;t.updateRenderTarget(a,r,s)}(t,e),function(t,e){var i=e.id,n=e.camera,r=Ew(n,n.window.width,n.window.height),s=r.width,a=r.height,o="postprocessPassRTName"+i,h="postprocessPassDS"+i;t.updateRenderWindow(o,n.window),t.updateDepthStencil(h,s,a)}(t,e))},t}());var Gj=Ta.Flags.Destroyed,Hj=Ta.Flags.PersistentMask,zj=[];function Vj(t){var e;if(Sa(t)){if(t._instantiate)return g.game._isCloning=!0,e=t._instantiate(null,!0),g.game._isCloning=!1,e;if(t instanceof g.Asset)throw new TypeError(J(6903))}return g.game._isCloning=!0,e=Wj(t),g.game._isCloning=!1,e}function Wj(t,e){var i;Xj(t,i=t._iN$t?t._iN$t:t.constructor?new(0,t.constructor):Object.create(null),e);for(var n=0,r=zj.length;n<r;++n)zj[n]._iN$t=null;return zj.length=0,i}function Xj(t,e,i){At(t,"_iN$t",e,!0),zj.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 h=i[a];h instanceof ve&&h.constructor===o.constructor?h.set(o):i[a]=o._iN$t||jj(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||jj(s,i)}else e[r]=s}Sa(t)&&(e._objFlags&=Hj)}function jj(t,e){if(t instanceof ve)return t.clone();if(t instanceof g.Asset)return t;var i;if(ArrayBuffer.isView(t)){var n=t.length;i=new t.constructor(n),t._iN$t=i,zj.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,zj.push(t);for(var a=0;a<s;++a){var o=t[a];i[a]="object"==typeof o&&o?o._iN$t||jj(o,e):o}return i}if(t._objFlags&Gj)return null;var h=t.constructor;if(li(h)){if(e)if(e instanceof g.Component){if(t instanceof g.Node||t instanceof g.Component)return t}else if(e instanceof g.Node)if(t instanceof g.Node){if(!t.isChildOf(e))return t}else if(t instanceof g.Component&&t.node&&!t.node.isChildOf(e))return t;i=new h}else if(h===Object)i={};else{if(h)return t;i=Object.create(null)}return Xj(t,i,e),i}Vj._clone=Wj,g.instantiate=Vj;var Yj,Kj,qj=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}());g.NodePool=qj;var Qj=null!==(Yj=globalThis.jsb)&&void 0!==Yj?Yj:{};t("native",{DownloaderHints:Qj.DownloaderHints,Downloader:Qj.Downloader,zipUtils:Qj.zipUtils,fileUtils:Qj.fileUtils,DebugRenderer:Qj.DebugRenderer,copyTextToClipboard:null===(Kj=Qj.copyTextToClipboard)||void 0===Kj?void 0:Kj.bind(Qj),garbageCollect:Qj.garbageCollect,reflection:Qj.reflection,bridge:Qj.bridge,jsbBridgeWrapper:Qj.jsbBridgeWrapper,AssetsManager:Qj.AssetsManager,EventAssetsManager:Qj.EventAssetsManager,Manifest:Qj.Manifest,saveImageData:Qj.saveImageData,process:Qj.process}),g.renderer=Mk;var Zj,Jj=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}s(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],h=0;h<o.count;h++)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&S_){var i=this._buffers[e];i&&(t[e].gpuBuffer=i.gpuBuffer||i.gpuBufferView)}else t[e].type&A_&&(this._textures[e]&&(t[e].gpuTexture=this._textures[e].gpuTexture),this._samplers[e]&&(t[e].gpuSampler=this._samplers[e].gpuSampler));this._isDirty=!1}},n(e,[{key:"gpuDescriptorSet",get:function(){return this._gpuDescriptorSet}}]),e}(H_);!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"}(Zj||(Zj={}));var $j=function(){function t(){}return t.setInstance=function(e){t._instance=e},n(t,null,[{key:"instance",get:function(){return t._instance}}]),t}();function tY(t,e){switch(t){case xc.R8:return e.UNSIGNED_BYTE;case xc.R8SN:return e.BYTE;case xc.R8UI:return e.UNSIGNED_BYTE;case xc.R8I:return e.BYTE;case xc.R16F:return Zj.HALF_FLOAT_OES;case xc.R16UI:return e.UNSIGNED_SHORT;case xc.R16I:return e.SHORT;case xc.R32F:return e.FLOAT;case xc.R32UI:return e.UNSIGNED_INT;case xc.R32I:return e.INT;case xc.RG8:return e.UNSIGNED_BYTE;case xc.RG8SN:return e.BYTE;case xc.RG8UI:return e.UNSIGNED_BYTE;case xc.RG8I:return e.BYTE;case xc.RG16F:return Zj.HALF_FLOAT_OES;case xc.RG16UI:return e.UNSIGNED_SHORT;case xc.RG16I:return e.SHORT;case xc.RG32F:return e.FLOAT;case xc.RG32UI:return e.UNSIGNED_INT;case xc.RG32I:return e.INT;case xc.RGB8:case xc.SRGB8:return e.UNSIGNED_BYTE;case xc.RGB8SN:return e.BYTE;case xc.RGB8UI:return e.UNSIGNED_BYTE;case xc.RGB8I:return e.BYTE;case xc.RGB16F:return Zj.HALF_FLOAT_OES;case xc.RGB16UI:return e.UNSIGNED_SHORT;case xc.RGB16I:return e.SHORT;case xc.RGB32F:return e.FLOAT;case xc.RGB32UI:return e.UNSIGNED_INT;case xc.RGB32I:return e.INT;case xc.BGRA8:case xc.RGBA8:case xc.SRGB8_A8:return e.UNSIGNED_BYTE;case xc.RGBA8SN:return e.BYTE;case xc.RGBA8UI:return e.UNSIGNED_BYTE;case xc.RGBA8I:return e.BYTE;case xc.RGBA16F:return Zj.HALF_FLOAT_OES;case xc.RGBA16UI:return e.UNSIGNED_SHORT;case xc.RGBA16I:return e.SHORT;case xc.RGBA32F:return e.FLOAT;case xc.RGBA32UI:return e.UNSIGNED_INT;case xc.RGBA32I:return e.INT;case xc.R5G6B5:return e.UNSIGNED_SHORT_5_6_5;case xc.R11G11B10F:return e.FLOAT;case xc.RGB5A1:return e.UNSIGNED_SHORT_5_5_5_1;case xc.RGBA4:return e.UNSIGNED_SHORT_4_4_4_4;case xc.RGB10A2:return e.UNSIGNED_BYTE;case xc.RGB10A2UI:return e.UNSIGNED_INT;case xc.RGB9E5:return e.UNSIGNED_BYTE;case xc.DEPTH:return e.UNSIGNED_INT;case xc.DEPTH_STENCIL:return Zj.UNSIGNED_INT_24_8_WEBGL;case xc.BC1:case xc.BC1_SRGB:case xc.BC2:case xc.BC2_SRGB:case xc.BC3:case xc.BC3_SRGB:case xc.BC4:return e.UNSIGNED_BYTE;case xc.BC4_SNORM:return e.BYTE;case xc.BC5:return e.UNSIGNED_BYTE;case xc.BC5_SNORM:return e.BYTE;case xc.BC6H_SF16:case xc.BC6H_UF16:return e.FLOAT;case xc.BC7:case xc.BC7_SRGB:case xc.ETC_RGB8:case xc.ETC2_RGB8:case xc.ETC2_SRGB8:case xc.ETC2_RGB8_A1:case xc.ETC2_SRGB8_A1:case xc.EAC_R11:return e.UNSIGNED_BYTE;case xc.EAC_R11SN:return e.BYTE;case xc.EAC_RG11:return e.UNSIGNED_BYTE;case xc.EAC_RG11SN:return e.BYTE;case xc.PVRTC_RGB2:case xc.PVRTC_RGBA2:case xc.PVRTC_RGB4:case xc.PVRTC_RGBA4:case xc.PVRTC2_2BPP:case xc.PVRTC2_4BPP:return e.UNSIGNED_BYTE;case xc.ASTC_RGBA_4X4:case xc.ASTC_RGBA_5X4:case xc.ASTC_RGBA_5X5:case xc.ASTC_RGBA_6X5:case xc.ASTC_RGBA_6X6:case xc.ASTC_RGBA_8X5:case xc.ASTC_RGBA_8X6:case xc.ASTC_RGBA_8X8:case xc.ASTC_RGBA_10X5:case xc.ASTC_RGBA_10X6:case xc.ASTC_RGBA_10X8:case xc.ASTC_RGBA_10X10:case xc.ASTC_RGBA_12X10:case xc.ASTC_RGBA_12X12:case xc.ASTC_SRGBA_4X4:case xc.ASTC_SRGBA_5X4:case xc.ASTC_SRGBA_5X5:case xc.ASTC_SRGBA_6X5:case xc.ASTC_SRGBA_6X6:case xc.ASTC_SRGBA_8X5:case xc.ASTC_SRGBA_8X6:case xc.ASTC_SRGBA_8X8:case xc.ASTC_SRGBA_10X5:case xc.ASTC_SRGBA_10X6:case xc.ASTC_SRGBA_10X8:case xc.ASTC_SRGBA_10X10:case xc.ASTC_SRGBA_12X10:case xc.ASTC_SRGBA_12X12:default:return e.UNSIGNED_BYTE}}function eY(t,e){switch(t){case Dc.BOOL:return e.BOOL;case Dc.BOOL2:return e.BOOL_VEC2;case Dc.BOOL3:return e.BOOL_VEC3;case Dc.BOOL4:return e.BOOL_VEC4;case Dc.INT:return e.INT;case Dc.INT2:return e.INT_VEC2;case Dc.INT3:return e.INT_VEC3;case Dc.INT4:return e.INT_VEC4;case Dc.UINT:return e.UNSIGNED_INT;case Dc.FLOAT:return e.FLOAT;case Dc.FLOAT2:return e.FLOAT_VEC2;case Dc.FLOAT3:return e.FLOAT_VEC3;case Dc.FLOAT4:return e.FLOAT_VEC4;case Dc.MAT2:return e.FLOAT_MAT2;case Dc.MAT3:return e.FLOAT_MAT3;case Dc.MAT4:return e.FLOAT_MAT4;case Dc.SAMPLER2D:return e.SAMPLER_2D;case Dc.SAMPLER_CUBE:return e.SAMPLER_CUBE;default:return console.error("Unsupported GLType, convert to GL type failed."),Dc.UNKNOWN}}function iY(t){switch(t){case Dc.BOOL:case Dc.BOOL2:case Dc.BOOL3:case Dc.BOOL4:case Dc.INT:case Dc.INT2:case Dc.INT3:case Dc.INT4:case Dc.UINT:return Int32Array;case Dc.FLOAT:case Dc.FLOAT2:case Dc.FLOAT3:case Dc.FLOAT4:case Dc.MAT2:case Dc.MAT3:case Dc.MAT4:return Float32Array;default:return console.error("Unsupported GLType, convert to TypedArrayConstructor failed."),Float32Array}}function nY(t,e){switch(t){case e.BOOL:return Dc.BOOL;case e.BOOL_VEC2:return Dc.BOOL2;case e.BOOL_VEC3:return Dc.BOOL3;case e.BOOL_VEC4:return Dc.BOOL4;case e.INT:return Dc.INT;case e.INT_VEC2:return Dc.INT2;case e.INT_VEC3:return Dc.INT3;case e.INT_VEC4:return Dc.INT4;case e.UNSIGNED_INT:return Dc.UINT;case e.FLOAT:return Dc.FLOAT;case e.FLOAT_VEC2:return Dc.FLOAT2;case e.FLOAT_VEC3:return Dc.FLOAT3;case e.FLOAT_VEC4:return Dc.FLOAT4;case e.FLOAT_MAT2:return Dc.MAT2;case e.FLOAT_MAT3:return Dc.MAT3;case e.FLOAT_MAT4:return Dc.MAT4;case e.SAMPLER_2D:return Dc.SAMPLER2D;case e.SAMPLER_CUBE:return Dc.SAMPLER_CUBE;default:return console.error("Unsupported GLType, convert to Type failed."),Dc.UNKNOWN}}function rY(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 sY(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}}$j._instance=null;var aY,oY=[512,513,514,515,516,517,518,519],hY=[0,7680,7681,7682,7683,5386,34055,34056],uY=[32774,32778,32779,32775,32776],cY=[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.BLIT_TEXTURE=6]="BLIT_TEXTURE",t[t.COUNT=7]="COUNT"}(aY||(aY={}));var lY=function(t){this.cmdType=void 0,this.refCount=0,this.cmdType=t},_Y=function(t){function e(){var e;return(e=t.call(this,aY.BEGIN_RENDER_PASS)||this).gpuRenderPass=null,e.gpuFramebuffer=null,e.renderArea=new Tl,e.clearFlag=_l.NONE,e.clearColors=[],e.clearDepth=1,e.clearStencil=0,e}return s(e,t),e.prototype.clear=function(){this.gpuFramebuffer=null,this.clearColors.length=0},e}(lY),fY=function(t){function e(){var e;return(e=t.call(this,aY.BIND_STATES)||this).gpuPipelineState=null,e.gpuInputAssembler=null,e.gpuDescriptorSets=[],e.dynamicOffsets=[],e.dynamicStates=new y_,e}return s(e,t),e.prototype.clear=function(){this.gpuPipelineState=null,this.gpuDescriptorSets.length=0,this.gpuInputAssembler=null,this.dynamicOffsets.length=0},e}(lY),dY=function(t){function e(){var e;return(e=t.call(this,aY.DRAW)||this).drawInfo=new Ll,e}return s(e,t),e.prototype.clear=function(){},e}(lY),pY=function(t){function e(){var e;return(e=t.call(this,aY.UPDATE_BUFFER)||this).gpuBuffer=null,e.buffer=null,e.offset=0,e.size=0,e}return s(e,t),e.prototype.clear=function(){this.gpuBuffer=null,this.buffer=null},e}(lY),mY=function(t){function e(){var e;return(e=t.call(this,aY.COPY_BUFFER_TO_TEXTURE)||this).gpuTexture=null,e.buffers=[],e.regions=[],e}return s(e,t),e.prototype.clear=function(){this.gpuTexture=null,this.buffers.length=0,this.regions.length=0},e}(lY),gY=function(t){function e(){var e;return(e=t.call(this,aY.BLIT_TEXTURE)||this).srcTexture=null,e.dstTexture=null,e.regions=[],e.filter=Vc.LINEAR,e}return s(e,t),e.prototype.clear=function(){this.srcTexture=null,this.dstTexture=null,this.regions.length=0},e}(lY),vY=function(){function t(){this.cmds=new uu(1),this.beginRenderPassCmds=new uu(1),this.bindStatesCmds=new uu(1),this.drawCmds=new uu(1),this.updateBufferCmds=new uu(1),this.copyBufferToTextureCmds=new uu(1),this.blitTextureCmds=new uu(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.blitTextureCmds.length&&(t.blitTextureCmdPool.freeCmds(this.blitTextureCmds),this.blitTextureCmds.clear()),this.cmds.clear()},t}();function yY(t,e){var i=t.gl,n=t.stateCache,r=e.memUsage&Bc.HOST?i.DYNAMIC_DRAW:i.STATIC_DRAW;if(e.usage&Mc.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),bY.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&Mc.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),bY.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&Mc.UNIFORM?(e.glTarget=i.NONE,e.buffer&&(e.vf32=new Float32Array(e.buffer.buffer))):(e.usage&Mc.INDIRECT||e.usage&Mc.TRANSFER_DST||e.usage&Mc.TRANSFER_SRC||console.error("Unsupported BufferType, create buffer failed."),e.glTarget=i.NONE)}function EY(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),bY.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),bY.gpuInputAssembler=null,i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,null),t.stateCache.glElementArrayBuffer=null}i.deleteBuffer(e.glBuffer),e.glBuffer=null}}function TY(t,e,i,n,r){if(e.usage&Mc.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&Mc.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,h=t.gl,u=t.stateCache;switch(e.glTarget){case h.ARRAY_BUFFER:t.extensions.useVAO&&u.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),u.glVAO=null),bY.gpuInputAssembler=null,t.stateCache.glArrayBuffer!==e.glBuffer&&(h.bindBuffer(h.ARRAY_BUFFER,e.glBuffer),t.stateCache.glArrayBuffer=e.glBuffer);break;case h.ELEMENT_ARRAY_BUFFER:t.extensions.useVAO&&u.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),u.glVAO=null),bY.gpuInputAssembler=null,t.stateCache.glElementArrayBuffer!==e.glBuffer&&(h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,e.glBuffer),t.stateCache.glElementArrayBuffer=e.glBuffer);break;default:return void console.error("Unsupported BufferType, update buffer failed.")}r===o.byteLength?h.bufferSubData(e.glTarget,n,o):h.bufferSubData(e.glTarget,n,o.slice(0,r))}}function SY(t,e){for(var i=t.gl,n=function(){var t=e.gpuStages[r],n=0,s="",a=1;switch(t.type){case Qc.VERTEX:s="VertexShader",n=i.VERTEX_SHADER;break;case Qc.FRAGMENT:s="FragmentShader",n=i.FRAGMENT_SHADER;break;default:return console.error("Unsupported ShaderType."),{v:void 0}}var o=i.createShader(n);if(o&&(t.glShader=o,i.shaderSource(t.glShader,t.source),i.compileShader(t.glShader),!i.getShaderParameter(t.glShader,i.COMPILE_STATUS))){console.error(s+" in '"+e.name+"' compilation failed."),console.error("Shader source dump:",t.source.replace(/^|\n/g,(function(){return"\n"+a+++" "}))),console.error(i.getShaderInfoLog(t.glShader));for(var h=0;h<e.gpuStages.length;h++){var u=e.gpuStages[r];u.glShader&&(i.deleteShader(u.glShader),u.glShader=null)}return{v:void 0}}},r=0;r<e.gpuStages.length;r++){var s=n();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 h=e.gpuStages[o];i.attachShader(e.glProgram,h.glShader)}if(i.linkProgram(e.glProgram),t.extensions.destroyShadersImmediately)for(var u=0;u<e.gpuStages.length;u++){var c=e.gpuStages[u];c.glShader&&(i.detachShader(e.glProgram,c.glShader),i.deleteShader(c.glShader),c.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));k("Shader '"+e.name+"' compilation succeeded.");var l=i.getProgramParameter(e.glProgram,i.ACTIVE_ATTRIBUTES);e.glInputs=new Array(l);for(var _=0;_<l;++_){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),v=nY(f.type,i),y=rY(f.type,i);e.glInputs[_]={binding:m,name:d,type:v,stride:y,count:f.size,size:y*f.size,glType:f.type,glLoc:m}}}if(e.blocks.length>0){e.glBlocks=new Array(e.blocks.length);for(var E=0;E<e.blocks.length;++E){var T=e.blocks[E],S={set:T.set,binding:T.binding,name:T.name,size:0,glUniforms:new Array(T.members.length),glActiveUniforms:[]};e.glBlocks[E]=S;for(var A=0;A<T.members.length;++A){var R=T.members[A],C=eY(R.type,i),b=rY(C,i),I=b*R.count;S.glUniforms[A]={binding:-1,name:R.name,type:R.type,stride:b,count:R.count,size:I,offset:0,glType:C,glLoc:null,array:null}}}}for(var w=0;w<e.subpassInputs.length;++w){var O=e.subpassInputs[w];e.samplerTextures.push(new Vl(O.set,O.binding,O.name,Dc.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 N=e.samplerTextures[x];e.glSamplerTextures[x]={set:N.set,binding:N.binding,name:N.name,type:N.type,count:N.count,units:[],glUnits:null,glType:eY(N.type,i),glLoc:null}}}for(var D=i.getProgramParameter(e.glProgram,i.ACTIVE_UNIFORMS),M=0;M<D;++M){var P=i.getActiveUniform(e.glProgram,M);if(P&&P.type!==i.SAMPLER_2D&&P.type!==i.SAMPLER_CUBE){var L=i.getUniformLocation(e.glProgram,P.name);if(t.extensions.isLocationActive(L)){var B,F=P.name.indexOf("[");B=-1!==F?P.name.substr(0,F):P.name;for(var U=0;U<e.glBlocks.length;U++)for(var G=e.glBlocks[U],H=0;H<G.glUniforms.length;H++){var z=G.glUniforms[H];if(z.name===B){z.glLoc=L,z.count=P.size,z.size=z.stride*z.count,z.array=new(iY(z.type))(z.size/4),G.glActiveUniforms.push(z);break}}}}}for(var V=0;V<e.glBlocks.length;V++)for(var W=e.glBlocks[V],X=0;X<W.glUniforms.length;X++){var j=W.glUniforms[X];j.offset=W.size/4,W.size+=j.size}var Y=[],K=[],q=t.bindingMappings,Q=t.stateCache.texUnitCacheMap;if(g.rendering&&g.rendering.enableEffectImport)for(var Z=0;Z<e.samplerTextures.length;++Z){var J=e.samplerTextures[Z],$=i.getUniformLocation(e.glProgram,J.name);t.extensions.isLocationActive($)&&(Y.push(e.glSamplerTextures[Z]),K.push($)),void 0===Q[J.name]&&(Q[J.name]=J.flattened%t.capabilities.maxTextureUnits)}else{for(var tt=0,et=0;et<e.blocks.length;++et)e.blocks[et].set===q.flexibleSet&&tt++;for(var it=0,nt=0;nt<e.samplerTextures.length;++nt){var rt=e.samplerTextures[nt],st=i.getUniformLocation(e.glProgram,rt.name);if(t.extensions.isLocationActive(st)&&(Y.push(e.glSamplerTextures[nt]),K.push(st)),void 0===Q[rt.name]){var at=rt.binding+q.samplerTextureOffsets[rt.set]+it;rt.set===q.flexibleSet&&(at-=tt),Q[rt.name]=at%t.capabilities.maxTextureUnits,it+=rt.count-1}}}if(Y.length){for(var ot=[],ht=0;ht<Y.length;++ht){var ut=Y[ht],ct=Q[ut.name];if(void 0!==ct){ut.glLoc=K[ht];for(var lt=0;lt<ut.count;++lt){for(;ot[ct];)ct=(ct+1)%t.capabilities.maxTextureUnits;ut.units.push(ct),ot[ct]=!0}}}for(var _t=0,ft=0;ft<Y.length;++ft){var dt=Y[ft];if(!t.extensions.isLocationActive(dt.glLoc)){dt.glLoc=K[ft];for(var pt=0;pt<dt.count;++pt){for(;ot[_t];)_t=(_t+1)%t.capabilities.maxTextureUnits;void 0===Q[dt.name]&&(Q[dt.name]=_t),dt.units.push(_t),ot[_t]=!0}}}t.stateCache.glProgram!==e.glProgram&&i.useProgram(e.glProgram);for(var mt=0;mt<Y.length;mt++){var gt=Y[mt];gt.glUnits=new Int32Array(gt.units),i.uniform1iv(gt.glLoc,gt.glUnits)}t.stateCache.glProgram!==e.glProgram&&i.useProgram(t.stateCache.glProgram)}for(var vt=0;vt<e.glBlocks.length;)e.glBlocks[vt].glActiveUniforms.length?vt++:(e.glBlocks[vt]=e.glBlocks[e.glBlocks.length-1],e.glBlocks.length--);e.glSamplerTextures=Y}}function AY(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}}function RY(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],h=tY(s.format,i),u=T_[s.format].size;e.glAttribs[r]={name:s.name,glBuffer:o.glBuffer,glType:h,size:u,count:T_[s.format].count,stride:o.stride,componentCount:sY(h,i),isNormalized:void 0!==s.isNormalized&&s.isNormalized,isInstanced:void 0!==s.isInstanced&&s.isInstanced,offset:n[a]},n[a]+=u}}function CY(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()}var bY={gpuPipelineState:null,gpuInputAssembler:null,glPrimitive:0},IY=new Tl;function wY(t,e,i,n,r,s,a){var o=t.gl,h=t.stateCache,u=0;if(i&&(IY.x=n.x<<i.lodLevel,IY.y=n.y<<i.lodLevel,IY.width=n.width<<i.lodLevel,IY.height=n.height<<i.lodLevel),i&&e){h.glFramebuffer!==i.glFramebuffer&&(o.bindFramebuffer(o.FRAMEBUFFER,i.glFramebuffer),h.glFramebuffer=i.glFramebuffer),h.viewport.left===IY.x&&h.viewport.top===IY.y&&h.viewport.width===IY.width&&h.viewport.height===IY.height||(o.viewport(IY.x,IY.y,IY.width,IY.height),h.viewport.left=IY.x,h.viewport.top=IY.y,h.viewport.width=IY.width,h.viewport.height=IY.height),h.scissorRect.x===IY.x&&h.scissorRect.y===IY.y&&h.scissorRect.width===IY.width&&h.scissorRect.height===IY.height||(o.scissor(IY.x,IY.y,IY.width,IY.height),h.scissorRect.x=IY.x,h.scissorRect.y=IY.y,h.scissorRect.width=IY.width,h.scissorRect.height=IY.height);var c=r.length;t.extensions.WEBGL_draw_buffers||(c=1);for(var l=0;l<c;++l){var _=e.colorAttachments[l];if(_.format!==xc.UNKNOWN)switch(_.loadOp){case Zc.LOAD:break;case Zc.CLEAR:h.bs.targets[0].blendColorMask!==qc.ALL&&o.colorMask(!0,!0,!0,!0);var f=r[0];o.clearColor(f.x,f.y,f.z,f.w),u|=o.COLOR_BUFFER_BIT;break;case Zc.DISCARD:}}if(e.depthStencilAttachment&&e.depthStencilAttachment.format!==xc.UNKNOWN){switch(e.depthStencilAttachment.depthLoadOp){case Zc.LOAD:break;case Zc.CLEAR:h.dss.depthWrite||o.depthMask(!0),o.clearDepth(s),u|=o.DEPTH_BUFFER_BIT;break;case Zc.DISCARD:}if(T_[e.depthStencilAttachment.format].hasStencil)switch(e.depthStencilAttachment.stencilLoadOp){case Zc.LOAD:break;case Zc.CLEAR:h.dss.stencilWriteMaskFront||o.stencilMaskSeparate(o.FRONT,65535),h.dss.stencilWriteMaskBack||o.stencilMaskSeparate(o.BACK,65535),o.clearStencil(a),u|=o.STENCIL_BUFFER_BIT;break;case Zc.DISCARD:}}if(u&&o.clear(u),u&o.COLOR_BUFFER_BIT){var d=h.bs.targets[0].blendColorMask;if(d!==qc.ALL){var p=(d&qc.R)!==qc.NONE,m=(d&qc.G)!==qc.NONE,g=(d&qc.B)!==qc.NONE,v=(d&qc.A)!==qc.NONE;o.colorMask(p,m,g,v)}}u&o.DEPTH_BUFFER_BIT&&!h.dss.depthWrite&&o.depthMask(!1),u&o.STENCIL_BUFFER_BIT&&(h.dss.stencilWriteMaskFront||o.stencilMaskSeparate(o.FRONT,0),h.dss.stencilWriteMaskBack||o.stencilMaskSeparate(o.BACK,0))}}function OY(t,e,i,n,r,s){var a,o,h,u=t.gl,c=t.stateCache,l=e&&e.gpuShader,_=!1;if(e&&bY.gpuPipelineState!==e){if(bY.gpuPipelineState=e,bY.glPrimitive=e.glPrimitive,e.gpuShader){var f=e.gpuShader.glProgram;c.glProgram!==f&&(u.useProgram(f),c.glProgram=f,_=!0)}var d=e.rs;if(d){if(c.rs.cullMode!==d.cullMode){switch(d.cullMode){case sl.NONE:u.disable(u.CULL_FACE);break;case sl.FRONT:u.enable(u.CULL_FACE),u.cullFace(u.FRONT);break;case sl.BACK:u.enable(u.CULL_FACE),u.cullFace(u.BACK)}c.rs.cullMode=d.cullMode}var p=d.isFrontFaceCCW;c.rs.isFrontFaceCCW!==p&&(u.frontFace(p?u.CCW:u.CW),c.rs.isFrontFaceCCW=p),c.rs.depthBias===d.depthBias&&c.rs.depthBiasSlop===d.depthBiasSlop||(u.polygonOffset(d.depthBias,d.depthBiasSlop),c.rs.depthBias=d.depthBias,c.rs.depthBiasSlop=d.depthBiasSlop),c.rs.lineWidth!==d.lineWidth&&(u.lineWidth(d.lineWidth),c.rs.lineWidth=d.lineWidth)}var m=e.dss;m&&(c.dss.depthTest!==m.depthTest&&(m.depthTest?u.enable(u.DEPTH_TEST):u.disable(u.DEPTH_TEST),c.dss.depthTest=m.depthTest),c.dss.depthWrite!==m.depthWrite&&(u.depthMask(m.depthWrite),c.dss.depthWrite=m.depthWrite),c.dss.depthFunc!==m.depthFunc&&(u.depthFunc(oY[m.depthFunc]),c.dss.depthFunc=m.depthFunc),c.dss.stencilTestFront===m.stencilTestFront&&c.dss.stencilTestBack===m.stencilTestBack||(m.stencilTestFront||m.stencilTestBack?u.enable(u.STENCIL_TEST):u.disable(u.STENCIL_TEST),c.dss.stencilTestFront=m.stencilTestFront,c.dss.stencilTestBack=m.stencilTestBack),c.dss.stencilFuncFront===m.stencilFuncFront&&c.dss.stencilRefFront===m.stencilRefFront&&c.dss.stencilReadMaskFront===m.stencilReadMaskFront||(u.stencilFuncSeparate(u.FRONT,oY[m.stencilFuncFront],m.stencilRefFront,m.stencilReadMaskFront),c.dss.stencilFuncFront=m.stencilFuncFront,c.dss.stencilRefFront=m.stencilRefFront,c.dss.stencilReadMaskFront=m.stencilReadMaskFront),c.dss.stencilFailOpFront===m.stencilFailOpFront&&c.dss.stencilZFailOpFront===m.stencilZFailOpFront&&c.dss.stencilPassOpFront===m.stencilPassOpFront||(u.stencilOpSeparate(u.FRONT,hY[m.stencilFailOpFront],hY[m.stencilZFailOpFront],hY[m.stencilPassOpFront]),c.dss.stencilFailOpFront=m.stencilFailOpFront,c.dss.stencilZFailOpFront=m.stencilZFailOpFront,c.dss.stencilPassOpFront=m.stencilPassOpFront),c.dss.stencilWriteMaskFront!==m.stencilWriteMaskFront&&(u.stencilMaskSeparate(u.FRONT,m.stencilWriteMaskFront),c.dss.stencilWriteMaskFront=m.stencilWriteMaskFront),c.dss.stencilFuncBack===m.stencilFuncBack&&c.dss.stencilRefBack===m.stencilRefBack&&c.dss.stencilReadMaskBack===m.stencilReadMaskBack||(u.stencilFuncSeparate(u.BACK,oY[m.stencilFuncBack],m.stencilRefBack,m.stencilReadMaskBack),c.dss.stencilFuncBack=m.stencilFuncBack,c.dss.stencilRefBack=m.stencilRefBack,c.dss.stencilReadMaskBack=m.stencilReadMaskBack),c.dss.stencilFailOpBack===m.stencilFailOpBack&&c.dss.stencilZFailOpBack===m.stencilZFailOpBack&&c.dss.stencilPassOpBack===m.stencilPassOpBack||(u.stencilOpSeparate(u.BACK,hY[m.stencilFailOpBack],hY[m.stencilZFailOpBack],hY[m.stencilPassOpBack]),c.dss.stencilFailOpBack=m.stencilFailOpBack,c.dss.stencilZFailOpBack=m.stencilZFailOpBack,c.dss.stencilPassOpBack=m.stencilPassOpBack),c.dss.stencilWriteMaskBack!==m.stencilWriteMaskBack&&(u.stencilMaskSeparate(u.BACK,m.stencilWriteMaskBack),c.dss.stencilWriteMaskBack=m.stencilWriteMaskBack));var g=e.bs;if(g){c.bs.isA2C!==g.isA2C&&(g.isA2C?u.enable(u.SAMPLE_ALPHA_TO_COVERAGE):u.disable(u.SAMPLE_ALPHA_TO_COVERAGE),c.bs.isA2C=g.isA2C),c.bs.blendColor.x===g.blendColor.x&&c.bs.blendColor.y===g.blendColor.y&&c.bs.blendColor.z===g.blendColor.z&&c.bs.blendColor.w===g.blendColor.w||(u.blendColor(g.blendColor.x,g.blendColor.y,g.blendColor.z,g.blendColor.w),c.bs.blendColor.x=g.blendColor.x,c.bs.blendColor.y=g.blendColor.y,c.bs.blendColor.z=g.blendColor.z,c.bs.blendColor.w=g.blendColor.w);var v=g.targets[0],y=c.bs.targets[0];y.blend!==v.blend&&(v.blend?u.enable(u.BLEND):u.disable(u.BLEND),y.blend=v.blend),y.blendEq===v.blendEq&&y.blendAlphaEq===v.blendAlphaEq||(u.blendEquationSeparate(uY[v.blendEq],uY[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||(u.blendFuncSeparate(cY[v.blendSrc],cY[v.blendDst],cY[v.blendSrcAlpha],cY[v.blendDstAlpha]),y.blendSrc=v.blendSrc,y.blendDst=v.blendDst,y.blendSrcAlpha=v.blendSrcAlpha,y.blendDstAlpha=v.blendDstAlpha),y.blendColorMask!==v.blendColorMask&&(u.colorMask((v.blendColorMask&qc.R)!==qc.NONE,(v.blendColorMask&qc.G)!==qc.NONE,(v.blendColorMask&qc.B)!==qc.NONE,(v.blendColorMask&qc.A)!==qc.NONE),y.blendColorMask=v.blendColorMask)}}if(e&&e.gpuPipelineLayout&&l){for(var E=l.glBlocks.length,T=e.gpuPipelineLayout.dynamicOffsetIndices,S=0;S<E;S++){var A=l.glBlocks[S],R=n[A.set],C=R&&R.descriptorIndices[A.binding],b=C>=0&&R.gpuDescriptors[C],I=null,w=0;if(b&&b.gpuBuffer){var O=b.gpuBuffer,x=T[A.set],N=x&&x[A.binding];N>=0&&(w=r[N]),"vf32"in O?I=O.vf32:(w+=O.offset,I=O.gpuBuffer.vf32),w>>=2}if(I)for(var D=A.glActiveUniforms.length,M=0;M<D;M++){var P=A.glActiveUniforms[M];switch(P.glType){case u.BOOL:case u.INT:for(var L=0;L<P.array.length;++L){var B=P.offset+w+L;if(I[B]!==P.array[L]){for(var F=L,U=B;F<P.array.length;++F,++U)P.array[F]=I[U];u.uniform1iv(P.glLoc,P.array);break}}break;case u.BOOL_VEC2:case u.INT_VEC2:for(var k=0;k<P.array.length;++k){var G=P.offset+w+k;if(I[G]!==P.array[k]){for(var H=k,z=G;H<P.array.length;++H,++z)P.array[H]=I[z];u.uniform2iv(P.glLoc,P.array);break}}break;case u.BOOL_VEC3:case u.INT_VEC3:for(var V=0;V<P.array.length;++V){var W=P.offset+w+V;if(I[W]!==P.array[V]){for(var X=V,j=W;X<P.array.length;++X,++j)P.array[X]=I[j];u.uniform3iv(P.glLoc,P.array);break}}break;case u.BOOL_VEC4:case u.INT_VEC4:for(var Y=0;Y<P.array.length;++Y){var K=P.offset+w+Y;if(I[K]!==P.array[Y]){for(var q=Y,Q=K;q<P.array.length;++q,++Q)P.array[q]=I[Q];u.uniform4iv(P.glLoc,P.array);break}}break;case u.FLOAT:for(var Z=0;Z<P.array.length;++Z){var J=P.offset+w+Z;if(I[J]!==P.array[Z]){for(var $=Z,tt=J;$<P.array.length;++$,++tt)P.array[$]=I[tt];u.uniform1fv(P.glLoc,P.array);break}}break;case u.FLOAT_VEC2:for(var et=0;et<P.array.length;++et){var it=P.offset+w+et;if(I[it]!==P.array[et]){for(var nt=et,rt=it;nt<P.array.length;++nt,++rt)P.array[nt]=I[rt];u.uniform2fv(P.glLoc,P.array);break}}break;case u.FLOAT_VEC3:for(var st=0;st<P.array.length;++st){var at=P.offset+w+st;if(I[at]!==P.array[st]){for(var ot=st,ht=at;ot<P.array.length;++ot,++ht)P.array[ot]=I[ht];u.uniform3fv(P.glLoc,P.array);break}}break;case u.FLOAT_VEC4:for(var ut=0;ut<P.array.length;++ut){var ct=P.offset+w+ut;if(I[ct]!==P.array[ut]){for(var lt=ut,_t=ct;lt<P.array.length;++lt,++_t)P.array[lt]=I[_t];u.uniform4fv(P.glLoc,P.array);break}}break;case u.FLOAT_MAT2:for(var ft=0;ft<P.array.length;++ft){var dt=P.offset+w+ft;if(I[dt]!==P.array[ft]){for(var pt=ft,mt=dt;pt<P.array.length;++pt,++mt)P.array[pt]=I[mt];u.uniformMatrix2fv(P.glLoc,!1,P.array);break}}break;case u.FLOAT_MAT3:for(var gt=0;gt<P.array.length;++gt){var vt=P.offset+w+gt;if(I[vt]!==P.array[gt]){for(var yt=gt,Et=vt;yt<P.array.length;++yt,++Et)P.array[yt]=I[Et];u.uniformMatrix3fv(P.glLoc,!1,P.array);break}}break;case u.FLOAT_MAT4:for(var Tt=0;Tt<P.array.length;++Tt){var St=P.offset+w+Tt;if(I[St]!==P.array[Tt]){for(var At=Tt,Rt=St;At<P.array.length;++At,++Rt)P.array[At]=I[Rt];u.uniformMatrix4fv(P.glLoc,!1,P.array);break}}}}}for(var Ct=l.glSamplerTextures.length,bt=0;bt<Ct;bt++)for(var It=l.glSamplerTextures[bt],wt=n[It.set],Ot=wt&&wt.descriptorIndices[It.binding],xt=Ot>=0&&wt.gpuDescriptors[Ot],Nt=It.units.length,Dt=0;Dt<Nt;Dt++){var Mt=It.units[Dt];if(xt&&xt.gpuSampler){if(xt.gpuTexture&&xt.gpuTexture.size>0){var Pt=xt.gpuTexture,Lt=c.glTexUnits[Mt];Lt.glTexture!==Pt.glTexture&&(c.texUnit!==Mt&&(u.activeTexture(u.TEXTURE0+Mt),c.texUnit=Mt),Pt.glTexture?u.bindTexture(Pt.glTarget,Pt.glTexture):u.bindTexture(Pt.glTarget,t.nullTex2D.gpuTexture.glTexture),Lt.glTexture=Pt.glTexture);var Bt=xt.gpuSampler;Pt.isPowerOf2?(a=Bt.glWrapS,o=Bt.glWrapT):(a=u.CLAMP_TO_EDGE,o=u.CLAMP_TO_EDGE),h=Pt.isPowerOf2?Pt.mipLevel<=1&&(Bt.glMinFilter===u.LINEAR_MIPMAP_NEAREST||Bt.glMinFilter===u.LINEAR_MIPMAP_LINEAR)?u.LINEAR:Bt.glMinFilter:Bt.glMinFilter===u.LINEAR||Bt.glMinFilter===u.LINEAR_MIPMAP_NEAREST||Bt.glMinFilter===u.LINEAR_MIPMAP_LINEAR?u.LINEAR:u.NEAREST,Pt.glWrapS!==a&&(c.texUnit!==Mt&&(u.activeTexture(u.TEXTURE0+Mt),c.texUnit=Mt),u.texParameteri(Pt.glTarget,u.TEXTURE_WRAP_S,a),Pt.glWrapS=a),Pt.glWrapT!==o&&(c.texUnit!==Mt&&(u.activeTexture(u.TEXTURE0+Mt),c.texUnit=Mt),u.texParameteri(Pt.glTarget,u.TEXTURE_WRAP_T,o),Pt.glWrapT=o),Pt.glMinFilter!==h&&(c.texUnit!==Mt&&(u.activeTexture(u.TEXTURE0+Mt),c.texUnit=Mt),u.texParameteri(Pt.glTarget,u.TEXTURE_MIN_FILTER,h),Pt.glMinFilter=h),Pt.glMagFilter!==Bt.glMagFilter&&(c.texUnit!==Mt&&(u.activeTexture(u.TEXTURE0+Mt),c.texUnit=Mt),u.texParameteri(Pt.glTarget,u.TEXTURE_MAG_FILTER,Bt.glMagFilter),Pt.glMagFilter=Bt.glMagFilter)}xt=wt.gpuDescriptors[++Ot]}}}if(i&&l&&(_||bY.gpuInputAssembler!==i)){bY.gpuInputAssembler=i;var Ft=t.extensions.ANGLE_instanced_arrays;if(t.extensions.useVAO){var Ut=t.extensions.OES_vertex_array_object,kt=i.glVAOs.get(l.glProgram);if(!kt){var Gt;kt=Ut.createVertexArrayOES(),i.glVAOs.set(l.glProgram,kt),Ut.bindVertexArrayOES(kt),u.bindBuffer(u.ARRAY_BUFFER,null),u.bindBuffer(u.ELEMENT_ARRAY_BUFFER,null),c.glArrayBuffer=null,c.glElementArrayBuffer=null;for(var Ht=l.glInputs.length,zt=0;zt<Ht;zt++){var Vt=l.glInputs[zt];Gt=null;for(var Wt=i.glAttribs.length,Xt=0;Xt<Wt;Xt++){var jt=i.glAttribs[Xt];if(jt.name===Vt.name){Gt=jt;break}}if(Gt){c.glArrayBuffer!==Gt.glBuffer&&(u.bindBuffer(u.ARRAY_BUFFER,Gt.glBuffer),c.glArrayBuffer=Gt.glBuffer);for(var Yt=0;Yt<Gt.componentCount;++Yt){var Kt=Vt.glLoc+Yt,qt=Gt.offset+Gt.size*Yt;u.enableVertexAttribArray(Kt),c.glCurrentAttribLocs[Kt]=!0,u.vertexAttribPointer(Kt,Gt.count,Gt.glType,Gt.isNormalized,Gt.stride,qt),Ft&&Ft.vertexAttribDivisorANGLE(Kt,Gt.isInstanced?1:0)}}}var Qt=i.gpuIndexBuffer;Qt&&u.bindBuffer(u.ELEMENT_ARRAY_BUFFER,Qt.glBuffer),Ut.bindVertexArrayOES(null),u.bindBuffer(u.ARRAY_BUFFER,null),u.bindBuffer(u.ELEMENT_ARRAY_BUFFER,null),c.glArrayBuffer=null,c.glElementArrayBuffer=null}c.glVAO!==kt&&(Ut.bindVertexArrayOES(kt),c.glVAO=kt)}else{for(var Zt=0;Zt<t.capabilities.maxVertexAttributes;++Zt)c.glCurrentAttribLocs[Zt]=!1;for(var Jt=l.glInputs.length,$t=0;$t<Jt;$t++){for(var te=l.glInputs[$t],ee=null,ie=i.glAttribs.length,ne=0;ne<ie;ne++){var re=i.glAttribs[ne];if(re.name===te.name){ee=re;break}}if(ee){c.glArrayBuffer!==ee.glBuffer&&(u.bindBuffer(u.ARRAY_BUFFER,ee.glBuffer),c.glArrayBuffer=ee.glBuffer);for(var se=0;se<ee.componentCount;++se){var ae=te.glLoc+se,oe=ee.offset+ee.size*se;!c.glEnabledAttribLocs[ae]&&ae>=0&&(u.enableVertexAttribArray(ae),c.glEnabledAttribLocs[ae]=!0),c.glCurrentAttribLocs[ae]=!0,u.vertexAttribPointer(ae,ee.count,ee.glType,ee.isNormalized,ee.stride,oe),Ft&&Ft.vertexAttribDivisorANGLE(ae,ee.isInstanced?1:0)}}}var he=i.gpuIndexBuffer;he&&c.glElementArrayBuffer!==he.glBuffer&&(u.bindBuffer(u.ELEMENT_ARRAY_BUFFER,he.glBuffer),c.glElementArrayBuffer=he.glBuffer);for(var ue=0;ue<t.capabilities.maxVertexAttributes;++ue)c.glEnabledAttribLocs[ue]!==c.glCurrentAttribLocs[ue]&&(u.disableVertexAttribArray(ue),c.glEnabledAttribLocs[ue]=!1)}}if(e&&e.dynamicStates.length)for(var ce=e.dynamicStates.length,le=0;le<ce;le++)switch(e.dynamicStates[le]){case al.LINE_WIDTH:c.rs.lineWidth!==s.lineWidth&&(u.lineWidth(s.lineWidth),c.rs.lineWidth=s.lineWidth);break;case al.DEPTH_BIAS:c.rs.depthBias===s.depthBiasConstant&&c.rs.depthBiasSlop===s.depthBiasSlope||(u.polygonOffset(s.depthBiasConstant,s.depthBiasSlope),c.rs.depthBias=s.depthBiasConstant,c.rs.depthBiasSlop=s.depthBiasSlope);break;case al.BLEND_CONSTANTS:var _e=s.blendConstant;c.bs.blendColor.x===_e.x&&c.bs.blendColor.y===_e.y&&c.bs.blendColor.z===_e.z&&c.bs.blendColor.w===_e.w||(u.blendColor(_e.x,_e.y,_e.z,_e.w),c.bs.blendColor.copy(_e));break;case al.STENCIL_WRITE_MASK:var fe=s.stencilStatesFront,de=s.stencilStatesBack;c.dss.stencilWriteMaskFront!==fe.writeMask&&(u.stencilMaskSeparate(u.FRONT,fe.writeMask),c.dss.stencilWriteMaskFront=fe.writeMask),c.dss.stencilWriteMaskBack!==de.writeMask&&(u.stencilMaskSeparate(u.BACK,de.writeMask),c.dss.stencilWriteMaskBack=de.writeMask);break;case al.STENCIL_COMPARE_MASK:var pe=s.stencilStatesFront,me=s.stencilStatesBack;c.dss.stencilRefFront===pe.reference&&c.dss.stencilReadMaskFront===pe.compareMask||(u.stencilFuncSeparate(u.FRONT,oY[c.dss.stencilFuncFront],pe.reference,pe.compareMask),c.dss.stencilRefFront=pe.reference,c.dss.stencilReadMaskFront=pe.compareMask),c.dss.stencilRefBack===me.reference&&c.dss.stencilReadMaskBack===me.compareMask||(u.stencilFuncSeparate(u.BACK,oY[c.dss.stencilFuncBack],me.reference,me.compareMask),c.dss.stencilRefBack=me.reference,c.dss.stencilReadMaskBack=me.compareMask)}}function xY(t,e){var i=t.gl,n=t.extensions,r=n.ANGLE_instanced_arrays,s=n.WEBGL_multi_draw,a=bY.gpuInputAssembler,o=bY.glPrimitive;if(a){var h=a.gpuIndexBuffer;if(a.gpuIndirectBuffer){var u=a.gpuIndirectBuffer.indirects;if(u.drawByIndex){for(var c=0;c<u.drawCount;c++)u.byteOffsets[c]=u.offsets[c]*h.stride;if(s)u.instancedDraw?s.multiDrawElementsInstancedWEBGL(o,u.counts,0,a.glIndexType,u.byteOffsets,0,u.instances,0,u.drawCount):s.multiDrawElementsWEBGL(o,u.counts,0,a.glIndexType,u.byteOffsets,0,u.drawCount);else for(var l=0;l<u.drawCount;l++)u.instances[l]&&r?r.drawElementsInstancedANGLE(o,u.counts[l],a.glIndexType,u.byteOffsets[l],u.instances[l]):i.drawElements(o,u.counts[l],a.glIndexType,u.byteOffsets[l])}else if(s)u.instancedDraw?s.multiDrawArraysInstancedWEBGL(o,u.offsets,0,u.counts,0,u.instances,0,u.drawCount):s.multiDrawArraysWEBGL(o,u.offsets,0,u.counts,0,u.drawCount);else for(var _=0;_<u.drawCount;_++)u.instances[_]&&r?r.drawArraysInstancedANGLE(o,u.offsets[_],u.counts[_],u.instances[_]):i.drawArrays(o,u.offsets[_],u.counts[_])}else if(e.instanceCount&&r)if(h){if(e.indexCount>0){var f=e.firstIndex*h.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(h){if(e.indexCount>0){var d=e.firstIndex*h.stride;i.drawElements(o,e.indexCount,a.glIndexType,d)}}else e.vertexCount>0&&i.drawArrays(o,e.firstVertex,e.vertexCount)}}var NY=new Array(aY.COUNT);function DY(t,e){NY.fill(0);for(var i=0;i<e.cmds.length;++i){var n=e.cmds.array[i],r=NY[n]++;switch(n){case aY.BEGIN_RENDER_PASS:var s=e.beginRenderPassCmds.array[r];wY(t,s.gpuRenderPass,s.gpuFramebuffer,s.renderArea,s.clearColors,s.clearDepth,s.clearStencil);break;case aY.BIND_STATES:var a=e.bindStatesCmds.array[r];OY(t,a.gpuPipelineState,a.gpuInputAssembler,a.gpuDescriptorSets,a.dynamicOffsets,a.dynamicStates);break;case aY.DRAW:xY(t,e.drawCmds.array[r].drawInfo);break;case aY.UPDATE_BUFFER:var o=e.updateBufferCmds.array[r];TY(t,o.gpuBuffer,o.buffer,o.offset,o.size);break;case aY.COPY_BUFFER_TO_TEXTURE:var h=e.copyBufferToTextureCmds.array[r];LY(t,h.buffers,h.gpuTexture,h.regions);break;case aY.BLIT_TEXTURE:var u=e.blitTextureCmds.array[r];BY(t,u.srcTexture,u.dstTexture,u.regions,u.filter)}}}var MY=new Uint8Array(1);function PY(t,e,i,n,r){var s=N_(e).height,a=b_(e,r.width,r.height,r.depth),o=b_(e,n.width,1,1),h=b_(e,n.width,n.height,1),u=b_(e,r.width,1,1),c=x_(T_[e]);MY.byteLength<a&&(MY=new Uint8Array(a));for(var l=0,_=i,f=0;f<r.depth;f++){_=i+h*f;for(var d=0;d<r.height;d+=s)MY.subarray(l,l+u).set(new Uint8Array(t.buffer,t.byteOffset+_,u)),l+=u,_+=o}var p=a/c.BYTES_PER_ELEMENT;return Z(Number.isInteger(p),9101),new c(MY.buffer,0,p)}function LY(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,h=T_[i.format],u=x_(h),c=h.isCompressed,l=N_(i.format),_=new Sl,f=new El,d=new Sl;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:D_(m.texOffset.x,l.width),f.y=0===m.texOffset.y?0:D_(m.texOffset.y,l.height),_.width=m.texExtent.width<l.width?m.texExtent.width:D_(m.texExtent.width,l.width),_.height=m.texExtent.height<l.height?m.texExtent.width:D_(m.texExtent.height,l.height),d.width=m.buffStride>0?m.buffStride:_.width,d.height=m.buffTexHeight>0?m.buffTexHeight:_.height;var v=m.texExtent.width+f.x===i.width>>g?m.texExtent.width:_.width,y=m.texExtent.height+f.y===i.height>>g?m.texExtent.height:_.height,E=void 0,T=e[a++];if(d.width===_.width&&d.height===_.height){var S=b_(i.format,v,y,1)/u.BYTES_PER_ELEMENT;Z(Number.isInteger(S),9101),E=new u(T.buffer,T.byteOffset+m.buffOffset,S)}else E=PY(T,i.format,m.buffOffset,d,_);c?i.glInternalFmt===Zj.COMPRESSED_RGB_ETC1_WEBGL||t.extensions.noCompressedTexSubImage2D?r.compressedTexImage2D(r.TEXTURE_2D,g,i.glInternalFmt,v,y,0,E):r.compressedTexSubImage2D(r.TEXTURE_2D,g,f.x,f.y,v,y,i.glFormat,E):r.texSubImage2D(r.TEXTURE_2D,g,f.x,f.y,v,y,i.glFormat,i.glType,E)}break;case r.TEXTURE_CUBE_MAP:for(var A=0;A<n.length;A++){var R=n[A],C=R.texSubres.mipLevel;f.x=0===R.texOffset.x?0:D_(R.texOffset.x,l.width),f.y=0===R.texOffset.y?0:D_(R.texOffset.y,l.height),_.width=R.texExtent.width<l.width?R.texExtent.width:D_(R.texExtent.width,l.width),_.height=R.texExtent.height<l.height?R.texExtent.width:D_(R.texExtent.height,l.height),d.width=R.buffStride>0?R.buffStride:_.width,d.height=R.buffTexHeight>0?R.buffTexHeight:_.height;var b=R.texExtent.width+f.x===i.width>>C?R.texExtent.width:_.width,I=R.texExtent.height+f.y===i.height>>C?R.texExtent.height:_.height,w=R.texSubres.baseArrayLayer+R.texSubres.layerCount;for(o=R.texSubres.baseArrayLayer;o<w;++o){var O=void 0,x=e[a++];if(d.width===_.width&&d.height===_.height){var N=b_(i.format,b,I,1)/u.BYTES_PER_ELEMENT;Z(Number.isInteger(N),9101),O=new u(x.buffer,x.byteOffset+R.buffOffset,N)}else O=PY(x,i.format,R.buffOffset,d,_);c?i.glInternalFmt===Zj.COMPRESSED_RGB_ETC1_WEBGL||t.extensions.noCompressedTexSubImage2D?r.compressedTexImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+o,C,i.glInternalFmt,b,I,0,O):r.compressedTexSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+o,C,f.x,f.y,b,I,i.glFormat,O):r.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+o,C,f.x,f.y,b,I,i.glFormat,i.glType,O)}}break;default:console.error("Unsupported GL texture type, copy buffer to texture failed.")}i.flags&kc.GEN_MIPMAP&&r.generateMipmap(i.glTarget)}function BY(t,e,i,n,r){t.blitManager.draw(e,i,n,r)}var FY=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=Di(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}(),UY=function(){function t(){this._gpuShader=null,this._gpuDescriptorSetLayout=null,this._gpuPipelineLayout=null,this._gpuPipelineState=null,this._gpuVertexBuffer=null,this._gpuInputAssembler=null,this._gpuPointSampler=null,this._gpuLinearSampler=null,this._gpuDescriptorSet=null,this._gpuUniformBuffer=null,this._drawInfo=null,this._glFramebuffer=null,this._uniformBuffer=null;var t=$j.instance.gl,e=$j.instance.bindingMappingInfo.maxBlockCounts[0];this._gpuShader={name:"Blit Pass",blocks:[new zl(0,0,"BlitParams",[new Hl("tilingOffsetSrc",Dc.FLOAT4,1),new Hl("tilingOffsetDst",Dc.FLOAT4,1)],1)],samplerTextures:[new Vl(0,e,"textureSrc",Dc.SAMPLER2D,1)],subpassInputs:[],gpuStages:[{type:Qc.VERTEX,source:"\n precision mediump float;\n\n attribute vec2 a_position;\n attribute vec2 a_texCoord;\n \n uniform vec4 tilingOffsetSrc;\n uniform vec4 tilingOffsetDst;\n \n varying vec2 v_texCoord;\n \n void main() {\n v_texCoord = a_texCoord * tilingOffsetSrc.xy + tilingOffsetSrc.zw;\n gl_Position = vec4((a_position + 1.0) * tilingOffsetDst.xy - 1.0 + tilingOffsetDst.zw * 2.0, 0, 1);\n }",glShader:null},{type:Qc.FRAGMENT,source:"\n precision mediump float;\n uniform sampler2D textureSrc;\n\n varying vec2 v_texCoord;\n \n void main() {\n gl_FragColor = texture2D(textureSrc, v_texCoord);\n }",glShader:null}],glProgram:null,glInputs:[],glUniforms:[],glBlocks:[],glSamplerTextures:[]},SY($j.instance,this._gpuShader),this._gpuDescriptorSetLayout={bindings:[new h_(0,hl.UNIFORM_BUFFER,1,Qc.VERTEX),new h_(e,hl.SAMPLER_TEXTURE,1,Qc.FRAGMENT)],dynamicBindings:[],descriptorIndices:[],descriptorCount:e+1};for(var i=0;i<e;i++)this._gpuDescriptorSetLayout.descriptorIndices[i]=0;this._gpuDescriptorSetLayout.descriptorIndices.push(1),this._gpuPipelineLayout={gpuSetLayouts:[this._gpuDescriptorSetLayout],dynamicOffsetCount:0,dynamicOffsetOffsets:[0],dynamicOffsetIndices:[[]]},this._gpuPipelineState={glPrimitive:t.TRIANGLE_STRIP,gpuShader:this._gpuShader,gpuPipelineLayout:this._gpuPipelineLayout,rs:null,dss:new X_(!1,!1),bs:null,dynamicStates:[],gpuRenderPass:null},this._gpuVertexBuffer={usage:Mc.VERTEX,memUsage:Bc.DEVICE,size:16*Float32Array.BYTES_PER_ELEMENT,stride:4*Float32Array.BYTES_PER_ELEMENT,buffer:null,vf32:null,indirects:new FY,glTarget:0,glBuffer:null},yY($j.instance,this._gpuVertexBuffer),$j.instance.memoryStatus.bufferSize+=this._gpuVertexBuffer.size;var n=new Float32Array([-1,-1,0,0,1,-1,1,0,-1,1,0,1,1,1,1,1]);TY($j.instance,this._gpuVertexBuffer,n,0,n.length),this._gpuInputAssembler={attributes:[new Ql("a_position",xc.RG32F),new Ql("a_texCoord",xc.RG32F)],gpuVertexBuffers:[this._gpuVertexBuffer],gpuIndexBuffer:null,gpuIndirectBuffer:null,glAttribs:[],glIndexType:0,glVAOs:new Map},RY($j.instance,this._gpuInputAssembler),this._gpuPointSampler={glMinFilter:9728,glMagFilter:9728,glWrapS:10497,glWrapT:10497,glWrapR:10497},this._gpuLinearSampler={glMinFilter:9729,glMagFilter:9729,glWrapS:10497,glWrapT:10497,glWrapR:10497},this._uniformBuffer=new Float32Array(8),this._gpuUniformBuffer={usage:Mc.UNIFORM,memUsage:Bc.DEVICE,size:8*Float32Array.BYTES_PER_ELEMENT,stride:8*Float32Array.BYTES_PER_ELEMENT,buffer:this._uniformBuffer,vf32:null,indirects:new FY,glTarget:0,glBuffer:null},yY($j.instance,this._gpuUniformBuffer),$j.instance.memoryStatus.bufferSize+=this._gpuUniformBuffer.size,this._gpuDescriptorSet={gpuDescriptors:[{type:hl.UNIFORM_BUFFER,gpuBuffer:this._gpuUniformBuffer,gpuTexture:null,gpuSampler:null},{type:hl.SAMPLER_TEXTURE,gpuBuffer:null,gpuTexture:null,gpuSampler:null}],descriptorIndices:this._gpuDescriptorSetLayout.descriptorIndices},this._drawInfo=new Ll(4,0,0,0,0,0,0),this._glFramebuffer=$j.instance.gl.createFramebuffer()}var e=t.prototype;return e.destroy=function(){this._glFramebuffer&&($j.instance.gl.deleteFramebuffer(this._glFramebuffer),this._glFramebuffer=null),this._gpuVertexBuffer&&($j.instance.memoryStatus.bufferSize-=this._gpuVertexBuffer.size,EY($j.instance,this._gpuVertexBuffer)),this._gpuUniformBuffer&&($j.instance.memoryStatus.bufferSize-=this._gpuUniformBuffer.size,EY($j.instance,this._gpuUniformBuffer)),this._gpuShader&&AY($j.instance,this._gpuShader),this._gpuInputAssembler&&CY($j.instance,this._gpuInputAssembler)},e.draw=function(t,e,i,n){var r=$j.instance,s=r.gl,a=r.stateCache,o=a.glFramebuffer;if(s.viewport(0,0,e.width,e.height),s.scissor(0,0,e.width,e.height),this._uniformBuffer&&this._gpuUniformBuffer&&this._gpuPipelineState&&this._gpuInputAssembler&&this._gpuDescriptorSet&&this._drawInfo){var h=this._gpuDescriptorSet.gpuDescriptors[1];h.gpuTexture=t,h.gpuSampler=n===Vc.POINT?this._gpuPointSampler:this._gpuLinearSampler;var u=T_[e.format],c=s.COLOR_ATTACHMENT0;u.hasStencil?c=s.DEPTH_STENCIL_ATTACHMENT:u.hasDepth&&(c=s.DEPTH_ATTACHMENT);var l=i.map((function(t,e){return e}));l.sort((function(t,e){return i[t].srcSubres.mipLevel-i[e].srcSubres.mipLevel})),a.glFramebuffer!==this._glFramebuffer&&(r.gl.bindFramebuffer(r.gl.FRAMEBUFFER,this._glFramebuffer),a.glFramebuffer=this._glFramebuffer);var _=i[0].dstSubres.mipLevel;e.glTexture?s.framebufferTexture2D(s.FRAMEBUFFER,c,e.glTarget,e.glTexture,_):s.framebufferRenderbuffer(s.FRAMEBUFFER,c,s.RENDERBUFFER,e.glRenderbuffer);for(var f=0;f<l.length;++f){var d=i[l[f]];t.glTexture&&_!==d.srcSubres.mipLevel&&(_=d.srcSubres.mipLevel,s.framebufferTexture2D(s.FRAMEBUFFER,c,e.glTarget,e.glTexture,_));var p=t.width,m=t.height,g=e.width,v=e.height;this._uniformBuffer[0]=d.srcExtent.width/p,this._uniformBuffer[1]=d.srcExtent.height/m,this._uniformBuffer[2]=d.srcOffset.x/p,this._uniformBuffer[3]=d.srcOffset.y/m,this._uniformBuffer[4]=d.dstExtent.width/g,this._uniformBuffer[5]=d.dstExtent.height/v,this._uniformBuffer[6]=d.dstOffset.x/g,this._uniformBuffer[7]=d.dstOffset.y/v,TY(r,this._gpuUniformBuffer,this._uniformBuffer,0,this._uniformBuffer.length*Float32Array.BYTES_PER_ELEMENT),OY(r,this._gpuPipelineState,this._gpuInputAssembler,[this._gpuDescriptorSet],[],null),xY(r,this._drawInfo)}a.glFramebuffer!==o&&(r.gl.bindFramebuffer(r.gl.FRAMEBUFFER,o),a.glFramebuffer=o);var y=a.viewport;s.viewport(y.left,y.top,y.width,y.height);var E=a.scissorRect;s.scissor(E.x,E.y,E.width,E.height)}},t}(),kY=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}s(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&Mc.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 FY,glTarget:0,glBuffer:null},this._usage&Mc.UNIFORM&&(this._gpuBuffer.buffer=this._uniformBuffer),yY($j.instance,this._gpuBuffer),$j.instance.memoryStatus.bufferSize+=this._size},i.destroy=function(){this._gpuBuffer&&(EY($j.instance,this._gpuBuffer),$j.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&Bc.HOST?i.DYNAMIC_DRAW:i.STATIC_DRAW;e.usage&Mc.VERTEX?(t.extensions.useVAO&&n.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),n.glVAO=null),bY.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&Mc.INDEX?(t.extensions.useVAO&&n.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),n.glVAO=null),bY.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&Mc.UNIFORM?e.buffer&&(e.vf32=new Float32Array(e.buffer.buffer)):(e.usage&Mc.INDIRECT||e.usage&Mc.TRANSFER_DST||e.usage&Mc.TRANSFER_SRC||console.error("Unsupported BufferType, create buffer failed."),e.glTarget=i.NONE)}($j.instance,this._gpuBuffer),$j.instance.memoryStatus.bufferSize-=e,$j.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&Mc.INDIRECT?0:t.byteLength,TY($j.instance,this._gpuBuffer,t,0,i))},n(e,[{key:"gpuBuffer",get:function(){return this._gpuBuffer}},{key:"gpuBufferView",get:function(){return this._gpuBufferView}}]),e}(P_),GY=function(){function t(t,e){this._frees=void 0,this._freeIdx=0,this._freeCmds=void 0,this._frees=new Array(e),this._freeCmds=new uu(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}(),HY=function(){function t(){this.beginRenderPassCmdPool=void 0,this.bindStatesCmdPool=void 0,this.drawCmdPool=void 0,this.updateBufferCmdPool=void 0,this.copyBufferToTextureCmdPool=void 0,this.blitTextureCmdPool=void 0,this.beginRenderPassCmdPool=new GY(_Y,1),this.bindStatesCmdPool=new GY(fY,1),this.drawCmdPool=new GY(dY,1),this.updateBufferCmdPool=new GY(pY,1),this.copyBufferToTextureCmdPool=new GY(mY,1),this.blitTextureCmdPool=new GY(gY,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.blitTextureCmds.length&&(this.blitTextureCmdPool.freeCmds(t.blitTextureCmds),t.blitTextureCmds.clear()),t.cmds.clear()},e.releaseCmds=function(){this.beginRenderPassCmdPool.release(),this.bindStatesCmdPool.release(),this.drawCmdPool.release(),this.updateBufferCmdPool.release(),this.copyBufferToTextureCmdPool.release(),this.blitTextureCmdPool.release()},t}(),zY=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 vY,e._cmdAllocator=new HY,e._isInRenderPass=!1,e._curGPUPipelineState=null,e._curGPUInputAssembler=null,e._curGPUDescriptorSets=[],e._curDynamicOffsets=Array(8).fill(0),e._curDynamicStates=new y_,e._isStateInvalied=!1,e}s(e,t);var i=e.prototype;return i.initialize=function(t){this._type=t.type,this._queue=t.queue;for(var e=$j.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(_Y);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(aY.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],h=0;h<i.length;h++)a[o+h]=i[h];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&ol.FRONT&&i.writeMask!==e&&(i.writeMask=e,this._isStateInvalied=!0),t&ol.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&ol.FRONT&&(n.compareMask===i&&n.reference===e||(n.reference=e,n.compareMask=i,this._isStateInvalied=!0)),t&ol.BACK&&(r.compareMask===i&&r.reference===e||(r.reference=e,r.compareMask=i,this._isStateInvalied=!0))},i.draw=function(t){if(this._type===ll.PRIMARY&&this._isInRenderPass||this._type===ll.SECONDARY){this._isStateInvalied&&this.bindStates();var e="drawInfo"in t?t.drawInfo:t,i=this._cmdAllocator.drawCmdPool.alloc(dY);i.drawInfo.copy(e),this.cmdPackage.drawCmds.push(i),this.cmdPackage.cmds.push(aY.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===ll.PRIMARY&&!this._isInRenderPass||this._type===ll.SECONDARY){var n=t.gpuBuffer;if(n){var r,s=this._cmdAllocator.updateBufferCmdPool.alloc(pY),a=0;t.usage&Mc.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(aY.UPDATE_BUFFER)}}else console.error("Command 'updateBuffer' must be recorded outside a render pass.")},i.copyBuffersToTexture=function(t,e,i){if(this._type===ll.PRIMARY&&!this._isInRenderPass||this._type===ll.SECONDARY){var n=e.gpuTexture;if(n){var r=this._cmdAllocator.copyBufferToTextureCmdPool.alloc(mY);r&&(r.gpuTexture=n,r.regions=i,r.buffers=t,this.cmdPackage.copyBufferToTextureCmds.push(r),this.cmdPackage.cmds.push(aY.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 h=0;h<n.cmdPackage.drawCmds.length;++h){var u=n.cmdPackage.drawCmds.array[h];++u.refCount,this.cmdPackage.drawCmds.push(u)}for(var c=0;c<n.cmdPackage.updateBufferCmds.length;++c){var l=n.cmdPackage.updateBufferCmds.array[c];++l.refCount,this.cmdPackage.updateBufferCmds.push(l)}for(var _=0;_<n.cmdPackage.copyBufferToTextureCmds.length;++_){var f=n.cmdPackage.copyBufferToTextureCmds.array[_];++f.refCount,this.cmdPackage.copyBufferToTextureCmds.push(f)}for(var d=0;d<n.cmdPackage.blitTextureCmds.length;++d){var p=n.cmdPackage.blitTextureCmds.array[d];++p.refCount,this.cmdPackage.blitTextureCmds.push(p)}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(fY);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(aY.BIND_STATES),this._isStateInvalied=!1)},i.blitTexture=function(t,e,i,n){var r=this._cmdAllocator.blitTextureCmdPool.alloc(gY);r.srcTexture=t.gpuTexture,r.dstTexture=e.gpuTexture,r.regions=i,r.filter=n,++this._numDrawCalls,this.cmdPackage.blitTextureCmds.push(r),this.cmdPackage.cmds.push(aY.BLIT_TEXTURE)},e}(L_),VY=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}s(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 h=e.gpuDepthStencilTexture;if(h){var u=T_[h.format].hasStencil?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;h.glTexture?n.framebufferTexture2D(n.FRAMEBUFFER,u,h.glTarget,h.glTexture,0):n.framebufferRenderbuffer(n.FRAMEBUFFER,u,n.RENDERBUFFER,h.glRenderbuffer),e.width=Math.min(e.width,h.width),e.height=Math.min(e.height,h.height)}t.extensions.WEBGL_draw_buffers&&t.extensions.WEBGL_draw_buffers.drawBuffersWEBGL(r);var c=n.checkFramebufferStatus(n.FRAMEBUFFER);if(c!==n.FRAMEBUFFER_COMPLETE)switch(c){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)}}($j.instance,this._gpuFramebuffer)},i.destroy=function(){var t,e;this._gpuFramebuffer&&(t=$j.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)},n(e,[{key:"gpuFramebuffer",get:function(){return this._gpuFramebuffer}}]),e}(k_),WY=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}s(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},RY($j.instance,this._gpuInputAssembler)}else console.error("InputAssemblerInfo.vertexBuffers is null.")},i.destroy=function(){var t=$j.instance;this._gpuInputAssembler&&t.extensions.useVAO&&CY(t,this._gpuInputAssembler),this._gpuInputAssembler=null},n(e,[{key:"gpuInputAssembler",get:function(){return this._gpuInputAssembler}}]),e}(G_),XY=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}s(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 h=this._bindings[o];this._bindingIndices[h.binding]=o,a[h.binding]=n[o]}for(var u=[],c=0;c<this._bindings.length;c++){var l=this._bindings[c];if(l.descriptorType&R_)for(var _=0;_<l.count;_++)u.push(l.binding)}this._gpuDescriptorSetLayout={bindings:this._bindings,dynamicBindings:u,descriptorIndices:a,descriptorCount:e}},i.destroy=function(){this._bindings.length=0},n(e,[{key:"gpuDescriptorSetLayout",get:function(){return this._gpuDescriptorSetLayout}}]),e}(z_),jY=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}s(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,h=Array(a.bindingIndices.length).fill(-1),u=0;u<o.length;u++){var c=o[u];h[c]<0&&(h[c]=n+u)}i.push(a.gpuDescriptorSetLayout),e.push(h),r.push(n),n+=o.length}this._gpuPipelineLayout={gpuSetLayouts:i,dynamicOffsetIndices:e,dynamicOffsetCount:n,dynamicOffsetOffsets:r}},i.destroy=function(){this._setLayouts.length=0},n(e,[{key:"gpuPipelineLayout",get:function(){return this._gpuPipelineLayout}}]),e}(V_),YY=[0,1,3,2,0,0,0,4,5,6,0,0,0,0],KY=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}s(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:YY[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},n(e,[{key:"gpuPipelineState",get:function(){return this._gpuPipelineState}}]),e}(q_),qY=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.beginRenderPass=function(t,e,i,n,r,s){wY($j.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;xY($j.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=$j.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=$j.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&Mc.INDIRECT?0:e.byteLength,TY($j.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&&LY($j.instance,t,n,i)}},i.execute=function(t,e){for(var i=0;i<e;++i){var n=t[i];DY($j.instance,n.cmdPackage),this._numDrawCalls+=n._numDrawCalls,this._numInstances+=n._numInstances,this._numTris+=n._numTris}},i.bindStates=function(){OY($j.instance,this._curGPUPipelineState,this._curGPUInputAssembler,this._curGPUDescriptorSets,this._curDynamicOffsets,this._curDynamicStates),this._isStateInvalied=!1},i.blitTexture=function(t,e,i,n){var r=t.gpuTexture,s=e.gpuTexture;BY($j.instance,r,s,i,n)},e}(zY),QY=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}s(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}(Q_),ZY=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}s(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},n(e,[{key:"gpuRenderPass",get:function(){return this._gpuRenderPass}}]),e}(Z_),JY=[10497,33648,33071,33071],$Y=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,h=n._info.mipFilter;r=a===Vc.LINEAR||a===Vc.ANISOTROPIC?h===Vc.LINEAR||h===Vc.ANISOTROPIC?9987:h===Vc.POINT?9985:9729:h===Vc.LINEAR||h===Vc.ANISOTROPIC?9986:h===Vc.POINT?9984:9728,s=o===Vc.LINEAR||o===Vc.ANISOTROPIC?9729:9728;var u=JY[n._info.addressU],c=JY[n._info.addressV],l=JY[n._info.addressW];return n._gpuSampler={glMinFilter:r,glMagFilter:s,glWrapS:u,glWrapT:c,glWrapR:l},n}return s(e,t),n(e,[{key:"gpuSampler",get:function(){return this._gpuSampler}}]),e}(J_),tK=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}s(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&&(AY($j.instance,this._gpuShader),this._gpuShader=null)},n(e,[{key:"gpuShader",get:function(){return null===this._gpuShader.glProgram&&SY($j.instance,this._gpuShader),this._gpuShader}}]),e}($_),eK=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 wl,this.scissorRect=new Tl(0,0,0,0),this.rs=new W_,this.dss=new X_,this.bs=new Y_,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}(),iK=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}s(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=C_(this._info.width)&&C_(this._info.height),this._size=I_(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},this._gpuTexture.isSwapchainTexture||(function(t,e){var i=t.gl;e.glFormat=e.glInternalFmt=function(t,e){switch(t){case xc.A8:return e.ALPHA;case xc.L8:return e.LUMINANCE;case xc.LA8:return e.LUMINANCE_ALPHA;case xc.RGB8:case xc.RGB16F:case xc.RGB32F:return e.RGB;case xc.BGRA8:case xc.RGBA8:case xc.SRGB8_A8:case xc.RGBA16F:case xc.RGBA32F:return e.RGBA;case xc.R5G6B5:return e.RGB;case xc.RGB5A1:case xc.RGBA4:return e.RGBA;case xc.DEPTH:return e.DEPTH_COMPONENT;case xc.DEPTH_STENCIL:return e.DEPTH_STENCIL;case xc.BC1:return Zj.COMPRESSED_RGB_S3TC_DXT1_EXT;case xc.BC1_ALPHA:return Zj.COMPRESSED_RGBA_S3TC_DXT1_EXT;case xc.BC1_SRGB:return Zj.COMPRESSED_SRGB_S3TC_DXT1_EXT;case xc.BC1_SRGB_ALPHA:return Zj.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;case xc.BC2:return Zj.COMPRESSED_RGBA_S3TC_DXT3_EXT;case xc.BC2_SRGB:return Zj.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;case xc.BC3:return Zj.COMPRESSED_RGBA_S3TC_DXT5_EXT;case xc.BC3_SRGB:return Zj.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;case xc.ETC_RGB8:return Zj.COMPRESSED_RGB_ETC1_WEBGL;case xc.ETC2_RGB8:return Zj.COMPRESSED_RGB8_ETC2;case xc.ETC2_SRGB8:return Zj.COMPRESSED_SRGB8_ETC2;case xc.ETC2_RGB8_A1:return Zj.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2;case xc.ETC2_SRGB8_A1:return Zj.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2;case xc.ETC2_RGBA8:return Zj.COMPRESSED_RGBA8_ETC2_EAC;case xc.ETC2_SRGB8_A8:return Zj.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC;case xc.EAC_R11:return Zj.COMPRESSED_R11_EAC;case xc.EAC_R11SN:return Zj.COMPRESSED_SIGNED_R11_EAC;case xc.EAC_RG11:return Zj.COMPRESSED_RG11_EAC;case xc.EAC_RG11SN:return Zj.COMPRESSED_SIGNED_RG11_EAC;case xc.PVRTC_RGB2:return Zj.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;case xc.PVRTC_RGBA2:return Zj.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;case xc.PVRTC_RGB4:return Zj.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;case xc.PVRTC_RGBA4:return Zj.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;case xc.ASTC_RGBA_4X4:return Zj.COMPRESSED_RGBA_ASTC_4x4_KHR;case xc.ASTC_RGBA_5X4:return Zj.COMPRESSED_RGBA_ASTC_5x4_KHR;case xc.ASTC_RGBA_5X5:return Zj.COMPRESSED_RGBA_ASTC_5x5_KHR;case xc.ASTC_RGBA_6X5:return Zj.COMPRESSED_RGBA_ASTC_6x5_KHR;case xc.ASTC_RGBA_6X6:return Zj.COMPRESSED_RGBA_ASTC_6x6_KHR;case xc.ASTC_RGBA_8X5:return Zj.COMPRESSED_RGBA_ASTC_8x5_KHR;case xc.ASTC_RGBA_8X6:return Zj.COMPRESSED_RGBA_ASTC_8x6_KHR;case xc.ASTC_RGBA_8X8:return Zj.COMPRESSED_RGBA_ASTC_8x8_KHR;case xc.ASTC_RGBA_10X5:return Zj.COMPRESSED_RGBA_ASTC_10x5_KHR;case xc.ASTC_RGBA_10X6:return Zj.COMPRESSED_RGBA_ASTC_10x6_KHR;case xc.ASTC_RGBA_10X8:return Zj.COMPRESSED_RGBA_ASTC_10x8_KHR;case xc.ASTC_RGBA_10X10:return Zj.COMPRESSED_RGBA_ASTC_10x10_KHR;case xc.ASTC_RGBA_12X10:return Zj.COMPRESSED_RGBA_ASTC_12x10_KHR;case xc.ASTC_RGBA_12X12:return Zj.COMPRESSED_RGBA_ASTC_12x12_KHR;case xc.ASTC_SRGBA_4X4:return Zj.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR;case xc.ASTC_SRGBA_5X4:return Zj.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR;case xc.ASTC_SRGBA_5X5:return Zj.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR;case xc.ASTC_SRGBA_6X5:return Zj.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR;case xc.ASTC_SRGBA_6X6:return Zj.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR;case xc.ASTC_SRGBA_8X5:return Zj.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR;case xc.ASTC_SRGBA_8X6:return Zj.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR;case xc.ASTC_SRGBA_8X8:return Zj.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR;case xc.ASTC_SRGBA_10X5:return Zj.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR;case xc.ASTC_SRGBA_10X6:return Zj.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR;case xc.ASTC_SRGBA_10X8:return Zj.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR;case xc.ASTC_SRGBA_10X10:return Zj.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR;case xc.ASTC_SRGBA_12X10:return Zj.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR;case xc.ASTC_SRGBA_12X12:return Zj.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR;default:return console.error("Unsupported Format, convert to WebGL format failed."),e.RGBA}}(e.format,i),e.glType=tY(e.format,i);var n=e.width,r=e.height;switch(e.type){case Fc.TEX2D:e.glTarget=i.TEXTURE_2D;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||!T_[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),T_[e.format].isCompressed)for(var o=0;o<e.mipLevel;++o){var h=b_(e.format,n,r,1),u=new Uint8Array(h);i.compressedTexImage2D(i.TEXTURE_2D,o,e.glInternalFmt,n,r,0,u),n=Math.max(1,n>>1),r=Math.max(1,r>>1)}else for(var c=0;c<e.mipLevel;++c)i.texImage2D(i.TEXTURE_2D,c,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 xc.R5G6B5:return e.RGB565;case xc.RGB5A1:return e.RGB5_A1;case xc.RGBA4:return e.RGBA4;case xc.RGBA16F:return Zj.RGBA16F_EXT;case xc.RGBA32F:return Zj.RGBA32F_EXT;case xc.SRGB8_A8:return Zj.SRGB8_ALPHA8_EXT;case xc.DEPTH:return e.DEPTH_COMPONENT16;case xc.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 Fc.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 _=t.stateCache.glTexUnits[t.stateCache.texUnit];if(_.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_CUBE_MAP,e.glTexture),_.glTexture=e.glTexture),T_[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=b_(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=Fc.TEX2D,e.glTarget=i.TEXTURE_2D}}($j.instance,this._gpuTexture),$j.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}}($j.instance,this._gpuTexture),$j.instance.memoryStatus.textureSize-=this._size,this._gpuTexture=null)},i.getGLTextureHandle=function(){var t=this._gpuTexture;return t?t.glTexture?t.glTexture:t.glRenderbuffer?t.glRenderbuffer:0:0},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=I_(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,this._gpuTexture.isSwapchainTexture||(function(t,e){if(e.size){var i=t.gl,n=e.width,r=e.height;switch(e.type){case Fc.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),T_[e.format].isCompressed)for(var o=0;o<e.mipLevel;++o){var h=b_(e.format,n,r,1),u=new Uint8Array(h);i.compressedTexImage2D(i.TEXTURE_2D,o,e.glInternalFmt,n,r,0,u),n=Math.max(1,n>>1),r=Math.max(1,r>>1)}else for(var c=0;c<e.mipLevel;++c)i.texImage2D(i.TEXTURE_2D,c,e.glInternalFmt,n,r,0,e.glFormat,e.glType,null),n=Math.max(1,n>>1),r=Math.max(1,r>>1)}break;case Fc.CUBE:e.glTarget=i.TEXTURE_CUBE_MAP;var l=Math.max(n,r);l>t.capabilities.maxCubeMapTextureSize&&K(9100,l,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),T_[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=b_(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=Fc.TEX2D,e.glTarget=i.TEXTURE_2D}}}($j.instance,this._gpuTexture),$j.instance.memoryStatus.textureSize-=n,$j.instance.memoryStatus.textureSize+=this._size))}},i.initAsSwapchainTexture=function(t){var e=new Ul;e.format=t.format,e.usage=T_[t.format].hasDepth?Uc.DEPTH_STENCIL_ATTACHMENT:Uc.COLOR_ATTACHMENT,e.width=t.width,e.height=t.height,this.initialize(e,!0)},n(e,[{key:"gpuTexture",get:function(){return this._gpuTexture}},{key:"lodLevel",get:function(){return this._lodLevel}}]),e}(tf),nK="webglcontextlost";function rK(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 sK(t){var e={EXT_texture_filter_anisotropic:rK(t,"EXT_texture_filter_anisotropic"),EXT_blend_minmax:rK(t,"EXT_blend_minmax"),EXT_frag_depth:rK(t,"EXT_frag_depth"),EXT_shader_texture_lod:rK(t,"EXT_shader_texture_lod"),EXT_sRGB:rK(t,"EXT_sRGB"),OES_vertex_array_object:rK(t,"OES_vertex_array_object"),EXT_color_buffer_half_float:rK(t,"EXT_color_buffer_half_float"),WEBGL_color_buffer_float:rK(t,"WEBGL_color_buffer_float"),WEBGL_compressed_texture_etc1:rK(t,"WEBGL_compressed_texture_etc1"),WEBGL_compressed_texture_etc:rK(t,"WEBGL_compressed_texture_etc"),WEBGL_compressed_texture_pvrtc:rK(t,"WEBGL_compressed_texture_pvrtc"),WEBGL_compressed_texture_s3tc:rK(t,"WEBGL_compressed_texture_s3tc"),WEBGL_compressed_texture_s3tc_srgb:rK(t,"WEBGL_compressed_texture_s3tc_srgb"),WEBGL_debug_shaders:rK(t,"WEBGL_debug_shaders"),WEBGL_draw_buffers:rK(t,"WEBGL_draw_buffers"),WEBGL_lose_context:rK(t,"WEBGL_lose_context"),WEBGL_depth_texture:rK(t,"WEBGL_depth_texture"),OES_texture_half_float:rK(t,"OES_texture_half_float"),OES_texture_half_float_linear:rK(t,"OES_texture_half_float_linear"),OES_texture_float:rK(t,"OES_texture_float"),OES_texture_float_linear:rK(t,"OES_texture_float_linear"),OES_standard_derivatives:rK(t,"OES_standard_derivatives"),OES_element_index_uint:rK(t,"OES_element_index_uint"),ANGLE_instanced_arrays:rK(t,"ANGLE_instanced_arrays"),WEBGL_debug_renderer_info:rK(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 Yu.os===zu.IOS&&14===Yu.osMainVersion&&Yu.isBrowser||(e.WEBGL_compressed_texture_astc=rK(t,"WEBGL_compressed_texture_astc")),Yu.os!==zu.ANDROID&&Yu.os!==zu.IOS&&(e.WEBGL_multi_draw=rK(t,"WEBGL_multi_draw")),Yu.browserType===ku.UC&&(e.ANGLE_instanced_arrays=null),Yu.os===zu.IOS&&(e.WEBGL_depth_texture=null),Yu.os===zu.IOS&&Yu.osMainVersion<=10&&(e.destroyShadersImmediately=!1),e.OES_vertex_array_object&&(e.useVAO=!0),e}var aK,oK,hK,uK,cK,lK,_K,fK,dK,pK,mK,gK,vK,yK,EK,TK,SK,AK,RK,CK,bK,IK,wK,OK,xK,NK,DK,MK,PK,LK,BK,FK=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 eK,e.cmdAllocator=new HY,e.nullTex2D=null,e.nullTexCube=null,e._canvas=null,e._webGLContextLostHandler=null,e._extensions=null,e._blitManager=null,e}s(e,t);var i=e.prototype;return i.initialize=function(t){this._canvas=t.windowHandle,this._webGLContextLostHandler=this._onWebGLContextLost.bind(this),this._canvas.addEventListener(nK,this._onWebGLContextLost);var e=$j.instance.gl;this.stateCache.initialize($j.instance.capabilities.maxTextureUnits,$j.instance.capabilities.maxVertexAttributes),this._extensions=sK(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=xc.RGBA8,n=xc.DEPTH_STENCIL,r=e.getParameter(e.DEPTH_BITS),s=e.getParameter(e.STENCIL_BITS);r&&s?n=xc.DEPTH_STENCIL:r&&(n=xc.DEPTH),this._colorTexture=new iK,this._colorTexture.initAsSwapchainTexture({swapchain:this,format:i,width:t.width,height:t.height}),this._depthStencilTexture=new iK,this._depthStencilTexture.initAsSwapchainTexture({swapchain:this,format:n,width:t.width,height:t.height}),this.nullTex2D=$j.instance.createTexture(new Ul(Fc.TEX2D,Uc.SAMPLED,xc.RGBA8,2,2,kc.GEN_MIPMAP)),this.nullTexCube=$j.instance.createTexture(new Ul(Fc.CUBE,Uc.SAMPLED,xc.RGBA8,2,2,kc.GEN_MIPMAP,6));var a=new Il;a.texExtent.width=2,a.texExtent.height=2;var o=new Uint8Array(this.nullTex2D.size);o.fill(0),$j.instance.copyBuffersToTexture([o],this.nullTex2D,[a]),a.texSubres.layerCount=6,$j.instance.copyBuffersToTexture([o,o,o,o,o,o],this.nullTexCube,[a]),this._blitManager=new UY},i.destroy=function(){this._canvas&&this._webGLContextLostHandler&&(this._canvas.removeEventListener(nK,this._webGLContextLostHandler),this._webGLContextLostHandler=null),this.nullTex2D&&(this.nullTex2D.destroy(),this.nullTex2D=null),this.nullTexCube&&(this.nullTexCube.destroy(),this.nullTexCube=null),this._blitManager&&(this._blitManager.destroy(),this._blitManager=null),this._extensions=null,this._canvas=null},i.resize=function(t,e){this._colorTexture.width===t&&this._colorTexture.height===e||(k("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),B(t)},n(e,[{key:"extensions",get:function(){return this._extensions}},{key:"blitManager",get:function(){return this._blitManager}}]),e}(U_),UK=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(xc.COUNT),e}s(e,t);var i=e.prototype;return i.initialize=function(t){$j.setInstance(this),this._gfxAPI=Ic.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 h=0;h<e.setIndices.length;++h){var u=e.setIndices[h];n[u]-=e.maxBlockCounts[u]}this._bindingMappings={blockOffsets:i,samplerTextureOffsets:n,flexibleSet:e.setIndices[e.setIndices.length-1]};var c=this._context=function(t){var e=null;try{var i={alpha:Te.ENABLE_TRANSPARENT_CANVAS,antialias:Te.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}(B_.canvas);if(!c)return console.error("This device does not support WebGL."),!1;this._queue=this.createQueue(new d_(ul.GRAPHICS)),this._cmdBuff=this.createCommandBuffer(new f_(this._queue)),this._caps.maxVertexAttributes=c.getParameter(c.MAX_VERTEX_ATTRIBS),this._caps.maxVertexUniformVectors=c.getParameter(c.MAX_VERTEX_UNIFORM_VECTORS),this._caps.maxFragmentUniformVectors=c.getParameter(c.MAX_FRAGMENT_UNIFORM_VECTORS),this._caps.maxTextureUnits=c.getParameter(c.MAX_TEXTURE_IMAGE_UNITS),this._caps.maxVertexTextureUnits=c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS),this._caps.maxTextureSize=c.getParameter(c.MAX_TEXTURE_SIZE),this._caps.maxCubeMapTextureSize=c.getParameter(c.MAX_CUBE_MAP_TEXTURE_SIZE),this._caps.maxArrayTextureLayers=0,this._caps.max3DTextureSize=0,this._caps.maxUniformBufferBindings=16;var l=c.getSupportedExtensions(),_="";if(l)for(var d,p=f(l);!(d=p()).done;)_+=d.value+" ";var m=sK(c);m.WEBGL_debug_renderer_info?(this._renderer=c.getParameter(m.WEBGL_debug_renderer_info.UNMASKED_RENDERER_WEBGL),this._vendor=c.getParameter(m.WEBGL_debug_renderer_info.UNMASKED_VENDOR_WEBGL)):(this._renderer=c.getParameter(c.RENDERER),this._vendor=c.getParameter(c.VENDOR));var g=c.getParameter(c.VERSION);this._features.fill(!1),this.initFormatFeatures(m),m.EXT_blend_minmax&&(this._features[Oc.BLEND_MINMAX]=!0),m.OES_element_index_uint&&(this._features[Oc.ELEMENT_INDEX_UINT]=!0),m.ANGLE_instanced_arrays&&(this._features[Oc.INSTANCED_ARRAYS]=!0),m.WEBGL_draw_buffers&&(this._features[Oc.MULTIPLE_RENDER_TARGETS]=!0);var v="";return this.getFormatFeatures(xc.ETC_RGB8)&&(v+="etc1 "),this.getFormatFeatures(xc.ETC2_RGB8)&&(v+="etc2 "),this.getFormatFeatures(xc.BC1)&&(v+="dxt "),this.getFormatFeatures(xc.PVRTC_RGB2)&&(v+="pvrtc "),this.getFormatFeatures(xc.ASTC_RGBA_4X4)&&(v+="astc "),k("WebGL device initialized."),k("RENDERER: "+this._renderer),k("VENDOR: "+this._vendor),k("VERSION: "+g),k("COMPRESSED_FORMAT: "+v),k("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(Gc.NONE),this._textureExclusive.fill(!0);var e=Gc.RENDER_TARGET|Gc.SAMPLED_TEXTURE|Gc.LINEAR_FILTER;this._formatFeatures[xc.RGB8]=e,this._formatFeatures[xc.R5G6B5]=e,this._textureExclusive[xc.R5G6B5]=!1,this._formatFeatures[xc.RGBA8]=e,this._formatFeatures[xc.RGBA4]=e,this._textureExclusive[xc.RGBA4]=!1,this._formatFeatures[xc.RGB5A1]=e,this._textureExclusive[xc.RGB5A1]=!1,this._formatFeatures[xc.DEPTH]=Gc.RENDER_TARGET,this._textureExclusive[xc.DEPTH]=!1,this._formatFeatures[xc.DEPTH_STENCIL]=Gc.RENDER_TARGET,this._textureExclusive[xc.DEPTH_STENCIL]=!1,this._formatFeatures[xc.R8I]|=Gc.VERTEX_ATTRIBUTE,this._formatFeatures[xc.RG8I]|=Gc.VERTEX_ATTRIBUTE,this._formatFeatures[xc.RGB8I]|=Gc.VERTEX_ATTRIBUTE,this._formatFeatures[xc.RGBA8I]|=Gc.VERTEX_ATTRIBUTE,this._formatFeatures[xc.R8UI]|=Gc.VERTEX_ATTRIBUTE,this._formatFeatures[xc.RG8UI]|=Gc.VERTEX_ATTRIBUTE,this._formatFeatures[xc.RGB8UI]|=Gc.VERTEX_ATTRIBUTE,this._formatFeatures[xc.RGBA8UI]|=Gc.VERTEX_ATTRIBUTE,this._formatFeatures[xc.R8I]|=Gc.VERTEX_ATTRIBUTE,this._formatFeatures[xc.RG8I]|=Gc.VERTEX_ATTRIBUTE,this._formatFeatures[xc.RGB8I]|=Gc.VERTEX_ATTRIBUTE,this._formatFeatures[xc.RGBA8I]|=Gc.VERTEX_ATTRIBUTE,this._formatFeatures[xc.R8UI]|=Gc.VERTEX_ATTRIBUTE,this._formatFeatures[xc.RG8UI]|=Gc.VERTEX_ATTRIBUTE,this._formatFeatures[xc.RGB8UI]|=Gc.VERTEX_ATTRIBUTE,this._formatFeatures[xc.RGBA8UI]|=Gc.VERTEX_ATTRIBUTE,this._formatFeatures[xc.R32F]|=Gc.VERTEX_ATTRIBUTE,this._formatFeatures[xc.RG32F]|=Gc.VERTEX_ATTRIBUTE,this._formatFeatures[xc.RGB32F]|=Gc.VERTEX_ATTRIBUTE,this._formatFeatures[xc.RGBA32F]|=Gc.VERTEX_ATTRIBUTE,t.EXT_sRGB&&(this._formatFeatures[xc.SRGB8]=e,this._formatFeatures[xc.SRGB8_A8]=e,this._textureExclusive[xc.SRGB8_A8]=!1),t.WEBGL_depth_texture&&(this._formatFeatures[xc.DEPTH]|=e,this._formatFeatures[xc.DEPTH_STENCIL]|=e),t.WEBGL_color_buffer_float&&(this._formatFeatures[xc.RGB32F]|=Gc.RENDER_TARGET,this._formatFeatures[xc.RGBA32F]|=Gc.RENDER_TARGET,this._textureExclusive[xc.RGB32F]=!1,this._textureExclusive[xc.RGBA32F]=!1),t.EXT_color_buffer_half_float&&(this._formatFeatures[xc.RGB16F]|=Gc.RENDER_TARGET,this._formatFeatures[xc.RGBA16F]|=Gc.RENDER_TARGET,this._textureExclusive[xc.RGB16F]=!1,this._textureExclusive[xc.RGBA16F]=!1),t.OES_texture_float&&(this._formatFeatures[xc.RGB32F]|=Gc.RENDER_TARGET|Gc.SAMPLED_TEXTURE,this._formatFeatures[xc.RGBA32F]|=Gc.RENDER_TARGET|Gc.SAMPLED_TEXTURE),t.OES_texture_half_float&&(this._formatFeatures[xc.RGB16F]|=Gc.RENDER_TARGET|Gc.SAMPLED_TEXTURE,this._formatFeatures[xc.RGBA16F]|=Gc.RENDER_TARGET|Gc.SAMPLED_TEXTURE),t.OES_texture_float_linear&&(this._formatFeatures[xc.RGB32F]|=Gc.LINEAR_FILTER,this._formatFeatures[xc.RGBA32F]|=Gc.LINEAR_FILTER),t.OES_texture_half_float_linear&&(this._formatFeatures[xc.RGB16F]|=Gc.LINEAR_FILTER,this._formatFeatures[xc.RGBA16F]|=Gc.LINEAR_FILTER);var i=Gc.SAMPLED_TEXTURE|Gc.LINEAR_FILTER;t.WEBGL_compressed_texture_etc1&&(this._formatFeatures[xc.ETC_RGB8]=i),t.WEBGL_compressed_texture_etc&&(this._formatFeatures[xc.ETC2_RGB8]=i,this._formatFeatures[xc.ETC2_RGBA8]=i,this._formatFeatures[xc.ETC2_SRGB8]=i,this._formatFeatures[xc.ETC2_SRGB8_A8]=i,this._formatFeatures[xc.ETC2_RGB8_A1]=i,this._formatFeatures[xc.ETC2_SRGB8_A1]=i),t.WEBGL_compressed_texture_s3tc&&(this._formatFeatures[xc.BC1]=i,this._formatFeatures[xc.BC1_ALPHA]=i,this._formatFeatures[xc.BC1_SRGB]=i,this._formatFeatures[xc.BC1_SRGB_ALPHA]=i,this._formatFeatures[xc.BC2]=i,this._formatFeatures[xc.BC2_SRGB]=i,this._formatFeatures[xc.BC3]=i,this._formatFeatures[xc.BC3_SRGB]=i),t.WEBGL_compressed_texture_pvrtc&&(this._formatFeatures[xc.PVRTC_RGB2]|=i,this._formatFeatures[xc.PVRTC_RGBA2]|=i,this._formatFeatures[xc.PVRTC_RGB4]|=i,this._formatFeatures[xc.PVRTC_RGBA4]|=i),t.WEBGL_compressed_texture_astc&&(this._formatFeatures[xc.ASTC_RGBA_4X4]|=i,this._formatFeatures[xc.ASTC_RGBA_5X4]|=i,this._formatFeatures[xc.ASTC_RGBA_5X5]|=i,this._formatFeatures[xc.ASTC_RGBA_6X5]|=i,this._formatFeatures[xc.ASTC_RGBA_6X6]|=i,this._formatFeatures[xc.ASTC_RGBA_8X5]|=i,this._formatFeatures[xc.ASTC_RGBA_8X6]|=i,this._formatFeatures[xc.ASTC_RGBA_8X8]|=i,this._formatFeatures[xc.ASTC_RGBA_10X5]|=i,this._formatFeatures[xc.ASTC_RGBA_10X6]|=i,this._formatFeatures[xc.ASTC_RGBA_10X8]|=i,this._formatFeatures[xc.ASTC_RGBA_10X10]|=i,this._formatFeatures[xc.ASTC_RGBA_12X10]|=i,this._formatFeatures[xc.ASTC_RGBA_12X12]|=i,this._formatFeatures[xc.ASTC_SRGBA_4X4]|=i,this._formatFeatures[xc.ASTC_SRGBA_5X4]|=i,this._formatFeatures[xc.ASTC_SRGBA_5X5]|=i,this._formatFeatures[xc.ASTC_SRGBA_6X5]|=i,this._formatFeatures[xc.ASTC_SRGBA_6X6]|=i,this._formatFeatures[xc.ASTC_SRGBA_8X5]|=i,this._formatFeatures[xc.ASTC_SRGBA_8X6]|=i,this._formatFeatures[xc.ASTC_SRGBA_8X8]|=i,this._formatFeatures[xc.ASTC_SRGBA_10X5]|=i,this._formatFeatures[xc.ASTC_SRGBA_10X6]|=i,this._formatFeatures[xc.ASTC_SRGBA_10X8]|=i,this._formatFeatures[xc.ASTC_SRGBA_10X10]|=i,this._formatFeatures[xc.ASTC_SRGBA_12X10]|=i,this._formatFeatures[xc.ASTC_SRGBA_12X12]|=i)},i.createCommandBuffer=function(t){var e=new(t.type===ll.PRIMARY?qY:zY);return e.initialize(t),e},i.createSwapchain=function(t){var e=new FK;return this._swapchain=e,e.initialize(t),e},i.createBuffer=function(t){var e=new kY;return e.initialize(t),e},i.createTexture=function(t){var e=new iK;return e.initialize(t),e},i.createDescriptorSet=function(t){var e=new Jj;return e.initialize(t),e},i.createShader=function(t){var e=new tK;return e.initialize(t),e},i.createInputAssembler=function(t){var e=new WY;return e.initialize(t),e},i.createRenderPass=function(t){var e=new ZY;return e.initialize(t),e},i.createFramebuffer=function(t){var e=new VY;return e.initialize(t),e},i.createDescriptorSetLayout=function(t){var e=new XY;return e.initialize(t),e},i.createPipelineLayout=function(t){var e=new jY;return e.initialize(t),e},i.createPipelineState=function(t){var e=new KY;return e.initialize(t),e},i.createQueue=function(t){var e=new QY;return e.initialize(t),e},i.getSampler=function(t){var e=J_.computeHash(t);return this._samplers.has(e)||this._samplers.set(e,new $Y(t,e)),this._samplers.get(e)},i.getSwapchains=function(){return[this._swapchain]},i.getGeneralBarrier=function(t){var e=ef.computeHash(t);return this._generalBarrierss.has(e)||this._generalBarrierss.set(e,new ef(t,e)),this._generalBarrierss.get(e)},i.getTextureBarrier=function(t){var e=nf.computeHash(t);return this._textureBarriers.has(e)||this._textureBarriers.set(e,new nf(t,e)),this._textureBarriers.get(e)},i.getBufferBarrier=function(t){var e=rf.computeHash(t);return this._bufferBarriers.has(e)||this._bufferBarriers.set(e,new rf(t,e)),this._bufferBarriers.get(e)},i.copyBuffersToTexture=function(t,e,i){LY(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,h=0,u=1,c=1;switch(e.glTarget){case r.TEXTURE_2D:for(var l=0;l<n.length;l++){var _=n[l];r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,e.glTarget,e.glTexture,_.texSubres.mipLevel),o=_.texOffset.x,h=_.texOffset.y,u=_.texExtent.width,c=_.texExtent.height,r.readPixels(o,h,u,c,e.glFormat,e.glType,i[l])}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 h=0;h<n.length;h++){var u=n[h];r.texSubImage2D(r.TEXTURE_2D,u.texSubres.mipLevel,u.texOffset.x,u.texOffset.y,i.glFormat,i.glType,e[a++])}break;case r.TEXTURE_CUBE_MAP:for(var c=0;c<n.length;c++){var l=n[c],_=l.texSubres.baseArrayLayer+l.texSubres.layerCount;for(o=l.texSubres.baseArrayLayer;o<_;++o)r.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+o,l.texSubres.mipLevel,l.texOffset.x,l.texOffset.y,i.glFormat,i.glType,e[a++])}break;default:console.error("Unsupported GL texture type, copy buffer to texture failed.")}i.flags&kc.GEN_MIPMAP&&i.isPowerOf2&&r.generateMipmap(i.glTarget)}(this,t,e.gpuTexture,i)},n(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}},{key:"blitManager",get:function(){return this._swapchain.blitManager}}]),e}(B_));g.WebGLDevice=UK,function(t){t[t.Other=0]="Other",t[t.Left=1]="Left",t[t.Right=2]="Right"}(aK||(aK={})),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"}(oK||(oK={})),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"}(hK||(hK={})),s((function(){for(var t,e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return(t=BK.call.apply(BK,[this].concat(i))||this).deviceType=aK.Other,t.hitPoint=new Wi,t}),BK=UC);var kK,GK,HK,zK=new qi;!function(t){t[t.NONE=0]="NONE",t[t.COLOR=1]="COLOR",t[t.SPRITE=2]="SPRITE",t[t.SCALE=3]="SCALE"}(kK||(kK={})),me(kK),function(t){t.NORMAL="normal",t.HOVER="hover",t.PRESSED="pressed",t.DISABLED="disabled"}(GK||(GK={})),function(t){t.CLICK="click"}(HK||(HK={}));var VK=(uK=bs("cc.Button"),cK=ws(110),lK=Is(XF),_K=sa(Lm),fK=sa(kK),dK=sa(nB),pK=sa(nB),mK=sa(nB),gK=sa(nB),vK=sa([Hd]),uK(yK=cK(yK=lK(((LK=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).clickEvents=TK&&TK(),e._interactable=SK&&SK(),e._transition=AK&&AK(),e._normalColor=RK&&RK(),e._hoverColor=CK&&CK(),e._pressedColor=bK&&bK(),e._disabledColor=IK&&IK(),e._normalSprite=wK&&wK(),e._hoverSprite=OK&&OK(),e._pressedSprite=xK&&xK(),e._disabledSprite=NK&&NK(),e._duration=DK&&DK(),e._zoomScale=MK&&MK(),e._target=PK&&PK(),e._pressed=!1,e._hovered=!1,e._fromColor=new qi,e._toColor=new qi,e._time=0,e._transitionFinished=!0,e._fromScale=new Wi,e._toScale=new Wi,e._originalScale=null,e._sprite=null,e._targetScale=new Wi,e}s(e,t);var i=e.prototype;return i.__preload=function(){this.target||(this.target=this.node);var t=this.node.getComponent(WG);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===kK.COLOR||this._transition===kK.SCALE)){this._time+=t;var i=1;if(this._duration>0&&(i=this._time/this._duration),i>=1&&(i=1),this._transition===kK.COLOR){var n=e._uiProps.uiComp;qi.lerp(zK,this._fromColor,this._toColor,i),n&&(n.color=zK)}else this.transition===kK.SCALE&&(e.getScale(this._targetScale),this._targetScale.x=Ai(this._fromScale.x,this._toScale.x,i),this._targetScale.y=Ai(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===kK.COLOR&&this._interactable){var i=t.getComponent(uU);i&&(i.color=this._normalColor)}else e===kK.SCALE&&this._originalScale&&t.setScale(this._originalScale);this._transitionFinished=!0}},i._registerNodeEvent=function(){this.node.on(Xp.TOUCH_START,this._onTouchBegan,this),this.node.on(Xp.TOUCH_MOVE,this._onTouchMove,this),this.node.on(Xp.TOUCH_END,this._onTouchEnded,this),this.node.on(Xp.TOUCH_CANCEL,this._onTouchCancel,this),this.node.on(Xp.MOUSE_ENTER,this._onMouseMoveIn,this),this.node.on(Xp.MOUSE_LEAVE,this._onMouseMoveOut,this),this.node.on(oK.XRUI_HOVER_ENTERED,this._xrHoverEnter,this),this.node.on(oK.XRUI_HOVER_EXITED,this._xrHoverExit,this),this.node.on(oK.XRUI_CLICK,this._xrClick,this),this.node.on(oK.XRUI_UNCLICK,this._xrUnClick,this)},i._registerTargetEvent=function(t){t.on(Xp.TRANSFORM_CHANGED,this._onTargetTransformChanged,this)},i._unregisterNodeEvent=function(){this.node.off(Xp.TOUCH_START,this._onTouchBegan,this),this.node.off(Xp.TOUCH_MOVE,this._onTouchMove,this),this.node.off(Xp.TOUCH_END,this._onTouchEnded,this),this.node.off(Xp.TOUCH_CANCEL,this._onTouchCancel,this),this.node.off(Xp.MOUSE_ENTER,this._onMouseMoveIn,this),this.node.off(Xp.MOUSE_LEAVE,this._onMouseMoveOut,this),this.node.off(oK.XRUI_HOVER_ENTERED,this._xrHoverEnter,this),this.node.off(oK.XRUI_HOVER_EXITED,this._xrHoverExit,this),this.node.off(oK.XRUI_CLICK,this._xrClick,this),this.node.off(oK.XRUI_UNCLICK,this._xrUnClick,this)},i._unregisterTargetEvent=function(t){t.off(Xp.TRANSFORM_CHANGED)},i._getTargetSprite=function(t){var e=null;return t&&(e=t.getComponent(WG)),e},i._applyTarget=function(){this.target&&(this._sprite=this._getTargetSprite(this.target),this._originalScale||(this._originalScale=new Wi),Wi.copy(this._originalScale,this.target.getScale()),this._registerTargetEvent(this.target))},i._onTargetSpriteFrameChanged=function(t){this._transition===kK.SPRITE&&this._setCurrentStateSpriteFrame(t.spriteFrame)},i._setCurrentStateSpriteFrame=function(t){if(t)switch(this._getButtonState()){case GK.NORMAL:this._normalSprite=t;break;case GK.HOVER:this._hoverSprite=t;break;case GK.PRESSED:this._pressedSprite=t;break;case GK.DISABLED:this._disabledSprite=t}},i._onTargetColorChanged=function(t){this._transition===kK.COLOR&&this._setCurrentStateColor(t)},i._setCurrentStateColor=function(t){switch(this._getButtonState()){case GK.NORMAL:this._normalColor=t;break;case GK.HOVER:this._hoverColor=t;break;case GK.PRESSED:this._pressedColor=t;break;case GK.DISABLED:this._disabledColor=t}},i._onTargetTransformChanged=function(t){t&Vp.SCALE&&this._originalScale&&this._transition===kK.SCALE&&this._transitionFinished&&Wi.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(),t.windowId);this._transition===kK.SCALE&&this.target&&this._originalScale?n?(Wi.copy(this._fromScale,this._originalScale),Wi.multiplyScalar(this._toScale,this._originalScale,this._zoomScale),this._transitionFinished=!1):(this._time=0,this._transitionFinished=!0,this.target.setScale(this._originalScale)):(i=n?GK.PRESSED:GK.NORMAL,this._applyTransition(i)),t&&(t.propagationStopped=!0)}}},i._onTouchEnded=function(t){this._interactable&&this.enabledInHierarchy&&(this._pressed&&(Hd.emitEvents(this.clickEvents,t),this.node.emit(HK.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!==kK.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=GK.NORMAL;return this._interactable?this._pressed?t=GK.PRESSED:this._hovered&&(t=GK.HOVER):t=GK.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(uU);n&&(t===GK.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===GK.PRESSED?this._zoomUp():this._zoomBack())},i._zoomUp=function(){this._originalScale&&(Wi.copy(this._fromScale,this._originalScale),Wi.multiplyScalar(this._toScale,this._originalScale,this._zoomScale),this._time=0,this._transitionFinished=!1)},i._zoomBack=function(){this.target&&this._originalScale&&(Wi.copy(this._fromScale,this.target.getScale()),Wi.copy(this._toScale,this._originalScale),this._time=0,this._transitionFinished=!1)},i._applyTransition=function(t){var e=this._transition;e===kK.COLOR?this._updateColorTransition(t):e===kK.SPRITE?this._updateSpriteTransition(t):e===kK.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&&(Hd.emitEvents(this.clickEvents,this),this.node.emit(HK.CLICK,this)),this._pressed=!1,this._updateState())},n(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===kK.COLOR?this._updateColorTransition(GK.NORMAL):this._transition===kK.SPRITE&&this._updateSpriteTransition(GK.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(WG);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}(Wd)).Transition=kK,LK.EventType=HK,d((EK=LK).prototype,"target",[_K],Object.getOwnPropertyDescriptor(EK.prototype,"target"),EK.prototype),d(EK.prototype,"transition",[fK],Object.getOwnPropertyDescriptor(EK.prototype,"transition"),EK.prototype),d(EK.prototype,"normalSprite",[dK],Object.getOwnPropertyDescriptor(EK.prototype,"normalSprite"),EK.prototype),d(EK.prototype,"pressedSprite",[pK],Object.getOwnPropertyDescriptor(EK.prototype,"pressedSprite"),EK.prototype),d(EK.prototype,"hoverSprite",[mK],Object.getOwnPropertyDescriptor(EK.prototype,"hoverSprite"),EK.prototype),d(EK.prototype,"disabledSprite",[gK],Object.getOwnPropertyDescriptor(EK.prototype,"disabledSprite"),EK.prototype),TK=gs(EK.prototype,"clickEvents",[vK,Ls],(function(){return[]})),SK=gs(EK.prototype,"_interactable",[Ls],(function(){return!0})),AK=gs(EK.prototype,"_transition",[Ls],(function(){return kK.NONE})),RK=gs(EK.prototype,"_normalColor",[Ls],(function(){return qi.WHITE.clone()})),CK=gs(EK.prototype,"_hoverColor",[Ls],(function(){return new qi(211,211,211,255)})),bK=gs(EK.prototype,"_pressedColor",[Ls],(function(){return qi.WHITE.clone()})),IK=gs(EK.prototype,"_disabledColor",[Ls],(function(){return new qi(124,124,124,255)})),wK=gs(EK.prototype,"_normalSprite",[Ls],(function(){return null})),OK=gs(EK.prototype,"_hoverSprite",[Ls],(function(){return null})),xK=gs(EK.prototype,"_pressedSprite",[Ls],(function(){return null})),NK=gs(EK.prototype,"_disabledSprite",[Ls],(function(){return null})),DK=gs(EK.prototype,"_duration",[Ls],(function(){return.1})),MK=gs(EK.prototype,"_zoomScale",[Ls],(function(){return 1.2})),PK=gs(EK.prototype,"_target",[Ls],(function(){return null})),yK=EK))||yK)||yK)||yK);t({Button:VK,ButtonComponent:VK}),g.Button=VK;var WK,XK,jK,YK=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}();YK._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"}(WK||(WK={})),fe(WK),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"}(XK||(XK={})),fe(XK),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"}(jK||(jK={})),fe(jK);var KK,qK,QK,ZK,JK,$K,tq,eq,iq,nq,rq,sq,aq,oq,hq,uq,cq,lq,_q,fq,dq,pq,mq,gq,vq,yq,Eq,Tq,Sq,Aq,Rq=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}(),Cq=y.document,bq=new cn,Iq=new cn,wq=new Wi,Oq=null,xq=0;!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_"+ ++xq,e}s(e,t);var i=e.prototype;i.init=function(t){t&&(this._delegate=t,t.inputMode===XK.ANY?this._createTextArea():this._createInput(),YK.add(this),this.setTabIndex(t.tabIndex),this._initStyleSheet(),this._registerEventListeners(),this._addDomToGameContainer())},i.clear=function(){this._removeEventListeners(),this._removeDomFromGameContainer(),YK.remove(this),Oq===this&&(Oq=null),this._delegate=null},i.update=function(){this._updateMatrix()},i.setTabIndex=function(t){this._edTxt.tabIndex=t,YK.resort()},i.setSize=function(t,e){var i=this._edTxt;i&&(i.style.width=t+"px",i.style.height=e+"px")},i.beginEditing=function(){Oq&&Oq!==this&&Oq.setFocus(!1),this._editing=!0,Oq=this,this._delegate._editBoxEditingDidBegan(),this._showDom(),this._edTxt.focus()},i.endEditing=function(){this._edTxt.blur()},i._createInput=function(){this._isTextArea=!1,this._edTxt=Cq.createElement("input")},i._createTextArea=function(){this._isTextArea=!0,this._edTxt=Cq.createElement("textarea")},i._addDomToGameContainer=function(){yL.container&&this._edTxt&&(yL.container.appendChild(this._edTxt),Cq.head.appendChild(this._placeholderStyleSheet))},i._removeDomFromGameContainer=function(){Oe(yL.container,this._edTxt)&&this._edTxt&&yL.container.removeChild(this._edTxt),Oe(Cq.head,this._placeholderStyleSheet)&&Cq.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()),dc.isMobile&&this._showDomOnMobile()},i._hideDom=function(){var t=this._edTxt;t&&this._delegate&&(t.style.display="none",this._delegate._showLabels()),dc.isMobile&&this._hideDomOnMobile()},i._showDomOnMobile=function(){dc.os!==zu.ANDROID&&dc.os!==zu.OHOS||(lc.handleResizeEvent=!1,this._adjustWindowScroll())},i._hideDomOnMobile=function(){dc.os!==zu.ANDROID&&dc.os!==zu.OHOS||(lc.handleResizeEvent=!0),this._scrollBackWindow()},i._adjustWindowScroll=function(){var t=this;setTimeout((function(){y.scrollY<40&&t._edTxt.scrollIntoView({block:"start",inline:"nearest",behavior:"smooth"})}),400)},i._scrollBackWindow=function(){setTimeout((function(){dc.browserType!==ku.WECHAT||dc.os!==zu.IOS?y.scrollTo(0,0):y.top&&y.top.scrollTo(0,0)}),400)},i._updateMatrix=function(){if(this._edTxt){var t=this._delegate.node,e=uz.getScaleX(),i=uz.getScaleY(),n=uz.getViewportRect(),r=lc.devicePixelRatio;t.getWorldMatrix(bq);var s=t._uiProps.uiTransformComp;if(s&&Wi.set(wq,-s.anchorX*s.width,-s.anchorY*s.height,wq.z),cn.transform(bq,bq,wq),t._uiProps.uiTransformComp){var a=fL.root.batcher2D.getFirstRenderCamera(t);if(a){a.node.getWorldRT(Iq);var o=Iq.m12,h=Iq.m13,u=pc.center;Iq.m12=u.x-(Iq.m00*o+Iq.m04*h),Iq.m13=u.y-(Iq.m01*o+Iq.m05*h),cn.multiply(Iq,Iq,bq),e/=r,i/=r;var c=yL.container,l=Iq.m00*e,_=bq.m01,f=bq.m04,d=Iq.m05*i,p=parseInt(c&&c.style.paddingLeft||"0");p+=n.x/r;var m=parseInt(c&&c.style.paddingBottom||"0");m+=n.y/r;var g="matrix("+l+","+-_+","+-f+","+d+","+(Iq.m12*e+p)+","+-(Iq.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===jK.INITIAL_CAPS_ALL_CHARACTERS?s="uppercase":i===jK.INITIAL_CAPS_WORD&&(s="capitalize"),void(r.style.textTransform=s)}if(r=r,i===jK.PASSWORD)return r.type="password",void(r.style.textTransform="none");var a=r.type;e===XK.EMAIL_ADDR?a="email":e===XK.NUMERIC||e===XK.DECIMAL?a="number":e===XK.PHONE_NUMBER?(a="number",r.pattern="[0-9]*",r.addEventListener("wheel",(function(){return!1}))):e===XK.URL?a="url":(a="text",n===WK.SEARCH&&(a="search")),r.type=a;var o="none";i===jK.INITIAL_CAPS_ALL_CHARACTERS?o="uppercase":i===jK.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=Cq.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 SB?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 XU.HorizontalAlign.LEFT:n.style.textAlign="left";break;case XU.HorizontalAlign.CENTER:n.style.textAlign="center";break;case XU.HorizontalAlign.RIGHT:n.style.textAlign="right"}}}},i._updatePlaceholderLabel=function(t){if(t){var e=t.font;e=!e||e instanceof SB?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 XU.HorizontalAlign.LEFT:a="left";break;case XU.HorizontalAlign.CENTER:a="center";break;case XU.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+";}",dc.browserType===ku.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&&dc.isMobile&&t._adjustWindowScroll()},n.onKeydown=function(i){i.keyCode===WC.ENTER?(i.propagationStopped=!0,t._delegate._editBoxEditingReturn(),t._isTextArea||e.blur()):i.keyCode===WC.TAB&&(i.propagationStopped=!0,i.preventDefault(),YK.next(t))},n.onBlur=function(){dc.isMobile&&i&&n.compositionEnd(),t._editing=!1,Oq=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}}}(Rq),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"}(Aq||(Aq={}));var Nq,Dq,Mq,Pq,Lq,Bq,Fq,Uq,kq,Gq,Hq,zq,Vq,Wq,Xq,jq,Yq,Kq,qq,Qq,Zq,Jq,$q,tQ,eQ,iQ,nQ,rQ,sQ,aQ,oQ,hQ,uQ,cQ,lQ=(KK=bs("cc.EditBox"),qK=ws(110),QK=Is(XF),ZK=sa(XU),JK=sa(XU),$K=sa(nB),tq=sa(jK),eq=sa(XK),iq=sa(WK),nq=sa([Hd]),rq=sa([Hd]),sq=sa([Hd]),aq=sa([Hd]),KK(oq=qK(oq=QK(((Sq=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).editingDidBegan=uq&&uq(),e.textChanged=cq&&cq(),e.editingDidEnded=lq&&lq(),e.editingReturn=_q&&_q(),e._impl=null,e._background=null,e._textLabel=fq&&fq(),e._placeholderLabel=dq&&dq(),e._returnType=pq&&pq(),e._string=mq&&mq(),e._tabIndex=gq&&gq(),e._backgroundImage=vq&&vq(),e._inputFlag=yq&&yq(),e._inputMode=Eq&&Eq(),e._maxLength=Tq&&Tq(),e._isLabelVisible=!1,e}s(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(){Hd.emitEvents(this.editingDidBegan,this),this.node.emit(Aq.EDITING_DID_BEGAN,this)},i._editBoxEditingDidEnded=function(t){Hd.emitEvents(this.editingDidEnded,this),this.node.emit(Aq.EDITING_DID_ENDED,this,t)},i._editBoxTextChanged=function(t){t=this._updateLabelStringStyle(t,!0),this.string=t,Hd.emitEvents(this.textChanged,t,this),this.node.emit(Aq.TEXT_CHANGED,this)},i._editBoxEditingReturn=function(t){Hd.emitEvents(this.editingReturn,this),this.node.emit(Aq.EDITING_RETURN,this,t)},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(Xp.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(WG);t||(t=this.node.addComponent(WG)),t!==this._background&&(t.type=WG.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 Lm("TEXT_LABEL")).layer=this.node.layer),(t=e.getComponent(XU))||(t=e.addComponent(XU)),e.parent=this.node,this._textLabel=t}this._inputMode===XK.ANY?(t.verticalAlign=UU.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 Lm("PLACEHOLDER_LABEL")).layer=this.node.layer),(t=e.getComponent(XU))||(t=e.addComponent(XU)),e.parent=this.node,this._placeholderLabel=t}this._inputMode===XK.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!==jK.PASSWORD)n===jK.INITIAL_CAPS_ALL_CHARACTERS?t=t.toUpperCase():n===jK.INITIAL_CAPS_WORD?t=t.replace(/(?:^|\s)\S/g,(function(t){return t.toUpperCase()})):n===jK.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(Xp.TOUCH_START,this._onTouchBegan,this),this.node.on(Xp.TOUCH_END,this._onTouchEnded,this),this.node.on(oK.XRUI_UNCLICK,this._xrUnClick,this),this.node.on(hK.XR_KEYBOARD_INPUT,this._xrKeyBoardInput,this)},i._unregisterEvent=function(){this.node.off(Xp.TOUCH_START,this._onTouchBegan,this),this.node.off(Xp.TOUCH_END,this._onTouchEnded,this),this.node.off(oK.XRUI_UNCLICK,this._xrUnClick,this),this.node.off(hK.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(WG.EventType.SPRITE_FRAME_CHANGED,this._onBackgroundSpriteFrameChanged,this)},i._unregisterBackgroundEvent=function(){var t=this._background&&this._background.node;null==t||t.off(WG.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===XK.ANY&&(s.verticalAlign=UU.TOP),s.enableWrapText=this._inputMode===XK.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===XK.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(Aq.XR_EDITING_DID_BEGAN,this._maxLength,this.string)},i._xrKeyBoardInput=function(t){this.string=t},n(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}(Wd))._EditBoxImpl=Rq,Sq.KeyboardReturnType=WK,Sq.InputFlag=jK,Sq.InputMode=XK,Sq.EventType=Aq,d((hq=Sq).prototype,"textLabel",[ZK],Object.getOwnPropertyDescriptor(hq.prototype,"textLabel"),hq.prototype),d(hq.prototype,"placeholderLabel",[JK],Object.getOwnPropertyDescriptor(hq.prototype,"placeholderLabel"),hq.prototype),d(hq.prototype,"backgroundImage",[$K],Object.getOwnPropertyDescriptor(hq.prototype,"backgroundImage"),hq.prototype),d(hq.prototype,"inputFlag",[tq],Object.getOwnPropertyDescriptor(hq.prototype,"inputFlag"),hq.prototype),d(hq.prototype,"inputMode",[eq],Object.getOwnPropertyDescriptor(hq.prototype,"inputMode"),hq.prototype),d(hq.prototype,"returnType",[iq],Object.getOwnPropertyDescriptor(hq.prototype,"returnType"),hq.prototype),uq=gs(hq.prototype,"editingDidBegan",[nq,Ls],(function(){return[]})),cq=gs(hq.prototype,"textChanged",[rq,Ls],(function(){return[]})),lq=gs(hq.prototype,"editingDidEnded",[sq,Ls],(function(){return[]})),_q=gs(hq.prototype,"editingReturn",[aq,Ls],(function(){return[]})),fq=gs(hq.prototype,"_textLabel",[Ls],(function(){return null})),dq=gs(hq.prototype,"_placeholderLabel",[Ls],(function(){return null})),pq=gs(hq.prototype,"_returnType",[Ls],(function(){return WK.DEFAULT})),mq=gs(hq.prototype,"_string",[Ls],(function(){return""})),gq=gs(hq.prototype,"_tabIndex",[Ls],(function(){return 0})),vq=gs(hq.prototype,"_backgroundImage",[Ls],(function(){return null})),yq=gs(hq.prototype,"_inputFlag",[Ls],(function(){return jK.DEFAULT})),Eq=gs(hq.prototype,"_inputMode",[Ls],(function(){return XK.ANY})),Tq=gs(hq.prototype,"_maxLength",[Ls],(function(){return 20})),oq=hq))||oq)||oq)||oq);t({EditBox:lQ,EditBoxComponent:lQ}),g.internal.EditBox=lQ,function(t){t[t.NONE=0]="NONE",t[t.HORIZONTAL=1]="HORIZONTAL",t[t.VERTICAL=2]="VERTICAL",t[t.GRID=3]="GRID"}(sQ||(sQ={})),me(sQ),function(t){t[t.NONE=0]="NONE",t[t.CONTAINER=1]="CONTAINER",t[t.CHILDREN=2]="CHILDREN"}(aQ||(aQ={})),me(aQ),function(t){t[t.HORIZONTAL=0]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(oQ||(oQ={})),me(oQ),function(t){t[t.BOTTOM_TO_TOP=0]="BOTTOM_TO_TOP",t[t.TOP_TO_BOTTOM=1]="TOP_TO_BOTTOM"}(hQ||(hQ={})),me(hQ),function(t){t[t.LEFT_TO_RIGHT=0]="LEFT_TO_RIGHT",t[t.RIGHT_TO_LEFT=1]="RIGHT_TO_LEFT"}(uQ||(uQ={})),me(uQ),function(t){t[t.NONE=0]="NONE",t[t.FIXED_ROW=1]="FIXED_ROW",t[t.FIXED_COL=2]="FIXED_COL"}(cQ||(cQ={})),me(cQ);var _Q,fQ,dQ,pQ,mQ,gQ,vQ,yQ,EQ,TQ,SQ,AQ,RQ,CQ,bQ=new Wi,IQ=(Nq=bs("cc.Layout"),Dq=ws(110),Mq=Is(XF),Pq=sa(sQ),Lq=sa(aQ),Bq=sa(oQ),Fq=sa(hQ),Uq=sa(uQ),kq=sa(cQ),Nq(Gq=Dq(Gq=Mq(((rQ=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)._resizeMode=zq&&zq(),e._layoutType=Vq&&Vq(),e._cellSize=Wq&&Wq(),e._startAxis=Xq&&Xq(),e._paddingLeft=jq&&jq(),e._paddingRight=Yq&&Yq(),e._paddingTop=Kq&&Kq(),e._paddingBottom=qq&&qq(),e._spacingX=Qq&&Qq(),e._spacingY=Zq&&Zq(),e._verticalDirection=Jq&&Jq(),e._horizontalDirection=$q&&$q(),e._constraint=tQ&&tQ(),e._constraintNum=eQ&&eQ(),e._affectedByScale=iQ&&iQ(),e._isAlign=nQ&&nQ(),e._layoutSize=new vn(300,200),e._layoutDirty=!0,e._childrenDirty=!1,e._usefulLayoutObj=[],e._init=!1,e}s(e,t);var i=e.prototype;return i.updateLayout=function(t){void 0===t&&(t=!1),(this._layoutDirty||t)&&(this._doLayout(),this._layoutDirty=!1)},i.onEnable=function(){this._addEventListeners();var t=this.node._uiProps.uiTransformComp;t.contentSize.equals(vn.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(){fL.on(_L.EVENT_AFTER_UPDATE,this.updateLayout,this),this.node.on(Xp.SIZE_CHANGED,this._resized,this),this.node.on(Xp.ANCHOR_CHANGED,this._doLayoutDirty,this),this.node.on(Xp.CHILD_ADDED,this._childAdded,this),this.node.on(Xp.CHILD_REMOVED,this._childRemoved,this),this.node.on(Xp.SIBLING_ORDER_CHANGED,this._childrenChanged,this),this.node.on("childrenSiblingOrderChanged",this.updateLayout,this),this._addChildrenEventListeners()},i._removeEventListeners=function(){fL.off(_L.EVENT_AFTER_UPDATE,this.updateLayout,this),this.node.off(Xp.SIZE_CHANGED,this._resized,this),this.node.off(Xp.ANCHOR_CHANGED,this._doLayoutDirty,this),this.node.off(Xp.CHILD_ADDED,this._childAdded,this),this.node.off(Xp.CHILD_REMOVED,this._childRemoved,this),this.node.off(Xp.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(Xp.SIZE_CHANGED,this._doLayoutDirty,this),i.on(Xp.TRANSFORM_CHANGED,this._transformDirty,this),i.on(Xp.ANCHOR_CHANGED,this._doLayoutDirty,this),i.on(Xp.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(Xp.SIZE_CHANGED,this._doLayoutDirty,this),i.off(Xp.TRANSFORM_CHANGED,this._transformDirty,this),i.off(Xp.ANCHOR_CHANGED,this._doLayoutDirty,this),i.off(Xp.ACTIVE_IN_HIERARCHY_CHANGED,this._childrenChanged,this)}},i._childAdded=function(t){t.on(Xp.SIZE_CHANGED,this._doLayoutDirty,this),t.on(Xp.TRANSFORM_CHANGED,this._transformDirty,this),t.on(Xp.ANCHOR_CHANGED,this._doLayoutDirty,this),t.on(Xp.ACTIVE_IN_HIERARCHY_CHANGED,this._childrenChanged,this),this._childrenChanged()},i._childRemoved=function(t){t.off(Xp.SIZE_CHANGED,this._doLayoutDirty,this),t.off(Xp.TRANSFORM_CHANGED,this._transformDirty,this),t.off(Xp.ANCHOR_CHANGED,this._doLayoutDirty,this),t.off(Xp.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===uQ.RIGHT_TO_LEFT&&(a=-1,o=this._paddingRight);var h=(this._horizontalDirection-r.x)*t+a*o,u=h-a*this._spacingX,c=0,l=0,_=0,f=0,d=!1,p=this._usefulLayoutObj.length,m=this._cellSize.width,g=this._getPaddingH();this._layoutType!==sQ.GRID&&this._resizeMode===aQ.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===aQ.CHILDREN&&(E.width=m/A,this._layoutType===sQ.GRID&&(E.height=this._cellSize.height/R));var C=Math.abs(this._horizontalDirection-E.anchorX),b=E.width*A,I=E.height*R;I>_&&(f=Math.max(_,f),l=_||I,_=I),u+=a*(C*b+this._spacingX);var w=a*(1-C)*b;if(e){if(s>0)(d=y/s>0&&y%s==0)&&(l=_>I?_:l);else if(b>t-g)u>h+a*C*b&&(d=!0);else{var O=(1-this._horizontalDirection-r.x)*t,x=u+w+a*(a>0?this._paddingRight:this._paddingLeft);d=Math.abs(x)>Math.abs(O)}d&&(u=h+a*C*b,I!==_&&(l=_),c+=l+this._spacingY,l=_=I)}var N=i(T,E,c);n&&T.setPosition(u,N),u+=w}return l=Math.max(l,_),Math.max(f,c+l)+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===hQ.TOP_TO_BOTTOM&&(a=-1,o=this._paddingTop);var h=(this._verticalDirection-r.y)*t+a*o,u=h-a*this._spacingY,c=0,l=0,_=0,f=0,d=!1,p=this._usefulLayoutObj.length,m=this._cellSize.height,g=this._getPaddingV();this._layoutType!==sQ.GRID&&this._resizeMode===aQ.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===aQ.CHILDREN&&(E.height=m/R,this._layoutType===sQ.GRID&&(E.width=this._cellSize.width/A));var C=Math.abs(this._verticalDirection-E.anchorY),b=E.width*A,I=E.height*R;b>c&&(l=Math.max(c,l),_=c||b,c=b),u+=a*(C*I+this._spacingY);var w=a*(1-C)*I;if(e){if(s>0)(d=y/s>0&&y%s==0)&&(_=c>I?c:_);else if(I>t-g)u>h+a*C*I&&(d=!0);else{var O=(1-this._verticalDirection-r.y)*t,x=u+w+a*(a>0?this._paddingTop:this._paddingBottom);d=Math.abs(x)>Math.abs(O)}d&&(u=h+a*C*I,b!==c&&(_=c),f+=_+this._spacingX,_=c=b)}var N=i(T,E,f);n&&(T.getPosition(bQ),T.setPosition(N,u,bQ.z)),u+=w}return _=Math.max(_,c),Math.max(l,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===hQ.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)},h=0;this._resizeMode===aQ.CONTAINER&&(h=this._doLayoutHorizontally(n,!0,o,!1),s=-t.y*h,this._verticalDirection===hQ.TOP_TO_BOTTOM&&(r=-1,s=(1-t.y)*h)),this._doLayoutHorizontally(n,!0,o,!0),this._resizeMode===aQ.CONTAINER&&this.node._uiProps.uiTransformComp.setContentSize(n,h)},i._doLayoutGridAxisVertical=function(t,e){var i=this,n=e.height,r=1,s=-t.x*e.width,a=this._paddingLeft;this._horizontalDirection===uQ.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)},h=0;this._resizeMode===aQ.CONTAINER&&(h=this._doLayoutVertically(n,!0,o,!1),s=-t.x*h,this._horizontalDirection===uQ.RIGHT_TO_LEFT&&(r=-1,s=(1-t.x)*h)),this._doLayoutVertically(n,!0,o,!0),this._resizeMode===aQ.CONTAINER&&this.node._uiProps.uiTransformComp.setContentSize(h,n)},i._doLayoutGrid=function(){var t=this.node._uiProps.uiTransformComp,e=t.anchorPoint,i=t.contentSize;this.startAxis===oQ.HORIZONTAL?this._doLayoutGridAxisHorizontal(e,i):this.startAxis===oQ.VERTICAL&&this._doLayoutGridAxisVertical(e,i)},i._getHorizontalBaseWidth=function(){var t=this._usefulLayoutObj,e=0,i=t.length;if(this._resizeMode===aQ.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===aQ.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===sQ.HORIZONTAL){var e=this._getHorizontalBaseWidth();this._doLayoutHorizontally(e,!1,(function(e){return(t._isAlign?Wi.ZERO:e.position).y}),!0),this.node._uiProps.uiTransformComp.width=e}else if(this._layoutType===sQ.VERTICAL){var i=this._getVerticalBaseHeight();this._doLayoutVertically(i,!1,(function(e){return(t._isAlign?Wi.ZERO:e.position).x}),!0),this.node._uiProps.uiTransformComp.height=i}else this._layoutType===sQ.GRID&&this._doLayoutGrid()},i._getUsedScaleValue=function(t){return this._affectedByScale?Math.abs(t):1},i._transformDirty=function(t){t&Vp.SCALE&&t&Vp.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!==sQ.GRID||this._constraint===cQ.NONE||this._constraintNum<=0)return 0;var t=this._constraint===cQ.FIXED_ROW?Math.ceil(this._usefulLayoutObj.length/this._constraintNum):this._constraintNum;return this._startAxis===oQ.VERTICAL&&(t=this._constraint===cQ.FIXED_COL?Math.ceil(this._usefulLayoutObj.length/this._constraintNum):this._constraintNum),t},n(e,[{key:"alignHorizontal",get:function(){return this._isAlign},set:function(t){this._layoutType===sQ.HORIZONTAL&&(this._isAlign=t,this._doLayoutDirty())}},{key:"alignVertical",get:function(){return this._isAlign},set:function(t){this._layoutType===sQ.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!==sQ.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!==sQ.NONE&&this._constraint!==t&&(this._constraint=t,this._doLayoutDirty())}},{key:"constraintNum",get:function(){return this._constraintNum},set:function(t){this._constraint!==cQ.NONE&&this._constraintNum!==t&&(t<=0&&B("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}(Wd)).Type=sQ,rQ.VerticalDirection=hQ,rQ.HorizontalDirection=uQ,rQ.ResizeMode=aQ,rQ.AxisDirection=oQ,rQ.Constraint=cQ,d((Hq=rQ).prototype,"type",[Pq],Object.getOwnPropertyDescriptor(Hq.prototype,"type"),Hq.prototype),d(Hq.prototype,"resizeMode",[Lq],Object.getOwnPropertyDescriptor(Hq.prototype,"resizeMode"),Hq.prototype),d(Hq.prototype,"startAxis",[Bq],Object.getOwnPropertyDescriptor(Hq.prototype,"startAxis"),Hq.prototype),d(Hq.prototype,"verticalDirection",[Fq],Object.getOwnPropertyDescriptor(Hq.prototype,"verticalDirection"),Hq.prototype),d(Hq.prototype,"horizontalDirection",[Uq],Object.getOwnPropertyDescriptor(Hq.prototype,"horizontalDirection"),Hq.prototype),d(Hq.prototype,"constraint",[kq],Object.getOwnPropertyDescriptor(Hq.prototype,"constraint"),Hq.prototype),zq=gs(Hq.prototype,"_resizeMode",[Ls],(function(){return aQ.NONE})),Vq=gs(Hq.prototype,"_layoutType",[Ls],(function(){return sQ.NONE})),Wq=gs(Hq.prototype,"_cellSize",[Ls],(function(){return new vn(40,40)})),Xq=gs(Hq.prototype,"_startAxis",[Ls],(function(){return oQ.HORIZONTAL})),jq=gs(Hq.prototype,"_paddingLeft",[Ls],(function(){return 0})),Yq=gs(Hq.prototype,"_paddingRight",[Ls],(function(){return 0})),Kq=gs(Hq.prototype,"_paddingTop",[Ls],(function(){return 0})),qq=gs(Hq.prototype,"_paddingBottom",[Ls],(function(){return 0})),Qq=gs(Hq.prototype,"_spacingX",[Ls],(function(){return 0})),Zq=gs(Hq.prototype,"_spacingY",[Ls],(function(){return 0})),Jq=gs(Hq.prototype,"_verticalDirection",[Ls],(function(){return hQ.TOP_TO_BOTTOM})),$q=gs(Hq.prototype,"_horizontalDirection",[Ls],(function(){return uQ.LEFT_TO_RIGHT})),tQ=gs(Hq.prototype,"_constraint",[Ls],(function(){return cQ.NONE})),eQ=gs(Hq.prototype,"_constraintNum",[Ls],(function(){return 2})),iQ=gs(Hq.prototype,"_affectedByScale",[Ls],(function(){return!1})),nQ=gs(Hq.prototype,"_isAlign",[Ls],(function(){return!1})),Gq=Hq))||Gq)||Gq)||Gq);t({Layout:IQ,LayoutComponent:IQ}),g.Layout=IQ,function(t){t[t.HORIZONTAL=0]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL",t[t.FILLED=2]="FILLED"}(CQ||(CQ={})),fe(CQ);var wQ,OQ,xQ,NQ,DQ,MQ,PQ,LQ,BQ,FQ,UQ,kQ,GQ,HQ=(_Q=bs("cc.ProgressBar"),fQ=ws(110),dQ=Is(XF),pQ=sa(WG),mQ=sa(CQ),_Q(gQ=fQ(gQ=dQ(((RQ=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)._barSprite=yQ&&yQ(),e._mode=EQ&&EQ(),e._totalLength=TQ&&TQ(),e._progress=SQ&&SQ(),e._reverse=AQ&&AQ(),e}s(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===WG.FillType.RADIAL&&(this._mode=CQ.FILLED),this._mode===CQ.HORIZONTAL?this.totalLength=r.width:this._mode===CQ.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 pn(0,.5),a=Si(this._progress),o=this._totalLength*a,h=n,u=0,c=0;switch(this._mode){case CQ.HORIZONTAL:this._reverse&&(s=new pn(1,.5)),h=new vn(o,n.height),u=this._totalLength,c=n.height;break;case CQ.VERTICAL:s=this._reverse?new pn(.5,1):new pn(.5,0),h=new vn(n.width,o),u=n.width,c=this._totalLength}if(this._mode===CQ.FILLED)this._barSprite.type!==WG.Type.FILLED?B("ProgressBar FILLED mode only works when barSprite's Type is FILLED!"):(this._reverse&&(o*=-1),this._barSprite.fillRange=o);else if(this._barSprite.type!==WG.Type.FILLED){var l=s.x-i.x,_=s.y-i.y,f=new Wi(u*l,c*_,0);t.setPosition(r.x+f.x,r.y+f.y,r.z),e.setAnchorPoint(s),e.setContentSize(h)}else B("ProgressBar non-FILLED mode only works when barSprite's Type is non-FILLED!")}},n(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===CQ.HORIZONTAL?this.totalLength=i.width:this._mode===CQ.VERTICAL?this.totalLength=i.height:this._mode===CQ.FILLED&&(this.totalLength=this._barSprite.fillRange)}}},{key:"totalLength",get:function(){return this._totalLength},set:function(t){this._mode===CQ.FILLED&&(t=Si(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}(Wd)).Mode=CQ,d((vQ=RQ).prototype,"barSprite",[pQ],Object.getOwnPropertyDescriptor(vQ.prototype,"barSprite"),vQ.prototype),d(vQ.prototype,"mode",[mQ],Object.getOwnPropertyDescriptor(vQ.prototype,"mode"),vQ.prototype),yQ=gs(vQ.prototype,"_barSprite",[Ls],(function(){return null})),EQ=gs(vQ.prototype,"_mode",[Ls],(function(){return CQ.HORIZONTAL})),TQ=gs(vQ.prototype,"_totalLength",[Ls],(function(){return 1})),SQ=gs(vQ.prototype,"_progress",[Ls],(function(){return.1})),AQ=gs(vQ.prototype,"_reverse",[Ls],(function(){return!1})),gQ=vQ))||gQ)||gQ)||gQ);t({ProgressBar:HQ,ProgressBarComponent:HQ}),g.ProgressBar=HQ;var zQ,VQ=new Wi,WQ=new Wi,XQ=new Wi,jQ=new pn,YQ=new qi,KQ=new pn;!function(t){t[t.HORIZONTAL=0]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(zQ||(zQ={})),me(zQ);var qQ,QQ=(wQ=bs("cc.ScrollBar"),OQ=ws(110),xQ=Is(XF),NQ=sa(WG),DQ=sa(zQ),wQ(MQ=OQ(MQ=xQ(((GQ=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)._scrollView=LQ&&LQ(),e._handle=BQ&&BQ(),e._direction=FQ&&FQ(),e._enableAutoHide=UQ&&UQ(),e._autoHideTime=kQ&&kQ(),e._touching=!1,e._opacity=255,e._autoHideRemainingTime=0,e}s(e,t);var i=e.prototype;return i.hide=function(){this._autoHideRemainingTime=0,this._setOpacity(0)},i.show=function(){this._autoHideRemainingTime=this._autoHideTime,this._opacity=255,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,h=0,u=0,c=KQ;c.set(0,0),this._direction===zQ.HORIZONTAL?(s=i.width,a=n.width,u=r.width,o=t.x,this._convertToScrollViewSpace(c,e),h=-c.x):this._direction===zQ.VERTICAL&&(s=i.height,a=n.height,u=r.height,o=t.y,this._convertToScrollViewSpace(c,e),h=-c.y);var l=this._calculateLength(s,a,u,o),_=KQ;this._calculatePosition(_,s,a,u,h,o,l),this._updateLength(l),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(WG);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){VQ.set(-n.anchorX*n.width,-n.anchorY*n.height,0),n.convertToWorldSpaceAR(VQ,WQ);var r=i.convertToNodeSpaceAR(WQ);r.x+=i.anchorX*i.width,r.y+=i.anchorY*i.height,t.set(r.x,r.y)}else t.set(pn.ZERO)},i._setOpacity=function(t){if(this._handle){var e=this.node.getComponent(WG);e&&(YQ.set(e.color),YQ.a=t,e.color=YQ),(e=this._handle.getComponent(WG))&&(YQ.set(e.color),YQ.a=t,e.color=YQ)}},i._updateHandlerPosition=function(t){if(this._handle){var e=XQ;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;Wi.set(VQ,-i.width*n.x,-i.height*n.y,0);var a=this.node._uiProps.uiTransformComp.convertToWorldSpaceAR(VQ,WQ),o=t;o.set(0,0,0),s._uiProps.uiTransformComp.convertToNodeSpaceAR(a,o),this.direction===zQ.HORIZONTAL?o.set(o.x,o.y+(i.height-r.height)/2,o.z):this.direction===zQ.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===zQ.HORIZONTAL||t.height<=e.height&&this._direction===zQ.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 h=0;o&&(h=Si(h=r/o));var u=(n-a)*h;this._direction===zQ.VERTICAL?t.set(0,u):t.set(u,0)},i._updateLength=function(t){if(this._handle){var e=this._handle.node._uiProps.uiTransformComp,i=e.contentSize,n=e.anchorPoint;n.x===jQ.x&&n.y===jQ.y||e.setAnchorPoint(jQ),this._direction===zQ.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)}},n(e,[{key:"handle",get:function(){return this._handle},set:function(t){this._handle!==t&&(this._handle=t,this.onScroll(pn.ZERO))}},{key:"direction",get:function(){return this._direction},set:function(t){this._direction!==t&&(this._direction=t,this.onScroll(pn.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}(Wd)).Direction=zQ,d((PQ=GQ).prototype,"handle",[NQ],Object.getOwnPropertyDescriptor(PQ.prototype,"handle"),PQ.prototype),d(PQ.prototype,"direction",[DQ],Object.getOwnPropertyDescriptor(PQ.prototype,"direction"),PQ.prototype),LQ=gs(PQ.prototype,"_scrollView",[Ls],(function(){return null})),BQ=gs(PQ.prototype,"_handle",[Ls],(function(){return null})),FQ=gs(PQ.prototype,"_direction",[Ls],(function(){return zQ.HORIZONTAL})),UQ=gs(PQ.prototype,"_enableAutoHide",[Ls],(function(){return!1})),kQ=gs(PQ.prototype,"_autoHideTime",[Ls],(function(){return 1})),MQ=PQ))||MQ)||MQ)||MQ);t({ScrollBar:QQ,ScrollBarComponent:QQ}),g.ScrollBar=QQ;var ZQ,JQ,$Q,tZ,eZ,iZ,nZ,rZ,sZ,aZ,oZ,hZ,uZ,cZ,lZ,_Z,fZ,dZ,pZ,mZ,gZ,vZ=t("ViewGroup",bs("cc.ViewGroup")(qQ=ws(110)(qQ=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(Wd))||qQ)||qQ);g.ViewGroup=vZ;var yZ,EZ,TZ=1e-4,SZ=new Wi,AZ=new Wi,RZ=new pn,CZ=new pn,bZ=function(){return(new Date).getMilliseconds()},IZ={"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"}(yZ||(yZ={})),function(t){t[t.NONE=0]="NONE",t[t.LEFT=1]="LEFT",t[t.RIGHT=2]="RIGHT"}(EZ||(EZ={}));var wZ,OZ,xZ,NZ,DZ,MZ,PZ,LZ,BZ,FZ,UZ,kZ,GZ,HZ=(ZQ=bs("cc.ScrollView"),JQ=ws(110),$Q=Is(XF),tZ=sa(Lm),eZ=sa(QQ),iZ=sa(QQ),nZ=sa([Hd]),ZQ(rZ=JQ(rZ=$Q(((gZ=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).bounceDuration=aZ&&aZ(),e.brake=oZ&&oZ(),e.elastic=hZ&&hZ(),e.inertia=uZ&&uZ(),e.horizontal=cZ&&cZ(),e.vertical=lZ&&lZ(),e.cancelInnerEvents=_Z&&_Z(),e.scrollEvents=fZ&&fZ(),e._autoScrolling=!1,e._scrolling=!1,e._content=dZ&&dZ(),e._horizontalScrollBar=pZ&&pZ(),e._verticalScrollBar=mZ&&mZ(),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 Wi,e._autoScrollTargetDelta=new Wi,e._autoScrollTotalTime=0,e._autoScrollAccumulatedTime=0,e._autoScrollCurrentlyOutOfBoundary=!1,e._autoScrollBraking=!1,e._autoScrollBrakingStartPosition=new Wi,e._outOfBoundaryAmount=new Wi,e._outOfBoundaryAmountDirty=!0,e._stopMouseWheel=!1,e._mouseWheelEventElapsedTime=0,e._isScrollEndedWithThresholdEventFired=!1,e._scrollEventEmitMask=0,e._isBouncing=!1,e._contentPos=new Wi,e._deltaPos=new Wi,e._hoverIn=EZ.NONE,e}s(e,t);var i=e.prototype;return i.scrollToBottom=function(t,e){void 0===e&&(e=!0);var i=this._calculateMovePercentDelta({anchor:new pn(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 pn(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 pn(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 pn(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 pn(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 pn(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 pn(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 pn(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 pn(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 pn(e,t)},i.getMaxScrollOffset=function(){if(!this._content||!this.view)return pn.ZERO;var t=this._content._uiProps.uiTransformComp.contentSize,e=t.width-this.view.width,i=t.height-this.view.height;return new pn(e=e>=0?e:0,i=i>=0?i:0)},i.scrollToPercentHorizontal=function(t,e,i){var n=this._calculateMovePercentDelta({anchor:new pn(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 pn(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 pn(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)<TZ&&Math.abs(t.y-e.y)<TZ||(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):Wi.ZERO.clone()},i.isScrolling=function(){return this._scrolling},i.isAutoScrolling=function(){return this._autoScrolling},i.getScrollEndedEventTiming=function(){return TZ},i.start=function(){this._calculateBoundary(),this._content&&fL.once(_L.EVENT_BEFORE_DRAW,this._adjustContentOutOfBoundary,this)},i.onEnable=function(){this._registerEvent(),this._content&&(this._content.on(Xp.SIZE_CHANGED,this._calculateBoundary,this),this._content.on(Xp.TRANSFORM_CHANGED,this._scaleChanged,this),this.view&&(this.view.node.on(Xp.TRANSFORM_CHANGED,this._scaleChanged,this),this.view.node.on(Xp.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(Xp.SIZE_CHANGED,this._calculateBoundary,this),this._content.off(Xp.TRANSFORM_CHANGED,this._scaleChanged,this),this.view&&(this.view.node.off(Xp.TRANSFORM_CHANGED,this._scaleChanged,this),this.view.node.off(Xp.SIZE_CHANGED,this._calculateBoundary,this))),this._hideScrollBar(),this.stopAutoScroll()},i._registerEvent=function(){this.node.on(Xp.TOUCH_START,this._onTouchBegan,this,!0),this.node.on(Xp.TOUCH_MOVE,this._onTouchMoved,this,!0),this.node.on(Xp.TOUCH_END,this._onTouchEnded,this,!0),this.node.on(Xp.TOUCH_CANCEL,this._onTouchCancelled,this,!0),this.node.on(Xp.MOUSE_WHEEL,this._onMouseWheel,this,!0),this.node.on(oK.XRUI_HOVER_ENTERED,this._xrHoverEnter,this),this.node.on(oK.XRUI_HOVER_EXITED,this._xrHoverExit,this),Cb.on(Rb.EventType.HANDLE_INPUT,this._dispatchEventHandleInput,this),Cb.on(Rb.EventType.GAMEPAD_INPUT,this._dispatchEventHandleInput,this)},i._unregisterEvent=function(){this.node.off(Xp.TOUCH_START,this._onTouchBegan,this,!0),this.node.off(Xp.TOUCH_MOVE,this._onTouchMoved,this,!0),this.node.off(Xp.TOUCH_END,this._onTouchEnded,this,!0),this.node.off(Xp.TOUCH_CANCEL,this._onTouchCancelled,this,!0),this.node.off(Xp.MOUSE_WHEEL,this._onMouseWheel,this,!0),this.node.off(oK.XRUI_HOVER_ENTERED,this._xrHoverEnter,this),this.node.off(oK.XRUI_HOVER_EXITED,this._xrHoverExit,this),Cb.off(Rb.EventType.HANDLE_INPUT,this._dispatchEventHandleInput,this),Cb.off(Rb.EventType.GAMEPAD_INPUT,this._dispatchEventHandleInput,this)},i._onMouseWheel=function(t,e){if(this.enabledInHierarchy&&!this._hasNestedViewGroup(t,e)){var i=new Wi,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(RZ);if(n.subtract(i.getUIStartLocation(CZ)),n.length()>7&&!this._touchMoved&&t.target!==this.node){var r=new VC(t.getTouches(),t.bubbles,BC.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(yZ.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(IQ);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!==UC.CAPTURING_PHASE)return!1;if(e)for(var i,n=f(e);!(i=n()).done;){var r=i.value;if(this.node===r)return!(!t.target||!t.target.getComponent(vZ));if(r.getComponent(vZ))return!0}return!1},i._startInertiaScroll=function(t){var e=new Wi(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),h=this._calculateAttenuatedFactor(a);i.x=i.x*s*(1-this.brake)*o,i.y=i.y*a*h*(1-this.brake),i.z=0}var u=t.length(),c=i.length()/u;if(i.add(t),this.brake>0&&c>7){c=Math.sqrt(c);var l=t.clone();l.multiplyScalar(c),i.set(l),i.add(t)}var _=this._calculateAutoScrollTimeByInitialSpeed(e.length());this.brake>0&&c>3&&(_*=c=3),0===this.brake&&c>1&&(_*=c),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,Wi.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(Wi.ZERO,TZ)||(this._autoScrollCurrentlyOutOfBoundary=!0)},i._calculateTouchMoveVelocity=function(){var t=new Wi,e=0;if((e=this._touchMoveTimeDeltas.reduce((function(t,e){return t+e}),e))<=0||e>=.5)t.set(Wi.ZERO);else{var i=new Wi;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);SZ.set(this._getContentPosition()),SZ.add(i),SZ.set(Math.round(1e4*SZ.x)*TZ,Math.round(1e4*SZ.y)*TZ,SZ.z),this._setContentPosition(SZ);var n=this._getHowMuchOutOfBoundary();RZ.set(n.x,n.y),this._updateScrollBar(RZ),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 Wi).equals(Wi.ZERO,TZ)&&!this._outOfBoundaryAmountDirty)return this._outOfBoundaryAmount;var e=new Wi,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(Wi.ZERO,TZ)&&(this._outOfBoundaryAmount=e,this._outOfBoundaryAmountDirty=!1),this._clampDelta(e),e},i._updateScrollBar=function(t){this._horizontalScrollBar&&this._horizontalScrollBar.isValid&&this._horizontalScrollBar.onScroll(t),this._verticalScrollBar&&this._verticalScrollBar.isValid&&this._verticalScrollBar.onScroll(t)},i._onScrollBarTouchBegan=function(){this._horizontalScrollBar&&this._horizontalScrollBar.isValid&&this._horizontalScrollBar.onTouchBegan(),this._verticalScrollBar&&this._verticalScrollBar.isValid&&this._verticalScrollBar.onTouchBegan()},i._onScrollBarTouchEnded=function(){this._horizontalScrollBar&&this._horizontalScrollBar.isValid&&this._horizontalScrollBar.onTouchEnded(),this._verticalScrollBar&&this._verticalScrollBar.isValid&&this._verticalScrollBar.onTouchEnded()},i._dispatchEvent=function(t){if(t===yZ.SCROLL_ENDED)this._scrollEventEmitMask=0;else if(t===yZ.SCROLL_TO_TOP||t===yZ.SCROLL_TO_BOTTOM||t===yZ.SCROLL_TO_LEFT||t===yZ.SCROLL_TO_RIGHT){var e=1<<IZ[t];if(this._scrollEventEmitMask&e)return;this._scrollEventEmitMask|=e}Hd.emitEvents(this.scrollEvents,this,IZ[t]),this.node.emit(t,this)},i._adjustContentOutOfBoundary=function(){if(this._content&&(this._outOfBoundaryAmountDirty=!0,this._isOutOfBoundary())){var t=this._getHowMuchOutOfBoundary();SZ.set(this._getContentPosition()),SZ.add(t),this._setContentPosition(SZ),this._updateScrollBar(pn.ZERO)}},i._hideScrollBar=function(){this._horizontalScrollBar&&this._horizontalScrollBar.isValid&&this._horizontalScrollBar.hide(),this._verticalScrollBar&&this._verticalScrollBar.isValid&&this._verticalScrollBar.hide()},i._updateScrollBarState=function(){if(this._content&&this.view){var t=this.view,e=this._content._uiProps.uiTransformComp;this._verticalScrollBar&&this._verticalScrollBar.isValid&&(e.height<t.height?this._verticalScrollBar.hide():this._verticalScrollBar.show()),this._horizontalScrollBar&&this._horizontalScrollBar.isValid&&(e.width<t.width?this._horizontalScrollBar.hide():this._horizontalScrollBar.show())}},i._stopPropagationIfTargetIsMe=function(t){t.eventPhase===UC.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(yZ.SCROLL_ENDED))},i._getLocalAxisAlignDelta=function(t,e){var i=this.node._uiProps.uiTransformComp,n=new Wi;i&&(e.getUILocation(RZ),e.getUIPreviousLocation(CZ),SZ.set(RZ.x,RZ.y,0),AZ.set(CZ.x,CZ.y,0),i.convertToNodeSpaceAR(SZ,SZ),i.convertToNodeSpaceAR(AZ,AZ),Wi.subtract(n,SZ,AZ)),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,h=s.width,u=s.height,c=this._content.position||Wi.ZERO;this.vertical&&(i.y>0?c.y-o*u+i.y>=this._bottomBoundary&&(n=yZ.SCROLL_TO_BOTTOM):i.y<0&&c.y-o*u+u+i.y<=this._topBoundary&&(n=yZ.SCROLL_TO_TOP)),this.horizontal&&(i.x<0?c.x-a*h+h+i.x<=this._rightBoundary&&(r=yZ.SCROLL_TO_RIGHT):i.x>0&&c.x-a*h+i.x>=this._leftBoundary&&(r=yZ.SCROLL_TO_LEFT))}this._moveContent(i,!1),(this.horizontal&&0!==i.x||this.vertical&&0!==i.y)&&(this._scrolling||(this._scrolling=!0,this._dispatchEvent(yZ.SCROLL_BEGAN)),this._dispatchEvent(yZ.SCROLLING)),""!==n&&this._dispatchEvent(n),""!==r&&this._dispatchEvent(r)},i._handlePressLogic=function(){this._autoScrolling&&this._dispatchEvent(yZ.SCROLL_ENDED),this._autoScrolling=!1,this._isBouncing=!1,this._touchMovePreviousTimestamp=bZ(),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=bZ();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(Wi.ZERO,TZ))return!1;var e=Math.max(this.bounceDuration,0);return this._startAutoScroll(t,e,!0),this._isBouncing||(t.y>0&&this._dispatchEvent(yZ.BOUNCE_TOP),t.y<0&&this._dispatchEvent(yZ.BOUNCE_BOTTOM),t.x>0&&this._dispatchEvent(yZ.BOUNCE_RIGHT),t.x<0&&this._dispatchEvent(yZ.BOUNCE_LEFT),this._isBouncing=!0),!0},i._processInertiaScroll=function(){if(!this._startBounceBackIfNeeded()&&this.inertia){var t=this._calculateTouchMoveVelocity();!t.equals(SZ,TZ)&&this.brake<1&&this._startInertiaScroll(t)}this._onScrollBarTouchEnded()},i._isOutOfBoundary=function(){return!this._getHowMuchOutOfBoundary().equals(Wi.ZERO,TZ)},i._isNecessaryAutoScrollBrake=function(){if(this._autoScrollBraking)return!0;if(this._isOutOfBoundary()){if(!this._autoScrollCurrentlyOutOfBoundary)return this._autoScrollCurrentlyOutOfBoundary=!0,this._autoScrollBraking=!0,Wi.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)<=TZ;if(Math.abs(r-1)<=this.getScrollEndedEventTiming()&&!this._isScrollEndedWithThresholdEventFired&&(this._dispatchEvent(yZ.SCROLL_ENG_WITH_THRESHOLD),this._isScrollEndedWithThresholdEventFired=!0),this.elastic){var h=a.clone();h.subtract(this._autoScrollBrakingStartPosition),e&&h.multiplyScalar(i),a.set(this._autoScrollBrakingStartPosition),a.add(h)}else{var u=a.clone();u.subtract(this.getContentPosition());var c=this._getHowMuchOutOfBoundary(u);c.equals(Wi.ZERO,TZ)||(a.add(c),o=!0)}o&&(this._autoScrolling=!1);var l=a.clone();l.subtract(this._getContentPosition()),this._clampDelta(l),this._moveContent(l,o),this._dispatchEvent(yZ.SCROLLING),this._autoScrolling||(this._isBouncing=!1,this._scrolling=!1,this._dispatchEvent(yZ.SCROLL_ENDED))},i._checkMouseWheel=function(t){if(!this._getHowMuchOutOfBoundary().equals(Wi.ZERO,TZ))return this._processInertiaScroll(),this.unschedule(this._checkMouseWheel),this._dispatchEvent(yZ.SCROLL_ENDED),void(this._stopMouseWheel=!1);this._mouseWheelEventElapsedTime+=t,this._mouseWheelEventElapsedTime>.1&&(this._onScrollBarTouchEnded(),this.unschedule(this._checkMouseWheel),this._dispatchEvent(yZ.SCROLL_ENDED),this._stopMouseWheel=!1)},i._calculateMovePercentDelta=function(t){var e=t.anchor,i=t.applyToHorizontal,n=t.applyToVertical;this._calculateBoundary(),e.clampf(pn.ZERO,pn.ONE);var r=this._getContentBottomBoundary()-this._bottomBoundary;r=-r;var s=this._getContentLeftBoundary()-this._leftBoundary;s=-s;var a=new Wi;if(this._content&&this.view){var o=0,h=this._content._uiProps.uiTransformComp.contentSize,u=this.view.contentSize;i&&(o=h.width-u.width,a.x=s-o*e.x),n&&(o=h.height-u.height,a.y=r-o*e.y)}return a},i._moveContentToTopLeft=function(t){var e=this._getContentBottomBoundary()-this._bottomBoundary;e=-e;var i=new Wi,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===Vp.SCALE&&this._calculateBoundary()},i._xrHoverEnter=function(t){t.deviceType===aK.Left?this._hoverIn=EZ.LEFT:t.deviceType===aK.Right&&(this._hoverIn=EZ.RIGHT)},i._xrHoverExit=function(){this._hoverIn=EZ.NONE},i._dispatchEventHandleInput=function(t){var e,i;t instanceof XC?e=t.gamepad:t instanceof jC&&(e=t.handleInputDevice),this.enabledInHierarchy&&this._hoverIn!==EZ.NONE&&(this._hoverIn===EZ.LEFT?(i=e.leftStick.getValue()).equals(pn.ZERO)||this._xrThumbStickMove(i):this._hoverIn===EZ.RIGHT&&((i=e.rightStick.getValue()).equals(pn.ZERO)||this._xrThumbStickMove(i)))},i._xrThumbStickMove=function(t){if(this.enabledInHierarchy){var e=new Wi,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._stopMouseWheel||(this._handlePressLogic(),this.schedule(this._checkMouseWheel,1/60,NaN,0),this._stopMouseWheel=!0)}},n(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&&!this._horizontalScrollBar.isValid&&K(4303,"horizontal",this.node.name),this._horizontalScrollBar},set:function(t){this._horizontalScrollBar!==t&&(this._horizontalScrollBar=t,this._horizontalScrollBar&&(this._horizontalScrollBar.setScrollView(this),this._updateScrollBar(pn.ZERO)))}},{key:"verticalScrollBar",get:function(){return this._verticalScrollBar&&!this._verticalScrollBar.isValid&&K(4303,"vertical",this.node.name),this._verticalScrollBar},set:function(t){this._verticalScrollBar!==t&&(this._verticalScrollBar=t,this._verticalScrollBar&&(this._verticalScrollBar.setScrollView(this),this._updateScrollBar(pn.ZERO)))}},{key:"view",get:function(){var t=this._content&&this._content.parent;return t?t._uiProps.uiTransformComp:null}}]),e}(vZ)).EventType=yZ,aZ=gs((sZ=gZ).prototype,"bounceDuration",[Ls],(function(){return 1})),oZ=gs(sZ.prototype,"brake",[Ls],(function(){return.5})),hZ=gs(sZ.prototype,"elastic",[Ls],(function(){return!0})),uZ=gs(sZ.prototype,"inertia",[Ls],(function(){return!0})),d(sZ.prototype,"content",[tZ],Object.getOwnPropertyDescriptor(sZ.prototype,"content"),sZ.prototype),cZ=gs(sZ.prototype,"horizontal",[Ls],(function(){return!0})),d(sZ.prototype,"horizontalScrollBar",[eZ],Object.getOwnPropertyDescriptor(sZ.prototype,"horizontalScrollBar"),sZ.prototype),lZ=gs(sZ.prototype,"vertical",[Ls],(function(){return!0})),d(sZ.prototype,"verticalScrollBar",[iZ],Object.getOwnPropertyDescriptor(sZ.prototype,"verticalScrollBar"),sZ.prototype),_Z=gs(sZ.prototype,"cancelInnerEvents",[Ls],(function(){return!0})),fZ=gs(sZ.prototype,"scrollEvents",[nZ,Ls],(function(){return[]})),dZ=gs(sZ.prototype,"_content",[Ls],(function(){return null})),pZ=gs(sZ.prototype,"_horizontalScrollBar",[Ls],(function(){return null})),mZ=gs(sZ.prototype,"_verticalScrollBar",[Ls],(function(){return null})),rZ=sZ))||rZ)||rZ)||rZ);t({ScrollView:HZ,ScrollViewComponent:HZ}),g.ScrollView=HZ;var zZ,VZ=new Wi;!function(t){t[t.Horizontal=0]="Horizontal",t[t.Vertical=1]="Vertical"}(zZ||(zZ={})),me(zZ);var WZ,XZ,jZ,YZ,KZ,qZ,QZ,ZZ,JZ,$Z,tJ,eJ,iJ=(wZ=bs("cc.Slider"),OZ=ws(110),xZ=Is(XF),NZ=sa(WG),DZ=sa(zZ),MZ=sa([Hd]),wZ(PZ=OZ(PZ=xZ(((GZ=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).slideEvents=BZ&&BZ(),e._handle=FZ&&FZ(),e._direction=UZ&&UZ(),e._progress=kZ&&kZ(),e._offset=new Wi,e._dragging=!1,e._touchHandle=!1,e._handleLocalPos=new Wi,e._touchPos=new Wi,e}s(e,t);var i=e.prototype;return i.__preload=function(){this._updateHandlePosition()},i.onEnable=function(){this._updateHandlePosition(),this.node.on(Xp.TOUCH_START,this._onTouchBegan,this),this.node.on(Xp.TOUCH_MOVE,this._onTouchMoved,this),this.node.on(Xp.TOUCH_END,this._onTouchEnded,this),this.node.on(Xp.TOUCH_CANCEL,this._onTouchCancelled,this),this.node.on(oK.XRUI_HOVER_STAY,this._xrHoverStay,this),this.node.on(oK.XRUI_CLICK,this._xrClick,this),this.node.on(oK.XRUI_UNCLICK,this._xrUnClick,this),this._handle&&this._handle.isValid&&(this._handle.node.on(Xp.TOUCH_START,this._onHandleDragStart,this),this._handle.node.on(Xp.TOUCH_MOVE,this._onTouchMoved,this),this._handle.node.on(Xp.TOUCH_END,this._onTouchEnded,this))},i.onDisable=function(){this.node.off(Xp.TOUCH_START,this._onTouchBegan,this),this.node.off(Xp.TOUCH_MOVE,this._onTouchMoved,this),this.node.off(Xp.TOUCH_END,this._onTouchEnded,this),this.node.off(Xp.TOUCH_CANCEL,this._onTouchCancelled,this),this.node.off(oK.XRUI_HOVER_STAY,this._xrHoverStay,this),this.node.off(oK.XRUI_CLICK,this._xrClick,this),this.node.off(oK.XRUI_UNCLICK,this._xrUnClick,this),this._handle&&this._handle.isValid&&(this._handle.node.off(Xp.TOUCH_START,this._onHandleDragStart,this),this._handle.node.off(Xp.TOUCH_MOVE,this._onTouchMoved,this),this._handle.node.off(Xp.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();Wi.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 Wi,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(){Hd.emitEvents(this.slideEvents,this),this.node.emit("slide",this)},i._updateProgress=function(t){if(this._handle&&t){var e=t.getUILocation();Wi.set(this._touchPos,e.x,e.y,0);var i=this.node._uiProps.uiTransformComp,n=i.convertToNodeSpaceAR(this._touchPos,VZ);this.direction===zZ.Horizontal?this.progress=Si(.5+(n.x-this._offset.x)/i.width):this.progress=Si(.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===zZ.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===zZ.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,VZ),this.direction===zZ.Horizontal?this.progress=Si(.5+(VZ.x-this.node.position.x)/e.width):this.progress=Si(.5+(VZ.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())},n(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}(Wd)).Direction=zZ,d((LZ=GZ).prototype,"handle",[NZ],Object.getOwnPropertyDescriptor(LZ.prototype,"handle"),LZ.prototype),d(LZ.prototype,"direction",[DZ],Object.getOwnPropertyDescriptor(LZ.prototype,"direction"),LZ.prototype),BZ=gs(LZ.prototype,"slideEvents",[MZ,Ls],(function(){return[]})),FZ=gs(LZ.prototype,"_handle",[Ls],(function(){return null})),UZ=gs(LZ.prototype,"_direction",[Ls],(function(){return zZ.Horizontal})),kZ=gs(LZ.prototype,"_progress",[Ls],(function(){return.1})),PZ=LZ))||PZ)||PZ)||PZ);function nJ(){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))}t({Slider:iJ,SliderComponent:iJ}),g.Slider=iJ,function(t){t.TOGGLE="toggle"}(eJ||(eJ={}));var rJ,sJ,aJ,oJ,hJ,uJ,cJ,lJ=(WZ=bs("cc.Toggle"),XZ=ws(110),jZ=Is(XF),YZ=sa(WG),KZ=sa([Hd]),WZ(qZ=XZ(qZ=jZ(((tJ=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).checkEvents=ZZ&&ZZ(),e._isChecked=JZ&&JZ(),e._checkMark=$Z&&$Z(),e}s(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._emitToggleEvents=function(){this.node.emit(e.EventType.TOGGLE,this),this.checkEvents&&Hd.emitEvents(this.checkEvents,this)},n(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 g.Node.isNode(t)?t.getComponent("cc.ToggleContainer"):null}}]),e}(VK)).EventType=nJ(eJ,HK),d((QZ=tJ).prototype,"checkMark",[YZ],Object.getOwnPropertyDescriptor(QZ.prototype,"checkMark"),QZ.prototype),ZZ=gs(QZ.prototype,"checkEvents",[KZ,Ls],(function(){return[]})),JZ=gs(QZ.prototype,"_isChecked",[Ls],(function(){return!0})),$Z=gs(QZ.prototype,"_checkMark",[Ls],(function(){return null})),qZ=QZ))||qZ)||qZ)||qZ);t({Toggle:lJ,ToggleComponent:lJ}),g.Toggle=lJ;var _J,fJ,dJ,pJ,mJ,gJ,vJ,yJ,EJ,TJ,SJ,AJ,RJ,CJ,bJ,IJ,wJ,OJ,xJ,NJ,DJ,MJ,PJ,LJ,BJ,FJ,UJ=(rJ=bs("cc.ToggleContainer"),sJ=ws(110),aJ=sa([Hd]),rJ(oJ=sJ((hJ=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)._allowSwitchOff=uJ&&uJ(),e.checkEvents=cJ&&cJ(),e}s(e,t);var i=e.prototype;return i.onEnable=function(){this.ensureValidState(),this.node.on(Xp.CHILD_ADDED,this.ensureValidState,this),this.node.on(Xp.CHILD_REMOVED,this.ensureValidState,this)},i.onDisable=function(){this.node.off(Xp.CHILD_ADDED,this.ensureValidState,this),this.node.off(Xp.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&&g.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)}},n(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}(Wd),uJ=gs(hJ.prototype,"_allowSwitchOff",[Ls],(function(){return!1})),cJ=gs(hJ.prototype,"checkEvents",[aJ,Ls],(function(){return[]})),oJ=hJ))||oJ)||oJ);t({ToggleContainer:UJ,ToggleContainerComponent:UJ}),g.ToggleContainer=UJ;var kJ,GJ,HJ=new pn;function zJ(t){return t instanceof PC?pc:t._uiProps.uiTransformComp?t._uiProps.uiTransformComp.contentSize:vn.ZERO}function VJ(t,e,i,n){t.parent?HJ.set(t.parent.getScale().x,t.parent.getScale().y):HJ.set(0,0);for(var r=HJ.x,s=HJ.y,a=0,o=0,h=t.parent;;){if(!h)return i.x=i.y=0,void(n.x=n.y=1);var u=h.getPosition();if(a+=u.x,o+=u.y,(h=h.parent)===e)break;h?HJ.set(h.getScale().x,h.getScale().y):HJ.set(0,0);var c=HJ.x,l=HJ.y;a*=c,o*=l,r*=c,s*=l}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"}(kJ||(kJ={})),me(kJ),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"}(GJ||(GJ={}));var WJ,XJ,jJ,YJ,KJ,qJ,QJ,ZJ,JJ,$J,t$,e$,i$=GJ.TOP|GJ.BOT,n$=GJ.LEFT|GJ.RIGHT,r$=(_J=bs("cc.Widget"),fJ=ws(110),dJ=Is(XF),pJ=sa(Lm),mJ=sa(kJ),_J(gJ=fJ(gJ=dJ(((FJ=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 Wi,e._lastSize=new vn,e._dirty=!0,e._hadAlignOnce=!1,e._alignFlags=yJ&&yJ(),e._target=EJ&&EJ(),e._left=TJ&&TJ(),e._right=SJ&&SJ(),e._top=AJ&&AJ(),e._bottom=RJ&&RJ(),e._horizontalCenter=CJ&&CJ(),e._verticalCenter=bJ&&bJ(),e._isAbsLeft=IJ&&IJ(),e._isAbsRight=wJ&&wJ(),e._isAbsTop=OJ&&OJ(),e._isAbsBottom=xJ&&xJ(),e._isAbsHorizontalCenter=NJ&&NJ(),e._isAbsVerticalCenter=DJ&&DJ(),e._originalWidth=MJ&&MJ(),e._originalHeight=PJ&&PJ(),e._alignMode=LJ&&LJ(),e._lockFlags=BJ&&BJ(),e}s(e,t);var i=e.prototype;return i.updateAlignment=function(){g._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),g._widgetManager.add(this),this._hadAlignOnce=!1,this._registerEvent(),this._registerTargetEvents()},i.onDisable=function(){g._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(Xp.TRANSFORM_CHANGED,this._setDirtyByMode,this),this.node.on(Xp.SIZE_CHANGED,this._setDirtyByMode,this),this.node.on(Xp.ANCHOR_CHANGED,this._adjustWidgetToAnchorChanged,this),this.node.on(Xp.PARENT_CHANGED,this._adjustTargetToParentChanged,this)},i._unregisterEvent=function(){this.node.off(Xp.TRANSFORM_CHANGED,this._setDirtyByMode,this),this.node.off(Xp.SIZE_CHANGED,this._setDirtyByMode,this),this.node.off(Xp.ANCHOR_CHANGED,this._adjustWidgetToAnchorChanged,this)},i._removeParentEvent=function(){this.node.off(Xp.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:pc;this.isAlignLeft&&t===GJ.LEFT?this._left=e?this._left*r.width:this._left/r.width:this.isAlignRight&&t===GJ.RIGHT?this._right=e?this._right*r.width:this._right/r.width:this.isAlignHorizontalCenter&&t===GJ.CENTER?this._horizontalCenter=e?this._horizontalCenter*r.width:this._horizontalCenter/r.width:this.isAlignTop&&t===GJ.TOP?this._top=e?this._top*r.height:this._top/r.height:this.isAlignBottom&&t===GJ.BOT?this._bottom=e?this._bottom*r.height:this._bottom/r.height:this.isAbsoluteVerticalCenter&&t===GJ.MID&&(this._verticalCenter=this._verticalCenter/r.height),this._recursiveDirty()}},i._registerTargetEvents=function(){var t=this._target||this.node.parent;t&&t.getComponent(XF)&&(t.on(Xp.TRANSFORM_CHANGED,this._setDirtyByMode,this),t.on(Xp.SIZE_CHANGED,this._setDirtyByMode,this),t.on(Xp.ANCHOR_CHANGED,this._setDirtyByMode,this))},i._unregisterTargetEvents=function(){var t=this._target||this.node.parent;t&&(t.off(Xp.TRANSFORM_CHANGED,this._setDirtyByMode,this),t.off(Xp.SIZE_CHANGED,this._setDirtyByMode,this),t.off(Xp.ANCHOR_CHANGED,this._setDirtyByMode,this))},i._unregisterOldParentEvents=function(t){var e=this._target||t;e&&(e.off(Xp.TRANSFORM_CHANGED,this._setDirtyByMode,this),e.off(Xp.SIZE_CHANGED,this._setDirtyByMode,this))},i._setDirtyByMode=function(){this.alignMode===kJ.ALWAYS&&this._recursiveDirty()},i._setAlign=function(t,e){if(e!==(this._alignFlags&t)>0){var i=(t&n$)>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)},n(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&GJ.TOP)>0},set:function(t){this._setAlign(GJ.TOP,t),this._recursiveDirty()}},{key:"isAlignBottom",get:function(){return(this._alignFlags&GJ.BOT)>0},set:function(t){this._setAlign(GJ.BOT,t),this._recursiveDirty()}},{key:"isAlignLeft",get:function(){return(this._alignFlags&GJ.LEFT)>0},set:function(t){this._setAlign(GJ.LEFT,t),this._recursiveDirty()}},{key:"isAlignRight",get:function(){return(this._alignFlags&GJ.RIGHT)>0},set:function(t){this._setAlign(GJ.RIGHT,t),this._recursiveDirty()}},{key:"isAlignVerticalCenter",get:function(){return(this._alignFlags&GJ.MID)>0},set:function(t){t?(this.isAlignTop=!1,this.isAlignBottom=!1,this._alignFlags|=GJ.MID):this._alignFlags&=~GJ.MID,this._recursiveDirty()}},{key:"isAlignHorizontalCenter",get:function(){return(this._alignFlags&GJ.CENTER)>0},set:function(t){t?(this.isAlignLeft=!1,this.isAlignRight=!1,this._alignFlags|=GJ.CENTER):this._alignFlags&=~GJ.CENTER,this._recursiveDirty()}},{key:"isStretchWidth",get:function(){return(this._alignFlags&n$)===n$}},{key:"isStretchHeight",get:function(){return(this._alignFlags&i$)===i$}},{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(GJ.TOP,this._isAbsTop))}},{key:"isAbsoluteBottom",get:function(){return this._isAbsBottom},set:function(t){this._isAbsBottom!==t&&(this._isAbsBottom=t,this._autoChangedValue(GJ.BOT,this._isAbsBottom))}},{key:"isAbsoluteLeft",get:function(){return this._isAbsLeft},set:function(t){this._isAbsLeft!==t&&(this._isAbsLeft=t,this._autoChangedValue(GJ.LEFT,this._isAbsLeft))}},{key:"isAbsoluteRight",get:function(){return this._isAbsRight},set:function(t){this._isAbsRight!==t&&(this._isAbsRight=t,this._autoChangedValue(GJ.RIGHT,this._isAbsRight))}},{key:"isAbsoluteHorizontalCenter",get:function(){return this._isAbsHorizontalCenter},set:function(t){this._isAbsHorizontalCenter!==t&&(this._isAbsHorizontalCenter=t,this._autoChangedValue(GJ.CENTER,this._isAbsHorizontalCenter))}},{key:"isAbsoluteVerticalCenter",get:function(){return this._isAbsVerticalCenter},set:function(t){this._isAbsVerticalCenter!==t&&(this._isAbsVerticalCenter=t,this._autoChangedValue(GJ.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}(Wd)).AlignMode=kJ,d((vJ=FJ).prototype,"target",[pJ],Object.getOwnPropertyDescriptor(vJ.prototype,"target"),vJ.prototype),d(vJ.prototype,"alignMode",[mJ],Object.getOwnPropertyDescriptor(vJ.prototype,"alignMode"),vJ.prototype),yJ=gs(vJ.prototype,"_alignFlags",[Ls],(function(){return 0})),EJ=gs(vJ.prototype,"_target",[Ls],(function(){return null})),TJ=gs(vJ.prototype,"_left",[Ls],(function(){return 0})),SJ=gs(vJ.prototype,"_right",[Ls],(function(){return 0})),AJ=gs(vJ.prototype,"_top",[Ls],(function(){return 0})),RJ=gs(vJ.prototype,"_bottom",[Ls],(function(){return 0})),CJ=gs(vJ.prototype,"_horizontalCenter",[Ls],(function(){return 0})),bJ=gs(vJ.prototype,"_verticalCenter",[Ls],(function(){return 0})),IJ=gs(vJ.prototype,"_isAbsLeft",[Ls],(function(){return!0})),wJ=gs(vJ.prototype,"_isAbsRight",[Ls],(function(){return!0})),OJ=gs(vJ.prototype,"_isAbsTop",[Ls],(function(){return!0})),xJ=gs(vJ.prototype,"_isAbsBottom",[Ls],(function(){return!0})),NJ=gs(vJ.prototype,"_isAbsHorizontalCenter",[Ls],(function(){return!0})),DJ=gs(vJ.prototype,"_isAbsVerticalCenter",[Ls],(function(){return!0})),MJ=gs(vJ.prototype,"_originalWidth",[Ls],(function(){return 0})),PJ=gs(vJ.prototype,"_originalHeight",[Ls],(function(){return 0})),LJ=gs(vJ.prototype,"_alignMode",[Ls],(function(){return kJ.ON_WINDOW_RESIZE})),BJ=gs(vJ.prototype,"_lockFlags",[Ls,Fs],(function(){return 0})),gJ=vJ))||gJ)||gJ)||gJ);t({Widget:r$,WidgetComponent:r$}),g.internal.computeInverseTransForTarget=VJ,g.internal.getReadonlyNodeSize=zJ,g.Widget=r$;var s$,a$=new qi;!function(t){t[t.HORIZONTAL=0]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(s$||(s$={})),me(s$);var o$,h$,u$,c$,l$,_$,f$,d$,p$,m$,g$,v$,y$,E$,T$,S$,A$,R$,C$,b$,I$,w$,O$,x$,N$=(WJ=bs("cc.PageViewIndicator"),XJ=ws(110),jJ=sa(nB),YJ=sa(s$),KJ=sa(vn),WJ(qJ=XJ(((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).spacing=ZJ&&ZJ(),e._spriteFrame=JJ&&JJ(),e._direction=$J&&$J(),e._cellSize=t$&&t$(),e._layout=null,e._pageView=null,e._indicators=[],e}s(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(IQ),this._layout||(this._layout=this.addComponent(IQ));var t=this._layout;this.direction===s$.HORIZONTAL?(t.type=IQ.Type.HORIZONTAL,t.spacingX=this.spacing):this.direction===s$.VERTICAL&&(t.type=IQ.Type.VERTICAL,t.spacingY=this.spacing),t.resizeMode=IQ.ResizeMode.CONTAINER},i._createIndicator=function(){var t=new Lm;t.layer=this.node.layer;var e=t.addComponent(WG);return e.spriteFrame=this.spriteFrame,e.sizeMode=WG.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;a$.set(r.color),a$.a=127.5,r.color=a$}}if(t[e]._uiProps.uiComp){var s=t[e]._uiProps.uiComp;a$.set(s.color),a$.a=255,s.color=a$}}}},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()}}},n(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}(Wd)).Direction=s$,d((QJ=e$).prototype,"spriteFrame",[jJ],Object.getOwnPropertyDescriptor(QJ.prototype,"spriteFrame"),QJ.prototype),d(QJ.prototype,"direction",[YJ],Object.getOwnPropertyDescriptor(QJ.prototype,"direction"),QJ.prototype),d(QJ.prototype,"cellSize",[KJ],Object.getOwnPropertyDescriptor(QJ.prototype,"cellSize"),QJ.prototype),ZJ=gs(QJ.prototype,"spacing",[Ls],(function(){return 0})),JJ=gs(QJ.prototype,"_spriteFrame",[Ls],(function(){return null})),$J=gs(QJ.prototype,"_direction",[Ls],(function(){return s$.HORIZONTAL})),t$=gs(QJ.prototype,"_cellSize",[Ls],(function(){return new vn(20,20)})),qJ=QJ))||qJ)||qJ);t({PageViewIndicator:N$,PageViewIndicatorComponent:N$}),g.PageViewIndicator=N$;var D$,M$,P$,L$=new pn;!function(t){t[t.Unified=0]="Unified",t[t.Free=1]="Free"}(D$||(D$={})),me(D$),function(t){t[t.Horizontal=0]="Horizontal",t[t.Vertical=1]="Vertical"}(M$||(M$={})),me(M$),function(t){t.PAGE_TURNING="page-turning"}(P$||(P$={}));var B$=(o$=bs("cc.PageView"),h$=ws(110),u$=sa(D$),c$=sa(M$),l$=sa(N$),_$=sa(QQ),f$=sa(QQ),d$=sa([Hd]),p$=sa([Hd]),o$(m$=h$(((x$=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).autoPageTurningThreshold=v$&&v$(),e.horizontal=y$&&y$(),e.vertical=E$&&E$(),e.cancelInnerEvents=T$&&T$(),e.scrollEvents=S$&&S$(),e.pageTurningSpeed=A$&&A$(),e.pageEvents=R$&&R$(),e._sizeMode=C$&&C$(),e._direction=b$&&b$(),e._scrollThreshold=I$&&I$(),e._pageTurningEventTiming=w$&&w$(),e._indicator=O$&&O$(),e._curPageIdx=0,e._lastPageIdx=0,e._pages=[],e._initContentPos=new Wi,e._scrollCenterOffsetX=[],e._scrollCenterOffsetY=[],e._touchBeganPosition=new pn,e._touchEndPosition=new pn,e}s(e,t);var i=e.prototype;return i.onEnable=function(){t.prototype.onEnable.call(this),this.node.on(Xp.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(Xp.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(IQ);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===M$.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===D$.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(L$),pn.set(this._touchBeganPosition,L$.x,L$.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(L$),pn.set(this._touchEndPosition,L$.x,L$.y),t.prototype._onTouchEnded.call(this,e,i)},i._onTouchCancelled=function(e,i){e.touch.getUILocation(L$),pn.set(this._touchEndPosition,L$.x,L$.y),t.prototype._onTouchCancelled.call(this,e,i)},i._onMouseWheel=function(){},i._syncScrollDirection=function(){this.horizontal=this.direction===M$.Horizontal,this.vertical=this.direction===M$.Vertical},i._syncSizeMode=function(){var t=this.view;if(this.content&&t){var e=this.content.getComponent(IQ);if(e){if(this._sizeMode===D$.Free&&this._pages.length>0){var i=this._pages[0]._uiProps.uiTransformComp,n=this._pages[this._pages.length-1]._uiProps.uiTransformComp;this.direction===M$.Horizontal?(e.paddingLeft=(t.width-i.width)/2,e.paddingRight=(t.width-n.width)/2):this.direction===M$.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,Hd.emitEvents(this.pageEvents,this,P$.PAGE_TURNING),this.node.emit(P$.PAGE_TURNING,this))},i._isQuicklyScrollable=function(t){if(this.direction===M$.Horizontal){if(Math.abs(t.x)>this.autoPageTurningThreshold)return!0}else if(this.direction===M$.Vertical&&Math.abs(t.y)>this.autoPageTurningThreshold)return!0;return!1},i._moveOffsetValue=function(t){var e=new pn;if(this._sizeMode===D$.Free)this.direction===M$.Horizontal?e.x=this._scrollCenterOffsetX[t]:this.direction===M$.Vertical&&(e.y=this._scrollCenterOffsetY[t]);else{var i=this.view;if(!i)return e;this.direction===M$.Horizontal?e.x=t*i.width:this.direction===M$.Vertical&&(e.y=t*i.height)}return e},i._getDragDirection=function(t){return this._direction===M$.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===D$.Free){var n=0,r=0;if(this.direction===M$.Horizontal)return n=this._scrollCenterOffsetX[e],r=this._scrollCenterOffsetX[i],Math.abs(t.x)>=Math.abs(n-r)*this.scrollThreshold;if(this.direction===M$.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===M$.Horizontal)return Math.abs(t.x)>=s.width*this.scrollThreshold;if(this.direction===M$.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 pn;pn.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)}},n(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}(HZ)).SizeMode=D$,x$.Direction=M$,x$.EventType=nJ(P$,yZ),d((g$=x$).prototype,"sizeMode",[u$],Object.getOwnPropertyDescriptor(g$.prototype,"sizeMode"),g$.prototype),d(g$.prototype,"direction",[c$],Object.getOwnPropertyDescriptor(g$.prototype,"direction"),g$.prototype),d(g$.prototype,"indicator",[l$],Object.getOwnPropertyDescriptor(g$.prototype,"indicator"),g$.prototype),v$=gs(g$.prototype,"autoPageTurningThreshold",[Ls],(function(){return 100})),d(g$.prototype,"verticalScrollBar",[_$,aa],Object.getOwnPropertyDescriptor(g$.prototype,"verticalScrollBar"),g$.prototype),d(g$.prototype,"horizontalScrollBar",[f$,aa],Object.getOwnPropertyDescriptor(g$.prototype,"horizontalScrollBar"),g$.prototype),y$=gs(g$.prototype,"horizontal",[aa,Ls],(function(){return!0})),E$=gs(g$.prototype,"vertical",[aa,Ls],(function(){return!0})),T$=gs(g$.prototype,"cancelInnerEvents",[aa,Ls],(function(){return!0})),S$=gs(g$.prototype,"scrollEvents",[d$,Ls,aa],(function(){return[]})),A$=gs(g$.prototype,"pageTurningSpeed",[Ls],(function(){return.3})),R$=gs(g$.prototype,"pageEvents",[p$,Ls],(function(){return[]})),C$=gs(g$.prototype,"_sizeMode",[Ls],(function(){return D$.Unified})),b$=gs(g$.prototype,"_direction",[Ls],(function(){return M$.Horizontal})),I$=gs(g$.prototype,"_scrollThreshold",[Ls],(function(){return.5})),w$=gs(g$.prototype,"_pageTurningEventTiming",[Ls],(function(){return.1})),O$=gs(g$.prototype,"_indicator",[Ls],(function(){return null})),m$=g$))||m$)||m$);t({PageView:B$,PageViewComponent:B$}),g.PageView=B$;var F$=new Wi,U$=new pn,k$=new pn,G$=new pn(1,1),H$=new pn,z$=new pn;function V$(t,e){if(!e._hadAlignOnce){e.alignMode===kJ.ONCE&&(e._hadAlignOnce=!0);var i,n=e.target,r=k$,s=G$;n?VJ(t,i=n,r,s):i=t.parent;var a=zJ(i),o=i instanceof PC||!i.getComponent(XF),h=o?U$:i.getComponent(XF).anchorPoint,u=o;t.getPosition(F$);var c=t._uiProps.uiTransformComp,l=F$.x,_=F$.y,f=c.anchorPoint,d=t.getScale();if(e.alignFlags&GJ.HORIZONTAL){var p=0,m=0,g=a.width;u?(p=pc.left.x,m=pc.right.x):m=(p=-h.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&&(c.width=v/E),l=p+y*v;else{if(v=c.width*E,e.isAlignHorizontalCenter){var T=e.isAbsoluteHorizontalCenter?e.horizontalCenter:e.horizontalCenter*g,S=(.5-h.x)*a.width;n&&(T*=s.x,S+=r.x,S*=s.x),l=S+(y-.5)*v+T}else l=e.isAlignLeft?p+y*v:m+(y-1)*v;Ei(E,0,vi)?v=c.width:v/=E}e._lastSize.width=v}if(e.alignFlags&GJ.VERTICAL){var A=0,R=0,C=a.height;u?(R=pc.bottom.y,A=pc.top.y):A=(R=-h.y*C)+C,R+=e.isAbsoluteBottom?e.bottom:e.bottom*C,A-=e.isAbsoluteTop?e.top:e.top*C,n&&(R+=r.y,R*=s.y,A+=r.y,A*=s.y);var b=0,I=f.y,w=d.y;if(w<0&&(I=1-I,w=-w),e.isStretchHeight)b=A-R,0!==w&&(c.height=b/w),_=R+I*b;else{if(b=c.height*w,e.isAlignVerticalCenter){var O=e.isAbsoluteVerticalCenter?e.verticalCenter:e.verticalCenter*C,x=(.5-h.y)*a.height;n&&(O*=s.y,x+=r.y,x*=s.y),_=x+(I-.5)*b+O}else _=e.isAlignBottom?R+I*b:A+(I-1)*b;Ei(w,0,vi)?b=c.height:b/=w}e._lastSize.height=b}t.setPosition(l,_,F$.z),Wi.set(e._lastPos,l,_,F$.z)}}function W$(t){var e=t.getComponent(r$);if(e&&e.enabled){if(!g.isValid(t,!0))return;Y$.push(e)}for(var i,n=f(t.children);!(i=n()).done;){var r=i.value;r.active&&W$(r)}}function X$(){var t=fL.getScene();if(t){K$.isAligning=!0,K$._nodesOrderDirty&&(Y$.length=0,W$(t),K$._nodesOrderDirty=!1);var e=null,i=K$._activeWidgetsIterator;for(i.i=0;i.i<Y$.length;++i.i)(e=Y$[i.i])._dirty&&(V$(e.node,e),e._dirty=!1);K$.isAligning=!1}}var j$,Y$=[],K$=t("widgetManager",g._widgetManager={isAligning:!1,_nodesOrderDirty:!1,_activeWidgetsIterator:new ne(Y$),animationState:null,init:function(){fL.on(_L.EVENT_AFTER_SCENE_LAUNCH,X$),fL.on(_L.EVENT_AFTER_UPDATE,X$),rz.instance.on("design-resolution-changed",this.onResized,this);var t=this.onResized.bind(this);rz.instance.on("canvas-resize",t),lc.on("window-resize",t)},add:function(){this._nodesOrderDirty=!0},remove:function(t){this._activeWidgetsIterator.remove(t)},onResized:function(){var t=fL.getScene();t&&this.refreshWidgetOnResized(t)},refreshWidgetOnResized:function(t){var e=Lm.isNode(t)&&t.getComponent(r$);e&&e.enabled&&(e.alignMode===kJ.ON_WINDOW_RESIZE||e.alignMode===kJ.ALWAYS)&&e.setDirty();for(var i,n=f(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=H$;s.set(0,0);var a=z$;if(a.set(1,1),t.target&&VJ(n,r=t.target,s,a),!e)return;var o=r._uiProps&&r._uiProps.uiTransformComp,h=o?o.anchorPoint:U$,u=n._uiProps.uiTransformComp,c=zJ(r),l=u.anchorPoint,_=n.getPosition(),f=GJ,d=n.getScale(),p=0;if(e&f.LEFT){var m=-h.x*c.width;m+=s.x,m*=a.x,p=_.x-l.x*u.width*Math.abs(d.x)-m,t.isAbsoluteLeft||(p/=c.width),p/=a.x,t.left=i(t.left,p)}if(e&f.RIGHT){var g=(1-h.x)*c.width;g+=s.x,p=(g*=a.x)-(_.x+(1-l.x)*u.width*Math.abs(d.x)),t.isAbsoluteRight||(p/=c.width),p/=a.x,t.right=i(t.right,p)}if(e&f.TOP){var v=(1-h.y)*c.height;v+=s.y,p=(v*=a.y)-(_.y+(1-l.y)*u.height*Math.abs(d.y)),t.isAbsoluteTop||(p/=c.height),p/=a.y,t.top=i(t.top,p)}if(e&f.BOT){var y=-h.y*c.height;y+=s.y,y*=a.y,p=_.y-l.y*u.height*Math.abs(d.y)-y,t.isAbsoluteBottom||(p/=c.height),p/=a.y,t.bottom=i(t.bottom,p)}}},updateAlignment:function t(e){var i=e.parent;i&&Lm.isNode(i)&&t(i);var n=e.getComponent(r$);n&&i&&V$(e,n)},AlignMode:kJ,AlignFlags:GJ});fL.on(_L.EVENT_INIT,(function(){K$.init()}));var q$,Q$,Z$,J$,$$,t0,e0,i0,n0,r0,s0,a0,o0=bs("cc.SafeArea")(j$=ws(110)(j$=Is(r$)(j$=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.onEnable=function(){this.updateArea(),lc.on("window-resize",this.updateArea,this),lc.on("orientation-change",this.updateArea,this)},i.onDisable=function(){lc.off("window-resize",this.updateArea,this),lc.off("orientation-change",this.updateArea,this)},i.updateArea=function(){var t=this.node.getComponent(r$),e=this.node.getComponent(XF);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=uz.getVisibleSize(),s=r.width,a=r.height,o=dc.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 h=this.node.position.clone(),u=n.x-(h.x-i.x)/e.width,c=n.y-(h.y-i.y)/e.height;e.setAnchorPoint(u,c),K$.add(t)}},e}(Wd))||j$)||j$)||j$;t({SafeArea:o0,SafeAreaComponent:o0}),g.SafeArea=o0;var h0,u0=(q$=bs("cc.UICoordinateTracker"),Q$=ws(110),Z$=sa(Lm),J$=sa(ez),$$=sa([Hd]),q$(t0=Q$((d((e0=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).syncEvents=i0&&i0(),e._target=n0&&n0(),e._camera=r0&&r0(),e._useScale=s0&&s0(),e._distance=a0&&a0(),e._transformPos=new Wi,e._viewPos=new Wi,e._canMove=!0,e._lastWPos=new Wi,e._lastCameraPos=new Wi,e}s(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&&Wi.transformMat4(this._viewPos,this.node.worldPosition,e.camera.matView),this.syncEvents.length>0)){var i=this._distance/Math.abs(this._viewPos.z);Hd.emitEvents(this.syncEvents,this._transformPos,i)}},i._checkCanMove=function(){this._canMove=!(!this._camera||!this._target)},n(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}(Wd)).prototype,"target",[Z$],Object.getOwnPropertyDescriptor(e0.prototype,"target"),e0.prototype),d(e0.prototype,"camera",[J$],Object.getOwnPropertyDescriptor(e0.prototype,"camera"),e0.prototype),i0=gs(e0.prototype,"syncEvents",[$$,Ls],(function(){return[]})),n0=gs(e0.prototype,"_target",[Ls],(function(){return null})),r0=gs(e0.prototype,"_camera",[Ls],(function(){return null})),s0=gs(e0.prototype,"_useScale",[Ls],(function(){return!0})),a0=gs(e0.prototype,"_distance",[Ls],(function(){return 1})),t0=e0))||t0)||t0);t({UICoordinateTracker:u0,UICoordinateTrackerComponent:u0});var c0=[Xp.TOUCH_START,Xp.TOUCH_END,Xp.TOUCH_MOVE,Xp.MOUSE_DOWN,Xp.MOUSE_MOVE,Xp.MOUSE_UP,Xp.MOUSE_ENTER,Xp.MOUSE_LEAVE,Xp.MOUSE_WHEEL];function l0(t){t.propagationStopped=!0}var _0,f0,d0,p0,m0=bs("cc.BlockInputEvents")(h0=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.onEnable=function(){for(var t=0;t<c0.length;t++)this.node.on(c0[t],l0,this)},i.onDisable=function(){for(var t=0;t<c0.length;t++)this.node.off(c0[t],l0,this)},e}(Wd))||h0;t({BlockInputEvents:m0,BlockInputEventsComponent:m0});var g0,v0=t("SubContextView",bs("cc.SubContextView")(_0=ws(110)(_0=Is(XF)((f0=function(t){function e(){var e;return(e=t.call(this)||this)._fps=d0&&d0(),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._designResolutionSize=p0&&p0(),e._content=new Lm("content"),e._content.hideFlags|=Ta.Flags.DontSave|Ta.Flags.HideInHierarchy,e._sprite=null,e._imageAsset=new dd,e._openDataContext=null,e._updatedTime=performance.now(),e._texture=new Fp,e}s(e,t);var i=e.prototype;return i.onLoad=function(){Au.getOpenDataContext?(this._updateInterval=1e3/this._fps,this._openDataContext=Au.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(WG),this._sprite||(this._sprite=this._content.addComponent(WG)),this._sprite.spriteFrame)this._sprite.spriteFrame.texture=this._texture;else{var i=new nB;i.texture=this._texture,this._sprite.spriteFrame=i}this._content.parent=this.node}},i._updateSubContextView=function(){if(this._openDataContext){var t=this.node.getComponent(XF),e=this._content.getComponent(XF),i=t.width/e.width,n=t.height/e.height,r=i>n?n:i;e.width*=r,e.height*=r;var s=uz.getViewportRect(),a=e.getBoundingBoxToWorld(),o=uz.getVisibleSize(),h=lc.devicePixelRatio,u=(s.width*(a.x/o.width)+s.x)/h,c=(s.height*(a.y/o.height)+s.y)/h,l=s.width*(a.width/o.width)/h,_=s.height*(a.height/o.height)/h;this._openDataContext.postMessage({fromEngine:!0,type:"engine",event:"viewport",x:u,y:c,width:l,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(Xp.TRANSFORM_CHANGED,this._updateSubContextView,this),this.node.on(Xp.SIZE_CHANGED,this._updateSubContextView,this),this.node.on(Xp.LAYER_CHANGED,this._updateContentLayer,this)},i._unregisterNodeEvent=function(){this.node.off(Xp.TRANSFORM_CHANGED,this._updateSubContextView,this),this.node.off(Xp.SIZE_CHANGED,this._updateSubContextView,this),this.node.off(Xp.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},n(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}(Wd),d0=gs(f0.prototype,"_fps",[Ls],(function(){return 60})),p0=gs(f0.prototype,"_designResolutionSize",[Ls],(function(){return new vn(640,960)})),_0=f0))||_0)||_0)||_0);g.SubContextView=v0,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 y0=t("UIReorderComponent",bs("cc.UIReorderComponent")(g0=function(){j(1408,"UIReorderComponent")})||g0);g.UIReorderComponent=y0,g.ButtonComponent=VK,qt(VK,"cc.ButtonComponent"),g.EditBoxComponent=lQ,qt(lQ,"cc.EditBoxComponent"),g.LayoutComponent=IQ,qt(IQ,"cc.LayoutComponent"),g.ProgressBarComponent=HQ,qt(HQ,"cc.ProgressBarComponent"),g.ScrollViewComponent=HZ,qt(HZ,"cc.ScrollViewComponent"),g.ScrollBarComponent=QQ,qt(QQ,"cc.ScrollBarComponent"),g.SliderComponent=iJ,qt(iJ,"cc.SliderComponent"),g.ToggleComponent=lJ,qt(lJ,"cc.ToggleComponent"),g.ToggleContainerComponent=UJ,qt(UJ,"cc.ToggleContainerComponent"),g.WidgetComponent=r$,qt(r$,"cc.WidgetComponent"),g.PageViewComponent=B$,qt(B$,"cc.PageViewComponent"),g.PageViewIndicatorComponent=N$,qt(N$,"cc.PageViewIndicatorComponent"),g.SafeAreaComponent=o0,qt(o0,"cc.SafeAreaComponent"),qt(u0,"cc.UICoordinateTrackerComponent"),g.BlockInputEventsComponent=m0,qt(m0,"cc.BlockInputEventsComponent"),nt(rz.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"}]),rt(rz.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"}])}}}));
|