cc.js 2.0 MB

12
  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,a(t,e)}function o(t){return(o=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function a(t,e){return(a=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&&a(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,o(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),a(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 d(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 f(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:ge,CCClass:Ti,Enum:ye,Eventify:so,WorldNode3DToLocalNodeUI:Oo,WorldNode3DToWorldNodeUI:Po,__checkObsoleteInNamespace__:function(t){return dt||(dt="undefined"==typeof Proxy?{}:new Proxy(t,{get:function(t,e,i){return mt(e),Reflect.get(t,e,i)}})),dt},__checkObsolete__:function(t){for(var e,i=d(t);!(e=i()).done;)mt(e.value)},_resetDebugSetting:H,absMax:qi,absMaxComponent:Ki,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:Oi,assert:U,assertID:tt,assertIsNonNullable:function(){},assertIsTrue:function(){},assertsArrayIndex:me,bezier:Uu,bezierByTime:ic,binarySearch:function(t,e){return na(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 o=t[s];if(i(o,e)<0)r=s-1;else{if(!(i(o,e)>0))return s;n=s+1}}return~n},binarySearchEpsilon:na,ccenum:Se,clamp:Pi,clamp01:Mi,color:Tn,computeRatioByType:wZ,debug:G,debugID:Y,deprecateModuleExportedName:gt,deserialize:rg,enumerableProps:Qi,equals:Di,error:k,errorID:Z,find:Ex,flattenCodeArray:ul,floatToHalf:nn,formerlySerializedAs:Ia,fragmentText:KP,getBaselineOffset:function(){return 0},getEnglishWordPartAtFirst:jP,getEnglishWordPartAtLast:YP,getError:et,getPathFromRoot:function(t,e){for(var i=t,n="";null!==i&&i!==e;)n=i.name+"/"+n,i=i.parent;return n.slice(0,-1)},getSerializationMetadata:function(t){return t[Ra]},getSymbolAt:HP,getSymbolCodeAt:zP,getSymbolLength:GP,getWorldTransformUntilRoot:Pj,halfToFloat:rn,instantiate:F0,inverseLerp:Yi,isCCClassOrFastDefined:Ei,isCCObject:Qs,isDisplayStats:it,isEnglishWordPartAtFirst:function(t){return BP.test(t)},isEnglishWordPartAtLast:function(t){return LP.test(t)},isUnicodeCJK:FP,isUnicodeSpace:kP,isValid:Zs,lerp:Ni,log:B,logID:X,mat4:Un,murmurhash2_32_gc:nl,nextPow2:Wi,pingPong:ji,pseudoRandom:Hi,pseudoRandomRange:zi,pseudoRandomRangeInt:Vi,quat:Mn,random:Fi,randomRange:Ui,randomRangeInt:Gi,rect:Kn,repeat:Xi,safeMeasureText:UP,sampleAnimationCurve:RZ,setDefaultLogTimes:function(t){t>0&&(ct=t)},setDisplayStats:nt,setPropertyEnumType:li,setPropertyEnumTypeOnAttrs:_i,setRandGenerator:ki,shift:function(t,e,i){if(me(t,e),me(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:jn,toDegree:Bi,toRadian:Li,tween:cut,tweenUtil:lut,v2:zn,v3:dn,v4:an,warn:F,warnID:q}),p("CC_WECHAT",!0),p("CC_BAIDU",!1),p("CC_XIAOMI",!1),p("CC_ALIPAY",!1),p("CC_BYTEDANCE",!1),p("CC_OPPO",!1),p("CC_VIVO",!1),p("CC_HUAWEI",!1),p("CC_COCOSPLAY",!1),p("CC_QTT",!1),p("CC_LINKSURE",!1);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 g="undefined"==typeof window?global:window,m=t("cclegacy",{_global:g});m.internal={};var v=t("VERSION","3.8.4");g.CocosEngine=m.ENGINE_VERSION=v,g.cc=m;var y=void 0!==globalThis.jsb&&void 0!==jsb.window?jsb.window:globalThis;function T(t,e){return t^(t^e)&-(t<e)}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 S(t){return 16843009*((t=(858993459&(t-=t>>>1&1431655765))+(t>>>2&858993459))+(t>>>4)&252645135)>>>24}function A(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 b(t){return--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,1+(t|=t>>>16)}g.ccwindow=y;var C=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}}(C);var R=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:T,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:S,countTrailingZeros:A,nextPow2:b,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 C[255&t]<<24|C[t>>>8&255]<<16|C[t>>>16&255]<<8|C[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>>>A(t)+1}});t("bits",R);var w=y.document,I="https://github.com/cocos/cocos-engine/blob/"+v+"/EngineErrorMap.md",x=null,D=console.log.bind(console),O=D,P=D,M=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: "+L.apply(void 0,[e].concat(n)))}},N=D;function L(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return m.js.formatStr.apply(null,e)}function B(){return D.apply(void 0,arguments)}function F(){return O.apply(void 0,arguments)}function k(){return P.apply(void 0,arguments)}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 M.apply(void 0,[t,e].concat(n))}function G(){return N.apply(void 0,arguments)}function H(t){if(D=O=P=M=N=function(){},t!==J.NONE){if(t>J.ERROR){var e=function(t){if(m.game.canvas){if(!x){var e=w.createElement("Div");e.setAttribute("id","logInfoDiv"),e.setAttribute("width","200");var i=m.game.canvas.height;e.setAttribute("height",""+i);var n=e.style;n.zIndex="99999",n.position="absolute",n.top=n.left="0",(x=w.createElement("textarea")).setAttribute("rows","20"),x.setAttribute("cols","30"),x.setAttribute("disabled","true");var r=x.style;r.backgroundColor="transparent",r.borderBottom="1px solid #cccccc",r.borderTopWidth=r.borderLeftWidth=r.borderRightWidth="0px",r.borderTopStyle=r.borderLeftStyle=r.borderRightStyle="none",r.padding="0px",r.margin="0px",e.appendChild(x),m.game.canvas.parentNode.appendChild(e)}x.value=x.value+t+"\r\n",x.scrollTop=x.scrollHeight}};P=function(){e("ERROR : "+L.apply(void 0,arguments))},M=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: "+L.apply(void 0,[i].concat(r)))}},t!==J.ERROR_FOR_WEB_PAGE&&(O=function(){e("WARN : "+L.apply(void 0,arguments))}),t===J.INFO_FOR_WEB_PAGE&&(D=function(){e(L.apply(void 0,arguments))})}else console&&(console.error||(console.error=console.log),console.warn||(console.warn=console.log),P=console.error.bind?console.error.bind(console):function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return console.error.apply(console,e)},M=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=L.apply(void 0,[e].concat(n));throw new Error(s)}});if(t!==J.ERROR&&(O=console.warn.bind?console.warn.bind(console):function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return console.warn.apply(console,e)}),t<=J.INFO&&(D=console.log.bind?console.log.bind(console):function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return console.log.apply(console,e)}),t<=J.VERBOSE&&"function"==typeof console.debug){var i=console.debug.bind(console);N=function(){return i.apply(void 0,arguments)}}}}function z(t){k(t.stack||t)}function V(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 W=V("Log");function X(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(W.apply(void 0,[t].concat(i)))}var j=V("Debug");function Y(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];G(j.apply(void 0,[t].concat(i)))}var K=V("Warning");function q(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(K.apply(void 0,[t].concat(i)))}var Q=V("Error");function Z(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];k(Q.apply(void 0,[t].concat(i)))}var J,$=V("Assert");function tt(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,$.apply(void 0,[e].concat(n)))}}function et(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 Q.apply(void 0,[t].concat(i))}function it(){return!!m.profiler&&m.profiler.isShowingStats()}function nt(t){m.profiler&&(t?m.profiler.showStats():m.profiler.hideStats())}t("DebugMode",J),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"}(J||t("DebugMode",J={}));var rt,st,ot,at,ht,ut=Object.freeze({__proto__:null,log:B,warn:F,error:k,assert:U,debug:G,_resetDebugSetting:H,_throw:z,logID:X,debugID:Y,warnID:q,errorID:Z,assertID:tt,get DebugMode(){return J},getError:et,isDisplayStats:it,setDisplayStats:nt}),ct=10;t("replaceProperty",rt),t("removeProperty",st),t("markAsWarning",ot);var lt=0,_t=new Map;at=function(t,e,i,n,r,s,o){var a=_t.get(s);a&&a.logTimes>a.count&&(r("'%s' is deprecated, please use '%s' instead. "+o,t+"."+e,i+"."+n),a.count++)},t("replaceProperty",rt=function(t,e,i){null!=t&&i.forEach((function(i){var n=lt++;_t.set(n,{id:n,count:0,logTimes:void 0!==i.logTimes?i.logTimes:ct});var r=null!=i.target?i.target:t,s=null!=i.newName?i.newName:i.name,o=null!=i.targetName?i.targetName:e,a=r===t,h=i.suggest?"("+i.suggest+")":"";if(null!=i.customFunction)t[i.name]=function(){var t;return at(e,i.name,o,s,F,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 at(e,i.name,o,s,F,n,h),i.customGetter.call(this)},set:function(t){at(e,i.name,o,s,F,n,h),i.customSetter.call(this,t)},enumerable:!1}):u?Object.defineProperty(t,i.name,{set:function(t){at(e,i.name,o,s,F,n,h),i.customSetter.call(this,t)},enumerable:!1}):c&&Object.defineProperty(t,i.name,{get:function(){return at(e,i.name,o,s,F,n,h),i.customGetter.call(this)},enumerable:!1})}else Object.defineProperty(t,i.name,{get:function(){return at(e,i.name,o,s,F,n,h),a?this[s]:r[s]},set:function(t){at(e,i.name,o,s,F,n,h),a?this[s]=t:r[s]=t},enumerable:!1})}))}),ht=function(t,e,i,n,r){var s=_t.get(n);s&&s.logTimes>s.count&&(i("'%s' has been removed. "+r,t+"."+e),s.count++)},t("removeProperty",st=function(t,e,i){null!=t&&i.forEach((function(i){var n=lt++;_t.set(n,{id:n,count:0,logTimes:void 0!==i.logTimes?i.logTimes:ct});var r=i.suggest?"("+i.suggest+")":"";Object.defineProperty(t,i.name,{get:function(){return ht(e,i.name,k,n,r)},set:function(){ht(e,i.name,k,n,r)},enumerable:!1})}))}),t("markAsWarning",ot=function(){});var dt,ft,pt={};function gt(t){for(var e in t){var i=t[e];pt[e]=i}}function mt(t){var e=pt[t];if(e){var i=e.newName,n=e.since;e.removed?i?Z(16003,t,n,i):Z(16002,t,n):i?q(16001,t,n,i):q(16e3,t,n)}}var vt=function(){function t(t){this.id=0|998*Math.random(),this.prefix=t?t+".":""}return t.prototype.getNewId=function(){return this.prefix+(++this.id).toString()},t}();ft=vt,vt.global=new ft("global");var yt=new vt("TmpCId."),Tt="undefined"==typeof Symbol?"__aliases__":Symbol("[[Aliases]]"),Et="__cid__";function St(t){return"number"==typeof t||t instanceof Number}function At(t){return"string"==typeof t||t instanceof String}function bt(t){for(var e in t)return!1;return!0}var Ct,Rt=(Ct={value:void 0,enumerable:!1,writable:!1,configurable:!0},function(t,e,i,n,r){Ct.value=i,Ct.writable=n,Ct.enumerable=r,Object.defineProperty(t,e,Ct),Ct.value=void 0}),wt=function(){var t={get:void 0,set:void 0,enumerable:!1};return function(e,i,n,r,s,o){void 0===s&&(s=!1),void 0===o&&(o=!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=o,Object.defineProperty(e,i,t),t.get=void 0,t.set=void 0}}(),It=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}}(),xt=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 Dt(t){var e=Object.create(null);return t&&(e["."]=1,e["/"]=1,delete e["."],delete e["/"]),e}function Ot(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?Ot(t.constructor):""}function Pt(t,e,i,n){var r=/([^.]+)$/,s=r.exec(e)[0],o=r.exec(i)[0];function a(){return this[o]}n?wt(t,s,a,(function(t){this[o]=t})):It(t,s,a)}function Mt(t,e,i,n){for(var r in i)Pt(t,e+"."+r,i[r],n)}var Nt=/(%d)|(%s)/,Lt=/%s/;function Bt(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,o=d(i);!(s=o()).done;){var a=s.value,h="number"==typeof a?Nt:Lt;if(h.test(t)){var u=""+a;t=t.replace(h,u)}else t+=" "+a}else for(var c,l=d(i);!(c=l()).done;){var _=c.value;t+=" "+_}return t}function Ft(){for(var t=arguments.length-1,e=new Array(t),i=0;i<t;++i)e[i]=arguments[i+1];return e}function kt(t,e){for(;t;){var i=Object.getOwnPropertyDescriptor(t,e);if(i)return i;t=Object.getPrototypeOf(t)}return null}function Ut(t,e,i){var n=kt(e,t);n&&Object.defineProperty(i,t,n)}function Gt(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 o=s[r];if(o){if("object"!=typeof o){Z(5402,o);continue}for(var a in o)a in t||Ut(a,o,t)}}return t}function Ht(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 o=s[r];if(o){if("object"!=typeof o){Z(5403,o);continue}for(var a in o)Ut(a,o,t)}}return t}function zt(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 Vt(t){var e=t.prototype,i=e&&Object.getPrototypeOf(e);return i&&i.constructor}function Wt(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=Vt(t)))return!1;if(t===e)return!0}}return!1}function Xt(t){for(var e=0,i=Object.keys(t);e<i.length;e++)delete t[i[e]]}var jt=Dt(!0),Yt=Dt(!0);function Kt(t,e,i){return function(n,r){if(r.prototype.hasOwnProperty(t)&&delete e[r.prototype[t]],Rt(r.prototype,t,n),n){var s=e[n];!i&&s&&s!==r?Z(16334,t,n,""):e[n]=r}}}var qt=Kt("__cid__",jt,!1),Qt=Kt("__classname__",Yt,!0);function Zt(t,e){if(Qt(t,e),!e.prototype.hasOwnProperty(Et)){var i=t||yt.getNewId();i&&qt(i,e)}}function Jt(t,e){var i=Yt[e],n=jt[e],r=!0;if(i&&i!==t&&(Z(16335,e),r=!1),n&&n!==t&&(Z(16336,e),r=!1),r){var s=t[Tt];s||(s=[],t[Tt]=s),s.push(e),Yt[e]=t,jt[e]=t}}function $t(){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],o=s.prototype,a=o.__cid__;a&&delete jt[a];var h=o.__classname__;h&&delete Yt[h];var u=o[Tt];if(u)for(var c=0;c<u.length;++c){var l=u[c];delete Yt[l],delete jt[l]}}}function te(t){return ee(t)}function ee(t){return jt[t]}function ie(t){return Yt[t]}function ne(t,e){return re(t,e)}function re(t,e){if(e=void 0===e||e,"function"==typeof t&&t.prototype.hasOwnProperty(Et))return t.prototype.__cid__;if(t&&t.constructor){var i=t.constructor.prototype;if(i&&i.hasOwnProperty(Et))return t.__cid__}return""}var se=function(){var t=e.prototype;function e(t,e){this.count=0;var i=void 0===e?t:e,n=void 0===e?null:t;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}(),oe=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 ae(t,e){t.splice(e,1)}function he(t,e){var i=t.length;e<0||e>=i||(t[e]=t[i-1],t.length=i-1)}function ue(t,e){var i=t.indexOf(e);return i>=0&&(ae(t,i),!0)}function ce(t,e){var i=t.indexOf(e);i>=0&&(t[i]=t[t.length-1],--t.length)}function le(t,e){var i=t.findIndex(e);if(i>=0){var n=t[i];return ae(t,i),n}}function _e(t,e){return t.indexOf(e)>=0}var de=Object.freeze({__proto__:null,MutableForwardIterator:oe,removeAt:ae,fastRemoveAt:he,remove:ue,fastRemove:ce,removeIf:le,verifyType:function(t,e){if(t&&t.length>0)for(var i,n=d(t);!(i=n()).done;)if(!(i.value instanceof e))return X(1300),!1;return!0},removeArray:function(t,e){for(var i=0,n=e.length;i<n;i++)ue(t,e[i])},appendObjectsAt:function(t,e,i){return t.splice.apply(t,[i,0].concat(e)),t},contains:_e,copy:function(t){for(var e=t.length,i=new Array(e),n=0;n<e;n+=1)i[n]=t[n];return i}}),fe={IDGenerator:vt,Pool:se,array:de,isNumber:St,isString:At,isEmptyObject:bt,getPropertyDescriptor:kt,addon:Gt,mixin:Ht,extend:zt,getSuper:Vt,isChildClassOf:Wt,clear:Xt,value:Rt,getset:wt,get:It,set:xt,unregisterClass:$t,getClassName:Ot,setClassName:Zt,setClassAlias:Jt,getClassByName:ie,getClassById:ee,get _registeredClassNames(){return r({},Yt)},set _registeredClassNames(t){Xt(Yt),Object.assign(Yt,t)},get _registeredClassIds(){return r({},jt)},set _registeredClassIds(t){Xt(jt),Object.assign(jt,t)},_getClassId:ne,getClassId:re,_setClassId:qt,_getClassById:te,obsolete:Pt,obsoletes:Mt,formatStr:Bt,shiftArguments:Ft,createMap:Dt};m.js=fe;var pe=Object.freeze({__proto__:null,array:de,js:fe,IDGenerator:vt,Pool:se,isNumber:St,isString:At,isEmptyObject:bt,value:Rt,getset:wt,get:It,set:xt,createMap:Dt,getClassName:Ot,obsolete:Pt,obsoletes:Mt,formatStr:Bt,shiftArguments:Ft,getPropertyDescriptor:kt,copyAllProperties:function(t,e,i){for(var n=Object.getOwnPropertyNames(t),r=0,s=n.length;r<s;++r){var o=n[r];-1===i.indexOf(o)&&Ut(o,t,e)}},addon:Gt,mixin:Ht,extend:zt,getSuper:Vt,isChildClassOf:Wt,clear:Xt,_idToClass:jt,_nameToClass:Yt,_setClassId:qt,setClassName:Zt,setClassAlias:Jt,unregisterClass:$t,_getClassById:te,getClassById:ee,getClassByName:ie,_getClassId:ne,getClassId:re});function ge(t){if("__bitmask__"in t)return t;Rt(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 o=""+s;r!==o&&Rt(t,o,r)}return t}function me(t,e){e>=0&&t.length,t.length}t("js",pe),ge.isBitMask=function(t){return t&&Object.prototype.hasOwnProperty.call(t,"__bitmask__")},ge.getList=function(t){return t.__bitmask__?t.__bitmask__:ge.update(t)},ge.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},m.BitMask=ge;var ve=Object.prototype.hasOwnProperty;function ye(t){return"__enums__"in t?t:(Rt(t,"__enums__",null,!0),ye.update(t))}function Te(t){ve.call(t,"__enums__")}function Ee(t){Te(t);var e=t.__enums__||[];e.length=0;var i=!0;for(var n in t){var r=t[n],s=Number.isInteger(r);s||(i=!1),(s||"string"==typeof r&&t[r]!==Number.parseInt(n))&&e.push({name:n,value:r})}return i&&e.sort((function(t,e){return t.value-e.value})),t.__enums__=e,e}function Se(t){"__enums__"in t||Rt(t,"__enums__",null,!0)}ye.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 o=""+s;r!==o&&Rt(t,o,r)}return Array.isArray(t.__enums__)&&Ee(t),t},ye||t("Enum",ye={}),ye.isEnum=function(t){return t&&ve.call(t,"__enums__")},ye.getList=function(t){return Te(t),t.__enums__?t.__enums__:Ee(t)},ye.sortList=function(t,e){Te(t),Array.isArray(t.__enums__)&&t.__enums__.sort(e)},m.Enum=ye;var Ae,be=t("ValueType",function(){function t(){}var e=t.prototype;return e.clone=function(){return Z(100,Ot(this)+".clone"),this},e.equals=function(){return!1},e.set=function(){Z(100,Ot(this)+".set")},e.toString=function(){return""},t}());Zt("cc.ValueType",be),m.ValueType=be,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"}(Ae||(Ae={}));var Ce=t("Settings",function(){function t(){this._settings={},this._override={}}var e=t.prototype;return e.init=function(t,e){var i=this;for(var n in void 0===t&&(t=""),void 0===e&&(e={}),e){var r=e[n];if(r)for(var s in r)this.overrideSettings(n,s,r[s])}return t?new Promise((function(e,n){if(t.startsWith("http")){var r=new XMLHttpRequest;r.open("GET",t),r.responseType="text",r.onload=function(){i._settings=JSON.parse(r.response),e()},r.onerror=function(){n(new Error("request settings failed!"))},r.send(null)}else{var s=fsUtils.readJsonSync(t);s instanceof Error?n(s):(i._settings=s,e())}})):Promise.resolve()},e.overrideSettings=function(t,e,i){t in this._override||(this._override[t]={}),this._override[t][e]=i},e.querySettings=function(t,e){if(t in this._override){var i=this._override[t];if(i&&e in i)return i[e]}if(t in this._settings){var n=this._settings[t];if(n&&e in n)return n[e]}return null},t}());Ce.Category=Ae;var Re,we=t("settings",new Ce);m.settings=we,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"}(Re||(Re={}));var Ie=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:Re.PORTRAIT,ORIENTATION_PORTRAIT_UPSIDE_DOWN:Re.PORTRAIT_UPSIDE_DOWN,ORIENTATION_LANDSCAPE:Re.LANDSCAPE,ORIENTATION_LANDSCAPE_LEFT:Re.LANDSCAPE_LEFT,ORIENTATION_LANDSCAPE_RIGHT:Re.LANDSCAPE_RIGHT,ORIENTATION_AUTO:Re.AUTO,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:"Builtin",init:function(){this.CLEANUP_IMAGE_CACHE=!0;var t=we.querySettings(Ce.Category.ENGINE,"macros");if(t)for(var e in t)Ie[e]=t[e]}});function xe(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 o=performance.now(),a=requestAnimationFrame||window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame;if(void 0===a||null!==(i=globalThis.__globalXR)&&void 0!==i&&i.isWebXR)return setTimeout.apply(void 0,[t,e].concat(r));var h=function i(){performance.now()-o<e?a(i):t.apply(void 0,r)};return a(h)}m.macro=Ie;for(var De=/^(?:cc|dragonBones|sp|ccsg)\..+/,Oe=new Array(123),Pe=0;Pe<123;++Pe)Oe[Pe]=64;for(var Me=0;Me<64;++Me)Oe["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charCodeAt(Me)]=Me;var Ne=Oe;function Le(t,e,i){function n(t,e,i,n){var r=Object.getOwnPropertyDescriptor(t,e);if(r)r.get&&i&&(t[i]=r.get),r.set&&n&&(t[n]=r.set);else{var s=t[i];wt(t,e,s,t[n])}}for(var r,s=t.prototype,o=0,a=e.length;o<a;++o){var h=(r=e[o])[0].toUpperCase()+r.slice(1);n(s,r,"get"+h,"set"+h)}for(r in i){var u=i[r];n(s,r,u[0],u[1])}}function Be(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 Fe(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 ke(t){return"object"==typeof window&&"function"==typeof Node?t instanceof Node:!!t&&"object"==typeof t&&"number"==typeof t.nodeType&&"string"==typeof t.nodeName}function Ue(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];t&&xe((function(){t.apply(void 0,i)}),0)}function Ge(t){return!(!t||t.constructor!==Object)&&bt(t)}function He(t,e,i){if(e>i){var n=e;e=i,i=n}return t<e?e:t<i?t:i}function ze(t){return t*Ie.RAD}function Ve(t){return t*Ie.DEG}m.misc={BUILTIN_CLASSID_RE:De,BASE64_VALUES:Ne,propertyDefine:Le,pushToMap:Be,contains:Fe,isDomNode:ke,callInNextTick:Ue,isPlainEmptyObj_DEV:Ge,clampf:He,degreesToRadians:ze,radiansToDegrees:Ve},t("misc",Object.freeze({__proto__:null,BUILTIN_CLASSID_RE:De,BASE64_VALUES:Ne,propertyDefine:Le,pushToMap:Be,contains:Fe,isDomNode:ke,callInNextTick:Ue,tryCatchFunctor_EDITOR:function(t){return Function("target","try {\n target."+t+"();\n}\ncatch (e) {\n cc._throw(e);\n}")},isPlainEmptyObj_DEV:Ge,clampf:He,degreesToRadians:ze,radiansToDegrees:Ve}));var We="$_$";function Xe(t,e){var i=e?Object.create(e):{};return Rt(t,"__attrs__",i),i}function je(t){if("function"!=typeof t)return Xe(t,Ke(t.constructor));for(var e,i=m.Class.getInheritanceChain(t),n=i.length-1;n>=0;n--){var r=i[n];r.hasOwnProperty("__attrs__")&&r.__attrs__||Xe(r,(e=i[n+1])&&e.__attrs__)}return Xe(t,(e=i[0])&&e.__attrs__),t.__attrs__}function Ye(t,e){var i=Ke(t),n=e+We,r={};for(var s in i)s.startsWith(n)&&(r[s.slice(n.length)]=i[s]);return r}function Ke(t){return t.hasOwnProperty("__attrs__")&&t.__attrs__||je(t)}function qe(t,e,i,n){Ke(t)[e+We+i]=n}var Qe=function(){function t(t,e){this.name=t,this.default=e}return t.prototype.toString=function(){return this.name},t}(),Ze=t("CCInteger",new Qe("Integer",0));m.Integer=Ze,m.CCInteger=Ze;var Je=t("CCFloat",new Qe("Float",0));m.Float=Je,m.CCFloat=Je;var $e=t("CCBoolean",new Qe("Boolean",!1));m.Boolean=$e,m.CCBoolean=$e;var ti=t("CCString",new Qe("String",""));function ei(t,e){return function(i,n){var r='"'+Ot(i)+"."+n+'"',s=Ye(i,n),o=s.type;if(o===Ze||o===Je?o="Number":o!==ti&&o!==$e||(o=""+o),o===t){if(s.hasOwnProperty("default")){var a=s.default;if(void 0!==a&&!Array.isArray(a)&&!Ge(a)){var h=typeof a,u=t.toLowerCase();if(h===u)if("object"===u){if(!a||a instanceof s.ctor)return;q(3605,r,Ot(s.ctor))}else"Number"!==t&&q(3606,e,r,t);else{if("function"===h)return;t===ti.default&&null==a?q(3607,r):q(3611,e,r,h)}delete s.type}}}else q(3604,r)}}m.String=ti,m.CCString=ti;var ii=Object.freeze({__proto__:null,DELIMETER:We,createAttrsSingle:Xe,createAttrs:je,attr:Ye,getClassAttrs:Ke,setClassAttr:qe,PrimitiveType:Qe,CCInteger:Ze,CCFloat:Je,CCBoolean:$e,CCString:ti,getTypeChecker_ET:ei,getObjTypeChecker_ET:function(t){return function(e,i){ei("Object","type")(e,i);var n=Ke(e)[i+We+"default"],r=m.Class.getDefault(n);if(!Array.isArray(r)&&Wt(t,m.ValueType)){var s=Ot(t),o=Bt('No need to specify the "type" of "%s.%s" because %s is a child class of ValueType.',Ot(e),i,s);n?B(o):q(3612,o,s,Ot(e),i,s)}}}}),ni={default:{},serializable:{},editorOnly:{},formerlySerializedAs:{}};function ri(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 o in n[r]=s,ni){var a=ni[o];t.hasOwnProperty(o)&&(s[o]=t[o],a.canUsedInGet||delete t[o])}}}function si(t,e,i,n){if(Array.isArray(e)){if(!(e.length>0))return Z(5508,i,n);t.type=e=e[0]}"function"==typeof e&&(e===String?t.type=m.String:e===Boolean?t.type=m.Boolean:e===Number&&(t.type=m.Float))}function oi(t,e,i){var n=t||void 0===e?{_short:!0}:{_short:!0,default:e};return i&&(n.type=i),n}function ai(t,e){if(!t||t.constructor!==Object){if(Array.isArray(t)&&t.length>0)return oi(e,[],t);if("function"==typeof t){var i=t;return oi(e,Wt(i,m.ValueType)?new i:null,i)}return t instanceof Qe?oi(e,void 0,t):oi(e,t)}return null}var hi,ui=[];function ci(){return ui[ui.length-1]}function li(t,e,i){_i(Ke(t),e,i)}function _i(t,e,i){t[e+"$_$type"]="Enum",t[e+"$_$enumList"]=ye.getList(i)}m._RF={push:function(t,e,i,n){void 0===i&&(i=e,e=""),ui.push({uuid:e,script:i,module:t,exports:t.exports,beh:null,importMeta:n})},pop:function(){var t=ui.pop(),e=t.module,i=e.exports;if(i===t.exports){for(var n in i)return;e.exports=i=t.cls}},peek:ci},function(t){t[t.STANDALONE=1]="STANDALONE",t[t.IMPLICIT_VISIBLE=2]="IMPLICIT_VISIBLE",t[t.IMPLICIT_SERIALIZABLE=4]="IMPLICIT_SERIALIZABLE"}(hi||(hi={}));var di=We,fi="__ctors__",pi=t("ENUM_TAG","Enum"),gi=t("BITMASK_TAG","BitMask");function mi(t,e,i,n){!function(t,e){!function(t,e){t.indexOf(e)<0&&t.push(e)}(t.__props__,e)}(t,i),Ai(t,n,e,i)}function vi(t,e,i,n){var r=n.get;n.set,r&&(Ai(t,n,e,i),qe(t,i,"serializable",!1))}function yi(t){return"function"==typeof t?t():t}function Ti(t){var e=t.name,i=t.extends,n=function(t,e,i){var n=m.Component,r=ci();if(r&&Wt(e,n)){if(Wt(r.cls,n))return Z(3615),null;t=t||r.script}var s=function(t,e,i){var n=i.ctor;return Rt(n,fi,!0,!0),n.prototype,e&&(n.$super=e),Zt(t,n),n}(t,e,i);if(r)if(Wt(e,n)){var o=r.uuid;o&&qt(o,s),r.cls=s}else Wt(r.cls,n)||(r.cls=s);return s}(e,i,t);e||(e=m.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=ai(n,!1);if(r&&(n=t[i]=r),n){var s=n.notify;s&&ri(n,i,s,t),"type"in n&&si(n,n.type,e,i)}}}(i,e),i){var s=i[r];s.get||s.set?vi(t,e,r,s):mi(t,e,r,s)}var o=Ke(t);t.__values__=t.__props__.filter((function(t){return!1!==o[t+"$_$serializable"]}))}(n,e,t.properties,i);var r=t.editor;return r&&Wt(i,m.Component)&&m.Component._registerEditorProps(n,r),n}function Ei(t){var e;return null==t||null===(e=t.hasOwnProperty)||void 0===e?void 0:e.call(t,"__values__")}Ti._isCCClass=function(t){var e;return null==t||null===(e=t.hasOwnProperty)||void 0===e?void 0:e.call(t,fi)},Ti.fastDefine=function(t,e,i){Zt(t,e);for(var n=e.__props__=e.__values__=Object.keys(i),r=Ke(e),s=0;s<n.length;s++){var o=n[s];r[o+di+"visible"]=!1,r[o+di+"default"]=i[o]}},Ti.Attr=ii,Ti.attr=Ye,Ti.isCCClassOrFastDefined=Ei,Ti.getInheritanceChain=function(t){for(var e=[];t=Vt(t);)t!==Object&&e.push(t);return e};var Si={Integer:"Number",Float:"Number",Boolean:"Boolean",String:"String"};function Ai(t,e,i,n){var r=null,s="";function o(){return s=n+di,r=Ke(t)}"type"in e&&void 0===e.type&&q(3660,n,i);var a=e.type;a&&(Si[a]?(r||o())[s+"type"]=a:"Object"===a||("object"==typeof a?ye.isEnum(a)?_i(r||o(),n,a):ge.isBitMask(a)&&((r||o())[s+"type"]=gi,r[s+"bitmaskList"]=ge.getList(a)):"function"==typeof a&&((r||o())[s+"type"]="Object",r[s+"ctor"]=a))),"default"in e&&((r||o())[s+"default"]=e.default);var h,u=function(t,i){if(t in e){var n=e[t];typeof n===i&&((r||o())[s+t]=n)}};e.editorOnly&&((r||o())[s+"editorOnly"]=!0),e.__internalFlags&hi.STANDALONE?h=!0===e.serializable||0!=(e.__internalFlags&hi.IMPLICIT_SERIALIZABLE):!1===e.serializable&&(h=!1),void 0!==h&&((r||o())[s+"serializable"]=h),u("formerlySerializedAs","string");var c=e.range;c&&Array.isArray(c)&&c.length>=2&&((r||o())[s+"min"]=c[0],r[s+"max"]=c[1],c.length>2&&(r[s+"step"]=c[2])),u("step","number"),u("userData","object")}Ti.isArray=function(t){return t=yi(t),Array.isArray(t)},Ti.getDefault=yi,Ti.escapeForJS=function(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")},Ti.IDENTIFIER_RE=/^[A-Za-z_$][0-9A-Za-z_$]*$/,Ti.getNewValueTypeCode=!1,m.Class=Ti;var bi=Math.PI/180,Ci=180/Math.PI,Ri=Math.random,wi=t("HALF_PI",.5*Math.PI),Ii=t("TWO_PI",2*Math.PI),xi=t("EPSILON",1e-6);function Di(t,e){return Math.abs(t-e)<=xi*Math.max(1,Math.abs(t),Math.abs(e))}function Oi(t,e,i){return i=i||xi,Math.abs(t-e)<=i}function Pi(t,e,i){if(e>i){var n=e;e=i,i=n}return t<e?e:t>i?i:t}function Mi(t){return t<0?0:t>1?1:t}function Ni(t,e,i){return t+(e-t)*i}function Li(t){return t*bi}function Bi(t){return t*Ci}function Fi(){return Ri()}function ki(t){Ri=t}function Ui(t,e){return Fi()*(e-t)+t}function Gi(t,e){return Math.floor(Ui(t,e))}function Hi(t){return(t=(9301*t+49297)%233280)/233280}function zi(t,e,i){return Hi(t)*(i-e)+e}function Vi(t,e,i){return Math.floor(zi(t,e,i))}function Wi(t){return b(t)}function Xi(t,e){return t-Math.floor(t/e)*e}function ji(t,e){return t=Xi(t,2*e),e-Math.abs(t-e)}function Yi(t,e,i){return(i-t)/(e-t)}function Ki(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 qi(t,e){return Math.abs(t)>Math.abs(e)?t:e}function Qi(t,e){e.forEach((function(e){Object.defineProperty(t,e,{enumerable:!0})}))}var Zi,Ji,$i,tn=(Zi=new Float32Array(1),Ji=new Int32Array(Zi.buffer),function(t){Zi[0]=t;var e=Ji[0],i=e>>16&32768,n=2147483647&e,r=n-(112<<23)+4096>>13;return r=n<113<<23?0:r,r=n>=143<<23?31744:r,r=n>255<<23?32256:r,Ji[0]=i|r,Ji[0]}),en=function(){var t=new Float32Array(1),e=new Int32Array(t.buffer);return function(i){var n,r=32767&i,s=r<<13;return 31744!==s?(s+=112<<23,0===r?s=(1048575&s)>>1:32767===r&&(s=2147483647)):s=2139095040,n=(i>>15&1)<<31|s,e[0]=n,t[0]}}();function nn(t){return tn(t)}function rn(t){return en(t)}var sn,on=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)<xi?t.x=0:t.x=1/i,Math.abs(n)<xi?t.y=0:t.y=1/n,Math.abs(r)<xi?t.z=0:t.z=1/r,Math.abs(s)<xi?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,o=i*i+n*n+r*r+s*s;return o>0?(o=1/Math.sqrt(o),t.x=i*o,t.y=n*o,t.z=r*o,t.w=s*o):(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*Fi()*Math.PI,n=2*Fi()-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,o=e.w;return t.x=i.m00*n+i.m04*r+i.m08*s+i.m12*o,t.y=i.m01*n+i.m05*r+i.m09*s+i.m13*o,t.z=i.m02*n+i.m06*r+i.m10*s+i.m14*o,t.w=i.m03*n+i.m07*r+i.m11*s+i.m15*o,t},e.transformAffine=function(t,e,i){var n=e.x,r=e.y,s=e.z,o=e.w;return t.x=i.m00*n+i.m04*r+i.m08*s+i.m12*o,t.y=i.m01*n+i.m05*r+i.m09*s+i.m13*o,t.z=i.m02*n+i.m06*r+i.m10*s+i.m14*o,t.w=e.w,t},e.transformQuat=function(t,e,i){var n=e.x,r=e.y,s=e.z,o=i.x,a=i.y,h=i.z,u=i.w,c=u*n+a*s-h*r,l=u*r+h*n-o*s,_=u*s+o*r-a*n,d=-o*n-a*r-h*s;return t.x=c*u+d*-o+l*-h-_*-a,t.y=l*u+d*-a+_*-o-c*-h,t.z=_*u+d*-h+c*-a-l*-o,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=xi),!(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=xi),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=xi),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=Pi(this.x,t.x,e.x),this.y=Pi(this.y,t.y,e.y),this.z=Pi(this.z,t.z,e.z),this.w=Pi(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&&q(16361),this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},i.multiply=function(t){return"object"!=typeof t&&q(16362),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,o=t.z;return this.x=i*o-n*s,this.y=n*r-e*o,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}(be));function an(t,e,i,n){return new on(t,e,i,n)}$i=on,on.ZERO=Object.freeze(new $i(0,0,0,0)),on.ONE=Object.freeze(new $i(1,1,1,1)),on.NEG_ONE=Object.freeze(new $i(-1,-1,-1,-1)),on.UNIT_X=Object.freeze(new $i(1,0,0,0)),on.UNIT_Y=Object.freeze(new $i(0,1,0,0)),on.UNIT_Z=Object.freeze(new $i(0,0,1,0)),on.UNIT_W=Object.freeze(new $i(0,0,0,1)),Ti.fastDefine("cc.Vec4",on,{x:0,y:0,z:0,w:0}),m.Vec4=on,m.v4=an;var hn,un,cn,ln,_n=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)<xi?t.x=0:t.x=1/i,Math.abs(n)<xi?t.y=0:t.y=1/n,Math.abs(r)<xi?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,o=i.x,a=i.y,h=i.z;return t.x=r*h-s*a,t.y=s*o-n*h,t.z=n*a-r*o,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*Fi()*Math.PI,n=2*Fi()-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,o=i.m03*n+i.m07*r+i.m11*s+i.m15;return o=o?1/o:1,t.x=(i.m00*n+i.m04*r+i.m08*s+i.m12)*o,t.y=(i.m01*n+i.m05*r+i.m09*s+i.m13)*o,t.z=(i.m02*n+i.m06*r+i.m10*s+i.m14)*o,t},e.transformMat4Normal=function(t,e,i){var n=e.x,r=e.y,s=e.z,o=i.m03*n+i.m07*r+i.m11*s;return o=o?1/o:1,t.x=(i.m00*n+i.m04*r+i.m08*s)*o,t.y=(i.m01*n+i.m05*r+i.m09*s)*o,t.z=(i.m02*n+i.m06*r+i.m10*s)*o,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,o=-i.x*e.x-i.y*e.y-i.z*e.z;return t.x=n*i.w+o*-i.x+r*-i.z-s*-i.y,t.y=r*i.w+o*-i.y+s*-i.x-n*-i.z,t.z=s*i.w+o*-i.z+n*-i.y-r*-i.x,t},e.transformRTS=function(t,e,i,n,r){var s=e.x*r.x,o=e.y*r.y,a=e.z*r.z,h=i.w*s+i.y*a-i.z*o,u=i.w*o+i.z*s-i.x*a,c=i.w*a+i.x*o-i.y*s,l=-i.x*s-i.y*o-i.z*a;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,o=e.y-n.y,a=e.z-n.z,h=i.w*s-i.y*a+i.z*o,u=i.w*o-i.z*s+i.x*a,c=i.w*a-i.x*o+i.y*s,l=i.x*s+i.y*o+i.z*a;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,o=e.z-i.z,a=Math.cos(n),h=Math.sin(n),u=r,c=s*a-o*h,l=s*h+o*a;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,o=e.z-i.z,a=Math.cos(n),h=Math.sin(n),u=o*h+r*a,c=s,l=o*a-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,o=e.z-i.z,a=Math.cos(n),h=Math.sin(n),u=r*a-s*h,c=r*h+s*a,l=o;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,o=e.y-i.y,a=e.z-i.z,h=n.x,u=n.y,c=n.z,l=Math.cos(r),_=Math.sin(r),d=s*(h*h*(1-l)+l)+o*(h*u*(1-l)-c*_)+a*(h*c*(1-l)+u*_),f=s*(h*u*(1-l)+c*_)+o*(u*u*(1-l)+l)+a*(u*c*(1-l)-h*_),p=s*(h*c*(1-l)-u*_)+o*(u*c*(1-l)+h*_)+a*(c*c*(1-l)+l);return t.x=d+i.x,t.y=f+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=xi);var n=t.x,r=t.y,s=t.z,o=e.x,a=e.y,h=e.z;return Math.abs(n-o)<=i*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(r-a)<=i*Math.max(1,Math.abs(r),Math.abs(a))&&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=Pi(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,o=i.z-e.z,a=r*r+s*s+o*o;if(0===a||n>=0&&a<n*n)return t.x=i.x,t.y=i.y,t.z=i.z,t;var h=n/Math.sqrt(a);return t.x=e.x+r*h,t.y=e.y+s*h,t.z=e.z+o*h,t},e.generateOrthogonal=function(t,i){var n=i.x,r=i.y,s=i.z,o=Math.abs(n),a=Math.abs(r),h=Math.abs(s);return o<a&&o<h?e.set(t,0,s,-r):a<h?e.set(t,s,0,-n):e.set(t,r,-n,0),e.normalize(t,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=xi),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=xi),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&&q(16357),this.x*=t,this.y*=t,this.z*=t,this},i.multiply=function(t){return"object"!=typeof t&&q(16358),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=Pi(this.x,t.x,e.x),this.y=Pi(this.y,t.y,e.y),this.z=Pi(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,o=t.z;return this.x=i*o-n*s,this.y=n*r-e*o,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},i.toVec2=function(){return new m.Vec2(this.x,this.y)},e}(be));function dn(t,e,i){return new _n(t,e,i)}sn=_n,_n.UNIT_X=Object.freeze(new sn(1,0,0)),_n.UNIT_Y=Object.freeze(new sn(0,1,0)),_n.UNIT_Z=Object.freeze(new sn(0,0,1)),_n.RIGHT=Object.freeze(new sn(1,0,0)),_n.UP=Object.freeze(new sn(0,1,0)),_n.FORWARD=Object.freeze(new sn(0,0,-1)),_n.ZERO=Object.freeze(new sn(0,0,0)),_n.ONE=Object.freeze(new sn(1,1,1)),_n.NEG_ONE=Object.freeze(new sn(-1,-1,-1)),_n.slerp=(hn=new sn,un=new sn,cn=new sn,function(t,e,i,n){var r=1e-5,s=sn.len(e),o=sn.len(i);if(s<r||o<r)return sn.lerp(t,e,i,n);var a=Ni(s,o,n),h=sn.dot(e,i)/(s*o);if(h>.99999)return sn.lerp(t,e,i,n);if(h<-.99999){var u=sn.multiplyScalar(hn,e,1/s),c=sn.generateOrthogonal(un,u),l=Math.PI*n;return gn(cn,u,c,l),sn.multiplyScalar(t,cn,a),t}var _=h,d=Math.acos(_)*n,f=sn.multiplyScalar(hn,e,1/s),p=sn.multiplyScalar(un,i,1/o);return sn.scaleAndAdd(cn,p,f,-_),sn.normalize(cn,cn),sn.multiplyScalar(cn,cn,Math.sin(d)),sn.scaleAndAdd(cn,cn,f,Math.cos(d)),sn.multiplyScalar(t,cn,a),t}),_n.signedAngle=(ln=new sn,function(t,e,i){var n=sn.angle(t,e),r=sn.cross(ln,t,e);return sn.dot(r,i)<0?-n:n}),Ti.fastDefine("cc.Vec3",_n,{x:0,y:0,z:0}),m.Vec3=_n;var fn,pn,gn=(fn={x:0,y:0,z:0,w:0},function(t,e,i,n){var r=.5*n,s=Math.sin(r);return fn.x=s*i.x,fn.y=s*i.y,fn.z=s*i.z,fn.w=Math.cos(r),_n.transformQuat(t,e,fn),t});m.v3=dn;var mn,vn=1/255,yn=t("Color",function(t){function e(e,i,n,r){var s;return(s=t.call(this)||this)._data=new Uint8ClampedArray(4),"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 i.r=t.r,i.g=t.g,i.b=t.b,i.a=t.a,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 on).x=t._data[0]*vn,e.y=t._data[1]*vn,e.z=t._data[2]*vn,e.w=t._data[3]*vn,e},e.fromVec4=function(t,i){return(i=void 0===i?new e:i)._data[0]=t.x/vn,i._data[1]=t.y/vn,i._data[2]=t.z/vn,i._data[3]=t.w/vn,i},e.fromHEX=function(t,e){var i;return"string"==typeof e?(6===(e="#"===e[0]?e.substring(1):e).length?e+="FF":3===e.length?e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]+"FF":4===e.length&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]+e[3]+e[3]),i=Number("0x"+e)):(e<16777216&&(e=255+(e<<8)),i=e),t.r=i>>>24,t.g=(16711680&i)>>>16,t.b=(65280&i)>>>8,t.a=255&i,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,o=e.b,a=e.a;return t.r=r+(i.r-r)*n,t.g=s+(i.g-s)*n,t.b=o+(i.b-o)*n,t.a=a+(i.a-a)*n,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 e>>>=0,t.r=255&e,t.g=e>>8&255,t.b=e>>16&255,t.a=e>>24&255,t},e.toUint32=function(t){return(t.a<<24|t.b<<16|t.g<<8|t.r)>>>0},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=xi),!(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._data.set(this._data),t},i.equals=function(t){var e=t;return t&&this._data[0]===e.r&&this._data[1]===e.g&&this._data[2]===e.b&&this._data[3]===e.a},i.lerp=function(t,i){return e.lerp(this,this,t,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*vn).toFixed(2)+")":"rgb"===t?"rgb("+this.r+","+this.g+","+this.b+")":"#"+this.toHEX(t)},i.fromHEX=function(t){var e;return"string"==typeof t?(6===(t="#"===t[0]?t.substring(1):t).length?t+="FF":3===t.length?t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]+"FF":4===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]+t[3]+t[3]),e=Number("0x"+t)):(t<16777216&&(t=255+(t<<8)),e=t),this.r=e>>>24,this.g=(16711680&e)>>>16,this.b=(65280&e)>>>8,this.a=255&e,this},i.toHEX=function(t){void 0===t&&(t="#rrggbb");var e="0",i=[(this._data[0]<16?e:"")+this._data[0].toString(16),(this._data[1]<16?e:"")+this._data[1].toString(16),(this._data[2]<16?e:"")+this._data[2].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._data[3]<16?e:"")+this._data[3].toString(16)),i.join("")},i.toRGBValue=function(){return this._data[2]<<16|this._data[1]<<8|this._data[0]},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 o=Math.floor(t),a=t-o,h=i*(1-e),u=i*(1-e*a),c=i*(1-e*(1-a));switch(o){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 this._data[0]=255*n,this._data[1]=255*r,this._data[2]=255*s,this},i.toHSV=function(){var t=this._data[0]*vn,e=this._data[1]*vn,i=this._data[2]*vn,n={h:0,s:0,v:0},r=Math.max(t,e,i),s=Math.min(t,e,i),o=0;return n.v=r,n.s=r?(r-s)/r:0,n.s?(o=r-s,n.h=t===r?(e-i)/o:e===r?2+(i-t)/o:4+(t-e)/o,n.h/=6,n.h<0&&(n.h+=1)):n.h=0,n},i.set=function(t,e,i,n){if("object"==typeof t){var r,s,o,a,h=t;h._data?this._data.set(h._data):(this._data[0]=null!==(r=h.r)&&void 0!==r?r:0,this._data[1]=null!==(s=h.g)&&void 0!==s?s:0,this._data[2]=null!==(o=h.b)&&void 0!==o?o:0,this._data[3]=null!==(a=h.a)&&void 0!==a?a:255)}else this._data[0]=null!=t?t:0,this._data[1]=null!=e?e:0,this._data[2]=null!=i?i:0,this._data[3]=null!=n?n:255;return this},i.multiply=function(t){return this._data[0]*=t.r/255,this._data[1]*=t.g/255,this._data[2]*=t.b/255,this._data[3]*=t.a/255,this},i.getModifiableProperties=function(){return["r","g","b","a"]},n(e,[{key:"r",get:function(){return this._data[0]},set:function(t){this._data[0]=t}},{key:"g",get:function(){return this._data[1]},set:function(t){this._data[1]=t}},{key:"b",get:function(){return this._data[2]},set:function(t){this._data[2]=t}},{key:"a",get:function(){return this._data[3]},set:function(t){this._data[3]=t}},{key:"x",get:function(){return this._data[0]*vn},set:function(t){this._data[0]=255*t}},{key:"y",get:function(){return this._data[1]*vn},set:function(t){this._data[1]=255*t}},{key:"z",get:function(){return this._data[2]*vn},set:function(t){this._data[2]=255*t}},{key:"w",get:function(){return this._data[3]*vn},set:function(t){this._data[3]=255*t}}]),e}(be));function Tn(t,e,i,n){return new yn(t,e,i,n)}function En(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}pn=yn,yn.WHITE=Object.freeze(new pn(255,255,255,255)),yn.GRAY=Object.freeze(new pn(127,127,127,255)),yn.BLACK=Object.freeze(new pn(0,0,0,255)),yn.TRANSPARENT=Object.freeze(new pn(0,0,0,0)),yn.RED=Object.freeze(new pn(255,0,0,255)),yn.GREEN=Object.freeze(new pn(0,255,0,255)),yn.BLUE=Object.freeze(new pn(0,0,255,255)),yn.CYAN=Object.freeze(new pn(0,255,255,255)),yn.MAGENTA=Object.freeze(new pn(255,0,255,255)),yn.YELLOW=Object.freeze(new pn(255,255,0,255)),Ti.fastDefine("cc.Color",yn,{r:0,g:0,b:0,a:255}),m.Color=yn,m.color=Tn;var Sn=t("Mat3",function(t){function e(e,i,n,r,s,o,a,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===o&&(o=0),void 0===a&&(a=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=o,c.m06=a,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,o,a,h,u){return t.m00=e,t.m01=i,t.m02=n,t.m03=r,t.m04=s,t.m05=o,t.m06=a,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,o=e.m04,a=e.m05,h=e.m06,u=e.m07,c=e.m08,l=c*o-a*u,_=-c*s+a*h,d=u*s-o*h,f=i*l+n*_+r*d;return 0===f?(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):(f=1/f,t.m00=l*f,t.m01=(-c*n+r*u)*f,t.m02=(a*n-r*o)*f,t.m03=_*f,t.m04=(c*i-r*h)*f,t.m05=(-a*i+r*s)*f,t.m06=d*f,t.m07=(-u*i+n*h)*f,t.m08=(o*i-n*s)*f,t)},e.determinant=function(t){var e=t.m00,i=t.m01,n=t.m02,r=t.m03,s=t.m04,o=t.m05,a=t.m06,h=t.m07,u=t.m08;return e*(u*s-o*h)+i*(-u*r+o*a)+n*(h*r-s*a)},e.multiply=function(t,e,i){var n=e.m00,r=e.m01,s=e.m02,o=e.m03,a=e.m04,h=e.m05,u=e.m06,c=e.m07,l=e.m08,_=i.m00,d=i.m01,f=i.m02,p=i.m03,g=i.m04,m=i.m05,v=i.m06,y=i.m07,T=i.m08;return t.m00=_*n+d*o+f*u,t.m01=_*r+d*a+f*c,t.m02=_*s+d*h+f*l,t.m03=p*n+g*o+m*u,t.m04=p*r+g*a+m*c,t.m05=p*s+g*h+m*l,t.m06=v*n+y*o+T*u,t.m07=v*r+y*a+T*c,t.m08=v*s+y*h+T*l,t},e.multiplyMat4=function(t,e,i){var n=e.m00,r=e.m01,s=e.m02,o=e.m03,a=e.m04,h=e.m05,u=e.m06,c=e.m07,l=e.m08,_=i.m00,d=i.m01,f=i.m02,p=i.m04,g=i.m05,m=i.m06,v=i.m08,y=i.m09,T=i.m10;return t.m00=_*n+d*o+f*u,t.m01=_*r+d*a+f*c,t.m02=_*s+d*h+f*l,t.m03=p*n+g*o+m*u,t.m04=p*r+g*a+m*c,t.m05=p*s+g*h+m*l,t.m06=v*n+y*o+T*u,t.m07=v*r+y*a+T*c,t.m08=v*s+y*h+T*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,o=e.m03,a=e.m04,h=e.m05,u=e.m06,c=e.m07,l=e.m08,_=i.x,d=i.y;return t.m00=n,t.m01=r,t.m02=s,t.m03=o,t.m04=a,t.m05=h,t.m06=_*n+d*o+u,t.m07=_*r+d*a+c,t.m08=_*s+d*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,o=e.m03,a=e.m04,h=e.m05,u=e.m06,c=e.m07,l=e.m08,_=Math.sin(i),d=Math.cos(i);return t.m00=d*n+_*o,t.m01=d*r+_*a,t.m02=d*s+_*h,t.m03=d*o-_*n,t.m04=d*a-_*r,t.m05=d*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 _n.lengthSqr(i)<xi*xi?(e.identity(t),t):(n=n||_n.UNIT_Y,_n.normalize(bn,_n.cross(bn,n,i)),_n.lengthSqr(bn)<xi*xi?(e.identity(t),t):(_n.cross(Cn,i,bn),e.set(t,bn.x,bn.y,bn.z,Cn.x,Cn.y,Cn.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,o=i+i,a=n+n,h=r+r,u=i*o,c=n*o,l=n*a,_=r*o,d=r*a,f=r*h,p=s*o,g=s*a,m=s*h;return t.m00=1-l-f,t.m03=c-m,t.m06=_+g,t.m01=c+m,t.m04=1-u-f,t.m07=d-p,t.m02=_-g,t.m05=d+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,o=e.m04,a=e.m05,h=e.m06,u=e.m07,c=e.m08,l=e.m09,_=e.m10,d=e.m11,f=e.m12,p=e.m13,g=e.m14,m=e.m15,v=i*a-n*o,y=i*h-r*o,T=i*u-s*o,E=n*h-r*a,S=n*u-s*a,A=r*u-s*h,b=c*p-l*f,C=c*g-_*f,R=c*m-d*f,w=l*g-_*p,I=l*m-d*p,x=_*m-d*g,D=v*x-y*I+T*w+E*R-S*C+A*b;return D?(D=1/D,t.m00=(a*x-h*I+u*w)*D,t.m01=(h*R-o*x-u*C)*D,t.m02=(o*I-a*R+u*b)*D,t.m03=(r*I-n*x-s*w)*D,t.m04=(i*x-r*R+s*C)*D,t.m05=(n*R-i*I-s*b)*D,t.m06=(p*A-g*S+m*E)*D,t.m07=(g*T-f*A-m*y)*D,t.m08=(f*S-p*T+m*v)*D,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=xi),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 o=t.m06,a=t.m07,h=t.m08;return a<.999?a>-.999?(e.x=Math.asin(-a),e.y=Math.atan2(o,h),e.z=Math.atan2(n,s),!0):(e.x=wi,e.y=Math.atan2(r,i),e.z=0,!1):(e.x=-wi,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,o,a,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===o&&(o=0),void 0===a&&(a=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=o,this.m07=a,this.m08=h),this},i.equals=function(t,e){return void 0===e&&(e=xi),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,o=this.m06,a=this.m07,h=this.m08,u=h*r-s*a,c=-h*n+s*o,l=a*n-r*o,_=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*a)*_,this.m02=(s*e-i*r)*_,this.m03=c*_,this.m04=(h*t-i*o)*_,this.m05=(-s*t+i*n)*_,this.m06=l*_,this.m07=(-a*t+e*o)*_,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,o=this.m06,a=this.m07,h=this.m08;return t*(h*r-s*a)+e*(-h*n+s*o)+i*(a*n-r*o)},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,o=this.m05,a=this.m06,h=this.m07,u=this.m08,c=t.m00,l=t.m01,_=t.m02,d=t.m03,f=t.m04,p=t.m05,g=t.m06,m=t.m07,v=t.m08;return this.m00=c*e+l*r+_*a,this.m01=c*i+l*s+_*h,this.m02=c*n+l*o+_*u,this.m03=d*e+f*r+p*a,this.m04=d*i+f*s+p*h,this.m05=d*n+f*o+p*u,this.m06=g*e+m*r+v*a,this.m07=g*i+m*s+v*h,this.m08=g*n+m*o+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.m01*=e,this.m02*=e,this.m03*=i,this.m04*=i,this.m05*=i,this},i.rotate=function(t){var e=this.m00,i=this.m01,n=this.m02,r=this.m03,s=this.m04,o=this.m05,a=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*o,this.m03=l*r-c*e,this.m04=l*s-c*i,this.m05=l*o-c*n,this.m06=a,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,o=i+i,a=n+n,h=e*s,u=i*s,c=i*o,l=n*s,_=n*o,d=n*a,f=r*s,p=r*o,g=r*a;return this.m00=1-c-d,this.m03=u-g,this.m06=l+p,this.m01=u+g,this.m04=1-h-d,this.m07=_-f,this.m02=l-p,this.m05=_+f,this.m08=1-h-c,this},e}(be));mn=Sn,Sn.IDENTITY=Object.freeze(new mn);var An,bn=new _n,Cn=new _n;Ti.fastDefine("cc.Mat3",Sn,{m00:1,m01:0,m02:0,m03:0,m04:1,m05:0,m06:0,m07:0,m08:1}),m.Mat3=Sn;var Rn=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=_n.dot(i,n);return r<-.999999?(_n.cross(Dn,_n.UNIT_X,i),Dn.length()<1e-6&&_n.cross(Dn,_n.UNIT_Y,i),_n.normalize(Dn,Dn),e.fromAxisAngle(t,Dn,Math.PI),t):r>.999999?(t.x=0,t.y=0,t.z=0,t.w=1,t):(_n.cross(Dn,i,n),t.x=Dn.x,t.y=Dn.y,t.z=Dn.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,o=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=o,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,o=e.y,a=e.z,h=e.w;return t.x=s*r+h*n,t.y=o*r+a*n,t.z=a*r-o*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,o=e.y,a=e.z,h=e.w;return t.x=s*r-a*n,t.y=o*r+h*n,t.z=a*r+s*n,t.w=h*r-o*n,t},e.rotateZ=function(t,e,i){i*=.5;var n=Math.sin(i),r=Math.cos(i),s=e.x,o=e.y,a=e.z,h=e.w;return t.x=s*r+o*n,t.y=o*r-s*n,t.z=a*r+h*n,t.w=h*r-a*n,t},e.rotateAround=function(t,i,n,r){return e.invert(In,i),_n.transformQuat(Dn,n,In),e.fromAxisAngle(In,Dn,r),e.multiply(t,i,In),t},e.rotateAroundLocal=function(t,i,n,r){return e.fromAxisAngle(In,n,r),e.multiply(t,i,In),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,o=i.x,a=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,o=-o,a=-a,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*o,t.y=r*e.y+s*a,t.z=r*e.z+s*h,t.w=r*e.w+s*u,t},e.sqlerp=function(t,i,n,r,s,o){return e.slerp(In,i,s,o),e.slerp(xn,n,r,o),e.slerp(t,In,xn,2*o*(1-o)),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 Sn.set(On,i.x,i.y,i.z,n.x,n.y,n.z,r.x,r.y,r.z),e.normalize(t,e.fromMat3(t,On))},e.fromViewUp=function(t,i,n){return Sn.fromViewUp(On,i,n),e.normalize(t,e.fromMat3(t,On))},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,o=e.m04,a=e.m05,h=e.m06,u=e.m07,c=e.m08,l=i-o-c,_=o-i-c,d=c-i-o,f=0,p=i+o+c;l>p&&(p=l,f=1),_>p&&(p=_,f=2),d>p&&(p=d,f=3);var g=.5*Math.sqrt(p+1),m=.25/g;switch(f){case 0:t.w=g,t.x=(a-u)*m,t.y=(h-r)*m,t.z=(n-s)*m;break;case 1:t.w=(a-u)*m,t.x=g,t.y=(n+s)*m,t.z=(h+r)*m;break;case 2:t.w=(h-r)*m,t.x=(n+s)*m,t.y=g,t.z=(a+u)*m;break;case 3:t.w=(n-s)*m,t.x=(h+r)*m,t.y=(a+u)*m,t.z=g;break;default:t.w=1,t.x=0,t.y=0,t.z=0}return t},e.fromEuler=function(t,e,i,n){e*=Pn,i*=Pn,n*=Pn;var r=Math.sin(e),s=Math.cos(e),o=Math.sin(i),a=Math.cos(i),h=Math.sin(n),u=Math.cos(n);return t.x=r*a*u+s*o*h,t.y=s*o*u+r*a*h,t.z=s*a*h-r*o*u,t.w=s*a*u-r*o*h,t},e.fromAngleZ=function(t,e){return e*=Pn,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,o=e.w,a=0,h=0,u=0,c=n*r+s*o;if(c>.499999)a=0,h=Bi(2*Math.atan2(n,o)),u=90;else if(c<-.499999)a=0,h=-Bi(2*Math.atan2(n,o)),u=-90;else{var l=n*n,_=r*r,d=s*s;a=Bi(Math.atan2(2*n*o-2*r*s,1-2*l-2*d)),h=Bi(Math.atan2(2*r*o-2*n*s,1-2*_-2*d)),u=Bi(Math.asin(2*c)),i&&(a=-180*Math.sign(a+1e-6)+a,h=-180*Math.sign(h+1e-6)+h,u=180*Math.sign(u+1e-6)-u)}return t.x=a,t.y=h,t.z=u,t},e.toEulerInYXZOrder=function(t,e){Sn.fromQuat(On,e),Sn.toEuler(On,t),t.x=Bi(t.x),t.y=Bi(t.y),t.z=Bi(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=xi),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 o=Math.min(r/Bi(s),1);return e.slerp(t,i,n,o)};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=xi),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}(be));An=Rn,Rn.IDENTITY=Object.freeze(new An);var wn,In=new Rn,xn=new Rn,Dn=new _n,On=new Sn,Pn=.5*Math.PI/180;function Mn(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 Rn(t,e,i,n)}Ti.fastDefine("cc.Quat",Rn,{x:0,y:0,z:0,w:1}),m.Quat=Rn,m.quat=Mn;var Nn=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])])),Ln=t("Mat4",function(t){function e(e,i,n,r,s,o,a,h,u,c,l,_,d,f,p,g){var m;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===o&&(o=1),void 0===a&&(a=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===d&&(d=0),void 0===f&&(f=0),void 0===p&&(p=0),void 0===g&&(g=1),m=t.call(this)||this,"object"==typeof e?(m.m00=e.m00,m.m01=e.m01,m.m02=e.m02,m.m03=e.m03,m.m04=e.m04,m.m05=e.m05,m.m06=e.m06,m.m07=e.m07,m.m08=e.m08,m.m09=e.m09,m.m10=e.m10,m.m11=e.m11,m.m12=e.m12,m.m13=e.m13,m.m14=e.m14,m.m15=e.m15):(m.m00=e,m.m01=i,m.m02=n,m.m03=r,m.m04=s,m.m05=o,m.m06=a,m.m07=h,m.m08=u,m.m09=c,m.m10=l,m.m11=_,m.m12=d,m.m13=f,m.m14=p,m.m15=g),m}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,o,a,h,u,c,l,_,d,f,p,g){return t.m00=e,t.m01=i,t.m02=n,t.m03=r,t.m04=s,t.m05=o,t.m06=a,t.m07=h,t.m08=u,t.m09=c,t.m10=l,t.m11=_,t.m12=d,t.m13=f,t.m14=p,t.m15=g,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,o=e.m07,a=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=o,t.m14=a}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,o=e.m04,a=e.m05,h=e.m06,u=e.m07,c=e.m08,l=e.m09,_=e.m10,d=e.m11,f=e.m12,p=e.m13,g=e.m14,m=e.m15,v=i*a-n*o,y=i*h-r*o,T=i*u-s*o,E=n*h-r*a,S=n*u-s*a,A=r*u-s*h,b=c*p-l*f,C=c*g-_*f,R=c*m-d*f,w=l*g-_*p,I=l*m-d*p,x=_*m-d*g,D=v*x-y*I+T*w+E*R-S*C+A*b;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.m09=0,t.m10=0,t.m11=0,t.m12=0,t.m13=0,t.m14=0,t.m15=0,t):(D=1/D,t.m00=(a*x-h*I+u*w)*D,t.m01=(r*I-n*x-s*w)*D,t.m02=(p*A-g*S+m*E)*D,t.m03=(_*S-l*A-d*E)*D,t.m04=(h*R-o*x-u*C)*D,t.m05=(i*x-r*R+s*C)*D,t.m06=(g*T-f*A-m*y)*D,t.m07=(c*A-_*T+d*y)*D,t.m08=(o*I-a*R+u*b)*D,t.m09=(n*R-i*I-s*b)*D,t.m10=(f*S-p*T+m*v)*D,t.m11=(l*T-c*S-d*v)*D,t.m12=(a*C-o*w-h*b)*D,t.m13=(i*w-n*C+r*b)*D,t.m14=(p*y-f*E-g*v)*D,t.m15=(c*E-l*y+_*v)*D,t)},e.determinant=function(t){var e=t.m00,i=t.m01,n=t.m02,r=t.m03,s=t.m04,o=t.m05,a=t.m06,h=t.m07,u=t.m08,c=t.m09,l=t.m10,_=t.m11,d=t.m12,f=t.m13,p=t.m14,g=t.m15;return(e*o-i*s)*(l*g-_*p)-(e*a-n*s)*(c*g-_*f)+(e*h-r*s)*(c*p-l*f)+(i*a-n*o)*(u*g-_*d)-(i*h-r*o)*(u*p-l*d)+(n*h-r*a)*(u*f-c*d)},e.multiply=function(t,e,i){var n=e.m00,r=e.m01,s=e.m02,o=e.m03,a=e.m04,h=e.m05,u=e.m06,c=e.m07,l=e.m08,_=e.m09,d=e.m10,f=e.m11,p=e.m12,g=e.m13,m=e.m14,v=e.m15,y=i.m00,T=i.m01,E=i.m02,S=i.m03;return t.m00=y*n+T*a+E*l+S*p,t.m01=y*r+T*h+E*_+S*g,t.m02=y*s+T*u+E*d+S*m,t.m03=y*o+T*c+E*f+S*v,y=i.m04,T=i.m05,E=i.m06,S=i.m07,t.m04=y*n+T*a+E*l+S*p,t.m05=y*r+T*h+E*_+S*g,t.m06=y*s+T*u+E*d+S*m,t.m07=y*o+T*c+E*f+S*v,y=i.m08,T=i.m09,E=i.m10,S=i.m11,t.m08=y*n+T*a+E*l+S*p,t.m09=y*r+T*h+E*_+S*g,t.m10=y*s+T*u+E*d+S*m,t.m11=y*o+T*c+E*f+S*v,y=i.m12,T=i.m13,E=i.m14,S=i.m15,t.m12=y*n+T*a+E*l+S*p,t.m13=y*r+T*h+E*_+S*g,t.m14=y*s+T*u+E*d+S*m,t.m15=y*o+T*c+E*f+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 o=e.m00,a=e.m01,h=e.m02,u=e.m03,c=e.m04,l=e.m05,_=e.m06,d=e.m07,f=e.m08,p=e.m09,g=e.m10,m=e.m11;t.m00=o,t.m01=a,t.m02=h,t.m03=u,t.m04=c,t.m05=l,t.m06=_,t.m07=d,t.m08=f,t.m09=p,t.m10=g,t.m11=m,t.m12=o*n+c*r+f*s+e.m12,t.m13=a*n+l*r+p*s+e.m13,t.m14=h*n+_*r+g*s+e.m14,t.m15=u*n+d*r+m*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,o=n.z,a=Math.sqrt(r*r+s*s+o*o);if(Math.abs(a)<xi)return null;r*=a=1/a,s*=a,o*=a;var h=Math.sin(i),u=Math.cos(i),c=1-u,l=e.m00,_=e.m01,d=e.m02,f=e.m03,p=e.m04,g=e.m05,m=e.m06,v=e.m07,y=e.m08,T=e.m09,E=e.m10,S=e.m11,A=r*r*c+u,b=s*r*c+o*h,C=o*r*c-s*h,R=r*s*c-o*h,w=s*s*c+u,I=o*s*c+r*h,x=r*o*c+s*h,D=s*o*c-r*h,O=o*o*c+u;return t.m00=l*A+p*b+y*C,t.m01=_*A+g*b+T*C,t.m02=d*A+m*b+E*C,t.m03=f*A+v*b+S*C,t.m04=l*R+p*w+y*I,t.m05=_*R+g*w+T*I,t.m06=d*R+m*w+E*I,t.m07=f*R+v*w+S*I,t.m08=l*x+p*D+y*O,t.m09=_*x+g*D+T*O,t.m10=d*x+m*D+E*O,t.m11=f*x+v*D+S*O,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,o=e.m05,a=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=o*r+c*n,t.m06=a*r+l*n,t.m07=h*r+_*n,t.m08=u*r-s*n,t.m09=c*r-o*n,t.m10=l*r-a*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,o=e.m01,a=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=o*r-c*n,t.m02=a*r-l*n,t.m03=h*r-_*n,t.m08=s*n+u*r,t.m09=o*n+c*r,t.m10=a*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,o=e.m01,a=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=o*r+c*n,t.m02=a*r+l*n,t.m03=h*r+_*n,t.m04=u*r-s*n,t.m05=c*r-o*n,t.m06=l*r-a*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,o=Math.sqrt(n*n+r*r+s*s);if(Math.abs(o)<xi)return null;n*=o=1/o,r*=o,s*=o;var a=Math.sin(e),h=Math.cos(e),u=1-h;return t.m00=n*n*u+h,t.m01=r*n*u+s*a,t.m02=s*n*u-r*a,t.m03=0,t.m04=n*r*u-s*a,t.m05=r*r*u+h,t.m06=s*r*u+n*a,t.m07=0,t.m08=n*s*u+r*a,t.m09=r*s*u-n*a,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,o=e.w,a=n+n,h=r+r,u=s+s,c=n*a,l=n*h,_=n*u,d=r*h,f=r*u,p=s*u,g=o*a,m=o*h,v=o*u;return t.m00=1-(d+p),t.m01=l+v,t.m02=_-m,t.m03=0,t.m04=l-v,t.m05=1-(c+p),t.m06=f+g,t.m07=0,t.m08=_+m,t.m09=f-g,t.m10=1-(c+d),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=kn.m00=e.m00,n=kn.m01=e.m01,r=kn.m02=e.m02,s=kn.m03=e.m04,o=kn.m04=e.m05,a=kn.m05=e.m06,h=kn.m06=e.m08,u=kn.m07=e.m09,c=kn.m08=e.m10;return t.x=Math.sqrt(i*i+n*n+r*r),t.y=Math.sqrt(s*s+o*o+a*a),t.z=Math.sqrt(h*h+u*u+c*c),Sn.determinant(kn)<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,i,n,r){e.toSRT(t,i,n,r)},e.toSRT=function(t,e,i,n){i&&_n.set(i,t.m12,t.m13,t.m14);var r=_n.set(Fn,t.m00,t.m01,t.m02).length(),s=_n.set(Fn,t.m04,t.m05,t.m06).length(),o=_n.set(Fn,t.m08,t.m09,t.m10).length();if(n&&(n.x=r,n.y=s,n.z=o),0!==r&&0!==s&&0!==o){kn.m00=t.m00/r,kn.m01=t.m01/r,kn.m02=t.m02/r,kn.m03=t.m04/s,kn.m04=t.m05/s,kn.m05=t.m06/s,kn.m06=t.m08/o,kn.m07=t.m09/o,kn.m08=t.m10/o;var a=Sn.determinant(kn);n&&a<0&&(n.x*=-1),e&&(a<0&&(kn.m00*=-1,kn.m01*=-1,kn.m02*=-1),Rn.fromMat3(e,kn))}else e&&Rn.identity(e)},e.toEuler=function(t,e){return Sn.set(kn,t.m00,t.m01,t.m02,t.m04,t.m05,t.m06,t.m08,t.m09,t.m10),Sn.toEuler(kn,e)},e.fromRTS=function(t,i,n,r){return e.fromSRT(t,i,n,r)},e.fromSRT=function(t,e,i,n){var r=e.x,s=e.y,o=e.z,a=e.w,h=r+r,u=s+s,c=o+o,l=r*h,_=r*u,d=r*c,f=s*u,p=s*c,g=o*c,m=a*h,v=a*u,y=a*c,T=n.x,E=n.y,S=n.z;return t.m00=(1-(f+g))*T,t.m01=(_+y)*T,t.m02=(d-v)*T,t.m03=0,t.m04=(_-y)*E,t.m05=(1-(l+g))*E,t.m06=(p+m)*E,t.m07=0,t.m08=(d+v)*S,t.m09=(p-m)*S,t.m10=(1-(l+f))*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,o=e.y,a=e.z,h=e.w,u=s+s,c=o+o,l=a+a,_=s*u,d=s*c,f=s*l,p=o*c,g=o*l,m=a*l,v=h*u,y=h*c,T=h*l,E=n.x,S=n.y,A=n.z,b=r.x,C=r.y,R=r.z;return t.m00=(1-(p+m))*E,t.m01=(d+T)*E,t.m02=(f-y)*E,t.m03=0,t.m04=(d-T)*S,t.m05=(1-(_+m))*S,t.m06=(g+v)*S,t.m07=0,t.m08=(f+y)*A,t.m09=(g-v)*A,t.m10=(1-(_+p))*A,t.m11=0,t.m12=i.x+b-(t.m00*b+t.m04*C+t.m08*R),t.m13=i.y+C-(t.m01*b+t.m05*C+t.m09*R),t.m14=i.z+R-(t.m02*b+t.m06*C+t.m10*R),t.m15=1,t},e.fromSRTOrigin=function(t,e,i,n,r){var s=e.x,o=e.y,a=e.z,h=e.w,u=s+s,c=o+o,l=a+a,_=s*u,d=s*c,f=s*l,p=o*c,g=o*l,m=a*l,v=h*u,y=h*c,T=h*l,E=n.x,S=n.y,A=n.z,b=r.x,C=r.y,R=r.z;return t.m00=(1-(p+m))*E,t.m01=(d+T)*E,t.m02=(f-y)*E,t.m03=0,t.m04=(d-T)*S,t.m05=(1-(_+m))*S,t.m06=(g+v)*S,t.m07=0,t.m08=(f+y)*A,t.m09=(g-v)*A,t.m10=(1-(_+p))*A,t.m11=0,t.m12=i.x+b-(t.m00*b+t.m04*C+t.m08*R),t.m13=i.y+C-(t.m01*b+t.m05*C+t.m09*R),t.m14=i.z+R-(t.m02*b+t.m06*C+t.m10*R),t.m15=1,t},e.fromQuat=function(t,e){var i=e.x,n=e.y,r=e.z,s=e.w,o=i+i,a=n+n,h=r+r,u=i*o,c=n*o,l=n*a,_=r*o,d=r*a,f=r*h,p=s*o,g=s*a,m=s*h;return t.m00=1-l-f,t.m01=c+m,t.m02=_-g,t.m03=0,t.m04=c-m,t.m05=1-u-f,t.m06=d+p,t.m07=0,t.m08=_+g,t.m09=d-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,o){var a=1/(i-e),h=1/(r-n),u=1/(s-o);return t.m00=2*s*a,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)*a,t.m09=(r+n)*h,t.m10=(o+s)*u,t.m11=-1,t.m12=0,t.m13=0,t.m14=o*s*2*u,t.m15=0,t},e.perspective=function(t,e,i,n,r,s,o,a,h){void 0===s&&(s=!0),void 0===o&&(o=-1),void 0===a&&(a=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)*a,d=Nn[h];return t.m00=l*d[0],t.m01=l*d[1],t.m02=0,t.m03=0,t.m04=_*d[2],t.m05=_*d[3],t.m06=0,t.m07=0,t.m08=0,t.m09=0,t.m10=(r-o*n)*c,t.m11=-1,t.m12=0,t.m13=0,t.m14=r*n*c*(1-o),t.m15=0,t},e.ortho=function(t,e,i,n,r,s,o,a,h,u){void 0===a&&(a=-1),void 0===h&&(h=1),void 0===u&&(u=0);var c=1/(e-i),l=1/(n-r)*h,_=1/(s-o),d=-2*c,f=-2*l,p=(e+i)*c,g=(r+n)*l,m=Nn[u];return t.m00=d*m[0],t.m01=d*m[1],t.m02=0,t.m03=0,t.m04=f*m[2],t.m05=f*m[3],t.m06=0,t.m07=0,t.m08=0,t.m09=0,t.m10=_*(1-a),t.m11=0,t.m12=p*m[0]+g*m[2],t.m13=p*m[1]+g*m[3],t.m14=(s-a*o)*_,t.m15=1,t},e.lookAt=function(t,e,i,n){var r=e.x,s=e.y,o=e.z,a=n.x,h=n.y,u=n.z,c=r-i.x,l=s-i.y,_=o-i.z,d=1/Math.sqrt(c*c+l*l+_*_),f=h*(_*=d)-u*(l*=d),p=u*(c*=d)-a*_,g=a*l-h*c,m=l*(g*=d=1/Math.sqrt(f*f+p*p+g*g))-_*(p*=d),v=_*(f*=d)-c*g,y=c*p-l*f;return t.m00=f,t.m01=m,t.m02=c,t.m03=0,t.m04=p,t.m05=v,t.m06=l,t.m07=0,t.m08=g,t.m09=y,t.m10=_,t.m11=0,t.m12=-(f*r+p*s+g*o),t.m13=-(m*r+v*s+y*o),t.m14=-(c*r+l*s+_*o),t.m15=1,t},e.inverseTranspose=function(t,e){var i=e.m00,n=e.m01,r=e.m02,s=e.m03,o=e.m04,a=e.m05,h=e.m06,u=e.m07,c=e.m08,l=e.m09,_=e.m10,d=e.m11,f=e.m12,p=e.m13,g=e.m14,m=e.m15,v=i*a-n*o,y=i*h-r*o,T=i*u-s*o,E=n*h-r*a,S=n*u-s*a,A=r*u-s*h,b=c*p-l*f,C=c*g-_*f,R=c*m-d*f,w=l*g-_*p,I=l*m-d*p,x=_*m-d*g,D=v*x-y*I+T*w+E*R-S*C+A*b;return D?(D=1/D,t.m00=(a*x-h*I+u*w)*D,t.m01=(h*R-o*x-u*C)*D,t.m02=(o*I-a*R+u*b)*D,t.m03=0,t.m04=(r*I-n*x-s*w)*D,t.m05=(i*x-r*R+s*C)*D,t.m06=(n*R-i*I-s*b)*D,t.m07=0,t.m08=(p*A-g*S+m*E)*D,t.m09=(g*T-f*A-m*y)*D,t.m10=(f*S-p*T+m*v)*D,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=xi),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,o,a,h,u,c,l,_,d,f,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===o&&(o=0),void 0===a&&(a=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===d&&(d=0),void 0===f&&(f=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=o,this.m07=a,this.m08=h,this.m09=u,this.m10=c,this.m11=l,this.m12=_,this.m13=d,this.m14=f,this.m15=p,this.m00=t),this},i.equals=function(t,e){return void 0===e&&(e=xi),!(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,o=this.m06,a=this.m07,h=this.m08,u=this.m09,c=this.m10,l=this.m11,_=this.m12,d=this.m13,f=this.m14,p=this.m15,g=t*s-e*r,m=t*o-i*r,v=t*a-n*r,y=e*o-i*s,T=e*a-n*s,E=i*a-n*o,S=h*d-u*_,A=h*f-c*_,b=h*p-l*_,C=u*f-c*d,R=u*p-l*d,w=c*p-l*f,I=g*w-m*R+v*C+y*b-T*A+E*S;return 0===I?(this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),this):(I=1/I,this.m00=(s*w-o*R+a*C)*I,this.m01=(i*R-e*w-n*C)*I,this.m02=(d*E-f*T+p*y)*I,this.m03=(c*T-u*E-l*y)*I,this.m04=(o*b-r*w-a*A)*I,this.m05=(t*w-i*b+n*A)*I,this.m06=(f*v-_*E-p*m)*I,this.m07=(h*E-c*v+l*m)*I,this.m08=(r*R-s*b+a*S)*I,this.m09=(e*b-t*R-n*S)*I,this.m10=(_*T-d*v+p*g)*I,this.m11=(u*v-h*T-l*g)*I,this.m12=(s*A-r*C-o*S)*I,this.m13=(t*C-e*A+i*S)*I,this.m14=(d*m-_*y-f*g)*I,this.m15=(h*y-u*m+c*g)*I,this)},i.determinant=function(){var t=this.m00,e=this.m01,i=this.m02,n=this.m03,r=this.m04,s=this.m05,o=this.m06,a=this.m07,h=this.m08,u=this.m09,c=this.m10,l=this.m11,_=this.m12,d=this.m13,f=this.m14,p=this.m15;return(t*s-e*r)*(c*p-l*f)-(t*o-i*r)*(u*p-l*d)+(t*a-n*r)*(u*f-c*d)+(e*o-i*s)*(h*p-l*_)-(e*a-n*s)*(h*f-c*_)+(i*a-n*o)*(h*d-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,o=this.m05,a=this.m06,h=this.m07,u=this.m08,c=this.m09,l=this.m10,_=this.m11,d=this.m12,f=this.m13,p=this.m14,g=this.m15,m=t.m00,v=t.m01,y=t.m02,T=t.m03;return this.m00=m*e+v*s+y*u+T*d,this.m01=m*i+v*o+y*c+T*f,this.m02=m*n+v*a+y*l+T*p,this.m03=m*r+v*h+y*_+T*g,m=t.m04,v=t.m05,y=t.m06,T=t.m07,this.m04=m*e+v*s+y*u+T*d,this.m05=m*i+v*o+y*c+T*f,this.m06=m*n+v*a+y*l+T*p,this.m07=m*r+v*h+y*_+T*g,m=t.m08,v=t.m09,y=t.m10,T=t.m11,this.m08=m*e+v*s+y*u+T*d,this.m09=m*i+v*o+y*c+T*f,this.m10=m*n+v*a+y*l+T*p,this.m11=m*r+v*h+y*_+T*g,m=t.m12,v=t.m13,y=t.m14,T=t.m15,this.m12=m*e+v*s+y*u+T*d,this.m13=m*i+v*o+y*c+T*f,this.m14=m*n+v*a+y*l+T*p,this.m15=m*r+v*h+y*_+T*g,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,o=this.m02,a=this.m03,h=this.m04,u=this.m05,c=this.m06,l=this.m07,_=this.m08,d=this.m09,f=this.m10,p=this.m11;return this.m12=r*e+h*i+_*n+this.m12,this.m13=s*e+u*i+d*n+this.m13,this.m14=o*e+c*i+f*n+this.m14,this.m15=a*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)<xi)return null;i*=s=1/s,n*=s,r*=s;var o=Math.sin(t),a=Math.cos(t),h=1-a,u=this.m00,c=this.m01,l=this.m02,_=this.m03,d=this.m04,f=this.m05,p=this.m06,g=this.m07,m=this.m08,v=this.m09,y=this.m10,T=this.m11,E=i*i*h+a,S=n*i*h+r*o,A=r*i*h-n*o,b=i*n*h-r*o,C=n*n*h+a,R=r*n*h+i*o,w=i*r*h+n*o,I=n*r*h-i*o,x=r*r*h+a;return this.m00=u*E+d*S+m*A,this.m01=c*E+f*S+v*A,this.m02=l*E+p*S+y*A,this.m03=_*E+g*S+T*A,this.m04=u*b+d*C+m*R,this.m05=c*b+f*C+v*R,this.m06=l*b+p*C+y*R,this.m07=_*b+g*C+T*R,this.m08=u*w+d*I+m*x,this.m09=c*w+f*I+v*x,this.m10=l*w+p*I+y*x,this.m11=_*w+g*I+T*x,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=kn.m00=this.m00,i=kn.m01=this.m01,n=kn.m02=this.m02,r=kn.m03=this.m04,s=kn.m04=this.m05,o=kn.m05=this.m06,a=kn.m06=this.m08,h=kn.m07=this.m09,u=kn.m08=this.m10;return t.x=Math.sqrt(e*e+i*i+n*n),t.y=Math.sqrt(r*r+s*s+o*o),t.z=Math.sqrt(a*a+h*h+u*u),Sn.determinant(kn)<0&&(t.x*=-1),t},i.getRotation=function(t){var e=_n.set(Fn,this.m00,this.m01,this.m02).length(),i=_n.set(Fn,this.m04,this.m05,this.m06).length(),n=_n.set(Fn,this.m08,this.m09,this.m10).length();return kn.m00=this.m00/e,kn.m01=this.m01/e,kn.m02=this.m02/e,kn.m03=this.m04/i,kn.m04=this.m05/i,kn.m05=this.m06/i,kn.m06=this.m08/n,kn.m07=this.m09/n,kn.m08=this.m10/n,Sn.determinant(kn)<0&&(kn.m00*=-1,kn.m01*=-1,kn.m02*=-1),Rn.fromMat3(t,kn)},i.fromRTS=function(t,e,i){var n=t.x,r=t.y,s=t.z,o=t.w,a=n+n,h=r+r,u=s+s,c=n*a,l=n*h,_=n*u,d=r*h,f=r*u,p=s*u,g=o*a,m=o*h,v=o*u,y=i.x,T=i.y,E=i.z;return this.m00=(1-(d+p))*y,this.m01=(l+v)*y,this.m02=(_-m)*y,this.m03=0,this.m04=(l-v)*T,this.m05=(1-(c+p))*T,this.m06=(f+g)*T,this.m07=0,this.m08=(_+m)*E,this.m09=(f-g)*E,this.m10=(1-(c+d))*E,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,o=t.w,a=n+n,h=r+r,u=s+s,c=n*a,l=n*h,_=n*u,d=r*h,f=r*u,p=s*u,g=o*a,m=o*h,v=o*u,y=i.x,T=i.y,E=i.z;return this.m00=(1-(d+p))*y,this.m01=(l+v)*y,this.m02=(_-m)*y,this.m03=0,this.m04=(l-v)*T,this.m05=(1-(c+p))*T,this.m06=(f+g)*T,this.m07=0,this.m08=(_+m)*E,this.m09=(f-g)*E,this.m10=(1-(c+d))*E,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,o=i+i,a=n+n,h=e*s,u=i*s,c=i*o,l=n*s,_=n*o,d=n*a,f=r*s,p=r*o,g=r*a;return this.m00=1-c-d,this.m01=u+g,this.m02=l-p,this.m03=0,this.m04=u-g,this.m05=1-h-d,this.m06=_+f,this.m07=0,this.m08=l+p,this.m09=_-f,this.m10=1-h-c,this.m11=0,this.m12=0,this.m13=0,this.m14=0,this.m15=1,this},e}(be));wn=Ln,Ln.IDENTITY=Object.freeze(new wn);var Bn,Fn=new _n,kn=new Sn;function Un(t,e,i,n,r,s,o,a,h,u,c,l,_,d,f,p){return new Ln(t,e,i,n,r,s,o,a,h,u,c,l,_,d,f,p)}Ti.fastDefine("cc.Mat4",Ln,{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}),m.Mat4=Ln,m.mat4=Un;var Gn,Hn=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)<xi?t.x=0:t.x=1/i,Math.abs(n)<xi?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 _n?(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*Fi()*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=xi),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=Pi(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=xi),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=xi),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=Pi(this.x,t.x,e.x),this.y=Pi(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&&q(16359),this.x*=t,this.y*=t,this},i.multiply=function(t){return"object"!=typeof t&&q(16360),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=Pi(n,-1,1),Math.acos(n)},i.signAngle=function(t){var e=this.cross(t),i=this.dot(t);return Math.atan2(e,i)},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},i.toVec3=function(){return new _n(this.x,this.y,0)},e}(be));function zn(t,e){return new Hn(t,e)}Bn=Hn,Hn.ZERO=Object.freeze(new Bn(0,0)),Hn.ONE=Object.freeze(new Bn(1,1)),Hn.NEG_ONE=Object.freeze(new Bn(-1,-1)),Hn.UNIT_X=Object.freeze(new Bn(1,0)),Hn.UNIT_Y=Object.freeze(new Bn(0,1)),Ti.fastDefine("cc.Vec2",Hn,{x:0,y:0}),m.Vec2=Hn,m.v2=zn,rt(Hn,"Vec2",[{name:"sub",newName:"subtract",target:Hn,targetName:"Vec2"},{name:"mul",newName:"multiply",target:Hn,targetName:"Vec2"},{name:"div",newName:"divide",target:Hn,targetName:"Vec2"},{name:"dist",newName:"distance",target:Hn,targetName:"Vec2"},{name:"sqrDist",newName:"squaredDistance",target:Hn,targetName:"Vec2"},{name:"mag",newName:"len",target:Hn,targetName:"Vec2"},{name:"sqrMag",newName:"lengthSqr",target:Hn,targetName:"Vec2"},{name:"scale",newName:"multiplyScalar",target:Hn,targetName:"Vec2"},{name:"exactEquals",newName:"strictEquals",target:Hn,targetName:"Vec2"}]),rt(Hn.prototype,"Vec2",[{name:"mag",newName:"length",target:Hn.prototype,targetName:"Vec2"},{name:"magSqr",newName:"lengthSqr",target:Hn.prototype,targetName:"Vec2"},{name:"scale",newName:"multiplyScalar",target:Hn.prototype,targetName:"Vec2"},{name:"exactEquals",newName:"strictEquals",target:Hn.prototype,targetName:"Vec2"}]),rt(_n,"Vec3",[{name:"sub",newName:"subtract",target:_n,targetName:"Vec3"},{name:"mul",newName:"multiply",target:_n,targetName:"Vec3"},{name:"div",newName:"divide",target:_n,targetName:"Vec3"},{name:"dist",newName:"distance",target:_n,targetName:"Vec3"},{name:"sqrDist",newName:"squaredDistance",target:_n,targetName:"Vec3"},{name:"mag",newName:"len",target:_n,targetName:"Vec3"},{name:"sqrMag",newName:"lengthSqr",target:_n,targetName:"Vec3"},{name:"scale",newName:"multiplyScalar",target:_n,targetName:"Vec3"},{name:"exactEquals",newName:"strictEquals",target:_n,targetName:"Vec3"}]),rt(_n.prototype,"Vec3",[{name:"mag",newName:"length",target:_n.prototype,targetName:"Vec3"},{name:"magSqr",newName:"lengthSqr",target:_n.prototype,targetName:"Vec3"},{name:"scale",newName:"multiplyScalar",target:_n.prototype,targetName:"Vec3"},{name:"exactEquals",newName:"strictEquals",target:_n.prototype,targetName:"Vec3"}]),rt(on,"Vec4",[{name:"sub",newName:"subtract",target:on,targetName:"Vec4"},{name:"mul",newName:"multiply",target:on,targetName:"Vec4"},{name:"div",newName:"divide",target:on,targetName:"Vec4"},{name:"dist",newName:"distance",target:on,targetName:"Vec4"},{name:"sqrDist",newName:"squaredDistance",target:on,targetName:"Vec4"},{name:"mag",newName:"len",target:on,targetName:"Vec4"},{name:"sqrMag",newName:"lengthSqr",target:on,targetName:"Vec4"},{name:"scale",newName:"multiplyScalar",target:on,targetName:"Vec4"},{name:"exactEquals",newName:"strictEquals",target:on,targetName:"Vec4"}]),rt(on.prototype,"Vec4",[{name:"mag",newName:"length",target:on.prototype,targetName:"Vec4"},{name:"magSqr",newName:"lengthSqr",target:on.prototype,targetName:"Vec4"},{name:"scale",newName:"multiplyScalar",target:on.prototype,targetName:"Vec4"},{name:"exactEquals",newName:"strictEquals",target:on.prototype,targetName:"Vec4"}]),rt(Rn,"Quat",[{name:"mag",newName:"len",target:Rn,targetName:"Quat"},{name:"mul",newName:"multiply",target:Rn,targetName:"Quat"},{name:"sqrMag",newName:"lengthSqr",target:Rn,targetName:"Quat"},{name:"scale",newName:"multiplyScalar",target:Rn,targetName:"Quat"},{name:"exactEquals",newName:"strictEquals",target:Rn,targetName:"Quat"}]),rt(Rn.prototype,"Quat",[{name:"scale",newName:"multiplyScalar",target:Rn.prototype,targetName:"Quat"},{name:"exactEquals",newName:"strictEquals",target:Rn.prototype,targetName:"Quat"}]),rt(yn,"Color",[{name:"sub",newName:"subtract",target:yn,targetName:"Color"},{name:"mul",newName:"multiply",target:yn,targetName:"Color"},{name:"div",newName:"divide",target:yn,targetName:"Color"},{name:"exactEquals",newName:"strictEquals",target:yn,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 m.Color.fromHEX(e[0],n)}}]),rt(Sn,"Mat3",[{name:"sub",newName:"subtract",target:Sn,targetName:"Mat3"},{name:"mul",newName:"multiply",target:Sn,targetName:"Mat3"},{name:"exactEquals",newName:"strictEquals",target:Sn,targetName:"Mat3"},{name:"transfrom",newName:"transform",target:Sn,targetName:"Mat3"}]),rt(Sn.prototype,"Mat3",[{name:"sub",newName:"subtract",target:Sn.prototype,targetName:"Mat3"},{name:"mul",newName:"multiply",target:Sn.prototype,targetName:"Mat3"},{name:"mulScalar",newName:"multiplyScalar",target:Sn.prototype,targetName:"Mat3"},{name:"exactEquals",newName:"strictEquals",target:Sn.prototype,targetName:"Mat3"}]),rt(Ln,"Mat4",[{name:"sub",newName:"subtract",target:Ln,targetName:"Mat4"},{name:"mul",newName:"multiply",target:Ln,targetName:"Mat4"},{name:"exactEquals",newName:"strictEquals",target:Ln,targetName:"Mat4"}]),rt(Ln.prototype,"Mat4",[{name:"sub",newName:"subtract",target:Ln.prototype,targetName:"Mat4"},{name:"mul",newName:"multiply",target:Ln.prototype,targetName:"Mat4"},{name:"mulScalar",newName:"multiplyScalar",target:Ln.prototype,targetName:"Mat4"},{name:"exactEquals",newName:"strictEquals",target:Ln.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"}(Gn||(Gn={}));var Vn,Wn=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,o=e.d,a=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+o*i.c,t.d=s*i.b+o*i.d,t.tx=a*i.a+h*i.c+i.tx,t.ty=a*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,o=i.b*e.x+i.d*e.y+i.ty,a=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,d=Math.min(s,a,u,l),f=Math.max(s,a,u,l),p=Math.min(o,h,c,_),g=Math.max(o,h,c,_);t.x=d,t.y=p,t.width=f-d,t.height=g-p},t.transformObb=function(t,e,i,n,r,s,o){void 0===o&&(o=!0);var a=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;o?(e.x=a,e.y=h,i.x=u+a,i.y=c+h,t.x=l+a,t.y=_+h,n.x=u+l+a,n.y=c+_+h):(t.x=a,t.y=h,n.x=u+a,n.y=c+h,e.x=l+a,e.y=_+h,i.x=u+l+a,i.y=c+_+h)},t}());m.AffineTransform=Wn;var Xn=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}(be));function jn(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),new Xn(t,e)}Vn=Xn,Xn.ZERO=Object.freeze(new Vn(0,0)),Xn.ONE=Object.freeze(new Vn(1,1)),Ti.fastDefine("cc.Size",Xn,{width:0,height:0}),m.size=jn,m.Size=Xn;var Yn=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),o=Math.max(e.y,i.y);return t.x=n,t.y=r,t.width=s-n,t.height=o-r,t},e.lerp=function(t,e,i,n){var r=e.x,s=e.y,o=e.width,a=e.height;return t.x=r+(i.x-r)*n,t.y=s+(i.y-s)*n,t.width=o+(i.width-o)*n,t.height=a+(i.height-a)*n,t},e.intersection=function(t,e,i){var n=e.x,r=e.y,s=e.x+e.width,o=e.y+e.height,a=i.x,h=i.y,u=i.x+i.width,c=i.y+i.height;return t.x=Math.max(n,a),t.y=Math.max(r,h),t.width=Math.min(s,u)-t.x,t.height=Math.min(o,c)-t.y,t},e.union=function(t,e,i){var n=e.x,r=e.y,s=e.width,o=e.height,a=i.x,h=i.y,u=i.width,c=i.height;return t.x=Math.min(n,a),t.y=Math.min(r,h),t.width=Math.max(n+s,a+u)-t.x,t.height=Math.max(r+o,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,o=t.m01*e+t.m05*i+t.m13,a=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,d=Math.min(s,a,u,l),f=Math.max(s,a,u,l),p=Math.min(o,h,c,_),g=Math.max(o,h,c,_);return this.x=d,this.y=p,this.width=f-d,this.height=g-p,this},i.transformMat4ToPoints=function(t,e,i,n,r){var s=this.x,o=this.y,a=s+this.width,h=o+this.height;e.x=t.m00*s+t.m04*o+t.m12,e.y=t.m01*s+t.m05*o+t.m13,r.x=t.m00*a+t.m04*o+t.m12,r.y=t.m01*a+t.m05*o+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*a+t.m04*h+t.m12,n.y=t.m01*a+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 Hn(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 Hn(this.x,this.y)},set:function(t){this.x=t.x,this.y=t.y}},{key:"size",get:function(){return new Xn(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}(be));function Kn(t,e,i,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),new Yn(t,e,i,n)}Ti.fastDefine("cc.Rect",Yn,{x:0,y:0,width:0,height:0}),m.Rect=Yn,m.rect=Kn;var qn=t("MATH_FLOAT_ARRAY",Float64Array),Qn=t("MathBase",function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.createFloatArray=function(t){return new qn(t)},n(e,[{key:"array",get:function(){return this._array}}]),e}(be)),Zn=Object.freeze({__proto__:null,bits:R,Vec2:Hn,v2:zn,Vec3:_n,v3:dn,Vec4:on,v4:an,Quat:Rn,quat:Mn,Mat3:Sn,Mat4:Ln,mat4:Un,AffineTransform:Wn,Size:Xn,size:jn,Rect:Yn,rect:Kn,Color:yn,color:Tn,preTransforms:Nn,HALF_PI:wi,TWO_PI:Ii,EPSILON:xi,equals:Di,approx:Oi,clamp:Pi,clamp01:Mi,lerp:Ni,toRadian:Li,toDegree:Bi,random:Fi,setRandGenerator:ki,randomRange:Ui,randomRangeInt:Gi,pseudoRandom:Hi,pseudoRandomRange:zi,pseudoRandomRangeInt:Vi,nextPow2:Wi,repeat:Xi,pingPong:ji,inverseLerp:Yi,absMaxComponent:Ki,absMax:qi,enumerableProps:Qi,floatToHalf:nn,halfToFloat:rn,MATH_FLOAT_ARRAY:qn,MathBase:Qn});t("math",Zn);var Jn=new _n,$n=new _n,tr=new _n,er=new _n,ir=new _n,nr=new _n,rr=new Array(3),sr=new Array(3);function or(t,e){return _n.dot(e.n,t)-e.d}function ar(t,e,i){return _n.copy(t,e),_n.subtract(ir,i.center,i.halfExtents),_n.add(nr,i.center,i.halfExtents),t.x=t.x<ir.x?ir.x:t.x,t.y=t.y<ir.y?ir.y:t.y,t.z=t.z<ir.z?ir.z:t.z,t.x=t.x>nr.x?nr.x:t.x,t.y=t.y>nr.y?nr.y:t.y,t.z=t.z>nr.z?nr.z:t.z,t}function hr(t,e,i){_n.set(Jn,i.orientation.m00,i.orientation.m01,i.orientation.m02),_n.set($n,i.orientation.m03,i.orientation.m04,i.orientation.m05),_n.set(tr,i.orientation.m06,i.orientation.m07,i.orientation.m08),rr[0]=Jn,rr[1]=$n,rr[2]=tr,sr[0]=i.halfExtents.x,sr[1]=i.halfExtents.y,sr[2]=i.halfExtents.z,_n.subtract(er,e,i.center),_n.set(t,i.center.x,i.center.y,i.center.z);for(var n=0;n<3;n++){var r=_n.dot(er,rr[n]);r>sr[n]&&(r=sr[n]),r<-sr[n]&&(r=-sr[n]),t.x+=r*rr[n].x,t.y+=r*rr[n].y,t.z+=r*rr[n].z}return t}var ur=Object.freeze({__proto__:null,point_plane:or,pt_point_plane:function(t,e,i){var n=or(e,i);return _n.subtract(t,e,_n.multiplyScalar(t,i.n,n))},pt_point_aabb:ar,pt_point_obb:hr,pt_point_line:function(t,e,i,n){_n.subtract(Jn,i,n);var r=Jn.clone(),s=_n.lengthSqr(r);if(0===s)_n.copy(t,i);else{_n.subtract(Jn,e,i);var o=_n.dot(Jn,r)/s;o<0?_n.copy(t,i):o>1?_n.copy(t,n):_n.scaleAndAdd(t,i,r,o)}}}),cr={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},lr=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=cr.SHAPE_LINE,this.s=new _n(t,e,i),this.e=new _n(n,r,s)}return t.create=function(e,i,n,r,s,o){return new t(e,i,n,r,s,o)},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 _n.copy(t.s,e.s),_n.copy(t.e,e.e),t},t.fromPoints=function(t,e,i){return _n.copy(t.s,e),_n.copy(t.e,i),t},t.set=function(t,e,i,n,r,s,o){return t.s.x=e,t.s.y=i,t.s.z=n,t.e.x=r,t.e.y=s,t.e.z=o,t},t.len=function(t){return _n.distance(t.s,t.e)},t.prototype.length=function(){return _n.distance(this.s,this.e)},n(t,[{key:"type",get:function(){return this._type}}]),t}(),_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=0),void 0===r&&(r=0),void 0===s&&(s=-1),this._type=cr.SHAPE_RAY,this.o=new _n(t,e,i),this.d=new _n(n,r,s)}return t.create=function(e,i,n,r,s,o){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===o&&(o=1),new t(e,i,n,r,s,o)},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 _n.copy(t.o,e.o),_n.copy(t.d,e.d),t},t.fromPoints=function(t,e,i){return _n.copy(t.o,e),_n.normalize(t.d,_n.subtract(t.d,i,e)),t},t.set=function(t,e,i,n,r,s,o){return t.o.x=e,t.o.y=i,t.o.z=n,t.d.x=r,t.d.y=s,t.d.z=o,t},t.prototype.computeHit=function(t,e){_n.normalize(t,this.d),_n.scaleAndAdd(t,this.o,t,e)},n(t,[{key:"type",get:function(){return this._type}}]),t}(),dr=new _n,fr=new _n,pr=new _n,gr=new _n;function mr(t){return Math.max(Math.max(t.x,t.y),t.z)}var vr,yr,Tr,Er,Sr,Ar=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._type=cr.SHAPE_SPHERE,this._center=new _n(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 _n.copy(t.center,e.center),t.radius=e.radius,t},t.fromPoints=function(t,e,i){return _n.multiplyScalar(t.center,_n.add(dr,e,i),.5),t.radius=.5*_n.subtract(dr,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){_n.set(t,this.center.x-this.radius,this.center.y-this.radius,this.center.z-this.radius),_n.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){_n.transformMat4(r.center,this.center,t),r.radius=this.radius*mr(n)},e.translateAndRotate=function(t,e,i){_n.transformMat4(i.center,this.center,t)},e.setScale=function(t,e){e.radius=this.radius*mr(t)},e.mergePoint=function(t){this.radius<0&&(this.center.set(t),this.radius=0),_n.subtract(fr,t,this.center);var e=fr.length();if(e>this.radius){var i=.5*(e-this.radius);this.radius+=i,_n.multiplyScalar(fr,fr,i/e),_n.add(this.center,this.center,fr)}},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(pr,gr),this.mergePoint(pr),this.mergePoint(gr)},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}(),br=function(t,e){var i=_n.dot(t.d,e.n);if(Math.abs(i)<Number.EPSILON)return 0;var n=-or(t.o,e)/i;return n<0?0:n},Cr=(vr=new _n(0,0,0),yr=new _n(0,0,0),Tr=new _n(0,0,0),Er=new _n(0,0,0),Sr=new _n(0,0,0),function(t,e,i){_n.subtract(vr,e.b,e.a),_n.subtract(yr,e.c,e.a),_n.cross(Tr,t.d,yr);var n=_n.dot(vr,Tr);if(n<Number.EPSILON&&(!i||n>-Number.EPSILON))return 0;var r=1/n;_n.subtract(Er,t.o,e.a);var s=_n.dot(Er,Tr)*r;if(s<0||s>1)return 0;_n.cross(Sr,Er,vr);var o=_n.dot(t.d,Sr)*r;if(o<0||s+o>1)return 0;var a=_n.dot(yr,Sr)*r;return a<0?0:a}),Rr=function(){var t=new _n(0,0,0);return function(e,i){var n=i.radius,r=i.center,s=e.o,o=e.d,a=n*n;_n.subtract(t,r,s);var h=t.lengthSqr(),u=_n.dot(t,o),c=a-(h-u*u);if(c<0)return 0;var l=Math.sqrt(c),_=h<a?u+l:u-l;return _<0?0:_}}(),wr=function(){var t=new _n,e=new _n;return function(i,n){return _n.subtract(t,n.center,n.halfExtents),_n.add(e,n.center,n.halfExtents),function(t,e,i){var n=t.o,r=t.d,s=1/r.x,o=1/r.y,a=1/r.z,h=(e.x-n.x)*s,u=(i.x-n.x)*s,c=(e.y-n.y)*o,l=(i.y-n.y)*o,_=(e.z-n.z)*a,d=(i.z-n.z)*a,f=Math.max(Math.max(Math.min(h,u),Math.min(c,l)),Math.min(_,d)),p=Math.min(Math.min(Math.max(h,u),Math.max(c,l)),Math.max(_,d));return p<0||f>p?0:f>0?f:p}(i,t,e)}}(),Ir=function(){var t=new _n,e=new _n,i=new _n,n=new _n,r=new _n,s=new _n,o=new _n,a=new Array(3),h=new Array(3),u=new Array(3),c=new Array(6);return function(l,_){a[0]=_.halfExtents.x,a[1]=_.halfExtents.y,a[2]=_.halfExtents.z,t=_.center,e=l.o,i=l.d,_n.set(n,_.orientation.m00,_.orientation.m01,_.orientation.m02),_n.set(r,_.orientation.m03,_.orientation.m04,_.orientation.m05),_n.set(s,_.orientation.m06,_.orientation.m07,_.orientation.m08),_n.subtract(o,t,e),h[0]=_n.dot(n,i),h[1]=_n.dot(r,i),h[2]=_n.dot(s,i),u[0]=_n.dot(n,o),u[1]=_n.dot(r,o),u[2]=_n.dot(s,o);for(var d=0;d<3;++d){if(0===h[d]){if(-u[d]-a[d]>0||-u[d]+a[d]<0)return 0;h[d]=1e-7}c[2*d+0]=(u[d]+a[d])/h[d],c[2*d+1]=(u[d]-a[d])/h[d]}var f=Math.max(Math.max(Math.min(c[0],c[1]),Math.min(c[2],c[3])),Math.min(c[4],c[5])),p=Math.min(Math.min(Math.max(c[0],c[1]),Math.max(c[2],c[3])),Math.max(c[4],c[5]));return p<0||f>p?0:f>0?f:p}}(),Dr=function(){var t=new _n,e=new _n,i=new _n,n=new _n,r=new _n,s=new _n,o=new _n,a=new Ar;return function(h,u){var c=u.ellipseCenter0,l=u.ellipseCenter1,_=_n.subtract(e,l,c);if(_.length()<xi)return a.radius=u.radius,a.center.set(u.ellipseCenter0),ds.raySphere(h,a);var d=h.o,f=_n.subtract(i,d,c),p=_n.normalize(t,h.d),g=_n.cross(n,p,_),m=g.lengthSqr();if(0===m){a.radius=u.radius;var v=_n.subtract(r,l,d);return f.lengthSqr()<v.lengthSqr()?a.center.set(c):a.center.set(l),ds.raySphere(h,a)}var y=_n.cross(r,f,_),T=_.lengthSqr(),E=2*_n.dot(g,y),S=u.radius*u.radius,A=E*E-4*m*(y.lengthSqr()-S*T);if(A<0)return 0;var b=(-E-Math.sqrt(A))/(2*m);if(b<0){a.radius=u.radius;var C=_n.subtract(s,l,d);return f.lengthSqr()<C.lengthSqr()?a.center.set(u.ellipseCenter0):a.center.set(u.ellipseCenter1),ds.raySphere(h,a)}var R=_n.scaleAndAdd(s,h.o,p,b),w=_n.subtract(o,R,c),I=_n.dot(w,_)/T;return I>=0&&I<=1?b:I<0?(a.radius=u.radius,a.center.set(u.ellipseCenter0),ds.raySphere(h,a)):I>1?(a.radius=u.radius,a.center.set(u.ellipseCenter1),ds.raySphere(h,a)):0}}(),Or=function(){var t=new _n(0,0,0);return function(e,i){_n.subtract(t,e.e,e.s);var n=-or(e.s,i)/_n.dot(t,i.n);return n<0||n>1?0:n}}(),Pr=function(){var t=new _n(0,0,0),e=new _n(0,0,0),i=new _n(0,0,0),n=new _n(0,0,0),r=new _n(0,0,0),s=new _n(0,0,0);return function(o,a,h){_n.subtract(t,a.b,a.a),_n.subtract(e,a.c,a.a),_n.subtract(i,o.s,o.e),_n.cross(r,t,e);var u=_n.dot(i,r);if(u<=0)return 0;_n.subtract(n,o.s,a.a);var c=_n.dot(n,r);if(c<0||c>u)return 0;_n.cross(s,i,n);var l=_n.dot(e,s);if(l<0||l>u)return 0;var _=-_n.dot(t,s);if(_<0||l+_>u)return 0;if(h){var d=1/u,f=1-(l*=d)-(_*=d);_n.set(h,a.a.x*f+a.b.x*l+a.c.x*_,a.a.y*f+a.b.y*l+a.c.y*_,a.a.z*f+a.b.z*l+a.c.z*_)}return 1}}(),Mr=new _r;function Nr(t,e){Mr.o.set(t.s),_n.subtract(Mr.d,t.e,t.s),Mr.d.normalize();var i=wr(Mr,e);return i<=t.length()?i:0}function Lr(t,e){Mr.o.set(t.s),_n.subtract(Mr.d,t.e,t.s),Mr.d.normalize();var i=Ir(Mr,e);return i<=t.length()?i:0}function Br(t,e){Mr.o.set(t.s),_n.subtract(Mr.d,t.e,t.s),Mr.d.normalize();var i=Rr(Mr,e);return i<=t.length()?i:0}var Fr,kr,Ur,Gr,Hr=(Fr=new _n,kr=new _n,Ur=new _n,Gr=new _n,function(t,e){return _n.subtract(Fr,t.center,t.halfExtents),_n.add(kr,t.center,t.halfExtents),_n.subtract(Ur,e.center,e.halfExtents),_n.add(Gr,e.center,e.halfExtents),Fr.x<=Gr.x&&kr.x>=Ur.x&&Fr.y<=Gr.y&&kr.y>=Ur.y&&Fr.z<=Gr.z&&kr.z>=Ur.z});function zr(t,e,i,n,r,s){_n.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),_n.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),_n.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),_n.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),_n.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),_n.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),_n.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),_n.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 Vr(t,e){for(var i=_n.dot(e,t[0]),n=i,r=1;r<8;++r){var s=_n.dot(e,t[r]);i=s<i?s:i,n=s>n?s:n}return[i,n]}var Wr,Xr,jr,Yr,Kr,qr=function(){for(var t=new Array(15),e=0;e<15;e++)t[e]=new _n(0,0,0);for(var i=new Array(8),n=new Array(8),r=0;r<8;r++)i[r]=new _n(0,0,0),n[r]=new _n(0,0,0);var s=new _n,o=new _n;return function(e,r){_n.set(t[0],1,0,0),_n.set(t[1],0,1,0),_n.set(t[2],0,0,1),_n.set(t[3],r.orientation.m00,r.orientation.m01,r.orientation.m02),_n.set(t[4],r.orientation.m03,r.orientation.m04,r.orientation.m05),_n.set(t[5],r.orientation.m06,r.orientation.m07,r.orientation.m08);for(var a=0;a<3;++a)_n.cross(t[6+3*a],t[a],t[3]),_n.cross(t[7+3*a],t[a],t[4]),_n.cross(t[7+3*a],t[a],t[5]);_n.subtract(s,e.center,e.halfExtents),_n.add(o,e.center,e.halfExtents),function(t,e,i){_n.set(i[0],t.x,e.y,e.z),_n.set(i[1],t.x,e.y,t.z),_n.set(i[2],t.x,t.y,e.z),_n.set(i[3],t.x,t.y,t.z),_n.set(i[4],e.x,e.y,e.z),_n.set(i[5],e.x,e.y,t.z),_n.set(i[6],e.x,t.y,e.z),_n.set(i[7],e.x,t.y,t.z)}(s,o,i),zr(r.center,r.halfExtents,t[3],t[4],t[5],n);for(var h=0;h<15;++h){var u=Vr(i,t[h]),c=Vr(n,t[h]);if(c[0]>u[1]||u[0]>c[1])return 0}return 1}}(),Qr=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=_n.dot(e.n,t.center);return n+i<e.d?-1:n-i>e.d?0:1},Zr=function(t,e){for(var i=0;i<e.planes.length;i++)if(-1===Qr(t,e.planes[i]))return 0;return 1},Jr=function(){for(var t=new Array(8),e=0,i=0,n=0;n<t.length;n++)t[n]=new _n(0,0,0);return function(n,r){for(var s=0,o=!1,a=0;a<r.planes.length;a++){if(-1===(s=Qr(n,r.planes[a])))return 0;1===s&&(o=!0)}if(!o)return 1;for(var h=0;h<r.vertices.length;h++)_n.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}}(),$r=(Wr=new _n(0,0,0),Xr=new Sn,function(t,e){return _n.subtract(Wr,e,t.center),_n.transformMat3(Wr,Wr,Sn.transpose(Xr,t.orientation)),i=Wr,n=t.halfExtents,Math.abs(i.x)<n.x&&Math.abs(i.y)<n.y&&Math.abs(i.z)<n.z;var i,n}),ts=(jr=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*jr(e.n,t.orientation.m00,t.orientation.m01,t.orientation.m02)+t.halfExtents.y*jr(e.n,t.orientation.m03,t.orientation.m04,t.orientation.m05)+t.halfExtents.z*jr(e.n,t.orientation.m06,t.orientation.m07,t.orientation.m08),n=_n.dot(e.n,t.center);return n+i<e.d?-1:n-i>e.d?0:1}),es=function(t,e){for(var i=0;i<e.planes.length;i++)if(-1===ts(t,e.planes[i]))return 0;return 1},is=function(){for(var t=new Array(8),e=0,i=0,n=0,r=0;r<t.length;r++)t[r]=new _n(0,0,0);var s=function(t,e,i,n){return t.x*e+t.y*i+t.z*n};return function(r,o){for(var a=0,h=!1,u=0;u<o.planes.length;u++){if(-1===(a=ts(r,o.planes[u])))return 0;1===a&&(h=!0)}if(!h)return 1;for(var c=0;c<o.vertices.length;c++)_n.subtract(t[c],o.vertices[c],r.center);i=0,n=0;for(var l=0;l<o.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===o.vertices.length||n===o.vertices.length)return 0;i=0,n=0;for(var _=0;_<o.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===o.vertices.length||n===o.vertices.length)return 0;i=0,n=0;for(var d=0;d<o.vertices.length;d++)(e=s(t[d],r.orientation.m06,r.orientation.m07,r.orientation.m08))>r.halfExtents.z?i++:e<-r.halfExtents.z&&n++;return i===o.vertices.length||n===o.vertices.length?0:1}}(),ns=function(){for(var t=new Array(15),e=0;e<15;e++)t[e]=new _n(0,0,0);for(var i=new Array(8),n=new Array(8),r=0;r<8;r++)i[r]=new _n(0,0,0),n[r]=new _n(0,0,0);return function(e,r){_n.set(t[0],e.orientation.m00,e.orientation.m01,e.orientation.m02),_n.set(t[1],e.orientation.m03,e.orientation.m04,e.orientation.m05),_n.set(t[2],e.orientation.m06,e.orientation.m07,e.orientation.m08),_n.set(t[3],r.orientation.m00,r.orientation.m01,r.orientation.m02),_n.set(t[4],r.orientation.m03,r.orientation.m04,r.orientation.m05),_n.set(t[5],r.orientation.m06,r.orientation.m07,r.orientation.m08);for(var s=0;s<3;++s)_n.cross(t[6+3*s],t[s],t[3]),_n.cross(t[7+3*s],t[s],t[4]),_n.cross(t[8+3*s],t[s],t[5]);zr(e.center,e.halfExtents,t[0],t[1],t[2],i),zr(r.center,r.halfExtents,t[3],t[4],t[5],n);for(var o=0;o<15;++o){var a=Vr(i,t[o]),h=Vr(n,t[o]);if(h[0]>a[1]||a[0]>h[1])return 0}return 1}}(),rs=function(){for(var t=new Ar,e=new _n,i=new _n,n=new _n,r=new Array(8),s=0;s<8;s++)r[s]=new _n;for(var o=new Array(8),a=0;a<8;a++)o[a]=new _n;return function(s,a){if(0===_n.squaredDistance(a.ellipseCenter0,a.ellipseCenter1))return t.radius=a.radius,t.center.set(a.ellipseCenter0),ds.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,zr(s.center,s.halfExtents,e,i,n,r);var h=o,u=_n.copy(h[0],e),c=_n.copy(h[1],i),l=_n.copy(h[2],n);_n.subtract(h[3],a.center,s.center).normalize();var _=_n.subtract(h[4],a.ellipseCenter0,a.ellipseCenter1);_.normalize(),_n.cross(h[5],u,_),_n.cross(h[6],c,_),_n.cross(h[7],l,_);for(var d=0;d<8;++d){var f=Vr(r,h[d]),p=_n.dot(h[d],a.ellipseCenter0),g=_n.dot(h[d],a.ellipseCenter1),m=Math.max(p,g),v=Math.min(p,g)-a.radius,y=m+a.radius;if(v>f[1]||f[0]>y)return 0}return 1}}(),ss=function(t,e){var i=_n.dot(e.n,t.center),n=t.radius*e.n.length();return i+n<e.d?-1:i-n>e.d?0:1},os=function(t,e){for(var i=0;i<e.planes.length;i++)if(-1===ss(t,e.planes[i]))return 0;return 1},as=(Yr=new _n(0,0,0),Kr=[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,o=n.n,a=n.d,h=_n.dot(o,s);if(h+r<a)return 0;if(!(h-r>a)){_n.add(Yr,s,_n.multiplyScalar(Yr,o,r));for(var u=0;u<6;u++)if(u!==i&&u!==i+Kr[i]){var c=e.planes[u];if(_n.dot(c.n,Yr)<c.d)return 0}}}return 1}),hs=function(t,e){var i=t.radius+e.radius;return _n.squaredDistance(t.center,e.center)<i*i},us=function(){var t=new _n;return function(e,i){return ar(t,e.center,i),_n.squaredDistance(e.center,t)<e.radius*e.radius}}(),cs=function(){var t=new _n;return function(e,i){return hr(t,e.center,i),_n.squaredDistance(e.center,t)<e.radius*e.radius}}(),ls=function(){var t=new _n,e=new _n;return function(i,n){var r=i.radius+n.radius,s=r*r,o=_n.squaredDistance(n.ellipseCenter0,n.ellipseCenter1);if(0===o)return _n.squaredDistance(i.center,n.center)<s;_n.subtract(t,i.center,n.ellipseCenter0),_n.subtract(e,n.ellipseCenter1,n.ellipseCenter0);var a=_n.dot(t,e)/o;return a<0?_n.squaredDistance(i.center,n.ellipseCenter0)<s:a>1?_n.squaredDistance(i.center,n.ellipseCenter1)<s:(_n.scaleAndAdd(t,n.ellipseCenter0,e,a),_n.squaredDistance(i.center,t)<s)}}(),_s=function(){var t=new _n,e=new _n,i=new _n,n=new _n,r=new _n,s=new _n;return function(o,a){var h,u,c=_n.subtract(t,o.ellipseCenter1,o.ellipseCenter0),l=_n.subtract(e,a.ellipseCenter1,a.ellipseCenter0),_=_n.subtract(i,o.ellipseCenter0,a.ellipseCenter0),d=_n.dot(c,c),f=_n.dot(c,l),p=_n.dot(l,l),g=_n.dot(c,_),m=_n.dot(l,_),v=d*p-f*f,y=v,T=v;v<xi?(h=0,y=1,u=m,T=p):(u=d*m-f*g,(h=f*m-p*g)<0?(h=0,u=m,T=p):h>y&&(h=y,u=m+f,T=p)),u<0?(u=0,-g<0?h=0:-g>d?h=y:(h=-g,y=d)):u>T&&(u=T,-g+f<0?h=0:-g+f>d?h=y:(h=-g+f,y=d));var E=Math.abs(h)<xi?0:h/y,S=Math.abs(u)<xi?0:u/T,A=n;A.set(_),A.add(_n.multiplyScalar(r,c,E)),A.subtract(_n.multiplyScalar(s,l,S));var b=o.radius+a.radius;return A.lengthSqr()<b*b}}(),ds={raySphere:Rr,rayAABB:wr,rayOBB:Ir,rayPlane:br,rayTriangle:Cr,rayCapsule:Dr,raySubMesh:null,rayMesh:null,rayModel:null,lineSphere:Br,lineAABB:Nr,lineOBB:Lr,linePlane:Or,lineTriangle:Pr,sphereWithSphere:hs,sphereAABB:us,sphereOBB:cs,spherePlane:ss,sphereFrustum:os,sphereFrustumAccurate:as,sphereCapsule:ls,aabbWithAABB:Hr,aabbWithOBB:qr,aabbPlane:Qr,aabbFrustum:Zr,aabbFrustumAccurate:Jr,obbWithOBB:ns,obbPlane:ts,obbFrustum:es,obbFrustumAccurate:is,obbPoint:$r,obbCapsule:rs,aabbFrustumCompletelyInside:function(t,e){for(var i=0;i<e.planes.length;i++)if(0!==Qr(t,e.planes[i]))return 0;return 1},capsuleWithCapsule:_s,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)}};ds[cr.SHAPE_RAY|cr.SHAPE_SPHERE]=Rr,ds[cr.SHAPE_RAY|cr.SHAPE_AABB]=wr,ds[cr.SHAPE_RAY|cr.SHAPE_OBB]=Ir,ds[cr.SHAPE_RAY|cr.SHAPE_PLANE]=br,ds[cr.SHAPE_RAY|cr.SHAPE_TRIANGLE]=Cr,ds[cr.SHAPE_RAY|cr.SHAPE_CAPSULE]=Dr,ds[cr.SHAPE_LINE|cr.SHAPE_SPHERE]=Br,ds[cr.SHAPE_LINE|cr.SHAPE_AABB]=Nr,ds[cr.SHAPE_LINE|cr.SHAPE_OBB]=Lr,ds[cr.SHAPE_LINE|cr.SHAPE_PLANE]=Or,ds[cr.SHAPE_LINE|cr.SHAPE_TRIANGLE]=Pr,ds[cr.SHAPE_SPHERE]=hs,ds[cr.SHAPE_SPHERE|cr.SHAPE_AABB]=us,ds[cr.SHAPE_SPHERE|cr.SHAPE_OBB]=cs,ds[cr.SHAPE_SPHERE|cr.SHAPE_PLANE]=ss,ds[cr.SHAPE_SPHERE|cr.SHAPE_FRUSTUM]=os,ds[cr.SHAPE_SPHERE|cr.SHAPE_FRUSTUM_ACCURATE]=as,ds[cr.SHAPE_SPHERE|cr.SHAPE_CAPSULE]=ls,ds[cr.SHAPE_AABB]=Hr,ds[cr.SHAPE_AABB|cr.SHAPE_OBB]=qr,ds[cr.SHAPE_AABB|cr.SHAPE_PLANE]=Qr,ds[cr.SHAPE_AABB|cr.SHAPE_FRUSTUM]=Zr,ds[cr.SHAPE_AABB|cr.SHAPE_FRUSTUM_ACCURATE]=Jr,ds[cr.SHAPE_OBB]=ns,ds[cr.SHAPE_OBB|cr.SHAPE_PLANE]=ts,ds[cr.SHAPE_OBB|cr.SHAPE_FRUSTUM]=es,ds[cr.SHAPE_OBB|cr.SHAPE_FRUSTUM_ACCURATE]=is,ds[cr.SHAPE_OBB|cr.SHAPE_CAPSULE]=rs,ds[cr.SHAPE_CAPSULE]=_s,rt(lr.prototype,"line",[{name:"mag",newName:"len"},{name:"magnitude",newName:"len"}]),st(ds,"intersect",[{name:"line_quad"}]);var fs,ps,gs,ms,vs,ys,Ts,Es=new _n(0,0,0),Ss=new _n(0,0,0),As=m.mat4(),bs=m.v4(),Cs=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._type=cr.SHAPE_PLANE,this.n=new _n(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 _n.copy(t.n,e.n),t.d=e.d,t},t.fromPoints=function(t,e,i,n){return _n.subtract(Es,i,e),_n.subtract(Ss,n,e),_n.normalize(t.n,_n.cross(t.n,Es,Ss)),t.d=_n.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 _n.copy(t.n,e),t.d=_n.dot(e,i),t},t.normalize=function(t,e){var i=e.n.length();return _n.normalize(t.n,e.n),i>0&&(t.d=e.d/i),t},t.prototype.transform=function(t){Ln.invert(As,t),Ln.transpose(As,As),on.set(bs,this.n.x,this.n.y,this.n.z,-this.d),on.transformMat4(bs,bs,As),_n.set(this.n,bs.x,bs.y,bs.z),this.d=-bs.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}(),Rs=function(){function t(t,e,i,n,r,s,o,a,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===o&&(o=0),void 0===a&&(a=1),void 0===h&&(h=0),this._type=cr.SHAPE_TRIANGLE,this.a=new _n(t,e,i),this.b=new _n(n,r,s),this.c=new _n(o,a,h)}return t.create=function(e,i,n,r,s,o,a,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===o&&(o=0),void 0===a&&(a=0),void 0===h&&(h=0),void 0===u&&(u=1),new t(e,i,n,r,s,o,a,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 _n.copy(t.a,e.a),_n.copy(t.b,e.b),_n.copy(t.c,e.c),t},t.fromPoints=function(t,e,i,n){return _n.copy(t.a,e),_n.copy(t.b,i),_n.copy(t.c,n),t},t.set=function(t,e,i,n,r,s,o,a,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=o,t.c.x=a,t.c.y=h,t.c.z=u,t},n(t,[{key:"type",get:function(){return this._type}}]),t}();gt({replaceProperty:{since:"3.6.0",removed:!1},removeProperty:{since:"3.6.0",removed:!1},markAsWarning:{since:"3.6.0",removed:!1},setDefaultLogTimes:{since:"3.6.0",removed:!1}});var ws,Is,xs={};ws=xs,Is=wx,Object.keys(Is).forEach((function(t){"function"!=typeof Is[t]?ws[t]=Is[t]:ws[t]=Is[t].bind(Is)})),xs.wx={},xs.wx.onKeyDown=null===(fs=wx.onKeyDown)||void 0===fs?void 0:fs.bind(wx),xs.wx.onKeyUp=null===(ps=wx.onKeyUp)||void 0===ps?void 0:ps.bind(wx),xs.wx.onMouseDown=null===(gs=wx.onMouseDown)||void 0===gs?void 0:gs.bind(wx),xs.wx.onMouseMove=null===(ms=wx.onMouseMove)||void 0===ms?void 0:ms.bind(wx),xs.wx.onMouseUp=null===(vs=wx.onMouseUp)||void 0===vs?void 0:vs.bind(wx),xs.wx.onWheel=null===(ys=wx.onWheel)||void 0===ys?void 0:ys.bind(wx);var Ds,Os,Ps=wx.getSystemInfoSync();Ds=0,Os=null,Os=setInterval((function(){var t=wx.getSystemInfoSync();Ps.screenWidth===t.screenWidth&&Ps.screenHeight===t.screenHeight?++Ds>=10&&null!==Os&&(clearInterval(Os),Os=null):Ds=0,Ps=t}),500),null===(Ts=xs.onWindowResize)||void 0===Ts||Ts.call(xs,(function(){Ps=wx.getSystemInfoSync()})),xs.getSystemInfoSync=function(){return Ps};var Ms=xs.getSystemInfoSync();xs.isDevTool="devtools"===Ms.platform,Object.defineProperty(xs,"isLandscape",{get:function(){var t=wx.getSystemInfoSync();return"string"==typeof t.deviceOrientation?t.deviceOrientation.startsWith("landscape"):t.screenWidth>t.screenHeight}});var Ns,Ls,Bs,Fs,ks=Re.LANDSCAPE_RIGHT;if("android"!==Ms.platform.toLocaleLowerCase()&&wx.onDeviceOrientationChange((function(t){"landscape"===t.value?ks=Re.LANDSCAPE_RIGHT:"landscapeReverse"===t.value&&(ks=Re.LANDSCAPE_LEFT)})),Object.defineProperty(xs,"orientation",{get:function(){return xs.isLandscape?ks:Re.PORTRAIT}}),xs.onAccelerometerChange=function(t){xs.offAccelerometerChange(),Ns=function(e){var i=e.x,n=e.y;if(xs.isLandscape){var r=ks===Re.LANDSCAPE_RIGHT?1:-1,s=i;i=-n*r,n=s*r}var o={x:i,y:n,z:e.z};t(o)}},xs.offAccelerometerChange=function(){Ns&&(wx.offAccelerometerChange(Ns),Ns=void 0)},xs.startAccelerometer=function(t){Ns&&wx.onAccelerometerChange(Ns),wx.startAccelerometer(t)},xs.createInnerAudioContext=(Ls=wx,Bs={onPlay:!0,onPause:!0,onStop:!0,onSeek:!1},void 0===(Fs=!0)&&(Fs=!1),function(){var t=Ls.createInnerAudioContext();if(Bs.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&&(Fs?setTimeout(i,0):i())}})}if(Bs.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&&(Fs?setTimeout(r,0):r())}})}if(Bs.onStop){var s=t.stop,o=null;Object.defineProperty(t,"onStop",{configurable:!0,value:function(t){o=t}}),Object.defineProperty(t,"stop",{configurable:!0,value:function(){s.call(t),o&&(Fs?setTimeout(o,0):o())}})}if(Bs.onSeek){var a=t.seek,h=null;Object.defineProperty(t,"onSeeked",{configurable:!0,value:function(t){h=t}}),Object.defineProperty(t,"seek",{configurable:!0,value:function(e){a.call(t,e),h&&(Fs?setTimeout(h,0):h())}})}return t}),xs.getSafeArea=function(){return wx.getSystemInfoSync().safeArea},"windows"===Ms.platform&&function(t,e){var i=/\d+\.\d+\.\d+/;if(!i.test(t)||!i.test(e))return q(16356),0;for(var n=t.split(".").map((function(t){return Number.parseInt(t)})),r=e.split(".").map((function(t){return Number.parseInt(t)})),s=0;s<3;++s){var o=n[s],a=r[s];if(o!==a)return o-a}return 0}(Ms.SDKVersion,"2.16.0")<0){var Us=canvas;if(Us){var Gs=Us.getContext("webgl"),Hs=Gs.useProgram.bind(Gs);Gs.useProgram=function(t){t&&Hs(t)}}}var zs=function(){function t(){this._poolHandle=-1,Vs.addContainer(this)}return t.prototype.destroy=function(){Vs.removeContainer(this)},t}(),Vs=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,he(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}()),Ws=t("Pool",function(t){function e(e,i,n,r){var s;(s=t.call(this)||this)._freePool=[],s._ctor=e,s._dtor=n||null,s._elementsPerBatch=Math.max(i,1),s._shrinkThreshold=r?T(r,1):s._elementsPerBatch,s._nextAvail=s._elementsPerBatch-1;for(var o=0;o<s._elementsPerBatch;++o)s._freePool.push(e());return s}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(){var t=this._nextAvail+1;if(!(t<=this._shrinkThreshold)){var e;if(e=t>>1>=this._shrinkThreshold?t>>1:Math.floor((t-this._shrinkThreshold+1)/2),this._dtor)for(var i=this._nextAvail-e+1;i<=this._nextAvail;++i)this._dtor(this._freePool[i]);this._nextAvail-=e,this._freePool.length=this._nextAvail+1}},i.destroy=function(){var e=arguments.length>0?arguments[0]:null;e&&q(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}(zs)),Xs=t("RecyclePool",function(t){function e(e,i,n){var r;(r=t.call(this)||this)._count=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}(zs)),js=t("CachedArray",function(t){function e(e,i){var n;return(n=t.call(this)||this).length=0,n._initSize=0,n.array=new Array(e),n._initSize=e,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}(zs));t("memop",Object.freeze({__proto__:null,Pool:Ws,RecyclePool:Xs,CachedArray:js}));var Ys=t("editorExtrasTag","__editorExtras__"),Ks=[],qs=t("CCObject",function(){function t(t){void 0===t&&(t=""),this._objFlags=0,this._name=t}t._deferredDestroy=function(){for(var t=Ks.length,e=0;e<t;++e){var i=Ks[e];1&i._objFlags||i._destroyImmediate()}t===Ks.length?Ks.length=0:Ks.splice(0,t)};var e=t.prototype;return e.destroy=function(){return 1&this._objFlags?(q(5e3),!1):!(4&this._objFlags||(this._objFlags|=4,Ks.push(this),0))},e._destruct=function(){var t,e=this.constructor;Object.prototype.hasOwnProperty.call(e,"__destruct__")?t=e.__destruct__:(t=function(t,e){var i,n=t instanceof m.Node||t instanceof m.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(Ti._isCCClass(e))for(var o=m.Class.Attr.getClassAttrs(e),a=e.__props__,h=0;h<a.length;h++){var u=""+(i=a[h]);if(u in o){if(n&&"_id"===i)continue;switch(typeof o[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,e),Rt(e,"__destruct__",t,!0)),t(this)},e._destroyImmediate=function(){var t;1&this._objFlags?Z(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 Qs(t){return t instanceof qs}function Zs(t,e){return"object"==typeof t?!(!t||t._objFlags&(e?5:1)):void 0!==t}qs.prototype._deserialize=null,Ti.fastDefine("cc.Object",qs,{_name:"",_objFlags:0}),Rt(qs,"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}),m.isValid=Zs,m.Object=qs;var Js=he;function $s(){}var to=function(){function t(){this.callback=$s,this.target=void 0,this.once=!1}var e=t.prototype;return e.set=function(t,e,i){this.callback=t||$s,this.target=e,this.once=!!i},e.reset=function(){this.target=void 0,this.callback=$s,this.once=!1},e.check=function(){return!(Qs(this.target)&&!Zs(this.target,!0))},t}(),eo=new Ws((function(){return new to}),32),io=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(),eo.free(i),Js(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(),eo.free(i),Js(this.callbackInfos,e),--e)}},e.cancel=function(t){var e=this.callbackInfos[t];e&&(e.reset(),this.isInvoking?this.callbackInfos[t]=null:Js(this.callbackInfos,t),eo.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(),eo.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]||Js(this.callbackInfos,t);this.containCanceled=!1},e.clear=function(){this.cancelAll(),this.callbackInfos.length=0,this.isInvoking=!1,this.containCanceled=!1},t}(),no=new Ws((function(){return new io}),16),ro=t("CallbacksInvoker",function(){function t(){this._callbackTable=Dt(!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]=no.alloc());var s=eo.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 o=0;o<r.length;++o){var a=r[o];if(a&&a.check()&&a.callback===e&&a.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(),no.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,o=0;o<s.length;++o){var a=s[o];a&&a.target===t&&r.cancel(o)}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 o=0;o<s.length;++o){var a=s[o];if(a&&a.callback===e&&a.target===i){r.cancel(o);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 o=this._callbackTable&&this._callbackTable[t];if(o){var a=!o.isInvoking;o.isInvoking=!0;for(var h=o.callbackInfos,u=0,c=h.length;u<c;++u){var l=h[u];if(l){var _=l.callback,d=l.target;l.once&&this.off(t,_,d),l.check()?d?_.call(d,e,i,n,r,s):_(e,i,n,r,s):this.off(t,_,d)}}a&&(o.isInvoking=!1,o.containCanceled&&o.purgeCanceled())}},e.clear=function(){for(var t in this._callbackTable){var e=this._callbackTable[t];e&&(e.clear(),no.free(e),delete this._callbackTable[t])}},e._registerOffCallback=function(t){this._offCallback=t},t}());function so(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=Dt(!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=ro.prototype,n=Object.getOwnPropertyNames(i).concat(Object.getOwnPropertySymbols(i)),r=0;r<n.length;++r){var o=n[r];if(!(o in e.prototype)){var a=Object.getOwnPropertyDescriptor(i,o);a&&Object.defineProperty(e.prototype,o,a)}}return e}var oo=t("EventTarget",so((function(){})));m.EventTarget=oo;var ao,ho,uo,co,lo,_o,fo,po=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){ce(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"}(ao||(ao={})),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"}(ho||(ho={})),function(t){t[t.NONE=0]="NONE",t[t.LAN=1]="LAN",t[t.WWAN=2]="WWAN"}(uo||(uo={})),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"}(co||(co={})),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"}(lo||(lo={})),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"}(_o||(_o={})),fo=lo.WECHAT_GAME;var go=new(function(t){function e(){var e,i;(i=t.call(this)||this)._initPromise=[];var n,r=xs.getSystemInfoSync();switch(i.networkType=uo.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),r.platform.toLocaleLowerCase()){case"android":i.os=co.ANDROID;break;case"ios":i.os=co.IOS;break;case"windows":i.os=co.WINDOWS;break;case"mac":i.os=co.OSX;break;default:i.os=co.UNKNOWN}var s=r.system.toLowerCase();"android p"===s&&(s="android p 9.0");var o=/[\d.]+/.exec(s);i.osVersion=o?o[0]:s,i.osMainVersion=parseInt(i.osVersion),i.platform=fo,i.isMobile=i.os===co.ANDROID||i.os===co.IOS,i.browserType=ao.UNKNOWN,i.browserVersion="",i.isXR=!1;var a=i.os===co.WINDOWS&&!xs.isDevTool;return i._featureMap=((e={})[_o.WEBP]=!1,e[_o.IMAGE_BITMAP]=!1,e[_o.WEB_VIEW]=!1,e[_o.VIDEO_PLAYER]=!0,e[_o.SAFE_AREA]=!0,e[_o.HPE]=!1,e[_o.INPUT_TOUCH]=!a,e[_o.EVENT_KEYBOARD]=a,e[_o.EVENT_MOUSE]=a,e[_o.EVENT_TOUCH]=!0,e[_o.EVENT_ACCELEROMETER]=!a,e[_o.EVENT_GAMEPAD]=!1,e[_o.EVENT_HANDLE]=i.isXR,e[_o.EVENT_HMD]=i.isXR,e[_o.EVENT_HANDHELD]=!1,e[_o.WASM]=!0,e),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(_o.WEBP,e)}))},i._supportsWebp=function(){var t=this;return new Promise((function(e){if(t.os!==co.ANDROID)try{var i=document.createElement("img"),n=setTimeout((function(){e(!1)}),500);i.onload=function(){clearTimeout(n);var t=i.width>0&&i.height>0;e(t)},i.onerror=function(){clearTimeout(n),e(!1)},i.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA"}catch(t){e(!1)}else e(!1)}))},i._registerEvent=function(){var t=this;xs.onHide((function(){t.emit("hide")})),xs.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 xs.getBatteryInfoSync().level/100},i.triggerGC=function(){var t;null===(t=xs.triggerGC)||void 0===t||t.call(xs)},i.openURL=function(){},i.now=function(){return Date.now?Date.now():+new Date},i.restartJSVM=function(){},i.exit=function(){var t;null===(t=xs.exitMiniProgram)||void 0===t||t.call(xs)},i.close=function(){this.exit()},e}(oo)),mo=/(\.[^\.\/\?\\]*)(\?.*)?$/,vo=/((.*)(\/|\\|\\\\))?(.*?\..*$)?/,yo=/[^\.\/]+\/\.\.\//;function To(){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 o=s[r];t=(t+(""===t?"":"/")+o).replace(/(\/|\\\\)$/,"")}return t}function Eo(t){var e=mo.exec(t);return e?e[1]:""}function So(t){if(t){var e=t.lastIndexOf(".");if(-1!==e)return t.substring(0,e)}return t}function Ao(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 bo(t){var e=vo.exec(t);return e?e[2]:""}function Co(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 Ro(t,e,i){if(0===e.indexOf("."))return Co(t,e);var n=t.indexOf("?"),r="",s=i?Eo(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 wo(t){var e=t=String(t);do{e=t,t=t.replace(yo,"")}while(e.length!==t.length);return t}function Io(t){return t.replace(/[\/\\]$/,"")}function xo(){return go.os===co.WINDOWS?"\\":"/"}t("path",Object.freeze({__proto__:null,join:To,extname:Eo,mainFileName:So,basename:Ao,dirname:bo,changeExtname:Co,changeBasename:Ro,_normalize:wo,stripSep:Io,getSeperator:xo}));var Do=new _n;function Oo(t,e,i,n){n||(n=new _n),t.convertToUINode(e,i,n);var r=i.position;return n.add(r),n}function Po(t,e,i){return i||(i=new _n),t.worldToScreen(e,i),i.x/=m.view.getScaleX(),i.y/=m.view.getScaleY(),i}var Mo=t("convertUtils",{WorldNode3DToLocalNodeUI:Oo,WorldNode3DToWorldNodeUI:Po});m.pipelineUtils=Mo,rt(m.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]||Do;return n.convertToUINode(e[1],e[2],r),r.add(e[2].position),e[3]||r.clone()}}]);var No=new(function(t){function e(){var e,i;return(i=t.call(this)||this).isFrameRotated=!1,i.handleResizeEvent=!0,i._cbToUpdateFrameBuffer=void 0,i._resolutionScale=1,i._isProportionalToFrame=!1,null===(e=xs.onWindowResize)||void 0===e||e.call(xs,(function(){i.emit("window-resize",i.windowSize.width,i.windowSize.height)})),i}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 xs.getSystemInfoSync().pixelRatio}},{key:"windowSize",get:function(){var t=xs.getSystemInfoSync(),e=this.devicePixelRatio,i=t.windowWidth,n=t.windowHeight;return new Xn(i*e,n*e)},set:function(){q(1221)}},{key:"resolution",get:function(){var t=this.windowSize,e=this.resolutionScale;return new Xn(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 xs.orientation},set:function(){q(1221)}},{key:"safeAreaEdge",get:function(){var t=xs.getSafeArea(),e=this.windowSize,i=this.devicePixelRatio;return{top:t.top*i,bottom:e.height-t.bottom*i,left:t.left*i,right:e.width-t.right*i}}},{key:"isProportionalToFrame",get:function(){return this._isProportionalToFrame},set:function(){}}]),e}(oo)),Lo=function(){function t(){}var e=t.prototype;return e.init=function(){var t,e,i=null===(t=we.querySettings(Ce.Category.SCREEN,"exactFitScreen"))||void 0===t||t,n=null!==(e=we.querySettings(Ce.Category.SCREEN,"orientation"))&&void 0!==e?e:"auto",r=3===we.querySettings(Ce.Category.RENDERING,"renderMode");No.init({exactFitScreen:i,configOrientation:n,isHeadlessMode:r},(function(){var t,e=m.director;null!==(t=e.root)&&void 0!==t&&t.pipeline?e.root.pipeline.shadingScale=No.resolutionScale:q(1220)}))},e.fullScreen=function(){return No.isFullScreen},e.requestFullScreen=function(t,e,i){return arguments.length>0&&q(1400,"screen.requestFullScreen(element, onFullScreenChange?, onFullScreenError?)","screen.requestFullScreen(): Promise"),No.requestFullScreen().then((function(){null==e||e.call(document)})).catch((function(t){k(t),null==i||i.call(document)}))},e.exitFullScreen=function(){return No.exitFullScreen()},e.autoFullScreen=function(t,e){var i;null===(i=this.requestFullScreen(t,e))||void 0===i||i.catch((function(t){F(t)}))},e.disableAutoFullScreen=function(){},e.on=function(t,e,i){No.on(t,e,i)},e.once=function(t,e,i){No.once(t,e,i)},e.off=function(t,e,i){No.off(t,e,i)},n(t,[{key:"devicePixelRatio",get:function(){return No.devicePixelRatio}},{key:"windowSize",get:function(){return No.windowSize},set:function(t){No.windowSize=t}},{key:"resolution",get:function(){return No.resolution}},{key:"supportsFullScreen",get:function(){return No.supportFullScreen}}]),t}(),Bo=t("screen",new Lo);m.screen=Bo;var Fo=t("sys",{Feature:_o,hasFeature:function(t){return go.hasFeature(t)},NetworkType:uo,Language:ho,OS:co,Platform:lo,BrowserType:ao,isNative:go.isNative,isBrowser:go.isBrowser,isMobile:go.isMobile,isLittleEndian:go.isLittleEndian,platform:go.platform,language:go.language,languageCode:go.nativeLanguage,os:go.os,osVersion:go.osVersion,osMainVersion:go.osMainVersion,browserType:go.browserType,browserVersion:go.browserVersion,isXR:go.isXR,windowPixelResolution:Bo.windowSize,capabilities:{canvas:!0,opengl:!0,webp:go.hasFeature(_o.WEBP),imageBitmap:go.hasFeature(_o.IMAGE_BITMAP),touches:go.hasFeature(_o.INPUT_TOUCH),mouse:go.hasFeature(_o.EVENT_MOUSE),keyboard:go.hasFeature(_o.EVENT_KEYBOARD),accelerometer:go.hasFeature(_o.EVENT_ACCELEROMETER)},localStorage:{},getNetworkType:function(){return go.networkType},getBatteryLevel:function(){return go.getBatteryLevel()},garbageCollect:function(){go.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: "+Fo.hasFeature(_o.WEBP)+"\r\n",t+="supports bitmap: "+Fo.hasFeature(_o.IMAGE_BITMAP)+"\r\n",t+="supports touches: "+Fo.hasFeature(_o.INPUT_TOUCH)+"\r\n",t+="supports mouse: "+Fo.hasFeature(_o.EVENT_MOUSE)+"\r\n",t+="supports keyboard: "+Fo.hasFeature(_o.EVENT_KEYBOARD)+"\r\n",t+="supports accelerometer: "+Fo.hasFeature(_o.EVENT_ACCELEROMETER)+"\r\n",t+="os : "+this.os+"\r\n",t+="osVersion : "+this.osVersion+"\r\n",t+="platform : "+this.platform+"\r\n",B(t+="Using "+(m.game.renderType===m.game.RENDER_TYPE_WEBGL?"WEBGL":"CANVAS")+" renderer.\r\n")},openURL:function(t){go.openURL(t)},init:function(){var t=this;return Promise.resolve().then((function(){return go.init()})).then((function(){try{var e=Fo.localStorage=window.localStorage;e.setItem("storage",""),e.removeItem("storage"),e=null}catch(e){var i=function(){q(5200)};t.localStorage={getItem:i,setItem:i,clear:i,removeItem:i,key:i,length:0}}var n;t.__isWebIOS14OrIPadOS14Env=(Fo.os===co.IOS||Fo.os===co.OSX)&&(null===(n=GameGlobal)||void 0===n?void 0:n.isIOSHighPerformanceMode)&&/(OS 1((4\.[0-9])|(5\.[0-3])))|(Version\/1((4\.[0-9])|(5\.[0-3])))/.test(window.navigator.userAgent)}))},now:function(){return go.now()},restartVM:function(){go.restartJSVM()},getSafeAreaRect:function(t){void 0===t&&(t=!0);var e=m.view,i=No.safeAreaEdge;t&&(No.orientation===Ie.ORIENTATION_PORTRAIT?i.top<i.bottom?i.top=i.bottom:i.bottom=i.top:i.left<i.right?i.left=i.right:i.right=i.left);var n=No.windowSize,r=new Hn(i.left,i.bottom),s=new Hn(n.width-i.right,n.height-i.top);e._convertToUISpace(r),e._convertToUISpace(s);var o=r.x,a=r.y,h=s.x-r.x,u=s.y-r.y;return new Yn(o,a,h,u)}});m.sys=Fo,ot(m,"cc",[{name:"winSize",suggest:"please use view.getVisibleSize() instead."}]),ot(Fo,"sys",[{name:"capabilities",suggest:"please use sys.hasFeature() method instead."}]),rt(Fo,"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:Fo.Language,targetName:"sys.Language"}}))),rt(Fo,"sys",["UNKNOWN","IOS","ANDROID","WINDOWS","LINUX","OSX"].map((function(t){return{name:"OS_"+t,newName:t,target:Fo.OS,targetName:"sys.OS"}}))),rt(Fo,"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:Fo.BrowserType,targetName:"sys.BrowserType"}}))),rt(Fo,"sys",[{name:"BROWSER_TYPE_360",newName:"BROWSER_360",target:Fo.BrowserType,targetName:"sys.BrowserType"}]),rt(Fo,"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:Fo.Platform,targetName:"sys.Platform"}}))),rt(Fo,"sys",[{name:"IPHONE",newName:"IOS",target:Fo.Platform,targetName:"sys.Platform"},{name:"IPAD",newName:"IOS",target:Fo.Platform,targetName:"sys.Platform"}]),st(Fo,"sys",["LINUX","BLACKBERRY","NACL","EMSCRIPTEN","TIZEN","WINRT","WP8","QQ_PLAY","FB_PLAYABLE_ADS"].map((function(t){return{name:t}}))),rt(Fo,"sys",[{name:"windowPixelResolution",target:Bo,targetName:"screen",newName:"windowSize"}]),ot(Bo,"screen",[{name:"autoFullScreen",suggest:"please use screen.requestFullScreen() instead."},{name:"disableAutoFullScreen"}]);var ko=t("visibleRect",{topLeft:m.v2(0,0),topRight:m.v2(0,0),top:m.v2(0,0),bottomLeft:m.v2(0,0),bottomRight:m.v2(0,0),bottom:m.v2(0,0),center:m.v2(0,0),left:m.v2(0,0),right:m.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,o=n+e;this.topLeft.x=n,this.topLeft.y=s,this.topRight.x=o,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=o,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=o,this.right.y=r+i/2}});m.visibleRect=ko;var Uo=new _n,Go=new _n,Ho=new _n,zo=new _n,Vo=new Sn,Wo=function(t,e,i){Vo.m00=Math.abs(i.m00),Vo.m01=Math.abs(i.m01),Vo.m02=Math.abs(i.m02),Vo.m03=Math.abs(i.m04),Vo.m04=Math.abs(i.m05),Vo.m05=Math.abs(i.m06),Vo.m06=Math.abs(i.m08),Vo.m07=Math.abs(i.m09),Vo.m08=Math.abs(i.m10),_n.transformMat3(t,e,Vo)},Xo=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=cr.SHAPE_AABB,this.center=new _n(t,e,i),this.halfExtents=new _n(n,r,s)}t.create=function(e,i,n,r,s,o){return new t(e,i,n,r,s,o)},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 _n.copy(t.center,e.center),_n.copy(t.halfExtents,e.halfExtents),t},t.fromPoints=function(t,e,i){return _n.add(Uo,i,e),_n.subtract(Go,i,e),_n.multiplyScalar(t.center,Uo,.5),_n.multiplyScalar(t.halfExtents,Go,.5),t},t.set=function(t,e,i,n,r,s,o){return t.center.set(e,i,n),t.halfExtents.set(r,s,o),t},t.merge=function(e,i,n){return _n.subtract(Uo,i.center,i.halfExtents),_n.subtract(Go,n.center,n.halfExtents),_n.add(Ho,i.center,i.halfExtents),_n.add(zo,n.center,n.halfExtents),_n.max(zo,Ho,zo),_n.min(Ho,Uo,Go),t.fromPoints(e,Ho,zo)},t.toBoundingSphere=function(t,e){return t.center.set(e.center),t.radius=e.halfExtents.length(),t},t.transform=function(t,e,i){return _n.transformMat4(t.center,e.center,i),Wo(t.halfExtents,e.halfExtents,i),t};var e=t.prototype;return e.getBoundary=function(t,e){_n.subtract(t,this.center,this.halfExtents),_n.add(e,this.center,this.halfExtents)},e.transform=function(t,e,i,n,r){_n.transformMat4(r.center,this.center,t),Wo(r.halfExtents,this.halfExtents,t)},e.clone=function(){var e=this.center,i=this.halfExtents;return new t(e.x,e.y,e.z,i.x,i.y,i.z)},e.copy=function(t){return _n.copy(this.center,t.center),_n.copy(this.halfExtents,t.halfExtents),this},e.mergePoint=function(t){this.getBoundary(Uo,Go),t.x<Uo.x&&(Uo.x=t.x),t.y<Uo.y&&(Uo.y=t.y),t.z<Uo.z&&(Uo.z=t.z),t.x>Go.x&&(Go.x=t.x),t.y>Go.y&&(Go.y=t.y),t.z>Go.z&&(Go.z=t.z),_n.add(Ho,Uo,Go),this.center.set(_n.multiplyScalar(Ho,Ho,.5)),this.halfExtents.set(Go.x-Ho.x,Go.y-Ho.y,Go.z-Ho.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}(),jo=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=cr.SHAPE_CAPSULE,this.radius=t,this.halfHeight=e,this.axis=i,this.center=new _n,this.rotation=new Rn,this.ellipseCenter0=new _n(0,e,0),this.ellipseCenter1=new _n(0,-e,0),this.updateCache()}var e=t.prototype;return e.transform=function(t,e,i,n,r){var s=n,o=Ki(s);r.radius=this.radius*Math.abs(o);var a=(this.halfHeight+this.radius)*Math.abs(s.y)-r.radius;a<0&&(a=0),r.halfHeight=a,_n.transformMat4(r.center,this.center,t),Rn.multiply(r.rotation,this.rotation,i),r.updateCache()},e.updateCache=function(){this.updateLocalCenter(),_n.transformQuat(this.ellipseCenter0,this.ellipseCenter0,this.rotation),_n.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}(),Yo=new Array(8);Yo[0]=new _n(1,1,1),Yo[1]=new _n(-1,1,1),Yo[2]=new _n(-1,-1,1),Yo[3]=new _n(1,-1,1),Yo[4]=new _n(1,1,-1),Yo[5]=new _n(-1,1,-1),Yo[6]=new _n(-1,-1,-1),Yo[7]=new _n(1,-1,-1);var Ko,qo=new _n,Qo=new _n,Zo=new _n,Jo=function(){e.createOrthographic=function(t,e,i,n,r,s){var o=e/2,a=i/2;_n.set(Zo,o,a,-n),_n.transformMat4(t.vertices[0],Zo,s),_n.set(Zo,-o,a,-n),_n.transformMat4(t.vertices[1],Zo,s),_n.set(Zo,-o,-a,-n),_n.transformMat4(t.vertices[2],Zo,s),_n.set(Zo,o,-a,-n),_n.transformMat4(t.vertices[3],Zo,s),_n.set(Zo,o,a,-r),_n.transformMat4(t.vertices[4],Zo,s),_n.set(Zo,-o,a,-r),_n.transformMat4(t.vertices[5],Zo,s),_n.set(Zo,-o,-a,-r),_n.transformMat4(t.vertices[6],Zo,s),_n.set(Zo,o,-a,-r),_n.transformMat4(t.vertices[7],Zo,s),t.updatePlanes()},e.createOrtho=function(t,i,n,r,s,o){return e.createOrthographic(t,i,n,r,s,o)},e.createPerspective=function(t,e,i,n,r,s){var o=Math.tan(.5*i),a=o*e;qo.set(n*a,n*o,n),Qo.set(r*a,r*o,r);var h=t.vertices;Zo.set(qo.x,qo.y,-qo.z),_n.transformMat4(h[0],Zo,s),Zo.set(-qo.x,qo.y,-qo.z),_n.transformMat4(h[1],Zo,s),Zo.set(-qo.x,-qo.y,-qo.z),_n.transformMat4(h[2],Zo,s),Zo.set(qo.x,-qo.y,-qo.z),_n.transformMat4(h[3],Zo,s),Zo.set(Qo.x,Qo.y,-Qo.z),_n.transformMat4(h[4],Zo,s),Zo.set(-Qo.x,Qo.y,-Qo.z),_n.transformMat4(h[5],Zo,s),Zo.set(-Qo.x,-Qo.y,-Qo.z),_n.transformMat4(h[6],Zo,s),Zo.set(Qo.x,-Qo.y,-Qo.z),_n.transformMat4(h[7],Zo,s),t.updatePlanes()},e.createFromAABB=function(t,e){var i=new _n,n=new _n;return _n.subtract(i,e.center,e.halfExtents),_n.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=cr.SHAPE_FRUSTUM,this.planes=new Array(6);for(var t=0;t<6;++t)this.planes[t]=Cs.create(0,0,0,0);this.vertices=new Array(8);for(var e=0;e<8;++e)this.vertices[e]=new _n}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)Cs.copy(t.planes[i],e.planes[i]);for(var n=0;n<8;++n)_n.copy(t.vertices[n],e.vertices[n]);return t},t.update=function(t,e){_n.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),_n.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),_n.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),_n.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),_n.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),_n.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();_n.multiplyScalar(n.n,n.n,r),n.d*=r}for(var s=0;s<8;s++)_n.transformMat4(this.vertices[s],Yo[s],e)},t.transform=function(t){for(var e=0;e<8;e++)_n.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++)Cs.set(this.planes[e],0,0,0,0)},t.updatePlanes=function(){Cs.fromPoints(this.planes[0],this.vertices[1],this.vertices[6],this.vertices[5]),Cs.fromPoints(this.planes[1],this.vertices[3],this.vertices[4],this.vertices[7]),Cs.fromPoints(this.planes[2],this.vertices[6],this.vertices[3],this.vertices[7]),Cs.fromPoints(this.planes[3],this.vertices[0],this.vertices[5],this.vertices[4]),Cs.fromPoints(this.planes[4],this.vertices[2],this.vertices[0],this.vertices[3]),Cs.fromPoints(this.planes[5],this.vertices[7],this.vertices[5],this.vertices[6])},n(e,[{key:"accurate",set:function(t){this._type=t?cr.SHAPE_FRUSTUM_ACCURATE:cr.SHAPE_FRUSTUM}},{key:"type",get:function(){return this._type}}]),e}(),$o=new _n,ta=new _n,ea=new Sn,ia=function(){function t(t,e,i,n,r,s,o,a,h,u,c,l,_,d,f){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===o&&(o=1),void 0===a&&(a=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===d&&(d=0),void 0===f&&(f=1),this.center=void 0,this.halfExtents=void 0,this.orientation=void 0,this._type=void 0,this._type=cr.SHAPE_OBB,this.center=new _n(t,e,i),this.halfExtents=new _n(n,r,s),this.orientation=new Sn(o,a,h,u,c,l,_,d,f)}t.create=function(e,i,n,r,s,o,a,h,u,c,l,_,d,f,p){return new t(e,i,n,r,s,o,a,h,u,c,l,_,d,f,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 _n.copy(t.center,e.center),_n.copy(t.halfExtents,e.halfExtents),Sn.copy(t.orientation,e.orientation),t},t.fromPoints=function(t,e,i){return _n.multiplyScalar(t.center,_n.add($o,e,i),.5),_n.multiplyScalar(t.halfExtents,_n.subtract(ta,i,e),.5),Sn.identity(t.orientation),t},t.set=function(t,e,i,n,r,s,o,a,h,u,c,l,_,d,f,p){return _n.set(t.center,e,i,n),_n.set(t.halfExtents,r,s,o),Sn.set(t.orientation,a,h,u,c,l,_,d,f,p),t};var e=t.prototype;return e.getBoundary=function(t,e){!function(t,e,i){ea.m00=Math.abs(i.m00),ea.m01=Math.abs(i.m01),ea.m02=Math.abs(i.m02),ea.m03=Math.abs(i.m03),ea.m04=Math.abs(i.m04),ea.m05=Math.abs(i.m05),ea.m06=Math.abs(i.m06),ea.m07=Math.abs(i.m07),ea.m08=Math.abs(i.m08),_n.transformMat3(t,e,ea)}($o,this.halfExtents,this.orientation),_n.subtract(t,this.center,$o),_n.add(e,this.center,$o)},e.transform=function(t,e,i,n,r){_n.transformMat4(r.center,this.center,t),Sn.fromQuat(r.orientation,i),_n.multiply(r.halfExtents,this.halfExtents,n)},e.translateAndRotate=function(t,e,i){_n.transformMat4(i.center,this.center,t),Sn.fromQuat(i.orientation,e)},e.setScale=function(t,e){_n.multiply(e.halfExtents,this.halfExtents,t)},n(t,[{key:"type",get:function(){return this._type}}]),t}();function na(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 o=t[s];if(o>e+i)r=s-1;else{if(!(o<e-i))return s;n=s+1}}return~n}Ko=Symbol.iterator;var ra,sa,oa,aa=function(){function t(){this._times=[],this._values=[]}var e=t.prototype;return e[Ko]=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 na(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 na(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]||Oi(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=na(i,t);if(s>=0)return s;var o=~s;return 0===o?(i.unshift(t),n.unshift(e)):o===r?(i.push(t),n.push(e)):(i.splice(o-1,0,t),n.splice(o-1,0,e)),o},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 ha(t){return t>-1e-9&&t<1e-9}function ua(t,e,i,n){return i.slice().reverse().reduce((function(i,n){return n(t,e,i)||i}),n)}Ti.fastDefine("cc.KeyframeCurve",aa,{_times:[],_values:[]}),t("RealInterpolationMode",ra),function(t){t[t.LINEAR=0]="LINEAR",t[t.CONSTANT=1]="CONSTANT",t[t.CUBIC=2]="CUBIC"}(ra||t("RealInterpolationMode",ra={})),t("ExtrapolationMode",sa),function(t){t[t.LINEAR=0]="LINEAR",t[t.CLAMP=1]="CLAMP",t[t.LOOP=2]="LOOP",t[t.PING_PONG=3]="PING_PONG"}(sa||t("ExtrapolationMode",sa={})),t("TangentWeightMode",oa),function(t){t[t.NONE=0]="NONE",t[t.LEFT=1]="LEFT",t[t.RIGHT=2]="RIGHT",t[t.BOTH=3]="BOTH"}(oa||t("TangentWeightMode",oa={}));var ca=function(){},la=function(){return ca},_a=da((function(){}));function da(t){return function(e){return"function"==typeof e?t(e):function(i){return t(i,e)}}}function fa(t){return function(e){return function(i){!function(t,e,i){var n=ga(t);if(n){var r=ma(n,"proto");ma(r,"editor")[e]=i}}(i,t,e)}}}var pa="__ccclassCache__";function ga(t){return ma(t,pa)}function ma(t,e){return t[e]||(t[e]={})}var va=da((function(t,e){var i=Vt(t);i===Object&&(i=null);var n={name:e,extends:i,ctor:t},r=t[pa];if(r){var s=r.proto;s&&Ht(n,s),t[pa]=void 0}return Ti(n)})),ya=fa("requireComponent"),Ta=fa("executionOrder"),Ea=_a;function Sa(t,e,i){var n=null;function r(t,e,i){!function(t,e,i,n,r,s){var o,a=s&&"function"!=typeof s&&(s.get||s.set);r&&(o=ai(r,a));var h=Ht(e,o||r||{});a?(s.get&&(h.get=s.get),s.set&&(h.set=s.set)):Ca(t,h,i,n,s)}(function(t){return ga(t.constructor)}(t),function(t,e){var i,n,r=ma(ga(t.constructor),"proto"),s=ma(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?Sa({type:void 0}):void 0===e?(n=t,r):void r(t,e,i)}function Aa(t){var e;try{e=t()}catch(e){return t}return"object"!=typeof e||null===e?e:t}function ba(t,e,i){var n,r,s=ga(t.constructor),o=ma(s,"proto"),a=ma(o,"properties"),h=null!==(r=a[n=e])&&void 0!==r?r:a[n]={};return h.__internalFlags|=hi.STANDALONE,i&&"function"!=typeof i&&(i.get||i.set)?(i.get&&(h.get=i.get),i.set&&(h.set=i.set)):Ca(s,h,t.constructor,e,i),h}function Ca(t,e,i,n,r){if(void 0!==r)"function"==typeof r?e.default=Aa(r):null===r||r.initializer&&(e.default=Aa(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 Ra=Symbol("cc:SerializationMetadata"),wa=t("serializable",(function(t,e,i){Da(ba(t,e,i))}));function Ia(t){return function(e,i,n){var r=ba(e,i,n);r.formerlySerializedAs=t,Da(r)}}var xa=function(t,e,i){var n=ba(t,e,i);n.editorOnly=!0,Da(n)};function Da(t){t.__internalFlags|=hi.IMPLICIT_SERIALIZABLE}var Oa=ca,Pa=_a,Ma=la,Na=_a,La=la,Ba=la,Fa=la,ka=t("editable",ca),Ua=t("visible",la),Ga=t("displayName",la),Ha=t("tooltip",la),za=t("range",la),Va=t("rangeStep",la),Wa=t("slide",ca),Xa=t("displayOrder",la),ja=t("disallowAnimation",ca),Ya=Za(Ze),Ka=Za(Je),qa=Za($e),Qa=Za(ti);function Za(t){return Sa({type:t})}var Ja,$a,th,eh,ih,nh,rh,sh,oh,ah,hh=t("override",(function(t,e,i){ba(t,e,i).override=!0})),uh=t("EditorExtendable",(function(){})),ch=Object.freeze({__proto__:null,uniquelyReferenced:Oa,ccclass:va,property:Sa,requireComponent:ya,executionOrder:Ta,disallowMultiple:Ea,executeInEditMode:Pa,menu:Ma,playOnFocus:Na,inspector:La,icon:Ba,help:Fa,type:Za,integer:Ya,float:Ka,boolean:qa,string:Qa,editable:ka,tooltip:Ha,visible:Ua,displayName:Ga,displayOrder:Xa,range:za,rangeStep:Va,slide:Wa,disallowAnimation:ja,override:hh,formerlySerializedAs:Ia,serializable:wa});function lh(t,e){return(e<<3)+t}function _h(t){return fh[t]}function dh(t){switch(t){case oh.Uint8:return Uint8Array;case oh.Uint16:return Uint16Array;case oh.Uint32:return Uint32Array;case oh.Int8:return Int8Array;case oh.Int16:return Int16Array;case oh.Int32:return Int32Array;case oh.Float32:return Float32Array;case oh.Float64:return Float64Array}}t("_decorator",ch),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"}(oh||(oh={})),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"}(ah||(ah={})),t("CompactValueTypeArray",va("cc.CompactValueTypeArray")(((rh=function(){function t(){this._byteOffset=th&&th(),this._unitCount=eh&&eh(),this._unitElement=ih&&ih(),this._length=nh&&nh()}return t.lengthFor=function(t,e,i){return _h(e).requiredUnits*t.length*dh(i).BYTES_PER_ELEMENT},t.compress=function(e,i,n,r,s,o){for(var a=_h(i),h=dh(n),u=a.requiredUnits*e.length,c=new h(r,s,u),l=0;l<e.length;++l)a.compress(c,l,e[l]);var _=new t;return _._unitElement=lh(n,i),_._byteOffset=o,_._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=_h(i.elementType),s=new(dh(n))(t,this._byteOffset,this._unitCount),o=new Array(this._length),a=0;a<this._length;++a)o[a]=r.decompress(s,a);return o},t}()).StorageUnit=oh,rh.ElementType=ah,th=ua(($a=rh).prototype,"_byteOffset",[wa],(function(){return 0})),eh=ua($a.prototype,"_unitCount",[wa],(function(){return 0})),ih=ua($a.prototype,"_unitElement",[wa],(function(){return lh(oh.Uint8,ah.Scalar)})),nh=ua($a.prototype,"_length",[wa],(function(){return 0})),Ja=$a))||Ja);var fh=((sh={})[ah.Scalar]={requiredUnits:1,compress:function(t,e,i){t[e]=i},decompress:function(t,e){return t[e]}},sh[ah.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 _n(t[2*e],t[2*e+1])}},sh[ah.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 _n(t[3*e],t[3*e+1],t[3*e+2])}},sh[ah.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 on(t[4*e],t[4*e+1],t[4*e+2],t[4*e+3])}},sh[ah.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 Rn(t[4*e],t[4*e+1],t[4*e+2],t[4*e+3])}},sh[ah.Mat4]={requiredUnits:16,compress:function(t,e,i){Ln.toArray(t,i,16*e)},decompress:function(t,e){return Ln.fromArray(new Ln,t,16*e)}},sh),ph=t("serializeTag",Symbol("[[Serialize]]")),gh=t("deserializeTag",Symbol("[[Deserialize]]"));function mh(){return 0}function vh(t){return t}function yh(t){return t*t}function Th(t){return t*(2-t)}function Eh(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)}function Sh(t){return t*t*t}function Ah(t){return--t*t*t+1}function bh(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)}function Ch(t){return t*t*t*t}function Rh(t){return 1- --t*t*t*t}function wh(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)}function Ih(t){return t*t*t*t*t}function xh(t){return--t*t*t*t*t+1}function Dh(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)}function Oh(t){return 1===t?1:1-Math.cos(t*Math.PI/2)}function Ph(t){return Math.sin(t*Math.PI/2)}function Mh(t){return.5*(1-Math.cos(Math.PI*t))}function Nh(t){return 0===t?0:Math.pow(1024,t-1)}function Lh(t){return 1===t?1:1-Math.pow(2,-10*t)}function Bh(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 Fh(t){return 1-Math.sqrt(1-t*t)}function kh(t){return Math.sqrt(1- --t*t)}function Uh(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}function Gh(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 Hh(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 zh(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 Vh(t){if(1===t)return 1;var e=1.70158;return t*t*((e+1)*t-e)}function Wh(t){if(0===t)return 0;var e=1.70158;return--t*t*((e+1)*t+e)+1}function Xh(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 jh(t){return 1-Yh(1-t)}function Yh(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 Kh(t){return t<.5?.5*jh(2*t):.5*Yh(2*t-1)+.5}function qh(t){return t<=0?0:t>=1?1:t*t*(3-2*t)}function Qh(t){return t<=0?0:t>=1?1:t*t*t*(t*(6*t-15)+10)}m._decorator=ch;var Zh=au(yh,Th),Jh=au(Sh,Ah),$h=au(Ch,Rh),tu=au(Ih,xh),eu=au(Oh,Ph),iu=au(Nh,Lh),nu=au(Fh,kh),ru=au(Gh,Hh),su=au(Vh,Wh),ou=au(jh,Yh);function au(t,e){return function(i){return i<.5?e(2*i)/2:t(2*i-1)/2+.5}}var hu,uu,cu=Object.freeze({__proto__:null,constant:mh,linear:vh,quadIn:yh,quadOut:Th,quadInOut:Eh,cubicIn:Sh,cubicOut:Ah,cubicInOut:bh,quartIn:Ch,quartOut:Rh,quartInOut:wh,quintIn:Ih,quintOut:xh,quintInOut:Dh,sineIn:Oh,sineOut:Ph,sineInOut:Mh,expoIn:Nh,expoOut:Lh,expoInOut:Bh,circIn:Fh,circOut:kh,circInOut:Uh,elasticIn:Gh,elasticOut:Hh,elasticInOut:zh,backIn:Vh,backOut:Wh,backInOut:Xh,bounceIn:jh,bounceOut:Yh,bounceInOut:Kh,smooth:qh,fade:Qh,quadOutIn:Zh,cubicOutIn:Jh,quartOutIn:$h,quintOutIn:tu,sineOutIn:eu,expoOutIn:iu,circOutIn:nu,elasticOutIn:ru,backOutIn:su,bounceOutIn:ou});t("easing",cu),t("EasingMethod",uu),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"}(uu||t("EasingMethod",uu={}));var lu,_u=((hu={})[uu.CONSTANT]=mh,hu[uu.LINEAR]=vh,hu[uu.QUAD_IN]=yh,hu[uu.QUAD_OUT]=Th,hu[uu.QUAD_IN_OUT]=Eh,hu[uu.QUAD_OUT_IN]=Zh,hu[uu.CUBIC_IN]=Sh,hu[uu.CUBIC_OUT]=Ah,hu[uu.CUBIC_IN_OUT]=bh,hu[uu.CUBIC_OUT_IN]=Jh,hu[uu.QUART_IN]=Ch,hu[uu.QUART_OUT]=Rh,hu[uu.QUART_IN_OUT]=wh,hu[uu.QUART_OUT_IN]=$h,hu[uu.QUINT_IN]=Ih,hu[uu.QUINT_OUT]=xh,hu[uu.QUINT_IN_OUT]=Dh,hu[uu.QUINT_OUT_IN]=tu,hu[uu.SINE_IN]=Oh,hu[uu.SINE_OUT]=Ph,hu[uu.SINE_IN_OUT]=Mh,hu[uu.SINE_OUT_IN]=eu,hu[uu.EXPO_IN]=Nh,hu[uu.EXPO_OUT]=Lh,hu[uu.EXPO_IN_OUT]=Bh,hu[uu.EXPO_OUT_IN]=iu,hu[uu.CIRC_IN]=Fh,hu[uu.CIRC_OUT]=kh,hu[uu.CIRC_IN_OUT]=Uh,hu[uu.CIRC_OUT_IN]=nu,hu[uu.ELASTIC_IN]=Gh,hu[uu.ELASTIC_OUT]=Hh,hu[uu.ELASTIC_IN_OUT]=zh,hu[uu.ELASTIC_OUT_IN]=ru,hu[uu.BACK_IN]=Vh,hu[uu.BACK_OUT]=Wh,hu[uu.BACK_IN_OUT]=Xh,hu[uu.BACK_OUT_IN]=su,hu[uu.BOUNCE_IN]=jh,hu[uu.BOUNCE_OUT]=Yh,hu[uu.BOUNCE_IN_OUT]=Kh,hu[uu.BOUNCE_OUT_IN]=ou,hu[uu.SMOOTH]=qh,hu[uu.FADE]=Qh,hu);function du(t){return _u[t]}S(255),S(65280);var fu,pu,gu,mu=ra.LINEAR<<0|oa.NONE<<8|uu.LINEAR<<16,vu=function(t){function e(){var e;return(e=t.call(this)||this).value=0,e.rightTangent=0,e.rightTangentWeight=0,e.leftTangent=0,e.leftTangentWeight=0,e._flags=mu,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}(uh);function yu(t){var e=new vu;if("number"==typeof t)e.value=t;else{var i=t.interpolationMode,n=t.tangentWeightMode,r=t.value,s=t.rightTangent,o=t.rightTangentWeight,a=t.leftTangent,h=t.leftTangentWeight,u=t.easingMethod,c=t[Ys];e.value=null!=r?r:e.value,e.rightTangent=null!=s?s:e.rightTangent,e.rightTangentWeight=null!=o?o:e.rightTangentWeight,e.leftTangent=null!=a?a: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[Ys]=c)}return e}Ti.fastDefine("cc.RealKeyframeValue",vu,((lu={interpolationMode:ra.LINEAR,tangentWeightMode:oa.NONE,value:0,rightTangent:0,rightTangentWeight:0,leftTangent:0,leftTangentWeight:0,easingMethod:uu.LINEAR})[Ys]=void 0,lu)),Ti.Attr.setClassAttr(vu,Ys,"editorOnly",!0),(fu=vu,null!==(gu=(pu=fu)[Ra])&&void 0!==gu?gu:pu[Ra]={}).uniquelyReferenced=!0;var Tu,Eu=t("RealCurve",function(t){function e(){var e;return(e=t.call(this)||this).preExtrapolation=sa.CLAMP,e.postExtrapolation=sa.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 o=this.preExtrapolation,a=i[0];if(o===sa.CLAMP||n<2)return a.value;switch(o){case sa.LINEAR:return Fu(r,i[0].value,e[1],i[1].value,t);case sa.LOOP:t=Lu(t,r,s);break;case sa.PING_PONG:t=Bu(t,r,s);break;default:return a.value}}else if(t>s){var h=this.postExtrapolation,u=i[n-1];if(h===sa.CLAMP||n<2)return u.value;switch(h){case sa.LINEAR:return Fu(s,u.value,e[n-2],i[n-2].value,t);case sa.LOOP:t=Lu(t,r,s);break;case sa.PING_PONG:t=Bu(t,r,s);break;default:return u.value}}var c=na(e,t);if(c>=0)return i[c].value;var l=~c,_=l-1,d=e[_],f=i[_],p=e[l];return function(t,e,i,n,r){var s=i-t;switch(e.interpolationMode){default:case ra.CONSTANT:return e.value;case ra.LINEAR:var o=e.easingMethod===uu.LINEAR?r:du(e.easingMethod)(r);return Ni(e.value,n.value,o);case ra.CUBIC:var a=1/3,h=e.rightTangent,u=e.rightTangentWeight,c=0!=(e.tangentWeightMode&oa.RIGHT),l=n.leftTangent,_=n.leftTangentWeight,d=0!=(n.tangentWeightMode&oa.LEFT);if(c||d){var f=0;if(c)f=u;else{var p=s,g=s*h;f=Math.sqrt(p*p+g*g)*a}var m=Math.atan(h),v=Math.cos(m)*f+t,y=Math.sin(m)*f+e.value,T=0;if(d)T=_;else{var E=s,S=s*l;T=Math.sqrt(E*E+S*S)*a}var A=Math.atan(l),b=(v-t)/s,C=(-Math.cos(A)*T+i-t)/s,R=y,w=-Math.sin(A)*T+n.value,I=[0,0,0],x=function(t,e,i,n,r){var s=i/n,o=e/n,a=s*s,h=1/3*(-1/3*a+o),u=.5*(2/27*s*a-1/3*s*o+t/n),c=h*h*h,l=u*u+c,_=0;if(ha(l)){if(ha(u))return r[0]=0,1;var d=Math.cbrt(-u);return r[0]=2*d,r[1]=-d,2}if(l<0){var f=1/3*Math.acos(-u/Math.sqrt(-c)),p=2*Math.sqrt(-h);r[0]=p*Math.cos(f),r[1]=-p*Math.cos(f+Math.PI/3),r[2]=-p*Math.cos(f-Math.PI/3),_=3}else{var g=Math.sqrt(l),m=Math.cbrt(g-u),v=-Math.cbrt(g+u);r[0]=m+v,_=1}for(var y=1/3*s,T=0;T<_;++T)r[T]-=y;return _}(0-r,3*b,3*C-6*b,3*(b-C)+1,I),D=function(t,e,i){var n=i;if(1===e)n=t[0];else{n=-1/0;for(var r=0;r<e;++r){var s=t[r];s>=0&&s<=1&&s>n&&(n=s)}n===-1/0&&(n=0)}return n}(I,x,r);return ku(e.value,R,w,n.value,D)}var O=e.value+a*h*s,P=n.value-a*l*s;return ku(e.value,O,P,n.value,r)}}(d,f,p,i[l],(t-d)/(p-d))},i.addKeyFrame=function(e,i){return t.prototype.addKeyFrame.call(this,e,yu(i))},i.assignSorted=function(t,e){if(void 0!==e)this.setKeyframes(t.slice(),e.map((function(t){return yu(t)})));else{var i=Array.from(t);this.setKeyframes(i.map((function(t){return t[0]})),i.map((function(t){return yu(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 Oi(i.value,e,t)}))},i[ph]=function(t,e){if(e.toCCON){var i=this._times,n=this._values,r=i.length,s=new DataView(new ArrayBuffer(0+Su+Su+Au+bu*r+Pu*r)),o=0;s.setUint8(o,this.preExtrapolation),o+=Su,s.setUint8(o,this.postExtrapolation),o+=Su,s.setUint32(o,r,!0),o+=Au,i.forEach((function(t,e){return s.setFloat32(o+bu*e,t,!0)})),o+=bu*r;for(var a,h=d(n);!(a=h()).done;){var u=a.value;o=Mu(s,u,o)}var c=new Uint8Array(s.buffer,0,o);t.writeProperty("bytes",c);var l=n.map((function(t){return t[Ys]}));l.some((function(t){return void 0!==t}))&&t.writeProperty("keyframeValueEditorExtras",l)}else t.writeThis()},i[gh]=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+=Su,this.postExtrapolation=n.getUint8(r),r+=Su;var s=n.getUint32(r,!0);r+=Au;var o=Array.from({length:s},(function(t,e){return n.getFloat32(r+bu*e,!0)}));r+=bu*s;for(var a=new Array(s),h=0;h<s;++h){var u=yu({});r=Nu(n,u,r),a[h]=u}i.byteLength;var c=t.readProperty("keyframeValueEditorExtras");c&&(c.length,c.forEach((function(t,e){return a[e][Ys]=t}))),this._times=o,this._values=a}else t.readThis()},e}(aa));Ti.fastDefine("cc.RealCurve",Eu,{_times:[],_values:[],preExtrapolation:sa.CLAMP,postExtrapolation:sa.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"}(Tu||(Tu={}));var Su=1,Au=4,bu=4,Cu=yu({}),Ru=Cu.interpolationMode,wu=Cu.tangentWeightMode,Iu=Cu.leftTangent,xu=Cu.leftTangentWeight,Du=Cu.rightTangent,Ou=Cu.rightTangentWeight,Pu=26;function Mu(t,e,i){var n=0,r=i,s=r;r+=4;var o=e.value,a=e.interpolationMode,h=e.tangentWeightMode,u=e.rightTangent,c=e.rightTangentWeight,l=e.leftTangent,_=e.leftTangentWeight,d=e.easingMethod;return t.setFloat32(r,o,!0),r+=4,a!==Ru&&(n|=Tu.INTERPOLATION_MODE,t.setUint8(r,a),r+=1),h!==wu&&(n|=Tu.TANGENT_WEIGHT_MODE,t.setUint8(r,h),r+=1),l!==Iu&&(n|=Tu.LEFT_TANGENT,t.setFloat32(r,l,!0),r+=4),_!==xu&&(n|=Tu.LEFT_TANGENT_WEIGHT,t.setFloat32(r,_,!0),r+=4),u!==Du&&(n|=Tu.RIGHT_TANGENT,t.setFloat32(r,u,!0),r+=4),c!==Ou&&(n|=Tu.RIGHT_TANGENT_WEIGHT,t.setFloat32(r,c,!0),r+=4),n|=d<<8,t.setUint32(s,n,!0),r}function Nu(t,e,i){var n=i,r=t.getUint32(n,!0);n+=4,e.value=t.getFloat32(n,!0),n+=4,r&Tu.INTERPOLATION_MODE&&(e.interpolationMode=t.getUint8(n),n+=1),r&Tu.TANGENT_WEIGHT_MODE&&(e.tangentWeightMode=t.getUint8(n),n+=1),r&Tu.LEFT_TANGENT&&(e.leftTangent=t.getFloat32(n,!0),n+=4),r&Tu.LEFT_TANGENT_WEIGHT&&(e.leftTangentWeight=t.getFloat32(n,!0),n+=4),r&Tu.RIGHT_TANGENT&&(e.rightTangent=t.getFloat32(n,!0),n+=4),r&Tu.RIGHT_TANGENT_WEIGHT&&(e.rightTangentWeight=t.getFloat32(n,!0),n+=4);var s=(65280&r)>>8;return e.easingMethod=s,n}function Lu(t,e,i){return e+Xi(t-e,i-e)}function Bu(t,e,i){return e+ji(t-e,i-e)}function Fu(t,e,i,n,r){return e+(n-e)/(i-t)*(r-t)}function ku(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 Uu(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}m.bezier=Uu;var Gu,Hu,zu,Vu,Wu,Xu,ju,Yu,Ku,qu,Qu=Math.cos,Zu=Math.acos,Ju=Math.max,$u=2*Math.PI,tc=Math.sqrt;function ec(t){return t<0?-Math.pow(-t,1/3):Math.pow(t,1/3)}function ic(t,e){var i=function(t,e){var i,n,r,s,o=e-0,a=e-t[0],h=3*o,u=3*a,c=3*(e-t[2]),l=1/(-o+u-c+(e-1)),_=1/3,d=(h-6*a+c)*l,f=d*_,p=(-h+u)*l,g=(3*p-d*d)*_,m=g*_,v=(2*d*d*d-9*d*p+o*l*27)/27,y=v/2,T=y*y+m*m*m;if(T<0){var E=-g*_,S=tc(E*E*E),A=-v/(2*S),b=Zu(A<-1?-1:A>1?1:A),C=2*ec(S);return n=C*Qu(b*_)-f,r=C*Qu((b+$u)*_)-f,s=C*Qu((b+2*$u)*_)-f,n>=0&&n<=1?r>=0&&r<=1?s>=0&&s<=1?Ju(n,r,s):Ju(n,r):s>=0&&s<=1?Ju(n,s):n:r>=0&&r<=1?s>=0&&s<=1?Ju(r,s):r:s}if(0===T)return r=-(i=y<0?ec(-y):-ec(y))-f,(n=2*i-f)>=0&&n<=1?r>=0&&r<=1?Ju(n,r):n:r;var R=tc(T);return(i=ec(-y+R))-ec(y+R)-f}(t,e),n=t[1];return((1-i)*(n+(t[3]-n)*i)*3+i*i)*i}m.bezierByTime=ic,t("QuatInterpolationMode",qu),function(t){t[t.SLERP=0]="SLERP",t[t.CONSTANT=1]="CONSTANT"}(qu||t("QuatInterpolationMode",qu={}));var nc=va("cc.QuatKeyframeValue")(Gu=Oa((Hu=function(t){var e=void 0===t?{}:t,i=e.value,n=e.interpolationMode,r=e.easingMethod;this.interpolationMode=zu&&zu(),this.value=Vu&&Vu(),this.easingMethod=Wu&&Wu(),this.value=i?Rn.clone(i):this.value,this.interpolationMode=null!=n?n:this.interpolationMode,this.easingMethod=null!=r?r:this.easingMethod},zu=ua(Hu.prototype,"interpolationMode",[wa],(function(){return qu.SLERP})),Vu=ua(Hu.prototype,"value",[wa],(function(){return Rn.clone(Rn.IDENTITY)})),Wu=ua(Hu.prototype,"easingMethod",[wa],(function(){return uu.LINEAR})),Gu=Hu))||Gu)||Gu;function rc(t){return new nc(t)}var sc,oc=t("QuatCurve",va("cc.QuatCurve")((ju=function(t){function e(){var e;return(e=t.call(this)||this).preExtrapolation=Yu&&Yu(),e.postExtrapolation=Ku&&Ku(),e}s(e,t);var i=e.prototype;return i.evaluate=function(t,e){var i;null!==(i=e)&&void 0!==i||(e=new Rn);var n=this._times,r=this._values,s=this.postExtrapolation,o=this.preExtrapolation,a=n.length;if(0===a)return e;var h=n[0],u=n[a-1];if(t<h){var c=r[0];switch(o){case sa.LOOP:t=h+Xi(t-h,u-h);break;case sa.PING_PONG:t=h+ji(t-h,u-h);break;case sa.CLAMP:default:return Rn.copy(e,c.value)}}else if(t>u){var l=r[a-1];switch(s){case sa.LOOP:t=h+Xi(t-h,u-h);break;case sa.PING_PONG:t=h+ji(t-h,u-h);break;case sa.CLAMP:default:return Rn.copy(e,l.value)}}var _=na(n,t);if(_>=0)return Rn.copy(e,r[_].value);var d=~_,f=d-1,p=n[f],g=r[f],m=n[d],v=r[d],y=(t-p)/(m-p);switch(g.interpolationMode){default:case qu.CONSTANT:return Rn.copy(e,g.value);case qu.SLERP:var T=g.easingMethod,E=T===uu.LINEAR?y:Array.isArray(T)?ic(T,y):du(T)(y);return Rn.slerp(e,g.value,v.value,E)}},i.addKeyFrame=function(e,i){var n=new nc(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 rc(t)})));else{var i=Array.from(t);this.setKeyframes(i.map((function(t){return t[0]})),i.map((function(t){return rc(t[1])})))}},i[ph]=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,o=_c*(r?1:s),a=n.reduce((function(t,e){var i=e.easingMethod;return t+(Array.isArray(i)?dc+4*pc:dc)}),0),h=0,u=new DataView(new ArrayBuffer(h+=hc+uc+cc*s+4*lc*s+a+o+0)),c=0,l=0;r&&(l|=sc.INTERPOLATION_MODE),u.setUint32(c,l,!0),c+=hc,u.setUint32(c,s,!0),c+=uc,i.forEach((function(t,e){return u.setFloat32(c+cc*e,t,!0)})),c+=cc*s,n.forEach((function(t,e){var i=t.value,n=i.x,r=i.y,s=i.z,o=i.w,a=c+4*lc*e;u.setFloat32(a+0*lc,n,!0),u.setFloat32(a+1*lc,r,!0),u.setFloat32(a+2*lc,s,!0),u.setFloat32(a+3*lc,o,!0)})),c+=4*lc*s,n.forEach((function(t){var e=t.easingMethod;Array.isArray(e)?(u.setUint8(c,fc),++c,u.setFloat32(c+0*pc,e[0],!0),u.setFloat32(c+1*pc,e[1],!0),u.setFloat32(c+2*pc,e[2],!0),u.setFloat32(c+3*pc,e[3],!0),c+=4*pc):(u.setUint8(c,e),++c)}));var _=c;c+=o;var d=_;n.forEach((function(t){var e=t.interpolationMode;u.setUint8(d,e),r||(d+=_c)}));var f=new Uint8Array(u.buffer);t.writeProperty("bytes",f)}else t.writeThis()},i[gh]=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+=hc;var o=s&sc.INTERPOLATION_MODE,a=n.getUint32(r,!0);r+=uc;var h=Array.from({length:a},(function(t,e){return n.getFloat32(r+cc*e,!0)})),u=r+=cc*a;r+=4*lc*a;var c=Array.from({length:a},(function(t,e){var i=u+4*lc*e,s=n.getFloat32(i+0*lc,!0),o=n.getFloat32(i+1*lc,!0),a=n.getFloat32(i+2*lc,!0),h=n.getFloat32(i+3*lc,!0),c=n.getUint8(r);++r;var l=rc({value:{x:s,y:o,z:a,w:h}});return c!==fc?l.easingMethod=c:(l.easingMethod=[n.getFloat32(r+0*pc,!0),n.getFloat32(r+1*pc,!0),n.getFloat32(r+2*pc,!0),n.getFloat32(r+3*pc,!0)],r+=4*pc),l}));if(o){var l=n.getUint8(r);++r;for(var _=0;_<a;++_)c[_].interpolationMode=l}else{for(var d=0;d<a;++d){var f=n.getUint8(r+d);c[d].interpolationMode=f}r+=a}this._times=h,this._values=c}else t.readThis()},e}(aa),Yu=ua(ju.prototype,"preExtrapolation",[wa],(function(){return sa.CLAMP})),Ku=ua(ju.prototype,"postExtrapolation",[wa],(function(){return sa.CLAMP})),Xu=ju))||Xu);!function(t){t[t.INTERPOLATION_MODE=1]="INTERPOLATION_MODE"}(sc||(sc={}));var ac,hc=1,uc=4,cc=4,lc=4,_c=1,dc=1,fc=255,pc=4,gc=t("ObjectCurve",va("cc.ObjectCurve")(ac=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=Pi(~e-1,0,this._values.length-1);return this._values[i]},e}(aa))||ac),mc=ye({Blend:0,Fixed:1}),vc=t("ColorKey",(function(){this.color=yn.WHITE.clone(),this.time=0}));Ti.fastDefine("cc.ColorKey",vc,{color:yn.WHITE.clone(),time:0}),Ti.Attr.setClassAttr(vc,"color","visible",!0),Ti.Attr.setClassAttr(vc,"time","visible",!0);var yc=t("AlphaKey",(function(){this.alpha=1,this.time=0}));Ti.fastDefine("cc.AlphaKey",yc,{alpha:1,time:0}),Ti.Attr.setClassAttr(yc,"alpha","visible",!0),Ti.Attr.setClassAttr(yc,"time","visible",!0);var Tc=t("Gradient",function(){function t(){this.colorKeys=[],this.alphaKeys=[],this.mode=mc.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 yn,t)},e.evaluateFast=function(t,e){return this.getRGB(t,e),t.a=this.getAlpha(e),t},e.randomColor=function(){return this.getRandomColor(new yn)},e.getRandomColor=function(t){var e=this.colorKeys[Math.trunc(Fi()*this.colorKeys.length)],i=this.alphaKeys[Math.trunc(Fi()*this.alphaKeys.length)];return t.set(e.color),t.a=i.alpha,t},e.getRGB=function(t,e){var i=this.colorKeys,n=i.length;if(n>1){e=Xi(e,1+xi);for(var r=1;r<n;++r){var s=i[r-1].time,o=i[r].time;if(e>=s&&e<o){if(this.mode===mc.Fixed)return yn.copy(t,i[r].color),t;var a=(e-s)/(o-s);return yn.lerp(t,i[r-1].color,i[r].color,a),t}}var h=n-1;Oi(e,i[h].time,xi)?yn.copy(t,i[h].color):e<i[0].time?yn.lerp(t,yn.BLACK,i[0].color,e/i[0].time):e>i[h].time&&yn.lerp(t,i[h].color,yn.BLACK,(e-i[h].time)/(1-i[h].time))}else 1===n?yn.copy(t,i[0].color):yn.copy(t,yn.WHITE);return t},e.getAlpha=function(t){var e=this.alphaKeys,i=e.length;if(i>1){t=Xi(t,1+xi);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===mc.Fixed)return e[n].alpha;var o=(t-r)/(s-r);return Ni(e[n-1].alpha,e[n].alpha,o)}}var a=i-1;return Oi(t,e[a].time,xi)?e[a].alpha:t<e[0].time?Ni(0,e[0].alpha,t/e[0].time):t>e[a].time?Ni(e[a].alpha,0,(t-e[a].time)/(1-e[a].time)):255}return 1===i?e[0].alpha:255},t}());Tc.Mode=mc,Ti.fastDefine("cc.Gradient",Tc,{colorKeys:[],alphaKeys:[],mode:mc.Blend}),Ti.Attr.setClassAttr(Tc,"colorKeys","visible",!0),Ti.Attr.setClassAttr(Tc,"alphaKeys","visible",!0),Ti.Attr.setClassAttr(Tc,"mode","visible",!0);var Ec=function(){this.time=0,this.value=0,this.inTangent=0,this.outTangent=0};Ti.fastDefine("cc.Keyframe",Ec,{time:0,value:0,inTangent:0,outTangent:0});var Sc=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 Ac(t-this.time,this.coefficient)},t}();function Ac(t,e){return t*(t*(t*e[0]+e[1])+e[2])+e[3]}var bc,Cc,Rc=function(){function t(t){if(void 0===t&&(t=null),this._curve=void 0,this.cachedKey=void 0,t instanceof Eu)this._curve=t;else{var e=new Eu;this._curve=e,e.preExtrapolation=sa.LOOP,e.postExtrapolation=sa.CLAMP,t?e.assignSorted(t.map((function(t){return[t.time,{interpolationMode:ra.CUBIC,value:t.value,leftTangent:t.inTangent,rightTangent:t.outTangent}]}))):e.assignSorted([[0,{interpolationMode:ra.CUBIC,value:1}],[1,{interpolationMode:ra.CUBIC,value:1}]])}this.cachedKey=new Sc}var e=t.prototype;return e.addKey=function(t){t?this._curve.addKeyFrame(t.time,{interpolationMode:ra.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,o=i.getKeyframeTime(0),a=i.getKeyframeTime(n);switch(s){case sa.LOOP:r=Xi(t-o,a-o)+o;break;case sa.PING_PONG:r=ji(t-o,a-o)+o;break;case sa.CLAMP:default:r=Pi(t,o,a)}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),o=s.value,a=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-o,d=1/(l*l),f=a*l,p=c*l;t.coefficient[0]=(f+p-_-_)*d/l,t.coefficient[1]=(_+_+_-f-f-p)*d,t.coefficient[2]=a,t.coefficient[3]=o},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 o=r+s;if(o+1<n&&i.getKeyframeTime(o+1)>e)return o}else for(var a=0;a<3;a++){var h=r-a;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 Ec;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:ra.CUBIC,value:t.value,leftTangent:t.inTangent,rightTangent:t.outTangent}]})))}},{key:"preWrapMode",get:function(){return Ic(this._curve.preExtrapolation)},set:function(t){this._curve.preExtrapolation=wc(t)}},{key:"postWrapMode",get:function(){return Ic(this._curve.postExtrapolation)},set:function(t){this._curve.postExtrapolation=wc(t)}}]),t}();function wc(t){switch(t){default:case bc.Default:case bc.Normal:case bc.Clamp:return sa.CLAMP;case bc.PingPong:return sa.PING_PONG;case bc.Loop:return sa.LOOP}}function Ic(t){switch(t){default:case sa.LINEAR:case sa.CLAMP:return bc.Clamp;case sa.PING_PONG:return bc.PingPong;case sa.LOOP:return bc.Loop}}Rc.defaultKF=[{time:0,value:1,inTangent:0,outTangent:0},{time:1,value:1,inTangent:0,outTangent:0}],Ti.fastDefine("cc.AnimationCurve",Rc,{_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"}(bc||(bc={})),function(t){t[t.LINEAR=0]="LINEAR",t[t.BEZIER=1]="BEZIER",t[t.CATMULL_ROM=2]="CATMULL_ROM"}(Cc||(Cc={}));var xc,Dc=4294967295,Oc=new _n,Pc=new _n,Mc=new _n,Nc=new _n,Lc=function(){function t(t,e){void 0===t&&(t=Cc.CATMULL_ROM),void 0===e&&(e=[]),this._type=void 0,this._mode=Cc.CATMULL_ROM,this._knots=[],this._type=cr.SHAPE_SPLINE,this._mode=t;for(var i=0;i<e.length;i++)this._knots[i]=new _n(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 _n(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 _n(e[i])},e.clearKnots=function(){this._knots.length=0},e.getKnotCount=function(){return this._knots.length},e.addKnot=function(t){this._knots.push(new _n(t))},e.insertKnot=function(t,e){var i=new _n(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=Dc),e=Pi(e,0,1);var n=this.getSegments();if(0===n)return new _n(0,0,0);if(i===Dc){var r=1/n;i=Math.floor(e/r),e=e%r/r}if(i>=n)return new _n(this._knots[this._knots.length-1]);switch(this._mode){case Cc.LINEAR:return t.calcLinear(this._knots[i],this._knots[i+1],e);case Cc.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 Cc.CATMULL_ROM:var s=i>0?this._knots[i-1]:this._knots[i],o=i+2<this._knots.length?this._knots[i+2]:this._knots[i+1];return t.calcCatmullRom(s,this._knots[i],this._knots[i+1],o,e);default:return new _n(0,0,0)}},e.getPoints=function(t,e){if(void 0===e&&(e=Dc),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,o=this.getPoint(s,e);i.push(o)}return i},e.getSegments=function(){var t=this._knots.length;switch(this._mode){case Cc.LINEAR:case Cc.CATMULL_ROM:return t<2?(q(14300),0):t-1;case Cc.BEZIER:return t<4||t%4!=0?(q(14301),0):t/4}},t.calcLinear=function(t,e,i){var n=new _n;return _n.multiplyScalar(Oc,t,1-i),_n.multiplyScalar(Pc,e,i),_n.add(n,Oc,Pc),n},t.calcBezier=function(t,e,i,n,r){var s=new _n,o=1-r;return _n.multiplyScalar(Oc,t,o*o*o),_n.multiplyScalar(Pc,e,3*r*o*o),_n.multiplyScalar(Mc,i,3*r*r*o),_n.multiplyScalar(Nc,n,r*r*r),_n.add(Oc,Oc,Pc),_n.add(Mc,Mc,Nc),_n.add(s,Oc,Mc),s},t.calcCatmullRom=function(t,e,i,n,r){var s=new _n,o=r*r,a=o*r;return _n.multiplyScalar(Oc,t,-.5*a+o-.5*r),_n.multiplyScalar(Pc,e,1.5*a-2.5*o+1),_n.multiplyScalar(Mc,i,-1.5*a+2*o+.5*r),_n.multiplyScalar(Nc,n,.5*a-.5*o),_n.add(Oc,Oc,Pc),_n.add(Mc,Mc,Nc),_n.add(s,Oc,Mc),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 Bc(t,e){F(t+" is deprecated, please use "+e+" instead.")}!function(t){t[t.ALL=0]="ALL",t[t.CLOSEST=1]="CLOSEST",t[t.ANY=2]="ANY"}(xc||(xc={})),rt(ds,"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 Fc=function(t){function e(){var e;return e=t.call(this)||this,Bc("line","Line"),e}return s(e,t),e}(lr),kc=function(t){function e(){var e;return e=t.call(this)||this,Bc("plane","Plane"),e}return s(e,t),e}(Cs),Uc=function(t){function e(){var e;return e=t.call(this)||this,Bc("ray","Ray"),e}return s(e,t),e}(_r),Gc=function(t){function e(){var e;return e=t.call(this)||this,Bc("triangle","Triangle"),e}return s(e,t),e}(Rs),Hc=function(t){function e(){var e;return e=t.call(this)||this,Bc("sphere","Sphere"),e}return s(e,t),e}(Ar),zc=function(t){function e(){var e;return e=t.call(this)||this,Bc("aabb","AABB"),e}return s(e,t),e}(Xo),Vc=function(t){function e(){var e;return e=t.call(this)||this,Bc("obb","OBB"),e}return s(e,t),e}(ia),Wc=function(t){function e(){var e;return e=t.call(this)||this,Bc("capsule","Capsule"),e}return s(e,t),e}(jo),Xc=function(t){function e(){var e;return e=t.call(this)||this,Bc("frustum","Frustum"),e}return s(e,t),e}(Jo),jc=Object.freeze({__proto__:null,distance:ur,enums:cr,intersect:ds,Line:lr,Plane:Cs,Ray:_r,Triangle:Rs,Sphere:Ar,AABB:Xo,OBB:ia,Capsule:jo,Frustum:Jo,Keyframe:Ec,AnimationCurve:Rc,get WrapModeMask(){return bc},get SplineMode(){return Cc},Spline:Lc,constructLegacyCurveAndConvert:function(){var t=new Eu;return t.assignSorted([[0,{interpolationMode:ra.CUBIC,value:1}],[1,{interpolationMode:ra.CUBIC,value:1}]]),t},OptimizedKey:Sc,evalOptCurve:Ac,get ERaycastMode(){return xc},line:Fc,plane:kc,ray:Uc,triangle:Gc,sphere:Hc,aabb:zc,obb:Vc,capsule:Wc,frustum:Xc});t("geometry",jc);var Yc=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}());Yc.Priority=ye({LOW:0,MEDIUM:100,HIGH:200,SCHEDULER:1<<31>>>0});var Kc=new vt("Scheduler"),qc=function(){function t(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}return t.get=function(e,i,n,r){var s=t._listEntries.pop();return s?(s.target=e,s.priority=i,s.paused=n,s.markedForDeletion=r):s=new t(e,i,n,r),s},t.put=function(e){t._listEntries.length<20&&(e.target=null,t._listEntries.push(e))},t}();qc._listEntries=[];var Qc=function(){function t(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}return t.get=function(e,i,n,r){var s=t._hashUpdateEntries.pop();return s?(s.list=e,s.entry=i,s.target=n,s.callback=r):s=new t(e,i,n,r),s},t.put=function(e){t._hashUpdateEntries.length<20&&(e.list=e.entry=e.target=e.callback=null,t._hashUpdateEntries.push(e))},t}();Qc._hashUpdateEntries=[];var Zc=function(){function t(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}return t.get=function(e,i,n,r,s,o){var a=t._hashTimerEntries.pop();return a?(a.timers=e,a.target=i,a.timerIndex=n,a.currentTimer=r,a.currentTimerSalvaged=s,a.paused=o):a=new t(e,i,n,r,s,o),a},t.put=function(e){t._hashTimerEntries.length<20&&(e.timers=e.target=e.currentTimer=null,t._hashTimerEntries.push(e))},t}();Zc._hashTimerEntries=[];var Jc=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}t.get=function(){return t._timers.pop()||new t},t.put=function(e){t._timers.length<20&&!e._lock&&(e._scheduler=e._target=e._callback=null,t._timers.push(e))};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._timesExecuted=0,this._elapsed=-1,this._interval=n,this._delay=s,this._useDelay=this._delay>0,this._repeat=r,this._runForever=this._repeat===m.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&&this._callback&&this._target&&this._scheduler.unscheduleForTimer(this,this._target)},t}();Jc._timers=[];var $c=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=Dt(!0),e._hashForTimers=Dt(!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=Kc.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++){var o,a;(r=i[e]).paused||r.markedForDeletion||!r.target||null===(o=(a=r.target).update)||void 0===o||o.call(a,t)}for(e=0,n=(i=this._updates0List).length;e<n;e++){var h,u;(r=i[e]).paused||r.markedForDeletion||!r.target||null===(h=(u=r.target).update)||void 0===h||h.call(u,t)}for(e=0,n=(i=this._updatesPosList).length;e<n;e++){var c,l;(r=i[e]).paused||r.markedForDeletion||!r.target||null===(c=(l=r.target).update)||void 0===c||c.call(l,t)}var _=this._arrayForTimers;for(e=0;e<_.length;e++){var d;if(s=_[e],this._currentTarget=s,this._currentTargetSalvaged=!1,!s.paused&&s.timers)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===(null===(d=this._currentTarget.timers)||void 0===d?void 0:d.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){var o,a,h,u;"function"!=typeof t?(q(1514),h=e,u=t):(h=t,u=e),3!==arguments.length&&4!==arguments.length&&5!==arguments.length||(s=!!n,n=m.macro.REPEAT_FOREVER,r=0),tt(Boolean(u),1502);var c=u.uuid||u.id;if(c){var l,_,d=this._hashForTimers[c];if(d?d.paused!==s&&q(1511):(d=Zc.get(null,u,0,null,!1,Boolean(s)),this._arrayForTimers.push(d),this._hashForTimers[c]=d),null==d.timers)d.timers=[];else for(_=0;_<d.timers.length;++_)if((l=d.timers[_])&&h===l.getCallback())return X(1507,l.getInterval(),i),void l.setInterval(i);(l=Jc.get()).initWithCallback(this,h,u,i,null!==(o=n)&&void 0!==o?o:0,null!==(a=r)&&void 0!==a?a:0),d.timers.push(l),this._currentTarget===d&&this._currentTargetSalvaged&&(this._currentTargetSalvaged=!1)}else Z(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 X(1506),r.entry.markedForDeletion=!1,void(r.entry.paused=i);this.unscheduleUpdate(t)}var s,o=qc.get(t,e,i,!1);0===e?(s=this._updates0List,this._appendIn(s,o)):(s=e<0?this._updatesNegList:this._updatesPosList,this._priorityIn(s,o,e)),this._hashForUpdates[n]=Qc.get(s,o,t,null)}else Z(1510)},i.unschedule=function(t,e){if(e&&t){var i=e.uuid||e.id;if(i){var n=this._hashForTimers[i];if(n){var r=n.timers;if(!r)return;for(var s=0,o=r.length;s<o;s++){var a=r[s];if(t===a.getCallback())return a!==n.currentTimer||n.currentTimerSalvaged||(n.currentTimerSalvaged=!0),r.splice(s,1),Jc.put(a),n.timerIndex>=s&&n.timerIndex--,void(0===r.length&&(this._currentTarget===n?this._currentTargetSalvaged=!0:this._removeHashElement(n)))}}}else Z(1510)}},i.unscheduleForTimer=function(t,e){var i=e.uuid||e.id,n=this._hashForTimers[i],r=n.timers;if(r&&0!==r.length)for(var s=r.length-1;s>=0;s--){var o=r[s];if(o===t)return r.splice(s,1),Jc.put(o),n.timerIndex>=s&&n.timerIndex--,void(0===r.length&&(this._currentTargetSalvaged=!0))}},i.unscheduleUpdate=function(t){if(t){var e=t.uuid||t.id;if(e){var i=this._hashForUpdates[e];null!=i&&i.entry&&(this._updateHashLocked?i.entry.markedForDeletion=!0:this._removeUpdateFromHash(i.entry))}else Z(1510)}},i.unscheduleAllForTarget=function(t){if(t){var e=t.uuid||t.id;if(e){var i=this._hashForTimers[e];if(null!=i&&i.timers){var n=i.timers;i.currentTimer&&n.indexOf(i.currentTimer)>-1&&!i.currentTimerSalvaged&&(i.currentTimerSalvaged=!0);for(var r=0,s=n.length;r<s;r++)Jc.put(n[r]);n.length=0,this._currentTarget===i?this._currentTargetSalvaged=!0:this._removeHashElement(i)}this.unscheduleUpdate(t)}else Z(1510)}},i.unscheduleAll=function(){this.unscheduleAllWithMinPriority(Yc.Priority.SCHEDULER)},i.unscheduleAllWithMinPriority=function(t){var e,i,n,r=this._arrayForTimers;for(e=r.length-1;e>=0;e--)(i=r[e]).target&&this.unscheduleAllForTarget(i.target);var s=0;if(t<0)for(e=0;e<this._updatesNegList.length;){var o;s=this._updatesNegList.length,null!==(o=n=this._updatesNegList[e])&&void 0!==o&&o.target&&n.priority>=t&&this.unscheduleUpdate(n.target),s===this._updatesNegList.length&&e++}if(t<=0)for(e=0;e<this._updates0List.length;){var a;s=this._updates0List.length,null!==(a=n=this._updates0List[e])&&void 0!==a&&a.target&&this.unscheduleUpdate(n.target),s===this._updates0List.length&&e++}for(e=0;e<this._updatesPosList.length;){var h;s=this._updatesPosList.length,null!==(h=n=this._updatesPosList[e])&&void 0!==h&&h.target&&n.priority>=t&&this.unscheduleUpdate(n.target),s===this._updatesPosList.length&&e++}},i.isScheduled=function(t,e){tt(Boolean(t),1508),tt(Boolean(e),1509);var i=e.uuid||e.id;if(!i)return Z(1510),!1;var n=this._hashForTimers[i];if(!n)return!1;if(null==n.timers)return!1;for(var r=n.timers,s=0;s<r.length;++s)if(t===r[s].getCallback())return!0;return!1},i.pauseAllTargets=function(){return this.pauseAllTargetsWithMinPriority(Yc.Priority.SCHEDULER)},i.pauseAllTargetsWithMinPriority=function(t){var e,i,n,r,s=[],o=this._arrayForTimers;for(i=0,n=o.length;i<n;i++){var a;null!==(a=e=o[i])&&void 0!==a&&a.target&&(e.paused=!0,s.push(e.target))}if(t<0)for(i=0;i<this._updatesNegList.length;i++){var h;null!==(h=r=this._updatesNegList[i])&&void 0!==h&&h.target&&r.priority>=t&&(r.paused=!0,s.push(r.target))}if(t<=0)for(i=0;i<this._updates0List.length;i++){var u;null!==(u=r=this._updates0List[i])&&void 0!==u&&u.target&&(r.paused=!0,s.push(r.target))}for(i=0;i<this._updatesPosList.length;i++){var c;null!==(c=r=this._updatesPosList[i])&&void 0!==c&&c.target&&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){tt(Boolean(t),1503);var e=t.uuid||t.id;if(e){var i=this._hashForTimers[e];i&&(i.paused=!0);var n=this._hashForUpdates[e];null!=n&&n.entry&&(n.entry.paused=!0)}else Z(1510)},i.resumeTarget=function(t){tt(Boolean(t),1504);var e=t.uuid||t.id;if(e){var i=this._hashForTimers[e];i&&(i.paused=!1);var n=this._hashForUpdates[e];null!=n&&n.entry&&(n.entry.paused=!1)}else Z(1510)},i.isTargetPaused=function(t){tt(Boolean(t),1505);var e=t.uuid||t.id;if(!e)return Z(1510),!1;var i=this._hashForTimers[e];if(i)return i.paused;var n=this._hashForUpdates[e];return!(null==n||!n.entry)&&n.entry.paused},i._removeHashElement=function(t){if(t.target){var e=t.target.uuid||t.target.id;if(void 0!==e){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}Zc.put(t)}}},i._removeUpdateFromHash=function(t){if(t.target){var e=t.target.uuid||t.target.id;if(void 0!==e){var i=this._hashForUpdates[e];if(i){var n=i.list,r=i.entry;if(n)for(var s=0,o=n.length;s<o;s++)if(n[s]===r){n.splice(s,1);break}delete this._hashForUpdates[e],r&&qc.put(r),Qc.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}(Yc));$c.ID="scheduler",m.Scheduler=$c;var tl={};rt(tl,"vmath",[{name:"vec2",newName:"Vec2",target:Zn,targetName:"math"},{name:"vec3",newName:"Vec3",target:Zn,targetName:"math"},{name:"vec4",newName:"Vec4",target:Zn,targetName:"math"},{name:"quat",newName:"Quat",target:Zn,targetName:"math"},{name:"mat3",newName:"Mat3",target:Zn,targetName:"math"},{name:"mat4",newName:"Mat4",target:Zn,targetName:"math"},{name:"color4",newName:"Color",target:Zn,targetName:"math"},{name:"rect",newName:"Rect",target:Zn,targetName:"math"},{name:"approx",newName:"approx",target:Zn,targetName:"math"},{name:"EPSILON",newName:"EPSILON",target:Zn,targetName:"math"},{name:"equals",newName:"equals",target:Zn,targetName:"math"},{name:"clamp",newName:"clamp",target:Zn,targetName:"math"},{name:"clamp01",newName:"clamp01",target:Zn,targetName:"math"},{name:"lerp",newName:"lerp",target:Zn,targetName:"math"},{name:"toRadian",newName:"toRadian",target:Zn,targetName:"math"},{name:"toDegree",newName:"toDegree",target:Zn,targetName:"math"},{name:"random",newName:"random",target:Zn,targetName:"math"},{name:"randomRange",newName:"randomRange",target:Zn,targetName:"math"},{name:"randomRangeInt",newName:"randomRangeInt",target:Zn,targetName:"math"},{name:"pseudoRandom",newName:"pseudoRandom",target:Zn,targetName:"math"},{name:"pseudoRandomRangeInt",newName:"pseudoRandomRangeInt",target:Zn,targetName:"math"},{name:"nextPow2",newName:"nextPow2",target:Zn,targetName:"math"},{name:"repeat",newName:"repeat",target:Zn,targetName:"math"},{name:"pingPong",newName:"pingPong",target:Zn,targetName:"math"},{name:"inverseLerp",newName:"inverseLerp",target:Zn,targetName:"math"}]),m.vmath=tl,rt($c.prototype,"Scheduler.prototype",[{name:"enableForTarget",newName:"enableForTarget",target:$c,targetName:"Scheduler"}]),rt($c,"Scheduler",[{name:"PRIORITY_SYSTEM",newName:"System.Priority.SCHEDULER",customGetter:function(){return Yc.Priority.SCHEDULER}}]),st($c,"Scheduler",[{name:"PRIORITY_NON_SYSTEM",suggest:"Use enum` System.Priority` instead"}]),ot(pe,"js",[{name:"js",suggest:"'js.js' is deprecated since v3.7.0, please access 'js' directly instead."}]);var el=String.prototype.charCodeAt;function il(t){return this[t]}function nl(t,e){for(var i=t.length,n=e^i,r=0,s="string"==typeof t?el:il;i>=4;){var o=255&s.call(t,r)|(255&s.call(t,++r))<<8|(255&s.call(t,++r))<<16|(255&s.call(t,++r))<<24;o=1540483477*(65535&o)+((1540483477*(o>>>16)&65535)<<16),n=1540483477*(65535&n)+((1540483477*(n>>>16)&65535)<<16)^(o=1540483477*(65535&(o^=o>>>24))+((1540483477*(o>>>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 rl(){}m.easing=cu,rl.prototype.once=function(t,e,i){return this.on(t,e,i,!0)},rl.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:rl}));var sl=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}(),ol=t("garbageCollectionManager",new sl),al=t("GCObject",function(){function t(){return ol.registerGCObject(this)}return t.prototype.destroy=function(){},t}());function hl(t,e){for(var i,n=d(e);!(i=n()).done;){var r=i.value;Array.isArray(r)?hl(t,r):t.push(r)}}function ul(t){var e=[];return hl(e,t),e.join("")}m.math=Zn,m.geometry=jc;var cl,ll,_l,dl,fl,pl,gl,ml,vl,yl,Tl,El,Sl,Al,bl,Cl,Rl,wl,Il,xl,Dl,Ol,Pl,Ml,Nl,Ll,Bl,Fl,kl,Ul,Gl,Hl,zl,Vl,Wl,Xl,jl,Yl,Kl,ql,Ql,Zl,Jl,$l,t_=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"}(cl||(cl={})),function(t){t[t.UNREADY=0]="UNREADY",t[t.FAILED=1]="FAILED",t[t.SUCCESS=2]="SUCCESS"}(ll||(ll={})),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"}(_l||(_l={})),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"}(dl||(dl={})),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.MULTI_SAMPLE_RESOLVE_DEPTH_STENCIL=9]="MULTI_SAMPLE_RESOLVE_DEPTH_STENCIL",t[t.COUNT=10]="COUNT"}(fl||(fl={})),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"}(pl||(pl={})),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"}(gl||(gl={})),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"}(ml||(ml={})),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"}(vl||(vl={})),function(t){t[t.NONE=0]="NONE"}(yl||(yl={})),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"}(Tl||(Tl={})),function(t){t[t.NONE=0]="NONE",t[t.DEVICE=1]="DEVICE",t[t.HOST=2]="HOST"}(El||(El={})),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"}(Sl||(Sl={})),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"}(Al||(Al={})),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",t[t.LAZILY_ALLOCATED=16]="LAZILY_ALLOCATED",t[t.MUTABLE_VIEW_FORMAT=64]="MUTABLE_VIEW_FORMAT",t[t.MUTABLE_STORAGE=128]="MUTABLE_STORAGE"}(bl||(bl={})),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"}(Cl||(Cl={})),function(t){t[t.X1=1]="X1",t[t.X2=2]="X2",t[t.X4=4]="X4",t[t.X8=8]="X8",t[t.X16=16]="X16",t[t.X32=32]="X32",t[t.X64=64]="X64"}(Rl||(Rl={})),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"}(wl||(wl={})),function(t){t[t.NONE=0]="NONE",t[t.POINT=1]="POINT",t[t.LINEAR=2]="LINEAR",t[t.ANISOTROPIC=3]="ANISOTROPIC"}(Il||(Il={})),function(t){t[t.WRAP=0]="WRAP",t[t.MIRROR=1]="MIRROR",t[t.CLAMP=2]="CLAMP",t[t.BORDER=3]="BORDER"}(xl||(xl={})),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"}(Dl||(Dl={})),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"}(Ol||(Ol={})),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"}(Pl||(Pl={})),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"}(Ml||(Ml={})),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"}(Nl||(Nl={})),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"}(Ll||(Ll={})),function(t){t[t.LOAD=0]="LOAD",t[t.CLEAR=1]="CLEAR",t[t.DISCARD=2]="DISCARD"}(Bl||(Bl={})),function(t){t[t.STORE=0]="STORE",t[t.DISCARD=1]="DISCARD"}(Fl||(Fl={})),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"}(kl||(kl={})),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"}(Ul||(Ul={})),function(t){t[t.GRAPHICS=0]="GRAPHICS",t[t.COMPUTE=1]="COMPUTE",t[t.RAY_TRACING=2]="RAY_TRACING"}(Gl||(Gl={})),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"}(Hl||(Hl={})),function(t){t[t.FILL=0]="FILL",t[t.POINT=1]="POINT",t[t.LINE=2]="LINE"}(zl||(zl={})),function(t){t[t.GOURAND=0]="GOURAND",t[t.FLAT=1]="FLAT"}(Vl||(Vl={})),function(t){t[t.NONE=0]="NONE",t[t.FRONT=1]="FRONT",t[t.BACK=2]="BACK"}(Wl||(Wl={})),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"}(Xl||(Xl={})),function(t){t[t.FRONT=1]="FRONT",t[t.BACK=2]="BACK",t[t.ALL=3]="ALL"}(jl||(jl={})),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"}(Yl||(Yl={})),function(t){t[t.GRAPHICS=0]="GRAPHICS",t[t.COMPUTE=1]="COMPUTE",t[t.TRANSFER=2]="TRANSFER"}(Kl||(Kl={})),function(t){t[t.OCCLUSION=0]="OCCLUSION",t[t.PIPELINE_STATISTICS=1]="PIPELINE_STATISTICS",t[t.TIMESTAMP=2]="TIMESTAMP"}(ql||(ql={})),function(t){t[t.PRIMARY=0]="PRIMARY",t[t.SECONDARY=1]="SECONDARY"}(Ql||(Ql={})),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"}(Zl||(Zl={})),function(t){t[t.FULL=0]="FULL",t[t.SPLIT_BEGIN=1]="SPLIT_BEGIN",t[t.SPLIT_END=2]="SPLIT_END"}(Jl||(Jl={})),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"}($l||($l={}));var e_,i_=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}(),n_=function(){function t(t,e,i,n,r,s,o,a,h,u,c,l,_,d,f,p,g,m,v,y,T,E,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===o&&(o=0),void 0===a&&(a=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===d&&(d=0),void 0===f&&(f=0),void 0===p&&(p=1),void 0===g&&(g=0),void 0===m&&(m=0),void 0===v&&(v=new i_),void 0===y&&(y=new i_),void 0===T&&(T=!1),void 0===E&&(E=-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=o,this.maxShaderStorageBufferBindings=a,this.maxShaderStorageBlockSize=h,this.maxUniformBufferBindings=u,this.maxUniformBlockSize=c,this.maxTextureSize=l,this.maxCubeMapTextureSize=_,this.maxArrayTextureLayers=d,this.max3DTextureSize=f,this.uboOffsetAlignment=p,this.maxComputeSharedMemorySize=g,this.maxComputeWorkGroupInvocations=m,this.maxComputeWorkGroupSize=v,this.maxComputeWorkGroupCount=y,this.supportQuery=T,this.clipSpaceMinZ=E,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}(),r_=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}(),s_=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}(),o_=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}(),a_=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}(),h_=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}(),u_=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}(),c_=function(){function t(t,e,i,n,r){void 0===t&&(t=new h_),void 0===e&&(e=new s_),void 0===i&&(i=new h_),void 0===n&&(n=new s_),void 0===r&&(r=new a_),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}(),l_=function(){function t(t,e,i,n,r,s){void 0===t&&(t=new h_),void 0===e&&(e=new s_),void 0===i&&(i=new a_),void 0===n&&(n=new h_),void 0===r&&(r=new s_),void 0===s&&(s=new a_),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}(),__=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 s_),void 0===r&&(r=new a_),void 0===s&&(s=new h_),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}(),d_=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}var e=t.prototype;return e.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},e.reset=function(){this.left=0,this.top=0,this.width=0,this.height=0,this.minDepth=0,this.maxDepth=1},t}(),f_=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},e.reset=function(){this.x=0,this.y=0,this.z=0,this.w=0},t}(),p_=function(){function t(t,e,i,n,r,s,o,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===o&&(o=[0]),void 0===a&&(a=[0]),this.maxBlockCounts=t,this.maxSamplerTextureCounts=e,this.maxSamplerCounts=i,this.maxTextureCounts=n,this.maxBufferCounts=r,this.maxImageCounts=s,this.maxSubpassInputCounts=o,this.setIndices=a}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}(),g_=function(){function t(t,e,i,n,r){void 0===t&&(t=0),void 0===e&&(e=null),void 0===i&&(i=wl.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}(),m_=function(){function t(t){void 0===t&&(t=new p_),this.bindingMappingInfo=t}return t.prototype.copy=function(t){return this.bindingMappingInfo.copy(t.bindingMappingInfo),this},t}(),v_=function(){function t(t,e,i,n,r){void 0===t&&(t=vl.NONE),void 0===e&&(e=El.NONE),void 0===i&&(i=0),void 0===n&&(n=1),void 0===r&&(r=yl.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}(),y_=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}(),T_=function(){function t(t,e,i,n,r,s,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===o&&(o=0),this.vertexCount=t,this.firstVertex=e,this.indexCount=i,this.firstIndex=n,this.vertexOffset=r,this.instanceCount=s,this.firstInstance=o}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}(),E_=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}(),S_=function(){function t(t){void 0===t&&(t=[]),this.drawInfos=t}return t.prototype.copy=function(t){return t_(this.drawInfos,t.drawInfos,T_),this},t}(),A_=function(){function t(t,e,i,n,r,s,o,a,h,u,c){void 0===t&&(t=Sl.TEX2D),void 0===e&&(e=Al.NONE),void 0===i&&(i=pl.UNKNOWN),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=bl.NONE),void 0===o&&(o=1),void 0===a&&(a=1),void 0===h&&(h=Rl.X1),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=o,this.levelCount=a,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}(),b_=function(){function t(t,e,i,n,r,s,o){void 0===t&&(t=null),void 0===e&&(e=Sl.TEX2D),void 0===i&&(i=pl.UNKNOWN),void 0===n&&(n=0),void 0===r&&(r=1),void 0===s&&(s=0),void 0===o&&(o=1),this.texture=t,this.type=e,this.format=i,this.baseLevel=n,this.levelCount=r,this.baseLayer=s,this.layerCount=o}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}(),C_=function(){function t(t,e,i,n,r,s,o,a){void 0===t&&(t=Il.LINEAR),void 0===e&&(e=Il.LINEAR),void 0===i&&(i=Il.NONE),void 0===n&&(n=xl.WRAP),void 0===r&&(r=xl.WRAP),void 0===s&&(s=xl.WRAP),void 0===o&&(o=0),void 0===a&&(a=Dl.ALWAYS),this.minFilter=t,this.magFilter=e,this.mipFilter=i,this.addressU=n,this.addressV=r,this.addressW=s,this.maxAnisotropy=o,this.cmpFunc=a}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}(),R_=function(){function t(t,e,i){void 0===t&&(t=""),void 0===e&&(e=ml.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}(),w_=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,t_(this.members,t.members,R_),this.count=t.count,this.flattened=t.flattened,this},t}(),I_=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=ml.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}(),x_=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}(),D_=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=ml.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}(),O_=function(){function t(t,e,i,n,r,s,o){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=""),void 0===n&&(n=ml.UNKNOWN),void 0===r&&(r=0),void 0===s&&(s=Tl.READ_WRITE),void 0===o&&(o=0),this.set=t,this.binding=e,this.name=i,this.type=n,this.count=r,this.memoryAccess=s,this.flattened=o}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}(),P_=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=Tl.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}(),M_=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}(),N_=function(){function t(t,e){void 0===t&&(t=Ll.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}(),L_=function(){function t(t,e,i,n,r,s){void 0===t&&(t=""),void 0===e&&(e=pl.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}(),B_=function(){function t(t,e,i,n,r,s,o,a,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===o&&(o=[]),void 0===a&&(a=[]),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=o,this.textures=a,this.images=h,this.subpassInputs=u}return t.prototype.copy=function(t){return this.name=t.name,t_(this.stages,t.stages,N_),t_(this.attributes,t.attributes,L_),t_(this.blocks,t.blocks,w_),t_(this.buffers,t.buffers,P_),t_(this.samplerTextures,t.samplerTextures,I_),t_(this.samplers,t.samplers,x_),t_(this.textures,t.textures,D_),t_(this.images,t.images,O_),t_(this.subpassInputs,t.subpassInputs,M_),this},t}(),F_=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 t_(this.attributes,t.attributes,L_),this.vertexBuffers=t.vertexBuffers.slice(),this.indexBuffer=t.indexBuffer,this.indirectBuffer=t.indirectBuffer,this},t}(),k_=function(){function t(t,e,i,n,r){void 0===t&&(t=pl.UNKNOWN),void 0===e&&(e=Rl.X1),void 0===i&&(i=Bl.CLEAR),void 0===n&&(n=Fl.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}(),U_=function(){function t(t,e,i,n,r,s,o){void 0===t&&(t=pl.UNKNOWN),void 0===e&&(e=Rl.X1),void 0===i&&(i=Bl.CLEAR),void 0===n&&(n=Fl.STORE),void 0===r&&(r=Bl.CLEAR),void 0===s&&(s=Fl.STORE),void 0===o&&(o=null),this.format=t,this.sampleCount=e,this.depthLoadOp=i,this.depthStoreOp=n,this.stencilLoadOp=r,this.stencilStoreOp=s,this.barrier=o}return t.prototype.copy=function(t){return this.format=t.format,this.sampleCount=t.sampleCount,this.depthLoadOp=t.depthLoadOp,this.depthStoreOp=t.depthStoreOp,this.stencilLoadOp=t.stencilLoadOp,this.stencilStoreOp=t.stencilStoreOp,this.barrier=t.barrier,this},t}(),G_=function(){function t(t,e,i,n,r,s,o,a){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===o&&(o=Ul.NONE),void 0===a&&(a=Ul.NONE),this.inputs=t,this.colors=e,this.resolves=i,this.preserves=n,this.depthStencil=r,this.depthStencilResolve=s,this.depthResolveMode=o,this.stencilResolveMode=a}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}(),H_=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=[kl.NONE]),void 0===r&&(r=[kl.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}(),z_=function(){function t(t,e,i,n,r){void 0===t&&(t=[]),void 0===e&&(e=null),void 0===i&&(i=null),void 0===n&&(n=[]),void 0===r&&(r=[]),this.colorAttachments=t,this.depthStencilAttachment=e,this.depthStencilResolveAttachment=i,this.subpasses=n,this.dependencies=r}return t.prototype.copy=function(t){return t_(this.colorAttachments,t.colorAttachments,k_),t.depthStencilAttachment&&this.depthStencilAttachment&&this.depthStencilAttachment.copy(t.depthStencilAttachment),t.depthStencilResolveAttachment&&this.depthStencilResolveAttachment&&this.depthStencilResolveAttachment.copy(t.depthStencilResolveAttachment),t_(this.subpasses,t.subpasses,G_),t_(this.dependencies,t.dependencies,H_),this},t}(),V_=function(){function t(t,e,i){void 0===t&&(t=kl.NONE),void 0===e&&(e=kl.NONE),void 0===i&&(i=Jl.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}(),W_=function(){function t(t,e,i,n,r,s,o,a,h,u){void 0===t&&(t=kl.NONE),void 0===e&&(e=kl.NONE),void 0===i&&(i=Jl.FULL),void 0===n&&(n=0),void 0===r&&(r=1),void 0===s&&(s=0),void 0===o&&(o=1),void 0===a&&(a=!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=o,this.discardContents=a,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}(),X_=function(){function t(t,e,i,n,r,s,o,a){void 0===t&&(t=kl.NONE),void 0===e&&(e=kl.NONE),void 0===i&&(i=Jl.FULL),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=!1),void 0===o&&(o=null),void 0===a&&(a=null),this.prevAccesses=t,this.nextAccesses=e,this.type=i,this.offset=n,this.size=r,this.discardContents=s,this.srcQueue=o,this.dstQueue=a}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}(),j_=function(){function t(t,e,i,n){void 0===t&&(t=null),void 0===e&&(e=[]),void 0===i&&(i=null),void 0===n&&(n=null),this.renderPass=t,this.colorTextures=e,this.depthStencilTexture=i,this.depthStencilResolveTexture=n}return t.prototype.copy=function(t){return this.renderPass=t.renderPass,this.colorTextures=t.colorTextures.slice(),this.depthStencilTexture=t.depthStencilTexture,this.depthStencilResolveTexture=t.depthStencilResolveTexture,this},t}(),Y_=function(){function t(t,e,i,n,r){void 0===t&&(t=-1),void 0===e&&(e=Yl.UNKNOWN),void 0===i&&(i=0),void 0===n&&(n=Ll.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}(),K_=function(){function t(t){void 0===t&&(t=[]),this.bindings=t}var e=t.prototype;return e.copy=function(t){return t_(this.bindings,t.bindings,Y_),this},e.reset=function(){this.bindings.length=0},t}(),q_=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}(),Q_=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}(),Z_=function(){function t(t){void 0===t&&(t=[]),this.attributes=t}return t.prototype.copy=function(t){return t_(this.attributes,t.attributes,L_),this},t}(),J_=function(){function t(t,e){void 0===t&&(t=null),void 0===e&&(e=Ql.PRIMARY),this.queue=t,this.type=e}return t.prototype.copy=function(t){return this.queue=t.queue,this.type=t.type,this},t}(),$_=function(){function t(t){void 0===t&&(t=Kl.GRAPHICS),this.type=t}return t.prototype.copy=function(t){return this.type=t.type,this},t}(),td=function(){function t(t,e,i){void 0===t&&(t=ql.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}(),ed=function(t,e,i,n,r,s,o,a){void 0===t&&(t=""),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=gl.NONE),void 0===r&&(r=!1),void 0===s&&(s=!1),void 0===o&&(o=!1),void 0===a&&(a=!1),this.name=t,this.size=e,this.count=i,this.type=n,this.hasAlpha=r,this.hasDepth=s,this.hasStencil=o,this.isCompressed=a},id=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}(),nd=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}(),rd=function(){function t(t,e,i,n,r,s,o,a,h,u,c){void 0===t&&(t=new d_),void 0===e&&(e=new o_),void 0===i&&(i=new f_),void 0===n&&(n=1),void 0===r&&(r=0),void 0===s&&(s=0),void 0===o&&(o=0),void 0===a&&(a=0),void 0===h&&(h=0),void 0===u&&(u=new nd),void 0===c&&(c=new nd),this.viewport=t,this.scissor=e,this.blendConstant=i,this.lineWidth=n,this.depthBiasConstant=r,this.depthBiasClamp=s,this.depthBiasSlope=o,this.depthMinBounds=a,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}(),sd=function(t){function e(i){var n;return(n=t.call(this)||this)._objectType=cl.UNKNOWN,n._objectID=0,n._typedID=0,n._objectType=i,n._objectID=e._idTable[cl.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}(al);sd._idTable=Array(cl.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"}(e_||(e_={}));var od=Object.freeze([new ed("UNKNOWN",0,0,gl.NONE,!1,!1,!1,!1),new ed("A8",1,1,gl.UNORM,!0,!1,!1,!1),new ed("L8",1,1,gl.UNORM,!1,!1,!1,!1),new ed("LA8",1,2,gl.UNORM,!0,!1,!1,!1),new ed("R8",1,1,gl.UNORM,!1,!1,!1,!1),new ed("R8SN",1,1,gl.SNORM,!1,!1,!1,!1),new ed("R8UI",1,1,gl.UINT,!1,!1,!1,!1),new ed("R8I",1,1,gl.INT,!1,!1,!1,!1),new ed("R16F",2,1,gl.FLOAT,!1,!1,!1,!1),new ed("R16UI",2,1,gl.UINT,!1,!1,!1,!1),new ed("R16I",2,1,gl.INT,!1,!1,!1,!1),new ed("R32F",4,1,gl.FLOAT,!1,!1,!1,!1),new ed("R32UI",4,1,gl.UINT,!1,!1,!1,!1),new ed("R32I",4,1,gl.INT,!1,!1,!1,!1),new ed("RG8",2,2,gl.UNORM,!1,!1,!1,!1),new ed("RG8SN",2,2,gl.SNORM,!1,!1,!1,!1),new ed("RG8UI",2,2,gl.UINT,!1,!1,!1,!1),new ed("RG8I",2,2,gl.INT,!1,!1,!1,!1),new ed("RG16F",4,2,gl.FLOAT,!1,!1,!1,!1),new ed("RG16UI",4,2,gl.UINT,!1,!1,!1,!1),new ed("RG16I",4,2,gl.INT,!1,!1,!1,!1),new ed("RG32F",8,2,gl.FLOAT,!1,!1,!1,!1),new ed("RG32UI",8,2,gl.UINT,!1,!1,!1,!1),new ed("RG32I",8,2,gl.INT,!1,!1,!1,!1),new ed("RGB8",3,3,gl.UNORM,!1,!1,!1,!1),new ed("SRGB8",3,3,gl.UNORM,!1,!1,!1,!1),new ed("RGB8SN",3,3,gl.SNORM,!1,!1,!1,!1),new ed("RGB8UI",3,3,gl.UINT,!1,!1,!1,!1),new ed("RGB8I",3,3,gl.INT,!1,!1,!1,!1),new ed("RGB16F",6,3,gl.FLOAT,!1,!1,!1,!1),new ed("RGB16UI",6,3,gl.UINT,!1,!1,!1,!1),new ed("RGB16I",6,3,gl.INT,!1,!1,!1,!1),new ed("RGB32F",12,3,gl.FLOAT,!1,!1,!1,!1),new ed("RGB32UI",12,3,gl.UINT,!1,!1,!1,!1),new ed("RGB32I",12,3,gl.INT,!1,!1,!1,!1),new ed("RGBA8",4,4,gl.UNORM,!0,!1,!1,!1),new ed("BGRA8",4,4,gl.UNORM,!0,!1,!1,!1),new ed("SRGB8_A8",4,4,gl.UNORM,!0,!1,!1,!1),new ed("RGBA8SN",4,4,gl.SNORM,!0,!1,!1,!1),new ed("RGBA8UI",4,4,gl.UINT,!0,!1,!1,!1),new ed("RGBA8I",4,4,gl.INT,!0,!1,!1,!1),new ed("RGBA16F",8,4,gl.FLOAT,!0,!1,!1,!1),new ed("RGBA16UI",8,4,gl.UINT,!0,!1,!1,!1),new ed("RGBA16I",8,4,gl.INT,!0,!1,!1,!1),new ed("RGBA32F",16,4,gl.FLOAT,!0,!1,!1,!1),new ed("RGBA32UI",16,4,gl.UINT,!0,!1,!1,!1),new ed("RGBA32I",16,4,gl.INT,!0,!1,!1,!1),new ed("R5G6B5",2,3,gl.UNORM,!1,!1,!1,!1),new ed("R11G11B10F",4,3,gl.FLOAT,!1,!1,!1,!1),new ed("RGB5A1",2,4,gl.UNORM,!0,!1,!1,!1),new ed("RGBA4",2,4,gl.UNORM,!0,!1,!1,!1),new ed("RGB10A2",2,4,gl.UNORM,!0,!1,!1,!1),new ed("RGB10A2UI",2,4,gl.UINT,!0,!1,!1,!1),new ed("RGB9E5",2,4,gl.FLOAT,!0,!1,!1,!1),new ed("DEPTH",4,1,gl.FLOAT,!1,!0,!1,!1),new ed("DEPTH_STENCIL",5,2,gl.FLOAT,!1,!0,!0,!1),new ed("BC1",1,3,gl.UNORM,!1,!1,!1,!0),new ed("BC1_ALPHA",1,4,gl.UNORM,!0,!1,!1,!0),new ed("BC1_SRGB",1,3,gl.UNORM,!1,!1,!1,!0),new ed("BC1_SRGB_ALPHA",1,4,gl.UNORM,!0,!1,!1,!0),new ed("BC2",1,4,gl.UNORM,!0,!1,!1,!0),new ed("BC2_SRGB",1,4,gl.UNORM,!0,!1,!1,!0),new ed("BC3",1,4,gl.UNORM,!0,!1,!1,!0),new ed("BC3_SRGB",1,4,gl.UNORM,!0,!1,!1,!0),new ed("BC4",1,1,gl.UNORM,!1,!1,!1,!0),new ed("BC4_SNORM",1,1,gl.SNORM,!1,!1,!1,!0),new ed("BC5",1,2,gl.UNORM,!1,!1,!1,!0),new ed("BC5_SNORM",1,2,gl.SNORM,!1,!1,!1,!0),new ed("BC6H_UF16",1,3,gl.UFLOAT,!1,!1,!1,!0),new ed("BC6H_SF16",1,3,gl.FLOAT,!1,!1,!1,!0),new ed("BC7",1,4,gl.UNORM,!0,!1,!1,!0),new ed("BC7_SRGB",1,4,gl.UNORM,!0,!1,!1,!0),new ed("ETC_RGB8",1,3,gl.UNORM,!1,!1,!1,!0),new ed("ETC2_RGB8",1,3,gl.UNORM,!1,!1,!1,!0),new ed("ETC2_SRGB8",1,3,gl.UNORM,!1,!1,!1,!0),new ed("ETC2_RGB8_A1",1,4,gl.UNORM,!0,!1,!1,!0),new ed("ETC2_SRGB8_A1",1,4,gl.UNORM,!0,!1,!1,!0),new ed("ETC2_RGBA8",2,4,gl.UNORM,!0,!1,!1,!0),new ed("ETC2_SRGB8_A8",2,4,gl.UNORM,!0,!1,!1,!0),new ed("EAC_R11",1,1,gl.UNORM,!1,!1,!1,!0),new ed("EAC_R11SN",1,1,gl.SNORM,!1,!1,!1,!0),new ed("EAC_RG11",2,2,gl.UNORM,!1,!1,!1,!0),new ed("EAC_RG11SN",2,2,gl.SNORM,!1,!1,!1,!0),new ed("PVRTC_RGB2",2,3,gl.UNORM,!1,!1,!1,!0),new ed("PVRTC_RGBA2",2,4,gl.UNORM,!0,!1,!1,!0),new ed("PVRTC_RGB4",2,3,gl.UNORM,!1,!1,!1,!0),new ed("PVRTC_RGBA4",2,4,gl.UNORM,!0,!1,!1,!0),new ed("PVRTC2_2BPP",2,4,gl.UNORM,!0,!1,!1,!0),new ed("PVRTC2_4BPP",2,4,gl.UNORM,!0,!1,!1,!0),new ed("ASTC_RGBA_4x4",1,4,gl.UNORM,!0,!1,!1,!0),new ed("ASTC_RGBA_5x4",1,4,gl.UNORM,!0,!1,!1,!0),new ed("ASTC_RGBA_5x5",1,4,gl.UNORM,!0,!1,!1,!0),new ed("ASTC_RGBA_6x5",1,4,gl.UNORM,!0,!1,!1,!0),new ed("ASTC_RGBA_6x6",1,4,gl.UNORM,!0,!1,!1,!0),new ed("ASTC_RGBA_8x5",1,4,gl.UNORM,!0,!1,!1,!0),new ed("ASTC_RGBA_8x6",1,4,gl.UNORM,!0,!1,!1,!0),new ed("ASTC_RGBA_8x8",1,4,gl.UNORM,!0,!1,!1,!0),new ed("ASTC_RGBA_10x5",1,4,gl.UNORM,!0,!1,!1,!0),new ed("ASTC_RGBA_10x6",1,4,gl.UNORM,!0,!1,!1,!0),new ed("ASTC_RGBA_10x8",1,4,gl.UNORM,!0,!1,!1,!0),new ed("ASTC_RGBA_10x10",1,4,gl.UNORM,!0,!1,!1,!0),new ed("ASTC_RGBA_12x10",1,4,gl.UNORM,!0,!1,!1,!0),new ed("ASTC_RGBA_12x12",1,4,gl.UNORM,!0,!1,!1,!0),new ed("ASTC_SRGBA_4x4",1,4,gl.UNORM,!0,!1,!1,!0),new ed("ASTC_SRGBA_5x4",1,4,gl.UNORM,!0,!1,!1,!0),new ed("ASTC_SRGBA_5x5",1,4,gl.UNORM,!0,!1,!1,!0),new ed("ASTC_SRGBA_6x5",1,4,gl.UNORM,!0,!1,!1,!0),new ed("ASTC_SRGBA_6x6",1,4,gl.UNORM,!0,!1,!1,!0),new ed("ASTC_SRGBA_8x5",1,4,gl.UNORM,!0,!1,!1,!0),new ed("ASTC_SRGBA_8x6",1,4,gl.UNORM,!0,!1,!1,!0),new ed("ASTC_SRGBA_8x8",1,4,gl.UNORM,!0,!1,!1,!0),new ed("ASTC_SRGBA_10x5",1,4,gl.UNORM,!0,!1,!1,!0),new ed("ASTC_SRGBA_10x6",1,4,gl.UNORM,!0,!1,!1,!0),new ed("ASTC_SRGBA_10x8",1,4,gl.UNORM,!0,!1,!1,!0),new ed("ASTC_SRGBA_10x10",1,4,gl.UNORM,!0,!1,!1,!0),new ed("ASTC_SRGBA_12x10",1,4,gl.UNORM,!0,!1,!1,!0),new ed("ASTC_SRGBA_12x12",1,4,gl.UNORM,!0,!1,!1,!0)]),ad=Yl.UNIFORM_BUFFER|Yl.DYNAMIC_UNIFORM_BUFFER|Yl.STORAGE_BUFFER|Yl.DYNAMIC_STORAGE_BUFFER,hd=Yl.SAMPLER_TEXTURE|Yl.SAMPLER|Yl.TEXTURE|Yl.STORAGE_IMAGE|Yl.INPUT_ATTACHMENT,ud=Yl.DYNAMIC_STORAGE_BUFFER|Yl.DYNAMIC_UNIFORM_BUFFER;function cd(t){return t>0&&0==(t&t-1)}function ld(t,e,i,n){if(!od[t].isCompressed)return e*i*n*od[t].size;switch(t){case pl.BC1:case pl.BC1_ALPHA:case pl.BC1_SRGB:case pl.BC1_SRGB_ALPHA:return Math.ceil(e/4)*Math.ceil(i/4)*8*n;case pl.BC2:case pl.BC2_SRGB:case pl.BC3:case pl.BC3_SRGB:case pl.BC4:case pl.BC4_SNORM:case pl.BC6H_SF16:case pl.BC6H_UF16:case pl.BC7:case pl.BC7_SRGB:return Math.ceil(e/4)*Math.ceil(i/4)*16*n;case pl.BC5:case pl.BC5_SNORM:return Math.ceil(e/4)*Math.ceil(i/4)*32*n;case pl.ETC_RGB8:case pl.ETC2_RGB8:case pl.ETC2_SRGB8:case pl.ETC2_RGB8_A1:case pl.EAC_R11:case pl.EAC_R11SN:return Math.ceil(e/4)*Math.ceil(i/4)*8*n;case pl.ETC2_RGBA8:case pl.ETC2_SRGB8_A1:case pl.EAC_RG11:case pl.EAC_RG11SN:return Math.ceil(e/4)*Math.ceil(i/4)*16*n;case pl.PVRTC_RGB2:case pl.PVRTC_RGBA2:case pl.PVRTC2_2BPP:return Math.ceil(e/8)*Math.ceil(i/4)*8*n;case pl.PVRTC_RGB4:case pl.PVRTC_RGBA4:case pl.PVRTC2_4BPP:return Math.ceil(e/4)*Math.ceil(i/4)*8*n;case pl.ASTC_RGBA_4X4:case pl.ASTC_SRGBA_4X4:return Math.ceil(e/4)*Math.ceil(i/4)*16*n;case pl.ASTC_RGBA_5X4:case pl.ASTC_SRGBA_5X4:return Math.ceil(e/5)*Math.ceil(i/4)*16*n;case pl.ASTC_RGBA_5X5:case pl.ASTC_SRGBA_5X5:return Math.ceil(e/5)*Math.ceil(i/5)*16*n;case pl.ASTC_RGBA_6X5:case pl.ASTC_SRGBA_6X5:return Math.ceil(e/6)*Math.ceil(i/5)*16*n;case pl.ASTC_RGBA_6X6:case pl.ASTC_SRGBA_6X6:return Math.ceil(e/6)*Math.ceil(i/6)*16*n;case pl.ASTC_RGBA_8X5:case pl.ASTC_SRGBA_8X5:return Math.ceil(e/8)*Math.ceil(i/5)*16*n;case pl.ASTC_RGBA_8X6:case pl.ASTC_SRGBA_8X6:return Math.ceil(e/8)*Math.ceil(i/6)*16*n;case pl.ASTC_RGBA_8X8:case pl.ASTC_SRGBA_8X8:return Math.ceil(e/8)*Math.ceil(i/8)*16*n;case pl.ASTC_RGBA_10X5:case pl.ASTC_SRGBA_10X5:return Math.ceil(e/10)*Math.ceil(i/5)*16*n;case pl.ASTC_RGBA_10X6:case pl.ASTC_SRGBA_10X6:return Math.ceil(e/10)*Math.ceil(i/6)*16*n;case pl.ASTC_RGBA_10X8:case pl.ASTC_SRGBA_10X8:return Math.ceil(e/10)*Math.ceil(i/8)*16*n;case pl.ASTC_RGBA_10X10:case pl.ASTC_SRGBA_10X10:return Math.ceil(e/10)*Math.ceil(i/10)*16*n;case pl.ASTC_RGBA_12X10:case pl.ASTC_SRGBA_12X10:return Math.ceil(e/12)*Math.ceil(i/10)*16*n;case pl.ASTC_RGBA_12X12:case pl.ASTC_SRGBA_12X12:return Math.ceil(e/12)*Math.ceil(i/12)*16*n;default:return 0}}function _d(t,e,i,n,r){for(var s=0,o=0;o<r;++o)s+=ld(t,e,i,n),e=Math.max(e>>1,1),i=Math.max(i>>1,1);return s}var dd=[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 fd(t){return dd[t]||0}function pd(t){if(t.isCompressed)return Uint8Array;var e=t.size/t.count;switch(t.type){case gl.UNORM:case gl.UINT:switch(e){case 1:return Uint8Array;case 2:return Uint16Array;case 4:return Uint32Array;default:return Uint8Array}case gl.SNORM:case gl.INT:switch(e){case 1:return Int8Array;case 2:return Int16Array;case 4:return Int32Array;default:return Int8Array}case gl.FLOAT:switch(e){case 2:return Uint16Array;case 4:default:return Float32Array}}return Float32Array}function gd(t){switch(t){case pl.BC1:case pl.BC1_ALPHA:case pl.BC1_SRGB:case pl.BC1_SRGB_ALPHA:case pl.BC2:case pl.BC2_SRGB:case pl.BC3:case pl.BC3_SRGB:case pl.BC4:case pl.BC4_SNORM:case pl.BC6H_SF16:case pl.BC6H_UF16:case pl.BC7:case pl.BC7_SRGB:case pl.BC5:case pl.BC5_SNORM:case pl.ETC_RGB8:case pl.ETC2_RGB8:case pl.ETC2_SRGB8:case pl.ETC2_RGB8_A1:case pl.EAC_R11:case pl.EAC_R11SN:case pl.ETC2_RGBA8:case pl.ETC2_SRGB8_A1:case pl.EAC_RG11:case pl.EAC_RG11SN:return{width:4,height:4};case pl.PVRTC_RGB2:case pl.PVRTC_RGBA2:case pl.PVRTC2_2BPP:return{width:8,height:4};case pl.PVRTC_RGB4:case pl.PVRTC_RGBA4:case pl.PVRTC2_4BPP:return{width:4,height:4};case pl.ASTC_RGBA_4X4:case pl.ASTC_SRGBA_4X4:return{width:4,height:4};case pl.ASTC_RGBA_5X4:case pl.ASTC_SRGBA_5X4:return{width:5,height:4};case pl.ASTC_RGBA_5X5:case pl.ASTC_SRGBA_5X5:return{width:5,height:5};case pl.ASTC_RGBA_6X5:case pl.ASTC_SRGBA_6X5:return{width:6,height:5};case pl.ASTC_RGBA_6X6:case pl.ASTC_SRGBA_6X6:return{width:6,height:6};case pl.ASTC_RGBA_8X5:case pl.ASTC_SRGBA_8X5:return{width:8,height:5};case pl.ASTC_RGBA_8X6:case pl.ASTC_SRGBA_8X6:return{width:8,height:6};case pl.ASTC_RGBA_8X8:case pl.ASTC_SRGBA_8X8:return{width:8,height:8};case pl.ASTC_RGBA_10X5:case pl.ASTC_SRGBA_10X5:return{width:10,height:5};case pl.ASTC_RGBA_10X6:case pl.ASTC_SRGBA_10X6:return{width:10,height:6};case pl.ASTC_RGBA_10X8:case pl.ASTC_SRGBA_10X8:return{width:10,height:8};case pl.ASTC_RGBA_10X10:case pl.ASTC_SRGBA_10X10:return{width:10,height:10};case pl.ASTC_RGBA_12X10:case pl.ASTC_SRGBA_12X10:return{width:12,height:10};case pl.ASTC_RGBA_12X12:case pl.ASTC_SRGBA_12X12:return{width:12,height:12};default:return{width:1,height:1}}}function md(t,e){return Math.ceil(t/e)*e}var vd=Object.freeze({__proto__:null,get ObjectType(){return cl},get Status(){return ll},get API(){return _l},get SurfaceTransform(){return dl},get Feature(){return fl},get Format(){return pl},get FormatType(){return gl},get Type(){return ml},get BufferUsageBit(){return vl},get BufferFlagBit(){return yl},get MemoryAccessBit(){return Tl},get MemoryUsageBit(){return El},get TextureType(){return Sl},get TextureUsageBit(){return Al},get TextureFlagBit(){return bl},get FormatFeatureBit(){return Cl},get SampleCount(){return Rl},get VsyncMode(){return wl},get Filter(){return Il},get Address(){return xl},get ComparisonFunc(){return Dl},get StencilOp(){return Ol},get BlendFactor(){return Pl},get BlendOp(){return Ml},get ColorMask(){return Nl},get ShaderStageFlagBit(){return Ll},get LoadOp(){return Bl},get StoreOp(){return Fl},get AccessFlagBit(){return kl},get ResolveMode(){return Ul},get PipelineBindPoint(){return Gl},get PrimitiveMode(){return Hl},get PolygonMode(){return zl},get ShadeModel(){return Vl},get CullMode(){return Wl},get DynamicStateFlagBit(){return Xl},get StencilFace(){return jl},get DescriptorType(){return Yl},get QueueType(){return Kl},get QueryType(){return ql},get CommandBufferType(){return Ql},get ClearFlagBit(){return Zl},get BarrierType(){return Jl},get PassType(){return $l},Size:i_,DeviceCaps:n_,DeviceOptions:r_,Offset:s_,Rect:o_,Extent:a_,TextureSubresLayers:h_,TextureSubresRange:u_,TextureCopy:c_,TextureBlit:l_,BufferTextureCopy:__,Viewport:d_,Color:f_,BindingMappingInfo:p_,SwapchainInfo:g_,DeviceInfo:m_,BufferInfo:v_,BufferViewInfo:y_,DrawInfo:T_,DispatchInfo:E_,IndirectBuffer:S_,TextureInfo:A_,TextureViewInfo:b_,SamplerInfo:C_,Uniform:R_,UniformBlock:w_,UniformSamplerTexture:I_,UniformSampler:x_,UniformTexture:D_,UniformStorageImage:O_,UniformStorageBuffer:P_,UniformInputAttachment:M_,ShaderStage:N_,Attribute:L_,ShaderInfo:B_,InputAssemblerInfo:F_,ColorAttachment:k_,DepthStencilAttachment:U_,SubpassInfo:G_,SubpassDependency:H_,RenderPassInfo:z_,GeneralBarrierInfo:V_,TextureBarrierInfo:W_,BufferBarrierInfo:X_,FramebufferInfo:j_,DescriptorSetLayoutBinding:Y_,DescriptorSetLayoutInfo:K_,DescriptorSetInfo:q_,PipelineLayoutInfo:Q_,InputState:Z_,CommandBufferInfo:J_,QueueInfo:$_,QueryPoolInfo:td,FormatInfo:ed,MemoryStatus:id,DynamicStencilStates:nd,DynamicStates:rd,GFXObject:sd,get AttributeName(){return e_},FormatInfos:od,DESCRIPTOR_BUFFER_TYPE:ad,DESCRIPTOR_SAMPLER_TYPE:hd,DESCRIPTOR_DYNAMIC_TYPE:ud,DRAW_INFO_SIZE:28,IsPowerOf2:cd,FormatSize:ld,FormatSurfaceSize:_d,GetTypeSize:fd,getTypedArrayConstructor:pd,formatAlignment:gd,alignTo:md}),yd=function(t){function e(){var e;return(e=t.call(this,cl.BUFFER)||this)._usage=vl.NONE,e._memUsage=El.NONE,e._size=0,e._stride=1,e._count=0,e._flags=yl.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}(sd),Td=function(t){function e(){var e;return(e=t.call(this,cl.COMMAND_BUFFER)||this)._queue=null,e._type=Ql.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}(sd),Ed=function(){function t(){this._gfxAPI=_l.UNKNOWN,this._renderer="",this._vendor="",this._features=new Array(fl.COUNT),this._formatFeatures=new Array(pl.COUNT),this._queue=null,this._cmdBuff=null,this._numDrawCalls=0,this._numInstances=0,this._numTris=0,this._memoryStatus=new id,this._caps=new n_,this._bindingMappingInfo=new p_,this._samplers=new Map,this._generalBarrierss=new Map,this._textureBarriers=new Map,this._bufferBarriers=new Map,this._swapchainFormat=pl.RGBA8}var e=t.prototype;return e.hasFeature=function(t){return this._features[t]},e.getFormatFeatures=function(t){return this._formatFeatures[t]},e.enableAutoBarrier=function(){},e.getMaxSampleCount=function(){return Rl.X1},n(t,[{key:"gfxAPI",get:function(){return this._gfxAPI}},{key:"queue",get:function(){return this._queue}},{key:"commandBuffer",get:function(){return this._cmdBuff}},{key:"swapchainFormat",get:function(){return this._swapchainFormat}},{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}();Ed.canvas=void 0;var Sd=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 A_(Sl.TEX2D,Al.STORAGE|Al.SAMPLED,pl.RGBA8,2,2,bl.NONE));var i=new __(0,0,0,new s_(0,0,0),new a_(2,2,1));t.copyBuffersToTexture([e],this._texture2D,[i])}if(t.capabilities.maxTextureSize>=2){this._textureCube=t.createTexture(new A_(Sl.CUBE,Al.STORAGE|Al.SAMPLED,pl.RGBA8,2,2,bl.NONE,6));var n=new __(0,0,0,new s_(0,0,0),new a_(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 A_(Sl.TEX3D,Al.STORAGE|Al.SAMPLED,pl.RGBA8,2,2,bl.NONE,1,1,Rl.X1,2));var r=new __(0,0,0,new s_(0,0,0),new a_(2,2,2),new h_(0,0,1));t.copyBuffersToTexture([e],this._texture3D,[r])}if(t.capabilities.maxArrayTextureLayers>=2){this._texture2DArray=t.createTexture(new A_(Sl.TEX2D_ARRAY,Al.STORAGE|Al.SAMPLED,pl.RGBA8,2,2,bl.NONE,2));var s=new __(0,0,0,new s_(0,0,0),new a_(2,2,1),new h_(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 Sl.TEX2D:return this._texture2D;case Sl.TEX3D:return this._texture3D;case Sl.CUBE:return this._textureCube;case Sl.TEX2D_ARRAY:return this._texture2DArray;default:return null}},t}(),Ad=function(t){function e(){var e;return(e=t.call(this,cl.SWAPCHAIN)||this)._transform=dl.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}(sd),bd=function(t){function e(){var e;return(e=t.call(this,cl.FRAMEBUFFER)||this)._renderPass=null,e._colorTextures=[],e._depthStencilTexture=null,e._width=0,e._height=0,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}},{key:"width",get:function(){return this.colorTextures.length>0?this.colorTextures[0].width:this.depthStencilTexture?this.depthStencilTexture.width:this._width}},{key:"height",get:function(){return this.colorTextures.length>0?this.colorTextures[0].height:this.depthStencilTexture?this.depthStencilTexture.height:this._height}},{key:"needRebuild",get:function(){return!1}}]),e}(sd),Cd=function(t){function e(){var e;return(e=t.call(this,cl.INPUT_ASSEMBLER)||this)._attributes=[],e._attributesHash=0,e._vertexBuffers=[],e._indexBuffer=null,e._indirectBuffer=null,e._drawInfo=new T_,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 nl(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}(sd),Rd=function(t){function e(){var e;return(e=t.call(this,cl.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&ad){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&hd){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,n){void 0===i&&(i=0),void 0===n&&(n=kl.NONE);var r=this._layout.bindingIndices[t],s=this._layout.bindings[r];if(s&&s.descriptorType&hd){var o=this._layout.descriptorIndices[t];this._textures[o+i]!==e&&(this._textures[o+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}(sd),wd=function(t){function e(){var e;return(e=t.call(this,cl.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}(sd),Id=function(t){function e(){var e;return(e=t.call(this,cl.PIPELINE_LAYOUT)||this)._setLayouts=[],e}return s(e,t),n(e,[{key:"setLayouts",get:function(){return this._setLayouts}}]),e}(sd),xd=function(){function t(t,e,i,n,r,s,o,a,h,u,c,l){void 0===t&&(t=!1),void 0===e&&(e=zl.FILL),void 0===i&&(i=Vl.GOURAND),void 0===n&&(n=Wl.BACK),void 0===r&&(r=!0),void 0===s&&(s=!1),void 0===o&&(o=0),void 0===a&&(a=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=o,this.depthBiasClamp=a,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=zl.FILL,this.shadeModel=Vl.GOURAND,this.cullMode=Wl.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}(),Dd=function(){function t(t,e,i,n,r,s,o,a,h,u,c,l,_,d,f,p,g,m,v){void 0===t&&(t=!0),void 0===e&&(e=!0),void 0===i&&(i=Dl.LESS),void 0===n&&(n=!1),void 0===r&&(r=Dl.ALWAYS),void 0===s&&(s=65535),void 0===o&&(o=65535),void 0===a&&(a=Ol.KEEP),void 0===h&&(h=Ol.KEEP),void 0===u&&(u=Ol.KEEP),void 0===c&&(c=1),void 0===l&&(l=!1),void 0===_&&(_=Dl.ALWAYS),void 0===d&&(d=65535),void 0===f&&(f=65535),void 0===p&&(p=Ol.KEEP),void 0===g&&(g=Ol.KEEP),void 0===m&&(m=Ol.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=o,this.stencilFailOpFront=a,this.stencilZFailOpFront=h,this.stencilPassOpFront=u,this.stencilRefFront=c,this.stencilTestBack=l,this.stencilFuncBack=_,this.stencilReadMaskBack=d,this.stencilWriteMaskBack=f,this.stencilFailOpBack=p,this.stencilZFailOpBack=g,this.stencilPassOpBack=m,this.stencilRefBack=v}var e=t.prototype;return e.reset=function(){this.depthTest=!0,this.depthWrite=!0,this.depthFunc=Dl.LESS,this.stencilTestFront=!1,this.stencilFuncFront=Dl.ALWAYS,this.stencilReadMaskFront=65535,this.stencilWriteMaskFront=65535,this.stencilFailOpFront=Ol.KEEP,this.stencilZFailOpFront=Ol.KEEP,this.stencilPassOpFront=Ol.KEEP,this.stencilRefFront=1,this.stencilTestBack=!1,this.stencilFuncBack=Dl.ALWAYS,this.stencilReadMaskBack=65535,this.stencilWriteMaskBack=65535,this.stencilFailOpBack=Ol.KEEP,this.stencilZFailOpBack=Ol.KEEP,this.stencilPassOpBack=Ol.KEEP,this.stencilRefBack=1},e.assign=function(t){Object.assign(this,t)},e.destroy=function(){},n(t,[{key:"native",get:function(){return this}}]),t}(),Od=function(){function t(t,e,i,n,r,s,o,a){void 0===t&&(t=!1),void 0===e&&(e=Pl.ONE),void 0===i&&(i=Pl.ZERO),void 0===n&&(n=Ml.ADD),void 0===r&&(r=Pl.ONE),void 0===s&&(s=Pl.ZERO),void 0===o&&(o=Ml.ADD),void 0===a&&(a=Nl.ALL),this.blend=t,this.blendSrc=e,this.blendDst=i,this.blendEq=n,this.blendSrcAlpha=r,this.blendDstAlpha=s,this.blendAlphaEq=o,this.blendColorMask=a}var e=t.prototype;return e.reset=function(){this.blend=!1,this.blendSrc=Pl.ONE,this.blendDst=Pl.ZERO,this.blendEq=Ml.ADD,this.blendSrcAlpha=Pl.ONE,this.blendDstAlpha=Pl.ZERO,this.blendAlphaEq=Ml.ADD,this.blendColorMask=Nl.ALL},e.assign=function(t){Object.assign(this,t)},e.destroy=function(){},t}(),Pd=function(){function t(t,e,i,n){void 0===t&&(t=!1),void 0===e&&(e=!1),void 0===i&&(i=new f_),void 0===n&&(n=[new Od]),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 Od),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}(),Md=function(t,e,i,n,r,s,o,a,h,u){void 0===t&&(t=null),void 0===e&&(e=null),void 0===i&&(i=null),void 0===n&&(n=new Z_),void 0===r&&(r=new xd),void 0===s&&(s=new Dd),void 0===o&&(o=new Pd),void 0===a&&(a=Hl.TRIANGLE_LIST),void 0===h&&(h=Xl.NONE),void 0===u&&(u=Gl.GRAPHICS),this.shader=t,this.pipelineLayout=e,this.renderPass=i,this.inputState=n,this.rasterizerState=r,this.depthStencilState=s,this.blendState=o,this.primitive=a,this.dynamicStates=h,this.bindPoint=u},Nd=function(t){function e(){var e;return(e=t.call(this,cl.PIPELINE_STATE)||this)._shader=null,e._pipelineLayout=null,e._primitive=Hl.TRIANGLE_LIST,e._is=null,e._rs=new xd,e._dss=new Dd,e._bs=new Pd,e._dynamicStates=Xl.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}(sd),Ld=function(t){function e(){var e;return(e=t.call(this,cl.QUEUE)||this)._type=Kl.GRAPHICS,e}return s(e,t),n(e,[{key:"type",get:function(){return this._type}}]),e}(sd),Bd=function(t){function e(){var e;return(e=t.call(this,cl.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 o=this._colorInfos[i.inputs[s]];t+=","+o.format+","+o.sampleCount}}if(i.depthStencil>=0){var a=this._colorInfos[i.depthStencil];t+="ds,"+a.format+","+a.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 nl(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}(sd),Fd=function(t){function e(e,i){var n;return(n=t.call(this,cl.SAMPLER)||this)._info=new C_,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 C_;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}(sd),kd=function(t){function e(){var e;return(e=t.call(this,cl.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}},{key:"stages",get:function(){return this._stages}}]),e}(sd),Ud=function(t){function e(){var e;return(e=t.call(this,cl.TEXTURE)||this)._info=new A_,e._viewInfo=new b_,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}(sd),Gd=function(t){function e(e,i){var n;return(n=t.call(this,cl.GLOBAL_BARRIER)||this)._info=new V_,n._hash=0,n._info.copy(e),n._hash=i,n}return s(e,t),e.computeHash=function(t){return nl(t.prevAccesses+" "+t.nextAccesses+" "+t.type,666)},n(e,[{key:"info",get:function(){return this._info}},{key:"hash",get:function(){return this._hash}}]),e}(sd),Hd=function(t){function e(e,i){var n;return(n=t.call(this,cl.TEXTURE_BARRIER)||this)._info=new W_,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,nl(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}(sd),zd=function(t){function e(e,i){var n;return(n=t.call(this,cl.BUFFER_BARRIER)||this)._info=new X_,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,nl(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}(sd),Vd={Device:Ed,Swapchain:Ad,Buffer:yd,Texture:Ud,Sampler:Fd,Shader:kd,InputAssembler:Cd,RenderPass:Bd,Framebuffer:bd,DescriptorSet:Rd,DescriptorSetLayout:wd,PipelineLayout:Id,PipelineState:Nd,CommandBuffer:Td,Queue:Ld,GeneralBarrier:Gd,TextureBarrier:Hd,BufferBarrier:zd,RasterizerState:xd,BlendState:Pd,BlendTarget:Od,DepthStencilState:Dd,PipelineStateInfo:Md};Object.assign(Vd,vd),m.gfx=Vd;var Wd,Xd,jd={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 Yd in jd){var Kd=jd[Yd];!0===Kd?Kd=Yd.slice(3):!1===Kd&&(Kd=Yd),rt(m,"cc",[{name:Yd,newName:Kd,target:m.gfx,targetName:"cc.gfx"}])}st(m,"cc",[{name:"GFX_MAX_VERTEX_ATTRIBUTES"},{name:"GFX_MAX_TEXTURE_UNITS"},{name:"GFX_MAX_ATTACHMENTS"},{name:"GFX_MAX_BUFFER_BINDINGS"},{name:"GFXTextureLayout"}]),st(fl,"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;"}]),st(k_.prototype,"ColorAttachment",[{name:"beginAccesses",suggest:"Please assign to ColorAttachment.barrier instead"},{name:"endAccesses",suggest:"Please assign to ColorAttachment.barrier instead"}]),st(U_.prototype,"DepthStencilAttachment",[{name:"beginAccesses",suggest:"Please assign to DepthStencilAttachment.barrier instead"},{name:"endAccesses",suggest:"Please assign to DepthStencilAttachment.barrier instead"}]),rt(Ed.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",t[t.WEBGPU=4]="WEBGPU"}(Wd||(Wd={})),function(t){t[t.UNKNOWN=-1]="UNKNOWN",t[t.CANVAS=0]="CANVAS",t[t.WEBGL=1]="WEBGL",t[t.WEBGPU=2]="WEBGPU",t[t.OPENGL=3]="OPENGL",t[t.HEADLESS=4]="HEADLESS"}(Xd||(Xd={}));var qd=function(){function t(){this.initialized=!1,this._gfxDevice=void 0,this._canvas=null,this._swapchain=void 0,this._renderType=Xd.UNKNOWN,this._deviceInitialized=!1}var e=t.prototype;return e._tryInitializeWebGPUDevice=function(t,e){var i=this;return this._deviceInitialized?Promise.resolve(!0):t?(this._gfxDevice=new t,new Promise((function(t,n){i._gfxDevice.initialize(e).then((function(e){i._deviceInitialized=e,t(e)})).catch((function(t){n(t)}))}))):Promise.resolve(!1)},e._tryInitializeDeviceSync=function(t,e){return!!this._deviceInitialized||(t&&(this._gfxDevice=new t,this._deviceInitialized=this._gfxDevice.initialize(e)),this._deviceInitialized)},e.init=function(t,e){var i=this;if(this.initialized)return!0;var n=we.querySettings(Ce.Category.RENDERING,"renderMode");this._canvas=t,this._canvas&&(this._canvas.oncontextmenu=function(){return!1}),this._renderType=this._determineRenderType(n),this._deviceInitialized=!1;var r=new m_(e);if(this._renderType===Xd.WEBGL||this._renderType===Xd.WEBGPU){var s=!!globalThis.WebGL2RenderingContext;if(globalThis.navigator.userAgent.toLowerCase(),Fo.browserType===ao.UC&&(s=!1),Ed.canvas=t,this._renderType===Xd.WEBGPU&&m.WebGPUDevice)return new Promise((function(t,e){i._tryInitializeWebGPUDevice(m.WebGPUDevice,r).then((function(e){i._initSwapchain(),t(e)})).catch((function(t){e(t)}))}));s&&m.WebGL2Device&&this._tryInitializeDeviceSync(m.WebGL2Device,r),m.WebGLDevice&&this._tryInitializeDeviceSync(m.WebGLDevice,r),m.EmptyDevice&&this._tryInitializeDeviceSync(m.EmptyDevice,r),this._initSwapchain()}else this._renderType===Xd.HEADLESS&&m.EmptyDevice&&(this._tryInitializeDeviceSync(m.EmptyDevice,r),this._initSwapchain());return!!this._gfxDevice||(Z(16337),this._renderType=Xd.UNKNOWN,!1)},e._initSwapchain=function(){var t=new g_(1,this._canvas),e=Bo.windowSize;t.width=e.width,t.height=e.height,this._swapchain=this._gfxDevice.createSwapchain(t)},e._supportWebGPU=function(){return"gpu"in globalThis.navigator},e._determineRenderType=function(t){("number"!=typeof t||t>Wd.WEBGPU||t<Wd.AUTO)&&(t=Wd.AUTO);var e=Xd.CANVAS,i=!1;if(t===Wd.CANVAS?(e=Xd.CANVAS,i=!0):t===Wd.AUTO||t===Wd.WEBGPU?(e=this._supportWebGPU()?Xd.WEBGPU:Xd.WEBGL,i=!0):t===Wd.WEBGL?(e=Xd.WEBGL,i=!0):t===Wd.HEADLESS&&(e=Xd.HEADLESS,i=!0),!i)throw new Error(et(3820,t));return e},n(t,[{key:"gfxDevice",get:function(){return this._gfxDevice}},{key:"swapchain",get:function(){return this._swapchain}}]),t}(),Qd=new qd;t("gfx",Object.freeze({__proto__:null,DescriptorSet:Rd,Buffer:yd,CommandBuffer:Td,get ObjectType(){return cl},get Status(){return ll},get API(){return _l},get SurfaceTransform(){return dl},get Feature(){return fl},get Format(){return pl},get FormatType(){return gl},get Type(){return ml},get BufferUsageBit(){return vl},get BufferFlagBit(){return yl},get MemoryAccessBit(){return Tl},get MemoryUsageBit(){return El},get TextureType(){return Sl},get TextureUsageBit(){return Al},get TextureFlagBit(){return bl},get FormatFeatureBit(){return Cl},get SampleCount(){return Rl},get VsyncMode(){return wl},get Filter(){return Il},get Address(){return xl},get ComparisonFunc(){return Dl},get StencilOp(){return Ol},get BlendFactor(){return Pl},get BlendOp(){return Ml},get ColorMask(){return Nl},get ShaderStageFlagBit(){return Ll},get LoadOp(){return Bl},get StoreOp(){return Fl},get AccessFlagBit(){return kl},get ResolveMode(){return Ul},get PipelineBindPoint(){return Gl},get PrimitiveMode(){return Hl},get PolygonMode(){return zl},get ShadeModel(){return Vl},get CullMode(){return Wl},get DynamicStateFlagBit(){return Xl},get StencilFace(){return jl},get DescriptorType(){return Yl},get QueueType(){return Kl},get QueryType(){return ql},get CommandBufferType(){return Ql},get ClearFlagBit(){return Zl},get BarrierType(){return Jl},get PassType(){return $l},Size:i_,DeviceCaps:n_,DeviceOptions:r_,Offset:s_,Rect:o_,Extent:a_,TextureSubresLayers:h_,TextureSubresRange:u_,TextureCopy:c_,TextureBlit:l_,BufferTextureCopy:__,Viewport:d_,Color:f_,BindingMappingInfo:p_,SwapchainInfo:g_,DeviceInfo:m_,BufferInfo:v_,BufferViewInfo:y_,DrawInfo:T_,DispatchInfo:E_,IndirectBuffer:S_,TextureInfo:A_,TextureViewInfo:b_,SamplerInfo:C_,Uniform:R_,UniformBlock:w_,UniformSamplerTexture:I_,UniformSampler:x_,UniformTexture:D_,UniformStorageImage:O_,UniformStorageBuffer:P_,UniformInputAttachment:M_,ShaderStage:N_,Attribute:L_,ShaderInfo:B_,InputAssemblerInfo:F_,ColorAttachment:k_,DepthStencilAttachment:U_,SubpassInfo:G_,SubpassDependency:H_,RenderPassInfo:z_,GeneralBarrierInfo:V_,TextureBarrierInfo:W_,BufferBarrierInfo:X_,FramebufferInfo:j_,DescriptorSetLayoutBinding:Y_,DescriptorSetLayoutInfo:K_,DescriptorSetInfo:q_,PipelineLayoutInfo:Q_,InputState:Z_,CommandBufferInfo:J_,QueueInfo:$_,QueryPoolInfo:td,FormatInfo:ed,MemoryStatus:id,DynamicStencilStates:nd,DynamicStates:rd,GFXObject:sd,get AttributeName(){return e_},FormatInfos:od,DESCRIPTOR_BUFFER_TYPE:ad,DESCRIPTOR_SAMPLER_TYPE:hd,DESCRIPTOR_DYNAMIC_TYPE:ud,DRAW_INFO_SIZE:28,IsPowerOf2:cd,FormatSize:ld,FormatSurfaceSize:_d,GetTypeSize:fd,getTypedArrayConstructor:pd,formatAlignment:gd,alignTo:md,Device:Ed,DefaultResource:Sd,Swapchain:Ad,Framebuffer:bd,InputAssembler:Cd,DescriptorSetLayout:wd,PipelineLayout:Id,BlendState:Pd,BlendTarget:Od,RasterizerState:xd,DepthStencilState:Dd,PipelineStateInfo:Md,PipelineState:Nd,Queue:Ld,RenderPass:Bd,Sampler:Fd,Shader:kd,Texture:Ud,GeneralBarrier:Gd,TextureBarrier:Hd,get LegacyRenderMode(){return Wd},get RenderType(){return Xd},DeviceManager:qd,deviceManager:Qd}));var Zd=new on;function Jd(t,e,i,n){var r=i.chunk,s=i.data,o=r.vb,a=i.vertexCount,h=t.worldMatrix,u=h.m00,c=h.m01,l=h.m02,_=h.m03,d=h.m04,f=h.m05,p=h.m06,g=h.m07,m=h.m12,v=h.m13,y=h.m14,T=h.m15;Zd.set(n.r/255,n.g/255,n.b/255,n.a/255);for(var E=0,S=0;S<a;++S){var A=s[S],b=A.x,C=A.y,R=_*b+g*C+T;R=R?1/R:1,o[E+0]=(u*b+d*C+m)*R,o[E+1]=(c*b+f*C+v)*R,o[E+2]=(l*b+p*C+y)*R,on.toArray(o,Zd,E+5),E+=9}r.bufferId;for(var w=r.vertexOffset,I=r.meshBuffer,x=r.meshBuffer.iData,D=I.indexOffset,O=0,P=a/4;O<P;O++){var M=w+4*O;x[D++]=M,x[D++]=M+1,x[D++]=M+2,x[D++]=M+1,x[D++]=M+3,x[D++]=M+2}I.indexOffset+=i.indexCount,I.setDirty()}var $d=function(){function t(t){this._map=null,this._count=0,t?(this._map=t,this._count=Object.keys(t).length):(this._map=Dt(!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=Dt(!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}(),tf=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?(q(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}();tf._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=Dt(!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 ef,nf=new $d,rf=new $d,sf=new $d,of=new $d,af=new tf("normal load",[]),hf=new tf("fetch",[]),uf=new tf("transform url",[]),cf=new Map;!function(t){t.UUID="uuid",t.PATH="path",t.DIR="dir",t.URL="url",t.SCENE="scene"}(ef||(ef={}));var lf,_f={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"}(lf||(lf={}));var df=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}();df.MAX_DEAD_NUM=500,df._taskId=0,df._deadPool=[];var ff="0123456789abcdef".split(""),pf=["","","",""],gf=pf.concat(pf,"-",pf,"-",pf,"-",pf,"-",pf,pf,pf),mf=gf.map((function(t,e){return"-"===t?NaN:e})).filter(Number.isFinite);function vf(t){var e=t.split("@")[0];if(22!==e.length)return t;gf[0]=t[0],gf[1]=t[1];for(var i=2,n=2;i<22;i+=2){var r=Ne[t.charCodeAt(i)],s=Ne[t.charCodeAt(i+1)];gf[mf[n++]]=ff[r>>2],gf[mf[n++]]=ff[(3&r)<<2|s>>4],gf[mf[n++]]=ff[15&s]}return t.replace(e,gf.join(""))}var yf=/.*[/\\][0-9a-fA-F]{2}[/\\]([0-9a-fA-F-@]{8,}).*/;function Tf(t){var e=yf.exec(t);return e?e[1]:""}function Ef(t,e){(e=e||Object.create(null)).__isNative__=e.isNative,e.nativeExt&&(e.ext=e.nativeExt);var i=of.find((function(e){return!!e.getAssetInfo(t)}));return i&&(e.bundle=i.name),bf(t,e)}function Sf(t){return!!t&&(t instanceof m.SceneAsset||t instanceof m.Scene)}function Af(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 bf(t,e){var i=df.create({input:t,options:e}),n=[];try{for(var r,s=d(uf.sync(i));!(r=s()).done;){var o=r.value,a=o.url;o.recycle(),n.push(a)}}catch(t){for(var h,u=d(i.output);!(h=u()).done;)h.value.recycle();k(t.message,t.stack)}return i.recycle(),n.length>1?n:n[0]}var Cf,Rf,wf,If=Object.freeze({__proto__:null,getUuidFromURL:Tf,getUrlWithUuid:Ef,isScene:Sf,normalize:Af,transform:bf,decodeUuid:vf}),xf=wa,Df=Sa,Of=t("Asset",va("cc.Asset")((Rf=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=wf&&wf(),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 m.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&&m.assetManager._releaseManager.tryRelease(this),this},i.onLoaded=function(){},i.initDefault=function(t){t&&(this._uuid=t),this.isDefault=!0},i.validate=function(){return!0},i.destroy=function(){return G(et(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=Ef(this._uuid,{nativeExt:t,isNative:!0}):this._nativeUrl=Ef(this._uuid,{__nativeName__:t,nativeExt:Eo(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}(so(qs)),wf=ua(Rf.prototype,"_native",[xf],(function(){return""})),f(Rf.prototype,"_nativeAsset",[Df],Object.getOwnPropertyDescriptor(Rf.prototype,"_nativeAsset"),Rf.prototype),Cf=Rf))||Cf);Of.prototype.createNode=null,m.Asset=Of;var Pf,Mf,Nf,Lf,Bf,Ff;!function(t){t[t.RGB565=pl.R5G6B5]="RGB565",t[t.RGB5A1=pl.RGB5A1]="RGB5A1",t[t.RGBA4444=pl.RGBA4]="RGBA4444",t[t.RGB888=pl.RGB8]="RGB888",t[t.RGB32F=pl.RGB32F]="RGB32F",t[t.RGBA8888=pl.RGBA8]="RGBA8888",t[t.BGRA8888=pl.BGRA8]="BGRA8888",t[t.RGBA32F=pl.RGBA32F]="RGBA32F",t[t.A8=pl.A8]="A8",t[t.I8=pl.L8]="I8",t[t.AI8=pl.LA8]="AI8",t[t.RGB_PVRTC_2BPPV1=pl.PVRTC_RGB2]="RGB_PVRTC_2BPPV1",t[t.RGBA_PVRTC_2BPPV1=pl.PVRTC_RGBA2]="RGBA_PVRTC_2BPPV1",t[t.RGB_A_PVRTC_2BPPV1=1024]="RGB_A_PVRTC_2BPPV1",t[t.RGB_PVRTC_4BPPV1=pl.PVRTC_RGB4]="RGB_PVRTC_4BPPV1",t[t.RGBA_PVRTC_4BPPV1=pl.PVRTC_RGBA4]="RGBA_PVRTC_4BPPV1",t[t.RGB_A_PVRTC_4BPPV1=1025]="RGB_A_PVRTC_4BPPV1",t[t.RGB_ETC1=pl.ETC_RGB8]="RGB_ETC1",t[t.RGBA_ETC1=1026]="RGBA_ETC1",t[t.RGB_ETC2=pl.ETC2_RGB8]="RGB_ETC2",t[t.RGBA_ETC2=pl.ETC2_RGBA8]="RGBA_ETC2",t[t.RGBA_ASTC_4x4=pl.ASTC_RGBA_4X4]="RGBA_ASTC_4x4",t[t.RGBA_ASTC_5x4=pl.ASTC_RGBA_5X4]="RGBA_ASTC_5x4",t[t.RGBA_ASTC_5x5=pl.ASTC_RGBA_5X5]="RGBA_ASTC_5x5",t[t.RGBA_ASTC_6x5=pl.ASTC_RGBA_6X5]="RGBA_ASTC_6x5",t[t.RGBA_ASTC_6x6=pl.ASTC_RGBA_6X6]="RGBA_ASTC_6x6",t[t.RGBA_ASTC_8x5=pl.ASTC_RGBA_8X5]="RGBA_ASTC_8x5",t[t.RGBA_ASTC_8x6=pl.ASTC_RGBA_8X6]="RGBA_ASTC_8x6",t[t.RGBA_ASTC_8x8=pl.ASTC_RGBA_8X8]="RGBA_ASTC_8x8",t[t.RGBA_ASTC_10x5=pl.ASTC_RGBA_10X5]="RGBA_ASTC_10x5",t[t.RGBA_ASTC_10x6=pl.ASTC_RGBA_10X6]="RGBA_ASTC_10x6",t[t.RGBA_ASTC_10x8=pl.ASTC_RGBA_10X8]="RGBA_ASTC_10x8",t[t.RGBA_ASTC_10x10=pl.ASTC_RGBA_10X10]="RGBA_ASTC_10x10",t[t.RGBA_ASTC_12x10=pl.ASTC_RGBA_12X10]="RGBA_ASTC_12x10",t[t.RGBA_ASTC_12x12=pl.ASTC_RGBA_12X12]="RGBA_ASTC_12x12"}(Pf||(Pf={})),function(t){t[t.REPEAT=xl.WRAP]="REPEAT",t[t.CLAMP_TO_EDGE=xl.CLAMP]="CLAMP_TO_EDGE",t[t.MIRRORED_REPEAT=xl.MIRROR]="MIRRORED_REPEAT",t[t.CLAMP_TO_BORDER=xl.BORDER]="CLAMP_TO_BORDER"}(Mf||(Mf={})),function(t){t[t.NONE=Il.NONE]="NONE",t[t.LINEAR=Il.LINEAR]="LINEAR",t[t.NEAREST=Il.POINT]="NEAREST"}(Nf||(Nf={}));var kf=1346981187,Uf=ye({PVR:0,PKM:1,ASTC:2});function Gf(t,e){return t[e]<<8|t[e+1]}function Hf(t){return!!(Fo.hasFeature(Fo.Feature.IMAGE_BITMAP)&&t instanceof ImageBitmap)}var zf,Vf,Wf,Xf,jf,Yf,Kf,qf,Qf,Zf,Jf,$f=t("ImageAsset",va("cc.ImageAsset")(((Ff=function(t){s(i,t),i.mergeCompressedTextureMips=function(t){var e=new Uint8Array(0);try{for(var i,n=8+4*t.length,r=0,s=d(t);!(i=s()).done;)r+=i.value.byteLength;r+=n,e=new Uint8Array(r);var o=new DataView(e.buffer,e.byteOffset,e.byteLength);o.setUint32(0,kf,!0),o.setUint32(4,t.length,!0);for(var a=n,h=0;h<t.length;h++){var u=t[h];if(o.setUint32(8+4*h,u.byteLength,!0),u instanceof ArrayBuffer){var c=new Uint8Array(u);e.set(c,a)}else{var l=new Uint8Array(u.buffer,u.byteOffset,u.byteLength);e.set(l,a)}a+=u.byteLength}}catch(t){F(t)}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)===kf){var o=s.getUint32(4,!0),a=s.getUint32(8,!0),h=8+4*o;i.parseCompressedTexture(t,0,h,a,e,n);for(var u=h+a,c=1;c<o;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,o){switch(s){case Uf.PVR:i.parsePVRTexture(t,e,n,r,o);break;case Uf.PKM:i.parsePKMTexture(t,e,n,r,o);break;case Uf.ASTC:i.parseASTCTexture(t,e,n,r,o)}},i.parsePVRTexture=function(t,e,i,n,r){var s=t instanceof ArrayBuffer?t:t.buffer,o=new Int32Array(s,i,13);if(55727696===o[0]){var a=i+o[12]+52,h=n-o.byteLength;if(n>0){var u=new Uint8Array(s,a,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,a);r.width=e>0?r.width:o[7],r.height=e>0?r.height:o[6]}else{if(559044176!==o[11])throw new Error("Invalid magic number in PVR header");var l=i+o[0],_=n-o.byteLength;if(n>0){var d=new Uint8Array(s,l,_),f=new Uint8Array(r._data.byteLength+d.byteLength);f.set(r._data),f.set(d,r._data.byteLength),r._data=f,r.mipmapLevelDataSize[e]=_}else r._data=new Uint8Array(s,l);r.width=e>0?r.width:o[1],r.height=e>0?r.height:o[2]}},i.parsePKMTexture=function(t,e,i,n,r){var s=t instanceof ArrayBuffer?t:t.buffer,o=new Uint8Array(s,i,16),a=Gf(o,6);if(0!==a&&1!==a&&3!==a)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:Gf(o,12),r.height=e>0?r.height:Gf(o,14)},i.parseASTCTexture=function(t,e,i,n,r){var s=t instanceof ArrayBuffer?t:t.buffer,o=new Uint8Array(s,i,16);if(1554098963!==o[0]+(o[1]<<8)+(o[2]<<16)+(o[3]<<24))throw new Error("Invalid magic number in ASTC header");var a=o[4],h=o[5],u=o[6];if((a<3||a>6||h<3||h>6||u<3||u>6)&&(a<4||7===a||9===a||11===a||a>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?Pf.RGBA_ASTC_4x4:5===t?4===e?Pf.RGBA_ASTC_5x4:Pf.RGBA_ASTC_5x5:6===t?5===e?Pf.RGBA_ASTC_6x5:Pf.RGBA_ASTC_6x6:8===t?5===e?Pf.RGBA_ASTC_8x5:6===e?Pf.RGBA_ASTC_8x6:Pf.RGBA_ASTC_8x8:10===t?5===e?Pf.RGBA_ASTC_10x5:6===e?Pf.RGBA_ASTC_10x6:8===e?Pf.RGBA_ASTC_10x8:Pf.RGBA_ASTC_10x10:10===e?Pf.RGBA_ASTC_12x10:Pf.RGBA_ASTC_12x12}(a,h),l=i+16,_=n-16;if(n>0){var d=new Uint8Array(s,l,_),f=new Uint8Array(r._data.byteLength+d.byteLength);f.set(r._data),f.set(d,r._data.byteLength),r._data=f,r.mipmapLevelDataSize[e]=_}else r._data=new Uint8Array(s,l);r.width=e>0?r.width:o[7]+(o[8]<<8)+(o[9]<<16),r.height=e>0?r.height:o[10]+(o[11]<<8)+(o[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=Pf.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,o=this.height,a=this.width,h=d(n);!(e=h()).done;){var u=e.value,c=new i({_data:new Uint8Array(r.buffer,s,u),_compressed:!0,width:a,height:o,format:this.format,mipmapLevelDataSize:[]});s+=u,c._uuid=""+this._uuid,a=Math.max(a>>1,1),o=Math.max(o>>1,1),t.push(c)}else t.push(this);return t},e.reset=function(t){Hf(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(Hf(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=Qd.gfxDevice,s=e.split("_"),o=Number.MAX_VALUE,a=this._format,h="",u=Ie.SUPPORT_TEXTURE_FORMATS,c=d(s);!(n=c()).done;){var l=n.value.split("@"),_=parseInt(l[0],void 0),f=i.extnames[_]||l[0],p=u.indexOf(f);if(-1!==p&&p<o){var g=l[1]?parseInt(l[1]):this._format;if(!(".astc"!==f||r&&r.getFormatFeatures(pl.ASTC_RGBA_4X4)&Cl.SAMPLED_TEXTURE))continue;if(!(".pvr"!==f||r&&r.getFormatFeatures(pl.PVRTC_RGBA4)&Cl.SAMPLED_TEXTURE))continue;if(!(g!==Pf.RGB_ETC1&&g!==Pf.RGBA_ETC1||r&&r.getFormatFeatures(pl.ETC_RGB8)&Cl.SAMPLED_TEXTURE))continue;if(!(g!==Pf.RGB_ETC2&&g!==Pf.RGBA_ETC2||r&&r.getFormatFeatures(pl.ETC2_RGB8)&Cl.SAMPLED_TEXTURE))continue;if(".webp"===f&&!Fo.hasFeature(Fo.Feature.WEBP))continue;o=p,h=f,a=g}}h?(this._setRawAsset(h),this._format=a):q(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||Hf(t)||(t.format=t.format||this._format),this.reset(t)}},{key:"data",get:function(){return(t=this._nativeData)instanceof HTMLImageElement||t instanceof HTMLCanvasElement||Hf(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>=Pf.RGB_ETC1&&this._format<=Pf.RGBA_ASTC_12x12||this._format>=Pf.RGB_A_PVRTC_2BPPV1&&this._format<=Pf.RGBA_ETC1}},{key:"mipmapLevelDataSize",get:function(){return this._nativeData.mipmapLevelDataSize}},{key:"url",get:function(){return this.nativeUrl}}]),i}(Of)).extnames=[".png",".jpg",".jpeg",".bmp",".webp",".pvr",".pkm",".astc"],Ff._sharedPlaceHolderCanvas=null,f((Bf=Ff).prototype,"_nativeAsset",[hh],Object.getOwnPropertyDescriptor(Bf.prototype,"_nativeAsset"),Bf.prototype),Lf=Bf))||Lf);m.ImageAsset=$f,Se(pl);var tp,ep,ip,np=new vt("Tex"),rp=va("cc.TextureBase")(((Jf=function(t){function e(){var e;return(e=t.call(this)||this)._format=Wf&&Wf(),e._minFilter=Xf&&Xf(),e._magFilter=jf&&jf(),e._mipFilter=Yf&&Yf(),e._wrapS=Kf&&Kf(),e._wrapT=qf&&qf(),e._wrapR=Qf&&Qf(),e._anisotropy=Zf&&Zf(),e._width=1,e._height=1,e._samplerInfo=new C_,e._gfxSampler=null,e._gfxDevice=null,e._textureHash=0,e._id=np.getNewId(),e._gfxDevice=e._getGFXDevice(),e._textureHash=nl(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=m.director.root)&&void 0!==e&&e.batcher2D&&m.director.root.batcher2D._releaseDescriptorSetCache(this._textureHash),i},i.getHash=function(){return this._textureHash},i.getGFXTexture=function(){return null},i.getSamplerInfo=function(){return this._samplerInfo},i.getGFXSampler=function(){return this._gfxSampler||(this._gfxDevice?this._gfxSampler=this._gfxDevice.getSampler(this._samplerInfo):Z(9302)),this._gfxSampler},i._serialize=function(){return""},i._deserialize=function(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 Qd.gfxDevice},i._getGFXFormat=function(){return this._getGFXPixelFormat(this._format)},i._setGFXFormat=function(t){this._format=void 0===t?Pf.RGBA8888:t},i._getGFXPixelFormat=function(t){return t===Pf.RGBA_ETC1?t=Pf.RGB_ETC1:t===Pf.RGB_A_PVRTC_4BPPV1?t=Pf.RGB_PVRTC_4BPPV1:t===Pf.RGB_A_PVRTC_2BPPV1&&(t=Pf.RGB_PVRTC_2BPPV1),t},n(e,[{key:"isCompressed",get:function(){return this._format>=Pf.RGB_ETC1&&this._format<=Pf.RGBA_ASTC_12x12||this._format>=Pf.RGB_A_PVRTC_2BPPV1&&this._format<=Pf.RGBA_ETC1}},{key:"width",get:function(){return this._width}},{key:"height",get:function(){return this._height}}]),e}(Of)).PixelFormat=Pf,Jf.WrapMode=Mf,Jf.Filter=Nf,Wf=ua((Vf=Jf).prototype,"_format",[wa],(function(){return Pf.RGBA8888})),Xf=ua(Vf.prototype,"_minFilter",[wa],(function(){return Nf.LINEAR})),jf=ua(Vf.prototype,"_magFilter",[wa],(function(){return Nf.LINEAR})),Yf=ua(Vf.prototype,"_mipFilter",[wa],(function(){return Nf.NONE})),Kf=ua(Vf.prototype,"_wrapS",[wa],(function(){return Mf.REPEAT})),qf=ua(Vf.prototype,"_wrapT",[wa],(function(){return Mf.REPEAT})),Qf=ua(Vf.prototype,"_wrapR",[wa],(function(){return Mf.REPEAT})),Zf=ua(Vf.prototype,"_anisotropy",[wa],(function(){return 0})),zf=Vf))||zf;m.TextureBase=rp;var sp=t("Script",va("cc.Script")(tp=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(Of))||tp);m._Script=sp;var op=t("JavaScript",va("cc.JavaScript")(ep=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(sp))||ep);m._JavaScript=op;var ap,hp,up,cp,lp,_p,dp,fp=t("TypeScript",va("cc.TypeScript")(ip=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(sp))||ip);m._TypeScript=fp;var pp,gp,mp,vp,yp,Tp,Ep,Sp,Ap,bp,Cp,Rp=t("EventHandler",va("cc.ClickEvent")((hp=function(){function t(){this.target=up&&up(),this.component=cp&&cp(),this._componentId=lp&&lp(),this.handler=_p&&_p(),this.customEventData=dp&&dp()}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,o=e.length;s<o;s++){var a=e[s];a instanceof t&&a.emit(n)}};var e=t.prototype;return e.emit=function(t){var e=this.target;if(m.isValid(e)){this._genCompIdIfNeeded();var i=m.js.getClassById(this._componentId),n=e.getComponent(i);if(m.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=m.js.getClassByName(t);return m.js.getClassId(e)},e._compId2Name=function(t){var e=m.js.getClassById(t);return m.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}(),up=ua(hp.prototype,"target",[wa],(function(){return null})),cp=ua(hp.prototype,"component",[wa],(function(){return""})),lp=ua(hp.prototype,"_componentId",[wa],(function(){return""})),_p=ua(hp.prototype,"handler",[wa],(function(){return""})),dp=ua(hp.prototype,"customEventData",[wa],(function(){return""})),ap=hp))||ap),wp=new vt("Comp"),Ip=qs.Flags.IsOnLoadCalled,xp=t("Component",(pp=va("cc.Component"),gp=Za(sp),pp(((Sp=function(t){function e(){var e;return(e=t.call(this)||this).node=yp&&yp(),e._enabled=Tp&&Tp(),e.__prefab=Ep&&Ep(),e._sceneGetter=null,e._id=wp.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&&m.director._compScheduler.disableComp(this),!0)},i._onPreDestroy=function(){this.unscheduleAllCallbacks(),m.director._nodeActivator.destroyComp(this),this.node._removeComponent(this)},i._instantiate=function(t){return t||(t=m.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=m.macro.REPEAT_FOREVER),void 0===n&&(n=0),tt(Boolean(t),1619),tt((e=e||0)>=0,1620),i=Number.isNaN(i)?m.macro.REPEAT_FOREVER:i,n=n||0;var r=m.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&&m.director.getScheduler().unschedule(t,this)},i.unscheduleAllCallbacks=function(){m.director.getScheduler().unscheduleAllForTarget(this)},n(e,[{key:"name",get:function(){if(this._name)return this._name;var t=Ot(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=m.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&Ip}},{key:"internalUpdate",get:function(){return this.update}},{key:"internalLateUpdate",get:function(){return this.lateUpdate}},{key:"internalPreload",get:function(){return this.__preload}},{key:"internalOnLoad",get:function(){return this.onLoad}},{key:"internalStart",get:function(){return this.start}},{key:"internalOnEnable",get:function(){return this.onEnable}},{key:"internalOnDisable",get:function(){return this.onDisable}},{key:"internalOnDestroy",get:function(){return this.onDestroy}}]),e}(qs)).EventHandler=Rp,Sp._executionOrder=0,Sp._requireComponent=null,Sp.system=null,f((vp=Sp).prototype,"__scriptAsset",[gp],Object.getOwnPropertyDescriptor(vp.prototype,"__scriptAsset"),vp.prototype),yp=ua(vp.prototype,"node",[wa],(function(){return null})),Tp=ua(vp.prototype,"_enabled",[wa],(function(){return!0})),Ep=ua(vp.prototype,"__prefab",[wa],(function(){return null})),mp=vp))||mp));Rt(xp,"_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)})),m.Component=xp;var Dp=t("MissingScript",va("cc.MissingScript")((bp=function(t){function e(){var e;return(e=t.call(this)||this)._$erialized=Cp&&Cp(),e}return s(e,t),e.safeFindClass=function(t){var e=ee(t);if(e)return e;m.deserialize.reportMissingClass(t)},e.prototype.onLoad=function(){q(4600,this.node.name)},e}(xp),Cp=ua(bp.prototype,"_$erialized",[wa,xa],(function(){return null})),Ap=bp))||Ap);m._MissingScript=Dp;try{var Op=Dp.__values__;0!==Op.length&&"_$erialized"===Op[Op.length-1]||(Z(16338),Z(16339,Op.join(", ")))}catch(sr){Z(16340,""+sr)}var Pp=function(){function t(t,e){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 Mp(t){var e=t;return{chunks:e.chunks,document:e.document}}function Np(t){if(t.length<16)throw new Lp(et(13102));var e=new DataView(t.buffer,t.byteOffset,t.byteLength);if(1313817411!==e.getUint32(0,!0))throw new Lp(et(13100));var i=e.getUint32(4,!0);if(1!==i)throw new Lp(et(13101,i));if(e.getUint32(8,!0)!==e.byteLength)throw new Lp(et(13102));var n=12,r=e.getUint32(n,!0);n+=4;var s=new Uint8Array(e.buffer,n+e.byteOffset,r);n+=r;var o,a=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(et(13104))}(s);try{o=JSON.parse(a)}catch(t){throw new Lp(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 Lp(et(13102));return new Pp(o,h)}var Lp=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}}])}(),m.internal.parseCCONJson=Mp,m.internal.decodeCCONBinary=Np,m.internal.CCON=Pp;var Bp=Ti.Attr.DELIMETER,Fp=Bp+"type",kp=Bp+"default",Up=Bp+"formerlySerializedAs";function Gp(t,e){if(void 0===t)return e instanceof Ti.Attr.PrimitiveType||e===pi||e===gi;var i=typeof t;return"string"===i||"number"===i||"boolean"===i}var Hp=function(t){function e(){return t.call(this,(function(t){t.clear()}),1)||this}return s(e,t),e}(se);Hp.prototype.get=function(t,e,i,n,r){var s=this._get();return s?(s.reset(t,e,i,n,r),s):new zp(t,e,i,n,r)};var zp=function(){function t(t,e,i,n){this.deserializedList=[],this.deserializedData=null,this.result=t,this.customEnv=n,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 Pp?(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__,o=this._classFinder(s,t,i,n);if(!o)return this._classFinder===ee&&this._reportMissingClass(s),null;var a=function(t){var i=new t;return e>=0&&(r.deserializedList[e]=i),i}(o);return this._deserializeInto(t,a,o),a},e._deserializeInto=function(t,e,i,n){void 0===n&&(n=!1),n||!e[gh]?e._deserialize?e._deserialize(t.content,this):m.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=Vt(i);r&&n._deserializeInto(t,e,r)}};e[gh](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=function(t){return De.test(re(t))}(e),n=Wt(e,m.Node)||Wt(e,m.Component),r=!1,s=[],o=s,a=[],h=a,u=[];return function(){var t=e.__values__;r="_$erialized"===t[t.length-1];for(var n=Ti.Attr.getClassAttrs(e),c=0;c<t.length;c++){var l=t[c],_=l;n[l+Up]&&(_=n[l+Up]);var d=Ti.getDefault(n[l+kp]),f=n[l+Fp],p=!1;i&&(void 0!==d||f)&&(p=Gp(d,f)),p?(_!==l&&o===s&&(o=s.slice()),s.push(l),o!==s&&o.push(_)):(_!==l&&h===a&&(h=a.slice()),a.push(l),h!==a&&h.push(_),u.push(d instanceof m.ValueType&&d.constructor))}}(),function(t,e,c){for(var l=0;l<s.length;++l){var _=c[o[l]];void 0!==_&&(e[s[l]]=_)}for(var d=0;d<a.length;++d){var f=a[d],p=c[h[d]];if(void 0!==p)if(i||"object"==typeof p){var g=u[d];g?i||p?t._deserializeFastDefinedObject(e[f],p,g):e[f]=null:p?t._deserializeAndAssignField(e,p,f):e[f]=null}else e[f]=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===Dp){var r=i.__values__;0!==r.length&&"_$erialized"===r[r.length-1]||(Z(16341),Z(16342,r.join(", ")));var s=n;n=function(t,e,i,n){s(t,e,i,n),e._$erialized||Z(16343,JSON.stringify(i))}}}catch(t){Z(16344,""+t)}Rt(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,o=this._serializedData[n];t[i]=this._deserializeObject(o,n,void 0,i),null===(s=this._onDereferenced)||void 0===s||s.call(this,this.deserializedList,n,t,i)}}else{var a=e.__uuid__;if(a){var h=e.__expectedType__;this.result.push(t,i,a,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===m.Vec2)return t.x=e.x||0,void(t.y=e.y||0);if(i===m.Vec3)return t.x=e.x||0,t.y=e.y||0,void(t.z=e.z||0);if(i!==m.Color){if(i===m.Size)return t.width=e.width||0,void(t.height=e.height||0);for(var n=Ti.Attr.getClassAttrs(i),r=i.__values__,s=0;s<r.length;s++){var o=r[s],a=e[o];void 0!==a||e.hasOwnProperty(o)||(a=Ti.getDefault(n[o+kp])),"object"!=typeof a?t[o]=a:a?this._deserializeAndAssignField(t,a,o):t[o]=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}();zp.pool=new Hp;var Vp=[Hn,_n,on,Rn,yn,Xn,Yn,Ln];function Wp(t,e){t.x=e[1],t.y=e[2],t.z=e[3],t.w=e[4]}var Xp=[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]},Wp,Wp,function(t,e){yn.fromUint32(t,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){Ln.fromArray(t,e,1)}],jp=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 Yp(t,e){for(var i=t[4][e[0]],n=i[0],r=new(0,n[0]),s=n[1],o=n[2],a=i[i.length-1],h=1;h<a;++h)r[s[i[h]]]=e[h];for(;h<e.length;++h){var u=s[i[h]],c=n[i[h]+o];(0,$p[c])(t,r,u,e[h])}return r}function Kp(t,e,i){var n=new e;return n._deserialize?n._deserialize(i,t[0]):Z(5303,Ot(e)),n}function qp(t,e,i,n){n>=0?e[i]=t[5][n]:t[7][3*~n]=e}function Qp(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 Zp(t,e,i,n){e[i]=null,t[8][n]=e}function Jp(t,e,i,n){e[i]=Yp(t,n)}jp.pool=new se((function(t){t.reset()}),5),jp.pool.get=function(){return this._get()||new jp};var $p=new Array(13);function tg(t,e,i){return t||i(e),Object}function eg(t,e,i,n,r,s,o){var a=t(e);if(!a){if(r)return void(i[n]=function(e,i,n){return function(){var r=t(n)||tg(s,n,o);return e[i]=r,new r}}(i,n,e));a=tg(s,e,o)}i[n]=a}function ig(t,e,i,n){for(var r=i||ee,s=t[3],o=0;o<s.length;++o){var a=s[o];"string"!=typeof a?eg(r,a[0],a,0,e,i,n):eg(r,a,s,o,e,i,n)}}function ng(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 rg(t,e,i){"string"==typeof t&&(t=JSON.parse(t));var n,r=!1;if(e||(e=jp.pool.get(),r=!0),function(t){if(Array.isArray(t)){var e=t[0];return"number"==typeof e||e instanceof sg}return!1}(t)){!function(t,e,i){var n;e.init(t),null!==(n=i)&&void 0!==n||(i={});var r=t[0],s=!1;if("object"==typeof r&&(s=r.preprocessed,r=r.version),r<1)throw new Error(et(5304,r));var o,a=i;a._version=r,a.result=e,t[0]=a,s||(ig(t,!1,i.classFinder,null!==(o=i.reportMissingClass)&&void 0!==o?o:rg.reportMissingClass),ng(t))}(t,e,i);var s=t;m.game._isCloning=!0;var o=s[5],a=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 o=0;o<s;++o)e[o]=Yp(t,e[o]);for(var a=t[3],h=0;h<n;++h,++o){var u=i[h],c=e[o];if(u>=0){var l=a[u];e[o]=Kp(t,l,c)}else(0,$p[u=~u])(t,e,o,c)}return r}(s);m.game._isCloning=!1,s[7]&&function(t,e,i){for(var n=t.length-1,r=0,s=3*t[n];r<s;r+=3){var o=t[r],a=e[t[r+2]],h=t[r+1];h>=0?o[i[h]]=a:o[~h]=a}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}}(s[7],o,s[2]),function(t){for(var e=t[5],i=t[2],n=t[1],r=t[8],s=t[9],o=t[10],a=0;a<r.length;++a){var h=r[a];"number"==typeof h&&(r[a]=e[h]);var u=s[a];"number"==typeof u&&(u=u>=0?i[u]:~u,s[a]=u);var c=o[a];"number"==typeof c&&(o[a]=n[c])}}(s),n=o[a]}else n=function(t,e,i){var n,r=(i=i||{}).classFinder||ee,s=i.createAssetRefs||Fo.platform===lo.EDITOR_CORE,o=i.customEnv,a=i.ignoreEditorOnly,h=null!==(n=i.reportMissingClass)&&void 0!==n?n:m.deserialize.reportMissingClass;e.init();var u=zp.pool.get(e,r,h,o,a);m.game._isCloning=!0;var c=u.deserialize(t);return m.game._isCloning=!1,zp.pool.put(u),s&&e.assignAssetsBy((function(t,e){return EditorExtends.serialize.asAsset(t,e.type)})),c}(t,e,i);return r&&jp.pool.put(e),n}$p[0]=function(t,e,i,n){e[i]=n},$p[1]=qp,$p[2]=Qp(qp),$p[3]=Qp(Zp),$p[4]=Jp,$p[5]=function(t,e,i,n){var r=n[0],s=e[i];(0,Xp[r])(s,n)},$p[6]=Zp,$p[7]=function(t,e,i,n){e[i].set(n)},$p[8]=function(t,e,i,n){var r=n[0],s=new Vp[r];(0,Xp[r])(s,n),e[i]=s},$p[9]=Qp(Jp),$p[10]=function(t,e,i,n){var r=t[3][n[0]];e[i]=Kp(t,r,n[1])},$p[11]=function(t,e,i,n){var r=n[0];e[i]=r;for(var s=1;s<n.length;s+=3){var o=n[s],a=n[s+1],h=n[s+2];(0,$p[a])(t,r,o,h)}},$p[12]=function(t,e,i,n){for(var r=n[0],s=0;s<r.length;++s){var o=r[s],a=n[s+1];0!==a&&(0,$p[a])(t,r,s,o)}e[i]=r},rg.Details=jp,rg.reportMissingClass=function(t){Z(5302,t)};var sg=function(t){this.preprocessed=!0,this.version=t};function og(t,e,i){return[1,0,0,[t],0,i?[e,-1]:[e],[0],0,[],[],[]]}m.deserialize=rg;var ag=new WeakMap,hg=new WeakSet,ug=new WeakSet;function cg(t,e){var i;i=Dp.safeFindClass;var n,r=jp.pool.get();try{n=rg(t,r,{classFinder:i,customEnv:e})}catch(t){throw k(t),jp.pool.put(r),t}n._uuid=e.__uuid__||"";for(var s=r.uuidList,o=r.uuidObjList,a=r.uuidPropList,h=r.uuidTypeList||[],u=[],c=0;c<s.length;c++){var l=s[c];u[c]={uuid:vf(l),owner:o[c],prop:a[c],type:ee(h[c])}}return ag.set(n,u),n._native&&hg.add(n),jp.pool.put(r),n}var lg=function(){function t(){this._depends=new $d}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 Pp){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=cg(e,{__uuid__:t});(r=this._parseDepsFromAsset(s)).nativeDep&&(r.nativeDep.uuid=t),sf.add(t+"@import",s)}catch(e){rf.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=ag.get(t),n=0,r=i.length;n<r;n++)e.deps.push(i[n].uuid);return hg.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]=vf(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}();lg._instance=void 0;var _g,dg=lg.instance,fg=[new __];function pg(t){return t&&0==(t&t-1)}var gg,mg,vg,yg,Tg,Eg=va("cc.SimpleTexture")(_g=function(t){function e(){var e;return(e=t.call(this)||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=fg[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,fg):n.copyTexImagesToTexture([t],this._gfxTexture,fg)}}},i._assignImage=function(t,e,i){var n=t.data;if(n&&(this.uploadData(n,e,i),this._checkTextureLoaded(),Ie.CLEANUP_IMAGE_CACHE)){var r=dg.getDeps(this._uuid),s=r.indexOf(t._uuid);-1!==s&&(he(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){tt(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=bl.NONE;this._mipFilter!==Nf.NONE&&function(t,e,i){return!(t.gfxAPI===_l.WEBGL)||pg(e)&&pg(i)}(t,this._width,this._height)&&(this._mipmapLevel=function(t,e){for(var i=Math.max(t,e),n=0;i;)i>>=1,n++;return n}(this._width,this._height),this.isUsingOfflineMipmaps()||this.isCompressed||(e=bl.GEN_MIPMAP));var i=this._getGfxTextureCreateInfo({usage:Al.SAMPLED|Al.TRANSFER_DST|Al.COLOR_ATTACHMENT,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}(rp))||_g;m.SimpleTexture=Eg;var Sg=t("Texture2D",(gg=va("cc.Texture2D"),mg=Za([$f]),gg((yg=function(t){function e(){var e;return(e=t.call(this)||this)._mipmaps=Tg&&Tg(),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=Pf.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),void 0===e&&(e=void 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 $f,n.mipmaps[r]){var s=n.mipmaps[r];i.result.push(this._mipmaps,""+r,s,re($f))}},i._getGfxTextureCreateInfo=function(t){var e=new A_(Sl.TEX2D);return e.width=this._width,e.height=this._height,Object.assign(e,t),e},i._getGfxTextureViewCreateInfo=function(t){var e=new b_;return e.type=Sl.TEX2D,Object.assign(e,t),e},i.initDefault=function(e){t.prototype.initDefault.call(this,e);var i=new $f;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}(Eg),Tg=ua(yg.prototype,"_mipmaps",[mg],(function(){return[]})),vg=yg))||vg));m.Texture2D=Sg;var Ag=t("Atlas",function(){function t(t,e){this._innerTextureInfos={},this._innerSpriteFrames=[],this._count=0;var i=new bg;i.initWithSize(t,e),this._texture=i,this._width=t,this._height=e,this._x=2,this._y=2,this._nextY=2}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 o=i.width,a=i.height;if(this._x+o+2>this._width&&(this._x=2,this._y=this._nextY),this._y+a+2>this._nextY&&(this._nextY=this._y+a+2),this._nextY>this._height)return null;m.internal.dynamicAtlasManager.textureBleeding&&((o<=8||a<=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+=o+2}var h={x:r,y:s,texture:this._texture};return this._innerSpriteFrames.push(t),h},e.removeSpriteFrame=function(t){ce(this._innerSpriteFrames,t)},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}()),bg=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=Pf.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 __;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 q(16363)}},e}(Sg),Cg={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},Rg=t("Layers",function(){function t(){}return t.init=function(){var e=we.querySettings(Ce.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=d(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)q(16365);else{var n=1<<i;t.Enum[e],et(2104,e),t.Enum[e]=n,Rt(t.Enum,String(n),e),t.BitMask[e]=n,Rt(t.BitMask,String(n),e),ge.update(t.BitMask),ye.update(t.Enum)}else q(16364)},t.deleteLayer=function(e){if(e>19||e<0)q(16366);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],ge.update(t.BitMask),ye.update(t.Enum)}},t.nameToLayer=function(e){return void 0===e?(q(16367),-1):E(t.Enum[e])},t.layerToName=function(e){return e>31||e<0?(q(16368),""):t.Enum[1<<e]},t}());Rg.Enum=ye(Cg),Rg.BitMask=ge(r({},Cg)),m.Layers=Rg;var wg,Ig,xg=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=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?q(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}();qs.Flags.Destroying,m.GAME_VIEW,t("NodeSpace",wg),function(t){t[t.LOCAL=0]="LOCAL",t[t.WORLD=1]="WORLD"}(wg||t("NodeSpace",wg={})),t("TransformBit",Ig),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"}(Ig||t("TransformBit",Ig={})),m.internal.TransformBit=Ig;var Dg,Og,Pg,Mg,Ng,Lg,Bg,Fg,kg,Ug,Gg,Hg,zg,Vg,Wg,Xg,jg,Yg,Kg=t("MobilityMode",ye({Static:0,Stationary:1,Movable:2}));t("NodeEventType",Dg),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.CHILDREN_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",t.ACTIVE_CHANGED="active-changed"}(Dg||t("NodeEventType",Dg={}));var qg=qs.Flags.Destroying,Qg=qs.Flags.DontDestroy,Zg=qs.Flags.Deactivating,Jg=new vt("Node");function $g(t){return t?"string"==typeof t?ie(t):t:(Z(3804),null)}var tm,em,im,nm,rm,sm,om,am,hm,um=dn(),cm=dn(),lm=Mn(),_m=Mn(),dm=Mn(),fm=new Sn,pm=Un(),gm=Un(),mm=[],vm=Symbol("ReserveContentsForAllSyncablePrefab"),ym=0,Tm=(Og=va("cc.Node"),Pg=Za(_n),Mg=Za(Kg),Og(((Yg=function(t){s(i,t);var e=i.prototype;function i(e){var i;return void 0===e&&(e="New Node"),(i=t.call(this,e)||this)._parent=Bg&&Bg(),i._children=Fg&&Fg(),i._active=kg&&kg(),i._components=Ug&&Ug(),i._prefab=Gg&&Gg(),i._scene=null,i._activeInHierarchy=!1,i._id=Jg.getNewId(),i._eventProcessor=new m.NodeEventProcessor(l(i)),i._eventMask=0,i._siblingIndex=0,i._originalSceneId="",i._uiProps=new xg(l(i)),i._static=!1,i._lpos=Hg&&Hg(),i._lrot=zg&&zg(),i._lscale=Vg&&Vg(),i._mobility=Wg&&Wg(),i._layer=Xg&&Xg(),i._euler=jg&&jg(),i._transformFlags=Ig.TRS,i._eulerDirty=!1,i._flagChangeVersion=0,i._hasChangedFlags=0,i._pos=new _n,i._rot=new Rn,i._scale=new _n(1,1,1),i._mat=new Ln,i}return e._setActiveInHierarchy=function(t){this._activeInHierarchy=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 o=0;o<n.length;++o){var a=n[o];if(a instanceof e)return a}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 o=r[s];o.constructor===e&&i.push(o)}else for(var a=0;a<r.length;++a){var h=r[a];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)}},e.getWritableComponents=function(){return this._components},e._updateScene=function(){null==this._parent?Z(1640,this.name,this.uuid):this._scene=this._parent._scene},e.attr=function(t){Ht(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(Dg.PARENT_CHANGED,i),i&&!(i._objFlags&qg)){var r=i._children.indexOf(this);i._children.splice(r,1),i._updateSiblingIndex(),i.emit&&i.emit(Dg.CHILD_REMOVED,this)}n&&(n._children.push(this),this._siblingIndex=n._children.length-1,n.emit&&n.emit(Dg.CHILD_ADDED,this)),this._onHierarchyChanged(i)}},e.getChildByUuid=function(t){if(!t)return B("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 B("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,i=t.split("/"),n=this,r=function(){var t=i[s];if(0===t.length)return 0;var e=n.children.find((function(e){return e.name===t}));if(!e)return{v:null};n=e},s=0;s<i.length;++s)if(0!==(e=r())&&e)return e.v;return n},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&Zg)Z(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,o=0,a=i._stacks[i._stackId];a||(a=[],i._stacks.push(a)),i._stackId++,a.length=0,a[0]=this;for(var h=null,u=!1;n;)if(s=a[--n])if(!u&&t?t(s):u&&e&&e(s),a[n]=null,u){if(h===this._parent)break;if(u=!1,r)if(r[++o])a[n]=r[o],n++;else if(h&&(a[n]=h,n++,u=!0,h._parent?(o=(r=h._parent._children).indexOf(h),h=h._parent):(h=null,r=null),o<0))break}else s._children.length>0?(h=s,r=s._children,o=0,a[n]=r[o],n++):(a[n]=s,n++,u=!0);a.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=$g(t);return e?i._findComponent(this,e):null},e.getComponents=function(t){var e=$g(t),n=[];return e&&i._findComponents(this,e,n),n},e.getComponentInChildren=function(t){var e=$g(t);return e?i._findChildComponent(this._children,e):null},e.getComponentsInChildren=function(t){var e=$g(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=ie(t)))throw m._RF.peek()&&Z(3808,t),TypeError(et(3807,t))}else{if(!t)throw TypeError(et(3804));e=t}if("function"!=typeof e)throw TypeError(et(3809));if(!Wt(e,m.Component))throw TypeError(et(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 o=new e;return o.node=this,this._components.push(o),this.emit(Dg.COMPONENT_ADDED,o),this._activeInHierarchy&&m.director._nodeActivator.activateComp(o),o},e.removeComponent=function(t){if(t){var e=null;(e=t instanceof xp?t:this.getComponent(t))&&e.destroy()}else Z(3813)},e.on=function(t,e,i,n){switch(void 0===n&&(n=!1),t){case Dg.TRANSFORM_CHANGED:this._eventMask|=1;break;case Dg.ACTIVE_CHANGED:this._eventMask|=2}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 Dg.TRANSFORM_CHANGED:this._eventMask&=-2;break;case Dg.ACTIVE_CHANGED:this._eventMask&=-3}},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(Dg.TRANSFORM_CHANGED)&&(this._eventMask&=-2),2&this._eventMask&&!this._eventProcessor.hasEventListener(Dg.ACTIVE_CHANGED)&&(this._eventMask&=-3)},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&qg)){var e=this._components.indexOf(t);-1!==e?(this._components.splice(e,1),this.emit(Dg.COMPONENT_REMOVED,t)):t.node!==this&&Z(3815)}}else Z(3814)},e._updateSiblingIndex=function(){for(var t=0;t<this._children.length;++t)this._children[t]._siblingIndex=t;this.emit(Dg.CHILDREN_ORDER_CHANGED)},e._instantiate=function(t,e){return void 0===e&&(e=!1),t||(t=m.instantiate._clone(this,this)),t._prefab,t._parent=null,t._onBatchCreated(e),t},e._onHierarchyChangedBase=function(){var t=this._parent;!this._persistNode||t instanceof m.Scene||m.game.removePersistRootNode(this);var e=this._active&&!(!t||!t._activeInHierarchy);this._activeInHierarchy!==e&&m.director._nodeActivator.activateNode(this,e)},e._onPreDestroyBase=function(){this._objFlags|=qg;var t=this._parent,e=!!t&&0!=(t._objFlags&qg);if(this._persistNode&&m.game.removePersistRootNode(this),!e&&t){this.emit(Dg.PARENT_CHANGED,this);var i=t._children.indexOf(this);t._children.splice(i,1),this._siblingIndex=0,t._updateSiblingIndex(),t.emit&&t.emit(Dg.CHILD_REMOVED,this)}this.emit(Dg.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,o=0;o<s.length;++o)s[o]._destroyImmediate();return e},i.isNode=function(t){return t instanceof i&&(t.constructor===i||!(t instanceof m.Scene))},e._onPreDestroy=function(){return this._onPreDestroyBase()},e[ph]=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(),Oi(Ln.determinant(n._mat),0,xi)?(q(14300),this._transformFlags|=Ig.TRS,this.updateWorldTransform()):(Ln.multiply(pm,Ln.invert(pm,n._mat),this._mat),Ln.toRTS(pm,this._lrot,this._lpos,this._lscale))):(_n.copy(this._lpos,this._pos),Rn.copy(this._lrot,this._rot),_n.copy(this._lscale,this._scale)),this._eulerDirty=!0}this.invalidateChildren(Ig.TRS)},e._onHierarchyChanged=function(t){this.eventProcessor.reattach(),this._onHierarchyChangedBase(t)},e._onBatchCreated=function(t){2&this._eventMask&&(this._activeInHierarchy||this.emit(Dg.ACTIVE_CHANGED,this,!1)),this.hasChangedFlags=Ig.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){2&this._eventMask&&this.emit(Dg.ACTIVE_CHANGED,this,t),this._eventProcessor.setEnabled(t),t&&(this.invalidateChildren(Ig.TRS),this._uiProps&&this._uiProps.uiComp&&(this._uiProps.uiComp.setNodeDirty(),this._uiProps.uiComp.setTextureDirty(),this._uiProps.uiComp.markForUpdateRenderData()))},e.translate=function(t,e){var i=e||wg.LOCAL;if(i===wg.LOCAL)_n.transformQuat(um,t,this._lrot),this._lpos.x+=um.x,this._lpos.y+=um.y,this._lpos.z+=um.z;else if(i===wg.WORLD)if(this._parent){Rn.invert(lm,this._parent.worldRotation),_n.transformQuat(um,t,lm);var n=this.worldScale;this._lpos.x+=um.x/n.x,this._lpos.y+=um.y/n.y,this._lpos.z+=um.z/n.z}else this._lpos.x+=t.x,this._lpos.y+=t.y,this._lpos.z+=t.z;this.invalidateChildren(Ig.POSITION),1&this._eventMask&&this.emit(Dg.TRANSFORM_CHANGED,Ig.POSITION)},e.rotate=function(t,e){var i=e||wg.LOCAL;if(Rn.normalize(lm,t),i===wg.LOCAL)Rn.multiply(this._lrot,this._lrot,lm);else if(i===wg.WORLD){var n=this.worldRotation;Rn.multiply(_m,lm,n),Rn.invert(lm,n),Rn.multiply(_m,lm,_m),Rn.multiply(this._lrot,this._lrot,_m)}this._eulerDirty=!0,this.invalidateChildren(Ig.ROTATION),1&this._eventMask&&this.emit(Dg.TRANSFORM_CHANGED,Ig.ROTATION)},e.lookAt=function(t,e){this.getWorldPosition(um),_n.subtract(um,um,t),_n.normalize(um,um),Rn.fromViewUp(lm,um,e),this.setWorldRotation(lm)},e.invalidateChildren=function(t){var e,i,n=0,r=0,s=0,o=0,a=t|Ig.POSITION;for(mm[0]=this;n>=0;){if(o=(e=mm[n--]).hasChangedFlags,e.isValid&&(e._transformFlags&o&t)!==t)for(e._transformFlags|=t,e.hasChangedFlags=o|t,s=(i=e._children).length,r=0;r<s;r++)mm[++n]=i[r];t=a}},e.updateWorldTransform=function(){if(this._transformFlags){for(var t,e=this,i=0;e&&e._transformFlags;)mm[i++]=e,e=e._parent;for(var n=0;i;){if(n|=(t=mm[--i])._transformFlags,e){if(n&Ig.POSITION&&(_n.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&Ig.RS){Ln.fromRTS(t._mat,t._lrot,t._lpos,t._lscale),Ln.multiply(t._mat,e._mat,t._mat);var r=n&Ig.ROTATION?t._rot:null;Ln.toRTS(t._mat,r,null,t._scale)}}else n&Ig.POSITION&&(_n.copy(t._pos,t._lpos),t._mat.m12=t._pos.x,t._mat.m13=t._pos.y,t._mat.m14=t._pos.z),n&Ig.RS&&(n&Ig.ROTATION&&Rn.copy(t._rot,t._lrot),n&Ig.SCALE&&_n.copy(t._scale,t._lscale),Ln.fromRTS(t._mat,t._rot,t._pos,t._scale));t._transformFlags=Ig.NONE,e=t}}},e.setPosition=function(t,e,i){var n=this._lpos;if(void 0===e){if(n.equals(t))return;_n.copy(n,t)}else{if(void 0===i&&(i=n.z),n.equals(um.set(t,e,i)))return;_n.copy(n,um)}this.invalidateChildren(Ig.POSITION),1&this._eventMask&&this.emit(Dg.TRANSFORM_CHANGED,Ig.POSITION)},e.getPosition=function(t){return t?_n.set(t,this._lpos.x,this._lpos.y,this._lpos.z):_n.copy(new _n,this._lpos)},e.setRotation=function(t,e,i,n){var r=this._lrot;if(void 0===e){if(r.equals(t))return;Rn.copy(r,t)}else{if(r.equals(lm.set(t,e,i,n)))return;Rn.copy(r,lm)}this._eulerDirty=!0,this.invalidateChildren(Ig.ROTATION),1&this._eventMask&&this.emit(Dg.TRANSFORM_CHANGED,Ig.ROTATION)},e.setRotationFromEuler=function(t,e,i){var n=this._euler;if(void 0===e){if(n.equals(t))return;_n.copy(n,t),Rn.fromEuler(this._lrot,t.x,t.y,t.z)}else{var r=void 0===i?this._euler.z:i;if(_n.set(um,t,e,r),n.equals(um))return;_n.copy(n,um),Rn.fromEuler(this._lrot,t,e,r)}this._eulerDirty=!1,this.invalidateChildren(Ig.ROTATION),1&this._eventMask&&this.emit(Dg.TRANSFORM_CHANGED,Ig.ROTATION)},e.getRotation=function(t){return t?Rn.set(t,this._lrot.x,this._lrot.y,this._lrot.z,this._lrot.w):Rn.copy(new Rn,this._lrot)},e.setScale=function(t,e,i){var n=this._lscale;if(void 0===e){if(n.equals(t))return;_n.copy(n,t)}else{if(void 0===i&&(i=n.z),_n.set(um,t,e,i),n.equals(um))return;_n.copy(n,um)}this.invalidateChildren(Ig.SCALE),1&this._eventMask&&this.emit(Dg.TRANSFORM_CHANGED,Ig.SCALE)},e.getScale=function(t){return t?_n.set(t,this._lscale.x,this._lscale.y,this._lscale.z):_n.copy(new _n,this._lscale)},e.inverseTransformPoint=function(t,e){_n.copy(t,e);for(var i=this,n=0;i._parent;)mm[n++]=i,i=i._parent;for(;n>=0;)_n.transformInverseRTS(t,t,i._lrot,i._lpos,i._lscale),i=mm[--n];return t},e.setWorldPosition=function(t,e,i){var n=this._pos,r=this._parent&&(this._transformFlags&Ig.POSITION)!==Ig.NONE;if(void 0===e){if(!r&&n.equals(t))return;_n.copy(n,t)}else{if(_n.set(um,t,e,i),!r&&n.equals(um))return;_n.copy(n,um)}var s=this._parent,o=this._lpos;s?(s.updateWorldTransform(),_n.transformMat4(o,n,Ln.invert(pm,s._mat))):_n.copy(o,n),this.invalidateChildren(Ig.POSITION),1&this._eventMask&&this.emit(Dg.TRANSFORM_CHANGED,Ig.POSITION)},e.getWorldPosition=function(t){return this.updateWorldTransform(),t?_n.copy(t,this._pos):_n.copy(new _n,this._pos)},e.setWorldRotation=function(t,e,i,n){var r=this._rot,s=this._parent&&(this._transformFlags&Ig.ROTATION)!==Ig.NONE;if(void 0===e){if(!s&&r.equals(t))return;Rn.copy(r,t)}else{if(Rn.set(lm,t,e,i,n),!s&&r.equals(lm))return;Rn.copy(r,lm)}this._parent?(this._parent.updateWorldTransform(),Rn.multiply(this._lrot,Rn.conjugate(this._lrot,this._parent._rot),r)):Rn.copy(this._lrot,r),this._eulerDirty=!0,this.invalidateChildren(Ig.ROTATION),1&this._eventMask&&this.emit(Dg.TRANSFORM_CHANGED,Ig.ROTATION)},e.setWorldRotationFromEuler=function(t,e,i){Rn.fromEuler(lm,t,e,i),this.setWorldRotation(lm)},e.getWorldRotation=function(t){return this.updateWorldTransform(),t?Rn.copy(t,this._rot):Rn.copy(new Rn,this._rot)},e.setWorldScale=function(t,e,i){var n=this._scale,r=this._parent&&(this._transformFlags&Ig.SCALE)!==Ig.NONE,s=this._parent;if(s&&this.updateWorldTransform(),void 0===e){if(!r&&n.equals(t))return;_n.copy(n,t)}else{if(_n.set(um,t,e,i),!r&&n.equals(um))return;_n.copy(n,um)}s?(um.x=n.x/_n.set(cm,this._mat.m00,this._mat.m01,this._mat.m02).length(),um.y=n.y/_n.set(cm,this._mat.m04,this._mat.m05,this._mat.m06).length(),um.z=n.z/_n.set(cm,this._mat.m08,this._mat.m09,this._mat.m10).length(),Ln.scale(pm,this._mat,um),Ln.multiply(gm,Ln.invert(gm,s._mat),pm),Sn.fromQuat(fm,Rn.conjugate(dm,this._lrot)),Sn.multiplyMat4(fm,fm,gm),this._lscale.x=_n.set(um,fm.m00,fm.m01,fm.m02).length(),this._lscale.y=_n.set(um,fm.m03,fm.m04,fm.m05).length(),this._lscale.z=_n.set(um,fm.m06,fm.m07,fm.m08).length()):_n.copy(this._lscale,n),this.invalidateChildren(Ig.SCALE),1&this._eventMask&&this.emit(Dg.TRANSFORM_CHANGED,Ig.SCALE)},e.getWorldScale=function(t){return this.updateWorldTransform(),t?_n.copy(t,this._scale):_n.copy(new _n,this._scale)},e.getWorldMatrix=function(t){this.updateWorldTransform();var e=t||new Ln;return Ln.copy(e,this._mat)},e.getWorldRS=function(t){this.updateWorldTransform();var e=t||new Ln;return Ln.copy(e,this._mat),e.m12=0,e.m13=0,e.m14=0,e},e.getWorldRT=function(t){this.updateWorldTransform();var e=t||new Ln;return Ln.fromRT(e,this._rot,this._pos)},e.setRTS=function(t,e,i){var n=0;t&&(n|=Ig.ROTATION,void 0!==t.w?(Rn.copy(this._lrot,t),this._eulerDirty=!0):(_n.copy(this._euler,t),Rn.fromEuler(this._lrot,t.x,t.y,t.z),this._eulerDirty=!1)),e&&(_n.copy(this._lpos,e),n|=Ig.POSITION),i&&(_n.copy(this._lscale,i),n|=Ig.SCALE),n&&(this.invalidateChildren(n),1&this._eventMask&&this.emit(Dg.TRANSFORM_CHANGED,n))},e.isTransformDirty=function(){return this._transformFlags!==Ig.NONE},e.pauseSystemEvents=function(t){this._eventProcessor.setEnabled(!1,t)},e.resumeSystemEvents=function(t){this._eventProcessor.setEnabled(!0,t)},i.resetHasChangedFlags=function(){ym+=1},i.clearNodeArray=function(){i.ClearFrame<i.ClearRound?i.ClearFrame++:(i.ClearFrame=0,mm.length=0)},e.getPathInHierarchy=function(){for(var t=this.name,e=this.parent;e&&!(e instanceof m.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&Qg)>0},set:function(t){t?this._objFlags|=Qg:this._objFlags&=~Qg}},{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&&m.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:"prefab",get:function(){return this._prefab}},{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&&(Rn.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.eulerAngles.z},set:function(t){this._euler.equals(um.set(0,0,t))||(_n.set(this._euler,0,0,t),Rn.fromAngleZ(this._lrot,t),this._eulerDirty=!1,this.invalidateChildren(Ig.ROTATION),1&this._eventMask&&this.emit(Dg.TRANSFORM_CHANGED,Ig.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){Ln.toRTS(t,this._lrot,this._lpos,this._lscale),this.invalidateChildren(Ig.TRS),this._eulerDirty=!0,1&this._eventMask&&this.emit(Dg.TRANSFORM_CHANGED,Ig.TRS)}},{key:"worldMatrix",get:function(){return this.updateWorldTransform(),this._mat}},{key:"forward",get:function(){return _n.transformQuat(new _n,_n.FORWARD,this.worldRotation)},set:function(t){var e=t.length();_n.multiplyScalar(um,t,-1/e),Rn.fromViewUp(lm,um),this.setWorldRotation(lm)}},{key:"up",get:function(){return _n.transformQuat(new _n,_n.UP,this.worldRotation)}},{key:"right",get:function(){return _n.transformQuat(new _n,_n.RIGHT,this.worldRotation)}},{key:"mobility",get:function(){return this._mobility},set:function(t){this._mobility!==t&&(this._mobility=t,this.emit(Dg.MOBILITY_CHANGED))}},{key:"layer",get:function(){return this._layer},set:function(t){this._layer!==t&&(this._layer=t,this._uiProps&&this._uiProps.uiComp&&(this._uiProps.uiComp.setNodeDirty(),this._uiProps.uiComp.markForUpdateRenderData()),this.emit(Dg.LAYER_CHANGED,this._layer))}},{key:"flagChangedVersion",get:function(){return this._flagChangeVersion}},{key:"hasChangedFlags",get:function(){return this._flagChangeVersion===ym?this._hasChangedFlags:0},set:function(t){this._flagChangeVersion=ym,this._hasChangedFlags=t}}]),i}(qs)).idGenerator=Jg,Yg._stacks=[[]],Yg._stackId=0,Yg.EventType=Dg,Yg.NodeSpace=wg,Yg.TransformDirtyBit=Ig,Yg.TransformBit=Ig,Yg.reserveContentsForAllSyncablePrefabTag=vm,Yg.ClearFrame=0,Yg.ClearRound=1e3,f((Lg=Yg).prototype,"_persistNode",[Sa],Object.getOwnPropertyDescriptor(Lg.prototype,"_persistNode"),Lg.prototype),Bg=ua(Lg.prototype,"_parent",[wa],(function(){return null})),Fg=ua(Lg.prototype,"_children",[wa],(function(){return[]})),kg=ua(Lg.prototype,"_active",[wa],(function(){return!0})),Ug=ua(Lg.prototype,"_components",[wa],(function(){return[]})),Gg=ua(Lg.prototype,"_prefab",[wa],(function(){return null})),Hg=ua(Lg.prototype,"_lpos",[wa],(function(){return new _n})),zg=ua(Lg.prototype,"_lrot",[wa],(function(){return new Rn})),Vg=ua(Lg.prototype,"_lscale",[wa],(function(){return new _n(1,1,1)})),Wg=ua(Lg.prototype,"_mobility",[wa],(function(){return Kg.Static})),Xg=ua(Lg.prototype,"_layer",[wa],(function(){return Rg.Enum.DEFAULT})),jg=ua(Lg.prototype,"_euler",[wa],(function(){return new _n})),f(Lg.prototype,"eulerAngles",[Pg],Object.getOwnPropertyDescriptor(Lg.prototype,"eulerAngles"),Lg.prototype),f(Lg.prototype,"mobility",[Mg],Object.getOwnPropertyDescriptor(Lg.prototype,"mobility"),Lg.prototype),Ng=Lg))||Ng);t({Node:Tm,BaseNode:Tm}),m.Node=Tm,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"}(am||(am={})),function(t){t[t.NONE=0]="NONE",t[t.AUTO=1]="AUTO",t[t.BAKED_CONVOLUTION_MAP=2]="BAKED_CONVOLUTION_MAP"}(hm||(hm={}));var Em=t("TextureCube",va("cc.TextureCube")(((om=function(t){function e(){var e;return(e=t.call(this)||this).isRGBE=im&&im(),e._mipmapAtlas=nm&&nm(),e._mipmapMode=rm&&rm(),e._mipmaps=sm&&sm(),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){Sm(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===hm.BAKED_CONVOLUTION_MAP},e.fromTexture2DArray=function(t,i){for(var n=[],r=t.length/6,s=0;s<r;s++){var o=6*s;n.push({front:t[o+am.front].image,back:t[o+am.back].image,left:t[o+am.left].image,right:t[o+am.right].image,top:t[o+am.top].image,bottom:t[o+am.bottom].image})}return(i=i||new e).mipmaps=n,i},i.onLoaded=function(){this._mipmapMode===hm.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),void 0===e&&(e=void 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;Sm(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===hm.BAKED_CONVOLUTION_MAP){var r=n.mipmapAtlas,s=n.mipmapLayout;this._mipmapAtlas={atlas:{},layout:s},this._mipmapAtlas.atlas={front:new $f,back:new $f,left:new $f,right:new $f,top:new $f,bottom:new $f};var o=re($f);i.result.push(this._mipmapAtlas.atlas,"front",r.front,o),i.result.push(this._mipmapAtlas.atlas,"back",r.back,o),i.result.push(this._mipmapAtlas.atlas,"left",r.left,o),i.result.push(this._mipmapAtlas.atlas,"right",r.right,o),i.result.push(this._mipmapAtlas.atlas,"top",r.top,o),i.result.push(this._mipmapAtlas.atlas,"bottom",r.bottom,o)}else{this._mipmaps=new Array(n.mipmaps.length);for(var a=0;a<n.mipmaps.length;++a){this._mipmaps[a]={front:new $f,back:new $f,left:new $f,right:new $f,top:new $f,bottom:new $f};var h=n.mipmaps[a],u=re($f);i.result.push(this._mipmaps[a],"front",h.front,u),i.result.push(this._mipmaps[a],"back",h.back,u),i.result.push(this._mipmaps[a],"left",h.left,u),i.result.push(this._mipmaps[a],"right",h.right,u),i.result.push(this._mipmaps[a],"top",h.top,u),i.result.push(this._mipmaps[a],"bottom",h.bottom,u)}}},i._getGfxTextureCreateInfo=function(t){var e=new A_(Sl.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 b_;return e.type=Sl.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}),Sm(this._mipmapAtlas.atlas,(function(i,n){var r=new Sg;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 o=e[s],a=r.getGFXTexture().size,h=new Uint8Array(a),u=new __;u.texOffset.x=o.left,u.texOffset.y=o.top,u.texExtent.width=o.width,u.texExtent.height=o.height,t._getGFXDevice().copyTextureToBuffers(r.getGFXTexture(),[h],[u]);var c=new $f({_data:h,_compressed:i.isCompressed,width:o.width,height:o.height,format:i.format});t._assignImage(c,o.level,n)}}))},i.initDefault=function(e){t.prototype.initDefault.call(this,e);var i=new $f;i.initDefault(),this.mipmaps=[{front:i,back:i,top:i,bottom:i,left:i,right:i}]},i.validate=function(){if(this._mipmapMode===hm.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(),o=i.right.extractMipmaps(),a=i.top.extractMipmaps(),h=i.bottom.extractMipmaps();if(n.length!==r.length||n.length!==s.length||n.length!==o.length||n.length!==a.length||n.length!==h.length)return Z(16347),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:o[c],top:a[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)if(Fo.os!==co.IOS){var n=this._mipmapAtlas.atlas,r=this._mipmapAtlas.layout,s=r[0],o=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 a=function(){var t=r[h];Sm(n,(function(n,r){o.clearRect(0,0,i.width,i.height);var s=n.data;o.drawImage(s,0,0);var a=o.getImageData(t.left,t.top,t.width,t.height),h=new $f({_data:a.data,_compressed:n.isCompressed,width:a.width,height:a.height,format:n.format});e._assignImage(h,t.level,r)}))},h=0;h<r.length;h++)a()}else this._uploadAtlas()}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}(Eg)).FaceIndex=am,im=ua((em=om).prototype,"isRGBE",[wa],(function(){return!1})),nm=ua(em.prototype,"_mipmapAtlas",[wa],(function(){return null})),rm=ua(em.prototype,"_mipmapMode",[wa],(function(){return hm.NONE})),sm=ua(em.prototype,"_mipmaps",[wa],(function(){return[]})),tm=em))||tm);function Sm(t,e){e(t.front,am.front),e(t.back,am.back),e(t.left,am.left),e(t.right,am.right),e(t.top,am.top),e(t.bottom,am.bottom)}m.TextureCube=Em;var Am,bm,Cm,Rm,wm,Im,xm,Dm,Om,Pm,Mm,Nm,Lm,Bm,Fm,km,Um=function(){function t(){this._groundAlbedoHDR=new on(.2,.2,.2,1),this._skyColorHDR=new on(.2,.5,.8,1),this._skyIllumHDR=0,this._groundAlbedoLDR=new on(.2,.2,.2,1),this._skyColorLDR=new on(.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 m.director.root.pipeline.pipelineSceneData.isHDR?this._skyColorHDR:this._skyColorLDR},set:function(t){m.director.root.pipeline.pipelineSceneData.isHDR?this._skyColorHDR.set(t):this._skyColorLDR.set(t)}},{key:"skyIllum",get:function(){return m.director.root.pipeline.pipelineSceneData.isHDR?this._skyIllumHDR:this._skyIllumLDR},set:function(t){m.director.root.pipeline.pipelineSceneData.isHDR?this._skyIllumHDR=t:this._skyIllumLDR=t}},{key:"groundAlbedo",get:function(){return m.director.root.pipeline.pipelineSceneData.isHDR?this._groundAlbedoHDR:this._groundAlbedoLDR},set:function(t){m.director.root.pipeline.pipelineSceneData.isHDR?this._groundAlbedoHDR.set(t):this._groundAlbedoLDR.set(t)}}]),t}();Um.SUN_ILLUM=65e3,Um.SKY_ILLUM=2e4,m.Ambient=Um,function(t){t[t.DEFAULT=100]="DEFAULT",t[t.UI=200]="UI"}(Fm||(Fm={})),m.RenderPassStage=Fm,function(t){t[t.MIN=0]="MIN",t[t.MAX=255]="MAX",t[t.DEFAULT=128]="DEFAULT"}(km||(km={}));var Gm,Hm={bindings:[],layouts:{}},zm={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"}(Gm||(Gm={}));var Vm,Wm=Gm.SAMPLER_SHADOWMAP,Xm=Gm.COUNT-Wm;!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"}(Vm||(Vm={}));var jm,Ym=Vm.SAMPLER_JOINTS,Km=Vm.STORAGE_REFLECTION-Ym,qm=Vm.COUNT-Ym-Km;!function(t){t[t.GLOBAL=0]="GLOBAL",t[t.MATERIAL=1]="MATERIAL",t[t.LOCAL=2]="LOCAL",t[t.COUNT=3]="COUNT"}(jm||(jm={}));var Qm=new p_([Wm,0,Ym,0],[Xm,0,Km,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,qm,0],[0,0,0,0],[0,2,1,3]),Zm=function(){};Am=Zm,Zm.TIME_OFFSET=0,Zm.SCREEN_SIZE_OFFSET=Am.TIME_OFFSET+4,Zm.NATIVE_SIZE_OFFSET=Am.SCREEN_SIZE_OFFSET+4,Zm.PROBE_INFO_OFFSET=Am.NATIVE_SIZE_OFFSET+4,Zm.DEBUG_VIEW_MODE_OFFSET=Am.PROBE_INFO_OFFSET+4,Zm.COUNT=Am.DEBUG_VIEW_MODE_OFFSET+4,Zm.SIZE=4*Am.COUNT,Zm.NAME="CCGlobal",Zm.BINDING=Gm.UBO_GLOBAL,Zm.DESCRIPTOR=new Y_(Am.BINDING,Yl.UNIFORM_BUFFER,1,Ll.ALL),Zm.LAYOUT=new w_(jm.GLOBAL,Am.BINDING,Am.NAME,[new R_("cc_time",ml.FLOAT4,1),new R_("cc_screenSize",ml.FLOAT4,1),new R_("cc_nativeSize",ml.FLOAT4,1),new R_("cc_probeInfo",ml.FLOAT4,1),new R_("cc_debug_view_mode",ml.FLOAT4,1)],1),Hm.layouts[Zm.NAME]=Zm.LAYOUT,Hm.bindings[Zm.BINDING]=Zm.DESCRIPTOR;var Jm=function(){};bm=Jm,Jm.MAT_VIEW_OFFSET=0,Jm.MAT_VIEW_INV_OFFSET=bm.MAT_VIEW_OFFSET+16,Jm.MAT_PROJ_OFFSET=bm.MAT_VIEW_INV_OFFSET+16,Jm.MAT_PROJ_INV_OFFSET=bm.MAT_PROJ_OFFSET+16,Jm.MAT_VIEW_PROJ_OFFSET=bm.MAT_PROJ_INV_OFFSET+16,Jm.MAT_VIEW_PROJ_INV_OFFSET=bm.MAT_VIEW_PROJ_OFFSET+16,Jm.CAMERA_POS_OFFSET=bm.MAT_VIEW_PROJ_INV_OFFSET+16,Jm.SURFACE_TRANSFORM_OFFSET=bm.CAMERA_POS_OFFSET+4,Jm.SCREEN_SCALE_OFFSET=bm.SURFACE_TRANSFORM_OFFSET+4,Jm.EXPOSURE_OFFSET=bm.SCREEN_SCALE_OFFSET+4,Jm.MAIN_LIT_DIR_OFFSET=bm.EXPOSURE_OFFSET+4,Jm.MAIN_LIT_COLOR_OFFSET=bm.MAIN_LIT_DIR_OFFSET+4,Jm.AMBIENT_SKY_OFFSET=bm.MAIN_LIT_COLOR_OFFSET+4,Jm.AMBIENT_GROUND_OFFSET=bm.AMBIENT_SKY_OFFSET+4,Jm.GLOBAL_FOG_COLOR_OFFSET=bm.AMBIENT_GROUND_OFFSET+4,Jm.GLOBAL_FOG_BASE_OFFSET=bm.GLOBAL_FOG_COLOR_OFFSET+4,Jm.GLOBAL_FOG_ADD_OFFSET=bm.GLOBAL_FOG_BASE_OFFSET+4,Jm.NEAR_FAR_OFFSET=bm.GLOBAL_FOG_ADD_OFFSET+4,Jm.VIEW_PORT_OFFSET=bm.NEAR_FAR_OFFSET+4,Jm.COUNT=bm.VIEW_PORT_OFFSET+4,Jm.SIZE=4*bm.COUNT,Jm.NAME="CCCamera",Jm.BINDING=Gm.UBO_CAMERA,Jm.DESCRIPTOR=new Y_(bm.BINDING,Yl.UNIFORM_BUFFER,1,Ll.ALL),Jm.LAYOUT=new w_(jm.GLOBAL,bm.BINDING,bm.NAME,[new R_("cc_matView",ml.MAT4,1),new R_("cc_matViewInv",ml.MAT4,1),new R_("cc_matProj",ml.MAT4,1),new R_("cc_matProjInv",ml.MAT4,1),new R_("cc_matViewProj",ml.MAT4,1),new R_("cc_matViewProjInv",ml.MAT4,1),new R_("cc_cameraPos",ml.FLOAT4,1),new R_("cc_surfaceTransform",ml.FLOAT4,1),new R_("cc_screenScale",ml.FLOAT4,1),new R_("cc_exposure",ml.FLOAT4,1),new R_("cc_mainLitDir",ml.FLOAT4,1),new R_("cc_mainLitColor",ml.FLOAT4,1),new R_("cc_ambientSky",ml.FLOAT4,1),new R_("cc_ambientGround",ml.FLOAT4,1),new R_("cc_fogColor",ml.FLOAT4,1),new R_("cc_fogBase",ml.FLOAT4,1),new R_("cc_fogAdd",ml.FLOAT4,1),new R_("cc_nearFar",ml.FLOAT4,1),new R_("cc_viewPort",ml.FLOAT4,1)],1),Hm.layouts[Jm.NAME]=Jm.LAYOUT,Hm.bindings[Jm.BINDING]=Jm.DESCRIPTOR;var $m=function(){};Cm=$m,$m.MAT_LIGHT_VIEW_OFFSET=0,$m.MAT_LIGHT_VIEW_PROJ_OFFSET=Cm.MAT_LIGHT_VIEW_OFFSET+16,$m.SHADOW_INV_PROJ_DEPTH_INFO_OFFSET=Cm.MAT_LIGHT_VIEW_PROJ_OFFSET+16,$m.SHADOW_PROJ_DEPTH_INFO_OFFSET=Cm.SHADOW_INV_PROJ_DEPTH_INFO_OFFSET+4,$m.SHADOW_PROJ_INFO_OFFSET=Cm.SHADOW_PROJ_DEPTH_INFO_OFFSET+4,$m.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET=Cm.SHADOW_PROJ_INFO_OFFSET+4,$m.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET=Cm.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET+4,$m.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET=Cm.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+4,$m.SHADOW_COLOR_OFFSET=Cm.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+4,$m.PLANAR_NORMAL_DISTANCE_INFO_OFFSET=Cm.SHADOW_COLOR_OFFSET+4,$m.COUNT=Cm.PLANAR_NORMAL_DISTANCE_INFO_OFFSET+4,$m.SIZE=4*Cm.COUNT,$m.NAME="CCShadow",$m.BINDING=Gm.UBO_SHADOW,$m.DESCRIPTOR=new Y_(Cm.BINDING,Yl.UNIFORM_BUFFER,1,Ll.ALL),$m.LAYOUT=new w_(jm.GLOBAL,Cm.BINDING,Cm.NAME,[new R_("cc_matLightView",ml.MAT4,1),new R_("cc_matLightViewProj",ml.MAT4,1),new R_("cc_shadowInvProjDepthInfo",ml.FLOAT4,1),new R_("cc_shadowProjDepthInfo",ml.FLOAT4,1),new R_("cc_shadowProjInfo",ml.FLOAT4,1),new R_("cc_shadowNFLSInfo",ml.FLOAT4,1),new R_("cc_shadowWHPBInfo",ml.FLOAT4,1),new R_("cc_shadowLPNNInfo",ml.FLOAT4,1),new R_("cc_shadowColor",ml.FLOAT4,1),new R_("cc_planarNDInfo",ml.FLOAT4,1)],1),Hm.layouts[$m.NAME]=$m.LAYOUT,Hm.bindings[$m.BINDING]=$m.DESCRIPTOR;var tv=function(){};Rm=tv,tv.CSM_LEVEL_COUNT=4,tv.CSM_VIEW_DIR_0_OFFSET=0,tv.CSM_VIEW_DIR_1_OFFSET=Rm.CSM_VIEW_DIR_0_OFFSET+4*Rm.CSM_LEVEL_COUNT,tv.CSM_VIEW_DIR_2_OFFSET=Rm.CSM_VIEW_DIR_1_OFFSET+4*Rm.CSM_LEVEL_COUNT,tv.CSM_ATLAS_OFFSET=Rm.CSM_VIEW_DIR_2_OFFSET+4*Rm.CSM_LEVEL_COUNT,tv.MAT_CSM_VIEW_PROJ_OFFSET=Rm.CSM_ATLAS_OFFSET+4*Rm.CSM_LEVEL_COUNT,tv.CSM_PROJ_DEPTH_INFO_OFFSET=Rm.MAT_CSM_VIEW_PROJ_OFFSET+16*Rm.CSM_LEVEL_COUNT,tv.CSM_PROJ_INFO_OFFSET=Rm.CSM_PROJ_DEPTH_INFO_OFFSET+4*Rm.CSM_LEVEL_COUNT,tv.CSM_SPLITS_INFO_OFFSET=Rm.CSM_PROJ_INFO_OFFSET+4*Rm.CSM_LEVEL_COUNT,tv.COUNT=Rm.CSM_SPLITS_INFO_OFFSET+4,tv.SIZE=4*Rm.COUNT,tv.NAME="CCCSM",tv.BINDING=Gm.UBO_CSM,tv.DESCRIPTOR=new Y_(Rm.BINDING,Yl.UNIFORM_BUFFER,1,Ll.FRAGMENT),tv.LAYOUT=new w_(jm.GLOBAL,Rm.BINDING,Rm.NAME,[new R_("cc_csmViewDir0",ml.FLOAT4,Rm.CSM_LEVEL_COUNT),new R_("cc_csmViewDir1",ml.FLOAT4,Rm.CSM_LEVEL_COUNT),new R_("cc_csmViewDir2",ml.FLOAT4,Rm.CSM_LEVEL_COUNT),new R_("cc_csmAtlas",ml.FLOAT4,Rm.CSM_LEVEL_COUNT),new R_("cc_matCSMViewProj",ml.MAT4,Rm.CSM_LEVEL_COUNT),new R_("cc_csmProjDepthInfo",ml.FLOAT4,Rm.CSM_LEVEL_COUNT),new R_("cc_csmProjInfo",ml.FLOAT4,Rm.CSM_LEVEL_COUNT),new R_("cc_csmSplitsInfo",ml.FLOAT4,1)],1),Hm.layouts[tv.NAME]=tv.LAYOUT,Hm.bindings[tv.BINDING]=tv.DESCRIPTOR;var ev=Gm.SAMPLER_SHADOWMAP,iv=new Y_(ev,Yl.SAMPLER_TEXTURE,1,Ll.FRAGMENT),nv=new I_(jm.GLOBAL,ev,"cc_shadowMap",ml.SAMPLER2D,1);Hm.layouts.cc_shadowMap=nv,Hm.bindings[ev]=iv;var rv=Gm.SAMPLER_ENVIRONMENT,sv=new Y_(rv,Yl.SAMPLER_TEXTURE,1,Ll.FRAGMENT),ov=new I_(jm.GLOBAL,rv,"cc_environment",ml.SAMPLER_CUBE,1);Hm.layouts.cc_environment=ov,Hm.bindings[rv]=sv;var av=Gm.SAMPLER_DIFFUSEMAP,hv=new Y_(av,Yl.SAMPLER_TEXTURE,1,Ll.FRAGMENT),uv=new I_(jm.GLOBAL,av,"cc_diffuseMap",ml.SAMPLER_CUBE,1);Hm.layouts.cc_diffuseMap=uv,Hm.bindings[av]=hv;var cv=Gm.SAMPLER_SPOT_SHADOW_MAP,lv=new Y_(cv,Yl.SAMPLER_TEXTURE,1,Ll.FRAGMENT),_v=new I_(jm.GLOBAL,cv,"cc_spotShadowMap",ml.SAMPLER2D,1);Hm.layouts.cc_spotShadowMap=_v,Hm.bindings[cv]=lv;var dv=function(){};wm=dv,dv.MAT_WORLD_OFFSET=0,dv.MAT_WORLD_IT_OFFSET=wm.MAT_WORLD_OFFSET+16,dv.LIGHTINGMAP_UVPARAM=wm.MAT_WORLD_IT_OFFSET+16,dv.LOCAL_SHADOW_BIAS=wm.LIGHTINGMAP_UVPARAM+4,dv.REFLECTION_PROBE_DATA1=wm.LOCAL_SHADOW_BIAS+4,dv.REFLECTION_PROBE_DATA2=wm.REFLECTION_PROBE_DATA1+4,dv.REFLECTION_PROBE_BLEND_DATA1=wm.REFLECTION_PROBE_DATA2+4,dv.REFLECTION_PROBE_BLEND_DATA2=wm.REFLECTION_PROBE_BLEND_DATA1+4,dv.COUNT=wm.REFLECTION_PROBE_BLEND_DATA2+4,dv.SIZE=4*wm.COUNT,dv.NAME="CCLocal",dv.BINDING=Vm.UBO_LOCAL,dv.DESCRIPTOR=new Y_(wm.BINDING,Yl.UNIFORM_BUFFER,1,Ll.VERTEX|Ll.FRAGMENT|Ll.COMPUTE),dv.LAYOUT=new w_(jm.LOCAL,wm.BINDING,wm.NAME,[new R_("cc_matWorld",ml.MAT4,1),new R_("cc_matWorldIT",ml.MAT4,1),new R_("cc_lightingMapUVParam",ml.FLOAT4,1),new R_("cc_localShadowBias",ml.FLOAT4,1),new R_("cc_reflectionProbeData1",ml.FLOAT4,1),new R_("cc_reflectionProbeData2",ml.FLOAT4,1),new R_("cc_reflectionProbeBlendData1",ml.FLOAT4,1),new R_("cc_reflectionProbeBlendData2",ml.FLOAT4,1)],1),zm.layouts[dv.NAME]=dv.LAYOUT,zm.bindings[dv.BINDING]=dv.DESCRIPTOR;var fv=function(){};Im=fv,fv.WORLD_BOUND_CENTER=0,fv.WORLD_BOUND_HALF_EXTENTS=Im.WORLD_BOUND_CENTER+4,fv.COUNT=Im.WORLD_BOUND_HALF_EXTENTS+4,fv.SIZE=4*Im.COUNT,fv.NAME="CCWorldBound",fv.BINDING=Vm.UBO_LOCAL,fv.DESCRIPTOR=new Y_(Im.BINDING,Yl.UNIFORM_BUFFER,1,Ll.VERTEX|Ll.COMPUTE),fv.LAYOUT=new w_(jm.LOCAL,Im.BINDING,Im.NAME,[new R_("cc_worldBoundCenter",ml.FLOAT4,1),new R_("cc_worldBoundHalfExtents",ml.FLOAT4,1)],1),zm.layouts[fv.NAME]=fv.LAYOUT,zm.bindings[fv.BINDING]=fv.DESCRIPTOR;var pv="a_matWorld0",gv="a_sh_linear_const_r",mv=function(){};xm=mv,mv.BATCHING_COUNT=10,mv.MAT_WORLDS_OFFSET=0,mv.COUNT=16*xm.BATCHING_COUNT,mv.SIZE=4*xm.COUNT,mv.NAME="CCLocalBatched",mv.BINDING=Vm.UBO_LOCAL,mv.DESCRIPTOR=new Y_(xm.BINDING,Yl.UNIFORM_BUFFER,1,Ll.VERTEX|Ll.COMPUTE),mv.LAYOUT=new w_(jm.LOCAL,xm.BINDING,xm.NAME,[new R_("cc_matWorlds",ml.MAT4,xm.BATCHING_COUNT)],1),zm.layouts[mv.NAME]=mv.LAYOUT,zm.bindings[mv.BINDING]=mv.DESCRIPTOR;var vv=function(){};Dm=vv,vv.LIGHTS_PER_PASS=1,vv.LIGHT_POS_OFFSET=0,vv.LIGHT_COLOR_OFFSET=Dm.LIGHT_POS_OFFSET+4*Dm.LIGHTS_PER_PASS,vv.LIGHT_SIZE_RANGE_ANGLE_OFFSET=Dm.LIGHT_COLOR_OFFSET+4*Dm.LIGHTS_PER_PASS,vv.LIGHT_DIR_OFFSET=Dm.LIGHT_SIZE_RANGE_ANGLE_OFFSET+4*Dm.LIGHTS_PER_PASS,vv.LIGHT_BOUNDING_SIZE_VS_OFFSET=Dm.LIGHT_DIR_OFFSET+4*Dm.LIGHTS_PER_PASS,vv.COUNT=Dm.LIGHT_BOUNDING_SIZE_VS_OFFSET+4*Dm.LIGHTS_PER_PASS,vv.SIZE=4*Dm.COUNT,vv.NAME="CCForwardLight",vv.BINDING=Vm.UBO_FORWARD_LIGHTS,vv.DESCRIPTOR=new Y_(Dm.BINDING,Yl.DYNAMIC_UNIFORM_BUFFER,1,Ll.FRAGMENT),vv.LAYOUT=new w_(jm.LOCAL,Dm.BINDING,Dm.NAME,[new R_("cc_lightPos",ml.FLOAT4,Dm.LIGHTS_PER_PASS),new R_("cc_lightColor",ml.FLOAT4,Dm.LIGHTS_PER_PASS),new R_("cc_lightSizeRangeAngle",ml.FLOAT4,Dm.LIGHTS_PER_PASS),new R_("cc_lightDir",ml.FLOAT4,Dm.LIGHTS_PER_PASS),new R_("cc_lightBoundingSizeVS",ml.FLOAT4,Dm.LIGHTS_PER_PASS)],1),zm.layouts[vv.NAME]=vv.LAYOUT,zm.bindings[vv.BINDING]=vv.DESCRIPTOR;var yv=function(){};yv.LIGHTS_PER_PASS=10;var Tv=function(){};Om=Tv,Tv.JOINTS_TEXTURE_INFO_OFFSET=0,Tv.COUNT=Om.JOINTS_TEXTURE_INFO_OFFSET+4,Tv.SIZE=4*Om.COUNT,Tv.NAME="CCSkinningTexture",Tv.BINDING=Vm.UBO_SKINNING_TEXTURE,Tv.DESCRIPTOR=new Y_(Om.BINDING,Yl.UNIFORM_BUFFER,1,Ll.VERTEX),Tv.LAYOUT=new w_(jm.LOCAL,Om.BINDING,Om.NAME,[new R_("cc_jointTextureInfo",ml.FLOAT4,1)],1),zm.layouts[Tv.NAME]=Tv.LAYOUT,zm.bindings[Tv.BINDING]=Tv.DESCRIPTOR;var Ev=function(){};Pm=Ev,Ev.JOINTS_ANIM_INFO_OFFSET=0,Ev.COUNT=Pm.JOINTS_ANIM_INFO_OFFSET+4,Ev.SIZE=4*Pm.COUNT,Ev.NAME="CCSkinningAnimation",Ev.BINDING=Vm.UBO_SKINNING_ANIMATION,Ev.DESCRIPTOR=new Y_(Pm.BINDING,Yl.UNIFORM_BUFFER,1,Ll.VERTEX),Ev.LAYOUT=new w_(jm.LOCAL,Pm.BINDING,Pm.NAME,[new R_("cc_jointAnimInfo",ml.FLOAT4,1)],1),zm.layouts[Ev.NAME]=Ev.LAYOUT,zm.bindings[Ev.BINDING]=Ev.DESCRIPTOR;var Sv="a_jointAnimInfo",Av=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 bv(t){Av.initLayout(t),zm.layouts[Av.NAME]=Av.LAYOUT,zm.bindings[Av.BINDING]=Av.DESCRIPTOR}Mm=Av,Av._jointUniformCapacity=0,Av._count=0,Av._size=0,Av.NAME="CCSkinning",Av.BINDING=Vm.UBO_SKINNING_TEXTURE,Av.DESCRIPTOR=new Y_(Mm.BINDING,Yl.UNIFORM_BUFFER,1,Ll.VERTEX),Av.LAYOUT=new w_(jm.LOCAL,Mm.BINDING,Mm.NAME,[new R_("cc_joints",ml.FLOAT4,1)],1);var Cv=function(){};Nm=Cv,Cv.MAX_MORPH_TARGET_COUNT=60,Cv.OFFSET_OF_WEIGHTS=0,Cv.OFFSET_OF_DISPLACEMENT_TEXTURE_WIDTH=4*Nm.MAX_MORPH_TARGET_COUNT,Cv.OFFSET_OF_DISPLACEMENT_TEXTURE_HEIGHT=Nm.OFFSET_OF_DISPLACEMENT_TEXTURE_WIDTH+4,Cv.OFFSET_OF_VERTICES_COUNT=Nm.OFFSET_OF_DISPLACEMENT_TEXTURE_HEIGHT+4,Cv.COUNT_BASE_4_BYTES=4*Math.ceil(Nm.MAX_MORPH_TARGET_COUNT/4)+4,Cv.SIZE=4*Nm.COUNT_BASE_4_BYTES,Cv.NAME="CCMorph",Cv.BINDING=Vm.UBO_MORPH,Cv.DESCRIPTOR=new Y_(Nm.BINDING,Yl.UNIFORM_BUFFER,1,Ll.VERTEX),Cv.LAYOUT=new w_(jm.LOCAL,Nm.BINDING,Nm.NAME,[new R_("cc_displacementWeights",ml.FLOAT4,Nm.MAX_MORPH_TARGET_COUNT/4),new R_("cc_displacementTextureInfo",ml.FLOAT4,1)],1),zm.layouts[Cv.NAME]=Cv.LAYOUT,zm.bindings[Cv.BINDING]=Cv.DESCRIPTOR;var Rv=function(){};Lm=Rv,Rv.NAME="CCUILocal",Rv.BINDING=Vm.UBO_UI_LOCAL,Rv.DESCRIPTOR=new Y_(Lm.BINDING,Yl.DYNAMIC_UNIFORM_BUFFER,1,Ll.VERTEX),Rv.LAYOUT=new w_(jm.LOCAL,Lm.BINDING,Lm.NAME,[new R_("cc_local_data",ml.FLOAT4,1)],1),zm.layouts[Rv.NAME]=Rv.LAYOUT,zm.bindings[Rv.BINDING]=Rv.DESCRIPTOR;var wv=function(){};Bm=wv,wv.SH_LINEAR_CONST_R_OFFSET=0,wv.SH_LINEAR_CONST_G_OFFSET=Bm.SH_LINEAR_CONST_R_OFFSET+4,wv.SH_LINEAR_CONST_B_OFFSET=Bm.SH_LINEAR_CONST_G_OFFSET+4,wv.SH_QUADRATIC_R_OFFSET=Bm.SH_LINEAR_CONST_B_OFFSET+4,wv.SH_QUADRATIC_G_OFFSET=Bm.SH_QUADRATIC_R_OFFSET+4,wv.SH_QUADRATIC_B_OFFSET=Bm.SH_QUADRATIC_G_OFFSET+4,wv.SH_QUADRATIC_A_OFFSET=Bm.SH_QUADRATIC_B_OFFSET+4,wv.COUNT=Bm.SH_QUADRATIC_A_OFFSET+4,wv.SIZE=4*Bm.COUNT,wv.NAME="CCSH",wv.BINDING=Vm.UBO_SH,wv.DESCRIPTOR=new Y_(Bm.BINDING,Yl.UNIFORM_BUFFER,1,Ll.FRAGMENT),wv.LAYOUT=new w_(jm.LOCAL,Bm.BINDING,Bm.NAME,[new R_("cc_sh_linear_const_r",ml.FLOAT4,1),new R_("cc_sh_linear_const_g",ml.FLOAT4,1),new R_("cc_sh_linear_const_b",ml.FLOAT4,1),new R_("cc_sh_quadratic_r",ml.FLOAT4,1),new R_("cc_sh_quadratic_g",ml.FLOAT4,1),new R_("cc_sh_quadratic_b",ml.FLOAT4,1),new R_("cc_sh_quadratic_a",ml.FLOAT4,1)],1),zm.layouts[wv.NAME]=wv.LAYOUT,zm.bindings[wv.BINDING]=wv.DESCRIPTOR;var Iv=Vm.SAMPLER_JOINTS,xv=new Y_(Iv,Yl.SAMPLER_TEXTURE,1,Ll.VERTEX),Dv=new I_(jm.LOCAL,Iv,"cc_jointTexture",ml.SAMPLER2D,1);zm.layouts.cc_jointTexture=Dv,zm.bindings[Iv]=xv;var Ov=Vm.SAMPLER_JOINTS,Pv=new Y_(Ov,Yl.SAMPLER_TEXTURE,1,Ll.VERTEX),Mv=new I_(jm.LOCAL,Ov,"cc_realtimeJoint",ml.SAMPLER2D,1);zm.layouts.cc_realtimeJoint=Mv,zm.bindings[Ov]=Pv;var Nv=Vm.SAMPLER_MORPH_POSITION,Lv=new Y_(Nv,Yl.SAMPLER_TEXTURE,1,Ll.VERTEX),Bv=new I_(jm.LOCAL,Nv,"cc_PositionDisplacements",ml.SAMPLER2D,1);zm.layouts.cc_PositionDisplacements=Bv,zm.bindings[Nv]=Lv;var Fv=Vm.SAMPLER_MORPH_NORMAL,kv=new Y_(Fv,Yl.SAMPLER_TEXTURE,1,Ll.VERTEX),Uv=new I_(jm.LOCAL,Fv,"cc_NormalDisplacements",ml.SAMPLER2D,1);zm.layouts.cc_NormalDisplacements=Uv,zm.bindings[Fv]=kv;var Gv=Vm.SAMPLER_MORPH_TANGENT,Hv=new Y_(Gv,Yl.SAMPLER_TEXTURE,1,Ll.VERTEX),zv=new I_(jm.LOCAL,Gv,"cc_TangentDisplacements",ml.SAMPLER2D,1);zm.layouts.cc_TangentDisplacements=zv,zm.bindings[Gv]=Hv;var Vv=Vm.SAMPLER_LIGHTMAP,Wv=new Y_(Vv,Yl.SAMPLER_TEXTURE,1,Ll.FRAGMENT),Xv=new I_(jm.LOCAL,Vv,"cc_lightingMap",ml.SAMPLER2D,1);zm.layouts.cc_lightingMap=Xv,zm.bindings[Vv]=Wv;var jv=Vm.SAMPLER_SPRITE,Yv=new Y_(jv,Yl.SAMPLER_TEXTURE,1,Ll.FRAGMENT),Kv=new I_(jm.LOCAL,jv,"cc_spriteTexture",ml.SAMPLER2D,1);zm.layouts.cc_spriteTexture=Kv,zm.bindings[jv]=Yv;var qv=Vm.SAMPLER_REFLECTION,Qv=new Y_(qv,Yl.SAMPLER_TEXTURE,1,Ll.FRAGMENT),Zv=new I_(jm.LOCAL,qv,"cc_reflectionTexture",ml.SAMPLER2D,1);zm.layouts.cc_reflectionTexture=Zv,zm.bindings[qv]=Qv;var Jv=Vm.STORAGE_REFLECTION,$v=new Y_(Jv,Yl.STORAGE_IMAGE,1,Ll.COMPUTE),ty=new O_(jm.LOCAL,Jv,"cc_reflectionStorage",ml.IMAGE2D,1);zm.layouts.cc_reflectionStorage=ty,zm.bindings[Jv]=$v;var ey=Vm.SAMPLER_REFLECTION_PROBE_CUBE,iy=new Y_(ey,Yl.SAMPLER_TEXTURE,1,Ll.FRAGMENT),ny=new I_(jm.LOCAL,ey,"cc_reflectionProbeCubemap",ml.SAMPLER_CUBE,1);zm.layouts.cc_reflectionProbeCubemap=ny,zm.bindings[ey]=iy;var ry=Vm.SAMPLER_REFLECTION_PROBE_PLANAR,sy=new Y_(ry,Yl.SAMPLER_TEXTURE,1,Ll.FRAGMENT),oy=new I_(jm.LOCAL,ry,"cc_reflectionProbePlanarMap",ml.SAMPLER2D,1);zm.layouts.cc_reflectionProbePlanarMap=oy,zm.bindings[ry]=sy;var ay=Vm.SAMPLER_REFLECTION_PROBE_DATA_MAP,hy=new Y_(ay,Yl.SAMPLER_TEXTURE,1,Ll.FRAGMENT),uy=new I_(jm.LOCAL,ay,"cc_reflectionProbeDataMap",ml.SAMPLER2D,1);zm.layouts.cc_reflectionProbeDataMap=uy,zm.bindings[ay]=hy;var cy=Vm.SAMPLER_REFLECTION_PROBE_BLEND_CUBE,ly=new Y_(cy,Yl.SAMPLER_TEXTURE,1,Ll.FRAGMENT),_y=new I_(jm.LOCAL,cy,"cc_reflectionProbeBlendCubemap",ml.SAMPLER_CUBE,1);zm.layouts.cc_reflectionProbeBlendCubemap=_y,zm.bindings[cy]=ly;var dy,fy,py,gy,my=Rg.makeMaskExclude([Rg.BitMask.UI_2D,Rg.BitMask.GIZMOS,Rg.BitMask.EDITOR,Rg.BitMask.SCENE_GIZMO,Rg.BitMask.PROFILER]),vy=Rg.makeMaskExclude([Rg.BitMask.UI_2D,Rg.BitMask.PROFILER]),yy=Rg.Enum.ALL;function Ty(t){if(dy)return dy;var e=new A_(Sl.TEX2D,Al.NONE,Ey(t)?pl.R32F:pl.RGBA8,16,16,bl.NONE,1,1,Rl.X1,1);return dy=t.createTexture(e)}function Ey(t){return(t.getFormatFeatures(pl.R32F)&(Cl.RENDER_TARGET|Cl.SAMPLED_TEXTURE))==(Cl.RENDER_TARGET|Cl.SAMPLED_TEXTURE)&&!(t.gfxAPI===_l.WEBGL)}function Sy(t){return(t.getFormatFeatures(pl.RGBA16F)&(Cl.RENDER_TARGET|Cl.SAMPLED_TEXTURE))==(Cl.RENDER_TARGET|Cl.SAMPLED_TEXTURE)}function Ay(){return!(!m.rendering||!m.rendering.enableEffectImport)}t("pipeline",Object.freeze({__proto__:null,PIPELINE_FLOW_MAIN:"MainFlow",PIPELINE_FLOW_FORWARD:"ForwardFlow",PIPELINE_FLOW_SHADOW:"ShadowFlow",PIPELINE_FLOW_SMAA:"SMAAFlow",PIPELINE_FLOW_TONEMAP:"ToneMapFlow",get RenderPassStage(){return Fm},get RenderPriority(){return km},globalDescriptorSetLayout:Hm,localDescriptorSetLayout:zm,get PipelineGlobalBindings(){return Gm},get ModelLocalBindings(){return Vm},get SetIndex(){return jm},bindingMappingInfo:Qm,UBOGlobal:Zm,UBOCamera:Jm,UBOShadow:$m,UBOCSM:tv,UNIFORM_SHADOWMAP_BINDING:ev,UNIFORM_ENVIRONMENT_BINDING:rv,UNIFORM_DIFFUSEMAP_BINDING:av,UNIFORM_SPOT_SHADOW_MAP_TEXTURE_BINDING:cv,UBOLocal:dv,UBOWorldBound:fv,INST_MAT_WORLD:pv,INST_SH:gv,UBOLocalBatched:mv,UBOForwardLight:vv,UBODeferredLight:yv,JOINT_UNIFORM_CAPACITY:30,UBOSkinningTexture:Tv,UBOSkinningAnimation:Ev,INST_JOINT_ANIM_INFO:Sv,UBOSkinning:Av,localDescriptorSetLayout_ResizeMaxJoints:bv,UBOMorph:Cv,UBOUILocal:Rv,UBOSH:wv,UNIFORM_JOINT_TEXTURE_BINDING:Iv,UNIFORM_REALTIME_JOINT_TEXTURE_BINDING:Ov,UNIFORM_POSITION_MORPH_TEXTURE_BINDING:Nv,UNIFORM_NORMAL_MORPH_TEXTURE_BINDING:Fv,UNIFORM_TANGENT_MORPH_TEXTURE_BINDING:Gv,UNIFORM_LIGHTMAP_TEXTURE_BINDING:Vv,UNIFORM_SPRITE_TEXTURE_BINDING:jv,UNIFORM_REFLECTION_TEXTURE_BINDING:qv,UNIFORM_REFLECTION_STORAGE_BINDING:Jv,UNIFORM_REFLECTION_PROBE_CUBEMAP_BINDING:ey,UNIFORM_REFLECTION_PROBE_TEXTURE_BINDING:ry,UNIFORM_REFLECTION_PROBE_DATA_MAP_BINDING:ay,UNIFORM_REFLECTION_PROBE_BLEND_CUBEMAP_BINDING:cy,CAMERA_DEFAULT_MASK:my,CAMERA_EDITOR_MASK:vy,MODEL_ALWAYS_MASK:yy,supportsR16HalfFloatTexture:function(t){return(t.getFormatFeatures(pl.R16F)&(Cl.RENDER_TARGET|Cl.SAMPLED_TEXTURE))==(Cl.RENDER_TARGET|Cl.SAMPLED_TEXTURE)},getDefaultShadowTexture:Ty,supportsR32FloatTexture:Ey,supportsRGBA16HalfFloatTexture:Sy,supportsRGBA32FloatTexture:function(t){return(t.getFormatFeatures(pl.RGBA32F)&(Cl.RENDER_TARGET|Cl.SAMPLED_TEXTURE))==(Cl.RENDER_TARGET|Cl.SAMPLED_TEXTURE)},isEnableEffect:Ay}));var by=4227858432,Cy=66060288,Ry=1044480,wy=function(t,e,i,n){return void 0===n&&(n=0),e<<26&by|t<<20&Cy|i<<12&Ry|4095&n},Iy=function(t){return(t&by)>>>26},xy=function(t){return(t&Cy)>>>20},Dy=function(t){return(t&Ry)>>>12},Oy=function(t){return 4095&t},Py=function(t,e){return 67108863&t|e<<26&by},My=((fy={})[ml.UNKNOWN]=function(t,e,i){return void 0===i&&(i=0),q(12010,i)},fy[ml.INT]=function(t,e,i){return void 0===i&&(i=0),t[i]},fy[ml.INT2]=function(t,e,i){return void 0===i&&(i=0),Hn.fromArray(e,t,i)},fy[ml.INT3]=function(t,e,i){return void 0===i&&(i=0),_n.fromArray(e,t,i)},fy[ml.INT4]=function(t,e,i){return void 0===i&&(i=0),on.fromArray(e,t,i)},fy[ml.FLOAT]=function(t,e,i){return void 0===i&&(i=0),t[i]},fy[ml.FLOAT2]=function(t,e,i){return void 0===i&&(i=0),Hn.fromArray(e,t,i)},fy[ml.FLOAT3]=function(t,e,i){return void 0===i&&(i=0),_n.fromArray(e,t,i)},fy[ml.FLOAT4]=function(t,e,i){return void 0===i&&(i=0),on.fromArray(e,t,i)},fy[ml.MAT3]=function(t,e,i){return void 0===i&&(i=0),Sn.fromArray(e,t,i)},fy[ml.MAT4]=function(t,e,i){return void 0===i&&(i=0),Ln.fromArray(e,t,i)},fy),Ny=((py={})[ml.UNKNOWN]=function(t,e,i){return void 0===i&&(i=0),q(12010,i)},py[ml.INT]=function(t,e,i){return void 0===i&&(i=0),t[i]=e},py[ml.INT2]=function(t,e,i){return void 0===i&&(i=0),Hn.toArray(t,e,i)},py[ml.INT3]=function(t,e,i){return void 0===i&&(i=0),_n.toArray(t,e,i)},py[ml.INT4]=function(t,e,i){return void 0===i&&(i=0),on.toArray(t,e,i)},py[ml.FLOAT]=function(t,e,i){return void 0===i&&(i=0),t[i]=e},py[ml.FLOAT2]=function(t,e,i){return void 0===i&&(i=0),Hn.toArray(t,e,i)},py[ml.FLOAT3]=function(t,e,i){return void 0===i&&(i=0),_n.toArray(t,e,i)},py[ml.FLOAT4]=function(t,e,i){return void 0===i&&(i=0),on.toArray(t,e,i)},py[ml.MAT3]=function(t,e,i){return void 0===i&&(i=0),Sn.toArray(t,e,i)},py[ml.MAT4]=function(t,e,i){return void 0===i&&(i=0),Ln.toArray(t,e,i)},py),Ly=((gy={})[ml.INT]=function(t){return"number"==typeof t},gy[ml.FLOAT]=function(t){return"number"==typeof t},gy[ml.INT2]=function(t){return!!(t instanceof Hn)},gy[ml.FLOAT2]=function(t){return!!(t instanceof Hn)},gy[ml.INT3]=function(t){return!!(t instanceof _n)},gy[ml.FLOAT3]=function(t){return!!(t instanceof _n)},gy[ml.INT4]=function(t){return!!(t instanceof on)},gy[ml.FLOAT4]=function(t){return!!(t instanceof on||t instanceof yn||t instanceof Rn)},gy[ml.MAT3]=function(t){return!!(t instanceof Sn)},gy[ml.MAT4]=function(t){return!!(t instanceof Ln)},gy),By=[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 Fy(t){switch(t){case ml.BOOL:case ml.INT:case ml.UINT:case ml.FLOAT:return By[0];case ml.BOOL2:case ml.INT2:case ml.UINT2:case ml.FLOAT2:return By[1];case ml.BOOL4:case ml.INT4:case ml.UINT4:case ml.FLOAT4:return By[2];case ml.MAT4:return By[3];case ml.SAMPLER2D:return"default-texture";case ml.SAMPLER_CUBE:return"default-cube-texture";case ml.SAMPLER2D_ARRAY:return"default-array-texture";case ml.SAMPLER3D:return"default-3d-texture"}return By[0]}function ky(t){switch(t){case ml.SAMPLER2D:return"-texture";case ml.SAMPLER_CUBE:return"-cube-texture";case ml.SAMPLER2D_ARRAY:return"-array-texture";case ml.SAMPLER3D:return"-3d-texture";default:return"-unknown"}}function Uy(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 Gy(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 q(16369),"-1"}}function Hy(t,e){for(var i=[],n=0;n<e.length;n++){var r=e[n],s=r.name,o=t[s],a=Gy(r,o),h=!o||"0"===o;i.push({name:s,value:a,isDefault:h})}return i}function zy(t,e){return t+e.reduce((function(t,e){return e.isDefault?t:t+"|"+e.name+e.value}),"")}function Vy(t,e){for(var i=0;i<t.length;i++){var n=t[i];if("!"===n[0]){if(e[n.slice(1)])return!1}else if(!e[n])return!1}return!0}function Wy(t,e,i){for(var n=[],r=t.attributes,s=0;s<r.length;s++)Vy(r[s].defines,i)&&n.push(e[s]);return n}function Xy(t,e){var i=t.defines;if(t.uber){for(var n="",r=0;r<i.length;r++){var s=i[r],o=e[s.name];if(o&&s._map){var a=s._map(o);n+=""+s._offset+a+"|"}}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}var jy=new Map;function Yy(t,e){if(e.count)return t+fd(e.type)*e.count;var i=jy.get(e.name);return void 0!==i?t+fd(e.type)*i:(Z(16345,e.name),t)}function Ky(t){return t.reduce(Yy,0)}function qy(t){for(var e={},i=0;i<t.blocks.length;i++)for(var n=t.blocks[i],r=n.members,s=0,o=0;o<r.length;o++){var a=r[o];e[a.name]=wy(n.binding,a.type,a.count,s),s+=(fd(a.type)>>2)*a.count}for(var h=0;h<t.samplerTextures.length;h++){var u=t.samplerTextures[h];e[u.name]=wy(u.binding,u.type,u.count)}return e}function Qy(t){return Math.ceil(Math.log2(Math.max(t,2)))}function Zy(t){for(var e=0,i=function(){var i=t.defines[n],r=1;if("number"===i.type){var s=i.range;r=Qy(s[1]-s[0]+1),i._map=function(t){return t-s[0]}}else"string"===i.type?(r=Qy(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"}function Jy(t){return Object.keys(t).reduce((function(e,i){return e.reduce((function(e,n){for(var s=t[i],o=0;o<s.length;++o){var a=r({},n);a[i]=s[o],e.push(a)}return e}),[])}),[{}])}jy.set("cc_joints",Av.LAYOUT.members[0].count),jy.set("cc_lightPos",vv.LIGHTS_PER_PASS),jy.set("cc_lightColor",vv.LIGHTS_PER_PASS),jy.set("cc_lightSizeRangeAngle",vv.LIGHTS_PER_PASS),jy.set("cc_lightDir",vv.LIGHTS_PER_PASS),jy.set("cc_lightBoundingSizeVS",vv.LIGHTS_PER_PASS);var $y=new K_;function tT(t,e,i,n,r){for(var s=t.builtins[n],o=[],a=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&ad))return q(16348,t.name),1;o.push(e),r&&!r.includes(n)&&r.push(n)},h=0;h<s.blocks.length;h++)a();Array.prototype.unshift.apply(e.shaderInfo.blocks,o);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&hd))return q(16349,t.name),1;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 eT(t){switch(t.gfxAPI){case _l.GLES2:case _l.WEBGL:return"glsl1";case _l.GLES3:case _l.WEBGL2:return"glsl3";default:return"glsl4"}}var iT,nT,rT,sT,oT,aT,hT,uT=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(Zy(i),this._templates[t.name]=i,!this._templateInfos[i.hash]){var n={};n.samplerStartBinding=i.blocks.length,n.shaderInfo=new B_,n.blockSizes=[],n.bindings=[];for(var s=0;s<i.blocks.length;s++){var o=i.blocks[s];n.blockSizes.push(Ky(o.members)),n.bindings.push(new Y_(o.binding,Yl.UNIFORM_BUFFER,1,o.stageFlags)),n.shaderInfo.blocks.push(new w_(jm.MATERIAL,o.binding,o.name,o.members.map((function(t){return new R_(t.name,t.type,t.count)})),1))}for(var a=0;a<i.samplerTextures.length;a++){var h=i.samplerTextures[a];n.bindings.push(new Y_(h.binding,Yl.SAMPLER_TEXTURE,h.count,h.stageFlags)),n.shaderInfo.samplerTextures.push(new I_(jm.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 Y_(c.binding,Yl.SAMPLER,c.count,c.stageFlags)),n.shaderInfo.samplers.push(new x_(jm.MATERIAL,c.binding,c.name,c.count))}for(var l=0;l<i.textures.length;l++){var _=i.textures[l];n.bindings.push(new Y_(_.binding,Yl.TEXTURE,_.count,_.stageFlags)),n.shaderInfo.textures.push(new D_(jm.MATERIAL,_.binding,_.name,_.type,_.count))}for(var d=0;d<i.buffers.length;d++){var f=i.buffers[d];n.bindings.push(new Y_(f.binding,Yl.STORAGE_BUFFER,1,f.stageFlags)),n.shaderInfo.buffers.push(new P_(jm.MATERIAL,f.binding,f.name,1,f.memoryAccess))}for(var p=0;p<i.images.length;p++){var g=i.images[p];n.bindings.push(new Y_(g.binding,Yl.STORAGE_IMAGE,g.count,g.stageFlags)),n.shaderInfo.images.push(new O_(jm.MATERIAL,g.binding,g.name,g.type,g.count,g.memoryAccess))}for(var m=0;m<i.subpassInputs.length;m++){var v=i.subpassInputs[m];n.bindings.push(new Y_(v.binding,Yl.INPUT_ATTACHMENT,v.count,v.stageFlags)),n.shaderInfo.subpassInputs.push(new M_(jm.MATERIAL,v.binding,v.name,v.count))}n.gfxAttributes=[];for(var y=0;y<i.attributes.length;y++){var T=i.attributes[y];n.gfxAttributes.push(new L_(T.name,T.format,T.isNormalized,0,T.isInstanced,T.location))}tT(i,n,zm,"locals"),n.shaderInfo.stages.push(new N_(Ll.VERTEX,"")),n.shaderInfo.stages.push(new N_(Ll.FRAGMENT,"")),n.handleMap=qy(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||($y.bindings=r.bindings,r.setLayouts[jm.MATERIAL]=t.createDescriptorSetLayout($y),$y.bindings=zm.bindings,r.setLayouts[jm.LOCAL]=t.createDescriptorSetLayout($y)),r.setLayouts[i?jm.LOCAL:jm.MATERIAL]},e.hasProgram=function(t){return void 0!==this._templates[t]},e.getKey=function(t,e){return Xy(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 o=r[s],a=this._cache[o];G("destroyed shader "+a.name),a.destroy(),delete this._cache[o]}},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 o=this._templates[e],a=this._templateInfos[o.hash];a.pipelineLayout||(this.getDescriptorSetLayout(t,e),tT(o,a,Hm,"globals"),a.setLayouts[jm.GLOBAL]=n.descriptorSetLayout,a.pipelineLayout=t.createPipelineLayout(new Q_(a.setLayouts)));var h=Hy(i,o.defines),u=n.constantMacros+o.constantMacros+h.reduce((function(t,e){return t+"#define "+e.name+" "+e.value+"\n"}),""),c=o.glsl3,l=eT(t);l?c=o[l]:Z(16346),a.shaderInfo.stages[0].source=u+c.vert,a.shaderInfo.stages[1].source=u+c.frag,a.shaderInfo.attributes=Wy(o,a.gfxAttributes,i),a.shaderInfo.name=zy(e,h);var _=a.shaderInfo;return this._cache[r]=t.createShader(_)},t}());m.programLib=uT;var cT=["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","float-output-process"],lT=t("EffectAsset",va("cc.EffectAsset")(((hT=function(t){function e(){var e;return(e=t.call(this)||this).techniques=rT&&rT(),e.shaders=sT&&sT(),e.combinations=oT&&oT(),e.hideInEditor=aT&&aT(),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 cT.includes(t)&&q(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(){if(m.rendering&&m.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);var t=m.rendering.programLib;t.addEffect(this),t.init(Qd.gfxDevice)}else uT.register(this);e.register(this),m.game.once(m.Game.EVENT_RENDERER_INITED,this._precompile,this)},i._precompile=function(){var t=this;if(m.rendering&&m.rendering.enableEffectImport)m.rendering.programLib.precompileEffect(Qd.gfxDevice,this);else for(var e=m.director.root,i=function(){var i=t.shaders[n],r=t.combinations[n];if(!r)return 1;Jy(r).forEach((function(t){return uT.getGFXShader(Qd.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}(Of))._effects={},hT._layoutValid=!0,rT=ua((nT=hT).prototype,"techniques",[wa],(function(){return[]})),sT=ua(nT.prototype,"shaders",[wa],(function(){return[]})),oT=ua(nT.prototype,"combinations",[wa],(function(){return[]})),aT=ua(nT.prototype,"hideInEditor",[wa,xa],(function(){return!1})),iT=nT))||iT);m.EffectAsset=lT;var _T=function(){function t(){this.name="",this.base="",this.importBase="",this.nativeBase="",this.deps=null,this.assetInfos=new $d,this.scenes=new $d,this.paths=new $d}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 o=0,a=e.length;o<a;o++)e[o]=vf(e[o]);for(var h in i){var u=i[h],c=u[1];u[1]=n[c]}}else{for(var l=Object.create(null),_=0,d=e.length;_<d;_++){var f=e[_];e[_]=l[f]=vf(f)}e=l}for(var p in i){var g=i[p];s[e[p]]=g}var m=t.scenes;for(var v in m){var y=m[v];m[v]=e[y]}var T=t.packs;for(var E in T)for(var S=T[E],A=0;A<S.length;++A)S[A]=e[S[A]];var b=t.versions;if(b)for(var C in b)for(var R=b[C],w=0;w<R.length;w+=2){var I=R[w];R[w]=e[I]||I}var x=t.redirect;if(x)for(var D=0;D<x.length;D+=2)x[D]=e[x[D]],x[D+1]=r[x[D+1]];if(t.extensionMap){var O=function(i){if(!Object.prototype.hasOwnProperty.call(t.extensionMap,i))return 1;t.extensionMap[i].forEach((function(n,r){t.extensionMap[i][r]=e[n]||n}))};for(var P in t.extensionMap)O(P)}}(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 1;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=Af(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(Wt(s.ctor,e))return s}}return null},e.getDirWithPath=function(t,e,i){"/"===(t=Af(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,o=i.length;s<o;s++){var a=i[s];e&&!Wt(a.ctor,e)||n.push(a)}})),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],o=3===n.length,a=this.assetInfos.get(i);a.path=r,a.ctor=ee(s),e.has(r)?o?e.get(r).push(a):e.get(r).unshift(a):e.add(r,[a])}}},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,o=n.length;s<o;s++){var a=n[s],h=e.get(a),u=h.packs;u?1===o?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 o=0,a=i.length;o<a;o+=2){var h=i[o];e.get(h).nativeVer=i[o+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 dT(t,e){t._uuid&&e.push(t._uuid)}function fT(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 o=0;o<s.length;o++){var a=s[o];a instanceof Of&&dT(a,e)}else if(s.constructor&&s.constructor!==Object)s instanceof Of&&dT(s,e);else for(var h=Object.getOwnPropertyNames(s),u=0;u<h.length;u++){var c=s[h[u]];c instanceof Of&&dT(c,e)}}}}function pT(t,e){for(var i=0;i<t._components.length;i++)fT(t._components[i],e);for(var n=0;n<t._children.length;n++)pT(t._children[n],e)}function gT(t,e,i,n){i.push(t._uuid);for(var r=dg.getDeps(t._uuid),s=0,o=r.length;s<o;s++){var a=nf.get(r[s]);if(a){var h=a._uuid;h in e?e[h]+=n:e[h]=a.refCount+n,i.includes(h)||gT(a,e,i,n)}}}var mT=[],vT=new(function(){function t(){this._persistNodeDeps=new $d,this._toDelete=new $d,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=[];pT(t,e);for(var i=0,n=e.length;i<n;i++){var r=nf.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=nf.get(e[i]);r&&r.decRef()}this._persistNodeDeps.remove(t.uuid)}},e._autoRelease=function(t,e,i){if(t){for(var n=dg.getDeps(t.uuid),r=0,s=n.length;r<s;r++){var o=nf.get(n[r]);o&&o.decRef(t.autoReleaseAssets)}var a=dg._depends.get(t.uuid);if(a&&a.persistDeps)for(var h=a.persistDeps,u=0,c=h.length;u<c;u++){var l=nf.get(h[u]);l&&l.decRef(t.autoReleaseAssets)}t.uuid!==e.uuid&&dg.remove(t.uuid)}var _=dg._depends.get(e.uuid);for(var f in _&&(_.persistDeps=[]),i){for(var p,g,m=i[f],v=this._persistNodeDeps.get(m.uuid),y=d(v);!(g=y()).done;){var T=g.value,E=nf.get(T);E&&E.addRef()}_&&(p=_.persistDeps).push.apply(p,v)}},e.tryRelease=function(t,e){void 0===e&&(e=!1),t instanceof Of&&(e?this._free(t,e):(this._toDelete.add(t._uuid,t),this._eventListener||(this._eventListener=!0,Ue(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),Zs(t,!0)&&-1===this._dontDestroyAssets.indexOf(i)&&!(!e&&t.refCount>0&&function(t){var e=Object.create(null);if(e[t._uuid]=t.refCount,gT(t,e,mT,-1),mT.length=0,0!==e[t._uuid])return e[t._uuid];for(var i in e)0!==e[i]&&gT(nf.get(i),e,mT,1);return mT.length=0,e[t._uuid]}(t)>0)){nf.remove(i);for(var n=dg.getDeps(i),r=0,s=n.length;r<s;r++){var o=nf.get(n[r]);o&&(o.decRef(!1),this._free(o,!1))}t.destroy(),dg.remove(i)}},t}()),yT=null;function TT(t,e){for(var i=0,n=t.input.length;i<n;i++){var r=t.input[i];e&&!r.isNative&&r.content instanceof Of&&r.content.decRef(!1),r.recycle()}t.input=null}function ET(t,e){return e?/\?/.test(t)?t+"&_t="+Date.now():t+"?_t="+Date.now():t}function ST(t,e,i,n,r){void 0===r&&(r=0),t(r,(function(s,o){r++,!s||r>e?n&&n(s,o):setTimeout((function(){ST(t,e,i,n,r)}),i)}))}function AT(t,e,i,n,s){try{for(var o=dg.parse(t,e),a=0,h=o.deps.length;a<h;a++){var u=o.deps[a];u in i||(i[u]=!0,n.push({uuid:u,bundle:s&&s.name}))}o.nativeDep&&(s&&(o.nativeDep.bundle=s.name),n.push(r({},o.nativeDep)))}catch(t){k(t.message,t.stack)}}function bT(t,e,i){e&&(i=void 0!==i?i:m.assetManager.cacheAsset,Sf(e)||!i||e.isDefault||nf.add(t,e))}function CT(t,e,i){var n=0,r=[],s=t.length;0===s&&i&&i(r);for(var o=function(t){t&&r.push(t),++n===s&&i&&i(r)},a=0;a<s;a++)e(t[a],o)}function RT(t,e,i){var n=t,r=e,s=i;if(void 0===i){var o="function"==typeof t;e?(s=e,o||(r=null)):void 0===e&&o&&(s=t,n=null,r=null),void 0!==e&&o&&(r=t,n=null)}return{options:n||Object.create(null),onProgress:r,onComplete:s}}function wT(t,e,i){var n=t,r=e,s=i;if(void 0===i){var o=Wt(t,Of);e?(s=e,o&&(r=null)):void 0!==e||o||(s=t,r=null,n=null),void 0===e||o||(r=t,n=null)}return{type:n,onProgress:r||yT,onComplete:s}}function IT(t,e,i,n){if(void 0===n&&(n={}),!i[e]||n[e])return!1;n[e]=!0;var r=!1,s=dg.getDeps(e);if(s)for(var o=0,a=s.length;o<a;o++){var h=s[o];if(h===t||IT(t,h,i,n)){r=!0;break}}return r}function xT(t){return function(e,i){if(t){var n=[];Array.isArray(i)?i.forEach((function(t){return t instanceof Of&&n.push(t.addRef())})):i instanceof Of&&n.push(i.addRef()),Ue((function(){n.forEach((function(t){return t.decRef(!1)})),t(e,i)}))}}}var DT=function(){function t(){this._config=new _T}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),of.add(t.name,this)},e.load=function(t,e,i,n){var r=wT(e,i,n),s=r.type,o=r.onProgress,a=r.onComplete,h={__requestType__:ef.PATH,type:s,bundle:this.name,__outputAsArray__:Array.isArray(t)};m.assetManager.loadAny(t,h,o,a)},e.preload=function(t,e,i,n){var r=wT(e,i,n),s=r.type,o=r.onProgress,a=r.onComplete;m.assetManager.preloadAny(t,{__requestType__:ef.PATH,type:s,bundle:this.name},o,a)},e.loadDir=function(t,e,i,n){var r=wT(e,i,n),s=r.type,o=r.onProgress,a=r.onComplete;m.assetManager.loadAny(t,{__requestType__:ef.DIR,type:s,bundle:this.name,__outputAsArray__:!0},o,a)},e.preloadDir=function(t,e,i,n){var r=wT(e,i,n),s=r.type,o=r.onProgress,a=r.onComplete;m.assetManager.preloadAny(t,{__requestType__:ef.DIR,type:s,bundle:this.name},o,a)},e.loadScene=function(t,e,i,n){var r=RT(e,i,n),s=r.options,o=r.onProgress,a=r.onComplete;s.preset=s.preset||"scene",s.bundle=this.name,m.assetManager.loadAny({scene:t},s,o,(function(t,e){if(t)k(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");a&&a(t,e)}))},e.preloadScene=function(t,e,i,n){var r=RT(e,i,n),s=r.options,o=r.onProgress,a=r.onComplete;s.bundle=this.name,m.assetManager.preloadAny({scene:t},s,o,(function(e){e&&Z(1210,t,e.message),a&&a(e)}))},e.get=function(t,e){var i=this.getInfoWithPath(t,e);return i&&nf.get(i.uuid)||null},e.release=function(t,e){var i=this.get(t,e);i&&vT.tryRelease(i,!0)},e.releaseUnusedAssets=function(){var t=this;nf.forEach((function(e){var i=t.getAssetInfo(e._uuid);i&&!i.redirect&&vT.tryRelease(e)}))},e.releaseAll=function(){var t=this;nf.forEach((function(e){var i=t.getAssetInfo(e._uuid);i&&!i.redirect&&vT.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}(),OT=t("resources",new DT);function PT(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(et(4930,t)))}return"file:"!==y.location.protocol&&(n.crossOrigin="anonymous"),n.addEventListener("load",r),n.addEventListener("error",s),n.src=t,n}function MT(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 o in e.xhrHeader)r.setRequestHeader(o,e.xhrHeader[o]);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}m.resources=OT;var NT=y.document,LT={};function BT(t,e,i){if(LT[t])return i&&i(null),null;var n=NT.createElement("script");function r(){n.parentNode.removeChild(n),n.removeEventListener("load",r,!1),n.removeEventListener("error",s,!1),LT[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(et(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),NT.body.appendChild(n),n}var FT=/^(?:\w+:\/\/|\.+\/).+/,kT=function(t,e,i){(Fo.hasFeature(Fo.Feature.IMAGE_BITMAP)&&m.assetManager.allowImageBitmap?UT:PT)(t,e,i)},UT=function(t,e,i){e.xhrResponseType="blob",MT(t,e,e.onFileProgress,i)},GT=function(t,e,i){e.xhrResponseType="json",MT(t,e,e.onFileProgress,i)},HT=function(t,e,i){e.xhrResponseType="arraybuffer",MT(t,e,e.onFileProgress,i)},zT=function(t,e,i){$T._downloadJson(t,e,(function(e,n){if(e)i(e);else{var r=Mp(n);Promise.all(r.chunks.map((function(i){return new Promise((function(n,r){$T._downloadArrayBuffer(""+So(t)+i,{},(function(t,i){e?r(e):n(new Uint8Array(i))}))}))}))).then((function(t){var e=new Pp(r.document,t);i(null,e)})).catch((function(t){i(t)}))}}))},VT=function(t,e,i){$T._downloadArrayBuffer(t,e,(function(t,e){if(t)i(t);else try{var n=Np(new Uint8Array(e));i(null,n)}catch(t){i(t)}}))},WT=function(t,e,i){e.xhrResponseType="text",MT(t,e,e.onFileProgress,i)},XT=function(t,e,i){var n=Ao(t),r=t;FT.test(r)||(r=-1!==$T.remoteBundles.indexOf(n)?$T.remoteServerAddress+"remote/"+n:"assets/"+n);var s=e.version||$T.bundleVers[n],o=0,a=null,h=null;GT(r+"/config."+(s?s+".":"")+"json",e,(function(t,e){h=t||h,(a=e)&&(a.base=r+"/"),2==++o&&i(h,a)})),BT(r+"/index."+(s?s+".":"")+"js",e,(function(t){h=t||h,2==++o&&i(h,a)}))},jT=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=PT,this.downloadDomAudio=null,this.downloadFile=MT,this.downloadScript=BT,this._downloadArrayBuffer=HT,this._downloadJson=GT,this._downloaders={".png":kT,".jpg":kT,".bmp":kT,".jpeg":kT,".gif":kT,".ico":kT,".tiff":kT,".webp":kT,".image":kT,".pvr":HT,".pkm":HT,".astc":HT,".txt":WT,".xml":WT,".vsh":WT,".fsh":WT,".atlas":WT,".tmx":WT,".tsx":WT,".json":GT,".ExportJson":GT,".plist":WT,".ccon":zT,".cconb":VT,".fnt":WT,".binary":HT,".bin":HT,".dbbin":HT,".skel":HT,".js":BT,bundle:XT,default:WT},this._downloading=new $d,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?Ht(this._downloaders,t):this._downloaders[t]=e},t.download=function(t,e,i,n,r){var s=this,o=rf.get(t);if(o)r(null,o);else{var a=this._downloading.get(t);if(a){a.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,d=this._downloaders[i]||this._downloaders.default;ST((function(i,o){if(0===i&&s._downloading.add(t,[r]),s.limited){s._updateTime();var a=function(t,e){s._totalNum--,s._handleQueueInNextFrame(l,_),o(t,e)};s._totalNum<l&&s._totalNumThisPeriod<_?(d(ET(e,s.appendTimeStamp),n,a),s._totalNum++,s._totalNumThisPeriod++):(s._queue.push({id:t,priority:n.priority||0,url:e,options:n,done:a,handler:d}),s._queueDirty=!0,s._totalNum<l&&s._handleQueueInNextFrame(l,_))}else d(ET(e,s.appendTimeStamp),n,o)}),c,this.retryInterval,(function(e,i){e||rf.add(t,i);for(var n=s._downloading.remove(t),r=0,o=n.length;r<o;r++)n[r](e,i)}))}}},t.loadSubpackage=function(t,e){m.assetManager.loadBundle(t,null,e)},t._updateTime=function(){var t=performance.now(),e=m.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(ET(i.url,this.appendTimeStamp),i.options,i.done)}this._handleQueueInNextFrame(t,e)},t._handleQueueInNextFrame=function(t,e){!this._checkNextPeriod&&this._queue.length>0&&(Ue(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}();jT._instance=void 0;var YT,KT,qT,QT,ZT,JT,$T=jT.instance,tE=jT.instance,eE=t("JsonAsset",va("cc.JsonAsset")((KT=function(t){function e(){var e;return(e=t.call(this)||this).json=qT&&qT(),e}return s(e,t),e}(Of),qT=ua(KT.prototype,"json",[wa],(function(){return null})),YT=KT))||YT);m.JsonAsset=eE;var iE,nE,rE=t("TextAsset",va("cc.TextAsset")((ZT=function(t){function e(){var e;return(e=t.call(this)||this).text=JT&&JT(),e}return s(e,t),e.prototype.toString=function(){return this.text},e}(Of),JT=ua(ZT.prototype,"text",[wa],(function(){return""})),QT=ZT))||QT);m.TextAsset=rE;var sE=t("BufferAsset",va("cc.BufferAsset")((f((nE=function(t){function e(){var e;return(e=t.call(this)||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}(Of)).prototype,"_nativeAsset",[hh],Object.getOwnPropertyDescriptor(nE.prototype,"_nativeAsset"),nE.prototype),iE=nE))||iE);function oE(t,e,i,n){var r=null,s=null;try{(r=new $f)._nativeUrl=t,r._nativeAsset=e}catch(t){s=t}n(s,r)}function aE(t,e,i,n){var r=new eE;r.json=e,n(null,r)}function hE(t,e,i,n){var r=new rE;r.text=e,n(null,r)}function uE(t,e,i,n){var r=new sE;r._nativeUrl=t,r._nativeAsset=e,n(null,r)}function cE(t,e,i,n){var r=new Of;r._nativeUrl=t,r._nativeAsset=e,n(null,r)}function lE(t,i,n,r){var s=of.get(i.name);s||(s=i.name===lf.RESOURCES?OT:new DT,i.base=i.base||t+"/",s.init(i)),e.import("virtual:///prerequisite-imports/"+s.name).then((function(){r(null,s)})).catch(r)}m.BufferAsset=sE;var _E=new(function(){function t(){this._creating=new $d,this._producers={".png":oE,".jpg":oE,".bmp":oE,".jpeg":oE,".gif":oE,".ico":oE,".tiff":oE,".webp":oE,".image":oE,".pvr":oE,".pkm":oE,".astc":oE,".txt":hE,".xml":hE,".vsh":hE,".fsh":hE,".atlas":hE,".tmx":hE,".tsx":hE,".fnt":hE,".json":aE,".ExportJson":aE,".binary":uE,".bin":uE,".dbbin":uE,".skel":uE,bundle:lE,default:cE}}var e=t.prototype;return e.register=function(t,e){"object"==typeof t?Ht(this._producers,t):this._producers[t]=e},e.create=function(t,e,i,n,r){var s=this,o=this._producers[i]||this._producers.default,a=nf.get(t);if(n.reloadAsset||!a){var h=this._creating.get(t);h?h.push(r):(this._creating.add(t,[r]),o(t,e,n,(function(e,i){!e&&i instanceof Of&&(i._uuid=t,bT(t,i,n.cacheAsset));for(var r=s._creating.remove(t),o=0,a=r.length;o<a;o++)r[o](e,i)})))}else r(null,a)},t}()),dE=new(function(){function t(){this._loading=new $d,this._unpackers={".json":this.unpackJson}}var e=t.prototype;return e.unpackJson=function(t,e,i,n){var r=Dt(!0),s=null;if(Array.isArray(e)){(e=function(t){if(t[0]<1)throw new Error(et(5304,t[0]));ig(t,!0,void 0,rg.reportMissingClass),ng(t);for(var e=new sg(t[0]),i=t[1],n=t[2],r=t[3],s=t[4],o=t[5],a=0;a<o.length;++a)o[a].unshift(e,i,n,r,s);return o}(e)).length!==t.length&&Z(4915);for(var o=0;o<t.length;o++)r[t[o]+"@import"]=e[o]}else{var a=re(Sg),h=re($f);if(e.type===a&&e.data){var u=e.data;u.length!==t.length&&Z(4915);for(var c=0;c<t.length;c++)r[t[c]+"@import"]=og(a,{base:u[c][0],mipmaps:u[c][1]})}else{if(e.type!==h||!e.data)return void n(s=new Error("unmatched type pack!"),null);var l=e.data;l.length!==t.length&&Z(4915);for(var _=0;_<t.length;_++)r[t[_]+"@import"]=l[_]}}n(s,r)},e.init=function(){this._loading.clear()},e.register=function(t,e){"object"==typeof t?Ht(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(rf.has(t.id))i(null,rf.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{var o=r[0];this._loading.add(o.uuid,[{onComplete:i,id:t.id}]),t.config;var a=bf(o.uuid,{ext:o.ext,bundle:t.config.name});tE.download(o.uuid,a,o.ext,t.options,(function(e,i){rf.remove(o.uuid),e&&k(e.message,e.stack),n.unpack(o.packedUuids,i,o.ext,t.options,(function(t,i){if(!t)for(var r in i)rf.add(r,i[r]);for(var s=n._loading.remove(o.uuid),a=0,h=s.length;a<h;a++){var u=s[a];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 tE.download(t.id,t.url,t.ext,t.options,i)},t}());function fE(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=[],o=r.total,a=n.__exclude__=n.__exclude__||Object.create(null);t.output=[],CT(t.input,(function(n,h){if(!n.isNative&&nf.has(n.uuid)){var u=nf.get(n.uuid);return n.content=u.addRef(),t.output.push(n),r.canInvoke&&t.dispatch("progress",++r.finish,r.total,n),void h()}dE.load(n,t.options,(function(u,c){u?t.isFinished||(!m.assetManager.force||i?(k(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||(a[n.uuid]=!0,AT(n.uuid,c,a,s,n.config),r.total=o+s.length),r.canInvoke&&t.dispatch("progress",++r.finish,r.total,n)),h()}))}),(function(){if(t.isFinished)return TT(t,!0),void t.dispatch("error");if(s.length>0){var o=df.create({input:s,progress:r,options:n,onProgress:t.onProgress,onError:df.prototype.recycle,onComplete:function(n){var r;n||((r=t.output).push.apply(r,o.output),o.recycle()),i&&pE(t),e(n)}});hf.async(o)}else i&&pE(t),e()}))}function pE(t){for(var e=t.output,i=0,n=e.length;i<n;i++)e[i].content&&e[i].content.decRef(!1)}var gE=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 q(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}())),mE=function(){function t(){this._parsing=new $d,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=$f.parseCompressedTextures(t,0)}catch(t){F(n=t)}i(n,r)},e.parsePKMTex=function(t,e,i){var n=null,r=null;try{r=$f.parseCompressedTextures(t,1)}catch(t){F(n=t)}i(n,r)},e.parseASTCTex=function(t,e,i){var n=null,r=null;try{r=$f.parseCompressedTextures(t,2)}catch(t){F(n=t)}i(n,r)},e.parsePlist=function(t,e,i){var n=null,r=gE.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=cg(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?Ht(this._parsers,t):this._parsers[t]=e},e.parse=function(t,e,i,n,r){var s=this,o=sf.get(t);if(o)r(null,o);else{var a=this._parsing.get(t);if(a)a.push(r);else{var h=this._parsers[i];h?(this._parsing.add(t,[r]),h(e,n,(function(e,i){e?rf.remove(t):Sf(i)||sf.add(t,i);for(var n=s._parsing.remove(t),r=0,o=n.length;r<o;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}();mE._instance=void 0;var vE=mE.instance;function yE(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=[],CT(t.input,(function(s,o){var a=df.create({input:s,onProgress:t.onProgress,options:n,progress:r,onComplete:function(n,h){n&&!t.isFinished&&(!m.assetManager.force||i?(k(n.message,n.stack),r.canInvoke=!1,e(n)):r.canInvoke&&t.dispatch("progress",++r.finish,r.total,s)),t.output.push(h),a.recycle(),o(null)}});TE.async(a)}),(function(){if(n.__exclude__=null,t.isFinished)return TT(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),TT(t,!0),e()}))}var TE=new tf("loadOneAsset",[function(t,e){var i=t.output=t.input,n=i.options,r=i.isNative,s=i.uuid,o=i.file,a=n.reloadAsset;o||!a&&!r&&nf.has(s)?e():dE.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,o=i.file,a=i.options;if(i.isNative)vE.parse(s,o,i.ext,a,(function(r,o){r?e(r):(i.content=o,n.canInvoke&&t.dispatch("progress",++n.finish,n.total,i),rf.remove(s),sf.remove(s),e())}));else{var h=i.uuid;if(h in r){var u=r[h],c=u.finish,l=u.content,_=u.err,f=u.callbacks;n.canInvoke&&t.dispatch("progress",++n.finish,n.total,i),c||IT(h,h,r)?(l&&l.addRef(),i.content=l,e(_)):f.push({done:e,item:i})}else if(!a.reloadAsset&&nf.has(h)){var p=nf.get(h);i.content=p.addRef(),n.canInvoke&&t.dispatch("progress",++n.finish,n.total,i),e()}else a.__uuid__=h,vE.parse(s,o,"import",a,(function(i,n){i?e(i):function(t,e,i){var n=t.input,r=t.progress,s=n,o=s.uuid,a=s.id,h=s.options,u=s.config,c=h.cacheAsset,l=[];e.addRef&&e.addRef(),AT(o,e,Object.create(null),l,u),r.canInvoke&&t.dispatch("progress",++r.finish,r.total+=l.length,n);var _=t.options.__exclude__[o]={content:e,finish:!1,callbacks:[{done:i,item:n}]},f=df.create({input:l,options:t.options,onProgress:t.onProgress,onError:df.prototype.recycle,progress:r,onComplete:function(t){if(e.decRef&&e.decRef(!1),_.finish=!0,_.err=t,!t){for(var i,n=Array.isArray(f.output)?f.output:[f.output],r=Object.create(null),s=d(n);!(i=s()).done;){var h=i.value;h&&(r[h instanceof Of?h._uuid+"@import":o+"@native"]=h)}!function(t,e,i){var n=ag.get(e);if(n){for(var r=0,s=n.length;r<s;r++){var o=n[r],a=i[o.uuid+"@import"];if(a)o.owner[o.prop]=a.addRef();else{if(Z(16350,o.uuid),m.assetManager.dispatchAssetMissing(e,o.owner,o.prop,o.uuid),o.type&&o.type!==Of){var h=new o.type;h.initDefault(o.uuid),o.owner[o.prop]=h}!0}}ag.delete(e)}hg.has(e)&&(i[t+"@native"]?e._nativeAsset=i[t+"@native"]:(!0,Z(16351,t)),hg.delete(e))}(o,e,r);try{"function"!=typeof e.onLoaded||ug.has(e)||hg.has(e)||(e.onLoaded(),ug.add(e))}catch(t){Z(16352,o,t.message,t.stack)}rf.remove(a),sf.remove(a),bT(o,e,c),f.recycle()}for(var u=_.callbacks,l=0,p=u.length;l<p;l++){var g=u[l];e.addRef&&e.addRef(),g.item.content=e,g.done(t)}u.length=0}});af.async(f)}(t,n,e)}))}}]);function EE(t,e){var i=t.options,n=Object.create(null),r=Object.create(null);for(var s in i)switch(s){case ef.PATH:case ef.UUID:case ef.DIR:case ef.SCENE:case ef.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 o=df.create({input:t.input,options:n}),a=null;try{t.output=t.source=uf.sync(o)}catch(t){a=t;for(var h=0,u=o.output.length;h<u;h++)o.output[h].recycle()}o.recycle(),e(a)}var SE=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}();SE.MAX_DEAD_NUM=500,SE._deadPool=[];var AE=[];function bE(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=SE.create(),o=null,a=null;if("string"==typeof n&&((n=Object.create(null))[e.__requestType__||ef.UUID]=i[r]),"object"==typeof n){Gt(n,e),n.preset&&Gt(n,_f[n.preset]);var h=function(){var t;switch(u){case ef.UUID:var e,r=s.uuid=vf(n.uuid);if(!n.bundle){var h=of.find((function(t){return!!t.getAssetInfo(r)}));n.bundle=h&&h.name}if(of.has(n.bundle)){if(o=of.get(n.bundle).config,(a=o.getAssetInfo(r))&&a.redirect){if(!of.has(a.redirect))throw new Error("Please load bundle "+a.redirect+" first");o=of.get(a.redirect).config,a=o.getAssetInfo(r)}s.config=o,s.info=a}s.ext=n.ext||(null===(e=a)||void 0===e?void 0:e.extension)||".json";break;case"__requestType__":case"ext":case"bundle":case"preset":case"type":break;case ef.DIR:if(of.has(n.bundle)){of.get(n.bundle).config.getDirWithPath(n.dir,n.type,AE);for(var c,l=d(AE);!(c=l()).done;){var _=c.value;i.push({uuid:_.uuid,__isNative__:!1,ext:_.extension||".json",bundle:n.bundle})}AE.length=0}s.recycle(),s=null;break;case ef.PATH:if(of.has(n.bundle)){if(o=of.get(n.bundle).config,(a=o.getInfoWithPath(n.path,n.type))&&a.redirect){if(!of.has(a.redirect))throw new Error("you need to load bundle "+a.redirect+" first");o=of.get(a.redirect).config,a=o.getAssetInfo(a.uuid)}if(!a)throw s.recycle(),new Error("Bundle "+n.bundle+" doesn't contain "+n.path);s.config=o,s.uuid=a.uuid,s.info=a}s.ext=n.ext||(null===(t=a)||void 0===t?void 0:t.extension)||".json";break;case ef.SCENE:if(!n.bundle){var f=of.find((function(t){return!!t.getSceneInfo(n.scene)}));n.bundle=f&&f.name}if(of.has(n.bundle)){if(o=of.get(n.bundle).config,(a=o.getSceneInfo(n.scene))&&a.redirect){if(!of.has(a.redirect))throw new Error("you need to load bundle "+a.redirect+" first");o=of.get(a.redirect).config,a=o.getAssetInfo(a.uuid)}if(!a)throw s.recycle(),new Error("Bundle "+o.name+" doesn't contain scene "+n.scene);s.config=o,s.uuid=a.uuid,s.info=a}break;case"__isNative__":s.isNative=n.__isNative__;break;case ef.URL:s.url=n.url,s.uuid=n.uuid||n.url,s.ext=n.ext||Eo(n.url),s.isNative=void 0===n.__isNative__||n.__isNative__;break;default:s.options[u]=n[u]}if(!s)return 1};for(var u in n)if(h())break}if(!s)return 1;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 CE(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=of.find((function(t){return!!t.getAssetInfo(i)}));if(r){var s;t.overrideUuid=i;var o=r.config,a=o.getAssetInfo(i);if(a&&a.redirect){if(!of.has(a.redirect))throw new Error("Please load bundle "+a.redirect+" first");a=(o=of.get(a.redirect).config).getAssetInfo(i)}t.config=o,t.info=a,t.ext=t.isNative?t.ext:(null===(s=a)||void 0===s?void 0:s.extension)||".json"}else q(16201,i,t.uuid)}},n=0;n<e.length;n++)i()}function RE(t){for(var e=t.output=t.input,i=0;i<e.length;i++){var n=e[i];if(!n.url){var r,s,o=n.config;s=n.isNative?o&&o.nativeBase?o.base+o.nativeBase:m.assetManager.generalNativeBase:o&&o.importBase?o.base+o.importBase:m.assetManager.generalImportBase;var a=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+"/"+a.slice(0,2)+"/"+a+h+"/"+n.options.__nativeName__:s+"/"+a.slice(0,2)+"/"+a+h+n.ext,n.url=r}}return null}var wE="asset-missing",IE=t("AssetManager",function(){function t(){this.pipeline=af.append(EE).append(yE),this.fetchPipeline=hf.append(EE).append(fE),this.transformPipeline=uf.append(bE).append(CE).append(RE),this.bundles=of,this.assets=nf,this.assetsOverrideMap=cf,this.generalImportBase="",this.generalNativeBase="",this.dependUtil=dg,this.force=!1,this.allowImageBitmap=!1,this.utils=If,this.downloader=tE,this.parser=vE,this.packManager=dE,this.cacheAsset=!0,this.cacheManager=null,this.presets=_f,this.factory=_E,this.preprocessPipe=EE,this.fetchPipe=fE,this.loadPipe=yE,this.references=null,this._releaseManager=vT,this._files=rf,this._parsed=sf,this._parsePipeline=null,this._projectBundles=[],this._eventTarget=new oo}var e=t.prototype;return e.onAssetMissing=function(t,e){this._eventTarget.on(wE,t,e)},e.offAssetMissing=function(t,e){this._eventTarget.off(wE,t,e)},e.dispatchAssetMissing=function(t,e,i,n){this._eventTarget.emit(wE,t,e,i,n)},e.init=function(t){void 0===t&&(t={});var e=t.server||we.querySettings(Ce.Category.ASSETS,"server")||"",i=t.bundleVers||we.querySettings(Ce.Category.ASSETS,"bundleVers")||{},n=t.remoteBundles||we.querySettings(Ce.Category.ASSETS,"remoteBundles")||[],r=t.downloadMaxConcurrency||we.querySettings(Ce.Category.ASSETS,"downloadMaxConcurrency");r&&r>0&&(this.downloader.maxConcurrency=r),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 s=t.importBase||we.querySettings(Ce.Category.ASSETS,"importBase")||"";s&&s.endsWith("/")&&(s=s.substr(0,s.length-1));var o=t.nativeBase||we.querySettings(Ce.Category.ASSETS,"nativeBase")||"";o&&o.endsWith("/")&&(o=o.substr(0,o.length-1)),this.generalImportBase=s,this.generalNativeBase=o,this._projectBundles=we.querySettings(Ce.Category.ASSETS,"projectBundles")||[];var a=we.querySettings(Ce.Category.ASSETS,"assetsOverrides")||{};for(var h in a)this.assetsOverrideMap.set(h,a[h])},e.getBundle=function(t){return of.get(t)||null},e.removeBundle=function(t){t._destroy(),of.remove(t.name)},e.loadAny=function(t,e,i,n){var r=RT(e,i,n),s=r.options,o=r.onProgress,a=r.onComplete;s.preset=s.preset||"default",t=Array.isArray(t)?t.slice():t;var h=df.create({input:t,onProgress:o,onComplete:xT(a),options:s});af.async(h)},e.preloadAny=function(t,e,i,n){var r=RT(e,i,n),s=r.options,o=r.onProgress,a=r.onComplete;s.preset=s.preset||"preload",t=Array.isArray(t)?t.slice():t;var h=df.create({input:t,onProgress:o,onComplete:xT(a),options:s});hf.async(h)},e.loadRemote=function(t,e,i){var n=RT(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?(k(e.message,e.stack),s&&s(e,i)):_E.create(t,i,r.ext||Eo(t),r,(function(t,e){s&&s(t,e)}))}))):xT(s)(null,this.assets.get(t))},e.loadBundle=function(t,e,i){var n=RT(e,void 0,i),r=n.options,s=n.onComplete,o=Ao(t);this.bundles.has(o)?xT(s)(null,this.getBundle(o)):(r.preset=r.preset||"bundle",r.ext="bundle",r.__isNative__=!0,this.loadAny({url:t},r,null,(function(e,i){e?(k(e.message,e.stack),s&&s(e,i)):_E.create(t,i,"bundle",r,(function(t,e){s&&s(t,e)}))})))},e.releaseAsset=function(t){vT.tryRelease(t,!0)},e.releaseUnusedAssets=function(){nf.forEach((function(t){vT.tryRelease(t)}))},e.releaseAll=function(){nf.forEach((function(t){vT.tryRelease(t,!0)}))},e.loadWithJson=function(){throw new Error("Only valid in Editor")},n(t,[{key:"main",get:function(){return of.get(lf.MAIN)||null}},{key:"resources",get:function(){return of.get(lf.RESOURCES)||null}}],[{key:"instance",get:function(){return this._instance||(this._instance=new t),this._instance}}]),t}());IE._instance=void 0,IE.Pipeline=tf,IE.Task=df,IE.Cache=$d,IE.RequestItem=SE,IE.Bundle=DT,IE.BuiltinBundleName=lf,IE.CacheManager=function(){this.cacheDir=void 0,this.cacheEnabled=void 0,this.autoClear=void 0,this.cacheInterval=void 0,this.deleteInterval=void 0,this.cachedFiles=void 0},IE.Downloader=jT,IE.Parser=mE,IE.DependUtil=lg;var xE=t("assetManager",m.assetManager=IE.instance);m.AssetManager=IE;var DE,OE,PE,ME=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),o=0,a=0;a<4;a++)e[o]=0,e[o+1]=0,e[o+2]=0,e[o+3]=255,i[o]=0,i[o+1]=0,i[o+2]=0,i[o+3]=0,n[o]=119,n[o+1]=119,n[o+2]=119,n[o+3]=255,r[o]=255,r[o+1]=255,r[o+2]=255,r[o+3]=255,s[o]=127,s[o+1]=127,s[o+2]=255,s[o+3]=255,o+=4;var h=new Uint8Array(1024);o=0;for(var u=0;u<256;u++)h[o]=221,h[o+1]=221,h[o+2]=221,h[o+3]=255,o+=4;o=0;for(var c=0;c<8;c++){for(var l=0;l<8;l++)h[o]=85,h[o+1]=85,h[o+2]=85,h[o+3]=255,o+=4;o+=32}o+=32;for(var _=0;_<8;_++){for(var d=0;d<8;d++)h[o]=85,h[o+1]=85,h[o+2]=85,h[o+3]=255,o+=4;o+=32}var f={width:2,height:2,_data:e,_compressed:!1,format:Sg.PixelFormat.RGBA8888},p={width:2,height:2,_data:i,_compressed:!1,format:Sg.PixelFormat.RGBA8888},g={width:2,height:2,_data:n,_compressed:!1,format:Sg.PixelFormat.RGBA8888},v={width:2,height:2,_data:r,_compressed:!1,format:Sg.PixelFormat.RGBA8888},y={width:2,height:2,_data:s,_compressed:!1,format:Sg.PixelFormat.RGBA8888},T={width:16,height:16,_data:h,_compressed:!1,format:Sg.PixelFormat.RGBA8888},E=new $f(f),S=new Sg;S._uuid="black-texture",S.image=E,t[S._uuid]=S;var A=new $f(p),b=new Sg;b._uuid="empty-texture",b.image=A,t[b._uuid]=b;var C=new Em;C._uuid="black-cube-texture",C.setMipFilter(Em.Filter.NEAREST),C.image={front:new $f(f),back:new $f(f),left:new $f(f),right:new $f(f),top:new $f(f),bottom:new $f(f)},t[C._uuid]=C;var R=new $f(g),w=new Sg;w._uuid="grey-texture",w.image=R,t[w._uuid]=w;var I=new Em;I._uuid="grey-cube-texture",I.setMipFilter(Em.Filter.NEAREST),I.image={front:new $f(g),back:new $f(g),left:new $f(g),right:new $f(g),top:new $f(g),bottom:new $f(g)},t[I._uuid]=I;var x=new $f(v),D=new Sg;D._uuid="white-texture",D.image=x,t[D._uuid]=D;var O=new Em;O._uuid="white-cube-texture",O.setMipFilter(Em.Filter.NEAREST),O.image={front:new $f(v),back:new $f(v),left:new $f(v),right:new $f(v),top:new $f(v),bottom:new $f(v)},t[O._uuid]=O;var P=new $f(y),M=new Sg;M._uuid="normal-texture",M.image=P,t[M._uuid]=M;var N=new $f(T),L=new Sg;L._uuid="default-texture",L.image=N,t[L._uuid]=L;var B=new Em;if(B.setMipFilter(Em.Filter.NEAREST),B._uuid="default-cube-texture",B.image={front:new $f(T),back:new $f(T),left:new $f(T),right:new $f(T),top:new $f(T),bottom:new $f(T)},t[B._uuid]=B,m.SpriteFrame){var F=new m.SpriteFrame,k=E,U=new Sg;U.image=k,F.texture=U,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=we.querySettings(Ce.Category.ENGINE,"builtinAssets");if(!e)return Promise.resolve();var i=this._resources;return new Promise((function(n,r){xE.loadBundle(lf.INTERNAL,(function(s){s?r(s):xE.loadAny(e,(function(e,s){e?r(e):(s.forEach((function(e){i[e.name]=e,vT.addIgnoredAsset(e),e instanceof m.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}()),NE=t("builtinResMgr",m.builtinResMgr=new ME),LE=t("getPhaseID",(DE=new Map,OE=0,function(t){return"number"==typeof t?t:(DE.has(t)||(DE.set(t,1<<OE),OE++),DE.get(t))})),BE=t("InstancedBuffer",function(){function t(t){this.instances=[],this.hasPendingModels=!1,this.dynamicOffsets=[],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,o=t.descriptorSet.getTexture(Vv),a=t.descriptorSet.getTexture(ey),h=t.descriptorSet.getTexture(ry),u=t.descriptorSet.getTexture(cy),c=t.useReflectionProbeType,l=i;l||(l=t.shaders[e]);for(var _=t.descriptorSet,d=0;d<this.instances.length;++d){var f,p,g=this.instances[d];if(!((null===(f=g.ia.indexBuffer)||void 0===f?void 0:f.objectID)!==(null===(p=s.indexBuffer)||void 0===p?void 0:p.objectID)||g.count>=1024)&&g.lightingMap.objectID===o.objectID&&g.useReflectionProbeType===c&&g.reflectionProbeCubemap.objectID===a.objectID&&g.reflectionProbePlanarMap.objectID===h.objectID&&g.reflectionProbeBlendCubemap.objectID===u.objectID&&g.stride===r){if(g.count>=g.capacity){g.capacity<<=1;var m=g.stride*g.capacity,v=g.data;g.data=new Uint8Array(m),g.data.set(v),g.vb.resize(m)}return g.shader=l,g.descriptorSet=_,g.data.set(n.buffer,g.stride*g.count++),void(this.hasPendingModels=!0)}}for(var y=this._device.createBuffer(new v_(vl.VERTEX|vl.TRANSFER_DST,El.HOST|El.DEVICE,32*r,r)),T=new Uint8Array(32*r),E=s.vertexBuffers.slice(),S=s.attributes.slice(),A=s.indexBuffer,b=0;b<n.attributes.length;b++){var C=n.attributes[b],R=new L_(C.name,C.format,C.isNormalized,E.length,!0);S.push(R)}T.set(n.buffer),E.push(y);var w=new F_(S,E,A),I=this._device.createInputAssembler(w);this.instances.push({count:1,capacity:32,vb:y,data:T,ia:I,stride:r,shader:l,descriptorSet:_,lightingMap:o,reflectionProbeCubemap:a,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}()),FE=new v_(vl.UNIFORM|vl.TRANSFER_DST,El.DEVICE),kE=new y_(null),UE=new q_(null);!function(t){t[t.NONE=0]="NONE",t[t.INSTANCING=1]="INSTANCING"}(PE||(PE={}));var GE=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 Pd,this._dss=new Dd,this._rs=new xd,this._priority=km.DEFAULT,this._stage=Fm.DEFAULT,this._phase=LE("default"),this._passID=4294967295,this._subpassID=4294967295,this._phaseID=4294967295,this._primitive=Hl.TRIANGLE_LIST,this._batchingScheme=PE.NONE,this._dynamicStates=Xl.NONE,this._instancedBuffers={},this._hash=0,this._rootBufferDirty=!1,this._root=t,this._device=Qd.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=LE(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(m.rendering&&m.rendering.enableEffectImport){var i=m.rendering.programLib.getKey(t._phaseID,t.program,t.defines);e=t._phaseID.toString()+","+i}else e=uT.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=d(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),nl(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=ml.UNKNOWN);var n=this._propertyHandleMap[t];return n?(i?n=Py(n,i):e&&(n=Py(n,Iy(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),o=this._getBlockView(r,n);Ny[r](o,i,s),this._rootBufferDirty=!0},e.getUniform=function(e,i){var n=t.getBindingFromHandle(e),r=t.getTypeFromHandle(e),s=t.getOffsetFromHandle(e),o=this._getBlockView(r,n);return My[r](o,i,s)},e.setUniformArray=function(e,i){for(var n=t.getBindingFromHandle(e),r=t.getTypeFromHandle(e),s=fd(r)>>2,o=this._getBlockView(r,n),a=t.getOffsetFromHandle(e),h=0;h<i.length;h++,a+=s)null!==i[h]&&Ny[r](o,i[h],a);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(){q(12102)},e.update=function(){this._descriptorSet?(this._rootBuffer&&this._rootBufferDirty&&(this._rootBuffer.update(this._rootBlock),this._rootBufferDirty=!1),this._descriptorSet.update()):Z(12006)},e.getInstancedBuffer=function(t){return void 0===t&&(t=0),this._instancedBuffers[t]||(this._instancedBuffers[t]=new BE(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),o=t.getCountFromHandle(i),a=this._getBlockView(n,r),h=this._properties[e],u=h&&h.value||Fy(n),c=(fd(n)>>2)*o,l=0;l+u.length<=c;l+=u.length)a.set(u,s+l);this._rootBufferDirty=!0}},e.resetTexture=function(e,i){var n=this.getHandle(e);if(n){var r,s=t.getTypeFromHandle(n),o=t.getBindingFromHandle(n),a=this._properties[e],h=a&&a.value,u=(r="string"==typeof h?NE.get(""+h+ky(s)):h||NE.get(Fy(s)))&&r.getGFXTexture(),c=a&&void 0!==a.samplerHash?Fd.unpackFromHash(a.samplerHash):r&&r.getSamplerInfo(),l=this._device.getSampler(c);this._descriptorSet.bindSampler(o,l,i||0),this._descriptorSet.bindTexture(o,u,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),o=this._properties[r.name],a=o&&o.value||Fy(r.type),h=(fd(r.type)>>2)*r.count,u=0;u+a.length<=h;u+=a.length)s.set(a,i+u);i+=h}this._rootBufferDirty=!0},e.resetTextures=function(){if(m.rendering)for(var t,e=d(this._shaderInfo.descriptors[jm.MATERIAL].samplerTextures);!(t=e()).done;)for(var i=t.value,n=0;n<i.count;++n)this.resetTexture(i.name,n);else for(var r=0;r<this._shaderInfo.samplerTextures.length;r++)for(var s=this._shaderInfo.samplerTextures[r],o=0;o<s.count;o++)this.resetTexture(s.name,o)},e.tryCompile=function(){var e=this._root.pipeline;if(!e)return!1;if(this._syncBatchingScheme(),m.rendering&&m.rendering.enableEffectImport){var i=m.rendering.programLib,n=i.getProgramVariant(this._device,this._phaseID,this._programName,this._defines);if(!n)return q(12103,this._programName),!1;this._shader=n.shader,this._pipelineLayout=i.getPipelineLayout(this.device,this._phaseID,this._programName)}else{var r=uT.getGFXShader(this._device,this._programName,this._defines,e);if(!r)return q(12104,this._programName),!1;this._shader=r,this._pipelineLayout=uT.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 q(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}this._isBlend&&(this._defines.CC_IS_TRANSPARENCY_PASS=1);var r=null;if(m.rendering&&m.rendering.enableEffectImport){var s=m.rendering.programLib.getProgramVariant(this._device,this._phaseID,this._programName,this._defines);s&&(r=s.shader)}else r=uT.getGFXShader(this._device,this._programName,this._defines,e);for(var o=0;o<t.length;o++){var a=t[o];delete this._defines[a.name]}return r},e.beginChangeStatesSilently=function(){},e.endChangeStatesSilently=function(){},e._doInit=function(e,i){if(void 0===i&&(i=!1),this._priority=km.DEFAULT,this._stage=Fm.DEFAULT,m.rendering&&m.rendering.enableEffectImport){var n=m.rendering;if("number"==typeof e.phase?(this._passID=e._passID,this._subpassID=e._subpassID,this._phaseID=e._phaseID):(this._passID=n.getPassID(e.pass),this._passID!==n.INVALID_ID&&(e.subpass?(this._subpassID=n.getSubpassID(this._passID,e.subpass),this._phaseID=n.getPhaseID(this._subpassID,e.phase)):this._phaseID=n.getPhaseID(this._passID,e.phase))),this._passID===n.INVALID_ID)return void Z(12107,e.program);if(this._phaseID===n.INVALID_ID)return void Z(12108,e.program)}this._phase=LE("default"),this._primitive=Hl.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,m.rendering&&m.rendering.enableEffectImport?this._shaderInfo=m.rendering.programLib.getProgramInfo(this._phaseID,this._programName):this._shaderInfo=uT.getTemplate(e.program),this._properties=e.properties||this._properties;var s=this._device;t.fillPipelineInfo(this,e),e.stateOverrides&&t.fillPipelineInfo(this,e.stateOverrides),m.rendering&&m.rendering.enableEffectImport?UE.layout=m.rendering.programLib.getMaterialDescriptorSetLayout(this._device,this._phaseID,e.program):UE.layout=uT.getDescriptorSetLayout(this._device,e.program),this._descriptorSet=this._device.createDescriptorSet(UE);var o,a,h=this._shaderInfo.blocks;if(m.rendering&&m.rendering.enableEffectImport){var u=m.rendering.programLib;o=u.getBlockSizes(this._phaseID,this._programName),a=u.getHandleMap(this._phaseID,this._programName)}else{var c=uT.getTemplateInfo(e.program);o=c.blockSizes,a=c.handleMap}if(m.rendering&&m.rendering.enableEffectImport){var l=m.rendering.programLib.getShaderInfo(this._phaseID,this.program);this._buildMaterialUniformBlocks(s,l.blocks,o)}else this._buildUniformBlocks(s,h,o);var _=this._propertyHandleMap=a,d={};for(var f in this._properties){var p=this._properties[f];p.handleInfo&&(d[f]=this.getHandle.apply(this,p.handleInfo))}Object.assign(_,d)},e._buildUniformBlocks=function(t,e,i){for(var n=t.capabilities.uboOffsetAlignment,r=[],s=0,o=0,a=0;a<e.length;a++){var h=i[a];r.push(o),o+=Math.ceil(h/n)*n,s=h}var u=r[r.length-1]+s;u&&(FE.size=16*Math.ceil(u/16),this._rootBuffer=t.createBuffer(FE),this._rootBlock=new ArrayBuffer(u));for(var c=0,l=0;c<e.length;c++){var _=e[c].binding,d=i[c];kE.buffer=this._rootBuffer,kE.offset=r[l++],kE.range=16*Math.ceil(d/16);var f=this._buffers[_]=t.createBuffer(kE);this._blocks[_]=new Float32Array(this._rootBlock,kE.offset,d/Float32Array.BYTES_PER_ELEMENT),this._blocksInt[_]=new Int32Array(this._blocks[_].buffer,this._blocks[_].byteOffset,this._blocks[_].length),this._descriptorSet.bindBuffer(_,f)}},e._buildMaterialUniformBlocks=function(t,e,i){for(var n=t.capabilities.uboOffsetAlignment,r=[],s=0,o=0,a=0;a<e.length;a++)if(1===e[a].set){var h=i[a];r.push(o),o+=Math.ceil(h/n)*n,s=h}if(0!==s){var u=r[r.length-1]+s;u&&(FE.size=16*Math.ceil(u/16),this._rootBuffer=t.createBuffer(FE),this._rootBlock=new ArrayBuffer(u))}for(var c=0,l=0;c<e.length;c++)if(1===e[c].set){var _=e[c].binding,d=i[c];kE.buffer=this._rootBuffer,kE.offset=r[l++],kE.range=16*Math.ceil(d/16);var f=this._buffers[_]=t.createBuffer(kE);this._blocks[_]=new Float32Array(this._rootBlock,kE.offset,d/Float32Array.BYTES_PER_ELEMENT),this._blocksInt[_]=new Int32Array(this._blocks[_].buffer,this._blocks[_].byteOffset,this._blocks[_].length),this._descriptorSet.bindBuffer(_,f)}},e._syncBatchingScheme=function(){this._defines.USE_INSTANCING?this._device.hasFeature(fl.INSTANCED_ARRAYS)?this._batchingScheme=PE.INSTANCING:(this._defines.USE_INSTANCING=!1,this._batchingScheme=PE.NONE):this._batchingScheme=PE.NONE},e._getBlockView=function(t,e){return t<ml.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,m.rendering&&m.rendering.enableEffectImport?this._pipelineLayout=m.rendering.programLib.getPipelineLayout(this.device,this._phaseID,this._programName):this._pipelineLayout=uT.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:"_isBlend",get:function(){for(var t,e=!1,i=d(this.blendState.targets);!(t=i()).done;)t.value.blend&&(e=!0);return e}},{key:"root",get:function(){return this._root}},{key:"device",get:function(){return this._device}},{key:"shaderInfo",get:function(){return this._shaderInfo}},{key:"localSetLayout",get:function(){return m.rendering&&m.rendering.enableEffectImport?m.rendering.programLib.getLocalDescriptorSetLayout(this._device,this._phaseID,this._programName):uT.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}();GE.getTypeFromHandle=Iy,GE.getBindingFromHandle=xy,GE.getCountFromHandle=Dy,GE.getOffsetFromHandle=Oy;var HE,zE,VE,WE,XE,jE,YE,KE,qE,QE=t("PipelineStateManager",function(){function t(){}return t.getOrCreatePipelineState=function(t,e,i,n,r){var s=e.hash^n.hash^r.attributesHash^i.typedID,o=this._PSOHashMap.get(s);if(!o){var a=e.pipelineLayout,h=new Z_(r.attributes),u=new Md(i,a,n,h,e.rasterizerState,e.depthStencilState,e.blendState,e.primitive,e.dynamicStates);o=t.createPipelineState(u),this._PSOHashMap.set(s,o)}return o},t}());function ZE(t,e){t.x=e.x*e.x,t.y=e.y*e.y,t.z=e.z*e.z}QE._PSOHashMap=new Map,new d_,new o_;var JE=new on,$E=t("Material",(HE=va("cc.Material"),zE=Za(lT),HE((WE=function(t){function e(){var e;return(e=t.call(this)||this)._effectAsset=XE&&XE(),e._techIdx=jE&&jE(),e._defines=YE&&YE(),e._states=KE&&KE(),e._props=qE&&qE(),e._passes=[],e._hash=0,e}s(e,t),e.getHash=function(t){for(var e,i=0,n=d(t.passes);!(e=n()).done;)i^=e.value.hash;return i};var i=e.prototype;return i.initialize=function(t){this._passes.length?q(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(){q(16370,this.name)},i.overridePipelineStates=function(){q(16371,this.name)},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=d(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,o=0;o<s;o++){var a=r[o];this._uploadProperty(a,t,e)&&(this._props[a.propertyIndex][t]=e,n=!0)}else{i>=this._passes.length&&q(16372,i);var h=this._passes[i];this._uploadProperty(h,t,e)&&(this._props[h.propertyIndex][t]=e,n=!0)}n||q(16373,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 q(16372,e),null;var o=this._props[this._passes[e].propertyIndex];if(t in o)return o[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=lT.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,o=r.defines=this._defines[s]||(this._defines[s]={});if(r.stateOverrides=this._states[s]||(this._states[s]={}),void 0!==r.propertyIndex&&Object.assign(o,this._defines[r.propertyIndex]),void 0!==r.embeddedMacros&&Object.assign(o,r.embeddedMacros),!r.switch||o[r.switch]){var a=new GE(m.director.root);a.initialize(r),i.push(a)}}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(GE.getTypeFromHandle(n)<ml.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;ZE(JE,s),JE.w=s.w,i=JE}t.setUniform(n,i)}else t.resetUniform(e);else if(Array.isArray(i))for(var o=0;o<i.length;o++)this._bindTexture(t,n,i[o],o);else i?this._bindTexture(t,n,i):t.resetTexture(e);return!0},i._bindTexture=function(t,e,i,n){var r=GE.getBindingFromHandle(e);if(i instanceof Ud)t.bindTexture(r,i,n);else if(i instanceof rp){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=d(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 yn("#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}(Of),XE=ua(WE.prototype,"_effectAsset",[zE],(function(){return null})),jE=ua(WE.prototype,"_techIdx",[wa],(function(){return 0})),YE=ua(WE.prototype,"_defines",[wa],(function(){return[]})),KE=ua(WE.prototype,"_states",[wa],(function(){return[]})),qE=ua(WE.prototype,"_props",[wa],(function(){return[]})),VE=WE))||VE));m.Material=$E;var tS=ye({Low_256x256:256,Medium_512x512:512,High_1024x1024:1024,Ultra_2048x2048:2048}),eS=ye({Planar:0,ShadowMap:1}),iS=ye({HARD:0,SOFT:1,SOFT_2X:2,SOFT_4X:3}),nS=ye({LEVEL_1:1,LEVEL_2:2,LEVEL_3:3,LEVEL_4:4}),rS=ye({NONE:1,RemoveDuplicates:2,DisableRotationFix:3}),sS=eS.ShadowMap+1,oS=function(){function t(){this.fixedSphere=new Ar(0,0,0,.01),this.maxReceived=4,this._matLight=new Ln,this._material=null,this._instancingMaterial=null,this._enabled=!1,this._type=sS,this._distance=0,this._planeBias=1,this._normal=new _n(0,1,0),this._shadowColor=new yn(0,0,0,76),this._size=new Hn(1024,1024),this._shadowMapDirty=!1}var e=t.prototype;return e.getPlanarShader=function(t){this._material||(this._material=new $E,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:sS,this.normal=t.planeDirection,this.distance=t.planeHeight,this.planeBias=t.planeBias,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===eS.Planar)this._updatePlanarInfo();else{var t=m.director.root;t.pipeline.macros.CC_SHADOW_TYPE=2,t.onGlobalPipelineStateChanged()}else{var e=m.director.root;e.pipeline.macros.CC_SHADOW_TYPE=0,e.onGlobalPipelineStateChanged()}},e._updatePlanarInfo=function(){this._material||(this._material=new $E,this._material.initialize({effectName:"pipeline/planar-shadow"}));var t=m.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:sS,this.activate()}},{key:"normal",get:function(){return this._normal},set:function(t){_n.copy(this._normal,t)}},{key:"distance",get:function(){return this._distance},set:function(t){this._distance=t}},{key:"planeBias",get:function(){return this._planeBias},set:function(t){this._planeBias=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}();oS.MAX_FAR=2e3,oS.COEFFICIENT_OF_EXPANSION=2*Math.sqrt(3),m.Shadows=oS;var aS=function(t){function e(e,i){var n;(n=t.call(this,e.root)||this)._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],o=n._blocks[s.binding],a=n._parent.blocks[s.binding];o.set(a)}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 d=h._descriptorSet.getSampler(c.binding,_),f=h._descriptorSet.getTexture(c.binding,_);n._descriptorSet.bindSampler(c.binding,d,_),n._descriptorSet.bindTexture(c.binding,f,_)}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(),GE.fillPipelineInfo(this,t),GE.fillPipelineInfo(this,e),this._onStateChange()},i.tryCompile=function(e){if(e&&!Uy(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=PE.NONE},i._onStateChange=function(){this._hash=GE.getPassHash(this),this._owner.onPassStateChange(this._dontNotify)},n(e,[{key:"parent",get:function(){return this._parent}}]),e}(GE),hS=function(t){function e(e){var i;return(i=t.call(this)||this)._passes=[],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=d(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 o in t)s[o]=t[o];r.overridePipelineStates(i[r.passIndex],s)}else{var a=this._states[e]||(this._states[e]={});for(var h in t)a[h]=t[h];this._passes[e].overridePipelineStates(i[e],a)}}},i.destroy=function(){return this._doDestroy(),!0},i.onPassStateChange=function(t){this._hash=$E.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 aS(e[i],this));return t},n(e,[{key:"parent",get:function(){return this._parent}},{key:"owner",get:function(){return this._owner}}]),e}($E),uS=null,cS=null,lS=ye({HEMISPHERE_DIFFUSE:0,AUTOGEN_HEMISPHERE_DIFFUSE_WITH_REFLECTION:1,DIFFUSEMAP_WITH_REFLECTION:2}),_S=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 hS({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=m.director.root.pipeline;this._globalDSManager=t.globalDSManager,this._default=NE.get("default-cube-texture"),this._model||(this._model=m.director.root.createModel(m.renderer.scene.Model));var e=this._default.isRGBE;if(this._default.isUsingOfflineMipmaps(),this.envmap&&(e=this.envmap.isRGBE,this.envmap.isUsingOfflineMipmaps()),!cS){var i=new $E;i.initialize({effectName:"pipeline/skybox",defines:{USE_RGBE_CUBEMAP:e}}),cS=new hS({parent:i})}this.enabled&&(uS||(uS=m.utils.createMesh(m.primitives.box({width:2,height:2,length:2}))),this._editableMaterial?this._model.initSubModel(0,uS.renderingSubMeshes[0],this._editableMaterial):this._model.initSubModel(0,uS.renderingSubMeshes[0],cS)),this.envmap||(this.envmap=this._default),this.diffuseMap||(this.diffuseMap=this._default),this._updateGlobalBinding(),this._updatePipeline(),this._activated=!0},e._updatePipeline=function(){var t=m.director.root,e=t.pipeline,i=this.useIBL?this.isRGBE?2:1:0,n=this.useIBL&&this.useDiffuseMap&&this.diffuseMap&&this.diffuseMap!==this._default?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 o=this.envmap?this.envmap:this._default,a=this._editableMaterial?this._editableMaterial:cS;a&&(a.setProperty("environmentMap",o),a.recompileShaders({USE_RGBE_CUBEMAP:this.isRGBE})),this._model&&(this._model.setSubModelMaterial(0,a),this._updateSubModes())}},e._updateGlobalBinding=function(){if(this._globalDSManager){var t=Qd.gfxDevice;if(this.reflectionMap){var e=this.reflectionMap.getGFXTexture(),i=t.getSampler(this.reflectionMap.getSamplerInfo());this._globalDSManager.bindSampler(rv,i),this._globalDSManager.bindTexture(rv,e)}else{var n=this.envmap?this.envmap:this._default;if(n){var r=n.getGFXTexture(),s=t.getSampler(n.getSamplerInfo());this._globalDSManager.bindSampler(rv,s),this._globalDSManager.bindTexture(rv,r)}}var o=this.diffuseMap?this.diffuseMap:this._default;if(o){var a=o.getGFXTexture(),h=t.getSampler(o.getSamplerInfo());this._globalDSManager.bindSampler(av,h),this._globalDSManager.bindTexture(av,a)}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 m.director.root.pipeline.pipelineSceneData.isHDR?this._envmapHDR:this._envmapLDR},set:function(t){m.director.root.pipeline.pipelineSceneData.isHDR?this.setEnvMaps(t,this._envmapLDR):this.setEnvMaps(this._envmapHDR,t)}},{key:"diffuseMap",get:function(){return m.director.root.pipeline.pipelineSceneData.isHDR?this._diffuseMapHDR:this._diffuseMapLDR},set:function(t){m.director.root.pipeline.pipelineSceneData.isHDR?this.setDiffuseMaps(t,this._diffuseMapLDR):this.setDiffuseMaps(this._diffuseMapHDR,t)}},{key:"reflectionMap",get:function(){return m.director.root.pipeline.pipelineSceneData.isHDR?this._reflectionHDR:this._reflectionLDR}},{key:"editableMaterial",get:function(){return this._editableMaterial}}]),t}();m.Skybox=_S;var dS=new on,fS=ye({LINEAR:0,EXP:1,EXP_SQUARED:2,LAYERED:3}),pS=fS.LAYERED+1,gS=function(){function t(){this._fogColor=new yn("#C8C8C8"),this._colorArray=new on(.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:pS,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=m.director.root,e=this.enabled?this.type:pS,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=pS,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),dS.set(t.x,t.y,t.z,t.w),ZE(this._colorArray,dS)}},{key:"type",get:function(){return this._type},set:function(t){this._type=this.enabled?t:pS,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}();m.Fog=gS;var mS,vS,yS,TS,ES,SS,AS,bS,CS,RS,wS,IS,xS,DS,OS,PS,MS,NS,LS,BS,FS,kS,US,GS,HS,zS,VS,WS,XS,jS,YS,KS,qS,QS,ZS,JS,$S,tA,eA,iA,nA,rA,sA,oA,aA,hA,uA,cA,lA,_A,dA,fA,pA,gA,mA,vA,yA,TA,EA,SA,AA,bA,CA,RA,wA,IA,xA,DA,OA,PA,MA,NA,LA,BA,FA,kA,UA,GA,HA,zA,VA,WA,XA,jA,YA,KA,qA,QA,ZA,JA,$A,tb,eb,ib,nb,rb,sb,ob,ab,hb,ub,cb,lb,_b,db,fb,pb,gb,mb,vb,yb,Tb,Eb,Sb,Ab,bb,Cb,Rb,wb,Ib,xb,Db,Ob,Pb,Mb,Nb,Lb,Bb,Fb,kb,Ub=ye({DEFAULT:0,LINEAR:1}),Gb=function(){function t(){this._toneMappingType=Ub.DEFAULT,this._activated=!1}var e=t.prototype;return e.initialize=function(t){this._toneMappingType=t.toneMappingType},e.activate=function(){this._updatePipeline(),this._activated=!0},e._updatePipeline=function(){var t=m.director.root;t.pipeline.macros.CC_TONE_MAPPING_TYPE=this._toneMappingType,this._activated&&t.onGlobalPipelineStateChanged()},n(t,[{key:"toneMappingType",get:function(){return this._toneMappingType},set:function(t){this._toneMappingType=t,this._updatePipeline()}}]),t}(),Hb=new _n(0,1,0),zb=new _n,Vb=new on,Wb=new yn,Xb=new Rn,jb=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)},Yb=t("AmbientInfo",(mS=va("cc.AmbientInfo"),vS=Za(Je),yS=Ia("_skyColor"),TS=Ia("_skyIllum"),ES=Ia("_groundAlbedo"),mS((f((AS=function(){function t(){this._skyColorHDR=bS&&bS(),this._skyIllumHDR=CS&&CS(),this._groundAlbedoHDR=RS&&RS(),this._skyColorLDR=wS&&wS(),this._skyIllumLDR=IS&&IS(),this._groundAlbedoLDR=xS&&xS(),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=m.director.root.pipeline.pipelineSceneData.isHDR;return Vb.set(t?this._skyColorHDR:this._skyColorLDR),jb(Vb),Wb.set(255*Vb.x,255*Vb.y,255*Vb.z,255)},set:function(t){Vb.set(t.x,t.y,t.z,t.w),m.director.root.pipeline.pipelineSceneData.isHDR?this._skyColorHDR.set(Vb):this._skyColorLDR.set(Vb),this._resource&&this._resource.skyColor.set(Vb)}},{key:"skyColor",set:function(t){m.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 m.director.root.pipeline.pipelineSceneData.isHDR?this._skyIllumHDR:this._skyIllumLDR},set:function(t){m.director.root.pipeline.pipelineSceneData.isHDR?this._skyIllumHDR=t:this._skyIllumLDR=t,this._resource&&(this._resource.skyIllum=t)}},{key:"groundLightingColor",get:function(){var t=m.director.root.pipeline.pipelineSceneData.isHDR;return Vb.set(t?this._groundAlbedoHDR:this._groundAlbedoLDR),jb(Vb),Wb.set(255*Vb.x,255*Vb.y,255*Vb.z,255)},set:function(t){Vb.set(t.x,t.y,t.z,t.w),m.director.root.pipeline.pipelineSceneData.isHDR?this._groundAlbedoHDR.set(Vb):this._groundAlbedoLDR.set(Vb),this._resource&&this._resource.groundAlbedo.set(Vb)}},{key:"groundAlbedo",set:function(t){m.director.root.pipeline.pipelineSceneData.isHDR?this._groundAlbedoHDR.set(t):this._groundAlbedoLDR.set(t),this._resource&&this._resource.groundAlbedo.set(t)}}]),t}()).prototype,"skyIllum",[vS],Object.getOwnPropertyDescriptor(AS.prototype,"skyIllum"),AS.prototype),bS=ua(AS.prototype,"_skyColorHDR",[wa,yS],(function(){return new on(.2,.5,.8,1)})),CS=ua(AS.prototype,"_skyIllumHDR",[wa,TS],(function(){return Um.SKY_ILLUM})),RS=ua(AS.prototype,"_groundAlbedoHDR",[wa,ES],(function(){return new on(.2,.2,.2,1)})),wS=ua(AS.prototype,"_skyColorLDR",[wa],(function(){return new on(.2,.5,.8,1)})),IS=ua(AS.prototype,"_skyIllumLDR",[wa],(function(){return Um.SKY_ILLUM})),xS=ua(AS.prototype,"_groundAlbedoLDR",[wa],(function(){return new on(.2,.2,.2,1)})),SS=AS))||SS));m.AmbientInfo=Yb;var Kb=t("SkyboxInfo",(DS=va("cc.SkyboxInfo"),OS=Za(lS),PS=Za(Em),MS=Za(Je),NS=Za(Em),LS=Za(Em),BS=Za($E),FS=Za(Em),kS=Ia("_envmap"),US=Za(Em),GS=Za(Em),HS=Za(Em),zS=Za($E),VS=Za(Em),WS=Za(Em),DS((f((jS=function(){function t(){this._envLightingType=YS&&YS(),this._envmapHDR=KS&&KS(),this._envmapLDR=qS&&qS(),this._diffuseMapHDR=QS&&QS(),this._diffuseMapLDR=ZS&&ZS(),this._enabled=JS&&JS(),this._useHDR=$S&&$S(),this._editableMaterial=tA&&tA(),this._reflectionHDR=eA&&eA(),this._reflectionLDR=iA&&iA(),this._rotationAngle=nA&&nA(),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=lS.HEMISPHERE_DIFFUSE,q(15001)),this._resource&&(this._resource.setEnvMaps(this._envmapHDR,this._envmapLDR),this._resource.setDiffuseMaps(this._diffuseMapHDR,this._diffuseMapLDR),this._resource.setReflectionMaps(this._reflectionHDR,this._reflectionLDR),this._resource.useDiffuseMap=this.applyDiffuseMap,this._resource.envmap=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 lS.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||lS.HEMISPHERE_DIFFUSE===t?(lS.HEMISPHERE_DIFFUSE===t?(this.useIBL=!1,this.applyDiffuseMap=!1):lS.AUTOGEN_HEMISPHERE_DIFFUSE_WITH_REFLECTION===t?(this.useIBL=!0,this.applyDiffuseMap=!1):lS.DIFFUSEMAP_WITH_REFLECTION===t&&(this.useIBL=!0,this.applyDiffuseMap=!0),this._envLightingType=t):(this.useIBL=!1,this.applyDiffuseMap=!1,this._envLightingType=lS.HEMISPHERE_DIFFUSE,q(15001))}},{key:"useIBL",get:function(){return lS.HEMISPHERE_DIFFUSE!==this._envLightingType},set:function(t){this._resource&&(this._resource.useIBL=t)}},{key:"useHDR",get:function(){return m.director.root.pipeline.pipelineSceneData.isHDR=this._useHDR,this._useHDR},set:function(t){m.director.root.pipeline.pipelineSceneData.isHDR=t,this._useHDR=t,this._resource&&this.envLightingType===lS.DIFFUSEMAP_WITH_REFLECTION&&(null===this.diffuseMap?(this.envLightingType=lS.AUTOGEN_HEMISPHERE_DIFFUSE_WITH_REFLECTION,q(15e3)):this.diffuseMap.isDefault&&q(15002)),this._resource&&(this._resource.useHDR=this._useHDR,this._resource.updateMaterialRenderInfo())}},{key:"envmap",get:function(){return m.director.root.pipeline.pipelineSceneData.isHDR?this._envmapHDR:this._envmapLDR},set:function(t){var e=m.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=lS.HEMISPHERE_DIFFUSE,q(15001)),this._resource&&(this._resource.setEnvMaps(this._envmapHDR,this._envmapLDR),this._resource.setDiffuseMaps(this._diffuseMapHDR,this._diffuseMapLDR),this._resource.setReflectionMaps(this._reflectionHDR,this._reflectionLDR),this._resource.useDiffuseMap=this.applyDiffuseMap,this._resource.envmap=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 m.director.root.pipeline.pipelineSceneData.isHDR?this._diffuseMapHDR:this._diffuseMapLDR},set:function(t){m.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 m.director.root.pipeline.pipelineSceneData.isHDR?this._reflectionHDR:this._reflectionLDR},set:function(t){m.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",[OS],Object.getOwnPropertyDescriptor(jS.prototype,"envLightingType"),jS.prototype),f(jS.prototype,"envmap",[PS],Object.getOwnPropertyDescriptor(jS.prototype,"envmap"),jS.prototype),f(jS.prototype,"rotationAngle",[MS],Object.getOwnPropertyDescriptor(jS.prototype,"rotationAngle"),jS.prototype),f(jS.prototype,"diffuseMap",[NS],Object.getOwnPropertyDescriptor(jS.prototype,"diffuseMap"),jS.prototype),f(jS.prototype,"reflectionMap",[LS],Object.getOwnPropertyDescriptor(jS.prototype,"reflectionMap"),jS.prototype),f(jS.prototype,"skyboxMaterial",[BS],Object.getOwnPropertyDescriptor(jS.prototype,"skyboxMaterial"),jS.prototype),YS=ua(jS.prototype,"_envLightingType",[wa],(function(){return lS.HEMISPHERE_DIFFUSE})),KS=ua(jS.prototype,"_envmapHDR",[wa,FS,kS],(function(){return null})),qS=ua(jS.prototype,"_envmapLDR",[wa,US],(function(){return null})),QS=ua(jS.prototype,"_diffuseMapHDR",[wa,GS],(function(){return null})),ZS=ua(jS.prototype,"_diffuseMapLDR",[wa,HS],(function(){return null})),JS=ua(jS.prototype,"_enabled",[wa],(function(){return!1})),$S=ua(jS.prototype,"_useHDR",[wa],(function(){return!0})),tA=ua(jS.prototype,"_editableMaterial",[wa,zS],(function(){return null})),eA=ua(jS.prototype,"_reflectionHDR",[wa,VS],(function(){return null})),iA=ua(jS.prototype,"_reflectionLDR",[wa,WS],(function(){return null})),nA=ua(jS.prototype,"_rotationAngle",[wa],(function(){return 0})),XS=jS))||XS));m.SkyboxInfo=Kb;var qb=t("FogInfo",(rA=va("cc.FogInfo"),sA=Za(fS),oA=Za(Je),aA=Za(Je),hA=Za(Je),uA=Za(Je),cA=Za(Je),lA=Za(Je),rA(((bA=function(){function t(){this._type=fA&&fA(),this._fogColor=pA&&pA(),this._enabled=gA&&gA(),this._fogDensity=mA&&mA(),this._fogStart=vA&&vA(),this._fogEnd=yA&&yA(),this._fogAtten=TA&&TA(),this._fogTop=EA&&EA(),this._fogRange=SA&&SA(),this._accurate=AA&&AA(),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=fS,f((dA=bA).prototype,"type",[sA],Object.getOwnPropertyDescriptor(dA.prototype,"type"),dA.prototype),f(dA.prototype,"fogDensity",[oA],Object.getOwnPropertyDescriptor(dA.prototype,"fogDensity"),dA.prototype),f(dA.prototype,"fogStart",[aA],Object.getOwnPropertyDescriptor(dA.prototype,"fogStart"),dA.prototype),f(dA.prototype,"fogEnd",[hA],Object.getOwnPropertyDescriptor(dA.prototype,"fogEnd"),dA.prototype),f(dA.prototype,"fogAtten",[uA],Object.getOwnPropertyDescriptor(dA.prototype,"fogAtten"),dA.prototype),f(dA.prototype,"fogTop",[cA],Object.getOwnPropertyDescriptor(dA.prototype,"fogTop"),dA.prototype),f(dA.prototype,"fogRange",[lA],Object.getOwnPropertyDescriptor(dA.prototype,"fogRange"),dA.prototype),fA=ua(dA.prototype,"_type",[wa],(function(){return fS.LINEAR})),pA=ua(dA.prototype,"_fogColor",[wa],(function(){return new yn("#C8C8C8")})),gA=ua(dA.prototype,"_enabled",[wa],(function(){return!1})),mA=ua(dA.prototype,"_fogDensity",[wa],(function(){return.3})),vA=ua(dA.prototype,"_fogStart",[wa],(function(){return.5})),yA=ua(dA.prototype,"_fogEnd",[wa],(function(){return 300})),TA=ua(dA.prototype,"_fogAtten",[wa],(function(){return 5})),EA=ua(dA.prototype,"_fogTop",[wa],(function(){return 1.5})),SA=ua(dA.prototype,"_fogRange",[wa],(function(){return 1.2})),AA=ua(dA.prototype,"_accurate",[wa],(function(){return!1})),_A=dA))||_A)),Qb=t("ShadowsInfo",(CA=va("cc.ShadowsInfo"),RA=Za(eS),wA=Za(Je),IA=Za(Je),xA=Za(Ze),DA=Za(tS),CA((f((PA=function(){function t(){this._enabled=MA&&MA(),this._type=NA&&NA(),this._normal=LA&&LA(),this._distance=BA&&BA(),this._planeBias=FA&&FA(),this._shadowColor=kA&&kA(),this._maxReceived=UA&&UA(),this._size=GA&&GA(),this._resource=null}var e=t.prototype;return e.setPlaneFromNode=function(t){t.getWorldRotation(Xb),this.planeDirection=_n.transformQuat(zb,Hb,Xb),t.getWorldPosition(zb),this.planeHeight=_n.dot(this._normal,zb)},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){_n.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:"planeBias",get:function(){return this._planeBias},set:function(t){this._planeBias=t,this._resource&&(this._resource.planeBias=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",[RA],Object.getOwnPropertyDescriptor(PA.prototype,"type"),PA.prototype),f(PA.prototype,"planeHeight",[wA],Object.getOwnPropertyDescriptor(PA.prototype,"planeHeight"),PA.prototype),f(PA.prototype,"planeBias",[IA],Object.getOwnPropertyDescriptor(PA.prototype,"planeBias"),PA.prototype),f(PA.prototype,"maxReceived",[xA],Object.getOwnPropertyDescriptor(PA.prototype,"maxReceived"),PA.prototype),f(PA.prototype,"shadowMapSize",[DA],Object.getOwnPropertyDescriptor(PA.prototype,"shadowMapSize"),PA.prototype),MA=ua(PA.prototype,"_enabled",[wa],(function(){return!1})),NA=ua(PA.prototype,"_type",[wa],(function(){return eS.Planar})),LA=ua(PA.prototype,"_normal",[wa],(function(){return new _n(0,1,0)})),BA=ua(PA.prototype,"_distance",[wa],(function(){return 0})),FA=ua(PA.prototype,"_planeBias",[wa],(function(){return 1})),kA=ua(PA.prototype,"_shadowColor",[wa],(function(){return new yn(0,0,0,76)})),UA=ua(PA.prototype,"_maxReceived",[wa],(function(){return 4})),GA=ua(PA.prototype,"_size",[wa],(function(){return new Hn(1024,1024)})),OA=PA))||OA));m.ShadowsInfo=Qb;var Zb=t("DEFAULT_WORLD_MIN_POS",new _n(-1024,-1024,-1024)),Jb=t("DEFAULT_WORLD_MAX_POS",new _n(1024,1024,1024)),$b=t("DEFAULT_OCTREE_DEPTH",8),tC=t("OctreeInfo",(HA=va("cc.OctreeInfo"),zA=Za(Ze),HA((f((WA=function(){function t(){this._enabled=XA&&XA(),this._minPos=jA&&jA(),this._maxPos=YA&&YA(),this._depth=KA&&KA(),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",[zA],Object.getOwnPropertyDescriptor(WA.prototype,"depth"),WA.prototype),XA=ua(WA.prototype,"_enabled",[wa],(function(){return!1})),jA=ua(WA.prototype,"_minPos",[wa],(function(){return new _n(Zb)})),YA=ua(WA.prototype,"_maxPos",[wa],(function(){return new _n(Jb)})),KA=ua(WA.prototype,"_depth",[wa],(function(){return $b})),VA=WA))||VA));m.OctreeInfo=tC;var eC=t("SkinInfo",(qA=va("cc.SkinInfo"),QA=Za(Je),ZA=Za(Je),qA((f(($A=function(){function t(){this._enabled=tb&&tb(),this._blurRadius=eb&&eb(),this._sssIntensity=ib&&ib(),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",[QA],Object.getOwnPropertyDescriptor($A.prototype,"blurRadius"),$A.prototype),f($A.prototype,"sssIntensity",[ZA],Object.getOwnPropertyDescriptor($A.prototype,"sssIntensity"),$A.prototype),tb=ua($A.prototype,"_enabled",[wa],(function(){return!0})),eb=ua($A.prototype,"_blurRadius",[wa],(function(){return.01})),ib=ua($A.prototype,"_sssIntensity",[wa],(function(){return 3})),JA=$A))||JA));m.SkinInfo=eC;var iC=t("PostSettingsInfo",(nb=va("cc.PostSettingsInfo"),rb=Za(Ub),nb((f((ob=function(){function t(){this._toneMappingType=ab&&ab(),this._resource=null}return t.prototype.activate=function(t){this._resource=t,this._resource.initialize(this),this._resource.activate()},n(t,[{key:"toneMappingType",get:function(){return this._toneMappingType},set:function(t){this._toneMappingType=t,this._resource&&(this._resource.toneMappingType=t)}}]),t}()).prototype,"toneMappingType",[rb],Object.getOwnPropertyDescriptor(ob.prototype,"toneMappingType"),ob.prototype),ab=ua(ob.prototype,"_toneMappingType",[wa],(function(){return Ub.DEFAULT})),sb=ob))||sb));m.PostSettingsInfo=iC;var nC,rC,sC,oC,aC,hC,uC,cC,lC,_C,dC,fC,pC,gC,mC,vC,yC,TC,EC,SC,AC,bC,CC,RC,wC,IC,xC,DC,OC,PC,MC,NC,LC,BC,FC,kC,UC,GC,HC,zC,VC,WC,XC,jC,YC,KC,qC,QC,ZC,JC,$C,tR,eR,iR,nR,rR,sR,oR,aR,hR,uR,cR,lR,_R,dR,fR,pR,gR,mR,vR=t("LightProbeInfo",(hb=va("cc.LightProbeInfo"),ub=Za(Je),cb=Za(Ze),lb=Za(Ze),_b=Za(Je),db=Za(Je),hb((f((pb=function(){function t(){this._giScale=gb&&gb(),this._giSamples=mb&&mb(),this._bounces=vb&&vb(),this._reduceRinging=yb&&yb(),this._showProbe=Tb&&Tb(),this._showWireframe=Eb&&Eb(),this._showConvex=Sb&&Sb(),this._data=Ab&&Ab(),this._lightProbeSphereVolume=bb&&bb(),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(Dg.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),m.internal.LightProbesData){this._data||(this._data=new m.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 o=0;o<r.length;o++){var a=new _n(0,0,0);_n.add(a,r[o],s),e.push(a)}}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",[ub],Object.getOwnPropertyDescriptor(pb.prototype,"giScale"),pb.prototype),f(pb.prototype,"giSamples",[cb],Object.getOwnPropertyDescriptor(pb.prototype,"giSamples"),pb.prototype),f(pb.prototype,"bounces",[lb],Object.getOwnPropertyDescriptor(pb.prototype,"bounces"),pb.prototype),f(pb.prototype,"reduceRinging",[_b],Object.getOwnPropertyDescriptor(pb.prototype,"reduceRinging"),pb.prototype),f(pb.prototype,"lightProbeSphereVolume",[db],Object.getOwnPropertyDescriptor(pb.prototype,"lightProbeSphereVolume"),pb.prototype),gb=ua(pb.prototype,"_giScale",[wa],(function(){return 1})),mb=ua(pb.prototype,"_giSamples",[wa],(function(){return 1024})),vb=ua(pb.prototype,"_bounces",[wa],(function(){return 2})),yb=ua(pb.prototype,"_reduceRinging",[wa],(function(){return 0})),Tb=ua(pb.prototype,"_showProbe",[wa],(function(){return!0})),Eb=ua(pb.prototype,"_showWireframe",[wa],(function(){return!0})),Sb=ua(pb.prototype,"_showConvex",[wa],(function(){return!1})),Ab=ua(pb.prototype,"_data",[wa],(function(){return null})),bb=ua(pb.prototype,"_lightProbeSphereVolume",[wa],(function(){return 1})),fb=pb))||fb)),yR=t("SceneGlobals",(Cb=va("cc.SceneGlobals"),Rb=Za(Kb),Cb((Ib=function(){function t(){this.ambient=xb&&xb(),this.shadows=Db&&Db(),this._skybox=Ob&&Ob(),this.fog=Pb&&Pb(),this.octree=Mb&&Mb(),this.skin=Nb&&Nb(),this.lightProbeInfo=Lb&&Lb(),this.postSettings=Bb&&Bb(),this.bakedWithStationaryMainLight=Fb&&Fb(),this.bakedWithHighpLightmap=kb&&kb(),this.disableLightmap=!1}return t.prototype.activate=function(t){var e=m.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.postSettings.activate(e.postSettings),this.lightProbeInfo&&e.lightProbes&&this.lightProbeInfo.activate(t,e.lightProbes),m.director.root.onGlobalPipelineStateChanged()},n(t,[{key:"skybox",get:function(){return this._skybox},set:function(t){this._skybox=t}}]),t}(),xb=ua(Ib.prototype,"ambient",[wa],(function(){return new Yb})),Db=ua(Ib.prototype,"shadows",[wa],(function(){return new Qb})),Ob=ua(Ib.prototype,"_skybox",[wa],(function(){return new Kb})),Pb=ua(Ib.prototype,"fog",[wa],(function(){return new qb})),f(Ib.prototype,"skybox",[Rb],Object.getOwnPropertyDescriptor(Ib.prototype,"skybox"),Ib.prototype),Mb=ua(Ib.prototype,"octree",[wa],(function(){return new tC})),Nb=ua(Ib.prototype,"skin",[wa],(function(){return new eC})),Lb=ua(Ib.prototype,"lightProbeInfo",[wa],(function(){return new vR})),Bb=ua(Ib.prototype,"postSettings",[wa],(function(){return new iC})),Fb=ua(Ib.prototype,"bakedWithStationaryMainLight",[wa],(function(){return!1})),kb=ua(Ib.prototype,"bakedWithHighpLightmap",[wa],(function(){return!1})),wb=Ib))||wb));m.SceneGlobals=yR;var TR=(nC=va("cc.TargetInfo"),rC=Za([ti]),nC((oC=function(){this.localID=aC&&aC()},aC=ua(oC.prototype,"localID",[wa,rC],(function(){return[]})),sC=oC))||sC),ER=(hC=va("cc.TargetOverrideInfo"),uC=Za(qs),cC=Za(TR),lC=Za([ti]),_C=Za(Tm),dC=Za(TR),hC((pC=function(){this.source=gC&&gC(),this.sourceInfo=mC&&mC(),this.propertyPath=vC&&vC(),this.target=yC&&yC(),this.targetInfo=TC&&TC()},gC=ua(pC.prototype,"source",[wa,uC],(function(){return null})),mC=ua(pC.prototype,"sourceInfo",[wa,cC],(function(){return null})),vC=ua(pC.prototype,"propertyPath",[wa,lC],(function(){return[]})),yC=ua(pC.prototype,"target",[wa,_C],(function(){return null})),TC=ua(pC.prototype,"targetInfo",[wa,dC],(function(){return null})),fC=pC))||fC),SR=va("cc.CompPrefabInfo")((SC=function(){this.fileId=AC&&AC()},AC=ua(SC.prototype,"fileId",[wa],(function(){return""})),EC=SC))||EC,AR=(bC=va("CCPropertyOverrideInfo"),CC=Za(TR),RC=Za([ti]),bC((IC=function(){function t(){this.targetInfo=xC&&xC(),this.propertyPath=DC&&DC(),this.value=OC&&OC()}return t.prototype.isTarget=function(){},t}(),xC=ua(IC.prototype,"targetInfo",[wa,CC],(function(){return null})),DC=ua(IC.prototype,"propertyPath",[wa,RC],(function(){return[]})),OC=ua(IC.prototype,"value",[wa],null),wC=IC))||wC),bR=(PC=va("cc.MountedChildrenInfo"),MC=Za(TR),NC=Za([Tm]),PC((BC=function(){function t(){this.targetInfo=FC&&FC(),this.nodes=kC&&kC()}return t.prototype.isTarget=function(){},t}(),FC=ua(BC.prototype,"targetInfo",[wa,MC],(function(){return null})),kC=ua(BC.prototype,"nodes",[wa,NC],(function(){return[]})),LC=BC))||LC),CR=(UC=va("cc.MountedComponentsInfo"),GC=Za(TR),HC=Za([xp]),UC((VC=function(){function t(){this.targetInfo=WC&&WC(),this.components=XC&&XC()}return t.prototype.isTarget=function(){},t}(),WC=ua(VC.prototype,"targetInfo",[wa,GC],(function(){return null})),XC=ua(VC.prototype,"components",[wa,HC],(function(){return[]})),zC=VC))||zC),RR=(jC=va("cc.PrefabInstance"),YC=Za(Tm),KC=Za([bR]),qC=Za([CR]),QC=Za([AR]),ZC=Za([TR]),jC(($C=function(){function t(){this.fileId=tR&&tR(),this.prefabRootNode=eR&&eR(),this.mountedChildren=iR&&iR(),this.mountedComponents=nR&&nR(),this.propertyOverrides=rR&&rR(),this.removedComponents=sR&&sR(),this.targetMap={},this.expanded=!1}var e=t.prototype;return e.findPropertyOverride=function(){},e.removePropertyOverride=function(){},t}(),tR=ua($C.prototype,"fileId",[wa],(function(){return""})),eR=ua($C.prototype,"prefabRootNode",[wa,YC],null),iR=ua($C.prototype,"mountedChildren",[wa,KC],(function(){return[]})),nR=ua($C.prototype,"mountedComponents",[wa,qC],(function(){return[]})),rR=ua($C.prototype,"propertyOverrides",[wa,QC],(function(){return[]})),sR=ua($C.prototype,"removedComponents",[wa,ZC],(function(){return[]})),JC=$C))||JC),wR=(oR=va("cc.PrefabInfo"),aR=Za(Tm),hR=Za(RR),uR=Za([ER]),oR((lR=function(){this.root=_R&&_R(),this.asset=dR&&dR(),this.fileId=fR&&fR(),this.instance=pR&&pR(),this.targetOverrides=gR&&gR(),this.nestedPrefabInstanceRoots=mR&&mR()},_R=ua(lR.prototype,"root",[wa,aR],null),dR=ua(lR.prototype,"asset",[wa],null),fR=ua(lR.prototype,"fileId",[wa],(function(){return""})),pR=ua(lR.prototype,"instance",[wa,hR],null),gR=ua(lR.prototype,"targetOverrides",[wa,uR],null),mR=ua(lR.prototype,"nestedPrefabInstanceRoots",[wa],null),cR=lR))||cR);function IR(t){var e=null==t?void 0:t.prefab;if(e&&e.instance){if(!e.asset)return Z(3701,t.name),void(e.instance=void 0);var i=t._objFlags,n=t.getParent(),r=t.uuid;t[Ys],m.game._isCloning=!0;var s=e.asset.data;s._iN$t=t,m.instantiate._clone(s,s),m.game._isCloning=!1,t._objFlags=i,t.modifyParent(n),t.id=r,t.prefab&&(t.prefab.instance=e.instance)}}function xR(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 o=t.prefab;o&&(r[o.fileId]=t);for(var a=t.components,h=0;h<a.length;h++){var u=a[h];u.__prefab&&(r[u.__prefab.fileId]=u)}for(var c=0;c<t.children.length;c++)xR(t.children[c],r,!1)}}function DR(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 OR(t,e,i){if(e)for(var n=0;n<e.length;n++){var r=e[n];if(r&&r.targetInfo){var s=DR(r.targetInfo.localID,i);if(!s)continue;var o=i,a=r.targetInfo.localID;if(a.length>0)for(var h=0;h<a.length-1;h++)o=o[a[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),xR(c,o,!1),c.siblingIndex=s.children.length-1,BR(c,!0))}}}}function PR(t,e,i){if(e)for(var n=0;n<e.length;n++){var r=e[n];if(r&&r.targetInfo){var s=DR(r.targetInfo.localID,i);if(!s)continue;if(r.components)for(var o=0;o<r.components.length;o++){var a=r.components[o];a&&(a.node=s,s.getWritableComponents().push(a))}}}}function MR(t,e,i){if(e)for(var n=0;n<e.length;n++){var r=e[n];if(r){var s=DR(r.localID,i);if(!s||!s.node)continue;var o=s.node.components.indexOf(s);o>=0&&s.node.getWritableComponents().splice(o,1)}}}function NR(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=DR(s.targetInfo.localID,i)))continue;var o=n,a=s.propertyPath.slice();if(a.length>0){var h=a.pop();if(!h)continue;for(var u=0;u<a.length&&(o=o[a[u]]);u++);if(!o)continue;if(Array.isArray(o))if("length"===h)o[h]=s.value;else{var c=Number.parseInt(h);Number.isInteger(c)&&c<o.length&&(o[h]=s.value)}else o[h]instanceof be?o[h].set(s.value):o[h]=s.value}}}}function LR(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=i[n],o=s.source,a=s.sourceInfo;if(a){var h,u=s.source,c=null==u||null===(h=u.prefab)||void 0===h?void 0:h.instance;c&&c.targetMap&&(o=DR(a.localID,c.targetMap))}if(o){var l,_=s.targetInfo;if(_){var d=s.target,f=null==d||null===(r=d.prefab)||void 0===r?void 0:r.instance;if(f&&f.targetMap&&(l=DR(_.localID,f.targetMap))){var p=s.propertyPath.slice(),g=o;if(p.length>0){var m=p.pop();if(!m)return;for(var v=0;v<p.length&&(g=g[p[v]]);v++);if(!g)continue;g[m]=l}}}}}}function BR(t,e){var i;void 0===e&&(e=!1);var n=null==t||null===(i=t.prefab)||void 0===i?void 0:i.instance;if(n&&!n.expanded){IR(t),e&&t&&t.children&&t.children.forEach((function(t){BR(t,!0)}));var r={};n.targetMap=r,xR(t,r,!0),OR(0,n.mountedChildren,r),MR(0,n.removedComponents,r),PR(0,n.mountedComponents,r),NR(0,n.propertyOverrides,r),n.expanded=!0}else e&&t&&t.children&&t.children.forEach((function(t){BR(t,!0)}))}function FR(t){var e=t.prefab;e&&e.nestedPrefabInstanceRoots&&e.nestedPrefabInstanceRoots.forEach((function(t){BR(t)}))}m._PrefabInfo=wR;var kR,UR,GR,HR,zR,VR,WR,XR=Object.freeze({__proto__:null,createNodeWithPrefab:IR,generateTargetMap:xR,getTarget:DR,applyMountedChildren:OR,applyMountedComponents:PR,applyRemovedComponents:MR,applyPropertyOverrides:NR,applyTargetOverrides:LR,expandPrefabInstanceNode:BR,expandNestedPrefabInstanceNode:FR,applyNodeAndComponentId:function t(e,i){for(var n=e.components,r=e.children,s=0;s<n.length;s++){var o,a,h=n[s],u=null!==(o=null===(a=h.__prefab)||void 0===a?void 0:a.fileId)&&void 0!==o?o:"";h._id=""+i+u}for(var c=0;c<r.length;c++){var l=r[c],_=l.prefab,d=null!=_&&_.instance?_.instance.fileId:null==_?void 0:_.fileId;d&&(l.id=""+i+d,null!=_&&_.instance||t(l,i))}},TargetInfo:TR,TargetOverrideInfo:ER,CompPrefabInfo:SR,PropertyOverrideInfo:AR,MountedChildrenInfo:bR,MountedComponentsInfo:CR,PrefabInstance:RR,PrefabInfo:wR}),jR=t("Scene",va("cc.Scene")((UR=function(t){s(i,t);var e=i.prototype;function i(e){var i;return(i=t.call(this,e)||this).autoReleaseAssets=GR&&GR(),i._globals=HR&&HR(),i.dependAssets=null,i._renderScene=null,i._prefabSyncedInLiveReload=!1,i._activeInHierarchy=!1,m.director&&m.director.root&&(i._renderScene=m.director.root.createScene({})),i._inited=!m.game||!m.game._isCloning,i}return e._updateScene=function(){this._scene=this},e.destroy=function(){var t=qs.prototype.destroy.call(this);if(t)for(var e=this._children,i=0;i<e.length;++i)e[i].active=!1;return this._renderScene&&m.director.root.destroyScene(this._renderScene),this._active=!1,this._activeInHierarchy=!1,t},e.addComponent=function(){throw new Error(et(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(){return null},e._load=function(){this._inited||(FR(this),LR(this),this._onBatchCreated(false),this._inited=!0),this.walk(Tm._setScene)},e._activate=function(t){void 0===t&&(t=!0),m.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}(Tm),GR=ua(UR.prototype,"autoReleaseAssets",[wa],(function(){return!1})),HR=ua(UR.prototype,"_globals",[wa],(function(){return new yR})),kR=UR))||kR);m.Scene=jR;var YR=t("SceneAsset",va("cc.SceneAsset")((VR=function(t){function e(){var e;return(e=t.call(this)||this).scene=WR&&WR(),e}s(e,t);var i=e.prototype;return i.initDefault=function(e){t.prototype.initDefault.call(this,e),this.scene=new jR("New Scene")},i.validate=function(){return!!this.scene},e}(Of),WR=ua(VR.prototype,"scene",[wa],(function(){return null})),zR=VR))||zR);m.SceneAsset=YR,gt({SystemEventType:{newName:"Input.EventType",since:"3.3.0",removed:!1}}),gt({SystemEvent:{newName:"Input",since:"3.4.0",removed:!1},systemEvent:{newName:"input",since:"3.4.0",removed:!1}});var KR,qR,QR=t("Event",function(){function t(t,e){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}());QR.NO_TYPE="no_type",QR.TOUCH="touch",QR.MOUSE="mouse",QR.KEYBOARD="keyboard",QR.ACCELERATION="acceleration",QR.NONE=0,QR.CAPTURING_PHASE=1,QR.AT_TARGET=2,QR.BUBBLING_PHASE=3,m.Event=QR,t("SystemEventType",KR),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"}(KR||t("SystemEventType",KR={})),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_LEAVE="mouse-leave-window",t.MOUSE_ENTER="mouse-enter-window",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"}(qR||(qR={})),m.SystemEventType=KR;var ZR=t("EventAcceleration",function(t){function e(e,i){var n;return(n=t.call(this,KR.DEVICEMOTION,i)||this).acc=e,n}return s(e,t),e}(QR));QR.EventAcceleration=ZR;var JR=t("EventKeyboard",function(t){function e(e,i,n){var r;return"boolean"==typeof i&&(i=i?KR.KEY_DOWN:KR.KEY_UP),(r=t.call(this,i,n)||this).rawEvent=void 0,r._isPressed=i!==KR.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}(QR));QR.EventKeyboard=JR;var $R=t("EventMouse",function(t){function e(i,n,r,s){var o;return(o=t.call(this,i,n)||this).movementX=0,o.movementY=0,o.windowId=0,o.preventSwallow=!1,o._button=e.BUTTON_MISSING,o._x=0,o._y=0,o._prevX=0,o._prevY=0,o._scrollX=0,o._scrollY=0,o._eventType=i,r&&(o._prevX=r.x,o._prevY=r.y),o.windowId=null!=s?s:o.windowId,o}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 Hn),Hn.set(t,this._x,this._y),t},i.getLocationInView=function(t){return t||(t=new Hn),Hn.set(t,this._x,m.view._designResolutionSize.height-this._y),t},i.getUILocation=function(t){return t||(t=new Hn),Hn.set(t,this._x,this._y),m.view._convertToUISpace(t),t},i.getPreviousLocation=function(t){return t||(t=new Hn),Hn.set(t,this._prevX,this._prevY),t},i.getUIPreviousLocation=function(t){return t||(t=new Hn),Hn.set(t,this._prevX,this._prevY),m.view._convertToUISpace(t),t},i.getDelta=function(t){return t||(t=new Hn),Hn.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 Hn),Hn.set(t,(this._x-this._prevX)/m.view.getScaleX(),(this._y-this._prevY)/m.view.getScaleY()),t},i.getUIDeltaX=function(){return(this._x-this._prevX)/m.view.getScaleX()},i.getUIDeltaY=function(){return(this._y-this._prevY)/m.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=m.view.getViewportRect();return(this._x-t.x)/m.view.getScaleX()},i.getUILocationY=function(){var t=m.view.getViewportRect();return(this._y-t.y)/m.view.getScaleY()},n(e,[{key:"eventType",get:function(){return this._eventType}}]),e}(QR));$R.BUTTON_MISSING=-1,$R.BUTTON_LEFT=0,$R.BUTTON_RIGHT=2,$R.BUTTON_MIDDLE=1,$R.BUTTON_4=3,$R.BUTTON_5=4,$R.BUTTON_6=5,$R.BUTTON_7=6,$R.BUTTON_8=7,QR.EventMouse=$R;var tw=new Hn,ew=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=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 Hn},i.getUILocation=function(t){return this.touch?this.touch.getUILocation(t):new Hn},i.getLocationInView=function(t){return this.touch?this.touch.getLocationInView(t):new Hn},i.getPreviousLocation=function(t){return this.touch?this.touch.getPreviousLocation(t):new Hn},i.getStartLocation=function(t){return this.touch?this.touch.getStartLocation(t):new Hn},i.getUIStartLocation=function(t){return this.touch?this.touch.getUIStartLocation(t):new Hn},i.getID=function(){return this.touch?this.touch.getID():null},i.getDelta=function(t){return this.touch?this.touch.getDelta(t):new Hn},i.getUIDelta=function(t){return this.touch?this.touch.getUIDelta(t):new Hn},i.getDeltaX=function(){return this.touch?this.touch.getDelta(tw).x:0},i.getDeltaY=function(){return this.touch?this.touch.getDelta(tw).y:0},i.getLocationX=function(){return this.touch?this.touch.getLocationX():0},i.getLocationY=function(){return this.touch?this.touch.getLocationY():0},e}(QR));ew.MAX_TOUCHES=5,QR.EventTouch=ew;var iw,nw=t("EventGamepad",function(t){function e(e,i){var n;return(n=t.call(this,e,!1)||this).gamepad=i,n}return s(e,t),e}(QR)),rw=t("EventHandle",function(t){function e(e,i){var n;return(n=t.call(this,e,!1)||this).handleInputDevice=i,n}return s(e,t),e}(QR)),sw=(t("EventHMD",function(t){function e(e,i){var n;return(n=t.call(this,e,!1)||this).hmdInputDevice=i,n}return s(e,t),e}(QR)),t("EventHandheld",function(t){function e(e,i){var n;return(n=t.call(this,e,!1)||this).handheldInputDevice=i,n}return s(e,t),e}(QR)),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=t,this.y=e,this.z=i,this.timestamp=n})));t("KeyCode",iw),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"}(iw||t("KeyCode",iw={}));var ow=new Hn,aw=t("Touch",function(){function t(t,e,i){void 0===i&&(i=0),this._point=new Hn,this._prevPoint=new Hn,this._lastModified=0,this._id=0,this._startPoint=new Hn,this._startPointCaptured=!1,this.setTouchInfo(i,t,e)}var e=t.prototype;return e.getLocation=function(t){return t||(t=new Hn),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 Hn),t.set(this._point.x,this._point.y),m.view._convertToUISpace(t),t},e.getUILocationX=function(){var t=m.view.getViewportRect();return(this._point.x-t.x)/m.view.getScaleX()},e.getUILocationY=function(){var t=m.view.getViewportRect();return(this._point.y-t.y)/m.view.getScaleY()},e.getPreviousLocation=function(t){return t||(t=new Hn),t.set(this._prevPoint.x,this._prevPoint.y),t},e.getUIPreviousLocation=function(t){return t||(t=new Hn),t.set(this._prevPoint.x,this._prevPoint.y),m.view._convertToUISpace(t),t},e.getStartLocation=function(t){return t||(t=new Hn),t.set(this._startPoint.x,this._startPoint.y),t},e.getUIStartLocation=function(t){return t||(t=new Hn),t.set(this._startPoint.x,this._startPoint.y),m.view._convertToUISpace(t),t},e.getDelta=function(t){return t||(t=new Hn),t.set(this._point),t.subtract(this._prevPoint),t},e.getUIDelta=function(t){return t||(t=new Hn),ow.set(this._point),ow.subtract(this._prevPoint),t.set(m.view.getScaleX(),m.view.getScaleY()),Hn.divide(t,ow,t),t},e.getLocationInView=function(t){return t||(t=new Hn),t.set(this._point.x,m.view._designResolutionSize.height-this._point.y),t},e.getPreviousLocationInView=function(t){return t||(t=new Hn),t.set(this._prevPoint.x,m.view._designResolutionSize.height-this._prevPoint.y),t},e.getStartLocationInView=function(t){return t||(t=new Hn),t.set(this._startPoint.x,m.view._designResolutionSize.height-this._startPoint.y),t},e.getID=function(){return this._id},e.setTouchInfo=function(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this._prevPoint=this._point,this._point=new Hn(e||0,i||0),this._id=t,this._startPointCaptured||(this._startPoint=new Hn(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=m.game.frameStartTime},e.setPrevPoint=function(t,e){this._prevPoint="object"==typeof t?new Hn(t.x,t.y):new Hn(t||0,e||0),this._lastModified=m.game.frameStartTime},e.clone=function(){var e=this.getID();this.getStartLocation(ow);var i=new t(ow.x,ow.y,e);return this.getLocation(ow),i.setPoint(ow.x,ow.y),this.getPreviousLocation(ow),i.setPrevPoint(ow),i},n(t,[{key:"lastModified",get:function(){return this._lastModified}}]),t}());m.Touch=aw;var hw=function(){function t(){this._isStarted=!1,this._accelMode="normal",this._eventTarget=new oo,this._didAccelerateFunc=this._didAccelerate.bind(this)}var e=t.prototype;return e._registerEvent=function(){xs.onAccelerometerChange(this._didAccelerateFunc)},e._unregisterEvent=function(){xs.offAccelerometerChange(this._didAccelerateFunc)},e._didAccelerate=function(t){var e=performance.now(),i=new sw(t.x,t.y,t.z,e),n=new ZR(i);this._eventTarget.emit(qR.DEVICEMOTION,n)},e.start=function(){var t=this;this._registerEvent(),xs.startAccelerometer({interval:this._accelMode,success:function(){t._isStarted=!0}})},e.stop=function(){var t=this;xs.stopAccelerometer({success:function(){t._isStarted=!1},fail:function(){Z(16305)}}),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}(),uw=function(){},cw=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}(uw),lw=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}(uw),_w=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}(uw),dw=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}(uw),fw=function(t){function e(e){var i;return(i=t.call(this)||this).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}(cw),pw=function(t){function e(e){var i;return(i=t.call(this)||this).up=e.up,i.down=e.down,i.left=e.left,i.right=e.right,i.xAxis=new fw({positive:i.right,negative:i.left}),i.yAxis=new fw({positive:i.up,negative:i.down}),i}return s(e,t),e.prototype.getValue=function(){return new Hn(this.xAxis.getValue(),this.yAxis.getValue())},e}(lw);!function(t){function e(e){var i;return(i=t.call(this)||this).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 fw({positive:i.right,negative:i.left}),i.yAxis=new fw({positive:i.up,negative:i.down}),i.zAxis=new fw({positive:i.forward,negative:i.backward}),i}s(e,t),e.prototype.getValue=function(){return new _n(this.xAxis.getValue(),this.yAxis.getValue(),this.zAxis.getValue())}}(_w);var gw=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}(cw),mw=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(pw),vw=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(pw),yw=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}(dw),Tw=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}(_w),Ew=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}(cw),Sw=function(){function t(t){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 gw,this._buttonNorth.getValue=function(){return 0},this._buttonEast=new gw,this._buttonEast.getValue=function(){return 0},this._buttonWest=new gw,this._buttonWest.getValue=function(){return 0},this._buttonSouth=new gw,this._buttonSouth.getValue=function(){return 0},this._buttonL1=new gw,this._buttonL1.getValue=function(){return 0},this._buttonL2=new gw,this._buttonL2.getValue=function(){return 0},this._buttonL3=new gw,this._buttonL3.getValue=function(){return 0},this._buttonR1=new gw,this._buttonR1.getValue=function(){return 0},this._buttonR2=new gw,this._buttonR2.getValue=function(){return 0},this._buttonR3=new gw,this._buttonR3.getValue=function(){return 0},this._buttonShare=new gw,this._buttonShare.getValue=function(){return 0},this._buttonOptions=new gw,this._buttonOptions.getValue=function(){return 0};var t=new gw;t.getValue=function(){return 0};var e=new gw;e.getValue=function(){return 0};var i=new gw;i.getValue=function(){return 0};var n=new gw;n.getValue=function(){return 0},this._dpad=new mw({up:t,down:e,left:i,right:n});var r=new gw;r.getValue=function(){return 0};var s=new gw;s.getValue=function(){return 0};var o=new gw;o.getValue=function(){return 0};var a=new gw;a.getValue=function(){return 0},this._leftStick=new vw({up:r,down:s,left:o,right:a});var h=new gw;h.getValue=function(){return 0};var u=new gw;u.getValue=function(){return 0};var c=new gw;c.getValue=function(){return 0};var l=new gw;l.getValue=function(){return 0},this._rightStick=new vw({up:h,down:u,left:c,right:l}),this._buttonStart=new gw,this._buttonStart.getValue=function(){return 0},this._gripLeft=new gw,this._gripLeft.getValue=function(){return 0},this._gripRight=new gw,this._gripRight.getValue=function(){return 0},this._handLeftPosition=new Tw,this._handLeftPosition.getValue=function(){return _n.ZERO},this._handLeftOrientation=new yw,this._handLeftOrientation.getValue=function(){return Rn.IDENTITY},this._handRightPosition=new Tw,this._handRightPosition.getValue=function(){return _n.ZERO},this._handRightOrientation=new yw,this._handRightOrientation.getValue=function(){return Rn.IDENTITY},this._aimLeftPosition=new Tw,this._aimLeftPosition.getValue=function(){return _n.ZERO},this._aimLeftOrientation=new yw,this._aimLeftOrientation.getValue=function(){return Rn.IDENTITY},this._aimRightPosition=new Tw,this._aimRightPosition.getValue=function(){return _n.ZERO},this._aimRightOrientation=new yw,this._aimRightOrientation.getValue=function(){return Rn.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}();Sw.all=[],Sw.xr=null,Sw._eventTarget=new oo;var Aw=function(){function t(){this._eventTarget=new oo,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 gw,this._buttonNorth.getValue=function(){return 0},this._buttonEast=new gw,this._buttonEast.getValue=function(){return 0},this._buttonWest=new gw,this._buttonWest.getValue=function(){return 0},this._buttonSouth=new gw,this._buttonSouth.getValue=function(){return 0},this._buttonTriggerLeft=new gw,this._buttonTriggerLeft.getValue=function(){return 0},this._buttonTriggerRight=new gw,this._buttonTriggerRight.getValue=function(){return 0},this._triggerLeft=new gw,this._triggerLeft.getValue=function(){return 0},this._triggerRight=new gw,this._triggerRight.getValue=function(){return 0},this._gripLeft=new gw,this._gripLeft.getValue=function(){return 0},this._gripRight=new gw,this._gripRight.getValue=function(){return 0},this._buttonLeftStick=new gw,this._buttonLeftStick.getValue=function(){return 0};var t=new gw;t.getValue=function(){return 0};var e=new gw;e.getValue=function(){return 0};var i=new gw;i.getValue=function(){return 0};var n=new gw;n.getValue=function(){return 0},this._leftStick=new vw({up:t,down:e,left:i,right:n}),this._buttonRightStick=new gw,this._buttonRightStick.getValue=function(){return 0};var r=new gw;r.getValue=function(){return 0};var s=new gw;s.getValue=function(){return 0};var o=new gw;o.getValue=function(){return 0};var a=new gw;a.getValue=function(){return 0},this._rightStick=new vw({up:r,down:s,left:o,right:a}),this._buttonOptions=new gw,this._buttonOptions.getValue=function(){return 0},this._buttonStart=new gw,this._buttonStart.getValue=function(){return 0},this._handLeftPosition=new Tw,this._handLeftPosition.getValue=function(){return _n.ZERO},this._handLeftOrientation=new yw,this._handLeftOrientation.getValue=function(){return Rn.IDENTITY},this._handRightPosition=new Tw,this._handRightPosition.getValue=function(){return _n.ZERO},this._handRightOrientation=new yw,this._handRightOrientation.getValue=function(){return Rn.IDENTITY},this._aimLeftPosition=new Tw,this._aimLeftPosition.getValue=function(){return _n.ZERO},this._aimLeftOrientation=new yw,this._aimLeftOrientation.getValue=function(){return Rn.IDENTITY},this._aimRightPosition=new Tw,this._aimRightPosition.getValue=function(){return _n.ZERO},this._aimRightOrientation=new yw,this._aimRightOrientation.getValue=function(){return Rn.IDENTITY},this._touchButtonA=new Ew,this._touchButtonA.getValue=function(){return 0},this._touchButtonB=new Ew,this._touchButtonB.getValue=function(){return 0},this._touchButtonX=new Ew,this._touchButtonX.getValue=function(){return 0},this._touchButtonY=new Ew,this._touchButtonY.getValue=function(){return 0},this._touchButtonTriggerLeft=new Ew,this._touchButtonTriggerLeft.getValue=function(){return 0},this._touchButtonTriggerRight=new Ew,this._touchButtonTriggerRight.getValue=function(){return 0},this._touchButtonThumbStickLeft=new Ew,this._touchButtonThumbStickLeft.getValue=function(){return 0},this._touchButtonThumbStickRight=new Ew,this._touchButtonThumbStickRight.getValue=function(){return 0}},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}},{key:"touchButtonA",get:function(){return this._touchButtonA}},{key:"touchButtonB",get:function(){return this._touchButtonB}},{key:"touchButtonX",get:function(){return this._touchButtonX}},{key:"touchButtonY",get:function(){return this._touchButtonY}},{key:"touchButtonTriggerLeft",get:function(){return this._touchButtonTriggerLeft}},{key:"touchButtonTriggerRight",get:function(){return this._touchButtonTriggerRight}},{key:"touchButtonThumbStickLeft",get:function(){return this._touchButtonThumbStickLeft}},{key:"touchButtonThumbStickRight",get:function(){return this._touchButtonThumbStickRight}}]),t}(),bw=function(){function t(){this._eventTarget=new oo,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 Tw,this._viewLeftPosition.getValue=function(){return _n.ZERO},this._viewLeftOrientation=new yw,this._viewLeftOrientation.getValue=function(){return Rn.IDENTITY},this._viewRightPosition=new Tw,this._viewRightPosition.getValue=function(){return _n.ZERO},this._viewRightOrientation=new yw,this._viewRightOrientation.getValue=function(){return Rn.IDENTITY},this._headMiddlePosition=new Tw,this._headMiddlePosition.getValue=function(){return _n.ZERO},this._headMiddleOrientation=new yw,this._headMiddleOrientation.getValue=function(){return Rn.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}(),Cw=function(){function t(){this._eventTarget=new oo,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 Tw,this._handheldPosition.getValue=function(){return _n.ZERO},this._handheldOrientation=new yw,this._handheldOrientation.getValue=function(){return Rn.IDENTITY}},n(t,[{key:"handheldPosition",get:function(){return this._handheldPosition}},{key:"handheldOrientation",get:function(){return this._handheldOrientation}}]),t}(),Rw={Backspace:iw.BACKSPACE,Tab:iw.TAB,Enter:iw.ENTER,ShiftLeft:iw.SHIFT_LEFT,ControlLeft:iw.CTRL_LEFT,AltLeft:iw.ALT_LEFT,ShiftRight:iw.SHIFT_RIGHT,ControlRight:iw.CTRL_RIGHT,AltRight:iw.ALT_RIGHT,Pause:iw.PAUSE,CapsLock:iw.CAPS_LOCK,Escape:iw.ESCAPE,Space:iw.SPACE,PageUp:iw.PAGE_UP,PageDown:iw.PAGE_DOWN,End:iw.END,Home:iw.HOME,ArrowLeft:iw.ARROW_LEFT,ArrowUp:iw.ARROW_UP,ArrowRight:iw.ARROW_RIGHT,ArrowDown:iw.ARROW_DOWN,Insert:iw.INSERT,Delete:iw.DELETE,Digit0:iw.DIGIT_0,Digit1:iw.DIGIT_1,Digit2:iw.DIGIT_2,Digit3:iw.DIGIT_3,Digit4:iw.DIGIT_4,Digit5:iw.DIGIT_5,Digit6:iw.DIGIT_6,Digit7:iw.DIGIT_7,Digit8:iw.DIGIT_8,Digit9:iw.DIGIT_9,KeyA:iw.KEY_A,KeyB:iw.KEY_B,KeyC:iw.KEY_C,KeyD:iw.KEY_D,KeyE:iw.KEY_E,KeyF:iw.KEY_F,KeyG:iw.KEY_G,KeyH:iw.KEY_H,KeyI:iw.KEY_I,KeyJ:iw.KEY_J,KeyK:iw.KEY_K,KeyL:iw.KEY_L,KeyM:iw.KEY_M,KeyN:iw.KEY_N,KeyO:iw.KEY_O,KeyP:iw.KEY_P,KeyQ:iw.KEY_Q,KeyR:iw.KEY_R,KeyS:iw.KEY_S,KeyT:iw.KEY_T,KeyU:iw.KEY_U,KeyV:iw.KEY_V,KeyW:iw.KEY_W,KeyX:iw.KEY_X,KeyY:iw.KEY_Y,KeyZ:iw.KEY_Z,Numpad0:iw.NUM_0,Numpad1:iw.NUM_1,Numpad2:iw.NUM_2,Numpad3:iw.NUM_3,Numpad4:iw.NUM_4,Numpad5:iw.NUM_5,Numpad6:iw.NUM_6,Numpad7:iw.NUM_7,Numpad8:iw.NUM_8,Numpad9:iw.NUM_9,NumpadMultiply:iw.NUM_MULTIPLY,NumpadAdd:iw.NUM_PLUS,NumpadSubtract:iw.NUM_SUBTRACT,NumpadDecimal:iw.NUM_DECIMAL,NumpadDivide:iw.NUM_DIVIDE,NumpadEnter:iw.NUM_ENTER,F1:iw.F1,F2:iw.F2,F3:iw.F3,F4:iw.F4,F5:iw.F5,F6:iw.F6,F7:iw.F7,F8:iw.F8,F9:iw.F9,F10:iw.F10,F11:iw.F11,F12:iw.F12,NumLock:iw.NUM_LOCK,ScrollLock:iw.SCROLL_LOCK,Semicolon:iw.SEMICOLON,Equal:iw.EQUAL,Comma:iw.COMMA,Minus:iw.DASH,Period:iw.PERIOD,Slash:iw.SLASH,Backquote:iw.BACK_QUOTE,BracketLeft:iw.BRACKET_LEFT,Backslash:iw.BACKSLASH,BracketRight:iw.BRACKET_RIGHT,Quote:iw.QUOTE};function ww(t){return Rw[t]||iw.NONE}var Iw,xw,Dw=function(){function t(){this._eventTarget=new oo,this._keyStateMap={},go.hasFeature(_o.EVENT_KEYBOARD)&&this._registerEvent()}var e=t.prototype;return e._registerEvent=function(){var t,e,i,n,r=this;null===(t=xs.wx)||void 0===t||null===(e=t.onKeyDown)||void 0===e||e.call(t,(function(t){var e=ww(t.code);if(r._keyStateMap[e]){var i=r._getInputEvent(t,qR.KEY_PRESSING);r._eventTarget.emit(qR.KEY_PRESSING,i)}else{var n=r._getInputEvent(t,qR.KEY_DOWN);r._eventTarget.emit(qR.KEY_DOWN,n)}r._keyStateMap[e]=!0})),null===(i=xs.wx)||void 0===i||null===(n=i.onKeyUp)||void 0===n||n.call(i,(function(t){var e=ww(t.code),i=r._getInputEvent(t,qR.KEY_UP);r._keyStateMap[e]=!1,r._eventTarget.emit(qR.KEY_UP,i)}))},e._getInputEvent=function(t,e){var i=ww(t.code);return new JR(i,e)},e.on=function(t,e,i){this._eventTarget.on(t,e,i)},t}(),Ow=function(){function t(){this._eventTarget=new oo,this._isPressed=!1,this._preMousePos=new Hn,go.hasFeature(_o.EVENT_MOUSE)&&this._registerEvent()}var e=t.prototype;return e._getLocation=function(t){var e=No.windowSize,i=No.devicePixelRatio,n=t.x*i,r=e.height-t.y*i;return new Hn(n,r)},e._registerEvent=function(){var t,e,i,n,r,s,o,a;null===(t=xs.wx)||void 0===t||null===(e=t.onMouseDown)||void 0===e||e.call(t,this._createCallback(qR.MOUSE_DOWN)),null===(i=xs.wx)||void 0===i||null===(n=i.onMouseMove)||void 0===n||n.call(i,this._createCallback(qR.MOUSE_MOVE)),null===(r=xs.wx)||void 0===r||null===(s=r.onMouseUp)||void 0===s||s.call(r,this._createCallback(qR.MOUSE_UP)),null===(o=xs.wx)||void 0===o||null===(a=o.onWheel)||void 0===a||a.call(o,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 qR.MOUSE_DOWN:e._isPressed=!0;break;case qR.MOUSE_UP:e._isPressed=!1;break;case qR.MOUSE_MOVE:e._isPressed||(r=$R.BUTTON_MISSING)}var s=new $R(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=qR.MOUSE_WHEEL,i=this._getLocation(t),n=t.button,r=new $R(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(qR.MOUSE_WHEEL,r)},e.on=function(t,e,i){this._eventTarget.on(t,e,i)},t}(),Pw=new Hn,Mw=new(function(){function t(){this._touchMap=new Map,this._maxTouches=8}var e=t.prototype;return e._createTouch=function(t,e,i){if(this._touchMap.has(t))B("Cannot create the same touch object.");else{if(!this._checkTouchMapSizeMoreThanMax(t)){var n=new aw(e,i,t);return this._touchMap.set(t,n),this._updateTouch(n,e,i),n}B("The touches is more than MAX_TOUCHES.")}},e.releaseTouch=function(t){this._touchMap.has(t)&&this._touchMap.delete(t)},e.getTouch=function(t){return this._touchMap.get(t)},e.getOrCreateTouch=function(t,e,i){var n=this.getTouch(t);return n?this._updateTouch(n,e,i):n=this._createTouch(t,e,i),n},e.getAllTouches=function(){var t=[];return this._touchMap.forEach((function(e){e&&t.push(e)})),t},e.getTouchCount=function(){return Mw._touchMap.size},e._updateTouch=function(t,e,i){t.getLocation(Pw),t.setPrevPoint(Pw),t.setPoint(e,i)},e._checkTouchMapSizeMoreThanMax=function(t){var e=this;if(this._touchMap.has(t))return!1;var i=Ie.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>Ie.TOUCH_TIMEOUT&&(B("The touches is more than MAX_TOUCHES, release touch id "+t.getID()+"."),e.releaseTouch(t.getID()))})),i>=this._touchMap.size},t}()),Nw=function(){function t(){this._eventTarget=new oo,go.hasFeature(_o.INPUT_TOUCH)&&this._registerEvent()}var e=t.prototype;return e._registerEvent=function(){xs.onTouchStart(this._createCallback(qR.TOUCH_START)),xs.onTouchMove(this._createCallback(qR.TOUCH_MOVE)),xs.onTouchEnd(this._createCallback(qR.TOUCH_END)),xs.onTouchCancel(this._createCallback(qR.TOUCH_CANCEL))},e._createCallback=function(t){var e=this;return function(i){for(var n=[],r=No.windowSize,s=No.devicePixelRatio,o=i.changedTouches.length,a=0;a<o;++a){var h=i.changedTouches[a],u=h.identifier;if(null!==u){var c=e._getLocation(h,r,s),l=Mw.getOrCreateTouch(u,c.x,c.y);l&&(t!==qR.TOUCH_END&&t!==qR.TOUCH_CANCEL||Mw.releaseTouch(u),n.push(l))}}if(n.length>0){var _=new ew(n,!1,t,Mw.getAllTouches());e._eventTarget.emit(t,_)}}},e._getLocation=function(t,e,i){var n=t.clientX*i,r=e.height-t.clientY*i;return new Hn(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"}(xw||(xw={}));var Lw=function(){function t(t){this.priority=xw.GLOBAL,this._inputEventTarget=t}var e=t.prototype;return e.onThrowException=function(){},e.dispatchEvent=function(t){return this._inputEventTarget.emit(t.type,t),!0},t}(),Bw=((Iw={})[qR.MOUSE_DOWN]=qR.TOUCH_START,Iw[qR.MOUSE_MOVE]=qR.TOUCH_MOVE,Iw[qR.MOUSE_UP]=qR.TOUCH_END,Iw),Fw=t("Input",function(){function t(){this._dispatchImmediately=!0,this._eventTarget=new oo,this._touchInput=new Nw,this._mouseInput=new Ow,this._keyboardInput=new Dw,this._accelerometerInput=new hw,this._handleInput=new Aw,this._hmdInput=new bw,this._handheldInput=new Cw,this._eventTouchList=[],this._eventMouseList=[],this._eventKeyboardList=[],this._eventAccelerationList=[],this._eventGamepadList=[],this._eventHandleList=[],this._eventHMDList=[],this._eventHandheldList=[],this._needSimulateTouchMoveEvent=!1,this._eventDispatcherList=[],this._registerEvent(),this._inputEventDispatcher=new Lw(this._eventTarget),this._registerEventDispatcher(this._inputEventDispatcher),Sw._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.getTouch=function(t){return Mw.getTouch(t)},e.getAllTouches=function(){return Mw.getAllTouches()},e.getTouchCount=function(){return Mw.getTouchCount()},e.setAccelerometerEnabled=function(t){t?this._accelerometerInput.start():this._accelerometerInput.stop()},e.setAccelerometerInterval=function(t){this._accelerometerInput.setInterval(t)},e._simulateEventTouch=function(t){var e=Bw[t.type],i=Mw.getOrCreateTouch(0,t.getLocationX(),t.getLocationY());if(i){var n=[i],r=new ew(n,!1,e,e===qR.TOUCH_END?[]:n);r.windowId=t.windowId,e===qR.TOUCH_END&&Mw.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(t){throw this._clearEvents(),n.onThrowException(),t}}},e._registerEvent=function(){var t=this;if(Fo.hasFeature(Fo.Feature.INPUT_TOUCH)){var e=this._eventTouchList;this._touchInput.on(qR.TOUCH_START,(function(i){t._dispatchOrPushEventTouch(i,e)})),this._touchInput.on(qR.TOUCH_MOVE,(function(i){t._dispatchOrPushEventTouch(i,e)})),this._touchInput.on(qR.TOUCH_END,(function(i){t._dispatchOrPushEventTouch(i,e)})),this._touchInput.on(qR.TOUCH_CANCEL,(function(i){t._dispatchOrPushEventTouch(i,e)}))}if(Fo.hasFeature(Fo.Feature.EVENT_MOUSE)){var i=this._eventMouseList;this._mouseInput.on(qR.MOUSE_DOWN,(function(e){t._needSimulateTouchMoveEvent=!0,t._simulateEventTouch(e),t._dispatchOrPushEvent(e,i)})),this._mouseInput.on(qR.MOUSE_MOVE,(function(e){t._needSimulateTouchMoveEvent&&t._simulateEventTouch(e),t._dispatchOrPushEvent(e,i)})),this._mouseInput.on(qR.MOUSE_UP,(function(e){t._needSimulateTouchMoveEvent=!1,t._simulateEventTouch(e),t._dispatchOrPushEvent(e,i)})),this._mouseInput.on(qR.MOUSE_WHEEL,(function(e){t._dispatchOrPushEvent(e,i)})),this._mouseInput.on(qR.MOUSE_LEAVE,(function(e){t._dispatchOrPushEvent(e,i)})),this._mouseInput.on(qR.MOUSE_ENTER,(function(e){t._dispatchOrPushEvent(e,i)}))}if(Fo.hasFeature(Fo.Feature.EVENT_KEYBOARD)){var n=this._eventKeyboardList;this._keyboardInput.on(qR.KEY_DOWN,(function(e){t._dispatchOrPushEvent(e,n)})),this._keyboardInput.on(qR.KEY_PRESSING,(function(e){t._dispatchOrPushEvent(e,n)})),this._keyboardInput.on(qR.KEY_UP,(function(e){t._dispatchOrPushEvent(e,n)}))}if(Fo.hasFeature(Fo.Feature.EVENT_ACCELEROMETER)){var r=this._eventAccelerationList;this._accelerometerInput.on(qR.DEVICEMOTION,(function(e){t._dispatchOrPushEvent(e,r)}))}if(Fo.hasFeature(Fo.Feature.EVENT_GAMEPAD)){var s=this._eventGamepadList;Sw._on(qR.GAMEPAD_CHANGE,(function(e){t._dispatchOrPushEvent(e,s)})),Sw._on(qR.GAMEPAD_INPUT,(function(e){t._dispatchOrPushEvent(e,s)})),Sw._on(qR.HANDLE_POSE_INPUT,(function(e){t._dispatchOrPushEvent(e,s)}))}if(Fo.hasFeature(Fo.Feature.EVENT_HANDLE)){var o=this._eventHandleList;this._handleInput._on(qR.HANDLE_INPUT,(function(e){t._dispatchOrPushEvent(e,o)})),this._handleInput._on(qR.HANDLE_POSE_INPUT,(function(e){t._dispatchOrPushEvent(e,o)}))}if(Fo.hasFeature(Fo.Feature.EVENT_HMD)){var a=this._eventHMDList;this._hmdInput._on(qR.HMD_POSE_INPUT,(function(e){t._dispatchOrPushEvent(e,a)}))}if(Fo.hasFeature(Fo.Feature.EVENT_HANDHELD)){var h=this._eventHandheldList;this._handheldInput._on(qR.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,o=r.length;s<o;++s){var a=r[s];this._emitEvent(a)}for(var h=this._eventMouseList,u=0,c=h.length;u<c;++u){var l=h[u];this._emitEvent(l)}for(var _=this._eventTouchList,d=0,f=_.length;d<f;++d)for(var p=_[d],g=p.getTouches(),m=g.length,v=0;v<m;++v)p.touch=g[v],p.propagationStopped=p.propagationImmediateStopped=!1,this._emitEvent(p);for(var y=this._eventKeyboardList,T=0,E=y.length;T<E;++T){var S=y[T];this._emitEvent(S)}for(var A=this._eventAccelerationList,b=0,C=A.length;b<C;++b){var R=A[b];this._emitEvent(R)}for(var w=this._eventGamepadList,I=0,x=w.length;I<x;++I){var D=w[I];this._emitEvent(D)}for(var O=this._eventHandleList,P=0,M=O.length;P<M;++P){var N=O[P];this._emitEvent(N)}this._clearEvents()},t}());Fw.EventType=qR;var kw=t("input",new Fw),Uw=t("SystemEvent",function(t){function e(){var e;return e=t.call(this)||this,kw.on(qR.MOUSE_DOWN,(function(t){e.emit(KR.MOUSE_DOWN,t)})),kw.on(qR.MOUSE_MOVE,(function(t){e.emit(KR.MOUSE_MOVE,t)})),kw.on(qR.MOUSE_UP,(function(t){e.emit(KR.MOUSE_UP,t)})),kw.on(qR.MOUSE_WHEEL,(function(t){e.emit(KR.MOUSE_WHEEL,t)})),kw.on(qR.TOUCH_START,(function(t){e.emit(KR.TOUCH_START,t.touch,t)})),kw.on(qR.TOUCH_MOVE,(function(t){e.emit(KR.TOUCH_MOVE,t.touch,t)})),kw.on(qR.TOUCH_END,(function(t){e.emit(KR.TOUCH_END,t.touch,t)})),kw.on(qR.TOUCH_CANCEL,(function(t){e.emit(KR.TOUCH_CANCEL,t.touch,t)})),kw.on(qR.KEY_DOWN,(function(t){e.emit(KR.KEY_DOWN,t)})),kw.on(qR.KEY_PRESSING,(function(t){e.emit(KR.KEY_DOWN,t)})),kw.on(qR.KEY_UP,(function(t){e.emit(KR.KEY_UP,t)})),kw.on(qR.DEVICEMOTION,(function(t){e.emit(KR.DEVICEMOTION,t)})),e}s(e,t);var i=e.prototype;return i.setAccelerometerEnabled=function(t){kw.setAccelerometerEnabled(t)},i.setAccelerometerInterval=function(t){kw.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}(oo));Uw.EventType=KR,m.SystemEvent=Uw;var Gw=t("systemEvent",new Uw);m.systemEvent=Gw,rt(KR,"Node.EventType",[{name:"POSITION_PART",newName:"TRANSFORM_CHANGED"},{name:"ROTATION_PART",newName:"TRANSFORM_CHANGED"},{name:"SCALE_PART",newName:"TRANSFORM_CHANGED"}]),rt(QR,"Event",[{name:"ACCELERATION",newName:"DEVICEMOTION",target:Uw.EventType,targetName:"SystemEvent.EventType"}]),ot(QR,"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"}]),rt($R,"EventMouse",["DOWN","UP","MOVE"].map((function(t){return{name:t,newName:"MOUSE_"+t,target:Uw.EventType,targetName:"SystemEvent.EventType"}}))),rt($R,"EventMouse",[{name:"SCROLL",newName:"MOUSE_WHEEL",target:Uw.EventType,targetName:"SystemEvent.EventType"}]),ot($R.prototype,"EventMouse.prototype",[{name:"eventType",suggest:"please use EventMouse.prototype.type instead"}]),rt(ew,"EventTouch",[{name:"BEGAN",newName:"TOUCH_START",target:Uw.EventType,targetName:"SystemEvent.EventType"}]),rt(ew,"EventTouch",[{name:"MOVED",newName:"TOUCH_MOVE",target:Uw.EventType,targetName:"SystemEvent.EventType"}]),rt(ew,"EventTouch",[{name:"ENDED",newName:"TOUCH_END",target:Uw.EventType,targetName:"SystemEvent.EventType"}]),rt(ew,"EventTouch",[{name:"CANCELLED",newName:"TOUCH_CANCEL",target:Uw.EventType,targetName:"SystemEvent.EventType"}]),ot(ew.prototype,"EventTouch.prototype",[{name:"getEventCode",suggest:"please use EventTouch.prototype.type instead"}]),rt(ew.prototype,"EventTouch.prototype",[{name:"getUILocationInView",newName:"getLocationInView",target:ew,targetName:"EventTouch"}]),ot(Ie.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}}))),ot(Ie.KEY,"macro.KEY",[{name:"shift",suggest:"please use KeyCode.SHIFT_LEFT instead"}]),ot(Ie.KEY,"macro.KEY",[{name:"ctrl",suggest:"please use KeyCode.CTRL_LEFT instead"}]),ot(Ie.KEY,"macro.KEY",[{name:"alt",suggest:"please use KeyCode.ALT_LEFT instead"}]),ot(Ie,"macro",[{name:"KEY",suggest:"please use KeyCode instead"}]);var Hw,zw,Vw,Ww,Xw,jw,Yw,Kw,qw=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=m.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()}},{key:"debugViewType",get:function(){return this._getType()}}]),t}());!function(t){t[t.VERTICAL=0]="VERTICAL",t[t.HORIZONTAL=1]="HORIZONTAL"}(Hw||(Hw={})),function(t){t[t.ORTHO=0]="ORTHO",t[t.PERSPECTIVE=1]="PERSPECTIVE"}(zw||(zw={})),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"}(Vw||(Vw={})),function(t){t[t.ISO100=0]="ISO100",t[t.ISO200=1]="ISO200",t[t.ISO400=2]="ISO400",t[t.ISO800=3]="ISO800"}(Ww||(Ww={})),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"}(Xw||(Xw={})),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"}(jw||(jw={})),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"}(Yw||(Yw={})),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"}(Kw||(Kw={}));var Qw,Zw=[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],Jw=[1,.5,1/4,1/8,1/15,1/30,1/60,.008,.004,.002,.001,5e-4,1/4e3],$w=[100,200,400,800],tI=new _n,eI=new _n,iI=new Ln,nI=Zl.STENCIL<<1,rI=[],sI=function(){function t(t){if(this.isWindowSize=!0,this.screenScale=1,this.postProcess=null,this.usePostProcess=!1,this.pipeline="",this.pipelineSettings=null,this._scene=null,this._node=null,this._name=null,this._enabled=!1,this._proj=-1,this._aspect=1,this._orthoHeight=10,this._fovAxis=Hw.VERTICAL,this._fov=Li(45),this._nearClip=1,this._farClip=1e3,this._clearColor=new f_(.2,.2,.2,1),this._viewport=new Yn(0,0,1,1),this._orientedViewport=new Yn(0,0,1,1),this._curTransform=dl.IDENTITY,this._isProjDirty=!0,this._matView=new Ln,this._matProj=new Ln,this._matProjInv=new Ln,this._matViewProj=new Ln,this._matViewProjInv=new Ln,this._frustum=new Jo,this._forward=new _n,this._position=new _n,this._priority=0,this._aperture=Vw.F16_0,this._shutter=Xw.D125,this._shutterValue=0,this._iso=Ww.ISO100,this._isoValue=0,this._window=null,this._width=1,this._height=1,this._clearFlag=Zl.NONE,this._clearDepth=1,this._visibility=my,this._exposure=0,this._clearStencil=0,this._geometryRenderer=null,this._windowId=0,this._cameraType=jw.DEFAULT,this._trackingType=Yw.NO_TRACKING,this._usage=Kw.GAME,this._device=t,this._apertureValue=Zw[this._aperture],this._shutterValue=Jw[this._shutter],this._isoValue=$w[this._iso],this._frustum.accurate=!0,!rI.length){var e=t.capabilities.clipSpaceSignY;rI[dl.IDENTITY]=new Ln(1,0,0,0,0,e),rI[dl.ROTATE_90]=new Ln(0,1,0,0,-e,0),rI[dl.ROTATE_180]=new Ln(-1,0,0,0,0,-e),rI[dl.ROTATE_270]=new Ln(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||dl.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=Zl.NONE,this.clearDepth=1,this.visibility=my,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 Yn(r*s,0,r,1))}(this._node.hasChangedFlags||t)&&(Ln.invert(this._matView,this._node.worldMatrix),this._forward.x=-this._matView.m02,this._forward.y=-this._matView.m06,this._forward.z=-this._matView.m10,Ln.multiply(this._matView,(new Ln).scale(this._node.worldScale),this._matView),this._node.getWorldPosition(this._position),i=!0);var o=null===(e=this.window)||void 0===e?void 0:e.swapchain,a=o&&o.surfaceTransform||dl.IDENTITY;if(this._isProjDirty||this._curTransform!==a){this._curTransform=a;var h=this._device.capabilities.clipSpaceSignY;if(this._proj===zw.PERSPECTIVE)if(n&&n.isWebXR&&n.webXRWindowMap&&n.webXRMatProjs){var u=n.webXRWindowMap.get(this._window);this._matProj.set(n.webXRMatProjs[u])}else Ln.perspective(this._matProj,this._fov,this._aspect,this._nearClip,this._farClip,this._fovAxis===Hw.VERTICAL,this._device.capabilities.clipSpaceMinZ,h,a);else{var c=this._orthoHeight*this._aspect,l=this._orthoHeight;Ln.ortho(this._matProj,-c,c,-l,l,this._nearClip,this._farClip,this._device.capabilities.clipSpaceMinZ,h,a)}Ln.invert(this._matProjInv,this._matProj),i=!0,this._isProjDirty=!1}i&&(Ln.multiply(this._matViewProj,this._matProj,this._matView),Ln.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,o=null===(e=this.window)||void 0===e?void 0:e.swapchain;switch(o&&o.surfaceTransform||dl.IDENTITY){case dl.ROTATE_90:this._viewport.x=1-s-r,this._viewport.y=i,this._viewport.width=r,this._viewport.height=n;break;case dl.ROTATE_180:this._viewport.x=1-i-n,this._viewport.y=1-s-r,this._viewport.width=n,this._viewport.height=r;break;case dl.ROTATE_270:this._viewport.x=s,this._viewport.y=1-i-n,this._viewport.width=r,this._viewport.height=n;break;case dl.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=m.internal.GeometryRenderer?new m.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||m.director.root.mainWindow;if(e){e.attachCamera(this),this.window=e;var i=e.swapchain;(i&&i.surfaceTransform||dl.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,o=this._orientedViewport.y*r,a=this._orientedViewport.width*n,h=this._orientedViewport.height*r,u=this._proj===zw.PERSPECTIVE,c=this._device.capabilities.clipSpaceSignY,l=Nn[this._curTransform];_n.set(tI,(e-s)/a*2-1,(i-o)/h*2-1,u?1:-1);var _=tI.x,d=tI.y;return tI.x=_*l[0]+d*l[2]*c,tI.y=_*l[1]+d*l[3]*c,_n.transformMat4(u?tI:t.o,tI,this._matViewProjInv),u?(this._node.getWorldPosition(eI),_r.fromPoints(t,eI,tI)):_n.transformQuat(t.d,_n.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,o=this._orientedViewport.width*i,a=this._orientedViewport.height*n,h=this._device.capabilities.clipSpaceSignY,u=Nn[this._curTransform];if(this._proj===zw.PERSPECTIVE){_n.set(t,(e.x-r)/o*2-1,(e.y-s)/a*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,_n.transformMat4(t,t,this._matViewProjInv),this._node&&this._node.getWorldPosition(tI),_n.lerp(t,tI,t,Ni(this._nearClip/this._farClip,1,e.z))}else{_n.set(t,(e.x-r)/o*2-1,(e.y-s)/a*2-1,2*e.z-1);var _=t.x,d=t.y;t.x=_*u[0]+d*u[2]*h,t.y=_*u[1]+d*u[3]*h,_n.transformMat4(t,t,this._matViewProjInv)}return t},e.worldToScreen=function(t,e){var i=this._device.capabilities.clipSpaceSignY,n=Nn[this._curTransform];_n.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 o=this.width,a=this.height,h=this._orientedViewport.x*o,u=this._orientedViewport.y*a,c=this._orientedViewport.width*o,l=this._orientedViewport.height*a;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){Ln.multiply(t,this._matViewProj,e),Ln.multiply(t,rI[this._curTransform],t);var r=i/2,s=n/2;return Ln.identity(iI),Ln.transform(iI,iI,_n.set(tI,r,s,0)),Ln.scale(iI,iI,_n.set(tI,r,s,1)),Ln.multiply(t,iI,t),t},e.calculateObliqueMat=function(t){var e=new on(Math.sign(t.x),Math.sign(t.y),1,1).transformMat4(this._matProjInv),i=new on(this._matProj.m03,this._matProj.m07,this._matProj.m11,this._matProj.m15),n=2/on.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=Kw.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=Zw[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=Jw[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=$w[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){q(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}(),oI=new q_(null),aI=function(){function t(){this._device=null,this._passes=null,this._shaders=null,this._subMesh=null,this._patches=null,this._priority=km.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=m.director.root;this._device=Qd.gfxDevice,oI.layout=e[0].localSetLayout,this._inputAssembler=this._device.createInputAssembler(t.iaInfo),this._descriptorSet=this._device.createDescriptorSet(oI);var r=m.director.root.pipeline.pipelineSceneData.getOcclusionQueryPass();if(r){var s=new q_(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=km.DEFAULT;var o=m.rendering;if((!o||!o.enableEffectImport)&&e[0].phase===LE("reflection")||Ay()&&e[0].phaseID===o.getPhaseID(o.getPassID("default"),"reflection")){var a=n.mainWindow.width,h=n.mainWindow.height,u=512;h<a?(a=u*a/h,h=u):h=u*h/(a=u),this._reflectionTex=this._device.createTexture(new A_(Sl.TEX2D,Al.STORAGE|Al.TRANSFER_SRC|Al.SAMPLED,pl.RGBA8,a,h)),this.descriptorSet.bindTexture(qv,this._reflectionTex),this._reflectionSampler=this._device.getSampler(new C_(Il.LINEAR,Il.LINEAR,Il.NONE,xl.CLAMP,xl.CLAMP,xl.CLAMP)),this.descriptorSet.bindSampler(qv,this._reflectionSampler),this.descriptorSet.bindTexture(Jv,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=km.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=(wv.SH_QUADRATIC_R_OFFSET-wv.SH_LINEAR_CONST_R_OFFSET)/4,r=0,s=e;s<e+n;s++)for(var o=0;o<4;o++)i[s][o]=t[r++]},e.UpdateInstancedAttributes=function(t){this.instancedWorldMatrixIndex=-1,this.instancedSHIndex=-1;var e=this.passes[0];if(e.device.hasFeature(fl.INSTANCED_ARRAYS)){for(var i=0,n=0;n<t.length;n++){var r=t[n];r.isInstanced&&(i+=od[r.format].size)}var s=this.instancedAttributeBlock;s.buffer=new Uint8Array(i),s.views.length=s.attributes.length=0;for(var o=0,a=0;a<t.length;a++){var h=t[a];if(h.isInstanced){var u=new L_;u.format=h.format,u.name=h.name,u.isNormalized=h.isNormalized,u.location=h.location,s.attributes.push(u);var c=od[h.format],l=new(pd(c))(s.buffer.buffer,o,c.count);s.views.push(l),o+=c.size}}e.batchingScheme===PE.INSTANCING&&e.getInstancedBuffer().destroy(),this.instancedWorldMatrixIndex=this.getInstancedAttributeIndex(pv),this.instancedSHIndex=this.getInstancedAttributeIndex(gv)}},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?Z(12004,8):(this._passes=t,this._flushPassInfo(),this._descriptorSet&&(this._descriptorSet.destroy(),oI.layout=t[0].localSetLayout,this._descriptorSet=this._device.createDescriptorSet(oI)))}},{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}(),hI=new k_;hI.format=pl.RGBA8;var uI=new U_;uI.format=pl.DEPTH_STENCIL;var cI,lI,_I=new z_([hI],uI),dI={width:1,height:1,renderPassInfo:_I},fI=t("RenderTexture",va("cc.RenderTexture")(Qw=function(t){function e(){var e;return(e=t.call(this)||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=m.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(Pi(t,1,2048)),this._height=Math.floor(Pi(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=m.director.root;dI.title=this._name,dI.width=this._width,dI.height=this._height,dI.renderPassInfo=t&&t.passInfo?t.passInfo:_I,dI.externalResLow=t&&t.externalResLow?t.externalResLow:0,dI.externalResHigh=t&&t.externalResHigh?t.externalResHigh:0,dI.externalFlag=t&&t.externalFlag?t.externalFlag:bl.NONE,dI.renderPassInfo.colorAttachments.forEach((function(t){t.format=e.device.swapchainFormat})),hI.barrier=Qd.gfxDevice.getGeneralBarrier(new V_(kl.FRAGMENT_SHADER_READ_TEXTURE,kl.FRAGMENT_SHADER_READ_TEXTURE)),this._window?(this._window.destroy(),this._window.initialize(Qd.gfxDevice,dI)):this._window=e.createWindow(dI)},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){t=t||0,e=e||0,i=i||this.width,n=n||this.height;var s=this.getGFXTexture();if(!s)return Z(7606),null;var o=4*i*n;if(void 0===r)r=new Uint8Array(o);else if(r.length<o)return Z(7607,o),null;var a=this._getGFXDevice(),h=[],u=[],c=new __;return c.texOffset.x=t,c.texOffset.y=e,c.texExtent.width=i,c.texExtent.height=n,u.push(c),h.push(r),null==a||a.copyTextureToBuffers(s,h,u),r},n(e,[{key:"window",get:function(){return this._window}}]),e}(rp))||Qw);m.RenderTexture=fI,function(t){t[t.SKYBOX=nI|Zl.DEPTH_STENCIL]="SKYBOX",t[t.SOLID_COLOR=Zl.ALL]="SOLID_COLOR"}(cI||(cI={})),function(t){t[t.CUBE=0]="CUBE",t[t.PLANAR=1]="PLANAR"}(lI||(lI={}));var pI,gI=[new _n(0,-90,0),new _n(0,90,0),new _n(90,0,0),new _n(-90,0,0),new _n(0,0,0),new _n(0,180,0)],mI=function(){function t(t){this.bakedCubeTextures=[],this.realtimePlanarTexture=null,this._resolution=256,this._clearFlag=cI.SKYBOX,this._backgroundColor=new yn(0,0,0,255),this._visibility=my,this._probeType=lI.CUBE,this._cubemap=null,this._size=new _n(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 _n,this._cameraWorldRotation=new Rn,this._forward=new _n,this._up=new _n,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=Xo.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=m.view.getDesignResolutionSize();this.realtimePlanarTexture=this._createTargetTexture(e.width,e.height),m.internal.reflectionProbeManager.updatePlanarMap(this,this.realtimePlanarTexture.getGFXTexture())}this._syncCameraParams(t),this._transformReflectionCamera(t),this._needRender=!0}},e.switchProbeType=function(t,e){t===lI.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===lI.PLANAR?new Hn(this.realtimePlanarTexture.width,this.realtimePlanarTexture.height):new Hn(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(gI[t]),this.camera.update(!0)},e.updateBoundingBox=function(){if(this.node){var t=this.node.getWorldPosition();Xo.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===lI.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.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){var e=m.director.root;if(!this._camera){if(this._camera=e.createCamera(),!this._camera)return null;this._camera.initialize({name:t.name,node:t,projection:zw.PERSPECTIVE,window:e&&e.tempWindow,priority:0,cameraType:jw.DEFAULT,trackingType:Yw.NO_TRACKING})}return this._camera.setViewportInOrientedSpace(new Yn(0,0,1,1)),this._camera.fovAxis=Hw.VERTICAL,this._camera.fov=Li(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=Vw.F16_0,this._camera.shutter=Xw.D125,this._camera.iso=Ww.ISO100,this._camera},e._resetCameraParams=function(){this.camera.projectionType=zw.PERSPECTIVE,this.camera.orthoHeight=10,this.camera.nearClip=1,this.camera.farClip=1e3,this.camera.fov=Li(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 fI;return i.reset({width:t,height:e}),i},e._transformReflectionCamera=function(t){var e=_n.dot(this.node.worldPosition,this.node.up);this._reflect(this._cameraWorldPos,t.node.worldPosition,this.node.up,e),this.cameraNode.worldPosition=this._cameraWorldPos,_n.transformQuat(this._forward,_n.FORWARD,t.node.worldRotation),this._reflect(this._forward,this._forward,this.node.up,0),this._forward.normalize(),this._forward.negative(),_n.transformQuat(this._up,_n.UP,t.node.worldRotation),this._reflect(this._up,this._up,this.node.up,0),this._up.normalize(),Rn.fromViewUp(this._cameraWorldRotation,this._forward,this._up),this.cameraNode.worldRotation=this._cameraWorldRotation,this.camera.update(!0);var i=new on(this.node.up.x,this.node.up.y,this.node.up.z,-_n.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=_n.clone(i);r.normalize();var s=_n.dot(r,e)-n;return r.multiplyScalar(2*s),_n.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();Xo.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}();t("ReflectionProbeType",pI),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"}(pI||t("ReflectionProbeType",pI={}));var vI,yI=new Ln,TI=[{name:"CC_RECEIVE_SHADOW",value:!0}],EI=[{name:"CC_USE_LIGHTMAP",value:1}],SI=[{name:"CC_USE_LIGHTMAP",value:2}],AI=[{name:"CC_LIGHT_MAP_VERSION",value:2}],bI=[{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"}(vI||(vI={}));var CI,RI=new C_(Il.LINEAR,Il.LINEAR,Il.NONE,xl.CLAMP,xl.CLAMP,xl.CLAMP),wI=new C_(Il.LINEAR,Il.LINEAR,Il.LINEAR,xl.CLAMP,xl.CLAMP,xl.CLAMP),II=function(){function t(){this.type=vI.DEFAULT,this.scene=null,this.isDynamicBatching=!1,this._worldBounds=null,this._modelBounds=null,this._subModels=[],this._node=null,this._transform=null,this._inited=!1,this._descriptorSetCount=1,this._updateStamp=-1,this._localDataUpdated=!0,this._localData=new Float32Array(dv.COUNT),this._localBuffer=null,this._localSHData=null,this._localSHBuffer=null,this._lightmap=null,this._lightmapUVParam=new on,this._tetrahedronIndex=-1,this._lastWorldBoundCenter=new _n(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=Rg.Enum.NONE,this._priority=0,this._bakeToReflectionProbe=!0,this._reflectionProbeType=pI.NONE,this._device=Qd.gfxDevice}var e=t.prototype;return e.initialize=function(){this._inited||(this._receiveShadow=!0,this.castShadow=!1,this.enabled=!0,this.visFlags=Rg.Enum.NONE,this._inited=!0,this._bakeToReflectionProbe=!0,this._reflectionProbeType=pI.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===eS.Planar;if(this._localDataUpdated){this._localDataUpdated=!1;for(var r=this.transform._mat,s=!1,o=0;o<e.length;o++){var a=e[o],h=a.instancedWorldMatrixIndex;h>=0?a.updateInstancedWorldMatrix(r,h):s=!0}(s||n)&&this._localBuffer&&(Ln.toArray(this._localData,r,dv.MAT_WORLD_OFFSET),Ln.invert(yI,r),Ln.transpose(yI,yI),Ln.toArray(this._localData,yI,dv.MAT_WORLD_IT_OFFSET),this._localBuffer.update(this._localData))}},e.invalidateLocalData=function(){this._localDataUpdated=!0},e.showTetrahedron=function(){return this.isLightProbeAvailable()},e.isLightProbeAvailable=function(){if(!this._useLightProbe)return!1;var t=m.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<wv.COUNT;t++)this._localSHData[t]=0;this.updateSHBuffer()}},e.updateSHUBOs=function(){if(this.isLightProbeAvailable()){var t=this._worldBounds.center;if(!t.equals(this._lastWorldBoundCenter,xi)){var e=[],i=new on(0,0,0,0),n=m.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&&(m.internal.SH.reduceRinging(e,n.reduceRinging),m.internal.SH.updateUBOData(this._localSHData,wv.SH_LINEAR_CONST_R_OFFSET,e),this.updateSHBuffer())}}},e.createBoundingShape=function(t,e){t&&e&&(this._modelBounds||(this._modelBounds=Xo.create()),this._worldBounds||(this._worldBounds=Xo.create()),Xo.fromPoints(this._modelBounds,t,e),this._worldBounds.copy(this._modelBounds))},e._createSubModel=function(){return new aI},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){on.toArray(this._localData,e,dv.LIGHTINGMAP_UVPARAM),this._localDataUpdated=!0,this._lightmap=t,this._lightmapUVParam=e,this.onMacroPatchesStateChanged(),t||(t=NE.get("empty-texture"));var i=t.getGFXTexture();if(i)for(var n=this._device.getSampler(t.mipmaps.length>1?wI:RI),r=this._subModels,s=0;s<r.length;s++){var o=r[s].descriptorSet;o.bindTexture(Vv,i),o.bindSampler(Vv,n),o.update()}},e.updateReflectionProbeCubemap=function(t){this._localDataUpdated=!0,this.onMacroPatchesStateChanged(),t||(t=NE.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(ey,i),s.bindTexture(ey,e),s.update())}},e.updateReflectionProbeBlendCubemap=function(t){this._localDataUpdated=!0,this.onMacroPatchesStateChanged(),t||(t=NE.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(cy,i),s.bindTexture(cy,e),s.update())}},e.updateReflectionProbePlanarMap=function(t){this._localDataUpdated=!0,this.onMacroPatchesStateChanged();var e=this._device.getSampler(new C_(Il.LINEAR,Il.LINEAR,Il.NONE,xl.CLAMP,xl.CLAMP,xl.CLAMP));if(t||(t=NE.get("empty-texture").getGFXTexture()),t)for(var i=this._subModels,n=0;n<i.length;n++){var r=i[n].descriptorSet;r&&(r.bindTexture(ry,t),r.bindSampler(ry,e),r.update())}},e.updateReflectionProbeDataMap=function(t){this._localDataUpdated=!0,this.onMacroPatchesStateChanged(),t||(t=NE.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(ay,e),r.bindSampler(ay,t.getGFXSampler()),r.update())}},e.updateLocalShadowBias=function(){var t=this._localData;t[dv.LOCAL_SHADOW_BIAS+0]=this._shadowBias,t[dv.LOCAL_SHADOW_BIAS+1]=this._shadowNormalBias,this._localDataUpdated=!0},e.updateReflectionProbeId=function(){var t=this._localData;t[dv.LOCAL_SHADOW_BIAS+2]=this._reflectionProbeId,t[dv.LOCAL_SHADOW_BIAS+3]=this._reflectionProbeBlendId;var e=null,i=null;if(m.internal.reflectionProbeManager&&(e=m.internal.reflectionProbeManager.getProbeById(this._reflectionProbeId),i=m.internal.reflectionProbeManager.getProbeById(this._reflectionProbeBlendId)),e){if(e.probeType===lI.PLANAR)t[dv.REFLECTION_PROBE_DATA1]=e.node.up.x,t[dv.REFLECTION_PROBE_DATA1+1]=e.node.up.y,t[dv.REFLECTION_PROBE_DATA1+2]=e.node.up.z,t[dv.REFLECTION_PROBE_DATA1+3]=1,t[dv.REFLECTION_PROBE_DATA2]=1,t[dv.REFLECTION_PROBE_DATA2+1]=0,t[dv.REFLECTION_PROBE_DATA2+2]=0,t[dv.REFLECTION_PROBE_DATA2+3]=1;else{t[dv.REFLECTION_PROBE_DATA1]=e.node.worldPosition.x,t[dv.REFLECTION_PROBE_DATA1+1]=e.node.worldPosition.y,t[dv.REFLECTION_PROBE_DATA1+2]=e.node.worldPosition.z,t[dv.REFLECTION_PROBE_DATA1+3]=0,t[dv.REFLECTION_PROBE_DATA2]=e.size.x,t[dv.REFLECTION_PROBE_DATA2+1]=e.size.y,t[dv.REFLECTION_PROBE_DATA2+2]=e.size.z;var n=e.isRGBE()?1e3:0;t[dv.REFLECTION_PROBE_DATA2+3]=e.cubemap?e.cubemap.mipmapLevel+n:1+n}if(this._reflectionProbeType===pI.BLEND_PROBES||this._reflectionProbeType===pI.BLEND_PROBES_AND_SKYBOX)if(i){t[dv.REFLECTION_PROBE_BLEND_DATA1]=i.node.worldPosition.x,t[dv.REFLECTION_PROBE_BLEND_DATA1+1]=i.node.worldPosition.y,t[dv.REFLECTION_PROBE_BLEND_DATA1+2]=i.node.worldPosition.z,t[dv.REFLECTION_PROBE_BLEND_DATA1+3]=this.reflectionProbeBlendWeight,t[dv.REFLECTION_PROBE_BLEND_DATA2]=i.size.x,t[dv.REFLECTION_PROBE_BLEND_DATA2+1]=i.size.y,t[dv.REFLECTION_PROBE_BLEND_DATA2+2]=i.size.z;var r=i.isRGBE()?1e3:0;t[dv.REFLECTION_PROBE_BLEND_DATA2+3]=i.cubemap?i.cubemap.mipmapLevel+r:1+r}else this._reflectionProbeType===pI.BLEND_PROBES_AND_SKYBOX&&(t[dv.REFLECTION_PROBE_BLEND_DATA1+3]=this.reflectionProbeBlendWeight)}this._localDataUpdated=!0},e.getMacroPatches=function(){var t=this.receiveShadow?TI:null;if(null!=this._lightmap&&this.node&&this.node.scene&&!this.node.scene.globals.disableLightmap){var e=this.node.scene.globals.bakedWithStationaryMainLight?SI:EI;t=t?t.concat(e):e,this.node.scene.globals.bakedWithHighpLightmap&&(t=t.concat(AI))}this._useLightProbe&&(t=t?t.concat(bI):bI);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=d(e.passes);!(i=s()).done;)for(var o,a=d(i.value.getShaderVariant(e.patches).attributes);!(o=a()).done;){var h=o.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 v_(vl.UNIFORM|vl.TRANSFER_DST,El.DEVICE,dv.SIZE,dv.SIZE)))},e._initLocalSHDescriptors=function(){this._useLightProbe&&(this._localSHData||(this._localSHData=new Float32Array(wv.COUNT)),this._localSHBuffer||(this._localSHBuffer=this._device.createBuffer(new v_(vl.UNIFORM|vl.TRANSFER_DST,El.DEVICE,wv.SIZE,wv.SIZE))))},e._initWorldBoundDescriptors=function(){this._worldBoundBuffer||(this._worldBoundBuffer=this._device.createBuffer(new v_(vl.UNIFORM|vl.TRANSFER_DST,El.DEVICE,fv.SIZE,fv.SIZE)))},e._updateLocalDescriptors=function(t,e){this._localBuffer&&e.bindBuffer(dv.BINDING,this._localBuffer)},e._updateLocalSHDescriptors=function(t,e){this._localSHBuffer&&e.bindBuffer(wv.BINDING,this._localSHBuffer)},e._updateWorldBoundDescriptors=function(t,e){this._worldBoundBuffer&&e.bindBuffer(fv.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}(),xI=function(){function t(){this._enabled=!1,this._minPos=new _n(0,0,0),this._maxPos=new _n(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}(),DI=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 OI(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,o=3*n/s,a=2*r/s,h=1/a*o,u=1/a*(1-o-a);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"}(CI||(CI={}));var PI,MI,NI=function(t){return 4*Math.PI*Math.PI*t*t},LI=function(){function t(){this._baked=!1,this._color=new _n(1,1,1),this._colorTemp=6550,this._colorTempRGB=new _n(1,1,1),this._finalColor=new _n(1,1,1),this._scene=null,this._node=null,this._name=null,this._useColorTemperature=!1,this._type=CI.UNKNOWN,this._visibility=my}var e=t.prototype;return e.initialize=function(){this.color=new _n(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&&_n.multiply(this._finalColor,this._color,this._colorTempRGB)}},{key:"useColorTemperature",get:function(){return this._useColorTemperature},set:function(t){this._useColorTemperature=t,t&&_n.multiply(this._finalColor,this._color,this._colorTempRGB)}},{key:"colorTemperature",get:function(){return this._colorTemp},set:function(t){this._colorTemp=t,OI(this._colorTempRGB,this._colorTemp),this._useColorTemperature&&_n.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|=Ig.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}(),BI=new _n(0,0,-1),FI=new _n,kI=function(t){function e(){var e;return(e=t.call(this)||this)._dir=new _n(1,-1,-1),e._illuminanceHDR=Um.SUN_ILLUM,e._illuminanceLDR=1,e._shadowEnabled=!1,e._shadowPcf=iS.HARD,e._shadowBias=1e-5,e._shadowNormalBias=0,e._shadowSaturation=1,e._shadowDistance=50,e._shadowInvisibleOcclusionRange=200,e._csmLevel=nS.LEVEL_4,e._csmNeedUpdate=!1,e._csmLayerLambda=.75,e._csmOptimizationMode=rS.DisableRotationFix,e._csmLayersTransition=!1,e._csmTransitionRange=.05,e._shadowFixedArea=!1,e._shadowNear=.1,e._shadowFar=10,e._shadowOrthoSize=5,e._type=CI.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 _n(1,-1,-1)},i.update=function(){this._node&&this._node.hasChangedFlags&&(this.direction=_n.transformQuat(FI,BI,this._node.worldRotation))},i.activate=function(){var t=m.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){_n.normalize(this._dir,t)}},{key:"illuminance",get:function(){return m.director.root.pipeline.pipelineSceneData.isHDR?this._illuminanceHDR:this._illuminanceLDR},set:function(t){m.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,oS.MAX_FAR)}},{key:"shadowInvisibleOcclusionRange",get:function(){return this._shadowInvisibleOcclusionRange},set:function(t){this._shadowInvisibleOcclusionRange=Math.min(t,oS.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,oS.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}(LI),UI=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=new _n,e._aabb=Xo.create(),e._type=CI.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/NI(.15),this.luminanceLDR=1},i.update=function(){if(this._node&&(this._node.hasChangedFlags||this._needUpdate)){this._node.getWorldPosition(this._pos);var t=this._range;Xo.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 m.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){m.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}(LI),GI=new _n(0,0,-1),HI=new Rn,zI=new Ln,VI=new Ln,WI=new Ln,XI=new Ln,jI=function(t){function e(){var e;return(e=t.call(this)||this)._dir=new _n(1,-1,-1),e._range=5,e._spotAngle=Math.cos(Math.PI/6),e._angleAttenuationStrength=0,e._pos=new _n,e._aabb=Xo.create(),e._frustum=Jo.create(),e._angle=0,e._needUpdate=!1,e._size=.15,e._luminanceHDR=0,e._luminanceLDR=0,e._shadowEnabled=!1,e._shadowPcf=iS.HARD,e._shadowBias=1e-5,e._shadowNormalBias=0,e._type=CI.SPOT,e}s(e,t);var i=e.prototype;return i.initialize=function(){t.prototype.initialize.call(this),this.size=.15,this.luminanceHDR=1700/NI(.15),this.luminanceLDR=1,this.range=Math.cos(Math.PI/6),this._dir.set(new _n(1,-1,-1))},i.update=function(){this._node&&(this._node.hasChangedFlags||this._needUpdate)&&(this._node.getWorldPosition(this._pos),_n.transformQuat(this._dir,GI,this._node.getWorldRotation(HI)),_n.normalize(this._dir,this._dir),Xo.set(this._aabb,this._pos.x,this._pos.y,this._pos.z,this._range,this._range,this._range),this._node.getWorldRT(zI),Ln.invert(zI,zI),Ln.perspective(VI,this._angle,1,.001,this._range),Ln.multiply(WI,VI,zI),this._frustum.update(WI,XI),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 m.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){m.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:"angleAttenuationStrength",get:function(){return this._angleAttenuationStrength},set:function(t){this._angleAttenuationStrength=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}(LI),YI=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=new _n,e._aabb=Xo.create(),e._type=CI.POINT,e}s(e,t);var i=e.prototype;return i.initialize=function(){t.prototype.initialize.call(this),this.range=1,this.luminanceHDR=1700/NI(1),this.luminanceLDR=1},i.update=function(){if(this._node&&(this._node.hasChangedFlags||this._needUpdate)){this._node.getWorldPosition(this._pos);var t=this._range;Xo.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 m.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){m.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}(LI),KI=new _n(0,0,-1),qI=function(t){function e(){var e;return(e=t.call(this)||this)._dir=new _n(0,0,-1),e._pos=new _n(0,0,0),e._scale=new _n(1,1,1),e._right=new _n(1,0,0),e._illuminanceHDR=Um.SUN_ILLUM,e._illuminanceLDR=1,e._type=CI.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),_n.transformQuat(this._dir,KI,this._node.worldRotation),_n.transformQuat(this._right,_n.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 m.director.root.pipeline.pipelineSceneData.isHDR?this._illuminanceHDR:this._illuminanceLDR},set:function(t){m.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}(LI),QI=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}(),ZI=function(){function t(){this.scene=void 0,this.node=null,this.enabled=!0,this._localBoundaryCenter=new _n(0,0,0),this._objectSize=1,this._lodDataArray=[],this._lockedLODLevelVec=[],this._isLockLevelChanged=!1,this._device=Qd.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.slice()},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===zw.PERSPECTIVE&&(e=_n.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===zw.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}(),JI=Object.freeze({__proto__:null,get CameraFOVAxis(){return Hw},get CameraProjection(){return zw},get CameraAperture(){return Vw},get CameraISO(){return Ww},get CameraShutter(){return Xw},get CameraType(){return jw},get TrackingType(){return Yw},get CameraUsage(){return Kw},SKYBOX_FLAG:nI,Camera:sI,get ModelType(){return vI},Model:II,SubModel:aI,Ambient:Um,EnvironmentLightingType:lS,Skybox:_S,ShadowSize:tS,ShadowType:eS,PCFType:iS,CSMLevel:nS,CSMOptimizationMode:rS,Shadows:oS,FogType:fS,FOG_TYPE_NONE:pS,Fog:gS,Octree:xI,Skin:DI,ColorTemperatureToRGB:OI,get LightType(){return CI},nt2lm:NI,Light:LI,DirectionalLight:kI,SphereLight:UI,SpotLight:jI,PointLight:YI,RangedDirectionalLight:qI,get ProbeClearFlag(){return cI},get ProbeType(){return lI},ReflectionProbe:mI,LODData:QI,LODGroup:ZI,ToneMappingType:Ub,PostSettings:Gb}),$I=function(){function t(t){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 ex(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 o=this._pointLights,a=0;a<o.length;a++)o[a].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=d(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|=Ig.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=d(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=d(this._lodGroups);!(t=e()).done;){var i=t.value;this._lodStateCache.removeLodGroup(i)}this._lodGroups.length=0},e.onGlobalPipelineStateChanged=function(){for(var t,e=d(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}(),tx=function(){this.usedLevel=-1,this.lastUsedLevel=-1,this.transformDirty=!0},ex=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=d(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=d(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=d(t.lodDataArray[e].models);!(i=n()).done;){var r=i.value;this._modelsInLODGroup.delete(r)}for(var s,o=d(this._lodStateInCamera);!(s=o()).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=d(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 o=r.get(s);o||(o=new Array);for(var a,h=d(n.lodDataArray[s].models);!(a=h()).done;){var u=a.value,c=this._modelsInLODGroup.get(u);c||(c=new Map),this._modelsInLODGroup.set(u,c),o.push(u)}r.set(s,o)}}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=d(e._lodStateInCamera);!(n=r()).done;){var s=n.value,o=s[1].get(t);o||(o=new tx,s[1].set(t,o)),o.transformDirty=!0}if(t.isLockLevelChanged()){t.resetLockChangeFlag();var a=e._levelModels.get(t);if(a){a.forEach((function(t){t.forEach((function(t){var i=e._modelsInLODGroup.get(t);i&&i.clear()}))}));for(var h,u=d(i);!(h=u()).done;){var c=h.value,_=a.get(c);_&&_.forEach((function(t){var i=e._modelsInLODGroup.get(t);if(i&&t.node&&t.node.active)for(var n,r=d(e._lodStateInCamera);!(n=r()).done;){var s=n.value;i.set(s[0],!0)}}))}}}return 0}for(var f,p=!1,g=d(e._lodStateInCamera);!(f=g()).done;){var m=f.value,v=m[1].get(t);v||(v=new tx,m[1].set(t,v));var y=m[0].node.hasChangedFlags,T=t.node.hasChangedFlags;if(y>0||T>0||v.transformDirty){v.transformDirty&&(v.transformDirty=!1);var E=t.getVisibleLODLevel(m[0]);E!==v.usedLevel&&(v.lastUsedLevel=v.usedLevel,v.usedLevel=E,p=!0)}}var S=e._levelModels.get(t);if(!S)return 0;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,o=S.get(s);o&&o.forEach((function(t){var i=e._modelsInLODGroup.get(t);i&&t.node&&t.node.active&&i.set(n,!0)}))}}))}},f=d(this._renderScene.lodGroups);!(l=f()).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}(),ix=((PI={})[Re.PORTRAIT]=dl.IDENTITY,PI[Re.LANDSCAPE_RIGHT]=dl.ROTATE_90,PI[Re.PORTRAIT_UPSIDE_DOWN]=dl.ROTATE_180,PI[Re.LANDSCAPE_LEFT]=dl.ROTATE_270,PI),nx=0,rx=function(){var t=e.prototype;function e(){this._title="",this._width=1,this._height=1,this._swapchain=null,this._renderPass=null,this._colorTextures=[],this._depthStencilTexture=null,this._cameras=[],this._hasOnScreenAttachments=!1,this._hasOffScreenAttachments=!1,this._framebuffer=null,this._device=null,this._renderWindowId=nx++,this._isResized=!0,this._colorName="Color"+this._renderWindowId,this._depthStencilName="DepthStencil"+this._renderWindowId}return t.isRenderWindowResized=function(){return this._isResized},t.setRenderWindowResizeHandled=function(){this._isResized=!1},e.registerCreateFunc=function(t){t._createWindowFun=function(){return new e}},t.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 A_(Sl.TEX2D,Al.COLOR_ATTACHMENT|Al.SAMPLED|Al.TRANSFER_SRC,e.renderPassInfo.colorAttachments[i].format,this._width,this._height);e.externalFlag&&(e.externalFlag&bl.EXTERNAL_NORMAL||e.externalFlag&bl.EXTERNAL_OES)&&(n.flags|=e.externalFlag,n.externalRes=e.externalResLow?e.externalResLow:0),this._colorTextures.push(t.createTexture(n))}e.renderPassInfo.depthStencilAttachment&&e.renderPassInfo.depthStencilAttachment.format!==pl.UNKNOWN&&(this._depthStencilTexture=t.createTexture(new A_(Sl.TEX2D,Al.DEPTH_STENCIL_ATTACHMENT|Al.SAMPLED,e.renderPassInfo.depthStencilAttachment.format,this._width,this._height)),this._hasOffScreenAttachments=!0)}return this._framebuffer=t.createFramebuffer(new j_(this._renderPass,this._colorTextures,this._depthStencilTexture)),!0},t.destroy=function(){this.clearCameras(),this._framebuffer&&(this._framebuffer.destroy(),this._framebuffer=null),this._depthStencilTexture&&(this._depthStencilTexture.destroy(),this._depthStencilTexture=null);for(var t=0;t<this._colorTextures.length;t++){var e=this._colorTextures[t];e&&e.destroy()}this._colorTextures.length=0,this._device=null},t.resize=function(t,e){if(this._swapchain)this._swapchain.resize(t,e,ix[No.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 j_(this._renderPass,this._colorTextures,this._depthStencilTexture)));for(var n,r=d(this._cameras);!(n=r()).done;)n.value.resize(t,e);this._isResized=!0},t.extractRenderCameras=function(t){for(var e=0;e<this._cameras.length;e++){var i=this._cameras[e];i.enabled&&(i.update(),t.push(i))}},t.attachCamera=function(t){for(var e=0;e<this._cameras.length;e++)if(this._cameras[e]===t)return;this._cameras.push(t),this.sortCameras(),this._isResized=!0},t.detachCamera=function(t){for(var e=0;e<this._cameras.length;++e)if(this._cameras[e]===t)return void this._cameras.splice(e,1)},t.clearCameras=function(){this._cameras.length=0},t.sortCameras=function(){this._cameras.sort((function(t,e){return t.priority-e.priority}))},n(e,[{key:"width",get:function(){return this._width}},{key:"height",get:function(){return this._height}},{key:"swapchain",get:function(){return this._swapchain}},{key:"framebuffer",get:function(){return this._framebuffer}},{key:"cameras",get:function(){return this._cameras}},{key:"renderWindowId",get:function(){return this._renderWindowId}},{key:"colorName",get:function(){return this._colorName}},{key:"depthStencilName",get:function(){return this._depthStencilName}}]),e}();t("PipelineEventType",MI),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"}(MI||t("PipelineEventType",MI={}));var sx,ox,ax,hx=t("PipelineEventProcessor",function(t){function e(){var e;return(e=t.call(this)||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}(oo));!function(t){t[t.NONE=-1]="NONE",t[t.LEFT=0]="LEFT",t[t.RIGHT=1]="RIGHT"}(sx||(sx={})),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"}(ox||(ox={})),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"}(ax||(ax={}));var ux=t("Root",function(){function t(t){var e=this;this._createSceneFun=null,this._createWindowFun=null,this._windows=[],this._mainWindow=null,this._curWindow=null,this._tempWindow=null,this._usesCustomPipeline=!0,this._pipeline=null,this._pipelineEvent=new hx,this._classicPipeline=null,this._customPipeline=null,this._batcher=null,this._scenes=[],this._modelPools=new Map,this._cameraPool=null,this._lightPools=new Map,this._debugView=new qw,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=m.internal.DataPoolManager&&new m.internal.DataPoolManager(t),$I.registerCreateFunc(this),rx.registerCreateFunc(this),this._cameraPool=new Ws((function(){return new sI(e._device)}),4,(function(t){return t.destroy()}))}var e=t.prototype;return e.initialize=function(){var t,e=Qd.swapchain,i=new k_;i.format=e.colorTexture.format;var n=new U_;n.format=e.depthStencilTexture.format,n.depthStoreOp=Fl.DISCARD,n.stencilStoreOp=Fl.DISCARD;var r=new z_([i],n);this._mainWindow=this.createWindow({title:"rootMainWindow",width:e.width,height:e.height,renderPassInfo:r,swapchain:e}),this._curWindow=this._mainWindow;var s=we.querySettings(Ce.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(),m.rendering&&m.rendering.destroy()},e.resize=function(t,e){for(var i,n=d(this._windows);!(i=n()).done;){var r=i.value;r.swapchain&&r.resize(t,e)}},e.setRenderPipeline=function(t){var e=m.internal,i=m.director,n=m.rendering,r=m.legacy_rendering;if(void 0===n&&void 0===r)return Z(1223),!1;var s=!1;if(t)this._customPipeline=n.createCustomPipeline(),s=!0,this._pipeline=this._customPipeline,B("Using custom pipeline: "+Ie.CUSTOM_PIPELINE_NAME);else{var o=r.createDefaultPipeline();s=!0,B("Using legacy pipeline"),this._classicPipeline=o,this._pipeline=this._classicPipeline,this._pipelineEvent=this._classicPipeline,this._usesCustomPipeline=!1}if((we.querySettings(Ce.Category.RENDERING,"renderMode")!==Wd.HEADLESS||this._classicPipeline)&&!this._pipeline.activate(this._mainWindow.swapchain))return s&&this._pipeline.destroy(),this._classicPipeline=null,this._customPipeline=null,this._pipeline=null,this._pipelineEvent=null,!1;var a=i.getScene();return a&&a.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.pipelineSceneData.skybox.enabled&&this._pipeline.pipelineSceneData.skybox.model.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=d(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=d(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 Ws((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)):q(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 Ws((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 CI.DIRECTIONAL:t.scene.removeDirectionalLight(t);break;case CI.SPHERE:t.scene.removeSphereLight(t);break;case CI.SPOT:t.scene.removeSpotLight(t);break;case CI.POINT:t.scene.removePointLight(t);break;case CI.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 CI.DIRECTIONAL:t.scene.removeDirectionalLight(t);break;case CI.SPHERE:t.scene.removeSphereLight(t);break;case CI.SPOT:t.scene.removeSpotLight(t);break;case CI.POINT:t.scene.removePointLight(t);break;case CI.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,o=0;o<n;o++){for(var a,h=d(e);!(a=h()).done;){var u=a.value;r=r.concat(u.cameras),u.swapchain&&t.webXRWindowMap.set(u,o)}if(s){for(var c=[0,0,0],l=0;l<s.length;l++){var _=s[l];if(_.code===ax.VIEW_LEFT&&o===sx.LEFT||_.code===ax.VIEW_RIGHT&&o===sx.RIGHT){c[0]=_.position.x,c[1]=_.position.y,c[2]=_.position.z;break}}for(var f,p=d(r);!(f=p()).done;){var g=f.value;g.trackingType!==Yw.NO_TRACKING&&g.node&&(g.trackingType===Yw.ROTATION&&(c=[0,0,0]),g.node.setPosition(c[0],c[1],c[2]))}}r.length=0,this._frameMoveBegin(),this._frameMoveProcess();for(var m=i.length-1;m>=0;m--){var v=i[m];(o===sx.LEFT&&v.cameraType===jw.RIGHT_EYE||o===sx.RIGHT&&v.cameraType===jw.LEFT_EYE)&&i.splice(m,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=m.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([Qd.swapchain]);var r=this._scenes,s=t.getTotalFrames();this._batcher&&(this._batcher.update(),this._batcher.uploadBuffers());for(var o=0;o<r.length;o++)r[o].update(s)}},e._frameMoveEnd=function(){var t=m.director,e=m.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((Zm.COUNT+Jm.COUNT+$m.COUNT+dv.COUNT+fv.COUNT)/4,100),e=Math.floor((Qd.gfxDevice.capabilities.maxVertexUniformVectors-t)/3);bv(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}());m.Root=ux,Ti.Attr.setClassAttr(Rp,"target","type","Object"),Ti.Attr.setClassAttr(Rp,"target","ctor",Tm);var cx,lx=new Ws((function(){return new Array(16)}),3),_x=null,dx=new Hn,fx=[Dg.TOUCH_START,Dg.TOUCH_MOVE,Dg.TOUCH_END,Dg.TOUCH_CANCEL],px=[Dg.MOUSE_DOWN,Dg.MOUSE_ENTER,Dg.MOUSE_MOVE,Dg.MOUSE_LEAVE,Dg.MOUSE_UP,Dg.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"}(cx||(cx={}));var gx,mx=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._isMouseLeaveWindow=!1,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(cx.MARK_LIST_DIRTY),i&&n.length>0)for(var r=0;r<n.length;++r)n[r].eventProcessor.setEnabled(e,!0)}},e.reattach=function(){var e,i=this;this.node.walk((function(n){e||(e=i._searchComponentsInParent(t._maskComp)),n.eventProcessor.maskList=e}))},e.destroy=function(){if(_x===this._node&&(_x=null),this.capturingTarget&&this.capturingTarget.clear(),this.bubblingTarget&&this.bubblingTarget.clear(),t.callbacksInvoker.emit(cx.REMOVE_POINTER_EVENT_PROCESSOR,this),this._dispatchingTouch){var e=new ew([this._dispatchingTouch],!0,qR.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(cx.REMOVE_POINTER_EVENT_PROCESSOR,this)},e.emit=function(t,e,i,n,r,s){var o;null===(o=this.bubblingTarget)||void 0===o||o.emit(t,e,i,n,r,s)},e.dispatchEvent=function(t){var e,i=this.node,n=0;t.target=i;var r=lx.alloc();for(r.length=0,this.getCapturingTargets(t.type,r),t.eventPhase=1,n=r.length-1;n>=0;--n)if((e=r[n]).eventProcessor.capturingTarget&&(t.currentTarget=e,e.eventProcessor.capturingTarget.emit(t.type,t,r),t.propagationStopped))return void lx.free(r);if(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(r.length=0,this.getBubblingTargets(t.type,r),t.eventPhase=3,n=0;n<r.length;++n)if((e=r[n]).eventProcessor.bubblingTarget&&(t.currentTarget=e,e.eventProcessor.bubblingTarget.emit(t.type,t),t.propagationStopped))return void lx.free(r);lx.free(r)},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(cx.MARK_LIST_DIRTY)},e._searchComponentsInParent=function(t){var e=this.node;if(t){for(var i=0,n=[],r=e;r&&Tm.isNode(r);r=r.parent,++i){var s=r.getComponent(t);if(s){var o={index:i,comp:s};n?n.push(o):n=[o]}}return n.length>0?n:null}return null},e._attachMask=function(){this.maskList=this._searchComponentsInParent(t._maskComp)},e._isTouchEvent=function(t){return-1!==fx.indexOf(t)},e._isMouseEvent=function(t){return-1!==px.indexOf(t)},e._hasTouchListeners=function(){for(var t=0;t<fx.length;++t){var e=fx[t];if(this.hasEventListener(e))return!0}return!1},e._hasMouseListeners=function(){for(var t=0;t<px.length;++t){var e=px[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(cx.ADD_POINTER_EVENT_PROCESSOR,this)},e._newCallbacksInvoker=function(){var e=this,i=new ro;return i._registerOffCallback((function(){e.shouldHandleEventTouch&&!e._hasTouchListeners()&&(e.shouldHandleEventTouch=!1),e.shouldHandleEventMouse&&!e._hasMouseListeners()&&(e.shouldHandleEventMouse=!1),e._hasPointerListeners()||t.callbacksInvoker.emit(cx.REMOVE_POINTER_EVENT_PROCESSOR,e)})),i},e._handleEventMouse=function(t){switch(t.type){case qR.MOUSE_DOWN:return this._handleMouseDown(t);case qR.MOUSE_MOVE:return this._handleMouseMove(t);case qR.MOUSE_UP:return this._handleMouseUp(t);case qR.MOUSE_WHEEL:return this._handleMouseWheel(t);case qR.MOUSE_LEAVE:return this._handleMouseLeave(t);case qR.MOUSE_ENTER:return this._handleMouseEnter(t);default:return!1}},e._handleMouseDown=function(t){var e=this._node;return!(!e||!e._uiProps.uiTransformComp||(t.getLocation(dx),!e._uiProps.uiTransformComp.hitTest(dx,t.windowId)||(t.type=Dg.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||this._isMouseLeaveWindow||(t.getLocation(dx),e._uiProps.uiTransformComp.hitTest(dx,t.windowId)?(this.previousMouseIn||(_x&&_x!==e&&(t.type=Dg.MOUSE_LEAVE,_x.dispatchEvent(t),_x.eventProcessor.previousMouseIn=!1),_x=e,t.type=Dg.MOUSE_ENTER,e.dispatchEvent(t),this.previousMouseIn=!0),t.type=Dg.MOUSE_MOVE,t.bubbles=!0,e.dispatchEvent(t),t.propagationStopped=!0,0):(this.previousMouseIn&&(t.type=Dg.MOUSE_LEAVE,e.dispatchEvent(t),this.previousMouseIn=!1,_x=null),1)))},e._handleMouseUp=function(t){var e=this._node;return!(!e||!e._uiProps.uiTransformComp||(t.getLocation(dx),!e._uiProps.uiTransformComp.hitTest(dx,t.windowId)||(t.type=Dg.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(dx),!e._uiProps.uiTransformComp.hitTest(dx,t.windowId)||(t.type=Dg.MOUSE_WHEEL,t.bubbles=!0,e.dispatchEvent(t),t.propagationStopped=!0,0)))},e._handleMouseLeave=function(t){return this._isMouseLeaveWindow=!0,this.previousMouseIn&&(t.type=Dg.MOUSE_LEAVE,this._node.dispatchEvent(t),this.previousMouseIn=!1,_x=null),!1},e._handleMouseEnter=function(){return this._isMouseLeaveWindow=!1,!1},e._handleEventTouch=function(t){try{switch(t.type){case qR.TOUCH_START:return this._handleTouchStart(t);case qR.TOUCH_MOVE:return this._handleTouchMove(t);case qR.TOUCH_END:return this._handleTouchEnd(t);case qR.TOUCH_CANCEL:return this._handleTouchCancel(t);default:return!1}}catch(t){throw this.claimedTouchIdList.length=0,t}},e._handleTouchStart=function(t){var e=this.node;return!(!e||!e._uiProps.uiTransformComp||(t.getLocation(dx),!e._uiProps.uiTransformComp.hitTest(dx,t.windowId)||(t.type=Dg.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=Dg.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(dx),e._uiProps.uiTransformComp.hitTest(dx,t.windowId)?t.type=Dg.TOUCH_END:t.type=Dg.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=Dg.TOUCH_CANCEL,t.bubbles=!0,e.dispatchEvent(t),this._dispatchingTouch=null)},n(t,[{key:"isEnabled",get:function(){return this._isEnabled}},{key:"node",get:function(){return this._node}}]),t}();mx._maskComp=null,mx.callbacksInvoker=new ro,m.NodeEventProcessor=mx,rt(Tm.prototype,"Node",[{name:"childrenCount",newName:"children.length",customGetter:function(){return this.children.length}}]),rt(Tm.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 Hn),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 Xn),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)}}]),st(yR.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"}]),rt(yR.prototype,"SceneGlobals.prototype",[{name:"distance",newName:"planeHeight"},{name:"normal",newName:"planeDirection"},{name:"size",newName:"shadowMapSize"}]),st(Tm.prototype,"Node.prototype",[{name:"addLayer"},{name:"removeLayer"}]),rt(xg.prototype,"NodeUIProperties",[{name:"opacityDirty",newName:"colorDirty"}]),st(Rg,"Layers",[{name:"All"},{name:"RaycastMask"},{name:"check"}]),rt(Rg,"Layers",[{name:"Default",newName:"DEFAULT",target:Rg.Enum,targetName:"Layers.Enum"},{name:"Always",newName:"ALWAYS",target:Rg.Enum,targetName:"Layers.Enum"},{name:"IgnoreRaycast",newName:"IGNORE_RAYCAST",target:Rg.Enum,targetName:"Layers.Enum"},{name:"Gizmos",newName:"GIZMOS",target:Rg.Enum,targetName:"Layers.Enum"},{name:"Editor",newName:"EDITOR",target:Rg.Enum,targetName:"Layers.Enum"},{name:"UI",newName:"UI_3D",target:Rg.Enum,targetName:"Layers.Enum"},{name:"UI2D",newName:"UI_2D",target:Rg.Enum,targetName:"Layers.Enum"},{name:"SceneGizmo",newName:"SCENE_GIZMO",target:Rg.Enum,targetName:"Layers.Enum"},{name:"makeInclusiveMask",newName:"makeMaskInclude",target:Rg,targetName:"Layers"},{name:"makeExclusiveMask",newName:"makeMaskExclude",target:Rg,targetName:"Layers"}]),st(Rg.Enum,"Layers.Enum",[{name:"ALWAYS"}]),st(Rg.BitMask,"Layers.BitMask",[{name:"ALWAYS"}]);var vx=qs.Flags.HideInHierarchy,yx=qs.Flags.DontSave,Tx=t("PrivateNode",va("cc.PrivateNode")(gx=function(t){function e(e){var i;return q(12003,(i=t.call(this,e)||this).name),i.hideFlags|=yx|vx,i}return s(e,t),e}(Tm))||gx);function Ex(t,e){if(!e){var i=m.director.getScene();if(!i)return null;e=i}return e.getChildByPath(t)}rt(KR,"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:Tm.EventType,targetName:"Node.EventType"}}))),rt(Tm.EventType,"Node.EventType",[{name:"DEVICEMOTION",target:Uw.EventType,targetName:"SystemEvent.EventType"},{name:"KEY_DOWN",target:Uw.EventType,targetName:"SystemEvent.EventType"},{name:"KEY_UP",target:Uw.EventType,targetName:"SystemEvent.EventType"}]),m.PrivateNode=Tx,gt({BaseNode:{newName:"Node",since:"3.7.0",removed:!1}}),m.find=Ex;var Sx=he,Ax=qs.Flags.IsStartCalled,bx=qs.Flags.IsOnEnableCalled;function Cx(t,e){for(var i=e.constructor._executionOrder,n=e._id,r=0,s=t.length-1,o=s>>>1;r<=s;o=r+s>>>1){var a=t[o],h=a.constructor._executionOrder;if(h>i)s=o-1;else if(h<i)r=o+1;else{var u=a._id;if(u>n)s=o-1;else{if(!(u<n))return o;r=o+1}}}return~r}function Rx(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))}}qs.Flags.IsEditorOnEnableCalled;var Ix=function(){function t(t){var e=oe;this._zero=new e([]),this._neg=new e([]),this._pos=new e([]),this._invoke=t}return n(t,[{key:"zero",get:function(){return this._zero}},{key:"neg",get:function(){return this._neg}},{key:"pos",get:function(){return this._pos}}]),t}();function xx(t,e){return t.constructor._executionOrder-e.constructor._executionOrder}Ix.stableRemoveInactive=Rx;var Dx=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){Rx(this._zero,t),Rx(this._neg,t),Rx(this._pos,t)},i.invoke=function(){var t=this._neg;t.array.length>0&&(t.array.sort(xx),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(xx),this._invoke(e),e.array.length=0)},e}(Ix),Ox=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=Cx(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=Cx(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}(Ix);function Px(t,e,i){return function(n,r){try{e(n,r)}catch(e){m._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){m._throw(t),i&&(s[n.i]._objFlags|=i)}}}}var Mx=Px((function(t){t.start(),t._objFlags|=Ax}),(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|=Ax}}),Ax),Nx=Px((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)})),Lx=Px((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)})),Bx=function(t){var e=m.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))}},Fx=function(){function t(){this._deferredComps=[],this.unscheduleAll()}var e=t.prototype;return e.unscheduleAll=function(){this.startInvoker=new Dx(Mx),this.updateInvoker=new Ox(Nx),this.lateUpdateInvoker=new Ox(Lx),this._updating=!1},e._onEnabled=function(t){m.director.getScheduler().resumeTarget(t),t._objFlags|=bx,this._updating?this._deferredComps.push(t):this._scheduleImmediate(t)},e._onDisabled=function(t){m.director.getScheduler().pauseTarget(t),t._objFlags&=~bx;var e=this._deferredComps.indexOf(t);e>=0?Sx(this._deferredComps,e):(!t.internalStart||t._objFlags&Ax||this.startInvoker.remove(t),t.internalUpdate&&this.updateInvoker.remove(t),t.internalLateUpdate&&this.lateUpdateInvoker.remove(t))},e.enableComp=function(t,e){if(!(t._objFlags&bx)){if(t.internalOnEnable){if(e)return void e.add(t);if(t.internalOnEnable(),!t.node.activeInHierarchy)return}this._onEnabled(t)}},e.disableComp=function(t){t._objFlags&bx&&(t.internalOnDisable&&t.internalOnDisable(),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.internalStart||t._objFlags&Ax||this.startInvoker.add(t),"function"==typeof t.internalUpdate&&this.updateInvoker.add(t),"function"==typeof t.internalLateUpdate&&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}(),kx=qs.Flags.IsPreloadStarted,Ux=qs.Flags.IsOnLoadStarted,Gx=qs.Flags.IsOnLoadCalled,Hx=qs.Flags.IsOnEnableCalled,zx=qs.Flags.Deactivating,Vx=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){Ix.stableRemoveInactive(this._zero,t)},i.invoke=function(){this._invoke(this._zero),this._zero.array.length=0},e}(Ix),Wx=Px((function(t){var e;null===(e=t.internalPreload)||void 0===e||e.call(t)}),(function(t){var e=t.array;for(t.i=0;t.i<e.length;++t.i){var i,n;null===(i=(n=e[t.i]).internalPreload)||void 0===i||i.call(n)}})),Xx=Px((function(t){var e;null===(e=t.internalOnLoad)||void 0===e||e.call(t),t._objFlags|=Gx}),(function(t){var e=t.array;for(t.i=0;t.i<e.length;++t.i){var i,n=e[t.i];null===(i=n.internalOnLoad)||void 0===i||i.call(n),n._objFlags|=Gx}}),Gx),jx=new se(4);function Yx(t,e,i){Z(3817,t.name,i),console.log("Corrupted component value:",e),e?t._removeComponent(e):ae(t.getWritableComponents(),i)}jx.get=function(){var t=this._get()||{preload:new Vx(Wx),onLoad:new Dx(Xx),onEnable:new Dx(Bx)};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 Kx=t("NodeActivator",function(){function t(){this.reset()}var e=t.prototype;return e.reset=function(){this._activatingStack=[]},e.activateNode=function(t,e){if(e){var i=jx.get();i&&(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(),jx.put(i))}else{this._deactivateNodeRecursively(t);for(var n,r=d(this._activatingStack);!(n=r()).done;){var s=n.value;s.preload.cancelInactive(kx),s.onLoad.cancelInactive(Ux),s.onEnable.cancelInactive(Hx)}}t.emit(Dg.ACTIVE_IN_HIERARCHY_CHANGED,t)},e.activateComp=function(t,e,i,n){if(Zs(t,!0)&&(t._objFlags&kx||(t._objFlags|=kx,t.internalPreload&&(e?e.add(t):t.internalPreload())),t._objFlags&Ux||(t._objFlags|=Ux,t.internalOnLoad?i?i.add(t):(t.internalOnLoad(),t._objFlags|=Gx):t._objFlags|=Gx),t._enabled)){if(!t.node.activeInHierarchy)return;m.director._compScheduler.enableComp(t,n)}},e.destroyComp=function(t){m.director._compScheduler.disableComp(t),t.internalOnDestroy&&t._objFlags&Gx&&t.internalOnDestroy()},e._activateNodeRecursively=function(t,e,i,n){if(t._objFlags&zx)Z(3816,t.name);else{t._setActiveInHierarchy(!0);for(var r=t.components.length,s=0;s<r;++s){var o=t.components[s];o instanceof m.Component?this.activateComp(o,e,i,n):(Yx(t,o,s),--s,--r)}for(var a=0,h=t.children.length;a<h;++a){var u=t.children[a];u.active&&this._activateNodeRecursively(u,e,i,n)}t._onPostActivated(!0)}},e._deactivateNodeRecursively=function(t){t._objFlags|=zx,t._setActiveInHierarchy(!1);for(var e=t.components.length,i=0;i<e;++i){var n=t.components[i];if(n._enabled&&(m.director._compScheduler.disableComp(n),t.activeInHierarchy))return void(t._objFlags&=~zx)}for(var r=0,s=t.children.length;r<s;++r){var o=t.children[r];if(o.activeInHierarchy&&(this._deactivateNodeRecursively(o),t.activeInHierarchy))return void(t._objFlags&=~zx)}t._onPostActivated(!1),t._objFlags&=~zx},t}()),qx=qs.Flags.Destroyed,Qx=qs.Flags.PersistentMask,Zx=Ti.Attr.DELIMETER+"default",Jx=Ti.IDENTIFIER_RE,$x="var ",tD="o",eD={"cc.ClickEvent":!1,"cc.PrefabInfo":!1},iD=Ti.escapeForJS,nD=function(){function t(t,e){this.varName=t,this.expression=e}return t.prototype.toString=function(){return $x+this.varName+"="+this.expression+";"},t}();function rD(t,e){return e instanceof nD?new nD(e.varName,t+e.expression):t+e}function sD(t,e,i){Array.isArray(i)?(i[0]=rD(e,i[0]),t.push(i)):t.push(rD(e,i)+";")}var oD=function(){function t(t){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];sD(t,e+aD(n[0])+"=",n[1])}},t}();function aD(t){return Jx.test(t)?"."+t:"["+iD(t)+"]"}oD.pool=void 0,oD.pool=new se((function(t){t._exps.length=0,t._targetExp=null}),1),oD.pool.get=function(t){var e=this._get()||new oD;return e._targetExp=t,e};var hD,uD,cD,lD,_D,dD,fD=function(){function t(t,e){var i;this.objsToClear_iN$t=[],this.codeArray=[],this.objs=[],this.funcs=[],this.globalVariables=[],this.globalVariableId=0,this.localVariableId=0,this.parent=e,this.funcModuleCache=Dt(),Ht(this.funcModuleCache,eD),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=$x+this.globalVariables.join(",")+";");var n=ul(["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=Ot(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 o="F["+s+"]";return e&&(o="("+o+")"),this.funcModuleCache[i]=o,o},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=oD.pool.get(n),s=e.constructor.__props__;s||(s=Object.keys(e));for(var o=0;o<s.length;o++){var a=s[o],h=i[a];if(e[a]!==h){var u=this.enumerateField(i,a,h);r.append(a,u)}}r.writeCode(t),oD.pool.put(r)},e.enumerateCCClass=function(t,e,i){for(var n=i.__values__,r=Ti.Attr.getClassAttrs(i),s=0;s<n.length;s++){var o=n[s],a=e[o],h=r[o+Zx];if(!pD(h,a))if("object"==typeof a&&a instanceof m.ValueType&&(h=Ti.getDefault(h))&&h.constructor===a.constructor){var u=tD+aD(o);this.setValueType(t,h,a,u)}else this.setObjProp(t,e,o,a)}},e.instantiateArray=function(t){if(0===t.length)return"[]";var e="a"+ ++this.localVariableId,i=[new nD(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)sD(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 nD(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]&&sD(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]=rD(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?iD(i):("_objFlags"===e&&Qs(t)&&(i&=Qx),i)},e.setObjProp=function(t,e,i,n){sD(t,tD+aD(i)+"=",this.enumerateField(e,i,n))},e.enumerateObject=function(t,e){var i=e.constructor;if(Ei(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 m.ValueType)return Ti.getNewValueTypeCode(t);if(t instanceof m.Asset)return this.getObjRef(t);if(t._objFlags&qx)return null;var e,i=t.constructor;if(Ei(i)){if(this.parent)if(this.parent instanceof m.Component){if(t instanceof m.Node||t instanceof m.Component)return this.getObjRef(t)}else if(this.parent instanceof m.Node)if(t instanceof m.Node){if(!t.isChildOf(this.parent))return this.getObjRef(t)}else if(t instanceof m.Component){var n;if(null===(n=t.node)||void 0===n||!n.isChildOf(this.parent))return this.getObjRef(t)}e=new nD(tD,"new "+this.getFuncModule(i,!0)+"()")}else if(i===Object)e=new nD(tD,"{}");else{if(i)return this.getObjRef(t);e=new nD(tD,"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 pD(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 m.ValueType){if(t.equals(e))return!0}else{if(Array.isArray(t))return 0===t.length&&0===e.length;if(t.constructor===Object)return bt(t)&&bt(e)}return!1}var gD=ye({AUTO:0,SINGLE_INSTANCE:1,MULTI_INSTANCE:2}),mD=t("Prefab",va("cc.Prefab")(((dD=function(t){function e(){var e;return(e=t.call(this)||this).data=cD&&cD(),e.optimizationPolicy=lD&&lD(),e.persistent=_D&&_D(),e._createFunction=null,e._instantiatedTimes=0,e}s(e,t);var i=e.prototype;return i.createNode=function(t){var e=m.instantiate(this);e.name=this.name,t(null,e)},i.compileCreateFunction=function(){var t,e;this._createFunction=(e=(t=this.data)instanceof m.Node&&t,new fD(t,e).result)},i._doInstantiate=function(t){return this.data._prefab||q(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 Tm,this.data.name="(Missing Node)";var i=new m._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;FR(t),LR(t)},e}(Of)).OptimizationPolicy=gD,dD.OptimizationPolicyThreshold=3,cD=ua((uD=dD).prototype,"data",[wa],(function(){return null})),lD=ua(uD.prototype,"optimizationPolicy",[wa],(function(){return gD.AUTO})),_D=ua(uD.prototype,"persistent",[wa],(function(){return!1})),hD=uD))||hD);Rt(mD,"_utils",XR),m.Prefab=mD,Pt(m,"cc._Prefab","Prefab");var vD=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,he(this._allRenderers,e),t._internalId=-1,t._dirtyVersion===this._dirtyVersion&&(ce(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,e=0;e<this._dirtyRenderers.length;e++)t[e].updateRenderer();this._dirtyRenderers.length=0,this._dirtyVersion++},t}()),yD=[".png",".jpg",".bmp",".jpeg",".gif",".ico",".tiff",".webp",".image",".pvr",".pkm",".astc"],TD=[".mp3",".ogg",".wav",".m4a"];function ED(){return!0}var SD={transformURL:function(t){var e=Tf(t);if(!e)return t;var i=of.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"===Eo(t)&&(s=!0),s){var o=bo(t),a=Ao(t);t=o+"."+n+"/"+a}else t=t.replace(/.*[/\\][0-9a-fA-F]{2}[/\\]([0-9a-fA-F-@]{8,})/,(function(t){return t+"."+n}));return t}},AD=t("CCLoader",function(){function t(){this._autoReleaseSetting=Object.create(null),this._parseLoadResArgs=wT}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 o=[],a=[];xE.loadAny(n,null,(function(t,i,n){n.content&&(yD.includes(n.ext)?o.push(n.content):TD.includes(n.ext)&&a.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 Of)){var r=i,s=n[t].url;o.includes(r)?_E.create(s,i,".png",{},(function(i,n){r=e[t]=n})):a.includes(r)&&_E.create(s,i,".mp3",{},(function(i,n){r=e[t]=n})),nf.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:ED,_map:u}}else r=e[0]}i&&i(t,r)}))},e.getXMLHttpRequest=function(){return new XMLHttpRequest},e.getItem=function(t){return xE.assets.has(t)?{content:xE.assets.get(t)}:null},e.loadRes=function(t,e,i,n){var r=this._parseLoadResArgs(e,i,n),s=r.type,o=r.onProgress,a=r.onComplete,h=Eo(t);h&&!OT.getInfoWithPath(t,s)&&(t=t.slice(0,-h.length)),OT.load(t,s,o,a)},e.loadResArray=function(t,e,i,n){var r=this._parseLoadResArgs(e,i,n),s=r.type,o=r.onProgress,a=r.onComplete;t.forEach((function(e,i){var n=Eo(e);n&&!OT.getInfoWithPath(e,s)&&(t[i]=e.slice(0,-n.length))})),OT.load(t,s,o,a)},e.loadResDir=function(t,e,i,n){var r=this._parseLoadResArgs(e,i,n),s=r.type,o=r.onProgress,a=r.onComplete;OT.loadDir(t,s,o,(function(e,i){var n=[];e||(n=OT.getDirWithPath(t,s).map((function(t){return t.path}))),a&&a(e,i,n)}))},e.getRes=function(t,e){return nf.has(t)?nf.get(t):OT.get(t,e)},e.getResCount=function(){return nf.count},e.getDependsRecursively=function(t){if(!t)return[];var e="string"==typeof t?t:t._uuid;return dg.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();tE.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();vE.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=nf.get(i)),xE.releaseAsset(i)}else t&&("string"==typeof t&&(t=nf.get(t)),xE.releaseAsset(t))},e.releaseAsset=function(t){xE.releaseAsset(t)},e.releaseRes=function(t,e){OT.release(t,e)},e.releaseAll=function(){xE.releaseAll(),nf.clear()},e.removeItem=function(t){return!!nf.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=dg.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){yT=t}},{key:"_cache",get:function(){if(nf instanceof $d)return nf.map;var t={};return nf.forEach((function(e,i){t[i]=e})),t}},{key:"md5Pipe",get:function(){return SD}},{key:"downloader",get:function(){return tE}},{key:"loader",get:function(){return xE.parser}}]),t}()),bD=t("loader",new AD),CD=t("AssetLibrary",{init:function(t){t.importBase=t.libraryPath,t.nativeBase=t.rawAssetsBase,xE.init(t),t.rawAssets&&OT.init({base:"",deps:[],scenes:{},redirect:[],debug:!0,packs:{},types:[],versions:{import:[],native:[]},name:lf.RESOURCES,importBase:t.importBase,nativeBase:t.nativeBase,paths:t.rawAssets.assets,uuids:Object.keys(t.rawAssets.assets),extensionMap:{}})},loadAsset:function(t,e){xE.loadAny(t,e)}}),RD=t("url",{});rt(RD,"url",[{name:"normalize",target:xE.utils,targetName:"assetManager.utils",newName:"normalize"},{name:"raw",targetName:"Asset.prototype",newName:"nativeUrl",customFunction:function(t){return t.startsWith("resources/")?bf({path:Co(t.substr(10)),bundle:lf.RESOURCES,__isNative__:!0,ext:Eo(t)}):""}}]),st(CD,"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"}]),st(bD,"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"}]),rt(m,"cc",[{name:"loader",newName:"assetManager",logTimes:1,customGetter:function(){return bD}},{name:"AssetLibrary",newName:"assetManager",logTimes:1,customGetter:function(){return CD}},{name:"Pipeline",target:IE,targetName:"AssetManager",newName:"Pipeline",logTimes:1},{name:"url",targetName:"assetManager",newName:"utils",logTimes:1,customGetter:function(){return RD}}]),st(m,"cc",[{name:"LoadingItems",suggest:et(1400,"LoadingItems","AssetManager.Task")}]),rt(Ie,"macro",[{name:"DOWNLOAD_MAX_CONCURRENT",target:tE,targetName:"assetManager.downloader",newName:"maxConcurrency"}]);var wD=vT._autoRelease;vT._autoRelease=function(t,e,i){wD.call(vT,t,e,i);for(var n=bD._autoReleaseSetting,r=Object.keys(n),s=0;s<r.length;s++){var o=r[s];if(!0===n[o]){var a=nf.get(o);a&&vT.tryRelease(a)}}};var ID=t("Director",function(t){function e(){var e;return(e=t.call(this)||this)._compScheduler=new Fx,e._nodeActivator=new Kx,e._invalid=!1,e._paused=!1,e._root=null,e._loadingScene="",e._scene=null,e._totalFrames=0,e._scheduler=new $c,e._systems=[],e._persistRootNodes={},e}s(e,t);var i=e.prototype;return i.end=function(){var t=this;this.once(e.EVENT_END_FRAME,(function(){t.purgeDirector()}))},i.pause=function(){this._paused=!0},i.purgeDirector=function(){this._scheduler.unscheduleAll(),this._compScheduler.unscheduleAll(),this._nodeActivator.reset(),Zs(this._scene)&&this._scene.destroy(),this._scene=null,this.stopAnimation(),xE.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 YR&&(t=t.scene),tt(t instanceof jR,1216),t._load();for(var s=Object.keys(this._persistRootNodes).map((function(t){return r._persistRootNodes[t]})),o=0;o<s.length;o++){var a=s[o];a.emit(Tm.EventType.SCENE_CHANGED_FOR_PERSISTS,t.renderScene);var h=t.uuid===a._originalSceneId&&t.getChildByUuid(a.uuid);if(h){var u=h.getSiblingIndex();a.hideFlags&=~qs.Flags.DontSave,a.hideFlags|=qs.Flags.DontSave&h.hideFlags,h._destroyImmediate(),t.insertChild(a,u)}else a.hideFlags|=qs.Flags.DontSave,a.parent=t}var c=this._scene;Zs(c)&&c.destroy(),vT._autoRelease(c,t,this._persistRootNodes),this._scene=null,qs._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 YR&&(t=t.scene),tt(Boolean(t),1205),tt(t instanceof jR,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 q(1208,t,this._loadingScene),!1;var s=xE.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?(k(e),i&&i(e)):r.runSceneImmediate(s,n,i)})),!0):(Z(1209,t),!1)},i.preloadScene=function(t,e,i){var n=xE.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)),k("preloadScene: "+r)}},i.resume=function(){this._paused=!1},i.getScene=function(){return this._scene},i.getDeltaTime=function(){return m.game.deltaTime},i.getTotalTime=function(){return m.game.totalTime},i.getCurrentTime=function(){return m.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($c.ID,t,200))},i.registerSystem=function(t,e,i){e.id=t,e.priority=i,this._systems.push(e),this._systems.sort(Yc.sortByPriority)},i.unregisterSystem=function(t){ce(this._systems,t),this._systems.sort(Yc.sortByPriority)},i.getSystem=function(t){return this._systems.find((function(e){return e.id===t}))},i.getAnimationManager=function(){return this.getSystem(m.AnimationManager.ID)},i.startAnimation=function(){this._invalid=!1},i.stopAnimation=function(){this._invalid=!0},i.mainLoop=function(t){var e;e=m.game._calculateDT(t),this.tick(e)},i.tick=function(t){if(!this._invalid){if(this.emit(e.EVENT_BEGIN_FRAME),kw._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),qs._deferredDestroy();for(var n=0;n<this._systems.length;++n)this._systems[n].postUpdate(t)}this.emit(e.EVENT_BEFORE_DRAW),vD.updateAllDirtyRenderers(),this._root.frameMove(t),this.emit(e.EVENT_AFTER_DRAW),Tm.resetHasChangedFlags(),Tm.clearNodeArray(),Vs.update(t),this.emit(e.EVENT_END_FRAME),this._totalFrames++}},i.buildRenderPipeline=function(){if(this._root){var t=this._root.customPipeline,e=this._root.cameraList;t.beginSetup();var i=m.rendering.getCustomPipeline(Ie.CUSTOM_PIPELINE_NAME);m.rendering.dispatchResizeEvents(e,i,t),i.setup(e,t),t.endSetup()}},i.setupRenderPipelineBuilder=function(){""!==Ie.CUSTOM_PIPELINE_NAME&&m.rendering&&this._root&&this._root.usesCustomPipeline&&(this.on(e.EVENT_BEFORE_RENDER,this.buildRenderPipeline,this),this.on(e.EVENT_BEFORE_SCENE_LAUNCH,m.rendering.forceResizeAllWindows,m.rendering))},i.init=function(){this._totalFrames=0,this._paused=!1,this.registerSystem($c.ID,this._scheduler,200),this._root=new ux(Qd.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(Tm.isNode(t)&&t.uuid){var e=t.uuid;if(!this._persistRootNodes[e]){var i=this._scene;if(Zs(i))if(t.parent){if(!(t.parent instanceof jR))return void q(3801);if(t.parent!==i)return void q(3802);t._originalSceneId=i.uuid}else t.parent=i,t._originalSceneId=i.uuid;this._persistRootNodes[e]=t,t._persistNode=!0,vT._addPersistNodeRef(t)}}else q(3800)},i.removePersistRootNode=function(t){var e=t.uuid||"";t===this._persistRootNodes[e]&&(delete this._persistRootNodes[e],t._persistNode=!1,t._originalSceneId="",vT._removePersistNodeRef(t))},i.isPersistRootNode=function(t){return!!t._persistNode},n(e,[{key:"root",get:function(){return this._root}}]),e}(oo));ID.EVENT_INIT="director_init",ID.EVENT_RESET="director_reset",ID.EVENT_BEFORE_SCENE_LOADING="director_before_scene_loading",ID.EVENT_BEFORE_SCENE_LAUNCH="director_before_scene_launch",ID.EVENT_AFTER_SCENE_LAUNCH="director_after_scene_launch",ID.EVENT_BEFORE_UPDATE="director_before_update",ID.EVENT_AFTER_UPDATE="director_after_update",ID.EVENT_BEFORE_DRAW="director_before_draw",ID.EVENT_AFTER_DRAW="director_after_draw",ID.EVENT_BEFORE_COMMIT="director_before_commit",ID.EVENT_BEFORE_RENDER="director_before_render",ID.EVENT_AFTER_RENDER="director_after_render",ID.EVENT_BEFORE_PHYSICS="director_before_physics",ID.EVENT_AFTER_PHYSICS="director_after_physics",ID.EVENT_BEGIN_FRAME="director_begin_frame",ID.EVENT_END_FRAME="director_end_frame",ID.instance=void 0,m.Director=ID;var xD,DD=t("director",ID.instance=m.director=new ID),OD=function(){function t(){var t=this;this._rafHandle=0,this._onTick=null,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,xs.setPreferredFramesPerSecond(this._targetFrameRate),this._isPlaying&&(this.stop(),this.start()))}},{key:"onTick",get:function(){return this._onTick},set:function(t){this._onTick=t}}]),t}(),PD=t("PipelineInputAssemblerData",(function(){this.quadIB=null,this.quadVB=null,this.quadIA=null}));st(rp.prototype,"TextureBase.prototype",[{name:"hasPremultipliedAlpha"},{name:"setPremultiplyAlpha"},{name:"setFlipY"}]),rt(fI.prototype,"RenderTexture.prototype",[{name:"getGFXWindow",customFunction:function(){return this.window}}]);var MD=((xD={})[gl.UNORM]="Uint",xD[gl.SNORM]="Int",xD[gl.UINT]="Uint",xD[gl.INT]="Int",xD[gl.UFLOAT]="Float",xD[gl.FLOAT]="Float",xD.default="Uint",xD);function ND(t){return""+(MD[t.type]||MD.default)+t.size/t.count*8}function LD(t,e,i,n,r){void 0===i&&(i=pl.R32F),void 0===n&&(n=0),void 0===r&&(r=0);var s=od[i];r||(r=s.size);for(var o="set"+ND(s),a=s.size/s.count,h=Math.floor(e.length/s.count),u=Fo.isLittleEndian,c=0;c<h;++c)for(var l=n+r*c,_=0;_<s.count;++_){var d=l+a*_;t[o](d,e[s.count*c+_],u)}}function BD(t,e,i,n,r,s){void 0===e&&(e=pl.R32F),void 0===i&&(i=0),void 0===n&&(n=t.byteLength-i),void 0===r&&(r=0),void 0===s&&(s=[]);var o=od[e];r||(r=o.size);for(var a="get"+ND(o),h=o.size/o.count,u=Math.floor(n/r),c=Fo.isLittleEndian,l=0;l<u;++l)for(var _=i+r*l,d=0;d<o.count;++d){var f=_+h*d;s[o.count*l+d]=t[a](f,c)}return s}function FD(t,e,i,n,r,s,o){void 0===i&&(i=pl.R32F),void 0===n&&(n=0),void 0===r&&(r=t.byteLength-n),void 0===s&&(s=0),o||(o=new DataView(t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)));var a=od[i];s||(s=a.size);for(var h="set"+ND(a),u="get"+ND(a),c=a.size/a.count,l=Math.floor(r/s),_=Fo.isLittleEndian,d=0;d<l;++d)for(var f=n+s*d,p=0;p<a.count;++p){var g=f+c*p,m=t[u](g,_);o[h](g,e(m,p,t),_)}return o}var kD=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._drawInfo=null,this._attributes=e,this._vertexBuffers=t,this._indexBuffer=n,this._indirectBuffer=r,this._primitiveMode=i,this._iaInfo=new F_(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],o=i.indexView?i.indexView.count:s.view.count,a=s.view.stride,h=a*o,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 d=_*a,f=l[_]*a,p=0;p<a;++p)c[d+p]=u[f+p];this._flatBuffers.push({stride:a,count:o,buffer:c})}else c.set(t.data.subarray(s.view.offset,s.view.offset+s.view.length)),this._flatBuffers.push({stride:a,count:o,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 L_("a_vertexId",pl.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 v_(vl.VERTEX|vl.TRANSFER_DST,El.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 t.EMPTY_GEOMETRIC_INFO;if(void 0===this.subMeshIdx)return t.EMPTY_GEOMETRIC_INFO;var e,i=this.mesh,n=this.subMeshIdx,r=this.attributes.find((function(t){return t.name===e_.ATTR_POSITION}));if(!r)return t.EMPTY_GEOMETRIC_INFO;switch(r.format){case pl.RG32F:case pl.RGB32F:if(!(e=i.readAttribute(n,e_.ATTR_POSITION)))return t.EMPTY_GEOMETRIC_INFO;break;case pl.RGBA32F:var s=i.readAttribute(n,e_.ATTR_POSITION);if(!s)return t.EMPTY_GEOMETRIC_INFO;var o=s.length/4;e=new Float32Array(3*o);for(var a=0;a<o;++a){var h=3*a,u=4*a;e[h]=s[u],e[h+1]=s[u+1],e[h+2]=s[u+2]}break;case pl.RG16F:case pl.RGB16F:var c=i.readAttribute(n,e_.ATTR_POSITION);if(!c)return t.EMPTY_GEOMETRIC_INFO;e=new Float32Array(c.length);for(var l=0;l<c.length;++l)e[l]=rn(c[l]);break;case pl.RGBA16F:var _=i.readAttribute(n,e_.ATTR_POSITION);if(!_)return t.EMPTY_GEOMETRIC_INFO;var d=_.length/4;e=new Float32Array(3*d);for(var f=0;f<d;++f){var p=3*f,g=4*f;e[p]=rn(_[g]),e[p+1]=rn(_[g+1]),e[p+2]=rn(_[g+2])}break;default:return t.EMPTY_GEOMETRIC_INFO}var m=i.readIndices(n)||void 0,v=new _n,y=new _n,T=od[r.format].count;2===T?(v.set(e[0],e[1],0),y.set(e[0],e[1],0)):(v.set(e[0],e[1],e[2]),y.set(e[0],e[1],e[2]));for(var E=0;E<e.length;E+=T)2===T?(v.x=e[E]>v.x?e[E]:v.x,v.y=e[E+1]>v.y?e[E+1]:v.y,y.x=e[E]<y.x?e[E]:y.x,y.y=e[E+1]<y.y?e[E+1]:y.y):(v.x=e[E]>v.x?e[E]:v.x,v.y=e[E+1]>v.y?e[E+1]:v.y,v.z=e[E+2]>v.z?e[E+2]:v.z,y.x=e[E]<y.x?e[E]:y.x,y.y=e[E+1]<y.y?e[E+1]:y.y,y.z=e[E+2]<y.z?e[E+2]:y.z);return this._geometricInfo={positions:e,indices:m,boundingBox:{max:v,min:y}},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,o=s.primitives[this.subMeshIdx];if(!s.jointMaps||void 0===o.jointMapIndex||!s.jointMaps[o.jointMapIndex])return this._jointMappedBuffers=this.vertexBuffers;for(var a=m.director.root.device,h=function(){var h=s.vertexBundles[o.vertexBundelIndices[u]];r=0,n=pl.UNKNOWN;for(var c=0;c<h.attributes.length;c++){var l=h.attributes[c];if(l.name===e_.ATTR_JOINTS){n=l.format;break}r+=od[l.format].size}if(n){var _=new Uint8Array(t.mesh.data.buffer,h.view.offset,h.view.length),d=new DataView(_.slice().buffer),f=s.jointMaps[o.jointMapIndex];FD(d,(function(t){return f.indexOf(t)}),n,r,h.view.length,h.view.stride,d);var p=a.createBuffer(new v_(vl.VERTEX|vl.TRANSFER_DST,El.DEVICE,h.view.length,h.view.stride));p.update(d.buffer),e.push(p),i.push(u)}else e.push(t.vertexBuffers[o.vertexBundelIndices[u]])},u=0;u<o.vertexBundelIndices.length;u++)h();return this._vertexIdChannel&&e.push(this._allocVertexIdBuffer(a)),e}},{key:"iaInfo",get:function(){return this._iaInfo}}]),t}());kD.EMPTY_GEOMETRIC_INFO={positions:new Float32Array,indices:new Uint8Array,boundingBox:{min:_n.ZERO,max:_n.ZERO}};var UD,GD=new Ln,HD=new Ln,zD=new Ln,VD=new Ln,WD=new Ln,XD=new Ln,jD=new Ln,YD=new _n(0,0,0),KD=new _n,qD=new Hn,QD=new _n,ZD=new _n,JD=new _n(1e7,1e7,1e7),$D=new _n(-1e7,-1e7,-1e7),tO=new _n,eO=0,iO=0,nO=function(){function t(t){this._shadowObjects=[],this._shadowCameraFar=0,this._matShadowView=new Ln,this._matShadowProj=new Ln,this._matShadowViewProj=new Ln,this._validFrustum=new Jo,this._splitFrustum=new Jo,this._lightViewFrustum=new Jo,this._castLightViewBoundingBox=new Xo,this._level=t,this._validFrustum.accurate=!0,this._splitFrustum.accurate=!0,this._lightViewFrustum.accurate=!0}var e=t.prototype;return e.copyToValidFrustum=function(t){Jo.copy(this._validFrustum,t)},e.calculateValidFrustumOrtho=function(t,e,i,n,r){Jo.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=m.director.root.device,r=t.shadowInvisibleOcclusionRange;Jo.copy(this._lightViewFrustum,this._splitFrustum),Ln.fromRT(HD,t.node.rotation,YD),Ln.invert(zD,HD);var s,o,a=zD.clone();this._lightViewFrustum.transform(zD),Xo.fromPoints(this._castLightViewBoundingBox,JD,$D),this._castLightViewBoundingBox.mergeFrustum(this._lightViewFrustum),t.csmOptimizationMode===rS.DisableRotationFix?(s=2*this._castLightViewBoundingBox.halfExtents.x,o=2*this._castLightViewBoundingBox.halfExtents.y):s=o=_n.distance(this._lightViewFrustum.vertices[0],this._lightViewFrustum.vertices[6]);var h=m.director.root.pipeline.pipelineSceneData.csmSupported?t.csmLevel:1;if(h>1&&t.csmOptimizationMode===rS.RemoveDuplicates)if(this._level>=h-1)iO=this._castLightViewBoundingBox.halfExtents.z,eO=this._castLightViewBoundingBox.center.z;else{var u=Math.abs(this._castLightViewBoundingBox.center.z-eO)+iO;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(tO.set(l.x,l.y,l.z+c+r),_n.transformMat4(tO,tO,HD),Ln.fromRT(HD,t.node.rotation,tO),Ln.invert(zD,HD),!i){var _=.5*s,d=.5*o;Ln.ortho(VD,-_,_,-d,d,.1,this._shadowCameraFar,n.capabilities.clipSpaceMinZ,n.capabilities.clipSpaceSignY),Ln.multiply(XD,VD,a),_n.transformMat4(KD,tO,XD);var f=2/e;qD.set(f,f);var p=KD.x%qD.x,g=KD.y%qD.y;QD.set(KD.x-p,KD.y-g,KD.z),Ln.invert(jD,XD),_n.transformMat4(ZD,QD,jD),Ln.fromRT(HD,t.node.rotation,ZD),Ln.invert(zD,HD),Ln.multiply(WD,VD,zD),Ln.copy(this._matShadowView,zD),Ln.copy(this._matShadowProj,VD),Ln.copy(this._matShadowViewProj,WD)}Jo.createOrtho(this._validFrustum,s,o,.1,this._shadowCameraFar,HD)},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}(),rO=function(t){function e(e){var i;return(i=t.call(this,e)||this)._splitCameraNear=0,i._splitCameraFar=0,i._csmAtlas=new on,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=m.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}(nO),sO=function(){function t(){this._castShadowObjects=[],this._layerObjects=new js(64),this._layers=[],this._levelCount=0,this._specialLayer=new nO(1),this._shadowDistance=0;for(var t=0;t<nS.LEVEL_4;t++)this._layers[t]=new rO(t)}var e=t.prototype;return e.update=function(t,e){var i=e.scene.mainLight;if(null!==i){var n=t.shadows,r=m.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=m.director.root.device,i=t.shadowOrthoSize,n=t.shadowOrthoSize,r=t.shadowNear,s=t.shadowFar;Ln.fromRT(HD,t.node.getWorldRotation(),t.node.getWorldPosition()),Ln.invert(zD,HD),Ln.ortho(VD,-i,i,-n,n,r,s,e.capabilities.clipSpaceMinZ,e.capabilities.clipSpaceSignY),Ln.multiply(WD,VD,zD),this._specialLayer.matShadowView=zD,this._specialLayer.matShadowProj=VD,this._specialLayer.matShadowViewProj=WD,this._specialLayer.calculateValidFrustumOrtho(2*i,2*n,r,s,HD)},e._splitFrustumLevels=function(t){var e=.1,i=t.shadowDistance,n=i/e,r=m.director.root.pipeline.pipelineSceneData.csmSupported?t.csmLevel:1,s=t.csmLayerLambda;this._layers[0].splitCameraNear=e;for(var o=1;o<r;o++){var a=o/r,h=s*e*Math.pow(n,a)+(1-s)*(e+(i-e)*a),u=1.005*h;this._layers[o].splitCameraNear=h,this._layers[o-1].splitCameraFar=u}this._layers[r-1].splitCameraFar=i,t.csmNeedUpdate=!1},e._calculateCSM=function(t,e,i){var n=m.director.root.pipeline.pipelineSceneData.csmSupported?e.csmLevel:1,r=n>1?.5*i.size.x:i.size.x;if(!(r<0)){this._getCameraWorldMatrix(GD,t);for(var s=n-1;s>=0;s--){var o=this._layers[s],a=o.splitCameraNear,h=o.splitCameraFar;o.calculateSplitFrustum(t,GD,a,h),o.createMatrix(e,r,!1)}n===nS.LEVEL_1?(this._specialLayer.shadowCameraFar=this._layers[0].shadowCameraFar,Ln.copy(this._specialLayer.matShadowView,this._layers[0].matShadowView),Ln.copy(this._specialLayer.matShadowProj,this._layers[0].matShadowProj),Ln.copy(this._specialLayer.matShadowViewProj,this._layers[0].matShadowViewProj),this._specialLayer.copyToValidFrustum(this._layers[0].validFrustum)):(this._specialLayer.calculateSplitFrustum(t,GD,.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();Ln.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}(),oO=t("PipelineSceneData",function(){function t(){this.fog=new gS,this.ambient=new Um,this.skybox=new _S,this.shadows=new oS,this.csmLayers=new sO,this.octree=new xI,this.skin=new DI,this.postSettings=new Gb,this.lightProbes=m.internal.LightProbes?new m.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 $E,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 $E;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 v_(vl.VERTEX|vl.TRANSFER_DST,El.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,o=36*s;this._occlusionQueryIndicesBuffer=t.createBuffer(new v_(vl.INDEX|vl.TRANSFER_DST,El.DEVICE,o,s)),this._occlusionQueryIndicesBuffer.update(r);var a=[new L_("a_position",pl.RGB32F)],h=new F_(a,[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}()),aO=jn(),hO=((UD={})[Ie.ORIENTATION_AUTO]=Re.AUTO,UD[Ie.ORIENTATION_LANDSCAPE]=Re.LANDSCAPE,UD[Ie.ORIENTATION_PORTRAIT]=Re.PORTRAIT,UD),uO=t("View",function(t){function e(){var e;(e=t.call(this)||this)._designResolutionSize=jn(0,0),e._scaleX=1,e._scaleY=1,e._viewportRect=Kn(),e._visibleRect=Kn(),e._autoFullScreen=!1,e._retinaEnabled=!1,e._resizeCallback=null;var i=cO,n=lO;return e._rpExactFit=new yO(i.EQUAL_TO_FRAME,n.EXACT_FIT),e._rpShowAll=new yO(i.EQUAL_TO_FRAME,n.SHOW_ALL),e._rpNoBorder=new yO(i.EQUAL_TO_FRAME,n.NO_BORDER),e._rpFixedHeight=new yO(i.EQUAL_TO_FRAME,n.FIXED_HEIGHT),e._rpFixedWidth=new yO(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=Bo.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,aO.width=this._visibleRect.width,aO.height=this._visibleRect.height,ko&&ko.init(this._visibleRect),this.resizeWithBrowserSize(!0);var n=we.querySettings(Ce.Category.SCREEN,"designResolution");n&&this.setDesignResolutionSize(Number(n.width),Number(n.height),n.policy||yO.FIXED_HEIGHT),Bo.on("window-resize",this._updateAdaptResult,this),Bo.on("fullscreen-change",this._updateAdaptResult,this)},i.resizeWithBrowserSize=function(t){No.handleResizeEvent=t},i.setResizeCallback=function(t){"function"!=typeof t&&null!=t||(this._resizeCallback=t)},i.setOrientation=function(t){No.orientation=hO[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&&Bo.requestFullScreen().catch((function(){})))},i.isAutoFullScreenEnabled=function(){return this._autoFullScreen},i.setCanvasSize=function(t,e){No.resolutionScale=1;var i=No.devicePixelRatio,n=new Xn(t*i,e*i);Bo.windowSize=n},i.getCanvasSize=function(){return Bo.windowSize},i.getFrameSize=function(){var t=No.devicePixelRatio,e=Bo.windowSize;return e.width/=t,e.height/=t,e},i.setFrameSize=function(t,e){var i=No.devicePixelRatio;Bo.windowSize=new Xn(t*i,e*i)},i.getVisibleSize=function(){return new Xn(this._visibleRect.width,this._visibleRect.height)},i.getVisibleSizeInPixel=function(){return new Xn(this._visibleRect.width*this._scaleX,this._visibleRect.height*this._scaleY)},i.getVisibleOrigin=function(){return new Hn(this._visibleRect.x,this._visibleRect.y)},i.getVisibleOriginInPixel=function(){return new Hn(this._visibleRect.x*this._scaleX,this._visibleRect.y*this._scaleY)},i.getResolutionPolicy=function(){return this._resolutionPolicy},i._updateResolutionPolicy=function(t){if(t instanceof yO)this._resolutionPolicy=t;else{var e=yO;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=TO.getDesignResolutionSize();TO.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,o=this._visibleRect,a=r.viewport;s.x=a.x,s.y=a.y,s.width=a.width,s.height=a.height,o.x=0,o.y=0,o.width=a.width/this._scaleX,o.height=a.height/this._scaleY}n.postApply(this),aO.width=this._visibleRect.width,aO.height=this._visibleRect.height,ko&&ko.init(this._visibleRect),this.emit("design-resolution-changed")}else Z(2200)},i.getDesignResolutionSize=function(){return new Xn(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 No.devicePixelRatio},i.convertToLocationInView=function(t,e,i,n){void 0===n&&(n=new Hn);var r=No.devicePixelRatio*(t-i.left),s=No.devicePixelRatio*(i.top+i.height-e);return No.isFrameRotated?(n.x=Bo.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;m.director.root.resize(t,e,void 0===i||0===i?1:i);var r=this._designResolutionSize.width,s=this._designResolutionSize.height;t>0&&e>0?this.setDesignResolutionSize(r,s,this._resolutionPolicy):U(!1,"_updateAdaptResult Invalid size."),this.emit("canvas-resize"),null===(n=this._resizeCallback)||void 0===n||n.call(this)},e}(so(Yc)));uO.instance=void 0;var cO=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=m.game.canvas;if(t){var e=Bo.windowSize;t.width!==e.width&&(t.width=e.width),t.height!==e.height&&(t.height=e.height)}},t}();cO.EQUAL_TO_FRAME=void 0,cO.PROPORTION_TO_FRAME=void 0;var lO=function(){function t(){this.name="ContentStrategy",this._result={scale:[1,1],viewport:null},this._strategy=yO.UNKNOWN}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 o=new Yn(Math.round((t-i)/2),Math.round((e-n)/2),i,n);return this._result.scale=[r,s],this._result.viewport=o,this._result},n(t,[{key:"strategy",get:function(){return this._strategy}}]),t}(),_O=function(t){function e(){var e;return(e=t.call(this)||this).name="EqualToFrame",e}return s(e,t),e.prototype.apply=function(){No.isProportionalToFrame=!1,this._setupCanvas()},e}(cO),dO=function(t){function e(){var e;return(e=t.call(this)||this).name="ProportionalToFrame",e}return s(e,t),e.prototype.apply=function(){No.isProportionalToFrame=!0,this._setupCanvas()},e}(cO);cO.EQUAL_TO_FRAME=new _O,cO.PROPORTION_TO_FRAME=new dO;var fO=function(t){function e(){var e;return(e=t.call(this)||this).name="ExactFit",e._strategy=yO.EXACT_FIT,e}return s(e,t),e.prototype.apply=function(t,e){var i=Bo.windowSize,n=i.width,r=i.height,s=n/e.width,o=r/e.height;return this._buildResult(n,r,n,r,s,o)},e}(lO),pO=function(t){function e(){var e;return(e=t.call(this)||this).name="ShowAll",e._strategy=yO.SHOW_ALL,e}return s(e,t),e.prototype.apply=function(t,e){var i,n,r=Bo.windowSize,s=r.width,o=r.height,a=e.width,h=e.height,u=s/a,c=o/h,l=0;return u<c?(i=s,n=h*(l=u)):(i=a*(l=c),n=o),this._buildResult(s,o,i,n,l,l)},e}(lO),gO=function(t){function e(){var e;return(e=t.call(this)||this).name="NoBorder",e._strategy=yO.NO_BORDER,e}return s(e,t),e.prototype.apply=function(t,e){var i,n,r,s=Bo.windowSize,o=s.width,a=s.height,h=e.width,u=e.height,c=o/h,l=a/u;return c<l?(n=h*(i=l),r=a):(n=o,r=u*(i=c)),this._buildResult(o,a,n,r,i,i)},e}(lO),mO=function(t){function e(){var e;return(e=t.call(this)||this).name="FixedHeight",e._strategy=yO.FIXED_HEIGHT,e}return s(e,t),e.prototype.apply=function(t,e){var i=Bo.windowSize,n=i.width,r=i.height,s=r/e.height,o=n,a=r;return this._buildResult(n,r,o,a,s,s)},e}(lO),vO=function(t){function e(){var e;return(e=t.call(this)||this).name="FixedWidth",e._strategy=yO.FIXED_WIDTH,e}return s(e,t),e.prototype.apply=function(t,e){var i=Bo.windowSize,n=i.width,r=i.height,s=n/e.width,o=n,a=r;return this._buildResult(n,r,o,a,s,s)},e}(lO),yO=t("ResolutionPolicy",function(){function t(t,e){this.name="ResolutionPolicy",this._containerStrategy=t,this._contentStrategy=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){this._containerStrategy=t},e.setContentStrategy=function(t){this._contentStrategy=t},e.getContentStrategy=function(){return this._contentStrategy},n(t,[{key:"canvasSize",get:function(){return Bo.windowSize}}]),t}());yO.EXACT_FIT=0,yO.NO_BORDER=1,yO.SHOW_ALL=2,yO.FIXED_HEIGHT=3,yO.FIXED_WIDTH=4,yO.UNKNOWN=5,yO.ContainerStrategy=cO,yO.ContentStrategy=lO,m.ResolutionPolicy=yO,lO.EXACT_FIT=new fO,lO.SHOW_ALL=new pO,lO.NO_BORDER=new gO,lO.FIXED_HEIGHT=new mO,lO.FIXED_WIDTH=new vO;var TO=t("view",uO.instance=m.view=new uO);DD.registerSystem("view",TO,0),m.winSize=aO,new Hn,new q_(null);var EO=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.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(){return Promise.resolve([])},t.preInit=function(){},t.initLayout=function(){},t.initScale=function(){},t.update=function(){},t.initBG=function(){},t.initLogo=function(){},t.initWaterMark=function(){},t.frame=function(){},t.destroy=function(){},n(e,[{key:"isFinished",get:function(){return!0}},{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}();EO._ins=void 0,m.internal.SplashScreen=EO;var SO=new(function(){function t(){this._data=null}return t.prototype.init=function(t){var e=this;return void 0===t&&(t=""),m.rendering&&m.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 globalThis.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}());m.effectSettings=SO;var AO=t("Game",function(t){function i(){var e;return(e=t.call(this)||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 po,e.onPostBaseInitDelegate=new po,e.onPreInfrastructureInitDelegate=new po,e.onPostInfrastructureInitDelegate=new po,e.onPreSubsystemInitDelegate=new po,e.onPostSubsystemInitDelegate=new po,e.onPreProjectInitDelegate=new po,e.onPostProjectInitDelegate=new po,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(){DD.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&&(kw._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){DD.once(ID.EVENT_END_FRAME,(function(){return t()}))})).then((function(){DD.reset(),m.Object._deferredDestroy(),t.pause(),t.resume(),t._shouldLoadLaunchScene=!0,EO.instance.curTime=0,t._safeEmit(i.EVENT_RESTART)}))},r.end=function(){go.close()},r.on=function(t,e,i,n){return this.canRegisterEvent(t)&&e.call(i),this.eventTargetOn(t,e,i,n)},r.once=function(t,e,i){return this.canRegisterEvent(t)?e.call(i):this.eventTargetOnce(t,e,i)},r.canRegisterEvent=function(t){return this._engineInited&&t===i.EVENT_ENGINE_INITED||this._inited&&t===i.EVENT_GAME_INITED||this._rendererInitialized&&t===i.EVENT_RENDERER_INITED},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(){H(t.debugMode||J.NONE)})).then((function(){return Fo.init()})).then((function(){n._initEvents()})).then((function(){return we.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(){Ie.init(),n._initXR();var t,e={frame:t=document.createElement("div"),canvas:window.canvas,container:t};return e&&(n.canvas=e.canvas,n.frame=e.frame,n.container=e.container),Bo.init(),ol.init(),Qd.init(n.canvas,Qm)})).then((function(){if(we.querySettings(Ce.Category.RENDERING,"customPipeline")){if(!m.rendering)return void Z(12109);Ie.CUSTOM_PIPELINE_NAME||(Ie.CUSTOM_PIPELINE_NAME="Builtin")}else m.rendering=void 0;xE.init(),NE.init(),Rg.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 SO.init(we.querySettings(Ce.Category.RENDERING,"effectSettingsPath"))})).then((function(){if(m.rendering&&m.rendering.enableEffectImport)if(we.querySettings(Ce.Category.RENDERING,"renderMode")!==Wd.HEADLESS){var t=SO.data;null!==t?m.rendering.init(Qd.gfxDevice,t):Z(1102)}else m.rendering.init(Qd.gfxDevice,null)})).then((function(){var t=we.querySettings(Ce.Category.SCRIPTING,"scriptPackages");return t?Promise.all(t.map((function(t){return e.import(t)}))):Promise.resolve([])})).then((function(){return DD.init(),NE.loadBuiltinAssets()})).then((function(){return n.emit(i.EVENT_POST_SUBSYSTEM_INIT),n.onPostSubsystemInitDelegate.dispatch()})).then((function(){B("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=we.querySettings(Ce.Category.PLUGINS,"jsList"),e=Promise.resolve();return t&&t.forEach((function(t){e=e.then((function(){return __wxRequire("src/"+t)}))})),e})).then((function(){return n._loadProjectBundles()})).then((function(){return n._loadCCEScripts()})).then((function(){return n._setupRenderPipeline()})).then((function(){return n._loadPreloadAssets()})).then((function(){return NE.compileBuiltinMaterial(),EO.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=we.querySettings(Ce.Category.XR,"webxrCompatible"))&&void 0!==t&&t,Fo.isXR){var e,i;xr.entry=xr.XrEntry.getInstance();var n=null!==(e=we.querySettings(Ce.Category.RENDERING,"msaa"))&&void 0!==e?e:1,r=null!==(i=we.querySettings(Ce.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=we.querySettings(Ce.Category.ASSETS,"preloadAssets");return t?Promise.all(t.map((function(t){return new Promise((function(e,i){xE.loadAny(t,(function(t){t?i(t):e()}))}))}))):Promise.resolve([])},r._loadCCEScripts=function(){return new Promise((function(t){t()}))},r._loadProjectBundles=function(){var t=we.querySettings(Ce.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),xE.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(EO.instance.isFinished)if(this._shouldLoadLaunchScene){this._shouldLoadLaunchScene=!1;var e,i=we.querySettings(Ce.Category.LAUNCH,"launchScene");i?DD.loadScene(i,(function(){var e;X(1103,i),t._initTime=performance.now(),DD.startAnimation(),null===(e=t.onStart)||void 0===e||e.call(t)})):(this._initTime=performance.now(),DD.startAnimation(),null===(e=this.onStart)||void 0===e||e.call(this))}else DD.tick(this._calculateDT(!1));else EO.instance.update(this._calculateDT(!1))},r.initPacer=function(){var t,e=null!==(t=we.querySettings(Ce.Category.SCREEN,"frameRate"))&&void 0!==t?t:60;U("number"==typeof e),this._pacer=new OD,this._pacer.onTick=this._updateCallback.bind(this),this.frameRate=e},r._initEvents=function(){go.on("show",this._onShow,this),go.on("hide",this._onHide,this),go.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),go.exit()},r.addPersistRootNode=function(t){DD.addPersistRootNode(t)},r.removePersistRootNode=function(t){DD.removePersistRootNode(t)},r.isPersistRootNode=function(t){return DD.isPersistRootNode(t)},r._setupRenderPipeline=function(){var t=we.querySettings(Ce.Category.RENDERING,"customPipeline");return this._setRenderPipeline(!!t)},r._setRenderPipeline=function(t){DD.root.setRenderPipeline(t)?(this._rendererInitialized=!0,this._safeEmit(i.EVENT_RENDERER_INITED)):Z(1222)},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}(oo));AO.EVENT_HIDE="game_on_hide",AO.EVENT_SHOW="game_on_show",AO.EVENT_LOW_MEMORY="game_on_low_memory",AO.EVENT_GAME_INITED="game_inited",AO.EVENT_ENGINE_INITED="engine_inited",AO.EVENT_RENDERER_INITED="renderer_inited",AO.EVENT_PRE_BASE_INIT="pre_base_init",AO.EVENT_POST_BASE_INIT="post_base_init",AO.EVENT_PRE_INFRASTRUCTURE_INIT="pre_infrastructure_init",AO.EVENT_POST_INFRASTRUCTURE_INIT="post_infrastructure_init",AO.EVENT_PRE_SUBSYSTEM_INIT="pre_subsystem_init",AO.EVENT_POST_SUBSYSTEM_INIT="post_subsystem_init",AO.EVENT_PRE_PROJECT_INIT="pre_project_init",AO.EVENT_POST_PROJECT_INIT="post_project_init",AO.EVENT_RESTART="game_on_restart",AO.EVENT_PAUSE="game_on_pause",AO.EVENT_RESUME="game_on_resume",AO.EVENT_CLOSE="game_on_close",AO.RENDER_TYPE_CANVAS=0,AO.RENDER_TYPE_WEBGL=1,AO.RENDER_TYPE_OPENGL=2,AO.RENDER_TYPE_HEADLESS=3,AO.DEBUG_DT_THRESHOLD=1,m.Game=AO;var bO=t("game",m.game=new AO);ot(ID.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"}]),st(ID.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"}]),rt(DD,"director",[{name:"_getSceneUuid",targetName:"assetManager.main",newName:"getSceneInfo",customFunction:function(t){var e;return xE.main?null===(e=xE.main.getSceneInfo(t))||void 0===e?void 0:e.uuid:""}}]),ot(bO,"game",[{name:"collisionMatrix"},{name:"groupList"}]),rt(bO,"game",[{name:"_sceneInfos",targetName:"assetManager.main",newName:"getSceneInfo",customGetter:function(){var t=[];return xE.main&&xE.main.config.scenes.forEach((function(e){t.push(e)})),t}}]);var CO=t("DynamicAtlasManager",function(t){function e(){var e;return(e=t.call(this)||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&&this._atlasIndex<this.maxAtlasCount&&(t=new Ag(this._textureSize,this._textureSize),this._atlases.push(t)),t},i.beforeSceneLoad=function(){this.reset()},i.init=function(){this.enabled=!Ie.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!==Il.LINEAR||e.magFilter!==Il.LINEAR||e.mipFilter!==Il.NONE)return null;var i=this._atlases[this._atlasIndex];i||(i=this.newAtlas());var n=i?i.insertSpriteFrame(t):null;return!n&&this._atlasIndex<this._maxAtlasCount?(i=this.newAtlas())?i.insertSpriteFrame(t):null:n},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--)this._atlases[e].removeSpriteFrame(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(),m.director.on(m.Director.EVENT_BEFORE_SCENE_LAUNCH,this.beforeSceneLoad,this)):(this.reset(),m.director.off(m.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}(Yc));CO.instance=void 0;var RO,wO=t("dynamicAtlasManager",CO.instance=new CO);DD.registerSystem("dynamicAtlasManager",wO,0),m.internal.dynamicAtlasManager=wO,function(t){t[t.positions=e_.ATTR_POSITION]="positions",t[t.normals=e_.ATTR_NORMAL]="normals",t[t.uvs=e_.ATTR_TEX_COORD]="uvs",t[t.colors=e_.ATTR_COLOR]="colors"}(RO||(RO={}));var IO,xO=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}(),DO=function(){function t(t,e){if(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>Cv.MAX_MORPH_TARGET_COUNT?this._subMeshRenderings[n]=new PO(this._mesh,n,this._mesh.struct.morph,e):this._subMeshRenderings[n]=new OO(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(e_.ATTR_POSITION)&&s.push({name:"CC_MORPH_TARGET_HAS_POSITION",value:!0}),n.attributes.includes(e_.ATTR_NORMAL)&&s.push({name:"CC_MORPH_TARGET_HAS_NORMAL",value:!0}),n.attributes.includes(e_.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}(),OO=function(){function t(t,e,i,n){this._gfxDevice=n;var r=i.subMeshMorphs[e];this._subMeshMorph=r,BO(t,e,n);var s=t.struct.vertexBundles[t.struct.primitives[e].vertexBundelIndices[0]].view.count;this._verticesCount=s;var o=r.targets.length,a=LO(n,s*o);this._textureInfo={width:a.width,height:a.height},this._attributes=r.attributes.map((function(e,i){var n=a.create(),o=n.valueView;return r.targets.forEach((function(e,n){for(var r=e.displacements[i],a=new Float32Array(t.data.buffer,t.data.byteOffset+r.offset,r.count),h=s*n*4,u=0;u<s;++u)o[h+4*u+0]=a[3*u+0],o[h+4*u+1]=a[3*u+1],o[h+4*u+2]=a[3*u+2]})),n.updatePixels(),{name:e,morphTexture:n}}))}var e=t.prototype;return e.destroy=function(){for(var t,e=d(this._attributes);!(t=e()).done;)t.value.morphTexture.destroy()},e.createInstance=function(){var t=this,e=new NO(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=d(t._attributes);!(n=r()).done;){var s=n.value,o=void 0;switch(s.name){case e_.ATTR_POSITION:o=Nv;break;case e_.ATTR_NORMAL:o=Fv;break;case e_.ATTR_TANGENT:o=Gv;break;default:q(16374)}void 0!==o&&(i.bindSampler(o,s.morphTexture.sampler),i.bindTexture(o,s.morphTexture.texture))}i.bindBuffer(Cv.BINDING,e.buffer),i.update()},destroy:function(){}}},t}(),PO=function(){function t(t,e,i,n){this._attributes=[],this._gfxDevice=n;var r=i.subMeshMorphs[e];BO(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 MO(this,this._attributes[0].targets[0].displacements.length/3,this._gfxDevice)},n(t,[{key:"data",get:function(){return this._attributes}}]),t}(),MO=function(){function t(t,e,i){this._owner=t,this._morphUniforms=new NO(i,0);var n=LO(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 o=r.targets[s].displacements,a=t[s],h=o.length/3;if(0===s)for(var u=0;u<h;++u)n[4*u+0]=o[3*u+0]*a,n[4*u+1]=o[3*u+1]*a,n[4*u+2]=o[3*u+2]*a;else if(0!==a)for(var c=0;c<h;++c)n[4*c+0]+=o[3*c+0]*a,n[4*c+1]+=o[3*c+1]*a,n[4*c+2]+=o[3*c+2]*a}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=d(this._attributes);!(e=i()).done;){var n=e.value,r=void 0;switch(n.attributeName){case e_.ATTR_POSITION:r=Nv;break;case e_.ATTR_NORMAL:r=Fv;break;case e_.ATTR_TANGENT:r=Gv;break;default:q(16374)}void 0!==r&&(t.bindSampler(r,n.morphTexture.sampler),t.bindTexture(r,n.morphTexture.texture))}t.bindBuffer(Cv.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}(),NO=function(){function t(t,e){this._targetCount=e,this._localBuffer=new DataView(new ArrayBuffer(Cv.SIZE)),this._remoteBuffer=t.createBuffer(new v_(vl.UNIFORM|vl.TRANSFER_DST,El.HOST|El.DEVICE,Cv.SIZE,Cv.SIZE))}var e=t.prototype;return e.destroy=function(){this._remoteBuffer.destroy()},e.setWeights=function(t){t.length,this._targetCount;for(var e=m.sys.isLittleEndian,i=0;i<t.length;++i)this._localBuffer.setFloat32(Cv.OFFSET_OF_WEIGHTS+4*i,t[i],e)},e.setMorphTextureInfo=function(t,e){var i=m.sys.isLittleEndian;this._localBuffer.setFloat32(Cv.OFFSET_OF_DISPLACEMENT_TEXTURE_WIDTH,t,i),this._localBuffer.setFloat32(Cv.OFFSET_OF_DISPLACEMENT_TEXTURE_HEIGHT,e,i)},e.setVerticesCount=function(t){var e=m.sys.isLittleEndian;this._localBuffer.setFloat32(Cv.OFFSET_OF_VERTICES_COUNT,t,e)},e.commit=function(){this._remoteBuffer.update(this._localBuffer.buffer)},n(t,[{key:"buffer",get:function(){return this._remoteBuffer}}]),t}();function LO(t,e){var i,n,r,s;t.getFormatFeatures(pl.RGBA32F)&Cl.SAMPLED_TEXTURE?(i=e,r=16,n=Sg.PixelFormat.RGBA32F,s=Float32Array):(i=4*e,r=4,n=Sg.PixelFormat.RGBA8888,s=Uint8Array);var o=function(t){t<5&&(t=5);var e=E(Wi(t)),i=e>>1;return{width:1<<(1&e?i+1:i),height:1<<i}}(i),a=o.width,h=o.height;return{width:a,height:h,create:function(){var e=new ArrayBuffer(a*h*r),i=new Float32Array(e),o=s===Float32Array?i:new s(e),u=new $f({width:a,height:h,_data:o,_compressed:!1,format:n}),c=new Sg;c.setFilters(Sg.Filter.NEAREST,Sg.Filter.NEAREST),c.setMipFilter(Sg.Filter.NONE),c.setWrapMode(Sg.WrapMode.CLAMP_TO_EDGE,Sg.WrapMode.CLAMP_TO_EDGE,Sg.WrapMode.CLAMP_TO_EDGE),c.image=u,c.getGFXTexture()||q(16375);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(o)}}}}}function BO(t,e,i){t.renderingSubMeshes[e].enableVertexIdChannel(i)}function FO(t,e){return(i=t,new Promise((function(t){t("cocos-js/"+i)}))).then((function(t){return CCWebAssembly.instantiate(t,e)}));var i}function kO(){return IO||(IO=new Promise((function(t,e){Promise.all(["__ccWasmAssetSubpkg__","__ccWasmChunkSubpkg__"].map((function(t){return function(t){return new Promise((function(e,i){xs.loadSubpackage?xs.loadSubpackage({name:t,success:function(){e()},fail:function(i){B("Load subpacakge '"+t+"' failed, maybe we don't need this subpacakge or it's an engine build issue, for detailed: ",i),e()}}):i(new Error("Subpackage is not supported on this platform"))}))}(t)}))).then((function(){t()})).catch(e)})))}var UO={},GO={};
  2. /** @license zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License */(function(){function t(t){throw t}var e=void 0,i=!0,n=this;function r(t,i){var r,s=t.split("."),o=n;!(s[0]in o)&&o.execScript&&o.execScript("var "+s[0]);for(;s.length&&(r=s.shift());)s.length||i===e?o=o[r]?o[r]:o[r]={}:o[r]=i}var s="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array;function o(t){if("string"==typeof t){var e,i,n=t.split("");for(e=0,i=n.length;e<i;e++)n[e]=(255&n[e].charCodeAt(0))>>>0;t=n}for(var r,s=1,o=0,a=t.length,h=0;0<a;){a-=r=1024<a?1024:a;do{o+=s+=t[h++]}while(--r);s%=65521,o%=65521}return(o<<16|s)>>>0}function a(e,i){this.index="number"==typeof i?i:0,this.i=0,this.buffer=e instanceof(s?Uint8Array:Array)?e:new(s?Uint8Array:Array)(32768),2*this.buffer.length<=this.index&&t(Error("invalid index")),this.buffer.length<=this.index&&this.f()}a.prototype.f=function(){var t,e=this.buffer,i=e.length,n=new(s?Uint8Array:Array)(i<<1);if(s)n.set(e);else for(t=0;t<i;++t)n[t]=e[t];return this.buffer=n},a.prototype.d=function(t,e,i){var n,r=this.buffer,s=this.index,o=this.i,a=r[s];if(i&&1<e&&(t=8<e?(d[255&t]<<24|d[t>>>8&255]<<16|d[t>>>16&255]<<8|d[t>>>24&255])>>32-e:d[t]>>8-e),8>e+o)a=a<<e|t,o+=e;else for(n=0;n<e;++n)a=a<<1|t>>e-n-1&1,8==++o&&(o=0,r[s++]=d[a],a=0,s===r.length&&(r=this.f()));r[s]=a,this.buffer=r,this.i=o,this.index=s},a.prototype.finish=function(){var t,e=this.buffer,i=this.index;return 0<this.i&&(e[i]<<=8-this.i,e[i]=d[e[i]],i++),s?t=e.subarray(0,i):(e.length=i,t=e),t};var h,u=new(s?Uint8Array:Array)(256);for(h=0;256>h;++h){for(var c=_=h,l=7,_=_>>>1;_;_>>>=1)c<<=1,c|=1&_,--l;u[h]=(c<<l&255)>>>0}var d=u;function f(t){this.buffer=new(s?Uint16Array:Array)(2*t),this.length=0}function p(t){var e,i,n,r,o,a,h,u,c,l=t.length,_=0,d=Number.POSITIVE_INFINITY;for(u=0;u<l;++u)t[u]>_&&(_=t[u]),t[u]<d&&(d=t[u]);for(e=1<<_,i=new(s?Uint32Array:Array)(e),n=1,r=0,o=2;n<=_;){for(u=0;u<l;++u)if(t[u]===n){for(a=0,h=r,c=0;c<n;++c)a=a<<1|1&h,h>>=1;for(c=a;c<e;c+=o)i[c]=n<<16|u;++r}++n,r<<=1,o<<=1}return[i,_,d]}function g(t,e){this.h=v,this.w=0,this.input=t,this.b=0,e&&(e.lazy&&(this.w=e.lazy),"number"==typeof e.compressionType&&(this.h=e.compressionType),e.outputBuffer&&(this.a=s&&e.outputBuffer instanceof Array?new Uint8Array(e.outputBuffer):e.outputBuffer),"number"==typeof e.outputIndex&&(this.b=e.outputIndex)),this.a||(this.a=new(s?Uint8Array:Array)(32768))}f.prototype.getParent=function(t){return 2*((t-2)/4|0)},f.prototype.push=function(t,e){var i,n,r,s=this.buffer;for(i=this.length,s[this.length++]=e,s[this.length++]=t;0<i&&(n=this.getParent(i),s[i]>s[n]);)r=s[i],s[i]=s[n],s[n]=r,r=s[i+1],s[i+1]=s[n+1],s[n+1]=r,i=n;return this.length},f.prototype.pop=function(){var t,e,i,n,r,s=this.buffer;for(e=s[0],t=s[1],this.length-=2,s[0]=s[this.length],s[1]=s[this.length+1],r=0;!((n=2*r+2)>=this.length)&&(n+2<this.length&&s[n+2]>s[n]&&(n+=2),s[n]>s[r]);)i=s[r],s[r]=s[n],s[n]=i,i=s[r+1],s[r+1]=s[n+1],s[n+1]=i,r=n;return{index:t,value:e,length:this.length}};var m,v=2,y={NONE:0,r:1,j:v,N:3},T=[];for(m=0;288>m;m++)switch(i){case 143>=m:T.push([m+48,8]);break;case 255>=m:T.push([m-144+400,9]);break;case 279>=m:T.push([m-256+0,7]);break;case 287>=m:T.push([m-280+192,8]);break;default:t("invalid literal: "+m)}function E(t,e){this.length=t,this.G=e}function S(){var e=A;switch(i){case 3===e:return[257,e-3,0];case 4===e:return[258,e-4,0];case 5===e:return[259,e-5,0];case 6===e:return[260,e-6,0];case 7===e:return[261,e-7,0];case 8===e:return[262,e-8,0];case 9===e:return[263,e-9,0];case 10===e:return[264,e-10,0];case 12>=e:return[265,e-11,1];case 14>=e:return[266,e-13,1];case 16>=e:return[267,e-15,1];case 18>=e:return[268,e-17,1];case 22>=e:return[269,e-19,2];case 26>=e:return[270,e-23,2];case 30>=e:return[271,e-27,2];case 34>=e:return[272,e-31,2];case 42>=e:return[273,e-35,3];case 50>=e:return[274,e-43,3];case 58>=e:return[275,e-51,3];case 66>=e:return[276,e-59,3];case 82>=e:return[277,e-67,4];case 98>=e:return[278,e-83,4];case 114>=e:return[279,e-99,4];case 130>=e:return[280,e-115,4];case 162>=e:return[281,e-131,5];case 194>=e:return[282,e-163,5];case 226>=e:return[283,e-195,5];case 257>=e:return[284,e-227,5];case 258===e:return[285,e-258,0];default:t("invalid length: "+e)}}g.prototype.n=function(){var n,r,o,h,u=this.input;switch(this.h){case 0:for(o=0,h=u.length;o<h;){var c,l,_,d=r=s?u.subarray(o,o+65535):u.slice(o,o+65535),f=(o+=r.length)===h,p=e,g=e,m=this.a,y=this.b;if(s){for(m=new Uint8Array(this.a.buffer);m.length<=y+d.length+5;)m=new Uint8Array(m.length<<1);m.set(this.a)}if(c=f?1:0,m[y++]=0|c,_=65536+~(l=d.length)&65535,m[y++]=255&l,m[y++]=l>>>8&255,m[y++]=255&_,m[y++]=_>>>8&255,s)m.set(d,y),y+=d.length,m=m.subarray(0,y);else{for(p=0,g=d.length;p<g;++p)m[y++]=d[p];m.length=y}this.b=y,this.a=m}break;case 1:var E=new a(new Uint8Array(this.a.buffer),this.b);E.d(1,1,i),E.d(1,2,i);var S,A,b,C=w(this,u);for(S=0,A=C.length;S<A;S++)if(b=C[S],a.prototype.d.apply(E,T[b]),256<b)E.d(C[++S],C[++S],i),E.d(C[++S],5),E.d(C[++S],C[++S],i);else if(256===b)break;this.a=E.finish(),this.b=this.a.length;break;case v:var R,D,O,P,M,N,L,B,F,k,U,G,H,z,V,W=new a(new Uint8Array(this.a),this.b),X=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],j=Array(19);for(R=v,W.d(1,1,i),W.d(R,2,i),D=w(this,u),L=x(N=I(this.L,15)),F=x(B=I(this.K,7)),O=286;257<O&&0===N[O-1];O--);for(P=30;1<P&&0===B[P-1];P--);var Y,K,q,Q,Z,J,$=O,tt=P,et=new(s?Uint32Array:Array)($+tt),it=new(s?Uint32Array:Array)(316),nt=new(s?Uint8Array:Array)(19);for(Y=K=0;Y<$;Y++)et[K++]=N[Y];for(Y=0;Y<tt;Y++)et[K++]=B[Y];if(!s)for(Y=0,Q=nt.length;Y<Q;++Y)nt[Y]=0;for(Y=Z=0,Q=et.length;Y<Q;Y+=K){for(K=1;Y+K<Q&&et[Y+K]===et[Y];++K);if(q=K,0===et[Y])if(3>q)for(;0<q--;)it[Z++]=0,nt[0]++;else for(;0<q;)(J=138>q?q:138)>q-3&&J<q&&(J=q-3),10>=J?(it[Z++]=17,it[Z++]=J-3,nt[17]++):(it[Z++]=18,it[Z++]=J-11,nt[18]++),q-=J;else if(it[Z++]=et[Y],nt[et[Y]]++,3>--q)for(;0<q--;)it[Z++]=et[Y],nt[et[Y]]++;else for(;0<q;)(J=6>q?q:6)>q-3&&J<q&&(J=q-3),it[Z++]=16,it[Z++]=J-3,nt[16]++,q-=J}for(n=s?it.subarray(0,Z):it.slice(0,Z),k=I(nt,7),z=0;19>z;z++)j[z]=k[X[z]];for(M=19;4<M&&0===j[M-1];M--);for(U=x(k),W.d(O-257,5,i),W.d(P-1,5,i),W.d(M-4,4,i),z=0;z<M;z++)W.d(j[z],3,i);for(z=0,V=n.length;z<V;z++)if(G=n[z],W.d(U[G],k[G],i),16<=G){switch(z++,G){case 16:H=2;break;case 17:H=3;break;case 18:H=7;break;default:t("invalid code: "+G)}W.d(n[z],H,i)}var rt,st,ot,at,ht,ut,ct,lt,_t=[L,N],dt=[F,B];for(ht=_t[0],ut=_t[1],ct=dt[0],lt=dt[1],rt=0,st=D.length;rt<st;++rt)if(ot=D[rt],W.d(ht[ot],ut[ot],i),256<ot)W.d(D[++rt],D[++rt],i),at=D[++rt],W.d(ct[at],lt[at],i),W.d(D[++rt],D[++rt],i);else if(256===ot)break;this.a=W.finish(),this.b=this.a.length;break;default:t("invalid compression type")}return this.a};var A,b,C=[];for(A=3;258>=A;A++)b=S(),C[A]=b[2]<<24|b[1]<<16|b[0];var R=s?new Uint32Array(C):C;function w(n,r){function o(e,n){var r,s,o,a,h=e.G,u=[],c=0;switch(r=R[e.length],u[c++]=65535&r,u[c++]=r>>16&255,u[c++]=r>>24,i){case 1===h:s=[0,h-1,0];break;case 2===h:s=[1,h-2,0];break;case 3===h:s=[2,h-3,0];break;case 4===h:s=[3,h-4,0];break;case 6>=h:s=[4,h-5,1];break;case 8>=h:s=[5,h-7,1];break;case 12>=h:s=[6,h-9,2];break;case 16>=h:s=[7,h-13,2];break;case 24>=h:s=[8,h-17,3];break;case 32>=h:s=[9,h-25,3];break;case 48>=h:s=[10,h-33,4];break;case 64>=h:s=[11,h-49,4];break;case 96>=h:s=[12,h-65,5];break;case 128>=h:s=[13,h-97,5];break;case 192>=h:s=[14,h-129,6];break;case 256>=h:s=[15,h-193,6];break;case 384>=h:s=[16,h-257,7];break;case 512>=h:s=[17,h-385,7];break;case 768>=h:s=[18,h-513,8];break;case 1024>=h:s=[19,h-769,8];break;case 1536>=h:s=[20,h-1025,9];break;case 2048>=h:s=[21,h-1537,9];break;case 3072>=h:s=[22,h-2049,10];break;case 4096>=h:s=[23,h-3073,10];break;case 6144>=h:s=[24,h-4097,11];break;case 8192>=h:s=[25,h-6145,11];break;case 12288>=h:s=[26,h-8193,12];break;case 16384>=h:s=[27,h-12289,12];break;case 24576>=h:s=[28,h-16385,13];break;case 32768>=h:s=[29,h-24577,13];break;default:t("invalid distance")}for(r=s,u[c++]=r[0],u[c++]=r[1],u[c++]=r[2],o=0,a=u.length;o<a;++o)m[v++]=u[o];T[u[0]]++,S[u[3]]++,y=e.length+n-1,f=null}var a,h,u,c,l,_,d,f,p,g={},m=s?new Uint16Array(2*r.length):[],v=0,y=0,T=new(s?Uint32Array:Array)(286),S=new(s?Uint32Array:Array)(30),A=n.w;if(!s){for(u=0;285>=u;)T[u++]=0;for(u=0;29>=u;)S[u++]=0}for(T[256]=1,a=0,h=r.length;a<h;++a){for(u=l=0,c=3;u<c&&a+u!==h;++u)l=l<<8|r[a+u];if(g[l]===e&&(g[l]=[]),_=g[l],!(0<y--)){for(;0<_.length&&32768<a-_[0];)_.shift();if(a+3>=h){for(f&&o(f,-1),u=0,c=h-a;u<c;++u)p=r[a+u],m[v++]=p,++T[p];break}if(0<_.length){var b=e,C=e,w=0,I=e,x=e,D=e,O=r.length,P=(x=0,_.length);t:for(;x<P;x++){if(b=_[P-x-1],I=3,3<w){for(D=w;3<D;D--)if(r[b+D-1]!==r[a+D-1])continue t;I=w}for(;258>I&&a+I<O&&r[b+I]===r[a+I];)++I;if(I>w&&(C=b,w=I),258===I)break}d=new E(w,a-C),f?f.length<d.length?(p=r[a-1],m[v++]=p,++T[p],o(d,0)):o(f,-1):d.length<A?f=d:o(d,0)}else f?o(f,-1):(p=r[a],m[v++]=p,++T[p])}_.push(a)}return m[v++]=256,T[256]++,n.L=T,n.K=S,s?m.subarray(0,v):m}function I(t,e){function i(t){var e=A[t][b[t]];e===v?(i(t+1),i(t+1)):--E[e],++b[t]}var n,r,o,a,h,u=t.length,c=new f(572),l=new(s?Uint8Array:Array)(u);if(!s)for(a=0;a<u;a++)l[a]=0;for(a=0;a<u;++a)0<t[a]&&c.push(a,t[a]);if(n=Array(c.length/2),r=new(s?Uint32Array:Array)(c.length/2),1===n.length)return l[c.pop().index]=1,l;for(a=0,h=c.length/2;a<h;++a)n[a]=c.pop(),r[a]=n[a].value;var _,d,p,g,m,v=r.length,y=new(s?Uint16Array:Array)(e),T=new(s?Uint8Array:Array)(e),E=new(s?Uint8Array:Array)(v),S=Array(e),A=Array(e),b=Array(e),C=(1<<e)-v,R=1<<e-1;for(y[e-1]=v,d=0;d<e;++d)C<R?T[d]=0:(T[d]=1,C-=R),C<<=1,y[e-2-d]=(y[e-1-d]/2|0)+v;for(y[0]=T[0],S[0]=Array(y[0]),A[0]=Array(y[0]),d=1;d<e;++d)y[d]>2*y[d-1]+T[d]&&(y[d]=2*y[d-1]+T[d]),S[d]=Array(y[d]),A[d]=Array(y[d]);for(_=0;_<v;++_)E[_]=e;for(p=0;p<y[e-1];++p)S[e-1][p]=r[p],A[e-1][p]=p;for(_=0;_<e;++_)b[_]=0;for(1===T[e-1]&&(--E[0],++b[e-1]),d=e-2;0<=d;--d){for(g=_=0,m=b[d+1],p=0;p<y[d];p++)(g=S[d+1][m]+S[d+1][m+1])>r[_]?(S[d][p]=g,A[d][p]=v,m+=2):(S[d][p]=r[_],A[d][p]=_,++_);b[d]=0,1===T[d]&&i(d)}for(o=E,a=0,h=n.length;a<h;++a)l[n[a].index]=o[a];return l}function x(e){var i,n,r,o,a=new(s?Uint16Array:Array)(e.length),h=[],u=[],c=0;for(i=0,n=e.length;i<n;i++)h[e[i]]=1+(0|h[e[i]]);for(i=1,n=16;i<=n;i++)u[i]=c,(c+=0|h[i])>1<<i&&t("overcommitted"),c<<=1;for(65536>c&&t("undercommitted"),i=0,n=e.length;i<n;i++)for(c=u[e[i]],u[e[i]]+=1,r=a[i]=0,o=e[i];r<o;r++)a[i]=a[i]<<1|1&c,c>>>=1;return a}function D(t,e){this.input=t,this.a=new(s?Uint8Array:Array)(32768),this.h=O.j;var i,n={};for(i in!e&&(e={})||"number"!=typeof e.compressionType||(this.h=e.compressionType),e)n[i]=e[i];n.outputBuffer=this.a,this.z=new g(this.input,n)}var O=y;function P(e,i){switch(this.k=[],this.l=32768,this.e=this.g=this.c=this.q=0,this.input=s?new Uint8Array(e):e,this.s=!1,this.m=N,this.B=!1,!i&&(i={})||(i.index&&(this.c=i.index),i.bufferSize&&(this.l=i.bufferSize),i.bufferType&&(this.m=i.bufferType),i.resize&&(this.B=i.resize)),this.m){case M:this.b=32768,this.a=new(s?Uint8Array:Array)(32768+this.l+258);break;case N:this.b=0,this.a=new(s?Uint8Array:Array)(this.l),this.f=this.J,this.t=this.H,this.o=this.I;break;default:t(Error("invalid inflate mode"))}}D.prototype.n=function(){var e,i,n,r,a,h,u,c=0;switch(u=this.a,e=ct){case ct:i=Math.LOG2E*Math.log(32768)-8;break;default:t(Error("invalid compression method"))}switch(n=i<<4|e,u[c++]=n,e){case ct:switch(this.h){case O.NONE:a=0;break;case O.r:a=1;break;case O.j:a=2;break;default:t(Error("unsupported compression type"))}break;default:t(Error("invalid compression method"))}return r=a<<6|0,u[c++]=r|31-(256*n+r)%31,h=o(this.input),this.z.b=c,c=(u=this.z.n()).length,s&&((u=new Uint8Array(u.buffer)).length<=c+4&&(this.a=new Uint8Array(u.length+4),this.a.set(u),u=this.a),u=u.subarray(0,c+4)),u[c++]=h>>24&255,u[c++]=h>>16&255,u[c++]=h>>8&255,u[c++]=255&h,u},r("Zlib.Deflate",D),r("Zlib.Deflate.compress",(function(t,e){return new D(t,e).n()})),r("Zlib.Deflate.CompressionType",O),r("Zlib.Deflate.CompressionType.NONE",O.NONE),r("Zlib.Deflate.CompressionType.FIXED",O.r),r("Zlib.Deflate.CompressionType.DYNAMIC",O.j);var M=0,N=1,L={D:M,C:N};P.prototype.p=function(){for(;!this.s;){var n=tt(this,3);switch(1&n&&(this.s=i),n>>>=1){case 0:var r=this.input,o=this.c,a=this.a,h=this.b,u=e,c=e,l=e,_=a.length,d=e;switch(this.e=this.g=0,(u=r[o++])===e&&t(Error("invalid uncompressed block header: LEN (first byte)")),c=u,(u=r[o++])===e&&t(Error("invalid uncompressed block header: LEN (second byte)")),c|=u<<8,(u=r[o++])===e&&t(Error("invalid uncompressed block header: NLEN (first byte)")),l=u,(u=r[o++])===e&&t(Error("invalid uncompressed block header: NLEN (second byte)")),c===~(l|=u<<8)&&t(Error("invalid uncompressed block header: length verify")),o+c>r.length&&t(Error("input buffer is broken")),this.m){case M:for(;h+c>a.length;){if(c-=d=_-h,s)a.set(r.subarray(o,o+d),h),h+=d,o+=d;else for(;d--;)a[h++]=r[o++];this.b=h,a=this.f(),h=this.b}break;case N:for(;h+c>a.length;)a=this.f({v:2});break;default:t(Error("invalid inflate mode"))}if(s)a.set(r.subarray(o,o+c),h),h+=c,o+=c;else for(;c--;)a[h++]=r[o++];this.c=o,this.b=h,this.a=a;break;case 1:this.o(Z,$);break;case 2:it(this);break;default:t(Error("unknown BTYPE: "+n))}}return this.t()};var B,F,k=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],U=s?new Uint16Array(k):k,G=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,258,258],H=s?new Uint16Array(G):G,z=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0],V=s?new Uint8Array(z):z,W=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],X=s?new Uint16Array(W):W,j=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],Y=s?new Uint8Array(j):j,K=new(s?Uint8Array:Array)(288);for(B=0,F=K.length;B<F;++B)K[B]=143>=B?8:255>=B?9:279>=B?7:8;var q,Q,Z=p(K),J=new(s?Uint8Array:Array)(30);for(q=0,Q=J.length;q<Q;++q)J[q]=5;var $=p(J);function tt(i,n){for(var r,s=i.g,o=i.e,a=i.input,h=i.c;o<n;)(r=a[h++])===e&&t(Error("input buffer is broken")),s|=r<<o,o+=8;return r=s&(1<<n)-1,i.g=s>>>n,i.e=o-n,i.c=h,r}function et(i,n){for(var r,s,o,a=i.g,h=i.e,u=i.input,c=i.c,l=n[0],_=n[1];h<_;)(r=u[c++])===e&&t(Error("input buffer is broken")),a|=r<<h,h+=8;return o=(s=l[a&(1<<_)-1])>>>16,i.g=a>>o,i.e=h-o,i.c=c,65535&s}function it(t){function e(t,e,i){var n,r,s,o;for(o=0;o<t;)switch(n=et(this,e),n){case 16:for(s=3+tt(this,2);s--;)i[o++]=r;break;case 17:for(s=3+tt(this,3);s--;)i[o++]=0;r=0;break;case 18:for(s=11+tt(this,7);s--;)i[o++]=0;r=0;break;default:r=i[o++]=n}return i}var i,n,r,o,a=tt(t,5)+257,h=tt(t,5)+1,u=tt(t,4)+4,c=new(s?Uint8Array:Array)(U.length);for(o=0;o<u;++o)c[U[o]]=tt(t,3);i=p(c),n=new(s?Uint8Array:Array)(a),r=new(s?Uint8Array:Array)(h),t.o(p(e.call(t,a,i,n)),p(e.call(t,h,i,r)))}function nt(e,i){var n,r;switch(this.input=e,this.c=0,!i&&(i={})||(i.index&&(this.c=i.index),i.verify&&(this.M=i.verify)),n=e[this.c++],r=e[this.c++],15&n){case ct:this.method=ct;break;default:t(Error("unsupported compression method"))}0!=((n<<8)+r)%31&&t(Error("invalid fcheck flag:"+((n<<8)+r)%31)),32&r&&t(Error("fdict flag is not supported")),this.A=new P(e,{index:this.c,bufferSize:i.bufferSize,bufferType:i.bufferType,resize:i.resize})}P.prototype.o=function(t,e){var i=this.a,n=this.b;this.u=t;for(var r,s,o,a,h=i.length-258;256!==(r=et(this,t));)if(256>r)n>=h&&(this.b=n,i=this.f(),n=this.b),i[n++]=r;else for(a=H[s=r-257],0<V[s]&&(a+=tt(this,V[s])),r=et(this,e),o=X[r],0<Y[r]&&(o+=tt(this,Y[r])),n>=h&&(this.b=n,i=this.f(),n=this.b);a--;)i[n]=i[n++-o];for(;8<=this.e;)this.e-=8,this.c--;this.b=n},P.prototype.I=function(t,e){var i=this.a,n=this.b;this.u=t;for(var r,s,o,a,h=i.length;256!==(r=et(this,t));)if(256>r)n>=h&&(h=(i=this.f()).length),i[n++]=r;else for(a=H[s=r-257],0<V[s]&&(a+=tt(this,V[s])),r=et(this,e),o=X[r],0<Y[r]&&(o+=tt(this,Y[r])),n+a>h&&(h=(i=this.f()).length);a--;)i[n]=i[n++-o];for(;8<=this.e;)this.e-=8,this.c--;this.b=n},P.prototype.f=function(){var t,e,i=new(s?Uint8Array:Array)(this.b-32768),n=this.b-32768,r=this.a;if(s)i.set(r.subarray(32768,i.length));else for(t=0,e=i.length;t<e;++t)i[t]=r[t+32768];if(this.k.push(i),this.q+=i.length,s)r.set(r.subarray(n,n+32768));else for(t=0;32768>t;++t)r[t]=r[n+t];return this.b=32768,r},P.prototype.J=function(t){var e,i,n,r=this.input.length/this.c+1|0,o=this.input,a=this.a;return t&&("number"==typeof t.v&&(r=t.v),"number"==typeof t.F&&(r+=t.F)),i=2>r?(n=(o.length-this.c)/this.u[2]/2*258|0)<a.length?a.length+n:a.length<<1:a.length*r,s?(e=new Uint8Array(i)).set(a):e=a,this.a=e},P.prototype.t=function(){var t,e,i,n,r,o=0,a=this.a,h=this.k,u=new(s?Uint8Array:Array)(this.q+(this.b-32768));if(0===h.length)return s?this.a.subarray(32768,this.b):this.a.slice(32768,this.b);for(e=0,i=h.length;e<i;++e)for(n=0,r=(t=h[e]).length;n<r;++n)u[o++]=t[n];for(e=32768,i=this.b;e<i;++e)u[o++]=a[e];return this.k=[],this.buffer=u},P.prototype.H=function(){var t,e=this.b;return s?this.B?(t=new Uint8Array(e)).set(this.a.subarray(0,e)):t=this.a.subarray(0,e):(this.a.length>e&&(this.a.length=e),t=this.a),this.buffer=t},nt.prototype.p=function(){var e,i=this.input;return e=this.A.p(),this.c=this.A.c,this.M&&(i[this.c++]<<24|i[this.c++]<<16|i[this.c++]<<8|i[this.c++])>>>0!==o(e)&&t(Error("invalid adler-32 checksum")),e},r("Zlib.Inflate",nt),r("Zlib.Inflate.BufferType",L),L.ADAPTIVE=L.C,L.BLOCK=L.D,r("Zlib.Inflate.prototype.decompress",nt.prototype.p);var rt,st,ot=new(s?Uint8Array:Array)(288);for(rt=0,st=ot.length;rt<st;++rt)ot[rt]=143>=rt?8:255>=rt?9:279>=rt?7:8;p(ot);var at,ht,ut=new(s?Uint8Array:Array)(30);for(at=0,ht=ut.length;at<ht;++at)ut[at]=5;p(ut);var ct=8}).call(GO);var HO,zO,VO,WO,XO,jO=GO.Zlib;function YO(t){switch(t){case 1:return Uint8Array;case 2:return Uint16Array;case 4:return Uint32Array;default:return Uint8Array}}jO.Deflate=jO.Deflate,jO.Deflate.compress=jO.Deflate.compress,jO.Inflate=jO.Inflate,jO.Inflate.BufferType=jO.Inflate.BufferType,jO.Inflate.prototype.decompress=jO.Inflate.prototype.decompress;var KO=new _n,qO=new _n,QO=new Uint8Array,ZO=t("Mesh",va("cc.Mesh")((zO=function(t){function e(){var e;return(e=t.call(this)||this).morphRendering=null,e._struct=VO&&VO(),e._hash=WO&&WO(),e._data=QO,e._initialized=!1,e._allowDataAccess=XO&&XO(),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){this._initialized=!0;var t={struct:this.struct,data:this.data};if(t.struct.compressed&&(t=rP(t)),this.struct.encoded&&(t=nP(t)),!this.struct.quantized||Qd.gfxDevice.getFormatFeatures(pl.RGB16F)&Cl.VERTEX_ATTRIBUTE||(t=function(t){var e=JSON.parse(JSON.stringify(t.struct)),i=new xO;function n(t,e,i,n,r,s,o){for(var a=0;a<i;a++)for(var h=0;h<n;h++)e(o*a+r*h,t(s*a+r*h))}function r(t,e,i,n,r,s){for(var o=0;o<i;o++)for(var a=0;a<n;a++)e(s*o+4*a,rn(t(r*o+2*a)))}i.setNextAlignment(0);for(var s=0;s<e.vertexBundles.length;++s){for(var o=e.vertexBundles[s],a=o.view,h=o.attributes,u=t.struct.vertexBundles[s].attributes,c=[],l=[],_=[],f=0;f<h.length;++f){var p=h[f],g=eP(new DataView(t.data.buffer,a.offset+JO(u,f)),p.format),m=!0;switch(p.format){case pl.R16F:p.format=pl.R32F;break;case pl.RG16F:p.format=pl.RG32F;break;case pl.RGB16F:p.format=pl.RGB32F;break;case pl.RGBA16F:p.format=pl.RGBA32F;break;default:m=!1}c.push(od[p.format].size),l.push(m),_.push(g)}for(var v=c.reduce((function(t,e){return t+e}),0),y=new Uint8Array(v*a.count),T=0;T<h.length;++T){var E=h[T],S=_[T],A=iP(new DataView(y.buffer,JO(h,T)),E.format),b=l[T],C=od[E.format];b?r(S,A,a.count,C.count,a.stride,v):n(S,A,a.count,C.count,C.size/C.count,a.stride,v)}i.setNextAlignment(v);var R={offset:i.getLength(),length:y.byteLength,count:a.count,stride:v};o.view=R,i.addBuffer(y)}for(var w,I=d(e.primitives);!(w=I()).done;){var x=w.value;if(void 0!==x.indexView){var D=x.indexView,O=new Uint8Array(t.data.buffer,D.offset,D.length);i.setNextAlignment(D.stride);var P={offset:i.getLength(),length:O.byteLength,count:D.count,stride:D.stride};x.indexView=P,i.addBuffer(O)}}var M=new Uint8Array(i.getCombined());return e.quantized=!1,{struct:e,data:M}}(t)),this._struct=t.struct,this._data=t.data,this._struct.dynamic){for(var e=Qd.gfxDevice,i=[],n=[],r=0;r<this._struct.vertexBundles.length;r++){var s=this._struct.vertexBundles[r],o=e.createBuffer(new v_(vl.VERTEX|vl.TRANSFER_DST,El.DEVICE,s.view.length,s.view.stride));i.push(o)}for(var a=0;a<this._struct.primitives.length;a++){var h=this._struct.primitives[a],u=h.indexView,c=null;u&&(c=e.createBuffer(new v_(vl.INDEX|vl.TRANSFER_DST,El.DEVICE,u.length,u.stride)));for(var l=[],_=0;_<h.vertexBundelIndices.length;_++){var f=h.vertexBundelIndices[_];l.push(i[f])}for(var p=[],g=0;g<h.vertexBundelIndices.length;g++)for(var m,v=h.vertexBundelIndices[g],y=d(this._struct.vertexBundles[v].attributes);!(m=y()).done;){var T=m.value,E=new L_;E.copy(T),p.push(E)}var S=new kD(l,p,h.primitiveMode,c);S.drawInfo=new T_,S.mesh=this,S.subMeshIdx=a,n.push(S)}this._renderingSubMeshes=n}else{for(var A=this._data.buffer,b=Qd.gfxDevice,C=this._createVertexBuffers(b,A),R=[],w=[],I=0;I<this._struct.primitives.length;I++){var x=this._struct.primitives[I];if(0!==x.vertexBundelIndices.length){var D=null,O=void 0;if(x.indexView){var P=x.indexView,M=P.stride,N=P.length;if(4===M&&!b.hasFeature(fl.ELEMENT_INDEX_UINT)){var L=this._struct.vertexBundles[x.vertexBundelIndices[0]].view.count;if(L>=65536){q(10001,L,65536);continue}M>>=1,N>>=1}D=b.createBuffer(new v_(vl.INDEX,El.DEVICE,N,M)),R.push(D),O=new(YO(P.stride))(A,P.offset,P.count),P.stride!==M&&(O=YO(M).from(O)),D.update(O)}var B=x.vertexBundelIndices.map((function(t){return C[t]})),F=[];if(x.vertexBundelIndices.length>0)for(var k=x.vertexBundelIndices[0],U=this._struct.vertexBundles[k].attributes,G=0;G<U.length;++G){var H=U[G];F[G]=new L_(H.name,H.format,H.isNormalized,H.stream,H.isInstanced,H.location)}var z=new kD(B,F,x.primitiveMode,D);z.mesh=this,z.subMeshIdx=I,w.push(z)}}this._renderingSubMeshes=w,this._struct.morph&&(this.morphRendering=function(t,e){return new DO(t,e)}(this,b)),this._isMeshDataUploaded=!0,this._allowDataAccess||this.releaseData()}}},i.updateSubMesh=function(t,e){if(this._struct.dynamic)if(t>=this._struct.primitives.length)q(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,o=this._struct.primitives[t],a=this._renderingSubMeshes[t],h=a.drawInfo,u=0;u<i.length;u++){var c=i[u],l=this._struct.vertexBundles[o.vertexBundelIndices[u]],_=l.view.stride,f=c.byteLength/_,p=c.byteLength,g=new Uint8Array(this._data.buffer,l.view.offset,p),m=new Uint8Array(c.buffer,c.byteOffset,p),v=a.vertexBuffers[u];s.maxSubMeshVertices,p>0&&(g.set(m),v.update(m,p)),l.view.count=f,h.vertexCount=f}if(o.indexView){var y=o.indexView,T=y.stride,E=2===T?e.indices16.length:e.indices32.length,S=E*T,A=new Uint8Array(this._data.buffer,y.offset,S),b=2===T?new Uint8Array(e.indices16.buffer,e.indices16.byteOffset,S):new Uint8Array(e.indices32.buffer,e.indices32.byteOffset,S),C=a.indexBuffer;s.maxSubMeshIndices,S>0&&(A.set(b),C.update(b,S)),y.count=E,h.indexCount=E}if(e.minPos&&e.maxPos){var R=new _n(e.minPos.x,e.minPos.y,e.minPos.z),w=new _n(e.maxPos.x,e.maxPos.y,e.maxPos.z);r.bounds[t]||(r.bounds[t]=new Xo),Xo.fromPoints(r.bounds[t],R,w);for(var I,x=new _n,D=new _n,O=d(r.bounds);!(I=O()).done;){var P=I.value;P&&(P.getBoundary(x,D),_n.min(R,x,R),_n.max(w,D,w))}this._struct.minPosition=new _n(R.x,R.y,R.z),this._struct.maxPosition=new _n(w.x,w.y,w.z)}a.invalidateGeometricInfo()}else q(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 Xo(1/0,1/0,1/0,-1/0,-1/0,-1/0)),i.push(!1);for(var s=this._struct.primitives,o=0;o<s.length;o++){var a=this.readAttribute(o,e_.ATTR_JOINTS),h=this.readAttribute(o,e_.ATTR_WEIGHTS),u=this.readAttribute(o,e_.ATTR_POSITION);if(a&&h&&u)for(var c=Math.min(a.length/4,h.length/4,u.length/3),l=0;l<c;l++){_n.set(KO,u[3*l+0],u[3*l+1],u[3*l+2]);for(var _=0;_<4;++_){var d=4*l+_,f=a[d];if(!(0===h[d]||f>=n.length)){_n.transformMat4(qO,KO,n[f]),i[f]=!0;var p=e[f];_n.min(p.center,p.center,qO),_n.max(p.halfExtents,p.halfExtents,qO)}}}}for(var g=0;g<n.length;g++){var m=e[g];i[g]?Xo.fromPoints(m,m.center,m.halfExtents):e[g]=null}return e},i.merge=function(t,e,i){if(i&&!this.validateMergingMesh(t))return!1;var n=new _n,r=e&&new Rn,s=e&&new Xo;if(r&&e.getRotation(r),!this._initialized){var o=JSON.parse(JSON.stringify(t._struct)),a=t._data.slice();if(e){o.maxPosition&&o.minPosition&&(_n.add(s.center,o.maxPosition,o.minPosition),_n.multiplyScalar(s.center,s.center,.5),_n.subtract(s.halfExtents,o.maxPosition,o.minPosition),_n.multiplyScalar(s.halfExtents,s.halfExtents,.5),Xo.transform(s,s,e),_n.add(o.maxPosition,s.center,s.halfExtents),_n.subtract(o.minPosition,s.center,s.halfExtents));for(var h=0;h<o.vertexBundles.length;h++)for(var u=o.vertexBundles[h],c=0;c<u.attributes.length;c++)if(u.attributes[c].name===e_.ATTR_POSITION||u.attributes[c].name===e_.ATTR_NORMAL){var l=u.attributes[c].format,_=new DataView(a.buffer,u.view.offset+JO(u.attributes,c)),f=eP(_,l),p=iP(_,l);if(!f||!p)continue;for(var g=u.view.count,m=u.view.stride,v=tP(l),y=0;y<g;y++){var T=y*m,E=T+v,S=E+v;switch(n.set(f(T),f(E),f(S)),u.attributes[c].name){case e_.ATTR_POSITION:n.transformMat4(e);break;case e_.ATTR_NORMAL:_n.transformQuat(n,n,r)}p(T,n.x),p(E,n.y),p(S,n.z)}}}return this.reset({struct:o,data:a}),this.initialize(),!0}for(var A,b,C,R,w,I=new xO,x=0,D=0,O=0,P=0,M=0,N=0,L=0,B=0,F=!1,k=new Array(this._struct.vertexBundles.length),U=0;U<this._struct.vertexBundles.length;++U){var G=this._struct.vertexBundles[U],H=t._struct.vertexBundles[U];O=G.view.offset,P=H.view.offset,D=G.view.stride,x=G.view.count+H.view.count,A=new ArrayBuffer(x*D),b=new Uint8Array(A),O+=(C=this._data.subarray(O,O+G.view.length)).length,P+=(R=t._data.subarray(P,P+H.view.length)).length,b.set(C),M=0;for(var z,V=d(G.attributes);!(z=V()).done;){var W=z.value;L=0,F=!1;for(var X,j=d(H.attributes);!(X=j()).done;){var Y=X.value;if(W.name===Y.name&&W.format===Y.format){F=!0;break}L+=od[Y.format].size}if(F){B=od[W.format].size,N=G.view.length+M;for(var K=0;K<H.view.count;++K){if(w=R.subarray(L,L+B),b.set(w,N),(W.name===e_.ATTR_POSITION||W.name===e_.ATTR_NORMAL)&&e){var q=new Float32Array(b.buffer,N,3);switch(n.set(q[0],q[1],q[2]),W.name){case e_.ATTR_POSITION:n.transformMat4(e);break;case e_.ATTR_NORMAL:_n.transformQuat(n,n,r)}q[0]=n.x,q[1]=n.y,q[2]=n.z}N+=G.view.stride,L+=H.view.stride}}M+=od[W.format].size}k[U]={attributes:G.attributes,view:{offset:I.getLength(),length:A.byteLength,count:x,stride:D}},I.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,ot=0,at=d(nt.vertexBundelIndices);!(st=at()).done;){var ht=st.value;ot=Math.max(ot,this._struct.vertexBundles[ht].view.count)}if(nt.indexView&&rt.indexView){$=nt.indexView.count,$+=rt.indexView.count,O=nt.indexView.offset,P=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,O,nt.indexView.count):1===nt.indexView.stride?new Uint8Array(this._data.buffer,O,nt.indexView.count):new Uint32Array(this._data.buffer,O,nt.indexView.count),tt===nt.indexView.stride)Q.set(Z);else for(var ct=0;ct<nt.indexView.count;++ct)Q[ct]=Z[ct];O+=nt.indexView.length,J=2===rt.indexView.stride?new Uint16Array(t._data.buffer,P,rt.indexView.count):1===rt.indexView.stride?new Uint8Array(t._data.buffer,P,rt.indexView.count):new Uint32Array(t._data.buffer,P,rt.indexView.count);for(var lt=0;lt<rt.indexView.count;++lt)Q[nt.indexView.count+lt]=ot+J[lt];P+=rt.indexView.length,et[it].indexView={offset:I.getLength(),length:ut.byteLength,count:$,stride:tt},I.setNextAlignment(tt),I.addBuffer(ut)}}var _t={vertexBundles:k,primitives:et,minPosition:this._struct.minPosition,maxPosition:this._struct.maxPosition};return _t.minPosition&&t._struct.minPosition&&_t.maxPosition&&t._struct.maxPosition&&(e?(_n.add(s.center,t._struct.maxPosition,t._struct.minPosition),_n.multiplyScalar(s.center,s.center,.5),_n.subtract(s.halfExtents,t._struct.maxPosition,t._struct.minPosition),_n.multiplyScalar(s.halfExtents,s.halfExtents,.5),Xo.transform(s,s,e),_n.add(n,s.center,s.halfExtents),_n.max(_t.maxPosition,_t.maxPosition,n),_n.subtract(n,s.center,s.halfExtents),_n.min(_t.minPosition,_t.minPosition,n)):(_n.min(_t.minPosition,_t.minPosition,t._struct.minPosition),_n.max(_t.maxPosition,_t.maxPosition,t._struct.maxPosition))),this.reset({struct:_t,data:new Uint8Array(I.getCombined())}),this.initialize(),!0},i.validateMergingMesh=function(t){if(this._struct.dynamic||t._struct.dynamic)return!1;if(this._struct.vertexBundles.length!==t._struct.vertexBundles.length)return!1;for(var e=0;e<this._struct.vertexBundles.length;++e){var i=this._struct.vertexBundles[e],n=t._struct.vertexBundles[e];if(i.attributes.length!==n.attributes.length)return!1;for(var r=0;r<i.attributes.length;++r)if(i.attributes[r].format!==n.attributes[r].format)return!1}if(this._struct.primitives.length!==t._struct.primitives.length)return!1;for(var s=0;s<this._struct.primitives.length;++s){var o=this._struct.primitives[s],a=t._struct.primitives[s];if(o.vertexBundelIndices.length!==a.vertexBundelIndices.length)return!1;for(var h=0;h<o.vertexBundelIndices.length;++h)if(o.vertexBundelIndices[h]!==a.vertexBundelIndices[h])return!1;if(o.primitiveMode!==a.primitiveMode)return!1;if(o.indexView){if(void 0===a.indexView)return!1}else if(a.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,o=pd(od[s]);if(0!==r){var a=new DataView(i._data.buffer,t.view.offset+JO(t.attributes,e)),h=od[s],u=eP(a,s);if(o&&u){for(var c=h.count,l=new o(r*c),_=t.view.stride,d=0;d<r;++d)for(var f=0;f<c;++f)l[c*d+f]=u(_*d+l.BYTES_PER_ELEMENT*f);n=l}}})),n},i.copyAttribute=function(t,e,i,n,r){var s=this,o=!1;return this._accessAttribute(t,e,(function(t,e){var a=t.view.count;if(0!==a){var h=t.attributes[e].format,u=new DataView(s._data.buffer,t.view.offset+JO(t.attributes,e)),c=new DataView(i,r),l=od[h],_=eP(u,h),d=iP(c,h);if(_&&d){for(var f=l.count,p=t.view.stride,g=tP(h),m=n,v=g,y=0;y<a;++y)for(var T=0;T<f;++T)d(m*y+v*T,_(p*y+g*T));o=!0}}else o=!0})),o},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?pl.R8UI:2===i.indexView.stride?pl.R16UI:pl.R32UI,s=eP(new DataView(this._data.buffer),r),o=0;o<n;++o)e[o]=s(i.indexView.offset+od[r].size*o);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=od[n]})),i},i._accessAttribute=function(t,e,i){if(!(t>=this._struct.primitives.length))for(var n,r=d(this._struct.primitives[t].vertexBundelIndices);!(n=r()).done;){var s=n.value,o=this._struct.vertexBundles[s],a=o.attributes.findIndex((function(t){return t.name===e}));if(!(a<0)){i(o,a);break}}},i._createVertexBuffers=function(t,e){return this._struct.vertexBundles.map((function(i){var n=t.createBuffer(new v_(vl.VERTEX,El.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:QO})},i.releaseData=function(){this._data=QO},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=nl(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}(Of),VO=ua(zO.prototype,"_struct",[wa],(function(){return{vertexBundles:[],primitives:[]}})),WO=ua(zO.prototype,"_hash",[wa],(function(){return 0})),XO=ua(zO.prototype,"_allowDataAccess",[wa],(function(){return!0})),HO=zO))||HO);function JO(t,e){for(var i=0,n=0;n<e;++n){var r=t[n];i+=od[r.format].size}return i}m.Mesh=ZO;var $O=Fo.isLittleEndian;function tP(t){var e=od[t];return e.size/e.count}function eP(t,e){var i=od[e],n=i.size/i.count;switch(i.type){case gl.UNORM:switch(n){case 1:return function(e){return t.getUint8(e)};case 2:return function(e){return t.getUint16(e,$O)};case 4:return function(e){return t.getUint32(e,$O)}}break;case gl.SNORM:case gl.INT:switch(n){case 1:return function(e){return t.getInt8(e)};case 2:return function(e){return t.getInt16(e,$O)};case 4:return function(e){return t.getInt32(e,$O)}}break;case gl.UINT:switch(n){case 1:return function(e){return t.getUint8(e)};case 2:return function(e){return t.getUint16(e,$O)};case 4:return function(e){return t.getUint32(e,$O)}}break;case gl.FLOAT:switch(n){case 2:return function(e){return t.getUint16(e,$O)};case 4:return function(e){return t.getFloat32(e,$O)}}}return null}function iP(t,e){var i=od[e],n=i.size/i.count;switch(i.type){case gl.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,$O)};case 4:return function(e,i){return t.setUint32(e,i,$O)}}break;case gl.SNORM:case gl.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,$O)};case 4:return function(e,i){return t.setInt32(e,i,$O)}}break;case gl.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,$O)};case 4:return function(e,i){return t.setUint32(e,i,$O)}}break;case gl.FLOAT:switch(n){case 2:return function(e,i){return t.setUint16(e,i,$O)};case 4:return function(e,i){return t.setFloat32(e,i,$O)}}}return null}function nP(t){if(!t.struct.encoded)return t;var e=function(t){t<0&&Z(14204,t)},i=JSON.parse(JSON.stringify(t.struct)),n=new xO;n.setNextAlignment(0);for(var r,s=d(i.vertexBundles);!(r=s()).done;){var o=r.value,a=o.view,h=a.count*a.stride,u=new Uint8Array(h),c=new Uint8Array(t.data.buffer,a.offset,a.length);e(UO.decodeVertexBuffer(u,a.count,a.stride,c)),n.setNextAlignment(a.stride);var l={offset:n.getLength(),length:u.byteLength,count:a.count,stride:a.stride};o.view=l,n.addBuffer(u)}for(var _,f=d(i.primitives);!(_=f()).done;){var p=_.value;if(void 0!==p.indexView){var g=p.indexView,m=g.count*g.stride,v=new Uint8Array(m),y=new Uint8Array(t.data.buffer,g.offset,g.length);e(UO.decodeIndexBuffer(v,g.count,g.stride,y)),n.setNextAlignment(g.stride);var T={offset:n.getLength(),length:v.byteLength,count:g.count,stride:g.stride};p.indexView=T,n.addBuffer(v)}}return{struct:i,data:new Uint8Array(n.getCombined())}}function rP(t){var e=new jO.Inflate(t.data).decompress();return t.data=e,t.struct.compressed=!1,t}var sP=[new L_(e_.ATTR_POSITION,pl.RGB32F),new L_(e_.ATTR_NORMAL,pl.RGB32F),new L_(e_.ATTR_TEX_COORD,pl.RG32F),new L_(e_.ATTR_TANGENT,pl.RGBA32F),new L_(e_.ATTR_COLOR,pl.RGBA32F)],oP=new _n;function aP(t,e,i){i=i||{};var n,r=[],s=0,o=[],a=0,h=t.positions.slice();if(h.length>0){if(n=null,t.attributes)for(var u,c=d(t.attributes);!(u=c()).done;){var l=u.value;if(l.name===e_.ATTR_POSITION){n=l;break}}n||(n=sP[0]),r.push(n);var _=od[n.format];a=Math.max(a,Math.floor(h.length/_.count)),o.push({offset:s,data:h,attribute:n}),s+=_.size}if(t.normals&&t.normals.length>0){if(n=null,t.attributes)for(var f,p=d(t.attributes);!(f=p()).done;){var g=f.value;if(g.name===e_.ATTR_NORMAL){n=g;break}}n||(n=sP[1]);var m=od[n.format];r.push(n),a=Math.max(a,Math.floor(t.normals.length/m.count)),o.push({offset:s,data:t.normals,attribute:n}),s+=m.size}if(t.uvs&&t.uvs.length>0){if(n=null,t.attributes)for(var v,y=d(t.attributes);!(v=y()).done;){var T=v.value;if(T.name===e_.ATTR_TEX_COORD){n=T;break}}n||(n=sP[2]);var E=od[n.format];r.push(n),a=Math.max(a,Math.floor(t.uvs.length/E.count)),o.push({offset:s,data:t.uvs,attribute:n}),s+=E.size}if(t.tangents&&t.tangents.length>0){if(n=null,t.attributes)for(var S,A=d(t.attributes);!(S=A()).done;){var b=S.value;if(b.name===e_.ATTR_TANGENT){n=b;break}}n||(n=sP[3]);var C=od[n.format];r.push(n),a=Math.max(a,Math.floor(t.tangents.length/C.count)),o.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 R,w=d(t.attributes);!(R=w()).done;){var I=R.value;if(I.name===e_.ATTR_COLOR){n=I;break}}n||(n=sP[4]);var x=od[n.format];r.push(n),a=Math.max(a,Math.floor(t.colors.length/x.count)),o.push({offset:s,data:t.colors,attribute:n}),s+=x.size}if(t.customAttributes)for(var D=0;D<t.customAttributes.length;D++){var O=t.customAttributes[D],P=od[O.attr.format];r.push(O.attr),a=Math.max(a,Math.floor(O.values.length/P.count)),o.push({offset:s,data:O.values,attribute:O.attr}),s+=P.size}for(var M=new xO,N=new ArrayBuffer(a*s),L=new DataView(N),B=0,F=o;B<F.length;B++){var k=F[B];LD(L,k.data,k.attribute.format,k.offset,s)}M.setNextAlignment(0);var U={attributes:r,view:{offset:M.getLength(),length:N.byteLength,count:a,stride:s}};M.addBuffer(N);var G=null,H=0;if(t.indices){var z=t.indices;H=z.length,G=new ArrayBuffer(2*H),LD(new DataView(G),z,pl.R16UI)}var V={primitiveMode:t.primitiveMode||Hl.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=_n.set(new _n,1/0,1/0,1/0);for(var X=0;X<a;++X)_n.set(oP,h[3*X+0],h[3*X+1],h[3*X+2]),_n.min(W,W,oP)}var j=t.maxPos;if(!j&&i.calculateBounds){j=_n.set(new _n,-1/0,-1/0,-1/0);for(var Y=0;Y<a;++Y)_n.set(oP,h[3*Y+0],h[3*Y+1],h[3*Y+2]),_n.max(j,j,oP)}var K={vertexBundles:[U],primitives:[V]};return W&&(K.minPosition=new _n(W.x,W.y,W.z)),j&&(K.maxPosition=new _n(j.x,j.y,j.z)),e||(e=new ZO),e.reset({struct:K,data:new Uint8Array(M.getCombined())}),e}function hP(t,e){if(e>0){var i=t%e;if(0!==i)return e-i}return 0}var uP,cP,lP=function(){function t(){}return t.createMesh=function(t,e,i){return aP(t,e,i)},t.createDynamicMesh=function(t,e,i,n){return function(t,e,i,n){n=n||{maxSubMeshes:1,maxSubMeshVertices:1024,maxSubMeshIndices:1024};var r=[],s=0;if(e.positions.length>0&&r.push(new L_(e_.ATTR_POSITION,pl.RGB32F,!1,s++,!1,0)),e.normals&&e.normals.length>0&&r.push(new L_(e_.ATTR_NORMAL,pl.RGB32F,!1,s++,!1,0)),e.uvs&&e.uvs.length>0&&r.push(new L_(e_.ATTR_TEX_COORD,pl.RG32F,!1,s++,!1,0)),e.tangents&&e.tangents.length>0&&r.push(new L_(e_.ATTR_TANGENT,pl.RGBA32F,!1,s++,!1,0)),e.colors&&e.colors.length>0&&r.push(new L_(e_.ATTR_COLOR,pl.RGBA32F,!1,s++,!1,0)),e.customAttributes)for(var o=0;o<e.customAttributes.length;o++){var a=e.customAttributes[o],h=new L_;h.copy(a.attr),h.stream=s++,r.push(h)}for(var u=[],c=[],l=0,_=0;_<n.maxSubMeshes;_++){for(var f,p={vertexBundelIndices:[],primitiveMode:e.primitiveMode||Hl.TRIANGLE_LIST},g=d(r);!(f=g()).done;){var m=f.value,v=od[m.format],y=n.maxSubMeshVertices*v.size,T={view:{offset:l,length:y,count:0,stride:v.size},attributes:[m]},E=u.length;p.vertexBundelIndices.push(E),u.push(T),l+=y}var S=0;if(e.indices16&&e.indices16.length>0?S=2:e.indices32&&e.indices32.length>0&&(S=4),S>0){l+=hP(l,S);var A=n.maxSubMeshIndices*S,b={offset:l,length:A,count:0,stride:S};p.indexView=b,l+=A}c.push(p)}var C={info:{maxSubMeshes:n.maxSubMeshes,maxSubMeshVertices:n.maxSubMeshVertices,maxSubMeshIndices:n.maxSubMeshIndices},bounds:[]};C.bounds.length=n.maxSubMeshes;var R={struct:{vertexBundles:u,primitives:c,dynamic:C},data:new Uint8Array(l)};return i||(i=new ZO),i.reset(R),i.initialize(),i.updateSubMesh(t,e),i}(t,e,i,n)},t.decodeMesh=function(t){return nP(t)},t.inflateMesh=function(t){return rP(t)},t}(),_P=Object.freeze({__proto__:null,find:Ex,toPPM:function(t,e,i){return"P3 "+e+" "+i+" 255\n"+t.filter((function(t,e){return e%4<3})).toString()+"\n"},readMesh:function(t,e){void 0===e&&(e=0);for(var i,n={positions:[]},r=new DataView(t.data.buffer,t.data.byteOffset,t.data.byteLength),s=t.struct,o=s.primitives[e],a=d(o.vertexBundelIndices);!(i=a()).done;)for(var h,u=i.value,c=s.vertexBundles[u],l=c.view.offset,_=c.view,f=_.length,p=_.stride,g=d(c.attributes);!(h=g()).done;){var m=h.value,v=RO[m.name];v&&(n[v]=(n[v]||[]).concat(BD(r,m.format,l,f,p))),l+=od[m.format].size}var y=o.indexView;return n.indices=BD(r,pl["R"+8*y.stride+"UI"],y.offset,y.length),n},createMesh:aP,MeshUtils:lP,readBuffer:BD,writeBuffer:LD,mapBuffer:FD});t("utils",_P);var dP,fP=dn(),pP=Un();!function(t){t[t.RECT=0]="RECT",t[t.POLYGON=1]="POLYGON"}(dP||(dP={}));var gP,mP,vP,yP=[{u:0,v:0},{u:0,v:0},{u:0,v:0},{u:0,v:0}],TP=t("SpriteFrame",va("cc.SpriteFrame")(((cP=function(t){function e(){var e;return(e=t.call(this)||this).vertices=null,e.uv=[],e.unbiasUV=[],e.uvSliced=[],e._rect=Kn(),e._trimmedBorder=an(),e._offset=zn(),e._originalSize=jn(),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=zn(.5,.5),e._meshType=dP.RECT,e._extrude=0,e._customOutLine=[],e._mesh=null,e._minPos=dn(),e._maxPos=dn(),e}s(e,t),e.createWithImage=function(t){var i=t instanceof $f?t:new $f(t),n=new Sg;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?(Z(3300,this.name+"/"+t.name,i,t.width),!1):!(n>t.height&&(Z(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&&wO&&wO.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],o=this._capInsets[2],a=t.width-s-o,h=this._capInsets[1],u=this._capInsets[3],c=t.height-h-u,l=this.uvSliced;if(l.length=0,this._rotated){yP[0].u=t.x/n,yP[1].u=(t.x+u)/n,yP[2].u=(t.x+u+c)/n,yP[3].u=(t.x+t.height)/n,yP[3].v=t.y/r,yP[2].v=(t.y+s)/r,yP[1].v=(t.y+s+a)/r,yP[0].v=(t.y+t.width)/r;for(var _=0;_<4;++_)for(var d=yP[_],f=0;f<4;++f){var p=yP[3-f];l.push({u:d.u,v:p.v})}}else{yP[0].u=t.x/n,yP[1].u=(t.x+s)/n,yP[2].u=(t.x+s+a)/n,yP[3].u=(t.x+t.width)/n,yP[3].v=t.y/r,yP[2].v=(t.y+h)/r,yP[1].v=(t.y+h+c)/r,yP[0].v=(t.y+t.height)/r;for(var g=0;g<4;++g)for(var m=yP[g],v=0;v<4;++v){var y=yP[v];l.push({u:y.u,v:m.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 o=0===r?0:t.x/r,a=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]=a,e[1]=u,e[2]=a,e[3]=h,e[4]=o,e[5]=u,e[6]=o,e[7]=h):this._isFlipUVX?(e[0]=a,e[1]=h,e[2]=a,e[3]=u,e[4]=o,e[5]=h,e[6]=o,e[7]=u):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):(e[0]=o,e[1]=h,e[2]=o,e[3]=u,e[4]=a,e[5]=h,e[6]=a,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,d=0===s?1:(t.y+t.width)/s;this._isFlipUVX&&this._isFlipUVY?(i[0]=l,i[1]=d,i[2]=l,i[3]=_,i[4]=c,i[5]=d,i[6]=c,i[7]=_):this._isFlipUVX?(i[0]=l,i[1]=_,i[2]=l,i[3]=d,i[4]=c,i[5]=_,i[6]=c,i[7]=d):this._isFlipUVY?(i[0]=c,i[1]=d,i[2]=c,i[3]=_,i[4]=l,i[5]=d,i[6]=l,i[7]=_):(i[0]=c,i[1]=_,i[2]=c,i[3]=d,i[4]=l,i[5]=_,i[6]=l,i[7]=d)}else{var f=0===r?0:t.x/r,p=0===r?1:(t.x+t.width)/r,g=0===s?1:(t.y+t.height)/s,m=0===s?0:t.y/s;this._isFlipUVX&&this._isFlipUVY?(e[0]=p,e[1]=m,e[2]=f,e[3]=m,e[4]=p,e[5]=g,e[6]=f,e[7]=g):this._isFlipUVX?(e[0]=p,e[1]=g,e[2]=f,e[3]=g,e[4]=p,e[5]=m,e[6]=f,e[7]=m):this._isFlipUVY?(e[0]=f,e[1]=m,e[2]=p,e[3]=m,e[4]=f,e[5]=g,e[6]=p,e[7]=g):(e[0]=f,e[1]=g,e[2]=p,e[3]=g,e[4]=f,e[5]=m,e[6]=p,e[7]=m);var v=0===r?0:t.x/r,y=0===r?1:(t.x+t.width)/r,T=0===s?1:(t.y+t.height)/s,E=0===s?0:t.y/s;this._isFlipUVX&&this._isFlipUVY?(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._isFlipUVX?(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._isFlipUVY?(i[0]=v,i[1]=E,i[2]=y,i[3]=E,i[4]=v,i[5]=T,i[6]=y,i[7]=T):(i[0]=v,i[1]=T,i[2]=y,i[3]=T,i[4]=v,i[5]=E,i[6]=y,i[7]=E)}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=wO;if(t){var e=this._texture;if(e instanceof Sg&&!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 Yn(i.x,i.y,i.width,i.height));var n=e.offset;e.offset&&(this._offset=zn(n.x,n.y));var r=e.originalSize;e.originalSize&&(this._originalSize=jn(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=zn(s.x,s.y)),this._meshType=e.meshType;var o=e.capInsets;o&&(this._capInsets[0]=o[0],this._capInsets[1]=o[1],this._capInsets[2]=o[2],this._capInsets[3]=o[3]);var a=e.vertices;if(a){this.vertices||(this.vertices={rawPosition:[],positions:[],indexes:a.indexes,uv:a.uv,nuv:a.nuv,minPos:dn(a.minPos.x,a.minPos.y,a.minPos.z),maxPos:dn(a.maxPos.x,a.maxPos.y,a.maxPos.z)}),this.vertices.rawPosition.length=0;for(var h=a.rawPosition,u=0;u<h.length;u+=3)this.vertices.rawPosition.push(dn(h[u],h[u+1],h[u+2]));this._updateMeshVertices()}},i.clone=function(){var t,i,n,r,s,o=new e,a=this.vertices;return o.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.maxPos.clone()}:null,(t=o.uv).splice.apply(t,[0,o.uv.length].concat(this.uv)),(i=o.unbiasUV).splice.apply(i,[0,o.unbiasUV.length].concat(this.unbiasUV)),(n=o.uvSliced).splice.apply(n,[0,o.uvSliced.length].concat(this.uvSliced)),o._rect.set(this._rect),o._trimmedBorder.set(this._trimmedBorder),o._offset.set(this._offset),o._originalSize.set(this._originalSize),o._rotated=this._rotated,(r=o._capInsets).splice.apply(r,[0,o._capInsets.length].concat(this._capInsets)),o._atlasUuid=this._atlasUuid,o._texture=this._texture,o._isFlipUVX=this._isFlipUVX,o._isFlipUVY=this._isFlipUVY,this._original?o._original={_texture:this._original._texture,_x:this._original._x,_y:this._original._y}:o._original=null,o._packable=this._packable,o._pixelsToUnit=this._pixelsToUnit,o._pivot.set(this._pivot),o._meshType=this._meshType,o._extrude=this._extrude,(s=o._customOutLine).splice.apply(s,[0,o._customOutLine.length].concat(this._customOutLine)),o._minPos=this._minPos,o._maxPos=this._maxPos,this._mesh&&o._createMesh(),o},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=Kn(0,0,e.width,e.height),n=!0),(0===this._originalSize.width||0===this._originalSize.height||n)&&(i.originalSize=jn(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 Sg;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:dn(),maxPos:dn()},this._meshType===dP.POLYGON);else{var t=this.texture,e=t.width,i=t.height,n=this.rect,r=n.width,s=n.height,o=n.x,a=i-n.y-s,h=r/2,u=s/2,c=0===e?0:o/e,l=0===e?1:(o+r)/e,_=0===i?1:(a+s)/i,d=0===i?0:a/i;fP.set(-h,-u,0),this.vertices.rawPosition.push(fP.clone()),this.vertices.uv.push(o),this.vertices.uv.push(a+s),this.vertices.nuv.push(c),this.vertices.nuv.push(d),this.vertices.minPos.set(fP),fP.set(h,-u,0),this.vertices.rawPosition.push(fP.clone()),this.vertices.uv.push(o+r),this.vertices.uv.push(a+s),this.vertices.nuv.push(l),this.vertices.nuv.push(d),fP.set(-h,u,0),this.vertices.rawPosition.push(fP.clone()),this.vertices.uv.push(o),this.vertices.uv.push(a),this.vertices.nuv.push(c),this.vertices.nuv.push(_),fP.set(h,u,0),this.vertices.rawPosition.push(fP.clone()),this.vertices.uv.push(o+r),this.vertices.uv.push(a),this.vertices.nuv.push(l),this.vertices.nuv.push(_),this.vertices.maxPos.set(fP),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(){pP.identity();var t=1/this._pixelsToUnit,e=dn(-(this._pivot.x-.5)*this.rect.width*t,-(this._pivot.y-.5)*this.rect.height*t,0);pP.transform(e),e.set(t,t,1),pP.scale(e);for(var i=this.vertices,n=0;n<i.rawPosition.length;n++){var r=i.rawPosition[n];_n.transformMat4(e,r,pP),_n.toArray(i.positions,e,3*n)}_n.transformMat4(this._minPos,i.minPos,pP),_n.transformMat4(this._maxPos,i.maxPos,pP)},i._createMesh=function(){this._mesh=aP({primitiveMode:Hl.TRIANGLE_LIST,positions:this.vertices.positions,uvs:this.vertices.nuv,indices:this.vertices.indexes,minPos:this._minPos,maxPos:this._maxPos,attributes:[new L_(e_.ATTR_POSITION,pl.RGB32F),new L_(e_.ATTR_TEX_COORD,pl.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):q(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}(Of)).EVENT_UV_UPDATED="uv_updated",cP.MeshType=dP,uP=cP))||uP);m.SpriteFrame=TP;var EP,SP=t("SpriteAtlas",va("cc.SpriteAtlas")((mP=function(t){function e(){var e;return(e=t.call(this)||this).spriteFrames=vP&&vP(),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(){return null},i._deserialize=function(t,e){var i=t;this._name=i.name;var n=i.spriteFrames;this.spriteFrames=Dt();for(var r=0;r<n.length;r+=2)e.result.push(this.spriteFrames,n[r],n[r+1],re(TP))},e}(Of),vP=ua(mP.prototype,"spriteFrames",[wa],(function(){return Dt()})),gP=mP))||gP);m.SpriteAtlas=SP;var AP,bP,CP,RP=t("Font",va("cc.Font")(EP=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(Of))||EP);m.Font=RP;var wP=t("TTFFont",va("cc.TTFFont")((bP=function(t){function e(){var e;return(e=t.call(this)||this)._fontFamily=CP&&CP(),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:Eo(this._native),__isNative__:!0}}}]),e}(RP),CP=ua(bP.prototype,"_fontFamily",[wa],(function(){return null})),f(bP.prototype,"_nativeAsset",[hh,Qa],Object.getOwnPropertyDescriptor(bP.prototype,"_nativeAsset"),bP.prototype),f(bP.prototype,"_nativeDep",[hh],Object.getOwnPropertyDescriptor(bP.prototype,"_nativeDep"),bP.prototype),AP=bP))||AP);m.TTFFont=wP;var IP=t("BASELINE_RATIO",.26),xP=t("MIDDLE_RATIO",(IP+1)/2-IP);var DP=new se(2);DP.get=function(){return this._get()||{key:"",value:0,prev:null,next:null}};var OP=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=DP.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,DP.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),PP=/([a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûа-яА-ЯЁё]+|\S)/,MP=/^[!,.:;'}\]%\?>、‘“》?。,!]/,NP=/([a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûаíìÍÌïÁÀáàÉÈÒÓòóŐőÙÚŰúűñÑæÆœŒÃÂãÔõěščřžýáíéóúůťďňĚŠČŘŽÁÍÉÓÚŤżźśóńłęćąŻŹŚÓŃŁĘĆĄ-яА-ЯЁёáàảạãăắằẳẵặâấầẩẫậéèẻẽẹêếềểễệiíìỉĩịóòỏõọôốồổỗộơớờởỡợúùủũụưứừửữựýỳỷỹỵđÁÀẢẠÃĂẮẰẲẴẶÂẤẦẨẪẬÉÈẺẼẸÊẾỀỂỄỆIÍÌỈĨỊÓÒỎÕỌÔỐỒỔỖỘƠỚỜỞỠỢÚÙỦŨỤƯỨỪỬỮỰÝỲỶỸỴĐ]+|\S)$/,LP=/[a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûаíìÍÌïÁÀáàÉÈÒÓòóŐőÙÚŰúűñÑæÆœŒÃÂãÔõěščřžýáíéóúůťďňĚŠČŘŽÁÍÉÓÚŤżźśóńłęćąŻŹŚÓŃŁĘĆĄ-яА-ЯЁёáàảạãăắằẳẵặâấầẩẫậéèẻẽẹêếềểễệiíìỉĩịóòỏõọôốồổỗộơớờởỡợúùủũụưứừửữựýỳỷỹỵđÁÀẢẠÃĂẮẰẲẴẶÂẤẦẨẪẬÉÈẺẼẸÊẾỀỂỄỆIÍÌỈĨỊÓÒỎÕỌÔỐỒỔỖỘƠỚỜỞỠỢÚÙỦŨỤƯỨỪỬỮỰÝỲỶỸỴĐ]+$/,BP=/^[a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûаíìÍÌïÁÀáàÉÈÒÓòóŐőÙÚŰúűñÑæÆœŒÃÂãÔõěščřžýáíéóúůťďňĚŠČŘŽÁÍÉÓÚŤżźśóńłęćąŻŹŚÓŃŁĘĆĄ-яА-ЯЁёáàảạãăắằẳẵặâấầẩẫậéèẻẽẹêếềểễệiíìỉĩịóòỏõọôốồổỗộơớờởỡợúùủũụưứừửữựýỳỷỹỵđÁÀẢẠÃĂẮẰẲẴẶÂẤẦẨẪẬÉÈẺẼẸÊẾỀỂỄỆIÍÌỈĨỊÓÒỎÕỌÔỐỒỔỖỘƠỚỜỞỠỢÚÙỦŨỤƯỨỪỬỮỰÝỲỶỸỴĐ]/;function FP(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 kP(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 UP(t,e,i){var n=(i||t.font)+"🎮"+e,r=OP.get(n);if(null!==r)return r;var s=t.measureText(e),o=s&&s.width||0;return OP.put(n,o),o}function GP(t){for(var e=t.length,i=0,n=0,r=0;r<e;r++)8205!==(n=t.charCodeAt(r))&&(n>=55296&&n<=56319&&(n=t.charCodeAt(r+1))>=56320&&n<=57343?((r+2>=e||8205!==t.charCodeAt(r+2))&&i++,r++):i++);return i}function HP(t,e){for(var i=t.length,n=0,r=0,s=0,o=0,a=0;a<i;a++)if(8205!==(o=t.charCodeAt(a)))if(o>=55296&&o<=56319&&(n++,(o=t.charCodeAt(a+1))>=56320&&o<=57343)){if(n++,a+2>=i||8205!==t.charCodeAt(a+2)){if(e===r)return t.slice(s,s+n);s+=n,r++,n=0}a++}else{if(e===r)return t.charAt(a);s=a+1,r++,n=0}else n++;return""}function zP(t,e){var i=HP(t,e);if(1===i.length)return""+i.charCodeAt(0);for(var n="",r=0;r<i.length;r++)n+=""+i.charCodeAt(r);return""+n}function VP(t,e){if(e>=t.length)return t.length;for(var i=e,n=t[i];i>=0&&("‍"===n&&(n=t[--i]),n>="\udc00"&&n<="\udfff"&&i-1>=0&&(n=t[--i]),n>="\ud800"&&n<="\udbff")&&i-1>=0&&"‍"===t[i-1];)n=t[--i];return i}function WP(t,e){for(var i=e,n=e,r=t[n];n<t.length;)if("‍"===r&&(i++,(r=t[++n])>="\ud800"&&r<="\udbff"&&(i++,r=t[++n])),r>="\ud800"&&r<="\udbff")i++,r=t[++n];else{if(!(r>="\udc00"&&r<="\udfff"))break;if(r=t[++n],!(n<t.length&&"‍"===t[n]))break;i++,r=t[n]}return i}function XP(t,e,i){var n=VP(t,e);n<e&&(n=WP(t,e)+1);var r=i;if(void 0!==i){r=WP(t,i=Math.max(0,i-1));var s=VP(t,i);s<n||s===n&&e>n?r=n:r+=1}return t.substring(n,r)}function jP(t){return BP.exec(t)}function YP(t){return LP.exec(t)}function KP(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 o=s.length*(i/e)|0,a=XP(s,o),h=e-n(a),u=a,c=0,l=0;h>i&&l++<100;)o*=i/h,h=e-n(a=XP(s,o|=0));for(l=0;a&&h<=i&&l++<100;){var _=PP.exec(a);u=a,h=e-n(a=XP(s,o+=c=_?_[0].length:1))}0==(o-=c)?(o=1,u=XP(s,1)):1===o&&s[0]>="\ud800"&&s[0]<="\udbff"&&(o=2,u=XP(s,2));var d=XP(s,0,o),f=void 0;MP.test(u||a)&&(0==(o-=(f=NP.exec(d))?f[0].length:0)&&(o=1),u=XP(s,o),d=XP(s,0,o)),BP.test(u)&&(f=LP.exec(d))&&d!==f[0]&&(u=XP(s,o-=f[0].length),d=XP(s,0,o)),(0===r.length||(d=d.trim()).length>0)&&r.push(d),e=n(s=u||a)}return(0===r.length||(s=s.trim()).length>0)&&r.push(s),r}var qP,QP=y.document,ZP=null,JP=-1,$P="BES bswy:->@123丁ぁᄁ",tM=Object.create(null),eM=[],iM=3e3;function nM(){for(var t=!0,e=Date.now(),i=eM.length-1;i>=0;i--){var n=eM[i],r=n.fontFamilyName;if(e-n.startTime>iM)q(4933,r),n.onComplete(null,r),eM.splice(i,1);else{var s=n.refWidth,o="40px "+r;ZP.font=o,s!==UP(ZP,$P,o)?(eM.splice(i,1),n.onComplete(null,r)):t=!1}}t&&(clearInterval(JP),JP=-1)}function rM(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(tM[n])i(null,n);else{if(!ZP){var r=QP.createElement("canvas");r.width=100,r.height=100,ZP=r.getContext("2d")}var s="40px "+n,o=QP.createElement("style");o.type="text/css";var a="";Number.isNaN(n)?a+="@font-face { font-family:"+n+"; src:":a+='@font-face { font-family:"'+n+'"; src:',a+='url("'+t+'");',o.textContent=a+"}",QP.body.appendChild(o);var h=QP.createElement("div"),u=h.style;if(u.fontFamily=n,h.innerHTML=".",u.position="absolute",u.left="-100px",u.top="-100px",QP.body.appendChild(h),function(){if(void 0===qP)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);qP=t?parseInt(t[1],10)>42:!e}else qP=!1;return qP}())!function(t,e,i){var n=new Promise((function(i,n){!function r(){Date.now()-t>=iM?n():QP.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,iM)}));Promise.race([s,n]).then((function(){r&&(clearTimeout(r),r=null),i(null,e)}),(function(){q(4933,e),i(null,e)}))}(Date.now(),n,i);else{var c={fontFamilyName:n,refWidth:UP(ZP,$P,s),onComplete:i,startTime:Date.now()};eM.push(c),-1===JP&&(JP=setInterval(nM,100))}tM[n]=o}}function sM(t,e,i,n){var r=new wP;r._nativeUrl=t,r._nativeAsset=e,n(null,r)}tE.register({".font":rM,".eot":rM,".ttf":rM,".woff":rM,".svg":rM,".ttc":rM}),_E.register({".font":sM,".eot":sM,".ttf":sM,".woff":sM,".svg":sM,".ttc":sM});var oM,aM,hM,uM,cM,lM,_M,dM,fM,pM=/^(click)(\s)*=|(param)(\s)*=/,gM=/(\s)*src(\s)*=|(\s)*height(\s)*=|(\s)*width(\s)*=|(\s)*align(\s)*=|(\s)*offset(\s)*=|(\s)*click(\s)*=|(\s)*param(\s)*=/,mM=t("HtmlTextParser",function(){function t(){this._specialSymbolArray=[],this._stack=[],this._resultObjectArray=[],this._specialSymbolArray.push([/&lt;/g,"<"]),this._specialSymbolArray.push([/&gt;/g,">"]),this._specialSymbolArray.push([/&amp;/g,"&"]),this._specialSymbolArray.push([/&quot;/g,'"']),this._specialSymbolArray.push([/&apos;/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),o=t.substring(r+1,n);""===o&&(s=t.substring(e,n+1)),this._processResult(s),-1===n?n=r:"/"===t.charAt(r+1)?this._stack.pop():this._addToStack(o),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 o="",a=-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=gM.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(),o=t.substring(c).trim(),a="src"===n?this.getRightQuotationIndex(o):-1,h=(r=o.indexOf(" ",a+1>=o.length?-1:a+1))>-1?o.substr(0,r):o,t=o.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=gM.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 _,d=/(\s)*color(\s)*=|(\s)*width(\s)*=|(\s)*click(\s)*=|(\s)*param(\s)*=/;for(i=d.exec(t);i;)n=(t=t.substring(t.indexOf(i[0]))).substr(0,i[0].length),_=(r=(o=t.substring(n.length).trim()).indexOf(" "))>-1?o.substr(0,r):o,n=(n=n.replace(/[^a-zA-Z]/g,"").trim()).toLowerCase(),t=o.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=d.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=pM.exec(t);r;){var s=r[0],o="";if(n=!1,'"'===(t=t.substring(s.length).trim()).charAt(0))(i=t.indexOf('"',1))>-1&&(o=t.substring(1,i).trim(),n=!0),i++;else if("'"===t.charAt(0))(i=t.indexOf("'",1))>-1&&(o=t.substring(1,i).trim(),n=!0),i++;else{var a=/(\S)+/.exec(t);i=(o=a?a[0]:"").length}n&&(e[s=s.substring(0,s.length-1).trim()]=o),t=t.substring(i).trim(),r=pM.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=d(this._specialSymbolArray);!(e=i()).done;){var n=e.value,r=n[0],s=n[1];t=t.replace(r,s)}return t},t}()),vM=function(){this.u=0,this.v=0,this.w=0,this.h=0,this.offsetX=0,this.offsetY=0,this.valid=!1,this.xAdvance=0},yM=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 vM;Ht(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=zP(t,0),i=null;return Object.prototype.hasOwnProperty.call(this.letterDefinitions,e)&&(i=this.letterDefinitions[e]),i},e.clear=function(){this.letterDefinitions={}},t}(),TM=t("BitmapFont",(oM=va("cc.BitmapFont"),aM=Za(TP),oM((uM=function(t){function e(){var e;return(e=t.call(this)||this).fntDataStr=cM&&cM(),e.spriteFrame=lM&&lM(),e.fontSize=_M&&_M(),e.fntConfig=dM&&dM(),e}return s(e,t),e.prototype.onLoaded=function(){var t=this.spriteFrame;!this.fontDefDictionary&&t&&(this.fontDefDictionary=new yM(t.texture));var e=this.fntConfig;if(e){var i=e.fontDefDictionary;for(var n in i){var r=i[n],s=new vM,o=r.rect;s.offsetX=r.xOffset,s.offsetY=r.yOffset,s.w=o.width,s.h=o.height,s.u=o.x,s.v=o.y,s.valid=!0,s.xAdvance=r.xAdvance,this.fontDefDictionary.addLetterDefinitions(n,s)}}else q(16376)},e}(RP),cM=ua(uM.prototype,"fntDataStr",[wa],(function(){return""})),lM=ua(uM.prototype,"spriteFrame",[aM],(function(){return null})),_M=ua(uM.prototype,"fontSize",[wa],(function(){return-1})),dM=ua(uM.prototype,"fntConfig",[wa],(function(){return null})),hM=uM))||hM));m.BitmapFont=TM;var EM,SM=t("LabelAtlas",va("cc.LabelAtlas")(fM=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(TM))||fM);m.LabelAtlas=SM;var AM,bM=function(){function t(){this.pool=[]}t.getInstance=function(){return EM||(EM=new t),EM};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>=Ie.MAX_LABEL_CANVAS_POOL_SIZE||this.pool.push(t)},t}(),CM=yn.WHITE.clone(),RM="rgba(255, 255, 255, "+(1/255).toFixed(3)+")",wM=function(){function t(t,e){this.image=null,this.data=null,this.canvas=null,this.context=null,this.width=0,this.height=0,this.offsetY=0,this.char=t,this.labelInfo=e,this.hash=""+zP(t,0)+e.hash}var e=t.prototype;return e.updateRenderData=function(){this._updateProperties(),this._updateTexture()},e.destroy=function(){this.image=null,bM.getInstance().put(this.data)},e._updateProperties=function(){if(this.data=bM.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=UP(this.context,this.char,this.labelInfo.fontDesc),i=2*this.labelInfo.margin+2;this.width=parseFloat(e.toFixed(2))*t+i,this.height=(1+IP)*this.labelInfo.fontSize*t+i,this.offsetY=-this.labelInfo.fontSize*IP*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 $f),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=RM,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,o=i/2,a=n/2+s*xP+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||CM;t.strokeStyle="rgba("+u.r+", "+u.g+", "+u.b+", "+u.a/255+")",t.lineWidth=2*e.margin*r,t.strokeText(this.char,o,a)}t.fillText(this.char,o,a)}},t}(),IM=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=Pf.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 __;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 q(16363)}},e}(Sg),xM=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 IM;i.initWithSize(t,e),this.fontDefDictionary=new yM(i),this._halfBleed=1,this._width=t,this._height=e,DD.on(ID.EVENT_BEFORE_SCENE_LAUNCH,this.beforeSceneLoad,this)}var e=t.prototype;return e.insertLetterTexture=function(t){var e=t.image,i=DD.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 q(12100),null;if(!this.fontDefDictionary.texture)return null;this.fontDefDictionary.texture.drawTextureAt(e,this._x,this._y),this._dirty=!0;var s=new vM;return s.u=this._x+this._halfBleed,s.v=this._y+this._halfBleed,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();var t=this.fontDefDictionary;t&&t.texture&&(t.texture.destroy(),t.texture=null)},e.getTexture=function(){return this.fontDefDictionary.getTexture()},e.beforeSceneLoad=function(){this.clearAllCache()},e.clearAllCache=function(){this.destroy();var t=new IM;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=zP(t,0)+e.hash,n=this.fontDefDictionary.letterDefinitions[i];if(!n){var r=new wM(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}(),DM={fontAtlas:null,fontSize:0,lineHeight:0,hAlign:0,vAlign:0,hash:"",fontFamily:"",fontDesc:"Arial",color:yn.WHITE.clone(),isOutlined:!1,out:yn.WHITE.clone(),margin:0,fontScale:1},OM=[new L_(e_.ATTR_POSITION,pl.RGB32F)],PM=[new L_(e_.ATTR_POSITION,pl.RGB32F),new L_(e_.ATTR_COLOR,pl.RGBA32F)],MM=[new L_(e_.ATTR_POSITION,pl.RGB32F),new L_(e_.ATTR_TEX_COORD,pl.RG32F),new L_(e_.ATTR_COLOR,pl.RGBA32F)],NM=[new L_(e_.ATTR_POSITION,pl.RGB32F),new L_(e_.ATTR_TEX_COORD,pl.RG32F),new L_(e_.ATTR_COLOR,pl.RGBA8,!0)],LM=[new L_(e_.ATTR_POSITION,pl.RGB32F),new L_(e_.ATTR_TEX_COORD,pl.RG32F),new L_(e_.ATTR_COLOR,pl.RGBA32F),new L_(e_.ATTR_COLOR2,pl.RGBA32F)],BM=[new L_(e_.ATTR_POSITION,pl.RGB32F),new L_(e_.ATTR_TEX_COORD,pl.RG32F),new L_(e_.ATTR_COLOR,pl.RGBA8,!0),new L_(e_.ATTR_COLOR2,pl.RGBA8,!0)];function FM(t){for(var e=0,i=0;i<t.length;i++){var n=t[i];e+=od[n.format].count}return e}function kM(t){for(var e=0,i=0;i<t.length;i++){var n=t[i];e+=od[n.format].size}return e}m.internal.vfmtPosUvColor=MM,m.internal.vfmtPosUvTwoColor=LM,m.internal.vfmtPosUvColor4B=NM,m.internal.vfmtPosUvTwoColor4B=BM,t("UIVertexFormat",Object.freeze({__proto__:null,vfmt:OM,vfmtPosColor:PM,vfmtPosUvColor:MM,vfmtPosUvColor4B:NM,vfmtPosUvTwoColor:LM,vfmtPosUvTwoColor4B:BM,getComponentPerVertex:FM,getAttributeStride:kM})),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"}(AM||(AM={}));var UM,GM,HM,zM,VM,WM,XM=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=kM(e)>>2,this._initVDataCount,this._floatsPerVertex,et(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 q(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=Fo.__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,o=this.indexOffset,a=0;a<e;++a){var h=this._iaPool[a],u=new Float32Array(this.vData.buffer,0,s>>2),c=new Uint16Array(this.iData.buffer,0,o),l=h.vertexBuffers[0];s>l.size&&l.resize(s),l.update(u),2*o>h.indexBuffer.size&&h.indexBuffer.resize(2*o),h.indexBuffer.update(c)}this.dirty=!1}},t.createNewIA=function(t){var e,i,n;if(Fo.__isWebIOS14OrIPadOS14Env||!this._iaPool[0]){var r=this._vertexFormatBytes=this._floatsPerVertex*Float32Array.BYTES_PER_ELEMENT,s=Uint16Array.BYTES_PER_ELEMENT,o=t.createBuffer(new v_(vl.VERTEX|vl.TRANSFER_DST,El.HOST|El.DEVICE,r,r));n=t.createBuffer(new v_(vl.INDEX|vl.TRANSFER_DST,El.HOST|El.DEVICE,s,s)),i=[o],this._iaInfo=new F_(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}()),jM=function(){function t(t,e){this._buffers=[],this._device=t,this._attributes=e,this._floatsPerVertex=kM(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}(),YM=new Ws((function(){return{offset:0,length:0}}),32),KM=function(){function t(t,e,i,n,r,s){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}(),qM=function(t){function e(i,n,r,s){var o;return(o=t.call(this,i,n)||this)._freeLists=[],o._vCount=0,o._iCount=0,o._id=0,o._vCount=r||Math.floor(1024*Ie.BATCHER2D_MEM_INCREMENT/o._vertexFormatBytes),o._iCount=s||o._vCount*e.IB_SCALE,o._id=e.generateID(),o._allocateBuffer(),o}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)YM.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){var i=t*this.vertexFormatBytes;if(t>this._vCount||e>this._iCount)return Z(9004,i),null;for(var n,r=null,s=0,o=-1,a=null,h=0;h<this._buffers.length;++h){r=this._buffers[h],n=this._freeLists[h];for(var u=0;u<n.length;++u)if(n[u].length>=i){a=n[u],s=h,o=u;break}if(a)break}if(a||(s=this._allocateBuffer(),(r=this._buffers[s])&&(o=0,a=this._freeLists[s][o])),a){var c=a.offset/this.vertexFormatBytes,l=new Float32Array(r.vData.buffer,a.offset,i>>2).fill(0);return this._allocateChunkFromEntry(s,o,a,i),new KM(this,s,r,c,l,e)}return 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,o=0,a=null,h=e[o];h&&h.offset<n;)a=h,h=e[++o];if(a&&0==n-(a.offset+a.length)&&(a.length+=r,n=a.offset,r=a.length,h&&h.offset-(n+r)==0&&(a.length+=h.length,e.splice(o,1),YM.free(h),h=null),s=!0),!s&&h){if(0==h.offset-(n+r))h.offset=n,h.length+=r;else{var u=YM.alloc();u.offset=n,u.length=r,e.splice(o,0,u)}s=!0}if(s)n+r===i.byteOffset&&(i.byteOffset=n);else{var c=YM.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,o=this._buffers[t];o.byteOffset<s&&(o.byteOffset=s),tt(r>=0,9004,t,i.offset,i.length),0===r?(this._freeLists[t].splice(e,1),YM.free(i)):(i.offset+=n,i.length=r)},i._allocateBuffer=function(){tt(this._buffers.length===this._freeLists.length,9003);var t=new XM,e=this._vCount*this._floatsPerVertex;t.initialize(this._device,this._attributes,e,this._iCount),this._buffers.push(t);var i=YM.alloc();i.offset=0,i.length=t.vData.byteLength;var n=[i];return this._freeLists.push(n),DD.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}(jM);qM.IB_SCALE=4,qM.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"}(UM||(UM={})),function(t){t[t.BufferID=0]="BufferID",t[t.AccessorID=1]="AccessorID",t[t.Count=2]="Count"}(GM||(GM={})),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"}(HM||(HM={})),function(t){t[t.COMP=0]="COMP",t[t.MODEL=1]="MODEL",t[t.MIDDLEWARE=2]="MIDDLEWARE",t[t.SUB_NODE=3]="SUB_NODE"}(zM||(zM={})),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=zM.COMP,this._subNode=null,this.init(t);var e=this._nativeObj.getAttrSharedBufferForJS(),i=0;this._uint8SharedBuffer=new Uint8Array(e,i,UM.Count),i+=UM.Count*Uint8Array.BYTES_PER_ELEMENT,this._uint16SharedBuffer=new Uint16Array(e,i,GM.Count),i+=GM.Count*Uint16Array.BYTES_PER_ELEMENT,this._uint32SharedBuffer=new Uint32Array(e,i,HM.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"}(VM||(VM={})),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"}(WM||(WM={}));var QM,ZM,JM,$M,tN,eN=t("StencilManager",function(){function t(){this._maskStack=[],this._stencilPattern={stencilTest:!0,func:Dl.ALWAYS,stencilMask:65535,writeMask:65535,failOp:Ol.KEEP,zFailOp:Ol.KEEP,passOp:Ol.KEEP,ref:1},this._stage=VM.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!==VM.ENTER_LEVEL?VM.CLEAR_INVERTED:VM.CLEAR},e.enableMask=function(){this.stage=VM.ENABLED},e.exitMask=function(){0!==this._maskStack.length&&(this._maskStack.pop(),0===this._maskStack.length?this.stage=VM.DISABLED:this.stage=VM.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=VM.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=Dl.LESS,o=this.stencilStateMap;if(e&&e.passes[0]){var a=e.passes[0].depthStencilState,h=0,u=0;a.depthTest&&(h=1),a.depthWrite&&(u=1),i=h|u<<1|a.depthFunc<<2|t<<6|this._maskStack.length<<9,n=a.depthTest,r=a.depthWrite,s=a.depthFunc,o=this.stencilStateMapWithDepth}else i=t<<16|this._maskStack.length;if(o&&o.has(i))return o.get(i);this.setStateFromStage(t);var c=new Dd(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 o.set(i,c),c},e.getStencilHash=function(t){return t<<8|this._maskStack.length},e.setStateFromStage=function(t){var e=this._stencilPattern;t===VM.DISABLED?(e.stencilTest=!1,e.func=Dl.ALWAYS,e.failOp=Ol.KEEP,e.stencilMask=e.writeMask=65535,e.ref=1):(e.stencilTest=!0,t===VM.ENABLED?(e.func=Dl.EQUAL,e.failOp=Ol.KEEP,e.stencilMask=e.ref=this.getStencilRef(),e.writeMask=this.getWriteMask()):t===VM.CLEAR?(e.func=Dl.NEVER,e.failOp=Ol.ZERO,e.writeMask=e.stencilMask=e.ref=this.getWriteMask()):t===VM.CLEAR_INVERTED||t===VM.ENTER_LEVEL?(e.func=Dl.NEVER,e.failOp=Ol.REPLACE,e.writeMask=e.stencilMask=e.ref=this.getWriteMask()):t===VM.ENTER_LEVEL_INVERTED&&(e.func=Dl.NEVER,e.failOp=Ol.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}());eN.sharedManager=null,eN.sharedManager=new eN,function(t){t[t.STATIC=0]="STATIC",t[t.DYNAMIC=1]="DYNAMIC",t[t.CROSSED=2]="CROSSED"}(QM||(QM={})),function(t){t[t.localOpacity=0]="localOpacity",t[t.count=1]="count"}(ZM||(ZM={})),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"}(JM||(JM={})),function(t){t[t.colorDirty=0]="colorDirty",t[t.enabled=1]="enabled",t[t.useLocal=2]="useLocal",t[t.count=3]="count"}($M||($M={})),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"}(tN||(tN={}));var iN,nN,rN,sN,oN,aN,hN,uN,cN,lN,_N,dN=function(){function t(){this._renderEntityType=QM.STATIC,this._dynamicDrawInfoArr=[],this._node=null,this._renderTransform=null,this._stencilStage=VM.DISABLED,this._useLocal=!1,this._maskMode=tN.NONE,this._color=yn.WHITE.clone(),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}(),fN=kM(MM)>>2,pN=t("BaseRenderData",function(){function t(t){void 0===t&&(t=MM),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=MM,this._drawInfoType=zM.COMP,this._multiOwner=!1,this._batcher=null,this._floatStride=t===MM?fN:kM(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=zM.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=DD.root.batcher2D),this._batcher}}]),t}()),gN=t("RenderData",function(t){function e(e,i){var n;return void 0===e&&(e=MM),void 0===i&&(i=null),(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._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=MM),void 0===i&&(i=null);var n=new e(t,i);return i||(i=DD.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=nl(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.clear=function(){this.resize(0,0),this._data.length=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=DD.root.device;return new qM(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:yn.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}(pN)),mN=t("MeshRenderData",function(t){function e(e){var i;return void 0===e&&(e=MM),(i=t.call(this,e)||this)._isMeshBuffer=!0,i.vertexStart=0,i.vertexRange=0,i.indexStart=0,i.indexRange=0,i.lastFilledIndex=0,i.lastFilledVertex=0,i.frame=null,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=MM);var i=new e;return i._floatStride=t===MM?fN:kM(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,o=this.vData.length,a=this.iData.length;if(i>r||n>s){for(;r<i||s<n;)r=4*(o*=2),s=a*=2;this._reallocBuffer(o,a)}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 v_(vl.VERTEX|vl.TRANSFER_DST,El.DEVICE,i,i)));var r=Uint16Array.BYTES_PER_ELEMENT;this._indexBuffer||(this._indexBuffer=t.createBuffer(new v_(vl.INDEX|vl.TRANSFER_DST,El.DEVICE,r,r))),this._iaInfo=new F_(this._vertexFormat,n,this._indexBuffer),this._iaPool=new Xs((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}(pN)),vN=new Hn,yN=new Hn,TN=new _n,EN=new Ln,SN=new Ln,AN=new Ln,bN=new Ln(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),CN=new Yn,RN=va("cc.UITransform")(iN=Ta(110)(iN=Ea(((oN=function(t){function e(){var e;return(e=t.call(this)||this)._priority=0,e._contentSize=rN&&rN(),e._anchorPoint=sN&&sN(),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(Dg.PARENT_CHANGED,this._parentChanged,this),this._markRenderDataDirty()},i.onDisable=function(){this.node.off(Dg.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(Oi((t=t).width,r.width,xi)&&Oi(t.height,r.height,xi))return;i=t.width,n=t.height}else{if(Oi(t=t,r.width,xi)&&Oi(e,r.height,xi))return;i=t,n=e}r.width=i,r.height=n,this.node.emit(Dg.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(Dg.ANCHOR_CHANGED,this._anchorPoint),this._markRenderDataDirty()},i.isHit=function(t){for(var e=this._contentSize.width,i=this._contentSize.height,n=vN,r=yN,s=this._getRenderScene().cameras,o=0;o<s.length;o++){var a=s[o];if(a.visibility&this.node.layer){a.node.getWorldRT(EN);var h=EN.m12,u=EN.m13,c=ko.center;if(EN.m12=c.x-(EN.m00*h+EN.m04*u),EN.m13=c.y-(EN.m01*h+EN.m05*u),Ln.invert(EN,EN),Hn.transformMat4(n,t,EN),this.node.getWorldMatrix(AN),Ln.invert(EN,AN),!Ln.strictEquals(EN,bN)){Hn.transformMat4(r,n,EN),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=TN,s=vN,o=yN,a=this._getRenderScene().cameras,h=0;h<a.length;h++){var u=a[h];if(u.visibility&this.node.layer&&(!u.window||u.window.swapchain)&&u.systemWindowId===e&&(_n.set(r,t.x,t.y,0),u.screenToWorld(r,r),Hn.set(s,r.x,r.y),this.node.getWorldMatrix(AN),Ln.invert(EN,AN),!Ln.strictEquals(EN,bN))){Hn.transformMat4(o,s,EN),o.x+=this._anchorPoint.x*i,o.y+=this._anchorPoint.y*n;var c=!1;if(o.x>=0&&o.y>=0&&o.x<=i&&o.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,o=0,a=0;r&&a<s;++o,r=r.parent){var h=n[a];if(o===h.index){if(r!==h.comp.node){n.length=a;break}var u=h.comp;if(u&&u._enabled&&!u.isHit(t))return!1;a++}else if(o>h.index){n.length=a;break}}return!0},i.convertToNodeSpaceAR=function(t,e){return this.node.getWorldMatrix(AN),Ln.invert(EN,AN),e||(e=new _n),_n.transformMat4(e,t,EN)},i.convertToWorldSpaceAR=function(t,e){return this.node.getWorldMatrix(AN),e||(e=new _n),_n.transformMat4(e,t,AN)},i.getBoundingBox=function(){var t=new Yn;return this._selfBoundingBox(t),Ln.fromSRT(SN,this.node.rotation,this.node.position,this.node.scale),t.transformMat4(SN),t},i.getBoundingBoxToWorld=function(){for(var t=new Yn,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(CN),CN.transformMat4(r.worldMatrix),0===t.width?t.set(CN):Yn.union(t,t,CN))}}return this._contentSize.width&&this._contentSize.height&&(this._selfBoundingBox(CN),CN.transformMat4(this.node.worldMatrix),0===t.width?t.set(CN):Yn.union(t,t,CN)),t},i.getBoundingBoxTo=function(t){var i=new Yn,n=this.node.children;Ln.invert(EN,t);for(var r=0;r<n.length;++r){var s=n[r];if(s&&s.active){var o=s.getComponent(e);o&&o.contentSize.width&&o.contentSize.height&&(o._selfBoundingBox(CN),Ln.multiply(SN,s.worldMatrix,EN),CN.transformMat4(SN),0===i.width?i.set(CN):Yn.union(i,i,CN))}}return this._contentSize.width&&this._contentSize.height&&(this._selfBoundingBox(CN),Ln.multiply(SN,this.node.worldMatrix,EN),CN.transformMat4(SN),0===i.width?i.set(CN):Yn.union(i,i,CN)),i},i.getComputeAABB=function(t){var e=this._contentSize.width,i=this._contentSize.height;CN.set(-this._anchorPoint.x*e,-this._anchorPoint.y*i,e,i),CN.transformMat4(this.node.worldMatrix);var n=CN.x+.5*CN.width,r=CN.y+.5*CN.height,s=this.node.worldPosition.z,o=CN.width/2,a=CN.height/2;return null!=t?(Xo.set(t,n,r,s,o,a,.001),t):new Xo(n,r,s,o,a,.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(Dg.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(Dg.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(Dg.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(Dg.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(Dg.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(Dg.ANCHOR_CHANGED,this._anchorPoint),this._markRenderDataDirty())}},{key:"priority",get:function(){return this._priority},set:function(t){this._priority!==t&&(this.node.getComponent("cc.RenderRoot2D")?q(6706):(this._priority=t,this.node.parent&&e.insertChangeMap(this.node.parent)))}},{key:"visibility",get:function(){var t=DD.root.batcher2D.getFirstRenderCamera(this.node);return t?t.visibility:0}},{key:"cameraPriority",get:function(){var t=DD.root.batcher2D.getFirstRenderCamera(this.node);return t?t.priority:0}}]),e}(xp)).EventType=Dg,oN.priorityChangeNodeMap=new Map,rN=ua((nN=oN).prototype,"_contentSize",[wa],(function(){return new Xn(100,100)})),sN=ua(nN.prototype,"_anchorPoint",[wa],(function(){return new Hn(.5,.5)})),iN=nN))||iN)||iN)||iN;t({UITransform:RN,UITransformComponent:RN}),DD.on(ID.EVENT_AFTER_UPDATE,RN._sortSiblings),DD.on(ID.EVENT_BEFORE_SCENE_LAUNCH,RN._cleanChangeMap);var wN,IN,xN,DN,ON,PN,MN,NN,LN,BN,FN,kN,UN,GN={parent:null,owner:null,subModelIdx:0},HN=Ea,zN=Za,VN=t("Renderer",(aN=va("cc.Renderer"),hN=zN($E),uN=zN([$E]),aN(cN=HN((f((lN=function(t){function e(){var e;return(e=t.call(this)||this)._materials=_N&&_N(),e._materialInstances=[],e}s(e,t);var i=e.prototype;return i.getMaterial=function(t){return this.getSharedMaterial(t)},i.setMaterial=function(t,e){this.setSharedMaterial(t,e)},i.getSharedMaterial=function(t){return t<0||t>=this._materials.length?null:this._materials[t]},i.setSharedMaterial=function(t,e){t&&t instanceof hS&&Z(12012),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]){GN.parent=this._materials[t],GN.owner=this,GN.subModelIdx=t;var e=new hS(GN);GN.parent=null,GN.owner=null,GN.subModelIdx=0,this.setMaterialInstance(e,t)}return this._materialInstances[t]},i.setMaterialInstance=function(t,e){if("number"==typeof t){q(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.setSharedMaterial(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.setSharedMaterial(t[e],e);if(t.length<this._materials.length){for(var i=t.length;i<this._materials.length;i++)this.setSharedMaterial(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}(xp)).prototype,"sharedMaterials",[hN],Object.getOwnPropertyDescriptor(lN.prototype,"sharedMaterials"),lN.prototype),_N=ua(lN.prototype,"_materials",[uN],(function(){return[]})),cN=lN))||cN)||cN));Se(Pl),Se(Ml),Se(Nl),t("InstanceMaterialType",UN),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"}(UN||t("InstanceMaterialType",UN={}));var WN=(wN=va("cc.UIRenderer"),IN=ya(RN),xN=Za($E),DN=Za($E),wN(ON=IN(((kN=function(t){function e(){var e;return(e=t.call(this)||this)._renderData=null,e._materials=MN&&MN(),e._customMaterial=NN&&NN(),e._srcBlendFactor=LN&&LN(),e._dstBlendFactor=BN&&BN(),e._color=FN&&FN(),e._stencilStage=VM.DISABLED,e._assembler=null,e._postAssembler=null,e._renderDataFlag=!0,e._renderFlag=!0,e._instanceMaterialType=-1,e._srcBlendFactorCache=Pl.SRC_ALPHA,e._dstBlendFactorCache=Pl.ONE_MINUS_SRC_ALPHA,e._dirtyVersion=-1,e._internalId=-1,e._flagChangedVersion=-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(Dg.ANCHOR_CHANGED,this._nodeStateChange,this),this.node.on(Dg.SIZE_CHANGED,this._nodeStateChange,this),this.node.on(Dg.PARENT_CHANGED,this._colorDirty,this),this.updateMaterial(),this._colorDirty(),vD.addRenderer(this),this.markForUpdateRenderData()},i.onRestore=function(){this.updateMaterial(),this.markForUpdateRenderData()},i.onDisable=function(){this.node.off(Dg.ANCHOR_CHANGED,this._nodeStateChange,this),this.node.off(Dg.SIZE_CHANGED,this._nodeStateChange,this),this.node.off(Dg.PARENT_CHANGED,this._colorDirty,this),vD.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),vD.markDirtyRenderer(this)}},i.requestRenderData=function(t){void 0===t&&(t=zM.COMP);var e=gN.add();return e.initRenderDrawInfo(this,t),this._renderData=e,e},i.destroyRenderData=function(){this._renderData&&(this._renderData.removeRenderDrawInfo(this),gN.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.setSharedMaterial(this._customMaterial,0);else{var t=this._updateBuiltinMaterial();this.setSharedMaterial(t,0),this.stencilStage!==VM.ENTER_LEVEL&&this.stencilStage!==VM.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=Pl.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 UN.ADD_COLOR:t=NE.get("ui-base-material");break;case UN.GRAYSCALE:t=NE.get("ui-sprite-gray-material");break;case UN.USE_ALPHA_SEPARATED:t=NE.get("ui-sprite-alpha-sep-material");break;case UN.USE_ALPHA_SEPARATED_AND_GRAY:t=NE.get("ui-sprite-gray-alpha-sep-material");break;default:t=NE.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 dN(QM.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.setSharedMaterial(t[e],e);if(t.length<this._materials.length){for(var i=t.length;i<this._materials.length;i++)this.setSharedMaterial(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 DD.root.batcher2D}},{key:"renderEntity",get:function(){return this._renderEntity}}]),e}(VN)).BlendState=Pl,kN.Assembler=null,kN.PostAssembler=null,f((PN=kN).prototype,"sharedMaterials",[hh],Object.getOwnPropertyDescriptor(PN.prototype,"sharedMaterials"),PN.prototype),f(PN.prototype,"customMaterial",[xN],Object.getOwnPropertyDescriptor(PN.prototype,"customMaterial"),PN.prototype),MN=ua(PN.prototype,"_materials",[hh],(function(){return[]})),NN=ua(PN.prototype,"_customMaterial",[DN],(function(){return null})),LN=ua(PN.prototype,"_srcBlendFactor",[wa],(function(){return Pl.SRC_ALPHA})),BN=ua(PN.prototype,"_dstBlendFactor",[wa],(function(){return Pl.ONE_MINUS_SRC_ALPHA})),FN=ua(PN.prototype,"_color",[wa],(function(){return yn.WHITE.clone()})),ON=PN))||ON)||ON);t({UIRenderer:WN,RenderComponent:WN,UIRenderable:WN,Renderable2D:WN}),m.internal.UIRenderer=WN;var XN,jN,YN,KN,qN,QN,ZN,JN,$N,tL,eL,iL,nL,rL,sL,oL,aL,hL,uL,cL,lL,_L,dL,fL,pL,gL,mL,vL,yL,TL,EL,SL,AL,bL,CL,RL,wL,IL,xL=function(){function t(){this.isBold=!1,this.isItalic=!1,this.isUnderline=!1,this.underlineHeight=1,this.isOutlined=!1,this.outlineColor=yn.WHITE.clone(),this.outlineWidth=1,this.hasShadow=!1,this.shadowColor=yn.BLACK.clone(),this.shadowBlur=2,this.shadowOffsetX=0,this.shadowOffsetY=0,this.color=yn.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}(),DL=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 Xn,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}(),OL=function(){function t(){this.parsedString=[],this.nodeContentSize=Xn.ZERO.clone(),this.canvasSize=new Xn,this.canvasPadding=new Yn,this.contentSizeExtend=Xn.ZERO.clone(),this.startPosition=Hn.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}(),PL=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}();yn.WHITE.clone(),t("HorizontalTextAlignment",CL),function(t){t[t.LEFT=0]="LEFT",t[t.CENTER=1]="CENTER",t[t.RIGHT=2]="RIGHT"}(CL||t("HorizontalTextAlignment",CL={})),Se(CL),t("VerticalTextAlignment",RL),function(t){t[t.TOP=0]="TOP",t[t.CENTER=1]="CENTER",t[t.BOTTOM=2]="BOTTOM"}(RL||t("VerticalTextAlignment",RL={})),Se(RL),t("Overflow",wL),function(t){t[t.NONE=0]="NONE",t[t.CLAMP=1]="CLAMP",t[t.SHRINK=2]="SHRINK",t[t.RESIZE_HEIGHT=3]="RESIZE_HEIGHT"}(wL||t("Overflow",wL={})),Se(wL),t("CacheMode",IL),function(t){t[t.NONE=0]="NONE",t[t.BITMAP=1]="BITMAP",t[t.CHAR=2]="CHAR"}(IL||t("CacheMode",IL={})),Se(IL);var ML=(XN=va("cc.Label"),jN=Ta(110),YN=Za(CL),KN=Za(RL),qN=Za(wL),QN=Za(RP),ZN=Za(IL),XN(JN=jN(((bL=function(t){function e(){var e;return(e=t.call(this)||this)._string=tL&&tL(),e._horizontalAlign=eL&&eL(),e._verticalAlign=iL&&iL(),e._actualFontSize=nL&&nL(),e._fontSize=rL&&rL(),e._fontFamily=sL&&sL(),e._lineHeight=oL&&oL(),e._overflow=aL&&aL(),e._enableWrapText=hL&&hL(),e._font=uL&&uL(),e._isSystemFontUsed=cL&&cL(),e._spacingX=lL&&lL(),e._isItalic=_L&&_L(),e._isBold=dL&&dL(),e._isUnderline=fL&&fL(),e._underlineHeight=pL&&pL(),e._cacheMode=gL&&gL(),e._enableOutline=mL&&mL(),e._outlineColor=vL&&vL(),e._outlineWidth=yL&&yL(),e._enableShadow=TL&&TL(),e._shadowColor=EL&&EL(),e._shadowOffset=SL&&SL(),e._shadowBlur=AL&&AL(),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 xL,e._textLayout=new DL,e._textLayoutData=new OL,e._textRenderData=new PL,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.destroyTtfSpriteFrame=function(){if(this._ttfSpriteFrame){this._ttfSpriteFrame._resetDynamicAtlasFrame();var t=this._ttfSpriteFrame.texture;if(this._ttfSpriteFrame.destroy(),t){var e=t;e.image&&e.image.destroy(),t.destroy()}this._ttfSpriteFrame=null}},i._onPreDestroy=function(){t.prototype._onPreDestroy.call(this),this._isOnLoadCalled||this.destroyTtfSpriteFrame()},i.onDestroy=function(){this._assembler&&this._assembler.resetAssemblerData&&this._assembler.resetAssemblerData(this._assemblerData),this._assemblerData=null,this.destroyTtfSpriteFrame(),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 TM){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 TM){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===IL.CHAR)this._letterTexture=this._assembler.getAssemblerData(),this._texture=this._letterTexture;else if(!this._ttfSpriteFrame){this._ttfSpriteFrame=new TP,this._assemblerData=this._assembler.getAssemblerData();var i=new $f(this._assemblerData.canvas),n=new Sg;n.image=i,this._ttfSpriteFrame.texture=n}this.cacheMode!==IL.CHAR&&(this._texture=this._ttfSpriteFrame),this.changeMaterialForDefine()}},i.changeMaterialForDefine=function(){if(this._texture){var t=!1;if(this.cacheMode!==IL.CHAR){var e=this._texture.texture;if(e instanceof rp){var i=e.getPixelFormat();t=i===Pf.RGBA_ETC1||i===Pf.RGB_A_PVRTC_4BPPV1||i===Pf.RGB_A_PVRTC_2BPPV1}}this._instanceMaterialType=t?UN.USE_ALPHA_SEPARATED:UN.ADD_COLOR_AND_TEXTURE,this.updateMaterial()}},i._updateBlendFunc=function(){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!==IL.BITMAP||this._font instanceof TM||!this._ttfSpriteFrame||this._ttfSpriteFrame._resetDynamicAtlasFrame(),this._cacheMode===IL.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:"enableOutline",get:function(){return this._enableOutline},set:function(t){this._enableOutline!==t&&(this._enableOutline=t,this.markForUpdateRenderData())}},{key:"outlineColor",get:function(){return this._outlineColor},set:function(t){this._outlineColor!==t&&(this._outlineColor.set(t),this.markForUpdateRenderData())}},{key:"outlineWidth",get:function(){return this._outlineWidth},set:function(t){this._outlineWidth!==t&&(this._outlineWidth=t,this.markForUpdateRenderData())}},{key:"enableShadow",get:function(){return this._enableShadow},set:function(t){this._enableShadow!==t&&(this._enableShadow=t,this.markForUpdateRenderData())}},{key:"shadowColor",get:function(){return this._shadowColor},set:function(t){this._shadowColor!==t&&(this._shadowColor.set(t),this.markForUpdateRenderData())}},{key:"shadowOffset",get:function(){return this._shadowOffset},set:function(t){this._shadowOffset!==t&&(this._shadowOffset.set(t),this.markForUpdateRenderData())}},{key:"shadowBlur",get:function(){return this._shadowBlur},set:function(t){this._shadowBlur!==t&&(this._shadowBlur=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 TM?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}(WN)).HorizontalAlign=CL,bL.VerticalAlign=RL,bL.Overflow=wL,bL.CacheMode=IL,bL._canvasPool=bM.getInstance(),f(($N=bL).prototype,"horizontalAlign",[YN],Object.getOwnPropertyDescriptor($N.prototype,"horizontalAlign"),$N.prototype),f($N.prototype,"verticalAlign",[KN],Object.getOwnPropertyDescriptor($N.prototype,"verticalAlign"),$N.prototype),f($N.prototype,"overflow",[qN],Object.getOwnPropertyDescriptor($N.prototype,"overflow"),$N.prototype),f($N.prototype,"font",[QN],Object.getOwnPropertyDescriptor($N.prototype,"font"),$N.prototype),f($N.prototype,"cacheMode",[ZN],Object.getOwnPropertyDescriptor($N.prototype,"cacheMode"),$N.prototype),tL=ua($N.prototype,"_string",[wa],(function(){return"label"})),eL=ua($N.prototype,"_horizontalAlign",[wa],(function(){return CL.CENTER})),iL=ua($N.prototype,"_verticalAlign",[wa],(function(){return RL.CENTER})),nL=ua($N.prototype,"_actualFontSize",[wa],(function(){return 0})),rL=ua($N.prototype,"_fontSize",[wa],(function(){return 40})),sL=ua($N.prototype,"_fontFamily",[wa],(function(){return"Arial"})),oL=ua($N.prototype,"_lineHeight",[wa],(function(){return 40})),aL=ua($N.prototype,"_overflow",[wa],(function(){return wL.NONE})),hL=ua($N.prototype,"_enableWrapText",[wa],(function(){return!0})),uL=ua($N.prototype,"_font",[wa],(function(){return null})),cL=ua($N.prototype,"_isSystemFontUsed",[wa],(function(){return!0})),lL=ua($N.prototype,"_spacingX",[wa],(function(){return 0})),_L=ua($N.prototype,"_isItalic",[wa],(function(){return!1})),dL=ua($N.prototype,"_isBold",[wa],(function(){return!1})),fL=ua($N.prototype,"_isUnderline",[wa],(function(){return!1})),pL=ua($N.prototype,"_underlineHeight",[wa],(function(){return 2})),gL=ua($N.prototype,"_cacheMode",[wa],(function(){return IL.NONE})),mL=ua($N.prototype,"_enableOutline",[wa],(function(){return!1})),vL=ua($N.prototype,"_outlineColor",[wa],(function(){return new yn(0,0,0,255)})),yL=ua($N.prototype,"_outlineWidth",[wa],(function(){return 2})),TL=ua($N.prototype,"_enableShadow",[wa],(function(){return!1})),EL=ua($N.prototype,"_shadowColor",[wa],(function(){return new yn(0,0,0,255)})),SL=ua($N.prototype,"_shadowOffset",[wa],(function(){return new Hn(2,2)})),AL=ua($N.prototype,"_shadowBlur",[wa],(function(){return 2})),JN=$N))||JN)||JN);t({Label:ML,LabelComponent:ML}),m.Label=ML;var NL,LL,BL=0,FL={};function kL(t){return--t,t|=t>>16,t|=t>>8,t|=t>>4,t|=t>>2,t|=t>>1,++t}function UL(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"}(NL||(NL={})),function(t){t[t.DEFAULT=1]="DEFAULT",t[t.FORWARD=2]="FORWARD",t[t.SHADOWCAST=4]="SHADOWCAST"}(LL||(LL={}));var GL,HL,zL,VL,WL,XL,jL,YL,KL,qL=function(){function t(t){this._format=pl.UNKNOWN,this._formatSize=0,this._chunks=[],this._chunkCount=0,this._handles=[],this._region0=new __,this._region1=new __,this._region2=new __,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=od[t.format];this._format=t.format,this._formatSize=e.size,this._channels=e.count,this._bufferViewCtor=pd(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=UL(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 o={chunkIdx:i,start:n,end:n+t,texture:s.texture};return this._handles.push(o),o}var a=Math.sqrt(t/this._formatSize),h=this._roundUpFn&&this._roundUpFn(a,this._formatSize)||Math.max(1024,kL(a)),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;G("TextureBufferPool: Allocate chunk "+this._chunkCount+", size: "+e+", format: "+this._format);var i={texture:this._device.createTexture(new A_(Sl.TEX2D,Al.SAMPLED|Al.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,o=r%t.texture.width,a=Math.floor(r/t.texture.width),h=Math.min(t.texture.width-o,s),u=0;o>0&&(this._region0.texOffset.x=o,this._region0.texOffset.y=a,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),o=0,a+=1,s-=h,u+=h),s>0&&(this._region1.texOffset.x=o,this._region1.texOffset.y=a,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),o=0,a+=this._region1.texExtent.height,s-=h,u+=h),s>0&&(this._region2.texOffset.x=o,this._region2.texOffset.y=a,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})),o=0;o<s.length;o++){var a=s[o];if(r+t<=a.start){n=!0;break}r=a.end}!n&&r+t<=i.size&&(n=!0)}return n?r:-1},e._McDonaldAlloc=function(t){t=UL(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 o=Math.sqrt(t/this._formatSize),a=this._roundUpFn&&this._roundUpFn(o,this._formatSize)||Math.max(1024,kL(o)),h=this._chunks[this.createChunk(a)];h.start+=t;var u={chunkIdx:this._chunkCount,start:0,end:t,texture:h.texture};return this._handles.push(u),u},t}(),QL=function(){function t(t,e,i){this._arrayBuffers=[],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"}(KL||(KL={}));var ZL,JL,$L=function(){function t(t,e,i,n,r){void 0===r&&(r=8),this._arrayBuffers=[],this._freeLists=[],this._uint32BufferViews=[],this._float32BufferViews=[],this._hasUint32=!1,this._hasFloat32=!1,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 QL(t,r,this._stride);var s=KL.NEVER,o=!1,a=!1;for(var h in e){if(o=this._hasFloat32,(a=this._hasUint32)&&o)break;s=e[h],o||s!==KL.FLOAT32?a||s!==KL.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=[],o=[],a=this._hasFloat32,h=this._hasUint32,u=0;u<this._entriesPerChunk;u++)a&&r.push(new Float32Array(n,this._stride*u,this._elementCount)),h&&s.push(new Uint32Array(n,this._stride*u,this._elementCount)),u&&o.push(u);return h&&this._uint32BufferViews.push(s),a&&this._float32BufferViews.push(r),this._freeLists.push(o),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]===KL.UINT32?this._uint32BufferViews:this._float32BufferViews)[i][n],o=this._dataMembers[e];return s.subarray(r,r+o)},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"}(ZL||(ZL={})),function(t){t[t.POSITION=0]="POSITION",t[t.UV=3]="UV",t[t.COLOR=5]="COLOR",t[t.COUNT=9]="COUNT"}(JL||(JL={}));var tB,eB=((GL={})[JL.POSITION]=KL.FLOAT32,GL[JL.UV]=KL.FLOAT32,GL[JL.COLOR]=KL.UINT32,GL[JL.COUNT]=KL.NEVER,GL),iB=((HL={})[JL.POSITION]=JL.UV-JL.POSITION,HL[JL.UV]=JL.COLOR-JL.UV,HL[JL.COLOR]=JL.COUNT-JL.COLOR,HL[JL.COUNT]=1,HL),nB=new $L(ZL.RENDER2D,eB,iB,JL);!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"}(tB||(tB={}));var rB,sB=((zL={})[tB.DIRTY_FLAG]=KL.UINT32,zL[tB.LAYER]=KL.UINT32,zL[tB.WORLD_SCALE]=KL.FLOAT32,zL[tB.WORLD_POSITION]=KL.FLOAT32,zL[tB.WORLD_ROTATION]=KL.FLOAT32,zL[tB.WORLD_MATRIX]=KL.FLOAT32,zL[tB.LOCAL_SCALE]=KL.FLOAT32,zL[tB.LOCAL_POSITION]=KL.FLOAT32,zL[tB.LOCAL_ROTATION]=KL.FLOAT32,zL[tB.COUNT]=KL.NEVER,zL),oB=((VL={})[tB.DIRTY_FLAG]=tB.LAYER-tB.DIRTY_FLAG,VL[tB.LAYER]=tB.WORLD_SCALE-tB.LAYER,VL[tB.WORLD_SCALE]=tB.WORLD_POSITION-tB.WORLD_SCALE,VL[tB.WORLD_POSITION]=tB.WORLD_ROTATION-tB.WORLD_POSITION,VL[tB.WORLD_ROTATION]=tB.WORLD_MATRIX-tB.WORLD_ROTATION,VL[tB.WORLD_MATRIX]=tB.LOCAL_SCALE-tB.WORLD_MATRIX,VL[tB.LOCAL_SCALE]=tB.LOCAL_POSITION-tB.LOCAL_SCALE,VL[tB.LOCAL_POSITION]=tB.LOCAL_ROTATION-tB.LOCAL_POSITION,VL[tB.LOCAL_ROTATION]=tB.COUNT-tB.LOCAL_ROTATION,VL[tB.COUNT]=1,VL),aB=new $L(ZL.NODE,sB,oB,tB);!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"}(rB||(rB={}));var hB,uB=((WL={})[rB.PRIORITY]=KL.UINT32,WL[rB.STAGE]=KL.UINT32,WL[rB.PHASE]=KL.UINT32,WL[rB.PRIMITIVE]=KL.UINT32,WL[rB.BATCHING_SCHEME]=KL.UINT32,WL[rB.DYNAMIC_STATE]=KL.UINT32,WL[rB.HASH]=KL.UINT32,WL[rB.COUNT]=KL.NEVER,WL),cB=((XL={})[rB.PRIORITY]=rB.STAGE-rB.PRIORITY,XL[rB.STAGE]=rB.PHASE-rB.STAGE,XL[rB.PHASE]=rB.PRIMITIVE-rB.PHASE,XL[rB.PRIMITIVE]=rB.BATCHING_SCHEME-rB.PRIMITIVE,XL[rB.BATCHING_SCHEME]=rB.DYNAMIC_STATE-rB.BATCHING_SCHEME,XL[rB.DYNAMIC_STATE]=rB.HASH-rB.DYNAMIC_STATE,XL[rB.HASH]=rB.COUNT-rB.HASH,XL[rB.COUNT]=1,XL),lB=new $L(ZL.PASS,uB,cB,rB);!function(t){t[t.CENTER=0]="CENTER",t[t.HALFEXTENTS=3]="HALFEXTENTS",t[t.COUNT=6]="COUNT"}(hB||(hB={}));var _B=((jL={})[hB.CENTER]=KL.FLOAT32,jL[hB.HALFEXTENTS]=KL.FLOAT32,jL[hB.COUNT]=KL.NEVER,jL),dB=((YL={})[hB.CENTER]=hB.HALFEXTENTS-hB.CENTER,YL[hB.HALFEXTENTS]=hB.COUNT-hB.HALFEXTENTS,YL[hB.COUNT]=1,YL),fB=new $L(ZL.AABB,_B,dB,hB);st($I.prototype,"RenderScene.prototype",[{name:"raycastUI2DNode"},{name:"raycastUINode"}]),st($I.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"}]),st(II.prototype,"Model.prototype",[{name:"isInstancingEnabled"},{name:"instancedAttributes"}]);var pB={};st(pB,"CameraVisFlags",[{name:"GENERAL"}]),rt(pB,"CameraVisFlags",[{name:"PROFILER",newName:"PROFILER",target:Rg.BitMask,targetName:"PROFILER"},{name:"GIZMOS",newName:"GIZMOS",target:Rg.BitMask,targetName:"GIZMOS"},{name:"EDITOR",newName:"EDITOR",target:Rg.BitMask,targetName:"EDITOR"},{name:"UI",newName:"UI",target:Rg.BitMask,targetName:"UI_3D"},{name:"UI2D",newName:"UI2D",target:Rg.BitMask,targetName:"UI_2D"}]),m.CameraVisFlags=pB;var gB={};st(gB,"VisibilityFlags",[{name:"GENERAL"}]),rt(gB,"VisibilityFlags",[{name:"ALWALS",newName:"ALWALS",target:Rg.Enum,targetName:"ALWALS"},{name:"PROFILER",newName:"PROFILER",target:Rg.Enum,targetName:"PROFILER"},{name:"GIZMOS",newName:"GIZMOS",target:Rg.Enum,targetName:"GIZMOS"},{name:"EDITOR",newName:"EDITOR",target:Rg.Enum,targetName:"EDITOR"},{name:"UI",newName:"UI",target:Rg.Enum,targetName:"UI_3D"},{name:"UI2D",newName:"UI2D",target:Rg.Enum,targetName:"UI_2D"}]),m.VisibilityFlags=gB,rt(GE.prototype,"Pass.prototype",[{name:"getBindingTypeFromHandle",newName:"getDescriptorTypeFromHandle"}]),st(sI.prototype,"Camera.prototype",[{name:"getSplitFrustum"},{name:"setMatView"},{name:"setMatViewInv"},{name:"setMatProjInv"},{name:"setMatViewProjInv"},{name:"setMatProj"},{name:"setMatViewProj"},{name:"getMatViewInv"}]),st(oS.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"}]),st(jI.prototype,"SpotLight.prototype",[{name:"aspect"}]),rt(aI.prototype,"SubModel.prototype",[{name:"subMeshData",newName:"subMesh"}]),st(aI.prototype,"SubModel.prototype",[{name:"getSubModel",suggest:"Use `subModels[i]` instead"},{name:"subModelNum",suggest:"Use `subModels.length` instead"}]);var mB,vB,yB,TB=function(t){if(void 0===FL[t]){var e=1<<BL;FL[t]=e,BL+=1}},EB=Object.freeze({__proto__:null,addStage:TB,scene:JI,createIA:function(t,e){if(!e.positions)return Z(16306),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 L_(e_.ATTR_POSITION,pl.RGB32F)),e.normals&&s.push(new L_(e_.ATTR_NORMAL,pl.RGB32F)),e.uvs&&s.push(new L_(e_.ATTR_TEX_COORD,pl.RG32F)),e.colors&&s.push(new L_(e_.ATTR_COLOR,pl.RGB32F));var o=t.createBuffer(new v_(vl.VERTEX|vl.TRANSFER_DST,El.DEVICE,4*i.length,4*i.length/n));o.update(new Float32Array(i));var a=null;return e.indices&&(a=t.createBuffer(new v_(vl.INDEX|vl.TRANSFER_DST,El.DEVICE,2*e.indices.length,2))).update(new Uint16Array(e.indices)),t.createInputAssembler(new F_(s,[o],a))},programLib:uT,getDeviceShaderVersion:eT,RenderWindow:rx,get RenderQueue(){return NL},get PassStage(){return LL},genHandle:wy,getTypeFromHandle:Iy,getBindingFromHandle:xy,getCountFromHandle:Dy,getOffsetFromHandle:Oy,customizeType:Py,type2reader:My,type2writer:Ny,type2validator:Ly,getDefaultFromType:Fy,getStringFromType:ky,overrideMacros:Uy,get BatchingSchemes(){return PE},Pass:GE,nearestPOT:kL,TextureBufferPool:qL,MaterialInstance:hS,PassInstance:aS,get PoolType(){return ZL},NULL_HANDLE:0,get Render2dView(){return JL},Render2dPool:nB,get NodeView(){return tB},NodePool:aB,get PassView(){return rB},PassPool:lB,get AABBView(){return hB},AABBPool:fB,RenderScene:$I,CameraVisFlags:pB,VisibilityFlags:gB});t("renderer",EB),function(t){t[t.BUTT=0]="BUTT",t[t.ROUND=1]="ROUND",t[t.SQUARE=2]="SQUARE"}(mB||(mB={})),Se(mB),function(t){t[t.BEVEL=0]="BEVEL",t[t.ROUND=1]="ROUND",t[t.MITER=2]="MITER"}(vB||(vB={})),Se(vB),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"}(yB||(yB={})),Se(yB);var SB=Math.PI,AB=Math.min,bB=Math.max,CB=Math.cos,RB=Math.sin,wB=Math.abs,IB=Math.sign,xB=.5522847493;function DB(t,e,i,n,r){t.moveTo(e-n,i),t.bezierCurveTo(e-n,i+r*xB,e-n*xB,i+r,e,i+r),t.bezierCurveTo(e+n*xB,i+r,e+n,i+r*xB,e+n,i),t.bezierCurveTo(e+n,i-r*xB,e+n*xB,i-r,e,i-r),t.bezierCurveTo(e-n*xB,i-r,e-n,i-r*xB,e-n,i),t.close()}function OB(t,e,i,n,r,s,o,a,h,u,c){var l,_,d,f,p,g,m,v,y,T,E,S,A,b,C,R;u>10||(p=.5*(s+a),g=.5*(o+h),m=.5*((l=.5*(e+n))+(d=.5*(n+s))),v=.5*((_=.5*(i+r))+(f=.5*(r+o))),((C=wB((n-a)*(b=h-i)-(r-h)*(A=a-e)))+(R=wB((s-a)*b-(o-h)*A)))*(C+R)<t.tessTol*(A*A+b*b)?t.addPoint(a,h,0===c?c|yB.PT_BEVEL:c):(OB(t,e,i,l,_,m,v,E=.5*(m+(y=.5*(d+p))),S=.5*(v+(T=.5*(f+g))),u+1,0),OB(t,E,S,y,T,p,g,a,h,u+1,c)))}var PB,MB,NB,LB,BB,FB,kB,UB,GB,HB,zB,VB,WB,XB,jB,YB,KB,qB,QB,ZB,JB,$B,tF,eF,iF,nF,rF,sF,oF,aF,hF,uF,cF,lF,_F,dF,fF,pF=function(t){function e(e,i){var n;return(n=t.call(this,e,i)||this).dx=0,n.dy=0,n.dmx=0,n.dmy=0,n.flags=0,n.len=0,n}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}(Hn),gF=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}(),mF=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=yn.WHITE.clone(),this.lineCap=mB.BUTT,this.strokeColor=yn.BLACK.clone(),this.lineJoin=vB.MITER,this.lineWidth=0,this.pointsOffset=0,this._commandX=0,this._commandY=0,this._points=[],this._renderDataList=[],this._curPath=null,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,yB.PT_CORNER),this._commandX=t,this._commandY=e},e.lineTo=function(t,e){this.addPoint(t,e,yB.PT_CORNER),this._commandX=t,this._commandY=e},e.bezierCurveTo=function(t,e,i,n,r,s){var o=this._curPath,a=o.points[o.points.length-1];a&&(a.x!==t||a.y!==e||i!==r||n!==s?(OB(this,a.x,a.y,t,e,i,n,r,s,0,yB.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,o){var a,h,u=0,c=0,l=0,_=0,d=0,f=0,p=0,g=0,m=0,v=0,y=0,T=0,E=0,S=0;if(c=s-r,o=o||!1)if(wB(c)>=2*SB)c=2*SB;else for(;c<0;)c+=2*SB;else if(wB(c)>=2*SB)c=2*-SB;else for(;c>0;)c-=2*SB;for(h=0|bB(1,AB(wB(c)/(.5*SB)+.5,5)),l=wB(4/3*(1-CB(a=c/h/2))/RB(a)),o||(l=-l),S=0;S<=h;S++)f=e+(_=CB(u=r+c*(S/h)))*n,p=i+(d=RB(u))*n,g=-d*n*l,m=_*n*l,0===S?t.moveTo(f,p):t.bezierCurveTo(v+T,y+E,f-g,p-m,f,p),v=f,y=p,T=g,E=m}(this,t,e,i,n,r,s)},e.ellipse=function(t,e,i,n){DB(this,t,e,i,n),this._curPath.complex=!1},e.circle=function(t,e,i){DB(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 o=AB(s,.5*wB(n))*IB(n),a=AB(s,.5*wB(r))*IB(r);t.moveTo(e,i+a),t.lineTo(e,i+r-a),t.bezierCurveTo(e,i+r-a*(1-xB),e+o*(1-xB),i+r,e+o,i+r),t.lineTo(e+n-o,i+r),t.bezierCurveTo(e+n-o*(1-xB),i+r,e+n,i+r-a*(1-xB),e+n,i+r-a),t.lineTo(e+n,i+a),t.bezierCurveTo(e+n,i+a*(1-xB),e+n-o*(1-xB),i,e+n-o,i),t.lineTo(e+o,i),t.bezierCurveTo(e+o*(1-xB),i,e,i+a*(1-xB),e,i+a),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&&(mN.remove(n),n.removeRenderDrawInfo(this._comp))}this._renderDataList.length=0},e.close=function(){this._curPath.closed=!0},e.requestRenderData=function(){var t=mN.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,o=r[this.pointsOffset++];o?(o.x=t,o.y=e):(o=new pF(t,e),r.push(o)),o.flags=i,s.push(o)}},e._addPath=function(){var t=this.pathLength,e=this.paths[t];return e?e.reset():(e=new gF,this.paths.push(e)),this.pathLength++,this._curPath=e,e},t}(),vF=PM.concat([new L_("a_dist",pl.R32F)]),yF=FM(vF),TF=kM(vF),EF=(PB=va("cc.Graphics"),MB=Ta(110),NB=Za(vB),LB=Za(mB),PB(BB=MB(((WB=function(t){function e(){var e;return(e=t.call(this)||this).impl=null,e.model=null,e._lineWidth=kB&&kB(),e._strokeColor=UB&&UB(),e._lineJoin=GB&&GB(),e._lineCap=HB&&HB(),e._fillColor=zB&&zB(),e._miterLimit=VB&&VB(),e._isDrawing=!1,e._isNeedUploadData=!0,e._graphicsUseSubMeshes=[],e._instanceMaterialType=UN.ADD_COLOR,e.impl=new mF(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=DD.root.createModel(II),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&&(DD.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=NE.get("ui-graphics-material"),this.setSharedMaterial(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=Qd.gfxDevice,i=e.createBuffer(new v_(vl.VERTEX|vl.TRANSFER_DST,El.DEVICE,65535*TF,TF)),n=e.createBuffer(new v_(vl.INDEX|vl.TRANSFER_DST,El.DEVICE,131070*Uint16Array.BYTES_PER_ELEMENT,Uint16Array.BYTES_PER_ELEMENT)),r=new kD([i],vF,Hl.TRIANGLE_LIST,n);r.subMeshIdx=0,this.model.initSubModel(t,r,this.getMaterialInstance(0)),this._graphicsUseSubMeshes.push(r)}}else q(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 o=new Float32Array(r.vData.buffer,0,r.vertexStart*yF);s.vertexBuffers[0].update(o),s.vertexCount=r.vertexStart;var a=new Uint16Array(r.iData.buffer,0,r.indexStart);s.indexBuffer.update(a),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 dN(QM.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}(WN)).LineJoin=vB,WB.LineCap=mB,f((FB=WB).prototype,"lineJoin",[NB],Object.getOwnPropertyDescriptor(FB.prototype,"lineJoin"),FB.prototype),f(FB.prototype,"lineCap",[LB],Object.getOwnPropertyDescriptor(FB.prototype,"lineCap"),FB.prototype),f(FB.prototype,"color",[hh],Object.getOwnPropertyDescriptor(FB.prototype,"color"),FB.prototype),kB=ua(FB.prototype,"_lineWidth",[wa],(function(){return 1})),UB=ua(FB.prototype,"_strokeColor",[wa],(function(){return yn.BLACK.clone()})),GB=ua(FB.prototype,"_lineJoin",[wa],(function(){return vB.MITER})),HB=ua(FB.prototype,"_lineCap",[wa],(function(){return mB.BUTT})),zB=ua(FB.prototype,"_fillColor",[wa],(function(){return yn.WHITE.clone()})),VB=ua(FB.prototype,"_miterLimit",[wa],(function(){return 10})),BB=FB))||BB)||BB);t({Graphics:EF,GraphicsComponent:EF}),m.Graphics=EF,function(t){t[t.SIMPLE=0]="SIMPLE",t[t.SLICED=1]="SLICED",t[t.TILED=2]="TILED",t[t.FILLED=3]="FILLED"}(lF||(lF={})),Se(lF),function(t){t[t.HORIZONTAL=0]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL",t[t.RADIAL=2]="RADIAL"}(_F||(_F={})),Se(_F),function(t){t[t.CUSTOM=0]="CUSTOM",t[t.TRIMMED=1]="TRIMMED",t[t.RAW=2]="RAW"}(dF||(dF={})),Se(dF),function(t){t.SPRITE_FRAME_CHANGED="spriteframe-changed"}(fF||(fF={}));var SF,AF,bF,CF,RF,wF,IF,xF,DF,OF,PF=(XB=va("cc.Sprite"),jB=Ta(110),YB=Za(SP),KB=Za(TP),qB=Za(lF),QB=Za(_F),ZB=Za(dF),XB(JB=jB(((cF=function(t){function e(){var e;return(e=t.call(this)||this)._spriteFrame=tF&&tF(),e._type=eF&&eF(),e._fillType=iF&&iF(),e._sizeMode=nF&&nF(),e._fillCenter=rF&&rF(),e._fillStart=sF&&sF(),e._fillRange=oF&&oF(),e._isTrimmedMode=aF&&aF(),e._useGrayscale=hF&&hF(),e._atlas=uF&&uF(),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===lF.SLICED&&e.on(TP.EVENT_UV_UPDATED,this._updateUVs,this))},i.onDisable=function(){t.prototype.onDisable.call(this),this._spriteFrame&&this._type===lF.SLICED&&this._spriteFrame.off(TP.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 q(16377)},i.changeMaterialForDefine=function(){var t,e=this._instanceMaterialType;this._spriteFrame&&(t=this._spriteFrame.texture);var i=!1;if(t instanceof rp){var n=t.getPixelFormat();i=n===Pf.RGBA_ETC1||n===Pf.RGB_A_PVRTC_4BPPV1||n===Pf.RGB_A_PVRTC_2BPPV1}i&&this.grayscale?this._instanceMaterialType=UN.USE_ALPHA_SEPARATED_AND_GRAY:i?this._instanceMaterialType=UN.USE_ALPHA_SEPARATED:this.grayscale?this._instanceMaterialType=UN.GRAYSCALE:this._instanceMaterialType=UN.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 fI){var i=new $E;i.copy(e,{defines:{SAMPLE_FROM_RT:!0}}),e=i}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===lF.SLICED?this._spriteFrame.on(TP.EVENT_UV_UPDATED,this._updateUVs,this):this._spriteFrame.off(TP.EVENT_UV_UPDATED,this._updateUVs,this))},i._applySpriteSize=function(){if(this._spriteFrame)if(dF.RAW===this._sizeMode){var t=this._spriteFrame.originalSize;this.node._uiProps.uiTransformComp.setContentSize(t)}else if(dF.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===lF.SLICED&&t.off(TP.EVENT_UV_UPDATED,this._updateUVs,this);var i=!1;e&&(t&&t.texture===e.texture||(i=!0),i&&(this.renderData&&(this.renderData.textureDirty=!0),(!!t&&t.texture instanceof fI)!=e.texture instanceof fI&&(this._instanceMaterialType=-1),this.changeMaterialForDefine()),this._applySpriteSize(),this._type===lF.SLICED&&e.on(TP.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===_F.RADIAL||this._fillType===_F.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===lF.FILLED&&this.renderData&&this.markForUpdateRenderData()}},{key:"fillStart",get:function(){return this._fillStart},set:function(t){this._fillStart=Pi(t,0,1),this._type===lF.FILLED&&this.renderData&&(this.markForUpdateRenderData(),this._updateUVs())}},{key:"fillRange",get:function(){return this._fillRange},set:function(t){this._fillRange=Pi(t,-1,1),this._type===lF.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===lF.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!==dF.CUSTOM&&this._applySpriteSize())}}]),e}(WN)).FillType=_F,cF.Type=lF,cF.SizeMode=dF,cF.EventType=fF,f(($B=cF).prototype,"spriteAtlas",[YB],Object.getOwnPropertyDescriptor($B.prototype,"spriteAtlas"),$B.prototype),f($B.prototype,"spriteFrame",[KB],Object.getOwnPropertyDescriptor($B.prototype,"spriteFrame"),$B.prototype),f($B.prototype,"type",[qB],Object.getOwnPropertyDescriptor($B.prototype,"type"),$B.prototype),f($B.prototype,"fillType",[QB],Object.getOwnPropertyDescriptor($B.prototype,"fillType"),$B.prototype),f($B.prototype,"sizeMode",[ZB],Object.getOwnPropertyDescriptor($B.prototype,"sizeMode"),$B.prototype),tF=ua($B.prototype,"_spriteFrame",[wa],(function(){return null})),eF=ua($B.prototype,"_type",[wa],(function(){return lF.SIMPLE})),iF=ua($B.prototype,"_fillType",[wa],(function(){return _F.HORIZONTAL})),nF=ua($B.prototype,"_sizeMode",[wa],(function(){return dF.TRIMMED})),rF=ua($B.prototype,"_fillCenter",[wa],(function(){return new Hn(0,0)})),sF=ua($B.prototype,"_fillStart",[wa],(function(){return 0})),oF=ua($B.prototype,"_fillRange",[wa],(function(){return 0})),aF=ua($B.prototype,"_isTrimmedMode",[wa],(function(){return!0})),hF=ua($B.prototype,"_useGrayscale",[wa],(function(){return!1})),uF=ua($B.prototype,"_atlas",[wa],(function(){return null})),JB=$B))||JB)||JB);t({Sprite:PF,SpriteComponent:PF}),m.Sprite=PF;var MF,NF=new Ln,LF=new Hn,BF=new Ln,FF=[];!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"}(MF||(MF={})),Se(MF);var kF,UF,GF,HF,zF,VF,WF=(SF=va("cc.Mask"),AF=Ta(110),bF=Za(MF),SF(CF=AF(((OF=function(t){function e(){var e;return(e=t.call(this)||this)._type=wF&&wF(),e._inverted=IF&&IF(),e._segments=xF&&xF(),e._alphaThreshold=DF&&DF(),e._sprite=null,e._graphics=null,e._stencilStage=VM.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(Dg.ANCHOR_CHANGED,this._nodeStateChange,this),this.node.on(Dg.SIZE_CHANGED,this._nodeStateChange,this)},i.onRestore=function(){this._changeRenderType(),this._updateGraphics()},i.onDisable=function(){this._disableRender(),this.node.off(Dg.ANCHOR_CHANGED,this._nodeStateChange,this),this.node.off(Dg.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=LF;this.node.getWorldMatrix(NF),Ln.invert(BF,NF),Hn.transformMat4(s,t,BF);var o=e.anchorPoint;s.x+=o.x*n,s.y+=o.y*r;var a=!1;if(this.type===MF.GRAPHICS_RECT||this.type===MF.GRAPHICS_STENCIL||this.type===MF.SPRITE_STENCIL)a=s.x>=0&&s.y>=0&&s.x<=n&&s.y<=r;else if(this.type===MF.GRAPHICS_ELLIPSE){var h=n/2,u=r/2,c=s.x-.5*n,l=s.y-.5*r;a=c*c/(h*h)+l*l/(u*u)<1}return this._inverted&&(a=!a),a},i._nodeStateChange=function(){this._updateGraphics()},i._changeRenderType=function(){this._type!==MF.SPRITE_STENCIL?this._createGraphics():this._createSprite()},i._createSprite=function(){if(!this._sprite){var t=this._sprite=this.node.getComponent(PF);if(!t){var e=this.node;t=this._sprite=e.addComponent(PF)}}this._sprite.stencilStage=this.inverted?VM.ENTER_LEVEL_INVERTED:VM.ENTER_LEVEL,this._sprite.updateMaterial()},i._createGraphics=function(){if(!this._graphics){var t=this._graphics=this.node.getComponent(EF);if(!t){var e=this.node;t=this._graphics=e.addComponent(EF)}t.lineWidth=1;var i=yn.WHITE.clone();i.a=0,t.fillColor=i}this._graphics.stencilStage=this.inverted?VM.ENTER_LEVEL_INVERTED:VM.ENTER_LEVEL},i._updateGraphics=function(){if(this._graphics&&(this._type===MF.GRAPHICS_RECT||this._type===MF.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,o=-n*s.x,a=-r*s.y;if(this._type===MF.GRAPHICS_RECT)e.rect(o,a,n,r);else if(this._type===MF.GRAPHICS_ELLIPSE){for(var h=function(t,e,i){FF.length=0;for(var n=2*Math.PI/i,r=0;r<i;++r)FF.push(new _n(e.x*Math.cos(n*r)+t.x,e.y*Math.sin(n*r)+t.y,0));return FF}(new _n(o+n/2,a+r/2,0),new _n(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=VM.DISABLED,this.subComp.updateMaterial(),this.node.activeInHierarchy&&(this.subComp.enabled=!1))},i._removeMaskNode=function(){this._sprite&&(this._sprite=null),this._graphics&&(this._graphics=null)},i.markForUpdateRenderData=function(t){void 0===t&&(t=!0),q(9007),this.subComp&&this.subComp.markForUpdateRenderData(t)},i.requestRenderData=function(){q(9007)},i.destroyRenderData=function(){q(9007)},i.updateRenderer=function(){q(9007),this.subComp&&this.subComp.updateRenderer()},i.fillBuffers=function(){q(9007)},i.postUpdateAssembler=function(){q(9007)},i.setNodeDirty=function(){q(9007),this.subComp&&this.subComp.setNodeDirty()},i.setTextureDirty=function(){q(9007),this.subComp&&this.subComp.setTextureDirty()},i.getMaterial=function(t){return q(9007),this.subComp?this.subComp.getSharedMaterial(t):null},i.setMaterial=function(t,e){q(9007),this.subComp&&this.subComp.setMaterial(t,e)},i.getMaterialInstance=function(t){return q(9007),this.subComp?this.subComp.getMaterialInstance(t):null},i.setMaterialInstance=function(t,e){q(9007),this.subComp&&this.subComp.setMaterialInstance(t,e)},i.getRenderMaterial=function(t){return q(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!==MF.SPRITE_STENCIL?(this._sprite&&(this.node.removeComponent(PF),this._sprite._destroyImmediate(),this._sprite=null),this._changeRenderType(),this._updateGraphics()):(this._graphics&&(this._graphics.clear(),this.node.removeComponent(EF),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?VM.ENTER_LEVEL_INVERTED:VM.ENTER_LEVEL}},{key:"segments",get:function(){return this._segments},set:function(t){this._segments!==t&&(this._segments=Pi(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:Z(16307)}},{key:"alphaThreshold",get:function(){return this._alphaThreshold},set:function(t){this._alphaThreshold!==t&&(this._alphaThreshold=t,this.type===MF.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 q(9007),this.subComp?this.subComp.customMaterial:null},set:function(t){q(9007),this.subComp&&(this.subComp.customMaterial=t)}},{key:"color",get:function(){return q(9007),this.subComp?this.subComp.color:null},set:function(t){q(9007),this.subComp&&t&&(this.subComp.color=t)}},{key:"sharedMaterial",get:function(){return q(9007),this.subComp?this.subComp.sharedMaterial:null}},{key:"sharedMaterials",get:function(){return q(9007),this.subComp?this.subComp.sharedMaterials:null},set:function(t){q(9007),this.subComp&&t&&(this.subComp.sharedMaterials=t)}},{key:"material",get:function(){return q(9007),this.subComp?this.subComp.material:null},set:function(t){q(9007),this.subComp&&(this.subComp.material=t)}},{key:"materials",get:function(){return q(9007),this.subComp?this.subComp.materials:[null]},set:function(t){q(9007),this.subComp&&(this.subComp.materials=t)}}]),e}(xp)).Type=MF,f((RF=OF).prototype,"type",[bF],Object.getOwnPropertyDescriptor(RF.prototype,"type"),RF.prototype),wF=ua(RF.prototype,"_type",[wa],(function(){return MF.GRAPHICS_RECT})),IF=ua(RF.prototype,"_inverted",[wa],(function(){return!1})),xF=ua(RF.prototype,"_segments",[wa],(function(){return 64})),DF=ua(RF.prototype,"_alphaThreshold",[wa],(function(){return.1})),CF=RF))||CF)||CF);t({Mask:WF,MaskComponent:WF}),mx._maskComp=WF,m.Mask=WF,gt({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}}),gt({UIRenderable:{newName:"UIRenderer",since:"3.0.0",removed:!0}}),gt({Renderable2D:{newName:"UIRenderer",since:"3.6.0",removed:!1}});var XF,jF,YF,KF,qF,QF,ZF,JF,$F,tk,ek,ik,nk,rk,sk,ok,ak,hk,uk,ck,lk,_k,dk,fk,pk,gk,mk,vk,yk,Tk,Ek,Sk,Ak,bk,Ck,Rk,wk=va("cc.PostProcess")(kF=Ea(((VF=function(t){function e(){var e;return(e=t.call(this)||this).global=GF&&GF(),e._shadingScale=HF&&HF(),e.enableShadingScaleInEditor=zF&&zF(),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}(xp)).all=[],GF=ua((UF=VF).prototype,"global",[Sa,wa],(function(){return!0})),HF=ua(UF.prototype,"_shadingScale",[wa],(function(){return 1})),f(UF.prototype,"shadingScale",[Sa],Object.getOwnPropertyDescriptor(UF.prototype,"shadingScale"),UF.prototype),zF=ua(UF.prototype,"enableShadingScaleInEditor",[Sa,wa],(function(){return!1})),kF=UF))||kF)||kF,Ik=new _n,xk=ye(zw),Dk=ye(Hw),Ok=ye(Vw),Pk=ye(Xw),Mk=ye(Ww),Nk=ye({SKYBOX:nI|Zl.DEPTH_STENCIL,SOLID_COLOR:Zl.ALL,DEPTH_ONLY:Zl.DEPTH_STENCIL,DONT_CLEAR:Zl.NONE}),Lk=(XF=va("cc.Camera"),jF=Za(Rg.BitMask),YF=Za(Nk),KF=Za(xk),qF=Za(Dk),QF=Za(Ok),ZF=Za(Pk),JF=Za(Mk),$F=Za(fI),tk=Za(wk),XF(((Ck=function(t){function e(){var e;return(e=t.call(this)||this)._projection=nk&&nk(),e._priority=rk&&rk(),e._fov=sk&&sk(),e._fovAxis=ok&&ok(),e._orthoHeight=ak&&ak(),e._near=hk&&hk(),e._far=uk&&uk(),e._color=ck&&ck(),e._depth=lk&&lk(),e._stencil=_k&&_k(),e._clearFlags=dk&&dk(),e._rect=fk&&fk(),e._aperture=pk&&pk(),e._shutter=gk&&gk(),e._iso=mk&&mk(),e._screenScale=vk&&vk(),e._visibility=yk&&yk(),e._targetTexture=Tk&&Tk(),e._postProcess=Ek&&Ek(),e._usePostProcess=Sk&&Sk(),e._camera=null,e._inEditorMode=!1,e._flows=void 0,e._cameraType=Ak&&Ak(),e._trackingType=bk&&bk(),e}s(e,t);var i=e.prototype;return i.onLoad=function(){this._createCamera()},i.onEnable=function(){this.node.hasChangedFlags|=Ig.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=_r.create()),this._camera&&this._camera.screenPointToRay(i,t,e),i},i.worldToScreen=function(t,e){return e||(e=new _n),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 _n),!this._camera)return i;this.worldToScreen(t,Ik);var n=e.getComponent("cc.UITransform"),r=m.view.getVisibleSize(),s=Ik.x-.5*this._camera.width,o=Ik.y-.5*this._camera.height;return Ik.x=s/m.view.getScaleX()+.5*r.width,Ik.y=o/m.view.getScaleY()+.5*r.height,n&&n.convertToNodeSpaceAR(Ik,i),i},i._createCamera=function(){this._camera||(this._camera=m.director.root.createCamera(),this._camera.initialize({name:this.node.name,node:this.node,projection:this._projection,window:this._inEditorMode?m.director.root&&m.director.root.mainWindow:m.director.root&&m.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=Li(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===Hw.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=Li(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?m.director.root&&m.director.root.mainWindow:m.director.root&&m.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}(xp)).ProjectionType=xk,Ck.FOVAxis=Dk,Ck.ClearFlag=Nk,Ck.Aperture=Ok,Ck.Shutter=Pk,Ck.ISO=Mk,Ck.TARGET_TEXTURE_CHANGE="tex-change",nk=ua((ik=Ck).prototype,"_projection",[wa],(function(){return xk.PERSPECTIVE})),rk=ua(ik.prototype,"_priority",[wa],(function(){return 0})),sk=ua(ik.prototype,"_fov",[wa],(function(){return 45})),ok=ua(ik.prototype,"_fovAxis",[wa],(function(){return Dk.VERTICAL})),ak=ua(ik.prototype,"_orthoHeight",[wa],(function(){return 10})),hk=ua(ik.prototype,"_near",[wa],(function(){return 1})),uk=ua(ik.prototype,"_far",[wa],(function(){return 1e3})),ck=ua(ik.prototype,"_color",[wa],(function(){return new yn("#333333")})),lk=ua(ik.prototype,"_depth",[wa],(function(){return 1})),_k=ua(ik.prototype,"_stencil",[wa],(function(){return 0})),dk=ua(ik.prototype,"_clearFlags",[wa],(function(){return Nk.SOLID_COLOR})),fk=ua(ik.prototype,"_rect",[wa],(function(){return new Yn(0,0,1,1)})),pk=ua(ik.prototype,"_aperture",[wa],(function(){return Ok.F16_0})),gk=ua(ik.prototype,"_shutter",[wa],(function(){return Pk.D125})),mk=ua(ik.prototype,"_iso",[wa],(function(){return Mk.ISO100})),vk=ua(ik.prototype,"_screenScale",[wa],(function(){return 1})),yk=ua(ik.prototype,"_visibility",[wa],(function(){return my})),Tk=ua(ik.prototype,"_targetTexture",[wa],(function(){return null})),Ek=ua(ik.prototype,"_postProcess",[wa],(function(){return null})),Sk=ua(ik.prototype,"_usePostProcess",[wa],(function(){return!1})),Ak=ua(ik.prototype,"_cameraType",[wa],(function(){return jw.DEFAULT})),bk=ua(ik.prototype,"_trackingType",[wa],(function(){return Yw.NO_TRACKING})),f(ik.prototype,"visibility",[jF],Object.getOwnPropertyDescriptor(ik.prototype,"visibility"),ik.prototype),f(ik.prototype,"clearFlags",[YF],Object.getOwnPropertyDescriptor(ik.prototype,"clearFlags"),ik.prototype),f(ik.prototype,"projection",[KF],Object.getOwnPropertyDescriptor(ik.prototype,"projection"),ik.prototype),f(ik.prototype,"fovAxis",[qF],Object.getOwnPropertyDescriptor(ik.prototype,"fovAxis"),ik.prototype),f(ik.prototype,"aperture",[QF],Object.getOwnPropertyDescriptor(ik.prototype,"aperture"),ik.prototype),f(ik.prototype,"shutter",[ZF],Object.getOwnPropertyDescriptor(ik.prototype,"shutter"),ik.prototype),f(ik.prototype,"iso",[JF],Object.getOwnPropertyDescriptor(ik.prototype,"iso"),ik.prototype),f(ik.prototype,"targetTexture",[$F],Object.getOwnPropertyDescriptor(ik.prototype,"targetTexture"),ik.prototype),f(ik.prototype,"usePostProcess",[Sa],Object.getOwnPropertyDescriptor(ik.prototype,"usePostProcess"),ik.prototype),f(ik.prototype,"postProcess",[tk],Object.getOwnPropertyDescriptor(ik.prototype,"postProcess"),ik.prototype),ek=ik))||ek);t({Camera:Lk,CameraComponent:Lk}),m.Camera=Lk;var Bk,Fk,kk,Uk,Gk,Hk,zk,Vk,Wk,Xk=t("RenderRoot2D",va("cc.RenderRoot2D")(Rk=Ta(100)(Rk=ya(RN)(Rk=Ea(Rk=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.onEnable=function(){m.director.root.batcher2D.addScreen(this)},i.onDisable=function(){m.director.root.batcher2D.removeScreen(this)},i.onDestroy=function(){m.director.root.batcher2D.removeScreen(this)},e}(xp))||Rk)||Rk)||Rk)||Rk),jk=new _n,Yk=ye({OVERLAY:0,INTERSPERSE:1}),Kk=(Bk=va("cc.Canvas"),Fk=Ta(100),kk=Za(Lk),Uk=Za(Lk),Bk(Gk=Fk(Gk=Ea((f((Hk=function(t){function e(){var e;return(e=t.call(this)||this)._cameraComponent=zk&&zk(),e._alignCanvasWithScreen=Vk&&Vk(),e._pos=new _n,e._renderMode=Yk.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(Lk.TARGET_TEXTURE_CHANGE,this._thisOnCameraResized)),this._onResizeCamera(),TO.on("canvas-resize",this._thisOnCameraResized,this)},i.onEnable=function(){t.prototype.onEnable.call(this),this._cameraComponent&&this._cameraComponent.node.on(Lk.TARGET_TEXTURE_CHANGE,this._thisOnCameraResized)},i.onDisable=function(){t.prototype.onDisable.call(this),this._cameraComponent&&this._cameraComponent.node.off(Lk.TARGET_TEXTURE_CHANGE,this._thisOnCameraResized)},i.onDestroy=function(){t.prototype.onDestroy.call(this),TO.off("canvas-resize",this._thisOnCameraResized,this)},i._onResizeCamera=function(){if(this._cameraComponent&&this._alignCanvasWithScreen){if(this._cameraComponent.targetTexture)this._cameraComponent.orthoHeight=ko.height/2;else{var t=Bo.windowSize;this._cameraComponent.orthoHeight=t.height/TO.getScaleY()/2}this.node.getWorldPosition(jk),this._cameraComponent.node.setWorldPosition(jk.x,jk.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===Yk.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}(Xk)).prototype,"cameraComponent",[kk],Object.getOwnPropertyDescriptor(Hk.prototype,"cameraComponent"),Hk.prototype),zk=ua(Hk.prototype,"_cameraComponent",[Uk],(function(){return null})),Vk=ua(Hk.prototype,"_alignCanvasWithScreen",[wa],(function(){return!0})),Gk=Hk))||Gk)||Gk)||Gk);function qk(t,e,i){var n=t.o,r=t.d,s=1/r.x,o=1/r.y,a=1/r.z,h=(e.x-n.x)*s,u=(i.x-n.x)*s,c=(e.y-n.y)*o,l=(i.y-n.y)*o,_=(e.z-n.z)*a,d=(i.z-n.z)*a,f=Math.max(Math.max(Math.min(h,u),Math.min(c,l)),Math.min(_,d)),p=Math.min(Math.min(Math.max(h,u),Math.max(c,l)),Math.max(_,d));return p<0||f>p?0:f>0?f:p}t({Canvas:Kk,CanvasComponent:Kk}),m.Canvas=Kk,st(t("UIComponent",va("cc.UIComponent")(Wk=ya(RN)(Wk=Ta(110)(Wk=Ea(Wk=function(t){function e(){var e;return(e=t.call(this)||this)._lastParent=null,e.stencilStage=VM.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}(xp))||Wk)||Wk)||Wk)||Wk).prototype,"UIComponent",[{name:"_visibility"},{name:"setVisibility"}]),rt(Kk.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:yn.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}}]),ot(RN.prototype,"UITransform.prototype",[{name:"priority",suggest:"Please use setSiblingIndex to change index of the current node in its parent's children array."}]),m.UITransformComponent=RN,Jt(RN,"cc.UITransformComponent"),Jt(WN,"cc.RenderComponent"),m.CanvasComponent=Kk,Jt(Kk,"cc.CanvasComponent"),m.internal.Renderable2D=WN,Jt(WN,"cc.Renderable2D");var Qk,Zk,Jk,$k,tU,eU,iU,nU=(Qk=Rs.create(),Zk={distance:1/0,doubleSided:!1,mode:xc.ANY},Jk=0,$k=function(t,e,i,n,r,s){t===xc.CLOSEST?(Jk>e||0===Jk)&&(Jk=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))):(Jk=e,s&&s.push({distance:e,vertexIndex0:i/3,vertexIndex1:n/3,vertexIndex2:r/3}))},function(t,e,i){if(Jk=0,0===e.geometricInfo.positions.length)return Jk;var n=void 0===i?Zk:i;if(qk(t,e.geometricInfo.boundingBox.min,e.geometricInfo.boundingBox.max)){var r=e.primitiveMode,s=e.geometricInfo;!function(t,e,i,n,r){if(i===Hl.TRIANGLE_LIST)for(var s=e.length,o=0;o<s;o+=3){var a=3*e[o],h=3*e[o+1],u=3*e[o+2];_n.set(Qk.a,t[a],t[a+1],t[a+2]),_n.set(Qk.b,t[h],t[h+1],t[h+2]),_n.set(Qk.c,t[u],t[u+1],t[u+2]);var c=ds.rayTriangle(n,Qk,r.doubleSided);if(!(0===c||c>r.distance)&&($k(r.mode,c,a,h,u,r.result),r.mode===xc.ANY))return c}else if(i===Hl.TRIANGLE_STRIP)for(var l=e.length-2,_=0,d=0;d<l;d+=1){var f=3*e[d-_],p=3*e[d+_+1],g=3*e[d+2];_n.set(Qk.a,t[f],t[f+1],t[f+2]),_n.set(Qk.b,t[p],t[p+1],t[p+2]),_n.set(Qk.c,t[g],t[g+1],t[g+2]),_=~_;var m=ds.rayTriangle(n,Qk,r.doubleSided);if(!(0===m||m>r.distance)&&($k(r.mode,m,f,p,g,r.result),r.mode===xc.ANY))return m}else if(i===Hl.TRIANGLE_FAN){var v=e.length-1,y=3*e[0];_n.set(Qk.a,t[y],t[y+1],t[y+2]);for(var T=1;T<v;T+=1){var E=3*e[T],S=3*e[T+1];_n.set(Qk.b,t[E],t[E+1],t[E+2]),_n.set(Qk.c,t[S],t[S+1],t[S+2]);var A=ds.rayTriangle(n,Qk,r.doubleSided);if(!(0===A||A>r.distance)&&($k(r.mode,A,y,E,S,r.result),r.mode===xc.ANY))return A}}}(s.positions,s.indices,r,t,n)}return Jk}),rU=function(){var t=0,e={distance:1/0,doubleSided:!1,mode:xc.ANY};return function(i,n,r){t=0;var s=void 0===r?e:r,o=n.renderingSubMeshes.length,a=n.struct.minPosition,h=n.struct.maxPosition;if(a&&h&&!qk(i,a,h))return t;for(var u=0;u<o;u++){var c=n.renderingSubMeshes[u],l=nU(i,c,s);if(l)if(s.mode===xc.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===xc.ANY)return l}return t&&s.mode===xc.CLOSEST&&(s.result&&(s.result[0].distance=t,s.result.length=1),s.subIndices&&(s.subIndices.length=1)),t}}(),sU=function(){var t=0,e={distance:1/0,doubleSided:!1,mode:xc.ANY},i=new _r,n=new Ln;return function(r,s,o){t=0;var a=void 0===o?e:o,h=s.worldBounds;if(h&&!ds.rayAABB(r,h))return t;_r.copy(i,r),s.node&&(Ln.invert(n,s.node.getWorldMatrix(n)),_n.transformMat4(i.o,r.o,n),_n.transformMat4Normal(i.d,r.d,n));for(var u=s.subModels,c=0;c<u.length;c++){var l=u[c].subMesh,_=nU(i,l,a);if(_)if(a.mode===xc.CLOSEST)(0===t||t>_)&&(t=_,a.subIndices&&(a.subIndices[0]=c));else if(t=_,a.subIndices&&a.subIndices.push(c),a.mode===xc.ANY)return _}return t&&a.mode===xc.CLOSEST&&(a.result&&(a.result[0].distance=t,a.result.length=1),a.subIndices&&(a.subIndices.length=1)),t}}();ds.rayModel=sU,ds.raySubMesh=nU,ds.rayMesh=rU,LE("specular-pass");var oU,aU,hU,uU,cU,lU=va("cc.ModelRenderer")((eU=function(t){function e(){var e;return(e=t.call(this)||this)._visFlags=iU&&iU(),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}(VN),iU=ua(eU.prototype,"_visFlags",[wa],(function(){return Rg.Enum.NONE})),tU=eU))||tU;t({ModelRenderer:lU,RenderableComponent:lU});var _U,dU,fU,pU,gU,mU,vU,yU,TU,EU,SU,AU,bU=wa,CU=Za;t("PrefabLink",(oU=va("cc.PrefabLink"),aU=CU(mD),oU((uU=function(t){function e(){var e;return(e=t.call(this)||this).prefab=cU&&cU(),e}return s(e,t),e}(xp),cU=ua(uU.prototype,"prefab",[aU,bU],(function(){return null})),hU=uU))||hU)),rt(Lk,"Camera",[{name:"CameraClearFlag",newName:"ClearFlag"}]),rt(Lk.prototype,"Camera.prototype",[{name:"color",newName:"clearColor"},{name:"depth",newName:"clearDepth"},{name:"stencil",newName:"clearStencil"}]),ot(VN.prototype,"Renderer.prototype",[{name:"getMaterial",suggest:"please use renderer.getSharedMaterial instead."}]),m.CameraComponent=Lk,Jt(Lk,"cc.CameraComponent"),m.RenderableComponent=lU,Jt(lU,"cc.RenderableComponent"),function(t){t[t.SIMPLE=0]="SIMPLE",t[t.SLICED=1]="SLICED",t[t.TILED=2]="TILED"}(AU||(AU={})),t("SpriteRenderer",(_U=va("cc.SpriteRenderer"),dU=Ta(100),fU=Za(TP),_U(pU=dU((f((gU=function(t){function e(){var e;return(e=t.call(this)||this)._spriteFrame=mU&&mU(),e._mode=vU&&vU(),e._color=yU&&yU(),e._flipX=TU&&TU(),e._flipY=EU&&EU(),e._size=SU&&SU(),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&&(m.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=m.director.root.createModel(II);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|=Ig.POSITION,this._model.transform.hasChangedFlags|=Ig.POSITION;var e=t?t.renderingSubMeshes:null;if(e)for(var i=e.length,n=0;n<i;++n){var r=this.getRenderMaterial(n);r&&!r.isValid&&(r=null);var s=e[n];s&&this._model.initSubModel(n,s,r||this._getBuiltinMaterial())}this._model.enabled=!0}},i._getBuiltinMaterial=function(){return NE.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=Vm.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}(lU)).prototype,"spriteFrame",[fU],Object.getOwnPropertyDescriptor(gU.prototype,"spriteFrame"),gU.prototype),mU=ua(gU.prototype,"_spriteFrame",[wa],(function(){return null})),vU=ua(gU.prototype,"_mode",[wa],(function(){return AU.SIMPLE})),yU=ua(gU.prototype,"_color",[wa],(function(){return yn.WHITE.clone()})),TU=ua(gU.prototype,"_flipX",[wa],(function(){return!1})),EU=ua(gU.prototype,"_flipY",[wa],(function(){return!1})),SU=ua(gU.prototype,"_size",[wa],(function(){return new Hn})),pU=gU))||pU)||pU));var RU,wU,IU,xU,DU,OU,PU,MU,NU,LU,BU,FU,kU,UU,GU,HU,zU,VU,WU,XU,jU,YU,KU,qU,QU,ZU=new mM,JU="RICHTEXT_CHILD",$U="RICHTEXT_Image_CHILD",tG=new Hn,eG=new Hn,iG=new se((function(t){if(!m.isValid(t.node))return!1;var e=t.node.getComponent(ML);return e&&(e.outlineWidth=0),!0}),20),nG=new se((function(t){return m.isValid(t.node)}),10);function rG(t){return{node:new Tm(t),comp:null,lineCount:0,styleIndex:0,imageOffset:"",clickParam:"",clickHandler:"",type:t}}function sG(t,e){var i;t===JU?i=iG._get():t===$U&&(i=nG._get());var n=(i=i||rG(t)).node;return n||(n=new Tm(t)),n.hideFlags|=qs.Flags.DontSave|qs.Flags.HideInHierarchy,n.active=!0,t===$U?(i.comp=n.getComponent(PF)||n.addComponent(PF),i.comp.spriteFrame=e,i.comp.type=PF.Type.SLICED,i.comp.sizeMode=PF.SizeMode.CUSTOM):(i.comp=n.getComponent(ML)||n.addComponent(ML),i.comp.string=e,i.comp.horizontalAlign=CL.LEFT,i.comp.verticalAlign=RL.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 oG,aG=(RU=va("cc.RichText"),wU=Ta(110),IU=Za(CL),xU=Za(RL),DU=Za(yn),OU=Za(RP),PU=Za(IL),MU=Za(SP),RU(NU=wU(((QU=function(t){function e(){var e;return(e=t.call(this)||this)._lineHeight=BU&&BU(),e._string=FU&&FU(),e._horizontalAlign=kU&&kU(),e._verticalAlign=UU&&UU(),e._fontSize=GU&&GU(),e._fontColor=HU&&HU(),e._maxWidth=zU&&zU(),e._fontFamily=VU&&VU(),e._font=WU&&WU(),e._isSystemFontUsed=XU&&XU(),e._userDefinedFont=jU&&jU(),e._cacheMode=YU&&YU(),e._imageAtlas=KU&&KU(),e._handleTouchEvent=qU&&qU(),e._textArray=[],e._segments=[],e._labelSegmentsCache=[],e._linesWidth=[],e._lineCount=1,e._labelWidth=0,e._labelHeight=0,e._layoutDirty=!0,e._lineOffsetX=0,e._labelChildrenNum=0,e._updateRichTextStatus=e._updateRichText,e}s(e,t);var i=e.prototype;return i.onLoad=function(){this.node.on(Dg.LAYER_CHANGED,this._applyLayer,this),this.node.on(Dg.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=d(this._segments);!(t=e()).done;){var i=t.value;i.node.removeFromParent(),i.type===JU?iG.put(i):i.type===$U&&nG.put(i)}this.node.off(Dg.ANCHOR_CHANGED,this._updateRichTextPosition,this),this.node.off(Dg.LAYER_CHANGED,this._applyLayer,this)},i._addEventListeners=function(){this.node.on(Dg.TOUCH_END,this._onTouchEnded,this)},i._removeEventListeners=function(){this.node.off(Dg.TOUCH_END,this._onTouchEnded,this)},i._updateLabelSegmentTextAttributes=function(){var t=this;this._segments.forEach((function(e){t._applyTextAttribute(e)}))},i._createFontLabel=function(t){return sG(JU,t)},i._createImage=function(t){return sG($U,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(tG,e,t),tG.x<2048)i.push(t);else for(var n=t.split("\n"),r=0;r<n.length;r++)if(this._calculateSize(tG,e,n[r]),tG.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,o=n.substring(r,s),a=n.substring(s),h=this._calculateSize(tG,e,o),u=this._calculateSize(eG,e,a),c=this._maxWidth;0===this._maxWidth&&(c=2047.9);for(var l=1*c;h.x>l;){if((s/=2)<1){s*=2;break}o=o.substring(r,s),a=n.substring(s),this._calculateSize(h,e,o)}for(var _=1e3,d=1;_&&r<t.length;){for(;_&&h.x<l;){var f=jP(a);f&&f.length>0&&(d=f[0].length),s+=d,o=n.substring(r,s),a=n.substring(s),this._calculateSize(h,e,o),_--}for(;_&&o.length>=2&&h.x>l;)s-=d,o=n.substring(r,s),this._calculateSize(h,e,o),d=1,_--;if(o.length>=2){var p=YP(o);p&&p.length>0&&o!==p[0]&&(s-=p[0].length,o=n.substring(r,s))}if(i.push(o),r=s,s+=o.length,o=n.substring(r,s),a=n.substring(s),this._calculateSize(u,e,a),this._calculateSize(h,e,o),_--,u.x<2048&&h.x<l){i.push(o),r=t.length,s=t.length,o=a,""!==a&&i.push(o);break}}return i},i._measureText=function(t,e){var i=this,n=function(e){return i._calculateSize(tG,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(ML).string=i,n.styleIndex=e,this._applyTextAttribute(n);var r=n.node._uiProps.uiTransformComp.contentSize;return Hn.set(t,r.x,r.y),t},i._onTouchEnded=function(t){for(var e,i=this,n=this.node.getComponents(xp),r=function(){var r=e.value,s=r.clickHandler,o=r.clickParam;s&&i._containsTouchLocation(r,t.touch.getUILocation())&&(n.forEach((function(e){var i=e[s];e.enabledInHierarchy&&i&&i.call(e,t,o)})),t.propagationStopped=!0)},s=d(this._segments);!(e=s()).done;)r()},i._containsTouchLocation=function(t,e){var i=t.node.getComponent(RN);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===JU||i.name===$U){i.parent=null;var n=rG(i.name);n.node=i,i.name===JU?(n.comp=i.getComponent(ML),iG.put(n)):(n.comp=i.getComponent(PF),nG.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!==JU&&i.name!==$U||(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(ML);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),o=t.substr(r,s),a=this._measureText(i,o);if(!(this._lineOffsetX+a<=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+=a,r+=s}if(n>this._maxWidth)for(var u=KP(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(),o=1,a=s.width,h=s.height,u=e.imageWidth||0,c=e.imageHeight||0;c>0?(a*=o=c/h,h*=o):(a*=o=this._lineHeight/h,h*=o),u>0&&(a=u),this._maxWidth>0?(this._lineOffsetX+a>this._maxWidth&&this._updateLineInfo(),this._lineOffsetX+=a):(this._lineOffsetX+=a,this._lineOffsetX>this._labelWidth&&(this._labelWidth=this._lineOffsetX)),r.node._uiProps.uiTransformComp.setContentSize(a,h),r.lineCount=this._lineCount,r.clickHandler="",r.clickParam="";var l=e.event;l&&(r.clickHandler=l.click,r.clickParam=l.param)}else q(4400)}},i._updateTextDefaultColor=function(){for(var t=0;t<this._segments.length;++t){var e,i,n=this._segments[t],r=n.node.getComponent(ML);r&&(null!==(e=this._textArray[n.styleIndex])&&void 0!==e&&null!==(i=e.style)&&void 0!==i&&i.color||(r.color=this._fontColor))}},i._updateRichText=function(){if(this.enabledInHierarchy){var t=ZU.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 o=(s=this.splitLongStringApproximatelyIn2048(s,n).join("\n")).split("\n"),a=0;a<o.length;++a){var h=o[a];if(""!==h)if(i=!1,this._maxWidth>0){var u=this._measureText(n,h);this._updateRichTextWithMaxWidth(h,u,n),o.length>1&&a<o.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),o.length>1&&a<o.length-1&&this._updateLineInfo();else{if(this._isLastComponentCR(s)&&a===o.length-1)continue;this._updateLineInfo(),i=!0}}}}i||this._linesWidth.push(this._lineOffsetX),this._maxWidth>0&&(this._labelWidth=this._maxWidth),this._labelHeight=(this._lineCount+IP)*this._lineHeight,this.node._uiProps.uiTransformComp.setContentSize(this._labelWidth,this._labelHeight),this._updateRichTextPosition(),this._layoutDirty=!1}},i._getFirstWordLen=function(t,e,i){var n=HP(t,e);if(FP(n)||kP(n))return 1;for(var r=1,s=e+1;s<i&&!kP(n=HP(t,s))&&!FP(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,o=0;o<this._segments.length;++o){var a=this._segments[o],h=a.lineCount;h>e&&(t=0,e=h);var u=this._labelWidth*(.5*this._horizontalAlign-r);switch(this._horizontalAlign){case CL.LEFT:break;case CL.CENTER:u-=this._linesWidth[h-1]/2;break;case CL.RIGHT:u-=this._linesWidth[h-1]}var c=a.node.position;if(a.node.setPosition(t+u,this._lineHeight*(i-h)-this._labelHeight*s,c.z),h===e&&(t+=a.node._uiProps.uiTransformComp.width),a.node.getComponent(PF)){var l=a.node.position.clone(),_=this._lineHeight,d=this._lineHeight*(1+IP);switch(a.node._uiProps.uiTransformComp.anchorY){case 1:l.y+=_+(d-_)/2;break;case.5:l.y+=d/2;break;default:l.y+=(d-_)/2}if(a.imageOffset){var f=a.imageOffset.split(",");if(1===f.length&&f[0]){var p=parseFloat(f[0]);Number.isInteger(p)&&(l.y+=p)}else if(2===f.length){var g=parseFloat(f[0]),m=parseFloat(f[1]);Number.isInteger(g)&&(l.x+=g),Number.isInteger(m)&&(l.y+=m)}}a.node.position=l}var v=a.node.getComponent(ML);if(v&&v.enableOutline){var y=a.node.position.clone();y.y-=v.outlineWidth,a.node.position=y}}},i._convertLiteralColorValue=function(t){var e=t.toUpperCase();return yn[e]?yn[e]:(new yn).fromHEX(t)},i._applyTextAttribute=function(t){var e=t.node.getComponent(ML);if(e){this._resetLabelState(e);var i,n=t.styleIndex;if(this._textArray[n]&&(i=this._textArray[n].style),i){if(i.color?e.color=this._convertLiteralColorValue(i.color):e.color=this._fontColor,e.isBold=!!i.bold,e.isItalic=!!i.italic,e.isUnderline=!!i.underline,i.outline){var r=t.node.getComponent(ML);r||(r=t.node.addComponent(ML)),r.enableOutline=!0,r.outlineColor=this._convertLiteralColorValue(i.outline.color),r.outlineWidth=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 RP&&!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=d(this._segments);!(t=e()).done;)t.value.node.layer=this.node.layer},i._resetLabelState=function(t){t.fontSize=this._fontSize,t.color=this._fontColor,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:"fontColor",get:function(){return this._fontColor},set:function(t){this._fontColor!==t&&(this._fontColor=t,this._updateTextDefaultColor())}},{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}(xp)).HorizontalAlign=CL,QU.VerticalAlign=RL,f((LU=QU).prototype,"horizontalAlign",[IU],Object.getOwnPropertyDescriptor(LU.prototype,"horizontalAlign"),LU.prototype),f(LU.prototype,"verticalAlign",[xU],Object.getOwnPropertyDescriptor(LU.prototype,"verticalAlign"),LU.prototype),f(LU.prototype,"fontColor",[DU],Object.getOwnPropertyDescriptor(LU.prototype,"fontColor"),LU.prototype),f(LU.prototype,"font",[OU],Object.getOwnPropertyDescriptor(LU.prototype,"font"),LU.prototype),f(LU.prototype,"cacheMode",[PU],Object.getOwnPropertyDescriptor(LU.prototype,"cacheMode"),LU.prototype),f(LU.prototype,"imageAtlas",[MU],Object.getOwnPropertyDescriptor(LU.prototype,"imageAtlas"),LU.prototype),BU=ua(LU.prototype,"_lineHeight",[wa],(function(){return 40})),FU=ua(LU.prototype,"_string",[wa],(function(){return"<color=#00ff00>Rich</color><color=#0fffff>Text</color>"})),kU=ua(LU.prototype,"_horizontalAlign",[wa],(function(){return CL.LEFT})),UU=ua(LU.prototype,"_verticalAlign",[wa],(function(){return RL.TOP})),GU=ua(LU.prototype,"_fontSize",[wa],(function(){return 40})),HU=ua(LU.prototype,"_fontColor",[wa],(function(){return yn.WHITE.clone()})),zU=ua(LU.prototype,"_maxWidth",[wa],(function(){return 0})),VU=ua(LU.prototype,"_fontFamily",[wa],(function(){return"Arial"})),WU=ua(LU.prototype,"_font",[wa],(function(){return null})),XU=ua(LU.prototype,"_isSystemFontUsed",[wa],(function(){return!0})),jU=ua(LU.prototype,"_userDefinedFont",[wa],(function(){return null})),YU=ua(LU.prototype,"_cacheMode",[wa],(function(){return IL.NONE})),KU=ua(LU.prototype,"_imageAtlas",[wa],(function(){return null})),qU=ua(LU.prototype,"_handleTouchEvent",[wa],(function(){return!0})),NU=LU))||NU)||NU);t({RichText:aG,RichTextComponent:aG}),m.RichText=aG;var hG,uG=va("cc.UIMeshRenderer")(oG=Ta(110)(oG=function(t){function e(){var e;return(e=t.call(this)||this)._modelComponent=null,e._dirtyVersion=-1,e._internalId=-1,e.stencilStage=VM.DISABLED,e._renderData=null,e._renderEntity=new dN(QM.DYNAMIC),e}s(e,t);var i=e.prototype;return i.__preload=function(){this.node._uiProps.uiComp=this},i.onEnable=function(){vD.addRenderer(this),this.markForUpdateRenderData()},i.onDisable=function(){vD.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):q(16378,this.node?this.node.name:"")},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(km.MAX-11),i.recompileShaders({CC_FORCE_FORWARD_SHADING:!0},s)}},i.markForUpdateRenderData=function(){vD.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}(xp))||oG)||oG;t({UIMeshRenderer:uG,UIModelComponent:uG}),m.UIMeshRenderer=uG;var cG=va("cc.LabelOutline")(hG=Ta(110)(hG=ya(ML)(hG=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.onEnable=function(){this.node.getComponent(ML).enableOutline=!0},i.onDisable=function(){this.node.getComponent(ML).enableOutline=!1},n(e,[{key:"color",get:function(){return this.node.getComponent(ML).outlineColor},set:function(t){this.node.getComponent(ML).outlineColor=t}},{key:"width",get:function(){return this.node.getComponent(ML).outlineWidth},set:function(t){this.node.getComponent(ML).outlineWidth=t}}]),e}(xp))||hG)||hG)||hG;t({LabelOutline:cG,LabelOutlineComponent:cG}),m.LabelOutline=cG;var lG,_G,dG,fG=Rg.Enum.NONE|Rg.Enum.UI_3D,pG=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=fG,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=fG},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 GE(m.director.root));var o=r[s],a=this._passes[s];o.update(),e||(e=o.depthStencilState,i=0),a._initPassFromTarget(o,e,i),this._shaders[s]=a.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}(),gG=va("cc.UIStaticBatch")(lG=Ta(110)((f((_G=function(t){function e(){var e;return(e=t.call(this)||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 pG;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 DD.root&&DD.root.batcher2D?DD.root.batcher2D:(q(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}(WN)).prototype,"color",[hh],Object.getOwnPropertyDescriptor(_G.prototype,"color"),_G.prototype),lG=_G))||lG)||lG;t({UIStaticBatch:gG,UIStaticBatchComponent:gG});var mG,vG,yG,TG=t("LabelShadow",va("cc.LabelShadow")(dG=Ta(110)(dG=ya(ML)(dG=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.onEnable=function(){this.node.getComponent(ML).enableShadow=!0},i.onDisable=function(){this.node.getComponent(ML).enableShadow=!1},n(e,[{key:"color",get:function(){return this.node.getComponent(ML).shadowColor},set:function(t){this.node.getComponent(ML).shadowColor=t}},{key:"offset",get:function(){return this.node.getComponent(ML).shadowOffset},set:function(t){this.node.getComponent(ML).shadowOffset=t}},{key:"blur",get:function(){return this.node.getComponent(ML).shadowBlur},set:function(t){this.node.getComponent(ML).shadowBlur=t}}]),e}(xp))||dG)||dG)||dG),EG=va("cc.UIOpacity")(mG=Ta(110)(mG=Ea((vG=function(t){function e(){var e;return(e=t.call(this)||this)._parentOpacity=1,e._opacity=yG&&yG(),e}s(e,t);var i=e.prototype;return i.setEntityLocalOpacityDirtyRecursively=function(){},e.setEntityLocalOpacityDirtyRecursively=function(t,i,n,r){if(t.isValid){var s=t.getComponent(e);if(s&&r)s._parentOpacity=n;else{var o=t._uiProps.uiComp;if(o||(o=t.getComponent(WN)),o&&o.color)return o.renderEntity.colorDirty=i,s?(s._parentOpacity=n,o.renderEntity.localOpacity=n*s.opacity/255):o.renderEntity.localOpacity=n,void(o.node._uiProps.localOpacity=o.renderEntity.localOpacity);s&&(s._parentOpacity=n,n=n*s.opacity/255);for(var a=t.children,h=0,u=a.length;h<u;++h)e.setEntityLocalOpacityDirtyRecursively(a[h],i||n<1,n,r)}}},i._getParentOpacity=function(t){if(null==t||!t.isValid)return 1;var i=t._uiProps.uiComp,n=t.getComponent(e);return i&&i.color?1:n?n._parentOpacity*(n._opacity/255):this._getParentOpacity(t.getParent())},i._parentChanged=function(){var t=this.node.getParent(),i=1;t&&(this._parentOpacity=this._getParentOpacity(t),i=this._parentOpacity),e.setEntityLocalOpacityDirtyRecursively(this.node,!0,i,!1)},i._setEntityLocalOpacityRecursively=function(){},i.onEnable=function(){this.node.on(Dg.PARENT_CHANGED,this._parentChanged,this),this.node._uiProps.localOpacity=this._parentOpacity*this._opacity/255,this._setEntityLocalOpacityRecursively(this.node._uiProps.localOpacity)},i.onDisable=function(){this.node.off(Dg.PARENT_CHANGED,this._parentChanged,this),this.node._uiProps.localOpacity=1,this._setEntityLocalOpacityRecursively(this.node._uiProps.localOpacity)},n(e,[{key:"opacity",get:function(){return this._opacity},set:function(t){this._opacity!==t&&(t=Pi(t,0,255),this._opacity=t,this.node._uiProps.localOpacity=t/255,this.setEntityLocalOpacityDirtyRecursively(!0))}}]),e}(xp),yG=ua(vG.prototype,"_opacity",[wa],(function(){return 255})),mG=vG))||mG)||mG)||mG;t({UIOpacity:EG,UIOpacityComponent:EG}),m.MaskComponent=WF,Jt(WF,"cc.MaskComponent"),m.LabelComponent=ML,Jt(ML,"cc.LabelComponent"),m.LabelOutlineComponent=cG,Jt(cG,"cc.LabelOutlineComponent"),m.RichTextComponent=aG,Jt(aG,"cc.RichTextComponent"),m.SpriteComponent=PF,Jt(PF,"cc.SpriteComponent"),m.UIModelComponent=uG,Jt(uG,"cc.UIModelComponent"),m.GraphicsComponent=EF,Jt(EF,"cc.GraphicsComponent"),Jt(gG,"cc.UIStaticBatchComponent"),Jt(EG,"cc.UIOpacityComponent"),rt(WF.prototype,"Mask",[{name:"graphics",newName:"subComp",target:WF.prototype,targetName:"Mask"}]),rt(MF,"MaskType",[{name:"RECT",newName:"GRAPHICS_RECT",target:MF,targetName:"MaskType"},{name:"ELLIPSE",newName:"GRAPHICS_ELLIPSE",target:MF,targetName:"MaskType"},{name:"IMAGE_STENCIL",newName:"SPRITE_STENCIL",target:MF,targetName:"MaskType"}]),ot(cG.prototype,"LabelOutline",[{name:"width",suggest:"Please use Label.outlineWidth instead."},{name:"color",suggest:"Please use Label.outlineColor instead."}]),ot(TG.prototype,"LabelShadow",[{name:"color",suggest:"Please use Label.shadowColor instead."},{name:"offset",suggest:"Please use Label.shadowOffset instead."},{name:"blur",suggest:"Please use Label.shadowBlur instead."}]);var SG=function(t,e,i){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 AG(t,e,i,n,r){var s=0,o=null;if(r===function(t,e,i,n){for(var r=0,s=e,o=i-n;s<i;s+=n)r+=(t[o]-t[s])*(t[s+1]+t[o+1]),o=s;return r}(t,e,i,n)>0)for(s=e;s<i;s+=n)o=HG(s,t[s],t[s+1],o);else for(s=i-n;s>=e;s-=n)o=HG(s,t[s],t[s+1],o);return o&&FG(o,o.next)&&(zG(o),o=o.next),o}function bG(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||!FG(i,i.next)&&0!==BG(i.prev,i,i.next))i=i.next;else{if(zG(i),(i=e=i.prev)===i.next)return null;n=!0}}while(n||i!==e);return e}function CG(t,e,i,n,r,s,o){if(void 0===o&&(o=0),t){!o&&s&&function(t,e,i,n){var r=t;do{null===r.z&&(r.z=PG(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,o=0,a=0,h=0,u=1;do{for(i=t,t=null,s=null,o=0;i;){for(o++,n=i,a=0,e=0;e<u&&(a++,n=n.nextZ);e++);for(h=u;a>0||h>0&&n;)0===a?(r=n,n=n.nextZ,h--):0!==h&&n?i.z<=n.z?(r=i,i=i.nextZ,a--):(r=n,n=n.nextZ,h--):(r=i,i=i.nextZ,a--),s?s.nextZ=r:t=r,r.prevZ=s,s=r;i=n}s.nextZ=null,u*=2}while(o>1)}(r)}(t,n,r,s);for(var a=t,h=null,u=null;t.prev!==t.next;)if(h=t.prev,u=t.next,s?wG(t,n,r,s):RG(t))e.push(h.i/i),e.push(t.i/i),e.push(u.i/i),zG(t),t=u.next,a=u.next;else if((t=u)===a){o?1===o?CG(t=IG(t,e,i),e,i,n,r,s,2):2===o&&xG(t,e,i,n,r,s):CG(bG(t),e,i,n,r,s,1);break}}}function RG(t){var e=t.prev,i=t,n=t.next;if(BG(e,i,n)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(NG(e.x,e.y,i.x,i.y,n.x,n.y,r.x,r.y)&&BG(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function wG(t,e,i,n){var r=t.prev,s=t,o=t.next;if(BG(r,s,o)>=0)return!1;for(var a=r.x<s.x?r.x<o.x?r.x:o.x:s.x<o.x?s.x:o.x,h=r.y<s.y?r.y<o.y?r.y:o.y:s.y<o.y?s.y:o.y,u=r.x>s.x?r.x>o.x?r.x:o.x:s.x>o.x?s.x:o.x,c=r.y>s.y?r.y>o.y?r.y:o.y:s.y>o.y?s.y:o.y,l=PG(a,h,e,i,n),_=PG(u,c,e,i,n),d=t.nextZ;d&&d.z<=_;){if(d!==t.prev&&d!==t.next&&NG(r.x,r.y,s.x,s.y,o.x,o.y,d.x,d.y)&&BG(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(d=t.prevZ;d&&d.z>=l;){if(d!==t.prev&&d!==t.next&&NG(r.x,r.y,s.x,s.y,o.x,o.y,d.x,d.y)&&BG(d.prev,d,d.next)>=0)return!1;d=d.prevZ}return!0}function IG(t,e,i){var n=t;do{var r=n.prev,s=n.next.next;!FG(r,s)&&kG(r,n,n.next,s)&&UG(r,s)&&UG(s,r)&&(e.push(r.i/i),e.push(n.i/i),e.push(s.i/i),zG(n),zG(n.next),n=t=s),n=n.next}while(n!==t);return n}function xG(t,e,i,n,r,s){var o=t;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&LG(o,a)){var h=GG(o,a);return o=bG(o,o.next),h=bG(h,h.next),CG(o,e,i,n,r,s),void CG(h,e,i,n,r,s)}a=a.next}o=o.next}while(o!==t)}function DG(t,e){return t.x-e.x}function OG(t,e){if(e=function(t,e){var i=e,n=t.x,r=t.y,s=-1/0,o=null;do{if(r<=i.y&&r>=i.next.y){var a=i.x+(r-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(a<=n&&a>s){if(s=a,a===n){if(r===i.y)return i;if(r===i.next.y)return i.next}o=i.x<i.next.x?i:i.next}}i=i.next}while(i!==e);if(!o)return null;if(n===s)return o.prev;var h,u=o,c=o.x,l=o.y,_=1/0;for(i=o.next;i!==u;)n>=i.x&&i.x>=c&&NG(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>o.x)&&UG(i,t)&&(o=i,_=h),i=i.next;return o}(t,e)){var i=GG(e,t);bG(i,i.next)}}function PG(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 MG(t){var e=t,i=t;do{e.x<i.x&&(i=e),e=e.next}while(e!==t);return i}function NG(t,e,i,n,r,s,o,a){return(r-o)*(e-a)-(t-o)*(s-a)>=0&&(t-o)*(n-a)-(i-o)*(e-a)>=0&&(i-o)*(s-a)-(r-o)*(n-a)>=0}function LG(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&&kG(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&UG(t,e)&&UG(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 BG(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function FG(t,e){return t.x===e.x&&t.y===e.y}function kG(t,e,i,n){return!!(FG(t,e)&&FG(i,n)||FG(t,n)&&FG(i,e))||BG(t,e,i)>0!=BG(t,e,n)>0&&BG(i,n,t)>0!=BG(i,n,e)>0}function UG(t,e){return BG(t.prev,t,t.next)<0?BG(t,e,t.next)>=0&&BG(t,t.prev,e)>=0:BG(t,e,t.prev)<0||BG(t,t.next,e)<0}function GG(t,e){var i=new SG(t.i,t.x,t.y),n=new SG(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 HG(t,e,i,n){var r=new SG(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 zG(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 VG(t,e,i){i=i||3;var n=e?e.length:0,r=n?e[0]*i:t.length,s=AG(t,0,r,i,!0),o=[];if(!s)return o;var a=0,h=0,u=0,c=0,l=0,_=0,d=0;if(n&&(s=function(t,e,i,n){var r,s=[],o=0,a=null;for(o=0,r=e.length;o<r;o++)(a=AG(t,e[o]*n,o<r-1?e[o+1]*n:t.length,n,!1))&&(a===a.next&&(a.steiner=!0),s.push(MG(a)));if(s.sort(DG),!i)return i;for(o=0;o<s.length;o++)OG(s[o],i),i=bG(i,i.next);return i}(t,e,s,i)),t.length>80*i){a=u=t[0],h=c=t[1];for(var f=i;f<r;f+=i)(l=t[f])<a&&(a=l),(_=t[f+1])<h&&(h=_),l>u&&(u=l),_>c&&(c=_);d=Math.max(u-a,c-h)}return CG(s,o,i,a,h,d),o}for(var WG=Math.PI,XG=Math.min,jG=Math.max,YG=Math.ceil,KG=Math.acos,qG=Math.cos,QG=Math.sin,ZG=Math.atan2,JG=null,$G=null,tH=new yn,eH=[],iH=0;iH<4;iH++)eH.push(new _n);function nH(t,e,i){return t<e?e:t>i?i:t}var rH={useModel:!0,updateRenderData:function(){},fillBuffers:function(){},renderIA:function(){},getRenderData:function(t,e){if(!$G)return null;var i=$G.getRenderDataList(),n=i[$G.dataOffset];if(!n)return null;var r=n,s=r?r.vertexStart+e:0;return(s>65535||3*s>131070)&&(++$G.dataOffset,$G.dataOffset<i.length?n=i[$G.dataOffset]:(n=$G.requestRenderData(),i[$G.dataOffset]=n),r=n),r&&r.vertexCount<s&&r.request(e,3*e),n},stroke:function(t){yn.copy(tH,t.strokeColor),t.impl&&(this._flattenPaths(t.impl),this._expandStroke(t),t.impl.updatePathOffset=!0,this.end(t))},fill:function(t){yn.copy(tH,t.fillColor),this._expandFill(t),t.impl&&(t.impl.updatePathOffset=!0),this.end(t)},end:function(t){t.markForUpdateRenderData()},_expandStroke:function(t){var e=.5*t.lineWidth,i=t.lineCap,n=t.lineJoin,r=t.miterLimit;if($G=t.impl){var s=function(t,e,i){var n=2*KG(t/(t+i));return jG(2,YG(e/n))}(e,WG,$G.tessTol);this._calculateJoins($G,e,n,r);for(var o=$G.paths,a=0,h=$G.pathOffset,u=$G.pathLength;h<u;h++){var c=o[h],l=c.points.length;n===vB.ROUND?a+=2*(l+c.bevel*(s+2)+1):a+=2*(l+5*c.bevel+1),c.closed||(i===mB.ROUND?a+=2*(2*s+2):a+=12)}var _=JG=this.getRenderData(t,a);if(_){for(var d=_.vData,f=_.iData,p=$G.pathOffset,g=$G.pathLength;p<g;p++){var m=o[p],v=m.points,y=v.length,T=_.vertexStart,E=void 0,S=void 0,A=0,b=0,C=m.closed;if(C?(E=v[y-1],S=v[0],A=0,b=y):(E=v[0],S=v[1],A=1,b=y-1),S=S||E,!C){var R=new pF(S.x,S.y);R.subtract(E),R.normalize();var w=R.x,I=R.y;i===mB.BUTT?this._buttCapStart(E,w,I,e,0):i===mB.SQUARE?this._buttCapStart(E,w,I,e,e):i===mB.ROUND&&this._roundCapStart(E,w,I,e,s)}for(var x=A;x<b;++x)n===vB.ROUND?this._roundJoin(E,S,e,e,s):0!=(S.flags&(yB.PT_BEVEL|yB.PT_INNERBEVEL))?this._bevelJoin(E,S,e,e):(this._vSet(S.x+S.dmx*e,S.y+S.dmy*e,1),this._vSet(S.x-S.dmx*e,S.y-S.dmy*e,-1)),E=S,S=v[x+1];if(C){var D=8*T;this._vSet(d[D],d[D+1],1),this._vSet(d[D+8],d[D+8+1],-1)}else{var O=new pF(S.x,S.y);O.subtract(E),O.normalize();var P=O.x,M=O.y;i===mB.BUTT?this._buttCapEnd(S,P,M,e,0):i===mB.SQUARE?this._buttCapEnd(S,P,M,e,e):i===mB.ROUND&&this._roundCapEnd(S,P,M,e,s)}for(var N=_.indexStart,L=T+2,B=_.vertexStart;L<B;L++)f[N++]=L-2,f[N++]=L-1,f[N++]=L;_.indexStart=N}JG=null,$G=null}}},_expandFill:function(t){if($G=t.impl){for(var e=$G.paths,i=0,n=$G.pathOffset,r=$G.pathLength;n<r;n++)i+=e[n].points.length;var s=JG=this.getRenderData(t,i);if(s){for(var o=s,a=o.vData,h=o.iData,u=$G.pathOffset,c=$G.pathLength;u<c;u++){var l=e[u],_=l.points,d=_.length;if(0!==d){for(var f=s.vertexStart,p=0;p<d;++p)this._vSet(_[p].x,_[p].y);var g=s.indexStart;if(l.complex){for(var m=[],v=f,y=s.vertexStart;v<y;v++){var T=8*v;m.push(a[T++]),m.push(a[T++]),m.push(a[T++])}var E=VG(m,null,3);if(!E||0===E.length)continue;for(var S=0,A=E.length;S<A;S++)h[g++]=E[S]+f}else for(var b=f,C=f+2,R=o.vertexStart;C<R;C++)h[g++]=b,h[g++]=C-1,h[g++]=C;o.indexStart=g}}JG=null,$G=null}}},_calculateJoins:function(t,e,i,n){var r=0;e>0&&(r=1/e);for(var s=t.paths,o=t.pathOffset,a=t.pathLength;o<a;o++){var h=s[o],u=h.points,c=u.length,l=u[c-1],_=u[0];h.bevel=0;for(var d=0;d<c;d++){var f,p,g=l.dy,m=-l.dx,v=_.dy,y=-_.dx;if(_.dmx=.5*(g+v),_.dmy=.5*(m+y),(f=_.dmx*_.dmx+_.dmy*_.dmy)>1e-6){var T=1/f;T>600&&(T=600),_.dmx*=T,_.dmy*=T}_.dx*l.dy-l.dx*_.dy>0&&(_.flags|=yB.PT_LEFT),f*(p=jG(11,XG(l.len,_.len)*r))*p<1&&(_.flags|=yB.PT_INNERBEVEL),_.flags&yB.PT_CORNER&&(f*n*n<1||i===vB.BEVEL||i===vB.ROUND)&&(_.flags|=yB.PT_BEVEL),0!=(_.flags&(yB.PT_BEVEL|yB.PT_INNERBEVEL))&&h.bevel++,l=_,_=u[d+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,o=s[s.length-1],a=s[0];s.length>2&&o.equals(a)&&(r.closed=!0,s.pop(),o=s[s.length-1]);for(var h=0,u=s.length;h<u;h++){var c=new pF(a.x,a.y);c.subtract(o),o.len=c.length(),(c.x||c.y)&&c.normalize(),o.dx=c.x,o.dy=c.y,o=a,a=s[h+1]}}},_chooseBevel:function(t,e,i,n){var r=i.x,s=i.y,o=0,a=0,h=0,u=0;return 0!==t?(o=r+e.dy*n,a=s-e.dx*n,h=r+i.dy*n,u=s-i.dx*n):(o=h=r+i.dmx*n,a=u=s+i.dmy*n),[o,a,h,u]},_buttCapStart:function(t,e,i,n,r){var s=t.x-e*r,o=t.y-i*r,a=i,h=-e;this._vSet(s+a*n,o+h*n,1),this._vSet(s-a*n,o-h*n,-1)},_buttCapEnd:function(t,e,i,n,r){var s=t.x+e*r,o=t.y+i*r,a=i,h=-e;this._vSet(s+a*n,o+h*n,1),this._vSet(s-a*n,o-h*n,-1)},_roundCapStart:function(t,e,i,n,r){for(var s=t.x,o=t.y,a=i,h=-e,u=0;u<r;u++){var c=u/(r-1)*WG,l=qG(c)*n,_=QG(c)*n;this._vSet(s-a*l-e*_,o-h*l-i*_,1),this._vSet(s,o,0)}this._vSet(s+a*n,o+h*n,1),this._vSet(s-a*n,o-h*n,-1)},_roundCapEnd:function(t,e,i,n,r){var s=t.x,o=t.y,a=i,h=-e;this._vSet(s+a*n,o+h*n,1),this._vSet(s-a*n,o-h*n,-1);for(var u=0;u<r;u++){var c=u/(r-1)*WG,l=qG(c)*n,_=QG(c)*n;this._vSet(s,o,0),this._vSet(s-a*l+e*_,o-h*l+i*_,1)}},_roundJoin:function(t,e,i,n,r){var s=t.dy,o=-t.dx,a=e.dy,h=-e.dx,u=e.x,c=e.y;if(0!=(e.flags&yB.PT_LEFT)){var l=this._chooseBevel(e.flags&yB.PT_INNERBEVEL,t,e,i),_=l[0],d=l[1],f=l[2],p=l[3],g=ZG(-o,-s),m=ZG(-h,-a);m>g&&(m-=2*WG),this._vSet(_,d,1),this._vSet(u-s*n,e.y-o*n,-1);for(var v=nH(YG((g-m)/WG)*r,2,r),y=0;y<v;y++){var T=g+y/(v-1)*(m-g),E=u+qG(T)*n,S=c+QG(T)*n;this._vSet(u,c,0),this._vSet(E,S,-1)}this._vSet(f,p,1),this._vSet(u-a*n,c-h*n,-1)}else{var A=this._chooseBevel(e.flags&yB.PT_INNERBEVEL,t,e,-n),b=A[0],C=A[1],R=A[2],w=A[3],I=ZG(o,s),x=ZG(h,a);x<I&&(x+=2*WG),this._vSet(u+s*n,c+o*n,1),this._vSet(b,C,-1);for(var D=nH(YG((x-I)/WG)*r,2,r),O=0;O<D;O++){var P=I+O/(D-1)*(x-I),M=u+qG(P)*i,N=c+QG(P)*i;this._vSet(M,N,1),this._vSet(u,c,0)}this._vSet(u+a*n,c+h*n,1),this._vSet(R,w,-1)}},_bevelJoin:function(t,e,i,n){var r=0,s=0,o=0,a=0,h=0,u=0,c=0,l=0,_=t.dy,d=-t.dx,f=e.dy,p=-e.dx;if(e.flags&yB.PT_LEFT){var g=this._chooseBevel(e.flags&yB.PT_INNERBEVEL,t,e,i);h=g[0],u=g[1],c=g[2],l=g[3],this._vSet(h,u,1),this._vSet(e.x-_*n,e.y-d*n,-1),this._vSet(c,l,1),this._vSet(e.x-f*n,e.y-p*n,-1)}else{var m=this._chooseBevel(e.flags&yB.PT_INNERBEVEL,t,e,-n);r=m[0],s=m[1],o=m[2],a=m[3],this._vSet(e.x+_*i,e.y+d*i,1),this._vSet(r,s,-1),this._vSet(e.x+f*i,e.y+p*i,1),this._vSet(o,a,-1)}},_vSet:function(t,e,i){if(void 0===i&&(i=0),JG){var n=JG,r=8*n.vertexStart,s=n.vData;s[r++]=t,s[r++]=e,s[r++]=0,yn.toArray(s,tH,r),r+=4,s[r++]=i,n.vertexStart++}}},sH=t("graphicsAssembler",{getAssembler:function(){return rH}});EF.Assembler=sH;var oH=["left","center","right"],aH=2048,hH=(1/255).toFixed(3),uH=function(){this.char="",this.valid=!0,this.x=0,this.y=0,this.line=0,this.hash=""},cH=function(){function t(){this._context=null,this._canvas=null,this._canvasData=null,this._lettersInfo=[],this._tmpRect=new Yn,this._maxFontSize=100,this._fontScale=1,this._canvasData=bM.getInstance().get(),this._canvas=this._canvasData.canvas,this._context=this._canvasData.context}var e=t.prototype;return e.destroy=function(){bM.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),DM.fontScale=this._fontScale,this._setupBMFontOverflowMetrics(i,n),this._updateFontScale(e),this._computeHorizontalKerningForText(e,i,r),this._alignText(e,i,n,r);else{var o=0;for(this._fontScale=this._getStyleFontScale(e.fontSize,e.fontScale),this._updatePaddingRect(e,n),this._calculateLabelFont(e,i,n,r);(n.canvasSize.width>aH||n.canvasSize.height>aH)&&o<=3;){if(++o>3)this._fontScale=1;else{var a=Math.max(n.canvasSize.width,n.canvasSize.height),h=aH/a;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,o){t?(this._computeAlignmentOffset(e,i,n),this.generateVertexData(t,e,i,n,r,s,o)):(this._updateLabelDimensions(e,i,n),this._updateTexture(e,i,n,r),this.generateVertexData(t,e,i,n,r,s,o))},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,o=this._getFontDesc(t.actualFontSize,t.fontFamily,t.isBold,t.isItalic);switch(this._context.font=t.fontDesc=o,e.overFlow){case wL.NONE:for(var a=0,h=0;h<r.length;++h){var u=UP(this._context,r[h],o);a=a>u?a:u}var c=a,l=(s.length+IP)*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 wL.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 wL.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 wL.RESIZE_HEIGHT:this._calculateWrapText(r,t,e,i);var _=(i.parsedString.length+IP)*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),o=0,a=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;a=l+1;for(var _=0,d=0|e.actualFontSize+1,f=0;_<d;){if((f=_+d+1>>1)<=0){X(4003);break}u=f,r=this._getFontDesc(u,e.fontFamily,e.isBold,e.isItalic),this._context.font=r;var p=this._getLineHeight(i.lineHeight,u,e.fontSize);for(a=0,o=0;o<t.length;++o){var g=UP(this._context,t[o],r);a+=KP(t[o],g,c,this._measureText(this._context,r)).length*p}a>l?d=f-1:_=f}0===_?X(4003):(u=_,r=this._getFontDesc(u,e.fontFamily,e.isBold,e.isItalic),this._context.font=r)}else{for(a=t.length*this._getLineHeight(i.lineHeight,u,e.fontSize),o=0;o<t.length;++o)h<s[o]&&(h=s[o]);var m=(n.canvasSize.width-n.canvasPadding.width)*this._fontScale/h,v=n.canvasSize.height*this._fontScale/a;u=e.actualFontSize*Math.min(1,m,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,o=this._getFontDesc(e.actualFontSize,e.fontFamily,e.isBold,e.isItalic);this._context.font=o;for(var a=0;a<t.length;++a){var h=UP(this._context,t[a],o),u=KP(t[a],h,s,this._measureText(this._context,o));r=r.concat(u)}n.parsedString=r,e.fontDesc=o}},e._measureText=function(t,e){return function(i){return UP(t,i,e)}},e._calculateParagraphLength=function(t,e,i){for(var n,r=[],s=d(t);!(n=s()).done;){var o=UP(e,n.value,i);r.push(o)}return r},e._updatePaddingRect=function(t,e){var i=0,n=0,r=0,s=0,o=0;if(e.contentSizeExtend.width=e.contentSizeExtend.height=0,t.isOutlined&&(i=n=r=s=o=t.outlineWidth,e.contentSizeExtend.width=e.contentSizeExtend.height=2*o),t.hasShadow){var a=t.shadowBlur+o,h=t.shadowOffsetX,u=t.shadowOffsetY;r=Math.max(r,-h+a),s=Math.max(s,h+a),i=Math.max(i,u+a),n=Math.max(n,-u+a)}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,aH),i.canvasSize.height=Math.min(i.canvasSize.height,aH),this._canvas.width=i.canvasSize.width,this._canvas.height=i.canvasSize.height,this._context.font=t.fontDesc,this._context.textAlign=oH[e.horizontalAlign],this._context.textBaseline="alphabetic"},e._calculateFillTextStartPosition=function(t,e,i){var n=0;e.horizontalAlign===CL.RIGHT?n=i.canvasSize.width-i.canvasPadding.width:e.horizontalAlign===CL.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-IP/2);if(e.verticalAlign!==RL.TOP){var o=r+i.canvasPadding.height+t.actualFontSize-i.canvasSize.height;e.verticalAlign===RL.BOTTOM?s-=o+=IP/2*t.actualFontSize:s-=o/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+", "+hH+")",this._context.fillRect(0,0,this._canvas.width,this._canvas.height)):(this._context.fillStyle="rgba("+t.color.r+", "+t.color.g+", "+t.color.b+", "+hH+")",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 Hn(i.startPosition.x,i.startPosition.y),o=s.x,a=0;this._drawTextEffect(s,r,t,e,i);for(var h=0;h<i.parsedString.length;++h)a=s.y+h*r,t.hasShadow&&(this._setupShadow(t),this._context.fillText(i.parsedString[h],o,a)),t.isOutlined&&(this._setupOutline(t),this._context.strokeText(i.parsedString[h],o,a)),t.hasShadow&&!t.isOutlined||this._context.fillText(i.parsedString[h],o,a);t.hasShadow&&(this._context.shadowColor="transparent"),this._uploadTexture(n)}},e._uploadTexture=function(t){var e;t.texture&&this._canvas&&(e=t.texture instanceof TP?t.texture.texture:t.texture,0!==this._canvas.width&&0!==this._canvas.height&&(e.getGFXTexture(),e.getGFXSampler(),e.reset({width:this._canvas.width,height:this._canvas.height,mipmapLevel:1}),e.uploadData(this._canvas),e.setWrapMode(Mf.CLAMP_TO_EDGE,Mf.CLAMP_TO_EDGE),t.texture instanceof TP&&(t.texture.rect=new Yn(0,0,this._canvas.width,this._canvas.height),t.texture._calculateUV()),m.director.root&&m.director.root.batcher2D&&m.director.root.batcher2D._releaseDescriptorSetCache(e.getHash())))},e._drawTextEffect=function(t,e,i,n,r){if(i.hasShadow||i.isOutlined||i.isUnderline){for(var s=r.parsedString.length>1&&i.hasShadow,o=this._measureText(this._context,i.fontDesc),a=0,h=0,u=0;u<r.parsedString.length;++u)if(a=t.x,h=t.y+u*e,s&&(i.hasShadow&&(this._setupShadow(i),this._context.fillText(r.parsedString[u],a,h)),i.isOutlined&&(this._setupOutline(i),this._context.strokeText(r.parsedString[u],a,h)),i.hasShadow&&!i.isOutlined||this._context.fillText(r.parsedString[u],a,h)),i.isUnderline){var c=o(r.parsedString[u]),l=new Hn;n.horizontalAlign===CL.RIGHT?l.x=t.x-c:n.horizontalAlign===CL.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.shadowBlur=0,this._context.shadowOffsetX=0,this._context.shadowOffsetY=0,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,o){t?this._updateQuads(e,i,n,r,s,o):(this.updateQuatCount(r),o(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:yn.WHITE.clone()});e.length=i}},e._setupBMFontOverflowMetrics=function(t,e){var i=e.nodeContentSize.width,n=e.nodeContentSize.height;t.overFlow===wL.RESIZE_HEIGHT&&(n=0),t.overFlow===wL.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,o=e.horizontalKerning;if(s&&0!==s.length)for(var a=-1,h=0;h<r;++h){var u=n.charCodeAt(h),c=s[a<<16|65535&u]||0;o[h]=h<r-1?c:0,a=u}}},e._alignText=function(t,e,i,n){this._multilineTextWrap(t,e,i,n,this._getFirstWordLen),e.overFlow===wL.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,o=GP(e);r<o;++r){var a=this._lettersInfo[r];a.valid&&(s===a.line?n+=a.char:(i=i.concat(n),s=a.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,o=s.length,a=0,h=0,u=0,c=0,l=0,_=0,d=0,f=null,p=0;p<o;){var g=HP(s,p);if("\n"!==g){for(var m=r(t,e,s,p,o),v=_,y=d,T=l,E=h,S=!1,A=new Hn,b=0;b<m;++b){var C=p+b;if("\r"!==(g=HP(s,C)))if(f=DM.fontAtlas.getLetterDefinitionForChar(g,DM)){var R=E+f.offsetX*t.bmfontScale-DM.margin;if(e.wrapping&&e.maxLineWidth>0&&h>0&&R+f.w*t.bmfontScale>e.maxLineWidth&&!kP(g)){e.linesWidth.push(l),l=0,a++,h=0,u-=e.lineHeight*this._getFontScale(t,e)+0,S=!0;break}A.x=R,A.y=u-f.offsetY*t.bmfontScale,this._recordLetterInfo(A,g,C,a),C+1<e.horizontalKerning.length&&C<o-1&&(E+=e.horizontalKerning[C+1]*t.bmfontScale),E+=f.xAdvance*t.bmfontScale+e.spacingX,T=A.x+f.w*t.bmfontScale,v<A.y&&(v=A.y),y>A.y-f.h*t.bmfontScale&&(y=A.y-f.h*t.bmfontScale)}else this._recordPlaceholderInfo(C,g),null!=t.fntConfig?X(16354,t.fntConfig.atlasName,g):X(16355,t.fontFamily,g);else this._recordPlaceholderInfo(C,g)}S||(h=E,_<v&&(_=v),d>y&&(d=y),c<(l=T)&&(c=l),p+=m)}else e.linesWidth.push(l),l=0,a++,h=0,u-=e.lineHeight*this._getFontScale(t,e)+0,this._recordPlaceholderInfo(p,g),p++}return e.linesWidth.push(l),e.numberOfLines=a+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*DM.margin),e.textHeightTemp<=0&&(i.nodeContentSize.height=parseFloat(e.textDesiredHeight.toFixed(2))+2*DM.margin),e.tailoredTopY=i.nodeContentSize.height,e.tailoredBottomY=0,_>0&&(e.tailoredTopY=i.nodeContentSize.height+_),d<-e.textDesiredHeight&&(e.tailoredBottomY=e.textDesiredHeight+d),!0},e._recordPlaceholderInfo=function(t,e){if(t>=this._lettersInfo.length){var i=new uH;this._lettersInfo.push(i)}this._lettersInfo[t].char=e,this._lettersInfo[t].hash=""+zP(e,0)+DM.hash,this._lettersInfo[t].valid=!1},e._recordLetterInfo=function(t,e,i,n){if(i>=this._lettersInfo.length){var r=new uH;this._lettersInfo.push(r)}var s=""+zP(e,0)+DM.hash;this._lettersInfo[i].line=n,this._lettersInfo[i].char=e,this._lettersInfo[i].hash=s,this._lettersInfo[i].valid=DM.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=HP(i,n);if(FP(s)||"\n"===s||kP(s))return 1;var o=1,a=DM.fontAtlas.getLetterDefinitionForChar(s,DM);if(!a)return o;for(var h=a.xAdvance*t.bmfontScale+e.spacingX,u=n+1;u<r&&(s=HP(i,u),a=DM.fontAtlas.getLetterDefinitionForChar(s,DM));++u){if(h+a.offsetX*t.bmfontScale+a.w*t.bmfontScale>e.maxLineWidth&&!kP(s)&&e.maxLineWidth>0)return o;if(h+=a.xAdvance*t.bmfontScale+e.spacingX,"\n"===s||kP(s)||FP(s))break;o++}return o},e._computeAlignmentOffset=function(t,e,i){switch(e.linesOffsetX.length=0,e.letterOffsetY=0,e.horizontalAlign){case CL.LEFT:for(var n=0;n<e.numberOfLines;++n)e.linesOffsetX.push(0);break;case CL.CENTER:for(var r=0,s=e.linesWidth.length;r<s;r++)e.linesOffsetX.push((i.nodeContentSize.width-e.linesWidth[r])/2);break;case CL.RIGHT:for(var o=0,a=e.linesWidth.length;o<a;o++)e.linesOffsetX.push(i.nodeContentSize.width-e.linesWidth[o])}if(e.letterOffsetY=i.nodeContentSize.height,e.verticalAlign!==RL.TOP){var h=i.nodeContentSize.height-e.textDesiredHeight+e.lineHeight*this._getFontScale(t,e)-t.originFontSize*this._fontScale*t.bmfontScale;e.verticalAlign===RL.BOTTOM?e.letterOffsetY-=h:e.letterOffsetY-=h/2}},e._getFontScale=function(t,e){return e.overFlow===wL.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,o=0,a=GP(n);o<a;++o){var h=r._lettersInfo[o];if(h.valid){var u=DM.fontAtlas.getLetterDefinitionForChar(h.char,DM);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,o=0|t.actualFontSize,a=0;s<o;){var h=a=s+o+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)?o=a-1:s=a}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 o=t.spriteFrame?t.spriteFrame.texture:DM.fontAtlas.getTexture(),a=n.uiTransAnchorX*i.nodeContentSize.width,h=n.uiTransAnchorY*i.nodeContentSize.height,u=0,c=GP(r);u<c;++u){var l=this._lettersInfo[u];if(l.valid){var _=DM.fontAtlas.getLetter(l.hash);if(_){this._tmpRect.height=_.h,this._tmpRect.width=_.w,this._tmpRect.x=_.u,this._tmpRect.y=_.v;var d=l.y+e.letterOffsetY;if(e.textHeightTemp>0){if(d>e.tailoredTopY){var f=d-e.tailoredTopY;this._tmpRect.y+=f,this._tmpRect.height-=f,d-=f}d-this._tmpRect.height*t.bmfontScale<e.tailoredBottomY&&e.overFlow===wL.CLAMP&&(this._tmpRect.height=d<e.tailoredBottomY?0:(d-e.tailoredBottomY)/t.bmfontScale)}var p=l.line,g=l.x+_.w/2*t.bmfontScale+e.linesOffsetX[p];if(e.textWidthTemp>0&&this._isHorizontalClamped(e,i,g,p)&&e.overFlow===wL.CLAMP&&(this._tmpRect.width=0),this._tmpRect.height>0&&this._tmpRect.width>0){var m=this._determineRect(t),v=l.x+e.linesOffsetX[l.line],y=n.quadCount;n.quadCount+=4,this.updateQuatCount(n),s(t,i,n,y,o,this._tmpRect,m,v-a,d-h)}}else q(16353)}}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(),o=s.x+(n.width-r.width)/2,a=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-a,this._tmpRect.y=h+r.y-o,this._tmpRect.y<0&&(this._tmpRect.height+=a)}else this._tmpRect.x+=r.x-o,this._tmpRect.y+=r.y+a;return i},t}();cH.instance=void 0,cH.instance=new cH;var lH=new xM(64,64),_H=new yM(null),dH=null,fH=null,pH=null,gH=null,mH=null,vH={updateProcessingData:function(t,e,i,n,r,s){t.fontSize=r.fontSize,t.actualFontSize=r.fontSize,t.originFontSize=pH?pH.fontSize:r.fontSize,e.horizontalAlign=r.horizontalAlign,e.verticalAlign=r.verticalAlign,e.spacingX=r.spacingX;var o=r.overflow;e.overFlow=o,e.lineHeight=r.lineHeight,i.nodeContentSize.width=s.width,i.nodeContentSize.height=s.height,o===wL.NONE?(e.wrapping=!1,i.nodeContentSize.width+=2*DM.margin,i.nodeContentSize.height+=2*DM.margin):o===wL.RESIZE_HEIGHT?(e.wrapping=!0,i.nodeContentSize.height+=2*DM.margin):e.wrapping=r.enableWrapText,n.uiTransAnchorX=s.anchorX,n.uiTransAnchorY=s.anchorY,DM.lineHeight=r.lineHeight,DM.fontSize=r.fontSize,t.spriteFrame=gH,t.fntConfig=pH,t.fontFamily=DM.fontFamily,t.color.set(r.color)},updateRenderData:function(t){if(t.renderData&&dH!==t){if(t.renderData.vertDirty){fH=(dH=t).node._uiProps.uiTransformComp;var e=t.renderData,i=cH.instance,n=t.textStyle,r=t.textLayout,s=t.textLayoutData,o=t.textRenderData;n.fontScale=TO.getScaleX(),this._updateFontFamily(t),this.updateProcessingData(n,r,s,o,t,fH),this._updateLabelInfo(t),n.fontDesc=DM.fontDesc,i.processingString(!0,n,r,s,t.string),o.quadCount=0,i.generateRenderInfo(!0,n,r,s,o,t.string,this.generateVertexData),e.dataLength!==o.quadCount&&(this.resetRenderData(t),e.dataLength=o.quadCount,e.resize(e.dataLength,e.dataLength/2*3));for(var a=e.data,h=0,u=o.quadCount;h<u;h++)a[h]=o.vertexBuffer[h];var c=e.indexCount;this.createQuadIndices(c),e.chunk.setIndexBuffer(mH),dH.actualFontSize=n.actualFontSize,fH.setContentSize(s.nodeContentSize),this.updateUVs(t),e.vertDirty=!1,dH=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,o=0;o<n;o++){var a=r[o];i[s]=a.u,i[s+1]=a.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,o,a,h){var u=n,c=t.bmfontScale,l=i.vertexBuffer,_=r.width,d=r.height,f=s.width,p=s.height,g=0,m=0,v=0,y=0;o?(g=s.x/_,y=(s.x+p)/_,m=(s.y+f)/d,v=s.y/d,l[u].u=g,l[u].v=v,l[u+1].u=g,l[u+1].v=m,l[u+2].u=y,l[u+2].v=v,l[u+3].u=y,l[u+3].v=m):(g=s.x/_,y=(s.x+f)/_,m=(s.y+p)/d,v=s.y/d,l[u].u=g,l[u].v=m,l[u+1].u=y,l[u+1].v=m,l[u+2].u=g,l[u+2].v=v,l[u+3].u=y,l[u+3].v=v),l[u].x=a,l[u].y=h-p*c,l[u+1].x=a+f*c,l[u+1].y=h-p*c,l[u+2].x=a,l[u+2].y=h,l[u+3].x=a+f*c,l[u+3].y=h},_updateFontFamily:function(t){var e=t.font;gH=e.spriteFrame,pH=e.fntConfig,DM.fontAtlas=e.fontDefDictionary,DM.fontAtlas||(t.cacheMode===IL.CHAR?DM.fontAtlas=lH:DM.fontAtlas=_H),wO.packToDynamicAtlas(t,gH)},_updateLabelInfo:function(){DM.hash="",DM.margin=0},_resetProperties:function(){pH=null,gH=null,DM.hash="",DM.margin=0},createQuadIndices:function(t){if(t%6==0){var e=t/6;mH=new Uint16Array(t);for(var i=0,n=0;n<e;n++)mH[i++]=0+4*n,mH[i++]=1+4*n,mH[i++]=2+4*n,mH[i++]=1+4*n,mH[i++]=3+4*n,mH[i++]=2+4*n}else Z(16308)}},yH=new yn(255,255,255,255),TH={createData:function(t){var e=t.requestRenderData();return e.resize(0,0),e},fillBuffers:function(t){var e=t.node;yH.set(t.color),yH.a=255*e._uiProps.opacity,Jd(e,0,t.renderData,yH)},appendQuad:function(t,e,i,n,r,s,o){var a=t.renderData;if(a){var h=a.dataLength;a.dataLength+=4,a.resize(a.dataLength,a.dataLength/2*3);var u=a.data,c=e.width,l=e.height,_=i.width,d=i.height,f=0,p=0,g=0,m=0;n?(f=i.x/c,m=(i.x+d)/c,p=(i.y+_)/l,g=i.y/l,u[h].u=f,u[h].v=g,u[h+1].u=f,u[h+1].v=p,u[h+2].u=m,u[h+2].v=g,u[h+3].u=m,u[h+3].v=p):(f=i.x/c,m=(i.x+_)/c,p=(i.y+d)/l,g=i.y/l,u[h].u=f,u[h].v=p,u[h+1].u=m,u[h+1].v=p,u[h+2].u=f,u[h+2].v=g,u[h+3].u=m,u[h+3].v=g),u[h].x=r,u[h].y=s-d*o,u[h+1].x=r+_*o,u[h+1].y=s-d*o,u[h+2].x=r,u[h+2].y=s,u[h+3].x=r+_*o,u[h+3].y=s}}};Gt(TH,vH);var EH=null,SH=Ht(vH,{getAssemblerData:function(){return EH||(EH=new xM(1024,1024)),EH.getTexture()},_updateFontFamily:function(t){DM.fontAtlas=EH,DM.fontFamily=this._getFontFamily(t),t.enableOutline&&t.outlineWidth>0?(DM.isOutlined=!0,DM.margin=t.outlineWidth,DM.out=t.outlineColor.clone(),DM.out.a=t.outlineColor.a*t.color.a/255):(DM.isOutlined=!1,DM.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){DM.fontDesc=this._getFontDesc(),DM.color=t.color,DM.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}(DM)},_getFontDesc:function(){return DM.fontSize.toString()+"px "+DM.fontFamily}}),AH=new yn(255,255,255,255),bH={createData:function(t){var e=t.requestRenderData();return e.resize(0,0),e},fillBuffers:function(t){if(t.renderData){var e=t.node;AH.a=255*e._uiProps.opacity,Jd(e,0,t.renderData,AH)}},updateColor:function(){}};Gt(bH,SH);var CH=ML.Overflow,RH={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===CH.NONE?e.wrapping=!1:r.overflow===CH.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,r.enableOutline&&r.outlineWidth>0?(t.isOutlined=!0,t.outlineColor.set(r.outlineColor),t.outlineWidth=r.outlineWidth):t.isOutlined=!1,r.enableShadow&&(r.shadowBlur>0||!Oi(r.shadowOffset.x,0)||!Oi(r.shadowOffset.y,0))?(t.hasShadow=!0,t.shadowColor.set(r.shadowColor),t.shadowBlur=r.shadowBlur,t.shadowOffsetX=r.shadowOffset.x,t.shadowOffsetY=r.shadowOffset.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=ML._canvasPool.get();return t.canvas.width=t.canvas.height=1,t},resetAssemblerData:function(t){t&&ML._canvasPool.put(t)},updateRenderData:function(t){if(t.renderData){if(t.renderData.vertDirty){var e=t.node._uiProps.uiTransformComp,i=cH.instance,n=t.textStyle,r=t.textLayout,s=t.textLayoutData,o=t.textRenderData;n.fontScale=TO.getScaleX(),this.updateProcessingData(n,r,s,o,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,o,t.string,this.generateVertexData);var a=t.renderData;a.textureDirty=!0,this._calDynamicAtlas(t,s),t.actualFontSize=n.actualFontSize,e.setContentSize(s.nodeContentSize);var h=a.data;h[0]=o.vertexBuffer[0],h[1]=o.vertexBuffer[1],h[2]=o.vertexBuffer[2],h[3]=o.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,o=i.uiTransAnchorX*r,a=i.uiTransAnchorY*s;n[0].x=-o,n[0].y=-a,n[1].x=r-o,n[1].y=-a,n[2].x=-o,n[2].y=s-a,n[3].x=r-o,n[3].y=s-a},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!==ML.CacheMode.BITMAP||e.canvasSize.width<=0||e.canvasSize.height<=0)){var i=t.ttfSpriteFrame;wO.packToDynamicAtlas(t,i)}},_resetDynamicAtlas:function(t){if(t.cacheMode===ML.CacheMode.BITMAP){var e=t.ttfSpriteFrame;wO.deleteAtlasSpriteFrame(e),e._resetDynamicAtlasFrame()}}},wH=yn.WHITE.clone(),IH=Uint16Array.from([0,1,2,1,3,2]),xH={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++)yn.toArray(i,wH,n),n+=9;return e.chunk.setIndexBuffer(IH),e},fillBuffers:function(t){for(var e=t.renderData,i=e.chunk,n=e.data,r=t.node,s=i.vb,o=r.worldMatrix,a=e.floatStride,h=0,u=n.length,c=0;c<u;c++){var l=n[c],_=l.x,d=l.y,f=o.m03*_+o.m07*d+o.m15;f=f?1/f:1,s[0+(h=c*a)]=(o.m00*_+o.m04*d+o.m12)*f,s[h+1]=(o.m01*_+o.m05*d+o.m13)*f,s[h+2]=(o.m02*_+o.m06*d+o.m14)*f}var p=i.vertexOffset,g=i.meshBuffer,m=i.meshBuffer.iData,v=g.indexOffset;m[v++]=p,m[v++]=p+1,m[v++]=p+2,m[v++]=p+2,m[v++]=p+1,m[v++]=p+3,g.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,o=i.anchorY*r,a=e.data;a[0].x=-s,a[0].y=-o,a[1].x=n-s,a[1].y=-o,a[2].x=-s,a[2].y=r-o,a[3].x=n-s,a[3].y=r-o}},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(){}};Gt(xH,RH);var DH=t("labelAssembler",{getAssembler:function(t){var e=xH;return t.font instanceof TM?e=TH:t.cacheMode===ML.CacheMode.CHAR&&(e=bH),e}});ML.Assembler=DH;var OH=PF.FillType,PH=new Ln,MH=Uint16Array.from([0,1,2,1,3,2]),NH={updateRenderData:function(t){var e=t.spriteFrame;wO.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,o=n.height,a=n.rect,h=0,u=0,c=0,l=0,_=0,d=0,f=0,p=0,g=0,m=0;switch(n.isRotated()?(h=a.x/s,u=(a.y+a.width)/o,c=_=h,f=g=(a.x+a.height)/s,d=m=u,l=p=a.y/o):(h=a.x/s,u=(a.y+a.height)/o,c=f=h,_=g=(a.x+a.width)/s,l=d=u,p=m=a.y/o),t.fillType){case OH.HORIZONTAL:r[3]=c+(_-c)*e,r[4]=l+(d-l)*e,r[12]=c+(_-c)*i,r[13]=l+(d-l)*i,r[21]=f+(g-f)*e,r[22]=p+(m-p)*e,r[30]=f+(g-f)*i,r[31]=p+(m-p)*i;break;case OH.VERTICAL:r[3]=c+(f-c)*e,r[4]=l+(p-l)*e,r[12]=_+(g-_)*e,r[13]=d+(m-d)*e,r[21]=c+(f-c)*i,r[22]=l+(p-l)*i,r[30]=_+(g-_)*i,r[31]=d+(m-d)*i;break;default:Z(2626)}},updateVertexData:function(t,e,i){var n=t.renderData.data,r=t.node._uiProps.uiTransformComp,s=r.width,o=r.height,a=r.anchorX*s,h=r.anchorY*o,u=-a,c=-h,l=s-a,_=o-h,d=0;switch(t.fillType){case OH.HORIZONTAL:d=u+(l-u)*i,u+=(l-u)*e,l=d;break;case OH.VERTICAL:d=c+(_-c)*i,c+=(_-c)*e,_=d;break;default:Z(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.chunk.setIndexBuffer(MH);for(var i,n=d(e.data);!(i=n()).done;)i.value.z=0;return e},updateWorldVertexData:function(t,e){t.node.getWorldMatrix(PH);for(var i=t.renderData.floatStride,n=t.renderData.data,r=e.vb,s=0,o=0;o<4;o++){var a=n[o],h=a.x,u=a.y,c=PH.m03*h+PH.m07*u+PH.m15;c=c?1/c:1,r[s=o*i]=(PH.m00*h+PH.m04*u+PH.m12)*c,r[s+1]=(PH.m01*h+PH.m05*u+PH.m13)*c,r[s+2]=(PH.m02*h+PH.m06*u+PH.m14)*c}},fillBuffers:function(t){var e=t.renderData,i=e.chunk;(t._flagChangedVersion!==t.node.flagChangedVersion||e.vertDirty)&&(this.updateWorldVertexData(t,i),e.vertDirty=!1,t._flagChangedVersion=t.node.flagChangedVersion),i.bufferId;var n=i.vertexOffset,r=i.meshBuffer,s=i.meshBuffer.iData,o=r.indexOffset;s[o++]=n,s[o++]=n+1,s[o++]=n+2,s[o++]=n+2,s[o++]=n+1,s[o++]=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,o=s.r/255,a=s.g/255,h=s.b/255,u=t.node._uiProps.opacity,c=0;c<4;c++)i[r]=o,i[r+1]=a,i[r+2]=h,i[r+3]=u,r+=n}},LH=2*Math.PI,BH=1e-6,FH=new Ln,kH=[new Hn,new Hn,new Hn,new Hn],UH=new Array(4),GH=new Array(8),HH=[new Hn,new Hn,new Hn,new Hn],zH=[new Hn,new Hn,new Hn,new Hn],VH=new Hn,WH=[new Hn,new Hn,new Hn,new Hn],XH=null;function jH(t,e,i,n,r,s,o){var a=Math.sin(s);a=Math.abs(a)>BH?a:0;var h=Math.cos(s),u=0,c=0;if(0!==(h=Math.abs(h)>BH?h:0)){if(u=a/h,(t-r.x)*h>0){var l=r.y+u*(t-r.x);o[0].x=t,o[0].y=l}if((e-r.x)*h>0){var _=r.y+u*(e-r.x);o[2].x=e,o[2].y=_}}if(0!==a){if(c=h/a,(n-r.y)*a>0){var d=r.x+c*(n-r.y);o[3].x=d,o[3].y=n}if((i-r.y)*a>0){var f=r.x+c*(i-r.y);o[1].x=f,o[1].y=i}}}function YH(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 KH(t,e,i,n,r){var s=UH,o=s[0],a=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,qH((i.x-o)/(h-o),(i.y-a)/(u-a),t,e),qH((n.x-o)/(h-o),(n.y-a)/(u-a),t,e+1),qH((r.x-o)/(h-o),(r.y-a)/(u-a),t,e+2)}function qH(t,e,i,n){var r=GH,s=r[0]+(r[2]-r[0])*t,o=r[4]+(r[6]-r[4])*t,a=r[1]+(r[3]-r[1])*t,h=r[5]+(r[7]-r[5])*t,u=i[n];u.u=s+(o-s)*e,u.v=a+(h-a)*e}for(var QH={useModel:!1,createData:function(t){return t.requestRenderData()},updateRenderData:function(t){var e=t.spriteFrame;wO.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 o=(r*=LH)+(s*=LH);!function(t){var e=t.node._uiProps.uiTransformComp,i=e.width,n=e.height,r=e.anchorX*i,s=e.anchorY*n,o=-r,a=-s,h=i-r,u=n-s,c=UH;c[0]=o,c[1]=a,c[2]=h,c[3]=u;var l=t.fillCenter,_=VH.x=Math.min(Math.max(0,l.x),1)*(h-o)+o,d=VH.y=Math.min(Math.max(0,l.y),1)*(u-a)+a;kH[0].x=kH[3].x=o,kH[1].x=kH[2].x=h,kH[0].y=kH[1].y=a,kH[2].y=kH[3].y=u;for(var f=0,p=WH;f<p.length;f++){var g=p[f];Hn.set(g,0,0)}_!==c[0]&&Hn.set(WH[0],3,0),_!==c[2]&&Hn.set(WH[2],1,2),d!==c[1]&&Hn.set(WH[1],0,1),d!==c[3]&&Hn.set(WH[3],2,3)}(t),function(t){var e=t.width,i=t.height,n=t.getRect(),r=0,s=0,o=0,a=0,h=GH;t.isRotated()?(r=n.x/e,s=(n.x+n.height)/e,o=n.y/i,a=(n.y+n.width)/i,h[0]=h[2]=r,h[4]=h[6]=s,h[3]=h[7]=a,h[1]=h[5]=o):(r=n.x/e,s=(n.x+n.width)/e,o=n.y/i,a=(n.y+n.height)/i,h[0]=h[4]=r,h[2]=h[6]=s,h[1]=h[3]=a,h[5]=h[7]=o)}(e),jH(UH[0],UH[2],UH[1],UH[3],VH,r,HH),jH(UH[0],UH[2],UH[1],UH[3],VH,r+s,zH);for(var a=0,h=0;h<4;++h){var u=WH[h];if(u)if(s>=LH)i.dataLength=a+3,KH(n,a,VH,kH[u.x],kH[u.y]),a+=3;else{var c=YH(VH,kH[u.x]),l=YH(VH,kH[u.y]);l<c&&(l+=LH),c-=LH,l-=LH;for(var _=0;_<3;++_)c>=o||(c>=r?(i.dataLength=a+3,KH(n,a,VH,kH[u.x],l>=o?zH[h]:kH[u.y]),a+=3):l>r&&(l<=o?(i.dataLength=a+3,KH(n,a,VH,HH[h],kH[u.y]),a+=3):(i.dataLength=a+3,KH(n,a,VH,HH[h],zH[h]),a+=3))),c+=LH,l+=LH}}0===a&&(i.dataLength=0),i.resize(a,a),i.updateRenderData(t,e)}},createQuadIndices:function(t){XH=null,XH=new Uint16Array(t);for(var e=0,i=0;i<t;i++)XH[e++]=i},fillBuffers:function(t){var e=t.node,i=t.renderData,n=i.chunk;(t._flagChangedVersion!==e.flagChangedVersion||i.vertDirty)&&(this.updateWorldVertexAndUVData(t,n),i.vertDirty=!1,t._flagChangedVersion=e.flagChangedVersion),this.updateColorLate(t),n.bufferId;for(var r=n.vertexOffset,s=n.meshBuffer,o=n.meshBuffer.iData,a=s.indexOffset,h=0;h<i.indexCount;h++)o[a+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 o=s*i;r[o+3]=n[s].u,r[o+4]=n[s].v}},updateWorldVertexAndUVData:function(t,e){t.node.getWorldMatrix(FH);for(var i=t.renderData,n=i.floatStride,r=t.renderData.data,s=e.vb,o=i.vertexCount,a=0,h=0;h<o;h++){var u=r[h],c=u.x,l=u.y,_=FH.m03*c+FH.m07*l+FH.m15;_=_?1/_:1,s[a+0]=(FH.m00*c+FH.m04*l+FH.m12)*_,s[a+1]=(FH.m01*c+FH.m05*l+FH.m13)*_,s[a+2]=(FH.m02*c+FH.m06*l+FH.m14)*_,s[a+3]=u.u,s[a+4]=u.v,a+=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,o=t.color,a=o.r/255,h=o.g/255,u=o.b/255,c=t.node._uiProps.opacity,l=0;l<r;l++)i[s]=a,i[s+1]=h,i[s+2]=u,i[s+3]=c,s+=n},updateColor:function(){}},ZH=Uint16Array.from([0,1,2,1,3,2]),JH={createData:function(t){var e=t.requestRenderData();return e.dataLength=4,e.resize(4,6),e.chunk.setIndexBuffer(ZH),e},updateRenderData:function(t){var e=t.spriteFrame;wO.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,o=s.m00,a=s.m01,h=s.m02,u=s.m03,c=s.m04,l=s.m05,_=s.m06,d=s.m07,f=s.m12,p=s.m13,g=s.m14,m=s.m15,v=i.floatStride,y=0,T=r.length,E=0;E<T;++E){var S=r[E],A=S.x,b=S.y,C=u*A+d*b+m;C=C?1/C:1,n[0+(y=E*v)]=(o*A+c*b+f)*C,n[y+1]=(a*A+l*b+p)*C,n[y+2]=(h*A+_*b+g)*C}},fillBuffers:function(t){if(null!==t){var e=t.renderData,i=e.chunk;(t._flagChangedVersion!==t.node.flagChangedVersion||e.vertDirty)&&(this.updateWorldVerts(t,i),e.vertDirty=!1,t._flagChangedVersion=t.node.flagChangedVersion);var n=i.vertexOffset,r=i.meshBuffer,s=i.meshBuffer.iData,o=r.indexOffset,a=n;s[o++]=a,s[o++]=a+1,s[o++]=a+2,s[o++]=a+1,s[o++]=a+3,s[o++]=a+2,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,o=i.anchorX*r,a=i.anchorY*s,h=0,u=0,c=0,l=0;if(t.trim)h=-o,u=-a,c=r-o,l=s-a;else{var _=t.spriteFrame,d=_.originalSize,f=r/d.width,p=s/d.height,g=_.trimmedBorder;h=g.x*f-o,u=g.z*p-a,c=r+g.y*f-o,l=s+g.w*p-a}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,o=r.g/255,a=r.b/255,h=r.a/255,u=0;u<4;u++,n+=e.floatStride)i[n]=s,i[n+1]=o,i[n+2]=a,i[n+3]=h}},$H=[],tz=0;tz<4;tz++)$H.push({x:0,y:0,z:0,u:0,v:0,color:new yn});var ez,iz,nz,rz,sz,oz,az,hz={createData:function(t){var e=t.requestRenderData();return e.dataLength=16,e.resize(16,54),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;wO.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,o=n.anchorX*r,a=n.anchorY*s,h=t.spriteFrame,u=h.insetLeft,c=h.insetRight,l=h.insetTop,_=h.insetBottom,d=r-u-c,f=s-l-_,p=r/(u+c),g=s/(l+_);p=Number.isNaN(p)||p>1?1:p,g=Number.isNaN(g)||g>1?1:g,d=d<0?0:d,f=f<0?0:f,$H[0].x=-o,$H[0].y=-a,$H[1].x=u*p-o,$H[1].y=_*g-a,$H[2].x=$H[1].x+d,$H[2].y=$H[1].y+f,$H[3].x=r-o,$H[3].y=s-a;for(var m=0;m<4;m++)for(var v=0;v<4;v++){var y=4*m+v;y<e.dataLength&&m<$H.length&&v<$H.length&&(i[y].x=$H[v].x,i[y].y=$H[m].y)}},fillBuffers:function(t){var e=t.renderData,i=e.chunk;(t._flagChangedVersion!==t.node.flagChangedVersion||e.vertDirty)&&(this.updateWorldVertexData(t,i),e.vertDirty=!1,t._flagChangedVersion=t.node.flagChangedVersion),i.bufferId;for(var n=i.vertexOffset,r=i.meshBuffer,s=i.meshBuffer.iData,o=r.indexOffset,a=0;a<3;++a)for(var h=0;h<3;++h){var u=n+4*a+h;s[o++]=u,s[o++]=u+1,s[o++]=u+4,s[o++]=u+1,s[o++]=u+5,s[o++]=u+4}r.indexOffset=o},updateWorldVertexData:function(t,e){for(var i=t.renderData,n=i.floatStride,r=i.data,s=e.vb,o=t.node.worldMatrix,a=o.m00,h=o.m01,u=o.m02,c=o.m03,l=o.m04,_=o.m05,d=o.m06,f=o.m07,p=o.m12,g=o.m13,m=o.m14,v=o.m15,y=0,T=0;T<4;++T)for(var E=r[4*T],S=0;S<4;++S){var A=r[S].x,b=E.y,C=c*A+f*b+v;C=C?1/C:1,s[0+(y=(4*T+S)*n)]=(a*A+l*b+p)*C,s[y+1]=(h*A+_*b+g)*C,s[y+2]=(u*A+d*b+m)*C}},updateUVs:function(t){if(t.spriteFrame)for(var e=t.renderData,i=e.chunk.vb,n=e.floatStride,r=t.spriteFrame.uvSliced,s=3,o=0;o<16;o++)i[s]=r[o].u,i[s+1]=r[o].v,s+=n},updateColor:function(t){for(var e=t.renderData,i=e.chunk.vb,n=e.floatStride,r=5,s=t.color,o=s.r/255,a=s.g/255,h=s.b/255,u=t.node._uiProps.opacity,c=0;c<16;c++)i[r]=o,i[r+1]=a,i[r+2]=h,i[r+3]=u,r+=n}},uz=new Ln,cz=0,lz=[],_z=null;function dz(t){return t&&(t.insetTop>0||t.insetBottom>0||t.insetLeft>0||t.insetRight>0)?2:0}var fz={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),o=i.getRect(),a=i.insetLeft,h=i.insetRight,u=o.width-a-h,c=i.insetTop,l=i.insetBottom,_=o.height-c-l,d=r-a-h,f=s-c-l;d=d>0?d:0,f=f>0?f:0;var p=0===u?d:d/u,g=0===_?f:f/_,m=dz(i),v=Math.ceil(g+m),y=Math.ceil(p+m);e.dataLength=4*v*y,this.updateVerts(t,d,f,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;_z=new Uint16Array(t);for(var i=0,n=0;n<e;n++)_z[i++]=0+4*n,_z[i++]=1+4*n,_z[i++]=2+4*n,_z[i++]=1+4*n,_z[i++]=3+4*n,_z[i++]=2+4*n}else Z(16308)},updateUVs:function(t){t.renderData.vertDirty=!0,t.markForUpdateRenderData()},fillBuffers:function(t){var e=t.node,i=t.renderData,n=i.chunk;if(null!==n){(t._flagChangedVersion!==e.flagChangedVersion||i.vertDirty)&&(this.updateWorldVertexAndUVData(t,n),i.vertDirty=!1,t._flagChangedVersion=e.flagChangedVersion),this.updateColorLate(t),n.bufferId;for(var r=n.vertexOffset,s=n.meshBuffer,o=n.meshBuffer.iData,a=s.indexOffset,h=0;h<i.indexCount;h+=6)o[a++]=r,o[a++]=r+1,o[a++]=r+2,o[a++]=r+1,o[a++]=r+3,o[a++]=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 o=s*i;r[o+3]=n[s].u,r[o+4]=n[s].v}},updateWorldVertexAndUVData:function(t,e){t.node.getWorldMatrix(uz);for(var i=t.renderData,n=i.floatStride,r=i.data,s=e.vb,o=r.length,a=0;a<o;a++){var h=r[a].x,u=r[a].y,c=r[a].z,l=uz.m03*h+uz.m07*u+uz.m11*c+uz.m15;l=l?1/l:1;var _=a*n;s[_]=(uz.m00*h+uz.m04*u+uz.m08*c+uz.m12)*l,s[_+1]=(uz.m01*h+uz.m05*u+uz.m09*c+uz.m13)*l,s[_+2]=(uz.m02*h+uz.m06*u+uz.m10*c+uz.m14)*l}this.updateWorldUVData(t)},updateVerts:function(t,e,i,n,r){var s,o,a=t.node._uiProps.uiTransformComp,h=t.renderData.data,u=t.spriteFrame,c=u.rect,l=Math.abs(a.width),_=Math.abs(a.height),d=a.anchorX*l,f=a.anchorY*_,p=u.insetLeft,g=u.insetRight,m=c.width-p-g,v=u.insetTop,y=u.insetBottom,T=c.height-v-y,E=a.width/(p+g)>1?1:a.width/(p+g),S=a.height/(v+y)>1?1:a.height/(v+y);s=m>0?Math.floor(1e3*e)/1e3%m==0?m:e%m:e,o=T>0?Math.floor(1e3*i)/1e3%T==0?T:i%T:i,lz.length=0,cz=Math.max(n+1,r+1);for(var A=0;A<cz;A++)lz.push({x:0,y:0,z:0,u:0,v:0,color:new yn});var b=dz(u);if(0===b)for(var C=0;C<cz;C++)lz[C].x=C>=r?l-d:C*m-d,lz[C].y=C>=n?_-f:C*T-f;else for(var R=0;R<cz;R++)0===R?lz[R].x=-d:1===R?lz[R].x=p*E-d:R>1&&R<r-1?lz[R].x=m>0?p*E-d+m*(R-1):p+e-d:R===r-1?lz[R].x=p*E-d+s+m*(R-2):R>=r&&(lz[R].x=Math.min(p+e+g,l)-d),0===R?lz[R].y=-f:1===R?lz[R].y=y*S-f:R>1&&R<n-1?lz[R].y=T>0?y*S-f+T*(R-1):y+i-f:R===n-1?lz[R].y=y*S-f+o+T*(R-2):R>=n&&(lz[R].y=Math.min(y+i+v,_)-f);for(var w=0,I=0,x=0,D=0,O=0;O<n;++O){x=lz[O].y,D=lz[O+1].y;for(var P=0;P<r;++P){w=lz[P].x,I=lz[P+1].x;var M=4*(O*r+P);h[M].x=w,h[M].y=x,h[M+1].x=I,h[M+1].y=x,h[M+2].x=w,h[M+2].y=D,h[M+3].x=I,h[M+3].y=D}}var N=u.rotated;u.uv;var L=u.uvSliced;ez=L[0],iz=L[1],nz=L[2],rz=L[3],sz=L[4],oz=L[8],az=L[12];for(var B=0,F=0,k=0===m?e:e/m,U=0===T?i:i/T,G=[],H=[],z=0;z<n;++z){F=i>T?i>=(b>0?z:z+1)*T?1:U%1:U;for(var V=0;V<r;++V){B=e>m?e>=(b>0?V:V+1)*m?1:k%1:k,N?(0===b?(G[0]=sz.u,G[1]=sz.u,G[2]=sz.u+(oz.u-sz.u)*F,H[0]=iz.v,H[1]=iz.v+(nz.v-iz.v)*B,H[2]=iz.v):(0===z?(G[0]=ez.u,G[1]=ez.u,G[2]=sz.u):z<n-1?(G[0]=sz.u,G[1]=sz.u,G[2]=sz.u+(oz.u-sz.u)*F):z===n-1&&(G[0]=oz.u,G[1]=oz.u,G[2]=az.u),0===V?(H[0]=ez.v,H[1]=iz.v,H[2]=ez.v):V<r-1?(H[0]=iz.v,H[1]=iz.v+(nz.v-iz.v)*B,H[2]=iz.v):V===r-1&&(H[0]=nz.v,H[1]=rz.v,H[2]=nz.v)),G[3]=G[2],H[3]=H[1]):(0===b?(G[0]=iz.u,G[1]=iz.u+(nz.u-iz.u)*B,G[2]=iz.u,H[0]=sz.v,H[1]=sz.v,H[2]=sz.v+(oz.v-sz.v)*F):(0===V?(G[0]=ez.u,G[1]=iz.u,G[2]=ez.u):V<r-1?(G[0]=iz.u,G[1]=iz.u+(nz.u-iz.u)*B,G[2]=iz.u):V===r-1&&(G[0]=nz.u,G[1]=rz.u,G[2]=nz.u),0===z?(H[0]=ez.v,H[1]=ez.v,H[2]=sz.v):z<n-1?(H[0]=sz.v,H[1]=sz.v,H[2]=sz.v+(oz.v-sz.v)*F):z===n-1&&(H[0]=oz.v,H[1]=oz.v,H[2]=az.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,o=t.color,a=o.r/255,h=o.g/255,u=o.b/255,c=t.node._uiProps.opacity,l=0;l<r;l++)i[s]=a,i[s+1]=h,i[s+2]=u,i[s+3]=c,s+=n},updateColor:function(){}},pz=PF.Type,gz=PF.FillType,mz=t("spriteAssembler",{getAssembler:function(t){var e=JH,i=t;switch(i.type){case pz.SLICED:e=hz;break;case pz.TILED:e=fz;break;case pz.FILLED:e=i.fillType===gz.RADIAL?QH:NH}return e}});PF.Assembler=mz;var vz=[Fw.EventType.MOUSE_DOWN,Fw.EventType.MOUSE_MOVE,Fw.EventType.MOUSE_UP,Fw.EventType.MOUSE_WHEEL,Fw.EventType.MOUSE_LEAVE,Fw.EventType.MOUSE_ENTER],yz=[Fw.EventType.TOUCH_START,Fw.EventType.TOUCH_MOVE,Fw.EventType.TOUCH_END,Fw.EventType.TOUCH_CANCEL];new(function(){function t(){this.priority=xw.UI,this._isListDirty=!1,this._inDispatchCount=0,this._pointerEventProcessorList=[],this._processorListToAdd=[],this._processorListToRemove=[],kw._registerEventDispatcher(this),mx.callbacksInvoker.on(cx.ADD_POINTER_EVENT_PROCESSOR,this.addPointerEventProcessor,this),mx.callbacksInvoker.on(cx.REMOVE_POINTER_EVENT_PROCESSOR,this.removePointerEventProcessor,this),mx.callbacksInvoker.on(cx.MARK_LIST_DIRTY,this._markListDirty,this)}var e=t.prototype;return e.onThrowException=function(){this._inDispatchCount=0},e.dispatchEvent=function(t){var e=t.type;return yz.includes(e)?this.dispatchEventTouch(t):!vz.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),ue(this._processorListToRemove,t)},e.removePointerEventProcessor=function(t){0===this._inDispatchCount?(ue(this._pointerEventProcessorList,t),this._isListDirty=!0):this._processorListToRemove.includes(t)||this._processorListToRemove.push(t),ue(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 o=e[s];if(o.isEnabled&&o.shouldHandleEventTouch)if(t.type===qR.TOUCH_START){if(o._handleEventTouch(t)){if(o.isEnabled)o.claimedTouchIdList.push(n.getID());else{var a=new ew([t.touch],!0,qR.TOUCH_CANCEL);a.touch=t.touch,o.dispatchEvent(a),o.claimedTouchIdList.length=0}if(r=!1,!t.preventSwallow)break;t.preventSwallow=!1}}else if(o.claimedTouchIdList.length>0){var h=o.claimedTouchIdList.indexOf(n.getID());if(-1!==h){if(o._handleEventTouch(t),t.type!==qR.TOUCH_END&&t.type!==qR.TOUCH_CANCEL||(ae(o.claimedTouchIdList,h),t.preventSwallow||this._removeClaimedTouch(s+1,n.getID())),r=!1,!t.preventSwallow)break;t.preventSwallow=!1}}}return--this._inDispatchCount<=0&&this._updatePointerEventProcessorList(),r},e._removeClaimedTouch=function(t,e){for(var i=this._pointerEventProcessorList,n=i.length,r=t;r<n;++r){var s=i[r],o=s.claimedTouchIdList.indexOf(e);-1!==o&&ae(s.claimedTouchIdList,o)}},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,o=!1;(null===(a=r.parent)||void 0===a?void 0:a.uuid)!==(null===(h=s.parent)||void 0===h?void 0:h.uuid);){var a,h,u,c,l,_;r=null===(null===(u=r)||void 0===u||null===(c=u.parent)||void 0===c?void 0:c.parent)?(o=!0)&&n:r&&r.parent,s=null===(null===(l=s)||void 0===l||null===(_=l.parent)||void 0===_?void 0:_.parent)?(o=!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 d=r?r.getSiblingIndex():0,f=s?s.getSiblingIndex():0;return o?d-f:f-d},e._markListDirty=function(){this._isListDirty=!0},t}());var Tz=new q_(null),Ez=new Ln,Sz=t("UI",function(){function t(t){var e=this;this._screens=[],this._staticVBBuffer=null,this._bufferAccessors=new Map,this._currBID=-1,this._indexStart=0,this._emptyMaterial=new $E,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 bz,this._meshDataArray=[],this._maskClearModel=null,this._maskClearMtl=null,this._maskModelMesh=null,this._root=t,this.device=t.device,this._batches=new js(64),this._drawBatchPool=new Ws((function(){return new pG}),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=d(this._bufferAccessors.values());!(e=i()).done;)e.value.destroy();this._bufferAccessors.clear(),this._drawBatchPool&&this._drawBatchPool.destroy(),this._descriptorSetCache.destroy(),eN.sharedManager.destroy(),this._maskClearModel&&this._maskModelMesh&&(m.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 o=this._batches.array[e];if(o.model)for(var a=o.model.subModels,h=0;h<a.length;h++)a[h].priority=s++;else o.descriptorSet=this._descriptorSetCache.getDescriptorSet(o);r.addBatch(o)}}}},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=d(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=d(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(),eN.sharedManager.reset()},e.switchBufferAccessor=function(t){void 0===t&&(t=MM);var e=t===MM?36:kM(t);if(!this._staticVBBuffer||this._staticVBBuffer.vertexFormatBytes!==e){var i=this._bufferAccessors.get(e);i||(i=new qM(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,o=0,a=-1;if(e&&e.chunk){if(!e.isValid())return;o=e.dataHash,s=e.material,a=e.chunk.bufferId}t.stencilStage===VM.ENTER_LEVEL||t.stencilStage===VM.ENTER_LEVEL_INVERTED?this._insertMaskBatch(t):t.stencilStage=eN.sharedManager.stage;var h=t.stencilStage;this._currHash===o&&0!==o&&this._currMaterial===s&&this._currDepthStencilStateStage===h||(this.autoMergeBatches(this._currComponent),e&&!e._isMeshBuffer&&this.updateBuffer(e.vertexFormat,a),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){this._currMaterial!==this._emptyMaterial&&(this.autoMergeBatches(this._currComponent),this.resetRenderStates());var s=null,o=0;t&&(t.stencilStage=eN.sharedManager.stage,s=null!==t.customMaterial?eN.sharedManager.getStencilStage(t.stencilStage,n):eN.sharedManager.getStencilStage(t.stencilStage),o=eN.sharedManager.getStencilHash(t.stencilStage));var a=this._currStaticRoot?this._currStaticRoot._requireDrawBatch():this._drawBatchPool.alloc();a.visFlags=t.node.layer,a.inputAssembler=e,a.useLocalData=r||null,i&&(a.texture=i.getGFXTexture(),a.sampler=i.getGFXSampler(),a.textureHash=i.getHash(),a.samplerHash=a.sampler.hash),a.fillPasses(n||null,s,o,null),this._batches.push(a)},e.commitMiddleware=function(t,e,i,n,r,s,o){var a=r.getGFXTexture();o&&this._middlewareEnableBatch&&this._middlewareBuffer===e&&this._currTexture===a&&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=a,this._currSampler=r.getGFXSampler(),this._currTextureHash=r.getHash(),this._currLayer=t.node.layer,this._currSamplerHash=this._currSampler.hash,this._currHash=0,this._currTransform=o?null:t.node,this._middlewareEnableBatch=o,this._middlewareBuffer=e,this._currMaterial=s,this._middlewareIndexStart=i,this._middlewareIndexCount=n),this._currIsMiddleware=!0},e.commitModel=function(t,e,i){this._currMaterial!==this._emptyMaterial&&(this.autoMergeBatches(this._currComponent),this.resetRenderStates());var n=null,r=0;i&&(t.stencilStage===VM.ENTER_LEVEL||t.stencilStage===VM.ENTER_LEVEL_INVERTED?this._insertMaskBatch(t):t.stencilStage=eN.sharedManager.stage,n=eN.sharedManager.getStencilStage(t.stencilStage,i),r=eN.sharedManager.getStencilHash(t.stencilStage));var s=m.director.getTotalFrames();e&&(e.updateTransform(s),e.updateUBOs(s));for(var o=0;o<e.subModels.length;o++){var a=this._drawBatchPool.alloc(),h=e.subModels[o];a.visFlags=t.node.layer,a.model=e,a.texture=null,a.sampler=null,a.useLocalData=null,n||(n=null),a.fillPasses(i,n,r,h.patches),a.inputAssembler=h.inputAssembler,a.model.visFlags=a.visFlags,a.descriptorSet=h.descriptorSet,this._batches.push(a)}},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,o=r.getMeshBuffer(s);if(!o)return;var a=o.indexOffset-this._indexStart;if(a<=0)return;this._indexStart,o.indexOffset,o.setDirty(),(i=o.requireFreeIA(this.device)).firstIndex=this._indexStart,i.indexCount=a,this._indexStart=o.indexOffset}if(this._currBID=-1,i&&this._currTexture){var h=null,u=0;t&&(h=null!==t.customMaterial?eN.sharedManager.getStencilStage(t.stencilStage,e):eN.sharedManager.getStencilStage(t.stencilStage),u=eN.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=eN.sharedManager.stage,i=null!==t.customMaterial?eN.sharedManager.getStencilStage(t.stencilStage,this._currMaterial):eN.sharedManager.getStencilStage(t.stencilStage),e=eN.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,i,e,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,o=s,a=r&&r.color?r.color.a/255:1;if(this._pOpacity=o*=a*n.localOpacity,n.setOpacity(o),!Oi(o,0,xi)){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,o=t.chunk.vb,a=0,h=0;h<s.length;++h){if(i=s[h],(n=od[i.format]).hasAlpha)if(r=t.floatStride,n.size/n.count==1)for(var u=~~Pi(Math.round(255*e),0,255),c=a;c<o.length;c+=r)o[c]=(4294967040&o[c]|u)>>>0;else if(n.size/n.count==4)for(var l=a+3;l<o.length;l+=r)o[l]=e;a+=n.size>>2}}(r.renderData,o);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===VM.ENTER_LEVEL||r.stencilStage===VM.ENTER_LEVEL_INVERTED)&&eN.sharedManager.getMaskStackSize()>0&&(this.autoMergeBatches(this._currComponent),this.resetRenderStates(),eN.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=NE.get("default-clear-stencil"),this._maskClearModel=m.director.root.createModel(II);var t=kM(OM),e=Qd.gfxDevice,i=e.createBuffer(new v_(vl.VERTEX|vl.TRANSFER_DST,El.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 v_(vl.INDEX|vl.TRANSFER_DST,El.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 kD([i],OM,Hl.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=eN.sharedManager;e.pushMask(1);var i=e.clear(t),n=null,r=0,s=this._maskClearMtl;s&&(n=e.getStencilStage(i,s),r=e.getStencilHash(i));var o=this._maskClearModel,a=m.director.getTotalFrames();o&&(o.updateTransform(a),o.updateUBOs(a));for(var h=0;h<o.subModels.length;h++){var u=this._drawBatchPool.alloc(),c=o.subModels[h];u.visFlags=t.node.layer,u.model=o,u.texture=null,u.sampler=null,u.useLocalData=null,n||(n=null),u.fillPasses(s,n,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}()),Az=function(){function t(){this._descriptorSet=null,this._transform=null,this._textureHash=0,this._samplerHash=0,this._localBuffer=null,this._transformUpdate=!0;var t=Qd.gfxDevice;this._localData=new Float32Array(dv.COUNT),this._localBuffer=t.createBuffer(new v_(vl.UNIFORM|vl.TRANSFER_DST,El.HOST|El.DEVICE,dv.SIZE,dv.SIZE))}var e=t.prototype;return e.initialize=function(t){var e=Qd.gfxDevice;this._transform=t.useLocalData,this._textureHash=t.textureHash,this._samplerHash=t.samplerHash,Tz.layout=t.passes[0].localSetLayout,this._descriptorSet=e.createDescriptorSet(Tz),this._descriptorSet.bindBuffer(dv.BINDING,this._localBuffer);var i=Vm.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;Ln.toArray(this._localData,e,dv.MAT_WORLD_OFFSET),Ln.invert(Ez,e),Ln.transpose(Ez,Ez);var i=Ln.determinant(Ez),n=1/Math.sqrt(i);Ln.multiplyScalar(Ez,Ez,n),Ln.toArray(this._localData,Ez,dv.MAT_WORLD_IT_OFFSET),this._localBuffer.update(this._localData),this._transformUpdate=!1}},n(t,[{key:"descriptorSet",get:function(){return this._descriptorSet}}]),t}(),bz=function(){function t(){this._descriptorSetCache=new Map,this._dsCacheHashByTexture=new Map,this._localDescriptorSetCache=[],this._localCachePool=new Ws((function(){return new Az}),16,(function(t){return t.destroy()}))}var e=t.prototype;return e.getDescriptorSet=function(t){if(m.director.root,t.useLocalData){for(var e=this._localDescriptorSetCache,i=0,n=e.length;i<n;i++){var r=e[i];if(r.equals(t.useLocalData,t.textureHash,t.samplerHash))return r.descriptorSet}var s=this._localCachePool.alloc();return s.initialize(t),this._localDescriptorSetCache.push(s),s.descriptorSet}var o=t.textureHash^t.samplerHash;if(this._descriptorSetCache.has(o))return this._descriptorSetCache.get(o);Tz.layout=t.passes[0].localSetLayout;var a=Qd.gfxDevice.createDescriptorSet(Tz),h=Vm.SAMPLER_SPRITE;return a.bindTexture(h,t.texture),a.bindSampler(h,t.sampler),a.update(),this._descriptorSetCache.set(o,a),this._dsCacheHashByTexture.set(t.textureHash,o),a},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 o=i.length-1;o>=0;o--){var a=i[o],h=t[a];t.splice(a,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=d(this._descriptorSetCache.values());!(t=e()).done;)t.value.destroy();this._descriptorSetCache.clear(),this._dsCacheHashByTexture.clear(),this._localDescriptorSetCache.length=0,this._localCachePool.destroy()},t}();m.internal.Batcher2D=Sz,t("UIDrawBatch",function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(pG)),ot(XM.prototype,"MeshBuffer",["byteStart","vertexStart","indicesStart","request"].map((function(t){return{name:t,suggest:"please use meshBuffer.accessor."+t+" instead"}}))),rt(XM.prototype,"MeshBuffer",[{name:"indicesOffset",newName:"indexOffset"}]),st(XM.prototype,"MeshBuffer",[{name:"vertexBuffers"},{name:"indexBuffer"}]),rt(Sz.prototype,"Batcher2D",[{name:"currBufferBatch",newName:"currBufferAccessor"},{name:"acquireBufferBatch",newName:"switchBufferAccessor"}]),st(mN.prototype,"MeshRenderData",[{name:"formatByte"},{name:"byteStart"},{name:"byteCount"}]),rt(mN.prototype,"MeshRenderData",[{name:"indicesStart",newName:"indexStart"}]),t("QuadRenderData",function(t){function e(e){var i;return i=t.call(this,e)||this,q(9006),i}return s(e,t),e}(mN)),m.UI={MeshBuffer:XM,spriteAssembler:mz,graphicsAssembler:sH,labelAssembler:DH,RenderData:gN,MeshRenderData:mN},bO.on(AO.EVENT_POST_SUBSYSTEM_INIT,(function(){Oz.init()}));var Cz,Rz,wz,Iz,xz,Dz,Oz=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):Z(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):Z(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 Z(2106),0},t.isLayerValid=function(t){return!!this.indexMap.has(t)||(Z(2105),!1)},t.getBuiltinLayers=function(){return[{id:0,name:"default",value:0}]},t.init=function(){var e=we.querySettings(Ce.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}ye.update(t.Enum),ye.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}());Oz.nameMap=new Map,Oz.indexMap=new Map,Oz.Enum=ye({default:0}),t("Sorting",(Cz=va("cc.Sorting"),Rz=Za(Oz.Enum),Cz(wz=Ea((f((Iz=function(t){function e(){var e;return(e=t.call(this)||this)._sortingLayer=xz&&xz(),e._sortingOrder=Dz&&Dz(),e._modelRenderer=null,e}s(e,t);var i=e.prototype;return i.__preload=function(){this._modelRenderer=this.getComponent("cc.ModelRenderer"),this._modelRenderer||q(16301,this.node.name),this._updateSortingPriority()},i._updateSortingPriority=function(){var t=Oz.getLayerIndex(this._sortingLayer),e=Oz.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&&Oz.isLayerValid(t)&&(this._sortingLayer=t,this._updateSortingPriority())}},{key:"sortingOrder",get:function(){return this._sortingOrder},set:function(t){t!==this._sortingOrder&&(this._sortingOrder=Pi(t,-32768,32767),this._updateSortingPriority())}}]),e}(xp)).prototype,"sortingLayer",[Rz],Object.getOwnPropertyDescriptor(Iz.prototype,"sortingLayer"),Iz.prototype),xz=ua(Iz.prototype,"_sortingLayer",[wa],(function(){return Oz.Enum.default})),Dz=ua(Iz.prototype,"_sortingOrder",[wa],(function(){return 0})),wz=Iz))||wz)||wz));var Pz,Mz,Nz,Lz,Bz,Fz,kz,Uz,Gz,Hz,zz,Vz,Wz,Xz,jz,Yz,Kz,qz,Qz,Zz,Jz,$z,tV,eV,iV,nV,rV,sV,oV,aV,hV,uV,cV,lV,_V,dV,fV,pV,gV,mV,vV,yV,TV=function(t){function e(){var e;return(e=t.call(this)||this)._morphRenderingInstance=null,e._usedMaterials=new Set,e}s(e,t);var i=e.prototype;return i.getMacroPatches=function(e){var i=t.prototype.getMacroPatches.call(this,e);if(this._morphRenderingInstance){var n=this._morphRenderingInstance.requiredPatches(e);if(n)return n.concat(null!=i?i:[])}return i},i.initSubModel=function(e,i,n){return t.prototype.initSubModel.call(this,e,i,this._launderMaterial(n))},i.destroy=function(){t.prototype.destroy.call(this),this._morphRenderingInstance=null},i.setSubModelMaterial=function(e,i){return t.prototype.setSubModelMaterial.call(this,e,this._launderMaterial(i))},i.setMorphRendering=function(t){this._morphRenderingInstance=t},i._updateLocalDescriptors=function(e,i){t.prototype._updateLocalDescriptors.call(this,e,i),this._morphRenderingInstance&&this._morphRenderingInstance.adaptPipelineState(e,i)},i._launderMaterial=function(t){return t},e}(II),EV=va,SV=Ta,AV=Za,bV=Ia,CV=wa,RV=LE("specular-pass");function wV(t){var e=t.passes,i=m.rendering;Ay()&&(RV=i.getPhaseID(i.getPassID("specular-pass"),"default"));for(var n=0;n<e.length;n++)if((!i||!i.enableEffectImport)&&e[n].phase===RV||Ay()&&e[n].phaseID===RV)return n;return-1}var IV,xV,DV,OV,PV,MV,NV,LV,BV=ye({OFF:0,ON:1}),FV=ye({OFF:0,ON:1}),kV=(Pz=EV("cc.ModelBakeSettings"),Mz=bV("_recieveShadow"),Nz=AV(Ze),Lz=AV($e),Bz=AV($e),Fz=AV(ye(pI)),kz=AV($e),Pz(((Zz=function(t){function e(){var e;return(e=t.call(this)||this).texture=Hz&&Hz(),e.uvParam=zz&&zz(),e._bakeable=Vz&&Vz(),e._castShadow=Wz&&Wz(),e._receiveShadow=Xz&&Xz(),e._lightmapSize=jz&&jz(),e._useLightProbe=Yz&&Yz(),e._bakeToLightProbe=Kz&&Kz(),e._reflectionProbeType=qz&&qz(),e._bakeToReflectionProbe=Qz&&Qz(),e.probeCubemap=null,e.probeBlendCubemap=null,e.probePlanarmap=null,e}return s(e,t),n(e,[{key:"bakeable",get:function(){return this._bakeable},set:function(t){this._bakeable=t}},{key:"castShadow",get:function(){return this._castShadow},set:function(t){this._castShadow=t}},{key:"receiveShadow",get:function(){return this._receiveShadow},set:function(t){this._receiveShadow=t}},{key:"lightmapSize",get:function(){return this._lightmapSize},set:function(t){this._lightmapSize=t}},{key:"useLightProbe",get:function(){return this._useLightProbe},set:function(t){this._useLightProbe=t,this.emit(e.USE_LIGHT_PROBE_CHANGED)}},{key:"bakeToLightProbe",get:function(){return this._bakeToLightProbe},set:function(t){this._bakeToLightProbe=t}},{key:"reflectionProbe",get:function(){return this._reflectionProbeType},set:function(t){this._reflectionProbeType=t,this.emit(e.REFLECTION_PROBE_CHANGED)}},{key:"bakeToReflectionProbe",get:function(){return this._bakeToReflectionProbe},set:function(t){this._bakeToReflectionProbe=t,this.emit(e.BAKE_TO_REFLECTION_PROBE_CHANGED)}}]),e}(oo)).USE_LIGHT_PROBE_CHANGED="use_light_probe_changed",Zz.REFLECTION_PROBE_CHANGED="reflection_probe_changed",Zz.BAKE_TO_REFLECTION_PROBE_CHANGED="bake_to_reflection_probe_changed",Hz=ua((Gz=Zz).prototype,"texture",[CV],(function(){return null})),zz=ua(Gz.prototype,"uvParam",[CV],(function(){return new on})),Vz=ua(Gz.prototype,"_bakeable",[CV],(function(){return!1})),Wz=ua(Gz.prototype,"_castShadow",[CV],(function(){return!1})),Xz=ua(Gz.prototype,"_receiveShadow",[Mz],(function(){return!1})),jz=ua(Gz.prototype,"_lightmapSize",[CV],(function(){return 64})),Yz=ua(Gz.prototype,"_useLightProbe",[CV],(function(){return!1})),Kz=ua(Gz.prototype,"_bakeToLightProbe",[CV],(function(){return!0})),qz=ua(Gz.prototype,"_reflectionProbeType",[CV],(function(){return pI.NONE})),Qz=ua(Gz.prototype,"_bakeToReflectionProbe",[CV],(function(){return!0})),f(Gz.prototype,"lightmapSize",[Nz],Object.getOwnPropertyDescriptor(Gz.prototype,"lightmapSize"),Gz.prototype),f(Gz.prototype,"useLightProbe",[Lz],Object.getOwnPropertyDescriptor(Gz.prototype,"useLightProbe"),Gz.prototype),f(Gz.prototype,"bakeToLightProbe",[Bz],Object.getOwnPropertyDescriptor(Gz.prototype,"bakeToLightProbe"),Gz.prototype),f(Gz.prototype,"reflectionProbe",[Fz],Object.getOwnPropertyDescriptor(Gz.prototype,"reflectionProbe"),Gz.prototype),f(Gz.prototype,"bakeToReflectionProbe",[kz],Object.getOwnPropertyDescriptor(Gz.prototype,"bakeToReflectionProbe"),Gz.prototype),Uz=Gz))||Uz),UV=(Jz=EV("cc.MeshRenderer"),$z=SV(100),tV=AV(Je),eV=AV(Je),iV=AV(BV),nV=AV(FV),rV=AV(ZO),sV=AV($e),Jz(oV=$z(((yV=function(t){s(i,t);var e=i.prototype;function i(){var e;return(e=t.call(this)||this).bakeSettings=hV&&hV(),e._mesh=uV&&uV(),e._shadowCastingMode=cV&&cV(),e._shadowReceivingMode=lV&&lV(),e._shadowBias=_V&&_V(),e._shadowNormalBias=dV&&dV(),e._reflectionProbeId=fV&&fV(),e._reflectionProbeBlendId=pV&&pV(),e._reflectionProbeBlendWeight=gV&&gV(),e._enabledGlobalStandardSkinObject=mV&&mV(),e._reflectionProbeDataMap=null,e._subMeshShapesWeights=[],e._modelType=II,e._model=null,e._morphInstance=null,e._enableMorph=vV&&vV(),we.querySettings(Ce.Category.RENDERING,"highQualityMode")&&(e._shadowCastingMode=BV.ON,e.bakeSettings.castShadow=!0,e.bakeSettings.receiveShadow=!0),e}return e.onUpdateReceiveDirLight=function(t,e){void 0===e&&(e=!1),this._model&&(e?this._model.receiveDirLight=!1:this.node&&(t&this.node.layer)===this.node.layer||t&this._model.visFlags?this._model.receiveDirLight=!0:this._model.receiveDirLight=!1)},e.clearGlobalStandardSkinObjectFlag=function(){this._enabledGlobalStandardSkinObject=!1},e.onLoad=function(){this._mesh&&this._mesh.initialize(),this._validateShapeWeights()||this._initSubMeshShapesWeights(),this._watchMorphInMesh(),this._updateModels(),this._updateCastShadow(),this._updateReceiveShadow(),this._updateShadowBias(),this._updateShadowNormalBias(),this._updateUseLightProbe(),this._updateBakeToReflectionProbe(),this._updateUseReflectionProbe(),this._updateReceiveDirLight(),this._updateStandardSkin()},e.onRestore=function(){this._updateModels(),this.enabledInHierarchy&&this._attachToScene(),this._updateCastShadow(),this._updateReceiveShadow(),this._updateShadowBias(),this._updateShadowNormalBias(),this._updateUseLightProbe(),this._updateBakeToReflectionProbe(),this._updateUseReflectionProbe(),this._updateReceiveDirLight(),this._updateStandardSkin()},e.onEnable=function(){t.prototype.onEnable.call(this),this.node.on(Dg.MOBILITY_CHANGED,this.onMobilityChanged,this),this.node.on(Dg.LIGHT_PROBE_BAKING_CHANGED,this.onLightProbeBakingChanged,this),this.bakeSettings.on(kV.USE_LIGHT_PROBE_CHANGED,this.onUseLightProbeChanged,this),this.bakeSettings.on(kV.REFLECTION_PROBE_CHANGED,this.onReflectionProbeChanged,this),this.bakeSettings.on(kV.BAKE_TO_REFLECTION_PROBE_CHANGED,this.onBakeToReflectionProbeChanged,this),this._model||this._updateModels(),this._model.onGlobalPipelineStateChanged(),this._updateCastShadow(),this._updateReceiveShadow(),this._updateShadowBias(),this._updateShadowNormalBias(),this._updateBakeToReflectionProbe(),this._updateUseReflectionProbe(),this._onUpdateLocalShadowBiasAndProbeId(),this._updateUseLightProbe(),this._updateReceiveDirLight(),this._onUpdateReflectionProbeDataMap(),this._onUpdateLocalReflectionProbeData(),this._updateStandardSkin(),this._attachToScene()},e.onDisable=function(){this._model&&this._detachFromScene(),this.node.off(Dg.MOBILITY_CHANGED,this.onMobilityChanged,this),this.node.off(Dg.LIGHT_PROBE_BAKING_CHANGED,this.onLightProbeBakingChanged,this),this.bakeSettings.off(kV.USE_LIGHT_PROBE_CHANGED,this.onUseLightProbeChanged,this),this.bakeSettings.off(kV.REFLECTION_PROBE_CHANGED,this.onReflectionProbeChanged,this),this.bakeSettings.off(kV.BAKE_TO_REFLECTION_PROBE_CHANGED,this.onBakeToReflectionProbeChanged,this)},e.onDestroy=function(){this._model&&(m.director.root.destroyModel(this._model),this._model=null,this._models.length=0),this._morphInstance&&this._morphInstance.destroy()},e.onGeometryChanged=function(){if(this._model&&this._mesh){var t=this._mesh.struct;this._model.createBoundingShape(t.minPosition,t.maxPosition),this._model.updateWorldBound(),this._model.onGeometryChanged()}},e.getWeight=function(t,e){this._subMeshShapesWeights.length;var i=this._subMeshShapesWeights[t];return i.length,i[e]},e.setWeights=function(t,e){var i=this._subMeshShapesWeights;e>=i.length||i[e].length===t.length&&(i[e]=t.slice(0),this._uploadSubMeshShapesWeights(e))},e.setWeight=function(t,e,i){var n=this._subMeshShapesWeights;if(!(e>=n.length)){var r=n[e];i>=r.length||(r[i]=t,this._uploadSubMeshShapesWeights(e))}},e.setInstancedAttribute=function(t,e){if(this.model)for(var i=this.model.subModels,n=0;n<i.length;n++)for(var r=i[n].instancedAttributeBlock,s=r.attributes,o=r.views,a=0;a<s.length;a++)if(s[a].name===t){o[a].set(e);break}},e._updateLightmap=function(t,e,i,n,r){this.bakeSettings.texture=t,this.bakeSettings.uvParam.x=e,this.bakeSettings.uvParam.y=i,this.bakeSettings.uvParam.z=n,this.bakeSettings.uvParam.w=r,this._onUpdateLightingmap(),this._updateReceiveDirLight()},e.updateProbeCubemap=function(t){this.bakeSettings.probeCubemap&&this.bakeSettings.probeCubemap===t||(this.bakeSettings.probeCubemap=t,null!==this.model&&this.model.updateReflectionProbeCubemap(this.bakeSettings.probeCubemap))},e.updateProbeBlendCubemap=function(t){this.bakeSettings.probeBlendCubemap&&this.bakeSettings.probeBlendCubemap===t||(this.bakeSettings.probeBlendCubemap=t,null!==this.model&&this.model.updateReflectionProbeBlendCubemap(this.bakeSettings.probeBlendCubemap))},e.updateProbePlanarMap=function(t){this.bakeSettings.probePlanarmap!==t&&(this.bakeSettings.probePlanarmap=t,null!==this.model&&this.model.updateReflectionProbePlanarMap(this.bakeSettings.probePlanarmap))},e.updateReflectionProbeDataMap=function(t){this._reflectionProbeDataMap=t,null!==this.model&&this.model.updateReflectionProbeDataMap(t)},e.updateReflectionProbeId=function(t){this._reflectionProbeId=t,this.model&&(this.model.reflectionProbeId=t),this._onUpdateLocalShadowBiasAndProbeId()},e.updateReflectionProbeBlendId=function(t){this._reflectionProbeBlendId=t,this.model&&(this.model.reflectionProbeBlendId=t),this._onUpdateLocalShadowBiasAndProbeId()},e.updateReflectionProbeBlendWeight=function(t){this._reflectionProbeBlendWeight=t,this.model&&(this.model.reflectionProbeBlendWeight=t),this._onUpdateLocalReflectionProbeData()},e._updateReflectionProbeTexture=function(){if(this.model){var t=this.bakeSettings,e=t.reflectionProbe,i=t.probeBlendCubemap,n=t.probePlanarmap,r=t.probeCubemap;e===pI.BAKED_CUBEMAP?(this.model.updateReflectionProbeCubemap(r),this.model.updateReflectionProbePlanarMap(null),this.model.updateReflectionProbeBlendCubemap(null)):e===pI.BLEND_PROBES||e===pI.BLEND_PROBES_AND_SKYBOX?(this.model.updateReflectionProbeCubemap(r),this.model.updateReflectionProbeBlendCubemap(i),this.model.updateReflectionProbePlanarMap(null)):e===pI.PLANAR_REFLECTION?(this.model.updateReflectionProbePlanarMap(n),this.model.updateReflectionProbeCubemap(null),this.model.updateReflectionProbeBlendCubemap(null)):(this.model.updateReflectionProbeCubemap(null),this.model.updateReflectionProbePlanarMap(null),this.model.updateReflectionProbeBlendCubemap(null))}},e._updateModels=function(){if(this.enabledInHierarchy){var t=this._model;if(t?(t.destroy(),t.initialize(),t.node=t.transform=this.node):this._createModel(),this._model){if(this._mesh){var e=this._mesh.struct;this._model.createBoundingShape(e.minPosition,e.maxPosition),this._model.updateWorldBound()}this._model.initLightingmap(this.bakeSettings.texture,this.bakeSettings.uvParam),this._updateUseLightProbe(),this._updateUseReflectionProbeType(),this._updateModelParams(),this._onUpdateLightingmap(),this._onUpdateLocalShadowBiasAndProbeId(),this._updateUseReflectionProbe(),this._updateReceiveDirLight(),this._onUpdateReflectionProbeDataMap(),this._onUpdateLocalReflectionProbeData()}}},e._updateReceiveDirLight=function(){if(this._model){var t=this.node.scene;if(t&&t.renderScene){var e=t.renderScene.mainLight;if(e){var i=e.visibility;if(e.node)if(e.node.mobility===Kg.Static){var n=!1;this.bakeSettings.texture&&!this.node.scene.globals.disableLightmap&&(n=!0),this.node.scene.globals.lightProbeInfo.data&&this.node.scene.globals.lightProbeInfo.data.hasCoefficients()&&this._model.useLightProbe&&(n=!0),this.onUpdateReceiveDirLight(i,n)}else this.onUpdateReceiveDirLight(i)}}}},e._createModel=function(){var t=this._morphInstance&&this._modelType===II?TV:this._modelType,e=this._model=m.director.root.createModel(t);e.visFlags=this.visibility,e.node=e.transform=this.node,this._models.length=0,this._models.push(this._model),this._morphInstance&&e instanceof TV&&e.setMorphRendering(this._morphInstance)},e._attachToScene=function(){if(this.node.scene&&this._model){var t=this._getRenderScene();null!==this._model.scene&&this._detachFromScene(),t.addModel(this._model)}},e._detachFromScene=function(){this._model&&this._model.scene&&this._model.scene.removeModel(this._model)},e._updateModelParams=function(){if(this._mesh&&this._model){this.node.hasChangedFlags|=Ig.POSITION,this._model.transform.hasChangedFlags|=Ig.POSITION,this._model.isDynamicBatching=this._isBatchingEnabled();var t=this._mesh?this._mesh.renderingSubMeshes.length:0,e=this._mesh.renderingSubMeshes;if(e)for(var i=0;i<t;++i){var n=this.getRenderMaterial(i);n&&!n.isValid&&(n=null);var r=e[i];r&&this._model.initSubModel(i,r,n||this._getBuiltinMaterial())}this._model.enabled=!0}},e._onUpdateLightingmap=function(){null!==this.model&&this.model.updateLightingmap(this.bakeSettings.texture,this.bakeSettings.uvParam),this.setInstancedAttribute("a_lightingMapUVParam",[this.bakeSettings.uvParam.x,this.bakeSettings.uvParam.y,this.bakeSettings.uvParam.z,this.bakeSettings.uvParam.w])},e._onUpdateLocalShadowBiasAndProbeId=function(){null!==this.model&&(this.model.updateLocalShadowBias(),this.model.updateReflectionProbeId()),this.setInstancedAttribute("a_localShadowBiasAndProbeId",[this._shadowBias,this._shadowNormalBias,this._reflectionProbeId,this._reflectionProbeBlendId])},e._onUpdateLocalReflectionProbeData=function(){this.bakeSettings.reflectionProbe!==pI.BAKED_CUBEMAP&&this.bakeSettings.reflectionProbe!==pI.BLEND_PROBES&&this.bakeSettings.reflectionProbe!==pI.BLEND_PROBES_AND_SKYBOX||(null!==this.model&&this.model.updateReflectionProbeId(),this.setInstancedAttribute("a_reflectionProbeData",[this._reflectionProbeBlendWeight,0,0,0]))},e._onUpdateReflectionProbeDataMap=function(){null!==this.model&&this.model.updateReflectionProbeDataMap(this._reflectionProbeDataMap)},e._onMaterialModified=function(t,e){this._model&&this._model.inited&&(this._onRebuildPSO(t,e||this._getBuiltinMaterial()),this._updateStandardSkin())},e._onRebuildPSO=function(t,e){this._model&&this._model.inited&&(this._model.isDynamicBatching=this._isBatchingEnabled(),this._model.setSubModelMaterial(t,e),this._onUpdateLightingmap(),this._onUpdateLocalShadowBiasAndProbeId(),this._updateReflectionProbeTexture(),this._onUpdateReflectionProbeDataMap(),this._onUpdateLocalReflectionProbeData())},e._onMeshChanged=function(){},e._clearMaterials=function(){if(this._model)for(var t=this._model.subModels,e=0;e<t.length;++e)this._onMaterialModified(e,null)},e._getBuiltinMaterial=function(){return NE.get("missing-material")},e._onVisibilityChange=function(t){this._model&&(this._model.visFlags=t)},e._updateShadowBias=function(){this._model&&(this._model.shadowBias=this._shadowBias)},e._updateShadowNormalBias=function(){this._model&&(this._model.shadowNormalBias=this._shadowNormalBias)},e._updateCastShadow=function(){this._model&&(this._shadowCastingMode===BV.OFF?this._model.castShadow=!1:(this._shadowCastingMode,BV.ON,this._shadowCastingMode,this._model.castShadow=!0))},e._updateReceiveShadow=function(){this._model&&(this._shadowReceivingMode===FV.OFF?this._model.receiveShadow=!1:this._model.receiveShadow=!0)},e.onMobilityChanged=function(){this._updateUseLightProbe(),this._updateReceiveDirLight()},e.onLightProbeBakingChanged=function(){this._updateReceiveDirLight()},e.onUseLightProbeChanged=function(){this._updateUseLightProbe()},e.onReflectionProbeChanged=function(){this._updateUseReflectionProbe(),this._onUpdateLocalShadowBiasAndProbeId(),this.bakeSettings.reflectionProbe===pI.BAKED_CUBEMAP||this.bakeSettings.reflectionProbe===pI.BLEND_PROBES||this.bakeSettings.reflectionProbe===pI.BLEND_PROBES_AND_SKYBOX?(m.internal.reflectionProbeManager.selectReflectionProbe(this._model),m.internal.reflectionProbeManager.getUsedReflectionProbe(this._model,!1)||q(16302)):this.bakeSettings.reflectionProbe===pI.PLANAR_REFLECTION&&(m.internal.reflectionProbeManager.selectPlanarReflectionProbe(this._model),m.internal.reflectionProbeManager.getUsedReflectionProbe(this._model,!0)||q(16302))},e.onBakeToReflectionProbeChanged=function(){this._updateBakeToReflectionProbe()},e._updateUseLightProbe=function(){if(this._model){var t=this.node;this._mesh&&t&&t.mobility===Kg.Movable&&this.bakeSettings.useLightProbe?this._model.useLightProbe=!0:this._model.useLightProbe=!1}},e._isBatchingEnabled=function(){for(var t=0;t<this._materials.length;++t){var e=this._materials[t];if(e)for(var i=0;i<e.passes.length;++i)if(e.passes[i].batchingScheme)return!0}return!1},e._updateUseReflectionProbe=function(){this._model&&(this._model.reflectionProbeType=this.bakeSettings.reflectionProbe,this._updateReflectionProbeTexture())},e._updateUseReflectionProbeType=function(){this._model&&(this._model.reflectionProbeType=this.bakeSettings.reflectionProbe)},e._updateBakeToReflectionProbe=function(){this._model&&(this._model.bakeToReflectionProbe=this.bakeSettings.bakeToReflectionProbe)},e._watchMorphInMesh=function(){if(this._morphInstance&&(this._morphInstance.destroy(),this._morphInstance=null),this._enableMorph&&this._mesh&&this._mesh.struct.morph&&this._mesh.morphRendering){this._morphInstance=this._mesh.morphRendering.createInstance();for(var t=this._mesh.struct.primitives.length,e=0;e<t;++e)this._uploadSubMeshShapesWeights(e);this._model&&this._model instanceof TV&&this._model.setMorphRendering(this._morphInstance)}},e._initSubMeshShapesWeights=function(){var t=this._mesh;if(this._subMeshShapesWeights.length=0,t){var e=t.struct.morph;if(e){var i=e.weights;this._subMeshShapesWeights=e.subMeshMorphs.map((function(t){return t?t.weights?t.weights.slice(0):i?(i.length,t.targets.length,i.slice(0)):new Array(t.targets.length).fill(0):[]}))}}},e._validateShapeWeights=function(){var t=this._mesh,e=this._subMeshShapesWeights;if(!t||!t.struct.morph)return 0===e.length;var i=t.struct.morph;return i.subMeshMorphs.length===e.length&&e.every((function(t,e){var n,r,s=t.length;return(null!==(n=null===(r=i.subMeshMorphs[e])||void 0===r?void 0:r.targets.length)&&void 0!==n?n:0)===s}))},e._uploadSubMeshShapesWeights=function(t){var e;null===(e=this._morphInstance)||void 0===e||e.setWeights(t,this._subMeshShapesWeights[t])},e._updateStandardSkin=function(){var t=m.director.root.pipeline.pipelineSceneData;if(this._enabledGlobalStandardSkinObject&&(t.standardSkinMeshRenderer=this,t.standardSkinModel=this.model),!t.skinMaterialModel&&this._model)for(var e=this._model.subModels,i=0;i<e.length;i++)if(!(wV(e[i])<0))return void(t.skinMaterialModel=this._model)},n(i,[{key:"shadowBias",get:function(){return this._shadowBias},set:function(t){this._shadowBias=t,this._updateShadowBias(),this._onUpdateLocalShadowBiasAndProbeId()}},{key:"shadowNormalBias",get:function(){return this._shadowNormalBias},set:function(t){this._shadowNormalBias=t,this._updateShadowNormalBias(),this._onUpdateLocalShadowBiasAndProbeId()}},{key:"shadowCastingMode",get:function(){return this._shadowCastingMode},set:function(t){this._shadowCastingMode=t,this._updateCastShadow()}},{key:"shadowCastingModeForInspector",get:function(){return this.shadowCastingMode===BV.ON},set:function(t){this.shadowCastingMode=!0===t?BV.ON:BV.OFF}},{key:"receiveShadow",get:function(){return this._shadowReceivingMode},set:function(t){this._shadowReceivingMode=t,this._updateReceiveShadow()}},{key:"receiveShadowForInspector",get:function(){return this._shadowReceivingMode===FV.ON},set:function(t){this._shadowReceivingMode=!0===t?FV.ON:FV.OFF,this._updateReceiveShadow()}},{key:"mesh",get:function(){return this._mesh},set:function(t){var e=this._mesh,i=this._mesh=t;null==i||i.initialize(),this._initSubMeshShapesWeights(),this._watchMorphInMesh(),this._onMeshChanged(e),this._updateModels(),this.enabledInHierarchy&&this._attachToScene(),this._updateCastShadow(),this._updateReceiveShadow(),this._updateUseLightProbe(),this._updateUseReflectionProbe(),this._updateReceiveDirLight()}},{key:"model",get:function(){return this._model}},{key:"enableMorph",get:function(){return this._enableMorph},set:function(t){this._enableMorph=t}},{key:"isGlobalStandardSkinObject",get:function(){return this._enabledGlobalStandardSkinObject},set:function(t){m.director.root.pipeline.pipelineSceneData.standardSkinMeshRenderer=t?this:null,this._enabledGlobalStandardSkinObject=t}}]),i}(lU)).ShadowCastingMode=BV,yV.ShadowReceivingMode=FV,hV=ua((aV=yV).prototype,"bakeSettings",[CV],(function(){return new kV})),uV=ua(aV.prototype,"_mesh",[CV],(function(){return null})),cV=ua(aV.prototype,"_shadowCastingMode",[CV],(function(){return BV.OFF})),lV=ua(aV.prototype,"_shadowReceivingMode",[CV],(function(){return FV.ON})),_V=ua(aV.prototype,"_shadowBias",[CV],(function(){return 0})),dV=ua(aV.prototype,"_shadowNormalBias",[CV],(function(){return 0})),fV=ua(aV.prototype,"_reflectionProbeId",[CV],(function(){return-1})),pV=ua(aV.prototype,"_reflectionProbeBlendId",[CV],(function(){return-1})),gV=ua(aV.prototype,"_reflectionProbeBlendWeight",[CV],(function(){return 0})),mV=ua(aV.prototype,"_enabledGlobalStandardSkinObject",[CV],(function(){return!1})),f(aV.prototype,"shadowBias",[tV],Object.getOwnPropertyDescriptor(aV.prototype,"shadowBias"),aV.prototype),f(aV.prototype,"shadowNormalBias",[eV],Object.getOwnPropertyDescriptor(aV.prototype,"shadowNormalBias"),aV.prototype),f(aV.prototype,"shadowCastingMode",[iV],Object.getOwnPropertyDescriptor(aV.prototype,"shadowCastingMode"),aV.prototype),f(aV.prototype,"receiveShadow",[nV],Object.getOwnPropertyDescriptor(aV.prototype,"receiveShadow"),aV.prototype),f(aV.prototype,"mesh",[rV],Object.getOwnPropertyDescriptor(aV.prototype,"mesh"),aV.prototype),f(aV.prototype,"isGlobalStandardSkinObject",[sV],Object.getOwnPropertyDescriptor(aV.prototype,"isGlobalStandardSkinObject"),aV.prototype),vV=ua(aV.prototype,"_enableMorph",[CV],(function(){return!0})),oV=aV))||oV)||oV);function GV(t,e){var i=t.sharedMaterials.length;if(i!==e.sharedMaterials.length)return!1;for(var n=0;n<i;n++)if(t.getRenderMaterial(n)!==e.getRenderMaterial(n))return!1;return!0}t({MeshRenderer:UV,ModelComponent:UV}),t("BatchingUtility",function(){function t(){}return t.batchStaticModel=function(t,e){var i=t.getComponentsInChildren(UV);if(i.length<2)return console.error("the number of static models to batch is less than 2,it needn't batch."),!1;for(var n=1;n<i.length;n++){if(!i[0].mesh.validateMergingMesh(i[n].mesh))return console.error("the meshes of "+i[0].node.name+" and "+i[n].node.name+" can't be merged"),!1;if(!GV(i[0],i[n]))return console.error("the materials of "+i[0].node.name+" and "+i[n].node.name+" can't be merged"),!1}var r=new ZO,s=new Ln,o=new Ln;t.getWorldMatrix(o),Ln.invert(o,o);for(var a=0;a<i.length;a++){var h=i[a];h.node.getWorldMatrix(s),Ln.multiply(s,o,s),r.merge(i[a].mesh,s),h.enabled=!1}var u=e.addComponent(UV);return u.mesh=r,u.sharedMaterials=i[0].sharedMaterials,!0},t.unbatchStaticModel=function(t,e){for(var i=t.getComponentsInChildren(UV),n=0;n<i.length;n++)i[n].enabled=!0;var r=e.getComponent(UV);return r&&(r.mesh&&r.mesh.destroyRenderingMesh(),r.destroy()),!0},t}()),rt(ZO.prototype,"Mesh.prototype",[{name:"renderingMesh",newName:"renderingSubMeshes"}]),st(ZO.prototype,"Mesh.prototype",[{name:"hasFlatBuffers"},{name:"destroyFlatBuffers"}]);var HV,zV,VV,WV,XV,jV,YV,KV,qV,QV,ZV,JV,$V,tW,eW,iW,nW=t("Skeleton",(IV=va("cc.Skeleton"),xV=Za([ti]),DV=Za([Ln]),IV((PV=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)._joints=MV&&MV(),e._bindposes=NV&&NV(),e._hash=LV&&LV(),e._invBindposes=null,e}s(e,t);var i=e.prototype;return i.destroy=function(){var e,i;return null===(e=m.director.root)||void 0===e||null===(i=e.dataPoolManager)||void 0===i||i.releaseSkeleton(this),t.prototype.destroy.call(this)},i.validate=function(){return this.joints.length>0&&this.bindposes.length>0},n(e,[{key:"joints",get:function(){return this._joints},set:function(t){this._joints=t}},{key:"bindposes",get:function(){return this._bindposes},set:function(t){this._bindposes=t}},{key:"inverseBindposes",get:function(){if(!this._invBindposes){this._invBindposes=[];for(var t=0;t<this._bindposes.length;t++){var e=new Ln;Ln.invert(e,this._bindposes[t]),this._invBindposes.push(e)}}return this._invBindposes}},{key:"hash",get:function(){if(!this._hash){for(var t="",e=0;e<this._bindposes.length;e++){var i=this._bindposes[e];t+=i.m00.toPrecision(2)+" "+i.m01.toPrecision(2)+" "+i.m02.toPrecision(2)+" "+i.m03.toPrecision(2)+" "+i.m04.toPrecision(2)+" "+i.m05.toPrecision(2)+" "+i.m06.toPrecision(2)+" "+i.m07.toPrecision(2)+" "+i.m08.toPrecision(2)+" "+i.m09.toPrecision(2)+" "+i.m10.toPrecision(2)+" "+i.m11.toPrecision(2)+" "+i.m12.toPrecision(2)+" "+i.m13.toPrecision(2)+" "+i.m14.toPrecision(2)+" "+i.m15.toPrecision(2)+"\n"}this._hash=nl(t,666)}return this._hash}}]),e}(Of),MV=ua(PV.prototype,"_joints",[xV],(function(){return[]})),NV=ua(PV.prototype,"_bindposes",[DV],(function(){return[]})),LV=ua(PV.prototype,"_hash",[wa],(function(){return 0})),OV=PV))||OV));m.Skeleton=nW,st(UV.prototype,"MeshRenderer.prototype",[{name:"enableDynamicBatching"},{name:"recieveShadows"}]),m.ModelComponent=UV,Jt(UV,"cc.ModelComponent");var rW,sW,oW,aW,hW,uW,cW,lW,_W,dW,fW,pW,gW,mW,vW,yW,TW,EW,SW,AW,bW,CW,RW,wW,IW,xW,DW,OW,PW,MW,NW,LW,BW,FW,kW,UW,GW,HW,zW,VW,WW,XW,jW,YW,KW,qW,QW,ZW,JW,$W,tX,eX,iX,nX,rX,sX,oX,aX,hX,uX,cX=new _n,lX=ye({LUMINOUS_FLUX:0,LUMINANCE:1}),_X=va("cc.StaticLightSettings")((zV=function(){function t(){this._baked=VV&&VV(),this._editorOnly=WV&&WV(),this._castShadow=XV&&XV()}return n(t,[{key:"editorOnly",get:function(){return this._editorOnly},set:function(t){this._editorOnly=t}},{key:"baked",get:function(){return this._baked},set:function(t){this._baked=t}},{key:"castShadow",get:function(){return this._castShadow},set:function(t){this._castShadow=t}}]),t}(),VV=ua(zV.prototype,"_baked",[wa],(function(){return!1})),WV=ua(zV.prototype,"_editorOnly",[wa],(function(){return!1})),XV=ua(zV.prototype,"_castShadow",[wa],(function(){return!1})),HV=zV))||HV,dX=(jV=va("cc.Light"),YV=Za(_X),KV=Za(Rg.BitMask),jV(((iW=function(t){function e(){var e;return(e=t.call(this)||this)._color=ZV&&ZV(),e._useColorTemperature=JV&&JV(),e._colorTemperature=$V&&$V(),e._staticSettings=tW&&tW(),e._visibility=eW&&eW(),e._type=CI.UNKNOWN,e._lightType=void 0,e._light=null,e._lightType=LI,e}s(e,t);var i=e.prototype;return i.onLoad=function(){this._createLight()},i.onEnable=function(){this._attachToScene()},i.onDisable=function(){this._detachFromScene()},i.onDestroy=function(){this._destroyLight()},i._createLight=function(){this._light||(this._light=m.director.root.createLight(this._lightType)),this.color=this._color,this.useColorTemperature=this._useColorTemperature,this.colorTemperature=this._colorTemperature,this._light.node=this.node,this._light.baked=this.baked,this._light.visibility=this.visibility},i._destroyLight=function(){this._light&&(m.director.root.recycleLight(this._light),this._light=null)},i._attachToScene=function(){if(this._detachFromScene(),this._light&&!this._light.scene&&this.node.scene){var t=this._getRenderScene();switch(this._type){case CI.DIRECTIONAL:t.addDirectionalLight(this._light),t.setMainLight(this._light);break;case CI.SPHERE:t.addSphereLight(this._light);break;case CI.SPOT:t.addSpotLight(this._light);break;case CI.POINT:t.addPointLight(this._light);break;case CI.RANGED_DIRECTIONAL:t.addRangedDirLight(this._light)}}},i._detachFromScene=function(){if(this._light&&this._light.scene){var t=this._light.scene;switch(this._type){case CI.DIRECTIONAL:t.removeDirectionalLight(this._light),t.unsetMainLight(this._light);break;case CI.SPHERE:t.removeSphereLight(this._light);break;case CI.SPOT:t.removeSpotLight(this._light);break;case CI.POINT:t.removePointLight(this._light);break;case CI.RANGED_DIRECTIONAL:t.removeRangedDirLight(this._light)}}},i._onUpdateReceiveDirLight=function(){},n(e,[{key:"color",get:function(){return this._color},set:function(t){this._color=t.clone(),this._light&&(cX.x=t.r/255,cX.y=t.g/255,cX.z=t.b/255,this._light.color=cX)}},{key:"useColorTemperature",get:function(){return this._useColorTemperature},set:function(t){this._useColorTemperature=t,this._light&&(this._light.useColorTemperature=t)}},{key:"colorTemperature",get:function(){return this._colorTemperature},set:function(t){this._colorTemperature=t,this._light&&(this._light.colorTemperature=t)}},{key:"staticSettings",get:function(){return this._staticSettings},set:function(t){this._staticSettings=t}},{key:"type",get:function(){return this._type}},{key:"baked",get:function(){return this.staticSettings.baked},set:function(t){this.staticSettings.baked=t,null!==this._light&&(this._light.baked=t)}},{key:"visibility",get:function(){return this._visibility},set:function(t){this._visibility=t,this._light&&(this._light.visibility=t),this._onUpdateReceiveDirLight()}}]),e}(xp)).Type=CI,iW.PhotometricTerm=lX,ZV=ua((QV=iW).prototype,"_color",[wa],(function(){return yn.WHITE.clone()})),JV=ua(QV.prototype,"_useColorTemperature",[wa],(function(){return!1})),$V=ua(QV.prototype,"_colorTemperature",[wa],(function(){return 6550})),tW=ua(QV.prototype,"_staticSettings",[wa],(function(){return new _X})),eW=ua(QV.prototype,"_visibility",[wa],(function(){return my})),f(QV.prototype,"staticSettings",[YV],Object.getOwnPropertyDescriptor(QV.prototype,"staticSettings"),QV.prototype),f(QV.prototype,"visibility",[KV],Object.getOwnPropertyDescriptor(QV.prototype,"visibility"),QV.prototype),qV=QV))||qV);t({Light:dX,LightComponent:dX});var fX,pX,gX,mX,vX,yX,TX,EX,SX,AX,bX,CX,RX,wX,IX=Sa,xX=wa,DX=Ia,OX=Za,PX=(rW=va("cc.DirectionalLight"),sW=DX("_illuminance"),oW=OX(Ze),aW=IX({group:{name:"DynamicShadowSettings",displayOrder:1}}),hW=OX($e),uW=IX({group:{name:"DynamicShadowSettings",displayOrder:5}}),cW=OX(iS),lW=IX({group:{name:"DynamicShadowSettings",displayOrder:6}}),_W=OX(Je),dW=IX({group:{name:"DynamicShadowSettings",displayOrder:7}}),fW=OX(Je),pW=IX({group:{name:"DynamicShadowSettings",displayOrder:8}}),gW=OX(Je),mW=IX({group:{name:"DynamicShadowSettings",displayOrder:9}}),vW=OX(Je),yW=IX({group:{name:"DynamicShadowSettings",displayOrder:22}}),TW=OX(Je),EW=IX({group:{name:"DynamicShadowSettings",displayOrder:10}}),SW=OX(nS),AW=IX({group:{name:"DynamicShadowSettings",displayOrder:11}}),bW=OX($e),CW=IX({group:{name:"DynamicShadowSettings",displayOrder:12}}),RW=OX(Je),wW=IX({group:{name:"DynamicShadowSettings",displayOrder:13}}),IW=OX(rS),xW=IX({group:{name:"DynamicShadowSettings",displayOrder:14}}),DW=OX($e),OW=IX({group:{name:"DynamicShadowSettings",displayOrder:15}}),PW=OX(Je),MW=IX({group:{name:"DynamicShadowSettings",displayOrder:16}}),NW=OX(Je),LW=IX({group:{name:"DynamicShadowSettings",displayOrder:17}}),BW=OX(Je),FW=IX({group:{name:"DynamicShadowSettings",displayOrder:19}}),kW=OX($e),UW=IX({group:{name:"DynamicShadowSettings",displayOrder:20}}),GW=OX($e),HW=IX({group:{name:"DynamicShadowSettings",displayOrder:21}}),zW=OX(Je),rW((WW=function(t){function e(){var e;return(e=t.call(this)||this)._illuminanceHDR=XW&&XW(),e._illuminanceLDR=jW&&jW(),e._shadowEnabled=YW&&YW(),e._shadowPcf=KW&&KW(),e._shadowBias=qW&&qW(),e._shadowNormalBias=QW&&QW(),e._shadowSaturation=ZW&&ZW(),e._shadowDistance=JW&&JW(),e._shadowInvisibleOcclusionRange=$W&&$W(),e._csmLevel=tX&&tX(),e._csmLayerLambda=eX&&eX(),e._csmOptimizationMode=iX&&iX(),e._csmAdvancedOptions=nX&&nX(),e._csmLayersTransition=rX&&rX(),e._csmTransitionRange=sX&&sX(),e._shadowFixedArea=oX&&oX(),e._shadowNear=aX&&aX(),e._shadowFar=hX&&hX(),e._shadowOrthoSize=uX&&uX(),e._lightType=kI,we.querySettings(Ce.Category.RENDERING,"highQualityMode")&&(e._shadowPcf=iS.SOFT_2X,e._shadowDistance=50,e.enableCSM=!0,e.staticSettings.castShadow=!0),e}s(e,t);var i=e.prototype;return i._createLight=function(){if(t.prototype._createLight.call(this),this._type=CI.DIRECTIONAL,this._light){var e=this._light;e.illuminanceHDR=this._illuminanceHDR,e.illuminanceLDR=this._illuminanceLDR,e.shadowEnabled=this._shadowEnabled,e.shadowPcf=this._shadowPcf,e.shadowBias=this._shadowBias,e.shadowNormalBias=this._shadowNormalBias,e.shadowSaturation=this._shadowSaturation,e.shadowDistance=this._shadowDistance,e.shadowInvisibleOcclusionRange=this._shadowInvisibleOcclusionRange,e.shadowFixedArea=this._shadowFixedArea,e.shadowNear=this._shadowNear,e.shadowFar=this._shadowFar,e.shadowOrthoSize=this._shadowOrthoSize,e.csmLevel=this._csmLevel,e.csmLayerLambda=this._csmLayerLambda,e.csmOptimizationMode=this._csmOptimizationMode,e.csmLayersTransition=this._csmLayersTransition,e.csmTransitionRange=this._csmTransitionRange}},i._onUpdateReceiveDirLight=function(){if(this._light){t.prototype._onUpdateReceiveDirLight.call(this);var e=this.node.scene;if(e&&e.renderScene&&e.renderScene.mainLight===this._light)for(var i=e.renderScene.models,n=0;n<i.length;n++){var r=i[n];if(r.node){var s=r.node.getComponent(UV);s&&s.onUpdateReceiveDirLight(this._visibility)}}}},n(e,[{key:"illuminance",get:function(){return m.director.root.pipeline.pipelineSceneData.isHDR?this._illuminanceHDR:this._illuminanceLDR},set:function(t){m.director.root.pipeline.pipelineSceneData.isHDR?(this._illuminanceHDR=t,this._light&&(this._light.illuminanceHDR=this._illuminanceHDR)):(this._illuminanceLDR=t,this._light&&(this._light.illuminanceLDR=this._illuminanceLDR))}},{key:"shadowEnabled",get:function(){return this._shadowEnabled},set:function(t){this._shadowEnabled=t,this._light&&(this._light.shadowEnabled=this._shadowEnabled)}},{key:"shadowPcf",get:function(){return this._shadowPcf},set:function(t){this._shadowPcf=t,this._light&&(this._light.shadowPcf=this._shadowPcf)}},{key:"shadowBias",get:function(){return this._shadowBias},set:function(t){this._shadowBias=t,this._light&&(this._light.shadowBias=this._shadowBias)}},{key:"shadowNormalBias",get:function(){return this._shadowNormalBias},set:function(t){this._shadowNormalBias=t,this._light&&(this._light.shadowNormalBias=this._shadowNormalBias)}},{key:"shadowSaturation",get:function(){return this._shadowSaturation},set:function(t){this._shadowSaturation=Pi(t,0,1),this._light&&(this._light.shadowSaturation=this._shadowSaturation)}},{key:"shadowDistance",get:function(){return this._shadowDistance},set:function(t){this._shadowDistance=Math.min(t,oS.MAX_FAR),this._shadowDistance/.1<10&&q(15003,this._shadowDistance),this._light&&(this._light.shadowDistance=this._shadowDistance,this._light.csmNeedUpdate=!0)}},{key:"shadowInvisibleOcclusionRange",get:function(){return this._shadowInvisibleOcclusionRange},set:function(t){this._shadowInvisibleOcclusionRange=Math.min(t,oS.MAX_FAR),this._light&&(this._light.shadowInvisibleOcclusionRange=this._shadowInvisibleOcclusionRange)}},{key:"csmLevel",get:function(){return this._csmLevel},set:function(t){this._csmLevel=t,this._light&&(this._light.csmLevel=this._csmLevel,this._light.csmNeedUpdate=!0)}},{key:"enableCSM",get:function(){return this._csmLevel>nS.LEVEL_1},set:function(t){this._csmLevel=t?nS.LEVEL_4:nS.LEVEL_1,this._light&&(this._light.csmLevel=this._csmLevel,this._light.csmNeedUpdate=!0)}},{key:"csmLayerLambda",get:function(){return this._csmLayerLambda},set:function(t){this._csmLayerLambda=t,this._light&&(this._light.csmLayerLambda=this._csmLayerLambda,this._light.csmNeedUpdate=!0)}},{key:"csmOptimizationMode",get:function(){return this._csmOptimizationMode},set:function(t){this._csmOptimizationMode=t,this._light&&(this._light.csmOptimizationMode=this._csmOptimizationMode)}},{key:"shadowFixedArea",get:function(){return this._shadowFixedArea},set:function(t){this._shadowFixedArea=t,this._light&&(this._light.shadowFixedArea=this._shadowFixedArea)}},{key:"shadowNear",get:function(){return this._shadowNear},set:function(t){this._shadowNear=t,this._light&&(this._light.shadowNear=this._shadowNear)}},{key:"shadowFar",get:function(){return this._shadowFar},set:function(t){this._shadowFar=Math.min(t,oS.MAX_FAR),this._light&&(this._light.shadowFar=this._shadowFar)}},{key:"shadowOrthoSize",get:function(){return this._shadowOrthoSize},set:function(t){this._shadowOrthoSize=t,this._light&&(this._light.shadowOrthoSize=this._shadowOrthoSize)}},{key:"csmAdvancedOptions",get:function(){return this._csmAdvancedOptions},set:function(t){this._csmAdvancedOptions=t}},{key:"csmLayersTransition",get:function(){return this._csmLayersTransition},set:function(t){this._csmLayersTransition=t,this._light&&(this._light.csmLayersTransition=t)}},{key:"csmTransitionRange",get:function(){return this._csmTransitionRange},set:function(t){this._csmTransitionRange=t,this._light&&(this._light.csmTransitionRange=t)}}]),e}(dX),XW=ua(WW.prototype,"_illuminanceHDR",[IX,sW],(function(){return 65e3})),jW=ua(WW.prototype,"_illuminanceLDR",[xX],(function(){return 65e3*sI.standardExposureValue})),YW=ua(WW.prototype,"_shadowEnabled",[xX],(function(){return!1})),KW=ua(WW.prototype,"_shadowPcf",[xX],(function(){return iS.HARD})),qW=ua(WW.prototype,"_shadowBias",[xX],(function(){return 1e-5})),QW=ua(WW.prototype,"_shadowNormalBias",[xX],(function(){return 0})),ZW=ua(WW.prototype,"_shadowSaturation",[xX],(function(){return 1})),JW=ua(WW.prototype,"_shadowDistance",[xX],(function(){return 50})),$W=ua(WW.prototype,"_shadowInvisibleOcclusionRange",[xX],(function(){return 200})),tX=ua(WW.prototype,"_csmLevel",[xX],(function(){return nS.LEVEL_4})),eX=ua(WW.prototype,"_csmLayerLambda",[xX],(function(){return.75})),iX=ua(WW.prototype,"_csmOptimizationMode",[xX],(function(){return rS.RemoveDuplicates})),nX=ua(WW.prototype,"_csmAdvancedOptions",[xX],(function(){return!1})),rX=ua(WW.prototype,"_csmLayersTransition",[xX],(function(){return!1})),sX=ua(WW.prototype,"_csmTransitionRange",[xX],(function(){return.05})),oX=ua(WW.prototype,"_shadowFixedArea",[xX],(function(){return!1})),aX=ua(WW.prototype,"_shadowNear",[xX],(function(){return.1})),hX=ua(WW.prototype,"_shadowFar",[xX],(function(){return 10})),uX=ua(WW.prototype,"_shadowOrthoSize",[xX],(function(){return 5})),f(WW.prototype,"illuminance",[oW],Object.getOwnPropertyDescriptor(WW.prototype,"illuminance"),WW.prototype),f(WW.prototype,"shadowEnabled",[aW,hW],Object.getOwnPropertyDescriptor(WW.prototype,"shadowEnabled"),WW.prototype),f(WW.prototype,"shadowPcf",[uW,cW],Object.getOwnPropertyDescriptor(WW.prototype,"shadowPcf"),WW.prototype),f(WW.prototype,"shadowBias",[lW,_W],Object.getOwnPropertyDescriptor(WW.prototype,"shadowBias"),WW.prototype),f(WW.prototype,"shadowNormalBias",[dW,fW],Object.getOwnPropertyDescriptor(WW.prototype,"shadowNormalBias"),WW.prototype),f(WW.prototype,"shadowSaturation",[pW,gW],Object.getOwnPropertyDescriptor(WW.prototype,"shadowSaturation"),WW.prototype),f(WW.prototype,"shadowDistance",[mW,vW],Object.getOwnPropertyDescriptor(WW.prototype,"shadowDistance"),WW.prototype),f(WW.prototype,"shadowInvisibleOcclusionRange",[yW,TW],Object.getOwnPropertyDescriptor(WW.prototype,"shadowInvisibleOcclusionRange"),WW.prototype),f(WW.prototype,"csmLevel",[EW,SW],Object.getOwnPropertyDescriptor(WW.prototype,"csmLevel"),WW.prototype),f(WW.prototype,"enableCSM",[AW,bW],Object.getOwnPropertyDescriptor(WW.prototype,"enableCSM"),WW.prototype),f(WW.prototype,"csmLayerLambda",[CW,RW],Object.getOwnPropertyDescriptor(WW.prototype,"csmLayerLambda"),WW.prototype),f(WW.prototype,"csmOptimizationMode",[wW,IW],Object.getOwnPropertyDescriptor(WW.prototype,"csmOptimizationMode"),WW.prototype),f(WW.prototype,"shadowFixedArea",[xW,DW],Object.getOwnPropertyDescriptor(WW.prototype,"shadowFixedArea"),WW.prototype),f(WW.prototype,"shadowNear",[OW,PW],Object.getOwnPropertyDescriptor(WW.prototype,"shadowNear"),WW.prototype),f(WW.prototype,"shadowFar",[MW,NW],Object.getOwnPropertyDescriptor(WW.prototype,"shadowFar"),WW.prototype),f(WW.prototype,"shadowOrthoSize",[LW,BW],Object.getOwnPropertyDescriptor(WW.prototype,"shadowOrthoSize"),WW.prototype),f(WW.prototype,"csmAdvancedOptions",[FW,kW],Object.getOwnPropertyDescriptor(WW.prototype,"csmAdvancedOptions"),WW.prototype),f(WW.prototype,"csmLayersTransition",[UW,GW],Object.getOwnPropertyDescriptor(WW.prototype,"csmLayersTransition"),WW.prototype),f(WW.prototype,"csmTransitionRange",[HW,zW],Object.getOwnPropertyDescriptor(WW.prototype,"csmTransitionRange"),WW.prototype),VW=WW))||VW);t({DirectionalLight:PX,DirectionalLightComponent:PX});var MX,NX,LX,BX,FX,kX,UX,GX,HX,zX,VX,WX,XX,jX,YX,KX,qX,QX,ZX,JX,$X,tj,ej,ij,nj,rj=(fX=va("cc.SphereLight"),pX=Ia("_luminance"),gX=Za(Ze),mX=Za(Ze),vX=Za(lX),yX=Za(Je),TX=Za(Je),fX((SX=function(t){function e(){var e;return(e=t.call(this)||this)._size=AX&&AX(),e._luminanceHDR=bX&&bX(),e._luminanceLDR=CX&&CX(),e._term=RX&&RX(),e._range=wX&&wX(),e._lightType=UI,e}return s(e,t),e.prototype._createLight=function(){t.prototype._createLight.call(this),this._type=CI.SPHERE,this.size=this._size,this.range=this._range,this._light&&(this._light.luminanceHDR=this._luminanceHDR,this._light.luminanceLDR=this._luminanceLDR)},n(e,[{key:"luminousFlux",get:function(){return m.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR*NI(this._size):this._luminanceLDR},set:function(t){var e=0;m.director.root.pipeline.pipelineSceneData.isHDR?(this._luminanceHDR=t/NI(this._size),e=this._luminanceHDR):(this._luminanceLDR=t,e=this._luminanceLDR),this._light&&(this._light.luminance=e)}},{key:"luminance",get:function(){return m.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){m.director.root.pipeline.pipelineSceneData.isHDR?(this._luminanceHDR=t,this._light&&(this._light.luminanceHDR=this._luminanceHDR)):(this._luminanceLDR=t,this._light&&(this._light.luminanceLDR=this._luminanceLDR))}},{key:"term",get:function(){return this._term},set:function(t){this._term=t}},{key:"size",get:function(){return this._size},set:function(t){this._size=t,this._light&&(this._light.size=t)}},{key:"range",get:function(){return this._range},set:function(t){this._range=t,this._light&&(this._light.range=t)}}]),e}(dX),AX=ua(SX.prototype,"_size",[wa],(function(){return.15})),bX=ua(SX.prototype,"_luminanceHDR",[wa,pX],(function(){return 1700/NI(.15)})),CX=ua(SX.prototype,"_luminanceLDR",[wa],(function(){return 1700/NI(.15)*sI.standardExposureValue*sI.standardLightMeterScale})),RX=ua(SX.prototype,"_term",[wa],(function(){return lX.LUMINOUS_FLUX})),wX=ua(SX.prototype,"_range",[wa],(function(){return 1})),f(SX.prototype,"luminousFlux",[gX],Object.getOwnPropertyDescriptor(SX.prototype,"luminousFlux"),SX.prototype),f(SX.prototype,"luminance",[mX],Object.getOwnPropertyDescriptor(SX.prototype,"luminance"),SX.prototype),f(SX.prototype,"term",[vX],Object.getOwnPropertyDescriptor(SX.prototype,"term"),SX.prototype),f(SX.prototype,"size",[yX],Object.getOwnPropertyDescriptor(SX.prototype,"size"),SX.prototype),f(SX.prototype,"range",[TX],Object.getOwnPropertyDescriptor(SX.prototype,"range"),SX.prototype),EX=SX))||EX);t({SphereLight:rj,SphereLightComponent:rj});var sj,oj,aj,hj,uj,cj,lj,_j,dj,fj,pj,gj,mj,vj,yj,Tj,Ej,Sj,Aj,bj=Za,Cj=wa,Rj=Ia,wj=Sa,Ij=(MX=va("cc.SpotLight"),NX=Rj("_luminance"),LX=bj(lX),BX=bj(Je),FX=wj({group:{name:"DynamicShadowSettings",displayOrder:1}}),kX=bj($e),UX=wj({group:{name:"DynamicShadowSettings",displayOrder:2}}),GX=bj(iS),HX=wj({group:{name:"DynamicShadowSettings",displayOrder:3}}),zX=bj(Je),VX=wj({group:{name:"DynamicShadowSettings",displayOrder:4}}),WX=bj(Je),MX((jX=function(t){function e(){var e;return(e=t.call(this)||this)._size=YX&&YX(),e._luminanceHDR=KX&&KX(),e._luminanceLDR=qX&&qX(),e._term=QX&&QX(),e._range=ZX&&ZX(),e._spotAngle=JX&&JX(),e._angleAttenuationStrength=$X&&$X(),e._shadowEnabled=tj&&tj(),e._shadowPcf=ej&&ej(),e._shadowBias=ij&&ij(),e._shadowNormalBias=nj&&nj(),e._lightType=jI,e}return s(e,t),e.prototype._createLight=function(){if(t.prototype._createLight.call(this),this._type=CI.SPOT,this.size=this._size,this.range=this._range,this.spotAngle=this._spotAngle,this.angleAttenuationStrength=this._angleAttenuationStrength,this._light){var e=this._light;e.luminanceHDR=this._luminanceHDR,e.luminanceLDR=this._luminanceLDR,e.shadowEnabled=this._shadowEnabled,e.shadowPcf=this._shadowPcf,e.shadowBias=this._shadowBias,e.shadowNormalBias=this._shadowNormalBias}},n(e,[{key:"luminousFlux",get:function(){return m.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR*NI(this._size):this._luminanceLDR},set:function(t){var e=0;m.director.root.pipeline.pipelineSceneData.isHDR?(this._luminanceHDR=t/NI(this._size),e=this._luminanceHDR):(this._luminanceLDR=t,e=this._luminanceLDR),this._light&&(this._light.luminance=e)}},{key:"luminance",get:function(){return m.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){m.director.root.pipeline.pipelineSceneData.isHDR?(this._luminanceHDR=t,this._light&&(this._light.luminanceHDR=this._luminanceHDR)):(this._luminanceLDR=t,this._light&&(this._light.luminanceLDR=this._luminanceLDR))}},{key:"term",get:function(){return this._term},set:function(t){this._term=t}},{key:"size",get:function(){return this._size},set:function(t){this._size=t,this._light&&(this._light.size=t)}},{key:"range",get:function(){return this._range},set:function(t){this._range=t,this._light&&(this._light.range=t)}},{key:"spotAngle",get:function(){return this._spotAngle},set:function(t){this._spotAngle=t,this._light&&(this._light.spotAngle=Li(t))}},{key:"angleAttenuationStrength",get:function(){return this._angleAttenuationStrength},set:function(t){this._angleAttenuationStrength=t,this._light&&(this._light.angleAttenuationStrength=t)}},{key:"shadowEnabled",get:function(){return this._shadowEnabled},set:function(t){this._shadowEnabled=t,this._light&&(this._light.shadowEnabled=t)}},{key:"shadowPcf",get:function(){return this._shadowPcf},set:function(t){this._shadowPcf=t,this._light&&(this._light.shadowPcf=t)}},{key:"shadowBias",get:function(){return this._shadowBias},set:function(t){this._shadowBias=t,this._light&&(this._light.shadowBias=t)}},{key:"shadowNormalBias",get:function(){return this._shadowNormalBias},set:function(t){this._shadowNormalBias=t,this._light&&(this._light.shadowNormalBias=t)}}]),e}(dX),YX=ua(jX.prototype,"_size",[Cj],(function(){return.15})),KX=ua(jX.prototype,"_luminanceHDR",[Cj,NX],(function(){return 1700/NI(.15)})),qX=ua(jX.prototype,"_luminanceLDR",[Cj],(function(){return 1700/NI(.15)*sI.standardExposureValue*sI.standardLightMeterScale})),QX=ua(jX.prototype,"_term",[Cj],(function(){return lX.LUMINOUS_FLUX})),ZX=ua(jX.prototype,"_range",[Cj],(function(){return 1})),JX=ua(jX.prototype,"_spotAngle",[Cj],(function(){return 60})),$X=ua(jX.prototype,"_angleAttenuationStrength",[Cj],(function(){return 0})),tj=ua(jX.prototype,"_shadowEnabled",[Cj],(function(){return!1})),ej=ua(jX.prototype,"_shadowPcf",[Cj],(function(){return iS.HARD})),ij=ua(jX.prototype,"_shadowBias",[Cj],(function(){return 1e-5})),nj=ua(jX.prototype,"_shadowNormalBias",[Cj],(function(){return 0})),f(jX.prototype,"term",[LX],Object.getOwnPropertyDescriptor(jX.prototype,"term"),jX.prototype),f(jX.prototype,"size",[BX],Object.getOwnPropertyDescriptor(jX.prototype,"size"),jX.prototype),f(jX.prototype,"shadowEnabled",[FX,kX],Object.getOwnPropertyDescriptor(jX.prototype,"shadowEnabled"),jX.prototype),f(jX.prototype,"shadowPcf",[UX,GX],Object.getOwnPropertyDescriptor(jX.prototype,"shadowPcf"),jX.prototype),f(jX.prototype,"shadowBias",[HX,zX],Object.getOwnPropertyDescriptor(jX.prototype,"shadowBias"),jX.prototype),f(jX.prototype,"shadowNormalBias",[VX,WX],Object.getOwnPropertyDescriptor(jX.prototype,"shadowNormalBias"),jX.prototype),XX=jX))||XX);t({SpotLight:Ij,SpotLightComponent:Ij}),t("PointLight",(sj=va("cc.PointLight"),oj=Ia("_luminance"),aj=Za(Ze),hj=Za(Ze),uj=Za(lX),cj=Za(Je),sj((_j=function(t){function e(){var e;return(e=t.call(this)||this)._luminanceHDR=dj&&dj(),e._luminanceLDR=fj&&fj(),e._term=pj&&pj(),e._range=gj&&gj(),e._lightType=YI,e}return s(e,t),e.prototype._createLight=function(){t.prototype._createLight.call(this),this._type=CI.POINT,this.range=this._range,this._light&&(this._light.luminanceHDR=this._luminanceHDR,this._light.luminanceLDR=this._luminanceLDR)},n(e,[{key:"luminousFlux",get:function(){return m.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR*NI(1):this._luminanceLDR},set:function(t){var e=0;m.director.root.pipeline.pipelineSceneData.isHDR?(this._luminanceHDR=t/NI(1),e=this._luminanceHDR):(this._luminanceLDR=t,e=this._luminanceLDR),this._light&&(this._light.luminance=e)}},{key:"luminance",get:function(){return m.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){m.director.root.pipeline.pipelineSceneData.isHDR?(this._luminanceHDR=t,this._light&&(this._light.luminanceHDR=this._luminanceHDR)):(this._luminanceLDR=t,this._light&&(this._light.luminanceLDR=this._luminanceLDR))}},{key:"term",get:function(){return this._term},set:function(t){this._term=t}},{key:"range",get:function(){return this._range},set:function(t){this._range=t,this._light&&(this._light.range=t)}}]),e}(dX),dj=ua(_j.prototype,"_luminanceHDR",[wa,oj],(function(){return 1700/NI(.15)})),fj=ua(_j.prototype,"_luminanceLDR",[wa],(function(){return 1700/NI(.15)*sI.standardExposureValue*sI.standardLightMeterScale})),pj=ua(_j.prototype,"_term",[wa],(function(){return lX.LUMINOUS_FLUX})),gj=ua(_j.prototype,"_range",[wa],(function(){return 1})),f(_j.prototype,"luminousFlux",[aj],Object.getOwnPropertyDescriptor(_j.prototype,"luminousFlux"),_j.prototype),f(_j.prototype,"luminance",[hj],Object.getOwnPropertyDescriptor(_j.prototype,"luminance"),_j.prototype),f(_j.prototype,"term",[uj],Object.getOwnPropertyDescriptor(_j.prototype,"term"),_j.prototype),f(_j.prototype,"range",[cj],Object.getOwnPropertyDescriptor(_j.prototype,"range"),_j.prototype),lj=_j))||lj)),t("RangedDirectionalLight",(mj=va("cc.RangedDirectionalLight"),vj=Ia("_illuminance"),yj=Za(Ze),mj((Ej=function(t){function e(){var e;return(e=t.call(this)||this)._illuminanceHDR=Sj&&Sj(),e._illuminanceLDR=Aj&&Aj(),e._lightType=qI,e}return s(e,t),e.prototype._createLight=function(){t.prototype._createLight.call(this),this._type=CI.RANGED_DIRECTIONAL,this._light&&(this._light.illuminanceHDR=this._illuminanceHDR,this._light.illuminanceLDR=this._illuminanceLDR)},n(e,[{key:"illuminance",get:function(){return m.director.root.pipeline.pipelineSceneData.isHDR?this._illuminanceHDR:this._illuminanceLDR},set:function(t){m.director.root.pipeline.pipelineSceneData.isHDR?(this._illuminanceHDR=t,this._light&&(this._light.illuminanceHDR=this._illuminanceHDR)):(this._illuminanceLDR=t,this._light&&(this._light.illuminanceLDR=this._illuminanceLDR))}}]),e}(dX),Sj=ua(Ej.prototype,"_illuminanceHDR",[Sa,vj],(function(){return 65e3})),Aj=ua(Ej.prototype,"_illuminanceLDR",[wa],(function(){return 65e3*sI.standardExposureValue})),f(Ej.prototype,"illuminance",[yj],Object.getOwnPropertyDescriptor(Ej.prototype,"illuminance"),Ej.prototype),Tj=Ej))||Tj)),m.LightComponent=dX,Jt(dX,"cc.LightComponent"),m.DirectionalLightComponent=PX,Jt(PX,"cc.DirectionalLightComponent"),m.SphereLightComponent=rj,Jt(rj,"cc.SphereLightComponent"),m.SpotLightComponent=Ij,Jt(Ij,"cc.SpotLightComponent"),rt(Ij.prototype,"SpotLight.prototype",[{name:"luminousPower",newName:"luminousFlux",customGetter:function(){return this.luminousFlux},customSetter:function(t){this.luminousFlux=t}}]),rt(rj.prototype,"SphereLight.prototype",[{name:"luminousPower",newName:"luminousFlux",customGetter:function(){return this.luminousFlux},customSetter:function(t){this.luminousFlux=t}}]),rt(dX.PhotometricTerm,"Light.PhotometricTerm",[{name:"LUMINOUS_POWER",newName:"LUMINOUS_FLUX"}]);var xj=Symbol("BakeNodeCurves"),Dj=function(){function t(){}return t.getOrExtract=function(e){var i=t.pool.get(e);if(!i||i.samples!==e.sample){i&&m.director.root.dataPoolManager.releaseAnimationClip(e);var n=Math.ceil(e.sample*e.duration)+1,r=e.sample;i=e[xj](0,r,n),t.pool.set(e,i)}return i},t.destroy=function(e){t.pool.delete(e)},t}();Dj.pool=new Map;var Oj=new Ln;function Pj(t,e,i){for(Ln.identity(i);t!==e;)Ln.fromRTS(Oj,t.rotation,t.position,t.scale),Ln.multiply(i,Oj,i),t=t.parent;return i}var Mj=new C_(Il.POINT,Il.POINT,Il.NONE,xl.CLAMP,xl.CLAMP,xl.CLAMP),Nj=function(t,e,i){t[e+0]=i.m00,t[e+1]=i.m01,t[e+2]=i.m02,t[e+3]=i.m12,t[e+4]=i.m04,t[e+5]=i.m05,t[e+6]=i.m06,t[e+7]=i.m13,t[e+8]=i.m08,t[e+9]=i.m09,t[e+10]=i.m10,t[e+11]=i.m14};function Lj(t,e){var i=4/Math.sqrt(e);return 12*Math.ceil(Math.max(480*i,t)/12)}new Rn,new Rn,new _n,new Rn,new _n;var Bj=new _n,Fj=new _n,kj=new _n,Uj=new _n,Gj=new Ln,Hj=new Ln,zj=new Xo,Vj=Number.MAX_SAFE_INTEGER;!function(){function t(t){this._device=void 0,this._pool=void 0,this._textureBuffers=new Map,this._formatSize=void 0,this._pixelsPerJoint=void 0,this._customPool=void 0,this._chunkIdxMap=new Map,this._device=t;var e=function(t){return t.getFormatFeatures(pl.RGBA32F)&Cl.SAMPLED_TEXTURE?pl.RGBA32F:pl.RGBA8}(this._device);this._formatSize=od[e].size,this._pixelsPerJoint=48/this._formatSize,this._pool=new qL(t),this._pool.initialize({format:e,roundUpFn:Lj}),this._customPool=new qL(t),this._customPool.initialize({format:e,roundUpFn:Lj})}var e=t.prototype;e.clear=function(){this._pool.destroy(),this._textureBuffers.clear()},e.registerCustomTextureLayouts=function(t){for(var e=0;e<t.length;e++){var i=t[e],n=i.textureLength;this._device.getFormatFeatures(pl.RGBA32F)&Cl.SAMPLED_TEXTURE||(n*=2);for(var r=this._customPool.createChunk(n),s=0;s<i.contents.length;s++){var o=i.contents[s],a=o.skeleton;this._chunkIdxMap.set(a,r);for(var h=0;h<o.clips.length;h++){var u=o.clips[h];this._chunkIdxMap.set(a^u,r)}}}},e.getDefaultPoseTexture=function(t,e,i){var n=0^t.hash,r=this._textureBuffers.get(n)||null;if(r&&r.bounds.has(e.hash))return r.refCount++,r;var s=t.joints,o=t.bindposes,a=null,h=!1,u=s.length;if(r)r.refCount++;else{var c=12*u,l=this._chunkIdxMap.get(n),_=void 0!==l?this._customPool.alloc(c*Float32Array.BYTES_PER_ELEMENT,l):this._pool.alloc(c*Float32Array.BYTES_PER_ELEMENT);if(!_)return r;r={pixelOffset:_.start/this._formatSize,refCount:1,bounds:new Map,skeletonHash:t.hash,clipHash:0,readyToBeDeleted:!1,handle:_},a=new Float32Array(c),h=!0}_n.set(kj,Vj,Vj,Vj),_n.set(Uj,-Vj,-Vj,-Vj);for(var d=e.getBoneSpaceBounds(t),f=0,p=0;f<u;f++,p+=12){var g=i.getChildByPath(s[f]),m=g?Pj(g,i,Gj):t.inverseBindposes[f],v=d[f];v&&(Xo.transform(zj,v,m),zj.getBoundary(Bj,Fj),_n.min(kj,kj,Bj),_n.max(Uj,Uj,Fj)),h&&(g&&Ln.multiply(m,m,o[f]),Nj(a,p,g?m:Ln.IDENTITY))}var y=[new Xo];return r.bounds.set(e.hash,y),Xo.fromPoints(y[0],kj,Uj),h&&(this._pool.update(r.handle,a.buffer),this._textureBuffers.set(n,r)),r},e.getSequencePoseTexture=function(t,e,i,n){var r=t.hash^e.hash,s=this._textureBuffers.get(r)||null;if(s&&s.bounds.has(i.hash))return s.refCount++,s;var o=t.joints,a=t.bindposes,h=Dj.getOrExtract(e).frames,u=null,c=!1,l=o.length;if(s)s.refCount++;else{var _=12*l*h,d=this._chunkIdxMap.get(r),f=void 0!==d?this._customPool.alloc(_*Float32Array.BYTES_PER_ELEMENT,d):this._pool.alloc(_*Float32Array.BYTES_PER_ELEMENT);if(!f)return null;var p=this._createAnimInfos(t,e,n);s={pixelOffset:f.start/this._formatSize,refCount:1,bounds:new Map,skeletonHash:t.hash,clipHash:e.hash,readyToBeDeleted:!1,handle:f,animInfos:p},u=new Float32Array(_),c=!0}var g=i.getBoneSpaceBounds(t),m=[];s.bounds.set(i.hash,m);for(var v=0;v<h;v++)m.push(new Xo(Vj,Vj,Vj,-Vj,-Vj,-Vj));for(var y=0,T=0;y<h;y++){for(var E=m[y],S=0;S<l;S++,T+=12){var A=s.animInfos[S],b=A.curveData,C=A.downstream,R=A.bindposeIdx,w=A.bindposeCorrection,I=void 0,x=!0;b&&C?I=Ln.multiply(Gj,b[y],C):b?I=b[y]:C?I=C:(I=t.inverseBindposes[R],x=!1);var D=g[S];if(D){var O=w?Ln.multiply(Hj,I,w):I;Xo.transform(zj,D,O),zj.getBoundary(Bj,Fj),_n.min(E.center,E.center,Bj),_n.max(E.halfExtents,E.halfExtents,Fj)}c&&(x&&Ln.multiply(Gj,I,a[R]),Nj(u,T,x?Gj:Ln.IDENTITY))}Xo.fromPoints(E,E.center,E.halfExtents)}return c&&(this._pool.update(s.handle,u.buffer),this._textureBuffers.set(r,s)),s},e.releaseHandle=function(t){if(t.refCount>0&&t.refCount--,!t.refCount&&t.readyToBeDeleted){var e=t.skeletonHash^t.clipHash;(void 0!==this._chunkIdxMap.get(e)?this._customPool:this._pool).free(t.handle),this._textureBuffers.get(e)===t&&this._textureBuffers.delete(e)}},e.releaseSkeleton=function(t){for(var e=this._textureBuffers.values(),i=e.next();!i.done;){var n=i.value;n.skeletonHash===t.hash&&(n.readyToBeDeleted=!0,n.refCount?this._textureBuffers.delete(n.skeletonHash^n.clipHash):this.releaseHandle(n)),i=e.next()}},e.releaseAnimationClip=function(t){for(var e=this._textureBuffers.values(),i=e.next();!i.done;){var n=i.value;n.clipHash===t.hash&&(n.readyToBeDeleted=!0,n.refCount?this._textureBuffers.delete(n.skeletonHash^n.clipHash):this.releaseHandle(n)),i=e.next()}},e._createAnimInfos=function(t,e,i){for(var n=[],r=t.joints,s=t.bindposes,o=r.length,a=Dj.getOrExtract(e),h=0;h<o;h++){for(var u=r[h],c=a.joints[u],l=i.getChildByPath(u),_=void 0,d=void 0;!c;){var f=u.lastIndexOf("/");if(u=u.substring(0,f),c=a.joints[u],l?(_||(_=new Ln),Ln.fromRTS(Gj,l.rotation,l.position,l.scale),Ln.multiply(_,Gj,_),l=l.parent):d=u,f<0)break}var p=h,g=void 0;if(void 0!==d&&c){p=h-1;for(var m=0;m<o;m++)if(r[m]===d){p=m,g=new Ln,Ln.multiply(g,s[m],t.inverseBindposes[h]);break}}n.push({curveData:c&&c.transforms,downstream:_,bindposeIdx:p,bindposeCorrection:g})}return n},n(t,[{key:"pixelsPerJoint",get:function(){return this._pixelsPerJoint}}])}();var Wj=[],Xj=new Map;function jj(t,e){for(var i=0,n=Ln.IDENTITY;t;){if(t.stamp===e||t.stamp+1===e&&!t.node.hasChangedFlags){n=t.world,t.stamp=e;break}t.stamp=e,Wj[i++]=t,t=t.parent}for(;i>0;){t=Wj[--i],Wj[i]=null;var r=t.node;Ln.fromRTS(t.local,r.rotation,r.position,r.scale),n=Ln.multiply(t.world,n,t.local)}return n}function Yj(t,e){for(var i,n=null,r=0;t!==e;){var s=t.uuid;if(Xj.has(s)){n=Xj.get(s);break}n={node:t,local:new Ln,world:new Ln,stamp:-1,parent:null},Xj.set(s,n),Wj[r++]=n,t=t.parent,n=null}for(;r>0;)i=Wj[--r],Wj[r]=null,i.parent=n,n=i;return n}function Kj(t){for(var e=Xj.get(t.uuid)||null;e;)Xj.delete(e.node.uuid),e=e.parent}var qj=[{name:"CC_USE_SKINNING",value:!0},{name:"CC_USE_REAL_TIME_JOINT_TEXTURE",value:!1}],Qj=[{name:"CC_USE_SKINNING",value:!0},{name:"CC_USE_REAL_TIME_JOINT_TEXTURE",value:!0}];function Zj(t,e,i,n){for(var r=0;r<i.length;r++){for(var s=i[r],o=-1,a=0;a<s.length;a++)if(s[a]===n){o=a;break}o>=0&&(e.push(r),t.push(o))}}var Jj=new _n,$j=new _n,tY=new _n,eY=new _n,iY=new Ln,nY=new Xo,rY=function(){this._format=Pf.RGBA32F,this._textures=[],this._buffers=[]};rY.WIDTH=256,rY.HEIGHT=3;var sY,oY,aY,hY,uY,cY,lY,_Y,dY,fY,pY,gY,mY,vY,yY,TY,EY,SY,AY,bY,CY,RY,wY,IY,xY,DY,OY,PY,MY,NY,LY,BY,FY=function(t){function e(){var e;return(e=t.call(this)||this)._buffers=[],e._dataArray=[],e._joints=[],e._bufferIndices=null,e._realTimeJointTexture=new rY,e._realTimeTextureMode=!1,e.type=vI.SKINNING,e}s(e,t);var i=e.prototype;return i.destroy=function(){if(this.bindSkeleton(),this._buffers.length){for(var e=0;e<this._buffers.length;e++)this._buffers[e].destroy();this._buffers.length=0}this._dataArray.length=0,this._realTimeJointTexture._textures.forEach((function(t){t.destroy()})),this._realTimeJointTexture._textures.length=0,this._realTimeJointTexture._buffers.length=0,t.prototype.destroy.call(this)},i.uploadAnimation=function(){},i.bindSkeleton=function(t,e,i){void 0===t&&(t=null),void 0===e&&(e=null),void 0===i&&(i=null);for(var n=0;n<this._joints.length;n++)Kj(this._joints[n].target);if(this._bufferIndices=null,this._joints.length=0,t&&e&&i){this._realTimeTextureMode=!1,Av.JOINT_UNIFORM_CAPACITY<t.joints.length&&(this._realTimeTextureMode=!0),this.transform=e;var r=i.getBoneSpaceBounds(t),s=i.struct.jointMaps;this._ensureEnoughBuffers(s&&s.length||1),this._bufferIndices=i.jointBufferIndices,this._initRealTimeJointTexture();for(var o=0;o<t.joints.length;o++){var a=r[o],h=e.getChildByPath(t.joints[o]);if(a&&h){var u=Yj(h,e),c=t.bindposes[o],l=[],_=[];s?Zj(l,_,s,o):(l.push(o),_.push(0)),this._joints.push({indices:l,buffers:_,bound:a,target:h,bindpose:c,transform:u})}}}},i.updateTransform=function(t){var e=this.transform;(e.hasChangedFlags||e.isTransformDirty())&&(e.updateWorldTransform(),this._localDataUpdated=!0),_n.set(Jj,1/0,1/0,1/0),_n.set($j,-1/0,-1/0,-1/0);for(var i=0;i<this._joints.length;i++){var n=this._joints[i],r=n.bound,s=jj(n.transform,t);Xo.transform(nY,r,s),nY.getBoundary(tY,eY),_n.min(Jj,Jj,tY),_n.max($j,$j,eY)}var o=this._worldBounds;this._modelBounds&&o&&(Xo.fromPoints(this._modelBounds,Jj,$j),this._modelBounds.transform(e._mat,e._pos,e._rot,e._scale,this._worldBounds))},i.updateUBOs=function(e){t.prototype.updateUBOs.call(this,e);for(var i=0;i<this._joints.length;i++){var n=this._joints[i],r=n.indices,s=n.buffers,o=n.transform,a=n.bindpose;Ln.multiply(iY,o.world,a);for(var h=0;h<s.length;h++)Nj(this._dataArray[s[h]],12*r[h],iY)}if(this._realTimeTextureMode)this._updateRealTimeJointTextureBuffer();else for(var u=0;u<this._buffers.length;u++)this._buffers[u].update(this._dataArray[u]);return!0},i.initSubModel=function(e,i,n){var r=i.vertexBuffers,s=i.iaInfo;s.vertexBuffers=i.jointMappedBuffers,t.prototype.initSubModel.call(this,e,i,n),s.vertexBuffers=r},i.getMacroPatches=function(e){var i=t.prototype.getMacroPatches.call(this,e),n=qj;return this._realTimeTextureMode&&(n=Qj),i?n.concat(i):n},i._updateLocalDescriptors=function(e,i){t.prototype._updateLocalDescriptors.call(this,e,i);var n=this._bufferIndices[e];if(this._realTimeTextureMode)this._bindRealTimeJointTexture(n,i);else{var r=this._buffers[n];r&&i.bindBuffer(Av.BINDING,r)}},i._updateInstancedAttributes=function(e,i){i.passes[0].batchingScheme!==PE.NONE&&q(3936,this.node.getPathInHierarchy()),t.prototype._updateInstancedAttributes.call(this,e,i)},i._ensureEnoughBuffers=function(t){if(this._buffers.length){for(var e=0;e<this._buffers.length;e++)this._buffers[e].destroy();this._buffers.length=0}if(this._dataArray.length&&(this._dataArray.length=0),this._realTimeTextureMode)for(var i=0;i<t;i++){var n=rY.WIDTH;this._dataArray[i]=new Float32Array(12*n)}else for(var r=0;r<t;r++){this._buffers[r]=this._device.createBuffer(new v_(vl.UNIFORM|vl.TRANSFER_DST,El.HOST|El.DEVICE,Av.SIZE,Av.SIZE));var s=Av.JOINT_UNIFORM_CAPACITY;this._dataArray[r]=new Float32Array(12*s)}},i._initRealTimeJointTexture=function(){if(this._realTimeJointTexture._textures.length&&(this._realTimeJointTexture._textures.forEach((function(t){t.destroy()})),this._realTimeJointTexture._textures.length=0),this._realTimeJointTexture._buffers.length=0,this._realTimeTextureMode){var t=DD.root.device,e=rY.WIDTH,i=rY.HEIGHT;0==(t.getFormatFeatures(pl.RGBA32F)&Cl.SAMPLED_TEXTURE)&&(this._realTimeJointTexture._format=Pf.RGBA8888,e=4*rY.WIDTH);for(var n=this._realTimeJointTexture._textures,r=this._realTimeJointTexture._buffers,s=this._realTimeJointTexture._format,o=0;o<this._dataArray.length;o++){r[o]=new Float32Array(4*rY.HEIGHT*rY.WIDTH);var a=r[o],h=s===Pf.RGBA32F?a:new Uint8Array(a.buffer),u=new $f({width:e,height:i,_data:h,_compressed:!1,format:s}),c=new Sg;c.setFilters(Sg.Filter.NEAREST,Sg.Filter.NEAREST),c.setMipFilter(Sg.Filter.NONE),c.setWrapMode(Sg.WrapMode.CLAMP_TO_EDGE,Sg.WrapMode.CLAMP_TO_EDGE,Sg.WrapMode.CLAMP_TO_EDGE),c.image=u,n[o]=c}}},i._bindRealTimeJointTexture=function(t,e){if(this._realTimeTextureMode){var i=this._realTimeJointTexture._textures[t];if(i){var n=i.getGFXTexture(),r=i.getGFXSampler();e.bindTexture(Ov,n),e.bindSampler(Ov,r)}}},i._updateRealTimeJointTextureBuffer=function(){if(this._realTimeTextureMode)for(var t=this._realTimeJointTexture._textures,e=this._realTimeJointTexture._buffers,i=0;i<t.length;i++){for(var n=e[i],r=this._dataArray[i],s=r.length/12,o=0,a=0,h=0;h<s;h++)a=4*h,n[a++]=r[o++],n[a++]=r[o++],n[a++]=r[o++],n[a++]=r[o++],a=4*(h+rY.WIDTH),n[a++]=r[o++],n[a++]=r[o++],n[a++]=r[o++],n[a++]=r[o++],a=4*(h+2*rY.WIDTH),n[a++]=r[o++],n[a++]=r[o++],n[a++]=r[o++],n[a++]=r[o++];var u=this._realTimeJointTexture._format===Pf.RGBA32F?n:new Uint8Array(n.buffer);t[i].uploadData(u)}},e}(TV),kY=[{name:"CC_USE_SKINNING",value:!0},{name:"CC_USE_BAKED_ANIMATION",value:!0}],UY=function(t){function e(){var e;(e=t.call(this)||this).uploadedAnim=void 0,e._jointsMedium=void 0,e._skeleton=null,e._mesh=null,e._dataPoolManager=void 0,e._instAnimInfoIdx=-1,e.type=vI.BAKED_SKINNING,e._dataPoolManager=m.director.root.dataPoolManager;var i=new Float32Array(4),n=e._dataPoolManager.jointAnimationInfo.getData();return e._jointsMedium={buffer:null,jointTextureInfo:i,animInfo:n,texture:null,boundsInfo:null},e}s(e,t);var i=e.prototype;return i.destroy=function(){this.uploadedAnim=void 0,this._jointsMedium.boundsInfo=null,this._jointsMedium.buffer&&(this._jointsMedium.buffer.destroy(),this._jointsMedium.buffer=null),this._applyJointTexture(),t.prototype.destroy.call(this)},i.bindSkeleton=function(t,e,i){if(void 0===t&&(t=null),void 0===e&&(e=null),void 0===i&&(i=null),this._skeleton=t,this._mesh=i,t&&e&&i){this.transform=e;var n=this._dataPoolManager;this._jointsMedium.animInfo=n.jointAnimationInfo.getData(e.uuid),this._jointsMedium.buffer||(this._jointsMedium.buffer=this._device.createBuffer(new v_(vl.UNIFORM|vl.TRANSFER_DST,El.DEVICE,Tv.SIZE,Tv.SIZE)))}},i.updateTransform=function(e){if(t.prototype.updateTransform.call(this,e),this.uploadedAnim){var i=this._jointsMedium,n=i.animInfo,r=i.boundsInfo[n.data[0]],s=this._worldBounds;if(s&&r){var o=this.transform;r.transform(o._mat,o._pos,o._rot,o._scale,s)}}},i.updateUBOs=function(e){t.prototype.updateUBOs.call(this,e);for(var i=this._jointsMedium.animInfo,n=!1,r=this._instAnimInfoIdx,s=0;s<this._subModels.length;s++){var o=this._subModels[s];r>=0?o.instancedAttributeBlock.views[r][0]=i.data[0]:n=!0}return n&&i.dirty&&(i.buffer.update(i.data),i.dirty=!1),!0},i.getMacroPatches=function(e){var i=t.prototype.getMacroPatches.call(this,e);return i?i.concat(kY):kY},i.uploadAnimation=function(t){if(this._skeleton&&this._mesh&&this.uploadedAnim!==t){this.uploadedAnim=t;var e=this._dataPoolManager,i=null;t?(i=e.jointTexturePool.getSequencePoseTexture(this._skeleton,t,this._mesh,this.transform),this._jointsMedium.boundsInfo=i&&i.bounds.get(this._mesh.hash),this._modelBounds=null):(i=e.jointTexturePool.getDefaultPoseTexture(this._skeleton,this._mesh,this.transform),this._jointsMedium.boundsInfo=null,this._modelBounds=i&&i.bounds.get(this._mesh.hash)[0]),this._applyJointTexture(i)}},i._applyJointTexture=function(t){void 0===t&&(t=null);var e=this._jointsMedium.texture;if(e&&e!==t&&this._dataPoolManager.jointTexturePool.releaseHandle(e),this._jointsMedium.texture=t,t){var i=this._jointsMedium,n=i.buffer,r=i.jointTextureInfo;r[0]=t.handle.texture.width,r[1]=this._skeleton.joints.length,r[2]=t.pixelOffset+.1,r[3]=1/r[0],this.updateInstancedJointTextureInfo(),n&&n.update(r);for(var s=t.handle.texture,o=0;o<this._subModels.length;++o)this._subModels[o].descriptorSet.bindTexture(Iv,s)}},i._updateLocalDescriptors=function(e,i){t.prototype._updateLocalDescriptors.call(this,e,i);var n=this._jointsMedium,r=n.buffer,s=n.texture,o=n.animInfo;if(i.bindBuffer(Tv.BINDING,r),i.bindBuffer(Ev.BINDING,o.buffer),s){var a=this._device.getSampler(Mj);i.bindTexture(Iv,s.handle.texture),i.bindSampler(Iv,a)}},i._updateInstancedAttributes=function(e,i){t.prototype._updateInstancedAttributes.call(this,e,i),this._instAnimInfoIdx=i.getInstancedAttributeIndex(Sv),this.updateInstancedJointTextureInfo()},i.updateInstancedJointTextureInfo=function(){for(var t=this._jointsMedium,e=t.jointTextureInfo,i=t.animInfo,n=this._instAnimInfoIdx,r=0;r<this._subModels.length;r++){var s=this._subModels[r].instancedAttributeBlock.views;if(n>=0&&s.length>0){var o=s[n];o[0]=i.data[0],o[1]=e[1],o[2]=e[2]}}},e}(TV),GY=(sY=va("cc.SkinnedMeshRenderer"),oY=Ta(100),aY=Za(nW),hY=Za(Tm),uY=Za(nW),cY=Za(Tm),sY(lY=oY((_Y=function(t){function e(){var e;return(e=t.call(this)||this)._skeleton=dY&&dY(),e._skinningRoot=fY&&fY(),e._clip=null,e.associatedAnimation=null,e._modelType=UY,e}s(e,t);var i=e.prototype;return i.onLoad=function(){t.prototype.onLoad.call(this),this._tryBindAnimation()},i.onDestroy=function(){this.associatedAnimation&&(this.associatedAnimation.notifySkinnedMeshRemoved(this),this.associatedAnimation),t.prototype.onDestroy.call(this)},i.uploadAnimation=function(t){this._clip=t,this.model&&this.model.uploadAnimation&&this.model.uploadAnimation(t)},i.setUseBakedAnimation=function(t,e){void 0===t&&(t=!0),void 0===e&&(e=!1);var i=t?UY:FY;(e||this._modelType!==i)&&(this._modelType=i,this._model&&(m.director.root.destroyModel(this._model),this._model=null,this._models.length=0,this._updateModels(),this._updateCastShadow(),this._updateReceiveShadow(),this._updateUseLightProbe(),this.enabledInHierarchy&&this._attachToScene()))},i.setSharedMaterial=function(e,i){t.prototype.setSharedMaterial.call(this,e,i),this._modelType===FY&&this.getMaterialInstance(i)},i._updateModelParams=function(){this._update(),t.prototype._updateModelParams.call(this)},i._tryBindAnimation=function(){var t=this._skinningRoot;if(t){for(var e=!1,i=this.node;i;i=i.parent)if(i===t){e=!0;break}if(e){var n=t.getComponent("cc.SkeletalAnimation");n&&n.enabledInHierarchy?n.notifySkinnedMeshAdded(this):this.setUseBakedAnimation(!1)}}},i._update=function(){this.model&&(this.model.bindSkeleton(this._skeleton,this._skinningRoot,this._mesh),this.model.uploadAnimation&&this.model.uploadAnimation(this._clip))},n(e,[{key:"skeleton",get:function(){return this._skeleton},set:function(t){t!==this._skeleton&&(this._skeleton=t,this._update())}},{key:"skinningRoot",get:function(){return this._skinningRoot},set:function(t){t!==this._skinningRoot&&(this._skinningRoot=t,this._tryBindAnimation(),this._update())}},{key:"model",get:function(){return this._model}}]),e}(UV),dY=ua(_Y.prototype,"_skeleton",[aY],(function(){return null})),fY=ua(_Y.prototype,"_skinningRoot",[hY],(function(){return null})),f(_Y.prototype,"skeleton",[uY],Object.getOwnPropertyDescriptor(_Y.prototype,"skeleton"),_Y.prototype),f(_Y.prototype,"skinningRoot",[cY],Object.getOwnPropertyDescriptor(_Y.prototype,"skinningRoot"),_Y.prototype),lY=_Y))||lY)||lY);t({SkinnedMeshRenderer:GY,SkinningModelComponent:GY});var HY=new L_(e_.ATTR_BATCH_ID,pl.R32F),zY=new L_(e_.ATTR_BATCH_UV,pl.RG32F),VY=od[HY.format].size+od[zY.format].size,WY=(pY=va("cc.SkinnedMeshUnit"),gY=Za(ZO),mY=Za(nW),vY=Za($E),yY=Za(GY),pY((EY=function(){function t(){this.mesh=SY&&SY(),this.skeleton=AY&&AY(),this.material=bY&&bY(),this._localTransform=CY&&CY(),this._offset=RY&&RY(),this._size=wY&&wY()}return n(t,[{key:"offset",get:function(){return this._offset},set:function(t){Hn.copy(this._offset,t)}},{key:"size",get:function(){return this._size},set:function(t){Hn.copy(this._size,t)}},{key:"copyFrom",get:function(){return null},set:function(t){t&&(this.mesh=t.mesh,this.skeleton=t.skeleton,this.material=t.getSharedMaterial(0),t.skinningRoot&&Pj(t.node,t.skinningRoot,this._localTransform))}}]),t}(),SY=ua(EY.prototype,"mesh",[gY],(function(){return null})),AY=ua(EY.prototype,"skeleton",[mY],(function(){return null})),bY=ua(EY.prototype,"material",[vY],(function(){return null})),CY=ua(EY.prototype,"_localTransform",[wa],(function(){return new Ln})),RY=ua(EY.prototype,"_offset",[wa],(function(){return new Hn(0,0)})),wY=ua(EY.prototype,"_size",[wa],(function(){return new Hn(1,1)})),f(EY.prototype,"copyFrom",[yY],Object.getOwnPropertyDescriptor(EY.prototype,"copyFrom"),EY.prototype),TY=EY))||TY);t({SkinnedMeshUnit:WY,SkinningModelUnit:WY});var XY=new Ln;new Ln;var jY,YY,KY,qY,QY,ZY,JY,$Y,tK,eK,iK,nK,rK,sK,oK,aK,hK,uK=new _n,cK=(IY=va("cc.SkinnedMeshBatchRenderer"),xY=Ta(100),DY=Za([ti]),OY=Za([WY]),IY(PY=xY((MY=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).atlasSize=NY&&NY(),e.batchableTextureNames=LY&&LY(),e.units=BY&&BY(),e._textures={},e._batchMaterial=null,e}s(e,t);var i=e.prototype;return i.onLoad=function(){t.prototype.onLoad.call(this),this.cook()},i.onDestroy=function(){for(var e in this._textures)this._textures[e].destroy();this._textures={},this._mesh&&(this._mesh.destroy(),this._mesh=null),t.prototype.onDestroy.call(this)},i._onMaterialModified=function(e){this.cookMaterials(),t.prototype._onMaterialModified.call(this,e,this.getMaterialInstance(e))},i.cook=function(){this.cookMaterials(),this.cookSkeletons(),this.cookMeshes()},i.cookMaterials=function(){var t=this;this._batchMaterial||(this._batchMaterial=this.getSharedMaterial(0));var e=this.getMaterialInstance(0);if(e&&this._batchMaterial&&this._batchMaterial.effectAsset){e.copy(this._batchMaterial),this.resizeAtlases();for(var i=e.effectAsset.techniques[e.technique],n=function(n){var r=i.passes[n];if(!r.properties)return 1;var s=function(i){if(r.properties[i].type>=ml.SAMPLER1D){var s=null;t.batchableTextureNames.find((function(t){return t===i}))?((s=t._textures[i])||(s=t.createTexture(i)),t.cookTextures(s,i,n)):t.units.some((function(t){return s=t.material&&t.material.getProperty(i,n)})),s&&e.setProperty(i,s,n)}else{for(var o=[],a=0;a<t.units.length;a++){var h=t.units[a];h.material&&o.push(h.material.getProperty(i.slice(0,-3),n))}e.setProperty(i,o,n)}};for(var o in r.properties)s(o)},r=0;r<i.passes.length;r++)n(r)}else F("incomplete batch material!")},i.cookSkeletons=function(){if(this._skinningRoot){for(var t=[],e=[],i=0;i<this.units.length;i++){var n=this.units[i];if(n&&n.skeleton){var r=n.skeleton;Ln.invert(XY,n._localTransform);for(var s=function(){var i=r.joints[o];if(t.findIndex((function(t){return t===i}))>=0)return 1;t.push(i),e.push(Ln.multiply(new Ln,r.bindposes[o]||Ln.IDENTITY,XY))},o=0;o<r.joints.length;o++)s()}}var a=Array.from(Array(t.length).keys()).sort((function(e,i){return t[e]>t[i]?1:t[e]<t[i]?-1:0})),h=new nW;h.joints=t.map((function(t,e,i){return i[a[e]]})),h.bindposes=e.map((function(t,e,i){return i[a[e]]})),this._skeleton&&this._skeleton.destroy(),this.skeleton=h}else F("no skinning root specified!")},i.cookMeshes=function(){for(var t=this,e=!1,i=0;i<this.units.length;i++)if(this.units[i].mesh){e=!0;break}if(e&&this._skinningRoot){this._mesh?this._mesh.destroyRenderingMesh():this._mesh=new ZO;for(var n=0,r=pl.UNKNOWN,s=0,o=pl.UNKNOWN,a=0,h=pl.UNKNOWN,u=0,c=pl.UNKNOWN,l=0,_=pl.UNKNOWN,d=new Array(this.units.length),f=this.units.length,p=0;p<f;p++){var g=this.units[p];g&&g.skeleton&&(d[p]=g.skeleton.joints.map((function(e){return t._skeleton.joints.findIndex((function(t){return e===t}))})))}for(var m=function(){var e=t.units[v];if(!e||!e.mesh||!e.mesh.data)return 1;var i=t._createUnitMesh(v,e.mesh),f=new DataView(i.data.buffer);Ln.invert(XY,e._localTransform),Ln.transpose(XY,XY);for(var p=e.offset,g=e.size,m=function(){var t=i.struct.vertexBundles[y];n=t.view.offset,r=pl.UNKNOWN;for(var m=0;m<t.attributes.length;m++){var T=t.attributes[m];if(T.name===e_.ATTR_POSITION){r=T.format;break}n+=od[T.format].size}if(r){for(var E=BD(f,r,n,t.view.length,t.view.stride),S=0;S<E.length;S+=3)_n.fromArray(uK,E,S),_n.transformMat4(uK,uK,e._localTransform),_n.toArray(E,uK,S);LD(f,E,r,n,t.view.stride)}s=t.view.offset,o=pl.UNKNOWN;for(var A=0;A<t.attributes.length;A++){var b=t.attributes[A];if(b.name===e_.ATTR_NORMAL){o=b.format;break}s+=od[b.format].size}if(o){for(var C=BD(f,o,s,t.view.length,t.view.stride),R=0;R<C.length;R+=3)_n.fromArray(uK,C,R),_n.transformMat4Normal(uK,uK,XY),_n.toArray(C,uK,R);LD(f,C,o,s,t.view.stride)}a=t.view.offset,h=pl.UNKNOWN;for(var w=0;w<t.attributes.length;w++){var I=t.attributes[w];if(I.name===e_.ATTR_TANGENT){h=I.format;break}a+=od[I.format].size}if(h){for(var x=BD(f,h,a,t.view.length,t.view.stride),D=0;D<x.length;D+=3)_n.fromArray(uK,x,D),_n.transformMat4Normal(uK,uK,XY),_n.toArray(x,uK,D);LD(f,x,h,a,t.view.stride)}u=t.view.offset,c=pl.UNKNOWN;for(var O=0;O<t.attributes.length;O++){var P=t.attributes[O];if(P.name===e_.ATTR_BATCH_UV){c=P.format;break}u+=od[P.format].size}c&&FD(f,(function(t,e){var i,n=0===e?"x":"y";return(t=(i=t)-Math.floor(i))*g[n]+p[n]}),c,u,t.view.length,t.view.stride,f);var M=d[v];if(!M)return 1;l=t.view.offset,_=pl.UNKNOWN;for(var N=0;N<t.attributes.length;N++){var L=t.attributes[N];if(L.name===e_.ATTR_JOINTS){_=L.format;break}l+=od[L.format].size}_&&FD(f,(function(t){return M[t]}),_,l,t.view.length,t.view.stride,f)},y=0;y<i.struct.vertexBundles.length;y++)m();t._mesh.merge(i)},v=0;v<f;v++)m();this._onMeshChanged(this._mesh),this._updateModels()}},i.cookTextures=function(t,e,i){for(var n=[],r=[],s=[],o=[],a=0;a<this.units.length;a++){var h=this.units[a];if(h.material){var u=h.material.getProperty(e,i);if(u&&u.image&&u.image.data){var c=new __;c.texOffset.x=h.offset.x*this.atlasSize,c.texOffset.y=h.offset.y*this.atlasSize,c.texExtent.width=h.size.x*this.atlasSize,c.texExtent.height=h.size.y*this.atlasSize;var l=u.image.data;ArrayBuffer.isView(l)?(s.push(l),o.push(c)):(n.push(l),r.push(c))}}}var _=t.getGFXTexture(),d=m.director.root.device;s.length>0&&d.copyBuffersToTexture(s,_,o),n.length>0&&d.copyTexImagesToTexture(n,_,r)},i.createTexture=function(t){var e=new Sg;return e.setFilters(Nf.LINEAR,Nf.LINEAR),e.setMipFilter(Nf.NEAREST),e.reset({width:this.atlasSize,height:this.atlasSize,format:Pf.RGBA8888}),this._textures[t]=e,e},i.resizeAtlases=function(){for(var t in this._textures)this._textures[t].reset({width:this.atlasSize,height:this.atlasSize,format:Pf.RGBA8888})},i._createUnitMesh=function(t,e){for(var i=JSON.parse(JSON.stringify(e.struct)),n={},r=0;r<e.struct.primitives.length;r++){for(var s=e.struct.primitives[r],o=0,a=pl.UNKNOWN,h=0;h<s.vertexBundelIndices.length;h++){var u=e.struct.vertexBundles[s.vertexBundelIndices[h]];o=u.view.offset,a=pl.UNKNOWN;for(var c=0;c<u.attributes.length;c++){var l=u.attributes[c];if(l.name===e_.ATTR_TEX_COORD){a=l.format;break}o+=od[l.format].size}if(a)break}if(void 0===n[h]){n[h]=[a,o];var _=i.vertexBundles[h];_.attributes.push(HY),_.attributes.push(zY),_.view.offset=0,_.view.length+=_.view.count*VY,_.view.stride+=VY}}for(var d=0,f=0;f<i.vertexBundles.length;f++)d+=i.vertexBundles[f].view.length;for(var p=0;p<i.primitives.length;p++){var g=i.primitives[p];g.indexView&&(g.indexView.offset=d,d+=g.indexView.length)}var v=new Uint8Array(d),y=e.data,T=new DataView(v.buffer),E=new DataView(y.buffer),S=m.sys.isLittleEndian;for(var A in n)for(var b=i.vertexBundles[A],C=e.struct.vertexBundles[A],R=n[A],w=BD(E,R[0],R[1],C.view.length,C.view.stride),I=C.view,x=b.view,D=I.stride,O=x.stride,P=I.offset,M=x.offset,N=0;N<x.count;N++){var L=y.subarray(P,P+D);v.set(L,M),T.setFloat32(M+D,t),T.setFloat32(M+D+4,w[2*N],S),T.setFloat32(M+D+8,w[2*N+1],S),M+=O,P+=D}for(var B=0;B<i.primitives.length;B++){var F=e.struct.primitives[B],k=i.primitives[B];if(F.indexView&&k.indexView)for(var U=F.indexView.stride,G=k.indexView.stride,H=F.indexView.offset,z=k.indexView.offset,V=0;V<k.indexView.count;V++){var W=y.subarray(H,H+U);v.set(W,z),z+=G,H+=U}}var X=new ZO;return X.reset({struct:i,data:v}),X},n(e,[{key:"mesh",get:function(){return t.prototype.mesh},set:function(t){this.mesh=t}},{key:"skeleton",get:function(){return t.prototype.skeleton},set:function(t){this.skeleton=t}}]),e}(GY),NY=ua(MY.prototype,"atlasSize",[wa],(function(){return 1024})),LY=ua(MY.prototype,"batchableTextureNames",[DY,wa],(function(){return[]})),BY=ua(MY.prototype,"units",[OY,wa],(function(){return[]})),f(MY.prototype,"mesh",[hh],Object.getOwnPropertyDescriptor(MY.prototype,"mesh"),MY.prototype),f(MY.prototype,"skeleton",[hh],Object.getOwnPropertyDescriptor(MY.prototype,"skeleton"),MY.prototype),PY=MY))||PY)||PY);t({SkinnedMeshBatchRenderer:cK,BatchedSkinningModelComponent:cK}),m.SkinningModelComponent=GY,Jt(GY,"cc.SkinningModelComponent"),m.SkinningModelUnit=WY,Jt(WY,"cc.SkinningModelUnit"),m.BatchedSkinningModelComponent=cK,Jt(cK,"cc.BatchedSkinningModelComponent");var lK=[.25,.125,.01],_K=t("LOD",(jY=va("cc.LOD"),YY=Za([UV]),KY=Za(Je),qY=Za([UV]),QY=Za([Ze]),jY((JY=function(){function t(){this._screenUsagePercentage=$Y&&$Y(),this._renderers=tK&&tK(),this._LODData=new QI,this._modelAddedCallback=void 0,this._LODData.screenUsagePercentage=this._screenUsagePercentage,this._modelAddedCallback=null}var e=t.prototype;return e.insertRenderer=function(t,e){(t<0||t>this._renderers.length)&&(t=this._renderers.length),this._renderers.splice(t,0,e);var i=!1;return e.model&&(i=!0,this._LODData.addModel(e.model)),this._modelAddedCallback&&i&&this._modelAddedCallback(),e},e.deleteRenderer=function(t){var e,i=this._renderers.splice(t,1),n=i.length>0?null===(e=i[0])||void 0===e?void 0:e.model:null;return n&&this._LODData.eraseModel(n),i[0]},e.getRenderer=function(t){return this._renderers[t]||null},e.setRenderer=function(t,e){t<0||t>=this.rendererCount?k("setRenderer to LOD error, index out of range"):(this.deleteRenderer(t),this.insertRenderer(t,e))},n(t,[{key:"screenUsagePercentage",get:function(){return this._screenUsagePercentage},set:function(t){this._screenUsagePercentage=t,this._LODData.screenUsagePercentage=t}},{key:"renderers",get:function(){return this._renderers},set:function(t){if(t!==this._renderers){var e=!1;this._renderers.length=0,this._LODData.clearModels();for(var i=0;i<t.length;i++){var n;this._renderers[i]=t[i];var r=null===(n=t[i])||void 0===n?void 0:n.model;r&&(e=!0,this._LODData.addModel(r))}this._modelAddedCallback&&e&&this._modelAddedCallback()}}},{key:"triangleCount",get:function(){var t=[];return this._renderers.forEach((function(e){var i=0;if(e&&e.mesh){var n=e.mesh.struct.primitives;null==n||n.forEach((function(t){t&&t.indexView&&(i+=t.indexView.count)}))}t.push(i/3)})),t}},{key:"rendererCount",get:function(){return this._renderers.length}},{key:"lodData",get:function(){return this._LODData}},{key:"modelAddedCallback",set:function(t){this._modelAddedCallback=t}}]),t}(),$Y=ua(JY.prototype,"_screenUsagePercentage",[wa],(function(){return 1})),tK=ua(JY.prototype,"_renderers",[YY,wa],(function(){return[]})),f(JY.prototype,"screenUsagePercentage",[KY],Object.getOwnPropertyDescriptor(JY.prototype,"screenUsagePercentage"),JY.prototype),f(JY.prototype,"renderers",[qY],Object.getOwnPropertyDescriptor(JY.prototype,"renderers"),JY.prototype),f(JY.prototype,"triangleCount",[QY],Object.getOwnPropertyDescriptor(JY.prototype,"triangleCount"),JY.prototype),ZY=JY))||ZY)),dK=(t("LODGroup",(eK=va("cc.LODGroup"),iK=Za(Je),nK=Za([_K]),eK((sK=function(t){function e(){var e;return(e=t.call(this)||this)._localBoundaryCenter=oK&&oK(),e._objectSize=aK&&aK(),e._LODs=hK&&hK(),e._lodGroup=new ZI,e._eventRegistered=!1,e._forceUsedLevels=[],e}s(e,t);var i=e.prototype;return i.onLodModelAddedCallback=function(){0===this.objectSize&&this.recalculateBounds()},i.insertLOD=function(t,e,i){if((t<0||t>this.lodCount)&&(t=this.lodCount),i||(i=new _K),i.modelAddedCallback=this.onLodModelAddedCallback.bind(this),!e){var n=this.getLOD(t-1),r=this.getLOD(t);if(n&&r)e=(n.screenUsagePercentage+r.screenUsagePercentage)/2;else if(n&&!r)(e=n.screenUsagePercentage/2)>.01&&(e=.01);else if(r&&!n){e=r.screenUsagePercentage;var s=this.getLOD(t+1);r.screenUsagePercentage=(e+(s?s.screenUsagePercentage:0))/2}else e=lK[0]}return i.screenUsagePercentage=e,this._LODs.splice(t,0,i),this._lodGroup.insertLOD(t,i.lodData),this._updateDataToScene(),this.node&&this._emitChangeNode(this.node),i},i.eraseLOD=function(t){if(t<0||t>=this.lodCount)return F("eraseLOD error, index out of range"),null;var e=this._LODs[t];return e?(this._LODs.splice(t,1),this._lodGroup.eraseLOD(t),this._updateDataToScene(),this._emitChangeNode(this.node),e):(F("eraseLOD error, LOD not exist at specified index."),null)},i.getLOD=function(t){return t<0||t>=this.lodCount?(F("getLOD error, index out of range"),null):this._LODs[t]},i.setLOD=function(t,e){t<0||t>=this.lodCount?F("setLOD error, index out of range"):(this._LODs[t]=e,e.modelAddedCallback=this.onLodModelAddedCallback.bind(this),this.lodGroup.updateLOD(t,e.lodData),this._updateDataToScene())},i.recalculateBounds=function(){for(var t=new _n,e=new _n,i=null,n=new _n,r=0;r<this.lodCount;++r){var s=this.getLOD(r);if(s)for(var o=0;o<s.rendererCount;++o){var a,h,u=s.getRenderer(o);if(u){null===(a=u.model)||void 0===a||a.updateWorldBound();var c=null===(h=u.model)||void 0===h?void 0:h.worldBounds;c&&(c.getBoundary(t,e),i?(_n.min(i,i,t),_n.max(n,n,e)):(i=t.clone(),n=e.clone()))}}}if(i){var l=i,_=new _n(.5*(n.x+l.x),.5*(n.y+l.y),.5*(n.z+l.z)),d=new _n(.5*(n.x-l.x),.5*(n.y-l.y),.5*(n.z-l.z)),f=function(t,e,i){var n,r,s=new Array(new _n(t.x-e.x,t.y-e.y,t.z-e.z),new _n(t.x-e.x,t.y+e.y,t.z-e.z),new _n(t.x+e.x,t.y+e.y,t.z-e.z),new _n(t.x+e.x,t.y-e.y,t.z-e.z),new _n(t.x-e.x,t.y-e.y,t.z+e.z),new _n(t.x-e.x,t.y+e.y,t.z+e.z),new _n(t.x+e.x,t.y+e.y,t.z+e.z),new _n(t.x+e.x,t.y-e.y,t.z+e.z));r=(n=s[0].transformMat4(i)).clone();for(var o=1;o<8;++o){var a=s[o].transformMat4(i);n=_n.min(n,n,a),r=_n.max(r,r,a)}return[n,r]}(_,d,this.node.worldMatrix.clone().invert()),p=f[0],g=f[1];_.set(.5*(g.x+p.x),.5*(g.y+p.y),.5*(g.z+p.z)),d.set(.5*(g.x-p.x),.5*(g.y-p.y),.5*(g.z-p.z)),this.localBoundaryCenter=_,this.objectSize=2*Math.max(d.x,d.y,d.z)}else this.localBoundaryCenter=new _n(0,0,0),this.objectSize=0;this._emitChangeNode(this.node)},i.resetObjectSize=function(){if(1!==this.objectSize){0===this.objectSize&&(this.objectSize=1);var t=1/this.objectSize;this.objectSize=1;for(var e=0;e<this.lodCount;++e){var i=this.getLOD(e);i&&(i.screenUsagePercentage*=t)}this._emitChangeNode(this.node)}},i.forceLOD=function(t){this._forceUsedLevels=t<0?[]:[t],this.lodGroup.lockLODLevels(this._forceUsedLevels)},i.forceLODs=function(){},i.onLoad=function(){this._lodGroup.node=this.node,this._lodGroup.objectSize=this._objectSize,this._lodGroup.localBoundaryCenter=this._localBoundaryCenter,this._eventRegistered||(this.node.on(Dg.COMPONENT_REMOVED,this._onRemove,this),this._eventRegistered=!0),this._constructLOD()},i._onRemove=function(t){t===this&&this.onDisable()},i._constructLOD=function(){if(this.lodCount<1)for(var t=lK.length,e=0;e<t;e++)this.insertLOD(e,lK[e])},i.onRestore=function(){this._constructLOD(),this.enabledInHierarchy&&this._attachToScene()},i.onEnable=function(){var t=this;this._attachToScene(),0===this.objectSize&&this.recalculateBounds(),this.lodGroup.lockLODLevels(this._forceUsedLevels),this.lodCount>0&&this._lodGroup.lodCount<1&&this._LODs.forEach((function(e,i){e.lodData.screenUsagePercentage=e.screenUsagePercentage;var n=e.renderers;if(null!==n&&n.length>0)for(var r=0;r<n.length;r++){var s=e.lodData,o=n[r];s&&o&&o.model&&s.addModel(o.model)}t._lodGroup.insertLOD(i,e.lodData)}))},i.onDisable=function(){this._detachFromScene(),this.lodGroup.lockLODLevels([])},i._attachToScene=function(){if(this.node&&this.node.scene){var t=this._getRenderScene();this._lodGroup.scene&&this._detachFromScene(),t.addLODGroup(this._lodGroup)}},i._detachFromScene=function(){this._lodGroup.scene&&this._lodGroup.scene.removeLODGroup(this._lodGroup)},i._emitChangeNode=function(){},i._updateDataToScene=function(){this._detachFromScene(),this._attachToScene()},n(e,[{key:"localBoundaryCenter",get:function(){return this._localBoundaryCenter.clone()},set:function(t){this._localBoundaryCenter.set(t),this._lodGroup.localBoundaryCenter=t}},{key:"lodCount",get:function(){return this._LODs.length}},{key:"objectSize",get:function(){return this._objectSize},set:function(t){this._objectSize=t,this._lodGroup.objectSize=t}},{key:"LODs",get:function(){return this._LODs},set:function(t){var e=this;t!==this._LODs?(this._LODs.length=0,this.lodGroup.clearLODs(),t.forEach((function(t,i){e.lodGroup.insertLOD(i,t.lodData),e._LODs[i]=t,t.modelAddedCallback=e.onLodModelAddedCallback.bind(e)})),this._updateDataToScene()):this._updateDataToScene()}},{key:"lodGroup",get:function(){return this._lodGroup}}]),e}(xp),oK=ua(sK.prototype,"_localBoundaryCenter",[wa],(function(){return new _n(0,0,0)})),aK=ua(sK.prototype,"_objectSize",[wa],(function(){return 0})),hK=ua(sK.prototype,"_LODs",[wa],(function(){return[]})),f(sK.prototype,"objectSize",[iK],Object.getOwnPropertyDescriptor(sK.prototype,"objectSize"),sK.prototype),f(sK.prototype,"LODs",[nK],Object.getOwnPropertyDescriptor(sK.prototype,"LODs"),sK.prototype),rK=sK))||rK)),Rg.makeMaskExclude([Rg.BitMask.UI_2D,Rg.BitMask.UI_3D,Rg.BitMask.GIZMOS,Rg.BitMask.EDITOR,Rg.BitMask.SCENE_GIZMO,Rg.BitMask.PROFILER,Rg.Enum.IGNORE_RAYCAST])),fK=t("ReflectionProbeManager",function(){function t(){this._probes=[],this._useCubeModels=new Map,this._usePlanarModels=new Map,this._updateForRuntime=!0,this._dataTexture=null,this._registeredEvent=!1}var e=t.prototype;return e.registerEvent=function(){this._registeredEvent||(m.director.on(m.Director.EVENT_BEFORE_UPDATE,this.onUpdateProbes,this),this._registeredEvent=!0)},e.onUpdateProbes=function(){if(0!==this._probes.length){var t=m.director.getScene();if(t&&t.renderScene)for(var e=t.renderScene.models,i=0;i<e.length;i++){var n=e[i];n.node&&n.node.layer&dK&&(n.reflectionProbeType===pI.BAKED_CUBEMAP||this._isUsedBlending(n)?this.selectReflectionProbe(n):n.reflectionProbeType===pI.PLANAR_REFLECTION&&this.selectPlanarReflectionProbe(n))}}},e.filterModelsForPlanarReflection=function(){if(0!==this._probes.length){var t=m.director.getScene();if(t&&t.renderScene)for(var e=t.renderScene.models,i=0;i<e.length;i++){var n=e[i];n.node&&n.node.layer&dK&&n.reflectionProbeType===pI.PLANAR_REFLECTION&&this.selectPlanarReflectionProbe(n)}}},e.clearPlanarReflectionMap=function(t){for(var e,i=d(this._usePlanarModels.entries());!(e=i()).done;){var n=e.value;n[1]===t&&this._updatePlanarMapOfModel(n[0],null,null)}},e.register=function(t){-1===this._probes.indexOf(t)&&(this._probes.push(t),this.updateProbeData())},e.unregister=function(t){for(var e=0;e<this._probes.length;e++)if(this._probes[e]===t){var i=this._probes.splice(e,1);i[0]&&this._removeDependentModels(i[0]);break}this.updateProbeData()},e.exists=function(t){if(0===this._probes.length)return!1;for(var e=0;e<this._probes.length;e++)if(this._probes[e].getProbeId()===t)return!0;return!1},e.getNewReflectionProbeId=function(){for(var t=0;;){if(!this.exists(t))return t;t++}},e.getProbes=function(){return this._probes},e.getProbeById=function(t){for(var e=0;e<this._probes.length;e++)if(this._probes[e].getProbeId()===t)return this._probes[e];return null},e.clearAll=function(){this._probes=[]},e.getProbeByCamera=function(t){for(var e=0;e<this._probes.length;e++)if(this._probes[e].camera===t)return this._probes[e];return null},e.updateBakedCubemap=function(t){var e=this._getModelsByProbe(t);if(t.cubemap){for(var i=0;i<e.length;i++){var n=e[i];this._updateCubemapOfModel(n,t)}if(t.needRefresh=!1,0===e.length)for(var r,s=d(this._useCubeModels.entries());!(r=s()).done;){var o=r.value;o[0].reflectionProbeBlendId===t.getProbeId()&&this._updateBlendCubemap(o[0],t)}}},e.updatePlanarMap=function(t,e){if(t.node&&t.node.scene){for(var i=this._getModelsByProbe(t),n=0;n<i.length;n++)this._updatePlanarMapOfModel(i[n],e,t);if(t.previewPlane){var r=t.previewPlane.getComponent(UV);r&&r.updateProbePlanarMap(e)}}},e.selectPlanarReflectionProbe=function(t){if(t.node&&t.worldBounds&&t.reflectionProbeType===pI.PLANAR_REFLECTION){for(var e=0;e<this._probes.length;e++){var i=this._probes[e];i.probeType===lI.PLANAR&&t.node.layer&dK&&(t.updateWorldBound(),ds.aabbWithAABB(t.worldBounds,i.boundingBox)?this._usePlanarModels.set(t,i):this._usePlanarModels.has(t)&&this._usePlanarModels.get(t)===i&&(this._usePlanarModels.delete(t),this._updatePlanarMapOfModel(t,null,null)))}for(var n=0;n<this._probes.length;n++)this._probes[n].probeType===lI.PLANAR&&(this._probes[n].realtimePlanarTexture?this.updatePlanarMap(this._probes[n],this._probes[n].realtimePlanarTexture.getGFXTexture()):this.updatePlanarMap(this._probes[n],null))}},e.selectReflectionProbe=function(t){if(t.node&&t.worldBounds&&t.node.layer&dK){t.updateWorldBound();var e=this._getNearestProbe(t);e?this._useCubeModels.has(t)?(this._useCubeModels.get(t)!==e&&this._useCubeModels.set(t,e),e.needRefresh=!0):(this._useCubeModels.set(t,e),e.needRefresh=!0):(this._updateCubemapOfModel(t,null),this._useCubeModels.delete(t))}for(var i=0;i<this._probes.length;i++)(this._probes[i].needRefresh&&this._probes[i].probeType===lI.CUBE||this._isUsedBlending(t))&&this.updateBakedCubemap(this._probes[i])},e.updatePreviewSphere=function(t){if(t&&t.previewSphere){var e=t.previewSphere.getComponent(UV);e&&(e.updateProbeCubemap(t.cubemap),e.updateReflectionProbeId(t.getProbeId()))}},e.updatePreviewPlane=function(t){t&&t.previewPlane&&t.previewPlane.getComponent(UV)&&t.realtimePlanarTexture&&this.updatePlanarMap(t,t.realtimePlanarTexture.getGFXTexture())},e.updateProbeData=function(){if(0!==this._probes.length){var t=this.getMaxProbeId(),e=t+1;this._dataTexture&&this._dataTexture.destroy();for(var i=new Float32Array(12*e),n=0,r=0;r<=t;r++){var s=this.getProbeById(r);if(s){if(s.probeType===lI.CUBE){i[n]=s.node.worldPosition.x,i[n+1]=s.node.worldPosition.y,i[n+2]=s.node.worldPosition.z,i[n+3]=0,i[n+4]=s.size.x,i[n+5]=s.size.y,i[n+6]=s.size.z,i[n+7]=0;var o=s.isRGBE()?1e3:0;i[n+8]=s.cubemap?s.cubemap.mipmapLevel+o:1+o}else i[n]=s.node.up.x,i[n+1]=s.node.up.y,i[n+2]=s.node.up.z,i[n+3]=1,i[n+4]=1,i[n+5]=1,i[n+6]=0,i[n+7]=0,i[n+8]=1;n+=12}else n+=12}var a=new Uint8Array(i.buffer),h=new $f({_data:a,_compressed:!1,width:12,height:e,format:Pf.RGBA8888});this._dataTexture=new Sg,this._dataTexture.setFilters(Sg.Filter.NONE,Sg.Filter.NONE),this._dataTexture.setMipFilter(Sg.Filter.NONE),this._dataTexture.setWrapMode(Sg.WrapMode.CLAMP_TO_EDGE,Sg.WrapMode.CLAMP_TO_EDGE,Sg.WrapMode.CLAMP_TO_EDGE),this._dataTexture.image=h,this._dataTexture.uploadData(a);for(var u=0;u<this._probes.length;u++)for(var c=this._probes[u],l=this._getModelsByProbe(c),_=0;_<l.length;_++){var d=l[_].node.getComponent(UV);d&&d.updateReflectionProbeDataMap(this._dataTexture)}}},e.getMaxProbeId=function(){return 0===this._probes.length?-1:1===this._probes.length?this._probes[0].getProbeId():(this._probes.sort((function(t,e){return t.getProbeId()-e.getProbeId()})),this._probes[this._probes.length-1].getProbeId())},e.getUsedReflectionProbe=function(t,e){if(e){if(this._usePlanarModels.has(t))return this._usePlanarModels.get(t)}else if(this._useCubeModels.has(t))return this._useCubeModels.get(t);return null},e.setReflectionProbe=function(t,e,i){void 0===i&&(i=null),e&&(this._useCubeModels.set(t,e),this._updateCubemapOfModel(t,e),i&&this._updateBlendProbeInfo(t,e,i))},e.updateProbeOfModels=function(){if(0!==this._probes.length){var t=m.director.getScene();if(t&&t.renderScene)for(var e=t.renderScene.models,i=0;i<e.length;i++){var n=e[i];n.node&&n.node.layer&dK&&(n.reflectionProbeType===pI.BAKED_CUBEMAP||n.reflectionProbeType===pI.PLANAR_REFLECTION||this._isUsedBlending(n))&&n.updateReflectionProbeId()}}},e._getNearestProbe=function(t){if(!t.node||!t.worldBounds||0===this._probes.length)return null;for(var e,i=null,n=1/0,r=d(this._probes);!(e=r()).done;){var s=e.value;if(s.probeType===lI.CUBE&&s.validate()&&ds.aabbWithAABB(t.worldBounds,s.boundingBox)){var o=_n.distance(t.node.worldPosition,s.node.worldPosition);o<n&&(n=o,i=s)}}return i},e._getBlendProbe=function(t){if(!t||!t.node||!t.worldBounds||this._probes.length<2)return null;for(var e=[],i=0;i<this._probes.length;i++)this._probes[i].probeType===lI.CUBE&&this._probes[i].validate()&&ds.aabbWithAABB(t.worldBounds,this._probes[i].boundingBox)&&e.push(this._probes[i]);return e.sort((function(e,i){return _n.distance(t.node.worldPosition,e.node.worldPosition)-_n.distance(t.node.worldPosition,i.node.worldPosition)})),e.length>1?e[1]:null},e._getModelsByProbe=function(t){var e=[],i=this._useCubeModels;t.probeType===lI.PLANAR&&(i=this._usePlanarModels);for(var n,r=d(i.entries());!(n=r()).done;){var s=n.value;s[1]===t&&e.push(s[0])}return e},e._removeDependentModels=function(t){for(var e,i=d(this._useCubeModels.keys());!(e=i()).done;){var n=e.value,r=this._useCubeModels.get(n);void 0!==r&&r===t&&(this._useCubeModels.delete(n),this.selectReflectionProbe(n))}for(var s,o=d(this._usePlanarModels.keys());!(s=o()).done;){var a=s.value,h=this._usePlanarModels.get(a);void 0!==h&&h===t&&(this._usePlanarModels.delete(a),this.selectPlanarReflectionProbe(a))}},e._updateCubemapOfModel=function(t,e){var i=t.node;if(i){var n=i.getComponent(UV);if(n&&(n.updateProbeCubemap(e?e.cubemap:null),n.updateReflectionProbeId(e&&e.cubemap?e.getProbeId():-1),e&&(n.updateReflectionProbeDataMap(this._dataTexture),this._isUsedBlending(t)))){var r=this._getBlendProbe(t);this._updateBlendProbeInfo(t,e,r)}}},e._updatePlanarMapOfModel=function(t,e,i){var n=t.node.getComponent(UV);n&&(n.updateProbePlanarMap(e),i?(n.updateReflectionProbeId(i.getProbeId()),n.updateReflectionProbeDataMap(this._dataTexture)):n.updateReflectionProbeId(-1))},e._isUsedBlending=function(t){return t.reflectionProbeType===pI.BLEND_PROBES||t.reflectionProbeType===pI.BLEND_PROBES_AND_SKYBOX},e._updateBlendProbeInfo=function(t,e,i){var n=t.node;if(n){var r=n.getComponent(UV);r&&(i?(r.updateReflectionProbeBlendId(i.getProbeId()),r.updateProbeBlendCubemap(i.cubemap),r.updateReflectionProbeBlendWeight(this._calculateBlendWeight(t,e,i))):(r.updateReflectionProbeBlendId(-1),t.reflectionProbeType===pI.BLEND_PROBES_AND_SKYBOX&&r.updateReflectionProbeBlendWeight(this._calculateBlendWeight(t,e,i))))}},e._updateBlendCubemap=function(t,e){var i=t.node;if(i&&this._isUsedBlending(t)){var n=i.getComponent(UV);n&&n.updateProbeBlendCubemap(e.cubemap)}},e._calculateBlendWeight=function(t,e,i){if(i){var n=_n.distance(t.node.worldPosition,e.node.worldPosition),r=_n.distance(t.node.worldPosition,i.node.worldPosition);return 1-r/(n+r)}return t.reflectionProbeType===pI.BLEND_PROBES?0:t.reflectionProbeType===pI.BLEND_PROBES_AND_SKYBOX?this._calculateBlendOfSkybox(t.worldBounds,e.boundingBox):0},e._calculateBlendOfSkybox=function(t,e){if(!t)return 1;var i=new _n,n=new _n,r=new _n,s=new _n;if(_n.subtract(i,t.center,t.halfExtents),_n.add(n,t.center,t.halfExtents),_n.subtract(r,e.center,e.halfExtents),_n.add(s,e.center,e.halfExtents),i.x<=s.x&&n.x>=r.x&&i.y<=s.y&&n.y>=r.y&&i.z<=s.z&&n.z>=r.z){var o=new _n;_n.multiplyScalar(o,t.halfExtents,2);var a=i.x+o.x<=s.x&&n.x+o.x>=r.x,h=i.x-o.x<=s.x&&n.x-o.x>=r.x,u=i.y+o.y<=s.y&&n.y+o.y>=r.y,c=i.y-o.y<=s.y&&n.y-o.y>=r.y,l=i.z+o.z<=s.z&&n.z+o.z>=r.z,_=i.z-o.z<=s.z&&n.z-o.z>=r.z,d=[];if(!a){var f=n.x-s.x;d.push(f/o.x)}if(!h){var p=Math.abs(i.x-r.x);d.push(p/o.x)}if(!u){var g=n.y-s.y;d.push(g/o.y)}if(!c){var m=Math.abs(i.y-r.y);d.push(m/o.y)}if(!l){var v=n.z-s.z;d.push(v/o.z)}if(!_){var y=Math.abs(i.z-r.z);d.push(y/o.z)}return d.length>0?(d.sort((function(t,e){return e-t})),d[0]):0}return 1},n(t,[{key:"updateForRuntime",get:function(){return this._updateForRuntime},set:function(t){this._updateForRuntime=t}}]),t}());function pK(t){return void 0===(t=t||{}).includeNormal&&(t.includeNormal=!0),void 0===t.includeUV&&(t.includeUV=!0),t}fK.probeManager=void 0,fK.probeManager=new fK,m.internal.reflectionProbeManager=fK.probeManager;var gK=new _n,mK=new _n,vK=new _n,yK=new _n,TK=new _n,EK=new _n,SK=new _n,AK=new _n,bK=new _n,CK=new _n,RK=new _n,wK=new _n,IK=new _n(0,0,0),xK=new _n(0,0,0);function DK(t,e,i,n){void 0===t&&(t=.5),void 0===e&&(e=.5),void 0===i&&(i=2),void 0===n&&(n={});var r=.5*i,s=n.radialSegments||32,o=n.heightSegments||1,a=void 0===n.capped||n.capped,h=n.arc||2*Math.PI,u=0;a&&(t>0&&u++,e>0&&u++);var c=(s+1)*(o+1);a&&(c+=(s+1)*u+s*u);var l=s*o*6;a&&(l+=s*u*3);var _=new Array(l),d=new Array(3*c),f=new Array(3*c),p=new Array(2*c),g=Math.max(t,e),m=new _n(-g,-r,-g),v=new _n(g,r,g),y=Math.sqrt(g*g+r*r),T=0,E=0;return function(){for(var n=[],a=t-e,u=a*a/i*Math.sign(a),c=0;c<=o;c++){for(var l=[],g=c/o,m=g*a+e,v=0;v<=s;++v){var y=v/s,S=y*h,A=Math.sin(S),b=Math.cos(S);d[3*T]=m*A,d[3*T+1]=g*i-r,d[3*T+2]=m*b,_n.normalize(IK,_n.set(xK,A,-u,b)),f[3*T]=IK.x,f[3*T+1]=IK.y,f[3*T+2]=IK.z,p[2*T]=2*(1-y)%1,p[2*T+1]=g,l.push(T),++T}n.push(l)}for(var C=0;C<o;++C)for(var R=0;R<s;++R){var w=n[C][R],I=n[C+1][R],x=n[C+1][R+1],D=n[C][R+1];_[E]=w,++E,_[E]=D,++E,_[E]=I,++E,_[E]=D,++E,_[E]=x,++E,_[E]=I,++E}}(),a&&(e>0&&S(!1),t>0&&S(!0)),{positions:d,normals:f,uvs:p,indices:_,minPos:m,maxPos:v,boundingRadius:y};function S(i){for(var n=i?t:e,o=i?1:-1,a=T,u=1;u<=s;++u)d[3*T]=0,d[3*T+1]=r*o,d[3*T+2]=0,f[3*T]=0,f[3*T+1]=o,f[3*T+2]=0,p[2*T]=.5,p[2*T+1]=.5,++T;for(var c=T,l=0;l<=s;++l){var g=l/s*h,m=Math.cos(g),v=Math.sin(g);d[3*T]=n*v,d[3*T+1]=r*o,d[3*T+2]=n*m,f[3*T]=0,f[3*T+1]=o,f[3*T+2]=0,p[2*T]=.5-.5*v*o,p[2*T+1]=.5+.5*m,++T}for(var y=0;y<s;++y){var S=a+y,A=c+y;i?(_[E]=A+1,++E,_[E]=S,++E,_[E]=A,++E):(_[E]=S,++E,_[E]=A+1,++E,_[E]=A,++E)}}}var OK=new _n(0,0,0),PK=new _n(0,0,0),MK=new _n(0,0,0),NK=new _n(0,0,0),LK=new _n(0,0,0),BK=new _n(0,0,0),FK=new _n(0,0,0),kK=new _n(0,0,0),UK=new _n(0,0,0),GK=Object.freeze({__proto__:null,box:function(t){var e=(t=t||{}).widthSegments||1,i=t.heightSegments||1,n=t.lengthSegments||1,r=(t.width||1)/2,s=(t.height||1)/2,o=(t.length||1)/2,a=[_n.set(TK,-r,-s,o),_n.set(EK,r,-s,o),_n.set(SK,r,s,o),_n.set(AK,-r,s,o),_n.set(bK,r,-s,-o),_n.set(CK,-r,-s,-o),_n.set(RK,-r,s,-o),_n.set(wK,r,s,-o)],h=[[2,3,1],[4,5,7],[7,6,2],[1,0,4],[1,4,2],[5,0,6]],u=[[0,0,1],[0,0,-1],[0,1,0],[0,-1,0],[1,0,0],[-1,0,0]],c=[[-1,0,0,1],[-1,0,0,1],[-1,0,0,1],[-1,0,0,1],[0,0,-1,1],[0,0,1,1]],l=[],_=[],d=[],f=[],p=[],g=new _n(-r,-s,-o),m=new _n(r,s,o),v=Math.sqrt(r*r+s*s+o*o);function y(t,e,i){var n,r,s,o,g=l.length/3,m=h[t],v=u[t],y=c[t];for(o=0;o<=i;o++)for(s=0;s<=e;s++)if(n=s/e,r=o/i,_n.lerp(gK,a[m[0]],a[m[1]],n),_n.lerp(mK,a[m[0]],a[m[2]],r),_n.subtract(vK,mK,a[m[0]]),_n.add(yK,gK,vK),l.push(yK.x,yK.y,yK.z),_.push(v[0],v[1],v[2]),d.push(n,r),f.push(y[0],y[1],y[2],y[3]),s<e&&o<i){var T=e+1,E=s+o*T,S=s+(o+1)*T,A=s+1+(o+1)*T,b=s+1+o*T;p.push(g+E,g+b,g+S),p.push(g+S,g+b,g+A)}}return y(0,e,i),y(4,n,i),y(1,e,i),y(5,n,i),y(3,e,n),y(2,e,n),{positions:l,normals:_,uvs:d,tangents:f,indices:p,minPos:g,maxPos:m,boundingRadius:v}},cone:function(t,e,i){return void 0===t&&(t=.5),void 0===e&&(e=1),void 0===i&&(i={}),DK(0,t,e,i)},cylinder:DK,plane:function(t){var e=function(t){return(t=pK(t)).width=t.width||10,t.length=t.length||10,t.widthSegments=t.widthSegments||10,t.lengthSegments=t.lengthSegments||10,t}(t),i=e.width,n=e.length,r=e.widthSegments,s=e.lengthSegments,o=.5*i,a=.5*n,h=[],u=[],c=[],l=new _n(-o,0,-a),_=new _n(o,0,a),d=Math.sqrt(i*i+n*n);_n.set(LK,-o,0,a),_n.set(BK,o,0,a),_n.set(FK,-o,0,-a);for(var f=0;f<=s;f++)for(var p=0;p<=r;p++){var g=p/r,m=f/s;if(_n.lerp(OK,LK,BK,g),_n.lerp(PK,LK,FK,m),_n.subtract(MK,PK,LK),_n.add(NK,OK,MK),h.push(NK.x,NK.y,NK.z),e.includeUV&&u.push(g,m),p<r&&f<s){var v=r+1,y=p+f*v,T=p+(f+1)*v,E=p+1+(f+1)*v,S=p+1+f*v;c.push(y,S,T),c.push(S,E,T)}}var A={positions:h,indices:c,minPos:l,maxPos:_,boundingRadius:d};if(e.includeNormal){var b=(s+1)*(r+1),C=new Array(3*b);A.normals=C;for(var R=0;R<b;++R)C[3*R+0]=0,C[3*R+1]=1,C[3*R+2]=0}return e.includeUV&&(A.uvs=u),A},quad:function(t){var e=pK(t),i={positions:[-.5,-.5,0,-.5,.5,0,.5,.5,0,.5,-.5,0],indices:[0,3,1,3,2,1],minPos:{x:-.5,y:-.5,z:0},maxPos:{x:.5,y:.5,z:0},boundingRadius:Math.sqrt(.5)};return!1!==e.includeNormal&&(i.normals=[0,0,1,0,0,1,0,0,1,0,0,1]),!1!==e.includeUV&&(i.uvs=[0,0,0,1,1,1,1,0]),i},sphere:function(t,e){void 0===t&&(t=.5),void 0===e&&(e={});for(var i=void 0!==e.segments?e.segments:32,n=[],r=[],s=[],o=[],a=new _n(-t,-t,-t),h=new _n(t,t,t),u=t,c=0;c<=i;++c)for(var l=c*Math.PI/i,_=Math.sin(l),d=-Math.cos(l),f=0;f<=i;++f){var p=2*f*Math.PI/i-Math.PI/2,g=Math.sin(p)*_,m=d,v=Math.cos(p)*_,y=f/i,T=c/i;if(n.push(g*t,m*t,v*t),r.push(g,m,v),s.push(y,T),c<i&&f<i){var E=i+1,S=E*c+f,A=E*(c+1)+f,b=E*(c+1)+f+1,C=E*c+f+1;o.push(S,C,A),o.push(C,b,A)}}return{positions:n,indices:o,normals:r,uvs:s,minPos:a,maxPos:h,boundingRadius:u}},torus:function(t,e,i){void 0===t&&(t=.4),void 0===e&&(e=.1),void 0===i&&(i={});for(var n=i.radialSegments||32,r=i.tubularSegments||32,s=i.arc||2*Math.PI,o=[],a=[],h=[],u=[],c=new _n(-t-e,-e,-t-e),l=new _n(t+e,e,t+e),_=t+e,d=0;d<=n;d++)for(var f=0;f<=r;f++){var p=f/r,g=d/n,m=p*s,v=g*Math.PI*2,y=(t+e*Math.cos(v))*Math.sin(m),T=e*Math.sin(v),E=(t+e*Math.cos(v))*Math.cos(m),S=Math.sin(m)*Math.cos(v),A=Math.sin(v),b=Math.cos(m)*Math.cos(v);if(o.push(y,T,E),a.push(S,A,b),h.push(p,g),f<r&&d<n){var C=r+1,R=C*d+f,w=C*(d+1)+f,I=C*(d+1)+f+1,x=C*d+f+1;u.push(R,x,w),u.push(x,I,w)}}return{positions:o,normals:a,uvs:h,indices:u,minPos:c,maxPos:l,boundingRadius:_}},capsule:function(t,e,i,n){void 0===t&&(t=.5),void 0===e&&(e=.5),void 0===i&&(i=2),void 0===n&&(n={});var r=i-t-e,s=n.sides||32,o=n.heightSegments||32,a=e/i,h=r/i,u=t/i,c=Math.floor(o*a),l=Math.floor(o*u),_=Math.floor(o*h),d=r+e-i/2,f=e-i/2,p=e-i/2,g=n.arc||2*Math.PI,m=[],v=[],y=[],T=[],E=Math.max(t,e),S=new _n(-E,-i/2,-E),A=new _n(E,i/2,E),b=i/2,C=0,R=[];return function(){for(var t=0;t<=c;++t)for(var i=t*Math.PI/c/2,n=Math.sin(i),r=-Math.cos(i),a=0;a<=s;++a){var h=2*a*Math.PI/s-Math.PI/2,u=Math.sin(h)*n,l=r,_=Math.cos(h)*n,d=a/s,f=t/o;if(m.push(u*e,l*e+p,_*e),v.push(u,l,_),y.push(d,f),t<c&&a<s){var g=s+1,E=g*t+a,S=g*(t+1)+a,A=g*(t+1)+a+1,b=g*t+a+1;T.push(E,b,S),T.push(b,A,S)}++C}}(),function(){for(var i=(t-e)/r,n=0;n<=_;n++){for(var o=[],u=n/_,c=u*(t-e)+e,l=0;l<=s;++l){var d=l/s,p=u*h+a,E=d*g-g/4,S=Math.sin(E),A=Math.cos(E);m.push(c*S),m.push(u*r+f),m.push(c*A),_n.normalize(kK,_n.set(UK,S,-i,A)),v.push(kK.x),v.push(kK.y),v.push(kK.z),y.push(d,p),o.push(C),++C}R.push(o)}for(var b=0;b<_;++b)for(var w=0;w<s;++w){var I=R[b][w],x=R[b+1][w],D=R[b+1][w+1],O=R[b][w+1];T.push(I),T.push(O),T.push(x),T.push(O),T.push(D),T.push(x)}}(),function(){for(var e=0;e<=l;++e)for(var i=e*Math.PI/l/2+Math.PI/2,n=Math.sin(i),r=-Math.cos(i),a=0;a<=s;++a){var h=2*a*Math.PI/s-Math.PI/2,c=Math.sin(h)*n,f=r,p=Math.cos(h)*n,g=a/s,E=e/o+(1-u);if(m.push(c*t,f*t+d,p*t),v.push(c,f,p),y.push(g,E),e<l&&a<s){var S=s+1,A=S*e+a+R[_][s]+1,b=S*(e+1)+a+R[_][s]+1,C=S*(e+1)+a+1+R[_][s]+1,w=S*e+a+1+R[_][s]+1;T.push(A,w,b),T.push(w,C,b)}}}(),{positions:m,normals:v,uvs:y,indices:T,minPos:S,maxPos:A,boundingRadius:b}},circle:function(t){var e=function(t){return(t=pK(t)).segments=64,t}(t).segments,i=new Array(3*(e+1));i[0]=0,i[1]=0,i[2]=0;var n=new Array(1+2*e);n[0]=0;for(var r=2*Math.PI/e,s=0;s<e;++s){var o=r*s,a=Math.cos(o),h=Math.sin(o),u=3*(s+1);i[u+0]=a,i[u+1]=h,i[u+2]=0;var c=2*s;n[1+c]=s+1,n[1+(c+1)]=s+2}return e>0&&(n[n.length-1]=1),{positions:i,indices:n,minPos:{x:1,y:1,z:0},maxPos:{x:-1,y:-1,z:0},boundingRadius:1,primitiveMode:Hl.TRIANGLE_FAN}},translate:function(t,e){for(var i=e.x||0,n=e.y||0,r=e.z||0,s=Math.floor(t.positions.length/3),o=0;o<s;++o){var a=3*o,h=3*o+1,u=3*o+2;t.positions[a]+=i,t.positions[h]+=n,t.positions[u]+=r}return t.minPos&&(t.minPos.x+=i,t.minPos.y+=n,t.minPos.z+=r),t.maxPos&&(t.maxPos.x+=i,t.maxPos.y+=n,t.maxPos.z+=r),t},scale:function(t,e){for(var i,n,r,s=null!==(i=e.x)&&void 0!==i?i:1,o=null!==(n=e.y)&&void 0!==n?n:1,a=null!==(r=e.z)&&void 0!==r?r:1,h=Math.floor(t.positions.length/3),u=0;u<h;++u){var c=3*u,l=3*u+1,_=3*u+2;t.positions[c]*=s,t.positions[l]*=o,t.positions[_]*=a}var d=t.minPos,f=t.maxPos;if(d&&(d.x*=s,d.y*=o,d.z*=a),f&&(f.x*=s,f.y*=o,f.z*=a),d&&f){if(s<0){var p=d.x;d.x=f.x,f.x=p}if(o<0){var g=d.y;d.y=f.y,f.y=g}if(a<0){var m=d.z;d.z=f.z,f.z=m}}return void 0!==t.boundingRadius&&(t.boundingRadius*=Math.max(Math.max(Math.abs(s),Math.abs(o)),Math.abs(a))),t},wireframed:function(t){var e=t.indices;if(!e)return t;if(t.primitiveMode&&t.primitiveMode!==Hl.TRIANGLE_LIST)return t;for(var i=[[0,1],[1,2],[2,0]],n=[],r={},s=0;s<e.length;s+=3)for(var o=0;o<3;++o){var a=e[s+i[o][0]],h=e[s+i[o][1]],u=a>h?h<<16|a:a<<16|h;void 0===r[u]&&(r[u]=0,n.push(a,h))}return t.indices=n,t.primitiveMode=Hl.LINE_LIST,t},wireframe:function(t){for(var e=[[0,1],[1,2],[2,0]],i=[],n={},r=0;r<t.length;r+=3)for(var s=0;s<3;++s){var o=t[r+e[s][0]],a=t[r+e[s][1]],h=o>a?a<<16|o:o<<16|a;void 0===n[h]&&(n[h]=0,i.push(o,a))}return i},invWinding:function(t){for(var e=[],i=0;i<t.length;i+=3)e.push(t[i],t[i+2],t[i+1]);return e},toWavefrontOBJ:function(t,e){if(void 0===e&&(e=1),!t.indices||!t.uvs||!t.normals||void 0!==t.primitiveMode&&t.primitiveMode!==Hl.TRIANGLE_LIST)return"";for(var i=t.positions,n=t.uvs,r=t.normals,s=t.indices,o=function(t){return s[t]+1+"/"+(s[t]+1)+"/"+(s[t]+1)},a="",h=0;h<i.length;h+=3)a+="v "+i[h]*e+" "+i[h+1]*e+" "+i[h+2]*e+"\n";for(var u=0;u<n.length;u+=2)a+="vt "+n[u]+" "+n[u+1]+"\n";for(var c=0;c<r.length;c+=3)a+="vn "+r[c]+" "+r[c+1]+" "+r[c+2]+"\n";for(var l=0;l<s.length;l+=3)a+="f "+o(l)+" "+o(l+1)+" "+o(l+2)+"\n";return a},normals:function(t,e,i){void 0===i&&(i=1);for(var n=new Array(2*t.length),r=0;r<t.length/3;++r){var s=3*r,o=6*r;n[o+0]=t[s+0],n[o+1]=t[s+1],n[o+2]=t[s+2],n[o+3]=t[s+0]+e[s+0]*i,n[o+4]=t[s+1]+e[s+1]*i,n[o+5]=t[s+2]+e[s+2]*i}return n},applyDefaultGeometryOptions:pK});t("primitives",GK);var HK=new _n;function zK(t){return t.x=Math.abs(t.x),t.y=Math.abs(t.y),t.z=Math.abs(t.z),t}var VK,WK,XK,jK,YK,KK,qK,QK,ZK,JK,$K,tq,eq,iq,nq,rq,sq,oq,aq,hq,uq,cq,lq,_q,dq=Object.freeze({__proto__:null,setWrap:function(t,e){t.__cc_wrapper__=e},getWrap:function(t){return t.__cc_wrapper__},maxComponent:function(t){return Math.max(t.x,Math.max(t.y,t.z))},VEC3_0:HK,TriggerEventObject:{type:"onTriggerEnter",selfCollider:null,otherCollider:null,impl:null},CharacterTriggerEventObject:{type:"onControllerTriggerEnter",collider:null,characterController:null,impl:null},CollisionEventObject:{type:"onCollisionEnter",selfCollider:null,otherCollider:null,contacts:[],impl:null},shrinkPositions:function(t){var e=[],i={};if(t.length>=3){e[0]=t[0],e[1]=t[1],e[2]=t[2];for(var n=t.length,r=3;r<n;r+=3){var s=t[r],o=t[r+1],a=t[r+2],h=String(s)+String(o)+String(a),u=nl(h,666);i[u]!==h&&(i[u]=h,e.push(s),e.push(o),e.push(a))}}return e},absolute:zK,cylinder:DK});!function(t){t[t.Low_256x256=256]="Low_256x256",t[t.Medium_512x512=512]="Medium_512x512",t[t.High_768x768=768]="High_768x768"}(_q||(_q={})),t("ReflectionProbe",(VK=va("cc.ReflectionProbe"),WK=Za(_n),XK=Za(ye(lI)),jK=Za(ye(_q)),YK=Za(ye(cI)),KK=Za(yn),qK=Za(Rg.BitMask),QK=Za(Lk),ZK=Za($e),JK=Za(Em),VK(((lq=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)._lastSize=new _n,e._resolution=eq&&eq(),e._clearFlag=iq&&iq(),e._backgroundColor=nq&&nq(),e._visibility=rq&&rq(),e._probeType=sq&&sq(),e._cubemap=oq&&oq(),e._size=aq&&aq(),e._sourceCamera=hq&&hq(),e._probeId=uq&&uq(),e._fastBake=cq&&cq(),e._probe=null,e._previewSphere=null,e._previewPlane=null,e._sourceCameraPos=new _n(0,0,0),e._position=new _n(0,0,0),e}s(e,t);var i=e.prototype;return i.onLoad=function(){this._createProbe()},i.onEnable=function(){if(this._probe){var t=fK.probeManager.getProbeById(this._probeId);null!==t&&t!==this._probe&&(this._probeId=fK.probeManager.getNewReflectionProbeId(),this._probe.updateProbeId(this._probeId)),fK.probeManager.register(this._probe),fK.probeManager.onUpdateProbes(),this._probe.enable()}},i.onDisable=function(){this._probe&&(fK.probeManager.unregister(this._probe),this._probe.disable())},i.start=function(){this._sourceCamera&&this.probeType===lI.PLANAR&&(this.probe.renderPlanarReflection(this.sourceCamera.camera),fK.probeManager.filterModelsForPlanarReflection()),fK.probeManager.updateProbeData(),this._position=this.node.getWorldPosition().clone()},i.onDestroy=function(){this.probe&&this.probe.destroy()},i.update=function(){if(this.probe){this.probeType===lI.PLANAR&&this.sourceCamera&&(this.sourceCamera.node.hasChangedFlags&Ig.TRS||!this._sourceCameraPos.equals(this.sourceCamera.node.getWorldPosition()))&&(this._sourceCameraPos=this.sourceCamera.node.getWorldPosition(),this.probe.renderPlanarReflection(this.sourceCamera.camera)),this.node.hasChangedFlags&Ig.POSITION&&(this.probe.updateBoundingBox(),fK.probeManager.onUpdateProbes(),fK.probeManager.updateProbeData());var t=this.node.getWorldPosition();this._position.equals(t)||(this._position=t,this.probe.updateBoundingBox(),fK.probeManager.updateProbeData(),fK.probeManager.updateProbeOfModels())}},i.clearBakedCubemap=function(){this.cubemap=null,fK.probeManager.updateBakedCubemap(this.probe),fK.probeManager.updatePreviewSphere(this.probe)},i._createProbe=function(){if((-1===this._probeId||fK.probeManager.exists(this._probeId))&&(this._probeId=fK.probeManager.getNewReflectionProbeId()),this._probe=new mI(this._probeId),this._probe){var t=new Tm("ReflectionProbeCamera");t.hideFlags|=qs.Flags.DontSave|qs.Flags.HideInHierarchy,this.node.scene.addChild(t),this._probe.initialize(this.node,t),this.enabled&&fK.probeManager.register(this._probe),this._probe.resolution=this._resolution,this._probe.clearFlag=this._clearFlag,this._probe.backgroundColor=this._backgroundColor,this._probe.visibility=this._visibility,this._probe.probeType=this._probeType,this._probe.size=this._size,this._probe.cubemap=this._cubemap}},n(e,[{key:"size",get:function(){return this._size},set:function(t){this._size.set(t),zK(this._size),this.probe.size=this._size,this.probe&&(this.probe.updateBoundingBox(),fK.probeManager.onUpdateProbes(),fK.probeManager.updateProbeData(),fK.probeManager.updateProbeOfModels())}},{key:"probeType",get:function(){return this._probeType},set:function(t){if(this.probe.probeType=t,t!==this._probeType){var i=this._size.clone(),n=_n.equals(this._lastSize,_n.ZERO);this._probeType=t,this._probeType===lI.CUBE?(n&&this._size.set(e.DEFAULT_CUBE_SIZE),this.probe.switchProbeType(t,null),fK.probeManager.clearPlanarReflectionMap(this.probe)):(n&&this._size.set(e.DEFAULT_PLANER_SIZE),this._sourceCamera?this.probe.switchProbeType(t,this._sourceCamera.camera):F("the reflection camera is invalid, please set the reflection camera")),n||this._size.set(this._lastSize),this._lastSize.set(i),this.size=this._size}}},{key:"resolution",get:function(){return this._resolution},set:function(t){this._resolution=t,this.probe.resolution=t}},{key:"clearFlag",get:function(){return this._clearFlag},set:function(t){this._clearFlag=t,this.probe.clearFlag=this._clearFlag}},{key:"backgroundColor",get:function(){return this._backgroundColor},set:function(t){this._backgroundColor=t,this.probe.backgroundColor=this._backgroundColor}},{key:"visibility",get:function(){return this._visibility},set:function(t){this._visibility=t,this.probe.visibility=this._visibility}},{key:"sourceCamera",get:function(){return this._sourceCamera},set:function(t){this._sourceCamera=t,t&&(this.visibility=t.visibility,this.clearFlag=t.clearFlags,this.backgroundColor=t.clearColor,this.probeType===lI.PLANAR&&this.probe.switchProbeType(this.probeType,t.camera))}},{key:"fastBake",get:function(){return this._fastBake},set:function(t){this._fastBake=t}},{key:"cubemap",get:function(){return this._cubemap},set:function(t){this._cubemap=t,this.probe.cubemap=t,fK.probeManager.onUpdateProbes()}},{key:"probe",get:function(){return this._probe}},{key:"previewSphere",get:function(){return this._previewSphere},set:function(t){this._previewSphere=t,this.probe&&(this.probe.previewSphere=t,this._previewSphere&&fK.probeManager.updatePreviewSphere(this.probe))}},{key:"previewPlane",get:function(){return this._previewPlane},set:function(t){this._previewPlane=t,this.probe&&(this.probe.previewPlane=t,this._previewPlane&&fK.probeManager.updatePreviewPlane(this.probe))}}]),e}(xp)).DEFAULT_CUBE_SIZE=new _n(1,1,1),lq.DEFAULT_PLANER_SIZE=new _n(5,.5,5),eq=ua((tq=lq).prototype,"_resolution",[wa],(function(){return 256})),iq=ua(tq.prototype,"_clearFlag",[wa],(function(){return cI.SKYBOX})),nq=ua(tq.prototype,"_backgroundColor",[wa],(function(){return new yn(0,0,0,255)})),rq=ua(tq.prototype,"_visibility",[wa],(function(){return my})),sq=ua(tq.prototype,"_probeType",[wa],(function(){return lI.CUBE})),oq=ua(tq.prototype,"_cubemap",[wa],(function(){return null})),aq=ua(tq.prototype,"_size",[wa],(function(){return new _n(1,1,1)})),hq=ua(tq.prototype,"_sourceCamera",[wa],(function(){return null})),uq=ua(tq.prototype,"_probeId",[wa],(function(){return-1})),cq=ua(tq.prototype,"_fastBake",[wa],(function(){return!1})),f(tq.prototype,"size",[WK],Object.getOwnPropertyDescriptor(tq.prototype,"size"),tq.prototype),f(tq.prototype,"probeType",[XK],Object.getOwnPropertyDescriptor(tq.prototype,"probeType"),tq.prototype),f(tq.prototype,"resolution",[jK],Object.getOwnPropertyDescriptor(tq.prototype,"resolution"),tq.prototype),f(tq.prototype,"clearFlag",[YK],Object.getOwnPropertyDescriptor(tq.prototype,"clearFlag"),tq.prototype),f(tq.prototype,"backgroundColor",[KK],Object.getOwnPropertyDescriptor(tq.prototype,"backgroundColor"),tq.prototype),f(tq.prototype,"visibility",[qK],Object.getOwnPropertyDescriptor(tq.prototype,"visibility"),tq.prototype),f(tq.prototype,"sourceCamera",[QK],Object.getOwnPropertyDescriptor(tq.prototype,"sourceCamera"),tq.prototype),f(tq.prototype,"fastBake",[ZK],Object.getOwnPropertyDescriptor(tq.prototype,"fastBake"),tq.prototype),f(tq.prototype,"cubemap",[JK],Object.getOwnPropertyDescriptor(tq.prototype,"cubemap"),tq.prototype),$K=tq))||$K)),m.utils=_P;var fq,pq,gq,mq,vq,yq=Symbol("CreateEval");va("cc.animation.EmbeddedPlayer")((fq=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).begin=pq&&pq(),e.end=gq&&gq(),e.reconciledSpeed=mq&&mq(),e.playable=vq&&vq(),e}return s(e,t),e}(uh),pq=ua(fq.prototype,"begin",[wa],(function(){return 0})),gq=ua(fq.prototype,"end",[wa],(function(){return 0})),mq=ua(fq.prototype,"reconciledSpeed",[wa],(function(){return!1})),vq=ua(fq.prototype,"playable",[wa],(function(){return null})),fq));var Tq,Eq=function(){},Sq=function(){function t(t){this._randomAccess=t}return t.prototype.setTime=function(){},n(t,[{key:"randomAccess",get:function(){return this._randomAccess}}]),t}(),Aq=function(){function t(){this._isPlaying=!1,this._isPaused=!1,this._stepOnce=!1}var e=t.prototype;return e.play=function(){this._isPlaying?this._isPaused?(this._isPaused=!1,this.onResume()):this.onError(et(3912)):(this._isPlaying=!0,this.onPlay())},e.stop=function(){this._isPlaying&&(this._isPlaying=!1,this.onStop(),this._isPaused=!1)},e.pause=function(){this._isPlaying&&!this._isPaused&&(this._isPaused=!0,this.onPause())},e.resume=function(){this._isPlaying&&this._isPaused&&(this._isPaused=!1,this.onResume())},e.step=function(){this.pause(),this._stepOnce=!0,this._isPlaying||this.play()},e.update=function(){},e.onPlay=function(){},e.onPause=function(){},e.onResume=function(){},e.onStop=function(){},e.onError=function(){},n(t,[{key:"isPlaying",get:function(){return this._isPlaying}},{key:"isPaused",get:function(){return this._isPaused}},{key:"isMotionless",get:function(){return!this.isPlaying||this.isPaused}}]),t}();!function(t){t[t.Default=bc.Default]="Default",t[t.Normal=bc.Normal]="Normal",t[t.Reverse=bc.Reverse]="Reverse",t[t.Loop=bc.Loop]="Loop",t[t.LoopReverse=bc.Loop|bc.Reverse]="LoopReverse",t[t.PingPong=bc.PingPong]="PingPong",t[t.PingPongReverse=bc.PingPong|bc.Reverse]="PingPongReverse"}(Tq||(Tq={})),Se(Tq);var bq,Cq=function(){function t(t){this.ratio=0,this.time=0,this.direction=1,this.stopped=!0,this.iterations=0,this.frameIndex=void 0,t&&this.set(t)}return t.prototype.set=function(t){this.ratio=t.ratio,this.time=t.time,this.direction=t.direction,this.stopped=t.stopped,this.iterations=t.iterations,this.frameIndex=t.frameIndex},t}(),Rq=function(){function t(t){this.weight=0,this._pose=void 0,this._blendStateWriters=[],this._pose=t}var e=t.prototype;return e.destroy=function(){for(var t=0;t<this._blendStateWriters.length;++t)this._pose.destroyWriter(this._blendStateWriters[t]);this._blendStateWriters.length=0},e.createPoseWriter=function(t,e,i){var n=this._pose.createWriter(t,e,this,i);return this._blendStateWriters.push(n),n},t}();function wq(){return m.director.getAnimationManager()}!function(t){t.PLAY="play",t.STOP="stop",t.PAUSE="pause",t.RESUME="resume",t.LASTFRAME="lastframe",t.FINISHED="finished"}(bq||(bq={})),Se(bq);var Iq,xq,Dq,Oq=t("AnimationState",function(t){function e(e,i){var n;return void 0===i&&(i=""),(n=t.call(this)||this).duration=1,n.time=0,n.frameRate=0,n._targetNode=null,n._curveLoaded=!1,n._clip=void 0,n._speed=1,n._useSimpleProcess=!1,n._target=null,n._wrapMode=Tq.Normal,n._repeatCount=1,n._delay=0,n._delayTime=0,n._currentFramePlayed=!1,n._name=void 0,n._lastIterations=NaN,n._lastWrapInfo=null,n._wrappedInfo=new Cq,n._allowLastFrame=!1,n._blendStateWriterHost={weight:0},n._playbackDuration=0,n._invDuration=1,n._poseOutput=null,n._weight=1,n._clipEval=void 0,n._clipEventEval=void 0,n._clipEmbeddedPlayerEval=void 0,n._doNotCreateEval=!1,n._clip=e,n._name=i||e&&e.name,n._playbackRange={min:0,max:e.duration},n._playbackDuration=e.duration,e.duration||G("Clip "+e.name+" has zero duration."),n}s(e,t);var i=e.prototype;return i.initialize=function(t,e,i){if(!this._curveLoaded){this._curveLoaded=!0,this._poseOutput&&(this._poseOutput.destroy(),this._poseOutput=null),this._clipEval&&(this._clipEval=void 0),this._clipEventEval&&(this._clipEventEval=void 0),this._clipEmbeddedPlayerEval&&(this._clipEmbeddedPlayerEval.destroy(),this._clipEmbeddedPlayerEval=void 0),this._targetNode=t;var n=this._clip;if(this.duration=n.duration,this._invDuration=1/this.duration,this._speed=n.speed,this.wrapMode=n.wrapMode,this.frameRate=n.sample,this._playbackRange.min=0,this._playbackRange.max=n.duration,this._playbackDuration=n.duration,(this.wrapMode&bc.Loop)===bc.Loop?this.repeatCount=1/0:this.repeatCount=1,!this._doNotCreateEval){var r,s,o,a=null!==(r=null!=e?e:null===(s=wq())||void 0===s?void 0:s.blendState)&&void 0!==r?r:null;a&&(this._poseOutput=new Rq(a)),this._clipEval=n.createEvaluator({target:t,pose:null!==(o=this._poseOutput)&&void 0!==o?o:void 0,mask:i})}n.containsAnyEvent()&&(this._clipEventEval=n.createEventEvaluator(this._targetNode)),n.containsAnyEmbeddedPlayer()&&(this._clipEmbeddedPlayerEval=n.createEmbeddedPlayerEvaluator(this._targetNode),this._clipEmbeddedPlayerEval.notifyHostSpeedChanged(this._speed))}},i.destroy=function(){this.isMotionless||wq().removeAnimation(this),this._poseOutput&&(this._poseOutput.destroy(),this._poseOutput=null),this._clipEval=void 0},i.emit=function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];wq().pushDelayEvent(this._emit,this,e)},i.on=function(t,e,i){return this._target&&this._target.isValid?this._target.on(t,e,i):null},i.once=function(t,e,i){return this._target&&this._target.isValid?this._target.once(t,e,i):null},i.off=function(t,e,i){this._target&&this._target.isValid&&this._target.off(t,e,i)},i.allowLastFrameEvent=function(t){this._allowLastFrame=t},i._setEventTarget=function(t){this._target=t},i.setTime=function(t){this._currentFramePlayed=!1,this.time=t||0;var e,i=this.getWrappedInfo(t,this._wrappedInfo);null===(e=this._clipEventEval)||void 0===e||e.ignore(i.ratio,i.direction)},i.update=function(t){this._delayTime>0&&(this._delayTime-=t,this._delayTime>0)||(this._currentFramePlayed?this.time+=t*this._speed:this._currentFramePlayed=!0,this._process())},i.sample=function(){var t=this.getWrappedInfo(this.time,this._wrappedInfo);return this._sampleCurves(t.time),this._sampleEvents(t),this._sampleEmbeddedPlayers(t),t},i.onPlay=function(){var t;this.setTime(this._getPlaybackStart()),this._delayTime=this._delay,this._onReplayOrResume(),this.emit(bq.PLAY,this),null===(t=this._clipEmbeddedPlayerEval)||void 0===t||t.notifyHostPlay(this.current)},i.onStop=function(){var t;this.isPaused||this._onPauseOrStop(),this.emit(bq.STOP,this),null===(t=this._clipEmbeddedPlayerEval)||void 0===t||t.notifyHostStop()},i.onResume=function(){var t;this._onReplayOrResume(),this.emit(bq.RESUME,this),null===(t=this._clipEmbeddedPlayerEval)||void 0===t||t.notifyHostPlay(this.current)},i.onPause=function(){var t;this._onPauseOrStop(),this.emit(bq.PAUSE,this),null===(t=this._clipEmbeddedPlayerEval)||void 0===t||t.notifyHostPause(this.current)},i._sampleCurves=function(t){var e=this._poseOutput,i=this._clipEval;e&&(e.weight=this.weight),i&&i.evaluate(t)},i._process=function(){this._useSimpleProcess?this.simpleProcess():this.process()},i.process=function(){var t,e=this.sample();this._allowLastFrame&&(t=this._lastWrapInfo?this._lastWrapInfo:this._lastWrapInfo=new Cq(e),this.repeatCount>1&&(0|e.iterations)>(0|t.iterations)&&this.emit(bq.LASTFRAME,this),t.set(e)),e.stopped&&(this.stop(),this.emit(bq.FINISHED,this))},i.simpleProcess=function(){var t=this._playbackRange.min,e=this._playbackDuration,i=0,n=0;if(0!==e&&((i=this.time%e)<0&&(i+=e),n=(t+i)*this._invDuration),this._sampleCurves(t+i),this._clipEventEval||this._clipEmbeddedPlayerEval){var r=this.getWrappedInfo(this.time,this._wrappedInfo);this._sampleEvents(r),this._sampleEmbeddedPlayers(r)}this._allowLastFrame&&(Number.isNaN(this._lastIterations)&&(this._lastIterations=n),(this.time>0&&this._lastIterations>n||this.time<0&&this._lastIterations<n)&&this.emit(bq.LASTFRAME,this),this._lastIterations=n)},i._needReverse=function(t){var e=this.wrapMode,i=!1;return(e&bc.PingPong)===bc.PingPong&&(t-(0|t)==0&&t>0&&(t-=1),1&t&&(i=!i)),(e&bc.Reverse)===bc.Reverse&&(i=!i),i},i.getWrappedInfo=function(t,e){e=e||new Cq;var i=this._playbackRange.min,n=this._playbackDuration,r=this.repeatCount;if(0===n)return e.time=0,e.ratio=0,e.direction=1,e.stopped=!!Number.isFinite(r),e.iterations=0,e;var s=!1,o=(t-=i)>0?t/n:-t/n;if(o>=r){o=r,s=!0;var a=r-(0|r);0===a&&(a=1),t=a*n*(t>0?1:-1)}if(t>n){var h=t%n;t=0===h?n:h}else t<0&&0!=(t%=n)&&(t+=n);var u=!1,c=this._wrapMode&bc.ShouldWrap;c&&(u=this._needReverse(o));var l=u?-1:1;return this.speed<0&&(l*=-1),c&&u&&(t=n-t),e.time=i+t,e.ratio=e.time/this.duration,e.direction=l,e.stopped=s,e.iterations=o,e},i._getPlaybackStart=function(){return this._playbackRange.min},i._sampleEvents=function(t){var e;null===(e=this._clipEventEval)||void 0===e||e.sample(t.ratio,t.direction,t.iterations)},i._sampleEmbeddedPlayers=function(t){var e;null===(e=this._clipEmbeddedPlayerEval)||void 0===e||e.evaluate(t.time,Math.trunc(t.iterations))},i._emit=function(t,e){this._target&&this._target.isValid&&this._target.emit(t,t,e)},i._onReplayOrResume=function(){wq().addAnimation(this)},i._onPauseOrStop=function(){wq().removeAnimation(this)},n(e,[{key:"clip",get:function(){return this._clip}},{key:"name",get:function(){return this._name}},{key:"length",get:function(){return this.duration}},{key:"wrapMode",get:function(){return this._wrapMode},set:function(t){var e;this._wrapMode=t,this.time=0,t&bc.Loop?this.repeatCount=1/0:this.repeatCount=1,null===(e=this._clipEventEval)||void 0===e||e.setWrapMode(t)}},{key:"repeatCount",get:function(){return this._repeatCount},set:function(t){this._repeatCount=t;var e=this._wrapMode&bc.ShouldWrap,i=(this.wrapMode&bc.Reverse)===bc.Reverse;this._useSimpleProcess=t===1/0&&!e&&!i}},{key:"delay",get:function(){return this._delay},set:function(t){this._delayTime=this._delay=t}},{key:"playbackRange",get:function(){return this._playbackRange},set:function(t){t.max,t.min,this._playbackRange.min=Math.max(t.min,0),this._playbackRange.max=Math.min(t.max,this.duration),this._playbackDuration=this._playbackRange.max-this._playbackRange.min,this.setTime(0)}},{key:"speed",get:function(){return this._speed},set:function(t){var e;this._speed=t,null===(e=this._clipEmbeddedPlayerEval)||void 0===e||e.notifyHostSpeedChanged(t)}},{key:"current",get:function(){return this.getWrappedInfo(this.time).time}},{key:"ratio",get:function(){return 0===this.duration?0:this.current/this.duration}},{key:"weight",get:function(){return this._weight},set:function(t){this._weight=t,this._poseOutput&&(this._poseOutput.weight=t)}},{key:"curveLoaded",get:function(){return this._curveLoaded}}]),e}(Aq));m.AnimationState=Oq,va("cc.animation.EmbeddedAnimationClipPlayable")((Iq=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).path=xq&&xq(),e.clip=Dq&&Dq(),e}return s(e,t),e.prototype.instantiate=function(t){var e=this.clip,i=this.path;if(!e)return null;var n=t.getChildByPath(i);if(!n)return Z(3938,i,t.getPathInHierarchy(),e.name),null;var r=new Oq(e);return r.initialize(n),new Nq(r)},e}(Eq),xq=ua(Iq.prototype,"path",[wa],(function(){return""})),Dq=ua(Iq.prototype,"clip",[wa],(function(){return null})),Iq));var Pq,Mq,Nq=function(t){function e(e){var i;return(i=t.call(this,!0)||this)._animationState=void 0,i._animationState=e,i}s(e,t);var i=e.prototype;return i.destroy=function(){this._animationState.destroy()},i.play=function(){this._animationState.play()},i.pause=function(){this._animationState.pause()},i.stop=function(){this._animationState.stop()},i.setSpeed=function(t){this._animationState.speed=t},i.setTime=function(t){this._animationState.time=t},e}(Sq);va("cc.animation.EmbeddedParticleSystemPlayable")((Pq=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).path=Mq&&Mq(),e}return s(e,t),e.prototype.instantiate=function(t){var e=t.getChildByPath(this.path);if(!e)return F("Hierarchy path "+this.path+" does not exists."),null;var i=ie("cc.ParticleSystem");if(!i)return F("Particle system is required for embedded particle system player."),null;var n=e.getComponent(i);return n?new Hq(n):(F(this.path+" does not includes a particle system component."),null)},e}(Eq),Mq=ua(Pq.prototype,"path",[wa],(function(){return""})),Pq));var Lq,Bq,Fq,kq,Uq,Gq,Hq=function(t){function e(e){var i;return(i=t.call(this,!1)||this)._particleSystem=void 0,i._particleSystem=e,i}s(e,t);var i=e.prototype;return i.destroy=function(){},i.play=function(){this._particleSystem.play()},i.pause=function(){this._particleSystem.stopEmitting()},i.stop=function(){this._particleSystem.stopEmitting()},i.setSpeed=function(t){this._particleSystem.simulationSpeed=t},e}(Sq);function zq(t){return"string"==typeof t||"number"==typeof t}var Vq,Wq,Xq,jq,Yq,Kq,qq,Qq,Zq,Jq,$q,tQ,eQ,iQ,nQ,rQ,sQ,oQ,aQ,hQ=va("cc.animation.HierarchyPath")((Bq=function(){function t(t){this.path=Fq&&Fq(),this.path=t||""}return t.prototype.get=function(t){return t instanceof Tm?t.getChildByPath(this.path)||(q(3926,t.name,this.path),null):(q(3925),null)},t}(),Fq=ua(Bq.prototype,"path",[wa],(function(){return""})),Lq=Bq))||Lq,uQ=va("cc.animation.ComponentPath")((Uq=function(){function t(t){this.component=Gq&&Gq(),this.component=t||""}return t.prototype.get=function(t){return t instanceof Tm?t.getComponent(this.component)||(q(3928,t.name,this.component),null):(q(3927),null)},t}(),Gq=ua(Uq.prototype,"component",[wa],(function(){return""})),kq=Uq))||kq,cQ=Symbol("NormalizedFollow"),lQ=Symbol("ConvertAsTrsPath"),_Q=Symbol("TrackBinding"),dQ=va("cc.animation.TrackPath")((Wq=function(){function t(){this._paths=Xq&&Xq()}var e=t.prototype;return e.toProperty=function(t){return this._paths.push(t),this},e.toElement=function(t){return this._paths.push(t),this},e.toHierarchy=function(t){return this._paths.push(new hQ(t)),this},e.toComponent=function(t){var e=new uQ("string"==typeof t?t:Ot(t));return this._paths.push(e),this},e.toCustomized=function(t){return this._paths.push(t),this},e.append=function(){for(var t,e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];var r=(t=this._paths).concat.apply(t,i.map((function(t){return t._paths})));return this._paths=r,this},e.isPropertyAt=function(t){return"string"==typeof this._paths[t]},e.parsePropertyAt=function(t){return this._paths[t]},e.isElementAt=function(t){return"number"==typeof this._paths[t]},e.parseElementAt=function(t){return this._paths[t]},e.isHierarchyAt=function(t){return this._paths[t]instanceof hQ},e.parseHierarchyAt=function(t){return this.isHierarchyAt(t),this._paths[t].path},e.isComponentAt=function(t){return this._paths[t]instanceof uQ},e.parseComponentAt=function(t){return this.isComponentAt(t),this._paths[t].component},e.slice=function(e,i){var n=new t;return n._paths=this._paths.slice(e,i),n},e.trace=function(t,e,i){var n,r;return null!==(n=e)&&void 0!==n||(e=0),null!==(r=i)&&void 0!==r||(i=this._paths.length),this[cQ](t,e,i)},e[lQ]=function(){for(var t,e=this._paths,i=e.length,n=0,r="";n<i;++n){var s=e[n];if(!(s instanceof hQ))break;s.path&&(r?r+="/"+s.path:r=s.path)}if(n===i)return null;if(n!==i-1)return null;switch(e[n]){case"position":case"scale":case"rotation":case"eulerAngles":t=e[n];break;default:return null}return{node:r,property:t}},e[cQ]=function(t,e,i){for(var n=this._paths,r=t,s=e;s<i;++s){var o=n[s];if(zq(o)){if(!(o in r))return q(3929,o),null;r=r[o]}else r=o.get(r);if(null===r)break}return r},n(t,[{key:"length",get:function(){return this._paths.length}}]),t}(),Xq=ua(Wq.prototype,"_paths",[wa],(function(){return[]})),Vq=Wq))||Vq,fQ=va("cc.animation.TrackBinding")(jq=Oa(((Qq=function(){function t(){this.path=Kq&&Kq(),this.proxy=qq&&qq()}var e=t.prototype;return e.parseTrsPath=function(){return this.proxy?null:this.path[lQ]()},e.createRuntimeBinding=function(t,e,i){var n=this.path,r=this.proxy,s=n.length,o=s-1;if(0===s||!n.isPropertyAt(o)&&!n.isElementAt(o)||r){if(r){var a=n[cQ](t,0,s);if(null===a)return null;var h=r.forTarget(a);if(!h)return null;var u={setValue:function(t){h.set(t)}},c=h.get;return c&&(u.getValue=function(){return c.call(h)}),u}return Z(3921),null}var l,_=n.isPropertyAt(o)?n.parsePropertyAt(o):n.parseElementAt(o),d=n[cQ](t,0,s-1);return null===d?null:e&&d instanceof Tm&&function(t){return"position"===t||"rotation"===t||"scale"===t||"eulerAngles"===t}(_)?e.createPoseWriter(d,_,i):(l=function(t){d[_]=t},{target:d,setValue:l,getValue:function(){return d[_]}})},e.isMaskedOff=function(t){var e=this.parseTrsPath();if(!e)return!1;for(var i=t.joints[Symbol.iterator](),n=i.next();!n.done;n=i.next()){var r=n.value;if(r.path===e.node)return!r.enabled}return!1},t}())._animationFunctions=new WeakMap,Kq=ua((Yq=Qq).prototype,"path",[wa],(function(){return new dQ})),qq=ua(Yq.prototype,"proxy",[wa],null),jq=Yq))||jq)||jq,pQ=va("cc.animation.Track")((Jq=function(){function t(){this._binding=$q&&$q()}var e=t.prototype;return e.channels=function(){return[]},e.range=function(){for(var t,e={min:1/0,max:-1/0},i=d(this.channels());!(t=i()).done;){var n=t.value;e.min=Math.min(e.min,n.curve.rangeMin),e.max=Math.max(e.max,n.curve.rangeMax)}return e},n(t,[{key:"path",get:function(){return this._binding.path},set:function(t){this._binding.path=t}},{key:"proxy",get:function(){return this._binding.proxy},set:function(t){this._binding.proxy=t}},{key:_Q,get:function(){return this._binding}}]),t}(),$q=ua(Jq.prototype,"_binding",[wa],(function(){return new fQ})),Zq=Jq))||Zq,gQ=va("cc.animation.Channel")((eQ=function(){function t(t){this.name="",this._curve=iQ&&iQ(),this._curve=t}return n(t,[{key:"curve",get:function(){return this._curve}}]),t}(),iQ=ua(eQ.prototype,"_curve",[wa],null),tQ=eQ))||tQ,mQ=va("cc.animation.SingleChannelTrack")((rQ=function(t){function e(){var e;return(e=t.call(this)||this)._channel=sQ&&sQ(),e._channel=new gQ(e.createCurve()),e}s(e,t);var i=e.prototype;return i.channels=function(){return[this._channel]},i.createCurve=function(){throw new Error("Not impl")},i[yq]=function(){var t=this._channel.curve;return new vQ(t)},n(e,[{key:"channel",get:function(){return this._channel}}]),e}(pQ),sQ=ua(rQ.prototype,"_channel",[wa],null),nQ=rQ))||nQ,vQ=function(){function t(t){this._curve=t}return t.prototype.evaluate=function(t){return this._curve.evaluate(t)},n(t,[{key:"requiresDefault",get:function(){return!1}}]),t}(),yQ=wa;va("cc.animation.RealArrayTrack")((oQ=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)._channels=aQ&&aQ(),e}s(e,t);var i=e.prototype;return i.channels=function(){return this._channels},i[yq]=function(){return new kQ(this._channels.map((function(t){return t.curve})))},n(e,[{key:"elementCount",get:function(){return this._channels.length},set:function(t){var e=this._channels.length;if(t<e)this._channels.splice(t);else if(t>e){var i;(i=this._channels).push.apply(i,Array.from({length:t-e},(function(){return new gQ(new Eu)})))}}}]),e}(pQ),aQ=ua(oQ.prototype,"_channels",[yQ],(function(){return[]})),oQ));var TQ,EQ,SQ,AQ,bQ,CQ,RQ,wQ,IQ,xQ,DQ,OQ,PQ,MQ,NQ,LQ,BQ,FQ,kQ=function(){function t(t){this._curves=t,this._result=new Array(t.length).fill(0)}return t.prototype.evaluate=function(t){for(var e=this._result,i=e.length,n=0;n<i;++n)e[n]=this._curves[n].evaluate(t);return this._result},n(t,[{key:"requiresDefault",get:function(){return!1}}]),t}(),UQ=va("cc.animation.UniformProxyFactory")((EQ=function(){function t(t,e){this.passIndex=SQ&&SQ(),this.uniformName=AQ&&AQ(),function(t,e,i,n){i&&Object.defineProperty(t,"channelIndex",{enumerable:i.enumerable,configurable:i.configurable,writable:i.writable,value:i.initializer?i.initializer.call(n):void 0})}(this,0,bQ,this),this.passIndex=e||0,this.uniformName=t||""}return t.prototype.forTarget=function(t){if(t instanceof $E){var e=this.passIndex,i=this.uniformName,n=this.channelIndex;if(e<0||e>=t.passes.length)q(3941,t.name,e);else{var r=t.passes[e],s=r.getHandle(i);if(s){if(GE.getTypeFromHandle(s)<ml.SAMPLER1D){var o=void 0===n?s:r.getHandle(i,n,ml.FLOAT);return o?function(t,e){for(var i,n=d(t.shaderInfo.blocks);!(i=n()).done;)for(var r,s=d(i.value.members);!(r=s()).done;){var o=r.value;if(o.name===e)return o.count>1}return!1}(r,i)?{set:function(t){r.setUniformArray(o,t)}}:{set:function(t){r.setUniform(o,t)}}:void q(3943,t.name,e,i,n)}var a=GE.getBindingFromHandle(s),h=r.properties[i],u=h&&h.value?""+h.value+ky(h.type):Fy(h.type),c=NE.get(u);return c||(F("Illegal texture default value: "+u+"."),c=NE.get("default-texture")),{set:function(t){t||(t=c);var e=t.getGFXTexture();e&&e.width&&e.height&&(r.bindTexture(a,e),t instanceof rp&&r.bindSampler(a,Qd.gfxDevice.getSampler(t.getSamplerInfo())))}}}q(3942,t.name,e,i)}}else q(3940,t)},t}(),SQ=ua(EQ.prototype,"passIndex",[wa],(function(){return 0})),AQ=ua(EQ.prototype,"uniformName",[wa],(function(){return""})),bQ=f(EQ.prototype,"channelIndex",[Ka],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){}}),TQ=EQ))||TQ,GQ=va("cc.animation.MorphWeightValueProxy")((RQ=function(){function t(){this.subMeshIndex=wQ&&wQ(),this.shapeIndex=IQ&&IQ()}return t.prototype.forTarget=function(t){var e=this;return{set:function(i){t.setWeight(i,e.subMeshIndex,e.shapeIndex)}}},t}(),wQ=ua(RQ.prototype,"subMeshIndex",[wa],(function(){return 0})),IQ=ua(RQ.prototype,"shapeIndex",[wa],(function(){return 0})),CQ=RQ))||CQ,HQ=va("cc.animation.MorphWeightsValueProxy")((DQ=function(){function t(){this.subMeshIndex=OQ&&OQ()}return t.prototype.forTarget=function(t){var e=this;return{set:function(i){t.setWeights(i,e.subMeshIndex)}}},t}(),OQ=ua(DQ.prototype,"subMeshIndex",[wa],(function(){return 0})),xQ=DQ))||xQ,zQ=va("cc.animation.MorphWeightsAllValueProxy")(PQ=function(){function t(){}return t.prototype.forTarget=function(t){return{set:function(e){for(var i,n,r=null!==(i=null===(n=t.mesh)||void 0===n?void 0:n.struct.primitives.length)&&void 0!==i?i:0,s=0;s<r;++s)t.setWeights(e,s)}}},t}())||PQ;function VQ(t,e,i,n){var r,s,o,a,h,u=new e,c=new e,l=new e,_=va(t)((s=function(){function t(t,i,n){this.dataPoint=o&&o(),this.inTangent=a&&a(),this.outTangent=h&&h(),this.dataPoint=t||new e,this.inTangent=i||new e,this.outTangent=n||new e}var r=t.prototype;return r.lerp=function(t,e,r){var s=this.dataPoint,o=t.dataPoint;c=i(c,this.inTangent,r),l=i(l,t.outTangent,r);var a=e*e*e,h=e*e,_=a-2*h+e,d=-2*a+3*h,f=a-h;return u=i(u,s,2*a-3*h+1),u=n(u,u,c,_),u=n(u,u,o,d),u=n(u,u,l,f)},r.getNoLerp=function(){return this.dataPoint},t}(),o=ua(s.prototype,"dataPoint",[wa],(function(){return new e})),a=ua(s.prototype,"inTangent",[wa],(function(){return new e})),h=ua(s.prototype,"outTangent",[wa],(function(){return new e})),r=s))||r;if(e===Rn){var d=_.prototype.lerp;_.prototype.lerp=function(t,e,i){var n=d.call(this,t,e,i);return Rn.normalize(n,n),n}}return _}var WQ,XQ,jQ,YQ,KQ,qQ=VQ("cc.CubicSplineVec2Value",Hn,Hn.multiplyScalar,Hn.scaleAndAdd),QQ=VQ("cc.CubicSplineVec3Value",_n,_n.multiplyScalar,_n.scaleAndAdd),ZQ=VQ("cc.CubicSplineVec4Value",on,on.multiplyScalar,on.scaleAndAdd),JQ=VQ("cc.CubicSplineQuatValue",Rn,Rn.multiplyScalar,Rn.scaleAndAdd),$Q=va("cc.CubicSplineNumberValue")((NQ=function(){function t(t,e,i){this.dataPoint=LQ&&LQ(),this.inTangent=BQ&&BQ(),this.outTangent=FQ&&FQ(),this.dataPoint=t,this.inTangent=e,this.outTangent=i}var e=t.prototype;return e.lerp=function(t,e,i){var n=this.dataPoint,r=t.dataPoint,s=e*e*e,o=e*e;return n*(2*s-3*o+1)+this.outTangent*i*(s-2*o+e)+r*(-2*s+3*o)+t.inTangent*i*(s-o)},e.getNoLerp=function(){return this.dataPoint},t}(),LQ=ua(NQ.prototype,"dataPoint",[wa],(function(){return 0})),BQ=ua(NQ.prototype,"inTangent",[wa],(function(){return 0})),FQ=ua(NQ.prototype,"outTangent",[wa],(function(){return 0})),MQ=NQ))||MQ,tZ=va("cc.animation.RealTrack")(WQ=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.createCurve=function(){return new Eu},e}(mQ))||WQ;function eZ(t){return 0===t.keyFramesCount?void 0:t}var iZ,nZ,rZ,sZ,oZ,aZ,hZ,uZ,cZ=["X","Y","Z","W"],lZ=va("cc.animation.VectorTrack")((jQ=function(t){function e(){var e;(e=t.call(this)||this)._channels=YQ&&YQ(),e._nComponents=KQ&&KQ(),e._channels=new Array(4);for(var i=0;i<e._channels.length;++i){var n=new gQ(new Eu);n.name=cZ[i],e._channels[i]=n}return e}s(e,t);var i=e.prototype;return i.channels=function(){return this._channels},i[yq]=function(){switch(this._nComponents){default:case 2:return new _Z(eZ(this._channels[0].curve),eZ(this._channels[1].curve));case 3:return new dZ(eZ(this._channels[0].curve),eZ(this._channels[1].curve),eZ(this._channels[2].curve));case 4:return new fZ(eZ(this._channels[0].curve),eZ(this._channels[1].curve),eZ(this._channels[2].curve),eZ(this._channels[3].curve))}},n(e,[{key:"componentsCount",get:function(){return this._nComponents},set:function(t){this._nComponents=t}}]),e}(pQ),YQ=ua(jQ.prototype,"_channels",[wa],null),KQ=ua(jQ.prototype,"_nComponents",[wa],(function(){return 4})),XQ=jQ))||XQ,_Z=function(){function t(t,e){this._result=new Hn,this._x=t,this._y=e}return t.prototype.evaluate=function(t,e){return e&&Hn.copy(this._result,e),this._x&&(this._result.x=this._x.evaluate(t)),this._y&&(this._result.y=this._y.evaluate(t)),this._result},n(t,[{key:"requiresDefault",get:function(){return!this._x||!this._y}}]),t}(),dZ=function(){function t(t,e,i){this._result=new _n,this._x=t,this._y=e,this._z=i}return t.prototype.evaluate=function(t,e){var i=this._x,n=this._y,r=this._z,s=this._result;return e&&_n.copy(s,e),i&&(s.x=i.evaluate(t)),n&&(s.y=n.evaluate(t)),r&&(s.z=r.evaluate(t)),s},n(t,[{key:"requiresDefault",get:function(){return!this._x||!this._y||!this._z}}]),t}(),fZ=function(){function t(t,e,i,n){this._result=new on,this._x=t,this._y=e,this._z=i,this._w=n}return t.prototype.evaluate=function(t,e){return e&&on.copy(this._result,e),this._x&&(this._result.x=this._x.evaluate(t)),this._y&&(this._result.y=this._y.evaluate(t)),this._z&&(this._result.z=this._z.evaluate(t)),this._w&&(this._result.w=this._w.evaluate(t)),this._result},n(t,[{key:"requiresDefault",get:function(){return!(this._x&&this._y&&this._z&&this._w)}}]),t}(),pZ=va("cc.animation.QuatTrack")(iZ=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.createCurve=function(){return new oc},i[yq]=function(){return new gZ(this.channels()[0].curve)},e}(mQ))||iZ,gZ=function(){function t(t){this._result=new Rn,this._curve=t}return t.prototype.evaluate=function(t){return this._curve.evaluate(t,this._result),this._result},n(t,[{key:"requiresDefault",get:function(){return!1}}]),t}(),mZ=["Red","Green","Blue","Alpha"],vZ=va("cc.animation.ColorTrack")((rZ=function(t){function e(){var e;(e=t.call(this)||this)._channels=sZ&&sZ(),e._channels=new Array(4);for(var i=0;i<e._channels.length;++i){var n=new gQ(new Eu);n.name=mZ[i],e._channels[i]=n}return e}s(e,t);var i=e.prototype;return i.channels=function(){return this._channels},i[yq]=function(){return new yZ(eZ(this._channels[0].curve),eZ(this._channels[1].curve),eZ(this._channels[2].curve),eZ(this._channels[3].curve))},e}(pQ),sZ=ua(rZ.prototype,"_channels",[wa],null),nZ=rZ))||nZ,yZ=function(){function t(t,e,i,n){this._result=new yn,this._x=t,this._y=e,this._z=i,this._w=n}return t.prototype.evaluate=function(t,e){return e&&yn.copy(this._result,e),this._x&&(this._result.r=this._x.evaluate(t)),this._y&&(this._result.g=this._y.evaluate(t)),this._z&&(this._result.b=this._z.evaluate(t)),this._w&&(this._result.a=this._w.evaluate(t)),this._result},n(t,[{key:"requiresDefault",get:function(){return!(this._x&&this._y&&this._z&&this._w)}}]),t}(),TZ=["Width","Height"],EZ=va("cc.animation.SizeTrack")((aZ=function(t){function e(){var e;(e=t.call(this)||this)._channels=hZ&&hZ(),e._channels=new Array(2);for(var i=0;i<e._channels.length;++i){var n=new gQ(new Eu);n.name=TZ[i],e._channels[i]=n}return e}s(e,t);var i=e.prototype;return i.channels=function(){return this._channels},i[yq]=function(){return new SZ(eZ(this._channels[0].curve),eZ(this._channels[1].curve))},e}(pQ),hZ=ua(aZ.prototype,"_channels",[wa],null),oZ=aZ))||oZ,SZ=function(){function t(t,e){this._result=new Xn,this._width=t,this._height=e}return t.prototype.evaluate=function(t,e){return e&&(this._result.x=e.x,this._result.y=e.y),this._width&&(this._result.width=this._width.evaluate(t)),this._height&&(this._result.height=this._height.evaluate(t)),this._result},n(t,[{key:"requiresDefault",get:function(){return!this._width||!this._height}}]),t}(),AZ=va("cc.animation.ObjectTrack")(uZ=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.createCurve=function(){return new gc},e}(mQ))||uZ;t("animation",Object.freeze({__proto__:null,UniformProxyFactory:UQ,MorphWeightValueProxy:GQ,MorphWeightsValueProxy:HQ,MorphWeightsAllValueProxy:zQ,Track:pQ,TrackPath:dQ,RealTrack:tZ,VectorTrack:lZ,QuatTrack:pZ,ColorTrack:vZ,SizeTrack:EZ,ObjectTrack:AZ,isPropertyPath:zq,isCustomPath:function(t,e){return t instanceof e},HierarchyPath:hQ,ComponentPath:uQ,CubicSplineVec2Value:qQ,CubicSplineVec3Value:QQ,CubicSplineVec4Value:ZQ,CubicSplineQuatValue:JQ,CubicSplineNumberValue:$Q}));var bZ=t("RatioSampler",function(){function t(t){var e,i;this.ratios=void 0,this._findRatio=void 0,this.ratios=t;for(var n=!0,r=1,s=t.length;r<s;r++)if(e=t[r]-t[r-1],1===r)i=e;else if(Math.abs(e-i)>1e-6){n=!1;break}this._findRatio=n?IZ:na}return t.prototype.sample=function(t){return this._findRatio(this.ratios,t)},t}());m.RatioSampler=bZ;var CZ=t("AnimCurve",function(){function t(e,i){this.types=void 0,this.type=null,this._values=[],this._lerp=void 0,this._duration=void 0,this._array=void 0,this._duration=i,this._values=e.values;var n=function(e){return"string"==typeof e?e:Array.isArray(e)?e[0]===e[1]&&e[2]===e[3]?t.Linear:t.Bezier(e):t.Linear};if(void 0!==e.easingMethod)this.type=n(e.easingMethod);else if(Array.isArray(e.easingMethods))this.types=e.easingMethods.map(n);else if(void 0!==e.easingMethods){this.types=new Array(this._values.length).fill(null);for(var r=0,s=Object.keys(e.easingMethods);r<s.length;r++){var o=s[r];this.types[o]=n(e.easingMethods[o])}}else this.type=null;var a=e.values[0];(void 0===e.interpolate||e.interpolate)&&(this._lerp=LZ(a)),void 0!==e._arrayLength&&(this._array=new Array(e._arrayLength))}t.Bezier=function(t){return t};var e=t.prototype;return e.hasLerp=function(){return!!this._lerp},e.valueAt=function(t){if(void 0===this._array){var e=this._values[t];return e&&e.getNoLerp?e.getNoLerp():e}for(var i=0;i<this._array.length;++i)this._array[i]=this._values[this._array.length*t+i];return this._array},e.valueBetween=function(t,e,i,n,r){if(this._lerp){var s=this.types?this.types[e]:this.type,o=r-i,a=(t-i)/o;if(s&&(a=wZ(a,s)),void 0===this._array){var h=this._values[e],u=this._values[n];return this._lerp(h,u,a,o*this._duration)}for(var c=0;c<this._array.length;++c){var l=this._values[this._array.length*e+c],_=this._values[this._array.length*n+c];this._array[c]=this._lerp(l,_,a,o*this._duration)}return this._array}if(void 0===this._array)return this.valueAt(e);for(var d=0;d<this._array.length;++d)this._array[d]=this._values[this._array.length*e+d];return this._array},e.empty=function(){return 0===this._values.length},e.constant=function(){return 1===this._values.length},t}());function RZ(t,e,i){var n=e.sample(i);if(n<0)if((n=~n)<=0)n=0;else{if(!(n>=e.ratios.length))return t.valueBetween(i,n-1,e.ratios[n-1],n,e.ratios[n]);n=e.ratios.length-1}return t.valueAt(n)}function wZ(t,e){if("string"==typeof e){var i=cu[e];i?t=i(t):Z(3906,e)}else Array.isArray(e)&&(t=ic(e,t));return t}function IZ(t,e){var i=t.length-1;if(0===i)return 0;var n=t[0];if(e<n)return 0;var r=t[i];if(e>r)return i;var s=(e=(e-n)/(r-n))/(1/i),o=0|s,a=1e-6;return s-o<a?o:o+1-s<a?o+1:~(o+1)}CZ.Linear=null,m.AnimCurve=CZ,t("EventInfo",function(){function t(){this.events=[]}return t.prototype.add=function(t,e){this.events.push({func:t||"",params:e||[]})},t}()),m.sampleAnimationCurve=RZ;var xZ,DZ,OZ,PZ,MZ,NZ,LZ=function(){function t(t,e,i,n){return t.lerp(e,i,n)}return function(e){if(null!==e){if("number"==typeof e)return Ni;if("object"==typeof e&&e.constructor){if(e instanceof Rn)return i=new Rn,function(t,e,n){return Rn.slerp(i,t,e,n)};if(e instanceof be)return function(t){var e=new t;return function(i,n,r){return t.lerp(e,i,n,r),e}}(e.constructor);if(e.constructor===Number)return Ni;if("function"==typeof e.lerp)return t}var i}}}(),BZ=va("cc.animation.UntypedTrackChannel")((DZ=function(t){function e(){var e;return(e=t.call(this,new Eu)||this).property=OZ&&OZ(),e}return s(e,t),e}(gQ),OZ=ua(DZ.prototype,"property",[wa],(function(){return""})),xZ=DZ))||xZ,FZ=va("cc.animation.UntypedTrack")((MZ=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)._channels=NZ&&NZ(),e}s(e,t);var i=e.prototype;return i.channels=function(){return this._channels},i[yq]=function(){throw new Error("UntypedTrack should be handled specially. Please file an issue.")},i.createLegacyEval=function(t){var e=this,i=function(t){var i;return null===(i=e._channels.find((function(e){return e.property===t})))||void 0===i?void 0:i.curve};switch(!0){default:throw new Error(et(3931));case t instanceof Hn:return new _Z(i("x"),i("y"));case t instanceof _n:return new dZ(i("x"),i("y"),i("z"));case t instanceof on:return new fZ(i("x"),i("y"),i("z"),i("w"));case t instanceof yn:return new yZ(i("r"),i("g"),i("b"),i("a"));case t instanceof Xn:return new SZ(i("width"),i("height"))}},i.addChannel=function(t){var e=new BZ;return e.property=t,this._channels.push(e),e},i.upgrade=function(t){var e=this,i=function(t,i){var n=e.channels().find((function(e){return e.property===t}));n&&(i.name=n.name,i.curve.assignSorted(Array.from(n.curve.times()),Array.from(n.curve.values())))},n=t(this.path,this.proxy);switch(n){default:break;case"vec2":case"vec3":case"vec4":var r=new lZ;r.path=this.path,r.proxy=this.proxy,r.componentsCount="vec2"===n?2:"vec3"===n?3:4;var s=r.channels(),o=s[0],a=s[1],h=s[2],u=s[3];switch(n){case"vec4":i("w",u);case"vec3":i("z",h);default:case"vec2":i("x",o),i("y",a)}return r;case"color":var c=new vZ,l=c.channels(),_=l[0],d=l[1],f=l[2],p=l[3];return i("r",_),i("g",d),i("b",f),i("a",p),i("x",_),i("y",d),i("z",f),i("w",p),c;case"size":}return null},e}(pQ),NZ=ua(MZ.prototype,"_channels",[wa],(function(){return[]})),PZ=MZ))||PZ,kZ=function(){function t(t){this._keys=[],this._curves=[],this._commonTargets=[],this._ratioSamplers=[],this._runtimeCurves=void 0,this._data=null,this._duration=void 0,this._duration=t}var e=t.prototype;return e.getPropertyCurves=function(){return this._runtimeCurves||this._createPropertyCurves(),this._runtimeCurves},e.toTracks=function(){for(var t,e=[],i=this.keys,n=this.curves,r=this.commonTargets,s=function(t,e,i){for(var n,r=new dQ,s=d(e);!(n=s()).done;){var o=n.value;"string"==typeof o?r.toProperty(o):"number"==typeof o?r.toElement(o):o instanceof hQ?r.toHierarchy(o.path):o instanceof uQ?r.toComponent(o.component):r.toCustomized(o)}t.path=r,t.proxy=i},o=r.map((function(t){var i=new FZ;return s(i,t.modifiers,t.valueAdapter),e.push(i),i})),a=function(){var n,r=t.value,a=r.data,h=a.values;if(0===h.length)return 0;var u=a.keys<0?[0]:i[a.keys],c=h[0],l=null===(n=a.interpolate)||void 0===n||n;a._arrayLength;var _,d=new GZ(a,u.length),f=function(t){s(t,r.modifiers,r.valueAdapter)};if("number"==typeof r.commonTarget){if(!h.every((function(t){return"number"==typeof t})))return q(3932),0;if(r.valueAdapter||1!==r.modifiers.length||"string"!=typeof r.modifiers[0])return q(3933),0;var p=r.modifiers[0],g=o[r.commonTarget].addChannel(p).curve;_=g}!function(){if("number"==typeof c){if(!h.every((function(t){return"number"==typeof t})))return void q(3934);var t;if(_)t=_;else{var i=new tZ;f(i),e.push(i),t=i.channel.curve}var n=l?ra.LINEAR:ra.CONSTANT;return t.assignSorted(u,h.map((function(t){return{value:t,interpolationMode:n}}))),void d.convert(t)}if("object"==typeof c)switch(!0){default:break;case UZ(h,Hn):case UZ(h,_n):case UZ(h,on):var r=c instanceof Hn?2:c instanceof _n?3:4,s=new lZ;f(s),s.componentsCount=r;var o=s.channels(),a=o[0].curve,p=o[1].curve,g=o[2].curve,m=o[3].curve,v=l?ra.LINEAR:ra.CONSTANT,y=function(t){return{value:t,interpolationMode:v}};switch(r){case 4:m.assignSorted(u,h.map((function(t){return y(t.w)}))),d.convert(m);case 3:g.assignSorted(u,h.map((function(t){return y(t.z)}))),d.convert(g);default:a.assignSorted(u,h.map((function(t){return y(t.x)}))),d.convert(a),p.assignSorted(u,h.map((function(t){return y(t.y)}))),d.convert(p)}return void e.push(s);case UZ(h,Rn):var T=new pZ;f(T);var E=l?qu.SLERP:qu.CONSTANT;return T.channel.curve.assignSorted(u,h.map((function(t){return{value:Rn.clone(t),interpolationMode:E}}))),d.convertQuatCurve(T.channel.curve),void e.push(T);case UZ(h,yn):var S=new vZ;f(S);var A=S.channels(),b=A[0].curve,C=A[1].curve,R=A[2].curve,w=A[3].curve,I=l?ra.LINEAR:ra.CONSTANT,x=function(t){return{value:t,interpolationMode:I}};return b.assignSorted(u,h.map((function(t){return x(t.r)}))),d.convert(b),C.assignSorted(u,h.map((function(t){return x(t.g)}))),d.convert(C),R.assignSorted(u,h.map((function(t){return x(t.b)}))),d.convert(R),w.assignSorted(u,h.map((function(t){return x(t.a)}))),d.convert(w),void e.push(S);case UZ(h,Xn):var D=new EZ;f(D);var O=D.channels(),P=O[0].curve,M=O[1].curve,N=l?ra.LINEAR:ra.CONSTANT,L=function(t){return{value:t,interpolationMode:N}};return P.assignSorted(u,h.map((function(t){return L(t.width)}))),d.convert(P),M.assignSorted(u,h.map((function(t){return L(t.height)}))),d.convert(M),void e.push(D);case UZ(h,$Q):d.nil;var B=new tZ;f(B);var F=l?ra.CUBIC:ra.CONSTANT;return B.channel.curve.assignSorted(u,h.map((function(t){return{value:t.dataPoint,leftTangent:t.inTangent,rightTangent:t.outTangent,interpolationMode:F}}))),void e.push(B);case UZ(h,qQ):case UZ(h,QQ):case UZ(h,ZQ):d.nil;var k=c instanceof qQ?2:c instanceof QQ?3:4,U=new lZ;f(U),U.componentsCount=k;var G=U.channels(),H=G[0],z=G[1],V=G[2],W=G[3],X=l?ra.LINEAR:ra.CONSTANT,j=function(t,e,i){return{value:t,leftTangent:e,rightTangent:i,interpolationMode:X}};switch(k){case 4:W.curve.assignSorted(u,h.map((function(t){return j(t.dataPoint.w,t.inTangent.w,t.outTangent.w)})));case 3:V.curve.assignSorted(u,h.map((function(t){return j(t.dataPoint.z,t.inTangent.z,t.outTangent.z)})));default:H.curve.assignSorted(u,h.map((function(t){return j(t.dataPoint.y,t.inTangent.y,t.outTangent.y)}))),z.curve.assignSorted(u,h.map((function(t){return j(t.dataPoint.x,t.inTangent.x,t.outTangent.x)})))}return void e.push(U);case h.every((function(t){return t instanceof JQ})):q(3935)}var Y=new AZ;f(Y),Y.channel.curve.assignSorted(u,h),e.push(Y)}()},h=d(n);!(t=h()).done;)a();return e},e._createPropertyCurves=function(){var t=this;this._ratioSamplers=this._keys.map((function(e){return new bZ(e.map((function(e){return e/t._duration})))})),this._runtimeCurves=this._curves.map((function(e){return{curve:new CZ(e.data,t._duration),modifiers:e.modifiers,valueAdapter:e.valueAdapter,sampler:t._ratioSamplers[e.data.keys],commonTarget:e.commonTarget}}))},n(t,[{key:"keys",get:function(){return this._keys},set:function(t){this._keys=t}},{key:"curves",get:function(){return this._curves},set:function(t){this._curves=t,delete this._runtimeCurves}},{key:"commonTargets",get:function(){return this._commonTargets},set:function(t){this._commonTargets=t}},{key:"data",get:function(){return this._data}}]),t}();function UZ(t,e){return t.every((function(t){return t instanceof e}))}var GZ=function(){function t(t,e){this._easingMethods=void 0;var i=t.easingMethods;Array.isArray(i)?0===i.length&&0!==e?this._easingMethods=new Array(e).fill(null):this._easingMethods=i:this._easingMethods=void 0===i?new Array(e).fill(t.easingMethod):Array.from({length:e},(function(t,e){var n;return null!==(n=i[e])&&void 0!==n?n:null}))}var e=t.prototype;return e.convert=function(t){var e,i,n,r,s,o,a,h,u,c,l,_,d,f,p,g,m,v,y,T,E,S,A=this._easingMethods;if(A){var b=t.keyFramesCount;if(!(t.keyFramesCount<2)){Array.isArray(A)&&A.length;for(var C=b-1,R=0;R<C;++R){var w=A[R];w&&(Array.isArray(w)?(e=w,i=t.getKeyframeTime(R),n=t.getKeyframeValue(R),r=t.getKeyframeTime(R+1),s=t.getKeyframeValue(R+1),o=void 0,a=void 0,h=void 0,u=void 0,c=void 0,l=void 0,_=void 0,d=void 0,f=void 0,p=void 0,g=void 0,m=void 0,v=void 0,y=void 0,T=void 0,E=void 0,S=void 0,a=e[0],h=e[1],u=e[2],c=e[3],l=n.value,_=3*(r-i),d=3*(s.value-l),g=(1-u)*_,m=(1-c)*d,v=1/3,y=(p=h*d)/(f=a*_),T=Math.sqrt(f*f+p*p)*v,E=m/g,S=Math.sqrt(g*g+m*m)*v,n.interpolationMode=ra.CUBIC,n.tangentWeightMode=(o=n.tangentWeightMode)===oa.NONE?oa.RIGHT:o===oa.LEFT?oa.BOTH:o,n.rightTangent=y,n.rightTangentWeight=T,s.tangentWeightMode=function(t){return t===oa.NONE?oa.LEFT:t===oa.RIGHT?oa.BOTH:t}(s.tangentWeightMode),s.leftTangent=E,s.leftTangentWeight=S):HZ(w,t,R))}}}},e.convertQuatCurve=function(t){var e=this._easingMethods;if(e){var i=t.keyFramesCount;if(!(t.keyFramesCount<2)){Array.isArray(e)&&e.length;for(var n=i-1,r=0;r<n;++r){var s=e[r];s&&(Array.isArray(s)?t.getKeyframeValue(r).easingMethod=s.slice():zZ(s,t,r))}}}},n(t,[{key:"nil",get:function(){return!this._easingMethods||this._easingMethods.every((function(t){return null==t}))}}]),t}();function HZ(t,e,i){e.keyFramesCount;var n=e.getKeyframeValue(i),r=dJ[t];r===uu.CONSTANT?n.interpolationMode=ra.CONSTANT:(n.interpolationMode=ra.LINEAR,n.easingMethod=r)}function zZ(t,e,i){e.keyFramesCount;var n=e.getKeyframeValue(i),r=dJ[t];n.easingMethod=r}var VZ,WZ,XZ,jZ,YZ,KZ,qZ,QZ,ZZ,JZ,$Z,tJ,eJ,iJ,nJ,rJ,sJ,oJ,aJ,hJ,uJ,cJ,lJ,_J,dJ={constant:uu.CONSTANT,linear:uu.LINEAR,quadIn:uu.QUAD_IN,quadOut:uu.QUAD_OUT,quadInOut:uu.QUAD_IN_OUT,quadOutIn:uu.QUAD_OUT_IN,cubicIn:uu.CUBIC_IN,cubicOut:uu.CUBIC_OUT,cubicInOut:uu.CUBIC_IN_OUT,cubicOutIn:uu.CUBIC_OUT_IN,quartIn:uu.QUART_IN,quartOut:uu.QUART_OUT,quartInOut:uu.QUART_IN_OUT,quartOutIn:uu.QUART_OUT_IN,quintIn:uu.QUINT_IN,quintOut:uu.QUINT_OUT,quintInOut:uu.QUINT_IN_OUT,quintOutIn:uu.QUINT_OUT_IN,sineIn:uu.SINE_IN,sineOut:uu.SINE_OUT,sineInOut:uu.SINE_IN_OUT,sineOutIn:uu.SINE_OUT_IN,expoIn:uu.EXPO_IN,expoOut:uu.EXPO_OUT,expoInOut:uu.EXPO_IN_OUT,expoOutIn:uu.EXPO_OUT_IN,circIn:uu.CIRC_IN,circOut:uu.CIRC_OUT,circInOut:uu.CIRC_IN_OUT,circOutIn:uu.CIRC_OUT_IN,elasticIn:uu.ELASTIC_IN,elasticOut:uu.ELASTIC_OUT,elasticInOut:uu.ELASTIC_IN_OUT,elasticOutIn:uu.ELASTIC_OUT_IN,backIn:uu.BACK_IN,backOut:uu.BACK_OUT,backInOut:uu.BACK_IN_OUT,backOutIn:uu.BACK_OUT_IN,bounceIn:uu.BOUNCE_IN,bounceOut:uu.BOUNCE_OUT,bounceInOut:uu.BOUNCE_IN_OUT,bounceOutIn:uu.BOUNCE_OUT_IN,smooth:uu.SMOOTH,fade:uu.FADE};var fJ=va,pJ=wa;function gJ(){throw new Error("split() only valid in Editor.")}fJ("cc.animation.ExoticAnimation")((VZ=function(){function t(){this._nodeAnimations=WZ&&WZ()}var e=t.prototype;return e.createEvaluator=function(t){return new RJ(this._nodeAnimations,t)},e.createEvaluatorForAnimationGraph=function(t){return new xJ(this._nodeAnimations,t)},e.addNodeAnimation=function(t){var e=new mJ(t);return this._nodeAnimations.push(e),e},e.collectAnimatedJoints=function(){return Array.from(new Set(this._nodeAnimations.map((function(t){return t.path}))))},e.split=function(){return gJ()},e.toHashString=function(){return this._nodeAnimations.map((function(t){return t.toHashString()})).join("\n")},t}(),WZ=ua(VZ.prototype,"_nodeAnimations",[pJ],(function(){return[]})),VZ));var mJ=fJ("cc.animation.ExoticNodeAnimation")((jZ=function(){function t(t){this._path=YZ&&YZ(),this._position=KZ&&KZ(),this._rotation=qZ&&qZ(),this._scale=QZ&&QZ(),this._path=t}var e=t.prototype;return e.createPosition=function(t,e){this._position=new AJ(t,new EJ(e))},e.createRotation=function(t,e){this._rotation=new AJ(t,new SJ(e))},e.createScale=function(t,e){this._scale=new AJ(t,new EJ(e))},e.createEvaluator=function(t){return new wJ(this._path,this._position,this._rotation,this._scale,t)},e.createEvaluatorForAnimationGraph=function(t){var e=t.bindTransform(this._path);return e?new DJ(e,this._position,this._rotation,this._scale):null},e.split=function(){return gJ()},e.toHashString=function(){var t,e,i,n,r,s;return this._path+"\n"+(null!==(t=null===(e=this._position)||void 0===e?void 0:e.toHashString())&&void 0!==t?t:"")+(null!==(i=null===(n=this._scale)||void 0===n?void 0:n.toHashString())&&void 0!==i?i:"")+(null!==(r=null===(s=this._rotation)||void 0===s?void 0:s.toHashString())&&void 0!==r?r:"")},n(t,[{key:"path",get:function(){return this._path}}]),t}(),YZ=ua(jZ.prototype,"_path",[pJ],(function(){return""})),KZ=ua(jZ.prototype,"_position",[pJ],(function(){return null})),qZ=ua(jZ.prototype,"_rotation",[pJ],(function(){return null})),QZ=ua(jZ.prototype,"_scale",[pJ],(function(){return null})),XZ=jZ))||XZ;function vJ(t){return t.toPrecision(2)}function yJ(t){return t.map((function(t){return Number.parseFloat(vJ(t))})).join(" ")}var TJ=fJ("cc.animation.ExoticVectorLikeTrackValues")((JZ=function(){function t(t){this._values=$Z&&$Z(),this._isQuantized=tJ&&tJ(),this._values=t}var e=t.prototype;return e.quantize=function(t){this._isQuantized,this._values=function(t,e){var i=OJ[e],n=1<<i.BYTES_PER_ELEMENT,r=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY;t.forEach((function(t){r=Math.min(t,r),s=Math.max(t,s)}));var o=s-r,a=i.from(t,(function(t){return(t-r)/o*n}));return new FJ(PJ(t),a,o,r)}(this._values,t),this._isQuantized=!0},e.toHashString=function(){var t=this._isQuantized,e=this._values;return t+" "+(t?e.toHashString():yJ(e))},n(t,[{key:"precision",get:function(){return this._isQuantized?this._values.originalPrecision:PJ(this._values)}}]),t}(),$Z=ua(JZ.prototype,"_values",[pJ],null),tJ=ua(JZ.prototype,"_isQuantized",[pJ],(function(){return!1})),ZZ=JZ))||ZZ,EJ=fJ("cc.animation.ExoticVec3TrackValues")(eJ=function(t){function e(){return t.apply(this,arguments)||this}s(e,t),e.imitate=function(t,i){var n=new e(t);return i._isQuantized&&n.quantize(i._values.quantizationType),n};var i=e.prototype;return i.get=function(t,e){var i=this._values;this._isQuantized?GJ(i,t,e):_n.fromArray(e,i,3*t)},i.lerp=function(t,e,i,n,r,s){var o=this._values;this._isQuantized?(GJ(o,t,n),GJ(o,e,r)):(_n.fromArray(n,o,3*t),_n.fromArray(r,o,3*e)),_n.lerp(s,n,r,i)},e}(TJ))||eJ,SJ=fJ("cc.animation.ExoticQuatTrackValues")(iJ=function(t){function e(){return t.apply(this,arguments)||this}s(e,t),e.imitate=function(t,i){var n=new e(t);return i._isQuantized&&n.quantize(i._values.quantizationType),n};var i=e.prototype;return i.get=function(t,e){var i=this._values;this._isQuantized?HJ(i,t,e):Rn.fromArray(e,i,4*t)},i.lerp=function(t,e,i,n,r,s){var o=this._values;this._isQuantized?(HJ(o,t,n),HJ(o,e,r)):(Rn.fromArray(n,o,4*t),Rn.fromArray(r,o,4*e)),Rn.slerp(s,n,r,i)},e}(TJ))||iJ,AJ=fJ("cc.animation.ExoticTrack")((rJ=function(){function t(t,e){this.times=sJ&&sJ(),this.values=oJ&&oJ(),this.times=t,this.values=e}return t.prototype.toHashString=function(){var t=this.times,e=this.values;return"times: "+yJ(t)+"; values: "+e.toHashString()},t}(),sJ=ua(rJ.prototype,"times",[pJ],null),oJ=ua(rJ.prototype,"values",[pJ],null),nJ=rJ))||nJ;function bJ(t,e){t.length,t.length;var i=0,n=0,r=na(t,e);if(r>=0)i=r;else{var s=~r,o=s-1;i=o;var a=t[s],h=t[o];n=(e-h)/(a-h)}return{index:i,ratio:n}}!function(){function t(){this._reset()}var e=t.prototype;e.calculate=function(t,e,i){if(this._reset(),!(e>i)){var n=t.length;if(n){var r=t[0],s=t[n-1],o=0,a=0;if(e<r);else if(e>=s)o=n-1,a=0;else{var h=bJ(t,e);o=h.index,a=h.ratio}var u=0,c=0;if(i<r);else if(i>=s)u=n-1,c=0;else{var l=bJ(t,i);u=l.index,c=l.ratio}var _=!a,d=!c;o!==u||a!==c?(_||(this.preLerpIndex=o,this.preLerpRatio=a),this.directKeyframesBegin=_?o:o+1,this.directKeyframesEnd=u+1,d||(this.postLerpIndex=u,this.postLerpRatio=c)):_?(this.directKeyframesBegin=o,this.directKeyframesEnd=o+1):(this.preLerpIndex=o,this.preLerpRatio=a)}}},e._reset=function(){this.preLerpIndex=-1,this.preLerpRatio=0,this.directKeyframesBegin=0,this.directKeyframesEnd=0,this.postLerpIndex=-1,this.postLerpRatio=0},n(t,[{key:"keyframesCount",get:function(){var t=this.preLerpIndex,e=this.directKeyframesBegin;return 0+(t<0?0:1)+(this.directKeyframesEnd-e)+(this.postLerpIndex<0?0:1)}}])}();var CJ,RJ=function(){function t(t,e){this._nodeEvaluations=void 0,this._nodeEvaluations=t.map((function(t){return t.createEvaluator(e)}))}return t.prototype.evaluate=function(t){this._nodeEvaluations.forEach((function(e){e.evaluate(t)}))},t}(),wJ=function(){function t(t,e,i,n,r){this._position=null,this._rotation=null,this._scale=null,e&&(this._position=UJ(e.times,e.values,_n,t,"position",r)),i&&(this._rotation=UJ(i.times,i.values,Rn,t,"rotation",r)),n&&(this._scale=UJ(n.times,n.values,_n,t,"scale",r))}return t.prototype.evaluate=function(t){if(this._position){var e=this._position.evaluator.evaluate(t);this._position.runtimeBinding.setValue(e)}if(this._rotation){var i=this._rotation.evaluator.evaluate(t);this._rotation.runtimeBinding.setValue(i)}if(this._scale){var n=this._scale.evaluator.evaluate(t);this._scale.runtimeBinding.setValue(n)}},t}(),IJ=function(){function t(t,e,i){this._times=void 0,this._inputSampleResultCache={just:!1,index:-1,nextIndex:-1,ratio:0},this._values=void 0,this._prevValue=void 0,this._nextValue=void 0,this._resultValue=void 0,this._times=t,this._values=e,this._prevValue=new i,this._nextValue=new i,this._resultValue=new i}return t.prototype.evaluate=function(t){var e=this._times,i=this._values,n=this._resultValue;if(0===e.length)return n;var r=function(t,e,i){var n=t.length,r=t[0],s=t[n-1];if(e<r)i.just=!0,i.index=0;else if(e>s)i.just=!0,i.index=n-1;else{var o=na(t,e);if(o>=0)i.just=!0,i.index=o;else{var a=~o,h=a-1,u=t[h],c=t[a],l=(e-t[h])/(c-u);i.just=!1,i.index=h,i.nextIndex=a,i.ratio=l}}return i}(e,t,this._inputSampleResultCache);return r.just?i.get(r.index,n):i.lerp(r.index,r.nextIndex,r.ratio,this._prevValue,this._nextValue,n),n},t}(),xJ=function(){function t(t,e){this._nodeEvaluations=void 0,this._nodeEvaluations=t.map((function(t){return t.createEvaluatorForAnimationGraph(e)})).filter((function(t){return!!t}))}var e=t.prototype;return e.destroy=function(){for(var t=this._nodeEvaluations,e=t.length,i=0;i<e;++i)t[i].destroy()},e.evaluate=function(t,e){for(var i=this._nodeEvaluations,n=i.length,r=0;r<n;++r)i[r].evaluate(t,e)},t}(),DJ=function(){function t(t,e,i,n){this._position=null,this._rotation=null,this._scale=null,this._transformHandle=void 0,this._transformHandle=t,e&&(this._position=new IJ(e.times,e.values,_n)),i&&(this._rotation=new IJ(i.times,i.values,Rn)),n&&(this._scale=new IJ(n.times,n.values,_n))}var e=t.prototype;return e.destroy=function(){this._transformHandle.destroy()},e.evaluate=function(t,e){var i=this._transformHandle.index,n=this._position,r=this._rotation,s=this._scale,o=e.transforms;if(n){var a=n.evaluate(t);o.setPosition(i,a)}if(r){var h=r.evaluate(t);o.setRotation(i,h)}if(s){var u=s.evaluate(t);o.setScale(i,u)}},t}(),OJ={uint8:Uint8Array,uint16:Uint16Array};function PJ(t){switch(t.BYTES_PER_ELEMENT){default:case 4:return CJ.FLOAT_32;case 8:return CJ.FLOAT_64}}!function(t){t[t.FLOAT_32=0]="FLOAT_32",t[t.FLOAT_64=1]="FLOAT_64"}(CJ||(CJ={}));var MJ,NJ,LJ,BJ,FJ=fJ("cc.animation.QuantizedFloatArray")((hJ=function(){function t(t,e,i,n){void 0===n&&(n=0),this.originalPrecision=uJ&&uJ(),this.min=cJ&&cJ(),this.extent=lJ&&lJ(),this.values=_J&&_J(),this.originalPrecision=t,this.values=e,this.extent=i,this.min=n}return t.prototype.toHashString=function(){var t=this.originalPrecision,e=this.min,i=this.extent,n=this.values;return t+" "+vJ(e)+" "+vJ(i)+" "+n.join(" ")},n(t,[{key:"quantizationType",get:function(){switch(this.values.BYTES_PER_ELEMENT){default:case 1:return"uint8";case 2:return"uint16"}}}]),t}(),uJ=ua(hJ.prototype,"originalPrecision",[pJ],null),cJ=ua(hJ.prototype,"min",[pJ],null),lJ=ua(hJ.prototype,"extent",[pJ],null),_J=ua(hJ.prototype,"values",[pJ],null),aJ=hJ))||aJ;function kJ(t,e){return t.values[e]/(1<<t.values.BYTES_PER_ELEMENT)*t.extent+t.min}function UJ(t,e,i,n,r,s){var o=new fQ;o.path=(new dQ).toHierarchy(n).toProperty(r);var a=s(o);return a?{runtimeBinding:a,evaluator:new IJ(t,e,i)}:null}function GJ(t,e,i){_n.set(i,kJ(t,3*e+0),kJ(t,3*e+1),kJ(t,3*e+2))}function HJ(t,e,i){Rn.set(i,kJ(t,4*e+0),kJ(t,4*e+1),kJ(t,4*e+2),kJ(t,4*e+3))}var zJ,VJ,WJ,XJ,jJ,YJ,KJ,qJ,QJ,ZJ,JJ,$J,t$,e$,i$,n$,r$,s$,o$,a$=va("cc.animation.AuxiliaryCurveEntry")((NJ=function(){this.name=LJ&&LJ(),this.curve=BJ&&BJ()},LJ=ua(NJ.prototype,"name",[wa],(function(){return""})),BJ=ua(NJ.prototype,"curve",[wa],(function(){return new Eu})),MJ=NJ))||MJ;function h$(t,e,i){for(var n=t.components,r=n.length,s=0;s<r;++s){var o=n[s],a=o[e];"function"==typeof a&&a.apply(o,i)}}var u$=Symbol("SearchForRootBonePath"),c$=Symbol("ExoticAnimation"),l$=Symbol("[[EmbeddedPlayerCount]]"),_$=Symbol("[[GetEmbeddedPlayers]]"),d$=Symbol("[[AddEmbeddedPlayer]]"),f$=Symbol("[[RemoveEmbeddedPlayer]]"),p$=Symbol("[[ClearEmbeddedPlayers]]"),g$=Symbol("[[Additive Settings]]"),m$=t("AnimationClip",va("cc.AnimationClip")(((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).sample=WJ&&WJ(),e.speed=XJ&&XJ(),e.wrapMode=jJ&&jJ(),e.enableTrsBlending=YJ&&YJ(),e._duration=KJ&&KJ(),e._hash=qJ&&qJ(),e.frameRate=0,e._tracks=QJ&&QJ(),e._exoticAnimation=ZJ&&ZJ(),e._legacyData=void 0,e._legacyDataDirty=!1,e._events=JJ&&JJ(),e._embeddedPlayers=$J&&$J(),e._additiveSettings=t$&&t$(),e._auxiliaryCurveEntries=e$&&e$(),e._runtimeEvents={ratios:[],eventGroups:[]},e}s(e,t),e.createWithSpriteFrames=function(t,i){var n=new e;n.sample=i||n.sample,n.duration=t.length/n.sample;var r=1/n.sample,s=new AZ;return s.path=(new dQ).toComponent("cc.Sprite").toProperty("spriteFrame"),s.channels()[0].curve.assignSorted(t.map((function(t,e){return[r*e,t]}))),n.addTrack(s),n};var i=e.prototype;return i.onLoaded=function(){this.frameRate=this.sample,this.events=this._events},i.range=function(){for(var t={min:1/0,max:-1/0},e=this._tracks,i=e.length,n=0;n<i;++n){var r=e[n].range();t.min=Math.min(t.min,r.min),t.max=Math.max(t.max,r.max)}return t},i.getTrack=function(t){return this._tracks[t]},i.addTrack=function(t){var e=this._tracks.length;return this._tracks.push(t),e},i.removeTrack=function(t){this._tracks.splice(t,1)},i.clearTracks=function(){this._tracks.length=0},i.containsAnyEvent=function(){return 0!==this._events.length},i.createEventEvaluator=function(t){return new I$(t,this._runtimeEvents.ratios,this._runtimeEvents.eventGroups,this.wrapMode)},i.containsAnyEmbeddedPlayer=function(){return 0!==this._embeddedPlayers.length},i.createEmbeddedPlayerEvaluator=function(t){return new T$(this._embeddedPlayers,t)},i.createEvaluator=function(t){var e=this,i=t.target;return this._createEvalWithBinder(i,(function(n){if(!t.mask||!n.isMaskedOff(t.mask)){var r=n.createRuntimeBinding(i,e.enableTrsBlending?t.pose:void 0,!1);return null!=r?r:void 0}}),t.rootMotion)},i.destroy=function(){var e;return null!==(e=m.director.root)&&void 0!==e&&e.dataPoolManager&&m.director.root.dataPoolManager.releaseAnimationClip(this),Dj.destroy(this),t.prototype.destroy.call(this)},i[xj]=function(t,e,i){for(var n=1/e,r=this._collectAnimatedJoints(),s=r.length,o={},a=0;a<s;++a)o[r[a]]={transforms:Array.from({length:i},(function(){return new Ln}))};var h=r.reduce((function(t,e){return t[e]=new A$,t}),{});for(var u in h){var c=h[u],l=u.lastIndexOf("/");if(l>=0){var _=u.substring(0,l),d=h[_];d&&(c.parent=d)}}for(var f=this._createEvalWithBinder(void 0,(function(t){var e=t.parseTrsPath();if(e){var i=h[e.node];if(i)return w$(i,e.property)}}),void 0),p=0;p<i;++p){var g=t+n*p;f.evaluate(g);for(var m=0;m<s;++m){var v=r[m];Ln.copy(o[v].transforms[p],h[v].globalTransform)}for(var y=0;y<s;++y){var T=r[y];h[T].invalidate()}}return{samples:e,frames:i,joints:o}},i.upgradeUntypedTracks=function(t){for(var e=[],i=[],n=this._tracks,r=n.length,s=0;s<r;++s){var o=n[s];if(o instanceof FZ){var a=o.upgrade(t);a&&(e.push(a),i.push(o))}}for(var h=i.length,u=0;u<h;++u)ue(n,i[u]);n.push.apply(n,e)},i[u$]=function(){return this._searchForRootBonePath()},i.getPropertyCurves=function(){return this._getLegacyData().getPropertyCurves()},i.updateEventDatas=function(){this.events=this._events},i.hasEvents=function(){return 0!==this.events.length},i.syncLegacyData=function(){this._legacyData&&(this._fromLegacy(this._legacyData),this._legacyData=void 0)},i[_$]=function(){return this._embeddedPlayers},i[d$]=function(t){this._embeddedPlayers.push(t)},i[f$]=function(t){var e=this._embeddedPlayers.indexOf(t);e>=0&&this._embeddedPlayers.splice(e,1)},i[p$]=function(){this._embeddedPlayers.length=0},i.getAuxiliaryCurveNames_experimental=function(){return this._auxiliaryCurveEntries.map((function(t){return t.name}))},i.hasAuxiliaryCurve_experimental=function(t){return!!this._findAuxiliaryCurveEntry(t)},i.addAuxiliaryCurve_experimental=function(t){var e=this._findAuxiliaryCurveEntry(t);return e||((e=new a$).name=t,this._auxiliaryCurveEntries.push(e)),e.curve},i.getAuxiliaryCurve_experimental=function(t){return this._findAuxiliaryCurveEntry(t).curve},i.renameAuxiliaryCurve_experimental=function(t,e){var i=this._findAuxiliaryCurveEntry(t);i&&(i.name=e)},i.removeAuxiliaryCurve_experimental=function(t){le(this._auxiliaryCurveEntries,(function(e){return e.name===t}))},i._trySyncLegacyData=function(){this._legacyDataDirty&&(this._legacyDataDirty=!1,this.syncLegacyData())},i._createEvalWithBinder=function(t,e,i){this._legacyDataDirty&&(this._legacyDataDirty=!1,this.syncLegacyData());var n,r=[];i&&(n=this._createRootMotionEvaluation(t,i,r));for(var s,o=[],a=this._tracks,h=a.length,u=0;u<h;++u){var c=a[u];if(!r.includes(c)&&!Array.from(c.channels()).every((function(t){return 0===t.curve.keyFramesCount}))){var l=e(c[_Q]);if(l){var _=void 0;if(c instanceof FZ){if(!l.getValue){Z(3930);continue}var d=l.getValue();_=c.createLegacyEval(d)}else _=c[yq]();o.push(new y$(l,_))}}}return this._exoticAnimation&&(s=this._exoticAnimation.createEvaluator(e)),new E$(o,s,n)},i._createRootMotionEvaluation=function(t,e,i){if(t instanceof Tm){var n=this._searchForRootBonePath();if(n){var r=t.getChildByPath(n);if(r){for(var s=new S$,o=[],a=this._tracks,h=a.length,u=0;u<h;++u){var c=a[u],l=c[_Q].parseTrsPath();if(l&&l.node===n){i.push(c);var _=w$(s,l.property);if(_){var d=c[yq]();o.push(new y$(_,d))}}}return new C$(r,this._duration,s,o)}q(3924)}else q(3923)}else Z(3920)},i._searchForRootBonePath=function(){var t=this._tracks.map((function(t){var e=t[_Q].parseTrsPath();if(e){var i=e.node;return{path:i,rank:i.split("/").length}}return{path:"",rank:0}}));t.sort((function(t,e){return t.rank-e.rank}));var e=t.findIndex((function(t){return 0!==t.rank}));if(e<0)return"";for(var i=t.length,n=t[e],r=!0,s=e+1;s<i;++s){var o=t[s];if(o.rank!==n.rank)break;if(o.path!==n.path){r=!1;break}}return r?n.path:""},i._getLegacyData=function(){return this._legacyData||(this._legacyData=this._toLegacy()),this._legacyData},i._toLegacy=function(){var t=new kZ(this._duration);return t.keys=[],t.curves=[],t.commonTargets=[],t},i._fromLegacy=function(t){for(var e=t.toTracks(),i=e.length,n=0;n<i;++n)this.addTrack(e[n])},i._collectAnimatedJoints=function(){for(var t=new Set,e=this._tracks,i=e.length,n=0;n<i;++n){var r=e[n][_Q].parseTrsPath();r&&t.add(r.node)}if(this._exoticAnimation)for(var s=this._exoticAnimation.collectAnimatedJoints(),o=s.length,a=0;a<o;++a)t.add(s[a]);return Array.from(t)},i._findAuxiliaryCurveEntry=function(t){return this._auxiliaryCurveEntries.find((function(e){return e.name===t}))},n(e,[{key:"duration",get:function(){return this._duration},set:function(t){this._duration=t}},{key:"tracksCount",get:function(){return this._tracks.length}},{key:"tracks",get:function(){return this._tracks}},{key:"hash",get:function(){var t,e;if(this._hash)return this._hash;var i="Exotic:"+(null!==(t=null===(e=this._exoticAnimation)||void 0===e?void 0:e.toHashString())&&void 0!==t?t:"");return this._hash=nl(i,666)}},{key:"events",get:function(){return this._events},set:function(t){var e=this;this._events=t;for(var i=[],n=[],r=this.events.sort((function(t,e){return t.frame-e.frame})),s=r.length,o=function(){var t=r[a],s=t.frame/e._duration,o=i.findIndex((function(t){return t===s}));o<0&&(o=i.length,i.push(s),n.push({events:[]})),n[o].events.push({functionName:t.func,parameters:t.params})},a=0;a<s;++a)o();this._runtimeEvents={ratios:i,eventGroups:n}}},{key:c$,get:function(){return this._exoticAnimation}},{key:c$,set:function(t){this._exoticAnimation=t}},{key:"isAdditive_experimental",get:function(){return this._additiveSettings.enabled}},{key:g$,get:function(){return this._additiveSettings}},{key:"keys",get:function(){return this._getLegacyData().keys}},{key:"keys",set:function(t){this._legacyDataDirty=!0,this._getLegacyData().keys=t}},{key:"curves",get:function(){return this._legacyDataDirty=!0,this._getLegacyData().curves}},{key:"curves",set:function(t){this._getLegacyData().curves=t}},{key:"commonTargets",get:function(){return this._getLegacyData().commonTargets}},{key:"commonTargets",set:function(t){this._legacyDataDirty=!0,this._getLegacyData().commonTargets=t}},{key:"data",get:function(){return this._getLegacyData().data}},{key:"eventGroups",get:function(){return this._runtimeEvents.eventGroups}},{key:l$,get:function(){return this._embeddedPlayers.length}},{key:"auxiliaryCurveCount_experimental",get:function(){return this._auxiliaryCurveEntries.length}}]),e}(Of)).WrapMode=Tq,WJ=ua((VJ=i$).prototype,"sample",[wa],(function(){return 60})),XJ=ua(VJ.prototype,"speed",[wa],(function(){return 1})),jJ=ua(VJ.prototype,"wrapMode",[wa],(function(){return Tq.Normal})),YJ=ua(VJ.prototype,"enableTrsBlending",[wa],(function(){return!1})),KJ=ua(VJ.prototype,"_duration",[wa],(function(){return 0})),qJ=ua(VJ.prototype,"_hash",[wa],(function(){return 0})),QJ=ua(VJ.prototype,"_tracks",[wa],(function(){return[]})),ZJ=ua(VJ.prototype,"_exoticAnimation",[wa],(function(){return null})),JJ=ua(VJ.prototype,"_events",[wa],(function(){return[]})),$J=ua(VJ.prototype,"_embeddedPlayers",[wa],(function(){return[]})),t$=ua(VJ.prototype,"_additiveSettings",[wa],(function(){return new v$})),e$=ua(VJ.prototype,"_auxiliaryCurveEntries",[wa],(function(){return[]})),zJ=VJ))||zJ),v$=va("cc.AnimationClipAdditiveSettings")((r$=function(){this.enabled=s$&&s$(),this.refClip=o$&&o$()},s$=ua(r$.prototype,"enabled",[wa],(function(){return!1})),o$=ua(r$.prototype,"refClip",[wa],(function(){return null})),n$=r$))||n$;m.AnimationClip=m$;var y$=function(){function t(t,e){this._binding=void 0,this._trackEval=void 0,this._shouldEvaluateDefault=!0,this._binding=t,this._trackEval=e,this._shouldEvaluateDefault=!!t.getValue&&e.requiresDefault}return t.prototype.evaluate=function(t){var e=this._binding,i=this._trackEval,n=this._shouldEvaluateDefault?e.getValue():void 0,r=i.evaluate(t,n);e.setValue(r)},t}(),T$=function(){function t(t,e){this._embeddedPlayers=t,this._embeddedPlayerEvaluationInfos=t.map((function(t){var i=t.playable;if(!i)return null;var n=i.instantiate(e);return n?{instantiatedPlayer:n,entered:!1,hostPauseTime:0,lastIterations:0}:null}))}var e=t.prototype;return e.destroy=function(){for(var t=this._embeddedPlayerEvaluationInfos,e=t.length,i=0;i<e;++i){var n;null===(n=t[i])||void 0===n||n.instantiatedPlayer.destroy()}this._embeddedPlayerEvaluationInfos.length=0},e.evaluate=function(t,e){for(var i=this._embeddedPlayers,n=this._embeddedPlayerEvaluationInfos,r=i.length,s=0;s<r;++s){var o=n[s];if(o){var a=o.entered,h=o.instantiatedPlayer,u=o.lastIterations,c=i[s],l=c.begin,_=c.end;if(t>=l&&t<=_?a?e!==u&&(h.stop(),h.play(),o.entered=!0):(h.play(),o.entered=!0):a&&(h.stop(),o.entered=!1),o.lastIterations=e,o.entered){var d=t-l;o.instantiatedPlayer.setTime(d)}}}},e.notifyHostSpeedChanged=function(t){for(var e=this._embeddedPlayers,i=this._embeddedPlayerEvaluationInfos,n=e.length,r=0;r<n;++r){var s=i[r];if(s){var o=s.instantiatedPlayer;e[r].reconciledSpeed&&o.setSpeed(t)}}},e.notifyHostPlay=function(t){for(var e=this._embeddedPlayers,i=this._embeddedPlayerEvaluationInfos,n=e.length,r=0;r<n;++r){var s=i[r];if(s){var o=e[r],a=o.begin,h=o.end,u=s.instantiatedPlayer;if(s.entered){var c=s.hostPauseTime;if(u.randomAccess||Oi(c,t,1e-5)){var l=Pi(t,a,h);u.play(),u.setTime(l-a)}else u.stop()}}}},e.notifyHostPause=function(t){for(var e=this._embeddedPlayers,i=this._embeddedPlayerEvaluationInfos,n=e.length,r=0;r<n;++r){var s=i[r];if(s){var o=s.instantiatedPlayer;s.entered&&(o.pause(),s.hostPauseTime=t)}}},e.notifyHostStop=function(){for(var t=this._embeddedPlayers,e=this._embeddedPlayerEvaluationInfos,i=t.length,n=0;n<i;++n){var r=e[n];if(r){var s=r.instantiatedPlayer;r.entered&&(r.entered=!1,s.stop())}}},t}(),E$=function(){function t(t,e,i){this._exoticAnimationEvaluator=void 0,this._trackEvalStatues=[],this._rootMotionEvaluation=void 0,this._trackEvalStatues=t,this._exoticAnimationEvaluator=e,this._rootMotionEvaluation=i}var e=t.prototype;return e.evaluate=function(t){for(var e=this._trackEvalStatues,i=this._exoticAnimationEvaluator,n=e.length,r=0;r<n;++r)e[r].evaluate(t);i&&i.evaluate(t)},e.evaluateRootMotion=function(t,e){var i=this._rootMotionEvaluation;i&&i.evaluate(t,e)},t}(),S$=function(){function t(){this.position=new _n,this.scale=new _n(1,1,1),this.rotation=new Rn,this.eulerAngles=new _n}return t.prototype.getTransform=function(t){Ln.fromRTS(t,this.rotation,this.position,this.scale)},t}(),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).parent=null,e._dirty=!0,e._transform=new Ln,e}return s(e,t),e.prototype.invalidate=function(){this._dirty=!0},n(e,[{key:"globalTransform",get:function(){var t=this._transform;return this._dirty&&(this._dirty=!1,Ln.fromRTS(t,this.rotation,this.position,this.scale),this.parent&&Ln.multiply(t,this.parent.globalTransform,t)),this._transform}}]),e}(S$),b$=new Ln,C$=function(){function t(t,e,i,n){this._initialTransformCache=new Ln,this._clipEndTransformCache=new Ln,this._startTransformCache=new Ln,this._endTransformCache=new Ln,this._motionTransformCache=new Ln,this._translationMotionCache=new _n,this._rotationMotionCache=new Rn,this._scaleMotionCache=new _n,this._rootBone=t,this._duration=e,this._boneTransform=i,this._trackEvalStatuses=n}var e=t.prototype;return e.evaluate=function(t,e){var i=this._calcMotionTransform(t,e,this._motionTransformCache),n=this._translationMotionCache,r=this._rotationMotionCache,s=this._scaleMotionCache,o=this._rootBone;Ln.toRTS(i,r,n,s),_n.add(n,n,o.position),o.setPosition(n),Rn.multiply(r,r,o.rotation),o.setRotation(r),_n.multiply(s,s,o.scale),o.setScale(s)},e._calcMotionTransform=function(t,e,i){var n=this._duration,r=n-t,s=this._evaluateAt(t,this._startTransformCache);if(e<r){var o=this._evaluateAt(t+e,this._endTransformCache);R$(i,s,o)}else{Ln.identity(i);var a=function(t,e){R$(b$,t,e),Ln.multiply(i,i,b$)},h=e-r,u=Math.floor(h/n),c=h-u*n,l=this._evaluateAt(0,this._initialTransformCache),_=this._evaluateAt(n,this._clipEndTransformCache),d=this._evaluateAt(c,this._endTransformCache);a(s,_),R$(b$,l,_);for(var f=0;f<u;++f)Ln.multiply(i,i,b$);a(l,d)}return i},e._evaluateAt=function(t,e){for(var i=this._trackEvalStatuses,n=i.length,r=0;r<n;++r)i[r].evaluate(t);return this._boneTransform.getTransform(e),e},t}();function R$(t,e,i){Ln.invert(t,e),Ln.multiply(t,i,t)}function w$(t,e){switch(e){default:return;case"position":return{setValue:function(e){_n.copy(t.position,e)}};case"rotation":return{setValue:function(e){Rn.copy(t.rotation,e)}};case"scale":return{setValue:function(e){_n.copy(t.scale,e)}};case"eulerAngles":return{setValue:function(e){_n.copy(t.eulerAngles,e)}}}}var I$=function(){function t(t,e,i,n){this._lastFrameIndex=-1,this._lastIterations=0,this._lastDirection=0,this._ignoreIndex=-1,this._sampled=!1,this._targetNode=t,this._ratios=e,this._eventGroups=i,this._wrapMode=n}var e=t.prototype;return e.setWrapMode=function(t){this._wrapMode=t},e.ignore=function(t,e){this._ignoreIndex=-1,this._sampled=!1;var i=D$(t,this._ratios);i<0&&(i=~i-1,e<0&&(i+=1),this._ignoreIndex=i)},e.reset=function(){this._lastFrameIndex=-1,this._lastIterations=0,this._lastDirection=0,this._ignoreIndex=-1,this._sampled=!1},e.sample=function(t,e,i){if(0!==this._eventGroups.length){var n=this._eventGroups.length,r=D$(t,this._ratios);if(r<0&&(r=~r-1,e<0&&(r+=1)),this._ignoreIndex!==r&&(this._ignoreIndex=-1),!this._sampled)return this._sampled=!0,this._doFire(r,!1),this._lastFrameIndex=r,this._lastIterations=i,void(this._lastDirection=e);var s=this._wrapMode,o=x$(i),a=x$(this._lastIterations),h=this._lastFrameIndex,u=this._lastDirection,c=-1!==a&&o!==a;if(h===r&&c&&1===n)this._doFire(0,!1);else if(h!==r||c){e=u;do{if(h!==r){if(-1===e&&0===h&&r>0?((s&bc.PingPong)===bc.PingPong?e*=-1:h=n,a++):1===e&&h===n-1&&r<n-1&&((s&bc.PingPong)===bc.PingPong?e*=-1:h=-1,a++),h===r)break;if(a>o)break}h+=e,this._doFire(h,!0)}while(h!==r&&h>-1&&h<n)}this._lastFrameIndex=r,this._lastIterations=i,this._lastDirection=e}},e._doFire=function(t,e){e?wq().pushDelayEvent(this._checkAndFire,this,[t]):this._checkAndFire(t)},e._checkAndFire=function(t){if(this._targetNode&&this._targetNode.isValid){var e=this._eventGroups;if(!(t<0||t>=e.length||this._ignoreIndex===t))for(var i=e[t],n=i.events.length,r=0;r<n;++r){var s=i.events[r];h$(this._targetNode,s.functionName,s.parameters)}}},t}();function x$(t){return t-(0|t)==0&&(t-=1),0|t}function D$(t,e){return na(e,t)}var O$,P$=function(){function t(){this._nodeBlendStates=new Map}var e=t.prototype;return e.createWriter=function(t,e,i,n){var r=this.ref(t,e);return new M$(t,e,r,i,n)},e.destroyWriter=function(t){var e=t;this.deRef(e.node,e.property)},e.ref=function(t,e){var i=this._nodeBlendStates.get(t);return i||(i=this.createNodeBlendState(),this._nodeBlendStates.set(t,i)),i.refProperty(t,e)},e.deRef=function(t,e){var i=this._nodeBlendStates.get(t);i&&(i.deRefProperty(e),i.empty&&this._nodeBlendStates.delete(t))},e.apply=function(){this._nodeBlendStates.forEach((function(t,e){t.apply(e)}))},t}(),M$=function(){function t(t,e,i,n,r){this._node=t,this._property=e,this._propertyBlendState=i,this._host=n,this._constants=r}var e=t.prototype;return e.getValue=function(){return this._node[this._property]},e.setValue=function(t){var e=this._propertyBlendState,i=this._host.weight;e.blend(t,i)},n(t,[{key:"node",get:function(){return this._node}},{key:"property",get:function(){return this._property}}]),t}();!function(t){t[t.POSITION=1]="POSITION",t[t.ROTATION=2]="ROTATION",t[t.SCALE=4]="SCALE",t[t.EULER_ANGLES=8]="EULER_ANGLES"}(O$||(O$={})),O$.POSITION,O$.ROTATION,O$.SCALE,O$.EULER_ANGLES;var N$,L$,B$=function(){function t(){this.refCount=0,this.accumulatedWeight=0,this.result=new _n}var e=t.prototype;return e.blend=function(t,e){this.accumulatedWeight=function(t,e,i,n,r){var s=i+r;if(1!==r||i){if(s){var o=r/s;_n.lerp(t,t,n,o)}}else _n.copy(t,n);return s}(this.result,this.result,this.accumulatedWeight,t,e)},e.reset=function(){this.accumulatedWeight=0,_n.zero(this.result)},t}(),F$=function(){function t(){this.refCount=0,this.accumulatedWeight=0,this.result=new Rn}var e=t.prototype;return e.blend=function(t,e){this.accumulatedWeight=function(t,e,i,n,r){var s=i+r;if(1!==r||i){if(s){var o=r/s;Rn.slerp(t,e,n,o)}}else Rn.copy(t,n);return s}(this.result,this.result,this.accumulatedWeight,t,e)},e.reset=function(){this.accumulatedWeight=0,Rn.identity(this.result)},t}(),k$=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.apply=function(e){var i=this._properties,n=i.position,r=i.scale,s=i.rotation,o=i.eulerAngles;n&&n.accumulatedWeight&&(this._transformApplyFlags|=O$.POSITION,n.accumulatedWeight<1&&n.blend(e.position,1-n.accumulatedWeight)),r&&r.accumulatedWeight&&(this._transformApplyFlags|=O$.SCALE,r.accumulatedWeight<1&&r.blend(e.scale,1-r.accumulatedWeight)),o&&o.accumulatedWeight&&(this._transformApplyFlags|=O$.EULER_ANGLES,o.accumulatedWeight<1&&o.blend(e.eulerAngles,1-o.accumulatedWeight)),s&&s.accumulatedWeight&&(this._transformApplyFlags|=O$.ROTATION,s.accumulatedWeight<1&&s.blend(e.rotation,1-s.accumulatedWeight)),t.prototype.apply.call(this,e),null==n||n.reset(),null==r||r.reset(),null==s||s.reset(),null==o||o.reset()},i._createVec3BlendState=function(){return new B$},i._createQuatBlendState=function(){return new F$},e}(function(){function t(){this._transformApplyFlags=0,this._properties={}}var e=t.prototype;return e.refProperty=function(t,e){var i,n,r,s=this._properties;switch(e){default:case"position":case"scale":case"eulerAngles":r=null!==(i=s[e])&&void 0!==i?i:s[e]=this._createVec3BlendState(t[e]);break;case"rotation":r=null!==(n=s[e])&&void 0!==n?n:s[e]=this._createQuatBlendState(t.rotation)}return++r.refCount,r},e.deRefProperty=function(t){var e=this._properties,i=e[t];i&&(--i.refCount,i.refCount>0||delete e[t])},e.apply=function(t){var e,i,n,r=this._transformApplyFlags,s=this._properties,o=s.position,a=s.scale,h=s.rotation,u=s.eulerAngles;r&&(o&&r&O$.POSITION&&(e=o.result),a&&r&O$.SCALE&&(i=a.result),u&&r&O$.EULER_ANGLES&&(n=u.result),h&&r&O$.ROTATION&&(n=h.result),(n||e||i)&&t.setRTS(n,e,i),this._transformApplyFlags=0)},n(t,[{key:"empty",get:function(){var t=this._properties;return!(t.position||t.rotation||t.eulerAngles||t.scale)}}]),t}()),U$=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.createNodeBlendState=function(){return new k$},e}(P$),G$=t("AnimationManager",va(((L$=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._anims=new oe([]),e._crossFades=new oe([]),e._delayEvents=[],e._blendStateBuffer=new U$,e._sockets=[],e}s(e,t);var i=e.prototype;return i.addCrossFade=function(t){-1===this._crossFades.array.indexOf(t)&&this._crossFades.push(t)},i.removeCrossFade=function(t){var e=this._crossFades.array.indexOf(t);e>=0?this._crossFades.fastRemoveAt(e):Z(3907)},i.update=function(t){var e=this._delayEvents,i=this._crossFades,n=this._sockets,r=i.array;for(i.i=0;i.i<r.length;++i.i)r[i.i].update(t);var s=this._anims,o=s.array;for(s.i=0;s.i<o.length;++s.i){var a=o[s.i];a.isMotionless||a.update(t)}this._blendStateBuffer.apply();for(var h=DD.getTotalFrames(),u=0,c=n.length;u<c;u++){var l=n[u],_=l.target,d=l.transform;_.matrix=jj(d,h)}for(var f=0,p=e.length;f<p;f++){var g=e[f];g.fn.apply(g.thisArg,g.args)}e.length=0},i.destruct=function(){},i.addAnimation=function(t){-1===this._anims.array.indexOf(t)&&this._anims.push(t)},i.removeAnimation=function(t){var e=this._anims.array.indexOf(t);e>=0?this._anims.fastRemoveAt(e):Z(3907)},i.pushDelayEvent=function(t,e,i){this._delayEvents.push({fn:t,thisArg:e,args:i})},i.addSockets=function(t,e){for(var i=this,n=function(){var n=e[r];if(i._sockets.find((function(t){return t.target===n.target})))return 1;var s=t.getChildByPath(n.path),o=n.target&&s&&Yj(s,t);o&&i._sockets.push({target:n.target,transform:o})},r=0;r<e.length;++r)n()},i.removeSockets=function(t,e){for(var i=0;i<e.length;++i)for(var n=e[i],r=0;r<this._sockets.length;++r){var s=this._sockets[r];if(s.target===n.target){Kj(s.transform.node),this._sockets[r]=this._sockets[this._sockets.length-1],this._sockets.length--;break}}},n(e,[{key:"blendState",get:function(){return this._blendStateBuffer}}]),e}(Yc)).ID="animation",N$=L$))||N$);DD.on(ID.EVENT_INIT,(function(){var t=new G$;DD.registerSystem(G$.ID,t,Yc.Priority.HIGH)})),m.AnimationManager=G$;var H$,z$,V$,W$,X$,j$,Y$,K$,q$,Q$,Z$,J$,$$,t0,e0=function(t){function e(e){var i;return(i=t.call(this)||this)._managedStates=[],i._fadings=[],i._scheduled=!1,i._scheduler=null!=e?e:wq(),i}s(e,t);var i=e.prototype;return i.update=function(t){if(!this.isMotionless){var e=this._managedStates,i=this._fadings;if(1===e.length&&1===i.length){var n=e[0].state;n&&(n.weight=1)}else this._calculateWeights(t);1===e.length&&1===i.length&&this._unscheduleThis()}},i.crossFade=function(t,e){var i;0===this._managedStates.length&&(e=0),0===e&&this.clear();var n=this._managedStates.find((function(e){return e.state===t}));n?null!==(i=n.state)&&void 0!==i&&i.isMotionless&&n.state.play():(n={state:t,reference:0},t&&t.play(),this._managedStates.push(n)),++n.reference,this._fadings.unshift({easeDuration:e,easeTime:0,target:n}),this.isMotionless||this._scheduleThis()},i.clear=function(){for(var t=0;t<this._managedStates.length;++t){var e=this._managedStates[t].state;e&&e.stop()}this._managedStates.length=0,this._fadings.length=0},i.onPlay=function(){t.prototype.onPlay.call(this),this._scheduleThis()},i.onPause=function(){t.prototype.onPause.call(this);for(var e=0;e<this._managedStates.length;++e){var i=this._managedStates[e].state;i&&i.pause()}this._unscheduleThis()},i.onResume=function(){t.prototype.onResume.call(this);for(var e=0;e<this._managedStates.length;++e){var i=this._managedStates[e].state;i&&i.resume()}this._scheduleThis()},i.onStop=function(){t.prototype.onStop.call(this),this.clear()},i._calculateWeights=function(t){for(var e=this._managedStates,i=this._fadings,n=0;n<e.length;++n){var r=e[n].state;r&&(r.weight=0)}for(var s=1,o=i.length,a=0;a<i.length;++a){var h=i[a];h.easeTime+=t;var u=0===h.easeDuration?1:Mi(h.easeTime/h.easeDuration),c=u*s;if(s*=1-u,h.target.state&&(h.target.state.weight+=c),h.easeTime>=h.easeDuration){o=a+1,h.easeTime=h.easeDuration;break}}if(o!==i.length){for(var l=o;l<i.length;++l){var _=i[l];--_.target.reference,_.target.reference<=0&&(_.target.state&&_.target.state.stop(),ue(this._managedStates,_.target))}i.splice(o)}},i._scheduleThis=function(){this._scheduled||(this._scheduler.addCrossFade(this),this._scheduled=!0)},i._unscheduleThis=function(){this._scheduled&&(this._scheduler.removeCrossFade(this),this._scheduled=!1)},e}(Aq),i0=(H$=va("cc.Animation"),z$=Ta(99),V$=Za([m$]),W$=Za(m$),X$=Za([m$]),H$(j$=z$(((Z$=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).playOnLoad=K$&&K$(),e._crossFade=new e0,e._nameToState=Dt(!0),e._clips=q$&&q$(),e._defaultClip=Q$&&Q$(),e._hasBeenPlayed=!1,e}s(e,t);var i=e.prototype;return i.onLoad=function(){for(var t in this.clips=this._clips,this._nameToState)this._nameToState[t].initialize(this.node)},i.start=function(){this.playOnLoad&&!this._hasBeenPlayed&&this._defaultClip&&this.crossFade(this._defaultClip.name,0)},i.onEnable=function(){this._crossFade.resume()},i.onDisable=function(){this._crossFade.pause()},i.onDestroy=function(){for(var t in this._crossFade.stop(),this._nameToState)this._nameToState[t].destroy();this._nameToState=Dt(!0)},i.play=function(t){if(this._hasBeenPlayed=!0,!t){if(!this._defaultClip)return;t=this._defaultClip.name}this.crossFade(t,0)},i.crossFade=function(t,e){void 0===e&&(e=.3),this._hasBeenPlayed=!0;var i=this._nameToState[t];i&&this.doPlayOrCrossFade(i,e)},i.pause=function(){this._crossFade.pause()},i.resume=function(){this._crossFade.resume()},i.stop=function(){this._crossFade.stop()},i.getState=function(t){var e=this._nameToState[t];return e&&!e.curveLoaded&&e.initialize(this.node),e||null},i.createState=function(t,e){return e=e||t.name,this.removeState(e),this._doCreateState(t,e)},i.removeState=function(t){var e=this._nameToState[t];e&&(e.allowLastFrameEvent(!1),e.stop(),delete this._nameToState[t])},i.addClip=function(t,e){return _e(this._clips,t)||this._clips.push(t),this.createState(t,e)},i.removeClip=function(t,e){var i;for(var n in this._nameToState){var r=this._nameToState[n];if(r.clip===t){i=r;break}}if(t===this._defaultClip){if(!e)return void q(3902);this._defaultClip=null}if(i&&i.isPlaying){if(!e)return void q(3903);i.stop()}this._clips=this._clips.filter((function(e){return e!==t})),i&&delete this._nameToState[i.name]},i.on=function(e,i,n,r){var s=t.prototype.on.call(this,e,i,n,r);return e===bq.LASTFRAME&&this._syncAllowLastFrameEvent(),s},i.once=function(e,i,n){var r=t.prototype.once.call(this,e,i,n);return e===bq.LASTFRAME&&this._syncAllowLastFrameEvent(),r},i.off=function(e,i,n){t.prototype.off.call(this,e,i,n),e===bq.LASTFRAME&&this._syncDisallowLastFrameEvent()},i._createState=function(t,e){return new Oq(t,e)},i._doCreateState=function(t,e){var i=this._createState(t,e);return i._setEventTarget(this),i.allowLastFrameEvent(this.hasEventListener(bq.LASTFRAME)),this.node&&i.initialize(this.node),this._nameToState[i.name]=i,i},i.doPlayOrCrossFade=function(t,e){this._crossFade.play(),this._crossFade.crossFade(t,e)},i._removeStateOfAutomaticClip=function(t){for(var e in this._nameToState){var i=this._nameToState[e];n0(t,i.clip)&&(i.stop(),delete this._nameToState[e])}},i._syncAllowLastFrameEvent=function(){if(this.hasEventListener(bq.LASTFRAME))for(var t in this._nameToState)this._nameToState[t].allowLastFrameEvent(!0)},i._syncDisallowLastFrameEvent=function(){if(!this.hasEventListener(bq.LASTFRAME))for(var t in this._nameToState)this._nameToState[t].allowLastFrameEvent(!1)},n(e,[{key:"clips",get:function(){return this._clips},set:function(t){var e=this;this._crossFade&&this._crossFade.clear();for(var i,n=d(this._clips);!(i=n()).done;){var r=i.value;r&&this._removeStateOfAutomaticClip(r)}for(var s,o=d(t);!(s=o()).done;){var a=s.value;a&&this.createState(a)}var h=t.find((function(t){return n0(t,e._defaultClip)}));this._defaultClip=h||null,this._clips=t}},{key:"defaultClip",get:function(){return this._defaultClip},set:function(t){this._defaultClip=t,t&&(this._clips.findIndex((function(e){return n0(e,t)}))>=0||(this._clips.push(t),this.createState(t)))}}]),e}(so(xp))).EventType=bq,f((Y$=Z$).prototype,"clips",[V$],Object.getOwnPropertyDescriptor(Y$.prototype,"clips"),Y$.prototype),f(Y$.prototype,"defaultClip",[W$],Object.getOwnPropertyDescriptor(Y$.prototype,"defaultClip"),Y$.prototype),K$=ua(Y$.prototype,"playOnLoad",[wa],(function(){return!1})),q$=ua(Y$.prototype,"_clips",[X$],(function(){return[]})),Q$=ua(Y$.prototype,"_defaultClip",[wa],(function(){return null})),j$=Y$))||j$)||j$);function n0(t,e){return t===e||!!t&&!!e&&t._uuid===e._uuid&&t._uuid}t({Animation:i0,AnimationComponent:i0}),m.Animation=i0,m.AnimationComponent=i0,Jt(i0,"cc.AnimationComponent"),function(t){t.PLAYED="play",t.PAUSED="pause",t.STOPPED="stop",t.SEEKED="seeked",t.ENDED="ended",t.INTERRUPTION_BEGIN="interruptionBegin",t.INTERRUPTION_END="interruptionEnd",t.USER_GESTURE="on_gesture"}(J$||(J$={})),function(t){t[t.DOM_AUDIO=0]="DOM_AUDIO",t[t.WEB_AUDIO=1]="WEB_AUDIO",t[t.MINIGAME_AUDIO=2]="MINIGAME_AUDIO",t[t.NATIVE_AUDIO=3]="NATIVE_AUDIO",t[t.UNKNOWN_AUDIO=4]="UNKNOWN_AUDIO"}($$||($$={})),function(t){t[t.INIT=0]="INIT",t[t.PLAYING=1]="PLAYING",t[t.PAUSED=2]="PAUSED",t[t.STOPPED=3]="STOPPED",t[t.INTERRUPTED=4]="INTERRUPTED"}(t0||(t0={})),t("AudioPCMDataView",function(){function t(){this._bufferView=void 0,this._normalizeFactor=1;for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];if(2===e.length)this._bufferView=e[0],this._normalizeFactor=e[1];else{var n=e[0],r=e[1],s=e[2];this._bufferView=new r(n),this._normalizeFactor=s}}return t.prototype.getData=function(t){return this._bufferView[t]*this._normalizeFactor},n(t,[{key:"length",get:function(){return this._bufferView.length}}]),t}());var r0,s0=0;function o0(t,e){var i;e.invoking||(e.invoking=!0,(i=e.func).call.apply(i,[t].concat(e.args)).then((function(){e.invoking=!1,t._operationQueue.shift(),t._eventTarget.emit(e.id.toString()),function(t){for(var e=t._operationQueue.length,i=t._operationQueue.slice(),n=[],r=!1,s=e-1;s>=0;s--){var o=i[s];if("stop"===o.op){n.push(o);break}if("seek"===o.op)r||(n.push(o),r=!0);else{if(r){n.push(o);break}0===n.length&&n.push(o)}}t._operationQueue=n.reverse()}(t);var i=t._operationQueue[0];i&&o0(t,i)})).catch((function(){})))}function a0(t,e,i){var n=i.value;i.value=function(){for(var t=this,i=arguments.length,r=new Array(i),s=0;s<i;s++)r[s]=arguments[s];return new Promise((function(i){var s=s0++,o=t;o._operationQueue.push({op:e,id:s,func:n,args:r,invoking:!1}),o._eventTarget.once(s.toString(),i),o0(o,o._operationQueue[0])}))}}var h0,u0,c0,l0,_0=function(){function t(t,e){var i=this;this._innerAudioContext=void 0,this._onPlayCb=void 0,this._onEndCb=void 0,this._innerAudioContext=t,t.volume=e,t.onPlay((function(){var t;null===(t=i._onPlayCb)||void 0===t||t.call(i)}));var n=function(){var e;i._innerAudioContext&&(i._innerAudioContext=null,go.off("hide",i._onInterruptedBegin,i),go.off("show",i._onInterruptedEnd,i),null===(e=i._onEndCb)||void 0===e||e.call(i),t.destroy())};t.onEnded(n),t.onStop(n),go.on("hide",this._onInterruptedBegin,this),go.on("show",this._onInterruptedEnd,this)}var e=t.prototype;return e._onInterruptedBegin=function(){this._innerAudioContext.pause()},e._onInterruptedEnd=function(){this._innerAudioContext.play()},e.play=function(){this._innerAudioContext.play()},e.stop=function(){this._innerAudioContext.stop()},n(t,[{key:"onPlay",get:function(){return this._onPlayCb},set:function(t){this._onPlayCb=t}},{key:"onEnd",get:function(){return this._onEndCb},set:function(t){this._onEndCb=t}}]),t}(),d0=(f((r0=function(){var t=e.prototype;function e(t){var e=this;this._innerAudioContext=void 0,this._state=t0.INIT,this._cacheTime=0,this._needSeek=!1,this._seeking=!1,this._onPlay=void 0,this._onPause=void 0,this._onStop=void 0,this._onSeeked=void 0,this._onEnded=void 0,this._readyToHandleOnShow=!1,this._eventTarget=new oo,this._operationQueue=[],this._innerAudioContext=t,this._eventTarget=new oo,go.on("hide",this._onInterruptedBegin,this),go.on("show",this._onInterruptedEnd,this);var i=this._eventTarget;this._onPlay=function(){e._state=t0.PLAYING,i.emit(J$.PLAYED),e._needSeek&&e.seek(e._cacheTime).catch((function(){}))},t.onPlay(this._onPlay),this._onPause=function(){e._state=t0.PAUSED;try{var t=e._innerAudioContext.currentTime;null!=t&&(e._cacheTime=t)}catch(t){}i.emit(J$.PAUSED)},t.onPause(this._onPause),this._onStop=function(){e._state=t0.STOPPED,e._resetSeekCache(),i.emit(J$.STOPPED),0!==(e._innerAudioContext?e._innerAudioContext.currentTime:0)&&e._innerAudioContext.seek(0)},t.onStop(this._onStop),this._onSeeked=function(){i.emit(J$.SEEKED),e._seeking=!1,e._needSeek&&(e._needSeek=!1,e._cacheTime.toFixed(2)!==e._innerAudioContext.currentTime.toFixed(2)&&e.seek(e._cacheTime).catch((function(){})))},t.onSeeked(this._onSeeked),this._onEnded=function(){e._state=t0.INIT,e._resetSeekCache(),i.emit(J$.ENDED)},t.onEnded(this._onEnded)}return t._resetSeekCache=function(){this._cacheTime=0,this._needSeek=!1,this._seeking=!1},t.destroy=function(){var t=this;go.off("hide",this._onInterruptedBegin,this),go.off("show",this._onInterruptedEnd,this),this._innerAudioContext&&(["Play","Pause","Stop","Seeked","Ended"].forEach((function(e){t._offEvent(e)})),this._innerAudioContext.stop(),this._innerAudioContext.destroy(),this._innerAudioContext=null,this._state=t0.INIT)},t._onInterruptedBegin=function(){var t=this;this._state===t0.PLAYING&&this.pause().then((function(){t._state=t0.INTERRUPTED,t._readyToHandleOnShow=!0,t._eventTarget.emit(J$.INTERRUPTION_BEGIN)})).catch((function(){}))},t._onInterruptedEnd=function(){var t=this;this._readyToHandleOnShow?(this._state===t0.INTERRUPTED&&this.play().then((function(){t._eventTarget.emit(J$.INTERRUPTION_END)})).catch((function(){})),this._readyToHandleOnShow=!1):this._eventTarget.once(J$.INTERRUPTION_END,this._onInterruptedEnd,this)},t._offEvent=function(t){this["_on"+t]&&(this._innerAudioContext["off"+t](this["_on"+t]),this["_on"+t]=null)},e.load=function(t){return new Promise((function(i,n){e.loadNative(t).then((function(t){i(new e(t))})).catch(n)}))},e.loadNative=function(t){return new Promise((function(e,i){var n=xs.createInnerAudioContext(),r=setTimeout((function(){s(),e(n)}),8e3);function s(){n.offCanplay(o),n.offError(a)}function o(){s(),clearTimeout(r),e(n)}function a(t){s(),clearTimeout(r),console.error("failed to load innerAudioContext"),i(new Error(t))}n.onCanplay(o),n.onError(a),n.src=t}))},e.loadOneShotAudio=function(t,i){return new Promise((function(n,r){e.loadNative(t).then((function(t){n(new _0(t,i))})).catch(r)}))},t.getPCMData=function(){},t.seek=function(t){var e=this;return new Promise((function(i){e._state!==t0.PLAYING||e._seeking?(e._cacheTime!==t&&(e._cacheTime=t,e._needSeek=!0),i()):(t=Pi(t,0,e.duration),e._seeking=!0,e._cacheTime=t,e._eventTarget.once(J$.SEEKED,i),e._innerAudioContext.seek(t))}))},t.play=function(){var t=this;return new Promise((function(e){t._eventTarget.once(J$.PLAYED,e),t._innerAudioContext.play()}))},t.pause=function(){var t=this;return new Promise((function(e){t.state!==t0.PLAYING?e():(t._eventTarget.once(J$.PAUSED,e),t._innerAudioContext.pause())}))},t.stop=function(){var t=this;return new Promise((function(e){if(t0.INIT===t._state)return t._resetSeekCache(),void e();t._eventTarget.once(J$.STOPPED,e),t._innerAudioContext.stop()}))},t.onInterruptionBegin=function(t){this._eventTarget.on(J$.INTERRUPTION_BEGIN,t)},t.offInterruptionBegin=function(t){this._eventTarget.off(J$.INTERRUPTION_BEGIN,t)},t.onInterruptionEnd=function(t){this._eventTarget.on(J$.INTERRUPTION_END,t)},t.offInterruptionEnd=function(t){this._eventTarget.off(J$.INTERRUPTION_END,t)},t.onEnded=function(t){this._eventTarget.on(J$.ENDED,t)},t.offEnded=function(t){this._eventTarget.off(J$.ENDED,t)},n(e,[{key:"src",get:function(){return this._innerAudioContext?this._innerAudioContext.src:""}},{key:"type",get:function(){return $$.MINIGAME_AUDIO}},{key:"state",get:function(){return this._state}},{key:"loop",get:function(){return this._innerAudioContext.loop},set:function(t){this._innerAudioContext.loop=t}},{key:"volume",get:function(){return this._innerAudioContext.volume},set:function(t){t=Mi(t),this._innerAudioContext.volume=t}},{key:"duration",get:function(){return this._innerAudioContext.duration}},{key:"currentTime",get:function(){return this._state!==t0.PLAYING||this._needSeek||this._seeking?this._cacheTime:this._innerAudioContext.currentTime}},{key:"sampleRate",get:function(){return 0}}]),e}()).prototype,"seek",[a0],Object.getOwnPropertyDescriptor(r0.prototype,"seek"),r0.prototype),f(r0.prototype,"play",[a0],Object.getOwnPropertyDescriptor(r0.prototype,"play"),r0.prototype),f(r0.prototype,"pause",[a0],Object.getOwnPropertyDescriptor(r0.prototype,"pause"),r0.prototype),f(r0.prototype,"stop",[a0],Object.getOwnPropertyDescriptor(r0.prototype,"stop"),r0.prototype),r0),f0=function(){function t(t){this._audio=void 0,this._audio=t}var e=t.prototype;return e.play=function(){this._audio.play()},e.stop=function(){this._audio.stop()},n(t,[{key:"onPlay",get:function(){return this._audio.onPlay},set:function(t){this._audio.onPlay=t}},{key:"onEnd",get:function(){return this._audio.onEnd},set:function(t){this._audio.onEnd=t}}]),t}(),p0=function(){function t(t){this._player=void 0,this._player=t}t.load=function(e){return new Promise((function(i,n){d0.load(e).then((function(e){i(new t(e))})).catch(n)}))};var e=t.prototype;return e.destroy=function(){this._player.destroy()},t.loadNative=function(t){return d0.loadNative(t)},t.loadOneShotAudio=function(t,e){return new Promise((function(i,n){d0.loadOneShotAudio(t,e).then((function(t){i(new f0(t))})).catch(n)}))},e.getPCMData=function(t){return this._player.getPCMData(t)},e.seek=function(t){return this._player.seek(t)},e.play=function(){return this._player.play()},e.pause=function(){return this._player.pause()},e.stop=function(){return this._player.stop()},e.onInterruptionBegin=function(t){this._player.onInterruptionBegin(t)},e.offInterruptionBegin=function(t){this._player.offInterruptionBegin(t)},e.onInterruptionEnd=function(t){this._player.onInterruptionEnd(t)},e.offInterruptionEnd=function(t){this._player.offInterruptionEnd(t)},e.onEnded=function(t){this._player.onEnded(t)},e.offEnded=function(t){this._player.offEnded(t)},n(t,[{key:"src",get:function(){return this._player.src}},{key:"type",get:function(){return this._player.type}},{key:"state",get:function(){return this._player.state}},{key:"loop",get:function(){return this._player.loop},set:function(t){this._player.loop=t}},{key:"volume",get:function(){return this._player.volume},set:function(t){this._player.volume=t}},{key:"duration",get:function(){return this._player.duration}},{key:"currentTime",get:function(){return this._player.currentTime}},{key:"sampleRate",get:function(){return this._player.sampleRate}}]),t}();p0.maxAudioChannel=10,m.AudioPlayer=p0;var g0=t("AudioClip",va("cc.AudioClip")(((l0=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._duration=c0&&c0(),e._loadMode=$$.UNKNOWN_AUDIO,e._meta=null,e._player=null,e}s(e,t);var i=e.prototype;return i.destroy=function(){var e,i=t.prototype.destroy.call(this);return null===(e=this._player)||void 0===e||e.destroy(),this._player=null,this._meta&&(this._meta.player=null),i},i.validate=function(){return!!this._meta},i.getDuration=function(){return this._duration?this._duration:this._meta?this._meta.duration:0},i.getCurrentTime=function(){return this._player?this._player.currentTime:0},i.getVolume=function(){return this._player?this._player.volume:0},i.getLoop=function(){return!!this._player&&this._player.loop},i.setCurrentTime=function(t){var e;null===(e=this._player)||void 0===e||e.seek(t).catch((function(){}))},i.setVolume=function(t){this._player&&(this._player.volume=t)},i.setLoop=function(t){this._player&&(this._player.loop=t)},i.play=function(){var t;null===(t=this._player)||void 0===t||t.play().catch((function(){}))},i.pause=function(){var t;null===(t=this._player)||void 0===t||t.pause().catch((function(){}))},i.stop=function(){var t;null===(t=this._player)||void 0===t||t.stop().catch((function(){}))},i.playOneShot=function(t){void 0===t&&(t=1),this._nativeAsset&&p0.loadOneShotAudio(this._nativeAsset.url,t).then((function(t){t.play()})).catch((function(){}))},n(e,[{key:"duration",set:function(t){this._duration=t}},{key:"_nativeAsset",get:function(){return this._meta},set:function(t){this._meta=t,t?(this._loadMode=t.type,this._player=t.player):(this._meta=null,this._loadMode=$$.UNKNOWN_AUDIO,this._duration=0)}},{key:"_nativeDep",get:function(){return{uuid:this._uuid,audioLoadMode:this.loadMode,ext:this._native,__isNative__:!0}}},{key:"loadMode",get:function(){return this._loadMode}},{key:"state",get:function(){return this._player?this._player.state:t0.INIT}}]),e}(Of)).AudioType=$$,c0=ua((u0=l0).prototype,"_duration",[wa],(function(){return 0})),f(u0.prototype,"_nativeDep",[hh],Object.getOwnPropertyDescriptor(u0.prototype,"_nativeDep"),u0.prototype),h0=u0))||h0);function m0(t,e,i){p0.load(t,{audioLoadMode:e.audioLoadMode}).then((function(e){var n={player:e,url:t,duration:e.duration,type:e.type};i(null,n)})).catch((function(t){i(t)}))}function v0(t,e,i,n){var r=new g0;r._nativeUrl=t,r._nativeAsset=e,r.duration=e.duration,n(null,r)}m.AudioClip=g0,tE.register({".mp3":m0,".ogg":m0,".wav":m0,".m4a":m0}),_E.register({".mp3":v0,".ogg":v0,".wav":v0,".m4a":v0});var y0,T0,E0,S0,A0,b0,C0,R0,w0,I0,x0,D0,O0=new(function(){function t(){this._oneShotAudioInfoList=[],this._audioPlayerInfoList=[]}var e=t.prototype;return e._findIndex=function(t,e){return t.findIndex((function(t){return t.audio===e}))},e._tryAddPlaying=function(t,e){var i=this._findIndex(t,e);return i>-1?(t[i].playTime=performance.now(),!1):(t.push({audio:e,playTime:performance.now()}),!0)},e.addPlaying=function(t){t instanceof p0?this._tryAddPlaying(this._audioPlayerInfoList,t):this._tryAddPlaying(this._oneShotAudioInfoList,t)},e._tryRemovePlaying=function(t,e){var i=this._findIndex(t,e);return-1!==i&&(he(t,i),!0)},e.removePlaying=function(t){t instanceof p0?this._tryRemovePlaying(this._audioPlayerInfoList,t):this._tryRemovePlaying(this._oneShotAudioInfoList,t)},e.discardOnePlayingIfNeeded=function(){var t;this._audioPlayerInfoList.length+this._oneShotAudioInfoList.length<p0.maxAudioChannel||(this._oneShotAudioInfoList.length>0?this._oneShotAudioInfoList.forEach((function(e){(!t||e.playTime<t.playTime)&&(t=e)})):this._audioPlayerInfoList.forEach((function(e){(!t||e.playTime<t.playTime)&&(t=e)})),t&&(t.audio.stop(),this.removePlaying(t.audio)))},e.pause=function(){this._oneShotAudioInfoList.forEach((function(t){t.audio.stop()})),this._audioPlayerInfoList.forEach((function(t){t.audio.pause().catch((function(){}))}))},e.resume=function(){this._audioPlayerInfoList.forEach((function(t){t.audio.play().catch((function(){}))}))},t}()),P0="audiosource-loaded";!function(t){t.STARTED="started",t.ENDED="ended"}(x0||(x0={})),function(t){t.PLAY="play",t.STOP="stop",t.PAUSE="pause",t.SEEK="seek"}(D0||(D0={}));var M0=(y0=va("cc.AudioSource"),T0=Za(g0),E0=Za(g0),y0(((I0=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)._clip=b0&&b0(),e._player=null,e._hasRegisterListener=!1,e._loop=C0&&C0(),e._playOnAwake=R0&&R0(),e._volume=w0&&w0(),e._cachedCurrentTime=-1,e._operationsBeforeLoading=[],e._isLoaded=!1,e._lastSetClip=null,e}s(e,t);var i=e.prototype;return i._resetPlayer=function(){this._player&&(O0.removePlaying(this._player),this._unregisterListener(),this._player.destroy(),this._player=null)},i._syncPlayer=function(){var t=this,e=this._clip;if(this._lastSetClip!==e)return e?void(e._nativeAsset?(this._isLoaded=!1,this._lastSetClip=e,this._operationsBeforeLoading.length=0,p0.load(e._nativeAsset.url,{audioLoadMode:e.loadMode}).then((function(i){var n;t._lastSetClip===e?(t._isLoaded=!0,t._resetPlayer(),t._player=i,t._syncStates(),null===(n=t.node)||void 0===n||n.emit(P0)):i.destroy()})).catch((function(){}))):console.error("Invalid audio clip")):(this._lastSetClip=null,void this._resetPlayer())},i._registerListener=function(){var t=this;if(!this._hasRegisterListener&&this._player){var e=this._player;e.onEnded((function(){var i;O0.removePlaying(e),null===(i=t.node)||void 0===i||i.emit(x0.ENDED,t)})),e.onInterruptionBegin((function(){O0.removePlaying(e)})),e.onInterruptionEnd((function(){t._player===e&&O0.addPlaying(e)})),this._hasRegisterListener=!0}},i._unregisterListener=function(){this._player&&this._hasRegisterListener&&(this._player.offEnded(),this._player.offInterruptionBegin(),this._player.offInterruptionEnd(),this._hasRegisterListener=!1)},i.onLoad=function(){this._syncPlayer()},i.onEnable=function(){this._playOnAwake&&!this.playing&&this.play()},i.onDisable=function(){var t=this._getRootNode();null!=t&&t._persistNode||this.pause()},i.onDestroy=function(){this.stop(),this.clip=null},i.getPCMData=function(t){var e=this;return new Promise((function(i){if(0!==t&&1!==t)return F("Only support channel index 0 or 1 to get buffer"),void i(void 0);var n;e._player?i(e._player.getPCMData(t)):null===(n=e.node)||void 0===n||n.once(P0,(function(){var n;i(null===(n=e._player)||void 0===n?void 0:n.getPCMData(t))}))}))},i.getSampleRate=function(){var t=this;return new Promise((function(e){var i;t._player?e(t._player.sampleRate):null===(i=t.node)||void 0===i||i.once(P0,(function(){e(t._player.sampleRate)}))}))},i._getRootNode=function(){for(var t,e,i=this.node,n=null===(t=i)||void 0===t||null===(e=t.parent)||void 0===e?void 0:e.parent;n;){var r,s,o;n=null===(s=i=null===(r=i)||void 0===r?void 0:r.parent)||void 0===s||null===(o=s.parent)||void 0===o?void 0:o.parent}return i},i.play=function(){var t=this;if(this._isLoaded||!this.clip){var e;this._registerListener(),O0.discardOnePlayingIfNeeded(),this.state===t0.PLAYING&&(null===(e=this._player)||void 0===e||e.stop().catch((function(){})));var i=this._player;i&&(i.play().then((function(){var e;null===(e=t.node)||void 0===e||e.emit(x0.STARTED,t)})).catch((function(){O0.removePlaying(i)})),O0.addPlaying(i))}else this._operationsBeforeLoading.push({op:D0.PLAY,params:null})},i.pause=function(){var t;this._isLoaded||!this.clip?null===(t=this._player)||void 0===t||t.pause().catch((function(){})):this._operationsBeforeLoading.push({op:D0.PAUSE,params:null})},i.stop=function(){this._isLoaded||!this.clip?this._player&&(this._player.stop().catch((function(){})),O0.removePlaying(this._player)):this._operationsBeforeLoading.push({op:D0.STOP,params:null})},i.playOneShot=function(t,e){var i;void 0===e&&(e=1),t._nativeAsset?p0.loadOneShotAudio(t._nativeAsset.url,this._volume*e,{audioLoadMode:t.loadMode}).then((function(t){i=t,O0.discardOnePlayingIfNeeded(),t.onEnd=function(){O0.removePlaying(t)},t.play(),O0.addPlaying(t)})).catch((function(){i&&O0.removePlaying(i)})):console.error("Invalid audio clip")},i._syncStates=function(){var t=this;this._player&&(this._player.loop=this._loop,this._player.volume=this._volume,this._operationsBeforeLoading.forEach((function(e){var i;e.op===D0.SEEK?(t._cachedCurrentTime=e.params&&e.params[0],t._player&&t._player.seek(t._cachedCurrentTime).catch((function(){}))):null===(i=t[e.op])||void 0===i||i.call(t)})),this._operationsBeforeLoading.length=0)},n(e,[{key:"clip",get:function(){return this._clip},set:function(t){t!==this._clip&&(this._clip=t,this._syncPlayer())}},{key:"loop",get:function(){return this._loop},set:function(t){this._loop=t,this._player&&(this._player.loop=t)}},{key:"playOnAwake",get:function(){return this._playOnAwake},set:function(t){this._playOnAwake=t}},{key:"volume",get:function(){return this._volume},set:function(t){Number.isNaN(t)?F("illegal audio volume!"):(t=Pi(t,0,1),this._player?(this._player.volume=t,this._volume=this._player.volume):this._volume=t)}},{key:"currentTime",get:function(){return this._player?this._player.currentTime:this._cachedCurrentTime<0?0:this._cachedCurrentTime},set:function(t){var e;Number.isNaN(t)?F("illegal audio time!"):(t=Pi(t,0,this.duration),this._isLoaded||!this.clip?(this._cachedCurrentTime=t,null===(e=this._player)||void 0===e||e.seek(this._cachedCurrentTime).catch((function(){}))):this._operationsBeforeLoading.push({op:D0.SEEK,params:[t]}))}},{key:"duration",get:function(){var t,e;return null!==(t=null===(e=this._clip)||void 0===e?void 0:e.getDuration())&&void 0!==t?t:this._player?this._player.duration:0}},{key:"state",get:function(){return this._player?this._player.state:t0.INIT}},{key:"playing",get:function(){return this.state===e.AudioState.PLAYING}}],[{key:"maxAudioChannel",get:function(){return p0.maxAudioChannel}}]),e}(xp)).AudioState=t0,I0.EventType=x0,b0=ua((A0=I0).prototype,"_clip",[T0],(function(){return null})),C0=ua(A0.prototype,"_loop",[wa],(function(){return!1})),R0=ua(A0.prototype,"_playOnAwake",[wa],(function(){return!0})),w0=ua(A0.prototype,"_volume",[wa],(function(){return 1})),f(A0.prototype,"clip",[E0],Object.getOwnPropertyDescriptor(A0.prototype,"clip"),A0.prototype),S0=A0))||S0);t({AudioSource:M0,AudioSourceComponent:M0}),rt(g0,"AudioClip",[{name:"PlayingState",newName:"AudioState",target:M0,targetName:"AudioSource"}]),ot(g0.prototype,"AudioClip.prototype",["state","play","pause","stop","playOneShot","setCurrentTime","setVolume","setLoop","getCurrentTime","getVolume","getLoop"].map((function(t){return{name:t,suggest:"please use AudioSource.prototype."+t+" instead"}}))),m.AudioSourceComponent=M0,Jt(M0,"cc.AudioSourceComponent"),m.log=B,m.warn=F,m.error=k,m.assert=U,m._throw=z,m.logID=X,m.warnID=q,m.errorID=Z,m.assertID=tt,m.debug=ut,m.path={join:To,extname:Eo,mainFileName:So,basename:Ao,dirname:bo,changeExtname:Co,changeBasename:Ro,_normalize:wo,stripSep:Io,get sep(){return xo()}};var N0=qs.Flags.Destroyed,L0=qs.Flags.PersistentMask,B0=[];function F0(t){var e;if(Qs(t)){if(function(t){return"function"==typeof t._instantiate}(t))return m.game._isCloning=!0,e=t._instantiate(null,!0),m.game._isCloning=!1,e;if(t instanceof m.Asset)throw new TypeError(et(6903))}return m.game._isCloning=!0,e=k0(t),m.game._isCloning=!1,e}function k0(t,e){var i;U0(t,i=t._iN$t?t._iN$t:t.constructor?new(0,t.constructor):Object.create(null),e);for(var n=0,r=B0.length;n<r;++n)B0[n]._iN$t=null;return B0.length=0,i}function U0(t,e,i){Rt(t,"_iN$t",e,!0),B0.push(t);var n=t.constructor;if(Ei(n))!function(t,e,i,n){for(var r=t.__values__,s=0;s<r.length;s++){var o=r[s],a=e[o];if("object"==typeof a&&a){var h=i[o];h instanceof be&&h.constructor===a.constructor?h.set(a):i[o]=a._iN$t||G0(a,n)}else i[o]=a}}(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||G0(s,i)}else e[r]=s}Qs(t)&&(e._objFlags&=L0)}function G0(t,e){if(t instanceof be)return t.clone();if(t instanceof m.Asset)return t;var i;if(ArrayBuffer.isView(t)){var n=t.length;i=new t.constructor(n),t._iN$t=i,B0.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,B0.push(t);for(var o=0;o<s;++o){var a=t[o];i[o]="object"==typeof a&&a?a._iN$t||G0(a,e):a}return i}if(t._objFlags&N0)return null;var h=t.constructor;if(Ei(h)){if(e)if(e instanceof xp){if(t instanceof Tm||t instanceof xp)return t}else if(e instanceof Tm)if(t instanceof Tm){if(!t.isChildOf(e))return t}else if(t instanceof xp&&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 U0(t,i,e),i}F0._clone=k0,m.instantiate=F0;var H0,z0,V0=t("NodePool",function(){function t(t){this._pool=[],this.poolHandlerComp=t}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}());m.NodePool=V0;var W0,X0=null!==(H0=globalThis.jsb)&&void 0!==H0?H0:{};function j0(t,e){t.s(e.name),t.n(e.type),t.n(e.count)}function Y0(t,e){e.name=t.s(),e.type=t.n(),e.count=t.n()}function K0(t,e){t.n(e.set),t.n(e.binding),t.s(e.name),t.n(e.members.length);for(var i,n=d(e.members);!(i=n()).done;)j0(t,i.value);t.n(e.count)}function q0(t,e){var i;e.set=t.n(),e.binding=t.n(),e.name=t.s(),i=t.n(),e.members.length=i;for(var n=0;n!==i;++n){var r=new R_;Y0(t,r),e.members[n]=r}e.count=t.n()}function Q0(t,e){e.binding=t.n(),e.descriptorType=t.n(),e.count=t.n(),e.stageFlags=t.n()}t("native",{DownloaderHints:X0.DownloaderHints,Downloader:X0.Downloader,zipUtils:X0.zipUtils,fileUtils:X0.fileUtils,DebugRenderer:X0.DebugRenderer,copyTextToClipboard:null===(z0=X0.copyTextToClipboard)||void 0===z0?void 0:z0.bind(X0),garbageCollect:X0.garbageCollect,reflection:X0.reflection,bridge:X0.bridge,jsbBridgeWrapper:X0.jsbBridgeWrapper,AssetsManager:X0.AssetsManager,EventAssetsManager:X0.EventAssetsManager,Manifest:X0.Manifest,saveImageData:X0.saveImageData,process:X0.process,adpf:X0.adpf}),m.renderer=EB,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"}(W0||(W0={}));var Z0,J0,$0,t1,e1,i1={CONSTANTS:0,CBV:1,UAV:2,SRV:3,TABLE:4,SSV:5};!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"}(Z0||(Z0={})),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"}(J0||(J0={})),function(t){t[t.BUFFER=0]="BUFFER",t[t.TEXTURE1D=1]="TEXTURE1D",t[t.TEXTURE2D=2]="TEXTURE2D",t[t.TEXTURE3D=3]="TEXTURE3D"}($0||($0={})),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",t[t.TRANSFER_SRC=256]="TRANSFER_SRC",t[t.TRANSFER_DST=512]="TRANSFER_DST"}(t1||(t1={})),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.GPU_DRIVEN=16384]="GPU_DRIVEN",t[t.NON_BUILTIN=32768]="NON_BUILTIN",t[t.ALL=4294967295]="ALL"}(e1||(e1={}));var n1,r1={NONE:0,DEFAULT:1,CLUSTERED:2},s1={RENDER_TARGET:0,DEPTH_STENCIL:1,SHADING_RATE:2};!function(t){t[t.READ=0]="READ",t[t.READ_WRITE=1]="READ_WRITE",t[t.WRITE=2]="WRITE"}(n1||(n1={}));var o1={NONE:0,FLOAT_TYPE:1,INT_TYPE:2},a1=function(){function t(t,e,i,n){void 0===t&&(t=null),void 0===e&&(e=0),void 0===i&&(i=!1),void 0===n&&(n=null),this.light=t,this.probe=n,this.level=e,this.culledByLight=i}return t.prototype.reset=function(t,e,i,n){this.light=t,this.probe=n,this.level=e,this.culledByLight=i},t}(),h1={UNIFORM_BUFFER:0,DYNAMIC_UNIFORM_BUFFER:1,SAMPLER_TEXTURE:2,SAMPLER:3,TEXTURE:4,STORAGE_BUFFER:5,DYNAMIC_STORAGE_BUFFER:6,STORAGE_IMAGE:7,INPUT_ATTACHMENT:8},u1=function(){function t(t){void 0===t&&(t=ml.UNKNOWN),this.count=1,this.type=t}return t.prototype.reset=function(t){this.type=t,this.count=1},t}(),c1=function(){function t(){this.descriptors=new Map,this.uniformBlocks=new Map,this.capacity=0,this.count=0}return t.prototype.reset=function(){this.descriptors.clear(),this.uniformBlocks.clear(),this.capacity=0,this.count=0},t}(),l1=function(){function t(){this.descriptorNames=[],this.uniformBlockNames=[],this.descriptors=[],this.uniformBlocks=[],this.capacity=0,this.count=0}return t.prototype.reset=function(){this.descriptorNames.length=0,this.uniformBlockNames.length=0,this.descriptors.length=0,this.uniformBlocks.length=0,this.capacity=0,this.count=0},t}(),_1=function(t,e,i,n){void 0===t&&(t=W0.PER_INSTANCE),void 0===e&&(e=i1.CONSTANTS),void 0===i&&(i=h1.UNIFORM_BUFFER),void 0===n&&(n=Ll.NONE),this.updateFrequency=t,this.parameterType=e,this.descriptorType=i,this.visibility=n},d1={NONE:0,COLOR:1,DEPTH:2,STENCIL:4},f1=function(){function t(t,e,i,n,r){void 0===t&&(t=""),void 0===e&&(e=""),void 0===i&&(i=d1.NONE),void 0===n&&(n=Ul.SAMPLE_ZERO),void 0===r&&(r=Ul.SAMPLE_ZERO),this.source=t,this.target=e,this.resolveFlags=i,this.mode=n,this.mode1=r}return t.prototype.reset=function(t,e,i,n,r){this.source=t,this.target=e,this.resolveFlags=i,this.mode=n,this.mode1=r},t}(),p1=function(){function t(t,e,i,n,r,s,o,a,h,u){void 0===t&&(t=""),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===o&&(o=0),void 0===a&&(a=0),void 0===h&&(h=0),void 0===u&&(u=0),this.source=t,this.target=e,this.mipLevels=i,this.numSlices=n,this.sourceMostDetailedMip=r,this.sourceFirstSlice=s,this.sourcePlaneSlice=o,this.targetMostDetailedMip=a,this.targetFirstSlice=h,this.targetPlaneSlice=u}return t.prototype.reset=function(t,e,i,n,r,s,o,a,h,u){this.source=t,this.target=e,this.mipLevels=i,this.numSlices=n,this.sourceMostDetailedMip=r,this.sourceFirstSlice=s,this.sourcePlaneSlice=o,this.targetMostDetailedMip=a,this.targetFirstSlice=h,this.targetPlaneSlice=u},t}(),g1=function(){function t(t,e,i,n,r,s,o){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===o&&(o=0),this.source=t,this.target=e,this.mipLevels=i,this.numSlices=n,this.targetMostDetailedMip=r,this.targetFirstSlice=s,this.targetPlaneSlice=o}return t.prototype.reset=function(t,e,i,n,r,s){this.target=t,this.mipLevels=e,this.numSlices=i,this.targetMostDetailedMip=n,this.targetFirstSlice=r,this.targetPlaneSlice=s},t}(),m1=function(){function t(t,e,i,n,r,s,o){void 0===t&&(t=""),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===o&&(o=0),this.source=t,this.target=e,this.mipLevels=i,this.numSlices=n,this.targetMostDetailedMip=r,this.targetFirstSlice=s,this.targetPlaneSlice=o}return t.prototype.reset=function(t,e,i,n,r,s,o){this.source=t,this.target=e,this.mipLevels=i,this.numSlices=n,this.targetMostDetailedMip=r,this.targetFirstSlice=s,this.targetPlaneSlice=o},t}(),v1=function(){function t(){this.numRenderPasses=0,this.numManagedTextures=0,this.totalManagedTextures=0,this.numUploadBuffers=0,this.numUploadBufferViews=0,this.numFreeUploadBuffers=0,this.numFreeUploadBufferViews=0,this.numDescriptorSets=0,this.numFreeDescriptorSets=0,this.numInstancingBuffers=0,this.numInstancingUniformBlocks=0}return t.prototype.reset=function(){this.numRenderPasses=0,this.numManagedTextures=0,this.totalManagedTextures=0,this.numUploadBuffers=0,this.numUploadBufferViews=0,this.numFreeUploadBuffers=0,this.numFreeUploadBufferViews=0,this.numDescriptorSets=0,this.numFreeDescriptorSets=0,this.numInstancingBuffers=0,this.numInstancingUniformBlocks=0},t}();function y1(t){return new Xs((function(){return new t}),16)}var T1,E1,S1,A1=function(){function t(){this.li=y1(a1),this.d=y1(u1),this.db=y1(c1),this.dbf=y1(l1),this.dbi=y1(_1),this.rp=y1(f1),this.cp=y1(p1),this.up=y1(g1),this.mp=y1(m1),this.ps=y1(v1)}var e=t.prototype;return e.reset=function(){this.li.reset(),this.d.reset(),this.db.reset(),this.dbf.reset(),this.dbi.reset(),this.rp.reset(),this.cp.reset(),this.up.reset(),this.mp.reset(),this.ps.reset()},e.createLightInfo=function(t,e,i,n){void 0===t&&(t=null),void 0===e&&(e=0),void 0===i&&(i=!1),void 0===n&&(n=null);var r=this.li.add();return r.reset(t,e,i,n),r},e.createDescriptor=function(t){void 0===t&&(t=ml.UNKNOWN);var e=this.d.add();return e.reset(t),e},e.createDescriptorBlock=function(){var t=this.db.add();return t.reset(),t},e.createDescriptorBlockFlattened=function(){var t=this.dbf.add();return t.reset(),t},e.createDescriptorBlockIndex=function(t,e,i,n){void 0===t&&(t=W0.PER_INSTANCE),void 0===e&&(e=i1.CONSTANTS),void 0===i&&(i=h1.UNIFORM_BUFFER),void 0===n&&(n=Ll.NONE);var r=this.dbi.add();return r.updateFrequency=t,r.parameterType=e,r.descriptorType=i,r.visibility=n,r},e.createResolvePair=function(t,e,i,n,r){void 0===t&&(t=""),void 0===e&&(e=""),void 0===i&&(i=d1.NONE),void 0===n&&(n=Ul.SAMPLE_ZERO),void 0===r&&(r=Ul.SAMPLE_ZERO);var s=this.rp.add();return s.reset(t,e,i,n,r),s},e.createCopyPair=function(t,e,i,n,r,s,o,a,h,u){void 0===t&&(t=""),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===o&&(o=0),void 0===a&&(a=0),void 0===h&&(h=0),void 0===u&&(u=0);var c=this.cp.add();return c.reset(t,e,i,n,r,s,o,a,h,u),c},e.createUploadPair=function(t,e,i,n,r,s){void 0===t&&(t=""),void 0===e&&(e=4294967295),void 0===i&&(i=4294967295),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=0);var o=this.up.add();return o.reset(t,e,i,n,r,s),o},e.createMovePair=function(t,e,i,n,r,s,o){void 0===t&&(t=""),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===o&&(o=0);var a=this.mp.add();return a.reset(t,e,i,n,r,s,o),a},e.createPipelineStatistics=function(){var t=this.ps.add();return t.reset(),t},t}();function b1(t,e){t.n(e.type),t.n(e.count)}function C1(t,e){e.type=t.n(),e.count=t.n()}var R1=function(){function t(t,e){this.source=void 0,this.target=void 0,this.source=t,this.target=e}return t.prototype.equals=function(t){return this.source===t.source&&this.target===t.target},t}(),w1=function(){function t(t){this.target=void 0,this.target=t}return t.prototype.equals=function(t){return this.target===t.target},t}();T1=Symbol.iterator;var I1=function(){function t(t,e){this.iterator=void 0,this.source=void 0,this.iterator=t,this.source=e}var e=t.prototype;return e[T1]=function(){return this},e.next=function(){var t=this.iterator.next();return t.done?{value:void 0,done:!0}:{value:new R1(this.source,t.value.target),done:!1}},t}();E1=Symbol.iterator;var x1=function(){function t(t,e){this.iterator=void 0,this.source=void 0,this.iterator=t,this.source=e}var e=t.prototype;return e[E1]=function(){return this},e.next=function(){var t=this.iterator.next();return t.done?{value:void 0,done:!0}:{value:new R1(t.value.target,this.source),done:!1}},t}();S1=Symbol.iterator;var D1=function(){function t(t,e){this.graph=void 0,this.iterator=void 0,this.graph=t,this.iterator=e}var e=t.prototype;return e[S1]=function(){return this},e.next=function(){var t=this.iterator.next();return t.done?{value:void 0,done:!0}:{value:this.graph.target(t.value),done:!1}},t}();function O1(t,e,i){var n=t.N,r=i.split("/");if(0===r.length)return e;var s=e,o=0;""===r[0]&&(s=n,++o);for(var a=o;a!==r.length;++a){var h=r[a];if(""!==h&&"."!==h)if(".."!==h){if((s=t.locateChild(s,h))===n)return n}else{if(s===n)return n;s=t.getParent(s)}}return s}var P1,M1=function(){function t(){}return t.prototype.terminate=function(){return!1},t}();function N1(t){var e=t.v().next();return e.done?t.N:e.value}!function(t){t[t.WHITE=0]="WHITE",t[t.GRAY=1]="GRAY",t[t.GREEN=2]="GREEN",t[t.RED=3]="RED",t[t.BLACK=4]="BLACK"}(P1||(P1={}));var L1=function(t,e,i){this.v=void 0,this.e=void 0,this.iter=void 0,this.v=t,this.e=e,this.iter=i};function B1(t,e,i,n,r){var s=null,o=null,a=new Array;for(n.put(e,P1.GRAY),i.discoverVertex(e,t),o=t.oe(e),r.terminate(e,t)?a.push(new L1(e,null,null)):a.push(new L1(e,null,o));a.length;){var h=a.pop();if(e=h.v,s=h.e,o=h.iter,null!==s&&i.finishEdge(s,t),o)for(var u=o.next();!u.done;u=o.next()){var c=u.value,l=c.target;i.examineEdge(c,t);var _=n.get(l);if(_===P1.WHITE){if(i.treeEdge(c,t),s=c,a.push(new L1(e,s,o)),e=l,n.put(e,P1.GRAY),i.discoverVertex(e,t),o=t.oe(e),r.terminate(e,t))break}else _===P1.GRAY?i.backEdge(c,t):i.forwardOrCrossEdge(c,t),i.finishEdge(c,t)}n.put(e,P1.BLACK),i.finishVertex(e,t)}}function F1(t,e,i,n){if(void 0===n&&(n=null),null!==(n=n||N1(t))&&0!==t.nv()){for(var r,s=d(t.v());!(r=s()).done;){var o=r.value;i.put(o,P1.WHITE),e.initializeVertex(o,t)}var a=new M1;n!==N1(t)&&(e.startVertex(n,t),B1(t,n,e,i,a));for(var h,u=d(t.v());!(h=u()).done;){var c=h.value;i.get(c)===P1.WHITE&&(e.startVertex(c,t),B1(t,c,e,i,a))}}}var k1=function(){function t(){}var e=t.prototype;return e.initializeVertex=function(){},e.startVertex=function(){},e.discoverVertex=function(){},e.examineEdge=function(){},e.treeEdge=function(){},e.backEdge=function(){},e.forwardOrCrossEdge=function(){},e.finishEdge=function(){},e.finishVertex=function(){},t}(),U1=function(){function t(t){this.g=void 0,this.g=t,this.N=t.N}var e=t.prototype;return e.edge=function(t,e){return this.g.reference(t,e)},e.source=function(t){return this.g.parent(t)},e.target=function(t){return this.g.child(t)},e.oe=function(t){return this.g.children(t)},e.od=function(t){return this.g.numChildren(t)},e.v=function(){return this.g.v()},e.nv=function(){return this.g.nv()},t}(),G1=function(){function t(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),this.x=t,this.y=e,this.z=i,this.w=n}return t.prototype.reset=function(t,e,i,n){this.x=t,this.y=e,this.z=i,this.w=n},t}(),H1=function(){function t(t,e,i,n,r,s,o,a){void 0===t&&(t=""),void 0===e&&(e=n1.WRITE),void 0===i&&(i=s1.RENDER_TARGET),void 0===n&&(n=Bl.LOAD),void 0===r&&(r=Fl.STORE),void 0===s&&(s=Zl.ALL),void 0===o&&(o=new f_),void 0===a&&(a=Ll.NONE),this.slotName1="",this.slotID=0,this.slotName=t,this.accessType=e,this.attachmentType=i,this.loadOp=n,this.storeOp=r,this.clearFlags=s,this.clearColor=o,this.shaderStageFlags=a}return t.prototype.reset=function(t,e,i,n,r,s,o){this.slotName=t,this.slotName1="",this.accessType=e,this.attachmentType=i,this.loadOp=n,this.storeOp=r,this.clearFlags=s,this.clearColor.reset(),this.slotID=0,this.shaderStageFlags=o},t}(),z1=function(){function t(t,e,i,n,r,s){void 0===t&&(t=""),void 0===e&&(e=n1.READ),void 0===i&&(i=Zl.NONE),void 0===n&&(n=o1.NONE),void 0===r&&(r=new G1),void 0===s&&(s=Ll.NONE),this.plane=0,this.name=t,this.accessType=e,this.clearFlags=i,this.clearValueType=n,this.clearValue=r,this.shaderStageFlags=s}return t.prototype.reset=function(t,e,i,n,r){this.name=t,this.accessType=e,this.plane=0,this.clearFlags=i,this.clearValueType=n,this.clearValue.reset(0,0,0,0),this.shaderStageFlags=r},t}(),V1=function(){function t(){this.dimension=$0.BUFFER,this.alignment=0,this.width=0,this.height=0,this.depthOrArraySize=0,this.mipLevels=0,this.format=pl.UNKNOWN,this.sampleCount=Rl.X1,this.textureFlags=bl.NONE,this.flags=t1.NONE,this.viewType=Sl.TEX2D}return t.prototype.reset=function(){this.dimension=$0.BUFFER,this.alignment=0,this.width=0,this.height=0,this.depthOrArraySize=0,this.mipLevels=0,this.format=pl.UNKNOWN,this.sampleCount=Rl.X1,this.textureFlags=bl.NONE,this.flags=t1.NONE,this.viewType=Sl.TEX2D},t}(),W1=function(){function t(t){void 0===t&&(t=Z0.MANAGED),this.residency=t}return t.prototype.reset=function(t){this.residency=t},t}(),X1=function(){function t(t,e){void 0===t&&(t=null),void 0===e&&(e=!1),this.renderWindow=null,this.currentID=0,this.numBackBuffers=0,this.generation=4294967295,this.swapchain=t,this.isDepthStencil=e}return t.prototype.reset=function(t,e){this.swapchain=t,this.renderWindow=null,this.currentID=0,this.numBackBuffers=0,this.generation=4294967295,this.isDepthStencil=e},t}(),j1=function(){function t(){this.states=kl.NONE}return t.prototype.reset=function(){this.states=kl.NONE},t}(),Y1=function(){function t(t){void 0===t&&(t=null),this.fenceValue=0,this.buffer=t}return t.prototype.reset=function(t){this.buffer=t,this.fenceValue=0},t}(),K1=function(){function t(t){void 0===t&&(t=null),this.fenceValue=0,this.buffer=t}return t.prototype.reset=function(t){this.buffer=t,this.fenceValue=0},t}(),q1=function(){function t(t){void 0===t&&(t=null),this.fenceValue=0,this.texture=t}return t.prototype.reset=function(t){this.texture=t,this.fenceValue=0},t}(),Q1=function(){function t(t){void 0===t&&(t=null),this.fenceValue=0,this.texture=t}return t.prototype.reset=function(t){this.texture=t,this.fenceValue=0},t}(),Z1=function(){function t(){this.unused=0}return t.prototype.reset=function(){this.unused=0},t}(),J1=function(){function t(){this.rasterViews=new Map,this.computeViews=new Map,this.resolvePairs=[]}return t.prototype.reset=function(){this.rasterViews.clear(),this.computeViews.clear(),this.resolvePairs.length=0},t}(),$1=function(){this.o=[],this.i=[]},t2=function(){function t(){this.N=4294967295,this.x=[],this._names=[],this._subpasses=[]}var e=t.prototype;return e.edge=function(t,e){for(var i,n=d(this.x[t].o);!(i=n()).done;)if(e===i.value.target)return!0;return!1},e.source=function(t){return t.source},e.target=function(t){return t.target},e.oe=function(t){return new I1(this.x[t].o.values(),t)},e.od=function(t){return this.x[t].o.length},e.ie=function(t){return new x1(this.x[t].i.values(),t)},e.id=function(t){return this.x[t].i.length},e.d=function(t){return this.od(t)+this.id(t)},e.adj=function(t){return new D1(this,this.oe(t))},e.v=function(){return this.x.keys()},e.nv=function(){return this.x.length},e.ne=function(){for(var t,e=0,i=d(this.v());!(t=i()).done;){var n=t.value;e+=this.od(n)}return e},e.clear=function(){this._names.length=0,this._subpasses.length=0,this.x.length=0},e.addVertex=function(t,e){var i=new $1,n=this.x.length;return this.x.push(i),this._names.push(t),this._subpasses.push(e),n},e.addEdge=function(t,e){return this.x[t].o.push(new w1(e)),this.x[e].i.push(new w1(t)),new R1(t,e)},e.vertexName=function(t){return this._names[t]},e.getName=function(t){return this._names[t]},e.setName=function(t,e){this._names[t]=e},e.getSubpass=function(t){return this._subpasses[t]},t}(),e2=function(){function t(t,e,i){void 0===t&&(t=4294967295),void 0===e&&(e=1),void 0===i&&(i=0),this.rasterViews=new Map,this.computeViews=new Map,this.resolvePairs=[],this.viewport=new d_,this.showStatistics=!1,this.subpassID=t,this.count=e,this.quality=i}return t.prototype.reset=function(t,e,i){this.rasterViews.clear(),this.computeViews.clear(),this.resolvePairs.length=0,this.viewport.reset(),this.subpassID=t,this.count=e,this.quality=i,this.showStatistics=!1},t}(),i2=function(){function t(t){void 0===t&&(t=4294967295),this.rasterViews=new Map,this.computeViews=new Map,this.subpassID=t}return t.prototype.reset=function(t){this.rasterViews.clear(),this.computeViews.clear(),this.subpassID=t},t}(),n2=function(){function t(){this.rasterViews=new Map,this.computeViews=new Map,this.attachmentIndexMap=new Map,this.textures=new Map,this.subpassGraph=new t2,this.width=0,this.height=0,this.count=1,this.quality=0,this.viewport=new d_,this.versionName="",this.version=0,this.hashValue=0,this.showStatistics=!1}return t.prototype.reset=function(){this.rasterViews.clear(),this.computeViews.clear(),this.attachmentIndexMap.clear(),this.textures.clear(),this.subpassGraph.clear(),this.width=0,this.height=0,this.count=1,this.quality=0,this.viewport.reset(),this.versionName="",this.version=0,this.hashValue=0,this.showStatistics=!1},t}(),r2=function(){function t(t,e){void 0===t&&(t=null),void 0===e&&(e=null),this.clearColors=[],this.clearDepth=0,this.clearStencil=0,this.renderPass=t,this.framebuffer=e}return t.prototype.reset=function(t,e){this.renderPass=t,this.framebuffer=e,this.clearColors.length=0,this.clearDepth=0,this.clearStencil=0},t}(),s2=function(){function t(){this.format=pl.UNKNOWN}return t.prototype.reset=function(){this.format=pl.UNKNOWN},t}(),o2=function(){function t(){this.textureView=null,this.format=pl.UNKNOWN,this.indexOrFirstMipLevel=0,this.numMipLevels=0,this.firstArraySlice=0,this.numArraySlices=0,this.firstPlane=0,this.numPlanes=0}return t.prototype.reset=function(){this.textureView=null,this.format=pl.UNKNOWN,this.indexOrFirstMipLevel=0,this.numMipLevels=0,this.firstArraySlice=0,this.numArraySlices=0,this.firstPlane=0,this.numPlanes=0},t}(),a2=function(t,e){this.o=[],this.i=[],this.t=void 0,this.j=void 0,this.id=t,this.object=e,this.t=t,this.j=e},h2=function(){function t(){this.N=4294967295,this.x=[],this._names=[],this._descs=[],this._traits=[],this._states=[],this._samplerInfo=[],this._valueIndex=new Map,this.renderPasses=new Map,this.nextFenceValue=0,this.version=0}var e=t.prototype;return e.edge=function(t,e){for(var i,n=d(this.x[t].o);!(i=n()).done;)if(e===i.value.target)return!0;return!1},e.source=function(t){return t.source},e.target=function(t){return t.target},e.oe=function(t){return new I1(this.x[t].o.values(),t)},e.od=function(t){return this.x[t].o.length},e.ie=function(t){return new x1(this.x[t].i.values(),t)},e.id=function(t){return this.x[t].i.length},e.d=function(t){return this.od(t)+this.id(t)},e.adj=function(t){return new D1(this,this.oe(t))},e.v=function(){return this.x.keys()},e.nv=function(){return this.x.length},e.ne=function(){for(var t,e=0,i=d(this.v());!(t=i()).done;){var n=t.value;e+=this.od(n)}return e},e.clear=function(){this.renderPasses.clear(),this.nextFenceValue=0,this.version=0,this._valueIndex.clear(),this._names.length=0,this._descs.length=0,this._traits.length=0,this._states.length=0,this._samplerInfo.length=0,this.x.length=0},e.addVertex=function(t,e,i,n,r,s,o,a){void 0===a&&(a=4294967295);var h=new a2(t,e),u=this.x.length;return this.x.push(h),this._names.push(i),this._descs.push(n),this._traits.push(r),this._states.push(s),this._samplerInfo.push(o),this._valueIndex.set(i,u),4294967295!==a&&this.addEdge(a,u),u},e.addEdge=function(t,e){return this.x[t].o.push(new w1(e)),this.x[e].i.push(new w1(t)),new R1(t,e)},e.vertexName=function(t){return this._names[t]},e.getName=function(t){return this._names[t]},e.setName=function(t,e){this._names[t]=e},e.getDesc=function(t){return this._descs[t]},e.getTraits=function(t){return this._traits[t]},e.getStates=function(t){return this._states[t]},e.getSampler=function(t){return this._samplerInfo[t]},e.h=function(t,e){return this.x[e].t===t},e.w=function(t){return this.x[t].t},e.object=function(t){return this.x[t].j},e.value=function(t,e){if(this.x[e].t===t)return this.x[e].j;throw Error("value id not match")},e.visitVertex=function(t,e){var i=this.x[e];switch(i.t){case 0:return t.managed(i.j);case 1:return t.managedBuffer(i.j);case 2:return t.managedTexture(i.j);case 3:return t.persistentBuffer(i.j);case 4:return t.persistentTexture(i.j);case 5:return t.framebuffer(i.j);case 6:return t.swapchain(i.j);case 7:return t.formatView(i.j);case 8:return t.subresourceView(i.j);default:throw Error("polymorphic type not found")}},e.j=function(t){return this.x[t].j},e.reference=function(t,e){for(var i,n=d(this.x[t].o);!(i=n()).done;)if(e===i.value.target)return!0;return!1},e.parent=function(t){return t.source},e.child=function(t){return t.target},e.children=function(t){return new I1(this.x[t].o.values(),t)},e.numChildren=function(t){return this.x[t].o.length},e.getParent=function(t){if(4294967295===t)return 4294967295;var e=this.x[t].i;return 0===e.length?4294967295:e[0].target},e.addReference=function(t,e){return this.addEdge(t,e)},e.contains=function(t){return this._valueIndex.has(t)},e.vertex=function(t){return this._valueIndex.get(t)},e.find=function(t){var e=this._valueIndex.get(t);return void 0===e?4294967295:e},t}(),u2=function(){function t(){this.computeViews=new Map,this.textures=new Map}return t.prototype.reset=function(){this.computeViews.clear(),this.textures.clear()},t}(),c2=function(){function t(){this.resolvePairs=[]}return t.prototype.reset=function(){this.resolvePairs.length=0},t}(),l2=function(){function t(){this.copyPairs=[],this.uploadPairs=[]}return t.prototype.reset=function(){this.copyPairs.length=0,this.uploadPairs.length=0},t}(),_2=function(){function t(){this.movePairs=[]}return t.prototype.reset=function(){this.movePairs.length=0},t}(),d2=function(){function t(){this.computeViews=new Map}return t.prototype.reset=function(){this.computeViews.clear()},t}(),f2=function(){function t(t,e,i){void 0===t&&(t=""),void 0===e&&(e=Zl.ALL),void 0===i&&(i=new f_),this.slotName=t,this.clearFlags=e,this.clearColor=i}return t.prototype.reset=function(t,e){this.slotName=t,this.clearFlags=e,this.clearColor.reset()},t}(),p2=function(){function t(t,e,i){void 0===t&&(t=J0.RENDER_OPAQUE),void 0===e&&(e=4294967295),void 0===i&&(i=4294967295),this.viewport=null,this.hint=t,this.phaseID=e,this.passLayoutID=i}return t.prototype.reset=function(t,e,i){this.hint=t,this.phaseID=e,this.passLayoutID=i,this.viewport=null},t}(),g2=function(){function t(t,e,i,n,r,s){void 0===t&&(t=null),void 0===e&&(e=null),void 0===i&&(i=e1.NONE),void 0===n&&(n=new a1),void 0===r&&(r=1),void 0===s&&(s=null),this.scene=t,this.camera=e,this.light=n,this.flags=i,this.cullingFlags=r,this.shadingLight=s}return t.prototype.reset=function(t,e,i,n,r){this.scene=t,this.camera=e,this.light.reset(null,0,!1,null),this.flags=i,this.cullingFlags=n,this.shadingLight=r},t}(),m2=function(){function t(t,e,i,n,r){void 0===t&&(t=null),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),this.material=t,this.passID=e,this.threadGroupCountX=i,this.threadGroupCountY=n,this.threadGroupCountZ=r}return t.prototype.reset=function(t,e,i,n,r){this.material=t,this.passID=e,this.threadGroupCountX=i,this.threadGroupCountY=n,this.threadGroupCountZ=r},t}(),v2=function(){function t(t,e,i,n){void 0===t&&(t=null),void 0===e&&(e=0),void 0===i&&(i=e1.NONE),void 0===n&&(n=null),this.material=t,this.passID=e,this.sceneFlags=i,this.camera=n}return t.prototype.reset=function(t,e,i,n){this.material=t,this.passID=e,this.sceneFlags=i,this.camera=n},t}(),y2=function(){function t(){this.constants=new Map,this.buffers=new Map,this.textures=new Map,this.samplers=new Map,this.custom=""}return t.prototype.reset=function(){this.constants.clear(),this.buffers.clear(),this.textures.clear(),this.samplers.clear(),this.custom=""},t}(),T2=10,E2=function(t,e){this.o=[],this.i=[],this.c=[],this.p=[],this.t=void 0,this.j=void 0,this.id=t,this.object=e,this.t=t,this.j=e},S2=function(){function t(){this.N=4294967295,this.x=[],this._names=[],this._layoutNodes=[],this._data=[],this._valid=[],this.index=new Map,this.sortedVertices=[]}var e=t.prototype;return e.edge=function(t,e){for(var i,n=d(this.x[t].o);!(i=n()).done;)if(e===i.value.target)return!0;return!1},e.source=function(t){return t.source},e.target=function(t){return t.target},e.oe=function(t){return new I1(this.x[t].o.values(),t)},e.od=function(t){return this.x[t].o.length},e.ie=function(t){return new x1(this.x[t].i.values(),t)},e.id=function(t){return this.x[t].i.length},e.d=function(t){return this.od(t)+this.id(t)},e.adj=function(t){return new D1(this,this.oe(t))},e.v=function(){return this.x.keys()},e.nv=function(){return this.x.length},e.ne=function(){for(var t,e=0,i=d(this.v());!(t=i()).done;){var n=t.value;e+=this.od(n)}return e},e.clear=function(){this.index.clear(),this.sortedVertices.length=0,this._names.length=0,this._layoutNodes.length=0,this._data.length=0,this._valid.length=0,this.x.length=0},e.addVertex=function(t,e,i,n,r,s,o){void 0===o&&(o=4294967295);var a=new E2(t,e),h=this.x.length;return this.x.push(a),this._names.push(i),this._layoutNodes.push(n),this._data.push(r),this._valid.push(s),4294967295!==o&&(this.x[o].c.push(new w1(h)),a.p.push(new w1(o))),h},e.addEdge=function(t,e){return this.x[t].o.push(new w1(e)),this.x[e].i.push(new w1(t)),new R1(t,e)},e.vertexName=function(t){return this._names[t]},e.getName=function(t){return this._names[t]},e.setName=function(t,e){this._names[t]=e},e.getLayout=function(t){return this._layoutNodes[t]},e.setLayout=function(t,e){this._layoutNodes[t]=e},e.getData=function(t){return this._data[t]},e.getValid=function(t){return this._valid[t]},e.setValid=function(t,e){this._valid[t]=e},e.h=function(t,e){return this.x[e].t===t},e.w=function(t){return this.x[t].t},e.object=function(t){return this.x[t].j},e.value=function(t,e){if(this.x[e].t===t)return this.x[e].j;throw Error("value id not match")},e.visitVertex=function(t,e){var i=this.x[e];switch(i.t){case 0:return t.rasterPass(i.j);case 1:return t.rasterSubpass(i.j);case 2:return t.computeSubpass(i.j);case 3:return t.compute(i.j);case 4:return t.resolve(i.j);case 5:return t.copy(i.j);case 6:return t.move(i.j);case 7:return t.raytrace(i.j);case 8:return t.queue(i.j);case 9:return t.scene(i.j);case T2:return t.blit(i.j);case 11:return t.dispatch(i.j);case 12:return t.clear(i.j);case 13:return t.viewport(i.j);default:throw Error("polymorphic type not found")}},e.j=function(t){return this.x[t].j},e.reference=function(t,e){for(var i,n=d(this.x[t].c);!(i=n()).done;)if(e===i.value.target)return!0;return!1},e.parent=function(t){return t.source},e.child=function(t){return t.target},e.children=function(t){return new I1(this.x[t].c.values(),t)},e.numChildren=function(t){return this.x[t].c.length},e.getParent=function(t){if(4294967295===t)return 4294967295;var e=this.x[t].p;return 0===e.length?4294967295:e[0].target},e.addReference=function(t,e){return this.x[t].c.push(new w1(e)),this.x[e].p.push(new w1(t)),new R1(t,e)},t}();function A2(t){return new Xs((function(){return new t}),16)}var b2,C2,R2=function(){function t(t){this.renderCommon=void 0,this.cv=A2(G1),this.rv=A2(H1),this.cv1=A2(z1),this.rd=A2(V1),this.rt=A2(W1),this.rs=A2(X1),this.rs1=A2(j1),this.mb=A2(Y1),this.pb=A2(K1),this.mt=A2(q1),this.pt=A2(Q1),this.mr=A2(Z1),this.s=A2(J1),this.sg=A2(t2),this.rs2=A2(e2),this.cs=A2(i2),this.rp=A2(n2),this.prpaf=A2(r2),this.fv=A2(s2),this.sv=A2(o2),this.rg=A2(h2),this.cp=A2(u2),this.rp1=A2(c2),this.cp1=A2(l2),this.mp=A2(_2),this.rp2=A2(d2),this.cv2=A2(f2),this.rq=A2(p2),this.sd=A2(g2),this.d=A2(m2),this.b=A2(v2),this.rd1=A2(y2),this.rg1=A2(S2),this.renderCommon=t}var e=t.prototype;return e.reset=function(){this.cv.reset(),this.rv.reset(),this.cv1.reset(),this.rd.reset(),this.rt.reset(),this.rs.reset(),this.rs1.reset(),this.mb.reset(),this.pb.reset(),this.mt.reset(),this.pt.reset(),this.mr.reset(),this.s.reset(),this.sg.reset(),this.rs2.reset(),this.cs.reset(),this.rp.reset(),this.prpaf.reset(),this.fv.reset(),this.sv.reset(),this.rg.reset(),this.cp.reset(),this.rp1.reset(),this.cp1.reset(),this.mp.reset(),this.rp2.reset(),this.cv2.reset(),this.rq.reset(),this.sd.reset(),this.d.reset(),this.b.reset(),this.rd1.reset(),this.rg1.reset()},e.createClearValue=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);var r=this.cv.add();return r.reset(t,e,i,n),r},e.createRasterView=function(t,e,i,n,r,s,o){void 0===t&&(t=""),void 0===e&&(e=n1.WRITE),void 0===i&&(i=s1.RENDER_TARGET),void 0===n&&(n=Bl.LOAD),void 0===r&&(r=Fl.STORE),void 0===s&&(s=Zl.ALL),void 0===o&&(o=Ll.NONE);var a=this.rv.add();return a.reset(t,e,i,n,r,s,o),a},e.createComputeView=function(t,e,i,n,r){void 0===t&&(t=""),void 0===e&&(e=n1.READ),void 0===i&&(i=Zl.NONE),void 0===n&&(n=o1.NONE),void 0===r&&(r=Ll.NONE);var s=this.cv1.add();return s.reset(t,e,i,n,r),s},e.createResourceDesc=function(){var t=this.rd.add();return t.reset(),t},e.createResourceTraits=function(t){void 0===t&&(t=Z0.MANAGED);var e=this.rt.add();return e.reset(t),e},e.createRenderSwapchain=function(t,e){void 0===t&&(t=null),void 0===e&&(e=!1);var i=this.rs.add();return i.reset(t,e),i},e.createResourceStates=function(){var t=this.rs1.add();return t.reset(),t},e.createManagedBuffer=function(t){void 0===t&&(t=null);var e=this.mb.add();return e.reset(t),e},e.createPersistentBuffer=function(t){void 0===t&&(t=null);var e=this.pb.add();return e.reset(t),e},e.createManagedTexture=function(t){void 0===t&&(t=null);var e=this.mt.add();return e.reset(t),e},e.createPersistentTexture=function(t){void 0===t&&(t=null);var e=this.pt.add();return e.reset(t),e},e.createManagedResource=function(){var t=this.mr.add();return t.reset(),t},e.createSubpass=function(){var t=this.s.add();return t.reset(),t},e.createSubpassGraph=function(){var t=this.sg.add();return t.clear(),t},e.createRasterSubpass=function(t,e,i){void 0===t&&(t=4294967295),void 0===e&&(e=1),void 0===i&&(i=0);var n=this.rs2.add();return n.reset(t,e,i),n},e.createComputeSubpass=function(t){void 0===t&&(t=4294967295);var e=this.cs.add();return e.reset(t),e},e.createRasterPass=function(){var t=this.rp.add();return t.reset(),t},e.createPersistentRenderPassAndFramebuffer=function(t,e){void 0===t&&(t=null),void 0===e&&(e=null);var i=this.prpaf.add();return i.reset(t,e),i},e.createFormatView=function(){var t=this.fv.add();return t.reset(),t},e.createSubresourceView=function(){var t=this.sv.add();return t.reset(),t},e.createResourceGraph=function(){var t=this.rg.add();return t.clear(),t},e.createComputePass=function(){var t=this.cp.add();return t.reset(),t},e.createResolvePass=function(){var t=this.rp1.add();return t.reset(),t},e.createCopyPass=function(){var t=this.cp1.add();return t.reset(),t},e.createMovePass=function(){var t=this.mp.add();return t.reset(),t},e.createRaytracePass=function(){var t=this.rp2.add();return t.reset(),t},e.createClearView=function(t,e){void 0===t&&(t=""),void 0===e&&(e=Zl.ALL);var i=this.cv2.add();return i.reset(t,e),i},e.createRenderQueue=function(t,e,i){void 0===t&&(t=J0.RENDER_OPAQUE),void 0===e&&(e=4294967295),void 0===i&&(i=4294967295);var n=this.rq.add();return n.reset(t,e,i),n},e.createSceneData=function(t,e,i,n,r){void 0===t&&(t=null),void 0===e&&(e=null),void 0===i&&(i=e1.NONE),void 0===n&&(n=1),void 0===r&&(r=null);var s=this.sd.add();return s.reset(t,e,i,n,r),s},e.createDispatch=function(t,e,i,n,r){void 0===t&&(t=null),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0);var s=this.d.add();return s.reset(t,e,i,n,r),s},e.createBlit=function(t,e,i,n){void 0===t&&(t=null),void 0===e&&(e=0),void 0===i&&(i=e1.NONE),void 0===n&&(n=null);var r=this.b.add();return r.reset(t,e,i,n),r},e.createRenderData=function(){var t=this.rd1.add();return t.reset(),t},e.createRenderGraph=function(){var t=this.rg1.add();return t.clear(),t},t}();!function(t){t[t.BASIC=0]="BASIC",t[t.STANDARD=1]="STANDARD"}(b2||(b2={})),function(t){t[t.NONE=0]="NONE",t[t.INPUT_DEPTH_STENCIL=1]="INPUT_DEPTH_STENCIL",t[t.INPUT_COLOR=2]="INPUT_COLOR",t[t.INPUT_COLOR_MRT=4]="INPUT_COLOR_MRT",t[t.HETEROGENEOUS_SAMPLE_COUNT=8]="HETEROGENEOUS_SAMPLE_COUNT"}(C2||(C2={}));var w2=function(){this.subpass=C2.NONE},I2=function(){function t(t,e,i){void 0===t&&(t=0),void 0===e&&(e=ml.UNKNOWN),void 0===i&&(i=1),this.descriptorID=t,this.type=e,this.count=i}return t.prototype.reset=function(t,e,i){this.descriptorID=t,this.type=e,this.count=i},t}(),x2=function(){function t(t,e,i){void 0===t&&(t=h1.UNIFORM_BUFFER),void 0===e&&(e=Ll.NONE),void 0===i&&(i=0),this.offset=0,this.descriptors=[],this.type=t,this.visibility=e,this.capacity=i}return t.prototype.reset=function(t,e,i){this.type=t,this.visibility=e,this.offset=0,this.capacity=i,this.descriptors.length=0},t}(),D2=function(){function t(t,e,i,n,r){void 0===t&&(t=4294967295),void 0===e&&(e=0),void 0===i&&(i=[]),void 0===n&&(n=new Map),void 0===r&&(r=new Map),this.uniformBlockCapacity=0,this.samplerTextureCapacity=0,this.slot=t,this.capacity=e,this.descriptorBlocks=i,this.uniformBlocks=n,this.bindingMap=r}return t.prototype.reset=function(t,e){this.slot=t,this.capacity=e,this.uniformBlockCapacity=0,this.samplerTextureCapacity=0,this.descriptorBlocks.length=0,this.uniformBlocks.clear(),this.bindingMap.clear()},t}(),O2=function(){function t(t,e,i){void 0===t&&(t=new D2),void 0===e&&(e=null),void 0===i&&(i=null),this.descriptorSetLayoutInfo=new K_,this.descriptorSetLayoutData=t,this.descriptorSetLayout=e,this.descriptorSet=i}return t.prototype.reset=function(t,e){this.descriptorSetLayoutData.reset(4294967295,0),this.descriptorSetLayoutInfo.reset(),this.descriptorSetLayout=t,this.descriptorSet=e},t}(),P2=function(){function t(){this.descriptorSets=new Map}return t.prototype.reset=function(){this.descriptorSets.clear()},t}(),M2=function(){function t(){this.descriptorBindings=new Map}return t.prototype.reset=function(){this.descriptorBindings.clear()},t}(),N2=function(){function t(){this.layoutData=new Map,this.bindingData=new Map}return t.prototype.reset=function(){this.layoutData.clear(),this.bindingData.clear()},t}(),L2=function(){function t(){this.passes=[]}return t.prototype.reset=function(){this.passes.length=0},t}(),B2=function(){function t(){this.techniques=new Map}return t.prototype.reset=function(){this.techniques.clear()},t}(),F2=function(){function t(){this.layout=new P2,this.pipelineLayout=null}return t.prototype.reset=function(){this.layout.reset(),this.pipelineLayout=null},t}(),k2=function(){function t(){this.descriptorVisibility=new Map}return t.prototype.reset=function(){this.descriptorVisibility.clear()},t}(),U2=function(){function t(){this.rootSignature="",this.shaderPrograms=[],this.shaderIndex=new Map,this.pipelineLayout=null}return t.prototype.reset=function(){this.rootSignature="",this.shaderPrograms.length=0,this.shaderIndex.clear(),this.pipelineLayout=null},t}(),G2=function(t,e){this.o=[],this.i=[],this.t=void 0,this.j=void 0,this.id=t,this.object=e,this.t=t,this.j=e},H2=function(){function t(){this.N=4294967295,this.x=[],this._names=[],this._updateFrequencies=[],this._layouts=[],this.valueNames=[],this.attributeIndex=new Map,this.constantIndex=new Map,this.shaderLayoutIndex=new Map,this.effects=new Map,this.constantMacros=""}var e=t.prototype;return e.edge=function(t,e){for(var i,n=d(this.x[t].o);!(i=n()).done;)if(e===i.value.target)return!0;return!1},e.source=function(t){return t.source},e.target=function(t){return t.target},e.oe=function(t){return new I1(this.x[t].o.values(),t)},e.od=function(t){return this.x[t].o.length},e.ie=function(t){return new x1(this.x[t].i.values(),t)},e.id=function(t){return this.x[t].i.length},e.d=function(t){return this.od(t)+this.id(t)},e.adj=function(t){return new D1(this,this.oe(t))},e.v=function(){return this.x.keys()},e.nv=function(){return this.x.length},e.ne=function(){for(var t,e=0,i=d(this.v());!(t=i()).done;){var n=t.value;e+=this.od(n)}return e},e.clear=function(){this.valueNames.length=0,this.attributeIndex.clear(),this.constantIndex.clear(),this.shaderLayoutIndex.clear(),this.effects.clear(),this.constantMacros="",this._names.length=0,this._updateFrequencies.length=0,this._layouts.length=0,this.x.length=0},e.addVertex=function(t,e,i,n,r,s){void 0===s&&(s=4294967295);var o=new G2(t,e),a=this.x.length;return this.x.push(o),this._names.push(i),this._updateFrequencies.push(n),this._layouts.push(r),4294967295!==s&&this.addEdge(s,a),a},e.addEdge=function(t,e){return this.x[t].o.push(new w1(e)),this.x[e].i.push(new w1(t)),new R1(t,e)},e.vertexName=function(t){return this._names[t]},e.getName=function(t){return this._names[t]},e.getUpdate=function(t){return this._updateFrequencies[t]},e.setUpdate=function(t,e){this._updateFrequencies[t]=e},e.getLayout=function(t){return this._layouts[t]},e.h=function(t,e){return this.x[e].t===t},e.w=function(t){return this.x[t].t},e.object=function(t){return this.x[t].j},e.value=function(t,e){if(this.x[e].t===t)return this.x[e].j;throw Error("value id not match")},e.visitVertex=function(t,e){var i=this.x[e];switch(i.t){case 0:return t.renderStage(i.j);case 1:return t.renderPhase(i.j);default:throw Error("polymorphic type not found")}},e.j=function(t){return this.x[t].j},e.reference=function(t,e){for(var i,n=d(this.x[t].o);!(i=n()).done;)if(e===i.value.target)return!0;return!1},e.parent=function(t){return t.source},e.child=function(t){return t.target},e.children=function(t){return new I1(this.x[t].o.values(),t)},e.numChildren=function(t){return this.x[t].o.length},e.getParent=function(t){if(4294967295===t)return 4294967295;var e=this.x[t].i;return 0===e.length?4294967295:e[0].target},e.addReference=function(t,e){return this.addEdge(t,e)},e.locateChild=function(t,e){if(4294967295===t){for(var i,n=d(this.x.keys());!(i=n()).done;){var r=i.value;if(0===this.x[r].i.length&&this._names[r]===e)return r}return 4294967295}for(var s,o=d(this.x[t].o);!(s=o()).done;){var a=s.value.target;if(e===this._names[a])return a}return 4294967295},e.locate=function(t){return O1(this,4294967295,t)},e.locateRelative=function(t,e){return void 0===e&&(e=4294967295),O1(this,e,t)},e.path=function(t){return function(t,e){if(e===t.N)return"";for(var i=[];e!==t.N;e=t.getParent(e))i.push(t.vertexName(e));for(var n="",r=i.length;r-- >0;)n+="/",n+=i[r];return n}(this,t)},t}();function z2(t,e){e.descriptorID=t.n(),e.type=t.n(),e.count=t.n()}function V2(t,e){var i;e.type=t.n(),e.visibility=t.n(),e.offset=t.n(),e.capacity=t.n(),i=t.n(),e.descriptors.length=i;for(var n=0;n!==i;++n){var r=new I2;z2(t,r),e.descriptors[n]=r}}function W2(t,e){e.slot=t.n(),e.capacity=t.n(),e.uniformBlockCapacity=t.n(),e.samplerTextureCapacity=t.n();var i=0;i=t.n(),e.descriptorBlocks.length=i;for(var n=0;n!==i;++n){var r=new x2;V2(t,r),e.descriptorBlocks[n]=r}i=t.n();for(var s=0;s!==i;++s){var o=t.n(),a=new w_;q0(t,a),e.uniformBlocks.set(o,a)}i=t.n();for(var h=0;h!==i;++h){var u=t.n(),c=t.n();e.bindingMap.set(u,c)}}function X2(t,e){W2(t,e.descriptorSetLayoutData),function(t,e){var i=t.n();e.bindings.length=i;for(var n=0;n!==i;++n){var r=new Y_;Q0(t,r),e.bindings[n]=r}}(t,e.descriptorSetLayoutInfo)}function j2(t,e){var i;i=t.n();for(var n=0;n!==i;++n){var r=t.n(),s=new O2;X2(t,s),e.descriptorSets.set(r,s)}}function Y2(t,e){var i;i=t.n();for(var n=0;n!==i;++n){var r=t.n(),s=t.n();e.descriptorBindings.set(r,s)}}function K2(t,e){var i=0;i=t.n();for(var n=0;n!==i;++n){var r=t.n(),s=new D2;W2(t,s),e.layoutData.set(r,s)}i=t.n();for(var o=0;o!==i;++o){var a=t.n(),h=new M2;Y2(t,h),e.bindingData.set(a,h)}}function q2(t,e){var i;i=t.n(),e.passes.length=i;for(var n=0;n!==i;++n){var r=new N2;K2(t,r),e.passes[n]=r}}function Q2(t,e){var i;i=t.n();for(var n=0;n!==i;++n){var r=t.s(),s=new L2;q2(t,s),e.techniques.set(r,s)}}function Z2(t,e){j2(t,e.layout)}function J2(t,e){var i;i=t.n();for(var n=0;n!==i;++n){var r=t.n(),s=t.n();e.descriptorVisibility.set(r,s)}}function $2(t,e){e.rootSignature=t.s();var i=0;i=t.n(),e.shaderPrograms.length=i;for(var n=0;n!==i;++n){var r=new F2;Z2(t,r),e.shaderPrograms[n]=r}i=t.n();for(var s=0;s!==i;++s){var o=t.s(),a=t.n();e.shaderIndex.set(o,a)}}function t3(t,e){var i=t.n();t.n(),t.n(),t.n();for(var n=0;n!==i;++n){var r=t.n(),s=t.n(),o=t.s(),a=t.n(),h=new P2;switch(j2(t,h),r){case 0:var u=new k2;J2(t,u),e.addVertex(0,u,o,a,h,s);break;case 1:var c=new U2;$2(t,c),e.addVertex(1,c,o,a,h,s)}}var l=0;l=t.n(),e.valueNames.length=l;for(var _=0;_!==l;++_)e.valueNames[_]=t.s();l=t.n();for(var d=0;d!==l;++d){var f=t.s(),p=t.n();e.attributeIndex.set(f,p)}l=t.n();for(var g=0;g!==l;++g){var m=t.s(),v=t.n();e.constantIndex.set(m,v)}l=t.n();for(var y=0;y!==l;++y){var T=t.s(),E=t.n();e.shaderLayoutIndex.set(T,E)}l=t.n();for(var S=0;S!==l;++S){var A=t.s(),b=new B2;Q2(t,b),e.effects.set(A,b)}}var e3,i3=function(){function t(t){this.colors=void 0,this.colors=new Array(t)}var e=t.prototype;return e.get=function(t){return this.colors[t]},e.put=function(t,e){this.colors[t]=e},t}();function n3(t){switch(t){case ml.BOOL:case ml.INT:case ml.UINT:case ml.FLOAT:return 1;case ml.INT2:case ml.FLOAT2:case ml.UINT2:case ml.BOOL2:return 2;case ml.FLOAT3:case ml.BOOL3:case ml.UINT3:case ml.INT3:return 3;case ml.BOOL4:case ml.FLOAT4:case ml.UINT4:case ml.INT4:case ml.MAT2:return 4;case ml.MAT2X3:case ml.MAT3X2:return 6;case ml.MAT2X4:case ml.MAT4X2:return 8;case ml.MAT3:return 9;case ml.MAT3X4:case ml.MAT4X3:return 12;case ml.MAT4:return 16;default:return 0}}function r3(t,e){var i=Bl.CLEAR;return t&Zl.COLOR||e!==s1.RENDER_TARGET||(i=t&nI?Bl.CLEAR:Bl.LOAD),(t&Zl.DEPTH_STENCIL)!==Zl.DEPTH_STENCIL&&e===s1.DEPTH_STENCIL&&(t&Zl.DEPTH||(i=Bl.LOAD),t&Zl.STENCIL||(i=Bl.LOAD)),i}function s3(t,e,i,n,r,s){void 0===n&&(n=null),void 0===r&&(r=0),void 0===s&&(s=void 0),s=s||new o_;var o=t?t.viewport:new o_(0,0,1,1),a=e,h=i;if(s.x=o.x*a,s.y=o.y*h,s.width=o.width*a,s.height=o.height*h,n)switch(n.type){case CI.DIRECTIONAL:var u=n;if(u.shadowFixedArea||u.csmLevel===nS.LEVEL_1)s.x=0,s.y=0,s.width=a,s.height=h;else{var c=m.director.root.device.capabilities.screenSpaceSignY;s.x=r%2*.5*a,s.y=c>0?.5*(1-Math.floor(r/2))*h:.5*Math.floor(r/2)*h,s.width=.5*a,s.height=.5*h}break;case CI.SPOT:s.x=0,s.y=0,s.width=a,s.height=h}return s}function o3(t,e,i,n,r){var s="Camera"+r,o=i.renderArea(),a=o.x,h=o.y,u=i.camera,c="reflectionProbePassColor"+s,l="reflectionProbePassDS"+s;e.containsResource(c)||(e.addRenderWindow(c,pl.RGBA8,a,h,n),e.addDepthStencil(l,pl.DEPTH_STENCIL,a,h,Z0.EXTERNAL)),e.updateRenderWindow(c,n),e.updateDepthStencil(l,a,h);var _=e.addRenderPass(a,h,"default");_.name="ReflectionProbePass"+r,_.setViewport(new d_(0,0,a,h)),_.addRenderTarget(c,r3(u.clearFlag,s1.RENDER_TARGET),Fl.STORE,new f_(u.clearColor.x,u.clearColor.y,u.clearColor.z,u.clearColor.w)),_.addDepthStencil(l,r3(u.clearFlag,s1.DEPTH_STENCIL),Fl.STORE,u.clearDepth,u.clearStencil,u.clearFlag);var d=_.addQueue(J0.RENDER_OPAQUE,"reflect-map"),f=new a1;f.probe=i,d.addSceneOfCamera(t,f,e1.REFLECTION_PROBE|e1.OPAQUE_OBJECT),function(t,e,i){var n=m.director.root.pipeline,r=i.pipelineSceneData,s=r.skybox;t.setMat4("cc_matView",e.matView),t.setMat4("cc_matViewInv",e.node.worldMatrix),t.setMat4("cc_matProj",e.matProj),t.setMat4("cc_matProjInv",e.matProjInv),t.setMat4("cc_matViewProj",e.matViewProj),t.setMat4("cc_matViewProjInv",e.matViewProjInv),t.setVec4("cc_cameraPos",new on(e.position.x,e.position.y,e.position.z,n.getCombineSignY())),t.setVec4("cc_surfaceTransform",new on(e.surfaceTransform,0,Math.cos(Li(s.getRotationAngle())),Math.sin(Li(s.getRotationAngle())))),t.setVec4("cc_screenScale",new on(r.shadingScale,r.shadingScale,1/r.shadingScale,1/r.shadingScale)),t.setVec4("cc_exposure",new on(e.exposure,1/e.exposure,r.isHDR?1:0,1/sI.standardExposureValue))}(d,u,e)}function a3(t,e,i){!function(t,e,i){i instanceof yd?t.bindBuffer(e,i):i instanceof Ud?t.bindTexture(e,i):i instanceof Fd&&t.bindSampler(e,i)}(t,e,i)}function h3(t,e){for(var i,n=d(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}new Xo(0,0,0,.5,.5,.5),new Xo,function(t){t[t.NONE=0]="NONE",t[t.FXAA=1]="FXAA",t[t.FXAAHQ=2]="FXAAHQ"}(e3||(e3={})),new(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}());var u3=function(){function t(t,e){void 0===e&&(e=2),this.buffers=[],this.currBuffIdx=0,this.device=void 0,this.currUniform=void 0,this._root=void 0;var i=(this._root=m.director.root).device;this.device=i,this.currUniform=new Float32Array(t/4);for(var n=0;n<e;n++){var r=new v_(vl.UNIFORM|vl.TRANSFER_DST,El.HOST|El.DEVICE,t,t);this.buffers.push(this.device.createBuffer(r))}}var e=t.prototype;return e.getCurrentBuffer=function(){var t=m.director;return this.currBuffIdx=t.getTotalFrames()%this.buffers.length,this.buffers[this.currBuffIdx]},e.updateData=function(t){this.currUniform.set(t)},e.updateBuffer=function(t,e){var i=e.descriptorSet,n=this.getCurrentBuffer();n.update(this.currUniform),a3(i,t,n)},t}(),c3=new Map,l3=new Map,_3=new Map;function d3(t){var e=_3.get(t);if(e)return e;var i=m.director.root.pipeline,n=i.layoutGraph.locateChild(i.layoutGraph.N,t),r=i.layoutGraph.getLayout(n).descriptorSets.get(W0.PER_PASS);return _3.set(t,r),r}function f3(t,e,i,n){void 0===n&&(n="default"),function(t,e,i,n){var r=n.constants,s=n.samplers,o=n.textures,a=n.buffers,h=m.director.root.pipeline,u=h.layoutGraph,c=d3(t);l3.clear();for(var l,_=function(){var n=l.value,r=n[0],s=n[1],o=y3.get(r);if(o)S3(o,s,c,e,i);else for(var a,h=Array.from(u.constantIndex).find((function(t){return t[0],t[1]===r}))[0],_=d(u.attributeIndex);!(a=_()).done;){var f=a.value,p=f[0],g=f[1],m=T3(p,t);if(m){var v=g3(h,p,t);-1!==v?(y3.set(r,new v3),(o=y3.get(r)).buffer=m,o.blockId=g,o.offset=v,S3(o,s,c,e,i)):A3(g,e,i,m,c)}}},f=d(r);!(l=f()).done;)_();for(var p,g=c.descriptorSet,v=d(o);!(p=v()).done;){var y=p.value,T=y[0],E=y[1],S=h3(T,c);if(-1!==S){var A=g.getTexture(S);A&&E===h.defaultShadowTexture&&(A.gpuTexture||A.gpuTextureView&&A.gpuTextureView.gpuTexture)||a3(g,S,E)}}for(var b,C=d(s);!(b=C()).done;){var R=b.value,w=R[0],I=R[1],x=h3(w,c);-1!==x&&(g.getSampler(x)&&I===h.defaultSampler||a3(g,x,I))}for(var D,O=d(l3);!(D=O()).done;){var P=D.value,M=P[0],N=P[1];c3.get(M).updateBuffer(N,c)}for(var L,B=d(a);!(L=B()).done;){var F=L.value,k=F[0],U=F[1],G=h3(k,c);-1!==G&&(g.getBuffer(G)||a3(g,G,U))}g.update()}(n,e,i,t)}function p3(t,e){var i=m.director.root.pipeline.layoutGraph,n=i.locateChild(4294967295,e),r=i.getLayout(n).descriptorSets.get(W0.PER_PASS).descriptorSetLayoutData,s=i.attributeIndex.get(t);return r.uniformBlocks.get(s)}function g3(t,e,i){var n=p3(e,i);if(!n)return-1;for(var r,s=0,o=d(n.members);!(r=o()).done;){var a=r.value,h=n3(a.type);if(a.name===t)return s;s+=h*a.count}return-1}var m3=new Map,v3=function(){this.offset=-1,this.buffer=[],this.blockId=-1},y3=new Map;function T3(t,e){var i=m3.get(t);if(i)return i;i=[],m.director.root.pipeline.layoutGraph;var n=0,r=p3(t,e);if(!r)return null;for(var s,o=d(r.members);!(s=o()).done;){var a=s.value;n+=n3(a.type)*a.count}return i.length=n,i.fill(0),m3.set(t,i),i}function E3(t,e){var i=c3.get(t);i||(c3.set(t,new u3(4*e.length,2)),i=c3.get(t)),i.updateData(e)}function S3(t,e,i,n,r){var s=t.blockId,o=t.buffer,a=function(t,e,i){var n=!1;if(i<0||i>t.length)return n;for(var r=Math.min(e.length,t.length-i),s=0;s<r;s++)t[i+s]!==e[s]&&(t[i+s]=e[s],n=!0);return n}(o,e,t.offset),h=h3(s,i),u=i.descriptorSet;if(a||!u.getBuffer(h)&&-1!==h){var c=""+s+h+r+n;l3.set(c,h),E3(c,o)}}function A3(t,e,i,n,r){var s=h3(t,r);if(-1!==s){var o=""+t+s+i+e;l3.set(o,s),E3(o,n)}}function b3(t){return t+"-"}function C3(t){return!!t}var R3=new on,w3=new _n,I3=new f_,x3=new Ln,D3=new Ln;function O3(t,e,i,n){var r,s=m.director.root.pipeline,o=i.shadows,a=i.skybox,h=i.shadingScale;e&&(t.setMat4("cc_matView",e.matView),t.setMat4("cc_matViewInv",e.node.worldMatrix),t.setMat4("cc_matProj",e.matProj),t.setMat4("cc_matProjInv",e.matProjInv),t.setMat4("cc_matViewProj",e.matViewProj),t.setMat4("cc_matViewProjInv",e.matViewProjInv),R3.set(e.surfaceTransform,e.cameraUsage,Math.cos(Li(a.getRotationAngle())),Math.sin(Li(a.getRotationAngle()))),t.setVec4("cc_surfaceTransform",R3),R3.set(e.exposure,1/e.exposure,i.isHDR?1:0,1/sI.standardExposureValue),t.setVec4("cc_exposure",R3)),e?R3.set(e.position.x,e.position.y,e.position.z,s.getCombineSignY()):R3.set(0,0,0,s.getCombineSignY()),t.setVec4("cc_cameraPos",R3),R3.set(i.shadingScale,i.shadingScale,1/i.shadingScale,1/i.shadingScale),t.setVec4("cc_screenScale",R3);var u=n&&n.mainLight;if(u){var c=u.shadowEnabled&&o.type===eS.ShadowMap?1:0;R3.set(u.direction.x,u.direction.y,u.direction.z,c),t.setVec4("cc_mainLitDir",R3);var l=u.color.x,_=u.color.y,d=u.color.z;u.useColorTemperature&&(l*=u.colorTemperatureRGB.x,_*=u.colorTemperatureRGB.y,d*=u.colorTemperatureRGB.z);var f=u.illuminance;i.isHDR&&e&&(f*=e.exposure),R3.set(l,_,d,f),t.setVec4("cc_mainLitColor",R3)}else R3.set(0,0,1,0),t.setVec4("cc_mainLitDir",R3),R3.set(0,0,0,0),t.setVec4("cc_mainLitColor",R3);var p=i.ambient,g=p.skyColor;i.isHDR?g.w=p.skyIllum*(e?e.exposure:1):g.w=p.skyIllum,R3.set(g.x,g.y,g.z,g.w),t.setVec4("cc_ambientSky",R3),R3.set(p.groundAlbedo.x,p.groundAlbedo.y,p.groundAlbedo.z,a.envmap?null===(r=a.envmap)||void 0===r?void 0:r.mipmapLevel:1),t.setVec4("cc_ambientGround",R3);var v=i.fog,y=v.colorArray;R3.set(y.x,y.y,y.z,y.z),t.setVec4("cc_fogColor",R3),R3.set(v.fogStart,v.fogEnd,v.fogDensity,0),t.setVec4("cc_fogBase",R3),R3.set(v.fogTop,v.fogRange,v.fogAtten,0),t.setVec4("cc_fogAdd",R3),e&&(R3.set(e.nearClip,e.farClip,e.getClipSpaceMinz(),0),t.setVec4("cc_nearFar",R3),R3.set(e.viewport.x,e.viewport.y,h*e.window.width*e.viewport.z,h*e.window.height*e.viewport.w),t.setVec4("cc_viewPort",R3))}var P3=function(){function t(t,e,i,n,r,s){void 0===t&&(t=null),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),this.subModel=void 0,this.priority=void 0,this.hash=void 0,this.depth=void 0,this.shaderID=void 0,this.passIndex=void 0,this.subModel=t,this.priority=e,this.hash=i,this.depth=n,this.shaderID=r,this.passIndex=s}return t.prototype.update=function(t,e,i,n,r,s){void 0===t&&(t=null),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),this.subModel=t,this.priority=e,this.hash=i,this.depth=n,this.shaderID=r,this.passIndex=s},t}(),M3=new Xs((function(){return new P3}),8),N3="CC_USE_RGBE_OUTPUT";function L3(t,e){for(var i=t.passes,n=0;n<i.length;n++)if(i[n].phaseID===e)return n;return-1}var B3=function(){function t(){this.probeMap=new Array,this.defaultId=function(){var t=m.rendering;return t.getPhaseID(t.getPassID("default"),"default")}()}var e=t.prototype;return e.clear=function(){this.probeMap.length=0},e.applyMacro=function(){for(var t,e=d(this.probeMap);!(t=e()).done;){var i=t.value,n=[{name:N3,value:!0}];i.patches&&(n=n.concat(i.patches)),i.onMacroPatchesStateChanged(n)}},e.removeMacro=function(){for(var t,e=d(this.probeMap);!(t=e()).done;){var i=t.value;if(i.patches){var n=i.patches.filter((function(t){return t.name!==N3}));0===n.length?i.onMacroPatchesStateChanged(null):i.onMacroPatchesStateChanged(n)}}},e.addToProbeQueue=function(t,e){for(var i=t.subModels,n=0;n<i.length;n++){var r=i[n];if(!r.passes[0].blendState.targets[0].blend){var s=L3(r,e),o=!0;s<0&&(s=L3(r,e=this.defaultId),o=!1),s<0||o||this.probeMap.push(r)}}},t}();function F3(t,e,i,n){var r=m.director.root.pipeline,s=r.device,o=r.pipelineSceneData,a=o.shadows;if(a.type!==eS.Planar){var h=o.csmLayers,u=Ey(s)?0:1,c=r.device.capabilities;switch(a.enabled&&a.type===eS.ShadowMap&&i&&i.node&&i.type===CI.DIRECTIONAL&&h.update(o,e),i.type){case CI.DIRECTIONAL:var l=i;if(a.enabled&&l&&l.shadowEnabled&&a.type===eS.ShadowMap){var _,d,f,p=.1,g=0,v=0;if(l.shadowFixedArea||l.csmLevel===nS.LEVEL_1)_=h.specialLayer.matShadowView,d=h.specialLayer.matShadowProj,f=h.specialLayer.matShadowViewProj,l.shadowFixedArea?(p=l.shadowNear,g=l.shadowFar,v=0):(p=.1,g=h.specialLayer.shadowCameraFar,v=1),R3.set(CI.DIRECTIONAL,u,l.shadowNormalBias,0),t.setVec4("cc_shadowLPNNInfo",R3);else{var y=h.layers[n];_=y.matShadowView,d=y.matShadowProj,f=y.matShadowViewProj,p=y.splitCameraNear,g=y.splitCameraFar,v=l.csmLevel}t.setMat4("cc_matLightView",_),R3.set(d.m10,d.m14,d.m11,d.m15),t.setVec4("cc_shadowProjDepthInfo",R3),R3.set(d.m00,d.m05,1/d.m00,1/d.m05),t.setVec4("cc_shadowProjInfo",R3),t.setMat4("cc_matLightViewProj",f),R3.set(p,g,0,1-l.shadowSaturation),t.setVec4("cc_shadowNFLSInfo",R3),R3.set(CI.DIRECTIONAL,u,l.shadowNormalBias,v),t.setVec4("cc_shadowLPNNInfo",R3),R3.set(a.size.x,a.size.y,l.shadowPcf,l.shadowBias),t.setVec4("cc_shadowWHPBInfo",R3)}break;case CI.SPOT:var T=i;if(a.enabled&&T&&T.shadowEnabled){Ln.invert(x3,T.node.getWorldMatrix()),t.setMat4("cc_matLightView",x3),Ln.perspective(D3,T.angle,1,.001,T.range,!0,c.clipSpaceMinZ,c.clipSpaceSignY,0);var E=D3.clone().invert(),S=D3.clone();Ln.multiply(x3,D3,x3),t.setMat4("cc_matLightViewProj",x3),R3.set(.01,i.range,0,0),t.setVec4("cc_shadowNFLSInfo",R3),R3.set(a.size.x,a.size.y,T.shadowPcf,T.shadowBias),t.setVec4("cc_shadowWHPBInfo",R3),R3.set(CI.SPOT,u,T.shadowNormalBias,0),t.setVec4("cc_shadowLPNNInfo",R3),R3.set(S.m10,S.m14,S.m11,S.m15),t.setVec4("cc_shadowProjDepthInfo",R3),R3.set(E.m10,E.m14,E.m11,E.m15),t.setVec4("cc_shadowInvProjDepthInfo",R3),R3.set(S.m00,S.m05,1/S.m00,1/S.m05),t.setVec4("cc_shadowProjInfo",R3)}break;case CI.SPHERE:R3.set(a.size.x,a.size.y,1,0),t.setVec4("cc_shadowWHPBInfo",R3),R3.set(CI.SPHERE,u,0,0),t.setVec4("cc_shadowLPNNInfo",R3);break;case CI.POINT:R3.set(a.size.x,a.size.y,1,0),t.setVec4("cc_shadowWHPBInfo",R3),R3.set(CI.POINT,u,0,0),t.setVec4("cc_shadowLPNNInfo",R3)}I3.set(a.shadowColor.x,a.shadowColor.y,a.shadowColor.z,a.shadowColor.w),t.setColor("cc_shadowColor",I3)}}function k3(t,e){var i=m.director,n=i.root.pipeline,r=n.device,s=i.getScene(),o=e&&e.scene?e.scene.mainLight:s?s.renderScene.mainLight:null,a=n.pipelineSceneData,h=a.shadows,u=a.csmLayers,c=a.csmSupported,l=Ey(r)?0:1;if(o&&h.enabled){if(h.type===eS.ShadowMap){if(o.shadowEnabled){if(o.shadowFixedArea||o.csmLevel===nS.LEVEL_1||!c){var _=u.specialLayer.matShadowView,d=u.specialLayer.matShadowProj,f=u.specialLayer.matShadowViewProj,p=o.shadowNear,g=o.shadowFar;t.setMat4("cc_matLightView",_),R3.set(d.m10,d.m14,d.m11,d.m15),t.setVec4("cc_shadowProjDepthInfo",R3),R3.set(d.m00,d.m05,1/d.m00,1/d.m05),t.setVec4("cc_shadowProjInfo",R3),t.setMat4("cc_matLightViewProj",f),R3.set(p,g,0,1-o.shadowSaturation),t.setVec4("cc_shadowNFLSInfo",R3),R3.set(CI.DIRECTIONAL,l,o.shadowNormalBias,0),t.setVec4("cc_shadowLPNNInfo",R3)}else{for(var v=function(t,e){var i=t.size.x;switch(e.shadowPcf){case iS.HARD:return 0;case iS.SOFT:return 1/(.5*i);case iS.SOFT_2X:return 2/(.5*i);case iS.SOFT_4X:return 3/(.5*i)}return 0}(h,o),y=0;y<o.csmLevel;y++){var T=u.layers[y],E=T.matShadowView;R3.set(E.m00,E.m04,E.m08,v),t.setVec4("cc_csmViewDir0",R3,y),R3.set(E.m01,E.m05,E.m09,T.splitCameraNear),t.setVec4("cc_csmViewDir1",R3,y),R3.set(E.m02,E.m06,E.m10,T.splitCameraFar),t.setVec4("cc_csmViewDir2",R3,y);var S=T.csmAtlas;t.setVec4("cc_csmAtlas",S,y);var A=T.matShadowViewProj;t.setMat4("cc_matCSMViewProj",A,y);var b=T.matShadowProj;R3.set(b.m10,b.m14,b.m11,b.m15),t.setVec4("cc_csmProjDepthInfo",R3,y),R3.set(b.m00,b.m05,1/b.m00,1/b.m05),t.setVec4("cc_csmProjInfo",R3,y)}R3.set(o.csmTransitionRange,0,0,0),t.setVec4("cc_csmSplitsInfo",R3),R3.set(.1,o.shadowDistance,0,1-o.shadowSaturation),t.setVec4("cc_shadowNFLSInfo",R3),R3.set(CI.DIRECTIONAL,l,o.shadowNormalBias,o.csmLevel),t.setVec4("cc_shadowLPNNInfo",R3)}R3.set(h.size.x,h.size.y,o.shadowPcf,o.shadowBias),t.setVec4("cc_shadowWHPBInfo",R3)}}else _n.normalize(w3,h.normal),R3.set(w3.x,w3.y,w3.z,-h.distance),t.setVec4("cc_planarNDInfo",R3),R3.set(0,0,0,h.planeBias),t.setVec4("cc_shadowWHPBInfo",R3);t.setMathColor("cc_shadowColor",h.shadowColor)}}var U3=function(){function t(t,e){this._data=void 0,this._lg=void 0,this._vertID=-1,this._currBlock=void 0,this._currStage="",this._currFrequency=W0.PER_PASS,this._currCount=void 0,this._currConstant=[],this._data=t,this._lg=e}var e=t.prototype;return e.setMat4=function(e,i,n){void 0===n&&(n=0),t.setMat4(this._lg,this._data,e,i,n)},t.setMat4=function(e,i,n,r,s){void 0===s&&(s=0);var o=t.getConstantInfo(e,i,n);Ln.toArray(o.dataArr,r,16*s),i.constants.set(o.constantID,o.dataArr)},e.setQuaternion=function(e,i,n){void 0===n&&(n=0),t.setQuaternion(this._lg,this._data,e,i,n)},t.setQuaternion=function(e,i,n,r,s){void 0===s&&(s=0);var o=t.getConstantInfo(e,i,n);Rn.toArray(o.dataArr,r,4*s),i.constants.set(o.constantID,o.dataArr)},e.setColor=function(e,i,n){void 0===n&&(n=0),t.setColor(this._lg,this._data,e,i,n)},t.setColor=function(e,i,n,r,s){void 0===s&&(s=0);var o=t.getConstantInfo(e,i,n),a=4*s;o.dataArr[0+a]=r.x,o.dataArr[1+a]=r.y,o.dataArr[2+a]=r.z,o.dataArr[3+a]=r.w,i.constants.set(o.constantID,o.dataArr)},e.setMathColor=function(e,i,n){void 0===n&&(n=0),t.setMathColor(this._lg,this._data,e,i,n)},t.setMathColor=function(e,i,n,r,s){void 0===s&&(s=0);var o=t.getConstantInfo(e,i,n);yn.toArray(o.dataArr,r,4*s),i.constants.set(o.constantID,o.dataArr)},t.getConstantInfo=function(t,e,i){var n=t.constantIndex.get(i);if(void 0===n)throw new Error("Constant with name "+i+" not found.");return{constantID:n,dataArr:e.constants.get(n)||[]}},e.setVec4=function(e,i,n){void 0===n&&(n=0),t.setVec4(this._lg,this._data,e,i,n)},t.setVec4=function(e,i,n,r,s){void 0===s&&(s=0);var o=t.getConstantInfo(e,i,n);on.toArray(o.dataArr,r,4*s),i.constants.set(o.constantID,o.dataArr)},e.setVec2=function(e,i,n){void 0===n&&(n=0),t.setVec2(this._lg,this._data,e,i,n)},t.setVec2=function(e,i,n,r,s){void 0===s&&(s=0);var o=t.getConstantInfo(e,i,n);Hn.toArray(o.dataArr,r,2*s),i.constants.set(o.constantID,o.dataArr)},e.setFloat=function(e,i,n){void 0===n&&(n=0),t.setFloat(this._lg,this._data,e,i,n)},t.setFloat=function(e,i,n,r,s){void 0===s&&(s=0);var o=t.getConstantInfo(e,i,n);o.dataArr[0+s]=r,i.constants.set(o.constantID,o.dataArr)},e.setArrayBuffer=function(e,i){t.setArrayBuffer(this._lg,this._data,e,i)},t.setArrayBuffer=function(){throw new Error("Method not implemented.")},e.setBuffer=function(e,i){t.setBuffer(this._lg,this._data,e,i)},t.setBuffer=function(t,e,i,n){var r=t.attributeIndex.get(i);e.buffers.set(r,n)},e.setTexture=function(e,i){t.setTexture(this._lg,this._data,e,i)},t.setTexture=function(t,e,i,n){var r=t.attributeIndex.get(i);e.textures.set(r,n)},e.setReadWriteBuffer=function(e,i){t.setReadWriteBuffer(this._lg,this._data,e,i)},t.setReadWriteBuffer=function(t,e,i,n){var r=t.attributeIndex.get(i);e.buffers.set(r,n)},e.setReadWriteTexture=function(e,i){t.setReadWriteTexture(this._lg,this._data,e,i)},t.setReadWriteTexture=function(t,e,i,n){var r=t.attributeIndex.get(i);e.textures.set(r,n)},e.setSampler=function(e,i){t.setSampler(this._lg,this._data,e,i)},t.setSampler=function(t,e,i,n){var r=t.attributeIndex.get(i);e.samplers.set(r,n)},e.getParentLayout=function(){var t=m.director.root.pipeline,e=t.renderGraph.getParent(this._vertID);return t.renderGraph.getLayout(e)},e.getCurrentLayout=function(){return m.director.root.pipeline.renderGraph.getLayout(this._vertID)},e.setBuiltinCameraConstants=function(t){var e=m.director.root.pipeline;this.getParentLayout(),O3(this,t,e.pipelineSceneData,t.scene)},e.setBuiltinShadowMapConstants=function(){k3(this,null,this.getParentLayout())},e.setBuiltinDirectionalLightFrustumConstants=function(t,e,i){void 0===i&&(i=0),F3(this,t,e,i)},e.setBuiltinSpotLightFrustumConstants=function(t){F3(this,null,t,0)},e.setBuiltinDirectionalLightConstants=function(t){this.setBuiltinShadowMapConstants(t)},e.setBuiltinSphereLightConstants=function(t,e){var i=m.director.root.pipeline.pipelineSceneData;R3.set(t.position.x,t.position.y,t.position.z,CI.SPHERE),this.setVec4("cc_lightPos",R3),R3.set(t.size,t.range,0,0),this.setVec4("cc_lightSizeRangeAngle",R3);var n=i.isHDR;if(R3.set(t.color.x,t.color.y,t.color.z,0),t.useColorTemperature){var r=t.finalColor;R3.x=r.x,R3.y=r.y,R3.z=r.z}R3.w=n?t.luminance*e.exposure*1e4:t.luminance,this.setVec4("cc_lightColor",R3)},e.setBuiltinSpotLightConstants=function(t,e){var i=m.director.root.pipeline.pipelineSceneData,n=i.shadows;R3.set(t.position.x,t.position.y,t.position.z,CI.SPOT),this.setVec4("cc_lightPos",R3),R3.set(t.size,t.range,t.spotAngle,n.enabled&&t.shadowEnabled&&n.type===eS.ShadowMap?1:0),this.setVec4("cc_lightSizeRangeAngle",R3),R3.set(t.direction.x,t.direction.y,t.direction.z,0),this.setVec4("cc_lightDir",R3);var r=i.isHDR;if(R3.set(t.color.x,t.color.y,t.color.z,0),t.useColorTemperature){var s=t.finalColor;R3.x=s.x,R3.y=s.y,R3.z=s.z}R3.w=r?t.luminance*e.exposure*1e4:t.luminance,this.setVec4("cc_lightColor",R3),R3.set(0,0,0,t.angleAttenuationStrength),this.setVec4("cc_lightBoundingSizeVS",R3)},e.setBuiltinPointLightConstants=function(t,e){var i=m.director.root.pipeline.pipelineSceneData;R3.set(t.position.x,t.position.y,t.position.z,CI.POINT),this.setVec4("cc_lightPos",R3),R3.set(0,t.range,0,0),this.setVec4("cc_lightSizeRangeAngle",R3);var n=i.isHDR;if(t.useColorTemperature){var r=t.finalColor;R3.x=r.x,R3.y=r.y,R3.z=r.z}R3.w=n?t.luminance*e.exposure*1e4:t.luminance,R3.set(t.color.x,t.color.y,t.color.z,0),this.setVec4("cc_lightColor",R3)},e.setBuiltinRangedDirectionalLightConstants=function(t,e){var i=m.director.root.pipeline.pipelineSceneData;R3.set(t.position.x,t.position.y,t.position.z,CI.RANGED_DIRECTIONAL),this.setVec4("cc_lightPos",R3),R3.set(t.right.x,t.right.y,t.right.z,0),this.setVec4("cc_lightSizeRangeAngle",R3),R3.set(t.direction.x,t.direction.y,t.direction.z,0),this.setVec4("cc_lightDir",R3);var n=t.scale;R3.set(.5*n.x,.5*n.y,.5*n.z,0),this.setVec4("cc_lightBoundingSizeVS",R3);var r=i.isHDR;if(R3.set(t.color.x,t.color.y,t.color.z,0),t.useColorTemperature){var s=t.finalColor;R3.x=s.x,R3.y=s.y,R3.z=s.z}R3.w=r?t.illuminance*e.exposure:t.illuminance,this.setVec4("cc_lightColor",R3)},e.hasSampler=function(t){var e=this._lg.constantIndex.get(t);return void 0!==e&&this._data.samplers.has(e)},e.hasTexture=function(t){var e=this._lg.constantIndex.get(t);return void 0!==e&&this._data.textures.has(e)},e.setCustomBehavior=function(){throw new Error("Method not implemented.")},n(t,[{key:"name",get:function(){return""},set:function(){}}]),t}(),G3=function(){function t(){this.instances=new Array}var e=t.prototype;return e.empty=function(){return 0===this.instances.length},e.clear=function(){this.instances.length=0},e.add=function(t,e,i,n){var r=t.subModels[i],s=r.passes[n].priority,o=r.priority,a=r.shaders[n].typedID,h=0|s<<16|o<<8|n,u=t.priority,c=M3.add();c.update(r,u,h,e,a,n),this.instances.push(c)},e.sortOpaqueOrCutout=function(){this.instances.sort((function(t,e){return t.hash!==e.hash?t.hash-e.hash:t.depth!==e.depth?t.depth-e.depth:t.shaderID-e.shaderID}))},e.sortTransparent=function(){this.instances.sort((function(t,e){return t.priority!==e.priority?t.priority-e.priority:t.hash!==e.hash?t.hash-e.hash:t.depth!==e.depth?e.depth-t.depth:t.shaderID-e.shaderID}))},e.recordCommandBuffer=function(t,e,i,n,r,s){void 0===n&&(n=null),void 0===r&&(r=0),void 0===s&&(s=null);for(var o,a=d(this.instances);!(o=a()).done;){var h=o.value,u=h.subModel,c=h.passIndex,l=u.inputAssembler,_=u.passes[c],f=u.shaders[c],p=QE.getOrCreatePipelineState(t,_,f,e,l);i.bindPipelineState(p),i.bindDescriptorSet(jm.MATERIAL,_.descriptorSet),n&&i.bindDescriptorSet(jm.GLOBAL,n,[r]),s?i.bindDescriptorSet(jm.LOCAL,u.descriptorSet,s):i.bindDescriptorSet(jm.LOCAL,u.descriptorSet),i.bindInputAssembler(l),i.draw(l)}},t}(),H3=function(){function t(){this.passInstances=new Map,this.instanceBuffers=new Array}var e=t.prototype;return e.empty=function(){return 0===this.passInstances.size},e.add=function(t,e,i){if(void 0===this.passInstances.get(t)){var n=this.passInstances.size;n>=this.instanceBuffers.length&&this.instanceBuffers.push(new BE(t)),this.passInstances.set(t,n);var r=this.instanceBuffers[n];r.pass=t,r.instances}this.instanceBuffers[this.passInstances.get(t)].merge(e,i)},e.clear=function(){this.passInstances.clear(),this.instanceBuffers.forEach((function(t){t.clear()}))},e.sort=function(){},e.uploadBuffers=function(t){for(var e,i=d(this.passInstances.entries());!(e=i()).done;){var n=e.value;n[0];var r=n[1],s=this.instanceBuffers[r];s.hasPendingModels&&s.uploadBuffers(t)}},e.recordCommandBuffer=function(t,e,i,n,r){void 0===i&&(i=null),void 0===n&&(n=0),void 0===r&&(r=null);for(var s,o=d(this.instanceBuffers);!(s=o()).done;){var a=s.value;if(a.hasPendingModels){var h=a.instances,u=a.pass;e.bindDescriptorSet(jm.MATERIAL,u.descriptorSet);for(var c,l=null,_=d(h);!(c=_()).done;){var f=c.value;if(f.count){var p=QE.getOrCreatePipelineState(Qd.gfxDevice,u,f.shader,t,f.ia);l!==p&&(e.bindPipelineState(p),l=p),i&&e.bindDescriptorSet(jm.GLOBAL,i,[n]),r?e.bindDescriptorSet(jm.LOCAL,f.descriptorSet,r):e.bindDescriptorSet(jm.LOCAL,f.descriptorSet,a.dynamicOffsets),e.bindInputAssembler(f.ia),e.draw(f.ia)}}}}},t}(),z3=function(){function t(t,e,i){void 0===t&&(t=4294967295),void 0===e&&(e=4294967295),void 0===i&&(i=4294967295),this.frustumCulledResultID=void 0,this.lightBoundsCulledResultID=void 0,this.renderQueueTarget=void 0,this.frustumCulledResultID=t,this.lightBoundsCulledResultID=e,this.renderQueueTarget=i}return t.prototype.update=function(t,e,i){void 0===t&&(t=4294967295),void 0===e&&(e=4294967295),void 0===i&&(i=4294967295),this.frustumCulledResultID=t,this.lightBoundsCulledResultID=e,this.renderQueueTarget=i},t}(),V3=function(){function t(){this.probeQueue=new B3,this.opaqueQueue=new G3,this.transparentQueue=new G3,this.opaqueInstancingQueue=new H3,this.transparentInstancingQueue=new H3,this.camera=null,this.sceneFlags=e1.NONE,this.lightByteOffset=4294967295}var e=t.prototype;return e.sort=function(){this.opaqueQueue.sortOpaqueOrCutout(),this.transparentQueue.sortTransparent(),this.opaqueInstancingQueue.sort(),this.transparentInstancingQueue.sort()},e.update=function(){this.probeQueue.clear(),this.opaqueQueue.clear(),this.transparentQueue.clear(),this.opaqueInstancingQueue.clear(),this.transparentInstancingQueue.clear(),this.camera=null,this.sceneFlags=e1.NONE,this.lightByteOffset=4294967295},e.empty=function(){return this.opaqueQueue.empty()&&this.transparentQueue.empty()&&this.opaqueInstancingQueue.empty()&&this.transparentInstancingQueue.empty()},e.recordCommands=function(t,e,i){var n=4294967295===this.lightByteOffset?null:[this.lightByteOffset];i&(e1.OPAQUE|e1.MASK)&&(this.opaqueQueue.recordCommandBuffer(Qd.gfxDevice,e,t,null,0,n),this.opaqueInstancingQueue.recordCommandBuffer(e,t,null,0,n)),i&e1.BLEND&&(this.transparentInstancingQueue.recordCommandBuffer(e,t,null,0,n),this.transparentQueue.recordCommandBuffer(Qd.gfxDevice,e,t,null,0,n))},t}(),W3=4294967295;function X3(t){switch(t){case h1.UNIFORM_BUFFER:return Yl.UNIFORM_BUFFER;case h1.DYNAMIC_UNIFORM_BUFFER:return Yl.DYNAMIC_UNIFORM_BUFFER;case h1.SAMPLER_TEXTURE:return Yl.SAMPLER_TEXTURE;case h1.SAMPLER:return Yl.SAMPLER;case h1.TEXTURE:return Yl.TEXTURE;case h1.STORAGE_BUFFER:return Yl.STORAGE_BUFFER;case h1.DYNAMIC_STORAGE_BUFFER:return Yl.DYNAMIC_STORAGE_BUFFER;case h1.STORAGE_IMAGE:return Yl.STORAGE_IMAGE;case h1.INPUT_ATTACHMENT:return Yl.INPUT_ATTACHMENT;default:return k("DescriptorType not found"),Yl.INPUT_ATTACHMENT}}function j3(t){switch(t){case Yl.UNIFORM_BUFFER:return h1.UNIFORM_BUFFER;case Yl.DYNAMIC_UNIFORM_BUFFER:return h1.DYNAMIC_UNIFORM_BUFFER;case Yl.SAMPLER_TEXTURE:return h1.SAMPLER_TEXTURE;case Yl.SAMPLER:return h1.SAMPLER;case Yl.TEXTURE:return h1.TEXTURE;case Yl.STORAGE_BUFFER:return h1.STORAGE_BUFFER;case Yl.DYNAMIC_STORAGE_BUFFER:return h1.DYNAMIC_STORAGE_BUFFER;case Yl.STORAGE_IMAGE:return h1.STORAGE_IMAGE;case Yl.INPUT_ATTACHMENT:return h1.INPUT_ATTACHMENT;case Yl.UNKNOWN:default:return k("DescriptorTypeOrder not found"),h1.INPUT_ATTACHMENT}}function Y3(t,e){return t.locateChild(t.N,e||"default")}function K3(t,e,i){return t.locateChild(e,i)}function q3(t,e,i){return void 0===i?t.locateChild(e,"default"):"number"==typeof i?t.locateChild(e,i.toString()):t.locateChild(e,i)}var Q3,Z3,J3=new Map([["cc_lightPos",vv.LIGHTS_PER_PASS],["cc_lightColor",vv.LIGHTS_PER_PASS],["cc_lightSizeRangeAngle",vv.LIGHTS_PER_PASS],["cc_lightDir",vv.LIGHTS_PER_PASS],["cc_lightBoundingSizeVS",vv.LIGHTS_PER_PASS]]);function $3(t,e){var i=JSON.parse(t[0]),n=JSON.parse(e[0]);return 1e4*i.updateFrequency+1e3*i.parameterType+100*i.descriptorType+i.visibility-(1e4*n.updateFrequency+1e3*n.parameterType+100*n.descriptorType+n.visibility)}function t4(t,e){var i=t.attributeIndex.get(e);if(void 0===i){var n=t.valueNames.length;return t.attributeIndex.set(e,n),t.valueNames.push(e),n}return i}function e4(t,e){for(var i=0;i<t.descriptorBlocks.length;++i)for(var n=t.descriptorBlocks[i],r=n.offset,s=0;s<n.descriptors.length;++s){var o=n.descriptors[s],a=new Y_;a.binding=r,a.descriptorType=X3(n.type),a.count=o.count,a.stageFlags=n.visibility,a.immutableSamplers=[],e.bindings.push(a),r+=o.count}}function i4(t,e){var i=new K_;return e4(e,i),t?t.createDescriptorSetLayout(i):null}function n4(t,e){var i=JSON.stringify(e),n=t.get(i);if(n)return n;var r=new x2(e.descriptorType,e.visibility,0);return t.set(i,r),r}function r4(t,e,i,n){for(var r=new Map,s=new Map,o=0;o<n.blocks.length;o++){var a=n.blocks[o],h=n4(r,{updateFrequency:e,parameterType:i1.TABLE,descriptorType:h1.UNIFORM_BUFFER,visibility:a.stageFlags}),u=t4(t,a.name);h.descriptors.push(new I2(u,ml.UNKNOWN,1)),s.set(u,new w_(i,4294967295,a.name,a.members,1))}for(var c=0;c<n.samplerTextures.length;c++){var l=n.samplerTextures[c],_=n4(r,{updateFrequency:e,parameterType:i1.TABLE,descriptorType:h1.SAMPLER_TEXTURE,visibility:l.stageFlags}),f=t4(t,l.name);_.descriptors.push(new I2(f,l.type,l.count))}for(var p=0;p<n.samplers.length;p++){var g=n.samplers[p],m=n4(r,{updateFrequency:e,parameterType:i1.TABLE,descriptorType:h1.SAMPLER,visibility:g.stageFlags}),v=t4(t,g.name);m.descriptors.push(new I2(v,ml.SAMPLER,g.count))}for(var y=0;y<n.textures.length;y++){var T=n.textures[y],E=n4(r,{updateFrequency:e,parameterType:i1.TABLE,descriptorType:h1.TEXTURE,visibility:T.stageFlags}),S=t4(t,T.name);E.descriptors.push(new I2(S,T.type,T.count))}for(var A=0;A<n.buffers.length;A++){var b=n.buffers[A],C=n4(r,{updateFrequency:e,parameterType:i1.TABLE,descriptorType:h1.STORAGE_BUFFER,visibility:b.stageFlags}),R=t4(t,b.name);C.descriptors.push(new I2(R,ml.UNKNOWN,1))}for(var w=0;w<n.images.length;w++){var I=n.images[w],x=n4(r,{updateFrequency:e,parameterType:i1.TABLE,descriptorType:h1.STORAGE_IMAGE,visibility:I.stageFlags}),D=t4(t,I.name);x.descriptors.push(new I2(D,I.type,I.count))}for(var O=0;O<n.subpassInputs.length;O++){var P=n.subpassInputs[O],M=n4(r,{updateFrequency:e,parameterType:i1.TABLE,descriptorType:h1.INPUT_ATTACHMENT,visibility:P.stageFlags}),N=t4(t,P.name);M.descriptors.push(new I2(N,ml.UNKNOWN,P.count))}for(var L,B=Array.from(r).sort($3),F=new D2(i,0),G=0,H=d(B);!(L=H()).done;){var z=L.value,V=z[0],W=z[1],X=JSON.parse(V);W.offset=G;for(var j,Y=d(W.descriptors);!(j=Y()).done;){var K=j.value;if(X.descriptorType===h1.UNIFORM_BUFFER){var q=s.get(K.descriptorID);if(!q){k("Uniform block not found for "+K.descriptorID);continue}U(4294967295===q.binding),q.binding=W.capacity,F.uniformBlocks.set(K.descriptorID,q)}void 0!==F.bindingMap.get(K.descriptorID)&&k("Duplicated descriptor "+K.descriptorID),F.bindingMap.set(K.descriptorID,W.offset+W.capacity),W.capacity+=K.count}G+=W.capacity,F.capacity+=W.capacity,X.descriptorType===h1.UNIFORM_BUFFER||X.descriptorType===h1.DYNAMIC_UNIFORM_BUFFER?F.uniformBlockCapacity+=W.capacity:X.descriptorType===h1.SAMPLER_TEXTURE&&(F.samplerTextureCapacity+=W.capacity),F.descriptorBlocks.push(W)}return F}function s4(t,e){for(var i=0;i<t.descriptorBlocks.length;++i)for(var n=t.descriptorBlocks[i],r=n.offset,s=0;s<n.descriptors.length;++s){var o=n.descriptors[s],a=new Y_;a.binding=r,a.descriptorType=X3(n.type),a.count=o.count,a.stageFlags=n.visibility,a.immutableSamplers=[],e.bindings.push(a),r+=o.count}}function o4(t,e,i){var n=t.descriptorSets.get(e);n&&n.descriptorSetLayout?i.setLayouts.push(n.descriptorSetLayout):i.setLayouts.push(Q3)}function a4(){return Q3}function h4(){return Z3}function u4(t,e,i,n){if(n<W0.PER_PASS){var r=t.getLayout(i).descriptorSets.get(n);return r?r.descriptorSetLayout?r.descriptorSetLayout:(k("descriptor set layout not initialized"),Q3):Q3}U(n===W0.PER_PASS),U(e===t.getParent(i));var s=t.getLayout(e).descriptorSets.get(n);return s?s.descriptorSetLayout?s.descriptorSetLayout:(k("descriptor set layout not initialized"),Q3):Q3}function c4(t,e,i,n){if(n<W0.PER_PASS){var r=t.getLayout(i).descriptorSets.get(n);return r?r.descriptorSetLayout?r.descriptorSetLayout:(k("descriptor set layout not initialized"),null):null}U(n===W0.PER_PASS),U(e===t.getParent(i));var s=t.getLayout(e).descriptorSets.get(n);return s?s.descriptorSetLayout?s.descriptorSetLayout:(k("descriptor set layout not initialized"),null):null}var l4=function(){this.frustumCullingKeyRecycle=new Xs((function(){return new y4}),8),this.frustumCullingsRecycle=new Xs((function(){return new C4}),8),this.lightBoundsCullingRecycle=new Xs((function(){return new E4}),8),this.lightBoundsCullingResultRecycle=new Xs((function(){return new S4}),8),this.lightBoundsCullingKeyRecycle=new Xs((function(){return new T4}),8),this.renderQueueRecycle=new Xs((function(){return new V3}),8),this.renderQueueQueryRecycle=new Xs((function(){return new z3}),8)},_4=Rg.makeMaskExclude([Rg.BitMask.UI_2D,Rg.BitMask.UI_3D,Rg.BitMask.GIZMOS,Rg.BitMask.EDITOR,Rg.BitMask.SCENE_GIZMO,Rg.BitMask.PROFILER]),d4=new WeakMap,f4="",p4=0;function g4(t){return d4.has(t)||d4.set(t,++p4),d4.get(t)}function m4(t,e,i){void 0===i&&(i=-1),f4="";var n=t.camera,r=t.light.light,s=t.light.level,o=t.light.probe,a=t.shadingLight;return f4+=b3(n?g4(n):0),f4+=b3(o?g4(o):0),f4+=b3(-1===i&&r?g4(r):0),f4+=b3(-1!==i&&a?g4(a):0),f4+=b3(-1===i?s:0),f4+=b3(e?1:0),f4+=b3(i)}var v4,y4=function(){function t(t,e){void 0===t&&(t=null),void 0===e&&(e=!1),this.sceneData=null,this.castShadows=!1,this.sceneData=t,this.castShadows=e}return t.prototype.update=function(t,e){this.sceneData=t,this.castShadows=e},t}(),T4=function(){function t(t,e){void 0===t&&(t=null),void 0===e&&(e=-1),this.sceneData=null,this.frustumCullingID=-1,this.sceneData=t,this.frustumCullingID=e}return t.prototype.update=function(t,e){void 0===t&&(t=null),void 0===e&&(e=-1),this.sceneData=t,this.frustumCullingID=e},t}(),E4=function(){function t(){this.resultKeyIndex=new Map,this.resultIndex=new Map}return t.prototype.update=function(){this.resultIndex.clear(),this.resultKeyIndex.clear()},t}(),S4=function(){function t(){this.instances=new Array,this.lightByteOffset=4294967295}return t.prototype.update=function(){return this.instances.length=0,this.lightByteOffset=4294967295,this},t}();function A4(t,e,i){return t+"-"+e+"-"+i}function b4(t){var e=t.split("-");return[parseInt(e[0]),parseInt(e[1]),parseInt(e[2])]}var C4=function(){function t(){this.resultIndex=new Map,this.resultKeyIndex=new Map}return t.prototype.update=function(){this.resultIndex.clear(),this.resultKeyIndex.clear()},t}();function R4(t,e){return function(t,e){return t&&(e&t.layer)===t.layer}(t.node,e)||function(t,e){return!!(e&t.visFlags)}(t,e)}function w4(t){return C3((t.node.layer&_4)===t.node.layer||_4&t.visFlags)}var I4=new Xo;function x4(t,e,i){var n=t.worldBounds,r=v4.shadows;return i&&r.type===eS.Planar?(Xo.transform(I4,n,r.matLight),!ds.aabbFrustum(I4,e)):!ds.aabbFrustum(n,e)}function D4(t,e,i,n,r,s){var o,a,h=v4.skybox,u=h.model,c=e.visibility,l=e.clearFlag&nI;!n&&h&&h.enabled&&u&&l&&s.push(u);for(var _,f=d(t.models);!(_=f()).done;){var p=_.value;if(p.enabled&&p.node&&(!n||p.castShadow)&&!t.isCulledByLod(e,p)){var g=p.worldBounds;if(r)if(r.probeType===lI.CUBE){if(!R4(p,c))continue;if(g&&(o=g,a=r.boundingBox,!ds.aabbWithAABB(o,a)))continue;s.push(p)}else w4(p)&&s.push(p);else{if(!R4(p,c))continue;if(g&&x4(p,i,n))continue;s.push(p)}}}}var O4=new _n;function P4(t,e,i,n,r,s,o){var a=o.probeQueue;n&&a.addToProbeQueue(s,t);for(var h=s.subModels,u=h.length,c=v4.skybox.model,l=function(t,e){var i=0;return e.node&&(_n.subtract(O4,e.worldBounds?e.worldBounds.center:e.node.worldPosition,t.position),i=_n.dot(O4,t.forward)),i}(r,s),_=0;_<u;++_){var d=h[_],f=d.passes,p=f.length;a.probeMap.includes(d)&&(t=a.defaultId);for(var g=0;g<p;++g)if(s!==c||_||g||!e){var m=f[g];if(t===m.phaseID){var v=m.blendState.targets[0].blend;!i&&v||!e&&!v||(m.batchingScheme===PE.INSTANCING?v?o.transparentInstancingQueue.add(m,d,g):o.opaqueInstancingQueue.add(m,d,g):v?o.transparentQueue.add(s,l,_,g):o.opaqueQueue.add(s,l,_,g))}}else o.opaqueQueue.add(s,l,_,g)}}var M4,N4,L4,B4=new Xo(0,0,0,.5,.5,.5),F4=new Xo,k4=function(){function t(){this.frustumCullings=new Map,this.frustumCullingResults=new Array,this.lightBoundsCullings=new Map,this.lightBoundsCullingResults=new Array,this.renderQueueIndex=new Map,this.renderQueues=new Array,this.renderQueueQueryIndex=new Map,this.cullingPools=new l4,this.numFrustumCulling=0,this.numLightBoundsCulling=0,this.numRenderQueues=0,this.layoutGraph=void 0,this.renderGraph=void 0,this.enableLightCulling=!0,this.kFilterMask=e1.SHADOW_CASTER|e1.REFLECTION_PROBE,this.kDrawMask=e1.OPAQUE|e1.MASK|e1.BLEND,this.kAllMask=this.kFilterMask|this.kDrawMask}var e=t.prototype;return e.resetPool=function(){var t=this.cullingPools;t.frustumCullingKeyRecycle.reset(),t.frustumCullingsRecycle.reset(),t.lightBoundsCullingRecycle.reset(),t.lightBoundsCullingResultRecycle.reset(),t.lightBoundsCullingKeyRecycle.reset(),t.renderQueueRecycle.reset(),t.renderQueueQueryRecycle.reset(),M3.reset()},e.clear=function(){this.resetPool(),this.frustumCullings.clear(),this.frustumCullingResults.length=0,this.lightBoundsCullings.clear(),this.lightBoundsCullingResults.length=0,this.renderQueueIndex.clear(),this.renderQueues.length=0,this.renderQueueQueryIndex.clear(),this.numLightBoundsCulling=0,this.numFrustumCulling=0,this.numRenderQueues=0},e.buildRenderQueues=function(t,e,i){this.layoutGraph=e,this.renderGraph=t,v4=i,this.collectCullingQueries(t),this.batchFrustumCulling(i),this.batchLightBoundsCulling(),this.fillRenderQueues()},e.getOrCreateLightBoundsCulling=function(t,e){var i;if(!(4&t.cullingFlags))return 4294967295;if((null===(i=t.shadingLight)||void 0===i?void 0:i.type)===CI.DIRECTIONAL)return 4294967295;if(!this.enableLightCulling)return 4294967295;var n=t.scene,r=this.lightBoundsCullings.get(n);if(!r){var s=this.cullingPools.lightBoundsCullingRecycle.add();s.update(),this.lightBoundsCullings.set(n,s),r=this.lightBoundsCullings.get(n)}var o=m4(t,!1,e),a=r.resultIndex.get(o);if(void 0!==a)return a;var h=this.numLightBoundsCulling++;this.numLightBoundsCulling>this.lightBoundsCullingResults.length&&this.lightBoundsCullingResults.push(this.cullingPools.lightBoundsCullingResultRecycle.add().update()),r.resultIndex.set(o,h);var u=this.cullingPools.lightBoundsCullingKeyRecycle.add();return u.update(t,e),r.resultKeyIndex.set(o,u),h},e.getOrCreateFrustumCulling=function(t){var e=this.renderGraph.j(t),i=e.scene,n=this.frustumCullings.get(i);if(!n){var r=this.cullingPools.frustumCullingsRecycle.add();r.update(),this.frustumCullings.set(i,r),n=this.frustumCullings.get(i)}var s=C3(e.flags&e1.SHADOW_CASTER),o=m4(e,s),a=n.resultIndex.get(o);if(void 0!==a)return a;var h=this.numFrustumCulling++;this.numFrustumCulling>this.frustumCullingResults.length&&this.frustumCullingResults.push([]),n.resultIndex.set(o,h);var u=this.cullingPools.frustumCullingKeyRecycle.add();return u.update(e,s),n.resultKeyIndex.set(o,u),h},e.getOrCreateRenderQueue=function(t,e,i){var n=this.renderQueueIndex.get(t);if(void 0!==n)return this.renderQueues[n].sceneFlags|=e&this.kDrawMask,n;var r=this.numRenderQueues++;if(this.numRenderQueues>this.renderQueues.length){var s=this.cullingPools.renderQueueRecycle.add();s.update(),this.renderQueues.push(s)}var o=this.renderQueues[r];return this.renderQueueIndex.set(t,r),o.camera=i,o.sceneFlags=e&this.kAllMask,r},e.collectCullingQueries=function(t){for(var e,i=d(t.v());!(e=i()).done;){var n=e.value;if(t.h(9,n)&&t.getValid(n)){var r=t.j(n);if(r.scene){var s=this.getOrCreateFrustumCulling(n),o=this.getOrCreateLightBoundsCulling(r,s),a=t.getParent(n),h=A4(s,o,t.j(a).phaseID),u=this.getOrCreateRenderQueue(h,r.flags,r.camera),c=this.cullingPools.renderQueueQueryRecycle.add();c.update(s,o,u),this.renderQueueQueryIndex.set(n,c)}}}},e.uploadInstancing=function(t){for(var e=0;e!==this.numRenderQueues;++e){var i=this.renderQueues[e];i.opaqueInstancingQueue.uploadBuffers(t),i.transparentInstancingQueue.uploadBuffers(t)}},e._getPhaseIdFromScene=function(t){var e=this.renderGraph,i=e.getParent(t);return e.j(i).phaseID},e.getBuiltinShadowFrustum=function(t,e,i,n){var r=t.csmLayers,s=i.csmLevel,o=t.shadows;return o.type===eS.Planar?e.frustum:(o.enabled&&o.type===eS.ShadowMap&&i&&i.node&&r.update(t,e),i.shadowFixedArea||s===nS.LEVEL_1?r.specialLayer.validFrustum:r.layers[n].validFrustum)},e.batchFrustumCulling=function(t){for(var e,i=d(this.frustumCullings);!(e=i()).done;)for(var n,r=e.value,s=r[0],o=r[1],a=d(o.resultIndex);!(n=a()).done;){var h=n.value,u=h[0],c=h[1],l=o.resultKeyIndex.get(u),_=l.sceneData,f=_.light.light,p=_.light.level,g=l.castShadows,m=_.light.probe,v=m?m.camera:_.camera,y=this.frustumCullingResults[c];if(m)D4(s,v,v.frustum,g,m,y);else if(f)switch(f.type){case CI.SPOT:D4(s,v,f.frustum,g,null,y);break;case CI.DIRECTIONAL:D4(s,v,this.getBuiltinShadowFrustum(t,v,f,p),g,null,y)}else D4(s,v,v.frustum,g,null,y)}},e.executeSphereLightCulling=function(t,e,i){for(var n,r=t.aabb,s=d(e);!(n=s()).done;){var o=n.value,a=o.worldBounds;a&&!ds.aabbWithAABB(a,r)||i.push(o)}},e.executeSpotLightCulling=function(t,e,i){for(var n,r=t.aabb,s=t.frustum,o=d(e);!(n=o()).done;){var a=n.value,h=a.worldBounds;(!h||ds.aabbWithAABB(r,h)&&ds.aabbFrustum(h,s))&&i.push(a)}},e.executePointLightCulling=function(t,e,i){for(var n,r=t.aabb,s=d(e);!(n=s()).done;){var o=n.value,a=o.worldBounds;a&&!ds.aabbWithAABB(r,a)||i.push(o)}},e.executeRangedDirectionalLightCulling=function(t,e,i){B4.transform(t.node.worldMatrix,null,null,null,F4);for(var n,r=d(e);!(n=r()).done;){var s=n.value,o=s.worldBounds;o&&!ds.aabbWithAABB(F4,o)||i.push(s)}},e.batchLightBoundsCulling=function(){for(var t,e=d(this.lightBoundsCullings);!(t=e()).done;){var i=t.value;i[0];for(var n,r=i[1],s=d(r.resultIndex);!(n=s()).done;){var o=n.value,a=o[0],h=o[1],u=r.resultKeyIndex.get(a),c=u.sceneData,l=u.frustumCullingID,_=this.frustumCullingResults[l],f=this.lightBoundsCullingResults[h];switch(c.shadingLight.type){case CI.SPHERE:var p=c.shadingLight;this.executeSphereLightCulling(p,_,f.instances);break;case CI.SPOT:var g=c.shadingLight;this.executeSpotLightCulling(g,_,f.instances);break;case CI.POINT:var m=c.shadingLight;this.executePointLightCulling(m,_,f.instances);break;case CI.RANGED_DIRECTIONAL:var v=c.shadingLight;this.executeRangedDirectionalLightCulling(v,_,f.instances);break;case CI.DIRECTIONAL:case CI.UNKNOWN:}}}},e._getModelsByCullingResults=function(t,e){return 4294967295!==t?t<this.lightBoundsCullingResults.length?this.lightBoundsCullingResults[t].instances:[]:e<this.frustumCullingResults.length?this.frustumCullingResults[e]:[]},e.fillRenderQueues=function(){for(var t,e=d(this.renderQueueIndex);!(t=e()).done;){var i=t.value,n=i[0],r=i[1],s=this.renderQueues[r],o=b4(n),a=o[0],h=o[1],u=o[2],c=C3(s.sceneFlags&e1.BLEND),l=C3(s.sceneFlags&(e1.OPAQUE|e1.MASK)),_=C3(s.sceneFlags&e1.SHADOW_CASTER),f=C3(s.sceneFlags&e1.REFLECTION_PROBE);if(_||c||l||f){for(var p,g=this._getModelsByCullingResults(h,a),m=s.camera,v=d(g);!(p=v()).done;)P4(u,l,c,f,m,p.value,s);s.sort()}}},t}(),U4=function(){function t(){this.cpuBuffer=void 0,this.programLibrary=void 0,this.device=null,this.elementSize=0,this.maxNumLights=16,this.binding=4294967295,this.resized=!1,this.lightBuffer=void 0,this.firstLightBufferView=null,this.lights=[],this.lightIndex=new Map}var e=t.prototype;return e.init=function(t,e,i){this.device=e,this.programLibrary=t;var n=this.programLibrary.localLayoutData,r=t.layoutGraph.attributeIndex.get("CCForwardLight"),s=n.uniformBlocks.get(r);this.elementSize=function(t,e){return t+(e-1)&~(e-1)}(function(t){for(var e,i=0,n=d(t);!(e=n()).done;){var r=e.value;if(r.count)i+=fd(r.type)*r.count;else{var s=J3.get(r.name);if(void 0===s)if("cc_joints"!==r.name)k("Invalid uniform count: "+r.name);else{var o=fd(r.type)*Av.LAYOUT.members[0].count;U(o!==Av.SIZE),i+=o}else i+=fd(r.type)*s}}return U(!!i),i}(s.members),this.device.capabilities.uboOffsetAlignment),this.maxNumLights=i,this.binding=t.localLayoutData.bindingMap.get(r);var o=this.elementSize*this.maxNumLights;this.lightBuffer=this.device.createBuffer(new v_(vl.UNIFORM|vl.TRANSFER_DST,El.HOST|El.DEVICE,o,this.elementSize)),this.firstLightBufferView=this.device.createBuffer(new y_(this.lightBuffer,0,this.elementSize)),this.cpuBuffer=new Float32Array(o/Float32Array.BYTES_PER_ELEMENT),this.resized=!0},e.buildLights=function(t,e,i){for(var n,r=d(t.lightBoundsCullings);!(n=r()).done;){var s=n.value;s[0];for(var o,a=s[1],h=d(a.resultIndex);!(o=h()).done;){var u=o.value,c=u[0],l=u[1],_=a.resultKeyIndex.get(c).sceneData,f=1;if(_.camera)f=_.camera.exposure;else{if(!_.light.probe||!_.light.probe.camera)throw new Error("Unexpected situation: No camera or probe found.");f=_.light.probe.camera.exposure}var p=this.addLight(_.shadingLight,e,f,i);t.lightBoundsCullingResults[l].lightByteOffset=p}}for(var g,m=d(t.renderQueueQueryIndex);!(g=m()).done;){var v=g.value;v[0];var y=v[1];if(4294967295!==y.lightBoundsCulledResultID){var T=t.lightBoundsCullingResults[y.lightBoundsCulledResultID].lightByteOffset;t.renderQueues[y.renderQueueTarget].lightByteOffset=T}}},e.tryUpdateRenderSceneLocalDescriptorSet=function(t){if(t.lightBoundsCullings.size){for(var e,i=d(t.frustumCullings);!(e=i()).done;){var n=e.value,r=n[0];n[1];for(var s,o=d(r.models);!(s=o()).done;){var a=s.value;if(!a)throw new Error("Unexpected null model.");for(var h,u=d(a.subModels);!(h=u()).done;){var c=h.value.descriptorSet,l=c.getBuffer(this.binding);(this.resized||l!==this.firstLightBufferView)&&(c.bindBuffer(this.binding,this.firstLightBufferView),c.update())}}}this.resized=!1}},e.clear=function(){this.cpuBuffer.fill(0),this.lights.length=0,this.lightIndex.clear()},e.addLight=function(t,e,i,n){var r=this.lightIndex.get(t);if(void 0!==r)return r;if(this.lights.length===this.maxNumLights){this.resized=!0,this.maxNumLights*=2;var s=this.elementSize*this.maxNumLights;this.lightBuffer.resize(s),this.firstLightBufferView=this.device.createBuffer(new y_(this.lightBuffer,0,this.elementSize));var o=this.cpuBuffer;this.cpuBuffer=new Float32Array(s/Float32Array.BYTES_PER_ELEMENT),this.cpuBuffer.set(o)}var a=this.lights.length;this.lights[a]=t,this.lightIndex.set(t,a);var h=this.elementSize/Float32Array.BYTES_PER_ELEMENT*a;return function(t,e,i,n,r,s){var o=new Float32Array(4),a=0,h=0,u=0,c=0;if(t&&t.type===CI.SPHERE){var l=t;o[0]=l.position.x,o[1]=l.position.y,o[2]=l.position.z,o[3]=CI.SPHERE,a=l.size,h=l.range,u=l.luminanceHDR,c=l.luminanceLDR}else if(t&&t.type===CI.SPOT){var _=t;o[0]=_.position.x,o[1]=_.position.y,o[2]=_.position.z,o[3]=CI.SPOT,a=_.size,h=_.range,u=_.luminanceHDR,c=_.luminanceLDR}else if(t&&t.type===CI.POINT){var d=t;o[0]=d.position.x,o[1]=d.position.y,o[2]=d.position.z,o[3]=CI.POINT,a=0,h=d.range,u=d.luminanceHDR,c=d.luminanceLDR}else if(t&&t.type===CI.RANGED_DIRECTIONAL){var f=t;o[0]=f.position.x,o[1]=f.position.y,o[2]=f.position.z,o[3]=CI.RANGED_DIRECTIONAL,a=0,h=0,u=f.illuminanceHDR,c=f.illuminanceLDR}var p=s+vv.LIGHT_POS_OFFSET;r.set(o,p),p=s+vv.LIGHT_SIZE_RANGE_ANGLE_OFFSET,o.set([a,h,0,0]),r.set(o,p),p=s+vv.LIGHT_COLOR_OFFSET;var g=t?t.color:new f_;if(t&&t.useColorTemperature){var m=t.colorTemperatureRGB;r[p++]=g.x*m.x,r[p++]=g.y*m.y,r[p++]=g.z*m.z}else r[p++]=g.x,r[p++]=g.y,r[p++]=g.z;switch(r[p]=e?u*i*1e4:c,t?t.type:CI.UNKNOWN){case CI.SPHERE:r[s+vv.LIGHT_SIZE_RANGE_ANGLE_OFFSET+2]=0,r[s+vv.LIGHT_SIZE_RANGE_ANGLE_OFFSET+3]=0;break;case CI.SPOT:var v=t;r[s+vv.LIGHT_SIZE_RANGE_ANGLE_OFFSET+2]=v.spotAngle,r[s+vv.LIGHT_SIZE_RANGE_ANGLE_OFFSET+3]=n&&n.enabled&&v.shadowEnabled&&n.type===eS.ShadowMap?1:0,p=s+vv.LIGHT_DIR_OFFSET;var y=v.direction;r[p++]=y.x,r[p++]=y.y,r[p]=y.z,r[s+vv.LIGHT_BOUNDING_SIZE_VS_OFFSET+0]=0,r[s+vv.LIGHT_BOUNDING_SIZE_VS_OFFSET+1]=0,r[s+vv.LIGHT_BOUNDING_SIZE_VS_OFFSET+2]=0,r[s+vv.LIGHT_BOUNDING_SIZE_VS_OFFSET+3]=v.angleAttenuationStrength;break;case CI.POINT:r[s+vv.LIGHT_SIZE_RANGE_ANGLE_OFFSET+2]=0,r[s+vv.LIGHT_SIZE_RANGE_ANGLE_OFFSET+3]=0;break;case CI.RANGED_DIRECTIONAL:var T=t,E=T.right;r[s+vv.LIGHT_SIZE_RANGE_ANGLE_OFFSET+0]=E.x,r[s+vv.LIGHT_SIZE_RANGE_ANGLE_OFFSET+1]=E.y,r[s+vv.LIGHT_SIZE_RANGE_ANGLE_OFFSET+2]=E.z,r[s+vv.LIGHT_SIZE_RANGE_ANGLE_OFFSET+3]=0;var S=T.direction;r[s+vv.LIGHT_DIR_OFFSET+0]=S.x,r[s+vv.LIGHT_DIR_OFFSET+1]=S.y,r[s+vv.LIGHT_DIR_OFFSET+2]=S.z,r[s+vv.LIGHT_DIR_OFFSET+3]=0;var A=T.scale;r[s+vv.LIGHT_BOUNDING_SIZE_VS_OFFSET+0]=.5*A.x,r[s+vv.LIGHT_BOUNDING_SIZE_VS_OFFSET+1]=.5*A.y,r[s+vv.LIGHT_BOUNDING_SIZE_VS_OFFSET+2]=.5*A.z,r[s+vv.LIGHT_BOUNDING_SIZE_VS_OFFSET+3]=0}}(t,e,i,n,this.cpuBuffer,h,this.elementSize),a*this.elementSize},e.buildLightBuffer=function(t){t.updateBuffer(this.lightBuffer,this.cpuBuffer,this.lights.length*this.elementSize/Float32Array.BYTES_PER_ELEMENT)},t}(),G4=function(){function t(t){void 0===t&&(t=""),this.name=void 0,this.name=t,M4&&M4.pipeline.resourceUses.push(t)}var e=t.prototype;return e.checkTexture=function(t){var e=M4.deviceTextures.get(t),i=M4.resourceGraph.vertex(this.name),n=M4.resourceGraph.getDesc(i),r=!1;return e.texture?r=e.texture.width===n.width&&e.texture.height===n.height:e.swapchain&&(r=e.swapchain.width===n.width&&e.swapchain.height===n.height),r},e.createDeviceTex=function(t){if(M4.deviceTextures.get(this.name)){if(!this.checkTexture(this.name)){var e;null===(e=M4.deviceTextures.get(this.name).texture)||void 0===e||e.destroy();var i=new z4(this.name,t);M4.deviceTextures.set(this.name,i)}}else{var n=new z4(this.name,t);M4.deviceTextures.set(this.name,n)}},e.checkBuffer=function(t){var e=M4.deviceBuffers.get(t),i=M4.resourceGraph.vertex(this.name),n=M4.resourceGraph.getDesc(i);return e.buffer.size>=n.width},e.createDeviceBuf=function(t){if(M4.deviceBuffers.get(this.name)){if(!this.checkBuffer(this.name)){var e;null===(e=M4.deviceBuffers.get(this.name).buffer)||void 0===e||e.destroy();var i=new V4(this.name,t);M4.deviceBuffers.set(this.name,i)}}else{var n=new V4(this.name,t);M4.deviceBuffers.set(this.name,n)}},e.managed=function(t){this.createDeviceTex(t)},e.managedBuffer=function(t){this.createDeviceBuf(t)},e.managedTexture=function(){},e.persistentBuffer=function(t){this.createDeviceBuf(t)},e.persistentTexture=function(t){this.createDeviceTex(t)},e.framebuffer=function(t){this.createDeviceTex(t)},e.swapchain=function(t){this.createDeviceTex(t)},e.formatView=function(){},e.subresourceView=function(){},n(t,[{key:"resName",set:function(t){this.name=t}}]),t}(),H4=function(){function t(t){this._name=void 0,this._name=t}return n(t,[{key:"name",get:function(){return this._name}}]),t}(),z4=function(t){function e(e,i){var n;(n=t.call(this,e)||this)._texture=null,n._swapchain=null,n._framebuffer=null,n._desc=null,n._trait=null;var r=M4.resourceGraph,s=r.vertex(e);if(n._desc=r.getDesc(s),n._trait=r.getTraits(s),i instanceof Ud)return n._texture=i,l(n);if(i instanceof bd)return n._framebuffer=i,l(n);if(i instanceof X1)return n._swapchain=i.swapchain,l(n);var o=n._desc,a=Sl.TEX2D;switch(o.dimension){case $0.TEXTURE1D:a=Sl.TEX1D;break;case $0.TEXTURE2D:a=Sl.TEX2D;break;case $0.TEXTURE3D:a=Sl.TEX3D}var h=Al.NONE;return o.flags&t1.COLOR_ATTACHMENT&&(h|=Al.COLOR_ATTACHMENT),o.flags&t1.DEPTH_STENCIL_ATTACHMENT&&(h|=Al.DEPTH_STENCIL_ATTACHMENT),o.flags&t1.INPUT_ATTACHMENT&&(h|=Al.INPUT_ATTACHMENT),o.flags&t1.SAMPLED&&(h|=Al.SAMPLED),o.flags&t1.STORAGE&&(h|=Al.STORAGE),o.flags&t1.TRANSFER_SRC&&(h|=Al.TRANSFER_SRC),o.flags&t1.TRANSFER_DST&&(h|=Al.TRANSFER_DST),n._texture=M4.device.createTexture(new A_(a,h,o.format,o.width,o.height)),n}return s(e,t),e.prototype.release=function(){this.framebuffer&&(this.framebuffer.destroy(),this._framebuffer=null),this.texture&&(this.texture.destroy(),this._texture=null)},n(e,[{key:"texture",get:function(){return this._texture}},{key:"framebuffer",get:function(){return this._framebuffer},set:function(t){this._framebuffer=t}},{key:"description",get:function(){return this._desc}},{key:"trait",get:function(){return this._trait}},{key:"swapchain",get:function(){return this._swapchain}}]),e}(H4),V4=function(t){function e(e){var i;(i=t.call(this,e)||this)._buffer=void 0;var n=M4.resourceGraph,r=n.vertex(e),s=n.getDesc(r),o=new v_;return o.size=s.width,o.memUsage=El.DEVICE,s.flags&t1.INDIRECT&&(o.usage|=vl.INDIRECT),s.flags&t1.UNIFORM&&(o.usage|=vl.UNIFORM),s.flags&t1.STORAGE&&(o.usage|=vl.STORAGE),s.flags&t1.TRANSFER_SRC&&(o.usage|=vl.TRANSFER_SRC),s.flags&t1.TRANSFER_DST&&(o.usage|=vl.TRANSFER_DST),i._buffer=M4.device.createBuffer(o),i}return s(e,t),e.prototype.release=function(){this._buffer&&(this._buffer.destroy(),this._buffer=null)},n(e,[{key:"buffer",get:function(){return this._buffer}}]),e}(H4),W4=new Float32Array(4),X4=function(){function t(t,e){this._isUpdate=!1,this._isGatherLight=!1,this._blit=void 0,this._screenQuad=null,this._queue=null,this._stageDesc=void 0,this._lightVolumeBuffer=null,this._lightMeterScale=1e4,this._lightBufferData=void 0,this._blit=t,this._queue=e}var e=t.prototype;return e._createQuadInputAssembler=function(){return M4.blit.pipelineIAData},e.createScreenQuad=function(){this._screenQuad||(this._screenQuad=this._createQuadInputAssembler())},e._gatherVolumeLights=function(t){if(t.scene){for(var e=M4.pipeline,i=M4.commandBuffer,n=t.scene.sphereLights,r=t.scene.spotLights,s=Ar.create(0,0,0,1),o=t.exposure,a=0,h=yv.LIGHTS_PER_PASS,u=on.length,c=u*h,l=0;l<n.length&&a<h;l++,++a){var _=n[l];if(Ar.set(s,_.position.x,_.position.y,_.position.z,_.range),ds.sphereFrustum(s,t.frustum)){if(_n.toArray(W4,_.position),W4[3]=0,this._lightBufferData.set(W4,a*u),_n.toArray(W4,_.color),_.useColorTemperature){var d=_.colorTemperatureRGB;W4[0]*=d.x,W4[1]*=d.y,W4[2]*=d.z}e.pipelineSceneData.isHDR?W4[3]=_.luminance*o*this._lightMeterScale:W4[3]=_.luminance,this._lightBufferData.set(W4,a*u+1*c),W4[0]=_.size,W4[1]=_.range,W4[2]=0,this._lightBufferData.set(W4,a*u+2*c)}}for(var f=0;f<r.length&&a<h;f++,++a){var p=r[f];if(Ar.set(s,p.position.x,p.position.y,p.position.z,p.range),ds.sphereFrustum(s,t.frustum)){if(_n.toArray(W4,p.position),W4[3]=1,this._lightBufferData.set(W4,a*u+0*c),_n.toArray(W4,p.color),p.useColorTemperature){var g=p.colorTemperatureRGB;W4[0]*=g.x,W4[1]*=g.y,W4[2]*=g.z}e.pipelineSceneData.isHDR?W4[3]=p.luminance*o*this._lightMeterScale:W4[3]=p.luminance,this._lightBufferData.set(W4,a*u+1*c),W4[0]=p.size,W4[1]=p.range,W4[2]=p.spotAngle,this._lightBufferData.set(W4,a*u+2*c),_n.toArray(W4,p.direction),this._lightBufferData.set(W4,a*u+3*c)}}var m=3*c+3;this._lightBufferData.set([a],m),i.updateBuffer(this._lightVolumeBuffer,this._lightBufferData)}},e.update=function(){this.blit.sceneFlags&e1.VOLUMETRIC_LIGHTING&&this.blit.camera&&!this._isGatherLight&&(this._gatherVolumeLights(this.blit.camera),this._isGatherLight=!0,this._isUpdate=!1),this._isUpdate||(this._stageDesc.update(),this._isUpdate=!0)},e.reset=function(){this._isUpdate=!1,this._isGatherLight=!1},e.createStageDescriptor=function(){var t=this.blit,e=t.material.passes[t.passID],i=M4.device;if(this._stageDesc=M4.blit.stageDescs.get(e),this._stageDesc||(this._stageDesc=i.createDescriptorSet(new q_(e.localSetLayout)),M4.blit.stageDescs.set(e,this._stageDesc)),this.blit.sceneFlags&e1.VOLUMETRIC_LIGHTING){this._lightVolumeBuffer=M4.blit.lightVolumeBuffer;var n=M4.blit.deferredLitsBufView;this._lightBufferData=M4.blit.lightBufferData,this._lightBufferData.fill(0),this._stageDesc.bindBuffer(vv.BINDING,n)}this._stageDesc.bindBuffer(dv.BINDING,M4.blit.emptyLocalUBO)},n(t,[{key:"screenQuad",get:function(){return this._screenQuad}},{key:"blit",get:function(){return this._blit},set:function(t){this._blit=t}},{key:"stageDesc",get:function(){return this._stageDesc}}]),t}(),j4=function(){function t(){this._devicePass=void 0,this._hint=J0.NONE,this._phaseID=LE("default"),this._renderPhase=null,this._descSetData=null,this._layoutID=-1,this._isUpdateUBO=!1,this._isUploadInstance=!1,this._isUploadBatched=!1,this._queueId=-1}var e=t.prototype;return e.preRecord=function(){},e.postRecord=function(){},e.init=function(t,e,i){this.reset(),this.queueHint=e.hint,this.queueId=i,this._devicePass=t,this._phaseID=m.rendering.getPhaseID(t.passID,M4.renderGraph.getLayout(i))},e.reset=function(){this._isUpdateUBO=!1,this._isUploadInstance=!1,this._isUploadBatched=!1},e.record=function(){this._descSetData&&this._descSetData.descriptorSet&&M4.commandBuffer.bindDescriptorSet(jm.COUNT,this._descSetData.descriptorSet)},n(t,[{key:"phaseID",get:function(){return this._phaseID}},{key:"layoutID",get:function(){return this._layoutID},set:function(t){this._layoutID=t;var e=M4.layoutGraph;this._renderPhase=e.h(1,t)?e.j(t):null;var i=e.getLayout(t);this._descSetData=i.descriptorSets.get(W0.PER_PHASE)}},{key:"descSetData",get:function(){return this._descSetData}},{key:"renderPhase",get:function(){return this._renderPhase}},{key:"queueId",get:function(){return this._queueId},set:function(t){this._queueId=t}},{key:"isUpdateUBO",get:function(){return this._isUpdateUBO},set:function(t){this._isUpdateUBO=t}},{key:"isUploadInstance",get:function(){return this._isUploadInstance},set:function(t){this._isUploadInstance=t}},{key:"isUploadBatched",get:function(){return this._isUploadBatched},set:function(t){this._isUploadBatched=t}},{key:"queueHint",get:function(){return this._hint},set:function(t){this._hint=t}},{key:"devicePass",get:function(){return this._devicePass}}]),t}(),Y4=function(){function t(){this._renderScenes=[],this._devicePass=void 0,this._hint=J0.NONE,this._graphQueue=void 0,this._phaseID=LE("default"),this._renderPhase=null,this._descSetData=null,this._viewport=null,this._scissor=null,this._layoutID=-1,this._isUpdateUBO=!1,this._isUploadInstance=!1,this._isUploadBatched=!1,this._blitDesc=null,this._queueId=-1}var e=t.prototype;return e.init=function(t,e,i){this.reset(),this._graphQueue=e,this.queueHint=e.hint;var n=this._viewport=e.viewport;n&&(this._scissor=new o_(n.left,n.top,n.width,n.height)),this.queueId=i,this._devicePass=t,this._phaseID=m.rendering.getPhaseID(t.passID,M4.renderGraph.getLayout(i))},e.createBlitDesc=function(t){this._blitDesc||(this._blitDesc=new X4(t,this)),this._blitDesc.createScreenQuad(),this._blitDesc.createStageDescriptor()},e.setScene=function(t,e,i){var n=M4.pools.addDeviceScene();return n.init(this,t,e,i),this._renderScenes.push(n),n},e.reset=function(){var t;this._renderScenes.length=0,this._isUpdateUBO=!1,this._isUploadInstance=!1,this._isUploadBatched=!1,null===(t=this._blitDesc)||void 0===t||t.reset()},e.preRecord=function(){},e.record=function(){this._descSetData&&this._descSetData.descriptorSet&&M4.commandBuffer.bindDescriptorSet(jm.COUNT,this._descSetData.descriptorSet),this._renderScenes.forEach((function(t){t.record()}))},e.postRecord=function(){},n(t,[{key:"phaseID",get:function(){return this._phaseID}},{key:"layoutID",get:function(){return this._layoutID},set:function(t){this._layoutID=t;var e=M4.layoutGraph;this._renderPhase=e.h(1,t)?e.j(t):null;var i=e.getLayout(t);this._descSetData=i.descriptorSets.get(W0.PER_PHASE)}},{key:"descSetData",get:function(){return this._descSetData}},{key:"renderPhase",get:function(){return this._renderPhase}},{key:"viewport",get:function(){return this._viewport}},{key:"scissor",get:function(){return this._scissor}},{key:"queueId",get:function(){return this._queueId},set:function(t){this._queueId=t}},{key:"isUpdateUBO",get:function(){return this._isUpdateUBO},set:function(t){this._isUpdateUBO=t}},{key:"isUploadInstance",get:function(){return this._isUploadInstance},set:function(t){this._isUploadInstance=t}},{key:"isUploadBatched",get:function(){return this._isUploadBatched},set:function(t){this._isUploadBatched=t}},{key:"graphQueue",get:function(){return this._graphQueue}},{key:"blitDesc",get:function(){return this._blitDesc}},{key:"renderScenes",get:function(){return this._renderScenes}},{key:"queueHint",get:function(){return this._hint},set:function(t){this._hint=t}},{key:"devicePass",get:function(){return this._devicePass}}]),t}(),K4=function(){function t(t,e,i){this._layoutID=0,this._vertID=-1,this._stage=null,this._layout=void 0,this._inputName=void 0,this._descriptorSet=null,this._inputName=i[0],this._layoutID=t,this._vertID=e;var n=M4.layoutGraph;this._stage=n.j(t),this._layout=n.getLayout(t);var r=this._layout.descriptorSets.get(W0.PER_PASS);if(r){var s=r.descriptorSet,o=M4.deviceTextures.get(this._inputName),a=null==o?void 0:o.texture,h=M4.deviceBuffers.get(this._inputName),u=null==h?void 0:h.buffer;if(!a&&!u)throw Error("Could not find texture with resource name "+this._inputName);for(var c,l=M4.resourceGraph.vertex(this._inputName),_=M4.resourceGraph.getSampler(l),f=d(i[1]);!(c=f()).done;)for(var p,g=c.value.name,m=n.attributeIndex.get(g),v=d(r.descriptorSetLayoutData.descriptorBlocks);!(p=v()).done;)for(var y=p.value,T=0;T!==y.descriptors.length;++T)if(m!==y.descriptors[T].descriptorID);else{if(a){s.bindTexture(y.offset+T,a);var E=M4.renderGraph.getData(this._vertID);s.bindSampler(y.offset+T,E.samplers.get(m)||M4.device.getSampler(_))}else if(M4.resourceGraph.getDesc(l).flags&t1.STORAGE){var S=i[1][0].accessType!==n1.READ?kl.COMPUTE_SHADER_WRITE:kl.COMPUTE_SHADER_READ_OTHER;s.bindBuffer(y.offset+T,u,0,S)}else s.bindBuffer(y.offset+T,u);this._descriptorSet||(this._descriptorSet=s)}}}return n(t,[{key:"descriptorSet",get:function(){return this._descriptorSet}},{key:"layoutID",get:function(){return this._layoutID}},{key:"vertID",get:function(){return this._vertID}},{key:"stage",get:function(){return this._stage}},{key:"layout",get:function(){return this._layout}}]),t}(),q4=new d_,Q4=new o_,Z4=new G4,J4=function(){function t(t,e){this._renderPass=void 0,this._framebuffer=void 0,this._clearColor=[],this._deviceQueues=new Map,this._clearDepth=1,this._clearStencil=0,this._passID=void 0,this._rasterID=void 0,this._rasterPass=void 0,this._layoutName=void 0,this._viewport=null,this._layout=null,this._idxOfRenderData=0,this._rasterID=t,this._rasterPass=e;var i=M4.device;this._layoutName=M4.renderGraph.getLayout(t),this._passID=m.rendering.getPassID(this._layoutName);var n=new U_;n.format=pl.DEPTH_STENCIL;for(var r,s=[],o=[],a=null,h=null,u=null,c=d(e.computeViews);!(r=c()).done;){var l=r.value;this._applyRenderLayout(l)}this.renderLayout&&this.renderLayout.descriptorSet&&this.renderLayout.descriptorSet.update();for(var _,f=d(e.rasterViews);!(_=f()).done;){var p=_.value,g=p[0],v=p[1],y=M4.deviceTextures.get(g);if(y){var T=M4.resourceGraph,E=T.vertex(g),S=T.object(E);if(y.framebuffer&&S instanceof bd&&y.framebuffer!==S)y.framebuffer=S;else if(y.texture){var A=T.getDesc(E);y.texture.width===A.width&&y.texture.height===A.height||y.texture.resize(A.width,A.height)}}else this.visitResource(g),y=M4.deviceTextures.get(g);switch(h||(h=y.swapchain),u||(u=y.framebuffer),v.attachmentType){case s1.RENDER_TARGET:y.swapchain||y.framebuffer||o.push(y.texture);var b=new k_;b.format=y.description.format,b.sampleCount=y.description.sampleCount,b.loadOp=v.loadOp,b.storeOp=v.storeOp,b.barrier=i.getGeneralBarrier(new V_(v.loadOp===Bl.LOAD?kl.COLOR_ATTACHMENT_WRITE:kl.NONE,v.storeOp===Fl.STORE?kl.COLOR_ATTACHMENT_WRITE:kl.NONE));var C=new f_;C.copy(v.clearColor),this._clearColor.push(C),s.push(b);break;case s1.DEPTH_STENCIL:n.depthStoreOp=v.storeOp,n.stencilStoreOp=v.storeOp,n.depthLoadOp=v.loadOp,n.stencilLoadOp=v.loadOp,n.barrier=i.getGeneralBarrier(new V_(v.loadOp===Bl.LOAD?kl.DEPTH_STENCIL_ATTACHMENT_WRITE:kl.NONE,v.storeOp===Fl.STORE?kl.DEPTH_STENCIL_ATTACHMENT_WRITE:kl.NONE)),y.swapchain||y.framebuffer?y.swapchain&&(a=y.swapchain.depthStencilTexture):a=y.texture,this._clearDepth=v.clearColor.x,this._clearStencil=v.clearColor.y}}if(0===s.length){var R=new k_;s.push(R)}if(0===o.length&&!h&&!u){var w=i.createTexture(new A_);o.push(w)}var I=new z_;I.colorAttachments=s,(h?h.depthStencilTexture:a)&&(I.depthStencilAttachment=n),this._renderPass=i.createRenderPass(I),this._framebuffer=u||i.createFramebuffer(new j_(this._renderPass,h?[h.colorTexture]:o,h?h.depthStencilTexture:a))}var e=t.prototype;return e.addIdxOfRD=function(){this._idxOfRenderData++},e.visitResource=function(t){var e=M4.resourceGraph,i=e.vertex(t);Z4.resName=t,e.visitVertex(Z4,i)},e.addQueue=function(t){this._deviceQueues.set(t.queueId,t)},e.preRecord=function(){M4.passDescriptorSet=d3(this.layoutName).descriptorSet},e._applyRenderLayout=function(t){var e=M4.renderGraph.getLayout(this._rasterID);if(e){var i=M4.layoutGraph,n=i.locateChild(i.N,e);4294967295!==n&&(this._layout=new K4(n,this._rasterID,t))}},e.getGlobalDescData=function(){var t=M4.layoutGraph.locateChild(M4.layoutGraph.N,"default");return M4.layoutGraph.getLayout(t).descriptorSets.get(W0.PER_PASS)},e._applyViewport=function(){this._viewport=null;var t=this._rasterPass.viewport;0===t.left&&0===t.top&&0===t.width&&0===t.height||(this._viewport=t)},e._showProfiler=function(t){var e=M4.pipeline.profiler;if(e&&e.enabled){var i=M4.profilerDescriptorSet,n=this._renderPass,r=M4.commandBuffer,s=e.subModels[0],o=s.passes[0],a=s.inputAssembler,h=M4.device,u=QE.getOrCreatePipelineState(h,o,s.shaders[0],n,a);q4.width=t.width,q4.height=t.height,r.setViewport(q4),r.setScissor(t),r.bindPipelineState(u),r.bindDescriptorSet(jm.GLOBAL,i),r.bindDescriptorSet(jm.MATERIAL,o.descriptorSet),r.bindDescriptorSet(jm.LOCAL,s.descriptorSet),r.bindInputAssembler(a),r.draw(a)}},e.beginPass=function(){var t=this.framebuffer.colorTextures[0];this._applyViewport(t);var e=M4.commandBuffer;this._viewport?(Q4.x=this._viewport.left,Q4.y=this._viewport.top,Q4.width=this._viewport.width,Q4.height=this._viewport.height):(Q4.y=Q4.x=0,Q4.width=t.width,Q4.height=t.height),e.beginRenderPass(this.renderPass,this.framebuffer,Q4,this.clearColor,this.clearDepth,this.clearStencil),M4.passDescriptorSet&&e.bindDescriptorSet(jm.GLOBAL,M4.passDescriptorSet)},e.endPass=function(){M4.commandBuffer.endRenderPass()},e.record=function(){this.beginPass();for(var t,e=d(this._deviceQueues.values());!(t=e()).done;)t.value.record();this._rasterPass.showStatistics&&this._showProfiler(Q4),this.endPass()},e.postRecord=function(){},e.resetResource=function(t,e){this._rasterID=t,this._rasterPass=e,this._layoutName=M4.renderGraph.getLayout(t),this._passID=m.rendering.getPassID(this._layoutName),this._deviceQueues.clear(),this._idxOfRenderData=0;for(var i,n=null,r=[],s=this._framebuffer,o=s.depthStencilTexture,a=s?o:null,h=d(e.computeViews);!(i=h()).done;){var u=i.value;this._applyRenderLayout(u)}this.renderLayout&&this.renderLayout.descriptorSet&&this.renderLayout.descriptorSet.update();for(var c,l=M4.resourceGraph,_=s?s.width:0,f=s?s.height:0,p=0,g=0,v=d(e.rasterViews);!(c=v()).done;){var y=c.value,T=y[0];if(y[1].attachmentType!==s1.SHADING_RATE){var E=l.vertex(T),S=l.getDesc(E);p=S.width,g=S.height;break}}for(var A,b=!1,C=d(s.colorTextures);!(A=C()).done;){var R=A.value;if(0===(null==R?void 0:R.getTextureHandle())){b=!0;break}}o&&!b&&(b=0===o.getTextureHandle());for(var w,I=p!==_||g!==f||s.needRebuild||b,x=d(e.rasterViews);!(w=x()).done;){var D=w.value,O=D[0],P=D[1],M=M4.deviceTextures.get(O),N=M;M||(this.visitResource(O),M=M4.deviceTextures.get(O));var L=M4.resourceGraph,B=L.vertex(O),F=L.object(B),k=L.getDesc(B);if(M.framebuffer&&F instanceof bd&&(M.framebuffer!==F||F!==this._framebuffer))n=this._framebuffer=M.framebuffer=F;else if(!N||M.texture&&I){var U=M.texture;switch(N&&U.resize(k.width,k.height),P.attachmentType){case s1.RENDER_TARGET:r.push(U);break;case s1.DEPTH_STENCIL:a=U}}}!n&&r.length&&(this._framebuffer.destroy(),this._framebuffer=M4.device.createFramebuffer(new j_(this._renderPass,r,a)))},n(t,[{key:"indexOfRD",get:function(){return this._idxOfRenderData}},{key:"rasterID",get:function(){return this._rasterID}},{key:"layoutName",get:function(){return this._layoutName}},{key:"passID",get:function(){return this._passID}},{key:"renderLayout",get:function(){return this._layout}},{key:"renderPass",get:function(){return this._renderPass}},{key:"framebuffer",get:function(){return this._framebuffer}},{key:"clearColor",get:function(){return this._clearColor}},{key:"clearDepth",get:function(){return this._clearDepth}},{key:"clearStencil",get:function(){return this._clearStencil}},{key:"deviceQueues",get:function(){return this._deviceQueues}},{key:"viewport",get:function(){return this._viewport}}]),t}(),$4=function(){function t(){this._id=void 0,this._pass=void 0}return t.prototype.applyInfo=function(t,e){this._id=t,this._pass=e},n(t,[{key:"id",get:function(){return this._id}},{key:"pass",get:function(){return this._pass}}]),t}(),t5=function(){function t(t){this._deviceQueues=[],this._passID=void 0,this._layoutName=void 0,this._viewport=null,this._computeInfo=void 0,this._layout=null,this._computeInfo=t,this._layoutName=M4.renderGraph.getLayout(t.id),this._passID=m.rendering.getPassID(this._layoutName);for(var e,i=d(t.pass.computeViews);!(e=i()).done;){var n=e.value,r=M4.deviceTextures.get(n[0]);r||(this.visitResource(n[0]),r=M4.deviceTextures.get(n[0])),this._applyRenderLayout(n)}this.renderLayout&&this.renderLayout.descriptorSet&&this.renderLayout.descriptorSet.update()}var e=t.prototype;return e.preRecord=function(){M4.passDescriptorSet=d3(this.layoutName).descriptorSet},e.postRecord=function(){},e.visitResource=function(t){var e=M4.resourceGraph,i=e.vertex(t);Z4.resName=t,e.visitVertex(Z4,i)},e.addQueue=function(t){this._deviceQueues.push(t)},e._applyRenderLayout=function(t){var e=M4.renderGraph.getLayout(this._computeInfo.id);if(e){var i=M4.layoutGraph,n=i.locateChild(i.N,e);4294967295!==n&&(this._layout=new K4(n,this._computeInfo.id,t))}},e.getGlobalDescData=function(){var t=M4.layoutGraph.locateChild(M4.layoutGraph.N,"default");return M4.layoutGraph.getLayout(t).descriptorSets.get(W0.PER_PASS)},e.record=function(){var t=M4.commandBuffer;M4.passDescriptorSet&&t.bindDescriptorSet(jm.GLOBAL,M4.passDescriptorSet);for(var e,i=d(this._deviceQueues);!(e=i()).done;)e.value.record();f3(M4.renderGraph.getData(this._computeInfo.id),-1,0,M4.renderGraph.getLayout(this._computeInfo.id))},e.resetResource=function(t,e){this._computeInfo.applyInfo(t,e),this._layoutName=M4.renderGraph.getLayout(t),this._passID=m.rendering.getPassID(this._layoutName),this._deviceQueues.length=0;for(var i,n=d(this._computeInfo.pass.computeViews);!(i=n()).done;){var r=i.value;this._applyRenderLayout(r)}this.renderLayout&&this.renderLayout.descriptorSet&&this.renderLayout.descriptorSet.update()},n(t,[{key:"layoutName",get:function(){return this._layoutName}},{key:"passID",get:function(){return this._passID}},{key:"renderLayout",get:function(){return this._layout}},{key:"deviceQueues",get:function(){return this._deviceQueues}},{key:"computePassInfo",get:function(){return this._computeInfo}}]),t}(),e5=new d_,i5=function(){function t(){this._currentQueue=void 0,this._renderPass=void 0,this._scene=null,this._camera=null,this._sceneData=void 0,this._blit=void 0,this._sceneID=-1}var e=t.prototype;return e.preRecord=function(){this._blit&&(this._currentQueue.createBlitDesc(this._blit),this._currentQueue.blitDesc.update()),M4.lightResource.buildLightBuffer(M4.commandBuffer),M4.lightResource.tryUpdateRenderSceneLocalDescriptorSet(M4.culling)},e.postRecord=function(){},e.init=function(t,e,i,n){this._currentQueue=t,this._sceneData=i,this._blit=n,this._sceneID=e,this._renderPass=t.devicePass.renderPass;var r=i&&i.camera?i.camera:null;r&&(this._scene=r.scene,this._camera=r)},e._recordUI=function(){var t=this._currentQueue.devicePass.rasterID,e=M4.renderGraph.getData(t);this._updateGlobal(e,this.sceneID);var i=this._currentQueue.queueId,n=M4.renderGraph.getData(i);this._updateGlobal(n,this.sceneID),this._currentQueue.isUpdateUBO=!0;for(var r=this.camera.scene.batches,s=0;s<r.length;s++){var o=r[s],a=!1;if(this.camera.visibility&o.visFlags&&(a=!0),a)for(var h=o.shaders.length,u=0;u<h;u++){var c=o.passes[u];if(c.phaseID===this._currentQueue.phaseID){var l=o.shaders[u],_=o.inputAssembler,d=QE.getOrCreatePipelineState(Qd.gfxDevice,c,l,this._renderPass,_);M4.commandBuffer.bindPipelineState(d),M4.commandBuffer.bindDescriptorSet(jm.MATERIAL,c.descriptorSet);var f=o.descriptorSet;M4.commandBuffer.bindDescriptorSet(jm.LOCAL,f),M4.commandBuffer.bindInputAssembler(_),M4.commandBuffer.draw(_)}}}},e._recordBlit=function(){if(this.blit){var t=this.blit,e=t.material.passes[t.passID];e.update();var i=e.getShaderVariant(),n=this._currentQueue.devicePass,r=this._currentQueue.blitDesc.screenQuad.quadIA,s=null;null!==e&&null!==i&&null!==r&&(s=QE.getOrCreatePipelineState(M4.device,e,i,n.renderPass,r)),s&&(M4.commandBuffer.bindPipelineState(s),M4.commandBuffer.bindDescriptorSet(jm.MATERIAL,e.descriptorSet),M4.commandBuffer.bindDescriptorSet(jm.LOCAL,this._currentQueue.blitDesc.stageDesc),M4.commandBuffer.bindInputAssembler(r),M4.commandBuffer.draw(r))}},e._updateGlobal=function(t,e){var i=this._currentQueue.devicePass;i.addIdxOfRD(),f3(t,e,i.indexOfRD,M4.renderGraph.getLayout(i.rasterID))},e._updateRenderData=function(){if(!this._currentQueue.isUpdateUBO){var t=this._currentQueue.devicePass.rasterID,e=M4.renderGraph.getData(t),i=this.sceneID;this._updateGlobal(e,i);var n=this._currentQueue.queueId,r=M4.renderGraph.getData(n);this._updateGlobal(r,i);var s=M4.renderGraph.getData(i);s&&this._updateGlobal(s,i),this._currentQueue.isUpdateUBO=!0}},e._applyViewport=function(){var t=this._currentQueue.viewport;if(t)M4.commandBuffer.setViewport(t),M4.commandBuffer.setScissor(this._currentQueue.scissor);else if(!this._currentQueue.devicePass.viewport){var e=this._currentQueue.devicePass.framebuffer.colorTextures[0],i=this.sceneData?this.sceneData.light:null,n=function(t){var e=m.director.root.pipeline.pipelineSceneData;return e.shadows.enabled&&e.shadows.type===eS.ShadowMap&&t&&0!=(t.flags&e1.SHADOW_CASTER)}(this.sceneData)&&this.sceneData&&i.light?s3(this.camera,e.width,e.height,i.light,i.level):s3(this.camera,e.width,e.height);e5.left=n.x,e5.top=n.y,e5.width=n.width,e5.height=n.height,M4.commandBuffer.setViewport(e5),M4.commandBuffer.setScissor(n)}},e.record=function(){var t=this._currentQueue.devicePass,e=M4.culling;if(this._updateRenderData(),this._applyViewport(),this.blit)this._recordBlit();else{var i,n=e.renderQueueQueryIndex.get(this.sceneID),r=e.renderQueues[n.renderQueueTarget],s=this.sceneData;C3(s.flags&e1.REFLECTION_PROBE)&&r.probeQueue.applyMacro(),r.recordCommands(M4.commandBuffer,this._renderPass,s.flags),C3(s.flags&e1.REFLECTION_PROBE)&&r.probeQueue.removeMacro(),s.flags&e1.GEOMETRY&&(null===(i=this.camera.geometryRenderer)||void 0===i||i.render(t.renderPass,M4.commandBuffer,M4.pipeline.pipelineSceneData)),s.flags&e1.UI&&this._recordUI()}},n(t,[{key:"blit",get:function(){return this._blit}},{key:"sceneData",get:function(){return this._sceneData}},{key:"sceneID",get:function(){return this._sceneID}},{key:"camera",get:function(){return this._camera}}]),t}(),n5=function(){function t(){this.deviceQueuePool=void 0,this.computeQueuePool=void 0,this.passPool=void 0,this.deviceScenePool=void 0,this.deviceQueuePool=new Xs((function(){return new Y4}),16),this.deviceScenePool=new Xs((function(){return new i5}),16),this.computeQueuePool=new Xs((function(){return new j4}),16),this.passPool=new Xs((function(){return{priority:0,hash:0,depth:0,shaderId:0,subModel:null,passIdx:0}}),64)}var e=t.prototype;return e.addDeviceQueue=function(){return this.deviceQueuePool.add()},e.addComputeQueue=function(){return this.computeQueuePool.add()},e.addDeviceScene=function(){return this.deviceScenePool.add()},e.reset=function(){this.deviceQueuePool.reset(),this.computeQueuePool.reset(),this.deviceScenePool.reset()},t}(),r5=new Float32Array(16),s5=new o_,o5=function(){function t(t){this._pipelineIAData=void 0,this._context=void 0,this._width=void 0,this._height=void 0,this._lightVolumeBuffer=void 0,this._lightBufferData=void 0,this._deferredLitsBufView=void 0,this._localUBO=void 0,this._stageDescs=new Map,this._context=t,this._width=t.width,this._height=t.height,this._pipelineIAData=this._createQuadInputAssembler();var e=this._genQuadVertexData(dl.IDENTITY,new o_(0,0,t.width,t.height));this._pipelineIAData.quadVB.update(e),this._createLightVolumes(),this._localUBO=t.device.createBuffer(new v_(vl.UNIFORM|vl.TRANSFER_DST,El.DEVICE,dv.SIZE,dv.SIZE))}var e=t.prototype;return e.resize=function(t,e){if(t!==this._width||e!==this._height){s5.y=s5.x=0,s5.width=t,s5.height=e;var i=this._genQuadVertexData(dl.IDENTITY,s5);this._pipelineIAData.quadVB.update(i)}},e._createLightVolumes=function(){var t=this._context.root.device,e=20*Float32Array.BYTES_PER_ELEMENT*yv.LIGHTS_PER_PASS;e=Math.ceil(e/t.capabilities.uboOffsetAlignment)*t.capabilities.uboOffsetAlignment,this._lightVolumeBuffer=t.createBuffer(new v_(vl.UNIFORM|vl.TRANSFER_DST,El.HOST|El.DEVICE,e,t.capabilities.uboOffsetAlignment)),this._deferredLitsBufView=t.createBuffer(new y_(this._lightVolumeBuffer,0,e)),this._lightBufferData=new Float32Array(e/Float32Array.BYTES_PER_ELEMENT)},e._genQuadVertexData=function(t,e){var i=e.x/this._context.width,n=(e.x+e.width)/this._context.width,r=e.y/this._context.height,s=(e.y+e.height)/this._context.height;if(this._context.root.device.capabilities.screenSpaceSignY>0){var o=s;s=r,r=o}var a=0;switch(t){case dl.IDENTITY:a=0,r5[a++]=-1,r5[a++]=-1,r5[a++]=i,r5[a++]=s,r5[a++]=1,r5[a++]=-1,r5[a++]=n,r5[a++]=s,r5[a++]=-1,r5[a++]=1,r5[a++]=i,r5[a++]=r,r5[a++]=1,r5[a++]=1,r5[a++]=n,r5[a++]=r;break;case dl.ROTATE_90:a=0,r5[a++]=-1,r5[a++]=-1,r5[a++]=n,r5[a++]=s,r5[a++]=1,r5[a++]=-1,r5[a++]=n,r5[a++]=r,r5[a++]=-1,r5[a++]=1,r5[a++]=i,r5[a++]=s,r5[a++]=1,r5[a++]=1,r5[a++]=i,r5[a++]=r;break;case dl.ROTATE_180:a=0,r5[a++]=-1,r5[a++]=-1,r5[a++]=i,r5[a++]=r,r5[a++]=1,r5[a++]=-1,r5[a++]=n,r5[a++]=r,r5[a++]=-1,r5[a++]=1,r5[a++]=i,r5[a++]=s,r5[a++]=1,r5[a++]=1,r5[a++]=n,r5[a++]=s;break;case dl.ROTATE_270:a=0,r5[a++]=-1,r5[a++]=-1,r5[a++]=i,r5[a++]=r,r5[a++]=1,r5[a++]=-1,r5[a++]=i,r5[a++]=s,r5[a++]=-1,r5[a++]=1,r5[a++]=n,r5[a++]=r,r5[a++]=1,r5[a++]=1,r5[a++]=n,r5[a++]=s}return r5},e._createQuadInputAssembler=function(){var t=new PD,e=4*Float32Array.BYTES_PER_ELEMENT,i=4*e,n=m.director.root.device,r=n.createBuffer(new v_(vl.VERTEX|vl.TRANSFER_DST,El.DEVICE|El.HOST,i,e));if(!r)return t;var s=Uint16Array.BYTES_PER_ELEMENT,o=6*s,a=n.createBuffer(new v_(vl.INDEX|vl.TRANSFER_DST,El.DEVICE,o,s));if(!a)return t;var h=new Uint16Array(6);h[0]=0,h[1]=1,h[2]=2,h[3]=1,h[4]=3,h[5]=2,a.update(h.buffer);var u=new Array(2);u[0]=new L_("a_position",pl.RG32F),u[1]=new L_("a_texCoord",pl.RG32F);var c=n.createInputAssembler(new F_(u,[r],a));return t.quadIB=a,t.quadVB=r,t.quadIA=c,t},n(t,[{key:"pipelineIAData",get:function(){return this._pipelineIAData}},{key:"deferredLitsBufView",get:function(){return this._deferredLitsBufView}},{key:"lightVolumeBuffer",get:function(){return this._lightVolumeBuffer}},{key:"lightBufferData",get:function(){return this._lightBufferData}},{key:"stageDescs",get:function(){return this._stageDescs}},{key:"emptyLocalUBO",get:function(){return this._localUBO}}]),t}(),a5=function(){function t(t,e,i,n,r,s,o,a){void 0===a&&(a=null),this.device=void 0,this.pipeline=void 0,this.commandBuffer=void 0,this.pipelineSceneData=void 0,this.resourceGraph=void 0,this.devicePasses=new Map,this.deviceTextures=new Map,this.deviceBuffers=new Map,this.layoutGraph=void 0,this.root=void 0,this.pools=void 0,this.blit=void 0,this.culling=void 0,this.lightResource=new U4,this.renderGraph=void 0,this.width=void 0,this.height=void 0,this.cullCamera=void 0,this.passDescriptorSet=void 0,this.profilerDescriptorSet=void 0,this.pipeline=t,this.device=e,this.commandBuffer=e.commandBuffer,this.pipelineSceneData=t.pipelineSceneData,this.resourceGraph=i,this.renderGraph=n,this.root=m.director.root,this.layoutGraph=r,this.width=s,this.height=o,this.pools=new n5,this.blit=new o5(this),this.culling=new k4,this.passDescriptorSet=a,this.profilerDescriptorSet=d3("default").descriptorSet}var e=t.prototype;return e.reset=function(){this.culling.clear(),this.pools.reset(),this.cullCamera=null,this.lightResource.clear()},e.resize=function(t,e){this.width=t,this.height=e,this.blit.resize(t,e)},t}(),h5=function(){function t(t,e,i,n,r,s){this._context=void 0,this._visitor=void 0,M4=this._context=new a5(t,e,i,new S2,n,r,s);var o=m.rendering.programLib;M4.lightResource.init(o,e,16)}var e=t.prototype;return e.resize=function(t,e){M4.resize(t,e)},e._removeDeviceResource=function(){for(var t,e=M4.pipeline.resourceUses,i=[],n=M4.deviceTextures,r=d(n);!(t=r()).done;){var s=t.value,o=s[0];s[1];var a=M4.resourceGraph.vertex(o),h=M4.resourceGraph.getTraits(a);if(!e.includes(o))switch(h.residency){case Z0.MANAGED:i.push(o)}}for(var u=0,c=i;u<c.length;u++){var l=c[u];n.get(l).release(),n.delete(l)}for(var _,f=[],p=M4.deviceBuffers,g=d(p);!(_=g()).done;){var m=_.value,v=m[0];m[1];var y=M4.resourceGraph.vertex(v),T=M4.resourceGraph.getTraits(y);if(!e.includes(v))switch(T.residency){case Z0.MANAGED:f.push(v)}}for(var E=0,S=f;E<S.length;E++){var A=S[E];p.get(A).release(),p.delete(A)}e.length=0},e.execute=function(t){M4.renderGraph=t,M4.reset();var e=M4.commandBuffer,i=M4.culling;i.buildRenderQueues(t,M4.layoutGraph,M4.pipelineSceneData),M4.lightResource.buildLights(i,M4.pipelineSceneData.isHDR,M4.pipelineSceneData.shadows),this._removeDeviceResource(),e.begin(),i.uploadInstancing(e),this._visitor||(this._visitor=new _5),F1(this._visitor.graphView,this._visitor,this._visitor.colorMap),e.end(),M4.device.queue.submit([e])},e.release=function(){M4.devicePasses.clear();for(var t,e=d(M4.deviceTextures);!(t=e()).done;){var i=t.value;i[0],i[1].release()}M4.deviceTextures.clear();for(var n,r=d(M4.deviceBuffers);!(n=r()).done;){var s=n.value;s[0],s[1].release()}M4.deviceBuffers.clear()},t}(),u5=function(){function t(){this.queueID=4294967295,this.sceneID=4294967295,this.passID=4294967295,this.dispatchID=4294967295,this.currPass=void 0,this.currQueue=void 0,this.rg=void 0,this.rg=M4.renderGraph}var e=t.prototype;return e._isRasterPass=function(t){return M4.renderGraph.h(0,t)},e.isComputePass=function(t){return M4.renderGraph.h(3,t)},e.isDispatch=function(t){return M4.renderGraph.h(11,t)},e._isQueue=function(t){return M4.renderGraph.h(8,t)},e._isScene=function(t){return M4.renderGraph.h(9,t)},e._isBlit=function(t){return M4.renderGraph.h(T2,t)},e.applyID=function(t){this._isRasterPass(t)?this.passID=t:this._isQueue(t)?this.queueID=t:this._isScene(t)||this._isBlit(t)?this.sceneID=t:this.isComputePass(t)?this.passID=t:this.isDispatch(t)&&(this.dispatchID=t)},t}(),c5=function(t){function e(){return t.call(this)||this}s(e,t);var i=e.prototype;return i.clear=function(){},i.viewport=function(){},i.rasterPass=function(t){if(this.rg.getValid(this.passID)){var e=M4.devicePasses,i=t.hashValue;this.currPass=e.get(i),this.currPass?this.currPass.resetResource(this.passID,t):(this.currPass=new J4(this.passID,t),e.set(i,this.currPass)),this.currPass.preRecord()}},i.rasterSubpass=function(){},i.computeSubpass=function(){},i.resolve=function(){},i.move=function(){},i.raytrace=function(){},i.compute=function(t){if(this.rg.getValid(this.passID)){M4.devicePasses;var e=new $4;e.applyInfo(this.passID,t),this.currPass=new t5(e),this.currPass.preRecord(),this.currPass.record()}},i.copy=function(t){if(t.uploadPairs.length)for(var e,i=d(t.uploadPairs);!(e=i()).done;){var n=e.value,r=M4.deviceBuffers,s=M4.resourceGraph,o=s.vertex(n.target);Z4.resName=n.target,s.visitVertex(Z4,o);var a=r.get(n.target);M4.device.commandBuffer.updateBuffer(a.buffer,n.source,n.source.byteLength)}},i.queue=function(t){if(this.rg.getValid(this.queueID)){var e;this.currPass instanceof J4?((e=M4.pools.addDeviceQueue()).init(this.currPass,t,this.queueID),this.currQueue=e,this.currPass.addQueue(e)):((e=M4.pools.addComputeQueue()).init(this.currPass,t,this.queueID),this.currQueue=e,this.currPass.addQueue(e));var i=this.rg.getLayout(this.queueID);if(i){var n=M4.layoutGraph;if(this.currPass.renderLayout){var r=n.locateChild(this.currPass.renderLayout.layoutID,i);this.currQueue.layoutID=r}}this.currQueue.preRecord()}},i.scene=function(t){this.rg.getValid(this.sceneID)&&this.currQueue.setScene(this.sceneID,t).preRecord()},i.blit=function(t){this.rg.getValid(this.sceneID)&&this.currQueue.setScene(this.sceneID,void 0,t).preRecord()},i.dispatch=function(t){var e,i=null,n=this.currPass,r=null===(e=t.material)||void 0===e?void 0:e.passes[t.passID];null==r||r.update();var s=null==r?void 0:r.getShaderVariant();if(null!==r&&null!==s){var o=new Md(s,null==r?void 0:r.pipelineLayout);o.bindPoint=Gl.COMPUTE,i=Qd.gfxDevice.createPipelineState(o)}var a=M4.commandBuffer;if(i){a.bindPipelineState(i);var h=n.renderLayout.descriptorSet;a.bindDescriptorSet(jm.GLOBAL,h)}var u=t.threadGroupCountX,c=t.threadGroupCountY,l=t.threadGroupCountZ;a.dispatch(new E_(u,c,l))},e}(u5),l5=function(t){function e(){return t.call(this)||this}s(e,t);var i=e.prototype;return i.clear=function(){},i.viewport=function(){},i.rasterPass=function(t){var e=M4.devicePasses,i=t.hashValue,n=e.get(i);n&&(this.currPass=n,this.currPass.record())},i.rasterSubpass=function(){},i.computeSubpass=function(){},i.resolve=function(){},i.compute=function(){},i.copy=function(){},i.move=function(){},i.raytrace=function(){},i.queue=function(){},i.scene=function(){},i.blit=function(){},i.dispatch=function(){},e}(u5),_5=function(t){function e(){var e;return(e=t.call(this)||this)._preVisitor=void 0,e._postVisitor=void 0,e._graphView=void 0,e._colorMap=void 0,e._preVisitor=new c5,e._postVisitor=new l5,e._graphView=new U1(M4.renderGraph),e._colorMap=new i3(M4.renderGraph.nv()),e}s(e,t);var i=e.prototype;return i.discoverVertex=function(t,e){var i=e.g;this._preVisitor.applyID(t),i.visitVertex(this._preVisitor,t)},i.finishVertex=function(t,e){e.g.visitVertex(this._postVisitor,t)},n(e,[{key:"graphView",get:function(){return this._graphView}},{key:"colorMap",get:function(){return this._colorMap}}]),e}(k1),d5=new C_(Il.LINEAR,Il.LINEAR,Il.NONE,xl.CLAMP,xl.CLAMP,xl.CLAMP),f5=new C_(Il.POINT,Il.POINT,Il.NONE,xl.CLAMP,xl.CLAMP,xl.CLAMP),p5=function(){function t(t){this._descriptorSetMap=new Map,this._device=t,this._linearSampler=this._device.getSampler(d5),this._pointSampler=this._device.getSampler(f5);var e=new K_(Hm.bindings);this._descriptorSetLayout=this._device.createDescriptorSetLayout(e),this._globalDescriptorSet=this._device.createDescriptorSet(new q_(this._descriptorSetLayout))}var e=t.prototype;return e.regenLayout=function(){var t=new K_(Hm.bindings);this._descriptorSetLayout=this._device.createDescriptorSetLayout(t),this._globalDescriptorSet=this._device.createDescriptorSet(new q_(this._descriptorSetLayout))},e.bindBuffer=function(t,e){this._globalDescriptorSet.bindBuffer(t,e);for(var i=this._descriptorSetMap.values(),n=i.next();!n.done;)n.value.bindBuffer(t,e),n=i.next()},e.bindSampler=function(t,e){this._globalDescriptorSet.bindSampler(t,e);for(var i=this._descriptorSetMap.values(),n=i.next();!n.done;)n.value.bindSampler(t,e),n=i.next()},e.bindTexture=function(t,e){this._globalDescriptorSet.bindTexture(t,e);for(var i=this._descriptorSetMap.values(),n=i.next();!n.done;)n.value.bindTexture(t,e),n=i.next()},e.update=function(){this._globalDescriptorSet.update();for(var t=this._descriptorSetMap.values(),e=t.next();!e.done;)e.value.update(),e=t.next()},e.getOrCreateDescriptorSet=function(t){var e=this._device;if(!this._descriptorSetMap.has(t)){var i=this._globalDescriptorSet,n=e.createDescriptorSet(new q_(this._descriptorSetLayout));this._descriptorSetMap.set(t,n);for(var r=Gm.UBO_GLOBAL;r<Gm.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 v_(vl.UNIFORM|vl.TRANSFER_DST,El.HOST|El.DEVICE,$m.SIZE,$m.SIZE));n.bindBuffer($m.BINDING,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}(),g5=new Map,m5=function(){function t(t){this.queueID=4294967295,this.sceneID=4294967295,this.passID=4294967295,this.dispatchID=4294967295,this.resID=4294967295,this.context=void 0,this._currPass=null,this._resVisitor=void 0,this.context=t,this._resVisitor=new y5(this.context)}var e=t.prototype;return e._isRasterPass=function(t){return this.context.renderGraph.h(0,t)},e._isCopyPass=function(t){return this.context.renderGraph.h(5,t)},e._isCompute=function(t){return this.context.renderGraph.h(3,t)},e._isDispatch=function(t){return this.context.renderGraph.h(11,t)},e._isQueue=function(t){return this.context.renderGraph.h(8,t)},e._isShadowMap=function(t){var e=this._getSceneData(t);return!!e&&e.light&&!!e.light.light&&0!=(e.flags&e1.SHADOW_CASTER)},e._getSceneData=function(t){return this.context.renderGraph.h(9,t)?this.context.renderGraph.j(t):null},e._isScene=function(t){return this.context.renderGraph.h(9,t)},e._isBlit=function(t){return this.context.renderGraph.h(T2,t)},e._useResourceInfo=function(){},e._fetchValidPass=function(){var t=this.context.renderGraph;if(this.context.resourceContext,t.getValid(this.passID))return t.setValid(this.queueID,!0),void t.setValid(this.sceneID,!0);var e=this.resID,i=this.context.resourceGraph.vertexName(e);g5.clear();var n=this._currPass;t.getValid(this.passID);for(var r,s=d(n.rasterViews);!(r=s()).done;){var o=r.value,a=o[0],h=o[1];a!==i||h.accessType===n1.READ?h.accessType!==n1.WRITE&&g5.set(a,h):(t.setValid(this.passID,!0),t.setValid(this.queueID,!0),t.setValid(this.sceneID,!0))}if(t.getValid(this.sceneID)){for(var u,c=d(n.rasterViews);!(u=c()).done;){var l=u.value,_=l[0];l[1],S5.pipeline.resourceUses.push(_)}for(var f,p,g,m=d(g5);!(g=m()).done;){var v=g.value,y=v[0];v[1],4294967295!==(p=(f=this.context.resourceGraph).find(y))&&(this._resVisitor.resID=p,f.visitVertex(this._resVisitor,p))}for(var T,E=d(n.computeViews);!(T=E()).done;){var S=T.value,A=S[0];S[1],4294967295!==(p=(f=this.context.resourceGraph).find(A))&&(this._resVisitor.resID=p,f.visitVertex(this._resVisitor,p))}!function(t){for(var e,i="",n=d(t.rasterViews);!(e=n()).done;){var r=e.value,s=r[0],o=r[1];i+=b3(s),i+=b3(o.slotName),i+=b3(o.accessType),i+=b3(o.attachmentType),i+=b3(o.loadOp),i+=b3(o.storeOp),i+=b3(o.clearFlags),i+=b3(o.clearColor.x),i+=b3(o.clearColor.y),i+=b3(o.clearColor.z),i+=b3(o.clearColor.w),i+=b3(o.slotID),i+=b3(o.shaderStageFlags)}for(var a,h=d(t.computeViews);!(a=h()).done;){var u=a.value,c=u[0],l=u[1];i+=b3(c);for(var _,f=d(l);!(_=f()).done;){var p=_.value;i+=b3(p.name),i+=b3(p.accessType),i+=b3(p.clearFlags),i+=b3(p.clearValueType),i+=b3(p.clearValue.x),i+=b3(p.clearValue.y),i+=b3(p.clearValue.z),i+=b3(p.clearValue.w),i+=b3(p.shaderStageFlags)}}i+=b3(t.width),i+=b3(t.height),i+=b3(t.viewport.left),i+=b3(t.viewport.top),i+=b3(t.viewport.width),i+=b3(t.viewport.height),i+=b3(t.viewport.minDepth),i+=b3(t.viewport.maxDepth),i+=b3(t.showStatistics?1:0),t.hashValue=function(t){for(var e=0,i=0;i<t.length;i++)e=(e<<5)-e+t.charCodeAt(i),e|=0;return e}(i)}(n)}},e.applyID=function(t,e){this.resID=e,this._isRasterPass(t)||this._isCopyPass(t)||this._isCompute(t)?this.passID=t:this._isQueue(t)?this.queueID=t:this._isScene(t)||this._isBlit(t)?this.sceneID=t:this._isDispatch(t)&&(this.dispatchID=t)},e.rasterPass=function(t){this._currPass=t},e.rasterSubpass=function(){},e.computeSubpass=function(){},e.compute=function(t){this._currPass=t,S5.renderGraph.setValid(this.passID,!0)},e.resolve=function(){},e.copy=function(t){var e=S5.renderGraph;if(!e.getValid(this.passID)){var i=this.context.resourceGraph;this._currPass=t;for(var n,r,s=this.resID,o=i.vertexName(s),a=d(t.copyPairs);!(r=a()).done;){var h=r.value;h.target===o&&(e.setValid(this.passID,!0),4294967295!==(n=i.find(h.source))&&(this._resVisitor.resID=n,i.visitVertex(this._resVisitor,n)))}}},e.move=function(){},e.raytrace=function(){},e.queue=function(){},e.scene=function(){this._fetchValidPass()},e.blit=function(){this._fetchValidPass()},e.dispatch=function(){var t=this.context.renderGraph;t.setValid(this.queueID,!0),t.setValid(this.dispatchID,!0)},e.clear=function(){},e.viewport=function(){},t}(),v5=function(t){function e(e,i){var n;return(n=t.call(this)||this)._colorMap=void 0,n._graphView=void 0,n._passVisitor=void 0,n._resId=4294967295,n._resId=i,n._passVisitor=new m5(e),n._graphView=new U1(e.renderGraph),n._colorMap=new i3(e.renderGraph.nv()),n}return s(e,t),e.prototype.discoverVertex=function(t,e){var i=e.g;this._passVisitor.applyID(t,this.resId),i.visitVertex(this._passVisitor,t)},n(e,[{key:"resId",get:function(){return this._resId},set:function(t){this._resId=t,this._colorMap.colors.length=S5.renderGraph.nv()}},{key:"graphView",get:function(){return this._graphView}},{key:"colorMap",get:function(){return this._colorMap}}]),e}(k1),y5=function(){function t(t){this._context=void 0,this.resID=4294967295,this._passManagerVis=void 0,this._context=t}var e=t.prototype;return e.managedBuffer=function(){},e.managedTexture=function(){},e.managed=function(){this.dependency()},e.persistentBuffer=function(){},e.dependency=function(){this._passManagerVis?this._passManagerVis.resId=this.resID:this._passManagerVis=new v5(this._context,this.resID),F1(this._passManagerVis.graphView,this._passManagerVis,this._passManagerVis.colorMap)},e.persistentTexture=function(){this.dependency()},e.framebuffer=function(){this.dependency()},e.swapchain=function(){this.dependency()},e.formatView=function(){},e.subresourceView=function(){},t}(),T5=function(){function t(){this.resourceGraph=void 0,this.pipeline=void 0,this.renderGraph=void 0,this.layoutGraph=void 0,this.resourceContext=void 0}return t.prototype.set=function(t,e,i,n){this.pipeline=t,this.resourceGraph=e,this.renderGraph=i,this.layoutGraph=n,this.resourceContext||(this.resourceContext=new Map),this.resourceContext.clear()},t}(),E5=function(){function t(t,e,i,n){this._resourceGraph=void 0,this._pipeline=void 0,this._layoutGraph=void 0,this._visitor=void 0,this._pipeline=t,this._resourceGraph=i,this._layoutGraph=n,S5.set(this._pipeline,this._resourceGraph,e,this._layoutGraph),this._visitor=new A5(S5)}return t.prototype.compile=function(t){S5.set(this._pipeline,this._resourceGraph,t,this._layoutGraph),S5.pipeline.resourceUses.length=0,this._visitor.colorMap.colors.length=S5.resourceGraph.nv(),F1(this._resourceGraph,this._visitor,this._visitor.colorMap)},t}(),S5=new T5,A5=function(t){function e(e){var i;return(i=t.call(this)||this)._colorMap=void 0,i._resourceGraph=void 0,i._resVisitor=void 0,i._colorMap=new i3(e.resourceGraph.nv()),i._resourceGraph=e.resourceGraph,i._resVisitor=new y5(e),i}return s(e,t),e.prototype.discoverVertex=function(t){var e=this._resourceGraph.getTraits(t);e.residency!==Z0.MANAGED&&e.residency!==Z0.MEMORYLESS&&(this._resVisitor.resID=t,this._resourceGraph.visitVertex(this._resVisitor,t))},n(e,[{key:"colorMap",get:function(){return this._colorMap}}]),e}(k1),b5=new on,C5=new C_(Il.POINT,Il.POINT,Il.NONE,xl.CLAMP,xl.CLAMP,xl.CLAMP),R5=function(){function t(){var t=this;this.renderData=new y2,this.layoutGraph=new H2,this.rg=new S2,this.vertId=-1,this.sceneData=new g2,this.resourceGraph=new h2,this.computePass=new u2,this.rasterPass=new n2,this.rasterSubpass=new e2,this.renderQueue=new p2,this.sceneBuilder=new Xs((function(){return new w5(t.renderData,t.layoutGraph,t.rg,t.vertId,t.sceneData)}),16),this.renderPassBuilder=new Xs((function(){return new D5(t.renderData,t.rg,t.layoutGraph,t.resourceGraph,t.vertId,t.rasterPass,t.getPipelineSceneData())}),16),this.computeQueueBuilder=new Xs((function(){return new O5(t.renderData,t.rg,t.layoutGraph,t.vertId,t.renderQueue,t.getPipelineSceneData())}),16),this.renderQueueBuilder=new Xs((function(){return new I5(t.renderData,t.rg,t.layoutGraph,t.vertId,t.renderQueue,t.getPipelineSceneData())}),16),this.renderSubpassBuilder=new Xs((function(){return new x5(t.renderData,t.rg,t.layoutGraph,t.vertId,t.rasterSubpass,t.getPipelineSceneData())}),16),this.computePassBuilder=new Xs((function(){return new P5(t.renderData,t.rg,t.layoutGraph,t.resourceGraph,t.vertId,t.computePass,t.getPipelineSceneData())}),16),this.samplerInfo=new Xs((function(){return new C_}),16),this.color=new Xs((function(){return new f_}),16),this.renderCommonObjectPool=new A1,this.renderGraphPool=new R2(this.renderCommonObjectPool),this.viewport=new Xs((function(){return new d_}),16)}var e=t.prototype;return e.getPipelineSceneData=function(){return m.director.root.pipeline.pipelineSceneData},e.createColor=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);var r=this.color.add();return r.set(t,e,i,n),r},e.createSamplerInfo=function(t,e,i,n,r,s,o,a){void 0===t&&(t=Il.LINEAR),void 0===e&&(e=Il.LINEAR),void 0===i&&(i=Il.NONE),void 0===n&&(n=xl.WRAP),void 0===r&&(r=xl.WRAP),void 0===s&&(s=xl.WRAP),void 0===o&&(o=0),void 0===a&&(a=Dl.ALWAYS);var h=this.samplerInfo.add();return h.minFilter=t,h.magFilter=e,h.mipFilter=i,h.addressU=n,h.addressV=r,h.addressW=s,h.maxAnisotropy=o,h.cmpFunc=a,h},e.reset=function(){this.sceneBuilder.reset(),this.renderPassBuilder.reset(),this.computePassBuilder.reset(),this.computeQueueBuilder.reset(),this.renderCommonObjectPool.reset(),this.renderGraphPool.reset(),this.viewport.reset(),this.samplerInfo.reset(),this.color.reset(),this.renderQueueBuilder.reset(),this.renderSubpassBuilder.reset()},t}(),w5=function(t){function e(e,i,n,r,s){var o;return(o=t.call(this,e,i)||this)._renderGraph=void 0,o._scene=void 0,o._renderGraph=n,o._scene=s,o._vertID=r,o}s(e,t);var i=e.prototype;return i.update=function(t,e,i,n,r){this._data=t,this._lg=e,this._renderGraph=i,this._scene=r,this._vertID=n},i.useLightFrustum=function(t,e,i){if(void 0===e&&(e=0),void 0===i&&(i=void 0),this._scene.light.light=t,this._scene.light.level=e,this._scene.light.culledByLight=!0,i&&(this._scene.camera=i),!(this._scene.flags&e1.NON_BUILTIN)){var n=this._renderGraph.getParent(this._vertID),r=this._renderGraph.getParent(n);this._renderGraph.getLayout(r),F3(this,this._scene.camera,t,e)}},e}(U3),I5=function(t){function e(e,i,n,r,s,o){var a;return(a=t.call(this,e,n)||this)._renderGraph=void 0,a._queue=void 0,a._pipeline=void 0,a._renderGraph=i,a._vertID=r,a._queue=s,a._pipeline=o,a}s(e,t);var i=e.prototype;return i.update=function(t,e,i,n,r,s){this._data=t,this._lg=i,this._renderGraph=e,this._vertID=n,this._queue=r,this._pipeline=s},i.setArrayBuffer=function(){throw new Error("Method not implemented.")},i.addSceneOfCamera=function(t,e,i,n){void 0===i&&(i=e1.NONE),void 0===n&&(n="Camera");var r=e.light,s=L4.createSceneData(t.scene,t,i,!r||i&e1.SHADOW_CASTER?1:5,r);this._renderGraph.addVertex(9,s,n,"",L4.createRenderData(),!1,this._vertID),this.getParentLayout();var o=m.director.getScene();O3(this,t,this._pipeline,t.scene||(o?o.renderScene:null)),i&e1.SHADOW_CASTER||r&&r.type!==CI.DIRECTIONAL?F3(this,t,r,e.level):k3(this,t)},i.addScene=function(t,e,i,n){void 0===e&&(e=e1.NONE),void 0===i&&(i=void 0),void 0===n&&(n=void 0);var r=L4.createSceneData(n||t.scene,t,e,!i||e&e1.SHADOW_CASTER?1:5,i),s=L4.createRenderData(),o=this._renderGraph.addVertex(9,r,"Scene","",s,!1,this._vertID);e&e1.NON_BUILTIN||(this.getParentLayout(),O3(this,t,this._pipeline,n||t.scene),i&&i.type!==CI.DIRECTIONAL?F3(this,t,i,0):e&e1.SHADOW_CASTER||k3(this,t));var a=N4.sceneBuilder.add();return a.update(s,this._lg,this._renderGraph,o,r),a},i.addFullscreenQuad=function(t,e,i,n){void 0===i&&(i=e1.NONE),void 0===n&&(n="Quad"),this._renderGraph.addVertex(T2,L4.createBlit(t,e,i,null),n,"",L4.createRenderData(),!1,this._vertID),this.getParentLayout();var r=m.director.getScene();O3(this,null,this._pipeline,r?r.renderScene:null),i&e1.SHADOW_CASTER||k3(this,null)},i.addCameraQuad=function(t,e,i,n){void 0===n&&(n=e1.NONE),this._renderGraph.addVertex(T2,L4.createBlit(e,i,n,t),"CameraQuad","",L4.createRenderData(),!1,this._vertID),this.getParentLayout();var r=m.director.getScene();O3(this,t,this._pipeline,t.scene||(r?r.renderScene:null)),n&e1.SHADOW_CASTER||k3(this,t)},i.clearRenderTarget=function(t,e){void 0===e&&(e=new f_);var i=L4.createClearView(t,Zl.COLOR);i.clearColor.copy(e),this._renderGraph.addVertex(12,[i],"ClearRenderTarget","",L4.createRenderData(),!1,this._vertID)},i.setViewport=function(t){var e=N4.viewport.add();this._queue.viewport=e.copy(t)},i.addCustomCommand=function(){throw new Error("Method not implemented.")},n(e,[{key:"name",get:function(){return this._renderGraph.getName(this._vertID)},set:function(t){this._renderGraph.setName(this._vertID,t)}}]),e}(U3),x5=function(t){function e(e,i,n,r,s,o){var a;(a=t.call(this,e,n)||this)._renderGraph=void 0,a._layoutID=void 0,a._subpass=void 0,a._pipeline=void 0,a._renderGraph=i,a._vertID=r,a._subpass=s,a._pipeline=o;var h=a._renderGraph.getLayout(a._vertID);return a._layoutID=n.locateChild(n.N,h),a}s(e,t);var i=e.prototype;return i.update=function(t,e,i,n,r,s){this._data=t,this._lg=i,this._renderGraph=e,this._vertID=n,this._subpass=r,this._pipeline=s;var o=this._renderGraph.getLayout(this._vertID);this._layoutID=i.locateChild(i.N,o)},i.addRenderTarget=function(){throw new Error("Method not implemented.")},i.setCustomShaderStages=function(){throw new Error("Method not implemented.")},i.setArrayBuffer=function(){throw new Error("Method not implemented.")},i.addDepthStencil=function(t,e,i,n,r,s,o,a,h){throw void 0===r&&(r=Bl.CLEAR),void 0===s&&(s=Fl.STORE),void 0===h&&(h=Zl.DEPTH_STENCIL),new Error("Method not implemented.")},i.addTexture=function(){throw new Error("Method not implemented.")},i.addStorageBuffer=function(){throw new Error("Method not implemented.")},i.addStorageImage=function(){throw new Error("Method not implemented.")},i.setViewport=function(){throw new Error("Method not implemented.")},i.addQueue=function(t,e){void 0===t&&(t=J0.RENDER_OPAQUE),void 0===e&&(e="default");var i=this._lg.locateChild(this._layoutID,e),n=L4.createRenderQueue(t,i),r=L4.createRenderData(),s=this._renderGraph.addVertex(8,n,"",e,r,!1,this._vertID),o=N4.renderQueueBuilder.add();return o.update(r,this._renderGraph,this._lg,s,n,this._pipeline),o},n(e,[{key:"name",get:function(){return this._renderGraph.getName(this._vertID)},set:function(t){this._renderGraph.setName(this._vertID,t)}},{key:"showStatistics",get:function(){return this._subpass.showStatistics},set:function(t){this._subpass.showStatistics=t}}]),e}(U3),D5=function(t){function e(e,i,n,r,s,o,a){var h;(h=t.call(this,e,n)||this)._renderGraph=void 0,h._layoutID=void 0,h._pass=void 0,h._pipeline=void 0,h._resourceGraph=void 0,h._renderGraph=i,h._resourceGraph=r,h._vertID=s,h._pass=o,h._pipeline=a;var u=h._renderGraph.getLayout(h._vertID);return h._layoutID=n.locateChild(n.N,u),h}s(e,t);var i=e.prototype;return i.update=function(t,e,i,n,r,s,o){this._renderGraph=e,this._lg=i,this._resourceGraph=n,this._vertID=r,this._pass=s,this._pipeline=o,this._data=t;var a=this._renderGraph.getLayout(this._vertID);this._layoutID=i.locateChild(i.N,a)},i.setCustomShaderStages=function(){throw new Error("Method not implemented.")},i.setArrayBuffer=function(){throw new Error("Method not implemented.")},i.setVersion=function(t,e){this._pass.versionName=t,this._pass.version=e},i.addRenderTarget=function(t,e,i,n){void 0===e&&(e=Bl.CLEAR),void 0===i&&(i=Fl.STORE),void 0===n&&(n=new f_);var r=Zl.COLOR;e===Bl.LOAD&&(r=Zl.NONE);var s=L4.createRasterView("",n1.WRITE,s1.RENDER_TARGET,e,i,r);s.clearColor.copy(n),this._pass.rasterViews.set(t,s)},i.addDepthStencil=function(t,e,i,n,r,s){void 0===e&&(e=Bl.CLEAR),void 0===i&&(i=Fl.STORE),void 0===n&&(n=1),void 0===r&&(r=0),void 0===s&&(s=Zl.DEPTH_STENCIL);var o=L4.createRasterView("",n1.WRITE,s1.DEPTH_STENCIL,e,i,s);o.clearColor.set(n,r,0,0),this._pass.rasterViews.set(t,o)},i.resolveRenderTarget=function(){},i.resolveDepthStencil=function(){},i._addComputeResource=function(t,e,i){var n,r=L4.createComputeView(i);r.accessType=e,this._pass.computeViews.has(t)?null===(n=this._pass.computeViews.get(t))||void 0===n||n.push(r):this._pass.computeViews.set(t,[r])},i.addTexture=function(t,e,i){if(void 0===i&&(i=null),this._addComputeResource(t,n1.READ,e),i){var n=this._lg.attributeIndex.get(e);this._data.samplers.set(n,i)}},i.addStorageBuffer=function(t,e,i){this._addComputeResource(t,e,i)},i.addStorageImage=function(t,e,i){this._addComputeResource(t,e,i)},i.addRenderSubpass=function(t){void 0===t&&(t="");var e="Raster",i=this._pass.subpassGraph.nv();this._pass.subpassGraph.addVertex(e,L4.createSubpass());var n=L4.createRasterSubpass(i,1,0),r=L4.createRenderData(),s=this._renderGraph.addVertex(1,n,e,t,r,!1),o=N4.renderSubpassBuilder.add();return o.update(r,this._renderGraph,this._lg,s,n,this._pipeline),o},i.addQueue=function(t,e){void 0===t&&(t=J0.RENDER_OPAQUE),void 0===e&&(e="default");var i=this._lg.locateChild(this._layoutID,e),n=L4.createRenderQueue(t,i),r=L4.createRenderData(),s=this._renderGraph.addVertex(8,n,"",e,r,!1,this._vertID),o=N4.renderQueueBuilder.add();return o.update(r,this._renderGraph,this._lg,s,n,this._pipeline),o},i.addFullscreenQuad=function(t,e,i,n){void 0===i&&(i=e1.NONE),void 0===n&&(n="FullscreenQuad");var r=L4.createRenderQueue(J0.RENDER_TRANSPARENT),s=this._renderGraph.addVertex(8,r,"Queue","",L4.createRenderData(),!1,this._vertID);this._renderGraph.addVertex(T2,L4.createBlit(t,e,i,null),n,"",L4.createRenderData(),!1,s)},i.addCameraQuad=function(t,e,i,n,r){void 0===r&&(r="CameraQuad");var s=L4.createRenderQueue(J0.RENDER_TRANSPARENT),o=this._renderGraph.addVertex(8,s,"Queue","",L4.createRenderData(),!1,this._vertID);this._renderGraph.addVertex(T2,L4.createBlit(e,i,n,t),r,"",L4.createRenderData(),!1,o)},i.setViewport=function(t){this._pass.viewport.copy(t)},n(e,[{key:"name",get:function(){return this._renderGraph.getName(this._vertID)},set:function(t){this._renderGraph.setName(this._vertID,t)}},{key:"showStatistics",get:function(){return this._pass.showStatistics},set:function(t){this._pass.showStatistics=t}}]),e}(U3),O5=function(t){function e(e,i,n,r,s,o){var a;return(a=t.call(this,e,n)||this)._renderGraph=void 0,a._queue=void 0,a._pipeline=void 0,a._renderGraph=i,a._vertID=r,a._queue=s,a._pipeline=o,a}s(e,t);var i=e.prototype;return i.update=function(t,e,i,n,r,s){this._data=t,this._lg=i,this._renderGraph=e,this._vertID=n,this._queue=r,this._pipeline=s},i.setArrayBuffer=function(){throw new Error("Method not implemented.")},i.addDispatch=function(t,e,i,n,r,s){void 0===n&&(n=null),void 0===r&&(r=0),void 0===s&&(s="Dispatch"),this._renderGraph.addVertex(11,L4.createDispatch(n,r,t,e,i),s,"",L4.createRenderData(),!1,this._vertID)},n(e,[{key:"name",get:function(){return this._renderGraph.getName(this._vertID)},set:function(t){this._renderGraph.setName(this._vertID,t)}}]),e}(U3),P5=function(t){function e(e,i,n,r,s,o,a){var h;(h=t.call(this,e,n)||this)._renderGraph=void 0,h._resourceGraph=void 0,h._layoutID=void 0,h._pass=void 0,h._pipeline=void 0,h._renderGraph=i,h._resourceGraph=r,h._vertID=s,h._pass=o,h._pipeline=a;var u=h._renderGraph.getLayout(h._vertID);return h._layoutID=n.locateChild(n.N,u),h}s(e,t);var i=e.prototype;return i.update=function(t,e,i,n,r,s,o){this._data=t,this._renderGraph=e,this._lg=i,this._resourceGraph=n,this._vertID=r,this._pass=s,this._pipeline=o;var a=this._renderGraph.getLayout(this._vertID);this._layoutID=i.locateChild(i.N,a)},i.setCustomShaderStages=function(){throw new Error("Method not implemented.")},i.setArrayBuffer=function(){throw new Error("Method not implemented.")},i.addTexture=function(){throw new Error("Method not implemented.")},i.addStorageBuffer=function(t,e,i){this._addComputeResource(t,e,i)},i.addStorageImage=function(t,e,i){this._addComputeResource(t,e,i)},i.addMaterialTexture=function(){throw new Error("Method not implemented.")},i.addQueue=function(t){void 0===t&&(t="default");var e=this._lg.locateChild(this._layoutID,t),i=L4.createRenderQueue(J0.RENDER_OPAQUE,e),n=L4.createRenderData(),r=this._renderGraph.addVertex(8,i,"",t,n,!1,this._vertID),s=N4.computeQueueBuilder.add();return s.update(n,this._renderGraph,this._lg,r,i,this._pipeline),s},i._addComputeResource=function(t,e,i){var n,r=L4.createComputeView(i);r.accessType=e,this._pass.computeViews.has(t)?null===(n=this._pass.computeViews.get(t))||void 0===n||n.push(r):this._pass.computeViews.set(t,[r])},n(e,[{key:"name",get:function(){return this._renderGraph.getName(this._vertID)},set:function(t){this._renderGraph.setName(this._vertID,t)}}]),e}(U3);!function(){function t(t,e,i){this._renderGraph=void 0,this._vertID=void 0,this._pass=void 0,this._renderGraph=t,this._vertID=e,this._pass=i}var e=t.prototype;e.setCustomBehavior=function(){throw new Error("Method not implemented.")},e.addPair=function(t){this._pass.movePairs.push(t)},n(t,[{key:"name",get:function(){return this._renderGraph.getName(this._vertID)},set:function(t){this._renderGraph.setName(this._vertID,t)}}])}(),function(){function t(t,e,i){this._renderGraph=void 0,this._vertID=void 0,this._pass=void 0,this._renderGraph=t,this._vertID=e,this._pass=i}var e=t.prototype;e.addPair=function(){throw new Error("Method not implemented.")},e.setCustomBehavior=function(){throw new Error("Method not implemented.")},n(t,[{key:"name",get:function(){return this._renderGraph.getName(this._vertID)},set:function(t){this._renderGraph.setName(this._vertID,t)}}])}();var M5=function(){function t(t){this._width=0,this._height=0,this._usesDeferredPipeline=!1,this._copyPassMat=new $E,this._device=void 0,this._globalDSManager=void 0,this._defaultSampler=void 0,this._globalDescriptorSet=null,this._globalDescriptorSetInfo=null,this._globalDescriptorSetLayout=null,this._profilerDescriptorSet=null,this._macros={},this._pipelineSceneData=new oO,this._constantMacros="",this._lightingMode=r1.DEFAULT,this._profiler=null,this._cameras=[],this._resourceUses=[],this._layoutGraph=void 0,this._resourceGraph=new h2,this._renderGraph=null,this._compiler=null,this._executor=null,this._customPipelineName="",this._globalDescSetData=void 0,this._combineSignY=0,this._layoutGraph=t}var e=t.prototype;return e.addCustomBuffer=function(){throw new Error("Method not implemented.")},e.addCustomTexture=function(){throw new Error("Method not implemented.")},e.tryAddRenderWindowDepthStencil=function(t,e,i,n){i&&(n?this.addDepthStencilImpl(i,n.depthStencilTexture.format,t,e,Z0.BACKBUFFER,n):this.addDepthStencilImpl(i,pl.DEPTH_STENCIL,t,e,Z0.MANAGED))},e.addRenderWindow=function(t,e,i,n,r,s){var o=this._resourceGraph.find(t);if(4294967295!==o)return this.updateRenderWindow(t,r,s),o;this.tryAddRenderWindowDepthStencil(i,n,s,r.swapchain);var a=new V1;return a.dimension=$0.TEXTURE2D,a.width=i,a.height=n,a.depthOrArraySize=1,a.mipLevels=1,a.format=r.framebuffer.colorTextures[0].format,a.flags=t1.COLOR_ATTACHMENT,r.swapchain?this._resourceGraph.addVertex(6,new X1(r.swapchain),t,a,new W1(Z0.BACKBUFFER),new j1,new C_):(a.sampleCount=r.framebuffer.colorTextures[0].info.samples,this._resourceGraph.addVertex(5,r.framebuffer,t,a,new W1(Z0.EXTERNAL),new j1,new C_))},e.updateRenderWindow=function(t,e,i){var n=this.resourceGraph.vertex(t),r=this.resourceGraph.getDesc(n);r.width=e.width,r.height=e.height,this.resourceGraph.object(n)!==e.framebuffer&&(this.resourceGraph.x[n].j=e.framebuffer),this.tryAddRenderWindowDepthStencil(e.width,e.height,i,e.swapchain)},e.updateStorageBuffer=function(t,e,i){void 0===i&&(i=pl.UNKNOWN);var n=this.resourceGraph.vertex(t),r=this.resourceGraph.getDesc(n);r.width=e,i!==pl.UNKNOWN&&(r.format=i)},e.updateRenderTarget=function(t,e,i,n){void 0===n&&(n=pl.UNKNOWN);var r=this.resourceGraph.vertex(t),s=this.resourceGraph.getDesc(r);s.width=e,s.height=i,n!==pl.UNKNOWN&&(s.format=n)},e.updateDepthStencil=function(t,e,i,n){void 0===n&&(n=pl.UNKNOWN);var r=this.resourceGraph.find(t);4294967295!==r&&this.updateDepthStencilImpl(r,e,i,n)},e.updateStorageTexture=function(t,e,i,n){void 0===n&&(n=pl.UNKNOWN);var r=this.resourceGraph.vertex(t),s=this.resourceGraph.getDesc(r);s.width=e,s.height=i,n!==pl.UNKNOWN&&(s.format=n)},e.updateShadingRateTexture=function(t,e,i){var n=this.resourceGraph.vertex(t),r=this.resourceGraph.getDesc(n);r.width=e,r.height=i},e.addBuffer=function(t,e,i,n){var r=this._resourceGraph.find(t);if(4294967295!==r)return this.updateBuffer(t,e),r;var s=new V1;return s.dimension=$0.BUFFER,s.width=e,s.flags=i,this._resourceGraph.addVertex(0,new Z1,t,s,new W1(n),new j1,new C_(Il.LINEAR,Il.LINEAR,Il.NONE,xl.CLAMP,xl.CLAMP,xl.CLAMP))},e.updateBuffer=function(t,e){this.updateResource(t,pl.UNKNOWN,e,0,0,0,0,Rl.X1)},e.addExternalTexture=function(){throw new Error("Method not implemented.")},e.updateExternalTexture=function(){throw new Error("Method not implemented.")},e.addTexture=function(t,e,i,n,r,s,o,a,h,u,c){var l=this._resourceGraph.find(t);if(4294967295!==l)return this.updateTexture(t,i,n,r,s,o,a,h),l;var _=new V1;return _.dimension=function(t){switch(t){case Sl.TEX1D:case Sl.TEX1D_ARRAY:return $0.TEXTURE1D;case Sl.TEX2D:case Sl.TEX2D_ARRAY:case Sl.CUBE:return $0.TEXTURE2D;case Sl.TEX3D:return $0.TEXTURE3D}return $0.TEXTURE2D}(e),_.width=n,_.height=r,_.depthOrArraySize=_.dimension===$0.TEXTURE3D?s:o,_.mipLevels=a,_.format=i,_.sampleCount=h,_.flags=u,_.viewType=e,this._resourceGraph.addVertex(0,new Z1,t,_,new W1(c),new j1,new C_(Il.LINEAR,Il.LINEAR,Il.NONE,xl.CLAMP,xl.CLAMP,xl.CLAMP))},e.updateTexture=function(t,e,i,n,r,s,o,a){this.updateResource(t,e,i,n,r,s,o,a)},e.addResource=function(t,e,i,n,r,s,o,a,h,u,c){var l=this._resourceGraph.find(t);return 4294967295!==l?(this.updateResource(t,i,n,r,s,o,a,h),l):e===$0.BUFFER?this.addBuffer(t,n,u,c):this.addTexture(t,function(t,e){switch(t){case $0.TEXTURE1D:return e>1?Sl.TEX1D_ARRAY:Sl.TEX1D;case $0.TEXTURE2D:return e>1?Sl.TEX2D_ARRAY:Sl.TEX2D;case $0.TEXTURE3D:return Sl.TEX3D;case $0.BUFFER:return Sl.TEX2D}return Sl.TEX2D}(e,o),i,n,r,s,o,a,h,u,c)},e.updateResource=function(t,e,i,n,r,s,o,a){var h=this.resourceGraph.vertex(t),u=this.resourceGraph.getDesc(h);u.width=i,u.height=n,u.depthOrArraySize=u.dimension===$0.TEXTURE3D?r:s,u.mipLevels=o,e!==pl.UNKNOWN&&(u.format=e),u.sampleCount=a},e.containsResource=function(t){return this._resourceGraph.contains(t)},e.addResolvePass=function(){throw new Error("Method not implemented.")},e.addComputePass=function(t){var e=L4.createComputePass(),i=L4.createRenderData(),n=this._renderGraph.addVertex(3,e,"Compute",t,i,!1),r=N4.computePassBuilder.add();return r.update(i,this._renderGraph,this._layoutGraph,this._resourceGraph,n,e,this._pipelineSceneData),m.director.root.pipeline,r},e.addUploadPass=function(t){for(var e,i=L4.createCopyPass(),n=d(t);!(e=n()).done;){var r=e.value;i.uploadPairs.push(r)}this._renderGraph.addVertex(5,i,"UploadPass","",L4.createRenderData(),!1)},e.addCopyPass=function(t){for(var e,i=d(t);!(e=i()).done;){var n=e.value,r=n.target,s=this.resourceGraph.find(r),o=this.resourceGraph.getDesc(s),a=this.addRenderPass(o.width,o.height,"copy-pass");a.addRenderTarget(r,Bl.CLEAR,Fl.STORE,N4.createColor()),a.addTexture(n.source,"outputResultMap"),a.addQueue(J0.NONE).addFullscreenQuad(this._copyPassMat,0,e1.NONE)}},e._generateConstantMacros=function(){var t="";t+="#define CC_DEVICE_SUPPORT_FLOAT_TEXTURE "+(this._device.getFormatFeatures(pl.RGBA32F)&(Cl.RENDER_TARGET|Cl.SAMPLED_TEXTURE)?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(fl.INPUT_ATTACHMENT_BENEFIT)?1:0)+"\n",t+="#define CC_PLATFORM_ANDROID_AND_WEBGL "+(go.os===co.ANDROID&&go.isBrowser?1:0)+"\n",t+="#define CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES "+(Ie.ENABLE_WEBGL_HIGHP_STRUCT_VALUES?1:0)+"\n",t+="#define CC_JOINT_UNIFORM_CAPACITY "+Av.JOINT_UNIFORM_CAPACITY+"\n",this._constantMacros=t,this._layoutGraph.constantMacros=this._constantMacros},e.setCustomPipelineName=function(t){this._customPipelineName=t,"Deferred"===this._customPipelineName&&(this._usesDeferredPipeline=!0)},e.getGlobalDescriptorSetData=function(){var t=this.layoutGraph.locateChild(this.layoutGraph.N,"default");return this.layoutGraph.getLayout(t).descriptorSets.get(W0.PER_PASS)},e._initCombineSignY=function(){var t=this._device;this._combineSignY=.5*t.capabilities.screenSpaceSignY+.5<<1|.5*t.capabilities.clipSpaceSignY+.5},e.getCombineSignY=function(){return this._combineSignY},e._compileMaterial=function(){this._copyPassMat.initialize({effectName:"pipeline/copy-pass"});for(var t=0;t<this._copyPassMat.passes.length;++t)this._copyPassMat.passes[t].tryCompile()},e.activate=function(){this._device=Qd.gfxDevice,N4=new R5,L4=N4.renderGraphPool,function(t,e){for(var i=0;i<e._layouts.length;++i)e.getLayout(i).descriptorSets.forEach((function(e){var i=e,n=i.descriptorSetLayoutData;if(t){var r=i4(t,n);r&&(i.descriptorSetLayout=r,i.descriptorSet=t.createDescriptorSet(new q_(r)))}else e4(n,i.descriptorSetLayoutInfo)}))}(this._device,this._layoutGraph),this._globalDSManager=new p5(this._device),this._globalDescSetData=this.getGlobalDescriptorSetData(),this._globalDescriptorSetLayout=this._globalDescSetData.descriptorSetLayout,this._globalDescriptorSetInfo=new q_(this._globalDescriptorSetLayout),this._globalDescriptorSet=this._device.createDescriptorSet(this._globalDescriptorSetInfo),this._profilerDescriptorSet=this._device.createDescriptorSet(this._globalDescriptorSetInfo),this._globalDSManager.globalDescriptorSet=this.globalDescriptorSet,this._compileMaterial(),this.setMacroBool("CC_USE_HDR",this._pipelineSceneData.isHDR),this.setMacroBool("CC_USE_FLOAT_OUTPUT",Ie.ENABLE_FLOAT_OUTPUT&&Sy(this._device)),this._generateConstantMacros(!1),this._pipelineSceneData.activate(this._device),this._initCombineSignY();var e=Ey(this._device)?0:1;this.setMacroInt("CC_SHADOWMAP_FORMAT",e);var i=this._device.gfxAPI===_l.WEBGL?1:0;this.setMacroInt("CC_SHADOWMAP_USE_LINEAR_DEPTH",i);var n=m.director.root;return this._defaultSampler=n.device.getSampler(C5),this.pipelineSceneData.csmSupported=this.device.capabilities.maxFragmentUniformVectors>=t.CSM_UNIFORM_VECTORS+t.GLOBAL_UNIFORM_VECTORS,this.setMacroBool("CC_SUPPORT_CASCADED_SHADOW_MAP",this.pipelineSceneData.csmSupported),this.setMacroInt("CC_SHADOW_TYPE",0),this.setMacroInt("CC_DIR_SHADOW_PCF_TYPE",iS.HARD),this.setMacroInt("CC_DIR_LIGHT_SHADOW_TYPE",0),this.setMacroBool("CC_CASCADED_LAYERS_TRANSITION",!1),this.usesDeferredPipeline&&this.setMacroInt("CC_PIPELINE_TYPE",1),!0},e.destroy=function(){var t,e,i;return null===(t=this._globalDSManager)||void 0===t||t.globalDescriptorSet.destroy(),null===(e=this._globalDSManager)||void 0===e||e.destroy(),null===(i=this._pipelineSceneData)||void 0===i||i.destroy(),!0},e.getMacroString=function(t){var e=this._macros[t];return void 0===e?"":e},e.getMacroInt=function(t){var e=this._macros[t];return void 0===e?0:e},e.getMacroBool=function(t){var e=this._macros[t];return void 0!==e&&e},e.getSamplerInfo=function(t){if(this.containsResource(t)){var e=this._resourceGraph.vertex(t);return this._resourceGraph.getSampler(e)}return null},e.setMacroString=function(t,e){this._macros[t]=e},e.setMacroInt=function(t,e){this._macros[t]=e},e.setMacroBool=function(t,e){this._macros[t]=e},e.onGlobalPipelineStateChanged=function(){var t=m.rendering.getCustomPipeline(Ie.CUSTOM_PIPELINE_NAME);t&&("function"==typeof t.onGlobalPipelineStateChanged&&t.onGlobalPipelineStateChanged(),m.rendering.forceResizeAllWindows())},e.beginSetup=function(){this._renderGraph||(this._renderGraph=new S2),N4.reset()},e.endSetup=function(){this.compile()},e.addStorageBuffer=function(t,e,i,n){void 0===n&&(n=Z0.MANAGED);var r=this._resourceGraph.find(t);if(4294967295!==r)return this.updateStorageBuffer(t,i,e),r;var s=new V1;return s.dimension=$0.BUFFER,s.width=i,s.height=1,s.depthOrArraySize=1,s.mipLevels=1,s.format=e,s.flags=t1.STORAGE,n===Z0.PERSISTENT?this._resourceGraph.addVertex(3,new K1,t,s,new W1(Z0.PERSISTENT),new j1,new C_):this._resourceGraph.addVertex(1,new Y1,t,s,new W1(n),new j1,new C_)},e.addRenderTarget=function(t,e,i,n,r){void 0===r&&(r=Z0.MANAGED);var s=this._resourceGraph.find(t);if(4294967295!==s)return this.updateRenderTarget(t,i,n,e),s;var o=new V1;return o.dimension=$0.TEXTURE2D,o.width=i,o.height=n,o.depthOrArraySize=1,o.mipLevels=1,o.format=e,o.sampleCount=Rl.X1,o.flags=t1.COLOR_ATTACHMENT|t1.SAMPLED,this._resourceGraph.addVertex(0,new Z1,t,o,new W1(r),new j1,new C_(Il.LINEAR,Il.LINEAR,Il.NONE,xl.CLAMP,xl.CLAMP,xl.CLAMP))},e.updateDepthStencilImpl=function(t,e,i,n,r){var s=this.resourceGraph.getDesc(t);if(s.width=e,s.height=i,r){var o=this.resourceGraph.j(t);o.swapchain=r,s.format=o.swapchain.depthStencilTexture.format}else n!==pl.UNKNOWN&&(s.format=n)},e.addDepthStencilImpl=function(t,e,i,n,r,s){var o=this._resourceGraph.find(t);if(4294967295!==o)return this.updateDepthStencilImpl(o,i,n,e,s),o;var a=new V1;return a.dimension=$0.TEXTURE2D,a.width=i,a.height=n,a.depthOrArraySize=1,a.mipLevels=1,a.format=e,a.sampleCount=Rl.X1,a.flags=t1.DEPTH_STENCIL_ATTACHMENT|t1.SAMPLED,s?this._resourceGraph.addVertex(6,new X1(s,!0),t,a,new W1(r),new j1,new C_(Il.POINT,Il.POINT,Il.NONE)):this._resourceGraph.addVertex(0,new Z1,t,a,new W1(r),new j1,new C_(Il.POINT,Il.POINT,Il.NONE))},e.addDepthStencil=function(t,e,i,n,r){return void 0===r&&(r=Z0.MANAGED),this.addDepthStencilImpl(t,e,i,n,r)},e.addStorageTexture=function(t,e,i,n,r){void 0===r&&(r=Z0.MANAGED);var s=this._resourceGraph.find(t);if(4294967295!==s)return this.updateStorageTexture(t,i,n,e),s;var o=new V1;return o.dimension=$0.TEXTURE2D,o.width=i,o.height=n,o.depthOrArraySize=1,o.mipLevels=1,o.format=e,o.flags=t1.STORAGE|t1.SAMPLED,this._resourceGraph.addVertex(0,new Z1,t,o,new W1(r),new j1,new C_(Il.POINT,Il.POINT,Il.NONE))},e.addShadingRateTexture=function(t,e,i,n){void 0===n&&(n=Z0.MANAGED);var r=this._resourceGraph.find(t);if(4294967295!==r)return this.addShadingRateTexture(t,e,i),r;var s=new V1;return s.dimension=$0.TEXTURE2D,s.width=e,s.height=i,s.depthOrArraySize=1,s.mipLevels=1,s.format=pl.R8UI,s.flags=t1.SHADING_RATE|t1.STORAGE|t1.SAMPLED,this._resourceGraph.addVertex(0,new Z1,t,s,new W1(n),new j1,new C_(Il.LINEAR,Il.LINEAR,Il.NONE,xl.CLAMP,xl.CLAMP,xl.CLAMP))},e.beginFrame=function(){},e.update=function(){},e.endFrame=function(){var t;null===(t=this.renderGraph)||void 0===t||t.clear()},e.compile=function(){if(!this._renderGraph)throw new Error("RenderGraph cannot be built without being created");this._compiler||(this._compiler=new E5(this,this._renderGraph,this._resourceGraph,this._layoutGraph)),this._compiler.compile(this._renderGraph)},e.execute=function(){if(!this._renderGraph)throw new Error("Cannot run without creating rendergraph");this._executor||(this._executor=new h5(this,this._device,this._resourceGraph,this.layoutGraph,this.width,this.height)),this._executor.resize(this.width,this.height),this._executor.execute(this._renderGraph)},e._applySize=function(t){var e=this,i=this._width,n=this._height;t.forEach((function(t){var r=t.window;i=Math.max(r.width,i),n=Math.max(r.height,n),e._cameras.includes(t)||e._cameras.push(t)})),i===this._width&&n===this._height||(this._width=i,this._height=n)},e.render=function(t){0!==t.length&&(this._applySize(t),function(t){for(var e=t.length-1;e>=0;--e)if(t[e].window.swapchain)return}(t),this.beginFrame(),this.execute(),this.endFrame())},e.addBuiltinReflectionProbePass=function(t){var e=m.internal.reflectionProbeManager;if(e){var i=e.getProbes();if(0!==i.length)for(var n=0;n<i.length;n++){var r=i[n];r.needRender&&i[n].probeType===lI.PLANAR&&o3(t,this,r,r.realtimePlanarTexture.window,0)}}},e.addRenderPassImpl=function(t,e,i,n,r){void 0===n&&(n=1),void 0===r&&(r=0);var s=L4.createRasterPass();s.viewport.width=t,s.viewport.height=e,s.count=n,s.quality=r;var o=L4.createRenderData(),a=this._renderGraph.addVertex(0,s,"Raster",i,o,!1),h=N4.renderPassBuilder.add();return h.update(o,this._renderGraph,this._layoutGraph,this._resourceGraph,a,s,this._pipelineSceneData),this._updateRasterPassConstants(h,t,e,i),function(t,e){var i=e.skybox,n=m.director.root,r=n.pipeline;if(i.reflectionMap){var s=i.reflectionMap.getGFXTexture(),o=n.device.getSampler(i.reflectionMap.getSamplerInfo());t.setTexture("cc_environment",s),t.setSampler("cc_environment",o)}else{var a=i.envmap?i.envmap:NE.get("default-cube-texture");if(a){var h=a.getGFXTexture(),u=n.device.getSampler(a.getSamplerInfo());t.setTexture("cc_environment",h),t.setSampler("cc_environment",u)}}var c=i.diffuseMap?i.diffuseMap:NE.get("default-cube-texture");if(c){var l=c.getGFXTexture(),_=n.device.getSampler(c.getSamplerInfo());t.setTexture("cc_diffuseMap",l),t.setSampler("cc_diffuseMap",_)}t.hasSampler("cc_shadowMap")||t.setSampler("cc_shadowMap",r.defaultSampler),t.hasTexture("cc_shadowMap")||t.setTexture("cc_shadowMap",r.defaultShadowTexture),t.hasSampler("cc_spotShadowMap")||t.setSampler("cc_spotShadowMap",r.defaultSampler),t.hasTexture("cc_spotShadowMap")||t.setTexture("cc_spotShadowMap",r.defaultShadowTexture)}(h,this._pipelineSceneData),h},e.addRenderPass=function(t,e,i){return void 0===i&&(i="default"),this.addRenderPassImpl(t,e,i)},e.addMultisampleRenderPass=function(t,e,i,n,r){return void 0===r&&(r="default"),this.addRenderPassImpl(t,e,r,i,n)},e.getDescriptorSetLayout=function(t,e){var i=this._layoutGraph,n=i.shaderLayoutIndex.get(t);return i.getLayout(n).descriptorSets.get(e).descriptorSetLayout},e._updateRasterPassConstants=function(t,e,i){var n=m.director,r=n.root,s=e,o=i;r.pipeline.layoutGraph,b5.set(r.cumulativeTime,r.frameTime,n.getTotalFrames()),t.setVec4("cc_time",b5),b5.set(s,o,1/s,1/o),t.setVec4("cc_screenSize",b5),b5.set(s,o,1/s,1/o),t.setVec4("cc_nativeSize",b5);var a=r.debugView;if(b5.set(0,0,0,0),a){for(var h=[a.singleMode,0,0,0],u=0;u<17;u++){var c=u%8;h[1+(u>>3)]+=(a.isCompositeModeEnabled(u)?1:0)*Math.pow(10,c)}h[3]+=(a.lightingWithAlbedo?1:0)*Math.pow(10,6),h[3]+=(a.csmLayerColoration?1:0)*Math.pow(10,7),b5.set(h[0],h[1],h[2],h[3])}t.setVec4("cc_debug_view_mode",b5)},n(t,[{key:"type",get:function(){return b2.BASIC}},{key:"capabilities",get:function(){return new w2}},{key:"enableCpuLightCulling",get:function(){return!this._executor||this._executor._context.culling.enableLightCulling},set:function(t){this._executor&&(this._executor._context.culling.enableLightCulling=t)}},{key:"globalDescriptorSetData",get:function(){return this._globalDescSetData}},{key:"defaultSampler",get:function(){return this._defaultSampler}},{key:"defaultShadowTexture",get:function(){return Ty(this.device)}},{key:"device",get:function(){return this._device}},{key:"lightingMode",get:function(){return this._lightingMode},set:function(t){this._lightingMode=t}},{key:"usesDeferredPipeline",get:function(){return this._usesDeferredPipeline}},{key:"macros",get:function(){return this._macros}},{key:"globalDSManager",get:function(){return this._globalDSManager}},{key:"descriptorSetLayout",get:function(){return this._globalDSManager.descriptorSetLayout}},{key:"descriptorSet",get:function(){return this._globalDSManager.globalDescriptorSet}},{key:"profilerDescriptorSet",get:function(){return this._profilerDescriptorSet}},{key:"globalDescriptorSet",get:function(){return this._globalDescriptorSet}},{key:"globalDescriptorSetInfo",get:function(){return this._globalDescriptorSetInfo}},{key:"commandBuffers",get:function(){return[this._device.commandBuffer]}},{key:"pipelineSceneData",get:function(){return this._pipelineSceneData}},{key:"constantMacros",get:function(){return this._constantMacros}},{key:"profiler",get:function(){return this._profiler},set:function(t){this._profiler=t}},{key:"geometryRenderer",get:function(){throw new Error("Method not implemented.")}},{key:"shadingScale",get:function(){return this._pipelineSceneData.shadingScale},set:function(t){this._pipelineSceneData.shadingScale=t}},{key:"width",get:function(){return this._width}},{key:"height",get:function(){return this._height}},{key:"renderGraph",get:function(){return this._renderGraph}},{key:"resourceGraph",get:function(){return this._resourceGraph}},{key:"layoutGraph",get:function(){return this._layoutGraph}},{key:"resourceUses",get:function(){return this._resourceUses}}]),t}();M5.MAX_BLOOM_FILTER_PASS_NUM=6,M5.CSM_UNIFORM_VECTORS=61,M5.GLOBAL_UNIFORM_VECTORS=64,function(){function t(){this.capacity=0,this.size=0,this.buffer=void 0,this.dataView=void 0,this.capacity=4096,this.buffer=new Uint8Array(this.capacity),this.dataView=new DataView(this.buffer.buffer)}var e=t.prototype;e.b=function(t){var e=this.size+1;e>this.capacity&&this.reserve(e),this.dataView.setUint8(this.size,t?1:0),this.size=e},e.n=function(t){var e=this.size+8;e>this.capacity&&this.reserve(e),this.dataView.setFloat64(this.size,t,!0),this.size=e},e.s=function(t){this.n(t.length);var e=this.size+t.length;e>this.capacity&&this.reserve(e);for(var i=0;i<t.length;i++)this.dataView.setUint8(this.size+i,t.charCodeAt(i));this.size=e},e.reserve=function(t){var e=Math.max(t,2*this.capacity),i=this.buffer;this.buffer=new Uint8Array(e),this.buffer.set(i),this.dataView=new DataView(this.buffer.buffer),this.capacity=e},n(t,[{key:"data",get:function(){return this.buffer.buffer.slice(0,this.size)}}])}();var N5=function(){function t(t,e){this.offset=0,this.dataView=void 0,this.dataView=new DataView(t,e)}var e=t.prototype;return e.b=function(){return 0!==this.dataView.getUint8(this.offset++)},e.n=function(){var t=this.dataView.getFloat64(this.offset,!0);return this.offset+=8,t},e.s=function(){var t=this.n(),e=String.fromCharCode.apply(null,Array.from(new Uint8Array(this.dataView.buffer,this.offset,t)));return this.offset+=t,e},t}(),L5=function(t,e,i,n,r){this.programInfo=t,this.shaderInfo=e,this.attributes=i,this.blockSizes=n,this.handleMap=r},B5=function(){this.programInfos=new Map,this.programProxies=new Map},F5=[2,1,3,0];function k5(t,e){var i=r({},e);return i.effectName=t,Zy(i),i}function U5(t,e){for(var i,n=d(t.blocks);!(i=n()).done;){var r=i.value;if(r.name===e)return{set:r.set,binding:r.binding}}for(var s,o=d(t.buffers);!(s=o()).done;){var a=s.value;if(a.name===e)return{set:a.set,binding:a.binding}}for(var h,u=d(t.samplerTextures);!(h=u()).done;){var c=h.value;if(c.name===e)return{set:c.set,binding:c.binding}}for(var l,_=d(t.samplers);!(l=_()).done;){var f=l.value;if(f.name===e)return{set:f.set,binding:f.binding}}for(var p,g=d(t.textures);!(p=g()).done;){var m=p.value;if(m.name===e)return{set:m.set,binding:m.binding}}for(var v,y=d(t.images);!(v=y()).done;){var T=v.value;if(T.name===e)return{set:T.set,binding:T.binding}}for(var E,S=d(t.subpassInputs);!(E=S()).done;){var A=E.value;if(A.name===e)return{set:A.set,binding:A.binding}}throw k("binding not found in shaderInfo!")}function G5(t,e){for(var i=e,n=/layout\s*\(([^)])+\)\s+uniform\s+(\b\w+\b\s+)?sampler(\w+)\s+(\b\w+\b)/g,r=n.exec(i);r;){var s=U5(t,r[4]),o="layout(set = "+s.set+", binding = "+s.binding+") uniform "+(r[2]?r[2]:"")+" sampler"+r[3]+" "+r[4];i=i.replace(r[0],o),r=n.exec(i)}for(var a=/layout\s*\(([^)]+)\)\s*(readonly|writeonly)?\s*\b((uniform\s*|buffer\s*|image2D\s*){1,2})\b\s*(\b\w+\b)\s*[{;]/g,h=a.exec(i);h;){var u=U5(t,h[5]),c=u.set,l=u.binding,_=h[2]?h[2]:"",d=" {";h[3].includes("image")&&(d=";");var f=h[1],p="layout("+(f=(f=f.replace(/set\s*=\s*\d+/g,"set = "+c)).replace(/binding\s*=\s*\d+/g,"binding = "+l))+") "+_+" "+h[3]+" "+h[5]+d;i=i.replace(h[0],p),h=a.exec(i)}return i}function H5(t,e){!function(t,e){"glsl4"===eT(Qd.gfxDevice)&&(e.glsl4.vert&&(e.glsl4.vert=G5(t,e.glsl4.vert)),e.glsl4.frag&&(e.glsl4.frag=G5(t,e.glsl4.frag)),e.glsl4.compute&&(e.glsl4.compute=G5(t,e.glsl4.compute)))}(t,e);for(var i,n=F5[W0.PER_BATCH],r=d(e.blocks);!(i=r()).done;){for(var s,o=i.value,a=!1,h=d(t.blocks);!(s=h()).done;){var u=s.value;if(u.set===n&&u.name===o.name){o.binding=u.binding,a=!0;break}}a||k("Block "+o.name+" not found in shader "+t.name)}}function z5(t,e,i,n,r){for(var s,o=d(t.descriptorBlocks);!(s=o()).done;){var a=s.value,h=a.visibility,u=a.offset;switch(a.type){case h1.UNIFORM_BUFFER:for(var c,l=d(e.blocks);!(c=l()).done;){var _=c.value;_.stageFlags===h&&(r.push(Ky(_.members)),n.blocks.push(new w_(i,u,_.name,_.members.map((function(t){return new R_(t.name,t.type,t.count)})),1)),++u)}break;case h1.DYNAMIC_UNIFORM_BUFFER:break;case h1.SAMPLER_TEXTURE:for(var f,p=d(e.samplerTextures);!(f=p()).done;){var g=f.value;g.stageFlags===h&&(n.samplerTextures.push(new I_(i,u,g.name,g.type,g.count)),++u)}break;case h1.SAMPLER:for(var m,v=d(e.samplers);!(m=v()).done;){var y=m.value;y.stageFlags===h&&(n.samplers.push(new x_(i,u,y.name,y.count)),++u)}break;case h1.TEXTURE:for(var T,E=d(e.textures);!(T=E()).done;){var S=T.value;S.stageFlags===h&&(n.textures.push(new D_(i,u,S.name,S.type,S.count)),++u)}break;case h1.STORAGE_BUFFER:for(var A,b=d(e.buffers);!(A=b()).done;){var C=A.value;C.stageFlags===h&&(n.buffers.push(new P_(i,u,C.name,1,C.memoryAccess)),++u)}break;case h1.DYNAMIC_STORAGE_BUFFER:break;case h1.STORAGE_IMAGE:for(var R,w=d(e.images);!(R=w()).done;){var I=R.value;I.stageFlags===h&&(n.images.push(new O_(i,u,I.name,I.type,I.count,I.memoryAccess)),++u)}break;case h1.INPUT_ATTACHMENT:for(var x,D=d(e.subpassInputs);!(x=D()).done;){var O=x.value;O.stageFlags===h&&(n.subpassInputs.push(new M_(i,O.binding,O.name,O.count)),++u)}}}}function V5(t,e,i,n,r){for(var s,o=d(e.descriptorBlocks);!(s=o()).done;){var a=s.value,h=a.offset;switch(a.type){case h1.UNIFORM_BUFFER:for(var u,c=d(a.descriptors);!(u=c()).done;){var l=u.value,_=e.uniformBlocks.get(l.descriptorID);void 0!==_?(r.push(Ky(_.members)),n.blocks.push(new w_(i,h,t[l.descriptorID],_.members.map((function(t){return new R_(t.name,t.type,t.count)})),1)),++h):k("Failed to find uniform block "+l.descriptorID+" in layout")}h!==a.offset+a.capacity&&k("Uniform buffer binding mismatch for set "+i);break;case h1.DYNAMIC_UNIFORM_BUFFER:break;case h1.SAMPLER_TEXTURE:for(var f,p=d(a.descriptors);!(f=p()).done;){var g=f.value;n.samplerTextures.push(new I_(i,h,t[g.descriptorID],g.type,g.count)),++h}break;case h1.SAMPLER:for(var m,v=d(a.descriptors);!(m=v()).done;){var y=m.value;n.samplers.push(new x_(i,h,t[y.descriptorID],y.count)),++h}break;case h1.TEXTURE:for(var T,E=d(a.descriptors);!(T=E()).done;){var S=T.value;n.textures.push(new D_(i,h,t[S.descriptorID],S.type,S.count)),++h}break;case h1.STORAGE_BUFFER:for(var A,b=d(a.descriptors);!(A=b()).done;){var C=A.value;n.buffers.push(new P_(i,h,t[C.descriptorID],1,Tl.READ_WRITE)),++h}break;case h1.DYNAMIC_STORAGE_BUFFER:break;case h1.STORAGE_IMAGE:for(var R,w=d(a.descriptors);!(R=w()).done;){var I=R.value;n.images.push(new O_(i,h,t[I.descriptorID],I.type,I.count,Tl.READ_WRITE)),++h}break;case h1.INPUT_ATTACHMENT:for(var x,D=d(a.descriptors);!(x=D()).done;){var O=x.value;n.subpassInputs.push(new M_(i,h,t[O.descriptorID],O.count)),++h}}}}function W5(t,e,i,n,r,s){var o=[null,null,null,null],a=null,h=new B_,u=new Array,c=e.descriptorSets.get(W0.PER_PASS);c&&(o[W0.PER_PASS]=c.descriptorSetLayoutData,V5(t.valueNames,c.descriptorSetLayoutData,F5[W0.PER_PASS],h,u));var l=i.descriptorSets.get(W0.PER_PHASE);l&&(o[W0.PER_PHASE]=l.descriptorSetLayoutData,V5(t.valueNames,l.descriptorSetLayoutData,F5[W0.PER_PHASE],h,u));var _=n.descriptors[W0.PER_BATCH];if(r){var f=r.layout.descriptorSets.get(W0.PER_BATCH);f&&(o[W0.PER_BATCH]=f.descriptorSetLayoutData,V5(t.valueNames,f.descriptorSetLayoutData,F5[W0.PER_BATCH],h,u))}else{var p=i.descriptorSets.get(W0.PER_BATCH);p&&(o[W0.PER_BATCH]=p.descriptorSetLayoutData,z5(p.descriptorSetLayoutData,_,F5[W0.PER_BATCH],h,u))}var g=n.descriptors[W0.PER_INSTANCE];if(r)if(s)a=zm,function(t,e,i,n){for(var r=F5[W0.PER_INSTANCE],s=function(){var s=t.blocks[o],a=e.layouts[s.name],h=a&&e.bindings.find((function(t){return t.binding===a.binding}));if(!(a&&h&&h.descriptorType&ad))return console.warn("builtin UBO '"+s.name+"' not available!"),1;n.push(Ky(s.members)),i.blocks.push(new w_(r,h.binding,s.name,s.members.map((function(t){return new R_(t.name,t.type,t.count)})),1))},o=0;o<t.blocks.length;o++)s();for(var a=function(){var n=t.samplerTextures[h],s=e.layouts[n.name],o=s&&e.bindings.find((function(t){return t.binding===s.binding}));if(!(s&&o&&o.descriptorType&hd))return console.warn("builtin samplerTexture '"+n.name+"' not available!"),1;i.samplerTextures.push(new I_(r,o.binding,n.name,n.type,n.count))},h=0;h<t.samplerTextures.length;h++)a()}(g,zm,h,u);else{var m=r.layout.descriptorSets.get(W0.PER_INSTANCE);m&&(o[W0.PER_INSTANCE]=m.descriptorSetLayoutData,V5(t.valueNames,m.descriptorSetLayoutData,F5[W0.PER_INSTANCE],h,u))}else{var v=i.descriptorSets.get(W0.PER_INSTANCE);v&&(o[W0.PER_INSTANCE]=v.descriptorSetLayoutData,z5(v.descriptorSetLayoutData,g,F5[W0.PER_INSTANCE],h,u))}return function(t,e,i){var n,r,s,o,a=new Array(4),h=(null===(n=t[W0.PER_PASS])||void 0===n?void 0:n.uniformBlockCapacity)||0,u=(null===(r=t[W0.PER_PHASE])||void 0===r?void 0:r.uniformBlockCapacity)||0,c=(null===(s=t[W0.PER_BATCH])||void 0===s?void 0:s.uniformBlockCapacity)||0,l=e?function(t){for(var e,i=0,n=d(t.bindings);!(e=n()).done;){var r=e.value;r.descriptorType!==Yl.UNIFORM_BUFFER&&r.descriptorType!==Yl.DYNAMIC_UNIFORM_BUFFER||(i+=r.count)}return i}(e):(null===(o=t[W0.PER_INSTANCE])||void 0===o?void 0:o.uniformBlockCapacity)||0;a[F5[W0.PER_PASS]]=h,a[F5[W0.PER_PHASE]]=u,a[F5[W0.PER_BATCH]]=c,a[F5[W0.PER_INSTANCE]]=l;var _=0+h,f=_+u,p=f+l,g=new Array(4);g[F5[W0.PER_PASS]]=0,g[F5[W0.PER_PHASE]]=_,g[F5[W0.PER_BATCH]]=p,g[F5[W0.PER_INSTANCE]]=f,function(t,e){for(var i,n=d(e);!(i=n()).done;){var r=i.value;r.flattened=t[r.set]+r.binding}}(g,i.blocks);var m,v,y,T=0+((null===(m=t[W0.PER_PASS])||void 0===m?void 0:m.samplerTextureCapacity)||0),E=T+((null===(v=t[W0.PER_PHASE])||void 0===v?void 0:v.samplerTextureCapacity)||0),S=E+(e?function(t){for(var e,i=0,n=d(t.bindings);!(e=n()).done;){var r=e.value;r.descriptorType!==Yl.UNIFORM_BUFFER&&r.descriptorType!==Yl.DYNAMIC_UNIFORM_BUFFER&&(i+=r.count)}return i}(e):(null===(y=t[W0.PER_INSTANCE])||void 0===y?void 0:y.samplerTextureCapacity)||0),A=new Array(4);A[F5[W0.PER_PASS]]=0,A[F5[W0.PER_PHASE]]=T,A[F5[W0.PER_BATCH]]=S,A[F5[W0.PER_INSTANCE]]=E,function(t,e,i){for(var n,r=d(i);!(n=r()).done;){var s=n.value;s.flattened=t[s.set]+s.binding-e[s.set]}}(A,a,i.samplerTextures)}(o,a,h),h.stages.push(new N_(Ll.VERTEX,"")),h.stages.push(new N_(Ll.FRAGMENT,"")),[h,u]}var X5=function(){function t(t,e){void 0===e&&(e=null),this.shader=void 0,this.pipelineState=null,this.shader=t,this.pipelineState=e}return n(t,[{key:"name",get:function(){return this.shader.name}}]),t}();function j5(t,e){for(var i in t.layouts){var n=t.layouts[i];if(n.binding===e){U(n.name===i);var r=ml.UNKNOWN;return(n instanceof I_||n instanceof O_)&&(r=n.type),[n.name,r]}}return k("descriptor not found"),["",ml.UNKNOWN]}function Y5(t,e){for(var i,n=new D2,r=d(e.bindings);!(i=r()).done;){var s=i.value,o=j5(e,s.binding),a=o[0],h=o[1],u=t4(t,a),c=j3(s.descriptorType),l=new x2(c,s.stageFlags,s.count);l.offset=s.binding,l.descriptors.push(new I2(u,h,s.count)),n.descriptorBlocks.push(l),void 0!==n.bindingMap.get(u)&&k("duplicate descriptor name '"+a+"'"),n.bindingMap.set(u,s.binding);var _=e.layouts[a];_ instanceof w_&&n.uniformBlocks.set(u,_)}return n}function K5(t,e,i,n,r,s){var o=r4(i,W0.PER_BATCH,F5[W0.PER_BATCH],e.descriptors[W0.PER_BATCH]),a=new O2(o);if(s4(a.descriptorSetLayoutData,a.descriptorSetLayoutInfo),r.layout.descriptorSets.set(W0.PER_BATCH,a),s){var h=Y5(i,zm),u=new O2(h);if(s4(u.descriptorSetLayoutData,u.descriptorSetLayoutInfo),zm.bindings.length!==u.descriptorSetLayoutInfo.bindings.length)k("local descriptor set layout inconsistent");else for(var c=0;c!==zm.bindings.length;++c){var l=zm.bindings[c],_=u.descriptorSetLayoutInfo.bindings[c];l.binding===_.binding&&l.descriptorType===_.descriptorType&&l.count===_.count&&l.stageFlags===_.stageFlags||k("local descriptor set layout inconsistent")}r.layout.descriptorSets.set(W0.PER_INSTANCE,u)}else{var d=r4(i,W0.PER_INSTANCE,F5[W0.PER_INSTANCE],e.descriptors[W0.PER_INSTANCE]),f=new O2(d);s4(f.descriptorSetLayoutData,f.descriptorSetLayoutInfo),r.layout.descriptorSets.set(W0.PER_INSTANCE,f)}var p=n.shaderPrograms.length;n.shaderIndex.set(t,p),n.shaderPrograms.push(r)}function q5(t,e,i,n,r){U(r<W0.PER_PHASE);var s=e.j(i),o=s.shaderIndex.get(n);if(void 0===o)return a4();var a=s.shaderPrograms[o].layout.descriptorSets.get(r);return void 0===a?a4():(a.descriptorSetLayout||(a.descriptorSetLayout=t.createDescriptorSetLayout(a.descriptorSetLayoutInfo)),a.descriptorSetLayout)}function Q5(t,e,i,n,r){U(r<W0.PER_PHASE);var s=e.j(i),o=s.shaderIndex.get(n);if(void 0===o)return null;var a=s.shaderPrograms[o].layout.descriptorSets.get(r);return void 0===a?null:(a.descriptorSetLayout||(a.descriptorSetLayout=t.createDescriptorSetLayout(a.descriptorSetLayoutInfo)),a.descriptorSetLayout)}function Z5(t,e,i){var n=i.program,r=Y3(t,i.pass);if(r===W3)return k("Invalid render pass, program: "+n),[W3,W3,W3,null,W3];var s=i.subpass&&""!==i.subpass&&!0,o=s?K3(t,r,i.subpass):W3;if(s&&o===W3)return k("Invalid render subpass, program: "+n),[W3,W3,W3,null,W3];var a=q3(t,o===W3?r:o,i.phase);if(a===W3)return k("Invalid render phase, program: "+n),[W3,W3,W3,null,W3];for(var h=null,u=W3,c=0;c<e.shaders.length;++c){var l=e.shaders[c];if(l.name===n){h=l,u=c;break}}return[r,o,a,h,u]}function J5(t){return void 0===t.descriptors?(k("No descriptors in shader: "+t.name+", please reimport ALL effects"),1):0}var $5=function(){function t(t){this.layoutGraph=void 0,this.phases=new Map,this.mergeHighFrequency=!1,this.fixedLocal=!0,this.localLayoutData=new D2,this.localDescriptorSetLayout=null,this.emptyDescriptorSetLayout=null,this.emptyPipelineLayout=null,this.pipeline=null,this.device=null,this.layoutGraph=t;for(var e,i=d(t.v());!(e=i()).done;){var n=e.value;t.h(1,n)&&this.phases.set(n,new B5)}}var e=t.prototype;return e.init=function(t){if(this.device!==t){this.device=t,this.emptyDescriptorSetLayout=this.device.createDescriptorSetLayout(new K_),this.emptyPipelineLayout=this.device.createPipelineLayout(new Q_);var e=Math.floor((this.device.capabilities.maxVertexUniformVectors-38)/3);e=e<256?e:256,Av.initLayout(e);for(var i,n=this.layoutGraph,r=d(n.v());!(i=r()).done;)for(var s,o=i.value,a=d(n.getLayout(o).descriptorSets);!(s=a()).done;){var h=s.value;h[0];var u=h[1];s4(u.descriptorSetLayoutData,u.descriptorSetLayoutInfo),u.descriptorSetLayout=this.device.createDescriptorSetLayout(u.descriptorSetLayoutInfo),U(!!u.descriptorSetLayout),u.descriptorSet=this.device.createDescriptorSet(new q_(u.descriptorSetLayout)),U(!!u.descriptorSet)}for(var c,l=d(n.v());!(c=l()).done;){var _=c.value;if(n.h(1,_)){var f=_,p=n.getParent(f),g=n.getLayout(p),m=n.getLayout(f),v=new Q_;o4(g,W0.PER_PASS,v),o4(m,W0.PER_PHASE,v),o4(m,W0.PER_BATCH,v),o4(m,W0.PER_INSTANCE,v),n.j(f).pipelineLayout=this.device.createPipelineLayout(v)}}var y=zm;this.localLayoutData=Y5(n,y);var T,E=new K_;s4(this.localLayoutData,E),this.localDescriptorSetLayout=this.device.createDescriptorSetLayout(E),U(!!this.localDescriptorSetLayout);for(var S,A=0,b=d(this.localLayoutData.descriptorBlocks);!(S=b()).done;){var C=S.value;if(C.type===h1.UNIFORM_BUFFER||C.type===h1.DYNAMIC_UNIFORM_BUFFER)for(var R,w=d(C.descriptors);!(R=w()).done;)A+=R.value.count}U(7===A),T=this.device,this.layoutGraph.constantMacros,T.getFormatFeatures(pl.RGBA32F),Cl.RENDER_TARGET,Cl.SAMPLED_TEXTURE,T.capabilities.maxVertexUniformVectors,T.capabilities.maxFragmentUniformVectors,T.hasFeature(fl.INPUT_ATTACHMENT_BENEFIT),Av.JOINT_UNIFORM_CAPACITY}},e.addEffect=function(t){for(var e,i=this.layoutGraph,n=d(t.techniques);!(e=n()).done;)for(var r,s=d(e.value.passes);!(r=s()).done;){var o=r.value,a=o.program,h=Z5(i,t,o),u=h[0],c=h[1],l=h[2],_=h[3];if(null===_||J5(_))k("program: "+a+" not found");else{U(u!==W3&&l!==W3);var f=c===W3?u:c,p=i.getLayout(f),g=i.getLayout(l),m=this.phases.get(l);void 0===m&&(m=new B5,this.phases.set(l,m));var v=m.programInfos,y=k5(t.name,_),T=null;if(!this.mergeHighFrequency){var E=i.j(l);K5(a,_,i,E,T=new F2,this.fixedLocal)}var S=W5(i,p,g,_,T,this.fixedLocal),A=S[0],b=S[1];H5(A,y);for(var C,R=qy(A),w=new Array,I=d(y.attributes);!(C=I()).done;){var x=C.value;w.push(new L_(x.name,x.format,x.isNormalized,0,x.isInstanced,x.location))}var D=new L5(y,A,w,b,R);v.set(_.name,D)}}},e.precompileEffect=function(t,e){for(var i,n=this,r=this.layoutGraph,s=d(e.techniques);!(i=s()).done;)for(var o,a=function(){var i=o.value,s=i.program,a=Z5(r,e,i),h=a[0];a[1];var u=a[2],c=a[3],l=a[4];if(null===c||J5(c))return k("program: "+s+" not valid"),0;U(h!==W3&&u!==W3&&l!==W3);var _=e.combinations[l];if(!_)return 0;Jy(_).forEach((function(e){return n.getProgramVariant(t,u,s,e)}))},h=d(i.value.passes);!(o=h()).done;)a()},e.getProgramInfo=function(t,e){return U(t!==W3),this.phases.get(t).programInfos.get(e).programInfo},e.getShaderInfo=function(t,e){return U(t!==W3),this.phases.get(t).programInfos.get(e).shaderInfo},e.getKey=function(t,e,i){U(t!==W3);var n=this.phases.get(t);if(void 0===n)return k("Invalid render phase, program: "+e),"";var r=n.programInfos.get(e);return void 0===r?(k("Invalid program, program: "+e),""):Xy(r.programInfo,i)},e.getProgramVariant=function(t,e,i,n,r){var s;void 0===r&&(r=null),Object.assign(n,null===(s=this.pipeline)||void 0===s?void 0:s.macros),U(e!==W3);var o=this.phases.get(e);if(void 0===o)return k("Invalid render phase, program: "+i),null;var a=o.programInfos.get(i);if(void 0===a)return k("Invalid program, program: "+i),null;var h=a.programInfo;null===r&&(r=Xy(h,n));var u=o.programProxies,c=u.get(r);if(void 0!==c)return c;var l=Hy(n,h.defines),_=this.layoutGraph.constantMacros+h.constantMacros+l.reduce((function(t,e){return t+"#define "+e.name+" "+e.value+"\n"}),""),d=h.glsl3,f=eT(t);f?d=h[f]:Z(16346);var p=a.shaderInfo;d.compute?(p.stages[0].source=_+d.compute,p.stages[0].stage=Ll.COMPUTE,p.stages.length=1):(p.stages[0].source=_+d.vert,p.stages[1].source=_+d.frag),p.attributes=Wy(h,a.attributes,n),p.name=zy(i,l);var g=t.createShader(p),m=new X5(g);return u.set(r,m),m},e.getMaterialDescriptorSetLayout=function(t,e,i){if(this.mergeHighFrequency){U(e!==W3);var n=this.layoutGraph.getParent(e);return u4(this.layoutGraph,n,e,W0.PER_BATCH)}return q5(t,this.layoutGraph,e,i,W0.PER_BATCH)},e.getLocalDescriptorSetLayout=function(t,e,i){if(this.mergeHighFrequency){U(e!==W3);var n=this.layoutGraph.getParent(e);return u4(this.layoutGraph,n,e,W0.PER_INSTANCE)}return q5(t,this.layoutGraph,e,i,W0.PER_INSTANCE)},e.getBlockSizes=function(t,e){U(t!==W3);var i=this.phases.get(t);if(!i)return k("Invalid render phase, program: "+e),[];var n=i.programInfos.get(e);return n?n.blockSizes:(k("Invalid program, program: "+e),[])},e.getHandleMap=function(t,e){U(t!==W3);var i=this.phases.get(t);if(!i)return k("Invalid render phase, program: "+e),{};var n=i.programInfos.get(e);return n?n.handleMap:(k("Invalid program, program: "+e),{})},e.getPipelineLayout=function(t,e,i){if(this.mergeHighFrequency)return U(e!==W3),this.layoutGraph.j(e).pipelineLayout;var n=this.layoutGraph,r=n.j(e),s=r.shaderIndex.get(i);if(void 0===s)return h4();var o=r.shaderPrograms[s];if(o.pipelineLayout)return o.pipelineLayout;var a=n.getParent(e);if(a===W3)return h4();var h=new Q_,u=c4(this.layoutGraph,a,e,W0.PER_PASS);u&&h.setLayouts.push(u);var c=c4(this.layoutGraph,a,e,W0.PER_PHASE);c&&h.setLayouts.push(c);var l=Q5(t,n,e,i,W0.PER_BATCH);l&&h.setLayouts.push(l);var _=Q5(t,n,e,i,W0.PER_INSTANCE);return _&&h.setLayouts.push(_),o.pipelineLayout=t.createPipelineLayout(h),o.pipelineLayout},e.getProgramID=function(t,e){return function(t,e,i){U(e!==t.N);var n=t.j(e).shaderIndex.get(i);return void 0===n?W3:n}(this.layoutGraph,t,e)},e.getDescriptorNameID=function(t){return function(t,e){var i=t.attributeIndex.get(e);return void 0===i?W3:i}(this.layoutGraph,t)},e.getDescriptorName=function(t){return function(t,e){return e>=t.valueNames.length?"":t.valueNames[e]}(this.layoutGraph,t)},t}(),t6=null,e6=!1;function i6(){e6=!0}var n6=[],r6=4294967295,s6=new H2,o6=new $5(s6),a6=new Map,h6=Object.freeze({__proto__:null,INVALID_ID:r6,enableEffectImport:!0,programLib:o6,createCustomPipeline:function(){var t=new M5(s6),e=Ie.CUSTOM_PIPELINE_NAME;return t.setCustomPipelineName(e),o6.pipeline=t,t},customPipelineBuilderMap:a6,setCustomPipeline:function(t,e){a6.set(t,e),i6()},getCustomPipeline:function(t){var e=a6.get(t);return e||(e=a6.get("Forward")),e},init:function(t,e){if(e&&e.byteLength>=8){var i=new Uint8Array(e);if(new DataView(i.buffer,i.byteOffset,8).getUint32(0)===r6){var n=new jO.Inflate(new Uint8Array(i.buffer,i.byteOffset+8)).decompress();t3(new N5(n.buffer,n.byteOffset),s6)}else t3(new N5(i.buffer,i.byteOffset),s6)}!function(t,e){Q3=t.createDescriptorSetLayout(new K_),Z3=t.createPipelineLayout(new Q_);for(var i,n=d(e.v());!(i=n()).done;)for(var r,s=i.value,o=d(e.getLayout(s).descriptorSets);!(r=o()).done;){var a=r.value;a[0];var h=a[1];null!==h.descriptorSetLayout&&F("descriptor set layout already initialized. It will be overwritten"),s4(h.descriptorSetLayoutData,h.descriptorSetLayoutInfo),h.descriptorSetLayout=t.createDescriptorSetLayout(h.descriptorSetLayoutInfo)}for(var u,c=d(e.v());!(u=c()).done;){var l=u.value;if(e.h(1,l)){var _=e.getParent(l),f=l,p=e.getLayout(_),g=e.getLayout(f),m=new Q_;o4(p,W0.PER_PASS,m),o4(g,W0.PER_PHASE,m),o4(g,W0.PER_BATCH,m),o4(g,W0.PER_INSTANCE,m),e.j(f).pipelineLayout=t.createPipelineLayout(m)}}}(t,s6)},destroy:function(){!function(t){for(var e,i=d(t.v());!(e=i()).done;)for(var n,r=e.value,s=d(t.getLayout(r).descriptorSets);!(n=s()).done;){var o=n.value;o[0];var a=o[1];null!==a.descriptorSetLayout&&a.descriptorSetLayout.destroy()}Z3.destroy(),Q3.destroy()}(s6)},getPassID:function(t){return Y3(s6,t)},getSubpassID:function(t,e){return K3(s6,t,e)},getPhaseID:function(t,e){return q3(s6,t,e)},completePhaseName:function(t){return"number"==typeof t?t.toString():"string"==typeof t?t:"default"},get UpdateFrequency(){return W0},ParameterType:i1,get ResourceResidency(){return Z0},get QueueHint(){return J0},get ResourceDimension(){return $0},get ResourceFlags(){return t1},TaskType:{SYNC:0,ASYNC:1},get SceneFlags(){return e1},LightingMode:r1,AttachmentType:s1,get AccessType(){return n1},ClearValueType:o1,LightInfo:a1,DescriptorTypeOrder:h1,Descriptor:u1,DescriptorBlock:c1,DescriptorBlockFlattened:l1,DescriptorBlockIndex:_1,ResolveFlags:d1,ResolvePair:f1,CopyPair:p1,UploadPair:g1,MovePair:m1,PipelineStatistics:v1,RenderCommonObjectPool:A1,saveLightInfo:function(t,e){t.n(e.level),t.b(e.culledByLight)},loadLightInfo:function(t,e){e.level=t.n(),e.culledByLight=t.b()},saveDescriptor:b1,loadDescriptor:C1,saveDescriptorBlock:function(t,e){t.n(e.descriptors.size);for(var i,n=d(e.descriptors);!(i=n()).done;){var r=i.value,s=r[0],o=r[1];t.s(s),b1(t,o)}t.n(e.uniformBlocks.size);for(var a,h=d(e.uniformBlocks);!(a=h()).done;){var u=a.value,c=u[0],l=u[1];t.s(c),K0(t,l)}t.n(e.capacity),t.n(e.count)},loadDescriptorBlock:function(t,e){var i=0;i=t.n();for(var n=0;n!==i;++n){var r=t.s(),s=new u1;C1(t,s),e.descriptors.set(r,s)}i=t.n();for(var o=0;o!==i;++o){var a=t.s(),h=new w_;q0(t,h),e.uniformBlocks.set(a,h)}e.capacity=t.n(),e.count=t.n()},saveDescriptorBlockFlattened:function(t,e){t.n(e.descriptorNames.length);for(var i,n=d(e.descriptorNames);!(i=n()).done;){var r=i.value;t.s(r)}t.n(e.uniformBlockNames.length);for(var s,o=d(e.uniformBlockNames);!(s=o()).done;){var a=s.value;t.s(a)}t.n(e.descriptors.length);for(var h,u=d(e.descriptors);!(h=u()).done;)b1(t,h.value);t.n(e.uniformBlocks.length);for(var c,l=d(e.uniformBlocks);!(c=l()).done;)K0(t,c.value);t.n(e.capacity),t.n(e.count)},loadDescriptorBlockFlattened:function(t,e){var i=0;i=t.n(),e.descriptorNames.length=i;for(var n=0;n!==i;++n)e.descriptorNames[n]=t.s();i=t.n(),e.uniformBlockNames.length=i;for(var r=0;r!==i;++r)e.uniformBlockNames[r]=t.s();i=t.n(),e.descriptors.length=i;for(var s=0;s!==i;++s){var o=new u1;C1(t,o),e.descriptors[s]=o}i=t.n(),e.uniformBlocks.length=i;for(var a=0;a!==i;++a){var h=new w_;q0(t,h),e.uniformBlocks[a]=h}e.capacity=t.n(),e.count=t.n()},saveDescriptorBlockIndex:function(t,e){t.n(e.updateFrequency),t.n(e.parameterType),t.n(e.descriptorType),t.n(e.visibility)},loadDescriptorBlockIndex:function(t,e){e.updateFrequency=t.n(),e.parameterType=t.n(),e.descriptorType=t.n(),e.visibility=t.n()},saveResolvePair:function(t,e){t.s(e.source),t.s(e.target),t.n(e.resolveFlags),t.n(e.mode),t.n(e.mode1)},loadResolvePair:function(t,e){e.source=t.s(),e.target=t.s(),e.resolveFlags=t.n(),e.mode=t.n(),e.mode1=t.n()},saveCopyPair:function(t,e){t.s(e.source),t.s(e.target),t.n(e.mipLevels),t.n(e.numSlices),t.n(e.sourceMostDetailedMip),t.n(e.sourceFirstSlice),t.n(e.sourcePlaneSlice),t.n(e.targetMostDetailedMip),t.n(e.targetFirstSlice),t.n(e.targetPlaneSlice)},loadCopyPair:function(t,e){e.source=t.s(),e.target=t.s(),e.mipLevels=t.n(),e.numSlices=t.n(),e.sourceMostDetailedMip=t.n(),e.sourceFirstSlice=t.n(),e.sourcePlaneSlice=t.n(),e.targetMostDetailedMip=t.n(),e.targetFirstSlice=t.n(),e.targetPlaneSlice=t.n()},saveMovePair:function(t,e){t.s(e.source),t.s(e.target),t.n(e.mipLevels),t.n(e.numSlices),t.n(e.targetMostDetailedMip),t.n(e.targetFirstSlice),t.n(e.targetPlaneSlice)},loadMovePair:function(t,e){e.source=t.s(),e.target=t.s(),e.mipLevels=t.n(),e.numSlices=t.n(),e.targetMostDetailedMip=t.n(),e.targetFirstSlice=t.n(),e.targetPlaneSlice=t.n()},savePipelineStatistics:function(t,e){t.n(e.numRenderPasses),t.n(e.numManagedTextures),t.n(e.totalManagedTextures),t.n(e.numUploadBuffers),t.n(e.numUploadBufferViews),t.n(e.numFreeUploadBuffers),t.n(e.numFreeUploadBufferViews),t.n(e.numDescriptorSets),t.n(e.numFreeDescriptorSets),t.n(e.numInstancingBuffers),t.n(e.numInstancingUniformBlocks)},loadPipelineStatistics:function(t,e){e.numRenderPasses=t.n(),e.numManagedTextures=t.n(),e.totalManagedTextures=t.n(),e.numUploadBuffers=t.n(),e.numUploadBufferViews=t.n(),e.numFreeUploadBuffers=t.n(),e.numFreeUploadBufferViews=t.n(),e.numDescriptorSets=t.n(),e.numFreeDescriptorSets=t.n(),e.numInstancingBuffers=t.n(),e.numInstancingUniformBlocks=t.n()},get PipelineType(){return b2},get SubpassCapabilities(){return C2},PipelineCapabilities:w2,packRGBE: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=Pi((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 _n(0,0,0),new _n(1,1,1));r.multiplyScalar(255);var s,o,a=En(r).add((s=r.subtract(En(r)))<(o=new _n(.5,.5,.5))?o:s);return new on(a.x/255,a.y/255,a.z/255,i/255)},setEditorPipelineSettings:function(t){t6=t,e6=!0},getEditorPipelineSettings:function(){return t6},forceResizeAllWindows:i6,defaultWindowResize:function(t,e,i,n){t.addRenderWindow(e.colorName,pl.BGRA8,i,n,e),t.addDepthStencil(e.depthStencilName,pl.DEPTH_STENCIL,i,n);var r=e.renderWindowId,s=Ey(t.device)?pl.R32F:pl.RGBA8,o=t.pipelineSceneData.shadows.size;t.addRenderTarget("ShadowMap"+r,s,o.x,o.y),t.addDepthStencil("ShadowDepth"+r,pl.DEPTH_STENCIL,o.x,o.y)},dispatchResizeEvents:function(t,e,i){if(e.windowResize){for(var n,r=d(t);!(n=r()).done;){var s=n.value;if(s.window.isRenderWindowResized()||e6){var o=Math.max(Math.floor(s.window.width),1),a=Math.max(Math.floor(s.window.height),1);e.windowResize(i,s.window,s,o,a),n6.push(s.window)}}for(var h,u=d(n6);!(h=u()).done;)h.value.setRenderWindowResizeHandled();n6.length=0,e6=!1}}});t("rendering",h6),m.rendering=h6;var u6,c6=function(t){function e(){var e;return(e=t.call(this)||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 o=0;o<i.length;++o)for(var a=i[o],h=0;h<a.count;h++)s.push({type:a.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&ad){var i=this._buffers[e];i&&(t[e].gpuBuffer=i.gpuBuffer||i.gpuBufferView)}else t[e].type&hd&&(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}(Rd);!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"}(u6||(u6={}));var l6=function(){function t(){}return t.setInstance=function(e){t._instance=e},n(t,null,[{key:"instance",get:function(){return t._instance}}]),t}();function _6(t,e){switch(t){case pl.R8:return e.UNSIGNED_BYTE;case pl.R8SN:return e.BYTE;case pl.R8UI:return e.UNSIGNED_BYTE;case pl.R8I:return e.BYTE;case pl.R16F:return u6.HALF_FLOAT_OES;case pl.R16UI:return e.UNSIGNED_SHORT;case pl.R16I:return e.SHORT;case pl.R32F:return e.FLOAT;case pl.R32UI:return e.UNSIGNED_INT;case pl.R32I:return e.INT;case pl.RG8:return e.UNSIGNED_BYTE;case pl.RG8SN:return e.BYTE;case pl.RG8UI:return e.UNSIGNED_BYTE;case pl.RG8I:return e.BYTE;case pl.RG16F:return u6.HALF_FLOAT_OES;case pl.RG16UI:return e.UNSIGNED_SHORT;case pl.RG16I:return e.SHORT;case pl.RG32F:return e.FLOAT;case pl.RG32UI:return e.UNSIGNED_INT;case pl.RG32I:return e.INT;case pl.RGB8:case pl.SRGB8:return e.UNSIGNED_BYTE;case pl.RGB8SN:return e.BYTE;case pl.RGB8UI:return e.UNSIGNED_BYTE;case pl.RGB8I:return e.BYTE;case pl.RGB16F:return u6.HALF_FLOAT_OES;case pl.RGB16UI:return e.UNSIGNED_SHORT;case pl.RGB16I:return e.SHORT;case pl.RGB32F:return e.FLOAT;case pl.RGB32UI:return e.UNSIGNED_INT;case pl.RGB32I:return e.INT;case pl.BGRA8:case pl.RGBA8:case pl.SRGB8_A8:return e.UNSIGNED_BYTE;case pl.RGBA8SN:return e.BYTE;case pl.RGBA8UI:return e.UNSIGNED_BYTE;case pl.RGBA8I:return e.BYTE;case pl.RGBA16F:return u6.HALF_FLOAT_OES;case pl.RGBA16UI:return e.UNSIGNED_SHORT;case pl.RGBA16I:return e.SHORT;case pl.RGBA32F:return e.FLOAT;case pl.RGBA32UI:return e.UNSIGNED_INT;case pl.RGBA32I:return e.INT;case pl.R5G6B5:return e.UNSIGNED_SHORT_5_6_5;case pl.R11G11B10F:return e.FLOAT;case pl.RGB5A1:return e.UNSIGNED_SHORT_5_5_5_1;case pl.RGBA4:return e.UNSIGNED_SHORT_4_4_4_4;case pl.RGB10A2:return e.UNSIGNED_BYTE;case pl.RGB10A2UI:return e.UNSIGNED_INT;case pl.RGB9E5:return e.UNSIGNED_BYTE;case pl.DEPTH:return e.UNSIGNED_INT;case pl.DEPTH_STENCIL:return u6.UNSIGNED_INT_24_8_WEBGL;case pl.BC1:case pl.BC1_SRGB:case pl.BC2:case pl.BC2_SRGB:case pl.BC3:case pl.BC3_SRGB:case pl.BC4:return e.UNSIGNED_BYTE;case pl.BC4_SNORM:return e.BYTE;case pl.BC5:return e.UNSIGNED_BYTE;case pl.BC5_SNORM:return e.BYTE;case pl.BC6H_SF16:case pl.BC6H_UF16:return e.FLOAT;case pl.BC7:case pl.BC7_SRGB:case pl.ETC_RGB8:case pl.ETC2_RGB8:case pl.ETC2_SRGB8:case pl.ETC2_RGB8_A1:case pl.ETC2_SRGB8_A1:case pl.EAC_R11:return e.UNSIGNED_BYTE;case pl.EAC_R11SN:return e.BYTE;case pl.EAC_RG11:return e.UNSIGNED_BYTE;case pl.EAC_RG11SN:return e.BYTE;case pl.PVRTC_RGB2:case pl.PVRTC_RGBA2:case pl.PVRTC_RGB4:case pl.PVRTC_RGBA4:case pl.PVRTC2_2BPP:case pl.PVRTC2_4BPP:return e.UNSIGNED_BYTE;case pl.ASTC_RGBA_4X4:case pl.ASTC_RGBA_5X4:case pl.ASTC_RGBA_5X5:case pl.ASTC_RGBA_6X5:case pl.ASTC_RGBA_6X6:case pl.ASTC_RGBA_8X5:case pl.ASTC_RGBA_8X6:case pl.ASTC_RGBA_8X8:case pl.ASTC_RGBA_10X5:case pl.ASTC_RGBA_10X6:case pl.ASTC_RGBA_10X8:case pl.ASTC_RGBA_10X10:case pl.ASTC_RGBA_12X10:case pl.ASTC_RGBA_12X12:case pl.ASTC_SRGBA_4X4:case pl.ASTC_SRGBA_5X4:case pl.ASTC_SRGBA_5X5:case pl.ASTC_SRGBA_6X5:case pl.ASTC_SRGBA_6X6:case pl.ASTC_SRGBA_8X5:case pl.ASTC_SRGBA_8X6:case pl.ASTC_SRGBA_8X8:case pl.ASTC_SRGBA_10X5:case pl.ASTC_SRGBA_10X6:case pl.ASTC_SRGBA_10X8:case pl.ASTC_SRGBA_10X10:case pl.ASTC_SRGBA_12X10:case pl.ASTC_SRGBA_12X12:default:return e.UNSIGNED_BYTE}}function d6(t,e){switch(t){case ml.BOOL:return e.BOOL;case ml.BOOL2:return e.BOOL_VEC2;case ml.BOOL3:return e.BOOL_VEC3;case ml.BOOL4:return e.BOOL_VEC4;case ml.INT:return e.INT;case ml.INT2:return e.INT_VEC2;case ml.INT3:return e.INT_VEC3;case ml.INT4:return e.INT_VEC4;case ml.UINT:return e.UNSIGNED_INT;case ml.FLOAT:return e.FLOAT;case ml.FLOAT2:return e.FLOAT_VEC2;case ml.FLOAT3:return e.FLOAT_VEC3;case ml.FLOAT4:return e.FLOAT_VEC4;case ml.MAT2:return e.FLOAT_MAT2;case ml.MAT3:return e.FLOAT_MAT3;case ml.MAT4:return e.FLOAT_MAT4;case ml.SAMPLER2D:return e.SAMPLER_2D;case ml.SAMPLER_CUBE:return e.SAMPLER_CUBE;default:return Z(16311),ml.UNKNOWN}}function f6(t){switch(t){case ml.BOOL:case ml.BOOL2:case ml.BOOL3:case ml.BOOL4:case ml.INT:case ml.INT2:case ml.INT3:case ml.INT4:case ml.UINT:return Int32Array;case ml.FLOAT:case ml.FLOAT2:case ml.FLOAT3:case ml.FLOAT4:case ml.MAT2:case ml.MAT3:case ml.MAT4:return Float32Array;default:return Z(16312),Float32Array}}function p6(t,e){switch(t){case e.BOOL:return ml.BOOL;case e.BOOL_VEC2:return ml.BOOL2;case e.BOOL_VEC3:return ml.BOOL3;case e.BOOL_VEC4:return ml.BOOL4;case e.INT:return ml.INT;case e.INT_VEC2:return ml.INT2;case e.INT_VEC3:return ml.INT3;case e.INT_VEC4:return ml.INT4;case e.UNSIGNED_INT:return ml.UINT;case e.FLOAT:return ml.FLOAT;case e.FLOAT_VEC2:return ml.FLOAT2;case e.FLOAT_VEC3:return ml.FLOAT3;case e.FLOAT_VEC4:return ml.FLOAT4;case e.FLOAT_MAT2:return ml.MAT2;case e.FLOAT_MAT3:return ml.MAT3;case e.FLOAT_MAT4:return ml.MAT4;case e.SAMPLER_2D:return ml.SAMPLER2D;case e.SAMPLER_CUBE:return ml.SAMPLER_CUBE;default:return Z(16313),ml.UNKNOWN}}function g6(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 Z(16314),0}}function m6(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}}l6._instance=null;var v6,y6=[512,513,514,515,516,517,518,519],T6=[0,7680,7681,7682,7683,5386,34055,34056],E6=[32774,32778,32779,32775,32776],S6=[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"}(v6||(v6={}));var A6=function(t){this.refCount=0,this.cmdType=t},b6=function(t){function e(){var e;return(e=t.call(this,v6.BEGIN_RENDER_PASS)||this).gpuRenderPass=null,e.gpuFramebuffer=null,e.renderArea=new o_,e.clearFlag=Zl.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}(A6),C6=function(t){function e(){var e;return(e=t.call(this,v6.BIND_STATES)||this).gpuPipelineState=null,e.gpuInputAssembler=null,e.gpuDescriptorSets=[],e.dynamicOffsets=[],e.dynamicStates=new rd,e}return s(e,t),e.prototype.clear=function(){this.gpuPipelineState=null,this.gpuDescriptorSets.length=0,this.gpuInputAssembler=null,this.dynamicOffsets.length=0},e}(A6),R6=function(t){function e(){var e;return(e=t.call(this,v6.DRAW)||this).drawInfo=new T_,e}return s(e,t),e.prototype.clear=function(){},e}(A6),w6=function(t){function e(){var e;return(e=t.call(this,v6.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}(A6),I6=function(t){function e(){var e;return(e=t.call(this,v6.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}(A6),x6=function(t){function e(){var e;return(e=t.call(this,v6.BLIT_TEXTURE)||this).srcTexture=null,e.dstTexture=null,e.regions=[],e.filter=Il.LINEAR,e}return s(e,t),e.prototype.clear=function(){this.srcTexture=null,this.dstTexture=null,this.regions.length=0},e}(A6),D6=function(){function t(){this.cmds=new js(1),this.beginRenderPassCmds=new js(1),this.bindStatesCmds=new js(1),this.drawCmds=new js(1),this.updateBufferCmds=new js(1),this.copyBufferToTextureCmds=new js(1),this.blitTextureCmds=new js(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 O6(t,e){var i=t.gl,n=t.stateCache,r=e.memUsage&El.HOST?i.DYNAMIC_DRAW:i.STATIC_DRAW;if(e.usage&vl.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),k6.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&vl.INDEX){e.glTarget=i.ELEMENT_ARRAY_BUFFER;var o=i.createBuffer();o&&(e.glBuffer=o,e.size>0&&(t.extensions.useVAO&&n.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),n.glVAO=null),k6.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&vl.UNIFORM?(e.glTarget=i.NONE,e.buffer&&(e.vf32=new Float32Array(e.buffer.buffer))):(e.usage&vl.INDIRECT||e.usage&vl.TRANSFER_DST||e.usage&vl.TRANSFER_SRC||Z(16315),e.glTarget=i.NONE)}function P6(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),k6.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),k6.gpuInputAssembler=null,i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,null),t.stateCache.glElementArrayBuffer=null}i.deleteBuffer(e.glBuffer),e.glBuffer=null}}function M6(t,e,i,n,r){if(e.usage&vl.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&vl.INDIRECT){e.indirects.clearDraws();for(var s=i.drawInfos,o=0;o<s.length;++o)e.indirects.setDrawInfo(n+o,s[o])}else{var a=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),k6.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),k6.gpuInputAssembler=null,t.stateCache.glElementArrayBuffer!==e.glBuffer&&(h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,e.glBuffer),t.stateCache.glElementArrayBuffer=e.glBuffer);break;default:return void Z(16316)}go.os===co.IOS&&e.memUsage&El.HOST&&0===n&&r===a.byteLength?h.bufferData(e.glTarget,a,h.DYNAMIC_DRAW):r===a.byteLength?h.bufferSubData(e.glTarget,n,a):h.bufferSubData(e.glTarget,n,a.slice(0,r))}}function N6(t,e){for(var i,n=t.gl,r=function(){var t=e.gpuStages[s],i=0,r="",o=1;switch(t.type){case Ll.VERTEX:r="VertexShader",i=n.VERTEX_SHADER;break;case Ll.FRAGMENT:r="FragmentShader",i=n.FRAGMENT_SHADER;break;default:return Z(16322),{v:void 0}}var a=n.createShader(i);if(a&&(t.glShader=a,n.shaderSource(t.glShader,t.source),n.compileShader(t.glShader),!n.getShaderParameter(t.glShader,n.COMPILE_STATUS))){Z(16323,r,e.name),Z(16324,t.source.replace(/^|\n/g,(function(){return"\n"+o+++" "}))),k(n.getShaderInfoLog(t.glShader));for(var h=0;h<e.gpuStages.length;h++){var u=e.gpuStages[s];u.glShader&&(n.deleteShader(u.glShader),u.glShader=null)}return{v:void 0}}},s=0;s<e.gpuStages.length;s++)if(i=r())return i.v;var o=n.createProgram();if(o){e.glProgram=o;for(var a=0;a<e.gpuStages.length;a++){var h=e.gpuStages[a];n.attachShader(e.glProgram,h.glShader)}if(n.linkProgram(e.glProgram),t.extensions.destroyShadersImmediately)for(var u=0;u<e.gpuStages.length;u++){var c=e.gpuStages[u];c.glShader&&(n.detachShader(e.glProgram,c.glShader),n.deleteShader(c.glShader),c.glShader=null)}if(!n.getProgramParameter(e.glProgram,n.LINK_STATUS))return Z(16326,e.name),void k(n.getProgramInfoLog(e.glProgram));Y(16325,e.name);var l=n.getProgramParameter(e.glProgram,n.ACTIVE_ATTRIBUTES);e.glInputs=new Array(l);for(var _=0;_<l;++_){var d=n.getActiveAttrib(e.glProgram,_);if(d){var f,p=d.name.indexOf("[");f=-1!==p?d.name.substr(0,p):d.name;var g=n.getAttribLocation(e.glProgram,f),v=p6(d.type,n),y=g6(d.type,n);e.glInputs[_]={binding:g,name:f,type:v,stride:y,count:d.size,size:y*d.size,glType:d.type,glLoc:g}}}if(e.blocks.length>0){e.glBlocks=new Array(e.blocks.length);for(var T=0;T<e.blocks.length;++T){var E=e.blocks[T],S={set:E.set,binding:E.binding,name:E.name,size:0,glUniforms:new Array(E.members.length),glActiveUniforms:[]};e.glBlocks[T]=S;for(var A=0;A<E.members.length;++A){var b=E.members[A],C=d6(b.type,n),R=g6(C,n),w=R*b.count;S.glUniforms[A]={binding:-1,name:b.name,type:b.type,stride:R,count:b.count,size:w,offset:0,glType:C,glLoc:null,array:null}}}}for(var I=0;I<e.subpassInputs.length;++I){var x=e.subpassInputs[I];e.samplerTextures.push(new I_(x.set,x.binding,x.name,ml.SAMPLER2D,x.count))}if(e.samplerTextures.length>0){e.glSamplerTextures=new Array(e.samplerTextures.length);for(var D=0;D<e.samplerTextures.length;++D){var O=e.samplerTextures[D];e.glSamplerTextures[D]={set:O.set,binding:O.binding,name:O.name,type:O.type,count:O.count,units:[],glUnits:null,glType:d6(O.type,n),glLoc:null}}}for(var P=n.getProgramParameter(e.glProgram,n.ACTIVE_UNIFORMS),M=0;M<P;++M){var N=n.getActiveUniform(e.glProgram,M);if(N&&N.type!==n.SAMPLER_2D&&N.type!==n.SAMPLER_CUBE){var L=n.getUniformLocation(e.glProgram,N.name);if(t.extensions.isLocationActive(L)){var B,F=N.name.indexOf("[");B=-1!==F?N.name.substr(0,F):N.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=N.size,z.size=z.stride*z.count,z.array=new(f6(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 K=[],q=[],Q=t.bindingMappings,J=t.stateCache.texUnitCacheMap;if(m.rendering&&m.rendering.enableEffectImport)for(var $=0;$<e.samplerTextures.length;++$){var tt=e.samplerTextures[$],et=n.getUniformLocation(e.glProgram,tt.name);t.extensions.isLocationActive(et)&&(K.push(e.glSamplerTextures[$]),q.push(et)),void 0===J[tt.name]&&(J[tt.name]=tt.flattened%t.capabilities.maxTextureUnits)}else{for(var it=0,nt=0;nt<e.blocks.length;++nt)e.blocks[nt].set===Q.flexibleSet&&it++;for(var rt=0,st=0;st<e.samplerTextures.length;++st){var ot=e.samplerTextures[st],at=n.getUniformLocation(e.glProgram,ot.name);if(t.extensions.isLocationActive(at)&&(K.push(e.glSamplerTextures[st]),q.push(at)),void 0===J[ot.name]){var ht=ot.binding+Q.samplerTextureOffsets[ot.set]+rt;ot.set===Q.flexibleSet&&(ht-=it),J[ot.name]=ht%t.capabilities.maxTextureUnits,rt+=ot.count-1}}}if(K.length){for(var ut=[],ct=0;ct<K.length;++ct){var lt=K[ct],_t=J[lt.name];if(void 0!==_t){lt.glLoc=q[ct];for(var dt=0;dt<lt.count;++dt){for(;ut[_t];)_t=(_t+1)%t.capabilities.maxTextureUnits;lt.units.push(_t),ut[_t]=!0}}}for(var ft=0,pt=0;pt<K.length;++pt){var gt=K[pt];if(!t.extensions.isLocationActive(gt.glLoc)){gt.glLoc=q[pt];for(var mt=0;mt<gt.count;++mt){for(;ut[ft];)ft=(ft+1)%t.capabilities.maxTextureUnits;void 0===J[gt.name]&&(J[gt.name]=ft),gt.units.push(ft),ut[ft]=!0}}}t.stateCache.glProgram!==e.glProgram&&n.useProgram(e.glProgram);for(var vt=0;vt<K.length;vt++){var yt=K[vt];yt.glUnits=new Int32Array(yt.units),n.uniform1iv(yt.glLoc,yt.glUnits)}t.stateCache.glProgram!==e.glProgram&&n.useProgram(t.stateCache.glProgram)}for(var Tt=0;Tt<e.glBlocks.length;)e.glBlocks[Tt].glActiveUniforms.length?Tt++:(e.glBlocks[Tt]=e.glBlocks[e.glBlocks.length-1],e.glBlocks.length--);e.glSamplerTextures=K}}function L6(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 B6(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],o=void 0!==s.stream?s.stream:0,a=e.gpuVertexBuffers[o],h=_6(s.format,i),u=od[s.format].size;e.glAttribs[r]={name:s.name,glBuffer:a.glBuffer,glType:h,size:u,count:od[s.format].count,stride:a.stride,componentCount:m6(h,i),isNormalized:void 0!==s.isNormalized&&s.isNormalized,isInstanced:void 0!==s.isInstanced&&s.isInstanced,offset:n[o]},n[o]+=u}}function F6(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 k6={gpuPipelineState:null,gpuInputAssembler:null,glPrimitive:0},U6=new o_;function G6(t,e,i,n,r,s,o){var a=t.gl,h=t.stateCache,u=0;if(i&&(U6.x=n.x<<i.lodLevel,U6.y=n.y<<i.lodLevel,U6.width=n.width<<i.lodLevel,U6.height=n.height<<i.lodLevel),i&&e){h.glFramebuffer!==i.glFramebuffer&&(a.bindFramebuffer(a.FRAMEBUFFER,i.glFramebuffer),h.glFramebuffer=i.glFramebuffer),h.viewport.left===U6.x&&h.viewport.top===U6.y&&h.viewport.width===U6.width&&h.viewport.height===U6.height||(a.viewport(U6.x,U6.y,U6.width,U6.height),h.viewport.left=U6.x,h.viewport.top=U6.y,h.viewport.width=U6.width,h.viewport.height=U6.height),h.scissorRect.x===U6.x&&h.scissorRect.y===U6.y&&h.scissorRect.width===U6.width&&h.scissorRect.height===U6.height||(a.scissor(U6.x,U6.y,U6.width,U6.height),h.scissorRect.x=U6.x,h.scissorRect.y=U6.y,h.scissorRect.width=U6.width,h.scissorRect.height=U6.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!==pl.UNKNOWN)switch(_.loadOp){case Bl.LOAD:break;case Bl.CLEAR:h.bs.targets[0].blendColorMask!==Nl.ALL&&a.colorMask(!0,!0,!0,!0);var d=r[0];a.clearColor(d.x,d.y,d.z,d.w),u|=a.COLOR_BUFFER_BIT;break;case Bl.DISCARD:}}if(e.depthStencilAttachment&&e.depthStencilAttachment.format!==pl.UNKNOWN){switch(e.depthStencilAttachment.depthLoadOp){case Bl.LOAD:break;case Bl.CLEAR:h.dss.depthWrite||a.depthMask(!0),a.clearDepth(s),u|=a.DEPTH_BUFFER_BIT;break;case Bl.DISCARD:}if(od[e.depthStencilAttachment.format].hasStencil)switch(e.depthStencilAttachment.stencilLoadOp){case Bl.LOAD:break;case Bl.CLEAR:h.dss.stencilWriteMaskFront||a.stencilMaskSeparate(a.FRONT,65535),h.dss.stencilWriteMaskBack||a.stencilMaskSeparate(a.BACK,65535),a.clearStencil(o),u|=a.STENCIL_BUFFER_BIT;break;case Bl.DISCARD:}}if(u&&a.clear(u),u&a.COLOR_BUFFER_BIT){var f=h.bs.targets[0].blendColorMask;if(f!==Nl.ALL){var p=(f&Nl.R)!==Nl.NONE,g=(f&Nl.G)!==Nl.NONE,m=(f&Nl.B)!==Nl.NONE,v=(f&Nl.A)!==Nl.NONE;a.colorMask(p,g,m,v)}}u&a.DEPTH_BUFFER_BIT&&!h.dss.depthWrite&&a.depthMask(!1),u&a.STENCIL_BUFFER_BIT&&(h.dss.stencilWriteMaskFront||a.stencilMaskSeparate(a.FRONT,0),h.dss.stencilWriteMaskBack||a.stencilMaskSeparate(a.BACK,0))}}function H6(t,e,i,n,r,s){var o,a,h,u=t.gl,c=t.stateCache,l=e&&e.gpuShader,_=!1;if(e&&k6.gpuPipelineState!==e){if(k6.gpuPipelineState=e,k6.glPrimitive=e.glPrimitive,e.gpuShader){var d=e.gpuShader.glProgram;c.glProgram!==d&&(u.useProgram(d),c.glProgram=d,_=!0)}var f=e.rs;if(f){if(c.rs.cullMode!==f.cullMode){switch(f.cullMode){case Wl.NONE:u.disable(u.CULL_FACE);break;case Wl.FRONT:u.enable(u.CULL_FACE),u.cullFace(u.FRONT);break;case Wl.BACK:u.enable(u.CULL_FACE),u.cullFace(u.BACK)}c.rs.cullMode=f.cullMode}var p=f.isFrontFaceCCW;c.rs.isFrontFaceCCW!==p&&(u.frontFace(p?u.CCW:u.CW),c.rs.isFrontFaceCCW=p),c.rs.depthBias===f.depthBias&&c.rs.depthBiasSlop===f.depthBiasSlop||(u.polygonOffset(f.depthBias,f.depthBiasSlop),c.rs.depthBias=f.depthBias,c.rs.depthBiasSlop=f.depthBiasSlop),c.rs.lineWidth!==f.lineWidth&&(u.lineWidth(f.lineWidth),c.rs.lineWidth=f.lineWidth)}var g=e.dss;g&&(c.dss.depthTest!==g.depthTest&&(g.depthTest?u.enable(u.DEPTH_TEST):u.disable(u.DEPTH_TEST),c.dss.depthTest=g.depthTest),c.dss.depthWrite!==g.depthWrite&&(u.depthMask(g.depthWrite),c.dss.depthWrite=g.depthWrite),c.dss.depthFunc!==g.depthFunc&&(u.depthFunc(y6[g.depthFunc]),c.dss.depthFunc=g.depthFunc),c.dss.stencilTestFront===g.stencilTestFront&&c.dss.stencilTestBack===g.stencilTestBack||(g.stencilTestFront||g.stencilTestBack?u.enable(u.STENCIL_TEST):u.disable(u.STENCIL_TEST),c.dss.stencilTestFront=g.stencilTestFront,c.dss.stencilTestBack=g.stencilTestBack),c.dss.stencilFuncFront===g.stencilFuncFront&&c.dss.stencilRefFront===g.stencilRefFront&&c.dss.stencilReadMaskFront===g.stencilReadMaskFront||(u.stencilFuncSeparate(u.FRONT,y6[g.stencilFuncFront],g.stencilRefFront,g.stencilReadMaskFront),c.dss.stencilFuncFront=g.stencilFuncFront,c.dss.stencilRefFront=g.stencilRefFront,c.dss.stencilReadMaskFront=g.stencilReadMaskFront),c.dss.stencilFailOpFront===g.stencilFailOpFront&&c.dss.stencilZFailOpFront===g.stencilZFailOpFront&&c.dss.stencilPassOpFront===g.stencilPassOpFront||(u.stencilOpSeparate(u.FRONT,T6[g.stencilFailOpFront],T6[g.stencilZFailOpFront],T6[g.stencilPassOpFront]),c.dss.stencilFailOpFront=g.stencilFailOpFront,c.dss.stencilZFailOpFront=g.stencilZFailOpFront,c.dss.stencilPassOpFront=g.stencilPassOpFront),c.dss.stencilWriteMaskFront!==g.stencilWriteMaskFront&&(u.stencilMaskSeparate(u.FRONT,g.stencilWriteMaskFront),c.dss.stencilWriteMaskFront=g.stencilWriteMaskFront),c.dss.stencilFuncBack===g.stencilFuncBack&&c.dss.stencilRefBack===g.stencilRefBack&&c.dss.stencilReadMaskBack===g.stencilReadMaskBack||(u.stencilFuncSeparate(u.BACK,y6[g.stencilFuncBack],g.stencilRefBack,g.stencilReadMaskBack),c.dss.stencilFuncBack=g.stencilFuncBack,c.dss.stencilRefBack=g.stencilRefBack,c.dss.stencilReadMaskBack=g.stencilReadMaskBack),c.dss.stencilFailOpBack===g.stencilFailOpBack&&c.dss.stencilZFailOpBack===g.stencilZFailOpBack&&c.dss.stencilPassOpBack===g.stencilPassOpBack||(u.stencilOpSeparate(u.BACK,T6[g.stencilFailOpBack],T6[g.stencilZFailOpBack],T6[g.stencilPassOpBack]),c.dss.stencilFailOpBack=g.stencilFailOpBack,c.dss.stencilZFailOpBack=g.stencilZFailOpBack,c.dss.stencilPassOpBack=g.stencilPassOpBack),c.dss.stencilWriteMaskBack!==g.stencilWriteMaskBack&&(u.stencilMaskSeparate(u.BACK,g.stencilWriteMaskBack),c.dss.stencilWriteMaskBack=g.stencilWriteMaskBack));var m=e.bs;if(m){c.bs.isA2C!==m.isA2C&&(m.isA2C?u.enable(u.SAMPLE_ALPHA_TO_COVERAGE):u.disable(u.SAMPLE_ALPHA_TO_COVERAGE),c.bs.isA2C=m.isA2C),c.bs.blendColor.x===m.blendColor.x&&c.bs.blendColor.y===m.blendColor.y&&c.bs.blendColor.z===m.blendColor.z&&c.bs.blendColor.w===m.blendColor.w||(u.blendColor(m.blendColor.x,m.blendColor.y,m.blendColor.z,m.blendColor.w),c.bs.blendColor.x=m.blendColor.x,c.bs.blendColor.y=m.blendColor.y,c.bs.blendColor.z=m.blendColor.z,c.bs.blendColor.w=m.blendColor.w);var v=m.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(E6[v.blendEq],E6[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(S6[v.blendSrc],S6[v.blendDst],S6[v.blendSrcAlpha],S6[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&Nl.R)!==Nl.NONE,(v.blendColorMask&Nl.G)!==Nl.NONE,(v.blendColorMask&Nl.B)!==Nl.NONE,(v.blendColorMask&Nl.A)!==Nl.NONE),y.blendColorMask=v.blendColorMask)}}if(e&&e.gpuPipelineLayout&&l){for(var T=l.glBlocks.length,E=e.gpuPipelineLayout.dynamicOffsetIndices,S=0;S<T;S++){var A=l.glBlocks[S],b=n[A.set],C=b&&b.descriptorIndices[A.binding],R=C>=0&&b.gpuDescriptors[C],w=null,I=0;if(R&&R.gpuBuffer){var x=R.gpuBuffer,D=E[A.set],O=D&&D[A.binding];O>=0&&(I=r[O]),"vf32"in x?w=x.vf32:(I+=x.offset,w=x.gpuBuffer.vf32),I>>=2}if(w)for(var P=A.glActiveUniforms.length,M=0;M<P;M++){var N=A.glActiveUniforms[M];switch(N.glType){case u.BOOL:case u.INT:for(var L=0;L<N.array.length;++L){var B=N.offset+I+L;if(w[B]!==N.array[L]){for(var F=L,k=B;F<N.array.length;++F,++k)N.array[F]=w[k];u.uniform1iv(N.glLoc,N.array);break}}break;case u.BOOL_VEC2:case u.INT_VEC2:for(var U=0;U<N.array.length;++U){var G=N.offset+I+U;if(w[G]!==N.array[U]){for(var H=U,z=G;H<N.array.length;++H,++z)N.array[H]=w[z];u.uniform2iv(N.glLoc,N.array);break}}break;case u.BOOL_VEC3:case u.INT_VEC3:for(var V=0;V<N.array.length;++V){var W=N.offset+I+V;if(w[W]!==N.array[V]){for(var X=V,j=W;X<N.array.length;++X,++j)N.array[X]=w[j];u.uniform3iv(N.glLoc,N.array);break}}break;case u.BOOL_VEC4:case u.INT_VEC4:for(var Y=0;Y<N.array.length;++Y){var K=N.offset+I+Y;if(w[K]!==N.array[Y]){for(var q=Y,Q=K;q<N.array.length;++q,++Q)N.array[q]=w[Q];u.uniform4iv(N.glLoc,N.array);break}}break;case u.FLOAT:for(var Z=0;Z<N.array.length;++Z){var J=N.offset+I+Z;if(w[J]!==N.array[Z]){for(var $=Z,tt=J;$<N.array.length;++$,++tt)N.array[$]=w[tt];u.uniform1fv(N.glLoc,N.array);break}}break;case u.FLOAT_VEC2:for(var et=0;et<N.array.length;++et){var it=N.offset+I+et;if(w[it]!==N.array[et]){for(var nt=et,rt=it;nt<N.array.length;++nt,++rt)N.array[nt]=w[rt];u.uniform2fv(N.glLoc,N.array);break}}break;case u.FLOAT_VEC3:for(var st=0;st<N.array.length;++st){var ot=N.offset+I+st;if(w[ot]!==N.array[st]){for(var at=st,ht=ot;at<N.array.length;++at,++ht)N.array[at]=w[ht];u.uniform3fv(N.glLoc,N.array);break}}break;case u.FLOAT_VEC4:for(var ut=0;ut<N.array.length;++ut){var ct=N.offset+I+ut;if(w[ct]!==N.array[ut]){for(var lt=ut,_t=ct;lt<N.array.length;++lt,++_t)N.array[lt]=w[_t];u.uniform4fv(N.glLoc,N.array);break}}break;case u.FLOAT_MAT2:for(var dt=0;dt<N.array.length;++dt){var ft=N.offset+I+dt;if(w[ft]!==N.array[dt]){for(var pt=dt,gt=ft;pt<N.array.length;++pt,++gt)N.array[pt]=w[gt];u.uniformMatrix2fv(N.glLoc,!1,N.array);break}}break;case u.FLOAT_MAT3:for(var mt=0;mt<N.array.length;++mt){var vt=N.offset+I+mt;if(w[vt]!==N.array[mt]){for(var yt=mt,Tt=vt;yt<N.array.length;++yt,++Tt)N.array[yt]=w[Tt];u.uniformMatrix3fv(N.glLoc,!1,N.array);break}}break;case u.FLOAT_MAT4:for(var Et=0;Et<N.array.length;++Et){var St=N.offset+I+Et;if(w[St]!==N.array[Et]){for(var At=Et,bt=St;At<N.array.length;++At,++bt)N.array[At]=w[bt];u.uniformMatrix4fv(N.glLoc,!1,N.array);break}}}}}for(var Ct=l.glSamplerTextures.length,Rt=0;Rt<Ct;Rt++)for(var wt=l.glSamplerTextures[Rt],It=n[wt.set],xt=It&&It.descriptorIndices[wt.binding],Dt=xt>=0&&It.gpuDescriptors[xt],Ot=wt.units.length,Pt=0;Pt<Ot;Pt++){var Mt=wt.units[Pt];if(Dt&&Dt.gpuSampler){if(Dt.gpuTexture&&Dt.gpuTexture.size>0){var Nt=Dt.gpuTexture,Lt=c.glTexUnits[Mt];Lt.glTexture!==Nt.glTexture&&(c.texUnit!==Mt&&(u.activeTexture(u.TEXTURE0+Mt),c.texUnit=Mt),Nt.glTexture?u.bindTexture(Nt.glTarget,Nt.glTexture):u.bindTexture(Nt.glTarget,t.nullTex2D.gpuTexture.glTexture),Lt.glTexture=Nt.glTexture);var Bt=Dt.gpuSampler;Nt.isPowerOf2?(o=Bt.glWrapS,a=Bt.glWrapT):(o=u.CLAMP_TO_EDGE,a=u.CLAMP_TO_EDGE),h=Nt.isPowerOf2?Nt.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,Nt.glWrapS!==o&&(c.texUnit!==Mt&&(u.activeTexture(u.TEXTURE0+Mt),c.texUnit=Mt),u.texParameteri(Nt.glTarget,u.TEXTURE_WRAP_S,o),Nt.glWrapS=o),Nt.glWrapT!==a&&(c.texUnit!==Mt&&(u.activeTexture(u.TEXTURE0+Mt),c.texUnit=Mt),u.texParameteri(Nt.glTarget,u.TEXTURE_WRAP_T,a),Nt.glWrapT=a),Nt.glMinFilter!==h&&(c.texUnit!==Mt&&(u.activeTexture(u.TEXTURE0+Mt),c.texUnit=Mt),u.texParameteri(Nt.glTarget,u.TEXTURE_MIN_FILTER,h),Nt.glMinFilter=h),Nt.glMagFilter!==Bt.glMagFilter&&(c.texUnit!==Mt&&(u.activeTexture(u.TEXTURE0+Mt),c.texUnit=Mt),u.texParameteri(Nt.glTarget,u.TEXTURE_MAG_FILTER,Bt.glMagFilter),Nt.glMagFilter=Bt.glMagFilter)}Dt=It.gpuDescriptors[++xt]}}}if(i&&l&&(_||k6.gpuInputAssembler!==i)){k6.gpuInputAssembler=i;var Ft=t.extensions.ANGLE_instanced_arrays;if(t.extensions.useVAO){var kt=t.extensions.OES_vertex_array_object,Ut=i.glVAOs.get(l.glProgram);if(!Ut){var Gt;Ut=kt.createVertexArrayOES(),i.glVAOs.set(l.glProgram,Ut),kt.bindVertexArrayOES(Ut),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),kt.bindVertexArrayOES(null),u.bindBuffer(u.ARRAY_BUFFER,null),u.bindBuffer(u.ELEMENT_ARRAY_BUFFER,null),c.glArrayBuffer=null,c.glElementArrayBuffer=null}c.glVAO!==Ut&&(kt.bindVertexArrayOES(Ut),c.glVAO=Ut)}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 oe=te.glLoc+se,ae=ee.offset+ee.size*se;!c.glEnabledAttribLocs[oe]&&oe>=0&&(u.enableVertexAttribArray(oe),c.glEnabledAttribLocs[oe]=!0),c.glCurrentAttribLocs[oe]=!0,u.vertexAttribPointer(oe,ee.count,ee.glType,ee.isNormalized,ee.stride,ae),Ft&&Ft.vertexAttribDivisorANGLE(oe,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 Xl.LINE_WIDTH:c.rs.lineWidth!==s.lineWidth&&(u.lineWidth(s.lineWidth),c.rs.lineWidth=s.lineWidth);break;case Xl.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 Xl.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 Xl.STENCIL_WRITE_MASK:var de=s.stencilStatesFront,fe=s.stencilStatesBack;c.dss.stencilWriteMaskFront!==de.writeMask&&(u.stencilMaskSeparate(u.FRONT,de.writeMask),c.dss.stencilWriteMaskFront=de.writeMask),c.dss.stencilWriteMaskBack!==fe.writeMask&&(u.stencilMaskSeparate(u.BACK,fe.writeMask),c.dss.stencilWriteMaskBack=fe.writeMask);break;case Xl.STENCIL_COMPARE_MASK:var pe=s.stencilStatesFront,ge=s.stencilStatesBack;c.dss.stencilRefFront===pe.reference&&c.dss.stencilReadMaskFront===pe.compareMask||(u.stencilFuncSeparate(u.FRONT,y6[c.dss.stencilFuncFront],pe.reference,pe.compareMask),c.dss.stencilRefFront=pe.reference,c.dss.stencilReadMaskFront=pe.compareMask),c.dss.stencilRefBack===ge.reference&&c.dss.stencilReadMaskBack===ge.compareMask||(u.stencilFuncSeparate(u.BACK,y6[c.dss.stencilFuncBack],ge.reference,ge.compareMask),c.dss.stencilRefBack=ge.reference,c.dss.stencilReadMaskBack=ge.compareMask)}}function z6(t,e){var i=t.gl,n=t.extensions,r=n.ANGLE_instanced_arrays,s=n.WEBGL_multi_draw,o=k6.gpuInputAssembler,a=k6.glPrimitive;if(o){var h=o.gpuIndexBuffer;if(o.gpuIndirectBuffer){var u=o.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(a,u.counts,0,o.glIndexType,u.byteOffsets,0,u.instances,0,u.drawCount):s.multiDrawElementsWEBGL(a,u.counts,0,o.glIndexType,u.byteOffsets,0,u.drawCount);else for(var l=0;l<u.drawCount;l++)u.instances[l]&&r?r.drawElementsInstancedANGLE(a,u.counts[l],o.glIndexType,u.byteOffsets[l],u.instances[l]):i.drawElements(a,u.counts[l],o.glIndexType,u.byteOffsets[l])}else if(s)u.instancedDraw?s.multiDrawArraysInstancedWEBGL(a,u.offsets,0,u.counts,0,u.instances,0,u.drawCount):s.multiDrawArraysWEBGL(a,u.offsets,0,u.counts,0,u.drawCount);else for(var _=0;_<u.drawCount;_++)u.instances[_]&&r?r.drawArraysInstancedANGLE(a,u.offsets[_],u.counts[_],u.instances[_]):i.drawArrays(a,u.offsets[_],u.counts[_])}else if(e.instanceCount&&r)if(h){if(e.indexCount>0){var d=e.firstIndex*h.stride;r.drawElementsInstancedANGLE(a,e.indexCount,o.glIndexType,d,e.instanceCount)}}else e.vertexCount>0&&r.drawArraysInstancedANGLE(a,e.firstVertex,e.vertexCount,e.instanceCount);else if(h){if(e.indexCount>0){var f=e.firstIndex*h.stride;i.drawElements(a,e.indexCount,o.glIndexType,f)}}else e.vertexCount>0&&i.drawArrays(a,e.firstVertex,e.vertexCount)}}var V6=new Array(v6.COUNT);function W6(t,e){V6.fill(0);for(var i=0;i<e.cmds.length;++i){var n=e.cmds.array[i],r=V6[n]++;switch(n){case v6.BEGIN_RENDER_PASS:var s=e.beginRenderPassCmds.array[r];G6(t,s.gpuRenderPass,s.gpuFramebuffer,s.renderArea,s.clearColors,s.clearDepth,s.clearStencil);break;case v6.BIND_STATES:var o=e.bindStatesCmds.array[r];H6(t,o.gpuPipelineState,o.gpuInputAssembler,o.gpuDescriptorSets,o.dynamicOffsets,o.dynamicStates);break;case v6.DRAW:z6(t,e.drawCmds.array[r].drawInfo);break;case v6.UPDATE_BUFFER:var a=e.updateBufferCmds.array[r];M6(t,a.gpuBuffer,a.buffer,a.offset,a.size);break;case v6.COPY_BUFFER_TO_TEXTURE:var h=e.copyBufferToTextureCmds.array[r];Y6(t,h.buffers,h.gpuTexture,h.regions);break;case v6.BLIT_TEXTURE:var u=e.blitTextureCmds.array[r];K6(t,u.srcTexture,u.dstTexture,u.regions,u.filter)}}}var X6=new Uint8Array(1);function j6(t,e,i,n,r){var s=gd(e).height,o=ld(e,r.width,r.height,r.depth),a=ld(e,n.width,1,1),h=ld(e,n.width,n.height,1),u=ld(e,r.width,1,1),c=pd(od[e]);X6.byteLength<o&&(X6=new Uint8Array(o));for(var l=0,_=i,d=0;d<r.depth;d++){_=i+h*d;for(var f=0;f<r.height;f+=s)X6.subarray(l,l+u).set(new Uint8Array(t.buffer,t.byteOffset+_,u)),l+=u,_+=a}var p=o/c.BYTES_PER_ELEMENT;return tt(Number.isInteger(p),9101),new c(X6.buffer,0,p)}function Y6(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 o=0,a=0,h=od[i.format],u=pd(h),c=h.isCompressed,l=gd(i.format),_=new a_,d=new s_,f=new a_;switch(i.glTarget){case r.TEXTURE_2D:for(var p=0;p<n.length;p++){var g=n[p],m=g.texSubres.mipLevel;d.x=0===g.texOffset.x?0:md(g.texOffset.x,l.width),d.y=0===g.texOffset.y?0:md(g.texOffset.y,l.height),_.width=g.texExtent.width<l.width?g.texExtent.width:md(g.texExtent.width,l.width),_.height=g.texExtent.height<l.height?g.texExtent.width:md(g.texExtent.height,l.height),f.width=g.buffStride>0?g.buffStride:_.width,f.height=g.buffTexHeight>0?g.buffTexHeight:_.height;var v=g.texExtent.width+d.x===i.width>>m?g.texExtent.width:_.width,y=g.texExtent.height+d.y===i.height>>m?g.texExtent.height:_.height,T=void 0,E=e[o++];if(f.width===_.width&&f.height===_.height){var S=ld(i.format,v,y,1)/u.BYTES_PER_ELEMENT;tt(Number.isInteger(S),9101),T=new u(E.buffer,E.byteOffset+g.buffOffset,S)}else T=j6(E,i.format,g.buffOffset,f,_);c?i.glInternalFmt===u6.COMPRESSED_RGB_ETC1_WEBGL||t.extensions.noCompressedTexSubImage2D?r.compressedTexImage2D(r.TEXTURE_2D,m,i.glInternalFmt,v,y,0,T):r.compressedTexSubImage2D(r.TEXTURE_2D,m,d.x,d.y,v,y,i.glFormat,T):r.texSubImage2D(r.TEXTURE_2D,m,d.x,d.y,v,y,i.glFormat,i.glType,T)}break;case r.TEXTURE_CUBE_MAP:for(var A=0;A<n.length;A++){var b=n[A],C=b.texSubres.mipLevel;d.x=0===b.texOffset.x?0:md(b.texOffset.x,l.width),d.y=0===b.texOffset.y?0:md(b.texOffset.y,l.height),_.width=b.texExtent.width<l.width?b.texExtent.width:md(b.texExtent.width,l.width),_.height=b.texExtent.height<l.height?b.texExtent.width:md(b.texExtent.height,l.height),f.width=b.buffStride>0?b.buffStride:_.width,f.height=b.buffTexHeight>0?b.buffTexHeight:_.height;var R=b.texExtent.width+d.x===i.width>>C?b.texExtent.width:_.width,w=b.texExtent.height+d.y===i.height>>C?b.texExtent.height:_.height,I=b.texSubres.baseArrayLayer+b.texSubres.layerCount;for(a=b.texSubres.baseArrayLayer;a<I;++a){var x=void 0,D=e[o++];if(f.width===_.width&&f.height===_.height){var O=ld(i.format,R,w,1)/u.BYTES_PER_ELEMENT;tt(Number.isInteger(O),9101),x=new u(D.buffer,D.byteOffset+b.buffOffset,O)}else x=j6(D,i.format,b.buffOffset,f,_);c?i.glInternalFmt===u6.COMPRESSED_RGB_ETC1_WEBGL||t.extensions.noCompressedTexSubImage2D?r.compressedTexImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+a,C,i.glInternalFmt,R,w,0,x):r.compressedTexSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+a,C,d.x,d.y,R,w,i.glFormat,x):r.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+a,C,d.x,d.y,R,w,i.glFormat,i.glType,x)}}break;default:Z(16327)}i.flags&bl.GEN_MIPMAP&&r.generateMipmap(i.glTarget)}function K6(t,e,i,n,r){t.blitManager.draw(e,i,n,r)}var q6=function(){function t(){this.drawCount=0,this.drawByIndex=!1,this.instancedDraw=!1,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=Wi(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}(),Q6=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=l6.instance.gl,e=l6.instance.bindingMappingInfo.maxBlockCounts[0];this._gpuShader={name:"Blit Pass",blocks:[new w_(0,0,"BlitParams",[new R_("tilingOffsetSrc",ml.FLOAT4,1),new R_("tilingOffsetDst",ml.FLOAT4,1)],1)],samplerTextures:[new I_(0,e,"textureSrc",ml.SAMPLER2D,1)],subpassInputs:[],gpuStages:[{type:Ll.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:Ll.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:[]},N6(l6.instance,this._gpuShader),this._gpuDescriptorSetLayout={bindings:[new Y_(0,Yl.UNIFORM_BUFFER,1,Ll.VERTEX),new Y_(e,Yl.SAMPLER_TEXTURE,1,Ll.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 Dd(!1,!1),bs:null,dynamicStates:[],gpuRenderPass:null},this._gpuVertexBuffer={usage:vl.VERTEX,memUsage:El.DEVICE,size:16*Float32Array.BYTES_PER_ELEMENT,stride:4*Float32Array.BYTES_PER_ELEMENT,buffer:null,vf32:null,indirects:new q6,glTarget:0,glBuffer:null},O6(l6.instance,this._gpuVertexBuffer),l6.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]);M6(l6.instance,this._gpuVertexBuffer,n,0,n.length),this._gpuInputAssembler={attributes:[new L_("a_position",pl.RG32F),new L_("a_texCoord",pl.RG32F)],gpuVertexBuffers:[this._gpuVertexBuffer],gpuIndexBuffer:null,gpuIndirectBuffer:null,glAttribs:[],glIndexType:0,glVAOs:new Map},B6(l6.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:vl.UNIFORM,memUsage:El.DEVICE,size:8*Float32Array.BYTES_PER_ELEMENT,stride:8*Float32Array.BYTES_PER_ELEMENT,buffer:this._uniformBuffer,vf32:null,indirects:new q6,glTarget:0,glBuffer:null},O6(l6.instance,this._gpuUniformBuffer),l6.instance.memoryStatus.bufferSize+=this._gpuUniformBuffer.size,this._gpuDescriptorSet={gpuDescriptors:[{type:Yl.UNIFORM_BUFFER,gpuBuffer:this._gpuUniformBuffer,gpuTexture:null,gpuSampler:null},{type:Yl.SAMPLER_TEXTURE,gpuBuffer:null,gpuTexture:null,gpuSampler:null}],descriptorIndices:this._gpuDescriptorSetLayout.descriptorIndices},this._drawInfo=new T_(4,0,0,0,0,0,0),this._glFramebuffer=l6.instance.gl.createFramebuffer()}var e=t.prototype;return e.destroy=function(){this._glFramebuffer&&(l6.instance.gl.deleteFramebuffer(this._glFramebuffer),this._glFramebuffer=null),this._gpuVertexBuffer&&(l6.instance.memoryStatus.bufferSize-=this._gpuVertexBuffer.size,P6(l6.instance,this._gpuVertexBuffer)),this._gpuUniformBuffer&&(l6.instance.memoryStatus.bufferSize-=this._gpuUniformBuffer.size,P6(l6.instance,this._gpuUniformBuffer)),this._gpuShader&&L6(l6.instance,this._gpuShader),this._gpuInputAssembler&&F6(l6.instance,this._gpuInputAssembler)},e.draw=function(t,e,i,n){var r=l6.instance,s=r.gl,o=r.stateCache,a=o.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===Il.POINT?this._gpuPointSampler:this._gpuLinearSampler;var u=od[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})),o.glFramebuffer!==this._glFramebuffer&&(r.gl.bindFramebuffer(r.gl.FRAMEBUFFER,this._glFramebuffer),o.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 d=0;d<l.length;++d){var f=i[l[d]];t.glTexture&&_!==f.srcSubres.mipLevel&&(_=f.srcSubres.mipLevel,s.framebufferTexture2D(s.FRAMEBUFFER,c,e.glTarget,e.glTexture,_));var p=t.width,g=t.height,m=e.width,v=e.height;this._uniformBuffer[0]=f.srcExtent.width/p,this._uniformBuffer[1]=f.srcExtent.height/g,this._uniformBuffer[2]=f.srcOffset.x/p,this._uniformBuffer[3]=f.srcOffset.y/g,this._uniformBuffer[4]=f.dstExtent.width/m,this._uniformBuffer[5]=f.dstExtent.height/v,this._uniformBuffer[6]=f.dstOffset.x/m,this._uniformBuffer[7]=f.dstOffset.y/v,M6(r,this._gpuUniformBuffer,this._uniformBuffer,0,this._uniformBuffer.length*Float32Array.BYTES_PER_ELEMENT),H6(r,this._gpuPipelineState,this._gpuInputAssembler,[this._gpuDescriptorSet],[],null),z6(r,this._drawInfo)}o.glFramebuffer!==a&&(r.gl.bindFramebuffer(r.gl.FRAMEBUFFER,a),o.glFramebuffer=a);var y=o.viewport;s.viewport(y.left,y.top,y.width,y.height);var T=o.scissorRect;s.scissor(T.x,T.y,T.width,T.height)}},t}(),Z6=function(t){function e(){var e;return(e=t.call(this)||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&vl.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 q6,glTarget:0,glBuffer:null},this._usage&vl.UNIFORM&&(this._gpuBuffer.buffer=this._uniformBuffer),O6(l6.instance,this._gpuBuffer),l6.instance.memoryStatus.bufferSize+=this._size},i.destroy=function(){this._gpuBuffer&&(P6(l6.instance,this._gpuBuffer),l6.instance.memoryStatus.bufferSize-=this._size,this._gpuBuffer=null),this._gpuBufferView&&(this._gpuBufferView=null)},i.resize=function(t){if(this._isBufferView)q(16379);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&El.HOST?i.DYNAMIC_DRAW:i.STATIC_DRAW;e.usage&vl.VERTEX?(t.extensions.useVAO&&n.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),n.glVAO=null),k6.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&vl.INDEX?(t.extensions.useVAO&&n.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),n.glVAO=null),k6.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&vl.UNIFORM?e.buffer&&(e.vf32=new Float32Array(e.buffer.buffer)):(e.usage&vl.INDIRECT||e.usage&vl.TRANSFER_DST||e.usage&vl.TRANSFER_SRC||Z(16315),e.glTarget=i.NONE)}(l6.instance,this._gpuBuffer),l6.instance.memoryStatus.bufferSize-=e,l6.instance.memoryStatus.bufferSize+=t)))}},i.update=function(t,e){var i;this._isBufferView?q(16380):(i=void 0!==e?e:this._usage&vl.INDIRECT?0:t.byteLength,M6(l6.instance,this._gpuBuffer,t,0,i))},n(e,[{key:"gpuBuffer",get:function(){return this._gpuBuffer}},{key:"gpuBufferView",get:function(){return this._gpuBufferView}}]),e}(yd),J6=function(){function t(t,e){this._freeIdx=0,this._frees=new Array(e),this._freeCmds=new js(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,o=0;s<e;++s,++o)this._frees[s]=i[o];this._freeIdx+=n}var a=this._frees[this._freeIdx];return this._frees[this._freeIdx--]=null,++a.refCount,a},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}(),$6=function(){function t(){this.beginRenderPassCmdPool=new J6(b6,1),this.bindStatesCmdPool=new J6(C6,1),this.drawCmdPool=new J6(R6,1),this.updateBufferCmdPool=new J6(w6,1),this.copyBufferToTextureCmdPool=new J6(I6,1),this.blitTextureCmdPool=new J6(x6,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}(),t8=function(t){function e(){var e;return(e=t.call(this)||this).cmdPackage=new D6,e._cmdAllocator=new $6,e._isInRenderPass=!1,e._curGPUPipelineState=null,e._curGPUInputAssembler=null,e._curGPUDescriptorSets=[],e._curDynamicOffsets=Array(8).fill(0),e._curDynamicStates=new rd,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=l6.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 o=this._cmdAllocator.beginRenderPassCmdPool.alloc(b6);o.gpuRenderPass=t.gpuRenderPass,o.gpuFramebuffer=e.gpuFramebuffer,o.renderArea.copy(i),o.clearColors.length=n.length;for(var a=0;a<n.length;++a)o.clearColors[a]=n[a];o.clearDepth=r,o.clearStencil=s,this.cmdPackage.beginRenderPassCmds.push(o),this.cmdPackage.cmds.push(v6.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 o=this._curDynamicOffsets,a=s.dynamicOffsetOffsets[t],h=0;h<i.length;h++)o[a+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&jl.FRONT&&i.writeMask!==e&&(i.writeMask=e,this._isStateInvalied=!0),t&jl.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&jl.FRONT&&(n.compareMask===i&&n.reference===e||(n.reference=e,n.compareMask=i,this._isStateInvalied=!0)),t&jl.BACK&&(r.compareMask===i&&r.reference===e||(r.reference=e,r.compareMask=i,this._isStateInvalied=!0))},i.draw=function(t){if(this._type===Ql.PRIMARY&&this._isInRenderPass||this._type===Ql.SECONDARY){this._isStateInvalied&&this.bindStates();var e="drawInfo"in t?t.drawInfo:t,i=this._cmdAllocator.drawCmdPool.alloc(R6);i.drawInfo.copy(e),this.cmdPackage.drawCmds.push(i),this.cmdPackage.cmds.push(v6.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 Z(16328)},i.updateBuffer=function(t,e,i){if(this._type===Ql.PRIMARY&&!this._isInRenderPass||this._type===Ql.SECONDARY){var n=t.gpuBuffer;if(n){var r,s=this._cmdAllocator.updateBufferCmdPool.alloc(w6),o=0;t.usage&vl.INDIRECT||(o=void 0!==i?i:e.byteLength),r=e,s.gpuBuffer=n,s.buffer=r,s.offset=0,s.size=o,this.cmdPackage.updateBufferCmds.push(s),this.cmdPackage.cmds.push(v6.UPDATE_BUFFER)}}else Z(16329)},i.copyBuffersToTexture=function(t,e,i){if(this._type===Ql.PRIMARY&&!this._isInRenderPass||this._type===Ql.SECONDARY){var n=e.gpuTexture;if(n){var r=this._cmdAllocator.copyBufferToTextureCmdPool.alloc(I6);r&&(r.gpuTexture=n,r.regions=i,r.buffers=t,this.cmdPackage.copyBufferToTextureCmds.push(r),this.cmdPackage.cmds.push(v6.COPY_BUFFER_TO_TEXTURE))}}else Z(16330)},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 o=0;o<n.cmdPackage.bindStatesCmds.length;++o){var a=n.cmdPackage.bindStatesCmds.array[o];++a.refCount,this.cmdPackage.bindStatesCmds.push(a)}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 d=n.cmdPackage.copyBufferToTextureCmds.array[_];++d.refCount,this.cmdPackage.copyBufferToTextureCmds.push(d)}for(var f=0;f<n.cmdPackage.blitTextureCmds.length;++f){var p=n.cmdPackage.blitTextureCmds.array[f];++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(C6);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(v6.BIND_STATES),this._isStateInvalied=!1)},i.blitTexture=function(t,e,i,n){var r=this._cmdAllocator.blitTextureCmdPool.alloc(x6);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(v6.BLIT_TEXTURE)},e}(Td),e8=function(t){function e(){var e;return(e=t.call(this)||this)._gpuFramebuffer=null,e._gpuColorTextures=[],e._gpuDepthStencilTexture=void 0,e}s(e,t);var i=e.prototype;return i.initialize=function(t){var e,i=this;this._renderPass=t.renderPass,this._colorTextures=t.colorTextures||[];for(var n=this._depthStencilTexture=t.depthStencilTexture||null,r=0,s=[],o=0;o<t.colorTextures.length;++o){var a=t.colorTextures[o];a&&(s.push(a.gpuTexture),r=a.lodLevel)}var h=null;n&&(h=n.gpuTexture,r=n.lodLevel);var u=Number.MAX_SAFE_INTEGER,c=Number.MAX_SAFE_INTEGER;this._gpuFramebuffer={gpuRenderPass:t.renderPass.gpuRenderPass,gpuColorTextures:s,gpuDepthStencilTexture:h,glFramebuffer:null,isOffscreen:!0,get width(){return this.gpuColorTextures.length>0?this.gpuColorTextures[0].width:this.gpuDepthStencilTexture?this.gpuDepthStencilTexture.width:u},set width(t){u=t},get height(){return this.gpuColorTextures.length>0?this.gpuColorTextures[0].height:this.gpuDepthStencilTexture?this.gpuDepthStencilTexture.height:c},set height(t){c=t},lodLevel:r},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 o=0;o<e.gpuColorTextures.length;++o){var a=e.gpuColorTextures[o];a&&(a.glTexture?n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+o,a.glTarget,a.glTexture,0):n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+o,n.RENDERBUFFER,a.glRenderbuffer),r.push(n.COLOR_ATTACHMENT0+o),e.width=Math.min(e.width,a.width),e.height=Math.min(e.height,a.height))}var h=e.gpuDepthStencilTexture;if(h){var u=od[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:Z(16318);break;case n.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:Z(16319);break;case n.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:Z(16320);break;case n.FRAMEBUFFER_UNSUPPORTED:Z(16321)}t.stateCache.glFramebuffer!==e.glFramebuffer&&n.bindFramebuffer(n.FRAMEBUFFER,t.stateCache.glFramebuffer)}}(l6.instance,this._gpuFramebuffer),this.gpuFramebuffer.gpuColorTextures.forEach((function(t){return i._gpuColorTextures.push(t.glTexture)})),this._gpuDepthStencilTexture=null===(e=this.gpuFramebuffer.gpuDepthStencilTexture)||void 0===e?void 0:e.glTexture,this._width=this._gpuFramebuffer.width,this._height=this._gpuFramebuffer.height},i.destroy=function(){var t,e;this._gpuFramebuffer&&(t=l6.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,this._gpuColorTextures.length=0,this._gpuDepthStencilTexture=null)},n(e,[{key:"gpuFramebuffer",get:function(){return this._gpuFramebuffer}},{key:"needRebuild",get:function(){if(this.gpuFramebuffer){for(var t,e=0;e<this.gpuFramebuffer.gpuColorTextures.length;e++)if(this.gpuFramebuffer.gpuColorTextures[e].glTexture!==this._gpuColorTextures[e])return!0;if((null===(t=this.gpuFramebuffer.gpuDepthStencilTexture)||void 0===t?void 0:t.glTexture)!==this._gpuDepthStencilTexture)return!0}return!1}}]),e}(bd),i8=function(t){function e(){var e;return(e=t.call(this)||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,o=0;if(t.indexBuffer&&(s=t.indexBuffer.gpuBuffer))switch(s.stride){case 1:o=5121;break;case 2:o=5123;break;case 4:o=5125;break;default:Z(16332)}var a=null;t.indirectBuffer&&(a=t.indirectBuffer.gpuBuffer),this._gpuInputAssembler={attributes:t.attributes,gpuVertexBuffers:i,gpuIndexBuffer:s,gpuIndirectBuffer:a,glAttribs:[],glIndexType:o,glVAOs:new Map},B6(l6.instance,this._gpuInputAssembler)}else Z(16331)},i.destroy=function(){var t=l6.instance;this._gpuInputAssembler&&t.extensions.useVAO&&F6(t,this._gpuInputAssembler),this._gpuInputAssembler=null},n(e,[{key:"gpuInputAssembler",get:function(){return this._gpuInputAssembler}}]),e}(Cd),n8=function(t){function e(){var e;return(e=t.call(this)||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 o=this._descriptorIndices=Array(i+1).fill(-1),a=0;a<this._bindings.length;a++){var h=this._bindings[a];this._bindingIndices[h.binding]=a,o[h.binding]=n[a]}for(var u=[],c=0;c<this._bindings.length;c++){var l=this._bindings[c];if(l.descriptorType&ud)for(var _=0;_<l.count;_++)u.push(l.binding)}this._gpuDescriptorSetLayout={bindings:this._bindings,dynamicBindings:u,descriptorIndices:o,descriptorCount:e}},i.destroy=function(){this._bindings.length=0},n(e,[{key:"gpuDescriptorSetLayout",get:function(){return this._gpuDescriptorSetLayout}}]),e}(wd),r8=function(t){function e(){var e;return(e=t.call(this)||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 o=this._setLayouts[s],a=o.gpuDescriptorSetLayout.dynamicBindings,h=Array(o.bindingIndices.length).fill(-1),u=0;u<a.length;u++){var c=a[u];h[c]<0&&(h[c]=n+u)}i.push(o.gpuDescriptorSetLayout),e.push(h),r.push(n),n+=a.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}(Id),s8=[0,1,3,2,0,0,0,4,5,6,0,0,0,0],o8=function(t){function e(){var e;return(e=t.call(this)||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:s8[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}(Nd),a8=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){G6(l6.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;z6(l6.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 Z(16328)},i.setViewport=function(t){var e=l6.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=l6.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)Z(16329);else{var n,r=t.gpuBuffer;r&&(n=void 0!==i?i:t.usage&vl.INDIRECT?0:e.byteLength,M6(l6.instance,r,e,0,n))}},i.copyBuffersToTexture=function(t,e,i){if(this._isInRenderPass)Z(16330);else{var n=e.gpuTexture;n&&Y6(l6.instance,t,n,i)}},i.execute=function(t,e){for(var i=0;i<e;++i){var n=t[i];W6(l6.instance,n.cmdPackage),this._numDrawCalls+=n._numDrawCalls,this._numInstances+=n._numInstances,this._numTris+=n._numTris}},i.bindStates=function(){H6(l6.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;K6(l6.instance,r,s,i,n)},e}(t8),h8=function(t){function e(){var e;return(e=t.call(this)||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}(Ld),u8=function(t){function e(){var e;return(e=t.call(this)||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}(Bd),c8=[10497,33648,33071,33071],l8=function(t){function e(e,i){var n;(n=t.call(this,e,i)||this)._gpuSampler=null;var r,s,o=n._info.minFilter,a=n._info.magFilter,h=n._info.mipFilter;r=o===Il.LINEAR||o===Il.ANISOTROPIC?h===Il.LINEAR||h===Il.ANISOTROPIC?9987:h===Il.POINT?9985:9729:h===Il.LINEAR||h===Il.ANISOTROPIC?9986:h===Il.POINT?9984:9728,s=a===Il.LINEAR||a===Il.ANISOTROPIC?9729:9728;var u=c8[n._info.addressU],c=c8[n._info.addressV],l=c8[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}(Fd),_8=function(t){function e(){var e;return(e=t.call(this)||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&&(L6(l6.instance,this._gpuShader),this._gpuShader=null)},n(e,[{key:"gpuShader",get:function(){return null===this._gpuShader.glProgram&&N6(l6.instance,this._gpuShader),this._gpuShader}}]),e}(kd),d8=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 d_,this.scissorRect=new o_(0,0,0,0),this.rs=new xd,this.dss=new Dd,this.bs=new Pd,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}(),f8=function(t){function e(){var e;return(e=t.call(this)||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=cd(this._info.width)&&cd(this._info.height),this._size=_d(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 pl.A8:return e.ALPHA;case pl.L8:return e.LUMINANCE;case pl.LA8:return e.LUMINANCE_ALPHA;case pl.RGB8:case pl.RGB16F:case pl.RGB32F:return e.RGB;case pl.BGRA8:case pl.RGBA8:case pl.SRGB8_A8:case pl.RGBA16F:case pl.RGBA32F:return e.RGBA;case pl.R5G6B5:return e.RGB;case pl.RGB5A1:case pl.RGBA4:return e.RGBA;case pl.DEPTH:return e.DEPTH_COMPONENT;case pl.DEPTH_STENCIL:return e.DEPTH_STENCIL;case pl.BC1:return u6.COMPRESSED_RGB_S3TC_DXT1_EXT;case pl.BC1_ALPHA:return u6.COMPRESSED_RGBA_S3TC_DXT1_EXT;case pl.BC1_SRGB:return u6.COMPRESSED_SRGB_S3TC_DXT1_EXT;case pl.BC1_SRGB_ALPHA:return u6.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;case pl.BC2:return u6.COMPRESSED_RGBA_S3TC_DXT3_EXT;case pl.BC2_SRGB:return u6.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;case pl.BC3:return u6.COMPRESSED_RGBA_S3TC_DXT5_EXT;case pl.BC3_SRGB:return u6.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;case pl.ETC_RGB8:return u6.COMPRESSED_RGB_ETC1_WEBGL;case pl.ETC2_RGB8:return u6.COMPRESSED_RGB8_ETC2;case pl.ETC2_SRGB8:return u6.COMPRESSED_SRGB8_ETC2;case pl.ETC2_RGB8_A1:return u6.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2;case pl.ETC2_SRGB8_A1:return u6.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2;case pl.ETC2_RGBA8:return u6.COMPRESSED_RGBA8_ETC2_EAC;case pl.ETC2_SRGB8_A8:return u6.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC;case pl.EAC_R11:return u6.COMPRESSED_R11_EAC;case pl.EAC_R11SN:return u6.COMPRESSED_SIGNED_R11_EAC;case pl.EAC_RG11:return u6.COMPRESSED_RG11_EAC;case pl.EAC_RG11SN:return u6.COMPRESSED_SIGNED_RG11_EAC;case pl.PVRTC_RGB2:return u6.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;case pl.PVRTC_RGBA2:return u6.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;case pl.PVRTC_RGB4:return u6.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;case pl.PVRTC_RGBA4:return u6.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;case pl.ASTC_RGBA_4X4:return u6.COMPRESSED_RGBA_ASTC_4x4_KHR;case pl.ASTC_RGBA_5X4:return u6.COMPRESSED_RGBA_ASTC_5x4_KHR;case pl.ASTC_RGBA_5X5:return u6.COMPRESSED_RGBA_ASTC_5x5_KHR;case pl.ASTC_RGBA_6X5:return u6.COMPRESSED_RGBA_ASTC_6x5_KHR;case pl.ASTC_RGBA_6X6:return u6.COMPRESSED_RGBA_ASTC_6x6_KHR;case pl.ASTC_RGBA_8X5:return u6.COMPRESSED_RGBA_ASTC_8x5_KHR;case pl.ASTC_RGBA_8X6:return u6.COMPRESSED_RGBA_ASTC_8x6_KHR;case pl.ASTC_RGBA_8X8:return u6.COMPRESSED_RGBA_ASTC_8x8_KHR;case pl.ASTC_RGBA_10X5:return u6.COMPRESSED_RGBA_ASTC_10x5_KHR;case pl.ASTC_RGBA_10X6:return u6.COMPRESSED_RGBA_ASTC_10x6_KHR;case pl.ASTC_RGBA_10X8:return u6.COMPRESSED_RGBA_ASTC_10x8_KHR;case pl.ASTC_RGBA_10X10:return u6.COMPRESSED_RGBA_ASTC_10x10_KHR;case pl.ASTC_RGBA_12X10:return u6.COMPRESSED_RGBA_ASTC_12x10_KHR;case pl.ASTC_RGBA_12X12:return u6.COMPRESSED_RGBA_ASTC_12x12_KHR;case pl.ASTC_SRGBA_4X4:return u6.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR;case pl.ASTC_SRGBA_5X4:return u6.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR;case pl.ASTC_SRGBA_5X5:return u6.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR;case pl.ASTC_SRGBA_6X5:return u6.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR;case pl.ASTC_SRGBA_6X6:return u6.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR;case pl.ASTC_SRGBA_8X5:return u6.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR;case pl.ASTC_SRGBA_8X6:return u6.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR;case pl.ASTC_SRGBA_8X8:return u6.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR;case pl.ASTC_SRGBA_10X5:return u6.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR;case pl.ASTC_SRGBA_10X6:return u6.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR;case pl.ASTC_SRGBA_10X8:return u6.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR;case pl.ASTC_SRGBA_10X10:return u6.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR;case pl.ASTC_SRGBA_12X10:return u6.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR;case pl.ASTC_SRGBA_12X12:return u6.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR;default:return Z(16310),e.RGBA}}(e.format,i),e.glType=_6(e.format,i);var n=e.width,r=e.height;switch(e.type){case Sl.TEX2D:e.glTarget=i.TEXTURE_2D;var s=Math.max(n,r);if(s>t.capabilities.maxTextureSize&&Z(9100,s,t.capabilities.maxTextureSize),t.textureExclusive[e.format]||t.extensions.WEBGL_depth_texture||!od[e.format].hasDepth){if(e.glTexture=i.createTexture(),e.size>0){var o=t.stateCache.glTexUnits[t.stateCache.texUnit];if(o.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_2D,e.glTexture),o.glTexture=e.glTexture),od[e.format].isCompressed)for(var a=0;a<e.mipLevel;++a){var h=ld(e.format,n,r,1),u=new Uint8Array(h);i.compressedTexImage2D(i.TEXTURE_2D,a,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 pl.R5G6B5:return e.RGB565;case pl.RGB5A1:return e.RGB5_A1;case pl.RGBA4:return e.RGBA4;case pl.RGBA16F:return u6.RGBA16F_EXT;case pl.RGBA32F:return u6.RGBA32F_EXT;case pl.SRGB8_A8:return u6.SRGB8_ALPHA8_EXT;case pl.DEPTH:return e.DEPTH_COMPONENT16;case pl.DEPTH_STENCIL:return e.DEPTH_STENCIL;default:return Z(16309),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 Sl.CUBE:e.glTarget=i.TEXTURE_CUBE_MAP;var l=Math.max(n,r);if(l>t.capabilities.maxCubeMapTextureSize&&Z(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),od[e.format].isCompressed)for(var d=0;d<6;++d){n=e.width,r=e.height;for(var f=0;f<e.mipLevel;++f){var p=ld(e.format,n,r,1),g=new Uint8Array(p);i.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+d,f,e.glInternalFmt,n,r,0,g),n=Math.max(1,n>>1),r=Math.max(1,r>>1)}}else for(var m=0;m<6;++m){n=e.width,r=e.height;for(var v=0;v<e.mipLevel;++v)i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+m,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:Z(16317),e.type=Sl.TEX2D,e.glTarget=i.TEXTURE_2D}}(l6.instance,this._gpuTexture),l6.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 o=t.stateCache.glRenderbuffer;i.deleteRenderbuffer(e.glRenderbuffer),o===e.glRenderbuffer&&(i.bindRenderbuffer(i.RENDERBUFFER,null),o=null),e.glRenderbuffer=null}}(l6.instance,this._gpuTexture),l6.instance.memoryStatus.textureSize-=this._size,this._gpuTexture=null)},i.getTextureHandle=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=_d(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 Sl.TEX2D:e.glTarget=i.TEXTURE_2D;var s=Math.max(n,r);if(s>t.capabilities.maxTextureSize&&Z(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 o=t.stateCache.glTexUnits[t.stateCache.texUnit];if(o.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_2D,e.glTexture),o.glTexture=e.glTexture),od[e.format].isCompressed)for(var a=0;a<e.mipLevel;++a){var h=ld(e.format,n,r,1),u=new Uint8Array(h);i.compressedTexImage2D(i.TEXTURE_2D,a,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 Sl.CUBE:e.glTarget=i.TEXTURE_CUBE_MAP;var l=Math.max(n,r);l>t.capabilities.maxCubeMapTextureSize&&Z(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),od[e.format].isCompressed)for(var d=0;d<6;++d){n=e.width,r=e.height;for(var f=0;f<e.mipLevel;++f){var p=ld(e.format,n,r,1),g=new Uint8Array(p);i.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+d,f,e.glInternalFmt,n,r,0,g),n=Math.max(1,n>>1),r=Math.max(1,r>>1)}}else for(var m=0;m<6;++m){n=e.width,r=e.height;for(var v=0;v<e.mipLevel;++v)i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+m,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:Z(16317),e.type=Sl.TEX2D,e.glTarget=i.TEXTURE_2D}}}(l6.instance,this._gpuTexture),l6.instance.memoryStatus.textureSize-=n,l6.instance.memoryStatus.textureSize+=this._size))}},i.initAsSwapchainTexture=function(t){var e=new A_;e.format=t.format,e.usage=od[t.format].hasDepth?Al.DEPTH_STENCIL_ATTACHMENT:Al.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}(Ud),p8="webglcontextlost";function g8(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 m8(t){var e={EXT_texture_filter_anisotropic:g8(t,"EXT_texture_filter_anisotropic"),EXT_blend_minmax:g8(t,"EXT_blend_minmax"),EXT_frag_depth:g8(t,"EXT_frag_depth"),EXT_shader_texture_lod:g8(t,"EXT_shader_texture_lod"),EXT_sRGB:g8(t,"EXT_sRGB"),OES_vertex_array_object:g8(t,"OES_vertex_array_object"),EXT_color_buffer_half_float:g8(t,"EXT_color_buffer_half_float"),WEBGL_color_buffer_float:g8(t,"WEBGL_color_buffer_float"),WEBGL_compressed_texture_etc1:g8(t,"WEBGL_compressed_texture_etc1"),WEBGL_compressed_texture_etc:g8(t,"WEBGL_compressed_texture_etc"),WEBGL_compressed_texture_pvrtc:g8(t,"WEBGL_compressed_texture_pvrtc"),WEBGL_compressed_texture_s3tc:g8(t,"WEBGL_compressed_texture_s3tc"),WEBGL_compressed_texture_s3tc_srgb:g8(t,"WEBGL_compressed_texture_s3tc_srgb"),WEBGL_debug_shaders:g8(t,"WEBGL_debug_shaders"),WEBGL_draw_buffers:g8(t,"WEBGL_draw_buffers"),WEBGL_lose_context:g8(t,"WEBGL_lose_context"),WEBGL_depth_texture:g8(t,"WEBGL_depth_texture"),OES_texture_half_float:g8(t,"OES_texture_half_float"),OES_texture_half_float_linear:g8(t,"OES_texture_half_float_linear"),OES_texture_float:g8(t,"OES_texture_float"),OES_texture_float_linear:g8(t,"OES_texture_float_linear"),OES_standard_derivatives:g8(t,"OES_standard_derivatives"),OES_element_index_uint:g8(t,"OES_element_index_uint"),ANGLE_instanced_arrays:g8(t,"ANGLE_instanced_arrays"),WEBGL_debug_renderer_info:g8(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 go.os===co.IOS&&14===go.osMainVersion&&go.isBrowser||(e.WEBGL_compressed_texture_astc=g8(t,"WEBGL_compressed_texture_astc")),go.os!==co.ANDROID&&go.os!==co.IOS&&(e.WEBGL_multi_draw=g8(t,"WEBGL_multi_draw")),go.browserType===ao.UC&&(e.ANGLE_instanced_arrays=null),(go.os===co.IOS&&go.osMainVersion<=10||go.os===co.ANDROID)&&(e.destroyShadersImmediately=!1),e.isLocationActive=function(t){return!!t&&-1!==t.id},e.noCompressedTexSubImage2D=!0,e.OES_vertex_array_object&&(e.useVAO=!0),e}var v8,y8,T8,E8,S8,A8,b8,C8,R8,w8,I8,x8,D8=function(t){function e(){var e;return(e=t.call(this)||this).stateCache=new d8,e.cmdAllocator=new $6,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(p8,this._onWebGLContextLost);var e=l6.instance.gl;this.stateCache.initialize(l6.instance.capabilities.maxTextureUnits,l6.instance.capabilities.maxVertexAttributes),this._extensions=m8(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=pl.RGBA8,n=pl.DEPTH_STENCIL,r=e.getParameter(e.DEPTH_BITS),s=e.getParameter(e.STENCIL_BITS);r&&s?n=pl.DEPTH_STENCIL:r&&(n=pl.DEPTH),this._colorTexture=new f8,this._colorTexture.initAsSwapchainTexture({swapchain:this,format:i,width:t.width,height:t.height}),this._depthStencilTexture=new f8,this._depthStencilTexture.initAsSwapchainTexture({swapchain:this,format:n,width:t.width,height:t.height}),this.nullTex2D=l6.instance.createTexture(new A_(Sl.TEX2D,Al.SAMPLED,pl.RGBA8,2,2,bl.GEN_MIPMAP)),this.nullTexCube=l6.instance.createTexture(new A_(Sl.CUBE,Al.SAMPLED,pl.RGBA8,2,2,bl.GEN_MIPMAP,6));var o=new __;o.texExtent.width=2,o.texExtent.height=2;var a=new Uint8Array(this.nullTex2D.size);a.fill(0),l6.instance.copyBuffersToTexture([a],this.nullTex2D,[o]),o.texSubres.layerCount=6,l6.instance.copyBuffersToTexture([a,a,a,a,a,a],this.nullTexCube,[o]),this._blitManager=new Q6},i.destroy=function(){this._canvas&&this._webGLContextLostHandler&&(this._canvas.removeEventListener(p8,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||(G("Resizing swapchain: "+t+"x"+e),this._canvas.width=t,this._canvas.height=e,this._colorTexture.resize(t,e),this._depthStencilTexture.resize(t,e))},i._onWebGLContextLost=function(t){q(11e3),F(t)},n(e,[{key:"extensions",get:function(){return this._extensions}},{key:"blitManager",get:function(){return this._blitManager}}]),e}(Ad),O8=t("WebGLDevice",function(t){function e(){var e;return(e=t.call(this)||this)._swapchain=null,e._context=null,e._bindingMappings=null,e._textureExclusive=new Array(pl.COUNT),e}s(e,t);var i=e.prototype;return i.initialize=function(t){l6.setInstance(this),this._gfxAPI=_l.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 o=e.setIndices[s],a=e.setIndices[s-1];i[o]=e.maxBlockCounts[a]+i[a],n[o]=e.maxSamplerTextureCounts[a]+n[a]}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:Ie.ENABLE_TRANSPARENT_CANVAS,antialias:Ie.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}(Ed.canvas);if(!c)return Z(16333),!1;this._queue=this.createQueue(new $_(Kl.GRAPHICS)),this._cmdBuff=this.createCommandBuffer(new J_(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 f,p=d(l);!(f=p()).done;)_+=f.value+" ";var g=m8(c);g.WEBGL_debug_renderer_info?(this._renderer=c.getParameter(g.WEBGL_debug_renderer_info.UNMASKED_RENDERER_WEBGL),this._vendor=c.getParameter(g.WEBGL_debug_renderer_info.UNMASKED_VENDOR_WEBGL)):(this._renderer=c.getParameter(c.RENDERER),this._vendor=c.getParameter(c.VENDOR));var m=c.getParameter(c.VERSION);this._features.fill(!1),this.initFormatFeatures(g),g.EXT_blend_minmax&&(this._features[fl.BLEND_MINMAX]=!0),g.OES_element_index_uint&&(this._features[fl.ELEMENT_INDEX_UINT]=!0),g.ANGLE_instanced_arrays&&(this._features[fl.INSTANCED_ARRAYS]=!0),g.WEBGL_draw_buffers&&(this._features[fl.MULTIPLE_RENDER_TARGETS]=!0);var v="";return this.getFormatFeatures(pl.ETC_RGB8)&&(v+="etc1 "),this.getFormatFeatures(pl.ETC2_RGB8)&&(v+="etc2 "),this.getFormatFeatures(pl.BC1)&&(v+="dxt "),this.getFormatFeatures(pl.PVRTC_RGB2)&&(v+="pvrtc "),this.getFormatFeatures(pl.ASTC_RGBA_4X4)&&(v+="astc "),G("WebGL device initialized."),G("RENDERER: "+this._renderer),G("VENDOR: "+this._vendor),G("VERSION: "+m),G("COMPRESSED_FORMAT: "+v),G("EXTENSIONS: "+_),!0},i.destroy=function(){this._queue&&(this._queue.destroy(),this._queue=null),this._cmdBuff&&(this._cmdBuff.destroy(),this._cmdBuff=null),this._swapchain=null},i.flushCommands=function(){},i.acquire=function(){},i.present=function(){var t=this._queue;this._numDrawCalls=t.numDrawCalls,this._numInstances=t.numInstances,this._numTris=t.numTris,t.clear()},i.initFormatFeatures=function(t){this._formatFeatures.fill(Cl.NONE),this._textureExclusive.fill(!0);var e=Cl.RENDER_TARGET|Cl.SAMPLED_TEXTURE|Cl.LINEAR_FILTER;this._formatFeatures[pl.RGB8]=e,this._formatFeatures[pl.R5G6B5]=e,this._textureExclusive[pl.R5G6B5]=!1,this._formatFeatures[pl.RGBA8]=e,this._formatFeatures[pl.RGBA4]=e,this._textureExclusive[pl.RGBA4]=!1,this._formatFeatures[pl.RGB5A1]=e,this._textureExclusive[pl.RGB5A1]=!1,this._formatFeatures[pl.DEPTH]=Cl.RENDER_TARGET,this._textureExclusive[pl.DEPTH]=!1,this._formatFeatures[pl.DEPTH_STENCIL]=Cl.RENDER_TARGET,this._textureExclusive[pl.DEPTH_STENCIL]=!1,this._formatFeatures[pl.R8I]|=Cl.VERTEX_ATTRIBUTE,this._formatFeatures[pl.RG8I]|=Cl.VERTEX_ATTRIBUTE,this._formatFeatures[pl.RGB8I]|=Cl.VERTEX_ATTRIBUTE,this._formatFeatures[pl.RGBA8I]|=Cl.VERTEX_ATTRIBUTE,this._formatFeatures[pl.R8UI]|=Cl.VERTEX_ATTRIBUTE,this._formatFeatures[pl.RG8UI]|=Cl.VERTEX_ATTRIBUTE,this._formatFeatures[pl.RGB8UI]|=Cl.VERTEX_ATTRIBUTE,this._formatFeatures[pl.RGBA8UI]|=Cl.VERTEX_ATTRIBUTE,this._formatFeatures[pl.R8I]|=Cl.VERTEX_ATTRIBUTE,this._formatFeatures[pl.RG8I]|=Cl.VERTEX_ATTRIBUTE,this._formatFeatures[pl.RGB8I]|=Cl.VERTEX_ATTRIBUTE,this._formatFeatures[pl.RGBA8I]|=Cl.VERTEX_ATTRIBUTE,this._formatFeatures[pl.R8UI]|=Cl.VERTEX_ATTRIBUTE,this._formatFeatures[pl.RG8UI]|=Cl.VERTEX_ATTRIBUTE,this._formatFeatures[pl.RGB8UI]|=Cl.VERTEX_ATTRIBUTE,this._formatFeatures[pl.RGBA8UI]|=Cl.VERTEX_ATTRIBUTE,this._formatFeatures[pl.R32F]|=Cl.VERTEX_ATTRIBUTE,this._formatFeatures[pl.RG32F]|=Cl.VERTEX_ATTRIBUTE,this._formatFeatures[pl.RGB32F]|=Cl.VERTEX_ATTRIBUTE,this._formatFeatures[pl.RGBA32F]|=Cl.VERTEX_ATTRIBUTE,t.EXT_sRGB&&(this._formatFeatures[pl.SRGB8]=e,this._formatFeatures[pl.SRGB8_A8]=e,this._textureExclusive[pl.SRGB8_A8]=!1),t.WEBGL_depth_texture&&(this._formatFeatures[pl.DEPTH]|=e,this._formatFeatures[pl.DEPTH_STENCIL]|=e),t.WEBGL_color_buffer_float&&(this._formatFeatures[pl.RGB32F]|=Cl.RENDER_TARGET,this._formatFeatures[pl.RGBA32F]|=Cl.RENDER_TARGET,this._textureExclusive[pl.RGB32F]=!1,this._textureExclusive[pl.RGBA32F]=!1),t.EXT_color_buffer_half_float&&(this._formatFeatures[pl.RGB16F]|=Cl.RENDER_TARGET,this._formatFeatures[pl.RGBA16F]|=Cl.RENDER_TARGET,this._textureExclusive[pl.RGB16F]=!1,this._textureExclusive[pl.RGBA16F]=!1),t.OES_texture_float&&(this._formatFeatures[pl.RGB32F]|=Cl.RENDER_TARGET|Cl.SAMPLED_TEXTURE,this._formatFeatures[pl.RGBA32F]|=Cl.RENDER_TARGET|Cl.SAMPLED_TEXTURE),t.OES_texture_half_float&&(this._formatFeatures[pl.RGB16F]|=Cl.RENDER_TARGET|Cl.SAMPLED_TEXTURE,this._formatFeatures[pl.RGBA16F]|=Cl.RENDER_TARGET|Cl.SAMPLED_TEXTURE),t.OES_texture_float_linear&&(this._formatFeatures[pl.RGB32F]|=Cl.LINEAR_FILTER,this._formatFeatures[pl.RGBA32F]|=Cl.LINEAR_FILTER),t.OES_texture_half_float_linear&&(this._formatFeatures[pl.RGB16F]|=Cl.LINEAR_FILTER,this._formatFeatures[pl.RGBA16F]|=Cl.LINEAR_FILTER);var i=Cl.SAMPLED_TEXTURE|Cl.LINEAR_FILTER;t.WEBGL_compressed_texture_etc1&&(this._formatFeatures[pl.ETC_RGB8]=i),t.WEBGL_compressed_texture_etc&&(this._formatFeatures[pl.ETC2_RGB8]=i,this._formatFeatures[pl.ETC2_RGBA8]=i,this._formatFeatures[pl.ETC2_SRGB8]=i,this._formatFeatures[pl.ETC2_SRGB8_A8]=i,this._formatFeatures[pl.ETC2_RGB8_A1]=i,this._formatFeatures[pl.ETC2_SRGB8_A1]=i),t.WEBGL_compressed_texture_s3tc&&(this._formatFeatures[pl.BC1]=i,this._formatFeatures[pl.BC1_ALPHA]=i,this._formatFeatures[pl.BC1_SRGB]=i,this._formatFeatures[pl.BC1_SRGB_ALPHA]=i,this._formatFeatures[pl.BC2]=i,this._formatFeatures[pl.BC2_SRGB]=i,this._formatFeatures[pl.BC3]=i,this._formatFeatures[pl.BC3_SRGB]=i),t.WEBGL_compressed_texture_pvrtc&&(this._formatFeatures[pl.PVRTC_RGB2]|=i,this._formatFeatures[pl.PVRTC_RGBA2]|=i,this._formatFeatures[pl.PVRTC_RGB4]|=i,this._formatFeatures[pl.PVRTC_RGBA4]|=i),t.WEBGL_compressed_texture_astc&&(this._formatFeatures[pl.ASTC_RGBA_4X4]|=i,this._formatFeatures[pl.ASTC_RGBA_5X4]|=i,this._formatFeatures[pl.ASTC_RGBA_5X5]|=i,this._formatFeatures[pl.ASTC_RGBA_6X5]|=i,this._formatFeatures[pl.ASTC_RGBA_6X6]|=i,this._formatFeatures[pl.ASTC_RGBA_8X5]|=i,this._formatFeatures[pl.ASTC_RGBA_8X6]|=i,this._formatFeatures[pl.ASTC_RGBA_8X8]|=i,this._formatFeatures[pl.ASTC_RGBA_10X5]|=i,this._formatFeatures[pl.ASTC_RGBA_10X6]|=i,this._formatFeatures[pl.ASTC_RGBA_10X8]|=i,this._formatFeatures[pl.ASTC_RGBA_10X10]|=i,this._formatFeatures[pl.ASTC_RGBA_12X10]|=i,this._formatFeatures[pl.ASTC_RGBA_12X12]|=i,this._formatFeatures[pl.ASTC_SRGBA_4X4]|=i,this._formatFeatures[pl.ASTC_SRGBA_5X4]|=i,this._formatFeatures[pl.ASTC_SRGBA_5X5]|=i,this._formatFeatures[pl.ASTC_SRGBA_6X5]|=i,this._formatFeatures[pl.ASTC_SRGBA_6X6]|=i,this._formatFeatures[pl.ASTC_SRGBA_8X5]|=i,this._formatFeatures[pl.ASTC_SRGBA_8X6]|=i,this._formatFeatures[pl.ASTC_SRGBA_8X8]|=i,this._formatFeatures[pl.ASTC_SRGBA_10X5]|=i,this._formatFeatures[pl.ASTC_SRGBA_10X6]|=i,this._formatFeatures[pl.ASTC_SRGBA_10X8]|=i,this._formatFeatures[pl.ASTC_SRGBA_10X10]|=i,this._formatFeatures[pl.ASTC_SRGBA_12X10]|=i,this._formatFeatures[pl.ASTC_SRGBA_12X12]|=i)},i.createCommandBuffer=function(t){var e=new(t.type===Ql.PRIMARY?a8:t8);return e.initialize(t),e},i.createSwapchain=function(t){var e=new D8;return this._swapchain=e,e.initialize(t),e},i.createBuffer=function(t){var e=new Z6;return e.initialize(t),e},i.createTexture=function(t){var e=new f8;return e.initialize(t),e},i.createDescriptorSet=function(t){var e=new c6;return e.initialize(t),e},i.createShader=function(t){var e=new _8;return e.initialize(t),e},i.createInputAssembler=function(t){var e=new i8;return e.initialize(t),e},i.createRenderPass=function(t){var e=new u8;return e.initialize(t),e},i.createFramebuffer=function(t){var e=new e8;return e.initialize(t),e},i.createDescriptorSetLayout=function(t){var e=new n8;return e.initialize(t),e},i.createPipelineLayout=function(t){var e=new r8;return e.initialize(t),e},i.createPipelineState=function(t){var e=new o8;return e.initialize(t),e},i.createQueue=function(t){var e=new h8;return e.initialize(t),e},i.getSampler=function(t){var e=Fd.computeHash(t);return this._samplers.has(e)||this._samplers.set(e,new l8(t,e)),this._samplers.get(e)},i.getSwapchains=function(){return[this._swapchain]},i.getGeneralBarrier=function(t){var e=Gd.computeHash(t);return this._generalBarrierss.has(e)||this._generalBarrierss.set(e,new Gd(t,e)),this._generalBarrierss.get(e)},i.getTextureBarrier=function(t){var e=Hd.computeHash(t);return this._textureBarriers.has(e)||this._textureBarriers.set(e,new Hd(t,e)),this._textureBarriers.get(e)},i.getBufferBarrier=function(t){var e=zd.computeHash(t);return this._bufferBarriers.has(e)||this._bufferBarriers.set(e,new zd(t,e)),this._bufferBarriers.get(e)},i.copyBuffersToTexture=function(t,e,i){Y6(this,t,e.gpuTexture,i)},i.copyTextureToBuffers=function(t,e,i){!function(t,e,i,n){var r=t.gl,s=t.stateCache,o=r.createFramebuffer();r.bindFramebuffer(r.FRAMEBUFFER,o);var a=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),a=_.texOffset.x,h=_.texOffset.y,u=_.texExtent.width,c=_.texExtent.height,r.readPixels(a,h,u,c,e.glFormat,e.glType,i[l])}break;default:k("Unsupported GL texture type, copy texture to buffers failed.")}r.bindFramebuffer(r.FRAMEBUFFER,null),s.glFramebuffer=null,r.deleteFramebuffer(o)}(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 o=0,a=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[o++])}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(a=l.texSubres.baseArrayLayer;a<_;++a)r.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+a,l.texSubres.mipLevel,l.texOffset.x,l.texOffset.y,i.glFormat,i.glType,e[o++])}break;default:Z(16327)}i.flags&bl.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}(Ed));function P8(t){m._global.CC_PHYSICS_BUILTIN="builtin"===t,m._global.CC_PHYSICS_CANNON="cannon.js"===t,m._global.CC_PHYSICS_AMMO="bullet"===t}m.WebGLDevice=O8,t("ERigidBodyType",v8),function(t){t[t.DYNAMIC=1]="DYNAMIC",t[t.STATIC=2]="STATIC",t[t.KINEMATIC=4]="KINEMATIC"}(v8||t("ERigidBodyType",v8={})),ye(v8),t("EAxisDirection",y8),function(t){t[t.X_AXIS=0]="X_AXIS",t[t.Y_AXIS=1]="Y_AXIS",t[t.Z_AXIS=2]="Z_AXIS"}(y8||t("EAxisDirection",y8={})),ye(y8),function(t){t[t.X=0]="X",t[t.Y=1]="Y",t[t.Z=2]="Z",t[t.SWING1=3]="SWING1",t[t.SWING2=4]="SWING2",t[t.TWIST=5]="TWIST"}(T8||(T8={})),ye(T8),function(t){t[t.VERTEX=1]="VERTEX",t[t.LINE=2]="LINE",t[t.TRIANGLE=3]="TRIANGLE",t[t.TETRAHEDRON=4]="TETRAHEDRON"}(E8||(E8={})),ye(E8),t("EColliderType",S8),function(t){t[t.BOX=0]="BOX",t[t.SPHERE=1]="SPHERE",t[t.CAPSULE=2]="CAPSULE",t[t.CYLINDER=3]="CYLINDER",t[t.CONE=4]="CONE",t[t.MESH=5]="MESH",t[t.PLANE=6]="PLANE",t[t.SIMPLEX=7]="SIMPLEX",t[t.TERRAIN=8]="TERRAIN"}(S8||t("EColliderType",S8={})),ye(S8),function(t){t[t.POINT_TO_POINT=0]="POINT_TO_POINT",t[t.HINGE=1]="HINGE",t[t.FIXED=2]="FIXED",t[t.CONFIGURABLE=3]="CONFIGURABLE"}(A8||(A8={})),ye(A8),function(t){t[t.FREE=0]="FREE",t[t.LIMITED=1]="LIMITED",t[t.LOCKED=2]="LOCKED"}(b8||(b8={})),ye(b8),function(t){t[t.DISABLED=0]="DISABLED",t[t.SERVO=1]="SERVO",t[t.INDUCTION=2]="INDUCTION"}(C8||(C8={})),ye(C8),function(t){t[t.BOX=0]="BOX",t[t.CAPSULE=1]="CAPSULE"}(R8||(R8={})),ye(R8),function(t){t[t.DEFAULT=1]="DEFAULT"}(w8||(w8={})),ye(w8),t("EPhysicsDrawFlags",I8),function(t){t[t.NONE=0]="NONE",t[t.WIRE_FRAME=1]="WIRE_FRAME",t[t.CONSTRAINT=2]="CONSTRAINT",t[t.AABB=4]="AABB"}(I8||t("EPhysicsDrawFlags",I8={})),ye(I8);var M8,N8={id:"",switchTo:function(t){if(N8.runInEditor){var e=N8;if(N8.physicsWorld&&t!==N8.id&&null!=N8.backend[t]?(N8.physicsWorld.destroy(),B("[PHYSICS]: switch from "+N8.id+" to "+t+"."),P8(t),e.id=t,e.wrapper=N8.backend[t],e.physicsWorld=k8()):(B("[PHYSICS]: using "+t+"."),e.physicsWorld=k8()),x8){var i=e.physicsWorld;i.setGravity(x8.gravity),i.setAllowSleep(x8.allowSleep)}}},register:function(t,e){if(B("[PHYSICS]: register "+t+"."),N8.backend[t]=e,!N8.physicsWorld||N8.id===t){P8(t);var i=N8;i.id=t,i.wrapper=e}},wrapper:{},backend:{},physicsWorld:null,runInEditor:!0},L8=function(){return 0},B8={impl:null,debugDrawFlags:0,debugDrawConstraintSize:0,setGravity:L8,setAllowSleep:L8,setDefaultMaterial:L8,step:L8,syncAfterEvents:L8,syncSceneToPhysics:L8,raycast:L8,raycastClosest:L8,sweepBox:L8,sweepBoxClosest:L8,sweepSphere:L8,sweepSphereClosest:L8,sweepCapsule:L8,sweepCapsuleClosest:L8,emitEvents:L8,destroy:L8};function F8(t,e){return null==t&&(N8.id?F(N8.id+" physics does not support "+M8[e]):Z(9600),!0)}function k8(){return F8(N8.wrapper.PhysicsWorld,M8.World)?B8:new N8.wrapper.PhysicsWorld}!function(t){t[t.World=0]="World",t[t.RigidBody=1]="RigidBody",t[t.BoxCollider=2]="BoxCollider",t[t.SphereCollider=3]="SphereCollider",t[t.CapsuleCollider=4]="CapsuleCollider",t[t.MeshCollider=5]="MeshCollider",t[t.CylinderCollider=6]="CylinderCollider",t[t.ConeCollider=7]="ConeCollider",t[t.TerrainCollider=8]="TerrainCollider",t[t.SimplexCollider=9]="SimplexCollider",t[t.PlaneCollider=10]="PlaneCollider",t[t.PointToPointConstraint=11]="PointToPointConstraint",t[t.HingeConstraint=12]="HingeConstraint",t[t.FixedConstraint=13]="FixedConstraint",t[t.ConfigurableConstraint=14]="ConfigurableConstraint",t[t.BoxCharacterController=15]="BoxCharacterController",t[t.CapsuleCharacterController=16]="CapsuleCharacterController"}(M8||(M8={}));var U8={impl:null,rigidBody:null,isAwake:!1,isSleepy:!1,isSleeping:!1,initialize:L8,onEnable:L8,onDisable:L8,onDestroy:L8,setType:L8,setMass:L8,setLinearDamping:L8,setAngularDamping:L8,useGravity:L8,setLinearFactor:L8,setAngularFactor:L8,setAllowSleep:L8,wakeUp:L8,sleep:L8,clearState:L8,clearForces:L8,clearVelocity:L8,setSleepThreshold:L8,getSleepThreshold:L8,getLinearVelocity:L8,setLinearVelocity:L8,getAngularVelocity:L8,setAngularVelocity:L8,applyForce:L8,applyLocalForce:L8,applyImpulse:L8,applyLocalImpulse:L8,applyTorque:L8,applyLocalTorque:L8,setGroup:L8,getGroup:L8,addGroup:L8,removeGroup:L8,setMask:L8,getMask:L8,addMask:L8,removeMask:L8,isUsingCCD:L8,useCCD:L8},G8={INITED:!1},H8={impl:null,collider:null,attachedRigidBody:null,initialize:L8,onLoad:L8,onEnable:L8,onDisable:L8,onDestroy:L8,setGroup:L8,getGroup:L8,addGroup:L8,removeGroup:L8,setMask:L8,getMask:L8,addMask:L8,removeMask:L8,setMaterial:L8,setAsTrigger:L8,setCenter:L8,getAABB:L8,getBoundingSphere:L8,updateSize:L8,updateRadius:L8,setRadius:L8,setCylinderHeight:L8,setDirection:L8,setHeight:L8,setShapeType:L8,setVertices:L8,setMesh:L8,setTerrain:L8,setNormal:L8,setConstant:L8,updateEventListener:L8};var z8={INITED:!1},V8={impl:null,initialize:L8,onLoad:L8,onEnable:L8,onDisable:L8,onDestroy:L8,setEnableCollision:L8,setConnectedBody:L8,setPivotA:L8,setPivotB:L8,setAxis:L8,setSecondaryAxis:L8,setBreakForce:L8,setBreakTorque:L8,setConstraintMode:L8,setLinearLimit:L8,setAngularExtent:L8,setLinearSoftConstraint:L8,setLinearStiffness:L8,setLinearDamping:L8,setLinearRestitution:L8,setSwingSoftConstraint:L8,setTwistSoftConstraint:L8,setSwingStiffness:L8,setSwingDamping:L8,setSwingRestitution:L8,setTwistStiffness:L8,setTwistDamping:L8,setTwistRestitution:L8,setDriverMode:L8,setLinearMotorTarget:L8,setLinearMotorVelocity:L8,setLinearMotorForceLimit:L8,setAngularMotorTarget:L8,setAngularMotorVelocity:L8,setAngularMotorForceLimit:L8,setAutoPivotB:L8,setLimitEnabled:L8,setLowerLimit:L8,setUpperLimit:L8,setMotorEnabled:L8,setMotorVelocity:L8,setMotorForceLimit:L8};var W8,X8,j8,Y8={INITED:!1},K8={initialize:L8,onLoad:L8,onEnable:L8,onDisable:L8,onDestroy:L8,onGround:L8,getPosition:L8,setPosition:L8,setStepOffset:L8,setSlopeLimit:L8,setContactOffset:L8,setDetectCollisions:L8,setOverlapRecovery:L8,setGroup:L8,getGroup:L8,addGroup:L8,removeGroup:L8,setMask:L8,getMask:L8,addMask:L8,removeMask:L8,move:L8,syncPhysicsToScene:L8,updateEventListener:L8,setHalfHeight:L8,setHalfSideExtent:L8,setHalfForwardExtent:L8,setRadius:L8,setHeight:L8};!function(t){t[t.EBulletTypeVec3=0]="EBulletTypeVec3",t[t.EBulletTypeQuat=1]="EBulletTypeQuat",t[t.EBulletTypeTransform=2]="EBulletTypeTransform",t[t.EBulletTypeMotionState=3]="EBulletTypeMotionState",t[t.EBulletTypeCollisionObject=4]="EBulletTypeCollisionObject",t[t.EBulletTypeCollisionShape=5]="EBulletTypeCollisionShape",t[t.EBulletTypeCharacterController=6]="EBulletTypeCharacterController",t[t.EBulletTypeStridingMeshInterface=7]="EBulletTypeStridingMeshInterface",t[t.EBulletTypeTriangleMesh=8]="EBulletTypeTriangleMesh",t[t.EBulletTypeCollisionDispatcher=9]="EBulletTypeCollisionDispatcher",t[t.EBulletTypeDbvtBroadPhase=10]="EBulletTypeDbvtBroadPhase",t[t.EBulletTypeSequentialImpulseConstraintSolver=11]="EBulletTypeSequentialImpulseConstraintSolver",t[t.EBulletTypeCollisionWorld=12]="EBulletTypeCollisionWorld",t[t.EBulletTypeTypedConstraint=13]="EBulletTypeTypedConstraint",t[t.EBulletTypeDebugDraw=14]="EBulletTypeDebugDraw"}(W8||(W8={})),function(t){t[t.NONE=0]="NONE",t[t.FilterBackfaces=1]="FilterBackfaces",t[t.KeepUnflippedNormal=2]="KeepUnflippedNormal",t[t.UseSubSimplexConvexCastRaytest=4]="UseSubSimplexConvexCastRaytest",t[t.UseGjkConvexCastRaytest=8]="UseGjkConvexCastRaytest"}(X8||(X8={})),function(t){t[t.DBG_NoDebug=0]="DBG_NoDebug",t[t.DBG_DrawWireframe=1]="DBG_DrawWireframe",t[t.DBG_DrawAabb=2]="DBG_DrawAabb",t[t.DBG_DrawFeaturesText=4]="DBG_DrawFeaturesText",t[t.DBG_DrawContactPoints=8]="DBG_DrawContactPoints",t[t.DBG_NoDeactivation=16]="DBG_NoDeactivation",t[t.DBG_NoHelpText=32]="DBG_NoHelpText",t[t.DBG_DrawText=64]="DBG_DrawText",t[t.DBG_ProfileTimings=128]="DBG_ProfileTimings",t[t.DBG_EnableSatComparison=256]="DBG_EnableSatComparison",t[t.DBG_DisableBulletLCP=512]="DBG_DisableBulletLCP",t[t.DBG_EnableCCD=1024]="DBG_EnableCCD",t[t.DBG_DrawConstraints=2048]="DBG_DrawConstraints",t[t.DBG_DrawConstraintLimits=4096]="DBG_DrawConstraintLimits",t[t.DBG_FastWireframe=8192]="DBG_FastWireframe",t[t.DBG_DrawNormals=16384]="DBG_DrawNormals",t[t.DBG_DrawFrames=32768]="DBG_DrawFrames",t[t.DBG_MAX_DEBUG_DRAW_MODE=32769]="DBG_MAX_DEBUG_DRAW_MODE"}(j8||(j8={}));var q8={},Q8={BODY_CACHE_NAME:"body",CCT_CACHE_NAME:"cct"};bO.onPostInfrastructureInitDelegate.add((function(){return kO().then((function(){return Promise.all([e.import("external:emscripten/bullet/bullet.release.wasm.js"),e.import("external:emscripten/bullet/bullet.release.wasm.wasm")]).then((function(t){var e,i,n=t[0].default,r=t[1].default;return e=n,i=r,new Promise((function(t,n){var r=function(t){return"[bullet]: bullet wasm lib load failed: "+t};e({instantiateWasm:function(t,e){FO(i,t).then((function(t){e(t.instance,t.module)})).catch((function(t){return n(r(t))}))}}).then((function(t){B("[bullet]:bullet wasm lib loaded."),q8=t,globalThis.Bullet=q8})).then(t).catch((function(t){return n(r(t))}))}))}))})).catch((function(t){k(t)}))}));var Z8={type:"onTriggerEnter",selfCollider:null,otherCollider:null,impl:null},J8={type:"onCollisionEnter",selfCollider:null,otherCollider:null,contacts:[],impl:null},$8={type:"onControllerTriggerEnter",collider:null,characterController:null,impl:null},t7=function(){function t(){this.BT_TRANSFORM_0=q8.Transform_new(),this.BT_TRANSFORM_1=q8.Transform_new(),this.BT_V3_0=q8.Vec3_new(0,0,0),this.BT_V3_1=q8.Vec3_new(0,0,0),this.BT_V3_2=q8.Vec3_new(0,0,0),this.BT_QUAT_0=q8.Quat_new(0,0,0,1)}return t.setWrapper=function(t,e,i){this.ROOT[e]||(this.ROOT[e]={}),this.ROOT[e][t]=i},t.delWrapper=function(t,e){delete this.ROOT[e][t]},t.getWrapper=function(t,e){return this.ROOT[e][t]},t.isNotEmptyShape=function(t){return t!==q8.EmptyShape_static()},n(t,null,[{key:"instance",get:function(){return null==t._instance&&(t._instance=new t),t._instance}}]),t}();t7._instance=void 0,t7.ROOT={};var e7=new _n,i7=new _n,n7=new _n,r7=new Rn,s7=new Rn,o7=new Ln;new Ln;var a7,h7,u7,c7,l7,_7,d7,f7,p7,g7,m7,v7,y7=new yn;function T7(t,e){return q8.Vec3_set(t,e.x,e.y,e.z),t}function E7(t,e){var i=q8.HEAPF32.subarray(e/4,e/4+3);return t.x=i[0],t.y=i[1],t.z=i[2],t}function S7(t,e){return q8.Quat_set(t,e.x,e.y,e.z,e.w),t}function A7(t,e){var i=q8.HEAPF32.subarray(e/4,e/4+4);return t.x=i[0],t.y=i[1],t.z=i[2],t.w=i[3],t}function b7(t,e){for(var i=e.renderingSubMeshes.length,n=0;n<i;n++){var r=e.renderingSubMeshes[n],s=r.geometricInfo;if(s){var o=r.primitiveMode,a=s.positions,h=s.indices,u=t7.instance.BT_V3_0,c=t7.instance.BT_V3_1,l=t7.instance.BT_V3_2;if(o===Hl.TRIANGLE_LIST)for(var _=h.length,d=0;d<_;d+=3){var f=3*h[d],p=3*h[d+1],g=3*h[d+2];q8.Vec3_set(u,a[f],a[f+1],a[f+2]),q8.Vec3_set(c,a[p],a[p+1],a[p+2]),q8.Vec3_set(l,a[g],a[g+1],a[g+2]),q8.TriangleMesh_addTriangle(t,u,c,l,!1)}else if(o===Hl.TRIANGLE_STRIP)for(var m=h.length-2,v=0,y=0;y<m;y+=1){var T=3*h[y-v],E=3*h[y+v+1],S=3*h[y+2];v=~v,q8.Vec3_set(u,a[T],a[T+1],a[T+2]),q8.Vec3_set(c,a[E],a[E+1],a[E+2]),q8.Vec3_set(l,a[S],a[S+1],a[S+2]),q8.TriangleMesh_addTriangle(t,u,c,l,!1)}else if(o===Hl.TRIANGLE_FAN){var A=h.length-1,b=3*h[0];q8.Vec3_set(u,a[b],a[b+1],a[b+2]);for(var C=1;C<A;C+=1){var R=3*h[C],w=3*h[C+1];q8.Vec3_set(c,a[R],a[R+1],a[R+2]),q8.Vec3_set(l,a[w],a[w+1],a[w+2]),q8.TriangleMesh_addTriangle(t,u,c,l,!1)}}}}return t}function C7(t,e){return t*e}Q8.CACHE=t7;var R7=(a7=va("cc.PhysicsMaterial"),h7=Za(Je),u7=Za(Je),c7=Za(Je),l7=Za(Je),a7(((v7=function(t){function e(){var i;return(i=t.call(this)||this).id=void 0,i._friction=f7&&f7(),i._rollingFriction=p7&&p7(),i._spinningFriction=g7&&g7(),i._restitution=m7&&m7(),e.allMaterials.push(l(i)),i.id=e._idCounter++,i._uuid||(i._uuid="pm_"+i.id),i}s(e,t);var i=e.prototype;return i.clone=function(){var t=new e;return t._friction=this._friction,t._restitution=this._restitution,t._rollingFriction=this._rollingFriction,t._spinningFriction=this._spinningFriction,t},i.destroy=function(){if(t.prototype.destroy.call(this)){var i=e.allMaterials.indexOf(this);return i>=0&&e.allMaterials.splice(i,1),!0}return!1},i.setValues=function(t,i,n,r){var s=this._friction!==t||this._rollingFriction!==i||this._spinningFriction!==n||this._restitution!==r;this._friction=t,this._rollingFriction=i,this._spinningFriction=n,this._restitution=r,s&&this.emit(e.EVENT_UPDATE)},n(e,[{key:"friction",get:function(){return this._friction},set:function(t){Di(this._friction,t)||(this._friction=t,this.emit(e.EVENT_UPDATE))}},{key:"rollingFriction",get:function(){return this._rollingFriction},set:function(t){Di(this._rollingFriction,t)||(this._rollingFriction=t,this.emit(e.EVENT_UPDATE))}},{key:"spinningFriction",get:function(){return this._spinningFriction},set:function(t){Di(this._spinningFriction,t)||(this._spinningFriction=t,this.emit(e.EVENT_UPDATE))}},{key:"restitution",get:function(){return this._restitution},set:function(t){Di(this._restitution,t)||(this._restitution=t,this.emit(e.EVENT_UPDATE))}}]),e}(Of)).allMaterials=[],v7.EVENT_UPDATE="event_update",v7._idCounter=0,f((d7=v7).prototype,"friction",[h7],Object.getOwnPropertyDescriptor(d7.prototype,"friction"),d7.prototype),f(d7.prototype,"rollingFriction",[u7],Object.getOwnPropertyDescriptor(d7.prototype,"rollingFriction"),d7.prototype),f(d7.prototype,"spinningFriction",[c7],Object.getOwnPropertyDescriptor(d7.prototype,"spinningFriction"),d7.prototype),f(d7.prototype,"restitution",[l7],Object.getOwnPropertyDescriptor(d7.prototype,"restitution"),d7.prototype),f7=ua(d7.prototype,"_friction",[wa],(function(){return.6})),p7=ua(d7.prototype,"_rollingFriction",[wa],(function(){return 0})),g7=ua(d7.prototype,"_spinningFriction",[wa],(function(){return 0})),m7=ua(d7.prototype,"_restitution",[wa],(function(){return 0})),_7=d7))||_7);t({PhysicsMaterial:R7,PhysicMaterial:R7});var w7=t("PhysicsRayResult",function(){function t(){this._hitPoint=new _n,this._hitNormal=new _n,this._distance=0,this._collider=null}var e=t.prototype;return e._assign=function(t,e,i,n){_n.copy(this._hitPoint,t),_n.copy(this._hitNormal,n),this._distance=e,this._collider=i},e.clone=function(){var e=new t;return _n.copy(e._hitPoint,this._hitPoint),_n.copy(e._hitNormal,this._hitNormal),e._distance=this._distance,e._collider=this._collider,e},n(t,[{key:"hitPoint",get:function(){return this._hitPoint}},{key:"distance",get:function(){return this._distance}},{key:"collider",get:function(){return this._collider}},{key:"hitNormal",get:function(){return this._hitNormal}}]),t}()),I7=t("PhysicsLineStripCastResult",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)._id=0,e}s(e,t);var i=e.prototype;return i._assign=function(e,i,n,r,s){void 0===s&&(s=0),t.prototype._assign.call(this,e,i,n,r),this._id=s},i.clone=function(){var t=new e;return _n.copy(t._hitPoint,this._hitPoint),_n.copy(t._hitNormal,this._hitNormal),t._distance=this._distance,t._collider=this._collider,t._id=this._id,t},n(e,[{key:"id",get:function(){return this._id}}]),e}(w7)),x7=function(t){if(1===t){for(var e=this,i=function(t){var i="_"+(1<<t);e[i]=0,e.updateArray=[],Object.defineProperty(e,1<<t,{get:function(){return this[i]},set:function(e){this[i]!==e&&(this[i]=e,this.updateArray.indexOf(t)<0&&this.updateArray.push(t))}})},n=0;n<32;n++)i(n);this._1=w8.DEFAULT}else{for(var r=0;r<32;r++)this[""+(1<<r)]=0;this[1]=w8.DEFAULT}};m.internal.PhysicsGroup=w8;var D7,O7,P7,M7,N7,L7,B7,F7,k7,U7,G7,H7,z7,V7,W7,X7,j7=t("PhysicsSystem",function(t){s(i,t);var e=i.prototype;function i(){var e;return(e=t.call(this)||this).raycastClosestResult=new w7,e.raycastResults=[],e.lineStripCastClosestResult=new I7,e.lineStripCastResults=[],e.sweepCastClosestResult=new w7,e.sweepCastResults=[],e.collisionMatrix=new x7(1),e.minVolumeSize=1e-5,e.useNodeChains=!1,e._enable=!0,e._allowSleep=!0,e._maxSubSteps=1,e._subStepCount=0,e._fixedTimeStep=1/60,e._autoSimulation=!0,e._accumulator=0,e._sleepThreshold=.1,e._gravity=new _n(0,-10,0),e._material=void 0,e.raycastOptions={group:-1,mask:-1,queryTrigger:!0,maxDistance:1e7},e.raycastResultPool=new Xs((function(){return new w7}),1),e.sweepResultPool=new Xs((function(){return new w7}),1),e}return e.setDefaultPhysicsMaterial=function(t){this._material=t,this.physicsWorld.setDefaultMaterial(this._material),this._material.on(R7.EVENT_UPDATE,this._updateMaterial,this)},e.initDefaultMaterial=function(){var t=this;if(null!=this._material)return Promise.resolve();var e=NE.get("default-physics-material");if(!e)return console.error("PhysicsSystem initDefaultMaterial() Failed to load builtinMaterial"),Promise.resolve();var i=we.querySettings(Ce.Category.PHYSICS,"defaultMaterial");return i?new Promise((function(t,e){xE.loadAny(i,(function(i,n){return!i&&n instanceof R7?t(n):e(i)}))})).then((function(e){t.setDefaultPhysicsMaterial(e)})).catch((function(n){F(n),F("Failed to load user customized default physics material: "+i+", will fallback to built-in default physics material"),t.setDefaultPhysicsMaterial(e)})):(this.setDefaultPhysicsMaterial(e),Promise.resolve())},e.postUpdate=function(t){if(this.physicsWorld)if(this._enable){if(this._autoSimulation){for(this._subStepCount=0,this._accumulator+=t,DD.emit(ID.EVENT_BEFORE_PHYSICS);this._subStepCount<this._maxSubSteps;){if(!(this._accumulator>=this._fixedTimeStep)){this.physicsWorld.syncSceneToPhysics();break}this.physicsWorld.syncSceneToPhysics(),this.physicsWorld.step(this._fixedTimeStep),this.physicsWorld.emitEvents(),this.physicsWorld.syncAfterEvents(),this._accumulator-=this._fixedTimeStep,this._subStepCount++}DD.emit(ID.EVENT_AFTER_PHYSICS)}}else this.physicsWorld.syncSceneToPhysics()},e.resetConfiguration=function(t){var e=t?t.allowSleep:we.querySettings(Ce.Category.PHYSICS,"allowSleep");"boolean"==typeof e&&(this._allowSleep=e);var i=t?t.fixedTimeStep:we.querySettings(Ce.Category.PHYSICS,"fixedTimeStep");"number"==typeof i&&(this._fixedTimeStep=i);var n=t?t.maxSubSteps:we.querySettings(Ce.Category.PHYSICS,"maxSubSteps");"number"==typeof n&&(this._maxSubSteps=n);var r=t?t.sleepThreshold:we.querySettings(Ce.Category.PHYSICS,"sleepThreshold");"number"==typeof r&&(this._sleepThreshold=r);var s=t?t.autoSimulation:we.querySettings(Ce.Category.PHYSICS,"autoSimulation");"boolean"==typeof s&&(this.autoSimulation=s);var o=t?t.gravity:we.querySettings(Ce.Category.PHYSICS,"gravity");o&&_n.copy(this._gravity,o);var a=t?t.collisionMatrix:we.querySettings(Ce.Category.PHYSICS,"collisionMatrix");if(a)for(var h in a)this.collisionMatrix[""+(1<<parseInt(h))]=a[h];var u=t?t.collisionGroups:we.querySettings(Ce.Category.PHYSICS,"collisionGroups");u&&u instanceof Array&&(u.forEach((function(t){w8[t.name]=1<<t.index})),ye.update(w8)),this.physicsWorld&&(this.physicsWorld.setGravity(this._gravity),this.physicsWorld.setAllowSleep(this._allowSleep))},e.resetAccumulator=function(t){void 0===t&&(t=0),this._accumulator=t},e.step=function(t,e,i){this.physicsWorld&&this.physicsWorld.step(t,e,i)},e.syncSceneToPhysics=function(){this.physicsWorld&&this.physicsWorld.syncSceneToPhysics()},e.emitEvents=function(){this.physicsWorld&&this.physicsWorld.emitEvents()},e.raycast=function(t,e,i,n){return void 0===e&&(e=4294967295),void 0===i&&(i=1e7),void 0===n&&(n=!0),!!this.physicsWorld&&(this.raycastResultPool.reset(),this.raycastResults.length=0,this.raycastOptions.mask=e>>>0,this.raycastOptions.maxDistance=i,this.raycastOptions.queryTrigger=n,this.physicsWorld.raycast(t,this.raycastOptions,this.raycastResultPool,this.raycastResults))},e.raycastClosest=function(t,e,i,n){return void 0===e&&(e=4294967295),void 0===i&&(i=1e7),void 0===n&&(n=!0),!!this.physicsWorld&&(this.raycastOptions.mask=e>>>0,this.raycastOptions.maxDistance=i,this.raycastOptions.queryTrigger=n,this.physicsWorld.raycastClosest(t,this.raycastOptions,this.raycastClosestResult))},e.lineStripCast=function(t,e,i,n){if(void 0===e&&(e=4294967295),void 0===i&&(i=1e7),void 0===n&&(n=!0),t.length<2)return!1;this.lineStripCastResults=[];for(var r=0,s=new _r,o=1;o<t.length&&!(r>i);++o){var a=t[o-1],h=t[o],u=new _n;_n.subtract(u,h,a);var c=_n.len(u);if(r+=c,_n.multiplyScalar(u,u,1/c),s.d=u,s.o=a,this.raycast(s,e,c,n))for(var l=0;l<this.raycastResults.length;l++){var _=this.raycastResults[l];if(0!==l||!_n.equals(a,_.hitPoint)){var d=new I7;d._assign(_.hitPoint,_.distance,_.collider,_.hitNormal,o-1),this.lineStripCastResults.push(d)}}}return this.lineStripCastResults.length>0},e.lineStripCastClosest=function(t,e,i,n){if(void 0===e&&(e=4294967295),void 0===i&&(i=1e7),void 0===n&&(n=!0),t.length<2)return!1;for(var r=0,s=new _r,o=!1,a=1;a<t.length&&!(r>i);++a){var h=t[a-1],u=t[a],c=new _n;_n.subtract(c,u,h);var l=_n.len(c);if(r+=l,_n.multiplyScalar(c,c,1/l),s.d=c,s.o=h,o=this.raycastClosest(s,e,l,n)){var _=this.raycastClosestResult,d=new I7;d._assign(_.hitPoint,_.distance,_.collider,_.hitNormal,a-1),this.lineStripCastClosestResult=d;break}}return o},e.sweepBox=function(t,e,i,n,r,s){return void 0===n&&(n=4294967295),void 0===r&&(r=1e7),void 0===s&&(s=!0),!!this.physicsWorld&&(this.sweepResultPool.reset(),this.sweepCastResults.length=0,this.raycastOptions.mask=n>>>0,this.raycastOptions.maxDistance=r,this.raycastOptions.queryTrigger=s,this.physicsWorld.sweepBox(t,e,i,this.raycastOptions,this.sweepResultPool,this.sweepCastResults))},e.sweepBoxClosest=function(t,e,i,n,r,s){return void 0===n&&(n=4294967295),void 0===r&&(r=1e7),void 0===s&&(s=!0),!!this.physicsWorld&&(this.raycastOptions.mask=n>>>0,this.raycastOptions.maxDistance=r,this.raycastOptions.queryTrigger=s,this.physicsWorld.sweepBoxClosest(t,e,i,this.raycastOptions,this.sweepCastClosestResult))},e.sweepSphere=function(t,e,i,n,r){return void 0===i&&(i=4294967295),void 0===n&&(n=1e7),void 0===r&&(r=!0),!!this.physicsWorld&&(this.sweepResultPool.reset(),this.sweepCastResults.length=0,this.raycastOptions.mask=i>>>0,this.raycastOptions.maxDistance=n,this.raycastOptions.queryTrigger=r,this.physicsWorld.sweepSphere(t,e,this.raycastOptions,this.sweepResultPool,this.sweepCastResults))},e.sweepSphereClosest=function(t,e,i,n,r){return void 0===i&&(i=4294967295),void 0===n&&(n=1e7),void 0===r&&(r=!0),!!this.physicsWorld&&(this.raycastOptions.mask=i>>>0,this.raycastOptions.maxDistance=n,this.raycastOptions.queryTrigger=r,this.physicsWorld.sweepSphereClosest(t,e,this.raycastOptions,this.sweepCastClosestResult))},e.sweepCapsule=function(t,e,i,n,r,s,o){return void 0===r&&(r=4294967295),void 0===s&&(s=1e7),void 0===o&&(o=!0),!!this.physicsWorld&&(this.sweepResultPool.reset(),this.sweepCastResults.length=0,this.raycastOptions.mask=r>>>0,this.raycastOptions.maxDistance=s,this.raycastOptions.queryTrigger=o,this.physicsWorld.sweepCapsule(t,e,i,n,this.raycastOptions,this.sweepResultPool,this.sweepCastResults))},e.sweepCapsuleClosest=function(t,e,i,n,r,s,o){return void 0===r&&(r=4294967295),void 0===s&&(s=1e7),void 0===o&&(o=!0),!!this.physicsWorld&&(this.raycastOptions.mask=r>>>0,this.raycastOptions.maxDistance=s,this.raycastOptions.queryTrigger=o,this.physicsWorld.sweepCapsuleClosest(t,e,i,n,this.raycastOptions,this.sweepCastClosestResult))},e._updateMaterial=function(){this.physicsWorld&&this.physicsWorld.setDefaultMaterial(this._material)},i.constructAndRegister=function(){var t;if((null===(t=we.querySettings(Ce.Category.PHYSICS,"enabled"))||void 0===t||t)&&!i._instance){var e=new i;i._instance=e,e.resetConfiguration(),function(t){if(x8||(x8=t),N8.runInEditor&&!N8.physicsWorld){B("[PHYSICS]: using "+N8.id+".");var e=N8.physicsWorld=k8();e.setGravity(x8.gravity),e.setAllowSleep(x8.allowSleep)}}(e),DD.registerSystem(i.ID,e,e.priority),bO.onPostProjectInitDelegate.add(e.initDefaultMaterial.bind(e))}},n(i,[{key:"enable",get:function(){return this._enable},set:function(t){this._enable=t}},{key:"allowSleep",get:function(){return this._allowSleep},set:function(t){this._allowSleep=t,this.physicsWorld&&this.physicsWorld.setAllowSleep(t)}},{key:"maxSubSteps",get:function(){return this._maxSubSteps},set:function(t){this._maxSubSteps=t}},{key:"fixedTimeStep",get:function(){return this._fixedTimeStep},set:function(t){this._fixedTimeStep=t}},{key:"gravity",get:function(){return this._gravity},set:function(t){this._gravity.set(t),this.physicsWorld&&this.physicsWorld.setGravity(t)}},{key:"sleepThreshold",get:function(){return this._sleepThreshold},set:function(t){this._sleepThreshold=t}},{key:"autoSimulation",get:function(){return this._autoSimulation},set:function(t){this._autoSimulation=t}},{key:"defaultMaterial",get:function(){return this._material}},{key:"physicsWorld",get:function(){return N8.physicsWorld}},{key:"debugDrawFlags",get:function(){return this.physicsWorld.debugDrawFlags},set:function(t){this.physicsWorld.debugDrawFlags=t}},{key:"debugDrawConstraintSize",get:function(){return this.physicsWorld.debugDrawConstraintSize},set:function(t){this.physicsWorld.debugDrawConstraintSize=t}}],[{key:"PHYSICS_NONE",get:function(){return!N8.id}},{key:"PHYSICS_BUILTIN",get:function(){return"builtin"===N8.id}},{key:"PHYSICS_CANNON",get:function(){return"cannon.js"===N8.id}},{key:"PHYSICS_BULLET",get:function(){return"bullet"===N8.id}},{key:"PHYSICS_PHYSX",get:function(){return"physx"===N8.id}},{key:"PhysicsGroup",get:function(){return w8}},{key:"instance",get:function(){return i._instance}}]),i}(Yc));j7.ID="PHYSICS",j7._instance=null,DD.once(ID.EVENT_INIT,(function(){j7.constructAndRegister()}));var Y7,K7,q7,Q7,Z7,J7,$7,t9,e9,i9,n9,r9=(D7=va("cc.RigidBody"),O7=Ta(-1),P7=Za(j7.PhysicsGroup),M7=Za(v8),D7(N7=Ea(N7=O7(((X7=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._body=null,e._group=B7&&B7(),e._type=F7&&F7(),e._mass=k7&&k7(),e._allowSleep=U7&&U7(),e._linearDamping=G7&&G7(),e._angularDamping=H7&&H7(),e._useGravity=z7&&z7(),e._linearFactor=V7&&V7(),e._angularFactor=W7&&W7(),e}s(e,t);var i=e.prototype;return i.onLoad=function(){N8.runInEditor&&(this._body=F8(N8.wrapper.RigidBody,M8.RigidBody)?U8:new N8.wrapper.RigidBody,this._body.initialize(this))},i.onEnable=function(){this._body&&this._body.onEnable()},i.onDisable=function(){this._body&&this._body.onDisable()},i.onDestroy=function(){this._body&&this._body.onDestroy()},i.applyForce=function(t,e){this._isInitialized&&this._body.applyForce(t,e)},i.applyLocalForce=function(t,e){this._isInitialized&&this._body.applyLocalForce(t,e)},i.applyImpulse=function(t,e){this._isInitialized&&this._body.applyImpulse(t,e)},i.applyLocalImpulse=function(t,e){this._isInitialized&&this._body.applyLocalImpulse(t,e)},i.applyTorque=function(t){this._isInitialized&&this._body.applyTorque(t)},i.applyLocalTorque=function(t){this._isInitialized&&this._body.applyLocalTorque(t)},i.wakeUp=function(){this._isInitialized&&this._body.wakeUp()},i.sleep=function(){this._isInitialized&&this._body.sleep()},i.clearState=function(){this._isInitialized&&this._body.clearState()},i.clearForces=function(){this._isInitialized&&this._body.clearForces()},i.clearVelocity=function(){this._isInitialized&&this._body.clearVelocity()},i.getLinearVelocity=function(t){this._isInitialized&&this._body.getLinearVelocity(t)},i.setLinearVelocity=function(t){this._isInitialized&&this._body.setLinearVelocity(t)},i.getAngularVelocity=function(t){this._isInitialized&&this._body.getAngularVelocity(t)},i.setAngularVelocity=function(t){this._isInitialized&&this._body.setAngularVelocity(t)},i.getGroup=function(){return this._isInitialized?this._body.getGroup():0},i.setGroup=function(t){this._isInitialized&&this._body.setGroup(t)},i.addGroup=function(t){this._isInitialized&&this._body.addGroup(t)},i.removeGroup=function(t){this._isInitialized&&this._body.removeGroup(t)},i.getMask=function(){return this._isInitialized?this._body.getMask():0},i.setMask=function(t){this._isInitialized&&this._body.setMask(t)},i.addMask=function(t){this._isInitialized&&this._body.addMask(t)},i.removeMask=function(t){this._isInitialized&&this._body.removeMask(t)},n(e,[{key:"group",get:function(){return this._group},set:function(t){this._group=t,this._body&&this._body.getGroup()!==t&&this._body.setGroup(t)}},{key:"type",get:function(){return this._type},set:function(t){this._type!==t&&(this._type=t,this._body&&this._body.setType(t))}},{key:"mass",get:function(){return this._mass},set:function(t){this._mass!==t&&(t=t<=0?1e-4:t,this._mass=t,this._body&&this._body.setMass(t))}},{key:"allowSleep",get:function(){return this._allowSleep},set:function(t){this._allowSleep=t,this._body&&this._body.setAllowSleep(t)}},{key:"linearDamping",get:function(){return this._linearDamping},set:function(t){this._linearDamping=t,this._body&&this._body.setLinearDamping(t)}},{key:"angularDamping",get:function(){return this._angularDamping},set:function(t){this._angularDamping=t,this._body&&this._body.setAngularDamping(t)}},{key:"useGravity",get:function(){return this._useGravity},set:function(t){this._useGravity=t,this._body&&this._body.useGravity(t)}},{key:"linearFactor",get:function(){return this._linearFactor},set:function(t){_n.copy(this._linearFactor,t),this._body&&this._body.setLinearFactor(this._linearFactor)}},{key:"angularFactor",get:function(){return this._angularFactor},set:function(t){_n.copy(this._angularFactor,t),this._body&&this._body.setAngularFactor(this._angularFactor)}},{key:"sleepThreshold",get:function(){return this._isInitialized?this._body.getSleepThreshold():.1},set:function(t){this._isInitialized&&this._body.setSleepThreshold(t)}},{key:"useCCD",get:function(){return!!this._isInitialized&&this._body.isUsingCCD()},set:function(t){this._isInitialized&&this._body.useCCD(t)}},{key:"isAwake",get:function(){return!!this._isInitialized&&this._body.isAwake}},{key:"isSleepy",get:function(){return!!this._isInitialized&&this._body.isSleepy}},{key:"isSleeping",get:function(){return!!this._isInitialized&&this._body.isSleeping}},{key:"isStatic",get:function(){return this._type===v8.STATIC},set:function(t){t&&this.isStatic||!t&&!this.isStatic||(this.type=t?v8.STATIC:v8.DYNAMIC)}},{key:"isDynamic",get:function(){return this._type===v8.DYNAMIC},set:function(t){t&&this.isDynamic||!t&&!this.isDynamic||(this.type=t?v8.DYNAMIC:v8.KINEMATIC)}},{key:"isKinematic",get:function(){return this._type===v8.KINEMATIC},set:function(t){t&&this.isKinematic||!t&&!this.isKinematic||(this.type=t?v8.KINEMATIC:v8.DYNAMIC)}},{key:"body",get:function(){return this._body}},{key:"_isInitialized",get:function(){var t=null===this._body;return t&&k("[Physics]: This component has not been call onLoad yet, please make sure the node has been added to the scene."),!t}}]),e}(xp)).Type=v8,f((L7=X7).prototype,"group",[P7],Object.getOwnPropertyDescriptor(L7.prototype,"group"),L7.prototype),f(L7.prototype,"type",[M7],Object.getOwnPropertyDescriptor(L7.prototype,"type"),L7.prototype),B7=ua(L7.prototype,"_group",[wa],(function(){return j7.PhysicsGroup.DEFAULT})),F7=ua(L7.prototype,"_type",[wa],(function(){return v8.DYNAMIC})),k7=ua(L7.prototype,"_mass",[wa],(function(){return 1})),U7=ua(L7.prototype,"_allowSleep",[wa],(function(){return!0})),G7=ua(L7.prototype,"_linearDamping",[wa],(function(){return.1})),H7=ua(L7.prototype,"_angularDamping",[wa],(function(){return.1})),z7=ua(L7.prototype,"_useGravity",[wa],(function(){return!0})),V7=ua(L7.prototype,"_linearFactor",[wa],(function(){return new _n(1,1,1)})),W7=ua(L7.prototype,"_angularFactor",[wa],(function(){return new _n(1,1,1)})),N7=L7))||N7)||N7)||N7);t({RigidBody:r9,RigidBodyComponent:r9}),r9||t({RigidBody:r9={},RigidBodyComponent:r9});var s9,o9,a9,h9,u9,c9=(Y7=va("cc.Collider"),K7=Za(r9),q7=Za(R7),Q7=Za(_n),Z7=Za(R7),Y7(((n9=function(t){function e(e){var i;return(i=t.call(this)||this).type=void 0,i._shape=null,i._aabb=null,i._boundingSphere=null,i._isSharedMaterial=!0,i._needTriggerEvent=!1,i._needCollisionEvent=!1,i._material=t9&&t9(),i._isTrigger=e9&&e9(),i._center=i9&&i9(),i.type=e,i}s(e,t);var i=e.prototype;return i.on=function(e,i,n,r){var s=t.prototype.on.call(this,e,i,n,r);return this._updateNeedEvent(e),s},i.off=function(e,i,n){t.prototype.off.call(this,e,i,n),this._updateNeedEvent()},i.once=function(e,i,n){var r=t.prototype.once.call(this,e,i,n);return this._updateNeedEvent(e),r},i.removeAll=function(e){t.prototype.removeAll.call(this,e),this._updateNeedEvent()},i.getGroup=function(){return this._isInitialized?this._shape.getGroup():0},i.setGroup=function(t){this._isInitialized&&this._shape.setGroup(t)},i.addGroup=function(t){this._isInitialized&&this._shape.addGroup(t)},i.removeGroup=function(t){this._isInitialized&&this._shape.removeGroup(t)},i.getMask=function(){return this._isInitialized?this._shape.getMask():0},i.setMask=function(t){this._isInitialized&&this._shape.setMask(t)},i.addMask=function(t){this._isInitialized&&this._shape.addMask(t)},i.removeMask=function(t){this._isInitialized&&this._shape.removeMask(t)},i.onLoad=function(){N8.runInEditor&&(this.sharedMaterial=this._material,this._shape=function(t){return G8.INITED||(G8.INITED=!0,G8[S8.BOX]=function(){return F8(N8.wrapper.BoxShape,M8.BoxCollider)?H8:new N8.wrapper.BoxShape},G8[S8.SPHERE]=function(){return F8(N8.wrapper.SphereShape,M8.SphereCollider)?H8:new N8.wrapper.SphereShape},G8[S8.CAPSULE]=function(){return F8(N8.wrapper.CapsuleShape,M8.CapsuleCollider)?H8:new N8.wrapper.CapsuleShape},G8[S8.CYLINDER]=function(){return F8(N8.wrapper.CylinderShape,M8.CylinderCollider)?H8:new N8.wrapper.CylinderShape},G8[S8.CONE]=function(){return F8(N8.wrapper.ConeShape,M8.ConeCollider)?H8:new N8.wrapper.ConeShape},G8[S8.MESH]=function(){return F8(N8.wrapper.TrimeshShape,M8.MeshCollider)?H8:new N8.wrapper.TrimeshShape},G8[S8.TERRAIN]=function(){return F8(N8.wrapper.TerrainShape,M8.TerrainCollider)?H8:new N8.wrapper.TerrainShape},G8[S8.SIMPLEX]=function(){return F8(N8.wrapper.SimplexShape,M8.SimplexCollider)?H8:new N8.wrapper.SimplexShape},G8[S8.PLANE]=function(){return F8(N8.wrapper.PlaneShape,M8.PlaneCollider)?H8:new N8.wrapper.PlaneShape}),G8[t]()}(this.type),this._shape.initialize(this),this._shape.onLoad())},i.onEnable=function(){this._shape&&this._shape.onEnable()},i.onDisable=function(){this._shape&&this._shape.onDisable()},i.onDestroy=function(){this._shape&&(this._needTriggerEvent=!1,this._needCollisionEvent=!1,this._shape.updateEventListener(),this._material&&this._material.off(R7.EVENT_UPDATE,this._updateMaterial,this),this._shape.onDestroy()),this._boundingSphere&&this._boundingSphere.destroy()},i._updateMaterial=function(){this._shape&&this._shape.setMaterial(this._material)},i._updateNeedEvent=function(t){this.isValid&&(void 0!==t?("onCollisionEnter"!==t&&"onCollisionStay"!==t&&"onCollisionExit"!==t||(this._needCollisionEvent=!0),"onTriggerEnter"!==t&&"onTriggerStay"!==t&&"onTriggerExit"!==t&&"onControllerTriggerEnter"!==t&&"onControllerTriggerStay"!==t&&"onControllerTriggerExit"!==t||(this._needTriggerEvent=!0)):(this.hasEventListener("onTriggerEnter")||this.hasEventListener("onTriggerStay")||this.hasEventListener("onTriggerExit")||this.hasEventListener("onControllerTriggerEnter")||this.hasEventListener("onControllerTriggerStay")||this.hasEventListener("onControllerTriggerExit")||(this._needTriggerEvent=!1),this.hasEventListener("onCollisionEnter")||this.hasEventListener("onCollisionStay")||this.hasEventListener("onCollisionExit")||(this._needCollisionEvent=!1)),this._shape&&this._shape.updateEventListener())},n(e,[{key:"attachedRigidBody",get:function(){return t=this.node,(e=t.getComponent(r9))&&e.isValid?e:null;var t,e}},{key:"sharedMaterial",get:function(){return this._material},set:function(t){this.material=t}},{key:"material",get:function(){return this._isSharedMaterial&&this._material&&(this._material.off(R7.EVENT_UPDATE,this._updateMaterial,this),this._material=this._material.clone(),this._material.on(R7.EVENT_UPDATE,this._updateMaterial,this),this._isSharedMaterial=!1),this._material},set:function(t){this._shape?(t&&this._material?this._material.id!==t.id&&(this._material.off(R7.EVENT_UPDATE,this._updateMaterial,this),t.on(R7.EVENT_UPDATE,this._updateMaterial,this),this._isSharedMaterial=!1,this._material=t):t&&!this._material?(t.on(R7.EVENT_UPDATE,this._updateMaterial,this),this._material=t):!t&&this._material&&(this._material.off(R7.EVENT_UPDATE,this._updateMaterial,this),this._material=t),this._updateMaterial()):this._material=t}},{key:"isTrigger",get:function(){return this._isTrigger},set:function(t){this._isTrigger=t,this._shape&&this._shape.setAsTrigger(this._isTrigger)}},{key:"center",get:function(){return this._center},set:function(t){_n.copy(this._center,t),this._shape&&this._shape.setCenter(this._center)}},{key:"shape",get:function(){return this._shape}},{key:"worldBounds",get:function(){return null==this._aabb&&(this._aabb=new Xo),this._shape&&this._shape.getAABB(this._aabb),this._aabb}},{key:"boundingSphere",get:function(){return null==this._boundingSphere&&(this._boundingSphere=new Ar),this._shape&&this._shape.getBoundingSphere(this._boundingSphere),this._boundingSphere}},{key:"needTriggerEvent",get:function(){return this._needTriggerEvent}},{key:"needCollisionEvent",get:function(){return this._needCollisionEvent}},{key:"_isInitialized",get:function(){var t=null===this._shape;return t&&k("[Physics]: This component has not been call onLoad yet, please make sure the node has been added to the scene."),!t}}]),e}(so(xp))).Type=S8,n9.Axis=y8,f(($7=n9).prototype,"attachedRigidBody",[K7],Object.getOwnPropertyDescriptor($7.prototype,"attachedRigidBody"),$7.prototype),f($7.prototype,"sharedMaterial",[q7],Object.getOwnPropertyDescriptor($7.prototype,"sharedMaterial"),$7.prototype),f($7.prototype,"center",[Q7],Object.getOwnPropertyDescriptor($7.prototype,"center"),$7.prototype),t9=ua($7.prototype,"_material",[Z7],(function(){return null})),e9=ua($7.prototype,"_isTrigger",[wa],(function(){return!1})),i9=ua($7.prototype,"_center",[wa],(function(){return new _n})),J7=$7))||J7);t({Collider:c9,ColliderComponent:c9}),c9||t({Collider:c9={},ColliderComponent:c9});var l9,_9,d9,f9=(s9=va("cc.BoxCollider"),o9=Za(_n),s9((f((h9=function(t){function e(){var e;return(e=t.call(this,S8.BOX)||this)._size=u9&&u9(),e}return s(e,t),n(e,[{key:"size",get:function(){return this._size},set:function(t){_n.strictEquals(this._size,t)||(_n.copy(this._size,t),zK(this._size),this._shape&&this.shape.updateSize())}},{key:"shape",get:function(){return this._shape}}]),e}(c9)).prototype,"size",[o9],Object.getOwnPropertyDescriptor(h9.prototype,"size"),h9.prototype),u9=ua(h9.prototype,"_size",[wa],(function(){return new _n(1,1,1)})),a9=h9))||a9);t({BoxCollider:f9,BoxColliderComponent:f9});var p9,g9,m9,v9,y9,T9,E9,S9=va("cc.SphereCollider")((_9=function(t){function e(){var e;return(e=t.call(this,S8.SPHERE)||this)._radius=d9&&d9(),e}return s(e,t),n(e,[{key:"radius",get:function(){return this._radius},set:function(t){this._radius!==t&&(this._radius=Math.abs(t),this._shape&&this.shape.updateRadius())}},{key:"shape",get:function(){return this._shape}}]),e}(c9),d9=ua(_9.prototype,"_radius",[wa],(function(){return.5})),l9=_9))||l9;t({SphereCollider:S9,SphereColliderComponent:S9});var A9,b9,C9,R9,w9,I9,x9,D9=(p9=va("cc.CapsuleCollider"),g9=Za(y8),p9((f((v9=function(t){function e(){var e;return(e=t.call(this,S8.CAPSULE)||this)._radius=y9&&y9(),e._cylinderHeight=T9&&T9(),e._direction=E9&&E9(),e}s(e,t);var i=e.prototype;return i._getRadiusScale=function(){if(null==this.node)return 1;var t=this.node.worldScale;return this._direction===y8.Y_AXIS?Math.abs(qi(t.x,t.z)):this._direction===y8.X_AXIS?Math.abs(qi(t.y,t.z)):Math.abs(qi(t.x,t.y))},i._getHeightScale=function(){if(null==this.node)return 1;var t=this.node.worldScale;return this._direction===y8.Y_AXIS?Math.abs(t.y):this._direction===y8.X_AXIS?Math.abs(t.x):Math.abs(t.z)},n(e,[{key:"radius",get:function(){return this._radius},set:function(t){this._radius!==t&&(this._radius=Math.abs(t),this._shape&&this.shape.setRadius(t))}},{key:"cylinderHeight",get:function(){return this._cylinderHeight},set:function(t){this._cylinderHeight!==t&&(this._cylinderHeight=Math.abs(t),this._shape&&this.shape.setCylinderHeight(t))}},{key:"direction",get:function(){return this._direction},set:function(t){(t=Math.floor(t))<y8.X_AXIS||t>y8.Z_AXIS||this._direction!==t&&(this._direction=t,this._shape&&this.shape.setDirection(t))}},{key:"height",get:function(){return 2*this._radius+this._cylinderHeight},set:function(t){var e=t-2*this._radius;e<0&&(e=0),this.cylinderHeight=e}},{key:"worldHeight",get:function(){return 2*this._radius*this._getRadiusScale()+this._cylinderHeight*this._getHeightScale()}},{key:"shape",get:function(){return this._shape}}]),e}(c9)).prototype,"direction",[g9],Object.getOwnPropertyDescriptor(v9.prototype,"direction"),v9.prototype),y9=ua(v9.prototype,"_radius",[wa],(function(){return.5})),T9=ua(v9.prototype,"_cylinderHeight",[wa],(function(){return 1})),E9=ua(v9.prototype,"_direction",[wa],(function(){return y8.Y_AXIS})),m9=v9))||m9);t({CapsuleCollider:D9,CapsuleColliderComponent:D9});var O9,P9,M9,N9,L9,B9,F9,k9=(A9=va("cc.CylinderCollider"),b9=Za(y8),A9((f((R9=function(t){function e(){var e;return(e=t.call(this,S8.CYLINDER)||this)._radius=w9&&w9(),e._height=I9&&I9(),e._direction=x9&&x9(),e}return s(e,t),n(e,[{key:"radius",get:function(){return this._radius},set:function(t){this._radius!==t&&(this._radius=Math.abs(t),this._shape&&this.shape.setRadius(t))}},{key:"height",get:function(){return this._height},set:function(t){this._height!==t&&(this._height=Math.abs(t),this._shape&&this.shape.setHeight(t))}},{key:"direction",get:function(){return this._direction},set:function(t){this._direction!==t&&(t<y8.X_AXIS||t>y8.Z_AXIS||(this._direction=t,this._shape&&this.shape.setDirection(t)))}},{key:"shape",get:function(){return this._shape}}]),e}(c9)).prototype,"direction",[b9],Object.getOwnPropertyDescriptor(R9.prototype,"direction"),R9.prototype),w9=ua(R9.prototype,"_radius",[wa],(function(){return.5})),I9=ua(R9.prototype,"_height",[wa],(function(){return 2})),x9=ua(R9.prototype,"_direction",[wa],(function(){return y8.Y_AXIS})),C9=R9))||C9);t({CylinderCollider:k9,CylinderColliderComponent:k9});var U9,G9,H9,z9,V9,W9,X9,j9,Y9,K9,q9,Q9,Z9=t("ConeCollider",(O9=va("cc.ConeCollider"),P9=Za(y8),O9((f((N9=function(t){function e(){var e;return(e=t.call(this,S8.CONE)||this)._radius=L9&&L9(),e._height=B9&&B9(),e._direction=F9&&F9(),e}return s(e,t),n(e,[{key:"radius",get:function(){return this._radius},set:function(t){this._radius!==t&&(this._radius=Math.abs(t),this._shape&&this.shape.setRadius(t))}},{key:"height",get:function(){return this._height},set:function(t){this._height!==t&&(t<0&&(t=0),this._height=t,this._shape&&this.shape.setHeight(t))}},{key:"direction",get:function(){return this._direction},set:function(t){this._direction!==t&&(t<y8.X_AXIS||t>y8.Z_AXIS||(this._direction=t,this._shape&&this.shape.setDirection(t)))}},{key:"shape",get:function(){return this._shape}}]),e}(c9)).prototype,"direction",[P9],Object.getOwnPropertyDescriptor(N9.prototype,"direction"),N9.prototype),L9=ua(N9.prototype,"_radius",[wa],(function(){return.5})),B9=ua(N9.prototype,"_height",[wa],(function(){return 1})),F9=ua(N9.prototype,"_direction",[wa],(function(){return y8.Y_AXIS})),M9=N9))||M9)),J9=(U9=va("cc.MeshCollider"),G9=Za(ZO),U9((f((z9=function(t){function e(){var e;return(e=t.call(this,S8.MESH)||this)._mesh=V9&&V9(),e._convex=W9&&W9(),e}return s(e,t),e.prototype.onEnable=function(){if(t.prototype.onEnable.call(this),this.node){var e=this.node.getComponent(r9);e&&e.isValid&&e.type===v8.DYNAMIC&&!this.convex&&q(9630,this.node.name)}},n(e,[{key:"mesh",get:function(){return this._mesh},set:function(t){this._mesh!==t&&(this._mesh=t,this._shape&&this.shape.setMesh(this._mesh))}},{key:"convex",get:function(){return this._convex},set:function(t){this._convex!==t&&(this._convex=t,this._shape&&this._mesh&&this.shape.setMesh(this._mesh))}},{key:"shape",get:function(){return this._shape}}]),e}(c9)).prototype,"mesh",[G9],Object.getOwnPropertyDescriptor(z9.prototype,"mesh"),z9.prototype),V9=ua(z9.prototype,"_mesh",[wa],(function(){return null})),W9=ua(z9.prototype,"_convex",[wa],(function(){return!1})),H9=z9))||H9);t({MeshCollider:J9,MeshColliderComponent:J9});var $9,ttt,ett,itt,ntt,rtt,stt,ott,att,htt,utt,ctt=t("ConstantForce",va("cc.ConstantForce")(X9=ya(r9)(X9=Ea((j9=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)._rigidBody=null,e._force=Y9&&Y9(),e._localForce=K9&&K9(),e._torque=q9&&q9(),e._localTorque=Q9&&Q9(),e._mask=0,e}s(e,t);var i=e.prototype;return i.onLoad=function(){this._rigidBody=this.node.getComponent(r9),this._maskUpdate(this._force,1),this._maskUpdate(this._localForce,2),this._maskUpdate(this._torque,4),this._maskUpdate(this._localTorque,8)},i.lateUpdate=function(){null!=this._rigidBody&&0!==this._mask&&(1&this._mask&&this._rigidBody.applyForce(this._force),2&this._mask&&this._rigidBody.applyLocalForce(this.localForce),4&this._mask&&this._rigidBody.applyTorque(this._torque),8&this._mask&&this._rigidBody.applyLocalTorque(this._localTorque))},i._maskUpdate=function(t,e){t.strictEquals(_n.ZERO)?this._mask&=~e:this._mask|=e},n(e,[{key:"force",get:function(){return this._force},set:function(t){_n.copy(this._force,t),this._maskUpdate(this._force,1)}},{key:"localForce",get:function(){return this._localForce},set:function(t){_n.copy(this._localForce,t),this._maskUpdate(this.localForce,2)}},{key:"torque",get:function(){return this._torque},set:function(t){_n.copy(this._torque,t),this._maskUpdate(this._torque,4)}},{key:"localTorque",get:function(){return this._localTorque},set:function(t){_n.copy(this._localTorque,t),this._maskUpdate(this._localTorque,8)}}]),e}(xp),Y9=ua(j9.prototype,"_force",[wa],(function(){return new _n})),K9=ua(j9.prototype,"_localForce",[wa],(function(){return new _n})),q9=ua(j9.prototype,"_torque",[wa],(function(){return new _n})),Q9=ua(j9.prototype,"_localTorque",[wa],(function(){return new _n})),X9=j9))||X9)||X9)||X9),ltt=32768,_tt=1/128,dtt=16842754,ftt=16842755,ptt=16842756,gtt=16842758,mtt=16842759,vtt=16842760,ytt=16843025,Ttt=function(){function t(){this.length=0,this.buffer=new Uint8Array(2048),this._buffView=new DataView(this.buffer.buffer),this._seekPos=0}var e=t.prototype;return e.reserve=function(t){if(!(this.buffer.byteLength>t)){for(var e=this.buffer.byteLength;e<t;)e+=e;for(var i=new Uint8Array(e),n=0;n<this.length;++n)i[n]=this.buffer[n];this.buffer=i,this._buffView=new DataView(this.buffer.buffer)}},e.assign=function(t){this.buffer=t,this.length=t.length,this._seekPos=t.byteOffset,this._buffView=new DataView(t.buffer)},e.writeInt8=function(t){this.reserve(this.length+1),this._buffView.setInt8(this.length,t),this.length+=1},e.writeInt16=function(t){this.reserve(this.length+2),this._buffView.setInt16(this.length,t,!0),this.length+=2},e.writeInt32=function(t){this.reserve(this.length+4),this._buffView.setInt32(this.length,t,!0),this.length+=4},e.writeIntArray=function(t){this.reserve(this.length+4*t.length);for(var e=0;e<t.length;++e)this._buffView.setInt32(this.length+4*e,t[e],!0);this.length+=4*t.length},e.writeFloat=function(t){this.reserve(this.length+4),this._buffView.setFloat32(this.length,t,!0),this.length+=4},e.writeFloatArray=function(t){this.reserve(this.length+4*t.length);for(var e=0;e<t.length;++e)this._buffView.setFloat32(this.length+4*e,t[e],!0);this.length+=4*t.length},e.writeDouble=function(t){this.reserve(this.length+8),this._buffView.setFloat64(this.length,t,!0),this.length+=8},e.writeDoubleArray=function(t){this.reserve(this.length+8*t.length);for(var e=0;e<t.length;++e)this._buffView.setFloat64(this.length+8*e,t[e],!0);this.length+=8*t.length},e.writeString=function(t){this.reserve(this.length+t.length+4),this._buffView.setInt32(this.length,t.length,!0);for(var e=0;e<t.length;++e)this._buffView.setInt8(this.length+4+e,t.charCodeAt(e));this.length+=t.length+4},e.readInt8=function(){var t=this._buffView.getInt8(this._seekPos);return this._seekPos+=1,t},e.readInt16=function(){var t=this._buffView.getInt16(this._seekPos,!0);return this._seekPos+=2,t},e.readInt=function(){var t=this._buffView.getInt32(this._seekPos,!0);return this._seekPos+=4,t},e.readIntArray=function(t){for(var e=0;e<t.length;++e)t[e]=this._buffView.getInt32(this._seekPos+4*e,!0);return this._seekPos+=4*t.length,t},e.readFloat=function(){var t=this._buffView.getFloat32(this._seekPos,!0);return this._seekPos+=4,t},e.readFloatArray=function(t){for(var e=0;e<t.length;++e)t[e]=this._buffView.getFloat32(this._seekPos+4*e,!0);return this._seekPos+=4*t.length,t},e.readDouble=function(){var t=this._buffView.getFloat64(this._seekPos,!0);return this._seekPos+=8,t},e.readDoubleArray=function(t){for(var e=0;e<t.length;++e)t[e]=this._buffView.getFloat64(this._seekPos+4*e,!0);return this._seekPos+=8*t.length,t},e.readString=function(){for(var t=this.readInt(),e="",i=0;i<t;++i)e+=String.fromCharCode(this.readInt8());return e},t}();va("cc.TerrainLayerInfo")(($9=function(){this.slot=ttt&&ttt(),this.tileSize=ett&&ett(),this.detailMap=itt&&itt(),this.normalMap=ntt&&ntt(),this.roughness=rtt&&rtt(),this.metallic=stt&&stt()},ttt=ua($9.prototype,"slot",[wa],(function(){return 0})),ett=ua($9.prototype,"tileSize",[wa],(function(){return 1})),itt=ua($9.prototype,"detailMap",[wa],(function(){return null})),ntt=ua($9.prototype,"normalMap",[wa],(function(){return null})),rtt=ua($9.prototype,"roughness",[wa],(function(){return 1})),stt=ua($9.prototype,"metallic",[wa],(function(){return 0})),$9));var Ett,Stt,Att,btt,Ctt,Rtt,wtt,Itt,xtt,Dtt,Ott,Ptt,Mtt,Ntt,Ltt,Btt,Ftt,ktt,Utt=va("cc.TerrainLayerBinaryInfo")(ott=function(){this.slot=0,this.tileSize=1,this.roughness=1,this.metallic=0,this.detailMapId="",this.normalMapId=""})||ott,Gtt=va("cc.TerrainAsset")((htt=function(t){function e(){var e;return(e=t.call(this)||this)._version=0,e._data=null,e._tileSize=1,e._blockCount=[1,1],e._weightMapSize=128,e._lightMapSize=128,e._heights=new Uint16Array,e._normals=new Float32Array,e._weights=new Uint8Array,e._layerBuffer=[-1,-1,-1,-1],e._layerBinaryInfos=[],e._layerInfos=utt&&utt(),e}s(e,t);var i=e.prototype;return i.getLayer=function(t,e,i){var n=4*(e*this.blockCount[0]+t)+i;return t<this.blockCount[0]&&e<this.blockCount[1]&&n<this._layerBuffer.length?this._layerBuffer[n]:-1},i.getHeight=function(t,e){var i=32*this._blockCount[0]+1;return(this._heights[e*i+t]-ltt)*_tt},i.getVertexCountI=function(){return this._blockCount.length<1?0:32*this._blockCount[0]+1},i.getVertexCountJ=function(){return this._blockCount.length<2?0:32*this._blockCount[1]+1},i._setNativeData=function(t){this._data=t},i._loadNativeData=function(t){if(!t||0===t.length)return!1;var e=new Ttt;if(e.assign(t),this._version=e.readInt(),this._version===ytt)return!0;if(16842753!==this._version&&this._version!==dtt&&this._version!==ftt&&this._version!==ptt&&16842757!==this._version&&this._version!==gtt&&this._version!==mtt&&this._version!==vtt)return!1;this._version>=mtt?this.tileSize=e.readDouble():this.tileSize=e.readFloat(),this.tileSize=Math.floor(100*this.tileSize)/100,e.readIntArray(this._blockCount),this.weightMapSize=e.readInt16(),this.lightMapSize=e.readInt16();var i=e.readInt();this.heights=new Uint16Array(i);for(var n=0;n<this.heights.length;++n)this.heights[n]=e.readInt16();if(this._version<vtt)for(var r=0;r<this.heights.length;++r){var s=.001953125*(this._heights[r]-ltt),o=ltt+s/_tt;this.heights[r]=o}if(this._version>=gtt){var a=e.readInt();this.normals=new Float32Array(a);for(var h=0;h<this.normals.length;++h)this.normals[h]=e.readFloat()}var u=e.readInt();this.weights=new Uint8Array(u);for(var c=0;c<this.weights.length;++c)this.weights[c]=e.readInt8();if(this._version>=dtt){var l=e.readInt();this.layerBuffer=new Array(l);for(var _=0;_<this.layerBuffer.length;++_)this.layerBuffer[_]=e.readInt16()}if(this._version>=ftt){var d=e.readInt();this._layerBinaryInfos=new Array(d);for(var f=0;f<this._layerBinaryInfos.length;++f)this._layerBinaryInfos[f]=new Utt,this._layerBinaryInfos[f].slot=e.readInt(),this._version>=mtt?this._layerBinaryInfos[f].tileSize=e.readDouble():this._layerBinaryInfos[f].tileSize=e.readFloat(),this._layerBinaryInfos[f].detailMapId=e.readString(),this._version>=ptt&&(this._layerBinaryInfos[f].normalMapId=e.readString(),this._version>=mtt?(this._layerBinaryInfos[f].roughness=e.readDouble(),this._layerBinaryInfos[f].metallic=e.readDouble()):(this._layerBinaryInfos[f].roughness=e.readFloat(),this._layerBinaryInfos[f].metallic=e.readFloat()))}return!0},i._exportNativeData=function(){var t=new Ttt;t.writeInt32(vtt),t.writeDouble(this.tileSize),t.writeIntArray(this._blockCount),t.writeInt16(this.weightMapSize),t.writeInt16(this.lightMapSize),t.writeInt32(this.heights.length);for(var e=0;e<this.heights.length;++e)t.writeInt16(this.heights[e]);t.writeInt32(this.normals.length);for(var i=0;i<this.normals.length;++i)t.writeFloat(this.normals[i]);t.writeInt32(this.weights.length);for(var n=0;n<this.weights.length;++n)t.writeInt8(this.weights[n]);t.writeInt32(this.layerBuffer.length);for(var r=0;r<this.layerBuffer.length;++r)t.writeInt16(this.layerBuffer[r]);var s=[];s.length=this.layerInfos.length;for(var o=0;o<s.length;++o){var a=this.layerInfos[o],h=new Utt;h.slot=o,h.tileSize=a.tileSize,h.detailMapId=a.detailMap?a.detailMap._uuid:"",h.normalMapId=a.normalMap?a.normalMap._uuid:"",h.metallic=a.metallic,h.roughness=a.roughness,s[o]=h}t.writeInt32(s.length);for(var u=0;u<s.length;++u)t.writeInt32(s[u].slot),t.writeDouble(s[u].tileSize),t.writeString(s[u].detailMapId),t.writeString(s[u].normalMapId),t.writeDouble(s[u].roughness),t.writeDouble(s[u].metallic);return t.buffer},i._exportDefaultNativeData=function(){var t=new Ttt;return t.writeInt32(ytt),t.buffer},n(e,[{key:"_nativeAsset",get:function(){return this._data.buffer},set:function(t){this._data&&this._data.byteLength===t.byteLength?this._data.set(new Uint8Array(t)):this._data=new Uint8Array(t),this._loadNativeData(this._data)}},{key:"version",get:function(){return this._version}},{key:"tileSize",get:function(){return this._tileSize},set:function(t){this._tileSize=t}},{key:"blockCount",get:function(){return this._blockCount},set:function(t){this._blockCount=t}},{key:"lightMapSize",get:function(){return this._lightMapSize},set:function(t){this._lightMapSize=t}},{key:"weightMapSize",get:function(){return this._weightMapSize},set:function(t){this._weightMapSize=t}},{key:"heights",get:function(){return this._heights},set:function(t){this._heights=t}},{key:"normals",get:function(){return this._normals},set:function(t){this._normals=t}},{key:"weights",get:function(){return this._weights},set:function(t){this._weights=t}},{key:"layerBuffer",get:function(){return this._layerBuffer},set:function(t){this._layerBuffer=t}},{key:"layerInfos",get:function(){return this._layerInfos},set:function(t){this._layerInfos=t}},{key:"layerBinaryInfos",get:function(){return this._layerBinaryInfos}}]),e}(Of),utt=ua(htt.prototype,"_layerInfos",[wa],(function(){return[]})),att=htt))||att,Htt=t("TerrainCollider",(Ett=va("cc.TerrainCollider"),Stt=Za(Gtt),Ett((f((btt=function(t){function e(){var e;return(e=t.call(this,S8.TERRAIN)||this)._terrain=Ctt&&Ctt(),e}return s(e,t),e.prototype.onEnable=function(){if(t.prototype.onEnable.call(this),this.node){var e=this.node.getComponent(r9);e&&e.isValid&&e.type===v8.DYNAMIC&&q(9630,this.node.name)}},n(e,[{key:"terrain",get:function(){return this._terrain},set:function(t){this._terrain=t,this._shape&&this.shape.setTerrain(this._terrain)}},{key:"shape",get:function(){return this._shape}}]),e}(c9)).prototype,"terrain",[Stt],Object.getOwnPropertyDescriptor(btt.prototype,"terrain"),btt.prototype),Ctt=ua(btt.prototype,"_terrain",[wa],(function(){return null})),Att=btt))||Att)),ztt=t("SimplexCollider",(Rtt=va("cc.SimplexCollider"),wtt=Za(E8),Rtt(((Ptt=function(t){function e(){var e;return(e=t.call(this,S8.SIMPLEX)||this)._shapeType=Dtt&&Dtt(),e._vertices=Ott&&Ott(),e}return s(e,t),e.prototype.updateVertices=function(){this._shape&&this.shape.setVertices(this._vertices)},n(e,[{key:"shapeType",get:function(){return this._shapeType},set:function(t){this._shapeType=t,this._shape&&this.shape.setShapeType(t)}},{key:"vertex0",get:function(){return this._vertices[0]},set:function(t){_n.copy(this._vertices[0],t),this.updateVertices()}},{key:"vertex1",get:function(){return this._vertices[1]},set:function(t){_n.copy(this._vertices[1],t),this.updateVertices()}},{key:"vertex2",get:function(){return this._vertices[2]},set:function(t){_n.copy(this._vertices[2],t),this.updateVertices()}},{key:"vertex3",get:function(){return this._vertices[3]},set:function(t){_n.copy(this._vertices[3],t),this.updateVertices()}},{key:"shape",get:function(){return this._shape}},{key:"vertices",get:function(){return this._vertices}}]),e}(c9)).ESimplexType=E8,f((xtt=Ptt).prototype,"shapeType",[wtt],Object.getOwnPropertyDescriptor(xtt.prototype,"shapeType"),xtt.prototype),Dtt=ua(xtt.prototype,"_shapeType",[wa],(function(){return E8.TETRAHEDRON})),Ott=ua(xtt.prototype,"_vertices",[wa],(function(){return[new _n(0,0,0),new _n(0,0,1),new _n(1,0,0),new _n(0,1,0)]})),Itt=xtt))||Itt));ztt||t("SimplexCollider",ztt={});var Vtt,Wtt,Xtt,jtt,Ytt,Ktt,qtt,Qtt,Ztt,Jtt,$tt,tet,eet,iet,net,ret,set,oet,aet,het,uet,cet,_et,det,fet,pet,get,met,vet,yet,Tet,Eet,Aet,bet,Cet,Ret,wet,Iet,xet,Det,Oet,Pet,Met,Net,Let,Bet,Fet,ket,Uet,Get,Het,zet,Vet,Wet,Xet,jet,Yet=t("PlaneCollider",(Mtt=va("cc.PlaneCollider"),Ntt=Za(_n),Mtt((f((Btt=function(t){function e(){var e;return(e=t.call(this,S8.PLANE)||this)._normal=Ftt&&Ftt(),e._constant=ktt&&ktt(),e}return s(e,t),e.prototype.onEnable=function(){if(t.prototype.onEnable.call(this),this.node){var e=this.node.getComponent(r9);e&&e.isValid&&e.type===v8.DYNAMIC&&q(9630,this.node.name)}},n(e,[{key:"normal",get:function(){return this._normal},set:function(t){_n.strictEquals(this._normal,t)||(_n.copy(this._normal,t),this._shape&&this.shape.setNormal(this._normal))}},{key:"constant",get:function(){return this._constant},set:function(t){this._constant!==t&&(this._constant=t,this._shape&&this.shape.setConstant(this._constant))}},{key:"shape",get:function(){return this._shape}}]),e}(c9)).prototype,"normal",[Ntt],Object.getOwnPropertyDescriptor(Btt.prototype,"normal"),Btt.prototype),Ftt=ua(Btt.prototype,"_normal",[wa],(function(){return new _n(0,1,0)})),ktt=ua(Btt.prototype,"_constant",[wa],(function(){return 0})),Ltt=Btt))||Ltt)),Ket=t("Constraint",(Vtt=va("cc.Constraint"),Wtt=ya(r9),Xtt=Za(r9),jtt=Za(r9),Ytt=Za(r9),Vtt(Ktt=Wtt(((Jtt=function(t){function e(e){var i;return(i=t.call(this)||this).TYPE=void 0,i._enableCollision=Qtt&&Qtt(),i._connectedBody=Ztt&&Ztt(),i._constraint=null,i.TYPE=e,i}s(e,t);var i=e.prototype;return i.onLoad=function(){N8.runInEditor&&(this._constraint=function(t){return z8.INITED||(z8.INITED=!0,z8[A8.POINT_TO_POINT]=function(){return F8(N8.wrapper.PointToPointConstraint,M8.PointToPointConstraint)?V8:new N8.wrapper.PointToPointConstraint},z8[A8.HINGE]=function(){return F8(N8.wrapper.HingeConstraint,M8.HingeConstraint)?V8:new N8.wrapper.HingeConstraint},z8[A8.FIXED]=function(){return F8(N8.wrapper.FixedConstraint,M8.FixedConstraint)?V8:new N8.wrapper.FixedConstraint},z8[A8.CONFIGURABLE]=function(){return F8(N8.wrapper.ConfigurableConstraint,M8.ConfigurableConstraint)?V8:new N8.wrapper.ConfigurableConstraint}),z8[t]()}(this.TYPE),this._constraint.initialize(this))},i.onEnable=function(){this._constraint&&this._constraint.onEnable()},i.onDisable=function(){this._constraint&&this._constraint.onDisable()},i.onDestroy=function(){this._constraint&&this._constraint.onDestroy()},n(e,[{key:"attachedBody",get:function(){return this.getComponent(r9)}},{key:"connectedBody",get:function(){return this._connectedBody},set:function(t){this._connectedBody=t,this._constraint&&this._constraint.setConnectedBody(t)}},{key:"enableCollision",get:function(){return this._enableCollision},set:function(t){this._enableCollision=t,this._constraint&&this._constraint.setEnableCollision(t)}}]),e}(so(xp))).Type=A8,f((qtt=Jtt).prototype,"attachedBody",[Xtt],Object.getOwnPropertyDescriptor(qtt.prototype,"attachedBody"),qtt.prototype),f(qtt.prototype,"connectedBody",[jtt],Object.getOwnPropertyDescriptor(qtt.prototype,"connectedBody"),qtt.prototype),Qtt=ua(qtt.prototype,"_enableCollision",[wa],(function(){return!0})),Ztt=ua(qtt.prototype,"_connectedBody",[Ytt],(function(){return null})),Ktt=qtt))||Ktt)||Ktt));Ket||t("Constraint",Ket={});var qet,Qet,Zet,Jet,$et,tit,eit,iit,nit,rit,sit,oit,ait,hit,uit,cit,lit,_it,dit,fit,pit,git,mit,vit,yit,Tit,Eit,Sit,Ait,bit,Cit,Rit,wit,Iit,xit,Dit,Oit,Pit,Mit,Nit,Lit,Bit,Fit,kit,Uit,Git,Hit,zit,Vit,Wit,Xit,jit,Yit,Kit,qit,Qit,Zit,Jit,$it,tnt,ent,int,nnt,rnt,snt,ont,ant,hnt,unt,cnt,lnt,_nt,dnt,fnt,pnt,gnt,mnt,vnt,ynt,Tnt,Ent,Snt,Ant,bnt,Cnt,Rnt,wnt,Int,xnt,Dnt,Ont,Pnt,Mnt,Nnt,Lnt,Bnt,Fnt,knt,Unt,Gnt,Hnt,znt,Vnt,Wnt,Xnt,jnt,Ynt,Knt,qnt,Qnt,Znt,Jnt,$nt,trt,ert,irt,nrt,rrt,srt,ort,art,hrt,urt,crt,lrt,_rt,drt,frt,prt,grt,mrt,vrt,yrt,Trt,Ert,Srt,Art,brt,Crt,Rrt,wrt,Irt,xrt=($tt=va("cc.HingeLimitData"),tet=Ia("enabled"),eet=Ia("upperLimit"),iet=Ia("lowerLimit"),net=Za($e),ret=Za(Je),set=Za(Je),$tt((aet=function(){function t(){this._enabled=het&&het(),this._upperLimit=uet&&uet(),this._lowerLimit=cet&&cet()}return n(t,[{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled=t}},{key:"upperLimit",get:function(){return this._upperLimit},set:function(t){this._upperLimit=t}},{key:"lowerLimit",get:function(){return this._lowerLimit},set:function(t){this._lowerLimit=t}}]),t}(),het=ua(aet.prototype,"_enabled",[wa,tet],(function(){return!1})),uet=ua(aet.prototype,"_upperLimit",[wa,eet],(function(){return Number.MAX_VALUE})),cet=ua(aet.prototype,"_lowerLimit",[wa,iet],(function(){return-Number.MAX_VALUE})),f(aet.prototype,"enabled",[net],Object.getOwnPropertyDescriptor(aet.prototype,"enabled"),aet.prototype),f(aet.prototype,"upperLimit",[ret],Object.getOwnPropertyDescriptor(aet.prototype,"upperLimit"),aet.prototype),f(aet.prototype,"lowerLimit",[set],Object.getOwnPropertyDescriptor(aet.prototype,"lowerLimit"),aet.prototype),oet=aet))||oet),Drt=(_et=va("cc.HingeMotorData"),det=Ia("enabled"),fet=Ia("motorVelocity"),pet=Ia("motorForceLimit"),get=Za($e),met=Za(Je),vet=Za(Je),_et((Tet=function(){function t(){this._enabled=Eet&&Eet(),this._motorVelocity=Aet&&Aet(),this._motorForceLimit=bet&&bet()}return n(t,[{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled=t}},{key:"motorVelocity",get:function(){return this._motorVelocity},set:function(t){this._motorVelocity=t}},{key:"motorForceLimit",get:function(){return this._motorForceLimit},set:function(t){this._motorForceLimit=t}}]),t}(),Eet=ua(Tet.prototype,"_enabled",[wa,det],(function(){return!1})),Aet=ua(Tet.prototype,"_motorVelocity",[wa,fet],(function(){return 0})),bet=ua(Tet.prototype,"_motorForceLimit",[wa,pet],(function(){return 0})),f(Tet.prototype,"enabled",[get],Object.getOwnPropertyDescriptor(Tet.prototype,"enabled"),Tet.prototype),f(Tet.prototype,"motorVelocity",[met],Object.getOwnPropertyDescriptor(Tet.prototype,"motorVelocity"),Tet.prototype),f(Tet.prototype,"motorForceLimit",[vet],Object.getOwnPropertyDescriptor(Tet.prototype,"motorForceLimit"),Tet.prototype),yet=Tet))||yet),Ort=t("HingeConstraint",(Cet=va("cc.HingeConstraint"),Ret=Za(_n),wet=Za(_n),Iet=Za(_n),xet=Za($e),Det=Za(Je),Oet=Za(Je),Pet=Za($e),Met=Za(Je),Net=Za(Je),Let=Ia("axisA"),Bet=Ia("pivotA"),Fet=Ia("pivotB"),ket=Ia("limitData"),Uet=Ia("motorData"),Cet((f((Het=function(t){function e(){var e;return(e=t.call(this,A8.HINGE)||this)._axis=zet&&zet(),e._pivotA=Vet&&Vet(),e._pivotB=Wet&&Wet(),e._limitData=Xet&&Xet(),e._motorData=jet&&jet(),e}return s(e,t),n(e,[{key:"pivotA",get:function(){return this._pivotA},set:function(t){_n.copy(this._pivotA,t),this.constraint.setPivotA(this._pivotA)}},{key:"pivotB",get:function(){return this._pivotB},set:function(t){_n.copy(this._pivotB,t),this.constraint.setPivotB(this._pivotB)}},{key:"axis",get:function(){return this._axis},set:function(t){_n.copy(this._axis,t),this.constraint.setAxis(this._axis)}},{key:"limitEnabled",get:function(){return this._limitData.enabled},set:function(t){this._limitData.enabled=t,this.constraint.setLimitEnabled(t)}},{key:"upperLimit",get:function(){return this._limitData.upperLimit},set:function(t){this._limitData.upperLimit=t,this.constraint.setUpperLimit(t)}},{key:"lowerLimit",get:function(){return this._limitData.lowerLimit},set:function(t){this._limitData.lowerLimit=t,this.constraint.setLowerLimit(t)}},{key:"motorEnabled",get:function(){return this._motorData.enabled},set:function(t){this._motorData.enabled=t,this.constraint.setMotorEnabled(t)}},{key:"motorVelocity",get:function(){return this._motorData.motorVelocity},set:function(t){this._motorData.motorVelocity=t,this.constraint.setMotorVelocity(t)}},{key:"motorForceLimit",get:function(){return this._motorData.motorForceLimit},set:function(t){this._motorData.motorForceLimit=t,this.constraint.setMotorForceLimit(t)}},{key:"constraint",get:function(){return this._constraint}}]),e}(Ket)).prototype,"pivotA",[Ret],Object.getOwnPropertyDescriptor(Het.prototype,"pivotA"),Het.prototype),f(Het.prototype,"pivotB",[wet],Object.getOwnPropertyDescriptor(Het.prototype,"pivotB"),Het.prototype),f(Het.prototype,"axis",[Iet],Object.getOwnPropertyDescriptor(Het.prototype,"axis"),Het.prototype),f(Het.prototype,"limitEnabled",[xet],Object.getOwnPropertyDescriptor(Het.prototype,"limitEnabled"),Het.prototype),f(Het.prototype,"upperLimit",[Det],Object.getOwnPropertyDescriptor(Het.prototype,"upperLimit"),Het.prototype),f(Het.prototype,"lowerLimit",[Oet],Object.getOwnPropertyDescriptor(Het.prototype,"lowerLimit"),Het.prototype),f(Het.prototype,"motorEnabled",[Pet],Object.getOwnPropertyDescriptor(Het.prototype,"motorEnabled"),Het.prototype),f(Het.prototype,"motorVelocity",[Met],Object.getOwnPropertyDescriptor(Het.prototype,"motorVelocity"),Het.prototype),f(Het.prototype,"motorForceLimit",[Net],Object.getOwnPropertyDescriptor(Het.prototype,"motorForceLimit"),Het.prototype),zet=ua(Het.prototype,"_axis",[wa,Let],(function(){return new _n})),Vet=ua(Het.prototype,"_pivotA",[wa,Bet],(function(){return new _n})),Wet=ua(Het.prototype,"_pivotB",[wa,Fet],(function(){return new _n})),Xet=ua(Het.prototype,"_limitData",[wa,ket],(function(){return new xrt})),jet=ua(Het.prototype,"_motorData",[wa,Uet],(function(){return new Drt})),Get=Het))||Get)),Prt=t("FixedConstraint",(qet=va("cc.FixedConstraint"),Qet=Za(Je),Zet=Za(Je),Jet=Ia("breakForce"),$et=Ia("breakTorque"),qet((f((eit=function(t){function e(){var e;return(e=t.call(this,A8.FIXED)||this)._breakForce=iit&&iit(),e._breakTorque=nit&&nit(),e}return s(e,t),n(e,[{key:"breakForce",get:function(){return this._breakForce},set:function(t){this._breakForce=t,this.constraint.setBreakForce(t)}},{key:"breakTorque",get:function(){return this._breakTorque},set:function(t){this._breakTorque=t,this.constraint.setBreakTorque(t)}},{key:"constraint",get:function(){return this._constraint}}]),e}(Ket)).prototype,"breakForce",[Qet],Object.getOwnPropertyDescriptor(eit.prototype,"breakForce"),eit.prototype),f(eit.prototype,"breakTorque",[Zet],Object.getOwnPropertyDescriptor(eit.prototype,"breakTorque"),eit.prototype),iit=ua(eit.prototype,"_breakForce",[wa,Jet],(function(){return 1e8})),nit=ua(eit.prototype,"_breakTorque",[wa,$et],(function(){return 1e8})),tit=eit))||tit)),Mrt=(rit=va("cc.LinearLimitSettings"),sit=Za(b8),oit=Za(b8),ait=Za(b8),hit=Za(_n),uit=Za(_n),cit=Za(Je),lit=Za($e),_it=Za(Je),dit=Za(Je),rit((f((pit=function(){function t(t){this._xMotion=git&&git(),this._yMotion=mit&&mit(),this._zMotion=vit&&vit(),this._upper=yit&&yit(),this._lower=Tit&&Tit(),this._enableSoftConstraint=Eit&&Eit(),this._bounciness=Sit&&Sit(),this._stiffness=Ait&&Ait(),this._damping=bit&&bit(),this._impl=void 0,this._impl=t}return n(t,[{key:"xMotion",get:function(){return this._xMotion},set:function(t){this._xMotion=t,this._impl.setConstraintMode(0,t)}},{key:"yMotion",get:function(){return this._yMotion},set:function(t){this._yMotion=t,this._impl.setConstraintMode(1,t)}},{key:"zMotion",get:function(){return this._zMotion},set:function(t){this._zMotion=t,this._impl.setConstraintMode(2,t)}},{key:"upper",get:function(){return this._upper},set:function(t){_n.copy(this._upper,t);var e=this.lower;this._impl.setLinearLimit(0,e.x,t.x),this._impl.setLinearLimit(1,e.y,t.y),this._impl.setLinearLimit(2,e.z,t.z)}},{key:"lower",get:function(){return this._lower},set:function(t){_n.copy(this._lower,t);var e=this.upper;this._impl.setLinearLimit(0,t.x,e.x),this._impl.setLinearLimit(1,t.y,e.y),this._impl.setLinearLimit(2,t.z,e.z)}},{key:"restitution",get:function(){return this._bounciness},set:function(t){this._bounciness=t,this._impl.setLinearRestitution(t)}},{key:"enableSoftConstraint",get:function(){return this._enableSoftConstraint},set:function(t){this._enableSoftConstraint=t,this._impl.setLinearSoftConstraint(t)}},{key:"stiffness",get:function(){return this._stiffness},set:function(t){this._stiffness=t,this._impl.setLinearStiffness(t)}},{key:"damping",get:function(){return this._damping},set:function(t){this._damping=t,this._impl.setLinearDamping(t)}},{key:"impl",set:function(t){this._impl=t}}]),t}()).prototype,"xMotion",[sit],Object.getOwnPropertyDescriptor(pit.prototype,"xMotion"),pit.prototype),f(pit.prototype,"yMotion",[oit],Object.getOwnPropertyDescriptor(pit.prototype,"yMotion"),pit.prototype),f(pit.prototype,"zMotion",[ait],Object.getOwnPropertyDescriptor(pit.prototype,"zMotion"),pit.prototype),f(pit.prototype,"upper",[hit],Object.getOwnPropertyDescriptor(pit.prototype,"upper"),pit.prototype),f(pit.prototype,"lower",[uit],Object.getOwnPropertyDescriptor(pit.prototype,"lower"),pit.prototype),f(pit.prototype,"restitution",[cit],Object.getOwnPropertyDescriptor(pit.prototype,"restitution"),pit.prototype),f(pit.prototype,"enableSoftConstraint",[lit],Object.getOwnPropertyDescriptor(pit.prototype,"enableSoftConstraint"),pit.prototype),f(pit.prototype,"stiffness",[_it],Object.getOwnPropertyDescriptor(pit.prototype,"stiffness"),pit.prototype),f(pit.prototype,"damping",[dit],Object.getOwnPropertyDescriptor(pit.prototype,"damping"),pit.prototype),git=ua(pit.prototype,"_xMotion",[wa],(function(){return b8.FREE})),mit=ua(pit.prototype,"_yMotion",[wa],(function(){return b8.FREE})),vit=ua(pit.prototype,"_zMotion",[wa],(function(){return b8.FREE})),yit=ua(pit.prototype,"_upper",[wa],(function(){return new _n})),Tit=ua(pit.prototype,"_lower",[wa],(function(){return new _n})),Eit=ua(pit.prototype,"_enableSoftConstraint",[wa],(function(){return!1})),Sit=ua(pit.prototype,"_bounciness",[wa],(function(){return 0})),Ait=ua(pit.prototype,"_stiffness",[wa],(function(){return 0})),bit=ua(pit.prototype,"_damping",[wa],(function(){return 0})),fit=pit))||fit),Nrt=(Cit=va("cc.AngularLimitSettings"),Rit=Za(b8),wit=Za(b8),Iit=Za(b8),xit=Za(Je),Dit=Za(Je),Oit=Za(Je),Pit=Za(Je),Mit=Za(Je),Nit=Za($e),Lit=Za(Je),Bit=Za(Je),Fit=Za($e),kit=Za(Je),Uit=Za(Je),Cit((f((Hit=function(){function t(t){this._swing1Motion=zit&&zit(),this._swing2Motion=Vit&&Vit(),this._twistMotion=Wit&&Wit(),this._twistExtent=Xit&&Xit(),this._swingExtent1=jit&&jit(),this._swingExtent2=Yit&&Yit(),this._enableSoftConstraintSwing=Kit&&Kit(),this._swingBounciness=qit&&qit(),this._swingStiffness=Qit&&Qit(),this._swingDamping=Zit&&Zit(),this._enableSoftConstraintTwist=Jit&&Jit(),this._twistBounciness=$it&&$it(),this._twistStiffness=tnt&&tnt(),this._twistDamping=ent&&ent(),this._impl=void 0,this._impl=t}return n(t,[{key:"twistMotion",get:function(){return this._twistMotion},set:function(t){this._twistMotion=t,this._impl.setConstraintMode(3,t)}},{key:"swingMotion1",get:function(){return this._swing1Motion},set:function(t){this._swing1Motion=t,this._impl.setConstraintMode(4,t)}},{key:"swingMotion2",get:function(){return this._swing2Motion},set:function(t){this._swing2Motion=t,this._impl.setConstraintMode(5,t)}},{key:"twistExtent",get:function(){return this._twistExtent},set:function(t){this._twistExtent=t,this._impl.setAngularExtent(t,this.swingExtent1,this.swingExtent2)}},{key:"swingExtent1",get:function(){return this._swingExtent1},set:function(t){this._swingExtent1=t,this._impl.setAngularExtent(this.twistExtent,t,this.swingExtent2)}},{key:"swingExtent2",get:function(){return this._swingExtent2},set:function(t){this._swingExtent2=t,this._impl.setAngularExtent(this.twistExtent,this.swingExtent1,t)}},{key:"twistRestitution",get:function(){return this._twistBounciness},set:function(t){this._twistBounciness=t,this._impl.setTwistRestitution(t)}},{key:"swingRestitution",get:function(){return this._swingBounciness},set:function(t){this._swingBounciness=t,this._impl.setSwingRestitution(t)}},{key:"enableSoftConstraintTwist",get:function(){return this._enableSoftConstraintTwist},set:function(t){this._enableSoftConstraintTwist=t,this._impl.setTwistSoftConstraint(t)}},{key:"twistStiffness",get:function(){return this._twistStiffness},set:function(t){this._twistStiffness=t,this._impl.setTwistStiffness(t)}},{key:"twistDamping",get:function(){return this._twistDamping},set:function(t){this._twistDamping=t,this._impl.setTwistDamping(t)}},{key:"enableSoftConstraintSwing",get:function(){return this._enableSoftConstraintSwing},set:function(t){this._enableSoftConstraintSwing=t,this._impl.setSwingSoftConstraint(t)}},{key:"swingStiffness",get:function(){return this._swingStiffness},set:function(t){this._swingStiffness=t,this._impl.setSwingStiffness(t)}},{key:"swingDamping",get:function(){return this._swingDamping},set:function(t){this._swingDamping=t,this._impl.setSwingDamping(t)}},{key:"impl",set:function(t){this._impl=t}}]),t}()).prototype,"twistMotion",[Rit],Object.getOwnPropertyDescriptor(Hit.prototype,"twistMotion"),Hit.prototype),f(Hit.prototype,"swingMotion1",[wit],Object.getOwnPropertyDescriptor(Hit.prototype,"swingMotion1"),Hit.prototype),f(Hit.prototype,"swingMotion2",[Iit],Object.getOwnPropertyDescriptor(Hit.prototype,"swingMotion2"),Hit.prototype),f(Hit.prototype,"twistExtent",[xit],Object.getOwnPropertyDescriptor(Hit.prototype,"twistExtent"),Hit.prototype),f(Hit.prototype,"swingExtent1",[Dit],Object.getOwnPropertyDescriptor(Hit.prototype,"swingExtent1"),Hit.prototype),f(Hit.prototype,"swingExtent2",[Oit],Object.getOwnPropertyDescriptor(Hit.prototype,"swingExtent2"),Hit.prototype),f(Hit.prototype,"twistRestitution",[Pit],Object.getOwnPropertyDescriptor(Hit.prototype,"twistRestitution"),Hit.prototype),f(Hit.prototype,"swingRestitution",[Mit],Object.getOwnPropertyDescriptor(Hit.prototype,"swingRestitution"),Hit.prototype),f(Hit.prototype,"enableSoftConstraintTwist",[Nit],Object.getOwnPropertyDescriptor(Hit.prototype,"enableSoftConstraintTwist"),Hit.prototype),f(Hit.prototype,"twistStiffness",[Lit],Object.getOwnPropertyDescriptor(Hit.prototype,"twistStiffness"),Hit.prototype),f(Hit.prototype,"twistDamping",[Bit],Object.getOwnPropertyDescriptor(Hit.prototype,"twistDamping"),Hit.prototype),f(Hit.prototype,"enableSoftConstraintSwing",[Fit],Object.getOwnPropertyDescriptor(Hit.prototype,"enableSoftConstraintSwing"),Hit.prototype),f(Hit.prototype,"swingStiffness",[kit],Object.getOwnPropertyDescriptor(Hit.prototype,"swingStiffness"),Hit.prototype),f(Hit.prototype,"swingDamping",[Uit],Object.getOwnPropertyDescriptor(Hit.prototype,"swingDamping"),Hit.prototype),zit=ua(Hit.prototype,"_swing1Motion",[wa],(function(){return b8.FREE})),Vit=ua(Hit.prototype,"_swing2Motion",[wa],(function(){return b8.FREE})),Wit=ua(Hit.prototype,"_twistMotion",[wa],(function(){return b8.FREE})),Xit=ua(Hit.prototype,"_twistExtent",[wa],(function(){return 0})),jit=ua(Hit.prototype,"_swingExtent1",[wa],(function(){return 0})),Yit=ua(Hit.prototype,"_swingExtent2",[wa],(function(){return 0})),Kit=ua(Hit.prototype,"_enableSoftConstraintSwing",[wa],(function(){return!1})),qit=ua(Hit.prototype,"_swingBounciness",[wa],(function(){return 0})),Qit=ua(Hit.prototype,"_swingStiffness",[wa],(function(){return 0})),Zit=ua(Hit.prototype,"_swingDamping",[wa],(function(){return 0})),Jit=ua(Hit.prototype,"_enableSoftConstraintTwist",[wa],(function(){return!1})),$it=ua(Hit.prototype,"_twistBounciness",[wa],(function(){return 0})),tnt=ua(Hit.prototype,"_twistStiffness",[wa],(function(){return 0})),ent=ua(Hit.prototype,"_twistDamping",[wa],(function(){return 0})),Git=Hit))||Git),Lrt=(int=va("cc.LinearDriverSettings"),nnt=Za(C8),rnt=Za(C8),snt=Za(C8),ont=Za(_n),ant=Za(_n),hnt=Za(Je),int((f((cnt=function(){function t(t){this._target=lnt&&lnt(),this._velocity=_nt&&_nt(),this._xDrive=dnt&&dnt(),this._yDrive=fnt&&fnt(),this._zDrive=pnt&&pnt(),this._strength=gnt&&gnt(),this._impl=void 0,this._impl=t}return n(t,[{key:"xDrive",get:function(){return this._xDrive},set:function(t){this._xDrive=t,this._impl.setDriverMode(0,t)}},{key:"yDrive",get:function(){return this._yDrive},set:function(t){this._yDrive=t,this._impl.setDriverMode(1,t)}},{key:"zDrive",get:function(){return this._zDrive},set:function(t){this._zDrive=t,this._impl.setDriverMode(2,t)}},{key:"targetPosition",get:function(){return this._target},set:function(t){_n.copy(this._target,t),this._impl.setLinearMotorTarget(t)}},{key:"targetVelocity",get:function(){return this._velocity},set:function(t){_n.copy(this._velocity,t),this._impl.setLinearMotorVelocity(t)}},{key:"strength",get:function(){return this._strength},set:function(t){this._strength=t,this._impl.setLinearMotorForceLimit(t)}},{key:"impl",set:function(t){this._impl=t}}]),t}()).prototype,"xDrive",[nnt],Object.getOwnPropertyDescriptor(cnt.prototype,"xDrive"),cnt.prototype),f(cnt.prototype,"yDrive",[rnt],Object.getOwnPropertyDescriptor(cnt.prototype,"yDrive"),cnt.prototype),f(cnt.prototype,"zDrive",[snt],Object.getOwnPropertyDescriptor(cnt.prototype,"zDrive"),cnt.prototype),f(cnt.prototype,"targetPosition",[ont],Object.getOwnPropertyDescriptor(cnt.prototype,"targetPosition"),cnt.prototype),f(cnt.prototype,"targetVelocity",[ant],Object.getOwnPropertyDescriptor(cnt.prototype,"targetVelocity"),cnt.prototype),f(cnt.prototype,"strength",[hnt],Object.getOwnPropertyDescriptor(cnt.prototype,"strength"),cnt.prototype),lnt=ua(cnt.prototype,"_target",[wa],(function(){return new _n})),_nt=ua(cnt.prototype,"_velocity",[wa],(function(){return new _n})),dnt=ua(cnt.prototype,"_xDrive",[wa],(function(){return C8.DISABLED})),fnt=ua(cnt.prototype,"_yDrive",[wa],(function(){return C8.DISABLED})),pnt=ua(cnt.prototype,"_zDrive",[wa],(function(){return C8.DISABLED})),gnt=ua(cnt.prototype,"_strength",[wa],(function(){return 0})),unt=cnt))||unt),Brt=(mnt=va("cc.AngularDriverSettings"),vnt=Za(C8),ynt=Za(C8),Tnt=Za(C8),Ent=Za(_n),Snt=Za(_n),Ant=Za(Je),mnt((f((Cnt=function(){function t(t){this._swingDrive1=Rnt&&Rnt(),this._swingDrive2=wnt&&wnt(),this._twistDrive=Int&&Int(),this._targetOrientation=xnt&&xnt(),this._targetVelocity=Dnt&&Dnt(),this._strength=Ont&&Ont(),this._impl=void 0,this._impl=t}return n(t,[{key:"twistDrive",get:function(){return this._twistDrive},set:function(t){this._twistDrive=t,this._impl.setDriverMode(3,t)}},{key:"swingDrive1",get:function(){return this._swingDrive1},set:function(t){this._swingDrive1=t,this._impl.setDriverMode(4,t)}},{key:"swingDrive2",get:function(){return this._swingDrive2},set:function(t){this._swingDrive2=t,this._impl.setDriverMode(5,t)}},{key:"targetOrientation",get:function(){return this._targetOrientation},set:function(t){_n.copy(this._targetOrientation,t),this._impl.setAngularMotorTarget(t)}},{key:"targetVelocity",get:function(){return this._targetVelocity},set:function(t){_n.copy(this._targetVelocity,t),this._impl.setAngularMotorVelocity(t)}},{key:"strength",get:function(){return this._strength},set:function(t){this._strength=t,this._impl.setAngularMotorForceLimit(t)}},{key:"impl",set:function(t){this._impl=t}}]),t}()).prototype,"twistDrive",[vnt],Object.getOwnPropertyDescriptor(Cnt.prototype,"twistDrive"),Cnt.prototype),f(Cnt.prototype,"swingDrive1",[ynt],Object.getOwnPropertyDescriptor(Cnt.prototype,"swingDrive1"),Cnt.prototype),f(Cnt.prototype,"swingDrive2",[Tnt],Object.getOwnPropertyDescriptor(Cnt.prototype,"swingDrive2"),Cnt.prototype),f(Cnt.prototype,"targetOrientation",[Ent],Object.getOwnPropertyDescriptor(Cnt.prototype,"targetOrientation"),Cnt.prototype),f(Cnt.prototype,"targetVelocity",[Snt],Object.getOwnPropertyDescriptor(Cnt.prototype,"targetVelocity"),Cnt.prototype),f(Cnt.prototype,"strength",[Ant],Object.getOwnPropertyDescriptor(Cnt.prototype,"strength"),Cnt.prototype),Rnt=ua(Cnt.prototype,"_swingDrive1",[wa],(function(){return C8.DISABLED})),wnt=ua(Cnt.prototype,"_swingDrive2",[wa],(function(){return C8.DISABLED})),Int=ua(Cnt.prototype,"_twistDrive",[wa],(function(){return C8.DISABLED})),xnt=ua(Cnt.prototype,"_targetOrientation",[wa],(function(){return new _n})),Dnt=ua(Cnt.prototype,"_targetVelocity",[wa],(function(){return new _n})),Ont=ua(Cnt.prototype,"_strength",[wa],(function(){return 0})),bnt=Cnt))||bnt),Frt=t("ConfigurableConstraint",(Pnt=va("cc.ConfigurableConstraint"),Mnt=Za(_n),Nnt=Za(_n),Lnt=Za(_n),Bnt=Za(_n),Fnt=Za($e),knt=Za(Je),Unt=Za(Je),Gnt=Za(Mrt),Hnt=Za(Nrt),znt=Za(Lrt),Vnt=Za(Brt),Wnt=Ia("linearLimitSettings"),Xnt=Ia("angularLimitSettings"),jnt=Ia("linearDriverSettings"),Ynt=Ia("angularDriverSettings"),Pnt((f((qnt=function(t){function e(){var e;return(e=t.call(this,A8.CONFIGURABLE)||this)._breakForce=Qnt&&Qnt(),e._breakTorque=Znt&&Znt(),e._linearLimitSettings=Jnt&&Jnt(),e._angularLimitSettings=$nt&&$nt(),e._linearDriverSettings=trt&&trt(),e._angularDriverSettings=ert&&ert(),e._pivotA=irt&&irt(),e._pivotB=nrt&&nrt(),e._autoPivotB=rrt&&rrt(),e._axis=srt&&srt(),e._secondaryAxis=ort&&ort(),e._linearLimitSettings=new Mrt(e.constraint),e._angularLimitSettings=new Nrt(e.constraint),e._linearDriverSettings=new Lrt(e.constraint),e._angularDriverSettings=new Brt(e.constraint),e}return s(e,t),e.prototype.onLoad=function(){t.prototype.onLoad.call(this),this.linearLimitSettings.impl=this.constraint,this.angularLimitSettings.impl=this.constraint,this.linearDriverSettings.impl=this.constraint,this.angularDriverSettings.impl=this.constraint},n(e,[{key:"axis",get:function(){return this._axis},set:function(t){_n.copy(this._axis,t),this.constraint.setAxis(this._axis)}},{key:"secondaryAxis",get:function(){return this._secondaryAxis},set:function(t){_n.copy(this._secondaryAxis,t),this.constraint.setSecondaryAxis(this._secondaryAxis)}},{key:"pivotA",get:function(){return this._pivotA},set:function(t){_n.copy(this._pivotA,t),this.constraint.setPivotA(this._pivotA)}},{key:"pivotB",get:function(){return this._pivotB},set:function(t){_n.copy(this._pivotB,t),this.constraint.setPivotB(this._pivotB)}},{key:"autoPivotB",get:function(){return this._autoPivotB},set:function(t){this._autoPivotB=t,this.constraint.setAutoPivotB(this._autoPivotB)}},{key:"breakForce",get:function(){return this._breakForce},set:function(t){this._breakForce=t,this.constraint.setBreakForce(t)}},{key:"breakTorque",get:function(){return this._breakTorque},set:function(t){this._breakTorque=t,this.constraint.setBreakTorque(t)}},{key:"linearLimitSettings",get:function(){return this._linearLimitSettings},set:function(t){this._linearLimitSettings=t;var e=this.constraint;e.setConstraintMode(0,t.xMotion),e.setConstraintMode(1,t.yMotion),e.setConstraintMode(2,t.zMotion);var i=t.upper,n=t.lower;e.setLinearLimit(0,n.x,i.x),e.setLinearLimit(1,n.y,i.y),e.setLinearLimit(2,n.z,i.z),e.setLinearSoftConstraint(t.enableSoftConstraint),e.setLinearDamping(t.damping),e.setLinearStiffness(t.stiffness),e.setLinearRestitution(t.restitution)}},{key:"angularLimitSettings",get:function(){return this._angularLimitSettings},set:function(t){this._angularLimitSettings=t;var e=this.constraint;e.setConstraintMode(3,t.twistMotion),e.setConstraintMode(4,t.swingMotion1),e.setConstraintMode(5,t.swingMotion2),e.setAngularExtent(t.twistExtent,t.swingExtent1,t.swingExtent2),e.setTwistRestitution(t.twistRestitution),e.setSwingRestitution(t.swingRestitution),e.setTwistSoftConstraint(t.enableSoftConstraintTwist),e.setSwingSoftConstraint(t.enableSoftConstraintSwing),e.setTwistDamping(t.twistDamping),e.setSwingDamping(t.swingDamping),e.setTwistStiffness(t.twistStiffness),e.setSwingStiffness(t.swingStiffness)}},{key:"linearDriverSettings",get:function(){return this._linearDriverSettings},set:function(t){this._linearDriverSettings=t;var e=this.constraint;e.setDriverMode(0,t.xDrive),e.setDriverMode(1,t.yDrive),e.setDriverMode(2,t.zDrive),e.setLinearMotorTarget(t.targetPosition),e.setLinearMotorVelocity(t.targetVelocity),e.setLinearMotorForceLimit(t.strength)}},{key:"angularDriverSettings",get:function(){return this._angularDriverSettings},set:function(t){this._angularDriverSettings=t;var e=this.constraint;e.setDriverMode(3,t.twistDrive),e.setDriverMode(4,t.swingDrive1),e.setDriverMode(5,t.swingDrive2),e.setAngularMotorTarget(t.targetOrientation),e.setAngularMotorVelocity(t.targetVelocity),e.setAngularMotorForceLimit(t.strength)}},{key:"constraint",get:function(){return this._constraint}}]),e}(Ket)).prototype,"axis",[Mnt],Object.getOwnPropertyDescriptor(qnt.prototype,"axis"),qnt.prototype),f(qnt.prototype,"secondaryAxis",[Nnt],Object.getOwnPropertyDescriptor(qnt.prototype,"secondaryAxis"),qnt.prototype),f(qnt.prototype,"pivotA",[Lnt],Object.getOwnPropertyDescriptor(qnt.prototype,"pivotA"),qnt.prototype),f(qnt.prototype,"pivotB",[Bnt],Object.getOwnPropertyDescriptor(qnt.prototype,"pivotB"),qnt.prototype),f(qnt.prototype,"autoPivotB",[Fnt],Object.getOwnPropertyDescriptor(qnt.prototype,"autoPivotB"),qnt.prototype),f(qnt.prototype,"breakForce",[knt],Object.getOwnPropertyDescriptor(qnt.prototype,"breakForce"),qnt.prototype),f(qnt.prototype,"breakTorque",[Unt],Object.getOwnPropertyDescriptor(qnt.prototype,"breakTorque"),qnt.prototype),f(qnt.prototype,"linearLimitSettings",[Gnt],Object.getOwnPropertyDescriptor(qnt.prototype,"linearLimitSettings"),qnt.prototype),f(qnt.prototype,"angularLimitSettings",[Hnt],Object.getOwnPropertyDescriptor(qnt.prototype,"angularLimitSettings"),qnt.prototype),f(qnt.prototype,"linearDriverSettings",[znt],Object.getOwnPropertyDescriptor(qnt.prototype,"linearDriverSettings"),qnt.prototype),f(qnt.prototype,"angularDriverSettings",[Vnt],Object.getOwnPropertyDescriptor(qnt.prototype,"angularDriverSettings"),qnt.prototype),Qnt=ua(qnt.prototype,"_breakForce",[wa],(function(){return 1e8})),Znt=ua(qnt.prototype,"_breakTorque",[wa],(function(){return 1e8})),Jnt=ua(qnt.prototype,"_linearLimitSettings",[wa,Wnt],null),$nt=ua(qnt.prototype,"_angularLimitSettings",[wa,Xnt],null),trt=ua(qnt.prototype,"_linearDriverSettings",[wa,jnt],null),ert=ua(qnt.prototype,"_angularDriverSettings",[wa,Ynt],null),irt=ua(qnt.prototype,"_pivotA",[wa],(function(){return new _n})),nrt=ua(qnt.prototype,"_pivotB",[wa],(function(){return new _n})),rrt=ua(qnt.prototype,"_autoPivotB",[wa],(function(){return!1})),srt=ua(qnt.prototype,"_axis",[wa],(function(){return new _n(0,1,0)})),ort=ua(qnt.prototype,"_secondaryAxis",[wa],(function(){return new _n(1,0,0)})),Knt=qnt))||Knt)),krt=t("PointToPointConstraint",(art=va("cc.PointToPointConstraint"),hrt=Za(_n),urt=Za(_n),art((f((lrt=function(t){function e(){var e;return(e=t.call(this,A8.POINT_TO_POINT)||this)._pivotA=_rt&&_rt(),e._pivotB=drt&&drt(),e}return s(e,t),n(e,[{key:"pivotA",get:function(){return this._pivotA},set:function(t){_n.copy(this._pivotA,t),this.constraint.setPivotA(this._pivotA)}},{key:"pivotB",get:function(){return this._pivotB},set:function(t){_n.copy(this._pivotB,t),this.constraint.setPivotB(this._pivotB)}},{key:"constraint",get:function(){return this._constraint}}]),e}(Ket)).prototype,"pivotA",[hrt],Object.getOwnPropertyDescriptor(lrt.prototype,"pivotA"),lrt.prototype),f(lrt.prototype,"pivotB",[urt],Object.getOwnPropertyDescriptor(lrt.prototype,"pivotB"),lrt.prototype),_rt=ua(lrt.prototype,"_pivotA",[wa],(function(){return new _n})),drt=ua(lrt.prototype,"_pivotB",[wa],(function(){return new _n})),crt=lrt))||crt));new _n(0,0,0),new _n(0,0,0);var Urt,Grt,Hrt,zrt,Vrt,Wrt,Xrt,jrt,Yrt,Krt,qrt=t("CharacterController",(frt=va("cc.CharacterController"),prt=Za(j7.PhysicsGroup),grt=Za(Je),mrt=Za(Je),vrt=Za(Je),yrt=Za(Je),Trt=Za(_n),frt(Ert=Ea((f((Srt=function(t){function e(e){var i;return(i=t.call(this)||this).type=void 0,i._cct=null,i._group=Art&&Art(),i._minMoveDistance=brt&&brt(),i._stepOffset=Crt&&Crt(),i._slopeLimit=Rrt&&Rrt(),i._skinWidth=wrt&&wrt(),i._center=Irt&&Irt(),i._initialized=!1,i._prevPos=new _n,i._currentPos=new _n,i._velocity=new _n,i._centerWorldPosition=new _n,i._needCollisionEvent=!1,i._needTriggerEvent=!1,i.type=e,i}s(e,t);var i=e.prototype;return i.onLoad=function(){N8.runInEditor&&(this._cct=function(t){return Y8.INITED||(Y8.INITED=!0,Y8[R8.BOX]=function(){return F8(N8.wrapper.BoxCharacterController,M8.BoxCharacterController)?K8:new N8.wrapper.BoxCharacterController},Y8[R8.CAPSULE]=function(){return F8(N8.wrapper.CapsuleCharacterController,M8.CapsuleCharacterController)?K8:new N8.wrapper.CapsuleCharacterController}),Y8[t]()}(this.type),this._initialized=this._cct.initialize(this),this._cct.onLoad())},i.onEnable=function(){this._cct&&this._cct.onEnable()},i.onDisable=function(){this._cct&&this._cct.onDisable()},i.onDestroy=function(){this._cct&&(this._needCollisionEvent=!1,this._needTriggerEvent=!1,this._cct.updateEventListener(),this._cct.onDestroy(),this._cct=null)},i.move=function(t){if(this._isInitialized){this._prevPos.set(this.centerWorldPosition);var e=j7.instance.fixedTimeStep;this._cct.move(t,this._minMoveDistance,e),this._currentPos.set(this.centerWorldPosition),this._velocity=this._currentPos.subtract(this._prevPos).multiplyScalar(1/e),this._cct.syncPhysicsToScene()}},i.on=function(e,i,n,r){var s=t.prototype.on.call(this,e,i,n,r);return this._updateNeedEvent(e),s},i.off=function(e,i,n){t.prototype.off.call(this,e,i,n),this._updateNeedEvent()},i.once=function(e,i,n){var r=t.prototype.once.call(this,e,i,n);return this._updateNeedEvent(e),r},i.getGroup=function(){return this._isInitialized?this._cct.getGroup():0},i.setGroup=function(t){this._isInitialized&&this._cct.setGroup(t)},i.addGroup=function(t){this._isInitialized&&this._cct.addGroup(t)},i.removeGroup=function(t){this._isInitialized&&this._cct.removeGroup(t)},i.getMask=function(){return this._isInitialized?this._cct.getMask():0},i.setMask=function(t){this._isInitialized&&this._cct.setMask(t)},i.addMask=function(t){this._isInitialized&&this._cct.addMask(t)},i.removeMask=function(t){this._isInitialized&&this._cct.removeMask(t)},i._updateNeedEvent=function(t){this.isValid&&(void 0!==t?("onControllerColliderHit"===t&&(this._needCollisionEvent=!0),"onControllerTriggerEnter"!==t&&"onControllerTriggerStay"!==t&&"onControllerTriggerExit"!==t||(this._needTriggerEvent=!0)):(this.hasEventListener("onControllerColliderHit")||(this._needCollisionEvent=!1),this.hasEventListener("onControllerTriggerEnter")||this.hasEventListener("onControllerTriggerStay")||this.hasEventListener("onControllerTriggerExit")||(this._needTriggerEvent=!1)),this._cct&&this._cct.updateEventListener())},n(e,[{key:"group",get:function(){return this._group},set:function(t){this._group=t,this._cct&&this._cct.getGroup()!==t&&this._cct.setGroup(t)}},{key:"minMoveDistance",get:function(){return this._minMoveDistance},set:function(t){this._minMoveDistance!==t&&(this._minMoveDistance=Math.abs(t))}},{key:"stepOffset",get:function(){return this._stepOffset},set:function(t){this._stepOffset!==t&&(this._stepOffset=Math.abs(t),this._cct&&this._cct.setStepOffset(t))}},{key:"slopeLimit",get:function(){return this._slopeLimit},set:function(t){this._slopeLimit!==t&&(this._slopeLimit=Math.abs(t),this._cct&&this._cct.setSlopeLimit(t))}},{key:"skinWidth",get:function(){return this._skinWidth},set:function(t){this._skinWidth!==t&&(this._skinWidth=Math.abs(t),this._cct&&this._cct.setContactOffset(Math.max(1e-4,t)))}},{key:"center",get:function(){return this._center},set:function(t){_n.equals(this._center,t)||_n.copy(this._center,t)}},{key:"_isInitialized",get:function(){return!(null===this._cct||!this._initialized)}},{key:"centerWorldPosition",get:function(){return this._isInitialized&&this._cct.getPosition(this._centerWorldPosition),this._centerWorldPosition},set:function(t){this._isInitialized&&this._cct.setPosition(t)}},{key:"velocity",get:function(){return this._velocity}},{key:"isGrounded",get:function(){return this._cct.onGround()}},{key:"needCollisionEvent",get:function(){return this._needCollisionEvent}},{key:"needTriggerEvent",get:function(){return this._needTriggerEvent}}]),e}(so(xp))).prototype,"group",[prt],Object.getOwnPropertyDescriptor(Srt.prototype,"group"),Srt.prototype),f(Srt.prototype,"minMoveDistance",[grt],Object.getOwnPropertyDescriptor(Srt.prototype,"minMoveDistance"),Srt.prototype),f(Srt.prototype,"stepOffset",[mrt],Object.getOwnPropertyDescriptor(Srt.prototype,"stepOffset"),Srt.prototype),f(Srt.prototype,"slopeLimit",[vrt],Object.getOwnPropertyDescriptor(Srt.prototype,"slopeLimit"),Srt.prototype),f(Srt.prototype,"skinWidth",[yrt],Object.getOwnPropertyDescriptor(Srt.prototype,"skinWidth"),Srt.prototype),f(Srt.prototype,"center",[Trt],Object.getOwnPropertyDescriptor(Srt.prototype,"center"),Srt.prototype),Art=ua(Srt.prototype,"_group",[wa],(function(){return j7.PhysicsGroup.DEFAULT})),brt=ua(Srt.prototype,"_minMoveDistance",[wa],(function(){return.001})),Crt=ua(Srt.prototype,"_stepOffset",[wa],(function(){return.5})),Rrt=ua(Srt.prototype,"_slopeLimit",[wa],(function(){return 45})),wrt=ua(Srt.prototype,"_skinWidth",[wa],(function(){return.01})),Irt=ua(Srt.prototype,"_center",[wa],(function(){return new _n})),Ert=Srt))||Ert)||Ert));new _n(0,0,0);var Qrt,Zrt,Jrt,$rt,tst,est,ist,nst,rst=t("BoxCharacterController",(Urt=va("cc.BoxCharacterController"),Grt=Ta(-1),Hrt=Za(Je),zrt=Za(Je),Vrt=Za(Je),Urt(Wrt=Grt((f((Xrt=function(t){function e(){var e;return(e=t.call(this,R8.BOX)||this)._halfHeight=jrt&&jrt(),e._halfSideExtent=Yrt&&Yrt(),e._halfForwardExtent=Krt&&Krt(),e}return s(e,t),n(e,[{key:"halfHeight",get:function(){return this._halfHeight},set:function(t){this._halfHeight!==t&&(this._halfHeight=Math.abs(t),this._cct&&this._cct.setHalfHeight(t))}},{key:"halfSideExtent",get:function(){return this._halfSideExtent},set:function(t){this._halfSideExtent!==t&&(this._halfSideExtent=Math.abs(t),this._cct&&this._cct.setHalfSideExtent(t))}},{key:"halfForwardExtent",get:function(){return this._halfForwardExtent},set:function(t){this._halfForwardExtent!==t&&(this._halfForwardExtent=Math.abs(t),this._cct&&this._cct.setHalfForwardExtent(t))}}]),e}(qrt)).prototype,"halfHeight",[Hrt],Object.getOwnPropertyDescriptor(Xrt.prototype,"halfHeight"),Xrt.prototype),f(Xrt.prototype,"halfSideExtent",[zrt],Object.getOwnPropertyDescriptor(Xrt.prototype,"halfSideExtent"),Xrt.prototype),f(Xrt.prototype,"halfForwardExtent",[Vrt],Object.getOwnPropertyDescriptor(Xrt.prototype,"halfForwardExtent"),Xrt.prototype),jrt=ua(Xrt.prototype,"_halfHeight",[wa],(function(){return.5})),Yrt=ua(Xrt.prototype,"_halfSideExtent",[wa],(function(){return.5})),Krt=ua(Xrt.prototype,"_halfForwardExtent",[wa],(function(){return.5})),Wrt=Xrt))||Wrt)||Wrt));new _n(0,0,0);var sst=t("CapsuleCharacterController",(Qrt=va("cc.CapsuleCharacterController"),Zrt=Ta(-1),Jrt=Za(Je),$rt=Za(Je),Qrt(tst=Zrt((f((est=function(t){function e(){var e;return(e=t.call(this,R8.CAPSULE)||this)._radius=ist&&ist(),e._height=nst&&nst(),e}return s(e,t),n(e,[{key:"radius",get:function(){return this._radius},set:function(t){this._radius!==t&&(this._radius=Math.abs(t),this._cct&&this._cct.setRadius(t))}},{key:"height",get:function(){return this._height},set:function(t){this._height!==t&&(this._height=Math.abs(t),this._cct&&this._cct.setHeight(t))}}]),e}(qrt)).prototype,"radius",[Jrt],Object.getOwnPropertyDescriptor(est.prototype,"radius"),est.prototype),f(est.prototype,"height",[$rt],Object.getOwnPropertyDescriptor(est.prototype,"height"),est.prototype),ist=ua(est.prototype,"_radius",[wa],(function(){return.5})),nst=ua(est.prototype,"_height",[wa],(function(){return 1})),tst=est))||tst)||tst)),ost=function(){this.worldPosition=new _n,this.worldNormal=new _n,this.motionDirection=new _n,this.motionLength=0};m.PhysicsSystem=j7,m.PhysicsMaterial=R7,m.PhysicsRayResult=w7,m.ConstantForce=ctt;var ast,hst,ust,cst,lst,_st=Object.freeze({__proto__:null,PhysicsSystem:j7,PhysicsRayResult:w7,PhysicsLineStripCastResult:I7,get Collider(){return c9},BoxCollider:f9,SphereCollider:S9,CapsuleCollider:D9,MeshCollider:J9,CylinderCollider:k9,ConeCollider:Z9,TerrainCollider:Htt,get SimplexCollider(){return ztt},PlaneCollider:Yet,get Constraint(){return Ket},HingeConstraint:Ort,FixedConstraint:Prt,PointToPointConstraint:krt,ConfigurableConstraint:Frt,get RigidBody(){return r9},PhysicsMaterial:R7,ConstantForce:ctt,CharacterController:qrt,BoxCharacterController:rst,CapsuleCharacterController:sst,selector:N8,utils:dq,CharacterControllerContact:ost,get ERigidBodyType(){return v8},get EAxisDirection(){return y8},get ED6Axis(){return T8},get ESimplexType(){return E8},get EColliderType(){return S8},get EConstraintType(){return A8},get EConstraintMode(){return b8},get EDriverMode(){return C8},get ECharacterControllerType(){return R8},get PhysicsGroup(){return w8},get EPhysicsDrawFlags(){return I8}});t("physics",_st),rt(j7,"PhysicsSystem",[{name:"ins",newName:"instance"},{name:"PHYSICS_AMMO",newName:"PHYSICS_BULLET"}]),rt(j7.prototype,"PhysicsSystem.prototype",[{name:"deltaTime",newName:"fixedTimeStep"},{name:"maxSubStep",newName:"maxSubSteps"}]),st(j7.prototype,"PhysicsSystem.prototype",[{name:"useFixedTime"},{name:"useCollisionMatrix"},{name:"updateCollisionMatrix"},{name:"resetCollisionMatrix"},{name:"isCollisionGroup"},{name:"setCollisionGroup"}]),rt(c9.prototype,"Collider.prototype",[{name:"attachedRigidbody",newName:"attachedRigidBody"},{name:"TYPE",newName:"type"}]),rt(c9,"Collider",[{name:"EColliderType",newName:"Type"},{name:"EAxisDirection",newName:"Axis"}]),rt(Ket,"Constraint",[{name:"EConstraintType",newName:"Type"}]),rt(f9.prototype,"BoxCollider.prototype",[{name:"boxShape",newName:"shape"}]),rt(S9.prototype,"SphereCollider.prototype",[{name:"sphereShape",newName:"shape"}]),rt(D9.prototype,"CapsuleCollider.prototype",[{name:"capsuleShape",newName:"shape"}]),rt(r9.prototype,"RigidBody.prototype",[{name:"rigidBody",newName:"body"}]),rt(r9,"RigidBody",[{name:"ERigidBodyType",newName:"Type"}]),st(r9.prototype,"RigidBody.prototype",[{name:"fixedRotation"}]),m.RigidBodyComponent=r9,Jt(r9,"cc.RigidBodyComponent"),m.ColliderComponent=c9,Jt(c9,"cc.ColliderComponent"),m.BoxColliderComponent=f9,Jt(f9,"cc.BoxColliderComponent"),m.SphereColliderComponent=S9,Jt(S9,"cc.SphereColliderComponent"),Jt(D9,"cc.CapsuleColliderComponent"),Jt(J9,"cc.MeshColliderComponent"),Jt(k9,"cc.CylinderColliderComponent"),m.PhysicMaterial=R7,Jt(R7,"cc.PhysicMaterial"),m.physics=_st,function(t){t[t.BODY_RE_ADD=1]="BODY_RE_ADD",t[t.GHOST_RE_ADD=2]="GHOST_RE_ADD"}(ast||(ast={})),function(t){t[t.CF_STATIC_OBJECT=1]="CF_STATIC_OBJECT",t[t.CF_KINEMATIC_OBJECT=2]="CF_KINEMATIC_OBJECT",t[t.CF_NO_CONTACT_RESPONSE=4]="CF_NO_CONTACT_RESPONSE",t[t.CF_CUSTOM_MATERIAL_CALLBACK=8]="CF_CUSTOM_MATERIAL_CALLBACK",t[t.CF_CHARACTER_OBJECT=16]="CF_CHARACTER_OBJECT",t[t.CF_DISABLE_VISUALIZE_OBJECT=32]="CF_DISABLE_VISUALIZE_OBJECT",t[t.CF_DISABLE_SPU_COLLISION_PROCESSING=64]="CF_DISABLE_SPU_COLLISION_PROCESSING"}(hst||(hst={})),function(t){t[t.CO_COLLISION_OBJECT=1]="CO_COLLISION_OBJECT",t[t.CO_RIGID_BODY=2]="CO_RIGID_BODY",t[t.CO_GHOST_OBJECT=4]="CO_GHOST_OBJECT",t[t.CO_SOFT_BODY=8]="CO_SOFT_BODY",t[t.CO_HF_FLUID=16]="CO_HF_FLUID",t[t.CO_USER_TYPE=32]="CO_USER_TYPE",t[t.CO_FEATHERSTONE_LINK=64]="CO_FEATHERSTONE_LINK"}(ust||(ust={})),function(t){t[t.ACTIVE_TAG=1]="ACTIVE_TAG",t[t.ISLAND_SLEEPING=2]="ISLAND_SLEEPING",t[t.WANTS_DEACTIVATION=3]="WANTS_DEACTIVATION",t[t.DISABLE_DEACTIVATION=4]="DISABLE_DEACTIVATION",t[t.DISABLE_SIMULATION=5]="DISABLE_SIMULATION"}(cst||(cst={})),function(t){t[t.BT_DISABLE_WORLD_GRAVITY=1]="BT_DISABLE_WORLD_GRAVITY",t[t.BT_ENABLE_GYROPSCOPIC_FORCE=2]="BT_ENABLE_GYROPSCOPIC_FORCE"}(lst||(lst={}));var dst=e7,fst=i7,pst=function(){var t=e.prototype;function e(){this.id=void 0,this._isEnabled=!1,this._isUsingCCD=!1,this._sharedBody=void 0,this._rigidBody=void 0,this.id=e.idCounter++}return t.setMass=function(t){this._rigidBody.isDynamic&&(q8.RigidBody_setMass(this.impl,t),this._wakeUpIfSleep(),this._sharedBody.dirty|=ast.BODY_RE_ADD)},t.setType=function(t){this._sharedBody.setType(t)},t.setLinearDamping=function(){q8.RigidBody_setDamping(this.impl,this._rigidBody.linearDamping,this._rigidBody.angularDamping)},t.setAngularDamping=function(){q8.RigidBody_setDamping(this.impl,this._rigidBody.linearDamping,this._rigidBody.angularDamping)},t.useGravity=function(t){if(this._rigidBody.isDynamic){var e=q8.RigidBody_getFlags(this.impl);t?e&=~lst.BT_DISABLE_WORLD_GRAVITY:(q8.RigidBody_setGravity(this.impl,T7(t7.instance.BT_V3_0,_n.ZERO)),e|=lst.BT_DISABLE_WORLD_GRAVITY),q8.RigidBody_setFlags(this.impl,e),this._wakeUpIfSleep(),this._sharedBody.dirty|=ast.BODY_RE_ADD}},t.useCCD=function(t){q8.CollisionObject_setCcdMotionThreshold(this.impl,t?.01:0),q8.CollisionObject_setCcdSweptSphereRadius(this.impl,t?.1:0),this._isUsingCCD=t},t.isUsingCCD=function(){return this._isUsingCCD},t.setLinearFactor=function(t){q8.RigidBody_setLinearFactor(this.impl,T7(t7.instance.BT_V3_0,t)),this._wakeUpIfSleep()},t.setAngularFactor=function(t){q8.RigidBody_setAngularFactor(this.impl,T7(t7.instance.BT_V3_0,t)),this._wakeUpIfSleep()},t.setAllowSleep=function(t){this._rigidBody.isDynamic&&(t?q8.CollisionObject_forceActivationState(this.impl,cst.ACTIVE_TAG):q8.CollisionObject_forceActivationState(this.impl,cst.DISABLE_DEACTIVATION),this._wakeUpIfSleep())},t.clearState=function(){q8.RigidBody_clearState(this.impl)},t.clearVelocity=function(){this.setLinearVelocity(_n.ZERO),this.setAngularVelocity(_n.ZERO)},t.clearForces=function(){q8.RigidBody_clearForces(this.impl)},t.initialize=function(t){this._rigidBody=t,this._sharedBody=j7.instance.physicsWorld.getSharedBody(this._rigidBody.node,this),this._sharedBody.reference=!0},t.onEnable=function(){this._isEnabled=!0,this.setMass(this._rigidBody.mass),this.setAllowSleep(this._rigidBody.allowSleep),this.setLinearDamping(this._rigidBody.linearDamping),this.setAngularDamping(this._rigidBody.angularDamping),this.setLinearFactor(this._rigidBody.linearFactor),this.setAngularFactor(this._rigidBody.angularFactor),this.useGravity(this._rigidBody.useGravity),this._sharedBody.bodyEnabled=!0},t.onDisable=function(){this._isEnabled=!1,this._sharedBody.bodyEnabled=!1},t.onDestroy=function(){this._sharedBody.reference=!1,this._rigidBody=null,this._sharedBody=null},t.wakeUp=function(t){void 0===t&&(t=!0),q8.CollisionObject_activate(this.impl,t)},t.sleep=function(){var t=q8.CollisionObject_getActivationState(this.impl);t!==cst.DISABLE_DEACTIVATION&&t!==cst.DISABLE_SIMULATION&&q8.CollisionObject_forceActivationState(this.impl,cst.ISLAND_SLEEPING)},t.setSleepThreshold=function(t){this._wakeUpIfSleep(),q8.RigidBody_setSleepingThresholds(this.impl,t,t)},t.getSleepThreshold=function(){return q8.RigidBody_getLinearSleepingThreshold(this.impl)},t.getLinearVelocity=function(t){return E7(t,q8.RigidBody_getLinearVelocity(this.impl))},t.setLinearVelocity=function(t){this._wakeUpIfSleep(),T7(q8.RigidBody_getLinearVelocity(this.impl),t)},t.getAngularVelocity=function(t){return E7(t,q8.RigidBody_getAngularVelocity(this.impl))},t.setAngularVelocity=function(t){this._wakeUpIfSleep(),T7(q8.RigidBody_getAngularVelocity(this.impl),t)},t.applyLocalForce=function(t,e){this._sharedBody.syncSceneToPhysics(),this._wakeUpIfSleep();var i=this._sharedBody.node.worldRotation,n=_n.transformQuat(dst,t,i),r=e?_n.transformQuat(fst,e,i):_n.ZERO;q8.RigidBody_applyForce(this.impl,T7(t7.instance.BT_V3_0,n),T7(t7.instance.BT_V3_1,r))},t.applyLocalTorque=function(t){this._sharedBody.syncSceneToPhysics(),this._wakeUpIfSleep(),_n.transformQuat(dst,t,this._sharedBody.node.worldRotation),q8.RigidBody_applyTorque(this.impl,T7(t7.instance.BT_V3_0,dst))},t.applyLocalImpulse=function(t,e){this._sharedBody.syncSceneToPhysics(),this._wakeUpIfSleep();var i=this._sharedBody.node.worldRotation,n=_n.transformQuat(dst,t,i),r=e?_n.transformQuat(fst,e,i):_n.ZERO;q8.RigidBody_applyImpulse(this.impl,T7(t7.instance.BT_V3_0,n),T7(t7.instance.BT_V3_1,r))},t.applyForce=function(t,e){this._sharedBody.syncSceneToPhysics(),this._wakeUpIfSleep();var i=e||_n.ZERO;q8.RigidBody_applyForce(this.impl,T7(t7.instance.BT_V3_0,t),T7(t7.instance.BT_V3_1,i))},t.applyTorque=function(t){this._sharedBody.syncSceneToPhysics(),this._wakeUpIfSleep(),q8.RigidBody_applyTorque(this.impl,T7(t7.instance.BT_V3_0,t))},t.applyImpulse=function(t,e){this._sharedBody.syncSceneToPhysics(),this._wakeUpIfSleep();var i=e||_n.ZERO;q8.RigidBody_applyImpulse(this.impl,T7(t7.instance.BT_V3_0,t),T7(t7.instance.BT_V3_1,i))},t.getGroup=function(){return this._sharedBody.collisionFilterGroup},t.setGroup=function(t){this._sharedBody.collisionFilterGroup=t},t.addGroup=function(t){this._sharedBody.collisionFilterGroup|=t},t.removeGroup=function(t){this._sharedBody.collisionFilterGroup&=~t},t.getMask=function(){return this._sharedBody.collisionFilterMask},t.setMask=function(t){this._sharedBody.collisionFilterMask=t},t.addMask=function(t){this._sharedBody.collisionFilterMask|=t},t.removeMask=function(t){this._sharedBody.collisionFilterMask&=~t},t._wakeUpIfSleep=function(){this.isAwake||q8.CollisionObject_activate(this.impl,!0)},n(e,[{key:"isAwake",get:function(){var t=q8.CollisionObject_getActivationState(this.impl);return t===cst.ACTIVE_TAG||t===cst.DISABLE_DEACTIVATION}},{key:"isSleepy",get:function(){return q8.CollisionObject_getActivationState(this.impl)===cst.WANTS_DEACTIVATION}},{key:"isSleeping",get:function(){return q8.CollisionObject_getActivationState(this.impl)===cst.ISLAND_SLEEPING}},{key:"impl",get:function(){return this._sharedBody.body}},{key:"rigidBody",get:function(){return this._rigidBody}},{key:"sharedBody",get:function(){return this._sharedBody}},{key:"isEnabled",get:function(){return this._isEnabled}}]),e}();pst.idCounter=0;var gst={syncPhysicsToGraphics:function(t){Q8.CACHE.getWrapper(t,Q8.BODY_CACHE_NAME).syncPhysicsToGraphics()},onShapeHitExt:function(t,e){Q8.CACHE.getWrapper(e,Q8.CCT_CACHE_NAME).onShapeHitExt(t)},onDebugDrawLine:function(t,e,i){var n=Q8.CACHE.world;n&&n.onDebugDrawLine(t,e,i)},clearLines:function(){var t=Q8.CACHE.world;t&&t.onClearLines()},flushLines:function(){}},mst=e7,vst=r7,yst=0,Tst=function(){function t(e,i){this.id=void 0,this.node=void 0,this.wrappedWorld=void 0,this.wrappedJoints0=[],this.wrappedJoints1=[],this.dirty=0,this._collisionFilterGroup=j7.PhysicsGroup.DEFAULT,this._collisionFilterMask=-1,this.ref=0,this.bodyIndex=-1,this.ghostIndex=-1,this._bodyStruct=void 0,this._ghostStruct=void 0,this._wrappedBody=null,this.id=t.idCounter++,this.wrappedWorld=i,this.node=e}t.getSharedBody=function(e,i,n){var r,s=e.uuid;if(t.sharedBodesMap.has(s))r=t.sharedBodesMap.get(s);else{r=new t(e,i);var o=w8.DEFAULT,a=j7.instance.collisionMatrix[o];r._collisionFilterGroup=o,r._collisionFilterMask=a,t.sharedBodesMap.set(e.uuid,r)}if(n){r._wrappedBody=n;var h=n.rigidBody.group,u=j7.instance.collisionMatrix[h];r._collisionFilterGroup=h,r._collisionFilterMask=u}return r};var e=t.prototype;return e._instantiateBodyStruct=function(){if(!this._bodyStruct){var t=0;this._wrappedBody&&this._wrappedBody.rigidBody.enabled&&this._wrappedBody.rigidBody.isDynamic&&(t=this._wrappedBody.rigidBody.mass);var e=t7.instance.BT_TRANSFORM_0,i=t7.instance.BT_QUAT_0;T7(q8.Transform_getOrigin(e),this.node.worldPosition),S7(i,this.node.worldRotation),q8.Transform_setRotation(e,i);var n=q8.MotionState.implement(gst).$$.ptr;q8.ccMotionState_setup(n,this.id,e);var r=q8.RigidBody_new(t,n),s=j7.instance.sleepThreshold;q8.RigidBody_setSleepingThresholds(r,s,s),this._bodyStruct={id:yst++,body:r,motionState:n,compound:q8.ccCompoundShape_new(),wrappedShapes:[],useCompound:!1},t7.setWrapper(this.id,Q8.BODY_CACHE_NAME,this),this._ghostStruct&&q8.CollisionObject_setIgnoreCollisionCheck(this.ghost,this.body,!0),this._wrappedBody&&this.setBodyType(this._wrappedBody.rigidBody.type)}},e._instantiateGhostStruct=function(){if(!this._ghostStruct){var t=q8.CollisionObject_new(),e=q8.ccCompoundShape_new();q8.CollisionObject_setCollisionShape(t,e),q8.CollisionObject_setCollisionFlags(t,hst.CF_STATIC_OBJECT|hst.CF_NO_CONTACT_RESPONSE),this._ghostStruct={id:yst++,ghost:t,compound:e,wrappedShapes:[]},this._bodyStruct&&q8.CollisionObject_setIgnoreCollisionCheck(this.body,this.ghost,!0),this._wrappedBody&&this.setGhostType(this._wrappedBody.rigidBody.type)}},e.setType=function(t){this.setBodyType(t),this.setGhostType(t)},e.setBodyType=function(t){if(this._bodyStruct&&this._wrappedBody){var e=this._bodyStruct.body,i=this._wrappedBody,n=i.rigidBody,r=q8.CollisionObject_getCollisionFlags(e),s=t7.instance.BT_V3_0;switch(t){case v8.DYNAMIC:r&=~hst.CF_KINEMATIC_OBJECT,r&=~hst.CF_STATIC_OBJECT,q8.CollisionObject_setCollisionFlags(e,r),i.setMass(n.mass),i.useGravity(n.useGravity),i.setAllowSleep(n.allowSleep);break;case v8.KINEMATIC:q8.Vec3_set(s,0,0,0),q8.RigidBody_setMassProps(e,0,s),r|=hst.CF_KINEMATIC_OBJECT,r&=~hst.CF_STATIC_OBJECT,q8.CollisionObject_setCollisionFlags(e,r),q8.CollisionObject_forceActivationState(e,cst.DISABLE_DEACTIVATION);break;case v8.STATIC:default:q8.Vec3_set(s,0,0,0),q8.RigidBody_setMassProps(e,0,s),r|=hst.CF_STATIC_OBJECT,r&=~hst.CF_KINEMATIC_OBJECT,q8.CollisionObject_setCollisionFlags(e,r),q8.CollisionObject_forceActivationState(e,cst.ISLAND_SLEEPING)}this.dirty|=ast.BODY_RE_ADD}},e.setGhostType=function(t){if(this._ghostStruct){var e=this._ghostStruct.ghost,i=q8.CollisionObject_getCollisionFlags(e);switch(t){case v8.DYNAMIC:case v8.KINEMATIC:i&=~hst.CF_STATIC_OBJECT,i|=hst.CF_KINEMATIC_OBJECT,q8.CollisionObject_setCollisionFlags(e,i),q8.CollisionObject_forceActivationState(e,cst.DISABLE_DEACTIVATION);break;case v8.STATIC:default:i&=~hst.CF_KINEMATIC_OBJECT,i|=hst.CF_STATIC_OBJECT,q8.CollisionObject_setCollisionFlags(e,i),q8.CollisionObject_forceActivationState(e,cst.ISLAND_SLEEPING)}this.dirty|=ast.GHOST_RE_ADD}},e.addShape=function(t,e){function i(t,e){q8.CollisionObject_setCollisionShape(t.body,e),t.dirty|=ast.BODY_RE_ADD,t._wrappedBody&&t._wrappedBody.isEnabled&&t._wrappedBody.setMass(t._wrappedBody.rigidBody.mass)}if(e)this.ghostStruct.wrappedShapes.indexOf(t)<0&&(this.ghostStruct.wrappedShapes.push(t),t.setCompound(this.ghostCompoundShape),this.ghostEnabled=!0);else if(this.bodyStruct.wrappedShapes.indexOf(t)<0){if(this.bodyStruct.wrappedShapes.push(t),this.bodyStruct.useCompound)t.setCompound(this.bodyCompoundShape);else{var n=this.bodyStruct.wrappedShapes.length;if(1!==n||t.needCompound()){this.bodyStruct.useCompound=!0;for(var r=0;r<n;r++)this.bodyStruct.wrappedShapes[r].setCompound(this.bodyCompoundShape);i(this,this.bodyStruct.compound)}else i(this,t.impl)}this.bodyEnabled=!0}},e.removeShape=function(t,e){if(e){var i=this.ghostStruct.wrappedShapes.indexOf(t);i>=0&&(he(this.ghostStruct.wrappedShapes,i),t.setCompound(0),this.ghostEnabled=!1)}else{var n=this.bodyStruct.wrappedShapes.indexOf(t);n>=0&&(this.bodyStruct.useCompound?t.setCompound(0):q8.CollisionObject_setCollisionShape(this.body,q8.EmptyShape_static()),q8.CollisionObject_activate(this.body,!0),this.dirty|=ast.BODY_RE_ADD,he(this.bodyStruct.wrappedShapes,n),this.bodyEnabled=!1)}},e.addJoint=function(t,e){e?this.wrappedJoints1.indexOf(t)<0&&this.wrappedJoints1.push(t):this.wrappedJoints0.indexOf(t)<0&&this.wrappedJoints0.push(t)},e.removeJoint=function(t,e){if(e){var i=this.wrappedJoints1.indexOf(t);i>=0&&he(this.wrappedJoints1,i)}else{var n=this.wrappedJoints0.indexOf(t);n>=0&&he(this.wrappedJoints0,n)}},e.updateDirty=function(){this.dirty&&(this.bodyIndex>=0&&this.dirty&ast.BODY_RE_ADD&&this.updateBodyByReAdd(),this.ghostIndex>=0&&this.dirty&ast.GHOST_RE_ADD&&this.updateGhostByReAdd(),this.dirty=0)},e.syncSceneToPhysics=function(){if(this.node.hasChangedFlags){var t=t7.instance.BT_QUAT_0,e=q8.CollisionObject_getWorldTransform(this.body);if(S7(t,this.node.worldRotation),T7(q8.Transform_getOrigin(e),this.node.worldPosition),q8.Transform_setRotation(e,t),this.node.hasChangedFlags&Ig.SCALE&&this.syncBodyScale(),q8.CollisionObject_isKinematicObject(this.body)){var i=q8.RigidBody_getMotionState(this.body);i&&q8.MotionState_setWorldTransform(i,e)}else this.isBodySleeping()&&q8.CollisionObject_activate(this.body,!1)}},e.syncPhysicsToScene=function(){q8.CollisionObject_isStaticOrKinematicObject(this.body)||this.syncPhysicsToGraphics()},e.syncPhysicsToGraphics=function(){if(!this.isBodySleeping()){var t=t7.instance.BT_QUAT_0,e=t7.instance.BT_TRANSFORM_0;q8.RigidBody_getWorldTransform(this.body,e);var i=q8.Transform_getRotationAndOrigin(e,t);if(this.node.worldRotation=A7(vst,t),this.node.worldPosition=E7(mst,i),this._ghostStruct){var n=q8.CollisionObject_getWorldTransform(this.ghost);T7(q8.Transform_getOrigin(n),this.node.worldPosition),S7(t,this.node.worldRotation),q8.Transform_setRotation(n,t)}}},e.syncSceneToGhost=function(){if(this.node.hasChangedFlags){var t=t7.instance.BT_QUAT_0,e=q8.CollisionObject_getWorldTransform(this.ghost);T7(q8.Transform_getOrigin(e),this.node.worldPosition),S7(t,this.node.worldRotation),q8.Transform_setRotation(e,t),this.node.hasChangedFlags&Ig.SCALE&&this.syncGhostScale(),q8.CollisionObject_activate(this.ghost,!1)}},e.syncInitialBody=function(){var t=t7.instance.BT_QUAT_0,e=q8.CollisionObject_getWorldTransform(this.body);T7(q8.Transform_getOrigin(e),this.node.worldPosition),S7(t,this.node.worldRotation),q8.Transform_setRotation(e,t),this.syncBodyScale(),q8.CollisionObject_activate(this.body,!1)},e.syncInitialGhost=function(){var t=t7.instance.BT_QUAT_0,e=q8.CollisionObject_getWorldTransform(this.ghost);T7(q8.Transform_getOrigin(e),this.node.worldPosition),S7(t,this.node.worldRotation),q8.Transform_setRotation(e,t),this.syncGhostScale(),q8.CollisionObject_activate(this.body,!1)},e.syncBodyScale=function(){for(var t=0;t<this.bodyStruct.wrappedShapes.length;t++)this.bodyStruct.wrappedShapes[t].updateScale();for(var e=0;e<this.wrappedJoints0.length;e++)this.wrappedJoints0[e].updateScale0();for(var i=0;i<this.wrappedJoints1.length;i++)this.wrappedJoints1[i].updateScale1()},e.syncGhostScale=function(){for(var t=0;t<this.ghostStruct.wrappedShapes.length;t++)this.ghostStruct.wrappedShapes[t].updateScale()},e.updateBodyByReAdd=function(){this.bodyIndex>=0&&(this.wrappedWorld.removeSharedBody(this),this.bodyIndex=this.wrappedWorld.bodies.length,this.wrappedWorld.addSharedBody(this))},e.updateGhostByReAdd=function(){this.ghostIndex>=0&&(this.wrappedWorld.removeGhostObject(this),this.ghostIndex=this.wrappedWorld.ghosts.length,this.wrappedWorld.addGhostObject(this))},e.destroy=function(){if(t.sharedBodesMap.delete(this.node.uuid),this.node=null,this.wrappedWorld=null,this._bodyStruct){var e=this._bodyStruct;t7.delWrapper(this.id,Q8.BODY_CACHE_NAME),q8._safe_delete(e.motionState,W8.EBulletTypeMotionState),q8._safe_delete(e.compound,W8.EBulletTypeCollisionShape),q8._safe_delete(e.body,W8.EBulletTypeCollisionObject),this._bodyStruct=null}if(this._ghostStruct){var i=this._ghostStruct;q8._safe_delete(i.compound,W8.EBulletTypeCollisionShape),q8._safe_delete(i.ghost,W8.EBulletTypeCollisionObject),this._ghostStruct=null}},e.isBodySleeping=function(){return q8.CollisionObject_isSleeping(this.body)},n(t,[{key:"wrappedBody",get:function(){return this._wrappedBody}},{key:"bodyCompoundShape",get:function(){return this.bodyStruct.compound}},{key:"ghostCompoundShape",get:function(){return this.ghostStruct.compound}},{key:"body",get:function(){return this.bodyStruct.body}},{key:"ghost",get:function(){return this.ghostStruct.ghost}},{key:"collisionFilterGroup",get:function(){return this._collisionFilterGroup},set:function(t){t!==this._collisionFilterGroup&&(this._collisionFilterGroup=t,this.dirty|=ast.BODY_RE_ADD,this.dirty|=ast.GHOST_RE_ADD)}},{key:"collisionFilterMask",get:function(){return this._collisionFilterMask},set:function(t){t!==this._collisionFilterMask&&(this._collisionFilterMask=t,this.dirty|=ast.BODY_RE_ADD,this.dirty|=ast.GHOST_RE_ADD)}},{key:"bodyStruct",get:function(){return this._instantiateBodyStruct(),this._bodyStruct}},{key:"ghostStruct",get:function(){return this._instantiateGhostStruct(),this._ghostStruct}},{key:"bodyEnabled",set:function(t){if(t){if(this.bodyIndex<0){if(0===this.bodyStruct.wrappedShapes.length){if(!this.wrappedBody)return;if(!this.wrappedBody.rigidBody.isDynamic)return}this.bodyIndex=this.wrappedWorld.bodies.length,this.wrappedWorld.addSharedBody(this),this.syncInitialBody()}}else this.bodyIndex>=0&&(0===this.bodyStruct.wrappedShapes.length&&null==this.wrappedBody||0===this.bodyStruct.wrappedShapes.length&&null!=this.wrappedBody&&!this.wrappedBody.isEnabled||0===this.bodyStruct.wrappedShapes.length&&null!=this.wrappedBody&&!this.wrappedBody.rigidBody.enabledInHierarchy)&&(q8.RigidBody_clearState(this.body),this.bodyIndex=-1,this.wrappedWorld.removeSharedBody(this))}},{key:"ghostEnabled",set:function(t){t?this.ghostIndex<0&&this.ghostStruct.wrappedShapes.length>0&&(this.ghostIndex=1,this.wrappedWorld.addGhostObject(this),this.syncInitialGhost()):this.ghostIndex>=0&&0===this.ghostStruct.wrappedShapes.length&&this.ghost&&(this.ghostIndex=-1,this.wrappedWorld.removeGhostObject(this))}},{key:"reference",set:function(t){t?this.ref++:this.ref--,0===this.ref&&this.destroy()}}]),t}();Tst.idCounter=0,Tst.sharedBodesMap=new Map;var Est=e7,Sst={},Ast=function(){function t(){this.id=t.idCounter++,this._isEnabled=!1,this._isTrigger=!1,this._isInitialized=!1,this._impl=0,this._compound=0,this.quat=q8.Quat_new(0,0,0,1),this.transform=q8.Transform_new(),this._collider=void 0,this._sharedBody=void 0}var e=t.prototype;return e.updateEventListener=function(){this._sharedBody.wrappedWorld.updateNeedEmitEvents(this.collider.needCollisionEvent||this.collider.needTriggerEvent)},e.setMaterial=function(t){var e=null==t?j7.instance.defaultMaterial:t;if(!this._isTrigger&&this._isEnabled)if(this._compound){Sst[e._uuid]||(Sst[e._uuid]=q8.ccMaterial_new());var i=Sst[e._uuid];q8.ccMaterial_set(i,e.restitution,e.friction,e.rollingFriction,e.spinningFriction),q8.CollisionShape_setMaterial(this._impl,i)}else q8.CollisionObject_setMaterial(this._sharedBody.body,e.restitution,e.friction,e.rollingFriction,e.spinningFriction)},e.setCenter=function(t){_n.copy(Est,t),Est.multiply(this._collider.node.worldScale),T7(q8.Transform_getOrigin(this.transform),Est),this.updateCompoundTransform()},e.setAsTrigger=function(t){this._isTrigger!==t&&(this._isEnabled&&(this._sharedBody.removeShape(this,!t),this._sharedBody.addShape(this,t)),this._isTrigger=t)},e.getAABB=function(t){var e=t7.instance.BT_TRANSFORM_0;q8.Transform_setIdentity(e),q8.Transform_setRotation(e,S7(t7.instance.BT_QUAT_0,this._collider.node.worldRotation));var i=t7.instance.BT_V3_0,n=t7.instance.BT_V3_1;q8.CollisionShape_getAabb(this._impl,e,i,n),t.halfExtents.x=(q8.Vec3_x(n)-q8.Vec3_x(i))/2,t.halfExtents.y=(q8.Vec3_y(n)-q8.Vec3_y(i))/2,t.halfExtents.z=(q8.Vec3_z(n)-q8.Vec3_z(i))/2,_n.add(t.center,this._collider.node.worldPosition,this._collider.center)},e.getBoundingSphere=function(t){t.radius=q8.CollisionShape_getLocalBoundingSphere(this._impl),_n.add(t.center,this._collider.node.worldPosition,this._collider.center)},e.initialize=function(t){this._collider=t,this._isInitialized=!0,this._sharedBody=j7.instance.physicsWorld.getSharedBody(this._collider.node),this._sharedBody.reference=!0,this.onComponentSet(),this.setWrapper()},e.setWrapper=function(){t7.isNotEmptyShape(this._impl)&&(q8.CollisionShape_setUserPointer(this._impl,this._impl),t7.setWrapper(this._impl,t.TYPE,this))},e.onLoad=function(){this.setCenter(this._collider.center),this.setAsTrigger(this._collider.isTrigger)},e.onEnable=function(){this._isEnabled=!0,this._sharedBody.addShape(this,this._isTrigger),this.setMaterial(this.collider.sharedMaterial)},e.onDisable=function(){this._isEnabled=!1,this._sharedBody.removeShape(this,this._isTrigger)},e.onDestroy=function(){this._sharedBody.reference=!1,this._collider=null,q8._safe_delete(this.quat,W8.EBulletTypeQuat),q8._safe_delete(this.transform,W8.EBulletTypeTransform),this._compound&&q8._safe_delete(this._compound,W8.EBulletTypeCollisionShape),t7.isNotEmptyShape(this._impl)&&(q8._safe_delete(this._impl,W8.EBulletTypeCollisionShape),t7.delWrapper(this._impl,t.TYPE))},e.updateByReAdd=function(){this._isEnabled&&(this._sharedBody.removeShape(this,this._isTrigger),this._sharedBody.addShape(this,this._isTrigger))},e.getGroup=function(){return this._sharedBody.collisionFilterGroup},e.setGroup=function(t){this._sharedBody.collisionFilterGroup=t},e.addGroup=function(t){this._sharedBody.collisionFilterGroup|=t},e.removeGroup=function(t){this._sharedBody.collisionFilterGroup&=~t},e.getMask=function(){return this._sharedBody.collisionFilterMask},e.setMask=function(t){this._sharedBody.collisionFilterMask=t},e.addMask=function(t){this._sharedBody.collisionFilterMask|=t},e.removeMask=function(t){this._sharedBody.collisionFilterMask&=~t},e.setCompound=function(t){this._compound&&q8.CompoundShape_removeChildShape(this._compound,this._impl),t&&q8.CompoundShape_addChildShape(t,this.transform,this._impl),this._compound=t},e.updateScale=function(){this.setCenter(this._collider.center)},e.updateCompoundTransform=function(){this._compound?q8.CompoundShape_updateChildTransform(this._compound,this._impl,this.transform,!0):this._isEnabled&&!this._isTrigger&&this._sharedBody&&!this._sharedBody.bodyStruct.useCompound&&(this._sharedBody.dirty|=ast.BODY_RE_ADD)},e.needCompound=function(){return this._collider.type===S8.TERRAIN||!this._collider.center.equals(_n.ZERO)},n(t,[{key:"attachedRigidBody",get:function(){return this._sharedBody.wrappedBody?this._sharedBody.wrappedBody.rigidBody:null}},{key:"impl",get:function(){return this._impl}},{key:"collider",get:function(){return this._collider}},{key:"sharedBody",get:function(){return this._sharedBody}}]),t}();Ast.TYPE="shape",Ast.idCounter=0;var bst=function(){function t(){this.matrix=[]}var e=t.prototype;return e.get=function(t,e){if(e>t){var i=e;e=t,t=i}return this.matrix[(t*(t+1)>>1)+e-1]},e.set=function(t,e,i){if(e>t){var n=e;e=t,t=n}this.matrix[(t*(t+1)>>1)+e-1]=i?1:0},e.reset=function(){this.matrix.length=0},e.setNumObjects=function(t){this.matrix.length=t*(t-1)>>1},t}(),Cst=function(){function t(){this.data=void 0,this.data={keys:[]}}var e=t.prototype;return e.get=function(t,e){if(t>e){var i=e;e=t,t=i}return this.data[t+"-"+e]},e.set=function(t,e,i){if(t>e){var n=e;e=t,t=n}var r=t+"-"+e;if(null==i){var s=this.data.keys.indexOf(r);if(-1!==s)return this.data.keys.splice(s,1),delete this.data[r],i}return this.get(t,e)||this.data.keys.push(r),this.data[r]=i,this.data[r]},e.reset=function(){this.data={keys:[]}},e.getLength=function(){return this.data.keys.length},e.getKeyByIndex=function(t){return this.data.keys[t]},e.getDataByKey=function(t){return this.data[t]},t}(),Rst=function(){function t(t){this.impl=0,this.event=void 0,this.event=t}var e=t.prototype;return e.getLocalPointOnA=function(t){this.impl&&E7(t,q8.ManifoldPoint_get_m_localPointA(this.impl))},e.getLocalPointOnB=function(t){this.impl&&E7(t,q8.ManifoldPoint_get_m_localPointB(this.impl))},e.getWorldPointOnA=function(t){this.impl&&E7(t,q8.ManifoldPoint_get_m_positionWorldOnA(this.impl))},e.getWorldPointOnB=function(t){this.impl&&E7(t,q8.ManifoldPoint_get_m_positionWorldOnB(this.impl))},e.getLocalNormalOnA=function(t){if(this.impl){var e=t7.instance.BT_QUAT_0,i=q8.PersistentManifold_getBody0(this.event.impl),n=q8.CollisionObject_getWorldTransform(i);q8.Transform_getRotation(n,e);var r=r7;A7(r,e),Rn.conjugate(r,r),E7(t,q8.ManifoldPoint_get_m_normalWorldOnB(this.impl)),this.isBodyA||_n.negate(t,t),_n.transformQuat(t,t,r)}},e.getLocalNormalOnB=function(t){if(this.impl){var e=t7.instance.BT_QUAT_0,i=q8.PersistentManifold_getBody1(this.event.impl),n=q8.CollisionObject_getWorldTransform(i);q8.Transform_getRotation(n,e);var r=r7;A7(r,e),Rn.conjugate(r,r),E7(t,q8.ManifoldPoint_get_m_normalWorldOnB(this.impl)),_n.transformQuat(t,t,r)}},e.getWorldNormalOnA=function(t){this.impl&&(E7(t,q8.ManifoldPoint_get_m_normalWorldOnB(this.impl)),this.isBodyA||_n.negate(t,t))},e.getWorldNormalOnB=function(t){this.impl&&E7(t,q8.ManifoldPoint_get_m_normalWorldOnB(this.impl))},n(t,[{key:"isBodyA",get:function(){return this.event.selfCollider.shape.sharedBody.body===q8.PersistentManifold_getBody0(this.event.impl)}}]),t}(),wst=[],Ist=e7,xst=i7,Dst=n7,Ost=y7,Pst=new ost,Mst=function(){var t=e.prototype;function e(){this._world=void 0,this._broadphase=void 0,this._solver=void 0,this._dispatcher=void 0,this._debugDraw=void 0,this._debugLineCount=0,this._MAX_DEBUG_LINE_COUNT=16384,this._debugDrawFlags=I8.NONE,this._debugConstraintSize=.3,this._needEmitEvents=!1,this._needSyncAfterEvents=!1,this._needEmitCCTEvents=!1,this.bodies=[],this.ghosts=[],this.ccts=[],this.constraints=[],this.triggerArrayMat=new bst,this.collisionArrayMat=new bst,this.contactsDic=new Cst,this.oldContactsDic=new Cst,this.cctShapeEventDic=new Cst,this.cctContactsDic=new Cst,this.cctOldContactsDic=new Cst,Q8.CACHE.world=this,this._broadphase=q8.DbvtBroadphase_new(),this._dispatcher=q8.CollisionDispatcher_new(),this._solver=q8.SequentialImpulseConstraintSolver_new(),this._world=q8.ccDiscreteDynamicsWorld_new(this._dispatcher,this._broadphase,this._solver);var t=q8.DebugDraw.implement(gst);this._debugDraw=t.$$.ptr,q8.CollisionWorld_setDebugDrawer(this._world,this._debugDraw),q8.DebugDraw_setDebugMode(this._debugDraw,j8.DBG_NoDebug),q8.DebugDraw_setAABBColor(this._debugDraw,0,1,1),q8.DebugDraw_setActiveObjectColor(this._debugDraw,1,0,1),q8.DebugDraw_setDeactiveObjectColor(this._debugDraw,1,0,1),q8.DebugDraw_setWantsDeactivationObjectColor(this._debugDraw,1,0,1),q8.DebugDraw_setDisabledDeactivationObjectColor(this._debugDraw,1,0,1),q8.DebugDraw_setDisabledSimulationObjectColor(this._debugDraw,1,0,1),q8.DebugDraw_setConstraintLimitColor(this._debugDraw,.5,.5,.5)}return t.setDefaultMaterial=function(){},t.setAllowSleep=function(t){q8.ccDiscreteDynamicsWorld_setAllowSleep(this._world,t)},t.setGravity=function(t){q8.DynamicsWorld_setGravity(this._world,T7(t7.instance.BT_V3_0,t))},t.updateNeedEmitEvents=function(t){if(this.ghosts)if(t)this._needEmitEvents=!0;else{this._needEmitEvents=!1;for(var e=0;e<this.ghosts.length;e++)for(var i=this.ghosts[e].ghostStruct.wrappedShapes,n=0;n<i.length;n++){var r=i[n].collider;if(r.needCollisionEvent||r.needTriggerEvent)return void(this._needEmitEvents=!0)}for(var s=0;s<this.bodies.length;s++)for(var o=this.bodies[s].bodyStruct.wrappedShapes,a=0;a<o.length;a++){var h=o[a].collider;if(h.needCollisionEvent||h.needTriggerEvent)return void(this._needEmitEvents=!0)}}},t.updateNeedEmitCCTEvents=function(t){if(this.ccts)if(t)this._needEmitCCTEvents=!0;else{this._needEmitCCTEvents=!1;for(var e=this.ccts,i=e.length,n=0;n<i;n++)if(e[n].characterController.needCollisionEvent)return void(this._needEmitCCTEvents=!0)}},t.destroy=function(){(this.constraints.length||this.bodies.length||this.ccts.length)&&k("You should destroy all physics component first."),q8._safe_delete(this._world,W8.EBulletTypeCollisionWorld),q8._safe_delete(this._broadphase,W8.EBulletTypeDbvtBroadPhase),q8._safe_delete(this._dispatcher,W8.EBulletTypeCollisionDispatcher),q8._safe_delete(this._solver,W8.EBulletTypeSequentialImpulseConstraintSolver),q8._safe_delete(this._debugDraw,W8.EBulletTypeDebugDraw),this.bodies=null,this.ghosts=null,this.ccts=null,this.constraints=null,this.triggerArrayMat=null,this.collisionArrayMat=null,this.contactsDic=null,this.oldContactsDic=null,this.cctShapeEventDic=null,this.cctShapeEventPool=null,wst.length=0},t.step=function(t,e,i){void 0===i&&(i=0),(this.bodies.length||this.ghosts.length)&&(void 0===e&&(e=t),q8.DynamicsWorld_stepSimulation(this._world,e,i,t),q8.CollisionWorld_debugDrawWorld(this._world))},t.syncSceneToPhysics=function(){for(var t=this.ghosts.length-1;t>=0;t--){var e=this.ghosts[t];e.updateDirty(),e.syncSceneToGhost()}for(var i=this.bodies.length-1;i>=0;i--){var n=this.bodies[i];n.updateDirty(),n.syncSceneToPhysics()}for(var r=this.ccts,s=r.length-1;s>=0;s--){var o=r[s];o.updateDirty(),o.syncSceneToPhysics()}},t.syncAfterEvents=function(){this._needSyncAfterEvents&&this.syncSceneToPhysics()},t.raycast=function(t,e,i,n){t.computeHit(Ist,e.maxDistance);var r=T7(t7.instance.BT_V3_0,Ist),s=T7(t7.instance.BT_V3_1,t.o),o=q8.ccAllRayCallback_static();if(q8.ccAllRayCallback_reset(o,s,r,e.mask>>>0,e.queryTrigger),q8.ccAllRayCallback_setFlags(o,X8.UseSubSimplexConvexCastRaytest),q8.CollisionWorld_rayTest(this._world,s,r,o),q8.RayCallback_hasHit(o)){for(var a=q8.ccAllRayCallback_getHitPointWorld(o),h=q8.ccAllRayCallback_getHitNormalWorld(o),u=q8.ccAllRayCallback_getCollisionShapePtrs(o),c=0,l=q8.int_array_size(u);c<l;c++){E7(Ist,q8.Vec3_array_at(a,c)),E7(xst,q8.Vec3_array_at(h,c));var _=t7.getWrapper(q8.int_array_at(u,c),Ast.TYPE),d=i.add();n.push(d),d._assign(Ist,_n.distance(t.o,Ist),_.collider,xst)}return!0}return!1},t.raycastClosest=function(t,e,i){t.computeHit(Ist,e.maxDistance);var n=T7(t7.instance.BT_V3_0,Ist),r=T7(t7.instance.BT_V3_1,t.o),s=q8.ccClosestRayCallback_static();if(q8.ccClosestRayCallback_reset(s,r,n,e.mask>>>0,e.queryTrigger),q8.ccClosestRayCallback_setFlags(s,X8.UseSubSimplexConvexCastRaytest),q8.CollisionWorld_rayTest(this._world,r,n,s),q8.RayCallback_hasHit(s)){E7(Ist,q8.ccClosestRayCallback_getHitPointWorld(s)),E7(xst,q8.ccClosestRayCallback_getHitNormalWorld(s));var o=t7.getWrapper(q8.ccClosestRayCallback_getCollisionShapePtr(s),Ast.TYPE);return i._assign(Ist,_n.distance(t.o,Ist),o.collider,xst),!0}return!1},t.sweepBox=function(t,i,n,r,s,o){var a=t7.instance.BT_V3_0;return T7(a,i),e._sweepBoxGeometry||(e._sweepBoxGeometry=q8.BoxShape_new(a)),q8.BoxShape_setUnscaledHalfExtents(e._sweepBoxGeometry,a),this.sweep(t,e._sweepBoxGeometry,n,r,s,o)},t.sweepBoxClosest=function(t,i,n,r,s){var o=t7.instance.BT_V3_0;return T7(o,i),e._sweepBoxGeometry||(e._sweepBoxGeometry=q8.BoxShape_new(o)),q8.BoxShape_setUnscaledHalfExtents(e._sweepBoxGeometry,o),this.sweepClosest(t,e._sweepBoxGeometry,n,r,s)},t.sweepSphere=function(t,i,n,r,s){return e._sweepSphereGeometry||(e._sweepSphereGeometry=q8.SphereShape_new(i)),q8.SphereShape_setUnscaledRadius(e._sweepSphereGeometry,i),this.sweep(t,e._sweepSphereGeometry,Rn.IDENTITY,n,r,s)},t.sweepSphereClosest=function(t,i,n,r){return e._sweepSphereGeometry||(e._sweepSphereGeometry=q8.SphereShape_new(i)),q8.SphereShape_setUnscaledRadius(e._sweepSphereGeometry,i),this.sweepClosest(t,e._sweepSphereGeometry,Rn.IDENTITY,n,r)},t.sweepCapsule=function(t,i,n,r,s,o,a){return e._sweepCapsuleGeometry||(e._sweepCapsuleGeometry=q8.CapsuleShape_new(i,n)),q8.CapsuleShape_updateProp(e._sweepCapsuleGeometry,i,.5*n,1),this.sweep(t,e._sweepCapsuleGeometry,r,s,o,a)},t.sweepCapsuleClosest=function(t,i,n,r,s,o){return e._sweepCapsuleGeometry||(e._sweepCapsuleGeometry=q8.CapsuleShape_new(i,n)),q8.CapsuleShape_updateProp(e._sweepCapsuleGeometry,i,.5*n,1),this.sweepClosest(t,e._sweepCapsuleGeometry,r,s,o)},t.sweep=function(t,e,i,n,r,s){var o=t7.instance.BT_TRANSFORM_0,a=t7.instance.BT_TRANSFORM_1,h=t7.instance.BT_QUAT_0;T7(q8.Transform_getOrigin(o),t.o),S7(h,i),q8.Transform_setRotation(o,h),t.computeHit(Ist,n.maxDistance),T7(q8.Transform_getOrigin(a),Ist),S7(h,i),q8.Transform_setRotation(a,h);var u=q8.ccAllConvexCallback_static();if(q8.ccAllConvexCallback_reset(u,o,a,n.mask>>>0,n.queryTrigger),q8.CollisionWorld_convexSweepTest(this._world,e,o,a,u,0),q8.ConvexCallback_hasHit(u)){for(var c=q8.ccAllConvexCallback_getHitPointWorld(u),l=q8.ccAllConvexCallback_getHitNormalWorld(u),_=q8.ccAllConvexCallback_getCollisionShapePtrs(u),d=0,f=q8.int_array_size(_);d<f;d++){E7(Ist,q8.Vec3_array_at(c,d)),E7(xst,q8.Vec3_array_at(l,d));var p=t7.getWrapper(q8.int_array_at(_,d),Ast.TYPE),g=r.add();s.push(g),g._assign(Ist,_n.distance(t.o,Ist),p.collider,xst)}return!0}return!1},t.sweepClosest=function(t,e,i,n,r){var s=t7.instance.BT_TRANSFORM_0,o=t7.instance.BT_TRANSFORM_1,a=t7.instance.BT_QUAT_0;T7(q8.Transform_getOrigin(s),t.o),S7(a,i),q8.Transform_setRotation(s,a),t.computeHit(Ist,n.maxDistance),T7(q8.Transform_getOrigin(o),Ist),S7(a,i),q8.Transform_setRotation(o,a);var h=q8.ccClosestConvexCallback_static();if(q8.ccClosestConvexCallback_reset(h,s,o,n.mask>>>0,n.queryTrigger),q8.CollisionWorld_convexSweepTest(this._world,e,s,o,h,0),q8.ConvexCallback_hasHit(h)){E7(Ist,q8.ccClosestConvexCallback_getHitPointWorld(h)),E7(xst,q8.ccClosestConvexCallback_getHitNormalWorld(h));var u=t7.getWrapper(q8.ccClosestConvexCallback_getCollisionShapePtr(h),Ast.TYPE);return r._assign(Ist,_n.distance(t.o,Ist),u.collider,xst),!0}return!1},t.getSharedBody=function(t,e){return Tst.getSharedBody(t,this,e)},t.addSharedBody=function(t){if(this.bodies.indexOf(t)<0){this.bodies.push(t);var e=t.collisionFilterGroup,i=t.collisionFilterMask;q8.DynamicsWorld_addRigidBody(this._world,t.body,e>>>0,i>>>0)}},t.removeSharedBody=function(t){var e=this.bodies.indexOf(t);e>=0&&(he(this.bodies,e),q8.DynamicsWorld_removeRigidBody(this._world,t.body))},t.addGhostObject=function(t){if(this.ghosts.indexOf(t)<0){this.ghosts.push(t);var e=t.collisionFilterGroup,i=t.collisionFilterMask;q8.CollisionWorld_addCollisionObject(this._world,t.ghost,e>>>0,i>>>0)}},t.removeGhostObject=function(t){var e=this.ghosts.indexOf(t);e>=0&&(he(this.ghosts,e),q8.CollisionWorld_removeCollisionObject(this._world,t.ghost))},t.addCCT=function(t){if(this.ccts.indexOf(t)<0){this.ccts.push(t);var e=q8.CharacterController_getGhostObject(t.impl),i=t.getGroup(),n=t.getMask();q8.CollisionWorld_addCollisionObject(this._world,e,i>>>0,n>>>0),q8.DynamicsWorld_addAction(this._world,t.impl)}},t.removeCCT=function(t){var e=this.ccts.indexOf(t);if(e>=0){he(this.ccts,e);var i=q8.CharacterController_getGhostObject(t.impl);q8.CollisionWorld_removeCollisionObject(this._world,i),q8.DynamicsWorld_removeAction(this._world,t.impl)}},t.addConstraint=function(t){var e=this.constraints.indexOf(t);e<0&&(this.constraints.push(t),q8.DynamicsWorld_addConstraint(this.impl,t.impl,!t.constraint.enableCollision),t.index=e)},t.removeConstraint=function(t){var e=this.constraints.indexOf(t);e>=0&&(this.constraints.splice(e,1),q8.DynamicsWorld_removeConstraint(this.impl,t.impl),t.index=-1)},t.emitEvents=function(){this._needSyncAfterEvents=!1,this._needEmitEvents&&(this.gatherConatactData(),this.emitCollisionAndTriggerEvent(),this.emitCCTTriggerEvent()),this._needEmitCCTEvents&&this.emitCCTCollisionEvent()},t.emitCollisionAndTriggerEvent=function(){for(var t=this.contactsDic.getLength();t--;){wst.push.apply(wst,J8.contacts),J8.contacts.length=0;var e=this.contactsDic.getKeyByIndex(t),i=this.contactsDic.getDataByKey(e),n=i.shape0,r=i.shape1;this.oldContactsDic.set(n.id,r.id,i);var s=n.collider,o=r.collider;if(s&&o){if(s.isTrigger||o.isTrigger)this.triggerArrayMat.get(n.id,r.id)?Z8.type="onTriggerStay":(Z8.type="onTriggerEnter",this.triggerArrayMat.set(n.id,r.id,!0)),Z8.impl=i.impl,Z8.selfCollider=s,Z8.otherCollider=o,s.emit(Z8.type,Z8),Z8.selfCollider=o,Z8.otherCollider=s,o.emit(Z8.type,Z8),this._needSyncAfterEvents=!0;else{var a=s.attachedRigidBody,h=o.attachedRigidBody;if(a&&h){if(a.isSleeping&&h.isSleeping)continue}else if(!a&&h){if(h.isSleeping)continue}else if(!h&&a&&a.isSleeping)continue;this.collisionArrayMat.get(n.id,r.id)?J8.type="onCollisionStay":(J8.type="onCollisionEnter",this.collisionArrayMat.set(n.id,r.id,!0));for(var u=0;u<i.contacts.length;u++){var c=i.contacts[u];if(wst.length>0){var l=wst.pop();l.impl=c,J8.contacts.push(l)}else{var _=new Rst(J8);_.impl=c,J8.contacts.push(_)}}J8.impl=i.impl,J8.selfCollider=s,J8.otherCollider=o,s.emit(J8.type,J8),J8.selfCollider=o,J8.otherCollider=s,o.emit(J8.type,J8),this._needSyncAfterEvents=!0}null==this.oldContactsDic.get(n.id,r.id)&&this.oldContactsDic.set(n.id,r.id,i)}}for(var d=this.oldContactsDic.getLength();d--;){var f=this.oldContactsDic.getKeyByIndex(d),p=this.oldContactsDic.getDataByKey(f),g=p.shape0,m=p.shape1,v=g.collider,y=m.collider;if(v&&y){var T=v.isTrigger||y.isTrigger;null==this.contactsDic.getDataByKey(f)&&(T?this.triggerArrayMat.get(g.id,m.id)&&(Z8.type="onTriggerExit",Z8.selfCollider=v,Z8.otherCollider=y,v.emit(Z8.type,Z8),Z8.selfCollider=y,Z8.otherCollider=v,y.emit(Z8.type,Z8),this.triggerArrayMat.set(g.id,m.id,!1),this.oldContactsDic.set(g.id,m.id,null),this._needSyncAfterEvents=!0):this.collisionArrayMat.get(g.id,m.id)&&(wst.push.apply(wst,J8.contacts),J8.contacts.length=0,J8.type="onCollisionExit",J8.selfCollider=v,J8.otherCollider=y,v.emit(J8.type,J8),J8.selfCollider=y,J8.otherCollider=v,y.emit(J8.type,J8),this.collisionArrayMat.set(g.id,m.id,!1),this.oldContactsDic.set(g.id,m.id,null),this._needSyncAfterEvents=!0))}}this.contactsDic.reset()},t.emitCCTTriggerEvent=function(){for(var t=this.cctContactsDic.getLength();t--;){var e=this.cctContactsDic.getKeyByIndex(t),i=this.cctContactsDic.getDataByKey(e),n=i.shape,r=i.cct;this.cctOldContactsDic.set(n.id,r.id,i);var s=n.collider,o=r.characterController;s&&o&&(s.isTrigger&&(this.triggerArrayMat.get(n.id,r.id)?$8.type="onControllerTriggerStay":($8.type="onControllerTriggerEnter",this.triggerArrayMat.set(n.id,r.id,!0)),$8.impl=i.impl,$8.collider=s,$8.characterController=o,s.emit($8.type,$8),$8.collider=s,$8.characterController=o,o.emit($8.type,$8),this._needSyncAfterEvents=!0),null==this.cctOldContactsDic.get(n.id,r.id)&&this.cctOldContactsDic.set(n.id,r.id,i))}for(var a=this.cctOldContactsDic.getLength();a--;){var h=this.cctOldContactsDic.getKeyByIndex(a),u=this.cctOldContactsDic.getDataByKey(h),c=u.shape,l=u.cct,_=c.collider,d=l.characterController;if(_&&d){var f=_.isTrigger;null==this.cctContactsDic.getDataByKey(h)&&f&&this.triggerArrayMat.get(c.id,l.id)&&($8.type="onControllerTriggerExit",$8.collider=_,$8.characterController=d,_.emit($8.type,$8),$8.collider=_,$8.characterController=d,d.emit($8.type,$8),this.triggerArrayMat.set(c.id,l.id,!1),this.cctOldContactsDic.set(c.id,l.id,null),this._needSyncAfterEvents=!0)}}this.cctContactsDic.reset()},t.emitCCTCollisionEvent=function(){for(var t=this.cctShapeEventDic.getLength();t--;){var e,i=this.cctShapeEventDic.getKeyByIndex(t),n=this.cctShapeEventDic.getDataByKey(i),r=n.BulletCharacterController,s=n.BulletShape,o=n.worldPos,a=n.worldNormal,h=n.motionDir,u=n.motionLength;Pst.controller=r.characterController,Pst.collider=s.collider,Pst.worldPosition.set(o.x,o.y,o.z),Pst.worldNormal.set(a.x,a.y,a.z),Pst.motionDirection.set(h.x,h.y,h.z),Pst.motionLength=u,null===(e=Pst.controller)||void 0===e||e.emit("onControllerColliderHit",Pst),this._needSyncAfterEvents=!0}this.cctShapeEventDic.reset()},t.gatherConatactData=function(){for(var t=q8.Dispatcher_getNumManifolds(this._dispatcher),e=0;e<t;e++)for(var i=q8.Dispatcher_getManifoldByIndexInternal(this._dispatcher,e),n=q8.PersistentManifold_getNumContacts(i),r=0;r<n;r++){var s=q8.PersistentManifold_getContactPoint(i,r),o=q8.ManifoldPoint_getShape0(s),a=q8.ManifoldPoint_getShape1(s),h=!1;if(!h){var u=t7.getWrapper(o,Ast.TYPE),c=t7.getWrapper(a,Ast.TYPE);if(u&&c&&(h=!0,u.collider.needTriggerEvent||c.collider.needTriggerEvent||u.collider.needCollisionEvent||c.collider.needCollisionEvent)){var l=this.contactsDic.get(u.id,c.id);l||(l=this.contactsDic.set(u.id,c.id,{shape0:u,shape1:c,contacts:[],impl:i})),l.contacts.push(s)}}if(!h){var _=t7.getWrapper(o,Ast.TYPE),d=t7.getWrapper(a,Q8.CCT_CACHE_NAME);if(_&&d&&(h=!0,_.collider.needTriggerEvent)){var f=this.cctContactsDic.get(_.id,d.id);f||(f=this.cctContactsDic.set(_.id,d.id,{shape:_,cct:d,contacts:[],impl:i})),f.contacts.push(s),h=!0}}if(!h){var p=t7.getWrapper(o,Q8.CCT_CACHE_NAME),g=t7.getWrapper(a,Ast.TYPE);if(g&&p&&(h=!0,g.collider.needTriggerEvent)){var m=this.cctContactsDic.get(g.id,p.id);m||(m=this.cctContactsDic.set(g.id,p.id,{shape:g,cct:p,contacts:[],impl:i})),m.contacts.push(s),h=!0}}}},t._setDebugDrawMode=function(){var t=0;this._debugDrawFlags&I8.WIRE_FRAME&&(t|=j8.DBG_DrawWireframe),this._debugDrawFlags&I8.CONSTRAINT&&(t|=j8.DBG_DrawConstraints,t|=j8.DBG_DrawConstraintLimits),this._debugDrawFlags&I8.AABB&&(t|=j8.DBG_DrawAabb),q8.DebugDraw_setDebugMode(this._debugDraw,t)},t._getDebugRenderer=function(){var t,e=null===(t=DD.root.mainWindow)||void 0===t?void 0:t.cameras;return e?0===e.length?null:e[0]?(e[0].initGeometryRenderer(),e[0].geometryRenderer):null:null},t.onDebugDrawLine=function(t,e,i){var n=this._getDebugRenderer();n&&this._debugLineCount<this._MAX_DEBUG_LINE_COUNT&&(this._debugLineCount++,E7(Ist,t),E7(xst,e),E7(Dst,i),Ost.set(255*Dst.x,255*Dst.y,255*Dst.z,255),n.addLine(Ist,xst,Ost))},t.onClearLines=function(){this._debugLineCount=0},n(e,[{key:"impl",get:function(){return this._world}},{key:"debugDrawFlags",get:function(){return this._debugDrawFlags},set:function(t){this._debugDrawFlags=t,this._debugDraw&&this._setDebugDrawMode()}},{key:"debugDrawConstraintSize",get:function(){return this._debugConstraintSize},set:function(t){this._debugConstraintSize=t;for(var e=0;e<this.constraints.length;e++)this.constraints[e].updateDebugDrawSize()}}]),e}();Mst._sweepBoxGeometry=void 0,Mst._sweepSphereGeometry=void 0,Mst._sweepCapsuleGeometry=void 0;var Nst=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.updateSize=function(){var t=t7.instance.BT_V3_0;T7(t,this.getMinUnscaledHalfExtents(HK)),q8.BoxShape_setUnscaledHalfExtents(this.impl,t),this.updateCompoundTransform()},i.onComponentSet=function(){var t=t7.instance.BT_V3_0;T7(t,this.getMinUnscaledHalfExtents(HK)),this._impl=q8.BoxShape_new(t),this.updateScale()},i.updateScale=function(){t.prototype.updateScale.call(this);var e=t7.instance.BT_V3_0;q8.CollisionShape_setLocalScaling(this._impl,T7(e,this.getMinScale(HK))),this.updateCompoundTransform()},i.getMinUnscaledHalfExtents=function(t){var e=this.collider.size,i=zK(HK.set(this._collider.node.worldScale)),n=j7.instance.minVolumeSize,r=e.x/2,s=e.y/2,o=e.z/2,a=r*i.x<n?n/i.x:r,h=s*i.y<n?n/i.y:s,u=o*i.z<n?n/i.z:o;return t.set(a,h,u),t},i.getMinScale=function(t){var e=this.collider.size,i=zK(HK.set(this._collider.node.worldScale)),n=j7.instance.minVolumeSize,r=e.x/2,s=e.y/2,o=e.z/2,a=r*i.x<n?n/r:i.x,h=s*i.y<n?n/s:i.y,u=o*i.z<n?n/o:i.z;return t.set(a,h,u),t},n(e,[{key:"collider",get:function(){return this._collider}}]),e}(Ast),Lst=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.updateRadius=function(){q8.SphereShape_setUnscaledRadius(this.impl,this.getMinUnscaledRadius()),this.updateCompoundTransform()},i.onComponentSet=function(){this._impl=q8.SphereShape_new(this.getMinUnscaledRadius()),this.updateScale()},i.updateScale=function(){t.prototype.updateScale.call(this);var e=this.getMinScale();e7.set(e,e,e);var i=t7.instance.BT_V3_0;q8.CollisionShape_setLocalScaling(this._impl,T7(i,e7)),this.updateCompoundTransform()},i.getMinUnscaledRadius=function(){var t=this.collider.radius,e=Math.abs(Ki(this._collider.node.worldScale)),i=j7.instance.minVolumeSize;return e*t<i?i/e:t},i.getMinScale=function(){var t=this.collider.radius,e=Math.abs(Ki(this._collider.node.worldScale)),i=j7.instance.minVolumeSize;return e*t<i?i/t:e},n(e,[{key:"collider",get:function(){return this._collider}}]),e}(Ast),Bst=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.setCylinderHeight=function(){this.updateProperties(this.collider.radius,this.collider.cylinderHeight,this.collider.direction,this._collider.node.worldScale)},i.setDirection=function(){this.updateProperties(this.collider.radius,this.collider.cylinderHeight,this.collider.direction,this._collider.node.worldScale)},i.setRadius=function(){this.updateProperties(this.collider.radius,this.collider.cylinderHeight,this.collider.direction,this._collider.node.worldScale)},i.onComponentSet=function(){this._impl=q8.CapsuleShape_new(.5,1),this.setRadius(this.collider.radius)},i.updateScale=function(){t.prototype.updateScale.call(this),this.setRadius(this.collider.radius)},i.updateProperties=function(t,e,i,n){var r,s,o=n,a=i;1===a?(r=t*Math.abs(qi(o.x,o.z)),s=e/2*Math.abs(o.y)):0===a?(r=t*Math.abs(qi(o.y,o.z)),s=e/2*Math.abs(o.x)):(r=t*Math.abs(qi(o.x,o.y)),s=e/2*Math.abs(o.z)),q8.CapsuleShape_updateProp(this._impl,r,s,a),this.updateCompoundTransform()},n(e,[{key:"collider",get:function(){return this._collider}}]),e}(Ast),Fst=function(){function t(t,e){this.key=void 0,this.ref=0,this.bulletBvhTriangleMeshShapePtr=void 0,this.btTriangleMeshPtr=0,this.reference=!0,this.key=t,this.btTriangleMeshPtr=q8.TriangleMesh_new(),b7(this.btTriangleMeshPtr,e),this.bulletBvhTriangleMeshShapePtr=q8.BvhTriangleMeshShape_new(this.btTriangleMeshPtr,!0,!0)}return t.getBulletBvhTriangleMeshShape=function(e,i){var n;return t.BulletBvhTriangleMeshShapeMap.has(e)?(n=t.BulletBvhTriangleMeshShapeMap.get(e)).reference=!0:(n=new t(e,i),t.BulletBvhTriangleMeshShapeMap.set(e,n)),n},t.prototype.destroy=function(){this.bulletBvhTriangleMeshShapePtr&&q8._safe_delete(W8.EBulletTypeCollisionShape,this.bulletBvhTriangleMeshShapePtr),this.btTriangleMeshPtr&&q8._safe_delete(W8.EBulletTypeTriangleMesh,this.btTriangleMeshPtr),t.BulletBvhTriangleMeshShapeMap.delete(this.key)},n(t,[{key:"reference",set:function(t){t?this.ref++:this.ref--,0===this.ref&&this.destroy()}}]),t}();Fst.BulletBvhTriangleMeshShapeMap=new Map;var kst,Ust,Gst=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).btBVHMeshShape=void 0,e.refBtTriangleMesh=0,e}s(e,t);var i=e.prototype;return i.setMesh=function(t){if(this._isInitialized){this._impl&&t7.isNotEmptyShape(this._impl)&&(this._compound&&q8.CompoundShape_removeChildShape(this._compound,this._impl),q8._safe_delete(this._impl,W8.EBulletTypeCollisionShape),t7.delWrapper(this._impl,Ast.TYPE),this._impl=0);var e=t;if(e&&e.renderingSubMeshes.length>0){if(this.collider.convex){var i=this._getBtTriangleMesh(e);this._impl=q8.ConvexTriangleMeshShape_new(i)}else this.btBVHMeshShape=Fst.getBulletBvhTriangleMeshShape(e.hash,e),this._impl=q8.ScaledBvhTriangleMeshShape_new(this.btBVHMeshShape.bulletBvhTriangleMeshShapePtr,1,1,1);var n=t7.instance.BT_V3_0;T7(n,this._collider.node.worldScale),q8.CollisionShape_setLocalScaling(this._impl,n),q8.CollisionShape_setMargin(this._impl,.01),this.setCompound(this._compound),this.updateByReAdd(),this.setWrapper()}else this._impl=q8.EmptyShape_static()}},i.onComponentSet=function(){this.setMesh(this.collider.mesh)},i.onDestroy=function(){this.collider.convex?this.refBtTriangleMesh&&q8._safe_delete(this.refBtTriangleMesh,W8.EBulletTypeTriangleMesh):this.btBVHMeshShape&&(this.btBVHMeshShape.reference=!1),t.prototype.onDestroy.call(this)},i.updateScale=function(){t.prototype.updateScale.call(this);var e=t7.instance.BT_V3_0;T7(e,this._collider.node.worldScale),q8.CollisionShape_setLocalScaling(this._impl,e),this.updateCompoundTransform()},i._getBtTriangleMesh=function(t){return this.refBtTriangleMesh=q8.TriangleMesh_new(),b7(this.refBtTriangleMesh,t),this.refBtTriangleMesh},n(e,[{key:"collider",get:function(){return this._collider}}]),e}(Ast),Hst=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.setHeight=function(){this.updateProperties(this.collider.radius,this.collider.height,this.collider.direction,this._collider.node.worldScale)},i.setDirection=function(){this.updateProperties(this.collider.radius,this.collider.height,this.collider.direction,this._collider.node.worldScale)},i.setRadius=function(){this.updateProperties(this.collider.radius,this.collider.height,this.collider.direction,this._collider.node.worldScale)},i.onComponentSet=function(){var t=t7.instance.BT_V3_0;q8.Vec3_set(t,.5,1,.5),this._impl=q8.CylinderShape_new(t),this.setRadius(this.collider.radius)},i.updateScale=function(){t.prototype.updateScale.call(this),this.setRadius(this.collider.radius)},i.updateProperties=function(t,e,i,n){var r,s,o=n,a=i;1===a?(s=e*Math.abs(o.y),r=t*Math.abs(qi(o.x,o.z))):0===a?(s=e*Math.abs(o.x),r=t*Math.abs(qi(o.y,o.z))):(s=e*Math.abs(o.z),r=t*Math.abs(qi(o.x,o.y))),q8.CylinderShape_updateProp(this._impl,r,s/2,a),this.updateCompoundTransform()},n(e,[{key:"collider",get:function(){return this._collider}}]),e}(Ast),zst=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.setHeight=function(){this.updateProperties(this.collider.radius,this.collider.height,this.collider.direction,this._collider.node.worldScale)},i.setDirection=function(){this.updateProperties(this.collider.radius,this.collider.height,this.collider.direction,this._collider.node.worldScale)},i.setRadius=function(){this.updateProperties(this.collider.radius,this.collider.height,this.collider.direction,this._collider.node.worldScale)},i.onComponentSet=function(){this._impl=q8.ConeShape_new(.5,1),this.setRadius(this.collider.radius)},i.updateScale=function(){t.prototype.updateScale.call(this),this.setRadius(this.collider.radius)},i.updateProperties=function(t,e,i,n){var r,s,o=n,a=i;1===a?(s=e*Math.abs(o.y),r=t*Math.abs(qi(o.x,o.z))):0===a?(s=e*Math.abs(o.x),r=t*Math.abs(qi(o.y,o.z))):(s=e*Math.abs(o.z),r=t*Math.abs(qi(o.x,o.y))),q8.ConeShape_setRadius(this._impl,r),q8.ConeShape_setHeight(this._impl,s),q8.ConeShape_setConeUpIndex(this._impl,a);var h=t7.instance.BT_V3_0;q8.Vec3_set(h,1,1,1),q8.CollisionShape_setLocalScaling(this._impl,h),this.updateCompoundTransform()},n(e,[{key:"impl",get:function(){return this._impl}},{key:"collider",get:function(){return this._collider}}]),e}(Ast),Vst=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)._bufPtr=0,e._tileSize=0,e._localOffset=new _n,e}s(e,t);var i=e.prototype;return i.setTerrain=function(t){if(this._isInitialized)if(this._impl&&t7.isNotEmptyShape(this._impl))F("[Physics][Bullet]: change the terrain asset after initialization is not support.");else{var e=t;if(e){this._tileSize=e.tileSize;var i=e.getVertexCountI(),n=e.getVertexCountJ();this._bufPtr=q8._malloc(4*i*n);for(var r=0,s=Number.MAX_SAFE_INTEGER,o=Number.MIN_SAFE_INTEGER,a=0;a<n;a++)for(var h=0;h<i;h++){var u=e.getHeight(h,a);q8._write_f32(this._bufPtr+r,u),s>u&&(s=u),u>o&&(o=u),r+=4}o+=.01,s-=.01,this._localOffset.set((i-1)/2*this._tileSize,(o+s)/2,(n-1)/2*this._tileSize),this._impl=q8.TerrainShape_new(i,n,this._bufPtr,1,s,o);var c=t7.instance.BT_V3_0;q8.Vec3_set(c,this._tileSize,1,this._tileSize),q8.CollisionShape_setLocalScaling(this._impl,c),this.setCompound(this._compound),this.updateByReAdd(),this.setWrapper()}else this._impl=q8.EmptyShape_static()}},i.onComponentSet=function(){this.setTerrain(this.collider.terrain)},i.onDestroy=function(){this._bufPtr&&q8._free(this._bufPtr),t.prototype.onDestroy.call(this)},i.setCenter=function(t){_n.copy(e7,t),e7.add(this._localOffset),T7(q8.Transform_getOrigin(this.transform),e7),this.updateCompoundTransform()},n(e,[{key:"collider",get:function(){return this._collider}}]),e}(Ast),Wst=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.setShapeType=function(){},i.setVertices=function(){},i.onComponentSet=function(){this._impl=q8.SimplexShape_new();for(var t=this.collider.shapeType,e=this.collider.vertices,i=t7.instance.BT_V3_0,n=0;n<t;n++)q8.SimplexShape_addVertex(this._impl,T7(i,e[n]));q8.CollisionShape_setLocalScaling(this._impl,T7(i,this._collider.node.worldScale))},i.onLoad=function(){t.prototype.onLoad.call(this),this.collider.updateVertices()},i.updateScale=function(){t.prototype.updateScale.call(this);var e=t7.instance.BT_V3_0;q8.CollisionShape_setLocalScaling(this._impl,T7(e,this._collider.node.worldScale))},n(e,[{key:"collider",get:function(){return this._collider}}]),e}(Ast),Xst=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.setNormal=function(t){T7(q8.StaticPlaneShape_getPlaneNormal(this.impl),t),this.updateCompoundTransform()},i.setConstant=function(t){q8.StaticPlaneShape_setPlaneConstant(this.impl,t),this.updateCompoundTransform()},i.updateScale=function(){t.prototype.updateScale.call(this);var e=t7.instance.BT_V3_0;T7(e,this._collider.node.worldScale),q8.CollisionShape_setLocalScaling(this._impl,e),this.updateCompoundTransform()},i.onComponentSet=function(){var t=t7.instance.BT_V3_0;T7(t,this.collider.normal),this._impl=q8.StaticPlaneShape_new(t,this.collider.constant),this.updateScale()},n(e,[{key:"collider",get:function(){return this._collider}}]),e}(Ast),jst=function(){function t(){this.dirty=0,this.index=-1,this._impl=0,this._com=void 0,this._rigidBody=void 0,this._connectedBody=null,this._collided=!1}var e=t.prototype;return e.setConnectedBody=function(t){if(this._connectedBody!==t){var e=this._connectedBody;e&&e.body.sharedBody.removeJoint(this,1);var i=this._rigidBody.body.sharedBody;i.removeJoint(this,0),this._impl&&(i.wrappedWorld.removeConstraint(this),q8._safe_delete(this._impl,W8.EBulletTypeTypedConstraint)),this._connectedBody=t;var n=this._connectedBody;this.onComponentSet(),this.setEnableCollision(this._collided),i.wrappedWorld.addConstraint(this),i.addJoint(this,0),n&&n.body.sharedBody.addJoint(this,1)}},e.setEnableCollision=function(t){this._collided!==t&&(this._collided=t,this.updateByReAdd())},e.updateByReAdd=function(){if(this._rigidBody&&this.index>=0){var t=this._rigidBody.body.sharedBody;t.wrappedWorld.removeConstraint(this),t.wrappedWorld.addConstraint(this)}},e.initialize=function(t){this._com=t,this._rigidBody=t.attachedBody,this._connectedBody=t.connectedBody,this._collided=t.enableCollision,this.onComponentSet(),this.setEnableCollision(this._collided)},e.updateDebugDrawSize=function(){if(this.impl){var t=j7.instance.physicsWorld.debugDrawConstraintSize;q8.TypedConstraint_setDbgDrawSize(this.impl,t)}},e.onEnable=function(){var t=this._rigidBody.body.sharedBody;t.wrappedWorld.addConstraint(this),t.addJoint(this,0);var e=this._connectedBody;e&&e.body.sharedBody.addJoint(this,1)},e.onDisable=function(){var t=this._rigidBody.body.sharedBody;t.wrappedWorld.removeConstraint(this),t.removeJoint(this,0);var e=this._connectedBody;e&&e.body.sharedBody.removeJoint(this,1)},e.onDestroy=function(){q8._safe_delete(this._impl,W8.EBulletTypeTypedConstraint),this._com=null,this._rigidBody=null,this._connectedBody=null},n(t,[{key:"impl",get:function(){return this._impl}},{key:"constraint",get:function(){return this._com}}]),t}(),Yst=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.setPivotA=function(){var t=this.constraint,e=t7.instance.BT_V3_0;_n.multiply(e7,t.node.worldScale,t.pivotA),T7(e,e7),q8.P2PConstraint_setPivotA(this._impl,e),t.connectedBody||this.setPivotB(t.pivotB)},i.setPivotB=function(){var t=this.constraint,e=this._rigidBody.node,i=t7.instance.BT_V3_0,n=t.connectedBody;n?(_n.multiply(e7,n.node.worldScale,t.pivotB),T7(i,e7)):(_n.multiply(e7,e.worldScale,t.pivotA),_n.transformQuat(e7,e7,e.worldRotation),_n.add(e7,e7,e.worldPosition),T7(i,e7)),q8.P2PConstraint_setPivotB(this._impl,i)},i.onComponentSet=function(){var t=this.constraint.connectedBody,e=this._rigidBody.body.impl,i=t?t.body.impl:q8.TypedConstraint_getFixedBody(),n=t7.instance.BT_V3_0,r=t7.instance.BT_V3_1;this._impl=q8.P2PConstraint_new(e,i,n,r),this.setPivotA(this.constraint.pivotA),this.setPivotB(this.constraint.pivotB),this.updateDebugDrawSize()},i.updateScale0=function(){this.setPivotA(this.constraint.pivotA)},i.updateScale1=function(){this.setPivotB(this.constraint.pivotB)},n(e,[{key:"constraint",get:function(){return this._com}}]),e}(jst),Kst=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.setBreakForce=function(t){q8.TypedConstraint_setMaxImpulseThreshold(this._impl,t)},i.setBreakTorque=function(){},i.onComponentSet=function(){var t=this.constraint.connectedBody,e=this._rigidBody.body.impl,i=t?t.body.impl:q8.TypedConstraint_getFixedBody(),n=t7.instance.BT_TRANSFORM_0,r=t7.instance.BT_TRANSFORM_1;this._impl=q8.FixedConstraint_new(e,i,n,r),this.setBreakForce(this.constraint.breakForce),this.setBreakTorque(this.constraint.breakTorque),this.updateFrames(),this.updateDebugDrawSize()},i.updateFrames=function(){var t=this.constraint.connectedBody,e=this._rigidBody.body.sharedBody,i=e7,n=r7,r=t7.instance.BT_TRANSFORM_0,s=t7.instance.BT_TRANSFORM_1,o=t7.instance.BT_QUAT_0,a=o7;if(Ln.fromRT(a,e.node.worldRotation,e.node.worldPosition),Ln.invert(a,a),Ln.getRotation(n,a),Ln.getTranslation(i,a),T7(q8.Transform_getOrigin(r),i),S7(o,n),q8.Transform_setRotation(r,o),t){var h=t.body.sharedBody;Ln.fromRT(a,h.node.worldRotation,h.node.worldPosition),Ln.invert(a,a),Ln.getRotation(n,a),Ln.getTranslation(i,a),T7(q8.Transform_getOrigin(s),i),S7(o,n),q8.Transform_setRotation(s,o)}else q8.Transform_setIdentity(s);q8.FixedConstraint_setFrames(this._impl,r,s)},i.updateScale0=function(){this.updateFrames()},i.updateScale1=function(){this.updateFrames()},n(e,[{key:"constraint",get:function(){return this._com}}]),e}(jst),qst=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.setPivotA=function(){this.updateFrames()},i.setPivotB=function(){this.updateFrames()},i.setAxis=function(){this.updateFrames()},i.setLimitEnabled=function(){this.constraint.limitEnabled?q8.HingeConstraint_setLimit(this._impl,Li(this.constraint.lowerLimit),Li(this.constraint.upperLimit),.9,.3,1):q8.HingeConstraint_setLimit(this._impl,1,0,.9,.3,1)},i.setLowerLimit=function(){this.constraint.limitEnabled&&q8.HingeConstraint_setLimit(this._impl,Li(this.constraint.lowerLimit),Li(this.constraint.upperLimit),.9,.3,1)},i.setUpperLimit=function(){this.constraint.limitEnabled&&q8.HingeConstraint_setLimit(this._impl,Li(this.constraint.lowerLimit),Li(this.constraint.upperLimit),.9,.3,1)},i.setMotorEnabled=function(t){q8.HingeConstraint_enableMotor(this._impl,t);var e=-this.constraint.motorVelocity/60,i=C7(this.constraint.motorForceLimit,j7.instance.fixedTimeStep);q8.HingeConstraint_setMotorVelocity(this._impl,e),q8.HingeConstraint_setMaxMotorImpulse(this._impl,i)},i.setMotorVelocity=function(t){if(this.constraint.motorEnabled){var e=-t/60;q8.HingeConstraint_setMotorVelocity(this._impl,e)}},i.setMotorForceLimit=function(t){if(this.constraint.motorEnabled){var e=C7(t,j7.instance.fixedTimeStep);q8.HingeConstraint_setMaxMotorImpulse(this._impl,e)}},i.onComponentSet=function(){var t=this.constraint.connectedBody,e=this._rigidBody.body.impl,i=t?t.body.impl:q8.TypedConstraint_getFixedBody(),n=t7.instance.BT_TRANSFORM_0,r=t7.instance.BT_TRANSFORM_1;this._impl=q8.HingeConstraint_new(e,i,n,r),this.setLimitEnabled(this.constraint.limitEnabled),this.setLowerLimit(this.constraint.lowerLimit),this.setUpperLimit(this.constraint.upperLimit),this.setMotorEnabled(this.constraint.motorEnabled),this.setMotorVelocity(this.constraint.motorVelocity),this.setMotorForceLimit(this.constraint.motorForceLimit),this.updateFrames(),this.updateDebugDrawSize()},i.updateFrames=function(){var t=this.constraint,e=t.node,i=e7,n=r7,r=s7,s=t7.instance.BT_TRANSFORM_0;_n.multiply(i,e.worldScale,t.pivotA),T7(q8.Transform_getOrigin(s),i);var o=t7.instance.BT_QUAT_0;_n.normalize(i,t.axis),Rn.rotationTo(r,_n.UNIT_Z,i),S7(o,r),q8.Transform_setRotation(s,o);var a=t7.instance.BT_TRANSFORM_1,h=this.constraint.connectedBody;h?(_n.multiply(i,h.node.worldScale,t.pivotB),Rn.multiply(r,e.worldRotation,r),Rn.invert(n,h.node.worldRotation),Rn.multiply(r,n,r)):(_n.multiply(i,e.worldScale,t.pivotA),_n.transformQuat(i,i,e.worldRotation),_n.add(i,i,e.worldPosition),Rn.multiply(r,e.worldRotation,r)),T7(q8.Transform_getOrigin(a),i),S7(o,r),q8.Transform_setRotation(a,o),q8.HingeConstraint_setFrames(this._impl,s,a)},i.updateScale0=function(){this.updateFrames()},i.updateScale1=function(){this.updateFrames()},n(e,[{key:"constraint",get:function(){return this._com}}]),e}(jst);!function(t){t[t.RO_XYZ=0]="RO_XYZ",t[t.RO_XZY=1]="RO_XZY",t[t.RO_YXZ=2]="RO_YXZ",t[t.RO_YZX=3]="RO_YZX",t[t.RO_ZXY=4]="RO_ZXY",t[t.RO_ZYX=5]="RO_ZYX"}(kst||(kst={})),function(t){t[t.X=0]="X",t[t.Y=1]="Y",t[t.Z=2]="Z",t[t.TWIST=3]="TWIST",t[t.SWING1=4]="SWING1",t[t.SWING2=5]="SWING2"}(Ust||(Ust={}));var Qst=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i._setLimit=function(t,e,i,n){switch(t){case b8.LOCKED:q8.Generic6DofSpring2Constraint_setLimit(this._impl,e,0,0);break;case b8.LIMITED:q8.Generic6DofSpring2Constraint_setLimit(this._impl,e,i,n);break;case b8.FREE:q8.Generic6DofSpring2Constraint_setLimit(this._impl,e,1,0)}},i.setConstraintMode=function(t,e){var i=this.constraint.linearLimitSettings,n=this.constraint.angularLimitSettings,r=[0,0,0],s=[0,0,0],o=0,a=0;switch(t){case 0:case 1:case 2:_n.toArray(r,i.lower),_n.toArray(s,i.upper),a=r[t],o=s[t];break;case 3:a=-(o=.5*Li(n.twistExtent));break;case 4:a=-(o=.5*Li(n.swingExtent1));break;case 5:a=-(o=.5*Li(n.swingExtent2));break;default:k("idx should be in [0, 5], but give "+t)}this._setLimit(e,t,a,o)},i.setLinearLimit=function(t,e,i){var n=0,r=this.constraint.linearLimitSettings;switch(t){case 0:n=r.xMotion;break;case 1:n=r.yMotion;break;case 2:n=r.zMotion}this._setLimit(n,t,e,i)},i.setAngularExtent=function(t,e,i){var n=this.constraint.angularLimitSettings;this._setLimit(n.twistMotion,Ust.TWIST,.5*-Li(t),.5*Li(t)),this._setLimit(n.swingMotion1,Ust.SWING1,.5*-Li(e),.5*Li(e)),this._setLimit(n.swingMotion2,Ust.SWING2,.5*-Li(i),.5*Li(i))},i.setSwingSoftConstraint=function(t){q8.Generic6DofSpring2Constraint_enableSpring(this._impl,Ust.SWING1,t),q8.Generic6DofSpring2Constraint_enableSpring(this._impl,Ust.SWING2,t)},i.setTwistSoftConstraint=function(t){q8.Generic6DofSpring2Constraint_enableSpring(this._impl,Ust.TWIST,t)},i.setLinearSoftConstraint=function(t){q8.Generic6DofSpring2Constraint_enableSpring(this._impl,Ust.X,t),q8.Generic6DofSpring2Constraint_enableSpring(this._impl,Ust.Y,t),q8.Generic6DofSpring2Constraint_enableSpring(this._impl,Ust.Z,t)},i.setLinearStiffness=function(t){q8.Generic6DofSpring2Constraint_setStiffness(this._impl,Ust.X,t),q8.Generic6DofSpring2Constraint_setStiffness(this._impl,Ust.Y,t),q8.Generic6DofSpring2Constraint_setStiffness(this._impl,Ust.Z,t)},i.setLinearDamping=function(t){q8.Generic6DofSpring2Constraint_setDamping(this._impl,Ust.X,t),q8.Generic6DofSpring2Constraint_setDamping(this._impl,Ust.Y,t),q8.Generic6DofSpring2Constraint_setDamping(this._impl,Ust.Z,t)},i.setLinearRestitution=function(t){q8.Generic6DofSpring2Constraint_setBounce(this._impl,Ust.X,t),q8.Generic6DofSpring2Constraint_setBounce(this._impl,Ust.Y,t),q8.Generic6DofSpring2Constraint_setBounce(this._impl,Ust.Z,t)},i.setSwingStiffness=function(t){q8.Generic6DofSpring2Constraint_setStiffness(this._impl,Ust.SWING1,t),q8.Generic6DofSpring2Constraint_setStiffness(this._impl,Ust.SWING2,t)},i.setSwingDamping=function(t){q8.Generic6DofSpring2Constraint_setDamping(this._impl,Ust.SWING1,t),q8.Generic6DofSpring2Constraint_setDamping(this._impl,Ust.SWING2,t)},i.setSwingRestitution=function(t){q8.Generic6DofSpring2Constraint_setBounce(this._impl,Ust.SWING1,t),q8.Generic6DofSpring2Constraint_setBounce(this._impl,Ust.SWING2,t)},i.setTwistStiffness=function(t){q8.Generic6DofSpring2Constraint_setStiffness(this._impl,Ust.TWIST,t)},i.setTwistDamping=function(t){q8.Generic6DofSpring2Constraint_setDamping(this._impl,Ust.TWIST,t)},i.setTwistRestitution=function(t){q8.Generic6DofSpring2Constraint_setBounce(this._impl,Ust.TWIST,t)},i.setDriverMode=function(t,e){e===C8.DISABLED?q8.Generic6DofSpring2Constraint_enableMotor(this._impl,t,!1):e===C8.SERVO?(q8.Generic6DofSpring2Constraint_enableMotor(this._impl,t,!0),q8.Generic6DofSpring2Constraint_setServo(this._impl,t,!0)):e===C8.INDUCTION&&(q8.Generic6DofSpring2Constraint_enableMotor(this._impl,t,!0),q8.Generic6DofSpring2Constraint_setServo(this._impl,t,!1))},i._updateMotorTargetAndVelocity=function(t){var e=C8.DISABLED,i=0,n=0,r=0,s=this.constraint.linearDriverSettings,o=this.constraint.angularDriverSettings;switch(t){case 0:i=Ust.X,e=s.xDrive,n=s.targetPosition.x,r=-s.targetVelocity.x;break;case 1:i=Ust.Y,e=s.yDrive,n=s.targetPosition.y,r=-s.targetVelocity.y;break;case 2:i=Ust.Z,e=s.zDrive,n=s.targetPosition.z,r=-s.targetVelocity.z;break;case 3:i=Ust.TWIST,e=o.twistDrive,n=-Li(o.targetOrientation.x),r=-Li(o.targetVelocity.x);break;case 4:i=Ust.SWING1,e=o.swingDrive1,n=-Li(o.targetOrientation.y),r=-Li(o.targetVelocity.y);break;case 5:i=Ust.SWING2,e=o.swingDrive2,n=-Li(o.targetOrientation.z),r=-Li(o.targetVelocity.z)}var a=t>2?o.strength:s.strength;q8.Generic6DofSpring2Constraint_setServoTarget(this._impl,i,n),e===C8.SERVO?t>2?q8.Generic6DofSpring2Constraint_setTargetVelocity(this._impl,i,-n*a*.1):q8.Generic6DofSpring2Constraint_setTargetVelocity(this._impl,i,n*a*.1):e===C8.INDUCTION&&q8.Generic6DofSpring2Constraint_setTargetVelocity(this._impl,i,r)},i.setLinearMotorTarget=function(){this._updateMotorTargetAndVelocity(0),this._updateMotorTargetAndVelocity(1),this._updateMotorTargetAndVelocity(2)},i.setLinearMotorVelocity=function(){this._updateMotorTargetAndVelocity(0),this._updateMotorTargetAndVelocity(1),this._updateMotorTargetAndVelocity(2)},i.setLinearMotorForceLimit=function(t){q8.Generic6DofSpring2Constraint_setMaxMotorForce(this._impl,Ust.X,t),q8.Generic6DofSpring2Constraint_setMaxMotorForce(this._impl,Ust.Y,t),q8.Generic6DofSpring2Constraint_setMaxMotorForce(this._impl,Ust.Z,t)},i.setAngularMotorTarget=function(){this._updateMotorTargetAndVelocity(3),this._updateMotorTargetAndVelocity(4),this._updateMotorTargetAndVelocity(5)},i.setAngularMotorVelocity=function(){this._updateMotorTargetAndVelocity(3),this._updateMotorTargetAndVelocity(4),this._updateMotorTargetAndVelocity(5)},i.setAngularMotorForceLimit=function(t){q8.Generic6DofSpring2Constraint_setMaxMotorForce(this._impl,Ust.TWIST,t),q8.Generic6DofSpring2Constraint_setMaxMotorForce(this._impl,Ust.SWING1,t),q8.Generic6DofSpring2Constraint_setMaxMotorForce(this._impl,Ust.SWING2,t)},i.setPivotA=function(){this.updateFrames()},i.setPivotB=function(){this.updateFrames()},i.setAutoPivotB=function(){this.updateFrames()},i.setAxis=function(){this.updateFrames()},i.setSecondaryAxis=function(){this.updateFrames()},i.setBreakForce=function(){var t=C7(Math.max(this.constraint.breakForce,this.constraint.breakTorque),j7.instance.fixedTimeStep);q8.TypedConstraint_setMaxImpulseThreshold(this._impl,t)},i.setBreakTorque=function(){var t=C7(Math.max(this.constraint.breakForce,this.constraint.breakTorque),j7.instance.fixedTimeStep);q8.TypedConstraint_setMaxImpulseThreshold(this._impl,t)},i.onComponentSet=function(){var t=this.constraint.connectedBody,e=this._rigidBody.body.impl,i=t&&t.body.impl||q8.TypedConstraint_getFixedBody(),n=t7.instance.BT_TRANSFORM_0,r=t7.instance.BT_TRANSFORM_1;this._impl=q8.Generic6DofSpring2Constraint_new(e,i,n,r,kst.RO_YZX);var s=this.constraint.linearLimitSettings,o=this.constraint.angularLimitSettings;this.setConstraintMode(0,s.xMotion),this.setConstraintMode(1,s.yMotion),this.setConstraintMode(2,s.zMotion),this.setConstraintMode(3,o.twistMotion),this.setConstraintMode(4,o.swingMotion1),this.setConstraintMode(5,o.swingMotion2),this.setLinearSoftConstraint(s.enableSoftConstraint),this.setLinearStiffness(s.stiffness),this.setLinearDamping(s.damping),this.setLinearRestitution(s.restitution),this.setSwingSoftConstraint(o.enableSoftConstraintSwing),this.setSwingRestitution(o.swingRestitution),this.setSwingStiffness(o.swingStiffness),this.setSwingDamping(o.swingDamping),this.setTwistSoftConstraint(o.enableSoftConstraintTwist),this.setTwistRestitution(o.twistRestitution),this.setTwistStiffness(o.twistStiffness),this.setTwistDamping(o.twistDamping);var a=this.constraint.linearDriverSettings,h=this.constraint.angularDriverSettings;this.setDriverMode(0,a.xDrive),this.setDriverMode(1,a.yDrive),this.setDriverMode(2,a.zDrive),this.setDriverMode(3,h.twistDrive),this.setDriverMode(4,h.swingDrive1),this.setDriverMode(5,h.swingDrive2),this.setLinearMotorTarget(a.targetPosition),this.setLinearMotorVelocity(a.targetVelocity),this.setLinearMotorForceLimit(a.strength),this.setAngularMotorTarget(h.targetOrientation),this.setAngularMotorVelocity(h.targetVelocity),this.setAngularMotorForceLimit(h.strength),this.setBreakForce(this.constraint.breakForce),this.setBreakTorque(this.constraint.breakTorque),this.updateFrames(),this.updateDebugDrawSize()},i.updateFrames=function(){var t=this.constraint,e=t.node,i=e7,n=r7,r=s7,s=t7.instance.BT_TRANSFORM_0;_n.multiply(i,e.worldScale,t.pivotA),T7(q8.Transform_getOrigin(s),i);var o=t7.instance.BT_QUAT_0,a=t.axis,h=t.secondaryAxis,u=_n.cross(i7,a,h);Ln.set(o7,a.x,a.y,a.z,0,h.x,h.y,h.z,0,u.x,u.y,u.z,0,0,0,0,1).getRotation(n),S7(o,n),q8.Transform_setRotation(s,o);var c=t7.instance.BT_TRANSFORM_1,l=this.constraint.connectedBody;l?(Rn.multiply(n,e.worldRotation,n),Rn.invert(r,l.node.worldRotation),Rn.multiply(n,r,n),t.autoPivotB?(_n.multiply(i,t.node.worldScale,t.pivotA),_n.transformQuat(i,i,e.worldRotation),_n.add(i,i,t.node.worldPosition),_n.subtract(i,i,l.node.worldPosition),_n.transformQuat(i,i,r)):_n.multiply(i,l.node.worldScale,t.pivotB)):(_n.multiply(i,e.worldScale,t.pivotA),_n.transformQuat(i,i,e.worldRotation),_n.add(i,i,e.worldPosition),Rn.multiply(n,e.worldRotation,n)),T7(q8.Transform_getOrigin(c),i),S7(o,n),q8.Transform_setRotation(c,o),q8.Generic6DofSpring2Constraint_setFrames(this._impl,s,c)},i.updateScale0=function(){this.updateFrames()},i.updateScale1=function(){this.updateFrames()},n(e,[{key:"constraint",get:function(){return this._com}}]),e}(jst),Zst=new _n(0,0,0),Jst=new _n(0,0,0);new _n(0,0,0);var $st=function(){function t(){this.wrappedWorld=void 0,this._isEnabled=!1,this._impl=0,this._comp=null,this._btCollisionFlags=0,this._word3=0,this._dirty=!1,this._collisionFilterGroup=w8.DEFAULT,this._collisionFilterMask=-1,this.id=t.idCounter++,this.wrappedWorld=j7.instance.physicsWorld}var e=t.prototype;return e.onComponentSet=function(){},e.updateScale=function(){},e.initialize=function(t){this._comp=t;var e=this._comp.group,i=j7.instance.collisionMatrix[e];return this._collisionFilterGroup=e,this._collisionFilterMask=i,this.onComponentSet(),0!==this._impl||(k("[Physics]: Initialize BulletCharacterController failed"),!1)},e.setWrapper=function(){t7.setWrapper(this._impl,Q8.CCT_CACHE_NAME,this);var t=q8.CharacterController_getCollisionShape(this.impl);t7.setWrapper(t,Q8.CCT_CACHE_NAME,this)},e.onEnable=function(){this._isEnabled=!0,this._impl||this.onComponentSet(),this.setDetectCollisions(!1),this.setOverlapRecovery(!0),j7.instance.physicsWorld.addCCT(this),this.setWrapper()},e.onDisable=function(){this._isEnabled=!1,this.wrappedWorld.removeCCT(this),this.onDestroy()},e.onDestroy=function(){q8._safe_delete(this._impl,W8.EBulletTypeCharacterController),t7.delWrapper(this._impl,Q8.CCT_CACHE_NAME),this._impl=0},e.onLoad=function(){},e.getPosition=function(t){this._impl&&E7(t,q8.CharacterController_getPosition(this.impl))},e.setPosition=function(t){this._impl&&(T7(q8.CharacterController_getPosition(this.impl),t),this.syncPhysicsToScene())},e.setContactOffset=function(t){this._impl&&q8.CharacterController_setContactOffset(this._impl,t)},e.setStepOffset=function(t){this._impl&&q8.CharacterController_setStepOffset(this._impl,t)},e.setSlopeLimit=function(t){this._impl&&q8.CharacterController_setSlopeLimit(this._impl,ze(t))},e.setDetectCollisions=function(t){this._impl&&q8.CharacterController_setCollision(this.impl,t)},e.setOverlapRecovery=function(t){this._impl&&q8.CharacterController_setOverlapRecovery(this.impl,t)},e.onGround=function(){return(4&this._btCollisionFlags)>0},e.syncSceneToPhysics=function(){var t=this.characterController.node;t.hasChangedFlags&&(t.hasChangedFlags&Ig.SCALE&&this.syncScale(),t.hasChangedFlags&Ig.POSITION&&(_n.add(Zst,t.worldPosition,this.scaledCenter),this.setPosition(Zst)))},e.syncPhysicsToScene=function(){this.getPosition(Zst),Zst.subtract(this.scaledCenter),this._comp.node.setWorldPosition(Zst)},e.syncScale=function(){this.updateScale()},e.move=function(t,e,i){if(this._isEnabled){var n=t7.instance.BT_V3_0;q8.Vec3_set(n,t.x,t.y,t.z),this._btCollisionFlags=q8.CharacterController_move(this.impl,n,e,i)}},e.setGroup=function(t){t!==this._collisionFilterGroup&&(this._collisionFilterGroup=t,this._dirty=!0)},e.getGroup=function(){return this._collisionFilterGroup},e.addGroup=function(t){this._collisionFilterGroup|=t,this._dirty=!0},e.removeGroup=function(t){this._collisionFilterGroup&=~t,this._dirty=!0},e.setMask=function(t){t!==this._collisionFilterMask&&(this._collisionFilterMask=t,this._dirty=!0)},e.getMask=function(){return this._collisionFilterMask},e.addMask=function(t){this._collisionFilterMask|=t,this._dirty=!0},e.removeMask=function(t){this._collisionFilterMask&=~t,this._dirty=!0},e.updateEventListener=function(){this.wrappedWorld.updateNeedEmitCCTEvents(this.characterController.needCollisionEvent)},e.updateDirty=function(){this._dirty&&(j7.instance.physicsWorld.removeCCT(this),j7.instance.physicsWorld.addCCT(this),this._dirty=!1)},e.onShapeHitExt=function(t){var e=q8.ControllerShapeHit_getHitShape(t),i=j7.instance.physicsWorld;i.cctShapeEventDic.get(this.impl,e);var n=new _n;E7(n,q8.ControllerHit_getHitWorldPos(t));var r=new _n;E7(r,q8.ControllerHit_getHitWorldNormal(t));var s=new _n;E7(s,q8.ControllerHit_getHitMotionDir(t));var o=q8.ControllerHit_getHitMotionLength(t),a=t7.getWrapper(e,Ast.TYPE);a&&i.cctShapeEventDic.set(this.impl,e,{BulletCharacterController:this,BulletShape:a,worldPos:n,worldNormal:r,motionDir:s,motionLength:o})},n(t,[{key:"isEnabled",get:function(){return this._isEnabled}},{key:"impl",get:function(){return this._impl}},{key:"characterController",get:function(){return this._comp}},{key:"scaledCenter",get:function(){return _n.multiply(Jst,this._comp.center,this._comp.node.worldScale),Jst}}]),t}();$st.idCounter=0;var tot,eot,iot,not,rot,sot,oot,aot,hot=new _n(0,0,0),uot=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.onComponentSet=function(){this.component.node.getWorldPosition(hot),hot.add(this.scaledCenter);var t=t7.instance.BT_V3_0;q8.Vec3_set(t,hot.x,hot.y,hot.z);var e=_n.UNIT_Y,i=t7.instance.BT_V3_1;q8.Vec3_set(i,e.x,e.y,e.z);var n=q8.ControllerHitReport.implement(gst).$$.ptr,r=j7.instance.physicsWorld,s=q8.CapsuleCharacterControllerDesc_new(ze(this.component.slopeLimit),this.component.stepOffset,this.component.skinWidth,i,t,n,this.component.radius,this.component.height);this._impl=q8.CapsuleCharacterController_new(r.impl,s,0),this.updateScale()},i.setRadius=function(){this.updateScale()},i.setHeight=function(){this.updateScale()},i.updateScale=function(){this.updateGeometry()},i.updateGeometry=function(){var t=this.component.node.worldScale,e=this.component.radius*qi(t.x,t.z),i=this.component.height*Math.abs(t.y);q8.CapsuleCharacterController_setRadius(this.impl,e),q8.CapsuleCharacterController_setHeight(this.impl,i),this._dirty=!0},n(e,[{key:"component",get:function(){return this._comp}}]),e}($st),cot=new _n(0,0,0),lot=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.onComponentSet=function(){this.component.node.getWorldPosition(cot),cot.add(this.scaledCenter);var t=t7.instance.BT_V3_0;q8.Vec3_set(t,cot.x,cot.y,cot.z);var e=_n.UNIT_Y,i=t7.instance.BT_V3_1;q8.Vec3_set(i,e.x,e.y,e.z);var n=q8.ControllerHitReport.implement(gst).$$.ptr,r=j7.instance.physicsWorld,s=q8.BoxCharacterControllerDesc_new(ze(this.component.slopeLimit),this.component.stepOffset,this.component.skinWidth,i,t,n,this.component.halfHeight,this.component.halfSideExtent,this.component.halfForwardExtent);this._impl=q8.BoxCharacterController_new(r.impl,s,0),this.updateScale()},i.setHalfHeight=function(){this.updateScale()},i.setHalfSideExtent=function(){this.updateScale()},i.setHalfForwardExtent=function(){this.updateScale()},i.updateScale=function(){this.updateGeometry()},i.updateGeometry=function(){var t=this.component.node.worldScale;q8.BoxCharacterController_setHalfSideExtent(this.impl,this.component.halfSideExtent*t.x),q8.BoxCharacterController_setHalfHeight(this.impl,this.component.halfHeight*t.y),q8.BoxCharacterController_setHalfForwardExtent(this.impl,this.component.halfForwardExtent*t.z),this._dirty=!0},n(e,[{key:"component",get:function(){return this._comp}}]),e}($st);bO.once(AO.EVENT_PRE_SUBSYSTEM_INIT,(function(){N8.register("bullet",{PhysicsWorld:Mst,RigidBody:pst,BoxShape:Nst,SphereShape:Lst,CapsuleShape:Bst,TrimeshShape:Gst,CylinderShape:Hst,ConeShape:zst,TerrainShape:Vst,SimplexShape:Wst,PlaneShape:Xst,PointToPointConstraint:Yst,HingeConstraint:qst,FixedConstraint:Kst,ConfigurableConstraint:Qst,BoxCharacterController:lot,CapsuleCharacterController:uot})})),function(t){t[t.BOX=0]="BOX",t[t.SPHERE=1]="SPHERE",t[t.CYLINDER=2]="CYLINDER",t[t.CONE=3]="CONE",t[t.CAPSULE=4]="CAPSULE",t[t.TORUS=5]="TORUS",t[t.PLANE=6]="PLANE",t[t.QUAD=7]="QUAD"}(aot||(aot={})),Se(aot);var _ot=t("Primitive",(tot=va("cc.Primitive"),eot=Za(aot),tot(((oot=function(t){function e(e){var i;return void 0===e&&(e=aot.BOX),(i=t.call(this)||this).type=rot&&rot(),i.info=sot&&sot(),i.type=e,i}return s(e,t),e.prototype.onLoaded=function(){aP(GK[aot[this.type].toLowerCase()](this.info),this)},e}(ZO)).PrimitiveType=aot,rot=ua((not=oot).prototype,"type",[eot],(function(){return aot.BOX})),sot=ua(not.prototype,"info",[wa],(function(){return{}})),iot=not))||iot));m.Primitive=_ot,m.primitives=GK;var dot,fot,pot=function(){function t(t,e,i){this._total=0,this._value=0,this._averageValue=0,this._accumValue=0,this._accumSamples=0,this._id=t,this._opts=e,this._accumStart=i}var e=t.prototype;return e.sample=function(t){this._average(this._value,t)},e.human=function(){var t=this._opts,e=t.average,i=t.isInteger,n=e?this._averageValue:this._value;return i?Math.round(n):Math.round(100*n)/100},e.alarm=function(){return void 0!==this._opts.below&&this._value<this._opts.below||void 0!==this._opts.over&&this._value>this._opts.over},e._average=function(t,e){if(void 0===e&&(e=0),this._opts.average){this._accumValue+=t,++this._accumSamples;var i=e;i-this._accumStart>=this._opts.average&&(this._averageValue=this._accumValue/this._accumSamples,this._accumValue=0,this._accumStart=i,this._accumSamples=0)}},n(t,[{key:"value",get:function(){return this._value},set:function(t){this._value=t}}]),t}(),got=va("cc.PerfCounter")(dot=function(t){function e(e,i,n){var r;return(r=t.call(this,e,i,n)||this)._time=n,r}s(e,t);var i=e.prototype;return i.start=function(t){void 0===t&&(t=0),this._time=t},i.end=function(t){void 0===t&&(t=0),this._value=t-this._time,this._average(this._value)},i.tick=function(){this.end(),this.start()},i.frame=function(t){var e=t,i=e-this._time;this._total++,i>(this._opts.average||1e3)&&(this._value=1e3*this._total/i,this._total=0,this._time=e,this._average(this._value))},e}(pot))||dot,mot="0123456789. ",vot=500,yot={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,".":10},Tot={fps:{desc:"Framerate (FPS)",below:30,average:vot,isInteger:!0},draws:{desc:"Draw call",isInteger:!0},frame:{desc:"Frame time (ms)",min:0,max:50,average:vot},instances:{desc:"Instance Count",isInteger:!0},tricount:{desc:"Triangle",isInteger:!0},logic:{desc:"Game Logic (ms)",min:0,max:50,average:vot,color:"#080"},physics:{desc:"Physics (ms)",min:0,max:50,average:vot},render:{desc:"Renderer (ms)",min:0,max:50,average:vot,color:"#f90"},present:{desc:"Present (ms)",min:0,max:50,average:vot,color:"#f90"},textureMemory:{desc:"GFX Texture Mem(M)"},bufferMemory:{desc:"GFX Buffer Mem(M)"}},Eot=t("Profiler",function(t){function e(){var e;return(e=t.call(this)||this)._profilerStats=null,e._showFPS=!1,e._rootNode=null,e._device=null,e._swapchain=null,e._meshRenderer=null,e._canvas=null,e._ctx=null,e._texture=null,e._region=new __,e._canvasArr=[],e._regionArr=[e._region],e.digitsData=null,e.offsetData=null,e.pass=null,e._canvasDone=!1,e._statsDone=!1,e._inited=!1,e._lineHeight=280/(Object.keys(Tot).length+1),e._wordHeight=0,e._eachNumWidth=0,e._totalLines=0,e.lastTime=0,e._canvas=y.document.createElement("canvas"),e._ctx=e._canvas.getContext("2d"),e._canvasArr.push(e._canvas),e}s(e,t);var i=e.prototype;return i.init=function(){we.querySettings(Ce.Category.PROFILING,"showFPS")?this.showStats():this.hideStats()},i.isShowingStats=function(){return this._showFPS},i.hideStats=function(){this._showFPS&&(this._rootNode&&(this._rootNode.active=!1),m.director.off(m.Director.EVENT_BEFORE_UPDATE,this.beforeUpdate,this),m.director.off(m.Director.EVENT_AFTER_UPDATE,this.afterUpdate,this),m.director.off(m.Director.EVENT_BEFORE_PHYSICS,this.beforePhysics,this),m.director.off(m.Director.EVENT_AFTER_PHYSICS,this.afterPhysics,this),m.director.off(m.Director.EVENT_BEFORE_DRAW,this.beforeDraw,this),m.director.off(m.Director.EVENT_AFTER_RENDER,this.afterRender,this),m.director.off(m.Director.EVENT_AFTER_DRAW,this.afterPresent,this),this._showFPS=!1,DD.root.pipeline.profiler=null,m.game.config.showFPS=!1)},i.showStats=function(){if(!this._showFPS){if(!this._device){var t=m.director.root;this._device=Qd.gfxDevice,this._swapchain=t.mainWindow.swapchain}this.generateCanvas(),this.generateStats(),m.game.once(m.Game.EVENT_ENGINE_INITED,this.generateNode,this),m.game.on(m.Game.EVENT_RESTART,this.generateNode,this),this._rootNode&&(this._rootNode.active=!0),m.director.on(m.Director.EVENT_BEFORE_UPDATE,this.beforeUpdate,this),m.director.on(m.Director.EVENT_AFTER_UPDATE,this.afterUpdate,this),m.director.on(m.Director.EVENT_BEFORE_PHYSICS,this.beforePhysics,this),m.director.on(m.Director.EVENT_AFTER_PHYSICS,this.afterPhysics,this),m.director.on(m.Director.EVENT_BEFORE_DRAW,this.beforeDraw,this),m.director.on(m.Director.EVENT_AFTER_RENDER,this.afterRender,this),m.director.on(m.Director.EVENT_AFTER_DRAW,this.afterPresent,this),this._showFPS=!0,this._canvasDone=!0,this._statsDone=!0,m.game.config.showFPS=!0}},i.generateCanvas=function(){if(!this._canvasDone){this._ctx&&this._canvas&&(this._canvas.width=280,this._canvas.height=280,this._canvas.style.width=""+this._canvas.width,this._canvas.style.height=""+this._canvas.height,this._ctx.font="23px Arial",this._ctx.textBaseline="top",this._ctx.fillStyle="#fff",this._texture=this._device.createTexture(new A_(Sl.TEX2D,Al.SAMPLED|Al.TRANSFER_DST,pl.RGBA8,280,280)),this._region.texExtent.width=280,this._region.texExtent.height=280)}},i.generateStats=function(){if(!this._statsDone&&this._ctx&&this._canvas){this._profilerStats=null;var t=performance.now();this._ctx.textAlign="left";var e=0;for(var i in Tot){var n=Tot[i];this._ctx.fillText(n.desc,0,e*this._lineHeight),n.counter=new got(i,n,t),e++}this._totalLines=e,this._wordHeight=this._totalLines*this._lineHeight/this._canvas.height;for(var r=0;r<mot.length;++r){var s=this._ctx.measureText(mot[r]).width;this._eachNumWidth=Math.max(this._eachNumWidth,s)}for(var o=0;o<mot.length;++o)this._ctx.fillText(mot[o],o*this._eachNumWidth,this._totalLines*this._lineHeight);this._eachNumWidth/=this._canvas.width,this._profilerStats=Tot,this._canvasArr[0]=this._canvas,this._device.copyTexImagesToTexture(this._canvasArr,this._texture,this._regionArr)}},i.generateNode=function(){if(!this._rootNode||!this._rootNode.isValid){this._rootNode=new Tm("PROFILER_NODE"),this._rootNode._objFlags=m.Object.Flags.DontSave|m.Object.Flags.HideInHierarchy,m.game.addPersistRootNode(this._rootNode);var t=new Tm("Profiler_Root");t.parent=this._rootNode;for(var e=.4,i=e/this._totalLines,n=e/this._wordHeight,r=i/23,s=this._eachNumWidth*this._canvas.width*r,o=[0,e,0,n,e,0,n,0,0,0,0,0],a=[0,2,1,0,3,2],h=[0,0,-1,0,1,0,-1,0,1,this._wordHeight,-1,0,0,this._wordHeight,-1,0],u=0,c=0;c<this._totalLines;c++)for(var l=0;l<8;l++){o.push(n+l*s,e-c*i,0),o.push(n+(l+1)*s,e-c*i,0),o.push(n+(l+1)*s,e-(c+1)*i,0),o.push(n+l*s,e-(c+1)*i,0),u=4*(8*c+l+1),a.push(0+u,2+u,1+u,0+u,3+u,2+u);var _=8*c+l,d=Math.floor(_/4),f=_-4*d;h.push(0,this._wordHeight,d,f),h.push(this._eachNumWidth,this._wordHeight,d,f),h.push(this._eachNumWidth,1,d,f),h.push(0,1,d,f)}this._meshRenderer=t.addComponent(UV),this._meshRenderer.mesh=aP({positions:o,indices:a,colors:h});var p=new $E;p.initialize({effectName:"util/profiler"});var g=this.pass=p.passes[0],v=g.getBinding("mainTexture"),y=g.getBinding("digits"),T=g.getBinding("offset");g.bindTexture(v,this._texture),this.digitsData=g.blocks[y],this.offsetData=g.blocks[T],this.offsetData[3]=-1,this._meshRenderer.material=p,this._meshRenderer.node.layer=Rg.Enum.PROFILER,this._inited=!0}},i.beforeUpdate=function(){if(this._profilerStats){var t=performance.now();this._profilerStats.frame.counter.start(t),this._profilerStats.logic.counter.start(t)}},i.afterUpdate=function(){if(this._profilerStats){var t=performance.now();m.director.isPaused()?this._profilerStats.frame.counter.start(t):this._profilerStats.logic.counter.end(t)}},i.beforePhysics=function(){if(this._profilerStats){var t=performance.now();this._profilerStats.physics.counter.start(t)}},i.afterPhysics=function(){if(this._profilerStats){var t=performance.now();this._profilerStats.physics.counter.end(t)}},i.beforeDraw=function(){if(this._profilerStats&&this._inited){var t=this._swapchain.surfaceTransform,e=this._device.capabilities.clipSpaceSignY;if(t!==this.offsetData[3]){var i=Nn[t],n=-.9,r=-.9*e;Fo.isXR&&(n=-.5,r=-.5*e),this.offsetData[0]=n*i[0]+r*i[2],this.offsetData[1]=n*i[1]+r*i[3],this.offsetData[2]=this._eachNumWidth,this.offsetData[3]=t}this.pass.setRootBufferDirty(!0),this._meshRenderer.model?DD.root.pipeline.profiler=this._meshRenderer.model:DD.root.pipeline.profiler=null;var s=performance.now();this._profilerStats.render.counter.start(s)}},i.afterRender=function(){if(this._profilerStats&&this._inited){var t=performance.now();this._profilerStats.render.counter.end(t),this._profilerStats.present.counter.start(t)}},i.afterPresent=function(){if(this._profilerStats&&this._inited){var t=performance.now();if(this._profilerStats.frame.counter.end(t),this._profilerStats.fps.counter.frame(t),this._profilerStats.present.counter.end(t),!(t-this.lastTime<vot)){this.lastTime=t;var e=this._device;this._profilerStats.draws.counter.value=e.numDrawCalls,this._profilerStats.instances.counter.value=e.numInstances,this._profilerStats.bufferMemory.counter.value=e.memoryStatus.bufferSize/1048576,this._profilerStats.textureMemory.counter.value=e.memoryStatus.textureSize/1048576,this._profilerStats.tricount.counter.value=e.numTris;var i=0,n=this.digitsData;for(var r in this._profilerStats){var s=this._profilerStats[r];s.counter.sample(t);for(var o=s.counter.human().toString(),a=7;a>=0;a--){var h=8*i+a,u=o[o.length-(8-a)],c=yot[u];void 0===c&&(c=11),n[h]=c}i++}}}},n(e,[{key:"_stats",get:function(){return q(16381),this._profilerStats}},{key:"stats",get:function(){return this._profilerStats}}]),e}(Yc)),Sot=t("profiler",new Eot);DD.registerSystem("profiler",Sot,0),m.profiler=Sot,function(t){var e,i,n,r,s,o,a,h,u,c;(e=t.MixBlend||(t.MixBlend={}))[e.setup=0]="setup",e[e.first=1]="first",e[e.replace=2]="replace",e[e.add=3]="add",(i=t.MixDirection||(t.MixDirection={}))[i.mixIn=0]="mixIn",i[i.mixOut=1]="mixOut",(n=t.TimelineType||(t.TimelineType={}))[n.rotate=0]="rotate",n[n.translate=1]="translate",n[n.scale=2]="scale",n[n.shear=3]="shear",n[n.attachment=4]="attachment",n[n.color=5]="color",n[n.deform=6]="deform",n[n.event=7]="event",n[n.drawOrder=8]="drawOrder",n[n.ikConstraint=9]="ikConstraint",n[n.transformConstraint=10]="transformConstraint",n[n.pathConstraintPosition=11]="pathConstraintPosition",n[n.pathConstraintSpacing=12]="pathConstraintSpacing",n[n.pathConstraintMix=13]="pathConstraintMix",n[n.twoColor=14]="twoColor",function(t){t[t.start=0]="start",t[t.interrupt=1]="interrupt",t[t.end=2]="end",t[t.dispose=3]="dispose",t[t.complete=4]="complete",t[t.event=5]="event"}(t.EventType||(t.EventType={})),(r=t.BlendMode||(t.BlendMode={}))[r.Normal=0]="Normal",r[r.Additive=1]="Additive",r[r.Multiply=2]="Multiply",r[r.Screen=3]="Screen",(s=t.TransformMode||(t.TransformMode={}))[s.Normal=0]="Normal",s[s.OnlyTranslation=1]="OnlyTranslation",s[s.NoRotationOrReflection=2]="NoRotationOrReflection",s[s.NoScale=3]="NoScale",s[s.NoScaleOrReflection=4]="NoScaleOrReflection",(o=t.PositionMode||(t.PositionMode={}))[o.Fixed=0]="Fixed",o[o.Percent=1]="Percent",(a=t.SpacingMode||(t.SpacingMode={}))[a.Length=0]="Length",a[a.Fixed=1]="Fixed",a[a.Percent=2]="Percent",(h=t.RotateMode||(t.RotateMode={}))[h.Tangent=0]="Tangent",h[h.Chain=1]="Chain",h[h.ChainScale=2]="ChainScale",(u=t.TextureFilter||(t.TextureFilter={}))[u.Nearest=9728]="Nearest",u[u.Linear=9729]="Linear",u[u.MipMap=9987]="MipMap",u[u.MipMapNearestNearest=9984]="MipMapNearestNearest",u[u.MipMapLinearNearest=9985]="MipMapLinearNearest",u[u.MipMapNearestLinear=9986]="MipMapNearestLinear",u[u.MipMapLinearLinear=9987]="MipMapLinearLinear",(c=t.TextureWrap||(t.TextureWrap={}))[c.MirroredRepeat=33648]="MirroredRepeat",c[c.ClampToEdge=33071]="ClampToEdge",c[c.Repeat=10497]="Repeat",function(t){t[t.Region=0]="Region",t[t.BoundingBox=1]="BoundingBox",t[t.Mesh=2]="Mesh",t[t.LinkedMesh=3]="LinkedMesh",t[t.Path=4]="Path",t[t.Point=5]="Point",t[t.Clipping=6]="Clipping"}(t.AttachmentType||(t.AttachmentType={}))}(fot||(fot={}));var Aot=fot;function bot(t,e){return t?e===t.length?t:e<t.length?t.slice(0,e):new Array(e):new Array(e)}function Cot(t,e,i){var n="_"+i;Object.defineProperty(t,i,{get:function(){var t=e.call(this),i=t.size(),r=this[n];r=bot(r,i);for(var s=0;s<i;s++)r[s]=t.get(s);return this[n]=r,r}})}var Rot=null,wot=[];bO.onPostInfrastructureInitDelegate.add((function(){return kO().then((function(){return Promise.all([e.import("external:emscripten/spine/spine.wasm.js"),e.import("external:emscripten/spine/spine.wasm")]).then((function(t){return e=t[0].default,i=t[1].default,new Promise((function(t,n){var r=function(t){return"[Spine]: Spine wasm load failed: "+t};e({instantiateWasm:function(t,e){FO(i,t).then((function(t){e(t.instance,t.module)})).catch((function(t){return n(r(t))}))}}).then((function(t){Rot=t,wot.forEach((function(t){t(Rot)}))})).then(t).catch((function(t){return n(r(t))}))}));var e,i}))})).catch((function(t){k(t)}))})),wot.push((function(t){var e;!function(t){Aot.wasmUtil=t.SpineWasmUtil,Aot.wasmUtil.wasm=t,Aot.wasmUtil.spineWasmInit(),Aot.SPVectorFloat=t.SPVectorFloat,Aot.MathUtils=t.MathUtils,Aot.Color=t.Color,Aot.String=t.String,Aot.Vector2=t.Vector2,Aot.Interpolation=t.Interpolation,Aot.Triangulator=t.Triangulator,Aot.ConstraintData=t.ConstraintData,Aot.IkConstraintData=t.IkConstraintData,Aot.PathConstraintData=t.PathConstraintData,Aot.SkeletonBounds=t.SkeletonBounds,Aot.Event=t.Event,Aot.EventData=t.EventData,Aot.Attachment=t.Attachment,Aot.VertexAttachment=t.VertexAttachment,Aot.BoundingBoxAttachment=t.BoundingBoxAttachment,Aot.ClippingAttachment=t.ClippingAttachment,Aot.MeshAttachment=t.MeshAttachment,Aot.PathAttachment=t.PathAttachment,Aot.PointAttachment=t.PointAttachment,Aot.RegionAttachment=t.RegionAttachment,Aot.AtlasAttachmentLoader=t.AtlasAttachmentLoader,Aot.TextureAtlasPage=t.TextureAtlasPage,Aot.TextureAtlasRegion=t.TextureAtlasRegion,Aot.TextureAtlas=t.TextureAtlas,Aot.PowOut=t.PowOut,Aot.BoneData=t.BoneData,Aot.SlotData=t.SlotData,Aot.Updatable=t.Updatable,Aot.IkConstraint=t.IkConstraint,Aot.PathConstraint=t.PathConstraint,Aot.TransformConstraintData=t.TransformConstraintData,Aot.TransformConstraint=t.TransformConstraint,Aot.Bone=t.Bone,Aot.Slot=t.Slot,Aot.Skin=t.Skin,Aot.SkinEntry=t.SkinEntry,Aot.SkeletonClipping=t.SkeletonClipping,Aot.SkeletonData=t.SkeletonData,Aot.TranslateTimeline=t.TranslateTimeline,Aot.ScaleTimeline=t.ScaleTimeline,Aot.ShearTimeline=t.ShearTimeline,Aot.RotateTimeline=t.RotateTimeline,Aot.ColorTimeline=t.ColorTimeline,Aot.TwoColorTimeline=t.TwoColorTimeline,Aot.AttachmentTimeline=t.AttachmentTimeline,Aot.DeformTimeline=t.DeformTimeline,Aot.EventTimeline=t.EventTimeline,Aot.DrawOrderTimeline=t.DrawOrderTimeline,Aot.IkConstraintTimeline=t.IkConstraintTimeline,Aot.TransformConstraintTimeline=t.TransformConstraintTimeline,Aot.PathConstraintPositionTimeline=t.PathConstraintPositionTimeline,Aot.PathConstraintMixTimeline=t.PathConstraintMixTimeline,Aot.TrackEntry=t.TrackEntry,Aot.AnimationStateData=t.AnimationStateData,Aot.AnimationState=t.AnimationState,Aot.Animation=t.Animation,Aot.EventQueue=t.EventQueue,Aot.AnimationStateAdapter=t.AnimationStateAdapter,Aot.Skeleton=t.Skeleton,Aot.SkeletonBinary=t.SkeletonBinary,Aot.SkeletonJson=t.SkeletonJson,Aot.VertexEffect=t.VertexEffect,Aot.JitterEffect=t.JitterEffect,Aot.SwirlEffect=t.SwirlEffect,Aot.SkeletonInstance=t.SkeletonInstance,Aot.SkeletonSystem=t.SkeletonSystem}(t),[{proto:e=Aot.String.prototype,property:"length",getter:e.length},{proto:e,property:"isEmpty",getter:e.isEmpty},{proto:e,property:"str",getter:e.str}].forEach((function(t){It(t.proto,t.property,t.getter)})),function(t,e){Object.defineProperty(t,"strPtr",{value:function(){var t=e.call(this),i=Aot.wasmUtil.wasm.HEAPU8,n=this.length,r=i.subarray(t,t+n);return String.fromCharCode.apply(String,r)}})}(e,e.strPtr),function(){var t=Aot.Vector2.prototype;[{proto:t,property:"x",getter:t.getX,setter:t.setX},{proto:t,property:"y",getter:t.getY,setter:t.setY}].forEach((function(t){It(t.proto,t.property,t.getter,t.setter)}))}(),function(){var t=Aot.BoneData.prototype;[{proto:t,property:"index",getter:t.getIndex},{proto:t,property:"name",getter:t.getName},{proto:t,property:"parent",getter:t.getParent},{proto:t,property:"length",getter:t.getLength,setter:t.setLength},{proto:t,property:"x",getter:t.getX,setter:t.setX},{proto:t,property:"y",getter:t.getY,setter:t.setY},{proto:t,property:"rotation",getter:t.getRotation,setter:t.setRotation},{proto:t,property:"scaleX",getter:t.getScaleX,setter:t.setScaleX},{proto:t,property:"scaleY",getter:t.getScaleY,setter:t.setScaleY},{proto:t,property:"shearX",getter:t.getShearX,setter:t.setShearX},{proto:t,property:"shearY",getter:t.getShearY,setter:t.setShearY},{proto:t,property:"transformMode",getter:t.getTransformMode,setter:t.setTransformMode},{proto:t,property:"skinRequired",getter:t.getSkinRequired,setter:t.setSkinRequired}].forEach((function(t){wt(t.proto,t.property,t.getter,t.setter)}))}(),function(){var t=Aot.ConstraintData.prototype;[{proto:t,property:"name",getter:t.getName},{proto:t,property:"order",getter:t.getOrder,setter:t.setOder},{proto:t,property:"skinRequired",getter:t.getSkinRequired,setter:t.setSkinRequired}].forEach((function(t){wt(t.proto,t.property,t.getter,t.setter)}))}(),function(){var t=Aot.IkConstraintData.prototype;[{proto:t,property:"target",getter:t.getTarget,setter:t.setTarget},{proto:t,property:"bendDirection",getter:t.getBendDirection,setter:t.setBendDirection},{proto:t,property:"compress",getter:t.getCompress,setter:t.setCompress},{proto:t,property:"stretch",getter:t.getStretch,setter:t.setStretch},{proto:t,property:"uniform",getter:t.getUniform,setter:t.setUniform},{proto:t,property:"mix",getter:t.getMix,setter:t.setMix},{proto:t,property:"softness",getter:t.getSoftness,setter:t.setSoftness}].forEach((function(t){wt(t.proto,t.property,t.getter,t.setter)})),Cot(t,t.getBones,"bones")}(),function(){var t=Aot.PathConstraintData.prototype;[{proto:t,property:"target",getter:t.getTarget,setter:t.setTarget},{proto:t,property:"positionMode",getter:t.getPositionMode,setter:t.setPositionMode},{proto:t,property:"spacingMode",getter:t.getSpacingMode,setter:t.setSpacingMode},{proto:t,property:"rotateMode",getter:t.getRotateMode,setter:t.setRotateMode},{proto:t,property:"offsetRotation",getter:t.getOffsetRotation,setter:t.setOffsetRotation},{proto:t,property:"position",getter:t.getPosition,setter:t.setPosition},{proto:t,property:"spacing",getter:t.getSpacing,setter:t.setSpacing},{proto:t,property:"rotateMix",getter:t.getRotateMix,setter:t.setRotateMix},{proto:t,property:"translateMix",getter:t.getTranslateMix,setter:t.setTranslateMix}].forEach((function(t){wt(t.proto,t.property,t.getter,t.setter)})),Cot(t,t.getBones,"bones")}(),function(){var t=Aot.Event.prototype;[{proto:t,property:"data",getter:t.getData},{proto:t,property:"intValue",getter:t.getIntValue,setter:t.setIntValue},{proto:t,property:"floatValue",getter:t.getFloatValue,setter:t.setFloatValue},{proto:t,property:"stringValue",getter:t.getStringValue,setter:t.setStringValue},{proto:t,property:"time",getter:t.getTime},{proto:t,property:"volume",getter:t.getVolume,setter:t.setVolume},{proto:t,property:"balance",getter:t.getBalance,setter:t.setBalance}].forEach((function(t){wt(t.proto,t.property,t.getter,t.setter)}))}(),function(){var t=Aot.EventData.prototype;[{proto:t,property:"name",getter:t.getName},{proto:t,property:"intValue",getter:t.getIntValue,setter:t.setIntValue},{proto:t,property:"floatValue",getter:t.getFloatValue,setter:t.setFloatValue},{proto:t,property:"stringValue",getter:t.getStringValue,setter:t.setStringValue},{proto:t,property:"audioPath",getter:t.getAudioPath,setter:t.setAudioPath},{proto:t,property:"volume",getter:t.getVolume,setter:t.setVolume},{proto:t,property:"balance",getter:t.getBalance,setter:t.setBalance}].forEach((function(t){wt(t.proto,t.property,t.getter,t.setter)}))}(),function(){var t=Aot.BoundingBoxAttachment.prototype;[{proto:t,property:"name",getter:t.getName}].forEach((function(t){wt(t.proto,t.property,t.getter)}))}(),function(){var t=Aot.ClippingAttachment.prototype;[{proto:t,property:"endSlot",getter:t.getEndSlot,setter:t.setEndSlot}].forEach((function(t){wt(t.proto,t.property,t.getter,t.setter)}))}(),function(){var t=Aot.MeshAttachment.prototype;[{proto:t,property:"path",getter:t.getPath,setter:t.setPath},{proto:t,property:"color",getter:t.getColor},{proto:t,property:"width",getter:t.getWidth,setter:t.setWidth},{proto:t,property:"height",getter:t.getHeight,setter:t.setHeight},{proto:t,property:"hullLength",getter:t.getHullLength,setter:t.setHullLength}].forEach((function(t){wt(t.proto,t.property,t.getter,t.setter)})),Cot(t,t.getRegionUVs,"regionUVs"),Cot(t,t.getUVs,"uvs"),Cot(t,t.getTriangles,"triangles"),Cot(t,t.getEdges,"edges")}(),function(){var t=Aot.PathAttachment.prototype;[{proto:t,property:"closed",getter:t.getClosed,setter:t.setClosed},{proto:t,property:"constantSpeed",getter:t.getConstantSpeed,setter:t.setConstantSpeed}].forEach((function(t){wt(t.proto,t.property,t.getter)})),Cot(t,t.getLengths,"lengths")}(),function(){var t=Aot.PointAttachment.prototype;[{proto:t,property:"x",getter:t.getX,setter:t.setX},{proto:t,property:"y",getter:t.getY,setter:t.setY},{proto:t,property:"rotation",getter:t.getRotation,setter:t.setRotation}].forEach((function(t){wt(t.proto,t.property,t.getter,t.setter)}))}(),function(){var t=Aot.RegionAttachment.prototype;[{proto:t,property:"x",getter:t.getX,setter:t.setX},{proto:t,property:"y",getter:t.getY,setter:t.setY},{proto:t,property:"scaleX",getter:t.getScaleX,setter:t.setScaleX},{proto:t,property:"scaleY",getter:t.getScaleY,setter:t.setScaleY},{proto:t,property:"rotation",getter:t.getRotation,setter:t.setRotation},{proto:t,property:"width",getter:t.getWidth,setter:t.setWidth},{proto:t,property:"height",getter:t.getHeight,setter:t.setHeight},{proto:t,property:"color",getter:t.getColor},{proto:t,property:"path",getter:t.getPath,setter:t.setPath},{proto:t,property:"rendererObject",getter:t.getRendererObject}].forEach((function(t){wt(t.proto,t.property,t.getter,t.setter)})),Cot(t,t.getOffset,"offset");var e=t.getUVs,i=t.setUVs;Object.defineProperty(t,"uvs",{get:function(){var i=e.call(this),n=i.size(),r=t._uvs;r=bot(r,n);for(var s=0;s<n;s++)r[s]=i.get(s);return t._uvs=r,r},set:function(t){i.call(this,t[0],t[1],t[2],t[3],1===t[4])}});var n=t.computeWorldVertices,r=new Aot.SPVectorFloat;Object.defineProperty(t,"computeWorldVertices",{value:function(t,e,i,s){var o=e.length;r.resize(o,0);for(var a=0;a<o;a++)r.set(a,e[a]);n.call(this,t,r,i,s);for(var h=0;h<o;h++)e[h]=r.get(h)}})}(),function(){var t=Aot.VertexAttachment.prototype;[{proto:t,property:"id",getter:t.getId},{proto:t,property:"worldVerticesLength",getter:t.getWorldVerticesLength,setter:t.setWorldVerticesLength},{proto:t,property:"deformAttachment",getter:t.getDeformAttachment,setter:t.setDeformAttachment}].forEach((function(t){wt(t.proto,t.property,t.getter,t.setter)})),Cot(t,t.getBones,"bones"),Cot(t,t.getVertices,"vertices");var e=t.computeWorldVertices,i=new Aot.SPVectorFloat;Object.defineProperty(t,"computeWorldVertices",{value:function(t,n,r,s,o,a){var h=s.length;i.resize(h,0);for(var u=0;u<h;u++)i.set(u,s[u]);e.call(this,t,n,r,i,o,a);for(var c=0;c<h;c++)s[c]=i.get(c)}})}(),function(){var t=Aot.SlotData.prototype;[{proto:t,property:"index",getter:t.getIndex},{proto:t,property:"boneData",getter:t.getBoneData},{proto:t,property:"name",getter:t.getName},{proto:t,property:"color",getter:t.getColor},{proto:t,property:"darkColor",getter:t.getDarkColor},{proto:t,property:"blendMode",getter:t.getBlendMode,setter:t.setBlendMode}].forEach((function(t){wt(t.proto,t.property,t.getter,t.setter)}))}(),function(){var t=Aot.IkConstraint.prototype;[{proto:t,property:"data",getter:t.getData},{proto:t,property:"target",getter:t.getTarget,setter:t.setTarget},{proto:t,property:"bendDirection",getter:t.getBendDirection,setter:t.setBendDirection},{proto:t,property:"compress",getter:t.getCompress,setter:t.setCompress},{proto:t,property:"stretch",getter:t.getStretch,setter:t.setStretch},{proto:t,property:"mix",getter:t.getMix,setter:t.setMix},{proto:t,property:"softness",getter:t.getSoftness,setter:t.setSoftness},{proto:t,property:"active",getter:t.getActive,setter:t.setActive}].forEach((function(t){wt(t.proto,t.property,t.getter,t.setter)})),Cot(t,t.getBones,"bones")}(),function(){var t=Aot.PathConstraint.prototype;[{proto:t,property:"data",getter:t.getData},{proto:t,property:"target",getter:t.getTarget,setter:t.setTarget},{proto:t,property:"position",getter:t.getPosition,setter:t.setPosition},{proto:t,property:"spacing",getter:t.getSpacing,setter:t.setSpacing},{proto:t,property:"rotateMix",getter:t.getRotateMix,setter:t.setRotateMix},{proto:t,property:"translateMix",getter:t.getTranslateMix,setter:t.setTranslateMix},{proto:t,property:"active",getter:t.getActive,setter:t.setActive}].forEach((function(t){wt(t.proto,t.property,t.getter,t.setter)})),Cot(t,t.getBones,"bones")}(),function(){var t=Aot.TransformConstraintData.prototype;[{proto:t,property:"target",getter:t.getTarget},{proto:t,property:"rotateMix",getter:t.getRotateMix},{proto:t,property:"translateMix",getter:t.getTranslateMix},{proto:t,property:"scaleMix",getter:t.getScaleMix},{proto:t,property:"shearMix",getter:t.getShearMix},{proto:t,property:"offsetRotation",getter:t.getOffsetRotation},{proto:t,property:"offsetX",getter:t.getOffsetX},{proto:t,property:"offsetY",getter:t.getOffsetY},{proto:t,property:"offsetScaleX",getter:t.getOffsetScaleX},{proto:t,property:"offsetScaleY",getter:t.getOffsetScaleY},{proto:t,property:"offsetShearY",getter:t.getOffsetShearY},{proto:t,property:"relative",getter:t.getRelative},{proto:t,property:"local",getter:t.getLocal}].forEach((function(t){wt(t.proto,t.property,t.getter)})),Cot(t,t.getBones,"bones")}(),function(){var t=Aot.TransformConstraint.prototype;[{proto:t,property:"data",getter:t.getData},{proto:t,property:"target",getter:t.getTarget},{proto:t,property:"rotateMix",getter:t.getRotateMix,setter:t.setRotateMix},{proto:t,property:"translateMix",getter:t.getTranslateMix,setter:t.setTranslateMix},{proto:t,property:"scaleMix",getter:t.getScaleMix,setter:t.setScaleMix},{proto:t,property:"shearMix",getter:t.getShearMix,setter:t.setShearMix},{proto:t,property:"active",getter:t.getActive,setter:t.setActive}].forEach((function(t){wt(t.proto,t.property,t.getter,t.setter)})),Cot(t,t.getBones,"bones")}(),function(){var t=Aot.Bone.prototype;[{proto:t,property:"skeleton",getter:t.getSkeleton},{proto:t,property:"data",getter:t.getData},{proto:t,property:"parent",getter:t.getParent},{proto:t,property:"x",getter:t.getX,setter:t.setX},{proto:t,property:"y",getter:t.getY,setter:t.setY},{proto:t,property:"rotation",getter:t.getRotation,setter:t.setRotation},{proto:t,property:"scaleX",getter:t.getScaleX,setter:t.setScaleX},{proto:t,property:"scaleY",getter:t.getScaleY,setter:t.setScaleY},{proto:t,property:"shearX",getter:t.getShearX,setter:t.setShearX},{proto:t,property:"shearY",getter:t.getShearY,setter:t.setShearY},{proto:t,property:"ax",getter:t.getAX,setter:t.setAX},{proto:t,property:"ay",getter:t.getAY,setter:t.setAY},{proto:t,property:"arotation",getter:t.getARotation,setter:t.setARotation},{proto:t,property:"ascaleX",getter:t.getAScaleX,setter:t.setAScaleX},{proto:t,property:"ascaleY",getter:t.getAScaleY,setter:t.setAScaleY},{proto:t,property:"ashearX",getter:t.getAShearX,setter:t.setAShearX},{proto:t,property:"ashearY",getter:t.getAShearY,setter:t.setAShearY},{proto:t,property:"appliedValid",getter:t.getAppliedValid,setter:t.setAppliedValid},{proto:t,property:"a",getter:t.getA,setter:t.setA},{proto:t,property:"b",getter:t.getB,setter:t.setB},{proto:t,property:"c",getter:t.getC,setter:t.setC},{proto:t,property:"d",getter:t.getD,setter:t.setD},{proto:t,property:"worldX",getter:t.getWorldX,setter:t.setWorldX},{proto:t,property:"worldY",getter:t.getWorldY,setter:t.setWorldY},{proto:t,property:"active",getter:t.getActive,setter:t.setActive}].forEach((function(t){wt(t.proto,t.property,t.getter,t.setter)})),Cot(t,t.getChildren,"children")}(),function(){var t=Aot.Slot.prototype;[{proto:t,property:"data",getter:t.getData},{proto:t,property:"bone",getter:t.getBone},{proto:t,property:"color",getter:t.getColor},{proto:t,property:"darkColor",getter:t.getDarkColor},{proto:t,property:"skeleton",getter:t.getSkeleton}].forEach((function(t){wt(t.proto,t.property,t.getter)})),Cot(t,t.getDeform,"deform")}(),function(){var t=Aot.Skin.prototype;[{proto:t,property:"name",getter:t.getName}].forEach((function(t){wt(t.proto,t.property,t.getter)})),Cot(t,t.getBones,"bones"),Cot(t,t.getAttachments,"attachments"),Cot(t,t.getConstraints,"constraints"),function(t,e,i){var n="_"+i;Object.defineProperty(t,i,{value:function(){var t=e.call(this),i=t.size(),r=this[n];r=bot(r,i);for(var s=0;s<i;s++)r[s]=t.get(s);return this[n]=r,r}})}(t,t.getAttachments,"getAttachments");var e=t.getAttachmentsForSlot;Object.defineProperty(t,"getAttachmentsForSlot",{value:function(t,i){var n=e.call(this,t),r=n.size();i.length=r;for(var s=0;s<r;s++)i[s]=n.get(s);n.delete()}});var i=t.findNamesForSlot;Object.defineProperty(t,"findNamesForSlot",{value:function(t,e){var n=i.call(this,t),r=n.size();e.length=r;for(var s=0;s<r;s++)e[s]=n.get(s);n.delete()}})}(),function(){var t=Aot.Attachment.prototype;[{proto:t,property:"name",getter:t.getName}].forEach((function(t){wt(t.proto,t.property,t.getter)}))}(),function(){var t=Aot.SkinEntry.prototype;[{proto:t,property:"name",getter:t.getName},{proto:t,property:"attachment",getter:t.getAttachment}].forEach((function(t){wt(t.proto,t.property,t.getter)}))}(),function(){var t=Aot.SkeletonClipping.prototype;[{proto:t,property:"clippedVertices",getter:t.getClippedVertices},{proto:t,property:"clippedTriangles",getter:t.getClippedTriangles},{proto:t,property:"clippedUVs",getter:t.getClippedUVs}].forEach((function(t){wt(t.proto,t.property,t.getter)}))}(),function(){var t=Aot.SkeletonData.prototype;[{proto:t,property:"name",getter:t.getName},{proto:t,property:"defaultSkin",getter:t.getDefaultSkin,setter:t.setDefaultSkin},{proto:t,property:"x",getter:t.getX,setter:t.setX},{proto:t,property:"y",getter:t.getY,setter:t.setY},{proto:t,property:"width",getter:t.getWidth,setter:t.setWidth},{proto:t,property:"height",getter:t.getHeight,setter:t.setHeight},{proto:t,property:"version",getter:t.getVersion,setter:t.setVersion},{proto:t,property:"hash",getter:t.getHash,setter:t.setHash},{proto:t,property:"fps",getter:t.getFps,setter:t.setFps},{proto:t,property:"imagesPath",getter:t.getImagesPath,setter:t.setImagesPath},{proto:t,property:"audioPath",getter:t.getAudioPath,setter:t.setAudioPath}].forEach((function(t){wt(t.proto,t.property,t.getter,t.setter)})),Cot(t,t.getBones,"bones"),Cot(t,t.getSlots,"slots"),Cot(t,t.getSkins,"skins"),Cot(t,t.getAnimations,"animations"),Cot(t,t.getEvents,"events"),Cot(t,t.getIkConstraints,"ikConstraints"),Cot(t,t.getTransformConstraints,"transformConstraints"),Cot(t,t.getPathConstraints,"pathConstraints")}(),function(){var t=Aot.RotateTimeline.prototype;[{proto:t,property:"boneIndex",getter:t.getBoneIndex}].forEach((function(t){wt(t.proto,t.property,t.getter)})),Cot(t,t.getFrames,"frames")}(),function(){var t=Aot.ColorTimeline.prototype;[{proto:t,property:"slotIndex",getter:t.getSlotIndex}].forEach((function(t){wt(t.proto,t.property,t.getter)})),Cot(t,t.getFrames,"frames")}(),function(){var t=Aot.TwoColorTimeline.prototype;[{proto:t,property:"slotIndex",getter:t.getSlotIndex}].forEach((function(t){wt(t.proto,t.property,t.getter)}))}(),function(){var t=Aot.AttachmentTimeline.prototype;[{proto:t,property:"slotIndex",getter:t.getSlotIndex}].forEach((function(t){wt(t.proto,t.property,t.getter)})),Cot(t,t.getFrames,"frames"),Cot(t,t.getAttachmentNames,"attachmentNames")}(),function(){var t=Aot.DeformTimeline.prototype;[{proto:t,property:"slotIndex",getter:t.getSlotIndex},{proto:t,property:"attachment",getter:t.getAttachment}].forEach((function(t){wt(t.proto,t.property,t.getter)})),Cot(t,t.getFrames,"frames"),function(t,e,i){var n="_"+i;Object.defineProperty(t,i,{get:function(){var t=e.call(this),i=t.size(),r=this[n];r=bot(r,i);for(var s=0;s<i;s++){var o=t.get(s),a=o.size(),h=r[s];h=bot(h,a);for(var u=0;u<a;u++)h[u]=o.get(u);r[s]=h}return this[n]=r,r}})}(t,t.getFrameVertices,"frameVertices")}(),function(){var t=Aot.EventTimeline.prototype;Cot(t,t.getFrames,"frames"),Cot(t,t.getEvents,"events")}(),function(){var t=Aot.DrawOrderTimeline.prototype;Cot(t,t.getFrames,"frames")}(),function(){var t=Aot.TrackEntry.prototype;[{proto:t,property:"animation",getter:t.getAnimation},{proto:t,property:"next",getter:t.getNext},{proto:t,property:"mixingFrom",getter:t.getMixingFrom},{proto:t,property:"mixingTo",getter:t.getMixingTo},{proto:t,property:"trackIndex",getter:t.getTrackIndex},{proto:t,property:"loop",getter:t.getLoop,setter:t.setLoop},{proto:t,property:"holdPrevious",getter:t.getHoldPrevious,setter:t.setHoldPrevious},{proto:t,property:"eventThreshold",getter:t.getEventThreshold,setter:t.setEventThreshold},{proto:t,property:"attachmentThreshold",getter:t.getAttachmentThreshold,setter:t.setAttachmentThreshold},{proto:t,property:"drawOrderThreshold",getter:t.getDrawOrderThreshold,setter:t.setDrawOrderThreshold},{proto:t,property:"animationStart",getter:t.getAnimationStart,setter:t.setAnimationStart},{proto:t,property:"animationEnd",getter:t.getAnimationEnd,setter:t.setAnimationEnd},{proto:t,property:"animationLast",getter:t.getAnimationLast,setter:t.setAnimationLast},{proto:t,property:"delay",getter:t.getDelay,setter:t.setDelay},{proto:t,property:"trackTime",getter:t.getTrackTime,setter:t.setTrackTime},{proto:t,property:"trackEnd",getter:t.getTrackEnd,setter:t.setTrackEnd},{proto:t,property:"timeScale",getter:t.getTimeScale,setter:t.setTimeScale},{proto:t,property:"alpha",getter:t.getAlpha,setter:t.setAlpha},{proto:t,property:"mixTime",getter:t.getMixTime,setter:t.setMixTime},{proto:t,property:"mixDuration",getter:t.getMixDuration,setter:t.setMixDuration},{proto:t,property:"mixBlend",getter:t.getMixBlend,setter:t.setMixBlend}].forEach((function(t){wt(t.proto,t.property,t.getter,t.setter)}))}(),function(){var t=Aot.AnimationStateData.prototype;[{proto:t,property:"defaultMix",getter:t.getDefaultMix},{proto:t,property:"skeletonData",getter:t.getSkeletonData}].forEach((function(t){wt(t.proto,t.property,t.getter)}))}(),function(){var t=Aot.AnimationState.prototype;[{proto:t,property:"data",getter:t.getData},{proto:t,property:"timeScale",getter:t.getTimeScale,setter:t.setTimeScale}].forEach((function(t){wt(t.proto,t.property,t.getter,t.setter)})),Cot(t,t.getTracks,"tracks")}(),function(){var t=Aot.Animation.prototype;[{proto:t,property:"name",getter:t.getName},{proto:t,property:"duration",getter:t.getDuration,setter:t.setDuration}].forEach((function(t){wt(t.proto,t.property,t.getter,t.setter)})),Cot(t,t.getTimelines,"timelines")}(),function(){var t=Aot.Skeleton.prototype;[{proto:t,property:"data",getter:t.getData},{proto:t,property:"skin",getter:t.getSkin},{proto:t,property:"color",getter:t.getColor},{proto:t,property:"time",getter:t.getTime},{proto:t,property:"scaleX",getter:t.getScaleX,setter:t.setScaleX},{proto:t,property:"scaleY",getter:t.getScaleY,setter:t.setScaleY},{proto:t,property:"x",getter:t.getX,setter:t.setX},{proto:t,property:"y",getter:t.getY,setter:t.setY}].forEach((function(t){wt(t.proto,t.property,t.getter,t.setter)})),Cot(t,t.getBones,"bones"),Cot(t,t.getSlots,"slots"),Cot(t,t.getDrawOrder,"drawOrder"),Cot(t,t.getIkConstraints,"ikConstraints"),Cot(t,t.getTransformConstraints,"transformConstraints"),Cot(t,t.getPathConstraints,"pathConstraints"),Cot(t,t.getUpdateCacheList,"_updateCache")}(),function(){var t=Aot.JitterEffect.prototype;[{proto:t,property:"jitterX",getter:t.getJitterX,setter:t.setJitterX},{proto:t,property:"jitterY",getter:t.getJitterY,setter:t.setJitterY}].forEach((function(t){wt(t.proto,t.property,t.getter,t.setter)}))}(),function(){var t=Aot.SwirlEffect.prototype;[{proto:t,property:"centerX",getter:t.getCenterX,setter:t.setCenterX},{proto:t,property:"centerY",getter:t.getCenterY,setter:t.setCenterY},{proto:t,property:"radius",getter:t.getRadius,setter:t.setRadius},{proto:t,property:"angle",getter:t.getAngle,setter:t.setAngle}].forEach((function(t){wt(t.proto,t.property,t.getter,t.setter)}))}()}));var Iot,xot=0,Dot=0,Oot=function(){function t(){this.start=void 0,this.interrupt=void 0,this.end=void 0,this.dispose=void 0,this.complete=void 0,this.event=void 0}return t.getListeners=function(e,i){if(!e.listener){e.listener=new t;var n=++Dot;i.setTrackEntryListener(n,e),t._trackSet.set(n,e)}return e.listener},t.emitListener=function(e,i,n,r){var s=t._listenerSet.get(e);if(s)switch(r){case Aot.EventType.event:s.event&&s.event(i,n);break;case Aot.EventType.start:s.start&&s.start(i);break;case Aot.EventType.interrupt:s.interrupt&&s.interrupt(i);break;case Aot.EventType.end:s.end&&s.end(i);break;case Aot.EventType.dispose:s.dispose&&s.dispose(i);break;case Aot.EventType.complete:s.complete&&s.complete(i);break;default:F("emitListener doesn't handled",r)}},t.emitTrackEntryListener=function(t,e,i,n){var r=this._trackSet.get(t);if(r)switch(n){case Aot.EventType.start:r.listener.start&&r.listener.start(e);break;case Aot.EventType.interrupt:r.listener.interrupt&&r.listener.interrupt(e);break;case Aot.EventType.end:r.listener.end&&r.listener.end(e);break;case Aot.EventType.dispose:r.listener.dispose&&r.listener.dispose(e),this._trackSet.delete(t),r.listener=null;break;case Aot.EventType.complete:r.listener.complete&&r.listener.complete(e);break;case Aot.EventType.event:r.listener.event&&r.listener.event(e,i);break;default:F("TrackEntry doesn't handled",n)}},t.addListener=function(e){var i=++xot;return t._listenerSet.set(i,e),i},t.removeListener=function(e){t._listenerSet.delete(e)},t}();Oot._listenerSet=new Map,Oot._trackSet=new Map,globalThis.TrackEntryListeners=Oot;var Pot=1/60;kM(NM);var Mot,Not,Lot,Bot,Fot,kot,Uot,Got,Hot,zot,Vot=kM(BM),Wot=function(){this.a=0,this.b=0,this.c=0,this.d=0,this.worldX=0,this.worldY=0},Xot=function(){this.vCount=0,this.iCount=0,this.vData=null,this.iData=null,this.meshes=[]},jot=function(){this.iCount=0,this.blendMode=0,this.textureID=0},Yot=function(){function t(t){this._instance=null,this._state=null,this._skeletonData=null,this._skeleton=null,this._privateMode=!1,this._curIndex=-1,this._isCompleted=!1,this._maxFrameIdex=0,this._frameIdx=-1,this._inited=!1,this._invalid=!0,this._enableCacheAttachedInfo=!1,this._skeletonInfo=null,this._animationName=null,this.isCompleted=!1,this.totalTime=0,this.frames=[],this._privateMode=!1,this._inited=!1,this._invalid=!0,this._instance=new Aot.SkeletonInstance,this._instance.isCache=!0,this._skeletonData=t,this._skeleton=this._instance.initSkeleton(t),this._instance.setUseTint(!0)}var e=t.prototype;return e.init=function(t,e){this._inited=!0,this._animationName=e,this._skeletonInfo=t},e.setSkin=function(t){this._skeleton&&this._skeleton.setSkinByName(t),this._instance.setSkin(t)},e.setAnimation=function(t){var e=this._skeletonData.animations,i=null;e.forEach((function(e){e.name===t&&(i=e)})),i?(this._maxFrameIdex=Math.floor(i.duration/Pot),this._maxFrameIdex<=0&&(this._maxFrameIdex=1),this._instance.setAnimation(0,t,!1)):F("find no animation named "+t+" !!!")},e.updateToFrame=function(t){if(this._inited&&(this.begin(),this.needToUpdate(t)))do{this._frameIdx++,this.totalTime+=Pot,this._instance.updateAnimation(Pot);var e=this._instance.updateRenderData();this.updateRenderData(this._frameIdx,e),this._frameIdx>=this._maxFrameIdex&&(this.isCompleted=!0)}while(this.needToUpdate(t))},e.getFrame=function(t){var e=t%this._maxFrameIdex;return this.frames[e]},e.invalidAnimationFrames=function(){this._curIndex=-1,this._isCompleted=!1,this.frames.length=0},e.updateRenderData=function(t,e){var i=e.vCount,n=e.iCount,r=Vot/Float32Array.BYTES_PER_ELEMENT,s=new Uint8Array(Float32Array.BYTES_PER_ELEMENT*r*i),o=new Uint16Array(n),a=Aot.wasmUtil.wasm.HEAPU8,h=e.vPtr,u=i*Float32Array.BYTES_PER_ELEMENT*r;s.set(a.subarray(h,h+u));var c=e.iPtr,l=Uint16Array.BYTES_PER_ELEMENT*n;new Uint8Array(o.buffer).set(a.subarray(c,c+l));var _=new Xot;_.vCount=i,_.iCount=n,_.vData=s,_.iData=o;for(var d=e.getData(),f=d.size(),p=0;p<f;p+=6){var g=new jot;g.iCount=d.get(p+3),g.blendMode=d.get(p+4),g.textureID=d.get(p+5),_.meshes.push(g)}var m=this._skeleton.bones,v=[];m.forEach((function(t){var e=new Wot;e.a=t.a,e.b=t.b,e.c=t.c,e.d=t.d,e.worldX=t.worldX,e.worldY=t.worldY,v.push(e)})),this.frames[t]={model:_,boneInfos:v}},e.begin=function(){if(this._invalid){var t=this._skeletonInfo,e=null==t?void 0:t.curAnimationCache;e&&e!==this&&(this._privateMode?e.invalidAllFrame():e.updateToFrame(0));var i=null==t?void 0:t.listener;this._instance.setAnimation(0,this._animationName,!1),this.bind(i),t.curAnimationCache=this,this._frameIdx=-1,this.isCompleted=!1,this.totalTime=0,this._invalid=!1}},e.end=function(){this.needToUpdate()||(this._skeletonInfo.curAnimationCache=null,this.frames.length=this._frameIdx+1,this.isCompleted=!0,this.unbind(this._skeletonInfo.listener))},e.bind=function(t){var e=this;t.complete=function(t){t&&t.animation.name===e._animationName&&(e.isCompleted=!0)}},e.unbind=function(t){t.complete=null},e.needToUpdate=function(t){return!this.isCompleted&&this.totalTime<30&&(void 0===t||this._frameIdx<t)},e.isInited=function(){return this._inited},e.isInvalid=function(){return this._invalid},e.invalidAllFrame=function(){this.isCompleted=!1,this._invalid=!0},e.enableCacheAttachedInfo=function(){this._enableCacheAttachedInfo||(this._enableCacheAttachedInfo=!0,this.invalidAllFrame())},e.clear=function(){this._inited=!1,this.invalidAllFrame()},e.destroy=function(){this._instance&&(this._instance.destroy(),this._instance=null)},n(t,[{key:"skeleton",get:function(){return this._skeleton}}]),t}(),Kot=function(){function t(){this._privateMode=void 0,this._skeletonCache=void 0,this._animationPool=void 0,this._sharedCacheMap=new Map,this._privateMode=!1,this._animationPool={},this._skeletonCache={}}var e=t.prototype;return e.enablePrivateMode=function(){this._privateMode=!0},e.clear=function(){this._animationPool={},this._skeletonCache={}},e.invalidAnimationCache=function(t){var e=this._skeletonCache[t];if(e&&e.skeleton){var i=e.animationsCache;for(var n in i)i[n].invalidAllFrame()}},e.destroySkeleton=function(t){var e=this;if(!this._privateMode){var i=this._sharedCacheMap.get(t);if(i){if((i-=1)>0)return void this._sharedCacheMap.set(t,i);this._sharedCacheMap.delete(t)}}var n=this._skeletonCache[t];if(n){var r=this._privateMode?function(t,e){e.destroy()}:function(i,n){e._animationPool[t+"#"+i]=n,n.clear()},s=n.animationsCache;for(var o in s){var a=s[o];a&&r(o,a)}n.skeleton&&Aot.wasmUtil.destroySpineSkeleton(n.skeleton),delete this._skeletonCache[t]}},e.createSkeletonInfo=function(t){var e=t.uuid,i=t.getRuntimeData();if(!this._privateMode){var n=this._sharedCacheMap.get(e);n?n+=1:n=1,this._sharedCacheMap.set(e,n)}if(this._skeletonCache[e])return this._skeletonCache[e];var r=new Aot.Skeleton(i),s=new Oot;return this._skeletonCache[e]={skeleton:r,clipper:null,state:null,listener:s,animationsCache:{},curAnimationCache:null,assetUUID:e}},e.getSkeletonInfo=function(t){var e=t.uuid;return this._skeletonCache[e]},e.getAnimationCache=function(t,e){var i=this._skeletonCache[t];return i?i.animationsCache[e]:null},e.initAnimationCache=function(t,e,i){var n=e.getRuntimeData();if(!n)return null;var r=this._skeletonCache[t];if(!r||!r.skeleton)return null;var s=r.animationsCache,o=s[i];if(!o){var a=t+"#"+i;(o=this._animationPool[a])?delete this._animationPool[a]:(o=new Yot(n))._privateMode=this._privateMode,o.init(r,i),s[i]=o}return o.init(r,i),o.setAnimation(i),o},e.destroyCachedAnimations=function(t){if(t){var e=this._animationPool;for(var i in e)i.includes(t)&&(e[i].destroy(),delete e[i]);var n=this._skeletonCache[t],r=n&&n.skeleton;r&&Aot.wasmUtil.destroySpineSkeleton(r),n&&delete this._skeletonCache[t]}else{var s=this._animationPool;for(var o in s)s[o].destroy(),delete s[o]}},t}();Iot=Kot,Kot.FrameTime=Pot,Kot.sharedCache=new Iot;var qot=(Mot=va("sp.SkeletonData"),Not=Za([Sg]),Lot=Za([ti]),Mot((Fot=function(t){function e(){var e;return(e=t.call(this)||this)._skeletonJson=kot&&kot(),e.textures=Uot&&Uot(),e.textureNames=Got&&Got(),e.scale=Hot&&Hot(),e._atlasText=zot&&zot(),e._buffer=void 0,e._skeletonCache=null,e._skinsEnum=null,e._animsEnum=null,e.reset(),e}s(e,t);var i=e.prototype;return i.createNode=function(t){var e=new Tm(this.name);return e.addComponent("cc.Skeleton").skeletonData=this,t(null,e)},i.reset=function(){this._skeletonCache=null},i.resetEnums=function(){},i.getRuntimeData=function(t){if(this._skeletonCache)return this._skeletonCache;if(!(this.textures&&this.textures.length>0)&&this.textureNames&&this.textureNames.length>0)return t||k(this.name+" no textures found!"),null;var e=Aot.wasmUtil.querySpineSkeletonDataByUUID(this._uuid);if(e)this._skeletonCache=e;else if(this._skeletonJson)this._skeletonCache=Aot.wasmUtil.createSpineSkeletonDataWithJson(this.skeletonJsonStr,this._atlasText),Aot.wasmUtil.registerSpineSkeletonDataWithUUID(this._skeletonCache,this._uuid);else{var i=new Uint8Array(this._nativeAsset),n=i.length,r=Aot.wasmUtil.queryStoreMemory(n);Aot.wasmUtil.wasm.HEAPU8.subarray(r,r+n).set(i),this._skeletonCache=Aot.wasmUtil.createSpineSkeletonDataWithBinary(n,this._atlasText),Aot.wasmUtil.registerSpineSkeletonDataWithUUID(this._skeletonCache,this._uuid)}return this._skeletonCache},i.getSkinsEnum=function(){if(this._skinsEnum)return this._skinsEnum;var t=this.getRuntimeData(!0);if(t){for(var e=t.skins,i={},n=0;n<e.length;n++)i[e[n].name]=n;return this._skinsEnum=ye(i)}return null},i.getAnimsEnum=function(){if(this._animsEnum&&Object.keys(this._animsEnum).length>1)return this._animsEnum;var t=this.getRuntimeData(!0);if(t){for(var e={"<None>":0},i=t.animations,n=0;n<i.length;n++)e[i[n].name]=n+1;return this._animsEnum=ye(e)}return null},i.destroy=function(){return Kot.sharedCache.destroyCachedAnimations(this._uuid),Aot.wasmUtil.destroySpineSkeletonDataWithUUID(this._uuid),t.prototype.destroy.call(this)},n(e,[{key:"skeletonJsonStr",get:function(){return this._skeletonJson?JSON.stringify(this._skeletonJson):""}},{key:"skeletonJson",get:function(){return this._skeletonJson},set:function(t){this.reset(),this._skeletonJson="string"==typeof t?JSON.parse(t):t,!this._uuid&&t.skeleton&&(this._uuid=t.skeleton.hash)}},{key:"atlasText",get:function(){return this._atlasText},set:function(t){this._atlasText=t,this.reset()}},{key:"_nativeAsset",get:function(){return this._buffer},set:function(t){this._buffer=t,this.reset()}}]),e}(Of),kot=ua(Fot.prototype,"_skeletonJson",[wa],(function(){return null})),Uot=ua(Fot.prototype,"textures",[wa,Not],(function(){return[]})),Got=ua(Fot.prototype,"textureNames",[wa,Lot],(function(){return[]})),Hot=ua(Fot.prototype,"scale",[wa],(function(){return 1})),zot=ua(Fot.prototype,"_atlasText",[wa],(function(){return""})),Bot=Fot))||Bot);m.internal.SpineSkeletonData=qot;var Qot=function(t){function e(){var e;return(e=t.call(this)||this)._skeletons=new Set,e}s(e,t),e.getInstance=function(){return e._instance||(e._instance=new e,DD.registerSystem(e.ID,e._instance,Yc.Priority.HIGH)),e._instance};var i=e.prototype;return i.add=function(t){t&&(this._skeletons.has(t)||this._skeletons.add(t))},i.remove=function(t){t&&this._skeletons.has(t)&&this._skeletons.delete(t)},i.postUpdate=function(t){this._skeletons&&this._skeletons.forEach((function(e){e.updateAnimation(t)}))},i.prepareRenderData=function(){this._skeletons&&this._skeletons.forEach((function(t){t.markForUpdateRenderData()}))},e}(Yc);Qot.ID="SKELETON",Qot._instance=void 0,m.internal.SpineSkeletonSystem=Qot;var Zot,Jot,$ot,tat,eat,iat,nat,rat,sat,oat,aat,hat,uat,cat,lat,_at,dat,fat,pat,gat,mat,vat,yat,Tat,Eat,Sat,Aat,bat,Cat,Rat,wat,Iat,xat,Dat,Oat=new Ln,Pat=function(){function t(){this._isInitialized=!1,this._skeletonBones=null,this._socketNodes=null,this._keysToDelete=[],this._isInitialized=!1}var e=t.prototype;return e.init=function(t){var e;this._isInitialized=!1,t&&0!==(null===(e=t.socketNodes)||void 0===e?void 0:e.size)&&(this._skeletonBones=t._skeleton.bones,!this._skeletonBones||this._skeletonBones.length<1||(this._socketNodes=t.socketNodes,!this._socketNodes||this._socketNodes.size<=0||(this._isInitialized=!0,this._syncAttachedNode())))},e.updateSkeletonBones=function(t){this._skeletonBones=t},e.reset=function(){this._isInitialized=!1,this._skeletonBones=null,this._socketNodes=null,this._keysToDelete.length=0},e._syncAttachedNode=function(){if(this._isInitialized){for(var t,e=this._socketNodes,i=d(e);!(t=i()).done;){var n=t.value,r=n[0],s=n[1];if(s&&s.isValid){var o=this._skeletonBones[r];o&&this.matrixHandle(s,o)}else this._keysToDelete.push(r)}if(!(this._keysToDelete.length<=0)){for(var a,h=d(this._keysToDelete);!(a=h()).done;){var u=a.value;e.delete(u)}this._keysToDelete.length=0}}},e.matrixHandle=function(t,e){var i=Oat;i.m00=e.a,i.m01=e.c,i.m04=e.b,i.m05=e.d,i.m12=e.worldX,i.m13=e.worldY,t.matrix=Oat},t}(),Mat=1e4;!function(t){t[t.UNSET=-1]="UNSET",t[t.REALTIME=0]="REALTIME",t[t.SHARED_CACHE=1]="SHARED_CACHE",t[t.PRIVATE_CACHE=2]="PRIVATE_CACHE"}(wat||(wat={})),Se(wat),function(t){t[t.default=0]="default"}(Iat||(Iat={})),Se(Iat),function(t){t[t["<None>"]=0]="<None>"}(xat||(xat={})),Se(xat),function(t){t[t.COLORED_TEXTURED=0]="COLORED_TEXTURED",t[t.TWO_COLORED=1]="TWO_COLORED"}(Dat||(Dat={}));var Nat=(Zot=va("sp.Skeleton.SpineSocket"),Jot=Za(Tm),Zot((tat=function(t,e){void 0===t&&(t=""),void 0===e&&(e=null),this.path=eat&&eat(),this.target=iat&&iat(),this.path=t,this.target=e},eat=ua(tat.prototype,"path",[wa],(function(){return""})),iat=ua(tat.prototype,"target",[Jot,wa],(function(){return null})),$ot=tat))||$ot);Jt(Nat,"sp.Skeleton.SpineSocket");var Lat=(nat=va("sp.Skeleton"),rat=Za(qot),sat=Za(Iat),oat=Za(xat),aat=Za(wat),hat=Za([Nat]),uat=Za($E),nat(((Rat=function(t){function e(){var e;return(e=t.call(this)||this)._skeletonData=_at&&_at(),e.defaultSkin=dat&&dat(),e.defaultAnimation=fat&&fat(),e._premultipliedAlpha=pat&&pat(),e._timeScale=gat&&gat(),e._preCacheMode=mat&&mat(),e._cacheMode=vat&&vat(),e._sockets=yat&&yat(),e._useTint=Tat&&Tat(),e._debugMesh=Eat&&Eat(),e._debugBones=Sat&&Sat(),e._debugSlots=Aat&&Aat(),e._enableBatch=bat&&bat(),e._runtimeData=null,e._skeleton=null,e._instance=null,e._state=null,e._textures=[],e._skeletonInfo=null,e._animationName="",e._skinName="",e._drawList=new Xs((function(){return{material:null,texture:null,indexOffset:0,indexCount:0}}),1),e._materialCache={},e.paused=!1,e._enumSkins=ye({}),e._enumAnimations=ye({}),e.attachUtil=void 0,e._socketNodes=new Map,e._cachedSockets=new Map,e._startEntry=void 0,e._endEntry=void 0,e._paused=!1,e._accTime=0,e._playCount=0,e._skeletonCache=null,e._animCache=null,e._animationQueue=[],e._headAniInfo=null,e._isAniComplete=!0,e._playTimes=0,e._curFrame=null,e._needUpdateSkeltonData=!0,e._listener=null,e._debugRenderer=null,e._startSlotIndex=void 0,e._endSlotIndex=void 0,e._slotTextures=null,e._vLength=0,e._vBuffer=null,e._iLength=0,e._iBuffer=null,e._model=void 0,e._tempColor={r:0,g:0,b:0,a:0},e._eventListenerID=-1,e.loop=Cat&&Cat(),e._useVertexOpacity=!0,e._startEntry={animation:{name:""},trackIndex:0},e._endEntry={animation:{name:""},trackIndex:0},e._startSlotIndex=-1,e._endSlotIndex=-1,e._instance=new Aot.SkeletonInstance,e._instance.dtRate=1*e._timeScale,e._instance.isCache=e.isAnimationCached(),e.attachUtil=new Pat,e}s(e,t);var i=e.prototype;return i.__preload=function(){t.prototype.__preload.call(this),this._updateSkeletonData(),this._updateDebugDraw()},i.onRestore=function(){this.updateMaterial(),this.markForUpdateRenderData()},i.getState=function(){return this._state},i.onEnable=function(){t.prototype.onEnable.call(this),this._instance&&(this._instance.enable=!0),this._flushAssembler(),Qot.getInstance().add(this)},i.onDisable=function(){t.prototype.onDisable.call(this),this._instance&&(this._instance.enable=!1),Qot.getInstance().remove(this)},i.onDestroy=function(){var e;this._eventListenerID>0&&(Oot.removeListener(this._eventListenerID),this._eventListenerID=-1),this._drawList.destroy(),this.destroyRenderData(),this._cleanMaterialCache(),this._vBuffer=null,this._iBuffer=null,this.attachUtil.reset(),null===(e=this._slotTextures)||void 0===e||e.clear(),this._slotTextures=null,this._cachedSockets.clear(),this._socketNodes.clear(),this._animCache=null,Qot.getInstance().remove(this),this._instance&&(this._instance.destroy(),this._instance=null),this._destroySkeletonInfo(this._skeletonCache),this._skeletonCache=null,t.prototype.onDestroy.call(this)},i.clearAnimation=function(t){this.isAnimationCached()||(this.clearTrack(t||0),this.setToSetupPose())},i.clearAnimations=function(){this.isAnimationCached()||(this.clearTracks(),this.setToSetupPose())},i._updateSkeletonData=function(){var t=this._skeletonData;if(!t)return this._runtimeData=null,this._state=null,this._skeleton=null,this._textures=[],void this._refreshInspector();this._instance&&(this._instance.dtRate=1*this._timeScale),this._needUpdateSkeltonData=!1,this._runtimeData=t.getRuntimeData(),this._runtimeData&&(this.setSkeletonData(this._runtimeData),this._textures=t.textures,this._refreshInspector(),this.defaultAnimation&&(this.animation=this.defaultAnimation.toString()),this.defaultSkin&&""!==this.defaultSkin&&this.setSkin(this.defaultSkin),this._updateUseTint(),this._indexBoneSockets(),this._updateSocketBindings(),this.attachUtil.init(this),this._preCacheMode=this._cacheMode)},i.setSkeletonData=function(t){var e=this._skeletonCache;if(this._cacheMode===wat.SHARED_CACHE?this._skeletonCache=Kot.sharedCache:this._cacheMode===wat.PRIVATE_CACHE?(this._skeletonCache=new Kot,this._skeletonCache.enablePrivateMode()):this._skeletonCache=null,e!==this._skeletonCache&&this._destroySkeletonInfo(e),this.isAnimationCached()){(this.debugBones||this.debugSlots)&&F("Debug bones or slots is invalid in cached mode");var i=this._skeletonCache.getSkeletonInfo(this._skeletonData);this._skeletonInfo!==i&&(this._destroySkeletonInfo(this._skeletonCache),this._skeletonInfo=this._skeletonCache.createSkeletonInfo(this._skeletonData),this._skeleton=this._skeletonInfo.skeleton)}else this._skeleton=this._instance.initSkeleton(t),this._state=this._instance.getAnimationState(),this._instance.setPremultipliedAlpha(this._premultipliedAlpha);this._flushAssembler()},i.setSlotsRange=function(t,e){this.isAnimationCached()?F("Slots visible range can not be modified in cached mode."):(this._startSlotIndex=t,this._endSlotIndex=e)},i.getAttachment=function(t,e){return this._skeleton?this._skeleton.getAttachmentByName(t,e):null},i.setAttachment=function(t,e){this._skeleton&&this._skeleton.setAttachment(t,e),this.invalidAnimationCache()},i.getTextureAtlas=function(t){return t.region},i.setAnimation=function(t,e,i){if("string"!=typeof e)return X(7511),null;if(!this._skeleton.data.findAnimation(e))return X(7509,e),null;var n=null;if(void 0===i&&(i=!0),this._playTimes=i?0:1,this.isAnimationCached()){if(0!==t&&F("Track index can not greater than 0 in cached mode."),!this._skeletonCache)return null;var r,s=this._skeletonCache.getAnimationCache(this._skeletonData.uuid,e);s||null===(r=s=this._skeletonCache.initAnimationCache(this.skeletonData.uuid,this._skeletonData,e))||void 0===r||r.setSkin(this._skinName),s&&(this._animationName=e,this._isAniComplete=!1,this._accTime=0,this._playCount=0,this._animCache=s,this._socketNodes.size>0&&this._animCache.enableCacheAttachedInfo(),this._animCache.updateToFrame(0),this._curFrame=this._animCache.frames[0])}else this._animationName=e,n=this._instance.setAnimation(t,e,i);return this.markForUpdateRenderData(),n},i.addAnimation=function(t,e,i,n){if(n=n||0,this.isAnimationCached())return 0!==t&&F("Track index can not greater than 0 in cached mode."),this._animationQueue.push({animationName:e,loop:i,delay:n}),null;if(this._skeleton){var r,s=this._skeleton.data.findAnimation(e);return s?null===(r=this._state)||void 0===r?void 0:r.addAnimationWith(t,s,i,n):(X(7510,e),null)}return null},i.findAnimation=function(t){return this._skeleton?this._skeleton.data.findAnimation(t):null},i.getCurrent=function(t){if(this.isAnimationCached())F("'getCurrent' interface can not be invoked in cached mode.");else if(this._state)return this._state.getCurrent(t);return null},i.setSkin=function(t){this._skeleton&&this._skeleton.setSkinByName(t),this._instance.setSkin(t),this.isAnimationCached()&&this._animCache&&this._animCache.setSkin(t),this._skinName=t,this.invalidAnimationCache()},i.updateAnimation=function(t){if(this.markForUpdateRenderData(),!this.paused)if(this.isAnimationCached()){if(t*=1*this._timeScale,this._isAniComplete){var e;if(0===this._animationQueue.length&&!this._headAniInfo){var i=this._animCache;if(i&&i.isInvalid()){i.updateToFrame(0);var n=i.frames;this._curFrame=n[n.length-1]}return}if(this._headAniInfo||(this._headAniInfo=this._animationQueue.shift()),this._accTime+=t,this._accTime>(null===(e=this._headAniInfo)||void 0===e?void 0:e.delay)){var r=this._headAniInfo;this._headAniInfo=null,this.setAnimation(0,null==r?void 0:r.animationName,null==r?void 0:r.loop)}return}this._updateCache(t)}else this._instance.updateAnimation(t)},i._updateCache=function(t){var e=this._animCache;if(e.isInited()){var i=e.frames,n=Kot.FrameTime;0===this._accTime&&0===this._playCount&&(this._startEntry.animation.name=this._animationName,this._listener&&this._listener.start&&this._listener.start(this._startEntry)),this._accTime+=t;var r=Math.floor(this._accTime/n);if(e.isCompleted||e.updateToFrame(r),this._curFrame=i[r],void 0!==this._curFrame&&this.attachUtil.updateSkeletonBones(this._curFrame.boneInfos),e.isCompleted&&r>=i.length){if(this._playCount++,this._playTimes>0&&this._playCount>=this._playTimes)return this._curFrame=i[i.length-1],this._accTime=0,this._playCount=0,this._isAniComplete=!0,void this._emitCacheCompleteEvent();this._accTime=0,r=0,this._curFrame=i[r],this._emitCacheCompleteEvent()}}},i._emitCacheCompleteEvent=function(){this._listener&&(this._endEntry.animation.name=this._animationName,this._listener.complete&&this._listener.complete(this._endEntry),this._listener.end&&this._listener.end(this._endEntry))},i.updateRenderData=function(){return this.isAnimationCached()?this._curFrame?this._curFrame.model:null:this._instance.updateRenderData()},i._flushAssembler=function(){var t=e.Assembler.getAssembler(this);this._assembler!==t&&(this._assembler=t),this._skeleton&&this._assembler&&(this._renderData=this._assembler.createData(this),this.markForUpdateRenderData(),this._updateColor())},i._render=function(t){var e=0;if(this.renderData&&this._drawList.length>0){for(var i=this.renderData,n=i.chunk,r=n.vertexAccessor,s=i.getMeshBuffer(),o=s.indexOffset,a=0;a<this._drawList.length;a++){var h=this._drawList.data[a];h.texture&&t.commitMiddleware(this,s,o+h.indexOffset,h.indexCount,h.texture,h.material,this._enableBatch),e+=h.indexCount}var u=i.indices.subarray(0,e);r.appendIndices(n.bufferId,u),r.getMeshBuffer(n.bufferId).setDirty()}},i.requestDrawData=function(t,e,i,n){var r=this._drawList.add();if(r.material=t,e<1e4)r.texture=this._textures[e];else{var s,o=null===(s=this._slotTextures)||void 0===s?void 0:s.get(e);o&&(r.texture=o)}return r.indexOffset=i,r.indexCount=n,r},i._updateBuiltinMaterial=function(){return NE.get("default-spine-material")},i.updateMaterial=function(){var t;t=this._customMaterial?this._customMaterial:this._updateBuiltinMaterial(),this.setSharedMaterial(t,0),this._cleanMaterialCache()},i.getMaterialTemplate=function(){return null!==this.customMaterial?this.customMaterial:(this.material||this.updateMaterial(),this.material)},i._cleanMaterialCache=function(){for(var t in this._materialCache)this._materialCache[t].destroy();this._materialCache={}},i.getMaterialForBlendAndTint=function(t,e,i){var n=i+"/"+t+"/"+e,r=this._materialCache[n];if(r)return r;var s=this.getMaterialTemplate();r=new hS({parent:s,subModelIdx:0,owner:this}),this._materialCache[n]=r,r.overridePipelineStates({blendState:{blendColor:yn.WHITE,targets:[{blendEq:Ml.ADD,blendAlphaEq:Ml.ADD,blendSrc:t,blendDst:e,blendSrcAlpha:t,blendDstAlpha:e}]}});var o=!1;i===Dat.TWO_COLORED&&(o=!0);var a=!this._enableBatch;return r.recompileShaders({TWO_COLORED:o,USE_LOCAL:a}),r},i._updateAnimEnum=function(){var t;t=this.skeletonData?this.skeletonData.getAnimsEnum():xat,this._enumAnimations=ye({}),Object.assign(this._enumAnimations,t),ye.update(this._enumAnimations),li(this,"_animationIndex",this._enumAnimations)},i._updateSkinEnum=function(){var t;t=this.skeletonData?this.skeletonData.getSkinsEnum():Iat,this._enumSkins=ye({}),Object.assign(this._enumSkins,t),ye.update(this._enumSkins),li(this,"_defaultSkinIndex",this._enumSkins)},i._refreshInspector=function(){},i.destroyRenderData=function(){this._drawList.reset(),t.prototype.destroyRenderData.call(this)},i.createRenderEntity=function(){var t=new dN(QM.DYNAMIC);return t.setUseLocal(!0),t},i.markForUpdateRenderData=function(e){void 0===e&&(e=!0),t.prototype.markForUpdateRenderData.call(this,e),this._debugRenderer&&this._debugRenderer.markForUpdateRenderData(e)},i.syncAttachedNode=function(){this.attachUtil._syncAttachedNode()},i.isAnimationCached=function(){return this._cacheMode!==wat.REALTIME},i.setAnimationCacheMode=function(t){this._preCacheMode!==t&&(this._cacheMode=t,this._preCacheMode=t,this._instance&&(this._instance.isCache=this.isAnimationCached()),this._updateSkeletonData(),this.markForUpdateRenderData())},i.setToSetupPose=function(){this._skeleton&&this._skeleton.setToSetupPose()},i.setBonesToSetupPose=function(){this._skeleton&&this._skeleton.setBonesToSetupPose()},i.setSlotsToSetupPose=function(){this._skeleton&&this._skeleton.setSlotsToSetupPose()},i.invalidAnimationCache=function(){this.isAnimationCached()&&this._skeletonCache&&this._skeletonCache.invalidAnimationCache(this._skeletonData.uuid)},i.findBone=function(t){return this._skeleton?this._skeleton.findBone(t):null},i.findSlot=function(t){return this._skeleton?this._skeleton.findSlot(t):null},i.setMix=function(t,e,i){this.isAnimationCached()?F("cached mode not support setMix!!!"):this._state&&this._instance.setMix(t,e,i)},i.clearTracks=function(){this.isAnimationCached()?F("'clearTracks' interface can not be invoked in cached mode."):this._state&&(this._state.clearTracks(),this.setToSetupPose())},i.clearTrack=function(t){this.isAnimationCached()?F("'clearTrack' interface can not be invoked in cached mode."):this._state&&this._state.clearTrack(t)},i.updateWorldTransform=function(){this.isAnimationCached()&&this._skeleton&&this._skeleton.updateWorldTransform()},i._verifySockets=function(t){for(var e=0,i=t.length;e<i;e++){var n=t[e].target;!n||n.parent&&n.parent===this.node||k("Target node "+n.name+" is expected to be a direct child of "+this.node.name)}var r=new Map;t.forEach((function(t){t.target&&(r.get(t.target)?k("Target node "+t.target.name+" has existed."):r.set(t.target,!0))}))},i._updateSocketBindings=function(){if(this._skeleton){this._socketNodes.clear();for(var t=0,e=this._sockets.length;t<e;t++){var i=this._sockets[t];if(i.path&&i.target){var n=this._cachedSockets.get(i.path);if(!n){k("Skeleton data does not contain path "+i.path);continue}this._socketNodes.set(n,i.target)}}}},i._indexBoneSockets=function(){if(this._skeleton){this._cachedSockets.clear();for(var t=this._skeleton.bones,e=function e(i){return null==i.parent?i.data.name||"<Unamed>":e(t[i.parent.data.index])+"/"+i.data.name},i=0,n=t.length;i<n;i++){var r=t[i].data,s=e(t[i]);this._cachedSockets.set(s,r.index)}}},i.querySockets=function(){return this._skeleton?(0===this._cachedSockets.size&&this._indexBoneSockets(),this._cachedSockets.size>0?Array.from(this._cachedSockets.keys()).sort():[]):[]},i._updateUseTint=function(){this._cleanMaterialCache(),this.destroyRenderData(),this.isAnimationCached()||this._instance.setUseTint(this._useTint),this._assembler&&this._skeleton&&(this._renderData=this._assembler.createData(this),this.markForUpdateRenderData())},i._updateBatch=function(){this._cleanMaterialCache(),this.markForUpdateRenderData()},i._updateDebugDraw=function(){if(this.debugBones||this.debugSlots||this.debugMesh){if(!this._debugRenderer){var t=new Tm("DEBUG_DRAW_NODE");t.layer=this.node.layer,t.hideFlags|=qs.Flags.DontSave|qs.Flags.HideInHierarchy;var e=t.addComponent(EF);e.lineWidth=5,e.strokeColor=new yn(255,0,0,255),this._debugRenderer=e,t.parent=this.node,this.node.on(Dg.LAYER_CHANGED,this._applyLayer,this)}this.isAnimationCached()?F("Debug bones or slots is invalid in cached mode"):this._instance.setDebugMode(!0)}else this._debugRenderer&&(this.node.off(Dg.LAYER_CHANGED,this._applyLayer,this),this._debugRenderer.node.destroy(),this._debugRenderer=null,this.isAnimationCached()||this._instance&&this._instance.setDebugMode(!1))},i._updateUITransform=function(){var t=this.node._uiProps.uiTransformComp,e=this._runtimeData;if(!e)return t.setContentSize(100,100),t.anchorX=.5,void(t.anchorX=.5);var i=e.width,n=e.height;i&&n&&(t.setContentSize(i,n),0!==i&&(t.anchorX=Math.abs(e.x)/i),0!==n&&(t.anchorY=Math.abs(e.y)/n))},i._updateColor=function(){var t=this.node._uiProps.opacity;if(this._tempColor.r!==this._color.r||this._tempColor.g!==this._color.g||this._tempColor.b!==this._color.b||this._tempColor.a!==t){this.node._uiProps.colorDirty=!0,this._tempColor.r=this._color.r,this._tempColor.g=this._color.g,this._tempColor.b=this._color.b,this._tempColor.a=t;var e=this._color.r/255,i=this._color.g/255,n=this._color.b/255;this._instance.setColor(e,i,n,t)}},i.setVertexEffectDelegate=function(t){if(this._instance)if(t){var e=null==t?void 0:t.getEffectType();if("jitter"===e){var i=null==t?void 0:t.getJitterVertexEffect();this._instance.setJitterEffect(i)}else if("swirl"===e){var n=null==t?void 0:t.getJitterVertexEffect();this._instance.setSwirlEffect(n)}}else this._instance.clearEffect()},i._ensureListener=function(){this._listener||(this._listener=new Oot,this._eventListenerID=Oot.addListener(this._listener),this._instance.setListener(this._eventListenerID))},i.setStartListener=function(t){this._ensureListener(),this._listener.start=t},i.setInterruptListener=function(t){this._ensureListener(),this._listener.interrupt=t},i.setEndListener=function(t){this._ensureListener(),this._listener.end=t},i.setDisposeListener=function(t){this._ensureListener(),this._listener.dispose=t},i.setCompleteListener=function(t){this._ensureListener(),this._listener.complete=t},i.setEventListener=function(t){this._ensureListener(),this._listener.event=t},i.setTrackStartListener=function(t,e){Oot.getListeners(t,this._instance).start=e},i.setTrackInterruptListener=function(t,e){Oot.getListeners(t,this._instance).interrupt=e},i.setTrackEndListener=function(t,e){Oot.getListeners(t,this._instance).end=e},i.setTrackDisposeListener=function(t,e){Oot.getListeners(t,this._instance).dispose=e},i.setTrackCompleteListener=function(t,e){Oot.getListeners(t,this._instance).complete=function(t){var i=Math.floor(t.trackTime/t.animationEnd);e(t,i)}},i.setTrackEventListener=function(t,e){Oot.getListeners(t,this._instance).event=e},i.getDebugShapes=function(){return this._instance.getDebugShapes()},i.setSlotTexture=function(t,e,i){if(this.isAnimationCached())k("Cached mode can't change texture of slot");else if(this.findSlot(t)){var n=e.width,r=e.height,s=i||!1;this._instance.resizeSlotRegion(t,n,r,s),this._slotTextures||(this._slotTextures=new Map);var o=0;this._slotTextures.forEach((function(t,i){t===e&&(o=i)})),0===o&&(o=++Mat,this._slotTextures.set(o,e)),this._instance.setSlotTexture(t,o)}else k("No slot named:"+t)},i._destroySkeletonInfo=function(t){t&&this._skeletonInfo&&(t.destroySkeleton(this._skeletonInfo.assetUUID),this._skeletonInfo=null)},i._applyLayer=function(){this._debugRenderer&&(this._debugRenderer.node.layer=this.node.layer)},n(e,[{key:"drawList",get:function(){return this._drawList}},{key:"skeletonData",get:function(){return this._skeletonData},set:function(t){t&&t.resetEnums(),this._skeletonData!==t&&(this.destroyRenderData(),this._skeletonData=t,this.defaultSkin="",this.defaultAnimation="",this._animationName="",this._skinName="",this._updateSkeletonData(),this._updateUITransform())}},{key:"_defaultSkinIndex",get:function(){if(this.skeletonData){var t=this.skeletonData.getSkinsEnum();if(t)if(""===this.defaultSkin){if(t.hasOwnProperty(0))return this._defaultSkinIndex=0,0}else{var e=t[this.defaultSkin];if(void 0!==e)return e}}return 0},set:function(t){var e;if(this.skeletonData&&(e=this.skeletonData.getSkinsEnum()),e){var i=e[t];void 0!==i?(this.defaultSkin=String(i),this.setSkin(this.defaultSkin),this._refreshInspector(),this.markForUpdateRenderData()):k(this.name+" skin enums are invalid")}else k(this.name+" skin enums are invalid")}},{key:"_animationIndex",get:function(){var t=this.animation;if(this.skeletonData)if(t){var e=this.skeletonData.getAnimsEnum();if(e){var i=e[t];if(void 0!==i)return i}}else this._refreshInspector();return 0},set:function(t){var e;if(this.skeletonData&&(e=this.skeletonData.getAnimsEnum()),e){var i=String(e[t]);void 0!==i?(this.animation=i,this.animation=i):k(this.name+" animation enums are invalid")}else k(this.name+" animation enums are invalid")}},{key:"defaultCacheMode",get:function(){return this._cacheMode},set:function(t){this._cacheMode=t,this.setAnimationCacheMode(this._cacheMode)}},{key:"premultipliedAlpha",get:function(){return this._premultipliedAlpha},set:function(t){t!==this._premultipliedAlpha&&(this._premultipliedAlpha=t,this._instance.setPremultipliedAlpha(t),this.markForUpdateRenderData())}},{key:"timeScale",get:function(){return this._timeScale},set:function(t){t!==this._timeScale&&(this._timeScale=t,this._instance&&(this._instance.dtRate=1*this._timeScale))}},{key:"useTint",get:function(){return this._useTint},set:function(t){t!==this._useTint&&(this._useTint=t,this._updateUseTint())}},{key:"enableBatch",get:function(){return this._enableBatch},set:function(t){t!==this._enableBatch&&(this._enableBatch=t,this._updateBatch())}},{key:"sockets",get:function(){return this._sockets},set:function(t){this._sockets=t,this._updateSocketBindings(),this.attachUtil.init(this)}},{key:"debugSlots",get:function(){return this._debugSlots},set:function(t){t!==this._debugSlots&&(this._debugSlots=t,this._updateDebugDraw(),this.markForUpdateRenderData())}},{key:"debugBones",get:function(){return this._debugBones},set:function(t){t!==this._debugBones&&(this._debugBones=t,this._updateDebugDraw(),this.markForUpdateRenderData())}},{key:"debugMesh",get:function(){return this._debugMesh},set:function(t){t!==this._debugMesh&&(this._debugMesh=t,this._updateDebugDraw(),this.markForUpdateRenderData())}},{key:"socketNodes",get:function(){return this._socketNodes}},{key:"animation",get:function(){return this._animationName},set:function(t){t?this.setAnimation(0,t,this.loop):this.clearAnimation(0)}},{key:"customMaterial",get:function(){return this._customMaterial},set:function(t){this._customMaterial=t,this.updateMaterial(),this.markForUpdateRenderData()}}]),e}(WN)).SpineSocket=Nat,Rat.AnimationCacheMode=wat,_at=ua((lat=Rat).prototype,"_skeletonData",[wa],(function(){return null})),dat=ua(lat.prototype,"defaultSkin",[wa],(function(){return""})),fat=ua(lat.prototype,"defaultAnimation",[wa],(function(){return""})),pat=ua(lat.prototype,"_premultipliedAlpha",[wa],(function(){return!0})),gat=ua(lat.prototype,"_timeScale",[wa],(function(){return 1})),mat=ua(lat.prototype,"_preCacheMode",[wa],(function(){return wat.UNSET})),vat=ua(lat.prototype,"_cacheMode",[wa],(function(){return wat.REALTIME})),yat=ua(lat.prototype,"_sockets",[wa],(function(){return[]})),Tat=ua(lat.prototype,"_useTint",[wa],(function(){return!1})),Eat=ua(lat.prototype,"_debugMesh",[wa],(function(){return!1})),Sat=ua(lat.prototype,"_debugBones",[wa],(function(){return!1})),Aat=ua(lat.prototype,"_debugSlots",[wa],(function(){return!1})),bat=ua(lat.prototype,"_enableBatch",[wa],(function(){return!1})),f(lat.prototype,"skeletonData",[rat],Object.getOwnPropertyDescriptor(lat.prototype,"skeletonData"),lat.prototype),f(lat.prototype,"_defaultSkinIndex",[sat],Object.getOwnPropertyDescriptor(lat.prototype,"_defaultSkinIndex"),lat.prototype),f(lat.prototype,"_animationIndex",[oat],Object.getOwnPropertyDescriptor(lat.prototype,"_animationIndex"),lat.prototype),f(lat.prototype,"defaultCacheMode",[aat],Object.getOwnPropertyDescriptor(lat.prototype,"defaultCacheMode"),lat.prototype),Cat=ua(lat.prototype,"loop",[wa],(function(){return!0})),f(lat.prototype,"sockets",[hat],Object.getOwnPropertyDescriptor(lat.prototype,"sockets"),lat.prototype),f(lat.prototype,"customMaterial",[hh,uat],Object.getOwnPropertyDescriptor(lat.prototype,"customMaterial"),lat.prototype),cat=lat))||cat);m.internal.SpineSkeleton=Lat;var Bat,Fat,kat,Uat,Gat=function(){function t(){this.name="sp.VertexEffectDelegate",this._vertexEffect=void 0,this._interpolation=void 0,this._effectType=void 0,this._vertexEffect=null,this._interpolation=null,this._effectType="none"}var e=t.prototype;return e.clear=function(){this._vertexEffect=null,this._interpolation=null,this._effectType="none"},e.initJitter=function(t,e){return this._effectType="jitter",this._vertexEffect=new Aot.JitterEffect(t,e),this._vertexEffect},e.initSwirlWithPow=function(t,e){return this._effectType="swirl",this._interpolation=new Aot.Pow(e),this._vertexEffect=new Aot.SwirlEffect(t,this._interpolation),this._vertexEffect},e.initSwirlWithPowOut=function(t,e){return this._effectType="swirl",this._interpolation=new Aot.PowOut(e),this._vertexEffect=new Aot.SwirlEffect(t,this._interpolation),this._vertexEffect},e.getJitterVertexEffect=function(){return this._vertexEffect},e.getSwirlVertexEffect=function(){return this._vertexEffect},e.getVertexEffect=function(){return this._vertexEffect},e.getEffectType=function(){return this._effectType},t}(),Hat=new yn(0,0,255,255),zat=new yn(255,0,0,255),Vat=new yn(0,255,0,255),Wat=new yn(255,255,0,255),Xat=null,jat=null,Yat=!1,Kat=!1,qat=kM(NM),Qat=kM(BM),Zat=new _n(0,0,0);function Jat(t,e){var i,n;switch(t){case 1:i=Yat?Pl.ONE:Pl.SRC_ALPHA,n=Pl.ONE;break;case 2:i=Pl.DST_COLOR,n=Pl.ONE_MINUS_SRC_ALPHA;break;case 3:i=Pl.ONE,n=Pl.ONE_MINUS_SRC_COLOR;break;case 0:default:i=Yat?Pl.ONE:Pl.SRC_ALPHA,n=Pl.ONE_MINUS_SRC_ALPHA}return e.getMaterialForBlendAndTint(i,n,Kat?Dat.TWO_COLORED:Dat.COLORED_TEXTURED)}var $at={vCount:32767,ensureAccessor:function(t){var e=t?jat:Xat;if(!e){var i=DD.root.device,n=DD.root.batcher2D,r=t?BM:NM;t?(e=jat=new qM(i,r,this.vCount),n.registerBufferAccessor(Number.parseInt("SPINETINT",36),jat)):(e=Xat=new qM(i,r,this.vCount),n.registerBufferAccessor(Number.parseInt("SPINE",36),Xat))}return e},createData:function(t){var e=t.renderData;if(!e){var i=t.useTint||t.isAnimationCached(),n=this.ensureAccessor(i);e=gN.add(i?BM:NM,n)}return e},updateRenderData:function(t){var e;t._skeleton&&t.node.active&&null!==(e=t.skeletonData)&&void 0!==e&&e.isValid&&function(t){if(t.drawList.reset(),0!==t.color.a){t._updateColor(),Yat=t.premultipliedAlpha,Kat=t.useTint||t.isAnimationCached(),t.isAnimationCached()?function(t){var e=t.updateRenderData();if(e){var i=e.vCount,n=e.iCount;if(!(i<1||n<1)){var r=t.renderData;r.vertexCount===i&&r.indexCount===n||(r.resize(i,n),r.indices=new Uint16Array(n));var s=r.chunk.vb,o=new Uint8Array(s.buffer,s.byteOffset,Float32Array.BYTES_PER_ELEMENT*s.length);o.set(e.vData);var a=t.color,h=t.node._uiProps.opacity;if(1-h>xi||4294967295!==yn.toUint32(a)||Yat){Bat=a.r/255,Fat=a.g/255,kat=a.b/255,Uat=h;for(var u=0;u<i;u++){var c=u*Qat+5*Float32Array.BYTES_PER_ELEMENT,l=o[c],_=o[c+1],d=o[c+2],f=o[c+3]*Uat,p=Yat?f/255:1;o[c]=Math.floor(p*l*Bat),o[c+1]=Math.floor(p*_*Fat),o[c+2]=Math.floor(p*d*kat),o[c+3]=Math.floor(f),o[c+4]=Math.floor(o[c+4]*Bat),o[c+5]=Math.floor(o[c+5]*Fat),o[c+6]=Math.floor(o[c+6]*kat),o[c+7]=Yat?255:0}}var g=r.indices;g.set(e.iData);for(var m=r.chunk.vertexOffset,v=0;v<n;v++)g[v]+=m;for(var y=e.meshes,T=y.length,E=0,S=0,A=0;A<T;A++){var b=y[A],C=Jat(b.blendMode,t),R=b.textureID;S=b.iCount,t.requestDrawData(C,R,E,S),E+=S}var w=Qat/Float32Array.BYTES_PER_ELEMENT;if(t.enableBatch)for(var I=t.node.worldMatrix,x=0,D=0;D<i;D++)x=D*w,Zat.x=s[x],Zat.y=s[x+1],Zat.z=0,Zat.transformMat4(I),s[x]=Zat.x,s[x+1]=Zat.y,s[x+2]=Zat.z}}}(t):function(t){var e,i,n=(t.useTint?Qat:qat)/Float32Array.BYTES_PER_ELEMENT,r=t.updateRenderData(),s=r.vCount,o=r.iCount;if(!(s<1||o<1)){var a=t.renderData;a.vertexCount===s&&a.indexCount===o||(a.resize(s,o),a.indices=new Uint16Array(o),t._vLength=s*Float32Array.BYTES_PER_ELEMENT*n,t._vBuffer=new Uint8Array(a.chunk.vb.buffer,a.chunk.vb.byteOffset,Float32Array.BYTES_PER_ELEMENT*a.chunk.vb.length),t._iLength=Uint16Array.BYTES_PER_ELEMENT*o,t._iBuffer=new Uint8Array(a.indices.buffer));var h=a.chunk.vb,u=r.vPtr,c=r.iPtr,l=a.indices,_=Aot.wasmUtil.wasm.HEAPU8;null===(e=t._vBuffer)||void 0===e||e.set(_.subarray(u,u+t._vLength),0),null===(i=t._iBuffer)||void 0===i||i.set(_.subarray(c,c+t._iLength),0);for(var d=a.chunk.vertexOffset,f=0;f<o;f++)l[f]+=d;for(var p=r.getData(),g=p.size(),m=0,v=0,y=0;y<g;y+=6){v=p.get(y+3);var T=Jat(p.get(y+4),t),E=p.get(y+5);t.requestDrawData(T,E,m,v),m+=v}if(t.enableBatch)for(var S=t.node.worldMatrix,A=0,b=0;b<s;b++)A=b*n,Zat.x=h[A],Zat.y=h[A+1],Zat.z=0,Zat.transformMat4(S),h[A]=Zat.x,h[A+1]=Zat.y,h[A+2]=Zat.z;var C=t._debugRenderer,R=t._skeleton;if(C&&(t.debugBones||t.debugSlots||t.debugMesh)){C.clear();for(var w=t.getDebugShapes(),I=w.size(),x=0;x<I;x++){var D=w.get(x);if(0===D.type&&t.debugSlots){C.strokeColor=Hat;var O=D.vOffset*n,P=D.vCount*n;C.moveTo(h[O],h[O+1]);for(var M=O+n,N=O+P;M<N;M+=n)C.lineTo(h[M],h[M+1]);C.close(),C.stroke()}else if(1===D.type&&t.debugMesh){C.strokeColor=Wat;for(var L=D.iCount,B=D.iOffset,F=B,k=B+L;F<k;F+=3){var U=l[F]*n,G=l[F+1]*n,H=l[F+2]*n;C.moveTo(h[U],h[U+1]),C.lineTo(h[G],h[G+1]),C.lineTo(h[H],h[H+1]),C.close(),C.stroke()}}}if(t.debugBones){C.strokeColor=zat,C.fillColor=Hat;for(var z=0,V=R.bones.length;z<V;z++){var W=R.bones[z],X=W.data.length*W.a+W.worldX,j=W.data.length*W.c+W.worldY;C.moveTo(W.worldX,W.worldY),C.lineTo(X,j),C.stroke(),C.circle(W.worldX,W.worldY,1.5*Math.PI),C.fill(),0===z&&(C.fillColor=Vat)}}}}}(t);var e=t.renderData,i=Kat?jat:Xat;t.syncAttachedNode(),(e.vertexCount>0||e.indexCount>0)&&i.getMeshBuffer(e.chunk.bufferId).setDirty()}}(t)}};m.internal.SpineAssembler=$at;var tht,eht,iht={getAssembler:function(){return $at}};Lat.Assembler=iht,function(t){t[t.REGION=0]="REGION",t[t.BOUNDING_BOX=1]="BOUNDING_BOX",t[t.MESH=2]="MESH",t[t.SKINNED_MESH=3]="SKINNED_MESH"}(tht||(tht={})),Se(tht),function(t){t[t.START=0]="START",t[t.INTERRUPT=1]="INTERRUPT",t[t.END=2]="END",t[t.DISPOSE=3]="DISPOSE",t[t.COMPLETE=4]="COMPLETE",t[t.EVENT=5]="EVENT"}(eht||(eht={})),Se(eht),t("sp",Object.freeze({__proto__:null,spine:Aot,get ATTACHMENT_TYPE(){return tht},get AnimationEventType(){return eht},timeScale:1,get AnimationCacheMode(){return wat},get DefaultSkinsEnum(){return Iat},get DefaultAnimsEnum(){return xat},get SpineMaterialType(){return Dat},SpineSocket:Nat,Skeleton:Lat,SkeletonData:qot,VertexEffectDelegate:Gat,simpleSpineAssembler:iht}));var nht=new _n,rht=new _n;function sht(t,e){var i=null;return{value:e.length>0?e[e.length-1]:_n.ZERO,progress:function(t,e,n,r){return i.getPoint(r)},clone:function(t){return _n.clone(t)},add:function(t,e){return t.clone().add(e)},sub:function(t,e){return t.clone().subtract(e)},onStart:function(n){var r=n.start,s=n.end,o=n.relative,a=n.reversed;(i=Lc.create(t)).addKnot(r);var h=null;o&&a&&(h=rht,_n.subtract(h,r,e[e.length-1]));for(var u=0,c=e.length;u<c;++u){var l=a?e[c-1-u]:e[u];o?a?u>0&&i.addKnot(_n.copy(nht,h).add(l)):i.addKnot(_n.copy(nht,r).add(l)):i.addKnot(l)}o&&a&&i.addKnot(s)},onComplete:function(){i=null},onStop:function(){i=null},legacyProgress:!1}}t("tweenProgress",Object.freeze({__proto__:null,bezier:function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return sht(Cc.BEZIER,e)},catmullRom:function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return sht(Cc.CATMULL_ROM,e)}}));var oht=function(){function t(){this.originalTarget=null,this.target=null,this.workerTarget=null,this.tag=t.TAG_INVALID,this._id=void 0,this._paused=!1}var e=t.prototype;return e.isDone=function(){return!0},e.startWithTarget=function(t){this.originalTarget=t,this.target=t},e.stop=function(){this.target=null},e.getTarget=function(){return this.target},e.setTarget=function(t){this.target=t},e.getOriginalTarget=function(){return this.originalTarget},e.setOriginalTarget=function(t){this.originalTarget=t},e.getTag=function(){return this.tag},e.setTag=function(t){this.tag=t},e.setId=function(t){this._id=t},e.getId=function(){return this._id},e.setPaused=function(t){this._paused=t},t}();oht.TAG_INVALID=-1;var aht=function(t){function e(){var e;return(e=t.call(this)||this)._duration=0,e}s(e,t);var i=e.prototype;return i.getDurationScaled=function(){return this._duration},i.getDuration=function(){return this._duration},i.setDuration=function(t){this._duration=t},e}(oht),hht=function(){this.actions=[],this.target=null,this.actionIndex=0,this.currentAction=null,this.paused=!1,this.lock=!1},uht=function(){function t(){this._hashTargets=new Map,this._arrayTargets=[],this._currentTarget=void 0,this._elementPool=[]}var e=t.prototype;return e._getElement=function(t,e){var i=this._elementPool.pop();return i||(i=new hht),i.target=t,i.paused=!!e,i},e._putElement=function(t){t.actions.length=0,t.actionIndex=0,t.currentAction=null,t.paused=!1,t.target=null,t.lock=!1,this._elementPool.push(t)},e._onNodeActiveChanged=function(t,e){e?this.resumeTarget(t):this.pauseTarget(t)},e._onNodeDestroy=function(t){this._removeAllActionsFromTarget(t,!1)},e._registerNodeEvent=function(t){t.isValid&&(t.on(Dg.ACTIVE_CHANGED,this._onNodeActiveChanged,this),t.on(Dg.NODE_DESTROYED,this._onNodeDestroy,this))},e._unregisterNodeEvent=function(t){t.isValid&&(t.off(Dg.ACTIVE_CHANGED,this._onNodeActiveChanged,this),t.off(Dg.NODE_DESTROYED,this._onNodeDestroy,this))},e.addAction=function(t,e,i){if(t&&e){var n=this._hashTargets.get(e);n?n.actions||(n.actions=[]):(n=this._getElement(e,i),this._hashTargets.set(e,n),this._arrayTargets.push(n)),0===n.actions.length&&e instanceof Tm&&this._registerNodeEvent(e),n.target=e,n.actions.push(t),t.startWithTarget(e)}else Z(1e3)},e.removeAllActions=function(){for(var t=this._arrayTargets,e=0;e<t.length;e++){var i=t[e];i&&(i.target instanceof Tm&&this._unregisterNodeEvent(i.target),this._putElement(i))}this._arrayTargets.length=0,this._hashTargets=new Map},e.removeAllActionsFromTarget=function(t){this._removeAllActionsFromTarget(t,!0)},e._removeAllActionsFromTarget=function(t,e){if(null!=t){var i=this._hashTargets.get(t);i&&(e&&t instanceof Tm&&this._unregisterNodeEvent(t),i.actions.length=0,this._deleteHashElement(i))}},e.removeAction=function(t){if(null!=t){var e=t.getOriginalTarget(),i=this._hashTargets.get(e);if(i)for(var n=0;n<i.actions.length;n++)if(i.actions[n]===t){i.actions.splice(n,1),i.actionIndex>=n&&i.actionIndex--;break}}},e._removeActionByTag=function(t,e,i){for(var n=0,r=e.actions.length;n<r;++n){var s=e.actions[n];if(s&&s.getTag()===t){if(i&&s.getOriginalTarget()!==i)continue;this._removeActionAtIndex(n,e);break}}},e._removeAllActionsByTag=function(t,e,i){for(var n=e.actions.length-1;n>=0;--n){var r=e.actions[n];if(r&&r.getTag()===t){if(i&&r.getOriginalTarget()!==i)continue;this._removeActionAtIndex(n,e)}}},e.removeActionByTag=function(t,e){var i=this;t===oht.TAG_INVALID&&X(1002);var n=this._hashTargets;if(e){var r=n.get(e);r&&this._removeActionByTag(t,r,e)}else n.forEach((function(e){i._removeActionByTag(t,e)}))},e.removeAllActionsByTag=function(t,e){var i=this;t===oht.TAG_INVALID&&X(1002);var n=this._hashTargets;if(e){var r=n.get(e);r&&this._removeAllActionsByTag(t,r,e)}else n.forEach((function(e){i._removeAllActionsByTag(t,e)}))},e.getActionByTag=function(t,e){t===oht.TAG_INVALID&&X(1004);var i=this._hashTargets.get(e);if(i){if(null!=i.actions)for(var n=0;n<i.actions.length;++n){var r=i.actions[n];if(r&&r.getTag()===t)return r}X(1005,t)}return null},e.getNumberOfRunningActionsInTarget=function(t){var e=this._hashTargets.get(t);return e&&e.actions?e.actions.length:0},e.pauseTarget=function(t){var e=this._hashTargets.get(t);e&&(e.paused=!0)},e.resumeTarget=function(t){var e=this._hashTargets.get(t);e&&(e.paused=!1)},e.pauseAllRunningActions=function(){for(var t=[],e=this._arrayTargets,i=0;i<e.length;i++){var n=e[i];n&&!n.paused&&(n.paused=!0,n.target&&t.push(n.target))}return t},e.resumeTargets=function(t){if(t)for(var e=0;e<t.length;e++)t[e]&&this.resumeTarget(t[e])},e.pauseTargets=function(t){if(t)for(var e=0;e<t.length;e++)t[e]&&this.pauseTarget(t[e])},e.isActionRunning=function(t){var e=this._hashTargets.get(t.getOriginalTarget()),i=-1;return e&&(i=e.actions.indexOf(t)),-1!==i},e._removeActionAtIndex=function(t,e){e.actions.splice(t,1),e.actionIndex>=t&&e.actionIndex--,0===e.actions.length&&(e.target instanceof Tm&&this._unregisterNodeEvent(e.target),this._deleteHashElement(e))},e._deleteHashElement=function(t){var e=!1;if(t&&!t.lock&&this._hashTargets.get(t.target)){this._hashTargets.delete(t.target);for(var i=this._arrayTargets,n=0,r=i.length;n<r;n++)if(i[n]===t){i.splice(n,1);break}this._putElement(t),e=!0}return e},e.update=function(t){for(var e,i=this._arrayTargets,n=0;n<i.length;n++){this._currentTarget=i[n];var r=(e=this._currentTarget).target;if(!Qs(r)||r.isValid){if(!e.paused&&e.actions){for(e.lock=!0,e.actionIndex=0;e.actionIndex<e.actions.length;e.actionIndex++)if(e.currentAction=e.actions[e.actionIndex],e.currentAction){if(e.currentAction.step(t),e.currentAction&&e.currentAction.isDone()){e.currentAction.stop();var s=e.currentAction;e.currentAction=null,this.removeAction(s)}e.currentAction=null}e.lock=!1}0===e.actions.length&&(r instanceof Tm&&this._unregisterNodeEvent(r),this._deleteHashElement(e)&&n--)}else this.removeAllActionsFromTarget(r),n--}},t}(),cht=t("TweenSystem",function(t){function e(){var e;return(e=t.call(this)||this).actionMgr=new uht,e}return s(e,t),e.prototype.update=function(t){this.actionMgr.update(t)},n(e,[{key:"ActionManager",get:function(){return this.actionMgr}}]),e}(Yc));cht.ID="TWEEN",cht.instance=void 0,DD.on(ID.EVENT_INIT,(function(){var t=new cht;cht.instance=t,DD.registerSystem(cht.ID,t,Yc.Priority.MEDIUM)}));var lht=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.isDone=function(){return!0},i.step=function(){this.update(1)},i.update=function(){},i.reverse=function(){return this.clone()},i.isUnknownDuration=function(){return!1},e}(aht),_ht=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.update=function(){var t,e=null!==(t=this.workerTarget)&&void 0!==t?t:this.target;if(e)for(var i=e.getComponentsInChildren(VN),n=0;n<i.length;++n)i[n].enabled=!0},i.reverse=function(){return new dht},i.clone=function(){var t=new e;return t._id=this._id,t},e}(lht),dht=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.update=function(){var t,e=null!==(t=this.workerTarget)&&void 0!==t?t:this.target;if(e)for(var i=e.getComponentsInChildren(VN),n=0;n<i.length;++n)i[n].enabled=!1},i.reverse=function(){return new _ht},i.clone=function(){var t=new e;return t._id=this._id,t},e}(lht);!function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;i.update=function(){var t,e=null!==(t=this.workerTarget)&&void 0!==t?t:this.target;if(e)for(var i=e.getComponentsInChildren(VN),n=0;n<i.length;++n){var r=i[n];r.enabled=!r.enabled}},i.reverse=function(){return new e},i.clone=function(){var t=new e;return t._id=this._id,t}}(lht);var fht=function(t){function e(e){var i;return(i=t.call(this)||this)._isNeedCleanUp=!0,void 0!==e&&i.init(e),i}s(e,t);var i=e.prototype;return i.update=function(){var t,e=null!==(t=this.workerTarget)&&void 0!==t?t:this.target;e&&(e.removeFromParent(),this._isNeedCleanUp&&e.destroy())},i.init=function(t){return this._isNeedCleanUp=t,!0},i.reverse=function(){return new e(this._isNeedCleanUp)},i.clone=function(){var t=new e(this._isNeedCleanUp);return t._id=this._id,t},e}(lht);function pht(t){return new fht(t)}var ght=function(t){function e(e,i,n){var r;return(r=t.call(this)||this)._callbackThis=void 0,r._callback=void 0,r._data=void 0,r.initWithFunction(e,i,n),r}s(e,t);var i=e.prototype;return i.initWithFunction=function(t,e,i){return t&&(this._callback=t),e&&(this._callbackThis=e),void 0!==i&&(this._data=i),!0},i.execute=function(){if(this._callback){var t,e=null!==(t=this.workerTarget)&&void 0!==t?t:this.target;this._callback.call(this._callbackThis,e,this._data)}},i.update=function(){this.execute()},i.getTargetCallback=function(){return this._callbackThis},i.setTargetCallback=function(t){t!==this._callbackThis&&(this._callbackThis=t)},i.clone=function(){var t=new e;return t._id=this._id,this._callback&&t.initWithFunction(this._callback,this._callbackThis,this._data),t},e}(lht),mht=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.clone=function(){return new e},i.reverse=function(){return this.clone()},i.update=function(){},i.step=function(){},i.isUnknownDuration=function(){return!1},e}(aht),vht=function(t){function e(e){var i;return(i=t.call(this)||this).MAX_VALUE=2,i._elapsed=0,i._startTime=0,i._firstTick=!1,i._speed=1,void 0===e||Number.isNaN(e)||i.initWithDuration(e),i}s(e,t);var i=e.prototype;return i.setStartTime=function(t){t=t<0?0:t>this._duration?this._duration:t,this._startTime=t},i.getElapsed=function(){return this._elapsed},i.initWithDuration=function(t){return this._duration=0===t?Ie.FLT_EPSILON:t,this._elapsed=0,this._firstTick=!0,!0},i.isDone=function(){return this._elapsed>=this._duration},i._cloneDecoration=function(t){t._speed=this._speed},i.step=function(t){if(!this._paused&&0!==this._speed){t*=this._speed,this._firstTick?this._elapsed=this._startTime:this._elapsed+=t;var e=this._elapsed/(this._duration>1.192092896e-7?this._duration:1.192092896e-7);e=e<1?e:1,this.update(e>0?e:0),this.isUnknownDuration()&&!this._firstTick&&(this._elapsed-=t),this._firstTick&&(this._firstTick=!1,this._startTime>0&&(this._startTime=0))}},i.startWithTarget=function(e){t.prototype.startWithTarget.call(this,e),this._elapsed=0,this._firstTick=!0},i.getSpeed=function(){return this._speed},i.setSpeed=function(t){this._speed=t},i.getDurationScaled=function(){return this._duration/this._speed},e}(aht),yht=function(t){function e(i){var n;if((n=t.call(this)||this)._actions=[],n._split=0,n._last=0,n._reversed=!1,!i||0===i.length)return l(n);1===i.length&&i.push(new mht);var r=i.length-1;if(r>=0&&null==i[r]&&X(1015),r>=0){for(var s,o=i[0],a=1;a<r;a++)i[a]&&(s=o,o=e._actionOneTwo(s,i[a]));n.initWithTwoActions(o,i[r])}return n}s(e,t),e._actionOneTwo=function(t,i){var n=new e;return n.initWithTwoActions(t,i),n};var i=e.prototype;return i.initWithTwoActions=function(t,e){if(!t||!e)return Z(1025),!1;var i=t.getDurationScaled()+e.getDurationScaled();return this.initWithDuration(i),this._actions[0]=t,this._actions[1]=e,!0},i.clone=function(){var t=new e;return t._id=this._id,t._speed=this._speed,this._cloneDecoration(t),t.initWithTwoActions(this._actions[0].clone(),this._actions[1].clone()),t},i.startWithTarget=function(e){t.prototype.startWithTarget.call(this,e),0!==this._actions.length&&(this._split=this._actions[0].getDurationScaled()/this._duration,this._last=-1)},i.stop=function(){0!==this._actions.length&&(-1!==this._last&&this._actions[this._last].stop(),t.prototype.stop.call(this))},i.update=function(t){var e=this._actions;if(0!==e.length){var i=0,n=0,r=this._split,s=this._last;if(t<r){if(i=0!==r?t/r:1,0===n&&1===s&&this._reversed){var o=e[1];if(o.update(0),o.isUnknownDuration())return;o.stop()}}else{var a=e[0];if(n=1,i=1===r?1:(t-r)/(1-r),-1===s){if(a.startWithTarget(this.target),a.update(1),a.isUnknownDuration())return;a.stop()}if(0===s){if(a.update(1),a.isUnknownDuration())return;a.stop()}}var h=e[n];s===n&&h.isDone()||(s!==n&&h.startWithTarget(this.target),h.update(i>1?i%1:i),this._last=n)}},i.reverse=function(){var t=e._actionOneTwo(this._actions[1].reverse(),this._actions[0].reverse());return this._cloneDecoration(t),t._reversed=!0,t},i.updateWorkerTarget=function(t){if(!(this._actions.length<2)){this._actions[1].workerTarget=t;var i=this._actions[0];i instanceof e||i instanceof bht?i.updateWorkerTarget(t):i.workerTarget=t}},i.findAction=function(t){for(var i=0,n=this._actions.length;i<n;++i){var r=this._actions[i];if(r.getId()===t)return r;if((r instanceof e||r instanceof bht)&&(r=r.findAction(t))&&r.getId()===t)return r}return null},i.isUnknownDuration=function(){if(0===this._actions.length)return!1;var t=this._actions[0],e=this._actions[1];return this._last<1?t.isUnknownDuration():e.isUnknownDuration()},e}(vht);function Tht(t){return new yht(t)}var Eht=function(t){function e(e,i){var n;return(n=t.call(this)||this)._times=0,n._total=0,n._nextDt=0,n._actionInstant=!1,n._innerAction=null,n.initWithAction(e,i),n}s(e,t);var i=e.prototype;return i.initWithAction=function(t,e){if(!t||void 0===e)return!1;var i=t.getDurationScaled()*e;return!!this.initWithDuration(i)&&(this._times=e,this._innerAction=t,t instanceof lht&&(this._actionInstant=!0,this._times-=1),this._total=0,!0)},i.clone=function(){var t=new e;return t._id=this._id,t._speed=this._speed,this._cloneDecoration(t),this._innerAction&&t.initWithAction(this._innerAction.clone(),this._times),t},i.startWithTarget=function(e){this._total=0,this._nextDt=(this._innerAction?this._innerAction.getDurationScaled():0)/this._duration,t.prototype.startWithTarget.call(this,e),this._innerAction&&this._innerAction.startWithTarget(e)},i.stop=function(){this._innerAction&&this._innerAction.stop(),t.prototype.stop.call(this)},i.update=function(t){var e=this._innerAction,i=this._duration,n=this._times,r=this._nextDt;if(e)if(t>=r){for(;t>r&&this._total<n;){if(e.update(1),e.isUnknownDuration())return;this._total++,e.stop(),e.startWithTarget(this.target),r+=e.getDurationScaled()/i,this._nextDt=r>1?1:r}if(t>=1&&this._total<n){if(e.update(1),e.isUnknownDuration())return;this._total++}this._actionInstant||(this._total===n?e.stop():e.update(t-(r-e.getDurationScaled()/i)))}else e.update(t*n%1)},i.isDone=function(){return this._total===this._times},i.reverse=function(){var t=new e(this._innerAction?this._innerAction.reverse():void 0,this._times);return this._cloneDecoration(t),t},i.setInnerAction=function(t){this._innerAction!==t&&(this._innerAction=t)},i.getInnerAction=function(){return this._innerAction},i.isUnknownDuration=function(){return!!this._innerAction&&this._innerAction.isUnknownDuration()},e}(vht);function Sht(t,e){return new Eht(t,e)}var Aht=function(t){function e(e){var i;return(i=t.call(this)||this)._innerAction=null,e&&i.initWithAction(e),i}s(e,t);var i=e.prototype;return i.initWithAction=function(t){return t?(this._innerAction=t,this._duration=1/0,!0):(Z(1026),!1)},i.clone=function(){var t=new e;return t._id=this._id,t._speed=this._speed,this._cloneDecoration(t),this._innerAction&&t.initWithAction(this._innerAction.clone()),t},i.startWithTarget=function(e){t.prototype.startWithTarget.call(this,e),this._innerAction&&this._innerAction.startWithTarget(e)},i.stop=function(){this._innerAction&&this._innerAction.stop(),t.prototype.stop.call(this)},i.step=function(t){if(!this._paused&&0!==this._speed){var e=this._innerAction;e&&(t*=this._speed,e.step(t),e.isDone()&&(e.startWithTarget(this.target),e.step(e.getElapsed()-e.getDurationScaled())))}},i.update=function(){X(1007)},i.isDone=function(){return!1},i.reverse=function(){if(this._innerAction){var t=new e(this._innerAction.reverse());return this._cloneDecoration(t),t}return this},i.setInnerAction=function(t){this._innerAction!==t&&(this._innerAction=t)},i.getInnerAction=function(){return this._innerAction},i.isUnknownDuration=function(){return!!this._innerAction&&this._innerAction.isUnknownDuration()},e}(vht),bht=function(t){function e(i){var n;if((n=t.call(this)||this)._one=null,n._two=null,n._finished=!1,!i||0===i.length)return l(n);1===i.length&&i.push(new mht);var r=i.length-1;if(r>=0&&null==i[r]&&X(1015),r>=0){for(var s,o=i[0],a=1;a<r;a++)i[a]&&(s=o,o=e._actionOneTwo(s,i[a]));n.initWithTwoActions(o,i[r])}return n}s(e,t),e._actionOneTwo=function(t,i){var n=new e;return n.initWithTwoActions(t,i),n};var i=e.prototype;return i.initWithTwoActions=function(t,e){if(!t||!e)return Z(1027),!1;var i=!1,n=t.getDurationScaled(),r=e.getDurationScaled();return this.initWithDuration(Math.max(n,r))&&(this._one=t,this._two=e,n>r?this._two=yht._actionOneTwo(e,Rht(n-r)):n<r&&(this._one=yht._actionOneTwo(t,Rht(r-n))),i=!0),i},i.clone=function(){var t=new e;return t._id=this._id,t._speed=this._speed,this._cloneDecoration(t),this._one&&this._two&&t.initWithTwoActions(this._one.clone(),this._two.clone()),t},i.startWithTarget=function(e){t.prototype.startWithTarget.call(this,e),this._one&&this._one.startWithTarget(e),this._two&&this._two.startWithTarget(e)},i.stop=function(){this._one&&this._one.stop(),this._two&&this._two.stop(),t.prototype.stop.call(this)},i.update=function(t){this._one&&(this._finished&&!this._one.isUnknownDuration()||this._one.update(t)),this._two&&(this._finished&&!this._two.isUnknownDuration()||this._two.update(t)),this._finished=1===t},i.reverse=function(){if(this._one&&this._two){var t=e._actionOneTwo(this._one.reverse(),this._two.reverse());return this._cloneDecoration(t),t}return this},i.updateWorkerTarget=function(t){if(this._one&&this._two){this._two.workerTarget=t;var i=this._one;i instanceof e||i instanceof yht?i.updateWorkerTarget(t):i.workerTarget=t}},i.findAction=function(t){var i=this._one,n=this._two,r=null,s=function(i){if(i.getId()===t)return i;if(i instanceof yht||i instanceof e){var n=i.findAction(t);if(n)return n}return null};return i&&(r=s(i))||n&&(r=s(n))?r:null},i.isUnknownDuration=function(){var t=this._one,e=this._two;if(null==t||null==e)return!1;var i=t.isUnknownDuration(),n=e.isUnknownDuration();if(i||n){if(i&&n)return!0;if(this._finished)return!0}return!1},e}(vht),Cht=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.update=function(){},i.reverse=function(){var t=new e(this._duration);return this._cloneDecoration(t),t},i.clone=function(){var t=new e;return t._id=this._id,t._speed=this._speed,this._cloneDecoration(t),t.initWithDuration(this._duration),t},i.isUnknownDuration=function(){return!1},e}(vht);function Rht(t){return new Cht(t)}var wht,Iht,xht,Dht,Oht,Pht,Mht,Nht,Lht,Bht,Fht,kht,Uht,Ght,Hht,zht,Vht,Wht,Xht,jht,Yht,Kht,qht,Qht,Zht,Jht,$ht,tut,eut,iut,nut,rut=function(t){function e(e){var i;return(i=t.call(this)||this)._other=null,e&&i.initWithAction(e),i}s(e,t);var i=e.prototype;return i.initWithAction=function(e){return e?e===this._other?(Z(1029),!1):!!t.prototype.initWithDuration.call(this,e.getDurationScaled())&&(this._other=e,!0):(Z(1028),!1)},i.clone=function(){var t=new e;return t._id=this._id,t._speed=this._speed,this._cloneDecoration(t),this._other&&t.initWithAction(this._other.clone()),t},i.startWithTarget=function(e){t.prototype.startWithTarget.call(this,e),this._other&&this._other.startWithTarget(e)},i.update=function(t){this._other&&this._other.update(1-t)},i.reverse=function(){return this._other?this._other.clone():this},i.stop=function(){this._other&&this._other.stop(),t.prototype.stop.call(this)},i.isUnknownDuration=function(){return!1},e}(vht),sut=function(t){function e(e,i,n){var r;return(r=t.call(this,e)||this)._cb=i,r._args=n,r}s(e,t);var i=e.prototype;return i.clone=function(){return new e(this._duration,this._cb,this._args)},i.update=function(t){this._cb.apply(this,[this.target,t].concat(this._args))},i.reverse=function(){return this.clone()},i.isUnknownDuration=function(){return!1},e}(vht),out=function(t){function e(e,i){var n;return(n=t.call(this)||this)._finished=!1,n._cb=e,n._args=i,n}s(e,t);var i=e.prototype;return i.clone=function(){return new e(this._cb,this._args)},i.reverse=function(){return this.clone()},i.step=function(){throw new Error("should never go here")},i.update=function(){var t=m.game.deltaTime;this._finished=this._cb.apply(this,[this.target,t].concat(this._args))},i.isDone=function(){return this._finished},i.isUnknownDuration=function(){return!this.isDone()},e}(aht),aut=t("TweenAction",function(t){function e(e,i,n){var r;if((r=t.call(this)||this)._reversed=!1,null==n)n=Object.create(null);else if(function(t){var e=" [Tween:] ",i=" option is not support in v + "+v,n=t;n.delay&&F(e+"delay"+i),n.repeat&&F(e+"repeat"+i),n.repeatDelay&&F(e+"repeatDelay"+i),n.interpolation&&F(e+"interpolation"+i),n.onStop&&F(e+"onStop"+i)}(n),n.easing&&"string"==typeof n.easing&&(n.easing=function(t){var e=t.charAt(0);if(/[A-Z]/.test(e)){var i=(t=t.replace(e,e.toLowerCase())).split("-");if(2===i.length){var n=i[0];if("linear"===n)t="linear";else{var r=i[1];switch(n){case"quadratic":t="quad"+r;break;case"quartic":t="quart"+r;break;case"quintic":t="quint"+r;break;case"sinusoidal":t="sine"+r;break;case"exponential":t="expo"+r;break;case"circular":t="circ"+r;break;default:t=n+r}}}}return t}(n.easing)),n.progress||(n.progress=r.progress),n.easing&&"string"==typeof n.easing){var s=n.easing;n.easing=cu[s],n.easing||q(1031,s)}for(var o in r._opts=n,r._props=Object.create(null),i){var a;if(i.hasOwnProperty(o)){var h=i[o];if("function"==typeof h)h=h();else if(null==h)continue;var u=void 0,c=void 0,l=void 0;void 0!==h.value?("function"==typeof(l=h.value)&&(l=l()),void 0!==h.easing&&("string"==typeof h.easing?(u=cu[h.easing])||q(1031,h.easing):u=h.easing),void 0!==h.progress&&(c=h.progress)):l=h;var _=Object.create(null);_.start=_.current=_.end=null,_.keys=null,_.value=l,_.easing=u,_.progress=c,_.convert=h.convert,_.clone=h.clone,_.add=h.add,_.sub=h.sub,_.legacyProgress=null===(a=h.legacyProgress)||void 0===a||a,_.toFixed=h.toFixed,_.onStart=h.onStart,_.onStop=h.onStop,_.onComplete=h.onComplete,_.valid=!0,r._props[o]=_}}return r._originProps=i,r.initWithDuration(e),r}s(e,t);var i=e.prototype;return i.clone=function(){var t=new e(this._duration,this._originProps,this._opts);return t._reversed=this._reversed,t.workerTarget=this.workerTarget,t._id=this._id,this._cloneDecoration(t),t},i.reverse=function(){if(!this._opts.relative)return q(16382),new e(0,{});var t=new e(this._duration,this._originProps,this._opts);return this._cloneDecoration(t),t._reversed=!this._reversed,t.workerTarget=this.workerTarget,t},i.startWithTarget=function(e){var i;t.prototype.startWithTarget.call(this,e);var n=null!==(i=this.workerTarget)&&void 0!==i?i:this.target;if(n){var r=!!this._opts.relative,s=this._props,o=this._reversed,a=function(){var t=n[h];if(void 0===t)return 0;var e=s[h],i=e.value;if("number"==typeof t)e.start=t,e.current=t,e.end=r?o?t-i:t+i:i;else if("object"==typeof t)if(e.legacyProgress){if(null==e.start){var a=t.constructor;e.start=new a,e.current=new a,e.end=new a}var u;u=i.getModifiableProperties?i.getModifiableProperties():Object.keys(i),e.keys=u;for(var c=0,l=u.length;c<l;++c){var _=u[c];isNaN(t[_])||(e.start[_]=t[_],e.current[_]=t[_],e.end[_]=r?o?t[_]-i[_]:t[_]+i[_]:i[_])}}else{var d=e.clone;if(!d)return q(16383,h),e.valid=!1,0;var f=e.add,p=e.sub;if(r&&(f||(q(16384,h),e.valid=!1),o&&!p&&(q(16385,h),e.valid=!1),!e.valid))return 0;e.start=d(t),e.current=d(t),e.end=r?o?p(t,i):f(t,i):d(i)}else if("string"==typeof t){var g=e.convert,m=function(t){if("number"==typeof t)return t;var e=t;return g&&(e=g(t)),"number"!=typeof e&&(e=Number(e),Number.isNaN(e))?(q(16386,""+t),null):e},v=m(i),y=m(t);if(null==v||null==y)return e.valid=!1,0;e.start=y,e.current=t,e.end=r?o?y-v:y+v:v}e.onStart&&e.onStart({relative:r,reversed:o,start:e.start,end:e.end})};for(var h in s)a();this._opts.onStart&&this._opts.onStart(n)}},i.stop=function(){var e=this._props;for(var i in e){var n=e[i];n.valid&&n.onStop&&n.onStop()}t.prototype.stop.call(this)},i.update=function(t){var e,i=null!==(e=this.workerTarget)&&void 0!==e?e:this.target;if(i&&this._opts){var n=this._props,r=this._opts,s=t;"function"==typeof r.easing&&(s=r.easing(t));var o=r.progress;for(var a in n){var h=n[a];if(h.valid){var u=h.easing?h.easing(t):s,c=h.progress?h.progress:o,l=h.start,_=h.end,d=h.current;if("number"==typeof d)h.current=c(l,_,h.current,u);else if("object"==typeof l)if(h.legacyProgress)for(var f=h.keys,p=0,g=f.length;p<g;++p){var m=f[p];h.current[m]=c(l[m],_[m],h.current[m],u)}else h.current=c(l,_,h.current,u);else if("string"==typeof d){var v,y=c(l,_,h.current,u);if("number"==typeof y)y=y.toFixed(null!==(v=h.toFixed)&&void 0!==v?v:0);else if("string"!=typeof y){q(16387);continue}h.current=y}i[a]=h.current,1===t&&h.onComplete&&h.onComplete()}}r.onUpdate&&r.onUpdate(i,t),1===t&&r.onComplete&&r.onComplete(i)}},i.progress=function(t,e,i,n){return t+(e-t)*n},i.isUnknownDuration=function(){return!1},n(e,[{key:"relative",get:function(){return!!this._opts.relative}}]),e}(vht)),hut=function(t){function e(e){var i;return(i=t.call(this)||this)._props=void 0,i._props={},e&&i.init(e),i}s(e,t);var i=e.prototype;return i.init=function(t){for(var e in t)this._props[e]=t[e];return!0},i.update=function(){var t=this._props,e=this.target;for(var i in t)e[i]=t[i]},i.clone=function(){var t=new e;return t._id=this._id,t.init(this._props),t},i.isUnknownDuration=function(){return!1},e}(lht),uut=t("Tween",function(){function t(t){this._actions=[],this._finalAction=null,this._target=null,this._tag=oht.TAG_INVALID,this._timeScale=1,this._target=void 0===t?null:t}var e=t.prototype;return e.tag=function(t){return this._tag=t,this},e.id=function(t){function e(e){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}((function(t){return this._actions.length>0&&this._actions[this._actions.length-1].setId(t),this})),e.then=function(t){var e=t._union(!0);return e&&(e.setSpeed(t._timeScale),this._actions.push(e)),this},e.reverse=function(e,i){if(null==e&&null==i)return this.reverseTween();var n,r;if(e instanceof t?(n=e,void 0!==i&&(r=i)):"number"==typeof e&&(n=this,r=e),n){var s=t.reverseAction(n,r);s&&this._actions.push(s)}return this},e.reverseTween=function(){if(0===this._actions.length)return q(16388),this.clone(this._target);var t=this._union(!1),e=cut(this._target);return e._timeScale=this._timeScale,t&&e.insertAction(t.reverse()),e},t.reverseAction=function(t,e){var i=t._actions;if(0===i.length)return null;var n=null,r=null;return"number"==typeof e?n=t.findAction(e,i):t&&(n=t._union(!1)),n?(r=n.reverse()).workerTarget=t._target:q(16391,""+e),r},e.findAction=function(t,e){for(var i=null,n=0,r=e.length;n<r;++n){if((i=e[n]).getId()===t)return i;if((i instanceof yht||i instanceof bht)&&(i=i.findAction(t)))return i}return null},e.insertAction=function(t){var e=t.clone();return this.updateWorkerTargetForAction(e),this._actions.push(e),this},e.updateWorkerTargetForAction=function(t){t&&(t instanceof yht||t instanceof bht?t.updateWorkerTarget(this._target):t.workerTarget=this._target)},e.target=function(t){function e(e){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}((function(t){this._target=t;for(var e=0,i=this._actions.length;e<i;++e){var n=this._actions[e];this.updateWorkerTargetForAction(n)}return this})),e.getTarget=function(){return this._target},e.start=function(t){if(void 0===t&&(t=0),!this._target)return q(16392),this;this._finalAction&&cht.instance.ActionManager.removeAction(this._finalAction);var e=this._unionForStart();return this._finalAction=e,e?(e.setTag(this._tag),e.setSpeed(this._timeScale),e.setStartTime(t),e.setPaused(!1),cht.instance.ActionManager.addAction(e,this._target,!1)):q(16393),this},e.stop=function(){return this._finalAction&&(this._finalAction.stop(),cht.instance.ActionManager.removeAction(this._finalAction),this._finalAction=null),this},e.pause=function(){return this._finalAction?this._finalAction.setPaused(!0):q(16389),this},e.resume=function(){return this._finalAction?this._finalAction.setPaused(!1):q(16390),this},e.clone=function(t){var e=this._union(!1),i=cut(null!=t?t:this._target);return i._timeScale=this._timeScale,e?i.insertAction(e):i},e.union=function(t){var e,i=this;if(void 0===t)return e=i._union(!1),i._actions.length=0,e&&i._actions.push(e),this;var n=this._actions,r=n.findIndex((function(e){return e.getId()===t}));if(n.length>1){var s=n.splice(r);1===s.length?n.push(s[0]):n.push(Tht(s))}return this},e.to=function(t,e,i){var n=i||Object.create(null);n.relative=!1;var r=new aut(t,e,n);return this._actions.push(r),this},e.by=function(t,e,i){var n=i||Object.create(null);n.relative=!0;var r=new aut(t,e,n);return this._actions.push(r),this},e.update=function(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];var s=new sut(t,e,n);return this._actions.push(s),this},e.updateUntil=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];var r=new out(t,i);return this._actions.push(r),this},e.set=function(t){var e=new hut(t);return this._actions.push(e),this},e.delay=function(t){var e=Rht(t);return this._actions.push(e),this},e.call=function(t,e,i){var n=function(t,e,i){return new ght(t,e,i)}(t,e,i);return this._actions.push(n),this},e.sequence=function(){for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];var r=t._wrappedSequence(i);return r&&this._actions.push(r),this},e.parallel=function(){for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];var r=t._wrappedParallel(i);return r&&this._actions.push(r),this},e.timeScale=function(t){return this._timeScale=t,this._finalAction&&this._finalAction.setSpeed(t),this},e.getTimeScale=function(){return this._timeScale},e.repeat=function(e,i){if(e===1/0)return this.repeatForever(i);var n,r=this._actions;return(n=i instanceof t?i._union(!1):r.pop())&&r.push(Sht(n,e)),this},e.repeatForever=function(e){var i,n=this._actions;return(i=e instanceof t?e._union(!1):n.pop())&&0!==n.length?n.push(Sht(i,Number.MAX_SAFE_INTEGER)):i instanceof vht?n.push(function(t){return new Aht(t)}(i)):q(16394),this},e.reverseTime=function(e){var i,n=this._actions;return(i=e instanceof t?e._union(!1):n.pop())instanceof vht?n.push(function(t){return new rut(t)}(i)):q(16395),this},e.hide=function(){if(this._target instanceof Tm){var t=new dht;this._actions.push(t)}return this},e.show=function(){if(this._target instanceof Tm){var t=new _ht;this._actions.push(t)}return this},e.removeSelf=function(){if(this._target instanceof Tm){var t=pht(!1);this._actions.push(t)}return this},e.destroySelf=function(){if(this._target instanceof Tm){var t=pht(!0);this._actions.push(t)}return this},t.getRunningCount=function(t){return cht.instance.ActionManager.getNumberOfRunningActionsInTarget(t)},t.stopAll=function(){cht.instance.ActionManager.removeAllActions()},t.stopAllByTag=function(t,e){cht.instance.ActionManager.removeAllActionsByTag(t,e)},t.stopAllByTarget=function(t){cht.instance.ActionManager.removeAllActionsFromTarget(t)},t.pauseAllByTarget=function(t){cht.instance.ActionManager.pauseTarget(t)},t.resumeAllByTarget=function(t){cht.instance.ActionManager.resumeTarget(t)},e._union=function(t){var e=this._actions;if(0===e.length)return null;var i=Tht(e);return t&&this.updateWorkerTargetForAction(i),i},e._unionForStart=function(){var t=this._actions;return 0===t.length?null:1===t.length&&t[0]instanceof Aht?t[0]:Tht(t)},t._tweenToActions=function(e){var i=t._tmp_args;i.length=0;for(var n=e.length,r=0;r<n;r++){var s=e[r],o=s._union(!0);o&&(o.setSpeed(s._timeScale),i.push(o))}},t._wrappedSequence=function(e){return t._tweenToActions(e),Tht(t._tmp_args)},t._wrappedParallel=function(e){return t._tweenToActions(e),i=t._tmp_args,new bht(i);var i},n(t,[{key:"running",get:function(){return!!this._finalAction&&cht.instance.ActionManager.isActionRunning(this._finalAction)}},{key:"duration",get:function(){return this._finalAction?this._finalAction.getDuration():0}}]),t}());function cut(t){return new uut(t)}function lut(t){return q(16396),new uut(t)}uut._tmp_args=[],m.Tween=uut,m.tween=cut,m.tweenUtil=lut,function(t){t[t.Other=0]="Other",t[t.Left=1]="Left",t[t.Right=2]="Right"}(wht||(wht={})),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"}(Iht||(Iht={})),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"}(xht||(xht={})),s((function(){for(var t,e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return(t=nut.call.apply(nut,[this].concat(i))||this).deviceType=wht.Other,t.hitPoint=new _n,t}),nut=QR);var _ut,dut,fut,put=new yn;!function(t){t[t.NONE=0]="NONE",t[t.COLOR=1]="COLOR",t[t.SPRITE=2]="SPRITE",t[t.SCALE=3]="SCALE"}(_ut||(_ut={})),Se(_ut),function(t){t[t.NORMAL=0]="NORMAL",t[t.HOVER=1]="HOVER",t[t.PRESSED=2]="PRESSED",t[t.DISABLED=3]="DISABLED"}(dut||(dut={})),function(t){t.CLICK="click"}(fut||(fut={}));var gut=(Dht=va("cc.Button"),Oht=Ta(110),Pht=ya(RN),Mht=Za(Tm),Nht=Za(_ut),Lht=Za(TP),Bht=Za(TP),Fht=Za(TP),kht=Za(TP),Uht=Za([Rp]),Dht(Ght=Oht(Ght=Pht(((iut=function(t){function e(){var e;return(e=t.call(this)||this).clickEvents=zht&&zht(),e._interactable=Vht&&Vht(),e._transition=Wht&&Wht(),e._normalColor=Xht&&Xht(),e._hoverColor=jht&&jht(),e._pressedColor=Yht&&Yht(),e._disabledColor=Kht&&Kht(),e._normalSprite=qht&&qht(),e._hoverSprite=Qht&&Qht(),e._pressedSprite=Zht&&Zht(),e._disabledSprite=Jht&&Jht(),e._duration=$ht&&$ht(),e._zoomScale=tut&&tut(),e._target=eut&&eut(),e._pressed=!1,e._hovered=!1,e._fromColor=new yn,e._toColor=new yn,e._time=0,e._transitionFinished=!0,e._fromScale=new _n,e._toScale=new _n,e._originalScale=null,e._sprite=null,e._targetScale=new _n,e}s(e,t);var i=e.prototype;return i.__preload=function(){this.target||(this.target=this.node),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===_ut.COLOR||this._transition===_ut.SCALE)){this._time+=t;var i=1;if(this._duration>0&&(i=this._time/this._duration),i>=1&&(i=1),this._transition===_ut.COLOR){var n=e._uiProps.uiComp;yn.lerp(put,this._fromColor,this._toColor,i),n&&(n.color=put)}else this.transition===_ut.SCALE&&(e.getScale(this._targetScale),this._targetScale.x=Ni(this._fromScale.x,this._toScale.x,i),this._targetScale.y=Ni(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===_ut.COLOR&&this._interactable){var i=t.getComponent(WN);i&&(i.color=this._normalColor)}else e===_ut.SCALE&&this._originalScale&&t.setScale(this._originalScale);this._transitionFinished=!0}},i._registerNodeEvent=function(){this.node.on(Dg.TOUCH_START,this._onTouchBegan,this),this.node.on(Dg.TOUCH_MOVE,this._onTouchMove,this),this.node.on(Dg.TOUCH_END,this._onTouchEnded,this),this.node.on(Dg.TOUCH_CANCEL,this._onTouchCancel,this),this.node.on(Dg.MOUSE_ENTER,this._onMouseMoveIn,this),this.node.on(Dg.MOUSE_LEAVE,this._onMouseMoveOut,this),this.node.on(Iht.XRUI_HOVER_ENTERED,this._xrHoverEnter,this),this.node.on(Iht.XRUI_HOVER_EXITED,this._xrHoverExit,this),this.node.on(Iht.XRUI_CLICK,this._xrClick,this),this.node.on(Iht.XRUI_UNCLICK,this._xrUnClick,this)},i._registerTargetEvent=function(t){t.on(Dg.TRANSFORM_CHANGED,this._onTargetTransformChanged,this)},i._unregisterNodeEvent=function(){this.node.off(Dg.TOUCH_START,this._onTouchBegan,this),this.node.off(Dg.TOUCH_MOVE,this._onTouchMove,this),this.node.off(Dg.TOUCH_END,this._onTouchEnded,this),this.node.off(Dg.TOUCH_CANCEL,this._onTouchCancel,this),this.node.off(Dg.MOUSE_ENTER,this._onMouseMoveIn,this),this.node.off(Dg.MOUSE_LEAVE,this._onMouseMoveOut,this),this.node.off(Iht.XRUI_HOVER_ENTERED,this._xrHoverEnter,this),this.node.off(Iht.XRUI_HOVER_EXITED,this._xrHoverExit,this),this.node.off(Iht.XRUI_CLICK,this._xrClick,this),this.node.off(Iht.XRUI_UNCLICK,this._xrUnClick,this)},i._unregisterTargetEvent=function(t){t.off(Dg.TRANSFORM_CHANGED)},i._getTargetSprite=function(t){var e=null;return t&&(e=t.getComponent(PF)),e},i._applyTarget=function(){this.target&&(this._sprite=this._getTargetSprite(this.target),this._originalScale||(this._originalScale=new _n),_n.copy(this._originalScale,this.target.scale),this._registerTargetEvent(this.target))},i._onTargetSpriteFrameChanged=function(t){this._transition===_ut.SPRITE&&this._setCurrentStateSpriteFrame(t.spriteFrame)},i._setCurrentStateSpriteFrame=function(t){if(t)switch(this._getButtonState()){case dut.NORMAL:this._normalSprite=t;break;case dut.HOVER:this._hoverSprite=t;break;case dut.PRESSED:this._pressedSprite=t;break;case dut.DISABLED:this._disabledSprite=t}},i._onTargetColorChanged=function(t){this._transition===_ut.COLOR&&this._setCurrentStateColor(t)},i._setCurrentStateColor=function(t){switch(this._getButtonState()){case dut.NORMAL:this._normalColor=t;break;case dut.HOVER:this._hoverColor=t;break;case dut.PRESSED:this._pressedColor=t;break;case dut.DISABLED:this._disabledColor=t}},i._onTargetTransformChanged=function(t){t&Ig.SCALE&&this._originalScale&&this._transition===_ut.SCALE&&this._transitionFinished&&_n.copy(this._originalScale,this.target.scale)},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===_ut.SCALE&&this.target&&this._originalScale?n?(_n.copy(this._fromScale,this._originalScale),_n.multiplyScalar(this._toScale,this._originalScale,this._zoomScale),this._transitionFinished=!1):(this._time=0,this._transitionFinished=!0,this.target.setScale(this._originalScale)):(i=n?dut.PRESSED:dut.NORMAL,this._applyTransition(i)),t&&(t.propagationStopped=!0)}}},i._onTouchEnded=function(t){this._interactable&&this.enabledInHierarchy&&(this._pressed&&(Rp.emitEvents(this.clickEvents,t),this.node.emit(fut.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!==_ut.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=dut.NORMAL;return this._interactable?this._pressed?t=dut.PRESSED:this._hovered&&(t=dut.HOVER):t=dut.DISABLED,t},i._updateColorTransition=function(t){var e,i=this._getColorByState(t),n=null===(e=this.target)||void 0===e?void 0:e.getComponent(WN);n&&(t===dut.DISABLED?(n.color=i,this._transitionFinished=!0):(this._fromColor=n.color.clone(),this._toColor=i,this._time=0,this._transitionFinished=!1))},i._updateSpriteTransition=function(t){var e=this._getSpriteFrameByState(t);this._sprite&&e&&(this._sprite.spriteFrame=e)},i._updateScaleTransition=function(t){this._interactable&&(t===dut.PRESSED?this._zoomUp():this._zoomBack())},i._zoomUp=function(){this._originalScale&&(_n.copy(this._fromScale,this._originalScale),_n.multiplyScalar(this._toScale,this._originalScale,this._zoomScale),this._time=0,this._transitionFinished=!1)},i._zoomBack=function(){this.target&&this._originalScale&&(_n.copy(this._fromScale,this.target.scale),_n.copy(this._toScale,this._originalScale),this._time=0,this._transitionFinished=!1)},i._applyTransition=function(t){var e=this._transition;e===_ut.COLOR?this._updateColorTransition(t):e===_ut.SPRITE?this._updateSpriteTransition(t):e===_ut.SCALE&&this._updateScaleTransition(t)},i._getSpriteFrameByState=function(t){switch(t){case dut.NORMAL:return this._normalSprite;case dut.DISABLED:return this._disabledSprite;case dut.HOVER:return this.hoverSprite;case dut.PRESSED:return this._pressedSprite;default:return null}},i._getColorByState=function(t){switch(t){case dut.NORMAL:return this._normalColor;case dut.DISABLED:return this._disabledColor;case dut.HOVER:return this._hoverColor;case dut.PRESSED:return this._pressedColor;default:return new yn}},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&&(Rp.emitEvents(this.clickEvents,this),this.node.emit(fut.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===_ut.COLOR?this._updateColorTransition(dut.NORMAL):this._transition===_ut.SPRITE&&this._updateSpriteTransition(dut.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(PF);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}(xp)).Transition=_ut,iut.EventType=fut,f((Hht=iut).prototype,"target",[Mht],Object.getOwnPropertyDescriptor(Hht.prototype,"target"),Hht.prototype),f(Hht.prototype,"transition",[Nht],Object.getOwnPropertyDescriptor(Hht.prototype,"transition"),Hht.prototype),f(Hht.prototype,"normalSprite",[Lht],Object.getOwnPropertyDescriptor(Hht.prototype,"normalSprite"),Hht.prototype),f(Hht.prototype,"pressedSprite",[Bht],Object.getOwnPropertyDescriptor(Hht.prototype,"pressedSprite"),Hht.prototype),f(Hht.prototype,"hoverSprite",[Fht],Object.getOwnPropertyDescriptor(Hht.prototype,"hoverSprite"),Hht.prototype),f(Hht.prototype,"disabledSprite",[kht],Object.getOwnPropertyDescriptor(Hht.prototype,"disabledSprite"),Hht.prototype),zht=ua(Hht.prototype,"clickEvents",[Uht,wa],(function(){return[]})),Vht=ua(Hht.prototype,"_interactable",[wa],(function(){return!0})),Wht=ua(Hht.prototype,"_transition",[wa],(function(){return _ut.NONE})),Xht=ua(Hht.prototype,"_normalColor",[wa],(function(){return yn.WHITE.clone()})),jht=ua(Hht.prototype,"_hoverColor",[wa],(function(){return new yn(211,211,211,255)})),Yht=ua(Hht.prototype,"_pressedColor",[wa],(function(){return yn.WHITE.clone()})),Kht=ua(Hht.prototype,"_disabledColor",[wa],(function(){return new yn(124,124,124,255)})),qht=ua(Hht.prototype,"_normalSprite",[wa],(function(){return null})),Qht=ua(Hht.prototype,"_hoverSprite",[wa],(function(){return null})),Zht=ua(Hht.prototype,"_pressedSprite",[wa],(function(){return null})),Jht=ua(Hht.prototype,"_disabledSprite",[wa],(function(){return null})),$ht=ua(Hht.prototype,"_duration",[wa],(function(){return.1})),tut=ua(Hht.prototype,"_zoomScale",[wa],(function(){return 1.2})),eut=ua(Hht.prototype,"_target",[wa],(function(){return null})),Ght=Hht))||Ght)||Ght)||Ght);t({Button:gut,ButtonComponent:gut}),m.Button=gut;var mut,vut,yut,Tut=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}();Tut._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"}(mut||(mut={})),ye(mut),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"}(vut||(vut={})),ye(vut),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"}(yut||(yut={})),ye(yut);var Eut,Sut,Aut,but,Cut,Rut,wut,Iut,xut,Dut,Out,Put,Mut,Nut,Lut,But,Fut,kut,Uut,Gut,Hut,zut,Vut,Wut,Xut,jut,Yut,Kut,qut,Qut,Zut=function(){function t(){this._editing=!1,this._delegate=null}var e=t.prototype;return e.init=function(){},e.onEnable=function(){},e.beforeDraw=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}(),Jut=y.document,$ut=new Ln,tct=new Ln,ect=new _n,ict=null,nct=0;!function(t){function e(){var e;return(e=t.call(this)||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_"+ ++nct,e._forceUpdate=!1,e}s(e,t);var i=e.prototype;i.init=function(t){t&&(this._delegate=t,t.inputMode===vut.ANY?this._createTextArea():this._createInput(),Tut.add(this),this.setTabIndex(t.tabIndex),this._initStyleSheet(),this._registerEventListeners(),this._addDomToGameContainer(),uO.instance.on("canvas-resize",this._resize,this),No.on("window-resize",this._resize,this))},i.clear=function(){uO.instance.off("canvas-resize",this._resize,this),No.off("window-resize",this._resize,this),this._removeEventListeners(),this._removeDomFromGameContainer(),Tut.remove(this),ict===this&&(ict=null),this._delegate=null},i._resize=function(){this._forceUpdate=!0},i.beforeDraw=function(){(this._delegate.node.hasChangedFlags||this._forceUpdate)&&(this._forceUpdate=!1,this._updateMatrix())},i.setTabIndex=function(t){this._edTxt.tabIndex=t,Tut.resort()},i.setSize=function(t,e){var i=this._edTxt;i&&(i.style.width=t+"px",i.style.height=e+"px")},i.beginEditing=function(){ict&&ict!==this&&ict.setFocus(!1),this._editing=!0,ict=this,this._delegate._editBoxEditingDidBegan(),this._showDom(),this._edTxt.focus()},i.endEditing=function(){this._edTxt.blur()},i._createInput=function(){this._isTextArea=!1,this._edTxt=Jut.createElement("input")},i._createTextArea=function(){this._isTextArea=!0,this._edTxt=Jut.createElement("textarea")},i._addDomToGameContainer=function(){bO.container&&this._edTxt&&(bO.container.appendChild(this._edTxt),Jut.head.appendChild(this._placeholderStyleSheet))},i._removeDomFromGameContainer=function(){Fe(bO.container,this._edTxt)&&this._edTxt&&bO.container.removeChild(this._edTxt),Fe(Jut.head,this._placeholderStyleSheet)&&Jut.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()),Fo.isMobile&&this._showDomOnMobile()},i._hideDom=function(){var t=this._edTxt;t&&this._delegate&&(t.style.display="none",this._delegate._showLabels()),Fo.isMobile&&this._hideDomOnMobile()},i._showDomOnMobile=function(){Fo.os!==co.ANDROID&&Fo.os!==co.OHOS||(No.handleResizeEvent=!1,this._adjustWindowScroll())},i._hideDomOnMobile=function(){Fo.os!==co.ANDROID&&Fo.os!==co.OHOS||(No.handleResizeEvent=!0),this._scrollBackWindow()},i._isElementInViewport=function(){if(this._edTxt){var t=this._edTxt.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=(y.innerHeight||Jut.documentElement.clientHeight)&&t.right<=(y.innerWidth||Jut.documentElement.clientWidth)}return!1},i._adjustWindowScroll=function(){var t=this;setTimeout((function(){y.scrollY<40&&!t._isElementInViewport()&&t._edTxt.scrollIntoView({block:"start",inline:"nearest",behavior:"smooth"})}),400)},i._scrollBackWindow=function(){setTimeout((function(){Fo.browserType!==ao.WECHAT||Fo.os!==co.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=TO.getScaleX(),i=TO.getScaleY(),n=TO.getViewportRect(),r=No.devicePixelRatio;t.getWorldMatrix($ut);var s=t._uiProps.uiTransformComp;if(s&&(_n.set(ect,-s.anchorX*s.width,-s.anchorY*s.height,ect.z),Ln.transform($ut,$ut,ect)),t._uiProps.uiTransformComp){var o=DD.root.batcher2D.getFirstRenderCamera(t);if(o){o.node.getWorldRT(tct);var a=tct.m12,h=tct.m13,u=ko.center;tct.m12=u.x-(tct.m00*a+tct.m04*h),tct.m13=u.y-(tct.m01*a+tct.m05*h),e/=r,i/=r,_n.set(ect,e,i,1),Ln.scale(tct,tct,ect);var c=bO.container,l=parseInt(c&&c.style.paddingLeft||"0");l+=n.x/r;var _=parseInt(c&&c.style.paddingBottom||"0");_+=n.y/r,tct.m12+=l,tct.m13+=_,Ln.multiply(tct,tct,$ut);var d="matrix("+tct.m00+","+-tct.m01+","+-tct.m04+","+tct.m05+","+tct.m12+","+-tct.m13+")";this._edTxt.style.transform=d,this._edTxt.style["-webkit-transform"]=d,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===yut.INITIAL_CAPS_ALL_CHARACTERS?s="uppercase":i===yut.INITIAL_CAPS_WORD&&(s="capitalize"),void(r.style.textTransform=s)}if(r=r,i===yut.PASSWORD)return r.type="password",void(r.style.textTransform="none");var o=r.type;e===vut.EMAIL_ADDR?o="email":e===vut.NUMERIC?o="number":e===vut.DECIMAL?o="digit":e===vut.PHONE_NUMBER?(o="tel",r.addEventListener("wheel",(function(){return!1}))):e===vut.URL?o="url":(o="text",n===mut.SEARCH&&(o="search")),r.type=o;var a="none";i===yut.INITIAL_CAPS_ALL_CHARACTERS?a="uppercase":i===yut.INITIAL_CAPS_WORD&&(a="capitalize"),r.style.textTransform=a}},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=Jut.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 TM?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 ML.HorizontalAlign.LEFT:n.style.textAlign="left";break;case ML.HorizontalAlign.CENTER:n.style.textAlign="center";break;case ML.HorizontalAlign.RIGHT:n.style.textAlign="right"}}}},i._updatePlaceholderLabel=function(t){if(t){var e=t.font;e=!e||e instanceof TM?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,o="";switch(t.horizontalAlign){case ML.HorizontalAlign.LEFT:o="left";break;case ML.HorizontalAlign.CENTER:o="center";break;case ML.HorizontalAlign.RIGHT:o="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: "+o+";}#"+this._domId+"::-moz-placeholder{text-transform: initial;-family: "+e+";font-size: "+i+"px;color: "+r+";line-height: "+s+"px;text-align: "+o+";}#"+this._domId+"::-ms-input-placeholder{text-transform: initial;-family: "+e+";font-size: "+i+"px;color: "+r+";line-height: "+s+"px;text-align: "+o+";}",Fo.browserType===ao.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&&Fo.isMobile&&t._adjustWindowScroll()},n.onKeydown=function(i){i.keyCode===iw.ENTER?(i.propagationStopped=!0,t._delegate._editBoxEditingReturn(),t._isTextArea||e.blur()):i.keyCode===iw.TAB&&(i.propagationStopped=!0,i.preventDefault(),Tut.next(t))},n.onBlur=function(){Fo.isMobile&&i&&n.compositionEnd(),t._editing=!1,ict=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}}}(Zut),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"}(Qut||(Qut={}));var rct,sct,oct,act,hct,uct,cct,lct,_ct,dct,fct,pct,gct,mct,vct,yct,Tct,Ect,Sct,Act,bct,Cct,Rct,wct,Ict,xct,Dct,Oct,Pct,Mct,Nct,Lct,Bct,Fct,kct=(Eut=va("cc.EditBox"),Sut=Ta(110),Aut=ya(RN),but=Za(ML),Cut=Za(ML),Rut=Za(TP),wut=Za(yut),Iut=Za(vut),xut=Za(mut),Dut=Za([Rp]),Out=Za([Rp]),Put=Za([Rp]),Mut=Za([Rp]),Eut(Nut=Sut(Nut=Aut(((qut=function(t){function e(){var e;return(e=t.call(this)||this).editingDidBegan=But&&But(),e.textChanged=Fut&&Fut(),e.editingDidEnded=kut&&kut(),e.editingReturn=Uut&&Uut(),e._impl=null,e._background=null,e._textLabel=Gut&&Gut(),e._placeholderLabel=Hut&&Hut(),e._returnType=zut&&zut(),e._string=Vut&&Vut(),e._tabIndex=Wut&&Wut(),e._backgroundImage=Xut&&Xut(),e._inputFlag=jut&&jut(),e._inputMode=Yut&&Yut(),e._maxLength=Kut&&Kut(),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._beforeDraw=function(){this._impl&&this._impl.beforeDraw()},i.onDisable=function(){this._unregisterEvent(),this._unregisterBackgroundEvent(),this._impl&&this._impl.onDisable()},i.onDestroy=function(){DD.off(ID.EVENT_BEFORE_DRAW,this._beforeDraw,this),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(){Rp.emitEvents(this.editingDidBegan,this),this.node.emit(Qut.EDITING_DID_BEGAN,this)},i._editBoxEditingDidEnded=function(t){Rp.emitEvents(this.editingDidEnded,this),this.node.emit(Qut.EDITING_DID_ENDED,this,t)},i._editBoxTextChanged=function(t){t=this._updateLabelStringStyle(t,!0),this.string=t,Rp.emitEvents(this.textChanged,t,this),this.node.emit(Qut.TEXT_CHANGED,this)},i._editBoxEditingReturn=function(t){Rp.emitEvents(this.editingReturn,this),this.node.emit(Qut.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(Dg.SIZE_CHANGED,this._resizeChildNodes,this),DD.on(ID.EVENT_BEFORE_DRAW,this._beforeDraw,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(PF);t||(t=this.node.addComponent(PF)),t!==this._background&&(t.type=PF.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 Tm("TEXT_LABEL")).layer=this.node.layer),(t=e.getComponent(ML))||(t=e.addComponent(ML)),e.parent=this.node,this._textLabel=t}this._inputMode===vut.ANY?(t.verticalAlign=RL.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 Tm("PLACEHOLDER_LABEL")).layer=this.node.layer),(t=e.getComponent(ML))||(t=e.addComponent(ML)),e.parent=this.node,this._placeholderLabel=t}this._inputMode===vut.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!==yut.PASSWORD)n===yut.INITIAL_CAPS_ALL_CHARACTERS?t=t.toUpperCase():n===yut.INITIAL_CAPS_WORD?t=t.replace(/(?:^|\s)\S/g,(function(t){return t.toUpperCase()})):n===yut.INITIAL_CAPS_SENTENCE&&(t=(i=t).charAt(0).toUpperCase()+i.slice(1));else{for(var r="",s=t.length,o=0;o<s;++o)r+="●";t=r}return t},i._registerEvent=function(){this.node.on(Dg.TOUCH_START,this._onTouchBegan,this),this.node.on(Dg.TOUCH_END,this._onTouchEnded,this),this.node.on(Iht.XRUI_UNCLICK,this._xrUnClick,this),this.node.on(xht.XR_KEYBOARD_INPUT,this._xrKeyBoardInput,this)},i._unregisterEvent=function(){this.node.off(Dg.TOUCH_START,this._onTouchBegan,this),this.node.off(Dg.TOUCH_END,this._onTouchEnded,this),this.node.off(Iht.XRUI_UNCLICK,this._xrUnClick,this),this.node.off(xht.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(PF.EventType.SPRITE_FRAME_CHANGED,this._onBackgroundSpriteFrameChanged,this)},i._unregisterBackgroundEvent=function(){var t=this._background&&this._background.node;null==t||t.off(PF.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===vut.ANY&&(s.verticalAlign=RL.TOP),s.enableWrapText=this._inputMode===vut.ANY),r&&(r.node._uiProps.uiTransformComp.setContentSize(t.width-2,t.height),r.node.setPosition(i+2,n+t.height,r.node.position.z),r.enableWrapText=this._inputMode===vut.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(Qut.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}(xp))._EditBoxImpl=Zut,qut.KeyboardReturnType=mut,qut.InputFlag=yut,qut.InputMode=vut,qut.EventType=Qut,f((Lut=qut).prototype,"textLabel",[but],Object.getOwnPropertyDescriptor(Lut.prototype,"textLabel"),Lut.prototype),f(Lut.prototype,"placeholderLabel",[Cut],Object.getOwnPropertyDescriptor(Lut.prototype,"placeholderLabel"),Lut.prototype),f(Lut.prototype,"backgroundImage",[Rut],Object.getOwnPropertyDescriptor(Lut.prototype,"backgroundImage"),Lut.prototype),f(Lut.prototype,"inputFlag",[wut],Object.getOwnPropertyDescriptor(Lut.prototype,"inputFlag"),Lut.prototype),f(Lut.prototype,"inputMode",[Iut],Object.getOwnPropertyDescriptor(Lut.prototype,"inputMode"),Lut.prototype),f(Lut.prototype,"returnType",[xut],Object.getOwnPropertyDescriptor(Lut.prototype,"returnType"),Lut.prototype),But=ua(Lut.prototype,"editingDidBegan",[Dut,wa],(function(){return[]})),Fut=ua(Lut.prototype,"textChanged",[Out,wa],(function(){return[]})),kut=ua(Lut.prototype,"editingDidEnded",[Put,wa],(function(){return[]})),Uut=ua(Lut.prototype,"editingReturn",[Mut,wa],(function(){return[]})),Gut=ua(Lut.prototype,"_textLabel",[wa],(function(){return null})),Hut=ua(Lut.prototype,"_placeholderLabel",[wa],(function(){return null})),zut=ua(Lut.prototype,"_returnType",[wa],(function(){return mut.DEFAULT})),Vut=ua(Lut.prototype,"_string",[wa],(function(){return""})),Wut=ua(Lut.prototype,"_tabIndex",[wa],(function(){return 0})),Xut=ua(Lut.prototype,"_backgroundImage",[wa],(function(){return null})),jut=ua(Lut.prototype,"_inputFlag",[wa],(function(){return yut.DEFAULT})),Yut=ua(Lut.prototype,"_inputMode",[wa],(function(){return vut.ANY})),Kut=ua(Lut.prototype,"_maxLength",[wa],(function(){return 20})),Nut=Lut))||Nut)||Nut)||Nut);t({EditBox:kct,EditBoxComponent:kct}),m.internal.EditBox=kct,function(t){t[t.NONE=0]="NONE",t[t.HORIZONTAL=1]="HORIZONTAL",t[t.VERTICAL=2]="VERTICAL",t[t.GRID=3]="GRID"}(Pct||(Pct={})),Se(Pct),function(t){t[t.NONE=0]="NONE",t[t.CONTAINER=1]="CONTAINER",t[t.CHILDREN=2]="CHILDREN"}(Mct||(Mct={})),Se(Mct),function(t){t[t.HORIZONTAL=0]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(Nct||(Nct={})),Se(Nct),function(t){t[t.BOTTOM_TO_TOP=0]="BOTTOM_TO_TOP",t[t.TOP_TO_BOTTOM=1]="TOP_TO_BOTTOM"}(Lct||(Lct={})),Se(Lct),function(t){t[t.LEFT_TO_RIGHT=0]="LEFT_TO_RIGHT",t[t.RIGHT_TO_LEFT=1]="RIGHT_TO_LEFT"}(Bct||(Bct={})),Se(Bct),function(t){t[t.NONE=0]="NONE",t[t.FIXED_ROW=1]="FIXED_ROW",t[t.FIXED_COL=2]="FIXED_COL"}(Fct||(Fct={})),Se(Fct);var Uct,Gct,Hct,zct,Vct,Wct,Xct,jct,Yct,Kct,qct,Qct,Zct,Jct,$ct=new _n,tlt=(rct=va("cc.Layout"),sct=Ta(110),oct=ya(RN),act=Za(Pct),hct=Za(Mct),uct=Za(Nct),cct=Za(Lct),lct=Za(Bct),_ct=Za(Fct),rct(dct=sct(dct=oct(((Oct=function(t){function e(){var e;return(e=t.call(this)||this)._resizeMode=pct&&pct(),e._layoutType=gct&&gct(),e._cellSize=mct&&mct(),e._startAxis=vct&&vct(),e._paddingLeft=yct&&yct(),e._paddingRight=Tct&&Tct(),e._paddingTop=Ect&&Ect(),e._paddingBottom=Sct&&Sct(),e._spacingX=Act&&Act(),e._spacingY=bct&&bct(),e._verticalDirection=Cct&&Cct(),e._horizontalDirection=Rct&&Rct(),e._constraint=wct&&wct(),e._constraintNum=Ict&&Ict(),e._affectedByScale=xct&&xct(),e._isAlign=Dct&&Dct(),e._layoutSize=new Xn(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(Xn.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(){DD.on(ID.EVENT_AFTER_UPDATE,this.updateLayout,this),this.node.on(Dg.SIZE_CHANGED,this._resized,this),this.node.on(Dg.ANCHOR_CHANGED,this._doLayoutDirty,this),this.node.on(Dg.CHILD_ADDED,this._childAdded,this),this.node.on(Dg.CHILD_REMOVED,this._childRemoved,this),this.node.on(Dg.CHILDREN_ORDER_CHANGED,this._childrenChanged,this),this.node.on("childrenSiblingOrderChanged",this.updateLayout,this),this._addChildrenEventListeners()},i._removeEventListeners=function(){DD.off(ID.EVENT_AFTER_UPDATE,this.updateLayout,this),this.node.off(Dg.SIZE_CHANGED,this._resized,this),this.node.off(Dg.ANCHOR_CHANGED,this._doLayoutDirty,this),this.node.off(Dg.CHILD_ADDED,this._childAdded,this),this.node.off(Dg.CHILD_REMOVED,this._childRemoved,this),this.node.off(Dg.CHILDREN_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(Dg.SIZE_CHANGED,this._doLayoutDirty,this),i.on(Dg.TRANSFORM_CHANGED,this._transformDirty,this),i.on(Dg.ANCHOR_CHANGED,this._doLayoutDirty,this),i.on(Dg.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(Dg.SIZE_CHANGED,this._doLayoutDirty,this),i.off(Dg.TRANSFORM_CHANGED,this._transformDirty,this),i.off(Dg.ANCHOR_CHANGED,this._doLayoutDirty,this),i.off(Dg.ACTIVE_IN_HIERARCHY_CHANGED,this._childrenChanged,this)}},i._childAdded=function(t){t.on(Dg.SIZE_CHANGED,this._doLayoutDirty,this),t.on(Dg.TRANSFORM_CHANGED,this._transformDirty,this),t.on(Dg.ANCHOR_CHANGED,this._doLayoutDirty,this),t.on(Dg.ACTIVE_IN_HIERARCHY_CHANGED,this._childrenChanged,this),this._childrenChanged()},i._childRemoved=function(t){t.off(Dg.SIZE_CHANGED,this._doLayoutDirty,this),t.off(Dg.TRANSFORM_CHANGED,this._transformDirty,this),t.off(Dg.ANCHOR_CHANGED,this._doLayoutDirty,this),t.off(Dg.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(),o=1,a=this._paddingLeft;this._horizontalDirection===Bct.RIGHT_TO_LEFT&&(o=-1,a=this._paddingRight);var h=(this._horizontalDirection-r.x)*t+o*a,u=h-o*this._spacingX,c=0,l=0,_=0,d=0,f=!1,p=this._usefulLayoutObj.length,g=this._cellSize.width,m=this._getPaddingH();this._layoutType!==Pct.GRID&&this._resizeMode===Mct.CHILDREN&&(g=(t-m-(p-1)*this._spacingX)/p);for(var v=this._usefulLayoutObj,y=0;y<v.length;++y){var T=v[y],E=T.node,S=E.scale,A=this._getUsedScaleValue(S.x),b=this._getUsedScaleValue(S.y);this._resizeMode===Mct.CHILDREN&&(T.width=g/A,this._layoutType===Pct.GRID&&(T.height=this._cellSize.height/b));var C=Math.abs(this._horizontalDirection-T.anchorX),R=T.width*A,w=T.height*b;w>_&&(d=Math.max(_,d),l=_||w,_=w),u+=o*(C*R+this._spacingX);var I=o*(1-C)*R;if(e){if(s>0)(f=y/s>0&&y%s==0)&&(l=_>w?_:l);else if(R>t-m)u>h+o*C*R&&(f=!0);else{var x=(1-this._horizontalDirection-r.x)*t,D=u+I+o*(o>0?this._paddingRight:this._paddingLeft);f=Math.abs(D)>Math.abs(x)}f&&(u=h+o*C*R,w!==_&&(l=_),c+=l+this._spacingY,l=_=w)}var O=i(E,T,c);n&&E.setPosition(u,O),u+=I}return l=Math.max(l,_),Math.max(d,c+l)+this._getPaddingV()},i._doLayoutVertically=function(t,e,i,n){var r=this.node._uiProps.uiTransformComp.anchorPoint,s=this._getFixedBreakingNum(),o=1,a=this._paddingBottom;this._verticalDirection===Lct.TOP_TO_BOTTOM&&(o=-1,a=this._paddingTop);var h=(this._verticalDirection-r.y)*t+o*a,u=h-o*this._spacingY,c=0,l=0,_=0,d=0,f=!1,p=this._usefulLayoutObj.length,g=this._cellSize.height,m=this._getPaddingV();this._layoutType!==Pct.GRID&&this._resizeMode===Mct.CHILDREN&&(g=(t-m-(p-1)*this._spacingY)/p);for(var v=this._usefulLayoutObj,y=0;y<v.length;++y){var T=v[y],E=T.node,S=E.scale,A=this._getUsedScaleValue(S.x),b=this._getUsedScaleValue(S.y);this._resizeMode===Mct.CHILDREN&&(T.height=g/b,this._layoutType===Pct.GRID&&(T.width=this._cellSize.width/A));var C=Math.abs(this._verticalDirection-T.anchorY),R=T.width*A,w=T.height*b;R>c&&(l=Math.max(c,l),_=c||R,c=R),u+=o*(C*w+this._spacingY);var I=o*(1-C)*w;if(e){if(s>0)(f=y/s>0&&y%s==0)&&(_=c>w?c:_);else if(w>t-m)u>h+o*C*w&&(f=!0);else{var x=(1-this._verticalDirection-r.y)*t,D=u+I+o*(o>0?this._paddingTop:this._paddingBottom);f=Math.abs(D)>Math.abs(x)}f&&(u=h+o*C*w,R!==c&&(_=c),d+=_+this._spacingX,_=c=R)}var O=i(E,T,d);n&&(E.getPosition($ct),E.setPosition(O,u,$ct.z)),u+=I}return _=Math.max(_,c),Math.max(l,d+_)+this._getPaddingH()},i._doLayoutGridAxisHorizontal=function(t,e){var i=this,n=e.width,r=1,s=-t.y*e.height,o=this._paddingBottom;this._verticalDirection===Lct.TOP_TO_BOTTOM&&(r=-1,s=(1-t.y)*e.height,o=this._paddingTop);var a=function(t,e,n){return s+r*(n+(1-e.anchorY)*e.height*i._getUsedScaleValue(t.scale.y)+o)},h=0;this._resizeMode===Mct.CONTAINER&&(h=this._doLayoutHorizontally(n,!0,a,!1),s=-t.y*h,this._verticalDirection===Lct.TOP_TO_BOTTOM&&(r=-1,s=(1-t.y)*h)),this._doLayoutHorizontally(n,!0,a,!0),this._resizeMode===Mct.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,o=this._paddingLeft;this._horizontalDirection===Bct.RIGHT_TO_LEFT&&(r=-1,s=(1-t.x)*e.width,o=this._paddingRight);var a=function(t,e,n){return s+r*(n+(1-e.anchorX)*e.width*i._getUsedScaleValue(t.scale.x)+o)},h=0;this._resizeMode===Mct.CONTAINER&&(h=this._doLayoutVertically(n,!0,a,!1),s=-t.x*h,this._horizontalDirection===Bct.RIGHT_TO_LEFT&&(r=-1,s=(1-t.x)*h)),this._doLayoutVertically(n,!0,a,!0),this._resizeMode===Mct.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===Nct.HORIZONTAL?this._doLayoutGridAxisHorizontal(e,i):this.startAxis===Nct.VERTICAL&&this._doLayoutGridAxisVertical(e,i)},i._getHorizontalBaseWidth=function(){var t=this._usefulLayoutObj,e=0,i=t.length;if(this._resizeMode===Mct.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===Mct.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===Pct.HORIZONTAL){var e=this._getHorizontalBaseWidth();this._doLayoutHorizontally(e,!1,(function(e){return(t._isAlign?_n.ZERO:e.position).y}),!0),this.node._uiProps.uiTransformComp.width=e}else if(this._layoutType===Pct.VERTICAL){var i=this._getVerticalBaseHeight();this._doLayoutVertically(i,!1,(function(e){return(t._isAlign?_n.ZERO:e.position).x}),!0),this.node._uiProps.uiTransformComp.height=i}else this._layoutType===Pct.GRID&&this._doLayoutGrid()},i._getUsedScaleValue=function(t){return this._affectedByScale?Math.abs(t):1},i._transformDirty=function(t){t&Ig.SCALE&&t&Ig.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!==Pct.GRID||this._constraint===Fct.NONE||this._constraintNum<=0)return 0;var t=this._constraint===Fct.FIXED_ROW?Math.ceil(this._usefulLayoutObj.length/this._constraintNum):this._constraintNum;return this._startAxis===Nct.VERTICAL&&(t=this._constraint===Fct.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===Pct.HORIZONTAL&&(this._isAlign=t,this._doLayoutDirty())}},{key:"alignVertical",get:function(){return this._isAlign},set:function(t){this._layoutType===Pct.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!==Pct.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!==Pct.NONE&&this._constraint!==t&&(this._constraint=t,this._doLayoutDirty())}},{key:"constraintNum",get:function(){return this._constraintNum},set:function(t){this._constraint!==Fct.NONE&&this._constraintNum!==t&&(t<=0&&F("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}(xp)).Type=Pct,Oct.VerticalDirection=Lct,Oct.HorizontalDirection=Bct,Oct.ResizeMode=Mct,Oct.AxisDirection=Nct,Oct.Constraint=Fct,f((fct=Oct).prototype,"type",[act],Object.getOwnPropertyDescriptor(fct.prototype,"type"),fct.prototype),f(fct.prototype,"resizeMode",[hct],Object.getOwnPropertyDescriptor(fct.prototype,"resizeMode"),fct.prototype),f(fct.prototype,"startAxis",[uct],Object.getOwnPropertyDescriptor(fct.prototype,"startAxis"),fct.prototype),f(fct.prototype,"verticalDirection",[cct],Object.getOwnPropertyDescriptor(fct.prototype,"verticalDirection"),fct.prototype),f(fct.prototype,"horizontalDirection",[lct],Object.getOwnPropertyDescriptor(fct.prototype,"horizontalDirection"),fct.prototype),f(fct.prototype,"constraint",[_ct],Object.getOwnPropertyDescriptor(fct.prototype,"constraint"),fct.prototype),pct=ua(fct.prototype,"_resizeMode",[wa],(function(){return Mct.NONE})),gct=ua(fct.prototype,"_layoutType",[wa],(function(){return Pct.NONE})),mct=ua(fct.prototype,"_cellSize",[wa],(function(){return new Xn(40,40)})),vct=ua(fct.prototype,"_startAxis",[wa],(function(){return Nct.HORIZONTAL})),yct=ua(fct.prototype,"_paddingLeft",[wa],(function(){return 0})),Tct=ua(fct.prototype,"_paddingRight",[wa],(function(){return 0})),Ect=ua(fct.prototype,"_paddingTop",[wa],(function(){return 0})),Sct=ua(fct.prototype,"_paddingBottom",[wa],(function(){return 0})),Act=ua(fct.prototype,"_spacingX",[wa],(function(){return 0})),bct=ua(fct.prototype,"_spacingY",[wa],(function(){return 0})),Cct=ua(fct.prototype,"_verticalDirection",[wa],(function(){return Lct.TOP_TO_BOTTOM})),Rct=ua(fct.prototype,"_horizontalDirection",[wa],(function(){return Bct.LEFT_TO_RIGHT})),wct=ua(fct.prototype,"_constraint",[wa],(function(){return Fct.NONE})),Ict=ua(fct.prototype,"_constraintNum",[wa],(function(){return 2})),xct=ua(fct.prototype,"_affectedByScale",[wa],(function(){return!1})),Dct=ua(fct.prototype,"_isAlign",[wa],(function(){return!1})),dct=fct))||dct)||dct)||dct);t({Layout:tlt,LayoutComponent:tlt}),m.Layout=tlt,function(t){t[t.HORIZONTAL=0]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL",t[t.FILLED=2]="FILLED"}(Jct||(Jct={})),ye(Jct);var elt,ilt,nlt,rlt,slt,olt,alt,hlt,ult,clt,llt,_lt,dlt,flt=(Uct=va("cc.ProgressBar"),Gct=Ta(110),Hct=ya(RN),zct=Za(PF),Vct=Za(Jct),Uct(Wct=Gct(Wct=Hct(((Zct=function(t){function e(){var e;return(e=t.call(this)||this)._barSprite=jct&&jct(),e._mode=Yct&&Yct(),e._totalLength=Kct&&Kct(),e._progress=qct&&qct(),e._reverse=Qct&&Qct(),e}s(e,t);var i=e.prototype;return i.onLoad=function(){this._updateBarStatus()},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===PF.FillType.RADIAL&&(this._mode=Jct.FILLED),this._mode===Jct.HORIZONTAL?this.totalLength=r.width:this._mode===Jct.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=new Hn(0,.5),s=Mi(this._progress),o=this._totalLength*s,a=n,h=0,u=0;switch(this._mode){case Jct.HORIZONTAL:this._reverse&&(r=new Hn(1,.5)),a=new Xn(o,n.height),h=this._totalLength,u=n.height;break;case Jct.VERTICAL:r=this._reverse?new Hn(.5,1):new Hn(.5,0),a=new Xn(n.width,o),h=n.width,u=this._totalLength}if(this._mode===Jct.FILLED)this._barSprite.type!==PF.Type.FILLED?q(16397):(this._reverse&&(o*=-1),this._barSprite.fillRange=o);else if(this._barSprite.type!==PF.Type.FILLED){var c=r.x-i.x,l=r.y-i.y,_=new _n(t.position);_.add3f(h*c,u*l,0),t.setPosition(_),e.setAnchorPoint(r),e.setContentSize(a)}else q(16398)}},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===Jct.HORIZONTAL?this.totalLength=i.width:this._mode===Jct.VERTICAL?this.totalLength=i.height:this._mode===Jct.FILLED&&(this.totalLength=this._barSprite.fillRange)}}},{key:"totalLength",get:function(){return this._totalLength},set:function(t){this._mode===Jct.FILLED&&(t=Mi(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}(xp)).Mode=Jct,f((Xct=Zct).prototype,"barSprite",[zct],Object.getOwnPropertyDescriptor(Xct.prototype,"barSprite"),Xct.prototype),f(Xct.prototype,"mode",[Vct],Object.getOwnPropertyDescriptor(Xct.prototype,"mode"),Xct.prototype),jct=ua(Xct.prototype,"_barSprite",[wa],(function(){return null})),Yct=ua(Xct.prototype,"_mode",[wa],(function(){return Jct.HORIZONTAL})),Kct=ua(Xct.prototype,"_totalLength",[wa],(function(){return 1})),qct=ua(Xct.prototype,"_progress",[wa],(function(){return.1})),Qct=ua(Xct.prototype,"_reverse",[wa],(function(){return!1})),Wct=Xct))||Wct)||Wct)||Wct);t({ProgressBar:flt,ProgressBarComponent:flt}),m.ProgressBar=flt;var plt,glt=new _n,mlt=new _n,vlt=new _n,ylt=new Hn,Tlt=new yn,Elt=new Hn;!function(t){t[t.HORIZONTAL=0]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(plt||(plt={})),Se(plt);var Slt,Alt=(elt=va("cc.ScrollBar"),ilt=Ta(110),nlt=ya(RN),rlt=Za(PF),slt=Za(plt),elt(olt=ilt(olt=nlt(((dlt=function(t){function e(){var e;return(e=t.call(this)||this)._scrollView=hlt&&hlt(),e._handle=ult&&ult(),e._direction=clt&&clt(),e._enableAutoHide=llt&&llt(),e._autoHideTime=_lt&&_lt(),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,o=0,a=0,h=0,u=0,c=Elt;c.set(0,0),this._direction===plt.HORIZONTAL?(s=i.width,o=n.width,u=r.width,a=t.x,this._convertToScrollViewSpace(c,e),h=-c.x):this._direction===plt.VERTICAL&&(s=i.height,o=n.height,u=r.height,a=t.y,this._convertToScrollViewSpace(c,e),h=-c.y);var l=this._calculateLength(s,o,u,a),_=Elt;this._calculatePosition(_,s,o,u,h,a,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(PF);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){glt.set(-n.anchorX*n.width,-n.anchorY*n.height,0),n.convertToWorldSpaceAR(glt,mlt);var r=i.convertToNodeSpaceAR(mlt);r.x+=i.anchorX*i.width,r.y+=i.anchorY*i.height,t.set(r.x,r.y)}else t.set(Hn.ZERO)},i._setOpacity=function(t){if(this._handle){var e=this.node.getComponent(PF);e&&(Tlt.set(e.color),Tlt.a=t,e.color=Tlt),(e=this._handle.getComponent(PF))&&(Tlt.set(e.color),Tlt.a=t,e.color=Tlt)}},i._updateHandlerPosition=function(t){if(this._handle){var e=vlt;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;_n.set(glt,-i.width*n.x,-i.height*n.y,0);var o=this.node._uiProps.uiTransformComp.convertToWorldSpaceAR(glt,mlt),a=t;a.set(0,0,0),s._uiProps.uiTransformComp.convertToNodeSpaceAR(o,a),this.direction===plt.HORIZONTAL?a.set(a.x,a.y+(i.height-r.height)/2,a.z):this.direction===plt.VERTICAL&&a.set(a.x+(i.width-r.width)/2,a.y,a.z),this.handle.node.setPosition(a)},i._conditionalDisableScrollBar=function(t,e){return t.width<=e.width&&this._direction===plt.HORIZONTAL||t.height<=e.height&&this._direction===plt.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,o){var a=e-i;s&&(a+=Math.abs(s));var h=0;a&&(h=Mi(h=r/a));var u=(n-o)*h;this._direction===plt.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===ylt.x&&n.y===ylt.y||e.setAnchorPoint(ylt),this._direction===plt.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(Hn.ZERO))}},{key:"direction",get:function(){return this._direction},set:function(t){this._direction!==t&&(this._direction=t,this.onScroll(Hn.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}(xp)).Direction=plt,f((alt=dlt).prototype,"handle",[rlt],Object.getOwnPropertyDescriptor(alt.prototype,"handle"),alt.prototype),f(alt.prototype,"direction",[slt],Object.getOwnPropertyDescriptor(alt.prototype,"direction"),alt.prototype),hlt=ua(alt.prototype,"_scrollView",[wa],(function(){return null})),ult=ua(alt.prototype,"_handle",[wa],(function(){return null})),clt=ua(alt.prototype,"_direction",[wa],(function(){return plt.HORIZONTAL})),llt=ua(alt.prototype,"_enableAutoHide",[wa],(function(){return!1})),_lt=ua(alt.prototype,"_autoHideTime",[wa],(function(){return 1})),olt=alt))||olt)||olt)||olt);t({ScrollBar:Alt,ScrollBarComponent:Alt}),m.ScrollBar=Alt;var blt,Clt,Rlt,wlt,Ilt,xlt,Dlt,Olt,Plt,Mlt,Nlt,Llt,Blt,Flt,klt,Ult,Glt,Hlt,zlt,Vlt,Wlt,Xlt=t("ViewGroup",va("cc.ViewGroup")(Slt=Ta(110)(Slt=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(xp))||Slt)||Slt);m.ViewGroup=Xlt;var jlt,Ylt,Klt=1e-4,qlt=new _n,Qlt=new _n,Zlt=new Hn,Jlt=new Hn,$lt=function(){return(new Date).getMilliseconds()},t_t={"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.NONE="",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"}(jlt||(jlt={})),function(t){t[t.NONE=0]="NONE",t[t.LEFT=1]="LEFT",t[t.RIGHT=2]="RIGHT"}(Ylt||(Ylt={}));var e_t,i_t,n_t,r_t,s_t,o_t,a_t,h_t,u_t,c_t,l_t,__t,d_t,f_t=(blt=va("cc.ScrollView"),Clt=Ta(110),Rlt=ya(RN),wlt=Za(Tm),Ilt=Za(Alt),xlt=Za(Alt),Dlt=Za([Rp]),blt(Olt=Clt(Olt=Rlt(((Wlt=function(t){function e(){var e;return(e=t.call(this)||this).bounceDuration=Mlt&&Mlt(),e.brake=Nlt&&Nlt(),e.elastic=Llt&&Llt(),e.inertia=Blt&&Blt(),e.horizontal=Flt&&Flt(),e.vertical=klt&&klt(),e.cancelInnerEvents=Ult&&Ult(),e.scrollEvents=Glt&&Glt(),e._autoScrolling=!1,e._scrolling=!1,e._content=Hlt&&Hlt(),e._horizontalScrollBar=zlt&&zlt(),e._verticalScrollBar=Vlt&&Vlt(),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 _n,e._autoScrollTargetDelta=new _n,e._autoScrollTotalTime=0,e._autoScrollAccumulatedTime=0,e._autoScrollCurrentlyOutOfBoundary=!1,e._autoScrollBraking=!1,e._autoScrollBrakingStartPosition=new _n,e._outOfBoundaryAmount=new _n,e._outOfBoundaryAmountDirty=!0,e._stopMouseWheel=!1,e._mouseWheelEventElapsedTime=0,e._isScrollEndedWithThresholdEventFired=!1,e._scrollEventEmitMask=0,e._isBouncing=!1,e._contentPos=new _n,e._deltaPos=new _n,e._deltaAmount=new _n,e._hoverIn=Ylt.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 Hn(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 Hn(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 Hn(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 Hn(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 Hn(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 Hn(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 Hn(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 Hn(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 Hn(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 Hn(e,t)},i.getMaxScrollOffset=function(){if(!this._content||!this.view)return Hn.ZERO;var t=this._content._uiProps.uiTransformComp.contentSize,e=t.width-this.view.width,i=t.height-this.view.height;return new Hn(e=e>=0?e:0,i=i>=0?i:0)},i.scrollToPercentHorizontal=function(t,e,i){var n=this._calculateMovePercentDelta({anchor:new Hn(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 Hn(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 Hn(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)<Klt&&Math.abs(t.y-e.y)<Klt||(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):_n.ZERO.clone()},i.isScrolling=function(){return this._scrolling},i.isAutoScrolling=function(){return this._autoScrolling},i.getScrollEndedEventTiming=function(){return Klt},i.start=function(){this._calculateBoundary(),this._content&&DD.once(ID.EVENT_BEFORE_DRAW,this._adjustContentOutOfBoundary,this)},i.onEnable=function(){this._registerEvent(),this._content&&(this._content.on(Dg.SIZE_CHANGED,this._calculateBoundary,this),this._content.on(Dg.TRANSFORM_CHANGED,this._scaleChanged,this),this.view&&(this.view.node.on(Dg.TRANSFORM_CHANGED,this._scaleChanged,this),this.view.node.on(Dg.SIZE_CHANGED,this._calculateBoundary,this))),this._calculateBoundary(),this._updateScrollBarState()},i.update=function(t){var e=this._deltaAmount;this._autoScrolling?(this._processAutoScrolling(t),e.x=0,e.y=0):0===e.x&&0===e.y||(this._processDeltaMove(e),e.x=0,e.y=0)},i.onDisable=function(){this._unregisterEvent(),this._content&&(this._content.off(Dg.SIZE_CHANGED,this._calculateBoundary,this),this._content.off(Dg.TRANSFORM_CHANGED,this._scaleChanged,this),this.view&&(this.view.node.off(Dg.TRANSFORM_CHANGED,this._scaleChanged,this),this.view.node.off(Dg.SIZE_CHANGED,this._calculateBoundary,this))),this._deltaAmount.set(0,0),this._hideScrollBar(),this.stopAutoScroll()},i._registerEvent=function(){this.node.on(Dg.TOUCH_START,this._onTouchBegan,this,!0),this.node.on(Dg.TOUCH_MOVE,this._onTouchMoved,this,!0),this.node.on(Dg.TOUCH_END,this._onTouchEnded,this,!0),this.node.on(Dg.TOUCH_CANCEL,this._onTouchCancelled,this,!0),this.node.on(Dg.MOUSE_WHEEL,this._onMouseWheel,this,!0),this.node.on(Iht.XRUI_HOVER_ENTERED,this._xrHoverEnter,this),this.node.on(Iht.XRUI_HOVER_EXITED,this._xrHoverExit,this),kw.on(Fw.EventType.HANDLE_INPUT,this._dispatchEventHandleInput,this),kw.on(Fw.EventType.GAMEPAD_INPUT,this._dispatchEventHandleInput,this)},i._unregisterEvent=function(){this.node.off(Dg.TOUCH_START,this._onTouchBegan,this,!0),this.node.off(Dg.TOUCH_MOVE,this._onTouchMoved,this,!0),this.node.off(Dg.TOUCH_END,this._onTouchEnded,this,!0),this.node.off(Dg.TOUCH_CANCEL,this._onTouchCancelled,this,!0),this.node.off(Dg.MOUSE_WHEEL,this._onMouseWheel,this,!0),this.node.off(Iht.XRUI_HOVER_ENTERED,this._xrHoverEnter,this),this.node.off(Iht.XRUI_HOVER_EXITED,this._xrHoverExit,this),kw.off(Fw.EventType.HANDLE_INPUT,this._dispatchEventHandleInput,this),kw.off(Fw.EventType.GAMEPAD_INPUT,this._dispatchEventHandleInput,this)},i._onMouseWheel=function(t,e){if(this.enabledInHierarchy&&!this._hasNestedViewGroup(t,e)){var i=new _n,n=t.getScrollY();this.vertical?i.set(0,-.1*n,0):this.horizontal&&i.set(-.1*n,0,0),this._mouseWheelEventElapsedTime=0,this._deltaAmount.add(i),this._stopMouseWheel||(this._handlePressLogic(),this.schedule(this._checkMouseWheel,1/60),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(Zlt);if(n.subtract(i.getUIStartLocation(Jlt)),n.length()>7&&!this._touchMoved&&t.target!==this.node){var r=new ew(t.getTouches(),t.bubbles,KR.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(jlt.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(tlt);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!==QR.CAPTURING_PHASE)return!1;if(e)for(var i,n=d(e);!(i=n()).done;){var r=i.value;if(this.node===r)return!(!t.target||!t.target.getComponent(Xlt));if(r.getComponent(Xlt))return!0}return!1},i._startInertiaScroll=function(t){var e=new _n(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,o=n.height-r.height,a=this._calculateAttenuatedFactor(s),h=this._calculateAttenuatedFactor(o);i.x=i.x*s*(1-this.brake)*a,i.y=i.y*o*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,_n.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(_n.ZERO,Klt)||(this._autoScrollCurrentlyOutOfBoundary=!0)},i._calculateTouchMoveVelocity=function(){var t=new _n,e=0;if((e=this._touchMoveTimeDeltas.reduce((function(t,e){return t+e}),e))<=0||e>=.5)t.set(_n.ZERO);else{var i=new _n;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);qlt.set(this._getContentPosition()),qlt.add(i),qlt.set(Math.round(1e4*qlt.x)*Klt,Math.round(1e4*qlt.y)*Klt,qlt.z),this._setContentPosition(qlt);var n=this._getHowMuchOutOfBoundary();Zlt.set(n.x,n.y),this._updateScrollBar(Zlt),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 _n).equals(_n.ZERO,Klt)&&!this._outOfBoundaryAmountDirty)return this._outOfBoundaryAmount;var e=new _n,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(_n.ZERO,Klt)&&(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===jlt.SCROLL_ENDED)this._scrollEventEmitMask=0;else if(t===jlt.SCROLL_TO_TOP||t===jlt.SCROLL_TO_BOTTOM||t===jlt.SCROLL_TO_LEFT||t===jlt.SCROLL_TO_RIGHT){var e=1<<t_t[t];if(this._scrollEventEmitMask&e)return;this._scrollEventEmitMask|=e}Rp.emitEvents(this.scrollEvents,this,t_t[t]),this.node.emit(t,this)},i._adjustContentOutOfBoundary=function(){if(this._content){this._outOfBoundaryAmountDirty=!0;var t=this._getHowMuchOutOfBoundary();!t.equals(_n.ZERO,Klt)&&(qlt.set(this._getContentPosition()),qlt.add(t),this._setContentPosition(qlt),this._updateScrollBar(Hn.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||Oi(e.height,t.height)?this._verticalScrollBar.hide():this._verticalScrollBar.show()),this._horizontalScrollBar&&this._horizontalScrollBar.isValid&&(e.width<t.width||Oi(e.width,t.width)?this._horizontalScrollBar.hide():this._horizontalScrollBar.show())}},i._stopPropagationIfTargetIsMe=function(t){t.eventPhase===QR.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._deltaAmount.add(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(jlt.SCROLL_ENDED))},i._getLocalAxisAlignDelta=function(t,e){var i=this.node._uiProps.uiTransformComp,n=new _n;i&&(e.getUILocation(Zlt),e.getUIPreviousLocation(Jlt),qlt.set(Zlt.x,Zlt.y,0),Qlt.set(Jlt.x,Jlt.y,0),i.convertToNodeSpaceAR(qlt,qlt),i.convertToNodeSpaceAR(Qlt,Qlt),_n.subtract(n,qlt,Qlt)),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=jlt.NONE,r=jlt.NONE;if(this._content){var s=this._content._uiProps.uiTransformComp,o=s.anchorX,a=s.anchorY,h=s.width,u=s.height,c=this._content.position||_n.ZERO;this.vertical&&(i.y>0?c.y-a*u+i.y>=this._bottomBoundary&&(n=jlt.SCROLL_TO_BOTTOM):i.y<0&&c.y-a*u+u+i.y<=this._topBoundary&&(n=jlt.SCROLL_TO_TOP)),this.horizontal&&(i.x<0?c.x-o*h+h+i.x<=this._rightBoundary&&(r=jlt.SCROLL_TO_RIGHT):i.x>0&&c.x-o*h+i.x>=this._leftBoundary&&(r=jlt.SCROLL_TO_LEFT))}this._moveContent(i,!1),(this.horizontal&&0!==i.x||this.vertical&&0!==i.y)&&(this._scrolling||(this._scrolling=!0,this._dispatchEvent(jlt.SCROLL_BEGAN)),this._dispatchEvent(jlt.SCROLLING)),n!==jlt.NONE&&this._dispatchEvent(n),r!==jlt.NONE&&this._dispatchEvent(r)},i._handlePressLogic=function(){this._autoScrolling&&this._dispatchEvent(jlt.SCROLL_ENDED),this._autoScrolling=!1,this._isBouncing=!1,this._touchMovePreviousTimestamp=$lt(),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=$lt();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(_n.ZERO,Klt))return!1;var e=Math.max(this.bounceDuration,0);return this._startAutoScroll(t,e,!0),this._isBouncing||(t.y>0&&this._dispatchEvent(jlt.BOUNCE_TOP),t.y<0&&this._dispatchEvent(jlt.BOUNCE_BOTTOM),t.x>0&&this._dispatchEvent(jlt.BOUNCE_RIGHT),t.x<0&&this._dispatchEvent(jlt.BOUNCE_LEFT),this._isBouncing=!0),!0},i._processInertiaScroll=function(){if(!this._startBounceBackIfNeeded()&&this.inertia){var t=this._calculateTouchMoveVelocity();!t.equals(qlt,Klt)&&this.brake<1&&this._startInertiaScroll(t)}this._onScrollBarTouchEnded()},i._isOutOfBoundary=function(){return!this._getHowMuchOutOfBoundary().equals(_n.ZERO,Klt)},i._isNecessaryAutoScrollBrake=function(){if(this._autoScrollBraking)return!0;if(this._isOutOfBoundary()){if(!this._autoScrollCurrentlyOutOfBoundary)return this._autoScrollCurrentlyOutOfBoundary=!0,this._autoScrollBraking=!0,_n.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 o=this._autoScrollStartPosition.clone();o.add(s);var a=Math.abs(r-1)<=Klt;if(Math.abs(r-1)<=this.getScrollEndedEventTiming()&&!this._isScrollEndedWithThresholdEventFired&&(this._dispatchEvent(jlt.SCROLL_ENG_WITH_THRESHOLD),this._isScrollEndedWithThresholdEventFired=!0),this.elastic){var h=o.clone();h.subtract(this._autoScrollBrakingStartPosition),e&&h.multiplyScalar(i),o.set(this._autoScrollBrakingStartPosition),o.add(h)}else{var u=o.clone();u.subtract(this.getContentPosition());var c=this._getHowMuchOutOfBoundary(u);c.equals(_n.ZERO,Klt)||(o.add(c),a=!0)}a&&(this._autoScrolling=!1);var l=o.clone();l.subtract(this._getContentPosition()),this._clampDelta(l),this._moveContent(l,a),this._dispatchEvent(jlt.SCROLLING),this._autoScrolling||(this._isBouncing=!1,this._scrolling=!1,this._dispatchEvent(jlt.SCROLL_ENDED))},i._checkMouseWheel=function(t){if(!this._getHowMuchOutOfBoundary().equals(_n.ZERO,Klt))return this._processInertiaScroll(),this._scrolling&&(this._scrolling=!1,this._autoScrolling||this._dispatchEvent(jlt.SCROLL_ENDED)),this.unschedule(this._checkMouseWheel),void(this._stopMouseWheel=!1);this._mouseWheelEventElapsedTime+=t,this._mouseWheelEventElapsedTime>.1&&(this._onScrollBarTouchEnded(),this._scrolling&&(this._scrolling=!1,this._autoScrolling||this._dispatchEvent(jlt.SCROLL_ENDED)),this.unschedule(this._checkMouseWheel),this._stopMouseWheel=!1)},i._calculateMovePercentDelta=function(t){var e=t.anchor,i=t.applyToHorizontal,n=t.applyToVertical;this._calculateBoundary(),e.clampf(Hn.ZERO,Hn.ONE);var r=this._getContentBottomBoundary()-this._bottomBoundary;r=-r;var s=this._getContentLeftBoundary()-this._leftBoundary;s=-s;var o=new _n;if(this._content&&this.view){var a=0,h=this._content._uiProps.uiTransformComp.contentSize,u=this.view.contentSize;i&&(a=h.width-u.width,o.x=s-a*e.x),n&&(a=h.height-u.height,o.y=r-a*e.y)}return o},i._moveContentToTopLeft=function(t){var e=this._getContentBottomBoundary()-this._bottomBoundary;e=-e;var i=new _n,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===Ig.SCALE&&this._calculateBoundary()},i._xrHoverEnter=function(t){t.deviceType===wht.Left?this._hoverIn=Ylt.LEFT:t.deviceType===wht.Right&&(this._hoverIn=Ylt.RIGHT)},i._xrHoverExit=function(){this._hoverIn=Ylt.NONE},i._dispatchEventHandleInput=function(t){var e,i;t instanceof nw?e=t.gamepad:t instanceof rw&&(e=t.handleInputDevice),this.enabledInHierarchy&&this._hoverIn!==Ylt.NONE&&(this._hoverIn===Ylt.LEFT?(i=e.leftStick.getValue()).equals(Hn.ZERO)||this._xrThumbStickMove(i):this._hoverIn===Ylt.RIGHT&&((i=e.rightStick.getValue()).equals(Hn.ZERO)||this._xrThumbStickMove(i)))},i._xrThumbStickMove=function(t){if(this.enabledInHierarchy){var e=new _n,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._deltaAmount.add(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()):X(4302)}}},{key:"horizontalScrollBar",get:function(){return this._horizontalScrollBar&&!this._horizontalScrollBar.isValid&&Z(4303,"horizontal",this.node.name),this._horizontalScrollBar},set:function(t){this._horizontalScrollBar!==t&&(this._horizontalScrollBar=t,this._horizontalScrollBar&&(this._horizontalScrollBar.setScrollView(this),this._updateScrollBar(Hn.ZERO)))}},{key:"verticalScrollBar",get:function(){return this._verticalScrollBar&&!this._verticalScrollBar.isValid&&Z(4303,"vertical",this.node.name),this._verticalScrollBar},set:function(t){this._verticalScrollBar!==t&&(this._verticalScrollBar=t,this._verticalScrollBar&&(this._verticalScrollBar.setScrollView(this),this._updateScrollBar(Hn.ZERO)))}},{key:"view",get:function(){var t=this._content&&this._content.parent;return t?t._uiProps.uiTransformComp:null}}]),e}(Xlt)).EventType=jlt,Mlt=ua((Plt=Wlt).prototype,"bounceDuration",[wa],(function(){return 1})),Nlt=ua(Plt.prototype,"brake",[wa],(function(){return.5})),Llt=ua(Plt.prototype,"elastic",[wa],(function(){return!0})),Blt=ua(Plt.prototype,"inertia",[wa],(function(){return!0})),f(Plt.prototype,"content",[wlt],Object.getOwnPropertyDescriptor(Plt.prototype,"content"),Plt.prototype),Flt=ua(Plt.prototype,"horizontal",[wa],(function(){return!0})),f(Plt.prototype,"horizontalScrollBar",[Ilt],Object.getOwnPropertyDescriptor(Plt.prototype,"horizontalScrollBar"),Plt.prototype),klt=ua(Plt.prototype,"vertical",[wa],(function(){return!0})),f(Plt.prototype,"verticalScrollBar",[xlt],Object.getOwnPropertyDescriptor(Plt.prototype,"verticalScrollBar"),Plt.prototype),Ult=ua(Plt.prototype,"cancelInnerEvents",[wa],(function(){return!0})),Glt=ua(Plt.prototype,"scrollEvents",[Dlt,wa],(function(){return[]})),Hlt=ua(Plt.prototype,"_content",[wa],(function(){return null})),zlt=ua(Plt.prototype,"_horizontalScrollBar",[wa],(function(){return null})),Vlt=ua(Plt.prototype,"_verticalScrollBar",[wa],(function(){return null})),Olt=Plt))||Olt)||Olt)||Olt);t({ScrollView:f_t,ScrollViewComponent:f_t}),m.ScrollView=f_t;var p_t,g_t=new _n;!function(t){t[t.Horizontal=0]="Horizontal",t[t.Vertical=1]="Vertical"}(p_t||(p_t={})),Se(p_t);var m_t,v_t,y_t,T_t,E_t,S_t,A_t,b_t,C_t,R_t,w_t,I_t,x_t=(e_t=va("cc.Slider"),i_t=Ta(110),n_t=ya(RN),r_t=Za(PF),s_t=Za(p_t),o_t=Za([Rp]),e_t(a_t=i_t(a_t=n_t(((d_t=function(t){function e(){var e;return(e=t.call(this)||this).slideEvents=u_t&&u_t(),e._handle=c_t&&c_t(),e._direction=l_t&&l_t(),e._progress=__t&&__t(),e._offset=new _n,e._dragging=!1,e._touchHandle=!1,e._handleLocalPos=new _n,e._touchPos=new _n,e}s(e,t);var i=e.prototype;return i.__preload=function(){this._updateHandlePosition()},i.onEnable=function(){this._updateHandlePosition(),this.node.on(Dg.TOUCH_START,this._onTouchBegan,this),this.node.on(Dg.TOUCH_MOVE,this._onTouchMoved,this),this.node.on(Dg.TOUCH_END,this._onTouchEnded,this),this.node.on(Dg.TOUCH_CANCEL,this._onTouchCancelled,this),this.node.on(Iht.XRUI_HOVER_STAY,this._xrHoverStay,this),this.node.on(Iht.XRUI_CLICK,this._xrClick,this),this.node.on(Iht.XRUI_UNCLICK,this._xrUnClick,this),this._handle&&this._handle.isValid&&(this._handle.node.on(Dg.TOUCH_START,this._onHandleDragStart,this),this._handle.node.on(Dg.TOUCH_MOVE,this._onTouchMoved,this),this._handle.node.on(Dg.TOUCH_END,this._onTouchEnded,this))},i.onDisable=function(){this.node.off(Dg.TOUCH_START,this._onTouchBegan,this),this.node.off(Dg.TOUCH_MOVE,this._onTouchMoved,this),this.node.off(Dg.TOUCH_END,this._onTouchEnded,this),this.node.off(Dg.TOUCH_CANCEL,this._onTouchCancelled,this),this.node.off(Iht.XRUI_HOVER_STAY,this._xrHoverStay,this),this.node.off(Iht.XRUI_CLICK,this._xrClick,this),this.node.off(Iht.XRUI_UNCLICK,this._xrUnClick,this),this._handle&&this._handle.isValid&&(this._handle.node.off(Dg.TOUCH_START,this._onHandleDragStart,this),this._handle.node.off(Dg.TOUCH_MOVE,this._onTouchMoved,this),this._handle.node.off(Dg.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();_n.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 _n,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(){Rp.emitEvents(this.slideEvents,this),this.node.emit("slide",this)},i._updateProgress=function(t){if(this._handle&&t){var e=t.getUILocation();_n.set(this._touchPos,e.x,e.y,0);var i=this.node._uiProps.uiTransformComp,n=i.convertToNodeSpaceAR(this._touchPos,g_t);this.direction===p_t.Horizontal?this.progress=Mi(.5+(n.x-this._offset.x)/i.width):this.progress=Mi(.5+(n.y-this._offset.y)/i.height)}},i._updateHandlePosition=function(){if(this._handle){this._handleLocalPos.set(this._handle.node.position);var t=this.node._uiProps.uiTransformComp;this._direction===p_t.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===p_t.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,g_t),this.direction===p_t.Horizontal?this.progress=Mi(.5+(g_t.x-this.node.position.x)/e.width):this.progress=Mi(.5+(g_t.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}(xp)).Direction=p_t,f((h_t=d_t).prototype,"handle",[r_t],Object.getOwnPropertyDescriptor(h_t.prototype,"handle"),h_t.prototype),f(h_t.prototype,"direction",[s_t],Object.getOwnPropertyDescriptor(h_t.prototype,"direction"),h_t.prototype),u_t=ua(h_t.prototype,"slideEvents",[o_t,wa],(function(){return[]})),c_t=ua(h_t.prototype,"_handle",[wa],(function(){return null})),l_t=ua(h_t.prototype,"_direction",[wa],(function(){return p_t.Horizontal})),__t=ua(h_t.prototype,"_progress",[wa],(function(){return.1})),a_t=h_t))||a_t)||a_t)||a_t);function D_t(){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:x_t,SliderComponent:x_t}),m.Slider=x_t,function(t){t.TOGGLE="toggle"}(I_t||(I_t={}));var O_t,P_t,M_t,N_t,L_t,B_t,F_t,k_t=(m_t=va("cc.Toggle"),v_t=Ta(110),y_t=ya(RN),T_t=Za(PF),E_t=Za([Rp]),m_t(S_t=v_t(S_t=y_t(((w_t=function(t){function e(){var e;return(e=t.call(this)||this).checkEvents=b_t&&b_t(),e._isChecked=C_t&&C_t(),e._checkMark=R_t&&R_t(),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&&Rp.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 m.Node.isNode(t)?t.getComponent("cc.ToggleContainer"):null}}]),e}(gut)).EventType=D_t(I_t,fut),f((A_t=w_t).prototype,"checkMark",[T_t],Object.getOwnPropertyDescriptor(A_t.prototype,"checkMark"),A_t.prototype),b_t=ua(A_t.prototype,"checkEvents",[E_t,wa],(function(){return[]})),C_t=ua(A_t.prototype,"_isChecked",[wa],(function(){return!0})),R_t=ua(A_t.prototype,"_checkMark",[wa],(function(){return null})),S_t=A_t))||S_t)||S_t)||S_t);t({Toggle:k_t,ToggleComponent:k_t}),m.Toggle=k_t;var U_t,G_t,H_t,z_t,V_t,W_t,X_t,j_t,Y_t,K_t,q_t,Q_t,Z_t,J_t,$_t,tdt,edt,idt,ndt,rdt,sdt,odt,adt,hdt,udt,cdt,ldt=(O_t=va("cc.ToggleContainer"),P_t=Ta(110),M_t=Za([Rp]),O_t(N_t=P_t((L_t=function(t){function e(){var e;return(e=t.call(this)||this)._allowSwitchOff=B_t&&B_t(),e.checkEvents=F_t&&F_t(),e}s(e,t);var i=e.prototype;return i.onEnable=function(){this.ensureValidState(),this.node.on(Dg.CHILD_ADDED,this.ensureValidState,this),this.node.on(Dg.CHILD_REMOVED,this.ensureValidState,this)},i.onDisable=function(){this.node.off(Dg.CHILD_ADDED,this.ensureValidState,this),this.node.off(Dg.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&&m.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}(xp),B_t=ua(L_t.prototype,"_allowSwitchOff",[wa],(function(){return!1})),F_t=ua(L_t.prototype,"checkEvents",[M_t,wa],(function(){return[]})),N_t=L_t))||N_t)||N_t);t({ToggleContainer:ldt,ToggleContainerComponent:ldt}),m.ToggleContainer=ldt;var _dt,ddt,fdt=new Hn;function pdt(t){return t instanceof jR?ko:t._uiProps.uiTransformComp?t._uiProps.uiTransformComp.contentSize:Xn.ZERO}function gdt(t,e,i,n){t.parent?fdt.set(t.parent.scale.x,t.parent.scale.y):fdt.set(0,0);for(var r=fdt.x,s=fdt.y,o=0,a=0,h=t.parent;;){if(!h)return i.x=i.y=0,void(n.x=n.y=1);var u=h.position;if(o+=u.x,a+=u.y,(h=h.parent)===e)break;h?fdt.set(h.scale.x,h.scale.y):fdt.set(0,0);var c=fdt.x,l=fdt.y;o*=c,a*=l,r*=c,s*=l}n.x=0!==r?1/r:1,n.y=0!==s?1/s:1,i.x=-o,i.y=-a}!function(t){t[t.ONCE=0]="ONCE",t[t.ALWAYS=1]="ALWAYS",t[t.ON_WINDOW_RESIZE=2]="ON_WINDOW_RESIZE"}(_dt||(_dt={})),Se(_dt),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"}(ddt||(ddt={}));var mdt,vdt,ydt,Tdt,Edt,Sdt,Adt,bdt,Cdt,Rdt,wdt,Idt,xdt=ddt.TOP|ddt.BOT,Ddt=ddt.LEFT|ddt.RIGHT,Odt=(U_t=va("cc.Widget"),G_t=Ta(110),H_t=ya(RN),z_t=Za(Tm),V_t=Za(_dt),U_t(W_t=G_t(W_t=H_t(((cdt=function(t){function e(){var e;return(e=t.call(this)||this)._lastPos=new _n,e._lastSize=new Xn,e._dirty=!0,e._hadAlignOnce=!1,e._alignFlags=j_t&&j_t(),e._target=Y_t&&Y_t(),e._left=K_t&&K_t(),e._right=q_t&&q_t(),e._top=Q_t&&Q_t(),e._bottom=Z_t&&Z_t(),e._horizontalCenter=J_t&&J_t(),e._verticalCenter=$_t&&$_t(),e._isAbsLeft=tdt&&tdt(),e._isAbsRight=edt&&edt(),e._isAbsTop=idt&&idt(),e._isAbsBottom=ndt&&ndt(),e._isAbsHorizontalCenter=rdt&&rdt(),e._isAbsVerticalCenter=sdt&&sdt(),e._originalWidth=odt&&odt(),e._originalHeight=adt&&adt(),e._alignMode=hdt&&hdt(),e._lockFlags=udt&&udt(),e}s(e,t);var i=e.prototype;return i.updateAlignment=function(){m._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),m._widgetManager.add(this),this._hadAlignOnce=!1,this._registerEvent(),this._registerTargetEvents()},i.onDisable=function(){m._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(Dg.TRANSFORM_CHANGED,this._setDirtyByMode,this),this.node.on(Dg.SIZE_CHANGED,this._setDirtyByMode,this),this.node.on(Dg.ANCHOR_CHANGED,this._adjustWidgetToAnchorChanged,this),this.node.on(Dg.PARENT_CHANGED,this._adjustTargetToParentChanged,this)},i._unregisterEvent=function(){this.node.off(Dg.TRANSFORM_CHANGED,this._setDirtyByMode,this),this.node.off(Dg.SIZE_CHANGED,this._setDirtyByMode,this),this.node.off(Dg.ANCHOR_CHANGED,this._adjustWidgetToAnchorChanged,this)},i._removeParentEvent=function(){this.node.off(Dg.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:ko;this.isAlignLeft&&t===ddt.LEFT?this._left=e?this._left*r.width:this._left/r.width:this.isAlignRight&&t===ddt.RIGHT?this._right=e?this._right*r.width:this._right/r.width:this.isAlignHorizontalCenter&&t===ddt.CENTER?this._horizontalCenter=e?this._horizontalCenter*r.width:this._horizontalCenter/r.width:this.isAlignTop&&t===ddt.TOP?this._top=e?this._top*r.height:this._top/r.height:this.isAlignBottom&&t===ddt.BOT?this._bottom=e?this._bottom*r.height:this._bottom/r.height:this.isAbsoluteVerticalCenter&&t===ddt.MID&&(this._verticalCenter=this._verticalCenter/r.height),this._recursiveDirty()}},i._registerTargetEvents=function(){var t=this._target||this.node.parent;t&&t.getComponent(RN)&&(t.on(Dg.TRANSFORM_CHANGED,this._setDirtyByMode,this),t.on(Dg.SIZE_CHANGED,this._setDirtyByMode,this),t.on(Dg.ANCHOR_CHANGED,this._setDirtyByMode,this))},i._unregisterTargetEvents=function(){var t=this._target||this.node.parent;t&&(t.off(Dg.TRANSFORM_CHANGED,this._setDirtyByMode,this),t.off(Dg.SIZE_CHANGED,this._setDirtyByMode,this),t.off(Dg.ANCHOR_CHANGED,this._setDirtyByMode,this))},i._unregisterOldParentEvents=function(t){var e=this._target||t;e&&(e.off(Dg.TRANSFORM_CHANGED,this._setDirtyByMode,this),e.off(Dg.SIZE_CHANGED,this._setDirtyByMode,this))},i._setDirtyByMode=function(){this.alignMode===_dt.ALWAYS&&this._recursiveDirty()},i._setAlign=function(t,e){if(e!==(this._alignFlags&t)>0){var i=(t&Ddt)>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&ddt.TOP)>0},set:function(t){this._setAlign(ddt.TOP,t),this._recursiveDirty()}},{key:"isAlignBottom",get:function(){return(this._alignFlags&ddt.BOT)>0},set:function(t){this._setAlign(ddt.BOT,t),this._recursiveDirty()}},{key:"isAlignLeft",get:function(){return(this._alignFlags&ddt.LEFT)>0},set:function(t){this._setAlign(ddt.LEFT,t),this._recursiveDirty()}},{key:"isAlignRight",get:function(){return(this._alignFlags&ddt.RIGHT)>0},set:function(t){this._setAlign(ddt.RIGHT,t),this._recursiveDirty()}},{key:"isAlignVerticalCenter",get:function(){return(this._alignFlags&ddt.MID)>0},set:function(t){t?(this.isAlignTop=!1,this.isAlignBottom=!1,this._alignFlags|=ddt.MID):this._alignFlags&=~ddt.MID,this._recursiveDirty()}},{key:"isAlignHorizontalCenter",get:function(){return(this._alignFlags&ddt.CENTER)>0},set:function(t){t?(this.isAlignLeft=!1,this.isAlignRight=!1,this._alignFlags|=ddt.CENTER):this._alignFlags&=~ddt.CENTER,this._recursiveDirty()}},{key:"isStretchWidth",get:function(){return(this._alignFlags&Ddt)===Ddt}},{key:"isStretchHeight",get:function(){return(this._alignFlags&xdt)===xdt}},{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(ddt.TOP,this._isAbsTop))}},{key:"isAbsoluteBottom",get:function(){return this._isAbsBottom},set:function(t){this._isAbsBottom!==t&&(this._isAbsBottom=t,this._autoChangedValue(ddt.BOT,this._isAbsBottom))}},{key:"isAbsoluteLeft",get:function(){return this._isAbsLeft},set:function(t){this._isAbsLeft!==t&&(this._isAbsLeft=t,this._autoChangedValue(ddt.LEFT,this._isAbsLeft))}},{key:"isAbsoluteRight",get:function(){return this._isAbsRight},set:function(t){this._isAbsRight!==t&&(this._isAbsRight=t,this._autoChangedValue(ddt.RIGHT,this._isAbsRight))}},{key:"isAbsoluteHorizontalCenter",get:function(){return this._isAbsHorizontalCenter},set:function(t){this._isAbsHorizontalCenter!==t&&(this._isAbsHorizontalCenter=t,this._autoChangedValue(ddt.CENTER,this._isAbsHorizontalCenter))}},{key:"isAbsoluteVerticalCenter",get:function(){return this._isAbsVerticalCenter},set:function(t){this._isAbsVerticalCenter!==t&&(this._isAbsVerticalCenter=t,this._autoChangedValue(ddt.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}(xp)).AlignMode=_dt,f((X_t=cdt).prototype,"target",[z_t],Object.getOwnPropertyDescriptor(X_t.prototype,"target"),X_t.prototype),f(X_t.prototype,"alignMode",[V_t],Object.getOwnPropertyDescriptor(X_t.prototype,"alignMode"),X_t.prototype),j_t=ua(X_t.prototype,"_alignFlags",[wa],(function(){return 0})),Y_t=ua(X_t.prototype,"_target",[wa],(function(){return null})),K_t=ua(X_t.prototype,"_left",[wa],(function(){return 0})),q_t=ua(X_t.prototype,"_right",[wa],(function(){return 0})),Q_t=ua(X_t.prototype,"_top",[wa],(function(){return 0})),Z_t=ua(X_t.prototype,"_bottom",[wa],(function(){return 0})),J_t=ua(X_t.prototype,"_horizontalCenter",[wa],(function(){return 0})),$_t=ua(X_t.prototype,"_verticalCenter",[wa],(function(){return 0})),tdt=ua(X_t.prototype,"_isAbsLeft",[wa],(function(){return!0})),edt=ua(X_t.prototype,"_isAbsRight",[wa],(function(){return!0})),idt=ua(X_t.prototype,"_isAbsTop",[wa],(function(){return!0})),ndt=ua(X_t.prototype,"_isAbsBottom",[wa],(function(){return!0})),rdt=ua(X_t.prototype,"_isAbsHorizontalCenter",[wa],(function(){return!0})),sdt=ua(X_t.prototype,"_isAbsVerticalCenter",[wa],(function(){return!0})),odt=ua(X_t.prototype,"_originalWidth",[wa],(function(){return 0})),adt=ua(X_t.prototype,"_originalHeight",[wa],(function(){return 0})),hdt=ua(X_t.prototype,"_alignMode",[wa],(function(){return _dt.ON_WINDOW_RESIZE})),udt=ua(X_t.prototype,"_lockFlags",[wa,xa],(function(){return 0})),W_t=X_t))||W_t)||W_t)||W_t);t({Widget:Odt,WidgetComponent:Odt}),m.internal.computeInverseTransForTarget=gdt,m.internal.getReadonlyNodeSize=pdt,m.Widget=Odt;var Pdt,Mdt=new yn;!function(t){t[t.HORIZONTAL=0]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(Pdt||(Pdt={})),Se(Pdt);var Ndt,Ldt,Bdt,Fdt,kdt,Udt,Gdt,Hdt,zdt,Vdt,Wdt,Xdt,jdt,Ydt,Kdt,qdt,Qdt,Zdt,Jdt,$dt,tft,eft,ift,nft,rft=(mdt=va("cc.PageViewIndicator"),vdt=Ta(110),ydt=Za(TP),Tdt=Za(Pdt),Edt=Za(Xn),mdt(Sdt=vdt(((Idt=function(t){function e(){var e;return(e=t.call(this)||this).spacing=bdt&&bdt(),e._spriteFrame=Cdt&&Cdt(),e._direction=Rdt&&Rdt(),e._cellSize=wdt&&wdt(),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(tlt),this._layout||(this._layout=this.addComponent(tlt));var t=this._layout;this.direction===Pdt.HORIZONTAL?(t.type=tlt.Type.HORIZONTAL,t.spacingX=this.spacing):this.direction===Pdt.VERTICAL&&(t.type=tlt.Type.VERTICAL,t.spacingY=this.spacing),t.resizeMode=tlt.ResizeMode.CONTAINER},i._createIndicator=function(){var t=new Tm;t.layer=this.node.layer;var e=t.addComponent(PF);return e.spriteFrame=this.spriteFrame,e.sizeMode=PF.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;Mdt.set(r.color),Mdt.a=127.5,r.color=Mdt}}if(t[e]._uiProps.uiComp){var s=t[e]._uiProps.uiComp;Mdt.set(s.color),Mdt.a=255,s.color=Mdt}}}},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}(xp)).Direction=Pdt,f((Adt=Idt).prototype,"spriteFrame",[ydt],Object.getOwnPropertyDescriptor(Adt.prototype,"spriteFrame"),Adt.prototype),f(Adt.prototype,"direction",[Tdt],Object.getOwnPropertyDescriptor(Adt.prototype,"direction"),Adt.prototype),f(Adt.prototype,"cellSize",[Edt],Object.getOwnPropertyDescriptor(Adt.prototype,"cellSize"),Adt.prototype),bdt=ua(Adt.prototype,"spacing",[wa],(function(){return 0})),Cdt=ua(Adt.prototype,"_spriteFrame",[wa],(function(){return null})),Rdt=ua(Adt.prototype,"_direction",[wa],(function(){return Pdt.HORIZONTAL})),wdt=ua(Adt.prototype,"_cellSize",[wa],(function(){return new Xn(20,20)})),Sdt=Adt))||Sdt)||Sdt);t({PageViewIndicator:rft,PageViewIndicatorComponent:rft}),m.PageViewIndicator=rft;var sft,oft,aft,hft=new Hn;!function(t){t[t.Unified=0]="Unified",t[t.Free=1]="Free"}(sft||(sft={})),Se(sft),function(t){t[t.Horizontal=0]="Horizontal",t[t.Vertical=1]="Vertical"}(oft||(oft={})),Se(oft),function(t){t.PAGE_TURNING="page-turning"}(aft||(aft={}));var uft=(Ndt=va("cc.PageView"),Ldt=Ta(110),Bdt=Za(sft),Fdt=Za(oft),kdt=Za(rft),Udt=Za(Alt),Gdt=Za(Alt),Hdt=Za([Rp]),zdt=Za([Rp]),Ndt(Vdt=Ldt(((nft=function(t){function e(){var e;return(e=t.call(this)||this).autoPageTurningThreshold=Xdt&&Xdt(),e.horizontal=jdt&&jdt(),e.vertical=Ydt&&Ydt(),e.cancelInnerEvents=Kdt&&Kdt(),e.scrollEvents=qdt&&qdt(),e.pageTurningSpeed=Qdt&&Qdt(),e.pageEvents=Zdt&&Zdt(),e._sizeMode=Jdt&&Jdt(),e._direction=$dt&&$dt(),e._scrollThreshold=tft&&tft(),e._pageTurningEventTiming=eft&&eft(),e._indicator=ift&&ift(),e._curPageIdx=0,e._lastPageIdx=0,e._pages=[],e._initContentPos=dn(),e._scrollCenterOffsetX=[],e._scrollCenterOffsetY=[],e._touchBeganPosition=zn(),e._touchEndPosition=zn(),e}s(e,t);var i=e.prototype;return i.onEnable=function(){t.prototype.onEnable.call(this),this.node.on(Dg.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(Dg.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()):X(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 X(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):q(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(tlt);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===oft.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===sft.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(hft),Hn.set(this._touchBeganPosition,hft.x,hft.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(hft),Hn.set(this._touchEndPosition,hft.x,hft.y),t.prototype._onTouchEnded.call(this,e,i)},i._onTouchCancelled=function(e,i){e.touch.getUILocation(hft),Hn.set(this._touchEndPosition,hft.x,hft.y),t.prototype._onTouchCancelled.call(this,e,i)},i._onMouseWheel=function(){},i._syncScrollDirection=function(){this.horizontal=this.direction===oft.Horizontal,this.vertical=this.direction===oft.Vertical},i._syncSizeMode=function(){var t=this.view;if(this.content&&t){var e=this.content.getComponent(tlt);if(e){if(this._sizeMode===sft.Free&&this._pages.length>0){var i=this._pages[0]._uiProps.uiTransformComp,n=this._pages[this._pages.length-1]._uiProps.uiTransformComp;this.direction===oft.Horizontal?(e.paddingLeft=(t.width-i.width)/2,e.paddingRight=(t.width-n.width)/2):this.direction===oft.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,Rp.emitEvents(this.pageEvents,this,aft.PAGE_TURNING),this.node.emit(aft.PAGE_TURNING,this))},i._isQuicklyScrollable=function(t){if(this.direction===oft.Horizontal){if(Math.abs(t.x)>this.autoPageTurningThreshold)return!0}else if(this.direction===oft.Vertical&&Math.abs(t.y)>this.autoPageTurningThreshold)return!0;return!1},i._moveOffsetValue=function(t){var e=new Hn;if(this._sizeMode===sft.Free)this.direction===oft.Horizontal?e.x=this._scrollCenterOffsetX[t]:this.direction===oft.Vertical&&(e.y=this._scrollCenterOffsetY[t]);else{var i=this.view;if(!i)return e;this.direction===oft.Horizontal?e.x=t*i.width:this.direction===oft.Vertical&&(e.y=t*i.height)}return e},i._getDragDirection=function(t){return this._direction===oft.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===sft.Free){var n=0,r=0;if(this.direction===oft.Horizontal)return n=this._scrollCenterOffsetX[e],r=this._scrollCenterOffsetX[i],Math.abs(t.x)>=Math.abs(n-r)*this.scrollThreshold;if(this.direction===oft.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===oft.Horizontal)return Math.abs(t.x)>=s.width*this.scrollThreshold;if(this.direction===oft.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 Hn;Hn.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}(f_t)).SizeMode=sft,nft.Direction=oft,nft.EventType=D_t(aft,jlt),f((Wdt=nft).prototype,"sizeMode",[Bdt],Object.getOwnPropertyDescriptor(Wdt.prototype,"sizeMode"),Wdt.prototype),f(Wdt.prototype,"direction",[Fdt],Object.getOwnPropertyDescriptor(Wdt.prototype,"direction"),Wdt.prototype),f(Wdt.prototype,"indicator",[kdt],Object.getOwnPropertyDescriptor(Wdt.prototype,"indicator"),Wdt.prototype),Xdt=ua(Wdt.prototype,"autoPageTurningThreshold",[wa],(function(){return 100})),f(Wdt.prototype,"verticalScrollBar",[Udt,hh],Object.getOwnPropertyDescriptor(Wdt.prototype,"verticalScrollBar"),Wdt.prototype),f(Wdt.prototype,"horizontalScrollBar",[Gdt,hh],Object.getOwnPropertyDescriptor(Wdt.prototype,"horizontalScrollBar"),Wdt.prototype),jdt=ua(Wdt.prototype,"horizontal",[hh,wa],(function(){return!0})),Ydt=ua(Wdt.prototype,"vertical",[hh,wa],(function(){return!0})),Kdt=ua(Wdt.prototype,"cancelInnerEvents",[hh,wa],(function(){return!0})),qdt=ua(Wdt.prototype,"scrollEvents",[Hdt,wa,hh],(function(){return[]})),Qdt=ua(Wdt.prototype,"pageTurningSpeed",[wa],(function(){return.3})),Zdt=ua(Wdt.prototype,"pageEvents",[zdt,wa],(function(){return[]})),Jdt=ua(Wdt.prototype,"_sizeMode",[wa],(function(){return sft.Unified})),$dt=ua(Wdt.prototype,"_direction",[wa],(function(){return oft.Horizontal})),tft=ua(Wdt.prototype,"_scrollThreshold",[wa],(function(){return.5})),eft=ua(Wdt.prototype,"_pageTurningEventTiming",[wa],(function(){return.1})),ift=ua(Wdt.prototype,"_indicator",[wa],(function(){return null})),Vdt=Wdt))||Vdt)||Vdt);t({PageView:uft,PageViewComponent:uft}),m.PageView=uft;var cft=new _n,lft=new Hn,_ft=new Hn,dft=new Hn(1,1),fft=new Hn,pft=new Hn;function gft(t,e){if(!e._hadAlignOnce){e.alignMode===_dt.ONCE&&(e._hadAlignOnce=!0);var i,n=e.target,r=_ft,s=dft;n?gdt(t,i=n,r,s):i=t.parent;var o=pdt(i),a=i instanceof jR||!i.getComponent(RN),h=a?lft:i.getComponent(RN).anchorPoint,u=a;t.getPosition(cft);var c=t._uiProps.uiTransformComp,l=cft.x,_=cft.y,d=c.anchorPoint,f=t.scale;if(e.alignFlags&ddt.HORIZONTAL){var p=0,g=0,m=o.width;u?(p=ko.left.x,g=ko.right.x):g=(p=-h.x*m)+m,p+=e.isAbsoluteLeft?e.left:e.left*m,g-=e.isAbsoluteRight?e.right:e.right*m,n&&(p+=r.x,p*=s.x,g+=r.x,g*=s.x);var v=0,y=d.x,T=f.x;if(T<0&&(y=1-y,T=-T),e.isStretchWidth)v=g-p,0!==T&&(c.width=v/T),l=p+y*v;else{if(v=c.width*T,e.isAlignHorizontalCenter){var E=e.isAbsoluteHorizontalCenter?e.horizontalCenter:e.horizontalCenter*m,S=(.5-h.x)*o.width;n&&(E*=s.x,S+=r.x,S*=s.x),l=S+(y-.5)*v+E}else l=e.isAlignLeft?p+y*v:g+(y-1)*v;Oi(T,0,xi)?v=c.width:v/=T}e._lastSize.width=v}if(e.alignFlags&ddt.VERTICAL){var A=0,b=0,C=o.height;u?(b=ko.bottom.y,A=ko.top.y):A=(b=-h.y*C)+C,b+=e.isAbsoluteBottom?e.bottom:e.bottom*C,A-=e.isAbsoluteTop?e.top:e.top*C,n&&(b+=r.y,b*=s.y,A+=r.y,A*=s.y);var R=0,w=d.y,I=f.y;if(I<0&&(w=1-w,I=-I),e.isStretchHeight)R=A-b,0!==I&&(c.height=R/I),_=b+w*R;else{if(R=c.height*I,e.isAlignVerticalCenter){var x=e.isAbsoluteVerticalCenter?e.verticalCenter:e.verticalCenter*C,D=(.5-h.y)*o.height;n&&(x*=s.y,D+=r.y,D*=s.y),_=D+(w-.5)*R+x}else _=e.isAlignBottom?b+w*R:A+(w-1)*R;Oi(I,0,xi)?R=c.height:R/=I}e._lastSize.height=R}t.setPosition(l,_,cft.z),_n.set(e._lastPos,l,_,cft.z)}}function mft(t){var e=t.getComponent(Odt);if(e&&e.enabled){if(!m.isValid(t,!0))return;Sft.push(e)}for(var i,n=d(t.children);!(i=n()).done;){var r=i.value;r.active&&mft(r)}}function vft(){var t=DD.getScene();if(t){Aft.isAligning=!0,Aft._nodesOrderDirty&&(Sft.length=0,mft(t),Aft._nodesOrderDirty=!1);var e=null,i=Aft._activeWidgetsIterator;for(i.i=0;i.i<Sft.length;++i.i)(e=Sft[i.i])._dirty&&(gft(e.node,e),e._dirty=!1);Aft.isAligning=!1}}var yft,Tft,Eft,Sft=[],Aft=t("widgetManager",m._widgetManager={isAligning:!1,_nodesOrderDirty:!1,_activeWidgetsIterator:new oe(Sft),animationState:null,init:function(){DD.on(ID.EVENT_AFTER_SCENE_LAUNCH,vft),DD.on(ID.EVENT_AFTER_UPDATE,vft),uO.instance.on("design-resolution-changed",this.onResized,this);var t=this.onResized.bind(this);uO.instance.on("canvas-resize",t),No.on("window-resize",t)},add:function(){this._nodesOrderDirty=!0},remove:function(t){this._activeWidgetsIterator.remove(t)},onResized:function(){var t=DD.getScene();t&&this.refreshWidgetOnResized(t)},refreshWidgetOnResized:function(t){var e=Tm.isNode(t)&&t.getComponent(Odt);e&&e.enabled&&(e.alignMode===_dt.ON_WINDOW_RESIZE||e.alignMode===_dt.ALWAYS)&&e.setDirty();for(var i,n=d(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=fft;s.set(0,0);var o=pft;if(o.set(1,1),t.target&&gdt(n,r=t.target,s,o),!e)return;var a=r._uiProps&&r._uiProps.uiTransformComp,h=a?a.anchorPoint:lft,u=n._uiProps.uiTransformComp,c=pdt(r),l=u.anchorPoint,_=n.position,d=ddt,f=n.scale,p=0;if(e&d.LEFT){var g=-h.x*c.width;g+=s.x,g*=o.x,p=_.x-l.x*u.width*Math.abs(f.x)-g,t.isAbsoluteLeft||(p/=c.width),p/=o.x,t.left=i(t.left,p)}if(e&d.RIGHT){var m=(1-h.x)*c.width;m+=s.x,p=(m*=o.x)-(_.x+(1-l.x)*u.width*Math.abs(f.x)),t.isAbsoluteRight||(p/=c.width),p/=o.x,t.right=i(t.right,p)}if(e&d.TOP){var v=(1-h.y)*c.height;v+=s.y,p=(v*=o.y)-(_.y+(1-l.y)*u.height*Math.abs(f.y)),t.isAbsoluteTop||(p/=c.height),p/=o.y,t.top=i(t.top,p)}if(e&d.BOT){var y=-h.y*c.height;y+=s.y,y*=o.y,p=_.y-l.y*u.height*Math.abs(f.y)-y,t.isAbsoluteBottom||(p/=c.height),p/=o.y,t.bottom=i(t.bottom,p)}}},updateAlignment:function t(e){var i=e.parent;i&&Tm.isNode(i)&&t(i);var n=e.getComponent(Odt);n&&i&&gft(e,n)},AlignMode:_dt,AlignFlags:ddt});DD.on(ID.EVENT_INIT,(function(){Aft.init()}));var bft,Cft,Rft,wft,Ift,xft,Dft,Oft,Pft,Mft,Nft,Lft,Bft=va("cc.SafeArea")(yft=Ta(110)(yft=ya(Odt)((Tft=function(t){function e(){var e;return(e=t.call(this)||this)._symmetric=Eft&&Eft(),e}s(e,t);var i=e.prototype;return i.onEnable=function(){this.updateArea(),No.on("window-resize",this.updateArea,this),No.on("orientation-change",this.updateArea,this)},i.onDisable=function(){No.off("window-resize",this.updateArea,this),No.off("orientation-change",this.updateArea,this)},i.updateArea=function(){var t=this.node.getComponent(Odt),e=this.node.getComponent(RN);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=TO.getVisibleSize(),s=r.width,o=r.height,a=Fo.getSafeAreaRect(this._symmetric);t.top=o-a.y-a.height,t.bottom=a.y,t.left=a.x,t.right=s-a.x-a.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),Aft.add(t)}},n(e,[{key:"symmetric",get:function(){return this._symmetric},set:function(t){this._symmetric=t}}]),e}(xp),Eft=ua(Tft.prototype,"_symmetric",[wa],(function(){return!0})),yft=Tft))||yft)||yft)||yft;t({SafeArea:Bft,SafeAreaComponent:Bft}),m.SafeArea=Bft;var Fft,kft=(bft=va("cc.UICoordinateTracker"),Cft=Ta(110),Rft=Za(Tm),wft=Za(Lk),Ift=Za([Rp]),bft(xft=Cft((f((Dft=function(t){function e(){var e;return(e=t.call(this)||this).syncEvents=Oft&&Oft(),e._target=Pft&&Pft(),e._camera=Mft&&Mft(),e._useScale=Nft&&Nft(),e._distance=Lft&&Lft(),e._transformPos=dn(),e._viewPos=dn(),e._canMove=!0,e._lastWPos=dn(),e._lastCameraPos=dn(),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&&_n.transformMat4(this._viewPos,this.node.worldPosition,e.camera.matView),this.syncEvents.length>0)){var i=this._distance/Math.abs(this._viewPos.z);Rp.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}(xp)).prototype,"target",[Rft],Object.getOwnPropertyDescriptor(Dft.prototype,"target"),Dft.prototype),f(Dft.prototype,"camera",[wft],Object.getOwnPropertyDescriptor(Dft.prototype,"camera"),Dft.prototype),Oft=ua(Dft.prototype,"syncEvents",[Ift,wa],(function(){return[]})),Pft=ua(Dft.prototype,"_target",[wa],(function(){return null})),Mft=ua(Dft.prototype,"_camera",[wa],(function(){return null})),Nft=ua(Dft.prototype,"_useScale",[wa],(function(){return!0})),Lft=ua(Dft.prototype,"_distance",[wa],(function(){return 1})),xft=Dft))||xft)||xft);t({UICoordinateTracker:kft,UICoordinateTrackerComponent:kft});var Uft=[Dg.TOUCH_START,Dg.TOUCH_END,Dg.TOUCH_MOVE,Dg.MOUSE_DOWN,Dg.MOUSE_MOVE,Dg.MOUSE_UP,Dg.MOUSE_ENTER,Dg.MOUSE_LEAVE,Dg.MOUSE_WHEEL];function Gft(t){t.propagationStopped=!0}var Hft,zft,Vft,Wft,Xft=va("cc.BlockInputEvents")(Fft=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<Uft.length;t++)this.node.on(Uft[t],Gft,this)},i.onDisable=function(){for(var t=0;t<Uft.length;t++)this.node.off(Uft[t],Gft,this)},e}(xp))||Fft;t({BlockInputEvents:Xft,BlockInputEventsComponent:Xft});var jft,Yft=t("SubContextView",va("cc.SubContextView")(Hft=Ta(110)(Hft=ya(RN)((zft=function(t){function e(){var e;return(e=t.call(this)||this)._fps=Vft&&Vft(),e._sprite=null,e._imageAsset=new $f,e._texture=new Sg,e._updatedTime=0,e._updateInterval=0,e._openDataContext=null,e._content=new Tm("content"),e._designResolutionSize=Wft&&Wft(),e._content.hideFlags|=qs.Flags.DontSave|qs.Flags.HideInHierarchy,e._updatedTime=performance.now(),e}s(e,t);var i=e.prototype;return i.onLoad=function(){xs.getOpenDataContext?(this._updateInterval=1e3/this._fps,this._openDataContext=xs.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,n=513;if(e<=n&&i<=n){var r=n/e,s=n/i,o=r<s?r:s;e*=o,i*=o}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(PF),this._sprite||(this._sprite=this._content.addComponent(PF)),this._sprite.spriteFrame)this._sprite.spriteFrame.texture=this._texture;else{var i=new TP;i.texture=this._texture,this._sprite.spriteFrame=i}this._content.parent=this.node}},i._updateSubContextView=function(){if(this._openDataContext){var t=this.node.getComponent(RN),e=this._content.getComponent(RN),i=t.width/e.width,n=t.height/e.height,r=i>n?n:i;e.width*=r,e.height*=r;var s=TO.getViewportRect(),o=e.getBoundingBoxToWorld(),a=TO.getVisibleSize(),h=No.devicePixelRatio,u=(s.width*(o.x/a.width)+s.x)/h,c=(s.height*(o.y/a.height)+s.y)/h,l=s.width*(o.width/a.width)/h,_=s.height*(o.height/a.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(Dg.TRANSFORM_CHANGED,this._updateSubContextView,this),this.node.on(Dg.SIZE_CHANGED,this._updateSubContextView,this),this.node.on(Dg.LAYER_CHANGED,this._updateContentLayer,this)},i._unregisterNodeEvent=function(){this.node.off(Dg.TRANSFORM_CHANGED,this._updateSubContextView,this),this.node.off(Dg.SIZE_CHANGED,this._updateSubContextView,this),this.node.off(Dg.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}(xp),Vft=ua(zft.prototype,"_fps",[wa],(function(){return 60})),Wft=ua(zft.prototype,"_designResolutionSize",[wa],(function(){return new Xn(640,960)})),Hft=zft))||Hft)||Hft)||Hft);m.SubContextView=Yft,gt({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 Kft,qft=t("UIReorderComponent",va("cc.UIReorderComponent")(jft=function(){q(1408,"UIReorderComponent")})||jft);m.UIReorderComponent=qft,m.ButtonComponent=gut,Jt(gut,"cc.ButtonComponent"),m.EditBoxComponent=kct,Jt(kct,"cc.EditBoxComponent"),m.LayoutComponent=tlt,Jt(tlt,"cc.LayoutComponent"),m.ProgressBarComponent=flt,Jt(flt,"cc.ProgressBarComponent"),m.ScrollViewComponent=f_t,Jt(f_t,"cc.ScrollViewComponent"),m.ScrollBarComponent=Alt,Jt(Alt,"cc.ScrollBarComponent"),m.SliderComponent=x_t,Jt(x_t,"cc.SliderComponent"),m.ToggleComponent=k_t,Jt(k_t,"cc.ToggleComponent"),m.ToggleContainerComponent=ldt,Jt(ldt,"cc.ToggleContainerComponent"),m.WidgetComponent=Odt,Jt(Odt,"cc.WidgetComponent"),m.PageViewComponent=uft,Jt(uft,"cc.PageViewComponent"),m.PageViewIndicatorComponent=rft,Jt(rft,"cc.PageViewIndicatorComponent"),m.SafeAreaComponent=Bft,Jt(Bft,"cc.SafeAreaComponent"),Jt(kft,"cc.UICoordinateTrackerComponent"),m.BlockInputEventsComponent=Xft,Jt(Xft,"cc.BlockInputEventsComponent"),st(uO.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"}]),ot(uO.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"}]),function(t){t.NONE="none",t.LOADING="loading",t.LOADED="loaded",t.ERROR="error"}(Kft||(Kft={}));var Qft=function(){function t(t){this._componentEventList=new Map,this._state=Kft.NONE,this._wrapper=void 0,this._webview=null,this._loaded=!1,this._forceUpdate=!1,this._component=null,this._uiTrans=null,this._node=null,this._w=0,this._h=0,this._m00=0,this._m01=0,this._m04=0,this._m05=0,this._m12=0,this._m13=0,this._component=t,this._node=t.node,this._uiTrans=t.node.getComponent(RN),this.reset(),this.createWebView()}var e=t.prototype;return e.reset=function(){this._wrapper=null,this._webview=null,this._loaded=!1,this._w=0,this._h=0,this._m00=0,this._m01=0,this._m04=0,this._m05=0,this._m12=0,this._m13=0,this._state=Kft.NONE,this._forceUpdate=!1},e.dispatchEvent=function(t){var e=this._componentEventList.get(t);if(e){this._state=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.call(this,n)}},e.destroy=function(){this.removeWebView(),this._wrapper=null,this._webview=null,this._loaded=!1,this._component=null,this._uiTrans=null,this._forceUpdate=!1,this._componentEventList.clear()},n(t,[{key:"loaded",get:function(){return this._loaded}},{key:"componentEventList",get:function(){return this._componentEventList}},{key:"webview",get:function(){return this._webview}},{key:"state",get:function(){return this._state}},{key:"UICamera",get:function(){return DD.root.batcher2D.getFirstRenderCamera(this._node)}}]),t}();m.internal.WebViewImpl=Qft;var Zft,Jft,$ft,tpt,ept,ipt,npt,rpt,spt=y.document,opt=Un(),apt=function(t){function e(e){return t.call(this,e)||this}s(e,t);var i=e.prototype;return i._bindDomEvent=function(){var t=this;this.webview&&this.webview.addEventListener("load",(function(e){t._forceUpdate=!0,t.dispatchEvent(Kft.LOADED);var i=e.target,n=i.contentDocument&&i.contentDocument.body;n&&n.innerHTML.includes("404")&&t.dispatchEvent(Kft.ERROR,n.innerHTML)}))},i.loadURL=function(t){this.webview&&(this.webview.src=t,this.dispatchEvent(Kft.LOADING))},i.createWebView=function(){var t=spt.createElement("div");this._wrapper=t,t.id="webview-wrapper",t.style["-webkit-overflow"]="auto",t.style["-webkit-overflow-scrolling"]="touch",t.style.position="absolute",t.style.bottom="0px",t.style.left="0px",t.style.transformOrigin="0px 100% 0px",t.style["-webkit-transform-origin"]="0px 100% 0px",bO.container.appendChild(t);var e=spt.createElement("iframe");this._webview=e,e.id="webview",e.style.border="none",e.style.width="100%",e.style.height="100%",t.appendChild(e),this._bindDomEvent()},i.removeWebView=function(){var t=this._wrapper;Fe(bO.container,t)&&bO.container.removeChild(t),this.reset()},i.enable=function(){this._wrapper&&(this._wrapper.style.visibility="visible")},i.disable=function(){this._wrapper&&(this._wrapper.style.visibility="hidden")},i.evaluateJS=function(t){if(this.webview){var e=this.webview.contentWindow;if(e)try{e.eval(t)}catch(t){this.dispatchEvent(Kft.ERROR,t),k(t)}}},i.setOnJSCallback=function(){F("The platform does not support")},i.setJavascriptInterfaceScheme=function(){F("The platform does not support")},i.syncMatrix=function(){if(this._wrapper&&this._uiTrans&&this._component&&"hidden"!==this._wrapper.style.visibility){var t=this.UICamera;if(t){this._component.node.getWorldMatrix(opt),t.update(!0),t.worldMatrixToScreen(opt,opt,bO.canvas.width,bO.canvas.height);var e=this._uiTrans.contentSize,i=e.width,n=e.height;if(this._forceUpdate||this._m00!==opt.m00||this._m01!==opt.m01||this._m04!==opt.m04||this._m05!==opt.m05||this._m12!==opt.m12||this._m13!==opt.m13||this._w!==i||this._h!==n){this._m00=opt.m00,this._m01=opt.m01,this._m04=opt.m04,this._m05=opt.m05,this._m12=opt.m12,this._m13=opt.m13,this._w=i,this._h=n;var r=No.devicePixelRatio,s=1/r,o=1/r,a=bO.container,h=opt.m00*s,u=opt.m01,c=opt.m04,l=opt.m05*o;this._wrapper.style.width=i+"px",this._wrapper.style.height=n+"px";var _=this._w*s,d=this._h*o,f=_*opt.m00*this._uiTrans.anchorX,p=d*opt.m05*this._uiTrans.anchorY,g=a&&a.style.paddingLeft?parseInt(a.style.paddingLeft):0,m=a&&a.style.paddingBottom?parseInt(a.style.paddingBottom):0,v="matrix("+h+","+-u+","+-c+","+l+","+(opt.m12*s-f+g)+","+-(opt.m13*o-p+m)+")";this._wrapper.style.transform=v,this._wrapper.style["-webkit-transform"]=v,this._forceUpdate=!1}}}},e}(Qft),hpt=function(){function t(){}return t.getImpl=function(t){return new apt(t)},t}();m.internal.WebViewImplManager=hpt;var upt=t("WebView",(Zft=va("cc.WebView"),Jft=ya(RN),$ft=Za([Rp]),Zft(tpt=Jft(((rpt=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)._url=ipt&&ipt(),e._impl=null,e.webviewEvents=npt&&npt(),e}s(e,t);var i=e.prototype;return i.setJavascriptInterfaceScheme=function(t){this._impl&&this._impl.setJavascriptInterfaceScheme(t)},i.setOnJSCallback=function(t){this._impl&&this._impl.setOnJSCallback(t)},i.evaluateJS=function(t){this._impl&&this._impl.evaluateJS(t)},i.__preload=function(){this._impl=hpt.getImpl(this),this._impl.componentEventList.set(Kft.LOADING,this.onLoading.bind(this)),this._impl.componentEventList.set(Kft.LOADED,this.onLoaded.bind(this)),this._impl.componentEventList.set(Kft.ERROR,this.onError.bind(this)),this._impl.loadURL(this._url)},i.onLoading=function(){Rp.emitEvents(this.webviewEvents,this,Kft.LOADING),this.node.emit(Kft.LOADING,this)},i.onLoaded=function(){Rp.emitEvents(this.webviewEvents,this,Kft.LOADED),this.node.emit(Kft.LOADED,this)},i.onError=function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];Rp.emitEvents(this.webviewEvents,this,Kft.ERROR,e),this.node.emit(Kft.ERROR,this,e)},i.onEnable=function(){this._impl&&this._impl.enable()},i.onDisable=function(){this._impl&&this._impl.disable()},i.onDestroy=function(){this._impl&&(this._impl.destroy(),this._impl=null)},i.update=function(){this._impl&&this._impl.syncMatrix()},n(e,[{key:"url",get:function(){return this._url},set:function(t){this._url=t,this._impl&&this._impl.loadURL(t)}},{key:"nativeWebView",get:function(){return this._impl&&this._impl.webview||null}},{key:"state",get:function(){return this._impl?this._impl.state:Kft.NONE}}]),e}(xp)).EventType=Kft,ipt=ua((ept=rpt).prototype,"_url",[wa],(function(){return"https://cocos.com"})),npt=ua(ept.prototype,"webviewEvents",[wa,$ft],(function(){return[]})),tpt=ept))||tpt)||tpt));m.internal.WebView=upt}}}));