_virtual_cc-221d3ffa.js 2.2 MB

123
  1. System.register([],(function(t,e){"use strict";return{execute:function(){function i(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,(void 0,"symbol"==typeof(r=function(t,e){if("object"!=typeof t||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e);if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(n.key,"string"))?r:String(r)),n)}var r}function n(t,e,n){return e&&i(t.prototype,e),n&&i(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function r(){return(r=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t}).apply(this,arguments)}function s(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,o(t,e)}function a(t){return(a=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function o(t,e){return(o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function h(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function u(t,e,i){return(u=h()?Reflect.construct.bind():function(t,e,i){var n=[null];n.push.apply(n,e);var r=new(Function.bind.apply(t,n));return i&&o(r,i.prototype),r}).apply(null,arguments)}function l(t){var e="function"==typeof Map?new Map:void 0;return(l=function(t){if(null===t||(i=t,-1===Function.toString.call(i).indexOf("[native code]")))return t;var i;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return u(t,arguments,a(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),o(n,t)})(t)}function c(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({D:function(){return 0},J:QF,K:ZF,N:JF,P:function(t){return qF.test(t)},W:function(t){return KF.test(t)},X:tk,Y:ek,Z:ik,_:d,a$:mn,aL:kn,aN:un,aP:rn,aR:In,aU:Nn,aX:zn,aZ:Wn,at:I2,au:O2,aw:function(t,e){for(var i=t,n="";null!==i&&i!==e;)n=i.name+"/"+n,i=i.parent;return n.slice(0,-1)},ax:NZ,b4:wi,b5:xi,b6:Ii,b7:Oi,b8:Di,b9:Mi,bD:function(t){t>0&&(lt=t)},bH:mt,bI:function(t){for(var e,i=d(t);!(e=i()).done;)gt(e.value)},bJ:function(t){return dt||(dt="undefined"==typeof Proxy?{}:new Proxy(t,{get:function(t,e,i){return gt(e),Reflect.get(t,e,i)}})),dt},bK:Sl,bL:El,bO:gi,bP:vi,bZ:function(t){return t[na]},ba:Pi,bb:Bi,bc:Ni,bd:Li,be:Fi,bf:ki,bg:Ui,bh:Gi,bi:Hi,bj:zi,bk:Vi,bl:Wi,bm:Xi,bn:ji,bo:Yi,bp:$i,bq:tn,bw:me,bx:ve,by:Se,c$:function(t,e){return Bs(t,e,0)},c0:Zu,c2:z,c3:k,c4:G,c5:U,c6:H,c7:Y,c8:Z,c9:q,cA:Uh,cM:sa,cO:function(t,e,i){if(ge(t,e),ge(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},cR:hi,cS:ui,cV:Xa,cW:ja,cZ: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))}))}))},c_:V,ca:tt,cb:it,cc:nt,cd:et,cy:Bl,cz:Eh,d0:Bs,d1:function(t,e,i){for(var n=0,r=t.length-1,s=r>>>1;n<=r;s=n+r>>>1){var a=t[s];if(i(a,e)<0)r=s-1;else{if(!(i(a,e)>0))return s;n=s+1}}return~n},d2:function(){},d3:function(){},d4:ge,d5:Gl,dB:lN,dc:cB,e4:Fp,e6:y8,fF:dSt,fG:fSt}),p("CC_WECHAT",!1),p("CC_BAIDU",!1),p("CC_XIAOMI",!1),p("CC_ALIPAY",!1),p("CC_BYTEDANCE",!1),p("CC_OPPO",!1),p("CC_VIVO",!1),p("CC_HUAWEI",!1),p("CC_COCOSPLAY",!1),p("CC_QTT",!1),p("CC_LINKSURE",!1);const m=!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",!1),p("CC_RUNTIME_BASED",!1),p("CC_SUPPORT_JIT",!0),p("CC_JSB",!1);var g="undefined"==typeof window?global:window,v=t("aI",{_global:g});v.internal={};var y=t("aH","3.8.2");g.CocosEngine=v.ENGINE_VERSION=y,g.cc=v;var T=void 0!==globalThis.jsb&&void 0!==jsb.window?jsb.window:globalThis;g.ccwindow=T;var S=2147483647;function E(t){return(t>0)-(t<0)}function A(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 R(t){return 16843009*((t=(858993459&(t-=t>>>1&1431655765))+(t>>>2&858993459))+(t>>>4)&252645135)>>>24}function b(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 C(t){return--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,1+(t|=t>>>16)}var w=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}}(w);var x=Object.freeze({__proto__:null,INT_BITS:32,INT_MAX:S,INT_MIN:-2147483648,sign:E,abs:function(t){var e=t>>31;return(t^e)-e},min:function(t,e){return e^(t^e)&-(t<e)},max:function(t,e){return t^(t^e)&-(t<e)},isPow2:function(t){return!(t&t-1||!t)},log2:A,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:R,countTrailingZeros:b,nextPow2:C,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 w[255&t]<<24|w[t>>>8&255]<<16|w[t>>>16&255]<<8|w[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>>>b(t)+1}});t("aJ",x);var I=T.document,O="https://github.com/cocos-creator/engine/blob/develop/EngineErrorMap.md",D=null,M=console.log.bind(console),P=M,B=M,N=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: "+F.apply(void 0,[e].concat(n)))}},L=M;function F(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return v.js.formatStr.apply(null,e)}function k(){return M.apply(void 0,arguments)}function U(){return P.apply(void 0,arguments)}function G(){return B.apply(void 0,arguments)}function H(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 N.apply(void 0,[t,e].concat(n))}function z(){return L.apply(void 0,arguments)}function V(t){if(M=P=B=N=L=function(){},t!==J.NONE){if(t>J.ERROR){var e=function(t){if(v.game.canvas){if(!D){var e=I.createElement("Div");e.setAttribute("id","logInfoDiv"),e.setAttribute("width","200"),e.setAttribute("height",v.game.canvas.height);var i=e.style;i.zIndex="99999",i.position="absolute",i.top=i.left="0",(D=I.createElement("textarea")).setAttribute("rows","20"),D.setAttribute("cols","30"),D.setAttribute("disabled","true");var n=D.style;n.backgroundColor="transparent",n.borderBottom="1px solid #cccccc",n.borderTopWidth=n.borderLeftWidth=n.borderRightWidth="0px",n.borderTopStyle=n.borderLeftStyle=n.borderRightStyle="none",n.padding="0px",n.margin="0px",e.appendChild(D),v.game.canvas.parentNode.appendChild(e)}D.value=D.value+t+"\r\n",D.scrollTop=D.scrollHeight}};B=function(){e("ERROR : "+F.apply(void 0,arguments))},N=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: "+F.apply(void 0,[i].concat(r)))}},t!==J.ERROR_FOR_WEB_PAGE&&(P=function(){e("WARN : "+F.apply(void 0,arguments))}),t===J.INFO_FOR_WEB_PAGE&&(M=function(){e(F.apply(void 0,arguments))})}else console&&(console.error||(console.error=console.log),console.warn||(console.warn=console.log),B=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)},N=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=F.apply(void 0,[e].concat(n));throw new Error(s)}});if(t!==J.ERROR&&(P=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&&(M=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);L=function(){return i.apply(void 0,arguments)}}}}function W(t){G(t.stack||t)}function X(t){return function(e){for(var i=t+" "+e+", please go to "+O+"#"+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 j=X("Log");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];k(j.apply(void 0,[t].concat(i)))}var K=X("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];U(K.apply(void 0,[t].concat(i)))}var Q=X("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];G(Q.apply(void 0,[t].concat(i)))}var J,$=X("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];H(!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!!v.profiler&&v.profiler.isShowingStats()}function nt(t){v.profiler&&(t?v.profiler.showStats():v.profiler.hideStats())}t("ce",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("ce",J={}));var rt,st,at,ot,ht,ut=Object.freeze({__proto__:null,log:k,warn:U,error:G,assert:H,debug:z,_resetDebugSetting:V,_throw:W,logID:Y,warnID:q,errorID:Z,assertID:tt,get DebugMode(){return J},getError:et,isDisplayStats:it,setDisplayStats:nt}),lt=10;t("bE",rt),t("bF",st),t("bG",at);var ct=0,_t=new Map;ot=function(t,e,i,n,r,s,a){var o=_t.get(s);o&&o.logTimes>o.count&&(r("'%s' is deprecated, please use '%s' instead. "+a,t+"."+e,i+"."+n),o.count++)},t("bE",rt=function(t,e,i){null!=t&&i.forEach((function(i){var n=ct++;_t.set(n,{id:n,count:0,logTimes:void 0!==i.logTimes?i.logTimes:lt});var r=null!=i.target?i.target:t,s=null!=i.newName?i.newName:i.name,a=null!=i.targetName?i.targetName:e,o=r===t,h=i.suggest?"("+i.suggest+")":"";if(null!=i.customFunction)t[i.name]=function(){var t;return ot(e,i.name,a,s,U,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,l=null!=i.customGetter;u&&l?Object.defineProperty(t,i.name,{get:function(){return ot(e,i.name,a,s,U,n,h),i.customGetter.call(this)},set:function(t){ot(e,i.name,a,s,U,n,h),i.customSetter.call(this,t)},enumerable:!1}):u?Object.defineProperty(t,i.name,{set:function(t){ot(e,i.name,a,s,U,n,h),i.customSetter.call(this,t)},enumerable:!1}):l&&Object.defineProperty(t,i.name,{get:function(){return ot(e,i.name,a,s,U,n,h),i.customGetter.call(this)},enumerable:!1})}else Object.defineProperty(t,i.name,{get:function(){return ot(e,i.name,a,s,U,n,h),o?this[s]:r[s]},set:function(t){ot(e,i.name,a,s,U,n,h),o?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("bF",st=function(t,e,i){null!=t&&i.forEach((function(i){var n=ct++;_t.set(n,{id:n,count:0,logTimes:void 0!==i.logTimes?i.logTimes:lt});var r=i.suggest?"("+i.suggest+")":"";Object.defineProperty(t,i.name,{get:function(){return ht(e,i.name,G,n,r)},set:function(){ht(e,i.name,G,n,r)},enumerable:!1})}))}),t("bG",at=function(){});var dt,ft,pt={};function mt(t){for(var e in t){var i=t[e];pt[e]=i}}function gt(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=void 0,this.prefix=void 0,this.id=0|998*Math.random(),this.prefix=t?t+".":""}return t.prototype.getNewId=function(){return this.prefix+(++this.id).toString()},t}();ft=vt,vt.global=new ft("global");var yt=new vt("TmpCId."),Tt="undefined"==typeof Symbol?"__aliases__":Symbol("[[Aliases]]"),St="__cid__";function Et(t){return"number"==typeof t||t instanceof Number}function At(t){return"string"==typeof t||t instanceof String}function Rt(t){for(var e in t)return!1;return!0}var bt,Ct=(bt={value:void 0,enumerable:!1,writable:!1,configurable:!0},function(t,e,i,n,r){bt.value=i,bt.writable=n,bt.enumerable=r,Object.defineProperty(t,e,bt),bt.value=void 0}),wt=function(){var t={get:void 0,set:void 0,enumerable:!1};return function(e,i,n,r,s,a){void 0===s&&(s=!1),void 0===a&&(a=!1),"boolean"==typeof r&&(console.log("Set `setter` to boolean is deprecated. Please don not use like this again."),s=r,r=void 0),t.get=n,t.set=r,t.enumerable=s,t.configurable=a,Object.defineProperty(e,i,t),t.get=void 0,t.set=void 0}}(),xt=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}}(),It=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 Ot(t){var e=Object.create(null);return t&&(e["."]=1,e["/"]=1,delete e["."],delete e["/"]),e}function Dt(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?Dt(t.constructor):""}function Mt(t,e,i,n){var r=/([^.]+)$/,s=r.exec(e)[0],a=r.exec(i)[0];function o(){return this[a]}n?wt(t,s,o,(function(t){this[a]=t})):xt(t,s,o)}function Pt(t,e,i,n){for(var r in i)Mt(t,e+"."+r,i[r],n)}var Bt=/(%d)|(%s)/,Nt=/%s/;function Lt(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&&Bt.test(t);if(r)for(var s,a=d(i);!(s=a()).done;){var o=s.value,h="number"==typeof o?Bt:Nt;if(h.test(t)){var u=""+o;t=t.replace(h,u)}else t+=" "+o}else for(var l,c=d(i);!(l=c()).done;){var _=l.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 a=s[r];if(a){if("object"!=typeof a){Z(5402,a);continue}for(var o in a)o in t||Ut(o,a,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 a=s[r];if(a){if("object"!=typeof a){Z(5403,a);continue}for(var o in a)Ut(o,a,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=Ot(!0),Yt=Ot(!0);function Kt(t,e,i){return function(n,r){if(r.prototype.hasOwnProperty(t)&&delete e[r.prototype[t]],Ct(r.prototype,t,n),n){var s=e[n];!i&&s&&s!==r?G("A Class already exists with the same "+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(St)){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&&(G('"'+e+'" has already been set as name or alias of another class.'),r=!1),n&&n!==t&&(G('"'+e+'" has already been set as id or alias of another class.'),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],a=s.prototype,o=a.__cid__;o&&delete jt[o];var h=a.__classname__;h&&delete Yt[h];var u=a[Tt];if(u)for(var l=0;l<u.length;++l){var c=u[l];delete Yt[c],delete jt[c]}}}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(St))return t.prototype.__cid__;if(t&&t.constructor){var i=t.constructor.prototype;if(i&&i.hasOwnProperty(St))return t.__cid__}return""}var se=function(){var t=e.prototype;function e(t,e){this.count=void 0,this._pool=void 0,this._cleanup=void 0;var i=void 0===e?t:e,n=void 0===e?null:t;this.count=0,this._pool=new Array(i),this._cleanup=n}return t.get=function(){return this._get()},t._get=function(){if(this.count>0){--this.count;var t=this._pool[this.count];return this._pool[this.count]=null,t}return null},t.put=function(t){var e=this._pool;if(this.count<e.length){if(this._cleanup&&!1===this._cleanup(t))return;e[this.count]=t,++this.count}},t.resize=function(t){t>=0&&(this._pool.length=t,this.count>t&&(this.count=t))},e}(),ae=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 oe(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&&(oe(t,i),!0)}function le(t,e){var i=t.indexOf(e);i>=0&&(t[i]=t[t.length-1],--t.length)}function ce(t,e){var i=t.findIndex(e);if(i>=0){var n=t[i];return oe(t,i),n}}function _e(t,e){return t.indexOf(e)>=0}var de=Object.freeze({__proto__:null,removeAt:oe,fastRemoveAt:he,remove:ue,fastRemove:le,removeIf:ce,verifyType:function(t,e){if(t&&t.length>0)for(var i,n=d(t);!(i=n()).done;)if(!(i.value instanceof e))return Y(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},MutableForwardIterator:ae}),fe={IDGenerator:vt,Pool:se,array:de,isNumber:Et,isString:At,isEmptyObject:Rt,getPropertyDescriptor:kt,addon:Gt,mixin:Ht,extend:zt,getSuper:Vt,isChildClassOf:Wt,clear:Xt,value:Ct,getset:wt,get:xt,set:It,unregisterClass:$t,getClassName:Dt,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:Mt,obsoletes:Pt,formatStr:Lt,shiftArguments:Ft,createMap:Ot};v.js=fe;var pe=Object.freeze({__proto__:null,array:de,js:fe,IDGenerator:vt,Pool:se,isNumber:Et,isString:At,isEmptyObject:Rt,value:Ct,getset:wt,get:xt,set:It,createMap:Ot,getClassName:Dt,obsolete:Mt,obsoletes:Pt,formatStr:Lt,shiftArguments:Ft,getPropertyDescriptor:kt,copyAllProperties:function(t,e,i){for(var n=Object.getOwnPropertyNames(t),r=0,s=n.length;r<s;++r){var a=n[r];-1===i.indexOf(a)&&Ut(a,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 me(t){if("__bitmask__"in t)return t;Ct(t,"__bitmask__",null,!0);for(var e=-1,i=Object.keys(t),n=0;n<i.length;n++){var r=i[n],s=t[r];if(-1===s)s=++e,t[r]=s;else if("number"==typeof s)e=s;else if("string"==typeof s&&Number.isInteger(parseFloat(r)))continue;var a=""+s;r!==a&&Ct(t,a,r)}return t}function ge(t,e){e>=0&&t.length,t.length}function ve(t){return"__enums__"in t?t:(Ct(t,"__enums__",null,!0),ve.update(t))}function ye(t){t.hasOwnProperty("__enums__")}function Te(t){ye(t);var e=t.__enums__||[];for(var i in e.length=0,t){var n=t[i];Number.isInteger(n)&&e.push({name:i,value:n})}return e.sort((function(t,e){return t.value-e.value})),t.__enums__=e,e}function Se(t){"__enums__"in t||Ct(t,"__enums__",null,!0)}t("bA",pe),me.isBitMask=function(t){return t&&t.hasOwnProperty("__bitmask__")},me.getList=function(t){return t.__bitmask__?t.__bitmask__:me.update(t)},me.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},v.BitMask=me,ve.update=function(t){for(var e=-1,i=Object.keys(t),n=0;n<i.length;n++){var r=i[n],s=t[r];if(-1===s)s=++e,t[r]=s;else if("number"==typeof s)e=s;else if("string"==typeof s&&Number.isInteger(parseFloat(r)))continue;var a=""+s;r!==a&&Ct(t,a,r)}return Array.isArray(t.__enums__)&&Te(t),t},ve||t("bx",ve={}),ve.isEnum=function(t){return t&&t.hasOwnProperty("__enums__")},ve.getList=function(t){return ye(t),t.__enums__?t.__enums__:Te(t)},ve.sortList=function(t,e){ye(t),Array.isArray(t.__enums__)&&t.__enums__.sort(e)},v.Enum=ve;var Ee,Ae=t("bz",function(){function t(){}var e=t.prototype;return e.clone=function(){return Z(100,Dt(this)+".clone"),this},e.equals=function(){return!1},e.set=function(){Z(100,Dt(this)+".set")},e.toString=function(){return""},t}());Zt("cc.ValueType",Ae),v.ValueType=Ae,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"}(Ee||(Ee={}));var Re=t("cu",function(){function t(){this._settings={},this._override={}}var e=t.prototype;return e.init=function(t,e){var i=this;for(var n in void 0===t&&(t=""),void 0===e&&(e={}),e){var r=e[n];if(r)for(var s in r)this.overrideSettings(n,s,r[s])}return t?new Promise((function(e,n){var r=new XMLHttpRequest;r.open("GET",t),r.responseType="text",r.onload=function(){i._settings=JSON.parse(r.response),e()},r.onerror=function(){n(new Error("request settings failed!"))},r.send(null)})):Promise.resolve()},e.overrideSettings=function(t,e,i){t in this._override||(this._override[t]={}),this._override[t][e]=i},e.querySettings=function(t,e){if(t in this._override){var i=this._override[t];if(i&&e in i)return i[e]}if(t in this._settings){var n=this._settings[t];if(n&&e in n)return n[e]}return null},t}());Re.Category=Ee;var be=t("cv",new Re);v.settings=be;var Ce=t("ch",{SUPPORT_TEXTURE_FORMATS:[".astc",".pkm",".pvr",".webp",".jpg",".jpeg",".bmp",".png"],KEY:{none:0,back:6,menu:18,backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,pause:19,capslock:20,escape:27,space:32,pageup:33,pagedown:34,end:35,home:36,left:37,up:38,right:39,down:40,select:41,insert:45,Delete:46,0:48,1:49,2:50,3:51,4:52,5:53,6:54,7:55,8:56,9:57,a:65,b:66,c:67,d:68,e:69,f:70,g:71,h:72,i:73,j:74,k:75,l:76,m:77,n:78,o:79,p:80,q:81,r:82,s:83,t:84,u:85,v:86,w:87,x:88,y:89,z:90,num0:96,num1:97,num2:98,num3:99,num4:100,num5:101,num6:102,num7:103,num8:104,num9:105,"*":106,"+":107,"-":109,numdel:110,"/":111,f1:112,f2:113,f3:114,f4:115,f5:116,f6:117,f7:118,f8:119,f9:120,f10:121,f11:122,f12:123,numlock:144,scrolllock:145,";":186,semicolon:186,equal:187,"=":187,",":188,comma:188,dash:189,".":190,period:190,forwardslash:191,grave:192,"[":219,openbracket:219,backslash:220,"]":221,closebracket:221,quote:222,dpadLeft:1e3,dpadRight:1001,dpadUp:1003,dpadDown:1004,dpadCenter:1005},RAD:Math.PI/180,DEG:180/Math.PI,REPEAT_FOREVER:Number.MAX_VALUE-1,FLT_EPSILON:1.192092896e-7,ORIENTATION_PORTRAIT:1,ORIENTATION_LANDSCAPE:2,ORIENTATION_AUTO:3,ENABLE_TILEDMAP_CULLING:!0,TOUCH_TIMEOUT:5e3,ENABLE_TRANSPARENT_CANVAS:!1,ENABLE_WEBGL_ANTIALIAS:!0,ENABLE_FLOAT_OUTPUT:!1,CLEANUP_IMAGE_CACHE:!1,ENABLE_MULTI_TOUCH:!0,MAX_LABEL_CANVAS_POOL_SIZE:20,ENABLE_WEBGL_HIGHP_STRUCT_VALUES:!1,BATCHER2D_MEM_INCREMENT:144,CUSTOM_PIPELINE_NAME:"",init:function(){var t=be.querySettings(Re.Category.ENGINE,"macros");if(t)for(var e in t)Ce[e]=t[e]}});v.macro=Ce;for(var we=/^(?:cc|dragonBones|sp|ccsg)\..+/,xe=new Array(123),Ie=0;Ie<123;++Ie)xe[Ie]=64;for(var Oe=0;Oe<64;++Oe)xe["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charCodeAt(Oe)]=Oe;var De=xe;function Me(t,e,i){function n(t,e,i,n){var r=Object.getOwnPropertyDescriptor(t,e);if(r)r.get&&(t[i]=r.get),r.set&&n&&(t[n]=r.set);else{var s=t[i];wt(t,e,s,t[n])}}for(var r,s=t.prototype,a=0;a<e.length;a++){var o=(r=e[a])[0].toUpperCase()+r.slice(1);n(s,r,"get"+o,"set"+o)}for(r in i){var h=i[r];n(s,r,h[0],h[1])}}function Pe(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 Be(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 Ne(t){return"object"==typeof window&&"function"==typeof Node?t instanceof Node:!!t&&"object"==typeof t&&"number"==typeof t.nodeType&&"string"==typeof t.nodeName}function Le(t,e,i){t&&function(t,e){for(var i,n=arguments.length,r=new Array(n>2?n-2:0),s=2;s<n;s++)r[s-2]=arguments[s];var a=performance.now(),o=requestAnimationFrame||window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame;if(void 0===o||null!==(i=globalThis.__globalXR)&&void 0!==i&&i.isWebXR)return setTimeout.apply(void 0,[t,e].concat(r));var h=function i(){performance.now()-a<e?o(i):t.apply(void 0,r)};o(h)}((function(){t(e,i)}),0)}function Fe(t){return!(!t||t.constructor!==Object)&&Rt(t)}function ke(t,e,i){if(e>i){var n=e;e=i,i=n}return t<e?e:t<i?t:i}function Ue(t){return t*Ce.RAD}function Ge(t){return t*Ce.DEG}v.misc={BUILTIN_CLASSID_RE:we,BASE64_VALUES:De,propertyDefine:Me,pushToMap:Pe,contains:Be,isDomNode:Ne,callInNextTick:Le,isPlainEmptyObj_DEV:Fe,clampf:ke,degreesToRadians:Ue,radiansToDegrees:Ge},t("bB",Object.freeze({__proto__:null,BUILTIN_CLASSID_RE:we,BASE64_VALUES:De,propertyDefine:Me,pushToMap:Pe,contains:Be,isDomNode:Ne,callInNextTick:Le,tryCatchFunctor_EDITOR:function(t){return Function("target","try {\n target."+t+"();\n}\ncatch (e) {\n cc._throw(e);\n}")},isPlainEmptyObj_DEV:Fe,clampf:ke,degreesToRadians:Ue,radiansToDegrees:Ge}));var He="$_$";function ze(t,e){var i=e?Object.create(e):{};return Ct(t,"__attrs__",i),i}function Ve(t){if("function"!=typeof t)return ze(t,Xe(t.constructor));for(var e,i=v.Class.getInheritanceChain(t),n=i.length-1;n>=0;n--){var r=i[n];r.hasOwnProperty("__attrs__")&&r.__attrs__||ze(r,(e=i[n+1])&&e.__attrs__)}return ze(t,(e=i[0])&&e.__attrs__),t.__attrs__}function We(t,e){var i=Xe(t),n=e+He,r={};for(var s in i)s.startsWith(n)&&(r[s.slice(n.length)]=i[s]);return r}function Xe(t){return t.hasOwnProperty("__attrs__")&&t.__attrs__||Ve(t)}function je(t,e,i,n){Xe(t)[e+He+i]=n}var Ye=function(){function t(t,e){this.name=void 0,this.default=void 0,this.name=t,this.default=e}return t.prototype.toString=function(){return this.name},t}(),Ke=t("bR",new Ye("Integer",0));v.Integer=Ke,v.CCInteger=Ke;var qe=t("bS",new Ye("Float",0));v.Float=qe,v.CCFloat=qe;var Qe=t("bT",new Ye("Boolean",!1));v.Boolean=Qe,v.CCBoolean=Qe;var Ze=t("bU",new Ye("String",""));function Je(t,e){return function(i,n){var r='"'+Dt(i)+"."+n+'"',s=We(i,n),a=s.type;if(a===Ke||a===qe?a="Number":a!==Ze&&a!==Qe||(a=""+a),a===t){if(s.hasOwnProperty("default")){var o=s.default;if(void 0!==o&&!Array.isArray(o)&&!Fe(o)){var h=typeof o,u=t.toLowerCase();if(h===u)if("object"===u){if(!o||o instanceof s.ctor)return;q(3605,r,Dt(s.ctor))}else"Number"!==t&&q(3606,e,r,t);else{if("function"===h)return;t===Ze.default&&null==o?q(3607,r):q(3611,e,r,h)}delete s.type}}}else q(3604,r)}}v.String=Ze,v.CCString=Ze;var $e=Object.freeze({__proto__:null,DELIMETER:He,createAttrsSingle:ze,createAttrs:Ve,attr:We,getClassAttrs:Xe,setClassAttr:je,PrimitiveType:Ye,CCInteger:Ke,CCFloat:qe,CCBoolean:Qe,CCString:Ze,getTypeChecker_ET:Je,getObjTypeChecker_ET:function(t){return function(e,i){Je("Object","type")(e,i);var n=Xe(e)[i+He+"default"],r=v.Class.getDefault(n);if(!Array.isArray(r)&&Wt(t,v.ValueType)){var s=Dt(t),a=Lt('No need to specify the "type" of "%s.%s" because %s is a child class of ValueType.',Dt(e),i,s);n?k(a):q(3612,a,s,Dt(e),i,s)}}}}),ti={default:{},serializable:{},editorOnly:{},formerlySerializedAs:{}};function ei(t,e,i,n){if(!t.get&&!t.set&&t.hasOwnProperty("default")){var r="_N$"+e;t.get=function(){return this[r]},t.set=function(t){var e=this[r];this[r]=t,i.call(this,e)};var s={};for(var a in n[r]=s,ti){var o=ti[a];t.hasOwnProperty(a)&&(s[a]=t[a],o.canUsedInGet||delete t[a])}}}function ii(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=v.String:e===Boolean?t.type=v.Boolean:e===Number&&(t.type=v.Float))}function ni(t,e,i){var n=t||void 0===e?{_short:!0}:{_short:!0,default:e};return i&&(n.type=i),n}function ri(t,e){if(!t||t.constructor!==Object){if(Array.isArray(t)&&t.length>0)return ni(e,[],t);if("function"==typeof t){var i=t;return ni(e,Wt(i,v.ValueType)?new i:null,i)}return t instanceof Ye?ni(e,void 0,t):ni(e,t)}return null}var si,ai=[];function oi(){return ai[ai.length-1]}function hi(t,e,i){ui(Xe(t),e,i)}function ui(t,e,i){t[e+"$_$type"]="Enum",t[e+"$_$enumList"]=ve.getList(i)}v._RF={push:function(t,e,i,n){void 0===i&&(i=e,e=""),ai.push({uuid:e,script:i,module:t,exports:t.exports,beh:null,importMeta:n})},pop:function(){var t=ai.pop(),e=t.module,i=e.exports;if(i===t.exports){for(var n in i)return;e.exports=i=t.cls}},peek:oi},function(t){t[t.STANDALONE=1]="STANDALONE",t[t.IMPLICIT_VISIBLE=2]="IMPLICIT_VISIBLE",t[t.IMPLICIT_SERIALIZABLE=4]="IMPLICIT_SERIALIZABLE"}(si||(si={}));var li=He,ci="__ctors__",_i=t("cT","Enum"),di=t("cU","BitMask");function fi(t,e,i,n){!function(t,e){!function(t,e){t.indexOf(e)<0&&t.push(e)}(t.__props__,e)}(t,i),Ti(t,n,e,i)}function pi(t,e,i,n){var r=n.get;n.set,r&&(Ti(t,n,e,i),je(t,i,"serializable",!1))}function mi(t){return"function"==typeof t?t():t}function gi(t){var e=t.name,i=t.extends,n=function(t,e,i){var n=v.Component,r=oi();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 Ct(n,ci,!0,!0),n.prototype,e&&(n.$super=e),Zt(t,n),n}(t,e,i);if(r)if(Wt(e,n)){var a=r.uuid;a&&qt(a,s),r.cls=s}else Wt(r.cls,n)||(r.cls=s);return s}(e,i,t);e||(e=v.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=ri(n,!1);if(r&&(n=t[i]=r),n){var s=n.notify;s&&ei(n,i,s,t),"type"in n&&ii(n,n.type,e,i)}}}(i,e),i){var s=i[r];s.get||s.set?pi(t,e,r,s):fi(t,e,r,s)}var a=Xe(t);t.__values__=t.__props__.filter((function(t){return!1!==a[t+"$_$serializable"]}))}(n,e,t.properties,i);var r=t.editor;return r&&Wt(i,v.Component)&&v.Component._registerEditorProps(n,r),n}function vi(t){var e;return null==t||null===(e=t.hasOwnProperty)||void 0===e?void 0:e.call(t,"__values__")}gi._isCCClass=function(t){var e;return null==t||null===(e=t.hasOwnProperty)||void 0===e?void 0:e.call(t,ci)},gi.fastDefine=function(t,e,i){Zt(t,e);for(var n=e.__props__=e.__values__=Object.keys(i),r=Xe(e),s=0;s<n.length;s++){var a=n[s];r[a+li+"visible"]=!1,r[a+li+"default"]=i[a]}},gi.Attr=$e,gi.attr=We,gi.isCCClassOrFastDefined=vi,gi.getInheritanceChain=function(t){for(var e=[];t=Vt(t);)t!==Object&&e.push(t);return e};var yi={Integer:"Number",Float:"Number",Boolean:"Boolean",String:"String"};function Ti(t,e,i,n){var r=null,s="";function a(){return s=n+li,r=Xe(t)}"type"in e&&void 0===e.type&&q(3660,n,i);var o=e.type;o&&(yi[o]?(r||a())[s+"type"]=o:"Object"===o||("object"==typeof o?ve.isEnum(o)?ui(r||a(),n,o):me.isBitMask(o)&&((r||a())[s+"type"]=di,r[s+"bitmaskList"]=me.getList(o)):"function"==typeof o&&((r||a())[s+"type"]="Object",r[s+"ctor"]=o))),"default"in e&&((r||a())[s+"default"]=e.default);var h,u=function(t,i){if(t in e){var n=e[t];typeof n===i&&((r||a())[s+t]=n)}};e.editorOnly&&((r||a())[s+"editorOnly"]=!0),e.__internalFlags&si.STANDALONE?h=!0===e.serializable||0!=(e.__internalFlags&si.IMPLICIT_SERIALIZABLE):!1===e.serializable&&(h=!1),void 0!==h&&((r||a())[s+"serializable"]=h),u("formerlySerializedAs","string");var l=e.range;l&&Array.isArray(l)&&l.length>=2&&((r||a())[s+"min"]=l[0],r[s+"max"]=l[1],l.length>2&&(r[s+"step"]=l[2])),u("min","number"),u("max","number"),u("step","number")}gi.isArray=function(t){return t=mi(t),Array.isArray(t)},gi.getDefault=mi,gi.escapeForJS=function(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")},gi.IDENTIFIER_RE=/^[A-Za-z_$][0-9A-Za-z_$]*$/,gi.getNewValueTypeCode=function(t){for(var e=Dt(t),i=t.constructor,n="new "+e+"(",r=0;r<i.__props__.length;r++)n+=t[i.__props__[r]],r<i.__props__.length-1&&(n+=",");return n+")"},v.Class=gi;var Si=Math.PI/180,Ei=180/Math.PI,Ai=Math.random,Ri=t("b1",.5*Math.PI),bi=t("b2",2*Math.PI),Ci=t("b3",1e-6);function wi(t,e){return Math.abs(t-e)<=Ci*Math.max(1,Math.abs(t),Math.abs(e))}function xi(t,e,i){return i=i||Ci,Math.abs(t-e)<=i}function Ii(t,e,i){if(e>i){var n=e;e=i,i=n}return t<e?e:t>i?i:t}function Oi(t){return t<0?0:t>1?1:t}function Di(t,e,i){return t+(e-t)*i}function Mi(t){return t*Si}function Pi(t){return t*Ei}function Bi(){return Ai()}function Ni(t){Ai=t}function Li(t,e){return Bi()*(e-t)+t}function Fi(t,e){return Math.floor(Li(t,e))}function ki(t){return(t=(9301*t+49297)%233280)/233280}function Ui(t,e,i){return ki(t)*(i-e)+e}function Gi(t,e,i){return Math.floor(Ui(t,e,i))}function Hi(t){return C(t)}function zi(t,e){return t-Math.floor(t/e)*e}function Vi(t,e){return t=zi(t,2*e),e-Math.abs(t-e)}function Wi(t,e,i){return(i-t)/(e-t)}function Xi(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 ji(t,e){return Math.abs(t)>Math.abs(e)?t:e}function Yi(t,e){e.forEach((function(e){Object.defineProperty(t,e,{enumerable:!0})}))}var Ki,qi,Qi,Zi=(Ki=new Float32Array(1),qi=new Int32Array(Ki.buffer),function(t){Ki[0]=t;var e=qi[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,qi[0]=i|r,qi[0]}),Ji=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 $i(t){return Zi(t)}function tn(t){return Ji(t)}var en,nn=t("aO",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)<Ci?t.x=0:t.x=1/i,Math.abs(n)<Ci?t.y=0:t.y=1/n,Math.abs(r)<Ci?t.z=0:t.z=1/r,Math.abs(s)<Ci?t.w=0:t.w=1/s,t},e.normalize=function(t,e){var i=e.x,n=e.y,r=e.z,s=e.w,a=i*i+n*n+r*r+s*s;return a>0?(a=1/Math.sqrt(a),t.x=i*a,t.y=n*a,t.z=r*a,t.w=s*a):(t.x=0,t.y=0,t.z=0,t.w=0),t},e.dot=function(t,e){return t.x*e.x+t.y*e.y+t.z*e.z+t.w*e.w},e.lerp=function(t,e,i,n){return t.x=e.x+n*(i.x-e.x),t.y=e.y+n*(i.y-e.y),t.z=e.z+n*(i.z-e.z),t.w=e.w+n*(i.w-e.w),t},e.scale=function(t,e,i){return t.x=e.x*i,t.y=e.y*i,t.z=e.z*i,t.w=e.w*i,t},e.random=function(t,e){e=e||1;var i=2*Bi()*Math.PI,n=2*Bi()-1,r=Math.sqrt(1-n*n);return t.x=r*Math.cos(i)*e,t.y=r*Math.sin(i)*e,t.z=n*e,t.w=0,t},e.transformMat4=function(t,e,i){var n=e.x,r=e.y,s=e.z,a=e.w;return t.x=i.m00*n+i.m04*r+i.m08*s+i.m12*a,t.y=i.m01*n+i.m05*r+i.m09*s+i.m13*a,t.z=i.m02*n+i.m06*r+i.m10*s+i.m14*a,t.w=i.m03*n+i.m07*r+i.m11*s+i.m15*a,t},e.transformAffine=function(t,e,i){var n=e.x,r=e.y,s=e.z,a=e.w;return t.x=i.m00*n+i.m04*r+i.m08*s+i.m12*a,t.y=i.m01*n+i.m05*r+i.m09*s+i.m13*a,t.z=i.m02*n+i.m06*r+i.m10*s+i.m14*a,t.w=e.w,t},e.transformQuat=function(t,e,i){var n=e.x,r=e.y,s=e.z,a=i.x,o=i.y,h=i.z,u=i.w,l=u*n+o*s-h*r,c=u*r+h*n-a*s,_=u*s+a*r-o*n,d=-a*n-o*r-h*s;return t.x=l*u+d*-a+c*-h-_*-o,t.y=c*u+d*-o+_*-a-l*-h,t.z=_*u+d*-h+l*-o-c*-a,t.w=e.w,t},e.toArray=function(t,e,i){return void 0===i&&(i=0),t[i+0]=e.x,t[i+1]=e.y,t[i+2]=e.z,t[i+3]=e.w,t},e.fromArray=function(t,e,i){return void 0===i&&(i=0),t.x=e[i+0],t.y=e[i+1],t.z=e[i+2],t.w=e[i+3],t},e.strictEquals=function(t,e){return t.x===e.x&&t.y===e.y&&t.z===e.z&&t.w===e.w},e.equals=function(t,e,i){return void 0===i&&(i=Ci),!(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=Ci),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=Ci),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=Ii(this.x,t.x,e.x),this.y=Ii(this.y,t.y,e.y),this.z=Ii(this.z,t.z,e.z),this.w=Ii(this.w,t.w,e.w),this},i.add=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this},i.add4f=function(t,e,i,n){return this.x+=t,this.y+=e,this.z+=i,this.w+=n,this},i.subtract=function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this},i.subtract4f=function(t,e,i,n){return this.x-=t,this.y-=e,this.z-=i,this.w-=n,this},i.multiplyScalar=function(t){return"object"==typeof t&&console.warn("should use Vec4.multiply for vector * vector operation"),this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},i.multiply=function(t){return"object"!=typeof t&&console.warn("should use Vec4.scale for vector * scalar operation"),this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this},i.multiply4f=function(t,e,i,n){return this.x*=t,this.y*=e,this.z*=i,this.w*=n,this},i.divide=function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this},i.divide4f=function(t,e,i,n){return this.x/=t,this.y/=e,this.z/=i,this.w/=n,this},i.negative=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},i.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},i.cross=function(t){var e=this.x,i=this.y,n=this.z,r=t.x,s=t.y,a=t.z;return this.x=i*a-n*s,this.y=n*r-e*a,this.z=e*s-i*r,this},i.length=function(){var t=this.x,e=this.y,i=this.z,n=this.w;return Math.sqrt(t*t+e*e+i*i+n*n)},i.lengthSqr=function(){var t=this.x,e=this.y,i=this.z,n=this.w;return t*t+e*e+i*i+n*n},i.normalize=function(){var t=this.x,e=this.y,i=this.z,n=this.w,r=t*t+e*e+i*i+n*n;return r>0&&(r=1/Math.sqrt(r),this.x=t*r,this.y=e*r,this.z=i*r,this.w=n*r),this},i.scale=function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},i.transformMat4=function(t){var e=this.x,i=this.y,n=this.z,r=this.w;return this.x=t.m00*e+t.m04*i+t.m08*n+t.m12*r,this.y=t.m01*e+t.m05*i+t.m09*n+t.m13*r,this.z=t.m02*e+t.m06*i+t.m10*n+t.m14*r,this.w=t.m03*e+t.m07*i+t.m11*n+t.m15*r,this},e}(Ae));function rn(t,e,i,n){return new nn(t,e,i,n)}Qi=nn,nn.ZERO=Object.freeze(new Qi(0,0,0,0)),nn.ONE=Object.freeze(new Qi(1,1,1,1)),nn.NEG_ONE=Object.freeze(new Qi(-1,-1,-1,-1)),nn.UNIT_X=Object.freeze(new Qi(1,0,0,0)),nn.UNIT_Y=Object.freeze(new Qi(0,1,0,0)),nn.UNIT_Z=Object.freeze(new Qi(0,0,1,0)),nn.UNIT_W=Object.freeze(new Qi(0,0,0,1)),gi.fastDefine("cc.Vec4",nn,{x:0,y:0,z:0,w:0}),v.Vec4=nn,v.v4=rn;var sn,an,on,hn=t("aM",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)<Ci?t.x=0:t.x=1/i,Math.abs(n)<Ci?t.y=0:t.y=1/n,Math.abs(r)<Ci?t.z=0:t.z=1/r,t},e.normalize=function(t,e){var i=e.x,n=e.y,r=e.z,s=i*i+n*n+r*r;return s>0?(s=1/Math.sqrt(s),t.x=i*s,t.y=n*s,t.z=r*s):(t.x=0,t.y=0,t.z=0),t},e.dot=function(t,e){return t.x*e.x+t.y*e.y+t.z*e.z},e.cross=function(t,e,i){var n=e.x,r=e.y,s=e.z,a=i.x,o=i.y,h=i.z;return t.x=r*h-s*o,t.y=s*a-n*h,t.z=n*o-r*a,t},e.lerp=function(t,e,i,n){return t.x=e.x+n*(i.x-e.x),t.y=e.y+n*(i.y-e.y),t.z=e.z+n*(i.z-e.z),t},e.random=function(t,e){e=e||1;var i=2*Bi()*Math.PI,n=2*Bi()-1,r=Math.sqrt(1-n*n);return t.x=r*Math.cos(i)*e,t.y=r*Math.sin(i)*e,t.z=n*e,t},e.transformMat4=function(t,e,i){var n=e.x,r=e.y,s=e.z,a=i.m03*n+i.m07*r+i.m11*s+i.m15;return a=a?1/a:1,t.x=(i.m00*n+i.m04*r+i.m08*s+i.m12)*a,t.y=(i.m01*n+i.m05*r+i.m09*s+i.m13)*a,t.z=(i.m02*n+i.m06*r+i.m10*s+i.m14)*a,t},e.transformMat4Normal=function(t,e,i){var n=e.x,r=e.y,s=e.z,a=i.m03*n+i.m07*r+i.m11*s;return a=a?1/a:1,t.x=(i.m00*n+i.m04*r+i.m08*s)*a,t.y=(i.m01*n+i.m05*r+i.m09*s)*a,t.z=(i.m02*n+i.m06*r+i.m10*s)*a,t},e.transformMat3=function(t,e,i){var n=e.x,r=e.y,s=e.z;return t.x=n*i.m00+r*i.m03+s*i.m06,t.y=n*i.m01+r*i.m04+s*i.m07,t.z=n*i.m02+r*i.m05+s*i.m08,t},e.transformAffine=function(t,e,i){var n=e.x,r=e.y,s=e.z;return t.x=i.m00*n+i.m04*r+i.m08*s+i.m12,t.y=i.m01*n+i.m05*r+i.m09*s+i.m13,t.z=i.m02*n+i.m06*r+i.m10*s+i.m14,t},e.transformQuat=function(t,e,i){var n=i.w*e.x+i.y*e.z-i.z*e.y,r=i.w*e.y+i.z*e.x-i.x*e.z,s=i.w*e.z+i.x*e.y-i.y*e.x,a=-i.x*e.x-i.y*e.y-i.z*e.z;return t.x=n*i.w+a*-i.x+r*-i.z-s*-i.y,t.y=r*i.w+a*-i.y+s*-i.x-n*-i.z,t.z=s*i.w+a*-i.z+n*-i.y-r*-i.x,t},e.transformRTS=function(t,e,i,n,r){var s=e.x*r.x,a=e.y*r.y,o=e.z*r.z,h=i.w*s+i.y*o-i.z*a,u=i.w*a+i.z*s-i.x*o,l=i.w*o+i.x*a-i.y*s,c=-i.x*s-i.y*a-i.z*o;return t.x=h*i.w+c*-i.x+u*-i.z-l*-i.y+n.x,t.y=u*i.w+c*-i.y+l*-i.x-h*-i.z+n.y,t.z=l*i.w+c*-i.z+h*-i.y-u*-i.x+n.z,t},e.transformInverseRTS=function(t,e,i,n,r){var s=e.x-n.x,a=e.y-n.y,o=e.z-n.z,h=i.w*s-i.y*o+i.z*a,u=i.w*a-i.z*s+i.x*o,l=i.w*o-i.x*a+i.y*s,c=i.x*s+i.y*a+i.z*o;return t.x=(h*i.w+c*i.x+u*i.z-l*i.y)/r.x,t.y=(u*i.w+c*i.y+l*i.x-h*i.z)/r.y,t.z=(l*i.w+c*i.z+h*i.y-u*i.x)/r.z,t},e.rotateX=function(t,e,i,n){var r=e.x-i.x,s=e.y-i.y,a=e.z-i.z,o=Math.cos(n),h=Math.sin(n),u=r,l=s*o-a*h,c=s*h+a*o;return t.x=u+i.x,t.y=l+i.y,t.z=c+i.z,t},e.rotateY=function(t,e,i,n){var r=e.x-i.x,s=e.y-i.y,a=e.z-i.z,o=Math.cos(n),h=Math.sin(n),u=a*h+r*o,l=s,c=a*o-r*h;return t.x=u+i.x,t.y=l+i.y,t.z=c+i.z,t},e.rotateZ=function(t,e,i,n){var r=e.x-i.x,s=e.y-i.y,a=e.z-i.z,o=Math.cos(n),h=Math.sin(n),u=r*o-s*h,l=r*h+s*o,c=a;return t.x=u+i.x,t.y=l+i.y,t.z=c+i.z,t},e.rotateN=function(t,e,i,n,r){var s=e.x-i.x,a=e.y-i.y,o=e.z-i.z,h=n.x,u=n.y,l=n.z,c=Math.cos(r),_=Math.sin(r),d=s*(h*h*(1-c)+c)+a*(h*u*(1-c)-h*_)+o*(h*l*(1-c)+u*_),f=s*(h*u*(1-c)+l*_)+a*(u*u*(1-c)+c)+o*(u*l*(1-c)-h*_),p=s*(h*l*(1-c)-u*_)+a*(u*l*(1-c)+h*_)+o*(l*l*(1-c)+c);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=Ci);var n=t.x,r=t.y,s=t.z,a=e.x,o=e.y,h=e.z;return Math.abs(n-a)<=i*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(r-o)<=i*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(s-h)<=i*Math.max(1,Math.abs(s),Math.abs(h))},e.angle=function(t,e){var i=t.x*t.x+t.y*t.y+t.z*t.z,n=e.x*e.x+e.y*e.y+e.z*e.z;if(0===i||0===n)return 0;var r=(t.x*e.x+t.y*e.y+t.z*e.z)/Math.sqrt(i*n);return r=Ii(r,-1,1),Math.acos(r)},e.projectOnPlane=function(t,i,n){return e.subtract(t,i,e.project(t,i,n))},e.project=function(t,i,n){var r=e.lengthSqr(n);return r<1e-6?e.set(t,0,0,0):e.multiplyScalar(t,n,e.dot(i,n)/r)},e.moveTowards=function(t,e,i,n){var r=i.x-e.x,s=i.y-e.y,a=i.z-e.z,o=r*r+s*s+a*a;if(0===o||n>=0&&o<n*n)return t.x=i.x,t.y=i.y,t.z=i.z,t;var h=n/Math.sqrt(o);return t.x=e.x+r*h,t.y=e.y+s*h,t.z=e.z+a*h,t},e.generateOrthogonal=function(t,i){var n=i.x,r=i.y,s=i.z,a=Math.abs(n),o=Math.abs(r),h=Math.abs(s);return a<o&&a<h?e.set(t,0,s,-r):o<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=Ci),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=Ci),Math.abs(this.x-t)<=n&&Math.abs(this.y-e)<=n&&Math.abs(this.z-i)<=n},i.strictEquals=function(t){return this.x===t.x&&this.y===t.y&&this.z===t.z},i.strictEquals3f=function(t,e,i){return this.x===t&&this.y===e&&this.z===i},i.toString=function(){return"("+this.x.toFixed(2)+", "+this.y.toFixed(2)+", "+this.z.toFixed(2)+")"},i.lerp=function(t,e){return this.x+=e*(t.x-this.x),this.y+=e*(t.y-this.y),this.z+=e*(t.z-this.z),this},i.add=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this},i.add3f=function(t,e,i){return this.x+=t,this.y+=e,this.z+=i,this},i.subtract=function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this},i.subtract3f=function(t,e,i){return this.x-=t,this.y-=e,this.z-=i,this},i.multiplyScalar=function(t){return"object"==typeof t&&console.warn("should use Vec3.multiply for vector * vector operation"),this.x*=t,this.y*=t,this.z*=t,this},i.multiply=function(t){return"object"!=typeof t&&console.warn("should use Vec3.scale for vector * scalar operation"),this.x*=t.x,this.y*=t.y,this.z*=t.z,this},i.multiply3f=function(t,e,i){return this.x*=t,this.y*=e,this.z*=i,this},i.divide=function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},i.divide3f=function(t,e,i){return this.x/=t,this.y/=e,this.z/=i,this},i.negative=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},i.clampf=function(t,e){return this.x=Ii(this.x,t.x,e.x),this.y=Ii(this.y,t.y,e.y),this.z=Ii(this.z,t.z,e.z),this},i.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},i.cross=function(t){var e=this.x,i=this.y,n=this.z,r=t.x,s=t.y,a=t.z;return this.x=i*a-n*s,this.y=n*r-e*a,this.z=e*s-i*r,this},i.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},i.lengthSqr=function(){return this.x*this.x+this.y*this.y+this.z*this.z},i.normalize=function(){var t=this.x,e=this.y,i=this.z,n=t*t+e*e+i*i;return n>0&&(n=1/Math.sqrt(n),this.x=t*n,this.y=e*n,this.z=i*n),this},i.transformMat4=function(t){var e=this.x,i=this.y,n=this.z,r=t.m03*e+t.m07*i+t.m11*n+t.m15;return r=r?1/r:1,this.x=(t.m00*e+t.m04*i+t.m08*n+t.m12)*r,this.y=(t.m01*e+t.m05*i+t.m09*n+t.m13)*r,this.z=(t.m02*e+t.m06*i+t.m10*n+t.m14)*r,this},e}(Ae));function un(t,e,i){return new hn(t,e,i)}en=hn,hn.UNIT_X=Object.freeze(new en(1,0,0)),hn.UNIT_Y=Object.freeze(new en(0,1,0)),hn.UNIT_Z=Object.freeze(new en(0,0,1)),hn.RIGHT=Object.freeze(new en(1,0,0)),hn.UP=Object.freeze(new en(0,1,0)),hn.FORWARD=Object.freeze(new en(0,0,-1)),hn.ZERO=Object.freeze(new en(0,0,0)),hn.ONE=Object.freeze(new en(1,1,1)),hn.NEG_ONE=Object.freeze(new en(-1,-1,-1)),hn.slerp=(sn=new en,an=new en,on=new en,function(t,e,i,n){var r=1e-5,s=en.len(e),a=en.len(i);if(s<r||a<r)return en.lerp(t,e,i,n);var o=Di(s,a,n),h=en.dot(e,i)/(s*a);if(h>.99999)return en.lerp(t,e,i,n);if(h<-.99999){var u=en.multiplyScalar(sn,e,1/s),l=en.generateOrthogonal(an,u),c=Math.PI*n;return _n(on,u,l,c),en.multiplyScalar(t,on,o),t}var _=h,d=Math.acos(_)*n,f=en.multiplyScalar(sn,e,1/s),p=en.multiplyScalar(an,i,1/a);return en.scaleAndAdd(on,p,f,-_),en.normalize(on,on),en.multiplyScalar(on,on,Math.sin(d)),en.scaleAndAdd(on,on,f,Math.cos(d)),en.multiplyScalar(t,on,o),t}),gi.fastDefine("cc.Vec3",hn,{x:0,y:0,z:0}),v.Vec3=hn;var ln,cn,_n=(ln={x:0,y:0,z:0,w:0},function(t,e,i,n){var r=.5*n,s=Math.sin(r);return ln.x=s*i.x,ln.y=s*i.y,ln.z=s*i.z,ln.w=Math.cos(r),hn.transformQuat(t,e,ln),t});v.v3=un;var dn,fn=1/255,pn=t("a_",function(t){function e(e,i,n,r){var s;return(s=t.call(this)||this)._val=0,"string"==typeof e?s.fromHEX(e):void 0!==i?s.set(e,i,n,r):s.set(e),s}s(e,t),e.clone=function(t){var i=new e;return t._val?i._val=t._val:i._val=(t.a<<24>>>0)+(t.b<<16)+(t.g<<8)+t.r,i},e.copy=function(t,e){return t.r=e.r,t.g=e.g,t.b=e.b,t.a=e.a,t},e.set=function(t,e,i,n,r){return t.r=e,t.g=i,t.b=n,t.a=r,t},e.toVec4=function(t,e){return(e=void 0!==e?e:new nn).x=t.r*fn,e.y=t.g*fn,e.z=t.b*fn,e.w=t.a*fn,e},e.fromVec4=function(t,i){return(i=void 0===i?new e:i).r=Math.floor(t.x/fn),i.g=Math.floor(t.y/fn),i.b=Math.floor(t.z/fn),i.a=Math.floor(t.w/fn),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._val=(t.a<<24>>>0)+(t.b<<16)+(t.g<<8)+t.r,t},e.add=function(t,e,i){return t.r=e.r+i.r,t.g=e.g+i.g,t.b=e.b+i.b,t.a=e.a+i.a,t},e.subtract=function(t,e,i){return t.r=e.r-i.r,t.g=e.g-i.g,t.b=e.b-i.b,t.a=e.a-i.a,t},e.multiply=function(t,e,i){return t.r=e.r*i.r,t.g=e.g*i.g,t.b=e.b*i.b,t.a=e.a*i.a,t},e.divide=function(t,e,i){return t.r=e.r/i.r,t.g=e.g/i.g,t.b=e.b/i.b,t.a=e.a/i.a,t},e.scale=function(t,e,i){return t.r=e.r*i,t.g=e.g*i,t.b=e.b*i,t.a=e.a*i,t},e.lerp=function(t,e,i,n){var r=e.r,s=e.g,a=e.b,o=e.a;return r+=(i.r-r)*n,s+=(i.g-s)*n,a+=(i.b-a)*n,o+=(i.a-o)*n,t._val=Math.floor((o<<24>>>0)+(a<<16)+(s<<8)+r),t},e.toArray=function(t,i,n){void 0===n&&(n=0);var r=i instanceof e||i.a>1?1/255:1;return t[n+0]=i.r*r,t[n+1]=i.g*r,t[n+2]=i.b*r,t[n+3]=i.a*r,t},e.fromArray=function(t,e,i){return void 0===i&&(i=0),e.r=255*t[i+0],e.g=255*t[i+1],e.b=255*t[i+2],e.a=255*t[i+3],e},e.fromUint32=function(t,e){return t._val=e,t},e.toUint32=function(t){return t._val},e.strictEquals=function(t,e){return t.r===e.r&&t.g===e.g&&t.b===e.b&&t.a===e.a},e.equals=function(t,e,i){return void 0===i&&(i=Ci),!(Math.abs(t.r)===1/0||Math.abs(t.g)===1/0||Math.abs(t.b)===1/0||Math.abs(t.a)===1/0)&&Math.abs(t.r-e.r)<=i*Math.max(1,Math.abs(t.r),Math.abs(e.r))&&Math.abs(t.g-e.g)<=i*Math.max(1,Math.abs(t.g),Math.abs(e.g))&&Math.abs(t.b-e.b)<=i*Math.max(1,Math.abs(t.b),Math.abs(e.b))&&Math.abs(t.a-e.a)<=i*Math.max(1,Math.abs(t.a),Math.abs(e.a))},e.hex=function(t){return(255*t.r<<24|255*t.g<<16|255*t.b<<8|255*t.a)>>>0};var i=e.prototype;return i.clone=function(){var t=new e;return t._val=this._val,t},i.equals=function(t){return t&&this._val===t._val},i.lerp=function(t,e){var i=this.r,n=this.g,r=this.b,s=this.a;return i+=(t.r-i)*e,n+=(t.g-n)*e,r+=(t.b-r)*e,s+=(t.a-s)*e,this._val=Math.floor((s<<24>>>0)+(r<<16)+(n<<8)+i),this},i.toString=function(){return"rgba("+this.r.toFixed()+", "+this.g.toFixed()+", "+this.b.toFixed()+", "+this.a.toFixed()+")"},i.toCSS=function(t){return void 0===t&&(t="rgba"),"rgba"===t?"rgba("+this.r+","+this.g+","+this.b+","+(this.a*fn).toFixed(2)+")":"rgb"===t?"rgb("+this.r+","+this.g+","+this.b+")":"#"+this.toHEX(t)},i.fromHEX=function(t){t=0===t.indexOf("#")?t.substring(1):t;var e=parseInt(t.substr(0,2),16)||0,i=parseInt(t.substr(2,2),16)||0,n=parseInt(t.substr(4,2),16)||0,r=parseInt(t.substr(6,2),16);return r=Number.isNaN(r)?255:r,this._val=(r<<24>>>0)+(n<<16)+(i<<8)+(0|e),this},i.toHEX=function(t){void 0===t&&(t="#rrggbb");var e="0",i=[(this.r<16?e:"")+this.r.toString(16),(this.g<16?e:"")+this.g.toString(16),(this.b<16?e:"")+this.b.toString(16)];return"#rgb"===t?(i[0]=i[0][0],i[1]=i[1][0],i[2]=i[2][0]):"#rrggbbaa"===t&&i.push((this.a<16?e:"")+this.a.toString(16)),i.join("")},i.toRGBValue=function(){return 16777215&this._val},i.fromHSV=function(t,e,i){var n=0,r=0,s=0;if(0===e)n=r=s=i;else if(0===i)n=r=s=0;else{1===t&&(t=0),t*=6;var a=Math.floor(t),o=t-a,h=i*(1-e),u=i*(1-e*o),l=i*(1-e*(1-o));switch(a){default:case 0:n=i,r=l,s=h;break;case 1:n=u,r=i,s=h;break;case 2:n=h,r=i,s=l;break;case 3:n=h,r=u,s=i;break;case 4:n=l,r=h,s=i;break;case 5:n=i,r=h,s=u}}return n*=255,r*=255,s*=255,this._val=(this.a<<24>>>0)+(s<<16)+(r<<8)+(0|n),this},i.toHSV=function(){var t=this.r*fn,e=this.g*fn,i=this.b*fn,n={h:0,s:0,v:0},r=Math.max(t,e,i),s=Math.min(t,e,i),a=0;return n.v=r,n.s=r?(r-s)/r:0,n.s?(a=r-s,n.h=t===r?(e-i)/a:e===r?2+(i-t)/a:4+(t-e)/a,n.h/=6,n.h<0&&(n.h+=1)):n.h=0,n},i.set=function(t,e,i,n){return"object"==typeof t?null!=t._val?this._val=t._val:(e=t.g||0,i=t.b||0,n="number"==typeof t.a?t.a:255,t=t.r||0,this._val=(n<<24>>>0)+(i<<16)+(e<<8)+(0|t)):(t=t||0,e=e||0,i=i||0,n="number"==typeof n?n:255,this._val=(n<<24>>>0)+(i<<16)+(e<<8)+(0|t)),this},i.multiply=function(t){var e=(255&this._val)*t.r>>8,i=(65280&this._val)*t.g>>8,n=(16711680&this._val)*t.b>>8,r=((4278190080&this._val)>>>8)*t.a;return this._val=4278190080&r|16711680&n|65280&i|255&e,this},i._set_r_unsafe=function(t){return this._val=(4294967040&this._val|t)>>>0,this},i._set_g_unsafe=function(t){return this._val=(4294902015&this._val|t<<8)>>>0,this},i._set_b_unsafe=function(t){return this._val=(4278255615&this._val|t<<16)>>>0,this},i._set_a_unsafe=function(t){return this._val=(16777215&this._val|t<<24)>>>0,this},n(e,[{key:"r",get:function(){return 255&this._val},set:function(t){t=~~Ii(t,0,255),this._val=(4294967040&this._val|t)>>>0}},{key:"g",get:function(){return(65280&this._val)>>8},set:function(t){t=~~Ii(t,0,255),this._val=(4294902015&this._val|t<<8)>>>0}},{key:"b",get:function(){return(16711680&this._val)>>16},set:function(t){t=~~Ii(t,0,255),this._val=(4278255615&this._val|t<<16)>>>0}},{key:"a",get:function(){return(4278190080&this._val)>>>24},set:function(t){t=~~Ii(t,0,255),this._val=(16777215&this._val|t<<24)>>>0}},{key:"x",get:function(){return this.r*fn},set:function(t){this.r=255*t}},{key:"y",get:function(){return this.g*fn},set:function(t){this.g=255*t}},{key:"z",get:function(){return this.b*fn},set:function(t){this.b=255*t}},{key:"w",get:function(){return this.a*fn},set:function(t){this.a=255*t}}]),e}(Ae));function mn(t,e,i,n){return new pn(t,e,i,n)}function gn(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}cn=pn,pn.WHITE=Object.freeze(new cn(255,255,255,255)),pn.GRAY=Object.freeze(new cn(127,127,127,255)),pn.BLACK=Object.freeze(new cn(0,0,0,255)),pn.TRANSPARENT=Object.freeze(new cn(0,0,0,0)),pn.RED=Object.freeze(new cn(255,0,0,255)),pn.GREEN=Object.freeze(new cn(0,255,0,255)),pn.BLUE=Object.freeze(new cn(0,0,255,255)),pn.CYAN=Object.freeze(new cn(0,255,255,255)),pn.MAGENTA=Object.freeze(new cn(255,0,255,255)),pn.YELLOW=Object.freeze(new cn(255,255,0,255)),gi.fastDefine("cc.Color",pn,{r:0,g:0,b:0,a:255}),v.Color=pn,v.color=mn;var vn=t("aS",function(t){function e(e,i,n,r,s,a,o,h,u){var l;return void 0===e&&(e=1),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=1),void 0===a&&(a=0),void 0===o&&(o=0),void 0===h&&(h=0),void 0===u&&(u=1),l=t.call(this)||this,"object"==typeof e?(l.m00=e.m00,l.m01=e.m01,l.m02=e.m02,l.m03=e.m03,l.m04=e.m04,l.m05=e.m05,l.m06=e.m06,l.m07=e.m07,l.m08=e.m08):(l.m00=e,l.m01=i,l.m02=n,l.m03=r,l.m04=s,l.m05=a,l.m06=o,l.m07=h,l.m08=u),l}s(e,t),e.clone=function(t){return new e(t.m00,t.m01,t.m02,t.m03,t.m04,t.m05,t.m06,t.m07,t.m08)},e.copy=function(t,e){return t.m00=e.m00,t.m01=e.m01,t.m02=e.m02,t.m03=e.m03,t.m04=e.m04,t.m05=e.m05,t.m06=e.m06,t.m07=e.m07,t.m08=e.m08,t},e.set=function(t,e,i,n,r,s,a,o,h,u){return t.m00=e,t.m01=i,t.m02=n,t.m03=r,t.m04=s,t.m05=a,t.m06=o,t.m07=h,t.m08=u,t},e.identity=function(t){return t.m00=1,t.m01=0,t.m02=0,t.m03=0,t.m04=1,t.m05=0,t.m06=0,t.m07=0,t.m08=1,t},e.transpose=function(t,e){if(t===e){var i=e.m01,n=e.m02,r=e.m05;t.m01=e.m03,t.m02=e.m06,t.m03=i,t.m05=e.m07,t.m06=n,t.m07=r}else t.m00=e.m00,t.m01=e.m03,t.m02=e.m06,t.m03=e.m01,t.m04=e.m04,t.m05=e.m07,t.m06=e.m02,t.m07=e.m05,t.m08=e.m08;return t},e.invert=function(t,e){var i=e.m00,n=e.m01,r=e.m02,s=e.m03,a=e.m04,o=e.m05,h=e.m06,u=e.m07,l=e.m08,c=l*a-o*u,_=-l*s+o*h,d=u*s-a*h,f=i*c+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=c*f,t.m01=(-l*n+r*u)*f,t.m02=(o*n-r*a)*f,t.m03=_*f,t.m04=(l*i-r*h)*f,t.m05=(-o*i+r*s)*f,t.m06=d*f,t.m07=(-u*i+n*h)*f,t.m08=(a*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,a=t.m05,o=t.m06,h=t.m07,u=t.m08;return e*(u*s-a*h)+i*(-u*r+a*o)+n*(h*r-s*o)},e.multiply=function(t,e,i){var n=e.m00,r=e.m01,s=e.m02,a=e.m03,o=e.m04,h=e.m05,u=e.m06,l=e.m07,c=e.m08,_=i.m00,d=i.m01,f=i.m02,p=i.m03,m=i.m04,g=i.m05,v=i.m06,y=i.m07,T=i.m08;return t.m00=_*n+d*a+f*u,t.m01=_*r+d*o+f*l,t.m02=_*s+d*h+f*c,t.m03=p*n+m*a+g*u,t.m04=p*r+m*o+g*l,t.m05=p*s+m*h+g*c,t.m06=v*n+y*a+T*u,t.m07=v*r+y*o+T*l,t.m08=v*s+y*h+T*c,t},e.multiplyMat4=function(t,e,i){var n=e.m00,r=e.m01,s=e.m02,a=e.m03,o=e.m04,h=e.m05,u=e.m06,l=e.m07,c=e.m08,_=i.m00,d=i.m01,f=i.m02,p=i.m04,m=i.m05,g=i.m06,v=i.m08,y=i.m09,T=i.m10;return t.m00=_*n+d*a+f*u,t.m01=_*r+d*o+f*l,t.m02=_*s+d*h+f*c,t.m03=p*n+m*a+g*u,t.m04=p*r+m*o+g*l,t.m05=p*s+m*h+g*c,t.m06=v*n+y*a+T*u,t.m07=v*r+y*o+T*l,t.m08=v*s+y*h+T*c,t},e.transform=function(t,e,i){this.translate(t,e,i)},e.translate=function(t,e,i){var n=e.m00,r=e.m01,s=e.m02,a=e.m03,o=e.m04,h=e.m05,u=e.m06,l=e.m07,c=e.m08,_=i.x,d=i.y;return t.m00=n,t.m01=r,t.m02=s,t.m03=a,t.m04=o,t.m05=h,t.m06=_*n+d*a+u,t.m07=_*r+d*o+l,t.m08=_*s+d*h+c,t},e.scale=function(t,e,i){var n=i.x,r=i.y;return t.m00=n*e.m00,t.m01=n*e.m01,t.m02=n*e.m02,t.m03=r*e.m03,t.m04=r*e.m04,t.m05=r*e.m05,t.m06=e.m06,t.m07=e.m07,t.m08=e.m08,t},e.rotate=function(t,e,i){var n=e.m00,r=e.m01,s=e.m02,a=e.m03,o=e.m04,h=e.m05,u=e.m06,l=e.m07,c=e.m08,_=Math.sin(i),d=Math.cos(i);return t.m00=d*n+_*a,t.m01=d*r+_*o,t.m02=d*s+_*h,t.m03=d*a-_*n,t.m04=d*o-_*r,t.m05=d*h-_*s,t.m06=u,t.m07=l,t.m08=c,t},e.fromMat4=function(t,e){return t.m00=e.m00,t.m01=e.m01,t.m02=e.m02,t.m03=e.m04,t.m04=e.m05,t.m05=e.m06,t.m06=e.m08,t.m07=e.m09,t.m08=e.m10,t},e.fromViewUp=function(t,i,n){return hn.lengthSqr(i)<Ci*Ci?(e.identity(t),t):(n=n||hn.UNIT_Y,hn.normalize(Tn,hn.cross(Tn,n,i)),hn.lengthSqr(Tn)<Ci*Ci?(e.identity(t),t):(hn.cross(Sn,i,Tn),e.set(t,Tn.x,Tn.y,Tn.z,Sn.x,Sn.y,Sn.z,i.x,i.y,i.z),t))},e.fromTranslation=function(t,e){return t.m00=1,t.m01=0,t.m02=0,t.m03=0,t.m04=1,t.m05=0,t.m06=e.x,t.m07=e.y,t.m08=1,t},e.fromScaling=function(t,e){return t.m00=e.x,t.m01=0,t.m02=0,t.m03=0,t.m04=e.y,t.m05=0,t.m06=0,t.m07=0,t.m08=1,t},e.fromRotation=function(t,e){var i=Math.sin(e),n=Math.cos(e);return t.m00=n,t.m01=i,t.m02=0,t.m03=-i,t.m04=n,t.m05=0,t.m06=0,t.m07=0,t.m08=1,t},e.fromQuat=function(t,e){var i=e.x,n=e.y,r=e.z,s=e.w,a=i+i,o=n+n,h=r+r,u=i*a,l=n*a,c=n*o,_=r*a,d=r*o,f=r*h,p=s*a,m=s*o,g=s*h;return t.m00=1-c-f,t.m03=l-g,t.m06=_+m,t.m01=l+g,t.m04=1-u-f,t.m07=d-p,t.m02=_-m,t.m05=d+p,t.m08=1-u-c,t},e.inverseTransposeMat4=function(t,e){var i=e.m00,n=e.m01,r=e.m02,s=e.m03,a=e.m04,o=e.m05,h=e.m06,u=e.m07,l=e.m08,c=e.m09,_=e.m10,d=e.m11,f=e.m12,p=e.m13,m=e.m14,g=e.m15,v=i*o-n*a,y=i*h-r*a,T=i*u-s*a,S=n*h-r*o,E=n*u-s*o,A=r*u-s*h,R=l*p-c*f,b=l*m-_*f,C=l*g-d*f,w=c*m-_*p,x=c*g-d*p,I=_*g-d*m,O=v*I-y*x+T*w+S*C-E*b+A*R;return O?(O=1/O,t.m00=(o*I-h*x+u*w)*O,t.m01=(h*C-a*I-u*b)*O,t.m02=(a*x-o*C+u*R)*O,t.m03=(r*x-n*I-s*w)*O,t.m04=(i*I-r*C+s*b)*O,t.m05=(n*C-i*x-s*R)*O,t.m06=(p*A-m*E+g*S)*O,t.m07=(m*T-f*A-g*y)*O,t.m08=(f*E-p*T+g*v)*O,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=Ci),Math.abs(t.m00-e.m00)<=i*Math.max(1,Math.abs(t.m00),Math.abs(e.m00))&&Math.abs(t.m01-e.m01)<=i*Math.max(1,Math.abs(t.m01),Math.abs(e.m01))&&Math.abs(t.m02-e.m02)<=i*Math.max(1,Math.abs(t.m02),Math.abs(e.m02))&&Math.abs(t.m03-e.m03)<=i*Math.max(1,Math.abs(t.m03),Math.abs(e.m03))&&Math.abs(t.m04-e.m04)<=i*Math.max(1,Math.abs(t.m04),Math.abs(e.m04))&&Math.abs(t.m05-e.m05)<=i*Math.max(1,Math.abs(t.m05),Math.abs(e.m05))&&Math.abs(t.m06-e.m06)<=i*Math.max(1,Math.abs(t.m06),Math.abs(e.m06))&&Math.abs(t.m07-e.m07)<=i*Math.max(1,Math.abs(t.m07),Math.abs(e.m07))&&Math.abs(t.m08-e.m08)<=i*Math.max(1,Math.abs(t.m08),Math.abs(e.m08))},e.toEuler=function(t,e){var i=t.m00,n=t.m01;t.m02;var r=t.m03,s=t.m04;t.m05;var a=t.m06,o=t.m07,h=t.m08;return o<.999?o>-.999?(e.x=Math.asin(-o),e.y=Math.atan2(a,h),e.z=Math.atan2(n,s),!0):(e.x=Ri,e.y=Math.atan2(r,i),e.z=0,!1):(e.x=-Ri,e.y=Math.atan2(-r,i),e.z=0,!1)};var i=e.prototype;return i.clone=function(){var t=this;return new e(t.m00,t.m01,t.m02,t.m03,t.m04,t.m05,t.m06,t.m07,t.m08)},i.set=function(t,e,i,n,r,s,a,o,h){return void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=1),void 0===s&&(s=0),void 0===a&&(a=0),void 0===o&&(o=0),void 0===h&&(h=1),"object"==typeof t?(this.m00=t.m00,this.m01=t.m01,this.m02=t.m02,this.m03=t.m03,this.m04=t.m04,this.m05=t.m05,this.m06=t.m06,this.m07=t.m07,this.m08=t.m08):(this.m00=t,this.m01=e,this.m02=i,this.m03=n,this.m04=r,this.m05=s,this.m06=a,this.m07=o,this.m08=h),this},i.equals=function(t,e){return void 0===e&&(e=Ci),Math.abs(this.m00-t.m00)<=e*Math.max(1,Math.abs(this.m00),Math.abs(t.m00))&&Math.abs(this.m01-t.m01)<=e*Math.max(1,Math.abs(this.m01),Math.abs(t.m01))&&Math.abs(this.m02-t.m02)<=e*Math.max(1,Math.abs(this.m02),Math.abs(t.m02))&&Math.abs(this.m03-t.m03)<=e*Math.max(1,Math.abs(this.m03),Math.abs(t.m03))&&Math.abs(this.m04-t.m04)<=e*Math.max(1,Math.abs(this.m04),Math.abs(t.m04))&&Math.abs(this.m05-t.m05)<=e*Math.max(1,Math.abs(this.m05),Math.abs(t.m05))&&Math.abs(this.m06-t.m06)<=e*Math.max(1,Math.abs(this.m06),Math.abs(t.m06))&&Math.abs(this.m07-t.m07)<=e*Math.max(1,Math.abs(this.m07),Math.abs(t.m07))&&Math.abs(this.m08-t.m08)<=e*Math.max(1,Math.abs(this.m08),Math.abs(t.m08))},i.strictEquals=function(t){return this.m00===t.m00&&this.m01===t.m01&&this.m02===t.m02&&this.m03===t.m03&&this.m04===t.m04&&this.m05===t.m05&&this.m06===t.m06&&this.m07===t.m07&&this.m08===t.m08},i.toString=function(){var t=this;return"[\n"+t.m00+", "+t.m01+", "+t.m02+",\n"+t.m03+",\n"+t.m04+", "+t.m05+",\n"+t.m06+", "+t.m07+",\n"+t.m08+"\n]"},i.identity=function(){return this.m00=1,this.m01=0,this.m02=0,this.m03=0,this.m04=1,this.m05=0,this.m06=0,this.m07=0,this.m08=1,this},i.transpose=function(){var t=this.m01,e=this.m02,i=this.m05;return this.m01=this.m03,this.m02=this.m06,this.m03=t,this.m05=this.m07,this.m06=e,this.m07=i,this},i.invert=function(){var t=this.m00,e=this.m01,i=this.m02,n=this.m03,r=this.m04,s=this.m05,a=this.m06,o=this.m07,h=this.m08,u=h*r-s*o,l=-h*n+s*a,c=o*n-r*a,_=t*u+e*l+i*c;return 0===_?(this.set(0,0,0,0,0,0,0,0,0),this):(_=1/_,this.m00=u*_,this.m01=(-h*e+i*o)*_,this.m02=(s*e-i*r)*_,this.m03=l*_,this.m04=(h*t-i*a)*_,this.m05=(-s*t+i*n)*_,this.m06=c*_,this.m07=(-o*t+e*a)*_,this.m08=(r*t-e*n)*_,this)},i.determinant=function(){var t=this.m00,e=this.m01,i=this.m02,n=this.m03,r=this.m04,s=this.m05,a=this.m06,o=this.m07,h=this.m08;return t*(h*r-s*o)+e*(-h*n+s*a)+i*(o*n-r*a)},i.add=function(t){return this.m00+=t.m00,this.m01+=t.m01,this.m02+=t.m02,this.m03+=t.m03,this.m04+=t.m04,this.m05+=t.m05,this.m06+=t.m06,this.m07+=t.m07,this.m08+=t.m08,this},i.subtract=function(t){return this.m00-=t.m00,this.m01-=t.m01,this.m02-=t.m02,this.m03-=t.m03,this.m04-=t.m04,this.m05-=t.m05,this.m06-=t.m06,this.m07-=t.m07,this.m08-=t.m08,this},i.multiply=function(t){var e=this.m00,i=this.m01,n=this.m02,r=this.m03,s=this.m04,a=this.m05,o=this.m06,h=this.m07,u=this.m08,l=t.m00,c=t.m01,_=t.m02,d=t.m03,f=t.m04,p=t.m05,m=t.m06,g=t.m07,v=t.m08;return this.m00=l*e+c*r+_*o,this.m01=l*i+c*s+_*h,this.m02=l*n+c*a+_*u,this.m03=d*e+f*r+p*o,this.m04=d*i+f*s+p*h,this.m05=d*n+f*a+p*u,this.m06=m*e+g*r+v*o,this.m07=m*i+g*s+v*h,this.m08=m*n+g*a+v*u,this},i.multiplyScalar=function(t){return this.m00*=t,this.m01*=t,this.m02*=t,this.m03*=t,this.m04*=t,this.m05*=t,this.m06*=t,this.m07*=t,this.m08*=t,this},i.scale=function(t){var e=t.x,i=t.y;return this.m00=e*this.m00,this.m01=e*this.m01,this.m02=e*this.m02,this.m03=i*this.m03,this.m04=i*this.m04,this.m05=i*this.m05,this.m06=this.m06,this.m07=this.m07,this.m08=this.m08,this},i.rotate=function(t){var e=this.m00,i=this.m01,n=this.m02,r=this.m03,s=this.m04,a=this.m05,o=this.m06,h=this.m07,u=this.m08,l=Math.sin(t),c=Math.cos(t);return this.m00=c*e+l*r,this.m01=c*i+l*s,this.m02=c*n+l*a,this.m03=c*r-l*e,this.m04=c*s-l*i,this.m05=c*a-l*n,this.m06=o,this.m07=h,this.m08=u,this},i.fromQuat=function(t){var e=t.x,i=t.y,n=t.z,r=t.w,s=e+e,a=i+i,o=n+n,h=e*s,u=i*s,l=i*a,c=n*s,_=n*a,d=n*o,f=r*s,p=r*a,m=r*o;return this.m00=1-l-d,this.m03=u-m,this.m06=c+p,this.m01=u+m,this.m04=1-h-d,this.m07=_-f,this.m02=c-p,this.m05=_+f,this.m08=1-h-l,this},e}(Ae));dn=vn,vn.IDENTITY=Object.freeze(new dn);var yn,Tn=new hn,Sn=new hn;gi.fastDefine("cc.Mat3",vn,{m00:1,m01:0,m02:0,m03:0,m04:1,m05:0,m06:0,m07:0,m08:1}),v.Mat3=vn;var En=t("aQ",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=hn.dot(i,n);return r<-.999999?(hn.cross(Cn,hn.UNIT_X,i),Cn.length()<1e-6&&hn.cross(Cn,hn.UNIT_Y,i),hn.normalize(Cn,Cn),e.fromAxisAngle(t,Cn,Math.PI),t):r>.999999?(t.x=0,t.y=0,t.z=0,t.w=1,t):(hn.cross(Cn,i,n),t.x=Cn.x,t.y=Cn.y,t.z=Cn.z,t.w=1+r,e.normalize(t,t))},e.getAxisAngle=function(t,e){var i=2*Math.acos(e.w),n=Math.sin(i/2);return 0!==n?(t.x=e.x/n,t.y=e.y/n,t.z=e.z/n):(t.x=1,t.y=0,t.z=0),i},e.multiply=function(t,e,i){var n=e.x*i.w+e.w*i.x+e.y*i.z-e.z*i.y,r=e.y*i.w+e.w*i.y+e.z*i.x-e.x*i.z,s=e.z*i.w+e.w*i.z+e.x*i.y-e.y*i.x,a=e.w*i.w-e.x*i.x-e.y*i.y-e.z*i.z;return t.x=n,t.y=r,t.z=s,t.w=a,t},e.multiplyScalar=function(t,e,i){return t.x=e.x*i,t.y=e.y*i,t.z=e.z*i,t.w=e.w*i,t},e.scaleAndAdd=function(t,e,i,n){return t.x=e.x+i.x*n,t.y=e.y+i.y*n,t.z=e.z+i.z*n,t.w=e.w+i.w*n,t},e.rotateX=function(t,e,i){i*=.5;var n=Math.sin(i),r=Math.cos(i),s=e.x,a=e.y,o=e.z,h=e.w;return t.x=s*r+h*n,t.y=a*r+o*n,t.z=o*r-a*n,t.w=h*r-s*n,t},e.rotateY=function(t,e,i){i*=.5;var n=Math.sin(i),r=Math.cos(i),s=e.x,a=e.y,o=e.z,h=e.w;return t.x=s*r-o*n,t.y=a*r+h*n,t.z=o*r+s*n,t.w=h*r-a*n,t},e.rotateZ=function(t,e,i){i*=.5;var n=Math.sin(i),r=Math.cos(i),s=e.x,a=e.y,o=e.z,h=e.w;return t.x=s*r+a*n,t.y=a*r-s*n,t.z=o*r+h*n,t.w=h*r-o*n,t},e.rotateAround=function(t,i,n,r){return e.invert(Rn,i),hn.transformQuat(Cn,n,Rn),e.fromAxisAngle(Rn,Cn,r),e.multiply(t,i,Rn),t},e.rotateAroundLocal=function(t,i,n,r){return e.fromAxisAngle(Rn,n,r),e.multiply(t,i,Rn),t},e.calculateW=function(t,e){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=Math.sqrt(Math.abs(1-e.x*e.x-e.y*e.y-e.z*e.z)),t},e.dot=function(t,e){return t.x*e.x+t.y*e.y+t.z*e.z+t.w*e.w},e.lerp=function(t,e,i,n){return t.x=e.x+n*(i.x-e.x),t.y=e.y+n*(i.y-e.y),t.z=e.z+n*(i.z-e.z),t.w=e.w+n*(i.w-e.w),t},e.slerp=function(t,e,i,n){var r=0,s=0,a=i.x,o=i.y,h=i.z,u=i.w,l=e.x*i.x+e.y*i.y+e.z*i.z+e.w*i.w;if(l<0&&(l=-l,a=-a,o=-o,h=-h,u=-u),1-l>1e-6){var c=Math.acos(l),_=Math.sin(c);r=Math.sin((1-n)*c)/_,s=Math.sin(n*c)/_}else r=1-n,s=n;return t.x=r*e.x+s*a,t.y=r*e.y+s*o,t.z=r*e.z+s*h,t.w=r*e.w+s*u,t},e.sqlerp=function(t,i,n,r,s,a){return e.slerp(Rn,i,s,a),e.slerp(bn,n,r,a),e.slerp(t,Rn,bn,2*a*(1-a)),t},e.invert=function(t,e){var i=e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w,n=i?1/i:0;return t.x=-e.x*n,t.y=-e.y*n,t.z=-e.z*n,t.w=e.w*n,t},e.conjugate=function(t,e){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=e.w,t},e.len=function(t){return Math.sqrt(t.x*t.x+t.y*t.y+t.z*t.z+t.w*t.w)},e.lengthSqr=function(t){return t.x*t.x+t.y*t.y+t.z*t.z+t.w*t.w},e.normalize=function(t,e){var i=e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w;return i>0?(i=1/Math.sqrt(i),t.x=e.x*i,t.y=e.y*i,t.z=e.z*i,t.w=e.w*i):(t.x=0,t.y=0,t.z=0,t.w=0),t},e.fromAxes=function(t,i,n,r){return vn.set(wn,i.x,i.y,i.z,n.x,n.y,n.z,r.x,r.y,r.z),e.normalize(t,e.fromMat3(t,wn))},e.fromViewUp=function(t,i,n){return vn.fromViewUp(wn,i,n),e.normalize(t,e.fromMat3(t,wn))},e.fromAxisAngle=function(t,e,i){i*=.5;var n=Math.sin(i);return t.x=n*e.x,t.y=n*e.y,t.z=n*e.z,t.w=Math.cos(i),t},e.fromMat3=function(t,e){var i=e.m00,n=e.m01,r=e.m02,s=e.m03,a=e.m04,o=e.m05,h=e.m06,u=e.m07,l=e.m08,c=i-a-l,_=a-i-l,d=l-i-a,f=0,p=i+a+l;c>p&&(p=c,f=1),_>p&&(p=_,f=2),d>p&&(p=d,f=3);var m=.5*Math.sqrt(p+1),g=.25/m;switch(f){case 0:t.w=m,t.x=(o-u)*g,t.y=(h-r)*g,t.z=(n-s)*g;break;case 1:t.w=(o-u)*g,t.x=m,t.y=(n+s)*g,t.z=(h+r)*g;break;case 2:t.w=(h-r)*g,t.x=(n+s)*g,t.y=m,t.z=(o+u)*g;break;case 3:t.w=(n-s)*g,t.x=(h+r)*g,t.y=(o+u)*g,t.z=m;break;default:t.w=1,t.x=0,t.y=0,t.z=0}return t},e.fromEuler=function(t,e,i,n){e*=xn,i*=xn,n*=xn;var r=Math.sin(e),s=Math.cos(e),a=Math.sin(i),o=Math.cos(i),h=Math.sin(n),u=Math.cos(n);return t.x=r*o*u+s*a*h,t.y=s*a*u+r*o*h,t.z=s*o*h-r*a*u,t.w=s*o*u-r*a*h,t},e.fromAngleZ=function(t,e){return e*=xn,t.x=t.y=0,t.z=Math.sin(e),t.w=Math.cos(e),t},e.toAxisX=function(t,e){var i=2*e.y,n=2*e.z;return t.x=1-i*e.y-n*e.z,t.y=i*e.x+n*e.w,t.z=n*e.x-i*e.w,t},e.toAxisY=function(t,e){var i=2*e.x,n=2*e.y,r=2*e.z;return t.x=n*e.x-r*e.w,t.y=1-i*e.x-r*e.z,t.z=r*e.y+i*e.w,t},e.toAxisZ=function(t,e){var i=2*e.x,n=2*e.y,r=2*e.z;return t.x=r*e.x+n*e.w,t.y=r*e.y-i*e.w,t.z=1-i*e.x-n*e.y,t},e.toEuler=function(t,e,i){var n=e.x,r=e.y,s=e.z,a=e.w,o=0,h=0,u=0,l=n*r+s*a;if(l>.499999)o=0,h=Pi(2*Math.atan2(n,a)),u=90;else if(l<-.499999)o=0,h=-Pi(2*Math.atan2(n,a)),u=-90;else{var c=n*n,_=r*r,d=s*s;o=Pi(Math.atan2(2*n*a-2*r*s,1-2*c-2*d)),h=Pi(Math.atan2(2*r*a-2*n*s,1-2*_-2*d)),u=Pi(Math.asin(2*l)),i&&(o=-180*Math.sign(o+1e-6)+o,h=-180*Math.sign(h+1e-6)+h,u=180*Math.sign(u+1e-6)-u)}return t.x=o,t.y=h,t.z=u,t},e.toEulerInYXZOrder=function(t,e){vn.fromQuat(wn,e),vn.toEuler(wn,t),t.x=Pi(t.x),t.y=Pi(t.y),t.z=Pi(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=Ci),Math.abs(t.x-e.x)<=i*Math.max(1,Math.abs(t.x),Math.abs(e.x))&&Math.abs(t.y-e.y)<=i*Math.max(1,Math.abs(t.y),Math.abs(e.y))&&Math.abs(t.z-e.z)<=i*Math.max(1,Math.abs(t.z),Math.abs(e.z))&&Math.abs(t.w-e.w)<=i*Math.max(1,Math.abs(t.w),Math.abs(e.w))},e.angle=function(t,i){var n=Math.min(Math.abs(e.dot(t,i)),1);return 2*Math.acos(n)},e.rotateTowards=function(t,i,n,r){var s=e.angle(i,n);if(0===s)return t.x=n.x,t.y=n.y,t.z=n.z,t.w=n.w,t;var a=Math.min(r/Pi(s),1);return e.slerp(t,i,n,a)};var i=e.prototype;return i.clone=function(){return new e(this.x,this.y,this.z,this.w)},i.set=function(t,e,i,n){return"object"==typeof t?(this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w):(this.x=t||0,this.y=e||0,this.z=i||0,this.w=null!=n?n:1),this},i.equals=function(t,e){return void 0===e&&(e=Ci),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}(Ae));yn=En,En.IDENTITY=Object.freeze(new yn);var An,Rn=new En,bn=new En,Cn=new hn,wn=new vn,xn=.5*Math.PI/180;function In(t,e,i,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1),new En(t,e,i,n)}gi.fastDefine("cc.Quat",En,{x:0,y:0,z:0,w:1}),v.Quat=En,v.quat=In;var On=t("b0",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])])),Dn=t("aT",function(t){function e(e,i,n,r,s,a,o,h,u,l,c,_,d,f,p,m){var g;return void 0===e&&(e=1),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=1),void 0===o&&(o=0),void 0===h&&(h=0),void 0===u&&(u=0),void 0===l&&(l=0),void 0===c&&(c=1),void 0===_&&(_=0),void 0===d&&(d=0),void 0===f&&(f=0),void 0===p&&(p=0),void 0===m&&(m=1),g=t.call(this)||this,"object"==typeof e?(g.m00=e.m00,g.m01=e.m01,g.m02=e.m02,g.m03=e.m03,g.m04=e.m04,g.m05=e.m05,g.m06=e.m06,g.m07=e.m07,g.m08=e.m08,g.m09=e.m09,g.m10=e.m10,g.m11=e.m11,g.m12=e.m12,g.m13=e.m13,g.m14=e.m14,g.m15=e.m15):(g.m00=e,g.m01=i,g.m02=n,g.m03=r,g.m04=s,g.m05=a,g.m06=o,g.m07=h,g.m08=u,g.m09=l,g.m10=c,g.m11=_,g.m12=d,g.m13=f,g.m14=p,g.m15=m),g}s(e,t),e.clone=function(t){return new e(t.m00,t.m01,t.m02,t.m03,t.m04,t.m05,t.m06,t.m07,t.m08,t.m09,t.m10,t.m11,t.m12,t.m13,t.m14,t.m15)},e.copy=function(t,e){return t.m00=e.m00,t.m01=e.m01,t.m02=e.m02,t.m03=e.m03,t.m04=e.m04,t.m05=e.m05,t.m06=e.m06,t.m07=e.m07,t.m08=e.m08,t.m09=e.m09,t.m10=e.m10,t.m11=e.m11,t.m12=e.m12,t.m13=e.m13,t.m14=e.m14,t.m15=e.m15,t},e.set=function(t,e,i,n,r,s,a,o,h,u,l,c,_,d,f,p,m){return t.m00=e,t.m01=i,t.m02=n,t.m03=r,t.m04=s,t.m05=a,t.m06=o,t.m07=h,t.m08=u,t.m09=l,t.m10=c,t.m11=_,t.m12=d,t.m13=f,t.m14=p,t.m15=m,t},e.identity=function(t){return t.m00=1,t.m01=0,t.m02=0,t.m03=0,t.m04=0,t.m05=1,t.m06=0,t.m07=0,t.m08=0,t.m09=0,t.m10=1,t.m11=0,t.m12=0,t.m13=0,t.m14=0,t.m15=1,t},e.transpose=function(t,e){if(t===e){var i=e.m01,n=e.m02,r=e.m03,s=e.m06,a=e.m07,o=e.m11;t.m01=e.m04,t.m02=e.m08,t.m03=e.m12,t.m04=i,t.m06=e.m09,t.m07=e.m13,t.m08=n,t.m09=s,t.m11=e.m14,t.m12=r,t.m13=a,t.m14=o}else t.m00=e.m00,t.m01=e.m04,t.m02=e.m08,t.m03=e.m12,t.m04=e.m01,t.m05=e.m05,t.m06=e.m09,t.m07=e.m13,t.m08=e.m02,t.m09=e.m06,t.m10=e.m10,t.m11=e.m14,t.m12=e.m03,t.m13=e.m07,t.m14=e.m11,t.m15=e.m15;return t},e.invert=function(t,e){var i=e.m00,n=e.m01,r=e.m02,s=e.m03,a=e.m04,o=e.m05,h=e.m06,u=e.m07,l=e.m08,c=e.m09,_=e.m10,d=e.m11,f=e.m12,p=e.m13,m=e.m14,g=e.m15,v=i*o-n*a,y=i*h-r*a,T=i*u-s*a,S=n*h-r*o,E=n*u-s*o,A=r*u-s*h,R=l*p-c*f,b=l*m-_*f,C=l*g-d*f,w=c*m-_*p,x=c*g-d*p,I=_*g-d*m,O=v*I-y*x+T*w+S*C-E*b+A*R;return 0===O?(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):(O=1/O,t.m00=(o*I-h*x+u*w)*O,t.m01=(r*x-n*I-s*w)*O,t.m02=(p*A-m*E+g*S)*O,t.m03=(_*E-c*A-d*S)*O,t.m04=(h*C-a*I-u*b)*O,t.m05=(i*I-r*C+s*b)*O,t.m06=(m*T-f*A-g*y)*O,t.m07=(l*A-_*T+d*y)*O,t.m08=(a*x-o*C+u*R)*O,t.m09=(n*C-i*x-s*R)*O,t.m10=(f*E-p*T+g*v)*O,t.m11=(c*T-l*E-d*v)*O,t.m12=(o*b-a*w-h*R)*O,t.m13=(i*w-n*b+r*R)*O,t.m14=(p*y-f*S-m*v)*O,t.m15=(l*S-c*y+_*v)*O,t)},e.determinant=function(t){var e=t.m00,i=t.m01,n=t.m02,r=t.m03,s=t.m04,a=t.m05,o=t.m06,h=t.m07,u=t.m08,l=t.m09,c=t.m10,_=t.m11,d=t.m12,f=t.m13,p=t.m14,m=t.m15;return(e*a-i*s)*(c*m-_*p)-(e*o-n*s)*(l*m-_*f)+(e*h-r*s)*(l*p-c*f)+(i*o-n*a)*(u*m-_*d)-(i*h-r*a)*(u*p-c*d)+(n*h-r*o)*(u*f-l*d)},e.multiply=function(t,e,i){var n=e.m00,r=e.m01,s=e.m02,a=e.m03,o=e.m04,h=e.m05,u=e.m06,l=e.m07,c=e.m08,_=e.m09,d=e.m10,f=e.m11,p=e.m12,m=e.m13,g=e.m14,v=e.m15,y=i.m00,T=i.m01,S=i.m02,E=i.m03;return t.m00=y*n+T*o+S*c+E*p,t.m01=y*r+T*h+S*_+E*m,t.m02=y*s+T*u+S*d+E*g,t.m03=y*a+T*l+S*f+E*v,y=i.m04,T=i.m05,S=i.m06,E=i.m07,t.m04=y*n+T*o+S*c+E*p,t.m05=y*r+T*h+S*_+E*m,t.m06=y*s+T*u+S*d+E*g,t.m07=y*a+T*l+S*f+E*v,y=i.m08,T=i.m09,S=i.m10,E=i.m11,t.m08=y*n+T*o+S*c+E*p,t.m09=y*r+T*h+S*_+E*m,t.m10=y*s+T*u+S*d+E*g,t.m11=y*a+T*l+S*f+E*v,y=i.m12,T=i.m13,S=i.m14,E=i.m15,t.m12=y*n+T*o+S*c+E*p,t.m13=y*r+T*h+S*_+E*m,t.m14=y*s+T*u+S*d+E*g,t.m15=y*a+T*l+S*f+E*v,t},e.transform=function(t,e,i){var n=i.x,r=i.y,s=i.z;if(e===t)t.m12=e.m00*n+e.m04*r+e.m08*s+e.m12,t.m13=e.m01*n+e.m05*r+e.m09*s+e.m13,t.m14=e.m02*n+e.m06*r+e.m10*s+e.m14,t.m15=e.m03*n+e.m07*r+e.m11*s+e.m15;else{var a=e.m00,o=e.m01,h=e.m02,u=e.m03,l=e.m04,c=e.m05,_=e.m06,d=e.m07,f=e.m08,p=e.m09,m=e.m10,g=e.m11;t.m00=a,t.m01=o,t.m02=h,t.m03=u,t.m04=l,t.m05=c,t.m06=_,t.m07=d,t.m08=f,t.m09=p,t.m10=m,t.m11=g,t.m12=a*n+l*r+f*s+e.m12,t.m13=o*n+c*r+p*s+e.m13,t.m14=h*n+_*r+m*s+e.m14,t.m15=u*n+d*r+g*s+e.m15}return t},e.translate=function(t,e,i){return e===t?(t.m12+=i.x,t.m13+=i.y,t.m14+=i.z):(t.m00=e.m00,t.m01=e.m01,t.m02=e.m02,t.m03=e.m03,t.m04=e.m04,t.m05=e.m05,t.m06=e.m06,t.m07=e.m07,t.m08=e.m08,t.m09=e.m09,t.m10=e.m10,t.m11=e.m11,t.m12=e.m12+i.x,t.m13=e.m13+i.y,t.m14=e.m14+i.z,t.m15=e.m15),t},e.scale=function(t,e,i){var n=i.x,r=i.y,s=i.z;return t.m00=e.m00*n,t.m01=e.m01*n,t.m02=e.m02*n,t.m03=e.m03*n,t.m04=e.m04*r,t.m05=e.m05*r,t.m06=e.m06*r,t.m07=e.m07*r,t.m08=e.m08*s,t.m09=e.m09*s,t.m10=e.m10*s,t.m11=e.m11*s,t.m12=e.m12,t.m13=e.m13,t.m14=e.m14,t.m15=e.m15,t},e.rotate=function(t,e,i,n){var r=n.x,s=n.y,a=n.z,o=Math.sqrt(r*r+s*s+a*a);if(Math.abs(o)<Ci)return null;r*=o=1/o,s*=o,a*=o;var h=Math.sin(i),u=Math.cos(i),l=1-u,c=e.m00,_=e.m01,d=e.m02,f=e.m03,p=e.m04,m=e.m05,g=e.m06,v=e.m07,y=e.m08,T=e.m09,S=e.m10,E=e.m11,A=r*r*l+u,R=s*r*l+a*h,b=a*r*l-s*h,C=r*s*l-a*h,w=s*s*l+u,x=a*s*l+r*h,I=r*a*l+s*h,O=s*a*l-r*h,D=a*a*l+u;return t.m00=c*A+p*R+y*b,t.m01=_*A+m*R+T*b,t.m02=d*A+g*R+S*b,t.m03=f*A+v*R+E*b,t.m04=c*C+p*w+y*x,t.m05=_*C+m*w+T*x,t.m06=d*C+g*w+S*x,t.m07=f*C+v*w+E*x,t.m08=c*I+p*O+y*D,t.m09=_*I+m*O+T*D,t.m10=d*I+g*O+S*D,t.m11=f*I+v*O+E*D,e!==t&&(t.m12=e.m12,t.m13=e.m13,t.m14=e.m14,t.m15=e.m15),t},e.rotateX=function(t,e,i){var n=Math.sin(i),r=Math.cos(i),s=e.m04,a=e.m05,o=e.m06,h=e.m07,u=e.m08,l=e.m09,c=e.m10,_=e.m11;return e!==t&&(t.m00=e.m00,t.m01=e.m01,t.m02=e.m02,t.m03=e.m03,t.m12=e.m12,t.m13=e.m13,t.m14=e.m14,t.m15=e.m15),t.m04=s*r+u*n,t.m05=a*r+l*n,t.m06=o*r+c*n,t.m07=h*r+_*n,t.m08=u*r-s*n,t.m09=l*r-a*n,t.m10=c*r-o*n,t.m11=_*r-h*n,t},e.rotateY=function(t,e,i){var n=Math.sin(i),r=Math.cos(i),s=e.m00,a=e.m01,o=e.m02,h=e.m03,u=e.m08,l=e.m09,c=e.m10,_=e.m11;return e!==t&&(t.m04=e.m04,t.m05=e.m05,t.m06=e.m06,t.m07=e.m07,t.m12=e.m12,t.m13=e.m13,t.m14=e.m14,t.m15=e.m15),t.m00=s*r-u*n,t.m01=a*r-l*n,t.m02=o*r-c*n,t.m03=h*r-_*n,t.m08=s*n+u*r,t.m09=a*n+l*r,t.m10=o*n+c*r,t.m11=h*n+_*r,t},e.rotateZ=function(t,e,i){var n=Math.sin(i),r=Math.cos(i),s=e.m00,a=e.m01,o=e.m02,h=e.m03,u=e.m04,l=e.m05,c=e.m06,_=e.m07;return e!==t&&(t.m08=e.m08,t.m09=e.m09,t.m10=e.m10,t.m11=e.m11,t.m12=e.m12,t.m13=e.m13,t.m14=e.m14,t.m15=e.m15),t.m00=s*r+u*n,t.m01=a*r+l*n,t.m02=o*r+c*n,t.m03=h*r+_*n,t.m04=u*r-s*n,t.m05=l*r-a*n,t.m06=c*r-o*n,t.m07=_*r-h*n,t},e.fromTranslation=function(t,e){return t.m00=1,t.m01=0,t.m02=0,t.m03=0,t.m04=0,t.m05=1,t.m06=0,t.m07=0,t.m08=0,t.m09=0,t.m10=1,t.m11=0,t.m12=e.x,t.m13=e.y,t.m14=e.z,t.m15=1,t},e.fromScaling=function(t,e){return t.m00=e.x,t.m01=0,t.m02=0,t.m03=0,t.m04=0,t.m05=e.y,t.m06=0,t.m07=0,t.m08=0,t.m09=0,t.m10=e.z,t.m11=0,t.m12=0,t.m13=0,t.m14=0,t.m15=1,t},e.fromRotation=function(t,e,i){var n=i.x,r=i.y,s=i.z,a=Math.sqrt(n*n+r*r+s*s);if(Math.abs(a)<Ci)return null;n*=a=1/a,r*=a,s*=a;var o=Math.sin(e),h=Math.cos(e),u=1-h;return t.m00=n*n*u+h,t.m01=r*n*u+s*o,t.m02=s*n*u-r*o,t.m03=0,t.m04=n*r*u-s*o,t.m05=r*r*u+h,t.m06=s*r*u+n*o,t.m07=0,t.m08=n*s*u+r*o,t.m09=r*s*u-n*o,t.m10=s*s*u+h,t.m11=0,t.m12=0,t.m13=0,t.m14=0,t.m15=1,t},e.fromXRotation=function(t,e){var i=Math.sin(e),n=Math.cos(e);return t.m00=1,t.m01=0,t.m02=0,t.m03=0,t.m04=0,t.m05=n,t.m06=i,t.m07=0,t.m08=0,t.m09=-i,t.m10=n,t.m11=0,t.m12=0,t.m13=0,t.m14=0,t.m15=1,t},e.fromYRotation=function(t,e){var i=Math.sin(e),n=Math.cos(e);return t.m00=n,t.m01=0,t.m02=-i,t.m03=0,t.m04=0,t.m05=1,t.m06=0,t.m07=0,t.m08=i,t.m09=0,t.m10=n,t.m11=0,t.m12=0,t.m13=0,t.m14=0,t.m15=1,t},e.fromZRotation=function(t,e){var i=Math.sin(e),n=Math.cos(e);return t.m00=n,t.m01=i,t.m02=0,t.m03=0,t.m04=-i,t.m05=n,t.m06=0,t.m07=0,t.m08=0,t.m09=0,t.m10=1,t.m11=0,t.m12=0,t.m13=0,t.m14=0,t.m15=1,t},e.fromRT=function(t,e,i){var n=e.x,r=e.y,s=e.z,a=e.w,o=n+n,h=r+r,u=s+s,l=n*o,c=n*h,_=n*u,d=r*h,f=r*u,p=s*u,m=a*o,g=a*h,v=a*u;return t.m00=1-(d+p),t.m01=c+v,t.m02=_-g,t.m03=0,t.m04=c-v,t.m05=1-(l+p),t.m06=f+m,t.m07=0,t.m08=_+g,t.m09=f-m,t.m10=1-(l+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=Bn.m00=e.m00,n=Bn.m01=e.m01,r=Bn.m02=e.m02,s=Bn.m03=e.m04,a=Bn.m04=e.m05,o=Bn.m05=e.m06,h=Bn.m06=e.m08,u=Bn.m07=e.m09,l=Bn.m08=e.m10;return t.x=Math.sqrt(i*i+n*n+r*r),t.y=Math.sqrt(s*s+a*a+o*o),t.z=Math.sqrt(h*h+u*u+l*l),vn.determinant(Bn)<0&&(t.x*=-1),t},e.getRotation=function(t,e){var i=e.m00+e.m05+e.m10,n=0;return i>0?(n=2*Math.sqrt(i+1),t.w=.25*n,t.x=(e.m06-e.m09)/n,t.y=(e.m08-e.m02)/n,t.z=(e.m01-e.m04)/n):e.m00>e.m05&&e.m00>e.m10?(n=2*Math.sqrt(1+e.m00-e.m05-e.m10),t.w=(e.m06-e.m09)/n,t.x=.25*n,t.y=(e.m01+e.m04)/n,t.z=(e.m08+e.m02)/n):e.m05>e.m10?(n=2*Math.sqrt(1+e.m05-e.m00-e.m10),t.w=(e.m08-e.m02)/n,t.x=(e.m01+e.m04)/n,t.y=.25*n,t.z=(e.m06+e.m09)/n):(n=2*Math.sqrt(1+e.m10-e.m00-e.m05),t.w=(e.m01-e.m04)/n,t.x=(e.m08+e.m02)/n,t.y=(e.m06+e.m09)/n,t.z=.25*n),t},e.toRTS=function(t,e,i,n){var r=hn.set(Pn,t.m00,t.m01,t.m02).length(),s=hn.set(Pn,t.m04,t.m05,t.m06).length(),a=hn.set(Pn,t.m08,t.m09,t.m10).length();Bn.m00=t.m00/r,Bn.m01=t.m01/r,Bn.m02=t.m02/r,Bn.m03=t.m04/s,Bn.m04=t.m05/s,Bn.m05=t.m06/s,Bn.m06=t.m08/a,Bn.m07=t.m09/a,Bn.m08=t.m10/a;var o=vn.determinant(Bn);n&&(hn.set(n,r,s,a),o<0&&(n.x*=-1)),i&&hn.set(i,t.m12,t.m13,t.m14),e&&(o<0&&(Bn.m00*=-1,Bn.m01*=-1,Bn.m02*=-1),En.fromMat3(e,Bn))},e.toSRT=function(t,e,i,n){var r=hn.set(Pn,t.m00,t.m01,t.m02).length(),s=hn.set(Pn,t.m04,t.m05,t.m06).length(),a=hn.set(Pn,t.m08,t.m09,t.m10).length();n&&(n.x=r,n.y=s,n.z=a),i&&hn.set(i,t.m12,t.m13,t.m14),e&&(Bn.m00=t.m00/r,Bn.m01=t.m01/r,Bn.m02=t.m02/r,Bn.m03=t.m04/s,Bn.m04=t.m05/s,Bn.m05=t.m06/s,Bn.m06=t.m08/a,Bn.m07=t.m09/a,Bn.m08=t.m10/a,vn.determinant(Bn)<0&&(n&&(n.x*=-1),Bn.m00*=-1,Bn.m01*=-1,Bn.m02*=-1),En.fromMat3(e,Bn))},e.toEuler=function(t,e){return vn.set(Bn,t.m00,t.m01,t.m02,t.m04,t.m05,t.m06,t.m08,t.m09,t.m10),vn.toEuler(Bn,e)},e.fromRTS=function(t,e,i,n){var r=e.x,s=e.y,a=e.z,o=e.w,h=r+r,u=s+s,l=a+a,c=r*h,_=r*u,d=r*l,f=s*u,p=s*l,m=a*l,g=o*h,v=o*u,y=o*l,T=n.x,S=n.y,E=n.z;return t.m00=(1-(f+m))*T,t.m01=(_+y)*T,t.m02=(d-v)*T,t.m03=0,t.m04=(_-y)*S,t.m05=(1-(c+m))*S,t.m06=(p+g)*S,t.m07=0,t.m08=(d+v)*E,t.m09=(p-g)*E,t.m10=(1-(c+f))*E,t.m11=0,t.m12=i.x,t.m13=i.y,t.m14=i.z,t.m15=1,t},e.fromSRT=function(t,e,i,n){var r=e.x,s=e.y,a=e.z,o=e.w,h=r+r,u=s+s,l=a+a,c=r*h,_=r*u,d=r*l,f=s*u,p=s*l,m=a*l,g=o*h,v=o*u,y=o*l,T=n.x,S=n.y,E=n.z;return t.m00=(1-(f+m))*T,t.m01=(_+y)*T,t.m02=(d-v)*T,t.m03=0,t.m04=(_-y)*S,t.m05=(1-(c+m))*S,t.m06=(p+g)*S,t.m07=0,t.m08=(d+v)*E,t.m09=(p-g)*E,t.m10=(1-(c+f))*E,t.m11=0,t.m12=i.x,t.m13=i.y,t.m14=i.z,t.m15=1,t},e.fromRTSOrigin=function(t,e,i,n,r){var s=e.x,a=e.y,o=e.z,h=e.w,u=s+s,l=a+a,c=o+o,_=s*u,d=s*l,f=s*c,p=a*l,m=a*c,g=o*c,v=h*u,y=h*l,T=h*c,S=n.x,E=n.y,A=n.z,R=r.x,b=r.y,C=r.z;return t.m00=(1-(p+g))*S,t.m01=(d+T)*S,t.m02=(f-y)*S,t.m03=0,t.m04=(d-T)*E,t.m05=(1-(_+g))*E,t.m06=(m+v)*E,t.m07=0,t.m08=(f+y)*A,t.m09=(m-v)*A,t.m10=(1-(_+p))*A,t.m11=0,t.m12=i.x+R-(t.m00*R+t.m04*b+t.m08*C),t.m13=i.y+b-(t.m01*R+t.m05*b+t.m09*C),t.m14=i.z+C-(t.m02*R+t.m06*b+t.m10*C),t.m15=1,t},e.fromSRTOrigin=function(t,e,i,n,r){var s=e.x,a=e.y,o=e.z,h=e.w,u=s+s,l=a+a,c=o+o,_=s*u,d=s*l,f=s*c,p=a*l,m=a*c,g=o*c,v=h*u,y=h*l,T=h*c,S=n.x,E=n.y,A=n.z,R=r.x,b=r.y,C=r.z;return t.m00=(1-(p+g))*S,t.m01=(d+T)*S,t.m02=(f-y)*S,t.m03=0,t.m04=(d-T)*E,t.m05=(1-(_+g))*E,t.m06=(m+v)*E,t.m07=0,t.m08=(f+y)*A,t.m09=(m-v)*A,t.m10=(1-(_+p))*A,t.m11=0,t.m12=i.x+R-(t.m00*R+t.m04*b+t.m08*C),t.m13=i.y+b-(t.m01*R+t.m05*b+t.m09*C),t.m14=i.z+C-(t.m02*R+t.m06*b+t.m10*C),t.m15=1,t},e.fromQuat=function(t,e){var i=e.x,n=e.y,r=e.z,s=e.w,a=i+i,o=n+n,h=r+r,u=i*a,l=n*a,c=n*o,_=r*a,d=r*o,f=r*h,p=s*a,m=s*o,g=s*h;return t.m00=1-c-f,t.m01=l+g,t.m02=_-m,t.m03=0,t.m04=l-g,t.m05=1-u-f,t.m06=d+p,t.m07=0,t.m08=_+m,t.m09=d-p,t.m10=1-u-c,t.m11=0,t.m12=0,t.m13=0,t.m14=0,t.m15=1,t},e.frustum=function(t,e,i,n,r,s,a){var o=1/(i-e),h=1/(r-n),u=1/(s-a);return t.m00=2*s*o,t.m01=0,t.m02=0,t.m03=0,t.m04=0,t.m05=2*s*h,t.m06=0,t.m07=0,t.m08=(i+e)*o,t.m09=(r+n)*h,t.m10=(a+s)*u,t.m11=-1,t.m12=0,t.m13=0,t.m14=a*s*2*u,t.m15=0,t},e.perspective=function(t,e,i,n,r,s,a,o,h){void 0===s&&(s=!0),void 0===a&&(a=-1),void 0===o&&(o=1),void 0===h&&(h=0);var u=1/Math.tan(e/2),l=1/(n-r),c=s?u/i:u,_=(s?u:u*i)*o,d=On[h];return t.m00=c*d[0],t.m01=c*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-a*n)*l,t.m11=-1,t.m12=0,t.m13=0,t.m14=r*n*l*(1-a),t.m15=0,t},e.ortho=function(t,e,i,n,r,s,a,o,h,u){void 0===o&&(o=-1),void 0===h&&(h=1),void 0===u&&(u=0);var l=1/(e-i),c=1/(n-r)*h,_=1/(s-a),d=-2*l,f=-2*c,p=(e+i)*l,m=(r+n)*c,g=On[u];return t.m00=d*g[0],t.m01=d*g[1],t.m02=0,t.m03=0,t.m04=f*g[2],t.m05=f*g[3],t.m06=0,t.m07=0,t.m08=0,t.m09=0,t.m10=_*(1-o),t.m11=0,t.m12=p*g[0]+m*g[2],t.m13=p*g[1]+m*g[3],t.m14=(s-o*a)*_,t.m15=1,t},e.lookAt=function(t,e,i,n){var r=e.x,s=e.y,a=e.z,o=n.x,h=n.y,u=n.z,l=r-i.x,c=s-i.y,_=a-i.z,d=1/Math.sqrt(l*l+c*c+_*_),f=h*(_*=d)-u*(c*=d),p=u*(l*=d)-o*_,m=o*c-h*l,g=c*(m*=d=1/Math.sqrt(f*f+p*p+m*m))-_*(p*=d),v=_*(f*=d)-l*m,y=l*p-c*f;return t.m00=f,t.m01=g,t.m02=l,t.m03=0,t.m04=p,t.m05=v,t.m06=c,t.m07=0,t.m08=m,t.m09=y,t.m10=_,t.m11=0,t.m12=-(f*r+p*s+m*a),t.m13=-(g*r+v*s+y*a),t.m14=-(l*r+c*s+_*a),t.m15=1,t},e.inverseTranspose=function(t,e){var i=e.m00,n=e.m01,r=e.m02,s=e.m03,a=e.m04,o=e.m05,h=e.m06,u=e.m07,l=e.m08,c=e.m09,_=e.m10,d=e.m11,f=e.m12,p=e.m13,m=e.m14,g=e.m15,v=i*o-n*a,y=i*h-r*a,T=i*u-s*a,S=n*h-r*o,E=n*u-s*o,A=r*u-s*h,R=l*p-c*f,b=l*m-_*f,C=l*g-d*f,w=c*m-_*p,x=c*g-d*p,I=_*g-d*m,O=v*I-y*x+T*w+S*C-E*b+A*R;return O?(O=1/O,t.m00=(o*I-h*x+u*w)*O,t.m01=(h*C-a*I-u*b)*O,t.m02=(a*x-o*C+u*R)*O,t.m03=0,t.m04=(r*x-n*I-s*w)*O,t.m05=(i*I-r*C+s*b)*O,t.m06=(n*C-i*x-s*R)*O,t.m07=0,t.m08=(p*A-m*E+g*S)*O,t.m09=(m*T-f*A-g*y)*O,t.m10=(f*E-p*T+g*v)*O,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=Ci),Math.abs(t.m00-e.m00)<=i*Math.max(1,Math.abs(t.m00),Math.abs(e.m00))&&Math.abs(t.m01-e.m01)<=i*Math.max(1,Math.abs(t.m01),Math.abs(e.m01))&&Math.abs(t.m02-e.m02)<=i*Math.max(1,Math.abs(t.m02),Math.abs(e.m02))&&Math.abs(t.m03-e.m03)<=i*Math.max(1,Math.abs(t.m03),Math.abs(e.m03))&&Math.abs(t.m04-e.m04)<=i*Math.max(1,Math.abs(t.m04),Math.abs(e.m04))&&Math.abs(t.m05-e.m05)<=i*Math.max(1,Math.abs(t.m05),Math.abs(e.m05))&&Math.abs(t.m06-e.m06)<=i*Math.max(1,Math.abs(t.m06),Math.abs(e.m06))&&Math.abs(t.m07-e.m07)<=i*Math.max(1,Math.abs(t.m07),Math.abs(e.m07))&&Math.abs(t.m08-e.m08)<=i*Math.max(1,Math.abs(t.m08),Math.abs(e.m08))&&Math.abs(t.m09-e.m09)<=i*Math.max(1,Math.abs(t.m09),Math.abs(e.m09))&&Math.abs(t.m10-e.m10)<=i*Math.max(1,Math.abs(t.m10),Math.abs(e.m10))&&Math.abs(t.m11-e.m11)<=i*Math.max(1,Math.abs(t.m11),Math.abs(e.m11))&&Math.abs(t.m12-e.m12)<=i*Math.max(1,Math.abs(t.m12),Math.abs(e.m12))&&Math.abs(t.m13-e.m13)<=i*Math.max(1,Math.abs(t.m13),Math.abs(e.m13))&&Math.abs(t.m14-e.m14)<=i*Math.max(1,Math.abs(t.m14),Math.abs(e.m14))&&Math.abs(t.m15-e.m15)<=i*Math.max(1,Math.abs(t.m15),Math.abs(e.m15))};var i=e.prototype;return i.clone=function(){return new e(this.m00,this.m01,this.m02,this.m03,this.m04,this.m05,this.m06,this.m07,this.m08,this.m09,this.m10,this.m11,this.m12,this.m13,this.m14,this.m15)},i.set=function(t,e,i,n,r,s,a,o,h,u,l,c,_,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===a&&(a=0),void 0===o&&(o=0),void 0===h&&(h=0),void 0===u&&(u=0),void 0===l&&(l=1),void 0===c&&(c=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=a,this.m07=o,this.m08=h,this.m09=u,this.m10=l,this.m11=c,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=Ci),!(Math.abs(this.m00)===1/0||Math.abs(this.m01)===1/0||Math.abs(this.m02)===1/0||Math.abs(this.m03)===1/0||Math.abs(this.m04)===1/0||Math.abs(this.m05)===1/0||Math.abs(this.m06)===1/0||Math.abs(this.m07)===1/0||Math.abs(this.m08)===1/0||Math.abs(this.m09)===1/0||Math.abs(this.m10)===1/0||Math.abs(this.m11)===1/0||Math.abs(this.m12)===1/0||Math.abs(this.m13)===1/0||Math.abs(this.m14)===1/0||Math.abs(this.m15)===1/0)&&Math.abs(this.m00-t.m00)<=e*Math.max(1,Math.abs(this.m00),Math.abs(t.m00))&&Math.abs(this.m01-t.m01)<=e*Math.max(1,Math.abs(this.m01),Math.abs(t.m01))&&Math.abs(this.m02-t.m02)<=e*Math.max(1,Math.abs(this.m02),Math.abs(t.m02))&&Math.abs(this.m03-t.m03)<=e*Math.max(1,Math.abs(this.m03),Math.abs(t.m03))&&Math.abs(this.m04-t.m04)<=e*Math.max(1,Math.abs(this.m04),Math.abs(t.m04))&&Math.abs(this.m05-t.m05)<=e*Math.max(1,Math.abs(this.m05),Math.abs(t.m05))&&Math.abs(this.m06-t.m06)<=e*Math.max(1,Math.abs(this.m06),Math.abs(t.m06))&&Math.abs(this.m07-t.m07)<=e*Math.max(1,Math.abs(this.m07),Math.abs(t.m07))&&Math.abs(this.m08-t.m08)<=e*Math.max(1,Math.abs(this.m08),Math.abs(t.m08))&&Math.abs(this.m09-t.m09)<=e*Math.max(1,Math.abs(this.m09),Math.abs(t.m09))&&Math.abs(this.m10-t.m10)<=e*Math.max(1,Math.abs(this.m10),Math.abs(t.m10))&&Math.abs(this.m11-t.m11)<=e*Math.max(1,Math.abs(this.m11),Math.abs(t.m11))&&Math.abs(this.m12-t.m12)<=e*Math.max(1,Math.abs(this.m12),Math.abs(t.m12))&&Math.abs(this.m13-t.m13)<=e*Math.max(1,Math.abs(this.m13),Math.abs(t.m13))&&Math.abs(this.m14-t.m14)<=e*Math.max(1,Math.abs(this.m14),Math.abs(t.m14))&&Math.abs(this.m15-t.m15)<=e*Math.max(1,Math.abs(this.m15),Math.abs(t.m15))},i.strictEquals=function(t){return this.m00===t.m00&&this.m01===t.m01&&this.m02===t.m02&&this.m03===t.m03&&this.m04===t.m04&&this.m05===t.m05&&this.m06===t.m06&&this.m07===t.m07&&this.m08===t.m08&&this.m09===t.m09&&this.m10===t.m10&&this.m11===t.m11&&this.m12===t.m12&&this.m13===t.m13&&this.m14===t.m14&&this.m15===t.m15},i.toString=function(){return"[\n"+this.m00+", "+this.m01+", "+this.m02+", "+this.m03+",\n"+this.m04+", "+this.m05+", "+this.m06+", "+this.m07+",\n"+this.m08+", "+this.m09+", "+this.m10+", "+this.m11+",\n"+this.m12+", "+this.m13+", "+this.m14+", "+this.m15+"\n]"},i.identity=function(){return this.m00=1,this.m01=0,this.m02=0,this.m03=0,this.m04=0,this.m05=1,this.m06=0,this.m07=0,this.m08=0,this.m09=0,this.m10=1,this.m11=0,this.m12=0,this.m13=0,this.m14=0,this.m15=1,this},i.zero=function(){return this.m00=0,this.m01=0,this.m02=0,this.m03=0,this.m04=0,this.m05=0,this.m06=0,this.m07=0,this.m08=0,this.m09=0,this.m10=0,this.m11=0,this.m12=0,this.m13=0,this.m14=0,this.m15=0,this},i.transpose=function(){var t=this.m01,e=this.m02,i=this.m03,n=this.m06,r=this.m07,s=this.m11;return this.m01=this.m04,this.m02=this.m08,this.m03=this.m12,this.m04=t,this.m06=this.m09,this.m07=this.m13,this.m08=e,this.m09=n,this.m11=this.m14,this.m12=i,this.m13=r,this.m14=s,this},i.invert=function(){var t=this.m00,e=this.m01,i=this.m02,n=this.m03,r=this.m04,s=this.m05,a=this.m06,o=this.m07,h=this.m08,u=this.m09,l=this.m10,c=this.m11,_=this.m12,d=this.m13,f=this.m14,p=this.m15,m=t*s-e*r,g=t*a-i*r,v=t*o-n*r,y=e*a-i*s,T=e*o-n*s,S=i*o-n*a,E=h*d-u*_,A=h*f-l*_,R=h*p-c*_,b=u*f-l*d,C=u*p-c*d,w=l*p-c*f,x=m*w-g*C+v*b+y*R-T*A+S*E;return 0===x?(this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),this):(x=1/x,this.m00=(s*w-a*C+o*b)*x,this.m01=(i*C-e*w-n*b)*x,this.m02=(d*S-f*T+p*y)*x,this.m03=(l*T-u*S-c*y)*x,this.m04=(a*R-r*w-o*A)*x,this.m05=(t*w-i*R+n*A)*x,this.m06=(f*v-_*S-p*g)*x,this.m07=(h*S-l*v+c*g)*x,this.m08=(r*C-s*R+o*E)*x,this.m09=(e*R-t*C-n*E)*x,this.m10=(_*T-d*v+p*m)*x,this.m11=(u*v-h*T-c*m)*x,this.m12=(s*A-r*b-a*E)*x,this.m13=(t*b-e*A+i*E)*x,this.m14=(d*g-_*y-f*m)*x,this.m15=(h*y-u*g+l*m)*x,this)},i.determinant=function(){var t=this.m00,e=this.m01,i=this.m02,n=this.m03,r=this.m04,s=this.m05,a=this.m06,o=this.m07,h=this.m08,u=this.m09,l=this.m10,c=this.m11,_=this.m12,d=this.m13,f=this.m14,p=this.m15;return(t*s-e*r)*(l*p-c*f)-(t*a-i*r)*(u*p-c*d)+(t*o-n*r)*(u*f-l*d)+(e*a-i*s)*(h*p-c*_)-(e*o-n*s)*(h*f-l*_)+(i*o-n*a)*(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,a=this.m05,o=this.m06,h=this.m07,u=this.m08,l=this.m09,c=this.m10,_=this.m11,d=this.m12,f=this.m13,p=this.m14,m=this.m15,g=t.m00,v=t.m01,y=t.m02,T=t.m03;return this.m00=g*e+v*s+y*u+T*d,this.m01=g*i+v*a+y*l+T*f,this.m02=g*n+v*o+y*c+T*p,this.m03=g*r+v*h+y*_+T*m,g=t.m04,v=t.m05,y=t.m06,T=t.m07,this.m04=g*e+v*s+y*u+T*d,this.m05=g*i+v*a+y*l+T*f,this.m06=g*n+v*o+y*c+T*p,this.m07=g*r+v*h+y*_+T*m,g=t.m08,v=t.m09,y=t.m10,T=t.m11,this.m08=g*e+v*s+y*u+T*d,this.m09=g*i+v*a+y*l+T*f,this.m10=g*n+v*o+y*c+T*p,this.m11=g*r+v*h+y*_+T*m,g=t.m12,v=t.m13,y=t.m14,T=t.m15,this.m12=g*e+v*s+y*u+T*d,this.m13=g*i+v*a+y*l+T*f,this.m14=g*n+v*o+y*c+T*p,this.m15=g*r+v*h+y*_+T*m,this},i.multiplyScalar=function(t){return this.m00*=t,this.m01*=t,this.m02*=t,this.m03*=t,this.m04*=t,this.m05*=t,this.m06*=t,this.m07*=t,this.m08*=t,this.m09*=t,this.m10*=t,this.m11*=t,this.m12*=t,this.m13*=t,this.m14*=t,this.m15*=t,this},i.translate=function(t){return this.m12+=t.x,this.m13+=t.y,this.m14+=t.z,this},i.transform=function(t){var e=t.x,i=t.y,n=t.z,r=this.m00,s=this.m01,a=this.m02,o=this.m03,h=this.m04,u=this.m05,l=this.m06,c=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=a*e+l*i+f*n+this.m14,this.m15=o*e+c*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)<Ci)return null;i*=s=1/s,n*=s,r*=s;var a=Math.sin(t),o=Math.cos(t),h=1-o,u=this.m00,l=this.m01,c=this.m02,_=this.m03,d=this.m04,f=this.m05,p=this.m06,m=this.m07,g=this.m08,v=this.m09,y=this.m10,T=this.m11,S=i*i*h+o,E=n*i*h+r*a,A=r*i*h-n*a,R=i*n*h-r*a,b=n*n*h+o,C=r*n*h+i*a,w=i*r*h+n*a,x=n*r*h-i*a,I=r*r*h+o;return this.m00=u*S+d*E+g*A,this.m01=l*S+f*E+v*A,this.m02=c*S+p*E+y*A,this.m03=_*S+m*E+T*A,this.m04=u*R+d*b+g*C,this.m05=l*R+f*b+v*C,this.m06=c*R+p*b+y*C,this.m07=_*R+m*b+T*C,this.m08=u*w+d*x+g*I,this.m09=l*w+f*x+v*I,this.m10=c*w+p*x+y*I,this.m11=_*w+m*x+T*I,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=Bn.m00=this.m00,i=Bn.m01=this.m01,n=Bn.m02=this.m02,r=Bn.m03=this.m04,s=Bn.m04=this.m05,a=Bn.m05=this.m06,o=Bn.m06=this.m08,h=Bn.m07=this.m09,u=Bn.m08=this.m10;return t.x=Math.sqrt(e*e+i*i+n*n),t.y=Math.sqrt(r*r+s*s+a*a),t.z=Math.sqrt(o*o+h*h+u*u),vn.determinant(Bn)<0&&(t.x*=-1),t},i.getRotation=function(t){var e=hn.set(Pn,this.m00,this.m01,this.m02).length(),i=hn.set(Pn,this.m04,this.m05,this.m06).length(),n=hn.set(Pn,this.m08,this.m09,this.m10).length();return Bn.m00=this.m00/e,Bn.m01=this.m01/e,Bn.m02=this.m02/e,Bn.m03=this.m04/i,Bn.m04=this.m05/i,Bn.m05=this.m06/i,Bn.m06=this.m08/n,Bn.m07=this.m09/n,Bn.m08=this.m10/n,vn.determinant(Bn)<0&&(Bn.m00*=-1,Bn.m01*=-1,Bn.m02*=-1),En.fromMat3(t,Bn)},i.fromRTS=function(t,e,i){var n=t.x,r=t.y,s=t.z,a=t.w,o=n+n,h=r+r,u=s+s,l=n*o,c=n*h,_=n*u,d=r*h,f=r*u,p=s*u,m=a*o,g=a*h,v=a*u,y=i.x,T=i.y,S=i.z;return this.m00=(1-(d+p))*y,this.m01=(c+v)*y,this.m02=(_-g)*y,this.m03=0,this.m04=(c-v)*T,this.m05=(1-(l+p))*T,this.m06=(f+m)*T,this.m07=0,this.m08=(_+g)*S,this.m09=(f-m)*S,this.m10=(1-(l+d))*S,this.m11=0,this.m12=e.x,this.m13=e.y,this.m14=e.z,this.m15=1,this},i.fromSRT=function(t,e,i){var n=t.x,r=t.y,s=t.z,a=t.w,o=n+n,h=r+r,u=s+s,l=n*o,c=n*h,_=n*u,d=r*h,f=r*u,p=s*u,m=a*o,g=a*h,v=a*u,y=i.x,T=i.y,S=i.z;return this.m00=(1-(d+p))*y,this.m01=(c+v)*y,this.m02=(_-g)*y,this.m03=0,this.m04=(c-v)*T,this.m05=(1-(l+p))*T,this.m06=(f+m)*T,this.m07=0,this.m08=(_+g)*S,this.m09=(f-m)*S,this.m10=(1-(l+d))*S,this.m11=0,this.m12=e.x,this.m13=e.y,this.m14=e.z,this.m15=1,this},i.fromQuat=function(t){var e=t.x,i=t.y,n=t.z,r=t.w,s=e+e,a=i+i,o=n+n,h=e*s,u=i*s,l=i*a,c=n*s,_=n*a,d=n*o,f=r*s,p=r*a,m=r*o;return this.m00=1-l-d,this.m01=u+m,this.m02=c-p,this.m03=0,this.m04=u-m,this.m05=1-h-d,this.m06=_+f,this.m07=0,this.m08=c+p,this.m09=_-f,this.m10=1-h-l,this.m11=0,this.m12=0,this.m13=0,this.m14=0,this.m15=1,this},e}(Ae));An=Dn,Dn.IDENTITY=Object.freeze(new An);var Mn,Pn=new hn,Bn=new vn;function Nn(t,e,i,n,r,s,a,o,h,u,l,c,_,d,f,p){return new Dn(t,e,i,n,r,s,a,o,h,u,l,c,_,d,f,p)}gi.fastDefine("cc.Mat4",Dn,{m00:1,m01:0,m02:0,m03:0,m04:0,m05:1,m06:0,m07:0,m08:0,m09:0,m10:1,m11:0,m12:0,m13:0,m14:0,m15:1}),v.Mat4=Dn,v.mat4=Nn;var Ln,Fn=t("aK",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)<Ci?t.x=0:t.x=1/i,Math.abs(n)<Ci?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 hn?(t.x=t.y=0,t.z=e.x*i.y-e.y*i.x,t):t.x*e.y-t.y*e.x},e.lerp=function(t,e,i,n){var r=e.x,s=e.y;return t.x=r+n*(i.x-r),t.y=s+n*(i.y-s),t},e.random=function(t,e){e=e||1;var i=2*Bi()*Math.PI;return t.x=Math.cos(i)*e,t.y=Math.sin(i)*e,t},e.transformMat3=function(t,e,i){var n=e.x,r=e.y;return t.x=i.m00*n+i.m03*r+i.m06,t.y=i.m01*n+i.m04*r+i.m07,t},e.transformMat4=function(t,e,i){var n=e.x,r=e.y;return t.x=i.m00*n+i.m04*r+i.m12,t.y=i.m01*n+i.m05*r+i.m13,t},e.str=function(t){return"Vec2("+t.x+", "+t.y+")"},e.toArray=function(t,e,i){return void 0===i&&(i=0),t[i+0]=e.x,t[i+1]=e.y,t},e.fromArray=function(t,e,i){return void 0===i&&(i=0),t.x=e[i+0],t.y=e[i+1],t},e.strictEquals=function(t,e){return t.x===e.x&&t.y===e.y},e.equals=function(t,e,i){return void 0===i&&(i=Ci),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=Ii(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=Ci),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=Ci),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=Ii(this.x,t.x,e.x),this.y=Ii(this.y,t.y,e.y),this},i.add=function(t){return this.x+=t.x,this.y+=t.y,this},i.add2f=function(t,e){return this.x+=t,this.y+=e,this},i.subtract=function(t){return this.x-=t.x,this.y-=t.y,this},i.subtract2f=function(t,e){return this.x-=t,this.y-=e,this},i.multiplyScalar=function(t){return"object"==typeof t&&console.warn("should use Vec2.multiply for vector * vector operation"),this.x*=t,this.y*=t,this},i.multiply=function(t){return"object"!=typeof t&&console.warn("should use Vec2.scale for vector * scalar operation"),this.x*=t.x,this.y*=t.y,this},i.multiply2f=function(t,e){return this.x*=t,this.y*=e,this},i.divide=function(t){return this.x/=t.x,this.y/=t.y,this},i.divide2f=function(t,e){return this.x/=t,this.y/=e,this},i.negative=function(){return this.x=-this.x,this.y=-this.y,this},i.dot=function(t){return this.x*t.x+this.y*t.y},i.cross=function(t){return this.x*t.y-this.y*t.x},i.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},i.lengthSqr=function(){return this.x*this.x+this.y*this.y},i.normalize=function(){var t=this.x,e=this.y,i=t*t+e*e;return i>0&&(i=1/Math.sqrt(i),this.x*=i,this.y*=i),this},i.angle=function(t){var e=this.lengthSqr(),i=t.lengthSqr();if(0===e||0===i)return 0;var n=this.dot(t)/Math.sqrt(e*i);return n=Ii(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},e}(Ae));function kn(t,e){return new Fn(t,e)}Mn=Fn,Fn.ZERO=Object.freeze(new Mn(0,0)),Fn.ONE=Object.freeze(new Mn(1,1)),Fn.NEG_ONE=Object.freeze(new Mn(-1,-1)),Fn.UNIT_X=Object.freeze(new Mn(1,0)),Fn.UNIT_Y=Object.freeze(new Mn(0,1)),gi.fastDefine("cc.Vec2",Fn,{x:0,y:0}),v.Vec2=Fn,v.v2=kn,rt(Fn,"Vec2",[{name:"sub",newName:"subtract",target:Fn,targetName:"Vec2"},{name:"mul",newName:"multiply",target:Fn,targetName:"Vec2"},{name:"div",newName:"divide",target:Fn,targetName:"Vec2"},{name:"dist",newName:"distance",target:Fn,targetName:"Vec2"},{name:"sqrDist",newName:"squaredDistance",target:Fn,targetName:"Vec2"},{name:"mag",newName:"len",target:Fn,targetName:"Vec2"},{name:"sqrMag",newName:"lengthSqr",target:Fn,targetName:"Vec2"},{name:"scale",newName:"multiplyScalar",target:Fn,targetName:"Vec2"},{name:"exactEquals",newName:"strictEquals",target:Fn,targetName:"Vec2"}]),rt(Fn.prototype,"Vec2",[{name:"mag",newName:"length",target:Fn.prototype,targetName:"Vec2"},{name:"magSqr",newName:"lengthSqr",target:Fn.prototype,targetName:"Vec2"},{name:"scale",newName:"multiplyScalar",target:Fn.prototype,targetName:"Vec2"},{name:"exactEquals",newName:"strictEquals",target:Fn.prototype,targetName:"Vec2"}]),rt(hn,"Vec3",[{name:"sub",newName:"subtract",target:hn,targetName:"Vec3"},{name:"mul",newName:"multiply",target:hn,targetName:"Vec3"},{name:"div",newName:"divide",target:hn,targetName:"Vec3"},{name:"dist",newName:"distance",target:hn,targetName:"Vec3"},{name:"sqrDist",newName:"squaredDistance",target:hn,targetName:"Vec3"},{name:"mag",newName:"len",target:hn,targetName:"Vec3"},{name:"sqrMag",newName:"lengthSqr",target:hn,targetName:"Vec3"},{name:"scale",newName:"multiplyScalar",target:hn,targetName:"Vec3"},{name:"exactEquals",newName:"strictEquals",target:hn,targetName:"Vec3"}]),rt(hn.prototype,"Vec3",[{name:"mag",newName:"length",target:hn.prototype,targetName:"Vec3"},{name:"magSqr",newName:"lengthSqr",target:hn.prototype,targetName:"Vec3"},{name:"scale",newName:"multiplyScalar",target:hn.prototype,targetName:"Vec3"},{name:"exactEquals",newName:"strictEquals",target:hn.prototype,targetName:"Vec3"}]),rt(nn,"Vec4",[{name:"sub",newName:"subtract",target:nn,targetName:"Vec4"},{name:"mul",newName:"multiply",target:nn,targetName:"Vec4"},{name:"div",newName:"divide",target:nn,targetName:"Vec4"},{name:"dist",newName:"distance",target:nn,targetName:"Vec4"},{name:"sqrDist",newName:"squaredDistance",target:nn,targetName:"Vec4"},{name:"mag",newName:"len",target:nn,targetName:"Vec4"},{name:"sqrMag",newName:"lengthSqr",target:nn,targetName:"Vec4"},{name:"scale",newName:"multiplyScalar",target:nn,targetName:"Vec4"},{name:"exactEquals",newName:"strictEquals",target:nn,targetName:"Vec4"}]),rt(nn.prototype,"Vec4",[{name:"mag",newName:"length",target:nn.prototype,targetName:"Vec4"},{name:"magSqr",newName:"lengthSqr",target:nn.prototype,targetName:"Vec4"},{name:"scale",newName:"multiplyScalar",target:nn.prototype,targetName:"Vec4"},{name:"exactEquals",newName:"strictEquals",target:nn.prototype,targetName:"Vec4"}]),rt(En,"Quat",[{name:"mag",newName:"len",target:En,targetName:"Quat"},{name:"mul",newName:"multiply",target:En,targetName:"Quat"},{name:"sqrMag",newName:"lengthSqr",target:En,targetName:"Quat"},{name:"scale",newName:"multiplyScalar",target:En,targetName:"Quat"},{name:"exactEquals",newName:"strictEquals",target:En,targetName:"Quat"}]),rt(En.prototype,"Quat",[{name:"scale",newName:"multiplyScalar",target:En.prototype,targetName:"Quat"},{name:"exactEquals",newName:"strictEquals",target:En.prototype,targetName:"Quat"}]),rt(pn,"Color",[{name:"sub",newName:"subtract",target:pn,targetName:"Color"},{name:"mul",newName:"multiply",target:pn,targetName:"Color"},{name:"div",newName:"divide",target:pn,targetName:"Color"},{name:"exactEquals",newName:"strictEquals",target:pn,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 v.Color.fromHEX(e[0],n)}}]),rt(vn,"Mat3",[{name:"sub",newName:"subtract",target:vn,targetName:"Mat3"},{name:"mul",newName:"multiply",target:vn,targetName:"Mat3"},{name:"exactEquals",newName:"strictEquals",target:vn,targetName:"Mat3"},{name:"transfrom",newName:"transform",target:vn,targetName:"Mat3"}]),rt(vn.prototype,"Mat3",[{name:"sub",newName:"subtract",target:vn.prototype,targetName:"Mat3"},{name:"mul",newName:"multiply",target:vn.prototype,targetName:"Mat3"},{name:"mulScalar",newName:"multiplyScalar",target:vn.prototype,targetName:"Mat3"},{name:"exactEquals",newName:"strictEquals",target:vn.prototype,targetName:"Mat3"}]),rt(Dn,"Mat4",[{name:"sub",newName:"subtract",target:Dn,targetName:"Mat4"},{name:"mul",newName:"multiply",target:Dn,targetName:"Mat4"},{name:"exactEquals",newName:"strictEquals",target:Dn,targetName:"Mat4"}]),rt(Dn.prototype,"Mat4",[{name:"sub",newName:"subtract",target:Dn.prototype,targetName:"Mat4"},{name:"mul",newName:"multiply",target:Dn.prototype,targetName:"Mat4"},{name:"mulScalar",newName:"multiplyScalar",target:Dn.prototype,targetName:"Mat4"},{name:"exactEquals",newName:"strictEquals",target:Dn.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"}(Ln||(Ln={}));var Un,Gn=t("aV",function(){function t(t,e,i,n,r,s){void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1),void 0===r&&(r=0),void 0===s&&(s=0),this.a=t,this.b=e,this.c=i,this.d=n,this.tx=r,this.ty=s}return t.identity=function(){return new t},t.clone=function(e){return new t(e.a,e.b,e.c,e.d,e.tx,e.ty)},t.concat=function(t,e,i){var n=e.a,r=e.b,s=e.c,a=e.d,o=e.tx,h=e.ty;t.a=n*i.a+r*i.c,t.b=n*i.b+r*i.d,t.c=s*i.a+a*i.c,t.d=s*i.b+a*i.d,t.tx=o*i.a+h*i.c+i.tx,t.ty=o*i.b+h*i.d+i.ty},t.invert=function(t,e){var i=1/(e.a*e.d-e.b*e.c);t.a=i*e.d,t.b=-i*e.b,t.c=-i*e.c,t.d=i*e.a,t.tx=i*(e.c*e.ty-e.d*e.tx),t.ty=i*(e.b*e.tx-e.a*e.ty)},t.fromMat4=function(t,e){t.a=e.m00,t.b=e.m01,t.c=e.m04,t.d=e.m05,t.tx=e.m12,t.ty=e.m13},t.transformVec2=function(t,e,i,n){var r,s;n?(r=e,s=i):(n=i,r=e.x,s=e.y),t.x=n.a*r+n.c*s+n.tx,t.y=n.b*r+n.d*s+n.ty},t.transformSize=function(t,e,i){t.width=i.a*e.width+i.c*e.height,t.height=i.b*e.width+i.d*e.height},t.transformRect=function(t,e,i){var n=e.x+e.width,r=e.y+e.height,s=i.a*e.x+i.c*e.y+i.tx,a=i.b*e.x+i.d*e.y+i.ty,o=i.a*n+i.c*e.y+i.tx,h=i.b*n+i.d*e.y+i.ty,u=i.a*e.x+i.c*r+i.tx,l=i.b*e.x+i.d*r+i.ty,c=i.a*n+i.c*r+i.tx,_=i.b*n+i.d*r+i.ty,d=Math.min(s,o,u,c),f=Math.max(s,o,u,c),p=Math.min(a,h,l,_),m=Math.max(a,h,l,_);t.x=d,t.y=p,t.width=f-d,t.height=m-p},t.transformObb=function(t,e,i,n,r,s,a){void 0===a&&(a=!0);var o=s.a*r.x+s.c*r.y+s.tx,h=s.b*r.x+s.d*r.y+s.ty,u=s.a*r.width,l=s.b*r.width,c=s.c*r.height,_=s.d*r.height;a?(e.x=o,e.y=h,i.x=u+o,i.y=l+h,t.x=c+o,t.y=_+h,n.x=u+c+o,n.y=l+_+h):(t.x=o,t.y=h,n.x=u+o,n.y=l+h,e.x=c+o,e.y=_+h,i.x=u+c+o,i.y=l+_+h)},t}());v.AffineTransform=Gn;var Hn=t("aW",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}(Ae));function zn(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),new Hn(t,e)}Un=Hn,Hn.ZERO=Object.freeze(new Un(0,0)),Hn.ONE=Object.freeze(new Un(1,1)),gi.fastDefine("cc.Size",Hn,{width:0,height:0}),v.size=zn,v.Size=Hn;var Vn=t("aY",function(t){function e(e,i,n,r){var s;return s=t.call(this)||this,"object"==typeof e?(s.x=e.x,s.y=e.y,s.width=e.width,s.height=e.height):(s.x=e||0,s.y=i||0,s.width=n||0,s.height=r||0),s}s(e,t),e.fromMinMax=function(t,e,i){var n=Math.min(e.x,i.x),r=Math.min(e.y,i.y),s=Math.max(e.x,i.x),a=Math.max(e.y,i.y);return t.x=n,t.y=r,t.width=s-n,t.height=a-r,t},e.lerp=function(t,e,i,n){var r=e.x,s=e.y,a=e.width,o=e.height;return t.x=r+(i.x-r)*n,t.y=s+(i.y-s)*n,t.width=a+(i.width-a)*n,t.height=o+(i.height-o)*n,t},e.intersection=function(t,e,i){var n=e.x,r=e.y,s=e.x+e.width,a=e.y+e.height,o=i.x,h=i.y,u=i.x+i.width,l=i.y+i.height;return t.x=Math.max(n,o),t.y=Math.max(r,h),t.width=Math.min(s,u)-t.x,t.height=Math.min(a,l)-t.y,t},e.union=function(t,e,i){var n=e.x,r=e.y,s=e.width,a=e.height,o=i.x,h=i.y,u=i.width,l=i.height;return t.x=Math.min(n,o),t.y=Math.min(r,h),t.width=Math.max(n+s,o+u)-t.x,t.height=Math.max(r+a,h+l)-t.y,t},e.equals=function(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height};var i=e.prototype;return i.clone=function(){return new e(this.x,this.y,this.width,this.height)},i.set=function(t,e,i,n){return"object"==typeof t?(this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height):(this.x=t||0,this.y=e||0,this.width=i||0,this.height=n||0),this},i.equals=function(t){return this.x===t.x&&this.y===t.y&&this.width===t.width&&this.height===t.height},i.lerp=function(t,e){var i=this.x,n=this.y,r=this.width,s=this.height;return this.x=i+(t.x-i)*e,this.y=n+(t.y-n)*e,this.width=r+(t.width-r)*e,this.height=s+(t.height-s)*e,this},i.toString=function(){return"("+this.x.toFixed(2)+", "+this.y.toFixed(2)+", "+this.width.toFixed(2)+", "+this.height.toFixed(2)+")"},i.intersects=function(t){var e=this.x+this.width,i=this.y+this.height,n=t.x+t.width,r=t.y+t.height;return!(e<t.x||n<this.x||i<t.y||r<this.y)},i.contains=function(t){return this.x<=t.x&&this.x+this.width>=t.x&&this.y<=t.y&&this.y+this.height>=t.y},i.containsRect=function(t){return this.x<=t.x&&this.x+this.width>=t.x+t.width&&this.y<=t.y&&this.y+this.height>=t.y+t.height},i.transformMat4=function(t){var e=this.x,i=this.y,n=e+this.width,r=i+this.height,s=t.m00*e+t.m04*i+t.m12,a=t.m01*e+t.m05*i+t.m13,o=t.m00*n+t.m04*i+t.m12,h=t.m01*n+t.m05*i+t.m13,u=t.m00*e+t.m04*r+t.m12,l=t.m01*e+t.m05*r+t.m13,c=t.m00*n+t.m04*r+t.m12,_=t.m01*n+t.m05*r+t.m13,d=Math.min(s,o,u,c),f=Math.max(s,o,u,c),p=Math.min(a,h,l,_),m=Math.max(a,h,l,_);return this.x=d,this.y=p,this.width=f-d,this.height=m-p,this},i.transformMat4ToPoints=function(t,e,i,n,r){var s=this.x,a=this.y,o=s+this.width,h=a+this.height;e.x=t.m00*s+t.m04*a+t.m12,e.y=t.m01*s+t.m05*a+t.m13,r.x=t.m00*o+t.m04*a+t.m12,r.y=t.m01*o+t.m05*a+t.m13,i.x=t.m00*s+t.m04*h+t.m12,i.y=t.m01*s+t.m05*h+t.m13,n.x=t.m00*o+t.m04*h+t.m12,n.y=t.m01*o+t.m05*h+t.m13},n(e,[{key:"xMin",get:function(){return this.x},set:function(t){this.width+=this.x-t,this.x=t}},{key:"yMin",get:function(){return this.y},set:function(t){this.height+=this.y-t,this.y=t}},{key:"xMax",get:function(){return this.x+this.width},set:function(t){this.width=t-this.x}},{key:"yMax",get:function(){return this.y+this.height},set:function(t){this.height=t-this.y}},{key:"center",get:function(){return new Fn(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 Fn(this.x,this.y)},set:function(t){this.x=t.x,this.y=t.y}},{key:"size",get:function(){return new Hn(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}(Ae));function Wn(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 Vn(t,e,i,n)}gi.fastDefine("cc.Rect",Vn,{x:0,y:0,width:0,height:0}),v.Rect=Vn,v.rect=Wn;var Xn=t("br",Float64Array),jn=t("bs",function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.createFloatArray=function(t){return new Xn(t)},n(e,[{key:"array",get:function(){return this._array}}]),e}(Ae)),Yn=Object.freeze({__proto__:null,bits:x,Vec2:Fn,v2:kn,Vec3:hn,v3:un,Vec4:nn,v4:rn,Quat:En,quat:In,Mat3:vn,Mat4:Dn,mat4:Nn,AffineTransform:Gn,Size:Hn,size:zn,Rect:Vn,rect:Wn,Color:pn,color:mn,preTransforms:On,HALF_PI:Ri,TWO_PI:bi,EPSILON:Ci,equals:wi,approx:xi,clamp:Ii,clamp01:Oi,lerp:Di,toRadian:Mi,toDegree:Pi,random:Bi,setRandGenerator:Ni,randomRange:Li,randomRangeInt:Fi,pseudoRandom:ki,pseudoRandomRange:Ui,pseudoRandomRangeInt:Gi,nextPow2:Hi,repeat:zi,pingPong:Vi,inverseLerp:Wi,absMaxComponent:Xi,absMax:ji,enumerableProps:Yi,floatToHalf:$i,halfToFloat:tn,MATH_FLOAT_ARRAY:Xn,MathBase:jn});t("aE",Yn);var Kn=new hn,qn=new hn,Qn=new hn,Zn=new hn,Jn=new hn,$n=new hn,tr=new Array(3),er=new Array(3);function ir(t,e){return hn.dot(e.n,t)-e.d}function nr(t,e,i){return hn.copy(t,e),hn.subtract(Jn,i.center,i.halfExtents),hn.add($n,i.center,i.halfExtents),t.x=t.x<Jn.x?Jn.x:t.x,t.y=t.y<Jn.y?Jn.y:t.y,t.z=t.z<Jn.z?Jn.z:t.z,t.x=t.x>$n.x?$n.x:t.x,t.y=t.y>$n.y?$n.y:t.y,t.z=t.z>$n.z?$n.z:t.z,t}function rr(t,e,i){hn.set(Kn,i.orientation.m00,i.orientation.m01,i.orientation.m02),hn.set(qn,i.orientation.m03,i.orientation.m04,i.orientation.m05),hn.set(Qn,i.orientation.m06,i.orientation.m07,i.orientation.m08),tr[0]=Kn,tr[1]=qn,tr[2]=Qn,er[0]=i.halfExtents.x,er[1]=i.halfExtents.y,er[2]=i.halfExtents.z,hn.subtract(Zn,e,i.center),hn.set(t,i.center.x,i.center.y,i.center.z);for(var n=0;n<3;n++){var r=hn.dot(Zn,tr[n]);r>er[n]&&(r=er[n]),r<-er[n]&&(r=-er[n]),t.x+=r*tr[n].x,t.y+=r*tr[n].y,t.z+=r*tr[n].z}return t}var sr=Object.freeze({__proto__:null,point_plane:ir,pt_point_plane:function(t,e,i){var n=ir(e,i);return hn.subtract(t,e,hn.multiplyScalar(t,i.n,n))},pt_point_aabb:nr,pt_point_obb:rr,pt_point_line:function(t,e,i,n){hn.subtract(Kn,i,n);var r=Kn.clone(),s=hn.lengthSqr(r);if(0===s)hn.copy(t,i);else{hn.subtract(Kn,e,i);var a=hn.dot(Kn,r)/s;a<0?hn.copy(t,i):a>1?hn.copy(t,n):hn.scaleAndAdd(t,i,r,a)}}}),ar={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},or=function(){function t(t,e,i,n,r,s){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=-1),this.s=void 0,this.e=void 0,this._type=void 0,this._type=ar.SHAPE_LINE,this.s=new hn(t,e,i),this.e=new hn(n,r,s)}return t.create=function(e,i,n,r,s,a){return new t(e,i,n,r,s,a)},t.clone=function(e){return new t(e.s.x,e.s.y,e.s.z,e.e.x,e.e.y,e.e.z)},t.copy=function(t,e){return hn.copy(t.s,e.s),hn.copy(t.e,e.e),t},t.fromPoints=function(t,e,i){return hn.copy(t.s,e),hn.copy(t.e,i),t},t.set=function(t,e,i,n,r,s,a){return t.s.x=e,t.s.y=i,t.s.z=n,t.e.x=r,t.e.y=s,t.e.z=a,t},t.len=function(t){return hn.distance(t.s,t.e)},t.prototype.length=function(){return hn.distance(this.s,this.e)},n(t,[{key:"type",get:function(){return this._type}}]),t}(),hr=function(){function t(t,e,i,n,r,s){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=-1),this.o=void 0,this.d=void 0,this._type=void 0,this._type=ar.SHAPE_RAY,this.o=new hn(t,e,i),this.d=new hn(n,r,s)}return t.create=function(e,i,n,r,s,a){return void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=1),new t(e,i,n,r,s,a)},t.clone=function(e){return new t(e.o.x,e.o.y,e.o.z,e.d.x,e.d.y,e.d.z)},t.copy=function(t,e){return hn.copy(t.o,e.o),hn.copy(t.d,e.d),t},t.fromPoints=function(t,e,i){return hn.copy(t.o,e),hn.normalize(t.d,hn.subtract(t.d,i,e)),t},t.set=function(t,e,i,n,r,s,a){return t.o.x=e,t.o.y=i,t.o.z=n,t.d.x=r,t.d.y=s,t.d.z=a,t},t.prototype.computeHit=function(t,e){hn.normalize(t,this.d),hn.scaleAndAdd(t,this.o,t,e)},n(t,[{key:"type",get:function(){return this._type}}]),t}(),ur=new hn,lr=new hn,cr=new hn,_r=new hn;function dr(t){return Math.max(Math.max(t.x,t.y),t.z)}var fr,pr,mr,gr,vr,yr=function(){function t(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1),this._center=new hn(0,0,0),this._radius=0,this._type=void 0,this._type=ar.SHAPE_SPHERE,this._center=new hn(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 hn.copy(t.center,e.center),t.radius=e.radius,t},t.fromPoints=function(t,e,i){return hn.multiplyScalar(t.center,hn.add(ur,e,i),.5),t.radius=.5*hn.subtract(ur,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){hn.set(t,this.center.x-this.radius,this.center.y-this.radius,this.center.z-this.radius),hn.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){hn.transformMat4(r.center,this.center,t),r.radius=this.radius*dr(n)},e.translateAndRotate=function(t,e,i){hn.transformMat4(i.center,this.center,t)},e.setScale=function(t,e){e.radius=this.radius*dr(t)},e.mergePoint=function(t){this.radius<0&&(this.center.set(t),this.radius=0),hn.subtract(lr,t,this.center);var e=lr.length();if(e>this.radius){var i=.5*(e-this.radius);this.radius+=i,hn.multiplyScalar(lr,lr,i/e),hn.add(this.center,this.center,lr)}},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(cr,_r),this.mergePoint(cr),this.mergePoint(_r)},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}(),Tr=function(t,e){var i=hn.dot(t.d,e.n);if(Math.abs(i)<Number.EPSILON)return 0;var n=-ir(t.o,e)/i;return n<0?0:n},Sr=(fr=new hn(0,0,0),pr=new hn(0,0,0),mr=new hn(0,0,0),gr=new hn(0,0,0),vr=new hn(0,0,0),function(t,e,i){hn.subtract(fr,e.b,e.a),hn.subtract(pr,e.c,e.a),hn.cross(mr,t.d,pr);var n=hn.dot(fr,mr);if(n<Number.EPSILON&&(!i||n>-Number.EPSILON))return 0;var r=1/n;hn.subtract(gr,t.o,e.a);var s=hn.dot(gr,mr)*r;if(s<0||s>1)return 0;hn.cross(vr,gr,fr);var a=hn.dot(t.d,vr)*r;if(a<0||s+a>1)return 0;var o=hn.dot(pr,vr)*r;return o<0?0:o}),Er=function(){var t=new hn(0,0,0);return function(e,i){var n=i.radius,r=i.center,s=e.o,a=e.d,o=n*n;hn.subtract(t,r,s);var h=t.lengthSqr(),u=hn.dot(t,a),l=o-(h-u*u);if(l<0)return 0;var c=Math.sqrt(l),_=h<o?u+c:u-c;return _<0?0:_}}(),Ar=function(){var t=new hn,e=new hn;return function(i,n){return hn.subtract(t,n.center,n.halfExtents),hn.add(e,n.center,n.halfExtents),function(t,e,i){var n=t.o,r=t.d,s=1/r.x,a=1/r.y,o=1/r.z,h=(e.x-n.x)*s,u=(i.x-n.x)*s,l=(e.y-n.y)*a,c=(i.y-n.y)*a,_=(e.z-n.z)*o,d=(i.z-n.z)*o,f=Math.max(Math.max(Math.min(h,u),Math.min(l,c)),Math.min(_,d)),p=Math.min(Math.min(Math.max(h,u),Math.max(l,c)),Math.max(_,d));return p<0||f>p?0:f>0?f:p}(i,t,e)}}(),Rr=function(){var t=new hn,e=new hn,i=new hn,n=new hn,r=new hn,s=new hn,a=new hn,o=new Array(3),h=new Array(3),u=new Array(3),l=new Array(6);return function(c,_){o[0]=_.halfExtents.x,o[1]=_.halfExtents.y,o[2]=_.halfExtents.z,t=_.center,e=c.o,i=c.d,hn.set(n,_.orientation.m00,_.orientation.m01,_.orientation.m02),hn.set(r,_.orientation.m03,_.orientation.m04,_.orientation.m05),hn.set(s,_.orientation.m06,_.orientation.m07,_.orientation.m08),hn.subtract(a,t,e),h[0]=hn.dot(n,i),h[1]=hn.dot(r,i),h[2]=hn.dot(s,i),u[0]=hn.dot(n,a),u[1]=hn.dot(r,a),u[2]=hn.dot(s,a);for(var d=0;d<3;++d){if(0===h[d]){if(-u[d]-o[d]>0||-u[d]+o[d]<0)return 0;h[d]=1e-7}l[2*d+0]=(u[d]+o[d])/h[d],l[2*d+1]=(u[d]-o[d])/h[d]}var f=Math.max(Math.max(Math.min(l[0],l[1]),Math.min(l[2],l[3])),Math.min(l[4],l[5])),p=Math.min(Math.min(Math.max(l[0],l[1]),Math.max(l[2],l[3])),Math.max(l[4],l[5]));return p<0||f>p?0:f>0?f:p}}(),br=function(){var t=new hn,e=new hn,i=new hn,n=new hn,r=new hn,s=new hn,a=new hn,o=new yr;return function(h,u){var l=u.ellipseCenter0,c=u.ellipseCenter1,_=hn.subtract(e,c,l);if(_.length()<Ci)return o.radius=u.radius,o.center.set(u.ellipseCenter0),us.raySphere(h,o);var d=h.o,f=hn.subtract(i,d,l),p=hn.normalize(t,h.d),m=hn.cross(n,p,_),g=m.lengthSqr();if(0===g){o.radius=u.radius;var v=hn.subtract(r,c,d);return f.lengthSqr()<v.lengthSqr()?o.center.set(l):o.center.set(c),us.raySphere(h,o)}var y=hn.cross(r,f,_),T=_.lengthSqr(),S=2*hn.dot(m,y),E=u.radius*u.radius,A=S*S-4*g*(y.lengthSqr()-E*T);if(A<0)return 0;var R=(-S-Math.sqrt(A))/(2*g);if(R<0){o.radius=u.radius;var b=hn.subtract(s,c,d);return f.lengthSqr()<b.lengthSqr()?o.center.set(u.ellipseCenter0):o.center.set(u.ellipseCenter1),us.raySphere(h,o)}var C=hn.scaleAndAdd(s,h.o,p,R),w=hn.subtract(a,C,l),x=hn.dot(w,_)/T;return x>=0&&x<=1?R:x<0?(o.radius=u.radius,o.center.set(u.ellipseCenter0),us.raySphere(h,o)):x>1?(o.radius=u.radius,o.center.set(u.ellipseCenter1),us.raySphere(h,o)):0}}(),Cr=function(){var t=new hn(0,0,0);return function(e,i){hn.subtract(t,e.e,e.s);var n=-ir(e.s,i)/hn.dot(t,i.n);return n<0||n>1?0:n}}(),wr=function(){var t=new hn(0,0,0),e=new hn(0,0,0),i=new hn(0,0,0),n=new hn(0,0,0),r=new hn(0,0,0),s=new hn(0,0,0);return function(a,o,h){hn.subtract(t,o.b,o.a),hn.subtract(e,o.c,o.a),hn.subtract(i,a.s,a.e),hn.cross(r,t,e);var u=hn.dot(i,r);if(u<=0)return 0;hn.subtract(n,a.s,o.a);var l=hn.dot(n,r);if(l<0||l>u)return 0;hn.cross(s,i,n);var c=hn.dot(e,s);if(c<0||c>u)return 0;var _=-hn.dot(t,s);if(_<0||c+_>u)return 0;if(h){var d=1/u,f=1-(c*=d)-(_*=d);hn.set(h,o.a.x*f+o.b.x*c+o.c.x*_,o.a.y*f+o.b.y*c+o.c.y*_,o.a.z*f+o.b.z*c+o.c.z*_)}return 1}}(),Ir=new hr;function Or(t,e){Ir.o.set(t.s),hn.subtract(Ir.d,t.e,t.s),Ir.d.normalize();var i=Ar(Ir,e);return i<=t.length()?i:0}function Dr(t,e){Ir.o.set(t.s),hn.subtract(Ir.d,t.e,t.s),Ir.d.normalize();var i=Rr(Ir,e);return i<=t.length()?i:0}function Mr(t,e){Ir.o.set(t.s),hn.subtract(Ir.d,t.e,t.s),Ir.d.normalize();var i=Er(Ir,e);return i<=t.length()?i:0}var Pr,Br,Nr,Lr,Fr=(Pr=new hn,Br=new hn,Nr=new hn,Lr=new hn,function(t,e){return hn.subtract(Pr,t.center,t.halfExtents),hn.add(Br,t.center,t.halfExtents),hn.subtract(Nr,e.center,e.halfExtents),hn.add(Lr,e.center,e.halfExtents),Pr.x<=Lr.x&&Br.x>=Nr.x&&Pr.y<=Lr.y&&Br.y>=Nr.y&&Pr.z<=Lr.z&&Br.z>=Nr.z});function kr(t,e,i,n,r,s){hn.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),hn.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),hn.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),hn.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),hn.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),hn.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),hn.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),hn.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 Ur(t,e){for(var i=hn.dot(e,t[0]),n=i,r=1;r<8;++r){var s=hn.dot(e,t[r]);i=s<i?s:i,n=s>n?s:n}return[i,n]}var Gr,Hr,zr,Vr,Wr,Xr=function(){for(var t=new Array(15),e=0;e<15;e++)t[e]=new hn(0,0,0);for(var i=new Array(8),n=new Array(8),r=0;r<8;r++)i[r]=new hn(0,0,0),n[r]=new hn(0,0,0);var s=new hn,a=new hn;return function(e,r){hn.set(t[0],1,0,0),hn.set(t[1],0,1,0),hn.set(t[2],0,0,1),hn.set(t[3],r.orientation.m00,r.orientation.m01,r.orientation.m02),hn.set(t[4],r.orientation.m03,r.orientation.m04,r.orientation.m05),hn.set(t[5],r.orientation.m06,r.orientation.m07,r.orientation.m08);for(var o=0;o<3;++o)hn.cross(t[6+3*o],t[o],t[3]),hn.cross(t[7+3*o],t[o],t[4]),hn.cross(t[7+3*o],t[o],t[5]);hn.subtract(s,e.center,e.halfExtents),hn.add(a,e.center,e.halfExtents),function(t,e,i){hn.set(i[0],t.x,e.y,e.z),hn.set(i[1],t.x,e.y,t.z),hn.set(i[2],t.x,t.y,e.z),hn.set(i[3],t.x,t.y,t.z),hn.set(i[4],e.x,e.y,e.z),hn.set(i[5],e.x,e.y,t.z),hn.set(i[6],e.x,t.y,e.z),hn.set(i[7],e.x,t.y,t.z)}(s,a,i),kr(r.center,r.halfExtents,t[3],t[4],t[5],n);for(var h=0;h<15;++h){var u=Ur(i,t[h]),l=Ur(n,t[h]);if(l[0]>u[1]||u[0]>l[1])return 0}return 1}}(),jr=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=hn.dot(e.n,t.center);return n+i<e.d?-1:n-i>e.d?0:1},Yr=function(t,e){for(var i=0;i<e.planes.length;i++)if(-1===jr(t,e.planes[i]))return 0;return 1},Kr=function(){for(var t=new Array(8),e=0,i=0,n=0;n<t.length;n++)t[n]=new hn(0,0,0);return function(n,r){for(var s=0,a=!1,o=0;o<r.planes.length;o++){if(-1===(s=jr(n,r.planes[o])))return 0;1===s&&(a=!0)}if(!a)return 1;for(var h=0;h<r.vertices.length;h++)hn.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 l=0;l<r.vertices.length;l++)t[l].y>n.halfExtents.y?e++:t[l].y<-n.halfExtents.y&&i++;if(e===r.vertices.length||i===r.vertices.length)return 0;e=0,i=0;for(var c=0;c<r.vertices.length;c++)t[c].z>n.halfExtents.z?e++:t[c].z<-n.halfExtents.z&&i++;return e===r.vertices.length||i===r.vertices.length?0:1}}(),qr=(Gr=new hn(0,0,0),Hr=new vn,function(t,e){return hn.subtract(Gr,e,t.center),hn.transformMat3(Gr,Gr,vn.transpose(Hr,t.orientation)),i=Gr,n=t.halfExtents,Math.abs(i.x)<n.x&&Math.abs(i.y)<n.y&&Math.abs(i.z)<n.z;var i,n}),Qr=(zr=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*zr(e.n,t.orientation.m00,t.orientation.m01,t.orientation.m02)+t.halfExtents.y*zr(e.n,t.orientation.m03,t.orientation.m04,t.orientation.m05)+t.halfExtents.z*zr(e.n,t.orientation.m06,t.orientation.m07,t.orientation.m08),n=hn.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,r=0;r<t.length;r++)t[r]=new hn(0,0,0);var s=function(t,e,i,n){return t.x*e+t.y*i+t.z*n};return function(r,a){for(var o=0,h=!1,u=0;u<a.planes.length;u++){if(-1===(o=Qr(r,a.planes[u])))return 0;1===o&&(h=!0)}if(!h)return 1;for(var l=0;l<a.vertices.length;l++)hn.subtract(t[l],a.vertices[l],r.center);i=0,n=0;for(var c=0;c<a.vertices.length;c++)(e=s(t[c],r.orientation.m00,r.orientation.m01,r.orientation.m02))>r.halfExtents.x?i++:e<-r.halfExtents.x&&n++;if(i===a.vertices.length||n===a.vertices.length)return 0;i=0,n=0;for(var _=0;_<a.vertices.length;_++)(e=s(t[_],r.orientation.m03,r.orientation.m04,r.orientation.m05))>r.halfExtents.y?i++:e<-r.halfExtents.y&&n++;if(i===a.vertices.length||n===a.vertices.length)return 0;i=0,n=0;for(var d=0;d<a.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===a.vertices.length||n===a.vertices.length?0:1}}(),$r=function(){for(var t=new Array(15),e=0;e<15;e++)t[e]=new hn(0,0,0);for(var i=new Array(8),n=new Array(8),r=0;r<8;r++)i[r]=new hn(0,0,0),n[r]=new hn(0,0,0);return function(e,r){hn.set(t[0],e.orientation.m00,e.orientation.m01,e.orientation.m02),hn.set(t[1],e.orientation.m03,e.orientation.m04,e.orientation.m05),hn.set(t[2],e.orientation.m06,e.orientation.m07,e.orientation.m08),hn.set(t[3],r.orientation.m00,r.orientation.m01,r.orientation.m02),hn.set(t[4],r.orientation.m03,r.orientation.m04,r.orientation.m05),hn.set(t[5],r.orientation.m06,r.orientation.m07,r.orientation.m08);for(var s=0;s<3;++s)hn.cross(t[6+3*s],t[s],t[3]),hn.cross(t[7+3*s],t[s],t[4]),hn.cross(t[8+3*s],t[s],t[5]);kr(e.center,e.halfExtents,t[0],t[1],t[2],i),kr(r.center,r.halfExtents,t[3],t[4],t[5],n);for(var a=0;a<15;++a){var o=Ur(i,t[a]),h=Ur(n,t[a]);if(h[0]>o[1]||o[0]>h[1])return 0}return 1}}(),ts=function(){for(var t=new yr,e=new hn,i=new hn,n=new hn,r=new Array(8),s=0;s<8;s++)r[s]=new hn;for(var a=new Array(8),o=0;o<8;o++)a[o]=new hn;return function(s,o){if(0===hn.squaredDistance(o.ellipseCenter0,o.ellipseCenter1))return t.radius=o.radius,t.center.set(o.ellipseCenter0),us.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,kr(s.center,s.halfExtents,e,i,n,r);var h=a,u=hn.copy(h[0],e),l=hn.copy(h[1],i),c=hn.copy(h[2],n);hn.subtract(h[3],o.center,s.center).normalize();var _=hn.subtract(h[4],o.ellipseCenter0,o.ellipseCenter1);_.normalize(),hn.cross(h[5],u,_),hn.cross(h[6],l,_),hn.cross(h[7],c,_);for(var d=0;d<8;++d){var f=Ur(r,h[d]),p=hn.dot(h[d],o.ellipseCenter0),m=hn.dot(h[d],o.ellipseCenter1),g=Math.max(p,m),v=Math.min(p,m)-o.radius,y=g+o.radius;if(v>f[1]||f[0]>y)return 0}return 1}}(),es=function(t,e){var i=hn.dot(e.n,t.center),n=t.radius*e.n.length();return i+n<e.d?-1:i-n>e.d?0:1},is=function(t,e){for(var i=0;i<e.planes.length;i++)if(-1===es(t,e.planes[i]))return 0;return 1},ns=(Vr=new hn(0,0,0),Wr=[1,-1,1,-1,1,-1],function(t,e){for(var i=0;i<6;i++){var n=e.planes[i],r=t.radius,s=t.center,a=n.n,o=n.d,h=hn.dot(a,s);if(h+r<o)return 0;if(!(h-r>o)){hn.add(Vr,s,hn.multiplyScalar(Vr,a,r));for(var u=0;u<6;u++)if(u!==i&&u!==i+Wr[i]){var l=e.planes[u];if(hn.dot(l.n,Vr)<l.d)return 0}}}return 1}),rs=function(t,e){var i=t.radius+e.radius;return hn.squaredDistance(t.center,e.center)<i*i},ss=function(){var t=new hn;return function(e,i){return nr(t,e.center,i),hn.squaredDistance(e.center,t)<e.radius*e.radius}}(),as=function(){var t=new hn;return function(e,i){return rr(t,e.center,i),hn.squaredDistance(e.center,t)<e.radius*e.radius}}(),os=function(){var t=new hn,e=new hn;return function(i,n){var r=i.radius+n.radius,s=r*r,a=hn.squaredDistance(n.ellipseCenter0,n.ellipseCenter1);if(0===a)return hn.squaredDistance(i.center,n.center)<s;hn.subtract(t,i.center,n.ellipseCenter0),hn.subtract(e,n.ellipseCenter1,n.ellipseCenter0);var o=hn.dot(t,e)/a;return o<0?hn.squaredDistance(i.center,n.ellipseCenter0)<s:o>1?hn.squaredDistance(i.center,n.ellipseCenter1)<s:(hn.scaleAndAdd(t,n.ellipseCenter0,e,o),hn.squaredDistance(i.center,t)<s)}}(),hs=function(){var t=new hn,e=new hn,i=new hn,n=new hn,r=new hn,s=new hn;return function(a,o){var h,u,l=hn.subtract(t,a.ellipseCenter1,a.ellipseCenter0),c=hn.subtract(e,o.ellipseCenter1,o.ellipseCenter0),_=hn.subtract(i,a.ellipseCenter0,o.ellipseCenter0),d=hn.dot(l,l),f=hn.dot(l,c),p=hn.dot(c,c),m=hn.dot(l,_),g=hn.dot(c,_),v=d*p-f*f,y=v,T=v;v<Ci?(h=0,y=1,u=g,T=p):(u=d*g-f*m,(h=f*g-p*m)<0?(h=0,u=g,T=p):h>y&&(h=y,u=g+f,T=p)),u<0?(u=0,-m<0?h=0:-m>d?h=y:(h=-m,y=d)):u>T&&(u=T,-m+f<0?h=0:-m+f>d?h=y:(h=-m+f,y=d));var S=Math.abs(h)<Ci?0:h/y,E=Math.abs(u)<Ci?0:u/T,A=n;A.set(_),A.add(hn.multiplyScalar(r,l,S)),A.subtract(hn.multiplyScalar(s,c,E));var R=a.radius+o.radius;return A.lengthSqr()<R*R}}(),us={raySphere:Er,rayAABB:Ar,rayOBB:Rr,rayPlane:Tr,rayTriangle:Sr,rayCapsule:br,raySubMesh:null,rayMesh:null,rayModel:null,lineSphere:Mr,lineAABB:Or,lineOBB:Dr,linePlane:Cr,lineTriangle:wr,sphereWithSphere:rs,sphereAABB:ss,sphereOBB:as,spherePlane:es,sphereFrustum:is,sphereFrustumAccurate:ns,sphereCapsule:os,aabbWithAABB:Fr,aabbWithOBB:Xr,aabbPlane:jr,aabbFrustum:Yr,aabbFrustumAccurate:Kr,obbWithOBB:$r,obbPlane:Qr,obbFrustum:Zr,obbFrustumAccurate:Jr,obbPoint:qr,obbCapsule:ts,aabbFrustumCompletelyInside:function(t,e){for(var i=0;i<e.planes.length;i++)if(0!==jr(t,e.planes[i]))return 0;return 1},capsuleWithCapsule:hs,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)}};us[ar.SHAPE_RAY|ar.SHAPE_SPHERE]=Er,us[ar.SHAPE_RAY|ar.SHAPE_AABB]=Ar,us[ar.SHAPE_RAY|ar.SHAPE_OBB]=Rr,us[ar.SHAPE_RAY|ar.SHAPE_PLANE]=Tr,us[ar.SHAPE_RAY|ar.SHAPE_TRIANGLE]=Sr,us[ar.SHAPE_RAY|ar.SHAPE_CAPSULE]=br,us[ar.SHAPE_LINE|ar.SHAPE_SPHERE]=Mr,us[ar.SHAPE_LINE|ar.SHAPE_AABB]=Or,us[ar.SHAPE_LINE|ar.SHAPE_OBB]=Dr,us[ar.SHAPE_LINE|ar.SHAPE_PLANE]=Cr,us[ar.SHAPE_LINE|ar.SHAPE_TRIANGLE]=wr,us[ar.SHAPE_SPHERE]=rs,us[ar.SHAPE_SPHERE|ar.SHAPE_AABB]=ss,us[ar.SHAPE_SPHERE|ar.SHAPE_OBB]=as,us[ar.SHAPE_SPHERE|ar.SHAPE_PLANE]=es,us[ar.SHAPE_SPHERE|ar.SHAPE_FRUSTUM]=is,us[ar.SHAPE_SPHERE|ar.SHAPE_FRUSTUM_ACCURATE]=ns,us[ar.SHAPE_SPHERE|ar.SHAPE_CAPSULE]=os,us[ar.SHAPE_AABB]=Fr,us[ar.SHAPE_AABB|ar.SHAPE_OBB]=Xr,us[ar.SHAPE_AABB|ar.SHAPE_PLANE]=jr,us[ar.SHAPE_AABB|ar.SHAPE_FRUSTUM]=Yr,us[ar.SHAPE_AABB|ar.SHAPE_FRUSTUM_ACCURATE]=Kr,us[ar.SHAPE_OBB]=$r,us[ar.SHAPE_OBB|ar.SHAPE_PLANE]=Qr,us[ar.SHAPE_OBB|ar.SHAPE_FRUSTUM]=Zr,us[ar.SHAPE_OBB|ar.SHAPE_FRUSTUM_ACCURATE]=Jr,us[ar.SHAPE_OBB|ar.SHAPE_CAPSULE]=ts,us[ar.SHAPE_CAPSULE]=hs,rt(or.prototype,"line",[{name:"mag",newName:"len"},{name:"magnitude",newName:"len"}]),st(us,"intersect",[{name:"line_quad"}]);var ls=new hn(0,0,0),cs=new hn(0,0,0),_s=v.mat4(),ds=v.v4(),fs=function(){function t(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=1),void 0===i&&(i=0),void 0===n&&(n=0),this.n=void 0,this._type=ar.SHAPE_PLANE,this.n=new hn(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 hn.copy(t.n,e.n),t.d=e.d,t},t.fromPoints=function(t,e,i,n){return hn.subtract(ls,i,e),hn.subtract(cs,n,e),hn.normalize(t.n,hn.cross(t.n,ls,cs)),t.d=hn.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 hn.copy(t.n,e),t.d=hn.dot(e,i),t},t.normalize=function(t,e){var i=e.n.length();return hn.normalize(t.n,e.n),i>0&&(t.d=e.d/i),t},t.prototype.transform=function(t){Dn.invert(_s,t),Dn.transpose(_s,_s),nn.set(ds,this.n.x,this.n.y,this.n.z,-this.d),nn.transformMat4(ds,ds,_s),hn.set(this.n,ds.x,ds.y,ds.z),this.d=-ds.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}(),ps=function(){function t(t,e,i,n,r,s,a,o,h){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=0),void 0===o&&(o=1),void 0===h&&(h=0),this.a=void 0,this.b=void 0,this.c=void 0,this._type=void 0,this._type=ar.SHAPE_TRIANGLE,this.a=new hn(t,e,i),this.b=new hn(n,r,s),this.c=new hn(a,o,h)}return t.create=function(e,i,n,r,s,a,o,h,u){return void 0===e&&(e=1),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=0),void 0===o&&(o=0),void 0===h&&(h=0),void 0===u&&(u=1),new t(e,i,n,r,s,a,o,h,u)},t.clone=function(e){return new t(e.a.x,e.a.y,e.a.z,e.b.x,e.b.y,e.b.z,e.c.x,e.c.y,e.c.z)},t.copy=function(t,e){return hn.copy(t.a,e.a),hn.copy(t.b,e.b),hn.copy(t.c,e.c),t},t.fromPoints=function(t,e,i,n){return hn.copy(t.a,e),hn.copy(t.b,i),hn.copy(t.c,n),t},t.set=function(t,e,i,n,r,s,a,o,h,u){return t.a.x=e,t.a.y=i,t.a.z=n,t.b.x=r,t.b.y=s,t.b.z=a,t.c.x=o,t.c.y=h,t.c.z=u,t},n(t,[{key:"type",get:function(){return this._type}}]),t}(),ms=new hn,gs=new hn,vs=new hn,ys=new hn,Ts=new vn,Ss=function(t,e,i){Ts.m00=Math.abs(i.m00),Ts.m01=Math.abs(i.m01),Ts.m02=Math.abs(i.m02),Ts.m03=Math.abs(i.m04),Ts.m04=Math.abs(i.m05),Ts.m05=Math.abs(i.m06),Ts.m06=Math.abs(i.m08),Ts.m07=Math.abs(i.m09),Ts.m08=Math.abs(i.m10),hn.transformMat3(t,e,Ts)},Es=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=ar.SHAPE_AABB,this.center=new hn(t,e,i),this.halfExtents=new hn(n,r,s)}t.create=function(e,i,n,r,s,a){return new t(e,i,n,r,s,a)},t.clone=function(e){return new t(e.center.x,e.center.y,e.center.z,e.halfExtents.x,e.halfExtents.y,e.halfExtents.z)},t.copy=function(t,e){return hn.copy(t.center,e.center),hn.copy(t.halfExtents,e.halfExtents),t},t.fromPoints=function(t,e,i){return hn.add(ms,i,e),hn.subtract(gs,i,e),hn.multiplyScalar(t.center,ms,.5),hn.multiplyScalar(t.halfExtents,gs,.5),t},t.set=function(t,e,i,n,r,s,a){return t.center.set(e,i,n),t.halfExtents.set(r,s,a),t},t.merge=function(e,i,n){return hn.subtract(ms,i.center,i.halfExtents),hn.subtract(gs,n.center,n.halfExtents),hn.add(vs,i.center,i.halfExtents),hn.add(ys,n.center,n.halfExtents),hn.max(ys,vs,ys),hn.min(vs,ms,gs),t.fromPoints(e,vs,ys)},t.toBoundingSphere=function(t,e){return t.center.set(e.center),t.radius=e.halfExtents.length(),t},t.transform=function(t,e,i){return hn.transformMat4(t.center,e.center,i),Ss(t.halfExtents,e.halfExtents,i),t};var e=t.prototype;return e.getBoundary=function(t,e){hn.subtract(t,this.center,this.halfExtents),hn.add(e,this.center,this.halfExtents)},e.transform=function(t,e,i,n,r){hn.transformMat4(r.center,this.center,t),Ss(r.halfExtents,this.halfExtents,t)},e.clone=function(){return t.clone(this)},e.copy=function(e){return t.copy(this,e)},e.mergePoint=function(t){this.getBoundary(ms,gs),t.x<ms.x&&(ms.x=t.x),t.y<ms.y&&(ms.y=t.y),t.z<ms.z&&(ms.z=t.z),t.x>gs.x&&(gs.x=t.x),t.y>gs.y&&(gs.y=t.y),t.z>gs.z&&(gs.z=t.z),hn.add(vs,ms,gs),this.center.set(hn.multiplyScalar(vs,vs,.5)),this.halfExtents.set(gs.x-vs.x,gs.y-vs.y,gs.z-vs.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}(),As=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=ar.SHAPE_CAPSULE,this.radius=t,this.halfHeight=e,this.axis=i,this.center=new hn,this.rotation=new En,this.ellipseCenter0=new hn(0,e,0),this.ellipseCenter1=new hn(0,-e,0),this.updateCache()}var e=t.prototype;return e.transform=function(t,e,i,n,r){var s=n,a=Xi(s);r.radius=this.radius*Math.abs(a);var o=(this.halfHeight+this.radius)*Math.abs(s.y)-r.radius;o<0&&(o=0),r.halfHeight=o,hn.transformMat4(r.center,this.center,t),En.multiply(r.rotation,this.rotation,i),r.updateCache()},e.updateCache=function(){this.updateLocalCenter(),hn.transformQuat(this.ellipseCenter0,this.ellipseCenter0,this.rotation),hn.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}(),Rs=new Array(8);Rs[0]=new hn(1,1,1),Rs[1]=new hn(-1,1,1),Rs[2]=new hn(-1,-1,1),Rs[3]=new hn(1,-1,1),Rs[4]=new hn(1,1,-1),Rs[5]=new hn(-1,1,-1),Rs[6]=new hn(-1,-1,-1),Rs[7]=new hn(1,-1,-1);var bs,Cs=new hn,ws=new hn,xs=new hn,Is=function(){e.createOrthographic=function(t,e,i,n,r,s){var a=e/2,o=i/2;hn.set(xs,a,o,-n),hn.transformMat4(t.vertices[0],xs,s),hn.set(xs,-a,o,-n),hn.transformMat4(t.vertices[1],xs,s),hn.set(xs,-a,-o,-n),hn.transformMat4(t.vertices[2],xs,s),hn.set(xs,a,-o,-n),hn.transformMat4(t.vertices[3],xs,s),hn.set(xs,a,o,-r),hn.transformMat4(t.vertices[4],xs,s),hn.set(xs,-a,o,-r),hn.transformMat4(t.vertices[5],xs,s),hn.set(xs,-a,-o,-r),hn.transformMat4(t.vertices[6],xs,s),hn.set(xs,a,-o,-r),hn.transformMat4(t.vertices[7],xs,s),t.updatePlanes()},e.createOrtho=function(t,i,n,r,s,a){return e.createOrthographic(t,i,n,r,s,a)},e.createPerspective=function(t,e,i,n,r,s){var a=Math.tan(.5*i),o=a*e;Cs.set(n*o,n*a,n),ws.set(r*o,r*a,r);var h=t.vertices;xs.set(Cs.x,Cs.y,-Cs.z),hn.transformMat4(h[0],xs,s),xs.set(-Cs.x,Cs.y,-Cs.z),hn.transformMat4(h[1],xs,s),xs.set(-Cs.x,-Cs.y,-Cs.z),hn.transformMat4(h[2],xs,s),xs.set(Cs.x,-Cs.y,-Cs.z),hn.transformMat4(h[3],xs,s),xs.set(ws.x,ws.y,-ws.z),hn.transformMat4(h[4],xs,s),xs.set(-ws.x,ws.y,-ws.z),hn.transformMat4(h[5],xs,s),xs.set(-ws.x,-ws.y,-ws.z),hn.transformMat4(h[6],xs,s),xs.set(ws.x,-ws.y,-ws.z),hn.transformMat4(h[7],xs,s),t.updatePlanes()},e.createFromAABB=function(t,e){var i=new hn,n=new hn;return hn.subtract(i,e.center,e.halfExtents),hn.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=ar.SHAPE_FRUSTUM,this.planes=new Array(6);for(var t=0;t<6;++t)this.planes[t]=fs.create(0,0,0,0);this.vertices=new Array(8);for(var e=0;e<8;++e)this.vertices[e]=new hn}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)fs.copy(t.planes[i],e.planes[i]);for(var n=0;n<8;++n)hn.copy(t.vertices[n],e.vertices[n]);return t},t.update=function(t,e){hn.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),hn.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),hn.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),hn.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),hn.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),hn.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();hn.multiplyScalar(n.n,n.n,r),n.d*=r}for(var s=0;s<8;s++)hn.transformMat4(this.vertices[s],Rs[s],e)},t.transform=function(t){for(var e=0;e<8;e++)hn.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++)fs.set(this.planes[e],0,0,0,0)},t.updatePlanes=function(){fs.fromPoints(this.planes[0],this.vertices[1],this.vertices[6],this.vertices[5]),fs.fromPoints(this.planes[1],this.vertices[3],this.vertices[4],this.vertices[7]),fs.fromPoints(this.planes[2],this.vertices[6],this.vertices[3],this.vertices[7]),fs.fromPoints(this.planes[3],this.vertices[0],this.vertices[5],this.vertices[4]),fs.fromPoints(this.planes[4],this.vertices[2],this.vertices[0],this.vertices[3]),fs.fromPoints(this.planes[5],this.vertices[7],this.vertices[5],this.vertices[6])},n(e,[{key:"accurate",set:function(t){this._type=t?ar.SHAPE_FRUSTUM_ACCURATE:ar.SHAPE_FRUSTUM}},{key:"type",get:function(){return this._type}}]),e}(),Os=new hn,Ds=new hn,Ms=new vn,Ps=function(){function t(t,e,i,n,r,s,a,o,h,u,l,c,_,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===a&&(a=1),void 0===o&&(o=0),void 0===h&&(h=0),void 0===u&&(u=0),void 0===l&&(l=1),void 0===c&&(c=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=ar.SHAPE_OBB,this.center=new hn(t,e,i),this.halfExtents=new hn(n,r,s),this.orientation=new vn(a,o,h,u,l,c,_,d,f)}t.create=function(e,i,n,r,s,a,o,h,u,l,c,_,d,f,p){return new t(e,i,n,r,s,a,o,h,u,l,c,_,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 hn.copy(t.center,e.center),hn.copy(t.halfExtents,e.halfExtents),vn.copy(t.orientation,e.orientation),t},t.fromPoints=function(t,e,i){return hn.multiplyScalar(t.center,hn.add(Os,e,i),.5),hn.multiplyScalar(t.halfExtents,hn.subtract(Ds,i,e),.5),vn.identity(t.orientation),t},t.set=function(t,e,i,n,r,s,a,o,h,u,l,c,_,d,f,p){return hn.set(t.center,e,i,n),hn.set(t.halfExtents,r,s,a),vn.set(t.orientation,o,h,u,l,c,_,d,f,p),t};var e=t.prototype;return e.getBoundary=function(t,e){!function(t,e,i){Ms.m00=Math.abs(i.m00),Ms.m01=Math.abs(i.m01),Ms.m02=Math.abs(i.m02),Ms.m03=Math.abs(i.m03),Ms.m04=Math.abs(i.m04),Ms.m05=Math.abs(i.m05),Ms.m06=Math.abs(i.m06),Ms.m07=Math.abs(i.m07),Ms.m08=Math.abs(i.m08),hn.transformMat3(t,e,Ms)}(Os,this.halfExtents,this.orientation),hn.subtract(t,this.center,Os),hn.add(e,this.center,Os)},e.transform=function(t,e,i,n,r){hn.transformMat4(r.center,this.center,t),vn.fromQuat(r.orientation,i),hn.multiply(r.halfExtents,this.halfExtents,n)},e.translateAndRotate=function(t,e,i){hn.transformMat4(i.center,this.center,t),vn.fromQuat(i.orientation,e)},e.setScale=function(t,e){hn.multiply(e.halfExtents,this.halfExtents,t)},n(t,[{key:"type",get:function(){return this._type}}]),t}();function Bs(t,e,i){void 0===i&&(i=1e-6);for(var n=0,r=t.length-1,s=r>>>1;n<=r;s=n+r>>>1){var a=t[s];if(a>e+i)r=s-1;else{if(!(a<e-i))return s;n=s+1}}return~n}bs=Symbol.iterator;var Ns,Ls,Fs,ks=function(){function t(){this._times=[],this._values=[]}var e=t.prototype;return e[bs]=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 Bs(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 Bs(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]||xi(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=Bs(i,t);if(s>=0)return s;var a=~s;return 0===a?(i.unshift(t),n.unshift(e)):a===r?(i.push(t),n.push(e)):(i.splice(a-1,0,t),n.splice(a-1,0,e)),a},n(t,[{key:"keyFramesCount",get:function(){return this._times.length}},{key:"rangeMin",get:function(){return this._times[0]}},{key:"rangeMax",get:function(){return this._times[this._values.length-1]}}]),t}();function Us(t){return t>-1e-9&&t<1e-9}function Gs(t,e,i,n){return i.slice().reverse().reduce((function(i,n){return n(t,e,i)||i}),n)}gi.fastDefine("cc.KeyframeCurve",ks,{_times:[],_values:[]}),t("cl",Ns),function(t){t[t.LINEAR=0]="LINEAR",t[t.CONSTANT=1]="CONSTANT",t[t.CUBIC=2]="CUBIC"}(Ns||t("cl",Ns={})),t("cm",Ls),function(t){t[t.LINEAR=0]="LINEAR",t[t.CLAMP=1]="CLAMP",t[t.LOOP=2]="LOOP",t[t.PING_PONG=3]="PING_PONG"}(Ls||t("cm",Ls={})),t("cn",Fs),function(t){t[t.NONE=0]="NONE",t[t.LEFT=1]="LEFT",t[t.RIGHT=2]="RIGHT",t[t.BOTH=3]="BOTH"}(Fs||t("cn",Fs={}));var Hs=function(){},zs=function(){return Hs},Vs=Ws((function(){}));function Ws(t){return function(e){return"function"==typeof e?t(e):function(i){return t(i,e)}}}function Xs(t){return function(e){return function(i){!function(t,e,i){var n=Ys(t);if(n){var r=Ks(n,"proto");Ks(r,"editor")[e]=i}}(i,t,e)}}}var js="__ccclassCache__";function Ys(t){return Ks(t,js)}function Ks(t,e){return t[e]||(t[e]={})}var qs=Ws((function(t,e){var i=Vt(t);i===Object&&(i=null);var n={name:e,extends:i,ctor:t},r=t[js];if(r){var s=r.proto;s&&Ht(n,s),t[js]=void 0}return gi(n)})),Qs=Xs("requireComponent"),Zs=Xs("executionOrder"),Js=Vs;function $s(t,e,i){var n=null;function r(t,e,i){!function(t,e,i,n,r,s){var a,o=s&&"function"!=typeof s&&(s.get||s.set);r&&(a=ri(r,o));var h=Ht(e,a||r||{});o?(s.get&&(h.get=s.get),s.set&&(h.set=s.set)):ia(t,h,i,n,s)}(function(t){return Ys(t.constructor)}(t),function(t,e){var i,n,r=Ks(Ys(t.constructor),"proto"),s=Ks(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?$s({type:void 0}):void 0===e?(n=t,r):void r(t,e,i)}function ta(t){var e;try{e=t()}catch(e){return t}return"object"!=typeof e||null===e?e:t}function ea(t,e,i){var n,r,s=Ys(t.constructor),a=Ks(s,"proto"),o=Ks(a,"properties"),h=null!==(r=o[n=e])&&void 0!==r?r:o[n]={};return h.__internalFlags|=si.STANDALONE,i&&"function"!=typeof i&&(i.get||i.set)?(i.get&&(h.get=i.get),i.set&&(h.set=i.set)):ia(s,h,t.constructor,e,i),h}function ia(t,e,i,n,r){if(void 0!==r)"function"==typeof r?e.default=ta(r):null===r||r.initializer&&(e.default=ta(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 na=Symbol("cc:SerializationMetadata"),ra=t("cN",(function(t,e,i){oa(ea(t,e,i))}));function sa(t){return function(e,i,n){var r=ea(e,i,n);r.formerlySerializedAs=t,oa(r)}}var aa=function(t,e,i){var n=ea(t,e,i);n.editorOnly=!0,oa(n)};function oa(t){t.__internalFlags|=si.IMPLICIT_SERIALIZABLE}var ha=Hs,ua=Vs,la=zs,ca=Vs,_a=zs,da=zs,fa=zs,pa=t("cC",Hs),ma=t("cE",zs),ga=t("cF",zs),va=t("cD",zs),ya=t("cH",zs),Ta=t("cI",zs),Sa=t("cJ",Hs),Ea=t("cG",zs),Aa=t("cK",Hs),Ra=xa(Ke),ba=xa(qe),Ca=xa(Qe),wa=xa(Ze);function xa(t){return $s({type:t})}var Ia=t("cL",(function(t,e,i){ea(t,e,i).override=!0})),Oa=t("bW","__editorExtras__"),Da=t("b_",(function(){})),Ma=Object.freeze({__proto__:null,uniquelyReferenced:ha,ccclass:qs,property:$s,requireComponent:Qs,executionOrder:Zs,disallowMultiple:Js,executeInEditMode:ua,menu:la,playOnFocus:ca,inspector:_a,icon:da,help:fa,type:xa,integer:Ra,float:ba,boolean:Ca,string:wa,editable:pa,tooltip:va,visible:ma,displayName:ga,displayOrder:Ea,range:ya,rangeStep:Ta,slide:Sa,disallowAnimation:Aa,override:Ia,formerlySerializedAs:sa,serializable:ra});t("bN",Ma);var Pa,Ba,Na,La,Fa,ka,Ua,Ga,Ha,za,Va=[],Wa=t("bQ",function(){function t(t){void 0===t&&(t=""),this._objFlags=void 0,this._name=void 0,this._name=t,this._objFlags=0}t._deferredDestroy=function(){for(var t=Va.length,e=0;e<t;++e){var i=Va[e];1&i._objFlags||i._destroyImmediate()}t===Va.length?Va.length=0:Va.splice(0,t)};var e=t.prototype;return e.destroy=function(){return 1&this._objFlags?(q(5e3),!1):!(4&this._objFlags||(this._objFlags|=4,Va.push(this),0))},e._destruct=function(){var t=this.constructor,e=t.__destruct__;e||(e=function(t,e){var i,n=t instanceof v.Node||t instanceof v.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(gi._isCCClass(e))for(var a=v.Class.Attr.getClassAttrs(e),o=e.__props__,h=0;h<o.length;h++){var u=""+(i=o[h]);if(u in a){if(n&&"_id"===i)continue;switch(typeof a[u]){case"string":s[i]="";break;case"object":case"function":s[i]=null;break;case"undefined":s[i]=void 0}}}var l="";for(i in s){var c;c=gi.IDENTIFIER_RE.test(i)?"o."+i+"=":"o["+gi.escapeForJS(i)+"]=";var _=s[i];""===_&&(_='""'),l+=c+_+";\n"}return Function("o",l)}(this,t),Ct(t,"__destruct__",e,!0)),e(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 Xa(t){return t instanceof Wa}function ja(t,e){return"object"==typeof t?!(!t||t._objFlags&(e?5:1)):void 0!==t}function Ya(t,e){return(e<<3)+t}function Ka(t){return Qa[t]}function qa(t){switch(t){case Ha.Uint8:return Uint8Array;case Ha.Uint16:return Uint16Array;case Ha.Uint32:return Uint32Array;case Ha.Int8:return Int8Array;case Ha.Int16:return Int16Array;case Ha.Int32:return Int32Array;case Ha.Float32:return Float32Array;case Ha.Float64:return Float64Array}}Wa.prototype._deserialize=null,gi.fastDefine("cc.Object",Wa,{_name:"",_objFlags:0}),Ct(Wa,"Flags",{Destroyed:1,DontSave:8,EditorOnly:16,Dirty:32,DontDestroy:64,PersistentMask:-4192741,Destroying:128,Deactivating:256,LockedInEditor:512,HideInHierarchy:1024,AllHideMasks:1560,IsPreloadStarted:8192,IsOnLoadStarted:32768,IsOnLoadCalled:16384,IsOnEnableCalled:2048,IsStartCalled:65536,IsEditorOnEnableCalled:4096,IsPositionLocked:1<<21,IsRotationLocked:1<<17,IsScaleLocked:1<<18,IsAnchorLocked:1<<19,IsSizeLocked:1<<20}),v.isValid=ja,v.Object=Wa,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"}(Ha||(Ha={})),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"}(za||(za={})),t("bV",qs("cc.CompactValueTypeArray")(((Ua=function(){function t(){this._byteOffset=Na&&Na(),this._unitCount=La&&La(),this._unitElement=Fa&&Fa(),this._length=ka&&ka()}return t.lengthFor=function(t,e,i){return Ka(e).requiredUnits*t.length*qa(i).BYTES_PER_ELEMENT},t.compress=function(e,i,n,r,s,a){for(var o=Ka(i),h=qa(n),u=o.requiredUnits*e.length,l=new h(r,s,u),c=0;c<e.length;++c)o.compress(l,c,e[c]);var _=new t;return _._unitElement=Ya(n,i),_._byteOffset=a,_._unitCount=u,_._length=e.length,_},t.prototype.decompress=function(t){for(var e,i={storageUnit:7&(e=this._unitElement),elementType:e>>3},n=i.storageUnit,r=Ka(i.elementType),s=new(qa(n))(t,this._byteOffset,this._unitCount),a=new Array(this._length),o=0;o<this._length;++o)a[o]=r.decompress(s,o);return a},t}()).StorageUnit=Ha,Ua.ElementType=za,Na=Gs((Ba=Ua).prototype,"_byteOffset",[ra],(function(){return 0})),La=Gs(Ba.prototype,"_unitCount",[ra],(function(){return 0})),Fa=Gs(Ba.prototype,"_unitElement",[ra],(function(){return Ya(Ha.Uint8,za.Scalar)})),ka=Gs(Ba.prototype,"_length",[ra],(function(){return 0})),Pa=Ba))||Pa);var Qa=((Ga={})[za.Scalar]={requiredUnits:1,compress:function(t,e,i){t[e]=i},decompress:function(t,e){return t[e]}},Ga[za.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 hn(t[2*e],t[2*e+1])}},Ga[za.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 hn(t[3*e],t[3*e+1],t[3*e+2])}},Ga[za.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 nn(t[4*e],t[4*e+1],t[4*e+2],t[4*e+3])}},Ga[za.Quat]={requiredUnits:4,compress:function(t,e,i){t[4*e]=i.x,t[4*e+1]=i.y,t[4*e+2]=i.z,t[4*e+3]=i.w},decompress:function(t,e){return new En(t[4*e],t[4*e+1],t[4*e+2],t[4*e+3])}},Ga[za.Mat4]={requiredUnits:16,compress:function(t,e,i){Dn.toArray(t,i,16*e)},decompress:function(t,e){return Dn.fromArray(new Dn,t,16*e)}},Ga),Za=t("bY",Symbol("[[Serialize]]")),Ja=t("bX",Symbol("[[Deserialize]]"));function $a(){return 0}function to(t){return t}function eo(t){return t*t}function io(t){return t*(2-t)}function no(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)}function ro(t){return t*t*t}function so(t){return--t*t*t+1}function ao(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)}function oo(t){return t*t*t*t}function ho(t){return 1- --t*t*t*t}function uo(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)}function lo(t){return t*t*t*t*t}function co(t){return--t*t*t*t*t+1}function _o(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)}function fo(t){return 1===t?1:1-Math.cos(t*Math.PI/2)}function po(t){return Math.sin(t*Math.PI/2)}function mo(t){return.5*(1-Math.cos(Math.PI*t))}function go(t){return 0===t?0:Math.pow(1024,t-1)}function vo(t){return 1===t?1:1-Math.pow(2,-10*t)}function yo(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 To(t){return 1-Math.sqrt(1-t*t)}function So(t){return Math.sqrt(1- --t*t)}function Eo(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}function Ao(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 Ro(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 bo(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 Co(t){if(1===t)return 1;var e=1.70158;return t*t*((e+1)*t-e)}function wo(t){if(0===t)return 0;var e=1.70158;return--t*t*((e+1)*t+e)+1}function xo(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 Io(t){return 1-Oo(1-t)}function Oo(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 Do(t){return t<.5?.5*Io(2*t):.5*Oo(2*t-1)+.5}function Mo(t){return t<=0?0:t>=1?1:t*t*(3-2*t)}function Po(t){return t<=0?0:t>=1?1:t*t*t*(t*(6*t-15)+10)}v._decorator=Ma;var Bo=Wo(eo,io),No=Wo(ro,so),Lo=Wo(oo,ho),Fo=Wo(lo,co),ko=Wo(fo,po),Uo=Wo(go,vo),Go=Wo(To,So),Ho=Wo(Ao,Ro),zo=Wo(Co,wo),Vo=Wo(Io,Oo);function Wo(t,e){return function(i){return i<.5?e(2*i)/2:t(2*i-1)/2+.5}}var Xo,jo,Yo=Object.freeze({__proto__:null,constant:$a,linear:to,quadIn:eo,quadOut:io,quadInOut:no,cubicIn:ro,cubicOut:so,cubicInOut:ao,quartIn:oo,quartOut:ho,quartInOut:uo,quintIn:lo,quintOut:co,quintInOut:_o,sineIn:fo,sineOut:po,sineInOut:mo,expoIn:go,expoOut:vo,expoInOut:yo,circIn:To,circOut:So,circInOut:Eo,elasticIn:Ao,elasticOut:Ro,elasticInOut:bo,backIn:Co,backOut:wo,backInOut:xo,bounceIn:Io,bounceOut:Oo,bounceInOut:Do,smooth:Mo,fade:Po,quadOutIn:Bo,cubicOutIn:No,quartOutIn:Lo,quintOutIn:Fo,sineOutIn:ko,expoOutIn:Uo,circOutIn:Go,elasticOutIn:Ho,backOutIn:zo,bounceOutIn:Vo});t("cx",Yo),t("cX",jo),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"}(jo||t("cX",jo={}));var Ko,qo=((Xo={})[jo.CONSTANT]=$a,Xo[jo.LINEAR]=to,Xo[jo.QUAD_IN]=eo,Xo[jo.QUAD_OUT]=io,Xo[jo.QUAD_IN_OUT]=no,Xo[jo.QUAD_OUT_IN]=Bo,Xo[jo.CUBIC_IN]=ro,Xo[jo.CUBIC_OUT]=so,Xo[jo.CUBIC_IN_OUT]=ao,Xo[jo.CUBIC_OUT_IN]=No,Xo[jo.QUART_IN]=oo,Xo[jo.QUART_OUT]=ho,Xo[jo.QUART_IN_OUT]=uo,Xo[jo.QUART_OUT_IN]=Lo,Xo[jo.QUINT_IN]=lo,Xo[jo.QUINT_OUT]=co,Xo[jo.QUINT_IN_OUT]=_o,Xo[jo.QUINT_OUT_IN]=Fo,Xo[jo.SINE_IN]=fo,Xo[jo.SINE_OUT]=po,Xo[jo.SINE_IN_OUT]=mo,Xo[jo.SINE_OUT_IN]=ko,Xo[jo.EXPO_IN]=go,Xo[jo.EXPO_OUT]=vo,Xo[jo.EXPO_IN_OUT]=yo,Xo[jo.EXPO_OUT_IN]=Uo,Xo[jo.CIRC_IN]=To,Xo[jo.CIRC_OUT]=So,Xo[jo.CIRC_IN_OUT]=Eo,Xo[jo.CIRC_OUT_IN]=Go,Xo[jo.ELASTIC_IN]=Ao,Xo[jo.ELASTIC_OUT]=Ro,Xo[jo.ELASTIC_IN_OUT]=bo,Xo[jo.ELASTIC_OUT_IN]=Ho,Xo[jo.BACK_IN]=Co,Xo[jo.BACK_OUT]=wo,Xo[jo.BACK_IN_OUT]=xo,Xo[jo.BACK_OUT_IN]=zo,Xo[jo.BOUNCE_IN]=Io,Xo[jo.BOUNCE_OUT]=Oo,Xo[jo.BOUNCE_IN_OUT]=Do,Xo[jo.BOUNCE_OUT_IN]=Vo,Xo[jo.SMOOTH]=Mo,Xo[jo.FADE]=Po,Xo);function Qo(t){return qo[t]}R(255),R(65280);var Zo,Jo,$o,th=Ns.LINEAR<<0|Fs.NONE<<8|jo.LINEAR<<16,eh=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).value=0,e.rightTangent=0,e.rightTangentWeight=0,e.leftTangent=0,e.leftTangentWeight=0,e._flags=th,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}(Da);function ih(t){var e=new eh;if("number"==typeof t)e.value=t;else{var i=t.interpolationMode,n=t.tangentWeightMode,r=t.value,s=t.rightTangent,a=t.rightTangentWeight,o=t.leftTangent,h=t.leftTangentWeight,u=t.easingMethod,l=t[Oa];e.value=null!=r?r:e.value,e.rightTangent=null!=s?s:e.rightTangent,e.rightTangentWeight=null!=a?a:e.rightTangentWeight,e.leftTangent=null!=o?o:e.leftTangent,e.leftTangentWeight=null!=h?h:e.leftTangentWeight,e.interpolationMode=null!=i?i:e.interpolationMode,e.tangentWeightMode=null!=n?n:e.tangentWeightMode,e.easingMethod=null!=u?u:e.easingMethod,l&&(e[Oa]=l)}return e}gi.fastDefine("cc.RealKeyframeValue",eh,((Ko={interpolationMode:Ns.LINEAR,tangentWeightMode:Fs.NONE,value:0,rightTangent:0,rightTangentWeight:0,leftTangent:0,leftTangentWeight:0,easingMethod:jo.LINEAR})[Oa]=void 0,Ko)),gi.Attr.setClassAttr(eh,Oa,"editorOnly",!0),(Zo=eh,null!==($o=(Jo=Zo)[na])&&void 0!==$o?$o:Jo[na]={}).uniquelyReferenced=!0;var nh,rh=t("ck",function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).preExtrapolation=Ls.CLAMP,e.postExtrapolation=Ls.CLAMP,e}s(e,t);var i=e.prototype;return i.evaluate=function(t){var e=this._times,i=this._values,n=e.length;if(0===n)return 0;var r=e[0],s=e[n-1];if(t<r){var a=this.preExtrapolation,o=i[0];if(a===Ls.CLAMP||n<2)return o.value;switch(a){case Ls.LINEAR:return Th(r,i[0].value,e[1],i[1].value,t);case Ls.LOOP:t=vh(t,r,s);break;case Ls.PING_PONG:t=yh(t,r,s);break;default:return o.value}}else if(t>s){var h=this.postExtrapolation,u=i[n-1];if(h===Ls.CLAMP||n<2)return u.value;switch(h){case Ls.LINEAR:return Th(s,u.value,e[n-2],i[n-2].value,t);case Ls.LOOP:t=vh(t,r,s);break;case Ls.PING_PONG:t=yh(t,r,s);break;default:return u.value}}var l=Bs(e,t);if(l>=0)return i[l].value;var c=~l,_=c-1,d=e[_],f=i[_],p=e[c];return function(t,e,i,n,r){var s=i-t;switch(e.interpolationMode){default:case Ns.CONSTANT:return e.value;case Ns.LINEAR:var a=e.easingMethod===jo.LINEAR?r:Qo(e.easingMethod)(r);return Di(e.value,n.value,a);case Ns.CUBIC:var o=1/3,h=e.rightTangent,u=e.rightTangentWeight,l=0!=(e.tangentWeightMode&Fs.RIGHT),c=n.leftTangent,_=n.leftTangentWeight,d=0!=(n.tangentWeightMode&Fs.LEFT);if(l||d){var f=0;if(l)f=u;else{var p=s,m=s*h;f=Math.sqrt(p*p+m*m)*o}var g=Math.atan(h),v=Math.cos(g)*f+t,y=Math.sin(g)*f+e.value,T=0;if(d)T=_;else{var S=s,E=s*c;T=Math.sqrt(S*S+E*E)*o}var A=Math.atan(c),R=(v-t)/s,b=(-Math.cos(A)*T+i-t)/s,C=y,w=-Math.sin(A)*T+n.value,x=[0,0,0],I=function(t,e,i,n,r){var s=i/n,a=e/n,o=s*s,h=1/3*(-1/3*o+a),u=.5*(2/27*s*o-1/3*s*a+t/n),l=h*h*h,c=u*u+l,_=0;if(Us(c)){if(Us(u))return r[0]=0,1;var d=Math.cbrt(-u);return r[0]=2*d,r[1]=-d,2}if(c<0){var f=1/3*Math.acos(-u/Math.sqrt(-l)),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 m=Math.sqrt(c),g=Math.cbrt(m-u),v=-Math.cbrt(m+u);r[0]=g+v,_=1}for(var y=1/3*s,T=0;T<_;++T)r[T]-=y;return _}(0-r,3*R,3*b-6*R,3*(R-b)+1,x),O=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}(x,I,r);return Sh(e.value,C,w,n.value,O)}var D=e.value+o*h*s,M=n.value-o*c*s;return Sh(e.value,D,M,n.value,r)}}(d,f,p,i[c],(t-d)/(p-d))},i.addKeyFrame=function(e,i){return t.prototype.addKeyFrame.call(this,e,ih(i))},i.assignSorted=function(t,e){if(void 0!==e)this.setKeyframes(t.slice(),e.map((function(t){return ih(t)})));else{var i=Array.from(t);this.setKeyframes(i.map((function(t){return t[0]})),i.map((function(t){return ih(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 xi(i.value,e,t)}))},i[Za]=function(t,e){if(e.toCCON){var i=this._times,n=this._values,r=i.length,s=new DataView(new ArrayBuffer(0+sh+sh+ah+oh*r+ph*r)),a=0;s.setUint8(a,this.preExtrapolation),a+=sh,s.setUint8(a,this.postExtrapolation),a+=sh,s.setUint32(a,r,!0),a+=ah,i.forEach((function(t,e){return s.setFloat32(a+oh*e,t,!0)})),a+=oh*r;for(var o,h=d(n);!(o=h()).done;){var u=o.value;a=mh(s,u,a)}var l=new Uint8Array(s.buffer,0,a);t.writeProperty("bytes",l);var c=n.map((function(t){return t[Oa]}));c.some((function(t){return void 0!==t}))&&t.writeProperty("keyframeValueEditorExtras",c)}else t.writeThis()},i[Ja]=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+=sh,this.postExtrapolation=n.getUint8(r),r+=sh;var s=n.getUint32(r,!0);r+=ah;var a=Array.from({length:s},(function(t,e){return n.getFloat32(r+oh*e,!0)}));r+=oh*s;for(var o=new Array(s),h=0;h<s;++h){var u=ih({});r=gh(n,u,r),o[h]=u}i.byteLength;var l=t.readProperty("keyframeValueEditorExtras");l&&(l.length,l.forEach((function(t,e){return o[e][Oa]=t}))),this._times=a,this._values=o}else t.readThis()},e}(ks));gi.fastDefine("cc.RealCurve",rh,{_times:[],_values:[],preExtrapolation:Ls.CLAMP,postExtrapolation:Ls.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"}(nh||(nh={}));var sh=1,ah=4,oh=4,hh=ih({}),uh=hh.interpolationMode,lh=hh.tangentWeightMode,ch=hh.leftTangent,_h=hh.leftTangentWeight,dh=hh.rightTangent,fh=hh.rightTangentWeight,ph=26;function mh(t,e,i){var n=0,r=i,s=r;r+=4;var a=e.value,o=e.interpolationMode,h=e.tangentWeightMode,u=e.rightTangent,l=e.rightTangentWeight,c=e.leftTangent,_=e.leftTangentWeight,d=e.easingMethod;return t.setFloat32(r,a,!0),r+=4,o!==uh&&(n|=nh.INTERPOLATION_MODE,t.setUint8(r,o),r+=1),h!==lh&&(n|=nh.TANGENT_WEIGHT_MODE,t.setUint8(r,h),r+=1),c!==ch&&(n|=nh.LEFT_TANGENT,t.setFloat32(r,c,!0),r+=4),_!==_h&&(n|=nh.LEFT_TANGENT_WEIGHT,t.setFloat32(r,_,!0),r+=4),u!==dh&&(n|=nh.RIGHT_TANGENT,t.setFloat32(r,u,!0),r+=4),l!==fh&&(n|=nh.RIGHT_TANGENT_WEIGHT,t.setFloat32(r,l,!0),r+=4),n|=d<<8,t.setUint32(s,n,!0),r}function gh(t,e,i){var n=i,r=t.getUint32(n,!0);n+=4,e.value=t.getFloat32(n,!0),n+=4,r&nh.INTERPOLATION_MODE&&(e.interpolationMode=t.getUint8(n),n+=1),r&nh.TANGENT_WEIGHT_MODE&&(e.tangentWeightMode=t.getUint8(n),n+=1),r&nh.LEFT_TANGENT&&(e.leftTangent=t.getFloat32(n,!0),n+=4),r&nh.LEFT_TANGENT_WEIGHT&&(e.leftTangentWeight=t.getFloat32(n,!0),n+=4),r&nh.RIGHT_TANGENT&&(e.rightTangent=t.getFloat32(n,!0),n+=4),r&nh.RIGHT_TANGENT_WEIGHT&&(e.rightTangentWeight=t.getFloat32(n,!0),n+=4);var s=(65280&r)>>8;return e.easingMethod=s,n}function vh(t,e,i){return e+zi(t-e,i-e)}function yh(t,e,i){return e+Vi(t-e,i-e)}function Th(t,e,i,n,r){return e+(n-e)/(i-t)*(r-t)}function Sh(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 Eh(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}v.bezier=Eh;var Ah,Rh,bh,Ch,wh,xh,Ih,Oh,Dh,Mh,Ph=Math.cos,Bh=Math.acos,Nh=Math.max,Lh=2*Math.PI,Fh=Math.sqrt;function kh(t){return t<0?-Math.pow(-t,1/3):Math.pow(t,1/3)}function Uh(t,e){var i=function(t,e){var i,n,r,s,a=e-0,o=e-t[0],h=3*a,u=3*o,l=3*(e-t[2]),c=1/(-a+u-l+(e-1)),_=1/3,d=(h-6*o+l)*c,f=d*_,p=(-h+u)*c,m=(3*p-d*d)*_,g=m*_,v=(2*d*d*d-9*d*p+a*c*27)/27,y=v/2,T=y*y+g*g*g;if(T<0){var S=-m*_,E=Fh(S*S*S),A=-v/(2*E),R=Bh(A<-1?-1:A>1?1:A),b=2*kh(E);return n=b*Ph(R*_)-f,r=b*Ph((R+Lh)*_)-f,s=b*Ph((R+2*Lh)*_)-f,n>=0&&n<=1?r>=0&&r<=1?s>=0&&s<=1?Nh(n,r,s):Nh(n,r):s>=0&&s<=1?Nh(n,s):n:r>=0&&r<=1?s>=0&&s<=1?Nh(r,s):r:s}if(0===T)return r=-(i=y<0?kh(-y):-kh(y))-f,(n=2*i-f)>=0&&n<=1?r>=0&&r<=1?Nh(n,r):n:r;var C=Fh(T);return(i=kh(-y+C))-kh(y+C)-f}(t,e),n=t[1];return((1-i)*(n+(t[3]-n)*i)*3+i*i)*i}v.bezierByTime=Uh,t("cp",Mh),function(t){t[t.SLERP=0]="SLERP",t[t.CONSTANT=1]="CONSTANT"}(Mh||t("cp",Mh={}));var Gh=qs("cc.QuatKeyframeValue")(Ah=ha((Rh=function(t){var e=void 0===t?{}:t,i=e.value,n=e.interpolationMode,r=e.easingMethod;this.interpolationMode=bh&&bh(),this.value=Ch&&Ch(),this.easingMethod=wh&&wh(),this.value=i?En.clone(i):this.value,this.interpolationMode=null!=n?n:this.interpolationMode,this.easingMethod=null!=r?r:this.easingMethod},bh=Gs(Rh.prototype,"interpolationMode",[ra],(function(){return Mh.SLERP})),Ch=Gs(Rh.prototype,"value",[ra],(function(){return En.clone(En.IDENTITY)})),wh=Gs(Rh.prototype,"easingMethod",[ra],(function(){return jo.LINEAR})),Ah=Rh))||Ah)||Ah;function Hh(t){return new Gh(t)}var zh,Vh=t("co",qs("cc.QuatCurve")((Ih=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).preExtrapolation=Oh&&Oh(),e.postExtrapolation=Dh&&Dh(),e}s(e,t);var i=e.prototype;return i.evaluate=function(t,e){var i;null!==(i=e)&&void 0!==i||(e=new En);var n=this._times,r=this._values,s=this.postExtrapolation,a=this.preExtrapolation,o=n.length;if(0===o)return e;var h=n[0],u=n[o-1];if(t<h){var l=r[0];switch(a){case Ls.LOOP:t=h+zi(t-h,u-h);break;case Ls.PING_PONG:t=h+Vi(t-h,u-h);break;case Ls.CLAMP:default:return En.copy(e,l.value)}}else if(t>u){var c=r[o-1];switch(s){case Ls.LOOP:t=h+zi(t-h,u-h);break;case Ls.PING_PONG:t=h+Vi(t-h,u-h);break;case Ls.CLAMP:default:return En.copy(e,c.value)}}var _=Bs(n,t);if(_>=0)return En.copy(e,r[_].value);var d=~_,f=d-1,p=n[f],m=r[f],g=n[d],v=r[d],y=(t-p)/(g-p);switch(m.interpolationMode){default:case Mh.CONSTANT:return En.copy(e,m.value);case Mh.SLERP:var T=m.easingMethod,S=T===jo.LINEAR?y:Array.isArray(T)?Uh(T,y):Qo(T)(y);return En.slerp(e,m.value,v.value,S)}},i.addKeyFrame=function(e,i){var n=new Gh(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 Hh(t)})));else{var i=Array.from(t);this.setKeyframes(i.map((function(t){return t[0]})),i.map((function(t){return Hh(t[1])})))}},i[Za]=function(t,e){if(e.toCCON){var i=this._times,n=this._values,r=!0;n.forEach((function(t,e,i){var n=i[0];r&&t.interpolationMode!==n.interpolationMode&&(r=!1)}));var s=i.length,a=qh*(r?1:s),o=n.reduce((function(t,e){var i=e.easingMethod;return t+(Array.isArray(i)?Qh+4*Jh:Qh)}),0),h=0,u=new DataView(new ArrayBuffer(h+=Xh+jh+Yh*s+4*Kh*s+o+a+0)),l=0,c=0;r&&(c|=zh.INTERPOLATION_MODE),u.setUint32(l,c,!0),l+=Xh,u.setUint32(l,s,!0),l+=jh,i.forEach((function(t,e){return u.setFloat32(l+Yh*e,t,!0)})),l+=Yh*s,n.forEach((function(t,e){var i=t.value,n=i.x,r=i.y,s=i.z,a=i.w,o=l+4*Kh*e;u.setFloat32(o+0*Kh,n,!0),u.setFloat32(o+1*Kh,r,!0),u.setFloat32(o+2*Kh,s,!0),u.setFloat32(o+3*Kh,a,!0)})),l+=4*Kh*s,n.forEach((function(t){var e=t.easingMethod;Array.isArray(e)?(u.setUint8(l,Zh),++l,u.setFloat32(l+0*Jh,e[0],!0),u.setFloat32(l+1*Jh,e[1],!0),u.setFloat32(l+2*Jh,e[2],!0),u.setFloat32(l+3*Jh,e[3],!0),l+=4*Jh):(u.setUint8(l,e),++l)}));var _=l;l+=a;var d=_;n.forEach((function(t){var e=t.interpolationMode;u.setUint8(d,e),r||(d+=qh)}));var f=new Uint8Array(u.buffer);t.writeProperty("bytes",f)}else t.writeThis()},i[Ja]=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+=Xh;var a=s&zh.INTERPOLATION_MODE,o=n.getUint32(r,!0);r+=jh;var h=Array.from({length:o},(function(t,e){return n.getFloat32(r+Yh*e,!0)})),u=r+=Yh*o;r+=4*Kh*o;var l=Array.from({length:o},(function(t,e){var i=u+4*Kh*e,s=n.getFloat32(i+0*Kh,!0),a=n.getFloat32(i+1*Kh,!0),o=n.getFloat32(i+2*Kh,!0),h=n.getFloat32(i+3*Kh,!0),l=n.getUint8(r);++r;var c=Hh({value:{x:s,y:a,z:o,w:h}});return l!==Zh?c.easingMethod=l:(c.easingMethod=[n.getFloat32(r+0*Jh,!0),n.getFloat32(r+1*Jh,!0),n.getFloat32(r+2*Jh,!0),n.getFloat32(r+3*Jh,!0)],r+=4*Jh),c}));if(a){var c=n.getUint8(r);++r;for(var _=0;_<o;++_)l[_].interpolationMode=c}else{for(var d=0;d<o;++d){var f=n.getUint8(r+d);l[d].interpolationMode=f}r+=o}this._times=h,this._values=l}else t.readThis()},e}(ks),Oh=Gs(Ih.prototype,"preExtrapolation",[ra],(function(){return Ls.CLAMP})),Dh=Gs(Ih.prototype,"postExtrapolation",[ra],(function(){return Ls.CLAMP})),xh=Ih))||xh);!function(t){t[t.INTERPOLATION_MODE=1]="INTERPOLATION_MODE"}(zh||(zh={}));var Wh,Xh=1,jh=4,Yh=4,Kh=4,qh=1,Qh=1,Zh=255,Jh=4,$h=t("cq",qs("cc.ObjectCurve")(Wh=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=Ii(~e-1,0,this._values.length-1);return this._values[i]},e}(ks))||Wh),tu=ve({Blend:0,Fixed:1}),eu=t("cr",(function(){this.color=pn.WHITE.clone(),this.time=0}));gi.fastDefine("cc.ColorKey",eu,{color:pn.WHITE.clone(),time:0}),gi.Attr.setClassAttr(eu,"color","visible",!0),gi.Attr.setClassAttr(eu,"time","visible",!0);var iu=t("cs",(function(){this.alpha=1,this.time=0}));gi.fastDefine("cc.AlphaKey",iu,{alpha:1,time:0}),gi.Attr.setClassAttr(iu,"alpha","visible",!0),gi.Attr.setClassAttr(iu,"time","visible",!0);var nu=t("ct",function(){function t(){this.colorKeys=[],this.alphaKeys=[],this.mode=tu.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 pn,t)},e.evaluateFast=function(t,e){return this.getRGB(t,e),t._set_a_unsafe(this.getAlpha(e)),t},e.randomColor=function(){return this.getRandomColor(new pn)},e.getRandomColor=function(t){var e=this.colorKeys[Math.trunc(Bi()*this.colorKeys.length)],i=this.alphaKeys[Math.trunc(Bi()*this.alphaKeys.length)];return t.set(e.color),t._set_a_unsafe(i.alpha),t},e.getRGB=function(t,e){var i=this.colorKeys,n=i.length;if(n>1){e=zi(e,1+Ci);for(var r=1;r<n;++r){var s=i[r-1].time,a=i[r].time;if(e>=s&&e<a){if(this.mode===tu.Fixed)return pn.copy(t,i[r].color),t;var o=(e-s)/(a-s);return pn.lerp(t,i[r-1].color,i[r].color,o),t}}var h=n-1;xi(e,i[h].time,Ci)?pn.copy(t,i[h].color):e<i[0].time?pn.lerp(t,pn.BLACK,i[0].color,e/i[0].time):e>i[h].time&&pn.lerp(t,i[h].color,pn.BLACK,(e-i[h].time)/(1-i[h].time))}else 1===n?pn.copy(t,i[0].color):pn.copy(t,pn.WHITE);return t},e.getAlpha=function(t){var e=this.alphaKeys,i=e.length;if(i>1){t=zi(t,1+Ci);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===tu.Fixed)return e[n].alpha;var a=(t-r)/(s-r);return Di(e[n-1].alpha,e[n].alpha,a)}}var o=i-1;return xi(t,e[o].time,Ci)?e[o].alpha:t<e[0].time?Di(0,e[0].alpha,t/e[0].time):t>e[o].time?Di(e[o].alpha,0,(t-e[o].time)/(1-e[o].time)):255}return 1===i?e[0].alpha:255},t}());nu.Mode=tu,gi.fastDefine("cc.Gradient",nu,{colorKeys:[],alphaKeys:[],mode:tu.Blend}),gi.Attr.setClassAttr(nu,"colorKeys","visible",!0),gi.Attr.setClassAttr(nu,"alphaKeys","visible",!0),gi.Attr.setClassAttr(nu,"mode","visible",!0);var ru=function(){this.time=0,this.value=0,this.inTangent=0,this.outTangent=0};gi.fastDefine("cc.Keyframe",ru,{time:0,value:0,inTangent:0,outTangent:0});var su=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 au(t-this.time,this.coefficient)},t}();function au(t,e){return t*(t*(t*e[0]+e[1])+e[2])+e[3]}var ou,hu,uu=function(){function t(t){if(void 0===t&&(t=null),this._curve=void 0,this.cachedKey=void 0,t instanceof rh)this._curve=t;else{var e=new rh;this._curve=e,e.preExtrapolation=Ls.LOOP,e.postExtrapolation=Ls.CLAMP,t?e.assignSorted(t.map((function(t){return[t.time,{interpolationMode:Ns.CUBIC,value:t.value,leftTangent:t.inTangent,rightTangent:t.outTangent}]}))):e.assignSorted([[0,{interpolationMode:Ns.CUBIC,value:1}],[1,{interpolationMode:Ns.CUBIC,value:1}]])}this.cachedKey=new su}var e=t.prototype;return e.addKey=function(t){t?this._curve.addKeyFrame(t.time,{interpolationMode:Ns.CUBIC,value:t.value,leftTangent:t.inTangent,rightTangent:t.outTangent}):this._curve.clear()},e.evaluate_slow=function(t){return this._curve.evaluate(t)},e.evaluate=function(t){var e=this.cachedKey,i=this._curve,n=i.keyFramesCount-1,r=t,s=t<0?i.preExtrapolation:i.postExtrapolation,a=i.getKeyframeTime(0),o=i.getKeyframeTime(n);switch(s){case Ls.LOOP:r=zi(t-a,o-a)+a;break;case Ls.PING_PONG:r=Vi(t-a,o-a)+a;break;case Ls.CLAMP:default:r=Ii(t,a,o)}if(r>=e.time&&r<e.endTime)return e.evaluate(r);var h=this.findIndex(e,r),u=Math.min(h+1,n);return this.calcOptimizedKey(e,h,u),e.evaluate(r)},e.calcOptimizedKey=function(t,e,i){var n=this._curve.getKeyframeTime(e),r=this._curve.getKeyframeTime(i),s=this._curve.getKeyframeValue(e),a=s.value,o=s.leftTangent,h=this._curve.getKeyframeValue(i),u=h.value,l=h.rightTangent;t.index=e,t.time=n,t.endTime=r;var c=r-n,_=u-a,d=1/(c*c),f=o*c,p=l*c;t.coefficient[0]=(f+p-_-_)*d/c,t.coefficient[1]=(_+_+_-f-f-p)*d,t.coefficient[2]=o,t.coefficient[3]=a},e.findIndex=function(t,e){var i=this._curve,n=i.keyFramesCount,r=t.index;if(-1!==r)if(e>i.getKeyframeTime(r))for(var s=0;s<3;s++){var a=r+s;if(a+1<n&&i.getKeyframeTime(a+1)>e)return a}else for(var o=0;o<3;o++){var h=r-o;if(h>=0&&i.getKeyframeTime(h-1)<=e)return h-1}for(var u,l=0,c=n;c-l>1;)u=Math.floor((l+c)/2),i.getKeyframeTime(u)>=e?c=u:l=u;return l},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 ru;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:Ns.CUBIC,value:t.value,leftTangent:t.inTangent,rightTangent:t.outTangent}]})))}},{key:"preWrapMode",get:function(){return cu(this._curve.preExtrapolation)},set:function(t){this._curve.preExtrapolation=lu(t)}},{key:"postWrapMode",get:function(){return cu(this._curve.postExtrapolation)},set:function(t){this._curve.postExtrapolation=lu(t)}}]),t}();function lu(t){switch(t){default:case ou.Default:case ou.Normal:case ou.Clamp:return Ls.CLAMP;case ou.PingPong:return Ls.PING_PONG;case ou.Loop:return Ls.LOOP}}function cu(t){switch(t){default:case Ls.LINEAR:case Ls.CLAMP:return ou.Clamp;case Ls.PING_PONG:return ou.PingPong;case Ls.LOOP:return ou.Loop}}function _u(){var t=new rh;return t.assignSorted([[0,{interpolationMode:Ns.CUBIC,value:1}],[1,{interpolationMode:Ns.CUBIC,value:1}]]),t}uu.defaultKF=[{time:0,value:1,inTangent:0,outTangent:0},{time:1,value:1,inTangent:0,outTangent:0}],gi.fastDefine("cc.AnimationCurve",uu,{_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"}(ou||(ou={})),function(t){t[t.LINEAR=0]="LINEAR",t[t.BEZIER=1]="BEZIER",t[t.CATMULL_ROM=2]="CATMULL_ROM"}(hu||(hu={}));var du,fu=4294967295,pu=new hn,mu=new hn,gu=new hn,vu=new hn,yu=function(){function t(t,e){void 0===t&&(t=hu.CATMULL_ROM),void 0===e&&(e=[]),this._type=void 0,this._mode=hu.CATMULL_ROM,this._knots=[],this._type=ar.SHAPE_SPLINE,this._mode=t;for(var i=0;i<e.length;i++)this._knots[i]=new hn(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 hn(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 hn(e[i])},e.clearKnots=function(){this._knots.length=0},e.getKnotCount=function(){return this._knots.length},e.addKnot=function(t){this._knots.push(new hn(t))},e.insertKnot=function(t,e){var i=new hn(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=fu),e=Ii(e,0,1);var n=this.getSegments();if(0===n)return new hn(0,0,0);if(i===fu){var r=1/n;i=Math.floor(e/r),e=e%r/r}if(i>=n)return new hn(this._knots[this._knots.length-1]);switch(this._mode){case hu.LINEAR:return t.calcLinear(this._knots[i],this._knots[i+1],e);case hu.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 hu.CATMULL_ROM:var s=i>0?this._knots[i-1]:this._knots[i],a=i+2<this._knots.length?this._knots[i+2]:this._knots[i+1];return t.calcCatmullRom(s,this._knots[i],this._knots[i+1],a,e);default:return new hn(0,0,0)}},e.getPoints=function(t,e){if(void 0===e&&(e=fu),0===t)return[];if(1===t)return[this.getPoint(0,e)];for(var i=[],n=1/(t-1),r=0;r<t;r++){var s=r*n,a=this.getPoint(s,e);i.push(a)}return i},e.getSegments=function(){var t=this._knots.length;switch(this._mode){case hu.LINEAR:case hu.CATMULL_ROM:return t<2?(q(14300),0):t-1;case hu.BEZIER:return t<4||t%4!=0?(q(14301),0):t/4}},t.calcLinear=function(t,e,i){var n=new hn;return hn.multiplyScalar(pu,t,1-i),hn.multiplyScalar(mu,e,i),hn.add(n,pu,mu),n},t.calcBezier=function(t,e,i,n,r){var s=new hn,a=1-r;return hn.multiplyScalar(pu,t,a*a*a),hn.multiplyScalar(mu,e,3*r*a*a),hn.multiplyScalar(gu,i,3*r*r*a),hn.multiplyScalar(vu,n,r*r*r),hn.add(pu,pu,mu),hn.add(gu,gu,vu),hn.add(s,pu,gu),s},t.calcCatmullRom=function(t,e,i,n,r){var s=new hn,a=r*r,o=a*r;return hn.multiplyScalar(pu,t,-.5*o+a-.5*r),hn.multiplyScalar(mu,e,1.5*o-2.5*a+1),hn.multiplyScalar(gu,i,-1.5*o+2*a+.5*r),hn.multiplyScalar(vu,n,.5*o-.5*a),hn.add(pu,pu,mu),hn.add(gu,gu,vu),hn.add(s,pu,gu),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 Tu(t,e){console.warn(t+" is deprecated, please use "+e+" instead.")}!function(t){t[t.ALL=0]="ALL",t[t.CLOSEST=1]="CLOSEST",t[t.ANY=2]="ANY"}(du||(du={})),rt(us,"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 Su=function(t){function e(){var e;return e=t.call(this)||this,Tu("line","Line"),e}return s(e,t),e}(or),Eu=function(t){function e(){var e;return e=t.call(this)||this,Tu("plane","Plane"),e}return s(e,t),e}(fs),Au=function(t){function e(){var e;return e=t.call(this)||this,Tu("ray","Ray"),e}return s(e,t),e}(hr),Ru=function(t){function e(){var e;return e=t.call(this)||this,Tu("triangle","Triangle"),e}return s(e,t),e}(ps),bu=function(t){function e(){var e;return e=t.call(this)||this,Tu("sphere","Sphere"),e}return s(e,t),e}(yr),Cu=function(t){function e(){var e;return e=t.call(this)||this,Tu("aabb","AABB"),e}return s(e,t),e}(Es),wu=function(t){function e(){var e;return e=t.call(this)||this,Tu("obb","OBB"),e}return s(e,t),e}(Ps),xu=function(t){function e(){var e;return e=t.call(this)||this,Tu("capsule","Capsule"),e}return s(e,t),e}(As),Iu=function(t){function e(){var e;return e=t.call(this)||this,Tu("frustum","Frustum"),e}return s(e,t),e}(Is),Ou=Object.freeze({__proto__:null,distance:sr,enums:ar,intersect:us,Line:or,Plane:fs,Ray:hr,Triangle:ps,Sphere:yr,AABB:Es,OBB:Ps,Capsule:As,Frustum:Is,Keyframe:ru,AnimationCurve:uu,get WrapModeMask(){return ou},get SplineMode(){return hu},Spline:yu,constructLegacyCurveAndConvert:_u,OptimizedKey:su,evalOptCurve:au,get ERaycastMode(){return du},line:Su,plane:Eu,ray:Au,triangle:Ru,sphere:bu,aabb:Cu,obb:wu,capsule:xu,frustum:Iu});t("aG",Ou);var Du=function(){function t(){this._poolHandle=-1,Mu.addContainer(this)}return t.prototype.destroy=function(){Mu.removeContainer(this)},t}(),Mu=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}()),Pu=t("bt",function(t){function e(e,i,n){var r;(r=t.call(this)||this)._ctor=void 0,r._elementsPerBatch=void 0,r._nextAvail=void 0,r._freePool=[],r._dtor=void 0,r._ctor=e,r._dtor=n||null,r._elementsPerBatch=Math.max(i,1),r._nextAvail=r._elementsPerBatch-1;for(var s=0;s<r._elementsPerBatch;++s)r._freePool.push(e());return r}s(e,t);var i=e.prototype;return i.alloc=function(){if(this._nextAvail<0){this._freePool.length=this._elementsPerBatch;for(var t=0;t<this._elementsPerBatch;t++)this._freePool[t]=this._ctor();this._nextAvail=this._elementsPerBatch-1}return this._freePool[this._nextAvail--]},i.free=function(t){this._freePool[++this._nextAvail]=t},i.freeArray=function(t){this._freePool.length=this._nextAvail+1,Array.prototype.push.apply(this._freePool,t),this._nextAvail+=t.length},i.tryShrink=function(){if(this._nextAvail>>1>this._elementsPerBatch){if(this._dtor)for(var t=this._nextAvail>>1;t<=this._nextAvail;t++)this._dtor(this._freePool[t]);this._freePool.length=this._nextAvail>>1,this._nextAvail=this._freePool.length-1}},i.destroy=function(){var e=arguments.length>0?arguments[0]:null;e&&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}(Du)),Bu=t("bu",function(t){function e(e,i,n){var r;(r=t.call(this)||this)._fn=void 0,r._dtor=null,r._count=0,r._data=void 0,r._initSize=0,r._fn=e,r._dtor=n||null,r._data=new Array(i),r._initSize=i;for(var s=0;s<i;++s)r._data[s]=e();return r}s(e,t);var i=e.prototype;return i.reset=function(){this._count=0},i.resize=function(t){if(t>this._data.length)for(var e=this._data.length;e<t;++e)this._data[e]=this._fn()},i.add=function(){return this._count>=this._data.length&&this.resize(this._data.length<<1),this._data[this._count++]},i.destroy=function(){if(this._dtor)for(var e=0;e<this._data.length;e++)this._dtor(this._data[e]);this._data.length=0,this._count=0,t.prototype.destroy.call(this)},i.tryShrink=function(){if(this._data.length>>2>this._count){var t=Math.max(this._initSize,this._data.length>>1);if(this._dtor)for(var e=t;e<this._data.length;e++)this._dtor(this._data[e]);this._data.length=t}},i.removeAt=function(t){if(!(t>=this._count)){var e=this._count-1,i=this._data[t];this._data[t]=this._data[e],this._data[e]=i,this._count-=1}},n(e,[{key:"length",get:function(){return this._count}},{key:"data",get:function(){return this._data}}]),e}(Du)),Nu=t("bv",function(t){function e(e,i){var n;return(n=t.call(this)||this).array=void 0,n.length=0,n._compareFn=void 0,n._initSize=0,n.array=new Array(e),n._initSize=e,n.length=0,n._compareFn=i,n}s(e,t);var i=e.prototype;return i.push=function(t){this.array[this.length++]=t},i.pop=function(){return this.array[--this.length]},i.get=function(t){return this.array[t]},i.clear=function(){this.length=0},i.destroy=function(){this.length=0,this.array.length=0,t.prototype.destroy.call(this)},i.tryShrink=function(){this.array.length>>2>this.length&&(this.array.length=Math.max(this._initSize,this.array.length>>1))},i.sort=function(){this.array.length=this.length,this.array.sort(this._compareFn)},i.concat=function(t){for(var e=0;e<t.length;++e)this.array[this.length++]=t[e]},i.fastRemove=function(t){if(!(t>=this.length||t<0)){var e=--this.length;this.array[t]=this.array[e]}},i.indexOf=function(t){for(var e=0,i=this.length;e<i;++e)if(this.array[e]===t)return e;return-1},e}(Du));t("aF",Object.freeze({__proto__:null,Pool:Pu,RecyclePool:Bu,CachedArray:Nu}));var Lu=t("cw",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}());Lu.Priority=ve({LOW:0,MEDIUM:100,HIGH:200,SCHEDULER:1<<31>>>0});var Fu=new vt("Scheduler"),ku=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}();ku._listEntries=[];var Uu=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}();Uu._hashUpdateEntries=[];var Gu=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,a){var o=t._hashTimerEntries.pop();return o?(o.timers=e,o.target=i,o.timerIndex=n,o.currentTimer=r,o.currentTimerSalvaged=s,o.paused=a):o=new t(e,i,n,r,s,a),o},t.put=function(e){t._hashTimerEntries.length<20&&(e.timers=e.target=e.currentTimer=null,t._hashTimerEntries.push(e))},t}();Gu._hashTimerEntries=[];var Hu=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._elapsed=-1,this._interval=n,this._delay=s,this._useDelay=this._delay>0,this._repeat=r,this._runForever=this._repeat===v.macro.REPEAT_FOREVER,!0},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.unschedule(this._callback,this._target)},t}();Hu._timers=[];var zu=t("cj",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=Ot(!0),e._hashForTimers=Ot(!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=Fu.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 a,o;(r=i[e]).paused||r.markedForDeletion||!r.target||null===(a=(o=r.target).update)||void 0===a||a.call(o,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 l,c;(r=i[e]).paused||r.markedForDeletion||!r.target||null===(l=(c=r.target).update)||void 0===l||l.call(c,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 a,o,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=v.macro.REPEAT_FOREVER,r=0),tt(Boolean(u),1502);var l=u.uuid||u.id;if(l){var c,_,d=this._hashForTimers[l];if(d?d.paused!==s&&q(1511):(d=Gu.get(null,u,0,null,!1,Boolean(s)),this._arrayForTimers.push(d),this._hashForTimers[l]=d),null==d.timers)d.timers=[];else for(_=0;_<d.timers.length;++_)if((c=d.timers[_])&&h===c.getCallback())return Y(1507,c.getInterval(),i),void c.setInterval(i);(c=Hu.get()).initWithCallback(this,h,u,i,null!==(a=n)&&void 0!==a?a:0,null!==(o=r)&&void 0!==o?o:0),d.timers.push(c),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 Y(1506),r.entry.markedForDeletion=!1,void(r.entry.paused=i);this.unscheduleUpdate(t)}var s,a=ku.get(t,e,i,!1);0===e?(s=this._updates0List,this._appendIn(s,a)):(s=e<0?this._updatesNegList:this._updatesPosList,this._priorityIn(s,a,e)),this._hashForUpdates[n]=Uu.get(s,a,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,a=r.length;s<a;s++){var o=r[s];if(t===o.getCallback())return o!==n.currentTimer||n.currentTimerSalvaged||(n.currentTimerSalvaged=!0),r.splice(s,1),Hu.put(o),n.timerIndex>=s&&n.timerIndex--,void(0===r.length&&(this._currentTarget===n?this._currentTargetSalvaged=!0:this._removeHashElement(n)))}}}else Z(1510)}},i.unscheduleUpdate=function(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++)Hu.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(Lu.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 a;s=this._updatesNegList.length,null!==(a=n=this._updatesNegList[e])&&void 0!==a&&a.target&&n.priority>=t&&this.unscheduleUpdate(n.target),s===this._updatesNegList.length&&e++}if(t<=0)for(e=0;e<this._updates0List.length;){var o;s=this._updates0List.length,null!==(o=n=this._updates0List[e])&&void 0!==o&&o.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(Lu.Priority.SCHEDULER)},i.pauseAllTargetsWithMinPriority=function(t){var e,i,n,r,s=[],a=this._arrayForTimers;for(i=0,n=a.length;i<n;i++){var o;null!==(o=e=a[i])&&void 0!==o&&o.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 l;null!==(l=r=this._updatesPosList[i])&&void 0!==l&&l.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}Gu.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,a=n.length;s<a;s++)if(n[s]===r){n.splice(s,1);break}delete this._hashForUpdates[e],r&&ku.put(r),Uu.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}(Lu));zu.ID="scheduler",v.Scheduler=zu;var Vu={};rt(Vu,"vmath",[{name:"vec2",newName:"Vec2",target:Yn,targetName:"math"},{name:"vec3",newName:"Vec3",target:Yn,targetName:"math"},{name:"vec4",newName:"Vec4",target:Yn,targetName:"math"},{name:"quat",newName:"Quat",target:Yn,targetName:"math"},{name:"mat3",newName:"Mat3",target:Yn,targetName:"math"},{name:"mat4",newName:"Mat4",target:Yn,targetName:"math"},{name:"color4",newName:"Color",target:Yn,targetName:"math"},{name:"rect",newName:"Rect",target:Yn,targetName:"math"},{name:"approx",newName:"approx",target:Yn,targetName:"math"},{name:"EPSILON",newName:"EPSILON",target:Yn,targetName:"math"},{name:"equals",newName:"equals",target:Yn,targetName:"math"},{name:"clamp",newName:"clamp",target:Yn,targetName:"math"},{name:"clamp01",newName:"clamp01",target:Yn,targetName:"math"},{name:"lerp",newName:"lerp",target:Yn,targetName:"math"},{name:"toRadian",newName:"toRadian",target:Yn,targetName:"math"},{name:"toDegree",newName:"toDegree",target:Yn,targetName:"math"},{name:"random",newName:"random",target:Yn,targetName:"math"},{name:"randomRange",newName:"randomRange",target:Yn,targetName:"math"},{name:"randomRangeInt",newName:"randomRangeInt",target:Yn,targetName:"math"},{name:"pseudoRandom",newName:"pseudoRandom",target:Yn,targetName:"math"},{name:"pseudoRandomRangeInt",newName:"pseudoRandomRangeInt",target:Yn,targetName:"math"},{name:"nextPow2",newName:"nextPow2",target:Yn,targetName:"math"},{name:"repeat",newName:"repeat",target:Yn,targetName:"math"},{name:"pingPong",newName:"pingPong",target:Yn,targetName:"math"},{name:"inverseLerp",newName:"inverseLerp",target:Yn,targetName:"math"}]),v.vmath=Vu,rt(zu.prototype,"Scheduler.prototype",[{name:"enableForTarget",newName:"enableForTarget",target:zu,targetName:"Scheduler"}]),rt(zu,"Scheduler",[{name:"PRIORITY_SYSTEM",newName:"System.Priority.SCHEDULER",customGetter:function(){return Lu.Priority.SCHEDULER}}]),st(zu,"Scheduler",[{name:"PRIORITY_NON_SYSTEM",suggest:"Use enum` System.Priority` instead"}]),mt({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 Wu=he;function Xu(){}var ju=function(){function t(){this.callback=Xu,this.target=void 0,this.once=!1}var e=t.prototype;return e.set=function(t,e,i){this.callback=t||Xu,this.target=e,this.once=!!i},e.reset=function(){this.target=void 0,this.callback=Xu,this.once=!1},e.check=function(){return!(Xa(this.target)&&!ja(this.target,!0))},t}(),Yu=new Pu((function(){return new ju}),32),Ku=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(),Yu.free(i),Wu(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(),Yu.free(i),Wu(this.callbackInfos,e),--e)}},e.cancel=function(t){var e=this.callbackInfos[t];e&&(e.reset(),this.isInvoking?this.callbackInfos[t]=null:Wu(this.callbackInfos,t),Yu.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(),Yu.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]||Wu(this.callbackInfos,t);this.containCanceled=!1},e.clear=function(){this.cancelAll(),this.callbackInfos.length=0,this.isInvoking=!1,this.containCanceled=!1},t}(),qu=new Pu((function(){return new Ku}),16),Qu=t("cY",function(){function t(){this._callbackTable=Ot(!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]=qu.alloc());var s=Yu.alloc();s.set(e,i,n),r.callbackInfos.push(s)}return e},e.hasEventListener=function(t,e,i){var n=this._callbackTable&&this._callbackTable[t];if(!n)return!1;var r=n.callbackInfos;if(!e){if(n.isInvoking){for(var s=0;s<r.length;++s)if(r[s])return!0;return!1}return r.length>0}for(var a=0;a<r.length;++a){var o=r[a];if(o&&o.check()&&o.callback===e&&o.target===i)return!0}return!1},e.removeAll=function(t){var e=typeof t;if("string"===e||"number"===e){var i=this._callbackTable&&this._callbackTable[t];i&&(i.isInvoking?i.cancelAll():(i.clear(),qu.free(i),delete this._callbackTable[t]))}else if(t)for(var n in this._callbackTable){var r=this._callbackTable[n];if(r.isInvoking)for(var s=r.callbackInfos,a=0;a<s.length;++a){var o=s[a];o&&o.target===t&&r.cancel(a)}else r.removeByTarget(t)}},e.off=function(t,e,i){var n,r=this._callbackTable&&this._callbackTable[t];if(r){var s=r.callbackInfos;if(e)for(var a=0;a<s.length;++a){var o=s[a];if(o&&o.callback===e&&o.target===i){r.cancel(a);break}}else this.removeAll(t)}null===(n=this._offCallback)||void 0===n||n.call(this)},e.emit=function(t,e,i,n,r,s){var a=this._callbackTable&&this._callbackTable[t];if(a){var o=!a.isInvoking;a.isInvoking=!0;for(var h=a.callbackInfos,u=0,l=h.length;u<l;++u){var c=h[u];if(c){var _=c.callback,d=c.target;c.once&&this.off(t,_,d),c.check()?d?_.call(d,e,i,n,r,s):_(e,i,n,r,s):this.off(t,_,d)}}o&&(a.isInvoking=!1,a.containCanceled&&a.purgeCanceled())}},e.clear=function(){for(var t in this._callbackTable){var e=this._callbackTable[t];e&&(e.clear(),qu.free(e),delete this._callbackTable[t])}},e._registerOffCallback=function(t){this._offCallback=t},t}());function Zu(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=Ot(!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=Qu.prototype,n=Object.getOwnPropertyNames(i).concat(Object.getOwnPropertySymbols(i)),r=0;r<n.length;++r){var a=n[r];if(!(a in e.prototype)){var o=Object.getOwnPropertyDescriptor(i,a);o&&Object.defineProperty(e.prototype,a,o)}}return e}var Ju=t("b$",Zu((function(){})));v.EventTarget=Ju;var $u,tl,el,il,nl,rl,sl=t("c1",function(){function t(){this._delegates=[]}var e=t.prototype;return e.add=function(t){this._delegates.includes(t)||this._delegates.push(t)},e.hasListener=function(t){return this._delegates.includes(t)},e.remove=function(t){le(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"}($u||($u={})),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"}(tl||(tl={})),function(t){t[t.NONE=0]="NONE",t[t.LAN=1]="LAN",t[t.WWAN=2]="WWAN"}(el||(el={})),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"}(il||(il={})),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"}(nl||(nl={})),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"}(rl||(rl={}));var al=new(function(t){function e(){var e,i,n,r;(r=t.call(this)||this).networkType=void 0,r.isNative=void 0,r.isBrowser=void 0,r.isMobile=void 0,r.isLittleEndian=void 0,r.platform=void 0,r.language=void 0,r.nativeLanguage=void 0,r.os=void 0,r.osVersion=void 0,r.osMainVersion=void 0,r.browserType=void 0,r.browserVersion=void 0,r.isXR=void 0,r._battery=void 0,r._featureMap=void 0,r._initPromise=void 0;var s,a=window.navigator,o=a.userAgent.toLowerCase();null===(e=(i=a).getBattery)||void 0===e||e.call(i).then((function(t){r._battery=t})),r.networkType=el.LAN,r.isNative=!1,r.isBrowser=!0,r.isMobile=/mobile|android|iphone|ipad/.test(o),r.platform=r.isMobile?nl.MOBILE_BROWSER:nl.DESKTOP_BROWSER,r.isLittleEndian=(s=new ArrayBuffer(2),new DataView(s).setInt16(0,256,!0),256===new Int16Array(s)[0]);var h=a.language;r.nativeLanguage=h.toLowerCase(),h=(h=h||a.browserLanguage)?h.split("-")[0]:tl.ENGLISH,r.language=h;var u=!1,l=!1,c="",_=0,d=/android\s*(\d+(?:\.\d+)*)/i.exec(o)||/android\s*(\d+(?:\.\d+)*)/i.exec(a.platform);d&&(u=!0,c=d[1]||"",_=parseInt(c)||0),(d=/(iPad|iPhone|iPod).*OS ((\d+_?){2,3})/i.exec(o))?(l=!0,c=d[2]||"",_=parseInt(c)||0):(/(iPhone|iPad|iPod)/.exec(a.platform)||"MacIntel"===a.platform&&a.maxTouchPoints&&a.maxTouchPoints>1)&&(l=!0,c="",_=0);var f=il.UNKNOWN;-1!==a.appVersion.indexOf("Win")?f=il.WINDOWS:l?f=il.IOS:-1!==a.appVersion.indexOf("Mac")?f=il.OSX:-1!==a.appVersion.indexOf("X11")&&-1===a.appVersion.indexOf("Linux")?f=il.LINUX:u?f=il.ANDROID:-1===a.appVersion.indexOf("Linux")&&-1===o.indexOf("ubuntu")||(f=il.LINUX),r.os=f,r.osVersion=c,r.osMainVersion=_,r.browserType=$u.UNKNOWN;var p=/wechat|weixin|micromessenger/i.exec(o)||/mqqbrowser|micromessenger|qqbrowser|sogou|qzone|liebao|maxthon|ucbs|360 aphone|360browser|baiduboxapp|baidubrowser|maxthon|mxbrowser|miuibrowser/i.exec(o)||/qq|qqbrowser|ucbrowser|ubrowser|edge|HuaweiBrowser/i.exec(o)||/chrome|safari|firefox|trident|opera|opr\/|oupeng/i.exec(o),g=p?p[0].toLowerCase():il.UNKNOWN;("safari"===g&&u||"qq"===g&&/android.*applewebkit/i.test(o))&&(g=$u.ANDROID);var v={micromessenger:$u.WECHAT,wechat:$u.WECHAT,weixin:$u.WECHAT,trident:$u.IE,edge:$u.EDGE,"360 aphone":$u.BROWSER_360,mxbrowser:$u.MAXTHON,"opr/":$u.OPERA,ubrowser:$u.UC,huaweibrowser:$u.HUAWEI};r.browserType=v[g]||g,r.browserVersion="";var y=/(mqqbrowser|micromessenger|qqbrowser|sogou|qzone|liebao|maxthon|uc|ucbs|360 aphone|360|baiduboxapp|baidu|maxthon|mxbrowser|miui(?:.hybrid)?)(mobile)?(browser)?\/?([\d.]+)/i.exec(o);y||(y=/(qq|chrome|safari|firefox|trident|opera|opr\/|oupeng)(mobile)?(browser)?\/?([\d.]+)/i.exec(o)),r.browserVersion=y?y[4]:"",r.isXR=!1;var T,S=document.createElement("canvas");S.getContext("2d");try{T=S.toDataURL("image/webp").startsWith("data:image/webp")}catch(t){T=!1}if(r.browserType===$u.SAFARI){var E,A=null===(E=/ version\/(\d+)/.exec(o))||void 0===E?void 0:E[1];"string"==typeof A&&Number.parseInt(A)>=14&&(T=!0)}var R=void 0!==document.documentElement.ontouchstart||void 0!==document.ontouchstart||m,b=void 0!==document.documentElement.onmouseup||m,C=void 0!==navigator.xr,w=function(){if((r.os===il.IOS||r.os===il.OSX)&&/(OS 15_4)|(Version\/15.4)/.test(window.navigator.userAgent))return!1;try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){var t=new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0]));if(t instanceof WebAssembly.Module)return new WebAssembly.Instance(t)instanceof WebAssembly.Instance}}catch(t){return!1}return!1}();return r._featureMap=((n={})[rl.WEBP]=T,n[rl.IMAGE_BITMAP]=!1,n[rl.WEB_VIEW]=!0,n[rl.VIDEO_PLAYER]=!0,n[rl.SAFE_AREA]=!1,n[rl.HPE]=!1,n[rl.INPUT_TOUCH]=R,n[rl.EVENT_KEYBOARD]=void 0!==document.documentElement.onkeyup||m,n[rl.EVENT_MOUSE]=b,n[rl.EVENT_TOUCH]=R||b,n[rl.EVENT_ACCELEROMETER]=void 0!==window.DeviceMotionEvent||void 0!==window.DeviceOrientationEvent,n[rl.EVENT_GAMEPAD]=void 0!==navigator.getGamepads||void 0!==navigator.webkitGetGamepads||C,n[rl.EVENT_HANDLE]=false,n[rl.EVENT_HMD]=C,n[rl.EVENT_HANDHELD]=C,n[rl.WASM]=w,n),r._initPromise=[],r._initPromise.push(r._supportsImageBitmapPromise()),r._registerEvent(),r}s(e,t);var i=e.prototype;return i._supportsImageBitmapPromise=function(){var t=this;if("undefined"!=typeof createImageBitmap&&"undefined"!=typeof Blob){var e=document.createElement("canvas");e.width=e.height=2;var i=createImageBitmap(e,{});if(i instanceof Promise)return i.then((function(e){t._setFeature(rl.IMAGE_BITMAP,!0),null==e||e.close()}))}return Promise.resolve()},i._registerEvent=function(){var t,e=this;t=void 0!==document.hidden?"hidden":void 0!==document.mozHidden?"mozHidden":void 0!==document.msHidden?"msHidden":void 0!==document.webkitHidden?"webkitHidden":"hidden";var i=!1,n=function(){i||(i=!0,e.emit("hide"))},r=function(t,n,r,s,a){i&&(i=!1,e.emit("show",t,n,r,s,a))};if(t)for(var s=["visibilitychange","mozvisibilitychange","msvisibilitychange","webkitvisibilitychange","qbrowserVisibilityChange"],a=0;a<s.length;a++)document.addEventListener(s[a],(function(e){var i=document[t];(i=i||e.hidden)?n():r()}));else window.addEventListener("blur",n),window.addEventListener("focus",r);window.navigator.userAgent.indexOf("MicroMessenger")>-1&&(window.onfocus=r),"onpageshow"in window&&"onpagehide"in window&&(window.addEventListener("pagehide",n),window.addEventListener("pageshow",r),document.addEventListener("pagehide",n),document.addEventListener("pageshow",r))},i._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 this._battery?this._battery.level:1},i.triggerGC=function(){},i.openURL=function(t){window.open(t)},i.now=function(){return Date.now?Date.now():+new Date},i.restartJSVM=function(){},i.exit=function(){window.close()},i.close=function(){this.emit("close")},e}(Ju)),ol=/(\.[^\.\/\?\\]*)(\?.*)?$/,hl=/((.*)(\/|\\|\\\\))?(.*?\..*$)?/,ul=/[^\.\/]+\/\.\.\//;function ll(){for(var t="",e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];for(var r=0,s=i;r<s.length;r++){var a=s[r];t=(t+(""===t?"":"/")+a).replace(/(\/|\\\\)$/,"")}return t}function cl(t){var e=ol.exec(t);return e?e[1]:""}function _l(t){if(t){var e=t.lastIndexOf(".");if(-1!==e)return t.substring(0,e)}return t}function dl(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 fl(t){var e=hl.exec(t);return e?e[2]:""}function pl(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 ml(t,e,i){if(0===e.indexOf("."))return pl(t,e);var n=t.indexOf("?"),r="",s=i?cl(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 gl(t){var e=t=String(t);do{e=t,t=t.replace(ul,"")}while(e.length!==t.length);return t}function vl(t){return t.replace(/[\/\\]$/,"")}function yl(){return al.os===il.WINDOWS?"\\":"/"}t("bC",Object.freeze({__proto__:null,join:ll,extname:cl,mainFileName:_l,basename:dl,dirname:fl,changeExtname:pl,changeBasename:ml,_normalize:gl,stripSep:vl,getSeperator:yl}));var Tl=new hn;function Sl(t,e,i,n){n||(n=new hn),t.convertToUINode(e,i,n);var r=i.position;return n.add(r),n}function El(t,e,i){return i||(i=new hn),t.worldToScreen(e,i),i.x/=v.view.getScaleX(),i.y/=v.view.getScaleY(),i}var Al,Rl=t("bM",{WorldNode3DToLocalNodeUI:Sl,WorldNode3DToWorldNodeUI:El});v.pipelineUtils=Rl,rt(v.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]||Tl;return n.convertToUINode(e[1],e[2],r),r.add(e[2].position),e[3]||r.clone()}}]),at(pe,"js",[{name:"js",suggest:"'js.js' is deprecated since v3.7.0, please access 'js' directly instead."}]),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"}(Al||(Al={}));var bl,Cl={auto:Al.AUTO,landscape:Al.LANDSCAPE,portrait:Al.PORTRAIT};!function(t){t[t.Unknown=0]="Unknown",t[t.SubFrame=1]="SubFrame",t[t.BrowserWindow=2]="BrowserWindow",t[t.Fullscreen=3]="Fullscreen"}(bl||(bl={}));var wl=new(function(t){function e(){var e,i,n,r,s,a;(e=t.call(this)||this).isFrameRotated=!1,e.handleResizeEvent=!0,e._gameFrame=void 0,e._gameContainer=void 0,e._gameCanvas=void 0,e._isProportionalToFrame=!1,e._cachedFrameStyle={width:"0px",height:"0px"},e._cachedContainerStyle={width:"0px",height:"0px"},e._cbToUpdateFrameBuffer=void 0,e._supportFullScreen=!1,e._touchEventName=void 0,e._onFullscreenChange=void 0,e._onFullscreenError=void 0,e._orientationChangeTimeoutId=-1,e._cachedFrameSize=new Hn(0,0),e._exactFitScreen=!1,e._isHeadlessMode=!1,e._fn={},e._fnGroup=[["requestFullscreen","exitFullscreen","fullscreenchange","fullscreenEnabled","fullscreenElement","fullscreenerror"],["requestFullScreen","exitFullScreen","fullScreenchange","fullScreenEnabled","fullScreenElement","fullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitfullscreenchange","webkitIsFullScreen","webkitCurrentFullScreenElement","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozfullscreenchange","mozFullScreen","mozFullScreenElement","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","MSFullscreenChange","msFullscreenEnabled","msFullscreenElement","msfullscreenerror"]],e._resolutionScale=1,e._orientation=Al.AUTO,e._gameFrame=document.getElementById("GameDiv"),e._gameContainer=document.getElementById("Cocos3dGameContainer"),e._gameCanvas=document.getElementById("GameCanvas"),e._gameFrame||(e._gameFrame=document.createElement("div"),e._gameFrame.setAttribute("id","GameDiv"),null===(i=e._gameCanvas)||void 0===i||null===(n=i.parentNode)||void 0===n||n.insertBefore(e._gameFrame,e._gameCanvas),e._gameFrame.appendChild(e._gameCanvas)),e._gameContainer||(e._gameContainer=document.createElement("div"),e._gameContainer.setAttribute("id","Cocos3dGameContainer"),null===(r=e._gameCanvas)||void 0===r||null===(s=r.parentNode)||void 0===s||s.insertBefore(e._gameContainer,e._gameCanvas),e._gameContainer.appendChild(e._gameCanvas));for(var o=e._fnGroup,h=0;h<o.length;h++)if(a=o[h],void 0!==document[a[1]]){for(var u=0;u<a.length;u++)e._fn[o[0][u]]=a[u];break}return e._supportFullScreen=void 0!==e._fn.requestFullscreen,e._touchEventName="ontouchstart"in window?"touchend":"mousedown",e._registerEvent(),e}s(e,t);var i=e.prototype;return i.init=function(t,e){this._cbToUpdateFrameBuffer=e,this.orientation=Cl[t.configOrientation],this._exactFitScreen=t.exactFitScreen,this._isHeadlessMode=t.isHeadlessMode,this._resizeFrame()},i.requestFullScreen=function(){var t=this;return new Promise((function(e,i){t.isFullScreen?e():(t._cachedFrameSize=t.windowSize,t._doRequestFullScreen().then((function(){e()})).catch((function(){var n=t._getFullscreenTarget();n?n.addEventListener(t._touchEventName,(function(){t._doRequestFullScreen().then((function(){e()})).catch(i)}),{once:!0,capture:!0}):i(new Error("Cannot access fullscreen target"))})))}))},i.exitFullScreen=function(){var t=this;return new Promise((function(e,i){var n=document[t._fn.exitFullscreen]();window.Promise&&n instanceof Promise?n.then((function(){t.windowSize=t._cachedFrameSize,e()})).catch(i):(t.windowSize=t._cachedFrameSize,e())}))},i._registerEvent=function(){var t=this;document.addEventListener(this._fn.fullscreenerror,(function(){var e;null===(e=t._onFullscreenError)||void 0===e||e.call(t)})),window.addEventListener("resize",(function(){t.handleResizeEvent&&t._resizeFrame()})),"function"==typeof window.matchMedia&&function e(){var i,n,r=window.devicePixelRatio;null===(i=window.matchMedia("(resolution: "+r+"dppx)"))||void 0===i||null===(n=i.addEventListener)||void 0===n||n.call(i,"change",(function(){t.emit("window-resize",t.windowSize.width,t.windowSize.height),e()}),{once:!0})}(),window.addEventListener("orientationchange",(function(){-1!==t._orientationChangeTimeoutId&&clearTimeout(t._orientationChangeTimeoutId),t._orientationChangeTimeoutId=setTimeout((function(){t.handleResizeEvent&&(t._updateFrameState(),t._resizeFrame(),t.emit("orientation-change",t.windowSize.width,t.windowSize.height),t._orientationChangeTimeoutId=-1)}),200)})),document.addEventListener(this._fn.fullscreenchange,(function(){var e;null===(e=t._onFullscreenChange)||void 0===e||e.call(t),t.emit("fullscreen-change",t.windowSize.width,t.windowSize.height)}))},i._convertToSizeInCssPixels=function(t){var e=t.clone(),i=this.devicePixelRatio;return e.width/=i,e.height/=i,e},i._resizeFrame=function(t){if(this._gameFrame){if(this._gameFrame.style.display="flex",this._gameFrame.style["justify-content"]="center",this._gameFrame.style["align-items"]="center",this._windowType===bl.SubFrame){if(!t)return void this._updateContainer();this._gameFrame.style.width=t.width+"px",this._gameFrame.style.height=t.height+"px"}else{var e=window.innerWidth,i=window.innerHeight;this.isFrameRotated?(this._gameFrame.style["-webkit-transform"]="rotate(90deg)",this._gameFrame.style.transform="rotate(90deg)",this._gameFrame.style["-webkit-transform-origin"]="0px 0px 0px",this._gameFrame.style.transformOrigin="0px 0px 0px",this._gameFrame.style.margin="0 0 0 "+e+"px",this._gameFrame.style.width=i+"px",this._gameFrame.style.height=e+"px"):(this._gameFrame.style["-webkit-transform"]="rotate(0deg)",this._gameFrame.style.transform="rotate(0deg)",this._gameFrame.style.margin="0px auto",this._gameFrame.style.width=e+"px",this._gameFrame.style.height=i+"px")}this._updateContainer()}},i._getFullscreenTarget=function(){var t=this._windowType;return t===bl.Fullscreen?document[this._fn.fullscreenElement]:t===bl.SubFrame?this._gameFrame:document.body},i._doRequestFullScreen=function(){var t=this;return new Promise((function(e,i){if(t._supportFullScreen){var n=t._getFullscreenTarget();if(n){t._onFullscreenChange=void 0,t._onFullscreenError=void 0;var r=n[t._fn.requestFullscreen]();window.Promise&&r instanceof Promise?r.then(e).catch(i):(t._onFullscreenChange=e,t._onFullscreenError=i)}else i(new Error("Cannot access fullscreen target"))}else i(new Error("fullscreen is not supported"))}))},i._updateFrameState=function(){var t=this.orientation,e=window.innerWidth>window.innerHeight;this.isFrameRotated=al.isMobile&&(e&&t===Al.PORTRAIT||!e&&t===Al.LANDSCAPE)},i._updateContainer=function(){if(this._gameContainer){if(this.isProportionalToFrame){if(!this._gameFrame)return void q(9201);var t,e,i=v.view.getDesignResolutionSize(),n=this._gameFrame,r=n.clientWidth,s=n.clientHeight,a=i.width,o=i.height,h=r/a,u=s/o,l=this._gameContainer.style;h<u?(t=r,e=o*h):(t=a*u,e=s),l.width=t+"px",l.height=e+"px"}else{var c=this._gameContainer.style;c.width="100%",c.height="100%"}!this._gameFrame||this._cachedFrameStyle.width===this._gameFrame.style.width&&this._cachedFrameStyle.height===this._gameFrame.style.height&&this._cachedContainerStyle.width===this._gameContainer.style.width&&this._cachedContainerStyle.height===this._gameContainer.style.height||(this.emit("window-resize",this.windowSize.width,this.windowSize.height),this._cachedFrameStyle.width=this._gameFrame.style.width,this._cachedFrameStyle.height=this._gameFrame.style.height,this._cachedContainerStyle.width=this._gameContainer.style.width,this._cachedContainerStyle.height=this._gameContainer.style.height)}else q(9201)},n(e,[{key:"supportFullScreen",get:function(){return this._supportFullScreen}},{key:"isFullScreen",get:function(){return!!this._supportFullScreen&&!!document[this._fn.fullscreenElement]}},{key:"devicePixelRatio",get:function(){var t;return Math.min(null!==(t=window.devicePixelRatio)&&void 0!==t?t:1,2)}},{key:"windowSize",get:function(){var t=this._windowSizeInCssPixels,e=this.devicePixelRatio;return t.width*=e,t.height*=e,t},set:function(t){this._windowType===bl.SubFrame?this._resizeFrame(this._convertToSizeInCssPixels(t)):q(9202)}},{key:"resolution",get:function(){var t=this.windowSize,e=this.resolutionScale;return new Hn(t.width*e,t.height*e)}},{key:"resolutionScale",get:function(){return this._resolutionScale},set:function(t){var e;t!==this._resolutionScale&&(this._resolutionScale=t,null===(e=this._cbToUpdateFrameBuffer)||void 0===e||e.call(this))}},{key:"orientation",get:function(){return this._orientation},set:function(t){this._orientation!==t&&(this._orientation=t,this._updateFrameState())}},{key:"safeAreaEdge",get:function(){var t=this.devicePixelRatio;return{top:parseInt(getComputedStyle(document.documentElement).getPropertyValue("--safe-top")||"0")*t,bottom:parseInt(getComputedStyle(document.documentElement).getPropertyValue("--safe-bottom")||"0")*t,left:parseInt(getComputedStyle(document.documentElement).getPropertyValue("--safe-left")||"0")*t,right:parseInt(getComputedStyle(document.documentElement).getPropertyValue("--safe-right")||"0")*t}}},{key:"isProportionalToFrame",get:function(){return this._isProportionalToFrame},set:function(t){this._isProportionalToFrame!==t&&(this._isProportionalToFrame=t,this._updateContainer())}},{key:"_windowSizeInCssPixels",get:function(){if(this.isProportionalToFrame)return this._gameContainer?new Hn(this._gameContainer.clientWidth,this._gameContainer.clientHeight):(q(9201),new Hn(0,0));var t,e,i;switch(this._windowType){case bl.SubFrame:return this._gameFrame?new Hn(this._gameFrame.clientWidth,this._gameFrame.clientHeight):(q(9201),new Hn(0,0));case bl.Fullscreen:return t=this._getFullscreenTarget(),e=this.isFrameRotated?t.clientHeight:t.clientWidth,i=this.isFrameRotated?t.clientWidth:t.clientHeight,new Hn(e,i);case bl.BrowserWindow:return e=this.isFrameRotated?window.innerHeight:window.innerWidth,i=this.isFrameRotated?window.innerWidth:window.innerHeight,new Hn(e,i);case bl.Unknown:default:return new Hn(0,0)}}},{key:"_windowType",get:function(){return this._isHeadlessMode?bl.Unknown:this.isFullScreen?bl.Fullscreen:this._gameFrame?this._exactFitScreen?bl.BrowserWindow:bl.SubFrame:(q(9201),bl.Unknown)}}]),e}(Ju)),xl=function(){function t(){}var e=t.prototype;return e.init=function(){var t,e,i=null===(t=be.querySettings(Re.Category.SCREEN,"exactFitScreen"))||void 0===t||t,n=null!==(e=be.querySettings(Re.Category.SCREEN,"orientation"))&&void 0!==e?e:"auto",r=3===be.querySettings(Re.Category.RENDERING,"renderMode");wl.init({exactFitScreen:i,configOrientation:n,isHeadlessMode:r},(function(){var t,e=v.director;null!==(t=e.root)&&void 0!==t&&t.pipeline?e.root.pipeline.shadingScale=wl.resolutionScale:q(1220)}))},e.fullScreen=function(){return wl.isFullScreen},e.requestFullScreen=function(t,e,i){return arguments.length>0&&q(1400,"screen.requestFullScreen(element, onFullScreenChange?, onFullScreenError?)","screen.requestFullScreen(): Promise"),wl.requestFullScreen().then((function(){null==e||e.call(document)})).catch((function(t){G(t),null==i||i.call(document)}))},e.exitFullScreen=function(){return wl.exitFullScreen()},e.autoFullScreen=function(t,e){var i;null===(i=this.requestFullScreen(t,e))||void 0===i||i.catch((function(t){U(t)}))},e.disableAutoFullScreen=function(){},e.on=function(t,e,i){wl.on(t,e,i)},e.once=function(t,e,i){wl.once(t,e,i)},e.off=function(t,e,i){wl.off(t,e,i)},n(t,[{key:"devicePixelRatio",get:function(){return wl.devicePixelRatio}},{key:"windowSize",get:function(){return wl.windowSize},set:function(t){wl.windowSize=t}},{key:"resolution",get:function(){return wl.resolution}},{key:"supportsFullScreen",get:function(){return wl.supportFullScreen}}]),t}(),Il=t("cf",new xl);v.screen=Il;var Ol=t("cg",{Feature:rl,hasFeature:function(t){return al.hasFeature(t)},NetworkType:el,Language:tl,OS:il,Platform:nl,BrowserType:$u,isNative:al.isNative,isBrowser:al.isBrowser,isMobile:al.isMobile,isLittleEndian:al.isLittleEndian,platform:al.platform,language:al.language,languageCode:al.nativeLanguage,os:al.os,osVersion:al.osVersion,osMainVersion:al.osMainVersion,browserType:al.browserType,browserVersion:al.browserVersion,isXR:al.isXR,windowPixelResolution:Il.windowSize,capabilities:{canvas:!0,opengl:!0,webp:al.hasFeature(rl.WEBP),imageBitmap:al.hasFeature(rl.IMAGE_BITMAP),touches:al.hasFeature(rl.INPUT_TOUCH),mouse:al.hasFeature(rl.EVENT_MOUSE),keyboard:al.hasFeature(rl.EVENT_KEYBOARD),accelerometer:al.hasFeature(rl.EVENT_ACCELEROMETER)},localStorage:{},getNetworkType:function(){return al.networkType},getBatteryLevel:function(){return al.getBatteryLevel()},garbageCollect:function(){al.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: "+Ol.hasFeature(rl.WEBP)+"\r\n",t+="supports bitmap: "+Ol.hasFeature(rl.IMAGE_BITMAP)+"\r\n",t+="supports touches: "+Ol.hasFeature(rl.INPUT_TOUCH)+"\r\n",t+="supports mouse: "+Ol.hasFeature(rl.EVENT_MOUSE)+"\r\n",t+="supports keyboard: "+Ol.hasFeature(rl.EVENT_KEYBOARD)+"\r\n",t+="supports accelerometer: "+Ol.hasFeature(rl.EVENT_ACCELEROMETER)+"\r\n",t+="os : "+this.os+"\r\n",t+="osVersion : "+this.osVersion+"\r\n",t+="platform : "+this.platform+"\r\n",k(t+="Using "+(v.game.renderType===v.game.RENDER_TYPE_WEBGL?"WEBGL":"CANVAS")+" renderer.\r\n")},openURL:function(t){al.openURL(t)},init:function(){var t=this;return Promise.resolve().then((function(){return al.init()})).then((function(){try{var e=Ol.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}}t.__isWebIOS14OrIPadOS14Env=(Ol.os===il.IOS||Ol.os===il.OSX)&&al.isBrowser&&/(OS 14)|(Version\/14)/.test(window.navigator.userAgent)}))},now:function(){return al.now()},restartVM:function(){al.restartJSVM()},getSafeAreaRect:function(){var t=v.view,e=wl.safeAreaEdge,i=wl.windowSize,n=new Fn(e.left,e.bottom),r=new Fn(i.width-e.right,i.height-e.top);t._convertToUISpace(n),t._convertToUISpace(r);var s=n.x,a=n.y,o=r.x-n.x,h=r.y-n.y;return new Vn(s,a,o,h)}});v.sys=Ol,at(v,"cc",[{name:"winSize",suggest:"please use view.getVisibleSize() instead."}]),at(Ol,"sys",[{name:"capabilities",suggest:"please use sys.hasFeature() method instead."}]),rt(Ol,"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:Ol.Language,targetName:"sys.Language"}}))),rt(Ol,"sys",["UNKNOWN","IOS","ANDROID","WINDOWS","LINUX","OSX"].map((function(t){return{name:"OS_"+t,newName:t,target:Ol.OS,targetName:"sys.OS"}}))),rt(Ol,"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:Ol.BrowserType,targetName:"sys.BrowserType"}}))),rt(Ol,"sys",[{name:"BROWSER_TYPE_360",newName:"BROWSER_360",target:Ol.BrowserType,targetName:"sys.BrowserType"}]),rt(Ol,"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:Ol.Platform,targetName:"sys.Platform"}}))),rt(Ol,"sys",[{name:"IPHONE",newName:"IOS",target:Ol.Platform,targetName:"sys.Platform"},{name:"IPAD",newName:"IOS",target:Ol.Platform,targetName:"sys.Platform"}]),st(Ol,"sys",["LINUX","BLACKBERRY","NACL","EMSCRIPTEN","TIZEN","WINRT","WP8","QQ_PLAY","FB_PLAYABLE_ADS"].map((function(t){return{name:t}}))),rt(Ol,"sys",[{name:"windowPixelResolution",target:Il,targetName:"screen",newName:"windowSize"}]),at(Il,"screen",[{name:"autoFullScreen",suggest:"please use screen.requestFullScreen() instead."},{name:"disableAutoFullScreen"}]);var Dl=t("ci",{topLeft:v.v2(0,0),topRight:v.v2(0,0),top:v.v2(0,0),bottomLeft:v.v2(0,0),bottomRight:v.v2(0,0),bottom:v.v2(0,0),center:v.v2(0,0),left:v.v2(0,0),right:v.v2(0,0),width:0,height:0,init:function(t){var e=this.width=t.width,i=this.height=t.height,n=t.x,r=t.y,s=r+i,a=n+e;this.topLeft.x=n,this.topLeft.y=s,this.topRight.x=a,this.topRight.y=s,this.top.x=n+e/2,this.top.y=s,this.bottomLeft.x=n,this.bottomLeft.y=r,this.bottomRight.x=a,this.bottomRight.y=r,this.bottom.x=n+e/2,this.bottom.y=r,this.center.x=n+e/2,this.center.y=r+i/2,this.left.x=n,this.left.y=r+i/2,this.right.x=a,this.right.y=r+i/2}});v.visibleRect=Dl;var Ml=String.prototype.charCodeAt;function Pl(t){return this[t]}function Bl(t,e){for(var i=t.length,n=e^i,r=0,s="string"==typeof t?Ml:Pl;i>=4;){var a=255&s.call(t,r)|(255&s.call(t,++r))<<8|(255&s.call(t,++r))<<16|(255&s.call(t,++r))<<24;a=1540483477*(65535&a)+((1540483477*(a>>>16)&65535)<<16),n=1540483477*(65535&n)+((1540483477*(n>>>16)&65535)<<16)^(a=1540483477*(65535&(a^=a>>>24))+((1540483477*(a>>>16)&65535)<<16)),i-=4,++r}switch(i){case 3:n^=(255&s.call(t,r+2))<<16;case 2:n^=(255&s.call(t,r+1))<<8;case 1:n=1540483477*(65535&(n^=255&s.call(t,r)))+((1540483477*(n>>>16)&65535)<<16)}return n=1540483477*(65535&(n^=n>>>13))+((1540483477*(n>>>16)&65535)<<16),(n^=n>>>15)>>>0}function Nl(){}v.easing=Yo,Nl.prototype.once=function(t,e,i){return this.on(t,e,i,!0)},Nl.prototype.targetOff=function(t){this.removeAll(t)},t("cB",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:Nl}));var Ll=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}(),Fl=t("cP",new Ll),kl=t("cQ",function(){function t(){return Fl.registerGCObject(this)}return t.prototype.destroy=function(){},t}());function Ul(t,e){for(var i,n=d(e);!(i=n()).done;){var r=i.value;Array.isArray(r)?Ul(t,r):t.push(r)}}function Gl(t){var e=[];return Ul(e,t),e.join("")}v.math=Yn,v.geometry=Ou;var Hl,zl,Vl,Wl,Xl,jl,Yl,Kl,ql,Ql,Zl,Jl,$l,tc,ec,ic,nc,rc,sc,ac,oc,hc,uc,lc,cc,_c,dc,fc,pc,mc,gc,vc,yc,Tc,Sc,Ec,Ac,Rc,bc,Cc,wc,xc,Ic,Oc,Dc=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"}(Hl||(Hl={})),function(t){t[t.UNREADY=0]="UNREADY",t[t.FAILED=1]="FAILED",t[t.SUCCESS=2]="SUCCESS"}(zl||(zl={})),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"}(Vl||(Vl={})),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"}(Wl||(Wl={})),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"}(Xl||(Xl={})),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"}(jl||(jl={})),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"}(Yl||(Yl={})),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"}(Kl||(Kl={})),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"}(ql||(ql={})),function(t){t[t.NONE=0]="NONE"}(Ql||(Ql={})),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"}(Zl||(Zl={})),function(t){t[t.NONE=0]="NONE",t[t.DEVICE=1]="DEVICE",t[t.HOST=2]="HOST"}(Jl||(Jl={})),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"}($l||($l={})),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"}(tc||(tc={})),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"}(ec||(ec={})),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"}(ic||(ic={})),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"}(nc||(nc={})),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"}(rc||(rc={})),function(t){t[t.NONE=0]="NONE",t[t.POINT=1]="POINT",t[t.LINEAR=2]="LINEAR",t[t.ANISOTROPIC=3]="ANISOTROPIC"}(sc||(sc={})),function(t){t[t.WRAP=0]="WRAP",t[t.MIRROR=1]="MIRROR",t[t.CLAMP=2]="CLAMP",t[t.BORDER=3]="BORDER"}(ac||(ac={})),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"}(oc||(oc={})),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"}(hc||(hc={})),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"}(uc||(uc={})),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"}(lc||(lc={})),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"}(cc||(cc={})),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"}(_c||(_c={})),function(t){t[t.LOAD=0]="LOAD",t[t.CLEAR=1]="CLEAR",t[t.DISCARD=2]="DISCARD"}(dc||(dc={})),function(t){t[t.STORE=0]="STORE",t[t.DISCARD=1]="DISCARD"}(fc||(fc={})),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"}(pc||(pc={})),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"}(mc||(mc={})),function(t){t[t.GRAPHICS=0]="GRAPHICS",t[t.COMPUTE=1]="COMPUTE",t[t.RAY_TRACING=2]="RAY_TRACING"}(gc||(gc={})),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"}(vc||(vc={})),function(t){t[t.FILL=0]="FILL",t[t.POINT=1]="POINT",t[t.LINE=2]="LINE"}(yc||(yc={})),function(t){t[t.GOURAND=0]="GOURAND",t[t.FLAT=1]="FLAT"}(Tc||(Tc={})),function(t){t[t.NONE=0]="NONE",t[t.FRONT=1]="FRONT",t[t.BACK=2]="BACK"}(Sc||(Sc={})),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"}(Ec||(Ec={})),function(t){t[t.FRONT=1]="FRONT",t[t.BACK=2]="BACK",t[t.ALL=3]="ALL"}(Ac||(Ac={})),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"}(Rc||(Rc={})),function(t){t[t.GRAPHICS=0]="GRAPHICS",t[t.COMPUTE=1]="COMPUTE",t[t.TRANSFER=2]="TRANSFER"}(bc||(bc={})),function(t){t[t.OCCLUSION=0]="OCCLUSION",t[t.PIPELINE_STATISTICS=1]="PIPELINE_STATISTICS",t[t.TIMESTAMP=2]="TIMESTAMP"}(Cc||(Cc={})),function(t){t[t.PRIMARY=0]="PRIMARY",t[t.SECONDARY=1]="SECONDARY"}(wc||(wc={})),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"}(xc||(xc={})),function(t){t[t.FULL=0]="FULL",t[t.SPLIT_BEGIN=1]="SPLIT_BEGIN",t[t.SPLIT_END=2]="SPLIT_END"}(Ic||(Ic={})),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"}(Oc||(Oc={}));var Mc,Pc=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}(),Bc=function(){function t(t,e,i,n,r,s,a,o,h,u,l,c,_,d,f,p,m,g,v,y,T,S,E,A){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=0),void 0===o&&(o=0),void 0===h&&(h=0),void 0===u&&(u=0),void 0===l&&(l=0),void 0===c&&(c=0),void 0===_&&(_=0),void 0===d&&(d=0),void 0===f&&(f=0),void 0===p&&(p=1),void 0===m&&(m=0),void 0===g&&(g=0),void 0===v&&(v=new Pc),void 0===y&&(y=new Pc),void 0===T&&(T=!1),void 0===S&&(S=-1),void 0===E&&(E=1),void 0===A&&(A=1),this.maxVertexAttributes=t,this.maxVertexUniformVectors=e,this.maxFragmentUniformVectors=i,this.maxTextureUnits=n,this.maxImageUnits=r,this.maxVertexTextureUnits=s,this.maxColorRenderTargets=a,this.maxShaderStorageBufferBindings=o,this.maxShaderStorageBlockSize=h,this.maxUniformBufferBindings=u,this.maxUniformBlockSize=l,this.maxTextureSize=c,this.maxCubeMapTextureSize=_,this.maxArrayTextureLayers=d,this.max3DTextureSize=f,this.uboOffsetAlignment=p,this.maxComputeSharedMemorySize=m,this.maxComputeWorkGroupInvocations=g,this.maxComputeWorkGroupSize=v,this.maxComputeWorkGroupCount=y,this.supportQuery=T,this.clipSpaceMinZ=S,this.screenSpaceSignY=E,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}(),Nc=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}(),Lc=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}(),Fc=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}(),kc=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}(),Uc=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}(),Gc=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}(),Hc=function(){function t(t,e,i,n,r){void 0===t&&(t=new Uc),void 0===e&&(e=new Lc),void 0===i&&(i=new Uc),void 0===n&&(n=new Lc),void 0===r&&(r=new kc),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}(),zc=function(){function t(t,e,i,n,r,s){void 0===t&&(t=new Uc),void 0===e&&(e=new Lc),void 0===i&&(i=new kc),void 0===n&&(n=new Uc),void 0===r&&(r=new Lc),void 0===s&&(s=new kc),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}(),Vc=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 Lc),void 0===r&&(r=new kc),void 0===s&&(s=new Uc),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}(),Wc=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}(),Xc=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}(),jc=function(){function t(t,e,i,n,r,s,a,o){void 0===t&&(t=[0]),void 0===e&&(e=[0]),void 0===i&&(i=[0]),void 0===n&&(n=[0]),void 0===r&&(r=[0]),void 0===s&&(s=[0]),void 0===a&&(a=[0]),void 0===o&&(o=[0]),this.maxBlockCounts=t,this.maxSamplerTextureCounts=e,this.maxSamplerCounts=i,this.maxTextureCounts=n,this.maxBufferCounts=r,this.maxImageCounts=s,this.maxSubpassInputCounts=a,this.setIndices=o}return t.prototype.copy=function(t){return this.maxBlockCounts=t.maxBlockCounts.slice(),this.maxSamplerTextureCounts=t.maxSamplerTextureCounts.slice(),this.maxSamplerCounts=t.maxSamplerCounts.slice(),this.maxTextureCounts=t.maxTextureCounts.slice(),this.maxBufferCounts=t.maxBufferCounts.slice(),this.maxImageCounts=t.maxImageCounts.slice(),this.maxSubpassInputCounts=t.maxSubpassInputCounts.slice(),this.setIndices=t.setIndices.slice(),this},t}(),Yc=function(){function t(t,e,i,n,r){void 0===t&&(t=0),void 0===e&&(e=null),void 0===i&&(i=rc.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}(),Kc=function(){function t(t){void 0===t&&(t=new jc),this.bindingMappingInfo=t}return t.prototype.copy=function(t){return this.bindingMappingInfo.copy(t.bindingMappingInfo),this},t}(),qc=function(){function t(t,e,i,n,r){void 0===t&&(t=ql.NONE),void 0===e&&(e=Jl.NONE),void 0===i&&(i=0),void 0===n&&(n=1),void 0===r&&(r=Ql.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}(),Qc=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}(),Zc=function(){function t(t,e,i,n,r,s,a){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=0),this.vertexCount=t,this.firstVertex=e,this.indexCount=i,this.firstIndex=n,this.vertexOffset=r,this.instanceCount=s,this.firstInstance=a}return t.prototype.copy=function(t){return this.vertexCount=t.vertexCount,this.firstVertex=t.firstVertex,this.indexCount=t.indexCount,this.firstIndex=t.firstIndex,this.vertexOffset=t.vertexOffset,this.instanceCount=t.instanceCount,this.firstInstance=t.firstInstance,this},t}(),Jc=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}(),$c=function(){function t(t){void 0===t&&(t=[]),this.drawInfos=t}return t.prototype.copy=function(t){return Dc(this.drawInfos,t.drawInfos,Zc),this},t}(),t_=function(){function t(t,e,i,n,r,s,a,o,h,u,l){void 0===t&&(t=$l.TEX2D),void 0===e&&(e=tc.NONE),void 0===i&&(i=jl.UNKNOWN),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=ec.NONE),void 0===a&&(a=1),void 0===o&&(o=1),void 0===h&&(h=nc.X1),void 0===u&&(u=1),void 0===l&&(l=0),this.type=t,this.usage=e,this.format=i,this.width=n,this.height=r,this.flags=s,this.layerCount=a,this.levelCount=o,this.samples=h,this.depth=u,this.externalRes=l}return t.prototype.copy=function(t){return this.type=t.type,this.usage=t.usage,this.format=t.format,this.width=t.width,this.height=t.height,this.flags=t.flags,this.layerCount=t.layerCount,this.levelCount=t.levelCount,this.samples=t.samples,this.depth=t.depth,this.externalRes=t.externalRes,this},t}(),e_=function(){function t(t,e,i,n,r,s,a){void 0===t&&(t=null),void 0===e&&(e=$l.TEX2D),void 0===i&&(i=jl.UNKNOWN),void 0===n&&(n=0),void 0===r&&(r=1),void 0===s&&(s=0),void 0===a&&(a=1),this.texture=t,this.type=e,this.format=i,this.baseLevel=n,this.levelCount=r,this.baseLayer=s,this.layerCount=a}return t.prototype.copy=function(t){return this.texture=t.texture,this.type=t.type,this.format=t.format,this.baseLevel=t.baseLevel,this.levelCount=t.levelCount,this.baseLayer=t.baseLayer,this.layerCount=t.layerCount,this},t}(),i_=function(){function t(t,e,i,n,r,s,a,o){void 0===t&&(t=sc.LINEAR),void 0===e&&(e=sc.LINEAR),void 0===i&&(i=sc.NONE),void 0===n&&(n=ac.WRAP),void 0===r&&(r=ac.WRAP),void 0===s&&(s=ac.WRAP),void 0===a&&(a=0),void 0===o&&(o=oc.ALWAYS),this.minFilter=t,this.magFilter=e,this.mipFilter=i,this.addressU=n,this.addressV=r,this.addressW=s,this.maxAnisotropy=a,this.cmpFunc=o}return t.prototype.copy=function(t){return this.minFilter=t.minFilter,this.magFilter=t.magFilter,this.mipFilter=t.mipFilter,this.addressU=t.addressU,this.addressV=t.addressV,this.addressW=t.addressW,this.maxAnisotropy=t.maxAnisotropy,this.cmpFunc=t.cmpFunc,this},t}(),n_=function(){function t(t,e,i){void 0===t&&(t=""),void 0===e&&(e=Kl.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}(),r_=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,Dc(this.members,t.members,n_),this.count=t.count,this.flattened=t.flattened,this},t}(),s_=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=Kl.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}(),a_=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}(),o_=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=Kl.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}(),h_=function(){function t(t,e,i,n,r,s,a){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=""),void 0===n&&(n=Kl.UNKNOWN),void 0===r&&(r=0),void 0===s&&(s=Zl.READ_WRITE),void 0===a&&(a=0),this.set=t,this.binding=e,this.name=i,this.type=n,this.count=r,this.memoryAccess=s,this.flattened=a}return t.prototype.copy=function(t){return this.set=t.set,this.binding=t.binding,this.name=t.name,this.type=t.type,this.count=t.count,this.memoryAccess=t.memoryAccess,this.flattened=t.flattened,this},t}(),u_=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=Zl.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}(),l_=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}(),c_=function(){function t(t,e){void 0===t&&(t=_c.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}(),__=function(){function t(t,e,i,n,r,s){void 0===t&&(t=""),void 0===e&&(e=jl.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}(),d_=function(){function t(t,e,i,n,r,s,a,o,h,u){void 0===t&&(t=""),void 0===e&&(e=[]),void 0===i&&(i=[]),void 0===n&&(n=[]),void 0===r&&(r=[]),void 0===s&&(s=[]),void 0===a&&(a=[]),void 0===o&&(o=[]),void 0===h&&(h=[]),void 0===u&&(u=[]),this.name=t,this.stages=e,this.attributes=i,this.blocks=n,this.buffers=r,this.samplerTextures=s,this.samplers=a,this.textures=o,this.images=h,this.subpassInputs=u}return t.prototype.copy=function(t){return this.name=t.name,Dc(this.stages,t.stages,c_),Dc(this.attributes,t.attributes,__),Dc(this.blocks,t.blocks,r_),Dc(this.buffers,t.buffers,u_),Dc(this.samplerTextures,t.samplerTextures,s_),Dc(this.samplers,t.samplers,a_),Dc(this.textures,t.textures,o_),Dc(this.images,t.images,h_),Dc(this.subpassInputs,t.subpassInputs,l_),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 Dc(this.attributes,t.attributes,__),this.vertexBuffers=t.vertexBuffers.slice(),this.indexBuffer=t.indexBuffer,this.indirectBuffer=t.indirectBuffer,this},t}(),p_=function(){function t(t,e,i,n,r){void 0===t&&(t=jl.UNKNOWN),void 0===e&&(e=nc.X1),void 0===i&&(i=dc.CLEAR),void 0===n&&(n=fc.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}(),m_=function(){function t(t,e,i,n,r,s,a){void 0===t&&(t=jl.UNKNOWN),void 0===e&&(e=nc.X1),void 0===i&&(i=dc.CLEAR),void 0===n&&(n=fc.STORE),void 0===r&&(r=dc.CLEAR),void 0===s&&(s=fc.STORE),void 0===a&&(a=null),this.format=t,this.sampleCount=e,this.depthLoadOp=i,this.depthStoreOp=n,this.stencilLoadOp=r,this.stencilStoreOp=s,this.barrier=a}return t.prototype.copy=function(t){return this.format=t.format,this.sampleCount=t.sampleCount,this.depthLoadOp=t.depthLoadOp,this.depthStoreOp=t.depthStoreOp,this.stencilLoadOp=t.stencilLoadOp,this.stencilStoreOp=t.stencilStoreOp,this.barrier=t.barrier,this},t}(),g_=function(){function t(t,e,i,n,r,s,a,o){void 0===t&&(t=[]),void 0===e&&(e=[]),void 0===i&&(i=[]),void 0===n&&(n=[]),void 0===r&&(r=-1),void 0===s&&(s=-1),void 0===a&&(a=mc.NONE),void 0===o&&(o=mc.NONE),this.inputs=t,this.colors=e,this.resolves=i,this.preserves=n,this.depthStencil=r,this.depthStencilResolve=s,this.depthResolveMode=a,this.stencilResolveMode=o}return t.prototype.copy=function(t){return this.inputs=t.inputs.slice(),this.colors=t.colors.slice(),this.resolves=t.resolves.slice(),this.preserves=t.preserves.slice(),this.depthStencil=t.depthStencil,this.depthStencilResolve=t.depthStencilResolve,this.depthResolveMode=t.depthResolveMode,this.stencilResolveMode=t.stencilResolveMode,this},t}(),v_=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=[pc.NONE]),void 0===r&&(r=[pc.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}(),y_=function(){function t(t,e,i,n,r){void 0===t&&(t=[]),void 0===e&&(e=new m_),void 0===i&&(i=new m_),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 Dc(this.colorAttachments,t.colorAttachments,p_),this.depthStencilAttachment.copy(t.depthStencilAttachment),this.depthStencilResolveAttachment.copy(t.depthStencilResolveAttachment),Dc(this.subpasses,t.subpasses,g_),Dc(this.dependencies,t.dependencies,v_),this},t}(),T_=function(){function t(t,e,i){void 0===t&&(t=pc.NONE),void 0===e&&(e=pc.NONE),void 0===i&&(i=Ic.FULL),this.prevAccesses=t,this.nextAccesses=e,this.type=i}return t.prototype.copy=function(t){return this.prevAccesses=t.prevAccesses,this.nextAccesses=t.nextAccesses,this.type=t.type,this},t}(),S_=function(){function t(t,e,i,n,r,s,a,o,h,u){void 0===t&&(t=pc.NONE),void 0===e&&(e=pc.NONE),void 0===i&&(i=Ic.FULL),void 0===n&&(n=0),void 0===r&&(r=1),void 0===s&&(s=0),void 0===a&&(a=1),void 0===o&&(o=!1),void 0===h&&(h=null),void 0===u&&(u=null),this.prevAccesses=t,this.nextAccesses=e,this.type=i,this.baseMipLevel=n,this.levelCount=r,this.baseSlice=s,this.sliceCount=a,this.discardContents=o,this.srcQueue=h,this.dstQueue=u}return t.prototype.copy=function(t){return this.prevAccesses=t.prevAccesses,this.nextAccesses=t.nextAccesses,this.type=t.type,this.baseMipLevel=t.baseMipLevel,this.levelCount=t.levelCount,this.baseSlice=t.baseSlice,this.sliceCount=t.sliceCount,this.discardContents=t.discardContents,this.srcQueue=t.srcQueue,this.dstQueue=t.dstQueue,this},t}(),E_=function(){function t(t,e,i,n,r,s,a,o){void 0===t&&(t=pc.NONE),void 0===e&&(e=pc.NONE),void 0===i&&(i=Ic.FULL),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=!1),void 0===a&&(a=null),void 0===o&&(o=null),this.prevAccesses=t,this.nextAccesses=e,this.type=i,this.offset=n,this.size=r,this.discardContents=s,this.srcQueue=a,this.dstQueue=o}return t.prototype.copy=function(t){return this.prevAccesses=t.prevAccesses,this.nextAccesses=t.nextAccesses,this.type=t.type,this.offset=t.offset,this.size=t.size,this.discardContents=t.discardContents,this.srcQueue=t.srcQueue,this.dstQueue=t.dstQueue,this},t}(),A_=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}(),R_=function(){function t(t,e,i,n,r){void 0===t&&(t=-1),void 0===e&&(e=Rc.UNKNOWN),void 0===i&&(i=0),void 0===n&&(n=_c.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}(),b_=function(){function t(t){void 0===t&&(t=[]),this.bindings=t}var e=t.prototype;return e.copy=function(t){return Dc(this.bindings,t.bindings,R_),this},e.reset=function(){this.bindings.length=0},t}(),C_=function(){function t(t){void 0===t&&(t=null),this.layout=t}return t.prototype.copy=function(t){return this.layout=t.layout,this},t}(),w_=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}(),x_=function(){function t(t){void 0===t&&(t=[]),this.attributes=t}return t.prototype.copy=function(t){return Dc(this.attributes,t.attributes,__),this},t}(),I_=function(){function t(t,e){void 0===t&&(t=null),void 0===e&&(e=wc.PRIMARY),this.queue=t,this.type=e}return t.prototype.copy=function(t){return this.queue=t.queue,this.type=t.type,this},t}(),O_=function(){function t(t){void 0===t&&(t=bc.GRAPHICS),this.type=t}return t.prototype.copy=function(t){return this.type=t.type,this},t}(),D_=function(){function t(t,e,i){void 0===t&&(t=Cc.OCCLUSION),void 0===e&&(e=32767),void 0===i&&(i=!0),this.type=t,this.maxQueryObjects=e,this.forceWait=i}return t.prototype.copy=function(t){return this.type=t.type,this.maxQueryObjects=t.maxQueryObjects,this.forceWait=t.forceWait,this},t}(),M_=function(t,e,i,n,r,s,a,o){void 0===t&&(t=""),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=Yl.NONE),void 0===r&&(r=!1),void 0===s&&(s=!1),void 0===a&&(a=!1),void 0===o&&(o=!1),this.name=t,this.size=e,this.count=i,this.type=n,this.hasAlpha=r,this.hasDepth=s,this.hasStencil=a,this.isCompressed=o},P_=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}(),B_=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}(),N_=function(){function t(t,e,i,n,r,s,a,o,h,u,l){void 0===t&&(t=new Wc),void 0===e&&(e=new Fc),void 0===i&&(i=new Xc),void 0===n&&(n=1),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=0),void 0===o&&(o=0),void 0===h&&(h=0),void 0===u&&(u=new B_),void 0===l&&(l=new B_),this.viewport=t,this.scissor=e,this.blendConstant=i,this.lineWidth=n,this.depthBiasConstant=r,this.depthBiasClamp=s,this.depthBiasSlope=a,this.depthMinBounds=o,this.depthMaxBounds=h,this.stencilStatesFront=u,this.stencilStatesBack=l}return t.prototype.copy=function(t){return this.viewport.copy(t.viewport),this.scissor.copy(t.scissor),this.blendConstant.copy(t.blendConstant),this.lineWidth=t.lineWidth,this.depthBiasConstant=t.depthBiasConstant,this.depthBiasClamp=t.depthBiasClamp,this.depthBiasSlope=t.depthBiasSlope,this.depthMinBounds=t.depthMinBounds,this.depthMaxBounds=t.depthMaxBounds,this.stencilStatesFront.copy(t.stencilStatesFront),this.stencilStatesBack.copy(t.stencilStatesBack),this},t}(),L_=function(t){function e(i){var n;return(n=t.call(this)||this)._objectType=Hl.UNKNOWN,n._objectID=0,n._typedID=0,n._objectType=i,n._objectID=e._idTable[Hl.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}(kl);L_._idTable=Array(Hl.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"}(Mc||(Mc={}));var F_=Object.freeze([new M_("UNKNOWN",0,0,Yl.NONE,!1,!1,!1,!1),new M_("A8",1,1,Yl.UNORM,!0,!1,!1,!1),new M_("L8",1,1,Yl.UNORM,!1,!1,!1,!1),new M_("LA8",1,2,Yl.UNORM,!0,!1,!1,!1),new M_("R8",1,1,Yl.UNORM,!1,!1,!1,!1),new M_("R8SN",1,1,Yl.SNORM,!1,!1,!1,!1),new M_("R8UI",1,1,Yl.UINT,!1,!1,!1,!1),new M_("R8I",1,1,Yl.INT,!1,!1,!1,!1),new M_("R16F",2,1,Yl.FLOAT,!1,!1,!1,!1),new M_("R16UI",2,1,Yl.UINT,!1,!1,!1,!1),new M_("R16I",2,1,Yl.INT,!1,!1,!1,!1),new M_("R32F",4,1,Yl.FLOAT,!1,!1,!1,!1),new M_("R32UI",4,1,Yl.UINT,!1,!1,!1,!1),new M_("R32I",4,1,Yl.INT,!1,!1,!1,!1),new M_("RG8",2,2,Yl.UNORM,!1,!1,!1,!1),new M_("RG8SN",2,2,Yl.SNORM,!1,!1,!1,!1),new M_("RG8UI",2,2,Yl.UINT,!1,!1,!1,!1),new M_("RG8I",2,2,Yl.INT,!1,!1,!1,!1),new M_("RG16F",4,2,Yl.FLOAT,!1,!1,!1,!1),new M_("RG16UI",4,2,Yl.UINT,!1,!1,!1,!1),new M_("RG16I",4,2,Yl.INT,!1,!1,!1,!1),new M_("RG32F",8,2,Yl.FLOAT,!1,!1,!1,!1),new M_("RG32UI",8,2,Yl.UINT,!1,!1,!1,!1),new M_("RG32I",8,2,Yl.INT,!1,!1,!1,!1),new M_("RGB8",3,3,Yl.UNORM,!1,!1,!1,!1),new M_("SRGB8",3,3,Yl.UNORM,!1,!1,!1,!1),new M_("RGB8SN",3,3,Yl.SNORM,!1,!1,!1,!1),new M_("RGB8UI",3,3,Yl.UINT,!1,!1,!1,!1),new M_("RGB8I",3,3,Yl.INT,!1,!1,!1,!1),new M_("RGB16F",6,3,Yl.FLOAT,!1,!1,!1,!1),new M_("RGB16UI",6,3,Yl.UINT,!1,!1,!1,!1),new M_("RGB16I",6,3,Yl.INT,!1,!1,!1,!1),new M_("RGB32F",12,3,Yl.FLOAT,!1,!1,!1,!1),new M_("RGB32UI",12,3,Yl.UINT,!1,!1,!1,!1),new M_("RGB32I",12,3,Yl.INT,!1,!1,!1,!1),new M_("RGBA8",4,4,Yl.UNORM,!0,!1,!1,!1),new M_("BGRA8",4,4,Yl.UNORM,!0,!1,!1,!1),new M_("SRGB8_A8",4,4,Yl.UNORM,!0,!1,!1,!1),new M_("RGBA8SN",4,4,Yl.SNORM,!0,!1,!1,!1),new M_("RGBA8UI",4,4,Yl.UINT,!0,!1,!1,!1),new M_("RGBA8I",4,4,Yl.INT,!0,!1,!1,!1),new M_("RGBA16F",8,4,Yl.FLOAT,!0,!1,!1,!1),new M_("RGBA16UI",8,4,Yl.UINT,!0,!1,!1,!1),new M_("RGBA16I",8,4,Yl.INT,!0,!1,!1,!1),new M_("RGBA32F",16,4,Yl.FLOAT,!0,!1,!1,!1),new M_("RGBA32UI",16,4,Yl.UINT,!0,!1,!1,!1),new M_("RGBA32I",16,4,Yl.INT,!0,!1,!1,!1),new M_("R5G6B5",2,3,Yl.UNORM,!1,!1,!1,!1),new M_("R11G11B10F",4,3,Yl.FLOAT,!1,!1,!1,!1),new M_("RGB5A1",2,4,Yl.UNORM,!0,!1,!1,!1),new M_("RGBA4",2,4,Yl.UNORM,!0,!1,!1,!1),new M_("RGB10A2",2,4,Yl.UNORM,!0,!1,!1,!1),new M_("RGB10A2UI",2,4,Yl.UINT,!0,!1,!1,!1),new M_("RGB9E5",2,4,Yl.FLOAT,!0,!1,!1,!1),new M_("DEPTH",4,1,Yl.FLOAT,!1,!0,!1,!1),new M_("DEPTH_STENCIL",5,2,Yl.FLOAT,!1,!0,!0,!1),new M_("BC1",1,3,Yl.UNORM,!1,!1,!1,!0),new M_("BC1_ALPHA",1,4,Yl.UNORM,!0,!1,!1,!0),new M_("BC1_SRGB",1,3,Yl.UNORM,!1,!1,!1,!0),new M_("BC1_SRGB_ALPHA",1,4,Yl.UNORM,!0,!1,!1,!0),new M_("BC2",1,4,Yl.UNORM,!0,!1,!1,!0),new M_("BC2_SRGB",1,4,Yl.UNORM,!0,!1,!1,!0),new M_("BC3",1,4,Yl.UNORM,!0,!1,!1,!0),new M_("BC3_SRGB",1,4,Yl.UNORM,!0,!1,!1,!0),new M_("BC4",1,1,Yl.UNORM,!1,!1,!1,!0),new M_("BC4_SNORM",1,1,Yl.SNORM,!1,!1,!1,!0),new M_("BC5",1,2,Yl.UNORM,!1,!1,!1,!0),new M_("BC5_SNORM",1,2,Yl.SNORM,!1,!1,!1,!0),new M_("BC6H_UF16",1,3,Yl.UFLOAT,!1,!1,!1,!0),new M_("BC6H_SF16",1,3,Yl.FLOAT,!1,!1,!1,!0),new M_("BC7",1,4,Yl.UNORM,!0,!1,!1,!0),new M_("BC7_SRGB",1,4,Yl.UNORM,!0,!1,!1,!0),new M_("ETC_RGB8",1,3,Yl.UNORM,!1,!1,!1,!0),new M_("ETC2_RGB8",1,3,Yl.UNORM,!1,!1,!1,!0),new M_("ETC2_SRGB8",1,3,Yl.UNORM,!1,!1,!1,!0),new M_("ETC2_RGB8_A1",1,4,Yl.UNORM,!0,!1,!1,!0),new M_("ETC2_SRGB8_A1",1,4,Yl.UNORM,!0,!1,!1,!0),new M_("ETC2_RGBA8",2,4,Yl.UNORM,!0,!1,!1,!0),new M_("ETC2_SRGB8_A8",2,4,Yl.UNORM,!0,!1,!1,!0),new M_("EAC_R11",1,1,Yl.UNORM,!1,!1,!1,!0),new M_("EAC_R11SN",1,1,Yl.SNORM,!1,!1,!1,!0),new M_("EAC_RG11",2,2,Yl.UNORM,!1,!1,!1,!0),new M_("EAC_RG11SN",2,2,Yl.SNORM,!1,!1,!1,!0),new M_("PVRTC_RGB2",2,3,Yl.UNORM,!1,!1,!1,!0),new M_("PVRTC_RGBA2",2,4,Yl.UNORM,!0,!1,!1,!0),new M_("PVRTC_RGB4",2,3,Yl.UNORM,!1,!1,!1,!0),new M_("PVRTC_RGBA4",2,4,Yl.UNORM,!0,!1,!1,!0),new M_("PVRTC2_2BPP",2,4,Yl.UNORM,!0,!1,!1,!0),new M_("PVRTC2_4BPP",2,4,Yl.UNORM,!0,!1,!1,!0),new M_("ASTC_RGBA_4x4",1,4,Yl.UNORM,!0,!1,!1,!0),new M_("ASTC_RGBA_5x4",1,4,Yl.UNORM,!0,!1,!1,!0),new M_("ASTC_RGBA_5x5",1,4,Yl.UNORM,!0,!1,!1,!0),new M_("ASTC_RGBA_6x5",1,4,Yl.UNORM,!0,!1,!1,!0),new M_("ASTC_RGBA_6x6",1,4,Yl.UNORM,!0,!1,!1,!0),new M_("ASTC_RGBA_8x5",1,4,Yl.UNORM,!0,!1,!1,!0),new M_("ASTC_RGBA_8x6",1,4,Yl.UNORM,!0,!1,!1,!0),new M_("ASTC_RGBA_8x8",1,4,Yl.UNORM,!0,!1,!1,!0),new M_("ASTC_RGBA_10x5",1,4,Yl.UNORM,!0,!1,!1,!0),new M_("ASTC_RGBA_10x6",1,4,Yl.UNORM,!0,!1,!1,!0),new M_("ASTC_RGBA_10x8",1,4,Yl.UNORM,!0,!1,!1,!0),new M_("ASTC_RGBA_10x10",1,4,Yl.UNORM,!0,!1,!1,!0),new M_("ASTC_RGBA_12x10",1,4,Yl.UNORM,!0,!1,!1,!0),new M_("ASTC_RGBA_12x12",1,4,Yl.UNORM,!0,!1,!1,!0),new M_("ASTC_SRGBA_4x4",1,4,Yl.UNORM,!0,!1,!1,!0),new M_("ASTC_SRGBA_5x4",1,4,Yl.UNORM,!0,!1,!1,!0),new M_("ASTC_SRGBA_5x5",1,4,Yl.UNORM,!0,!1,!1,!0),new M_("ASTC_SRGBA_6x5",1,4,Yl.UNORM,!0,!1,!1,!0),new M_("ASTC_SRGBA_6x6",1,4,Yl.UNORM,!0,!1,!1,!0),new M_("ASTC_SRGBA_8x5",1,4,Yl.UNORM,!0,!1,!1,!0),new M_("ASTC_SRGBA_8x6",1,4,Yl.UNORM,!0,!1,!1,!0),new M_("ASTC_SRGBA_8x8",1,4,Yl.UNORM,!0,!1,!1,!0),new M_("ASTC_SRGBA_10x5",1,4,Yl.UNORM,!0,!1,!1,!0),new M_("ASTC_SRGBA_10x6",1,4,Yl.UNORM,!0,!1,!1,!0),new M_("ASTC_SRGBA_10x8",1,4,Yl.UNORM,!0,!1,!1,!0),new M_("ASTC_SRGBA_10x10",1,4,Yl.UNORM,!0,!1,!1,!0),new M_("ASTC_SRGBA_12x10",1,4,Yl.UNORM,!0,!1,!1,!0),new M_("ASTC_SRGBA_12x12",1,4,Yl.UNORM,!0,!1,!1,!0)]),k_=Rc.UNIFORM_BUFFER|Rc.DYNAMIC_UNIFORM_BUFFER|Rc.STORAGE_BUFFER|Rc.DYNAMIC_STORAGE_BUFFER,U_=Rc.SAMPLER_TEXTURE|Rc.SAMPLER|Rc.TEXTURE|Rc.STORAGE_IMAGE|Rc.INPUT_ATTACHMENT,G_=Rc.DYNAMIC_STORAGE_BUFFER|Rc.DYNAMIC_UNIFORM_BUFFER;function H_(t){return t>0&&0==(t&t-1)}function z_(t,e,i,n){if(!F_[t].isCompressed)return e*i*n*F_[t].size;switch(t){case jl.BC1:case jl.BC1_ALPHA:case jl.BC1_SRGB:case jl.BC1_SRGB_ALPHA:return Math.ceil(e/4)*Math.ceil(i/4)*8*n;case jl.BC2:case jl.BC2_SRGB:case jl.BC3:case jl.BC3_SRGB:case jl.BC4:case jl.BC4_SNORM:case jl.BC6H_SF16:case jl.BC6H_UF16:case jl.BC7:case jl.BC7_SRGB:return Math.ceil(e/4)*Math.ceil(i/4)*16*n;case jl.BC5:case jl.BC5_SNORM:return Math.ceil(e/4)*Math.ceil(i/4)*32*n;case jl.ETC_RGB8:case jl.ETC2_RGB8:case jl.ETC2_SRGB8:case jl.ETC2_RGB8_A1:case jl.EAC_R11:case jl.EAC_R11SN:return Math.ceil(e/4)*Math.ceil(i/4)*8*n;case jl.ETC2_RGBA8:case jl.ETC2_SRGB8_A1:case jl.EAC_RG11:case jl.EAC_RG11SN:return Math.ceil(e/4)*Math.ceil(i/4)*16*n;case jl.PVRTC_RGB2:case jl.PVRTC_RGBA2:case jl.PVRTC2_2BPP:return Math.ceil(e/8)*Math.ceil(i/4)*8*n;case jl.PVRTC_RGB4:case jl.PVRTC_RGBA4:case jl.PVRTC2_4BPP:return Math.ceil(e/4)*Math.ceil(i/4)*8*n;case jl.ASTC_RGBA_4X4:case jl.ASTC_SRGBA_4X4:return Math.ceil(e/4)*Math.ceil(i/4)*16*n;case jl.ASTC_RGBA_5X4:case jl.ASTC_SRGBA_5X4:return Math.ceil(e/5)*Math.ceil(i/4)*16*n;case jl.ASTC_RGBA_5X5:case jl.ASTC_SRGBA_5X5:return Math.ceil(e/5)*Math.ceil(i/5)*16*n;case jl.ASTC_RGBA_6X5:case jl.ASTC_SRGBA_6X5:return Math.ceil(e/6)*Math.ceil(i/5)*16*n;case jl.ASTC_RGBA_6X6:case jl.ASTC_SRGBA_6X6:return Math.ceil(e/6)*Math.ceil(i/6)*16*n;case jl.ASTC_RGBA_8X5:case jl.ASTC_SRGBA_8X5:return Math.ceil(e/8)*Math.ceil(i/5)*16*n;case jl.ASTC_RGBA_8X6:case jl.ASTC_SRGBA_8X6:return Math.ceil(e/8)*Math.ceil(i/6)*16*n;case jl.ASTC_RGBA_8X8:case jl.ASTC_SRGBA_8X8:return Math.ceil(e/8)*Math.ceil(i/8)*16*n;case jl.ASTC_RGBA_10X5:case jl.ASTC_SRGBA_10X5:return Math.ceil(e/10)*Math.ceil(i/5)*16*n;case jl.ASTC_RGBA_10X6:case jl.ASTC_SRGBA_10X6:return Math.ceil(e/10)*Math.ceil(i/6)*16*n;case jl.ASTC_RGBA_10X8:case jl.ASTC_SRGBA_10X8:return Math.ceil(e/10)*Math.ceil(i/8)*16*n;case jl.ASTC_RGBA_10X10:case jl.ASTC_SRGBA_10X10:return Math.ceil(e/10)*Math.ceil(i/10)*16*n;case jl.ASTC_RGBA_12X10:case jl.ASTC_SRGBA_12X10:return Math.ceil(e/12)*Math.ceil(i/10)*16*n;case jl.ASTC_RGBA_12X12:case jl.ASTC_SRGBA_12X12:return Math.ceil(e/12)*Math.ceil(i/12)*16*n;default:return 0}}function V_(t,e,i,n,r){for(var s=0,a=0;a<r;++a)s+=z_(t,e,i,n),e=Math.max(e>>1,1),i=Math.max(i>>1,1);return s}var W_=[0,4,8,12,16,4,8,12,16,4,8,12,16,4,8,12,16,16,24,32,24,36,48,32,48,64,4,4,4,4,4,4];function X_(t){return W_[t]||0}function j_(t){if(t.isCompressed)return Uint8Array;var e=t.size/t.count;switch(t.type){case Yl.UNORM:case Yl.UINT:switch(e){case 1:return Uint8Array;case 2:return Uint16Array;case 4:return Uint32Array;default:return Uint8Array}case Yl.SNORM:case Yl.INT:switch(e){case 1:return Int8Array;case 2:return Int16Array;case 4:return Int32Array;default:return Int8Array}case Yl.FLOAT:switch(e){case 2:return Uint16Array;case 4:default:return Float32Array}}return Float32Array}function Y_(t){switch(t){case jl.BC1:case jl.BC1_ALPHA:case jl.BC1_SRGB:case jl.BC1_SRGB_ALPHA:case jl.BC2:case jl.BC2_SRGB:case jl.BC3:case jl.BC3_SRGB:case jl.BC4:case jl.BC4_SNORM:case jl.BC6H_SF16:case jl.BC6H_UF16:case jl.BC7:case jl.BC7_SRGB:case jl.BC5:case jl.BC5_SNORM:case jl.ETC_RGB8:case jl.ETC2_RGB8:case jl.ETC2_SRGB8:case jl.ETC2_RGB8_A1:case jl.EAC_R11:case jl.EAC_R11SN:case jl.ETC2_RGBA8:case jl.ETC2_SRGB8_A1:case jl.EAC_RG11:case jl.EAC_RG11SN:return{width:4,height:4};case jl.PVRTC_RGB2:case jl.PVRTC_RGBA2:case jl.PVRTC2_2BPP:return{width:8,height:4};case jl.PVRTC_RGB4:case jl.PVRTC_RGBA4:case jl.PVRTC2_4BPP:return{width:4,height:4};case jl.ASTC_RGBA_4X4:case jl.ASTC_SRGBA_4X4:return{width:4,height:4};case jl.ASTC_RGBA_5X4:case jl.ASTC_SRGBA_5X4:return{width:5,height:4};case jl.ASTC_RGBA_5X5:case jl.ASTC_SRGBA_5X5:return{width:5,height:5};case jl.ASTC_RGBA_6X5:case jl.ASTC_SRGBA_6X5:return{width:6,height:5};case jl.ASTC_RGBA_6X6:case jl.ASTC_SRGBA_6X6:return{width:6,height:6};case jl.ASTC_RGBA_8X5:case jl.ASTC_SRGBA_8X5:return{width:8,height:5};case jl.ASTC_RGBA_8X6:case jl.ASTC_SRGBA_8X6:return{width:8,height:6};case jl.ASTC_RGBA_8X8:case jl.ASTC_SRGBA_8X8:return{width:8,height:8};case jl.ASTC_RGBA_10X5:case jl.ASTC_SRGBA_10X5:return{width:10,height:5};case jl.ASTC_RGBA_10X6:case jl.ASTC_SRGBA_10X6:return{width:10,height:6};case jl.ASTC_RGBA_10X8:case jl.ASTC_SRGBA_10X8:return{width:10,height:8};case jl.ASTC_RGBA_10X10:case jl.ASTC_SRGBA_10X10:return{width:10,height:10};case jl.ASTC_RGBA_12X10:case jl.ASTC_SRGBA_12X10:return{width:12,height:10};case jl.ASTC_RGBA_12X12:case jl.ASTC_SRGBA_12X12:return{width:12,height:12};default:return{width:1,height:1}}}function K_(t,e){return Math.ceil(t/e)*e}var q_=Object.freeze({__proto__:null,get ObjectType(){return Hl},get Status(){return zl},get API(){return Vl},get SurfaceTransform(){return Wl},get Feature(){return Xl},get Format(){return jl},get FormatType(){return Yl},get Type(){return Kl},get BufferUsageBit(){return ql},get BufferFlagBit(){return Ql},get MemoryAccessBit(){return Zl},get MemoryUsageBit(){return Jl},get TextureType(){return $l},get TextureUsageBit(){return tc},get TextureFlagBit(){return ec},get FormatFeatureBit(){return ic},get SampleCount(){return nc},get VsyncMode(){return rc},get Filter(){return sc},get Address(){return ac},get ComparisonFunc(){return oc},get StencilOp(){return hc},get BlendFactor(){return uc},get BlendOp(){return lc},get ColorMask(){return cc},get ShaderStageFlagBit(){return _c},get LoadOp(){return dc},get StoreOp(){return fc},get AccessFlagBit(){return pc},get ResolveMode(){return mc},get PipelineBindPoint(){return gc},get PrimitiveMode(){return vc},get PolygonMode(){return yc},get ShadeModel(){return Tc},get CullMode(){return Sc},get DynamicStateFlagBit(){return Ec},get StencilFace(){return Ac},get DescriptorType(){return Rc},get QueueType(){return bc},get QueryType(){return Cc},get CommandBufferType(){return wc},get ClearFlagBit(){return xc},get BarrierType(){return Ic},get PassType(){return Oc},Size:Pc,DeviceCaps:Bc,DeviceOptions:Nc,Offset:Lc,Rect:Fc,Extent:kc,TextureSubresLayers:Uc,TextureSubresRange:Gc,TextureCopy:Hc,TextureBlit:zc,BufferTextureCopy:Vc,Viewport:Wc,Color:Xc,BindingMappingInfo:jc,SwapchainInfo:Yc,DeviceInfo:Kc,BufferInfo:qc,BufferViewInfo:Qc,DrawInfo:Zc,DispatchInfo:Jc,IndirectBuffer:$c,TextureInfo:t_,TextureViewInfo:e_,SamplerInfo:i_,Uniform:n_,UniformBlock:r_,UniformSamplerTexture:s_,UniformSampler:a_,UniformTexture:o_,UniformStorageImage:h_,UniformStorageBuffer:u_,UniformInputAttachment:l_,ShaderStage:c_,Attribute:__,ShaderInfo:d_,InputAssemblerInfo:f_,ColorAttachment:p_,DepthStencilAttachment:m_,SubpassInfo:g_,SubpassDependency:v_,RenderPassInfo:y_,GeneralBarrierInfo:T_,TextureBarrierInfo:S_,BufferBarrierInfo:E_,FramebufferInfo:A_,DescriptorSetLayoutBinding:R_,DescriptorSetLayoutInfo:b_,DescriptorSetInfo:C_,PipelineLayoutInfo:w_,InputState:x_,CommandBufferInfo:I_,QueueInfo:O_,QueryPoolInfo:D_,FormatInfo:M_,MemoryStatus:P_,DynamicStencilStates:B_,DynamicStates:N_,GFXObject:L_,get AttributeName(){return Mc},FormatInfos:F_,DESCRIPTOR_BUFFER_TYPE:k_,DESCRIPTOR_SAMPLER_TYPE:U_,DESCRIPTOR_DYNAMIC_TYPE:G_,DRAW_INFO_SIZE:28,IsPowerOf2:H_,FormatSize:z_,FormatSurfaceSize:V_,GetTypeSize:X_,getTypedArrayConstructor:j_,formatAlignment:Y_,alignTo:K_}),Q_=function(t){function e(){var e;return(e=t.call(this,Hl.BUFFER)||this)._usage=ql.NONE,e._memUsage=Jl.NONE,e._size=0,e._stride=1,e._count=0,e._flags=Ql.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}(L_),Z_=function(t){function e(){var e;return(e=t.call(this,Hl.COMMAND_BUFFER)||this)._queue=null,e._type=wc.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}(L_),J_=function(){function t(){this._gfxAPI=Vl.UNKNOWN,this._renderer="",this._vendor="",this._features=new Array(Xl.COUNT),this._formatFeatures=new Array(jl.COUNT),this._queue=null,this._cmdBuff=null,this._numDrawCalls=0,this._numInstances=0,this._numTris=0,this._memoryStatus=new P_,this._caps=new Bc,this._bindingMappingInfo=new jc,this._samplers=new Map,this._generalBarrierss=new Map,this._textureBarriers=new Map,this._bufferBarriers=new Map}var e=t.prototype;return e.hasFeature=function(t){return this._features[t]},e.getFormatFeatures=function(t){return this._formatFeatures[t]},e.enableAutoBarrier=function(){},e.getMaxSampleCount=function(){return nc.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:"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}();J_.canvas=void 0;var $_=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 t_($l.TEX2D,tc.STORAGE|tc.SAMPLED,jl.RGBA8,2,2,ec.NONE));var i=new Vc(0,0,0,new Lc(0,0,0),new kc(2,2,1));t.copyBuffersToTexture([e],this._texture2D,[i])}if(t.capabilities.maxTextureSize>=2){this._textureCube=t.createTexture(new t_($l.CUBE,tc.STORAGE|tc.SAMPLED,jl.RGBA8,2,2,ec.NONE,6));var n=new Vc(0,0,0,new Lc(0,0,0),new kc(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 t_($l.TEX3D,tc.STORAGE|tc.SAMPLED,jl.RGBA8,2,2,ec.NONE,1,1,nc.X1,2));var r=new Vc(0,0,0,new Lc(0,0,0),new kc(2,2,2),new Uc(0,0,1));t.copyBuffersToTexture([e],this._texture3D,[r])}if(t.capabilities.maxArrayTextureLayers>=2){this._texture2DArray=t.createTexture(new t_($l.TEX2D_ARRAY,tc.STORAGE|tc.SAMPLED,jl.RGBA8,2,2,ec.NONE,2));var s=new Vc(0,0,0,new Lc(0,0,0),new kc(2,2,1),new Uc(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 $l.TEX2D:return this._texture2D;case $l.TEX3D:return this._texture3D;case $l.CUBE:return this._textureCube;case $l.TEX2D_ARRAY:return this._texture2DArray;default:return null}},t}(),td=function(t){function e(){var e;return(e=t.call(this,Hl.SWAPCHAIN)||this)._transform=Wl.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}(L_),ed=function(t){function e(){var e;return(e=t.call(this,Hl.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}}]),e}(L_),id=function(t){function e(){var e;return(e=t.call(this,Hl.INPUT_ASSEMBLER)||this)._attributes=[],e._attributesHash=0,e._vertexBuffers=[],e._indexBuffer=null,e._indirectBuffer=null,e._drawInfo=new Zc,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 Bl(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}(L_),nd=function(t){function e(){var e;return(e=t.call(this,Hl.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&k_){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&U_){var s=this._layout.descriptorIndices[t];this._samplers[s+i]!==e&&(this._samplers[s+i]=e,this._isDirty=!0)}},i.bindTexture=function(t,e,i){void 0===i&&(i=0);var n=this._layout.bindingIndices[t],r=this._layout.bindings[n];if(r&&r.descriptorType&U_){var s=this._layout.descriptorIndices[t];this._textures[s+i]!==e&&(this._textures[s+i]=e,this._isDirty=!0)}},i.getBuffer=function(t,e){void 0===e&&(e=0);var i=this._layout.descriptorIndices[t];return this._buffers[i+e]},i.getSampler=function(t,e){void 0===e&&(e=0);var i=this._layout.descriptorIndices[t];return this._samplers[i+e]},i.getTexture=function(t,e){void 0===e&&(e=0);var i=this._layout.descriptorIndices[t];return this._textures[i+e]},n(e,[{key:"layout",get:function(){return this._layout}}]),e}(L_),rd=function(t){function e(){var e;return(e=t.call(this,Hl.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}(L_),sd=function(t){function e(){var e;return(e=t.call(this,Hl.PIPELINE_LAYOUT)||this)._setLayouts=[],e}return s(e,t),n(e,[{key:"setLayouts",get:function(){return this._setLayouts}}]),e}(L_),ad=function(){function t(t,e,i,n,r,s,a,o,h,u,l,c){void 0===t&&(t=!1),void 0===e&&(e=yc.FILL),void 0===i&&(i=Tc.GOURAND),void 0===n&&(n=Sc.BACK),void 0===r&&(r=!0),void 0===s&&(s=!1),void 0===a&&(a=0),void 0===o&&(o=0),void 0===h&&(h=0),void 0===u&&(u=!0),void 0===l&&(l=!1),void 0===c&&(c=1),this.isDiscard=t,this.polygonMode=e,this.shadeModel=i,this.cullMode=n,this.isFrontFaceCCW=r,this.depthBiasEnabled=s,this.depthBias=a,this.depthBiasClamp=o,this.depthBiasSlop=h,this.isDepthClip=u,this.isMultisample=l,this.lineWidth=c}var e=t.prototype;return e.reset=function(){this.isDiscard=!1,this.polygonMode=yc.FILL,this.shadeModel=Tc.GOURAND,this.cullMode=Sc.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}(),od=function(){function t(t,e,i,n,r,s,a,o,h,u,l,c,_,d,f,p,m,g,v){void 0===t&&(t=!0),void 0===e&&(e=!0),void 0===i&&(i=oc.LESS),void 0===n&&(n=!1),void 0===r&&(r=oc.ALWAYS),void 0===s&&(s=65535),void 0===a&&(a=65535),void 0===o&&(o=hc.KEEP),void 0===h&&(h=hc.KEEP),void 0===u&&(u=hc.KEEP),void 0===l&&(l=1),void 0===c&&(c=!1),void 0===_&&(_=oc.ALWAYS),void 0===d&&(d=65535),void 0===f&&(f=65535),void 0===p&&(p=hc.KEEP),void 0===m&&(m=hc.KEEP),void 0===g&&(g=hc.KEEP),void 0===v&&(v=1),this.depthTest=t,this.depthWrite=e,this.depthFunc=i,this.stencilTestFront=n,this.stencilFuncFront=r,this.stencilReadMaskFront=s,this.stencilWriteMaskFront=a,this.stencilFailOpFront=o,this.stencilZFailOpFront=h,this.stencilPassOpFront=u,this.stencilRefFront=l,this.stencilTestBack=c,this.stencilFuncBack=_,this.stencilReadMaskBack=d,this.stencilWriteMaskBack=f,this.stencilFailOpBack=p,this.stencilZFailOpBack=m,this.stencilPassOpBack=g,this.stencilRefBack=v}var e=t.prototype;return e.reset=function(){this.depthTest=!0,this.depthWrite=!0,this.depthFunc=oc.LESS,this.stencilTestFront=!1,this.stencilFuncFront=oc.ALWAYS,this.stencilReadMaskFront=65535,this.stencilWriteMaskFront=65535,this.stencilFailOpFront=hc.KEEP,this.stencilZFailOpFront=hc.KEEP,this.stencilPassOpFront=hc.KEEP,this.stencilRefFront=1,this.stencilTestBack=!1,this.stencilFuncBack=oc.ALWAYS,this.stencilReadMaskBack=65535,this.stencilWriteMaskBack=65535,this.stencilFailOpBack=hc.KEEP,this.stencilZFailOpBack=hc.KEEP,this.stencilPassOpBack=hc.KEEP,this.stencilRefBack=1},e.assign=function(t){Object.assign(this,t)},e.destroy=function(){},n(t,[{key:"native",get:function(){return this}}]),t}(),hd=function(){function t(t,e,i,n,r,s,a,o){void 0===t&&(t=!1),void 0===e&&(e=uc.ONE),void 0===i&&(i=uc.ZERO),void 0===n&&(n=lc.ADD),void 0===r&&(r=uc.ONE),void 0===s&&(s=uc.ZERO),void 0===a&&(a=lc.ADD),void 0===o&&(o=cc.ALL),this.blend=t,this.blendSrc=e,this.blendDst=i,this.blendEq=n,this.blendSrcAlpha=r,this.blendDstAlpha=s,this.blendAlphaEq=a,this.blendColorMask=o}var e=t.prototype;return e.reset=function(){this.blend=!1,this.blendSrc=uc.ONE,this.blendDst=uc.ZERO,this.blendEq=lc.ADD,this.blendSrcAlpha=uc.ONE,this.blendDstAlpha=uc.ZERO,this.blendAlphaEq=lc.ADD,this.blendColorMask=cc.ALL},e.assign=function(t){Object.assign(this,t)},e.destroy=function(){},t}(),ud=function(){function t(t,e,i,n){void 0===t&&(t=!1),void 0===e&&(e=!1),void 0===i&&(i=new Xc),void 0===n&&(n=[new hd]),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 hd),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}(),ld=function(t,e,i,n,r,s,a,o,h,u){void 0===t&&(t=null),void 0===e&&(e=null),void 0===i&&(i=null),void 0===n&&(n=new x_),void 0===r&&(r=new ad),void 0===s&&(s=new od),void 0===a&&(a=new ud),void 0===o&&(o=vc.TRIANGLE_LIST),void 0===h&&(h=Ec.NONE),void 0===u&&(u=gc.GRAPHICS),this.shader=t,this.pipelineLayout=e,this.renderPass=i,this.inputState=n,this.rasterizerState=r,this.depthStencilState=s,this.blendState=a,this.primitive=o,this.dynamicStates=h,this.bindPoint=u},cd=function(t){function e(){var e;return(e=t.call(this,Hl.PIPELINE_STATE)||this)._shader=null,e._pipelineLayout=null,e._primitive=vc.TRIANGLE_LIST,e._is=null,e._rs=new ad,e._dss=new od,e._bs=new ud,e._dynamicStates=Ec.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}(L_),_d=function(t){function e(){var e;return(e=t.call(this,Hl.QUEUE)||this)._type=bc.GRAPHICS,e}return s(e,t),n(e,[{key:"type",get:function(){return this._type}}]),e}(L_),dd=function(t){function e(){var e;return(e=t.call(this,Hl.RENDER_PASS)||this)._colorInfos=[],e._depthStencilInfo=null,e._subpasses=[],e._hash=0,e}return s(e,t),e.prototype.computeHash=function(){var t="";if(this._subpasses.length)for(var e=0;e<this._subpasses.length;++e){var i=this._subpasses[e];if(i.inputs.length){t+="ia";for(var n=0;n<i.inputs.length;++n){var r=this._colorInfos[i.inputs[n]];t+=","+r.format+","+r.sampleCount}}if(i.colors.length){t+="ca";for(var s=0;s<i.inputs.length;++s){var a=this._colorInfos[i.inputs[s]];t+=","+a.format+","+a.sampleCount}}if(i.depthStencil>=0){var o=this._colorInfos[i.depthStencil];t+="ds,"+o.format+","+o.sampleCount}}else{t+="ca";for(var h=0;h<this._colorInfos.length;++h){var u=this._colorInfos[h];t+=","+u.format+","+u.sampleCount}var l=this._depthStencilInfo;l&&(t+="ds,"+l.format+","+l.sampleCount)}return Bl(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}(L_),fd=function(t){function e(e,i){var n;return(n=t.call(this,Hl.SAMPLER)||this)._info=new i_,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 i_;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}(L_),pd=function(t){function e(){var e;return(e=t.call(this,Hl.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}(L_),md=function(t){function e(){var e;return(e=t.call(this,Hl.TEXTURE)||this)._info=new t_,e._viewInfo=new e_,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}(L_),gd=function(t){function e(e,i){var n;return(n=t.call(this,Hl.GLOBAL_BARRIER)||this)._info=new T_,n._hash=0,n._info.copy(e),n._hash=i,n}return s(e,t),e.computeHash=function(t){return Bl(t.prevAccesses+" "+t.nextAccesses+" "+t.type,666)},n(e,[{key:"info",get:function(){return this._info}},{key:"hash",get:function(){return this._hash}}]),e}(L_),vd=function(t){function e(e,i){var n;return(n=t.call(this,Hl.TEXTURE_BARRIER)||this)._info=new S_,n._hash=0,n._info.copy(e),n._hash=i,n}return s(e,t),e.computeHash=function(t){var e=t.prevAccesses+" "+t.nextAccesses;return e+=t.type,e+=t.baseMipLevel,e+=t.levelCount,e+=t.baseSlice,e+=t.sliceCount,e+=t.discardContents,e+=t.srcQueue?t.srcQueue.type:0,Bl(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}(L_),yd=function(t){function e(e,i){var n;return(n=t.call(this,Hl.BUFFER_BARRIER)||this)._info=new E_,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,Bl(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}(L_),Td={Device:J_,Swapchain:td,Buffer:Q_,Texture:md,Sampler:fd,Shader:pd,InputAssembler:id,RenderPass:dd,Framebuffer:ed,DescriptorSet:nd,DescriptorSetLayout:rd,PipelineLayout:sd,PipelineState:cd,CommandBuffer:Z_,Queue:_d,GeneralBarrier:gd,TextureBarrier:vd,BufferBarrier:yd,RasterizerState:ad,BlendState:ud,BlendTarget:hd,DepthStencilState:od,PipelineStateInfo:ld};Object.assign(Td,q_),v.gfx=Td;var Sd,Ed,Ad={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 Rd in Ad){var bd=Ad[Rd];!0===bd?bd=Rd.slice(3):!1===bd&&(bd=Rd),rt(v,"cc",[{name:Rd,newName:bd,target:v.gfx,targetName:"cc.gfx"}])}st(v,"cc",[{name:"GFX_MAX_VERTEX_ATTRIBUTES"},{name:"GFX_MAX_TEXTURE_UNITS"},{name:"GFX_MAX_ATTACHMENTS"},{name:"GFX_MAX_BUFFER_BINDINGS"},{name:"GFXTextureLayout"}]),st(Xl,"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(p_.prototype,"ColorAttachment",[{name:"beginAccesses",suggest:"Please assign to ColorAttachment.barrier instead"},{name:"endAccesses",suggest:"Please assign to ColorAttachment.barrier instead"}]),st(m_.prototype,"DepthStencilAttachment",[{name:"beginAccesses",suggest:"Please assign to DepthStencilAttachment.barrier instead"},{name:"endAccesses",suggest:"Please assign to DepthStencilAttachment.barrier instead"}]),rt(J_.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"}(Sd||(Sd={})),function(t){t[t.UNKNOWN=-1]="UNKNOWN",t[t.CANVAS=0]="CANVAS",t[t.WEBGL=1]="WEBGL",t[t.OPENGL=2]="OPENGL",t[t.HEADLESS=3]="HEADLESS"}(Ed||(Ed={}));var Cd=function(){function t(){this.initialized=!1,this._gfxDevice=void 0,this._canvas=null,this._swapchain=void 0,this._renderType=Ed.UNKNOWN}var e=t.prototype;return e.init=function(t,e){if(!this.initialized){var i=be.querySettings(Re.Category.RENDERING,"renderMode");if(this._canvas=t,this._renderType=this._determineRenderType(i),this._renderType===Ed.WEBGL){var n=new Kc(e),r=!!globalThis.WebGL2RenderingContext;globalThis.navigator.userAgent.toLowerCase(),Ol.browserType===$u.UC&&(r=!1);var s=[];r&&v.WebGL2Device&&s.push(v.WebGL2Device),v.WebGLDevice&&s.push(v.WebGLDevice),v.EmptyDevice&&s.push(v.EmptyDevice),J_.canvas=t;for(var a=0;a<s.length&&(this._gfxDevice=new s[a],!this._gfxDevice.initialize(n));a++);this._initSwapchain()}else this._renderType===Ed.HEADLESS&&v.EmptyDevice&&(this._gfxDevice=new v.EmptyDevice,this._gfxDevice.initialize(new Kc(e)),this._initSwapchain());if(!this._gfxDevice)return G("can not support canvas rendering in 3D"),void(this._renderType=Ed.UNKNOWN);this._canvas&&(this._canvas.oncontextmenu=function(){return!1})}},e._initSwapchain=function(){var t=new Yc(1,this._canvas),e=Il.windowSize;t.width=e.width,t.height=e.height,this._swapchain=this._gfxDevice.createSwapchain(t)},e._determineRenderType=function(t){("number"!=typeof t||t>Ed.HEADLESS||t<Sd.AUTO)&&(t=Sd.AUTO);var e=Ed.CANVAS,i=!1;if(t===Sd.CANVAS?(e=Ed.CANVAS,i=!0):t===Sd.AUTO||t===Sd.WEBGL?(e=Ed.WEBGL,i=!0):t===Sd.HEADLESS&&(e=Ed.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}(),wd=new Cd;t("aB",Object.freeze({__proto__:null,DescriptorSet:nd,Buffer:Q_,CommandBuffer:Z_,get ObjectType(){return Hl},get Status(){return zl},get API(){return Vl},get SurfaceTransform(){return Wl},get Feature(){return Xl},get Format(){return jl},get FormatType(){return Yl},get Type(){return Kl},get BufferUsageBit(){return ql},get BufferFlagBit(){return Ql},get MemoryAccessBit(){return Zl},get MemoryUsageBit(){return Jl},get TextureType(){return $l},get TextureUsageBit(){return tc},get TextureFlagBit(){return ec},get FormatFeatureBit(){return ic},get SampleCount(){return nc},get VsyncMode(){return rc},get Filter(){return sc},get Address(){return ac},get ComparisonFunc(){return oc},get StencilOp(){return hc},get BlendFactor(){return uc},get BlendOp(){return lc},get ColorMask(){return cc},get ShaderStageFlagBit(){return _c},get LoadOp(){return dc},get StoreOp(){return fc},get AccessFlagBit(){return pc},get ResolveMode(){return mc},get PipelineBindPoint(){return gc},get PrimitiveMode(){return vc},get PolygonMode(){return yc},get ShadeModel(){return Tc},get CullMode(){return Sc},get DynamicStateFlagBit(){return Ec},get StencilFace(){return Ac},get DescriptorType(){return Rc},get QueueType(){return bc},get QueryType(){return Cc},get CommandBufferType(){return wc},get ClearFlagBit(){return xc},get BarrierType(){return Ic},get PassType(){return Oc},Size:Pc,DeviceCaps:Bc,DeviceOptions:Nc,Offset:Lc,Rect:Fc,Extent:kc,TextureSubresLayers:Uc,TextureSubresRange:Gc,TextureCopy:Hc,TextureBlit:zc,BufferTextureCopy:Vc,Viewport:Wc,Color:Xc,BindingMappingInfo:jc,SwapchainInfo:Yc,DeviceInfo:Kc,BufferInfo:qc,BufferViewInfo:Qc,DrawInfo:Zc,DispatchInfo:Jc,IndirectBuffer:$c,TextureInfo:t_,TextureViewInfo:e_,SamplerInfo:i_,Uniform:n_,UniformBlock:r_,UniformSamplerTexture:s_,UniformSampler:a_,UniformTexture:o_,UniformStorageImage:h_,UniformStorageBuffer:u_,UniformInputAttachment:l_,ShaderStage:c_,Attribute:__,ShaderInfo:d_,InputAssemblerInfo:f_,ColorAttachment:p_,DepthStencilAttachment:m_,SubpassInfo:g_,SubpassDependency:v_,RenderPassInfo:y_,GeneralBarrierInfo:T_,TextureBarrierInfo:S_,BufferBarrierInfo:E_,FramebufferInfo:A_,DescriptorSetLayoutBinding:R_,DescriptorSetLayoutInfo:b_,DescriptorSetInfo:C_,PipelineLayoutInfo:w_,InputState:x_,CommandBufferInfo:I_,QueueInfo:O_,QueryPoolInfo:D_,FormatInfo:M_,MemoryStatus:P_,DynamicStencilStates:B_,DynamicStates:N_,GFXObject:L_,get AttributeName(){return Mc},FormatInfos:F_,DESCRIPTOR_BUFFER_TYPE:k_,DESCRIPTOR_SAMPLER_TYPE:U_,DESCRIPTOR_DYNAMIC_TYPE:G_,DRAW_INFO_SIZE:28,IsPowerOf2:H_,FormatSize:z_,FormatSurfaceSize:V_,GetTypeSize:X_,getTypedArrayConstructor:j_,formatAlignment:Y_,alignTo:K_,Device:J_,DefaultResource:$_,Swapchain:td,Framebuffer:ed,InputAssembler:id,DescriptorSetLayout:rd,PipelineLayout:sd,BlendState:ud,BlendTarget:hd,RasterizerState:ad,DepthStencilState:od,PipelineStateInfo:ld,PipelineState:cd,Queue:_d,RenderPass:dd,Sampler:fd,Shader:pd,Texture:md,GeneralBarrier:gd,TextureBarrier:vd,get LegacyRenderMode(){return Sd},get RenderType(){return Ed},DeviceManager:Cd,deviceManager:wd}));var xd=new Dn;function Id(t,e,i,n){var r=i.chunk,s=i.data,a=r.vb,o=i.vertexCount;t.getWorldMatrix(xd);for(var h=0,u=0;u<o;u++){var l=s[u],c=l.x,_=l.y,d=xd.m03*c+xd.m07*_+xd.m15;d=d?1/d:1,a[h+0]=(xd.m00*c+xd.m04*_+xd.m12)*d,a[h+1]=(xd.m01*c+xd.m05*_+xd.m13)*d,a[h+2]=(xd.m02*c+xd.m06*_+xd.m14)*d,pn.toArray(a,n,h+5),h+=9}r.bufferId;for(var f=r.vertexOffset,p=r.meshBuffer,m=r.meshBuffer.iData,g=p.indexOffset,v=0,y=o/4;v<y;v++){var T=f+4*v;m[g++]=T,m[g++]=T+1,m[g++]=T+2,m[g++]=T+1,m[g++]=T+3,m[g++]=T+2}p.indexOffset+=i.indexCount,p.setDirty()}var Od={},Dd=function(){function t(t){this._map=null,this._count=0,t?(this._map=t,this._count=Object.keys(t).length):(this._map=Ot(!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=Ot(!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}(),Md=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}();Md._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=Ot(!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 Pd,Bd=new Dd,Nd=new Dd,Ld=new Dd,Fd=new Dd,kd=new Md("normal load",[]),Ud=new Md("fetch",[]),Gd=new Md("transform url",[]),Hd=new Map;!function(t){t.UUID="uuid",t.PATH="path",t.DIR="dir",t.URL="url",t.SCENE="scene"}(Pd||(Pd={}));var zd,Vd={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"}(zd||(zd={}));var Wd=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}();Wd.MAX_DEAD_NUM=500,Wd._taskId=0,Wd._deadPool=[];var Xd="0123456789abcdef".split(""),jd=["","","",""],Yd=jd.concat(jd,"-",jd,"-",jd,"-",jd,"-",jd,jd,jd),Kd=Yd.map((function(t,e){return"-"===t?NaN:e})).filter(Number.isFinite);function qd(t){var e=t.split("@")[0];if(22!==e.length)return t;Yd[0]=t[0],Yd[1]=t[1];for(var i=2,n=2;i<22;i+=2){var r=De[t.charCodeAt(i)],s=De[t.charCodeAt(i+1)];Yd[Kd[n++]]=Xd[r>>2],Yd[Kd[n++]]=Xd[(3&r)<<2|s>>4],Yd[Kd[n++]]=Xd[15&s]}return t.replace(e,Yd.join(""))}var Qd=/.*[/\\][0-9a-fA-F]{2}[/\\]([0-9a-fA-F-@]{8,}).*/;function Zd(t){var e=Qd.exec(t);return e?e[1]:""}function Jd(t,e){(e=e||Object.create(null)).__isNative__=e.isNative,e.nativeExt&&(e.ext=e.nativeExt);var i=Fd.find((function(e){return!!e.getAssetInfo(t)}));return i&&(e.bundle=i.name),ef(t,e)}function $d(t){return!!t&&(t instanceof v.SceneAsset||t instanceof v.Scene)}function tf(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 ef(t,e){var i=Wd.create({input:t,options:e}),n=[];try{for(var r,s=d(Gd.sync(i));!(r=s()).done;){var a=r.value,o=a.url;a.recycle(),n.push(o)}}catch(t){for(var h,u=d(i.output);!(h=u()).done;)h.value.recycle();G(t.message,t.stack)}return i.recycle(),n.length>1?n:n[0]}var nf,rf,sf,af=Object.freeze({__proto__:null,getUuidFromURL:Zd,getUrlWithUuid:Jd,isScene:$d,normalize:tf,transform:ef,decodeUuid:qd}),of=ra,hf=$s,uf=t("e7",qs("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=sf&&sf(),e._nativeUrl="",e._file=null,e._ref=0,Object.defineProperty(c(e),"_uuid",{value:"",writable:!0}),e}s(e,t),e.deserialize=function(t){return v.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&&v.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 z(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=Jd(this._uuid,{nativeExt:t,isNative:!0}):this._nativeUrl=Jd(this._uuid,{__nativeName__:t,nativeExt:cl(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}(Zu(Wa)),sf=Gs(rf.prototype,"_native",[of],(function(){return""})),f(rf.prototype,"_nativeAsset",[hf],Object.getOwnPropertyDescriptor(rf.prototype,"_nativeAsset"),rf.prototype),nf=rf))||nf);uf.prototype.createNode=null,v.Asset=uf;var lf,cf,_f,df,ff,pf;!function(t){t[t.RGB565=jl.R5G6B5]="RGB565",t[t.RGB5A1=jl.RGB5A1]="RGB5A1",t[t.RGBA4444=jl.RGBA4]="RGBA4444",t[t.RGB888=jl.RGB8]="RGB888",t[t.RGB32F=jl.RGB32F]="RGB32F",t[t.RGBA8888=jl.RGBA8]="RGBA8888",t[t.RGBA32F=jl.RGBA32F]="RGBA32F",t[t.A8=jl.A8]="A8",t[t.I8=jl.L8]="I8",t[t.AI8=jl.LA8]="AI8",t[t.RGB_PVRTC_2BPPV1=jl.PVRTC_RGB2]="RGB_PVRTC_2BPPV1",t[t.RGBA_PVRTC_2BPPV1=jl.PVRTC_RGBA2]="RGBA_PVRTC_2BPPV1",t[t.RGB_A_PVRTC_2BPPV1=1024]="RGB_A_PVRTC_2BPPV1",t[t.RGB_PVRTC_4BPPV1=jl.PVRTC_RGB4]="RGB_PVRTC_4BPPV1",t[t.RGBA_PVRTC_4BPPV1=jl.PVRTC_RGBA4]="RGBA_PVRTC_4BPPV1",t[t.RGB_A_PVRTC_4BPPV1=1025]="RGB_A_PVRTC_4BPPV1",t[t.RGB_ETC1=jl.ETC_RGB8]="RGB_ETC1",t[t.RGBA_ETC1=1026]="RGBA_ETC1",t[t.RGB_ETC2=jl.ETC2_RGB8]="RGB_ETC2",t[t.RGBA_ETC2=jl.ETC2_RGBA8]="RGBA_ETC2",t[t.RGBA_ASTC_4x4=jl.ASTC_RGBA_4X4]="RGBA_ASTC_4x4",t[t.RGBA_ASTC_5x4=jl.ASTC_RGBA_5X4]="RGBA_ASTC_5x4",t[t.RGBA_ASTC_5x5=jl.ASTC_RGBA_5X5]="RGBA_ASTC_5x5",t[t.RGBA_ASTC_6x5=jl.ASTC_RGBA_6X5]="RGBA_ASTC_6x5",t[t.RGBA_ASTC_6x6=jl.ASTC_RGBA_6X6]="RGBA_ASTC_6x6",t[t.RGBA_ASTC_8x5=jl.ASTC_RGBA_8X5]="RGBA_ASTC_8x5",t[t.RGBA_ASTC_8x6=jl.ASTC_RGBA_8X6]="RGBA_ASTC_8x6",t[t.RGBA_ASTC_8x8=jl.ASTC_RGBA_8X8]="RGBA_ASTC_8x8",t[t.RGBA_ASTC_10x5=jl.ASTC_RGBA_10X5]="RGBA_ASTC_10x5",t[t.RGBA_ASTC_10x6=jl.ASTC_RGBA_10X6]="RGBA_ASTC_10x6",t[t.RGBA_ASTC_10x8=jl.ASTC_RGBA_10X8]="RGBA_ASTC_10x8",t[t.RGBA_ASTC_10x10=jl.ASTC_RGBA_10X10]="RGBA_ASTC_10x10",t[t.RGBA_ASTC_12x10=jl.ASTC_RGBA_12X10]="RGBA_ASTC_12x10",t[t.RGBA_ASTC_12x12=jl.ASTC_RGBA_12X12]="RGBA_ASTC_12x12"}(lf||(lf={})),function(t){t[t.REPEAT=ac.WRAP]="REPEAT",t[t.CLAMP_TO_EDGE=ac.CLAMP]="CLAMP_TO_EDGE",t[t.MIRRORED_REPEAT=ac.MIRROR]="MIRRORED_REPEAT",t[t.CLAMP_TO_BORDER=ac.BORDER]="CLAMP_TO_BORDER"}(cf||(cf={})),function(t){t[t.NONE=sc.NONE]="NONE",t[t.LINEAR=sc.LINEAR]="LINEAR",t[t.NEAREST=sc.POINT]="NEAREST"}(_f||(_f={}));var mf=1346981187,gf=ve({PVR:0,PKM:1,ASTC:2});function vf(t,e){return t[e]<<8|t[e+1]}function yf(t){return!!(Ol.hasFeature(Ol.Feature.IMAGE_BITMAP)&&t instanceof ImageBitmap)}var Tf,Sf,Ef,Af,Rf,bf,Cf,wf,xf,If,Of,Df=t("ed",qs("cc.ImageAsset")(((pf=function(t){s(i,t),i.mergeCompressedTextureMips=function(t){var e=new Uint8Array(0),i=null;try{for(var n,r=8+4*t.length,s=0,a=d(t);!(n=a()).done;)s+=n.value.byteLength;s+=r,e=new Uint8Array(s);var o=new DataView(e.buffer,e.byteOffset,e.byteLength);o.setUint32(0,mf,!0),o.setUint32(4,t.length,!0);for(var h=r,u=0;u<t.length;u++){var l=t[u];if(o.setUint32(8+4*u,l.byteLength,!0),l instanceof ArrayBuffer){var c=new Uint8Array(l);e.set(c,h)}else{var _=new Uint8Array(l.buffer,l.byteOffset,l.byteLength);e.set(_,h)}h+=l.byteLength}}catch(t){i=t,console.warn(i)}return e},i.parseCompressedTextures=function(t,e){var n={_data:new Uint8Array(0),_compressed:!0,width:0,height:0,format:0,mipmapLevelDataSize:[]},r=t instanceof ArrayBuffer?t:t.buffer,s=new DataView(r);if(s.getUint32(0,!0)===mf){var a=s.getUint32(4,!0),o=s.getUint32(8,!0),h=8+4*a;i.parseCompressedTexture(t,0,h,o,e,n);for(var u=h+o,l=1;l<a;l++){var c=s.getUint32(8+4*l,!0);i.parseCompressedTexture(t,l,u,c,e,n),u+=c}}else i.parseCompressedTexture(t,0,0,0,e,n);return n},i.parseCompressedTexture=function(t,e,n,r,s,a){switch(s){case gf.PVR:i.parsePVRTexture(t,e,n,r,a);break;case gf.PKM:i.parsePKMTexture(t,e,n,r,a);break;case gf.ASTC:i.parseASTCTexture(t,e,n,r,a)}},i.parsePVRTexture=function(t,e,i,n,r){var s=t instanceof ArrayBuffer?t:t.buffer,a=new Int32Array(s,i,13);if(55727696===a[0]){var o=i+a[12]+52,h=n-a.byteLength;if(n>0){var u=new Uint8Array(s,o,h),l=new Uint8Array(r._data.byteLength+u.byteLength);l.set(r._data),l.set(u,r._data.byteLength),r._data=l,r.mipmapLevelDataSize[e]=h}else r._data=new Uint8Array(s,o);r.width=e>0?r.width:a[7],r.height=e>0?r.height:a[6]}else{if(559044176!==a[11])throw new Error("Invalid magic number in PVR header");var c=i+a[0],_=n-a.byteLength;if(n>0){var d=new Uint8Array(s,c,_),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,c);r.width=e>0?r.width:a[1],r.height=e>0?r.height:a[2]}},i.parsePKMTexture=function(t,e,i,n,r){var s=t instanceof ArrayBuffer?t:t.buffer,a=new Uint8Array(s,i,16),o=vf(a,6);if(0!==o&&1!==o&&3!==o)throw new Error("Invalid magic number in ETC header");var h=i+16,u=n-16;if(n>0){var l=new Uint8Array(s,h,u),c=new Uint8Array(r._data.byteLength+l.byteLength);c.set(r._data),c.set(l,r._data.byteLength),r._data=c,r.mipmapLevelDataSize[e]=u}else r._data=new Uint8Array(s,h);r.width=e>0?r.width:vf(a,12),r.height=e>0?r.height:vf(a,14)},i.parseASTCTexture=function(t,e,i,n,r){var s=t instanceof ArrayBuffer?t:t.buffer,a=new Uint8Array(s,i,16);if(1554098963!==a[0]+(a[1]<<8)+(a[2]<<16)+(a[3]<<24))throw new Error("Invalid magic number in ASTC header");var o=a[4],h=a[5],u=a[6];if((o<3||o>6||h<3||h>6||u<3||u>6)&&(o<4||7===o||9===o||11===o||o>12||h<4||7===h||9===h||11===h||h>12||1!==u))throw new Error("Invalid block number in ASTC header");var l=function(t,e){return 4===t?lf.RGBA_ASTC_4x4:5===t?4===e?lf.RGBA_ASTC_5x4:lf.RGBA_ASTC_5x5:6===t?5===e?lf.RGBA_ASTC_6x5:lf.RGBA_ASTC_6x6:8===t?5===e?lf.RGBA_ASTC_8x5:6===e?lf.RGBA_ASTC_8x6:lf.RGBA_ASTC_8x8:10===t?5===e?lf.RGBA_ASTC_10x5:6===e?lf.RGBA_ASTC_10x6:8===e?lf.RGBA_ASTC_10x8:lf.RGBA_ASTC_10x10:10===e?lf.RGBA_ASTC_12x10:lf.RGBA_ASTC_12x12}(o,h),c=i+16,_=n-16;if(n>0){var d=new Uint8Array(s,c,_),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,c);r.width=e>0?r.width:a[7]+(a[8]<<8)+(a[9]<<16),r.height=e>0?r.height:a[10]+(a[11]<<8)+(a[12]<<16),r.format=l};var e=i.prototype;function i(e){var i;return(i=t.call(this)||this)._nativeData=void 0,i._exportedExts=void 0,i._format=lf.RGBA8888,i._width=0,i._height=0,i._nativeData={_data:null,width:0,height:0,format:0,_compressed:!1,mipmapLevelDataSize:[]},void 0!==e&&i.reset(e),i}return e.extractMipmap0=function(){if(this.mipmapLevelDataSize&&this.mipmapLevelDataSize.length>0){var t=this.mipmapLevelDataSize[0],e=this.data,n=new i({_data:new Uint8Array(e.buffer,0,t),_compressed:!0,width:this.width,height:this.height,format:this.format,mipmapLevelDataSize:[]});return n._uuid=""+this._uuid,n}return this},e.extractMipmaps=function(){var t=[];if(this.mipmapLevelDataSize&&this.mipmapLevelDataSize.length>0)for(var e,n=this.mipmapLevelDataSize,r=this.data,s=0,a=this.height,o=this.width,h=d(n);!(e=h()).done;){var u=e.value,l=new i({_data:new Uint8Array(r.buffer,s,u),_compressed:!0,width:o,height:a,format:this.format,mipmapLevelDataSize:[]});s+=u,l._uuid=""+this._uuid,o=Math.max(o>>1,1),a=Math.max(a>>1,1),t.push(l)}else t.push(this);return t},e.reset=function(t){yf(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(yf(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=wd.gfxDevice,s=e.split("_"),a=Number.MAX_VALUE,o=this._format,h="",u=Ce.SUPPORT_TEXTURE_FORMATS,l=d(s);!(n=l()).done;){var c=n.value.split("@"),_=parseInt(c[0],void 0),f=i.extnames[_]||c[0],p=u.indexOf(f);if(-1!==p&&p<a){var m=c[1]?parseInt(c[1]):this._format;if(!(".astc"!==f||r&&r.getFormatFeatures(jl.ASTC_RGBA_4X4)&ic.SAMPLED_TEXTURE))continue;if(!(".pvr"!==f||r&&r.getFormatFeatures(jl.PVRTC_RGBA4)&ic.SAMPLED_TEXTURE))continue;if(!(m!==lf.RGB_ETC1&&m!==lf.RGBA_ETC1||r&&r.getFormatFeatures(jl.ETC_RGB8)&ic.SAMPLED_TEXTURE))continue;if(!(m!==lf.RGB_ETC2&&m!==lf.RGBA_ETC2||r&&r.getFormatFeatures(jl.ETC2_RGB8)&ic.SAMPLED_TEXTURE))continue;if(".webp"===f&&!Ol.hasFeature(Ol.Feature.WEBP))continue;a=p,h=f,o=m}}h?(this._setRawAsset(h),this._format=o):q(3121)},e.initDefault=function(e){if(t.prototype.initDefault.call(this,e),i._sharedPlaceHolderCanvas)this.reset(i._sharedPlaceHolderCanvas);else{var n=T.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||yf(t)||(t.format=t.format||this._format),this.reset(t)}},{key:"data",get:function(){return(t=this._nativeData)instanceof HTMLImageElement||t instanceof HTMLCanvasElement||yf(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>=lf.RGB_ETC1&&this._format<=lf.RGBA_ASTC_12x12||this._format>=lf.RGB_A_PVRTC_2BPPV1&&this._format<=lf.RGBA_ETC1}},{key:"mipmapLevelDataSize",get:function(){return this._nativeData.mipmapLevelDataSize}},{key:"url",get:function(){return this.nativeUrl}}]),i}(uf)).extnames=[".png",".jpg",".jpeg",".bmp",".webp",".pvr",".pkm",".astc"],pf._sharedPlaceHolderCanvas=null,f((ff=pf).prototype,"_nativeAsset",[Ia],Object.getOwnPropertyDescriptor(ff.prototype,"_nativeAsset"),ff.prototype),df=ff))||df);v.ImageAsset=Df,Se(jl);var Mf,Pf,Bf,Nf=new vt("Tex"),Lf=qs("cc.TextureBase")(((Of=function(t){function e(){var e;return(e=t.call(this)||this)._format=Ef&&Ef(),e._minFilter=Af&&Af(),e._magFilter=Rf&&Rf(),e._mipFilter=bf&&bf(),e._wrapS=Cf&&Cf(),e._wrapT=wf&&wf(),e._wrapR=xf&&xf(),e._anisotropy=If&&If(),e._width=1,e._height=1,e._id=void 0,e._samplerInfo=new i_,e._gfxSampler=null,e._gfxDevice=null,e._textureHash=0,e._id=Nf.getNewId(),e._gfxDevice=e._getGFXDevice(),e._textureHash=Bl(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=v.director.root)&&void 0!==e&&e.batcher2D&&v.director.root.batcher2D._releaseDescriptorSetCache(this._textureHash),i},i.getHash=function(){return this._textureHash},i.getGFXTexture=function(){return null},i.getSamplerInfo=function(){return this._samplerInfo},i.getGFXSampler=function(){return this._gfxSampler||(this._gfxDevice?this._gfxSampler=this._gfxDevice.getSampler(this._samplerInfo):Z(9302)),this._gfxSampler},i._serialize=function(){return""},i._deserialize=function(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 wd.gfxDevice},i._getGFXFormat=function(){return this._getGFXPixelFormat(this._format)},i._setGFXFormat=function(t){this._format=void 0===t?lf.RGBA8888:t},i._getGFXPixelFormat=function(t){return t===lf.RGBA_ETC1?t=lf.RGB_ETC1:t===lf.RGB_A_PVRTC_4BPPV1?t=lf.RGB_PVRTC_4BPPV1:t===lf.RGB_A_PVRTC_2BPPV1&&(t=lf.RGB_PVRTC_2BPPV1),t},n(e,[{key:"isCompressed",get:function(){return this._format>=lf.RGB_ETC1&&this._format<=lf.RGBA_ASTC_12x12||this._format>=lf.RGB_A_PVRTC_2BPPV1&&this._format<=lf.RGBA_ETC1}},{key:"width",get:function(){return this._width}},{key:"height",get:function(){return this._height}}]),e}(uf)).PixelFormat=lf,Of.WrapMode=cf,Of.Filter=_f,Ef=Gs((Sf=Of).prototype,"_format",[ra],(function(){return lf.RGBA8888})),Af=Gs(Sf.prototype,"_minFilter",[ra],(function(){return _f.LINEAR})),Rf=Gs(Sf.prototype,"_magFilter",[ra],(function(){return _f.LINEAR})),bf=Gs(Sf.prototype,"_mipFilter",[ra],(function(){return _f.NONE})),Cf=Gs(Sf.prototype,"_wrapS",[ra],(function(){return cf.REPEAT})),wf=Gs(Sf.prototype,"_wrapT",[ra],(function(){return cf.REPEAT})),xf=Gs(Sf.prototype,"_wrapR",[ra],(function(){return cf.REPEAT})),If=Gs(Sf.prototype,"_anisotropy",[ra],(function(){return 0})),Tf=Sf))||Tf;v.TextureBase=Lf;var Ff=t("ej",qs("cc.Script")(Mf=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(uf))||Mf);v._Script=Ff;var kf=t("ek",qs("cc.JavaScript")(Pf=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(Ff))||Pf);v._JavaScript=kf;var Uf,Gf,Hf,zf,Vf,Wf,Xf,jf=t("el",qs("cc.TypeScript")(Bf=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(Ff))||Bf);v._TypeScript=jf;var Yf,Kf,qf,Qf,Zf,Jf,$f,tp,ep,ip,np,rp=t("dC",qs("cc.ClickEvent")((Gf=function(){function t(){this.target=Hf&&Hf(),this.component=zf&&zf(),this._componentId=Vf&&Vf(),this.handler=Wf&&Wf(),this.customEventData=Xf&&Xf()}t.emitEvents=function(e){for(var i=arguments.length,n=new Array(i>1?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];for(var s=0,a=e.length;s<a;s++){var o=e[s];o instanceof t&&o.emit(n)}};var e=t.prototype;return e.emit=function(t){var e=this.target;if(v.isValid(e)){this._genCompIdIfNeeded();var i=v.js.getClassById(this._componentId),n=e.getComponent(i);if(v.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=v.js.getClassByName(t);return v.js.getClassId(e)},e._compId2Name=function(t){var e=v.js.getClassById(t);return v.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}(),Hf=Gs(Gf.prototype,"target",[ra],(function(){return null})),zf=Gs(Gf.prototype,"component",[ra],(function(){return""})),Vf=Gs(Gf.prototype,"_componentId",[ra],(function(){return""})),Wf=Gs(Gf.prototype,"handler",[ra],(function(){return""})),Xf=Gs(Gf.prototype,"customEventData",[ra],(function(){return""})),Uf=Gf))||Uf),sp=new vt("Comp"),ap=Wa.Flags.IsOnLoadCalled,op=t("dD",(Yf=qs("cc.Component"),Kf=xa(Ff),Yf(((tp=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).node=Zf&&Zf(),e._enabled=Jf&&Jf(),e.__prefab=$f&&$f(),e._sceneGetter=null,e._id=sp.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&&v.director._compScheduler.disableComp(this),!0)},i._onPreDestroy=function(){this.unscheduleAllCallbacks(),v.director._nodeActivator.destroyComp(this),this.node._removeComponent(this)},i._instantiate=function(t){return t||(t=v.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=v.macro.REPEAT_FOREVER),void 0===n&&(n=0),tt(Boolean(t),1619),tt((e=e||0)>=0,1620),i=Number.isNaN(i)?v.macro.REPEAT_FOREVER:i,n=n||0;var r=v.director.getScheduler(),s=r.isTargetPaused(this);r.schedule(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&&v.director.getScheduler().unschedule(t,this)},i.unscheduleAllCallbacks=function(){v.director.getScheduler().unscheduleAllForTarget(this)},n(e,[{key:"name",get:function(){if(this._name)return this._name;var t=Dt(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=v.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&ap}},{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}(Wa)).EventHandler=rp,tp._executionOrder=0,tp._requireComponent=null,tp.system=null,f((Qf=tp).prototype,"__scriptAsset",[Kf],Object.getOwnPropertyDescriptor(Qf.prototype,"__scriptAsset"),Qf.prototype),Zf=Gs(Qf.prototype,"node",[ra],(function(){return null})),Jf=Gs(Qf.prototype,"_enabled",[ra],(function(){return!0})),$f=Gs(Qf.prototype,"__prefab",[ra],(function(){return null})),qf=Qf))||qf));Ct(op,"_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)})),v.Component=op;var hp=t("d_",qs("cc.MissingScript")((ip=function(t){function e(){var e;return(e=t.call(this)||this)._$erialized=np&&np(),e}return s(e,t),e.safeFindClass=function(t){var e=ee(t);if(e)return e;v.deserialize.reportMissingClass(t)},e.prototype.onLoad=function(){q(4600,this.node.name)},e}(op),np=Gs(ip.prototype,"_$erialized",[ra,aa],(function(){return null})),ep=ip))||ep);v._MissingScript=hp;try{var up=hp.__values__;0!==up.length&&"_$erialized"===up[up.length-1]||(G("The '_$erialized' prop in MissingScript is missing. Please contact jare."),G(" Error props: ['"+up+"']"))}catch(er){G("Error when checking MissingScript 5, "+er)}var lp=function(){function t(t,e){this._document=void 0,this._chunks=void 0,this._document=t,this._chunks=e}return n(t,[{key:"document",get:function(){return this._document}},{key:"chunks",get:function(){return this._chunks}}]),t}();function cp(t){var e=t;return{chunks:e.chunks,document:e.document}}function _p(t){if(t.length<16)throw new dp(et(13102));var e=new DataView(t.buffer,t.byteOffset,t.byteLength);if(1313817411!==e.getUint32(0,!0))throw new dp(et(13100));var i=e.getUint32(4,!0);if(1!==i)throw new dp(et(13101,i));if(e.getUint32(8,!0)!==e.byteLength)throw new dp(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 a,o=function(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);if("Buffer"in globalThis)return globalThis.Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString();throw new Error(et(13104))}(s);try{a=JSON.parse(o)}catch(t){throw new dp(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 dp(et(13102));return new lp(a,h)}var dp=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(l(Error));function fp(t,e,i,n,r){if(e instanceof v.ValueType){r||t.push("if(prop){");var s=Dt(e);t.push("s._deserializeFastDefinedObject(o"+i+",prop,"+s+");"),r||t.push("}else o"+i+"=null;")}else t.push("\nif (prop) {\n s._deserializeAndAssignField(o, prop, "+n+");\n} else {\n o"+i+"=null;\n}\n")}!function(){function t(){this._viewOrPaddings=[],this._length=0}var e=t.prototype;e.alignAs=function(t){if(0!==t){var e=this._length%t;if(0!==e){var i=t-e;return this._viewOrPaddings.push(i),this._length+=i,i}}return 0},e.append=function(t){var e=this._length;return this._viewOrPaddings.push(t),this._length+=t.byteLength,e},e.get=function(){var t=new Uint8Array(this._length),e=0;return this._viewOrPaddings.forEach((function(i){"number"==typeof i?e+=i:(t.set(new Uint8Array(i.buffer,i.byteOffset,i.byteLength),e),e+=i.byteLength)})),t},n(t,[{key:"byteLength",get:function(){return this._length}}])}(),v.internal.parseCCONJson=cp,v.internal.decodeCCONBinary=_p,v.internal.CCON=lp;var pp=gi.Attr.DELIMETER,mp=pp+"type",gp=pp+"default",vp=pp+"formerlySerializedAs";function yp(t,e){if(void 0===t)return e instanceof gi.Attr.PrimitiveType||e===_i||e===di;var i=typeof t;return"string"===i||"number"===i||"boolean"===i}var Tp=function(t){function e(){return t.call(this,(function(t){t.clear()}),1)||this}return s(e,t),e}(se);Tp.prototype.get=function(t,e,i,n,r){var s=this._get();return s?(s.reset(t,e,i,n,r),s):new Sp(t,e,i,n,r)};var Sp=function(){function t(t,e,i,n){this.deserializedList=void 0,this.deserializedData=void 0,this._ignoreEditorOnly=void 0,this.result=t,this.customEnv=n,this.deserializedList=[],this.deserializedData=null,this._classFinder=e,this._reportMissingClass=i,this._onDereferenced=null==e?void 0:e.onDereferenced}var e=t.prototype;return e.reset=function(t,e,i,n){this.result=t,this.customEnv=n,this._classFinder=e,this._reportMissingClass=i,this._onDereferenced=null==e?void 0:e.onDereferenced},e.clear=function(){this.result=null,this.customEnv=null,this.deserializedList.length=0,this.deserializedData=null,this._classFinder=null,this._reportMissingClass=null,this._onDereferenced=null},e.deserialize=function(t){var e,i=!1;t instanceof lp?(i=!0,e=t.document,t.chunks.length>0&&(t.chunks.length,this._mainBinChunk=t.chunks[0])):e=t,this._serializedData=e,this._context={fromCCON:i};var n=Array.isArray(e)?e[0]:e;return this.deserializedData=this._deserializeObject(n,0),this._serializedData=void 0,this._mainBinChunk=void 0,this._context=void 0,this.deserializedData},e._deserializeObject=function(t,e,i,n){switch(t.__type__){case"TypedArray":return this._deserializeTypedArrayView(t);case"TypedArrayRef":return this._deserializeTypedArrayViewRef(t);default:return t.__type__?this._deserializeTypeTaggedObject(t,e,i,n):Array.isArray(t)?this._deserializeArray(t):this._deserializePlainObject(t)}},e._deserializeTypedArrayView=function(t){return globalThis[t.ctor].from(t.array)},e._deserializeTypedArrayViewRef=function(t){var e=t.offset,i=t.length,n=t.ctor;return new globalThis[n](this._mainBinChunk.buffer,this._mainBinChunk.byteOffset+e,i)},e._deserializeArray=function(t){for(var e,i=new Array(t.length),n=0;n<t.length;n++)"object"==typeof(e=t[n])&&e?this._deserializeAndAssignField(i,e,""+n)&&(i[n]=null):i[n]=e;return i},e._deserializePlainObject=function(t){var e={};return this._fillPlainObject(e,t),e},e._deserializeTypeTaggedObject=function(t,e,i,n){var r=this,s=t.__type__,a=this._classFinder(s,t,i,n);if(!a)return this._classFinder===ee&&this._reportMissingClass(s),null;var o=function(t){var i=new t;return e>=0&&(r.deserializedList[e]=i),i}(a);return this._deserializeInto(t,o,a),o},e._deserializeInto=function(t,e,i,n){void 0===n&&(n=!1),n||!e[Ja]?e._deserialize?e._deserialize(t.content,this):v.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[Ja](r,this._context)},e._deserializeFireClass=function(t,e,i){var n;if(i.hasOwnProperty("__deserialize__"))n=i.__deserialize__;else{n=function(t,e){for(var i=gi.Attr.getClassAttrs(e),n=e.__values__,r=["var prop;"],s=function(t){return we.test(re(t))}(e),a=0;a<n.length;a++){var o=n[a],h=void 0,u=void 0;gi.IDENTIFIER_RE.test(o)?(u='"'+o+'"',h="."+o):h="["+(u=gi.escapeForJS(o))+"]";var l=h;if(i[o+vp]){var c=i[o+vp];l=gi.IDENTIFIER_RE.test(c)?"."+c:"["+gi.escapeForJS(c)+"]"}r.push("prop=d"+l+";"),r.push('if(typeof prop!=="undefined"){');var _=gi.getDefault(i[o+gp]),d=i[o+mp];s&&(void 0!==_||d)?yp(_,d)?r.push("o"+h+"=prop;"):fp(r,_,h,u,!0):(r.push('if(typeof prop!=="object"){o'+h+"=prop;}else{"),fp(r,_,h,u,!1),r.push("}")),r.push("}")}return(Wt(e,v.Node)||Wt(e,v.Component))&&r.push("d._id&&(o._id=d._id);"),"_$erialized"===n[n.length-1]&&(r.push("o._$erialized=JSON.parse(JSON.stringify(d));"),r.push("s._fillPlainObject(o._$erialized,d);")),Function("s","o","d","k",r.join(""))}(0,i);try{if(i===hp){var r=i.__values__;0!==r.length&&"_$erialized"===r[r.length-1]||(G("The '_$erialized' prop of MissingScript is missing. Will force the raw data to be save."),G(" Error props: ['"+r+"']. Please contact jare."));var s=n;n=function(t,e,i,n){s(t,e,i,n),e._$erialized||G("Unable to stash previously serialized data. "+JSON.stringify(i))}}}catch(t){G("Error when checking MissingScript 6, "+t)}Ct(i,"__deserialize__",n,!0)}n(this,t,e,i)},e._deserializeAndAssignField=function(t,e,i){var n=e.__id__;if("number"==typeof n){var r=this.deserializedList[n];if(r)t[i]=r;else{var s,a=this._serializedData[n];t[i]=this._deserializeObject(a,n,void 0,i),null===(s=this._onDereferenced)||void 0===s||s.call(this,this.deserializedList,n,t,i)}}else{var o=e.__uuid__;if(o){var h=e.__expectedType__;this.result.push(t,i,o,h)}else t[i]=this._deserializeObject(e,-1)}return!1},e._deserializeObjectField=function(t){var e=t.__id__;if("number"==typeof e){var i=this.deserializedList[e];if(i)return i;var n=this._serializedData[e];return this._deserializeObject(n,e,void 0,void 0)}if(t.__uuid__)throw t.__expectedType__,new Error("Asset reference field serialization is currently not supported in custom serialization.");return this._deserializeObject(t,-1)},e._fillPlainObject=function(t,e){for(var i in e)if(e.hasOwnProperty(i)){var n=e[i];"object"!=typeof n?"__type__"!==i&&(t[i]=n):n?this._deserializeAndAssignField(t,n,i)&&(t[i]=null):t[i]=null}},e._deserializeFastDefinedObject=function(t,e,i){if(i===v.Vec2)return t.x=e.x||0,void(t.y=e.y||0);if(i===v.Vec3)return t.x=e.x||0,t.y=e.y||0,void(t.z=e.z||0);if(i!==v.Color){if(i===v.Size)return t.width=e.width||0,void(t.height=e.height||0);for(var n=gi.Attr.getClassAttrs(i),r=i.__values__,s=0;s<r.length;s++){var a=r[s],o=e[a];void 0!==o||e.hasOwnProperty(a)||(o=gi.getDefault(n[a+gp])),"object"!=typeof o?t[a]=o:o?this._deserializeAndAssignField(t,o,a):t[a]=null}}else{t.r=e.r||0,t.g=e.g||0,t.b=e.b||0;var h=e.a;t.a=void 0===h?255:h}},n(t,[{key:"ignoreEditorOnly",get:function(){return this._ignoreEditorOnly}}]),t}();Sp.pool=new Tp;var Ep=[Fn,hn,nn,En,pn,Hn,Vn,Dn];function Ap(t,e){t.x=e[1],t.y=e[2],t.z=e[3],t.w=e[4]}var Rp=[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]},Ap,Ap,function(t,e){t._val=e[1]},function(t,e){t.width=e[1],t.height=e[2]},function(t,e){t.x=e[1],t.y=e[2],t.width=e[3],t.height=e[4]},function(t,e){Dn.fromArray(t,e,1)}],bp=t("e5",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 Cp(t,e){for(var i=t[4][e[0]],n=i[0],r=new(0,n[0]),s=n[1],a=n[2],o=i[i.length-1],h=1;h<o;++h)r[s[i[h]]]=e[h];for(;h<e.length;++h){var u=s[i[h]],l=n[i[h]+a];(0,Mp[l])(t,r,u,e[h])}return r}function wp(t,e,i){var n=new e;return n._deserialize?n._deserialize(i,t[0]):Z(5303,Dt(e)),n}function xp(t,e,i,n){n>=0?e[i]=t[5][n]:t[7][3*~n]=e}function Ip(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 Op(t,e,i,n){e[i]=null,t[8][n]=e}function Dp(t,e,i,n){e[i]=Cp(t,n)}bp.pool=new se((function(t){t.reset()}),5),bp.pool.get=function(){return this._get()||new bp};var Mp=new Array(13);function Pp(t,e,i){return t||i(e),Object}function Bp(t,e,i,n,r,s,a){var o=t(e);if(!o){if(r)return void(i[n]=function(e,i,n){return function(){var r=t(n)||Pp(s,n,a);return e[i]=r,new r}}(i,n,e));o=Pp(s,e,a)}i[n]=o}function Np(t,e,i,n){for(var r=i||ee,s=t[3],a=0;a<s.length;++a){var o=s[a];"string"!=typeof o?Bp(r,o[0],o,0,e,i,n):Bp(r,o,s,a,e,i,n)}}function Lp(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 Fp(t,e,i){"string"==typeof t&&(t=JSON.parse(t));var n,r=!1;if(e||(e=bp.pool.get(),r=!0),function(t){if(Array.isArray(t)){var e=t[0];return"number"==typeof e||e instanceof kp}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 a,o=i;o._version=r,o.result=e,t[0]=o,s||(Np(t,!1,i.classFinder,null!==(a=i.reportMissingClass)&&void 0!==a?a:Fp.reportMissingClass),Lp(t))}(t,e,i);var s=t;v.game._isCloning=!0;var a=s[5],o=function(t){var e=t[5],i=t[6],n=0===i?0:i.length,r=e[e.length-1],s=e.length-n;"number"!=typeof r?r=0:(r<0&&(r=~r),--s);for(var a=0;a<s;++a)e[a]=Cp(t,e[a]);for(var o=t[3],h=0;h<n;++h,++a){var u=i[h],l=e[a];if(u>=0){var c=o[u];e[a]=wp(t,c,l)}else(0,Mp[u=~u])(t,e,a,l)}return r}(s);v.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 a=t[r],o=e[t[r+2]],h=t[r+1];h>=0?a[i[h]]=o:a[~h]=o}for(;r<n;r+=3){var u=e[t[r]],l=e[t[r+2]],c=t[r+1];c>=0?u[i[c]]=l:u[~c]=l}}(s[7],a,s[2]),function(t){for(var e=t[5],i=t[2],n=t[1],r=t[8],s=t[9],a=t[10],o=0;o<r.length;++o){var h=r[o];"number"==typeof h&&(r[o]=e[h]);var u=s[o];"number"==typeof u&&(u=u>=0?i[u]:~u,s[o]=u);var l=a[o];"number"==typeof l&&(a[o]=n[l])}}(s),n=a[o]}else n=function(t,e,i){var n,r=(i=i||{}).classFinder||ee,s=i.createAssetRefs||Ol.platform===nl.EDITOR_CORE,a=i.customEnv,o=i.ignoreEditorOnly,h=null!==(n=i.reportMissingClass)&&void 0!==n?n:v.deserialize.reportMissingClass;e.init();var u=Sp.pool.get(e,r,h,a,o);v.game._isCloning=!0;var l=u.deserialize(t);return v.game._isCloning=!1,Sp.pool.put(u),s&&e.assignAssetsBy((function(t,e){return EditorExtends.serialize.asAsset(t,e.type)})),l}(t,e,i);return r&&bp.pool.put(e),n}Mp[0]=function(t,e,i,n){e[i]=n},Mp[1]=xp,Mp[2]=Ip(xp),Mp[3]=Ip(Op),Mp[4]=Dp,Mp[5]=function(t,e,i,n){var r=n[0],s=e[i];(0,Rp[r])(s,n)},Mp[6]=Op,Mp[7]=function(t,e,i,n){e[i].set(n)},Mp[8]=function(t,e,i,n){var r=n[0],s=new Ep[r];(0,Rp[r])(s,n),e[i]=s},Mp[9]=Ip(Dp),Mp[10]=function(t,e,i,n){var r=t[3][n[0]];e[i]=wp(t,r,n[1])},Mp[11]=function(t,e,i,n){var r=n[0];e[i]=r;for(var s=1;s<n.length;s+=3){var a=n[s],o=n[s+1],h=n[s+2];(0,Mp[o])(t,r,a,h)}},Mp[12]=function(t,e,i,n){for(var r=n[0],s=0;s<r.length;++s){var a=r[s],o=n[s+1];0!==o&&(0,Mp[o])(t,r,s,a)}e[i]=r},Fp.Details=bp,Fp.reportMissingClass=function(t){Z(5302,t)};var kp=function(t){this.preprocessed=!0,this.version=t};function Up(t,e,i){return[1,0,0,[t],0,i?[e,-1]:[e],[0],0,[],[],[]]}v.deserialize=Fp;var Gp=new WeakMap,Hp=new WeakSet,zp=new WeakSet;function Vp(t,e){var i;i=hp.safeFindClass;var n,r=bp.pool.get();try{n=Fp(t,r,{classFinder:i,customEnv:e})}catch(t){throw G(t),bp.pool.put(r),t}n._uuid=e.__uuid__||"";for(var s=r.uuidList,a=r.uuidObjList,o=r.uuidPropList,h=r.uuidTypeList||[],u=[],l=0;l<s.length;l++){var c=s[l];u[l]={uuid:qd(c),owner:a[l],prop:o[l],type:ee(h[l])}}return Gp.set(n,u),n._native&&Hp.add(n),bp.pool.put(r),n}var Wp=function(){function t(){this._depends=new Dd}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 lp){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=Vp(e,{__uuid__:t});(r=this._parseDepsFromAsset(s)).nativeDep&&(r.nativeDep.uuid=t),Ld.add(t+"@import",s)}catch(e){Nd.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=Gp.get(t),n=0,r=i.length;n<r;n++)e.deps.push(i[n].uuid);return Hp.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]=qd(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}();Wp._instance=void 0;var Xp,jp=Wp.instance,Yp=[new Vc];function Kp(t){return t&&0==(t&t-1)}var qp,Qp,Zp,Jp,$p,tm=qs("cc.SimpleTexture")(Xp=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._gfxTexture=null,e._gfxTextureView=null,e._mipmapLevel=1,e._textureWidth=0,e._textureHeight=0,e._baseLevel=0,e._maxLevel=1e3,e}s(e,t);var i=e.prototype;return i.getGFXTexture=function(){return this._gfxTextureView},i.destroy=function(){return this._tryDestroyTextureView(),this._tryDestroyTexture(),t.prototype.destroy.call(this)},i.updateImage=function(){this.updateMipmaps(0)},i.updateMipmaps=function(){},i.uploadData=function(t,e,i){if(void 0===e&&(e=0),void 0===i&&(i=0),this._gfxTexture&&!(this._mipmapLevel<=e)){var n=this._getGFXDevice();if(n){var r=Yp[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,Yp):n.copyTexImagesToTexture([t],this._gfxTexture,Yp)}}},i._assignImage=function(t,e,i){var n=t.data;if(n&&(this.uploadData(n,e,i),this._checkTextureLoaded(),Ce.CLEANUP_IMAGE_CACHE)){var r=jp.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=ec.NONE;this._mipFilter!==_f.NONE&&function(t,e,i){return!(t.gfxAPI===Vl.WEBGL)||Kp(e)&&Kp(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=ec.GEN_MIPMAP));var i=this._getGfxTextureCreateInfo({usage:tc.SAMPLED|tc.TRANSFER_DST|tc.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}(Lf))||Xp;v.SimpleTexture=tm;var em=t("ee",(qp=qs("cc.Texture2D"),Qp=xa([Df]),qp((Jp=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._mipmaps=$p&&$p(),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=lf.RGBA8888),void 0===n&&(n=1),void 0===r&&(r=0),void 0===s&&(s=1e3),this.reset({width:t,height:e,format:i,mipmapLevel:n,baseLevel:r,maxLevel:s})},i.toString=function(){return 0!==this._mipmaps.length?this._mipmaps[0].url:""},i.updateMipmaps=function(t,e){if(void 0===t&&(t=0),!(t>=this._generatedMipmaps.length))for(var i=Math.min(void 0===e?this._generatedMipmaps.length:e,this._generatedMipmaps.length-t),n=0;n<i;++n){var r=t+n;this._assignImage(this._generatedMipmaps[r],r)}},i.getHtmlElementObj=function(){return this._mipmaps[0]&&this._mipmaps[0].data instanceof HTMLElement?this._mipmaps[0].data:null},i.destroy=function(){return this._mipmaps=[],this._generatedMipmaps=[],t.prototype.destroy.call(this)},i.description=function(){return"<cc.Texture2D | Name = "+(this._mipmaps[0]?this._mipmaps[0].url:"")+" | Dimension = "+this.width+" x "+this.height+">"},i.releaseTexture=function(){this.destroy()},i._serialize=function(){return null},i._deserialize=function(e,i){var n=e;t.prototype._deserialize.call(this,n.base,i),this._mipmaps=new Array(n.mipmaps.length);for(var r=0;r<n.mipmaps.length;++r)if(this._mipmaps[r]=new Df,n.mipmaps[r]){var s=n.mipmaps[r];i.result.push(this._mipmaps,""+r,s,re(Df))}},i._getGfxTextureCreateInfo=function(t){var e=new t_($l.TEX2D);return e.width=this._width,e.height=this._height,Object.assign(e,t),e},i._getGfxTextureViewCreateInfo=function(t){var e=new e_;return e.type=$l.TEX2D,Object.assign(e,t),e},i.initDefault=function(e){t.prototype.initDefault.call(this,e);var i=new Df;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}(tm),$p=Gs(Jp.prototype,"_mipmaps",[Qp],(function(){return[]})),Zp=Jp))||Zp));v.Texture2D=em;var im=function(){function t(t,e){this._texture=void 0,this._width=void 0,this._height=void 0,this._x=void 0,this._y=void 0,this._nexty=void 0,this._innerTextureInfos={},this._innerSpriteFrames=void 0,this._count=void 0;var i=new nm;i.initWithSize(t,e),this._texture=i,this._width=t,this._height=e,this._x=2,this._y=2,this._nexty=2,this._innerTextureInfos={},this._innerSpriteFrames=[],this._count=0}var e=t.prototype;return e.insertSpriteFrame=function(t){var e=t.rect,i=t.texture,n=this._innerTextureInfos[i.getId()],r=e.x,s=e.y;if(n)r+=n.x,s+=n.y;else{var a=i.width,o=i.height;if(this._x+a+2>this._width&&(this._x=2,this._y=this._nexty),this._y+o+2>this._nexty&&(this._nexty=this._y+o+2),this._nexty>this._height)return null;v.internal.dynamicAtlasManager.textureBleeding&&((a<=8||o<=8)&&(this._texture.drawTextureAt(i.image,this._x-1,this._y-1),this._texture.drawTextureAt(i.image,this._x-1,this._y+1),this._texture.drawTextureAt(i.image,this._x+1,this._y-1),this._texture.drawTextureAt(i.image,this._x+1,this._y+1)),this._texture.drawTextureAt(i.image,this._x-1,this._y),this._texture.drawTextureAt(i.image,this._x+1,this._y),this._texture.drawTextureAt(i.image,this._x,this._y-1),this._texture.drawTextureAt(i.image,this._x,this._y+1)),this._texture.drawTextureAt(i.image,this._x,this._y),this._innerTextureInfos[i.getId()]={x:this._x,y:this._y,texture:i},this._count++,r+=this._x,s+=this._y,this._x+=a+2}var h={x:r,y:s,texture:this._texture};return this._innerSpriteFrames.push(t),h},e.deleteInnerTexture=function(t){t&&this._innerTextureInfos[t.getId()]&&(delete this._innerTextureInfos[t.getId()],this._count--)},e.isEmpty=function(){return this._count<=0},e.reset=function(){this._x=2,this._y=2,this._nexty=2;for(var t=this._innerSpriteFrames,e=0,i=t.length;e<i;e++){var n=t[e];n.isValid&&n._resetDynamicAtlasFrame()}this._innerSpriteFrames.length=0,this._innerTextureInfos={}},e.destroy=function(){this.reset(),this._texture.destroy()},t}(),nm=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=lf.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 Vc;s.texOffset.x=e,s.texOffset.y=i,s.texExtent.width=t.width,s.texExtent.height=t.height,r.copyTexImagesToTexture([t.data],n,[s])}else console.warn("Unable to get device")}},e}(em),rm={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},sm=t("dA",function(){function t(){}return t.init=function(){var e=be.querySettings(Re.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)console.warn("maximum layers reached.");else{var n=1<<i;t.Enum[e],et(2104,e),t.Enum[e]=n,Ct(t.Enum,String(n),e),t.BitMask[e]=n,Ct(t.BitMask,String(n),e),me.update(t.BitMask),ve.update(t.Enum)}else console.warn("bitNum can't be undefined")},t.deleteLayer=function(e){if(e>19||e<0)console.warn("do not change buildin layers.");else{var i=1<<e;delete t.Enum[t.Enum[i]],delete t.Enum[i],delete t.BitMask[t.BitMask[i]],delete t.BitMask[i],me.update(t.BitMask),ve.update(t.Enum)}},t.nameToLayer=function(e){return void 0===e?(console.warn("name can't be undefined"),-1):A(t.Enum[e])},t.layerToName=function(e){return e>31||e<0?(console.warn("Unable to access unknown layer."),""):t.Enum[1<<e]},t}());sm.Enum=ve(rm),sm.BitMask=me(r({},rm)),v.Layers=sm;var am,om,hm=function(){var t=e.prototype;function e(t){this._uiComp=null,this._opacity=1,this._localOpacity=1,this.colorDirty=!0,this._uiTransformComp=null,this._node=void 0,this._node=t}return t.setOpacity=function(t){this._opacity=t},t.applyOpacity=function(t){this._opacity=this._localOpacity*t},e.markOpacityTree=function(){},n(e,[{key:"uiTransformComp",get:function(){return this._uiTransformComp||(this._uiTransformComp=this._node.getComponent("cc.UITransform")),this._uiTransformComp},set:function(t){this._uiTransformComp=t}},{key:"uiComp",get:function(){return this._uiComp},set:function(t){this._uiComp&&t?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}();Wa.Flags.Destroying,v.GAME_VIEW,t("dG",am),function(t){t[t.LOCAL=0]="LOCAL",t[t.WORLD=1]="WORLD"}(am||t("dG",am={})),t("dH",om),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"}(om||t("dH",om={})),v.internal.TransformBit=om;var um,lm,cm,_m,dm,fm,pm,mm,gm,vm,ym,Tm,Sm,Em,Am,Rm,bm,Cm,wm=t("dI",ve({Static:0,Stationary:1,Movable:2}));t("dJ",um),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"}(um||t("dJ",um={}));var xm=Wa.Flags.Destroying,Im=Wa.Flags.DontDestroy,Om=Wa.Flags.Deactivating,Dm=new vt("Node");function Mm(t){return t?"string"==typeof t?ie(t):t:(Z(3804),null)}var Pm=new hn,Bm=new hn,Nm=new En,Lm=new En,Fm=new En,km=new vn;new vn;var Um,Gm,Hm,zm,Vm,Wm,Xm,jm,Ym,Km=new Dn,qm=new Dn,Qm=[],Zm=Symbol("ReserveContentsForAllSyncablePrefab"),Jm=0,$m=t("dy",(lm=qs("cc.Node"),cm=xa(hn),_m=xa(wm),lm(((Cm=function(t){s(i,t);var e=i.prototype;function i(e){var i;return(i=t.call(this,e)||this)._parent=pm&&pm(),i._children=mm&&mm(),i._active=gm&&gm(),i._components=vm&&vm(),i._prefab=ym&&ym(),i._scene=null,i._activeInHierarchy=!1,i._id=Dm.getNewId(),i._name=void 0,i._eventProcessor=new v.NodeEventProcessor(c(i)),i._eventMask=0,i._siblingIndex=0,i._originalSceneId="",i._uiProps=new hm(c(i)),i._static=!1,i._lpos=Tm&&Tm(),i._lrot=Sm&&Sm(),i._lscale=Em&&Em(),i._mobility=Am&&Am(),i._layer=Rm&&Rm(),i._euler=bm&&bm(),i._transformFlags=om.TRS,i._eulerDirty=!1,i._flagChangeVersion=0,i._hasChangedFlags=0,i._name=void 0!==e?e:"New Node",i._pos=new hn,i._rot=new En,i._scale=new hn(1,1,1),i._mat=new Dn,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 a=0;a<n.length;++a){var o=n[a];if(o instanceof e)return o}return null},i._findComponents=function(t,e,i){var n=e,r=t._components;if(n._sealed)for(var s=0;s<r.length;++s){var a=r[s];a.constructor===e&&i.push(a)}else for(var o=0;o<r.length;++o){var h=r[o];h instanceof e&&i.push(h)}},i._findChildComponent=function(t,e){for(var n=0;n<t.length;++n){var r=t[n],s=i._findComponent(r,e);if(s)return s;if(r._children.length>0&&(s=i._findChildComponent(r._children,e)))return s}return null},i._findChildComponents=function(t,e,n){for(var r=0;r<t.length;++r){var s=t[r];i._findComponents(s,e,n),s._children.length>0&&i._findChildComponents(s._children,e,n)}},e.getWritableComponents=function(){return this._components},e._updateScene=function(){null==this._parent?G("Node %s(%s) has not attached to a scene.",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(um.PARENT_CHANGED,i),i&&!(i._objFlags&xm)){var r=i._children.indexOf(this);i._children.splice(r,1),i._updateSiblingIndex(),i.emit&&i.emit(um.CHILD_REMOVED,this)}n&&(n._children.push(this),this._siblingIndex=n._children.length-1,n.emit&&n.emit(um.CHILD_ADDED,this)),this._onHierarchyChanged(i)}},e.getChildByUuid=function(t){if(!t)return k("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 k("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&Om)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,a=0,o=i._stacks[i._stackId];o||(o=[],i._stacks.push(o)),i._stackId++,o.length=0,o[0]=this;for(var h=null,u=!1;n;)if(s=o[--n])if(!u&&t?t(s):u&&e&&e(s),o[n]=null,u){if(h===this._parent)break;if(u=!1,r)if(r[++a])o[n]=r[a],n++;else if(h&&(o[n]=h,n++,u=!0,h._parent?(a=(r=h._parent._children).indexOf(h),h=h._parent):(h=null,r=null),a<0))break}else s._children.length>0?(h=s,r=s._children,a=0,o[n]=r[a],n++):(o[n]=s,n++,u=!0);o.length=0,i._stackId--},e.removeFromParent=function(){this._parent&&this._parent.removeChild(this)},e.removeChild=function(t){this._children.indexOf(t)>-1&&(t.parent=null)},e.removeAllChildren=function(){for(var t=this._children,e=t.length-1;e>=0;e--){var i=t[e];i&&(i.parent=null)}this._children.length=0},e.isChildOf=function(t){var e=this;do{if(e===t)return!0;e=e._parent}while(e);return!1},e.getComponent=function(t){var e=Mm(t);return e?i._findComponent(this,e):null},e.getComponents=function(t){var e=Mm(t),n=[];return e&&i._findComponents(this,e,n),n},e.getComponentInChildren=function(t){var e=Mm(t);return e?i._findChildComponent(this._children,e):null},e.getComponentsInChildren=function(t){var e=Mm(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 v._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,v.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 a=new e;return a.node=this,this._components.push(a),this.emit(um.COMPONENT_ADDED,a),this._activeInHierarchy&&v.director._nodeActivator.activateComp(a),a},e.removeComponent=function(t){if(t){var e=null;(e=t instanceof op?t:this.getComponent(t))&&e.destroy()}else Z(3813)},e.on=function(t,e,i,n){switch(void 0===n&&(n=!1),t){case um.TRANSFORM_CHANGED:this._eventMask|=1}this._eventProcessor.on(t,e,i,n)},e.off=function(t,e,i,n){if(void 0===n&&(n=!1),this._eventProcessor.off(t,e,i,n),!this._eventProcessor.hasEventListener(t))switch(t){case um.TRANSFORM_CHANGED:this._eventMask&=-2}},e.once=function(t,e,i,n){this._eventProcessor.once(t,e,i,n)},e.emit=function(t,e,i,n,r,s){this._eventProcessor.emit(t,e,i,n,r,s)},e.dispatchEvent=function(t){this._eventProcessor.dispatchEvent(t)},e.hasEventListener=function(t,e,i){return this._eventProcessor.hasEventListener(t,e,i)},e.targetOff=function(t){this._eventProcessor.targetOff(t),1&this._eventMask&&!this._eventProcessor.hasEventListener(um.TRANSFORM_CHANGED)&&(this._eventMask&=-2)},e.destroy=function(){return!!t.prototype.destroy.call(this)&&(this.active=!1,!0)},e.destroyAllChildren=function(){for(var t=this._children,e=0;e<t.length;++e)t[e].destroy()},e._removeComponent=function(t){if(t){if(!(this._objFlags&xm)){var e=this._components.indexOf(t);-1!==e?(this._components.splice(e,1),this.emit(um.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(um.CHILDREN_ORDER_CHANGED)},e._instantiate=function(t,e){return t||(t=v.instantiate._clone(this,this)),t._prefab,t._parent=null,t._onBatchCreated(e),t},e._onHierarchyChangedBase=function(){var t=this._parent;!this._persistNode||t instanceof v.Scene||v.game.removePersistRootNode(this);var e=this._active&&!(!t||!t._activeInHierarchy);this._activeInHierarchy!==e&&v.director._nodeActivator.activateNode(this,e)},e._onPreDestroyBase=function(){this._objFlags|=xm;var t=this._parent,e=!!t&&0!=(t._objFlags&xm);if(this._persistNode&&v.game.removePersistRootNode(this),!e&&t){this.emit(um.PARENT_CHANGED,this);var i=t._children.indexOf(this);t._children.splice(i,1),this._siblingIndex=0,t._updateSiblingIndex(),t.emit&&t.emit(um.CHILD_REMOVED,this)}this.emit(um.NODE_DESTROYED,this),this._eventProcessor.destroy();for(var n=this._children,r=0;r<n.length;++r)n[r]._destroyImmediate();for(var s=this._components,a=0;a<s.length;++a)s[a]._destroyImmediate();return e},i.isNode=function(t){return t instanceof i&&(t.constructor===i||!(t instanceof v.Scene))},e._onPreDestroy=function(){return this._onPreDestroyBase()},e[Za]=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(),xi(Dn.determinant(n._mat),0,Ci)?(q(14300),this._transformFlags|=om.TRS,this.updateWorldTransform()):(Dn.multiply(Km,Dn.invert(Km,n._mat),this._mat),Dn.toRTS(Km,this._lrot,this._lpos,this._lscale))):(hn.copy(this._lpos,this._pos),En.copy(this._lrot,this._rot),hn.copy(this._lscale,this._scale)),this._eulerDirty=!0}this.invalidateChildren(om.TRS)},e._onHierarchyChanged=function(t){this.eventProcessor.reattach(),this._onHierarchyChangedBase(t)},e._onBatchCreated=function(t){this.hasChangedFlags=om.TRS;for(var e=this._children.length,i=0;i<e;++i)this._children[i]._siblingIndex=i,this._children[i]._onBatchCreated(t)},e._onBeforeSerialize=function(){this.eulerAngles},e._onPostActivated=function(t){t?(this._eventProcessor.setEnabled(!0),this.invalidateChildren(om.TRS),this._uiProps&&this._uiProps.uiComp&&(this._uiProps.uiComp.setNodeDirty(),this._uiProps.uiComp.setTextureDirty(),this._uiProps.uiComp.markForUpdateRenderData())):this._eventProcessor.setEnabled(!1)},e.translate=function(t,e){var i=e||am.LOCAL;if(i===am.LOCAL)hn.transformQuat(Pm,t,this._lrot),this._lpos.x+=Pm.x,this._lpos.y+=Pm.y,this._lpos.z+=Pm.z;else if(i===am.WORLD)if(this._parent){En.invert(Nm,this._parent.worldRotation),hn.transformQuat(Pm,t,Nm);var n=this.worldScale;this._lpos.x+=Pm.x/n.x,this._lpos.y+=Pm.y/n.y,this._lpos.z+=Pm.z/n.z}else this._lpos.x+=t.x,this._lpos.y+=t.y,this._lpos.z+=t.z;this.invalidateChildren(om.POSITION),1&this._eventMask&&this.emit(um.TRANSFORM_CHANGED,om.POSITION)},e.rotate=function(t,e){var i=e||am.LOCAL;if(En.normalize(Nm,t),i===am.LOCAL)En.multiply(this._lrot,this._lrot,Nm);else if(i===am.WORLD){var n=this.worldRotation;En.multiply(Lm,Nm,n),En.invert(Nm,n),En.multiply(Lm,Nm,Lm),En.multiply(this._lrot,this._lrot,Lm)}this._eulerDirty=!0,this.invalidateChildren(om.ROTATION),1&this._eventMask&&this.emit(um.TRANSFORM_CHANGED,om.ROTATION)},e.lookAt=function(t,e){this.getWorldPosition(Pm),hn.subtract(Pm,Pm,t),hn.normalize(Pm,Pm),En.fromViewUp(Nm,Pm,e),this.setWorldRotation(Nm)},e.invalidateChildren=function(t){var e,i,n=0,r=0,s=0,a=0,o=t|om.POSITION;for(Qm[0]=this;n>=0;){if(a=(e=Qm[n--]).hasChangedFlags,e.isValid&&(e._transformFlags&a&t)!==t)for(e._transformFlags|=t,e.hasChangedFlags=a|t,s=(i=e._children).length,r=0;r<s;r++)Qm[++n]=i[r];t=o}},e.updateWorldTransform=function(){if(this._transformFlags){for(var t,e=this,i=0;e&&e._transformFlags;)Qm[i++]=e,e=e._parent;for(var n=0;i;){if(n|=(t=Qm[--i])._transformFlags,e){if(n&om.POSITION&&(hn.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&om.RS){Dn.fromRTS(t._mat,t._lrot,t._lpos,t._lscale),Dn.multiply(t._mat,e._mat,t._mat);var r=n&om.ROTATION?t._rot:null;Dn.toRTS(t._mat,r,null,t._scale)}}else n&om.POSITION&&(hn.copy(t._pos,t._lpos),t._mat.m12=t._pos.x,t._mat.m13=t._pos.y,t._mat.m14=t._pos.z),n&om.RS&&(n&om.ROTATION&&En.copy(t._rot,t._lrot),n&om.SCALE&&hn.copy(t._scale,t._lscale),Dn.fromRTS(t._mat,t._rot,t._pos,t._scale));t._transformFlags=om.NONE,e=t}}},e.setPosition=function(t,e,i){void 0===e&&void 0===i?hn.copy(this._lpos,t):void 0===i?hn.set(this._lpos,t,e,this._lpos.z):hn.set(this._lpos,t,e,i),this.invalidateChildren(om.POSITION),1&this._eventMask&&this.emit(um.TRANSFORM_CHANGED,om.POSITION)},e.getPosition=function(t){return t?hn.set(t,this._lpos.x,this._lpos.y,this._lpos.z):hn.copy(new hn,this._lpos)},e.setRotation=function(t,e,i,n){void 0===e||void 0===i||void 0===n?En.copy(this._lrot,t):En.set(this._lrot,t,e,i,n),this._eulerDirty=!0,this.invalidateChildren(om.ROTATION),1&this._eventMask&&this.emit(um.TRANSFORM_CHANGED,om.ROTATION)},e.setRotationFromEuler=function(t,e,i){var n=void 0===i?this._euler.z:i;void 0===e?(hn.copy(this._euler,t),En.fromEuler(this._lrot,t.x,t.y,t.z)):(hn.set(this._euler,t,e,n),En.fromEuler(this._lrot,t,e,n)),this._eulerDirty=!1,this.invalidateChildren(om.ROTATION),1&this._eventMask&&this.emit(um.TRANSFORM_CHANGED,om.ROTATION)},e.getRotation=function(t){return t?En.set(t,this._lrot.x,this._lrot.y,this._lrot.z,this._lrot.w):En.copy(new En,this._lrot)},e.setScale=function(t,e,i){void 0===e&&void 0===i?hn.copy(this._lscale,t):void 0===i?hn.set(this._lscale,t,e,this._lscale.z):hn.set(this._lscale,t,e,i),this.invalidateChildren(om.SCALE),1&this._eventMask&&this.emit(um.TRANSFORM_CHANGED,om.SCALE)},e.getScale=function(t){return t?hn.set(t,this._lscale.x,this._lscale.y,this._lscale.z):hn.copy(new hn,this._lscale)},e.inverseTransformPoint=function(t,e){hn.copy(t,e);for(var i=this,n=0;i._parent;)Qm[n++]=i,i=i._parent;for(;n>=0;)hn.transformInverseRTS(t,t,i._lrot,i._lpos,i._lscale),i=Qm[--n];return t},e.setWorldPosition=function(t,e,i){void 0===e||void 0===i?hn.copy(this._pos,t):hn.set(this._pos,t,e,i);var n=this._parent,r=this._lpos;n?(n.updateWorldTransform(),hn.transformMat4(r,this._pos,Dn.invert(Km,n._mat))):hn.copy(r,this._pos),this.invalidateChildren(om.POSITION),1&this._eventMask&&this.emit(um.TRANSFORM_CHANGED,om.POSITION)},e.getWorldPosition=function(t){return this.updateWorldTransform(),t?hn.copy(t,this._pos):hn.copy(new hn,this._pos)},e.setWorldRotation=function(t,e,i,n){void 0===e||void 0===i||void 0===n?En.copy(this._rot,t):En.set(this._rot,t,e,i,n),this._parent?(this._parent.updateWorldTransform(),En.multiply(this._lrot,En.conjugate(this._lrot,this._parent._rot),this._rot)):En.copy(this._lrot,this._rot),this._eulerDirty=!0,this.invalidateChildren(om.ROTATION),1&this._eventMask&&this.emit(um.TRANSFORM_CHANGED,om.ROTATION)},e.setWorldRotationFromEuler=function(t,e,i){En.fromEuler(this._rot,t,e,i),this._parent?(this._parent.updateWorldTransform(),En.multiply(this._lrot,En.conjugate(this._lrot,this._parent._rot),this._rot)):En.copy(this._lrot,this._rot),this._eulerDirty=!0,this.invalidateChildren(om.ROTATION),1&this._eventMask&&this.emit(um.TRANSFORM_CHANGED,om.ROTATION)},e.getWorldRotation=function(t){return this.updateWorldTransform(),t?En.copy(t,this._rot):En.copy(new En,this._rot)},e.setWorldScale=function(t,e,i){var n=this._parent;n&&this.updateWorldTransform(),void 0===e||void 0===i?hn.copy(this._scale,t):hn.set(this._scale,t,e,i),n?(Pm.x=this._scale.x/hn.set(Bm,this._mat.m00,this._mat.m01,this._mat.m02).length(),Pm.y=this._scale.y/hn.set(Bm,this._mat.m04,this._mat.m05,this._mat.m06).length(),Pm.z=this._scale.z/hn.set(Bm,this._mat.m08,this._mat.m09,this._mat.m10).length(),Dn.scale(Km,this._mat,Pm),Dn.multiply(qm,Dn.invert(qm,n._mat),Km),vn.fromQuat(km,En.conjugate(Fm,this._lrot)),vn.multiplyMat4(km,km,qm),this._lscale.x=hn.set(Pm,km.m00,km.m01,km.m02).length(),this._lscale.y=hn.set(Pm,km.m03,km.m04,km.m05).length(),this._lscale.z=hn.set(Pm,km.m06,km.m07,km.m08).length()):hn.copy(this._lscale,this._scale),this.invalidateChildren(om.SCALE),1&this._eventMask&&this.emit(um.TRANSFORM_CHANGED,om.SCALE)},e.getWorldScale=function(t){return this.updateWorldTransform(),t?hn.copy(t,this._scale):hn.copy(new hn,this._scale)},e.getWorldMatrix=function(t){this.updateWorldTransform();var e=t||new Dn;return Dn.copy(e,this._mat)},e.getWorldRS=function(t){this.updateWorldTransform();var e=t||new Dn;return Dn.copy(e,this._mat),e.m12=0,e.m13=0,e.m14=0,e},e.getWorldRT=function(t){this.updateWorldTransform();var e=t||new Dn;return Dn.fromRT(e,this._rot,this._pos)},e.setRTS=function(t,e,i){var n=0;t&&(n|=om.ROTATION,void 0!==t.w?(En.copy(this._lrot,t),this._eulerDirty=!0):(hn.copy(this._euler,t),En.fromEuler(this._lrot,t.x,t.y,t.z),this._eulerDirty=!1)),e&&(hn.copy(this._lpos,e),n|=om.POSITION),i&&(hn.copy(this._lscale,i),n|=om.SCALE),n&&(this.invalidateChildren(n),1&this._eventMask&&this.emit(um.TRANSFORM_CHANGED,n))},e.isTransformDirty=function(){return this._transformFlags!==om.NONE},e.pauseSystemEvents=function(t){this._eventProcessor.setEnabled(!1,t)},e.resumeSystemEvents=function(t){this._eventProcessor.setEnabled(!0,t)},i.resetHasChangedFlags=function(){Jm+=1},i.clearNodeArray=function(){i.ClearFrame<i.ClearRound?i.ClearFrame++:(i.ClearFrame=0,Qm.length=0)},e.getPathInHierarchy=function(){for(var t=this.name,e=this.parent;e&&!(e instanceof v.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&Im)>0},set:function(t){t?this._objFlags|=Im:this._objFlags&=~Im}},{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&&v.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&&(En.toEuler(this._euler,this._lrot),this._eulerDirty=!1),this._euler},set:function(t){this.setRotationFromEuler(t.x,t.y,t.z)}},{key:"angle",get:function(){return this._euler.z},set:function(t){hn.set(this._euler,0,0,t),En.fromAngleZ(this._lrot,t),this._eulerDirty=!1,this.invalidateChildren(om.ROTATION),1&this._eventMask&&this.emit(um.TRANSFORM_CHANGED,om.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){Dn.toRTS(t,this._lrot,this._lpos,this._lscale),this.invalidateChildren(om.TRS),this._eulerDirty=!0,1&this._eventMask&&this.emit(um.TRANSFORM_CHANGED,om.TRS)}},{key:"worldMatrix",get:function(){return this.updateWorldTransform(),this._mat}},{key:"forward",get:function(){return hn.transformQuat(new hn,hn.FORWARD,this.worldRotation)},set:function(t){var e=t.length();hn.multiplyScalar(Pm,t,-1/e),En.fromViewUp(Nm,Pm),this.setWorldRotation(Nm)}},{key:"up",get:function(){return hn.transformQuat(new hn,hn.UP,this.worldRotation)}},{key:"right",get:function(){return hn.transformQuat(new hn,hn.RIGHT,this.worldRotation)}},{key:"mobility",get:function(){return this._mobility},set:function(t){this._mobility=t,this.emit(um.MOBILITY_CHANGED)}},{key:"layer",get:function(){return this._layer},set:function(t){this._layer=t,this._uiProps&&this._uiProps.uiComp&&(this._uiProps.uiComp.setNodeDirty(),this._uiProps.uiComp.markForUpdateRenderData()),this.emit(um.LAYER_CHANGED,this._layer)}},{key:"flagChangedVersion",get:function(){return this._flagChangeVersion}},{key:"hasChangedFlags",get:function(){return this._flagChangeVersion===Jm?this._hasChangedFlags:0},set:function(t){this._flagChangeVersion=Jm,this._hasChangedFlags=t}}]),i}(Wa)).idGenerator=Dm,Cm._stacks=[[]],Cm._stackId=0,Cm.EventType=um,Cm.NodeSpace=am,Cm.TransformDirtyBit=om,Cm.TransformBit=om,Cm.reserveContentsForAllSyncablePrefabTag=Zm,Cm.ClearFrame=0,Cm.ClearRound=1e3,f((fm=Cm).prototype,"_persistNode",[$s],Object.getOwnPropertyDescriptor(fm.prototype,"_persistNode"),fm.prototype),pm=Gs(fm.prototype,"_parent",[ra],(function(){return null})),mm=Gs(fm.prototype,"_children",[ra],(function(){return[]})),gm=Gs(fm.prototype,"_active",[ra],(function(){return!0})),vm=Gs(fm.prototype,"_components",[ra],(function(){return[]})),ym=Gs(fm.prototype,"_prefab",[ra],(function(){return null})),Tm=Gs(fm.prototype,"_lpos",[ra],(function(){return new hn})),Sm=Gs(fm.prototype,"_lrot",[ra],(function(){return new En})),Em=Gs(fm.prototype,"_lscale",[ra],(function(){return new hn(1,1,1)})),Am=Gs(fm.prototype,"_mobility",[ra],(function(){return wm.Static})),Rm=Gs(fm.prototype,"_layer",[ra],(function(){return sm.Enum.DEFAULT})),bm=Gs(fm.prototype,"_euler",[ra],(function(){return new hn})),f(fm.prototype,"eulerAngles",[cm],Object.getOwnPropertyDescriptor(fm.prototype,"eulerAngles"),fm.prototype),f(fm.prototype,"mobility",[_m],Object.getOwnPropertyDescriptor(fm.prototype,"mobility"),fm.prototype),dm=fm))||dm));v.Node=$m,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"}(jm||(jm={})),function(t){t[t.NONE=0]="NONE",t[t.AUTO=1]="AUTO",t[t.BAKED_CONVOLUTION_MAP=2]="BAKED_CONVOLUTION_MAP"}(Ym||(Ym={}));var tg=t("ef",qs("cc.TextureCube")(((Xm=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).isRGBE=Hm&&Hm(),e._mipmapAtlas=zm&&zm(),e._mipmapMode=Vm&&Vm(),e._mipmaps=Wm&&Wm(),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){eg(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===Ym.BAKED_CONVOLUTION_MAP},e.fromTexture2DArray=function(t,i){for(var n=[],r=t.length/6,s=0;s<r;s++){var a=6*s;n.push({front:t[a+jm.front].image,back:t[a+jm.back].image,left:t[a+jm.left].image,right:t[a+jm.right].image,top:t[a+jm.top].image,bottom:t[a+jm.bottom].image})}return(i=i||new e).mipmaps=n,i},i.onLoaded=function(){this._mipmapMode===Ym.BAKED_CONVOLUTION_MAP?this.mipmapAtlas=this._mipmapAtlas:this.mipmaps=this._mipmaps},i.reset=function(t){this._width=t.width,this._height=t.height,this._setGFXFormat(t.format);var e=void 0===t.mipmapLevel?1:t.mipmapLevel;this._setMipmapLevel(e);var i=void 0===t.baseLevel?0:t.baseLevel,n=void 0===t.maxLevel?1e3:t.maxLevel;this._setMipRange(i,n),this._tryReset()},i.updateMipmaps=function(t,e){var i=this;if(void 0===t&&(t=0),!(t>=this._generatedMipmaps.length))for(var n=Math.min(void 0===e?this._generatedMipmaps.length:e,this._generatedMipmaps.length-t),r=function(){var e=t+s;eg(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===Ym.BAKED_CONVOLUTION_MAP){var r=n.mipmapAtlas,s=n.mipmapLayout;this._mipmapAtlas={atlas:{},layout:s},this._mipmapAtlas.atlas={front:new Df,back:new Df,left:new Df,right:new Df,top:new Df,bottom:new Df};var a=re(Df);i.result.push(this._mipmapAtlas.atlas,"front",r.front,a),i.result.push(this._mipmapAtlas.atlas,"back",r.back,a),i.result.push(this._mipmapAtlas.atlas,"left",r.left,a),i.result.push(this._mipmapAtlas.atlas,"right",r.right,a),i.result.push(this._mipmapAtlas.atlas,"top",r.top,a),i.result.push(this._mipmapAtlas.atlas,"bottom",r.bottom,a)}else{this._mipmaps=new Array(n.mipmaps.length);for(var o=0;o<n.mipmaps.length;++o){this._mipmaps[o]={front:new Df,back:new Df,left:new Df,right:new Df,top:new Df,bottom:new Df};var h=n.mipmaps[o],u=re(Df);i.result.push(this._mipmaps[o],"front",h.front,u),i.result.push(this._mipmaps[o],"back",h.back,u),i.result.push(this._mipmaps[o],"left",h.left,u),i.result.push(this._mipmaps[o],"right",h.right,u),i.result.push(this._mipmaps[o],"top",h.top,u),i.result.push(this._mipmaps[o],"bottom",h.bottom,u)}}},i._getGfxTextureCreateInfo=function(t){var e=new t_($l.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 e_;return e.type=$l.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}),eg(this._mipmapAtlas.atlas,(function(i,n){var r=new em;r.image=i,r.reset({width:i.width,height:i.height,format:i.format}),r.uploadData(i.data);for(var s=0;s<e.length;s++){var a=e[s],o=r.getGFXTexture().size,h=new Uint8Array(o),u=new Vc;u.texOffset.x=a.left,u.texOffset.y=a.top,u.texExtent.width=a.width,u.texExtent.height=a.height,t._getGFXDevice().copyTextureToBuffers(r.getGFXTexture(),[h],[u]);var l=new Df({_data:h,_compressed:i.isCompressed,width:a.width,height:a.height,format:i.format});t._assignImage(l,a.level,n)}}))},i.initDefault=function(e){t.prototype.initDefault.call(this,e);var i=new Df;i.initDefault(),this.mipmaps=[{front:i,back:i,top:i,bottom:i,left:i,right:i}]},i.validate=function(){if(this._mipmapMode===Ym.BAKED_CONVOLUTION_MAP){if(null===this.mipmapAtlas||0===this.mipmapAtlas.layout.length)return!1;var t=this.mipmapAtlas.atlas;return!!(t.top&&t.bottom&&t.front&&t.back&&t.left&&t.right)}return 0!==this._mipmaps.length&&!this._mipmaps.find((function(t){return!(t.top&&t.bottom&&t.front&&t.back&&t.left&&t.right)}))},n(e,[{key:"mipmaps",get:function(){return this._mipmaps},set:function(t){this._mipmaps=t;var e=[];if(1===t.length){var i=t[0],n=i.front.extractMipmaps(),r=i.back.extractMipmaps(),s=i.left.extractMipmaps(),a=i.right.extractMipmaps(),o=i.top.extractMipmaps(),h=i.bottom.extractMipmaps();if(n.length!==r.length||n.length!==s.length||n.length!==a.length||n.length!==o.length||n.length!==h.length)return console.error("The number of mipmaps of each face is different."),void this._setMipmapParams([]);for(var u=n.length,l=0;l<u;++l){var c={front:n[l],back:r[l],left:s[l],right:a[l],top:o[l],bottom:h[l]};e.push(c)}}else t.length>1&&t.forEach((function(t){var i={front:t.front.extractMipmap0(),back:t.back.extractMipmap0(),left:t.left.extractMipmap0(),right:t.right.extractMipmap0(),top:t.top.extractMipmap0(),bottom:t.bottom.extractMipmap0()};e.push(i)}));this._setMipmapParams(e)}},{key:"mipmapAtlas",get:function(){return this._mipmapAtlas},set:function(t){var e=this;if(this._mipmapAtlas=t,this._mipmapAtlas){var i=this._mipmapAtlas.atlas.front;if(i.data){var n=this._mipmapAtlas.atlas,r=this._mipmapAtlas.layout,s=r[0],a=Object.assign(T.document.createElement("canvas"),{width:i.width,height:i.height}).getContext("2d");this.reset({width:s.width,height:s.height,format:i.format,mipmapLevel:r.length});for(var o=function(){var t=r[h];eg(n,(function(n,r){a.clearRect(0,0,i.width,i.height);var s=n.data;a.drawImage(s,0,0);var o=a.getImageData(t.left,t.top,t.width,t.height),h=new Df({_data:o.data,_compressed:n.isCompressed,width:o.width,height:o.height,format:n.format});e._assignImage(h,t.level,r)}))},h=0;h<r.length;h++)o()}}else this.reset({width:0,height:0,mipmapLevel:0})}},{key:"image",get:function(){return 0===this._mipmaps.length?null:this._mipmaps[0]},set:function(t){this.mipmaps=t?[t]:[]}}]),e}(tm)).FaceIndex=jm,Hm=Gs((Gm=Xm).prototype,"isRGBE",[ra],(function(){return!1})),zm=Gs(Gm.prototype,"_mipmapAtlas",[ra],(function(){return null})),Vm=Gs(Gm.prototype,"_mipmapMode",[ra],(function(){return Ym.NONE})),Wm=Gs(Gm.prototype,"_mipmaps",[ra],(function(){return[]})),Um=Gm))||Um);function eg(t,e){e(t.front,jm.front),e(t.back,jm.back),e(t.left,jm.left),e(t.right,jm.right),e(t.top,jm.top),e(t.bottom,jm.bottom)}v.TextureCube=tg;var ig,ng,rg,sg,ag,og,hg,ug,lg,cg,_g,dg,fg,pg,mg=function(){function t(){this._groundAlbedoHDR=new nn(.2,.2,.2,1),this._skyColorHDR=new nn(.2,.5,.8,1),this._skyIllumHDR=0,this._groundAlbedoLDR=new nn(.2,.2,.2,1),this._skyColorLDR=new nn(.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 v.director.root.pipeline.pipelineSceneData.isHDR?this._skyColorHDR:this._skyColorLDR},set:function(t){v.director.root.pipeline.pipelineSceneData.isHDR?this._skyColorHDR.set(t):this._skyColorLDR.set(t)}},{key:"skyIllum",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR?this._skyIllumHDR:this._skyIllumLDR},set:function(t){v.director.root.pipeline.pipelineSceneData.isHDR?this._skyIllumHDR=t:this._skyIllumLDR=t}},{key:"groundAlbedo",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR?this._groundAlbedoHDR:this._groundAlbedoLDR},set:function(t){v.director.root.pipeline.pipelineSceneData.isHDR?this._groundAlbedoHDR.set(t):this._groundAlbedoLDR.set(t)}}]),t}();mg.SUN_ILLUM=65e3,mg.SKY_ILLUM=2e4,v.Ambient=mg;var gg,vg,yg="MainFlow",Tg="ForwardFlow",Sg="ShadowFlow";!function(t){t[t.DEFAULT=100]="DEFAULT",t[t.UI=200]="UI"}(gg||(gg={})),v.RenderPassStage=gg,function(t){t[t.MIN=0]="MIN",t[t.MAX=255]="MAX",t[t.DEFAULT=128]="DEFAULT"}(vg||(vg={}));var Eg,Ag={bindings:[],layouts:{}},Rg={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"}(Eg||(Eg={}));var bg,Cg=Eg.SAMPLER_SHADOWMAP,wg=Eg.COUNT-Cg;!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"}(bg||(bg={}));var xg,Ig=bg.SAMPLER_JOINTS,Og=bg.STORAGE_REFLECTION-Ig,Dg=bg.COUNT-Ig-Og;!function(t){t[t.GLOBAL=0]="GLOBAL",t[t.MATERIAL=1]="MATERIAL",t[t.LOCAL=2]="LOCAL",t[t.COUNT=3]="COUNT"}(xg||(xg={}));var Mg=new jc([Cg,0,Ig,0],[wg,0,Og,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,Dg,0],[0,0,0,0],[0,2,1,3]),Pg=function(){};ig=Pg,Pg.TIME_OFFSET=0,Pg.SCREEN_SIZE_OFFSET=ig.TIME_OFFSET+4,Pg.NATIVE_SIZE_OFFSET=ig.SCREEN_SIZE_OFFSET+4,Pg.PROBE_INFO_OFFSET=ig.NATIVE_SIZE_OFFSET+4,Pg.DEBUG_VIEW_MODE_OFFSET=ig.PROBE_INFO_OFFSET+4,Pg.COUNT=ig.DEBUG_VIEW_MODE_OFFSET+4,Pg.SIZE=4*ig.COUNT,Pg.NAME="CCGlobal",Pg.BINDING=Eg.UBO_GLOBAL,Pg.DESCRIPTOR=new R_(ig.BINDING,Rc.UNIFORM_BUFFER,1,_c.ALL),Pg.LAYOUT=new r_(xg.GLOBAL,ig.BINDING,ig.NAME,[new n_("cc_time",Kl.FLOAT4,1),new n_("cc_screenSize",Kl.FLOAT4,1),new n_("cc_nativeSize",Kl.FLOAT4,1),new n_("cc_probeInfo",Kl.FLOAT4,1),new n_("cc_debug_view_mode",Kl.FLOAT4,1)],1),Ag.layouts[Pg.NAME]=Pg.LAYOUT,Ag.bindings[Pg.BINDING]=Pg.DESCRIPTOR;var Bg=function(){};ng=Bg,Bg.MAT_VIEW_OFFSET=0,Bg.MAT_VIEW_INV_OFFSET=ng.MAT_VIEW_OFFSET+16,Bg.MAT_PROJ_OFFSET=ng.MAT_VIEW_INV_OFFSET+16,Bg.MAT_PROJ_INV_OFFSET=ng.MAT_PROJ_OFFSET+16,Bg.MAT_VIEW_PROJ_OFFSET=ng.MAT_PROJ_INV_OFFSET+16,Bg.MAT_VIEW_PROJ_INV_OFFSET=ng.MAT_VIEW_PROJ_OFFSET+16,Bg.CAMERA_POS_OFFSET=ng.MAT_VIEW_PROJ_INV_OFFSET+16,Bg.SURFACE_TRANSFORM_OFFSET=ng.CAMERA_POS_OFFSET+4,Bg.SCREEN_SCALE_OFFSET=ng.SURFACE_TRANSFORM_OFFSET+4,Bg.EXPOSURE_OFFSET=ng.SCREEN_SCALE_OFFSET+4,Bg.MAIN_LIT_DIR_OFFSET=ng.EXPOSURE_OFFSET+4,Bg.MAIN_LIT_COLOR_OFFSET=ng.MAIN_LIT_DIR_OFFSET+4,Bg.AMBIENT_SKY_OFFSET=ng.MAIN_LIT_COLOR_OFFSET+4,Bg.AMBIENT_GROUND_OFFSET=ng.AMBIENT_SKY_OFFSET+4,Bg.GLOBAL_FOG_COLOR_OFFSET=ng.AMBIENT_GROUND_OFFSET+4,Bg.GLOBAL_FOG_BASE_OFFSET=ng.GLOBAL_FOG_COLOR_OFFSET+4,Bg.GLOBAL_FOG_ADD_OFFSET=ng.GLOBAL_FOG_BASE_OFFSET+4,Bg.NEAR_FAR_OFFSET=ng.GLOBAL_FOG_ADD_OFFSET+4,Bg.VIEW_PORT_OFFSET=ng.NEAR_FAR_OFFSET+4,Bg.COUNT=ng.VIEW_PORT_OFFSET+4,Bg.SIZE=4*ng.COUNT,Bg.NAME="CCCamera",Bg.BINDING=Eg.UBO_CAMERA,Bg.DESCRIPTOR=new R_(ng.BINDING,Rc.UNIFORM_BUFFER,1,_c.ALL),Bg.LAYOUT=new r_(xg.GLOBAL,ng.BINDING,ng.NAME,[new n_("cc_matView",Kl.MAT4,1),new n_("cc_matViewInv",Kl.MAT4,1),new n_("cc_matProj",Kl.MAT4,1),new n_("cc_matProjInv",Kl.MAT4,1),new n_("cc_matViewProj",Kl.MAT4,1),new n_("cc_matViewProjInv",Kl.MAT4,1),new n_("cc_cameraPos",Kl.FLOAT4,1),new n_("cc_surfaceTransform",Kl.FLOAT4,1),new n_("cc_screenScale",Kl.FLOAT4,1),new n_("cc_exposure",Kl.FLOAT4,1),new n_("cc_mainLitDir",Kl.FLOAT4,1),new n_("cc_mainLitColor",Kl.FLOAT4,1),new n_("cc_ambientSky",Kl.FLOAT4,1),new n_("cc_ambientGround",Kl.FLOAT4,1),new n_("cc_fogColor",Kl.FLOAT4,1),new n_("cc_fogBase",Kl.FLOAT4,1),new n_("cc_fogAdd",Kl.FLOAT4,1),new n_("cc_nearFar",Kl.FLOAT4,1),new n_("cc_viewPort",Kl.FLOAT4,1)],1),Ag.layouts[Bg.NAME]=Bg.LAYOUT,Ag.bindings[Bg.BINDING]=Bg.DESCRIPTOR;var Ng=function(){};rg=Ng,Ng.MAT_LIGHT_VIEW_OFFSET=0,Ng.MAT_LIGHT_VIEW_PROJ_OFFSET=rg.MAT_LIGHT_VIEW_OFFSET+16,Ng.SHADOW_INV_PROJ_DEPTH_INFO_OFFSET=rg.MAT_LIGHT_VIEW_PROJ_OFFSET+16,Ng.SHADOW_PROJ_DEPTH_INFO_OFFSET=rg.SHADOW_INV_PROJ_DEPTH_INFO_OFFSET+4,Ng.SHADOW_PROJ_INFO_OFFSET=rg.SHADOW_PROJ_DEPTH_INFO_OFFSET+4,Ng.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET=rg.SHADOW_PROJ_INFO_OFFSET+4,Ng.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET=rg.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET+4,Ng.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET=rg.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+4,Ng.SHADOW_COLOR_OFFSET=rg.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+4,Ng.PLANAR_NORMAL_DISTANCE_INFO_OFFSET=rg.SHADOW_COLOR_OFFSET+4,Ng.COUNT=rg.PLANAR_NORMAL_DISTANCE_INFO_OFFSET+4,Ng.SIZE=4*rg.COUNT,Ng.NAME="CCShadow",Ng.BINDING=Eg.UBO_SHADOW,Ng.DESCRIPTOR=new R_(rg.BINDING,Rc.UNIFORM_BUFFER,1,_c.ALL),Ng.LAYOUT=new r_(xg.GLOBAL,rg.BINDING,rg.NAME,[new n_("cc_matLightView",Kl.MAT4,1),new n_("cc_matLightViewProj",Kl.MAT4,1),new n_("cc_shadowInvProjDepthInfo",Kl.FLOAT4,1),new n_("cc_shadowProjDepthInfo",Kl.FLOAT4,1),new n_("cc_shadowProjInfo",Kl.FLOAT4,1),new n_("cc_shadowNFLSInfo",Kl.FLOAT4,1),new n_("cc_shadowWHPBInfo",Kl.FLOAT4,1),new n_("cc_shadowLPNNInfo",Kl.FLOAT4,1),new n_("cc_shadowColor",Kl.FLOAT4,1),new n_("cc_planarNDInfo",Kl.FLOAT4,1)],1),Ag.layouts[Ng.NAME]=Ng.LAYOUT,Ag.bindings[Ng.BINDING]=Ng.DESCRIPTOR;var Lg=function(){};sg=Lg,Lg.CSM_LEVEL_COUNT=4,Lg.CSM_VIEW_DIR_0_OFFSET=0,Lg.CSM_VIEW_DIR_1_OFFSET=sg.CSM_VIEW_DIR_0_OFFSET+4*sg.CSM_LEVEL_COUNT,Lg.CSM_VIEW_DIR_2_OFFSET=sg.CSM_VIEW_DIR_1_OFFSET+4*sg.CSM_LEVEL_COUNT,Lg.CSM_ATLAS_OFFSET=sg.CSM_VIEW_DIR_2_OFFSET+4*sg.CSM_LEVEL_COUNT,Lg.MAT_CSM_VIEW_PROJ_OFFSET=sg.CSM_ATLAS_OFFSET+4*sg.CSM_LEVEL_COUNT,Lg.CSM_PROJ_DEPTH_INFO_OFFSET=sg.MAT_CSM_VIEW_PROJ_OFFSET+16*sg.CSM_LEVEL_COUNT,Lg.CSM_PROJ_INFO_OFFSET=sg.CSM_PROJ_DEPTH_INFO_OFFSET+4*sg.CSM_LEVEL_COUNT,Lg.CSM_SPLITS_INFO_OFFSET=sg.CSM_PROJ_INFO_OFFSET+4*sg.CSM_LEVEL_COUNT,Lg.COUNT=sg.CSM_SPLITS_INFO_OFFSET+4,Lg.SIZE=4*sg.COUNT,Lg.NAME="CCCSM",Lg.BINDING=Eg.UBO_CSM,Lg.DESCRIPTOR=new R_(sg.BINDING,Rc.UNIFORM_BUFFER,1,_c.FRAGMENT),Lg.LAYOUT=new r_(xg.GLOBAL,sg.BINDING,sg.NAME,[new n_("cc_csmViewDir0",Kl.FLOAT4,sg.CSM_LEVEL_COUNT),new n_("cc_csmViewDir1",Kl.FLOAT4,sg.CSM_LEVEL_COUNT),new n_("cc_csmViewDir2",Kl.FLOAT4,sg.CSM_LEVEL_COUNT),new n_("cc_csmAtlas",Kl.FLOAT4,sg.CSM_LEVEL_COUNT),new n_("cc_matCSMViewProj",Kl.MAT4,sg.CSM_LEVEL_COUNT),new n_("cc_csmProjDepthInfo",Kl.FLOAT4,sg.CSM_LEVEL_COUNT),new n_("cc_csmProjInfo",Kl.FLOAT4,sg.CSM_LEVEL_COUNT),new n_("cc_csmSplitsInfo",Kl.FLOAT4,1)],1),Ag.layouts[Lg.NAME]=Lg.LAYOUT,Ag.bindings[Lg.BINDING]=Lg.DESCRIPTOR;var Fg=Eg.SAMPLER_SHADOWMAP,kg=new R_(Fg,Rc.SAMPLER_TEXTURE,1,_c.FRAGMENT),Ug=new s_(xg.GLOBAL,Fg,"cc_shadowMap",Kl.SAMPLER2D,1);Ag.layouts.cc_shadowMap=Ug,Ag.bindings[Fg]=kg;var Gg=Eg.SAMPLER_ENVIRONMENT,Hg=new R_(Gg,Rc.SAMPLER_TEXTURE,1,_c.FRAGMENT),zg=new s_(xg.GLOBAL,Gg,"cc_environment",Kl.SAMPLER_CUBE,1);Ag.layouts.cc_environment=zg,Ag.bindings[Gg]=Hg;var Vg=Eg.SAMPLER_DIFFUSEMAP,Wg=new R_(Vg,Rc.SAMPLER_TEXTURE,1,_c.FRAGMENT),Xg=new s_(xg.GLOBAL,Vg,"cc_diffuseMap",Kl.SAMPLER_CUBE,1);Ag.layouts.cc_diffuseMap=Xg,Ag.bindings[Vg]=Wg;var jg=Eg.SAMPLER_SPOT_SHADOW_MAP,Yg=new R_(jg,Rc.SAMPLER_TEXTURE,1,_c.FRAGMENT),Kg=new s_(xg.GLOBAL,jg,"cc_spotShadowMap",Kl.SAMPLER2D,1);Ag.layouts.cc_spotShadowMap=Kg,Ag.bindings[jg]=Yg;var qg=function(){};ag=qg,qg.MAT_WORLD_OFFSET=0,qg.MAT_WORLD_IT_OFFSET=ag.MAT_WORLD_OFFSET+16,qg.LIGHTINGMAP_UVPARAM=ag.MAT_WORLD_IT_OFFSET+16,qg.LOCAL_SHADOW_BIAS=ag.LIGHTINGMAP_UVPARAM+4,qg.REFLECTION_PROBE_DATA1=ag.LOCAL_SHADOW_BIAS+4,qg.REFLECTION_PROBE_DATA2=ag.REFLECTION_PROBE_DATA1+4,qg.REFLECTION_PROBE_BLEND_DATA1=ag.REFLECTION_PROBE_DATA2+4,qg.REFLECTION_PROBE_BLEND_DATA2=ag.REFLECTION_PROBE_BLEND_DATA1+4,qg.COUNT=ag.REFLECTION_PROBE_BLEND_DATA2+4,qg.SIZE=4*ag.COUNT,qg.NAME="CCLocal",qg.BINDING=bg.UBO_LOCAL,qg.DESCRIPTOR=new R_(ag.BINDING,Rc.UNIFORM_BUFFER,1,_c.VERTEX|_c.FRAGMENT|_c.COMPUTE),qg.LAYOUT=new r_(xg.LOCAL,ag.BINDING,ag.NAME,[new n_("cc_matWorld",Kl.MAT4,1),new n_("cc_matWorldIT",Kl.MAT4,1),new n_("cc_lightingMapUVParam",Kl.FLOAT4,1),new n_("cc_localShadowBias",Kl.FLOAT4,1),new n_("cc_reflectionProbeData1",Kl.FLOAT4,1),new n_("cc_reflectionProbeData2",Kl.FLOAT4,1),new n_("cc_reflectionProbeBlendData1",Kl.FLOAT4,1),new n_("cc_reflectionProbeBlendData2",Kl.FLOAT4,1)],1),Rg.layouts[qg.NAME]=qg.LAYOUT,Rg.bindings[qg.BINDING]=qg.DESCRIPTOR;var Qg=function(){};og=Qg,Qg.WORLD_BOUND_CENTER=0,Qg.WORLD_BOUND_HALF_EXTENTS=og.WORLD_BOUND_CENTER+4,Qg.COUNT=og.WORLD_BOUND_HALF_EXTENTS+4,Qg.SIZE=4*og.COUNT,Qg.NAME="CCWorldBound",Qg.BINDING=bg.UBO_LOCAL,Qg.DESCRIPTOR=new R_(og.BINDING,Rc.UNIFORM_BUFFER,1,_c.VERTEX|_c.COMPUTE),Qg.LAYOUT=new r_(xg.LOCAL,og.BINDING,og.NAME,[new n_("cc_worldBoundCenter",Kl.FLOAT4,1),new n_("cc_worldBoundHalfExtents",Kl.FLOAT4,1)],1),Rg.layouts[Qg.NAME]=Qg.LAYOUT,Rg.bindings[Qg.BINDING]=Qg.DESCRIPTOR;var Zg="a_matWorld0",Jg="a_sh_linear_const_r",$g=function(){};hg=$g,$g.BATCHING_COUNT=10,$g.MAT_WORLDS_OFFSET=0,$g.COUNT=16*hg.BATCHING_COUNT,$g.SIZE=4*hg.COUNT,$g.NAME="CCLocalBatched",$g.BINDING=bg.UBO_LOCAL,$g.DESCRIPTOR=new R_(hg.BINDING,Rc.UNIFORM_BUFFER,1,_c.VERTEX|_c.COMPUTE),$g.LAYOUT=new r_(xg.LOCAL,hg.BINDING,hg.NAME,[new n_("cc_matWorlds",Kl.MAT4,hg.BATCHING_COUNT)],1),Rg.layouts[$g.NAME]=$g.LAYOUT,Rg.bindings[$g.BINDING]=$g.DESCRIPTOR;var tv=function(){};ug=tv,tv.LIGHTS_PER_PASS=1,tv.LIGHT_POS_OFFSET=0,tv.LIGHT_COLOR_OFFSET=ug.LIGHT_POS_OFFSET+4*ug.LIGHTS_PER_PASS,tv.LIGHT_SIZE_RANGE_ANGLE_OFFSET=ug.LIGHT_COLOR_OFFSET+4*ug.LIGHTS_PER_PASS,tv.LIGHT_DIR_OFFSET=ug.LIGHT_SIZE_RANGE_ANGLE_OFFSET+4*ug.LIGHTS_PER_PASS,tv.LIGHT_BOUNDING_SIZE_VS_OFFSET=ug.LIGHT_DIR_OFFSET+4*ug.LIGHTS_PER_PASS,tv.COUNT=ug.LIGHT_BOUNDING_SIZE_VS_OFFSET+4*ug.LIGHTS_PER_PASS,tv.SIZE=4*ug.COUNT,tv.NAME="CCForwardLight",tv.BINDING=bg.UBO_FORWARD_LIGHTS,tv.DESCRIPTOR=new R_(ug.BINDING,Rc.DYNAMIC_UNIFORM_BUFFER,1,_c.FRAGMENT),tv.LAYOUT=new r_(xg.LOCAL,ug.BINDING,ug.NAME,[new n_("cc_lightPos",Kl.FLOAT4,ug.LIGHTS_PER_PASS),new n_("cc_lightColor",Kl.FLOAT4,ug.LIGHTS_PER_PASS),new n_("cc_lightSizeRangeAngle",Kl.FLOAT4,ug.LIGHTS_PER_PASS),new n_("cc_lightDir",Kl.FLOAT4,ug.LIGHTS_PER_PASS),new n_("cc_lightBoundingSizeVS",Kl.FLOAT4,ug.LIGHTS_PER_PASS)],1),Rg.layouts[tv.NAME]=tv.LAYOUT,Rg.bindings[tv.BINDING]=tv.DESCRIPTOR;var ev=function(){};ev.LIGHTS_PER_PASS=10;var iv=function(){};lg=iv,iv.JOINTS_TEXTURE_INFO_OFFSET=0,iv.COUNT=lg.JOINTS_TEXTURE_INFO_OFFSET+4,iv.SIZE=4*lg.COUNT,iv.NAME="CCSkinningTexture",iv.BINDING=bg.UBO_SKINNING_TEXTURE,iv.DESCRIPTOR=new R_(lg.BINDING,Rc.UNIFORM_BUFFER,1,_c.VERTEX),iv.LAYOUT=new r_(xg.LOCAL,lg.BINDING,lg.NAME,[new n_("cc_jointTextureInfo",Kl.FLOAT4,1)],1),Rg.layouts[iv.NAME]=iv.LAYOUT,Rg.bindings[iv.BINDING]=iv.DESCRIPTOR;var nv=function(){};cg=nv,nv.JOINTS_ANIM_INFO_OFFSET=0,nv.COUNT=cg.JOINTS_ANIM_INFO_OFFSET+4,nv.SIZE=4*cg.COUNT,nv.NAME="CCSkinningAnimation",nv.BINDING=bg.UBO_SKINNING_ANIMATION,nv.DESCRIPTOR=new R_(cg.BINDING,Rc.UNIFORM_BUFFER,1,_c.VERTEX),nv.LAYOUT=new r_(xg.LOCAL,cg.BINDING,cg.NAME,[new n_("cc_jointAnimInfo",Kl.FLOAT4,1)],1),Rg.layouts[nv.NAME]=nv.LAYOUT,Rg.bindings[nv.BINDING]=nv.DESCRIPTOR;var rv="a_jointAnimInfo",sv=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 av(t){sv.initLayout(t),Rg.layouts[sv.NAME]=sv.LAYOUT,Rg.bindings[sv.BINDING]=sv.DESCRIPTOR}_g=sv,sv._jointUniformCapacity=0,sv._count=0,sv._size=0,sv.NAME="CCSkinning",sv.BINDING=bg.UBO_SKINNING_TEXTURE,sv.DESCRIPTOR=new R_(_g.BINDING,Rc.UNIFORM_BUFFER,1,_c.VERTEX),sv.LAYOUT=new r_(xg.LOCAL,_g.BINDING,_g.NAME,[new n_("cc_joints",Kl.FLOAT4,1)],1);var ov=function(){};dg=ov,ov.MAX_MORPH_TARGET_COUNT=60,ov.OFFSET_OF_WEIGHTS=0,ov.OFFSET_OF_DISPLACEMENT_TEXTURE_WIDTH=4*dg.MAX_MORPH_TARGET_COUNT,ov.OFFSET_OF_DISPLACEMENT_TEXTURE_HEIGHT=dg.OFFSET_OF_DISPLACEMENT_TEXTURE_WIDTH+4,ov.OFFSET_OF_VERTICES_COUNT=dg.OFFSET_OF_DISPLACEMENT_TEXTURE_HEIGHT+4,ov.COUNT_BASE_4_BYTES=4*Math.ceil(dg.MAX_MORPH_TARGET_COUNT/4)+4,ov.SIZE=4*dg.COUNT_BASE_4_BYTES,ov.NAME="CCMorph",ov.BINDING=bg.UBO_MORPH,ov.DESCRIPTOR=new R_(dg.BINDING,Rc.UNIFORM_BUFFER,1,_c.VERTEX),ov.LAYOUT=new r_(xg.LOCAL,dg.BINDING,dg.NAME,[new n_("cc_displacementWeights",Kl.FLOAT4,dg.MAX_MORPH_TARGET_COUNT/4),new n_("cc_displacementTextureInfo",Kl.FLOAT4,1)],1),Rg.layouts[ov.NAME]=ov.LAYOUT,Rg.bindings[ov.BINDING]=ov.DESCRIPTOR;var hv=function(){};fg=hv,hv.NAME="CCUILocal",hv.BINDING=bg.UBO_UI_LOCAL,hv.DESCRIPTOR=new R_(fg.BINDING,Rc.DYNAMIC_UNIFORM_BUFFER,1,_c.VERTEX),hv.LAYOUT=new r_(xg.LOCAL,fg.BINDING,fg.NAME,[new n_("cc_local_data",Kl.FLOAT4,1)],1),Rg.layouts[hv.NAME]=hv.LAYOUT,Rg.bindings[hv.BINDING]=hv.DESCRIPTOR;var uv=function(){};pg=uv,uv.SH_LINEAR_CONST_R_OFFSET=0,uv.SH_LINEAR_CONST_G_OFFSET=pg.SH_LINEAR_CONST_R_OFFSET+4,uv.SH_LINEAR_CONST_B_OFFSET=pg.SH_LINEAR_CONST_G_OFFSET+4,uv.SH_QUADRATIC_R_OFFSET=pg.SH_LINEAR_CONST_B_OFFSET+4,uv.SH_QUADRATIC_G_OFFSET=pg.SH_QUADRATIC_R_OFFSET+4,uv.SH_QUADRATIC_B_OFFSET=pg.SH_QUADRATIC_G_OFFSET+4,uv.SH_QUADRATIC_A_OFFSET=pg.SH_QUADRATIC_B_OFFSET+4,uv.COUNT=pg.SH_QUADRATIC_A_OFFSET+4,uv.SIZE=4*pg.COUNT,uv.NAME="CCSH",uv.BINDING=bg.UBO_SH,uv.DESCRIPTOR=new R_(pg.BINDING,Rc.UNIFORM_BUFFER,1,_c.FRAGMENT),uv.LAYOUT=new r_(xg.LOCAL,pg.BINDING,pg.NAME,[new n_("cc_sh_linear_const_r",Kl.FLOAT4,1),new n_("cc_sh_linear_const_g",Kl.FLOAT4,1),new n_("cc_sh_linear_const_b",Kl.FLOAT4,1),new n_("cc_sh_quadratic_r",Kl.FLOAT4,1),new n_("cc_sh_quadratic_g",Kl.FLOAT4,1),new n_("cc_sh_quadratic_b",Kl.FLOAT4,1),new n_("cc_sh_quadratic_a",Kl.FLOAT4,1)],1),Rg.layouts[uv.NAME]=uv.LAYOUT,Rg.bindings[uv.BINDING]=uv.DESCRIPTOR;var lv=bg.SAMPLER_JOINTS,cv=new R_(lv,Rc.SAMPLER_TEXTURE,1,_c.VERTEX),_v=new s_(xg.LOCAL,lv,"cc_jointTexture",Kl.SAMPLER2D,1);Rg.layouts.cc_jointTexture=_v,Rg.bindings[lv]=cv;var dv=bg.SAMPLER_JOINTS,fv=new R_(dv,Rc.SAMPLER_TEXTURE,1,_c.VERTEX),pv=new s_(xg.LOCAL,dv,"cc_realtimeJoint",Kl.SAMPLER2D,1);Rg.layouts.cc_realtimeJoint=pv,Rg.bindings[dv]=fv;var mv=bg.SAMPLER_MORPH_POSITION,gv=new R_(mv,Rc.SAMPLER_TEXTURE,1,_c.VERTEX),vv=new s_(xg.LOCAL,mv,"cc_PositionDisplacements",Kl.SAMPLER2D,1);Rg.layouts.cc_PositionDisplacements=vv,Rg.bindings[mv]=gv;var yv=bg.SAMPLER_MORPH_NORMAL,Tv=new R_(yv,Rc.SAMPLER_TEXTURE,1,_c.VERTEX),Sv=new s_(xg.LOCAL,yv,"cc_NormalDisplacements",Kl.SAMPLER2D,1);Rg.layouts.cc_NormalDisplacements=Sv,Rg.bindings[yv]=Tv;var Ev=bg.SAMPLER_MORPH_TANGENT,Av=new R_(Ev,Rc.SAMPLER_TEXTURE,1,_c.VERTEX),Rv=new s_(xg.LOCAL,Ev,"cc_TangentDisplacements",Kl.SAMPLER2D,1);Rg.layouts.cc_TangentDisplacements=Rv,Rg.bindings[Ev]=Av;var bv=bg.SAMPLER_LIGHTMAP,Cv=new R_(bv,Rc.SAMPLER_TEXTURE,1,_c.FRAGMENT),wv=new s_(xg.LOCAL,bv,"cc_lightingMap",Kl.SAMPLER2D,1);Rg.layouts.cc_lightingMap=wv,Rg.bindings[bv]=Cv;var xv=bg.SAMPLER_SPRITE,Iv=new R_(xv,Rc.SAMPLER_TEXTURE,1,_c.FRAGMENT),Ov=new s_(xg.LOCAL,xv,"cc_spriteTexture",Kl.SAMPLER2D,1);Rg.layouts.cc_spriteTexture=Ov,Rg.bindings[xv]=Iv;var Dv=bg.SAMPLER_REFLECTION,Mv=new R_(Dv,Rc.SAMPLER_TEXTURE,1,_c.FRAGMENT),Pv=new s_(xg.LOCAL,Dv,"cc_reflectionTexture",Kl.SAMPLER2D,1);Rg.layouts.cc_reflectionTexture=Pv,Rg.bindings[Dv]=Mv;var Bv=bg.STORAGE_REFLECTION,Nv=new R_(Bv,Rc.STORAGE_IMAGE,1,_c.COMPUTE),Lv=new h_(xg.LOCAL,Bv,"cc_reflectionStorage",Kl.IMAGE2D,1);Rg.layouts.cc_reflectionStorage=Lv,Rg.bindings[Bv]=Nv;var Fv=bg.SAMPLER_REFLECTION_PROBE_CUBE,kv=new R_(Fv,Rc.SAMPLER_TEXTURE,1,_c.FRAGMENT),Uv=new s_(xg.LOCAL,Fv,"cc_reflectionProbeCubemap",Kl.SAMPLER_CUBE,1);Rg.layouts.cc_reflectionProbeCubemap=Uv,Rg.bindings[Fv]=kv;var Gv=bg.SAMPLER_REFLECTION_PROBE_PLANAR,Hv=new R_(Gv,Rc.SAMPLER_TEXTURE,1,_c.FRAGMENT),zv=new s_(xg.LOCAL,Gv,"cc_reflectionProbePlanarMap",Kl.SAMPLER2D,1);Rg.layouts.cc_reflectionProbePlanarMap=zv,Rg.bindings[Gv]=Hv;var Vv=bg.SAMPLER_REFLECTION_PROBE_DATA_MAP,Wv=new R_(Vv,Rc.SAMPLER_TEXTURE,1,_c.FRAGMENT),Xv=new s_(xg.LOCAL,Vv,"cc_reflectionProbeDataMap",Kl.SAMPLER2D,1);Rg.layouts.cc_reflectionProbeDataMap=Xv,Rg.bindings[Vv]=Wv;var jv=bg.SAMPLER_REFLECTION_PROBE_BLEND_CUBE,Yv=new R_(jv,Rc.SAMPLER_TEXTURE,1,_c.FRAGMENT),Kv=new s_(xg.LOCAL,jv,"cc_reflectionProbeBlendCubemap",Kl.SAMPLER_CUBE,1);Rg.layouts.cc_reflectionProbeBlendCubemap=Kv,Rg.bindings[jv]=Yv;var qv,Qv,Zv,Jv=sm.makeMaskExclude([sm.BitMask.UI_2D,sm.BitMask.GIZMOS,sm.BitMask.EDITOR,sm.BitMask.SCENE_GIZMO,sm.BitMask.PROFILER]),$v=sm.makeMaskExclude([sm.BitMask.UI_2D,sm.BitMask.PROFILER]),ty=sm.Enum.ALL;function ey(t){return(t.getFormatFeatures(jl.R32F)&(ic.RENDER_TARGET|ic.SAMPLED_TEXTURE))==(ic.RENDER_TARGET|ic.SAMPLED_TEXTURE)&&!(t.gfxAPI===Vl.WEBGL)}function iy(t){return(t.getFormatFeatures(jl.RGBA16F)&(ic.RENDER_TARGET|ic.SAMPLED_TEXTURE))==(ic.RENDER_TARGET|ic.SAMPLED_TEXTURE)&&!(t.gfxAPI===Vl.WEBGL)}function ny(){return!(!v.rendering||!v.rendering.enableEffectImport)}t("d6",Object.freeze({__proto__:null,PIPELINE_FLOW_MAIN:yg,PIPELINE_FLOW_FORWARD:Tg,PIPELINE_FLOW_SHADOW:Sg,PIPELINE_FLOW_SMAA:"SMAAFlow",PIPELINE_FLOW_TONEMAP:"ToneMapFlow",get RenderPassStage(){return gg},get RenderPriority(){return vg},globalDescriptorSetLayout:Ag,localDescriptorSetLayout:Rg,get PipelineGlobalBindings(){return Eg},get ModelLocalBindings(){return bg},get SetIndex(){return xg},bindingMappingInfo:Mg,UBOGlobal:Pg,UBOCamera:Bg,UBOShadow:Ng,UBOCSM:Lg,UNIFORM_SHADOWMAP_BINDING:Fg,UNIFORM_ENVIRONMENT_BINDING:Gg,UNIFORM_DIFFUSEMAP_BINDING:Vg,UNIFORM_SPOT_SHADOW_MAP_TEXTURE_BINDING:jg,UBOLocal:qg,UBOWorldBound:Qg,INST_MAT_WORLD:Zg,INST_SH:Jg,UBOLocalBatched:$g,UBOForwardLight:tv,UBODeferredLight:ev,JOINT_UNIFORM_CAPACITY:30,UBOSkinningTexture:iv,UBOSkinningAnimation:nv,INST_JOINT_ANIM_INFO:rv,UBOSkinning:sv,localDescriptorSetLayout_ResizeMaxJoints:av,UBOMorph:ov,UBOUILocal:hv,UBOSH:uv,UNIFORM_JOINT_TEXTURE_BINDING:lv,UNIFORM_REALTIME_JOINT_TEXTURE_BINDING:dv,UNIFORM_POSITION_MORPH_TEXTURE_BINDING:mv,UNIFORM_NORMAL_MORPH_TEXTURE_BINDING:yv,UNIFORM_TANGENT_MORPH_TEXTURE_BINDING:Ev,UNIFORM_LIGHTMAP_TEXTURE_BINDING:bv,UNIFORM_SPRITE_TEXTURE_BINDING:xv,UNIFORM_REFLECTION_TEXTURE_BINDING:Dv,UNIFORM_REFLECTION_STORAGE_BINDING:Bv,UNIFORM_REFLECTION_PROBE_CUBEMAP_BINDING:Fv,UNIFORM_REFLECTION_PROBE_TEXTURE_BINDING:Gv,UNIFORM_REFLECTION_PROBE_DATA_MAP_BINDING:Vv,UNIFORM_REFLECTION_PROBE_BLEND_CUBEMAP_BINDING:jv,CAMERA_DEFAULT_MASK:Jv,CAMERA_EDITOR_MASK:$v,MODEL_ALWAYS_MASK:ty,supportsR16HalfFloatTexture:function(t){return(t.getFormatFeatures(jl.R16F)&(ic.RENDER_TARGET|ic.SAMPLED_TEXTURE))==(ic.RENDER_TARGET|ic.SAMPLED_TEXTURE)},supportsR32FloatTexture:ey,supportsRGBA16HalfFloatTexture:iy,supportsRGBA32FloatTexture:function(t){return(t.getFormatFeatures(jl.RGBA32F)&(ic.RENDER_TARGET|ic.SAMPLED_TEXTURE))==(ic.RENDER_TARGET|ic.SAMPLED_TEXTURE)&&!(t.gfxAPI===Vl.WEBGL)},isEnableEffect:ny}));var ry=4227858432,sy=66060288,ay=1044480,oy=function(t,e,i,n){return void 0===n&&(n=0),e<<26&ry|t<<20&sy|i<<12&ay|4095&n},hy=function(t){return(t&ry)>>>26},uy=function(t){return(t&sy)>>>20},ly=function(t){return(t&ay)>>>12},cy=function(t){return 4095&t},_y=function(t,e){return 67108863&t|e<<26&ry},dy=((qv={})[Kl.UNKNOWN]=function(t,e,i){return void 0===i&&(i=0),q(12010,i)},qv[Kl.INT]=function(t,e,i){return void 0===i&&(i=0),t[i]},qv[Kl.INT2]=function(t,e,i){return void 0===i&&(i=0),Fn.fromArray(e,t,i)},qv[Kl.INT3]=function(t,e,i){return void 0===i&&(i=0),hn.fromArray(e,t,i)},qv[Kl.INT4]=function(t,e,i){return void 0===i&&(i=0),nn.fromArray(e,t,i)},qv[Kl.FLOAT]=function(t,e,i){return void 0===i&&(i=0),t[i]},qv[Kl.FLOAT2]=function(t,e,i){return void 0===i&&(i=0),Fn.fromArray(e,t,i)},qv[Kl.FLOAT3]=function(t,e,i){return void 0===i&&(i=0),hn.fromArray(e,t,i)},qv[Kl.FLOAT4]=function(t,e,i){return void 0===i&&(i=0),nn.fromArray(e,t,i)},qv[Kl.MAT3]=function(t,e,i){return void 0===i&&(i=0),vn.fromArray(e,t,i)},qv[Kl.MAT4]=function(t,e,i){return void 0===i&&(i=0),Dn.fromArray(e,t,i)},qv),fy=((Qv={})[Kl.UNKNOWN]=function(t,e,i){return void 0===i&&(i=0),q(12010,i)},Qv[Kl.INT]=function(t,e,i){return void 0===i&&(i=0),t[i]=e},Qv[Kl.INT2]=function(t,e,i){return void 0===i&&(i=0),Fn.toArray(t,e,i)},Qv[Kl.INT3]=function(t,e,i){return void 0===i&&(i=0),hn.toArray(t,e,i)},Qv[Kl.INT4]=function(t,e,i){return void 0===i&&(i=0),nn.toArray(t,e,i)},Qv[Kl.FLOAT]=function(t,e,i){return void 0===i&&(i=0),t[i]=e},Qv[Kl.FLOAT2]=function(t,e,i){return void 0===i&&(i=0),Fn.toArray(t,e,i)},Qv[Kl.FLOAT3]=function(t,e,i){return void 0===i&&(i=0),hn.toArray(t,e,i)},Qv[Kl.FLOAT4]=function(t,e,i){return void 0===i&&(i=0),nn.toArray(t,e,i)},Qv[Kl.MAT3]=function(t,e,i){return void 0===i&&(i=0),vn.toArray(t,e,i)},Qv[Kl.MAT4]=function(t,e,i){return void 0===i&&(i=0),Dn.toArray(t,e,i)},Qv),py=((Zv={})[Kl.INT]=function(t){return"number"==typeof t},Zv[Kl.FLOAT]=function(t){return"number"==typeof t},Zv[Kl.INT2]=function(t){return!!(t instanceof Fn)},Zv[Kl.FLOAT2]=function(t){return!!(t instanceof Fn)},Zv[Kl.INT3]=function(t){return!!(t instanceof hn)},Zv[Kl.FLOAT3]=function(t){return!!(t instanceof hn)},Zv[Kl.INT4]=function(t){return!!(t instanceof nn)},Zv[Kl.FLOAT4]=function(t){return!!(t instanceof nn||t instanceof pn||t instanceof En)},Zv[Kl.MAT3]=function(t){return!!(t instanceof vn)},Zv[Kl.MAT4]=function(t){return!!(t instanceof Dn)},Zv),my=[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 gy(t){switch(t){case Kl.BOOL:case Kl.INT:case Kl.UINT:case Kl.FLOAT:return my[0];case Kl.BOOL2:case Kl.INT2:case Kl.UINT2:case Kl.FLOAT2:return my[1];case Kl.BOOL4:case Kl.INT4:case Kl.UINT4:case Kl.FLOAT4:return my[2];case Kl.MAT4:return my[3];case Kl.SAMPLER2D:return"default-texture";case Kl.SAMPLER_CUBE:return"default-cube-texture";case Kl.SAMPLER2D_ARRAY:return"default-array-texture";case Kl.SAMPLER3D:return"default-3d-texture"}return my[0]}function vy(t){switch(t){case Kl.SAMPLER2D:return"-texture";case Kl.SAMPLER_CUBE:return"-cube-texture";case Kl.SAMPLER2D_ARRAY:return"-array-texture";case Kl.SAMPLER3D:return"-3d-texture";default:return"-unknown"}}function yy(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 Ty(t,e){switch(t.type){case"boolean":return"number"==typeof e?e.toString():e?"1":"0";case"string":return void 0!==e?e:t.options[0];case"number":return void 0!==e?e.toString():t.range[0].toString();default:return console.warn("unknown define type '"+t.type+"'"),"-1"}}function Sy(t,e){for(var i=0;i<t.length;i++){var n=t[i];if("!"===n[0]){if(e[n.slice(1)])return!1}else if(!e[n])return!1}return!0}var Ey=new Map;function Ay(t,e){if(e.count)return t+X_(e.type)*e.count;var i=Ey.get(e.name);return void 0!==i?t+X_(e.type)*i:(console.error("uniform '"+e.name+"' must have a count"),t)}function Ry(t){return Math.ceil(Math.log2(Math.max(t,2)))}Ey.set("cc_joints",sv.LAYOUT.members[0].count),Ey.set("cc_lightPos",tv.LIGHTS_PER_PASS),Ey.set("cc_lightColor",tv.LIGHTS_PER_PASS),Ey.set("cc_lightSizeRangeAngle",tv.LIGHTS_PER_PASS),Ey.set("cc_lightDir",tv.LIGHTS_PER_PASS),Ey.set("cc_lightBoundingSizeVS",tv.LIGHTS_PER_PASS);var by=new b_;function Cy(t,e,i,n,r){for(var s=t.builtins[n],a=[],o=function(){var t=s.blocks[h],e=i.layouts[t.name],n=e&&i.bindings.find((function(t){return t.binding===e.binding}));if(!(e&&n&&n.descriptorType&k_))return console.warn("builtin UBO '"+t.name+"' not available!"),1;a.push(e),r&&!r.includes(n)&&r.push(n)},h=0;h<s.blocks.length;h++)o();Array.prototype.unshift.apply(e.shaderInfo.blocks,a);for(var u=[],l=function(){var t=s.samplerTextures[c],e=i.layouts[t.name],n=e&&i.bindings.find((function(t){return t.binding===e.binding}));if(!(e&&n&&n.descriptorType&U_))return console.warn("builtin samplerTexture '"+t.name+"' not available!"),1;u.push(e),r&&!r.includes(n)&&r.push(n)},c=0;c<s.samplerTextures.length;c++)l();Array.prototype.unshift.apply(e.shaderInfo.samplerTextures,u),r&&r.sort((function(t,e){return t.binding-e.binding}))}function wy(t){switch(t.gfxAPI){case Vl.GLES2:case Vl.WEBGL:return"glsl1";case Vl.GLES3:case Vl.WEBGL2:return"glsl3";default:return"glsl4"}}var xy,Iy,Oy,Dy,My,Py,By,Ny=new(function(){function t(){this._templates={},this._cache={},this._templateInfos={}}var e=t.prototype;return e.register=function(t){for(var e=0;e<t.shaders.length;e++)this.define(t.shaders[e]).effectName=t.name;for(var i=0;i<t.techniques.length;i++)for(var n=t.techniques[i],r=0;r<n.passes.length;r++){var s=n.passes[r];void 0!==s.propertyIndex&&void 0===s.properties&&(s.properties=n.passes[s.propertyIndex].properties)}},e.define=function(t){var e=this._templates[t.name];if(e&&e.hash===t.hash)return e;var i=r({},t);if(function(t){for(var e=0,i=function(){var i=t.defines[n],r=1;if("number"===i.type){var s=i.range;r=Ry(s[1]-s[0]+1),i._map=function(t){return t-s[0]}}else"string"===i.type?(r=Ry(i.options.length),i._map=function(t){return Math.max(0,i.options.findIndex((function(e){return e===t})))}):"boolean"===i.type&&(i._map=function(t){return t?1:0});i._offset=e,e+=r},n=0;n<t.defines.length;n++)i();for(var r in e>31&&(t.uber=!0),t.constantMacros="",t.builtins.statistics)t.constantMacros+="#define "+r+" "+t.builtins.statistics[r]+"\n"}(i),this._templates[t.name]=i,!this._templateInfos[i.hash]){var n={};n.samplerStartBinding=i.blocks.length,n.shaderInfo=new d_,n.blockSizes=[],n.bindings=[];for(var s=0;s<i.blocks.length;s++){var a=i.blocks[s];n.blockSizes.push(a.members.reduce(Ay,0)),n.bindings.push(new R_(a.binding,Rc.UNIFORM_BUFFER,1,a.stageFlags)),n.shaderInfo.blocks.push(new r_(xg.MATERIAL,a.binding,a.name,a.members.map((function(t){return new n_(t.name,t.type,t.count)})),1))}for(var o=0;o<i.samplerTextures.length;o++){var h=i.samplerTextures[o];n.bindings.push(new R_(h.binding,Rc.SAMPLER_TEXTURE,h.count,h.stageFlags)),n.shaderInfo.samplerTextures.push(new s_(xg.MATERIAL,h.binding,h.name,h.type,h.count))}for(var u=0;u<i.samplers.length;u++){var l=i.samplers[u];n.bindings.push(new R_(l.binding,Rc.SAMPLER,l.count,l.stageFlags)),n.shaderInfo.samplers.push(new a_(xg.MATERIAL,l.binding,l.name,l.count))}for(var c=0;c<i.textures.length;c++){var _=i.textures[c];n.bindings.push(new R_(_.binding,Rc.TEXTURE,_.count,_.stageFlags)),n.shaderInfo.textures.push(new o_(xg.MATERIAL,_.binding,_.name,_.type,_.count))}for(var d=0;d<i.buffers.length;d++){var f=i.buffers[d];n.bindings.push(new R_(f.binding,Rc.STORAGE_BUFFER,1,f.stageFlags)),n.shaderInfo.buffers.push(new u_(xg.MATERIAL,f.binding,f.name,1,f.memoryAccess))}for(var p=0;p<i.images.length;p++){var m=i.images[p];n.bindings.push(new R_(m.binding,Rc.STORAGE_IMAGE,m.count,m.stageFlags)),n.shaderInfo.images.push(new h_(xg.MATERIAL,m.binding,m.name,m.type,m.count,m.memoryAccess))}for(var g=0;g<i.subpassInputs.length;g++){var v=i.subpassInputs[g];n.bindings.push(new R_(v.binding,Rc.INPUT_ATTACHMENT,v.count,v.stageFlags)),n.shaderInfo.subpassInputs.push(new l_(xg.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 __(T.name,T.format,T.isNormalized,0,T.isInstanced,T.location))}Cy(i,n,Rg,"locals"),n.shaderInfo.stages.push(new c_(_c.VERTEX,"")),n.shaderInfo.stages.push(new c_(_c.FRAGMENT,"")),n.handleMap=function(t){for(var e={},i=0;i<t.blocks.length;i++)for(var n=t.blocks[i],r=n.members,s=0,a=0;a<r.length;a++){var o=r[a];e[o.name]=oy(n.binding,o.type,o.count,s),s+=(X_(o.type)>>2)*o.count}for(var h=0;h<t.samplerTextures.length;h++){var u=t.samplerTextures[h];e[u.name]=oy(u.binding,u.type,u.count)}return e}(i),n.setLayouts=[],this._templateInfos[i.hash]=n}return i},e.getTemplate=function(t){return this._templates[t]},e.getTemplateInfo=function(t){var e=this._templates[t].hash;return this._templateInfos[e]},e.getDescriptorSetLayout=function(t,e,i){void 0===i&&(i=!1);var n=this._templates[e],r=this._templateInfos[n.hash];return r.setLayouts.length||(by.bindings=r.bindings,r.setLayouts[xg.MATERIAL]=t.createDescriptorSetLayout(by),by.bindings=Rg.bindings,r.setLayouts[xg.LOCAL]=t.createDescriptorSetLayout(by)),r.setLayouts[i?xg.LOCAL:xg.MATERIAL]},e.hasProgram=function(t){return void 0!==this._templates[t]},e.getKey=function(t,e){return function(t,e){var i=t.defines;if(t.uber){for(var n="",r=0;r<i.length;r++){var s=i[r],a=e[s.name];if(a&&s._map){var o=s._map(a);n+=""+s._offset+o+"|"}}return""+n+t.hash}for(var h=0,u=0;u<i.length;u++){var l=i[u],c=e[l.name];c&&l._map&&(h|=l._map(c)<<l._offset)}return h.toString(16)+"|"+t.hash}(this._templates[t],e)},e.destroyShaderByDefines=function(t){var e=this,i=Object.keys(t);if(i.length)for(var n=i.map((function(e){var i=t[e];return"boolean"==typeof i&&(i=i?"1":"0"),new RegExp(""+e+i)})),r=Object.keys(this._cache).filter((function(t){return n.every((function(i){return i.test(e._cache[t].name)}))})),s=0;s<r.length;s++){var a=r[s],o=this._cache[a];z("destroyed shader "+o.name),o.destroy(),delete this._cache[a]}},e.getGFXShader=function(t,e,i,n,r){Object.assign(i,n.macros),r||(r=this.getKey(e,i));var s=this._cache[r];if(s)return s;var a=this._templates[e],o=this._templateInfos[a.hash];o.pipelineLayout||(this.getDescriptorSetLayout(t,e),Cy(a,o,Ag,"globals"),o.setLayouts[xg.GLOBAL]=n.descriptorSetLayout,o.pipelineLayout=t.createPipelineLayout(new w_(o.setLayouts)));var h=function(t,e){for(var i=[],n=0;n<e.length;n++){var r=e[n],s=r.name,a=t[s],o=Ty(r,a),h=!a||"0"===a;i.push({name:s,value:o,isDefault:h})}return i}(i,a.defines),u=n.constantMacros+a.constantMacros+h.reduce((function(t,e){return t+"#define "+e.name+" "+e.value+"\n"}),""),l=a.glsl3,c=wy(t);c?l=a[c]:console.error("Invalid GFX API!"),o.shaderInfo.stages[0].source=u+l.vert,o.shaderInfo.stages[1].source=u+l.frag,o.shaderInfo.attributes=function(t,e,i){for(var n=[],r=t.attributes,s=0;s<r.length;s++)Sy(r[s].defines,i)&&n.push(e[s]);return n}(a,o.gfxAttributes,i),o.shaderInfo.name=function(t,e){return t+e.reduce((function(t,e){return e.isDefault?t:t+"|"+e.name+e.value}),"")}(e,h);var _=o.shaderInfo;return this._cache[r]=t.createShader(_)},t}());v.programLib=Ny;var Ly=["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"],Fy=t("eg",qs("cc.EffectAsset")(((By=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).techniques=Oy&&Oy(),e.shaders=Dy&&Dy(),e.combinations=My&&My(),e.hideInEditor=Py&&Py(),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 Ly.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(v.rendering&&v.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=v.rendering.programLib;t.addEffect(this),t.init(wd.gfxDevice)}else Ny.register(this);e.register(this),v.game.once(v.Game.EVENT_RENDERER_INITED,this._precompile,this)},i._precompile=function(){var t=this;if(v.rendering&&v.rendering.enableEffectImport)v.rendering.programLib.precompileEffect(wd.gfxDevice,this);else for(var e=v.director.root,i=function(){var i=t.shaders[n],s=t.combinations[n];if(!s)return 1;(function(t){return Object.keys(t).reduce((function(e,i){return e.reduce((function(e,n){for(var s=t[i],a=0;a<s.length;++a){var o=r({},n);o[i]=s[a],e.push(o)}return e}),[])}),[{}])})(s).forEach((function(t){return Ny.getGFXShader(wd.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}(uf))._effects={},By._layoutValid=!0,Oy=Gs((Iy=By).prototype,"techniques",[ra],(function(){return[]})),Dy=Gs(Iy.prototype,"shaders",[ra],(function(){return[]})),My=Gs(Iy.prototype,"combinations",[ra],(function(){return[]})),Py=Gs(Iy.prototype,"hideInEditor",[ra,aa],(function(){return!1})),xy=Iy))||xy);v.EffectAsset=Fy;var ky=function(){function t(){this.name="",this.base="",this.importBase="",this.nativeBase="",this.deps=null,this.assetInfos=new Dd,this.scenes=new Dd,this.paths=new Dd}var e=t.prototype;return e.init=function(t){var e=this;!function(t){var e=t.uuids,i=t.paths,n=t.types,r=t.deps,s=t.paths=Object.create(null);if(!1===t.debug){for(var a=0,o=e.length;a<o;a++)e[a]=qd(e[a]);for(var h in i){var u=i[h],l=u[1];u[1]=n[l]}}else{for(var c=Object.create(null),_=0,d=e.length;_<d;_++){var f=e[_];e[_]=c[f]=qd(f)}e=c}for(var p in i){var m=i[p];s[e[p]]=m}var g=t.scenes;for(var v in g){var y=g[v];g[v]=e[y]}var T=t.packs;for(var S in T)for(var E=T[S],A=0;A<E.length;++A)E[A]=e[E[A]];var R=t.versions;if(R)for(var b in R)for(var C=R[b],w=0;w<C.length;w+=2){var x=C[w];C[w]=e[x]||x}var I=t.redirect;if(I)for(var O=0;O<I.length;O+=2)I[O]=e[I[O]],I[O+1]=r[I[O+1]];if(t.extensionMap){var D=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 M in t.extensionMap)D(M)}}(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=tf(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=tf(t))[t.length-1]&&(t=t.slice(0,-1));var n=i||[];return this.paths.forEach((function(i,r){if(r.startsWith(t)&&function(t,e){return!(t.length>e.length)||47===t.charCodeAt(e.length)}(r,t)||!t)for(var s=0,a=i.length;s<a;s++){var o=i[s];e&&!Wt(o.ctor,e)||n.push(o)}})),n},e.getAssetInfo=function(t){return this.assetInfos.get(t)||null},e.getSceneInfo=function(t){return t.endsWith(".scene")||(t+=".scene"),"/"===t[0]||t.startsWith("db://")||(t="/"+t),this.scenes.find((function(e,i){return i.endsWith(t)}))},e.destroy=function(){this.paths.destroy(),this.scenes.destroy(),this.assetInfos.destroy()},e._initUuid=function(t){if(t){this.assetInfos.clear();for(var e=0,i=t.length;e<i;e++){var n=t[e];this.assetInfos.add(n,{uuid:n})}}},e._initPath=function(t){if(t){var e=this.paths;for(var i in e.clear(),t){var n=t[i],r=n[0],s=n[1],a=3===n.length,o=this.assetInfos.get(i);o.path=r,o.ctor=ee(s),e.has(r)?a?e.get(r).push(o):e.get(r).unshift(o):e.add(r,[o])}}},e._initScene=function(t){if(t){var e=this.scenes;e.clear();var i=this.assetInfos;for(var n in t){var r=t[n],s=i.get(r);s.url=n,e.add(n,s)}}},e._initPackage=function(t){if(t){var e=this.assetInfos;for(var i in t){var n=t[i],r={uuid:i,packedUuids:n,ext:".json"};e.add(i,r);for(var s=0,a=n.length;s<a;s++){var o=n[s],h=e.get(o),u=h.packs;u?1===a?u.unshift(r):u.push(r):h.packs=[r]}}}},e._initVersion=function(t){if(t){var e=this.assetInfos,i=t.import;if(i)for(var n=0,r=i.length;n<r;n+=2){var s=i[n];e.get(s).ver=i[n+1]}if(i=t.native)for(var a=0,o=i.length;a<o;a+=2){var h=i[a];e.get(h).nativeVer=i[a+1]}}},e._initRedirect=function(t){if(t)for(var e=this.assetInfos,i=0,n=t.length;i<n;i+=2){var r=t[i];e.get(r).redirect=t[i+1]}},t}();function Uy(t,e){t._uuid&&e.push(t._uuid)}function Gy(t,e){for(var i=Object.getOwnPropertyNames(t),n=0;n<i.length;n++){var r=i[n];if("node"!==r&&"__eventTargets"!==r){var s=t[r];if("object"==typeof s&&s)if(Array.isArray(s))for(var a=0;a<s.length;a++){var o=s[a];o instanceof uf&&Uy(o,e)}else if(s.constructor&&s.constructor!==Object)s instanceof uf&&Uy(s,e);else for(var h=Object.getOwnPropertyNames(s),u=0;u<h.length;u++){var l=s[h[u]];l instanceof uf&&Uy(l,e)}}}}function Hy(t,e){for(var i=0;i<t._components.length;i++)Gy(t._components[i],e);for(var n=0;n<t._children.length;n++)Hy(t._children[n],e)}function zy(t,e,i,n){i.push(t._uuid);for(var r=jp.getDeps(t._uuid),s=0,a=r.length;s<a;s++){var o=Bd.get(r[s]);if(o){var h=o._uuid;h in e?e[h]+=n:e[h]=o.refCount+n,i.includes(h)||zy(o,e,i,n)}}}var Vy=[],Wy=new(function(){function t(){this._persistNodeDeps=new Dd,this._toDelete=new Dd,this._eventListener=!1,this._dontDestroyAssets=[]}var e=t.prototype;return e.addIgnoredAsset=function(t){this._dontDestroyAssets.push(t._uuid)},e.init=function(){this._persistNodeDeps.clear(),this._toDelete.clear()},e._addPersistNodeRef=function(t){var e=[];Hy(t,e);for(var i=0,n=e.length;i<n;i++){var r=Bd.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=Bd.get(e[i]);r&&r.decRef()}this._persistNodeDeps.remove(t.uuid)}},e._autoRelease=function(t,e,i){if(t){for(var n=jp.getDeps(t.uuid),r=0,s=n.length;r<s;r++){var a=Bd.get(n[r]);a&&a.decRef(t.autoReleaseAssets)}var o=jp._depends.get(t.uuid);if(o&&o.persistDeps)for(var h=o.persistDeps,u=0,l=h.length;u<l;u++){var c=Bd.get(h[u]);c&&c.decRef(t.autoReleaseAssets)}t.uuid!==e.uuid&&jp.remove(t.uuid)}var _=jp._depends.get(e.uuid);for(var f in _&&(_.persistDeps=[]),i){for(var p,m,g=i[f],v=this._persistNodeDeps.get(g.uuid),y=d(v);!(m=y()).done;){var T=m.value,S=Bd.get(T);S&&S.addRef()}_&&(p=_.persistDeps).push.apply(p,v)}},e.tryRelease=function(t,e){void 0===e&&(e=!1),t instanceof uf&&(e?this._free(t,e):(this._toDelete.add(t._uuid,t),this._eventListener||(this._eventListener=!0,Le(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),ja(t,!0)&&-1===this._dontDestroyAssets.indexOf(i)&&!(!e&&t.refCount>0&&function(t){var e=Object.create(null);if(e[t._uuid]=t.refCount,zy(t,e,Vy,-1),Vy.length=0,0!==e[t._uuid])return e[t._uuid];for(var i in e)0!==e[i]&&zy(Bd.get(i),e,Vy,1);return Vy.length=0,e[t._uuid]}(t)>0)){Bd.remove(i);for(var n=jp.getDeps(i),r=0,s=n.length;r<s;r++){var a=Bd.get(n[r]);a&&(a.decRef(!1),this._free(a,!1))}t.destroy(),jp.remove(i)}},t}()),Xy=null;function jy(t,e){for(var i=0,n=t.input.length;i<n;i++){var r=t.input[i];e&&!r.isNative&&r.content instanceof uf&&r.content.decRef(!1),r.recycle()}t.input=null}function Yy(t,e){return e?/\?/.test(t)?t+"&_t="+Date.now():t+"?_t="+Date.now():t}function Ky(t,e,i,n,r){void 0===r&&(r=0),t(r,(function(s,a){r++,!s||r>e?n&&n(s,a):setTimeout((function(){Ky(t,e,i,n,r)}),i)}))}function qy(t,e,i,n,s){try{for(var a=jp.parse(t,e),o=0,h=a.deps.length;o<h;o++){var u=a.deps[o];u in i||(i[u]=!0,n.push({uuid:u,bundle:s&&s.name}))}a.nativeDep&&(s&&(a.nativeDep.bundle=s.name),n.push(r({},a.nativeDep)))}catch(t){G(t.message,t.stack)}}function Qy(t,e,i){e&&(i=void 0!==i?i:v.assetManager.cacheAsset,$d(e)||!i||e.isDefault||Bd.add(t,e))}function Zy(t,e,i){var n=0,r=[],s=t.length;0===s&&i&&i(r);for(var a=function(t){t&&r.push(t),++n===s&&i&&i(r)},o=0;o<s;o++)e(t[o],a)}function Jy(t,e,i){var n=t,r=e,s=i;if(void 0===i){var a="function"==typeof t;e?(s=e,a||(r=null)):void 0===e&&a&&(s=t,n=null,r=null),void 0!==e&&a&&(r=t,n=null)}return{options:n||Object.create(null),onProgress:r,onComplete:s}}function $y(t,e,i){var n=t,r=e,s=i;if(void 0===i){var a=Wt(t,uf);e?(s=e,a&&(r=null)):void 0!==e||a||(s=t,r=null,n=null),void 0===e||a||(r=t,n=null)}return{type:n,onProgress:r||Xy,onComplete:s}}function tT(t,e,i,n){if(void 0===n&&(n={}),!i[e]||n[e])return!1;n[e]=!0;var r=!1,s=jp.getDeps(e);if(s)for(var a=0,o=s.length;a<o;a++){var h=s[a];if(h===t||tT(t,h,i,n)){r=!0;break}}return r}function eT(t){return function(e,i){if(t){var n=[];Array.isArray(i)?i.forEach((function(t){return t instanceof uf&&n.push(t.addRef())})):i instanceof uf&&n.push(i.addRef()),Le((function(){n.forEach((function(t){return t.decRef(!1)})),t(e,i)}))}}}var iT=function(){function t(){this._config=new ky}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),Fd.add(t.name,this)},e.load=function(t,e,i,n){var r=$y(e,i,n),s=r.type,a=r.onProgress,o=r.onComplete,h={__requestType__:Pd.PATH,type:s,bundle:this.name,__outputAsArray__:Array.isArray(t)};v.assetManager.loadAny(t,h,a,o)},e.preload=function(t,e,i,n){var r=$y(e,i,n),s=r.type,a=r.onProgress,o=r.onComplete;v.assetManager.preloadAny(t,{__requestType__:Pd.PATH,type:s,bundle:this.name},a,o)},e.loadDir=function(t,e,i,n){var r=$y(e,i,n),s=r.type,a=r.onProgress,o=r.onComplete;v.assetManager.loadAny(t,{__requestType__:Pd.DIR,type:s,bundle:this.name,__outputAsArray__:!0},a,o)},e.preloadDir=function(t,e,i,n){var r=$y(e,i,n),s=r.type,a=r.onProgress,o=r.onComplete;v.assetManager.preloadAny(t,{__requestType__:Pd.DIR,type:s,bundle:this.name},a,o)},e.loadScene=function(t,e,i,n){var r=Jy(e,i,n),s=r.options,a=r.onProgress,o=r.onComplete;s.preset=s.preset||"scene",s.bundle=this.name,v.assetManager.loadAny({scene:t},s,a,(function(t,e){if(t)G(t.message,t.stack);else if(e.scene){var i=e.scene;i._id=e._uuid,i.name=e.name}else t=new Error("The asset "+e._uuid+" is not a scene");o&&o(t,e)}))},e.preloadScene=function(t,e,i,n){var r=Jy(e,i,n),s=r.options,a=r.onProgress,o=r.onComplete;s.bundle=this.name,v.assetManager.preloadAny({scene:t},s,a,(function(e){e&&Z(1210,t,e.message),o&&o(e)}))},e.get=function(t,e){var i=this.getInfoWithPath(t,e);return i&&Bd.get(i.uuid)||null},e.release=function(t,e){var i=this.get(t,e);i&&Wy.tryRelease(i,!0)},e.releaseUnusedAssets=function(){var t=this;Bd.forEach((function(e){var i=t.getAssetInfo(e._uuid);i&&!i.redirect&&Wy.tryRelease(e)}))},e.releaseAll=function(){var t=this;Bd.forEach((function(e){var i=t.getAssetInfo(e._uuid);i&&!i.redirect&&Wy.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}(),nT=t("eo",new iT);function rT(t,e,i){var n=new T.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:"!==T.location.protocol&&(n.crossOrigin="anonymous"),n.addEventListener("load",r),n.addEventListener("error",s),n.src=t,n}function sT(t,e,i,n){var r=new XMLHttpRequest,s="download failed: "+t+", status: ";if(r.open("GET",t,!0),void 0!==e.xhrResponseType&&(r.responseType=e.xhrResponseType),void 0!==e.xhrWithCredentials&&(r.withCredentials=e.xhrWithCredentials),void 0!==e.xhrMimeType&&r.overrideMimeType&&r.overrideMimeType(e.xhrMimeType),void 0!==e.xhrTimeout&&(r.timeout=e.xhrTimeout),e.xhrHeader)for(var a in e.xhrHeader)r.setRequestHeader(a,e.xhrHeader[a]);return r.onload=function(){200===r.status||0===r.status?n&&n(null,r.response):n&&n(new Error(""+s+r.status+"(no response)"))},i&&(r.onprogress=function(t){t.lengthComputable&&i(t.loaded,t.total)}),r.onerror=function(){n&&n(new Error(""+s+r.status+"(error)"))},r.ontimeout=function(){n&&n(new Error(""+s+r.status+"(time out)"))},r.onabort=function(){n&&n(new Error(""+s+r.status+"(abort)"))},r.send(null),r}v.resources=nT;var aT=T.document,oT={};function hT(t,e,i){if(oT[t])return i&&i(null),null;var n=aT.createElement("script");function r(){n.parentNode.removeChild(n),n.removeEventListener("load",r,!1),n.removeEventListener("error",s,!1),oT[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:"!==T.location.protocol&&(n.crossOrigin="anonymous"),n.async=e.scriptAsyncLoading||!1,n.src=t,n.addEventListener("load",r,!1),n.addEventListener("error",s,!1),aT.body.appendChild(n),n}var uT=/^(?:\w+:\/\/|\.+\/).+/,lT=function(t,e,i){(Ol.hasFeature(Ol.Feature.IMAGE_BITMAP)&&v.assetManager.allowImageBitmap?cT:rT)(t,e,i)},cT=function(t,e,i){e.xhrResponseType="blob",sT(t,e,e.onFileProgress,i)},_T=function(t,e,i){e.xhrResponseType="json",sT(t,e,e.onFileProgress,i)},dT=function(t,e,i){e.xhrResponseType="arraybuffer",sT(t,e,e.onFileProgress,i)},fT=function(t,e,i){bT._downloadJson(t,e,(function(e,n){if(e)i(e);else{var r=cp(n);Promise.all(r.chunks.map((function(i){return new Promise((function(n,r){bT._downloadArrayBuffer(""+_l(t)+i,{},(function(t,i){e?r(e):n(new Uint8Array(i))}))}))}))).then((function(t){var e=new lp(r.document,t);i(null,e)})).catch((function(t){i(t)}))}}))},pT=function(t,e,i){bT._downloadArrayBuffer(t,e,(function(t,e){if(t)i(t);else try{var n=_p(new Uint8Array(e));i(null,n)}catch(t){i(t)}}))},mT=function(t,e,i){e.xhrResponseType="text",sT(t,e,e.onFileProgress,i)},gT=function(t,e,i){var n=dl(t),r=t;uT.test(r)||(r=-1!==bT.remoteBundles.indexOf(n)?bT.remoteServerAddress+"remote/"+n:"assets/"+n);var s=e.version||bT.bundleVers[n],a=0,o=null,h=null;_T(r+"/config."+(s?s+".":"")+"json",e,(function(t,e){h=t||h,(o=e)&&(o.base=r+"/"),2==++a&&i(h,o)})),hT(r+"/index."+(s?s+".":"")+"js",e,(function(t){h=t||h,2==++a&&i(h,o)}))},vT=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=rT,this.downloadDomAudio=null,this.downloadFile=sT,this.downloadScript=hT,this._downloadArrayBuffer=dT,this._downloadJson=_T,this._downloaders={".png":lT,".jpg":lT,".bmp":lT,".jpeg":lT,".gif":lT,".ico":lT,".tiff":lT,".webp":lT,".image":lT,".pvr":dT,".pkm":dT,".astc":dT,".txt":mT,".xml":mT,".vsh":mT,".fsh":mT,".atlas":mT,".tmx":mT,".tsx":mT,".json":_T,".ExportJson":_T,".plist":mT,".ccon":fT,".cconb":pT,".fnt":mT,".binary":dT,".bin":dT,".dbbin":dT,".skel":dT,".js":hT,bundle:gT,default:mT},this._downloading=new Dd,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,a=Nd.get(t);if(a)r(null,a);else{var o=this._downloading.get(t);if(o){o.push(r);var h=this._queue.find((function(e){return e.id===t}));if(!h)return;var u=n.priority||0;h.priority<u&&(h.priority=u,this._queueDirty=!0)}else{var l=void 0!==n.maxRetryCount?n.maxRetryCount:this.maxRetryCount,c=void 0!==n.maxConcurrency?n.maxConcurrency:this.maxConcurrency,_=void 0!==n.maxRequestsPerFrame?n.maxRequestsPerFrame:this.maxRequestsPerFrame,d=this._downloaders[i]||this._downloaders.default;Ky((function(i,a){if(0===i&&s._downloading.add(t,[r]),s.limited){s._updateTime();var o=function(t,e){s._totalNum--,s._handleQueueInNextFrame(c,_),a(t,e)};s._totalNum<c&&s._totalNumThisPeriod<_?(d(Yy(e,s.appendTimeStamp),n,o),s._totalNum++,s._totalNumThisPeriod++):(s._queue.push({id:t,priority:n.priority||0,url:e,options:n,done:o,handler:d}),s._queueDirty=!0,s._totalNum<c&&s._handleQueueInNextFrame(c,_))}else d(Yy(e,s.appendTimeStamp),n,a)}),l,this.retryInterval,(function(e,i){e||Nd.add(t,i);for(var n=s._downloading.remove(t),r=0,a=n.length;r<a;r++)n[r](e,i)}))}}},t.loadSubpackage=function(t,e){v.assetManager.loadBundle(t,null,e)},t._updateTime=function(){var t=performance.now(),e=v.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(Yy(i.url,this.appendTimeStamp),i.options,i.done)}this._handleQueueInNextFrame(t,e)},t._handleQueueInNextFrame=function(t,e){!this._checkNextPeriod&&this._queue.length>0&&(Le(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}();vT._instance=void 0;var yT,TT,ST,ET,AT,RT,bT=vT.instance,CT=vT.instance,wT=t("ec",qs("cc.JsonAsset")((TT=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).json=ST&&ST(),e}return s(e,t),e}(uf),ST=Gs(TT.prototype,"json",[ra],(function(){return null})),yT=TT))||yT);v.JsonAsset=wT;var xT,IT,OT=t("eb",qs("cc.TextAsset")((AT=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).text=RT&&RT(),e}return s(e,t),e.prototype.toString=function(){return this.text},e}(uf),RT=Gs(AT.prototype,"text",[ra],(function(){return""})),ET=AT))||ET);v.TextAsset=OT;var DT=t("e8",qs("cc.BufferAsset")((f((IT=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._buffer=null,e}s(e,t);var i=e.prototype;return i.buffer=function(){return this._buffer,this._buffer},i.validate=function(){return!!this._buffer},n(e,[{key:"_nativeAsset",get:function(){return this._buffer},set:function(t){t instanceof ArrayBuffer?this._buffer=t:this._buffer=t.buffer}}]),e}(uf)).prototype,"_nativeAsset",[Ia],Object.getOwnPropertyDescriptor(IT.prototype,"_nativeAsset"),IT.prototype),xT=IT))||xT);function MT(t,e,i,n){var r=null,s=null;try{(r=new Df)._nativeUrl=t,r._nativeAsset=e}catch(t){s=t}n(s,r)}function PT(t,e,i,n){var r=new wT;r.json=e,n(null,r)}function BT(t,e,i,n){var r=new OT;r.text=e,n(null,r)}function NT(t,e,i,n){var r=new DT;r._nativeUrl=t,r._nativeAsset=e,n(null,r)}function LT(t,e,i,n){var r=new uf;r._nativeUrl=t,r._nativeAsset=e,n(null,r)}function FT(t,i,n,r){var s=Fd.get(i.name);s||(s=i.name===zd.RESOURCES?nT:new iT,i.base=i.base||t+"/",s.init(i)),e.import("virtual:///prerequisite-imports/"+s.name).then((function(){r(null,s)})).catch(r)}v.BufferAsset=DT;var kT=new(function(){function t(){this._creating=new Dd,this._producers={".png":MT,".jpg":MT,".bmp":MT,".jpeg":MT,".gif":MT,".ico":MT,".tiff":MT,".webp":MT,".image":MT,".pvr":MT,".pkm":MT,".txt":BT,".xml":BT,".vsh":BT,".fsh":BT,".atlas":BT,".tmx":BT,".tsx":BT,".fnt":BT,".json":PT,".ExportJson":PT,".binary":NT,".bin":NT,".dbbin":NT,".skel":NT,bundle:FT,default:LT}}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,a=this._producers[i]||this._producers.default,o=Bd.get(t);if(n.reloadAsset||!o){var h=this._creating.get(t);h?h.push(r):(this._creating.add(t,[r]),a(t,e,n,(function(e,i){!e&&i instanceof uf&&(i._uuid=t,Qy(t,i,n.cacheAsset));for(var r=s._creating.remove(t),a=0,o=r.length;a<o;a++)r[a](e,i)})))}else r(null,o)},t}()),UT=new(function(){function t(){this._loading=new Dd,this._unpackers={".json":this.unpackJson}}var e=t.prototype;return e.unpackJson=function(t,e,i,n){var r=Ot(!0),s=null;if(Array.isArray(e)){(e=function(t){if(t[0]<1)throw new Error(et(5304,t[0]));Np(t,!0,void 0,Fp.reportMissingClass),Lp(t);for(var e=new kp(t[0]),i=t[1],n=t[2],r=t[3],s=t[4],a=t[5],o=0;o<a.length;++o)a[o].unshift(e,i,n,r,s);return a}(e)).length!==t.length&&Z(4915);for(var a=0;a<t.length;a++)r[t[a]+"@import"]=e[a]}else{var o=re(em),h=re(Df);if(e.type===o&&e.data){var u=e.data;u.length!==t.length&&Z(4915);for(var l=0;l<t.length;l++)r[t[l]+"@import"]=Up(o,{base:u[l][0],mipmaps:u[l][1]})}else{if(e.type!==h||!e.data)return void n(s=new Error("unmatched type pack!"),null);var c=e.data;c.length!==t.length&&Z(4915);for(var _=0;_<t.length;_++)r[t[_]+"@import"]=c[_]}}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(Nd.has(t.id))i(null,Nd.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 a=r[0];this._loading.add(a.uuid,[{onComplete:i,id:t.id}]),t.config;var o=ef(a.uuid,{ext:a.ext,bundle:t.config.name});CT.download(a.uuid,o,a.ext,t.options,(function(e,i){Nd.remove(a.uuid),e&&G(e.message,e.stack),n.unpack(a.packedUuids,i,a.ext,t.options,(function(t,i){if(!t)for(var r in i)Nd.add(r,i[r]);for(var s=n._loading.remove(a.uuid),o=0,h=s.length;o<h;o++){var u=s[o];if(e||t)u.onComplete(e||t);else{var l=i[u.id];l?u.onComplete(null,l):u.onComplete(new Error("can not retrieve data from package"))}}}))}))}}else CT.download(t.id,t.url,t.ext,t.options,i)},t}());function GT(t,e){var i=!1;t.progress||(t.progress={finish:0,total:t.input.length,canInvoke:!0},i=!0);var n=t.options,r=t.progress,s=[],a=r.total,o=n.__exclude__=n.__exclude__||Object.create(null);t.output=[],Zy(t.input,(function(n,h){if(!n.isNative&&Bd.has(n.uuid)){var u=Bd.get(n.uuid);return n.content=u.addRef(),t.output.push(n),r.canInvoke&&t.dispatch("progress",++r.finish,r.total,n),void h()}UT.load(n,t.options,(function(u,l){u?t.isFinished||(!v.assetManager.force||i?(G(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=l,t.output.push(n),n.isNative||(o[n.uuid]=!0,qy(n.uuid,l,o,s,n.config),r.total=a+s.length),r.canInvoke&&t.dispatch("progress",++r.finish,r.total,n)),h()}))}),(function(){if(t.isFinished)return jy(t,!0),void t.dispatch("error");if(s.length>0){var a=Wd.create({input:s,progress:r,options:n,onProgress:t.onProgress,onError:Wd.prototype.recycle,onComplete:function(n){var r;n||((r=t.output).push.apply(r,a.output),a.recycle()),i&&HT(t),e(n)}});Ud.async(a)}else i&&HT(t),e()}))}function HT(t){for(var e=t.output,i=0,n=e.length;i<n;i++)e[i].content&&e[i].content.decRef(!1)}var zT=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}())),VT=function(){function t(){this._parsing=new Dd,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=Df.parseCompressedTextures(t,0)}catch(t){n=t,console.warn(n)}i(n,r)},e.parsePKMTex=function(t,e,i){var n=null,r=null;try{r=Df.parseCompressedTextures(t,1)}catch(t){n=t,console.warn(n)}i(n,r)},e.parseASTCTex=function(t,e,i){var n=null,r=null;try{r=Df.parseCompressedTextures(t,2)}catch(t){n=t,console.warn(n)}i(n,r)},e.parsePlist=function(t,e,i){var n=null,r=zT.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=Vp(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,a=Ld.get(t);if(a)r(null,a);else{var o=this._parsing.get(t);if(o)o.push(r);else{var h=this._parsers[i];h?(this._parsing.add(t,[r]),h(e,n,(function(e,i){e?Nd.remove(t):$d(i)||Ld.add(t,i);for(var n=s._parsing.remove(t),r=0,a=n.length;r<a;r++)n[r](e,i)}))):r(null,e)}}},n(t,null,[{key:"instance",get:function(){return this._instance||(this._instance=new t),this._instance}}]),t}();VT._instance=void 0;var WT=VT.instance;function XT(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=[],Zy(t.input,(function(s,a){var o=Wd.create({input:s,onProgress:t.onProgress,options:n,progress:r,onComplete:function(n,h){n&&!t.isFinished&&(!v.assetManager.force||i?(G(n.message,n.stack),r.canInvoke=!1,e(n)):r.canInvoke&&t.dispatch("progress",++r.finish,r.total,s)),t.output.push(h),o.recycle(),a(null)}});jT.async(o)}),(function(){if(n.__exclude__=null,t.isFinished)return jy(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),jy(t,!0),e()}))}var jT=new Md("loadOneAsset",[function(t,e){var i=t.output=t.input,n=i.options,r=i.isNative,s=i.uuid,a=i.file,o=n.reloadAsset;a||!o&&!r&&Bd.has(s)?e():UT.load(i,t.options,(function(t,n){i.file=n,e(t)}))},function(t,e){var i=t.output=t.input,n=t.progress,r=t.options.__exclude__,s=i.id,a=i.file,o=i.options;if(i.isNative)WT.parse(s,a,i.ext,o,(function(r,a){r?e(r):(i.content=a,n.canInvoke&&t.dispatch("progress",++n.finish,n.total,i),Nd.remove(s),Ld.remove(s),e())}));else{var h=i.uuid;if(h in r){var u=r[h],l=u.finish,c=u.content,_=u.err,f=u.callbacks;n.canInvoke&&t.dispatch("progress",++n.finish,n.total,i),l||tT(h,h,r)?(c&&c.addRef(),i.content=c,e(_)):f.push({done:e,item:i})}else if(!o.reloadAsset&&Bd.has(h)){var p=Bd.get(h);i.content=p.addRef(),n.canInvoke&&t.dispatch("progress",++n.finish,n.total,i),e()}else o.__uuid__=h,WT.parse(s,a,"import",o,(function(i,n){i?e(i):function(t,e,i){var n=t.input,r=t.progress,s=n,a=s.uuid,o=s.id,h=s.options,u=s.config,l=h.cacheAsset,c=[];e.addRef&&e.addRef(),qy(a,e,Object.create(null),c,u),r.canInvoke&&t.dispatch("progress",++r.finish,r.total+=c.length,n);var _=t.options.__exclude__[a]={content:e,finish:!1,callbacks:[{done:i,item:n}]},f=Wd.create({input:c,options:t.options,onProgress:t.onProgress,onError:Wd.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 uf?h._uuid+"@import":a+"@native"]=h)}!function(t,e,i){var n=Gp.get(e);if(n){for(var r=0,s=n.length;r<s;r++){var a=n[r],o=i[a.uuid+"@import"];if(o)a.owner[a.prop]=o.addRef();else{if(G("The asset "+a.uuid+" is missing!"),v.assetManager.dispatchAssetMissing(e,a.owner,a.prop,a.uuid),a.type&&a.type!==uf){var h=new a.type;h.initDefault(a.uuid),a.owner[a.prop]=h}!0}}Gp.delete(e)}Hp.has(e)&&(i[t+"@native"]?e._nativeAsset=i[t+"@native"]:(!0,console.error("the native asset of "+t+" is missing!")),Hp.delete(e))}(a,e,r);try{"function"!=typeof e.onLoaded||zp.has(e)||Hp.has(e)||(e.onLoaded(),zp.add(e))}catch(t){G("The asset "+a+" is invalid for some reason, detail message: "+t.message+", stack: "+t.stack)}Nd.remove(o),Ld.remove(o),Qy(a,e,l),f.recycle()}for(var u=_.callbacks,c=0,p=u.length;c<p;c++){var m=u[c];e.addRef&&e.addRef(),m.item.content=e,m.done(t)}u.length=0}});kd.async(f)}(t,n,e)}))}}]);function YT(t,e){var i=t.options,n=Object.create(null),r=Object.create(null);for(var s in i)switch(s){case Pd.PATH:case Pd.UUID:case Pd.DIR:case Pd.SCENE:case Pd.URL:break;case"__requestType__":case"__isNative__":case"ext":case"type":case"__nativeName__":case"audioLoadMode":case"bundle":n[s]=i[s];break;case"__exclude__":case"__outputAsArray__":r[s]=i[s];break;default:n[s]=i[s],r[s]=i[s]}t.options=r;var a=Wd.create({input:t.input,options:n}),o=null;try{t.output=t.source=Gd.sync(a)}catch(t){o=t;for(var h=0,u=a.output.length;h<u;h++)a.output[h].recycle()}a.recycle(),e(o)}var KT=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}();KT.MAX_DEAD_NUM=500,KT._deadPool=[];var qT=[];function QT(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=KT.create(),a=null,o=null;if("string"==typeof n&&((n=Object.create(null))[e.__requestType__||Pd.UUID]=i[r]),"object"==typeof n){Gt(n,e),n.preset&&Gt(n,Vd[n.preset]);var h=function(){var t;switch(u){case Pd.UUID:var e,r=s.uuid=qd(n.uuid);if(!n.bundle){var h=Fd.find((function(t){return!!t.getAssetInfo(r)}));n.bundle=h&&h.name}if(Fd.has(n.bundle)){if(a=Fd.get(n.bundle).config,(o=a.getAssetInfo(r))&&o.redirect){if(!Fd.has(o.redirect))throw new Error("Please load bundle "+o.redirect+" first");a=Fd.get(o.redirect).config,o=a.getAssetInfo(r)}s.config=a,s.info=o}s.ext=n.ext||(null===(e=o)||void 0===e?void 0:e.extension)||".json";break;case"__requestType__":case"ext":case"bundle":case"preset":case"type":break;case Pd.DIR:if(Fd.has(n.bundle)){Fd.get(n.bundle).config.getDirWithPath(n.dir,n.type,qT);for(var l,c=d(qT);!(l=c()).done;){var _=l.value;i.push({uuid:_.uuid,__isNative__:!1,ext:_.extension||".json",bundle:n.bundle})}qT.length=0}s.recycle(),s=null;break;case Pd.PATH:if(Fd.has(n.bundle)){if(a=Fd.get(n.bundle).config,(o=a.getInfoWithPath(n.path,n.type))&&o.redirect){if(!Fd.has(o.redirect))throw new Error("you need to load bundle "+o.redirect+" first");a=Fd.get(o.redirect).config,o=a.getAssetInfo(o.uuid)}if(!o)throw s.recycle(),new Error("Bundle "+n.bundle+" doesn't contain "+n.path);s.config=a,s.uuid=o.uuid,s.info=o}s.ext=n.ext||(null===(t=o)||void 0===t?void 0:t.extension)||".json";break;case Pd.SCENE:if(!n.bundle){var f=Fd.find((function(t){return!!t.getSceneInfo(n.scene)}));n.bundle=f&&f.name}if(Fd.has(n.bundle)){if(a=Fd.get(n.bundle).config,(o=a.getSceneInfo(n.scene))&&o.redirect){if(!Fd.has(o.redirect))throw new Error("you need to load bundle "+o.redirect+" first");a=Fd.get(o.redirect).config,o=a.getAssetInfo(o.uuid)}if(!o)throw s.recycle(),new Error("Bundle "+a.name+" doesn't contain scene "+n.scene);s.config=a,s.uuid=o.uuid,s.info=o}break;case"__isNative__":s.isNative=n.__isNative__;break;case Pd.URL:s.url=n.url,s.uuid=n.uuid||n.url,s.ext=n.ext||cl(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 ZT(t){for(var e=t.output=t.input,i=function(){var t=e[n];if(Hd.has(t.uuid)){var i=Hd.get(t.uuid),r=Fd.find((function(t){return!!t.getAssetInfo(i)}));if(r){var s;t.overrideUuid=i;var a=r.config,o=a.getAssetInfo(i);if(o&&o.redirect){if(!Fd.has(o.redirect))throw new Error("Please load bundle "+o.redirect+" first");o=(a=Fd.get(o.redirect).config).getAssetInfo(i)}t.config=a,t.info=o,t.ext=t.isNative?t.ext:(null===(s=o)||void 0===s?void 0:s.extension)||".json"}else q(16201,i,t.uuid)}},n=0;n<e.length;n++)i()}function JT(t){for(var e=t.output=t.input,i=0;i<e.length;i++){var n=e[i];if(!n.url){var r,s,a=n.config;s=n.isNative?a&&a.nativeBase?a.base+a.nativeBase:v.assetManager.generalNativeBase:a&&a.importBase?a.base+a.importBase:v.assetManager.generalImportBase;var o=n.overrideUuid||n.uuid,h="";n.info&&(h=n.isNative?n.info.nativeVer?"."+n.info.nativeVer:"":n.info.ver?"."+n.info.ver:""),r=".ttf"===n.ext?s+"/"+o.slice(0,2)+"/"+o+h+"/"+n.options.__nativeName__:s+"/"+o.slice(0,2)+"/"+o+h+n.ext,n.url=r}}return null}var $T="asset-missing",tS=t("en",function(){function t(){this.pipeline=kd.append(YT).append(XT),this.fetchPipeline=Ud.append(YT).append(GT),this.transformPipeline=Gd.append(QT).append(ZT).append(JT),this.bundles=Fd,this.assets=Bd,this.assetsOverrideMap=Hd,this.generalImportBase="",this.generalNativeBase="",this.dependUtil=jp,this.force=false,this.allowImageBitmap=!1,this.utils=af,this.downloader=CT,this.parser=WT,this.packManager=UT,this.cacheAsset=!0,this.cacheManager=null,this.presets=Vd,this.factory=kT,this.preprocessPipe=YT,this.fetchPipe=GT,this.loadPipe=XT,this.references=null,this._releaseManager=Wy,this._files=Nd,this._parsed=Ld,this._parsePipeline=null,this._projectBundles=[],this._eventTarget=new Ju}var e=t.prototype;return e.onAssetMissing=function(t,e){this._eventTarget.on($T,t,e)},e.offAssetMissing=function(t,e){this._eventTarget.off($T,t,e)},e.dispatchAssetMissing=function(t,e,i,n){this._eventTarget.emit($T,t,e,i,n)},e.init=function(t){void 0===t&&(t={});var e=t.server||be.querySettings(Re.Category.ASSETS,"server")||"",i=t.bundleVers||be.querySettings(Re.Category.ASSETS,"bundleVers")||{},n=t.remoteBundles||be.querySettings(Re.Category.ASSETS,"remoteBundles")||[],r=t.downloadMaxConcurrency||be.querySettings(Re.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||be.querySettings(Re.Category.ASSETS,"importBase")||"";s&&s.endsWith("/")&&(s=s.substr(0,s.length-1));var a=t.nativeBase||be.querySettings(Re.Category.ASSETS,"nativeBase")||"";a&&a.endsWith("/")&&(a=a.substr(0,a.length-1)),this.generalImportBase=s,this.generalNativeBase=a,this._projectBundles=be.querySettings(Re.Category.ASSETS,"projectBundles")||[];var o=be.querySettings(Re.Category.ASSETS,"assetsOverrides")||{};for(var h in o)this.assetsOverrideMap.set(h,o[h])},e.getBundle=function(t){return Fd.get(t)||null},e.removeBundle=function(t){t._destroy(),Fd.remove(t.name)},e.loadAny=function(t,e,i,n){var r=Jy(e,i,n),s=r.options,a=r.onProgress,o=r.onComplete;s.preset=s.preset||"default",t=Array.isArray(t)?t.slice():t;var h=Wd.create({input:t,onProgress:a,onComplete:eT(o),options:s});kd.async(h)},e.preloadAny=function(t,e,i,n){var r=Jy(e,i,n),s=r.options,a=r.onProgress,o=r.onComplete;s.preset=s.preset||"preload",t=Array.isArray(t)?t.slice():t;var h=Wd.create({input:t,onProgress:a,onComplete:eT(o),options:s});Ud.async(h)},e.loadRemote=function(t,e,i){var n=Jy(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?(G(e.message,e.stack),s&&s(e,i)):kT.create(t,i,r.ext||cl(t),r,(function(t,e){s&&s(t,e)}))}))):eT(s)(null,this.assets.get(t))},e.loadBundle=function(t,e,i){var n=Jy(e,void 0,i),r=n.options,s=n.onComplete,a=dl(t);this.bundles.has(a)?eT(s)(null,this.getBundle(a)):(r.preset=r.preset||"bundle",r.ext="bundle",r.__isNative__=!0,this.loadAny({url:t},r,null,(function(e,i){e?(G(e.message,e.stack),s&&s(e,i)):kT.create(t,i,"bundle",r,(function(t,e){s&&s(t,e)}))})))},e.releaseAsset=function(t){Wy.tryRelease(t,!0)},e.releaseUnusedAssets=function(){Bd.forEach((function(t){Wy.tryRelease(t)}))},e.releaseAll=function(){Bd.forEach((function(t){Wy.tryRelease(t,!0)}))},e.loadWithJson=function(){throw new Error("Only valid in Editor")},n(t,[{key:"main",get:function(){return Fd.get(zd.MAIN)||null}},{key:"resources",get:function(){return Fd.get(zd.RESOURCES)||null}}],[{key:"instance",get:function(){return this._instance||(this._instance=new t),this._instance}}]),t}());tS._instance=void 0,tS.Pipeline=Md,tS.Task=Wd,tS.Cache=Dd,tS.RequestItem=KT,tS.Bundle=iT,tS.BuiltinBundleName=zd,tS.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},tS.Downloader=vT,tS.Parser=VT,tS.DependUtil=Wp;var eS=t("em",v.assetManager=tS.instance);v.AssetManager=tS;var iS,nS,rS,sS=t("et",function(){function t(){this._resources={},this._materialsToBeCompiled=[]}var e=t.prototype;return e.init=function(){for(var t=this._resources,e=new Uint8Array(16),i=new Uint8Array(16),n=new Uint8Array(16),r=new Uint8Array(16),s=new Uint8Array(16),a=0,o=0;o<4;o++)e[a]=0,e[a+1]=0,e[a+2]=0,e[a+3]=255,i[a]=0,i[a+1]=0,i[a+2]=0,i[a+3]=0,n[a]=119,n[a+1]=119,n[a+2]=119,n[a+3]=255,r[a]=255,r[a+1]=255,r[a+2]=255,r[a+3]=255,s[a]=127,s[a+1]=127,s[a+2]=255,s[a+3]=255,a+=4;var h=new Uint8Array(1024);a=0;for(var u=0;u<256;u++)h[a]=221,h[a+1]=221,h[a+2]=221,h[a+3]=255,a+=4;a=0;for(var l=0;l<8;l++){for(var c=0;c<8;c++)h[a]=85,h[a+1]=85,h[a+2]=85,h[a+3]=255,a+=4;a+=32}a+=32;for(var _=0;_<8;_++){for(var d=0;d<8;d++)h[a]=85,h[a+1]=85,h[a+2]=85,h[a+3]=255,a+=4;a+=32}var f={width:2,height:2,_data:e,_compressed:!1,format:em.PixelFormat.RGBA8888},p={width:2,height:2,_data:i,_compressed:!1,format:em.PixelFormat.RGBA8888},m={width:2,height:2,_data:n,_compressed:!1,format:em.PixelFormat.RGBA8888},g={width:2,height:2,_data:r,_compressed:!1,format:em.PixelFormat.RGBA8888},y={width:2,height:2,_data:s,_compressed:!1,format:em.PixelFormat.RGBA8888},T={width:16,height:16,_data:h,_compressed:!1,format:em.PixelFormat.RGBA8888},S=new Df(f),E=new em;E._uuid="black-texture",E.image=S,t[E._uuid]=E;var A=new Df(p),R=new em;R._uuid="empty-texture",R.image=A,t[R._uuid]=R;var b=new tg;b._uuid="black-cube-texture",b.setMipFilter(tg.Filter.NEAREST),b.image={front:new Df(f),back:new Df(f),left:new Df(f),right:new Df(f),top:new Df(f),bottom:new Df(f)},t[b._uuid]=b;var C=new Df(m),w=new em;w._uuid="grey-texture",w.image=C,t[w._uuid]=w;var x=new tg;x._uuid="grey-cube-texture",x.setMipFilter(tg.Filter.NEAREST),x.image={front:new Df(m),back:new Df(m),left:new Df(m),right:new Df(m),top:new Df(m),bottom:new Df(m)},t[x._uuid]=x;var I=new Df(g),O=new em;O._uuid="white-texture",O.image=I,t[O._uuid]=O;var D=new tg;D._uuid="white-cube-texture",D.setMipFilter(tg.Filter.NEAREST),D.image={front:new Df(g),back:new Df(g),left:new Df(g),right:new Df(g),top:new Df(g),bottom:new Df(g)},t[D._uuid]=D;var M=new Df(y),P=new em;P._uuid="normal-texture",P.image=M,t[P._uuid]=P;var B=new Df(T),N=new em;N._uuid="default-texture",N.image=B,t[N._uuid]=N;var L=new tg;if(L.setMipFilter(tg.Filter.NEAREST),L._uuid="default-cube-texture",L.image={front:new Df(T),back:new Df(T),left:new Df(T),right:new Df(T),top:new Df(T),bottom:new Df(T)},t[L._uuid]=L,v.SpriteFrame){var F=new v.SpriteFrame,k=S,U=new em;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=be.querySettings(Re.Category.ENGINE,"builtinAssets");if(!e)return Promise.resolve();var i=this._resources;return new Promise((function(n,r){eS.loadBundle(zd.INTERNAL,(function(s){s?r(s):eS.loadAny(e,(function(e,s){e?r(e):(s.forEach((function(e){i[e.name]=e,Wy.addIgnoredAsset(e),e instanceof v.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}()),aS=t("eu",v.builtinResMgr=new sS),oS=t("dv",(iS=new Map,nS=0,function(t){return"number"==typeof t?t:(iS.has(t)||(iS.set(t,1<<nS),nS++),iS.get(t))})),hS=t("dn",function(){function t(t){this.instances=[],this.pass=void 0,this.hasPendingModels=!1,this.dynamicOffsets=[],this._device=void 0,this._device=t.device,this.pass=t}var e=t.prototype;return e.destroy=function(){for(var t=0;t<this.instances.length;++t){var e=this.instances[t];e.vb.destroy(),e.ia.destroy()}this.instances.length=0},e.merge=function(t,e,i){void 0===i&&(i=null);var n=t.instancedAttributeBlock,r=n.buffer.length;if(r){var s=t.inputAssembler,a=t.descriptorSet.getTexture(bv),o=t.descriptorSet.getTexture(Fv),h=t.descriptorSet.getTexture(Gv),u=t.descriptorSet.getTexture(jv),l=t.useReflectionProbeType,c=i;c||(c=t.shaders[e]);for(var _=t.descriptorSet,d=0;d<this.instances.length;++d){var f,p,m=this.instances[d];if(!((null===(f=m.ia.indexBuffer)||void 0===f?void 0:f.objectID)!==(null===(p=s.indexBuffer)||void 0===p?void 0:p.objectID)||m.count>=1024)&&m.lightingMap.objectID===a.objectID&&m.useReflectionProbeType===l&&m.reflectionProbeCubemap.objectID===o.objectID&&m.reflectionProbePlanarMap.objectID===h.objectID&&m.reflectionProbeBlendCubemap.objectID===u.objectID&&m.stride===r){if(m.count>=m.capacity){m.capacity<<=1;var g=m.stride*m.capacity,v=m.data;m.data=new Uint8Array(g),m.data.set(v),m.vb.resize(g)}return m.shader=c,m.descriptorSet=_,m.data.set(n.buffer,m.stride*m.count++),void(this.hasPendingModels=!0)}}for(var y=this._device.createBuffer(new qc(ql.VERTEX|ql.TRANSFER_DST,Jl.HOST|Jl.DEVICE,32*r,r)),T=new Uint8Array(32*r),S=s.vertexBuffers.slice(),E=s.attributes.slice(),A=s.indexBuffer,R=0;R<n.attributes.length;R++){var b=n.attributes[R],C=new __(b.name,b.format,b.isNormalized,S.length,!0);E.push(C)}T.set(n.buffer),S.push(y);var w=new f_(E,S,A),x=this._device.createInputAssembler(w);this.instances.push({count:1,capacity:32,vb:y,data:T,ia:x,stride:r,shader:c,descriptorSet:_,lightingMap:a,reflectionProbeCubemap:o,reflectionProbePlanarMap:h,useReflectionProbeType:l,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}()),uS=new qc(ql.UNIFORM|ql.TRANSFER_DST,Jl.DEVICE),lS=new Qc(null),cS=new C_(null);!function(t){t[t.NONE=0]="NONE",t[t.INSTANCING=1]="INSTANCING"}(rS||(rS={}));var _S=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 ud,this._dss=new od,this._rs=new ad,this._priority=vg.DEFAULT,this._stage=gg.DEFAULT,this._phase=oS("default"),this._passID=4294967295,this._subpassID=4294967295,this._phaseID=4294967295,this._primitive=vc.TRIANGLE_LIST,this._batchingScheme=rS.NONE,this._dynamicStates=Ec.NONE,this._instancedBuffers={},this._hash=0,this._root=void 0,this._device=void 0,this._rootBufferDirty=!1,this._root=t,this._device=wd.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=oS(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(v.rendering&&v.rendering.enableEffectImport){var i=v.rendering.programLib.getKey(t._phaseID,t.program,t.defines);e=t._phaseID.toString()+","+i}else e=Ny.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),Bl(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=Kl.UNKNOWN);var n=this._propertyHandleMap[t];return n?(i?n=_y(n,i):e&&(n=_y(n,hy(n)-e)),n+e):0},e.getBinding=function(e){var i=this.getHandle(e);return i?t.getBindingFromHandle(i):-1},e.setUniform=function(e,i){var n=t.getBindingFromHandle(e),r=t.getTypeFromHandle(e),s=t.getOffsetFromHandle(e),a=this._getBlockView(r,n);fy[r](a,i,s),this._rootBufferDirty=!0},e.getUniform=function(e,i){var n=t.getBindingFromHandle(e),r=t.getTypeFromHandle(e),s=t.getOffsetFromHandle(e),a=this._getBlockView(r,n);return dy[r](a,i,s)},e.setUniformArray=function(e,i){for(var n=t.getBindingFromHandle(e),r=t.getTypeFromHandle(e),s=X_(r)>>2,a=this._getBlockView(r,n),o=t.getOffsetFromHandle(e),h=0;h<i.length;h++,o+=s)null!==i[h]&&fy[r](a,i[h],o);this._rootBufferDirty=!0},e.bindTexture=function(t,e,i){this._descriptorSet.bindTexture(t,e,i||0)},e.bindSampler=function(t,e,i){this._descriptorSet.bindSampler(t,e,i||0)},e.setDynamicState=function(t,e){var i=this._dynamics[t];i&&i.value===e||(i.value=e,i.dirty=!0)},e.overridePipelineStates=function(){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 hS(this))},e.destroy=function(){for(var t=0;t<this._shaderInfo.blocks.length;t++){var e=this._shaderInfo.blocks[t];this._buffers[e.binding].destroy()}for(var i in this._buffers=[],this._rootBuffer&&(this._rootBuffer.destroy(),this._rootBuffer=null),this._instancedBuffers)this._instancedBuffers[i].destroy();this._descriptorSet.destroy(),this._rs.destroy(),this._dss.destroy(),this._bs.destroy()},e.resetUniform=function(e){var i=this.getHandle(e);if(i){for(var n=t.getTypeFromHandle(i),r=t.getBindingFromHandle(i),s=t.getOffsetFromHandle(i),a=t.getCountFromHandle(i),o=this._getBlockView(n,r),h=this._properties[e],u=h&&h.value||gy(n),l=(X_(n)>>2)*a,c=0;c+u.length<=l;c+=u.length)o.set(u,s+c);this._rootBufferDirty=!0}},e.resetTexture=function(e,i){var n=this.getHandle(e);if(n){var r,s=t.getTypeFromHandle(n),a=t.getBindingFromHandle(n),o=this._properties[e],h=o&&o.value,u=(r="string"==typeof h?aS.get(""+h+vy(s)):h||aS.get(gy(s)))&&r.getGFXTexture(),l=o&&void 0!==o.samplerHash?fd.unpackFromHash(o.samplerHash):r&&r.getSamplerInfo(),c=this._device.getSampler(l);this._descriptorSet.bindSampler(a,c,i||0),this._descriptorSet.bindTexture(a,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),a=this._properties[r.name],o=a&&a.value||gy(r.type),h=(X_(r.type)>>2)*r.count,u=0;u+o.length<=h;u+=o.length)s.set(o,i+u);i+=h}this._rootBufferDirty=!0},e.resetTextures=function(){if(v.rendering)for(var t,e=d(this._shaderInfo.descriptors[xg.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],a=0;a<s.count;a++)this.resetTexture(s.name,a)},e.tryCompile=function(){var e=this._root.pipeline;if(!e)return!1;if(this._syncBatchingScheme(),v.rendering&&v.rendering.enableEffectImport){var i=v.rendering.programLib,n=i.getProgramVariant(this._device,this._phaseID,this._programName,this._defines);if(!n)return q(12103,this._programName),!1;this._shader=n.shader,this._pipelineLayout=i.getPipelineLayout(this.device,this._phaseID,this._programName)}else{var r=Ny.getGFXShader(this._device,this._programName,this._defines,e);if(!r)return q(12104,this._programName),!1;this._shader=r,this._pipelineLayout=Ny.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(v.rendering&&v.rendering.enableEffectImport){var s=v.rendering.programLib.getProgramVariant(this._device,this._phaseID,this._programName,this._defines);s&&(r=s.shader)}else r=Ny.getGFXShader(this._device,this._programName,this._defines,e);for(var a=0;a<t.length;a++){var o=t[a];delete this._defines[o.name]}return r},e.beginChangeStatesSilently=function(){},e.endChangeStatesSilently=function(){},e._doInit=function(e,i){if(void 0===i&&(i=!1),this._priority=vg.DEFAULT,this._stage=gg.DEFAULT,v.rendering&&v.rendering.enableEffectImport){var n=v.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=oS("default"),this._primitive=vc.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,v.rendering&&v.rendering.enableEffectImport?this._shaderInfo=v.rendering.programLib.getProgramInfo(this._phaseID,this._programName):this._shaderInfo=Ny.getTemplate(e.program),this._properties=e.properties||this._properties;var s=this._device;t.fillPipelineInfo(this,e),e.stateOverrides&&t.fillPipelineInfo(this,e.stateOverrides),v.rendering&&v.rendering.enableEffectImport?cS.layout=v.rendering.programLib.getMaterialDescriptorSetLayout(this._device,this._phaseID,e.program):cS.layout=Ny.getDescriptorSetLayout(this._device,e.program),this._descriptorSet=this._device.createDescriptorSet(cS);var a,o,h=this._shaderInfo.blocks;if(v.rendering&&v.rendering.enableEffectImport){var u=v.rendering.programLib;a=u.getBlockSizes(this._phaseID,this._programName),o=u.getHandleMap(this._phaseID,this._programName)}else{var l=Ny.getTemplateInfo(e.program);a=l.blockSizes,o=l.handleMap}if(v.rendering&&v.rendering.enableEffectImport){var c=v.rendering.programLib.getShaderInfo(this._phaseID,this.program);this._buildMaterialUniformBlocks(s,c.blocks,a)}else this._buildUniformBlocks(s,h,a);var _=this._propertyHandleMap=o,d={};for(var f in this._properties){var p=this._properties[f];p.handleInfo&&(d[f]=this.getHandle.apply(this,p.handleInfo))}Object.assign(_,d)},e._buildUniformBlocks=function(t,e,i){for(var n=t.capabilities.uboOffsetAlignment,r=[],s=0,a=0,o=0;o<e.length;o++){var h=i[o];r.push(a),a+=Math.ceil(h/n)*n,s=h}var u=r[r.length-1]+s;u&&(uS.size=16*Math.ceil(u/16),this._rootBuffer=t.createBuffer(uS),this._rootBlock=new ArrayBuffer(u));for(var l=0,c=0;l<e.length;l++){var _=e[l].binding,d=i[l];lS.buffer=this._rootBuffer,lS.offset=r[c++],lS.range=16*Math.ceil(d/16);var f=this._buffers[_]=t.createBuffer(lS);this._blocks[_]=new Float32Array(this._rootBlock,lS.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,a=0,o=0;o<e.length;o++)if(1===e[o].set){var h=i[o];r.push(a),a+=Math.ceil(h/n)*n,s=h}if(0!==s){var u=r[r.length-1]+s;u&&(uS.size=16*Math.ceil(u/16),this._rootBuffer=t.createBuffer(uS),this._rootBlock=new ArrayBuffer(u))}for(var l=0,c=0;l<e.length;l++)if(1===e[l].set){var _=e[l].binding,d=i[l];lS.buffer=this._rootBuffer,lS.offset=r[c++],lS.range=16*Math.ceil(d/16);var f=this._buffers[_]=t.createBuffer(lS);this._blocks[_]=new Float32Array(this._rootBlock,lS.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(Xl.INSTANCED_ARRAYS)?this._batchingScheme=rS.INSTANCING:(this._defines.USE_INSTANCING=!1,this._batchingScheme=rS.NONE):this._batchingScheme=rS.NONE},e._getBlockView=function(t,e){return t<Kl.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,v.rendering&&v.rendering.enableEffectImport?this._pipelineLayout=v.rendering.programLib.getPipelineLayout(this.device,this._phaseID,this._programName):this._pipelineLayout=Ny.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 v.rendering&&v.rendering.enableEffectImport?v.rendering.programLib.getLocalDescriptorSetLayout(this._device,this._phaseID,this._programName):Ny.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}();_S.getTypeFromHandle=hy,_S.getBindingFromHandle=uy,_S.getCountFromHandle=ly,_S.getOffsetFromHandle=cy;var dS=t("dp",function(){function t(){}return t.getOrCreatePipelineState=function(t,e,i,n,r){var s=e.hash^n.hash^r.attributesHash^i.typedID,a=this._PSOHashMap.get(s);if(!a){var o=e.pipelineLayout,h=new x_(r.attributes),u=new ld(i,o,n,h,e.rasterizerState,e.depthStencilState,e.blendState,e.primitive,e.dynamicStates);a=t.createPipelineState(u),this._PSOHashMap.set(s,a)}return a},t}());dS._PSOHashMap=new Map;var fS=new Wc,pS=new Fc;function mS(t,e){t.x=e.x*e.x,t.y=e.y*e.y,t.z=e.z*e.z}var gS,vS,yS,TS,SS,ES,AS,RS,bS,CS=null;function wS(){return CS}function xS(t,e,i,n,r){if(!ny()&&n&&n.enabled&&r===CS){var s=n.subModels[0],a=s.inputAssembler,o=s.passes,h=s.shaders,u=s.descriptorSet;fS.width=pS.width=r.window.width,fS.height=pS.height=r.window.height;var l=dS.getOrCreatePipelineState(t,o[0],h[0],e,a);i.setViewport(fS),i.setScissor(pS),i.bindPipelineState(l),i.bindDescriptorSet(xg.MATERIAL,o[0].descriptorSet),i.bindDescriptorSet(xg.LOCAL,u),i.bindInputAssembler(a),i.draw(a)}}var IS=new nn,OS=t("eh",(gS=qs("cc.Material"),vS=xa(Fy),gS((TS=function(t){function e(){var e;return(e=t.call(this)||this)._effectAsset=SS&&SS(),e._techIdx=ES&&ES(),e._defines=AS&&AS(),e._states=RS&&RS(),e._props=bS&&bS(),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(){console.warn("Shaders in material asset '"+this.name+"' cannot be modified at runtime, please instantiate the material first.")},i.overridePipelineStates=function(){console.warn("Pipeline states in material asset '"+this.name+"' cannot be modified at runtime, please instantiate the material first.")},i.onLoaded=function(){this._update()},i.resetUniforms=function(t){void 0===t&&(t=!0),this._props.length=this._passes.length;for(var e=0;e<this._props.length;e++)this._props[e]={};if(t)for(var i,n=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,a=0;a<s;a++){var o=r[a];this._uploadProperty(o,t,e)&&(this._props[o.propertyIndex][t]=e,n=!0)}else{if(i>=this._passes.length)return void console.warn("illegal pass index: "+i+".");var h=this._passes[i];this._uploadProperty(h,t,e)&&(this._props[h.propertyIndex][t]=e,n=!0)}n||console.warn("illegal property name: "+t+".")},i.getProperty=function(t,e){if(void 0===e)for(var i=this._props,n=i.length,r=0;r<n;r++){var s=i[r];if(t in s)return s[t]}else{if(e>=this._passes.length)return console.warn("illegal pass index: "+e+"."),null;var a=this._props[this._passes[e].propertyIndex];if(t in a)return a[t]}return null},i.copy=function(t,e){this._techIdx=t._techIdx,this._props.length=t._props.length;for(var i=0;i<t._props.length;i++)this._props[i]=r({},t._props[i]);this._defines.length=t._defines.length;for(var n=0;n<t._defines.length;n++)this._defines[n]=r({},t._defines[n]);this._states.length=t._states.length;for(var s=0;s<t._states.length;s++)this._states[s]=r({},t._states[s]);this._effectAsset=t._effectAsset,e&&this._fillInfo(e),this._update()},i._fillInfo=function(t){void 0!==t.technique&&(this._techIdx=t.technique),t.effectAsset?this._effectAsset=t.effectAsset:t.effectName&&(this._effectAsset=Fy.get(t.effectName)),t.defines&&this._prepareInfo(t.defines,this._defines),t.states&&this._prepareInfo(t.states,this._states)},i._prepareInfo=function(t,e){var i=t;if(!Array.isArray(i)){var n=this._effectAsset?this._effectAsset.techniques[this._techIdx].passes.length:1;i=Array(n).fill(i)}for(var r=0;r<i.length;++r)Object.assign(e[r]||(e[r]={}),i[r])},i._createPasses=function(){var t=this._effectAsset.techniques[this._techIdx||0];if(!t)return[];for(var e=t.passes.length,i=[],n=0;n<e;++n){var r=t.passes[n],s=r.passIndex=n,a=r.defines=this._defines[s]||(this._defines[s]={});if(r.stateOverrides=this._states[s]||(this._states[s]={}),void 0!==r.propertyIndex&&Object.assign(a,this._defines[r.propertyIndex]),void 0!==r.embeddedMacros&&Object.assign(a,r.embeddedMacros),!r.switch||a[r.switch]){var o=new _S(v.director.root);o.initialize(r),i.push(o)}}return i},i._update=function(t){var i=this;if(void 0===t&&(t=!0),this._effectAsset){this._passes=this._createPasses();var n=this._effectAsset.techniques[this._techIdx].passes.length;if(this._props.length=n,t)this._passes.forEach((function(t,e){var n=i._props[e];for(var r in n||(n=i._props[e]={}),void 0!==t.propertyIndex&&Object.assign(n,i._props[t.propertyIndex]),n)i._uploadProperty(t,r,n[r])}));else for(var r=0;r<this._props.length;r++)this._props[r]={}}this._hash=e.getHash(this)},i._uploadProperty=function(t,e,i){var n=t.getHandle(e);if(!n)return!1;if(_S.getTypeFromHandle(n)<Kl.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;mS(IS,s),IS.w=s.w,i=IS}t.setUniform(n,i)}else t.resetUniform(e);else if(Array.isArray(i))for(var a=0;a<i.length;a++)this._bindTexture(t,n,i[a],a);else i?this._bindTexture(t,n,i):t.resetTexture(e);return!0},i._bindTexture=function(t,e,i,n){var r=_S.getBindingFromHandle(e);if(i instanceof md)t.bindTexture(r,i,n);else if(i instanceof Lf){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 pn("#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}(uf),SS=Gs(TS.prototype,"_effectAsset",[vS],(function(){return null})),ES=Gs(TS.prototype,"_techIdx",[ra],(function(){return 0})),AS=Gs(TS.prototype,"_defines",[ra],(function(){return[]})),RS=Gs(TS.prototype,"_states",[ra],(function(){return[]})),bS=Gs(TS.prototype,"_props",[ra],(function(){return[]})),yS=TS))||yS));v.Material=OS;var DS=ve({Low_256x256:256,Medium_512x512:512,High_1024x1024:1024,Ultra_2048x2048:2048}),MS=ve({Planar:0,ShadowMap:1}),PS=ve({HARD:0,SOFT:1,SOFT_2X:2,SOFT_4X:3}),BS=ve({LEVEL_1:1,LEVEL_2:2,LEVEL_3:3,LEVEL_4:4}),NS=ve({NONE:1,RemoveDuplicates:2,DisableRotationFix:3}),LS=MS.ShadowMap+1,FS=function(){function t(){this.fixedSphere=new yr(0,0,0,.01),this.maxReceived=4,this._matLight=new Dn,this._material=null,this._instancingMaterial=null,this._enabled=!1,this._type=LS,this._distance=0,this._planeBias=1,this._normal=new hn(0,1,0),this._shadowColor=new pn(0,0,0,76),this._size=new Fn(1024,1024),this._shadowMapDirty=!1}var e=t.prototype;return e.getPlanarShader=function(t){this._material||(this._material=new OS,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:LS,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===MS.Planar)this._updatePlanarInfo();else{var t=v.director.root;t.pipeline.macros.CC_SHADOW_TYPE=2,t.onGlobalPipelineStateChanged()}else{var e=v.director.root;e.pipeline.macros.CC_SHADOW_TYPE=0,e.onGlobalPipelineStateChanged()}},e._updatePlanarInfo=function(){this._material||(this._material=new OS,this._material.initialize({effectName:"pipeline/planar-shadow"}));var t=v.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:LS,this.activate()}},{key:"normal",get:function(){return this._normal},set:function(t){hn.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}();FS.MAX_FAR=2e3,FS.COEFFICIENT_OF_EXPANSION=2*Math.sqrt(3),v.Shadows=FS;var kS=function(t){function e(e,i){var n;(n=t.call(this,e.root)||this)._parent=void 0,n._owner=void 0,n._dontNotify=!1,n._parent=e,n._owner=i,n._doInit(n._parent,!0);for(var r=0;r<n._shaderInfo.blocks.length;r++){var s=n._shaderInfo.blocks[r],a=n._blocks[s.binding],o=n._parent.blocks[s.binding];a.set(o)}n._rootBufferDirty=!0;for(var h=n._parent,u=0;u<n._shaderInfo.samplerTextures.length;u++)for(var l=n._shaderInfo.samplerTextures[u],_=0;_<l.count;_++){var d=h._descriptorSet.getSampler(l.binding,_),f=h._descriptorSet.getTexture(l.binding,_);n._descriptorSet.bindSampler(l.binding,d,_),n._descriptorSet.bindTexture(l.binding,f,_)}return t.prototype.tryCompile.call(c(n)),n}s(e,t);var i=e.prototype;return i.overridePipelineStates=function(t,e){this._bs.reset(),this._rs.reset(),this._dss.reset(),_S.fillPipelineInfo(this,t),_S.fillPipelineInfo(this,e),this._onStateChange()},i.tryCompile=function(e){if(e&&!yy(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=rS.NONE},i._onStateChange=function(){this._hash=_S.getPassHash(this),this._owner.onPassStateChange(this._dontNotify)},n(e,[{key:"parent",get:function(){return this._parent}}]),e}(_S),US=function(t){function e(e){var i;return(i=t.call(this)||this)._passes=[],i._parent=void 0,i._owner=void 0,i._subModelIdx=0,i._parent=e.parent,i._owner=e.owner||null,i._subModelIdx=e.subModelIdx||0,i.copy(i._parent),i}s(e,t);var i=e.prototype;return i.recompileShaders=function(t,e){if(this._passes&&this.effectAsset)if(void 0===e)for(var i,n=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 a in t)s[a]=t[a];r.overridePipelineStates(i[r.passIndex],s)}else{var o=this._states[e]||(this._states[e]={});for(var h in t)o[h]=t[h];this._passes[e].overridePipelineStates(i[e],o)}}},i.destroy=function(){return this._doDestroy(),!0},i.onPassStateChange=function(t){this._hash=OS.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 kS(e[i],this));return t},n(e,[{key:"parent",get:function(){return this._parent}},{key:"owner",get:function(){return this._owner}}]),e}(OS),GS=null,HS=null,zS=ve({HEMISPHERE_DIFFUSE:0,AUTOGEN_HEMISPHERE_DIFFUSE_WITH_REFLECTION:1,DIFFUSEMAP_WITH_REFLECTION:2}),VS=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 US({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=v.director.root.pipeline;this._globalDSManager=t.globalDSManager,this._default=aS.get("default-cube-texture"),this._model||(this._model=v.director.root.createModel(v.renderer.scene.Model));var e=this._default.isRGBE;if(this._default.isUsingOfflineMipmaps(),this.envmap&&(e=this.envmap.isRGBE,this.envmap.isUsingOfflineMipmaps()),!HS){var i=new OS;i.initialize({effectName:"pipeline/skybox",defines:{USE_RGBE_CUBEMAP:e}}),HS=new US({parent:i})}this.enabled&&(GS||(GS=v.utils.createMesh(v.primitives.box({width:2,height:2,length:2}))),this._editableMaterial?this._model.initSubModel(0,GS.renderingSubMeshes[0],this._editableMaterial):this._model.initSubModel(0,GS.renderingSubMeshes[0],HS)),this.envmap||(this.envmap=this._default),this.diffuseMap||(this.diffuseMap=this._default),this._updateGlobalBinding(),this._updatePipeline(),this._activated=!0},e._updatePipeline=function(){var t=v.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 a=this.envmap?this.envmap:this._default,o=this._editableMaterial?this._editableMaterial:HS;o&&(o.setProperty("environmentMap",a),o.recompileShaders({USE_RGBE_CUBEMAP:this.isRGBE})),this._model&&(this._model.setSubModelMaterial(0,o),this._updateSubModes())}},e._updateGlobalBinding=function(){if(this._globalDSManager){var t=wd.gfxDevice;if(this.reflectionMap){var e=this.reflectionMap.getGFXTexture(),i=t.getSampler(this.reflectionMap.getSamplerInfo());this._globalDSManager.bindSampler(Gg,i),this._globalDSManager.bindTexture(Gg,e)}else{var n=this.envmap?this.envmap:this._default;if(n){var r=n.getGFXTexture(),s=t.getSampler(n.getSamplerInfo());this._globalDSManager.bindSampler(Gg,s),this._globalDSManager.bindTexture(Gg,r)}}var a=this.diffuseMap?this.diffuseMap:this._default;if(a){var o=a.getGFXTexture(),h=t.getSampler(a.getSamplerInfo());this._globalDSManager.bindSampler(Vg,h),this._globalDSManager.bindTexture(Vg,o)}this._globalDSManager.update()}},e._updateSubModes=function(){if(this._model)for(var t=this._model.subModels,e=0;e<t.length;e++)t[e].update()},n(t,[{key:"model",get:function(){return this._model}},{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled=t,t?this.activate():this._updatePipeline()}},{key:"useHDR",get:function(){return this._useHDR},set:function(t){this._useHDR=t,this.setEnvMaps(this._envmapHDR,this._envmapLDR)}},{key:"useIBL",get:function(){return this._useIBL},set:function(t){this._useIBL=t,this._updatePipeline()}},{key:"useDiffuseMap",get:function(){return this._useDiffuseMap},set:function(t){this._useDiffuseMap=t,this._updatePipeline()}},{key:"isRGBE",get:function(){return!!this.envmap&&this.envmap.isRGBE}},{key:"useConvolutionMap",get:function(){return this.reflectionMap?this.reflectionMap.isUsingOfflineMipmaps():!!this.envmap&&this.envmap.isUsingOfflineMipmaps()}},{key:"envmap",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR?this._envmapHDR:this._envmapLDR},set:function(t){v.director.root.pipeline.pipelineSceneData.isHDR?this.setEnvMaps(t,this._envmapLDR):this.setEnvMaps(this._envmapHDR,t)}},{key:"diffuseMap",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR?this._diffuseMapHDR:this._diffuseMapLDR},set:function(t){v.director.root.pipeline.pipelineSceneData.isHDR?this.setDiffuseMaps(t,this._diffuseMapLDR):this.setDiffuseMaps(this._diffuseMapHDR,t)}},{key:"reflectionMap",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR?this._reflectionHDR:this._reflectionLDR}},{key:"editableMaterial",get:function(){return this._editableMaterial}}]),t}();v.Skybox=VS;var WS=new nn,XS=ve({LINEAR:0,EXP:1,EXP_SQUARED:2,LAYERED:3}),jS=XS.LAYERED+1,YS=function(){function t(){this._fogColor=new pn("#C8C8C8"),this._colorArray=new nn(.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:jS,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=v.director.root,e=this.enabled?this.type:jS,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=jS,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),WS.set(t.x,t.y,t.z,t.w),mS(this._colorArray,WS)}},{key:"type",get:function(){return this._type},set:function(t){this._type=this.enabled?t:jS,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}();v.Fog=YS;var KS,qS,QS,ZS,JS,$S,tE,eE,iE,nE,rE,sE,aE,oE,hE,uE,lE,cE,_E,dE,fE,pE,mE,gE,vE,yE,TE,SE,EE,AE,RE,bE,CE,wE,xE,IE,OE,DE,ME,PE,BE,NE,LE,FE,kE,UE,GE,HE,zE,VE,WE,XE,jE,YE,KE,qE,QE,ZE,JE,$E,tA,eA,iA,nA,rA,sA,aA,oA,hA,uA,lA,cA,_A,dA,fA,pA,mA,gA,vA,yA,TA,SA,EA,AA,RA,bA,CA,wA,xA,IA,OA,DA,MA,PA,BA,NA,LA,FA,kA,UA,GA,HA,zA,VA,WA,XA,jA,YA,KA,qA,QA,ZA,JA,$A,tR,eR,iR,nR,rR,sR,aR,oR,hR,uR,lR,cR,_R,dR,fR,pR,mR=ve({DEFAULT:0,LINEAR:1}),gR=function(){function t(){this._toneMappingType=mR.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=v.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}(),vR=new hn(0,1,0),yR=new hn,TR=new nn,SR=new pn,ER=new En,AR=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)},RR=t("dK",(KS=qs("cc.AmbientInfo"),qS=xa(qe),QS=sa("_skyColor"),ZS=sa("_skyIllum"),JS=sa("_groundAlbedo"),KS((f((tE=function(){function t(){this._skyColorHDR=eE&&eE(),this._skyIllumHDR=iE&&iE(),this._groundAlbedoHDR=nE&&nE(),this._skyColorLDR=rE&&rE(),this._skyIllumLDR=sE&&sE(),this._groundAlbedoLDR=aE&&aE(),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=v.director.root.pipeline.pipelineSceneData.isHDR;return TR.set(t?this._skyColorHDR:this._skyColorLDR),AR(TR),SR.set(255*TR.x,255*TR.y,255*TR.z,255)},set:function(t){TR.set(t.x,t.y,t.z,t.w),v.director.root.pipeline.pipelineSceneData.isHDR?this._skyColorHDR.set(TR):this._skyColorLDR.set(TR),this._resource&&this._resource.skyColor.set(TR)}},{key:"skyColor",set:function(t){v.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 v.director.root.pipeline.pipelineSceneData.isHDR?this._skyIllumHDR:this._skyIllumLDR},set:function(t){v.director.root.pipeline.pipelineSceneData.isHDR?this._skyIllumHDR=t:this._skyIllumLDR=t,this._resource&&(this._resource.skyIllum=t)}},{key:"groundLightingColor",get:function(){var t=v.director.root.pipeline.pipelineSceneData.isHDR;return TR.set(t?this._groundAlbedoHDR:this._groundAlbedoLDR),AR(TR),SR.set(255*TR.x,255*TR.y,255*TR.z,255)},set:function(t){TR.set(t.x,t.y,t.z,t.w),v.director.root.pipeline.pipelineSceneData.isHDR?this._groundAlbedoHDR.set(TR):this._groundAlbedoLDR.set(TR),this._resource&&this._resource.groundAlbedo.set(TR)}},{key:"groundAlbedo",set:function(t){v.director.root.pipeline.pipelineSceneData.isHDR?this._groundAlbedoHDR.set(t):this._groundAlbedoLDR.set(t),this._resource&&this._resource.groundAlbedo.set(t)}}]),t}()).prototype,"skyIllum",[qS],Object.getOwnPropertyDescriptor(tE.prototype,"skyIllum"),tE.prototype),eE=Gs(tE.prototype,"_skyColorHDR",[ra,QS],(function(){return new nn(.2,.5,.8,1)})),iE=Gs(tE.prototype,"_skyIllumHDR",[ra,ZS],(function(){return mg.SKY_ILLUM})),nE=Gs(tE.prototype,"_groundAlbedoHDR",[ra,JS],(function(){return new nn(.2,.2,.2,1)})),rE=Gs(tE.prototype,"_skyColorLDR",[ra],(function(){return new nn(.2,.5,.8,1)})),sE=Gs(tE.prototype,"_skyIllumLDR",[ra],(function(){return mg.SKY_ILLUM})),aE=Gs(tE.prototype,"_groundAlbedoLDR",[ra],(function(){return new nn(.2,.2,.2,1)})),$S=tE))||$S));v.AmbientInfo=RR;var bR=t("dL",(oE=qs("cc.SkyboxInfo"),hE=xa(zS),uE=xa(tg),lE=xa(qe),cE=xa(tg),_E=xa(tg),dE=xa(OS),fE=xa(tg),pE=sa("_envmap"),mE=xa(tg),gE=xa(tg),vE=xa(tg),yE=xa(OS),TE=xa(tg),SE=xa(tg),oE((f((AE=function(){function t(){this._envLightingType=RE&&RE(),this._envmapHDR=bE&&bE(),this._envmapLDR=CE&&CE(),this._diffuseMapHDR=wE&&wE(),this._diffuseMapLDR=xE&&xE(),this._enabled=IE&&IE(),this._useHDR=OE&&OE(),this._editableMaterial=DE&&DE(),this._reflectionHDR=ME&&ME(),this._reflectionLDR=PE&&PE(),this._rotationAngle=BE&&BE(),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=zS.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 zS.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||zS.HEMISPHERE_DIFFUSE===t?(zS.HEMISPHERE_DIFFUSE===t?(this.useIBL=!1,this.applyDiffuseMap=!1):zS.AUTOGEN_HEMISPHERE_DIFFUSE_WITH_REFLECTION===t?(this.useIBL=!0,this.applyDiffuseMap=!1):zS.DIFFUSEMAP_WITH_REFLECTION===t&&(this.useIBL=!0,this.applyDiffuseMap=!0),this._envLightingType=t):(this.useIBL=!1,this.applyDiffuseMap=!1,this._envLightingType=zS.HEMISPHERE_DIFFUSE,q(15001))}},{key:"useIBL",get:function(){return zS.HEMISPHERE_DIFFUSE!==this._envLightingType},set:function(t){this._resource&&(this._resource.useIBL=t)}},{key:"useHDR",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR=this._useHDR,this._useHDR},set:function(t){v.director.root.pipeline.pipelineSceneData.isHDR=t,this._useHDR=t,this._resource&&this.envLightingType===zS.DIFFUSEMAP_WITH_REFLECTION&&(null===this.diffuseMap?(this.envLightingType=zS.AUTOGEN_HEMISPHERE_DIFFUSE_WITH_REFLECTION,q(15e3)):this.diffuseMap.isDefault&&q(15002)),this._resource&&(this._resource.useHDR=this._useHDR,this._resource.updateMaterialRenderInfo())}},{key:"envmap",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR?this._envmapHDR:this._envmapLDR},set:function(t){var e=v.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=zS.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 v.director.root.pipeline.pipelineSceneData.isHDR?this._diffuseMapHDR:this._diffuseMapLDR},set:function(t){v.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 v.director.root.pipeline.pipelineSceneData.isHDR?this._reflectionHDR:this._reflectionLDR},set:function(t){v.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",[hE],Object.getOwnPropertyDescriptor(AE.prototype,"envLightingType"),AE.prototype),f(AE.prototype,"envmap",[uE],Object.getOwnPropertyDescriptor(AE.prototype,"envmap"),AE.prototype),f(AE.prototype,"rotationAngle",[lE],Object.getOwnPropertyDescriptor(AE.prototype,"rotationAngle"),AE.prototype),f(AE.prototype,"diffuseMap",[cE],Object.getOwnPropertyDescriptor(AE.prototype,"diffuseMap"),AE.prototype),f(AE.prototype,"reflectionMap",[_E],Object.getOwnPropertyDescriptor(AE.prototype,"reflectionMap"),AE.prototype),f(AE.prototype,"skyboxMaterial",[dE],Object.getOwnPropertyDescriptor(AE.prototype,"skyboxMaterial"),AE.prototype),RE=Gs(AE.prototype,"_envLightingType",[ra],(function(){return zS.HEMISPHERE_DIFFUSE})),bE=Gs(AE.prototype,"_envmapHDR",[ra,fE,pE],(function(){return null})),CE=Gs(AE.prototype,"_envmapLDR",[ra,mE],(function(){return null})),wE=Gs(AE.prototype,"_diffuseMapHDR",[ra,gE],(function(){return null})),xE=Gs(AE.prototype,"_diffuseMapLDR",[ra,vE],(function(){return null})),IE=Gs(AE.prototype,"_enabled",[ra],(function(){return!1})),OE=Gs(AE.prototype,"_useHDR",[ra],(function(){return!0})),DE=Gs(AE.prototype,"_editableMaterial",[ra,yE],(function(){return null})),ME=Gs(AE.prototype,"_reflectionHDR",[ra,TE],(function(){return null})),PE=Gs(AE.prototype,"_reflectionLDR",[ra,SE],(function(){return null})),BE=Gs(AE.prototype,"_rotationAngle",[ra],(function(){return 0})),EE=AE))||EE));v.SkyboxInfo=bR;var CR=t("dM",(NE=qs("cc.FogInfo"),LE=xa(XS),FE=xa(qe),kE=xa(qe),UE=xa(qe),GE=xa(qe),HE=xa(qe),zE=xa(qe),NE(((eA=function(){function t(){this._type=XE&&XE(),this._fogColor=jE&&jE(),this._enabled=YE&&YE(),this._fogDensity=KE&&KE(),this._fogStart=qE&&qE(),this._fogEnd=QE&&QE(),this._fogAtten=ZE&&ZE(),this._fogTop=JE&&JE(),this._fogRange=$E&&$E(),this._accurate=tA&&tA(),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=XS,f((WE=eA).prototype,"type",[LE],Object.getOwnPropertyDescriptor(WE.prototype,"type"),WE.prototype),f(WE.prototype,"fogDensity",[FE],Object.getOwnPropertyDescriptor(WE.prototype,"fogDensity"),WE.prototype),f(WE.prototype,"fogStart",[kE],Object.getOwnPropertyDescriptor(WE.prototype,"fogStart"),WE.prototype),f(WE.prototype,"fogEnd",[UE],Object.getOwnPropertyDescriptor(WE.prototype,"fogEnd"),WE.prototype),f(WE.prototype,"fogAtten",[GE],Object.getOwnPropertyDescriptor(WE.prototype,"fogAtten"),WE.prototype),f(WE.prototype,"fogTop",[HE],Object.getOwnPropertyDescriptor(WE.prototype,"fogTop"),WE.prototype),f(WE.prototype,"fogRange",[zE],Object.getOwnPropertyDescriptor(WE.prototype,"fogRange"),WE.prototype),XE=Gs(WE.prototype,"_type",[ra],(function(){return XS.LINEAR})),jE=Gs(WE.prototype,"_fogColor",[ra],(function(){return new pn("#C8C8C8")})),YE=Gs(WE.prototype,"_enabled",[ra],(function(){return!1})),KE=Gs(WE.prototype,"_fogDensity",[ra],(function(){return.3})),qE=Gs(WE.prototype,"_fogStart",[ra],(function(){return.5})),QE=Gs(WE.prototype,"_fogEnd",[ra],(function(){return 300})),ZE=Gs(WE.prototype,"_fogAtten",[ra],(function(){return 5})),JE=Gs(WE.prototype,"_fogTop",[ra],(function(){return 1.5})),$E=Gs(WE.prototype,"_fogRange",[ra],(function(){return 1.2})),tA=Gs(WE.prototype,"_accurate",[ra],(function(){return!1})),VE=WE))||VE)),wR=t("dN",(iA=qs("cc.ShadowsInfo"),nA=xa(MS),rA=xa(qe),sA=xa(qe),aA=xa(Ke),oA=xa(DS),iA((f((uA=function(){function t(){this._enabled=lA&&lA(),this._type=cA&&cA(),this._normal=_A&&_A(),this._distance=dA&&dA(),this._planeBias=fA&&fA(),this._shadowColor=pA&&pA(),this._maxReceived=mA&&mA(),this._size=gA&&gA(),this._resource=null}var e=t.prototype;return e.setPlaneFromNode=function(t){t.getWorldRotation(ER),this.planeDirection=hn.transformQuat(yR,vR,ER),t.getWorldPosition(yR),this.planeHeight=hn.dot(this._normal,yR)},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){hn.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",[nA],Object.getOwnPropertyDescriptor(uA.prototype,"type"),uA.prototype),f(uA.prototype,"planeHeight",[rA],Object.getOwnPropertyDescriptor(uA.prototype,"planeHeight"),uA.prototype),f(uA.prototype,"planeBias",[sA],Object.getOwnPropertyDescriptor(uA.prototype,"planeBias"),uA.prototype),f(uA.prototype,"maxReceived",[aA],Object.getOwnPropertyDescriptor(uA.prototype,"maxReceived"),uA.prototype),f(uA.prototype,"shadowMapSize",[oA],Object.getOwnPropertyDescriptor(uA.prototype,"shadowMapSize"),uA.prototype),lA=Gs(uA.prototype,"_enabled",[ra],(function(){return!1})),cA=Gs(uA.prototype,"_type",[ra],(function(){return MS.Planar})),_A=Gs(uA.prototype,"_normal",[ra],(function(){return new hn(0,1,0)})),dA=Gs(uA.prototype,"_distance",[ra],(function(){return 0})),fA=Gs(uA.prototype,"_planeBias",[ra],(function(){return 1})),pA=Gs(uA.prototype,"_shadowColor",[ra],(function(){return new pn(0,0,0,76)})),mA=Gs(uA.prototype,"_maxReceived",[ra],(function(){return 4})),gA=Gs(uA.prototype,"_size",[ra],(function(){return new Fn(1024,1024)})),hA=uA))||hA));v.ShadowsInfo=wR;var xR=t("dO",new hn(-1024,-1024,-1024)),IR=t("dP",new hn(1024,1024,1024)),OR=t("dQ",8),DR=t("dR",(vA=qs("cc.OctreeInfo"),yA=xa(Ke),vA((f((SA=function(){function t(){this._enabled=EA&&EA(),this._minPos=AA&&AA(),this._maxPos=RA&&RA(),this._depth=bA&&bA(),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",[yA],Object.getOwnPropertyDescriptor(SA.prototype,"depth"),SA.prototype),EA=Gs(SA.prototype,"_enabled",[ra],(function(){return!1})),AA=Gs(SA.prototype,"_minPos",[ra],(function(){return new hn(xR)})),RA=Gs(SA.prototype,"_maxPos",[ra],(function(){return new hn(IR)})),bA=Gs(SA.prototype,"_depth",[ra],(function(){return OR})),TA=SA))||TA));v.OctreeInfo=DR;var MR=t("dS",(CA=qs("cc.SkinInfo"),wA=xa(qe),xA=xa(qe),CA((f((OA=function(){function t(){this._enabled=DA&&DA(),this._blurRadius=MA&&MA(),this._sssIntensity=PA&&PA(),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",[wA],Object.getOwnPropertyDescriptor(OA.prototype,"blurRadius"),OA.prototype),f(OA.prototype,"sssIntensity",[xA],Object.getOwnPropertyDescriptor(OA.prototype,"sssIntensity"),OA.prototype),DA=Gs(OA.prototype,"_enabled",[ra],(function(){return!0})),MA=Gs(OA.prototype,"_blurRadius",[ra],(function(){return.01})),PA=Gs(OA.prototype,"_sssIntensity",[ra],(function(){return 3})),IA=OA))||IA));v.SkinInfo=MR;var PR=t("dT",(BA=qs("cc.PostSettingsInfo"),NA=xa(mR),BA((f((FA=function(){function t(){this._toneMappingType=kA&&kA(),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",[NA],Object.getOwnPropertyDescriptor(FA.prototype,"toneMappingType"),FA.prototype),kA=Gs(FA.prototype,"_toneMappingType",[ra],(function(){return mR.DEFAULT})),LA=FA))||LA));v.PostSettingsInfo=PR;var BR,NR,LR,FR,kR,UR,GR,HR,zR,VR,WR,XR,jR,YR,KR,qR,QR,ZR,JR,$R,tb,eb,ib,nb,rb,sb,ab,ob,hb,ub,lb,cb,_b,db,fb,pb,mb,gb,vb,yb,Tb,Sb,Eb,Ab,Rb,bb,Cb,wb,xb,Ib,Ob,Db,Mb,Pb,Bb,Nb,Lb,Fb,kb,Ub,Gb,Hb,zb,Vb,Wb,Xb,jb,Yb,Kb,qb=t("dU",(UA=qs("cc.LightProbeInfo"),GA=xa(qe),HA=xa(Ke),zA=xa(Ke),VA=xa(qe),WA=xa(qe),UA((f((jA=function(){function t(){this._giScale=YA&&YA(),this._giSamples=KA&&KA(),this._bounces=qA&&qA(),this._reduceRinging=QA&&QA(),this._showProbe=ZA&&ZA(),this._showWireframe=JA&&JA(),this._showConvex=$A&&$A(),this._data=tR&&tR(),this._lightProbeSphereVolume=eR&&eR(),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(um.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),v.internal.LightProbesData){this._data||(this._data=new v.internal.LightProbesData,this._resource&&(this._resource.data=this._data));for(var e=[],i=0;i<this._nodes.length;i++){var n=this._nodes[i].node,r=this._nodes[i].probes,s=n.worldPosition;if(r)for(var a=0;a<r.length;a++){var o=new hn(0,0,0);hn.add(o,r[a],s),e.push(o)}}if(e.length<4)return this.resetAllTetraIndices(),void this._data.reset();this._data.updateProbes(e),t&&(this.resetAllTetraIndices(),this._data.updateTetrahedrons())}},e.clearAllSHUBOs=function(){if(this._scene){var t=this._scene.renderScene;if(t)for(var e=t.models,i=0;i<e.length;i++)e[i].clearSHUBOs()}},e.resetAllTetraIndices=function(){if(this._scene){var t=this._scene.renderScene;if(t)for(var e=t.models,i=0;i<e.length;i++)e[i].tetrahedronIndex=-1}},n(t,[{key:"giScale",get:function(){return this._giScale},set:function(t){this._giScale!==t&&(this._giScale=t,this._resource&&(this._resource.giScale=t))}},{key:"giSamples",get:function(){return this._giSamples},set:function(t){this._giSamples!==t&&(this._giSamples=t,this._resource&&(this._resource.giSamples=t))}},{key:"bounces",get:function(){return this._bounces},set:function(t){this._bounces!==t&&(this._bounces=t,this._resource&&(this._resource.bounces=t))}},{key:"reduceRinging",get:function(){return this._reduceRinging},set:function(t){this._reduceRinging!==t&&(this._reduceRinging=t,this._resource&&(this._resource.reduceRinging=t))}},{key:"showProbe",get:function(){return this._showProbe},set:function(t){this._showProbe!==t&&(this._showProbe=t,this._resource&&(this._resource.showProbe=t))}},{key:"showWireframe",get:function(){return this._showWireframe},set:function(t){this._showWireframe!==t&&(this._showWireframe=t,this._resource&&(this._resource.showWireframe=t))}},{key:"showConvex",get:function(){return this._showConvex},set:function(t){this._showConvex!==t&&(this._showConvex=t,this._resource&&(this._resource.showConvex=t))}},{key:"data",get:function(){return this._data},set:function(t){this._data!==t&&(this._data=t,this._resource&&(this._resource.data=t))}},{key:"lightProbeSphereVolume",get:function(){return this._lightProbeSphereVolume},set:function(t){this._lightProbeSphereVolume!==t&&(this._lightProbeSphereVolume=t,this._resource&&(this._resource.lightProbeSphereVolume=t))}}]),t}()).prototype,"giScale",[GA],Object.getOwnPropertyDescriptor(jA.prototype,"giScale"),jA.prototype),f(jA.prototype,"giSamples",[HA],Object.getOwnPropertyDescriptor(jA.prototype,"giSamples"),jA.prototype),f(jA.prototype,"bounces",[zA],Object.getOwnPropertyDescriptor(jA.prototype,"bounces"),jA.prototype),f(jA.prototype,"reduceRinging",[VA],Object.getOwnPropertyDescriptor(jA.prototype,"reduceRinging"),jA.prototype),f(jA.prototype,"lightProbeSphereVolume",[WA],Object.getOwnPropertyDescriptor(jA.prototype,"lightProbeSphereVolume"),jA.prototype),YA=Gs(jA.prototype,"_giScale",[ra],(function(){return 1})),KA=Gs(jA.prototype,"_giSamples",[ra],(function(){return 1024})),qA=Gs(jA.prototype,"_bounces",[ra],(function(){return 2})),QA=Gs(jA.prototype,"_reduceRinging",[ra],(function(){return 0})),ZA=Gs(jA.prototype,"_showProbe",[ra],(function(){return!0})),JA=Gs(jA.prototype,"_showWireframe",[ra],(function(){return!0})),$A=Gs(jA.prototype,"_showConvex",[ra],(function(){return!1})),tR=Gs(jA.prototype,"_data",[ra],(function(){return null})),eR=Gs(jA.prototype,"_lightProbeSphereVolume",[ra],(function(){return 1})),XA=jA))||XA)),Qb=t("dV",(iR=qs("cc.SceneGlobals"),nR=xa(bR),iR((sR=function(){function t(){this.ambient=aR&&aR(),this.shadows=oR&&oR(),this._skybox=hR&&hR(),this.fog=uR&&uR(),this.octree=lR&&lR(),this.skin=cR&&cR(),this.lightProbeInfo=_R&&_R(),this.postSettings=dR&&dR(),this.bakedWithStationaryMainLight=fR&&fR(),this.bakedWithHighpLightmap=pR&&pR(),this.disableLightmap=!1}return t.prototype.activate=function(t){var e=v.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),v.director.root.onGlobalPipelineStateChanged()},n(t,[{key:"skybox",get:function(){return this._skybox},set:function(t){this._skybox=t}}]),t}(),aR=Gs(sR.prototype,"ambient",[ra],(function(){return new RR})),oR=Gs(sR.prototype,"shadows",[ra],(function(){return new wR})),hR=Gs(sR.prototype,"_skybox",[ra],(function(){return new bR})),uR=Gs(sR.prototype,"fog",[ra],(function(){return new CR})),f(sR.prototype,"skybox",[nR],Object.getOwnPropertyDescriptor(sR.prototype,"skybox"),sR.prototype),lR=Gs(sR.prototype,"octree",[ra],(function(){return new DR})),cR=Gs(sR.prototype,"skin",[ra],(function(){return new MR})),_R=Gs(sR.prototype,"lightProbeInfo",[ra],(function(){return new qb})),dR=Gs(sR.prototype,"postSettings",[ra],(function(){return new PR})),fR=Gs(sR.prototype,"bakedWithStationaryMainLight",[ra],(function(){return!1})),pR=Gs(sR.prototype,"bakedWithHighpLightmap",[ra],(function(){return!1})),rR=sR))||rR));v.SceneGlobals=Qb;var Zb=(BR=qs("cc.TargetInfo"),NR=xa([Ze]),BR((FR=function(){this.localID=kR&&kR()},kR=Gs(FR.prototype,"localID",[ra,NR],(function(){return[]})),LR=FR))||LR),Jb=(UR=qs("cc.TargetOverrideInfo"),GR=xa(Wa),HR=xa(Zb),zR=xa([Ze]),VR=xa($m),WR=xa(Zb),UR((jR=function(){this.source=YR&&YR(),this.sourceInfo=KR&&KR(),this.propertyPath=qR&&qR(),this.target=QR&&QR(),this.targetInfo=ZR&&ZR()},YR=Gs(jR.prototype,"source",[ra,GR],(function(){return null})),KR=Gs(jR.prototype,"sourceInfo",[ra,HR],(function(){return null})),qR=Gs(jR.prototype,"propertyPath",[ra,zR],(function(){return[]})),QR=Gs(jR.prototype,"target",[ra,VR],(function(){return null})),ZR=Gs(jR.prototype,"targetInfo",[ra,WR],(function(){return null})),XR=jR))||XR),$b=qs("cc.CompPrefabInfo")(($R=function(){this.fileId=tb&&tb()},tb=Gs($R.prototype,"fileId",[ra],(function(){return""})),JR=$R))||JR,tC=(eb=qs("CCPropertyOverrideInfo"),ib=xa(Zb),nb=xa([Ze]),eb((sb=function(){function t(){this.targetInfo=ab&&ab(),this.propertyPath=ob&&ob(),this.value=hb&&hb()}return t.prototype.isTarget=function(){},t}(),ab=Gs(sb.prototype,"targetInfo",[ra,ib],(function(){return null})),ob=Gs(sb.prototype,"propertyPath",[ra,nb],(function(){return[]})),hb=Gs(sb.prototype,"value",[ra],null),rb=sb))||rb),eC=(ub=qs("cc.MountedChildrenInfo"),lb=xa(Zb),cb=xa([$m]),ub((db=function(){function t(){this.targetInfo=fb&&fb(),this.nodes=pb&&pb()}return t.prototype.isTarget=function(){},t}(),fb=Gs(db.prototype,"targetInfo",[ra,lb],(function(){return null})),pb=Gs(db.prototype,"nodes",[ra,cb],(function(){return[]})),_b=db))||_b),iC=(mb=qs("cc.MountedComponentsInfo"),gb=xa(Zb),vb=xa([op]),mb((Tb=function(){function t(){this.targetInfo=Sb&&Sb(),this.components=Eb&&Eb()}return t.prototype.isTarget=function(){},t}(),Sb=Gs(Tb.prototype,"targetInfo",[ra,gb],(function(){return null})),Eb=Gs(Tb.prototype,"components",[ra,vb],(function(){return[]})),yb=Tb))||yb),nC=(Ab=qs("cc.PrefabInstance"),Rb=xa($m),bb=xa([eC]),Cb=xa([iC]),wb=xa([tC]),xb=xa([Zb]),Ab((Ob=function(){function t(){this.fileId=Db&&Db(),this.prefabRootNode=Mb&&Mb(),this.mountedChildren=Pb&&Pb(),this.mountedComponents=Bb&&Bb(),this.propertyOverrides=Nb&&Nb(),this.removedComponents=Lb&&Lb(),this.targetMap={},this.expanded=!1}var e=t.prototype;return e.findPropertyOverride=function(){},e.removePropertyOverride=function(){},t}(),Db=Gs(Ob.prototype,"fileId",[ra],(function(){return""})),Mb=Gs(Ob.prototype,"prefabRootNode",[ra,Rb],null),Pb=Gs(Ob.prototype,"mountedChildren",[ra,bb],(function(){return[]})),Bb=Gs(Ob.prototype,"mountedComponents",[ra,Cb],(function(){return[]})),Nb=Gs(Ob.prototype,"propertyOverrides",[ra,wb],(function(){return[]})),Lb=Gs(Ob.prototype,"removedComponents",[ra,xb],(function(){return[]})),Ib=Ob))||Ib),rC=(Fb=qs("cc.PrefabInfo"),kb=xa($m),Ub=xa(nC),Gb=xa([Jb]),Fb((zb=function(){this.root=Vb&&Vb(),this.asset=Wb&&Wb(),this.fileId=Xb&&Xb(),this.instance=jb&&jb(),this.targetOverrides=Yb&&Yb(),this.nestedPrefabInstanceRoots=Kb&&Kb()},Vb=Gs(zb.prototype,"root",[ra,kb],null),Wb=Gs(zb.prototype,"asset",[ra],null),Xb=Gs(zb.prototype,"fileId",[ra],(function(){return""})),jb=Gs(zb.prototype,"instance",[ra,Ub],null),Yb=Gs(zb.prototype,"targetOverrides",[ra,Gb],null),Kb=Gs(zb.prototype,"nestedPrefabInstanceRoots",[ra],null),Hb=zb))||Hb);function sC(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[Oa],v.game._isCloning=!0,e.asset._doInstantiate(t),v.game._isCloning=!1,t._objFlags=i,t.modifyParent(n),t.id=r,t.prefab&&(t.prefab.instance=e.instance)}}function aC(t,e,i){var n;if(e&&t){var r=e,s=null===(n=t.prefab)||void 0===n?void 0:n.instance;!i&&s&&(e[s.fileId]={},r=e[s.fileId]);var a=t.prefab;a&&(r[a.fileId]=t);for(var o=t.components,h=0;h<o.length;h++){var u=o[h];u.__prefab&&(r[u.__prefab.fileId]=u)}for(var l=0;l<t.children.length;l++)aC(t.children[l],r,!1)}}function oC(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 hC(t,e,i){if(e)for(var n=0;n<e.length;n++){var r=e[n];if(r&&r.targetInfo){var s=oC(r.targetInfo.localID,i);if(!s)continue;var a=i,o=r.targetInfo.localID;if(o.length>0)for(var h=0;h<o.length-1;h++)a=a[o[h]];if(r.nodes)for(var u=0;u<r.nodes.length;u++){var l=r.nodes[u];l&&!s.children.includes(l)&&(s.children.push(l),l.modifyParent(s),aC(l,a,!1),l.siblingIndex=s.children.length-1,dC(l,!0))}}}}function uC(t,e,i){if(e)for(var n=0;n<e.length;n++){var r=e[n];if(r&&r.targetInfo){var s=oC(r.targetInfo.localID,i);if(!s)continue;if(r.components)for(var a=0;a<r.components.length;a++){var o=r.components[a];o&&(o.node=s,s.getWritableComponents().push(o))}}}}function lC(t,e,i){if(e)for(var n=0;n<e.length;n++){var r=e[n];if(r){var s=oC(r.localID,i);if(!s||!s.node)continue;var a=s.node.components.indexOf(s);a>=0&&s.node.getWritableComponents().splice(a,1)}}}function cC(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=oC(s.targetInfo.localID,i)))continue;var a=n,o=s.propertyPath.slice();if(o.length>0){var h=o.pop();if(!h)continue;for(var u=0;u<o.length&&(a=a[o[u]]);u++);if(!a)continue;if(Array.isArray(a))if("length"===h)a[h]=s.value;else{var l=Number.parseInt(h);Number.isInteger(l)&&l<a.length&&(a[h]=s.value)}else a[h]instanceof Ae?a[h].set(s.value):a[h]=s.value}}}}function _C(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],a=s.source,o=s.sourceInfo;if(o){var h,u=s.source,l=null==u||null===(h=u.prefab)||void 0===h?void 0:h.instance;l&&l.targetMap&&(a=oC(o.localID,l.targetMap))}if(a){var c,_=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&&(c=oC(_.localID,f.targetMap))){var p=s.propertyPath.slice(),m=a;if(p.length>0){var g=p.pop();if(!g)return;for(var v=0;v<p.length&&(m=m[p[v]]);v++);if(!m)continue;m[g]=c}}}}}}function dC(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){sC(t),e&&t&&t.children&&t.children.forEach((function(t){dC(t,!0)}));var r={};n.targetMap=r,aC(t,r,!0),hC(0,n.mountedChildren,r),lC(0,n.removedComponents,r),uC(0,n.mountedComponents,r),cC(0,n.propertyOverrides,r),n.expanded=!0}else e&&t&&t.children&&t.children.forEach((function(t){dC(t,!0)}))}function fC(t){var e=t.prefab;e&&e.nestedPrefabInstanceRoots&&e.nestedPrefabInstanceRoots.forEach((function(t){dC(t)}))}v._PrefabInfo=rC;var pC,mC,gC,vC,yC,TC,SC,EC=Object.freeze({__proto__:null,createNodeWithPrefab:sC,generateTargetMap:aC,getTarget:oC,applyMountedChildren:hC,applyMountedComponents:uC,applyRemovedComponents:lC,applyPropertyOverrides:cC,applyTargetOverrides:_C,expandPrefabInstanceNode:dC,expandNestedPrefabInstanceNode:fC,applyNodeAndComponentId:function t(e,i){for(var n=e.components,r=e.children,s=0;s<n.length;s++){var a,o,h=n[s],u=null!==(a=null===(o=h.__prefab)||void 0===o?void 0:o.fileId)&&void 0!==a?a:"";h._id=""+i+u}for(var l=0;l<r.length;l++){var c=r[l],_=c.prefab,d=null!=_&&_.instance?_.instance.fileId:null==_?void 0:_.fileId;d&&(c.id=""+i+d,null!=_&&_.instance||t(c,i))}},TargetInfo:Zb,TargetOverrideInfo:Jb,CompPrefabInfo:$b,PropertyOverrideInfo:tC,MountedChildrenInfo:eC,MountedComponentsInfo:iC,PrefabInstance:nC,PrefabInfo:rC}),AC=t("dz",qs("cc.Scene")((mC=function(t){s(i,t);var e=i.prototype;function i(e){var i;return(i=t.call(this,e)||this).autoReleaseAssets=gC&&gC(),i._globals=vC&&vC(),i.dependAssets=null,i._renderScene=null,i._inited=void 0,i._prefabSyncedInLiveReload=!1,i._activeInHierarchy=!1,v.director&&v.director.root&&(i._renderScene=v.director.root.createScene({})),i._inited=!v.game||!v.game._isCloning,i}return e._updateScene=function(){this._scene=this},e.destroy=function(){var t=Wa.prototype.destroy.call(this);if(t)for(var e=this._children,i=0;i<e.length;++i)e[i].active=!1;return this._renderScene&&v.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(){},e._load=function(){this._inited||(fC(this),_C(this),this._onBatchCreated(m),this._inited=!0),this.walk($m._setScene)},e._activate=function(t){void 0===t&&(t=!0),v.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}($m),gC=Gs(mC.prototype,"autoReleaseAssets",[ra],(function(){return!1})),vC=Gs(mC.prototype,"_globals",[ra],(function(){return new Qb})),pC=mC))||pC);v.Scene=AC;var RC=t("ea",qs("cc.SceneAsset")((TC=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).scene=SC&&SC(),e}s(e,t);var i=e.prototype;return i.initDefault=function(e){t.prototype.initDefault.call(this,e),this.scene=new AC("New Scene")},i.validate=function(){return!!this.scene},e}(uf),SC=Gs(TC.prototype,"scene",[ra],(function(){return null})),yC=TC))||yC);v.SceneAsset=RC,mt({SystemEventType:{newName:"Input.EventType",since:"3.3.0",removed:!1}}),mt({SystemEvent:{newName:"Input",since:"3.4.0",removed:!1},systemEvent:{newName:"input",since:"3.4.0",removed:!1}});var bC,CC,wC=t("ex",function(){function t(t,e){this.type=void 0,this.bubbles=void 0,this.target=null,this.currentTarget=null,this.eventPhase=0,this.propagationStopped=!1,this.propagationImmediateStopped=!1,this.type=t,this.bubbles=!!e}var e=t.prototype;return e.unuse=function(){this.type=t.NO_TYPE,this.target=null,this.currentTarget=null,this.eventPhase=t.NONE,this.propagationStopped=!1,this.propagationImmediateStopped=!1},e.reuse=function(t,e){this.type=t,this.bubbles=e||!1},e.isStopped=function(){return this.propagationStopped||this.propagationImmediateStopped},e.getCurrentTarget=function(){return this.currentTarget},e.getType=function(){return this.type},t}());wC.NO_TYPE="no_type",wC.TOUCH="touch",wC.MOUSE="mouse",wC.KEYBOARD="keyboard",wC.ACCELERATION="acceleration",wC.NONE=0,wC.CAPTURING_PHASE=1,wC.AT_TARGET=2,wC.BUBBLING_PHASE=3,v.Event=wC,t("ew",bC),function(t){t.TOUCH_START="touch-start",t.TOUCH_MOVE="touch-move",t.TOUCH_END="touch-end",t.TOUCH_CANCEL="touch-cancel",t.MOUSE_DOWN="mouse-down",t.MOUSE_MOVE="mouse-move",t.MOUSE_UP="mouse-up",t.MOUSE_WHEEL="mouse-wheel",t.MOUSE_ENTER="mouse-enter",t.MOUSE_LEAVE="mouse-leave",t.KEY_DOWN="keydown",t.KEY_UP="keyup",t.DEVICEMOTION="devicemotion",t.TRANSFORM_CHANGED="transform-changed",t.SCENE_CHANGED_FOR_PERSISTS="scene-changed-for-persists",t.SIZE_CHANGED="size-changed",t.ANCHOR_CHANGED="anchor-changed",t.COLOR_CHANGED="color-changed",t.CHILD_ADDED="child-added",t.CHILD_REMOVED="child-removed",t.PARENT_CHANGED="parent-changed",t.NODE_DESTROYED="node-destroyed",t.LAYER_CHANGED="layer-changed",t.SIBLING_ORDER_CHANGED="sibling-order-changed"}(bC||t("ew",bC={})),function(t){t.TOUCH_START="touch-start",t.TOUCH_MOVE="touch-move",t.TOUCH_END="touch-end",t.TOUCH_CANCEL="touch-cancel",t.MOUSE_DOWN="mouse-down",t.MOUSE_MOVE="mouse-move",t.MOUSE_UP="mouse-up",t.MOUSE_WHEEL="mouse-wheel",t.KEY_DOWN="keydown",t.KEY_PRESSING="key-pressing",t.KEY_UP="keyup",t.DEVICEMOTION="devicemotion",t.GAMEPAD_INPUT="gamepad-input",t.GAMEPAD_CHANGE="gamepad-change",t.HANDLE_INPUT="handle-input",t.HANDLE_POSE_INPUT="handle-pose-input",t.HMD_POSE_INPUT="hmd-pose-input",t.HANDHELD_POSE_INPUT="handheld-pose-input"}(CC||(CC={})),v.SystemEventType=bC;var xC=t("ey",function(t){function e(e,i){var n;return(n=t.call(this,bC.DEVICEMOTION,i)||this).acc=void 0,n.acc=e,n}return s(e,t),e}(wC));wC.EventAcceleration=xC;var IC=t("ez",function(t){function e(e,i,n){var r;return"boolean"==typeof i&&(i=i?bC.KEY_DOWN:bC.KEY_UP),(r=t.call(this,i,n)||this).windowId=void 0,r.keyCode=void 0,r.rawEvent=void 0,r._isPressed=void 0,r._isPressed=i!==bC.KEY_UP,"number"==typeof e?r.keyCode=e:(r.keyCode=e.keyCode,r.rawEvent=e),r.windowId=0,r}return s(e,t),n(e,[{key:"isPressed",get:function(){return this._isPressed}}]),e}(wC));wC.EventKeyboard=IC;var OC=t("eA",function(t){function e(i,n,r,s){var a;return(a=t.call(this,i,n)||this).movementX=0,a.movementY=0,a.windowId=0,a.preventSwallow=!1,a._eventType=void 0,a._button=e.BUTTON_MISSING,a._x=0,a._y=0,a._prevX=0,a._prevY=0,a._scrollX=0,a._scrollY=0,a._eventType=i,r&&(a._prevX=r.x,a._prevY=r.y),a.windowId=null!=s?s:a.windowId,a}s(e,t);var i=e.prototype;return i.setScrollData=function(t,e){this._scrollX=t,this._scrollY=e},i.getScrollX=function(){return this._scrollX},i.getScrollY=function(){return this._scrollY},i.setLocation=function(t,e){this._x=t,this._y=e},i.getLocation=function(t){return t||(t=new Fn),Fn.set(t,this._x,this._y),t},i.getLocationInView=function(t){return t||(t=new Fn),Fn.set(t,this._x,v.view._designResolutionSize.height-this._y),t},i.getUILocation=function(t){return t||(t=new Fn),Fn.set(t,this._x,this._y),v.view._convertToUISpace(t),t},i.getPreviousLocation=function(t){return t||(t=new Fn),Fn.set(t,this._prevX,this._prevY),t},i.getUIPreviousLocation=function(t){return t||(t=new Fn),Fn.set(t,this._prevX,this._prevY),v.view._convertToUISpace(t),t},i.getDelta=function(t){return t||(t=new Fn),Fn.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 Fn),Fn.set(t,(this._x-this._prevX)/v.view.getScaleX(),(this._y-this._prevY)/v.view.getScaleY()),t},i.getUIDeltaX=function(){return(this._x-this._prevX)/v.view.getScaleX()},i.getUIDeltaY=function(){return(this._y-this._prevY)/v.view.getScaleY()},i.setButton=function(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=v.view.getViewportRect();return(this._x-t.x)/v.view.getScaleX()},i.getUILocationY=function(){var t=v.view.getViewportRect();return(this._y-t.y)/v.view.getScaleY()},n(e,[{key:"eventType",get:function(){return this._eventType}}]),e}(wC));OC.BUTTON_MISSING=-1,OC.BUTTON_LEFT=0,OC.BUTTON_RIGHT=2,OC.BUTTON_MIDDLE=1,OC.BUTTON_4=3,OC.BUTTON_5=4,OC.BUTTON_6=5,OC.BUTTON_7=6,OC.BUTTON_8=7,wC.EventMouse=OC;var DC=new Fn,MC=t("eB",function(t){function e(e,i,n,r){var s;return void 0===r&&(r=[]),(s=t.call(this,n,i)||this).touch=null,s.simulate=!1,s.windowId=0,s.preventSwallow=!1,s._eventCode=void 0,s._touches=void 0,s._allTouches=void 0,s._eventCode=n,s._touches=e||[],s._allTouches=r,s}s(e,t);var i=e.prototype;return i.getEventCode=function(){return this._eventCode},i.getTouches=function(){return this._touches},i.getAllTouches=function(){return this._allTouches},i.setLocation=function(t,e){this.touch&&this.touch.setTouchInfo(this.touch.getID(),t,e)},i.getLocation=function(t){return this.touch?this.touch.getLocation(t):new Fn},i.getUILocation=function(t){return this.touch?this.touch.getUILocation(t):new Fn},i.getLocationInView=function(t){return this.touch?this.touch.getLocationInView(t):new Fn},i.getPreviousLocation=function(t){return this.touch?this.touch.getPreviousLocation(t):new Fn},i.getStartLocation=function(t){return this.touch?this.touch.getStartLocation(t):new Fn},i.getUIStartLocation=function(t){return this.touch?this.touch.getUIStartLocation(t):new Fn},i.getID=function(){return this.touch?this.touch.getID():null},i.getDelta=function(t){return this.touch?this.touch.getDelta(t):new Fn},i.getUIDelta=function(t){return this.touch?this.touch.getUIDelta(t):new Fn},i.getDeltaX=function(){return this.touch?this.touch.getDelta(DC).x:0},i.getDeltaY=function(){return this.touch?this.touch.getDelta(DC).y:0},i.getLocationX=function(){return this.touch?this.touch.getLocationX():0},i.getLocationY=function(){return this.touch?this.touch.getLocationY():0},e}(wC));MC.MAX_TOUCHES=5,wC.EventTouch=MC;var PC,BC=t("eC",function(t){function e(e,i){var n;return(n=t.call(this,e,!1)||this).gamepad=void 0,n.gamepad=i,n}return s(e,t),e}(wC)),NC=t("eD",function(t){function e(e,i){var n;return(n=t.call(this,e,!1)||this).handleInputDevice=void 0,n.handleInputDevice=i,n}return s(e,t),e}(wC)),LC=t("eE",function(t){function e(e,i){var n;return(n=t.call(this,e,!1)||this).hmdInputDevice=void 0,n.hmdInputDevice=i,n}return s(e,t),e}(wC)),FC=(t("eF",function(t){function e(e,i){var n;return(n=t.call(this,e,!1)||this).handheldInputDevice=void 0,n.handheldInputDevice=i,n}return s(e,t),e}(wC)),t("eG",(function(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),this.x=void 0,this.y=void 0,this.z=void 0,this.timestamp=void 0,this.x=t,this.y=e,this.z=i,this.timestamp=n})));t("eH",PC),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"}(PC||t("eH",PC={}));var kC=new Fn,UC=t("eI",function(){function t(t,e,i){void 0===i&&(i=0),this._point=new Fn,this._prevPoint=new Fn,this._lastModified=0,this._id=0,this._startPoint=new Fn,this._startPointCaptured=!1,this.setTouchInfo(i,t,e)}var e=t.prototype;return e.getLocation=function(t){return t||(t=new Fn),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 Fn),t.set(this._point.x,this._point.y),v.view._convertToUISpace(t),t},e.getUILocationX=function(){var t=v.view.getViewportRect();return(this._point.x-t.x)/v.view.getScaleX()},e.getUILocationY=function(){var t=v.view.getViewportRect();return(this._point.y-t.y)/v.view.getScaleY()},e.getPreviousLocation=function(t){return t||(t=new Fn),t.set(this._prevPoint.x,this._prevPoint.y),t},e.getUIPreviousLocation=function(t){return t||(t=new Fn),t.set(this._prevPoint.x,this._prevPoint.y),v.view._convertToUISpace(t),t},e.getStartLocation=function(t){return t||(t=new Fn),t.set(this._startPoint.x,this._startPoint.y),t},e.getUIStartLocation=function(t){return t||(t=new Fn),t.set(this._startPoint.x,this._startPoint.y),v.view._convertToUISpace(t),t},e.getDelta=function(t){return t||(t=new Fn),t.set(this._point),t.subtract(this._prevPoint),t},e.getUIDelta=function(t){return t||(t=new Fn),kC.set(this._point),kC.subtract(this._prevPoint),t.set(v.view.getScaleX(),v.view.getScaleY()),Fn.divide(t,kC,t),t},e.getLocationInView=function(t){return t||(t=new Fn),t.set(this._point.x,v.view._designResolutionSize.height-this._point.y),t},e.getPreviousLocationInView=function(t){return t||(t=new Fn),t.set(this._prevPoint.x,v.view._designResolutionSize.height-this._prevPoint.y),t},e.getStartLocationInView=function(t){return t||(t=new Fn),t.set(this._startPoint.x,v.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 Fn(e||0,i||0),this._id=t,this._startPointCaptured||(this._startPoint=new Fn(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=v.game.frameStartTime},e.setPrevPoint=function(t,e){this._prevPoint="object"==typeof t?new Fn(t.x,t.y):new Fn(t||0,e||0),this._lastModified=v.game.frameStartTime},e.clone=function(){var e=this.getID();this.getStartLocation(kC);var i=new t(kC.x,kC.y,e);return this.getLocation(kC),i.setPoint(kC.x,kC.y),this.getPreviousLocation(kC),i.setPrevPoint(kC),i},n(t,[{key:"lastModified",get:function(){return this._lastModified}}]),t}());v.Touch=UC;var GC=function(){function t(){this._intervalInMileSeconds=200,this._accelTimer=0,this._eventTarget=new Ju,this._deviceEventName=void 0,this._globalEventClass=void 0,this._didAccelerateFunc=void 0,this._globalEventClass=window.DeviceMotionEvent||window.DeviceOrientationEvent,al.browserType===$u.MOBILE_QQ&&(this._globalEventClass=window.DeviceOrientationEvent),this._deviceEventName=this._globalEventClass===window.DeviceMotionEvent?"devicemotion":"deviceorientation",this._didAccelerateFunc=this._didAccelerate.bind(this)}var e=t.prototype;return e._registerEvent=function(){this._accelTimer=performance.now(),window.addEventListener(this._deviceEventName,this._didAccelerateFunc,!1)},e._unregisterEvent=function(){this._accelTimer=0,window.removeEventListener(this._deviceEventName,this._didAccelerateFunc,!1)},e._didAccelerate=function(t){var e=performance.now();if(!(e-this._accelTimer<this._intervalInMileSeconds)){this._accelTimer=e;var i=0,n=0,r=0;if(this._globalEventClass===window.DeviceMotionEvent){var s=t.accelerationIncludingGravity;i=.1*((null==s?void 0:s.x)||0),n=.1*((null==s?void 0:s.y)||0),r=.1*((null==s?void 0:s.z)||0)}else{var a=t;i=(a.gamma||0)/90*.981,n=-(a.beta||0)/90*.981,r=(a.alpha||0)/90*.981}if(wl.isFrameRotated){var o=i;i=-n,n=o}var h=i;90===window.orientation?(i=-n,n=h):-90===window.orientation?(i=n,n=-h):180===window.orientation&&(i=-i,n=-n),al.os===il.ANDROID&&al.browserType!==$u.MOBILE_QQ&&(i=-i,n=-n);var u=performance.now(),l=new FC(i,n,r,u),c=new xC(l);this._eventTarget.emit(CC.DEVICEMOTION,c)}},e.start=function(){var t=this;window.DeviceMotionEvent&&"function"==typeof DeviceMotionEvent.requestPermission?DeviceMotionEvent.requestPermission().then((function(e){"granted"===e&&t._registerEvent()})).catch((function(t){U(t)})):this._registerEvent()},e.stop=function(){this._unregisterEvent()},e.setInterval=function(t){this._intervalInMileSeconds=t},e.on=function(t,e,i){this._eventTarget.on(t,e,i)},t}(),HC=function(){},zC=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}(HC),VC=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}(HC),WC=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}(HC),XC=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}(HC),jC=function(t){function e(e){var i;return(i=t.call(this)||this).positive=void 0,i.negative=void 0,i.positive=e.positive,i.negative=e.negative,i}return s(e,t),e.prototype.getValue=function(){var t=this.positive.getValue(),e=this.negative.getValue();return Math.abs(t)>Math.abs(e)?t:-e},e}(zC),YC=function(t){function e(e){var i;return(i=t.call(this)||this).up=void 0,i.down=void 0,i.left=void 0,i.right=void 0,i.xAxis=void 0,i.yAxis=void 0,i.up=e.up,i.down=e.down,i.left=e.left,i.right=e.right,i.xAxis=new jC({positive:i.right,negative:i.left}),i.yAxis=new jC({positive:i.up,negative:i.down}),i}return s(e,t),e.prototype.getValue=function(){return new Fn(this.xAxis.getValue(),this.yAxis.getValue())},e}(VC);!function(t){function e(e){var i;return(i=t.call(this)||this).up=void 0,i.down=void 0,i.left=void 0,i.right=void 0,i.forward=void 0,i.backward=void 0,i.xAxis=void 0,i.yAxis=void 0,i.zAxis=void 0,i.up=e.up,i.down=e.down,i.left=e.left,i.right=e.right,i.forward=e.forward,i.backward=e.backward,i.xAxis=new jC({positive:i.right,negative:i.left}),i.yAxis=new jC({positive:i.up,negative:i.down}),i.zAxis=new jC({positive:i.forward,negative:i.backward}),i}s(e,t),e.prototype.getValue=function(){return new hn(this.xAxis.getValue(),this.yAxis.getValue(),this.zAxis.getValue())}}(WC);var KC,qC=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}(zC),QC=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(YC),ZC=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(YC),JC=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}(XC),$C=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}(WC),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}(zC),ew="left",iw="right",nw=[];!function(t){t[t.HAND_LEFT=1]="HAND_LEFT",t[t.HAND_RIGHT=4]="HAND_RIGHT",t[t.AIM_LEFT=2]="AIM_LEFT",t[t.AIM_RIGHT=5]="AIM_RIGHT"}(KC||(KC={}));var rw,sw,aw,ow,hw,uw=function(){function t(t){var e;this._buttonNorth=void 0,this._buttonEast=void 0,this._buttonWest=void 0,this._buttonSouth=void 0,this._buttonL1=void 0,this._buttonL2=void 0,this._buttonL3=void 0,this._buttonR1=void 0,this._buttonR2=void 0,this._buttonR3=void 0,this._buttonShare=void 0,this._buttonOptions=void 0,this._dpad=void 0,this._leftStick=void 0,this._rightStick=void 0,this._buttonStart=void 0,this._gripLeft=void 0,this._gripRight=void 0,this._handLeftPosition=void 0,this._handLeftOrientation=void 0,this._handRightPosition=void 0,this._handRightOrientation=void 0,this._aimLeftPosition=void 0,this._aimLeftOrientation=void 0,this._aimRightPosition=void 0,this._aimRightOrientation=void 0,this._deviceId=-1,this._connected=!1,this._webPoseState=((e={})[KC.HAND_LEFT]={position:hn.ZERO,orientation:En.IDENTITY},e[KC.HAND_RIGHT]={position:hn.ZERO,orientation:En.IDENTITY},e[KC.AIM_LEFT]={position:hn.ZERO,orientation:En.IDENTITY},e[KC.AIM_RIGHT]={position:hn.ZERO,orientation:En.IDENTITY},e),this._deviceId=t,this._initInputSource()}t._init=function(){al.hasFeature(rl.EVENT_GAMEPAD)&&t._registerEvent()},t._on=function(e,i,n){t._eventTarget.on(e,i,n)},t._removeInputDevice=function(e){var i=t.all.findIndex((function(t){return t.deviceId===e}));-1!==i&&he(t.all,i)},t._getOrCreateInputDevice=function(e,i){var n=t.all.find((function(t){return t.deviceId===e}));return n||(n=new t(e),t.all.push(n)),n._connected=i,n},t._ensureDirectorDefined=function(e){t._intervalId=setInterval((function(){v.director&&v.Director&&(clearInterval(t._intervalId),t._intervalId=-1,e())}),50)},t._updateGamepadCnt=function(){for(var e=0,i=0,n=t._cachedWebGamepads.length;i<n;i++)t._cachedWebGamepads[i]&&e++;t._totalGamepadCnt=e},t._registerEvent=function(){t._ensureDirectorDefined((function(){t._cachedWebGamepads=t._getWebGamePads(),t._updateGamepadCnt(),v.director.on(v.Director.EVENT_BEGIN_FRAME,t._scanGamepads)})),window.addEventListener("gamepadconnected",(function(e){t._cachedWebGamepads[e.gamepad.index]=e.gamepad,t._updateGamepadCnt();var i=t._getOrCreateInputDevice(e.gamepad.index,!0);t._eventTarget.emit(CC.GAMEPAD_CHANGE,new BC(CC.GAMEPAD_CHANGE,i))})),window.addEventListener("gamepaddisconnected",(function(e){t._cachedWebGamepads[e.gamepad.index]=null,t._updateGamepadCnt();var i=t._getOrCreateInputDevice(e.gamepad.index,!1);t._removeInputDevice(e.gamepad.index),t._eventTarget.emit(CC.GAMEPAD_CHANGE,new BC(CC.GAMEPAD_CHANGE,i))}))},t._scanWebGamepads=function(e){if(0!==t._totalGamepadCnt){var i=t._getWebGamePads();if(i){for(var n=0;n<i.length;++n){var r=i[n];if(r){var s=t._cachedWebGamepads[r.index];if(s){for(var a=void 0,o=s.buttons,h=0;h<o.length;++h){var u=o[h],l=r.buttons[h];if(Math.abs(u.value-l.value)>.01){a=t._getOrCreateInputDevice(r.index,!0);break}}if(a){e.push(a);continue}for(var c=s.axes,_=0;_<c.length;++_){var d=c[_],f=r.axes[_];if(Math.abs(d-f)>.01){a=t._getOrCreateInputDevice(r.index,!0);break}}if(a){e.push(a);continue}}}}t._cachedWebGamepads=i}}},t._scanGamepads=function(){nw.length=0,t._scanWebGamepads(nw),t._scanWebXRGamepads(nw);for(var e=0;e<nw.length;++e){var i=nw[e];t._eventTarget.emit(CC.GAMEPAD_INPUT,new BC(CC.GAMEPAD_INPUT,i))}t._scanWebXRGamepadsPose()},t._scanWebXRGamepads=function(e){var i,n,r=t._getWebXRGamepadMap();if(!r)return t._cachedWebXRGamepadMap=null,void(t.xr&&t.xr._connected&&(t.xr._connected=!1,t._eventTarget.emit(CC.GAMEPAD_CHANGE,new BC(CC.GAMEPAD_CHANGE,t.xr)),e.push(t.xr)));t.xr||(t.xr=new t(-1));var s=r.get(ew),a=r.get(iw);s||a?t.xr._connected||(t.xr._connected=!0,t._eventTarget.emit(CC.GAMEPAD_CHANGE,new BC(CC.GAMEPAD_CHANGE,t.xr))):t.xr._connected&&(t.xr._connected=!1,t._eventTarget.emit(CC.GAMEPAD_CHANGE,new BC(CC.GAMEPAD_CHANGE,t.xr))),(t.checkGamepadChanged(s,null===(i=t._cachedWebXRGamepadMap)||void 0===i?void 0:i.get(ew))||t.checkGamepadChanged(a,null===(n=t._cachedWebXRGamepadMap)||void 0===n?void 0:n.get(iw)))&&e.push(t.xr),t._cachedWebXRGamepadMap||(t._cachedWebXRGamepadMap=new Map),t._cachedWebXRGamepadMap.set(ew,t._copyCacheGamepadValue(s)),t._cachedWebXRGamepadMap.set(iw,t._copyCacheGamepadValue(a))},t.checkGamepadChanged=function(t,e){if(!t&&!e)return!1;if(!t||!e)return!0;for(var i=e.buttons,n=0;n<i.length;++n){var r=i[n];if(0!==t.buttons[n].value||0!==r)return!0}for(var s=e.axes,a=0;a<s.length;++a){var o=s[a];if(0!==t.axes[a]||0!==o)return!0}return!1},t._copyCacheGamepadValue=function(t){if(t){for(var e={buttons:new Array(t.buttons.length),axes:new Array(t.axes.length)},i=0;i<t.buttons.length;++i)e.buttons[i]=t.buttons[i].value;for(var n=0;n<t.axes.length;++n)e.axes[n]=t.axes[n];return e}},t._scanWebXRGamepadsPose=function(){var e,i=null===(e=globalThis.__globalXR)||void 0===e?void 0:e.webxrHandlePoseInfos;if(i&&t.xr){for(var n=0;n<i.length;++n){var r=i[n];t.xr._updateWebPoseState(r)}t._eventTarget.emit(CC.HANDLE_POSE_INPUT,new BC(CC.HANDLE_POSE_INPUT,t.xr))}},t._getWebXRGamepadMap=function(){var t;return null===(t=globalThis.__globalXR)||void 0===t?void 0:t.webxrGamepadMap},t._getWebGamePads=function(){return"function"==typeof navigator.getGamepads?navigator.getGamepads():"function"==typeof navigator.webkitGetGamepads?navigator.webkitGetGamepads():[]},t._getWebGamepad=function(e){for(var i=t._getWebGamePads(),n=0;n<i.length;++n){var r=i[n];if(r&&r.index===e)return r}};var e=t.prototype;return e._axisToButtons=function(t){var e=Math.abs(t);return t>0?{negative:0,positive:e}:t<0?{negative:e,positive:0}:{negative:0,positive:0}},e._updateWebPoseState=function(t){t.code!==KC.HAND_LEFT&&t.code!==KC.AIM_LEFT&&t.code!==KC.HAND_RIGHT&&t.code!==KC.AIM_RIGHT||(this._webPoseState[t.code]={position:new hn(t.position.x,t.position.y,t.position.z),orientation:new En(t.orientation.x,t.orientation.y,t.orientation.z,t.orientation.w)})},e._initInputSource=function(){var e=this;this._buttonNorth=new qC,this._buttonNorth.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(ew);return n&&n.buttons.length>5?n.buttons[5].value:0}var r=t._getWebGamepad(e.deviceId);return r?r.buttons[3].value:0},this._buttonEast=new qC,this._buttonEast.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(iw);return n&&n.buttons.length>5?n.buttons[5].value:0}var r=t._getWebGamepad(e.deviceId);return r?r.buttons[1].value:0},this._buttonWest=new qC,this._buttonWest.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(ew);return n&&n.buttons.length>4?n.buttons[4].value:0}var r=t._getWebGamepad(e.deviceId);return r?r.buttons[2].value:0},this._buttonSouth=new qC,this._buttonSouth.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(iw);return n&&n.buttons.length>4?n.buttons[4].value:0}var r=t._getWebGamepad(e.deviceId);return r?r.buttons[0].value:0},this._buttonL1=new qC,this._buttonL1.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[4].value:0},this._buttonL2=new qC,this._buttonL2.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(ew);return n&&n.buttons.length>0?n.buttons[0].value:0}var r=t._getWebGamepad(e.deviceId);return r?r.buttons[6].value:0},this._buttonL3=new qC,this._buttonL3.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(ew);if(n){if(n.buttons.length>3&&0!==n.buttons[3].value)return n.buttons[3].value;if(n.buttons.length>2&&0!==n.buttons[2].value)return n.buttons[2].value}return 0}var r=t._getWebGamepad(e.deviceId);return r?r.buttons[10].value:0},this._buttonR1=new qC,this._buttonR1.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[5].value:0},this._buttonR2=new qC,this._buttonR2.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(iw);return n&&n.buttons.length>0?n.buttons[0].value:0}var r=t._getWebGamepad(e.deviceId);return r?r.buttons[7].value:0},this._buttonR3=new qC,this._buttonR3.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(iw);if(n){if(n.buttons.length>3&&0!==n.buttons[3].value)return n.buttons[3].value;if(n.buttons.length>2&&0!==n.buttons[2].value)return n.buttons[2].value}return 0}var r=t._getWebGamepad(e.deviceId);return r?r.buttons[11].value:0},this._buttonShare=new qC,this._buttonShare.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[8].value:0},this._buttonOptions=new qC,this._buttonOptions.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[9].value:0};var i=new qC;i.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[12].value:0};var n=new qC;n.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[13].value:0};var r=new qC;r.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[14].value:0};var s=new qC;s.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[15].value:0},this._dpad=new QC({up:i,down:n,left:r,right:s});var a=new qC;a.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(ew);if(n){if(n.axes.length>3&&0!==n.axes[3])return e._axisToButtons(n.axes[3]).negative;if(n.axes.length>1&&0!==n.axes[1])return e._axisToButtons(n.axes[1]).negative}return 0}var r=t._getWebGamepad(e.deviceId);return r?e._axisToButtons(r.axes[1]).negative:0};var o=new qC;o.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(ew);if(n){if(n.axes.length>3&&0!==n.axes[3])return e._axisToButtons(n.axes[3]).positive;if(n.axes.length>1&&0!==n.axes[1])return e._axisToButtons(n.axes[1]).positive}return 0}var r=t._getWebGamepad(e.deviceId);return r?e._axisToButtons(r.axes[1]).positive:0};var h=new qC;h.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(ew);if(n){if(n.axes.length>2&&0!==n.axes[2])return e._axisToButtons(n.axes[2]).negative;if(n.axes.length>0&&0!==n.axes[0])return e._axisToButtons(n.axes[0]).negative}return 0}var r=t._getWebGamepad(e.deviceId);return r?e._axisToButtons(r.axes[0]).negative:0};var u=new qC;u.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(ew);if(n){if(n.axes.length>2&&0!==n.axes[2])return e._axisToButtons(n.axes[2]).positive;if(n.axes.length>0&&0!==n.axes[0])return e._axisToButtons(n.axes[0]).positive}return 0}var r=t._getWebGamepad(e.deviceId);return r?e._axisToButtons(r.axes[0]).positive:0},this._leftStick=new ZC({up:a,down:o,left:h,right:u});var l=new qC;l.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(iw);if(n){if(n.axes.length>3&&0!==n.axes[3])return e._axisToButtons(n.axes[3]).negative;if(n.axes.length>1&&0!==n.axes[1])return e._axisToButtons(n.axes[1]).negative}return 0}var r=t._getWebGamepad(e.deviceId);return r?e._axisToButtons(r.axes[3]).negative:0};var c=new qC;c.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(iw);if(n){if(n.axes.length>3&&0!==n.axes[3])return e._axisToButtons(n.axes[3]).positive;if(n.axes.length>1&&0!==n.axes[1])return e._axisToButtons(n.axes[1]).positive}return 0}var r=t._getWebGamepad(e.deviceId);return r?e._axisToButtons(r.axes[3]).positive:0};var _=new qC;_.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(iw);if(n){if(n.axes.length>2&&0!==n.axes[2])return e._axisToButtons(n.axes[2]).negative;if(n.axes.length>0&&0!==n.axes[0])return e._axisToButtons(n.axes[0]).negative}return 0}var r=t._getWebGamepad(e.deviceId);return r?e._axisToButtons(r.axes[2]).negative:0};var d=new qC;d.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(iw);if(n){if(n.axes.length>2&&0!==n.axes[2])return e._axisToButtons(n.axes[2]).positive;if(n.axes.length>0&&0!==n.axes[0])return e._axisToButtons(n.axes[0]).positive}return 0}var r=t._getWebGamepad(e.deviceId);return r?e._axisToButtons(r.axes[2]).positive:0},this._rightStick=new ZC({up:l,down:c,left:_,right:d}),this._buttonStart=new qC,this._buttonStart.getValue=function(){return 0},this._gripLeft=new qC,this._gripLeft.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(ew);if(n&&n.buttons.length>1)return n.buttons[1].value}return 0},this._gripRight=new qC,this._gripRight.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(iw);if(n&&n.buttons.length>1)return n.buttons[1].value}return 0},this._handLeftPosition=new $C,this._handLeftPosition.getValue=function(){return e._webPoseState[KC.HAND_LEFT].position},this._handLeftOrientation=new JC,this._handLeftOrientation.getValue=function(){return e._webPoseState[KC.HAND_LEFT].orientation},this._handRightPosition=new $C,this._handRightPosition.getValue=function(){return e._webPoseState[KC.HAND_RIGHT].position},this._handRightOrientation=new JC,this._handRightOrientation.getValue=function(){return e._webPoseState[KC.HAND_RIGHT].orientation},this._aimLeftPosition=new $C,this._aimLeftPosition.getValue=function(){return e._webPoseState[KC.AIM_LEFT].position},this._aimLeftOrientation=new JC,this._aimLeftOrientation.getValue=function(){return e._webPoseState[KC.AIM_LEFT].orientation},this._aimRightPosition=new $C,this._aimRightPosition.getValue=function(){return e._webPoseState[KC.AIM_RIGHT].position},this._aimRightOrientation=new JC,this._aimRightOrientation.getValue=function(){return e._webPoseState[KC.AIM_RIGHT].orientation}},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}();uw.all=[],uw.xr=null,uw._eventTarget=new Ju,uw._cachedWebGamepads=[],uw._cachedWebXRGamepadMap=null,uw._intervalId=-1,uw._totalGamepadCnt=0,function(t){t[t.BUTTON_EAST=0]="BUTTON_EAST",t[t.BUTTON_SOUTH=1]="BUTTON_SOUTH",t[t.BUTTON_WEST=2]="BUTTON_WEST",t[t.BUTTON_NORTH=3]="BUTTON_NORTH",t[t.BUTTON_TRIGGER_LEFT=4]="BUTTON_TRIGGER_LEFT",t[t.BUTTON_TRIGGER_RIGHT=5]="BUTTON_TRIGGER_RIGHT",t[t.TRIGGER_LEFT=6]="TRIGGER_LEFT",t[t.TRIGGER_RIGHT=7]="TRIGGER_RIGHT",t[t.GRIP_LEFT=8]="GRIP_LEFT",t[t.GRIP_RIGHT=9]="GRIP_RIGHT",t[t.BUTTON_LEFT_STICK=10]="BUTTON_LEFT_STICK",t[t.LEFT_STICK_UP=11]="LEFT_STICK_UP",t[t.LEFT_STICK_DOWN=12]="LEFT_STICK_DOWN",t[t.LEFT_STICK_LEFT=13]="LEFT_STICK_LEFT",t[t.LEFT_STICK_RIGHT=14]="LEFT_STICK_RIGHT",t[t.BUTTON_RIGHT_STICK=15]="BUTTON_RIGHT_STICK",t[t.RIGHT_STICK_UP=16]="RIGHT_STICK_UP",t[t.RIGHT_STICK_DOWN=17]="RIGHT_STICK_DOWN",t[t.RIGHT_STICK_LEFT=18]="RIGHT_STICK_LEFT",t[t.RIGHT_STICK_RIGHT=19]="RIGHT_STICK_RIGHT",t[t.ROKID_MENU=20]="ROKID_MENU",t[t.ROKID_START=21]="ROKID_START"}(rw||(rw={})),function(t){t[t.KET_CLICK=0]="KET_CLICK",t[t.KET_STICK=1]="KET_STICK",t[t.KET_GRAB=2]="KET_GRAB",t[t.KET_TOUCH=3]="KET_TOUCH"}(sw||(sw={})),function(t){t[t.UNDEFINE=0]="UNDEFINE",t[t.A=1]="A",t[t.B=2]="B",t[t.X=3]="X",t[t.Y=4]="Y",t[t.L1=5]="L1",t[t.R1=6]="R1",t[t.MINUS=7]="MINUS",t[t.PLUS=8]="PLUS",t[t.L3=9]="L3",t[t.R3=10]="R3",t[t.MENU=11]="MENU",t[t.START=12]="START",t[t.TRIGGER_LEFT=13]="TRIGGER_LEFT",t[t.TRIGGER_RIGHT=14]="TRIGGER_RIGHT"}(aw||(aw={})),function(t){t[t.UNDEFINE=0]="UNDEFINE",t[t.X=1]="X",t[t.Y=2]="Y",t[t.LEFT_STICK_X=3]="LEFT_STICK_X",t[t.LEFT_STICK_Y=4]="LEFT_STICK_Y",t[t.RIGHT_STICK_X=5]="RIGHT_STICK_X",t[t.RIGHT_STICK_Y=6]="RIGHT_STICK_Y",t[t.L2=7]="L2",t[t.R2=8]="R2",t[t.LEFT_GRIP=9]="LEFT_GRIP",t[t.RIGHT_GRIP=10]="RIGHT_GRIP"}(ow||(ow={})),function(t){t[t.UNDEFINE=0]="UNDEFINE",t[t.A=1]="A",t[t.B=2]="B",t[t.X=3]="X",t[t.Y=4]="Y",t[t.LEFT_TRIGGER=5]="LEFT_TRIGGER",t[t.RIGHT_TRIGGER=6]="RIGHT_TRIGGER",t[t.LEFT_THUMBSTICK=7]="LEFT_THUMBSTICK",t[t.RIGHT_THUMBSTICK=8]="RIGHT_THUMBSTICK"}(hw||(hw={}));var lw,cw={1:rw.BUTTON_EAST,2:rw.BUTTON_SOUTH,3:rw.BUTTON_NORTH,4:rw.BUTTON_WEST,9:rw.BUTTON_LEFT_STICK,10:rw.BUTTON_RIGHT_STICK,11:rw.ROKID_MENU,12:rw.ROKID_START,13:rw.BUTTON_TRIGGER_LEFT,14:rw.BUTTON_TRIGGER_RIGHT},_w=function(){function t(){var t,e,i=this;this._eventTarget=new Ju,this._buttonNorth=void 0,this._buttonEast=void 0,this._buttonWest=void 0,this._buttonSouth=void 0,this._buttonTriggerLeft=void 0,this._buttonTriggerRight=void 0,this._triggerLeft=void 0,this._triggerRight=void 0,this._gripLeft=void 0,this._gripRight=void 0,this._leftStick=void 0,this._rightStick=void 0,this._buttonLeftStick=void 0,this._buttonRightStick=void 0,this._buttonOptions=void 0,this._buttonStart=void 0,this._handLeftPosition=void 0,this._handLeftOrientation=void 0,this._handRightPosition=void 0,this._handRightOrientation=void 0,this._aimLeftPosition=void 0,this._aimLeftOrientation=void 0,this._aimRightPosition=void 0,this._aimRightOrientation=void 0,this._touchButtonA=void 0,this._touchButtonB=void 0,this._touchButtonX=void 0,this._touchButtonY=void 0,this._touchButtonTriggerLeft=void 0,this._touchButtonTriggerRight=void 0,this._touchButtonThumbStickLeft=void 0,this._touchButtonThumbStickRight=void 0,this._nativeButtonState=((t={})[rw.BUTTON_SOUTH]=0,t[rw.BUTTON_EAST]=0,t[rw.BUTTON_WEST]=0,t[rw.BUTTON_NORTH]=0,t[rw.BUTTON_TRIGGER_LEFT]=0,t[rw.BUTTON_TRIGGER_RIGHT]=0,t[rw.TRIGGER_LEFT]=0,t[rw.TRIGGER_RIGHT]=0,t[rw.GRIP_LEFT]=0,t[rw.GRIP_RIGHT]=0,t[rw.LEFT_STICK_UP]=0,t[rw.LEFT_STICK_DOWN]=0,t[rw.LEFT_STICK_LEFT]=0,t[rw.LEFT_STICK_RIGHT]=0,t[rw.RIGHT_STICK_UP]=0,t[rw.RIGHT_STICK_DOWN]=0,t[rw.RIGHT_STICK_LEFT]=0,t[rw.RIGHT_STICK_RIGHT]=0,t[rw.BUTTON_LEFT_STICK]=0,t[rw.BUTTON_RIGHT_STICK]=0,t[rw.ROKID_MENU]=0,t[rw.ROKID_START]=0,t),this._nativeTouchState=((e={})[hw.UNDEFINE]=0,e[hw.A]=0,e[hw.B]=0,e[hw.X]=0,e[hw.Y]=0,e[hw.LEFT_TRIGGER]=0,e[hw.RIGHT_TRIGGER]=0,e[hw.LEFT_THUMBSTICK]=0,e[hw.RIGHT_THUMBSTICK]=0,e),this._initInputSource(),window.addEventListener("xr-remote-input",(function(t){var e=t,n=e.detail.keyEventType,r=e.detail.stickAxisCode,s=e.detail.stickAxisValue,a=e.detail.stickKeyCode,o=e.detail.isButtonPressed,h=e.detail.touchCode,u=e.detail.touchValue;if(n===sw.KET_CLICK){var l=cw[a];i._nativeButtonState[l]=o?1:0}else if(n===sw.KET_STICK||n===sw.KET_GRAB){var c,_,d;switch(r){case ow.LEFT_STICK_X:c=rw.LEFT_STICK_LEFT,_=rw.LEFT_STICK_RIGHT,d=i._axisToButtons(s);break;case ow.LEFT_STICK_Y:c=rw.LEFT_STICK_DOWN,_=rw.LEFT_STICK_UP,d=i._axisToButtons(s);break;case ow.RIGHT_STICK_X:c=rw.RIGHT_STICK_LEFT,_=rw.RIGHT_STICK_RIGHT,d=i._axisToButtons(s);break;case ow.RIGHT_STICK_Y:c=rw.RIGHT_STICK_DOWN,_=rw.RIGHT_STICK_UP,d=i._axisToButtons(s);break;case ow.L2:i._nativeButtonState[rw.TRIGGER_LEFT]=s;break;case ow.R2:i._nativeButtonState[rw.TRIGGER_RIGHT]=s;break;case ow.LEFT_GRIP:i._nativeButtonState[rw.GRIP_LEFT]=s;break;case ow.RIGHT_GRIP:i._nativeButtonState[rw.GRIP_RIGHT]=s}c&&_&&d&&(i._nativeButtonState[c]=d.negative,i._nativeButtonState[_]=d.positive)}else if(n===sw.KET_TOUCH)switch(h){case hw.A:case hw.B:case hw.X:case hw.Y:case hw.LEFT_TRIGGER:case hw.RIGHT_TRIGGER:case hw.LEFT_THUMBSTICK:case hw.RIGHT_THUMBSTICK:i._nativeTouchState[h]=u}i._eventTarget.emit(CC.HANDLE_INPUT,new NC(CC.HANDLE_INPUT,i))}))}var e=t.prototype;return e._axisToButtons=function(t){var e=Math.abs(t);return t>0?{negative:0,positive:e}:t<0?{negative:e,positive:0}:{negative:0,positive:0}},e._on=function(t,e,i){this._eventTarget.on(t,e,i)},e._initInputSource=function(){var t=this;this._buttonNorth=new qC,this._buttonNorth.getValue=function(){return t._nativeButtonState[rw.BUTTON_NORTH]},this._buttonEast=new qC,this._buttonEast.getValue=function(){return t._nativeButtonState[rw.BUTTON_EAST]},this._buttonWest=new qC,this._buttonWest.getValue=function(){return t._nativeButtonState[rw.BUTTON_WEST]},this._buttonSouth=new qC,this._buttonSouth.getValue=function(){return t._nativeButtonState[rw.BUTTON_SOUTH]},this._buttonTriggerLeft=new qC,this._buttonTriggerLeft.getValue=function(){return t._nativeButtonState[rw.BUTTON_TRIGGER_LEFT]},this._buttonTriggerRight=new qC,this._buttonTriggerRight.getValue=function(){return t._nativeButtonState[rw.BUTTON_TRIGGER_RIGHT]},this._triggerLeft=new qC,this._triggerLeft.getValue=function(){return t._nativeButtonState[rw.TRIGGER_LEFT]},this._triggerRight=new qC,this._triggerRight.getValue=function(){return t._nativeButtonState[rw.TRIGGER_RIGHT]},this._gripLeft=new qC,this._gripLeft.getValue=function(){return t._nativeButtonState[rw.GRIP_LEFT]},this._gripRight=new qC,this._gripRight.getValue=function(){return t._nativeButtonState[rw.GRIP_RIGHT]},this._buttonLeftStick=new qC,this._buttonLeftStick.getValue=function(){return t._nativeButtonState[rw.BUTTON_LEFT_STICK]};var e=new qC;e.getValue=function(){return t._nativeButtonState[rw.LEFT_STICK_UP]};var i=new qC;i.getValue=function(){return t._nativeButtonState[rw.LEFT_STICK_DOWN]};var n=new qC;n.getValue=function(){return t._nativeButtonState[rw.LEFT_STICK_LEFT]};var r=new qC;r.getValue=function(){return t._nativeButtonState[rw.LEFT_STICK_RIGHT]},this._leftStick=new ZC({up:e,down:i,left:n,right:r}),this._buttonRightStick=new qC,this._buttonRightStick.getValue=function(){return t._nativeButtonState[rw.BUTTON_RIGHT_STICK]};var s=new qC;s.getValue=function(){return t._nativeButtonState[rw.RIGHT_STICK_UP]};var a=new qC;a.getValue=function(){return t._nativeButtonState[rw.RIGHT_STICK_DOWN]};var o=new qC;o.getValue=function(){return t._nativeButtonState[rw.RIGHT_STICK_LEFT]};var h=new qC;h.getValue=function(){return t._nativeButtonState[rw.RIGHT_STICK_RIGHT]},this._rightStick=new ZC({up:s,down:a,left:o,right:h}),this._buttonOptions=new qC,this._buttonOptions.getValue=function(){return t._nativeButtonState[rw.ROKID_MENU]},this._buttonStart=new qC,this._buttonStart.getValue=function(){return t._nativeButtonState[rw.ROKID_START]},this._handLeftPosition=new $C,this._handLeftPosition.getValue=function(){return hn.ZERO},this._handLeftOrientation=new JC,this._handLeftOrientation.getValue=function(){return En.IDENTITY},this._handRightPosition=new $C,this._handRightPosition.getValue=function(){return hn.ZERO},this._handRightOrientation=new JC,this._handRightOrientation.getValue=function(){return En.IDENTITY},this._aimLeftPosition=new $C,this._aimLeftPosition.getValue=function(){return hn.ZERO},this._aimLeftOrientation=new JC,this._aimLeftOrientation.getValue=function(){return En.IDENTITY},this._aimRightPosition=new $C,this._aimRightPosition.getValue=function(){return hn.ZERO},this._aimRightOrientation=new JC,this._aimRightOrientation.getValue=function(){return En.IDENTITY},this._touchButtonA=new tw,this._touchButtonA.getValue=function(){return t._nativeTouchState[hw.A]},this._touchButtonB=new tw,this._touchButtonB.getValue=function(){return t._nativeTouchState[hw.B]},this._touchButtonX=new tw,this._touchButtonX.getValue=function(){return t._nativeTouchState[hw.X]},this._touchButtonY=new tw,this._touchButtonY.getValue=function(){return t._nativeTouchState[hw.Y]},this._touchButtonTriggerLeft=new tw,this._touchButtonTriggerLeft.getValue=function(){return t._nativeTouchState[hw.LEFT_TRIGGER]},this._touchButtonTriggerRight=new tw,this._touchButtonTriggerRight.getValue=function(){return t._nativeTouchState[hw.RIGHT_TRIGGER]},this._touchButtonThumbStickLeft=new tw,this._touchButtonThumbStickLeft.getValue=function(){return t._nativeTouchState[hw.LEFT_THUMBSTICK]},this._touchButtonThumbStickRight=new tw,this._touchButtonThumbStickRight.getValue=function(){return t._nativeTouchState[hw.RIGHT_THUMBSTICK]}},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}();!function(t){t[t.VIEW_LEFT=0]="VIEW_LEFT",t[t.VIEW_RIGHT=3]="VIEW_RIGHT",t[t.HEAD_MIDDLE=6]="HEAD_MIDDLE"}(lw||(lw={}));var dw,fw,pw=function(){function t(){var t;this._eventTarget=new Ju,this._intervalId=-1,this._viewLeftPosition=void 0,this._viewLeftOrientation=void 0,this._viewRightPosition=void 0,this._viewRightOrientation=void 0,this._headMiddlePosition=void 0,this._headMiddleOrientation=void 0,this._webPoseState=((t={})[lw.VIEW_LEFT]={position:hn.ZERO,orientation:En.IDENTITY},t[lw.VIEW_RIGHT]={position:hn.ZERO,orientation:En.IDENTITY},t[lw.HEAD_MIDDLE]={position:hn.ZERO,orientation:En.IDENTITY},t),this._initInputSource(),this._registerEvent()}var e=t.prototype;return e._ensureDirectorDefined=function(){var t=this;return new Promise((function(e){t._intervalId=setInterval((function(){v.director&&v.Director&&(clearInterval(t._intervalId),t._intervalId=-1,e())}),50)}))},e._registerEvent=function(){var t=this;this._ensureDirectorDefined().then((function(){v.director.on(v.Director.EVENT_BEGIN_FRAME,t._scanHmd,t)})).catch((function(){}))},e._scanHmd=function(){var t,e=null===(t=globalThis.__globalXR)||void 0===t?void 0:t.webxrHmdPoseInfos;if(e){for(var i=0;i<e.length;++i){var n=e[i];this._updateWebPoseState(n)}this._eventTarget.emit(CC.HMD_POSE_INPUT,new LC(CC.HMD_POSE_INPUT,this))}},e._on=function(t,e,i){this._eventTarget.on(t,e,i)},e._updateWebPoseState=function(t){t.code!==lw.VIEW_LEFT&&t.code!==lw.VIEW_RIGHT&&t.code!==lw.HEAD_MIDDLE||(this._webPoseState[t.code]={position:new hn(t.position.x,t.position.y,t.position.z),orientation:new En(t.orientation.x,t.orientation.y,t.orientation.z,t.orientation.w)})},e._initInputSource=function(){var t=this;this._viewLeftPosition=new $C,this._viewLeftPosition.getValue=function(){return t._webPoseState[lw.VIEW_LEFT].position},this._viewLeftOrientation=new JC,this._viewLeftOrientation.getValue=function(){return t._webPoseState[lw.VIEW_LEFT].orientation},this._viewRightPosition=new $C,this._viewRightPosition.getValue=function(){return t._webPoseState[lw.VIEW_RIGHT].position},this._viewRightOrientation=new JC,this._viewRightOrientation.getValue=function(){return t._webPoseState[lw.VIEW_RIGHT].orientation},this._headMiddlePosition=new $C,this._headMiddlePosition.getValue=function(){return t._webPoseState[lw.HEAD_MIDDLE].position},this._headMiddleOrientation=new JC,this._headMiddleOrientation.getValue=function(){return t._webPoseState[lw.HEAD_MIDDLE].orientation}},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}(),mw=function(){function t(){this._eventTarget=new Ju,this._handheldPosition=void 0,this._handheldOrientation=void 0,this._initInputSource()}var e=t.prototype;return e._on=function(t,e,i){this._eventTarget.on(t,e,i)},e._initInputSource=function(){this._handheldPosition=new $C,this._handheldPosition.getValue=function(){return hn.ZERO},this._handheldOrientation=new JC,this._handheldOrientation.getValue=function(){return En.IDENTITY}},n(t,[{key:"handheldPosition",get:function(){return this._handheldPosition}},{key:"handheldOrientation",get:function(){return this._handheldOrientation}}]),t}(),gw={Backspace:PC.BACKSPACE,Tab:PC.TAB,Enter:PC.ENTER,ShiftLeft:PC.SHIFT_LEFT,ControlLeft:PC.CTRL_LEFT,AltLeft:PC.ALT_LEFT,ShiftRight:PC.SHIFT_RIGHT,ControlRight:PC.CTRL_RIGHT,AltRight:PC.ALT_RIGHT,Pause:PC.PAUSE,CapsLock:PC.CAPS_LOCK,Escape:PC.ESCAPE,Space:PC.SPACE,PageUp:PC.PAGE_UP,PageDown:PC.PAGE_DOWN,End:PC.END,Home:PC.HOME,ArrowLeft:PC.ARROW_LEFT,ArrowUp:PC.ARROW_UP,ArrowRight:PC.ARROW_RIGHT,ArrowDown:PC.ARROW_DOWN,Insert:PC.INSERT,Delete:PC.DELETE,Digit0:PC.DIGIT_0,Digit1:PC.DIGIT_1,Digit2:PC.DIGIT_2,Digit3:PC.DIGIT_3,Digit4:PC.DIGIT_4,Digit5:PC.DIGIT_5,Digit6:PC.DIGIT_6,Digit7:PC.DIGIT_7,Digit8:PC.DIGIT_8,Digit9:PC.DIGIT_9,KeyA:PC.KEY_A,KeyB:PC.KEY_B,KeyC:PC.KEY_C,KeyD:PC.KEY_D,KeyE:PC.KEY_E,KeyF:PC.KEY_F,KeyG:PC.KEY_G,KeyH:PC.KEY_H,KeyI:PC.KEY_I,KeyJ:PC.KEY_J,KeyK:PC.KEY_K,KeyL:PC.KEY_L,KeyM:PC.KEY_M,KeyN:PC.KEY_N,KeyO:PC.KEY_O,KeyP:PC.KEY_P,KeyQ:PC.KEY_Q,KeyR:PC.KEY_R,KeyS:PC.KEY_S,KeyT:PC.KEY_T,KeyU:PC.KEY_U,KeyV:PC.KEY_V,KeyW:PC.KEY_W,KeyX:PC.KEY_X,KeyY:PC.KEY_Y,KeyZ:PC.KEY_Z,Numpad0:PC.NUM_0,Numpad1:PC.NUM_1,Numpad2:PC.NUM_2,Numpad3:PC.NUM_3,Numpad4:PC.NUM_4,Numpad5:PC.NUM_5,Numpad6:PC.NUM_6,Numpad7:PC.NUM_7,Numpad8:PC.NUM_8,Numpad9:PC.NUM_9,NumpadMultiply:PC.NUM_MULTIPLY,NumpadAdd:PC.NUM_PLUS,NumpadSubtract:PC.NUM_SUBTRACT,NumpadDecimal:PC.NUM_DECIMAL,NumpadDivide:PC.NUM_DIVIDE,NumpadEnter:PC.NUM_ENTER,F1:PC.F1,F2:PC.F2,F3:PC.F3,F4:PC.F4,F5:PC.F5,F6:PC.F6,F7:PC.F7,F8:PC.F8,F9:PC.F9,F10:PC.F10,F11:PC.F11,F12:PC.F12,NumLock:PC.NUM_LOCK,ScrollLock:PC.SCROLL_LOCK,Semicolon:PC.SEMICOLON,Equal:PC.EQUAL,Comma:PC.COMMA,Minus:PC.DASH,Period:PC.PERIOD,Slash:PC.SLASH,Backquote:PC.BACK_QUOTE,BracketLeft:PC.BRACKET_LEFT,Backslash:PC.BACKSLASH,BracketRight:PC.BRACKET_RIGHT,Quote:PC.QUOTE},vw=function(){function t(){this._eventTarget=new Ju,this._registerEvent()}var e=t.prototype;return e.dispatchKeyboardDownEvent=function(t){this._handleKeyboardDown(t)},e.dispatchKeyboardUpEvent=function(t){this._handleKeyboardUp(t)},e.on=function(t,e,i){this._eventTarget.on(t,e,i)},e._registerEvent=function(){var t=document.getElementById("GameCanvas");null==t||t.addEventListener("keydown",this._handleKeyboardDown.bind(this)),null==t||t.addEventListener("keyup",this._handleKeyboardUp.bind(this))},e._getInputEvent=function(t,e){var i,n=(i=t.code,gw[i]||PC.NONE);return new IC(n,e)},e._handleKeyboardDown=function(t){if(t.stopPropagation(),t.preventDefault(),t.repeat){var e=this._getInputEvent(t,CC.KEY_PRESSING);this._eventTarget.emit(CC.KEY_PRESSING,e)}else{var i=this._getInputEvent(t,CC.KEY_DOWN);this._eventTarget.emit(CC.KEY_DOWN,i)}},e._handleKeyboardUp=function(t){var e=this._getInputEvent(t,CC.KEY_UP);t.stopPropagation(),t.preventDefault(),this._eventTarget.emit(CC.KEY_UP,e)},t}(),yw=function(){function t(){this._canvas=void 0,this._eventTarget=new Ju,this._pointLocked=!1,this._isPressed=!1,this._preMousePos=new Fn,this._handleMouseDown=void 0,this._handleMouseMove=void 0,this._handleMouseUp=void 0,al.hasFeature(rl.EVENT_MOUSE)&&(this._canvas=document.getElementById("GameCanvas"),this._canvas||console.warn("failed to access canvas"),this._handleMouseDown=this._createCallback(CC.MOUSE_DOWN),this._handleMouseMove=this._createCallback(CC.MOUSE_MOVE),this._handleMouseUp=this._createCallback(CC.MOUSE_UP),this._registerEvent())}var e=t.prototype;return e.dispatchMouseDownEvent=function(t){this._handleMouseDown(t)},e.dispatchMouseMoveEvent=function(t){this._handleMouseMove(t)},e.dispatchMouseUpEvent=function(t){this._handleMouseUp(t)},e.dispatchScrollEvent=function(t){this._handleMouseWheel(t)},e.on=function(t,e,i){this._eventTarget.on(t,e,i)},e._getCanvasRect=function(){var t=this._canvas,e=null==t?void 0:t.getBoundingClientRect();return e?new Vn(e.x,e.y,e.width,e.height):new Vn(0,0,0,0)},e._getLocation=function(t){var e=this._getCanvasRect(),i=wl.devicePixelRatio,n=this._pointLocked?this._preMousePos.x/i+t.movementX:t.clientX-e.x,r=this._pointLocked?this._preMousePos.y/i-t.movementY:e.y+e.height-t.clientY;return new Fn(n*=i,r*=i)},e._registerEvent=function(){var t,e,i,n,r=this;window.addEventListener("mousedown",(function(){r._isPressed=!0})),null===(t=this._canvas)||void 0===t||t.addEventListener("mousedown",this._handleMouseDown),null===(e=this._canvas)||void 0===e||e.addEventListener("mousemove",this._handleMouseMove),window.addEventListener("mouseup",this._handleMouseUp),null===(i=this._canvas)||void 0===i||i.addEventListener("mouseup",this._handleMouseUp),null===(n=this._canvas)||void 0===n||n.addEventListener("wheel",this._handleMouseWheel.bind(this)),this._registerPointerLockEvent()},e._registerPointerLockEvent=function(){var t=this,e=function(){var e=t._canvas;document.pointerLockElement===e||document.mozPointerLockElement===e?t._pointLocked=!0:t._pointLocked=!1};"onpointerlockchange"in document?document.addEventListener("pointerlockchange",e,!1):"onmozpointerlockchange"in document&&document.addEventListener("mozpointerlockchange",e,!1)},e._createCallback=function(t){var e=this;return function(i){var n,r=e._getLocation(i),s=i.button,a=i.buttons,o=s;switch(t){case CC.MOUSE_DOWN:null===(n=e._canvas)||void 0===n||n.focus(),e._isPressed=!0;break;case CC.MOUSE_UP:e._isPressed=!1;break;case CC.MOUSE_MOVE:o=1&a?OC.BUTTON_LEFT:2&a?OC.BUTTON_RIGHT:4&a?OC.BUTTON_MIDDLE:OC.BUTTON_MISSING}var h=new OC(t,!1,e._preMousePos);h.setLocation(r.x,r.y),h.setButton(o),h.movementX=i.movementX,h.movementY=i.movementY,e._preMousePos.set(r.x,r.y),i.stopPropagation(),i.target===e._canvas&&i.preventDefault(),e._eventTarget.emit(t,h)}},e._handleMouseWheel=function(t){var e=CC.MOUSE_WHEEL,i=this._getLocation(t),n=t.button,r=new OC(e,!1,this._preMousePos);r.setLocation(i.x,i.y),r.setButton(n),r.movementX=t.movementX,r.movementY=t.movementY,r.setScrollData(5*t.deltaX,5*-t.deltaY),this._preMousePos.set(i.x,i.y),t.stopPropagation(),t.target===this._canvas&&t.preventDefault(),this._eventTarget.emit(e,r)},t}(),Tw=new Fn,Sw=new(function(){function t(){this._touchMap=void 0,this._maxTouches=8,this._touchMap=new Map}var e=t.prototype;return e._createTouch=function(t,e,i){if(this._touchMap.has(t))k("Cannot create the same touch object.");else{if(!this._checkTouchMapSizeMoreThanMax(t)){var n=new UC(e,i,t);return this._touchMap.set(t,n),this._updateTouch(n,e,i),n}k("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 Sw._touchMap.size},e._updateTouch=function(t,e,i){t.getLocation(Tw),t.setPrevPoint(Tw),t.setPoint(e,i)},e._checkTouchMapSizeMoreThanMax=function(t){var e=this;if(this._touchMap.has(t))return!1;var i=Ce.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>Ce.TOUCH_TIMEOUT&&(k("The touches is more than MAX_TOUCHES, release touch id "+t.getID()+"."),e.releaseTouch(t.getID()))})),i>=this._touchMap.size},t}()),Ew=function(){function t(){this._canvas=void 0,this._eventTarget=new Ju,al.hasFeature(rl.INPUT_TOUCH)&&(this._canvas=document.getElementById("GameCanvas"),this._canvas||U("failed to access canvas"),this._registerEvent())}var e=t.prototype;return e._registerEvent=function(){var t,e,i,n;null===(t=this._canvas)||void 0===t||t.addEventListener("touchstart",this._createCallback(CC.TOUCH_START)),null===(e=this._canvas)||void 0===e||e.addEventListener("touchmove",this._createCallback(CC.TOUCH_MOVE)),null===(i=this._canvas)||void 0===i||i.addEventListener("touchend",this._createCallback(CC.TOUCH_END)),null===(n=this._canvas)||void 0===n||n.addEventListener("touchcancel",this._createCallback(CC.TOUCH_CANCEL))},e._createCallback=function(t){var e=this;return function(i){for(var n,r=e._getCanvasRect(),s=[],a=i.changedTouches.length,o=0;o<a;++o){var h=i.changedTouches[o],u=h.identifier;if(null!==u){var l=e._getLocation(h,r),c=Sw.getOrCreateTouch(u,l.x,l.y);c&&(t!==CC.TOUCH_END&&t!==CC.TOUCH_CANCEL||Sw.releaseTouch(u),s.push(c))}}if(i.stopPropagation(),i.target===e._canvas&&i.preventDefault(),t===CC.TOUCH_START&&(null===(n=e._canvas)||void 0===n||n.focus()),s.length>0){var _=new MC(s,!1,t,Ce.ENABLE_MULTI_TOUCH?Sw.getAllTouches():s);e._eventTarget.emit(t,_)}}},e._getCanvasRect=function(){var t=this._canvas,e=null==t?void 0:t.getBoundingClientRect();return e?new Vn(e.x,e.y,e.width,e.height):new Vn(0,0,0,0)},e._getLocation=function(t,e){if(globalThis.__globalXR&&globalThis.__globalXR.ar&&globalThis.__globalXR.ar.isWebXR())return new Fn(t.clientX,t.clientY);var i=t.clientX-e.x,n=e.y+e.height-t.clientY;if(wl.isFrameRotated){var r=i;i=e.height-n,n=r}var s=wl.devicePixelRatio;return new Fn(i*=s,n*=s)},e.on=function(t,e,i){this._eventTarget.on(t,e,i)},t}();!function(t){t[t.GLOBAL=0]="GLOBAL",t[t.UI=1]="UI"}(fw||(fw={}));var Aw=function(){function t(t){this.priority=fw.GLOBAL,this._inputEventTarget=void 0,this._inputEventTarget=t}return t.prototype.dispatchEvent=function(t){return this._inputEventTarget.emit(t.type,t),!0},t}(),Rw=((dw={})[CC.MOUSE_DOWN]=CC.TOUCH_START,dw[CC.MOUSE_MOVE]=CC.TOUCH_MOVE,dw[CC.MOUSE_UP]=CC.TOUCH_END,dw),bw=t("eK",function(){function t(){this._dispatchImmediately=!0,this._eventTarget=new Ju,this._touchInput=new Ew,this._mouseInput=new yw,this._keyboardInput=new vw,this._accelerometerInput=new GC,this._handleInput=new _w,this._hmdInput=new pw,this._handheldInput=new mw,this._eventTouchList=[],this._eventMouseList=[],this._eventKeyboardList=[],this._eventAccelerationList=[],this._eventGamepadList=[],this._eventHandleList=[],this._eventHMDList=[],this._eventHandheldList=[],this._needSimulateTouchMoveEvent=!1,this._inputEventDispatcher=void 0,this._eventDispatcherList=[],this._registerEvent(),this._inputEventDispatcher=new Aw(this._eventTarget),this._registerEventDispatcher(this._inputEventDispatcher),uw._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 Sw.getTouch(t)},e.getAllTouches=function(){return Sw.getAllTouches()},e.getTouchCount=function(){return Sw.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=Rw[t.type],i=Sw.getOrCreateTouch(0,t.getLocationX(),t.getLocationY());if(i){var n=[i],r=new MC(n,!1,e,e===CC.TOUCH_END?[]:n);r.windowId=t.windowId,e===CC.TOUCH_END&&Sw.releaseTouch(0),this._dispatchOrPushEventTouch(r,this._eventTouchList)}},e._registerEventDispatcher=function(t){this._eventDispatcherList.push(t),this._eventDispatcherList.sort((function(t,e){return e.priority-t.priority}))},e._emitEvent=function(t){for(var e=this._eventDispatcherList.length,i=0;i<e;++i){var n=this._eventDispatcherList[i];try{if(!n.dispatchEvent(t))break}catch(e){G("Error occurs in an event listener: "+t.type),G(e)}}},e._registerEvent=function(){var t=this;if(Ol.hasFeature(Ol.Feature.INPUT_TOUCH)){var e=this._eventTouchList;this._touchInput.on(CC.TOUCH_START,(function(i){t._dispatchOrPushEventTouch(i,e)})),this._touchInput.on(CC.TOUCH_MOVE,(function(i){t._dispatchOrPushEventTouch(i,e)})),this._touchInput.on(CC.TOUCH_END,(function(i){t._dispatchOrPushEventTouch(i,e)})),this._touchInput.on(CC.TOUCH_CANCEL,(function(i){t._dispatchOrPushEventTouch(i,e)}))}if(Ol.hasFeature(Ol.Feature.EVENT_MOUSE)){var i=this._eventMouseList;this._mouseInput.on(CC.MOUSE_DOWN,(function(e){t._needSimulateTouchMoveEvent=!0,t._simulateEventTouch(e),t._dispatchOrPushEvent(e,i)})),this._mouseInput.on(CC.MOUSE_MOVE,(function(e){t._needSimulateTouchMoveEvent&&t._simulateEventTouch(e),t._dispatchOrPushEvent(e,i)})),this._mouseInput.on(CC.MOUSE_UP,(function(e){t._needSimulateTouchMoveEvent=!1,t._simulateEventTouch(e),t._dispatchOrPushEvent(e,i)})),this._mouseInput.on(CC.MOUSE_WHEEL,(function(e){t._dispatchOrPushEvent(e,i)}))}if(Ol.hasFeature(Ol.Feature.EVENT_KEYBOARD)){var n=this._eventKeyboardList;this._keyboardInput.on(CC.KEY_DOWN,(function(e){t._dispatchOrPushEvent(e,n)})),this._keyboardInput.on(CC.KEY_PRESSING,(function(e){t._dispatchOrPushEvent(e,n)})),this._keyboardInput.on(CC.KEY_UP,(function(e){t._dispatchOrPushEvent(e,n)}))}if(Ol.hasFeature(Ol.Feature.EVENT_ACCELEROMETER)){var r=this._eventAccelerationList;this._accelerometerInput.on(CC.DEVICEMOTION,(function(e){t._dispatchOrPushEvent(e,r)}))}if(Ol.hasFeature(Ol.Feature.EVENT_GAMEPAD)){var s=this._eventGamepadList;uw._on(CC.GAMEPAD_CHANGE,(function(e){t._dispatchOrPushEvent(e,s)})),uw._on(CC.GAMEPAD_INPUT,(function(e){t._dispatchOrPushEvent(e,s)})),uw._on(CC.HANDLE_POSE_INPUT,(function(e){t._dispatchOrPushEvent(e,s)}))}if(Ol.hasFeature(Ol.Feature.EVENT_HANDLE)){var a=this._eventHandleList;this._handleInput._on(CC.HANDLE_INPUT,(function(e){t._dispatchOrPushEvent(e,a)})),this._handleInput._on(CC.HANDLE_POSE_INPUT,(function(e){t._dispatchOrPushEvent(e,a)}))}if(Ol.hasFeature(Ol.Feature.EVENT_HMD)){var o=this._eventHMDList;this._hmdInput._on(CC.HMD_POSE_INPUT,(function(e){t._dispatchOrPushEvent(e,o)}))}if(Ol.hasFeature(Ol.Feature.EVENT_HANDHELD)){var h=this._eventHandheldList;this._handheldInput._on(CC.HANDHELD_POSE_INPUT,(function(e){t._dispatchOrPushEvent(e,h)}))}},e._clearEvents=function(){this._eventMouseList.length=0,this._eventTouchList.length=0,this._eventKeyboardList.length=0,this._eventAccelerationList.length=0,this._eventGamepadList.length=0,this._eventHandleList.length=0,this._eventHMDList.length=0},e._dispatchOrPushEvent=function(t,e){this._dispatchImmediately?this._emitEvent(t):e.push(t)},e._dispatchOrPushEventTouch=function(t,e){if(this._dispatchImmediately)for(var i=t.getTouches(),n=i.length,r=0;r<n;++r)t.touch=i[r],t.propagationStopped=t.propagationImmediateStopped=!1,this._emitEvent(t);else e.push(t)},e._frameDispatchEvents=function(){for(var t=this._eventHMDList,e=0,i=t.length;e<i;++e){var n=t[e];this._emitEvent(n)}for(var r=this._eventHandheldList,s=0,a=r.length;s<a;++s){var o=r[s];this._emitEvent(o)}for(var h=this._eventMouseList,u=0,l=h.length;u<l;++u){var c=h[u];this._emitEvent(c)}for(var _=this._eventTouchList,d=0,f=_.length;d<f;++d)for(var p=_[d],m=p.getTouches(),g=m.length,v=0;v<g;++v)p.touch=m[v],p.propagationStopped=p.propagationImmediateStopped=!1,this._emitEvent(p);for(var y=this._eventKeyboardList,T=0,S=y.length;T<S;++T){var E=y[T];this._emitEvent(E)}for(var A=this._eventAccelerationList,R=0,b=A.length;R<b;++R){var C=A[R];this._emitEvent(C)}for(var w=this._eventGamepadList,x=0,I=w.length;x<I;++x){var O=w[x];this._emitEvent(O)}for(var D=this._eventHandleList,M=0,P=D.length;M<P;++M){var B=D[M];this._emitEvent(B)}this._clearEvents()},t}());bw.EventType=CC;var Cw=t("eJ",new bw),ww=t("eM",function(t){function e(){var e;return e=t.call(this)||this,Cw.on(CC.MOUSE_DOWN,(function(t){e.emit(bC.MOUSE_DOWN,t)})),Cw.on(CC.MOUSE_MOVE,(function(t){e.emit(bC.MOUSE_MOVE,t)})),Cw.on(CC.MOUSE_UP,(function(t){e.emit(bC.MOUSE_UP,t)})),Cw.on(CC.MOUSE_WHEEL,(function(t){e.emit(bC.MOUSE_WHEEL,t)})),Cw.on(CC.TOUCH_START,(function(t){e.emit(bC.TOUCH_START,t.touch,t)})),Cw.on(CC.TOUCH_MOVE,(function(t){e.emit(bC.TOUCH_MOVE,t.touch,t)})),Cw.on(CC.TOUCH_END,(function(t){e.emit(bC.TOUCH_END,t.touch,t)})),Cw.on(CC.TOUCH_CANCEL,(function(t){e.emit(bC.TOUCH_CANCEL,t.touch,t)})),Cw.on(CC.KEY_DOWN,(function(t){e.emit(bC.KEY_DOWN,t)})),Cw.on(CC.KEY_PRESSING,(function(t){e.emit(bC.KEY_DOWN,t)})),Cw.on(CC.KEY_UP,(function(t){e.emit(bC.KEY_UP,t)})),Cw.on(CC.DEVICEMOTION,(function(t){e.emit(bC.DEVICEMOTION,t)})),e}s(e,t);var i=e.prototype;return i.setAccelerometerEnabled=function(t){Cw.setAccelerometerEnabled(t)},i.setAccelerometerInterval=function(t){Cw.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}(Ju));ww.EventType=bC,v.SystemEvent=ww;var xw,Iw,Ow,Dw,Mw,Pw,Bw,Nw,Lw=t("eL",new ww);v.systemEvent=Lw,rt(bC,"Node.EventType",[{name:"POSITION_PART",newName:"TRANSFORM_CHANGED"},{name:"ROTATION_PART",newName:"TRANSFORM_CHANGED"},{name:"SCALE_PART",newName:"TRANSFORM_CHANGED"}]),rt(wC,"Event",[{name:"ACCELERATION",newName:"DEVICEMOTION",target:ww.EventType,targetName:"SystemEvent.EventType"}]),at(wC,"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(OC,"EventMouse",["DOWN","UP","MOVE"].map((function(t){return{name:t,newName:"MOUSE_"+t,target:ww.EventType,targetName:"SystemEvent.EventType"}}))),rt(OC,"EventMouse",[{name:"SCROLL",newName:"MOUSE_WHEEL",target:ww.EventType,targetName:"SystemEvent.EventType"}]),at(OC.prototype,"EventMouse.prototype",[{name:"eventType",suggest:"please use EventMouse.prototype.type instead"}]),rt(MC,"EventTouch",[{name:"BEGAN",newName:"TOUCH_START",target:ww.EventType,targetName:"SystemEvent.EventType"}]),rt(MC,"EventTouch",[{name:"MOVED",newName:"TOUCH_MOVE",target:ww.EventType,targetName:"SystemEvent.EventType"}]),rt(MC,"EventTouch",[{name:"ENDED",newName:"TOUCH_END",target:ww.EventType,targetName:"SystemEvent.EventType"}]),rt(MC,"EventTouch",[{name:"CANCELLED",newName:"TOUCH_CANCEL",target:ww.EventType,targetName:"SystemEvent.EventType"}]),at(MC.prototype,"EventTouch.prototype",[{name:"getEventCode",suggest:"please use EventTouch.prototype.type instead"}]),rt(MC.prototype,"EventTouch.prototype",[{name:"getUILocationInView",newName:"getLocationInView",target:MC,targetName:"EventTouch"}]),at(Ce.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}}))),at(Ce.KEY,"macro.KEY",[{name:"shift",suggest:"please use KeyCode.SHIFT_LEFT instead"}]),at(Ce.KEY,"macro.KEY",[{name:"ctrl",suggest:"please use KeyCode.CTRL_LEFT instead"}]),at(Ce.KEY,"macro.KEY",[{name:"alt",suggest:"please use KeyCode.ALT_LEFT instead"}]),at(Ce,"macro",[{name:"KEY",suggest:"please use KeyCode instead"}]),function(t){t[t.VERTICAL=0]="VERTICAL",t[t.HORIZONTAL=1]="HORIZONTAL"}(xw||(xw={})),function(t){t[t.ORTHO=0]="ORTHO",t[t.PERSPECTIVE=1]="PERSPECTIVE"}(Iw||(Iw={})),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"}(Ow||(Ow={})),function(t){t[t.ISO100=0]="ISO100",t[t.ISO200=1]="ISO200",t[t.ISO400=2]="ISO400",t[t.ISO800=3]="ISO800"}(Dw||(Dw={})),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"}(Mw||(Mw={})),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"}(Pw||(Pw={})),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"}(Bw||(Bw={})),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"}(Nw||(Nw={}));var Fw,kw=[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],Uw=[1,.5,1/4,1/8,1/15,1/30,1/60,.008,.004,.002,.001,5e-4,1/4e3],Gw=[100,200,400,800],Hw=new hn,zw=new hn,Vw=new Dn,Ww=xc.STENCIL<<1,Xw=[],jw=function(){function t(t){if(this.isWindowSize=!0,this.screenScale=void 0,this.postProcess=null,this.usePostProcess=!1,this.pipeline="",this._device=void 0,this._scene=null,this._node=null,this._name=null,this._enabled=!1,this._proj=-1,this._aspect=void 0,this._orthoHeight=10,this._fovAxis=xw.VERTICAL,this._fov=Mi(45),this._nearClip=1,this._farClip=1e3,this._clearColor=new Xc(.2,.2,.2,1),this._viewport=new Vn(0,0,1,1),this._orientedViewport=new Vn(0,0,1,1),this._curTransform=Wl.IDENTITY,this._isProjDirty=!0,this._matView=new Dn,this._matProj=new Dn,this._matProjInv=new Dn,this._matViewProj=new Dn,this._matViewProjInv=new Dn,this._frustum=new Is,this._forward=new hn,this._position=new hn,this._priority=0,this._aperture=Ow.F16_0,this._apertureValue=void 0,this._shutter=Mw.D125,this._shutterValue=0,this._iso=Dw.ISO100,this._isoValue=0,this._window=null,this._width=1,this._height=1,this._clearFlag=xc.NONE,this._clearDepth=1,this._visibility=Jv,this._exposure=0,this._clearStencil=0,this._geometryRenderer=null,this._windowId=0,this._cameraType=Pw.DEFAULT,this._trackingType=Bw.NO_TRACKING,this._usage=Nw.GAME,this._device=t,this._apertureValue=kw[this._aperture],this._shutterValue=Uw[this._shutter],this._isoValue=Gw[this._iso],this._aspect=this.screenScale=1,this._frustum.accurate=!0,!Xw.length){var e=t.capabilities.clipSpaceSignY;Xw[Wl.IDENTITY]=new Dn(1,0,0,0,0,e),Xw[Wl.ROTATE_90]=new Dn(0,1,0,0,-e,0),Xw[Wl.ROTATE_180]=new Dn(-1,0,0,0,0,-e),Xw[Wl.ROTATE_270]=new Dn(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||Wl.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=xc.NONE,this.clearDepth=1,this.visibility=Jv,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 Vn(r*s,0,r,1))}(this._node.hasChangedFlags||t)&&(Dn.invert(this._matView,this._node.worldMatrix),this._forward.x=-this._matView.m02,this._forward.y=-this._matView.m06,this._forward.z=-this._matView.m10,Dn.multiply(this._matView,(new Dn).scale(this._node.worldScale),this._matView),this._node.getWorldPosition(this._position),i=!0);var a=null===(e=this.window)||void 0===e?void 0:e.swapchain,o=a&&a.surfaceTransform||Wl.IDENTITY;if(this._isProjDirty||this._curTransform!==o){this._curTransform=o;var h=this._device.capabilities.clipSpaceSignY;if(this._proj===Iw.PERSPECTIVE)if(n&&n.isWebXR&&n.webXRWindowMap&&n.webXRMatProjs){var u=n.webXRWindowMap.get(this._window);this._matProj.set(n.webXRMatProjs[u])}else Dn.perspective(this._matProj,this._fov,this._aspect,this._nearClip,this._farClip,this._fovAxis===xw.VERTICAL,this._device.capabilities.clipSpaceMinZ,h,o);else{var l=this._orthoHeight*this._aspect,c=this._orthoHeight;Dn.ortho(this._matProj,-l,l,-c,c,this._nearClip,this._farClip,this._device.capabilities.clipSpaceMinZ,h,o)}Dn.invert(this._matProjInv,this._matProj),i=!0,this._isProjDirty=!1}i&&(Dn.multiply(this._matViewProj,this._matProj,this._matView),Dn.invert(this._matViewProjInv,this._matViewProj),this._frustum.update(this._matViewProj,this._matViewProjInv))}},e.setViewportInOrientedSpace=function(t){var e,i=t.x,n=t.width,r=t.height,s=this._device.capabilities.screenSpaceSignY<0?1-t.y-r:t.y,a=null===(e=this.window)||void 0===e?void 0:e.swapchain;switch(a&&a.surfaceTransform||Wl.IDENTITY){case Wl.ROTATE_90:this._viewport.x=1-s-r,this._viewport.y=i,this._viewport.width=r,this._viewport.height=n;break;case Wl.ROTATE_180:this._viewport.x=1-i-n,this._viewport.y=1-s-r,this._viewport.width=n,this._viewport.height=r;break;case Wl.ROTATE_270:this._viewport.x=s,this._viewport.y=1-i-n,this._viewport.width=r,this._viewport.height=n;break;case Wl.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=v.internal.GeometryRenderer?new v.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||v.director.root.mainWindow;if(e){e.attachCamera(this),this.window=e;var i=e.swapchain;(i&&i.surfaceTransform||Wl.IDENTITY)%2?this.resize(e.height,e.width):this.resize(e.width,e.height)}},e.detachCamera=function(){this._window&&this._window.detachCamera(this)},e.screenPointToRay=function(t,e,i){if(!this._node)return null;var n=this.width,r=this.height,s=this._orientedViewport.x*n,a=this._orientedViewport.y*r,o=this._orientedViewport.width*n,h=this._orientedViewport.height*r,u=this._proj===Iw.PERSPECTIVE,l=this._device.capabilities.clipSpaceSignY,c=On[this._curTransform];hn.set(Hw,(e-s)/o*2-1,(i-a)/h*2-1,u?1:-1);var _=Hw.x,d=Hw.y;return Hw.x=_*c[0]+d*c[2]*l,Hw.y=_*c[1]+d*c[3]*l,hn.transformMat4(u?Hw:t.o,Hw,this._matViewProjInv),u?(this._node.getWorldPosition(zw),hr.fromPoints(t,zw,Hw)):hn.transformQuat(t.d,hn.FORWARD,this._node.worldRotation),t},e.screenToWorld=function(t,e){var i=this.width,n=this.height,r=this._orientedViewport.x*i,s=this._orientedViewport.y*n,a=this._orientedViewport.width*i,o=this._orientedViewport.height*n,h=this._device.capabilities.clipSpaceSignY,u=On[this._curTransform];if(this._proj===Iw.PERSPECTIVE){hn.set(t,(e.x-r)/a*2-1,(e.y-s)/o*2-1,1);var l=t.x,c=t.y;t.x=l*u[0]+c*u[2]*h,t.y=l*u[1]+c*u[3]*h,hn.transformMat4(t,t,this._matViewProjInv),this._node&&this._node.getWorldPosition(Hw),hn.lerp(t,Hw,t,Di(this._nearClip/this._farClip,1,e.z))}else{hn.set(t,(e.x-r)/a*2-1,(e.y-s)/o*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,hn.transformMat4(t,t,this._matViewProjInv)}return t},e.worldToScreen=function(t,e){var i=this._device.capabilities.clipSpaceSignY,n=On[this._curTransform];hn.transformMat4(t,e,this._matViewProj);var r=t.x,s=t.y;t.x=r*n[0]+s*n[2]*i,t.y=r*n[1]+s*n[3]*i;var a=this.width,o=this.height,h=this._orientedViewport.x*a,u=this._orientedViewport.y*o,l=this._orientedViewport.width*a,c=this._orientedViewport.height*o;return t.x=h+.5*(t.x+1)*l,t.y=u+.5*(t.y+1)*c,t.z=.5*t.z+.5,t},e.worldMatrixToScreen=function(t,e,i,n){Dn.multiply(t,this._matViewProj,e),Dn.multiply(t,Xw[this._curTransform],t);var r=i/2,s=n/2;return Dn.identity(Vw),Dn.transform(Vw,Vw,hn.set(Hw,r,s,0)),Dn.scale(Vw,Vw,hn.set(Hw,r,s,1)),Dn.multiply(t,Vw,t),t},e.calculateObliqueMat=function(t){var e=new nn(Math.sign(t.x),Math.sign(t.y),1,1).transformMat4(this._matProjInv),i=new nn(this._matProj.m03,this._matProj.m07,this._matProj.m11,this._matProj.m15),n=2/nn.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=Nw.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=kw[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=Uw[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=Gw[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}(),Yw=new hn,Kw=yr.create(0,0,0,1),qw=new Es(0,0,0,.5,.5,.5),Qw=new Es,Zw=new Pu((function(){return{model:null,depth:0}}),128);function Jw(t,e){var i=0;t.node&&(hn.subtract(Yw,t.worldBounds?t.worldBounds.center:t.node.worldPosition,e.position),i=hn.dot(Yw,e.forward));var n=Zw.alloc();return n.model=t,n.depth=i,n}function $w(t,e){var i=t.pipelineSceneData,n=i.validPunctualLights;n.length=0;for(var r=e.scene.spotLights,s=0;s<r.length;s++){var a=r[s];a.baked&&!e.node.scene.globals.disableLightmap||(yr.set(Kw,a.position.x,a.position.y,a.position.z,a.range),us.sphereFrustum(Kw,e.frustum)&&n.push(a))}for(var o=e.scene.sphereLights,h=0;h<o.length;h++){var u=o[h];u.baked&&!e.node.scene.globals.disableLightmap||(yr.set(Kw,u.position.x,u.position.y,u.position.z,u.range),us.sphereFrustum(Kw,e.frustum)&&n.push(u))}for(var l=e.scene.pointLights,c=0;c<l.length;c++){var _=l[c];_.baked||(yr.set(Kw,_.position.x,_.position.y,_.position.z,_.range),us.sphereFrustum(Kw,e.frustum)&&n.push(_))}for(var d=e.scene.rangedDirLights,f=0;f<d.length;f++){var p=d[f];Es.transform(Qw,qw,p.node.getWorldMatrix()),us.aabbFrustum(Qw,e.frustum)&&n.push(p)}i.validPunctualLights=n}function tx(t,e){var i=e.scene,n=i.mainLight,r=t.pipelineSceneData,s=r.shadows,a=r.skybox,o=r.csmLayers,h=r.renderObjects;Zw.freeArray(h),h.length=0;var u=o.castShadowObjects;u.length=0;var l=o.layerObjects;l.clear(),s.enabled&&(t.pipelineUBO.updateShadowUBORange(Ng.SHADOW_COLOR_OFFSET,s.shadowColor),s.type===MS.ShadowMap&&n&&n.node&&o.update(r,e)),e.clearFlag&Ww&&(a.enabled&&a.model?h.push(Jw(a.model,e)):e.cameraUsage!==Nw.EDITOR&&e.cameraUsage!==Nw.SCENE_VIEW&&v.warnID(15100,e.name));var c=i.models,_=e.visibility;function d(t){if(t.enabled){if(i.isCulledByLod(e,t))return;if(t.castShadow&&(u.push(Jw(t,e)),l.push(Jw(t,e))),t.node&&(_&t.node.layer)===t.node.layer||_&t.visFlags){if(t.worldBounds&&!us.aabbFrustum(t.worldBounds,e.frustum))return;h.push(Jw(t,e))}}}for(var f=0;f<c.length;f++)d(c[f])}var ex=new p_;ex.format=jl.RGBA8;var ix=new m_;ix.format=jl.DEPTH_STENCIL;var nx,rx,sx=new y_([ex],ix),ax={width:1,height:1,renderPassInfo:sx},ox=t("ei",qs("cc.RenderTexture")(Fw=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._window=null,e}s(e,t);var i=e.prototype;return i.initialize=function(t){this._name=t.name||"",this._width=t.width,this._height=t.height,this._initWindow(t)},i.reset=function(t){this.initialize(t)},i.destroy=function(){if(this._window){var e=v.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(Ii(t,1,2048)),this._height=Math.floor(Ii(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=v.director.root;ax.title=this._name,ax.width=this._width,ax.height=this._height,ax.renderPassInfo=t&&t.passInfo?t.passInfo:sx,ax.externalResLow=t&&t.externalResLow?t.externalResLow:0,ax.externalResHigh=t&&t.externalResHigh?t.externalResHigh:0,ax.externalFlag=t&&t.externalFlag?t.externalFlag:ec.NONE,ex.barrier=wd.gfxDevice.getGeneralBarrier(new T_(pc.FRAGMENT_SHADER_READ_TEXTURE,pc.FRAGMENT_SHADER_READ_TEXTURE)),this._window?(this._window.destroy(),this._window.initialize(wd.gfxDevice,ax)):this._window=e.createWindow(ax)},i.initDefault=function(e){t.prototype.initDefault.call(this,e),this._width=this._height=1,this._initWindow()},i.validate=function(){return this.width>=1&&this.width<=2048&&this.height>=1&&this.height<=2048},i.readPixels=function(t,e,i,n,r){void 0===t&&(t=0),void 0===e&&(e=0),i=i||this.width,n=n||this.height;var s=this.getGFXTexture();if(!s)return Z(7606),null;var a=4*i*n;if(void 0===r)r=new Uint8Array(a);else if(r.length<a)return Z(7607,a),null;var o=this._getGFXDevice(),h=[],u=[],l=new Vc;return l.texOffset.x=t,l.texOffset.y=e,l.texExtent.width=i,l.texExtent.height=n,u.push(l),h.push(r),null==o||o.copyTextureToBuffers(s,h,u),r},n(e,[{key:"window",get:function(){return this._window}}]),e}(Lf))||Fw);v.RenderTexture=ox,function(t){t[t.SKYBOX=Ww|xc.DEPTH_STENCIL]="SKYBOX",t[t.SOLID_COLOR=xc.ALL]="SOLID_COLOR"}(nx||(nx={})),function(t){t[t.CUBE=0]="CUBE",t[t.PLANAR=1]="PLANAR"}(rx||(rx={}));var hx,ux=[new hn(0,-90,0),new hn(0,90,0),new hn(90,0,0),new hn(-90,0,0),new hn(0,0,0),new hn(0,180,0)],lx=function(){function t(t){this.bakedCubeTextures=[],this.realtimePlanarTexture=null,this._resolution=256,this._clearFlag=nx.SKYBOX,this._backgroundColor=new pn(0,0,0,255),this._visibility=Jv,this._probeType=rx.CUBE,this._cubemap=null,this._size=new hn(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 hn,this._cameraWorldRotation=new En,this._forward=new hn,this._up=new hn,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=Es.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=v.view.getDesignResolutionSize();this.realtimePlanarTexture=this._createTargetTexture(e.width,e.height),v.internal.reflectionProbeManager.updatePlanarMap(this,this.realtimePlanarTexture.getGFXTexture())}this._syncCameraParams(t),this._transformReflectionCamera(t),this._needRender=!0}},e.switchProbeType=function(t,e){t===rx.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===rx.PLANAR?new Fn(this.realtimePlanarTexture.width,this.realtimePlanarTexture.height):new Fn(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(ux[t]),this.camera.update(!0)},e.updateBoundingBox=function(){if(this.node){var t=this.node.getWorldPosition();Es.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===rx.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=v.director.root;if(!this._camera){if(this._camera=e.createCamera(),!this._camera)return null;this._camera.initialize({name:t.name,node:t,projection:Iw.PERSPECTIVE,window:e&&e.tempWindow,priority:0,cameraType:Pw.DEFAULT,trackingType:Bw.NO_TRACKING})}return this._camera.setViewportInOrientedSpace(new Vn(0,0,1,1)),this._camera.fovAxis=xw.VERTICAL,this._camera.fov=Mi(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=Ow.F16_0,this._camera.shutter=Mw.D125,this._camera.iso=Dw.ISO100,this._camera},e._resetCameraParams=function(){this.camera.projectionType=Iw.PERSPECTIVE,this.camera.orthoHeight=10,this.camera.nearClip=1,this.camera.farClip=1e3,this.camera.fov=Mi(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 ox;return i.reset({width:t,height:e}),i},e._transformReflectionCamera=function(t){var e=hn.dot(this.node.worldPosition,this.node.up);this._reflect(this._cameraWorldPos,t.node.worldPosition,this.node.up,e),this.cameraNode.worldPosition=this._cameraWorldPos,hn.transformQuat(this._forward,hn.FORWARD,t.node.worldRotation),this._reflect(this._forward,this._forward,this.node.up,0),this._forward.normalize(),this._forward.negative(),hn.transformQuat(this._up,hn.UP,t.node.worldRotation),this._reflect(this._up,this._up,this.node.up,0),this._up.normalize(),En.fromViewUp(this._cameraWorldRotation,this._forward,this._up),this.cameraNode.worldRotation=this._cameraWorldRotation,this.camera.update(!0);var i=new nn(this.node.up.x,this.node.up.y,this.node.up.z,-hn.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=hn.clone(i);r.normalize();var s=hn.dot(r,e)-n;return r.multiplyScalar(2*s),hn.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();Es.set(this._boundingBox,e.x,e.y,e.z,this._size.x,this._size.y,this._size.z)}},{key:"cubemap",get:function(){return this._cubemap},set:function(t){this._cubemap=t}},{key:"node",get:function(){return this._node}},{key:"camera",get:function(){return this._camera}},{key:"needRefresh",get:function(){return this._needRefresh},set:function(t){this._needRefresh=t}},{key:"needRender",get:function(){return this._needRender},set:function(t){this._needRender=t}},{key:"boundingBox",get:function(){return this._boundingBox}},{key:"cameraNode",get:function(){return this._cameraNode},set:function(t){this._cameraNode=t}},{key:"previewSphere",get:function(){return this._previewSphere},set:function(t){this._previewSphere=t}},{key:"previewPlane",get:function(){return this._previewPlane},set:function(t){this._previewPlane=t}}]),t}();function cx(t,e){e<1e3?e=1e3:e>15e3&&(e=15e3);var i=e*e,n=(.860117757+.000154118254*e+1.28641212e-7*i)/(1+.000842420235*e+7.08145163e-7*i),r=(.317398726+422806245e-13*e+4.20481691e-8*i)/(1-289741816e-13*e+1.61456053e-7*i),s=2*n-8*r+4,a=3*n/s,o=2*r/s,h=1/o*a,u=1/o*(1-a-o);t.x=3.2404542*h-1.5371385+-.4985314*u,t.y=-.969266*h+1.8760108+.041556*u,t.z=.0556434*h-.2040259+1.0572252*u}!function(t){t[t.DIRECTIONAL=0]="DIRECTIONAL",t[t.SPHERE=1]="SPHERE",t[t.SPOT=2]="SPOT",t[t.POINT=3]="POINT",t[t.RANGED_DIRECTIONAL=4]="RANGED_DIRECTIONAL",t[t.UNKNOWN=5]="UNKNOWN"}(hx||(hx={}));var _x,dx,fx,px,mx,gx,vx,yx,Tx,Sx,Ex,Ax,Rx=function(t){return 4*Math.PI*Math.PI*t*t},bx=function(){function t(){this._baked=!1,this._color=new hn(1,1,1),this._colorTemp=6550,this._colorTempRGB=new hn(1,1,1),this._finalColor=new hn(1,1,1),this._scene=null,this._node=null,this._name=null,this._useColorTemperature=!1,this._type=hx.UNKNOWN,this._visibility=Jv}var e=t.prototype;return e.initialize=function(){this.color=new hn(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&&hn.multiply(this._finalColor,this._color,this._colorTempRGB)}},{key:"useColorTemperature",get:function(){return this._useColorTemperature},set:function(t){this._useColorTemperature=t,t&&hn.multiply(this._finalColor,this._color,this._colorTempRGB)}},{key:"colorTemperature",get:function(){return this._colorTemp},set:function(t){this._colorTemp=t,cx(this._colorTempRGB,this._colorTemp),this._useColorTemperature&&hn.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|=om.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}();!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"}(_x||(_x={})),function(t){t[t.CONSTANTS=0]="CONSTANTS",t[t.CBV=1]="CBV",t[t.UAV=2]="UAV",t[t.SRV=3]="SRV",t[t.TABLE=4]="TABLE",t[t.SSV=5]="SSV"}(dx||(dx={})),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"}(fx||(fx={})),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"}(px||(px={})),function(t){t[t.BUFFER=0]="BUFFER",t[t.TEXTURE1D=1]="TEXTURE1D",t[t.TEXTURE2D=2]="TEXTURE2D",t[t.TEXTURE3D=3]="TEXTURE3D"}(mx||(mx={})),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"}(gx||(gx={})),function(t){t[t.SYNC=0]="SYNC",t[t.ASYNC=1]="ASYNC"}(vx||(vx={})),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"}(yx||(yx={})),function(t){t[t.NONE=0]="NONE",t[t.DEFAULT=1]="DEFAULT",t[t.CLUSTERED=2]="CLUSTERED"}(Tx||(Tx={})),function(t){t[t.RENDER_TARGET=0]="RENDER_TARGET",t[t.DEPTH_STENCIL=1]="DEPTH_STENCIL",t[t.SHADING_RATE=2]="SHADING_RATE"}(Sx||(Sx={})),function(t){t[t.READ=0]="READ",t[t.READ_WRITE=1]="READ_WRITE",t[t.WRITE=2]="WRITE"}(Ex||(Ex={})),function(t){t[t.NONE=0]="NONE",t[t.FLOAT_TYPE=1]="FLOAT_TYPE",t[t.INT_TYPE=2]="INT_TYPE"}(Ax||(Ax={}));var Cx,wx,xx=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=void 0,this.probe=void 0,this.level=void 0,this.culledByLight=void 0,this.light=t,this.probe=n,this.level=e,this.culledByLight=i}return t.prototype.reset=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),this.light=t,this.probe=n,this.level=e,this.culledByLight=i},t}();!function(t){t[t.UNIFORM_BUFFER=0]="UNIFORM_BUFFER",t[t.DYNAMIC_UNIFORM_BUFFER=1]="DYNAMIC_UNIFORM_BUFFER",t[t.SAMPLER_TEXTURE=2]="SAMPLER_TEXTURE",t[t.SAMPLER=3]="SAMPLER",t[t.TEXTURE=4]="TEXTURE",t[t.STORAGE_BUFFER=5]="STORAGE_BUFFER",t[t.DYNAMIC_STORAGE_BUFFER=6]="DYNAMIC_STORAGE_BUFFER",t[t.STORAGE_IMAGE=7]="STORAGE_IMAGE",t[t.INPUT_ATTACHMENT=8]="INPUT_ATTACHMENT"}(Cx||(Cx={})),function(t){t[t.NONE=0]="NONE",t[t.COLOR=1]="COLOR",t[t.DEPTH=2]="DEPTH",t[t.STENCIL=4]="STENCIL"}(wx||(wx={}));var Ix,Ox=function(){function t(t,e,i,n,r,s,a){void 0===t&&(t=new Uint8Array(0)),void 0===e&&(e=""),void 0===i&&(i=4294967295),void 0===n&&(n=4294967295),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=0),this.source=void 0,this.target=void 0,this.mipLevels=void 0,this.numSlices=void 0,this.targetMostDetailedMip=void 0,this.targetFirstSlice=void 0,this.targetPlaneSlice=void 0,this.source=t,this.target=e,this.mipLevels=i,this.numSlices=n,this.targetMostDetailedMip=r,this.targetFirstSlice=s,this.targetPlaneSlice=a}return t.prototype.reset=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),this.target=t,this.mipLevels=e,this.numSlices=i,this.targetMostDetailedMip=n,this.targetFirstSlice=r,this.targetPlaneSlice=s},t}();st(Lf.prototype,"TextureBase.prototype",[{name:"hasPremultipliedAlpha"},{name:"setPremultiplyAlpha"},{name:"setFlipY"}]),rt(ox.prototype,"RenderTexture.prototype",[{name:"getGFXWindow",customFunction:function(){return this.window}}]);var Dx=((Ix={})[Yl.UNORM]="Uint",Ix[Yl.SNORM]="Int",Ix[Yl.UINT]="Uint",Ix[Yl.INT]="Int",Ix[Yl.UFLOAT]="Float",Ix[Yl.FLOAT]="Float",Ix.default="Uint",Ix);function Mx(t){return""+(Dx[t.type]||Dx.default)+t.size/t.count*8}function Px(t,e,i,n,r){void 0===i&&(i=jl.R32F),void 0===n&&(n=0),void 0===r&&(r=0);var s=F_[i];r||(r=s.size);for(var a="set"+Mx(s),o=s.size/s.count,h=Math.floor(e.length/s.count),u=Ol.isLittleEndian,l=0;l<h;++l)for(var c=n+r*l,_=0;_<s.count;++_){var d=c+o*_;t[a](d,e[s.count*l+_],u)}}function Bx(t,e,i,n,r,s){void 0===e&&(e=jl.R32F),void 0===i&&(i=0),void 0===n&&(n=t.byteLength-i),void 0===r&&(r=0),void 0===s&&(s=[]);var a=F_[e];r||(r=a.size);for(var o="get"+Mx(a),h=a.size/a.count,u=Math.floor(n/r),l=Ol.isLittleEndian,c=0;c<u;++c)for(var _=i+r*c,d=0;d<a.count;++d){var f=_+h*d;s[a.count*c+d]=t[o](f,l)}return s}function Nx(t,e,i,n,r,s,a){void 0===i&&(i=jl.R32F),void 0===n&&(n=0),void 0===r&&(r=t.byteLength-n),void 0===s&&(s=0),a||(a=new DataView(t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)));var o=F_[i];s||(s=o.size);for(var h="set"+Mx(o),u="get"+Mx(o),l=o.size/o.count,c=Math.floor(r/s),_=Ol.isLittleEndian,d=0;d<c;++d)for(var f=n+s*d,p=0;p<o.count;++p){var m=f+l*p,g=t[u](m,_);a[h](m,e(g,p,t),_)}return a}var Lx=t("e9",function(){function t(t,e,i,n,r,s){void 0===n&&(n=null),void 0===r&&(r=null),void 0===s&&(s=!0),this.mesh=void 0,this.subMeshIdx=void 0,this._flatBuffers=[],this._jointMappedBuffers=void 0,this._jointMappedBufferIndices=void 0,this._vertexIdChannel=void 0,this._geometricInfo=void 0,this._vertexBuffers=void 0,this._attributes=void 0,this._indexBuffer=null,this._indirectBuffer=null,this._primitiveMode=void 0,this._iaInfo=void 0,this._isOwnerOfIndexBuffer=!0,this._drawInfo=null,this._attributes=e,this._vertexBuffers=t,this._indexBuffer=n,this._indirectBuffer=r,this._primitiveMode=i,this._iaInfo=new 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],a=i.indexView?i.indexView.count:s.view.count,o=s.view.stride,h=o*a,u=new Uint8Array(t.data.buffer,s.view.offset,s.view.length),l=new Uint8Array(i.indexView?h:s.view.length);if(i.indexView){for(var c=t.readIndices(this.subMeshIdx),_=0;_<e;++_)for(var d=_*o,f=c[_]*o,p=0;p<o;++p)l[d+p]=u[f+p];this._flatBuffers.push({stride:o,count:a,buffer:l})}else l.set(t.data.subarray(s.view.offset,s.view.offset+s.view.length)),this._flatBuffers.push({stride:o,count:a,buffer:l})}}},e.destroy=function(){for(var t=0;t<this.vertexBuffers.length;t++)this.vertexBuffers[t].destroy();if(this.vertexBuffers.length=0,this._indexBuffer&&(this._isOwnerOfIndexBuffer&&this._indexBuffer.destroy(),this._indexBuffer=null),this._jointMappedBuffers&&this._jointMappedBufferIndices){for(var e=0;e<this._jointMappedBufferIndices.length;e++)this._jointMappedBuffers[this._jointMappedBufferIndices[e]].destroy();this._jointMappedBuffers=void 0,this._jointMappedBufferIndices=void 0}this._indirectBuffer&&(this._indirectBuffer.destroy(),this._indirectBuffer=null)},e.enableVertexIdChannel=function(t){if(!this._vertexIdChannel){var e=this.vertexBuffers.length,i=this.attributes.length,n=this._allocVertexIdBuffer(t);this._vertexBuffers.push(n),this._attributes.push(new __("a_vertexId",jl.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 qc(ql.VERTEX|ql.TRANSFER_DST,Jl.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===Mc.ATTR_POSITION}));if(!r)return t.EMPTY_GEOMETRIC_INFO;switch(r.format){case jl.RG32F:case jl.RGB32F:if(!(e=i.readAttribute(n,Mc.ATTR_POSITION)))return t.EMPTY_GEOMETRIC_INFO;break;case jl.RGBA32F:var s=i.readAttribute(n,Mc.ATTR_POSITION);if(!s)return t.EMPTY_GEOMETRIC_INFO;var a=s.length/4;e=new Float32Array(3*a);for(var o=0;o<a;++o){var h=3*o,u=4*o;e[h]=s[u],e[h+1]=s[u+1],e[h+2]=s[u+2]}break;case jl.RG16F:case jl.RGB16F:var l=i.readAttribute(n,Mc.ATTR_POSITION);if(!l)return t.EMPTY_GEOMETRIC_INFO;e=new Float32Array(l.length);for(var c=0;c<l.length;++c)e[c]=tn(l[c]);break;case jl.RGBA16F:var _=i.readAttribute(n,Mc.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,m=4*f;e[p]=tn(_[m]),e[p+1]=tn(_[m+1]),e[p+2]=tn(_[m+2])}break;default:return t.EMPTY_GEOMETRIC_INFO}var g=i.readIndices(n)||void 0,v=new hn,y=new hn,T=F_[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 S=0;S<e.length;S+=T)2===T?(v.x=e[S]>v.x?e[S]:v.x,v.y=e[S+1]>v.y?e[S+1]:v.y,y.x=e[S]<y.x?e[S]:y.x,y.y=e[S+1]<y.y?e[S+1]:y.y):(v.x=e[S]>v.x?e[S]:v.x,v.y=e[S+1]>v.y?e[S+1]:v.y,v.z=e[S+2]>v.z?e[S+2]:v.z,y.x=e[S]<y.x?e[S]:y.x,y.y=e[S+1]<y.y?e[S+1]:y.y,y.z=e[S+2]<y.z?e[S+2]:y.z);return this._geometricInfo={positions:e,indices:g,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,a=s.primitives[this.subMeshIdx];if(!s.jointMaps||void 0===a.jointMapIndex||!s.jointMaps[a.jointMapIndex])return this._jointMappedBuffers=this.vertexBuffers;for(var o=v.director.root.device,h=function(){var h=s.vertexBundles[a.vertexBundelIndices[u]];r=0,n=jl.UNKNOWN;for(var l=0;l<h.attributes.length;l++){var c=h.attributes[l];if(c.name===Mc.ATTR_JOINTS){n=c.format;break}r+=F_[c.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[a.jointMapIndex];Nx(d,(function(t){return f.indexOf(t)}),n,r,h.view.length,h.view.stride,d);var p=o.createBuffer(new qc(ql.VERTEX|ql.TRANSFER_DST,Jl.DEVICE,h.view.length,h.view.stride));p.update(d.buffer),e.push(p),i.push(u)}else e.push(t.vertexBuffers[a.vertexBundelIndices[u]])},u=0;u<a.vertexBundelIndices.length;u++)h();return this._vertexIdChannel&&e.push(this._allocVertexIdBuffer(o)),e}},{key:"iaInfo",get:function(){return this._iaInfo}}]),t}());Lx.EMPTY_GEOMETRIC_INFO={positions:new Float32Array,indices:new Uint8Array,boundingBox:{min:hn.ZERO,max:hn.ZERO}};var Fx,kx=t("ds",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=v.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}()),Ux=new Es(0,0,0,.5,.5,.5),Gx=new Es;function Hx(t,e){var i=t.pipelineSceneData,n=i.validPunctualLights;n.length=0;for(var r=yr.create(0,0,0,1),s=e.scene.spotLights,a=0;a<s.length;a++){var o=s[a];o.baked&&!e.node.scene.globals.disableLightmap||(yr.set(r,o.position.x,o.position.y,o.position.z,o.range),us.sphereFrustum(r,e.frustum)&&n.push(o))}for(var h=e.scene.sphereLights,u=0;u<h.length;u++){var l=h[u];l.baked&&!e.node.scene.globals.disableLightmap||(yr.set(r,l.position.x,l.position.y,l.position.z,l.range),us.sphereFrustum(r,e.frustum)&&n.push(l))}for(var c=e.scene.pointLights,_=0;_<c.length;_++){var d=c[_];d.baked||(yr.set(r,d.position.x,d.position.y,d.position.z,d.range),us.sphereFrustum(r,e.frustum)&&n.push(d))}for(var f=e.scene.rangedDirLights,p=0;p<f.length;p++){var m=f[p];Es.transform(Gx,Ux,m.node.getWorldMatrix()),us.aabbFrustum(Gx,e.frustum)&&n.push(m)}i.validPunctualLights=n}!function(t){t[t.NONE=0]="NONE",t[t.FXAA=1]="FXAA",t[t.FXAAHQ=2]="FXAAHQ"}(Fx||(Fx={}));var zx=[];function Vx(t){return zx.includes(t)||zx.push(t),zx.indexOf(t)}function Wx(t,e){var i=dc.CLEAR;return t&xc.COLOR||e!==Sx.RENDER_TARGET||(i=t&Ww?dc.CLEAR:dc.LOAD),(t&xc.DEPTH_STENCIL)!==xc.DEPTH_STENCIL&&e===Sx.DEPTH_STENCIL&&(t&xc.DEPTH||(i=dc.LOAD),t&xc.STENCIL||(i=dc.LOAD)),i}function Xx(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 Fc;var a=t?t.viewport:new Fc(0,0,1,1),o=e,h=i;if(s.x=a.x*o,s.y=a.y*h,s.width=a.width*o,s.height=a.height*h,n)switch(n.type){case hx.DIRECTIONAL:var u=n;if(u.shadowFixedArea||u.csmLevel===BS.LEVEL_1)s.x=0,s.y=0,s.width=o,s.height=h;else{var l=v.director.root.device.capabilities.screenSpaceSignY;s.x=r%2*.5*o,s.y=l>0?.5*(1-Math.floor(r/2))*h:.5*Math.floor(r/2)*h,s.width=.5*o,s.height=.5*h}break;case hx.SPOT:s.x=0,s.y=0,s.width=o,s.height=h}return s}var jx=function(){function t(t){void 0===t&&(t=Fx.NONE),this.antiAliasing=Fx.NONE,this.antiAliasing=t,this._init()}return t.prototype._init=function(){this.postMaterial=new OS,this.postMaterial.name="builtin-post-process-material",this.postMaterial.initialize({effectName:"pipeline/post-process",defines:{ANTIALIAS_TYPE:this.antiAliasing}});for(var t=0;t<this.postMaterial.passes.length;++t)this.postMaterial.passes[t].tryCompile()},t}(),Yx=function(){function t(){this.shadowEnabled=!1,this.mainLightShadowNames=new Array,this.spotLightShadowNames=new Array,this.validLights=[]}return t.prototype.reset=function(){this.shadowEnabled=!1,this.mainLightShadowNames.length=0,this.spotLightShadowNames.length=0,this.validLights.length=0},t}();new Yx;var Kx=function(){function t(t){this.enableCluster=void 0,this.enableCluster=t?1:0,this._init()}return t.prototype._init=function(){this.deferredLightingMaterial=new OS,this.deferredLightingMaterial.name="builtin-deferred-material",this.deferredLightingMaterial.initialize({effectName:"pipeline/deferred-lighting",defines:{CC_ENABLE_CLUSTERED_LIGHT_CULLING:this.enableCluster,CC_RECEIVE_SHADOW:1}});for(var t=0;t<this.deferredLightingMaterial.passes.length;++t)this.deferredLightingMaterial.passes[t].tryCompile()},t}();function qx(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}function Qx(t){for(var e,i=v.director.root.pipeline.layoutGraph,n=i.vertices(),r=i.attributeIndex.get(t),s=d(n);!(e=s()).done;)for(var a,o=e.value,h=d(i.getLayout(o).descriptorSets);!(a=h()).done;){var u=a.value;u[0];for(var l,c=u[1],_=d(c.descriptorSetLayoutData.descriptorBlocks);!(l=_()).done;)for(var f,p=d(l.value.descriptors);!(f=p()).done;)if(f.value.descriptorID===r)return qx(r,c)}return-1}var Zx=new Map;function Jx(t){var e=Zx.get(t);if(e)return e;var i=v.director.root.pipeline,n=i.layoutGraph.locateChild(i.layoutGraph.nullVertex(),t);H(4294967295!==n);var r=i.layoutGraph.getLayout(n).descriptorSets.get(_x.PER_PASS);return Zx.set(t,r),r}var $x=[.0484,.187,.567,1.99,7.41],tI=[.1,.118,.113,.358,.078],eI=new hn,iI=new hn,nI=new nn,rI=new nn;!function(){var t=e.prototype;function e(){this.ssssFov=45/57.3,this.ssssWidth=.01,this.boundingBox=.4,this.ssssScale=3,this._v3SSSSStrength=new hn(.48,.41,.28),this._v3SSSSFallOff=new hn(1,.37,.3),this._kernel=[],this._init()}t._gaussian=function(t,e,i){var n=i/(.001+this._v3SSSSFallOff.x);t.x=Math.exp(-n*n/(2*e))/(6.28*e);var r=i/(.001+this._v3SSSSFallOff.y);t.y=Math.exp(-r*r/(2*e))/(6.28*e);var s=i/(.001+this._v3SSSSFallOff.z);t.z=Math.exp(-s*s/(2*e))/(6.28*e)},t._profile=function(t,e){for(var i=0;i<5;i++)this._gaussian(iI,$x[i],e),iI.multiplyScalar(tI[i]),t.add(iI)},t._updateSampleCount=function(){for(var t=this._v3SSSSStrength,e=0;e<25;e++){var i=.25*e-3,n=i<0?-1:1;this._kernel[e].w=3*n*Math.abs(Math.pow(i,2))/Math.pow(3,2)}for(var r=0;r<25;r++){var s=((r>0?Math.abs(this._kernel[r].w-this._kernel[r-1].w):0)+(r<24?Math.abs(this._kernel[r].w-this._kernel[r+1].w):0))/2;eI.set(0),this._profile(eI,this._kernel[r].w),eI.multiplyScalar(s),this._kernel[r].x=eI.x,this._kernel[r].y=eI.y,this._kernel[r].z=eI.z}nI.set(this._kernel[12]);for(var a=12;a>0;a--)rI.set(this._kernel[a-1]),this._kernel[a].set(rI);this._kernel[0].set(nI),eI.set(0);for(var o=0;o<25;o++)eI.add3f(this._kernel[o].x,this._kernel[o].y,this._kernel[o].z);for(var h=0;h<25;h++)this._kernel[h].x/=eI.x,this._kernel[h].y/=eI.y,this._kernel[h].z/=eI.z;this._kernel[0].x=1*(1-t.x)+t.x*this._kernel[0].x,this._kernel[0].y=1*(1-t.y)+t.y*this._kernel[0].y,this._kernel[0].z=1*(1-t.z)+t.z*this._kernel[0].z;for(var u=1;u<25;u++)this._kernel[u].x*=t.x,this._kernel[u].y*=t.y,this._kernel[u].z*=t.z},t._updateBlurPass=function(){if(this.ssssBlurMaterial){var t=this.ssssBlurMaterial.passes[0];t.beginChangeStatesSilently(),t.tryCompile(),t.endChangeStatesSilently();var e=this.ssssBlurMaterial.passes[1];e.beginChangeStatesSilently(),e.tryCompile(),e.endChangeStatesSilently();var i=this.ssssBlurMaterial.passes[2];i.beginChangeStatesSilently(),i.tryCompile(),i.endChangeStatesSilently()}},t._init=function(){if(!this.ssssBlurMaterial){this.ssssBlurMaterial=new OS,this.ssssBlurMaterial._uuid="builtin-ssssBlur-material",this.ssssBlurMaterial.initialize({effectName:"pipeline/ssss-blur"});for(var t=0;t<this.ssssBlurMaterial.passes.length;++t)this.ssssBlurMaterial.passes[t].tryCompile();this._updateBlurPass();for(var e=0;e<25;e++)this._kernel[e]=new nn;this._updateSampleCount()}},n(e,[{key:"ssssStrength",get:function(){return this._v3SSSSStrength},set:function(t){this._v3SSSSStrength=t,this._updateSampleCount()}},{key:"ssssFallOff",get:function(){return this._v3SSSSFallOff},set:function(t){this._v3SSSSFallOff=t,this._updateSampleCount()}},{key:"kernel",get:function(){return this._kernel}}])}(),function(){var t=e.prototype;function e(){this._uvDepthToEyePosParams=new nn,this._radiusParam=new nn,this._miscParam=new nn,this._blurParam=new nn,this._depthTexFullResolution=new Fn(1024),this._depthTexResolution=new Fn(1024),this._sceneScale=1,this._cameraFov=Mi(45),this._radiusScale=1,this._angleBiasDegree=10,this._aoStrength=1,this._blurSharpness=8,this._aoSaturation=1,this._randomDirAndJitter=[238,91,87,255,251,44,119,255,247,64,250,255,232,5,225,255,253,177,140,255,250,51,84,255,243,76,97,255,252,36,232,255,235,100,24,255,252,36,158,255,254,20,142,255,245,135,124,255,251,43,121,255,253,31,145,255,235,98,160,255,240,146,198,255],this._init(),this.update()}t._init=function(){if(!this.hbaoMaterial){this.hbaoMaterial=new OS,this.hbaoMaterial.name="builtin-hbao-material",this.hbaoMaterial.initialize({effectName:"pipeline/post-process/hbao"});for(var t=0;t<this.hbaoMaterial.passes.length;++t)this.hbaoMaterial.passes[t].tryCompile();for(var e=em.PixelFormat.RGBA8888,i=new Uint8Array(64),n=0;n<this._randomDirAndJitter.length;n++)i[n]=this._randomDirAndJitter[n];var r=new Df({width:4,height:4,_data:i,_compressed:!1,format:e});this.randomTexture=new em,this.randomTexture.setFilters(em.Filter.NEAREST,em.Filter.NEAREST),this.randomTexture.setMipFilter(em.Filter.NONE),this.randomTexture.setWrapMode(em.WrapMode.REPEAT,em.WrapMode.REPEAT,em.WrapMode.REPEAT),this.randomTexture.image=r,this.hbaoMaterial.setProperty("RandomTex",this.randomTexture,0)}},t.update=function(){var t=this._radiusScale*this._sceneScale,e=t*t,i=-1/e,n=.1*Math.min(this._depthTexFullResolution.x,this._depthTexFullResolution.y);this._radiusParam.set(t,e,i,n);var r=new Fn(this._depthTexResolution.y/this._depthTexResolution.x,1),s=new Fn(r.x/Math.tan(.5*this._cameraFov),r.y/Math.tan(.5*this._cameraFov)),a=Math.tan(Mi(this._angleBiasDegree)),o=this._aoStrength;this._miscParam.set(s.x,s.y,a,o);var h=new Fn(2/s.x,-2/s.y),u=new Fn(-1/s.x,1/s.y);this._uvDepthToEyePosParams.set(h.x,h.y,u.x,u.y);var l=this._sceneScale/this._blurSharpness*1.6651092;this._blurParam.set(.11541560320000001,l,this._blurSharpness/8,this._aoSaturation)},n(e,[{key:"uvDepthToEyePosParams",get:function(){return this._uvDepthToEyePosParams}},{key:"radiusParam",get:function(){return this._radiusParam}},{key:"miscParam",get:function(){return this._miscParam}},{key:"blurParam",get:function(){return this._blurParam}},{key:"depthTexFullResolution",set:function(t){this._depthTexFullResolution.set(t)}},{key:"depthTexResolution",set:function(t){this._depthTexResolution.set(t)}},{key:"sceneScale",set:function(t){this._sceneScale=t}},{key:"cameraFov",set:function(t){this._cameraFov=t}},{key:"radiusScale",set:function(t){this._radiusScale=t}},{key:"angleBiasDegree",set:function(t){this._angleBiasDegree=t}},{key:"aoStrength",set:function(t){this._aoStrength=t}},{key:"blurSharpness",set:function(t){this._blurSharpness=t}},{key:"aoSaturation",set:function(t){this._aoSaturation=t}}])}(),new Fn;var sI=function(){var t=e.prototype;function e(){this.clusters_x_threads=16,this.clusters_y_threads=8,this.clusters_z_threads=1,this.dispatchX=1,this.dispatchY=1,this.dispatchZ=1,this._init()}return t._initMaterial=function(t,e){var i=new OS;i.name=t,i.initialize({effectName:e});for(var n=0;n<i.passes.length;++n)i.passes[n].tryCompile();return i},t._init=function(){this.clusterBuildCS=this._initMaterial("builtin-cluster-build-cs-material","pipeline/cluster-build"),this.clusterLightCullingCS=this._initMaterial("builtin-cluster-culling-cs-material","pipeline/cluster-culling"),this.dispatchX=16/this.clusters_x_threads,this.dispatchY=8/this.clusters_y_threads,this.dispatchZ=24/this.clusters_z_threads},e}(),aI=null;function oI(t,e){!function(t,e){Hx(e,t);var i=e.pipelineSceneData,n=80*Hi(Math.max(i.validPunctualLights.length,1)),r=Vx(t),s="clusterLightBuffer"+r,a="globalIndexBuffer"+r,o=e;o.containsResource(a)||o.addStorageBuffer(a,jl.UNKNOWN,4,fx.PERSISTENT),o.containsResource(s)||o.addStorageBuffer(s,jl.UNKNOWN,n,fx.PERSISTENT),o.updateStorageBuffer(s,n);var h=function(t,e,i,n){for(var r,s=new ArrayBuffer(t),a=new Float32Array(s),o=n.pipelineSceneData,h=i.exposure,u=0,l=d(o.validPunctualLights);!(r=l()).done;){var c=r.value,_=20*u,f=_+0,p=_+4,m=_+8,g=_+12,v=_+16,y=0,T=0,S=void 0;if(c.type===hx.POINT){var E=c;S=E.position,T=E.luminanceLDR,y=E.luminanceHDR,a[m]=0,a[m+1]=E.range,a[m+2]=0,a[m+3]=0}else if(c.type===hx.SPHERE){var A=c;S=A.position,T=A.luminanceLDR,y=A.luminanceHDR,a[m]=A.size,a[m+1]=A.range,a[m+2]=0,a[m+3]=0}else if(c.type===hx.SPOT){var R=c;S=R.position,T=R.luminanceLDR,y=R.luminanceHDR,a[m]=R.size,a[m+1]=R.range,a[m+2]=R.spotAngle,a[m+3]=0;var b=R.direction;a[g]=b.x,a[g+1]=b.y,a[g+2]=b.z,a[g+3]=0}else if(c.type===hx.RANGED_DIRECTIONAL){var C=c;S=C.position,T=C.illuminanceLDR,y=C.illuminanceHDR;var w=C.right;a[m]=w.x,a[m+1]=w.y,a[m+2]=w.z,a[m+3]=0;var x=C.direction;a[g]=x.x,a[g+1]=x.y,a[g+2]=x.z,a[g+3]=0;var I=C.scale;a[v]=.5*I.x,a[v+1]=.5*I.y,a[v+2]=.5*I.z,a[v+3]=0}a[f]=S.x,a[f+1]=S.y,a[f+2]=S.z,a[f+3]=c.type;var O=c.color;if(c.useColorTemperature){var D=c.colorTemperatureRGB;a[p]=O.x*D.x,a[p+1]=O.y*D.y,a[p+2]=O.z*D.z}else a[p]=O.x,a[p+1]=O.y,a[p+2]=O.z;a[p+3]=o.isHDR?y*h*1e4:T,u++}return a[15]=o.validPunctualLights.length,s}(n,0,t,e),u=new ArrayBuffer(4);new Uint32Array(u)[0]=0;var l=new Ox(new Uint8Array(h),s),c=new Ox(new Uint8Array(u),a);o.addUploadPass([l,c])}(t,e);var i=e;aI||(aI=new sI),function(t,e,i){var n="clusterBuffer"+Vx(t);i.containsResource(n)||i.addStorageBuffer(n,jl.UNKNOWN,98304,fx.MANAGED),i.updateStorageBuffer(n,98304);var r=i.addComputePass("cluster-build-cs");r.addStorageBuffer(n,Ex.WRITE,"b_clustersBuffer"),r.addQueue().addDispatch(e.dispatchX,e.dispatchY,e.dispatchZ,e.clusterBuildCS,0);var s=t.width*i.pipelineSceneData.shadingScale,a=t.height*i.pipelineSceneData.shadingScale;"setCurrConstant"in r&&r.addConstant("CCConst","cluster-build-cs"),r.setVec4("cc_nearFar",new nn(t.nearClip,t.farClip,t.getClipSpaceMinz(),0)),r.setVec4("cc_viewPort",new nn(0,0,s,a)),r.setVec4("cc_workGroup",new nn(16,8,24,0)),r.setMat4("cc_matView",t.matView),r.setMat4("cc_matProjInv",t.matProjInv)}(t,aI,i),function(t,e,i){var n=Vx(t),r="clusterBuffer"+n,s="clusterLightBuffer"+n,a="globalIndexBuffer"+n,o="clusterLightIndicesBuffer"+n,h="clusterLightGridBuffer"+n;i.containsResource(o)||i.addStorageBuffer(o,jl.UNKNOWN,2457600,fx.MANAGED),i.containsResource(h)||i.addStorageBuffer(h,jl.UNKNOWN,49152,fx.MANAGED);var u=i.addComputePass("cluster-culling-cs");u.addStorageBuffer(s,Ex.READ,"b_ccLightsBuffer"),u.addStorageBuffer(r,Ex.READ,"b_clustersBuffer"),u.addStorageBuffer(o,Ex.WRITE,"b_clusterLightIndicesBuffer"),u.addStorageBuffer(h,Ex.WRITE,"b_clusterLightGridBuffer"),u.addStorageBuffer(a,Ex.WRITE,"b_globalIndexBuffer"),u.addQueue().addDispatch(e.dispatchX,e.dispatchY,e.dispatchZ,e.clusterLightCullingCS,0);var l=t.width*i.pipelineSceneData.shadingScale,c=t.height*i.pipelineSceneData.shadingScale;"setCurrConstant"in u&&u.addConstant("CCConst","cluster-build-cs"),u.setVec4("cc_nearFar",new nn(t.nearClip,t.farClip,t.getClipSpaceMinz(),0)),u.setVec4("cc_viewPort",new nn(l,c,l,c)),u.setVec4("cc_workGroup",new nn(16,8,24,0)),u.setMat4("cc_matView",t.matView),u.setMat4("cc_matProjInv",t.matProjInv)}(t,aI,i)}var hI,uI,lI,cI,_I,dI=new i_(sc.LINEAR,sc.LINEAR,sc.NONE,ac.CLAMP,ac.CLAMP,ac.CLAMP),fI=new i_(sc.POINT,sc.POINT,sc.NONE,ac.CLAMP,ac.CLAMP,ac.CLAMP),pI=function(){function t(t){this._device=void 0,this._descriptorSetMap=new Map,this._globalDescriptorSet=void 0,this._descriptorSetLayout=void 0,this._linearSampler=void 0,this._pointSampler=void 0,this._device=t,this._linearSampler=this._device.getSampler(dI),this._pointSampler=this._device.getSampler(fI);var e=new b_(Ag.bindings);this._descriptorSetLayout=this._device.createDescriptorSetLayout(e),this._globalDescriptorSet=this._device.createDescriptorSet(new C_(this._descriptorSetLayout))}var e=t.prototype;return e.regenLayout=function(){var t=new b_(Ag.bindings);this._descriptorSetLayout=this._device.createDescriptorSetLayout(t),this._globalDescriptorSet=this._device.createDescriptorSet(new C_(this._descriptorSetLayout))},e.bindBuffer=function(t,e){this._globalDescriptorSet.bindBuffer(t,e);for(var i=this._descriptorSetMap.values(),n=i.next();!n.done;)n.value.bindBuffer(t,e),n=i.next()},e.bindSampler=function(t,e){this._globalDescriptorSet.bindSampler(t,e);for(var i=this._descriptorSetMap.values(),n=i.next();!n.done;)n.value.bindSampler(t,e),n=i.next()},e.bindTexture=function(t,e){this._globalDescriptorSet.bindTexture(t,e);for(var i=this._descriptorSetMap.values(),n=i.next();!n.done;)n.value.bindTexture(t,e),n=i.next()},e.update=function(){this._globalDescriptorSet.update();for(var t=this._descriptorSetMap.values(),e=t.next();!e.done;)e.value.update(),e=t.next()},e.getOrCreateDescriptorSet=function(t){var e=this._device;if(!this._descriptorSetMap.has(t)){var i=ny()?Jx("default").descriptorSet:this._globalDescriptorSet,n=e.createDescriptorSet(new C_(ny()?Jx("default").descriptorSetLayout:this._descriptorSetLayout));this._descriptorSetMap.set(t,n);for(var r=Eg.UBO_GLOBAL;r<Eg.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 qc(ql.UNIFORM|ql.TRANSFER_DST,Jl.HOST|Jl.DEVICE,Ng.SIZE,Ng.SIZE)),a=ny()?Qx("CCShadow"):Ng.BINDING;n.bindBuffer(a,s),n.update()}return this._descriptorSetMap.get(t)},e.destroy=function(){this._descriptorSetLayout.destroy()},n(t,[{key:"descriptorSetMap",get:function(){return this._descriptorSetMap}},{key:"linearSampler",get:function(){return this._linearSampler}},{key:"pointSampler",get:function(){return this._pointSampler}},{key:"descriptorSetLayout",get:function(){return this._descriptorSetLayout}},{key:"globalDescriptorSet",get:function(){return this._globalDescriptorSet},set:function(t){this._globalDescriptorSet=t}}]),t}(),mI=new Dn,gI=new Dn,vI=new Dn,yI=new nn,TI=new nn(0,0,1,0),SI=new hn,EI=function(){function t(){this._globalUBO=new Float32Array(Pg.COUNT),this._cameraUBO=new Float32Array(Bg.COUNT),this._shadowUBO=new Float32Array(Ng.COUNT),this._csmUBO=new Float32Array(Lg.COUNT)}t.updateGlobalUBOView=function(t,e){var i=v.director,n=i.root,r=e,s=Math.floor(t.width),a=Math.floor(t.height);r[Pg.TIME_OFFSET]=n.cumulativeTime,r[Pg.TIME_OFFSET+1]=n.frameTime,r[Pg.TIME_OFFSET+2]=i.getTotalFrames(),r[Pg.TIME_OFFSET+3]=n.cumulativeTime-Math.floor(n.frameTime),r[Pg.SCREEN_SIZE_OFFSET]=s,r[Pg.SCREEN_SIZE_OFFSET+1]=a,r[Pg.SCREEN_SIZE_OFFSET+2]=1/s,r[Pg.SCREEN_SIZE_OFFSET+3]=1/a,r[Pg.NATIVE_SIZE_OFFSET]=s,r[Pg.NATIVE_SIZE_OFFSET+1]=a,r[Pg.NATIVE_SIZE_OFFSET+2]=1/r[Pg.NATIVE_SIZE_OFFSET],r[Pg.NATIVE_SIZE_OFFSET+3]=1/r[Pg.NATIVE_SIZE_OFFSET+1],v.internal.reflectionProbeManager&&(r[Pg.PROBE_INFO_OFFSET]=v.internal.reflectionProbeManager.getMaxProbeId()+1);for(var o=n.debugView,h=0;h<=3;h++)r[Pg.DEBUG_VIEW_MODE_OFFSET+h]=0;if(o.isEnabled()){r[Pg.DEBUG_VIEW_MODE_OFFSET]=o.singleMode;for(var u=0;u<17;u++){var l=u%8;r[Pg.DEBUG_VIEW_MODE_OFFSET+1+(u>>3)]+=(o.isCompositeModeEnabled(u)?1:0)*Math.pow(10,l)}r[Pg.DEBUG_VIEW_MODE_OFFSET+3]+=(o.lightingWithAlbedo?1:0)*Math.pow(10,6),r[Pg.DEBUG_VIEW_MODE_OFFSET+3]+=(o.csmLayerColoration?1:0)*Math.pow(10,7)}},t.updateCameraUBOView=function(t,e,i){var n,r=(i.scene?i.scene:v.director.getScene().renderScene).mainLight,s=t.pipelineSceneData,a=s.ambient,o=s.skybox,h=s.fog,u=s.shadows,l=e,c=i.exposure,_=s.isHDR;if(l[Bg.SCREEN_SCALE_OFFSET]=s.shadingScale,l[Bg.SCREEN_SCALE_OFFSET+1]=s.shadingScale,l[Bg.SCREEN_SCALE_OFFSET+2]=1/l[Bg.SCREEN_SCALE_OFFSET],l[Bg.SCREEN_SCALE_OFFSET+3]=1/l[Bg.SCREEN_SCALE_OFFSET+1],l[Bg.EXPOSURE_OFFSET]=c,l[Bg.EXPOSURE_OFFSET+1]=1/c,l[Bg.EXPOSURE_OFFSET+2]=_?1:0,l[Bg.EXPOSURE_OFFSET+3]=1/jw.standardExposureValue,r){var d=r.shadowEnabled&&u.type===MS.ShadowMap?1:0,f=r.direction;if(TI.set(f.x,f.y,f.z,d),nn.toArray(l,TI,Bg.MAIN_LIT_DIR_OFFSET),hn.toArray(l,r.color,Bg.MAIN_LIT_COLOR_OFFSET),r.useColorTemperature){var p=r.colorTemperatureRGB;l[Bg.MAIN_LIT_COLOR_OFFSET]*=p.x,l[Bg.MAIN_LIT_COLOR_OFFSET+1]*=p.y,l[Bg.MAIN_LIT_COLOR_OFFSET+2]*=p.z}l[Bg.MAIN_LIT_COLOR_OFFSET+3]=_?r.illuminance*c:r.illuminance}else TI.set(0,0,1,0),nn.toArray(l,TI,Bg.MAIN_LIT_DIR_OFFSET),nn.toArray(l,nn.ZERO,Bg.MAIN_LIT_COLOR_OFFSET);var m=a.skyColor;m.w=_?a.skyIllum*c:a.skyIllum,l[Bg.AMBIENT_SKY_OFFSET+0]=m.x,l[Bg.AMBIENT_SKY_OFFSET+1]=m.y,l[Bg.AMBIENT_SKY_OFFSET+2]=m.z,l[Bg.AMBIENT_SKY_OFFSET+3]=m.w,l[Bg.AMBIENT_GROUND_OFFSET+0]=a.groundAlbedo.x,l[Bg.AMBIENT_GROUND_OFFSET+1]=a.groundAlbedo.y,l[Bg.AMBIENT_GROUND_OFFSET+2]=a.groundAlbedo.z,l[Bg.AMBIENT_GROUND_OFFSET+3]=o.envmap?null===(n=o.envmap)||void 0===n?void 0:n.mipmapLevel:1,Dn.toArray(l,i.matView,Bg.MAT_VIEW_OFFSET),Dn.toArray(l,i.node.worldMatrix,Bg.MAT_VIEW_INV_OFFSET),hn.toArray(l,i.position,Bg.CAMERA_POS_OFFSET),Dn.toArray(l,i.matProj,Bg.MAT_PROJ_OFFSET),Dn.toArray(l,i.matProjInv,Bg.MAT_PROJ_INV_OFFSET),Dn.toArray(l,i.matViewProj,Bg.MAT_VIEW_PROJ_OFFSET),Dn.toArray(l,i.matViewProjInv,Bg.MAT_VIEW_PROJ_INV_OFFSET),l[Bg.CAMERA_POS_OFFSET+3]=this.getCombineSignY(),l[Bg.SURFACE_TRANSFORM_OFFSET]=i.surfaceTransform,l[Bg.SURFACE_TRANSFORM_OFFSET+1]=i.cameraUsage,l[Bg.SURFACE_TRANSFORM_OFFSET+2]=Math.cos(Mi(s.skybox.getRotationAngle())),l[Bg.SURFACE_TRANSFORM_OFFSET+3]=Math.sin(Mi(s.skybox.getRotationAngle()));var g=h.colorArray;l[Bg.GLOBAL_FOG_COLOR_OFFSET]=g.x,l[Bg.GLOBAL_FOG_COLOR_OFFSET+1]=g.y,l[Bg.GLOBAL_FOG_COLOR_OFFSET+2]=g.z,l[Bg.GLOBAL_FOG_COLOR_OFFSET+3]=g.z,l[Bg.GLOBAL_FOG_BASE_OFFSET]=h.fogStart,l[Bg.GLOBAL_FOG_BASE_OFFSET+1]=h.fogEnd,l[Bg.GLOBAL_FOG_BASE_OFFSET+2]=h.fogDensity,l[Bg.GLOBAL_FOG_ADD_OFFSET]=h.fogTop,l[Bg.GLOBAL_FOG_ADD_OFFSET+1]=h.fogRange,l[Bg.GLOBAL_FOG_ADD_OFFSET+2]=h.fogAtten,l[Bg.NEAR_FAR_OFFSET]=i.nearClip,l[Bg.NEAR_FAR_OFFSET+1]=i.farClip,l[Bg.NEAR_FAR_OFFSET+2]=i.getClipSpaceMinz(),l[Bg.VIEW_PORT_OFFSET]=s.shadingScale*i.window.width*i.viewport.x,l[Bg.VIEW_PORT_OFFSET+1]=s.shadingScale*i.window.height*i.viewport.y,l[Bg.VIEW_PORT_OFFSET+2]=s.shadingScale*i.window.width*i.viewport.z,l[Bg.VIEW_PORT_OFFSET+3]=s.shadingScale*i.window.height*i.viewport.w},t.getPCFRadius=function(t,e){var i=t.size.x;switch(e.shadowPcf){case PS.HARD:return 0;case PS.SOFT:return 1/(.5*i);case PS.SOFT_2X:return 2/(.5*i);case PS.SOFT_4X:return 3/(.5*i)}return 0},t.updatePlanarNormalAndDistance=function(t,e){hn.normalize(SI,t.normal),e[Ng.PLANAR_NORMAL_DISTANCE_INFO_OFFSET+0]=SI.x,e[Ng.PLANAR_NORMAL_DISTANCE_INFO_OFFSET+1]=SI.y,e[Ng.PLANAR_NORMAL_DISTANCE_INFO_OFFSET+2]=SI.z,e[Ng.PLANAR_NORMAL_DISTANCE_INFO_OFFSET+3]=-t.distance},t.updateShadowUBOView=function(e,i,n,r){var s=e.device,a=r.scene.mainLight,o=e.pipelineSceneData,h=o.shadows,u=o.csmLayers,l=i,c=n,_=o.csmSupported,d=ey(s)?0:1;if(a&&h.enabled){if(h.type===MS.ShadowMap){if(a.shadowEnabled){if(a.shadowFixedArea||a.csmLevel===BS.LEVEL_1||!_){var f=u.specialLayer.matShadowView,p=u.specialLayer.matShadowProj,m=u.specialLayer.matShadowViewProj,g=.1,v=0,y=0;a.shadowFixedArea?(g=a.shadowNear,v=a.shadowFar,y=0):(v=u.specialLayer.shadowCameraFar,y=1),Dn.toArray(l,f,Ng.MAT_LIGHT_VIEW_OFFSET),l[Ng.SHADOW_PROJ_DEPTH_INFO_OFFSET+0]=p.m10,l[Ng.SHADOW_PROJ_DEPTH_INFO_OFFSET+1]=p.m14,l[Ng.SHADOW_PROJ_DEPTH_INFO_OFFSET+2]=p.m11,l[Ng.SHADOW_PROJ_DEPTH_INFO_OFFSET+3]=p.m15,l[Ng.SHADOW_PROJ_INFO_OFFSET+0]=p.m00,l[Ng.SHADOW_PROJ_INFO_OFFSET+1]=p.m05,l[Ng.SHADOW_PROJ_INFO_OFFSET+2]=1/p.m00,l[Ng.SHADOW_PROJ_INFO_OFFSET+3]=1/p.m05,Dn.toArray(l,m,Ng.MAT_LIGHT_VIEW_PROJ_OFFSET),yI.set(g,v,0,1-a.shadowSaturation),nn.toArray(l,yI,Ng.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET),yI.set(hx.DIRECTIONAL,d,a.shadowNormalBias,y),nn.toArray(l,yI,Ng.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET)}else{for(var T=this.getPCFRadius(h,a),S=0;S<a.csmLevel;S++){var E=u.layers[S],A=E.matShadowView;yI.set(A.m00,A.m04,A.m08,T),nn.toArray(c,yI,Lg.CSM_VIEW_DIR_0_OFFSET+4*S),yI.set(A.m01,A.m05,A.m09,E.splitCameraNear),nn.toArray(c,yI,Lg.CSM_VIEW_DIR_1_OFFSET+4*S),yI.set(A.m02,A.m06,A.m10,E.splitCameraFar),nn.toArray(c,yI,Lg.CSM_VIEW_DIR_2_OFFSET+4*S);var R=E.csmAtlas;nn.toArray(c,R,Lg.CSM_ATLAS_OFFSET+4*S);var b=E.matShadowViewProj;Dn.toArray(c,b,Lg.MAT_CSM_VIEW_PROJ_OFFSET+16*S);var C=E.matShadowProj;c[Lg.CSM_PROJ_DEPTH_INFO_OFFSET+0+4*S]=C.m10,c[Lg.CSM_PROJ_DEPTH_INFO_OFFSET+1+4*S]=C.m14,c[Lg.CSM_PROJ_DEPTH_INFO_OFFSET+2+4*S]=C.m11,c[Lg.CSM_PROJ_DEPTH_INFO_OFFSET+3+4*S]=C.m15,c[Lg.CSM_PROJ_INFO_OFFSET+0+4*S]=C.m00,c[Lg.CSM_PROJ_INFO_OFFSET+1+4*S]=C.m05,c[Lg.CSM_PROJ_INFO_OFFSET+2+4*S]=1/C.m00,c[Lg.CSM_PROJ_INFO_OFFSET+3+4*S]=1/C.m05}yI.set(a.csmTransitionRange,0,0,0),nn.toArray(c,yI,Lg.CSM_SPLITS_INFO_OFFSET),yI.set(.1,a.shadowDistance,0,1-a.shadowSaturation),nn.toArray(l,yI,Ng.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET),yI.set(hx.DIRECTIONAL,d,a.shadowNormalBias,a.csmLevel),nn.toArray(l,yI,Ng.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET)}yI.set(h.size.x,h.size.y,a.shadowPcf,a.shadowBias),nn.toArray(l,yI,Ng.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET)}}else t.updatePlanarNormalAndDistance(h,l),yI.set(0,0,0,h.planeBias),nn.toArray(l,yI,Ng.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET);pn.toArray(l,h.shadowColor,Ng.SHADOW_COLOR_OFFSET)}},t.updateShadowUBOLightView=function(t,e,i,n){var r=t.device,s=t.pipelineSceneData,a=s.shadows,o=s.csmLayers,h=e,u=ey(r)?0:1,l=t.device.capabilities,c=s.csmSupported;switch(i.type){case hx.DIRECTIONAL:var _=i;if(a.enabled&&_&&_.shadowEnabled&&a.type===MS.ShadowMap){var d,f,p,m=.1,g=0,v=0;if(_.shadowFixedArea||_.csmLevel===BS.LEVEL_1||!c)d=o.specialLayer.matShadowView,f=o.specialLayer.matShadowProj,p=o.specialLayer.matShadowViewProj,_.shadowFixedArea?(m=_.shadowNear,g=_.shadowFar,v=0):(m=.1,g=o.specialLayer.shadowCameraFar,v=1),yI.set(hx.DIRECTIONAL,u,_.shadowNormalBias,0),nn.toArray(h,yI,Ng.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET);else{var y=o.layers[n];d=y.matShadowView,f=y.matShadowProj,p=y.matShadowViewProj,m=y.splitCameraNear,g=y.splitCameraFar,v=_.csmLevel}Dn.toArray(h,d,Ng.MAT_LIGHT_VIEW_OFFSET),h[Ng.SHADOW_PROJ_DEPTH_INFO_OFFSET+0]=f.m10,h[Ng.SHADOW_PROJ_DEPTH_INFO_OFFSET+1]=f.m14,h[Ng.SHADOW_PROJ_DEPTH_INFO_OFFSET+2]=f.m11,h[Ng.SHADOW_PROJ_DEPTH_INFO_OFFSET+3]=f.m15,h[Ng.SHADOW_PROJ_INFO_OFFSET+0]=f.m00,h[Ng.SHADOW_PROJ_INFO_OFFSET+1]=f.m05,h[Ng.SHADOW_PROJ_INFO_OFFSET+2]=1/f.m00,h[Ng.SHADOW_PROJ_INFO_OFFSET+3]=1/f.m05,Dn.toArray(h,p,Ng.MAT_LIGHT_VIEW_PROJ_OFFSET),yI.set(m,g,0,1-_.shadowSaturation),nn.toArray(h,yI,Ng.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET),yI.set(hx.DIRECTIONAL,u,_.shadowNormalBias,v),nn.toArray(h,yI,Ng.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET),yI.set(a.size.x,a.size.y,_.shadowPcf,_.shadowBias),nn.toArray(h,yI,Ng.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET)}break;case hx.SPOT:var T=i;a.enabled&&T&&T.shadowEnabled&&(Dn.invert(mI,i.node.getWorldMatrix()),Dn.toArray(h,mI,Ng.MAT_LIGHT_VIEW_OFFSET),Dn.perspective(gI,T.angle,1,.001,T.range,!0,l.clipSpaceMinZ,l.clipSpaceSignY,0),Dn.multiply(vI,gI,mI),Dn.toArray(h,vI,Ng.MAT_LIGHT_VIEW_PROJ_OFFSET),yI.set(.01,i.range,0,0),nn.toArray(h,yI,Ng.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET),yI.set(a.size.x,a.size.y,T.shadowPcf,T.shadowBias),nn.toArray(h,yI,Ng.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET),yI.set(hx.SPOT,u,T.shadowNormalBias,0),nn.toArray(h,yI,Ng.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET))}pn.toArray(h,a.shadowColor,Ng.SHADOW_COLOR_OFFSET)},t.getCombineSignY=function(){return t._combineSignY};var e=t.prototype;return e._initCombineSignY=function(){var e=this._device;t._combineSignY=.5*e.capabilities.screenSpaceSignY+.5<<1|.5*e.capabilities.clipSpaceSignY+.5},e.activate=function(t,e){this._device=t,this._pipeline=e;var i=this._pipeline.descriptorSet;if(!ny()){this._initCombineSignY();var n=t.createBuffer(new qc(ql.UNIFORM|ql.TRANSFER_DST,Jl.HOST|Jl.DEVICE,Pg.SIZE,Pg.SIZE));i.bindBuffer(Pg.BINDING,n);var r=t.createBuffer(new qc(ql.UNIFORM|ql.TRANSFER_DST,Jl.HOST|Jl.DEVICE,Bg.SIZE,Bg.SIZE));i.bindBuffer(Bg.BINDING,r);var s=t.createBuffer(new qc(ql.UNIFORM|ql.TRANSFER_DST,Jl.HOST|Jl.DEVICE,Ng.SIZE,Ng.SIZE)),a=ny()?Qx("CCShadow"):Ng.BINDING;i.bindBuffer(a,s);var o=t.createBuffer(new qc(ql.UNIFORM|ql.TRANSFER_DST,Jl.HOST|Jl.DEVICE,Lg.SIZE,Lg.SIZE)),h=ny()?Qx("CCCSM"):Lg.BINDING;i.bindBuffer(h,o)}},e.updateGlobalUBO=function(e){var i=this._pipeline.globalDSManager,n=this._pipeline.descriptorSet,r=this._pipeline.commandBuffers;n.update(),t.updateGlobalUBOView(e,this._globalUBO),r[0].updateBuffer(n.getBuffer(Pg.BINDING),this._globalUBO),i.bindBuffer(Pg.BINDING,n.getBuffer(Pg.BINDING)),i.update()},e.updateCameraUBO=function(e){var i=this._pipeline.globalDSManager,n=this._pipeline.descriptorSet,r=this._pipeline.commandBuffers;t.updateCameraUBOView(this._pipeline,this._cameraUBO,e),r[0].updateBuffer(n.getBuffer(Bg.BINDING),this._cameraUBO),i.bindBuffer(Bg.BINDING,n.getBuffer(Bg.BINDING)),i.update()},e.updateShadowUBO=function(e){var i=this._pipeline.pipelineSceneData;if(i.shadows.enabled){var n=this._pipeline.descriptorSet,r=this._pipeline.commandBuffers,s=i.shadowFrameBufferMap,a=e.scene.mainLight;a&&s.has(a)&&n.bindTexture(Fg,s.get(a).colorTextures[0]),t.updateShadowUBOView(this._pipeline,this._shadowUBO,this._csmUBO,e),n.update();var o=ny()?Qx("CCShadow"):Ng.BINDING;r[0].updateBuffer(n.getBuffer(o),this._shadowUBO);var h=ny()?Qx("CCCSM"):Lg.BINDING;r[0].updateBuffer(n.getBuffer(h),this._csmUBO)}},e.updateShadowUBOLight=function(e,i,n){void 0===n&&(n=0),t.updateShadowUBOLightView(this._pipeline,this._shadowUBO,i,n),e.bindTexture(Fg,aS.get("default-texture").getGFXTexture()),e.bindTexture(jg,aS.get("default-texture").getGFXTexture()),e.update();var r=ny()?Qx("CCShadow"):Ng.BINDING;this._pipeline.commandBuffers[0].updateBuffer(e.getBuffer(r),this._shadowUBO)},e.updateShadowUBORange=function(t,e){e instanceof Dn?Dn.toArray(this._shadowUBO,e,t):e instanceof pn&&pn.toArray(this._shadowUBO,e,t)},e.destroy=function(){},t}();EI._combineSignY=0;var AI,RI,bI,CI,wI,xI,II,OI,DI=t("d9",qs("RenderStage")((uI=function(){function t(){this._name=lI&&lI(),this._priority=cI&&cI(),this._enabled=!0,this._tag=_I&&_I(),this._pipeline=void 0,this._flow=void 0}var e=t.prototype;return e.initialize=function(t){return this._name=t.name,this._priority=t.priority,t.tag&&(this._tag=t.tag),!0},e.activate=function(t,e){this._pipeline=t,this._flow=e},n(t,[{key:"name",get:function(){return this._name}},{key:"priority",get:function(){return this._priority}},{key:"tag",get:function(){return this._tag}},{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled=t}}]),t}(),lI=Gs(uI.prototype,"_name",[ra],(function(){return""})),cI=Gs(uI.prototype,"_priority",[ra],(function(){return 0})),_I=Gs(uI.prototype,"_tag",[ra],(function(){return 0})),hI=uI))||hI);v.RenderStage=DI;var MI,PI=t("d8",(AI=qs("RenderFlow"),RI=xa([DI]),AI((CI=function(){function t(){this._name=wI&&wI(),this._priority=xI&&xI(),this._tag=II&&II(),this._stages=OI&&OI(),this._pipeline=void 0}var e=t.prototype;return e.initialize=function(t){return this._name=t.name,this._priority=t.priority,this._stages=t.stages,t.tag&&(this._tag=t.tag),!0},e.activate=function(t){this._pipeline=t,this._stages.sort((function(t,e){return t.priority-e.priority}));for(var e=0,i=this._stages.length;e<i;e++)this._stages[e].activate(t,this)},e.render=function(t){for(var e=0,i=this._stages.length;e<i;e++)this._stages[e].enabled&&this._stages[e].render(t)},e.destroy=function(){for(var t=0,e=this._stages.length;t<e;t++)this._stages[t].destroy();this._stages.length=0},n(t,[{key:"name",get:function(){return this._name}},{key:"priority",get:function(){return this._priority}},{key:"tag",get:function(){return this._tag}},{key:"stages",get:function(){return this._stages}},{key:"pipeline",get:function(){return this._pipeline}}]),t}(),wI=Gs(CI.prototype,"_name",[ra],(function(){return""})),xI=Gs(CI.prototype,"_priority",[ra],(function(){return 0})),II=Gs(CI.prototype,"_tag",[ra],(function(){return 0})),OI=Gs(CI.prototype,"_stages",[RI,ra],(function(){return[]})),bI=CI))||bI));v.RenderFlow=PI,t("dr",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("dr",MI={}));var BI,NI,LI,FI,kI,UI,GI,HI,zI,VI,WI,XI,jI,YI,KI,qI,QI,ZI,JI,$I,tO,eO,iO,nO,rO,sO,aO,oO,hO,uO,lO,cO,_O,dO,fO,pO,mO,gO,vO,yO,TO,SO,EO,AO,RO,bO,CO,wO,xO,IO,OO,DO,MO,PO,BO,NO,LO,FO,kO,UO,GO,HO,zO,VO,WO,XO,jO,YO,KO,qO,QO,ZO,JO,$O,tD,eD,iD,nD,rD,sD,aD,oD,hD,uD,lD,cD,_D,dD,fD,pD,mD=t("dq",function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).eventTargetOn=t.prototype.on,e.eventTargetOnce=t.prototype.once,e}s(e,t);var i=e.prototype;return i.on=function(t,e,i,n){return this.eventTargetOn(t,e,i,n)},i.once=function(t,e,i){return this.eventTargetOnce(t,e,i)},e}(Ju)),gD=new Fc,vD=new Wc,yD=function(){this.renderPass=null,this.sampler=null,this.prefiterTex=null,this.downsampleTexs=[],this.upsampleTexs=[],this.combineTex=null,this.prefilterFramebuffer=null,this.downsampleFramebuffers=[],this.upsampleFramebuffers=[],this.combineFramebuffer=null},TD=function(){this.quadIB=null,this.quadVB=null,this.quadIA=null},SD=t("d7",(BI=qs("cc.RenderPipeline"),NI=xa([PI]),BI((FI=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._tag=kI&&kI(),e._flows=UI&&UI(),e._quadIB=null,e._quadVBOnscreen=null,e._quadVBOffscreen=null,e._quadIAOnscreen=null,e._quadIAOffscreen=null,e._eventProcessor=new mD,e._device=void 0,e._globalDSManager=void 0,e._descriptorSet=void 0,e._commandBuffers=[],e._pipelineUBO=new EI,e._macros={},e._constantMacros="",e._profiler=null,e._geometryRenderer=null,e._pipelineRenderData=null,e._renderPasses=new Map,e._width=0,e._height=0,e._lastUsedRenderArea=new Fc,e._clusterEnabled=!1,e._bloomEnabled=!1,e}s(e,t);var i=e.prototype;return i.getPipelineRenderData=function(){return this._pipelineRenderData},i.initialize=function(t){return this._flows=t.flows,t.tag&&(this._tag=t.tag),!0},i.createRenderPass=function(t,e,i){var n=this._device,r=new p_,s=new m_;r.format=e,s.format=i,s.stencilStoreOp=fc.DISCARD,s.depthStoreOp=fc.DISCARD,t&xc.COLOR||(t&Ww?r.loadOp=dc.CLEAR:(r.loadOp=dc.LOAD,r.barrier=n.getGeneralBarrier(new T_(pc.COLOR_ATTACHMENT_WRITE,pc.COLOR_ATTACHMENT_WRITE)))),(t&xc.DEPTH_STENCIL)!==xc.DEPTH_STENCIL&&(t&xc.DEPTH||(s.depthLoadOp=dc.LOAD),t&xc.STENCIL||(s.stencilLoadOp=dc.LOAD)),s.barrier=n.getGeneralBarrier(new T_(pc.DEPTH_STENCIL_ATTACHMENT_WRITE,pc.DEPTH_STENCIL_ATTACHMENT_WRITE));var a=new y_([r],s);return n.createRenderPass(a)},i.getRenderPass=function(t,e){var i=function(t){for(var e,i=666,n=d(t.colorTextures);!(e=n()).done;){var r=e.value,s=null==r?void 0:r.info;i=Bl(s.type+"_"+s.usage+"_"+s.format+"_"+s.width+"_"+s.height+"_"+s.flags+"_\n "+s.layerCount+"_"+s.levelCount+"_"+s.samples+"_"+s.depth+"_"+s.externalRes,i)}if(t.depthStencilTexture){var a=t.depthStencilTexture.info;i=Bl(a.type+"_"+a.usage+"_"+a.format+"_"+a.width+"_"+a.height+"_"+a.flags+"_\n "+a.layerCount+"_"+a.levelCount+"_"+a.samples+"_"+a.depth+"_"+a.externalRes,i)}return i}(e),n=Bl(i+"_"+t,666),r=this._renderPasses.get(n);return r||(r=this.createRenderPass(t,e.colorTextures[0].format,e.depthStencilTexture.format),this._renderPasses.set(n,r),r)},i.newFramebufferByRatio=function(t){for(var e=this.pipelineSceneData,i=this._width*e.shadingScale,n=this._height*e.shadingScale,r=t.colorTextures,s=0;s<r.length;s++)r[s].resize(i,n);t.depthStencilTexture&&t.depthStencilTexture.resize(i,n);var a=this._device.createFramebuffer(new A_(t.renderPass,r,t.depthStencilTexture));return t.destroy(),a},i.generateRenderArea=function(t,e){var i=t.viewport,n=t.window.width,r=t.window.height;e.x=i.x*n,e.y=i.y*r,e.width=i.width*n,e.height=i.height*r},i.generateViewport=function(t,e){this.generateRenderArea(t,gD),e||(e=vD);var i=this.pipelineSceneData.shadingScale;return e.left=gD.x*i,e.top=gD.y*i,e.width=gD.width*i,e.height=gD.height*i,e},i.generateScissor=function(t,e){e||(e=gD),this.generateRenderArea(t,e);var i=this.pipelineSceneData.shadingScale;return e.x*=i,e.y*=i,e.width*=i,e.height*=i,e},i.getMacroString=function(t){var e=this._macros[t];return void 0===e?"":e},i.getMacroInt=function(t){var e=this._macros[t];return void 0===e?0:e},i.getMacroBool=function(t){var e=this._macros[t];return void 0!==e&&e},i.setMacroString=function(t,e){this._macros[t]=e},i.setMacroInt=function(t,e){this._macros[t]=e},i.setMacroBool=function(t,e){this._macros[t]=e},i.activate=function(){this._device=wd.gfxDevice,this._generateConstantMacros(),this._globalDSManager=new pI(this._device),this._descriptorSet=this._globalDSManager.globalDescriptorSet,this._pipelineUBO.activate(this._device,this),this._macros.CC_USE_HDR=this._pipelineSceneData.isHDR,this._macros.CC_USE_DEBUG_VIEW=0,this._generateConstantMacros(),this._pipelineSceneData.activate(this._device);for(var t=0;t<this._flows.length;t++)this._flows[t].activate(this);return!0},i._ensureEnoughSize=function(){},i.render=function(t){if(0!==t.length){this.updateGeometryRenderer(t),this._commandBuffers[0].begin(),this.emit(MI.RENDER_FRAME_BEGIN,t),this._ensureEnoughSize(t),function(t){for(var e=t.length-1;e>=0;--e){var i=t[e];if(i.window.swapchain)return void(CS=i)}CS=null}(t);for(var e=0;e<t.length;e++){var i=t[e];if(i.scene){this.emit(MI.RENDER_CAMERA_BEGIN,i),$w(this,i),tx(this,i),this._pipelineUBO.updateGlobalUBO(i.window),this._pipelineUBO.updateCameraUBO(i);for(var n=0;n<this._flows.length;n++)this._flows[n].render(i);this.emit(MI.RENDER_CAMERA_END,i)}}this.emit(MI.RENDER_FRAME_END,t),this._commandBuffers[0].end(),this._device.queue.submit(this._commandBuffers)}},i._destroyQuadInputAssembler=function(){this._quadIB&&(this._quadIB.destroy(),this._quadIB=null),this._quadVBOnscreen&&(this._quadVBOnscreen.destroy(),this._quadVBOnscreen=null),this._quadVBOffscreen&&(this._quadVBOffscreen.destroy(),this._quadVBOffscreen=null),this._quadIAOnscreen&&(this._quadIAOnscreen.destroy(),this._quadIAOnscreen=null),this._quadIAOffscreen&&(this._quadIAOffscreen.destroy(),this._quadIAOffscreen=null)},i._destroyBloomData=function(){var t,e=this._pipelineRenderData.bloom;if(null!==e){e.prefiterTex&&e.prefiterTex.destroy(),e.prefilterFramebuffer&&e.prefilterFramebuffer.destroy();for(var i=0;i<e.downsampleTexs.length;++i)e.downsampleTexs[i].destroy(),e.downsampleFramebuffers[i].destroy();e.downsampleTexs.length=0,e.downsampleFramebuffers.length=0;for(var n=0;n<e.upsampleTexs.length;++n)e.upsampleTexs[n].destroy(),e.upsampleFramebuffers[n].destroy();e.upsampleTexs.length=0,e.upsampleFramebuffers.length=0,e.combineTex&&e.combineTex.destroy(),e.combineFramebuffer&&e.combineFramebuffer.destroy(),null===(t=e.renderPass)||void 0===t||t.destroy(),this._pipelineRenderData.bloom=null}},i._genQuadVertexData=function(t,e){var i=new Float32Array(16),n=e.x/this._width,r=(e.x+e.width)/this._width,s=e.y/this._height,a=(e.y+e.height)/this._height;if(this.device.capabilities.screenSpaceSignY>0){var o=a;a=s,s=o}var h=0;switch(t){case Wl.IDENTITY:h=0,i[h++]=-1,i[h++]=-1,i[h++]=n,i[h++]=a,i[h++]=1,i[h++]=-1,i[h++]=r,i[h++]=a,i[h++]=-1,i[h++]=1,i[h++]=n,i[h++]=s,i[h++]=1,i[h++]=1,i[h++]=r,i[h++]=s;break;case Wl.ROTATE_90:h=0,i[h++]=-1,i[h++]=-1,i[h++]=r,i[h++]=a,i[h++]=1,i[h++]=-1,i[h++]=r,i[h++]=s,i[h++]=-1,i[h++]=1,i[h++]=n,i[h++]=a,i[h++]=1,i[h++]=1,i[h++]=n,i[h++]=s;break;case Wl.ROTATE_180:h=0,i[h++]=-1,i[h++]=-1,i[h++]=n,i[h++]=s,i[h++]=1,i[h++]=-1,i[h++]=r,i[h++]=s,i[h++]=-1,i[h++]=1,i[h++]=n,i[h++]=a,i[h++]=1,i[h++]=1,i[h++]=r,i[h++]=a;break;case Wl.ROTATE_270:h=0,i[h++]=-1,i[h++]=-1,i[h++]=n,i[h++]=s,i[h++]=1,i[h++]=-1,i[h++]=n,i[h++]=a,i[h++]=-1,i[h++]=1,i[h++]=r,i[h++]=s,i[h++]=1,i[h++]=1,i[h++]=r,i[h++]=a}return i},i._createQuadInputAssembler=function(){var t=new TD,e=4*Float32Array.BYTES_PER_ELEMENT,i=4*e,n=this._device.createBuffer(new qc(ql.VERTEX|ql.TRANSFER_DST,Jl.DEVICE|Jl.HOST,i,e));if(!n)return t;var r=Uint8Array.BYTES_PER_ELEMENT,s=6*r,a=this._device.createBuffer(new qc(ql.INDEX|ql.TRANSFER_DST,Jl.DEVICE,s,r));if(!a)return t;var o=new Uint8Array(6);o[0]=0,o[1]=1,o[2]=2,o[3]=1,o[4]=3,o[5]=2,a.update(o);var h=new Array(2);h[0]=new __("a_position",jl.RG32F),h[1]=new __("a_texCoord",jl.RG32F);var u=this._device.createInputAssembler(new f_(h,[n],a));return t.quadIB=a,t.quadVB=n,t.quadIA=u,t},i.updateQuadVertexData=function(t,e){var i=this._lastUsedRenderArea;if(i.x!==t.x||i.y!==t.y||i.width!==t.width||i.height!==t.height){var n=this._genQuadVertexData(Wl.IDENTITY,t);this._quadVBOffscreen.update(n);var r=this._genQuadVertexData(e.swapchain&&e.swapchain.surfaceTransform||Wl.IDENTITY,t);this._quadVBOnscreen.update(r),i.copy(t)}},i.destroy=function(){for(var e,i,n=0;n<this._flows.length;n++)this._flows[n].destroy();this._flows.length=0,this._descriptorSet&&this._descriptorSet.destroy(),null===(e=this._globalDSManager)||void 0===e||e.destroy();for(var r=0;r<this._commandBuffers.length;r++)this._commandBuffers[r].destroy();return this._commandBuffers.length=0,this._pipelineUBO.destroy(),null===(i=this._pipelineSceneData)||void 0===i||i.destroy(),t.prototype.destroy.call(this)},i.onGlobalPipelineStateChanged=function(){},i._generateConstantMacros=function(){var t="";t+="#define CC_DEVICE_SUPPORT_FLOAT_TEXTURE "+(this.device.getFormatFeatures(jl.RGBA32F)&(ic.RENDER_TARGET|ic.SAMPLED_TEXTURE)?1:0)+"\n",t+="#define CC_ENABLE_CLUSTERED_LIGHT_CULLING "+(this._clusterEnabled?1:0)+"\n",t+="#define CC_DEVICE_MAX_VERTEX_UNIFORM_VECTORS "+this.device.capabilities.maxVertexUniformVectors+"\n",t+="#define CC_DEVICE_MAX_FRAGMENT_UNIFORM_VECTORS "+this.device.capabilities.maxFragmentUniformVectors+"\n",t+="#define CC_DEVICE_CAN_BENEFIT_FROM_INPUT_ATTACHMENT "+(this.device.hasFeature(Xl.INPUT_ATTACHMENT_BENEFIT)?1:0)+"\n",t+="#define CC_PLATFORM_ANDROID_AND_WEBGL "+(al.os===il.ANDROID&&al.isBrowser?1:0)+"\n",t+="#define CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES "+(Ce.ENABLE_WEBGL_HIGHP_STRUCT_VALUES?1:0)+"\n",t+="#define CC_JOINT_UNIFORM_CAPACITY "+sv.JOINT_UNIFORM_CAPACITY+"\n",this._constantMacros=t},i.updateGeometryRenderer=function(t){if(!this._geometryRenderer)for(var e=0;e<t.length;e++){var i=t[e];if(i&&i.window&&i.window.swapchain)return i.initGeometryRenderer(),void(this._geometryRenderer=i.geometryRenderer)}},i.generateBloomRenderData=function(){if(null==this._pipelineRenderData.bloom){var t=this._pipelineRenderData.bloom=new yD,e=this.device,i=new p_;i.format=jl.RGBA8,i.loadOp=dc.CLEAR,i.storeOp=fc.STORE,i.barrier=e.getGeneralBarrier(new T_(pc.NONE,pc.COLOR_ATTACHMENT_WRITE)),t.renderPass=e.createRenderPass(new y_([i]));var n=this._width,r=this._height;t.prefiterTex=e.createTexture(new t_($l.TEX2D,tc.COLOR_ATTACHMENT|tc.SAMPLED,jl.RGBA8,n>>1,r>>1)),t.prefilterFramebuffer=e.createFramebuffer(new A_(t.renderPass,[t.prefiterTex])),n>>=1,r>>=1;for(var s=0;s<6;++s)t.downsampleTexs.push(e.createTexture(new t_($l.TEX2D,tc.COLOR_ATTACHMENT|tc.SAMPLED,jl.RGBA8,n>>1,r>>1))),t.downsampleFramebuffers[s]=e.createFramebuffer(new A_(t.renderPass,[t.downsampleTexs[s]])),t.upsampleTexs.push(e.createTexture(new t_($l.TEX2D,tc.COLOR_ATTACHMENT|tc.SAMPLED,jl.RGBA8,n,r))),t.upsampleFramebuffers[s]=e.createFramebuffer(new A_(t.renderPass,[t.upsampleTexs[s]])),n>>=1,r>>=1;t.combineTex=e.createTexture(new t_($l.TEX2D,tc.COLOR_ATTACHMENT|tc.SAMPLED,jl.RGBA8,this._width,this._height)),t.combineFramebuffer=e.createFramebuffer(new A_(t.renderPass,[t.combineTex])),t.sampler=this.globalDSManager.linearSampler}},i.on=function(t,e,i,n){return this._eventProcessor.on(t,e,i,n)},i.once=function(t,e,i){return this._eventProcessor.once(t,e,i)},i.off=function(t,e,i){this._eventProcessor.off(t,e,i)},i.emit=function(t,e,i,n,r,s){this._eventProcessor.emit(t,e,i,n,r,s)},i.targetOff=function(t){this._eventProcessor.targetOff(t)},i.removeAll=function(t){this._eventProcessor.removeAll(t)},i.hasEventListener=function(t,e,i){return this._eventProcessor.hasEventListener(t,e,i)},n(e,[{key:"tag",get:function(){return this._tag}},{key:"flows",get:function(){return this._flows}},{key:"quadIAOnscreen",get:function(){return this._quadIAOnscreen}},{key:"quadIAOffscreen",get:function(){return this._quadIAOffscreen}},{key:"constantMacros",get:function(){return this._constantMacros}},{key:"macros",get:function(){return this._macros}},{key:"device",get:function(){return this._device}},{key:"globalDSManager",get:function(){return this._globalDSManager}},{key:"descriptorSetLayout",get:function(){return this._globalDSManager.descriptorSetLayout}},{key:"descriptorSet",get:function(){return this._descriptorSet}},{key:"commandBuffers",get:function(){return this._commandBuffers}},{key:"pipelineUBO",get:function(){return this._pipelineUBO}},{key:"pipelineSceneData",get:function(){return this._pipelineSceneData}},{key:"profiler",get:function(){return this._profiler},set:function(t){this._profiler=t}},{key:"geometryRenderer",get:function(){return this._geometryRenderer}},{key:"clusterEnabled",get:function(){return this._clusterEnabled},set:function(t){this._clusterEnabled=t}},{key:"bloomEnabled",get:function(){return this._bloomEnabled},set:function(t){this._bloomEnabled=t}},{key:"shadingScale",get:function(){return this._pipelineSceneData.shadingScale},set:function(t){this._pipelineSceneData.shadingScale!==t&&(this._pipelineSceneData.shadingScale=t,this.emit(MI.ATTACHMENT_SCALE_CAHNGED,t))}}]),e}(uf),kI=Gs(FI.prototype,"_tag",[ra],(function(){return 0})),UI=Gs(FI.prototype,"_flows",[NI,ra],(function(){return[]})),LI=FI))||LI));v.RenderPipeline=SD,function(t){t[t.BLOOM=18]="BLOOM",t[t.POST_PROCESS=19]="POST_PROCESS",t[t.UI=20]="UI"}(GI||(GI={})),function(t){t[t.AR=5]="AR",t[t.FORWARD=10]="FORWARD"}(HI||(HI={})),function(t){t[t.SHADOW=0]="SHADOW",t[t.FORWARD=1]="FORWARD",t[t.UI=10]="UI"}(zI||(zI={})),function(t){t[t.GBUFFER=10]="GBUFFER",t[t.LIGHTING=15]="LIGHTING",t[t.TRANSPARENT=18]="TRANSPARENT"}(VI||(VI={})),function(t){t[t.SHADOW=0]="SHADOW",t[t.MAIN=1]="MAIN",t[t.UI=10]="UI"}(WI||(WI={})),Se($l),Se(tc),Se(fc),Se(dc),Se(pc),Se(jl),function(t){t[t.SCENE=0]="SCENE",t[t.POSTPROCESS=1]="POSTPROCESS",t[t.UI=2]="UI"}(pD||(pD={})),Se(pD),XI=qs("RenderTextureDesc"),jI=xa($l),YI=xa(tc),KI=xa(jl),XI((qI=function(){this.name=QI&&QI(),this.type=ZI&&ZI(),this.usage=JI&&JI(),this.format=$I&&$I(),this.width=tO&&tO(),this.height=eO&&eO()},QI=Gs(qI.prototype,"name",[ra],(function(){return""})),ZI=Gs(qI.prototype,"type",[jI],(function(){return $l.TEX2D})),JI=Gs(qI.prototype,"usage",[YI],(function(){return tc.COLOR_ATTACHMENT})),$I=Gs(qI.prototype,"format",[KI],(function(){return jl.UNKNOWN})),tO=Gs(qI.prototype,"width",[ra],(function(){return-1})),eO=Gs(qI.prototype,"height",[ra],(function(){return-1})),qI));var ED=(iO=qs("RenderTextureConfig"),nO=xa(ox),iO((sO=function(){this.name=aO&&aO(),this.texture=oO&&oO()},aO=Gs(sO.prototype,"name",[ra],(function(){return""})),oO=Gs(sO.prototype,"texture",[nO],(function(){return null})),rO=sO))||rO);hO=qs("MaterialConfig"),uO=xa(OS),hO((lO=function(){this.name=cO&&cO(),this.material=_O&&_O()},cO=Gs(lO.prototype,"name",[ra],(function(){return""})),_O=Gs(lO.prototype,"material",[uO],(function(){return null})),lO)),dO=qs("FrameBufferDesc"),fO=xa([Ze]),pO=xa(ox),dO((mO=function(){this.name=gO&&gO(),this.renderPass=vO&&vO(),this.colorTextures=yO&&yO(),this.depthStencilTexture=TO&&TO(),this.texture=SO&&SO()},gO=Gs(mO.prototype,"name",[ra],(function(){return""})),vO=Gs(mO.prototype,"renderPass",[ra],(function(){return 0})),yO=Gs(mO.prototype,"colorTextures",[fO],(function(){return[]})),TO=Gs(mO.prototype,"depthStencilTexture",[ra],(function(){return""})),SO=Gs(mO.prototype,"texture",[pO],(function(){return null})),mO));var AD,RD=(EO=qs("ColorDesc"),AO=xa(jl),RO=xa(dc),bO=xa(fc),CO=xa(pc),wO=xa(pc),EO((IO=function(){this.format=OO&&OO(),this.loadOp=DO&&DO(),this.storeOp=MO&&MO(),this.sampleCount=PO&&PO(),this.beginAccesses=BO&&BO(),this.endAccesses=NO&&NO()},OO=Gs(IO.prototype,"format",[AO],(function(){return jl.UNKNOWN})),DO=Gs(IO.prototype,"loadOp",[RO],(function(){return dc.CLEAR})),MO=Gs(IO.prototype,"storeOp",[bO],(function(){return fc.STORE})),PO=Gs(IO.prototype,"sampleCount",[ra],(function(){return 1})),BO=Gs(IO.prototype,"beginAccesses",[CO],(function(){return pc.NONE})),NO=Gs(IO.prototype,"endAccesses",[wO],(function(){return pc.COLOR_ATTACHMENT_WRITE})),xO=IO))||xO),bD=(LO=qs("DepthStencilDesc"),FO=xa(jl),kO=xa(dc),UO=xa(fc),GO=xa(dc),HO=xa(fc),zO=xa(pc),VO=xa(pc),LO((XO=function(){this.format=jO&&jO(),this.depthLoadOp=YO&&YO(),this.depthStoreOp=KO&&KO(),this.stencilLoadOp=qO&&qO(),this.stencilStoreOp=QO&&QO(),this.sampleCount=ZO&&ZO(),this.beginAccesses=JO&&JO(),this.endAccesses=$O&&$O()},jO=Gs(XO.prototype,"format",[FO],(function(){return jl.UNKNOWN})),YO=Gs(XO.prototype,"depthLoadOp",[kO],(function(){return dc.CLEAR})),KO=Gs(XO.prototype,"depthStoreOp",[UO],(function(){return fc.STORE})),qO=Gs(XO.prototype,"stencilLoadOp",[GO],(function(){return dc.CLEAR})),QO=Gs(XO.prototype,"stencilStoreOp",[HO],(function(){return fc.STORE})),ZO=Gs(XO.prototype,"sampleCount",[ra],(function(){return 1})),JO=Gs(XO.prototype,"beginAccesses",[zO],(function(){return pc.NONE})),$O=Gs(XO.prototype,"endAccesses",[VO],(function(){return pc.DEPTH_STENCIL_ATTACHMENT_WRITE})),WO=XO))||WO);tD=qs("RenderPassDesc"),eD=xa([RD]),iD=xa(bD),tD((nD=function(){this.index=rD&&rD(),this.colorAttachments=sD&&sD(),this.depthStencilAttachment=aD&&aD()},rD=Gs(nD.prototype,"index",[ra],(function(){return-1})),sD=Gs(nD.prototype,"colorAttachments",[eD],(function(){return[]})),aD=Gs(nD.prototype,"depthStencilAttachment",[iD],(function(){return new bD})),nD)),function(t){t[t.FRONT_TO_BACK=0]="FRONT_TO_BACK",t[t.BACK_TO_FRONT=1]="BACK_TO_FRONT"}(AD||(AD={})),Se(AD);var CD=(oD=qs("RenderQueueDesc"),hD=xa(AD),uD=xa([Ze]),oD((cD=function(){this.isTransparent=_D&&_D(),this.sortMode=dD&&dD(),this.stages=fD&&fD()},_D=Gs(cD.prototype,"isTransparent",[ra],(function(){return!1})),dD=Gs(cD.prototype,"sortMode",[hD],(function(){return AD.FRONT_TO_BACK})),fD=Gs(cD.prototype,"stages",[uD],(function(){return[]})),lD=cD))||lD);function wD(t,e){return t.hash-e.hash||t.depth-e.depth||t.shaderId-e.shaderId}function xD(t,e){return t.priority-e.priority||t.hash-e.hash||e.depth-t.depth||t.shaderId-e.shaderId}var ID=function(){function t(t){this.queue=void 0,this._passDesc=void 0,this._passPool=void 0,this._passDesc=t,this._passPool=new Bu((function(){return{priority:0,hash:0,depth:0,shaderId:0,subModel:null,passIdx:0}}),64),this.queue=new Nu(64,this._passDesc.sortFunc)}var e=t.prototype;return e.clear=function(){this.queue.clear(),this._passPool.reset()},e.insertRenderPass=function(t,e,i){var n=t.model.subModels[e],r=n.passes[i],s=n.shaders[i];if(r.blendState.targets[0].blend!==this._passDesc.isTransparent||!(r.phase&this._passDesc.phases))return!1;var a=0|r.priority<<16|n.priority<<8|i,o=this._passPool.add();return o.priority=t.model.priority,o.hash=a,o.depth=t.depth||0,o.shaderId=s.typedID,o.subModel=n,o.passIdx=i,this.queue.push(o),!0},e.sort=function(){this.queue.sort()},e.recordCommandBuffer=function(t,e,i){for(var n=0;n<this.queue.length;++n){var r=this.queue.array[n],s=r.subModel,a=r.passIdx,o=s.inputAssembler,h=s.passes[a],u=s.shaders[a],l=dS.getOrCreatePipelineState(t,h,u,e,o);i.bindPipelineState(l),i.bindDescriptorSet(xg.MATERIAL,h.descriptorSet),i.bindDescriptorSet(xg.LOCAL,s.descriptorSet),i.bindInputAssembler(o),i.draw(o)}},t}();function OD(t){for(var e=0,i=0;i<t.stages.length;i++)e|=oS(t.stages[i]);var n=wD;switch(t.sortMode){case AD.BACK_TO_FRONT:n=xD;break;case AD.FRONT_TO_BACK:n=wD}return new ID({isTransparent:t.isTransparent,phases:e,sortFunc:n})}function DD(t){t.clear()}function MD(t){t.sort()}var PD,BD,ND,LD,FD,kD,UD=function(){function t(){this.queue=new Set,this._renderQueue=[]}var e=t.prototype;return e.clear=function(){for(var t=this.queue.values(),e=t.next();!e.done;)e.value.clear(),e=t.next();this._renderQueue.length=0,this.queue.clear()},e.sort=function(){for(var t=this.queue.values(),e=t.next();!e.done;)e.value.pass.blendState.targets[0].blend||this._renderQueue.push(e.value),e=t.next();for(e=(t=this.queue.values()).next();!e.done;)e.value.pass.blendState.targets[0].blend&&this._renderQueue.push(e.value),e=t.next()},e.uploadBuffers=function(t){for(var e=this.queue.values(),i=e.next();!i.done;)i.value.hasPendingModels&&i.value.uploadBuffers(t),i=e.next()},e.recordCommandBuffer=function(t,e,i,n,r){void 0===n&&(n=null);for(var s=0===this._renderQueue.length?this.queue.values():this._renderQueue[Symbol.iterator](),a=s.next();!a.done;){var o=a.value,h=o.instances,u=o.pass;if(o.hasPendingModels){i.bindDescriptorSet(xg.MATERIAL,u.descriptorSet);for(var l=null,c=0;c<h.length;++c){var _=h[c];if(_.count){var d=_.shader,f=dS.getOrCreatePipelineState(t,u,d,e,_.ia);l!==f&&(i.bindPipelineState(f),l=f),n&&i.bindDescriptorSet(xg.GLOBAL,n),r?i.bindDescriptorSet(xg.LOCAL,_.descriptorSet,r):i.bindDescriptorSet(xg.LOCAL,_.descriptorSet,a.value.dynamicOffsets),i.bindInputAssembler(_.ia),i.draw(_.ia)}}}a=s.next()}},t}(),GD=[new Xc(0,0,0,0),new Xc(0,0,0,0),new Xc(0,0,0,0)],HD=t("dh",(PD=qs("GbufferStage"),BD=xa([CD]),PD(((kD=function(t){function e(){var e;return(e=t.call(this)||this).renderQueues=FD&&FD(),e._renderQueues=[],e._renderArea=new Fc,e._instancedQueue=void 0,e._phaseID=oS("default"),e._instancedQueue=new UD,e}s(e,t);var i=e.prototype;return i.initialize=function(e){return t.prototype.initialize.call(this,e),e.renderQueues&&(this.renderQueues=e.renderQueues),!0},i.activate=function(e,i){t.prototype.activate.call(this,e,i);for(var n=0;n<this.renderQueues.length;n++)this._renderQueues[n]=OD(this.renderQueues[n])},i.destroy=function(){},i.render=function(t){this._instancedQueue.clear();var e=this._pipeline,i=e.device;this._renderQueues.forEach(DD),e.generateRenderArea(t,this._renderArea),e.updateQuadVertexData(this._renderArea,t.window);for(var n=e.pipelineSceneData.renderObjects,r=0,s=0,a=0,o=0;o<n.length;++o){var h=n[o],u=h.model.subModels;for(r=0;r<u.length;++r){var l=u[r],c=l.passes;for(s=0;s<c.length;++s){var _=c[s];if(_.phase===this._phaseID)if(_.batchingScheme===rS.INSTANCING){var d=_.getInstancedBuffer();d.merge(l,s),this._instancedQueue.queue.add(d)}else for(a=0;a<this._renderQueues.length;a++)this._renderQueues[a].insertRenderPass(h,r,s)}}}this._renderQueues.forEach(MD);var f=e.commandBuffers[0];this._instancedQueue.uploadBuffers(f),t.clearFlag&xc.COLOR&&(e.pipelineSceneData.isHDR?mS(GD[0],t.clearColor):(GD[0].x=t.clearColor.x,GD[0].y=t.clearColor.y,GD[0].z=t.clearColor.z)),GD[0].w=t.clearColor.w;var p=e.getPipelineRenderData().gbufferFrameBuffer,m=p.renderPass;f.beginRenderPass(m,p,this._renderArea,GD,t.clearDepth,t.clearStencil),f.setScissor(e.generateScissor(t)),f.setViewport(e.generateViewport(t)),f.bindDescriptorSet(xg.GLOBAL,e.descriptorSet);for(var g=0;g<this.renderQueues.length;g++)this._renderQueues[g].recordCommandBuffer(i,m,f);this._instancedQueue.recordCommandBuffer(i,m,f),f.endRenderPass()},e}(DI)).initInfo={name:"GbufferStage",priority:VI.GBUFFER,tag:0,renderQueues:[{isTransparent:!1,sortMode:AD.FRONT_TO_BACK,stages:["default"]},{isTransparent:!0,sortMode:AD.BACK_TO_FRONT,stages:["default"]}]},FD=Gs((LD=kD).prototype,"renderQueues",[BD,ra],(function(){return[]})),ND=LD))||ND)),zD=new Es,VD=oS("planar-shadow");function WD(t){var e=t.passes,i=v.rendering;ny()&&(VD=i.getPhaseID(i.getPassID("default"),"planar-shadow"));for(var n=0;n<e.length;n++)if((!i||!i.enableEffectImport)&&e[n].phase===VD||ny()&&e[n].phaseID===VD)return n;return-1}var XD,jD,YD,KD,qD,QD,ZD,JD,$D,tM,eM,iM,nM,rM,sM,aM,oM,hM=function(){function t(t){this._subModelArray=[],this._shaderArray=[],this._passArray=[],this._castModels=[],this._instancedQueue=new UD,this._pipeline=void 0,this._pipeline=t}var e=t.prototype;return e.clear=function(){this._subModelArray.length=0,this._shaderArray.length=0,this._passArray.length=0,this._instancedQueue.clear(),this._castModels.length=0},e.gatherShadowPasses=function(t,e){this.clear();var i=this._pipeline.pipelineSceneData.shadows;if(i.enabled&&i.type===MS.Planar&&!(i.normal.length()<1e-6)){var n=t.scene,r=t.frustum,s=0!=(t.visibility&sm.BitMask.DEFAULT);if(n.mainLight&&s){for(var a=n.models,o=t.visibility,h=0;h<a.length;h++){var u=a[h];n.isCulledByLod(t,u)||u.enabled&&u.node&&u.castShadow&&u.node&&(o&u.node.layer)===u.node.layer&&this._castModels.push(u)}for(var l=0;l<this._castModels.length;l++){var c=this._castModels[l];if(!c.worldBounds||(Es.transform(zD,c.worldBounds,i.matLight),us.aabbFrustum(zD,r)))for(var _=c.subModels,d=0;d<_.length;d++){var f=_[d],p=WD(f);if(p<0){this._subModelArray.push(f);var m=i.getPlanarShader(f.patches);if(!m)continue;this._shaderArray.push(m),this._passArray.push(i.material.passes[0])}else{var g=f.passes[p];if(g.batchingScheme===rS.INSTANCING){var v=g.getInstancedBuffer();v.merge(f,p),this._instancedQueue.queue.add(v)}else{var y=f.shaders[p];this._subModelArray.push(f),y&&this._shaderArray.push(y),this._passArray.push(g)}}}}this._instancedQueue.uploadBuffers(e)}}},e.recordCommandBuffer=function(t,e,i){var n=this._pipeline.pipelineSceneData.shadows;if(n.enabled&&n.type===MS.Planar){this._instancedQueue.recordCommandBuffer(t,e,i);for(var r=0;r<this._subModelArray.length;++r){var s=this._subModelArray[r],a=this._shaderArray[r],o=this._passArray[r],h=s.inputAssembler,u=dS.getOrCreatePipelineState(t,o,a,e,h),l=o.descriptorSet;i.bindPipelineState(u),i.bindDescriptorSet(xg.MATERIAL,l),i.bindDescriptorSet(xg.LOCAL,s.descriptorSet),i.bindInputAssembler(h),i.draw(h)}}},t}(),uM=function(){function t(){this._phaseID=oS("default");var t=v.rendering;ny()&&(this._phaseID=t.getPhaseID(t.getPassID("default"),"default"))}var e=t.prototype;return e.activate=function(t){this._pipeline=t},e.render=function(t,e){for(var i=this._pipeline,n=i.device,r=i.commandBuffers[0],s=t.scene.batches,a=0;a<s.length;a++){var o=s[a],h=!1;if(t.visibility&o.visFlags&&(h=!0),h)for(var u=o.shaders.length,l=0;l<u;l++){var c=o.passes[l];if(c.phase===this._phaseID){var _=o.shaders[l],d=o.inputAssembler,f=dS.getOrCreatePipelineState(n,c,_,e,d);r.bindPipelineState(f),r.bindDescriptorSet(xg.MATERIAL,c.descriptorSet);var p=o.descriptorSet;r.bindDescriptorSet(xg.LOCAL,p),r.bindInputAssembler(d),r.draw(d)}}}},t}(),lM=new hn,cM=new Es(0,0,0,.5,.5,.5),_M=new Es,dM=[new Xc(0,0,0,1)],fM=t("di",(XD=qs("LightingStage"),jD=xa(OS),YD=xa([CD]),XD(((JD=function(t){function e(){var e;return(e=t.call(this)||this)._deferredLitsBufs=null,e._maxDeferredLights=ev.LIGHTS_PER_PASS,e._lightBufferData=void 0,e._lightMeterScale=1e4,e._descriptorSet=null,e._descriptorSetLayout=void 0,e._renderArea=new Fc,e._uiPhase=void 0,e._deferredMaterial=QD&&QD(),e.renderQueues=ZD&&ZD(),e._phaseID=oS("default"),e._renderQueues=[],e._uiPhase=new uM,e}s(e,t);var i=e.prototype;return i.initialize=function(e){return t.prototype.initialize.call(this,e),!0},i.gatherLights=function(t){for(var e=this._pipeline,i=e.commandBuffers[0],n=t.scene.sphereLights,r=t.scene.spotLights,s=t.scene.pointLights,a=t.scene.rangedDirLights,o=yr.create(0,0,0,1),h=new Float32Array(4),u=t.exposure,l=0,c=nn.length,_=c*this._maxDeferredLights,d=0;d<n.length&&l<this._maxDeferredLights;d++,++l){var f=n[d];if(yr.set(o,f.position.x,f.position.y,f.position.z,f.range),us.sphereFrustum(o,t.frustum)){if(hn.toArray(h,f.position),h[3]=hx.SPHERE,this._lightBufferData.set(h,l*c),hn.toArray(h,f.color),f.useColorTemperature){var p=f.finalColor;h[0]=p.x,h[1]=p.y,h[2]=p.z}e.pipelineSceneData.isHDR?h[3]=f.luminance*u*this._lightMeterScale:h[3]=f.luminance,this._lightBufferData.set(h,l*c+1*_),h[0]=f.size,h[1]=f.range,h[2]=0,this._lightBufferData.set(h,l*c+2*_)}}for(var m=0;m<r.length&&l<this._maxDeferredLights;m++,++l){var g=r[m];if(yr.set(o,g.position.x,g.position.y,g.position.z,g.range),us.sphereFrustum(o,t.frustum)){if(hn.toArray(h,g.position),h[3]=hx.SPOT,this._lightBufferData.set(h,l*c+0*_),hn.toArray(h,g.color),g.useColorTemperature){var v=g.finalColor;h[0]=v.x,h[1]=v.y,h[2]=v.z}e.pipelineSceneData.isHDR?h[3]=g.luminance*u*this._lightMeterScale:h[3]=g.luminance,this._lightBufferData.set(h,l*c+1*_),h[0]=g.size,h[1]=g.range,h[2]=g.spotAngle,this._lightBufferData.set(h,l*c+2*_),hn.toArray(h,g.direction),this._lightBufferData.set(h,l*c+3*_)}}for(var y=0;y<s.length&&l<this._maxDeferredLights;y++,++l){var T=s[y];if(yr.set(o,T.position.x,T.position.y,T.position.z,T.range),us.sphereFrustum(o,t.frustum)){if(hn.toArray(h,T.position),h[3]=hx.POINT,this._lightBufferData.set(h,l*c),hn.toArray(h,T.color),T.useColorTemperature){var S=T.finalColor;h[0]=S.x,h[1]=S.y,h[2]=S.z}e.pipelineSceneData.isHDR?h[3]=T.luminance*u*this._lightMeterScale:h[3]=T.luminance,this._lightBufferData.set(h,l*c+1*_),h[0]=0,h[1]=T.range,h[2]=0,this._lightBufferData.set(h,l*c+2*_)}}for(var E=0;E<a.length&&l<this._maxDeferredLights;E++,++l){var A=a[E];if(Es.transform(_M,cM,A.node.getWorldMatrix()),us.aabbFrustum(_M,t.frustum)){if(hn.toArray(h,A.position),h[3]=hx.RANGED_DIRECTIONAL,this._lightBufferData.set(h,l*c),hn.toArray(h,A.color),A.useColorTemperature){var R=A.finalColor;h[0]=R.x,h[1]=R.y,h[2]=R.z}e.pipelineSceneData.isHDR?h[3]=A.illuminance*u:h[3]=A.illuminance,this._lightBufferData.set(h,l*c+1*_),hn.toArray(h,A.right),h[3]=0,this._lightBufferData.set(h,l*c+2*_),hn.toArray(h,A.direction),h[3]=0,this._lightBufferData.set(h,l*c+3*_);var b=A.scale;lM.set(.5*b.x,.5*b.y,.5*b.z),hn.toArray(h,lM),h[3]=0,this._lightBufferData.set(h,l*c+4*_)}}var C=3*_+3;this._lightBufferData.set([l],C),i.updateBuffer(this._deferredLitsBufs,this._lightBufferData)},i._createStageDescriptor=function(t){var e=this._pipeline.device,i=16*Float32Array.BYTES_PER_ELEMENT*this._maxDeferredLights;i=Math.ceil(i/e.capabilities.uboOffsetAlignment)*e.capabilities.uboOffsetAlignment,this._deferredLitsBufs=e.createBuffer(new qc(ql.UNIFORM|ql.TRANSFER_DST,Jl.HOST|Jl.DEVICE,i,e.capabilities.uboOffsetAlignment));var n=e.createBuffer(new Qc(this._deferredLitsBufs,0,i));this._lightBufferData=new Float32Array(i/Float32Array.BYTES_PER_ELEMENT),this._descriptorSet=e.createDescriptorSet(new C_(t.localSetLayout)),this._descriptorSet.bindBuffer(tv.BINDING,n);var r=e.createBuffer(new qc(ql.UNIFORM|ql.TRANSFER_DST,Jl.DEVICE,qg.SIZE,qg.SIZE));this._descriptorSet.bindBuffer(qg.BINDING,r)},i.activate=function(e,i){t.prototype.activate.call(this,e,i),this._uiPhase.activate(e);for(var n=0;n<this.renderQueues.length;n++)this._renderQueues[n]=OD(this.renderQueues[n]);this._planarQueue=new hM(this._pipeline),this._deferredMaterial&&(e.pipelineSceneData.deferredLightingMaterial=this._deferredMaterial)},i.destroy=function(){var t;null===(t=this._deferredLitsBufs)||void 0===t||t.destroy(),this._deferredLitsBufs=null,this._descriptorSet=null},i.render=function(t){var e,i=this._pipeline,n=i.device,r=i.commandBuffers[0],s=i.pipelineSceneData,a=s.renderObjects;this._planarQueue.gatherShadowPasses(t,r),i.generateRenderArea(t,this._renderArea);for(var o=i.getPipelineRenderData(),h=s.deferredLightingMaterial.passes[0],u=h.getShaderVariant(),l=0;l<3;++l)h.descriptorSet.bindTexture(l,o.gbufferRenderTargets[l]),h.descriptorSet.bindSampler(l,o.sampler);h.descriptorSet.bindTexture(3,o.outputDepth),h.descriptorSet.bindSampler(3,o.sampler),h.descriptorSet.update(),this._descriptorSet||this._createStageDescriptor(h),this.gatherLights(t),t.clearFlag&xc.COLOR&&(dM[0].x=t.clearColor.x,dM[0].y=t.clearColor.y,dM[0].z=t.clearColor.z),dM[0].w=0;var c=o.outputFrameBuffer,_=c.renderPass;i.pipelineUBO.updateShadowUBO(t),r.beginRenderPass(_,c,this._renderArea,dM,t.clearDepth,t.clearStencil),r.setScissor(i.generateScissor(t)),r.setViewport(i.generateViewport(t)),r.bindDescriptorSet(xg.GLOBAL,i.descriptorSet);var d=i.quadIAOffscreen,f=null;null!=h&&null!=u&&null!=d&&(f=dS.getOrCreatePipelineState(n,h,u,_,d)),null!=f&&(this._descriptorSet.update(),r.bindPipelineState(f),r.bindDescriptorSet(xg.MATERIAL,h.descriptorSet),r.bindDescriptorSet(xg.LOCAL,this._descriptorSet),r.bindInputAssembler(d),r.draw(d)),this._renderQueues.forEach(DD);for(var p=0,m=0,g=0,v=0;v<a.length;++v){var y=a[v],T=y.model.subModels;for(p=0;p<T.length;++p){var S=T[p].passes;for(m=0;m<S.length;++m)if(S[m].phase===this._phaseID)for(g=0;g<this._renderQueues.length;g++)this._renderQueues[g].insertRenderPass(y,p,m)}}if(a.length>0){this._renderQueues.forEach(MD);for(var E=0;E<this._renderQueues.length;E++)this._renderQueues[E].recordCommandBuffer(n,_,r);this._planarQueue.recordCommandBuffer(n,_,r)}null===(e=t.geometryRenderer)||void 0===e||e.render(_,r,i.pipelineSceneData),this._uiPhase.render(t,_),r.endRenderPass()},e}(DI)).initInfo={name:"LightingStage",priority:VI.LIGHTING,tag:0},QD=Gs((qD=JD).prototype,"_deferredMaterial",[jD,ra],(function(){return null})),ZD=Gs(qD.prototype,"renderQueues",[YD,ra],(function(){return[]})),KD=qD))||KD)),pM=[new Xc(0,0,0,1)],mM=t("dk",($D=qs("PostProcessStage"),tM=xa(OS),eM=xa([CD]),$D(((aM=function(t){function e(){var e;return(e=t.call(this)||this)._postProcessMaterial=rM&&rM(),e.renderQueues=sM&&sM(),e._renderArea=new Fc,e._stageDesc=void 0,e._localUBO=void 0,e._uiPhase=new uM,e}s(e,t);var i=e.prototype;return i.initialize=function(e){return t.prototype.initialize.call(this,e),!0},i.activate=function(e,i){t.prototype.activate.call(this,e,i),this._postProcessMaterial&&(e.pipelineSceneData.postprocessMaterial=this._postProcessMaterial),this._uiPhase.activate(e)},i.destroy=function(){},i.render=function(t){var e=this._pipeline,i=e.device,n=e.pipelineSceneData,r=e.commandBuffers[0];e.pipelineUBO.updateCameraUBO(t);var s=t.viewport;this._renderArea.x=s.x*t.window.width,this._renderArea.y=s.y*t.window.height,this._renderArea.width=s.width*t.window.width,this._renderArea.height=s.height*t.window.height;var a=e.getPipelineRenderData(),o=t.window.framebuffer,h=e.getRenderPass(t.clearFlag,o);t.clearFlag&xc.COLOR&&(pM[0].x=t.clearColor.x,pM[0].y=t.clearColor.y,pM[0].z=t.clearColor.z),pM[0].w=t.clearColor.w,r.beginRenderPass(h,o,this._renderArea,pM,t.clearDepth,t.clearStencil),r.bindDescriptorSet(xg.GLOBAL,e.descriptorSet);var u=n.postprocessMaterial.passes[0],l=u.getShaderVariant();e.bloomEnabled?u.descriptorSet.bindTexture(0,a.bloom.combineTex):u.descriptorSet.bindTexture(0,a.outputRenderTargets[0]),u.descriptorSet.bindSampler(0,a.sampler),u.descriptorSet.update();var c=t.window.swapchain?e.quadIAOnscreen:e.quadIAOffscreen,_=null;null!=u&&null!=l&&null!=c&&(_=dS.getOrCreatePipelineState(i,u,l,h,c));var d=e.pipelineSceneData.renderObjects;null!=_&&d.length>0&&(this._stageDesc||(this._stageDesc=i.createDescriptorSet(new C_(u.localSetLayout)),this._localUBO=i.createBuffer(new qc(ql.UNIFORM|ql.TRANSFER_DST,Jl.DEVICE,qg.SIZE,qg.SIZE)),this._stageDesc.bindBuffer(qg.BINDING,this._localUBO)),this._stageDesc.update(),r.bindPipelineState(_),r.bindDescriptorSet(xg.MATERIAL,u.descriptorSet),r.bindDescriptorSet(xg.LOCAL,this._stageDesc),r.bindInputAssembler(c),r.draw(c)),this._uiPhase.render(t,h),xS(i,h,r,e.profiler,t),r.endRenderPass()},e}(DI)).initInfo={name:"PostProcessStage",priority:GI.POST_PROCESS,tag:0},rM=Gs((nM=aM).prototype,"_postProcessMaterial",[tM,ra],(function(){return null})),sM=Gs(nM.prototype,"renderQueues",[eM,ra],(function(){return[]})),iM=nM))||iM)),gM=function(){function t(){this._enabled=!1,this._minPos=new hn(0,0,0),this._maxPos=new hn(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}(),vM=new Dn,yM=new Dn,TM=new Dn,SM=new Dn,EM=new Dn,AM=new Dn,RM=new Dn,bM=new hn(0,0,0),CM=new hn,wM=new Fn,xM=new hn,IM=new hn,OM=new hn(1e7,1e7,1e7),DM=new hn(-1e7,-1e7,-1e7),MM=new hn,PM=0,BM=0,NM=function(){function t(t){this._shadowObjects=[],this._shadowCameraFar=0,this._level=void 0,this._matShadowView=new Dn,this._matShadowProj=new Dn,this._matShadowViewProj=new Dn,this._validFrustum=new Is,this._splitFrustum=new Is,this._lightViewFrustum=new Is,this._castLightViewBoundingBox=new Es,this._level=t,this._validFrustum.accurate=!0,this._splitFrustum.accurate=!0,this._lightViewFrustum.accurate=!0}var e=t.prototype;return e.copyToValidFrustum=function(t){Is.copy(this._validFrustum,t)},e.calculateValidFrustumOrtho=function(t,e,i,n,r){Is.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=v.director.root.device,r=t.shadowInvisibleOcclusionRange;Is.copy(this._lightViewFrustum,this._splitFrustum),Dn.fromRT(yM,t.node.rotation,bM),Dn.invert(TM,yM);var s,a,o=TM.clone();this._lightViewFrustum.transform(TM),Es.fromPoints(this._castLightViewBoundingBox,OM,DM),this._castLightViewBoundingBox.mergeFrustum(this._lightViewFrustum),t.csmOptimizationMode===NS.DisableRotationFix?(s=2*this._castLightViewBoundingBox.halfExtents.x,a=2*this._castLightViewBoundingBox.halfExtents.y):s=a=hn.distance(this._lightViewFrustum.vertices[0],this._lightViewFrustum.vertices[6]);var h=v.director.root.pipeline.pipelineSceneData.csmSupported?t.csmLevel:1;if(h>1&&t.csmOptimizationMode===NS.RemoveDuplicates)if(this._level>=h-1)BM=this._castLightViewBoundingBox.halfExtents.z,PM=this._castLightViewBoundingBox.center.z;else{var u=Math.abs(this._castLightViewBoundingBox.center.z-PM)+BM;this._castLightViewBoundingBox.halfExtents.z=Math.max(this._castLightViewBoundingBox.center.z,u)}var l=this._castLightViewBoundingBox.halfExtents.z;this._shadowCameraFar=2*l+r;var c=this._castLightViewBoundingBox.center;if(MM.set(c.x,c.y,c.z+l+r),hn.transformMat4(MM,MM,yM),Dn.fromRT(yM,t.node.rotation,MM),Dn.invert(TM,yM),!i){var _=.5*s,d=.5*a;Dn.ortho(SM,-_,_,-d,d,.1,this._shadowCameraFar,n.capabilities.clipSpaceMinZ,n.capabilities.clipSpaceSignY),Dn.multiply(AM,SM,o),hn.transformMat4(CM,MM,AM);var f=2/e;wM.set(f,f);var p=CM.x%wM.x,m=CM.y%wM.y;xM.set(CM.x-p,CM.y-m,CM.z),Dn.invert(RM,AM),hn.transformMat4(IM,xM,RM),Dn.fromRT(yM,t.node.rotation,IM),Dn.invert(TM,yM),Dn.multiply(EM,SM,TM),Dn.copy(this._matShadowView,TM),Dn.copy(this._matShadowProj,SM),Dn.copy(this._matShadowViewProj,EM)}Is.createOrtho(this._validFrustum,s,a,.1,this._shadowCameraFar,yM)},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}(),LM=function(t){function e(e){var i;return(i=t.call(this,e)||this)._splitCameraNear=0,i._splitCameraFar=0,i._csmAtlas=new nn,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=v.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}(NM),FM=function(){function t(){this._castShadowObjects=[],this._layerObjects=new Nu(64),this._layers=[],this._levelCount=0,this._specialLayer=new NM(1),this._shadowDistance=0;for(var t=0;t<BS.LEVEL_4;t++)this._layers[t]=new LM(t)}var e=t.prototype;return e.update=function(t,e){var i=e.scene.mainLight;if(null!==i){var n=t.shadows,r=v.director.root.pipeline.pipelineSceneData.csmSupported?i.csmLevel:1,s=i.shadowDistance;n.enabled&&i.shadowEnabled&&(i.shadowFixedArea?this._updateFixedArea(i):((i.csmNeedUpdate||this._levelCount!==r||this._shadowDistance!==s)&&(this._splitFrustumLevels(i),this._levelCount=r,this._shadowDistance=s),this._calculateCSM(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=v.director.root.device,i=t.shadowOrthoSize,n=t.shadowOrthoSize,r=t.shadowNear,s=t.shadowFar;Dn.fromRT(yM,t.node.getWorldRotation(),t.node.getWorldPosition()),Dn.invert(TM,yM),Dn.ortho(SM,-i,i,-n,n,r,s,e.capabilities.clipSpaceMinZ,e.capabilities.clipSpaceSignY),Dn.multiply(EM,SM,TM),this._specialLayer.matShadowView=TM,this._specialLayer.matShadowProj=SM,this._specialLayer.matShadowViewProj=EM,this._specialLayer.calculateValidFrustumOrtho(2*i,2*n,r,s,yM)},e._splitFrustumLevels=function(t){var e=.1,i=t.shadowDistance,n=i/e,r=v.director.root.pipeline.pipelineSceneData.csmSupported?t.csmLevel:1,s=t.csmLayerLambda;this._layers[0].splitCameraNear=e;for(var a=1;a<r;a++){var o=a/r,h=s*e*Math.pow(n,o)+(1-s)*(e+(i-e)*o),u=1.005*h;this._layers[a].splitCameraNear=h,this._layers[a-1].splitCameraFar=u}this._layers[r-1].splitCameraFar=i,t.csmNeedUpdate=!1},e._calculateCSM=function(t,e,i){var n=v.director.root.pipeline.pipelineSceneData.csmSupported?e.csmLevel:1,r=n>1?.5*i.size.x:i.size.x;if(!(r<0)){this._getCameraWorldMatrix(vM,t);for(var s=n-1;s>=0;s--){var a=this._layers[s],o=a.splitCameraNear,h=a.splitCameraFar;a.calculateSplitFrustum(t,vM,o,h),a.createMatrix(e,r,!1)}n===BS.LEVEL_1?(this._specialLayer.shadowCameraFar=this._layers[0].shadowCameraFar,Dn.copy(this._specialLayer.matShadowView,this._layers[0].matShadowView),Dn.copy(this._specialLayer.matShadowProj,this._layers[0].matShadowProj),Dn.copy(this._specialLayer.matShadowViewProj,this._layers[0].matShadowViewProj),this._specialLayer.copyToValidFrustum(this._layers[0].validFrustum)):(this._specialLayer.calculateSplitFrustum(t,vM,.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();Dn.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}(),kM=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}(),UM=t("da",function(){function t(){this.fog=new YS,this.ambient=new mg,this.skybox=new VS,this.shadows=new FS,this.csmLayers=new FM,this.octree=new gM,this.skin=new kM,this.postSettings=new gR,this.lightProbes=v.internal.LightProbes?new v.internal.LightProbes:null,this.validPunctualLights=[],this.renderObjects=[],this.shadowFrameBufferMap=new Map,this._geometryRendererMaterials=[],this._geometryRendererPasses=[],this._geometryRendererShaders=[],this._occlusionQueryVertexBuffer=null,this._occlusionQueryIndicesBuffer=null,this._occlusionQueryInputAssembler=null,this._occlusionQueryMaterial=null,this._occlusionQueryShader=null,this._isHDR=!0,this._shadingScale=1,this._csmSupported=!0,this._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 OS,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 OS;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 qc(ql.VERTEX|ql.TRANSFER_DST,Jl.DEVICE,n,i)),this._occlusionQueryVertexBuffer.update(e);var r=new Uint16Array([0,2,1,1,2,3,4,5,6,5,7,6,1,3,7,1,7,5,0,4,6,0,6,2,0,1,5,0,5,4,2,6,7,2,7,3]),s=Uint16Array.BYTES_PER_ELEMENT,a=36*s;this._occlusionQueryIndicesBuffer=t.createBuffer(new qc(ql.INDEX|ql.TRANSFER_DST,Jl.DEVICE,a,s)),this._occlusionQueryIndicesBuffer.update(r);var o=[new __("a_position",jl.RGB32F)],h=new f_(o,[this._occlusionQueryVertexBuffer],this._occlusionQueryIndicesBuffer);return t.createInputAssembler(h)},n(t,[{key:"isHDR",get:function(){return this._isHDR},set:function(t){this._isHDR=t}},{key:"shadingScale",get:function(){return this._shadingScale},set:function(t){this._shadingScale=t}},{key:"csmSupported",get:function(){return this._csmSupported},set:function(t){this._csmSupported=t}},{key:"standardSkinModel",get:function(){return this._standardSkinModel},set:function(t){this._standardSkinModel=t}},{key:"standardSkinMeshRenderer",get:function(){return this._standardSkinMeshRenderer},set:function(t){this._standardSkinMeshRenderer&&this._standardSkinMeshRenderer!==t&&this._standardSkinMeshRenderer.clearGlobalStandardSkinObjectFlag(),this._standardSkinMeshRenderer=t,this.standardSkinModel=t?t.model:null}},{key:"skinMaterialModel",get:function(){return this._skinMaterialModel},set:function(t){this._skinMaterialModel=t}},{key:"geometryRendererPasses",get:function(){return this._geometryRendererPasses}},{key:"geometryRendererShaders",get:function(){return this._geometryRendererShaders}}]),t}());!function(t){t[t.NONE=0]="NONE",t[t.FXAA=1]="FXAA"}(oM||(oM={}));var GM,HM,zM,VM,WM,XM,jM,YM=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._antiAliasing=oM.NONE,e}s(e,t);var i=e.prototype;return i.updatePipelineSceneData=function(){this.updatePipelinePassInfo()},i.updateBloomPass=function(){if(this._bloomMaterial){var t=this._bloomMaterial.passes[0];t.beginChangeStatesSilently(),t.tryCompile(),t.endChangeStatesSilently();for(var e=0;e<6;++e){var i=this._bloomMaterial.passes[1+e];i.beginChangeStatesSilently(),i.tryCompile(),i.endChangeStatesSilently();var n=this._bloomMaterial.passes[7+e];n.beginChangeStatesSilently(),n.tryCompile(),n.endChangeStatesSilently()}var r=this._bloomMaterial.passes[13];r.beginChangeStatesSilently(),r.tryCompile(),r.endChangeStatesSilently()}},i.updatePostProcessPass=function(){if(this.postprocessMaterial){var t=this.postprocessMaterial.passes[0];t.beginChangeStatesSilently(),t.tryCompile(),t.endChangeStatesSilently()}},i.initPipelinePassInfo=function(){var t=new OS;t._uuid="builtin-deferred-material",t.initialize({effectName:"pipeline/deferred-lighting"});for(var e=0;e<t.passes.length;++e)t.passes[e].tryCompile();this._deferredLightingMaterial=t;var i=new OS;i._uuid="builtin-bloom-material",i.initialize({effectName:"pipeline/bloom"});for(var n=0;n<i.passes.length;++n)i.passes[n].tryCompile();this._bloomMaterial=i;var r=new OS;r._uuid="builtin-post-process-material",r.initialize({effectName:"pipeline/post-process",defines:{ANTIALIAS_TYPE:this._antiAliasing}});for(var s=0;s<r.passes.length;++s)r.passes[s].tryCompile();this._postprocessMaterial=r,this.updatePipelinePassInfo()},i.updatePipelinePassInfo=function(){this.updateBloomPass(),this.updatePostProcessPass(),this.updateDeferredPassInfo()},i.activate=function(e){return t.prototype.activate.call(this,e),this.initPipelinePassInfo(),!0},i.updateDeferredPassInfo=function(){this.updateDeferredLightPass()},i.updateDeferredLightPass=function(){if(this._deferredLightingMaterial){v.director.root.pipeline.macros.CC_RECEIVE_SHADOW=1;var t=this._deferredLightingMaterial.passes[0];t.beginChangeStatesSilently(),t.tryCompile(),t.endChangeStatesSilently()}},n(e,[{key:"antiAliasing",get:function(){return this._antiAliasing},set:function(t){if(this._antiAliasing=t,this._postprocessMaterial){var e=this._postprocessMaterial.passes[0].defines;Object.assign(e,{ANTIALIAS_TYPE:t});var i=new OS;i.initialize({effectAsset:this._postprocessMaterial.effectAsset,defines:e});for(var n=0;n<i.passes.length;++n)i.passes[n].tryCompile();this._postprocessMaterial=i}}},{key:"bloomMaterial",get:function(){return this._bloomMaterial},set:function(t){this._bloomMaterial!==t&&t&&(this._bloomMaterial=t,this.updatePipelinePassInfo())}},{key:"postprocessMaterial",get:function(){return this._postprocessMaterial},set:function(t){this._postprocessMaterial!==t&&t&&(this._postprocessMaterial=t,this.updatePipelinePassInfo())}},{key:"deferredLightingMaterial",get:function(){return this._deferredLightingMaterial},set:function(t){this._deferredLightingMaterial!==t&&t&&(this._deferredLightingMaterial=t,this.updatePipelinePassInfo())}}]),e}(UM),KM=[new Xc(0,0,0,1)],qM=function(){};GM=qM,qM.TEXTURE_SIZE_OFFSET=0,qM.COUNT=GM.TEXTURE_SIZE_OFFSET+4,qM.SIZE=4*GM.COUNT;var QM,ZM,JM=t("dj",(HM=qs("BloomStage"),zM=xa(OS),HM(((jM=function(t){function e(){var e;return(e=t.call(this)||this).threshold=1,e.intensity=.8,e.iterations=2,e._bloomMaterial=XM&&XM(),e._renderArea=new Fc,e._bloomUBO=[],e}s(e,t);var i=e.prototype;return i.initialize=function(e){return t.prototype.initialize.call(this,e),!0},i.activate=function(e,i){t.prototype.activate.call(this,e,i),this._bloomMaterial&&(e.pipelineSceneData.bloomMaterial=this._bloomMaterial)},i.destroy=function(){},i.render=function(t){var e,i=this._pipeline;if(i.generateBloomRenderData(),(null!==(e=t.window)&&void 0!==e&&e.swapchain||i.macros.CC_PIPELINE_TYPE)&&i.bloomEnabled&&0!==i.pipelineSceneData.renderObjects.length){if(0===this._bloomUBO.length)for(var n=0;n<14;++n)this._bloomUBO[n]=i.device.createBuffer(new qc(ql.UNIFORM|ql.TRANSFER_DST,Jl.HOST|Jl.DEVICE,qM.SIZE,qM.SIZE));t.clearFlag&xc.COLOR&&(KM[0].x=t.clearColor.x,KM[0].y=t.clearColor.y,KM[0].z=t.clearColor.z),KM[0].w=t.clearColor.w,this._prefilterPass(t,i),this._downsamplePass(t,i),this._upsamplePass(t,i),this._combinePass(t,i)}},i._prefilterPass=function(t,e){e.generateRenderArea(t,this._renderArea),this._renderArea.width>>=1,this._renderArea.height>>=1;var i=e.commandBuffers[0],n=e.pipelineSceneData.bloomMaterial.passes[0],r=e.getPipelineRenderData(),s=r.bloom,a=new Float32Array(qM.COUNT);a[qM.TEXTURE_SIZE_OFFSET+2]=this.threshold,i.updateBuffer(this._bloomUBO[0],a),i.beginRenderPass(s.renderPass,s.prefilterFramebuffer,this._renderArea,KM,0,0),i.bindDescriptorSet(xg.GLOBAL,e.descriptorSet),n.descriptorSet.bindBuffer(0,this._bloomUBO[0]),n.descriptorSet.bindTexture(1,r.outputRenderTargets[0]),n.descriptorSet.bindSampler(1,s.sampler),n.descriptorSet.update(),i.bindDescriptorSet(xg.MATERIAL,n.descriptorSet);var o=t.window.swapchain?e.quadIAOffscreen:e.quadIAOnscreen,h=null,u=n.getShaderVariant();null!=n&&null!=u&&null!=o&&(h=dS.getOrCreatePipelineState(e.device,n,u,s.renderPass,o)),null!=h&&(i.bindPipelineState(h),i.bindInputAssembler(o),i.draw(o)),i.endRenderPass()},i._downsamplePass=function(t,e){e.generateRenderArea(t,this._renderArea),this._renderArea.width>>=1,this._renderArea.height>>=1;for(var i=e.commandBuffers[0],n=e.pipelineSceneData.bloomMaterial,r=e.getPipelineRenderData().bloom,s=new Float32Array(qM.COUNT),a=0;a<this.iterations;++a){s[qM.TEXTURE_SIZE_OFFSET+0]=this._renderArea.width,s[qM.TEXTURE_SIZE_OFFSET+1]=this._renderArea.height,i.updateBuffer(this._bloomUBO[a+1],s),this._renderArea.width>>=1,this._renderArea.height>>=1,i.beginRenderPass(r.renderPass,r.downsampleFramebuffers[a],this._renderArea,KM,0,0);var o=n.passes[1+a],h=o.getShaderVariant();o.descriptorSet.bindBuffer(0,this._bloomUBO[a+1]),0===a?o.descriptorSet.bindTexture(1,r.prefiterTex):o.descriptorSet.bindTexture(1,r.downsampleTexs[a-1]),o.descriptorSet.bindSampler(1,r.sampler),o.descriptorSet.update(),i.bindDescriptorSet(xg.MATERIAL,o.descriptorSet);var u=t.window.swapchain?e.quadIAOffscreen:e.quadIAOnscreen,l=null;null!=o&&null!=h&&null!=u&&(l=dS.getOrCreatePipelineState(e.device,o,h,r.renderPass,u)),null!=l&&(i.bindPipelineState(l),i.bindInputAssembler(u),i.draw(u)),i.endRenderPass()}},i._upsamplePass=function(t,e){var i=e.getPipelineRenderData().bloom;e.generateRenderArea(t,this._renderArea),this._renderArea.width>>=this.iterations+1,this._renderArea.height>>=this.iterations+1;for(var n=e.commandBuffers[0],r=e.pipelineSceneData.bloomMaterial,s=new Float32Array(qM.COUNT),a=0;a<this.iterations;++a){var o=a+6+1;s[qM.TEXTURE_SIZE_OFFSET+0]=this._renderArea.width,s[qM.TEXTURE_SIZE_OFFSET+1]=this._renderArea.height,n.updateBuffer(this._bloomUBO[o],s),this._renderArea.width<<=1,this._renderArea.height<<=1,n.beginRenderPass(i.renderPass,i.upsampleFramebuffers[this.iterations-1-a],this._renderArea,KM,0,0);var h=r.passes[7+a],u=h.getShaderVariant();h.descriptorSet.bindBuffer(0,this._bloomUBO[o]),0===a?h.descriptorSet.bindTexture(1,i.downsampleTexs[this.iterations-1]):h.descriptorSet.bindTexture(1,i.upsampleTexs[this.iterations-a]),h.descriptorSet.bindSampler(1,i.sampler),h.descriptorSet.update(),n.bindDescriptorSet(xg.MATERIAL,h.descriptorSet);var l=t.window.swapchain?e.quadIAOffscreen:e.quadIAOnscreen,c=null;null!=h&&null!=u&&null!=l&&(c=dS.getOrCreatePipelineState(e.device,h,u,i.renderPass,l)),null!=c&&(n.bindPipelineState(c),n.bindInputAssembler(l),n.draw(l)),n.endRenderPass()}},i._combinePass=function(t,e){e.generateRenderArea(t,this._renderArea);var i=e.commandBuffers[0],n=e.pipelineSceneData.bloomMaterial,r=e.getPipelineRenderData(),s=r.bloom,a=new Float32Array(qM.COUNT);a[qM.TEXTURE_SIZE_OFFSET+3]=this.intensity,i.updateBuffer(this._bloomUBO[13],a),i.beginRenderPass(s.renderPass,s.combineFramebuffer,this._renderArea,KM,0,0),i.bindDescriptorSet(xg.GLOBAL,e.descriptorSet);var o=n.passes[13];o.descriptorSet.bindBuffer(0,this._bloomUBO[13]),o.descriptorSet.bindTexture(1,r.outputRenderTargets[0]),o.descriptorSet.bindTexture(2,s.upsampleTexs[0]),o.descriptorSet.bindSampler(1,s.sampler),o.descriptorSet.bindSampler(2,s.sampler),o.descriptorSet.update(),i.bindDescriptorSet(xg.MATERIAL,o.descriptorSet);var h=t.window.swapchain?e.quadIAOffscreen:e.quadIAOnscreen,u=null,l=o.getShaderVariant();null!=o&&null!=l&&null!=h&&(u=dS.getOrCreatePipelineState(e.device,o,l,s.renderPass,h)),null!=u&&(i.bindPipelineState(u),i.bindInputAssembler(h),i.draw(h)),i.endRenderPass()},e}(DI)).initInfo={name:"BloomStage",priority:GI.BLOOM,tag:0},XM=Gs((WM=jM).prototype,"_bloomMaterial",[zM,ra],(function(){return null})),VM=WM))||VM)),$M=t("dg",qs("MainFlow")(((ZM=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.initialize=function(e){if(t.prototype.initialize.call(this,e),0===this._stages.length){var i=new HD;i.initialize(HD.initInfo),this._stages.push(i);var n=new fM;n.initialize(fM.initInfo),this._stages.push(n);var r=new JM;r.initialize(JM.initInfo),this._stages.push(r);var s=new mM;s.initialize(mM.initInfo),this._stages.push(s)}return!0},i.activate=function(e){t.prototype.activate.call(this,e)},i.render=function(e){t.prototype.render.call(this,e)},i.destroy=function(){t.prototype.destroy.call(this)},e}(PI)).initInfo={name:yg,priority:WI.MAIN,stages:[]},QM=ZM))||QM),tP=oS("shadow-caster");function eP(t){var e=t.passes,i=v.rendering;ny()&&(tP=i.getPhaseID(i.getPassID("default"),"shadow-caster"));for(var n=0;n<e.length;n++)if((!i||!i.enableEffectImport)&&e[n].phase===tP||ny()&&e[n].phaseID===tP)return n;return-1}var iP,nP,rP,sP,aP,oP,hP,uP,lP,cP=function(){function t(t){this._pipeline=void 0,this._subModelsArray=[],this._passArray=[],this._shaderArray=[],this._instancedQueue=void 0,this._pipeline=t,this._instancedQueue=new UD}var e=t.prototype;return e.gatherLightPasses=function(t,e,i,n){void 0===n&&(n=0),this.clear();var r=this._pipeline.pipelineSceneData,s=r.shadows;if(e&&s.enabled&&s.type===MS.ShadowMap){switch(e.type){case hx.DIRECTIONAL:var a=e;if(a.shadowEnabled){var o,h=r.csmLayers;!function(t,e,i){var n=t.scene.mainLight,r=e.csmLayers.layerObjects,s=i.validFrustum,a=i.shadowObjects;a.length=0;for(var o=t.visibility,h=r.length-1;h>=0;h--){var u=r.array[h];if(u){var l=u.model;l&&l.enabled&&l.node&&((o&l.node.layer)===l.node.layer||o&l.visFlags)&&l.worldBounds&&l.castShadow?us.aabbFrustum(l.worldBounds,s)&&(a.push(u),i.level<n.csmLevel&&n.csmOptimizationMode===NS.RemoveDuplicates&&us.aabbFrustumCompletelyInside(l.worldBounds,s)&&r.fastRemove(h)):r.fastRemove(h)}else r.fastRemove(h)}}(t,r,o=a.shadowFixedArea?h.specialLayer:h.layers[n]);for(var u=o.shadowObjects,l=0;l<u.length;l++){var c=u[l].model;this.add(c,n)}}break;case hx.SPOT:var _=e;if(_.shadowEnabled)for(var d=_.visibility,f=r.csmLayers.castShadowObjects,p=0;p<f.length;p++){var m=f[p].model;(!m.worldBounds||(d&m.node.layer)===m.node.layer&&us.aabbFrustum(m.worldBounds,_.frustum))&&this.add(m,n)}}this._instancedQueue.uploadBuffers(i)}},e.clear=function(){this._subModelsArray.length=0,this._shaderArray.length=0,this._passArray.length=0,this._instancedQueue.clear()},e.add=function(t,e){for(var i=t.subModels,n=0;n<i.length;n++){var r=i[n],s=eP(r);if(!(s<0)){var a=r.passes[s];if(a.batchingScheme===rS.INSTANCING){var o=a.getInstancedBuffer(e);o.merge(r,s),this._instancedQueue.queue.add(o)}else{var h=r.shaders[s];this._subModelsArray.push(r),h&&this._shaderArray.push(h),this._passArray.push(a)}}}},e.recordCommandBuffer=function(t,e,i){this._instancedQueue.recordCommandBuffer(t,e,i);for(var n=0;n<this._subModelsArray.length;++n){var r=this._subModelsArray[n],s=this._shaderArray[n],a=this._passArray[n],o=r.inputAssembler,h=dS.getOrCreatePipelineState(t,a,s,e,o),u=a.descriptorSet;i.bindPipelineState(h),i.bindDescriptorSet(xg.MATERIAL,u),i.bindDescriptorSet(xg.LOCAL,r.descriptorSet),i.bindInputAssembler(o),i.draw(o)}},t}(),_P=[new Xc(1,1,1,1)],dP=t("dm",qs("ShadowStage")(((nP=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._additiveShadowQueue=void 0,e._shadowFrameBuffer=null,e._renderArea=new Fc,e._light=null,e._globalDS=null,e._level=0,e._isShadowMapCleared=!1,e}s(e,t);var i=e.prototype;return i.setUsage=function(t,e,i,n){void 0===n&&(n=0),this._globalDS=t,this._light=e,this._shadowFrameBuffer=i,this._level=n},i.destroy=function(){var t;this._shadowFrameBuffer=null,this._globalDS=null,this._light=null,null===(t=this._additiveShadowQueue)||void 0===t||t.clear()},i.clearFramebuffer=function(t){if(this._light&&this._shadowFrameBuffer&&!this._isShadowMapCleared){_P[0].w=t.clearColor.w;var e=this._pipeline,i=e.pipelineSceneData,n=i.shadingScale,r=i.shadows,s=t.viewport,a=r.size;this._renderArea.x=s.x*a.x,this._renderArea.y=s.y*a.y,this._renderArea.width=s.width*a.x*n,this._renderArea.height=s.height*a.y*n;var o=e.commandBuffers[0],h=this._shadowFrameBuffer.renderPass;o.beginRenderPass(h,this._shadowFrameBuffer,this._renderArea,_P,t.clearDepth,t.clearStencil),o.endRenderPass(),this._isShadowMapCleared=!0}},i.render=function(t){var e=this._pipeline,i=e.pipelineSceneData,n=i.shadows,r=this._globalDS,s=e.commandBuffers[0],a=this._level,o=e.device;if(this._light&&this._shadowFrameBuffer){this._pipeline.pipelineUBO.updateShadowUBOLight(r,this._light,a),this._additiveShadowQueue.gatherLightPasses(t,this._light,s,a);var h=n.size;switch(this._light.type){case hx.DIRECTIONAL:var u=this._light;if(u.shadowFixedArea||u.csmLevel===BS.LEVEL_1||!i.csmSupported)this._renderArea.x=0,this._renderArea.y=0,this._renderArea.width=h.x,this._renderArea.height=h.y;else{var l=o.capabilities.screenSpaceSignY;this._renderArea.x=a%2*.5*h.x,this._renderArea.y=l>0?.5*(1-Math.floor(a/2))*h.y:.5*Math.floor(a/2)*h.y,this._renderArea.width=.5*h.x,this._renderArea.height=.5*h.y}break;case hx.SPOT:this._renderArea.x=0,this._renderArea.y=0,this._renderArea.width=h.x,this._renderArea.height=h.y}var c=this._shadowFrameBuffer.renderPass;s.beginRenderPass(c,this._shadowFrameBuffer,this._renderArea,_P,t.clearDepth,t.clearStencil),s.bindDescriptorSet(xg.GLOBAL,r),this._additiveShadowQueue.recordCommandBuffer(o,c,s),s.endRenderPass(),this._isShadowMapCleared=!1}},i.activate=function(e,i){t.prototype.activate.call(this,e,i),this._additiveShadowQueue=new cP(e),this._isShadowMapCleared=!1},e}(DI)).initInfo={name:"ShadowStage",priority:HI.FORWARD,tag:0},iP=nP))||iP),fP=[],pP=t("dl",qs("ShadowFlow")(((sP=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._shadowRenderPass=null,e}s(e,t);var i=e.prototype;return i.initialize=function(e){if(t.prototype.initialize.call(this,e),0===this._stages.length){var i=new dP;i.initialize(dP.initInfo),this._stages.push(i)}return!0},i.activate=function(e){t.prototype.activate.call(this,e);var i=ey(e.device)?0:1;e.macros.CC_SHADOWMAP_FORMAT=i;var n=e.device.gfxAPI===Vl.WEBGL?1:0;e.macros.CC_SHADOWMAP_USE_LINEAR_DEPTH=n,e.pipelineSceneData.csmSupported=e.device.capabilities.maxFragmentUniformVectors>=(Pg.COUNT+Bg.COUNT+Ng.COUNT+Lg.COUNT)/4,e.macros.CC_SUPPORT_CASCADED_SHADOW_MAP=e.pipelineSceneData.csmSupported,e.macros.CC_SHADOW_TYPE=0,e.macros.CC_DIR_SHADOW_PCF_TYPE=PS.HARD,e.macros.CC_DIR_LIGHT_SHADOW_TYPE=0,e.macros.CC_CASCADED_LAYERS_TRANSITION=0,e.onGlobalPipelineStateChanged()},i.render=function(t){var e=this._pipeline,i=e.pipelineSceneData.shadows,n=e.pipelineSceneData.csmLayers,r=e.pipelineSceneData.shadowFrameBufferMap,s=n.castShadowObjects,a=this._pipeline.pipelineSceneData.validPunctualLights;if(i.enabled&&i.type===MS.ShadowMap){for(var o=0,h=0;o<i.maxReceived&&h<a.length;){var u=a[h];u.type===hx.SPOT&&u.shadowEnabled&&(fP.push(u),o++),h++}if(0!==s.length){i.shadowMapDirty&&this.resizeShadowMap();var l=t.scene.mainLight;if(l&&l.shadowEnabled){var c=e.descriptorSet;r.has(l)||this._initShadowFrameBuffer(e,l,t.window.swapchain);var _=r.get(l);if(l.shadowFixedArea)this._renderStage(t,l,_,c);else for(var d=e.pipelineSceneData.csmSupported?l.csmLevel:1,f=0;f<d;f++)this._renderStage(t,l,_,c,f)}for(var p=0;p<fP.length;p++){var m=fP[p],g=e.globalDSManager.getOrCreateDescriptorSet(m);r.has(m)||this._initShadowFrameBuffer(e,m,t.window.swapchain);var v=r.get(m);this._renderStage(t,m,v,g)}fP.length=0}else this.clearShadowMap(fP,t)}},i.destroy=function(){if(t.prototype.destroy.call(this),this._pipeline){for(var e=this._pipeline.pipelineSceneData.shadowFrameBufferMap,i=Array.from(e.values()),n=0;n<i.length;n++){var r=i[n];if(r){for(var s=r.colorTextures,a=0;a<s.length;a++){var o=s[a];o&&o.destroy()}s.length=0;var h=r.depthStencilTexture;h&&h.destroy(),r.destroy()}}e.clear()}this._shadowRenderPass&&this._shadowRenderPass.destroy()},i._initShadowFrameBuffer=function(t,e){var i=t.device,n=t.pipelineSceneData.shadows.size,r=t.pipelineSceneData.shadowFrameBufferMap,s=ey(i)?jl.R32F:jl.RGBA8;if(!this._shadowRenderPass){var a=new p_;a.format=s,a.loadOp=dc.CLEAR,a.storeOp=fc.STORE,a.sampleCount=1;var o=new m_;o.format=jl.DEPTH_STENCIL,o.depthLoadOp=dc.CLEAR,o.depthStoreOp=fc.DISCARD,o.stencilLoadOp=dc.CLEAR,o.stencilStoreOp=fc.DISCARD,o.sampleCount=1;var h=new y_([a],o);this._shadowRenderPass=i.createRenderPass(h)}var u=[];u.push(i.createTexture(new t_($l.TEX2D,tc.COLOR_ATTACHMENT|tc.SAMPLED,s,n.x,n.y)));var l=i.createTexture(new t_($l.TEX2D,tc.DEPTH_STENCIL_ATTACHMENT,jl.DEPTH_STENCIL,n.x,n.y)),c=i.createFramebuffer(new A_(this._shadowRenderPass,u,l));r.set(e,c)},i._renderStage=function(t,e,i,n,r){void 0===r&&(r=0);for(var s=0;s<this._stages.length;s++){var a=this._stages[s];a.setUsage(n,e,i,r),a.render(t)}},i.clearShadowMap=function(t,e){var i=this._pipeline,n=i.pipelineSceneData,r=e.scene.mainLight;if(r){var s=this._pipeline.descriptorSet;n.shadowFrameBufferMap.has(r)||this._initShadowFrameBuffer(this._pipeline,r,e.window.swapchain);for(var a=n.shadowFrameBufferMap.get(r),o=0;o<this._stages.length;o++){var h=this._stages[o];h.setUsage(s,r,a),h.clearFramebuffer(e)}}for(var u=0;u<t.length;u++){var l=t[u],c=i.globalDSManager.getOrCreateDescriptorSet(l);n.shadowFrameBufferMap.has(l)||this._initShadowFrameBuffer(this._pipeline,l,e.window.swapchain);for(var _=n.shadowFrameBufferMap.get(l),d=0;d<this._stages.length;d++){var f=this._stages[d];f.setUsage(c,l,_),f.clearFramebuffer(e)}}},i.resizeShadowMap=function(){for(var t,e=this._pipeline.pipelineSceneData.shadows,i=e.size,n=this._pipeline,r=n.device,s=n.pipelineSceneData.shadowFrameBufferMap,a=ey(r)?jl.R32F:jl.RGBA8,o=d(s.keys());!(t=o()).done;){var h=t.value,u=s.get(h);if(u){var l=[];l.push(n.device.createTexture(new t_($l.TEX2D,tc.COLOR_ATTACHMENT|tc.SAMPLED,a,i.x,i.y)));var c=u.depthStencilTexture;c&&c.resize(i.x,i.y);var _=u.renderPass;u.destroy();var f=r.createFramebuffer(new A_(_,l,c));s.set(h,f)}}e.shadowMapDirty=!1},e}(PI)).initInfo={name:Sg,priority:zI.SHADOW,tag:pD.SCENE,stages:[]},rP=sP))||rP),mP=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).gbufferFrameBuffer=null,e.gbufferRenderTargets=[],e}return s(e,t),e}((function(){this.outputFrameBuffer=null,this.outputRenderTargets=[],this.outputDepth=null,this.sampler=null,this.bloom=null})),gP=t("df",(aP=qs("DeferredPipeline"),oP=xa([ED]),aP((uP=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._gbufferRenderPass=null,e._lightingRenderPass=null,e.renderTextures=lP&&lP(),e}s(e,t);var i=e.prototype;return i.initialize=function(e){if(t.prototype.initialize.call(this,e),0===this._flows.length){var i=new pP;i.initialize(pP.initInfo),this._flows.push(i);var n=new $M;n.initialize($M.initInfo),this._flows.push(n)}return!0},i.activate=function(e){return this._macros={CC_PIPELINE_TYPE:1},this._pipelineSceneData=new YM,!(!t.prototype.activate.call(this,e)||!this._activeRenderer(e)&&(Z(2402),1))},i.destroy=function(){this._destroyUBOs(),this._destroyQuadInputAssembler(),this._destroyDeferredData();for(var e=this._renderPasses.values(),i=e.next();!i.done;)i.value.destroy(),i=e.next();return this._commandBuffers.length=0,t.prototype.destroy.call(this)},i.onGlobalPipelineStateChanged=function(){this.pipelineSceneData.updatePipelineSceneData()},i.getPipelineRenderData=function(){return this._pipelineRenderData||this._generateDeferredRenderData(),this._pipelineRenderData},i._activeRenderer=function(t){var e=this.device;this._commandBuffers.push(e.commandBuffer);var i=this.globalDSManager.pointSampler;this._descriptorSet.bindSampler(Fg,i),this._descriptorSet.bindTexture(Fg,aS.get("default-texture").getGFXTexture()),this._descriptorSet.bindSampler(jg,i),this._descriptorSet.bindTexture(jg,aS.get("default-texture").getGFXTexture()),this._descriptorSet.update();var n=new TD;if(!(n=this._createQuadInputAssembler()).quadIB||!n.quadVB||!n.quadIA)return!1;this._quadIB=n.quadIB,this._quadVBOffscreen=n.quadVB,this._quadIAOffscreen=n.quadIA;var r=this._createQuadInputAssembler();if(!r.quadIB||!r.quadVB||!r.quadIA)return!1;if(this._quadVBOnscreen=r.quadVB,this._quadIAOnscreen=r.quadIA,!this._gbufferRenderPass){var s=new p_;s.format=jl.RGBA16F,s.loadOp=dc.CLEAR,s.storeOp=fc.STORE;var a=new p_;a.format=jl.RGBA16F,a.loadOp=dc.CLEAR,a.storeOp=fc.STORE;var o=new p_;o.format=jl.RGBA16F,o.loadOp=dc.CLEAR,o.storeOp=fc.STORE;var h=new m_;h.format=jl.DEPTH_STENCIL,h.depthLoadOp=dc.CLEAR,h.depthStoreOp=fc.STORE,h.stencilLoadOp=dc.CLEAR,h.stencilStoreOp=fc.STORE;var u=new y_([s,a,o],h);this._gbufferRenderPass=e.createRenderPass(u)}if(!this._lightingRenderPass){var l=new p_;l.format=jl.RGBA8,l.loadOp=dc.CLEAR,l.storeOp=fc.STORE,l.barrier=e.getGeneralBarrier(new T_(pc.NONE,pc.COLOR_ATTACHMENT_WRITE));var c=new m_;c.format=jl.DEPTH_STENCIL,c.depthLoadOp=dc.LOAD,c.depthStoreOp=fc.DISCARD,c.stencilLoadOp=dc.LOAD,c.stencilStoreOp=fc.DISCARD,l.barrier=e.getGeneralBarrier(new T_(pc.DEPTH_STENCIL_ATTACHMENT_WRITE,pc.DEPTH_STENCIL_ATTACHMENT_WRITE));var _=new y_([l],c);this._lightingRenderPass=e.createRenderPass(_)}return this._width=t.width,this._height=t.height,this._generateDeferredRenderData(),!0},i._destroyUBOs=function(){this._descriptorSet&&(this._descriptorSet.getBuffer(Pg.BINDING).destroy(),this._descriptorSet.getBuffer(Ng.BINDING).destroy(),this._descriptorSet.getBuffer(Bg.BINDING).destroy(),this._descriptorSet.getTexture(Fg).destroy(),this._descriptorSet.getTexture(jg).destroy())},i._destroyDeferredData=function(){var t=this._pipelineRenderData;if(t){t.gbufferFrameBuffer&&t.gbufferFrameBuffer.destroy(),t.outputFrameBuffer&&t.outputFrameBuffer.destroy(),t.outputDepth&&t.outputDepth.destroy();for(var e=0;e<t.gbufferRenderTargets.length;e++)t.gbufferRenderTargets[e].destroy();t.gbufferRenderTargets.length=0;for(var i=0;i<t.outputRenderTargets.length;i++)t.outputRenderTargets[i].destroy();t.outputRenderTargets.length=0,this._destroyBloomData()}this._pipelineRenderData=null},i._ensureEnoughSize=function(t){for(var e=this._width,i=this._height,n=0;n<t.length;++n){var r=t[n].window;e=Math.max(r.width,e),i=Math.max(r.height,i)}e===this._width&&i===this._height||(this._width=e,this._height=i,this._destroyDeferredData(),this._generateDeferredRenderData())},i._generateDeferredRenderData=function(){for(var t=this,e=this.device,i=this._pipelineRenderData=new mP,n=this.pipelineSceneData,r=0;r<3;++r)i.gbufferRenderTargets.push(e.createTexture(new t_($l.TEX2D,tc.COLOR_ATTACHMENT|tc.SAMPLED,jl.RGBA16F,this._width*n.shadingScale,this._height*n.shadingScale)));i.outputDepth=e.createTexture(new t_($l.TEX2D,tc.DEPTH_STENCIL_ATTACHMENT|tc.SAMPLED,jl.DEPTH_STENCIL,this._width*n.shadingScale,this._height*n.shadingScale)),i.gbufferFrameBuffer=e.createFramebuffer(new A_(this._gbufferRenderPass,i.gbufferRenderTargets,i.outputDepth)),i.outputRenderTargets.push(e.createTexture(new t_($l.TEX2D,tc.COLOR_ATTACHMENT|tc.SAMPLED,jl.RGBA16F,this._width*n.shadingScale,this._height*n.shadingScale))),i.outputFrameBuffer=e.createFramebuffer(new A_(this._lightingRenderPass,i.outputRenderTargets,null)),i.sampler=this.globalDSManager.pointSampler,this.on(MI.ATTACHMENT_SCALE_CAHNGED,(function(e){i.sampler=e<1?t.globalDSManager.pointSampler:t.globalDSManager.linearSampler,i.gbufferFrameBuffer=t.newFramebufferByRatio(i.gbufferFrameBuffer),i.gbufferFrameBuffer=t.newFramebufferByRatio(i.outputFrameBuffer)}))},e}(SD),lP=Gs(uP.prototype,"renderTextures",[oP,ra],(function(){return[]})),hP=uP))||hP)),vP=new Pu((function(){return{subModel:null,passIdx:-1,dynamicOffsets:[],lights:[]}}),16),yP=new hn,TP=new Float32Array(4),SP=[],EP=[],AP=new Dn,RP=new Dn,bP=new Es(0,0,0,.5,.5,.5),CP=new Es;function wP(t,e){return!(!e.worldBounds||us.aabbWithAABB(e.worldBounds,t.aabb))}function xP(t,e){return!(!e.worldBounds||us.aabbWithAABB(e.worldBounds,t.aabb)&&us.aabbFrustum(e.worldBounds,t.frustum))}function IP(t,e){return!(!e.worldBounds||us.aabbWithAABB(e.worldBounds,t.aabb))}function OP(t,e){return Es.transform(CP,bP,t.node.getWorldMatrix()),!(!e.worldBounds||us.aabbWithAABB(e.worldBounds,CP))}var DP="forward-add",MP=oS(DP),PP=[];function BP(t,e,i){void 0===i&&(i="default");var n=v.rendering;ny()&&(MP=n.getPhaseID(n.getPassID(i),DP)),e.length=0;for(var r=!1,s=0;s<t.length;s++){for(var a=t[s].passes,o=-1,h=0;h<a.length;h++)if((!n||!n.enableEffectImport)&&a[h].phase===MP||ny()&&a[h].phaseID===MP){o=h,r=!0;break}e.push(o)}return r}var NP,LP,FP,kP,UP,GP,HP,zP,VP=function(){function t(t){this._pipeline=void 0,this._device=void 0,this._lightPasses=[],this._instancedLightPassPool=vP.alloc(),this._shadowUBO=new Float32Array(Ng.COUNT),this._lightBufferCount=16,this._lightBufferStride=void 0,this._lightBufferElementCount=void 0,this._lightBuffer=void 0,this._firstLightBufferView=void 0,this._lightBufferData=void 0,this._instancedQueues=[],this._lightMeterScale=1e4,this._pipeline=t,this._device=t.device;var e=this._device.capabilities.uboOffsetAlignment;this._lightBufferStride=Math.ceil(tv.SIZE/e)*e,this._lightBufferElementCount=this._lightBufferStride/Float32Array.BYTES_PER_ELEMENT,this._lightBuffer=this._device.createBuffer(new qc(ql.UNIFORM|ql.TRANSFER_DST,Jl.HOST|Jl.DEVICE,this._lightBufferStride*this._lightBufferCount,this._lightBufferStride)),this._firstLightBufferView=this._device.createBuffer(new Qc(this._lightBuffer,0,tv.SIZE)),this._lightBufferData=new Float32Array(this._lightBufferElementCount*this._lightBufferCount)}var e=t.prototype;return e.clear=function(){this._instancedQueues.forEach((function(t){t.clear()})),this._instancedQueues.length=0;for(var t=0;t<this._lightPasses.length;t++){var e=this._lightPasses[t];e.dynamicOffsets.length=0,e.lights.length=0}vP.freeArray(this._lightPasses),this._lightPasses.length=0,this._instancedLightPassPool.dynamicOffsets.length=0,this._instancedLightPassPool.lights.length=0},e.destroy=function(){for(var t=this._pipeline.globalDSManager.descriptorSetMap,e=t.keys,i=0;i<e.length;i++){var n=e[i],r=t.get(n);if(r){var s=ny()?Qx("CCShadow"):Ng.BINDING;r.getBuffer(s).destroy(),r.getTexture(Fg).destroy(),r.getTexture(jg).destroy(),r.destroy()}t.delete(n)}},e._bindForwardAddLight=function(t,e){void 0===e&&(e="default");for(var i=this._pipeline.pipelineSceneData.renderObjects,n=0;n<i.length;n++){var r=i[n].model,s=r.subModels;if(BP(s,PP,e)&&(EP.length=0,this._lightCulling(r,t),EP.length||!(t.length>0)))for(var a=0;a<s.length;a++){var o=PP[a];if(!(o<0)){var h=s[a],u=h.passes[o];h.passes[0].blendState.targets[0].blend||(ny()&&Qx("CCForwardLight"),h.descriptorSet.bindBuffer(tv.BINDING,this._firstLightBufferView),h.descriptorSet.update(),this._addRenderQueue(u,h,r,o))}}}},e.gatherLightPasses=function(t,e,i){void 0===i&&(i="default"),this.clear();var n=this._pipeline.pipelineSceneData.validPunctualLights;if(n.length){this._updateUBOs(t,e),this._updateLightDescriptorSet(t,e),this._bindForwardAddLight(n,i);for(var r=0;r<n.length;r++){var s=n[r];this._instancedLightPassPool.lights.push(s),this._instancedLightPassPool.dynamicOffsets.push(this._lightBufferStride*r)}this._instancedQueues.forEach((function(t){t.uploadBuffers(e)}))}else this._bindForwardAddLight(n,i)},e.recordCommandBuffer=function(t,e,i){for(var n=this._pipeline.globalDSManager,r=0;r<this._instancedQueues.length;++r){var s=this._instancedLightPassPool.lights[r];SP[0]=this._instancedLightPassPool.dynamicOffsets[r];var a=n.getOrCreateDescriptorSet(s);this._instancedQueues[r].recordCommandBuffer(t,e,i,a,SP)}for(var o=0;o<this._lightPasses.length;o++){var h=this._lightPasses[o],u=h.subModel,l=h.passIdx,c=h.dynamicOffsets,_=h.lights,d=u.passes[l],f=u.shaders[l],p=u.inputAssembler,m=dS.getOrCreatePipelineState(t,d,f,e,p),g=d.descriptorSet,v=u.descriptorSet;i.bindPipelineState(m),i.bindDescriptorSet(xg.MATERIAL,g),i.bindInputAssembler(p);for(var y=0;y<c.length;++y){var T=_[y],S=n.getOrCreateDescriptorSet(T);SP[0]=c[y],i.bindDescriptorSet(xg.GLOBAL,S),i.bindDescriptorSet(xg.LOCAL,v,SP),i.draw(p)}}},e._lightCulling=function(t,e){for(var i=!1,n=0;n<e.length;n++){var r=e[n];switch(r.type){case hx.SPHERE:i=wP(r,t);break;case hx.SPOT:i=xP(r,t);break;case hx.POINT:i=IP(r,t);break;case hx.RANGED_DIRECTIONAL:i=OP(r,t)}i||EP.push(n)}},e._addRenderQueue=function(t,e,i,n){var r=this._pipeline.pipelineSceneData.validPunctualLights,s=t.batchingScheme,a=null;s===rS.NONE&&((a=vP.alloc()).subModel=e,a.passIdx=n);for(var o=0;o<EP.length;o++){var h=EP[o],u=r[h];if((u.visibility&i.node.layer)===i.node.layer)switch(s){case rS.INSTANCING:var l=t.getInstancedBuffer(o);l.merge(e,n),l.dynamicOffsets[0]=this._lightBufferStride,this._instancedQueues[o]||(this._instancedQueues[o]=new UD),this._instancedQueues[o].queue.add(l);break;default:a.lights.push(u),a.dynamicOffsets.push(this._lightBufferStride*h)}}s===rS.NONE&&this._lightPasses.push(a)},e._updateLightDescriptorSet=function(t,e){for(var i=this._pipeline.device,n=this._pipeline.pipelineSceneData,r=n.shadows,s=n.shadowFrameBufferMap,a=t.scene.mainLight,o=ey(i)?0:1,h=this._pipeline.globalDSManager,u=n.validPunctualLights,l=this._pipeline.device.capabilities,c=0;c<u.length;c++){var _=u[c],d=h.getOrCreateDescriptorSet(_);if(d){var f=void 0,p=void 0;switch(_.type){case hx.SPHERE:a&&EI.updatePlanarNormalAndDistance(r,this._shadowUBO),this._shadowUBO[Ng.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+0]=r.size.x,this._shadowUBO[Ng.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+1]=r.size.y,this._shadowUBO[Ng.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+2]=1,this._shadowUBO[Ng.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+3]=0,this._shadowUBO[Ng.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+0]=hx.SPHERE,this._shadowUBO[Ng.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+1]=o,this._shadowUBO[Ng.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+2]=0,this._shadowUBO[Ng.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+3]=0,pn.toArray(this._shadowUBO,r.shadowColor,Ng.SHADOW_COLOR_OFFSET);break;case hx.SPOT:var m=_;if(a&&EI.updatePlanarNormalAndDistance(r,this._shadowUBO),Dn.invert(AP,_.node.getWorldMatrix()),Dn.perspective(RP,_.angle,1,.001,_.range,!0,l.clipSpaceMinZ,l.clipSpaceSignY,0),f=RP.clone(),p=RP.clone().invert(),Dn.multiply(RP,RP,AP),Dn.toArray(this._shadowUBO,AP,Ng.MAT_LIGHT_VIEW_OFFSET),Dn.toArray(this._shadowUBO,RP,Ng.MAT_LIGHT_VIEW_PROJ_OFFSET),this._shadowUBO[Ng.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET+0]=.01,this._shadowUBO[Ng.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET+1]=_.range,this._shadowUBO[Ng.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET+2]=0,this._shadowUBO[Ng.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET+3]=0,this._shadowUBO[Ng.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+0]=r.size.x,this._shadowUBO[Ng.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+1]=r.size.y,this._shadowUBO[Ng.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+2]=m.shadowPcf,this._shadowUBO[Ng.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+3]=m.shadowBias,this._shadowUBO[Ng.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+0]=hx.SPOT,this._shadowUBO[Ng.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+1]=o,this._shadowUBO[Ng.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+2]=m.shadowNormalBias,this._shadowUBO[Ng.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+3]=0,this._shadowUBO[Ng.SHADOW_PROJ_DEPTH_INFO_OFFSET+0]=f.m10,this._shadowUBO[Ng.SHADOW_PROJ_DEPTH_INFO_OFFSET+1]=f.m14,this._shadowUBO[Ng.SHADOW_PROJ_DEPTH_INFO_OFFSET+2]=f.m11,this._shadowUBO[Ng.SHADOW_PROJ_DEPTH_INFO_OFFSET+3]=f.m15,this._shadowUBO[Ng.SHADOW_INV_PROJ_DEPTH_INFO_OFFSET+0]=p.m10,this._shadowUBO[Ng.SHADOW_INV_PROJ_DEPTH_INFO_OFFSET+1]=p.m14,this._shadowUBO[Ng.SHADOW_INV_PROJ_DEPTH_INFO_OFFSET+2]=p.m11,this._shadowUBO[Ng.SHADOW_INV_PROJ_DEPTH_INFO_OFFSET+3]=p.m15,this._shadowUBO[Ng.SHADOW_PROJ_INFO_OFFSET+0]=f.m00,this._shadowUBO[Ng.SHADOW_PROJ_INFO_OFFSET+1]=f.m05,this._shadowUBO[Ng.SHADOW_PROJ_INFO_OFFSET+2]=1/f.m00,this._shadowUBO[Ng.SHADOW_PROJ_INFO_OFFSET+3]=1/f.m05,pn.toArray(this._shadowUBO,r.shadowColor,Ng.SHADOW_COLOR_OFFSET),s.has(_)){var g,v=null===(g=s.get(_))||void 0===g?void 0:g.colorTextures[0];v&&d.bindTexture(jg,v)}break;case hx.POINT:a&&EI.updatePlanarNormalAndDistance(r,this._shadowUBO),this._shadowUBO[Ng.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+0]=r.size.x,this._shadowUBO[Ng.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+1]=r.size.y,this._shadowUBO[Ng.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+2]=1,this._shadowUBO[Ng.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+3]=0,this._shadowUBO[Ng.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+0]=hx.POINT,this._shadowUBO[Ng.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+1]=o,this._shadowUBO[Ng.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+2]=0,this._shadowUBO[Ng.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+3]=0,pn.toArray(this._shadowUBO,r.shadowColor,Ng.SHADOW_COLOR_OFFSET)}d.update();var y=ny()?Qx("CCShadow"):Ng.BINDING;e.updateBuffer(d.getBuffer(y),this._shadowUBO)}}},e._updateUBOs=function(t,e){var i=t.exposure,n=this._pipeline.pipelineSceneData,r=n.isHDR,s=n.shadows,a=n.validPunctualLights;a.length>this._lightBufferCount&&(this._firstLightBufferView.destroy(),this._lightBufferCount=Hi(a.length),this._lightBuffer.resize(this._lightBufferStride*this._lightBufferCount),this._lightBufferData=new Float32Array(this._lightBufferElementCount*this._lightBufferCount),this._firstLightBufferView=wd.gfxDevice.createBuffer(new Qc(this._lightBuffer,0,tv.SIZE)));for(var o=0,h=0;o<a.length;o++,h+=this._lightBufferElementCount){var u=a[o];switch(u.type){case hx.SPHERE:if(hn.toArray(TP,u.position),TP[3]=hx.SPHERE,this._lightBufferData.set(TP,h+tv.LIGHT_POS_OFFSET),TP[0]=u.size,TP[1]=u.range,TP[2]=0,TP[3]=0,this._lightBufferData.set(TP,h+tv.LIGHT_SIZE_RANGE_ANGLE_OFFSET),hn.toArray(TP,u.color),u.useColorTemperature){var l=u.finalColor;TP[0]=l.x,TP[1]=l.y,TP[2]=l.z}TP[3]=r?u.luminance*i*this._lightMeterScale:u.luminance,this._lightBufferData.set(TP,h+tv.LIGHT_COLOR_OFFSET);break;case hx.SPOT:if(hn.toArray(TP,u.position),TP[3]=hx.SPOT,this._lightBufferData.set(TP,h+tv.LIGHT_POS_OFFSET),TP[0]=u.size,TP[1]=u.range,TP[2]=u.spotAngle,TP[3]=s.enabled&&u.shadowEnabled&&s.type===MS.ShadowMap?1:0,this._lightBufferData.set(TP,h+tv.LIGHT_SIZE_RANGE_ANGLE_OFFSET),hn.toArray(TP,u.direction),this._lightBufferData.set(TP,h+tv.LIGHT_DIR_OFFSET),hn.toArray(TP,u.color),u.useColorTemperature){var c=u.finalColor;TP[0]=c.x,TP[1]=c.y,TP[2]=c.z}TP[3]=r?u.luminance*i*this._lightMeterScale:u.luminance,this._lightBufferData.set(TP,h+tv.LIGHT_COLOR_OFFSET);break;case hx.POINT:if(hn.toArray(TP,u.position),TP[3]=hx.POINT,this._lightBufferData.set(TP,h+tv.LIGHT_POS_OFFSET),TP[0]=0,TP[1]=u.range,TP[2]=0,TP[3]=0,this._lightBufferData.set(TP,h+tv.LIGHT_SIZE_RANGE_ANGLE_OFFSET),hn.toArray(TP,u.color),u.useColorTemperature){var _=u.finalColor;TP[0]=_.x,TP[1]=_.y,TP[2]=_.z}TP[3]=r?u.luminance*i*this._lightMeterScale:u.luminance,this._lightBufferData.set(TP,h+tv.LIGHT_COLOR_OFFSET);break;case hx.RANGED_DIRECTIONAL:hn.toArray(TP,u.position),TP[3]=hx.RANGED_DIRECTIONAL,this._lightBufferData.set(TP,h+tv.LIGHT_POS_OFFSET),hn.toArray(TP,u.right),TP[3]=0,this._lightBufferData.set(TP,h+tv.LIGHT_SIZE_RANGE_ANGLE_OFFSET),hn.toArray(TP,u.direction),TP[3]=0,this._lightBufferData.set(TP,h+tv.LIGHT_DIR_OFFSET);var d=u.scale;if(yP.set(.5*d.x,.5*d.y,.5*d.z),hn.toArray(TP,yP),TP[3]=0,this._lightBufferData.set(TP,h+tv.LIGHT_BOUNDING_SIZE_VS_OFFSET),hn.toArray(TP,u.color),u.useColorTemperature){var f=u.finalColor;TP[0]=f.x,TP[1]=f.y,TP[2]=f.z}TP[3]=r?u.illuminance*i:u.illuminance,this._lightBufferData.set(TP,h+tv.LIGHT_COLOR_OFFSET)}}e.updateBuffer(this._lightBuffer,this._lightBufferData)},t}(),WP=[new Xc(0,0,0,1)],XP=t("de",(NP=qs("ForwardStage"),LP=xa([CD]),NP(((GP=function(t){function e(){var e;return(e=t.call(this)||this).renderQueues=UP&&UP(),e._renderQueues=[],e._renderArea=new Fc,e._instancedQueue=void 0,e._phaseID=oS("default"),e._clearFlag=4294967295,e.additiveInstanceQueues=[],e._instancedQueue=new UD,e._uiPhase=new uM,e}s(e,t);var i=e.prototype;return i.addRenderInstancedQueue=function(t){this.additiveInstanceQueues.includes(t)||this.additiveInstanceQueues.push(t)},i.removeRenderInstancedQueue=function(t){var e=this.additiveInstanceQueues.indexOf(t);e>-1&&this.additiveInstanceQueues.splice(e,1)},i.initialize=function(e){return t.prototype.initialize.call(this,e),e.renderQueues&&(this.renderQueues=e.renderQueues),!0},i.activate=function(e,i){t.prototype.activate.call(this,e,i);for(var n=0;n<this.renderQueues.length;n++)this._renderQueues[n]=OD(this.renderQueues[n]);this._additiveLightQueue=new VP(this._pipeline),this._planarQueue=new hM(this._pipeline),this._uiPhase.activate(e)},i.destroy=function(){},i.render=function(t){var e;this._instancedQueue.clear();var i=this._pipeline,n=i.device;this._renderQueues.forEach(DD);for(var r=i.pipelineSceneData.renderObjects,s=0,a=0,o=0,h=0;h<r.length;++h){var u=r[h],l=u.model.subModels;for(s=0;s<l.length;++s){var c=l[s],_=c.passes;for(a=0;a<_.length;++a){var d=_[a];if(d.phase===this._phaseID)if(d.batchingScheme===rS.INSTANCING){var f=d.getInstancedBuffer();f.merge(c,a),this._instancedQueue.queue.add(f)}else for(o=0;o<this._renderQueues.length;o++)this._renderQueues[o].insertRenderPass(u,s,a)}}}this._instancedQueue.sort(),this._renderQueues.forEach(MD);var p=i.commandBuffers[0];i.pipelineUBO.updateShadowUBO(t);for(var m=0;m<this.additiveInstanceQueues.length;m++)this.additiveInstanceQueues[m].uploadBuffers(p);this._instancedQueue.uploadBuffers(p),this._additiveLightQueue.gatherLightPasses(t,p),this._planarQueue.gatherShadowPasses(t,p),t.clearFlag&xc.COLOR&&(WP[0].x=t.clearColor.x,WP[0].y=t.clearColor.y,WP[0].z=t.clearColor.z,WP[0].w=t.clearColor.w),i.generateRenderArea(t,this._renderArea);var g=t.window.framebuffer,v=i.getRenderPass(t.clearFlag&this._clearFlag,g);p.beginRenderPass(v,g,this._renderArea,WP,t.clearDepth,t.clearStencil),p.bindDescriptorSet(xg.GLOBAL,i.descriptorSet),this._renderQueues[0].recordCommandBuffer(n,v,p);for(var y=0;y<this.additiveInstanceQueues.length;y++)this.additiveInstanceQueues[y].recordCommandBuffer(n,v,p);this._instancedQueue.recordCommandBuffer(n,v,p),this._additiveLightQueue.recordCommandBuffer(n,v,p),p.bindDescriptorSet(xg.GLOBAL,i.descriptorSet),this._planarQueue.recordCommandBuffer(n,v,p),this._renderQueues[1].recordCommandBuffer(n,v,p),null===(e=t.geometryRenderer)||void 0===e||e.render(v,p,i.pipelineSceneData),this._uiPhase.render(t,v),xS(n,v,p,i.profiler,t),p.endRenderPass()},e}(DI)).initInfo={name:"ForwardStage",priority:HI.FORWARD,tag:0,renderQueues:[{isTransparent:!1,sortMode:AD.FRONT_TO_BACK,stages:["default"]},{isTransparent:!0,sortMode:AD.BACK_TO_FRONT,stages:["default","planarShadow"]}]},UP=Gs((kP=GP).prototype,"renderQueues",[LP,ra],(function(){return[]})),FP=kP))||FP)),jP=t("dd",qs("ForwardFlow")(((zP=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.initialize=function(e){if(t.prototype.initialize.call(this,e),0===this._stages.length){var i=new XP;i.initialize(XP.initInfo),this._stages.push(i)}return!0},i.activate=function(e){t.prototype.activate.call(this,e)},i.render=function(e){t.prototype.render.call(this,e)},i.destroy=function(){t.prototype.destroy.call(this)},e}(PI)).initInfo={name:Tg,priority:zI.FORWARD,stages:[]},HP=zP))||HP),YP="CC_USE_RGBE_OUTPUT",KP=oS("default"),qP=oS("reflect-map");function QP(t){var e=t.passes,i=v.rendering;ny()&&(KP=i.getPhaseID(i.getPassID("default"),"default"));for(var n=0;n<e.length;n++)if((!i||!i.enableEffectImport)&&e[n].phase===KP||ny()&&e[n].phaseID===KP)return n;return-1}function ZP(t){var e=t.passes,i=v.rendering;ny()&&(qP=i.getPhaseID(i.getPassID("default"),"reflect-map"));for(var n=0;n<e.length;n++)if((!i||!i.enableEffectImport)&&e[n].phase===qP||ny()&&e[n].phaseID===qP)return n;return-1}var JP,$P,tB,eB,iB,nB,rB,sB,aB,oB=function(){function t(t){this._pipeline=void 0,this._subModelsArray=[],this._passArray=[],this._shaderArray=[],this._rgbeSubModelsArray=[],this._instancedQueue=void 0,this._patches=[],this._pipeline=t,this._instancedQueue=new UD}var e=t.prototype;return e.gatherRenderObjects=function(t,e,i){this.clear();var n=e.scene,r=this._pipeline.pipelineSceneData.skybox;r.enabled&&r.model&&t.camera.clearFlag&Ww&&this.add(r.model);for(var s=n.models,a=t.visibility,o=0;o<s.length;o++){var h=s[o];h.node&&!n.isCulledByLod(e,h)&&((a&h.node.layer)===h.node.layer||a&h.visFlags)&&h.enabled&&h.worldBounds&&h.bakeToReflectionProbe&&(t.probeType===rx.CUBE?us.aabbWithAABB(h.worldBounds,t.boundingBox)&&this.add(h):us.aabbFrustum(h.worldBounds,t.camera.frustum)&&this.add(h))}this._instancedQueue.uploadBuffers(i)},e.clear=function(){this._subModelsArray.length=0,this._shaderArray.length=0,this._passArray.length=0,this._instancedQueue.clear(),this._rgbeSubModelsArray.length=0},e.add=function(t){for(var e=t.subModels,i=0;i<e.length;i++){var n=e[i];if(!n.passes[0].blendState.targets[0].blend){var r=ZP(n),s=!0;if(r<0&&(r=QP(n),s=!1),!(r<0)){var a=n.passes[r],o=a.batchingScheme;if(!s){this._patches=[],this._patches=this._patches.concat(n.patches);var h=[{name:YP,value:!0}];this._patches=this._patches.concat(h),n.onMacroPatchesStateChanged(this._patches),this._rgbeSubModelsArray.push(n)}if(o===rS.INSTANCING){var u=a.getInstancedBuffer();u.merge(n,r),this._instancedQueue.queue.add(u)}else{var l=n.shaders[r];this._subModelsArray.push(n),l&&this._shaderArray.push(l),this._passArray.push(a)}}}}},e.recordCommandBuffer=function(t,e,i){this._instancedQueue.recordCommandBuffer(t,e,i);for(var n=0;n<this._subModelsArray.length;++n){var r=this._subModelsArray[n],s=this._shaderArray[n],a=this._passArray[n],o=r.inputAssembler,h=dS.getOrCreatePipelineState(t,a,s,e,o),u=a.descriptorSet;i.bindPipelineState(h),i.bindDescriptorSet(xg.MATERIAL,u),i.bindDescriptorSet(xg.LOCAL,r.descriptorSet),i.bindInputAssembler(o),i.draw(o)}this.resetRGBEMacro(),this._instancedQueue.clear()},e.resetRGBEMacro=function(){for(var t=0;t<this._rgbeSubModelsArray.length;t++){this._patches=[];var e=this._rgbeSubModelsArray[t];if(this._patches=this._patches.concat(e.patches),this._patches){for(var i=0;i<this._patches.length;i++)if(this._patches[i].name===YP){this._patches.splice(i,1);break}e.onMacroPatchesStateChanged(this._patches)}}},t}(),hB=[new Xc(1,1,1,1)],uB=t("du",qs("ReflectionProbeStage")((($P=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._frameBuffer=null,e._renderArea=new Fc,e._probe=null,e._probeRenderQueue=void 0,e._rgbeColor=new hn,e}s(e,t);var i=e.prototype;return i.setUsageInfo=function(t,e){this._probe=t,this._frameBuffer=e},i.destroy=function(){var t;this._frameBuffer=null,null===(t=this._probeRenderQueue)||void 0===t||t.clear()},i.clearFramebuffer=function(t){if(this._frameBuffer){hB[0].w=t.clearColor.w;var e=this._pipeline,i=e.pipelineSceneData.shadingScale,n=t.viewport,r=this._probe.resolution;this._renderArea.x=n.x*r,this._renderArea.y=n.y*r,this._renderArea.width=n.width*r*i,this._renderArea.height=n.height*r*i;var s=e.commandBuffers[0],a=this._frameBuffer.renderPass;s.beginRenderPass(a,this._frameBuffer,this._renderArea,hB,t.clearDepth,t.clearStencil),s.endRenderPass()}},i.render=function(t){var e=this._pipeline,i=e.commandBuffers[0];this._probeRenderQueue.gatherRenderObjects(this._probe,t,i),e.pipelineUBO.updateCameraUBO(this._probe.camera),this._renderArea.x=0,this._renderArea.y=0,this._renderArea.width=this._probe.renderArea().x,this._renderArea.height=this._probe.renderArea().y;var n=this._frameBuffer.renderPass;if(this._probe.camera.clearFlag&xc.COLOR){this._rgbeColor.x=this._probe.camera.clearColor.x,this._rgbeColor.y=this._probe.camera.clearColor.y,this._rgbeColor.z=this._probe.camera.clearColor.z;var r=function(t){var e=Math.max(Math.max(t.x,t.y),t.z),i=128;e>1e-4&&(i=Math.log(e)/Math.log(1.1),i=Ii((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 hn(0,0,0),new hn(1,1,1));r.multiplyScalar(255);var s,a,o=gn(r).add((s=r.subtract(gn(r)))<(a=new hn(.5,.5,.5))?a:s);return new nn(o.x/255,o.y/255,o.z/255,i/255)}(this._rgbeColor);hB[0].x=r.x,hB[0].y=r.y,hB[0].z=r.z,hB[0].w=r.w}var s=e.device;i.beginRenderPass(n,this._frameBuffer,this._renderArea,hB,this._probe.camera.clearDepth,this._probe.camera.clearStencil),i.bindDescriptorSet(xg.GLOBAL,e.descriptorSet),this._probeRenderQueue.recordCommandBuffer(s,n,i),i.endRenderPass(),e.pipelineUBO.updateCameraUBO(t)},i.activate=function(e,i){t.prototype.activate.call(this,e,i),this._probeRenderQueue=new oB(e)},e}(DI)).initInfo={name:"ReflectionProbeStage",priority:HI.FORWARD,tag:0},JP=$P))||JP),lB=t("dt",qs("ReflectionProbeFlow")(((eB=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.initialize=function(e){if(t.prototype.initialize.call(this,e),0===this._stages.length){var i=new uB;i.initialize(uB.initInfo),this._stages.push(i)}return!0},i.activate=function(e){t.prototype.activate.call(this,e)},i.render=function(t){if(v.internal.reflectionProbeManager)for(var e=v.internal.reflectionProbeManager.getProbes(),i=0;i<e.length;i++)e[i].needRender&&e[i].probeType===rx.PLANAR&&this._renderStage(t,e[i])},i.destroy=function(){t.prototype.destroy.call(this)},i._renderStage=function(t,e){for(var i=0;i<this._stages.length;i++){var n=this._stages[i];if(e.probeType===rx.PLANAR)v.internal.reflectionProbeManager.updatePlanarMap(e,null),n.setUsageInfo(e,e.realtimePlanarTexture.window.framebuffer),n.render(t),v.internal.reflectionProbeManager.updatePlanarMap(e,e.realtimePlanarTexture.getGFXTexture());else{for(var r=0;r<6;r++){var s=e.bakedCubeTextures[r];if(!s)return;e.updateCameraDir(r),n.setUsageInfo(e,s.window.framebuffer),n.render(t)}e.needRender=!1}}},e}(PI)).initInfo={name:"PIPELINE_FLOW_RELECTION_PROBE",priority:0,tag:pD.SCENE,stages:[]},tB=eB))||tB);function cB(){var t=new dB;return t.initialize({flows:[]}),t}var _B,dB=t("db",(iB=qs("ForwardPipeline"),nB=xa([ED]),iB((sB=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).renderTextures=aB&&aB(),e._postRenderPass=null,e}s(e,t);var i=e.prototype;return i.initialize=function(e){if(t.prototype.initialize.call(this,e),0===this._flows.length){var i=new pP;i.initialize(pP.initInfo),this._flows.push(i);var n=new lB;n.initialize(lB.initInfo),this._flows.push(n);var r=new jP;r.initialize(jP.initInfo),this._flows.push(r)}return!0},i.activate=function(e){return this._macros={CC_PIPELINE_TYPE:0},this._pipelineSceneData=new UM,!(!t.prototype.activate.call(this,e)||!this._activeRenderer(e)&&(Z(2402),1))},i._ensureEnoughSize=function(t){for(var e=this._width,i=this._height,n=0;n<t.length;++n){var r=t[n].window;e=Math.max(r.width,e),i=Math.max(r.height,i)}e===this._width&&i===this._height||(this._width=e,this._height=i)},i.destroy=function(){this._destroyUBOs(),this._destroyQuadInputAssembler();for(var e=this._renderPasses.values(),i=e.next();!i.done;)i.value.destroy(),i=e.next();return this._commandBuffers.length=0,t.prototype.destroy.call(this)},i._activeRenderer=function(){var t=this.device;this._commandBuffers.push(t.commandBuffer);var e=this.globalDSManager.pointSampler;return this._descriptorSet.bindSampler(Fg,e),this._descriptorSet.bindTexture(Fg,aS.get("default-texture").getGFXTexture()),this._descriptorSet.bindSampler(jg,e),this._descriptorSet.bindTexture(jg,aS.get("default-texture").getGFXTexture()),this._descriptorSet.update(),!0},i._destroyUBOs=function(){this._descriptorSet&&(this._descriptorSet.getBuffer(Pg.BINDING).destroy(),this._descriptorSet.getBuffer(Ng.BINDING).destroy(),this._descriptorSet.getBuffer(Bg.BINDING).destroy(),this._descriptorSet.getTexture(Fg).destroy(),this._descriptorSet.getTexture(jg).destroy())},n(e,[{key:"postRenderPass",get:function(){return this._postRenderPass}}]),e}(SD),aB=Gs(sB.prototype,"renderTextures",[nB,ra],(function(){return[]})),rB=sB))||rB)),fB=new C_(null),pB=function(){function t(){this._device=null,this._passes=null,this._shaders=null,this._subMesh=null,this._patches=null,this._priority=vg.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=v.director.root;this._device=wd.gfxDevice,fB.layout=e[0].localSetLayout,this._inputAssembler=this._device.createInputAssembler(t.iaInfo),this._descriptorSet=this._device.createDescriptorSet(fB);var r=v.director.root.pipeline.pipelineSceneData.getOcclusionQueryPass();if(r){var s=new C_(null);s.layout=r.localSetLayout,this._worldBoundDescriptorSet=this._device.createDescriptorSet(s)}this._subMesh=t,this._patches=i?i.sort():null,this._passes=e,this._flushPassInfo(),this.priority=vg.DEFAULT;var a=v.rendering;if((!a||!a.enableEffectImport)&&e[0].phase===oS("reflection")||ny()&&e[0].phaseID===a.getPhaseID(a.getPassID("default"),"reflection")){var o=n.mainWindow.width,h=n.mainWindow.height,u=512;h<o?(o=u*o/h,h=u):h=u*h/(o=u),this._reflectionTex=this._device.createTexture(new t_($l.TEX2D,tc.STORAGE|tc.TRANSFER_SRC|tc.SAMPLED,jl.RGBA8,o,h)),this.descriptorSet.bindTexture(Dv,this._reflectionTex),this._reflectionSampler=this._device.getSampler(new i_(sc.LINEAR,sc.LINEAR,sc.NONE,ac.CLAMP,ac.CLAMP,ac.CLAMP)),this.descriptorSet.bindSampler(Dv,this._reflectionSampler),this.descriptorSet.bindTexture(Bv,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=vg.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=(uv.SH_QUADRATIC_R_OFFSET-uv.SH_LINEAR_CONST_R_OFFSET)/4,r=0,s=e;s<e+n;s++)for(var a=0;a<4;a++)i[s][a]=t[r++]},e.UpdateInstancedAttributes=function(t){this.instancedWorldMatrixIndex=-1,this.instancedSHIndex=-1;var e=this.passes[0];if(e.device.hasFeature(Xl.INSTANCED_ARRAYS)){for(var i=0,n=0;n<t.length;n++){var r=t[n];r.isInstanced&&(i+=F_[r.format].size)}var s=this.instancedAttributeBlock;s.buffer=new Uint8Array(i),s.views.length=s.attributes.length=0;for(var a=0,o=0;o<t.length;o++){var h=t[o];if(h.isInstanced){var u=new __;u.format=h.format,u.name=h.name,u.isNormalized=h.isNormalized,u.location=h.location,s.attributes.push(u);var l=F_[h.format],c=new(j_(l))(s.buffer.buffer,a,l.count);s.views.push(c),a+=l.size}}e.batchingScheme===rS.INSTANCING&&e.getInstancedBuffer().destroy(),this.instancedWorldMatrixIndex=this.getInstancedAttributeIndex(Zg),this.instancedSHIndex=this.getInstancedAttributeIndex(Jg)}},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(),fB.layout=t[0].localSetLayout,this._descriptorSet=this._device.createDescriptorSet(fB)))}},{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}();t("al",_B),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"}(_B||t("al",_B={}));var mB,gB=new Dn,vB=[{name:"CC_RECEIVE_SHADOW",value:!0}],yB=[{name:"CC_USE_LIGHTMAP",value:1}],TB=[{name:"CC_USE_LIGHTMAP",value:2}],SB=[{name:"CC_LIGHT_MAP_VERSION",value:2}],EB=[{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"}(mB||(mB={}));var AB,RB,bB,CB,wB=new i_(sc.LINEAR,sc.LINEAR,sc.NONE,ac.CLAMP,ac.CLAMP,ac.CLAMP),xB=new i_(sc.LINEAR,sc.LINEAR,sc.LINEAR,ac.CLAMP,ac.CLAMP,ac.CLAMP),IB=function(){function t(){this.type=mB.DEFAULT,this.scene=null,this.isDynamicBatching=!1,this._worldBounds=null,this._modelBounds=null,this._subModels=[],this._node=null,this._transform=null,this._device=void 0,this._inited=!1,this._descriptorSetCount=1,this._updateStamp=-1,this._localDataUpdated=!0,this._localData=new Float32Array(qg.COUNT),this._localBuffer=null,this._localSHData=null,this._localSHBuffer=null,this._lightmap=null,this._lightmapUVParam=new nn,this._tetrahedronIndex=-1,this._lastWorldBoundCenter=new hn(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=sm.Enum.NONE,this._priority=0,this._bakeToReflectionProbe=!0,this._reflectionProbeType=_B.NONE,this._device=wd.gfxDevice}var e=t.prototype;return e.initialize=function(){this._inited||(this._receiveShadow=!0,this.castShadow=!1,this.enabled=!0,this.visFlags=sm.Enum.NONE,this._inited=!0,this._bakeToReflectionProbe=!0,this._reflectionProbeType=_B.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===MS.Planar;if(this._localDataUpdated){this._localDataUpdated=!1;for(var r=this.transform._mat,s=!1,a=0;a<e.length;a++){var o=e[a],h=o.instancedWorldMatrixIndex;h>=0?o.updateInstancedWorldMatrix(r,h):s=!0}(s||n)&&this._localBuffer&&(Dn.toArray(this._localData,r,qg.MAT_WORLD_OFFSET),Dn.invert(gB,r),Dn.transpose(gB,gB),Dn.toArray(this._localData,gB,qg.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=v.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<uv.COUNT;t++)this._localSHData[t]=0;this.updateSHBuffer()}},e.updateSHUBOs=function(){if(this.isLightProbeAvailable()){var t=this._worldBounds.center;if(!t.equals(this._lastWorldBoundCenter,Ci)){var e=[],i=new nn(0,0,0,0),n=v.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&&(v.internal.SH.reduceRinging(e,n.reduceRinging),v.internal.SH.updateUBOData(this._localSHData,uv.SH_LINEAR_CONST_R_OFFSET,e),this.updateSHBuffer())}}},e.createBoundingShape=function(t,e){t&&e&&(this._modelBounds||(this._modelBounds=Es.create()),this._worldBounds||(this._worldBounds=Es.create()),Es.fromPoints(this._modelBounds,t,e),Es.copy(this._worldBounds,this._modelBounds))},e._createSubModel=function(){return new pB},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){nn.toArray(this._localData,e,qg.LIGHTINGMAP_UVPARAM),this._localDataUpdated=!0,this._lightmap=t,this._lightmapUVParam=e,this.onMacroPatchesStateChanged(),t||(t=aS.get("empty-texture"));var i=t.getGFXTexture();if(i)for(var n=this._device.getSampler(t.mipmaps.length>1?xB:wB),r=this._subModels,s=0;s<r.length;s++){var a=r[s].descriptorSet;a.bindTexture(bv,i),a.bindSampler(bv,n),a.update()}},e.updateReflectionProbeCubemap=function(t){this._localDataUpdated=!0,this.onMacroPatchesStateChanged(),t||(t=aS.get("default-cube-texture"));var e=t.getGFXTexture();if(e)for(var i=this._device.getSampler(t.getSamplerInfo()),n=this._subModels,r=0;r<n.length;r++){var s=n[r].descriptorSet;s&&(s.bindSampler(Fv,i),s.bindTexture(Fv,e),s.update())}},e.updateReflectionProbeBlendCubemap=function(t){this._localDataUpdated=!0,this.onMacroPatchesStateChanged(),t||(t=aS.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(jv,i),s.bindTexture(jv,e),s.update())}},e.updateReflectionProbePlanarMap=function(t){this._localDataUpdated=!0,this.onMacroPatchesStateChanged();var e=this._device.getSampler(new i_(sc.LINEAR,sc.LINEAR,sc.NONE,ac.CLAMP,ac.CLAMP,ac.CLAMP));if(t||(t=aS.get("empty-texture").getGFXTexture()),t)for(var i=this._subModels,n=0;n<i.length;n++){var r=i[n].descriptorSet;r&&(r.bindTexture(Gv,t),r.bindSampler(Gv,e),r.update())}},e.updateReflectionProbeDataMap=function(t){this._localDataUpdated=!0,this.onMacroPatchesStateChanged(),t||(t=aS.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(Vv,e),r.bindSampler(Vv,t.getGFXSampler()),r.update())}},e.updateLocalShadowBias=function(){var t=this._localData;t[qg.LOCAL_SHADOW_BIAS+0]=this._shadowBias,t[qg.LOCAL_SHADOW_BIAS+1]=this._shadowNormalBias,this._localDataUpdated=!0},e.updateReflectionProbeId=function(){var t=this._localData;t[qg.LOCAL_SHADOW_BIAS+2]=this._reflectionProbeId,t[qg.LOCAL_SHADOW_BIAS+3]=this._reflectionProbeBlendId;var e=null,i=null;if(v.internal.reflectionProbeManager&&(e=v.internal.reflectionProbeManager.getProbeById(this._reflectionProbeId),i=v.internal.reflectionProbeManager.getProbeById(this._reflectionProbeBlendId)),e){if(e.probeType===rx.PLANAR)t[qg.REFLECTION_PROBE_DATA1]=e.node.up.x,t[qg.REFLECTION_PROBE_DATA1+1]=e.node.up.y,t[qg.REFLECTION_PROBE_DATA1+2]=e.node.up.z,t[qg.REFLECTION_PROBE_DATA1+3]=1,t[qg.REFLECTION_PROBE_DATA2]=1,t[qg.REFLECTION_PROBE_DATA2+1]=0,t[qg.REFLECTION_PROBE_DATA2+2]=0,t[qg.REFLECTION_PROBE_DATA2+3]=1;else{t[qg.REFLECTION_PROBE_DATA1]=e.node.worldPosition.x,t[qg.REFLECTION_PROBE_DATA1+1]=e.node.worldPosition.y,t[qg.REFLECTION_PROBE_DATA1+2]=e.node.worldPosition.z,t[qg.REFLECTION_PROBE_DATA1+3]=0,t[qg.REFLECTION_PROBE_DATA2]=e.size.x,t[qg.REFLECTION_PROBE_DATA2+1]=e.size.y,t[qg.REFLECTION_PROBE_DATA2+2]=e.size.z;var n=e.isRGBE()?1e3:0;t[qg.REFLECTION_PROBE_DATA2+3]=e.cubemap?e.cubemap.mipmapLevel+n:1+n}if(this._reflectionProbeType===_B.BLEND_PROBES||this._reflectionProbeType===_B.BLEND_PROBES_AND_SKYBOX)if(i){t[qg.REFLECTION_PROBE_BLEND_DATA1]=i.node.worldPosition.x,t[qg.REFLECTION_PROBE_BLEND_DATA1+1]=i.node.worldPosition.y,t[qg.REFLECTION_PROBE_BLEND_DATA1+2]=i.node.worldPosition.z,t[qg.REFLECTION_PROBE_BLEND_DATA1+3]=this.reflectionProbeBlendWeight,t[qg.REFLECTION_PROBE_BLEND_DATA2]=i.size.x,t[qg.REFLECTION_PROBE_BLEND_DATA2+1]=i.size.y,t[qg.REFLECTION_PROBE_BLEND_DATA2+2]=i.size.z;var r=i.isRGBE()?1e3:0;t[qg.REFLECTION_PROBE_BLEND_DATA2+3]=i.cubemap?i.cubemap.mipmapLevel+r:1+r}else this._reflectionProbeType===_B.BLEND_PROBES_AND_SKYBOX&&(t[qg.REFLECTION_PROBE_BLEND_DATA1+3]=this.reflectionProbeBlendWeight)}this._localDataUpdated=!0},e.getMacroPatches=function(){var t=this.receiveShadow?vB:null;if(null!=this._lightmap&&this.node&&this.node.scene&&!this.node.scene.globals.disableLightmap){var e=this.node.scene.globals.bakedWithStationaryMainLight?TB:yB;t=t?t.concat(e):e,this.node.scene.globals.bakedWithHighpLightmap&&(t=t.concat(SB))}this._useLightProbe&&(t=t?t.concat(EB):EB);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 a,o=d(i.value.getShaderVariant(e.patches).attributes);!(a=o()).done;){var h=a.value;r.has(h.name)||(n.push(h),r.add(h.name))}this._updateInstancedAttributes(n,e)}},e._updateInstancedAttributes=function(t,e){e.UpdateInstancedAttributes(t),this._localDataUpdated=!0},e._initLocalDescriptors=function(){this._localBuffer||(this._localBuffer=this._device.createBuffer(new qc(ql.UNIFORM|ql.TRANSFER_DST,Jl.DEVICE,qg.SIZE,qg.SIZE)))},e._initLocalSHDescriptors=function(){this._useLightProbe&&(this._localSHData||(this._localSHData=new Float32Array(uv.COUNT)),this._localSHBuffer||(this._localSHBuffer=this._device.createBuffer(new qc(ql.UNIFORM|ql.TRANSFER_DST,Jl.DEVICE,uv.SIZE,uv.SIZE))))},e._initWorldBoundDescriptors=function(){this._worldBoundBuffer||(this._worldBoundBuffer=this._device.createBuffer(new qc(ql.UNIFORM|ql.TRANSFER_DST,Jl.DEVICE,Qg.SIZE,Qg.SIZE)))},e._updateLocalDescriptors=function(t,e){this._localBuffer&&e.bindBuffer(qg.BINDING,this._localBuffer)},e._updateLocalSHDescriptors=function(t,e){this._localSHBuffer&&e.bindBuffer(uv.BINDING,this._localSHBuffer)},e._updateWorldBoundDescriptors=function(t,e){this._worldBoundBuffer&&e.bindBuffer(Qg.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}(),OB=new hn(0,0,-1),DB=new hn,MB=function(t){function e(){var e;return(e=t.call(this)||this)._dir=new hn(1,-1,-1),e._illuminanceHDR=mg.SUN_ILLUM,e._illuminanceLDR=1,e._shadowEnabled=!1,e._shadowPcf=PS.HARD,e._shadowBias=1e-5,e._shadowNormalBias=0,e._shadowSaturation=1,e._shadowDistance=50,e._shadowInvisibleOcclusionRange=200,e._csmLevel=BS.LEVEL_4,e._csmNeedUpdate=!1,e._csmLayerLambda=.75,e._csmOptimizationMode=NS.DisableRotationFix,e._csmLayersTransition=!1,e._csmTransitionRange=.05,e._shadowFixedArea=!1,e._shadowNear=.1,e._shadowFar=10,e._shadowOrthoSize=5,e._type=hx.DIRECTIONAL,e}s(e,t);var i=e.prototype;return i.initialize=function(){t.prototype.initialize.call(this),this.illuminance=mg.SUN_ILLUM,this.direction=new hn(1,-1,-1)},i.update=function(){this._node&&this._node.hasChangedFlags&&(this.direction=hn.transformQuat(DB,OB,this._node.worldRotation))},i.activate=function(){var t=v.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){hn.normalize(this._dir,t)}},{key:"illuminance",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR?this._illuminanceHDR:this._illuminanceLDR},set:function(t){v.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,FS.MAX_FAR)}},{key:"shadowInvisibleOcclusionRange",get:function(){return this._shadowInvisibleOcclusionRange},set:function(t){this._shadowInvisibleOcclusionRange=Math.min(t,FS.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,FS.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}(bx),PB=function(t){function e(){var e;return(e=t.call(this)||this)._needUpdate=!1,e._size=.15,e._range=1,e._luminanceHDR=0,e._luminanceLDR=0,e._pos=void 0,e._aabb=void 0,e._aabb=Es.create(),e._pos=new hn,e._type=hx.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/Rx(.15),this.luminanceLDR=1},i.update=function(){if(this._node&&(this._node.hasChangedFlags||this._needUpdate)){this._node.getWorldPosition(this._pos);var t=this._range;Es.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 v.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){v.director.root.pipeline.pipelineSceneData.isHDR?this.luminanceHDR=t:this.luminanceLDR=t}},{key:"luminanceHDR",get:function(){return this._luminanceHDR},set:function(t){this._luminanceHDR=t}},{key:"luminanceLDR",set:function(t){this._luminanceLDR=t}},{key:"aabb",get:function(){return this._aabb}}]),e}(bx),BB=new hn(0,0,-1),NB=new En,LB=new Dn,FB=new Dn,kB=new Dn,UB=new Dn,GB=function(t){function e(){var e;return(e=t.call(this)||this)._dir=new hn(1,-1,-1),e._range=5,e._spotAngle=Math.cos(Math.PI/6),e._pos=void 0,e._aabb=void 0,e._frustum=void 0,e._angle=0,e._needUpdate=!1,e._size=.15,e._luminanceHDR=0,e._luminanceLDR=0,e._shadowEnabled=!1,e._shadowPcf=PS.HARD,e._shadowBias=1e-5,e._shadowNormalBias=0,e._aabb=Es.create(),e._frustum=Is.create(),e._pos=new hn,e._type=hx.SPOT,e}s(e,t);var i=e.prototype;return i.initialize=function(){t.prototype.initialize.call(this),this.size=.15,this.luminanceHDR=1700/Rx(.15),this.luminanceLDR=1,this.range=Math.cos(Math.PI/6),this._dir.set(new hn(1,-1,-1))},i.update=function(){this._node&&(this._node.hasChangedFlags||this._needUpdate)&&(this._node.getWorldPosition(this._pos),hn.transformQuat(this._dir,BB,this._node.getWorldRotation(NB)),hn.normalize(this._dir,this._dir),Es.set(this._aabb,this._pos.x,this._pos.y,this._pos.z,this._range,this._range,this._range),this._node.getWorldRT(LB),Dn.invert(LB,LB),Dn.perspective(FB,this._angle,1,.001,this._range),Dn.multiply(kB,FB,LB),this._frustum.update(kB,UB),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 v.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){v.director.root.pipeline.pipelineSceneData.isHDR?this.luminanceHDR=t:this.luminanceLDR=t}},{key:"luminanceHDR",get:function(){return this._luminanceHDR},set:function(t){this._luminanceHDR=t}},{key:"luminanceLDR",get:function(){return this._luminanceLDR},set:function(t){this._luminanceLDR=t}},{key:"direction",get:function(){return this._dir}},{key:"spotAngle",get:function(){return this._spotAngle},set:function(t){this._angle=t,this._spotAngle=Math.cos(.5*t),this._needUpdate=!0}},{key:"angle",get:function(){return this._angle}},{key:"aabb",get:function(){return this._aabb}},{key:"frustum",get:function(){return this._frustum}},{key:"shadowEnabled",get:function(){return this._shadowEnabled},set:function(t){this._shadowEnabled=t}},{key:"shadowPcf",get:function(){return this._shadowPcf},set:function(t){this._shadowPcf=t}},{key:"shadowBias",get:function(){return this._shadowBias},set:function(t){this._shadowBias=t}},{key:"shadowNormalBias",get:function(){return this._shadowNormalBias},set:function(t){this._shadowNormalBias=t}}]),e}(bx),HB=function(t){function e(){var e;return(e=t.call(this)||this)._needUpdate=!1,e._range=1,e._luminanceHDR=0,e._luminanceLDR=0,e._pos=void 0,e._aabb=void 0,e._aabb=Es.create(),e._pos=new hn,e._type=hx.POINT,e}s(e,t);var i=e.prototype;return i.initialize=function(){t.prototype.initialize.call(this),this.range=1,this.luminanceHDR=1700/Rx(1),this.luminanceLDR=1},i.update=function(){if(this._node&&(this._node.hasChangedFlags||this._needUpdate)){this._node.getWorldPosition(this._pos);var t=this._range;Es.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 v.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){v.director.root.pipeline.pipelineSceneData.isHDR?this.luminanceHDR=t:this.luminanceLDR=t}},{key:"luminanceHDR",get:function(){return this._luminanceHDR},set:function(t){this._luminanceHDR=t}},{key:"luminanceLDR",set:function(t){this._luminanceLDR=t}},{key:"aabb",get:function(){return this._aabb}}]),e}(bx),zB=new hn(0,0,-1),VB=function(t){function e(){var e;return(e=t.call(this)||this)._dir=new hn(0,0,-1),e._pos=new hn(0,0,0),e._scale=new hn(1,1,1),e._right=new hn(1,0,0),e._illuminanceHDR=mg.SUN_ILLUM,e._illuminanceLDR=1,e._type=hx.RANGED_DIRECTIONAL,e}s(e,t);var i=e.prototype;return i.initialize=function(){t.prototype.initialize.call(this),this.illuminance=mg.SUN_ILLUM},i.update=function(){this._node&&this._node.hasChangedFlags&&(this._node.getWorldPosition(this._pos),this._node.getWorldScale(this._scale),hn.transformQuat(this._dir,zB,this._node.worldRotation),hn.transformQuat(this._right,hn.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 v.director.root.pipeline.pipelineSceneData.isHDR?this._illuminanceHDR:this._illuminanceLDR},set:function(t){v.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}(bx),WB=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}(),XB=function(){function t(){this.scene=void 0,this.node=null,this._device=void 0,this.enabled=!0,this._localBoundaryCenter=new hn(0,0,0),this._objectSize=1,this._lodDataArray=[],this._lockedLODLevelVec=[],this._isLockLevelChanged=!1,this._device=wd.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===Iw.PERSPECTIVE&&(e=hn.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===Iw.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}(),jB=Object.freeze({__proto__:null,get CameraFOVAxis(){return xw},get CameraProjection(){return Iw},get CameraAperture(){return Ow},get CameraISO(){return Dw},get CameraShutter(){return Mw},get CameraType(){return Pw},get TrackingType(){return Bw},get CameraUsage(){return Nw},SKYBOX_FLAG:Ww,Camera:jw,get ModelType(){return mB},Model:IB,SubModel:pB,Ambient:mg,EnvironmentLightingType:zS,Skybox:VS,ShadowSize:DS,ShadowType:MS,PCFType:PS,CSMLevel:BS,CSMOptimizationMode:NS,Shadows:FS,FogType:XS,FOG_TYPE_NONE:jS,Fog:YS,Octree:gM,Skin:kM,ColorTemperatureToRGB:cx,get LightType(){return hx},nt2lm:Rx,Light:bx,DirectionalLight:MB,SphereLight:PB,SpotLight:GB,PointLight:HB,RangedDirectionalLight:VB,get ProbeClearFlag(){return nx},get ProbeType(){return rx},ReflectionProbe:lx,LODData:WB,LODGroup:XB,ToneMappingType:mR,PostSettings:gR}),YB=function(){function t(t){this._root=void 0,this._name="",this._cameras=[],this._models=[],this._lodGroups=[],this._batches=[],this._directionalLights=[],this._sphereLights=[],this._spotLights=[],this._pointLights=[],this._rangedDirLights=[],this._mainLight=null,this._modelId=0,this._lodStateCache=null,this._root=t}t.registerCreateFunc=function(e){e._createSceneFun=function(e){return new t(e)}};var e=t.prototype;return e.initialize=function(t){return this._name=t.name,this._lodStateCache=new qB(this),!0},e.update=function(t){var e=this._mainLight;e&&e.update();for(var i=this._sphereLights,n=0;n<i.length;n++)i[n].update();for(var r=this._spotLights,s=0;s<r.length;s++)r[s].update();for(var a=this._pointLights,o=0;o<a.length;o++)a[o].update();for(var h=this._rangedDirLights,u=0;u<h.length;u++)h[u].update();for(var l=this._models,c=0;c<l.length;c++){var _=l[c];_.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|=om.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}(),KB=function(){this.usedLevel=-1,this.lastUsedLevel=-1,this.transformDirty=!0},qB=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,a=d(this._lodStateInCamera);!(s=a()).done;)s.value[1].delete(t);this._levelModels.delete(t)},e.removeModel=function(t){this._modelsInLODGroup.has(t)&&this._modelsInLODGroup.delete(t)},e.updateLodState=function(){for(var t,e=this,i=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 a=r.get(s);a||(a=new Array);for(var o,h=d(n.lodDataArray[s].models);!(o=h()).done;){var u=o.value,l=this._modelsInLODGroup.get(u);l||(l=new Map),this._modelsInLODGroup.set(u,l),a.push(u)}r.set(s,a)}}this._newAddedLodGroupVec.length=0;for(var c,_=function(){var t=c.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,a=s[1].get(t);a||(a=new KB,s[1].set(t,a)),a.transformDirty=!0}if(t.isLockLevelChanged()){t.resetLockChangeFlag();var o=e._levelModels.get(t);if(o){o.forEach((function(t){t.forEach((function(t){var i=e._modelsInLODGroup.get(t);i&&i.clear()}))}));for(var h,u=d(i);!(h=u()).done;){var l=h.value,_=o.get(l);_&&_.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,m=d(e._lodStateInCamera);!(f=m()).done;){var g=f.value,v=g[1].get(t);v||(v=new KB,g[1].set(t,v));var y=g[0].node.hasChangedFlags,T=t.node.hasChangedFlags;if(y>0||T>0||v.transformDirty){v.transformDirty&&(v.transformDirty=!1);var S=t.getVisibleLODLevel(g[0]);S!==v.usedLevel&&(v.lastUsedLevel=v.usedLevel,v.usedLevel=S,p=!0)}}var E=e._levelModels.get(t);if(!E)return 0;t.isLockLevelChanged()?(t.resetLockChangeFlag(),E.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=E.get(n.lastUsedLevel);r&&r.forEach((function(t){var i=e._modelsInLODGroup.get(t);i&&i.clear()}))}})),p&&e._lodStateInCamera.forEach((function(i,n){var r=i.get(t);if(r){var s=r.usedLevel,a=E.get(s);a&&a.forEach((function(t){var i=e._modelsInLODGroup.get(t);i&&t.node&&t.node.active&&i.set(n,!0)}))}}))}},f=d(this._renderScene.lodGroups);!(c=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}(),QB=((AB={})[Al.PORTRAIT]=Wl.IDENTITY,AB[Al.LANDSCAPE_RIGHT]=Wl.ROTATE_90,AB[Al.PORTRAIT_UPSIDE_DOWN]=Wl.ROTATE_180,AB[Al.LANDSCAPE_LEFT]=Wl.ROTATE_270,AB),ZB=function(){function t(){this._title="",this._width=1,this._height=1,this._swapchain=null,this._renderPass=null,this._colorTextures=[],this._depthStencilTexture=null,this._cameras=[],this._hasOnScreenAttachments=!1,this._hasOffScreenAttachments=!1,this._framebuffer=null,this._device=null}t.registerCreateFunc=function(e){e._createWindowFun=function(){return new t}};var e=t.prototype;return e.initialize=function(t,e){if(void 0!==e.title&&(this._title=e.title),void 0!==e.swapchain&&(this._swapchain=e.swapchain),this._width=e.width,this._height=e.height,this._device=t,this._renderPass=t.createRenderPass(e.renderPassInfo),e.swapchain)this._swapchain=e.swapchain,this._colorTextures.push(e.swapchain.colorTexture),this._depthStencilTexture=e.swapchain.depthStencilTexture;else{for(var i=0;i<e.renderPassInfo.colorAttachments.length;i++){var n=new t_($l.TEX2D,tc.COLOR_ATTACHMENT|tc.SAMPLED|tc.TRANSFER_SRC,e.renderPassInfo.colorAttachments[i].format,this._width,this._height);e.externalFlag&&(e.externalFlag&ec.EXTERNAL_NORMAL||e.externalFlag&ec.EXTERNAL_OES)&&(n.flags|=e.externalFlag,n.externalRes=e.externalResLow?e.externalResLow:0),this._colorTextures.push(t.createTexture(n))}e.renderPassInfo.depthStencilAttachment.format!==jl.UNKNOWN&&(this._depthStencilTexture=t.createTexture(new t_($l.TEX2D,tc.DEPTH_STENCIL_ATTACHMENT|tc.SAMPLED,e.renderPassInfo.depthStencilAttachment.format,this._width,this._height)),this._hasOffScreenAttachments=!0)}return this._framebuffer=t.createFramebuffer(new A_(this._renderPass,this._colorTextures,this._depthStencilTexture)),!0},e.destroy=function(){this.clearCameras(),this._framebuffer&&(this._framebuffer.destroy(),this._framebuffer=null),this._depthStencilTexture&&(this._depthStencilTexture.destroy(),this._depthStencilTexture=null);for(var t=0;t<this._colorTextures.length;t++){var e=this._colorTextures[t];e&&e.destroy()}this._colorTextures.length=0,this._device=null},e.resize=function(t,e){if(this._swapchain)this._swapchain.resize(t,e,QB[wl.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 A_(this._renderPass,this._colorTextures,this._depthStencilTexture)));for(var n,r=d(this._cameras);!(n=r()).done;)n.value.resize(t,e)},e.extractRenderCameras=function(t){for(var e=0;e<this._cameras.length;e++){var i=this._cameras[e];i.enabled&&(i.update(),t.push(i))}},e.attachCamera=function(t){for(var e=0;e<this._cameras.length;e++)if(this._cameras[e]===t)return;this._cameras.push(t),this.sortCameras()},e.detachCamera=function(t){for(var e=0;e<this._cameras.length;++e)if(this._cameras[e]===t)return void this._cameras.splice(e,1)},e.clearCameras=function(){this._cameras.length=0},e.sortCameras=function(){this._cameras.sort((function(t,e){return t.priority-e.priority}))},n(t,[{key:"width",get:function(){return this._width}},{key:"height",get:function(){return this._height}},{key:"swapchain",get:function(){return this._swapchain}},{key:"framebuffer",get:function(){return this._framebuffer}},{key:"cameras",get:function(){return this._cameras}}]),t}();!function(t){t[t.NONE=-1]="NONE",t[t.LEFT=0]="LEFT",t[t.RIGHT=1]="RIGHT"}(RB||(RB={})),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"}(bB||(bB={})),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"}(CB||(CB={}));var JB=t("aD",function(){function t(t){var e=this;this._createSceneFun=null,this._createWindowFun=null,this._device=void 0,this._windows=[],this._mainWindow=null,this._curWindow=null,this._tempWindow=null,this._usesCustomPipeline=!0,this._pipeline=null,this._pipelineEvent=null,this._classicPipeline=null,this._customPipeline=null,this._batcher=null,this._dataPoolMgr=void 0,this._scenes=[],this._modelPools=new Map,this._cameraPool=null,this._lightPools=new Map,this._debugView=new kx,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=v.internal.DataPoolManager&&new v.internal.DataPoolManager(t),YB.registerCreateFunc(this),ZB.registerCreateFunc(this),this._cameraPool=new Pu((function(){return new jw(e._device)}),4,(function(t){return t.destroy()}))}var e=t.prototype;return e.initialize=function(){var t,e=wd.swapchain,i=new p_;i.format=e.colorTexture.format;var n=new m_;n.format=e.depthStencilTexture.format,n.depthStoreOp=fc.DISCARD,n.stencilStoreOp=fc.DISCARD;var r=new y_([i],n);this._mainWindow=this.createWindow({title:"rootMainWindow",width:e.width,height:e.height,renderPassInfo:r,swapchain:e}),this._curWindow=this._mainWindow;var s=be.querySettings(Re.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(),v.rendering&&v.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=v.internal,i=v.director,n=v.rendering;t instanceof gP&&(this._useDeferredPipeline=!0);var r=!1;if(t||(t=cB(),r=!0),this._useDeferredPipeline&&this.device.hasFeature(Xl.COMPUTE_SHADER)||(t.clusterEnabled=!1),t.bloomEnabled=!1,""!==Ce.CUSTOM_PIPELINE_NAME&&n&&this.usesCustomPipeline?(this._customPipeline=n.createCustomPipeline(),r=!0,this._pipeline=this._customPipeline,this._pipelineEvent=t):(this._classicPipeline=t,this._pipeline=this._classicPipeline,this._pipelineEvent=this._classicPipeline,this._usesCustomPipeline=!1),(be.querySettings(Re.Category.RENDERING,"renderMode")!==Sd.HEADLESS||this._classicPipeline)&&!this._pipeline.activate(this._mainWindow.swapchain))return r&&this._pipeline.destroy(),this._classicPipeline=null,this._customPipeline=null,this._pipeline=null,this._pipelineEvent=null,!1;var s=i.getScene();return s&&s.globals.activate(),this.onGlobalPipelineStateChanged(),!(!this._batcher&&e.Batcher2D&&(this._batcher=new e.Batcher2D(this),!this._batcher.initialize())&&(this.destroy(),1))},e.onGlobalPipelineStateChanged=function(){for(var t=0;t<this._scenes.length;t++)this._scenes[t].onGlobalPipelineStateChanged();this._pipeline.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 Pu((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 Pu((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 hx.DIRECTIONAL:t.scene.removeDirectionalLight(t);break;case hx.SPHERE:t.scene.removeSphereLight(t);break;case hx.SPOT:t.scene.removeSpotLight(t);break;case hx.POINT:t.scene.removePointLight(t);break;case hx.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 hx.DIRECTIONAL:t.scene.removeDirectionalLight(t);break;case hx.SPHERE:t.scene.removeSphereLight(t);break;case hx.SPOT:t.scene.removeSpotLight(t);break;case hx.POINT:t.scene.removePointLight(t);break;case hx.RANGED_DIRECTIONAL:t.scene.removeRangedDirLight(t)}},e._doWebXRFrameMove=function(){var t=globalThis.__globalXR;if(t){var e=this._windows,i=this._cameraList,n=t.webXRMatProjs?t.webXRMatProjs.length:1;t.webXRWindowMap||(t.webXRWindowMap=new Map);for(var r=[],s=t.webxrHmdPoseInfos,a=0;a<n;a++){for(var o,h=d(e);!(o=h()).done;){var u=o.value;r=r.concat(u.cameras),u.swapchain&&t.webXRWindowMap.set(u,a)}if(s){for(var l=[0,0,0],c=0;c<s.length;c++){var _=s[c];if(_.code===CB.VIEW_LEFT&&a===RB.LEFT||_.code===CB.VIEW_RIGHT&&a===RB.RIGHT){l[0]=_.position.x,l[1]=_.position.y,l[2]=_.position.z;break}}for(var f,p=d(r);!(f=p()).done;){var m=f.value;m.trackingType!==Bw.NO_TRACKING&&m.node&&(m.trackingType===Bw.ROTATION&&(l=[0,0,0]),m.node.setPosition(l[0],l[1],l[2]))}}r.length=0,this._frameMoveBegin(),this._frameMoveProcess();for(var g=i.length-1;g>=0;g--){var v=i[g];(a===RB.LEFT&&v.cameraType===Pw.RIGHT_EYE||a===RB.RIGHT&&v.cameraType===Pw.LEFT_EYE)&&i.splice(g,1)}this._frameMoveEnd()}}},e._frameMoveBegin=function(){for(var t=0;t<this._scenes.length;++t)this._scenes[t].removeBatches();this._cameraList.length=0},e._frameMoveProcess=function(){for(var t=v.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([wd.swapchain]);var r=this._scenes,s=t.getTotalFrames();this._batcher&&(this._batcher.update(),this._batcher.uploadBuffers());for(var a=0;a<r.length;a++)r[a].update(s)}},e._frameMoveEnd=function(){var t=v.director,e=v.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((Pg.COUNT+Bg.COUNT+Ng.COUNT+qg.COUNT+Qg.COUNT)/4,100),e=Math.floor((wd.gfxDevice.capabilities.maxVertexUniformVectors-t)/3);av(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}());v.Root=JB,gi.Attr.setClassAttr(rp,"target","type","Object"),gi.Attr.setClassAttr(rp,"target","ctor",$m);var $B,tN=new Array(16),eN=null,iN=new Fn,nN=[um.TOUCH_START,um.TOUCH_MOVE,um.TOUCH_END,um.TOUCH_CANCEL],rN=[um.MOUSE_DOWN,um.MOUSE_ENTER,um.MOUSE_MOVE,um.MOUSE_LEAVE,um.MOUSE_UP,um.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"}($B||($B={}));var sN,aN=function(){function t(t){this.claimedTouchIdList=[],this.maskList=null,this.cachedCameraPriority=0,this.previousMouseIn=!1,this.bubblingTarget=null,this.capturingTarget=null,this.shouldHandleEventMouse=!1,this.shouldHandleEventTouch=!1,this._dispatchingTouch=null,this._isEnabled=!1,this._node=void 0,this._node=t}var e=t.prototype;return e.setEnabled=function(e,i){if(void 0===i&&(i=!1),this._isEnabled!==e){this._isEnabled=e;var n=this.node.children;if(e&&this._attachMask(),t.callbacksInvoker.emit($B.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(eN===this._node&&(eN=null),this.capturingTarget&&this.capturingTarget.clear(),this.bubblingTarget&&this.bubblingTarget.clear(),t.callbacksInvoker.emit($B.REMOVE_POINTER_EVENT_PROCESSOR,this),this._dispatchingTouch){var e=new MC([this._dispatchingTouch],!0,CC.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($B.REMOVE_POINTER_EVENT_PROCESSOR,this)},e.emit=function(t,e,i,n,r,s){var a;null===(a=this.bubblingTarget)||void 0===a||a.emit(t,e,i,n,r,s)},e.dispatchEvent=function(t){var e,i=this.node,n=0;for(t.target=i,tN.length=0,this.getCapturingTargets(t.type,tN),t.eventPhase=1,n=tN.length-1;n>=0;--n)if((e=tN[n]).eventProcessor.capturingTarget&&(t.currentTarget=e,e.eventProcessor.capturingTarget.emit(t.type,t,tN),t.propagationStopped))return void(tN.length=0);if(tN.length=0,t.eventPhase=2,t.currentTarget=i,this.capturingTarget&&this.capturingTarget.emit(t.type,t),!t.propagationImmediateStopped&&this.bubblingTarget&&this.bubblingTarget.emit(t.type,t),!t.propagationStopped&&t.bubbles)for(this.getBubblingTargets(t.type,tN),t.eventPhase=3,n=0;n<tN.length;++n)if((e=tN[n]).eventProcessor.bubblingTarget&&(t.currentTarget=e,e.eventProcessor.bubblingTarget.emit(t.type,t),t.propagationStopped))return void(tN.length=0);tN.length=0},e.hasEventListener=function(t,e,i){var n=!1;return this.bubblingTarget&&(n=this.bubblingTarget.hasEventListener(t,e,i)),!n&&this.capturingTarget&&(n=this.capturingTarget.hasEventListener(t,e,i)),n},e.getCapturingTargets=function(t,e){for(var i=this._node.parent;i;){var n;null!==(n=i.eventProcessor.capturingTarget)&&void 0!==n&&n.hasEventListener(t)&&e.push(i),i=i.parent}},e.getBubblingTargets=function(t,e){for(var i=this._node.parent;i;){var n;null!==(n=i.eventProcessor.bubblingTarget)&&void 0!==n&&n.hasEventListener(t)&&e.push(i),i=i.parent}},e.onUpdatingSiblingIndex=function(){t.callbacksInvoker.emit($B.MARK_LIST_DIRTY)},e._searchComponentsInParent=function(t){var e=this.node;if(t){for(var i=0,n=[],r=e;r&&$m.isNode(r);r=r.parent,++i){var s=r.getComponent(t);if(s){var a={index:i,comp:s};n?n.push(a):n=[a]}}return n.length>0?n:null}return null},e._attachMask=function(){this.maskList=this._searchComponentsInParent(t._maskComp)},e._isTouchEvent=function(t){return-1!==nN.indexOf(t)},e._isMouseEvent=function(t){return-1!==rN.indexOf(t)},e._hasTouchListeners=function(){for(var t=0;t<nN.length;++t){var e=nN[t];if(this.hasEventListener(e))return!0}return!1},e._hasMouseListeners=function(){for(var t=0;t<rN.length;++t){var e=rN[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($B.ADD_POINTER_EVENT_PROCESSOR,this)},e._newCallbacksInvoker=function(){var e=this,i=new Qu;return i._registerOffCallback((function(){e.shouldHandleEventTouch&&!e._hasTouchListeners()&&(e.shouldHandleEventTouch=!1),e.shouldHandleEventMouse&&!e._hasMouseListeners()&&(e.shouldHandleEventMouse=!1),e._hasPointerListeners()||t.callbacksInvoker.emit($B.REMOVE_POINTER_EVENT_PROCESSOR,e)})),i},e._handleEventMouse=function(t){switch(t.type){case CC.MOUSE_DOWN:return this._handleMouseDown(t);case CC.MOUSE_MOVE:return this._handleMouseMove(t);case CC.MOUSE_UP:return this._handleMouseUp(t);case CC.MOUSE_WHEEL:return this._handleMouseWheel(t);default:return!1}},e._handleMouseDown=function(t){var e=this._node;return!(!e||!e._uiProps.uiTransformComp||(t.getLocation(iN),!e._uiProps.uiTransformComp.hitTest(iN,t.windowId)||(t.type=um.MOUSE_DOWN,t.bubbles=!0,e.dispatchEvent(t),t.propagationStopped=!0,0)))},e._handleMouseMove=function(t){var e=this._node;return!(!e||!e._uiProps.uiTransformComp||(t.getLocation(iN),e._uiProps.uiTransformComp.hitTest(iN,t.windowId)?(this.previousMouseIn||(eN&&eN!==e&&(t.type=um.MOUSE_LEAVE,eN.dispatchEvent(t),eN.eventProcessor.previousMouseIn=!1),eN=e,t.type=um.MOUSE_ENTER,e.dispatchEvent(t),this.previousMouseIn=!0),t.type=um.MOUSE_MOVE,t.bubbles=!0,e.dispatchEvent(t),t.propagationStopped=!0,0):(this.previousMouseIn&&(t.type=um.MOUSE_LEAVE,e.dispatchEvent(t),this.previousMouseIn=!1,eN=null),1)))},e._handleMouseUp=function(t){var e=this._node;return!(!e||!e._uiProps.uiTransformComp||(t.getLocation(iN),!e._uiProps.uiTransformComp.hitTest(iN,t.windowId)||(t.type=um.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(iN),!e._uiProps.uiTransformComp.hitTest(iN,t.windowId)||(t.type=um.MOUSE_WHEEL,t.bubbles=!0,e.dispatchEvent(t),t.propagationStopped=!0,0)))},e._handleEventTouch=function(t){switch(t.type){case CC.TOUCH_START:return this._handleTouchStart(t);case CC.TOUCH_MOVE:return this._handleTouchMove(t);case CC.TOUCH_END:return this._handleTouchEnd(t);case CC.TOUCH_CANCEL:return this._handleTouchCancel(t);default:return!1}},e._handleTouchStart=function(t){var e=this.node;return!(!e||!e._uiProps.uiTransformComp||(t.getLocation(iN),!e._uiProps.uiTransformComp.hitTest(iN,t.windowId)||(t.type=um.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=um.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(iN),e._uiProps.uiTransformComp.hitTest(iN,t.windowId)?t.type=um.TOUCH_END:t.type=um.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=um.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}();aN._maskComp=null,aN.callbacksInvoker=new Qu,v.NodeEventProcessor=aN,rt($m.prototype,"Node",[{name:"childrenCount",newName:"children.length",customGetter:function(){return this.children.length}}]),rt($m.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 Fn),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 Hn),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(Qb.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(Qb.prototype,"SceneGlobals.prototype",[{name:"distance",newName:"planeHeight"},{name:"normal",newName:"planeDirection"},{name:"size",newName:"shadowMapSize"}]),st($m.prototype,"Node.prototype",[{name:"addLayer"},{name:"removeLayer"}]),rt(hm.prototype,"NodeUIProperties",[{name:"opacityDirty",newName:"colorDirty"}]),st(sm,"Layers",[{name:"All"},{name:"RaycastMask"},{name:"check"}]),rt(sm,"Layers",[{name:"Default",newName:"DEFAULT",target:sm.Enum,targetName:"Layers.Enum"},{name:"Always",newName:"ALWAYS",target:sm.Enum,targetName:"Layers.Enum"},{name:"IgnoreRaycast",newName:"IGNORE_RAYCAST",target:sm.Enum,targetName:"Layers.Enum"},{name:"Gizmos",newName:"GIZMOS",target:sm.Enum,targetName:"Layers.Enum"},{name:"Editor",newName:"EDITOR",target:sm.Enum,targetName:"Layers.Enum"},{name:"UI",newName:"UI_3D",target:sm.Enum,targetName:"Layers.Enum"},{name:"UI2D",newName:"UI_2D",target:sm.Enum,targetName:"Layers.Enum"},{name:"SceneGizmo",newName:"SCENE_GIZMO",target:sm.Enum,targetName:"Layers.Enum"},{name:"makeInclusiveMask",newName:"makeMaskInclude",target:sm,targetName:"Layers"},{name:"makeExclusiveMask",newName:"makeMaskExclude",target:sm,targetName:"Layers"}]),st(sm.Enum,"Layers.Enum",[{name:"ALWAYS"}]),st(sm.BitMask,"Layers.BitMask",[{name:"ALWAYS"}]);var oN=Wa.Flags.HideInHierarchy,hN=Wa.Flags.DontSave,uN=t("dW",qs("cc.PrivateNode")(sN=function(t){function e(e){var i;return q(12003,(i=t.call(this,e)||this).name),i.hideFlags|=hN|oN,i}return s(e,t),e}($m))||sN);function lN(t,e){if(!e){var i=v.director.getScene();if(!i)return null;e=i}return e.getChildByPath(t)}rt(bC,"SystemEventType",["MOUSE_ENTER","MOUSE_LEAVE","TRANSFORM_CHANGED","SCENE_CHANGED_FOR_PERSISTS","SIZE_CHANGED","ANCHOR_CHANGED","COLOR_CHANGED","CHILD_ADDED","CHILD_REMOVED","PARENT_CHANGED","NODE_DESTROYED","LAYER_CHANGED","SIBLING_ORDER_CHANGED"].map((function(t){return{name:t,target:$m.EventType,targetName:"Node.EventType"}}))),rt($m.EventType,"Node.EventType",[{name:"DEVICEMOTION",target:ww.EventType,targetName:"SystemEvent.EventType"},{name:"KEY_DOWN",target:ww.EventType,targetName:"SystemEvent.EventType"},{name:"KEY_UP",target:ww.EventType,targetName:"SystemEvent.EventType"}]),v.PrivateNode=uN,mt({BaseNode:{newName:"Node",since:"3.7.0",removed:!1}}),v.find=lN;var cN=he,_N=Wa.Flags.IsStartCalled,dN=Wa.Flags.IsOnEnableCalled;function fN(t,e){for(var i=e.constructor._executionOrder,n=e._id,r=0,s=t.length-1,a=s>>>1;r<=s;a=r+s>>>1){var o=t[a],h=o.constructor._executionOrder;if(h>i)s=a-1;else if(h<i)r=a+1;else{var u=o._id;if(u>n)s=a-1;else{if(!(u<n))return a;r=a+1}}}return~r}function pN(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))}}Wa.Flags.IsEditorOnEnableCalled;var mN=function(){function t(t){this._zero=void 0,this._neg=void 0,this._pos=void 0,this._invoke=void 0;var e=ae;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 gN(t,e){return t.constructor._executionOrder-e.constructor._executionOrder}mN.stableRemoveInactive=pN;var vN=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){pN(this._zero,t),pN(this._neg,t),pN(this._pos,t)},i.invoke=function(){var t=this._neg;t.array.length>0&&(t.array.sort(gN),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(gN),this._invoke(e),e.array.length=0)},e}(mN),yN=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=fN(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=fN(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}(mN);function TN(t,e,i){var n="var a=it.array;for(it.i=0;it.i<a.length;++it.i){var c=a[it.i];"+t+"}",r=e?Function("it","dt",n):Function("it",n);return function(t,e,i){return function(n,r){try{e(n,r)}catch(e){v._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){v._throw(t),i&&(s[n.i]._objFlags|=i)}}}}(Function("c","dt",t),r,i)}var SN=TN("c.start();c._objFlags|="+_N,!1,_N),EN=TN("c.update(dt)",!0),AN=TN("c.lateUpdate(dt)",!0),RN=function(t){var e=v.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))}},bN=function(){function t(){this.startInvoker=void 0,this.updateInvoker=void 0,this.lateUpdateInvoker=void 0,this._deferredComps=[],this._updating=void 0,this.unscheduleAll()}var e=t.prototype;return e.unscheduleAll=function(){this.startInvoker=new vN(SN),this.updateInvoker=new yN(EN),this.lateUpdateInvoker=new yN(AN),this._updating=!1},e._onEnabled=function(t){v.director.getScheduler().resumeTarget(t),t._objFlags|=dN,this._updating?this._deferredComps.push(t):this._scheduleImmediate(t)},e._onDisabled=function(t){v.director.getScheduler().pauseTarget(t),t._objFlags&=~dN;var e=this._deferredComps.indexOf(t);e>=0?cN(this._deferredComps,e):(!t.internalStart||t._objFlags&_N||this.startInvoker.remove(t),t.internalUpdate&&this.updateInvoker.remove(t),t.internalLateUpdate&&this.lateUpdateInvoker.remove(t))},e.enableComp=function(t,e){if(!(t._objFlags&dN)){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&dN&&(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&_N||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}(),CN=Wa.Flags.IsPreloadStarted,wN=Wa.Flags.IsOnLoadStarted,xN=Wa.Flags.IsOnLoadCalled,IN=Wa.Flags.IsOnEnableCalled,ON=Wa.Flags.Deactivating,DN=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){mN.stableRemoveInactive(this._zero,t)},i.invoke=function(){this._invoke(this._zero),this._zero.array.length=0},e}(mN),MN=TN("c.__preload();"),PN=TN("c.onLoad();c._objFlags|="+xN,!1,xN),BN=new se(4);function NN(t,e,i){Z(3817,t.name,i),console.log("Corrupted component value:",e),e?t._removeComponent(e):oe(t.getWritableComponents(),i)}BN.get=function(){var t=this._get()||{preload:new DN(MN),onLoad:new vN(PN),onEnable:new vN(RN)};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 LN=t("dE",function(){function t(){this._activatingStack=void 0,this.reset()}var e=t.prototype;return e.reset=function(){this._activatingStack=[]},e.activateNode=function(t,e){if(e){var i=BN.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(),BN.put(i))}else{this._deactivateNodeRecursively(t);for(var n,r=d(this._activatingStack);!(n=r()).done;){var s=n.value;s.preload.cancelInactive(CN),s.onLoad.cancelInactive(wN),s.onEnable.cancelInactive(IN)}}t.emit(um.ACTIVE_IN_HIERARCHY_CHANGED,t)},e.activateComp=function(t,e,i,n){if(ja(t,!0)&&(t._objFlags&CN||(t._objFlags|=CN,t.internalPreload&&(e?e.add(t):t.internalPreload())),t._objFlags&wN||(t._objFlags|=wN,t.internalOnLoad?i?i.add(t):(t.internalOnLoad(),t._objFlags|=xN):t._objFlags|=xN),t._enabled)){if(!t.node.activeInHierarchy)return;v.director._compScheduler.enableComp(t,n)}},e.destroyComp=function(t){v.director._compScheduler.disableComp(t),t.internalOnDestroy&&t._objFlags&xN&&t.internalOnDestroy()},e._activateNodeRecursively=function(t,e,i,n){if(t._objFlags&ON)Z(3816,t.name);else{t._setActiveInHierarchy(!0);for(var r=t.components.length,s=0;s<r;++s){var a=t.components[s];a instanceof v.Component?this.activateComp(a,e,i,n):(NN(t,a,s),--s,--r)}for(var o=0,h=t.children.length;o<h;++o){var u=t.children[o];u.active&&this._activateNodeRecursively(u,e,i,n)}t._onPostActivated(!0)}},e._deactivateNodeRecursively=function(t){t._objFlags|=ON,t._setActiveInHierarchy(!1);for(var e=t.components.length,i=0;i<e;++i){var n=t.components[i];if(n._enabled&&(v.director._compScheduler.disableComp(n),t.activeInHierarchy))return void(t._objFlags&=~ON)}for(var r=0,s=t.children.length;r<s;++r){var a=t.children[r];if(a.activeInHierarchy&&(this._deactivateNodeRecursively(a),t.activeInHierarchy))return void(t._objFlags&=~ON)}t._onPostActivated(!1),t._objFlags&=~ON},t}()),FN=Wa.Flags.Destroyed,kN=Wa.Flags.PersistentMask,UN=gi.Attr.DELIMETER+"default",GN=gi.IDENTIFIER_RE,HN="var ",zN="o",VN={"cc.ClickEvent":!1,"cc.PrefabInfo":!1},WN=gi.escapeForJS,XN=function(){function t(t,e){this.varName=void 0,this.expression=void 0,this.varName=t,this.expression=e}return t.prototype.toString=function(){return HN+this.varName+"="+this.expression+";"},t}();function jN(t,e){return e instanceof XN?new XN(e.varName,t+e.expression):t+e}function YN(t,e,i){Array.isArray(i)?(i[0]=jN(e,i[0]),t.push(i)):t.push(jN(e,i)+";")}var KN=function(){function t(t){this._exps=void 0,this._targetExp=void 0,this._exps=[],this._targetExp=t}var e=t.prototype;return e.append=function(t,e){this._exps.push([t,e])},e.writeCode=function(t){var e;if(this._exps.length>1)t.push("t="+this._targetExp+";"),e="t";else{if(1!==this._exps.length)return;e=this._targetExp}for(var i=0;i<this._exps.length;i++){var n=this._exps[i];YN(t,e+qN(n[0])+"=",n[1])}},t}();function qN(t){return GN.test(t)?"."+t:"["+WN(t)+"]"}KN.pool=void 0,KN.pool=new se((function(t){t._exps.length=0,t._targetExp=null}),1),KN.pool.get=function(t){var e=this._get()||new KN;return e._targetExp=t,e};var QN,ZN,JN,$N,tL,eL,iL=function(){function t(t,e){var i;this.parent=void 0,this.objsToClear_iN$t=void 0,this.codeArray=void 0,this.objs=void 0,this.funcs=void 0,this.funcModuleCache=void 0,this.globalVariables=void 0,this.globalVariableId=void 0,this.localVariableId=void 0,this.result=void 0,this.parent=e,this.objsToClear_iN$t=[],this.codeArray=[],this.objs=[],this.funcs=[],this.funcModuleCache=Ot(),Ht(this.funcModuleCache,VN),this.globalVariables=[],this.globalVariableId=0,this.localVariableId=0,this.codeArray.push("var o,t;","if(R){","o=R;","}else{","o=R=new "+this.getFuncModule(t.constructor,!0)+"();","}"),t._iN$t={globalVar:"R"},this.objsToClear_iN$t.push(t),this.enumerateObject(this.codeArray,t),this.globalVariables.length>0&&(i=HN+this.globalVariables.join(",")+";");var n=Gl(["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=Dt(t);if(i){var n=this.funcModuleCache[i];if(n)return n;if(void 0===n){var r=-1!==i.indexOf(".");if(r)try{if(r=t===Function("return "+i)())return this.funcModuleCache[i]=i,i}catch(t){}}}var s=this.funcs.indexOf(t);s<0&&(s=this.funcs.length,this.funcs.push(t));var a="F["+s+"]";return e&&(a="("+a+")"),this.funcModuleCache[i]=a,a},e.getObjRef=function(t){var e=this.objs.indexOf(t);return e<0&&(e=this.objs.length,this.objs.push(t)),"O["+e+"]"},e.setValueType=function(t,e,i,n){var r=KN.pool.get(n),s=e.constructor.__props__;s||(s=Object.keys(e));for(var a=0;a<s.length;a++){var o=s[a],h=i[o];if(e[o]!==h){var u=this.enumerateField(i,o,h);r.append(o,u)}}r.writeCode(t),KN.pool.put(r)},e.enumerateCCClass=function(t,e,i){for(var n=i.__values__,r=gi.Attr.getClassAttrs(i),s=0;s<n.length;s++){var a=n[s],o=e[a],h=r[a+UN];if(!nL(h,o))if("object"==typeof o&&o instanceof v.ValueType&&(h=gi.getDefault(h))&&h.constructor===o.constructor){var u=zN+qN(a);this.setValueType(t,h,o,u)}else this.setObjProp(t,e,a,o)}},e.instantiateArray=function(t){if(0===t.length)return"[]";var e="a"+ ++this.localVariableId,i=[new XN(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)YN(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 XN(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]&&YN(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]=jN(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?WN(i):("_objFlags"===e&&Xa(t)&&(i&=kN),i)},e.setObjProp=function(t,e,i,n){YN(t,zN+qN(i)+"=",this.enumerateField(e,i,n))},e.enumerateObject=function(t,e){var i=e.constructor;if(vi(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 v.ValueType)return gi.getNewValueTypeCode(t);if(t instanceof v.Asset)return this.getObjRef(t);if(t._objFlags&FN)return null;var e,i=t.constructor;if(vi(i)){if(this.parent)if(this.parent instanceof v.Component){if(t instanceof v.Node||t instanceof v.Component)return this.getObjRef(t)}else if(this.parent instanceof v.Node)if(t instanceof v.Node){if(!t.isChildOf(this.parent))return this.getObjRef(t)}else if(t instanceof v.Component){var n;if(null===(n=t.node)||void 0===n||!n.isChildOf(this.parent))return this.getObjRef(t)}e=new XN(zN,"new "+this.getFuncModule(i,!0)+"()")}else if(i===Object)e=new XN(zN,"{}");else{if(i)return this.getObjRef(t);e=new XN(zN,"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 nL(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 v.ValueType){if(t.equals(e))return!0}else{if(Array.isArray(t))return 0===t.length&&0===e.length;if(t.constructor===Object)return Rt(t)&&Rt(e)}return!1}var rL=ve({AUTO:0,SINGLE_INSTANCE:1,MULTI_INSTANCE:2}),sL=t("dF",qs("cc.Prefab")(((eL=function(t){function e(){var e;return(e=t.call(this)||this).data=JN&&JN(),e.optimizationPolicy=$N&&$N(),e.persistent=tL&&tL(),e._createFunction=void 0,e._instantiatedTimes=void 0,e._createFunction=null,e._instantiatedTimes=0,e}s(e,t);var i=e.prototype;return i.createNode=function(t){var e=v.instantiate(this);e.name=this.name,t(null,e)},i.compileCreateFunction=function(){var t,e;this._createFunction=(e=(t=this.data)instanceof v.Node&&t,new iL(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 this.optimizationPolicy!==rL.SINGLE_INSTANCE&&(this.optimizationPolicy===rL.MULTI_INSTANCE||this._instantiatedTimes+1>=e.OptimizationPolicyThreshold)?(t=this._doInstantiate(),this.data._instantiate(t)):t=this.data._instantiate(),++this._instantiatedTimes,t},i.initDefault=function(e){t.prototype.initDefault.call(this,e),this.data=new $m,this.data.name="(Missing Node)";var i=new v._PrefabInfo;i.asset=this,i.root=this.data,this.data._prefab=i},i.validate=function(){return!!this.data},i.onLoaded=function(){var t=this.data;fC(t),_C(t)},e}(uf)).OptimizationPolicy=rL,eL.OptimizationPolicyThreshold=3,JN=Gs((ZN=eL).prototype,"data",[ra],(function(){return null})),$N=Gs(ZN.prototype,"optimizationPolicy",[ra],(function(){return rL.AUTO})),tL=Gs(ZN.prototype,"persistent",[ra],(function(){return!1})),QN=ZN))||QN);Ct(sL,"_utils",EC),v.Prefab=sL,Mt(v,"cc._Prefab","Prefab");var aL=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&&(le(this._dirtyRenderers,t),t._dirtyVersion=-1)}},e.markDirtyRenderer=function(t){t._dirtyVersion!==this._dirtyVersion&&-1!==t._internalId&&(this._dirtyRenderers.push(t),t._dirtyVersion=this._dirtyVersion)},e.updateAllDirtyRenderers=function(){for(var t=this._dirtyRenderers.length,e=this._dirtyRenderers,i=0;i<t;i++)e[i].updateRenderer();this._dirtyRenderers.length=0,this._dirtyVersion++},t}()),oL=[".png",".jpg",".bmp",".jpeg",".gif",".ico",".tiff",".webp",".image",".pvr",".pkm",".astc"],hL=[".mp3",".ogg",".wav",".m4a"];function uL(){return!0}var lL={transformURL:function(t){var e=Zd(t);if(!e)return t;var i=Fd.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"===cl(t)&&(s=!0),s){var a=fl(t),o=dl(t);t=a+"."+n+"/"+o}else t=t.replace(/.*[/\\][0-9a-fA-F]{2}[/\\]([0-9a-fA-F-@]{8,})/,(function(t){return t+"."+n}));return t}},cL=t("ep",function(){function t(){this._autoReleaseSetting=Object.create(null),this._parseLoadResArgs=$y}var e=t.prototype;return e.load=function(t,e,i){void 0===i&&void 0!==e&&(i=e,e=null);for(var n=Array.isArray(t)?t:[t],r=0;r<n.length;r++){var s=n[r];"string"==typeof s?n[r]={url:s,__isNative__:!0}:(s.type&&(s.ext="."+s.type,s.type=void 0),s.url&&(s.__isNative__=!0))}var a=[],o=[];eS.loadAny(n,null,(function(t,i,n){n.content&&(oL.includes(n.ext)?a.push(n.content):hL.includes(n.ext)&&o.push(n.content)),e&&e(t,i,n)}),(function(t,e){var r=null;if(!t){e=Array.isArray(e)?e:[e];for(var s=function(t){var i=e[t];if(!(i instanceof uf)){var r=i,s=n[t].url;a.includes(r)?kT.create(s,i,".png",{},(function(i,n){r=e[t]=n})):o.includes(r)&&kT.create(s,i,".mp3",{},(function(i,n){r=e[t]=n})),Bd.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:uL,_map:u}}else r=e[0]}i&&i(t,r)}))},e.getXMLHttpRequest=function(){return new XMLHttpRequest},e.getItem=function(t){return eS.assets.has(t)?{content:eS.assets.get(t)}:null},e.loadRes=function(t,e,i,n){var r=this._parseLoadResArgs(e,i,n),s=r.type,a=r.onProgress,o=r.onComplete,h=cl(t);h&&!nT.getInfoWithPath(t,s)&&(t=t.slice(0,-h.length)),nT.load(t,s,a,o)},e.loadResArray=function(t,e,i,n){var r=this._parseLoadResArgs(e,i,n),s=r.type,a=r.onProgress,o=r.onComplete;t.forEach((function(e,i){var n=cl(e);n&&!nT.getInfoWithPath(e,s)&&(t[i]=e.slice(0,-n.length))})),nT.load(t,s,a,o)},e.loadResDir=function(t,e,i,n){var r=this._parseLoadResArgs(e,i,n),s=r.type,a=r.onProgress,o=r.onComplete;nT.loadDir(t,s,a,(function(e,i){var n=[];e||(n=nT.getDirWithPath(t,s).map((function(t){return t.path}))),o&&o(e,i,n)}))},e.getRes=function(t,e){return Bd.has(t)?Bd.get(t):nT.get(t,e)},e.getResCount=function(){return Bd.count},e.getDependsRecursively=function(t){if(!t)return[];var e="string"==typeof t?t:t._uuid;return jp.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();CT.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();WT.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=Bd.get(i)),eS.releaseAsset(i)}else t&&("string"==typeof t&&(t=Bd.get(t)),eS.releaseAsset(t))},e.releaseAsset=function(t){eS.releaseAsset(t)},e.releaseRes=function(t,e){nT.release(t,e)},e.releaseAll=function(){eS.releaseAll(),Bd.clear()},e.removeItem=function(t){return!!Bd.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=jp.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){Xy=t}},{key:"_cache",get:function(){if(Bd instanceof Dd)return Bd.map;var t={};return Bd.forEach((function(e,i){t[i]=e})),t}},{key:"md5Pipe",get:function(){return lL}},{key:"downloader",get:function(){return CT}},{key:"loader",get:function(){return eS.parser}}]),t}()),_L=t("eq",new cL),dL=t("er",{init:function(t){t.importBase=t.libraryPath,t.nativeBase=t.rawAssetsBase,eS.init(t),t.rawAssets&&nT.init({base:"",deps:[],scenes:{},redirect:[],debug:!0,packs:{},types:[],versions:{import:[],native:[]},name:zd.RESOURCES,importBase:t.importBase,nativeBase:t.nativeBase,paths:t.rawAssets.assets,uuids:Object.keys(t.rawAssets.assets),extensionMap:{}})},loadAsset:function(t,e){eS.loadAny(t,e)}}),fL=t("es",{});rt(fL,"url",[{name:"normalize",target:eS.utils,targetName:"assetManager.utils",newName:"normalize"},{name:"raw",targetName:"Asset.prototype",newName:"nativeUrl",customFunction:function(t){return t.startsWith("resources/")?ef({path:pl(t.substr(10)),bundle:zd.RESOURCES,__isNative__:!0,ext:cl(t)}):""}}]),st(dL,"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(_L,"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(v,"cc",[{name:"loader",newName:"assetManager",logTimes:1,customGetter:function(){return _L}},{name:"AssetLibrary",newName:"assetManager",logTimes:1,customGetter:function(){return dL}},{name:"Pipeline",target:tS,targetName:"AssetManager",newName:"Pipeline",logTimes:1},{name:"url",targetName:"assetManager",newName:"utils",logTimes:1,customGetter:function(){return fL}}]),st(v,"cc",[{name:"LoadingItems",suggest:et(1400,"LoadingItems","AssetManager.Task")}]),rt(Ce,"macro",[{name:"DOWNLOAD_MAX_CONCURRENT",target:CT,targetName:"assetManager.downloader",newName:"maxConcurrency"}]);var pL=Wy._autoRelease;Wy._autoRelease=function(t,e,i){pL.call(Wy,t,e,i);for(var n=_L._autoReleaseSetting,r=Object.keys(n),s=0;s<r.length;s++){var a=r[s];if(!0===n[a]){var o=Bd.get(a);o&&Wy.tryRelease(o)}}};var mL=t("e0",function(t){function e(){var e;return(e=t.call(this)||this)._compScheduler=void 0,e._nodeActivator=void 0,e._invalid=void 0,e._paused=void 0,e._root=void 0,e._loadingScene=void 0,e._scene=void 0,e._totalFrames=void 0,e._scheduler=void 0,e._systems=void 0,e._persistRootNodes={},e._invalid=!1,e._paused=!1,e._root=null,e._loadingScene="",e._scene=null,e._totalFrames=0,e._scheduler=new zu,e._compScheduler=new bN,e._nodeActivator=new LN,e._systems=[],e}s(e,t);var i=e.prototype;return i.calculateDeltaTime=function(){},i.end=function(){var t=this;this.once(e.EVENT_END_FRAME,(function(){t.purgeDirector()}))},i.pause=function(){this._paused||(this._paused=!0)},i.purgeDirector=function(){this._scheduler.unscheduleAll(),this._compScheduler.unscheduleAll(),this._nodeActivator.reset(),ja(this._scene)&&this._scene.destroy(),this._scene=null,this.stopAnimation(),eS.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 RC&&(t=t.scene),tt(t instanceof AC,1216),t._load();for(var s=Object.keys(this._persistRootNodes).map((function(t){return r._persistRootNodes[t]})),a=0;a<s.length;a++){var o=s[a];o.emit($m.EventType.SCENE_CHANGED_FOR_PERSISTS,t.renderScene);var h=t.uuid===o._originalSceneId&&t.getChildByUuid(o.uuid);if(h){var u=h.getSiblingIndex();o.hideFlags&=~Wa.Flags.DontSave,o.hideFlags|=Wa.Flags.DontSave&h.hideFlags,h._destroyImmediate(),t.insertChild(o,u)}else o.hideFlags|=Wa.Flags.DontSave,o.parent=t}var l=this._scene;ja(l)&&l.destroy(),Wy._autoRelease(l,t,this._persistRootNodes),this._scene=null,Wa._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 RC&&(t=t.scene),tt(Boolean(t),1205),tt(t instanceof AC,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=eS.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?(G(e),i&&i(e)):r.runSceneImmediate(s,n,i)})),!0):(Z(1209,t),!1)},i.preloadScene=function(t,e,i){var n=eS.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)),G("preloadScene: "+r)}},i.resume=function(){this._paused&&(this._paused=!1)},i.getScene=function(){return this._scene},i.getDeltaTime=function(){return v.game.deltaTime},i.getTotalTime=function(){return v.game.totalTime},i.getCurrentTime=function(){return v.game.frameStartTime},i.getTotalFrames=function(){return this._totalFrames},i.isPaused=function(){return this._paused},i.getScheduler=function(){return this._scheduler},i.setScheduler=function(t){this._scheduler!==t&&(this.unregisterSystem(this._scheduler),this._scheduler=t,this.registerSystem(zu.ID,t,200))},i.registerSystem=function(t,e,i){e.id=t,e.priority=i,this._systems.push(e),this._systems.sort(Lu.sortByPriority)},i.unregisterSystem=function(t){le(this._systems,t),this._systems.sort(Lu.sortByPriority)},i.getSystem=function(t){return this._systems.find((function(e){return e.id===t}))},i.getAnimationManager=function(){return this.getSystem(v.AnimationManager.ID)},i.startAnimation=function(){this._invalid=!1},i.stopAnimation=function(){this._invalid=!0},i.mainLoop=function(t){var e;e=v.game._calculateDT(t),this.tick(e)},i.tick=function(t){if(!this._invalid){if(this.emit(e.EVENT_BEGIN_FRAME),Cw._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),Wa._deferredDestroy();for(var n=0;n<this._systems.length;++n)this._systems[n].postUpdate(t)}this.emit(e.EVENT_BEFORE_DRAW),aL.updateAllDirtyRenderers(),this._root.frameMove(t),this.emit(e.EVENT_AFTER_DRAW),$m.resetHasChangedFlags(),$m.clearNodeArray(),Mu.update(t),this.emit(e.EVENT_END_FRAME),this._totalFrames++}},i.buildRenderPipeline=function(){this._root&&(this._root.customPipeline.beginSetup(),v.rendering.getCustomPipeline(Ce.CUSTOM_PIPELINE_NAME).setup(this._root.cameraList,this._root.customPipeline),this._root.customPipeline.endSetup())},i.setupRenderPipelineBuilder=function(){""!==Ce.CUSTOM_PIPELINE_NAME&&v.rendering&&this._root&&this._root.usesCustomPipeline&&this.on(e.EVENT_BEFORE_RENDER,this.buildRenderPipeline,this)},i.init=function(){this._totalFrames=0,this._paused=!1,this.registerSystem(zu.ID,this._scheduler,200),this._root=new JB(wd.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($m.isNode(t)&&t.uuid){var e=t.uuid;if(!this._persistRootNodes[e]){var i=this._scene;if(ja(i))if(t.parent){if(!(t.parent instanceof AC))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,Wy._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="",Wy._removePersistNodeRef(t))},i.isPersistRootNode=function(t){return!!t._persistNode},n(e,[{key:"root",get:function(){return this._root}}]),e}(Ju));mL.EVENT_INIT="director_init",mL.EVENT_RESET="director_reset",mL.EVENT_BEFORE_SCENE_LOADING="director_before_scene_loading",mL.EVENT_BEFORE_SCENE_LAUNCH="director_before_scene_launch",mL.EVENT_AFTER_SCENE_LAUNCH="director_after_scene_launch",mL.EVENT_BEFORE_UPDATE="director_before_update",mL.EVENT_AFTER_UPDATE="director_after_update",mL.EVENT_BEFORE_DRAW="director_before_draw",mL.EVENT_AFTER_DRAW="director_after_draw",mL.EVENT_BEFORE_COMMIT="director_before_commit",mL.EVENT_BEFORE_RENDER="director_before_render",mL.EVENT_AFTER_RENDER="director_after_render",mL.EVENT_BEFORE_PHYSICS="director_before_physics",mL.EVENT_AFTER_PHYSICS="director_after_physics",mL.EVENT_BEGIN_FRAME="director_begin_frame",mL.EVENT_END_FRAME="director_end_frame",mL.instance=void 0,v.Director=mL;var gL=t("e1",mL.instance=v.director=new mL),vL=function(){function t(){var t=this;this._stHandle=0,this._onTick=null,this._targetFrameRate=60,this._frameTime=0,this._startTime=0,this._isPlaying=!1,this._frameCount=0,this._callback=null,this._rAF=void 0,this._cAF=void 0,this._handleRAF=function(){var e=performance.now()-t._startTime;Math.floor(e/t._frameTime)<t._frameCount?t._rAF.call(window,t._handleRAF):(t._frameCount++,t._callback&&t._callback()),performance.now()-t._startTime>2e3&&(t._startTime=performance.now(),t._frameCount=0)},this._frameTime=1e3/this._targetFrameRate,this._rAF=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame,this._cAF=window.cancelAnimationFrame||window.cancelRequestAnimationFrame||window.msCancelRequestAnimationFrame||window.mozCancelRequestAnimationFrame||window.oCancelRequestAnimationFrame||window.webkitCancelRequestAnimationFrame||window.msCancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.ocancelAnimationFrame}var e=t.prototype;return e.start=function(){var t,e=this;if(!this._isPlaying){var i=void 0===this._rAF||(null===(t=globalThis.__globalXR)||void 0===t?void 0:t.isWebXR);this._startTime=performance.now(),this._stHandle=this._stTime((function t(){i&&(e._startTime=performance.now()),e._isPlaying&&(e._stHandle=e._stTime(t)),e._onTick&&e._onTick()})),this._isPlaying=!0,this._frameCount=0}},e.stop=function(){this._isPlaying&&(this._ctTime(this._stHandle),this._stHandle=0,this._isPlaying=!1,this._frameCount=0)},e._stTime=function(t){var e;if(void 0===this._rAF||null!==(e=globalThis.__globalXR)&&void 0!==e&&e.isWebXR){var i=performance.now(),n=Math.max(0,i-this._startTime),r=Math.max(0,this._frameTime-n);return setTimeout(t,r)}return this._callback=t,this._rAF.call(window,this._handleRAF)},e._ctTime=function(t){var e;void 0===this._cAF||null!==(e=globalThis.__globalXR)&&void 0!==e&&e.isWebXR?clearTimeout(t):t&&this._cAF.call(window,t)},n(t,[{key:"targetFrameRate",get:function(){return this._targetFrameRate},set:function(t){this._targetFrameRate!==t&&(this._targetFrameRate=t,this._frameTime=1e3/this._targetFrameRate,this._isPlaying&&(this.stop(),this.start()))}},{key:"onTick",get:function(){return this._onTick},set:function(t){this._onTick=t}}]),t}();at(SD.prototype,"RenderPipeline.prototype",[{name:"geometryRenderer",suggest:"please use camera.geometryRenderer instead."}]);var yL=new Fn,TL=function(){var t=e.prototype;function e(){this.settings=void 0,this._curTime=0,this.device=void 0,this.swapchain=void 0,this.shader=void 0,this.sampler=void 0,this.cmdBuff=void 0,this.quadAssmebler=void 0,this.vertexBuffers=void 0,this.indicesBuffers=void 0,this.renderArea=void 0,this.clearColors=void 0,this.projection=void 0,this.isMobile=!1,this.bgMat=void 0,this.bgImage=void 0,this.bgTexture=void 0,this.logoMat=void 0,this.logoImage=void 0,this.logoTexture=void 0,this.watermarkMat=void 0,this.watermarkTexture=void 0,this.bgWidth=1920,this.bgHeight=1080,this.bgRatio=16/9,this.logoWidthTemp=140,this.logoHeightTemp=200,this.logoWidth=0,this.logoHeight=0,this.logoXTrans=.5,this.logoYTrans=1/6+2.5/6,this.textSize=24,this.textHeight=24,this.textXTrans=.5,this.textYExtraTrans=32,this.textExpandSize=4,this.scaleSize=1}return t.init=function(){var t,e,i,n,r,s,a=this;if(this.settings={displayRatio:null!==(t=be.querySettings(Re.Category.SPLASH_SCREEN,"displayRatio"))&&void 0!==t?t:.4,totalTime:null!==(e=be.querySettings(Re.Category.SPLASH_SCREEN,"totalTime"))&&void 0!==e?e:3e3,watermarkLocation:null!==(i=be.querySettings(Re.Category.SPLASH_SCREEN,"watermarkLocation"))&&void 0!==i?i:"default",autoFit:null===(n=be.querySettings(Re.Category.SPLASH_SCREEN,"autoFit"))||void 0===n||n,logo:null!==(r=be.querySettings(Re.Category.SPLASH_SCREEN,"logo"))&&void 0!==r?r:void 0,background:null!==(s=be.querySettings(Re.Category.SPLASH_SCREEN,"background"))&&void 0!==s?s:void 0},this._curTime=0,!(this.settings.totalTime<=0||void 0===this.settings.logo||void 0===this.settings.background)){this.device=v.director.root.device,this.swapchain=v.director.root.mainWindow.swapchain,this.preInit(),this.initLayout(),"default"===this.settings.logo.type&&this.initWaterMark();var o=Promise.resolve(),h=Promise.resolve();return"custom"===this.settings.background.type&&(o=new Promise((function(t,e){a.bgImage=new T.Image,a.bgImage.onload=function(){a.initBG(),t()},a.bgImage.onerror=function(){e()},a.bgImage.src=a.settings.background.base64}))),"none"!==this.settings.logo.type&&(h=new Promise((function(t,e){a.logoImage=new T.Image,a.logoImage.onload=function(){a.initLogo(),t()},a.logoImage.onerror=function(){e()},a.logoImage.src=a.settings.logo.base64}))),Promise.all([o,h])}return this.settings.totalTime=0,Promise.resolve([])},t.preInit=function(){var t,e=null===(t=this.settings.background)||void 0===t?void 0:t.color;this.clearColors=e?[new Xc(e.x,e.y,e.z,e.w)]:[new Xc(0,0,0,1)];var i=this.device,n=this.swapchain;this.renderArea=new Fc(0,0,n.width,n.height),this.cmdBuff=i.commandBuffer;var r=new Float32Array([.5,.5,1,0,-.5,.5,0,0,.5,-.5,1,1,-.5,-.5,0,1]),s=4*Float32Array.BYTES_PER_ELEMENT,a=4*s;this.vertexBuffers=i.createBuffer(new qc(ql.VERTEX|ql.TRANSFER_DST,Jl.DEVICE,a,s)),this.vertexBuffers.update(r);var o=new Uint16Array([0,1,2,1,3,2]),h=Uint16Array.BYTES_PER_ELEMENT,u=6*h;this.indicesBuffers=i.createBuffer(new qc(ql.INDEX|ql.TRANSFER_DST,Jl.DEVICE,u,h)),this.indicesBuffers.update(o);var l=[new __("a_position",jl.RG32F),new __("a_texCoord",jl.RG32F)],c=new f_(l,[this.vertexBuffers],this.indicesBuffers);this.quadAssmebler=i.createInputAssembler(c),this.projection=new Dn,Dn.ortho(this.projection,-1,1,-1,1,-1,1,i.capabilities.clipSpaceMinZ,i.capabilities.clipSpaceSignY,n.surfaceTransform),this.isMobile=Ol.isMobile},t.initLayout=function(){this.isMobile?(this.bgWidth=812,this.bgHeight=375,this.logoWidthTemp=70,this.logoHeightTemp=100,this.textSize=12,this.textHeight=this.textSize+this.textExpandSize,this.textXTrans=.5,this.textYExtraTrans=16):(this.bgWidth=1920,this.bgHeight=1080,this.logoWidthTemp=140,this.logoHeightTemp=200,this.textSize=24,this.textHeight=this.textSize+this.textExpandSize,this.textXTrans=.5,this.textYExtraTrans=32),this.logoXTrans=.5,this.logoYTrans=1/6+2.5/6,this.initScale()},t.initScale=function(){var t=this.swapchain.width,e=this.swapchain.height,i=this.isMobile?375:1080,n=this.isMobile?812:1920;if(t>e){var r=n;n=i,i=r}this.scaleSize=t/e>16/9?e/n:t/i},t.update=function(t){var e=this.settings,i=this.device,n=this.swapchain;Dn.ortho(this.projection,-1,1,-1,1,-1,1,i.capabilities.clipSpaceMinZ,i.capabilities.clipSpaceSignY,n.surfaceTransform);var r=n.width,s=n.height;this.initScale(),this._curTime+=1e3*t;var a=so(Oi(this._curTime/e.totalTime)),o=1,h=1;"custom"===this.settings.background.type&&(r<s?(o=s*this.bgRatio,h=s):(o=r,h=r*this.bgRatio),this.bgMat.setProperty("resolution",yL.set(r,s),0),this.bgMat.setProperty("scale",yL.set(o,h),0),this.bgMat.setProperty("translate",yL.set(.5*r,.5*s),0),this.bgMat.setProperty("percent",1),this.bgMat.setProperty("u_projection",this.projection),this.bgMat.passes[0].update());var u=s*this.logoYTrans;if("none"!==this.settings.logo.type&&(o=this.logoWidth*this.scaleSize*e.displayRatio,h=this.logoHeight*this.scaleSize*e.displayRatio,this.logoMat.setProperty("resolution",yL.set(r,s),0),this.logoMat.setProperty("scale",yL.set(o,h),0),this.logoMat.setProperty("translate",yL.set(r*this.logoXTrans,u),0),this.logoMat.setProperty("percent",a),this.logoMat.setProperty("u_projection",this.projection),this.logoMat.passes[0].update()),"default"===this.settings.logo.type&&this.watermarkMat){var l=this.watermarkTexture.width,c=this.watermarkTexture.height;o=l,h=c;var _=u-(.5*this.logoHeight*e.displayRatio+this.textYExtraTrans)*this.scaleSize-.5*c;this.watermarkMat.setProperty("resolution",yL.set(r,s),0),this.watermarkMat.setProperty("scale",yL.set(o,h),0),this.watermarkMat.setProperty("translate",yL.set(r*this.textXTrans,_),0),this.watermarkMat.setProperty("percent",a),this.watermarkMat.setProperty("u_projection",this.projection),this.watermarkMat.passes[0].update()}this.frame()},t.initBG=function(){var t=this.device;this.bgMat=new OS,this.bgMat.initialize({effectName:"util/splash-screen"});var e=new i_;e.addressU=ac.CLAMP,e.addressV=ac.CLAMP,e.addressW=ac.CLAMP,this.sampler=t.getSampler(e),this.bgTexture=t.createTexture(new t_($l.TEX2D,tc.SAMPLED|tc.TRANSFER_DST,jl.RGBA8,this.bgImage.width,this.bgImage.height));var i=this.bgMat.passes[0],n=i.getBinding("mainTexture");i.bindTexture(n,this.bgTexture),this.shader=i.getShaderVariant();var r=i.descriptorSet;r.bindSampler(n,this.sampler),r.update();var s=new Vc;s.texExtent.width=this.bgImage.width,s.texExtent.height=this.bgImage.height,s.texExtent.depth=1,t.copyTexImagesToTexture([this.bgImage],this.bgTexture,[s])},t.initLogo=function(){var t=this.device;this.logoMat=new OS,this.logoMat.initialize({effectName:"util/splash-screen"});var e=new i_;e.addressU=ac.CLAMP,e.addressV=ac.CLAMP,e.addressW=ac.CLAMP,this.sampler=t.getSampler(e),this.logoTexture=t.createTexture(new t_($l.TEX2D,tc.SAMPLED|tc.TRANSFER_DST,jl.RGBA8,this.logoImage.width,this.logoImage.height));var i=this.logoMat.passes[0],n=i.getBinding("mainTexture");i.bindTexture(n,this.logoTexture),this.shader=i.getShaderVariant();var r=i.descriptorSet;r.bindSampler(n,this.sampler),r.update();var s=new Vc;s.texExtent.width=this.logoImage.width,s.texExtent.height=this.logoImage.height,s.texExtent.depth=1,t.copyTexImagesToTexture([this.logoImage],this.logoTexture,[s]);var a=this.logoImage.width/this.logoImage.height;a<1?(this.logoWidth=this.logoWidthTemp,this.logoHeight=this.logoWidthTemp/a):(this.logoWidth=this.logoHeightTemp*a,this.logoHeight=this.logoHeightTemp)},t.initWaterMark=function(){var t=T.document.createElement("canvas");t.height=this.textHeight*this.scaleSize,t.style.width=""+t.width,t.style.height=""+t.height;var e="Created with Cocos",i=t.getContext("2d");i.font=this.textSize*this.scaleSize+"px Arial",i.textBaseline="top",i.textAlign="center",i.fillStyle="#707070";var n=i.measureText(e).width+10;t.width=n,i.font=this.textSize*this.scaleSize+"px Arial",i.textBaseline="top",i.textAlign="center",i.fillStyle="#707070",i.fillText(e,t.width/2,0);var r=new Vc;r.texExtent.width=t.width,r.texExtent.height=t.height,r.texExtent.depth=1,this.watermarkTexture=this.device.createTexture(new t_($l.TEX2D,tc.SAMPLED|tc.TRANSFER_DST,jl.RGBA8,t.width,t.height)),this.device.copyTexImagesToTexture([t],this.watermarkTexture,[r]),this.watermarkMat=new OS,this.watermarkMat.initialize({effectName:"util/splash-screen"});var s=this.watermarkMat.passes[0],a=s.getBinding("mainTexture");s.bindTexture(a,this.watermarkTexture),s.descriptorSet.update()},t.frame=function(){var t=this.device,e=this.swapchain;if(!Ol.isXR||xr.entry.isRenderAllowable())for(var i=Ol.isXR?2:1,n=0;n<i;n++){if(Ol.isXR){xr.entry.renderLoopStart(n);var r=xr.entry.getEyeFov(n),s=1,a=1;n===RB.LEFT?s=Math.abs(Math.tan(r[0]))/Math.abs(Math.tan(r[1])):n===RB.RIGHT&&(a=Math.abs(Math.tan(r[1]))/Math.abs(Math.tan(r[0]))),Dn.ortho(this.projection,-s,a,-1,1,-1,1,t.capabilities.clipSpaceMinZ,t.capabilities.clipSpaceSignY,e.surfaceTransform),this.projection.m00=On[e.surfaceTransform][0],this.projection.m05=On[e.surfaceTransform][3]*t.capabilities.clipSpaceSignY,"custom"===this.settings.background.type&&(this.bgMat.setProperty("u_projection",this.projection),this.bgMat.passes[0].update()),"none"!==this.settings.logo.type&&(this.logoMat.setProperty("u_projection",this.projection),this.logoMat.passes[0].update()),"default"===this.settings.logo.type&&this.watermarkMat&&(this.watermarkMat.setProperty("u_projection",this.projection),this.watermarkMat.passes[0].update())}t.enableAutoBarrier(!0),t.acquire([e]);var o=this.cmdBuff,h=v.director.root.mainWindow.framebuffer,u=this.renderArea;if(u.width=e.width,u.height=e.height,o.begin(),o.beginRenderPass(h.renderPass,h,u,this.clearColors,1,0),"custom"===this.settings.background.type){var l=this.bgMat.passes[0],c=dS.getOrCreatePipelineState(t,l,this.shader,h.renderPass,this.quadAssmebler);o.bindPipelineState(c),o.bindDescriptorSet(xg.MATERIAL,l.descriptorSet),o.bindInputAssembler(this.quadAssmebler),o.draw(this.quadAssmebler)}if("none"!==this.settings.logo.type){var _=this.logoMat.passes[0],d=dS.getOrCreatePipelineState(t,_,this.shader,h.renderPass,this.quadAssmebler);o.bindPipelineState(d),o.bindDescriptorSet(xg.MATERIAL,_.descriptorSet),o.bindInputAssembler(this.quadAssmebler),o.draw(this.quadAssmebler)}if("default"===this.settings.logo.type&&this.watermarkMat){var f=this.watermarkMat.passes[0],p=dS.getOrCreatePipelineState(t,f,this.shader,h.renderPass,this.quadAssmebler);o.bindPipelineState(p),o.bindDescriptorSet(xg.MATERIAL,f.descriptorSet),o.bindInputAssembler(this.quadAssmebler),o.draw(this.quadAssmebler)}o.endRenderPass(),o.end(),t.flushCommands([o]),t.queue.submit([o]),t.present(),t.enableAutoBarrier(!v.rendering),Ol.isXR&&xr.entry.renderLoopEnd(n)}},t.destroy=function(){this.device=null,this.swapchain=null,this.clearColors=null,"custom"===this.settings.background.type&&(this.bgImage.destroy&&this.bgImage.destroy(),this.bgImage=null,this.bgMat.destroy(),this.bgMat=null,this.bgTexture.destroy(),this.bgTexture=null),"none"!==this.settings.logo.type&&(this.logoImage.destroy&&this.logoImage.destroy(),this.logoImage=null,this.logoMat.destroy(),this.logoMat=null,this.logoTexture.destroy(),this.logoTexture=null),this.renderArea=null,this.cmdBuff=null,this.shader=null,this.quadAssmebler.destroy(),this.quadAssmebler=null,this.vertexBuffers.destroy(),this.vertexBuffers=null,this.indicesBuffers.destroy(),this.indicesBuffers=null,this.sampler=null,"default"===this.settings.logo.type&&this.watermarkTexture&&(this.watermarkMat.destroy(),this.watermarkMat=null,this.watermarkTexture.destroy(),this.watermarkTexture=null),this.settings=null},n(e,[{key:"isFinished",get:function(){return this._curTime>=this.settings.totalTime}},{key:"curTime",get:function(){return this._curTime},set:function(t){this._curTime=t}}],[{key:"instance",get:function(){return e._ins||(e._ins=new e),e._ins}}]),e}();TL._ins=void 0,v.internal.SplashScreen=TL;var SL=new(function(){function t(){this._data=null}return t.prototype.init=function(t){var e=this;return void 0===t&&(t=""),v.rendering&&v.rendering.enableEffectImport&&t?new Promise((function(i,n){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)})):Promise.resolve()},n(t,[{key:"data",get:function(){return this._data}}]),t}());v.effectSettings=SL;var EL=t("e2",function(t){function i(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).frame=null,e.container=null,e.canvas=null,e.renderType=-1,e.eventTargetOn=t.prototype.on,e.eventTargetOnce=t.prototype.once,e.config={},e.onStart=null,e.frameTime=1e3/60,e._isCloning=!1,e._inited=!1,e._engineInited=!1,e._rendererInitialized=!1,e._paused=!0,e._pausedByEngine=!1,e._frameRate=60,e._pacer=null,e._initTime=0,e._startTime=0,e._deltaTime=0,e._useFixedDeltaTime=!1,e._shouldLoadLaunchScene=!0,e.onPreBaseInitDelegate=new sl,e.onPostBaseInitDelegate=new sl,e.onPreInfrastructureInitDelegate=new sl,e.onPostInfrastructureInitDelegate=new sl,e.onPreSubsystemInitDelegate=new sl,e.onPostSubsystemInitDelegate=new sl,e.onPreProjectInitDelegate=new sl,e.onPostProjectInitDelegate=new sl,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(){gL.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&&(Cw._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){gL.once(mL.EVENT_END_FRAME,(function(){return t()}))})).then((function(){gL.reset(),v.Object._deferredDestroy(),t.pause(),t.resume(),t._shouldLoadLaunchScene=!0,TL.instance.curTime=0,t._safeEmit(i.EVENT_RESTART)}))},r.end=function(){al.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(){V(t.debugMode||J.NONE)})).then((function(){return Ol.init()})).then((function(){n._initEvents()})).then((function(){return be.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(){Ce.init(),n._initXR();var t={frame:document.querySelector("#GameDiv"),container:document.querySelector("#Cocos3dGameContainer"),canvas:document.querySelector("#GameCanvas")};t&&(n.canvas=t.canvas,n.frame=t.frame,n.container=t.container),Il.init(),Fl.init(),wd.init(n.canvas,Mg),""===Ce.CUSTOM_PIPELINE_NAME&&(v.rendering=void 0),eS.init(),aS.init(),sm.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 SL.init(be.querySettings(Re.Category.RENDERING,"effectSettingsPath"))})).then((function(){if(v.rendering&&v.rendering.enableEffectImport)if(be.querySettings(Re.Category.RENDERING,"renderMode")!==Sd.HEADLESS){var t=SL.data;null!==t?v.rendering.init(wd.gfxDevice,t):Z(1102)}else v.rendering.init(wd.gfxDevice,null)})).then((function(){var t=be.querySettings(Re.Category.SCRIPTING,"scriptPackages");return t?Promise.all(t.map((function(t){return e.import(t)}))):Promise.resolve([])})).then((function(){return gL.init(),aS.loadBuiltinAssets()})).then((function(){return n.emit(i.EVENT_POST_SUBSYSTEM_INIT),n.onPostSubsystemInitDelegate.dispatch()})).then((function(){k("Cocos Creator v"+y),n.emit(i.EVENT_ENGINE_INITED),n._engineInited=!0})).then((function(){return n.emit(i.EVENT_PRE_PROJECT_INIT),n.onPreProjectInitDelegate.dispatch()})).then((function(){var t=be.querySettings(Re.Category.PLUGINS,"jsList"),e=Promise.resolve();return t&&t.forEach((function(t){e=e.then((function(){return e="src/"+t,new Promise((function(t,i){var n;function r(t){t.filename===e&&(n=t.error)}window.addEventListener("error",r);var s=document.createElement("script");s.charset="utf-8",s.async=!0,s.crossOrigin="anonymous",s.addEventListener("error",(function(){window.removeEventListener("error",r),i(Error("Error loading "+e))})),s.addEventListener("load",(function(){window.removeEventListener("error",r),document.head.removeChild(s),n?i(n):t()})),s.src=e.replace("#","%23"),document.head.appendChild(s)}));var e}))})),e})).then((function(){return n._loadProjectBundles()})).then((function(){return n._loadCCEScripts()})).then((function(){return n._setupRenderPipeline()})).then((function(){return n._loadPreloadAssets()})).then((function(){return aS.compileBuiltinMaterial(),TL.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=be.querySettings(Re.Category.XR,"webxrCompatible"))&&void 0!==t&&t,Ol.isXR){var e,i;xr.entry=xr.XrEntry.getInstance();var n=null!==(e=be.querySettings(Re.Category.RENDERING,"msaa"))&&void 0!==e?e:1,r=null!==(i=be.querySettings(Re.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=be.querySettings(Re.Category.ASSETS,"preloadAssets");return t?Promise.all(t.map((function(t){return new Promise((function(e,i){eS.loadAny(t,(function(t){t?i(t):e()}))}))}))):Promise.resolve([])},r._loadCCEScripts=function(){return new Promise((function(t){t()}))},r._loadProjectBundles=function(){var t=be.querySettings(Re.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),eS.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(TL.instance.isFinished)if(this._shouldLoadLaunchScene){this._shouldLoadLaunchScene=!1;var e,i=be.querySettings(Re.Category.LAUNCH,"launchScene");i?gL.loadScene(i,(function(){var e;Y(1103,i),t._initTime=performance.now(),gL.startAnimation(),null===(e=t.onStart)||void 0===e||e.call(t)})):(this._initTime=performance.now(),gL.startAnimation(),null===(e=this.onStart)||void 0===e||e.call(this))}else gL.tick(this._calculateDT(!1));else TL.instance.update(this._calculateDT(!1))},r.initPacer=function(){var t,e=null!==(t=be.querySettings(Re.Category.SCREEN,"frameRate"))&&void 0!==t?t:60;H("number"==typeof e),this._pacer=new vL,this._pacer.onTick=this._updateCallback.bind(this),this.frameRate=e},r._initEvents=function(){al.on("show",this._onShow,this),al.on("hide",this._onHide,this),al.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),al.exit()},r.addPersistRootNode=function(t){gL.addPersistRootNode(t)},r.removePersistRootNode=function(t){gL.removePersistRootNode(t)},r.isPersistRootNode=function(t){return gL.isPersistRootNode(t)},r._setupRenderPipeline=function(){var t=this,e=be.querySettings(Re.Category.RENDERING,"renderPipeline");return e?new Promise((function(t,i){eS.loadAny(e,(function(e,n){return!e&&n instanceof SD?t(n):i(e)}))})).then((function(e){t._setRenderPipeline(e)})).catch((function(i){U(i),U("Failed load render pipeline: "+e+", engine failed to initialize, will fallback to default pipeline"),t._setRenderPipeline()})):this._setRenderPipeline()},r._setRenderPipeline=function(t){gL.root.setRenderPipeline(t)||this._setRenderPipeline(),this._rendererInitialized=!0,this._safeEmit(i.EVENT_RENDERER_INITED)},r._safeEmit=function(t){this.emit(t)},n(i,[{key:"inited",get:function(){return this._inited}},{key:"frameRate",get:function(){return this._frameRate},set:function(t){"number"!=typeof t&&(t=parseInt(t,10),Number.isNaN(t)&&(t=60)),this._frameRate=t,this.frameTime=1e3/t,this._pacer&&(this._pacer.targetFrameRate=this._frameRate)}},{key:"deltaTime",get:function(){return this._useFixedDeltaTime?this.frameTime/1e3:this._deltaTime}},{key:"totalTime",get:function(){return performance.now()-this._initTime}},{key:"frameStartTime",get:function(){return this._startTime}}]),i}(Ju));EL.EVENT_HIDE="game_on_hide",EL.EVENT_SHOW="game_on_show",EL.EVENT_LOW_MEMORY="game_on_low_memory",EL.EVENT_GAME_INITED="game_inited",EL.EVENT_ENGINE_INITED="engine_inited",EL.EVENT_RENDERER_INITED="renderer_inited",EL.EVENT_PRE_BASE_INIT="pre_base_init",EL.EVENT_POST_BASE_INIT="post_base_init",EL.EVENT_PRE_INFRASTRUCTURE_INIT="pre_infrastructure_init",EL.EVENT_POST_INFRASTRUCTURE_INIT="post_infrastructure_init",EL.EVENT_PRE_SUBSYSTEM_INIT="pre_subsystem_init",EL.EVENT_POST_SUBSYSTEM_INIT="post_subsystem_init",EL.EVENT_PRE_PROJECT_INIT="pre_project_init",EL.EVENT_POST_PROJECT_INIT="post_project_init",EL.EVENT_RESTART="game_on_restart",EL.EVENT_PAUSE="game_on_pause",EL.EVENT_RESUME="game_on_resume",EL.EVENT_CLOSE="game_on_close",EL.RENDER_TYPE_CANVAS=0,EL.RENDER_TYPE_WEBGL=1,EL.RENDER_TYPE_OPENGL=2,EL.RENDER_TYPE_HEADLESS=3,EL.DEBUG_DT_THRESHOLD=1,v.Game=EL;var AL=t("e3",v.game=new EL);at(mL.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(mL.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(gL,"director",[{name:"_getSceneUuid",targetName:"assetManager.main",newName:"getSceneInfo",customFunction:function(t){var e;return eS.main?null===(e=eS.main.getSceneInfo(t))||void 0===e?void 0:e.uuid:""}}]),at(AL,"game",[{name:"collisionMatrix"},{name:"groupList"}]),rt(AL,"game",[{name:"_sceneInfos",targetName:"assetManager.main",newName:"getSceneInfo",customGetter:function(){var t=[];return eS.main&&eS.main.config.scenes.forEach((function(e){t.push(e)})),t}}]);var RL=t("$",function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._atlases=[],e._atlasIndex=-1,e._maxAtlasCount=5,e._textureSize=2048,e._maxFrameSize=512,e._textureBleeding=!0,e._enabled=!1,e}s(e,t);var i=e.prototype;return i.newAtlas=function(){var t=this._atlases[++this._atlasIndex];return t||(t=new im(this._textureSize,this._textureSize),this._atlases.push(t)),t},i.beforeSceneLoad=function(){this.reset()},i.init=function(){this.enabled=!Ce.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!==_f.LINEAR||e.magFilter!==_f.LINEAR||e.mipFilter!==_f.NONE)return null;var i=this._atlases[this._atlasIndex];i||(i=this.newAtlas());var n=i.insertSpriteFrame(t);return n||this._atlasIndex===this._maxAtlasCount?n:(i=this.newAtlas()).insertSpriteFrame(t)},i.reset=function(){for(var t=0,e=this._atlases.length;t<e;t++)this._atlases[t].destroy();this._atlases.length=0,this._atlasIndex=-1},i.deleteAtlasSpriteFrame=function(t){if(t._original){for(var e=this._atlases.length-1;e>=0;e--)le(this._atlases[e]._innerSpriteFrames,t);var i=t._original._texture;this.deleteAtlasTexture(i)}},i.deleteAtlasTexture=function(t){if(t)for(var e=this._atlases.length-1;e>=0;e--)this._atlases[e].deleteInnerTexture(t),this._atlases[e].isEmpty()&&(this._atlases[e].destroy(),this._atlases.splice(e,1),this._atlasIndex--)},i.packToDynamicAtlas=function(t,e){if(this._enabled&&e&&!e._original&&e.packable&&e.texture&&e.texture.width>0&&e.texture.height>0){var i=this.insertSpriteFrame(e);i&&e._setDynamicAtlasFrame(i)}},n(e,[{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled!==t&&(t?(this.reset(),v.director.on(v.Director.EVENT_BEFORE_SCENE_LAUNCH,this.beforeSceneLoad,this)):(this.reset(),v.director.off(v.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}(Lu));RL.instance=void 0;var bL,CL=t("a0",RL.instance=new RL);gL.registerSystem("dynamicAtlasManager",CL,0),v.internal.dynamicAtlasManager=CL,function(t){t[t.positions=Mc.ATTR_POSITION]="positions",t[t.normals=Mc.ATTR_NORMAL]="normals",t[t.uvs=Mc.ATTR_TEX_COORD]="uvs",t[t.colors=Mc.ATTR_COLOR]="colors"}(bL||(bL={}));var wL=function(){function t(){this._arrayBufferOrPaddings=[],this._length=0}var e=t.prototype;return e.setNextAlignment=function(t){if(0!==t){var e=this._length%t;if(0!==e){var i=t-e;this._arrayBufferOrPaddings.push(i),this._length+=i}}},e.addBuffer=function(t){var e=this._length;return this._arrayBufferOrPaddings.push(t),this._length+=t.byteLength,e},e.getLength=function(){return this._length},e.getCombined=function(){var t=new Uint8Array(this._length),e=0;return this._arrayBufferOrPaddings.forEach((function(i){"number"==typeof i?e+=i:(t.set(new Uint8Array(i),e),e+=i.byteLength)})),t.buffer},t}(),xL=function(){function t(t,e){if(this._mesh=void 0,this._subMeshRenderings=[],this._mesh=t,this._mesh.struct.morph){var i=this._mesh.struct.primitives.length;this._subMeshRenderings=new Array(i).fill(null);for(var n=0;n<i;++n){var r=this._mesh.struct.morph.subMeshMorphs[n];r&&(r.targets.length>ov.MAX_MORPH_TARGET_COUNT?this._subMeshRenderings[n]=new OL(this._mesh,n,this._mesh.struct.morph,e):this._subMeshRenderings[n]=new IL(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(Mc.ATTR_POSITION)&&s.push({name:"CC_MORPH_TARGET_HAS_POSITION",value:!0}),n.attributes.includes(Mc.ATTR_NORMAL)&&s.push({name:"CC_MORPH_TARGET_HAS_NORMAL",value:!0}),n.attributes.includes(Mc.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}(),IL=function(){function t(t,e,i,n){this._gfxDevice=void 0,this._subMeshMorph=void 0,this._textureInfo=void 0,this._attributes=void 0,this._verticesCount=void 0,this._gfxDevice=n;var r=i.subMeshMorphs[e];this._subMeshMorph=r,BL(t,e,n);var s=t.struct.vertexBundles[t.struct.primitives[e].vertexBundelIndices[0]].view.count;this._verticesCount=s;var a=r.targets.length,o=PL(n,s*a);this._textureInfo={width:o.width,height:o.height},this._attributes=r.attributes.map((function(e,i){var n=o.create(),a=n.valueView;return r.targets.forEach((function(e,n){for(var r=e.displacements[i],o=new Float32Array(t.data.buffer,t.data.byteOffset+r.offset,r.count),h=s*n*4,u=0;u<s;++u)a[h+4*u+0]=o[3*u+0],a[h+4*u+1]=o[3*u+1],a[h+4*u+2]=o[3*u+2]})),n.updatePixels(),{name:e,morphTexture:n}}))}var e=t.prototype;return e.destroy=function(){for(var t,e=d(this._attributes);!(t=e()).done;)t.value.morphTexture.destroy()},e.createInstance=function(){var t=this,e=new ML(this._gfxDevice,this._subMeshMorph.targets.length);return e.setMorphTextureInfo(this._textureInfo.width,this._textureInfo.height),e.setVerticesCount(this._verticesCount),e.commit(),{setWeights:function(t){e.setWeights(t),e.commit()},requiredPatches:function(){return[{name:"CC_MORPH_TARGET_USE_TEXTURE",value:!0}]},adaptPipelineState:function(i){for(var n,r=d(t._attributes);!(n=r()).done;){var s=n.value,a=void 0;switch(s.name){case Mc.ATTR_POSITION:a=mv;break;case Mc.ATTR_NORMAL:a=yv;break;case Mc.ATTR_TANGENT:a=Ev;break;default:U("Unexpected attribute!")}void 0!==a&&(i.bindSampler(a,s.morphTexture.sampler),i.bindTexture(a,s.morphTexture.texture))}i.bindBuffer(ov.BINDING,e.buffer),i.update()},destroy:function(){}}},t}(),OL=function(){function t(t,e,i,n){this._gfxDevice=void 0,this._attributes=[],this._gfxDevice=n;var r=i.subMeshMorphs[e];BL(t,e,n),this._attributes=r.attributes.map((function(e,i){return{name:e,targets:r.targets.map((function(e){return{displacements:new Float32Array(t.data.buffer,t.data.byteOffset+e.displacements[i].offset,e.displacements[i].count)}}))}}))}return t.prototype.createInstance=function(){return new DL(this,this._attributes[0].targets[0].displacements.length/3,this._gfxDevice)},n(t,[{key:"data",get:function(){return this._attributes}}]),t}(),DL=function(){function t(t,e,i){this._attributes=void 0,this._owner=void 0,this._morphUniforms=void 0,this._owner=t,this._morphUniforms=new ML(i,0);var n=PL(i,e);this._morphUniforms.setMorphTextureInfo(n.width,n.height),this._morphUniforms.commit(),this._attributes=this._owner.data.map((function(t){var e=n.create();return{attributeName:t.name,morphTexture:e}}))}var e=t.prototype;return e.setWeights=function(t){for(var e=0;e<this._attributes.length;++e){var i=this._attributes[e],n=i.morphTexture.valueView,r=this._owner.data[e];t.length,r.targets.length;for(var s=0;s<r.targets.length;++s){var a=r.targets[s].displacements,o=t[s],h=a.length/3;if(0===s)for(var u=0;u<h;++u)n[4*u+0]=a[3*u+0]*o,n[4*u+1]=a[3*u+1]*o,n[4*u+2]=a[3*u+2]*o;else if(0!==o)for(var l=0;l<h;++l)n[4*l+0]+=a[3*l+0]*o,n[4*l+1]+=a[3*l+1]*o,n[4*l+2]+=a[3*l+2]*o}i.morphTexture.updatePixels()}},e.requiredPatches=function(){return[{name:"CC_MORPH_TARGET_USE_TEXTURE",value:!0},{name:"CC_MORPH_PRECOMPUTED",value:!0}]},e.adaptPipelineState=function(t){for(var e,i=d(this._attributes);!(e=i()).done;){var n=e.value,r=void 0;switch(n.attributeName){case Mc.ATTR_POSITION:r=mv;break;case Mc.ATTR_NORMAL:r=yv;break;case Mc.ATTR_TANGENT:r=Ev;break;default:U("Unexpected attribute!")}void 0!==r&&(t.bindSampler(r,n.morphTexture.sampler),t.bindTexture(r,n.morphTexture.texture))}t.bindBuffer(ov.BINDING,this._morphUniforms.buffer),t.update()},e.destroy=function(){this._morphUniforms.destroy();for(var t=0;t<this._attributes.length;++t)this._attributes[t].morphTexture.destroy()},t}(),ML=function(){function t(t,e){this._targetCount=void 0,this._localBuffer=void 0,this._remoteBuffer=void 0,this._targetCount=e,this._localBuffer=new DataView(new ArrayBuffer(ov.SIZE)),this._remoteBuffer=t.createBuffer(new qc(ql.UNIFORM|ql.TRANSFER_DST,Jl.HOST|Jl.DEVICE,ov.SIZE,ov.SIZE))}var e=t.prototype;return e.destroy=function(){this._remoteBuffer.destroy()},e.setWeights=function(t){t.length,this._targetCount;for(var e=0;e<t.length;++e)this._localBuffer.setFloat32(ov.OFFSET_OF_WEIGHTS+4*e,t[e],v.sys.isLittleEndian)},e.setMorphTextureInfo=function(t,e){this._localBuffer.setFloat32(ov.OFFSET_OF_DISPLACEMENT_TEXTURE_WIDTH,t,v.sys.isLittleEndian),this._localBuffer.setFloat32(ov.OFFSET_OF_DISPLACEMENT_TEXTURE_HEIGHT,e,v.sys.isLittleEndian)},e.setVerticesCount=function(t){this._localBuffer.setFloat32(ov.OFFSET_OF_VERTICES_COUNT,t,v.sys.isLittleEndian)},e.commit=function(){this._remoteBuffer.update(this._localBuffer.buffer)},n(t,[{key:"buffer",get:function(){return this._remoteBuffer}}]),t}();function PL(t,e){var i,n,r,s;t.getFormatFeatures(jl.RGBA32F)&ic.SAMPLED_TEXTURE?(i=e,r=16,n=em.PixelFormat.RGBA32F,s=Float32Array):(i=4*e,r=4,n=em.PixelFormat.RGBA8888,s=Uint8Array);var a=function(t){t<5&&(t=5);var e=A(Hi(t)),i=e>>1;return{width:1<<(1&e?i+1:i),height:1<<i}}(i),o=a.width,h=a.height;return{width:o,height:h,create:function(){var e=new ArrayBuffer(o*h*r),i=new Float32Array(e),a=s===Float32Array?i:new s(e),u=new Df({width:o,height:h,_data:a,_compressed:!1,format:n}),l=new em;l.setFilters(em.Filter.NEAREST,em.Filter.NEAREST),l.setMipFilter(em.Filter.NONE),l.setWrapMode(em.WrapMode.CLAMP_TO_EDGE,em.WrapMode.CLAMP_TO_EDGE,em.WrapMode.CLAMP_TO_EDGE),l.image=u,l.getGFXTexture()||U("Unexpected: failed to create morph texture?");var c=t.getSampler(l.getSamplerInfo());return{get texture(){return l.getGFXTexture()},get sampler(){return c},get valueView(){return i},destroy:function(){l.destroy()},updatePixels:function(){l.uploadData(a)}}}}}function BL(t,e,i){t.renderingSubMeshes[e].enableVertexIdChannel(i)}function NL(t,e){return LL(t).then((function(t){return WebAssembly.instantiate(t,e)}))}function LL(t){return new Promise((function(i,n){try{t=new URL(t,e.meta.url).href,fetch(t).then((function(t){return t.arrayBuffer().then(i)})).catch((function(){}))}catch(t){n(t)}}))}function FL(){return Promise.resolve()}var kL={};AL.onPostInfrastructureInitDelegate.add((function(){return FL().then((function(){return Promise.all([e.import("./meshopt_decoder.asm-700d8e85.js"),e.import("./meshopt_decoder.wasm-ebbcb6df.js"),e.import("./meshopt_decoder.wasm-43855155.js")]).then((function(t){var e,i,n,r=t[0].default,s=t[1].default,a=t[2].default;return Ol.hasFeature(Ol.Feature.WASM)?(i=s,n=a,Promise.all([i.ready((function(t){return NL(n,t)}))]).then((function(){kL.supported=i.supported,kL.ready=Promise.resolve(),kL.decodeVertexBuffer=i.decodeVertexBuffer,kL.decodeIndexBuffer=i.decodeIndexBuffer,kL.decodeIndexSequence=i.decodeIndexSequence,kL.decodeGltfBuffer=i.decodeGltfBuffer,kL.useWorkers=i.useWorkers,kL.decodeGltfBufferAsync=i.decodeGltfBufferAsync,Y(14203)}))):(e=r,Promise.all([e.ready]).then((function(){kL.supported=e.supported,kL.ready=Promise.resolve(),kL.decodeVertexBuffer=e.decodeVertexBuffer,kL.decodeIndexBuffer=e.decodeIndexBuffer,kL.decodeIndexSequence=e.decodeIndexSequence,kL.decodeGltfBuffer=e.decodeGltfBuffer,kL.useWorkers=e.useWorkers,kL.decodeGltfBufferAsync=e.decodeGltfBufferAsync,Y(14202)})))}))}))}));
  2. /** @license zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License */
  3. var UL={};(function(){function t(t){throw t}var e=void 0,i=!0,n=this;function r(t,i){var r,s=t.split("."),a=n;!(s[0]in a)&&a.execScript&&a.execScript("var "+s[0]);for(;s.length&&(r=s.shift());)s.length||i===e?a=a[r]?a[r]:a[r]={}:a[r]=i}var s="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array;function a(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,a=0,o=t.length,h=0;0<o;){o-=r=1024<o?1024:o;do{a+=s+=t[h++]}while(--r);s%=65521,a%=65521}return(a<<16|s)>>>0}function o(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()}o.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},o.prototype.d=function(t,e,i){var n,r=this.buffer,s=this.index,a=this.i,o=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+a)o=o<<e|t,a+=e;else for(n=0;n<e;++n)o=o<<1|t>>e-n-1&1,8==++a&&(a=0,r[s++]=d[o],o=0,s===r.length&&(r=this.f()));r[s]=o,this.buffer=r,this.i=a,this.index=s},o.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 l=_=h,c=7,_=_>>>1;_;_>>>=1)l<<=1,l|=1&_,--c;u[h]=(l<<c&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,a,o,h,u,l,c=t.length,_=0,d=Number.POSITIVE_INFINITY;for(u=0;u<c;++u)t[u]>_&&(_=t[u]),t[u]<d&&(d=t[u]);for(e=1<<_,i=new(s?Uint32Array:Array)(e),n=1,r=0,a=2;n<=_;){for(u=0;u<c;++u)if(t[u]===n){for(o=0,h=r,l=0;l<n;++l)o=o<<1|1&h,h>>=1;for(l=o;l<e;l+=a)i[l]=n<<16|u;++r}++n,r<<=1,a<<=1}return[i,_,d]}function m(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 g,v=2,y={NONE:0,r:1,j:v,N:3},T=[];for(g=0;288>g;g++)switch(i){case 143>=g:T.push([g+48,8]);break;case 255>=g:T.push([g-144+400,9]);break;case 279>=g:T.push([g-256+0,7]);break;case 287>=g:T.push([g-280+192,8]);break;default:t("invalid literal: "+g)}function S(t,e){this.length=t,this.G=e}function E(){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)}}m.prototype.n=function(){var n,r,a,h,u=this.input;switch(this.h){case 0:for(a=0,h=u.length;a<h;){var l,c,_,d=r=s?u.subarray(a,a+65535):u.slice(a,a+65535),f=(a+=r.length)===h,p=e,m=e,g=this.a,y=this.b;if(s){for(g=new Uint8Array(this.a.buffer);g.length<=y+d.length+5;)g=new Uint8Array(g.length<<1);g.set(this.a)}if(l=f?1:0,g[y++]=0|l,_=65536+~(c=d.length)&65535,g[y++]=255&c,g[y++]=c>>>8&255,g[y++]=255&_,g[y++]=_>>>8&255,s)g.set(d,y),y+=d.length,g=g.subarray(0,y);else{for(p=0,m=d.length;p<m;++p)g[y++]=d[p];g.length=y}this.b=y,this.a=g}break;case 1:var S=new o(new Uint8Array(this.a.buffer),this.b);S.d(1,1,i),S.d(1,2,i);var E,A,R,b=w(this,u);for(E=0,A=b.length;E<A;E++)if(R=b[E],o.prototype.d.apply(S,T[R]),256<R)S.d(b[++E],b[++E],i),S.d(b[++E],5),S.d(b[++E],b[++E],i);else if(256===R)break;this.a=S.finish(),this.b=this.a.length;break;case v:var C,O,D,M,P,B,N,L,F,k,U,G,H,z,V,W=new o(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(C=v,W.d(1,1,i),W.d(C,2,i),O=w(this,u),N=I(B=x(this.L,15)),F=I(L=x(this.K,7)),D=286;257<D&&0===B[D-1];D--);for(M=30;1<M&&0===L[M-1];M--);var Y,K,q,Q,Z,J,$=D,tt=M,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++]=B[Y];for(Y=0;Y<tt;Y++)et[K++]=L[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=x(nt,7),z=0;19>z;z++)j[z]=k[X[z]];for(P=19;4<P&&0===j[P-1];P--);for(U=I(k),W.d(D-257,5,i),W.d(M-1,5,i),W.d(P-4,4,i),z=0;z<P;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,at,ot,ht,ut,lt,ct,_t=[N,B],dt=[F,L];for(ht=_t[0],ut=_t[1],lt=dt[0],ct=dt[1],rt=0,st=O.length;rt<st;++rt)if(at=O[rt],W.d(ht[at],ut[at],i),256<at)W.d(O[++rt],O[++rt],i),ot=O[++rt],W.d(lt[ot],ct[ot],i),W.d(O[++rt],O[++rt],i);else if(256===at)break;this.a=W.finish(),this.b=this.a.length;break;default:t("invalid compression type")}return this.a};var A,R,b=[];for(A=3;258>=A;A++)R=E(),b[A]=R[2]<<24|R[1]<<16|R[0];var C=s?new Uint32Array(b):b;function w(n,r){function a(e,n){var r,s,a,o,h=e.G,u=[],l=0;switch(r=C[e.length],u[l++]=65535&r,u[l++]=r>>16&255,u[l++]=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[l++]=r[0],u[l++]=r[1],u[l++]=r[2],a=0,o=u.length;a<o;++a)g[v++]=u[a];T[u[0]]++,E[u[3]]++,y=e.length+n-1,f=null}var o,h,u,l,c,_,d,f,p,m={},g=s?new Uint16Array(2*r.length):[],v=0,y=0,T=new(s?Uint32Array:Array)(286),E=new(s?Uint32Array:Array)(30),A=n.w;if(!s){for(u=0;285>=u;)T[u++]=0;for(u=0;29>=u;)E[u++]=0}for(T[256]=1,o=0,h=r.length;o<h;++o){for(u=c=0,l=3;u<l&&o+u!==h;++u)c=c<<8|r[o+u];if(m[c]===e&&(m[c]=[]),_=m[c],!(0<y--)){for(;0<_.length&&32768<o-_[0];)_.shift();if(o+3>=h){for(f&&a(f,-1),u=0,l=h-o;u<l;++u)p=r[o+u],g[v++]=p,++T[p];break}if(0<_.length){var R=e,b=e,w=0,x=e,I=e,O=e,D=r.length,M=(I=0,_.length);t:for(;I<M;I++){if(R=_[M-I-1],x=3,3<w){for(O=w;3<O;O--)if(r[R+O-1]!==r[o+O-1])continue t;x=w}for(;258>x&&o+x<D&&r[R+x]===r[o+x];)++x;if(x>w&&(b=R,w=x),258===x)break}d=new S(w,o-b),f?f.length<d.length?(p=r[o-1],g[v++]=p,++T[p],a(d,0)):a(f,-1):d.length<A?f=d:a(d,0)}else f?a(f,-1):(p=r[o],g[v++]=p,++T[p])}_.push(o)}return g[v++]=256,T[256]++,n.L=T,n.K=E,s?g.subarray(0,v):g}function x(t,e){function i(t){var e=A[t][R[t]];e===v?(i(t+1),i(t+1)):--S[e],++R[t]}var n,r,a,o,h,u=t.length,l=new f(572),c=new(s?Uint8Array:Array)(u);if(!s)for(o=0;o<u;o++)c[o]=0;for(o=0;o<u;++o)0<t[o]&&l.push(o,t[o]);if(n=Array(l.length/2),r=new(s?Uint32Array:Array)(l.length/2),1===n.length)return c[l.pop().index]=1,c;for(o=0,h=l.length/2;o<h;++o)n[o]=l.pop(),r[o]=n[o].value;var _,d,p,m,g,v=r.length,y=new(s?Uint16Array:Array)(e),T=new(s?Uint8Array:Array)(e),S=new(s?Uint8Array:Array)(v),E=Array(e),A=Array(e),R=Array(e),b=(1<<e)-v,C=1<<e-1;for(y[e-1]=v,d=0;d<e;++d)b<C?T[d]=0:(T[d]=1,b-=C),b<<=1,y[e-2-d]=(y[e-1-d]/2|0)+v;for(y[0]=T[0],E[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]),E[d]=Array(y[d]),A[d]=Array(y[d]);for(_=0;_<v;++_)S[_]=e;for(p=0;p<y[e-1];++p)E[e-1][p]=r[p],A[e-1][p]=p;for(_=0;_<e;++_)R[_]=0;for(1===T[e-1]&&(--S[0],++R[e-1]),d=e-2;0<=d;--d){for(m=_=0,g=R[d+1],p=0;p<y[d];p++)(m=E[d+1][g]+E[d+1][g+1])>r[_]?(E[d][p]=m,A[d][p]=v,g+=2):(E[d][p]=r[_],A[d][p]=_,++_);R[d]=0,1===T[d]&&i(d)}for(a=S,o=0,h=n.length;o<h;++o)c[n[o].index]=a[o];return c}function I(e){var i,n,r,a,o=new(s?Uint16Array:Array)(e.length),h=[],u=[],l=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]=l,(l+=0|h[i])>1<<i&&t("overcommitted"),l<<=1;for(65536>l&&t("undercommitted"),i=0,n=e.length;i<n;i++)for(l=u[e[i]],u[e[i]]+=1,r=o[i]=0,a=e[i];r<a;r++)o[i]=o[i]<<1|1&l,l>>>=1;return o}function O(t,e){this.input=t,this.a=new(s?Uint8Array:Array)(32768),this.h=D.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 m(this.input,n)}var D=y;function M(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=B,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 P:this.b=32768,this.a=new(s?Uint8Array:Array)(32768+this.l+258);break;case B: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"))}}O.prototype.n=function(){var e,i,n,r,o,h,u,l=0;switch(u=this.a,e=lt){case lt:i=Math.LOG2E*Math.log(32768)-8;break;default:t(Error("invalid compression method"))}switch(n=i<<4|e,u[l++]=n,e){case lt:switch(this.h){case D.NONE:o=0;break;case D.r:o=1;break;case D.j:o=2;break;default:t(Error("unsupported compression type"))}break;default:t(Error("invalid compression method"))}return r=o<<6|0,u[l++]=r|31-(256*n+r)%31,h=a(this.input),this.z.b=l,l=(u=this.z.n()).length,s&&((u=new Uint8Array(u.buffer)).length<=l+4&&(this.a=new Uint8Array(u.length+4),this.a.set(u),u=this.a),u=u.subarray(0,l+4)),u[l++]=h>>24&255,u[l++]=h>>16&255,u[l++]=h>>8&255,u[l++]=255&h,u},r("Zlib.Deflate",O),r("Zlib.Deflate.compress",(function(t,e){return new O(t,e).n()})),r("Zlib.Deflate.CompressionType",D),r("Zlib.Deflate.CompressionType.NONE",D.NONE),r("Zlib.Deflate.CompressionType.FIXED",D.r),r("Zlib.Deflate.CompressionType.DYNAMIC",D.j);var P=0,B=1,N={D:P,C:B};M.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,a=this.c,o=this.a,h=this.b,u=e,l=e,c=e,_=o.length,d=e;switch(this.e=this.g=0,(u=r[a++])===e&&t(Error("invalid uncompressed block header: LEN (first byte)")),l=u,(u=r[a++])===e&&t(Error("invalid uncompressed block header: LEN (second byte)")),l|=u<<8,(u=r[a++])===e&&t(Error("invalid uncompressed block header: NLEN (first byte)")),c=u,(u=r[a++])===e&&t(Error("invalid uncompressed block header: NLEN (second byte)")),l===~(c|=u<<8)&&t(Error("invalid uncompressed block header: length verify")),a+l>r.length&&t(Error("input buffer is broken")),this.m){case P:for(;h+l>o.length;){if(l-=d=_-h,s)o.set(r.subarray(a,a+d),h),h+=d,a+=d;else for(;d--;)o[h++]=r[a++];this.b=h,o=this.f(),h=this.b}break;case B:for(;h+l>o.length;)o=this.f({v:2});break;default:t(Error("invalid inflate mode"))}if(s)o.set(r.subarray(a,a+l),h),h+=l,a+=l;else for(;l--;)o[h++]=r[a++];this.c=a,this.b=h,this.a=o;break;case 1:this.o(Z,$);break;case 2:it(this);break;default:t(Error("unknown BTYPE: "+n))}}return this.t()};var L,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(L=0,F=K.length;L<F;++L)K[L]=143>=L?8:255>=L?9:279>=L?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,a=i.e,o=i.input,h=i.c;a<n;)(r=o[h++])===e&&t(Error("input buffer is broken")),s|=r<<a,a+=8;return r=s&(1<<n)-1,i.g=s>>>n,i.e=a-n,i.c=h,r}function et(i,n){for(var r,s,a,o=i.g,h=i.e,u=i.input,l=i.c,c=n[0],_=n[1];h<_;)(r=u[l++])===e&&t(Error("input buffer is broken")),o|=r<<h,h+=8;return a=(s=c[o&(1<<_)-1])>>>16,i.g=o>>a,i.e=h-a,i.c=l,65535&s}function it(t){function e(t,e,i){var n,r,s,a;for(a=0;a<t;)switch(n=et(this,e),n){case 16:for(s=3+tt(this,2);s--;)i[a++]=r;break;case 17:for(s=3+tt(this,3);s--;)i[a++]=0;r=0;break;case 18:for(s=11+tt(this,7);s--;)i[a++]=0;r=0;break;default:r=i[a++]=n}return i}var i,n,r,a,o=tt(t,5)+257,h=tt(t,5)+1,u=tt(t,4)+4,l=new(s?Uint8Array:Array)(U.length);for(a=0;a<u;++a)l[U[a]]=tt(t,3);i=p(l),n=new(s?Uint8Array:Array)(o),r=new(s?Uint8Array:Array)(h),t.o(p(e.call(t,o,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 lt:this.method=lt;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 M(e,{index:this.c,bufferSize:i.bufferSize,bufferType:i.bufferType,resize:i.resize})}M.prototype.o=function(t,e){var i=this.a,n=this.b;this.u=t;for(var r,s,a,o,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(o=H[s=r-257],0<V[s]&&(o+=tt(this,V[s])),r=et(this,e),a=X[r],0<Y[r]&&(a+=tt(this,Y[r])),n>=h&&(this.b=n,i=this.f(),n=this.b);o--;)i[n]=i[n++-a];for(;8<=this.e;)this.e-=8,this.c--;this.b=n},M.prototype.I=function(t,e){var i=this.a,n=this.b;this.u=t;for(var r,s,a,o,h=i.length;256!==(r=et(this,t));)if(256>r)n>=h&&(h=(i=this.f()).length),i[n++]=r;else for(o=H[s=r-257],0<V[s]&&(o+=tt(this,V[s])),r=et(this,e),a=X[r],0<Y[r]&&(a+=tt(this,Y[r])),n+o>h&&(h=(i=this.f()).length);o--;)i[n]=i[n++-a];for(;8<=this.e;)this.e-=8,this.c--;this.b=n},M.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},M.prototype.J=function(t){var e,i,n,r=this.input.length/this.c+1|0,a=this.input,o=this.a;return t&&("number"==typeof t.v&&(r=t.v),"number"==typeof t.F&&(r+=t.F)),i=2>r?(n=(a.length-this.c)/this.u[2]/2*258|0)<o.length?o.length+n:o.length<<1:o.length*r,s?(e=new Uint8Array(i)).set(o):e=o,this.a=e},M.prototype.t=function(){var t,e,i,n,r,a=0,o=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[a++]=t[n];for(e=32768,i=this.b;e<i;++e)u[a++]=o[e];return this.k=[],this.buffer=u},M.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!==a(e)&&t(Error("invalid adler-32 checksum")),e},r("Zlib.Inflate",nt),r("Zlib.Inflate.BufferType",N),N.ADAPTIVE=N.C,N.BLOCK=N.D,r("Zlib.Inflate.prototype.decompress",nt.prototype.p);var rt,st,at=new(s?Uint8Array:Array)(288);for(rt=0,st=at.length;rt<st;++rt)at[rt]=143>=rt?8:255>=rt?9:279>=rt?7:8;p(at);var ot,ht,ut=new(s?Uint8Array:Array)(30);for(ot=0,ht=ut.length;ot<ht;++ot)ut[ot]=5;p(ut);var lt=8}).call(UL);var GL,HL,zL,VL,WL,XL=UL.Zlib;function jL(t){switch(t){case 1:return Uint8Array;case 2:return Uint16Array;case 4:return Uint32Array;default:return Uint8Array}}XL.Deflate=XL.Deflate,XL.Deflate.compress=XL.Deflate.compress,XL.Inflate=XL.Inflate,XL.Inflate.BufferType=XL.Inflate.BufferType,XL.Inflate.prototype.decompress=XL.Inflate.prototype.decompress;var YL=new hn,KL=new hn,qL=new Uint8Array,QL=t("a5",qs("cc.Mesh")((HL=function(t){function e(){var e;return(e=t.call(this)||this).morphRendering=null,e._struct=zL&&zL(),e._hash=VL&&VL(),e._data=qL,e._initialized=!1,e._allowDataAccess=WL&&WL(),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=nF(t)),this.struct.encoded&&(t=iF(t)),!this.struct.quantized||wd.gfxDevice.getFormatFeatures(jl.RGB16F)&ic.VERTEX_ATTRIBUTE||(t=function(t){var e=JSON.parse(JSON.stringify(t.struct)),i=new wL;function n(t,e,i,n,r,s,a){for(var o=0;o<i;o++)for(var h=0;h<n;h++)e(a*o+r*h,t(s*o+r*h))}function r(t,e,i,n,r,s){for(var a=0;a<i;a++)for(var o=0;o<n;o++)e(s*a+4*o,tn(t(r*a+2*o)))}i.setNextAlignment(0);for(var s=0;s<e.vertexBundles.length;++s){for(var a=e.vertexBundles[s],o=a.view,h=a.attributes,u=t.struct.vertexBundles[s].attributes,l=[],c=[],_=[],f=0;f<h.length;++f){var p=h[f],m=tF(new DataView(t.data.buffer,o.offset+ZL(u,f)),p.format),g=!0;switch(p.format){case jl.R16F:p.format=jl.R32F;break;case jl.RG16F:p.format=jl.RG32F;break;case jl.RGB16F:p.format=jl.RGB32F;break;case jl.RGBA16F:p.format=jl.RGBA32F;break;default:g=!1}l.push(F_[p.format].size),c.push(g),_.push(m)}for(var v=l.reduce((function(t,e){return t+e}),0),y=new Uint8Array(v*o.count),T=0;T<h.length;++T){var S=h[T],E=_[T],A=eF(new DataView(y.buffer,ZL(h,T)),S.format),R=c[T],b=F_[S.format];R?r(E,A,o.count,b.count,o.stride,v):n(E,A,o.count,b.count,b.size/b.count,o.stride,v)}i.setNextAlignment(v);var C={offset:i.getLength(),length:y.byteLength,count:o.count,stride:v};a.view=C,i.addBuffer(y)}for(var w,x=d(e.primitives);!(w=x()).done;){var I=w.value;if(void 0!==I.indexView){var O=I.indexView,D=new Uint8Array(t.data.buffer,O.offset,O.length);i.setNextAlignment(O.stride);var M={offset:i.getLength(),length:D.byteLength,count:O.count,stride:O.stride};I.indexView=M,i.addBuffer(D)}}var P=new Uint8Array(i.getCombined());return e.quantized=!1,{struct:e,data:P}}(t)),this._struct=t.struct,this._data=t.data,this._struct.dynamic){for(var e=wd.gfxDevice,i=[],n=[],r=0;r<this._struct.vertexBundles.length;r++){var s=this._struct.vertexBundles[r],a=e.createBuffer(new qc(ql.VERTEX|ql.TRANSFER_DST,Jl.DEVICE,s.view.length,s.view.stride));i.push(a)}for(var o=0;o<this._struct.primitives.length;o++){var h=this._struct.primitives[o],u=h.indexView,l=null;u&&(l=e.createBuffer(new qc(ql.INDEX|ql.TRANSFER_DST,Jl.DEVICE,u.length,u.stride)));for(var c=[],_=0;_<h.vertexBundelIndices.length;_++){var f=h.vertexBundelIndices[_];c.push(i[f])}for(var p=[],m=0;m<h.vertexBundelIndices.length;m++)for(var g,v=h.vertexBundelIndices[m],y=d(this._struct.vertexBundles[v].attributes);!(g=y()).done;){var T=g.value,S=new __;S.copy(T),p.push(S)}var E=new Lx(c,p,h.primitiveMode,l);E.drawInfo=new Zc,E.mesh=this,E.subMeshIdx=o,n.push(E)}this._renderingSubMeshes=n}else{for(var A=this._data.buffer,R=wd.gfxDevice,b=this._createVertexBuffers(R,A),C=[],w=[],x=0;x<this._struct.primitives.length;x++){var I=this._struct.primitives[x];if(0!==I.vertexBundelIndices.length){var O=null,D=void 0;if(I.indexView){var M=I.indexView,P=M.stride,B=M.length;if(4===P&&!R.hasFeature(Xl.ELEMENT_INDEX_UINT)){var N=this._struct.vertexBundles[I.vertexBundelIndices[0]].view.count;if(N>=65536){q(10001,N,65536);continue}P>>=1,B>>=1}O=R.createBuffer(new qc(ql.INDEX,Jl.DEVICE,B,P)),C.push(O),D=new(jL(M.stride))(A,M.offset,M.count),M.stride!==P&&(D=jL(P).from(D)),O.update(D)}var L=I.vertexBundelIndices.map((function(t){return b[t]})),F=[];if(I.vertexBundelIndices.length>0)for(var k=I.vertexBundelIndices[0],U=this._struct.vertexBundles[k].attributes,G=0;G<U.length;++G){var H=U[G];F[G]=new __(H.name,H.format,H.isNormalized,H.stream,H.isInstanced,H.location)}var z=new Lx(L,F,I.primitiveMode,O);z.mesh=this,z.subMeshIdx=x,w.push(z)}}this._renderingSubMeshes=w,this._struct.morph&&(this.morphRendering=function(t,e){return new xL(t,e)}(this,R)),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,a=this._struct.primitives[t],o=this._renderingSubMeshes[t],h=o.drawInfo,u=0;u<i.length;u++){var l=i[u],c=this._struct.vertexBundles[a.vertexBundelIndices[u]],_=c.view.stride,f=l.byteLength/_,p=l.byteLength,m=new Uint8Array(this._data.buffer,c.view.offset,p),g=new Uint8Array(l.buffer,l.byteOffset,p),v=o.vertexBuffers[u];s.maxSubMeshVertices,p>0&&(m.set(g),v.update(g,p)),c.view.count=f,h.vertexCount=f}if(a.indexView){var y=a.indexView,T=y.stride,S=2===T?e.indices16.length:e.indices32.length,E=S*T,A=new Uint8Array(this._data.buffer,y.offset,E),R=2===T?new Uint8Array(e.indices16.buffer,e.indices16.byteOffset,E):new Uint8Array(e.indices32.buffer,e.indices32.byteOffset,E),b=o.indexBuffer;s.maxSubMeshIndices,E>0&&(A.set(R),b.update(R,E)),y.count=S,h.indexCount=S}if(e.minPos&&e.maxPos){var C=new hn(e.minPos.x,e.minPos.y,e.minPos.z),w=new hn(e.maxPos.x,e.maxPos.y,e.maxPos.z);r.bounds[t]||(r.bounds[t]=new Es),Es.fromPoints(r.bounds[t],C,w);for(var x,I=new hn,O=new hn,D=d(r.bounds);!(x=D()).done;){var M=x.value;M&&(M.getBoundary(I,O),hn.min(C,I,C),hn.max(w,O,w))}this._struct.minPosition=new hn(C.x,C.y,C.z),this._struct.maxPosition=new hn(w.x,w.y,w.z)}o.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 Es(1/0,1/0,1/0,-1/0,-1/0,-1/0)),i.push(!1);for(var s=this._struct.primitives,a=0;a<s.length;a++){var o=this.readAttribute(a,Mc.ATTR_JOINTS),h=this.readAttribute(a,Mc.ATTR_WEIGHTS),u=this.readAttribute(a,Mc.ATTR_POSITION);if(o&&h&&u)for(var l=Math.min(o.length/4,h.length/4,u.length/3),c=0;c<l;c++){hn.set(YL,u[3*c+0],u[3*c+1],u[3*c+2]);for(var _=0;_<4;++_){var d=4*c+_,f=o[d];if(!(0===h[d]||f>=n.length)){hn.transformMat4(KL,YL,n[f]),i[f]=!0;var p=e[f];hn.min(p.center,p.center,KL),hn.max(p.halfExtents,p.halfExtents,KL)}}}}for(var m=0;m<n.length;m++){var g=e[m];i[m]?Es.fromPoints(g,g.center,g.halfExtents):e[m]=null}return e},i.merge=function(t,e,i){if(i&&!this.validateMergingMesh(t))return!1;var n=new hn,r=e&&new En,s=e&&new Es;if(r&&e.getRotation(r),!this._initialized){var a=JSON.parse(JSON.stringify(t._struct)),o=t._data.slice();if(e){a.maxPosition&&a.minPosition&&(hn.add(s.center,a.maxPosition,a.minPosition),hn.multiplyScalar(s.center,s.center,.5),hn.subtract(s.halfExtents,a.maxPosition,a.minPosition),hn.multiplyScalar(s.halfExtents,s.halfExtents,.5),Es.transform(s,s,e),hn.add(a.maxPosition,s.center,s.halfExtents),hn.subtract(a.minPosition,s.center,s.halfExtents));for(var h=0;h<a.vertexBundles.length;h++)for(var u=a.vertexBundles[h],l=0;l<u.attributes.length;l++)if(u.attributes[l].name===Mc.ATTR_POSITION||u.attributes[l].name===Mc.ATTR_NORMAL){var c=u.attributes[l].format,_=new DataView(o.buffer,u.view.offset+ZL(u.attributes,l)),f=tF(_,c),p=eF(_,c);if(!f||!p)continue;for(var m=u.view.count,g=u.view.stride,v=$L(c),y=0;y<m;y++){var T=y*g,S=T+v,E=S+v;switch(n.set(f(T),f(S),f(E)),u.attributes[l].name){case Mc.ATTR_POSITION:n.transformMat4(e);break;case Mc.ATTR_NORMAL:hn.transformQuat(n,n,r)}p(T,n.x),p(S,n.y),p(E,n.z)}}}return this.reset({struct:a,data:o}),this.initialize(),!0}for(var A,R,b,C,w,x=new wL,I=0,O=0,D=0,M=0,P=0,B=0,N=0,L=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];D=G.view.offset,M=H.view.offset,O=G.view.stride,I=G.view.count+H.view.count,A=new ArrayBuffer(I*O),R=new Uint8Array(A),D+=(b=this._data.subarray(D,D+G.view.length)).length,M+=(C=t._data.subarray(M,M+H.view.length)).length,R.set(b),P=0;for(var z,V=d(G.attributes);!(z=V()).done;){var W=z.value;N=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}N+=F_[Y.format].size}if(F){L=F_[W.format].size,B=G.view.length+P;for(var K=0;K<H.view.count;++K){if(w=C.subarray(N,N+L),R.set(w,B),(W.name===Mc.ATTR_POSITION||W.name===Mc.ATTR_NORMAL)&&e){var q=new Float32Array(R.buffer,B,3);switch(n.set(q[0],q[1],q[2]),W.name){case Mc.ATTR_POSITION:n.transformMat4(e);break;case Mc.ATTR_NORMAL:hn.transformQuat(n,n,r)}q[0]=n.x,q[1]=n.y,q[2]=n.z}B+=G.view.stride,N+=H.view.stride}}P+=F_[W.format].size}k[U]={attributes:G.attributes,view:{offset:x.getLength(),length:A.byteLength,count:I,stride:O}},x.addBuffer(A)}for(var Q,Z,J,$=0,tt=2,et=new Array(this._struct.primitives.length),it=0;it<this._struct.primitives.length;++it){var nt=this._struct.primitives[it],rt=t._struct.primitives[it];et[it]={primitiveMode:nt.primitiveMode,vertexBundelIndices:nt.vertexBundelIndices};for(var st,at=0,ot=d(nt.vertexBundelIndices);!(st=ot()).done;){var ht=st.value;at=Math.max(at,this._struct.vertexBundles[ht].view.count)}if(nt.indexView&&rt.indexView){$=nt.indexView.count,$+=rt.indexView.count,D=nt.indexView.offset,M=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,D,nt.indexView.count):1===nt.indexView.stride?new Uint8Array(this._data.buffer,D,nt.indexView.count):new Uint32Array(this._data.buffer,D,nt.indexView.count),tt===nt.indexView.stride)Q.set(Z);else for(var lt=0;lt<nt.indexView.count;++lt)Q[lt]=Z[lt];D+=nt.indexView.length,J=2===rt.indexView.stride?new Uint16Array(t._data.buffer,M,rt.indexView.count):1===rt.indexView.stride?new Uint8Array(t._data.buffer,M,rt.indexView.count):new Uint32Array(t._data.buffer,M,rt.indexView.count);for(var ct=0;ct<rt.indexView.count;++ct)Q[nt.indexView.count+ct]=at+J[ct];M+=rt.indexView.length,et[it].indexView={offset:x.getLength(),length:ut.byteLength,count:$,stride:tt},x.setNextAlignment(tt),x.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?(hn.add(s.center,t._struct.maxPosition,t._struct.minPosition),hn.multiplyScalar(s.center,s.center,.5),hn.subtract(s.halfExtents,t._struct.maxPosition,t._struct.minPosition),hn.multiplyScalar(s.halfExtents,s.halfExtents,.5),Es.transform(s,s,e),hn.add(n,s.center,s.halfExtents),hn.max(_t.maxPosition,_t.maxPosition,n),hn.subtract(n,s.center,s.halfExtents),hn.min(_t.minPosition,_t.minPosition,n)):(hn.min(_t.minPosition,_t.minPosition,t._struct.minPosition),hn.max(_t.maxPosition,_t.maxPosition,t._struct.maxPosition))),this.reset({struct:_t,data:new Uint8Array(x.getCombined())}),this.initialize(),!0},i.validateMergingMesh=function(t){if(this._struct.dynamic||t._struct.dynamic)return!1;if(this._struct.vertexBundles.length!==t._struct.vertexBundles.length)return!1;for(var e=0;e<this._struct.vertexBundles.length;++e){var i=this._struct.vertexBundles[e],n=t._struct.vertexBundles[e];if(i.attributes.length!==n.attributes.length)return!1;for(var r=0;r<i.attributes.length;++r)if(i.attributes[r].format!==n.attributes[r].format)return!1}if(this._struct.primitives.length!==t._struct.primitives.length)return!1;for(var s=0;s<this._struct.primitives.length;++s){var a=this._struct.primitives[s],o=t._struct.primitives[s];if(a.vertexBundelIndices.length!==o.vertexBundelIndices.length)return!1;for(var h=0;h<a.vertexBundelIndices.length;++h)if(a.vertexBundelIndices[h]!==o.vertexBundelIndices[h])return!1;if(a.primitiveMode!==o.primitiveMode)return!1;if(a.indexView){if(void 0===o.indexView)return!1}else if(o.indexView)return!1}return!0},i.readAttribute=function(t,e){var i=this,n=null;return this._accessAttribute(t,e,(function(t,e){var r=t.view.count,s=t.attributes[e].format,a=j_(F_[s]);if(0!==r){var o=new DataView(i._data.buffer,t.view.offset+ZL(t.attributes,e)),h=F_[s],u=tF(o,s);if(a&&u){for(var l=h.count,c=new a(r*l),_=t.view.stride,d=0;d<r;++d)for(var f=0;f<l;++f)c[l*d+f]=u(_*d+c.BYTES_PER_ELEMENT*f);n=c}}})),n},i.copyAttribute=function(t,e,i,n,r){var s=this,a=!1;return this._accessAttribute(t,e,(function(t,e){var o=t.view.count;if(0!==o){var h=t.attributes[e].format,u=new DataView(s._data.buffer,t.view.offset+ZL(t.attributes,e)),l=new DataView(i,r),c=F_[h],_=tF(u,h),d=eF(l,h);if(_&&d){for(var f=c.count,p=t.view.stride,m=$L(h),g=n,v=m,y=0;y<o;++y)for(var T=0;T<f;++T)d(g*y+v*T,_(p*y+m*T));a=!0}}else a=!0})),a},i.readIndices=function(t){if(t>=this._struct.primitives.length)return null;var e=this._struct.primitives[t];if(!e.indexView)return null;var i=e.indexView.stride;return new(1===i?Uint8Array:2===i?Uint16Array:Uint32Array)(this._data.buffer,e.indexView.offset,e.indexView.count)},i.copyIndices=function(t,e){if(t>=this._struct.primitives.length)return!1;var i=this._struct.primitives[t];if(!i.indexView)return!1;for(var n=i.indexView.count,r=1===i.indexView.stride?jl.R8UI:2===i.indexView.stride?jl.R16UI:jl.R32UI,s=tF(new DataView(this._data.buffer),r),a=0;a<n;++a)e[a]=s(i.indexView.offset+F_[r].size*a);return!0},i.readAttributeFormat=function(t,e){var i=null;return this._accessAttribute(t,e,(function(t,e){var n=t.attributes[e].format;i=F_[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,a=this._struct.vertexBundles[s],o=a.attributes.findIndex((function(t){return t.name===e}));if(!(o<0)){i(a,o);break}}},i._createVertexBuffers=function(t,e){return this._struct.vertexBundles.map((function(i){var n=t.createBuffer(new qc(ql.VERTEX,Jl.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:qL})},i.releaseData=function(){this._data=qL},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=Bl(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}(uf),zL=Gs(HL.prototype,"_struct",[ra],(function(){return{vertexBundles:[],primitives:[]}})),VL=Gs(HL.prototype,"_hash",[ra],(function(){return 0})),WL=Gs(HL.prototype,"_allowDataAccess",[ra],(function(){return!0})),GL=HL))||GL);function ZL(t,e){for(var i=0,n=0;n<e;++n){var r=t[n];i+=F_[r.format].size}return i}v.Mesh=QL;var JL=Ol.isLittleEndian;function $L(t){var e=F_[t];return e.size/e.count}function tF(t,e){var i=F_[e],n=i.size/i.count;switch(i.type){case Yl.UNORM:switch(n){case 1:return function(e){return t.getUint8(e)};case 2:return function(e){return t.getUint16(e,JL)};case 4:return function(e){return t.getUint32(e,JL)}}break;case Yl.SNORM:case Yl.INT:switch(n){case 1:return function(e){return t.getInt8(e)};case 2:return function(e){return t.getInt16(e,JL)};case 4:return function(e){return t.getInt32(e,JL)}}break;case Yl.UINT:switch(n){case 1:return function(e){return t.getUint8(e)};case 2:return function(e){return t.getUint16(e,JL)};case 4:return function(e){return t.getUint32(e,JL)}}break;case Yl.FLOAT:switch(n){case 2:return function(e){return t.getUint16(e,JL)};case 4:return function(e){return t.getFloat32(e,JL)}}}return null}function eF(t,e){var i=F_[e],n=i.size/i.count;switch(i.type){case Yl.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,JL)};case 4:return function(e,i){return t.setUint32(e,i,JL)}}break;case Yl.SNORM:case Yl.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,JL)};case 4:return function(e,i){return t.setInt32(e,i,JL)}}break;case Yl.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,JL)};case 4:return function(e,i){return t.setUint32(e,i,JL)}}break;case Yl.FLOAT:switch(n){case 2:return function(e,i){return t.setUint16(e,i,JL)};case 4:return function(e,i){return t.setFloat32(e,i,JL)}}}return null}function iF(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 wL;n.setNextAlignment(0);for(var r,s=d(i.vertexBundles);!(r=s()).done;){var a=r.value,o=a.view,h=o.count*o.stride,u=new Uint8Array(h),l=new Uint8Array(t.data.buffer,o.offset,o.length);e(kL.decodeVertexBuffer(u,o.count,o.stride,l)),n.setNextAlignment(o.stride);var c={offset:n.getLength(),length:u.byteLength,count:o.count,stride:o.stride};a.view=c,n.addBuffer(u)}for(var _,f=d(i.primitives);!(_=f()).done;){var p=_.value;if(void 0!==p.indexView){var m=p.indexView,g=m.count*m.stride,v=new Uint8Array(g),y=new Uint8Array(t.data.buffer,m.offset,m.length);e(kL.decodeIndexBuffer(v,m.count,m.stride,y)),n.setNextAlignment(m.stride);var T={offset:n.getLength(),length:v.byteLength,count:m.count,stride:m.stride};p.indexView=T,n.addBuffer(v)}}return{struct:i,data:new Uint8Array(n.getCombined())}}function nF(t){var e=new XL.Inflate(t.data).decompress();return t.data=e,t.struct.compressed=!1,t}var rF=[new __(Mc.ATTR_POSITION,jl.RGB32F),new __(Mc.ATTR_NORMAL,jl.RGB32F),new __(Mc.ATTR_TEX_COORD,jl.RG32F),new __(Mc.ATTR_TANGENT,jl.RGBA32F),new __(Mc.ATTR_COLOR,jl.RGBA32F)],sF=new hn;function aF(t,e,i){i=i||{};var n,r=[],s=0,a=[],o=0,h=t.positions.slice();if(h.length>0){if(n=null,t.attributes)for(var u,l=d(t.attributes);!(u=l()).done;){var c=u.value;if(c.name===Mc.ATTR_POSITION){n=c;break}}n||(n=rF[0]),r.push(n);var _=F_[n.format];o=Math.max(o,Math.floor(h.length/_.count)),a.push({offset:s,data:h,attribute:n}),s+=_.size}if(t.normals&&t.normals.length>0){if(n=null,t.attributes)for(var f,p=d(t.attributes);!(f=p()).done;){var m=f.value;if(m.name===Mc.ATTR_NORMAL){n=m;break}}n||(n=rF[1]);var g=F_[n.format];r.push(n),o=Math.max(o,Math.floor(t.normals.length/g.count)),a.push({offset:s,data:t.normals,attribute:n}),s+=g.size}if(t.uvs&&t.uvs.length>0){if(n=null,t.attributes)for(var v,y=d(t.attributes);!(v=y()).done;){var T=v.value;if(T.name===Mc.ATTR_TEX_COORD){n=T;break}}n||(n=rF[2]);var S=F_[n.format];r.push(n),o=Math.max(o,Math.floor(t.uvs.length/S.count)),a.push({offset:s,data:t.uvs,attribute:n}),s+=S.size}if(t.tangents&&t.tangents.length>0){if(n=null,t.attributes)for(var E,A=d(t.attributes);!(E=A()).done;){var R=E.value;if(R.name===Mc.ATTR_TANGENT){n=R;break}}n||(n=rF[3]);var b=F_[n.format];r.push(n),o=Math.max(o,Math.floor(t.tangents.length/b.count)),a.push({offset:s,data:t.tangents,attribute:n}),s+=b.size}if(t.colors&&t.colors.length>0){if(n=null,t.attributes)for(var C,w=d(t.attributes);!(C=w()).done;){var x=C.value;if(x.name===Mc.ATTR_COLOR){n=x;break}}n||(n=rF[4]);var I=F_[n.format];r.push(n),o=Math.max(o,Math.floor(t.colors.length/I.count)),a.push({offset:s,data:t.colors,attribute:n}),s+=I.size}if(t.customAttributes)for(var O=0;O<t.customAttributes.length;O++){var D=t.customAttributes[O],M=F_[D.attr.format];r.push(D.attr),o=Math.max(o,Math.floor(D.values.length/M.count)),a.push({offset:s,data:D.values,attribute:D.attr}),s+=M.size}for(var P=new wL,B=new ArrayBuffer(o*s),N=new DataView(B),L=0,F=a;L<F.length;L++){var k=F[L];Px(N,k.data,k.attribute.format,k.offset,s)}P.setNextAlignment(0);var U={attributes:r,view:{offset:P.getLength(),length:B.byteLength,count:o,stride:s}};P.addBuffer(B);var G=null,H=0;if(t.indices){var z=t.indices;H=z.length,G=new ArrayBuffer(2*H),Px(new DataView(G),z,jl.R16UI)}var V={primitiveMode:t.primitiveMode||vc.TRIANGLE_LIST,vertexBundelIndices:[0]};G&&(P.setNextAlignment(2),V.indexView={offset:P.getLength(),length:G.byteLength,count:H,stride:2},P.addBuffer(G));var W=t.minPos;if(!W&&i.calculateBounds){W=hn.set(new hn,1/0,1/0,1/0);for(var X=0;X<o;++X)hn.set(sF,h[3*X+0],h[3*X+1],h[3*X+2]),hn.min(W,W,sF)}var j=t.maxPos;if(!j&&i.calculateBounds){j=hn.set(new hn,-1/0,-1/0,-1/0);for(var Y=0;Y<o;++Y)hn.set(sF,h[3*Y+0],h[3*Y+1],h[3*Y+2]),hn.max(j,j,sF)}var K={vertexBundles:[U],primitives:[V]};return W&&(K.minPosition=new hn(W.x,W.y,W.z)),j&&(K.maxPosition=new hn(j.x,j.y,j.z)),e||(e=new QL),e.reset({struct:K,data:new Uint8Array(P.getCombined())}),e}function oF(t,e){if(e>0){var i=t%e;if(0!==i)return e-i}return 0}var hF,uF,lF=function(){function t(){}return t.createMesh=function(t,e,i){return aF(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 __(Mc.ATTR_POSITION,jl.RGB32F,!1,s++,!1,0)),e.normals&&e.normals.length>0&&r.push(new __(Mc.ATTR_NORMAL,jl.RGB32F,!1,s++,!1,0)),e.uvs&&e.uvs.length>0&&r.push(new __(Mc.ATTR_TEX_COORD,jl.RG32F,!1,s++,!1,0)),e.tangents&&e.tangents.length>0&&r.push(new __(Mc.ATTR_TANGENT,jl.RGBA32F,!1,s++,!1,0)),e.colors&&e.colors.length>0&&r.push(new __(Mc.ATTR_COLOR,jl.RGBA32F,!1,s++,!1,0)),e.customAttributes)for(var a=0;a<e.customAttributes.length;a++){var o=e.customAttributes[a],h=new __;h.copy(o.attr),h.stream=s++,r.push(h)}for(var u=[],l=[],c=0,_=0;_<n.maxSubMeshes;_++){for(var f,p={vertexBundelIndices:[],primitiveMode:e.primitiveMode||vc.TRIANGLE_LIST},m=d(r);!(f=m()).done;){var g=f.value,v=F_[g.format],y=n.maxSubMeshVertices*v.size,T={view:{offset:c,length:y,count:0,stride:v.size},attributes:[g]},S=u.length;p.vertexBundelIndices.push(S),u.push(T),c+=y}var E=0;if(e.indices16&&e.indices16.length>0?E=2:e.indices32&&e.indices32.length>0&&(E=4),E>0){c+=oF(c,E);var A=n.maxSubMeshIndices*E,R={offset:c,length:A,count:0,stride:E};p.indexView=R,c+=A}l.push(p)}var b={info:{maxSubMeshes:n.maxSubMeshes,maxSubMeshVertices:n.maxSubMeshVertices,maxSubMeshIndices:n.maxSubMeshIndices},bounds:[]};b.bounds.length=n.maxSubMeshes;var C={struct:{vertexBundles:u,primitives:l,dynamic:b},data:new Uint8Array(c)};return i||(i=new QL),i.reset(C),i.initialize(),i.updateSubMesh(t,e),i}(t,e,i,n)},t.decodeMesh=function(t){return iF(t)},t.inflateMesh=function(t){return nF(t)},t}(),cF=Object.freeze({__proto__:null,find:lN,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,a=s.primitives[e],o=d(a.vertexBundelIndices);!(i=o()).done;)for(var h,u=i.value,l=s.vertexBundles[u],c=l.view.offset,_=l.view,f=_.length,p=_.stride,m=d(l.attributes);!(h=m()).done;){var g=h.value,v=bL[g.name];v&&(n[v]=(n[v]||[]).concat(Bx(r,g.format,c,f,p))),c+=F_[g.format].size}var y=a.indexView;return n.indices=Bx(r,jl["R"+8*y.stride+"UI"],y.offset,y.length),n},createMesh:aF,MeshUtils:lF,readBuffer:Bx,writeBuffer:Px,mapBuffer:Nx});t("a3",cF);var _F,dF=new hn,fF=new Dn;!function(t){t[t.RECT=0]="RECT",t[t.POLYGON=1]="POLYGON"}(_F||(_F={}));var pF,mF,gF,vF=[{u:0,v:0},{u:0,v:0},{u:0,v:0},{u:0,v:0}],yF=t("b",qs("cc.SpriteFrame")(((uF=function(t){function e(){var e;return(e=t.call(this)||this).vertices=null,e.uv=[],e.unbiasUV=[],e.uvSliced=[],e._rect=new Vn,e._trimmedBorder=new nn,e._offset=new Fn,e._originalSize=new Hn,e._rotated=!1,e._capInsets=[0,0,0,0],e._atlasUuid="",e._texture=void 0,e._isFlipUVY=!1,e._isFlipUVX=!1,e._original=null,e._packable=!0,e._pixelsToUnit=100,e._pivot=new Fn(.5,.5),e._meshType=_F.RECT,e._extrude=0,e._customOutLine=[],e._minPos=new hn,e._maxPos=new hn,e}s(e,t),e.createWithImage=function(t){var i=t instanceof Df?t:new Df(t),n=new em;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&&CL&&CL.deleteAtlasSpriteFrame(this),t.prototype.destroy.call(this)},i._calculateSlicedUV=function(){var t=this._rect,i=this.texture,n=i.width,r=i.height,s=this._capInsets[0],a=this._capInsets[2],o=t.width-s-a,h=this._capInsets[1],u=this._capInsets[3],l=t.height-h-u,c=this.uvSliced;if(c.length=0,this._rotated){vF[0].u=t.x/n,vF[1].u=(t.x+u)/n,vF[2].u=(t.x+u+l)/n,vF[3].u=(t.x+t.height)/n,vF[3].v=t.y/r,vF[2].v=(t.y+s)/r,vF[1].v=(t.y+s+o)/r,vF[0].v=(t.y+t.width)/r;for(var _=0;_<4;++_)for(var d=vF[_],f=0;f<4;++f){var p=vF[3-f];c.push({u:d.u,v:p.v})}}else{vF[0].u=t.x/n,vF[1].u=(t.x+s)/n,vF[2].u=(t.x+s+o)/n,vF[3].u=(t.x+t.width)/n,vF[3].v=t.y/r,vF[2].v=(t.y+h)/r,vF[1].v=(t.y+h+l)/r,vF[0].v=(t.y+t.height)/r;for(var m=0;m<4;++m)for(var g=vF[m],v=0;v<4;++v){var y=vF[v];c.push({u:y.u,v:g.v})}}this.emit(e.EVENT_UV_UPDATED,this)},i._calculateUV=function(){var t=this._rect,e=this.uv,i=this.unbiasUV,n=this.texture,r=n.width,s=n.height;if(this._rotated){var a=0===r?0:t.x/r,o=0===r?1:(t.x+t.height)/r,h=0===s?0:t.y/s,u=0===s?1:(t.y+t.width)/s;this._isFlipUVX&&this._isFlipUVY?(e[0]=o,e[1]=u,e[2]=o,e[3]=h,e[4]=a,e[5]=u,e[6]=a,e[7]=h):this._isFlipUVX?(e[0]=o,e[1]=h,e[2]=o,e[3]=u,e[4]=a,e[5]=h,e[6]=a,e[7]=u):this._isFlipUVY?(e[0]=a,e[1]=u,e[2]=a,e[3]=h,e[4]=o,e[5]=u,e[6]=o,e[7]=h):(e[0]=a,e[1]=h,e[2]=a,e[3]=u,e[4]=o,e[5]=h,e[6]=o,e[7]=u);var l=0===r?0:t.x/r,c=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]=c,i[1]=d,i[2]=c,i[3]=_,i[4]=l,i[5]=d,i[6]=l,i[7]=_):this._isFlipUVX?(i[0]=c,i[1]=_,i[2]=c,i[3]=d,i[4]=l,i[5]=_,i[6]=l,i[7]=d):this._isFlipUVY?(i[0]=l,i[1]=d,i[2]=l,i[3]=_,i[4]=c,i[5]=d,i[6]=c,i[7]=_):(i[0]=l,i[1]=_,i[2]=l,i[3]=d,i[4]=c,i[5]=_,i[6]=c,i[7]=d)}else{var f=0===r?0:t.x/r,p=0===r?1:(t.x+t.width)/r,m=0===s?1:(t.y+t.height)/s,g=0===s?0:t.y/s;this._isFlipUVX&&this._isFlipUVY?(e[0]=p,e[1]=g,e[2]=f,e[3]=g,e[4]=p,e[5]=m,e[6]=f,e[7]=m):this._isFlipUVX?(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._isFlipUVY?(e[0]=f,e[1]=g,e[2]=p,e[3]=g,e[4]=f,e[5]=m,e[6]=p,e[7]=m):(e[0]=f,e[1]=m,e[2]=p,e[3]=m,e[4]=f,e[5]=g,e[6]=p,e[7]=g);var v=0===r?0:t.x/r,y=0===r?1:(t.x+t.width)/r,T=0===s?1:(t.y+t.height)/s,S=0===s?0:t.y/s;this._isFlipUVX&&this._isFlipUVY?(i[0]=y,i[1]=S,i[2]=v,i[3]=S,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]=S,i[6]=v,i[7]=S):this._isFlipUVY?(i[0]=v,i[1]=S,i[2]=y,i[3]=S,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]=S,i[6]=y,i[7]=S)}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=CL;if(t){var e=this._texture;if(e instanceof em&&!e.isCompressed){var i=this.width,n=this.height;if(!e.image||i>t.maxFrameSize||n>t.maxFrameSize)this._packable=!1;else{var r=T.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 Vn(i.x,i.y,i.width,i.height));var n=e.offset;e.offset&&(this._offset=new Fn(n.x,n.y));var r=e.originalSize;e.originalSize&&(this._originalSize=new Hn(r.width,r.height)),this._rotated=!!e.rotated,this._name=e.name,this._packable=!!e.packable,this._pixelsToUnit=e.pixelsToUnit;var s=e.pivot;s&&(this._pivot=new Fn(s.x,s.y)),this._meshType=e.meshType;var a=e.capInsets;a&&(this._capInsets[0]=a[0],this._capInsets[1]=a[1],this._capInsets[2]=a[2],this._capInsets[3]=a[3]);var o=e.vertices;if(o){this.vertices||(this.vertices={rawPosition:[],positions:[],indexes:o.indexes,uv:o.uv,nuv:o.nuv,minPos:new hn(o.minPos.x,o.minPos.y,o.minPos.z),maxPos:new hn(o.maxPos.x,o.maxPos.y,o.maxPos.z)}),this.vertices.rawPosition.length=0;for(var h=o.rawPosition,u=0;u<h.length;u+=3)this.vertices.rawPosition.push(new hn(h[u],h[u+1],h[u+2]));this._updateMeshVertices()}},i.clone=function(){var t,i,n,r,s=new e,a=this.vertices;return s.vertices=a?{rawPosition:a.rawPosition.slice(0),positions:a.positions.slice(0),indexes:a.indexes.slice(0),uv:a.uv.slice(0),nuv:a.nuv.slice(0),minPos:a.minPos.clone(),maxPos:a.minPos.clone()}:null,(t=s.uv).splice.apply(t,[0,s.uv.length].concat(this.uv)),(i=s.unbiasUV).splice.apply(i,[0,s.unbiasUV.length].concat(this.unbiasUV)),(n=s.uvSliced).splice.apply(n,[0,s.uvSliced.length].concat(this.uvSliced)),s._rect.set(this._rect),s._offset.set(this._offset),s._originalSize.set(this._originalSize),s._rotated=this._rotated,(r=s._capInsets).splice.apply(r,[0,s._capInsets.length].concat(this._capInsets)),s._atlasUuid=this._atlasUuid,s._texture=this._texture,s._isFlipUVX=this._isFlipUVX,s._isFlipUVY=this._isFlipUVY,s._pixelsToUnit=this._pixelsToUnit,s._pivot.set(this._pivot),s._meshType=this._meshType,s},i._refreshTexture=function(t){this._texture=t;var e=this._texture,i={},n=!1;0!==this._rect.width&&0!==this._rect.height&&this.checkRect(e)||(i.rect=new Vn(0,0,e.width,e.height),n=!0),(0===this._originalSize.width||0===this._originalSize.height||n)&&(i.originalSize=new Hn(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 em;i.initDefault(),this._refreshTexture(i),this._calculateUV()},i.validate=function(){return this._texture&&this._rect&&0!==this._rect.width&&0!==this._rect.height},i._initVertices=function(){if(this.vertices?(this.vertices.rawPosition.length=0,this.vertices.positions.length=0,this.vertices.indexes.length=0,this.vertices.uv.length=0,this.vertices.nuv.length=0,this.vertices.minPos.set(0,0,0),this.vertices.maxPos.set(0,0,0)):this.vertices={rawPosition:[],positions:[],indexes:[],uv:[],nuv:[],minPos:new hn,maxPos:new hn},this._meshType===_F.POLYGON);else{var t=this.texture,e=t.width,i=t.height,n=this.rect,r=n.width,s=n.height,a=n.x,o=i-n.y-s,h=r/2,u=s/2,l=0===e?0:a/e,c=0===e?1:(a+r)/e,_=0===i?1:(o+s)/i,d=0===i?0:n.y/i;dF.set(-h,-u,0),this.vertices.rawPosition.push(dF.clone()),this.vertices.uv.push(a),this.vertices.uv.push(o+s),this.vertices.nuv.push(l),this.vertices.nuv.push(d),this.vertices.minPos.set(dF),dF.set(h,-u,0),this.vertices.rawPosition.push(dF.clone()),this.vertices.uv.push(a+r),this.vertices.uv.push(o+s),this.vertices.nuv.push(c),this.vertices.nuv.push(d),dF.set(-h,u,0),this.vertices.rawPosition.push(dF.clone()),this.vertices.uv.push(a),this.vertices.uv.push(o),this.vertices.nuv.push(l),this.vertices.nuv.push(_),dF.set(h,u,0),this.vertices.rawPosition.push(dF.clone()),this.vertices.uv.push(a+r),this.vertices.uv.push(o),this.vertices.nuv.push(c),this.vertices.nuv.push(_),this.vertices.maxPos.set(dF),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(){fF.identity();var t=1/this._pixelsToUnit,e=-(this._pivot.x-.5)*this.rect.width*t,i=-(this._pivot.y-.5)*this.rect.height*t,n=new hn(e,i,0);fF.transform(n),n.set(t,t,1),fF.scale(n);for(var r=this.vertices,s=0;s<r.rawPosition.length;s++){var a=r.rawPosition[s];hn.transformMat4(n,a,fF),hn.toArray(r.positions,n,3*s)}hn.transformMat4(this._minPos,r.minPos,fF),hn.transformMat4(this._maxPos,r.maxPos,fF)},i._createMesh=function(){this._mesh=aF({primitiveMode:vc.TRIANGLE_LIST,positions:this.vertices.positions,uvs:this.vertices.nuv,indices:this.vertices.indexes,minPos:this._minPos,maxPos:this._maxPos,attributes:[new __(Mc.ATTR_POSITION,jl.RGB32F),new __(Mc.ATTR_TEX_COORD,jl.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}(uf)).EVENT_UV_UPDATED="uv_updated",uF.MeshType=_F,hF=uF))||hF);v.SpriteFrame=yF;var TF,SF=t("a",qs("cc.SpriteAtlas")((mF=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).spriteFrames=gF&&gF(),e}s(e,t);var i=e.prototype;return i.getTexture=function(){var t=Object.keys(this.spriteFrames);if(t.length>0){var e=this.spriteFrames[t[0]];return e&&e.texture}return null},i.getSpriteFrame=function(t){var e=this.spriteFrames[t];return e?(e.name||(e.name=t),e):null},i.getSpriteFrames=function(){for(var t=[],e=this.spriteFrames,i=0,n=Object.keys(e);i<n.length;i++){var r=n[i];t.push(e[r])}return t},i._serialize=function(){},i._deserialize=function(t,e){var i=t;this._name=i.name;var n=i.spriteFrames;this.spriteFrames=Ot();for(var r=0;r<n.length;r+=2)e.result.push(this.spriteFrames,n[r],n[r+1],re(yF))},e}(uf),gF=Gs(mF.prototype,"spriteFrames",[ra],(function(){return Ot()})),pF=mF))||pF);v.SpriteAtlas=SF;var EF,AF,RF,bF=t("F",qs("cc.Font")(TF=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(uf))||TF);v.Font=bF;var CF,wF,xF,IF,OF,DF,MF,PF,BF=t("T",qs("cc.TTFFont")((AF=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._fontFamily=RF&&RF(),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:cl(this._native),__isNative__:!0}}}]),e}(bF),RF=Gs(AF.prototype,"_fontFamily",[ra],(function(){return null})),f(AF.prototype,"_nativeAsset",[Ia,wa],Object.getOwnPropertyDescriptor(AF.prototype,"_nativeAsset"),AF.prototype),f(AF.prototype,"_nativeDep",[Ia],Object.getOwnPropertyDescriptor(AF.prototype,"_nativeDep"),AF.prototype),EF=AF))||EF);v.TTFFont=BF;var NF,LF=function(){this.u=0,this.v=0,this.w=0,this.h=0,this.offsetX=0,this.offsetY=0,this.textureID=0,this.valid=!1,this.xAdvance=0},FF=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 LF;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=t.charCodeAt(0);return this.letterDefinitions.hasOwnProperty(e)?this.letterDefinitions[e]:null},e.clear=function(){this.letterDefinitions={}},t}(),kF=t("B",(CF=qs("cc.BitmapFont"),wF=xa(yF),CF((IF=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).fntDataStr=OF&&OF(),e.spriteFrame=DF&&DF(),e.fontSize=MF&&MF(),e.fntConfig=PF&&PF(),e}return s(e,t),e.prototype.onLoaded=function(){var t=this.spriteFrame;!this.fontDefDictionary&&t&&(this.fontDefDictionary=new FF(t.texture));var e=this.fntConfig;if(e){var i=e.fontDefDictionary;for(var n in i){var r=new LF,s=i[n].rect;r.offsetX=i[n].xOffset,r.offsetY=i[n].yOffset,r.w=s.width,r.h=s.height,r.u=s.x,r.v=s.y,r.textureID=0,r.valid=!0,r.xAdvance=i[n].xAdvance,this.fontDefDictionary.addLetterDefinitions(n,r)}}else U("The fnt config is not exists!")},e}(bF),OF=Gs(IF.prototype,"fntDataStr",[ra],(function(){return""})),DF=Gs(IF.prototype,"spriteFrame",[wF],(function(){return null})),MF=Gs(IF.prototype,"fontSize",[ra],(function(){return-1})),PF=Gs(IF.prototype,"fntConfig",[ra],(function(){return null})),xF=IF))||xF));v.BitmapFont=kF;var UF=t("L",qs("cc.LabelAtlas")(NF=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(kF))||NF);v.LabelAtlas=UF;var GF=t("z",.26),HF=t("A",(GF+1)/2-GF);var zF=new se(2);zF.get=function(){return this._get()||{key:"",value:0,prev:null,next:null}};var VF,WF=new(t("E",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=zF.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,zF.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),XF=/([a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûа-яА-ЯЁё]+|\S)/,jF=/^[!,.:;'}\]%\?>、‘“》?。,!]/,YF=/([a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûаíìÍÌïÁÀáàÉÈÒÓòóŐőÙÚŰúűñÑæÆœŒÃÂãÔõěščřžýáíéóúůťďňĚŠČŘŽÁÍÉÓÚŤżźśóńłęćąŻŹŚÓŃŁĘĆĄ-яА-ЯЁёáàảạãăắằẳẵặâấầẩẫậéèẻẽẹêếềểễệiíìỉĩịóòỏõọôốồổỗộơớờởỡợúùủũụưứừửữựýỳỷỹỵđÁÀẢẠÃĂẮẰẲẴẶÂẤẦẨẪẬÉÈẺẼẸÊẾỀỂỄỆIÍÌỈĨỊÓÒỎÕỌÔỐỒỔỖỘƠỚỜỞỠỢÚÙỦŨỤƯỨỪỬỮỰÝỲỶỸỴĐ]+|\S)$/,KF=/[a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûаíìÍÌïÁÀáàÉÈÒÓòóŐőÙÚŰúűñÑæÆœŒÃÂãÔõěščřžýáíéóúůťďňĚŠČŘŽÁÍÉÓÚŤżźśóńłęćąŻŹŚÓŃŁĘĆĄ-яА-ЯЁёáàảạãăắằẳẵặâấầẩẫậéèẻẽẹêếềểễệiíìỉĩịóòỏõọôốồổỗộơớờởỡợúùủũụưứừửữựýỳỷỹỵđÁÀẢẠÃĂẮẰẲẴẶÂẤẦẨẪẬÉÈẺẼẸÊẾỀỂỄỆIÍÌỈĨỊÓÒỎÕỌÔỐỒỔỖỘƠỚỜỞỠỢÚÙỦŨỤƯỨỪỬỮỰÝỲỶỸỴĐ]+$/,qF=/^[a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûаíìÍÌïÁÀáàÉÈÒÓòóŐőÙÚŰúűñÑæÆœŒÃÂãÔõěščřžýáíéóúůťďňĚŠČŘŽÁÍÉÓÚŤżźśóńłęćąŻŹŚÓŃŁĘĆĄ-яА-ЯЁёáàảạãăắằẳẵặâấầẩẫậéèẻẽẹêếềểễệiíìỉĩịóòỏõọôốồổỗộơớờởỡợúùủũụưứừửữựýỳỷỹỵđÁÀẢẠÃĂẮẰẲẴẶÂẤẦẨẪẬÉÈẺẼẸÊẾỀỂỄỆIÍÌỈĨỊÓÒỎÕỌÔỐỒỔỖỘƠỚỜỞỠỢÚÙỦŨỤƯỨỪỬỮỰÝỲỶỸỴĐ]/;function QF(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 ZF(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 JF(t,e,i){var n=(i||t.font)+"🎮"+e,r=WF.get(n);if(null!==r)return r;var s=t.measureText(e),a=s&&s.width||0;return WF.put(n,a),a}function $F(t,e,i){var n=e,r=i,s=t[e];if(s>="\udc00"&&s<="\udfff"&&n--,void 0!==i)if(i-1!==e){var a=t[i-1];a>="\ud800"&&a<="\udbff"&&r--}else s>="\ud800"&&s<="\udbff"&&r++;return t.substring(n,r)}function tk(t){return qF.exec(t)}function ek(t){return KF.exec(t)}function ik(t,e,i,n){var r=[];if(0===t.length||i<0)return r.push(""),r;for(var s=t;e>i&&s.length>1;){for(var a=s.length*(i/e)|0,o=$F(s,a),h=e-n(o),u=o,l=0,c=0;h>i&&c++<100;)a*=i/h,h=e-n(o=$F(s,a|=0));for(c=0;o&&h<=i&&c++<100;){var _=XF.exec(o);u=o,h=e-n(o=$F(s,a+=l=_?_[0].length:1))}0==(a-=l)?(a=1,u=$F(s,1)):1===a&&s[0]>="\ud800"&&s[0]<="\udbff"&&(a=2,u=$F(s,2));var d=$F(s,0,a),f=void 0;jF.test(u||o)&&(0==(a-=(f=YF.exec(d))?f[0].length:0)&&(a=1),u=$F(s,a),d=$F(s,0,a)),qF.test(u)&&(f=KF.exec(d))&&d!==f[0]&&(u=$F(s,a-=f[0].length),d=$F(s,0,a)),(0===r.length||(d=d.trim()).length>0)&&r.push(d),e=n(s=u||o)}return(0===r.length||(s=s.trim()).length>0)&&r.push(s),r}var nk,rk=function(){function t(){this.pool=[]}t.getInstance=function(){return VF||(VF=new t),VF};var e=t.prototype;return e.get=function(){var t=this.pool.pop();if(!t){var e=T.document.createElement("canvas"),i=e.getContext("2d");t={canvas:e,context:i}}return t},e.put=function(t){this.pool.length>=Ce.MAX_LABEL_CANVAS_POOL_SIZE||this.pool.push(t)},t}(),sk=pn.WHITE.clone(),ak=function(){this.u=0,this.v=0,this.w=0,this.h=0,this.texture=null,this.offsetX=0,this.offsetY=0,this.valid=!1,this.xAdvance=0},ok="rgba(255, 255, 255, "+(1/255).toFixed(3)+")",hk=function(){function t(t,e){this.image=null,this.labelInfo=void 0,this.char=void 0,this.data=null,this.canvas=null,this.context=null,this.width=0,this.height=0,this.offsetY=0,this.hash=void 0,this.char=t,this.labelInfo=e,this.hash=""+t.charCodeAt(0)+e.hash}var e=t.prototype;return e.updateRenderData=function(){this._updateProperties(),this._updateTexture()},e.destroy=function(){this.image=null,rk.getInstance().put(this.data)},e._updateProperties=function(){if(this.data=rk.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=JF(this.context,this.char,this.labelInfo.fontDesc),i=2*this.labelInfo.margin+2;this.width=parseFloat(e.toFixed(2))*t+i,this.height=(1+GF)*this.labelInfo.fontSize*t+i,this.offsetY=-this.labelInfo.fontSize*GF*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 Df),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=ok,t.fillRect(0,0,i,n),t.font=e.fontDesc.replace(/(\d+)(\.\d+)?(px|em|rem|pt)/g,(function(t,e,i,n){return(+e*r+(+i||0)*r).toString()+n}));var s=e.fontSize*r,a=i/2,o=n/2+s*HF+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||sk;t.strokeStyle="rgba("+u.r+", "+u.g+", "+u.b+", "+u.a/255+")",t.lineWidth=2*e.margin*r,t.strokeText(this.char,a,o)}t.fillText(this.char,a,o)}},t}(),uk=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=lf.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 Vc;s.texOffset.x=e,s.texOffset.y=i,s.texExtent.width=t.width,s.texExtent.height=t.height,r.copyTexImagesToTexture([t.data],n,[s])}else console.warn("Unable to get device")}},e}(em),lk=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 uk;i.initWithSize(t,e),this.fontDefDictionary=new FF(i),this._halfBleed=1,this._width=t,this._height=e,gL.on(mL.EVENT_BEFORE_SCENE_LAUNCH,this.beforeSceneLoad,this)}var e=t.prototype;return e.insertLetterTexture=function(t){var e=t.image,i=gL.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;this.fontDefDictionary.texture.drawTextureAt(e,this._x,this._y),this._dirty=!0;var s=new ak;return s.u=this._x+this._halfBleed,s.v=this._y+this._halfBleed,s.texture=this.fontDefDictionary.texture,s.valid=!0,s.w=t.width-2,s.h=t.height-2,s.xAdvance=s.w,s.offsetY=t.offsetY,this._x+=n+0,this.fontDefDictionary.addLetterDefinitions(t.hash,s),s},e.update=function(){this._dirty&&(this._dirty=!1)},e.reset=function(){this._x=0,this._y=0,this._nextY=0,this.fontDefDictionary.clear()},e.destroy=function(){this.reset(),this.fontDefDictionary&&(this.fontDefDictionary.texture.destroy(),this.fontDefDictionary.texture=null)},e.getTexture=function(){return this.fontDefDictionary.getTexture()},e.beforeSceneLoad=function(){this.clearAllCache()},e.clearAllCache=function(){this.destroy();var t=new uk;t.initWithSize(this._width,this._height),this.fontDefDictionary.texture=t},e.getLetter=function(t){return this.fontDefDictionary.letterDefinitions[t]},e.getLetterDefinitionForChar=function(t,e){var i=t.charCodeAt(0)+e.hash,n=this.fontDefDictionary.letterDefinitions[i];if(!n){var r=new hk(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}(),ck={fontAtlas:null,fontSize:0,lineHeight:0,hAlign:0,vAlign:0,hash:"",fontFamily:"",fontDesc:"Arial",color:pn.WHITE.clone(),isOutlined:!1,out:pn.WHITE.clone(),margin:0,fontScale:1},_k=[new __(Mc.ATTR_POSITION,jl.RGB32F)],dk=[new __(Mc.ATTR_POSITION,jl.RGB32F),new __(Mc.ATTR_COLOR,jl.RGBA32F)],fk=[new __(Mc.ATTR_POSITION,jl.RGB32F),new __(Mc.ATTR_TEX_COORD,jl.RG32F),new __(Mc.ATTR_COLOR,jl.RGBA32F)],pk=[new __(Mc.ATTR_POSITION,jl.RGB32F),new __(Mc.ATTR_TEX_COORD,jl.RG32F),new __(Mc.ATTR_COLOR,jl.RGBA8,!0)],mk=[new __(Mc.ATTR_POSITION,jl.RGB32F),new __(Mc.ATTR_TEX_COORD,jl.RG32F),new __(Mc.ATTR_COLOR,jl.RGBA32F),new __(Mc.ATTR_COLOR2,jl.RGBA32F)],gk=[new __(Mc.ATTR_POSITION,jl.RGB32F),new __(Mc.ATTR_TEX_COORD,jl.RG32F),new __(Mc.ATTR_COLOR,jl.RGBA8,!0),new __(Mc.ATTR_COLOR2,jl.RGBA8,!0)];function vk(t){for(var e=0,i=0;i<t.length;i++){var n=t[i];e+=F_[n.format].count}return e}function yk(t){for(var e=0,i=0;i<t.length;i++){var n=t[i];e+=F_[n.format].size}return e}v.internal.vfmtPosUvColor=fk,v.internal.vfmtPosUvTwoColor=mk,v.internal.vfmtPosUvColor4B=pk,v.internal.vfmtPosUvTwoColor4B=gk,t("v",Object.freeze({__proto__:null,vfmt:_k,vfmtPosColor:dk,vfmtPosUvColor:fk,vfmtPosUvColor4B:pk,vfmtPosUvTwoColor:mk,vfmtPosUvTwoColor4B:gk,getComponentPerVertex:vk,getAttributeStride:yk})),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"}(nk||(nk={}));var Tk,Sk,Ek,Ak,Rk,bk,Ck=t("M",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=yk(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=Ol.__isWebIOS14OrIPadOS14Env,e=t?this._nextFreeIAHandle:1;if(t&&e/this._iaPool.length<.5){for(var i=e/.5,n=this._iaPool.length-1;n>=i;n--){var r=this._iaPool[n];r.vertexBuffers[0]&&r.vertexBuffers[0].destroy(),r.indexBuffer&&r.indexBuffer.destroy(),r.ia.destroy()}this._iaPool.length=i}for(var s=this.byteOffset,a=this.indexOffset,o=0;o<e;++o){var h=this._iaPool[o],u=new Float32Array(this.vData.buffer,0,s>>2),l=new Uint16Array(this.iData.buffer,0,a),c=h.vertexBuffers[0];s>c.size&&c.resize(s),c.update(u),2*a>h.indexBuffer.size&&h.indexBuffer.resize(2*a),h.indexBuffer.update(l)}this.dirty=!1}},t.createNewIA=function(t){var e,i,n;if(Ol.__isWebIOS14OrIPadOS14Env||!this._iaPool[0]){var r=this._vertexFormatBytes=this._floatsPerVertex*Float32Array.BYTES_PER_ELEMENT,s=Uint16Array.BYTES_PER_ELEMENT,a=t.createBuffer(new qc(ql.VERTEX|ql.TRANSFER_DST,Jl.HOST|Jl.DEVICE,r,r));n=t.createBuffer(new qc(ql.INDEX|ql.TRANSFER_DST,Jl.HOST|Jl.DEVICE,s,s)),i=[a],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}()),wk=function(){function t(t,e){this._device=null,this._attributes=null,this._vertexFormatBytes=void 0,this._floatsPerVertex=void 0,this._buffers=[],this._device=t,this._attributes=e,this._floatsPerVertex=yk(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}(),xk=new Pu((function(){return{offset:0,length:0}}),32),Ik=function(){function t(t,e,i,n,r,s){this._ib=void 0,this.vertexAccessor=t,this.bufferId=e,this.meshBuffer=i,this.vertexOffset=n,this.vb=r,this.indexCount=s,this._ib=new Uint16Array(s),t.getMeshBuffer(e)}return t.prototype.setIndexBuffer=function(){},n(t,[{key:"ib",get:function(){return this._ib}}]),t}(),Ok=function(t){function e(i,n,r,s){var a;return(a=t.call(this,i,n)||this)._freeLists=[],a._vCount=0,a._iCount=0,a._id=0,a._vCount=r||Math.floor(1024*Ce.BATCHER2D_MEM_INCREMENT/a._vertexFormatBytes),a._iCount=s||a._vCount*e.IB_SCALE,a._id=e.generateID(),a._allocateBuffer(),a}s(e,t);var i=e.prototype;return i.destroy=function(){for(var e=0;e<this._buffers.length;++e){this._buffers[e].destroy();for(var i=this._freeLists[e],n=0;n<i.length;++n)xk.free(i[n])}this._buffers.length=0,this._freeLists.length=0,t.prototype.destroy.call(this)},i.reset=function(){for(var t=0;t<this._buffers.length;++t){var e=this._buffers[t];e.indexOffset=0,e.reset()}},i.getVertexBuffer=function(t){return this._buffers[t].vData},i.getIndexBuffer=function(t){return this._buffers[t].iData},i.getMeshBuffer=function(t){return this._buffers[t]},i.uploadBuffers=function(){for(var t=0;t<this._buffers.length;++t){var e=this._freeLists[t][0],i=this._buffers[t];(!e||e.length<i.vData.byteLength)&&i.uploadBuffers()}},i.appendIndices=function(t,e){var i=this._buffers[t];if(e.length){var n=i.indexOffset+e.length;if(i.iData.length<n){var r=Math.floor(1.25*n),s=new Uint16Array(r);s.set(i.iData),i.iData=s}i.iData.set(e,i.indexOffset),i.indexOffset+=e.length}},i.allocateChunk=function(t,e){for(var i,n=t*this.vertexFormatBytes,r=null,s=0,a=-1,o=null,h=0;h<this._buffers.length;++h){r=this._buffers[h],i=this._freeLists[h];for(var u=0;u<i.length;++u)if(i[u].length>=n){o=i[u],s=h,a=u;break}if(o)break}if(o||(s=this._allocateBuffer(),(r=this._buffers[s])&&r.checkCapacity(t,e)&&(a=0,o=this._freeLists[s][a])),o){var l=o.offset/this.vertexFormatBytes,c=new Float32Array(r.vData.buffer,o.offset,n>>2).fill(0);return this._allocateChunkFromEntry(s,a,o,n),new Ik(this,s,r,l,c,e)}return Z(9004,n),null},i.recycleChunk=function(t){var e=this._freeLists[t.bufferId],i=this._buffers[t.bufferId],n=t.vertexOffset*this.vertexFormatBytes,r=t.vb.byteLength;if(0!==r){for(var s=!1,a=0,o=null,h=e[a];h&&h.offset<n;)o=h,h=e[++a];if(o&&0==n-(o.offset+o.length)&&(o.length+=r,n=o.offset,r=o.length,h&&h.offset-(n+r)==0&&(o.length+=h.length,e.splice(a,1),xk.free(h),h=null),s=!0),!s&&h){if(0==h.offset-(n+r))h.offset=n,h.length+=r;else{var u=xk.alloc();u.offset=n,u.length=r,e.splice(a,0,u)}s=!0}if(s)n+r===i.byteOffset&&(i.byteOffset=n);else{var l=xk.alloc();l.offset=n,l.length=r,e.push(l)}}},i._allocateChunkFromEntry=function(t,e,i,n){var r=i.length-n,s=i.offset+n,a=this._buffers[t];a.byteOffset<s&&(a.byteOffset=s),tt(r>=0,9004,t,i.offset,i.length),0===r?(this._freeLists[t].splice(e,1),xk.free(i)):(i.offset+=n,i.length=r)},i._allocateBuffer=function(){tt(this._buffers.length===this._freeLists.length,9003);var t=new Ck,e=this._vCount*this._floatsPerVertex;t.initialize(this._device,this._attributes,e,this._iCount),this._buffers.push(t);var i=xk.alloc();i.offset=0,i.length=t.vData.byteLength;var n=[i];return this._freeLists.push(n),gL.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}(wk);Ok.IB_SCALE=4,Ok.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"}(Tk||(Tk={})),function(t){t[t.BufferID=0]="BufferID",t[t.AccessorID=1]="AccessorID",t[t.Count=2]="Count"}(Sk||(Sk={})),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"}(Ek||(Ek={})),function(t){t[t.COMP=0]="COMP",t[t.MODEL=1]="MODEL",t[t.MIDDLEWARE=2]="MIDDLEWARE",t[t.SUB_NODE=3]="SUB_NODE"}(Ak||(Ak={})),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=Ak.COMP,this._subNode=null,this._uint8SharedBuffer=void 0,this._uint16SharedBuffer=void 0,this._uint32SharedBuffer=void 0,this.init(t);var e=this._nativeObj.getAttrSharedBufferForJS(),i=0;this._uint8SharedBuffer=new Uint8Array(e,i,Tk.Count),i+=Tk.Count*Uint8Array.BYTES_PER_ELEMENT,this._uint16SharedBuffer=new Uint16Array(e,i,Sk.Count),i+=Sk.Count*Uint16Array.BYTES_PER_ELEMENT,this._uint32SharedBuffer=new Uint32Array(e,i,Ek.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"}(Rk||(Rk={})),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"}(bk||(bk={}));var Dk,Mk,Pk,Bk,Nk,Lk=t("S",function(){function t(){this._maskStack=[],this._stencilPattern={stencilTest:!0,func:oc.ALWAYS,stencilMask:65535,writeMask:65535,failOp:hc.KEEP,zFailOp:hc.KEEP,passOp:hc.KEEP,ref:1},this._stage=Rk.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!==Rk.ENTER_LEVEL?Rk.CLEAR_INVERTED:Rk.CLEAR},e.enableMask=function(){this.stage=Rk.ENABLED},e.exitMask=function(){0!==this._maskStack.length&&(this._maskStack.pop(),0===this._maskStack.length?this.stage=Rk.DISABLED:this.stage=Rk.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=Rk.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=oc.LESS,a=this.stencilStateMap;if(e&&e.passes[0]){var o=e.passes[0].depthStencilState,h=0,u=0;o.depthTest&&(h=1),o.depthWrite&&(u=1),i=h|u<<1|o.depthFunc<<2|t<<6|this._maskStack.length<<9,n=o.depthTest,r=o.depthWrite,s=o.depthFunc,a=this.stencilStateMapWithDepth}else i=t<<16|this._maskStack.length;if(a&&a.has(i))return a.get(i);this.setStateFromStage(t);var l=new od(n,r,s,this._stencilPattern.stencilTest,this._stencilPattern.func,this._stencilPattern.stencilMask,this._stencilPattern.writeMask,this._stencilPattern.failOp,this._stencilPattern.zFailOp,this._stencilPattern.passOp,this._stencilPattern.ref,this._stencilPattern.stencilTest,this._stencilPattern.func,this._stencilPattern.stencilMask,this._stencilPattern.writeMask,this._stencilPattern.failOp,this._stencilPattern.zFailOp,this._stencilPattern.passOp,this._stencilPattern.ref);return a.set(i,l),l},e.getStencilHash=function(t){return t<<8|this._maskStack.length},e.setStateFromStage=function(t){var e=this._stencilPattern;t===Rk.DISABLED?(e.stencilTest=!1,e.func=oc.ALWAYS,e.failOp=hc.KEEP,e.stencilMask=e.writeMask=65535,e.ref=1):(e.stencilTest=!0,t===Rk.ENABLED?(e.func=oc.EQUAL,e.failOp=hc.KEEP,e.stencilMask=e.ref=this.getStencilRef(),e.writeMask=this.getWriteMask()):t===Rk.CLEAR?(e.func=oc.NEVER,e.failOp=hc.ZERO,e.writeMask=e.stencilMask=e.ref=this.getWriteMask()):t===Rk.CLEAR_INVERTED||t===Rk.ENTER_LEVEL?(e.func=oc.NEVER,e.failOp=hc.REPLACE,e.writeMask=e.stencilMask=e.ref=this.getWriteMask()):t===Rk.ENTER_LEVEL_INVERTED&&(e.func=oc.NEVER,e.failOp=hc.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}());Lk.sharedManager=null,Lk.sharedManager=new Lk,function(t){t[t.STATIC=0]="STATIC",t[t.DYNAMIC=1]="DYNAMIC",t[t.CROSSED=2]="CROSSED"}(Dk||(Dk={})),function(t){t[t.localOpacity=0]="localOpacity",t[t.count=1]="count"}(Mk||(Mk={})),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"}(Pk||(Pk={})),function(t){t[t.colorDirty=0]="colorDirty",t[t.enabled=1]="enabled",t[t.useLocal=2]="useLocal",t[t.count=3]="count"}(Bk||(Bk={})),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"}(Nk||(Nk={}));var Fk,kk,Uk,Gk,Hk,zk,Vk,Wk,Xk,jk,Yk,Kk=function(){function t(){this._renderEntityType=Dk.STATIC,this._dynamicDrawInfoArr=[],this._node=null,this._renderTransform=null,this._stencilStage=Rk.DISABLED,this._useLocal=!1,this._maskMode=Nk.NONE,this._color=pn.WHITE,this._localOpacity=255,this._colorDirty=!0,this._enabled=!1}var e=t.prototype;return e.addDynamicRenderDrawInfo=function(){},e.removeDynamicRenderDrawInfo=function(){},e.clearDynamicRenderDrawInfos=function(){},e.clearStaticRenderDrawInfos=function(){},e.setDynamicRenderDrawInfo=function(){},e.setMaskMode=function(t){this._maskMode=t},e.getStaticRenderDrawInfo=function(){return null},e.setNode=function(t){this._node=t},e.setRenderTransform=function(t){this._renderTransform=t},e.setStencilStage=function(t){this._stencilStage=t},e.setUseLocal=function(t){this._useLocal=t},e.initSharedBuffer=function(){},n(t,[{key:"nativeObj",get:function(){return this._nativeObj}},{key:"renderDrawInfoArr",get:function(){return this._dynamicDrawInfoArr}},{key:"renderEntityType",get:function(){return this._renderEntityType}},{key:"color",get:function(){return this._color},set:function(t){this._color=t}},{key:"localOpacity",get:function(){return this._localOpacity},set:function(t){this._localOpacity=t}},{key:"colorDirty",get:function(){return this._colorDirty},set:function(t){this._colorDirty=t}},{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled=t}}]),t}(),qk=yk(fk)>>2,Qk=t("r",function(){function t(t){void 0===t&&(t=fk),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=fk,this._drawInfoType=Ak.COMP,this._multiOwner=!1,this._batcher=null,this._floatStride=t===fk?qk:yk(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=Ak.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=gL.root.batcher2D),this._batcher}}]),t}()),Zk=t("t",function(t){function e(e,i){var n;return void 0===e&&(e=fk),(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=fk);var n=new e(t,i);return i||(i=gL.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=Bl(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=gL.root.device;return new Ok(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:pn.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}(Qk)),Jk=t("u",function(t){function e(e){var i;return void 0===e&&(e=fk),(i=t.call(this,e)||this)._isMeshBuffer=!0,i.vData=void 0,i.iData=void 0,i.vertexStart=0,i.vertexRange=0,i.indexStart=0,i.indexRange=0,i.lastFilledIndex=0,i.lastFilledVertex=0,i.frame=void 0,i._byteLength=0,i._vertexBuffers=[],i._indexBuffer=null,i._iaPool=null,i._iaInfo=null,i.vData=new Float32Array(256*i.stride),i.iData=new Uint16Array(1536),i}s(e,t),e.add=function(t){void 0===t&&(t=fk);var i=new e;return i._floatStride=t===fk?qk:yk(t)>>2,i._vertexFormat=t,i},e.remove=function(t){t.clear()};var i=e.prototype;return i.request=function(t,e){var i=this._byteLength+t*this.stride;return!!this.reserve(t,e)&&(this._vc+=t,this._ic+=e,this._byteLength=i,this.vertexRange=this._vc,this.indexRange=this._ic,!0)},i.reserve=function(t,e){var i=this._byteLength+t*this.stride,n=this.indexCount+e;if(t+this.vertexCount>65535)return!1;var r=this.vData.byteLength,s=this.iData.length,a=this.vData.length,o=this.iData.length;if(i>r||n>s){for(;r<i||s<n;)r=4*(a*=2),s=o*=2;this._reallocBuffer(a,o)}return!0},i.resize=function(t,e){var i=t*this.stride;t>=0&&e>=0&&i<=this.vData.byteLength&&this.iData.length,this._vc=t,this._ic=e,this._byteLength=i,this.updateRange(0,t,0,e)},i.updateRange=function(t,e,i,n){e>=0&&n>=0&&e<=this._vc&&this._ic,this.vertexStart=t,this.indexStart=i,this.vertexRange=e,this.indexRange=n},i.requestIA=function(t){this._initIAInfo(t);var e=this._iaPool.add();return e.firstIndex=this.indexStart,e.indexCount=this.indexRange,e},i.uploadBuffers=function(){if(0!==this._byteLength&&this._vertexBuffers[0]&&this._indexBuffer){var t=this._ic,e=new Float32Array(this.vData.buffer,0,this._byteLength>>2),i=new Uint16Array(this.iData.buffer,0,t),n=this._vertexBuffers[0];this._byteLength>n.size&&n.resize(this._byteLength),n.update(e);var r=t<<1;r>this._indexBuffer.size&&this._indexBuffer.resize(r),this._indexBuffer.update(i)}},i.freeIAPool=function(){this._iaPool&&this._iaPool.reset()},i.reset=function(){this._vc=0,this._ic=0,this._byteLength=0,this.vertexStart=0,this.vertexRange=0,this.indexStart=0,this.indexRange=0,this.lastFilledIndex=0,this.lastFilledVertex=0,this.material=null,this.freeIAPool()},i.clear=function(){this.reset(),this._iaPool&&this._iaPool.destroy(),this._vertexBuffers[0]&&(this._vertexBuffers[0].destroy(),this._vertexBuffers=[]),this._iaInfo=null,this.vData=new Float32Array(256*this.stride),this.iData=new Uint16Array(1536)},i._initIAInfo=function(t){var e=this;if(!this._iaInfo){var i=this.stride,n=this._vertexBuffers;n.length||n.push(t.createBuffer(new qc(ql.VERTEX|ql.TRANSFER_DST,Jl.DEVICE,i,i)));var r=Uint16Array.BYTES_PER_ELEMENT;this._indexBuffer||(this._indexBuffer=t.createBuffer(new qc(ql.INDEX|ql.TRANSFER_DST,Jl.DEVICE,r,r))),this._iaInfo=new f_(this._vertexFormat,n,this._indexBuffer),this._iaPool=new Bu((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}(Qk)),$k=new Fn,tU=new Fn,eU=new hn,iU=new Dn,nU=new Dn,rU=new Dn,sU=new Dn(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),aU=new Vn,oU=t("d",qs("cc.UITransform")(Fk=Zs(110)(Fk=Js(((Hk=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._priority=0,e._contentSize=Uk&&Uk(),e._anchorPoint=Gk&&Gk(),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(um.PARENT_CHANGED,this._parentChanged,this),this._markRenderDataDirty()},i.onDisable=function(){this.node.off(um.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(xi((t=t).width,r.width,Ci)&&xi(t.height,r.height,Ci))return;i=t.width,n=t.height}else{if(xi(t=t,r.width,Ci)&&xi(e,r.height,Ci))return;i=t,n=e}r.width=i,r.height=n,this.node.emit(um.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(um.ANCHOR_CHANGED,this._anchorPoint),this._markRenderDataDirty()},i.isHit=function(t){for(var e=this._contentSize.width,i=this._contentSize.height,n=$k,r=tU,s=this._getRenderScene().cameras,a=0;a<s.length;a++){var o=s[a];if(o.visibility&this.node.layer){o.node.getWorldRT(iU);var h=iU.m12,u=iU.m13,l=Dl.center;if(iU.m12=l.x-(iU.m00*h+iU.m04*u),iU.m13=l.y-(iU.m01*h+iU.m05*u),Dn.invert(iU,iU),Fn.transformMat4(n,t,iU),this.node.getWorldMatrix(rU),Dn.invert(iU,rU),!Dn.strictEquals(iU,sU)){Fn.transformMat4(r,n,iU),r.x+=this._anchorPoint.x*e,r.y+=this._anchorPoint.y*i;var c=!1;if(r.x>=0&&r.y>=0&&r.x<=e&&r.y<=i&&(c=this._maskTest(n)),c)return!0}}}return!1},i.hitTest=function(t,e){void 0===e&&(e=0);for(var i=this._contentSize.width,n=this._contentSize.height,r=eU,s=$k,a=tU,o=this._getRenderScene().cameras,h=0;h<o.length;h++){var u=o[h];if(u.visibility&this.node.layer&&(!u.window||u.window.swapchain)&&u.systemWindowId===e&&(hn.set(r,t.x,t.y,0),u.screenToWorld(r,r),Fn.set(s,r.x,r.y),this.node.getWorldMatrix(rU),Dn.invert(iU,rU),!Dn.strictEquals(iU,sU))){Fn.transformMat4(a,s,iU),a.x+=this._anchorPoint.x*i,a.y+=this._anchorPoint.y*n;var l=!1;if(a.x>=0&&a.y>=0&&a.x<=i&&a.y<=n&&(l=this._maskTest(s)),l)return!0}}return!1},i._maskTest=function(t){var e,i,n=null===(e=this.node)||void 0===e||null===(i=e.eventProcessor)||void 0===i?void 0:i.maskList;if(n)for(var r=this.node,s=n.length,a=0,o=0;r&&o<s;++a,r=r.parent){var h=n[o];if(a===h.index){if(r!==h.comp.node){n.length=o;break}var u=h.comp;if(u&&u._enabled&&!u.isHit(t))return!1;o++}else if(a>h.index){n.length=o;break}}return!0},i.convertToNodeSpaceAR=function(t,e){return this.node.getWorldMatrix(rU),Dn.invert(iU,rU),e||(e=new hn),hn.transformMat4(e,t,iU)},i.convertToWorldSpaceAR=function(t,e){return this.node.getWorldMatrix(rU),e||(e=new hn),hn.transformMat4(e,t,rU)},i.getBoundingBox=function(){var t=new Vn;return this._selfBoundingBox(t),Dn.fromSRT(nU,this.node.rotation,this.node.position,this.node.scale),t.transformMat4(nU),t},i.getBoundingBoxToWorld=function(){for(var t=new Vn,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(aU),aU.transformMat4(r.worldMatrix),0===t.width?t.set(aU):Vn.union(t,t,aU))}}return this._contentSize.width&&this._contentSize.height&&(this._selfBoundingBox(aU),aU.transformMat4(this.node.worldMatrix),0===t.width?t.set(aU):Vn.union(t,t,aU)),t},i.getBoundingBoxTo=function(t){var i=new Vn,n=this.node.children;Dn.invert(iU,t);for(var r=0;r<n.length;++r){var s=n[r];if(s&&s.active){var a=s.getComponent(e);a&&a.contentSize.width&&a.contentSize.height&&(a._selfBoundingBox(aU),Dn.multiply(nU,s.worldMatrix,iU),aU.transformMat4(nU),0===i.width?i.set(aU):Vn.union(i,i,aU))}}return this._contentSize.width&&this._contentSize.height&&(this._selfBoundingBox(aU),Dn.multiply(nU,this.node.worldMatrix,iU),aU.transformMat4(nU),0===i.width?i.set(aU):Vn.union(i,i,aU)),i},i.getComputeAABB=function(t){var e=this._contentSize.width,i=this._contentSize.height;aU.set(-this._anchorPoint.x*e,-this._anchorPoint.y*i,e,i),aU.transformMat4(this.node.worldMatrix);var n=aU.x+.5*aU.width,r=aU.y+.5*aU.height,s=this.node.worldPosition.z,a=aU.width/2,o=aU.height/2;return null!=t?(Es.set(t,n,r,s,a,o,.001),t):new Es(n,r,s,a,o,.001)},i._selfBoundingBox=function(t){var e=this._contentSize.width,i=this._contentSize.height;return t.set(-this._anchorPoint.x*e,-this._anchorPoint.y*i,e,i),t},i._parentChanged=function(){this.node.getComponent("cc.RenderRoot2D")||this.node.parent&&e.insertChangeMap(this.node.parent)},i._markRenderDataDirty=function(){var t=this.node._uiProps.uiComp;t&&t.markForUpdateRenderData()},e.insertChangeMap=function(t){var i=t.uuid;e.priorityChangeNodeMap.has(i)||e.priorityChangeNodeMap.set(i,t)},e._sortChildrenSibling=function(t){var e=t.children;e&&e.sort((function(t,e){var i=t._uiProps.uiTransformComp,n=e._uiProps.uiTransformComp,r=(i?i._priority:0)-(n?n._priority:0);return 0===r?t.getSiblingIndex()-e.getSiblingIndex():r}))},e._sortSiblings=function(){e.priorityChangeNodeMap.forEach((function(t){e._sortChildrenSibling(t),t._updateSiblingIndex(),t.emit("childrenSiblingOrderChanged")})),e.priorityChangeNodeMap.clear()},e._cleanChangeMap=function(){e.priorityChangeNodeMap.clear()},n(e,[{key:"contentSize",get:function(){return this._contentSize},set:function(t){this._contentSize.equals(t)||(this._contentSize.set(t),this.node.emit(um.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(um.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(um.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(um.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(um.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(um.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=gL.root.batcher2D.getFirstRenderCamera(this.node);return t?t.visibility:0}},{key:"cameraPriority",get:function(){var t=gL.root.batcher2D.getFirstRenderCamera(this.node);return t?t.priority:0}}]),e}(op)).EventType=um,Hk.priorityChangeNodeMap=new Map,Uk=Gs((kk=Hk).prototype,"_contentSize",[ra],(function(){return new Hn(100,100)})),Gk=Gs(kk.prototype,"_anchorPoint",[ra],(function(){return new Fn(.5,.5)})),Fk=kk))||Fk)||Fk)||Fk);gL.on(mL.EVENT_AFTER_UPDATE,oU._sortSiblings),gL.on(mL.EVENT_BEFORE_SCENE_LAUNCH,oU._cleanChangeMap);var hU,uU,lU,cU,_U,dU,fU,pU,mU,gU,vU,yU,TU,SU={parent:null,owner:null,subModelIdx:0},EU=Js,AU=xa,RU=t("dZ",(zk=qs("cc.Renderer"),Vk=AU(OS),Wk=AU([OS]),zk(Xk=EU((f((jk=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._materials=Yk&&Yk(),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 US&&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]){SU.parent=this._materials[t],SU.owner=this,SU.subModelIdx=t;var e=new US(SU);SU.parent=null,SU.owner=null,SU.subModelIdx=0,this.setMaterialInstance(e,t)}return this._materialInstances[t]},i.setMaterialInstance=function(t,e){if("number"==typeof t){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}(op)).prototype,"sharedMaterials",[Vk],Object.getOwnPropertyDescriptor(jk.prototype,"sharedMaterials"),jk.prototype),Yk=Gs(jk.prototype,"_materials",[Wk],(function(){return[]})),Xk=jk))||Xk)||Xk));Se(uc),Se(lc),Se(cc),t("I",TU),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"}(TU||t("I",TU={}));var bU=t("c",(hU=qs("cc.UIRenderer"),uU=Qs(oU),lU=xa(OS),cU=xa(OS),hU(_U=uU(((yU=function(t){function e(){var e;return(e=t.call(this)||this)._renderData=null,e._materials=fU&&fU(),e._customMaterial=pU&&pU(),e._srcBlendFactor=mU&&mU(),e._dstBlendFactor=gU&&gU(),e._color=vU&&vU(),e._stencilStage=Rk.DISABLED,e._assembler=null,e._postAssembler=null,e._renderDataFlag=!0,e._renderFlag=!0,e._renderEntity=void 0,e._instanceMaterialType=-1,e._srcBlendFactorCache=uc.SRC_ALPHA,e._dstBlendFactorCache=uc.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(um.ANCHOR_CHANGED,this._nodeStateChange,this),this.node.on(um.SIZE_CHANGED,this._nodeStateChange,this),this.node.on(um.PARENT_CHANGED,this._colorDirty,this),this.updateMaterial(),this._colorDirty(),aL.addRenderer(this),this.markForUpdateRenderData()},i.onRestore=function(){this.updateMaterial(),this.markForUpdateRenderData()},i.onDisable=function(){this.node.off(um.ANCHOR_CHANGED,this._nodeStateChange,this),this.node.off(um.SIZE_CHANGED,this._nodeStateChange,this),this.node.off(um.PARENT_CHANGED,this._colorDirty,this),aL.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),aL.markDirtyRenderer(this)}},i.requestRenderData=function(t){void 0===t&&(t=Ak.COMP);var e=Zk.add();return e.initRenderDrawInfo(this,t),this._renderData=e,e},i.destroyRenderData=function(){this._renderData&&(this._renderData.removeRenderDrawInfo(this),Zk.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!==Rk.ENTER_LEVEL&&this.stencilStage!==Rk.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=uc.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 TU.ADD_COLOR:t=aS.get("ui-base-material");break;case TU.GRAYSCALE:t=aS.get("ui-sprite-gray-material");break;case TU.USE_ALPHA_SEPARATED:t=aS.get("ui-sprite-alpha-sep-material");break;case TU.USE_ALPHA_SEPARATED_AND_GRAY:t=aS.get("ui-sprite-gray-alpha-sep-material");break;default:t=aS.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 Kk(Dk.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 gL.root.batcher2D}},{key:"renderEntity",get:function(){return this._renderEntity}}]),e}(RU)).BlendState=uc,yU.Assembler=null,yU.PostAssembler=null,f((dU=yU).prototype,"sharedMaterials",[Ia],Object.getOwnPropertyDescriptor(dU.prototype,"sharedMaterials"),dU.prototype),f(dU.prototype,"customMaterial",[lU],Object.getOwnPropertyDescriptor(dU.prototype,"customMaterial"),dU.prototype),fU=Gs(dU.prototype,"_materials",[Ia],(function(){return[]})),pU=Gs(dU.prototype,"_customMaterial",[cU],(function(){return null})),mU=Gs(dU.prototype,"_srcBlendFactor",[ra],(function(){return uc.SRC_ALPHA})),gU=Gs(dU.prototype,"_dstBlendFactor",[ra],(function(){return uc.ONE_MINUS_SRC_ALPHA})),vU=Gs(dU.prototype,"_color",[ra],(function(){return pn.WHITE.clone()})),_U=dU))||_U)||_U));v.internal.UIRenderer=bU;var CU,wU,xU,IU,OU,DU,MU,PU,BU,NU,LU,FU,kU,UU,GU,HU,zU,VU,WU,XU,jU,YU,KU,qU,QU,ZU,JU,$U,tG,eG,iG,nG,rG,sG,aG,oG,hG,uG,lG=function(){function t(){this.isBold=!1,this.isItalic=!1,this.isUnderline=!1,this.underlineHeight=1,this.isOutlined=!1,this.outlineColor=pn.WHITE.clone(),this.outlineWidth=1,this.hasShadow=!1,this.shadowColor=pn.BLACK.clone(),this.shadowBlur=2,this.shadowOffsetX=0,this.shadowOffsetY=0,this.color=pn.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}(),cG=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 Hn,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}(),_G=function(){function t(){this.parsedString=[],this.nodeContentSize=Hn.ZERO.clone(),this.canvasSize=new Hn,this.canvasPadding=new Vn,this.contentSizeExtend=Hn.ZERO.clone(),this.startPosition=Fn.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}(),dG=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}();pn.WHITE.clone(),t("H",aG),function(t){t[t.LEFT=0]="LEFT",t[t.CENTER=1]="CENTER",t[t.RIGHT=2]="RIGHT"}(aG||t("H",aG={})),Se(aG),t("V",oG),function(t){t[t.TOP=0]="TOP",t[t.CENTER=1]="CENTER",t[t.BOTTOM=2]="BOTTOM"}(oG||t("V",oG={})),Se(oG),t("O",hG),function(t){t[t.NONE=0]="NONE",t[t.CLAMP=1]="CLAMP",t[t.SHRINK=2]="SHRINK",t[t.RESIZE_HEIGHT=3]="RESIZE_HEIGHT"}(hG||t("O",hG={})),Se(hG),t("p",uG),function(t){t[t.NONE=0]="NONE",t[t.BITMAP=1]="BITMAP",t[t.CHAR=2]="CHAR"}(uG||t("p",uG={})),Se(uG);var fG=t("q",(CU=qs("cc.Label"),wU=Zs(110),xU=xa(aG),IU=xa(oG),OU=xa(hG),DU=xa(bF),MU=xa(uG),CU(PU=wU(((sG=function(t){function e(){var e;return(e=t.call(this)||this)._string=NU&&NU(),e._horizontalAlign=LU&&LU(),e._verticalAlign=FU&&FU(),e._actualFontSize=kU&&kU(),e._fontSize=UU&&UU(),e._fontFamily=GU&&GU(),e._lineHeight=HU&&HU(),e._overflow=zU&&zU(),e._enableWrapText=VU&&VU(),e._font=WU&&WU(),e._isSystemFontUsed=XU&&XU(),e._spacingX=jU&&jU(),e._isItalic=YU&&YU(),e._isBold=KU&&KU(),e._isUnderline=qU&&qU(),e._underlineHeight=QU&&QU(),e._cacheMode=ZU&&ZU(),e._enableOutline=JU&&JU(),e._outlineColor=$U&&$U(),e._outlineWidth=tG&&tG(),e._enableShadow=eG&&eG(),e._shadowColor=iG&&iG(),e._shadowOffset=nG&&nG(),e._shadowBlur=rG&&rG(),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 lG,e._textLayout=new cG,e._textLayoutData=new _G,e._textRenderData=new dG,e}s(e,t);var i=e.prototype;return i.onEnable=function(){t.prototype.onEnable.call(this),this._font||this._isSystemFontUsed||(this.useSystemFont=!0),this._isSystemFontUsed&&!this._fontFamily&&(this.fontFamily="Arial"),this._applyFontTexture()},i.onDestroy=function(){if(this._assembler&&this._assembler.resetAssemblerData&&this._assembler.resetAssemblerData(this._assemblerData),this._assemblerData=null,this._ttfSpriteFrame){this._ttfSpriteFrame._resetDynamicAtlasFrame();var e=this._ttfSpriteFrame.texture;if(this._ttfSpriteFrame.destroy(),e){var i=e;i.image&&i.image.destroy(),e.destroy()}this._ttfSpriteFrame=null}this._letterTexture=null,t.prototype.onDestroy.call(this)},i.updateRenderData=function(t){void 0===t&&(t=!1),t&&(this._flushAssembler(),this.renderData&&(this.renderData.vertDirty=!0),this._applyFontTexture()),this._assembler&&this._assembler.updateRenderData(this)},i._render=function(t){t.commitComp(this,this.renderData,this._texture,this._assembler,null)},i._updateColor=function(){t.prototype._updateColor.call(this),this.markForUpdateRenderData()},i.setEntityColor=function(){},i._canRender=function(){if(!t.prototype._canRender.call(this)||!this._string)return!1;var e=this._font;if(e&&e instanceof kF){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 kF){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===uG.CHAR)this._letterTexture=this._assembler.getAssemblerData(),this._texture=this._letterTexture;else if(!this._ttfSpriteFrame){this._ttfSpriteFrame=new yF,this._assemblerData=this._assembler.getAssemblerData();var i=new Df(this._assemblerData.canvas),n=new em;n.image=i,this._ttfSpriteFrame.texture=n}this.cacheMode!==uG.CHAR&&(this._texture=this._ttfSpriteFrame),this.changeMaterialForDefine()}},i.changeMaterialForDefine=function(){if(this._texture){var t=!1;if(this.cacheMode!==uG.CHAR){var e=this._texture.texture;if(e instanceof Lf){var i=e.getPixelFormat();t=i===lf.RGBA_ETC1||i===lf.RGB_A_PVRTC_4BPPV1||i===lf.RGB_A_PVRTC_2BPPV1}}this._instanceMaterialType=t?TU.USE_ALPHA_SEPARATED:TU.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!==uG.BITMAP||this._font instanceof kF||!this._ttfSpriteFrame||this._ttfSpriteFrame._resetDynamicAtlasFrame(),this._cacheMode===uG.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 kF?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}(bU)).HorizontalAlign=aG,sG.VerticalAlign=oG,sG.Overflow=hG,sG.CacheMode=uG,sG._canvasPool=rk.getInstance(),f((BU=sG).prototype,"horizontalAlign",[xU],Object.getOwnPropertyDescriptor(BU.prototype,"horizontalAlign"),BU.prototype),f(BU.prototype,"verticalAlign",[IU],Object.getOwnPropertyDescriptor(BU.prototype,"verticalAlign"),BU.prototype),f(BU.prototype,"overflow",[OU],Object.getOwnPropertyDescriptor(BU.prototype,"overflow"),BU.prototype),f(BU.prototype,"font",[DU],Object.getOwnPropertyDescriptor(BU.prototype,"font"),BU.prototype),f(BU.prototype,"cacheMode",[MU],Object.getOwnPropertyDescriptor(BU.prototype,"cacheMode"),BU.prototype),NU=Gs(BU.prototype,"_string",[ra],(function(){return"label"})),LU=Gs(BU.prototype,"_horizontalAlign",[ra],(function(){return aG.CENTER})),FU=Gs(BU.prototype,"_verticalAlign",[ra],(function(){return oG.CENTER})),kU=Gs(BU.prototype,"_actualFontSize",[ra],(function(){return 0})),UU=Gs(BU.prototype,"_fontSize",[ra],(function(){return 40})),GU=Gs(BU.prototype,"_fontFamily",[ra],(function(){return"Arial"})),HU=Gs(BU.prototype,"_lineHeight",[ra],(function(){return 40})),zU=Gs(BU.prototype,"_overflow",[ra],(function(){return hG.NONE})),VU=Gs(BU.prototype,"_enableWrapText",[ra],(function(){return!0})),WU=Gs(BU.prototype,"_font",[ra],(function(){return null})),XU=Gs(BU.prototype,"_isSystemFontUsed",[ra],(function(){return!0})),jU=Gs(BU.prototype,"_spacingX",[ra],(function(){return 0})),YU=Gs(BU.prototype,"_isItalic",[ra],(function(){return!1})),KU=Gs(BU.prototype,"_isBold",[ra],(function(){return!1})),qU=Gs(BU.prototype,"_isUnderline",[ra],(function(){return!1})),QU=Gs(BU.prototype,"_underlineHeight",[ra],(function(){return 2})),ZU=Gs(BU.prototype,"_cacheMode",[ra],(function(){return uG.NONE})),JU=Gs(BU.prototype,"_enableOutline",[ra],(function(){return!1})),$U=Gs(BU.prototype,"_outlineColor",[ra],(function(){return new pn(0,0,0,255)})),tG=Gs(BU.prototype,"_outlineWidth",[ra],(function(){return 2})),eG=Gs(BU.prototype,"_enableShadow",[ra],(function(){return!1})),iG=Gs(BU.prototype,"_shadowColor",[ra],(function(){return new pn(0,0,0,255)})),nG=Gs(BU.prototype,"_shadowOffset",[ra],(function(){return new Fn(2,2)})),rG=Gs(BU.prototype,"_shadowBlur",[ra],(function(){return 2})),PU=BU))||PU)||PU));v.Label=fG;var pG,mG,gG=0,vG={};function yG(t){return--t,t|=t>>16,t|=t>>8,t|=t>>4,t|=t>>2,t|=t>>1,++t}function TG(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"}(pG||(pG={})),function(t){t[t.DEFAULT=1]="DEFAULT",t[t.FORWARD=2]="FORWARD",t[t.SHADOWCAST=4]="SHADOWCAST"}(mG||(mG={}));var SG,EG,AG,RG,bG,CG,wG,xG,IG,OG=function(){function t(t){this._device=void 0,this._format=jl.UNKNOWN,this._formatSize=0,this._chunks=[],this._chunkCount=0,this._handles=[],this._region0=new Vc,this._region1=new Vc,this._region2=new Vc,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=F_[t.format];this._format=t.format,this._formatSize=e.size,this._channels=e.count,this._bufferViewCtor=j_(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=TG(t,this._alignment);var i=-1,n=-1;if(void 0!==e&&(i=e,n=this._findAvailableSpace(t,i)),n<0)for(var r=0;r<this._chunkCount&&(i=r,!((n=this._findAvailableSpace(t,i))>=0));++r);if(n>=0){var s=this._chunks[i];s.start+=t;var a={chunkIdx:i,start:n,end:n+t,texture:s.texture};return this._handles.push(a),a}var o=Math.sqrt(t/this._formatSize),h=this._roundUpFn&&this._roundUpFn(o,this._formatSize)||Math.max(1024,yG(o)),u=this._chunks[this.createChunk(h)];u.start+=t;var l={chunkIdx:this._chunkCount-1,start:0,end:t,texture:u.texture};return this._handles.push(l),l},e.free=function(t){for(var e=0;e<this._handles.length;++e)if(this._handles[e]===t)return this._chunks[t.chunkIdx].end=t.end,void this._handles.splice(e,1)},e.createChunk=function(t){var e=t*t*this._formatSize;z("TextureBufferPool: Allocate chunk "+this._chunkCount+", size: "+e+", format: "+this._format);var i={texture:this._device.createTexture(new t_($l.TEX2D,tc.SAMPLED|tc.TRANSFER_DST,this._format,t,t)),size:e,start:0,end:e};return this._chunks[this._chunkCount]=i,this._chunkCount++},e.update=function(t,e){var i=[],n=[],r=t.start/this._formatSize,s=e.byteLength/this._formatSize,a=r%t.texture.width,o=Math.floor(r/t.texture.width),h=Math.min(t.texture.width-a,s),u=0;a>0&&(this._region0.texOffset.x=a,this._region0.texOffset.y=o,this._region0.texExtent.width=h,this._region0.texExtent.height=1,i.push(new this._bufferViewCtor(e,u*this._formatSize,h*this._channels)),n.push(this._region0),a=0,o+=1,s-=h,u+=h),s>0&&(this._region1.texOffset.x=a,this._region1.texOffset.y=o,s>t.texture.width?(this._region1.texExtent.width=t.texture.width,this._region1.texExtent.height=Math.floor(s/t.texture.width),h=this._region1.texExtent.width*this._region1.texExtent.height):(h=s,this._region1.texExtent.width=h,this._region1.texExtent.height=1),i.push(new this._bufferViewCtor(e,u*this._formatSize,h*this._channels)),n.push(this._region1),a=0,o+=this._region1.texExtent.height,s-=h,u+=h),s>0&&(this._region2.texOffset.x=a,this._region2.texOffset.y=o,this._region2.texExtent.width=s,this._region2.texExtent.height=1,i.push(new this._bufferViewCtor(e,u*this._formatSize,s*this._channels)),n.push(this._region2)),this._device.copyBuffersToTexture(i,t.texture,n)},e._findAvailableSpace=function(t,e){var i=this._chunks[e],n=!1,r=i.start;if(r+t<=i.size)n=!0;else{r=0;for(var s=this._handles.filter((function(t){return t.chunkIdx===e})).sort((function(t,e){return t.start-e.start})),a=0;a<s.length;a++){var o=s[a];if(r+t<=o.start){n=!0;break}r=o.end}!n&&r+t<=i.size&&(n=!0)}return n?r:-1},e._McDonaldAlloc=function(t){t=TG(t,this._alignment);for(var e=0;e<this._chunkCount;++e){var i=this._chunks[e],n=!1,r=i.start;if(r+t<=i.end?n=!0:r>i.end?r+t<=i.size?n=!0:t<=i.end&&(i.start=r=0,n=!0):r===i.end&&(i.start=r=0,i.end=i.size,t<=i.end&&(n=!0)),n){i.start+=t;var s={chunkIdx:e,start:r,end:r+t,texture:i.texture};return this._handles.push(s),s}}var a=Math.sqrt(t/this._formatSize),o=this._roundUpFn&&this._roundUpFn(a,this._formatSize)||Math.max(1024,yG(a)),h=this._chunks[this.createChunk(o)];h.start+=t;var u={chunkIdx:this._chunkCount,start:0,end:t,texture:h.texture};return this._handles.push(u),u},t}(),DG=function(){function t(t,e,i){this._arrayBuffers=[],this._chunkSize=void 0,this._chunkSize=i*(1<<e)}return t.prototype.allocateNewChunk=function(){return new ArrayBuffer(this._chunkSize)},t}();!function(t){t[t.UINT32=0]="UINT32",t[t.FLOAT32=1]="FLOAT32",t[t.NEVER=2]="NEVER"}(IG||(IG={}));var MG,PG,BG=function(){function t(t,e,i,n,r){void 0===r&&(r=8),this._dataType=void 0,this._dataMembers=void 0,this._elementCount=void 0,this._entryBits=void 0,this._stride=void 0,this._entriesPerChunk=void 0,this._entryMask=void 0,this._chunkMask=void 0,this._poolFlag=void 0,this._arrayBuffers=[],this._freeLists=[],this._uint32BufferViews=[],this._float32BufferViews=[],this._hasUint32=!1,this._hasFloat32=!1,this._nativePool=void 0,this._elementCount=n.COUNT,this._entryBits=r,this._dataType=e,this._dataMembers=i,this._stride=4*this._elementCount,this._entriesPerChunk=1<<r,this._entryMask=this._entriesPerChunk-1,this._poolFlag=1<<30,this._chunkMask=~(this._entryMask|this._poolFlag),this._nativePool=new DG(t,r,this._stride);var s=IG.NEVER,a=!1,o=!1;for(var h in e){if(a=this._hasFloat32,(o=this._hasUint32)&&a)break;s=e[h],a||s!==IG.FLOAT32?o||s!==IG.UINT32||(this._hasUint32=!0):this._hasFloat32=!0}}var e=t.prototype;return e.alloc=function(){for(var t=0;t<this._freeLists.length;t++){var e=this._freeLists[t];if(e.length){var i=e[e.length-1];return e.length--,(t<<this._entryBits)+i+this._poolFlag}}for(var n=this._nativePool.allocateNewChunk(),r=[],s=[],a=[],o=this._hasFloat32,h=this._hasUint32,u=0;u<this._entriesPerChunk;u++)o&&r.push(new Float32Array(n,this._stride*u,this._elementCount)),h&&s.push(new Uint32Array(n,this._stride*u,this._elementCount)),u&&a.push(u);return h&&this._uint32BufferViews.push(s),o&&this._float32BufferViews.push(r),this._freeLists.push(a),this._arrayBuffers.push(n),(t<<this._entryBits)+this._poolFlag},e.getBuffer=function(t){var e=(this._chunkMask&t)>>this._entryBits,i=this._entryMask&t;return(this._hasFloat32?this._float32BufferViews:this._uint32BufferViews)[e][i]},e.getTypedArray=function(t,e){var i=(this._chunkMask&t)>>this._entryBits,n=this._entryMask&t,r=e,s=(this._dataType[e]===IG.UINT32?this._uint32BufferViews:this._float32BufferViews)[i][n],a=this._dataMembers[e];return s.subarray(r,r+a)},e.free=function(t){var e=(this._chunkMask&t)>>this._entryBits,i=this._entryMask&t;(this._hasUint32?this._uint32BufferViews:this._float32BufferViews)[e][i].fill(0),this._freeLists[e].push(i)},t}();!function(t){t[t.NODE=0]="NODE",t[t.PASS=1]="PASS",t[t.AABB=2]="AABB",t[t.RENDER2D=3]="RENDER2D"}(MG||(MG={})),function(t){t[t.POSITION=0]="POSITION",t[t.UV=3]="UV",t[t.COLOR=5]="COLOR",t[t.COUNT=9]="COUNT"}(PG||(PG={}));var NG,LG=((SG={})[PG.POSITION]=IG.FLOAT32,SG[PG.UV]=IG.FLOAT32,SG[PG.COLOR]=IG.UINT32,SG[PG.COUNT]=IG.NEVER,SG),FG=((EG={})[PG.POSITION]=PG.UV-PG.POSITION,EG[PG.UV]=PG.COLOR-PG.UV,EG[PG.COLOR]=PG.COUNT-PG.COLOR,EG[PG.COUNT]=1,EG),kG=new BG(MG.RENDER2D,LG,FG,PG);!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"}(NG||(NG={}));var UG,GG=((AG={})[NG.DIRTY_FLAG]=IG.UINT32,AG[NG.LAYER]=IG.UINT32,AG[NG.WORLD_SCALE]=IG.FLOAT32,AG[NG.WORLD_POSITION]=IG.FLOAT32,AG[NG.WORLD_ROTATION]=IG.FLOAT32,AG[NG.WORLD_MATRIX]=IG.FLOAT32,AG[NG.LOCAL_SCALE]=IG.FLOAT32,AG[NG.LOCAL_POSITION]=IG.FLOAT32,AG[NG.LOCAL_ROTATION]=IG.FLOAT32,AG[NG.COUNT]=IG.NEVER,AG),HG=((RG={})[NG.DIRTY_FLAG]=NG.LAYER-NG.DIRTY_FLAG,RG[NG.LAYER]=NG.WORLD_SCALE-NG.LAYER,RG[NG.WORLD_SCALE]=NG.WORLD_POSITION-NG.WORLD_SCALE,RG[NG.WORLD_POSITION]=NG.WORLD_ROTATION-NG.WORLD_POSITION,RG[NG.WORLD_ROTATION]=NG.WORLD_MATRIX-NG.WORLD_ROTATION,RG[NG.WORLD_MATRIX]=NG.LOCAL_SCALE-NG.WORLD_MATRIX,RG[NG.LOCAL_SCALE]=NG.LOCAL_POSITION-NG.LOCAL_SCALE,RG[NG.LOCAL_POSITION]=NG.LOCAL_ROTATION-NG.LOCAL_POSITION,RG[NG.LOCAL_ROTATION]=NG.COUNT-NG.LOCAL_ROTATION,RG[NG.COUNT]=1,RG),zG=new BG(MG.NODE,GG,HG,NG);!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"}(UG||(UG={}));var VG,WG=((bG={})[UG.PRIORITY]=IG.UINT32,bG[UG.STAGE]=IG.UINT32,bG[UG.PHASE]=IG.UINT32,bG[UG.PRIMITIVE]=IG.UINT32,bG[UG.BATCHING_SCHEME]=IG.UINT32,bG[UG.DYNAMIC_STATE]=IG.UINT32,bG[UG.HASH]=IG.UINT32,bG[UG.COUNT]=IG.NEVER,bG),XG=((CG={})[UG.PRIORITY]=UG.STAGE-UG.PRIORITY,CG[UG.STAGE]=UG.PHASE-UG.STAGE,CG[UG.PHASE]=UG.PRIMITIVE-UG.PHASE,CG[UG.PRIMITIVE]=UG.BATCHING_SCHEME-UG.PRIMITIVE,CG[UG.BATCHING_SCHEME]=UG.DYNAMIC_STATE-UG.BATCHING_SCHEME,CG[UG.DYNAMIC_STATE]=UG.HASH-UG.DYNAMIC_STATE,CG[UG.HASH]=UG.COUNT-UG.HASH,CG[UG.COUNT]=1,CG),jG=new BG(MG.PASS,WG,XG,UG);!function(t){t[t.CENTER=0]="CENTER",t[t.HALFEXTENTS=3]="HALFEXTENTS",t[t.COUNT=6]="COUNT"}(VG||(VG={}));var YG=((wG={})[VG.CENTER]=IG.FLOAT32,wG[VG.HALFEXTENTS]=IG.FLOAT32,wG[VG.COUNT]=IG.NEVER,wG),KG=((xG={})[VG.CENTER]=VG.HALFEXTENTS-VG.CENTER,xG[VG.HALFEXTENTS]=VG.COUNT-VG.HALFEXTENTS,xG[VG.COUNT]=1,xG),qG=new BG(MG.AABB,YG,KG,VG);st(YB.prototype,"RenderScene.prototype",[{name:"raycastUI2DNode"},{name:"raycastUINode"}]),st(YB.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(IB.prototype,"Model.prototype",[{name:"isInstancingEnabled"},{name:"instancedAttributes"}]);var QG={};st(QG,"CameraVisFlags",[{name:"GENERAL"}]),rt(QG,"CameraVisFlags",[{name:"PROFILER",newName:"PROFILER",target:sm.BitMask,targetName:"PROFILER"},{name:"GIZMOS",newName:"GIZMOS",target:sm.BitMask,targetName:"GIZMOS"},{name:"EDITOR",newName:"EDITOR",target:sm.BitMask,targetName:"EDITOR"},{name:"UI",newName:"UI",target:sm.BitMask,targetName:"UI_3D"},{name:"UI2D",newName:"UI2D",target:sm.BitMask,targetName:"UI_2D"}]),v.CameraVisFlags=QG;var ZG={};st(ZG,"VisibilityFlags",[{name:"GENERAL"}]),rt(ZG,"VisibilityFlags",[{name:"ALWALS",newName:"ALWALS",target:sm.Enum,targetName:"ALWALS"},{name:"PROFILER",newName:"PROFILER",target:sm.Enum,targetName:"PROFILER"},{name:"GIZMOS",newName:"GIZMOS",target:sm.Enum,targetName:"GIZMOS"},{name:"EDITOR",newName:"EDITOR",target:sm.Enum,targetName:"EDITOR"},{name:"UI",newName:"UI",target:sm.Enum,targetName:"UI_3D"},{name:"UI2D",newName:"UI2D",target:sm.Enum,targetName:"UI_2D"}]),v.VisibilityFlags=ZG,rt(_S.prototype,"Pass.prototype",[{name:"getBindingTypeFromHandle",newName:"getDescriptorTypeFromHandle"}]),st(jw.prototype,"Camera.prototype",[{name:"getSplitFrustum"},{name:"setMatView"},{name:"setMatViewInv"},{name:"setMatProjInv"},{name:"setMatViewProjInv"},{name:"setMatProj"},{name:"setMatViewProj"},{name:"getMatViewInv"}]),st(FS.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(GB.prototype,"SpotLight.prototype",[{name:"aspect"}]),rt(pB.prototype,"SubModel.prototype",[{name:"subMeshData",newName:"subMesh"}]),st(pB.prototype,"SubModel.prototype",[{name:"getSubModel",suggest:"Use `subModels[i]` instead"},{name:"subModelNum",suggest:"Use `subModels.length` instead"}]);var JG,$G,tH,eH=function(t){if(void 0===vG[t]){var e=1<<gG;vG[t]=e,gG+=1}},iH=Object.freeze({__proto__:null,addStage:eH,scene:jB,createIA:function(t,e){if(!e.positions)return console.error("The data must have positions field"),null;for(var i=[],n=e.positions.length/3,r=0;r<n;++r)i.push(e.positions[3*r],e.positions[3*r+1],e.positions[3*r+2]),e.normals&&i.push(e.normals[3*r],e.normals[3*r+1],e.normals[3*r+2]),e.uvs&&i.push(e.uvs[2*r],e.uvs[2*r+1]),e.colors&&i.push(e.colors[3*r],e.colors[3*r+1],e.colors[3*r+2]);var s=[];s.push(new __(Mc.ATTR_POSITION,jl.RGB32F)),e.normals&&s.push(new __(Mc.ATTR_NORMAL,jl.RGB32F)),e.uvs&&s.push(new __(Mc.ATTR_TEX_COORD,jl.RG32F)),e.colors&&s.push(new __(Mc.ATTR_COLOR,jl.RGB32F));var a=t.createBuffer(new qc(ql.VERTEX|ql.TRANSFER_DST,Jl.DEVICE,4*i.length,4*i.length/n));a.update(new Float32Array(i));var o=null;return e.indices&&(o=t.createBuffer(new qc(ql.INDEX|ql.TRANSFER_DST,Jl.DEVICE,2*e.indices.length,2))).update(new Uint16Array(e.indices)),t.createInputAssembler(new f_(s,[a],o))},programLib:Ny,getDeviceShaderVersion:wy,get RenderQueue(){return pG},get PassStage(){return mG},genHandle:oy,getTypeFromHandle:hy,getBindingFromHandle:uy,getCountFromHandle:ly,getOffsetFromHandle:cy,customizeType:_y,type2reader:dy,type2writer:fy,type2validator:py,getDefaultFromType:gy,getStringFromType:vy,overrideMacros:yy,get BatchingSchemes(){return rS},Pass:_S,nearestPOT:yG,TextureBufferPool:OG,MaterialInstance:US,PassInstance:kS,get PoolType(){return MG},NULL_HANDLE:0,get Render2dView(){return PG},Render2dPool:kG,get NodeView(){return NG},NodePool:zG,get PassView(){return UG},PassPool:jG,get AABBView(){return VG},AABBPool:qG,RenderScene:YB,CameraVisFlags:QG,VisibilityFlags:ZG});t("aC",iH),function(t){t[t.BUTT=0]="BUTT",t[t.ROUND=1]="ROUND",t[t.SQUARE=2]="SQUARE"}(JG||(JG={})),Se(JG),function(t){t[t.BEVEL=0]="BEVEL",t[t.ROUND=1]="ROUND",t[t.MITER=2]="MITER"}($G||($G={})),Se($G),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"}(tH||(tH={})),Se(tH);var nH=Math.PI,rH=Math.min,sH=Math.max,aH=Math.cos,oH=Math.sin,hH=Math.abs,uH=Math.sign,lH=.5522847493;function cH(t,e,i,n,r){t.moveTo(e-n,i),t.bezierCurveTo(e-n,i+r*lH,e-n*lH,i+r,e,i+r),t.bezierCurveTo(e+n*lH,i+r,e+n,i+r*lH,e+n,i),t.bezierCurveTo(e+n,i-r*lH,e+n*lH,i-r,e,i-r),t.bezierCurveTo(e-n*lH,i-r,e-n,i-r*lH,e-n,i),t.close()}function _H(t,e,i,n,r,s,a,o,h,u,l){var c,_,d,f,p,m,g,v,y,T,S,E,A,R,b,C;u>10||(p=.5*(s+o),m=.5*(a+h),g=.5*((c=.5*(e+n))+(d=.5*(n+s))),v=.5*((_=.5*(i+r))+(f=.5*(r+a))),((b=hH((n-o)*(R=h-i)-(r-h)*(A=o-e)))+(C=hH((s-o)*R-(a-h)*A)))*(b+C)<t.tessTol*(A*A+R*R)?t.addPoint(o,h,0===l?l|tH.PT_BEVEL:l):(_H(t,e,i,c,_,g,v,S=.5*(g+(y=.5*(d+p))),E=.5*(v+(T=.5*(f+m))),u+1,0),_H(t,S,E,y,T,p,m,o,h,u+1,l)))}var dH,fH,pH,mH,gH,vH,yH,TH,SH,EH,AH,RH,bH,CH,wH,xH,IH,OH,DH,MH,PH,BH,NH,LH,FH,kH,UH,GH,HH,zH,VH,WH,XH,jH,YH,KH,qH,QH=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).dx=0,e.dy=0,e.dmx=0,e.dmy=0,e.flags=0,e.len=0,e}return s(e,t),e.prototype.reset=function(){this.dx=0,this.dy=0,this.dmx=0,this.dmy=0,this.flags=0,this.len=0},e}(Fn),ZH=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}(),JH=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=pn.WHITE.clone(),this.lineCap=JG.BUTT,this.strokeColor=pn.BLACK.clone(),this.lineJoin=$G.MITER,this.lineWidth=0,this.pointsOffset=0,this._commandX=0,this._commandY=0,this._points=[],this._renderDataList=[],this._curPath=null,this._comp=void 0,this._comp=t}var e=t.prototype;return e.moveTo=function(t,e){this.updatePathOffset&&(this.pathOffset=this.pathLength,this.updatePathOffset=!1),this._addPath(),this.addPoint(t,e,tH.PT_CORNER),this._commandX=t,this._commandY=e},e.lineTo=function(t,e){this.addPoint(t,e,tH.PT_CORNER),this._commandX=t,this._commandY=e},e.bezierCurveTo=function(t,e,i,n,r,s){var a=this._curPath,o=a.points[a.points.length-1];o&&(o.x!==t||o.y!==e||i!==r||n!==s?(_H(this,o.x,o.y,t,e,i,n,r,s,0,tH.PT_CORNER),this._commandX=r,this._commandY=s):this.lineTo(r,s))},e.quadraticCurveTo=function(t,e,i,n){var r=this._commandX,s=this._commandY;this.bezierCurveTo(r+2/3*(t-r),s+2/3*(e-s),i+2/3*(t-i),n+2/3*(e-n),i,n)},e.arc=function(t,e,i,n,r,s){!function(t,e,i,n,r,s,a){var o,h,u=0,l=0,c=0,_=0,d=0,f=0,p=0,m=0,g=0,v=0,y=0,T=0,S=0,E=0;if(l=s-r,a=a||!1)if(hH(l)>=2*nH)l=2*nH;else for(;l<0;)l+=2*nH;else if(hH(l)>=2*nH)l=2*-nH;else for(;l>0;)l-=2*nH;for(h=0|sH(1,rH(hH(l)/(.5*nH)+.5,5)),c=hH(4/3*(1-aH(o=l/h/2))/oH(o)),a||(c=-c),E=0;E<=h;E++)f=e+(_=aH(u=r+l*(E/h)))*n,p=i+(d=oH(u))*n,m=-d*n*c,g=_*n*c,0===E?t.moveTo(f,p):t.bezierCurveTo(v+T,y+S,f-m,p-g,f,p),v=f,y=p,T=m,S=g}(this,t,e,i,n,r,s)},e.ellipse=function(t,e,i,n){cH(this,t,e,i,n),this._curPath.complex=!1},e.circle=function(t,e,i){cH(this,t,e,i,i),this._curPath.complex=!1},e.rect=function(t,e,i,n){this.moveTo(t,e),this.lineTo(t+i,e),this.lineTo(t+i,e+n),this.lineTo(t,e+n),this.close(),this._curPath.complex=!1},e.roundRect=function(t,e,i,n,r){!function(t,e,i,n,r,s){if(s<.1)t.rect(e,i,n,r);else{var a=rH(s,.5*hH(n))*uH(n),o=rH(s,.5*hH(r))*uH(r);t.moveTo(e,i+o),t.lineTo(e,i+r-o),t.bezierCurveTo(e,i+r-o*(1-lH),e+a*(1-lH),i+r,e+a,i+r),t.lineTo(e+n-a,i+r),t.bezierCurveTo(e+n-a*(1-lH),i+r,e+n,i+r-o*(1-lH),e+n,i+r-o),t.lineTo(e+n,i+o),t.bezierCurveTo(e+n,i+o*(1-lH),e+n-a*(1-lH),i,e+n-a,i),t.lineTo(e+a,i),t.bezierCurveTo(e+a*(1-lH),i,e,i+o*(1-lH),e,i+o),t.close()}}(this,t,e,i,n,r),this._curPath.complex=!1},e.clear=function(){this.pathLength=0,this.pathOffset=0,this.pointsOffset=0,this.dataOffset=0,this._curPath=null,this.paths.length=0,this._points.length=0;for(var t=this._renderDataList,e=0,i=t.length;e<i;e++){var n=t[e];n&&(Jk.remove(n),n.removeRenderDrawInfo(this._comp))}this._renderDataList.length=0},e.close=function(){this._curPath.closed=!0},e.requestRenderData=function(){var t=Jk.add();return this._renderDataList.push(t),t},e.getRenderDataList=function(){return 0===this._renderDataList.length&&this.requestRenderData(),this._renderDataList},e.addPoint=function(t,e,i){var n=this._curPath;if(n){var r=this._points,s=n.points,a=r[this.pointsOffset++];a?(a.x=t,a.y=e):(a=new QH(t,e),r.push(a)),a.flags=i,s.push(a)}},e._addPath=function(){var t=this.pathLength,e=this.paths[t];return e?e.reset():(e=new ZH,this.paths.push(e)),this.pathLength++,this._curPath=e,e},t}(),$H=dk.concat([new __("a_dist",jl.R32F)]),tz=vk($H),ez=yk($H),iz=t("G",(dH=qs("cc.Graphics"),fH=Zs(110),pH=xa($G),mH=xa(JG),dH(gH=fH(((bH=function(t){function e(){var e;return(e=t.call(this)||this).impl=null,e.model=null,e._lineWidth=yH&&yH(),e._strokeColor=TH&&TH(),e._lineJoin=SH&&SH(),e._lineCap=EH&&EH(),e._fillColor=AH&&AH(),e._miterLimit=RH&&RH(),e._isDrawing=!1,e._isNeedUploadData=!0,e._graphicsUseSubMeshes=[],e._instanceMaterialType=TU.ADD_COLOR,e.impl=new JH(c(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=gL.root.createModel(IB),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&&(gL.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=aS.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=wd.gfxDevice,i=e.createBuffer(new qc(ql.VERTEX|ql.TRANSFER_DST,Jl.DEVICE,65535*ez,ez)),n=e.createBuffer(new qc(ql.INDEX|ql.TRANSFER_DST,Jl.DEVICE,131070*Uint16Array.BYTES_PER_ELEMENT,Uint16Array.BYTES_PER_ELEMENT)),r=new Lx([i],$H,vc.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 a=new Float32Array(r.vData.buffer,0,r.vertexStart*tz);s.vertexBuffers[0].update(a),s.vertexCount=r.vertexStart;var o=new Uint16Array(r.iData.buffer,0,r.indexStart);s.indexBuffer.update(o),s.indexCount=r.indexStart,r.lastFilledVertex=r.vertexStart,r.lastFilledIndex=r.indexStart}}this._isNeedUploadData=!1}}},i._render=function(t){if(this._isNeedUploadData){if(this.impl){var e=this.impl.getRenderDataList(),i=this.model.subModels.length;if(e.length>i)for(var n=i;n<e.length;n++)this.activeSubModel(n)}this._uploadData()}t.commitModel(this,this.model,this.getMaterialInstance(0))},i._flushAssembler=function(){var t=e.Assembler.getAssembler(this);this._assembler!==t&&(this._assembler=t)},i._canRender=function(){return!!t.prototype._canRender.call(this)&&!!this.model&&this._isDrawing},i.updateRenderer=function(){t.prototype.updateRenderer.call(this)},i.createRenderEntity=function(){return new Kk(Dk.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}(bU)).LineJoin=$G,bH.LineCap=JG,f((vH=bH).prototype,"lineJoin",[pH],Object.getOwnPropertyDescriptor(vH.prototype,"lineJoin"),vH.prototype),f(vH.prototype,"lineCap",[mH],Object.getOwnPropertyDescriptor(vH.prototype,"lineCap"),vH.prototype),f(vH.prototype,"color",[Ia],Object.getOwnPropertyDescriptor(vH.prototype,"color"),vH.prototype),yH=Gs(vH.prototype,"_lineWidth",[ra],(function(){return 1})),TH=Gs(vH.prototype,"_strokeColor",[ra],(function(){return pn.BLACK.clone()})),SH=Gs(vH.prototype,"_lineJoin",[ra],(function(){return $G.MITER})),EH=Gs(vH.prototype,"_lineCap",[ra],(function(){return JG.BUTT})),AH=Gs(vH.prototype,"_fillColor",[ra],(function(){return pn.WHITE.clone()})),RH=Gs(vH.prototype,"_miterLimit",[ra],(function(){return 10})),gH=vH))||gH)||gH));v.Graphics=iz,function(t){t[t.SIMPLE=0]="SIMPLE",t[t.SLICED=1]="SLICED",t[t.TILED=2]="TILED",t[t.FILLED=3]="FILLED"}(jH||(jH={})),Se(jH),function(t){t[t.HORIZONTAL=0]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL",t[t.RADIAL=2]="RADIAL"}(YH||(YH={})),Se(YH),function(t){t[t.CUSTOM=0]="CUSTOM",t[t.TRIMMED=1]="TRIMMED",t[t.RAW=2]="RAW"}(KH||(KH={})),Se(KH),function(t){t.SPRITE_FRAME_CHANGED="spriteframe-changed"}(qH||(qH={}));var nz,rz,sz,az,oz,hz,uz,lz,cz,_z,dz=t("i",(CH=qs("cc.Sprite"),wH=Zs(110),xH=xa(SF),IH=xa(yF),OH=xa(jH),DH=xa(YH),MH=xa(KH),CH(PH=wH(((XH=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._spriteFrame=NH&&NH(),e._type=LH&&LH(),e._fillType=FH&&FH(),e._sizeMode=kH&&kH(),e._fillCenter=UH&&UH(),e._fillStart=GH&&GH(),e._fillRange=HH&&HH(),e._isTrimmedMode=zH&&zH(),e._useGrayscale=VH&&VH(),e._atlas=WH&&WH(),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===jH.SLICED&&e.on(yF.EVENT_UV_UPDATED,this._updateUVs,this))},i.onDisable=function(){t.prototype.onDisable.call(this),this._spriteFrame&&this._type===jH.SLICED&&this._spriteFrame.off(yF.EVENT_UV_UPDATED,this._updateUVs,this)},i.onDestroy=function(){t.prototype.onDestroy.call(this)},i.changeSpriteFrameFromAtlas=function(t){if(this._atlas){var e=this._atlas.getSpriteFrame(t);this.spriteFrame=e}else console.warn("SpriteAtlas is null.")},i.changeMaterialForDefine=function(){var t,e=this._instanceMaterialType;this._spriteFrame&&(t=this._spriteFrame.texture);var i=!1;if(t instanceof Lf){var n=t.getPixelFormat();i=n===lf.RGBA_ETC1||n===lf.RGB_A_PVRTC_4BPPV1||n===lf.RGB_A_PVRTC_2BPPV1}i&&this.grayscale?this._instanceMaterialType=TU.USE_ALPHA_SEPARATED_AND_GRAY:i?this._instanceMaterialType=TU.USE_ALPHA_SEPARATED:this.grayscale?this._instanceMaterialType=TU.GRAYSCALE:this._instanceMaterialType=TU.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 ox){var i=r({SAMPLE_FROM_RT:!0},e.passes[0].defines),n=new OS;n.initialize({effectAsset:e.effectAsset,defines:i}),e=n}return e},i._render=function(t){t.commitComp(this,this.renderData,this._spriteFrame,this._assembler,null)},i._canRender=function(){if(!t.prototype._canRender.call(this))return!1;var e=this._spriteFrame;return!(!e||!e.texture)},i._flushAssembler=function(){var t=e.Assembler.getAssembler(this);this._assembler!==t&&(this.destroyRenderData(),this._assembler=t),this._renderData||this._assembler&&this._assembler.createData&&(this._renderData=this._assembler.createData(this),this._renderData.material=this.getRenderMaterial(0),this.markForUpdateRenderData(),this.spriteFrame&&this._assembler.updateUVs(this),this._updateColor()),this._spriteFrame&&(this._type===jH.SLICED?this._spriteFrame.on(yF.EVENT_UV_UPDATED,this._updateUVs,this):this._spriteFrame.off(yF.EVENT_UV_UPDATED,this._updateUVs,this))},i._applySpriteSize=function(){if(this._spriteFrame)if(KH.RAW===this._sizeMode){var t=this._spriteFrame.originalSize;this.node._uiProps.uiTransformComp.setContentSize(t)}else if(KH.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===jH.SLICED&&t.off(yF.EVENT_UV_UPDATED,this._updateUVs,this);var i=!1;e&&(t&&t.texture===e.texture||(i=!0),i&&(this.renderData&&(this.renderData.textureDirty=!0),this.changeMaterialForDefine()),this._applySpriteSize(),this._type===jH.SLICED&&e.on(yF.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===YH.RADIAL||this._fillType===YH.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===jH.FILLED&&this.renderData&&this.markForUpdateRenderData()}},{key:"fillStart",get:function(){return this._fillStart},set:function(t){this._fillStart=Ii(t,0,1),this._type===jH.FILLED&&this.renderData&&(this.markForUpdateRenderData(),this._updateUVs())}},{key:"fillRange",get:function(){return this._fillRange},set:function(t){this._fillRange=Ii(t,-1,1),this._type===jH.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===jH.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!==KH.CUSTOM&&this._applySpriteSize())}}]),e}(bU)).FillType=YH,XH.Type=jH,XH.SizeMode=KH,XH.EventType=qH,f((BH=XH).prototype,"spriteAtlas",[xH],Object.getOwnPropertyDescriptor(BH.prototype,"spriteAtlas"),BH.prototype),f(BH.prototype,"spriteFrame",[IH],Object.getOwnPropertyDescriptor(BH.prototype,"spriteFrame"),BH.prototype),f(BH.prototype,"type",[OH],Object.getOwnPropertyDescriptor(BH.prototype,"type"),BH.prototype),f(BH.prototype,"fillType",[DH],Object.getOwnPropertyDescriptor(BH.prototype,"fillType"),BH.prototype),f(BH.prototype,"sizeMode",[MH],Object.getOwnPropertyDescriptor(BH.prototype,"sizeMode"),BH.prototype),NH=Gs(BH.prototype,"_spriteFrame",[ra],(function(){return null})),LH=Gs(BH.prototype,"_type",[ra],(function(){return jH.SIMPLE})),FH=Gs(BH.prototype,"_fillType",[ra],(function(){return YH.HORIZONTAL})),kH=Gs(BH.prototype,"_sizeMode",[ra],(function(){return KH.TRIMMED})),UH=Gs(BH.prototype,"_fillCenter",[ra],(function(){return new Fn(0,0)})),GH=Gs(BH.prototype,"_fillStart",[ra],(function(){return 0})),HH=Gs(BH.prototype,"_fillRange",[ra],(function(){return 0})),zH=Gs(BH.prototype,"_isTrimmedMode",[ra],(function(){return!0})),VH=Gs(BH.prototype,"_useGrayscale",[ra],(function(){return!1})),WH=Gs(BH.prototype,"_atlas",[ra],(function(){return null})),PH=BH))||PH)||PH));v.Sprite=dz;var fz,pz=new Dn,mz=new Fn,gz=new Dn,vz=[];!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"}(fz||(fz={})),Se(fz);var yz=t("f",(nz=qs("cc.Mask"),rz=Zs(110),sz=xa(fz),nz(az=rz(((_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)._type=hz&&hz(),e._inverted=uz&&uz(),e._segments=lz&&lz(),e._alphaThreshold=cz&&cz(),e._sprite=null,e._graphics=null,e._stencilStage=Rk.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(um.ANCHOR_CHANGED,this._nodeStateChange,this),this.node.on(um.SIZE_CHANGED,this._nodeStateChange,this)},i.onRestore=function(){this._changeRenderType(),this._updateGraphics()},i.onDisable=function(){this._disableRender(),this.node.off(um.ANCHOR_CHANGED,this._nodeStateChange,this),this.node.off(um.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=mz;this.node.getWorldMatrix(pz),Dn.invert(gz,pz),Fn.transformMat4(s,t,gz);var a=e.anchorPoint;s.x+=a.x*n,s.y+=a.y*r;var o=!1;if(this.type===fz.GRAPHICS_RECT||this.type===fz.GRAPHICS_STENCIL||this.type===fz.SPRITE_STENCIL)o=s.x>=0&&s.y>=0&&s.x<=n&&s.y<=r;else if(this.type===fz.GRAPHICS_ELLIPSE){var h=n/2,u=r/2,l=s.x-.5*n,c=s.y-.5*r;o=l*l/(h*h)+c*c/(u*u)<1}return this._inverted&&(o=!o),o},i._nodeStateChange=function(){this._updateGraphics()},i._changeRenderType=function(){this._type!==fz.SPRITE_STENCIL?this._createGraphics():this._createSprite()},i._createSprite=function(){if(!this._sprite){var t=this._sprite=this.node.getComponent(dz);if(!t){var e=this.node;t=this._sprite=e.addComponent(dz)}}this._sprite.stencilStage=this.inverted?Rk.ENTER_LEVEL_INVERTED:Rk.ENTER_LEVEL,this._sprite.updateMaterial()},i._createGraphics=function(){if(!this._graphics){var t=this._graphics=this.node.getComponent(iz);if(!t){var e=this.node;t=this._graphics=e.addComponent(iz)}t.lineWidth=1;var i=pn.WHITE.clone();i.a=0,t.fillColor=i}this._graphics.stencilStage=this.inverted?Rk.ENTER_LEVEL_INVERTED:Rk.ENTER_LEVEL},i._updateGraphics=function(){if(this._graphics&&(this._type===fz.GRAPHICS_RECT||this._type===fz.GRAPHICS_ELLIPSE)){var t=this.node._uiProps.uiTransformComp,e=this._graphics;e.clear();var i=t.contentSize,n=i.width,r=i.height,s=t.anchorPoint,a=-n*s.x,o=-r*s.y;if(this._type===fz.GRAPHICS_RECT)e.rect(a,o,n,r);else if(this._type===fz.GRAPHICS_ELLIPSE){for(var h=function(t,e,i){vz.length=0;for(var n=2*Math.PI/i,r=0;r<i;++r)vz.push(new hn(e.x*Math.cos(n*r)+t.x,e.y*Math.sin(n*r)+t.y,0));return vz}(new hn(a+n/2,o+r/2,0),new hn(n/2,r/2,0),this._segments),u=0;u<h.length;++u){var l=h[u];0===u?e.moveTo(l.x,l.y):e.lineTo(l.x,l.y)}e.close()}e.fill()}},i._enableRender=function(){this.subComp&&(this.subComp.enabled=!0)},i._disableRender=function(){this.subComp&&(this.subComp.stencilStage=Rk.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!==fz.SPRITE_STENCIL?(this._sprite&&(this.node.removeComponent(dz),this._sprite._destroyImmediate(),this._sprite=null),this._changeRenderType(),this._updateGraphics()):(this._graphics&&(this._graphics.clear(),this.node.removeComponent(iz),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?Rk.ENTER_LEVEL_INVERTED:Rk.ENTER_LEVEL}},{key:"segments",get:function(){return this._segments},set:function(t){this._segments!==t&&(this._segments=Ii(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:G("please change type to sprite_stencil first")}},{key:"alphaThreshold",get:function(){return this._alphaThreshold},set:function(t){this._alphaThreshold!==t&&(this._alphaThreshold=t,this.type===fz.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}(op)).Type=fz,f((oz=_z).prototype,"type",[sz],Object.getOwnPropertyDescriptor(oz.prototype,"type"),oz.prototype),hz=Gs(oz.prototype,"_type",[ra],(function(){return fz.GRAPHICS_RECT})),uz=Gs(oz.prototype,"_inverted",[ra],(function(){return!1})),lz=Gs(oz.prototype,"_segments",[ra],(function(){return 64})),cz=Gs(oz.prototype,"_alphaThreshold",[ra],(function(){return.1})),az=oz))||az)||az));aN._maskComp=yz,v.Mask=yz;var Tz,Sz,Ez,Az,Rz,bz,Cz,wz=/^(click)(\s)*=|(param)(\s)*=/,xz=/(\s)*src(\s)*=|(\s)*height(\s)*=|(\s)*width(\s)*=|(\s)*align(\s)*=|(\s)*offset(\s)*=|(\s)*click(\s)*=|(\s)*param(\s)*=/,Iz=t("y",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),a=t.substring(r+1,n);""===a&&(s=t.substring(e,n+1)),this._processResult(s),-1===n?n=r:"/"===t.charAt(r+1)?this._stack.pop():this._addToStack(a),e=n+1}}return this._resultObjectArray},e._attributeToObject=function(t){t=t.trim();var e={},i=/^(color|size)(\s)*=/.exec(t),n="",r=0,s="";if(i){if(n=i[0],""===(t=t.substring(n.length).trim()))return e;switch(r=t.indexOf(" "),n[0]){case"c":e.color=r>-1?t.substring(0,r).trim():t;break;case"s":e.size=parseInt(t)}return r>-1&&(s=t.substring(r+1).trim(),e.event=this._processEventHandler(s)),e}if((i=/^(br(\s)*\/)/.exec(t))&&i[0].length>0&&(n=i[0].trim()).startsWith("br")&&"/"===n[n.length-1])return e.isNewLine=!0,this._resultObjectArray.push({text:"",style:{isNewLine:!0}}),e;var a="",o=-1;if((i=/^(img(\s)*src(\s)*=[^>]+\/)/.exec(t))&&i[0].length>0&&(n=i[0].trim()).startsWith("img")&&"/"===n[n.length-1]){var h;i=xz.exec(t);for(var u=!1;i;){var l=(n=(t=t.substring(t.indexOf(i[0]))).substr(0,i[0].length)).length;if(n=(n=n.replace(/[^a-zA-Z]/g,"").trim()).toLowerCase(),a=t.substring(l).trim(),o="src"===n?this.getRightQuotationIndex(a):-1,h=(r=a.indexOf(" ",o+1>=a.length?-1:o+1))>-1?a.substr(0,r):a,t=a.substring(r).trim(),h.endsWith("/")&&(h=h.slice(0,-1)),"src"===n){switch(h.charCodeAt(0)){case 34:case 39:u=!0,h=h.slice(1,-1)}e.isImage=!0,e.src=h}else if("height"===n)e.imageHeight=parseInt(h);else if("width"===n)e.imageWidth=parseInt(h);else if("align"===n){switch(h.charCodeAt(0)){case 34:case 39:h=h.slice(1,-1)}e.imageAlign=h.toLowerCase()}else"offset"===n?e.imageOffset=h:"click"===n&&(e.event=this._processEventHandler(n+"="+h));e.event&&"param"===n&&(e.event[n]=h.replace(/^"|"$/g,"")),i=xz.exec(t)}return u&&e.isImage&&this._resultObjectArray.push({text:"",style:e}),{}}if(i=/^(outline(\s)*[^>]*)/.exec(t)){var c={color:"#ffffff",width:1};if(t=i[0].substring("outline".length).trim()){var _,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=(a=t.substring(n.length).trim()).indexOf(" "))>-1?a.substr(0,r):a,n=(n=n.replace(/[^a-zA-Z]/g,"").trim()).toLowerCase(),t=a.substring(r).trim(),"click"===n?e.event=this._processEventHandler(n+"="+_):"color"===n?c.color=_:"width"===n&&(c.width=parseInt(_)),e.event&&"param"===n&&(e.event[n]=_.replace(/^"|"$/g,"")),i=d.exec(t)}e.outline=c}if((i=/^(on|u|b|i)(\s)*/.exec(t))&&i[0].length>0){switch(n=i[0],t=t.substring(n.length).trim(),n[0]){case"u":e.underline=!0;break;case"i":e.italic=!0;break;case"b":e.bold=!0}if(""===t)return e;e.event=this._processEventHandler(t)}return e},e.getRightQuotationIndex=function(t){var e=-1,i=-1,n=t.indexOf("'"),r=t.indexOf('"'),s=r>-1&&(r<n||-1===n);return n>-1&&(n<r||-1===r)?(e=n,i=t.indexOf("'",e+1>=t.length?-1:e+1)):s&&(e=r,i=t.indexOf('"',e+1>=t.length?-1:e+1)),i},e._processEventHandler=function(t){for(var e={},i=0,n=!1,r=wz.exec(t);r;){var s=r[0],a="";if(n=!1,'"'===(t=t.substring(s.length).trim()).charAt(0))(i=t.indexOf('"',1))>-1&&(a=t.substring(1,i).trim(),n=!0),i++;else if("'"===t.charAt(0))(i=t.indexOf("'",1))>-1&&(a=t.substring(1,i).trim(),n=!0),i++;else{var o=/(\S)+/.exec(t);i=(a=o?o[0]:"").length}n&&(e[s=s.substring(0,s.length-1).trim()]=a),t=t.substring(i).trim(),r=wz.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}()),Oz=t("k",qs("cc.LabelOutline")(Tz=Zs(110)(Tz=Qs(fG)(Tz=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.onEnable=function(){this.node.getComponent(fG).enableOutline=!0},i.onDisable=function(){this.node.getComponent(fG).enableOutline=!1},n(e,[{key:"color",get:function(){return this.node.getComponent(fG).outlineColor},set:function(t){this.node.getComponent(fG).outlineColor=t}},{key:"width",get:function(){return this.node.getComponent(fG).outlineWidth},set:function(t){this.node.getComponent(fG).outlineWidth=t}}]),e}(op))||Tz)||Tz)||Tz);v.LabelOutline=Oz,mt({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}}),mt({UIRenderable:{newName:"UIRenderer",since:"3.0.0",removed:!0}}),mt({Renderable2D:{newName:"UIRenderer",since:"3.6.0",removed:!1}});var Dz,Mz,Pz,Bz,Nz,Lz,Fz,kz,Uz,Gz,Hz,zz,Vz,Wz,Xz,jz,Yz,Kz,qz,Qz,Zz,Jz,$z,tV,eV,iV,nV,rV,sV,aV,oV,hV,uV,lV,cV,_V,dV=qs("cc.PostProcess")(Sz=Js(((Cz=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).global=Az&&Az(),e._shadingScale=Rz&&Rz(),e.enableShadingScaleInEditor=bz&&bz(),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}(op)).all=[],Az=Gs((Ez=Cz).prototype,"global",[$s,ra],(function(){return!0})),Rz=Gs(Ez.prototype,"_shadingScale",[ra],(function(){return 1})),f(Ez.prototype,"shadingScale",[$s],Object.getOwnPropertyDescriptor(Ez.prototype,"shadingScale"),Ez.prototype),bz=Gs(Ez.prototype,"enableShadingScaleInEditor",[$s,ra],(function(){return!1})),Sz=Ez))||Sz)||Sz,fV=new hn,pV=ve(Iw),mV=ve(xw),gV=ve(Ow),vV=ve(Mw),yV=ve(Dw),TV=ve({SKYBOX:Ww|xc.DEPTH_STENCIL,SOLID_COLOR:xc.ALL,DEPTH_ONLY:xc.DEPTH_STENCIL,DONT_CLEAR:xc.NONE}),SV=t("dX",(Dz=qs("cc.Camera"),Mz=xa(sm.BitMask),Pz=xa(TV),Bz=xa(pV),Nz=xa(mV),Lz=xa(gV),Fz=xa(vV),kz=xa(yV),Uz=xa(ox),Gz=xa(dV),Dz(((cV=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._projection=Vz&&Vz(),e._priority=Wz&&Wz(),e._fov=Xz&&Xz(),e._fovAxis=jz&&jz(),e._orthoHeight=Yz&&Yz(),e._near=Kz&&Kz(),e._far=qz&&qz(),e._color=Qz&&Qz(),e._depth=Zz&&Zz(),e._stencil=Jz&&Jz(),e._clearFlags=$z&&$z(),e._rect=tV&&tV(),e._aperture=eV&&eV(),e._shutter=iV&&iV(),e._iso=nV&&nV(),e._screenScale=rV&&rV(),e._visibility=sV&&sV(),e._targetTexture=aV&&aV(),e._postProcess=oV&&oV(),e._usePostProcess=hV&&hV(),e._camera=null,e._inEditorMode=!1,e._flows=void 0,e._cameraType=uV&&uV(),e._trackingType=lV&&lV(),e}s(e,t);var i=e.prototype;return i.onLoad=function(){this._createCamera()},i.onEnable=function(){this.node.hasChangedFlags|=om.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=hr.create()),this._camera&&this._camera.screenPointToRay(i,t,e),i},i.worldToScreen=function(t,e){return e||(e=new hn),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 hn),!this._camera)return i;this.worldToScreen(t,fV);var n=e.getComponent("cc.UITransform"),r=v.view.getVisibleSize(),s=fV.x-.5*this._camera.width,a=fV.y-.5*this._camera.height;return fV.x=s/v.view.getScaleX()+.5*r.width,fV.y=a/v.view.getScaleY()+.5*r.height,n&&n.convertToNodeSpaceAR(fV,i),i},i._createCamera=function(){this._camera||(this._camera=v.director.root.createCamera(),this._camera.initialize({name:this.node.name,node:this.node,projection:this._projection,window:this._inEditorMode?v.director.root&&v.director.root.mainWindow:v.director.root&&v.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=Mi(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===xw.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=Mi(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?v.director.root&&v.director.root.mainWindow:v.director.root&&v.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}(op)).ProjectionType=pV,cV.FOVAxis=mV,cV.ClearFlag=TV,cV.Aperture=gV,cV.Shutter=vV,cV.ISO=yV,cV.TARGET_TEXTURE_CHANGE="tex-change",Vz=Gs((zz=cV).prototype,"_projection",[ra],(function(){return pV.PERSPECTIVE})),Wz=Gs(zz.prototype,"_priority",[ra],(function(){return 0})),Xz=Gs(zz.prototype,"_fov",[ra],(function(){return 45})),jz=Gs(zz.prototype,"_fovAxis",[ra],(function(){return mV.VERTICAL})),Yz=Gs(zz.prototype,"_orthoHeight",[ra],(function(){return 10})),Kz=Gs(zz.prototype,"_near",[ra],(function(){return 1})),qz=Gs(zz.prototype,"_far",[ra],(function(){return 1e3})),Qz=Gs(zz.prototype,"_color",[ra],(function(){return new pn("#333333")})),Zz=Gs(zz.prototype,"_depth",[ra],(function(){return 1})),Jz=Gs(zz.prototype,"_stencil",[ra],(function(){return 0})),$z=Gs(zz.prototype,"_clearFlags",[ra],(function(){return TV.SOLID_COLOR})),tV=Gs(zz.prototype,"_rect",[ra],(function(){return new Vn(0,0,1,1)})),eV=Gs(zz.prototype,"_aperture",[ra],(function(){return gV.F16_0})),iV=Gs(zz.prototype,"_shutter",[ra],(function(){return vV.D125})),nV=Gs(zz.prototype,"_iso",[ra],(function(){return yV.ISO100})),rV=Gs(zz.prototype,"_screenScale",[ra],(function(){return 1})),sV=Gs(zz.prototype,"_visibility",[ra],(function(){return Jv})),aV=Gs(zz.prototype,"_targetTexture",[ra],(function(){return null})),oV=Gs(zz.prototype,"_postProcess",[ra],(function(){return null})),hV=Gs(zz.prototype,"_usePostProcess",[ra],(function(){return!1})),uV=Gs(zz.prototype,"_cameraType",[ra],(function(){return Pw.DEFAULT})),lV=Gs(zz.prototype,"_trackingType",[ra],(function(){return Bw.NO_TRACKING})),f(zz.prototype,"visibility",[Mz],Object.getOwnPropertyDescriptor(zz.prototype,"visibility"),zz.prototype),f(zz.prototype,"clearFlags",[Pz],Object.getOwnPropertyDescriptor(zz.prototype,"clearFlags"),zz.prototype),f(zz.prototype,"projection",[Bz],Object.getOwnPropertyDescriptor(zz.prototype,"projection"),zz.prototype),f(zz.prototype,"fovAxis",[Nz],Object.getOwnPropertyDescriptor(zz.prototype,"fovAxis"),zz.prototype),f(zz.prototype,"aperture",[Lz],Object.getOwnPropertyDescriptor(zz.prototype,"aperture"),zz.prototype),f(zz.prototype,"shutter",[Fz],Object.getOwnPropertyDescriptor(zz.prototype,"shutter"),zz.prototype),f(zz.prototype,"iso",[kz],Object.getOwnPropertyDescriptor(zz.prototype,"iso"),zz.prototype),f(zz.prototype,"targetTexture",[Uz],Object.getOwnPropertyDescriptor(zz.prototype,"targetTexture"),zz.prototype),f(zz.prototype,"usePostProcess",[$s],Object.getOwnPropertyDescriptor(zz.prototype,"usePostProcess"),zz.prototype),f(zz.prototype,"postProcess",[Gz],Object.getOwnPropertyDescriptor(zz.prototype,"postProcess"),zz.prototype),Hz=zz))||Hz));v.Camera=SV;var EV=new Hn,AV=((_V={})[Ce.ORIENTATION_AUTO]=Al.AUTO,_V[Ce.ORIENTATION_LANDSCAPE]=Al.LANDSCAPE,_V[Ce.ORIENTATION_PORTRAIT]=Al.PORTRAIT,_V),RV=t("f$",function(t){function e(){var e;(e=t.call(this)||this)._designResolutionSize=void 0,e._scaleX=void 0,e._scaleY=void 0,e._viewportRect=void 0,e._visibleRect=void 0,e._autoFullScreen=void 0,e._retinaEnabled=void 0,e._resizeCallback=void 0,e._resolutionPolicy=void 0,e._rpExactFit=void 0,e._rpShowAll=void 0,e._rpNoBorder=void 0,e._rpFixedHeight=void 0,e._rpFixedWidth=void 0;var i=bV,n=CV;return e._designResolutionSize=new Hn(0,0),e._scaleX=1,e._scaleY=1,e._viewportRect=new Vn(0,0,0,0),e._visibleRect=new Vn(0,0,0,0),e._autoFullScreen=!1,e._retinaEnabled=!1,e._resizeCallback=null,e._rpExactFit=new wV(i.EQUAL_TO_FRAME,n.EXACT_FIT),e._rpShowAll=new wV(i.EQUAL_TO_FRAME,n.SHOW_ALL),e._rpNoBorder=new wV(i.EQUAL_TO_FRAME,n.NO_BORDER),e._rpFixedHeight=new wV(i.EQUAL_TO_FRAME,n.FIXED_HEIGHT),e._rpFixedWidth=new wV(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=Il.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,EV.width=this._visibleRect.width,EV.height=this._visibleRect.height,Dl&&Dl.init(this._visibleRect),this.resizeWithBrowserSize(!0);var n=be.querySettings(Re.Category.SCREEN,"designResolution");n&&this.setDesignResolutionSize(Number(n.width),Number(n.height),n.policy||wV.FIXED_HEIGHT),Il.on("window-resize",this._updateAdaptResult,this),Il.on("orientation-change",this._updateAdaptResult,this),Il.on("fullscreen-change",this._updateAdaptResult,this)},i.resizeWithBrowserSize=function(t){wl.handleResizeEvent=t},i.setResizeCallback=function(t){"function"!=typeof t&&null!=t||(this._resizeCallback=t)},i.setOrientation=function(t){wl.orientation=AV[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&&Il.requestFullScreen().catch((function(){})))},i.isAutoFullScreenEnabled=function(){return this._autoFullScreen},i.setCanvasSize=function(t,e){wl.resolutionScale=1;var i=wl.devicePixelRatio,n=new Hn(t*i,e*i);Il.windowSize=n},i.getCanvasSize=function(){return Il.windowSize},i.getFrameSize=function(){var t=wl.devicePixelRatio,e=Il.windowSize;return e.width/=t,e.height/=t,e},i.setFrameSize=function(t,e){var i=wl.devicePixelRatio;Il.windowSize=new Hn(t*i,e*i)},i.getVisibleSize=function(){return new Hn(this._visibleRect.width,this._visibleRect.height)},i.getVisibleSizeInPixel=function(){return new Hn(this._visibleRect.width*this._scaleX,this._visibleRect.height*this._scaleY)},i.getVisibleOrigin=function(){return new Fn(this._visibleRect.x,this._visibleRect.y)},i.getVisibleOriginInPixel=function(){return new Fn(this._visibleRect.x*this._scaleX,this._visibleRect.y*this._scaleY)},i.getResolutionPolicy=function(){return this._resolutionPolicy},i._updateResolutionPolicy=function(t){if(t instanceof wV)this._resolutionPolicy=t;else{var e=wV;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=IV.getDesignResolutionSize();IV.setDesignResolutionSize(e.width,e.height,t)},i.setDesignResolutionSize=function(t,e,i){if(t>0&&e>0){this._updateResolutionPolicy(i);var n=this._resolutionPolicy;n&&n.preApply(this),this._designResolutionSize.width=t,this._designResolutionSize.height=e;var r=n.apply(this,this._designResolutionSize);if(r.scale&&2===r.scale.length&&(this._scaleX=r.scale[0],this._scaleY=r.scale[1]),r.viewport){var s=this._viewportRect,a=this._visibleRect,o=r.viewport;s.x=o.x,s.y=o.y,s.width=o.width,s.height=o.height,a.x=0,a.y=0,a.width=o.width/this._scaleX,a.height=o.height/this._scaleY}n.postApply(this),EV.width=this._visibleRect.width,EV.height=this._visibleRect.height,Dl&&Dl.init(this._visibleRect),this.emit("design-resolution-changed")}else Z(2200)},i.getDesignResolutionSize=function(){return new Hn(this._designResolutionSize.width,this._designResolutionSize.height)},i.setRealPixelResolution=function(t,e,i){document.documentElement.style.width=t+"px",document.body.style.width=t+"px",document.body.style.left="0px",document.body.style.top="0px",this.setDesignResolutionSize(t,e,i)},i.getViewportRect=function(){return this._viewportRect},i.getScaleX=function(){return this._scaleX},i.getScaleY=function(){return this._scaleY},i.getDevicePixelRatio=function(){return wl.devicePixelRatio},i.convertToLocationInView=function(t,e,i,n){void 0===n&&(n=new Fn);var r=wl.devicePixelRatio*(t-i.left),s=wl.devicePixelRatio*(i.top+i.height-e);return wl.isFrameRotated?(n.x=Il.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;v.director.root.resize(t,e,void 0===i||0===i?1:i);var r=this._designResolutionSize.width,s=this._designResolutionSize.height;t>0&&this.setDesignResolutionSize(r,s,this._resolutionPolicy),this.emit("canvas-resize"),null===(n=this._resizeCallback)||void 0===n||n.call(this)},e}(Zu(Lu)));RV.instance=void 0;var bV=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=v.game.canvas;if(t){var e=Il.windowSize;t.width!==e.width&&(t.width=e.width),t.height!==e.height&&(t.height=e.height)}},t}();bV.EQUAL_TO_FRAME=void 0,bV.PROPORTION_TO_FRAME=void 0;var CV=function(){function t(){this.name="ContentStrategy",this._result=void 0,this._result={scale:[1,1],viewport:null}}var e=t.prototype;return e.preApply=function(){},e.apply=function(){return{scale:[1,1]}},e.postApply=function(){},e._buildResult=function(t,e,i,n,r,s){Math.abs(t-i)<2&&(i=t),Math.abs(e-n)<2&&(n=e);var a=new Vn(Math.round((t-i)/2),Math.round((e-n)/2),i,n);return this._result.scale=[r,s],this._result.viewport=a,this._result},t}();CV.EXACT_FIT=void 0,CV.SHOW_ALL=void 0,CV.NO_BORDER=void 0,CV.FIXED_HEIGHT=void 0,CV.FIXED_WIDTH=void 0,function(){var t=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).name="EqualToFrame",e}return s(e,t),e.prototype.apply=function(){wl.isProportionalToFrame=!1,this._setupCanvas()},e}(bV),e=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).name="ProportionalToFrame",e}return s(e,t),e.prototype.apply=function(){wl.isProportionalToFrame=!0,this._setupCanvas()},e}(bV);bV.EQUAL_TO_FRAME=new t,bV.PROPORTION_TO_FRAME=new e;var i=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).name="ExactFit",e}return s(e,t),e.prototype.apply=function(t,e){var i=Il.windowSize,n=i.width,r=i.height,s=n/e.width,a=r/e.height;return this._buildResult(n,r,n,r,s,a)},e}(CV),n=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).name="ShowAll",e}return s(e,t),e.prototype.apply=function(t,e){var i,n,r=Il.windowSize,s=r.width,a=r.height,o=e.width,h=e.height,u=s/o,l=a/h,c=0;return u<l?(i=s,n=h*(c=u)):(i=o*(c=l),n=a),this._buildResult(s,a,i,n,c,c)},e}(CV),r=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).name="NoBorder",e}return s(e,t),e.prototype.apply=function(t,e){var i,n,r,s=Il.windowSize,a=s.width,o=s.height,h=e.width,u=e.height,l=a/h,c=o/u;return l<c?(n=h*(i=c),r=o):(n=a,r=u*(i=l)),this._buildResult(a,o,n,r,i,i)},e}(CV),a=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).name="FixedHeight",e}return s(e,t),e.prototype.apply=function(t,e){var i=Il.windowSize,n=i.width,r=i.height,s=r/e.height,a=n,o=r;return this._buildResult(n,r,a,o,s,s)},e}(CV),o=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).name="FixedWidth",e}return s(e,t),e.prototype.apply=function(t,e){var i=Il.windowSize,n=i.width,r=i.height,s=n/e.width,a=n,o=r;return this._buildResult(n,r,a,o,s,s)},e}(CV);CV.EXACT_FIT=new i,CV.SHOW_ALL=new n,CV.NO_BORDER=new r,CV.FIXED_HEIGHT=new a,CV.FIXED_WIDTH=new o}();var wV=t("g0",function(){function t(t,e){this.name="ResolutionPolicy",this._containerStrategy=void 0,this._contentStrategy=void 0,this._containerStrategy=null,this._contentStrategy=null,this.setContainerStrategy(t),this.setContentStrategy(e)}var e=t.prototype;return e.preApply=function(t){this._contentStrategy.preApply(t)},e.apply=function(t,e){return this._containerStrategy.apply(t,e),this._contentStrategy.apply(t,e)},e.postApply=function(t){this._contentStrategy.postApply(t)},e.setContainerStrategy=function(t){t instanceof bV&&(this._containerStrategy=t)},e.setContentStrategy=function(t){t instanceof CV&&(this._contentStrategy=t)},n(t,[{key:"canvasSize",get:function(){return Il.windowSize}}]),t}());wV.EXACT_FIT=0,wV.NO_BORDER=1,wV.SHOW_ALL=2,wV.FIXED_HEIGHT=3,wV.FIXED_WIDTH=4,wV.UNKNOWN=5,wV.ContainerStrategy=bV,wV.ContentStrategy=CV,v.ResolutionPolicy=wV;var xV,IV=t("g1",RV.instance=v.view=new RV);gL.registerSystem("view",IV,0),v.winSize=EV;var OV,DV,MV,PV,BV,NV,LV,FV,kV,UV=t("R",qs("cc.RenderRoot2D")(xV=Zs(100)(xV=Qs(oU)(xV=Js(xV=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.onEnable=function(){v.director.root.batcher2D.addScreen(this)},i.onDisable=function(){v.director.root.batcher2D.removeScreen(this)},i.onDestroy=function(){v.director.root.batcher2D.removeScreen(this)},e}(op))||xV)||xV)||xV)||xV),GV=new hn,HV=ve({OVERLAY:0,INTERSPERSE:1}),zV=t("C",(OV=qs("cc.Canvas"),DV=Zs(100),MV=xa(SV),PV=xa(SV),OV(BV=DV(BV=Js((f((NV=function(t){function e(){var e;return(e=t.call(this)||this)._cameraComponent=LV&&LV(),e._alignCanvasWithScreen=FV&&FV(),e._thisOnCameraResized=void 0,e.fitDesignResolution_EDITOR=void 0,e._pos=new hn,e._renderMode=HV.OVERLAY,e._thisOnCameraResized=e._onResizeCamera.bind(c(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(SV.TARGET_TEXTURE_CHANGE,this._thisOnCameraResized)),this._onResizeCamera(),this.node.on(um.TRANSFORM_CHANGED,this._thisOnCameraResized)},i.onEnable=function(){t.prototype.onEnable.call(this),this._cameraComponent&&this._cameraComponent.node.on(SV.TARGET_TEXTURE_CHANGE,this._thisOnCameraResized)},i.onDisable=function(){t.prototype.onDisable.call(this),this._cameraComponent&&this._cameraComponent.node.off(SV.TARGET_TEXTURE_CHANGE,this._thisOnCameraResized)},i.onDestroy=function(){t.prototype.onDestroy.call(this),this.node.off(um.TRANSFORM_CHANGED,this._thisOnCameraResized)},i._onResizeCamera=function(){if(this._cameraComponent&&this._alignCanvasWithScreen){if(this._cameraComponent.targetTexture)this._cameraComponent.orthoHeight=Dl.height/2;else{var t=Il.windowSize;this._cameraComponent.orthoHeight=t.height/IV.getScaleY()/2}this.node.getWorldPosition(GV),this._cameraComponent.node.setWorldPosition(GV.x,GV.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===HV.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}(UV)).prototype,"cameraComponent",[MV],Object.getOwnPropertyDescriptor(NV.prototype,"cameraComponent"),NV.prototype),LV=Gs(NV.prototype,"_cameraComponent",[PV],(function(){return null})),FV=Gs(NV.prototype,"_alignCanvasWithScreen",[ra],(function(){return!0})),BV=NV))||BV)||BV)||BV));function VV(t,e,i){var n=t.o,r=t.d,s=1/r.x,a=1/r.y,o=1/r.z,h=(e.x-n.x)*s,u=(i.x-n.x)*s,l=(e.y-n.y)*a,c=(i.y-n.y)*a,_=(e.z-n.z)*o,d=(i.z-n.z)*o,f=Math.max(Math.max(Math.min(h,u),Math.min(l,c)),Math.min(_,d)),p=Math.min(Math.min(Math.max(h,u),Math.max(l,c)),Math.max(_,d));return p<0||f>p?0:f>0?f:p}v.Canvas=zV,st(t("U",qs("cc.UIComponent")(kV=Qs(oU)(kV=Zs(110)(kV=Js(kV=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._lastParent=null,e.stencilStage=Rk.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}(op))||kV)||kV)||kV)||kV).prototype,"UIComponent",[{name:"_visibility"},{name:"setVisibility"}]),rt(zV.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:pn.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}}]),at(oU.prototype,"UITransform.prototype",[{name:"priority",suggest:"Please use setSiblingIndex to change index of the current node in its parent's children array."}]),v.UITransformComponent=oU,Jt(oU,"cc.UITransformComponent"),Jt(bU,"cc.RenderComponent"),v.CanvasComponent=zV,Jt(zV,"cc.CanvasComponent"),v.internal.Renderable2D=bU,Jt(bU,"cc.Renderable2D");var WV,XV,jV,YV,KV,qV,QV,ZV=(WV=ps.create(),XV={distance:1/0,doubleSided:!1,mode:du.ANY},jV=0,YV=function(t,e,i,n,r,s){t===du.CLOSEST?(jV>e||0===jV)&&(jV=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))):(jV=e,s&&s.push({distance:e,vertexIndex0:i/3,vertexIndex1:n/3,vertexIndex2:r/3}))},function(t,e,i){if(jV=0,0===e.geometricInfo.positions.length)return jV;var n=void 0===i?XV:i;if(VV(t,e.geometricInfo.boundingBox.min,e.geometricInfo.boundingBox.max)){var r=e.primitiveMode,s=e.geometricInfo;!function(t,e,i,n,r){if(i===vc.TRIANGLE_LIST)for(var s=e.length,a=0;a<s;a+=3){var o=3*e[a],h=3*e[a+1],u=3*e[a+2];hn.set(WV.a,t[o],t[o+1],t[o+2]),hn.set(WV.b,t[h],t[h+1],t[h+2]),hn.set(WV.c,t[u],t[u+1],t[u+2]);var l=us.rayTriangle(n,WV,r.doubleSided);if(!(0===l||l>r.distance)&&(YV(r.mode,l,o,h,u,r.result),r.mode===du.ANY))return l}else if(i===vc.TRIANGLE_STRIP)for(var c=e.length-2,_=0,d=0;d<c;d+=1){var f=3*e[d-_],p=3*e[d+_+1],m=3*e[d+2];hn.set(WV.a,t[f],t[f+1],t[f+2]),hn.set(WV.b,t[p],t[p+1],t[p+2]),hn.set(WV.c,t[m],t[m+1],t[m+2]),_=~_;var g=us.rayTriangle(n,WV,r.doubleSided);if(!(0===g||g>r.distance)&&(YV(r.mode,g,f,p,m,r.result),r.mode===du.ANY))return g}else if(i===vc.TRIANGLE_FAN){var v=e.length-1,y=3*e[0];hn.set(WV.a,t[y],t[y+1],t[y+2]);for(var T=1;T<v;T+=1){var S=3*e[T],E=3*e[T+1];hn.set(WV.b,t[S],t[S+1],t[S+2]),hn.set(WV.c,t[E],t[E+1],t[E+2]);var A=us.rayTriangle(n,WV,r.doubleSided);if(!(0===A||A>r.distance)&&(YV(r.mode,A,y,S,E,r.result),r.mode===du.ANY))return A}}}(s.positions,s.indices,r,t,n)}return jV}),JV=function(){var t=0,e={distance:1/0,doubleSided:!1,mode:du.ANY};return function(i,n,r){t=0;var s=void 0===r?e:r,a=n.renderingSubMeshes.length,o=n.struct.minPosition,h=n.struct.maxPosition;if(o&&h&&!VV(i,o,h))return t;for(var u=0;u<a;u++){var l=n.renderingSubMeshes[u],c=ZV(i,l,s);if(c)if(s.mode===du.CLOSEST)(0===t||t>c)&&(t=c,s.subIndices&&(s.subIndices[0]=u));else if(t=c,s.subIndices&&s.subIndices.push(u),s.mode===du.ANY)return c}return t&&s.mode===du.CLOSEST&&(s.result&&(s.result[0].distance=t,s.result.length=1),s.subIndices&&(s.subIndices.length=1)),t}}(),$V=function(){var t=0,e={distance:1/0,doubleSided:!1,mode:du.ANY},i=new hr,n=new Dn;return function(r,s,a){t=0;var o=void 0===a?e:a,h=s.worldBounds;if(h&&!us.rayAABB(r,h))return t;hr.copy(i,r),s.node&&(Dn.invert(n,s.node.getWorldMatrix(n)),hn.transformMat4(i.o,r.o,n),hn.transformMat4Normal(i.d,r.d,n));for(var u=s.subModels,l=0;l<u.length;l++){var c=u[l].subMesh,_=ZV(i,c,o);if(_)if(o.mode===du.CLOSEST)(0===t||t>_)&&(t=_,o.subIndices&&(o.subIndices[0]=l));else if(t=_,o.subIndices&&o.subIndices.push(l),o.mode===du.ANY)return _}return t&&o.mode===du.CLOSEST&&(o.result&&(o.result[0].distance=t,o.result.length=1),o.subIndices&&(o.subIndices.length=1)),t}}();us.rayModel=$V,us.raySubMesh=ZV,us.rayMesh=JV,oS("specular-pass");var tW,eW,iW,nW,rW,sW,aW,oW,hW,uW,lW,cW,_W,dW,fW,pW,mW,gW=t("dY",qs("cc.ModelRenderer")((qV=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._visFlags=QV&&QV(),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}(RU),QV=Gs(qV.prototype,"_visFlags",[ra],(function(){return sm.Enum.NONE})),KV=qV))||KV),vW=ra,yW=xa;t("d$",(tW=qs("cc.PrefabLink"),eW=yW(sL),tW((nW=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).prefab=rW&&rW(),e}return s(e,t),e}(op),rW=Gs(nW.prototype,"prefab",[eW,vW],(function(){return null})),iW=nW))||iW)),rt(SV,"Camera",[{name:"CameraClearFlag",newName:"ClearFlag"}]),rt(SV.prototype,"Camera.prototype",[{name:"color",newName:"clearColor"},{name:"depth",newName:"clearDepth"},{name:"stencil",newName:"clearStencil"}]),at(RU.prototype,"Renderer.prototype",[{name:"getMaterial",suggest:"please use renderer.getSharedMaterial instead."}]),v.CameraComponent=SV,Jt(SV,"cc.CameraComponent"),v.RenderableComponent=gW,Jt(gW,"cc.RenderableComponent"),function(t){t[t.SIMPLE=0]="SIMPLE",t[t.SLICED=1]="SLICED",t[t.TILED=2]="TILED"}(mW||(mW={})),t("e",(sW=qs("cc.SpriteRenderer"),aW=Zs(100),oW=xa(yF),sW(hW=aW((f((uW=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._spriteFrame=lW&&lW(),e._mode=cW&&cW(),e._color=_W&&_W(),e._flipX=dW&&dW(),e._flipY=fW&&fW(),e._size=pW&&pW(),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&&(v.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=v.director.root.createModel(IB);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|=om.POSITION,this._model.transform.hasChangedFlags|=om.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 aS.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=bg.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}(gW)).prototype,"spriteFrame",[oW],Object.getOwnPropertyDescriptor(uW.prototype,"spriteFrame"),uW.prototype),lW=Gs(uW.prototype,"_spriteFrame",[ra],(function(){return null})),cW=Gs(uW.prototype,"_mode",[ra],(function(){return mW.SIMPLE})),_W=Gs(uW.prototype,"_color",[ra],(function(){return pn.WHITE.clone()})),dW=Gs(uW.prototype,"_flipX",[ra],(function(){return!1})),fW=Gs(uW.prototype,"_flipY",[ra],(function(){return!1})),pW=Gs(uW.prototype,"_size",[ra],(function(){return new Fn})),hW=uW))||hW)||hW));var TW,SW,EW,AW,RW,bW,CW,wW,xW,IW,OW,DW,MW,PW,BW,NW,LW,FW,kW,UW,GW,HW,zW,VW,WW,XW=new Iz,jW="RICHTEXT_CHILD",YW="RICHTEXT_Image_CHILD",KW=new Fn,qW=new Fn,QW=new se((function(t){if(!v.isValid(t.node))return!1;var e=t.node.getComponent(Oz);return e&&(e.width=0),!0}),20),ZW=new se((function(t){return v.isValid(t.node)}),10);function JW(t){return{node:new $m(t),comp:null,lineCount:0,styleIndex:0,imageOffset:"",clickParam:"",clickHandler:"",type:t}}function $W(t,e){var i;t===jW?i=QW._get():t===YW&&(i=ZW._get());var n=(i=i||JW(t)).node;return n||(n=new $m(t)),n.hideFlags|=Wa.Flags.DontSave|Wa.Flags.HideInHierarchy,n.active=!0,t===YW?(i.comp=n.getComponent(dz)||n.addComponent(dz),i.comp.spriteFrame=e,i.comp.type=dz.Type.SLICED,i.comp.sizeMode=dz.SizeMode.CUSTOM):(i.comp=n.getComponent(fG)||n.addComponent(fG),i.comp.string=e,i.comp.horizontalAlign=aG.LEFT,i.comp.verticalAlign=oG.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 tX,eX=t("h",(TW=qs("cc.RichText"),SW=Zs(110),EW=xa(aG),AW=xa(oG),RW=xa(pn),bW=xa(bF),CW=xa(uG),wW=xa(SF),TW(xW=SW(((WW=function(t){function e(){var e;return(e=t.call(this)||this)._lineHeight=OW&&OW(),e._string=DW&&DW(),e._horizontalAlign=MW&&MW(),e._verticalAlign=PW&&PW(),e._fontSize=BW&&BW(),e._fontColor=NW&&NW(),e._maxWidth=LW&&LW(),e._fontFamily=FW&&FW(),e._font=kW&&kW(),e._isSystemFontUsed=UW&&UW(),e._userDefinedFont=GW&&GW(),e._cacheMode=HW&&HW(),e._imageAtlas=zW&&zW(),e._handleTouchEvent=VW&&VW(),e._textArray=[],e._segments=[],e._labelSegmentsCache=[],e._linesWidth=[],e._lineCount=1,e._labelWidth=0,e._labelHeight=0,e._layoutDirty=!0,e._lineOffsetX=0,e._updateRichTextStatus=void 0,e._labelChildrenNum=0,e._updateRichTextStatus=e._updateRichText,e}s(e,t);var i=e.prototype;return i.onLoad=function(){this.node.on(um.LAYER_CHANGED,this._applyLayer,this),this.node.on(um.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===jW?QW.put(i):i.type===YW&&ZW.put(i)}this.node.off(um.ANCHOR_CHANGED,this._updateRichTextPosition,this),this.node.off(um.LAYER_CHANGED,this._applyLayer,this)},i._addEventListeners=function(){this.node.on(um.TOUCH_END,this._onTouchEnded,this)},i._removeEventListeners=function(){this.node.off(um.TOUCH_END,this._onTouchEnded,this)},i._updateLabelSegmentTextAttributes=function(){var t=this;this._segments.forEach((function(e){t._applyTextAttribute(e)}))},i._createFontLabel=function(t){return $W(jW,t)},i._createImage=function(t){return $W(YW,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(KW,e,t),KW.x<2048)i.push(t);else for(var n=t.split("\n"),r=0;r<n.length;r++)if(this._calculateSize(KW,e,n[r]),KW.x<2048)i.push(n[r]);else{var s=this.splitLongStringOver2048(n[r],e);i.push.apply(i,s)}return i},i.splitLongStringOver2048=function(t,e){var i=[],n=t,r=0,s=n.length/2,a=n.substring(r,s),o=n.substring(s),h=this._calculateSize(KW,e,a),u=this._calculateSize(qW,e,o),l=this._maxWidth;0===this._maxWidth&&(l=2047.9);for(var c=1*l;h.x>c;){if((s/=2)<1){s*=2;break}a=a.substring(r,s),o=n.substring(s),this._calculateSize(h,e,a)}for(var _=1e3,d=1;_&&r<t.length;){for(;_&&h.x<c;){var f=tk(o);f&&f.length>0&&(d=f[0].length),s+=d,a=n.substring(r,s),o=n.substring(s),this._calculateSize(h,e,a),_--}for(;_&&a.length>=2&&h.x>c;)s-=d,a=n.substring(r,s),this._calculateSize(h,e,a),d=1,_--;if(a.length>=2){var p=ek(a);p&&p.length>0&&a!==p[0]&&(s-=p[0].length,a=n.substring(r,s))}if(i.push(a),r=s,s+=a.length,a=n.substring(r,s),o=n.substring(s),this._calculateSize(u,e,o),this._calculateSize(h,e,a),_--,u.x<2048&&h.x<c){i.push(a),r=t.length,s=t.length,a=o,""!==o&&i.push(a);break}}return i},i._measureText=function(t,e){var i=this,n=function(e){return i._calculateSize(KW,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(fG).string=i,n.styleIndex=e,this._applyTextAttribute(n);var r=n.node._uiProps.uiTransformComp.contentSize;return Fn.set(t,r.x,r.y),t},i._onTouchEnded=function(t){for(var e,i=this,n=this.node.getComponents(op),r=function(){var r=e.value,s=r.clickHandler,a=r.clickParam;s&&i._containsTouchLocation(r,t.touch.getUILocation())&&(n.forEach((function(e){var i=e[s];e.enabledInHierarchy&&i&&i.call(e,t,a)})),t.propagationStopped=!0)},s=d(this._segments);!(e=s()).done;)r()},i._containsTouchLocation=function(t,e){var i=t.node.getComponent(oU);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===jW||i.name===YW){i.parent=null;var n=JW(i.name);n.node=i,i.name===jW?(n.comp=i.getComponent(fG),QW.put(n)):(n.comp=i.getComponent(dz),ZW.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!==jW&&i.name!==YW||(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(fG);n&&(n.string=t)}var r=i.comp;return r.verticalAlign!==this._verticalAlign&&(r.verticalAlign=this._verticalAlign),i.styleIndex=e,i.lineCount=this._lineCount,i.node._uiProps.uiTransformComp.setAnchorPoint(0,0),i.node.layer=this.node.layer,this.node.insertChild(i.node,this._labelChildrenNum++),this._applyTextAttribute(i),this._segments.push(i),i},i._updateRichTextWithMaxWidth=function(t,e,i){var n=e;if(this._lineOffsetX>0&&n+this._lineOffsetX>this._maxWidth)for(var r=0;this._lineOffsetX<=this._maxWidth;){var s=this._getFirstWordLen(t,r,t.length),a=t.substr(r,s),o=this._measureText(i,a);if(!(this._lineOffsetX+o<=this._maxWidth)){if(r>0){var h=t.substr(0,r);this._addLabelSegment(h,i),t=t.substr(r,t.length),n=this._measureText(i,t)}this._updateLineInfo();break}this._lineOffsetX+=o,r+=s}if(n>this._maxWidth)for(var u=ik(t,n,this._maxWidth,this._measureText(i)),l=0;l<u.length;++l){var c=u[l],_=this._addLabelSegment(c,i).node._uiProps.uiTransformComp.contentSize;this._lineOffsetX+=_.width,u.length>1&&l<u.length-1&&this._updateLineInfo()}else this._lineOffsetX+=n,this._addLabelSegment(t,i)},i._isLastComponentCR=function(t){return t.length-1===t.lastIndexOf("\n")},i._updateLineInfo=function(){this._linesWidth.push(this._lineOffsetX),this._lineOffsetX=0,this._lineCount++},i._needsUpdateTextLayout=function(t){if(this._layoutDirty||!this._textArray||!t)return!0;if(this._textArray.length!==t.length)return!0;for(var e=0;e<this._textArray.length;e++){var i=this._textArray[e],n=t[e];if(i.text!==n.text)return!0;var r=i.style,s=n.style;if(r){if(s){if(!!s.outline!=!!r.outline)return!0;if(r.size!==s.size||r.italic!==s.italic||r.isImage!==s.isImage)return!0;if(r.src!==s.src||r.imageAlign!==s.imageAlign||r.imageHeight!==s.imageHeight||r.imageWidth!==s.imageWidth||r.imageOffset!==s.imageOffset)return!0}else if(r.size||r.italic||r.isImage||r.outline)return!0}else if(s&&(s.size||s.italic||s.isImage||s.outline))return!0}return!1},i._addRichTextImageElement=function(t){if(t.style){var e=t.style,i=e.src,n=this._imageAtlas&&i&&this._imageAtlas.getSpriteFrame(i);if(n){var r=this._createImage(n);switch(r.comp,e.imageAlign){case"top":r.node._uiProps.uiTransformComp.setAnchorPoint(0,1);break;case"center":r.node._uiProps.uiTransformComp.setAnchorPoint(0,.5);break;default:r.node._uiProps.uiTransformComp.setAnchorPoint(0,0)}e.imageOffset&&(r.imageOffset=e.imageOffset),r.node.layer=this.node.layer,this.node.insertChild(r.node,this._labelChildrenNum++),this._segments.push(r);var s=n.rect.clone(),a=1,o=s.width,h=s.height,u=e.imageWidth||0,l=e.imageHeight||0;l>0?(o*=a=l/h,h*=a):(o*=a=this._lineHeight/h,h*=a),u>0&&(o=u),this._maxWidth>0?(this._lineOffsetX+o>this._maxWidth&&this._updateLineInfo(),this._lineOffsetX+=o):(this._lineOffsetX+=o,this._lineOffsetX>this._labelWidth&&(this._labelWidth=this._lineOffsetX)),r.node._uiProps.uiTransformComp.setContentSize(o,h),r.lineCount=this._lineCount,r.clickHandler="",r.clickParam="";var c=e.event;c&&(r.clickHandler=c.click,r.clickParam=c.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(fG);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=XW.parse(this._string);if(!this._needsUpdateTextLayout(t))return this._textArray=t.slice(),void this._updateLabelSegmentTextAttributes();this._textArray=t.slice(),this._resetState();for(var e,i=!1,n=0;n<this._textArray.length;++n){var r=this._textArray[n],s=r.text;if(void 0!==s){if(""===s){if(r.style&&r.style.isNewLine){this._updateLineInfo();continue}if(r.style&&r.style.isImage&&this._imageAtlas){this._addRichTextImageElement(r);continue}}for(var a=(s=this.splitLongStringApproximatelyIn2048(s,n).join("\n")).split("\n"),o=0;o<a.length;++o){var h=a[o];if(""!==h)if(i=!1,this._maxWidth>0){var u=this._measureText(n,h);this._updateRichTextWithMaxWidth(h,u,n),a.length>1&&o<a.length-1&&this._updateLineInfo()}else e=this._addLabelSegment(h,n),this._lineOffsetX+=e.node._uiProps.uiTransformComp.width,this._lineOffsetX>this._labelWidth&&(this._labelWidth=this._lineOffsetX),a.length>1&&o<a.length-1&&this._updateLineInfo();else{if(this._isLastComponentCR(s)&&o===a.length-1)continue;this._updateLineInfo(),i=!0}}}}i||this._linesWidth.push(this._lineOffsetX),this._maxWidth>0&&(this._labelWidth=this._maxWidth),this._labelHeight=(this._lineCount+GF)*this._lineHeight,this.node._uiProps.uiTransformComp.setContentSize(this._labelWidth,this._labelHeight),this._updateRichTextPosition(),this._layoutDirty=!1}},i._getFirstWordLen=function(t,e,i){var n=t.charAt(e);if(QF(n)||ZF(n))return 1;for(var r=1,s=e+1;s<i&&!ZF(n=t.charAt(s))&&!QF(n);++s)r++;return r},i._updateRichTextPosition=function(){for(var t=0,e=1,i=this._lineCount,n=this.node._uiProps.uiTransformComp,r=n.anchorX,s=n.anchorY,a=0;a<this._segments.length;++a){var o=this._segments[a],h=o.lineCount;h>e&&(t=0,e=h);var u=this._labelWidth*(.5*this._horizontalAlign-r);switch(this._horizontalAlign){case aG.LEFT:break;case aG.CENTER:u-=this._linesWidth[h-1]/2;break;case aG.RIGHT:u-=this._linesWidth[h-1]}var l=o.node.position;if(o.node.setPosition(t+u,this._lineHeight*(i-h)-this._labelHeight*s,l.z),h===e&&(t+=o.node._uiProps.uiTransformComp.width),o.node.getComponent(dz)){var c=o.node.position.clone(),_=this._lineHeight,d=this._lineHeight*(1+GF);switch(o.node._uiProps.uiTransformComp.anchorY){case 1:c.y+=_+(d-_)/2;break;case.5:c.y+=d/2;break;default:c.y+=(d-_)/2}if(o.imageOffset){var f=o.imageOffset.split(",");if(1===f.length&&f[0]){var p=parseFloat(f[0]);Number.isInteger(p)&&(c.y+=p)}else if(2===f.length){var m=parseFloat(f[0]),g=parseFloat(f[1]);Number.isInteger(m)&&(c.x+=m),Number.isInteger(g)&&(c.y+=g)}}o.node.position=c}var v=o.node.getComponent(Oz);if(v){var y=o.node.position.clone();y.y-=v.width,o.node.position=y}}},i._convertLiteralColorValue=function(t){var e=t.toUpperCase();return pn[e]?pn[e]:(new pn).fromHEX(t)},i._applyTextAttribute=function(t){var e=t.node.getComponent(fG);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(Oz);r||(r=t.node.addComponent(Oz)),r.color=this._convertLiteralColorValue(i.outline.color),r.width=i.outline.width}e.fontSize=i.size||this._fontSize,t.clickHandler="",t.clickParam="";var s=i.event;s&&(t.clickHandler=s.click||"",t.clickParam=s.param||"")}e.cacheMode=this._cacheMode,this._font instanceof bF&&!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}(op)).HorizontalAlign=aG,WW.VerticalAlign=oG,f((IW=WW).prototype,"horizontalAlign",[EW],Object.getOwnPropertyDescriptor(IW.prototype,"horizontalAlign"),IW.prototype),f(IW.prototype,"verticalAlign",[AW],Object.getOwnPropertyDescriptor(IW.prototype,"verticalAlign"),IW.prototype),f(IW.prototype,"fontColor",[RW],Object.getOwnPropertyDescriptor(IW.prototype,"fontColor"),IW.prototype),f(IW.prototype,"font",[bW],Object.getOwnPropertyDescriptor(IW.prototype,"font"),IW.prototype),f(IW.prototype,"cacheMode",[CW],Object.getOwnPropertyDescriptor(IW.prototype,"cacheMode"),IW.prototype),f(IW.prototype,"imageAtlas",[wW],Object.getOwnPropertyDescriptor(IW.prototype,"imageAtlas"),IW.prototype),OW=Gs(IW.prototype,"_lineHeight",[ra],(function(){return 40})),DW=Gs(IW.prototype,"_string",[ra],(function(){return"<color=#00ff00>Rich</color><color=#0fffff>Text</color>"})),MW=Gs(IW.prototype,"_horizontalAlign",[ra],(function(){return aG.LEFT})),PW=Gs(IW.prototype,"_verticalAlign",[ra],(function(){return oG.TOP})),BW=Gs(IW.prototype,"_fontSize",[ra],(function(){return 40})),NW=Gs(IW.prototype,"_fontColor",[ra],(function(){return pn.WHITE.clone()})),LW=Gs(IW.prototype,"_maxWidth",[ra],(function(){return 0})),FW=Gs(IW.prototype,"_fontFamily",[ra],(function(){return"Arial"})),kW=Gs(IW.prototype,"_font",[ra],(function(){return null})),UW=Gs(IW.prototype,"_isSystemFontUsed",[ra],(function(){return!0})),GW=Gs(IW.prototype,"_userDefinedFont",[ra],(function(){return null})),HW=Gs(IW.prototype,"_cacheMode",[ra],(function(){return uG.NONE})),zW=Gs(IW.prototype,"_imageAtlas",[ra],(function(){return null})),VW=Gs(IW.prototype,"_handleTouchEvent",[ra],(function(){return!0})),xW=IW))||xW)||xW));v.RichText=eX;var iX=t("j",qs("cc.UIMeshRenderer")(tX=Zs(110)(tX=function(t){function e(){var e;return(e=t.call(this)||this)._modelComponent=null,e._dirtyVersion=-1,e._internalId=-1,e.stencilStage=Rk.DISABLED,e._renderData=null,e._renderEntity=new Kk(Dk.DYNAMIC),e}s(e,t);var i=e.prototype;return i.__preload=function(){this.node._uiProps.uiComp=this},i.onEnable=function(){aL.addRenderer(this),this.markForUpdateRenderData()},i.onDisable=function(){aL.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):U("node '"+(this.node&&this.node.name)+"' doesn't have any renderable component")},i.onDestroy=function(){this.renderEntity.setNode(null),this.node._uiProps.uiComp===this&&(this.node._uiProps.uiComp=null),this._modelComponent=this.getComponent("cc.ModelRenderer"),this._modelComponent&&(this._modelComponent._sceneGetter=null)},i._render=function(t){if(this._modelComponent){var e=this._modelComponent._collectModels();this._modelComponent._detachFromScene();for(var i=0;i<e.length;i++)e[i].enabled&&t.commitModel(this,e[i],this._modelComponent.material);return!0}return!1},i.fillBuffers=function(t){this.enabled&&this._render(t)},i.updateRenderer=function(){},i._uploadRenderData=function(){},i.postUpdateAssembler=function(){},i.update=function(){this._fitUIRenderQueue()},i._fitUIRenderQueue=function(){if(this._modelComponent)for(var t=this._modelComponent.sharedMaterials.length,e=0;e<t;e++){var i=this._modelComponent.getMaterialInstance(e);if(null!=i)for(var n=i.passes,r=n.length,s=0;s<r;s++)n[s].setPriority(vg.MAX-11),i.recompileShaders({CC_FORCE_FORWARD_SHADING:!0},s)}},i.markForUpdateRenderData=function(){aL.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}(op))||tX)||tX);v.UIMeshRenderer=iX;var nX,rX,sX,aX,oX,hX,uX=sm.Enum.NONE|sm.Enum.UI_3D,lX=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=uX,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=uX},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 _S(v.director.root));var a=r[s],o=this._passes[s];a.update(),e||(e=a.depthStencilState,i=0),o._initPassFromTarget(a,e,i),this._shaders[s]=o.getShaderVariant(n)}}},n(t,[{key:"inputAssembler",get:function(){return this._inputAssembler},set:function(t){this._inputAssembler=t}},{key:"descriptorSet",get:function(){return this._descriptorSet},set:function(t){this._descriptorSet=t}},{key:"visFlags",get:function(){return this._visFlags},set:function(t){this._visFlags=t}},{key:"passes",get:function(){return this._passes}},{key:"shaders",get:function(){return this._shaders}}]),t}(),cX=t("m",qs("cc.UIStaticBatch")(nX=Zs(110)((f((rX=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._init=!1,e._bufferAccessor=null,e._dirty=!0,e._uiDrawBatchList=[],e}s(e,t);var i=e.prototype;return i.postUpdateAssembler=function(){},i.markAsDirty=function(){},i._requireDrawBatch=function(){var t=new lX;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 gL.root&&gL.root.batcher2D?gL.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}(bU)).prototype,"color",[Ia],Object.getOwnPropertyDescriptor(rX.prototype,"color"),rX.prototype),nX=rX))||nX)||nX),_X=t("n",qs("cc.LabelShadow")(sX=Zs(110)(sX=Qs(fG)(sX=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.onEnable=function(){this.node.getComponent(fG).enableShadow=!0},i.onDisable=function(){this.node.getComponent(fG).enableShadow=!1},n(e,[{key:"color",get:function(){return this.node.getComponent(fG).shadowColor},set:function(t){this.node.getComponent(fG).shadowColor=t}},{key:"offset",get:function(){return this.node.getComponent(fG).shadowOffset},set:function(t){this.node.getComponent(fG).shadowOffset=t}},{key:"blur",get:function(){return this.node.getComponent(fG).shadowBlur},set:function(t){this.node.getComponent(fG).shadowBlur=t}}]),e}(op))||sX)||sX)||sX),dX=t("o",qs("cc.UIOpacity")(aX=Zs(110)(aX=Js((oX=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)._setByParent=!1,e._opacity=hX&&hX(),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._uiProps.uiComp,a=t.getComponent(e),o=n;s&&s.color?(s.renderEntity.colorDirty=i,a?(s.renderEntity.localOpacity=o*a.opacity/255,a._setByParent=r):s.renderEntity.localOpacity=o,s.node._uiProps.localOpacity=s.renderEntity.localOpacity,o=1):a&&(o=o*a.opacity/255,a._setByParent=r);for(var h=0;h<t.children.length;h++)e.setEntityLocalOpacityDirtyRecursively(t.children[h],i||o<1,o,!0)}},i.onEnable=function(){this._setByParent||(this.node._uiProps.localOpacity=this._opacity/255,this.setEntityLocalOpacityDirtyRecursively(!0))},i.onDisable=function(){this._setByParent||(this.node._uiProps.localOpacity=1,this.setEntityLocalOpacityDirtyRecursively(!0))},n(e,[{key:"opacity",get:function(){return this._opacity},set:function(t){this._opacity!==t&&(t=ke(t,0,255),this._opacity=t,this.node._uiProps.localOpacity=t/255,this.setEntityLocalOpacityDirtyRecursively(!0))}}]),e}(op),hX=Gs(oX.prototype,"_opacity",[ra],(function(){return 255})),aX=oX))||aX)||aX)||aX);v.MaskComponent=yz,Jt(yz,"cc.MaskComponent"),v.LabelComponent=fG,Jt(fG,"cc.LabelComponent"),v.LabelOutlineComponent=Oz,Jt(Oz,"cc.LabelOutlineComponent"),v.RichTextComponent=eX,Jt(eX,"cc.RichTextComponent"),v.SpriteComponent=dz,Jt(dz,"cc.SpriteComponent"),v.UIModelComponent=iX,Jt(iX,"cc.UIModelComponent"),v.GraphicsComponent=iz,Jt(iz,"cc.GraphicsComponent"),Jt(cX,"cc.UIStaticBatchComponent"),Jt(dX,"cc.UIOpacityComponent"),rt(yz.prototype,"Mask",[{name:"graphics",newName:"subComp",target:yz.prototype,targetName:"Mask"}]),rt(fz,"MaskType",[{name:"RECT",newName:"GRAPHICS_RECT",target:fz,targetName:"MaskType"},{name:"ELLIPSE",newName:"GRAPHICS_ELLIPSE",target:fz,targetName:"MaskType"},{name:"IMAGE_STENCIL",newName:"SPRITE_STENCIL",target:fz,targetName:"MaskType"}]),at(Oz.prototype,"LabelOutline",[{name:"width",suggest:"Please use Label.outlineWidth instead."},{name:"color",suggest:"Please use Label.outlineColor instead."}]),at(_X.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 fX=function(t,e,i){this.i=void 0,this.x=void 0,this.y=void 0,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1,this.i=t,this.x=e,this.y=i};function pX(t,e,i,n,r){var s=0,a=null;if(r===function(t,e,i,n){for(var r=0,s=e,a=i-n;s<i;s+=n)r+=(t[a]-t[s])*(t[s+1]+t[a+1]),a=s;return r}(t,e,i,n)>0)for(s=e;s<i;s+=n)a=PX(s,t[s],t[s+1],a);else for(s=i-n;s>=e;s-=n)a=PX(s,t[s],t[s+1],a);return a&&IX(a,a.next)&&(BX(a),a=a.next),a}function mX(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||!IX(i,i.next)&&0!==xX(i.prev,i,i.next))i=i.next;else{if(BX(i),(i=e=i.prev)===i.next)return null;n=!0}}while(n||i!==e);return e}function gX(t,e,i,n,r,s,a){if(void 0===a&&(a=0),t){!a&&s&&function(t,e,i,n){var r=t;do{null===r.z&&(r.z=RX(r.x,r.y,e,i,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){var e=0,i=null,n=null,r=null,s=null,a=0,o=0,h=0,u=1;do{for(i=t,t=null,s=null,a=0;i;){for(a++,n=i,o=0,e=0;e<u&&(o++,n=n.nextZ);e++);for(h=u;o>0||h>0&&n;)0===o?(r=n,n=n.nextZ,h--):0!==h&&n?i.z<=n.z?(r=i,i=i.nextZ,o--):(r=n,n=n.nextZ,h--):(r=i,i=i.nextZ,o--),s?s.nextZ=r:t=r,r.prevZ=s,s=r;i=n}s.nextZ=null,u*=2}while(a>1)}(r)}(t,n,r,s);for(var o=t,h=null,u=null;t.prev!==t.next;)if(h=t.prev,u=t.next,s?yX(t,n,r,s):vX(t))e.push(h.i/i),e.push(t.i/i),e.push(u.i/i),BX(t),t=u.next,o=u.next;else if((t=u)===o){a?1===a?gX(t=TX(t,e,i),e,i,n,r,s,2):2===a&&SX(t,e,i,n,r,s):gX(mX(t),e,i,n,r,s,1);break}}}function vX(t){var e=t.prev,i=t,n=t.next;if(xX(e,i,n)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(CX(e.x,e.y,i.x,i.y,n.x,n.y,r.x,r.y)&&xX(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function yX(t,e,i,n){var r=t.prev,s=t,a=t.next;if(xX(r,s,a)>=0)return!1;for(var o=r.x<s.x?r.x<a.x?r.x:a.x:s.x<a.x?s.x:a.x,h=r.y<s.y?r.y<a.y?r.y:a.y:s.y<a.y?s.y:a.y,u=r.x>s.x?r.x>a.x?r.x:a.x:s.x>a.x?s.x:a.x,l=r.y>s.y?r.y>a.y?r.y:a.y:s.y>a.y?s.y:a.y,c=RX(o,h,e,i,n),_=RX(u,l,e,i,n),d=t.nextZ;d&&d.z<=_;){if(d!==t.prev&&d!==t.next&&CX(r.x,r.y,s.x,s.y,a.x,a.y,d.x,d.y)&&xX(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(d=t.prevZ;d&&d.z>=c;){if(d!==t.prev&&d!==t.next&&CX(r.x,r.y,s.x,s.y,a.x,a.y,d.x,d.y)&&xX(d.prev,d,d.next)>=0)return!1;d=d.prevZ}return!0}function TX(t,e,i){var n=t;do{var r=n.prev,s=n.next.next;!IX(r,s)&&OX(r,n,n.next,s)&&DX(r,s)&&DX(s,r)&&(e.push(r.i/i),e.push(n.i/i),e.push(s.i/i),BX(n),BX(n.next),n=t=s),n=n.next}while(n!==t);return n}function SX(t,e,i,n,r,s){var a=t;do{for(var o=a.next.next;o!==a.prev;){if(a.i!==o.i&&wX(a,o)){var h=MX(a,o);return a=mX(a,a.next),h=mX(h,h.next),gX(a,e,i,n,r,s),void gX(h,e,i,n,r,s)}o=o.next}a=a.next}while(a!==t)}function EX(t,e){return t.x-e.x}function AX(t,e){if(e=function(t,e){var i=e,n=t.x,r=t.y,s=-1/0,a=null;do{if(r<=i.y&&r>=i.next.y){var o=i.x+(r-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(o<=n&&o>s){if(s=o,o===n){if(r===i.y)return i;if(r===i.next.y)return i.next}a=i.x<i.next.x?i:i.next}}i=i.next}while(i!==e);if(!a)return null;if(n===s)return a.prev;var h,u=a,l=a.x,c=a.y,_=1/0;for(i=a.next;i!==u;)n>=i.x&&i.x>=l&&CX(r<c?n:s,r,l,c,r<c?s:n,r,i.x,i.y)&&((h=Math.abs(r-i.y)/(n-i.x))<_||h===_&&i.x>a.x)&&DX(i,t)&&(a=i,_=h),i=i.next;return a}(t,e)){var i=MX(e,t);mX(i,i.next)}}function RX(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 bX(t){var e=t,i=t;do{e.x<i.x&&(i=e),e=e.next}while(e!==t);return i}function CX(t,e,i,n,r,s,a,o){return(r-a)*(e-o)-(t-a)*(s-o)>=0&&(t-a)*(n-o)-(i-a)*(e-o)>=0&&(i-a)*(s-o)-(r-a)*(n-o)>=0}function wX(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&&OX(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&DX(t,e)&&DX(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 xX(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function IX(t,e){return t.x===e.x&&t.y===e.y}function OX(t,e,i,n){return!!(IX(t,e)&&IX(i,n)||IX(t,n)&&IX(i,e))||xX(t,e,i)>0!=xX(t,e,n)>0&&xX(i,n,t)>0!=xX(i,n,e)>0}function DX(t,e){return xX(t.prev,t,t.next)<0?xX(t,e,t.next)>=0&&xX(t,t.prev,e)>=0:xX(t,e,t.prev)<0||xX(t,t.next,e)<0}function MX(t,e){var i=new fX(t.i,t.x,t.y),n=new fX(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 PX(t,e,i,n){var r=new fX(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 BX(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 NX(t,e,i){i=i||3;var n=e?e.length:0,r=n?e[0]*i:t.length,s=pX(t,0,r,i,!0),a=[];if(!s)return a;var o=0,h=0,u=0,l=0,c=0,_=0,d=0;if(n&&(s=function(t,e,i,n){var r,s=[],a=0,o=null;for(a=0,r=e.length;a<r;a++)(o=pX(t,e[a]*n,a<r-1?e[a+1]*n:t.length,n,!1))&&(o===o.next&&(o.steiner=!0),s.push(bX(o)));if(s.sort(EX),!i)return i;for(a=0;a<s.length;a++)AX(s[a],i),i=mX(i,i.next);return i}(t,e,s,i)),t.length>80*i){o=u=t[0],h=l=t[1];for(var f=i;f<r;f+=i)(c=t[f])<o&&(o=c),(_=t[f+1])<h&&(h=_),c>u&&(u=c),_>l&&(l=_);d=Math.max(u-o,l-h)}return gX(s,a,i,o,h,d),a}for(var LX=Math.PI,FX=Math.min,kX=Math.max,UX=Math.ceil,GX=Math.acos,HX=Math.cos,zX=Math.sin,VX=Math.atan2,WX=null,XX=null,jX=new pn,YX=[],KX=0;KX<4;KX++)YX.push(new hn);function qX(t,e,i){return t<e?e:t>i?i:t}var QX={useModel:!0,updateRenderData:function(){},fillBuffers:function(){},renderIA:function(){},getRenderData:function(t,e){if(!XX)return null;var i=XX.getRenderDataList(),n=i[XX.dataOffset];if(!n)return null;var r=n,s=r?r.vertexStart+e:0;return(s>65535||3*s>131070)&&(++XX.dataOffset,XX.dataOffset<i.length?n=i[XX.dataOffset]:(n=XX.requestRenderData(),i[XX.dataOffset]=n),r=n),r&&r.vertexCount<s&&r.request(e,3*e),n},stroke:function(t){pn.copy(jX,t.strokeColor),t.impl&&(this._flattenPaths(t.impl),this._expandStroke(t),t.impl.updatePathOffset=!0,this.end(t))},fill:function(t){pn.copy(jX,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(XX=t.impl){var s=function(t,e,i){var n=2*GX(t/(t+i));return kX(2,UX(e/n))}(e,LX,XX.tessTol);this._calculateJoins(XX,e,n,r);for(var a=XX.paths,o=0,h=XX.pathOffset,u=XX.pathLength;h<u;h++){var l=a[h],c=l.points.length;n===$G.ROUND?o+=2*(c+l.bevel*(s+2)+1):o+=2*(c+5*l.bevel+1),l.closed||(i===JG.ROUND?o+=2*(2*s+2):o+=12)}var _=WX=this.getRenderData(t,o);if(_){for(var d=_.vData,f=_.iData,p=XX.pathOffset,m=XX.pathLength;p<m;p++){var g=a[p],v=g.points,y=v.length,T=_.vertexStart,S=void 0,E=void 0,A=0,R=0,b=g.closed;if(b?(S=v[y-1],E=v[0],A=0,R=y):(S=v[0],E=v[1],A=1,R=y-1),E=E||S,!b){var C=new QH(E.x,E.y);C.subtract(S),C.normalize();var w=C.x,x=C.y;i===JG.BUTT?this._buttCapStart(S,w,x,e,0):i===JG.SQUARE?this._buttCapStart(S,w,x,e,e):i===JG.ROUND&&this._roundCapStart(S,w,x,e,s)}for(var I=A;I<R;++I)n===$G.ROUND?this._roundJoin(S,E,e,e,s):0!=(E.flags&(tH.PT_BEVEL|tH.PT_INNERBEVEL))?this._bevelJoin(S,E,e,e):(this._vSet(E.x+E.dmx*e,E.y+E.dmy*e,1),this._vSet(E.x-E.dmx*e,E.y-E.dmy*e,-1)),S=E,E=v[I+1];if(b){var O=8*T;this._vSet(d[O],d[O+1],1),this._vSet(d[O+8],d[O+8+1],-1)}else{var D=new QH(E.x,E.y);D.subtract(S),D.normalize();var M=D.x,P=D.y;i===JG.BUTT?this._buttCapEnd(E,M,P,e,0):i===JG.SQUARE?this._buttCapEnd(E,M,P,e,e):i===JG.ROUND&&this._roundCapEnd(E,M,P,e,s)}for(var B=_.indexStart,N=T+2,L=_.vertexStart;N<L;N++)f[B++]=N-2,f[B++]=N-1,f[B++]=N;_.indexStart=B}WX=null,XX=null}}},_expandFill:function(t){if(XX=t.impl){for(var e=XX.paths,i=0,n=XX.pathOffset,r=XX.pathLength;n<r;n++)i+=e[n].points.length;var s=WX=this.getRenderData(t,i);if(s){for(var a=s,o=a.vData,h=a.iData,u=XX.pathOffset,l=XX.pathLength;u<l;u++){var c=e[u],_=c.points,d=_.length;if(0!==d){for(var f=s.vertexStart,p=0;p<d;++p)this._vSet(_[p].x,_[p].y);var m=s.indexStart;if(c.complex){for(var g=[],v=f,y=s.vertexStart;v<y;v++){var T=8*v;g.push(o[T++]),g.push(o[T++]),g.push(o[T++])}var S=NX(g,null,3);if(!S||0===S.length)continue;for(var E=0,A=S.length;E<A;E++)h[m++]=S[E]+f}else for(var R=f,b=f+2,C=a.vertexStart;b<C;b++)h[m++]=R,h[m++]=b-1,h[m++]=b;a.indexStart=m}}WX=null,XX=null}}},_calculateJoins:function(t,e,i,n){var r=0;e>0&&(r=1/e);for(var s=t.paths,a=t.pathOffset,o=t.pathLength;a<o;a++){var h=s[a],u=h.points,l=u.length,c=u[l-1],_=u[0];h.bevel=0;for(var d=0;d<l;d++){var f,p,m=c.dy,g=-c.dx,v=_.dy,y=-_.dx;if(_.dmx=.5*(m+v),_.dmy=.5*(g+y),(f=_.dmx*_.dmx+_.dmy*_.dmy)>1e-6){var T=1/f;T>600&&(T=600),_.dmx*=T,_.dmy*=T}_.dx*c.dy-c.dx*_.dy>0&&(_.flags|=tH.PT_LEFT),f*(p=kX(11,FX(c.len,_.len)*r))*p<1&&(_.flags|=tH.PT_INNERBEVEL),_.flags&tH.PT_CORNER&&(f*n*n<1||i===$G.BEVEL||i===$G.ROUND)&&(_.flags|=tH.PT_BEVEL),0!=(_.flags&(tH.PT_BEVEL|tH.PT_INNERBEVEL))&&h.bevel++,c=_,_=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,a=s[s.length-1],o=s[0];s.length>2&&a.equals(o)&&(r.closed=!0,s.pop(),a=s[s.length-1]);for(var h=0,u=s.length;h<u;h++){var l=new QH(o.x,o.y);l.subtract(a),a.len=l.length(),(l.x||l.y)&&l.normalize(),a.dx=l.x,a.dy=l.y,a=o,o=s[h+1]}}},_chooseBevel:function(t,e,i,n){var r=i.x,s=i.y,a=0,o=0,h=0,u=0;return 0!==t?(a=r+e.dy*n,o=s-e.dx*n,h=r+i.dy*n,u=s-i.dx*n):(a=h=r+i.dmx*n,o=u=s+i.dmy*n),[a,o,h,u]},_buttCapStart:function(t,e,i,n,r){var s=t.x-e*r,a=t.y-i*r,o=i,h=-e;this._vSet(s+o*n,a+h*n,1),this._vSet(s-o*n,a-h*n,-1)},_buttCapEnd:function(t,e,i,n,r){var s=t.x+e*r,a=t.y+i*r,o=i,h=-e;this._vSet(s+o*n,a+h*n,1),this._vSet(s-o*n,a-h*n,-1)},_roundCapStart:function(t,e,i,n,r){for(var s=t.x,a=t.y,o=i,h=-e,u=0;u<r;u++){var l=u/(r-1)*LX,c=HX(l)*n,_=zX(l)*n;this._vSet(s-o*c-e*_,a-h*c-i*_,1),this._vSet(s,a,0)}this._vSet(s+o*n,a+h*n,1),this._vSet(s-o*n,a-h*n,-1)},_roundCapEnd:function(t,e,i,n,r){var s=t.x,a=t.y,o=i,h=-e;this._vSet(s+o*n,a+h*n,1),this._vSet(s-o*n,a-h*n,-1);for(var u=0;u<r;u++){var l=u/(r-1)*LX,c=HX(l)*n,_=zX(l)*n;this._vSet(s,a,0),this._vSet(s-o*c+e*_,a-h*c+i*_,1)}},_roundJoin:function(t,e,i,n,r){var s=t.dy,a=-t.dx,o=e.dy,h=-e.dx,u=e.x,l=e.y;if(0!=(e.flags&tH.PT_LEFT)){var c=this._chooseBevel(e.flags&tH.PT_INNERBEVEL,t,e,i),_=c[0],d=c[1],f=c[2],p=c[3],m=VX(-a,-s),g=VX(-h,-o);g>m&&(g-=2*LX),this._vSet(_,d,1),this._vSet(u-s*n,e.y-a*n,-1);for(var v=qX(UX((m-g)/LX)*r,2,r),y=0;y<v;y++){var T=m+y/(v-1)*(g-m),S=u+HX(T)*n,E=l+zX(T)*n;this._vSet(u,l,0),this._vSet(S,E,-1)}this._vSet(f,p,1),this._vSet(u-o*n,l-h*n,-1)}else{var A=this._chooseBevel(e.flags&tH.PT_INNERBEVEL,t,e,-n),R=A[0],b=A[1],C=A[2],w=A[3],x=VX(a,s),I=VX(h,o);I<x&&(I+=2*LX),this._vSet(u+s*n,l+a*n,1),this._vSet(R,b,-1);for(var O=qX(UX((I-x)/LX)*r,2,r),D=0;D<O;D++){var M=x+D/(O-1)*(I-x),P=u+HX(M)*i,B=l+zX(M)*i;this._vSet(P,B,1),this._vSet(u,l,0)}this._vSet(u+o*n,l+h*n,1),this._vSet(C,w,-1)}},_bevelJoin:function(t,e,i,n){var r=0,s=0,a=0,o=0,h=0,u=0,l=0,c=0,_=t.dy,d=-t.dx,f=e.dy,p=-e.dx;if(e.flags&tH.PT_LEFT){var m=this._chooseBevel(e.flags&tH.PT_INNERBEVEL,t,e,i);h=m[0],u=m[1],l=m[2],c=m[3],this._vSet(h,u,1),this._vSet(e.x-_*n,e.y-d*n,-1),this._vSet(l,c,1),this._vSet(e.x-f*n,e.y-p*n,-1)}else{var g=this._chooseBevel(e.flags&tH.PT_INNERBEVEL,t,e,-n);r=g[0],s=g[1],a=g[2],o=g[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(a,o,-1)}},_vSet:function(t,e,i){if(void 0===i&&(i=0),WX){var n=WX,r=8*n.vertexStart,s=n.vData;s[r++]=t,s[r++]=e,s[r++]=0,pn.toArray(s,jX,r),r+=4,s[r++]=i,n.vertexStart++}}},ZX=t("g",{getAssembler:function(){return QX}});iz.Assembler=ZX;var JX=["left","center","right"],$X=2048,tj=(1/255).toFixed(3),ej=function(){this.char="",this.valid=!0,this.x=0,this.y=0,this.line=0,this.hash=""},ij=function(){function t(){this._context=null,this._canvas=null,this._canvasData=null,this._lettersInfo=[],this._tmpRect=new Vn,this._maxFontSize=100,this._fontScale=1,this._canvasData=rk.getInstance().get(),this._canvas=this._canvasData.canvas,this._context=this._canvasData.context}var e=t.prototype;return e.destroy=function(){rk.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),ck.fontScale=this._fontScale,this._setupBMFontOverflowMetrics(i,n),this._updateFontScale(e),this._computeHorizontalKerningForText(e,i,r),this._alignText(e,i,n,r);else{var a=0;for(this._fontScale=this._getStyleFontScale(e.fontSize,e.fontScale),this._updatePaddingRect(e,n),this._calculateLabelFont(e,i,n,r);(n.canvasSize.width>$X||n.canvasSize.height>$X)&&a<=3;){if(++a>3)this._fontScale=1;else{var o=Math.max(n.canvasSize.width,n.canvasSize.height),h=$X/o;this._fontScale*=h,this._fontScale=Math.max(1,this._fontScale)}this._updatePaddingRect(e,n),this._calculateLabelFont(e,i,n,r)}}s&&(s=n.parsedString)},e.generateRenderInfo=function(t,e,i,n,r,s,a){t?(this._computeAlignmentOffset(e,i,n),this.generateVertexData(t,e,i,n,r,s,a)):(this._updateLabelDimensions(e,i,n),this._updateTexture(e,i,n,r),this.generateVertexData(t,e,i,n,r,s,a))},e.setCanvasUsed=function(t,e){this._canvas=t,this._context=e},e._getStyleFontScale=function(t,e){var i=e;return i*t>this._maxFontSize&&t<this._maxFontSize&&(i=this._maxFontSize/t),i<1&&(i=1),i},e._calculateLabelFont=function(t,e,i,n){if(this._context){t.actualFontSize=t.fontSize*this._fontScale;var r=n.split("\n"),s=i.parsedString=r,a=this._getFontDesc(t.actualFontSize,t.fontFamily,t.isBold,t.isItalic);switch(this._context.font=t.fontDesc=a,e.overFlow){case hG.NONE:for(var o=0,h=0;h<r.length;++h){var u=JF(this._context,r[h],a);o=o>u?o:u}var l=o,c=(s.length+GF)*this._getLineHeight(e.lineHeight,t.actualFontSize,t.fontSize);i.canvasSize.width=l+i.canvasPadding.width*this._fontScale,i.canvasSize.height=c+i.canvasPadding.height*this._fontScale,i.nodeContentSize.width=(l+i.contentSizeExtend.width*this._fontScale)/this._fontScale,i.nodeContentSize.height=(c+i.contentSizeExtend.height*this._fontScale)/this._fontScale;break;case hG.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 hG.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 hG.RESIZE_HEIGHT:this._calculateWrapText(r,t,e,i);var _=(i.parsedString.length+GF)*this._getLineHeight(e.lineHeight,t.actualFontSize,t.fontSize);i.canvasSize.width=i.nodeContentSize.width*this._fontScale,i.canvasSize.height=_+i.canvasPadding.height*this._fontScale,i.nodeContentSize.height=(_+i.contentSizeExtend.height*this._fontScale)/this._fontScale}}},e._getFontDesc=function(t,e,i,n){var r=t.toString()+"px ";return r+=e,i&&(r="bold "+r),n&&(r="italic "+r),r},e._getLineHeight=function(t,e,i){return 0===t?e:t*e/i},e._calculateShrinkFont=function(t,e,i,n){if(this._context){var r=this._getFontDesc(e.actualFontSize,e.fontFamily,e.isBold,e.isItalic);this._context.font=r;var s=this._calculateParagraphLength(t,this._context,r),a=0,o=0,h=0,u=e.actualFontSize;if(i.wrapping){var l=n.nodeContentSize.width*this._fontScale,c=n.nodeContentSize.height*this._fontScale;if(l<0||c<0)return;o=c+1;for(var _=0,d=0|e.actualFontSize+1,f=0;_<d;){if((f=_+d+1>>1)<=0){Y(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(o=0,a=0;a<t.length;++a){var m=JF(this._context,t[a],r);o+=ik(t[a],m,l,this._measureText(this._context,r)).length*p}o>c?d=f-1:_=f}0===_?Y(4003):(u=_,r=this._getFontDesc(u,e.fontFamily,e.isBold,e.isItalic),this._context.font=r)}else{for(o=t.length*this._getLineHeight(i.lineHeight,u,e.fontSize),a=0;a<t.length;++a)h<s[a]&&(h=s[a]);var g=(n.canvasSize.width-n.canvasPadding.width)*this._fontScale/h,v=n.canvasSize.height*this._fontScale/o;u=e.actualFontSize*Math.min(1,g,v)|0,r=this._getFontDesc(u,e.fontFamily,e.isBold,e.isItalic),this._context.font=r}e.actualFontSize=u,e.fontDesc=r}},e._calculateWrapText=function(t,e,i,n){if(i.wrapping&&this._context){var r=[],s=n.nodeContentSize.width*this._fontScale,a=this._getFontDesc(e.actualFontSize,e.fontFamily,e.isBold,e.isItalic);this._context.font=a;for(var o=0;o<t.length;++o){var h=JF(this._context,t[o],a),u=ik(t[o],h,s,this._measureText(this._context,a));r=r.concat(u)}n.parsedString=r,e.fontDesc=a}},e._measureText=function(t,e){return function(i){return JF(t,i,e)}},e._calculateParagraphLength=function(t,e,i){for(var n,r=[],s=d(t);!(n=s()).done;){var a=JF(e,n.value,i);r.push(a)}return r},e._updatePaddingRect=function(t,e){var i=0,n=0,r=0,s=0,a=0;if(e.contentSizeExtend.width=e.contentSizeExtend.height=0,t.isOutlined&&(i=n=r=s=a=t.outlineWidth,e.contentSizeExtend.width=e.contentSizeExtend.height=2*a),t.hasShadow){var o=t.shadowBlur+a,h=t.shadowOffsetX,u=t.shadowOffsetY;r=Math.max(r,-h+o),s=Math.max(s,h+o),i=Math.max(i,u+o),n=Math.max(n,-u+o)}if(t.isItalic){var l=t.fontSize*Math.tan(.20943951);s+=l,e.contentSizeExtend.width+=l}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,$X),i.canvasSize.height=Math.min(i.canvasSize.height,$X),this._canvas.width=i.canvasSize.width,this._canvas.height=i.canvasSize.height,this._context.font=t.fontDesc,this._context.textAlign=JX[e.horizontalAlign],this._context.textBaseline="alphabetic"},e._calculateFillTextStartPosition=function(t,e,i){var n=0;e.horizontalAlign===aG.RIGHT?n=i.canvasSize.width-i.canvasPadding.width:e.horizontalAlign===aG.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-GF/2);if(e.verticalAlign!==oG.TOP){var a=r+i.canvasPadding.height+t.actualFontSize-i.canvasSize.height;e.verticalAlign===oG.BOTTOM?s-=a+=GF/2*t.actualFontSize:s-=a/2}s+=0*t.actualFontSize,i.startPosition.set(n+i.canvasPadding.x,s+i.canvasPadding.y)},e._updateTexture=function(t,e,i,n){if(this._context&&this._canvas){this._context.clearRect(0,0,this._canvas.width,this._canvas.height),this._context.font=t.fontDesc,this._calculateFillTextStartPosition(t,e,i);var r=this._getLineHeight(e.lineHeight,t.actualFontSize,t.fontSize);this._context.lineJoin="round",t.isOutlined?(this._context.fillStyle="rgba("+t.outlineColor.r+", "+t.outlineColor.g+", "+t.outlineColor.b+", "+tj+")",this._context.fillRect(0,0,this._canvas.width,this._canvas.height)):(this._context.fillStyle="rgba("+t.color.r+", "+t.color.g+", "+t.color.b+", "+tj+")",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 Fn(i.startPosition.x,i.startPosition.y),a=s.x,o=0;this._drawTextEffect(s,r,t,e,i);for(var h=0;h<i.parsedString.length;++h)o=s.y+h*r,t.isOutlined&&this._context.strokeText(i.parsedString[h],a,o),this._context.fillText(i.parsedString[h],a,o);t.hasShadow&&(this._context.shadowColor="transparent"),this._uploadTexture(n)}},e._uploadTexture=function(t){var e;t.texture&&this._canvas&&(e=t.texture instanceof yF?t.texture.texture:t.texture,0!==this._canvas.width&&0!==this._canvas.height&&(e.reset({width:this._canvas.width,height:this._canvas.height,mipmapLevel:1}),e.uploadData(this._canvas),e.setWrapMode(cf.CLAMP_TO_EDGE,cf.CLAMP_TO_EDGE),t.texture instanceof yF&&(t.texture.rect=new Vn(0,0,this._canvas.width,this._canvas.height),t.texture._calculateUV()),v.director.root&&v.director.root.batcher2D&&v.director.root.batcher2D._releaseDescriptorSetCache(e.getHash())))},e._drawTextEffect=function(t,e,i,n,r){if(i.hasShadow||i.isOutlined||i.isUnderline){var s=r.parsedString.length>1&&i.hasShadow,a=this._measureText(this._context,i.fontDesc),o=0,h=0;i.hasShadow&&this._setupShadow(i),i.isOutlined&&this._setupOutline(i);for(var u=0;u<r.parsedString.length;++u)if(o=t.x,h=t.y+u*e,s&&(i.isOutlined&&this._context.strokeText(r.parsedString[u],o,h),this._context.fillText(r.parsedString[u],o,h)),i.isUnderline){var l=a(r.parsedString[u]),c=new Fn;n.horizontalAlign===aG.RIGHT?c.x=t.x-l:n.horizontalAlign===aG.CENTER?c.x=t.x-l/2:c.x=t.x,c.y=h+i.actualFontSize/8,this._context.fillRect(c.x,c.y,l,i.underlineHeight*this._fontScale)}s&&(this._context.shadowColor="transparent")}},e._setupOutline=function(t){this._context.strokeStyle="rgba("+t.outlineColor.r+", "+t.outlineColor.g+", "+t.outlineColor.b+", "+t.outlineColor.a/255+")",this._context.lineWidth=2*t.outlineWidth*this._fontScale},e._setupShadow=function(t){var e=this._fontScale;this._context.shadowColor="rgba("+t.shadowColor.r+", "+t.shadowColor.g+", "+t.shadowColor.b+", "+t.shadowColor.a/255+")",this._context.shadowBlur=t.shadowBlur*e,this._context.shadowOffsetX=t.shadowOffsetX*e,this._context.shadowOffsetY=-t.shadowOffsetY*e},e.generateVertexData=function(t,e,i,n,r,s,a){t?this._updateQuads(e,i,n,r,s,a):(this.updateQuatCount(r),a(e,n,r))},e.updateQuatCount=function(t){var e=t.vertexBuffer,i=t.quadCount;if(e.length!==i){for(var n=e.length;n<i;n++)e.push({x:0,y:0,z:0,u:0,v:0,color:pn.WHITE.clone()});e.length=i}},e._setupBMFontOverflowMetrics=function(t,e){var i=e.nodeContentSize.width,n=e.nodeContentSize.height;t.overFlow===hG.RESIZE_HEIGHT&&(n=0),t.overFlow===hG.NONE&&(i=0,n=0),t.textWidthTemp=i,t.textHeightTemp=n,t.textDimensions.width=i,t.textDimensions.height=n,t.maxLineWidth=i},e._updateFontScale=function(t){t.bmfontScale=t.actualFontSize/(t.originFontSize*this._fontScale)},e._computeHorizontalKerningForText=function(t,e,i){var n=i,r=n.length;if(t.fntConfig){var s=t.fntConfig.kerningDict,a=e.horizontalKerning;if(s&&0!==s.length)for(var o=-1,h=0;h<r;++h){var u=n.charCodeAt(h),l=s[o<<16|65535&u]||0;a[h]=h<r-1?l:0,o=u}}},e._alignText=function(t,e,i,n){this._multilineTextWrap(t,e,i,n,this._getFirstWordLen),e.overFlow===hG.SHRINK&&(t.fontSize>0&&this._isVerticalClamp(t,e,i,n,this)&&this._shrinkLabelToContentSize(t,e,i,n,this._isVerticalClamp),t.fontSize>0&&this._isHorizontalNeedShrink(e,i)&&this._shrinkLabelToContentSize(t,e,i,n,this._isHorizontalClamp)),this._parsedString(i,n)},e._parsedString=function(t,e){for(var i=[],n="",r=0,s=0,a=e.length;r<a;++r){var o=this._lettersInfo[r];o.valid&&(s===o.line?n+=o.char:(i=i.concat(n),s=o.line,n=""))}i=i.concat(n),t.parsedString=i},e._multilineTextWrap=function(t,e,i,n,r){e.linesWidth.length=0;for(var s=n,a=s.length,o=0,h=0,u=0,l=0,c=0,_=0,d=0,f=null,p=0;p<a;){var m=s.charAt(p);if("\n"!==m){for(var g=r(t,e,s,p,a),v=_,y=d,T=c,S=h,E=!1,A=new Fn,R=0;R<g;++R){var b=p+R;if("\r"!==(m=s.charAt(b)))if(f=ck.fontAtlas.getLetterDefinitionForChar(m,ck)){var C=S+f.offsetX*t.bmfontScale-ck.margin;if(e.wrapping&&e.maxLineWidth>0&&h>0&&C+f.w*t.bmfontScale>e.maxLineWidth&&!ZF(m)){e.linesWidth.push(c),c=0,o++,h=0,u-=e.lineHeight*this._getFontScale(t,e)+0,E=!0;break}A.x=C,A.y=u-f.offsetY*t.bmfontScale,this._recordLetterInfo(A,m,b,o),b+1<e.horizontalKerning.length&&b<a-1&&(S+=e.horizontalKerning[b+1]*t.bmfontScale),S+=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(b,m),null!=t.fntConfig?k("Can't find letter definition in texture atlas "+t.fntConfig.atlasName+" for letter:"+m):k("Can't find letter definition in font family "+t.fontFamily+" for letter:"+m);else this._recordPlaceholderInfo(b,m)}E||(h=S,_<v&&(_=v),d>y&&(d=y),l<(c=T)&&(l=c),p+=g)}else e.linesWidth.push(c),c=0,o++,h=0,u-=e.lineHeight*this._getFontScale(t,e)+0,this._recordPlaceholderInfo(p,m),p++}return e.linesWidth.push(c),e.numberOfLines=o+1,e.textDesiredHeight=e.numberOfLines*e.lineHeight*this._getFontScale(t,e),e.numberOfLines>1&&(e.textDesiredHeight+=0*(e.numberOfLines-1)),i.nodeContentSize.width=e.textWidthTemp,i.nodeContentSize.height=e.textHeightTemp,e.textWidthTemp<=0&&(i.nodeContentSize.width=parseFloat(l.toFixed(2))+2*ck.margin),e.textHeightTemp<=0&&(i.nodeContentSize.height=parseFloat(e.textDesiredHeight.toFixed(2))+2*ck.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 ej;this._lettersInfo.push(i)}this._lettersInfo[t].char=e,this._lettersInfo[t].hash=""+e.charCodeAt(0)+ck.hash,this._lettersInfo[t].valid=!1},e._recordLetterInfo=function(t,e,i,n){if(i>=this._lettersInfo.length){var r=new ej;this._lettersInfo.push(r)}var s=""+e.charCodeAt(0)+ck.hash;this._lettersInfo[i].line=n,this._lettersInfo[i].char=e,this._lettersInfo[i].hash=s,this._lettersInfo[i].valid=ck.fontAtlas.getLetter(s).valid,this._lettersInfo[i].x=t.x,this._lettersInfo[i].y=t.y},e._getFirstWordLen=function(t,e,i,n,r){var s=i.charAt(n);if(QF(s)||"\n"===s||ZF(s))return 1;var a=1,o=ck.fontAtlas.getLetterDefinitionForChar(s,ck);if(!o)return a;for(var h=o.xAdvance*t.bmfontScale+e.spacingX,u=n+1;u<r&&(s=i.charAt(u),o=ck.fontAtlas.getLetterDefinitionForChar(s,ck));++u){if(h+o.offsetX*t.bmfontScale+o.w*t.bmfontScale>e.maxLineWidth&&!ZF(s)&&e.maxLineWidth>0)return a;if(h+=o.xAdvance*t.bmfontScale+e.spacingX,"\n"===s||ZF(s)||QF(s))break;a++}return a},e._computeAlignmentOffset=function(t,e,i){switch(e.linesOffsetX.length=0,e.letterOffsetY=0,e.horizontalAlign){case aG.LEFT:for(var n=0;n<e.numberOfLines;++n)e.linesOffsetX.push(0);break;case aG.CENTER:for(var r=0,s=e.linesWidth.length;r<s;r++)e.linesOffsetX.push((i.nodeContentSize.width-e.linesWidth[r])/2);break;case aG.RIGHT:for(var a=0,o=e.linesWidth.length;a<o;a++)e.linesOffsetX.push(i.nodeContentSize.width-e.linesWidth[a])}if(e.letterOffsetY=i.nodeContentSize.height,e.verticalAlign!==oG.TOP){var h=i.nodeContentSize.height-e.textDesiredHeight+e.lineHeight*this._getFontScale(t,e)-t.originFontSize*this._fontScale*t.bmfontScale;e.verticalAlign===oG.BOTTOM?e.letterOffsetY-=h:e.letterOffsetY-=h/2}},e._getFontScale=function(t,e){return e.overFlow===hG.SHRINK?t.bmfontScale:1},e._isVerticalClamp=function(t,e,i){return e.textDesiredHeight>i.nodeContentSize.height},e._isHorizontalClamp=function(t,e,i,n,r){for(var s=!1,a=0,o=n.length;a<o;++a){var h=r._lettersInfo[a];if(h.valid){var u=ck.fontAtlas.getLetterDefinitionForChar(h.char,ck);if(!u)continue;var l=h.x+u.w*t.bmfontScale,c=h.line;if(e.textWidthTemp>0)if(e.wrapping){if(e.linesWidth[c]>i.nodeContentSize.width&&(l>i.nodeContentSize.width||l<0)){s=!0;break}}else if(l>i.nodeContentSize.width){s=!0;break}}}return s},e._isHorizontalNeedShrink=function(t,e){for(var i=0,n=t.linesWidth.length;i<n;++i)if(t.linesWidth[i]>e.nodeContentSize.width)return!0;return!1},e._shrinkLabelToContentSize=function(t,e,i,n,r){for(var s=0,a=0|t.actualFontSize,o=0;s<a;){var h=o=s+a+1>>1;if(h<=0)break;t.bmfontScale=h/(t.originFontSize*this._fontScale),this._multilineTextWrap(t,e,i,n,this._getFirstWordLen),this._computeAlignmentOffset(t,e,i),r(t,e,i,n,this)?a=o-1:s=o}s>=0&&this._scaleFontSizeDown(t,e,i,n,s)},e._scaleFontSizeDown=function(t,e,i,n,r){var s=!0;r||(r=.1,s=!1),t.actualFontSize=r,s&&(this._updateFontScale(t),this._multilineTextWrap(t,e,i,n,this._getFirstWordLen))},e._updateQuads=function(t,e,i,n,r,s){for(var a=t.spriteFrame?t.spriteFrame.texture:ck.fontAtlas.getTexture(),o=n.uiTransAnchorX*i.nodeContentSize.width,h=n.uiTransAnchorY*i.nodeContentSize.height,u=0,l=r.length;u<l;++u){var c=this._lettersInfo[u];if(c.valid){var _=ck.fontAtlas.getLetter(c.hash);if(_){this._tmpRect.height=_.h,this._tmpRect.width=_.w,this._tmpRect.x=_.u,this._tmpRect.y=_.v;var d=c.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===hG.CLAMP&&(this._tmpRect.height=d<e.tailoredBottomY?0:(d-e.tailoredBottomY)/t.bmfontScale)}var p=c.line,m=c.x+_.w/2*t.bmfontScale+e.linesOffsetX[p];if(e.textWidthTemp>0&&this._isHorizontalClamped(e,i,m,p)&&e.overFlow===hG.CLAMP&&(this._tmpRect.width=0),this._tmpRect.height>0&&this._tmpRect.width>0){var g=this._determineRect(t),v=c.x+e.linesOffsetX[c.line],y=n.quadCount;n.quadCount+=4,this.updateQuatCount(n),s(t,i,n,y,a,this._tmpRect,g,v-o,d-h)}}else U("Can't find letter in this bitmap-font")}}return!0},e._isHorizontalClamped=function(t,e,i,n){var r=t.linesWidth[n],s=i>e.nodeContentSize.width||i<0;return t.wrapping?r>e.nodeContentSize.width&&s:s},e._determineRect=function(t){var e=t.spriteFrame;if(!e)return!1;var i=e.isRotated(),n=e.getOriginalSize(),r=e.getRect(),s=e.getOffset(),a=s.x+(n.width-r.width)/2,o=s.y-(n.height-r.height)/2;if(i){var h=this._tmpRect.x;this._tmpRect.x=r.x+r.height-this._tmpRect.y-this._tmpRect.height-o,this._tmpRect.y=h+r.y-a,this._tmpRect.y<0&&(this._tmpRect.height+=o)}else this._tmpRect.x+=r.x-a,this._tmpRect.y+=r.y+o;return i},t}();ij.instance=void 0,ij.instance=new ij;var nj,rj=new lk(64,64),sj=new FF(null),aj=null,oj=null,hj=null,uj=null,lj={updateProcessingData:function(t,e,i,n,r,s){t.fontSize=r.fontSize,t.actualFontSize=r.fontSize,t.originFontSize=hj?hj.fontSize:r.fontSize,e.horizontalAlign=r.horizontalAlign,e.verticalAlign=r.verticalAlign,e.spacingX=r.spacingX;var a=r.overflow;e.overFlow=a,e.lineHeight=r.lineHeight,i.nodeContentSize.width=s.width,i.nodeContentSize.height=s.height,a===hG.NONE?(e.wrapping=!1,i.nodeContentSize.width+=2*ck.margin,i.nodeContentSize.height+=2*ck.margin):a===hG.RESIZE_HEIGHT?(e.wrapping=!0,i.nodeContentSize.height+=2*ck.margin):e.wrapping=r.enableWrapText,n.uiTransAnchorX=s.anchorX,n.uiTransAnchorY=s.anchorY,ck.lineHeight=r.lineHeight,ck.fontSize=r.fontSize,t.spriteFrame=uj,t.fntConfig=hj,t.fontFamily=ck.fontFamily,t.color.set(r.color)},updateRenderData:function(t){if(t.renderData&&aj!==t){if(t.renderData.vertDirty){oj=(aj=t).node._uiProps.uiTransformComp;var e=t.renderData,i=ij.instance,n=t.textStyle,r=t.textLayout,s=t.textLayoutData,a=t.textRenderData;n.fontScale=IV.getScaleX(),this._updateFontFamily(t),this.updateProcessingData(n,r,s,a,t,oj),this._updateLabelInfo(t),n.fontDesc=ck.fontDesc,i.processingString(!0,n,r,s,t.string),this.resetRenderData(t),a.quadCount=0,i.generateRenderInfo(!0,n,r,s,a,t.string,this.generateVertexData),e.dataLength=a.quadCount,e.resize(e.dataLength,e.dataLength/2*3);for(var o=e.data,h=0,u=a.quadCount;h<u;h++)o[h]=a.vertexBuffer[h];var l=e.indexCount;this.createQuadIndices(l),e.chunk.setIndexBuffer(nj),aj.actualFontSize=n.actualFontSize,oj.setContentSize(s.nodeContentSize),this.updateUVs(t),this.updateColor(t),e.vertDirty=!1,aj=null,this._resetProperties()}t.spriteFrame&&t.renderData.updateRenderData(t,t.spriteFrame)}},updateUVs:function(t){for(var e=t.renderData,i=e.chunk.vb,n=e.vertexCount,r=e.data,s=3,a=0;a<n;a++){var o=r[a];i[s]=o.u,i[s+1]=o.v,s+=9}},updateColor:function(){},resetRenderData:function(t){var e=t.renderData;e.dataLength=0,e.resize(0,0)},generateVertexData:function(t,e,i,n,r,s,a,o,h){var u=n,l=t.bmfontScale,c=i.vertexBuffer,_=r.width,d=r.height,f=s.width,p=s.height,m=0,g=0,v=0,y=0;a?(m=s.x/_,y=(s.x+p)/_,g=(s.y+f)/d,v=s.y/d,c[u].u=m,c[u].v=v,c[u+1].u=m,c[u+1].v=g,c[u+2].u=y,c[u+2].v=v,c[u+3].u=y,c[u+3].v=g):(m=s.x/_,y=(s.x+f)/_,g=(s.y+p)/d,v=s.y/d,c[u].u=m,c[u].v=g,c[u+1].u=y,c[u+1].v=g,c[u+2].u=m,c[u+2].v=v,c[u+3].u=y,c[u+3].v=v),c[u].x=o,c[u].y=h-p*l,c[u+1].x=o+f*l,c[u+1].y=h-p*l,c[u+2].x=o,c[u+2].y=h,c[u+3].x=o+f*l,c[u+3].y=h},_updateFontFamily:function(t){var e=t.font;uj=e.spriteFrame,hj=e.fntConfig,ck.fontAtlas=e.fontDefDictionary,ck.fontAtlas||(t.cacheMode===uG.CHAR?ck.fontAtlas=rj:ck.fontAtlas=sj),CL.packToDynamicAtlas(t,uj)},_updateLabelInfo:function(){ck.hash="",ck.margin=0},_resetProperties:function(){hj=null,uj=null,ck.hash="",ck.margin=0},createQuadIndices:function(t){if(t%6==0){var e=t/6;nj=null,nj=new Uint16Array(t);for(var i=0,n=0;n<e;n++)nj[i++]=0+4*n,nj[i++]=1+4*n,nj[i++]=2+4*n,nj[i++]=1+4*n,nj[i++]=3+4*n,nj[i++]=2+4*n}else console.error("illegal index count!")}},cj=new pn(255,255,255,255),_j={createData:function(t){var e=t.requestRenderData();return e.resize(0,0),e},fillBuffers:function(t){var e=t.node;cj.set(t.color),cj.a=255*e._uiProps.opacity,Id(e,0,t.renderData,cj)},appendQuad:function(t,e,i,n,r,s,a){var o=t.renderData;if(o){var h=o.dataLength;o.dataLength+=4,o.resize(o.dataLength,o.dataLength/2*3);var u=o.data,l=e.width,c=e.height,_=i.width,d=i.height,f=0,p=0,m=0,g=0;n?(f=i.x/l,g=(i.x+d)/l,p=(i.y+_)/c,m=i.y/c,u[h].u=f,u[h].v=m,u[h+1].u=f,u[h+1].v=p,u[h+2].u=g,u[h+2].v=m,u[h+3].u=g,u[h+3].v=p):(f=i.x/l,g=(i.x+_)/l,p=(i.y+d)/c,m=i.y/c,u[h].u=f,u[h].v=p,u[h+1].u=g,u[h+1].v=p,u[h+2].u=f,u[h+2].v=m,u[h+3].u=g,u[h+3].v=m),u[h].x=r,u[h].y=s-d*a,u[h+1].x=r+_*a,u[h+1].y=s-d*a,u[h+2].x=r,u[h+2].y=s,u[h+3].x=r+_*a,u[h+3].y=s}}};Gt(_j,lj);var dj=null,fj=Ht(lj,{getAssemblerData:function(){return dj||(dj=new lk(1024,1024)),dj.getTexture()},_updateFontFamily:function(t){ck.fontAtlas=dj,ck.fontFamily=this._getFontFamily(t),t.enableOutline&&t.outlineWidth>0?(ck.isOutlined=!0,ck.margin=t.outlineWidth,ck.out=t.outlineColor.clone(),ck.out.a=t.outlineColor.a*t.color.a/255):(ck.isOutlined=!1,ck.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){ck.fontDesc=this._getFontDesc(),ck.color=t.color,ck.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}(ck)},_getFontDesc:function(){return ck.fontSize.toString()+"px "+ck.fontFamily}}),pj=new pn(255,255,255,255),mj={createData:function(t){var e=t.requestRenderData();return e.resize(0,0),e},fillBuffers:function(t){if(t.renderData){var e=t.node;pj.a=255*e._uiProps.opacity,Id(e,0,t.renderData,pj)}},updateColor:function(){}};Gt(mj,fj);var gj=fG.Overflow,vj={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===gj.NONE?e.wrapping=!1:r.overflow===gj.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||!xi(r.shadowOffset.x,0)||!xi(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=fG._canvasPool.get();return t.canvas.width=t.canvas.height=1,t},resetAssemblerData:function(t){t&&fG._canvasPool.put(t)},updateRenderData:function(t){if(t.renderData){if(t.renderData.vertDirty){var e=t.node._uiProps.uiTransformComp,i=ij.instance,n=t.textStyle,r=t.textLayout,s=t.textLayoutData,a=t.textRenderData;n.fontScale=IV.getScaleX(),this.updateProcessingData(n,r,s,a,t,e),i.setCanvasUsed(t.assemblerData.canvas,t.assemblerData.context),n.fontFamily=this._updateFontFamily(t),this._resetDynamicAtlas(t),i.processingString(!1,n,r,s,t.string),i.generateRenderInfo(!1,n,r,s,a,t.string,this.generateVertexData);var o=t.renderData;o.textureDirty=!0,this._calDynamicAtlas(t,s),t.actualFontSize=n.actualFontSize,e.setContentSize(s.nodeContentSize);var h=o.data;h[0]=a.vertexBuffer[0],h[1]=a.vertexBuffer[1],h[2]=a.vertexBuffer[2],h[3]=a.vertexBuffer[3],this.updateUVs(t),t.renderData.vertDirty=!1,t.contentWidth=s.nodeContentSize.width}t.spriteFrame&&t.renderData.updateRenderData(t,t.spriteFrame)}},generateVertexData:function(t,e,i){var n=i.vertexBuffer,r=e.nodeContentSize.width,s=e.nodeContentSize.height,a=i.uiTransAnchorX*r,o=i.uiTransAnchorY*s;n[0].x=-a,n[0].y=-o,n[1].x=r-a,n[1].y=-o,n[2].x=-a,n[2].y=s-o,n[3].x=r-a,n[3].y=s-o},updateVertexData:function(){},updateUVs:function(){},_updateFontFamily:function(t){return t.useSystemFont?t.fontFamily||"Arial":t.font&&t.font._nativeAsset||"Arial"},_calDynamicAtlas:function(t,e){if(!(t.cacheMode!==fG.CacheMode.BITMAP||e.canvasSize.width<=0||e.canvasSize.height<=0)){var i=t.ttfSpriteFrame;CL.packToDynamicAtlas(t,i)}},_resetDynamicAtlas:function(t){if(t.cacheMode===fG.CacheMode.BITMAP){var e=t.ttfSpriteFrame;CL.deleteAtlasSpriteFrame(e),e._resetDynamicAtlasFrame()}}},yj=pn.WHITE.clone(),Tj=Uint16Array.from([0,1,2,1,3,2]),Sj={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++)pn.toArray(i,yj,n),n+=9;return e.chunk.setIndexBuffer(Tj),e},fillBuffers:function(t){for(var e=t.renderData,i=e.chunk,n=e.data,r=t.node,s=i.vb,a=r.worldMatrix,o=e.floatStride,h=0,u=n.length,l=0;l<u;l++){var c=n[l],_=c.x,d=c.y,f=a.m03*_+a.m07*d+a.m15;f=f?1/f:1,s[0+(h=l*o)]=(a.m00*_+a.m04*d+a.m12)*f,s[h+1]=(a.m01*_+a.m05*d+a.m13)*f,s[h+2]=(a.m02*_+a.m06*d+a.m14)*f}var p=i.vertexOffset,m=i.meshBuffer,g=i.meshBuffer.iData,v=m.indexOffset;g[v++]=p,g[v++]=p+1,g[v++]=p+2,g[v++]=p+2,g[v++]=p+1,g[v++]=p+3,m.indexOffset+=6},updateVertexData:function(t){var e=t.renderData;if(e){var i=t.node._uiProps.uiTransformComp,n=i.width,r=i.height,s=i.anchorX*n,a=i.anchorY*r,o=e.data;o[0].x=-s,o[0].y=-a,o[1].x=n-s,o[1].y=-a,o[2].x=-s,o[2].y=r-a,o[3].x=n-s,o[3].y=r-a}},updateUVs:function(t){var e=t.renderData;if(e&&t.ttfSpriteFrame){var i=e.chunk.vb,n=t.ttfSpriteFrame.uv;i[3]=n[0],i[4]=n[1],i[12]=n[2],i[13]=n[3],i[21]=n[4],i[22]=n[5],i[30]=n[6],i[31]=n[7]}},updateColor:function(){}};Gt(Sj,vj);var Ej=t("l",{getAssembler:function(t){var e=Sj;return t.font instanceof kF?e=_j:t.cacheMode===fG.CacheMode.CHAR&&(e=mj),e}});fG.Assembler=Ej;var Aj=dz.FillType,Rj=new Dn,bj=Uint16Array.from([0,1,2,1,3,2]),Cj={updateRenderData:function(t){var e=t.spriteFrame;CL.packToDynamicAtlas(t,e);var i=t.renderData;if(i&&e){if(!i.vertDirty)return;var n=t.fillStart,r=t.fillRange;r<0&&(n+=r,r=-r),r=(r=(r=n+r)>1?1:r)<0?0:r;var s=(n=(n=n>1?1:n)<0?0:n)+(r=(r-=n)<0?0:r);s=s>1?1:s,this.updateUVs(t,n,s),this.updateVertexData(t,n,s),i.updateRenderData(t,e)}},updateUVs:function(t,e,i){var n=t.spriteFrame,r=t.renderData.chunk.vb,s=n.width,a=n.height,o=n.rect,h=0,u=0,l=0,c=0,_=0,d=0,f=0,p=0,m=0,g=0;switch(n.isRotated()?(h=o.x/s,u=(o.y+o.width)/a,l=_=h,f=m=(o.x+o.height)/s,d=g=u,c=p=o.y/a):(h=o.x/s,u=(o.y+o.height)/a,l=f=h,_=m=(o.x+o.width)/s,c=d=u,p=g=o.y/a),t.fillType){case Aj.HORIZONTAL:r[3]=l+(_-l)*e,r[4]=c+(d-c)*e,r[12]=l+(_-l)*i,r[13]=c+(d-c)*i,r[21]=f+(m-f)*e,r[22]=p+(g-p)*e,r[30]=f+(m-f)*i,r[31]=p+(g-p)*i;break;case Aj.VERTICAL:r[3]=l+(f-l)*e,r[4]=c+(p-c)*e,r[12]=_+(m-_)*e,r[13]=d+(g-d)*e,r[21]=l+(f-l)*i,r[22]=c+(p-c)*i,r[30]=_+(m-_)*i,r[31]=d+(g-d)*i;break;default:Z(2626)}},updateVertexData:function(t,e,i){var n=t.renderData.data,r=t.node._uiProps.uiTransformComp,s=r.width,a=r.height,o=r.anchorX*s,h=r.anchorY*a,u=-o,l=-h,c=s-o,_=a-h,d=0;switch(t.fillType){case Aj.HORIZONTAL:d=u+(c-u)*i,u+=(c-u)*e,c=d;break;case Aj.VERTICAL:d=l+(_-l)*i,l+=(_-l)*e,_=d;break;default:Z(2626)}n[0].x=u,n[0].y=l,n[1].x=c,n[1].y=l,n[2].x=u,n[2].y=_,n[3].x=c,n[3].y=_},createData:function(t){var e=t.requestRenderData();e.dataLength=4,e.resize(4,6),e.chunk.setIndexBuffer(bj);for(var i,n=d(e.data);!(i=n()).done;)i.value.z=0;return e},updateWorldVertexData:function(t,e){t.node.getWorldMatrix(Rj);for(var i=t.renderData.floatStride,n=t.renderData.data,r=e.vb,s=0,a=0;a<4;a++){var o=n[a],h=o.x,u=o.y,l=Rj.m03*h+Rj.m07*u+Rj.m15;l=l?1/l:1,r[s=a*i]=(Rj.m00*h+Rj.m04*u+Rj.m12)*l,r[s+1]=(Rj.m01*h+Rj.m05*u+Rj.m13)*l,r[s+2]=(Rj.m02*h+Rj.m06*u+Rj.m14)*l}},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,a=r.indexOffset;s[a++]=n,s[a++]=n+1,s[a++]=n+2,s[a++]=n+2,s[a++]=n+1,s[a++]=n+3,r.indexOffset+=6},updateColor:function(t){for(var e=t.renderData,i=e.chunk.vb,n=e.floatStride,r=5,s=t.color,a=s.r/255,o=s.g/255,h=s.b/255,u=t.node._uiProps.opacity,l=0;l<4;l++)i[r]=a,i[r+1]=o,i[r+2]=h,i[r+3]=u,r+=n}},wj=2*Math.PI,xj=1e-6,Ij=new Dn,Oj=[new Fn,new Fn,new Fn,new Fn],Dj=new Array(4),Mj=new Array(8),Pj=[new Fn,new Fn,new Fn,new Fn],Bj=[new Fn,new Fn,new Fn,new Fn],Nj=new Fn,Lj=[new Fn,new Fn,new Fn,new Fn],Fj=null;function kj(t,e,i,n,r,s,a){var o=Math.sin(s);o=Math.abs(o)>xj?o:0;var h=Math.cos(s),u=0,l=0;if(0!==(h=Math.abs(h)>xj?h:0)){if(u=o/h,(t-r.x)*h>0){var c=r.y+u*(t-r.x);a[0].x=t,a[0].y=c}if((e-r.x)*h>0){var _=r.y+u*(e-r.x);a[2].x=e,a[2].y=_}}if(0!==o){if(l=h/o,(n-r.y)*o>0){var d=r.x+l*(n-r.y);a[3].x=d,a[3].y=n}if((i-r.y)*o>0){var f=r.x+l*(i-r.y);a[1].x=f,a[1].y=i}}}function Uj(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 Gj(t,e,i,n,r){var s=Dj,a=s[0],o=s[1],h=s[2],u=s[3];t[e].x=i.x,t[e].y=i.y,t[e+1].x=n.x,t[e+1].y=n.y,t[e+2].x=r.x,t[e+2].y=r.y,Hj((i.x-a)/(h-a),(i.y-o)/(u-o),t,e),Hj((n.x-a)/(h-a),(n.y-o)/(u-o),t,e+1),Hj((r.x-a)/(h-a),(r.y-o)/(u-o),t,e+2)}function Hj(t,e,i,n){var r=Mj,s=r[0]+(r[2]-r[0])*t,a=r[4]+(r[6]-r[4])*t,o=r[1]+(r[3]-r[1])*t,h=r[5]+(r[7]-r[5])*t,u=i[n];u.u=s+(a-s)*e,u.v=o+(h-o)*e}for(var zj={useModel:!1,createData:function(t){return t.requestRenderData()},updateRenderData:function(t){var e=t.spriteFrame;CL.packToDynamicAtlas(t,e),this.updateUVs(t);var i=t.renderData;if(i&&e){if(!i.vertDirty)return;var n=i.data,r=t.fillStart,s=t.fillRange;for(s<0&&(r+=s,s=-s);r>=1;)r-=1;for(;r<0;)r+=1;var a=(r*=wj)+(s*=wj);!function(t){var e=t.node._uiProps.uiTransformComp,i=e.width,n=e.height,r=e.anchorX*i,s=e.anchorY*n,a=-r,o=-s,h=i-r,u=n-s,l=Dj;l[0]=a,l[1]=o,l[2]=h,l[3]=u;var c=t.fillCenter,_=Nj.x=Math.min(Math.max(0,c.x),1)*(h-a)+a,d=Nj.y=Math.min(Math.max(0,c.y),1)*(u-o)+o;Oj[0].x=Oj[3].x=a,Oj[1].x=Oj[2].x=h,Oj[0].y=Oj[1].y=o,Oj[2].y=Oj[3].y=u;for(var f=0,p=Lj;f<p.length;f++){var m=p[f];Fn.set(m,0,0)}_!==l[0]&&Fn.set(Lj[0],3,0),_!==l[2]&&Fn.set(Lj[2],1,2),d!==l[1]&&Fn.set(Lj[1],0,1),d!==l[3]&&Fn.set(Lj[3],2,3)}(t),function(t){var e=t.width,i=t.height,n=t.getRect(),r=0,s=0,a=0,o=0,h=Mj;t.isRotated()?(r=n.x/e,s=(n.x+n.height)/e,a=n.y/i,o=(n.y+n.width)/i,h[0]=h[2]=r,h[4]=h[6]=s,h[3]=h[7]=o,h[1]=h[5]=a):(r=n.x/e,s=(n.x+n.width)/e,a=n.y/i,o=(n.y+n.height)/i,h[0]=h[4]=r,h[2]=h[6]=s,h[1]=h[3]=o,h[5]=h[7]=a)}(e),kj(Dj[0],Dj[2],Dj[1],Dj[3],Nj,r,Pj),kj(Dj[0],Dj[2],Dj[1],Dj[3],Nj,r+s,Bj);for(var o=0,h=0;h<4;++h){var u=Lj[h];if(u)if(s>=wj)i.dataLength=o+3,Gj(n,o,Nj,Oj[u.x],Oj[u.y]),o+=3;else{var l=Uj(Nj,Oj[u.x]),c=Uj(Nj,Oj[u.y]);c<l&&(c+=wj),l-=wj,c-=wj;for(var _=0;_<3;++_)l>=a||(l>=r?(i.dataLength=o+3,Gj(n,o,Nj,Oj[u.x],c>=a?Bj[h]:Oj[u.y]),o+=3):c>r&&(c<=a?(i.dataLength=o+3,Gj(n,o,Nj,Pj[h],Oj[u.y]),o+=3):(i.dataLength=o+3,Gj(n,o,Nj,Pj[h],Bj[h]),o+=3))),l+=wj,c+=wj}}0===o&&(i.dataLength=0),i.resize(o,o),i.updateRenderData(t,e)}},createQuadIndices:function(t){Fj=null,Fj=new Uint16Array(t);for(var e=0,i=0;i<t;i++)Fj[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,a=n.meshBuffer.iData,o=s.indexOffset,h=0;h<i.indexCount;h++)a[o+h]=r+h;s.indexOffset+=i.indexCount,s.setDirty()},updateWorldUVData:function(t){for(var e=t.renderData,i=e.floatStride,n=e.data,r=e.chunk.vb,s=0;s<n.length;s++){var a=s*i;r[a+3]=n[s].u,r[a+4]=n[s].v}},updateWorldVertexAndUVData:function(t,e){t.node.getWorldMatrix(Ij);for(var i=t.renderData,n=i.floatStride,r=t.renderData.data,s=e.vb,a=i.vertexCount,o=0,h=0;h<a;h++){var u=r[h],l=u.x,c=u.y,_=Ij.m03*l+Ij.m07*c+Ij.m15;_=_?1/_:1,s[o+0]=(Ij.m00*l+Ij.m04*c+Ij.m12)*_,s[o+1]=(Ij.m01*l+Ij.m05*c+Ij.m13)*_,s[o+2]=(Ij.m02*l+Ij.m06*c+Ij.m14)*_,s[o+3]=u.u,s[o+4]=u.v,o+=n}},updateUVs:function(t){t.renderData.vertDirty=!0,t.markForUpdateRenderData()},updateColorLate:function(t){for(var e=t.renderData,i=e.chunk.vb,n=e.floatStride,r=e.vertexCount,s=5,a=t.color,o=a.r/255,h=a.g/255,u=a.b/255,l=t.node._uiProps.opacity,c=0;c<r;c++)i[s]=o,i[s+1]=h,i[s+2]=u,i[s+3]=l,s+=n},updateColor:function(){}},Vj=Uint16Array.from([0,1,2,1,3,2]),Wj={createData:function(t){var e=t.requestRenderData();return e.dataLength=4,e.resize(4,6),e.chunk.setIndexBuffer(Vj),e},updateRenderData:function(t){var e=t.spriteFrame;CL.packToDynamicAtlas(t,e),this.updateUVs(t);var i=t.renderData;i&&e&&(i.vertDirty&&this.updateVertexData(t),i.updateRenderData(t,e))},updateWorldVerts:function(t,e){for(var i=t.renderData,n=e.vb,r=i.data,s=t.node.worldMatrix,a=i.floatStride,o=0,h=r.length,u=0;u<h;u++){var l=r[u],c=l.x,_=l.y,d=s.m03*c+s.m07*_+s.m15;d=d?1/d:1,n[0+(o=u*a)]=(s.m00*c+s.m04*_+s.m12)*d,n[o+1]=(s.m01*c+s.m05*_+s.m13)*d,n[o+2]=(s.m02*c+s.m06*_+s.m14)*d}},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,a=r.indexOffset,o=n;s[a++]=o,s[a++]=o+1,s[a++]=o+2,s[a++]=o+1,s[a++]=o+3,s[a++]=o+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,a=i.anchorX*r,o=i.anchorY*s,h=0,u=0,l=0,c=0;if(t.trim)h=-a,u=-o,l=r-a,c=s-o;else{var _=t.spriteFrame,d=_.originalSize,f=r/d.width,p=s/d.height,m=_.trimmedBorder;h=m.x*f-a,u=m.z*p-o,l=r+m.y*f-a,c=s+m.w*p-o}n[0].x=h,n[0].y=u,n[1].x=l,n[1].y=u,n[2].x=h,n[2].y=c,n[3].x=l,n[3].y=c,e.vertDirty=!0}},updateUVs:function(t){if(t.spriteFrame){var e=t.renderData.chunk.vb,i=t.spriteFrame.uv;e[3]=i[0],e[4]=i[1],e[12]=i[2],e[13]=i[3],e[21]=i[4],e[22]=i[5],e[30]=i[6],e[31]=i[7]}},updateColor:function(t){for(var e=t.renderData,i=e.chunk.vb,n=5,r=t.color,s=r.r/255,a=r.g/255,o=r.b/255,h=r.a/255,u=0;u<4;u++,n+=e.floatStride)i[n]=s,i[n+1]=a,i[n+2]=o,i[n+3]=h}},Xj=new Dn,jj=[],Yj=0;Yj<4;Yj++)jj.push({x:0,y:0,z:0,u:0,v:0,color:new pn});var Kj,qj,Qj,Zj,Jj,$j,tY,eY={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;CL.packToDynamicAtlas(t,e),this.updateUVs(t);var i=t.renderData;i&&e&&(i.vertDirty&&this.updateVertexData(t),i.updateRenderData(t,e))},updateVertexData:function(t){var e=t.renderData,i=e.data,n=t.node._uiProps.uiTransformComp,r=n.width,s=n.height,a=n.anchorX*r,o=n.anchorY*s,h=t.spriteFrame,u=h.insetLeft,l=h.insetRight,c=h.insetTop,_=h.insetBottom,d=r-u-l,f=s-c-_,p=r/(u+l),m=s/(c+_);p=Number.isNaN(p)||p>1?1:p,m=Number.isNaN(m)||m>1?1:m,d=d<0?0:d,f=f<0?0:f,jj[0].x=-a,jj[0].y=-o,jj[1].x=u*p-a,jj[1].y=_*m-o,jj[2].x=jj[1].x+d,jj[2].y=jj[1].y+f,jj[3].x=r-a,jj[3].y=s-o;for(var g=0;g<4;g++)for(var v=0;v<4;v++){var y=4*g+v;y<e.dataLength&&g<jj.length&&v<jj.length&&(i[y].x=jj[v].x,i[y].y=jj[g].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,a=r.indexOffset,o=0;o<3;++o)for(var h=0;h<3;++h){var u=n+4*o+h;s[a++]=u,s[a++]=u+1,s[a++]=u+4,s[a++]=u+1,s[a++]=u+5,s[a++]=u+4}r.indexOffset=a},updateWorldVertexData:function(t,e){t.node.getWorldMatrix(Xj);for(var i=t.renderData,n=i.floatStride,r=i.data,s=e.vb,a=0,o=0;o<4;++o)for(var h=r[4*o],u=0;u<4;++u){var l=r[u].x,c=h.y,_=Xj.m03*l+Xj.m07*c+Xj.m15;_=_?1/_:1,s[0+(a=(4*o+u)*n)]=(Xj.m00*l+Xj.m04*c+Xj.m12)*_,s[a+1]=(Xj.m01*l+Xj.m05*c+Xj.m13)*_,s[a+2]=(Xj.m02*l+Xj.m06*c+Xj.m14)*_}},updateUVs:function(t){if(t.spriteFrame)for(var e=t.renderData,i=e.chunk.vb,n=e.floatStride,r=t.spriteFrame.uvSliced,s=3,a=0;a<16;a++)i[s]=r[a].u,i[s+1]=r[a].v,s+=n},updateColor:function(t){for(var e=t.renderData,i=e.chunk.vb,n=e.floatStride,r=5,s=t.color,a=s.r/255,o=s.g/255,h=s.b/255,u=t.node._uiProps.opacity,l=0;l<16;l++)i[r]=a,i[r+1]=o,i[r+2]=h,i[r+3]=u,r+=n}},iY=new Dn,nY=0,rY=[],sY=null;function aY(t){return t&&(t.insetTop>0||t.insetBottom>0||t.insetLeft>0||t.insetRight>0)?2:0}var oY={createData:function(t){return t.requestRenderData()},updateRenderData:function(t){var e=t.renderData,i=t.spriteFrame;if(i&&e&&e.vertDirty){var n=t.node._uiProps.uiTransformComp,r=Math.abs(n.width),s=Math.abs(n.height),a=i.getRect(),o=i.insetLeft,h=i.insetRight,u=a.width-o-h,l=i.insetTop,c=i.insetBottom,_=a.height-l-c,d=r-o-h,f=s-l-c;d=d>0?d:0,f=f>0?f:0;var p=0===u?d:d/u,m=0===_?f:f/_,g=aY(i),v=Math.ceil(m+g),y=Math.ceil(p+g);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;sY=null,sY=new Uint16Array(t);for(var i=0,n=0;n<e;n++)sY[i++]=0+4*n,sY[i++]=1+4*n,sY[i++]=2+4*n,sY[i++]=1+4*n,sY[i++]=3+4*n,sY[i++]=2+4*n}else G("illegal index count!")},updateUVs:function(t){t.renderData.vertDirty=!0,t.markForUpdateRenderData()},fillBuffers:function(t){var e=t.node,i=t.renderData,n=i.chunk;(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,a=n.meshBuffer.iData,o=s.indexOffset,h=0;h<i.indexCount;h+=6)a[o++]=r,a[o++]=r+1,a[o++]=r+2,a[o++]=r+1,a[o++]=r+3,a[o++]=r+2,r+=4,s.indexOffset+=6;s.setDirty()},updateWorldUVData:function(t){for(var e=t.renderData,i=e.floatStride,n=e.data,r=e.chunk.vb,s=0;s<n.length;s++){var a=s*i;r[a+3]=n[s].u,r[a+4]=n[s].v}},updateWorldVertexAndUVData:function(t,e){t.node.getWorldMatrix(iY);for(var i=t.renderData,n=i.floatStride,r=i.data,s=e.vb,a=r.length,o=0;o<a;o++){var h=r[o].x,u=r[o].y,l=r[o].z,c=iY.m03*h+iY.m07*u+iY.m11*l+iY.m15;c=c?1/c:1;var _=o*n;s[_]=(iY.m00*h+iY.m04*u+iY.m08*l+iY.m12)*c,s[_+1]=(iY.m01*h+iY.m05*u+iY.m09*l+iY.m13)*c,s[_+2]=(iY.m02*h+iY.m06*u+iY.m10*l+iY.m14)*c}this.updateWorldUVData(t)},updateVerts:function(t,e,i,n,r){var s,a,o=t.node._uiProps.uiTransformComp,h=t.renderData.data,u=t.spriteFrame,l=u.rect,c=Math.abs(o.width),_=Math.abs(o.height),d=o.anchorX*c,f=o.anchorY*_,p=u.insetLeft,m=u.insetRight,g=l.width-p-m,v=u.insetTop,y=u.insetBottom,T=l.height-v-y,S=o.width/(p+m)>1?1:o.width/(p+m),E=o.height/(v+y)>1?1:o.height/(v+y);s=g>0?Math.floor(1e3*e)/1e3%g==0?g:e%g:e,a=T>0?Math.floor(1e3*i)/1e3%T==0?T:i%T:i,rY.length=0,nY=Math.max(n+1,r+1);for(var A=0;A<nY;A++)rY.push({x:0,y:0,z:0,u:0,v:0,color:new pn});var R=aY(u);if(0===R)for(var b=0;b<nY;b++)rY[b].x=b>=r?c-d:b*g-d,rY[b].y=b>=n?_-f:b*T-f;else for(var C=0;C<nY;C++)0===C?rY[C].x=-d:1===C?rY[C].x=p*S-d:C>1&&C<r-1?rY[C].x=g>0?p*S-d+g*(C-1):p+e-d:C===r-1?rY[C].x=p*S-d+s+g*(C-2):C>=r&&(rY[C].x=Math.min(p+e+m,c)-d),0===C?rY[C].y=-f:1===C?rY[C].y=y*E-f:C>1&&C<n-1?rY[C].y=T>0?y*E-f+T*(C-1):y+i-f:C===n-1?rY[C].y=y*E-f+a+T*(C-2):C>=n&&(rY[C].y=Math.min(y+i+v,_)-f);for(var w=0,x=0,I=0,O=0,D=0;D<n;++D){I=rY[D].y,O=rY[D+1].y;for(var M=0;M<r;++M){w=rY[M].x,x=rY[M+1].x;var P=4*(D*r+M);h[P].x=w,h[P].y=I,h[P+1].x=x,h[P+1].y=I,h[P+2].x=w,h[P+2].y=O,h[P+3].x=x,h[P+3].y=O}}var B=u.rotated;u.uv;var N=u.uvSliced;Kj=N[0],qj=N[1],Qj=N[2],Zj=N[3],Jj=N[4],$j=N[8],tY=N[12];for(var L=0,F=0,k=0===g?e:e/g,U=0===T?i:i/T,G=[],H=[],z=0;z<n;++z){F=i>T?i>=(R>0?z:z+1)*T?1:U%1:U;for(var V=0;V<r;++V){L=e>g?e>=(R>0?V:V+1)*g?1:k%1:k,B?(0===R?(G[0]=Jj.u,G[1]=Jj.u,G[2]=Jj.u+($j.u-Jj.u)*F,H[0]=qj.v,H[1]=qj.v+(Qj.v-qj.v)*L,H[2]=qj.v):(0===z?(G[0]=Kj.u,G[1]=Kj.u,G[2]=Jj.u):z<n-1?(G[0]=Jj.u,G[1]=Jj.u,G[2]=Jj.u+($j.u-Jj.u)*F):z===n-1&&(G[0]=$j.u,G[1]=$j.u,G[2]=tY.u),0===V?(H[0]=Kj.v,H[1]=qj.v,H[2]=Kj.v):V<r-1?(H[0]=qj.v,H[1]=qj.v+(Qj.v-qj.v)*L,H[2]=qj.v):V===r-1&&(H[0]=Qj.v,H[1]=Zj.v,H[2]=Qj.v)),G[3]=G[2],H[3]=H[1]):(0===R?(G[0]=qj.u,G[1]=qj.u+(Qj.u-qj.u)*L,G[2]=qj.u,H[0]=Jj.v,H[1]=Jj.v,H[2]=Jj.v+($j.v-Jj.v)*F):(0===V?(G[0]=Kj.u,G[1]=qj.u,G[2]=Kj.u):V<r-1?(G[0]=qj.u,G[1]=qj.u+(Qj.u-qj.u)*L,G[2]=qj.u):V===r-1&&(G[0]=Qj.u,G[1]=Zj.u,G[2]=Qj.u),0===z?(H[0]=Kj.v,H[1]=Kj.v,H[2]=Jj.v):z<n-1?(H[0]=Jj.v,H[1]=Jj.v,H[2]=Jj.v+($j.v-Jj.v)*F):z===n-1&&(H[0]=$j.v,H[1]=$j.v,H[2]=tY.v)),G[3]=G[1],H[3]=H[2]);var W=4*(z*r+V);h[W].u=G[0],h[W].v=H[0],h[W+1].u=G[1],h[W+1].v=H[1],h[W+2].u=G[2],h[W+2].v=H[2],h[W+3].u=G[3],h[W+3].v=H[3]}}},updateColorLate:function(t){for(var e=t.renderData,i=e.chunk.vb,n=e.floatStride,r=e.vertexCount,s=5,a=t.color,o=a.r/255,h=a.g/255,u=a.b/255,l=t.node._uiProps.opacity,c=0;c<r;c++)i[s]=o,i[s+1]=h,i[s+2]=u,i[s+3]=l,s+=n},updateColor:function(){}},hY=dz.Type,uY=dz.FillType,lY=t("s",{getAssembler:function(t){var e=Wj,i=t;switch(i.type){case hY.SLICED:e=eY;break;case hY.TILED:e=oY;break;case hY.FILLED:e=i.fillType===uY.RADIAL?zj:Cj}return e}});dz.Assembler=lY;var cY=[bw.EventType.MOUSE_DOWN,bw.EventType.MOUSE_MOVE,bw.EventType.MOUSE_UP,bw.EventType.MOUSE_WHEEL],_Y=[bw.EventType.TOUCH_START,bw.EventType.TOUCH_MOVE,bw.EventType.TOUCH_END,bw.EventType.TOUCH_CANCEL];new(function(){function t(){this.priority=fw.UI,this._isListDirty=!1,this._inDispatchCount=0,this._pointerEventProcessorList=[],this._processorListToAdd=[],this._processorListToRemove=[],Cw._registerEventDispatcher(this),aN.callbacksInvoker.on($B.ADD_POINTER_EVENT_PROCESSOR,this.addPointerEventProcessor,this),aN.callbacksInvoker.on($B.REMOVE_POINTER_EVENT_PROCESSOR,this.removePointerEventProcessor,this),aN.callbacksInvoker.on($B.MARK_LIST_DIRTY,this._markListDirty,this)}var e=t.prototype;return e.dispatchEvent=function(t){var e=t.type;return _Y.includes(e)?this.dispatchEventTouch(t):!cY.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 a=e[s];if(a.isEnabled&&a.shouldHandleEventTouch)if(t.type===CC.TOUCH_START){if(a._handleEventTouch(t)){if(a.isEnabled)a.claimedTouchIdList.push(n.getID());else{var o=new MC([t.touch],!0,CC.TOUCH_CANCEL);o.touch=t.touch,a.dispatchEvent(o),a.claimedTouchIdList.length=0}if(r=!1,!t.preventSwallow)break;t.preventSwallow=!1}}else if(a.claimedTouchIdList.length>0){var h=a.claimedTouchIdList.indexOf(n.getID());if(-1!==h){if(a._handleEventTouch(t),t.type!==CC.TOUCH_END&&t.type!==CC.TOUCH_CANCEL||oe(a.claimedTouchIdList,h),r=!1,!t.preventSwallow)break;t.preventSwallow=!1}}}return--this._inDispatchCount<=0&&this._updatePointerEventProcessorList(),r},e._updatePointerEventProcessorList=function(){for(var t=this._processorListToAdd,e=t.length,i=0;i<e;++i)this.addPointerEventProcessor(t[i]);t.length=0;for(var n=this._processorListToRemove,r=n.length,s=0;s<r;++s)this.removePointerEventProcessor(n[s]);n.length=0},e._sortPointerEventProcessorList=function(){if(this._isListDirty){for(var t=this._pointerEventProcessorList,e=t.length,i=0;i<e;++i){var n=t[i],r=n.node;if(r._uiProps){var s=r._uiProps.uiTransformComp;n.cachedCameraPriority=s.cameraPriority}}t.sort(this._sortByPriority),this._isListDirty=!1}},e._sortByPriority=function(t,e){var i=t.node,n=e.node;if(!(e&&n&&n.activeInHierarchy&&n._uiProps.uiTransformComp))return-1;if(!(t&&i&&i.activeInHierarchy&&i._uiProps.uiTransformComp))return 1;if(t.cachedCameraPriority!==e.cachedCameraPriority)return e.cachedCameraPriority-t.cachedCameraPriority;for(var r=i,s=n,a=!1;(null===(o=r.parent)||void 0===o?void 0:o.uuid)!==(null===(h=s.parent)||void 0===h?void 0:h.uuid);){var o,h,u,l,c,_;r=null===(null===(u=r)||void 0===u||null===(l=u.parent)||void 0===l?void 0:l.parent)?(a=!0)&&n:r&&r.parent,s=null===(null===(c=s)||void 0===c||null===(_=c.parent)||void 0===_?void 0:_.parent)?(a=!0)&&i:s&&s.parent}if(r.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 a?d-f:f-d},e._markListDirty=function(){this._isListDirty=!0},t}());var dY=new C_(null),fY=new Dn,pY=t("w",function(){function t(t){var e=this;this.device=void 0,this._screens=[],this._staticVBBuffer=null,this._bufferAccessors=new Map,this._drawBatchPool=void 0,this._batches=void 0,this._currBID=-1,this._indexStart=0,this._emptyMaterial=new OS,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 gY,this._meshDataArray=[],this._maskClearModel=null,this._maskClearMtl=null,this._maskModelMesh=null,this._root=t,this.device=t.device,this._batches=new Nu(64),this._drawBatchPool=new Pu((function(){return new lX}),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(),Lk.sharedManager.destroy(),this._maskClearModel&&this._maskModelMesh&&(v.director.root.destroyModel(this._maskClearModel),this._maskModelMesh.destroy()),this._maskClearMtl&&this._maskClearMtl.destroy()},e.syncRootNodesToNative=function(){},e.addScreen=function(t){this._screens.push(t),this._screens.sort(this._screenSort)},e.removeScreen=function(t){var e=this._screens.indexOf(t);-1!==e&&this._screens.splice(e,1)},e.sortScreens=function(){this._screens.sort(this._screenSort)},e.getFirstRenderCamera=function(t){if(t.scene&&t.scene.renderScene)for(var e=t.scene.renderScene.cameras,i=0;i<e.length;i++){var n=e[i];if(n.visibility&t.layer)return n}return null},e.update=function(){for(var t=this._screens,e=0,i=0;i<t.length;++i){var n=t[i],r=n._getRenderScene();if(n.enabledInHierarchy&&r){this._opacityDirty=0,this._pOpacity=1,this.walk(n.node),this.autoMergeBatches(this._currComponent),this.resetRenderStates();var s=0;if(this._batches.length>e)for(;e<this._batches.length;++e){var a=this._batches.array[e];if(a.model)for(var o=a.model.subModels,h=0;h<o.length;h++)o[h].priority=s++;else a.descriptorSet=this._descriptorSetCache.getDescriptorSet(a);r.addBatch(a)}}}},e.uploadBuffers=function(){if(this._batches.length>0){for(var t=this._meshDataArray.length,e=0;e<t;e++)this._meshDataArray[e].uploadBuffers();for(var i,n=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(),Lk.sharedManager.reset()},e.switchBufferAccessor=function(t){void 0===t&&(t=fk);var e=t===fk?36:yk(t);if(!this._staticVBBuffer||this._staticVBBuffer.vertexFormatBytes!==e){var i=this._bufferAccessors.get(e);i||(i=new Ok(this.device,t),this._bufferAccessors.set(e,i)),this._staticVBBuffer=i,this._currBID=-1}return this._staticVBBuffer},e.registerBufferAccessor=function(t,e){this._bufferAccessors.set(t,e)},e.updateBuffer=function(t,e){var i=this.switchBufferAccessor(t);this._currBID!==e&&(this._currBID=e,this._indexStart=i.getMeshBuffer(e).indexOffset)},e.commitComp=function(t,e,i,n,r){var s,a=0,o=-1;if(e&&e.chunk){if(!e.isValid())return;a=e.dataHash,s=e.material,o=e.chunk.bufferId}t.stencilStage===Rk.ENTER_LEVEL||t.stencilStage===Rk.ENTER_LEVEL_INVERTED?this._insertMaskBatch(t):t.stencilStage=Lk.sharedManager.stage;var h=t.stencilStage;this._currHash===a&&0!==a&&this._currMaterial===s&&this._currDepthStencilStateStage===h||(this.autoMergeBatches(this._currComponent),e&&!e._isMeshBuffer&&this.updateBuffer(e.vertexFormat,o),this._currRenderData=e,this._currHash=e?e.dataHash:0,this._currComponent=t,this._currTransform=r,this._currMaterial=t.getRenderMaterial(0),this._currDepthStencilStateStage=h,this._currLayer=t.node.layer,i?(this._currTexture=i.getGFXTexture(),this._currSampler=i.getGFXSampler(),this._currTextureHash=i.getHash(),this._currSamplerHash=this._currSampler.hash):(this._currTexture=null,this._currSampler=null,this._currTextureHash=0,this._currSamplerHash=0)),n.fillBuffers(t,this)},e.commitIA=function(t,e,i,n,r){var s;this._currMaterial!==this._emptyMaterial&&(this.autoMergeBatches(this._currComponent),this.resetRenderStates());var a=0;t&&(t.stencilStage=Lk.sharedManager.stage,s=null!==t.customMaterial?Lk.sharedManager.getStencilStage(t.stencilStage,n):Lk.sharedManager.getStencilStage(t.stencilStage),a=Lk.sharedManager.getStencilHash(t.stencilStage));var o=this._currStaticRoot?this._currStaticRoot._requireDrawBatch():this._drawBatchPool.alloc();o.visFlags=t.node.layer,o.inputAssembler=e,o.useLocalData=r||null,i&&(o.texture=i.getGFXTexture(),o.sampler=i.getGFXSampler(),o.textureHash=i.getHash(),o.samplerHash=o.sampler.hash),o.fillPasses(n||null,s,a,null),this._batches.push(o)},e.commitMiddleware=function(t,e,i,n,r,s,a){var o=r.getGFXTexture();a&&this._middlewareEnableBatch&&this._middlewareBuffer===e&&this._currTexture===o&&this._currMaterial.hash===s.hash&&this._middlewareIndexStart+this._middlewareIndexCount===i&&this._currLayer===t.node.layer?this._middlewareIndexCount+=n:(this.autoMergeBatches(this._currComponent),this.resetRenderStates(),this._currComponent=t,this._currTexture=o,this._currSampler=r.getGFXSampler(),this._currTextureHash=r.getHash(),this._currLayer=t.node.layer,this._currSamplerHash=this._currSampler.hash,this._currHash=0,this._currTransform=a?null:t.node,this._middlewareEnableBatch=a,this._middlewareBuffer=e,this._currMaterial=s,this._middlewareIndexStart=i,this._middlewareIndexCount=n),this._currIsMiddleware=!0},e.commitModel=function(t,e,i){var n;this._currMaterial!==this._emptyMaterial&&(this.autoMergeBatches(this._currComponent),this.resetRenderStates());var r=0;i&&(t.stencilStage===Rk.ENTER_LEVEL||t.stencilStage===Rk.ENTER_LEVEL_INVERTED?this._insertMaskBatch(t):t.stencilStage=Lk.sharedManager.stage,n=Lk.sharedManager.getStencilStage(t.stencilStage,i),r=Lk.sharedManager.getStencilHash(t.stencilStage));var s=v.director.getTotalFrames();e&&(e.updateTransform(s),e.updateUBOs(s));for(var a=0;a<e.subModels.length;a++){var o=this._drawBatchPool.alloc(),h=e.subModels[a];o.visFlags=t.node.layer,o.model=e,o.texture=null,o.sampler=null,o.useLocalData=null,n||(n=null),o.fillPasses(i,n,r,h.patches),o.inputAssembler=h.inputAssembler,o.model.visFlags=o.visFlags,o.descriptorSet=h.descriptorSet,this._batches.push(o)}},e.setupStaticBatch=function(t,e){this.finishMergeBatches(),this._staticVBBuffer=e,this.currStaticRoot=t},e.endStaticBatch=function(){this.finishMergeBatches(),this.currStaticRoot=null,this._staticVBBuffer=null,this.switchBufferAccessor()},e.commitStaticBatch=function(t){this._batches.concat(t.drawBatchList),this.finishMergeBatches()},e.autoMergeBatches=function(t){if(this._currIsMiddleware)this.mergeBatchesForMiddleware(t);else{var e=this._currMaterial;if(e){var i,n=this._currRenderData,r=this._staticVBBuffer;if(n&&n._isMeshBuffer)i=n.requestIA(this.device),-1===this._meshDataArray.indexOf(n)&&this._meshDataArray.push(n);else if(r){var s=this._currBID,a=r.getMeshBuffer(s);if(!a)return;var o=a.indexOffset-this._indexStart;if(o<=0)return;this._indexStart,a.indexOffset,a.setDirty(),(i=a.requireFreeIA(this.device)).firstIndex=this._indexStart,i.indexCount=o,this._indexStart=a.indexOffset}if(this._currBID=-1,i&&this._currTexture){var h,u=0;t&&(h=null!==t.customMaterial?Lk.sharedManager.getStencilStage(t.stencilStage,e):Lk.sharedManager.getStencilStage(t.stencilStage),u=Lk.sharedManager.getStencilHash(t.stencilStage));var l=this._currStaticRoot?this._currStaticRoot._requireDrawBatch():this._drawBatchPool.alloc();l.visFlags=this._currLayer,l.texture=this._currTexture,l.sampler=this._currSampler,l.inputAssembler=i,l.useLocalData=this._currTransform,l.textureHash=this._currTextureHash,l.samplerHash=this._currSamplerHash,l.fillPasses(e,h,u,null),this._batches.push(l)}}}},e.mergeBatchesForMiddleware=function(t){var e,i;t.stencilStage=Lk.sharedManager.stage,e=null!==t.customMaterial?Lk.sharedManager.getStencilStage(t.stencilStage,this._currMaterial):Lk.sharedManager.getStencilStage(t.stencilStage),i=Lk.sharedManager.getStencilHash(t.stencilStage);var n=this._currStaticRoot?this._currStaticRoot._requireDrawBatch():this._drawBatchPool.alloc();n.visFlags=t.node.layer;var r=this._middlewareBuffer.requireFreeIA(this.device);r.firstIndex=this._middlewareIndexStart,r.indexCount=this._middlewareIndexCount,n.inputAssembler=r,n.useLocalData=this._currTransform,n.texture=this._currTexture,n.sampler=this._currSampler,n.textureHash=this._currTextureHash,n.samplerHash=this._currSamplerHash,n.fillPasses(this._currMaterial||null,e,i,null),this._batches.push(n),this._currIsMiddleware=!1,this._middlewareBuffer=null},e.forceMergeBatches=function(t,e,i){this._currMaterial=t,e?(this._currTexture=e.getGFXTexture(),this._currSampler=e.getGFXSampler(),this._currTextureHash=e.getHash(),this._currSamplerHash=this._currSampler.hash):(this._currTexture=this._currSampler=null,this._currTextureHash=this._currSamplerHash=0),this._currLayer=i.node.layer,this.autoMergeBatches(i)},e.resetRenderStates=function(){this._currMaterial=this._emptyMaterial,this._currRenderData=null,this._currTexture=null,this._currComponent=null,this._currTransform=null,this._currTextureHash=0,this._currSamplerHash=0,this._currLayer=0},e.finishMergeBatches=function(){this.autoMergeBatches(),this.resetRenderStates()},e.flushMaterial=function(t){this._currMaterial=t},e.walk=function(t,e){if(void 0===e&&(e=0),t.activeInHierarchy){var i=t.children,n=t._uiProps,r=n.uiComp,s=this._pOpacity,a=s,o=r&&r.color?r.color.a/255:1;if(this._pOpacity=a*=o*n.localOpacity,n.setOpacity(a),!xi(a,0,Ci)){if(n.colorDirty&&this._opacityDirty++,r&&r.enabledInHierarchy&&r.fillBuffers(this),this._opacityDirty&&r&&!r.useVertexOpacity&&r.renderData&&r.renderData.vertexCount>0){!function(t,e){for(var i,n,r,s=t.vertexFormat,a=t.chunk.vb,o=0,h=0;h<s.length;++h){if(i=s[h],(n=F_[i.format]).hasAlpha)if(r=t.floatStride,n.size/n.count==1)for(var u=~~Ii(Math.round(255*e),0,255),l=o;l<a.length;l+=r)a[l]=(4294967040&a[l]|u)>>>0;else if(n.size/n.count==4)for(var c=o+3;c<a.length;c+=r)a[c]=e;o+=n.size>>2}}(r.renderData,a);var h=r.renderData.getMeshBuffer();h&&h.setDirty()}if(i.length>0&&!t._static)for(var u=0;u<i.length;++u){var l=i[u];this.walk(l,e)}n.colorDirty&&(this._opacityDirty--,n.colorDirty=!1)}this._pOpacity=s,r&&r.enabledInHierarchy&&(r.postUpdateAssembler(this),(r.stencilStage===Rk.ENTER_LEVEL||r.stencilStage===Rk.ENTER_LEVEL_INVERTED)&&Lk.sharedManager.getMaskStackSize()>0&&(this.autoMergeBatches(this._currComponent),this.resetRenderStates(),Lk.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=aS.get("default-clear-stencil"),this._maskClearModel=v.director.root.createModel(IB);var t=yk(_k),e=wd.gfxDevice,i=e.createBuffer(new qc(ql.VERTEX|ql.TRANSFER_DST,Jl.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 qc(ql.INDEX|ql.TRANSFER_DST,Jl.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 Lx([i],_k,vc.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=Lk.sharedManager;e.pushMask(1);var i,n=e.clear(t),r=0,s=this._maskClearMtl;s&&(i=e.getStencilStage(n,s),r=e.getStencilHash(n));var a=this._maskClearModel,o=v.director.getTotalFrames();a&&(a.updateTransform(o),a.updateUBOs(o));for(var h=0;h<a.subModels.length;h++){var u=this._drawBatchPool.alloc(),l=a.subModels[h];u.visFlags=t.node.layer,u.model=a,u.texture=null,u.sampler=null,u.useLocalData=null,i||(i=null),u.fillPasses(s,i,r,l.patches),u.inputAssembler=l.inputAssembler,u.model.visFlags=u.visFlags,u.descriptorSet=l.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}()),mY=function(){function t(){this._descriptorSet=null,this._transform=null,this._textureHash=0,this._samplerHash=0,this._localBuffer=null,this._transformUpdate=!0;var t=wd.gfxDevice;this._localData=new Float32Array(qg.COUNT),this._localBuffer=t.createBuffer(new qc(ql.UNIFORM|ql.TRANSFER_DST,Jl.HOST|Jl.DEVICE,qg.SIZE,qg.SIZE))}var e=t.prototype;return e.initialize=function(t){var e=wd.gfxDevice;this._transform=t.useLocalData,this._textureHash=t.textureHash,this._samplerHash=t.samplerHash,dY.layout=t.passes[0].localSetLayout,this._descriptorSet=e.createDescriptorSet(dY),this._descriptorSet.bindBuffer(qg.BINDING,this._localBuffer);var i=bg.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;Dn.toArray(this._localData,e,qg.MAT_WORLD_OFFSET),Dn.invert(fY,e),Dn.transpose(fY,fY);var i=Dn.determinant(fY),n=1/Math.sqrt(i);Dn.multiplyScalar(fY,fY,n),Dn.toArray(this._localData,fY,qg.MAT_WORLD_IT_OFFSET),this._localBuffer.update(this._localData),this._transformUpdate=!1}},n(t,[{key:"descriptorSet",get:function(){return this._descriptorSet}}]),t}(),gY=function(){function t(){this._descriptorSetCache=new Map,this._dsCacheHashByTexture=new Map,this._localDescriptorSetCache=[],this._localCachePool=void 0,this._localCachePool=new Pu((function(){return new mY}),16,(function(t){return t.destroy()}))}var e=t.prototype;return e.getDescriptorSet=function(t){var e;if(v.director.root,t.useLocalData){for(var i=this._localDescriptorSetCache,n=0,r=i.length;n<r;n++){var s=i[n];if(s.equals(t.useLocalData,t.textureHash,t.samplerHash))return s.descriptorSet}var a=this._localCachePool.alloc();return a.initialize(t),this._localDescriptorSetCache.push(a),a.descriptorSet}if(e=t.textureHash^t.samplerHash,this._descriptorSetCache.has(e))return this._descriptorSetCache.get(e);dY.layout=t.passes[0].localSetLayout;var o=wd.gfxDevice.createDescriptorSet(dY),h=bg.SAMPLER_SPRITE;return o.bindTexture(h,t.texture),o.bindSampler(h,t.sampler),o.update(),this._descriptorSetCache.set(e,o),this._dsCacheHashByTexture.set(t.textureHash,e),o},e.update=function(){var t=this._localDescriptorSetCache,e=t.length;if(0!==e){for(var i=[],n=0;n<e;n++){var r=t[n];if(r.isValid())r.uploadLocalData();else{r.reset();var s=t.indexOf(r);i.push(s)}}for(var a=i.length-1;a>=0;a--){var o=i[a],h=t[o];t.splice(o,1),this._localCachePool.free(h)}}},e.reset=function(){for(var t=this._localDescriptorSetCache,e=t.length,i=0;i<e;i++){var n=t[i];this._localCachePool.free(n)}this._localDescriptorSetCache.length=0},e.releaseDescriptorSetCache=function(t){var e=this._dsCacheHashByTexture.get(t);e&&this._descriptorSetCache.has(e)&&(this._descriptorSetCache.get(e).destroy(),this._descriptorSetCache.delete(e),this._dsCacheHashByTexture.delete(t))},e.destroy=function(){for(var t,e=d(this._descriptorSetCache.values());!(t=e()).done;)t.value.destroy();this._descriptorSetCache.clear(),this._dsCacheHashByTexture.clear(),this._localDescriptorSetCache.length=0,this._localCachePool.destroy()},t}();v.internal.Batcher2D=pY,t("x",function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(lX)),at(Ck.prototype,"MeshBuffer",["byteStart","vertexStart","indicesStart","request"].map((function(t){return{name:t,suggest:"please use meshBuffer.accessor."+t+" instead"}}))),rt(Ck.prototype,"MeshBuffer",[{name:"indicesOffset",newName:"indexOffset"}]),st(Ck.prototype,"MeshBuffer",[{name:"vertexBuffers"},{name:"indexBuffer"}]),rt(pY.prototype,"Batcher2D",[{name:"currBufferBatch",newName:"currBufferAccessor"},{name:"acquireBufferBatch",newName:"switchBufferAccessor"}]),st(Jk.prototype,"MeshRenderData",[{name:"formatByte"},{name:"byteStart"},{name:"byteCount"}]),rt(Jk.prototype,"MeshRenderData",[{name:"indicesStart",newName:"indexStart"}]),t("Q",function(t){function e(e){var i;return i=t.call(this,e)||this,q(9006),i}return s(e,t),e}(Jk));var vY,yY=T.document,TY=null,SY=-1,EY="BES bswy:->@123丁ぁᄁ",AY=Object.create(null),RY=[],bY=3e3;function CY(){for(var t=!0,e=Date.now(),i=RY.length-1;i>=0;i--){var n=RY[i],r=n.fontFamilyName;if(e-n.startTime>bY)q(4933,r),n.onComplete(null,r),RY.splice(i,1);else{var s=n.refWidth,a="40px "+r;TY.font=a,s!==JF(TY,EY,a)?(RY.splice(i,1),n.onComplete(null,r)):t=!1}}t&&(clearInterval(SY),SY=-1)}function wY(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(AY[n])i(null,n);else{if(!TY){var r=yY.createElement("canvas");r.width=100,r.height=100,TY=r.getContext("2d")}var s="40px "+n,a=yY.createElement("style");a.type="text/css";var o="";Number.isNaN(n)?o+="@font-face { font-family:"+n+"; src:":o+='@font-face { font-family:"'+n+'"; src:',o+='url("'+t+'");',a.textContent=o+"}",yY.body.appendChild(a);var h=yY.createElement("div"),u=h.style;if(u.fontFamily=n,h.innerHTML=".",u.position="absolute",u.left="-100px",u.top="-100px",yY.body.appendChild(h),function(){if(void 0===vY)if("FontFace"in T){var t=/Gecko.*Firefox\/(\d+)/.exec(T.navigator.userAgent),e=/OS X.*Version\/10\..*Safari/.exec(T.navigator.userAgent)&&/Apple/.exec(T.navigator.vendor);vY=t?parseInt(t[1],10)>42:!e}else vY=!1;return vY}())!function(t,e,i){var n=new Promise((function(i,n){!function r(){Date.now()-t>=bY?n():yY.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,bY)}));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 l={fontFamilyName:n,refWidth:JF(TY,EY,s),onComplete:i,startTime:Date.now()};RY.push(l),-1===SY&&(SY=setInterval(CY,100))}AY[n]=a}}function xY(t,e,i,n){var r=new BF;r._nativeUrl=t,r._nativeAsset=e,n(null,r)}CT.register({".font":wY,".eot":wY,".ttf":wY,".woff":wY,".svg":wY,".ttc":wY}),kT.register({".font":xY,".eot":xY,".ttf":xY,".woff":xY,".svg":xY,".ttc":xY}),v.UI={MeshBuffer:Ck,spriteAssembler:lY,graphicsAssembler:ZX,labelAssembler:Ej,RenderData:Zk,MeshRenderData:Jk},AL.on(EL.EVENT_POST_SUBSYSTEM_INIT,(function(){NY.init()}));var IY,OY,DY,MY,PY,BY,NY=t("a1",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=be.querySettings(Re.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}ve.update(t.Enum),ve.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}());NY.nameMap=new Map,NY.indexMap=new Map,NY.Enum=ve({default:0}),t("a2",(IY=qs("cc.Sorting"),OY=xa(NY.Enum),IY(DY=Js((f((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)._sortingLayer=PY&&PY(),e._sortingOrder=BY&&BY(),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=NY.getLayerIndex(this._sortingLayer),e=NY.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&&NY.isLayerValid(t)&&(this._sortingLayer=t,this._updateSortingPriority())}},{key:"sortingOrder",get:function(){return this._sortingOrder},set:function(t){t!==this._sortingOrder&&(this._sortingOrder=Ii(t,-32768,32767),this._updateSortingPriority())}}]),e}(op)).prototype,"sortingLayer",[OY],Object.getOwnPropertyDescriptor(MY.prototype,"sortingLayer"),MY.prototype),PY=Gs(MY.prototype,"_sortingLayer",[ra],(function(){return NY.Enum.default})),BY=Gs(MY.prototype,"_sortingOrder",[ra],(function(){return 0})),DY=MY))||DY)||DY));var LY,FY,kY,UY,GY,HY,zY,VY,WY,XY,jY,YY,KY,qY,QY,ZY,JY,$Y,tK,eK,iK,nK,rK,sK,aK,oK,hK,uK,lK,cK,_K,dK,fK,pK,mK,gK,vK,yK,TK,SK,EK,AK,RK=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._morphRenderingInstance=null,e._usedMaterials=new Set,e}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}(IB),bK=qs,CK=Zs,wK=xa,xK=sa,IK=ra,OK=oS("specular-pass");function DK(t){var e=t.passes,i=v.rendering;ny()&&(OK=i.getPhaseID(i.getPassID("specular-pass"),"default"));for(var n=0;n<e.length;n++)if((!i||!i.enableEffectImport)&&e[n].phase===OK||ny()&&e[n].phaseID===OK)return n;return-1}var MK,PK,BK,NK,LK,FK,kK,UK,GK=ve({OFF:0,ON:1}),HK=ve({OFF:0,ON:1}),zK=(LY=bK("cc.ModelBakeSettings"),FY=xK("_recieveShadow"),kY=wK(Ke),UY=wK(Qe),GY=wK(Qe),HY=wK(ve(_B)),zY=wK(Qe),LY(((eK=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).texture=XY&&XY(),e.uvParam=jY&&jY(),e._bakeable=YY&&YY(),e._castShadow=KY&&KY(),e._receiveShadow=qY&&qY(),e._lightmapSize=QY&&QY(),e._useLightProbe=ZY&&ZY(),e._bakeToLightProbe=JY&&JY(),e._reflectionProbeType=$Y&&$Y(),e._bakeToReflectionProbe=tK&&tK(),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}(Ju)).USE_LIGHT_PROBE_CHANGED="use_light_probe_changed",eK.REFLECTION_PROBE_CHANGED="reflection_probe_changed",eK.BAKE_TO_REFLECTION_PROBE_CHANGED="bake_to_reflection_probe_changed",XY=Gs((WY=eK).prototype,"texture",[IK],(function(){return null})),jY=Gs(WY.prototype,"uvParam",[IK],(function(){return new nn})),YY=Gs(WY.prototype,"_bakeable",[IK],(function(){return!1})),KY=Gs(WY.prototype,"_castShadow",[IK],(function(){return!1})),qY=Gs(WY.prototype,"_receiveShadow",[FY],(function(){return!1})),QY=Gs(WY.prototype,"_lightmapSize",[IK],(function(){return 64})),ZY=Gs(WY.prototype,"_useLightProbe",[IK],(function(){return!1})),JY=Gs(WY.prototype,"_bakeToLightProbe",[IK],(function(){return!0})),$Y=Gs(WY.prototype,"_reflectionProbeType",[IK],(function(){return _B.NONE})),tK=Gs(WY.prototype,"_bakeToReflectionProbe",[IK],(function(){return!0})),f(WY.prototype,"lightmapSize",[kY],Object.getOwnPropertyDescriptor(WY.prototype,"lightmapSize"),WY.prototype),f(WY.prototype,"useLightProbe",[UY],Object.getOwnPropertyDescriptor(WY.prototype,"useLightProbe"),WY.prototype),f(WY.prototype,"bakeToLightProbe",[GY],Object.getOwnPropertyDescriptor(WY.prototype,"bakeToLightProbe"),WY.prototype),f(WY.prototype,"reflectionProbe",[HY],Object.getOwnPropertyDescriptor(WY.prototype,"reflectionProbe"),WY.prototype),f(WY.prototype,"bakeToReflectionProbe",[zY],Object.getOwnPropertyDescriptor(WY.prototype,"bakeToReflectionProbe"),WY.prototype),VY=WY))||VY),VK=t("a7",(iK=bK("cc.MeshRenderer"),nK=CK(100),rK=wK(qe),sK=wK(qe),aK=wK(GK),oK=wK(HK),hK=wK(QL),uK=wK(Qe),iK(lK=nK(((AK=function(t){s(i,t);var e=i.prototype;function i(){var e;return(e=t.call(this)||this).bakeSettings=_K&&_K(),e._mesh=dK&&dK(),e._shadowCastingMode=fK&&fK(),e._shadowReceivingMode=pK&&pK(),e._shadowBias=mK&&mK(),e._shadowNormalBias=gK&&gK(),e._reflectionProbeId=vK&&vK(),e._reflectionProbeBlendId=yK&&yK(),e._reflectionProbeBlendWeight=TK&&TK(),e._enabledGlobalStandardSkinObject=SK&&SK(),e._reflectionProbeDataMap=null,e._subMeshShapesWeights=[],e._modelType=void 0,e._model=null,e._morphInstance=null,e._enableMorph=EK&&EK(),e._modelType=IB,be.querySettings(Re.Category.RENDERING,"highQualityMode")&&(e._shadowCastingMode=GK.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(um.MOBILITY_CHANGED,this.onMobilityChanged,this),this.node.on(um.LIGHT_PROBE_BAKING_CHANGED,this.onLightProbeBakingChanged,this),this.bakeSettings.on(zK.USE_LIGHT_PROBE_CHANGED,this.onUseLightProbeChanged,this),this.bakeSettings.on(zK.REFLECTION_PROBE_CHANGED,this.onReflectionProbeChanged,this),this.bakeSettings.on(zK.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(um.MOBILITY_CHANGED,this.onMobilityChanged,this),this.node.off(um.LIGHT_PROBE_BAKING_CHANGED,this.onLightProbeBakingChanged,this),this.bakeSettings.off(zK.USE_LIGHT_PROBE_CHANGED,this.onUseLightProbeChanged,this),this.bakeSettings.off(zK.REFLECTION_PROBE_CHANGED,this.onReflectionProbeChanged,this),this.bakeSettings.off(zK.BAKE_TO_REFLECTION_PROBE_CHANGED,this.onBakeToReflectionProbeChanged,this)},e.onDestroy=function(){this._model&&(v.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,a=r.views,o=0;o<s.length;o++)if(s[o].name===t){a[o].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===_B.BAKED_CUBEMAP?(this.model.updateReflectionProbeCubemap(r),this.model.updateReflectionProbePlanarMap(null),this.model.updateReflectionProbeBlendCubemap(null)):e===_B.BLEND_PROBES||e===_B.BLEND_PROBES_AND_SKYBOX?(this.model.updateReflectionProbeCubemap(r),this.model.updateReflectionProbeBlendCubemap(i),this.model.updateReflectionProbePlanarMap(null)):e===_B.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===wm.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===IB?RK:this._modelType,e=this._model=v.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 RK&&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|=om.POSITION,this._model.transform.hasChangedFlags|=om.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!==_B.BAKED_CUBEMAP&&this.bakeSettings.reflectionProbe!==_B.BLEND_PROBES&&this.bakeSettings.reflectionProbe!==_B.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 aS.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===GK.OFF?this._model.castShadow=!1:(this._shadowCastingMode,GK.ON,this._shadowCastingMode,this._model.castShadow=!0))},e._updateReceiveShadow=function(){this._model&&(this._shadowReceivingMode===HK.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===_B.BAKED_CUBEMAP||this.bakeSettings.reflectionProbe===_B.BLEND_PROBES||this.bakeSettings.reflectionProbe===_B.BLEND_PROBES_AND_SKYBOX?(v.internal.reflectionProbeManager.selectReflectionProbe(this._model),v.internal.reflectionProbeManager.getUsedReflectionProbe(this._model,!1)||q(16302)):this.bakeSettings.reflectionProbe===_B.PLANAR_REFLECTION&&(v.internal.reflectionProbeManager.selectPlanarReflectionProbe(this._model),v.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===wm.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 RK&&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=v.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(!(DK(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===GK.ON},set:function(t){this.shadowCastingMode=!0===t?GK.ON:GK.OFF}},{key:"receiveShadow",get:function(){return this._shadowReceivingMode},set:function(t){this._shadowReceivingMode=t,this._updateReceiveShadow()}},{key:"receiveShadowForInspector",get:function(){return this._shadowReceivingMode===HK.ON},set:function(t){this._shadowReceivingMode=!0===t?HK.ON:HK.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){v.director.root.pipeline.pipelineSceneData.standardSkinMeshRenderer=t?this:null,this._enabledGlobalStandardSkinObject=t}}]),i}(gW)).ShadowCastingMode=GK,AK.ShadowReceivingMode=HK,_K=Gs((cK=AK).prototype,"bakeSettings",[IK],(function(){return new zK(this)})),dK=Gs(cK.prototype,"_mesh",[IK],(function(){return null})),fK=Gs(cK.prototype,"_shadowCastingMode",[IK],(function(){return GK.OFF})),pK=Gs(cK.prototype,"_shadowReceivingMode",[IK],(function(){return HK.ON})),mK=Gs(cK.prototype,"_shadowBias",[IK],(function(){return 0})),gK=Gs(cK.prototype,"_shadowNormalBias",[IK],(function(){return 0})),vK=Gs(cK.prototype,"_reflectionProbeId",[IK],(function(){return-1})),yK=Gs(cK.prototype,"_reflectionProbeBlendId",[IK],(function(){return-1})),TK=Gs(cK.prototype,"_reflectionProbeBlendWeight",[IK],(function(){return 0})),SK=Gs(cK.prototype,"_enabledGlobalStandardSkinObject",[IK],(function(){return!1})),f(cK.prototype,"shadowBias",[rK],Object.getOwnPropertyDescriptor(cK.prototype,"shadowBias"),cK.prototype),f(cK.prototype,"shadowNormalBias",[sK],Object.getOwnPropertyDescriptor(cK.prototype,"shadowNormalBias"),cK.prototype),f(cK.prototype,"shadowCastingMode",[aK],Object.getOwnPropertyDescriptor(cK.prototype,"shadowCastingMode"),cK.prototype),f(cK.prototype,"receiveShadow",[oK],Object.getOwnPropertyDescriptor(cK.prototype,"receiveShadow"),cK.prototype),f(cK.prototype,"mesh",[hK],Object.getOwnPropertyDescriptor(cK.prototype,"mesh"),cK.prototype),f(cK.prototype,"isGlobalStandardSkinObject",[uK],Object.getOwnPropertyDescriptor(cK.prototype,"isGlobalStandardSkinObject"),cK.prototype),EK=Gs(cK.prototype,"_enableMorph",[IK],(function(){return!0})),lK=cK))||lK)||lK));function WK(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("a4",function(){function t(){}return t.batchStaticModel=function(t,e){var i=t.getComponentsInChildren(VK);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(!WK(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 QL,s=new Dn,a=new Dn;t.getWorldMatrix(a),Dn.invert(a,a);for(var o=0;o<i.length;o++){var h=i[o];h.node.getWorldMatrix(s),Dn.multiply(s,a,s),r.merge(i[o].mesh,s),h.enabled=!1}var u=e.addComponent(VK);return u.mesh=r,u.sharedMaterials=i[0].sharedMaterials,!0},t.unbatchStaticModel=function(t,e){for(var i=t.getComponentsInChildren(VK),n=0;n<i.length;n++)i[n].enabled=!0;var r=e.getComponent(VK);return r&&(r.mesh&&r.mesh.destroyRenderingMesh(),r.destroy()),!0},t}()),rt(QL.prototype,"Mesh.prototype",[{name:"renderingMesh",newName:"renderingSubMeshes"}]),st(QL.prototype,"Mesh.prototype",[{name:"hasFlatBuffers"},{name:"destroyFlatBuffers"}]);var XK,jK,YK,KK,qK,QK,ZK,JK,$K,tq,eq,iq,nq,rq,sq,aq,oq=t("a6",(MK=qs("cc.Skeleton"),PK=xa([Ze]),BK=xa([Dn]),MK((LK=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._joints=FK&&FK(),e._bindposes=kK&&kK(),e._hash=UK&&UK(),e._invBindposes=null,e}s(e,t);var i=e.prototype;return i.destroy=function(){var e,i;return null===(e=v.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 Dn;Dn.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=Bl(t,666)}return this._hash}}]),e}(uf),FK=Gs(LK.prototype,"_joints",[PK],(function(){return[]})),kK=Gs(LK.prototype,"_bindposes",[BK],(function(){return[]})),UK=Gs(LK.prototype,"_hash",[ra],(function(){return 0})),NK=LK))||NK));v.Skeleton=oq,st(VK.prototype,"MeshRenderer.prototype",[{name:"enableDynamicBatching"},{name:"recieveShadows"}]),v.ModelComponent=VK,Jt(VK,"cc.ModelComponent");var hq,uq,lq,cq,_q,dq,fq,pq,mq,gq,vq,yq,Tq,Sq,Eq,Aq,Rq,bq,Cq,wq,xq,Iq,Oq,Dq,Mq,Pq,Bq,Nq,Lq,Fq,kq,Uq,Gq,Hq,zq,Vq,Wq,Xq,jq,Yq,Kq,qq,Qq,Zq,Jq,$q,tQ,eQ,iQ,nQ,rQ,sQ,aQ,oQ,hQ,uQ,lQ,cQ,_Q,dQ,fQ,pQ,mQ,gQ,vQ,yQ,TQ,SQ,EQ,AQ,RQ,bQ,CQ,wQ,xQ,IQ,OQ,DQ,MQ,PQ,BQ,NQ,LQ,FQ,kQ,UQ,GQ,HQ,zQ,VQ,WQ,XQ,jQ,YQ,KQ,qQ,QQ,ZQ,JQ,$Q,tZ,eZ,iZ,nZ,rZ,sZ,aZ,oZ,hZ,uZ,lZ,cZ,_Z,dZ,fZ,pZ,mZ,gZ=new hn,vZ=ve({LUMINOUS_FLUX:0,LUMINANCE:1}),yZ=qs("cc.StaticLightSettings")((jK=function(){function t(){this._baked=YK&&YK(),this._editorOnly=KK&&KK(),this._castShadow=qK&&qK()}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}(),YK=Gs(jK.prototype,"_baked",[ra],(function(){return!1})),KK=Gs(jK.prototype,"_editorOnly",[ra],(function(){return!1})),qK=Gs(jK.prototype,"_castShadow",[ra],(function(){return!1})),XK=jK))||XK,TZ=t("a9",(QK=qs("cc.Light"),ZK=xa(yZ),JK=xa(sm.BitMask),QK(((aq=function(t){function e(){var e;return(e=t.call(this)||this)._color=eq&&eq(),e._useColorTemperature=iq&&iq(),e._colorTemperature=nq&&nq(),e._staticSettings=rq&&rq(),e._visibility=sq&&sq(),e._type=hx.UNKNOWN,e._lightType=void 0,e._light=null,e._lightType=bx,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=v.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&&(v.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 hx.DIRECTIONAL:t.addDirectionalLight(this._light),t.setMainLight(this._light);break;case hx.SPHERE:t.addSphereLight(this._light);break;case hx.SPOT:t.addSpotLight(this._light);break;case hx.POINT:t.addPointLight(this._light);break;case hx.RANGED_DIRECTIONAL:t.addRangedDirLight(this._light)}}},i._detachFromScene=function(){if(this._light&&this._light.scene){var t=this._light.scene;switch(this._type){case hx.DIRECTIONAL:t.removeDirectionalLight(this._light),t.unsetMainLight(this._light);break;case hx.SPHERE:t.removeSphereLight(this._light);break;case hx.SPOT:t.removeSpotLight(this._light);break;case hx.POINT:t.removePointLight(this._light);break;case hx.RANGED_DIRECTIONAL:t.removeRangedDirLight(this._light)}}},i._onUpdateReceiveDirLight=function(){},n(e,[{key:"color",get:function(){return this._color},set:function(t){this._color=t,this._light&&(gZ.x=t.r/255,gZ.y=t.g/255,gZ.z=t.b/255,this._light.color=gZ)}},{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}(op)).Type=hx,aq.PhotometricTerm=vZ,eq=Gs((tq=aq).prototype,"_color",[ra],(function(){return pn.WHITE.clone()})),iq=Gs(tq.prototype,"_useColorTemperature",[ra],(function(){return!1})),nq=Gs(tq.prototype,"_colorTemperature",[ra],(function(){return 6550})),rq=Gs(tq.prototype,"_staticSettings",[ra],(function(){return new yZ})),sq=Gs(tq.prototype,"_visibility",[ra],(function(){return Jv})),f(tq.prototype,"staticSettings",[ZK],Object.getOwnPropertyDescriptor(tq.prototype,"staticSettings"),tq.prototype),f(tq.prototype,"visibility",[JK],Object.getOwnPropertyDescriptor(tq.prototype,"visibility"),tq.prototype),$K=tq))||$K)),SZ=$s,EZ=ra,AZ=sa,RZ=xa,bZ=t("a8",(hq=qs("cc.DirectionalLight"),uq=AZ("_illuminance"),lq=RZ(Ke),cq=SZ({group:{name:"DynamicShadowSettings",displayOrder:1}}),_q=RZ(Qe),dq=SZ({group:{name:"DynamicShadowSettings",displayOrder:5}}),fq=RZ(PS),pq=SZ({group:{name:"DynamicShadowSettings",displayOrder:6}}),mq=RZ(qe),gq=SZ({group:{name:"DynamicShadowSettings",displayOrder:7}}),vq=RZ(qe),yq=SZ({group:{name:"DynamicShadowSettings",displayOrder:8}}),Tq=RZ(qe),Sq=SZ({group:{name:"DynamicShadowSettings",displayOrder:9}}),Eq=RZ(qe),Aq=SZ({group:{name:"DynamicShadowSettings",displayOrder:22}}),Rq=RZ(qe),bq=SZ({group:{name:"DynamicShadowSettings",displayOrder:10}}),Cq=RZ(BS),wq=SZ({group:{name:"DynamicShadowSettings",displayOrder:11}}),xq=RZ(Qe),Iq=SZ({group:{name:"DynamicShadowSettings",displayOrder:12}}),Oq=RZ(qe),Dq=SZ({group:{name:"DynamicShadowSettings",displayOrder:13}}),Mq=RZ(NS),Pq=SZ({group:{name:"DynamicShadowSettings",displayOrder:14}}),Bq=RZ(Qe),Nq=SZ({group:{name:"DynamicShadowSettings",displayOrder:15}}),Lq=RZ(qe),Fq=SZ({group:{name:"DynamicShadowSettings",displayOrder:16}}),kq=RZ(qe),Uq=SZ({group:{name:"DynamicShadowSettings",displayOrder:17}}),Gq=RZ(qe),Hq=SZ({group:{name:"DynamicShadowSettings",displayOrder:19}}),zq=RZ(Qe),Vq=SZ({group:{name:"DynamicShadowSettings",displayOrder:20}}),Wq=RZ(Qe),Xq=SZ({group:{name:"DynamicShadowSettings",displayOrder:21}}),jq=RZ(qe),hq((Kq=function(t){function e(){var e;return(e=t.call(this)||this)._illuminanceHDR=qq&&qq(),e._illuminanceLDR=Qq&&Qq(),e._shadowEnabled=Zq&&Zq(),e._shadowPcf=Jq&&Jq(),e._shadowBias=$q&&$q(),e._shadowNormalBias=tQ&&tQ(),e._shadowSaturation=eQ&&eQ(),e._shadowDistance=iQ&&iQ(),e._shadowInvisibleOcclusionRange=nQ&&nQ(),e._csmLevel=rQ&&rQ(),e._csmLayerLambda=sQ&&sQ(),e._csmOptimizationMode=aQ&&aQ(),e._csmAdvancedOptions=oQ&&oQ(),e._csmLayersTransition=hQ&&hQ(),e._csmTransitionRange=uQ&&uQ(),e._shadowFixedArea=lQ&&lQ(),e._shadowNear=cQ&&cQ(),e._shadowFar=_Q&&_Q(),e._shadowOrthoSize=dQ&&dQ(),e._lightType=MB,be.querySettings(Re.Category.RENDERING,"highQualityMode")&&(e._shadowPcf=PS.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=hx.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(VK);s&&s.onUpdateReceiveDirLight(this._visibility)}}}},n(e,[{key:"illuminance",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR?this._illuminanceHDR:this._illuminanceLDR},set:function(t){v.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=Ii(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,FS.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,FS.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>BS.LEVEL_1},set:function(t){this._csmLevel=t?BS.LEVEL_4:BS.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,FS.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}(TZ),qq=Gs(Kq.prototype,"_illuminanceHDR",[SZ,uq],(function(){return 65e3})),Qq=Gs(Kq.prototype,"_illuminanceLDR",[EZ],(function(){return 65e3*jw.standardExposureValue})),Zq=Gs(Kq.prototype,"_shadowEnabled",[EZ],(function(){return!1})),Jq=Gs(Kq.prototype,"_shadowPcf",[EZ],(function(){return PS.HARD})),$q=Gs(Kq.prototype,"_shadowBias",[EZ],(function(){return 1e-5})),tQ=Gs(Kq.prototype,"_shadowNormalBias",[EZ],(function(){return 0})),eQ=Gs(Kq.prototype,"_shadowSaturation",[EZ],(function(){return 1})),iQ=Gs(Kq.prototype,"_shadowDistance",[EZ],(function(){return 50})),nQ=Gs(Kq.prototype,"_shadowInvisibleOcclusionRange",[EZ],(function(){return 200})),rQ=Gs(Kq.prototype,"_csmLevel",[EZ],(function(){return BS.LEVEL_4})),sQ=Gs(Kq.prototype,"_csmLayerLambda",[EZ],(function(){return.75})),aQ=Gs(Kq.prototype,"_csmOptimizationMode",[EZ],(function(){return NS.RemoveDuplicates})),oQ=Gs(Kq.prototype,"_csmAdvancedOptions",[EZ],(function(){return!1})),hQ=Gs(Kq.prototype,"_csmLayersTransition",[EZ],(function(){return!1})),uQ=Gs(Kq.prototype,"_csmTransitionRange",[EZ],(function(){return.05})),lQ=Gs(Kq.prototype,"_shadowFixedArea",[EZ],(function(){return!1})),cQ=Gs(Kq.prototype,"_shadowNear",[EZ],(function(){return.1})),_Q=Gs(Kq.prototype,"_shadowFar",[EZ],(function(){return 10})),dQ=Gs(Kq.prototype,"_shadowOrthoSize",[EZ],(function(){return 5})),f(Kq.prototype,"illuminance",[lq],Object.getOwnPropertyDescriptor(Kq.prototype,"illuminance"),Kq.prototype),f(Kq.prototype,"shadowEnabled",[cq,_q],Object.getOwnPropertyDescriptor(Kq.prototype,"shadowEnabled"),Kq.prototype),f(Kq.prototype,"shadowPcf",[dq,fq],Object.getOwnPropertyDescriptor(Kq.prototype,"shadowPcf"),Kq.prototype),f(Kq.prototype,"shadowBias",[pq,mq],Object.getOwnPropertyDescriptor(Kq.prototype,"shadowBias"),Kq.prototype),f(Kq.prototype,"shadowNormalBias",[gq,vq],Object.getOwnPropertyDescriptor(Kq.prototype,"shadowNormalBias"),Kq.prototype),f(Kq.prototype,"shadowSaturation",[yq,Tq],Object.getOwnPropertyDescriptor(Kq.prototype,"shadowSaturation"),Kq.prototype),f(Kq.prototype,"shadowDistance",[Sq,Eq],Object.getOwnPropertyDescriptor(Kq.prototype,"shadowDistance"),Kq.prototype),f(Kq.prototype,"shadowInvisibleOcclusionRange",[Aq,Rq],Object.getOwnPropertyDescriptor(Kq.prototype,"shadowInvisibleOcclusionRange"),Kq.prototype),f(Kq.prototype,"csmLevel",[bq,Cq],Object.getOwnPropertyDescriptor(Kq.prototype,"csmLevel"),Kq.prototype),f(Kq.prototype,"enableCSM",[wq,xq],Object.getOwnPropertyDescriptor(Kq.prototype,"enableCSM"),Kq.prototype),f(Kq.prototype,"csmLayerLambda",[Iq,Oq],Object.getOwnPropertyDescriptor(Kq.prototype,"csmLayerLambda"),Kq.prototype),f(Kq.prototype,"csmOptimizationMode",[Dq,Mq],Object.getOwnPropertyDescriptor(Kq.prototype,"csmOptimizationMode"),Kq.prototype),f(Kq.prototype,"shadowFixedArea",[Pq,Bq],Object.getOwnPropertyDescriptor(Kq.prototype,"shadowFixedArea"),Kq.prototype),f(Kq.prototype,"shadowNear",[Nq,Lq],Object.getOwnPropertyDescriptor(Kq.prototype,"shadowNear"),Kq.prototype),f(Kq.prototype,"shadowFar",[Fq,kq],Object.getOwnPropertyDescriptor(Kq.prototype,"shadowFar"),Kq.prototype),f(Kq.prototype,"shadowOrthoSize",[Uq,Gq],Object.getOwnPropertyDescriptor(Kq.prototype,"shadowOrthoSize"),Kq.prototype),f(Kq.prototype,"csmAdvancedOptions",[Hq,zq],Object.getOwnPropertyDescriptor(Kq.prototype,"csmAdvancedOptions"),Kq.prototype),f(Kq.prototype,"csmLayersTransition",[Vq,Wq],Object.getOwnPropertyDescriptor(Kq.prototype,"csmLayersTransition"),Kq.prototype),f(Kq.prototype,"csmTransitionRange",[Xq,jq],Object.getOwnPropertyDescriptor(Kq.prototype,"csmTransitionRange"),Kq.prototype),Yq=Kq))||Yq)),CZ=t("aa",(fQ=qs("cc.SphereLight"),pQ=sa("_luminance"),mQ=xa(Ke),gQ=xa(Ke),vQ=xa(vZ),yQ=xa(qe),TQ=xa(qe),fQ((EQ=function(t){function e(){var e;return(e=t.call(this)||this)._size=AQ&&AQ(),e._luminanceHDR=RQ&&RQ(),e._luminanceLDR=bQ&&bQ(),e._term=CQ&&CQ(),e._range=wQ&&wQ(),e._lightType=PB,e}return s(e,t),e.prototype._createLight=function(){t.prototype._createLight.call(this),this._type=hx.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 v.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR*Rx(this._size):this._luminanceLDR},set:function(t){var e=0;v.director.root.pipeline.pipelineSceneData.isHDR?(this._luminanceHDR=t/Rx(this._size),e=this._luminanceHDR):(this._luminanceLDR=t,e=this._luminanceLDR),this._light&&(this._light.luminance=e)}},{key:"luminance",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){v.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}(TZ),AQ=Gs(EQ.prototype,"_size",[ra],(function(){return.15})),RQ=Gs(EQ.prototype,"_luminanceHDR",[ra,pQ],(function(){return 1700/Rx(.15)})),bQ=Gs(EQ.prototype,"_luminanceLDR",[ra],(function(){return 1700/Rx(.15)*jw.standardExposureValue*jw.standardLightMeterScale})),CQ=Gs(EQ.prototype,"_term",[ra],(function(){return vZ.LUMINOUS_FLUX})),wQ=Gs(EQ.prototype,"_range",[ra],(function(){return 1})),f(EQ.prototype,"luminousFlux",[mQ],Object.getOwnPropertyDescriptor(EQ.prototype,"luminousFlux"),EQ.prototype),f(EQ.prototype,"luminance",[gQ],Object.getOwnPropertyDescriptor(EQ.prototype,"luminance"),EQ.prototype),f(EQ.prototype,"term",[vQ],Object.getOwnPropertyDescriptor(EQ.prototype,"term"),EQ.prototype),f(EQ.prototype,"size",[yQ],Object.getOwnPropertyDescriptor(EQ.prototype,"size"),EQ.prototype),f(EQ.prototype,"range",[TQ],Object.getOwnPropertyDescriptor(EQ.prototype,"range"),EQ.prototype),SQ=EQ))||SQ)),wZ=xa,xZ=ra,IZ=sa,OZ=$s,DZ=t("ab",(xQ=qs("cc.SpotLight"),IQ=IZ("_luminance"),OQ=wZ(vZ),DQ=wZ(qe),MQ=OZ({group:{name:"DynamicShadowSettings",displayOrder:1}}),PQ=wZ(Qe),BQ=OZ({group:{name:"DynamicShadowSettings",displayOrder:2}}),NQ=wZ(PS),LQ=OZ({group:{name:"DynamicShadowSettings",displayOrder:3}}),FQ=wZ(qe),kQ=OZ({group:{name:"DynamicShadowSettings",displayOrder:4}}),UQ=wZ(qe),xQ((HQ=function(t){function e(){var e;return(e=t.call(this)||this)._size=zQ&&zQ(),e._luminanceHDR=VQ&&VQ(),e._luminanceLDR=WQ&&WQ(),e._term=XQ&&XQ(),e._range=jQ&&jQ(),e._spotAngle=YQ&&YQ(),e._shadowEnabled=KQ&&KQ(),e._shadowPcf=qQ&&qQ(),e._shadowBias=QQ&&QQ(),e._shadowNormalBias=ZQ&&ZQ(),e._lightType=GB,e}return s(e,t),e.prototype._createLight=function(){if(t.prototype._createLight.call(this),this._type=hx.SPOT,this.size=this._size,this.range=this._range,this.spotAngle=this._spotAngle,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 v.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR*Rx(this._size):this._luminanceLDR},set:function(t){var e=0;v.director.root.pipeline.pipelineSceneData.isHDR?(this._luminanceHDR=t/Rx(this._size),e=this._luminanceHDR):(this._luminanceLDR=t,e=this._luminanceLDR),this._light&&(this._light.luminance=e)}},{key:"luminance",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){v.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=Mi(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}(TZ),zQ=Gs(HQ.prototype,"_size",[xZ],(function(){return.15})),VQ=Gs(HQ.prototype,"_luminanceHDR",[xZ,IQ],(function(){return 1700/Rx(.15)})),WQ=Gs(HQ.prototype,"_luminanceLDR",[xZ],(function(){return 1700/Rx(.15)*jw.standardExposureValue*jw.standardLightMeterScale})),XQ=Gs(HQ.prototype,"_term",[xZ],(function(){return vZ.LUMINOUS_FLUX})),jQ=Gs(HQ.prototype,"_range",[xZ],(function(){return 1})),YQ=Gs(HQ.prototype,"_spotAngle",[xZ],(function(){return 60})),KQ=Gs(HQ.prototype,"_shadowEnabled",[xZ],(function(){return!1})),qQ=Gs(HQ.prototype,"_shadowPcf",[xZ],(function(){return PS.HARD})),QQ=Gs(HQ.prototype,"_shadowBias",[xZ],(function(){return 1e-5})),ZQ=Gs(HQ.prototype,"_shadowNormalBias",[xZ],(function(){return 0})),f(HQ.prototype,"term",[OQ],Object.getOwnPropertyDescriptor(HQ.prototype,"term"),HQ.prototype),f(HQ.prototype,"size",[DQ],Object.getOwnPropertyDescriptor(HQ.prototype,"size"),HQ.prototype),f(HQ.prototype,"shadowEnabled",[MQ,PQ],Object.getOwnPropertyDescriptor(HQ.prototype,"shadowEnabled"),HQ.prototype),f(HQ.prototype,"shadowPcf",[BQ,NQ],Object.getOwnPropertyDescriptor(HQ.prototype,"shadowPcf"),HQ.prototype),f(HQ.prototype,"shadowBias",[LQ,FQ],Object.getOwnPropertyDescriptor(HQ.prototype,"shadowBias"),HQ.prototype),f(HQ.prototype,"shadowNormalBias",[kQ,UQ],Object.getOwnPropertyDescriptor(HQ.prototype,"shadowNormalBias"),HQ.prototype),GQ=HQ))||GQ));t("ac",(JQ=qs("cc.PointLight"),$Q=sa("_luminance"),tZ=xa(Ke),eZ=xa(Ke),iZ=xa(vZ),nZ=xa(qe),JQ((sZ=function(t){function e(){var e;return(e=t.call(this)||this)._luminanceHDR=aZ&&aZ(),e._luminanceLDR=oZ&&oZ(),e._term=hZ&&hZ(),e._range=uZ&&uZ(),e._lightType=HB,e}return s(e,t),e.prototype._createLight=function(){t.prototype._createLight.call(this),this._type=hx.POINT,this.range=this._range,this._light&&(this._light.luminanceHDR=this._luminanceHDR,this._light.luminanceLDR=this._luminanceLDR)},n(e,[{key:"luminousFlux",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR*Rx(1):this._luminanceLDR},set:function(t){var e=0;v.director.root.pipeline.pipelineSceneData.isHDR?(this._luminanceHDR=t/Rx(1),e=this._luminanceHDR):(this._luminanceLDR=t,e=this._luminanceLDR),this._light&&(this._light.luminance=e)}},{key:"luminance",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){v.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}(TZ),aZ=Gs(sZ.prototype,"_luminanceHDR",[ra,$Q],(function(){return 1700/Rx(.15)})),oZ=Gs(sZ.prototype,"_luminanceLDR",[ra],(function(){return 1700/Rx(.15)*jw.standardExposureValue*jw.standardLightMeterScale})),hZ=Gs(sZ.prototype,"_term",[ra],(function(){return vZ.LUMINOUS_FLUX})),uZ=Gs(sZ.prototype,"_range",[ra],(function(){return 1})),f(sZ.prototype,"luminousFlux",[tZ],Object.getOwnPropertyDescriptor(sZ.prototype,"luminousFlux"),sZ.prototype),f(sZ.prototype,"luminance",[eZ],Object.getOwnPropertyDescriptor(sZ.prototype,"luminance"),sZ.prototype),f(sZ.prototype,"term",[iZ],Object.getOwnPropertyDescriptor(sZ.prototype,"term"),sZ.prototype),f(sZ.prototype,"range",[nZ],Object.getOwnPropertyDescriptor(sZ.prototype,"range"),sZ.prototype),rZ=sZ))||rZ)),t("ad",(lZ=qs("cc.RangedDirectionalLight"),cZ=sa("_illuminance"),_Z=xa(Ke),lZ((fZ=function(t){function e(){var e;return(e=t.call(this)||this)._illuminanceHDR=pZ&&pZ(),e._illuminanceLDR=mZ&&mZ(),e._lightType=VB,e}return s(e,t),e.prototype._createLight=function(){t.prototype._createLight.call(this),this._type=hx.RANGED_DIRECTIONAL,this._light&&(this._light.illuminanceHDR=this._illuminanceHDR,this._light.illuminanceLDR=this._illuminanceLDR)},n(e,[{key:"illuminance",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR?this._illuminanceHDR:this._illuminanceLDR},set:function(t){v.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}(TZ),pZ=Gs(fZ.prototype,"_illuminanceHDR",[$s,cZ],(function(){return 65e3})),mZ=Gs(fZ.prototype,"_illuminanceLDR",[ra],(function(){return 65e3*jw.standardExposureValue})),f(fZ.prototype,"illuminance",[_Z],Object.getOwnPropertyDescriptor(fZ.prototype,"illuminance"),fZ.prototype),dZ=fZ))||dZ)),v.LightComponent=TZ,Jt(TZ,"cc.LightComponent"),v.DirectionalLightComponent=bZ,Jt(bZ,"cc.DirectionalLightComponent"),v.SphereLightComponent=CZ,Jt(CZ,"cc.SphereLightComponent"),v.SpotLightComponent=DZ,Jt(DZ,"cc.SpotLightComponent"),rt(DZ.prototype,"SpotLight.prototype",[{name:"luminousPower",newName:"luminousFlux",customGetter:function(){return this.luminousFlux},customSetter:function(t){this.luminousFlux=t}}]),rt(CZ.prototype,"SphereLight.prototype",[{name:"luminousPower",newName:"luminousFlux",customGetter:function(){return this.luminousFlux},customSetter:function(t){this.luminousFlux=t}}]),rt(TZ.PhotometricTerm,"Light.PhotometricTerm",[{name:"LUMINOUS_POWER",newName:"LUMINOUS_FLUX"}]);var MZ=Symbol("BakeNodeCurves"),PZ=function(){function t(){}return t.getOrExtract=function(e){var i=t.pool.get(e);if(!i||i.samples!==e.sample){i&&v.director.root.dataPoolManager.releaseAnimationClip(e);var n=Math.ceil(e.sample*e.duration)+1,r=e.sample;i=e[MZ](0,r,n),t.pool.set(e,i)}return i},t.destroy=function(e){t.pool.delete(e)},t}();PZ.pool=new Map;var BZ=new Dn;function NZ(t,e,i){for(Dn.identity(i);t!==e;)Dn.fromRTS(BZ,t.rotation,t.position,t.scale),Dn.multiply(i,BZ,i),t=t.parent;return i}var LZ=new i_(sc.POINT,sc.POINT,sc.NONE,ac.CLAMP,ac.CLAMP,ac.CLAMP),FZ=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 kZ(t,e){var i=4/Math.sqrt(e);return 12*Math.ceil(Math.max(480*i,t)/12)}new En,new En,new hn,new En,new hn;var UZ=new hn,GZ=new hn,HZ=new hn,zZ=new hn,VZ=new Dn,WZ=new Dn,XZ=new Es,jZ=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(jl.RGBA32F)&ic.SAMPLED_TEXTURE?jl.RGBA32F:jl.RGBA8}(this._device);this._formatSize=F_[e].size,this._pixelsPerJoint=48/this._formatSize,this._pool=new OG(t),this._pool.initialize({format:e,roundUpFn:kZ}),this._customPool=new OG(t),this._customPool.initialize({format:e,roundUpFn:kZ})}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(jl.RGBA32F)&ic.SAMPLED_TEXTURE||(n*=2);for(var r=this._customPool.createChunk(n),s=0;s<i.contents.length;s++){var a=i.contents[s],o=a.skeleton;this._chunkIdxMap.set(o,r);for(var h=0;h<a.clips.length;h++){var u=a.clips[h];this._chunkIdxMap.set(o^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,a=t.bindposes,o=null,h=!1,u=s.length;if(r)r.refCount++;else{var l=12*u,c=this._chunkIdxMap.get(n),_=void 0!==c?this._customPool.alloc(l*Float32Array.BYTES_PER_ELEMENT,c):this._pool.alloc(l*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:_},o=new Float32Array(l),h=!0}hn.set(HZ,jZ,jZ,jZ),hn.set(zZ,-jZ,-jZ,-jZ);for(var d=e.getBoneSpaceBounds(t),f=0,p=0;f<u;f++,p+=12){var m=i.getChildByPath(s[f]),g=m?NZ(m,i,VZ):t.inverseBindposes[f],v=d[f];v&&(Es.transform(XZ,v,g),XZ.getBoundary(UZ,GZ),hn.min(HZ,HZ,UZ),hn.max(zZ,zZ,GZ)),h&&(m&&Dn.multiply(g,g,a[f]),FZ(o,p,m?g:Dn.IDENTITY))}var y=[new Es];return r.bounds.set(e.hash,y),Es.fromPoints(y[0],HZ,zZ),h&&(this._pool.update(r.handle,o.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 a=t.joints,o=t.bindposes,h=PZ.getOrExtract(e).frames,u=null,l=!1,c=a.length;if(s)s.refCount++;else{var _=12*c*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(_),l=!0}var m=i.getBoneSpaceBounds(t),g=[];s.bounds.set(i.hash,g);for(var v=0;v<h;v++)g.push(new Es(jZ,jZ,jZ,-jZ,-jZ,-jZ));for(var y=0,T=0;y<h;y++){for(var S=g[y],E=0;E<c;E++,T+=12){var A=s.animInfos[E],R=A.curveData,b=A.downstream,C=A.bindposeIdx,w=A.bindposeCorrection,x=void 0,I=!0;R&&b?x=Dn.multiply(VZ,R[y],b):R?x=R[y]:b?x=b:(x=t.inverseBindposes[C],I=!1);var O=m[E];if(O){var D=w?Dn.multiply(WZ,x,w):x;Es.transform(XZ,O,D),XZ.getBoundary(UZ,GZ),hn.min(S.center,S.center,UZ),hn.max(S.halfExtents,S.halfExtents,GZ)}l&&(I&&Dn.multiply(VZ,x,o[C]),FZ(u,T,I?VZ:Dn.IDENTITY))}Es.fromPoints(S,S.center,S.halfExtents)}return l&&(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,a=r.length,o=PZ.getOrExtract(e),h=0;h<a;h++){for(var u=r[h],l=o.joints[u],c=i.getChildByPath(u),_=void 0,d=void 0;!l;){var f=u.lastIndexOf("/");if(u=u.substring(0,f),l=o.joints[u],c?(_||(_=new Dn),Dn.fromRTS(VZ,c.rotation,c.position,c.scale),Dn.multiply(_,VZ,_),c=c.parent):d=u,f<0)break}var p=h,m=void 0;if(void 0!==d&&l){p=h-1;for(var g=0;g<a;g++)if(r[g]===d){p=g,m=new Dn,Dn.multiply(m,s[g],t.inverseBindposes[h]);break}}n.push({curveData:l&&l.transforms,downstream:_,bindposeIdx:p,bindposeCorrection:m})}return n},n(t,[{key:"pixelsPerJoint",get:function(){return this._pixelsPerJoint}}])}();var YZ=[],KZ=new Map;function qZ(t,e){for(var i=0,n=Dn.IDENTITY;t;){if(t.stamp===e||t.stamp+1===e&&!t.node.hasChangedFlags){n=t.world,t.stamp=e;break}t.stamp=e,YZ[i++]=t,t=t.parent}for(;i>0;){t=YZ[--i],YZ[i]=null;var r=t.node;Dn.fromRTS(t.local,r.rotation,r.position,r.scale),n=Dn.multiply(t.world,n,t.local)}return n}function QZ(t,e){for(var i,n=null,r=0;t!==e;){var s=t.uuid;if(KZ.has(s)){n=KZ.get(s);break}n={node:t,local:new Dn,world:new Dn,stamp:-1,parent:null},KZ.set(s,n),YZ[r++]=n,t=t.parent,n=null}for(;r>0;)i=YZ[--r],YZ[r]=null,i.parent=n,n=i;return n}function ZZ(t){for(var e=KZ.get(t.uuid)||null;e;)KZ.delete(e.node.uuid),e=e.parent}var JZ=[{name:"CC_USE_SKINNING",value:!0},{name:"CC_USE_REAL_TIME_JOINT_TEXTURE",value:!1}],$Z=[{name:"CC_USE_SKINNING",value:!0},{name:"CC_USE_REAL_TIME_JOINT_TEXTURE",value:!0}];function tJ(t,e,i,n){for(var r=0;r<i.length;r++){for(var s=i[r],a=-1,o=0;o<s.length;o++)if(s[o]===n){a=o;break}a>=0&&(e.push(r),t.push(a))}}var eJ=new hn,iJ=new hn,nJ=new hn,rJ=new hn,sJ=new Dn,aJ=new Es,oJ=function(){this._format=lf.RGBA32F,this._textures=[],this._buffers=[]};oJ.WIDTH=256,oJ.HEIGHT=3;var hJ,uJ,lJ,cJ,_J,dJ,fJ,pJ,mJ,gJ,vJ,yJ,TJ,SJ,EJ,AJ,RJ,bJ,CJ,wJ,xJ,IJ,OJ,DJ,MJ,PJ,BJ,NJ,LJ,FJ,kJ,UJ,GJ=function(t){function e(){var e;return(e=t.call(this)||this)._buffers=[],e._dataArray=[],e._joints=[],e._bufferIndices=null,e._realTimeJointTexture=new oJ,e._realTimeTextureMode=!1,e.type=mB.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++)ZZ(this._joints[n].target);if(this._bufferIndices=null,this._joints.length=0,t&&e&&i){this._realTimeTextureMode=!1,sv.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 a=0;a<t.joints.length;a++){var o=r[a],h=e.getChildByPath(t.joints[a]);if(o&&h){var u=QZ(h,e),l=t.bindposes[a],c=[],_=[];s?tJ(c,_,s,a):(c.push(a),_.push(0)),this._joints.push({indices:c,buffers:_,bound:o,target:h,bindpose:l,transform:u})}}}},i.updateTransform=function(t){var e=this.transform;(e.hasChangedFlags||e.isTransformDirty())&&(e.updateWorldTransform(),this._localDataUpdated=!0),hn.set(eJ,1/0,1/0,1/0),hn.set(iJ,-1/0,-1/0,-1/0);for(var i=0;i<this._joints.length;i++){var n=this._joints[i],r=n.bound,s=qZ(n.transform,t);Es.transform(aJ,r,s),aJ.getBoundary(nJ,rJ),hn.min(eJ,eJ,nJ),hn.max(iJ,iJ,rJ)}var a=this._worldBounds;this._modelBounds&&a&&(Es.fromPoints(this._modelBounds,eJ,iJ),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,a=n.transform,o=n.bindpose;Dn.multiply(sJ,a.world,o);for(var h=0;h<s.length;h++)FZ(this._dataArray[s[h]],12*r[h],sJ)}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=JZ;return this._realTimeTextureMode&&(n=$Z),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(sv.BINDING,r)}},i._updateInstancedAttributes=function(e,i){i.passes[0].batchingScheme!==rS.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=oJ.WIDTH;this._dataArray[i]=new Float32Array(12*n)}else for(var r=0;r<t;r++){this._buffers[r]=this._device.createBuffer(new qc(ql.UNIFORM|ql.TRANSFER_DST,Jl.HOST|Jl.DEVICE,sv.SIZE,sv.SIZE));var s=sv.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=gL.root.device,e=oJ.WIDTH,i=oJ.HEIGHT;0==(t.getFormatFeatures(jl.RGBA32F)&ic.SAMPLED_TEXTURE)&&(this._realTimeJointTexture._format=lf.RGBA8888,e=4*oJ.WIDTH);for(var n=this._realTimeJointTexture._textures,r=this._realTimeJointTexture._buffers,s=this._realTimeJointTexture._format,a=0;a<this._dataArray.length;a++){r[a]=new Float32Array(4*oJ.HEIGHT*oJ.WIDTH);var o=r[a],h=s===lf.RGBA32F?o:new Uint8Array(o.buffer),u=new Df({width:e,height:i,_data:h,_compressed:!1,format:s}),l=new em;l.setFilters(em.Filter.NEAREST,em.Filter.NEAREST),l.setMipFilter(em.Filter.NONE),l.setWrapMode(em.WrapMode.CLAMP_TO_EDGE,em.WrapMode.CLAMP_TO_EDGE,em.WrapMode.CLAMP_TO_EDGE),l.image=u,n[a]=l}}},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(dv,n),e.bindSampler(dv,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,a=0,o=0,h=0;h<s;h++)o=4*h,n[o++]=r[a++],n[o++]=r[a++],n[o++]=r[a++],n[o++]=r[a++],o=4*(h+oJ.WIDTH),n[o++]=r[a++],n[o++]=r[a++],n[o++]=r[a++],n[o++]=r[a++],o=4*(h+2*oJ.WIDTH),n[o++]=r[a++],n[o++]=r[a++],n[o++]=r[a++],n[o++]=r[a++];var u=this._realTimeJointTexture._format===lf.RGBA32F?n:new Uint8Array(n.buffer);t[i].uploadData(u)}},e}(RK),HJ=[{name:"CC_USE_SKINNING",value:!0},{name:"CC_USE_BAKED_ANIMATION",value:!0}],zJ=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=mB.BAKED_SKINNING,e._dataPoolManager=v.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 qc(ql.UNIFORM|ql.TRANSFER_DST,Jl.DEVICE,iv.SIZE,iv.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 a=this.transform;r.transform(a._mat,a._pos,a._rot,a._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 a=this._subModels[s];r>=0?a.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(HJ):HJ},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,a=0;a<this._subModels.length;++a)this._subModels[a].descriptorSet.bindTexture(lv,s)}},i._updateLocalDescriptors=function(e,i){t.prototype._updateLocalDescriptors.call(this,e,i);var n=this._jointsMedium,r=n.buffer,s=n.texture,a=n.animInfo;if(i.bindBuffer(iv.BINDING,r),i.bindBuffer(nv.BINDING,a.buffer),s){var o=this._device.getSampler(LZ);i.bindTexture(lv,s.handle.texture),i.bindSampler(lv,o)}},i._updateInstancedAttributes=function(e,i){t.prototype._updateInstancedAttributes.call(this,e,i),this._instAnimInfoIdx=i.getInstancedAttributeIndex(rv),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 a=s[n];a[0]=i.data[0],a[1]=e[1],a[2]=e[2]}}},e}(RK),VJ=t("ae",(hJ=qs("cc.SkinnedMeshRenderer"),uJ=Zs(100),lJ=xa(oq),cJ=xa($m),_J=xa(oq),dJ=xa($m),hJ(fJ=uJ((pJ=function(t){function e(){var e;return(e=t.call(this)||this)._skeleton=mJ&&mJ(),e._skinningRoot=gJ&&gJ(),e._clip=null,e.associatedAnimation=null,e._modelType=zJ,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?zJ:GJ;(e||this._modelType!==i)&&(this._modelType=i,this._model&&(v.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===GJ&&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}(VK),mJ=Gs(pJ.prototype,"_skeleton",[lJ],(function(){return null})),gJ=Gs(pJ.prototype,"_skinningRoot",[cJ],(function(){return null})),f(pJ.prototype,"skeleton",[_J],Object.getOwnPropertyDescriptor(pJ.prototype,"skeleton"),pJ.prototype),f(pJ.prototype,"skinningRoot",[dJ],Object.getOwnPropertyDescriptor(pJ.prototype,"skinningRoot"),pJ.prototype),fJ=pJ))||fJ)||fJ)),WJ=new __(Mc.ATTR_BATCH_ID,jl.R32F),XJ=new __(Mc.ATTR_BATCH_UV,jl.RG32F),jJ=F_[WJ.format].size+F_[XJ.format].size,YJ=t("ag",(vJ=qs("cc.SkinnedMeshUnit"),yJ=xa(QL),TJ=xa(oq),SJ=xa(OS),EJ=xa(VJ),vJ((RJ=function(){function t(){this.mesh=bJ&&bJ(),this.skeleton=CJ&&CJ(),this.material=wJ&&wJ(),this._localTransform=xJ&&xJ(),this._offset=IJ&&IJ(),this._size=OJ&&OJ()}return n(t,[{key:"offset",get:function(){return this._offset},set:function(t){Fn.copy(this._offset,t)}},{key:"size",get:function(){return this._size},set:function(t){Fn.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&&NZ(t.node,t.skinningRoot,this._localTransform))}}]),t}(),bJ=Gs(RJ.prototype,"mesh",[yJ],(function(){return null})),CJ=Gs(RJ.prototype,"skeleton",[TJ],(function(){return null})),wJ=Gs(RJ.prototype,"material",[SJ],(function(){return null})),xJ=Gs(RJ.prototype,"_localTransform",[ra],(function(){return new Dn})),IJ=Gs(RJ.prototype,"_offset",[ra],(function(){return new Fn(0,0)})),OJ=Gs(RJ.prototype,"_size",[ra],(function(){return new Fn(1,1)})),f(RJ.prototype,"copyFrom",[EJ],Object.getOwnPropertyDescriptor(RJ.prototype,"copyFrom"),RJ.prototype),AJ=RJ))||AJ)),KJ=new Dn;new Dn;var qJ,QJ,ZJ,JJ,$J,t$,e$,i$,n$,r$,s$,a$,o$,h$,u$,l$,c$,_$=new hn,d$=t("af",(DJ=qs("cc.SkinnedMeshBatchRenderer"),MJ=Zs(100),PJ=xa([Ze]),BJ=xa([YJ]),DJ(NJ=MJ((LJ=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=FJ&&FJ(),e.batchableTextureNames=kJ&&kJ(),e.units=UJ&&UJ(),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>=Kl.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 a=[],o=0;o<t.units.length;o++){var h=t.units[o];h.material&&a.push(h.material.getProperty(i.slice(0,-3),n))}e.setProperty(i,a,n)}};for(var a in r.properties)s(a)},r=0;r<i.passes.length;r++)n(r)}else console.warn("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;Dn.invert(KJ,n._localTransform);for(var s=function(){var i=r.joints[a];if(t.findIndex((function(t){return t===i}))>=0)return 1;t.push(i),e.push(Dn.multiply(new Dn,r.bindposes[a]||Dn.IDENTITY,KJ))},a=0;a<r.joints.length;a++)s()}}var o=Array.from(Array(t.length).keys()).sort((function(e,i){return t[e]>t[i]?1:t[e]<t[i]?-1:0})),h=new oq;h.joints=t.map((function(t,e,i){return i[o[e]]})),h.bindposes=e.map((function(t,e,i){return i[o[e]]})),this._skeleton&&this._skeleton.destroy(),this.skeleton=h}else console.warn("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 QL;for(var n=0,r=jl.UNKNOWN,s=0,a=jl.UNKNOWN,o=0,h=jl.UNKNOWN,u=0,l=jl.UNKNOWN,c=0,_=jl.UNKNOWN,d=new Array(this.units.length),f=this.units.length,p=0;p<f;p++){var m=this.units[p];m&&m.skeleton&&(d[p]=m.skeleton.joints.map((function(e){return t._skeleton.joints.findIndex((function(t){return e===t}))})))}for(var g=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);Dn.invert(KJ,e._localTransform),Dn.transpose(KJ,KJ);for(var p=e.offset,m=e.size,g=function(){var t=i.struct.vertexBundles[y];n=t.view.offset,r=jl.UNKNOWN;for(var g=0;g<t.attributes.length;g++){var T=t.attributes[g];if(T.name===Mc.ATTR_POSITION){r=T.format;break}n+=F_[T.format].size}if(r){for(var S=Bx(f,r,n,t.view.length,t.view.stride),E=0;E<S.length;E+=3)hn.fromArray(_$,S,E),hn.transformMat4(_$,_$,e._localTransform),hn.toArray(S,_$,E);Px(f,S,r,n,t.view.stride)}s=t.view.offset,a=jl.UNKNOWN;for(var A=0;A<t.attributes.length;A++){var R=t.attributes[A];if(R.name===Mc.ATTR_NORMAL){a=R.format;break}s+=F_[R.format].size}if(a){for(var b=Bx(f,a,s,t.view.length,t.view.stride),C=0;C<b.length;C+=3)hn.fromArray(_$,b,C),hn.transformMat4Normal(_$,_$,KJ),hn.toArray(b,_$,C);Px(f,b,a,s,t.view.stride)}o=t.view.offset,h=jl.UNKNOWN;for(var w=0;w<t.attributes.length;w++){var x=t.attributes[w];if(x.name===Mc.ATTR_TANGENT){h=x.format;break}o+=F_[x.format].size}if(h){for(var I=Bx(f,h,o,t.view.length,t.view.stride),O=0;O<I.length;O+=3)hn.fromArray(_$,I,O),hn.transformMat4Normal(_$,_$,KJ),hn.toArray(I,_$,O);Px(f,I,h,o,t.view.stride)}u=t.view.offset,l=jl.UNKNOWN;for(var D=0;D<t.attributes.length;D++){var M=t.attributes[D];if(M.name===Mc.ATTR_BATCH_UV){l=M.format;break}u+=F_[M.format].size}l&&Nx(f,(function(t,e){var i,n=0===e?"x":"y";return(t=(i=t)-Math.floor(i))*m[n]+p[n]}),l,u,t.view.length,t.view.stride,f);var P=d[v];if(!P)return 1;c=t.view.offset,_=jl.UNKNOWN;for(var B=0;B<t.attributes.length;B++){var N=t.attributes[B];if(N.name===Mc.ATTR_JOINTS){_=N.format;break}c+=F_[N.format].size}_&&Nx(f,(function(t){return P[t]}),_,c,t.view.length,t.view.stride,f)},y=0;y<i.struct.vertexBundles.length;y++)g();t._mesh.merge(i)},v=0;v<f;v++)g();this._onMeshChanged(this._mesh),this._updateModels()}},i.cookTextures=function(t,e,i){for(var n=[],r=[],s=[],a=[],o=0;o<this.units.length;o++){var h=this.units[o];if(h.material){var u=h.material.getProperty(e,i);if(u&&u.image&&u.image.data){var l=new Vc;l.texOffset.x=h.offset.x*this.atlasSize,l.texOffset.y=h.offset.y*this.atlasSize,l.texExtent.width=h.size.x*this.atlasSize,l.texExtent.height=h.size.y*this.atlasSize;var c=u.image.data;ArrayBuffer.isView(c)?(s.push(c),a.push(l)):(n.push(c),r.push(l))}}}var _=t.getGFXTexture(),d=v.director.root.device;s.length>0&&d.copyBuffersToTexture(s,_,a),n.length>0&&d.copyTexImagesToTexture(n,_,r)},i.createTexture=function(t){var e=new em;return e.setFilters(_f.LINEAR,_f.LINEAR),e.setMipFilter(_f.NEAREST),e.reset({width:this.atlasSize,height:this.atlasSize,format:lf.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:lf.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],a=0,o=jl.UNKNOWN,h=0;h<s.vertexBundelIndices.length;h++){var u=e.struct.vertexBundles[s.vertexBundelIndices[h]];a=u.view.offset,o=jl.UNKNOWN;for(var l=0;l<u.attributes.length;l++){var c=u.attributes[l];if(c.name===Mc.ATTR_TEX_COORD){o=c.format;break}a+=F_[c.format].size}if(o)break}if(void 0===n[h]){n[h]=[o,a];var _=i.vertexBundles[h];_.attributes.push(WJ),_.attributes.push(XJ),_.view.offset=0,_.view.length+=_.view.count*jJ,_.view.stride+=jJ}}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 m=i.primitives[p];m.indexView&&(m.indexView.offset=d,d+=m.indexView.length)}var g=new Uint8Array(d),y=e.data,T=new DataView(g.buffer),S=new DataView(y.buffer),E=v.sys.isLittleEndian;for(var A in n)for(var R=i.vertexBundles[A],b=e.struct.vertexBundles[A],C=n[A],w=Bx(S,C[0],C[1],b.view.length,b.view.stride),x=b.view,I=R.view,O=x.stride,D=I.stride,M=x.offset,P=I.offset,B=0;B<I.count;B++){var N=y.subarray(M,M+O);g.set(N,P),T.setFloat32(P+O,t),T.setFloat32(P+O+4,w[2*B],E),T.setFloat32(P+O+8,w[2*B+1],E),P+=D,M+=O}for(var L=0;L<i.primitives.length;L++){var F=e.struct.primitives[L],k=i.primitives[L];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);g.set(W,z),z+=G,H+=U}}var X=new QL;return X.reset({struct:i,data:g}),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}(VJ),FJ=Gs(LJ.prototype,"atlasSize",[ra],(function(){return 1024})),kJ=Gs(LJ.prototype,"batchableTextureNames",[PJ,ra],(function(){return[]})),UJ=Gs(LJ.prototype,"units",[BJ,ra],(function(){return[]})),f(LJ.prototype,"mesh",[Ia],Object.getOwnPropertyDescriptor(LJ.prototype,"mesh"),LJ.prototype),f(LJ.prototype,"skeleton",[Ia],Object.getOwnPropertyDescriptor(LJ.prototype,"skeleton"),LJ.prototype),NJ=LJ))||NJ)||NJ));v.SkinningModelComponent=VJ,Jt(VJ,"cc.SkinningModelComponent"),v.SkinningModelUnit=YJ,Jt(YJ,"cc.SkinningModelUnit"),v.BatchedSkinningModelComponent=d$,Jt(d$,"cc.BatchedSkinningModelComponent");var f$=[.25,.125,.01],p$=t("ah",(qJ=qs("cc.LOD"),QJ=xa([VK]),ZJ=xa(qe),JJ=xa([VK]),$J=xa([Ke]),qJ((e$=function(){function t(){this._screenUsagePercentage=i$&&i$(),this._renderers=n$&&n$(),this._LODData=new WB,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?console.error("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}(),i$=Gs(e$.prototype,"_screenUsagePercentage",[ra],(function(){return 1})),n$=Gs(e$.prototype,"_renderers",[QJ,ra],(function(){return[]})),f(e$.prototype,"screenUsagePercentage",[ZJ],Object.getOwnPropertyDescriptor(e$.prototype,"screenUsagePercentage"),e$.prototype),f(e$.prototype,"renderers",[JJ],Object.getOwnPropertyDescriptor(e$.prototype,"renderers"),e$.prototype),f(e$.prototype,"triangleCount",[$J],Object.getOwnPropertyDescriptor(e$.prototype,"triangleCount"),e$.prototype),t$=e$))||t$)),m$=(t("ai",(r$=qs("cc.LODGroup"),s$=xa(qe),a$=xa([p$]),r$((h$=function(t){function e(){var e;return(e=t.call(this)||this)._localBoundaryCenter=u$&&u$(),e._objectSize=l$&&l$(),e._LODs=c$&&c$(),e._lodGroup=new XB,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 p$),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=f$[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 console.warn("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):(console.warn("eraseLOD error, LOD not exist at specified index."),null)},i.getLOD=function(t){return t<0||t>=this.lodCount?(console.warn("getLOD error, index out of range"),null):this._LODs[t]},i.setLOD=function(t,e){t<0||t>=this.lodCount?console.warn("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 hn,e=new hn,i=null,n=new hn,r=0;r<this.lodCount;++r){var s=this.getLOD(r);if(s)for(var a=0;a<s.rendererCount;++a){var o,h,u=s.getRenderer(a);if(u){null===(o=u.model)||void 0===o||o.updateWorldBound();var l=null===(h=u.model)||void 0===h?void 0:h.worldBounds;l&&(l.getBoundary(t,e),i?(hn.min(i,i,t),hn.max(n,n,e)):(i=t.clone(),n=e.clone()))}}}if(i){var c=i,_=new hn(.5*(n.x+c.x),.5*(n.y+c.y),.5*(n.z+c.z)),d=new hn(.5*(n.x-c.x),.5*(n.y-c.y),.5*(n.z-c.z)),f=function(t,e,i){var n,r,s=new Array(new hn(t.x-e.x,t.y-e.y,t.z-e.z),new hn(t.x-e.x,t.y+e.y,t.z-e.z),new hn(t.x+e.x,t.y+e.y,t.z-e.z),new hn(t.x+e.x,t.y-e.y,t.z-e.z),new hn(t.x-e.x,t.y-e.y,t.z+e.z),new hn(t.x-e.x,t.y+e.y,t.z+e.z),new hn(t.x+e.x,t.y+e.y,t.z+e.z),new hn(t.x+e.x,t.y-e.y,t.z+e.z));r=(n=s[0].transformMat4(i)).clone();for(var a=1;a<8;++a){var o=s[a].transformMat4(i);n=hn.min(n,n,o),r=hn.max(r,r,o)}return[n,r]}(_,d,this.node.worldMatrix.clone().invert()),p=f[0],m=f[1];_.set(.5*(m.x+p.x),.5*(m.y+p.y),.5*(m.z+p.z)),d.set(.5*(m.x-p.x),.5*(m.y-p.y),.5*(m.z-p.z)),this.localBoundaryCenter=_,this.objectSize=2*Math.max(d.x,d.y,d.z)}else this.localBoundaryCenter=new hn(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(um.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=f$.length,e=0;e<t;e++)this.insertLOD(e,f$[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,a=n[r];s&&a&&a.model&&s.addModel(a.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}(op),u$=Gs(h$.prototype,"_localBoundaryCenter",[ra],(function(){return new hn(0,0,0)})),l$=Gs(h$.prototype,"_objectSize",[ra],(function(){return 0})),c$=Gs(h$.prototype,"_LODs",[ra],(function(){return[]})),f(h$.prototype,"objectSize",[s$],Object.getOwnPropertyDescriptor(h$.prototype,"objectSize"),h$.prototype),f(h$.prototype,"LODs",[a$],Object.getOwnPropertyDescriptor(h$.prototype,"LODs"),h$.prototype),o$=h$))||o$)),sm.makeMaskExclude([sm.BitMask.UI_2D,sm.BitMask.UI_3D,sm.BitMask.GIZMOS,sm.BitMask.EDITOR,sm.BitMask.SCENE_GIZMO,sm.BitMask.PROFILER,sm.Enum.IGNORE_RAYCAST])),g$=t("ak",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||(v.director.on(v.Director.EVENT_BEFORE_UPDATE,this.onUpdateProbes,this),this._registeredEvent=!0)},e.onUpdateProbes=function(){if(0!==this._probes.length){var t=v.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&m$&&(n.reflectionProbeType===_B.BAKED_CUBEMAP||this._isUsedBlending(n)?this.selectReflectionProbe(n):n.reflectionProbeType===_B.PLANAR_REFLECTION&&this.selectPlanarReflectionProbe(n))}}},e.filterModelsForPlanarReflection=function(){if(0!==this._probes.length){var t=v.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&m$&&n.reflectionProbeType===_B.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 a=r.value;a[0].reflectionProbeBlendId===t.getProbeId()&&this._updateBlendCubemap(a[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(VK);r&&r.updateProbePlanarMap(e)}}},e.selectPlanarReflectionProbe=function(t){if(t.node&&t.worldBounds&&t.reflectionProbeType===_B.PLANAR_REFLECTION){for(var e=0;e<this._probes.length;e++){var i=this._probes[e];i.probeType===rx.PLANAR&&t.node.layer&m$&&(t.updateWorldBound(),us.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===rx.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&m$){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===rx.CUBE||this._isUsedBlending(t))&&this.updateBakedCubemap(this._probes[i])},e.updatePreviewSphere=function(t){if(t&&t.previewSphere){var e=t.previewSphere.getComponent(VK);e&&(e.updateProbeCubemap(t.cubemap),e.updateReflectionProbeId(t.getProbeId()))}},e.updatePreviewPlane=function(t){t&&t.previewPlane&&t.previewPlane.getComponent(VK)&&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===rx.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 a=s.isRGBE()?1e3:0;i[n+8]=s.cubemap?s.cubemap.mipmapLevel+a:1+a}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 o=new Uint8Array(i.buffer),h=new Df({_data:o,_compressed:!1,width:12,height:e,format:lf.RGBA8888});this._dataTexture=new em,this._dataTexture.setFilters(em.Filter.NONE,em.Filter.NONE),this._dataTexture.setMipFilter(em.Filter.NONE),this._dataTexture.setWrapMode(em.WrapMode.CLAMP_TO_EDGE,em.WrapMode.CLAMP_TO_EDGE,em.WrapMode.CLAMP_TO_EDGE),this._dataTexture.image=h,this._dataTexture.uploadData(o);for(var u=0;u<this._probes.length;u++)for(var l=this._probes[u],c=this._getModelsByProbe(l),_=0;_<c.length;_++){var d=c[_].node.getComponent(VK);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=v.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&m$&&(n.reflectionProbeType===_B.BAKED_CUBEMAP||n.reflectionProbeType===_B.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===rx.CUBE&&s.validate()&&us.aabbWithAABB(t.worldBounds,s.boundingBox)){var a=hn.distance(t.node.worldPosition,s.node.worldPosition);a<n&&(n=a,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===rx.CUBE&&this._probes[i].validate()&&us.aabbWithAABB(t.worldBounds,this._probes[i].boundingBox)&&e.push(this._probes[i]);return e.sort((function(e,i){return hn.distance(t.node.worldPosition,e.node.worldPosition)-hn.distance(t.node.worldPosition,i.node.worldPosition)})),e.length>1?e[1]:null},e._getModelsByProbe=function(t){var e=[],i=this._useCubeModels;t.probeType===rx.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,a=d(this._usePlanarModels.keys());!(s=a()).done;){var o=s.value,h=this._usePlanarModels.get(o);void 0!==h&&h===t&&(this._usePlanarModels.delete(o),this.selectPlanarReflectionProbe(o))}},e._updateCubemapOfModel=function(t,e){var i=t.node;if(i){var n=i.getComponent(VK);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(VK);n&&(n.updateProbePlanarMap(e),i?(n.updateReflectionProbeId(i.getProbeId()),n.updateReflectionProbeDataMap(this._dataTexture)):n.updateReflectionProbeId(-1))},e._isUsedBlending=function(t){return t.reflectionProbeType===_B.BLEND_PROBES||t.reflectionProbeType===_B.BLEND_PROBES_AND_SKYBOX},e._updateBlendProbeInfo=function(t,e,i){var n=t.node;if(n){var r=n.getComponent(VK);r&&(i?(r.updateReflectionProbeBlendId(i.getProbeId()),r.updateProbeBlendCubemap(i.cubemap),r.updateReflectionProbeBlendWeight(this._calculateBlendWeight(t,e,i))):(r.updateReflectionProbeBlendId(-1),t.reflectionProbeType===_B.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(VK);n&&n.updateProbeBlendCubemap(e.cubemap)}},e._calculateBlendWeight=function(t,e,i){if(i){var n=hn.distance(t.node.worldPosition,e.node.worldPosition),r=hn.distance(t.node.worldPosition,i.node.worldPosition);return 1-r/(n+r)}return t.reflectionProbeType===_B.BLEND_PROBES?0:t.reflectionProbeType===_B.BLEND_PROBES_AND_SKYBOX?this._calculateBlendOfSkybox(t.worldBounds,e.boundingBox):0},e._calculateBlendOfSkybox=function(t,e){if(!t)return 1;var i=new hn,n=new hn,r=new hn,s=new hn;if(hn.subtract(i,t.center,t.halfExtents),hn.add(n,t.center,t.halfExtents),hn.subtract(r,e.center,e.halfExtents),hn.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 a=new hn;hn.multiplyScalar(a,t.halfExtents,2);var o=i.x+a.x<=s.x&&n.x+a.x>=r.x,h=i.x-a.x<=s.x&&n.x-a.x>=r.x,u=i.y+a.y<=s.y&&n.y+a.y>=r.y,l=i.y-a.y<=s.y&&n.y-a.y>=r.y,c=i.z+a.z<=s.z&&n.z+a.z>=r.z,_=i.z-a.z<=s.z&&n.z-a.z>=r.z,d=[];if(!o){var f=n.x-s.x;d.push(f/a.x)}if(!h){var p=Math.abs(i.x-r.x);d.push(p/a.x)}if(!u){var m=n.y-s.y;d.push(m/a.y)}if(!l){var g=Math.abs(i.y-r.y);d.push(g/a.y)}if(!c){var v=n.z-s.z;d.push(v/a.z)}if(!_){var y=Math.abs(i.z-r.z);d.push(y/a.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 v$(t){return void 0===(t=t||{}).includeNormal&&(t.includeNormal=!0),void 0===t.includeUV&&(t.includeUV=!0),t}g$.probeManager=void 0,g$.probeManager=new g$,v.internal.reflectionProbeManager=g$.probeManager;var y$=new hn,T$=new hn,S$=new hn,E$=new hn,A$=new hn,R$=new hn,b$=new hn,C$=new hn,w$=new hn,x$=new hn,I$=new hn,O$=new hn,D$=new hn(0,0,0),M$=new hn(0,0,0);function P$(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,a=n.heightSegments||1,o=void 0===n.capped||n.capped,h=n.arc||2*Math.PI,u=0;o||(t>0&&u++,e>0&&u++);var l=(s+1)*(a+1);o&&(l+=(s+1)*u+s*u);var c=s*a*6;o&&(c+=s*u*3);var _=new Array(c),d=new Array(3*l),f=new Array(3*l),p=new Array(2*l),m=Math.max(t,e),g=new hn(-m,-r,-m),v=new hn(m,r,m),y=Math.sqrt(m*m+r*r),T=0,S=0;return function(){for(var n=[],o=t-e,u=o*o/i*Math.sign(o),l=0;l<=a;l++){for(var c=[],m=l/a,g=m*o+e,v=0;v<=s;++v){var y=v/s,E=y*h,A=Math.sin(E),R=Math.cos(E);d[3*T]=g*A,d[3*T+1]=m*i-r,d[3*T+2]=g*R,hn.normalize(D$,hn.set(M$,A,-u,R)),f[3*T]=D$.x,f[3*T+1]=D$.y,f[3*T+2]=D$.z,p[2*T]=2*(1-y)%1,p[2*T+1]=m,c.push(T),++T}n.push(c)}for(var b=0;b<a;++b)for(var C=0;C<s;++C){var w=n[b][C],x=n[b+1][C],I=n[b+1][C+1],O=n[b][C+1];_[S]=w,++S,_[S]=O,++S,_[S]=x,++S,_[S]=O,++S,_[S]=I,++S,_[S]=x,++S}}(),o&&(e>0&&E(!1),t>0&&E(!0)),{positions:d,normals:f,uvs:p,indices:_,minPos:g,maxPos:v,boundingRadius:y};function E(i){for(var n=i?t:e,a=i?1:-1,o=T,u=1;u<=s;++u)d[3*T]=0,d[3*T+1]=r*a,d[3*T+2]=0,f[3*T]=0,f[3*T+1]=a,f[3*T+2]=0,p[2*T]=.5,p[2*T+1]=.5,++T;for(var l=T,c=0;c<=s;++c){var m=c/s*h,g=Math.cos(m),v=Math.sin(m);d[3*T]=n*v,d[3*T+1]=r*a,d[3*T+2]=n*g,f[3*T]=0,f[3*T+1]=a,f[3*T+2]=0,p[2*T]=.5-.5*v*a,p[2*T+1]=.5+.5*g,++T}for(var y=0;y<s;++y){var E=o+y,A=l+y;i?(_[S]=A+1,++S,_[S]=E,++S,_[S]=A,++S):(_[S]=E,++S,_[S]=A+1,++S,_[S]=A,++S)}}}var B$=new hn(0,0,0),N$=new hn(0,0,0),L$=new hn(0,0,0),F$=new hn(0,0,0),k$=new hn(0,0,0),U$=new hn(0,0,0),G$=new hn(0,0,0),H$=new hn(0,0,0),z$=new hn(0,0,0),V$=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,a=(t.length||1)/2,o=[hn.set(A$,-r,-s,a),hn.set(R$,r,-s,a),hn.set(b$,r,s,a),hn.set(C$,-r,s,a),hn.set(w$,r,-s,-a),hn.set(x$,-r,-s,-a),hn.set(I$,-r,s,-a),hn.set(O$,r,s,-a)],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]],l=[[-1,0,0,1],[-1,0,0,1],[-1,0,0,1],[-1,0,0,1],[0,0,-1,1],[0,0,1,1]],c=[],_=[],d=[],f=[],p=[],m=new hn(-r,-s,-a),g=new hn(r,s,a),v=Math.sqrt(r*r+s*s+a*a);function y(t,e,i){var n,r,s,a,m=c.length/3,g=h[t],v=u[t],y=l[t];for(a=0;a<=i;a++)for(s=0;s<=e;s++)if(n=s/e,r=a/i,hn.lerp(y$,o[g[0]],o[g[1]],n),hn.lerp(T$,o[g[0]],o[g[2]],r),hn.subtract(S$,T$,o[g[0]]),hn.add(E$,y$,S$),c.push(E$.x,E$.y,E$.z),_.push(v[0],v[1],v[2]),d.push(n,r),f.push(y[0],y[1],y[2],y[3]),s<e&&a<i){var T=e+1,S=s+a*T,E=s+(a+1)*T,A=s+1+(a+1)*T,R=s+1+a*T;p.push(m+S,m+R,m+E),p.push(m+E,m+R,m+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:c,normals:_,uvs:d,tangents:f,indices:p,minPos:m,maxPos:g,boundingRadius:v}},cone:function(t,e,i){return void 0===t&&(t=.5),void 0===e&&(e=1),void 0===i&&(i={}),P$(0,t,e,i)},cylinder:P$,plane:function(t){var e=function(t){return(t=v$(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,a=.5*i,o=.5*n,h=[],u=[],l=[],c=new hn(-a,0,-o),_=new hn(a,0,o),d=Math.sqrt(i*i+n*n);hn.set(k$,-a,0,o),hn.set(U$,a,0,o),hn.set(G$,-a,0,-o);for(var f=0;f<=s;f++)for(var p=0;p<=r;p++){var m=p/r,g=f/s;if(hn.lerp(B$,k$,U$,m),hn.lerp(N$,k$,G$,g),hn.subtract(L$,N$,k$),hn.add(F$,B$,L$),h.push(F$.x,F$.y,F$.z),e.includeUV&&u.push(m,g),p<r&&f<s){var v=r+1,y=p+f*v,T=p+(f+1)*v,S=p+1+(f+1)*v,E=p+1+f*v;l.push(y,E,T),l.push(E,S,T)}}var A={positions:h,indices:l,minPos:c,maxPos:_,boundingRadius:d};if(e.includeNormal){var R=(s+1)*(r+1),b=new Array(3*R);A.normals=b;for(var C=0;C<R;++C)b[3*C+0]=0,b[3*C+1]=1,b[3*C+2]=0}return e.includeUV&&(A.uvs=u),A},quad:function(t){var e=v$(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=[],a=[],o=new hn(-t,-t,-t),h=new hn(t,t,t),u=t,l=0;l<=i;++l)for(var c=l*Math.PI/i,_=Math.sin(c),d=-Math.cos(c),f=0;f<=i;++f){var p=2*f*Math.PI/i-Math.PI/2,m=Math.sin(p)*_,g=d,v=Math.cos(p)*_,y=f/i,T=l/i;if(n.push(m*t,g*t,v*t),r.push(m,g,v),s.push(y,T),l<i&&f<i){var S=i+1,E=S*l+f,A=S*(l+1)+f,R=S*(l+1)+f+1,b=S*l+f+1;a.push(E,b,A),a.push(b,R,A)}}return{positions:n,indices:a,normals:r,uvs:s,minPos:o,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,a=[],o=[],h=[],u=[],l=new hn(-t-e,-e,-t-e),c=new hn(t+e,e,t+e),_=t+e,d=0;d<=n;d++)for(var f=0;f<=r;f++){var p=f/r,m=d/n,g=p*s,v=m*Math.PI*2,y=(t+e*Math.cos(v))*Math.sin(g),T=e*Math.sin(v),S=(t+e*Math.cos(v))*Math.cos(g),E=Math.sin(g)*Math.cos(v),A=Math.sin(v),R=Math.cos(g)*Math.cos(v);if(a.push(y,T,S),o.push(E,A,R),h.push(p,m),f<r&&d<n){var b=r+1,C=b*d+f,w=b*(d+1)+f,x=b*(d+1)+f+1,I=b*d+f+1;u.push(C,I,w),u.push(I,x,w)}}return{positions:a,normals:o,uvs:h,indices:u,minPos:l,maxPos:c,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,a=n.heightSegments||32,o=e/i,h=r/i,u=t/i,l=Math.floor(a*o),c=Math.floor(a*u),_=Math.floor(a*h),d=r+e-i/2,f=e-i/2,p=e-i/2,m=n.arc||2*Math.PI,g=[],v=[],y=[],T=[],S=Math.max(t,e),E=new hn(-S,-i/2,-S),A=new hn(S,i/2,S),R=i/2,b=0,C=[];return function(){for(var t=0;t<=l;++t)for(var i=t*Math.PI/l/2,n=Math.sin(i),r=-Math.cos(i),o=0;o<=s;++o){var h=2*o*Math.PI/s-Math.PI/2,u=Math.sin(h)*n,c=r,_=Math.cos(h)*n,d=o/s,f=t/a;if(g.push(u*e,c*e+p,_*e),v.push(u,c,_),y.push(d,f),t<l&&o<s){var m=s+1,S=m*t+o,E=m*(t+1)+o,A=m*(t+1)+o+1,R=m*t+o+1;T.push(S,R,E),T.push(R,A,E)}++b}}(),function(){for(var i=(t-e)/r,n=0;n<=_;n++){for(var a=[],u=n/_,l=u*(t-e)+e,c=0;c<=s;++c){var d=c/s,p=u*h+o,S=d*m-m/4,E=Math.sin(S),A=Math.cos(S);g.push(l*E),g.push(u*r+f),g.push(l*A),hn.normalize(H$,hn.set(z$,E,-i,A)),v.push(H$.x),v.push(H$.y),v.push(H$.z),y.push(d,p),a.push(b),++b}C.push(a)}for(var R=0;R<_;++R)for(var w=0;w<s;++w){var x=C[R][w],I=C[R+1][w],O=C[R+1][w+1],D=C[R][w+1];T.push(x),T.push(D),T.push(I),T.push(D),T.push(O),T.push(I)}}(),function(){for(var e=0;e<=c;++e)for(var i=e*Math.PI/c/2+Math.PI/2,n=Math.sin(i),r=-Math.cos(i),o=0;o<=s;++o){var h=2*o*Math.PI/s-Math.PI/2,l=Math.sin(h)*n,f=r,p=Math.cos(h)*n,m=o/s,S=e/a+(1-u);if(g.push(l*t,f*t+d,p*t),v.push(l,f,p),y.push(m,S),e<c&&o<s){var E=s+1,A=E*e+o+C[_][s]+1,R=E*(e+1)+o+C[_][s]+1,b=E*(e+1)+o+1+C[_][s]+1,w=E*e+o+1+C[_][s]+1;T.push(A,w,R),T.push(w,b,R)}}}(),{positions:g,normals:v,uvs:y,indices:T,minPos:E,maxPos:A,boundingRadius:R}},circle:function(t){var e=function(t){return(t=v$(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 a=r*s,o=Math.cos(a),h=Math.sin(a),u=3*(s+1);i[u+0]=o,i[u+1]=h,i[u+2]=0;var l=2*s;n[1+l]=s+1,n[1+(l+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:vc.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),a=0;a<s;++a){var o=3*a,h=3*a+1,u=3*a+2;t.positions[o]+=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,a=null!==(n=e.y)&&void 0!==n?n:1,o=null!==(r=e.z)&&void 0!==r?r:1,h=Math.floor(t.positions.length/3),u=0;u<h;++u){var l=3*u,c=3*u+1,_=3*u+2;t.positions[l]*=s,t.positions[c]*=a,t.positions[_]*=o}var d=t.minPos,f=t.maxPos;if(d&&(d.x*=s,d.y*=a,d.z*=o),f&&(f.x*=s,f.y*=a,f.z*=o),d&&f){if(s<0){var p=d.x;d.x=f.x,f.x=p}if(a<0){var m=d.y;d.y=f.y,f.y=m}if(o<0){var g=d.z;d.z=f.z,f.z=g}}return void 0!==t.boundingRadius&&(t.boundingRadius*=Math.max(Math.max(Math.abs(s),Math.abs(a)),Math.abs(o))),t},wireframed:function(t){var e=t.indices;if(!e)return t;if(t.primitiveMode&&t.primitiveMode!==vc.TRIANGLE_LIST)return t;for(var i=[[0,1],[1,2],[2,0]],n=[],r={},s=0;s<e.length;s+=3)for(var a=0;a<3;++a){var o=e[s+i[a][0]],h=e[s+i[a][1]],u=o>h?h<<16|o:o<<16|h;void 0===r[u]&&(r[u]=0,n.push(o,h))}return t.indices=n,t.primitiveMode=vc.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 a=t[r+e[s][0]],o=t[r+e[s][1]],h=a>o?o<<16|a:a<<16|o;void 0===n[h]&&(n[h]=0,i.push(a,o))}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!==vc.TRIANGLE_LIST)return"";for(var i=t.positions,n=t.uvs,r=t.normals,s=t.indices,a=function(t){return s[t]+1+"/"+(s[t]+1)+"/"+(s[t]+1)},o="",h=0;h<i.length;h+=3)o+="v "+i[h]*e+" "+i[h+1]*e+" "+i[h+2]*e+"\n";for(var u=0;u<n.length;u+=2)o+="vt "+n[u]+" "+n[u+1]+"\n";for(var l=0;l<r.length;l+=3)o+="vn "+r[l]+" "+r[l+1]+" "+r[l+2]+"\n";for(var c=0;c<s.length;c+=3)o+="f "+a(c)+" "+a(c+1)+" "+a(c+2)+"\n";return o},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,a=6*r;n[a+0]=t[s+0],n[a+1]=t[s+1],n[a+2]=t[s+2],n[a+3]=t[s+0]+e[s+0]*i,n[a+4]=t[s+1]+e[s+1]*i,n[a+5]=t[s+2]+e[s+2]*i}return n},applyDefaultGeometryOptions:v$});t("fz",V$);var W$=new hn;function X$(t){return t.x=Math.abs(t.x),t.y=Math.abs(t.y),t.z=Math.abs(t.z),t}var j$,Y$,K$,q$,Q$,Z$,J$,$$,t0,e0,i0,n0,r0,s0,a0,o0,h0,u0,l0,c0,_0,d0,f0,p0,m0=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:W$,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],a=t[r+1],o=t[r+2],h=String(s)+String(a)+String(o),u=Bl(h,666);i[u]!==h&&(i[u]=h,e.push(s),e.push(a),e.push(o))}}return e},absolute:X$,cylinder:P$});!function(t){t[t.Low_256x256=256]="Low_256x256",t[t.Medium_512x512=512]="Medium_512x512",t[t.High_768x768=768]="High_768x768"}(p0||(p0={})),t("aj",(j$=qs("cc.ReflectionProbe"),Y$=xa(hn),K$=xa(ve(rx)),q$=xa(ve(p0)),Q$=xa(ve(nx)),Z$=xa(pn),J$=xa(sm.BitMask),$$=xa(SV),t0=xa(Qe),e0=xa(tg),j$(((f0=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._lastSize=new hn,e._resolution=r0&&r0(),e._clearFlag=s0&&s0(),e._backgroundColor=a0&&a0(),e._visibility=o0&&o0(),e._probeType=h0&&h0(),e._cubemap=u0&&u0(),e._size=l0&&l0(),e._sourceCamera=c0&&c0(),e._probeId=_0&&_0(),e._fastBake=d0&&d0(),e._probe=null,e._previewSphere=null,e._previewPlane=null,e._sourceCameraPos=new hn(0,0,0),e._position=new hn(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=g$.probeManager.getProbeById(this._probeId);null!==t&&t!==this._probe&&(this._probeId=g$.probeManager.getNewReflectionProbeId(),this._probe.updateProbeId(this._probeId)),g$.probeManager.register(this._probe),g$.probeManager.onUpdateProbes(),this._probe.enable()}},i.onDisable=function(){this._probe&&(g$.probeManager.unregister(this._probe),this._probe.disable())},i.start=function(){this._sourceCamera&&this.probeType===rx.PLANAR&&(this.probe.renderPlanarReflection(this.sourceCamera.camera),g$.probeManager.filterModelsForPlanarReflection()),g$.probeManager.updateProbeData(),this._position=this.node.getWorldPosition().clone()},i.onDestroy=function(){this.probe&&this.probe.destroy()},i.update=function(){if(this.probe){this.probeType===rx.PLANAR&&this.sourceCamera&&(this.sourceCamera.node.hasChangedFlags&om.TRS||!this._sourceCameraPos.equals(this.sourceCamera.node.getWorldPosition()))&&(this._sourceCameraPos=this.sourceCamera.node.getWorldPosition(),this.probe.renderPlanarReflection(this.sourceCamera.camera)),this.node.hasChangedFlags&om.POSITION&&(this.probe.updateBoundingBox(),g$.probeManager.onUpdateProbes(),g$.probeManager.updateProbeData());var t=this.node.getWorldPosition();this._position.equals(t)||(this._position=t,this.probe.updateBoundingBox(),g$.probeManager.updateProbeData(),g$.probeManager.updateProbeOfModels())}},i.clearBakedCubemap=function(){this.cubemap=null,g$.probeManager.updateBakedCubemap(this.probe),g$.probeManager.updatePreviewSphere(this.probe)},i._createProbe=function(){if((-1===this._probeId||g$.probeManager.exists(this._probeId))&&(this._probeId=g$.probeManager.getNewReflectionProbeId()),this._probe=new lx(this._probeId),this._probe){var t=new $m("ReflectionProbeCamera");t.hideFlags|=Wa.Flags.DontSave|Wa.Flags.HideInHierarchy,this.node.scene.addChild(t),this._probe.initialize(this.node,t),this.enabled&&g$.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),X$(this._size),this.probe.size=this._size,this.probe&&(this.probe.updateBoundingBox(),g$.probeManager.onUpdateProbes(),g$.probeManager.updateProbeData(),g$.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=hn.equals(this._lastSize,hn.ZERO);this._probeType=t,this._probeType===rx.CUBE?(n&&this._size.set(e.DEFAULT_CUBE_SIZE),this.probe.switchProbeType(t,null),g$.probeManager.clearPlanarReflectionMap(this.probe)):(n&&this._size.set(e.DEFAULT_PLANER_SIZE),this._sourceCamera?this.probe.switchProbeType(t,this._sourceCamera.camera):U("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===rx.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,g$.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&&g$.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&&g$.probeManager.updatePreviewPlane(this.probe))}}]),e}(op)).DEFAULT_CUBE_SIZE=new hn(1,1,1),f0.DEFAULT_PLANER_SIZE=new hn(5,.5,5),r0=Gs((n0=f0).prototype,"_resolution",[ra],(function(){return 256})),s0=Gs(n0.prototype,"_clearFlag",[ra],(function(){return nx.SKYBOX})),a0=Gs(n0.prototype,"_backgroundColor",[ra],(function(){return new pn(0,0,0,255)})),o0=Gs(n0.prototype,"_visibility",[ra],(function(){return Jv})),h0=Gs(n0.prototype,"_probeType",[ra],(function(){return rx.CUBE})),u0=Gs(n0.prototype,"_cubemap",[ra],(function(){return null})),l0=Gs(n0.prototype,"_size",[ra],(function(){return new hn(1,1,1)})),c0=Gs(n0.prototype,"_sourceCamera",[ra],(function(){return null})),_0=Gs(n0.prototype,"_probeId",[ra],(function(){return-1})),d0=Gs(n0.prototype,"_fastBake",[ra],(function(){return!1})),f(n0.prototype,"size",[Y$],Object.getOwnPropertyDescriptor(n0.prototype,"size"),n0.prototype),f(n0.prototype,"probeType",[K$],Object.getOwnPropertyDescriptor(n0.prototype,"probeType"),n0.prototype),f(n0.prototype,"resolution",[q$],Object.getOwnPropertyDescriptor(n0.prototype,"resolution"),n0.prototype),f(n0.prototype,"clearFlag",[Q$],Object.getOwnPropertyDescriptor(n0.prototype,"clearFlag"),n0.prototype),f(n0.prototype,"backgroundColor",[Z$],Object.getOwnPropertyDescriptor(n0.prototype,"backgroundColor"),n0.prototype),f(n0.prototype,"visibility",[J$],Object.getOwnPropertyDescriptor(n0.prototype,"visibility"),n0.prototype),f(n0.prototype,"sourceCamera",[$$],Object.getOwnPropertyDescriptor(n0.prototype,"sourceCamera"),n0.prototype),f(n0.prototype,"fastBake",[t0],Object.getOwnPropertyDescriptor(n0.prototype,"fastBake"),n0.prototype),f(n0.prototype,"cubemap",[e0],Object.getOwnPropertyDescriptor(n0.prototype,"cubemap"),n0.prototype),i0=n0))||i0)),v.utils=cF;var g0,v0,y0,T0,S0,E0=Symbol("CreateEval");qs("cc.animation.EmbeddedPlayer")((g0=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=v0&&v0(),e.end=y0&&y0(),e.reconciledSpeed=T0&&T0(),e.playable=S0&&S0(),e}return s(e,t),e}(Da),v0=Gs(g0.prototype,"begin",[ra],(function(){return 0})),y0=Gs(g0.prototype,"end",[ra],(function(){return 0})),T0=Gs(g0.prototype,"reconciledSpeed",[ra],(function(){return!1})),S0=Gs(g0.prototype,"playable",[ra],(function(){return null})),g0));var A0,R0=function(){},b0=function(){function t(t){this._randomAccess=t}return t.prototype.setTime=function(){},n(t,[{key:"randomAccess",get:function(){return this._randomAccess}}]),t}(),C0=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=ou.Default]="Default",t[t.Normal=ou.Normal]="Normal",t[t.Reverse=ou.Reverse]="Reverse",t[t.Loop=ou.Loop]="Loop",t[t.LoopReverse=ou.Loop|ou.Reverse]="LoopReverse",t[t.PingPong=ou.PingPong]="PingPong",t[t.PingPongReverse=ou.PingPong|ou.Reverse]="PingPongReverse"}(A0||(A0={})),Se(A0);var w0,x0=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}(),I0=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 O0(){return v.director.getAnimationManager()}!function(t){t.PLAY="play",t.STOP="stop",t.PAUSE="pause",t.RESUME="resume",t.LASTFRAME="lastframe",t.FINISHED="finished"}(w0||(w0={})),Se(w0);var D0,M0,P0,B0=t("ao",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=A0.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 x0,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||z("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&ou.Loop)===ou.Loop?this.repeatCount=1/0:this.repeatCount=1,!this._doNotCreateEval){var r,s,a,o=null!==(r=null!=e?e:null===(s=O0())||void 0===s?void 0:s.blendState)&&void 0!==r?r:null;o&&(this._poseOutput=new I0(o)),this._clipEval=n.createEvaluator({target:t,pose:null!==(a=this._poseOutput)&&void 0!==a?a:void 0,mask:i})}n.containsAnyEvent()&&(this._clipEventEval=n.createEventEvaluator(this._targetNode)),n.containsAnyEmbeddedPlayer()&&(this._clipEmbeddedPlayerEval=n.createEmbeddedPlayerEvaluator(this._targetNode),this._clipEmbeddedPlayerEval.notifyHostSpeedChanged(this._speed))}},i.destroy=function(){this.isMotionless||O0().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];O0().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(w0.PLAY,this),null===(t=this._clipEmbeddedPlayerEval)||void 0===t||t.notifyHostPlay(this.current)},i.onStop=function(){var t;this.isPaused||this._onPauseOrStop(),this.emit(w0.STOP,this),null===(t=this._clipEmbeddedPlayerEval)||void 0===t||t.notifyHostStop()},i.onResume=function(){var t;this._onReplayOrResume(),this.emit(w0.RESUME,this),null===(t=this._clipEmbeddedPlayerEval)||void 0===t||t.notifyHostPlay(this.current)},i.onPause=function(){var t;this._onPauseOrStop(),this.emit(w0.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 x0(e),this.repeatCount>1&&(0|e.iterations)>(0|t.iterations)&&this.emit(w0.LASTFRAME,this),t.set(e)),e.stopped&&(this.stop(),this.emit(w0.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(w0.LASTFRAME,this),this._lastIterations=n)},i._needReverse=function(t){var e=this.wrapMode,i=!1;return(e&ou.PingPong)===ou.PingPong&&(t-(0|t)==0&&t>0&&(t-=1),1&t&&(i=!i)),(e&ou.Reverse)===ou.Reverse&&(i=!i),i},i.getWrappedInfo=function(t,e){e=e||new x0;var i=this._playbackRange.min,n=this._playbackDuration,r=this.repeatCount;if(0===n)return e.time=0,e.ratio=0,e.direction=1,e.stopped=!!Number.isFinite(r),e.iterations=0,e;var s=!1,a=(t-=i)>0?t/n:-t/n;if(a>=r){a=r,s=!0;var o=r-(0|r);0===o&&(o=1),t=o*n*(t>0?1:-1)}if(t>n){var h=t%n;t=0===h?n:h}else t<0&&0!=(t%=n)&&(t+=n);var u=!1,l=this._wrapMode&ou.ShouldWrap;l&&(u=this._needReverse(a));var c=u?-1:1;return this.speed<0&&(c*=-1),l&&u&&(t=n-t),e.time=i+t,e.ratio=e.time/this.duration,e.direction=c,e.stopped=s,e.iterations=a,e},i._getPlaybackStart=function(){return this._playbackRange.min},i._sampleEvents=function(t){var e;null===(e=this._clipEventEval)||void 0===e||e.sample(t.ratio,t.direction,t.iterations)},i._sampleEmbeddedPlayers=function(t){var e;null===(e=this._clipEmbeddedPlayerEval)||void 0===e||e.evaluate(t.time,Math.trunc(t.iterations))},i._emit=function(t,e){this._target&&this._target.isValid&&this._target.emit(t,t,e)},i._onReplayOrResume=function(){O0().addAnimation(this)},i._onPauseOrStop=function(){O0().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&ou.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&ou.ShouldWrap,i=(this.wrapMode&ou.Reverse)===ou.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}(C0));v.AnimationState=B0,qs("cc.animation.EmbeddedAnimationClipPlayable")((D0=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=M0&&M0(),e.clip=P0&&P0(),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 B0(e);return r.initialize(n),new F0(r)},e}(R0),M0=Gs(D0.prototype,"path",[ra],(function(){return""})),P0=Gs(D0.prototype,"clip",[ra],(function(){return null})),D0));var N0,L0,F0=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}(b0);qs("cc.animation.EmbeddedParticleSystemPlayable")((N0=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=L0&&L0(),e}return s(e,t),e.prototype.instantiate=function(t){var e=t.getChildByPath(this.path);if(!e)return U("Hierarchy path "+this.path+" does not exists."),null;var i=ie("cc.ParticleSystem");if(!i)return U("Particle system is required for embedded particle system player."),null;var n=e.getComponent(i);return n?new W0(n):(U(this.path+" does not includes a particle system component."),null)},e}(R0),L0=Gs(N0.prototype,"path",[ra],(function(){return""})),N0));var k0,U0,G0,H0,z0,V0,W0=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}(b0);function X0(t){return"string"==typeof t||"number"==typeof t}var j0,Y0,K0,q0,Q0,Z0,J0,$0,t1,e1,i1,n1,r1,s1,a1,o1,h1,u1,l1,c1=qs("cc.animation.HierarchyPath")((U0=function(){function t(t){this.path=G0&&G0(),this.path=t||""}return t.prototype.get=function(t){return t instanceof $m?t.getChildByPath(this.path)||(q(3926,t.name,this.path),null):(q(3925),null)},t}(),G0=Gs(U0.prototype,"path",[ra],(function(){return""})),k0=U0))||k0,_1=qs("cc.animation.ComponentPath")((z0=function(){function t(t){this.component=V0&&V0(),this.component=t||""}return t.prototype.get=function(t){return t instanceof $m?t.getComponent(this.component)||(q(3928,t.name,this.component),null):(q(3927),null)},t}(),V0=Gs(z0.prototype,"component",[ra],(function(){return""})),H0=z0))||H0,d1=Symbol("NormalizedFollow"),f1=Symbol("ConvertAsTrsPath"),p1=Symbol("TrackBinding"),m1=qs("cc.animation.TrackPath")((Y0=function(){function t(){this._paths=K0&&K0()}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 c1(t)),this},e.toComponent=function(t){var e=new _1("string"==typeof t?t:Dt(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 c1},e.parseHierarchyAt=function(t){return this.isHierarchyAt(t),this._paths[t].path},e.isComponentAt=function(t){return this._paths[t]instanceof _1},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[d1](t,e,i)},e[f1]=function(){for(var t,e=this._paths,i=e.length,n=0,r="";n<i;++n){var s=e[n];if(!(s instanceof c1))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[d1]=function(t,e,i){for(var n=this._paths,r=t,s=e;s<i;++s){var a=n[s];if(X0(a)){if(!(a in r))return q(3929,a),null;r=r[a]}else r=a.get(r);if(null===r)break}return r},n(t,[{key:"length",get:function(){return this._paths.length}}]),t}(),K0=Gs(Y0.prototype,"_paths",[ra],(function(){return[]})),j0=Y0))||j0,g1=qs("cc.animation.TrackBinding")(q0=ha((($0=function(){function t(){this.path=Z0&&Z0(),this.proxy=J0&&J0()}var e=t.prototype;return e.parseTrsPath=function(){return this.proxy?null:this.path[f1]()},e.createRuntimeBinding=function(e,i,n){var r=this.path,s=this.proxy,a=r.length,o=a-1;if(0===a||!r.isPropertyAt(o)&&!r.isElementAt(o)||s){if(s){var h=r[d1](e,0,a);if(null===h)return null;var u=s.forTarget(h);if(!u)return null;var l={setValue:function(t){u.set(t)}},c=u.get;return c&&(l.getValue=function(){return c.call(u)}),l}return Z(3921),null}var _=r.isPropertyAt(o)?r.parsePropertyAt(o):r.parseElementAt(o),d=r[d1](e,0,a-1);if(null===d)return null;if(i&&d instanceof $m&&function(t){return"position"===t||"rotation"===t||"scale"===t||"eulerAngles"===t}(_))return i.createPoseWriter(d,_,n);var f=t._animationFunctions.get(d.constructor);f||(f=new Map,t._animationFunctions.set(d.constructor,f));var p=f.get(_);return p||(p={setValue:Function("value","this.target."+_+" = value;"),getValue:Function("return this.target."+_+";")},f.set(_,p)),{target:d,setValue:p.setValue,getValue:p.getValue}},e.isMaskedOff=function(t){var e=this.parseTrsPath();if(!e)return!1;for(var i=t.joints[Symbol.iterator](),n=i.next();!n.done;n=i.next()){var r=n.value;if(r.path===e.node)return!r.enabled}return!1},t}())._animationFunctions=new WeakMap,Z0=Gs((Q0=$0).prototype,"path",[ra],(function(){return new m1})),J0=Gs(Q0.prototype,"proxy",[ra],null),q0=Q0))||q0)||q0,v1=qs("cc.animation.Track")((e1=function(){function t(){this._binding=i1&&i1()}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:p1,get:function(){return this._binding}}]),t}(),i1=Gs(e1.prototype,"_binding",[ra],(function(){return new g1})),t1=e1))||t1,y1=qs("cc.animation.Channel")((r1=function(){function t(t){this.name="",this._curve=s1&&s1(),this._curve=t}return n(t,[{key:"curve",get:function(){return this._curve}}]),t}(),s1=Gs(r1.prototype,"_curve",[ra],null),n1=r1))||n1,T1=qs("cc.animation.SingleChannelTrack")((o1=function(t){function e(){var e;return(e=t.call(this)||this)._channel=h1&&h1(),e._channel=new y1(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[E0]=function(){var t=this._channel.curve;return new S1(t)},n(e,[{key:"channel",get:function(){return this._channel}}]),e}(v1),h1=Gs(o1.prototype,"_channel",[ra],null),a1=o1))||a1,S1=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}(),E1=ra;qs("cc.animation.RealArrayTrack")((u1=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=l1&&l1(),e}s(e,t);var i=e.prototype;return i.channels=function(){return this._channels},i[E0]=function(){return new H1(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 y1(new rh)})))}}}]),e}(v1),l1=Gs(u1.prototype,"_channels",[E1],(function(){return[]})),u1));var A1,R1,b1,C1,w1,x1,I1,O1,D1,M1,P1,B1,N1,L1,F1,k1,U1,G1,H1=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}(),z1=qs("cc.animation.UniformProxyFactory")((R1=function(){function t(t,e){this.passIndex=b1&&b1(),this.uniformName=C1&&C1(),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,w1,this),this.passIndex=e||0,this.uniformName=t||""}return t.prototype.forTarget=function(t){if(t instanceof OS){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(_S.getTypeFromHandle(s)<Kl.SAMPLER1D){var a=void 0===n?s:r.getHandle(i,n,Kl.FLOAT);return a?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 a=r.value;if(a.name===e)return a.count>1}return!1}(r,i)?{set:function(t){r.setUniformArray(a,t)}}:{set:function(t){r.setUniform(a,t)}}:void q(3943,t.name,e,i,n)}var o=_S.getBindingFromHandle(s),h=r.properties[i],u=h&&h.value?""+h.value+vy(h.type):gy(h.type),l=aS.get(u);return l||(U("Illegal texture default value: "+u+"."),l=aS.get("default-texture")),{set:function(t){t||(t=l);var e=t.getGFXTexture();e&&e.width&&e.height&&(r.bindTexture(o,e),t instanceof Lf&&r.bindSampler(o,wd.gfxDevice.getSampler(t.getSamplerInfo())))}}}q(3942,t.name,e,i)}}else q(3940,t)},t}(),b1=Gs(R1.prototype,"passIndex",[ra],(function(){return 0})),C1=Gs(R1.prototype,"uniformName",[ra],(function(){return""})),w1=f(R1.prototype,"channelIndex",[ba],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){}}),A1=R1))||A1,V1=qs("cc.animation.MorphWeightValueProxy")((I1=function(){function t(){this.subMeshIndex=O1&&O1(),this.shapeIndex=D1&&D1()}return t.prototype.forTarget=function(t){var e=this;return{set:function(i){t.setWeight(i,e.subMeshIndex,e.shapeIndex)}}},t}(),O1=Gs(I1.prototype,"subMeshIndex",[ra],(function(){return 0})),D1=Gs(I1.prototype,"shapeIndex",[ra],(function(){return 0})),x1=I1))||x1,W1=qs("cc.animation.MorphWeightsValueProxy")((P1=function(){function t(){this.subMeshIndex=B1&&B1()}return t.prototype.forTarget=function(t){var e=this;return{set:function(i){t.setWeights(i,e.subMeshIndex)}}},t}(),B1=Gs(P1.prototype,"subMeshIndex",[ra],(function(){return 0})),M1=P1))||M1,X1=qs("cc.animation.MorphWeightsAllValueProxy")(N1=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}())||N1;function j1(t,e,i,n){var r,s,a,o,h,u=new e,l=new e,c=new e,_=qs(t)((s=function(){function t(t,i,n){this.dataPoint=a&&a(),this.inTangent=o&&o(),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,a=t.dataPoint;l=i(l,this.inTangent,r),c=i(c,t.outTangent,r);var o=e*e*e,h=e*e,_=o-2*h+e,d=-2*o+3*h,f=o-h;return u=i(u,s,2*o-3*h+1),u=n(u,u,l,_),u=n(u,u,a,d),u=n(u,u,c,f)},r.getNoLerp=function(){return this.dataPoint},t}(),a=Gs(s.prototype,"dataPoint",[ra],(function(){return new e})),o=Gs(s.prototype,"inTangent",[ra],(function(){return new e})),h=Gs(s.prototype,"outTangent",[ra],(function(){return new e})),r=s))||r;if(e===En){var d=_.prototype.lerp;_.prototype.lerp=function(t,e,i){var n=d.call(this,t,e,i);return En.normalize(n,n),n}}return _}var Y1,K1,q1,Q1,Z1,J1=j1("cc.CubicSplineVec2Value",Fn,Fn.multiplyScalar,Fn.scaleAndAdd),$1=j1("cc.CubicSplineVec3Value",hn,hn.multiplyScalar,hn.scaleAndAdd),t2=j1("cc.CubicSplineVec4Value",nn,nn.multiplyScalar,nn.scaleAndAdd),e2=j1("cc.CubicSplineQuatValue",En,En.multiplyScalar,En.scaleAndAdd),i2=qs("cc.CubicSplineNumberValue")((F1=function(){function t(t,e,i){this.dataPoint=k1&&k1(),this.inTangent=U1&&U1(),this.outTangent=G1&&G1(),this.dataPoint=t,this.inTangent=e,this.outTangent=i}var e=t.prototype;return e.lerp=function(t,e,i){var n=this.dataPoint,r=t.dataPoint,s=e*e*e,a=e*e;return n*(2*s-3*a+1)+this.outTangent*i*(s-2*a+e)+r*(-2*s+3*a)+t.inTangent*i*(s-a)},e.getNoLerp=function(){return this.dataPoint},t}(),k1=Gs(F1.prototype,"dataPoint",[ra],(function(){return 0})),U1=Gs(F1.prototype,"inTangent",[ra],(function(){return 0})),G1=Gs(F1.prototype,"outTangent",[ra],(function(){return 0})),L1=F1))||L1,n2=qs("cc.animation.RealTrack")(Y1=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.createCurve=function(){return new rh},e}(T1))||Y1;function r2(t){return 0===t.keyFramesCount?void 0:t}var s2,a2,o2,h2,u2,l2,c2,_2,d2=["X","Y","Z","W"],f2=qs("cc.animation.VectorTrack")((q1=function(t){function e(){var e;(e=t.call(this)||this)._channels=Q1&&Q1(),e._nComponents=Z1&&Z1(),e._channels=new Array(4);for(var i=0;i<e._channels.length;++i){var n=new y1(new rh);n.name=d2[i],e._channels[i]=n}return e}s(e,t);var i=e.prototype;return i.channels=function(){return this._channels},i[E0]=function(){switch(this._nComponents){default:case 2:return new p2(r2(this._channels[0].curve),r2(this._channels[1].curve));case 3:return new m2(r2(this._channels[0].curve),r2(this._channels[1].curve),r2(this._channels[2].curve));case 4:return new g2(r2(this._channels[0].curve),r2(this._channels[1].curve),r2(this._channels[2].curve),r2(this._channels[3].curve))}},n(e,[{key:"componentsCount",get:function(){return this._nComponents},set:function(t){this._nComponents=t}}]),e}(v1),Q1=Gs(q1.prototype,"_channels",[ra],null),Z1=Gs(q1.prototype,"_nComponents",[ra],(function(){return 4})),K1=q1))||K1,p2=function(){function t(t,e){this._result=new Fn,this._x=t,this._y=e}return t.prototype.evaluate=function(t,e){return e&&Fn.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}(),m2=function(){function t(t,e,i){this._result=new hn,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&&hn.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}(),g2=function(){function t(t,e,i,n){this._result=new nn,this._x=t,this._y=e,this._z=i,this._w=n}return t.prototype.evaluate=function(t,e){return e&&nn.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}(),v2=qs("cc.animation.QuatTrack")(s2=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.createCurve=function(){return new Vh},i[E0]=function(){return new y2(this.channels()[0].curve)},e}(T1))||s2,y2=function(){function t(t){this._result=new En,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}(),T2=["Red","Green","Blue","Alpha"],S2=qs("cc.animation.ColorTrack")((o2=function(t){function e(){var e;(e=t.call(this)||this)._channels=h2&&h2(),e._channels=new Array(4);for(var i=0;i<e._channels.length;++i){var n=new y1(new rh);n.name=T2[i],e._channels[i]=n}return e}s(e,t);var i=e.prototype;return i.channels=function(){return this._channels},i[E0]=function(){return new E2(r2(this._channels[0].curve),r2(this._channels[1].curve),r2(this._channels[2].curve),r2(this._channels[3].curve))},e}(v1),h2=Gs(o2.prototype,"_channels",[ra],null),a2=o2))||a2,E2=function(){function t(t,e,i,n){this._result=new pn,this._x=t,this._y=e,this._z=i,this._w=n}return t.prototype.evaluate=function(t,e){return e&&pn.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}(),A2=["Width","Height"],R2=qs("cc.animation.SizeTrack")((l2=function(t){function e(){var e;(e=t.call(this)||this)._channels=c2&&c2(),e._channels=new Array(2);for(var i=0;i<e._channels.length;++i){var n=new y1(new rh);n.name=A2[i],e._channels[i]=n}return e}s(e,t);var i=e.prototype;return i.channels=function(){return this._channels},i[E0]=function(){return new b2(r2(this._channels[0].curve),r2(this._channels[1].curve))},e}(v1),c2=Gs(l2.prototype,"_channels",[ra],null),u2=l2))||u2,b2=function(){function t(t,e){this._result=new Hn,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}(),C2=qs("cc.animation.ObjectTrack")(_2=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.createCurve=function(){return new $h},e}(T1))||_2;t("am",Object.freeze({__proto__:null,UniformProxyFactory:z1,MorphWeightValueProxy:V1,MorphWeightsValueProxy:W1,MorphWeightsAllValueProxy:X1,Track:v1,TrackPath:m1,RealTrack:n2,VectorTrack:f2,QuatTrack:v2,ColorTrack:S2,SizeTrack:R2,ObjectTrack:C2,isPropertyPath:X0,isCustomPath:function(t,e){return t instanceof e},HierarchyPath:c1,ComponentPath:_1,CubicSplineVec2Value:J1,CubicSplineVec3Value:$1,CubicSplineVec4Value:t2,CubicSplineQuatValue:e2,CubicSplineNumberValue:i2}));var w2=t("aq",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?D2:Bs}return t.prototype.sample=function(t){return this._findRatio(this.ratios,t)},t}());v.RatioSampler=w2;var x2=t("ar",function(){function t(e,i){this.types=void 0,this.type=null,this._values=[],this._lerp=void 0,this._duration=void 0,this._array=void 0,this._duration=i,this._values=e.values;var n=function(e){return"string"==typeof e?e:Array.isArray(e)?e[0]===e[1]&&e[2]===e[3]?t.Linear:t.Bezier(e):t.Linear};if(void 0!==e.easingMethod)this.type=n(e.easingMethod);else if(Array.isArray(e.easingMethods))this.types=e.easingMethods.map(n);else if(void 0!==e.easingMethods){this.types=new Array(this._values.length).fill(null);for(var r=0,s=Object.keys(e.easingMethods);r<s.length;r++){var a=s[r];this.types[a]=n(e.easingMethods[a])}}else this.type=null;var o=e.values[0];(void 0===e.interpolate||e.interpolate)&&(this._lerp=k2(o)),void 0!==e._arrayLength&&(this._array=new Array(e._arrayLength))}t.Bezier=function(t){return t};var e=t.prototype;return e.hasLerp=function(){return!!this._lerp},e.valueAt=function(t){if(void 0===this._array){var e=this._values[t];return e&&e.getNoLerp?e.getNoLerp():e}for(var i=0;i<this._array.length;++i)this._array[i]=this._values[this._array.length*t+i];return this._array},e.valueBetween=function(t,e,i,n,r){if(this._lerp){var s=this.types?this.types[e]:this.type,a=r-i,o=(t-i)/a;if(s&&(o=O2(o,s)),void 0===this._array){var h=this._values[e],u=this._values[n];return this._lerp(h,u,o,a*this._duration)}for(var l=0;l<this._array.length;++l){var c=this._values[this._array.length*e+l],_=this._values[this._array.length*n+l];this._array[l]=this._lerp(c,_,o,a*this._duration)}return this._array}if(void 0===this._array)return this.valueAt(e);for(var 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 I2(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 O2(t,e){if("string"==typeof e){var i=Yo[e];i?t=i(t):Z(3906,e)}else Array.isArray(e)&&(t=Uh(e,t));return t}function D2(t,e){var i=t.length-1;if(0===i)return 0;var n=t[0];if(e<n)return 0;var r=t[i];if(e>r)return i;var s=(e=(e-n)/(r-n))/(1/i),a=0|s,o=1e-6;return s-a<o?a:a+1-s<o?a+1:~(a+1)}x2.Linear=null,v.AnimCurve=x2,t("as",function(){function t(){this.events=[]}return t.prototype.add=function(t,e){this.events.push({func:t||"",params:e||[]})},t}()),v.sampleAnimationCurve=I2;var M2,P2,B2,N2,L2,F2,k2=function(){function t(t,e,i,n){return t.lerp(e,i,n)}return function(e){if(null!==e){if("number"==typeof e)return Di;if("object"==typeof e&&e.constructor){if(e instanceof En)return i=new En,function(t,e,n){return En.slerp(i,t,e,n)};if(e instanceof Ae)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 Di;if("function"==typeof e.lerp)return t}var i}}}(),U2=qs("cc.animation.UntypedTrackChannel")((P2=function(t){function e(){var e;return(e=t.call(this,new rh)||this).property=B2&&B2(),e}return s(e,t),e}(y1),B2=Gs(P2.prototype,"property",[ra],(function(){return""})),M2=P2))||M2,G2=qs("cc.animation.UntypedTrack")((L2=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=F2&&F2(),e}s(e,t);var i=e.prototype;return i.channels=function(){return this._channels},i[E0]=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 Fn:return new p2(i("x"),i("y"));case t instanceof hn:return new m2(i("x"),i("y"),i("z"));case t instanceof nn:return new g2(i("x"),i("y"),i("z"),i("w"));case t instanceof pn:return new E2(i("r"),i("g"),i("b"),i("a"));case t instanceof Hn:return new b2(i("width"),i("height"))}},i.addChannel=function(t){var e=new U2;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 f2;r.path=this.path,r.proxy=this.proxy,r.componentsCount="vec2"===n?2:"vec3"===n?3:4;var s=r.channels(),a=s[0],o=s[1],h=s[2],u=s[3];switch(n){case"vec4":i("w",u);case"vec3":i("z",h);default:case"vec2":i("x",a),i("y",o)}return r;case"color":var l=new S2,c=l.channels(),_=c[0],d=c[1],f=c[2],p=c[3];return i("r",_),i("g",d),i("b",f),i("a",p),i("x",_),i("y",d),i("z",f),i("w",p),l;case"size":}return null},e}(v1),F2=Gs(L2.prototype,"_channels",[ra],(function(){return[]})),N2=L2))||N2,H2=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 m1,s=d(e);!(n=s()).done;){var a=n.value;"string"==typeof a?r.toProperty(a):"number"==typeof a?r.toElement(a):a instanceof c1?r.toHierarchy(a.path):a instanceof _1?r.toComponent(a.component):r.toCustomized(a)}t.path=r,t.proxy=i},a=r.map((function(t){var i=new G2;return s(i,t.modifiers,t.valueAdapter),e.push(i),i})),o=function(){var n,r=t.value,o=r.data,h=o.values;if(0===h.length)return 0;var u=o.keys<0?[0]:i[o.keys],l=h[0],c=null===(n=o.interpolate)||void 0===n||n;o._arrayLength;var _,d=new V2(o,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],m=a[r.commonTarget].addChannel(p).curve;_=m}!function(){if("number"==typeof l){if(!h.every((function(t){return"number"==typeof t})))return void q(3934);var t;if(_)t=_;else{var i=new n2;f(i),e.push(i),t=i.channel.curve}var n=c?Ns.LINEAR:Ns.CONSTANT;return t.assignSorted(u,h.map((function(t){return{value:t,interpolationMode:n}}))),void d.convert(t)}if("object"==typeof l)switch(!0){default:break;case z2(h,Fn):case z2(h,hn):case z2(h,nn):var r=l instanceof Fn?2:l instanceof hn?3:4,s=new f2;f(s),s.componentsCount=r;var a=s.channels(),o=a[0].curve,p=a[1].curve,m=a[2].curve,g=a[3].curve,v=c?Ns.LINEAR:Ns.CONSTANT,y=function(t){return{value:t,interpolationMode:v}};switch(r){case 4:g.assignSorted(u,h.map((function(t){return y(t.w)}))),d.convert(g);case 3:m.assignSorted(u,h.map((function(t){return y(t.z)}))),d.convert(m);default:o.assignSorted(u,h.map((function(t){return y(t.x)}))),d.convert(o),p.assignSorted(u,h.map((function(t){return y(t.y)}))),d.convert(p)}return void e.push(s);case z2(h,En):var T=new v2;f(T);var S=c?Mh.SLERP:Mh.CONSTANT;return T.channel.curve.assignSorted(u,h.map((function(t){return{value:En.clone(t),interpolationMode:S}}))),d.convertQuatCurve(T.channel.curve),void e.push(T);case z2(h,pn):var E=new S2;f(E);var A=E.channels(),R=A[0].curve,b=A[1].curve,C=A[2].curve,w=A[3].curve,x=c?Ns.LINEAR:Ns.CONSTANT,I=function(t){return{value:t,interpolationMode:x}};return R.assignSorted(u,h.map((function(t){return I(t.r)}))),d.convert(R),b.assignSorted(u,h.map((function(t){return I(t.g)}))),d.convert(b),C.assignSorted(u,h.map((function(t){return I(t.b)}))),d.convert(C),w.assignSorted(u,h.map((function(t){return I(t.a)}))),d.convert(w),void e.push(E);case z2(h,Hn):var O=new R2;f(O);var D=O.channels(),M=D[0].curve,P=D[1].curve,B=c?Ns.LINEAR:Ns.CONSTANT,N=function(t){return{value:t,interpolationMode:B}};return M.assignSorted(u,h.map((function(t){return N(t.width)}))),d.convert(M),P.assignSorted(u,h.map((function(t){return N(t.height)}))),d.convert(P),void e.push(O);case z2(h,i2):d.nil;var L=new n2;f(L);var F=c?Ns.CUBIC:Ns.CONSTANT;return L.channel.curve.assignSorted(u,h.map((function(t){return{value:t.dataPoint,leftTangent:t.inTangent,rightTangent:t.outTangent,interpolationMode:F}}))),void e.push(L);case z2(h,J1):case z2(h,$1):case z2(h,t2):d.nil;var k=l instanceof J1?2:l instanceof $1?3:4,U=new f2;f(U),U.componentsCount=k;var G=U.channels(),H=G[0],z=G[1],V=G[2],W=G[3],X=c?Ns.LINEAR:Ns.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 e2})):q(3935)}var Y=new C2;f(Y),Y.channel.curve.assignSorted(u,h),e.push(Y)}()},h=d(n);!(t=h()).done;)o();return e},e._createPropertyCurves=function(){var t=this;this._ratioSamplers=this._keys.map((function(e){return new w2(e.map((function(e){return e/t._duration})))})),this._runtimeCurves=this._curves.map((function(e){return{curve:new x2(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 z2(t,e){return t.every((function(t){return t instanceof e}))}var V2=function(){function t(t,e){this._easingMethods=void 0;var i=t.easingMethods;Array.isArray(i)?0===i.length&&0!==e?this._easingMethods=new Array(e).fill(null):this._easingMethods=i:this._easingMethods=void 0===i?new Array(e).fill(t.easingMethod):Array.from({length:e},(function(t,e){var n;return null!==(n=i[e])&&void 0!==n?n:null}))}var e=t.prototype;return e.convert=function(t){var e,i,n,r,s,a,o,h,u,l,c,_,d,f,p,m,g,v,y,T,S,E,A=this._easingMethods;if(A){var R=t.keyFramesCount;if(!(t.keyFramesCount<2)){Array.isArray(A)&&A.length;for(var b=R-1,C=0;C<b;++C){var w=A[C];w&&(Array.isArray(w)?(e=w,i=t.getKeyframeTime(C),n=t.getKeyframeValue(C),r=t.getKeyframeTime(C+1),s=t.getKeyframeValue(C+1),a=void 0,o=void 0,h=void 0,u=void 0,l=void 0,c=void 0,_=void 0,d=void 0,f=void 0,p=void 0,m=void 0,g=void 0,v=void 0,y=void 0,T=void 0,S=void 0,E=void 0,o=e[0],h=e[1],u=e[2],l=e[3],c=n.value,_=3*(r-i),d=3*(s.value-c),m=(1-u)*_,g=(1-l)*d,v=1/3,y=(p=h*d)/(f=o*_),T=Math.sqrt(f*f+p*p)*v,S=g/m,E=Math.sqrt(m*m+g*g)*v,n.interpolationMode=Ns.CUBIC,n.tangentWeightMode=(a=n.tangentWeightMode)===Fs.NONE?Fs.RIGHT:a===Fs.LEFT?Fs.BOTH:a,n.rightTangent=y,n.rightTangentWeight=T,s.tangentWeightMode=function(t){return t===Fs.NONE?Fs.LEFT:t===Fs.RIGHT?Fs.BOTH:t}(s.tangentWeightMode),s.leftTangent=S,s.leftTangentWeight=E):W2(w,t,C))}}}},e.convertQuatCurve=function(t){var e=this._easingMethods;if(e){var i=t.keyFramesCount;if(!(t.keyFramesCount<2)){Array.isArray(e)&&e.length;for(var n=i-1,r=0;r<n;++r){var s=e[r];s&&(Array.isArray(s)?t.getKeyframeValue(r).easingMethod=s.slice():X2(s,t,r))}}}},n(t,[{key:"nil",get:function(){return!this._easingMethods||this._easingMethods.every((function(t){return null==t}))}}]),t}();function W2(t,e,i){e.keyFramesCount;var n=e.getKeyframeValue(i),r=m3[t];r===jo.CONSTANT?n.interpolationMode=Ns.CONSTANT:(n.interpolationMode=Ns.LINEAR,n.easingMethod=r)}function X2(t,e,i){e.keyFramesCount;var n=e.getKeyframeValue(i),r=m3[t];n.easingMethod=r}var j2,Y2,K2,q2,Q2,Z2,J2,$2,t3,e3,i3,n3,r3,s3,a3,o3,h3,u3,l3,c3,_3,d3,f3,p3,m3={constant:jo.CONSTANT,linear:jo.LINEAR,quadIn:jo.QUAD_IN,quadOut:jo.QUAD_OUT,quadInOut:jo.QUAD_IN_OUT,quadOutIn:jo.QUAD_OUT_IN,cubicIn:jo.CUBIC_IN,cubicOut:jo.CUBIC_OUT,cubicInOut:jo.CUBIC_IN_OUT,cubicOutIn:jo.CUBIC_OUT_IN,quartIn:jo.QUART_IN,quartOut:jo.QUART_OUT,quartInOut:jo.QUART_IN_OUT,quartOutIn:jo.QUART_OUT_IN,quintIn:jo.QUINT_IN,quintOut:jo.QUINT_OUT,quintInOut:jo.QUINT_IN_OUT,quintOutIn:jo.QUINT_OUT_IN,sineIn:jo.SINE_IN,sineOut:jo.SINE_OUT,sineInOut:jo.SINE_IN_OUT,sineOutIn:jo.SINE_OUT_IN,expoIn:jo.EXPO_IN,expoOut:jo.EXPO_OUT,expoInOut:jo.EXPO_IN_OUT,expoOutIn:jo.EXPO_OUT_IN,circIn:jo.CIRC_IN,circOut:jo.CIRC_OUT,circInOut:jo.CIRC_IN_OUT,circOutIn:jo.CIRC_OUT_IN,elasticIn:jo.ELASTIC_IN,elasticOut:jo.ELASTIC_OUT,elasticInOut:jo.ELASTIC_IN_OUT,elasticOutIn:jo.ELASTIC_OUT_IN,backIn:jo.BACK_IN,backOut:jo.BACK_OUT,backInOut:jo.BACK_IN_OUT,backOutIn:jo.BACK_OUT_IN,bounceIn:jo.BOUNCE_IN,bounceOut:jo.BOUNCE_OUT,bounceInOut:jo.BOUNCE_IN_OUT,bounceOutIn:jo.BOUNCE_OUT_IN,smooth:jo.SMOOTH,fade:jo.FADE};var g3=qs,v3=ra;function y3(){throw new Error("split() only valid in Editor.")}g3("cc.animation.ExoticAnimation")((j2=function(){function t(){this._nodeAnimations=Y2&&Y2()}var e=t.prototype;return e.createEvaluator=function(t){return new I3(this._nodeAnimations,t)},e.createEvaluatorForAnimationGraph=function(t){return new M3(this._nodeAnimations,t)},e.addNodeAnimation=function(t){var e=new T3(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 y3()},e.toHashString=function(){return this._nodeAnimations.map((function(t){return t.toHashString()})).join("\n")},t}(),Y2=Gs(j2.prototype,"_nodeAnimations",[v3],(function(){return[]})),j2));var T3=g3("cc.animation.ExoticNodeAnimation")((q2=function(){function t(t){this._path=Q2&&Q2(),this._position=Z2&&Z2(),this._rotation=J2&&J2(),this._scale=$2&&$2(),this._path=t}var e=t.prototype;return e.createPosition=function(t,e){this._position=new C3(t,new R3(e))},e.createRotation=function(t,e){this._rotation=new C3(t,new b3(e))},e.createScale=function(t,e){this._scale=new C3(t,new R3(e))},e.createEvaluator=function(t){return new O3(this._path,this._position,this._rotation,this._scale,t)},e.createEvaluatorForAnimationGraph=function(t){var e=t.bindTransform(this._path);return e?new P3(e,this._position,this._rotation,this._scale):null},e.split=function(){return y3()},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}(),Q2=Gs(q2.prototype,"_path",[v3],(function(){return""})),Z2=Gs(q2.prototype,"_position",[v3],(function(){return null})),J2=Gs(q2.prototype,"_rotation",[v3],(function(){return null})),$2=Gs(q2.prototype,"_scale",[v3],(function(){return null})),K2=q2))||K2;function S3(t){return t.toPrecision(2)}function E3(t){return t.map((function(t){return Number.parseFloat(S3(t))})).join(" ")}var A3=g3("cc.animation.ExoticVectorLikeTrackValues")((e3=function(){function t(t){this._values=i3&&i3(),this._isQuantized=n3&&n3(),this._values=t}var e=t.prototype;return e.quantize=function(t){this._isQuantized,this._values=function(t,e){var i=B3[e],n=1<<i.BYTES_PER_ELEMENT,r=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY;t.forEach((function(t){r=Math.min(t,r),s=Math.max(t,s)}));var a=s-r,o=i.from(t,(function(t){return(t-r)/a*n}));return new G3(N3(t),o,a,r)}(this._values,t),this._isQuantized=!0},e.toHashString=function(){var t=this._isQuantized,e=this._values;return t+" "+(t?e.toHashString():E3(e))},n(t,[{key:"precision",get:function(){return this._isQuantized?this._values.originalPrecision:N3(this._values)}}]),t}(),i3=Gs(e3.prototype,"_values",[v3],null),n3=Gs(e3.prototype,"_isQuantized",[v3],(function(){return!1})),t3=e3))||t3,R3=g3("cc.animation.ExoticVec3TrackValues")(r3=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?V3(i,t,e):hn.fromArray(e,i,3*t)},i.lerp=function(t,e,i,n,r,s){var a=this._values;this._isQuantized?(V3(a,t,n),V3(a,e,r)):(hn.fromArray(n,a,3*t),hn.fromArray(r,a,3*e)),hn.lerp(s,n,r,i)},e}(A3))||r3,b3=g3("cc.animation.ExoticQuatTrackValues")(s3=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?W3(i,t,e):En.fromArray(e,i,4*t)},i.lerp=function(t,e,i,n,r,s){var a=this._values;this._isQuantized?(W3(a,t,n),W3(a,e,r)):(En.fromArray(n,a,4*t),En.fromArray(r,a,4*e)),En.slerp(s,n,r,i)},e}(A3))||s3,C3=g3("cc.animation.ExoticTrack")((o3=function(){function t(t,e){this.times=h3&&h3(),this.values=u3&&u3(),this.times=t,this.values=e}return t.prototype.toHashString=function(){var t=this.times,e=this.values;return"times: "+E3(t)+"; values: "+e.toHashString()},t}(),h3=Gs(o3.prototype,"times",[v3],null),u3=Gs(o3.prototype,"values",[v3],null),a3=o3))||a3;function w3(t,e){t.length,t.length;var i=0,n=0,r=Bs(t,e);if(r>=0)i=r;else{var s=~r,a=s-1;i=a;var o=t[s],h=t[a];n=(e-h)/(o-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],a=0,o=0;if(e<r);else if(e>=s)a=n-1,o=0;else{var h=w3(t,e);a=h.index,o=h.ratio}var u=0,l=0;if(i<r);else if(i>=s)u=n-1,l=0;else{var c=w3(t,i);u=c.index,l=c.ratio}var _=!o,d=!l;a!==u||o!==l?(_||(this.preLerpIndex=a,this.preLerpRatio=o),this.directKeyframesBegin=_?a:a+1,this.directKeyframesEnd=u+1,d||(this.postLerpIndex=u,this.postLerpRatio=l)):_?(this.directKeyframesBegin=a,this.directKeyframesEnd=a+1):(this.preLerpIndex=a,this.preLerpRatio=o)}}},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 x3,I3=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}(),O3=function(){function t(t,e,i,n,r){this._position=null,this._rotation=null,this._scale=null,e&&(this._position=z3(e.times,e.values,hn,t,"position",r)),i&&(this._rotation=z3(i.times,i.values,En,t,"rotation",r)),n&&(this._scale=z3(n.times,n.values,hn,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}(),D3=function(){function t(t,e,i){this._times=void 0,this._inputSampleResultCache={just:!1,index:-1,nextIndex:-1,ratio:0},this._values=void 0,this._prevValue=void 0,this._nextValue=void 0,this._resultValue=void 0,this._times=t,this._values=e,this._prevValue=new i,this._nextValue=new i,this._resultValue=new i}return t.prototype.evaluate=function(t){var e=this._times,i=this._values,n=this._resultValue;if(0===e.length)return n;var r=function(t,e,i){var n=t.length,r=t[0],s=t[n-1];if(e<r)i.just=!0,i.index=0;else if(e>s)i.just=!0,i.index=n-1;else{var a=Bs(t,e);if(a>=0)i.just=!0,i.index=a;else{var o=~a,h=o-1,u=t[h],l=t[o],c=(e-t[h])/(l-u);i.just=!1,i.index=h,i.nextIndex=o,i.ratio=c}}return i}(e,t,this._inputSampleResultCache);return r.just?i.get(r.index,n):i.lerp(r.index,r.nextIndex,r.ratio,this._prevValue,this._nextValue,n),n},t}(),M3=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}(),P3=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 D3(e.times,e.values,hn)),i&&(this._rotation=new D3(i.times,i.values,En)),n&&(this._scale=new D3(n.times,n.values,hn))}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,a=e.transforms;if(n){var o=n.evaluate(t);a.setPosition(i,o)}if(r){var h=r.evaluate(t);a.setRotation(i,h)}if(s){var u=s.evaluate(t);a.setScale(i,u)}},t}(),B3={uint8:Uint8Array,uint16:Uint16Array};function N3(t){switch(t.BYTES_PER_ELEMENT){default:case 4:return x3.FLOAT_32;case 8:return x3.FLOAT_64}}!function(t){t[t.FLOAT_32=0]="FLOAT_32",t[t.FLOAT_64=1]="FLOAT_64"}(x3||(x3={}));var L3,F3,k3,U3,G3=g3("cc.animation.QuantizedFloatArray")((c3=function(){function t(t,e,i,n){void 0===n&&(n=0),this.originalPrecision=_3&&_3(),this.min=d3&&d3(),this.extent=f3&&f3(),this.values=p3&&p3(),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+" "+S3(e)+" "+S3(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}(),_3=Gs(c3.prototype,"originalPrecision",[v3],null),d3=Gs(c3.prototype,"min",[v3],null),f3=Gs(c3.prototype,"extent",[v3],null),p3=Gs(c3.prototype,"values",[v3],null),l3=c3))||l3;function H3(t,e){return t.values[e]/(1<<t.values.BYTES_PER_ELEMENT)*t.extent+t.min}function z3(t,e,i,n,r,s){var a=new g1;a.path=(new m1).toHierarchy(n).toProperty(r);var o=s(a);return o?{runtimeBinding:o,evaluator:new D3(t,e,i)}:null}function V3(t,e,i){hn.set(i,H3(t,3*e+0),H3(t,3*e+1),H3(t,3*e+2))}function W3(t,e,i){En.set(i,H3(t,4*e+0),H3(t,4*e+1),H3(t,4*e+2),H3(t,4*e+3))}var X3,j3,Y3,K3,q3,Q3,Z3,J3,$3,t5,e5,i5,n5,r5,s5,a5,o5,h5,u5,l5=qs("cc.animation.AuxiliaryCurveEntry")((F3=function(){this.name=k3&&k3(),this.curve=U3&&U3()},k3=Gs(F3.prototype,"name",[ra],(function(){return""})),U3=Gs(F3.prototype,"curve",[ra],(function(){return new rh})),L3=F3))||L3;function c5(t,e,i){for(var n=t.components,r=n.length,s=0;s<r;++s){var a=n[s],o=a[e];"function"==typeof o&&o.apply(a,i)}}var _5=Symbol("SearchForRootBonePath"),d5=Symbol("ExoticAnimation"),f5=Symbol("[[EmbeddedPlayerCount]]"),p5=Symbol("[[GetEmbeddedPlayers]]"),m5=Symbol("[[AddEmbeddedPlayer]]"),g5=Symbol("[[RemoveEmbeddedPlayer]]"),v5=Symbol("[[ClearEmbeddedPlayers]]"),y5=Symbol("[[Additive Settings]]"),T5=t("an",qs("cc.AnimationClip")(((s5=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=Y3&&Y3(),e.speed=K3&&K3(),e.wrapMode=q3&&q3(),e.enableTrsBlending=Q3&&Q3(),e._duration=Z3&&Z3(),e._hash=J3&&J3(),e.frameRate=0,e._tracks=$3&&$3(),e._exoticAnimation=t5&&t5(),e._legacyData=void 0,e._legacyDataDirty=!1,e._events=e5&&e5(),e._embeddedPlayers=i5&&i5(),e._additiveSettings=n5&&n5(),e._auxiliaryCurveEntries=r5&&r5(),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 C2;return s.path=(new m1).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 D5(t,this._runtimeEvents.ratios,this._runtimeEvents.eventGroups,this.wrapMode)},i.containsAnyEmbeddedPlayer=function(){return 0!==this._embeddedPlayers.length},i.createEmbeddedPlayerEvaluator=function(t){return new A5(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=v.director.root)&&void 0!==e&&e.dataPoolManager&&v.director.root.dataPoolManager.releaseAnimationClip(this),PZ.destroy(this),t.prototype.destroy.call(this)},i[MZ]=function(t,e,i){for(var n=1/e,r=this._collectAnimatedJoints(),s=r.length,a={},o=0;o<s;++o)a[r[o]]={transforms:Array.from({length:i},(function(){return new Dn}))};var h=r.reduce((function(t,e){return t[e]=new C5,t}),{});for(var u in h){var l=h[u],c=u.lastIndexOf("/");if(c>=0){var _=u.substring(0,c),d=h[_];d&&(l.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 O5(i,e.property)}}),void 0),p=0;p<i;++p){var m=t+n*p;f.evaluate(m);for(var g=0;g<s;++g){var v=r[g];Dn.copy(a[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:a}},i.upgradeUntypedTracks=function(t){for(var e=[],i=[],n=this._tracks,r=n.length,s=0;s<r;++s){var a=n[s];if(a instanceof G2){var o=a.upgrade(t);o&&(e.push(o),i.push(a))}}for(var h=i.length,u=0;u<h;++u)ue(n,i[u]);n.push.apply(n,e)},i[_5]=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[p5]=function(){return this._embeddedPlayers},i[m5]=function(t){this._embeddedPlayers.push(t)},i[g5]=function(t){var e=this._embeddedPlayers.indexOf(t);e>=0&&this._embeddedPlayers.splice(e,1)},i[v5]=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 l5).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){ce(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,a=[],o=this._tracks,h=o.length,u=0;u<h;++u){var l=o[u];if(!r.includes(l)&&!Array.from(l.channels()).every((function(t){return 0===t.curve.keyFramesCount}))){var c=e(l[p1]);if(c){var _=void 0;if(l instanceof G2){if(!c.getValue){Z(3930);continue}var d=c.getValue();_=l.createLegacyEval(d)}else _=l[E0]();a.push(new E5(c,_))}}}return this._exoticAnimation&&(s=this._exoticAnimation.createEvaluator(e)),new R5(a,s,n)},i._createRootMotionEvaluation=function(t,e,i){if(t instanceof $m){var n=this._searchForRootBonePath();if(n){var r=t.getChildByPath(n);if(r){for(var s=new b5,a=[],o=this._tracks,h=o.length,u=0;u<h;++u){var l=o[u],c=l[p1].parseTrsPath();if(c&&c.node===n){i.push(l);var _=O5(s,c.property);if(_){var d=l[E0]();a.push(new E5(_,d))}}}return new x5(r,this._duration,s,a)}q(3924)}else q(3923)}else Z(3920)},i._searchForRootBonePath=function(){var t=this._tracks.map((function(t){var e=t[p1].parseTrsPath();if(e){var i=e.node;return{path:i,rank:i.split("/").length}}return{path:"",rank:0}}));t.sort((function(t,e){return t.rank-e.rank}));var e=t.findIndex((function(t){return 0!==t.rank}));if(e<0)return"";for(var i=t.length,n=t[e],r=!0,s=e+1;s<i;++s){var a=t[s];if(a.rank!==n.rank)break;if(a.path!==n.path){r=!1;break}}return r?n.path:""},i._getLegacyData=function(){return this._legacyData||(this._legacyData=this._toLegacy()),this._legacyData},i._toLegacy=function(){var t=new H2(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][p1].parseTrsPath();r&&t.add(r.node)}if(this._exoticAnimation)for(var s=this._exoticAnimation.collectAnimatedJoints(),a=s.length,o=0;o<a;++o)t.add(s[o]);return Array.from(t)},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=Bl(i,666)}},{key:"events",get:function(){return this._events},set:function(t){var e=this;this._events=t;for(var i=[],n=[],r=this.events.sort((function(t,e){return t.frame-e.frame})),s=r.length,a=function(){var t=r[o],s=t.frame/e._duration,a=i.findIndex((function(t){return t===s}));a<0&&(a=i.length,i.push(s),n.push({events:[]})),n[a].events.push({functionName:t.func,parameters:t.params})},o=0;o<s;++o)a();this._runtimeEvents={ratios:i,eventGroups:n}}},{key:d5,get:function(){return this._exoticAnimation}},{key:d5,set:function(t){this._exoticAnimation=t}},{key:"isAdditive_experimental",get:function(){return this._additiveSettings.enabled}},{key:y5,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:f5,get:function(){return this._embeddedPlayers.length}},{key:"auxiliaryCurveCount_experimental",get:function(){return this._auxiliaryCurveEntries.length}}]),e}(uf)).WrapMode=A0,Y3=Gs((j3=s5).prototype,"sample",[ra],(function(){return 60})),K3=Gs(j3.prototype,"speed",[ra],(function(){return 1})),q3=Gs(j3.prototype,"wrapMode",[ra],(function(){return A0.Normal})),Q3=Gs(j3.prototype,"enableTrsBlending",[ra],(function(){return!1})),Z3=Gs(j3.prototype,"_duration",[ra],(function(){return 0})),J3=Gs(j3.prototype,"_hash",[ra],(function(){return 0})),$3=Gs(j3.prototype,"_tracks",[ra],(function(){return[]})),t5=Gs(j3.prototype,"_exoticAnimation",[ra],(function(){return null})),e5=Gs(j3.prototype,"_events",[ra],(function(){return[]})),i5=Gs(j3.prototype,"_embeddedPlayers",[ra],(function(){return[]})),n5=Gs(j3.prototype,"_additiveSettings",[ra],(function(){return new S5})),r5=Gs(j3.prototype,"_auxiliaryCurveEntries",[ra],(function(){return[]})),X3=j3))||X3),S5=qs("cc.AnimationClipAdditiveSettings")((o5=function(){this.enabled=h5&&h5(),this.refClip=u5&&u5()},h5=Gs(o5.prototype,"enabled",[ra],(function(){return!1})),u5=Gs(o5.prototype,"refClip",[ra],(function(){return null})),a5=o5))||a5;v.AnimationClip=T5;var E5=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}(),A5=function(){function t(t,e){this._embeddedPlayers=t,this._embeddedPlayerEvaluationInfos=t.map((function(t){var i=t.playable;if(!i)return null;var n=i.instantiate(e);return n?{instantiatedPlayer:n,entered:!1,hostPauseTime:0,lastIterations:0}:null}))}var e=t.prototype;return e.destroy=function(){for(var t=this._embeddedPlayerEvaluationInfos,e=t.length,i=0;i<e;++i){var n;null===(n=t[i])||void 0===n||n.instantiatedPlayer.destroy()}this._embeddedPlayerEvaluationInfos.length=0},e.evaluate=function(t,e){for(var i=this._embeddedPlayers,n=this._embeddedPlayerEvaluationInfos,r=i.length,s=0;s<r;++s){var a=n[s];if(a){var o=a.entered,h=a.instantiatedPlayer,u=a.lastIterations,l=i[s],c=l.begin,_=l.end;if(t>=c&&t<=_?o?e!==u&&(h.stop(),h.play(),a.entered=!0):(h.play(),a.entered=!0):o&&(h.stop(),a.entered=!1),a.lastIterations=e,a.entered){var d=t-c;a.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 a=s.instantiatedPlayer;e[r].reconciledSpeed&&a.setSpeed(t)}}},e.notifyHostPlay=function(t){for(var e=this._embeddedPlayers,i=this._embeddedPlayerEvaluationInfos,n=e.length,r=0;r<n;++r){var s=i[r];if(s){var a=e[r],o=a.begin,h=a.end,u=s.instantiatedPlayer;if(s.entered){var l=s.hostPauseTime;if(u.randomAccess||xi(l,t,1e-5)){var c=Ii(t,o,h);u.play(),u.setTime(c-o)}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 a=s.instantiatedPlayer;s.entered&&(a.pause(),s.hostPauseTime=t)}}},e.notifyHostStop=function(){for(var t=this._embeddedPlayers,e=this._embeddedPlayerEvaluationInfos,i=t.length,n=0;n<i;++n){var r=e[n];if(r){var s=r.instantiatedPlayer;r.entered&&(r.entered=!1,s.stop())}}},t}(),R5=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}(),b5=function(){function t(){this.position=new hn,this.scale=new hn(1,1,1),this.rotation=new En,this.eulerAngles=new hn}return t.prototype.getTransform=function(t){Dn.fromRTS(t,this.rotation,this.position,this.scale)},t}(),C5=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 Dn,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,Dn.fromRTS(t,this.rotation,this.position,this.scale),this.parent&&Dn.multiply(t,this.parent.globalTransform,t)),this._transform}}]),e}(b5),w5=new Dn,x5=function(){function t(t,e,i,n){this._initialTransformCache=new Dn,this._clipEndTransformCache=new Dn,this._startTransformCache=new Dn,this._endTransformCache=new Dn,this._motionTransformCache=new Dn,this._translationMotionCache=new hn,this._rotationMotionCache=new En,this._scaleMotionCache=new hn,this._rootBone=t,this._duration=e,this._boneTransform=i,this._trackEvalStatuses=n}var e=t.prototype;return e.evaluate=function(t,e){var i=this._calcMotionTransform(t,e,this._motionTransformCache),n=this._translationMotionCache,r=this._rotationMotionCache,s=this._scaleMotionCache,a=this._rootBone;Dn.toRTS(i,r,n,s),hn.add(n,n,a.position),a.setPosition(n),En.multiply(r,r,a.rotation),a.setRotation(r),hn.multiply(s,s,a.scale),a.setScale(s)},e._calcMotionTransform=function(t,e,i){var n=this._duration,r=n-t,s=this._evaluateAt(t,this._startTransformCache);if(e<r){var a=this._evaluateAt(t+e,this._endTransformCache);I5(i,s,a)}else{Dn.identity(i);var o=function(t,e){I5(w5,t,e),Dn.multiply(i,i,w5)},h=e-r,u=Math.floor(h/n),l=h-u*n,c=this._evaluateAt(0,this._initialTransformCache),_=this._evaluateAt(n,this._clipEndTransformCache),d=this._evaluateAt(l,this._endTransformCache);o(s,_),I5(w5,c,_);for(var f=0;f<u;++f)Dn.multiply(i,i,w5);o(c,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 I5(t,e,i){Dn.invert(t,e),Dn.multiply(t,i,t)}function O5(t,e){switch(e){default:return;case"position":return{setValue:function(e){hn.copy(t.position,e)}};case"rotation":return{setValue:function(e){En.copy(t.rotation,e)}};case"scale":return{setValue:function(e){hn.copy(t.scale,e)}};case"eulerAngles":return{setValue:function(e){hn.copy(t.eulerAngles,e)}}}}var D5=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=P5(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=P5(t,this._ratios);if(r<0&&(r=~r-1,e<0&&(r+=1)),this._ignoreIndex!==r&&(this._ignoreIndex=-1),!this._sampled)return this._sampled=!0,this._doFire(r,!1),this._lastFrameIndex=r,this._lastIterations=i,void(this._lastDirection=e);var s=this._wrapMode,a=M5(i),o=M5(this._lastIterations),h=this._lastFrameIndex,u=this._lastDirection,l=-1!==o&&a!==o;if(h===r&&l&&1===n)this._doFire(0,!1);else if(h!==r||l){e=u;do{if(h!==r){if(-1===e&&0===h&&r>0?((s&ou.PingPong)===ou.PingPong?e*=-1:h=n,o++):1===e&&h===n-1&&r<n-1&&((s&ou.PingPong)===ou.PingPong?e*=-1:h=-1,o++),h===r)break;if(o>a)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?O0().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];c5(this._targetNode,s.functionName,s.parameters)}}},t}();function M5(t){return t-(0|t)==0&&(t-=1),0|t}function P5(t,e){return Bs(e,t)}var B5,N5=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 L5(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}(),L5=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"}(B5||(B5={})),B5.POSITION,B5.ROTATION,B5.SCALE,B5.EULER_ANGLES;var F5,k5,U5=function(){function t(){this.refCount=0,this.accumulatedWeight=0,this.result=new hn}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 a=r/s;hn.lerp(t,t,n,a)}}else hn.copy(t,n);return s}(this.result,this.result,this.accumulatedWeight,t,e)},e.reset=function(){this.accumulatedWeight=0,hn.zero(this.result)},t}(),G5=function(){function t(){this.refCount=0,this.accumulatedWeight=0,this.result=new En}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 a=r/s;En.slerp(t,e,n,a)}}else En.copy(t,n);return s}(this.result,this.result,this.accumulatedWeight,t,e)},e.reset=function(){this.accumulatedWeight=0,En.identity(this.result)},t}(),H5=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,a=i.eulerAngles;n&&n.accumulatedWeight&&(this._transformApplyFlags|=B5.POSITION,n.accumulatedWeight<1&&n.blend(e.position,1-n.accumulatedWeight)),r&&r.accumulatedWeight&&(this._transformApplyFlags|=B5.SCALE,r.accumulatedWeight<1&&r.blend(e.scale,1-r.accumulatedWeight)),a&&a.accumulatedWeight&&(this._transformApplyFlags|=B5.EULER_ANGLES,a.accumulatedWeight<1&&a.blend(e.eulerAngles,1-a.accumulatedWeight)),s&&s.accumulatedWeight&&(this._transformApplyFlags|=B5.ROTATION,s.accumulatedWeight<1&&s.blend(e.rotation,1-s.accumulatedWeight)),t.prototype.apply.call(this,e),null==n||n.reset(),null==r||r.reset(),null==s||s.reset(),null==a||a.reset()},i._createVec3BlendState=function(){return new U5},i._createQuatBlendState=function(){return new G5},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,a=s.position,o=s.scale,h=s.rotation,u=s.eulerAngles;r&&(a&&r&B5.POSITION&&(e=a.result),o&&r&B5.SCALE&&(i=o.result),u&&r&B5.EULER_ANGLES&&(n=u.result),h&&r&B5.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}()),z5=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.createNodeBlendState=function(){return new H5},e}(N5),V5=t("av",qs(((k5=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 ae([]),e._crossFades=new ae([]),e._delayEvents=[],e._blendStateBuffer=new z5,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,a=s.array;for(s.i=0;s.i<a.length;++s.i){var o=a[s.i];o.isMotionless||o.update(t)}this._blendStateBuffer.apply();for(var h=gL.getTotalFrames(),u=0,l=n.length;u<l;u++){var c=n[u],_=c.target,d=c.transform;_.matrix=qZ(d,h)}for(var f=0,p=e.length;f<p;f++){var m=e[f];m.fn.apply(m.thisArg,m.args)}e.length=0},i.destruct=function(){},i.addAnimation=function(t){-1===this._anims.array.indexOf(t)&&this._anims.push(t)},i.removeAnimation=function(t){var e=this._anims.array.indexOf(t);e>=0?this._anims.fastRemoveAt(e):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),a=n.target&&s&&QZ(s,t);a&&i._sockets.push({target:n.target,transform:a})},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){ZZ(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}(Lu)).ID="animation",F5=k5))||F5);gL.on(mL.EVENT_INIT,(function(){var t=new V5;gL.registerSystem(V5.ID,t,Lu.Priority.HIGH)})),v.AnimationManager=V5;var W5,X5,j5,Y5,K5,q5,Q5,Z5,J5,$5,t4,e4,i4,n4,r4=function(t){function e(e){var i;return(i=t.call(this)||this)._managedStates=[],i._fadings=[],i._scheduled=!1,i._scheduler=null!=e?e:O0(),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,a=i.length,o=0;o<i.length;++o){var h=i[o];h.easeTime+=t;var u=0===h.easeDuration?1:Oi(h.easeTime/h.easeDuration),l=u*s;if(s*=1-u,h.target.state&&(h.target.state.weight+=l),h.easeTime>=h.easeDuration){a=o+1,h.easeTime=h.easeDuration;break}}if(a!==i.length){for(var c=a;c<i.length;++c){var _=i[c];--_.target.reference,_.target.reference<=0&&(_.target.state&&_.target.state.stop(),ue(this._managedStates,_.target))}i.splice(a)}},i._scheduleThis=function(){this._scheduled||(this._scheduler.addCrossFade(this),this._scheduled=!0)},i._unscheduleThis=function(){this._scheduled&&(this._scheduler.removeCrossFade(this),this._scheduled=!1)},e}(C0),s4=t("ap",(W5=qs("cc.Animation"),X5=Zs(99),j5=xa([T5]),Y5=xa(T5),K5=xa([T5]),W5(q5=X5(((t4=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=Z5&&Z5(),e._crossFade=new r4,e._nameToState=Ot(!0),e._clips=J5&&J5(),e._defaultClip=$5&&$5(),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=Ot(!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===w0.LASTFRAME&&this._syncAllowLastFrameEvent(),s},i.once=function(e,i,n){var r=t.prototype.once.call(this,e,i,n);return e===w0.LASTFRAME&&this._syncAllowLastFrameEvent(),r},i.off=function(e,i,n){t.prototype.off.call(this,e,i,n),e===w0.LASTFRAME&&this._syncDisallowLastFrameEvent()},i._createState=function(t,e){return new B0(t,e)},i._doCreateState=function(t,e){var i=this._createState(t,e);return i._setEventTarget(this),i.allowLastFrameEvent(this.hasEventListener(w0.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];a4(t,i.clip)&&(i.stop(),delete this._nameToState[e])}},i._syncAllowLastFrameEvent=function(){if(this.hasEventListener(w0.LASTFRAME))for(var t in this._nameToState)this._nameToState[t].allowLastFrameEvent(!0)},i._syncDisallowLastFrameEvent=function(){if(!this.hasEventListener(w0.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,a=d(t);!(s=a()).done;){var o=s.value;o&&this.createState(o)}var h=t.find((function(t){return a4(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 a4(e,t)}))>=0||(this._clips.push(t),this.createState(t)))}}]),e}(Zu(op))).EventType=w0,f((Q5=t4).prototype,"clips",[j5],Object.getOwnPropertyDescriptor(Q5.prototype,"clips"),Q5.prototype),f(Q5.prototype,"defaultClip",[Y5],Object.getOwnPropertyDescriptor(Q5.prototype,"defaultClip"),Q5.prototype),Z5=Gs(Q5.prototype,"playOnLoad",[ra],(function(){return!1})),J5=Gs(Q5.prototype,"_clips",[K5],(function(){return[]})),$5=Gs(Q5.prototype,"_defaultClip",[ra],(function(){return null})),q5=Q5))||q5)||q5));function a4(t,e){return t===e||!!t&&!!e&&t._uuid===e._uuid&&t._uuid}v.Animation=s4,v.AnimationComponent=s4,Jt(s4,"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"}(e4||(e4={})),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"}(i4||(i4={})),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"}(n4||(n4={}));var o4,h4=t("aA",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}()),u4=0;function l4(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 a=i[s];if("stop"===a.op){n.push(a);break}if("seek"===a.op)r||(n.push(a),r=!0);else{if(r){n.push(a);break}0===n.length&&n.push(a)}}t._operationQueue=n.reverse()}(t);var i=t._operationQueue[0];i&&l4(t,i)})).catch((function(){})))}function c4(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=u4++,a=t;a._operationQueue.push({op:e,id:s,func:n,args:r,invoking:!1}),a._eventTarget.once(s.toString(),i),l4(a,a._operationQueue[0])}))}}function _4(t){return new Promise((function(e){var i=t.play();return void 0===i?e():(i.then(e).catch((function(){var i=function i(){t.play().then((function(){null==n||n.removeEventListener("touchend",i,{capture:!0}),null==n||n.removeEventListener("mouseup",i,{capture:!0})})).catch((function(){})),e()},n=document.getElementById("GameCanvas");null==n||n.addEventListener("touchend",i,{capture:!0}),null==n||n.addEventListener("mouseup",i,{capture:!0})})),null)}))}var d4,f4,p4=function(){function t(t,e){this._domAudio=void 0,this._onPlayCb=void 0,this._onEndCb=void 0,this._domAudio=t,t.volume=e}var e=t.prototype;return e.play=function(){var t=this;_4(this._domAudio).then((function(){var e;null===(e=t.onPlay)||void 0===e||e.call(t)})).catch((function(){}))},e.stop=function(){this._domAudio.pause()},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&&this._domAudio.removeEventListener("ended",this._onEndCb),this._onEndCb=t,t&&this._domAudio.addEventListener("ended",t)}}]),t}(),m4=(f((o4=function(){function t(t){var e=this;this._domAudio=void 0,this._state=n4.INIT,this._onEnded=void 0,this._eventTarget=new Ju,this._operationQueue=[],this._domAudio=t,AL.on(EL.EVENT_PAUSE,this._onInterruptedBegin,this),AL.on(EL.EVENT_RESUME,this._onInterruptedEnd,this),this._onEnded=function(){e.seek(0).catch((function(){})),e._state=n4.INIT,e._eventTarget.emit(e4.ENDED)},this._domAudio.addEventListener("ended",this._onEnded)}var e=t.prototype;return e.destroy=function(){AL.off(EL.EVENT_PAUSE,this._onInterruptedBegin,this),AL.off(EL.EVENT_RESUME,this._onInterruptedEnd,this),this._domAudio.removeEventListener("ended",this._onEnded),this._domAudio=null},t.load=function(e){return new Promise((function(i){t.loadNative(e).then((function(e){i(new t(e))})).catch((function(){}))}))},t.loadNative=function(t){return new Promise((function(e,i){var n=document.createElement("audio"),r="canplaythrough";al.os===il.IOS?r="loadedmetadata":al.browserType===$u.FIREFOX&&(r="canplay");var s=setTimeout((function(){0===n.readyState?h():o()}),8e3),a=function(){clearTimeout(s),n.removeEventListener(r,o,!1),n.removeEventListener("error",h,!1)},o=function(){a(),e(n)},h=function(){a(),i("load audio failure - "+t)};n.addEventListener(r,o,!1),n.addEventListener("error",h,!1),n.src=t}))},t.loadOneShotAudio=function(e,i){return new Promise((function(n,r){t.loadNative(e).then((function(t){var e=new p4(t,i);n(e)})).catch(r)}))},e._onInterruptedBegin=function(){var t=this;this._state===n4.PLAYING&&this.pause().then((function(){t._state=n4.INTERRUPTED,t._eventTarget.emit(e4.INTERRUPTION_BEGIN)})).catch((function(){}))},e._onInterruptedEnd=function(){var t=this;this._state===n4.INTERRUPTED&&this.play().then((function(){t._eventTarget.emit(e4.INTERRUPTION_END)})).catch((function(){}))},e.getPCMData=function(){},e.seek=function(t){return t=Ii(t,0,this.duration),this._domAudio.currentTime=t,Promise.resolve()},e.play=function(){var t=this;return new Promise((function(e){_4(t._domAudio).then((function(){t._state=n4.PLAYING,e()})).catch((function(){}))}))},e.pause=function(){return this._domAudio.pause(),this._state=n4.PAUSED,Promise.resolve()},e.stop=function(){var t=this;return new Promise((function(e){t._domAudio.pause(),t._domAudio.currentTime=0,t._state=n4.STOPPED,e()}))},e.onInterruptionBegin=function(t){this._eventTarget.on(e4.INTERRUPTION_BEGIN,t)},e.offInterruptionBegin=function(t){this._eventTarget.off(e4.INTERRUPTION_BEGIN,t)},e.onInterruptionEnd=function(t){this._eventTarget.on(e4.INTERRUPTION_END,t)},e.offInterruptionEnd=function(t){this._eventTarget.off(e4.INTERRUPTION_END,t)},e.onEnded=function(t){this._eventTarget.on(e4.ENDED,t)},e.offEnded=function(t){this._eventTarget.off(e4.ENDED,t)},n(t,[{key:"src",get:function(){return this._domAudio?this._domAudio.src:""}},{key:"type",get:function(){return i4.DOM_AUDIO}},{key:"state",get:function(){return this._state}},{key:"loop",get:function(){return this._domAudio.loop},set:function(t){this._domAudio.loop=t}},{key:"volume",get:function(){return this._domAudio.volume},set:function(t){t=Oi(t),this._domAudio.volume=t}},{key:"duration",get:function(){return this._domAudio.duration}},{key:"currentTime",get:function(){return this._domAudio.currentTime}},{key:"sampleRate",get:function(){return 0}}]),t}()).prototype,"seek",[c4],Object.getOwnPropertyDescriptor(o4.prototype,"seek"),o4.prototype),f(o4.prototype,"play",[c4],Object.getOwnPropertyDescriptor(o4.prototype,"play"),o4.prototype),f(o4.prototype,"pause",[c4],Object.getOwnPropertyDescriptor(o4.prototype,"pause"),o4.prototype),f(o4.prototype,"stop",[c4],Object.getOwnPropertyDescriptor(o4.prototype,"stop"),o4.prototype),o4),g4=function(){function t(t){this._nativeAudio=void 0,this._startTime=0,this._startOffset=0,this._isPaused=!0,this._nativeAudio=t}var e=t.prototype;return e.destroy=function(){this._nativeAudio=void 0},e._now=function(){return performance.now()/1e3},e._calculateCurrentTime=function(){var t=this._now()-this._startTime,e=this._startOffset+t;return e>=this.duration&&(this._startTime=this._now(),this._startOffset=0),e%this.duration},e.start=function(){this._isPaused=!1,this._startTime=this._now()},e.pause=function(){this._isPaused||(this._isPaused=!0,this._startOffset=this._calculateCurrentTime())},e.stop=function(){this._isPaused=!0,this._startOffset=0},e.seek=function(t){this._startTime=this._now(),this._startOffset=Ii(t,0,this.duration)},n(t,[{key:"duration",get:function(){return this._nativeAudio.duration}},{key:"currentTime",get:function(){return this._isPaused?this._startOffset:this._calculateCurrentTime()}}]),t}(),v4=new(function(){function t(){this._audioBufferDataMap={}}var e=t.prototype;return e.addCache=function(t,e){this._audioBufferDataMap[t]?console.warn("Audio buffer "+t+" has been cached"):this._audioBufferDataMap[t]={usedCount:1,audioBuffer:e}},e.retainCache=function(t){var e=this._audioBufferDataMap[t];e?e.usedCount++:console.warn("Audio buffer cache "+t+" has not been added.")},e.getCache=function(t){var e=this._audioBufferDataMap[t];return null==e?void 0:e.audioBuffer},e.tryReleasingCache=function(t){var e=this._audioBufferDataMap[t];e?--e.usedCount<=0&&delete this._audioBufferDataMap[t]:console.warn("Audio buffer cache "+t+" has not been added.")},t}()),y4=window.AudioContext||window.webkitAudioContext||window.mozAudioContext,T4="on-context-running",S4=function(){function t(){var t=this;this._eventTarget=void 0,this._context=void 0,this._isRunning=!1,this._context=new(window.AudioContext||window.webkitAudioContext||window.mozAudioContext),this._eventTarget=new Ju,this._context.onstatechange=function(){"running"===t._context.state?(t._isRunning=!0,t._eventTarget.emit(T4)):t._isRunning=!1}}var e=t.prototype;return e.onceRunning=function(t,e){this._eventTarget.once(T4,t,e)},e.offRunning=function(t,e){this._eventTarget.off(T4,t,e)},e.decodeAudioData=function(t){var e=this;return new Promise((function(i){var n=e._context.decodeAudioData(t,(function(t){i(t)}),(function(t){console.error("failed to load Web Audio",t)}));null==n||n.catch((function(t){U("decodeAudioData error",t)}))}))},e.runContext=function(){var t=this;return new Promise((function(e){if(t.isRunning)e();else{var i=t._context;if(i.resume)if(i.resume().catch((function(t){U("runContext error",t)})),"running"!==i.state){var n=document.getElementById("GameCanvas"),r=function t(){i.resume().then((function(){null==n||n.removeEventListener("touchend",t,{capture:!0}),null==n||n.removeEventListener("mouseup",t,{capture:!0}),e()})).catch((function(t){U("onGesture resume error",t)}))};null==n||n.addEventListener("touchend",r,{capture:!0}),null==n||n.addEventListener("mouseup",r,{capture:!0})}else e();else e()}}))},e.createBufferSource=function(t,e){var i=this._context.createBufferSource();return void 0!==t&&(i.buffer=t),void 0!==e&&(i.loop=e),i},e.createGain=function(t){void 0===t&&(t=1);var e=this._context.createGain();return this.setGainValue(e,t),e},e.setGainValue=function(t,e){if(t.gain.setTargetAtTime)try{t.gain.setTargetAtTime(e,this._context.currentTime,0)}catch(i){t.gain.setTargetAtTime(e,this._context.currentTime,.01)}else t.gain.value=e},e.connectContext=function(t){this._context&&t.connect(this._context.destination)},n(t,[{key:"isRunning",get:function(){return this._isRunning}},{key:"currentTime",get:function(){return this._context.currentTime}}]),t}();S4.support=!!y4,S4.support&&(f4=new S4);var E4,A4,R4,b4,C4=function(){function t(t,e,i){this._duration=void 0,this._bufferSourceNode=void 0,this._onPlayCb=void 0,this._currentTimer=0,this._url=void 0,this._onEndCb=void 0,this._duration=t.duration,this._url=i,this._bufferSourceNode=f4.createBufferSource(t,!1);var n=f4.createGain(e);this._bufferSourceNode.connect(n),f4.connectContext(n)}var e=t.prototype;return e.play=function(){var t=this;this._bufferSourceNode.start(),f4.runContext().then((function(){var e;null===(e=t.onPlay)||void 0===e||e.call(t),t._currentTimer=window.setTimeout((function(){var e;v4.tryReleasingCache(t._url),null===(e=t.onEnd)||void 0===e||e.call(t)}),1e3*t._duration)})).catch((function(t){U("play error",t)}))},e.stop=function(){clearTimeout(this._currentTimer),v4.tryReleasingCache(this._url),this._bufferSourceNode.stop(),this._bufferSourceNode.disconnect(),this._bufferSourceNode.buffer=null},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}(),w4=(f((d4=function(){function t(t,e){this._src=void 0,this._audioBuffer=void 0,this._sourceNode=void 0,this._gainNode=void 0,this._currentTimer=0,this._volume=1,this._loop=!1,this._state=n4.INIT,this._audioTimer=void 0,this._runningCallback=void 0,this._eventTarget=new Ju,this._operationQueue=[],this._audioBuffer=t,this._audioTimer=new g4(t),this._gainNode=f4.createGain(),f4.connectContext(this._gainNode),this._src=e,AL.on(EL.EVENT_PAUSE,this._onInterruptedBegin,this),AL.on(EL.EVENT_RESUME,this._onInterruptedEnd,this)}var e=t.prototype;return e.destroy=function(){window.clearTimeout(this._currentTimer),this._audioTimer.destroy(),this._audioBuffer&&(this._audioBuffer=null),v4.tryReleasingCache(this._src),AL.off(EL.EVENT_PAUSE,this._onInterruptedBegin,this),AL.off(EL.EVENT_RESUME,this._onInterruptedEnd,this),this.offRunning()},t.load=function(e){return new Promise((function(i){t.loadNative(e).then((function(n){i(new t(n,e))})).catch((function(t){U("load error",e,t)}))}))},t.loadNative=function(t){return new Promise((function(e,i){var n=v4.getCache(t);if(n)return v4.retainCache(t),void e(n);var r=new XMLHttpRequest,s="load audio failed: "+t+", status: ";r.open("GET",t,!0),r.responseType="arraybuffer",r.onload=function(){200===r.status||0===r.status?f4.decodeAudioData(r.response).then((function(i){v4.addCache(t,i),e(i)})).catch((function(e){U("loadNative error",t,e)})):i(new Error(""+s+r.status+"(no response)"))},r.onerror=function(){i(new Error(""+s+r.status+"(error)"))},r.ontimeout=function(){i(new Error(""+s+r.status+"(time out)"))},r.onabort=function(){i(new Error(""+s+r.status+"(abort)"))},r.send(null)}))},t.loadOneShotAudio=function(e,i){return new Promise((function(n,r){t.loadNative(e).then((function(t){var r=new C4(t,i,e);n(r)})).catch(r)}))},e.getPCMData=function(t){return new h4(this._audioBuffer.getChannelData(t),1)},e._onInterruptedBegin=function(){var t=this;this._state===n4.PLAYING&&this.pause().then((function(){t._state=n4.INTERRUPTED,t._eventTarget.emit(e4.INTERRUPTION_BEGIN)})).catch((function(t){U("_onInterruptedBegin error",t)}))},e._onInterruptedEnd=function(){var t=this;this._state===n4.INTERRUPTED&&this.play().then((function(){t._eventTarget.emit(e4.INTERRUPTION_END)})).catch((function(t){U("_onInterruptedEnd error",t)}))},e.offRunning=function(){this._runningCallback&&(f4.offRunning(this._runningCallback),this._runningCallback=void 0)},e.seek=function(t){var e=this;return new Promise((function(i){e.offRunning(),e._audioTimer.seek(t),e._state===n4.PLAYING?e._doPlay().then(i).catch((function(t){U("seek error",t)})):i()}))},e.play=function(){return this.offRunning(),this._doPlay()},e._doPlay=function(){var t=this;return new Promise((function(e){f4.isRunning?(t._startSourceNode(),e()):(t.offRunning(),t._runningCallback=function(){t._startSourceNode(),e()},f4.onceRunning(t._runningCallback),f4.runContext().catch((function(t){U("doPlay error",t)})))}))},e._startSourceNode=function(){var t=this;this._stopSourceNode(),this._sourceNode=f4.createBufferSource(this._audioBuffer,this.loop),this._sourceNode.connect(this._gainNode),this._sourceNode.loop=this._loop,this._sourceNode.start(0,this._audioTimer.currentTime),this._state=n4.PLAYING,this._audioTimer.start(),window.clearTimeout(this._currentTimer),this._currentTimer=window.setTimeout((function e(){t.loop?t._currentTimer=window.setTimeout(e,1e3*t._audioBuffer.duration):(t._audioTimer.stop(),t._eventTarget.emit(e4.ENDED),t._state=n4.INIT)}),1e3*(this._audioBuffer.duration-this._audioTimer.currentTime))},e._stopSourceNode=function(){try{this._sourceNode&&(this._sourceNode.stop(),this._sourceNode.disconnect(),this._sourceNode.buffer=null,this._sourceNode=void 0)}catch(t){}},e.pause=function(){return this.offRunning(),this._state===n4.PLAYING&&this._sourceNode?(this._audioTimer.pause(),this._state=n4.PAUSED,window.clearTimeout(this._currentTimer),this._stopSourceNode(),Promise.resolve()):Promise.resolve()},e.stop=function(){return this.offRunning(),this._sourceNode?(this._audioTimer.stop(),this._state=n4.STOPPED,window.clearTimeout(this._currentTimer),this._stopSourceNode(),Promise.resolve()):(this._audioTimer.stop(),this._state=n4.STOPPED,Promise.resolve())},e.onInterruptionBegin=function(t){this._eventTarget.on(e4.INTERRUPTION_BEGIN,t)},e.offInterruptionBegin=function(t){this._eventTarget.off(e4.INTERRUPTION_BEGIN,t)},e.onInterruptionEnd=function(t){this._eventTarget.on(e4.INTERRUPTION_END,t)},e.offInterruptionEnd=function(t){this._eventTarget.off(e4.INTERRUPTION_END,t)},e.onEnded=function(t){this._eventTarget.on(e4.ENDED,t)},e.offEnded=function(t){this._eventTarget.off(e4.ENDED,t)},n(t,[{key:"sampleRate",get:function(){return this._audioBuffer.sampleRate}},{key:"src",get:function(){return this._src}},{key:"type",get:function(){return i4.WEB_AUDIO}},{key:"state",get:function(){return this._state}},{key:"loop",get:function(){return this._loop},set:function(t){this._loop=t,this._sourceNode&&(this._sourceNode.loop=t)}},{key:"volume",get:function(){return this._volume},set:function(t){t=Oi(t),this._volume=t,f4.setGainValue(this._gainNode,t)}},{key:"duration",get:function(){return this._audioBuffer.duration}},{key:"currentTime",get:function(){return this._audioTimer.currentTime}}]),t}()).prototype,"seek",[c4],Object.getOwnPropertyDescriptor(d4.prototype,"seek"),d4.prototype),f(d4.prototype,"play",[c4],Object.getOwnPropertyDescriptor(d4.prototype,"play"),d4.prototype),f(d4.prototype,"pause",[c4],Object.getOwnPropertyDescriptor(d4.prototype,"pause"),d4.prototype),f(d4.prototype,"stop",[c4],Object.getOwnPropertyDescriptor(d4.prototype,"stop"),d4.prototype),d4),x4=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}(),I4=function(){function t(t){this._player=void 0,this._player=t}t.load=function(e,i){return new Promise((function(n){(null==i?void 0:i.audioLoadMode)!==i4.DOM_AUDIO&&S4.support?w4.load(e).then((function(e){n(new t(e))})).catch((function(){})):(S4.support||q(5201),m4.load(e).then((function(e){n(new t(e))})).catch((function(){})))}))};var e=t.prototype;return e.destroy=function(){this._player.destroy()},t.loadNative=function(t,e){return(null==e?void 0:e.audioLoadMode)!==i4.DOM_AUDIO&&S4.support?w4.loadNative(t):(S4.support||q(5201),m4.loadNative(t))},t.loadOneShotAudio=function(t,e,i){return new Promise((function(n,r){(null==i?void 0:i.audioLoadMode)!==i4.DOM_AUDIO&&S4.support?w4.loadOneShotAudio(t,e).then((function(t){n(new x4(t))})).catch(r):(S4.support||q(5201),m4.loadOneShotAudio(t,e).then((function(t){n(new x4(t))})).catch(r))}))},e.getPCMData=function(t){return this._player.getPCMData(t)},e.seek=function(t){return this._player.seek(t)},e.play=function(){return this._player.play()},e.pause=function(){return this._player.pause()},e.stop=function(){return this._player.stop()},e.onInterruptionBegin=function(t){this._player.onInterruptionBegin(t)},e.offInterruptionBegin=function(t){this._player.offInterruptionBegin(t)},e.onInterruptionEnd=function(t){this._player.onInterruptionEnd(t)},e.offInterruptionEnd=function(t){this._player.offInterruptionEnd(t)},e.onEnded=function(t){this._player.onEnded(t)},e.offEnded=function(t){this._player.offEnded(t)},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}();I4.maxAudioChannel=24;var O4=t("az",qs("cc.AudioClip")(((b4=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._duration=R4&&R4(),e._loadMode=i4.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&&I4.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=i4.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:n4.INIT}}]),e}(uf)).AudioType=i4,R4=Gs((A4=b4).prototype,"_duration",[ra],(function(){return 0})),f(A4.prototype,"_nativeDep",[Ia],Object.getOwnPropertyDescriptor(A4.prototype,"_nativeDep"),A4.prototype),E4=A4))||E4);function D4(t,e,i){I4.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 M4(t,e,i,n){var r=new O4;r._nativeUrl=t,r._nativeAsset=e,r.duration=e.duration,n(null,r)}v.AudioClip=O4,CT.register({".mp3":D4,".ogg":D4,".wav":D4,".m4a":D4}),kT.register({".mp3":M4,".ogg":M4,".wav":M4,".m4a":M4});var P4,B4,N4,L4,F4,k4,U4,G4,H4,z4,V4,W4,X4=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 I4?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 I4?this._tryRemovePlaying(this._audioPlayerInfoList,t):this._tryRemovePlaying(this._oneShotAudioInfoList,t)},e.discardOnePlayingIfNeeded=function(){var t;this._audioPlayerInfoList.length+this._oneShotAudioInfoList.length<I4.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}()),j4="audiosource-loaded";!function(t){t.STARTED="started",t.ENDED="ended"}(V4||(V4={})),function(t){t.PLAY="play",t.STOP="stop",t.PAUSE="pause",t.SEEK="seek"}(W4||(W4={}));var Y4=t("ay",(P4=qs("cc.AudioSource"),B4=xa(O4),N4=xa(O4),P4(((z4=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=k4&&k4(),e._player=null,e._hasRegisterListener=!1,e._loop=U4&&U4(),e._playOnAwake=G4&&G4(),e._volume=H4&&H4(),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&&(X4.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,I4.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(j4)):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;X4.removePlaying(e),null===(i=t.node)||void 0===i||i.emit(V4.ENDED,t)})),e.onInterruptionBegin((function(){X4.removePlaying(e)})),e.onInterruptionEnd((function(){t._player===e&&X4.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 console.warn("Only support channel index 0 or 1 to get buffer"),void i(void 0);var n;e._player?i(e._player.getPCMData(t)):null===(n=e.node)||void 0===n||n.once(j4,(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(j4,(function(){e(t._player.sampleRate)}))}))},i._getRootNode=function(){for(var t,e,i=this.node,n=null===(t=i)||void 0===t||null===(e=t.parent)||void 0===e?void 0:e.parent;n;){var r,s,a;n=null===(s=i=null===(r=i)||void 0===r?void 0:r.parent)||void 0===s||null===(a=s.parent)||void 0===a?void 0:a.parent}return i},i.play=function(){var t=this;if(this._isLoaded||!this.clip){var e;this._registerListener(),X4.discardOnePlayingIfNeeded(),this.state===n4.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(V4.STARTED,t)})).catch((function(){X4.removePlaying(i)})),X4.addPlaying(i))}else this._operationsBeforeLoading.push({op:W4.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:W4.PAUSE,params:null})},i.stop=function(){this._isLoaded||!this.clip?this._player&&(this._player.stop().catch((function(){})),X4.removePlaying(this._player)):this._operationsBeforeLoading.push({op:W4.STOP,params:null})},i.playOneShot=function(t,e){var i;void 0===e&&(e=1),t._nativeAsset?I4.loadOneShotAudio(t._nativeAsset.url,this._volume*e,{audioLoadMode:t.loadMode}).then((function(t){i=t,X4.discardOnePlayingIfNeeded(),t.onEnd=function(){X4.removePlaying(t)},t.play(),X4.addPlaying(t)})).catch((function(){i&&X4.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===W4.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)?console.warn("illegal audio volume!"):(t=Ii(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)?console.warn("illegal audio time!"):(t=Ii(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:W4.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:n4.INIT}},{key:"playing",get:function(){return this.state===e.AudioState.PLAYING}}],[{key:"maxAudioChannel",get:function(){return I4.maxAudioChannel}}]),e}(op)).AudioState=n4,z4.EventType=V4,k4=Gs((F4=z4).prototype,"_clip",[B4],(function(){return null})),U4=Gs(F4.prototype,"_loop",[ra],(function(){return!1})),G4=Gs(F4.prototype,"_playOnAwake",[ra],(function(){return!0})),H4=Gs(F4.prototype,"_volume",[ra],(function(){return 1})),f(F4.prototype,"clip",[N4],Object.getOwnPropertyDescriptor(F4.prototype,"clip"),F4.prototype),L4=F4))||L4));function K4(t){for(var e=t.scene.batches,i=0;e&&i<e.length;i++){var n=e[i];if(t.visibility&n.visFlags)return!0}return!1}rt(O4,"AudioClip",[{name:"PlayingState",newName:"AudioState",target:Y4,targetName:"AudioSource"}]),at(O4.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"}}))),v.AudioSourceComponent=Y4,Jt(Y4,"cc.AudioSourceComponent"),v.log=k,v.warn=U,v.error=G,v.assert=H,v._throw=W,v.logID=Y,v.warnID=q,v.errorID=Z,v.assertID=tt,v.debug=ut,v.path={join:ll,extname:cl,mainFileName:_l,basename:dl,dirname:fl,changeExtname:pl,changeBasename:ml,_normalize:gl,stripSep:vl,get sep(){return yl()}};var q4=function(t,e,i,n,r){this.camera=void 0,this.id=4294967295,this.windowID=4294967295,this.width=0,this.height=0,this.camera=t,this.id=e,this.windowID=i,this.width=n,this.height=r},Q4=new Map,Z4=new Map;function J4(t){var e=Z4.get(t.window);return void 0===e&&(e=Z4.size,Z4.set(t.window,e)),e}function $4(t,e,i,n){var r=Q4.get(e);if(void 0!==r){var s=e.window.width,a=e.window.height;0===s&&(s=1),0===a&&(a=1);var o=J4(e);return r.width=s,r.height=a,r.windowID=o,n(t,r),r}var h=J4(e);return i(t,r=new q4(e,Q4.size,h,e.window.width?e.window.width:1,e.window.height?e.window.height:1)),Q4.set(e,r),r}function t8(t,e,i,n){var r=i,s=n,a=e,o=t.device;if(!t.containsResource(a)){var h=ey(o)?jl.R32F:jl.RGBA8;t.addRenderTarget(a,h,r,s,fx.MANAGED),t.addDepthStencil(a+"Depth",jl.DEPTH_STENCIL,r,s,fx.MANAGED)}t.updateRenderTarget(a,r,s),t.updateDepthStencil(a+"Depth",r,s)}var e8=new Yx;function i8(t,e){var i=e.camera;Hx(t,i);var n=t,r=n.pipelineSceneData.shadows,s=t.pipelineSceneData.validPunctualLights,a=t.pipelineSceneData.shadows;if(e8.reset(),!r.enabled||r.type!==MS.ShadowMap)return e8;e8.shadowEnabled=!0;for(var o=e8.validLights,h=0,u=0;h<r.maxReceived&&u<s.length;){var l=s[u];l.type===hx.SPOT&&l.shadowEnabled&&(o.push(l),h++),u++}var c=i.scene.mainLight,_=a.size.x,d=a.size.y;if(c&&c.shadowEnabled)if(e8.mainLightShadowNames[0]="MainLightShadow"+e.id,c.shadowFixedArea)t8(t,e8.mainLightShadowNames[0],_,d);else{var f=n.pipelineSceneData.csmSupported?c.csmLevel:1;e8.mainLightShadowNames[0]="MainLightShadow"+e.id;for(var p=0;p<f;p++)t8(t,e8.mainLightShadowNames[0],_,d)}for(var m=0;m<o.length;m++){o[m];var g="SpotLightShadow"+m.toString()+e.id;e8.spotLightShadowNames[m]=g,t8(t,e8.spotLightShadowNames[m],_,d)}return e8}var n8,r8=i8;function s8(t,e,i,n,r,s,a){var o=s,h=a,u=Xx(i,s,a,n,r);s=u.width,a=u.height;var l=t;r||((n8=e.addRenderPass(s,a,"default")).name=t,n8.setViewport(new Wc(0,0,o,h)),n8.addRenderTarget(l,dc.CLEAR,fc.STORE,new Xc(1,1,1,i.clearColor.w)),n8.addDepthStencil(l+"Depth",dc.CLEAR,fc.DISCARD,i.clearDepth,i.clearStencil,xc.DEPTH_STENCIL));var c=n8.addQueue(px.RENDER_OPAQUE,"shadow-caster");c.addSceneOfCamera(i,new xx(n,r),yx.SHADOW_CASTER),c.setViewport(new Wc(u.x,u.y,u.width,u.height))}function a8(t,e){if(e8.shadowEnabled){var i=e.camera,n=t.pipelineSceneData.shadows,r=n.size.x,s=n.size.y,a=i.scene.mainLight;if(a&&a.shadowEnabled)if(e8.mainLightShadowNames[0]="MainLightShadow"+e.id,a.shadowFixedArea)s8(e8.mainLightShadowNames[0],t,i,a,0,r,s);else{var o=t.pipelineSceneData.csmSupported?a.csmLevel:1;e8.mainLightShadowNames[0]="MainLightShadow"+e.id;for(var h=0;h<o;h++)s8(e8.mainLightShadowNames[0],t,i,a,h,r,s)}for(var u=0;u<e8.validLights.length;u++){var l=e8.validLights[u],c="SpotLightShadow"+u.toString()+e.id;e8.spotLightShadowNames[u]=c,s8(c,t,i,l,0,r,s)}}}function o8(t,e,i,n){var r=Xx(e.camera,e.camera.window.width,e.camera.window.height),s=r.width,a=r.height,o=t.addRenderPass(s,a,"default"),h=e.camera;o.addRenderTarget(i,dc.LOAD,fc.STORE),o.addDepthStencil(c8.ds,dc.LOAD,fc.DISCARD);for(var u,l=d(e8.mainLightShadowNames);!(u=l()).done;){var c=u.value;t.containsResource(c)&&o.addTexture(c,"cc_shadowMap")}for(var _,f=d(e8.spotLightShadowNames);!(_=f()).done;){var p=_.value;t.containsResource(p)&&o.addTexture(p,"cc_spotShadowMap")}var m=yx.OPAQUE_OBJECT|yx.PLANAR_SHADOW|yx.CUTOUT_OBJECT|yx.DRAW_INSTANCING;m|=n?yx.CLUSTERED_LIGHTING:yx.DEFAULT_LIGHTING,o.addQueue(px.RENDER_OPAQUE,"deferred-forward").addSceneOfCamera(h,new xx,m),o.addQueue(px.RENDER_TRANSPARENT,"deferred-forward").addSceneOfCamera(h,new xx,yx.TRANSPARENT_OBJECT|yx.GEOMETRY)}function h8(t,e,i,n){void 0===i&&(i=!1),void 0===n&&(n=!0),a8(t,e);var r=e.id,s=Xx(e.camera,e.camera.window.width,e.camera.window.height),a=s.width,o=s.height,h=t.addRenderPass(a,o,"default");h.name="ForwardPass"+r,h.setViewport(new Wc(s.x,s.y,a,o));for(var u,l=d(e8.mainLightShadowNames);!(u=l()).done;){var c=u.value;t.containsResource(c)&&h.addTexture(c,"cc_shadowMap")}for(var _,f=d(e8.spotLightShadowNames);!(_=f()).done;){var p=_.value;t.containsResource(p)&&h.addTexture(p,"cc_spotShadowMap")}var m=e.camera;h.addRenderTarget("ForwardColor"+e.id,i?dc.CLEAR:Wx(m.clearFlag,Sx.RENDER_TARGET),fc.STORE,new Xc(m.clearColor.x,m.clearColor.y,m.clearColor.z,m.clearColor.w)),h.addDepthStencil("ForwardDepthStencil"+e.id,i?dc.CLEAR:Wx(m.clearFlag,Sx.DEPTH_STENCIL),i?fc.DISCARD:fc.STORE,m.clearDepth,m.clearStencil,m.clearFlag),h.addQueue(px.RENDER_OPAQUE).addSceneOfCamera(m,new xx,yx.OPAQUE_OBJECT|yx.PLANAR_SHADOW|yx.CUTOUT_OBJECT|yx.DEFAULT_LIGHTING|yx.DRAW_INSTANCING);var g=yx.TRANSPARENT_OBJECT|yx.GEOMETRY;return i||(g|=yx.UI,h.showStatistics=!0),n&&h.addQueue(px.RENDER_TRANSPARENT).addSceneOfCamera(m,new xx,g),{rtName:"ForwardColor"+e.id,dsName:"ForwardDepthStencil"+e.id}}var u8,l8,c8=new function(){this.color=void 0,this.normal=void 0,this.emissive=void 0,this.ds=void 0};function _8(t,e){var i=e.camera,n=Xx(i,i.window.width,i.window.height),r=n.width,s=n.height,a=c8.color,o=c8.normal,h=c8.emissive,u=c8.ds,l=t.addRenderPass(r,s,"gbuffer");l.name="CameraGBufferPass"+e.id,l.setViewport(new Wc(n.x,n.y,r,s));var c=new Xc(0,0,0,0);return i.clearFlag&xc.COLOR&&(t.pipelineSceneData.isHDR?mS(c,i.clearColor):(c.x=i.clearColor.x,c.y=i.clearColor.y,c.z=i.clearColor.z)),l.addRenderTarget(a,dc.CLEAR,fc.STORE,c),l.addRenderTarget(h,dc.CLEAR,fc.STORE,new Xc(0,0,0,0)),l.addRenderTarget(o,dc.CLEAR,fc.STORE,new Xc(0,0,0,0)),l.addDepthStencil(u,dc.CLEAR,fc.STORE,i.clearDepth,i.clearStencil,i.clearFlag),l.addQueue(px.RENDER_OPAQUE,"gbuffer").addSceneOfCamera(i,new xx,yx.OPAQUE_OBJECT|yx.CUTOUT_OBJECT),l}function d8(t,e,i){a8(t,e),u8||(u8=new Kx(i));var n=t,r=e.camera,s=Xx(r,r.window.width,r.window.height),a=s.width,o=s.height,h=Vx(r),u="deferredLightingPassRTName"+e.id,l=n.addRenderPass(a,o,"deferred-lighting");l.name="CameraLightingPass"+e.id,l.setViewport(new Wc(s.x,s.y,a,o));for(var c,_=d(e8.mainLightShadowNames);!(c=_()).done;){var f=c.value;n.containsResource(f)&&l.addTexture(f,"cc_shadowMap")}for(var p,m=d(e8.spotLightShadowNames);!(p=m()).done;){var g=p.value;n.containsResource(g)&&l.addTexture(g,"cc_spotShadowMap")}n.containsResource(c8.color)&&(l.addTexture(c8.color,"albedoMap"),l.addTexture(c8.normal,"normalMap"),l.addTexture(c8.emissive,"emissiveMap"),l.addTexture(c8.ds,"depthStencil"));var v="clusterLightBuffer"+h,y="clusterLightIndicesBuffer"+h,T="clusterLightGridBuffer"+h;n.containsResource(v)&&(l.addStorageBuffer(v,Ex.READ,"b_ccLightsBuffer"),l.addStorageBuffer(y,Ex.READ,"b_clusterLightIndicesBuffer"),l.addStorageBuffer(T,Ex.READ,"b_clusterLightGridBuffer"));var S=new Xc(0,0,0,0);return r.clearFlag&xc.COLOR&&(S.x=r.clearColor.x,S.y=r.clearColor.y,S.z=r.clearColor.z),S.w=0,l.addRenderTarget(u,dc.CLEAR,fc.STORE,S),l.addQueue(px.RENDER_TRANSPARENT).addCameraQuad(r,u8.deferredLightingMaterial,0,yx.VOLUMETRIC_LIGHTING),{rtName:u}}function f8(t,e,i){l8||(l8=new jx);var n=e.id,r=e.camera,s=Xx(r,r.window.width,r.window.height),a=s.width,o=s.height,h="postprocessPassRTName"+n,u="postprocessPassDS"+n,l=t.addRenderPass(a,o,"post-process");l.name="CameraPostprocessPass"+n,l.setViewport(new Wc(s.x,s.y,s.width,s.height)),t.containsResource(i)&&l.addTexture(i,"outputResultMap");var c=new Xc(0,0,0,r.clearColor.w);return r.clearFlag&xc.COLOR&&(c.x=r.clearColor.x,c.y=r.clearColor.y,c.z=r.clearColor.z),l.addRenderTarget(h,Wx(r.clearFlag,Sx.RENDER_TARGET),fc.STORE,c),l.addDepthStencil(u,Wx(r.clearFlag,Sx.DEPTH_STENCIL),fc.STORE,r.clearDepth,r.clearStencil,r.clearFlag),l.addQueue(px.NONE).addCameraQuad(r,l8.postMaterial,0,yx.NONE),wS()===r&&(l.showStatistics=!0),{rtName:h,dsName:u}}function p8(t,e){var i=e.camera,n=Xx(i,i.window.width,i.window.height),r=n.width,s=n.height,a="dsUIAndProfilerPassColor"+e.id,o="dsUIAndProfilerPassDS"+e.id,h=t.addRenderPass(r,s,"default");h.name="CameraUIAndProfilerPass"+e.id,h.setViewport(new Wc(n.x,n.y,r,s)),h.addRenderTarget(a,Wx(i.clearFlag,Sx.RENDER_TARGET),fc.STORE,new Xc(i.clearColor.x,i.clearColor.y,i.clearColor.z,i.clearColor.w)),h.addDepthStencil(o,Wx(i.clearFlag,Sx.DEPTH_STENCIL),fc.STORE,i.clearDepth,i.clearStencil,i.clearFlag);var u=yx.UI;h.addQueue(px.RENDER_TRANSPARENT).addSceneOfCamera(i,new xx,u),wS()===i&&(h.showStatistics=!0)}new Xc(0,0,0,0),t("dw",function(){function t(){}var e=t.prototype;return e.setup=function(t,e){for(var i=0;i<t.length;i++){var n=t[i];null!==n.scene&&(e.update(n),h8(e,$4(e,n,this.initResource,this.updateResource)))}},e.initResource=function(t,e){!function(t,e,i){void 0===i&&(i=!1);var n=e.camera,r=Xx(n,n.window.width,n.window.height),s=r.width,a=r.height;i8(t,e),i?t.addRenderTarget("ForwardColor"+e.id,function(t){var e=t.getMacroBool("CC_USE_FLOAT_OUTPUT");return t.pipelineSceneData.isHDR&&e&&iy(t.device)?jl.RGBA16F:jl.RGBA8}(t),s,a,fx.PERSISTENT):t.addRenderWindow("ForwardColor"+e.id,jl.BGRA8,s,a,e.camera.window),t.addDepthStencil("ForwardDepthStencil"+e.id,jl.DEPTH_STENCIL,s,a)}(t,e)},e.updateResource=function(t,e){!function(t,e,i){void 0===i&&(i=!1);var n=e.camera,r=Xx(n,n.window.width,n.window.height),s=r.width,a=r.height;r8(t,e),i?t.updateRenderTarget("ForwardColor"+e.id,s,a):t.updateRenderWindow("ForwardColor"+e.id,e.camera.window),t.updateDepthStencil("ForwardDepthStencil"+e.id,s,a)}(t,e)},t}()),t("dx",function(){function t(){}var e=t.prototype;return e.setup=function(t,e){for(var i=0;i<t.length;++i){var n=t[i];if(n.scene){e.update(n);var r=e.device.hasFeature(Xl.COMPUTE_SHADER),s=n.cameraUsage===Nw.GAME||n.cameraUsage===Nw.GAME_VIEW,a=$4(e,n,this.initResource,this.updateResource);if(s)if(K4(n))p8(e,a);else{r&&oI(n,e),_8(e,a);var o=d8(e,a,r);o8(e,a,o.rtName,r),f8(e,a,o.rtName)}else h8(e,a)}}},e.initResource=function(t,e){K4(e.camera)?function(t,e){var i=e.camera,n=Xx(i,i.window.width,i.window.height),r=n.width,s=n.height,a="dsUIAndProfilerPassColor"+e.id,o="dsUIAndProfilerPassDS"+e.id;t.addRenderWindow(a,jl.BGRA8,r,s,i.window),t.addDepthStencil(o,jl.DEPTH_STENCIL,r,s,fx.MANAGED)}(t,e):(function(t,e){var i=e.camera,n=Xx(i,i.window.width,i.window.height),r=n.width,s=n.height,a="gBufferPassColorCamera"+e.id,o="gBufferPassNormal"+e.id,h="gBufferPassEmissive"+e.id,u="gBufferPassDSCamera"+e.id,l=jl.RGBA16F;t.addRenderTarget(a,l,r,s,fx.MANAGED),t.addRenderTarget(h,l,r,s,fx.MANAGED),t.addRenderTarget(o,l,r,s,fx.MANAGED),t.addDepthStencil(u,jl.DEPTH_STENCIL,r,s,fx.MANAGED),c8.color=a,c8.normal=o,c8.emissive=h,c8.ds=u}(t,e),function(t,e){i8(t,e);var i=e.camera,n=Xx(i,i.window.width,i.window.height),r=n.width,s=n.height,a="deferredLightingPassRTName"+e.id;t.addRenderTarget(a,jl.RGBA8,r,s,fx.MANAGED)}(t,e),function(t,e){var i=e.id,n=e.camera,r=Xx(n,n.window.width,n.window.height),s=r.width,a=r.height,o="postprocessPassRTName"+i,h="postprocessPassDS"+i;t.addRenderWindow(o,jl.BGRA8,s,a,n.window),t.addDepthStencil(h,jl.DEPTH_STENCIL,s,a,fx.MANAGED)}(t,e))},e.updateResource=function(t,e){K4(e.camera)?function(t,e){var i=e.camera,n=Xx(i,i.window.width,i.window.height),r=n.width,s=n.height,a="dsUIAndProfilerPassColor"+e.id,o="dsUIAndProfilerPassDS"+e.id;t.updateRenderWindow(a,i.window),t.updateDepthStencil(o,r,s)}(t,e):(function(t,e){var i=e.camera,n=Xx(i,i.window.width,i.window.height),r=n.width,s=n.height,a="gBufferPassColorCamera"+e.id,o="gBufferPassNormal"+e.id,h="gBufferPassEmissive"+e.id,u="gBufferPassDSCamera"+e.id;t.updateRenderTarget(a,r,s),t.updateRenderTarget(h,r,s),t.updateRenderTarget(o,r,s),t.updateDepthStencil(u,r,s)}(t,e),function(t,e){r8(t,e);var i=e.camera,n=Xx(i,i.window.width,i.window.height),r=n.width,s=n.height,a="deferredLightingPassRTName"+e.id;t.updateRenderTarget(a,r,s)}(t,e),function(t,e){var i=e.id,n=e.camera,r=Xx(n,n.window.width,n.window.height),s=r.width,a=r.height,o="postprocessPassRTName"+i,h="postprocessPassDS"+i;t.updateRenderWindow(o,n.window),t.updateDepthStencil(h,s,a)}(t,e))},t}());var m8=Wa.Flags.Destroyed,g8=Wa.Flags.PersistentMask,v8=[];function y8(t){var e;if(Xa(t)){if(function(t){return"function"==typeof t._instantiate}(t))return v.game._isCloning=!0,e=t._instantiate(null,!0),v.game._isCloning=!1,e;if(t instanceof v.Asset)throw new TypeError(et(6903))}return v.game._isCloning=!0,e=T8(t),v.game._isCloning=!1,e}function T8(t,e){var i;S8(t,i=t._iN$t?t._iN$t:t.constructor?new(0,t.constructor):Object.create(null),e);for(var n=0,r=v8.length;n<r;++n)v8[n]._iN$t=null;return v8.length=0,i}function S8(t,e,i){Ct(t,"_iN$t",e,!0),v8.push(t);var n=t.constructor;if(vi(n))!function(t,e,i,n){for(var r=t.__values__,s=0;s<r.length;s++){var a=r[s],o=e[a];if("object"==typeof o&&o){var h=i[a];h instanceof Ae&&h.constructor===o.constructor?h.set(o):i[a]=o._iN$t||E8(o,n)}else i[a]=o}}(n,t,e,i);else for(var r in t)if(t.hasOwnProperty(r)&&(95!==r.charCodeAt(0)||95!==r.charCodeAt(1)||"__type__"===r||"__prefab"===r)){var s=t[r];if("object"==typeof s&&s){if(s===e)continue;e[r]=s._iN$t||E8(s,i)}else e[r]=s}Xa(t)&&(e._objFlags&=g8)}function E8(t,e){if(t instanceof Ae)return t.clone();if(t instanceof v.Asset)return t;var i;if(ArrayBuffer.isView(t)){var n=t.length;i=new t.constructor(n),t._iN$t=i,v8.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,v8.push(t);for(var a=0;a<s;++a){var o=t[a];i[a]="object"==typeof o&&o?o._iN$t||E8(o,e):o}return i}if(t._objFlags&m8)return null;var h=t.constructor;if(vi(h)){if(e)if(e instanceof op){if(t instanceof $m||t instanceof op)return t}else if(e instanceof $m)if(t instanceof $m){if(!t.isChildOf(e))return t}else if(t instanceof op&&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 S8(t,i,e),i}y8._clone=T8,v.instantiate=y8;var A8,R8,b8=t("ev",function(){function t(t){this.poolHandlerComp=void 0,this._pool=void 0,this.poolHandlerComp=t,this._pool=[]}var e=t.prototype;return e.size=function(){return this._pool.length},e.clear=function(){for(var t=this._pool.length,e=0;e<t;++e)this._pool[e].destroy();this._pool.length=0},e.put=function(t){if(t&&-1===this._pool.indexOf(t)){t.removeFromParent();var e=this.poolHandlerComp?t.getComponent(this.poolHandlerComp):null;e&&e.unuse&&e.unuse(),this._pool.push(t)}},e.get=function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];var n=this._pool.length-1;if(n<0)return null;var r=this._pool[n];this._pool.length=n;var s=this.poolHandlerComp?r.getComponent(this.poolHandlerComp):null;return s&&s.reuse&&s.reuse(arguments),r},t}());v.NodePool=b8;var C8=null!==(A8=globalThis.jsb)&&void 0!==A8?A8:{};t("eN",{DownloaderHints:C8.DownloaderHints,Downloader:C8.Downloader,zipUtils:C8.zipUtils,fileUtils:C8.fileUtils,DebugRenderer:C8.DebugRenderer,copyTextToClipboard:null===(R8=C8.copyTextToClipboard)||void 0===R8?void 0:R8.bind(C8),garbageCollect:C8.garbageCollect,reflection:C8.reflection,bridge:C8.bridge,jsbBridgeWrapper:C8.jsbBridgeWrapper,AssetsManager:C8.AssetsManager,EventAssetsManager:C8.EventAssetsManager,Manifest:C8.Manifest,saveImageData:C8.saveImageData,process:C8.process,adpf:C8.adpf}),v.renderer=iH;var w8,x8=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._gpuDescriptorSet=null,e}s(e,t);var i=e.prototype;return i.initialize=function(t){this._layout=t.layout;var e=t.layout.gpuDescriptorSetLayout,i=e.bindings,n=e.descriptorIndices,r=e.descriptorCount;this._buffers=Array(r).fill(null),this._textures=Array(r).fill(null),this._samplers=Array(r).fill(null);var s=[];this._gpuDescriptorSet={gpuDescriptors:s,descriptorIndices:n};for(var a=0;a<i.length;++a)for(var o=i[a],h=0;h<o.count;h++)s.push({type:o.descriptorType,gpuBuffer:null,gpuTexture:null,gpuSampler:null})},i.destroy=function(){this._layout=null,this._gpuDescriptorSet=null},i.update=function(){if(this._isDirty&&this._gpuDescriptorSet){for(var t=this._gpuDescriptorSet.gpuDescriptors,e=0;e<t.length;++e)if(t[e].type&k_){var i=this._buffers[e];i&&(t[e].gpuBuffer=i.gpuBuffer||i.gpuBufferView)}else t[e].type&U_&&(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}(nd);!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"}(w8||(w8={}));var I8=function(){function t(){}return t.setInstance=function(e){t._instance=e},n(t,null,[{key:"instance",get:function(){return t._instance}}]),t}();function O8(t,e){switch(t){case jl.R8:return e.UNSIGNED_BYTE;case jl.R8SN:return e.BYTE;case jl.R8UI:return e.UNSIGNED_BYTE;case jl.R8I:return e.BYTE;case jl.R16F:return w8.HALF_FLOAT_OES;case jl.R16UI:return e.UNSIGNED_SHORT;case jl.R16I:return e.SHORT;case jl.R32F:return e.FLOAT;case jl.R32UI:return e.UNSIGNED_INT;case jl.R32I:return e.INT;case jl.RG8:return e.UNSIGNED_BYTE;case jl.RG8SN:return e.BYTE;case jl.RG8UI:return e.UNSIGNED_BYTE;case jl.RG8I:return e.BYTE;case jl.RG16F:return w8.HALF_FLOAT_OES;case jl.RG16UI:return e.UNSIGNED_SHORT;case jl.RG16I:return e.SHORT;case jl.RG32F:return e.FLOAT;case jl.RG32UI:return e.UNSIGNED_INT;case jl.RG32I:return e.INT;case jl.RGB8:case jl.SRGB8:return e.UNSIGNED_BYTE;case jl.RGB8SN:return e.BYTE;case jl.RGB8UI:return e.UNSIGNED_BYTE;case jl.RGB8I:return e.BYTE;case jl.RGB16F:return w8.HALF_FLOAT_OES;case jl.RGB16UI:return e.UNSIGNED_SHORT;case jl.RGB16I:return e.SHORT;case jl.RGB32F:return e.FLOAT;case jl.RGB32UI:return e.UNSIGNED_INT;case jl.RGB32I:return e.INT;case jl.BGRA8:case jl.RGBA8:case jl.SRGB8_A8:return e.UNSIGNED_BYTE;case jl.RGBA8SN:return e.BYTE;case jl.RGBA8UI:return e.UNSIGNED_BYTE;case jl.RGBA8I:return e.BYTE;case jl.RGBA16F:return w8.HALF_FLOAT_OES;case jl.RGBA16UI:return e.UNSIGNED_SHORT;case jl.RGBA16I:return e.SHORT;case jl.RGBA32F:return e.FLOAT;case jl.RGBA32UI:return e.UNSIGNED_INT;case jl.RGBA32I:return e.INT;case jl.R5G6B5:return e.UNSIGNED_SHORT_5_6_5;case jl.R11G11B10F:return e.FLOAT;case jl.RGB5A1:return e.UNSIGNED_SHORT_5_5_5_1;case jl.RGBA4:return e.UNSIGNED_SHORT_4_4_4_4;case jl.RGB10A2:return e.UNSIGNED_BYTE;case jl.RGB10A2UI:return e.UNSIGNED_INT;case jl.RGB9E5:return e.UNSIGNED_BYTE;case jl.DEPTH:return e.UNSIGNED_INT;case jl.DEPTH_STENCIL:return w8.UNSIGNED_INT_24_8_WEBGL;case jl.BC1:case jl.BC1_SRGB:case jl.BC2:case jl.BC2_SRGB:case jl.BC3:case jl.BC3_SRGB:case jl.BC4:return e.UNSIGNED_BYTE;case jl.BC4_SNORM:return e.BYTE;case jl.BC5:return e.UNSIGNED_BYTE;case jl.BC5_SNORM:return e.BYTE;case jl.BC6H_SF16:case jl.BC6H_UF16:return e.FLOAT;case jl.BC7:case jl.BC7_SRGB:case jl.ETC_RGB8:case jl.ETC2_RGB8:case jl.ETC2_SRGB8:case jl.ETC2_RGB8_A1:case jl.ETC2_SRGB8_A1:case jl.EAC_R11:return e.UNSIGNED_BYTE;case jl.EAC_R11SN:return e.BYTE;case jl.EAC_RG11:return e.UNSIGNED_BYTE;case jl.EAC_RG11SN:return e.BYTE;case jl.PVRTC_RGB2:case jl.PVRTC_RGBA2:case jl.PVRTC_RGB4:case jl.PVRTC_RGBA4:case jl.PVRTC2_2BPP:case jl.PVRTC2_4BPP:return e.UNSIGNED_BYTE;case jl.ASTC_RGBA_4X4:case jl.ASTC_RGBA_5X4:case jl.ASTC_RGBA_5X5:case jl.ASTC_RGBA_6X5:case jl.ASTC_RGBA_6X6:case jl.ASTC_RGBA_8X5:case jl.ASTC_RGBA_8X6:case jl.ASTC_RGBA_8X8:case jl.ASTC_RGBA_10X5:case jl.ASTC_RGBA_10X6:case jl.ASTC_RGBA_10X8:case jl.ASTC_RGBA_10X10:case jl.ASTC_RGBA_12X10:case jl.ASTC_RGBA_12X12:case jl.ASTC_SRGBA_4X4:case jl.ASTC_SRGBA_5X4:case jl.ASTC_SRGBA_5X5:case jl.ASTC_SRGBA_6X5:case jl.ASTC_SRGBA_6X6:case jl.ASTC_SRGBA_8X5:case jl.ASTC_SRGBA_8X6:case jl.ASTC_SRGBA_8X8:case jl.ASTC_SRGBA_10X5:case jl.ASTC_SRGBA_10X6:case jl.ASTC_SRGBA_10X8:case jl.ASTC_SRGBA_10X10:case jl.ASTC_SRGBA_12X10:case jl.ASTC_SRGBA_12X12:default:return e.UNSIGNED_BYTE}}function D8(t,e){switch(t){case Kl.BOOL:return e.BOOL;case Kl.BOOL2:return e.BOOL_VEC2;case Kl.BOOL3:return e.BOOL_VEC3;case Kl.BOOL4:return e.BOOL_VEC4;case Kl.INT:return e.INT;case Kl.INT2:return e.INT_VEC2;case Kl.INT3:return e.INT_VEC3;case Kl.INT4:return e.INT_VEC4;case Kl.UINT:return e.UNSIGNED_INT;case Kl.FLOAT:return e.FLOAT;case Kl.FLOAT2:return e.FLOAT_VEC2;case Kl.FLOAT3:return e.FLOAT_VEC3;case Kl.FLOAT4:return e.FLOAT_VEC4;case Kl.MAT2:return e.FLOAT_MAT2;case Kl.MAT3:return e.FLOAT_MAT3;case Kl.MAT4:return e.FLOAT_MAT4;case Kl.SAMPLER2D:return e.SAMPLER_2D;case Kl.SAMPLER_CUBE:return e.SAMPLER_CUBE;default:return G("Unsupported GLType, convert to GL type failed."),Kl.UNKNOWN}}function M8(t){switch(t){case Kl.BOOL:case Kl.BOOL2:case Kl.BOOL3:case Kl.BOOL4:case Kl.INT:case Kl.INT2:case Kl.INT3:case Kl.INT4:case Kl.UINT:return Int32Array;case Kl.FLOAT:case Kl.FLOAT2:case Kl.FLOAT3:case Kl.FLOAT4:case Kl.MAT2:case Kl.MAT3:case Kl.MAT4:return Float32Array;default:return G("Unsupported GLType, convert to TypedArrayConstructor failed."),Float32Array}}function P8(t,e){switch(t){case e.BOOL:return Kl.BOOL;case e.BOOL_VEC2:return Kl.BOOL2;case e.BOOL_VEC3:return Kl.BOOL3;case e.BOOL_VEC4:return Kl.BOOL4;case e.INT:return Kl.INT;case e.INT_VEC2:return Kl.INT2;case e.INT_VEC3:return Kl.INT3;case e.INT_VEC4:return Kl.INT4;case e.UNSIGNED_INT:return Kl.UINT;case e.FLOAT:return Kl.FLOAT;case e.FLOAT_VEC2:return Kl.FLOAT2;case e.FLOAT_VEC3:return Kl.FLOAT3;case e.FLOAT_VEC4:return Kl.FLOAT4;case e.FLOAT_MAT2:return Kl.MAT2;case e.FLOAT_MAT3:return Kl.MAT3;case e.FLOAT_MAT4:return Kl.MAT4;case e.SAMPLER_2D:return Kl.SAMPLER2D;case e.SAMPLER_CUBE:return Kl.SAMPLER_CUBE;default:return G("Unsupported GLType, convert to Type failed."),Kl.UNKNOWN}}function B8(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 G("Unsupported GLType, get type failed."),0}}function N8(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}}I8._instance=null;var L8,F8=[512,513,514,515,516,517,518,519],k8=[0,7680,7681,7682,7683,5386,34055,34056],U8=[32774,32778,32779,32775,32776],G8=[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"}(L8||(L8={}));var H8=function(t){this.cmdType=void 0,this.refCount=0,this.cmdType=t},z8=function(t){function e(){var e;return(e=t.call(this,L8.BEGIN_RENDER_PASS)||this).gpuRenderPass=null,e.gpuFramebuffer=null,e.renderArea=new Fc,e.clearFlag=xc.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}(H8),V8=function(t){function e(){var e;return(e=t.call(this,L8.BIND_STATES)||this).gpuPipelineState=null,e.gpuInputAssembler=null,e.gpuDescriptorSets=[],e.dynamicOffsets=[],e.dynamicStates=new N_,e}return s(e,t),e.prototype.clear=function(){this.gpuPipelineState=null,this.gpuDescriptorSets.length=0,this.gpuInputAssembler=null,this.dynamicOffsets.length=0},e}(H8),W8=function(t){function e(){var e;return(e=t.call(this,L8.DRAW)||this).drawInfo=new Zc,e}return s(e,t),e.prototype.clear=function(){},e}(H8),X8=function(t){function e(){var e;return(e=t.call(this,L8.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}(H8),j8=function(t){function e(){var e;return(e=t.call(this,L8.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}(H8),Y8=function(t){function e(){var e;return(e=t.call(this,L8.BLIT_TEXTURE)||this).srcTexture=null,e.dstTexture=null,e.regions=[],e.filter=sc.LINEAR,e}return s(e,t),e.prototype.clear=function(){this.srcTexture=null,this.dstTexture=null,this.regions.length=0},e}(H8),K8=function(){function t(){this.cmds=new Nu(1),this.beginRenderPassCmds=new Nu(1),this.bindStatesCmds=new Nu(1),this.drawCmds=new Nu(1),this.updateBufferCmds=new Nu(1),this.copyBufferToTextureCmds=new Nu(1),this.blitTextureCmds=new Nu(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 q8(t,e){var i=t.gl,n=t.stateCache,r=e.memUsage&Jl.HOST?i.DYNAMIC_DRAW:i.STATIC_DRAW;if(e.usage&ql.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),i6.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&ql.INDEX){e.glTarget=i.ELEMENT_ARRAY_BUFFER;var a=i.createBuffer();a&&(e.glBuffer=a,e.size>0&&(t.extensions.useVAO&&n.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),n.glVAO=null),i6.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&ql.UNIFORM?(e.glTarget=i.NONE,e.buffer&&(e.vf32=new Float32Array(e.buffer.buffer))):(e.usage&ql.INDIRECT||e.usage&ql.TRANSFER_DST||e.usage&ql.TRANSFER_SRC||G("Unsupported BufferType, create buffer failed."),e.glTarget=i.NONE)}function Q8(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),i6.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),i6.gpuInputAssembler=null,i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,null),t.stateCache.glElementArrayBuffer=null}i.deleteBuffer(e.glBuffer),e.glBuffer=null}}function Z8(t,e,i,n,r){if(e.usage&ql.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&ql.INDIRECT){e.indirects.clearDraws();for(var s=i.drawInfos,a=0;a<s.length;++a)e.indirects.setDrawInfo(n+a,s[a])}else{var o=i,h=t.gl,u=t.stateCache;switch(e.glTarget){case h.ARRAY_BUFFER:t.extensions.useVAO&&u.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),u.glVAO=null),i6.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),i6.gpuInputAssembler=null,t.stateCache.glElementArrayBuffer!==e.glBuffer&&(h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,e.glBuffer),t.stateCache.glElementArrayBuffer=e.glBuffer);break;default:return void G("Unsupported BufferType, update buffer failed.")}r===o.byteLength?h.bufferSubData(e.glTarget,n,o):h.bufferSubData(e.glTarget,n,o.slice(0,r))}}function J8(t,e){for(var i,n=t.gl,r=function(){var t=e.gpuStages[s],i=0,r="",a=1;switch(t.type){case _c.VERTEX:r="VertexShader",i=n.VERTEX_SHADER;break;case _c.FRAGMENT:r="FragmentShader",i=n.FRAGMENT_SHADER;break;default:return G("Unsupported ShaderType."),{v:void 0}}var o=n.createShader(i);if(o&&(t.glShader=o,n.shaderSource(t.glShader,t.source),n.compileShader(t.glShader),!n.getShaderParameter(t.glShader,n.COMPILE_STATUS))){G(r+" in '"+e.name+"' compilation failed."),G("Shader source dump:",t.source.replace(/^|\n/g,(function(){return"\n"+a+++" "}))),G(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 a=n.createProgram();if(a){e.glProgram=a;for(var o=0;o<e.gpuStages.length;o++){var h=e.gpuStages[o];n.attachShader(e.glProgram,h.glShader)}if(n.linkProgram(e.glProgram),t.extensions.destroyShadersImmediately)for(var u=0;u<e.gpuStages.length;u++){var l=e.gpuStages[u];l.glShader&&(n.detachShader(e.glProgram,l.glShader),n.deleteShader(l.glShader),l.glShader=null)}if(!n.getProgramParameter(e.glProgram,n.LINK_STATUS))return G("Failed to link shader '"+e.name+"'."),void G(n.getProgramInfoLog(e.glProgram));z("Shader '"+e.name+"' compilation succeeded.");var c=n.getProgramParameter(e.glProgram,n.ACTIVE_ATTRIBUTES);e.glInputs=new Array(c);for(var _=0;_<c;++_){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 m=n.getAttribLocation(e.glProgram,f),g=P8(d.type,n),y=B8(d.type,n);e.glInputs[_]={binding:m,name:f,type:g,stride:y,count:d.size,size:y*d.size,glType:d.type,glLoc:m}}}if(e.blocks.length>0){e.glBlocks=new Array(e.blocks.length);for(var T=0;T<e.blocks.length;++T){var S=e.blocks[T],E={set:S.set,binding:S.binding,name:S.name,size:0,glUniforms:new Array(S.members.length),glActiveUniforms:[]};e.glBlocks[T]=E;for(var A=0;A<S.members.length;++A){var R=S.members[A],b=D8(R.type,n),C=B8(b,n),w=C*R.count;E.glUniforms[A]={binding:-1,name:R.name,type:R.type,stride:C,count:R.count,size:w,offset:0,glType:b,glLoc:null,array:null}}}}for(var x=0;x<e.subpassInputs.length;++x){var I=e.subpassInputs[x];e.samplerTextures.push(new s_(I.set,I.binding,I.name,Kl.SAMPLER2D,I.count))}if(e.samplerTextures.length>0){e.glSamplerTextures=new Array(e.samplerTextures.length);for(var O=0;O<e.samplerTextures.length;++O){var D=e.samplerTextures[O];e.glSamplerTextures[O]={set:D.set,binding:D.binding,name:D.name,type:D.type,count:D.count,units:[],glUnits:null,glType:D8(D.type,n),glLoc:null}}}for(var M=n.getProgramParameter(e.glProgram,n.ACTIVE_UNIFORMS),P=0;P<M;++P){var B=n.getActiveUniform(e.glProgram,P);if(B&&B.type!==n.SAMPLER_2D&&B.type!==n.SAMPLER_CUBE){var N=n.getUniformLocation(e.glProgram,B.name);if(t.extensions.isLocationActive(N)){var L,F=B.name.indexOf("[");L=-1!==F?B.name.substr(0,F):B.name;for(var k=0;k<e.glBlocks.length;k++)for(var U=e.glBlocks[k],H=0;H<U.glUniforms.length;H++){var V=U.glUniforms[H];if(V.name===L){V.glLoc=N,V.count=B.size,V.size=V.stride*V.count,V.array=new(M8(V.type))(V.size/4),U.glActiveUniforms.push(V);break}}}}}for(var W=0;W<e.glBlocks.length;W++)for(var X=e.glBlocks[W],j=0;j<X.glUniforms.length;j++){var Y=X.glUniforms[j];Y.offset=X.size/4,X.size+=Y.size}var K=[],q=[],Q=t.bindingMappings,Z=t.stateCache.texUnitCacheMap;if(v.rendering&&v.rendering.enableEffectImport)for(var J=0;J<e.samplerTextures.length;++J){var $=e.samplerTextures[J],tt=n.getUniformLocation(e.glProgram,$.name);t.extensions.isLocationActive(tt)&&(K.push(e.glSamplerTextures[J]),q.push(tt)),void 0===Z[$.name]&&(Z[$.name]=$.flattened%t.capabilities.maxTextureUnits)}else{for(var et=0,it=0;it<e.blocks.length;++it)e.blocks[it].set===Q.flexibleSet&&et++;for(var nt=0,rt=0;rt<e.samplerTextures.length;++rt){var st=e.samplerTextures[rt],at=n.getUniformLocation(e.glProgram,st.name);if(t.extensions.isLocationActive(at)&&(K.push(e.glSamplerTextures[rt]),q.push(at)),void 0===Z[st.name]){var ot=st.binding+Q.samplerTextureOffsets[st.set]+nt;st.set===Q.flexibleSet&&(ot-=et),Z[st.name]=ot%t.capabilities.maxTextureUnits,nt+=st.count-1}}}if(K.length){for(var ht=[],ut=0;ut<K.length;++ut){var lt=K[ut],ct=Z[lt.name];if(void 0!==ct){lt.glLoc=q[ut];for(var _t=0;_t<lt.count;++_t){for(;ht[ct];)ct=(ct+1)%t.capabilities.maxTextureUnits;lt.units.push(ct),ht[ct]=!0}}}for(var dt=0,ft=0;ft<K.length;++ft){var pt=K[ft];if(!t.extensions.isLocationActive(pt.glLoc)){pt.glLoc=q[ft];for(var mt=0;mt<pt.count;++mt){for(;ht[dt];)dt=(dt+1)%t.capabilities.maxTextureUnits;void 0===Z[pt.name]&&(Z[pt.name]=dt),pt.units.push(dt),ht[dt]=!0}}}t.stateCache.glProgram!==e.glProgram&&n.useProgram(e.glProgram);for(var gt=0;gt<K.length;gt++){var vt=K[gt];vt.glUnits=new Int32Array(vt.units),n.uniform1iv(vt.glLoc,vt.glUnits)}t.stateCache.glProgram!==e.glProgram&&n.useProgram(t.stateCache.glProgram)}for(var yt=0;yt<e.glBlocks.length;)e.glBlocks[yt].glActiveUniforms.length?yt++:(e.glBlocks[yt]=e.glBlocks[e.glBlocks.length-1],e.glBlocks.length--);e.glSamplerTextures=K}}function $8(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 t6(t,e){var i=t.gl;e.glAttribs=new Array(e.attributes.length);for(var n=[0,0,0,0,0,0,0,0],r=0;r<e.attributes.length;++r){var s=e.attributes[r],a=void 0!==s.stream?s.stream:0,o=e.gpuVertexBuffers[a],h=O8(s.format,i),u=F_[s.format].size;e.glAttribs[r]={name:s.name,glBuffer:o.glBuffer,glType:h,size:u,count:F_[s.format].count,stride:o.stride,componentCount:N8(h,i),isNormalized:void 0!==s.isNormalized&&s.isNormalized,isInstanced:void 0!==s.isInstanced&&s.isInstanced,offset:n[a]},n[a]+=u}}function e6(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 i6={gpuPipelineState:null,gpuInputAssembler:null,glPrimitive:0},n6=new Fc;function r6(t,e,i,n,r,s,a){var o=t.gl,h=t.stateCache,u=0;if(i&&(n6.x=n.x<<i.lodLevel,n6.y=n.y<<i.lodLevel,n6.width=n.width<<i.lodLevel,n6.height=n.height<<i.lodLevel),i&&e){h.glFramebuffer!==i.glFramebuffer&&(o.bindFramebuffer(o.FRAMEBUFFER,i.glFramebuffer),h.glFramebuffer=i.glFramebuffer),h.viewport.left===n6.x&&h.viewport.top===n6.y&&h.viewport.width===n6.width&&h.viewport.height===n6.height||(o.viewport(n6.x,n6.y,n6.width,n6.height),h.viewport.left=n6.x,h.viewport.top=n6.y,h.viewport.width=n6.width,h.viewport.height=n6.height),h.scissorRect.x===n6.x&&h.scissorRect.y===n6.y&&h.scissorRect.width===n6.width&&h.scissorRect.height===n6.height||(o.scissor(n6.x,n6.y,n6.width,n6.height),h.scissorRect.x=n6.x,h.scissorRect.y=n6.y,h.scissorRect.width=n6.width,h.scissorRect.height=n6.height);var l=r.length;t.extensions.WEBGL_draw_buffers||(l=1);for(var c=0;c<l;++c){var _=e.colorAttachments[c];if(_.format!==jl.UNKNOWN)switch(_.loadOp){case dc.LOAD:break;case dc.CLEAR:h.bs.targets[0].blendColorMask!==cc.ALL&&o.colorMask(!0,!0,!0,!0);var d=r[0];o.clearColor(d.x,d.y,d.z,d.w),u|=o.COLOR_BUFFER_BIT;break;case dc.DISCARD:}}if(e.depthStencilAttachment&&e.depthStencilAttachment.format!==jl.UNKNOWN){switch(e.depthStencilAttachment.depthLoadOp){case dc.LOAD:break;case dc.CLEAR:h.dss.depthWrite||o.depthMask(!0),o.clearDepth(s),u|=o.DEPTH_BUFFER_BIT;break;case dc.DISCARD:}if(F_[e.depthStencilAttachment.format].hasStencil)switch(e.depthStencilAttachment.stencilLoadOp){case dc.LOAD:break;case dc.CLEAR:h.dss.stencilWriteMaskFront||o.stencilMaskSeparate(o.FRONT,65535),h.dss.stencilWriteMaskBack||o.stencilMaskSeparate(o.BACK,65535),o.clearStencil(a),u|=o.STENCIL_BUFFER_BIT;break;case dc.DISCARD:}}if(u&&o.clear(u),u&o.COLOR_BUFFER_BIT){var f=h.bs.targets[0].blendColorMask;if(f!==cc.ALL){var p=(f&cc.R)!==cc.NONE,m=(f&cc.G)!==cc.NONE,g=(f&cc.B)!==cc.NONE,v=(f&cc.A)!==cc.NONE;o.colorMask(p,m,g,v)}}u&o.DEPTH_BUFFER_BIT&&!h.dss.depthWrite&&o.depthMask(!1),u&o.STENCIL_BUFFER_BIT&&(h.dss.stencilWriteMaskFront||o.stencilMaskSeparate(o.FRONT,0),h.dss.stencilWriteMaskBack||o.stencilMaskSeparate(o.BACK,0))}}function s6(t,e,i,n,r,s){var a,o,h,u=t.gl,l=t.stateCache,c=e&&e.gpuShader,_=!1;if(e&&i6.gpuPipelineState!==e){if(i6.gpuPipelineState=e,i6.glPrimitive=e.glPrimitive,e.gpuShader){var d=e.gpuShader.glProgram;l.glProgram!==d&&(u.useProgram(d),l.glProgram=d,_=!0)}var f=e.rs;if(f){if(l.rs.cullMode!==f.cullMode){switch(f.cullMode){case Sc.NONE:u.disable(u.CULL_FACE);break;case Sc.FRONT:u.enable(u.CULL_FACE),u.cullFace(u.FRONT);break;case Sc.BACK:u.enable(u.CULL_FACE),u.cullFace(u.BACK)}l.rs.cullMode=f.cullMode}var p=f.isFrontFaceCCW;l.rs.isFrontFaceCCW!==p&&(u.frontFace(p?u.CCW:u.CW),l.rs.isFrontFaceCCW=p),l.rs.depthBias===f.depthBias&&l.rs.depthBiasSlop===f.depthBiasSlop||(u.polygonOffset(f.depthBias,f.depthBiasSlop),l.rs.depthBias=f.depthBias,l.rs.depthBiasSlop=f.depthBiasSlop),l.rs.lineWidth!==f.lineWidth&&(u.lineWidth(f.lineWidth),l.rs.lineWidth=f.lineWidth)}var m=e.dss;m&&(l.dss.depthTest!==m.depthTest&&(m.depthTest?u.enable(u.DEPTH_TEST):u.disable(u.DEPTH_TEST),l.dss.depthTest=m.depthTest),l.dss.depthWrite!==m.depthWrite&&(u.depthMask(m.depthWrite),l.dss.depthWrite=m.depthWrite),l.dss.depthFunc!==m.depthFunc&&(u.depthFunc(F8[m.depthFunc]),l.dss.depthFunc=m.depthFunc),l.dss.stencilTestFront===m.stencilTestFront&&l.dss.stencilTestBack===m.stencilTestBack||(m.stencilTestFront||m.stencilTestBack?u.enable(u.STENCIL_TEST):u.disable(u.STENCIL_TEST),l.dss.stencilTestFront=m.stencilTestFront,l.dss.stencilTestBack=m.stencilTestBack),l.dss.stencilFuncFront===m.stencilFuncFront&&l.dss.stencilRefFront===m.stencilRefFront&&l.dss.stencilReadMaskFront===m.stencilReadMaskFront||(u.stencilFuncSeparate(u.FRONT,F8[m.stencilFuncFront],m.stencilRefFront,m.stencilReadMaskFront),l.dss.stencilFuncFront=m.stencilFuncFront,l.dss.stencilRefFront=m.stencilRefFront,l.dss.stencilReadMaskFront=m.stencilReadMaskFront),l.dss.stencilFailOpFront===m.stencilFailOpFront&&l.dss.stencilZFailOpFront===m.stencilZFailOpFront&&l.dss.stencilPassOpFront===m.stencilPassOpFront||(u.stencilOpSeparate(u.FRONT,k8[m.stencilFailOpFront],k8[m.stencilZFailOpFront],k8[m.stencilPassOpFront]),l.dss.stencilFailOpFront=m.stencilFailOpFront,l.dss.stencilZFailOpFront=m.stencilZFailOpFront,l.dss.stencilPassOpFront=m.stencilPassOpFront),l.dss.stencilWriteMaskFront!==m.stencilWriteMaskFront&&(u.stencilMaskSeparate(u.FRONT,m.stencilWriteMaskFront),l.dss.stencilWriteMaskFront=m.stencilWriteMaskFront),l.dss.stencilFuncBack===m.stencilFuncBack&&l.dss.stencilRefBack===m.stencilRefBack&&l.dss.stencilReadMaskBack===m.stencilReadMaskBack||(u.stencilFuncSeparate(u.BACK,F8[m.stencilFuncBack],m.stencilRefBack,m.stencilReadMaskBack),l.dss.stencilFuncBack=m.stencilFuncBack,l.dss.stencilRefBack=m.stencilRefBack,l.dss.stencilReadMaskBack=m.stencilReadMaskBack),l.dss.stencilFailOpBack===m.stencilFailOpBack&&l.dss.stencilZFailOpBack===m.stencilZFailOpBack&&l.dss.stencilPassOpBack===m.stencilPassOpBack||(u.stencilOpSeparate(u.BACK,k8[m.stencilFailOpBack],k8[m.stencilZFailOpBack],k8[m.stencilPassOpBack]),l.dss.stencilFailOpBack=m.stencilFailOpBack,l.dss.stencilZFailOpBack=m.stencilZFailOpBack,l.dss.stencilPassOpBack=m.stencilPassOpBack),l.dss.stencilWriteMaskBack!==m.stencilWriteMaskBack&&(u.stencilMaskSeparate(u.BACK,m.stencilWriteMaskBack),l.dss.stencilWriteMaskBack=m.stencilWriteMaskBack));var g=e.bs;if(g){l.bs.isA2C!==g.isA2C&&(g.isA2C?u.enable(u.SAMPLE_ALPHA_TO_COVERAGE):u.disable(u.SAMPLE_ALPHA_TO_COVERAGE),l.bs.isA2C=g.isA2C),l.bs.blendColor.x===g.blendColor.x&&l.bs.blendColor.y===g.blendColor.y&&l.bs.blendColor.z===g.blendColor.z&&l.bs.blendColor.w===g.blendColor.w||(u.blendColor(g.blendColor.x,g.blendColor.y,g.blendColor.z,g.blendColor.w),l.bs.blendColor.x=g.blendColor.x,l.bs.blendColor.y=g.blendColor.y,l.bs.blendColor.z=g.blendColor.z,l.bs.blendColor.w=g.blendColor.w);var v=g.targets[0],y=l.bs.targets[0];y.blend!==v.blend&&(v.blend?u.enable(u.BLEND):u.disable(u.BLEND),y.blend=v.blend),y.blendEq===v.blendEq&&y.blendAlphaEq===v.blendAlphaEq||(u.blendEquationSeparate(U8[v.blendEq],U8[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(G8[v.blendSrc],G8[v.blendDst],G8[v.blendSrcAlpha],G8[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&cc.R)!==cc.NONE,(v.blendColorMask&cc.G)!==cc.NONE,(v.blendColorMask&cc.B)!==cc.NONE,(v.blendColorMask&cc.A)!==cc.NONE),y.blendColorMask=v.blendColorMask)}}if(e&&e.gpuPipelineLayout&&c){for(var T=c.glBlocks.length,S=e.gpuPipelineLayout.dynamicOffsetIndices,E=0;E<T;E++){var A=c.glBlocks[E],R=n[A.set],b=R&&R.descriptorIndices[A.binding],C=b>=0&&R.gpuDescriptors[b],w=null,x=0;if(C&&C.gpuBuffer){var I=C.gpuBuffer,O=S[A.set],D=O&&O[A.binding];D>=0&&(x=r[D]),"vf32"in I?w=I.vf32:(x+=I.offset,w=I.gpuBuffer.vf32),x>>=2}if(w)for(var M=A.glActiveUniforms.length,P=0;P<M;P++){var B=A.glActiveUniforms[P];switch(B.glType){case u.BOOL:case u.INT:for(var N=0;N<B.array.length;++N){var L=B.offset+x+N;if(w[L]!==B.array[N]){for(var F=N,k=L;F<B.array.length;++F,++k)B.array[F]=w[k];u.uniform1iv(B.glLoc,B.array);break}}break;case u.BOOL_VEC2:case u.INT_VEC2:for(var U=0;U<B.array.length;++U){var G=B.offset+x+U;if(w[G]!==B.array[U]){for(var H=U,z=G;H<B.array.length;++H,++z)B.array[H]=w[z];u.uniform2iv(B.glLoc,B.array);break}}break;case u.BOOL_VEC3:case u.INT_VEC3:for(var V=0;V<B.array.length;++V){var W=B.offset+x+V;if(w[W]!==B.array[V]){for(var X=V,j=W;X<B.array.length;++X,++j)B.array[X]=w[j];u.uniform3iv(B.glLoc,B.array);break}}break;case u.BOOL_VEC4:case u.INT_VEC4:for(var Y=0;Y<B.array.length;++Y){var K=B.offset+x+Y;if(w[K]!==B.array[Y]){for(var q=Y,Q=K;q<B.array.length;++q,++Q)B.array[q]=w[Q];u.uniform4iv(B.glLoc,B.array);break}}break;case u.FLOAT:for(var Z=0;Z<B.array.length;++Z){var J=B.offset+x+Z;if(w[J]!==B.array[Z]){for(var $=Z,tt=J;$<B.array.length;++$,++tt)B.array[$]=w[tt];u.uniform1fv(B.glLoc,B.array);break}}break;case u.FLOAT_VEC2:for(var et=0;et<B.array.length;++et){var it=B.offset+x+et;if(w[it]!==B.array[et]){for(var nt=et,rt=it;nt<B.array.length;++nt,++rt)B.array[nt]=w[rt];u.uniform2fv(B.glLoc,B.array);break}}break;case u.FLOAT_VEC3:for(var st=0;st<B.array.length;++st){var at=B.offset+x+st;if(w[at]!==B.array[st]){for(var ot=st,ht=at;ot<B.array.length;++ot,++ht)B.array[ot]=w[ht];u.uniform3fv(B.glLoc,B.array);break}}break;case u.FLOAT_VEC4:for(var ut=0;ut<B.array.length;++ut){var lt=B.offset+x+ut;if(w[lt]!==B.array[ut]){for(var ct=ut,_t=lt;ct<B.array.length;++ct,++_t)B.array[ct]=w[_t];u.uniform4fv(B.glLoc,B.array);break}}break;case u.FLOAT_MAT2:for(var dt=0;dt<B.array.length;++dt){var ft=B.offset+x+dt;if(w[ft]!==B.array[dt]){for(var pt=dt,mt=ft;pt<B.array.length;++pt,++mt)B.array[pt]=w[mt];u.uniformMatrix2fv(B.glLoc,!1,B.array);break}}break;case u.FLOAT_MAT3:for(var gt=0;gt<B.array.length;++gt){var vt=B.offset+x+gt;if(w[vt]!==B.array[gt]){for(var yt=gt,Tt=vt;yt<B.array.length;++yt,++Tt)B.array[yt]=w[Tt];u.uniformMatrix3fv(B.glLoc,!1,B.array);break}}break;case u.FLOAT_MAT4:for(var St=0;St<B.array.length;++St){var Et=B.offset+x+St;if(w[Et]!==B.array[St]){for(var At=St,Rt=Et;At<B.array.length;++At,++Rt)B.array[At]=w[Rt];u.uniformMatrix4fv(B.glLoc,!1,B.array);break}}}}}for(var bt=c.glSamplerTextures.length,Ct=0;Ct<bt;Ct++)for(var wt=c.glSamplerTextures[Ct],xt=n[wt.set],It=xt&&xt.descriptorIndices[wt.binding],Ot=It>=0&&xt.gpuDescriptors[It],Dt=wt.units.length,Mt=0;Mt<Dt;Mt++){var Pt=wt.units[Mt];if(Ot&&Ot.gpuSampler){if(Ot.gpuTexture&&Ot.gpuTexture.size>0){var Bt=Ot.gpuTexture,Nt=l.glTexUnits[Pt];Nt.glTexture!==Bt.glTexture&&(l.texUnit!==Pt&&(u.activeTexture(u.TEXTURE0+Pt),l.texUnit=Pt),Bt.glTexture?u.bindTexture(Bt.glTarget,Bt.glTexture):u.bindTexture(Bt.glTarget,t.nullTex2D.gpuTexture.glTexture),Nt.glTexture=Bt.glTexture);var Lt=Ot.gpuSampler;Bt.isPowerOf2?(a=Lt.glWrapS,o=Lt.glWrapT):(a=u.CLAMP_TO_EDGE,o=u.CLAMP_TO_EDGE),h=Bt.isPowerOf2?Bt.mipLevel<=1&&(Lt.glMinFilter===u.LINEAR_MIPMAP_NEAREST||Lt.glMinFilter===u.LINEAR_MIPMAP_LINEAR)?u.LINEAR:Lt.glMinFilter:Lt.glMinFilter===u.LINEAR||Lt.glMinFilter===u.LINEAR_MIPMAP_NEAREST||Lt.glMinFilter===u.LINEAR_MIPMAP_LINEAR?u.LINEAR:u.NEAREST,Bt.glWrapS!==a&&(l.texUnit!==Pt&&(u.activeTexture(u.TEXTURE0+Pt),l.texUnit=Pt),u.texParameteri(Bt.glTarget,u.TEXTURE_WRAP_S,a),Bt.glWrapS=a),Bt.glWrapT!==o&&(l.texUnit!==Pt&&(u.activeTexture(u.TEXTURE0+Pt),l.texUnit=Pt),u.texParameteri(Bt.glTarget,u.TEXTURE_WRAP_T,o),Bt.glWrapT=o),Bt.glMinFilter!==h&&(l.texUnit!==Pt&&(u.activeTexture(u.TEXTURE0+Pt),l.texUnit=Pt),u.texParameteri(Bt.glTarget,u.TEXTURE_MIN_FILTER,h),Bt.glMinFilter=h),Bt.glMagFilter!==Lt.glMagFilter&&(l.texUnit!==Pt&&(u.activeTexture(u.TEXTURE0+Pt),l.texUnit=Pt),u.texParameteri(Bt.glTarget,u.TEXTURE_MAG_FILTER,Lt.glMagFilter),Bt.glMagFilter=Lt.glMagFilter)}Ot=xt.gpuDescriptors[++It]}}}if(i&&c&&(_||i6.gpuInputAssembler!==i)){i6.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(c.glProgram);if(!Ut){var Gt;Ut=kt.createVertexArrayOES(),i.glVAOs.set(c.glProgram,Ut),kt.bindVertexArrayOES(Ut),u.bindBuffer(u.ARRAY_BUFFER,null),u.bindBuffer(u.ELEMENT_ARRAY_BUFFER,null),l.glArrayBuffer=null,l.glElementArrayBuffer=null;for(var Ht=c.glInputs.length,zt=0;zt<Ht;zt++){var Vt=c.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){l.glArrayBuffer!==Gt.glBuffer&&(u.bindBuffer(u.ARRAY_BUFFER,Gt.glBuffer),l.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),l.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),l.glArrayBuffer=null,l.glElementArrayBuffer=null}l.glVAO!==Ut&&(kt.bindVertexArrayOES(Ut),l.glVAO=Ut)}else{for(var Zt=0;Zt<t.capabilities.maxVertexAttributes;++Zt)l.glCurrentAttribLocs[Zt]=!1;for(var Jt=c.glInputs.length,$t=0;$t<Jt;$t++){for(var te=c.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){l.glArrayBuffer!==ee.glBuffer&&(u.bindBuffer(u.ARRAY_BUFFER,ee.glBuffer),l.glArrayBuffer=ee.glBuffer);for(var se=0;se<ee.componentCount;++se){var ae=te.glLoc+se,oe=ee.offset+ee.size*se;!l.glEnabledAttribLocs[ae]&&ae>=0&&(u.enableVertexAttribArray(ae),l.glEnabledAttribLocs[ae]=!0),l.glCurrentAttribLocs[ae]=!0,u.vertexAttribPointer(ae,ee.count,ee.glType,ee.isNormalized,ee.stride,oe),Ft&&Ft.vertexAttribDivisorANGLE(ae,ee.isInstanced?1:0)}}}var he=i.gpuIndexBuffer;he&&l.glElementArrayBuffer!==he.glBuffer&&(u.bindBuffer(u.ELEMENT_ARRAY_BUFFER,he.glBuffer),l.glElementArrayBuffer=he.glBuffer);for(var ue=0;ue<t.capabilities.maxVertexAttributes;++ue)l.glEnabledAttribLocs[ue]!==l.glCurrentAttribLocs[ue]&&(u.disableVertexAttribArray(ue),l.glEnabledAttribLocs[ue]=!1)}}if(e&&e.dynamicStates.length)for(var le=e.dynamicStates.length,ce=0;ce<le;ce++)switch(e.dynamicStates[ce]){case Ec.LINE_WIDTH:l.rs.lineWidth!==s.lineWidth&&(u.lineWidth(s.lineWidth),l.rs.lineWidth=s.lineWidth);break;case Ec.DEPTH_BIAS:l.rs.depthBias===s.depthBiasConstant&&l.rs.depthBiasSlop===s.depthBiasSlope||(u.polygonOffset(s.depthBiasConstant,s.depthBiasSlope),l.rs.depthBias=s.depthBiasConstant,l.rs.depthBiasSlop=s.depthBiasSlope);break;case Ec.BLEND_CONSTANTS:var _e=s.blendConstant;l.bs.blendColor.x===_e.x&&l.bs.blendColor.y===_e.y&&l.bs.blendColor.z===_e.z&&l.bs.blendColor.w===_e.w||(u.blendColor(_e.x,_e.y,_e.z,_e.w),l.bs.blendColor.copy(_e));break;case Ec.STENCIL_WRITE_MASK:var de=s.stencilStatesFront,fe=s.stencilStatesBack;l.dss.stencilWriteMaskFront!==de.writeMask&&(u.stencilMaskSeparate(u.FRONT,de.writeMask),l.dss.stencilWriteMaskFront=de.writeMask),l.dss.stencilWriteMaskBack!==fe.writeMask&&(u.stencilMaskSeparate(u.BACK,fe.writeMask),l.dss.stencilWriteMaskBack=fe.writeMask);break;case Ec.STENCIL_COMPARE_MASK:var pe=s.stencilStatesFront,me=s.stencilStatesBack;l.dss.stencilRefFront===pe.reference&&l.dss.stencilReadMaskFront===pe.compareMask||(u.stencilFuncSeparate(u.FRONT,F8[l.dss.stencilFuncFront],pe.reference,pe.compareMask),l.dss.stencilRefFront=pe.reference,l.dss.stencilReadMaskFront=pe.compareMask),l.dss.stencilRefBack===me.reference&&l.dss.stencilReadMaskBack===me.compareMask||(u.stencilFuncSeparate(u.BACK,F8[l.dss.stencilFuncBack],me.reference,me.compareMask),l.dss.stencilRefBack=me.reference,l.dss.stencilReadMaskBack=me.compareMask)}}function a6(t,e){var i=t.gl,n=t.extensions,r=n.ANGLE_instanced_arrays,s=n.WEBGL_multi_draw,a=i6.gpuInputAssembler,o=i6.glPrimitive;if(a){var h=a.gpuIndexBuffer;if(a.gpuIndirectBuffer){var u=a.gpuIndirectBuffer.indirects;if(u.drawByIndex){for(var l=0;l<u.drawCount;l++)u.byteOffsets[l]=u.offsets[l]*h.stride;if(s)u.instancedDraw?s.multiDrawElementsInstancedWEBGL(o,u.counts,0,a.glIndexType,u.byteOffsets,0,u.instances,0,u.drawCount):s.multiDrawElementsWEBGL(o,u.counts,0,a.glIndexType,u.byteOffsets,0,u.drawCount);else for(var c=0;c<u.drawCount;c++)u.instances[c]&&r?r.drawElementsInstancedANGLE(o,u.counts[c],a.glIndexType,u.byteOffsets[c],u.instances[c]):i.drawElements(o,u.counts[c],a.glIndexType,u.byteOffsets[c])}else if(s)u.instancedDraw?s.multiDrawArraysInstancedWEBGL(o,u.offsets,0,u.counts,0,u.instances,0,u.drawCount):s.multiDrawArraysWEBGL(o,u.offsets,0,u.counts,0,u.drawCount);else for(var _=0;_<u.drawCount;_++)u.instances[_]&&r?r.drawArraysInstancedANGLE(o,u.offsets[_],u.counts[_],u.instances[_]):i.drawArrays(o,u.offsets[_],u.counts[_])}else if(e.instanceCount&&r)if(h){if(e.indexCount>0){var d=e.firstIndex*h.stride;r.drawElementsInstancedANGLE(o,e.indexCount,a.glIndexType,d,e.instanceCount)}}else e.vertexCount>0&&r.drawArraysInstancedANGLE(o,e.firstVertex,e.vertexCount,e.instanceCount);else if(h){if(e.indexCount>0){var f=e.firstIndex*h.stride;i.drawElements(o,e.indexCount,a.glIndexType,f)}}else e.vertexCount>0&&i.drawArrays(o,e.firstVertex,e.vertexCount)}}var o6=new Array(L8.COUNT);function h6(t,e){o6.fill(0);for(var i=0;i<e.cmds.length;++i){var n=e.cmds.array[i],r=o6[n]++;switch(n){case L8.BEGIN_RENDER_PASS:var s=e.beginRenderPassCmds.array[r];r6(t,s.gpuRenderPass,s.gpuFramebuffer,s.renderArea,s.clearColors,s.clearDepth,s.clearStencil);break;case L8.BIND_STATES:var a=e.bindStatesCmds.array[r];s6(t,a.gpuPipelineState,a.gpuInputAssembler,a.gpuDescriptorSets,a.dynamicOffsets,a.dynamicStates);break;case L8.DRAW:a6(t,e.drawCmds.array[r].drawInfo);break;case L8.UPDATE_BUFFER:var o=e.updateBufferCmds.array[r];Z8(t,o.gpuBuffer,o.buffer,o.offset,o.size);break;case L8.COPY_BUFFER_TO_TEXTURE:var h=e.copyBufferToTextureCmds.array[r];c6(t,h.buffers,h.gpuTexture,h.regions);break;case L8.BLIT_TEXTURE:var u=e.blitTextureCmds.array[r];_6(t,u.srcTexture,u.dstTexture,u.regions,u.filter)}}}var u6=new Uint8Array(1);function l6(t,e,i,n,r){var s=Y_(e).height,a=z_(e,r.width,r.height,r.depth),o=z_(e,n.width,1,1),h=z_(e,n.width,n.height,1),u=z_(e,r.width,1,1),l=j_(F_[e]);u6.byteLength<a&&(u6=new Uint8Array(a));for(var c=0,_=i,d=0;d<r.depth;d++){_=i+h*d;for(var f=0;f<r.height;f+=s)u6.subarray(c,c+u).set(new Uint8Array(t.buffer,t.byteOffset+_,u)),c+=u,_+=o}var p=a/l.BYTES_PER_ELEMENT;return tt(Number.isInteger(p),9101),new l(u6.buffer,0,p)}function c6(t,e,i,n){var r=t.gl,s=t.stateCache.glTexUnits[t.stateCache.texUnit];s.glTexture!==i.glTexture&&(r.bindTexture(i.glTarget,i.glTexture),s.glTexture=i.glTexture);var a=0,o=0,h=F_[i.format],u=j_(h),l=h.isCompressed,c=Y_(i.format),_=new kc,d=new Lc,f=new kc;switch(i.glTarget){case r.TEXTURE_2D:for(var p=0;p<n.length;p++){var m=n[p],g=m.texSubres.mipLevel;d.x=0===m.texOffset.x?0:K_(m.texOffset.x,c.width),d.y=0===m.texOffset.y?0:K_(m.texOffset.y,c.height),_.width=m.texExtent.width<c.width?m.texExtent.width:K_(m.texExtent.width,c.width),_.height=m.texExtent.height<c.height?m.texExtent.width:K_(m.texExtent.height,c.height),f.width=m.buffStride>0?m.buffStride:_.width,f.height=m.buffTexHeight>0?m.buffTexHeight:_.height;var v=m.texExtent.width+d.x===i.width>>g?m.texExtent.width:_.width,y=m.texExtent.height+d.y===i.height>>g?m.texExtent.height:_.height,T=void 0,S=e[a++];if(f.width===_.width&&f.height===_.height){var E=z_(i.format,v,y,1)/u.BYTES_PER_ELEMENT;tt(Number.isInteger(E),9101),T=new u(S.buffer,S.byteOffset+m.buffOffset,E)}else T=l6(S,i.format,m.buffOffset,f,_);l?i.glInternalFmt===w8.COMPRESSED_RGB_ETC1_WEBGL||t.extensions.noCompressedTexSubImage2D?r.compressedTexImage2D(r.TEXTURE_2D,g,i.glInternalFmt,v,y,0,T):r.compressedTexSubImage2D(r.TEXTURE_2D,g,d.x,d.y,v,y,i.glFormat,T):r.texSubImage2D(r.TEXTURE_2D,g,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 R=n[A],b=R.texSubres.mipLevel;d.x=0===R.texOffset.x?0:K_(R.texOffset.x,c.width),d.y=0===R.texOffset.y?0:K_(R.texOffset.y,c.height),_.width=R.texExtent.width<c.width?R.texExtent.width:K_(R.texExtent.width,c.width),_.height=R.texExtent.height<c.height?R.texExtent.width:K_(R.texExtent.height,c.height),f.width=R.buffStride>0?R.buffStride:_.width,f.height=R.buffTexHeight>0?R.buffTexHeight:_.height;var C=R.texExtent.width+d.x===i.width>>b?R.texExtent.width:_.width,w=R.texExtent.height+d.y===i.height>>b?R.texExtent.height:_.height,x=R.texSubres.baseArrayLayer+R.texSubres.layerCount;for(o=R.texSubres.baseArrayLayer;o<x;++o){var I=void 0,O=e[a++];if(f.width===_.width&&f.height===_.height){var D=z_(i.format,C,w,1)/u.BYTES_PER_ELEMENT;tt(Number.isInteger(D),9101),I=new u(O.buffer,O.byteOffset+R.buffOffset,D)}else I=l6(O,i.format,R.buffOffset,f,_);l?i.glInternalFmt===w8.COMPRESSED_RGB_ETC1_WEBGL||t.extensions.noCompressedTexSubImage2D?r.compressedTexImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+o,b,i.glInternalFmt,C,w,0,I):r.compressedTexSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+o,b,d.x,d.y,C,w,i.glFormat,I):r.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+o,b,d.x,d.y,C,w,i.glFormat,i.glType,I)}}break;default:G("Unsupported GL texture type, copy buffer to texture failed.")}i.flags&ec.GEN_MIPMAP&&r.generateMipmap(i.glTarget)}function _6(t,e,i,n,r){t.blitManager.draw(e,i,n,r)}var d6=function(){function t(){this.counts=void 0,this.offsets=void 0,this.instances=void 0,this.drawCount=0,this.drawByIndex=!1,this.instancedDraw=!1,this.byteOffsets=void 0,this._capacity=4,this.counts=new Int32Array(this._capacity),this.offsets=new Int32Array(this._capacity),this.instances=new Int32Array(this._capacity),this.byteOffsets=new Int32Array(this._capacity)}var e=t.prototype;return e.clearDraws=function(){this.drawCount=0,this.drawByIndex=!1,this.instancedDraw=!1},e.setDrawInfo=function(t,e){this._ensureCapacity(t),this.drawByIndex=e.indexCount>0,this.instancedDraw=!!e.instanceCount,this.drawCount=Math.max(t+1,this.drawCount),this.drawByIndex?(this.counts[t]=e.indexCount,this.offsets[t]=e.firstIndex):(this.counts[t]=e.vertexCount,this.offsets[t]=e.firstVertex),this.instances[t]=Math.max(1,e.instanceCount)},e._ensureCapacity=function(t){if(!(this._capacity>t)){this._capacity=Hi(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}(),f6=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=I8.instance.gl,e=I8.instance.bindingMappingInfo.maxBlockCounts[0];this._gpuShader={name:"Blit Pass",blocks:[new r_(0,0,"BlitParams",[new n_("tilingOffsetSrc",Kl.FLOAT4,1),new n_("tilingOffsetDst",Kl.FLOAT4,1)],1)],samplerTextures:[new s_(0,e,"textureSrc",Kl.SAMPLER2D,1)],subpassInputs:[],gpuStages:[{type:_c.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:_c.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:[]},J8(I8.instance,this._gpuShader),this._gpuDescriptorSetLayout={bindings:[new R_(0,Rc.UNIFORM_BUFFER,1,_c.VERTEX),new R_(e,Rc.SAMPLER_TEXTURE,1,_c.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 od(!1,!1),bs:null,dynamicStates:[],gpuRenderPass:null},this._gpuVertexBuffer={usage:ql.VERTEX,memUsage:Jl.DEVICE,size:16*Float32Array.BYTES_PER_ELEMENT,stride:4*Float32Array.BYTES_PER_ELEMENT,buffer:null,vf32:null,indirects:new d6,glTarget:0,glBuffer:null},q8(I8.instance,this._gpuVertexBuffer),I8.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]);Z8(I8.instance,this._gpuVertexBuffer,n,0,n.length),this._gpuInputAssembler={attributes:[new __("a_position",jl.RG32F),new __("a_texCoord",jl.RG32F)],gpuVertexBuffers:[this._gpuVertexBuffer],gpuIndexBuffer:null,gpuIndirectBuffer:null,glAttribs:[],glIndexType:0,glVAOs:new Map},t6(I8.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:ql.UNIFORM,memUsage:Jl.DEVICE,size:8*Float32Array.BYTES_PER_ELEMENT,stride:8*Float32Array.BYTES_PER_ELEMENT,buffer:this._uniformBuffer,vf32:null,indirects:new d6,glTarget:0,glBuffer:null},q8(I8.instance,this._gpuUniformBuffer),I8.instance.memoryStatus.bufferSize+=this._gpuUniformBuffer.size,this._gpuDescriptorSet={gpuDescriptors:[{type:Rc.UNIFORM_BUFFER,gpuBuffer:this._gpuUniformBuffer,gpuTexture:null,gpuSampler:null},{type:Rc.SAMPLER_TEXTURE,gpuBuffer:null,gpuTexture:null,gpuSampler:null}],descriptorIndices:this._gpuDescriptorSetLayout.descriptorIndices},this._drawInfo=new Zc(4,0,0,0,0,0,0),this._glFramebuffer=I8.instance.gl.createFramebuffer()}var e=t.prototype;return e.destroy=function(){this._glFramebuffer&&(I8.instance.gl.deleteFramebuffer(this._glFramebuffer),this._glFramebuffer=null),this._gpuVertexBuffer&&(I8.instance.memoryStatus.bufferSize-=this._gpuVertexBuffer.size,Q8(I8.instance,this._gpuVertexBuffer)),this._gpuUniformBuffer&&(I8.instance.memoryStatus.bufferSize-=this._gpuUniformBuffer.size,Q8(I8.instance,this._gpuUniformBuffer)),this._gpuShader&&$8(I8.instance,this._gpuShader),this._gpuInputAssembler&&e6(I8.instance,this._gpuInputAssembler)},e.draw=function(t,e,i,n){var r=I8.instance,s=r.gl,a=r.stateCache,o=a.glFramebuffer;if(s.viewport(0,0,e.width,e.height),s.scissor(0,0,e.width,e.height),this._uniformBuffer&&this._gpuUniformBuffer&&this._gpuPipelineState&&this._gpuInputAssembler&&this._gpuDescriptorSet&&this._drawInfo){var h=this._gpuDescriptorSet.gpuDescriptors[1];h.gpuTexture=t,h.gpuSampler=n===sc.POINT?this._gpuPointSampler:this._gpuLinearSampler;var u=F_[e.format],l=s.COLOR_ATTACHMENT0;u.hasStencil?l=s.DEPTH_STENCIL_ATTACHMENT:u.hasDepth&&(l=s.DEPTH_ATTACHMENT);var c=i.map((function(t,e){return e}));c.sort((function(t,e){return i[t].srcSubres.mipLevel-i[e].srcSubres.mipLevel})),a.glFramebuffer!==this._glFramebuffer&&(r.gl.bindFramebuffer(r.gl.FRAMEBUFFER,this._glFramebuffer),a.glFramebuffer=this._glFramebuffer);var _=i[0].dstSubres.mipLevel;e.glTexture?s.framebufferTexture2D(s.FRAMEBUFFER,l,e.glTarget,e.glTexture,_):s.framebufferRenderbuffer(s.FRAMEBUFFER,l,s.RENDERBUFFER,e.glRenderbuffer);for(var d=0;d<c.length;++d){var f=i[c[d]];t.glTexture&&_!==f.srcSubres.mipLevel&&(_=f.srcSubres.mipLevel,s.framebufferTexture2D(s.FRAMEBUFFER,l,e.glTarget,e.glTexture,_));var p=t.width,m=t.height,g=e.width,v=e.height;this._uniformBuffer[0]=f.srcExtent.width/p,this._uniformBuffer[1]=f.srcExtent.height/m,this._uniformBuffer[2]=f.srcOffset.x/p,this._uniformBuffer[3]=f.srcOffset.y/m,this._uniformBuffer[4]=f.dstExtent.width/g,this._uniformBuffer[5]=f.dstExtent.height/v,this._uniformBuffer[6]=f.dstOffset.x/g,this._uniformBuffer[7]=f.dstOffset.y/v,Z8(r,this._gpuUniformBuffer,this._uniformBuffer,0,this._uniformBuffer.length*Float32Array.BYTES_PER_ELEMENT),s6(r,this._gpuPipelineState,this._gpuInputAssembler,[this._gpuDescriptorSet],[],null),a6(r,this._drawInfo)}a.glFramebuffer!==o&&(r.gl.bindFramebuffer(r.gl.FRAMEBUFFER,o),a.glFramebuffer=o);var y=a.viewport;s.viewport(y.left,y.top,y.width,y.height);var T=a.scissorRect;s.scissor(T.x,T.y,T.width,T.height)}},t}(),p6=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._gpuBuffer=null,e._gpuBufferView=null,e._uniformBuffer=null,e}s(e,t);var i=e.prototype;return i.initialize=function(t){if("buffer"in t){this._isBufferView=!0;var e=t.buffer;this._usage=e.usage,this._memUsage=e.memUsage,this._size=this._stride=t.range,this._count=1,this._flags=e.flags,this._gpuBufferView={gpuBuffer:e.gpuBuffer,offset:t.offset,range:t.range}}else this._usage=t.usage,this._memUsage=t.memUsage,this._size=t.size,this._stride=Math.max(t.stride||this._size,1),this._count=this._size/this._stride,this._flags=t.flags,this._usage&ql.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 d6,glTarget:0,glBuffer:null},this._usage&ql.UNIFORM&&(this._gpuBuffer.buffer=this._uniformBuffer),q8(I8.instance,this._gpuBuffer),I8.instance.memoryStatus.bufferSize+=this._size},i.destroy=function(){this._gpuBuffer&&(Q8(I8.instance,this._gpuBuffer),I8.instance.memoryStatus.bufferSize-=this._size,this._gpuBuffer=null),this._gpuBufferView&&(this._gpuBufferView=null)},i.resize=function(t){if(this._isBufferView)console.warn("cannot resize buffer views!");else{var e=this._size;e!==t&&(this._size=t,this._count=this._size/this._stride,this._uniformBuffer&&(this._uniformBuffer=new Uint8Array(t)),this._gpuBuffer&&(this._uniformBuffer&&(this._gpuBuffer.buffer=this._uniformBuffer),this._gpuBuffer.size=t,t>0&&(function(t,e){var i=t.gl,n=t.stateCache,r=e.memUsage&Jl.HOST?i.DYNAMIC_DRAW:i.STATIC_DRAW;e.usage&ql.VERTEX?(t.extensions.useVAO&&n.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),n.glVAO=null),i6.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&ql.INDEX?(t.extensions.useVAO&&n.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),n.glVAO=null),i6.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&ql.UNIFORM?e.buffer&&(e.vf32=new Float32Array(e.buffer.buffer)):(e.usage&ql.INDIRECT||e.usage&ql.TRANSFER_DST||e.usage&ql.TRANSFER_SRC||G("Unsupported BufferType, create buffer failed."),e.glTarget=i.NONE)}(I8.instance,this._gpuBuffer),I8.instance.memoryStatus.bufferSize-=e,I8.instance.memoryStatus.bufferSize+=t)))}},i.update=function(t,e){var i;this._isBufferView?console.warn("cannot update through buffer views!"):(i=void 0!==e?e:this._usage&ql.INDIRECT?0:t.byteLength,Z8(I8.instance,this._gpuBuffer,t,0,i))},n(e,[{key:"gpuBuffer",get:function(){return this._gpuBuffer}},{key:"gpuBufferView",get:function(){return this._gpuBufferView}}]),e}(Q_),m6=function(){function t(t,e){this._frees=void 0,this._freeIdx=0,this._freeCmds=void 0,this._frees=new Array(e),this._freeCmds=new Nu(e);for(var i=0;i<e;++i)this._frees[i]=new t;this._freeIdx=e-1}var e=t.prototype;return e.alloc=function(t){if(this._freeIdx<0){var e=2*this._frees.length,i=this._frees;this._frees=new Array(e);for(var n=e-i.length,r=0;r<n;++r)this._frees[r]=new t;for(var s=n,a=0;s<e;++s,++a)this._frees[s]=i[a];this._freeIdx+=n}var o=this._frees[this._freeIdx];return this._frees[this._freeIdx--]=null,++o.refCount,o},e.free=function(t){0==--t.refCount&&this._freeCmds.push(t)},e.freeCmds=function(t){for(var e=0;e<t.length;++e)0==--t.array[e].refCount&&this._freeCmds.push(t.array[e])},e.release=function(){for(var t=0;t<this._freeCmds.length;++t){var e=this._freeCmds.array[t];e.clear(),this._frees[++this._freeIdx]=e}this._freeCmds.clear()},t}(),g6=function(){function t(){this.beginRenderPassCmdPool=void 0,this.bindStatesCmdPool=void 0,this.drawCmdPool=void 0,this.updateBufferCmdPool=void 0,this.copyBufferToTextureCmdPool=void 0,this.blitTextureCmdPool=void 0,this.beginRenderPassCmdPool=new m6(z8,1),this.bindStatesCmdPool=new m6(V8,1),this.drawCmdPool=new m6(W8,1),this.updateBufferCmdPool=new m6(X8,1),this.copyBufferToTextureCmdPool=new m6(j8,1),this.blitTextureCmdPool=new m6(Y8,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}(),v6=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).cmdPackage=new K8,e._cmdAllocator=new g6,e._isInRenderPass=!1,e._curGPUPipelineState=null,e._curGPUInputAssembler=null,e._curGPUDescriptorSets=[],e._curDynamicOffsets=Array(8).fill(0),e._curDynamicStates=new N_,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=I8.instance.bindingMappings.blockOffsets.length,i=0;i<e;i++)this._curGPUDescriptorSets.push(null)},i.destroy=function(){this._cmdAllocator.clearCmds(this.cmdPackage)},i.begin=function(){this._cmdAllocator.clearCmds(this.cmdPackage),this._curGPUPipelineState=null,this._curGPUInputAssembler=null,this._curGPUDescriptorSets.length=0,this._numDrawCalls=0,this._numInstances=0,this._numTris=0},i.end=function(){this._isStateInvalied&&this.bindStates(),this._isInRenderPass=!1},i.beginRenderPass=function(t,e,i,n,r,s){var a=this._cmdAllocator.beginRenderPassCmdPool.alloc(z8);a.gpuRenderPass=t.gpuRenderPass,a.gpuFramebuffer=e.gpuFramebuffer,a.renderArea.copy(i),a.clearColors.length=n.length;for(var o=0;o<n.length;++o)a.clearColors[o]=n[o];a.clearDepth=r,a.clearStencil=s,this.cmdPackage.beginRenderPassCmds.push(a),this.cmdPackage.cmds.push(L8.BEGIN_RENDER_PASS),this._isInRenderPass=!0},i.endRenderPass=function(){this._isInRenderPass=!1},i.bindPipelineState=function(t){var e=t.gpuPipelineState;e!==this._curGPUPipelineState&&(this._curGPUPipelineState=e,this._isStateInvalied=!0)},i.bindDescriptorSet=function(t,e,i){var n=e.gpuDescriptorSet;if(n!==this._curGPUDescriptorSets[t]&&(this._curGPUDescriptorSets[t]=n,this._isStateInvalied=!0),i){var r,s=null===(r=this._curGPUPipelineState)||void 0===r?void 0:r.gpuPipelineLayout;if(s){for(var a=this._curDynamicOffsets,o=s.dynamicOffsetOffsets[t],h=0;h<i.length;h++)a[o+h]=i[h];this._isStateInvalied=!0}}},i.bindInputAssembler=function(t){var e=t.gpuInputAssembler;this._curGPUInputAssembler=e,this._isStateInvalied=!0},i.setViewport=function(t){var e=this._curDynamicStates.viewport;e.left===t.left&&e.top===t.top&&e.width===t.width&&e.height===t.height&&e.minDepth===t.minDepth&&e.maxDepth===t.maxDepth||(e.left=t.left,e.top=t.top,e.width=t.width,e.height=t.height,e.minDepth=t.minDepth,e.maxDepth=t.maxDepth,this._isStateInvalied=!0)},i.setScissor=function(t){var e=this._curDynamicStates.scissor;e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height||(e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height,this._isStateInvalied=!0)},i.setLineWidth=function(t){this._curDynamicStates.lineWidth!==t&&(this._curDynamicStates.lineWidth=t,this._isStateInvalied=!0)},i.setDepthBias=function(t,e,i){var n=this._curDynamicStates;n.depthBiasConstant===t&&n.depthBiasClamp===e&&n.depthBiasSlope===i||(n.depthBiasConstant=t,n.depthBiasClamp=e,n.depthBiasSlope=i,this._isStateInvalied=!0)},i.setBlendConstants=function(t){var e=this._curDynamicStates.blendConstant;e.x===t.x&&e.y===t.y&&e.z===t.z&&e.w===t.w||(e.copy(t),this._isStateInvalied=!0)},i.setDepthBound=function(t,e){var i=this._curDynamicStates;i.depthMinBounds===t&&i.depthMaxBounds===e||(i.depthMinBounds=t,i.depthMaxBounds=e,this._isStateInvalied=!0)},i.setStencilWriteMask=function(t,e){var i=this._curDynamicStates.stencilStatesFront,n=this._curDynamicStates.stencilStatesBack;t&Ac.FRONT&&i.writeMask!==e&&(i.writeMask=e,this._isStateInvalied=!0),t&Ac.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&Ac.FRONT&&(n.compareMask===i&&n.reference===e||(n.reference=e,n.compareMask=i,this._isStateInvalied=!0)),t&Ac.BACK&&(r.compareMask===i&&r.reference===e||(r.reference=e,r.compareMask=i,this._isStateInvalied=!0))},i.draw=function(t){if(this._type===wc.PRIMARY&&this._isInRenderPass||this._type===wc.SECONDARY){this._isStateInvalied&&this.bindStates();var e="drawInfo"in t?t.drawInfo:t,i=this._cmdAllocator.drawCmdPool.alloc(W8);i.drawInfo.copy(e),this.cmdPackage.drawCmds.push(i),this.cmdPackage.cmds.push(L8.DRAW),++this._numDrawCalls,this._numInstances+=e.instanceCount;var n=e.indexCount||e.vertexCount;if(this._curGPUPipelineState)switch(this._curGPUPipelineState.glPrimitive){case 4:this._numTris+=n/3*Math.max(e.instanceCount,1);break;case 5:case 6:this._numTris+=(n-2)*Math.max(e.instanceCount,1)}}else console.error("Command 'draw' must be recorded inside a render pass.")},i.updateBuffer=function(t,e,i){if(this._type===wc.PRIMARY&&!this._isInRenderPass||this._type===wc.SECONDARY){var n=t.gpuBuffer;if(n){var r,s=this._cmdAllocator.updateBufferCmdPool.alloc(X8),a=0;t.usage&ql.INDIRECT||(a=void 0!==i?i:e.byteLength),r=e,s.gpuBuffer=n,s.buffer=r,s.offset=0,s.size=a,this.cmdPackage.updateBufferCmds.push(s),this.cmdPackage.cmds.push(L8.UPDATE_BUFFER)}}else console.error("Command 'updateBuffer' must be recorded outside a render pass.")},i.copyBuffersToTexture=function(t,e,i){if(this._type===wc.PRIMARY&&!this._isInRenderPass||this._type===wc.SECONDARY){var n=e.gpuTexture;if(n){var r=this._cmdAllocator.copyBufferToTextureCmdPool.alloc(j8);r&&(r.gpuTexture=n,r.regions=i,r.buffers=t,this.cmdPackage.copyBufferToTextureCmds.push(r),this.cmdPackage.cmds.push(L8.COPY_BUFFER_TO_TEXTURE))}}else console.error("Command 'copyBufferToTexture' must be recorded outside a render pass.")},i.execute=function(t,e){for(var i=0;i<e;++i){for(var n=t[i],r=0;r<n.cmdPackage.beginRenderPassCmds.length;++r){var s=n.cmdPackage.beginRenderPassCmds.array[r];++s.refCount,this.cmdPackage.beginRenderPassCmds.push(s)}for(var a=0;a<n.cmdPackage.bindStatesCmds.length;++a){var o=n.cmdPackage.bindStatesCmds.array[a];++o.refCount,this.cmdPackage.bindStatesCmds.push(o)}for(var h=0;h<n.cmdPackage.drawCmds.length;++h){var u=n.cmdPackage.drawCmds.array[h];++u.refCount,this.cmdPackage.drawCmds.push(u)}for(var l=0;l<n.cmdPackage.updateBufferCmds.length;++l){var c=n.cmdPackage.updateBufferCmds.array[l];++c.refCount,this.cmdPackage.updateBufferCmds.push(c)}for(var _=0;_<n.cmdPackage.copyBufferToTextureCmds.length;++_){var 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(V8);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(L8.BIND_STATES),this._isStateInvalied=!1)},i.blitTexture=function(t,e,i,n){var r=this._cmdAllocator.blitTextureCmdPool.alloc(Y8);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(L8.BLIT_TEXTURE)},e}(Z_),y6=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._gpuFramebuffer=null,e}s(e,t);var i=e.prototype;return i.initialize=function(t){this._renderPass=t.renderPass,this._colorTextures=t.colorTextures||[],this._depthStencilTexture=t.depthStencilTexture||null;for(var e=0,i=[],n=0;n<t.colorTextures.length;++n){var r=t.colorTextures[n];r&&(i.push(r.gpuTexture),e=r.lodLevel)}var s=null;t.depthStencilTexture&&(s=t.depthStencilTexture.gpuTexture,e=t.depthStencilTexture.lodLevel);var a=Number.MAX_SAFE_INTEGER,o=Number.MAX_SAFE_INTEGER;this._gpuFramebuffer={gpuRenderPass:t.renderPass.gpuRenderPass,gpuColorTextures:i,gpuDepthStencilTexture:s,glFramebuffer:null,isOffscreen:!0,get width(){return this.gpuColorTextures.length>0?this.gpuColorTextures[0].width:this.gpuDepthStencilTexture?this.gpuDepthStencilTexture.width:a},set width(t){a=t},get height(){return this.gpuColorTextures.length>0?this.gpuColorTextures[0].height:this.gpuDepthStencilTexture?this.gpuDepthStencilTexture.height:o},set height(t){o=t},lodLevel:e},function(t,e){for(var i=0;i<e.gpuColorTextures.length;++i)if(e.gpuColorTextures[i].isSwapchainTexture)return void(e.isOffscreen=!1);var n=t.gl,r=[],s=n.createFramebuffer();if(s){e.glFramebuffer=s,t.stateCache.glFramebuffer!==e.glFramebuffer&&n.bindFramebuffer(n.FRAMEBUFFER,e.glFramebuffer);for(var a=0;a<e.gpuColorTextures.length;++a){var o=e.gpuColorTextures[a];o&&(o.glTexture?n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+a,o.glTarget,o.glTexture,0):n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+a,n.RENDERBUFFER,o.glRenderbuffer),r.push(n.COLOR_ATTACHMENT0+a),e.width=Math.min(e.width,o.width),e.height=Math.min(e.height,o.height))}var h=e.gpuDepthStencilTexture;if(h){var u=F_[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 l=n.checkFramebufferStatus(n.FRAMEBUFFER);if(l!==n.FRAMEBUFFER_COMPLETE)switch(l){case n.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:G("glCheckFramebufferStatus() - FRAMEBUFFER_INCOMPLETE_ATTACHMENT");break;case n.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:G("glCheckFramebufferStatus() - FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT");break;case n.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:G("glCheckFramebufferStatus() - FRAMEBUFFER_INCOMPLETE_DIMENSIONS");break;case n.FRAMEBUFFER_UNSUPPORTED:G("glCheckFramebufferStatus() - FRAMEBUFFER_UNSUPPORTED")}t.stateCache.glFramebuffer!==e.glFramebuffer&&n.bindFramebuffer(n.FRAMEBUFFER,t.stateCache.glFramebuffer)}}(I8.instance,this._gpuFramebuffer),this._width=this._gpuFramebuffer.width,this._height=this._gpuFramebuffer.height},i.destroy=function(){var t,e;this._gpuFramebuffer&&(t=I8.instance,(e=this._gpuFramebuffer).glFramebuffer&&(t.gl.deleteFramebuffer(e.glFramebuffer),t.stateCache.glFramebuffer===e.glFramebuffer&&(t.gl.bindFramebuffer(t.gl.FRAMEBUFFER,null),t.stateCache.glFramebuffer=null),e.glFramebuffer=null),this._gpuFramebuffer=null)},n(e,[{key:"gpuFramebuffer",get:function(){return this._gpuFramebuffer}}]),e}(ed),T6=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._gpuInputAssembler=null,e}s(e,t);var i=e.prototype;return i.initialize=function(t){if(0!==t.vertexBuffers.length){if(this._attributes=t.attributes,this._attributesHash=this.computeAttributesHash(),this._vertexBuffers=t.vertexBuffers,t.indexBuffer)this._indexBuffer=t.indexBuffer,this._drawInfo.indexCount=this._indexBuffer.size/this._indexBuffer.stride,this._drawInfo.firstIndex=0;else{var e=this._vertexBuffers[0];this._drawInfo.vertexCount=e.size/e.stride,this._drawInfo.firstVertex=0,this._drawInfo.vertexOffset=0}this._drawInfo.instanceCount=0,this._drawInfo.firstInstance=0,this._indirectBuffer=t.indirectBuffer||null;for(var i=new Array(t.vertexBuffers.length),n=0;n<t.vertexBuffers.length;++n){var r=t.vertexBuffers[n];r.gpuBuffer&&(i[n]=r.gpuBuffer)}var s=null,a=0;if(t.indexBuffer&&(s=t.indexBuffer.gpuBuffer))switch(s.stride){case 1:a=5121;break;case 2:a=5123;break;case 4:a=5125;break;default:console.error("Error index buffer stride.")}var o=null;t.indirectBuffer&&(o=t.indirectBuffer.gpuBuffer),this._gpuInputAssembler={attributes:t.attributes,gpuVertexBuffers:i,gpuIndexBuffer:s,gpuIndirectBuffer:o,glAttribs:[],glIndexType:a,glVAOs:new Map},t6(I8.instance,this._gpuInputAssembler)}else console.error("InputAssemblerInfo.vertexBuffers is null.")},i.destroy=function(){var t=I8.instance;this._gpuInputAssembler&&t.extensions.useVAO&&e6(t,this._gpuInputAssembler),this._gpuInputAssembler=null},n(e,[{key:"gpuInputAssembler",get:function(){return this._gpuInputAssembler}}]),e}(id),S6=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._gpuDescriptorSetLayout=null,e}s(e,t);var i=e.prototype;return i.initialize=function(t){Array.prototype.push.apply(this._bindings,t.bindings);for(var e=0,i=-1,n=[],r=0;r<this._bindings.length;r++){var s=this._bindings[r];n.push(e),e+=s.count,s.binding>i&&(i=s.binding)}this._bindingIndices=Array(i+1).fill(-1);for(var a=this._descriptorIndices=Array(i+1).fill(-1),o=0;o<this._bindings.length;o++){var h=this._bindings[o];this._bindingIndices[h.binding]=o,a[h.binding]=n[o]}for(var u=[],l=0;l<this._bindings.length;l++){var c=this._bindings[l];if(c.descriptorType&G_)for(var _=0;_<c.count;_++)u.push(c.binding)}this._gpuDescriptorSetLayout={bindings:this._bindings,dynamicBindings:u,descriptorIndices:a,descriptorCount:e}},i.destroy=function(){this._bindings.length=0},n(e,[{key:"gpuDescriptorSetLayout",get:function(){return this._gpuDescriptorSetLayout}}]),e}(rd),E6=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._gpuPipelineLayout=null,e}s(e,t);var i=e.prototype;return i.initialize=function(t){Array.prototype.push.apply(this._setLayouts,t.setLayouts);for(var e=[],i=[],n=0,r=[],s=0;s<this._setLayouts.length;s++){for(var a=this._setLayouts[s],o=a.gpuDescriptorSetLayout.dynamicBindings,h=Array(a.bindingIndices.length).fill(-1),u=0;u<o.length;u++){var l=o[u];h[l]<0&&(h[l]=n+u)}i.push(a.gpuDescriptorSetLayout),e.push(h),r.push(n),n+=o.length}this._gpuPipelineLayout={gpuSetLayouts:i,dynamicOffsetIndices:e,dynamicOffsetCount:n,dynamicOffsetOffsets:r}},i.destroy=function(){this._setLayouts.length=0},n(e,[{key:"gpuPipelineLayout",get:function(){return this._gpuPipelineLayout}}]),e}(sd),A6=[0,1,3,2,0,0,0,4,5,6,0,0,0,0],R6=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._gpuPipelineState=null,e}s(e,t);var i=e.prototype;return i.initialize=function(t){this._primitive=t.primitive,this._shader=t.shader,this._pipelineLayout=t.pipelineLayout;var e=this._bs;if(t.blendState){var i=t.blendState,n=i.targets;n&&n.forEach((function(t,i){e.setTarget(i,t)})),void 0!==i.isA2C&&(e.isA2C=i.isA2C),void 0!==i.isIndepend&&(e.isIndepend=i.isIndepend),void 0!==i.blendColor&&(e.blendColor=i.blendColor)}Object.assign(this._rs,t.rasterizerState),Object.assign(this._dss,t.depthStencilState),this._is=t.inputState,this._renderPass=t.renderPass,this._dynamicStates=t.dynamicStates;for(var r=[],s=0;s<31;s++)this._dynamicStates&1<<s&&r.push(1<<s);this._gpuPipelineState={glPrimitive:A6[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}(cd),b6=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){r6(I8.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;a6(I8.instance,e),++this._numDrawCalls,this._numInstances+=e.instanceCount;var i=e.indexCount||e.vertexCount;if(this._curGPUPipelineState)switch(this._curGPUPipelineState.glPrimitive){case 4:this._numTris+=i/3*Math.max(e.instanceCount,1);break;case 5:case 6:this._numTris+=(i-2)*Math.max(e.instanceCount,1)}}else console.error("Command 'draw' must be recorded inside a render pass.")},i.setViewport=function(t){var e=I8.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=I8.instance,i=e.stateCache,n=e.gl;i.scissorRect.x===t.x&&i.scissorRect.y===t.y&&i.scissorRect.width===t.width&&i.scissorRect.height===t.height||(n.scissor(t.x,t.y,t.width,t.height),i.scissorRect.x=t.x,i.scissorRect.y=t.y,i.scissorRect.width=t.width,i.scissorRect.height=t.height)},i.updateBuffer=function(t,e,i){if(this._isInRenderPass)console.error("Command 'updateBuffer' must be recorded outside a render pass.");else{var n,r=t.gpuBuffer;r&&(n=void 0!==i?i:t.usage&ql.INDIRECT?0:e.byteLength,Z8(I8.instance,r,e,0,n))}},i.copyBuffersToTexture=function(t,e,i){if(this._isInRenderPass)console.error("Command 'copyBufferToTexture' must be recorded outside a render pass.");else{var n=e.gpuTexture;n&&c6(I8.instance,t,n,i)}},i.execute=function(t,e){for(var i=0;i<e;++i){var n=t[i];h6(I8.instance,n.cmdPackage),this._numDrawCalls+=n._numDrawCalls,this._numInstances+=n._numInstances,this._numTris+=n._numTris}},i.bindStates=function(){s6(I8.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;_6(I8.instance,r,s,i,n)},e}(v6),C6=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).numDrawCalls=0,e.numInstances=0,e.numTris=0,e}s(e,t);var i=e.prototype;return i.initialize=function(t){this._type=t.type},i.destroy=function(){},i.submit=function(t){for(var e=t.length,i=0;i<e;i++){var n=t[i];this.numDrawCalls+=n.numDrawCalls,this.numInstances+=n.numInstances,this.numTris+=n.numTris}},i.clear=function(){this.numDrawCalls=0,this.numInstances=0,this.numTris=0},e}(_d),w6=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._gpuRenderPass=null,e}s(e,t);var i=e.prototype;return i.initialize=function(t){this._colorInfos=t.colorAttachments,this._depthStencilInfo=t.depthStencilAttachment,this._subpasses=t.subpasses,this._gpuRenderPass={colorAttachments:this._colorInfos,depthStencilAttachment:this._depthStencilInfo},this._hash=this.computeHash()},i.destroy=function(){this._gpuRenderPass=null},n(e,[{key:"gpuRenderPass",get:function(){return this._gpuRenderPass}}]),e}(dd),x6=[10497,33648,33071,33071],I6=function(t){function e(e,i){var n;(n=t.call(this,e,i)||this)._gpuSampler=null;var r,s,a=n._info.minFilter,o=n._info.magFilter,h=n._info.mipFilter;r=a===sc.LINEAR||a===sc.ANISOTROPIC?h===sc.LINEAR||h===sc.ANISOTROPIC?9987:h===sc.POINT?9985:9729:h===sc.LINEAR||h===sc.ANISOTROPIC?9986:h===sc.POINT?9984:9728,s=o===sc.LINEAR||o===sc.ANISOTROPIC?9729:9728;var u=x6[n._info.addressU],l=x6[n._info.addressV],c=x6[n._info.addressW];return n._gpuSampler={glMinFilter:r,glMagFilter:s,glWrapS:u,glWrapT:l,glWrapR:c},n}return s(e,t),n(e,[{key:"gpuSampler",get:function(){return this._gpuSampler}}]),e}(fd),O6=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._gpuShader=null,e}s(e,t);var i=e.prototype;return i.initialize=function(t){this._name=t.name,this._stages=t.stages,this._attributes=t.attributes,this._blocks=t.blocks,this._samplers=t.samplers,this._gpuShader={name:t.name,blocks:t.blocks.slice(),samplerTextures:t.samplerTextures.slice(),subpassInputs:t.subpassInputs.slice(),gpuStages:new Array(t.stages.length),glProgram:null,glInputs:[],glUniforms:[],glBlocks:[],glSamplerTextures:[]};for(var e=0;e<t.stages.length;++e){var i=t.stages[e];this._gpuShader.gpuStages[e]={type:i.stage,source:i.source,glShader:null}}},i.destroy=function(){this._gpuShader&&($8(I8.instance,this._gpuShader),this._gpuShader=null)},n(e,[{key:"gpuShader",get:function(){return null===this._gpuShader.glProgram&&J8(I8.instance,this._gpuShader),this._gpuShader}}]),e}(pd),D6=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 Wc,this.scissorRect=new Fc(0,0,0,0),this.rs=new ad,this.dss=new od,this.bs=new ud,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}(),M6=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._gpuTexture=null,e._lodLevel=0,e}s(e,t);var i=e.prototype;return i.initialize=function(t,e){var i=t,n=t;"texture"in t&&(i=n.texture.info,this._isTextureView=!0),this._info.copy(i),this._isPowerOf2=H_(this._info.width)&&H_(this._info.height),this._size=V_(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 jl.A8:return e.ALPHA;case jl.L8:return e.LUMINANCE;case jl.LA8:return e.LUMINANCE_ALPHA;case jl.RGB8:case jl.RGB16F:case jl.RGB32F:return e.RGB;case jl.BGRA8:case jl.RGBA8:case jl.SRGB8_A8:case jl.RGBA16F:case jl.RGBA32F:return e.RGBA;case jl.R5G6B5:return e.RGB;case jl.RGB5A1:case jl.RGBA4:return e.RGBA;case jl.DEPTH:return e.DEPTH_COMPONENT;case jl.DEPTH_STENCIL:return e.DEPTH_STENCIL;case jl.BC1:return w8.COMPRESSED_RGB_S3TC_DXT1_EXT;case jl.BC1_ALPHA:return w8.COMPRESSED_RGBA_S3TC_DXT1_EXT;case jl.BC1_SRGB:return w8.COMPRESSED_SRGB_S3TC_DXT1_EXT;case jl.BC1_SRGB_ALPHA:return w8.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;case jl.BC2:return w8.COMPRESSED_RGBA_S3TC_DXT3_EXT;case jl.BC2_SRGB:return w8.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;case jl.BC3:return w8.COMPRESSED_RGBA_S3TC_DXT5_EXT;case jl.BC3_SRGB:return w8.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;case jl.ETC_RGB8:return w8.COMPRESSED_RGB_ETC1_WEBGL;case jl.ETC2_RGB8:return w8.COMPRESSED_RGB8_ETC2;case jl.ETC2_SRGB8:return w8.COMPRESSED_SRGB8_ETC2;case jl.ETC2_RGB8_A1:return w8.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2;case jl.ETC2_SRGB8_A1:return w8.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2;case jl.ETC2_RGBA8:return w8.COMPRESSED_RGBA8_ETC2_EAC;case jl.ETC2_SRGB8_A8:return w8.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC;case jl.EAC_R11:return w8.COMPRESSED_R11_EAC;case jl.EAC_R11SN:return w8.COMPRESSED_SIGNED_R11_EAC;case jl.EAC_RG11:return w8.COMPRESSED_RG11_EAC;case jl.EAC_RG11SN:return w8.COMPRESSED_SIGNED_RG11_EAC;case jl.PVRTC_RGB2:return w8.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;case jl.PVRTC_RGBA2:return w8.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;case jl.PVRTC_RGB4:return w8.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;case jl.PVRTC_RGBA4:return w8.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;case jl.ASTC_RGBA_4X4:return w8.COMPRESSED_RGBA_ASTC_4x4_KHR;case jl.ASTC_RGBA_5X4:return w8.COMPRESSED_RGBA_ASTC_5x4_KHR;case jl.ASTC_RGBA_5X5:return w8.COMPRESSED_RGBA_ASTC_5x5_KHR;case jl.ASTC_RGBA_6X5:return w8.COMPRESSED_RGBA_ASTC_6x5_KHR;case jl.ASTC_RGBA_6X6:return w8.COMPRESSED_RGBA_ASTC_6x6_KHR;case jl.ASTC_RGBA_8X5:return w8.COMPRESSED_RGBA_ASTC_8x5_KHR;case jl.ASTC_RGBA_8X6:return w8.COMPRESSED_RGBA_ASTC_8x6_KHR;case jl.ASTC_RGBA_8X8:return w8.COMPRESSED_RGBA_ASTC_8x8_KHR;case jl.ASTC_RGBA_10X5:return w8.COMPRESSED_RGBA_ASTC_10x5_KHR;case jl.ASTC_RGBA_10X6:return w8.COMPRESSED_RGBA_ASTC_10x6_KHR;case jl.ASTC_RGBA_10X8:return w8.COMPRESSED_RGBA_ASTC_10x8_KHR;case jl.ASTC_RGBA_10X10:return w8.COMPRESSED_RGBA_ASTC_10x10_KHR;case jl.ASTC_RGBA_12X10:return w8.COMPRESSED_RGBA_ASTC_12x10_KHR;case jl.ASTC_RGBA_12X12:return w8.COMPRESSED_RGBA_ASTC_12x12_KHR;case jl.ASTC_SRGBA_4X4:return w8.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR;case jl.ASTC_SRGBA_5X4:return w8.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR;case jl.ASTC_SRGBA_5X5:return w8.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR;case jl.ASTC_SRGBA_6X5:return w8.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR;case jl.ASTC_SRGBA_6X6:return w8.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR;case jl.ASTC_SRGBA_8X5:return w8.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR;case jl.ASTC_SRGBA_8X6:return w8.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR;case jl.ASTC_SRGBA_8X8:return w8.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR;case jl.ASTC_SRGBA_10X5:return w8.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR;case jl.ASTC_SRGBA_10X6:return w8.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR;case jl.ASTC_SRGBA_10X8:return w8.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR;case jl.ASTC_SRGBA_10X10:return w8.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR;case jl.ASTC_SRGBA_12X10:return w8.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR;case jl.ASTC_SRGBA_12X12:return w8.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR;default:return G("Unsupported Format, convert to WebGL format failed."),e.RGBA}}(e.format,i),e.glType=O8(e.format,i);var n=e.width,r=e.height;switch(e.type){case $l.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||!F_[e.format].hasDepth){if(e.glTexture=i.createTexture(),e.size>0){var a=t.stateCache.glTexUnits[t.stateCache.texUnit];if(a.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_2D,e.glTexture),a.glTexture=e.glTexture),F_[e.format].isCompressed)for(var o=0;o<e.mipLevel;++o){var h=z_(e.format,n,r,1),u=new Uint8Array(h);i.compressedTexImage2D(i.TEXTURE_2D,o,e.glInternalFmt,n,r,0,u),n=Math.max(1,n>>1),r=Math.max(1,r>>1)}else for(var l=0;l<e.mipLevel;++l)i.texImage2D(i.TEXTURE_2D,l,e.glInternalFmt,n,r,0,e.glFormat,e.glType,null),n=Math.max(1,n>>1),r=Math.max(1,r>>1);e.isPowerOf2?(e.glWrapS=i.REPEAT,e.glWrapT=i.REPEAT):(e.glWrapS=i.CLAMP_TO_EDGE,e.glWrapT=i.CLAMP_TO_EDGE),e.glMinFilter=i.LINEAR,e.glMagFilter=i.LINEAR,i.texParameteri(e.glTarget,i.TEXTURE_WRAP_S,e.glWrapS),i.texParameteri(e.glTarget,i.TEXTURE_WRAP_T,e.glWrapT),i.texParameteri(e.glTarget,i.TEXTURE_MIN_FILTER,e.glMinFilter),i.texParameteri(e.glTarget,i.TEXTURE_MAG_FILTER,e.glMagFilter)}}else e.glInternalFmt=function(t,e){switch(t){case jl.R5G6B5:return e.RGB565;case jl.RGB5A1:return e.RGB5_A1;case jl.RGBA4:return e.RGBA4;case jl.RGBA16F:return w8.RGBA16F_EXT;case jl.RGBA32F:return w8.RGBA32F_EXT;case jl.SRGB8_A8:return w8.SRGB8_ALPHA8_EXT;case jl.DEPTH:return e.DEPTH_COMPONENT16;case jl.DEPTH_STENCIL:return e.DEPTH_STENCIL;default:return G("Unsupported Format, convert to WebGL internal format failed."),e.RGBA}}(e.format,i),e.glRenderbuffer=i.createRenderbuffer(),e.size>0&&(t.stateCache.glRenderbuffer!==e.glRenderbuffer&&(i.bindRenderbuffer(i.RENDERBUFFER,e.glRenderbuffer),t.stateCache.glRenderbuffer=e.glRenderbuffer),i.renderbufferStorage(i.RENDERBUFFER,e.glInternalFmt,n,r));break;case $l.CUBE:e.glTarget=i.TEXTURE_CUBE_MAP;var c=Math.max(n,r);if(c>t.capabilities.maxCubeMapTextureSize&&Z(9100,c,t.capabilities.maxTextureSize),e.glTexture=i.createTexture(),e.size>0){var _=t.stateCache.glTexUnits[t.stateCache.texUnit];if(_.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_CUBE_MAP,e.glTexture),_.glTexture=e.glTexture),F_[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=z_(e.format,n,r,1),m=new Uint8Array(p);i.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+d,f,e.glInternalFmt,n,r,0,m),n=Math.max(1,n>>1),r=Math.max(1,r>>1)}}else for(var g=0;g<6;++g){n=e.width,r=e.height;for(var v=0;v<e.mipLevel;++v)i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+g,v,e.glInternalFmt,n,r,0,e.glFormat,e.glType,null),n=Math.max(1,n>>1),r=Math.max(1,r>>1)}e.isPowerOf2?(e.glWrapS=i.REPEAT,e.glWrapT=i.REPEAT):(e.glWrapS=i.CLAMP_TO_EDGE,e.glWrapT=i.CLAMP_TO_EDGE),e.glMinFilter=i.LINEAR,e.glMagFilter=i.LINEAR,i.texParameteri(e.glTarget,i.TEXTURE_WRAP_S,e.glWrapS),i.texParameteri(e.glTarget,i.TEXTURE_WRAP_T,e.glWrapT),i.texParameteri(e.glTarget,i.TEXTURE_MIN_FILTER,e.glMinFilter),i.texParameteri(e.glTarget,i.TEXTURE_MAG_FILTER,e.glMagFilter)}break;default:G("Unsupported TextureType, create texture failed."),e.type=$l.TEX2D,e.glTarget=i.TEXTURE_2D}}(I8.instance,this._gpuTexture),I8.instance.memoryStatus.textureSize+=this._size),this._viewInfo.texture=this,this._viewInfo.type=t.type,this._viewInfo.format=t.format,this._viewInfo.baseLevel=0,this._viewInfo.levelCount=t.levelCount,this._viewInfo.baseLayer=0,this._viewInfo.layerCount=t.layerCount)},i.destroy=function(){!this._isTextureView&&this._gpuTexture&&(function(t,e){var i=t.gl;if(e.glTexture){var n=t.stateCache.glTexUnits,r=t.stateCache.texUnit;i.deleteTexture(e.glTexture);for(var s=0;s<n.length;s++)n[s].glTexture===e.glTexture&&(i.activeTexture(i.TEXTURE0+s),r=s,i.bindTexture(e.glTarget,null),n[s].glTexture=null);t.stateCache.texUnit=r,e.glTexture=null}if(e.glRenderbuffer){var a=t.stateCache.glRenderbuffer;i.deleteRenderbuffer(e.glRenderbuffer),a===e.glRenderbuffer&&(i.bindRenderbuffer(i.RENDERBUFFER,null),a=null),e.glRenderbuffer=null}}(I8.instance,this._gpuTexture),I8.instance.memoryStatus.textureSize-=this._size,this._gpuTexture=null)},i.getGLTextureHandle=function(){var t=this._gpuTexture;return t?t.glTexture?t.glTexture:t.glRenderbuffer?t.glRenderbuffer:0:0},i.resize=function(t,i){if(this._info.width!==t||this._info.height!==i){this._info.levelCount===e.getLevelCount(this._info.width,this._info.height)?this._info.levelCount=e.getLevelCount(t,i):this._info.levelCount>1&&(this._info.levelCount=Math.min(this._info.levelCount,e.getLevelCount(t,i)));var n=this._size;this._info.width=t,this._info.height=i,this._size=V_(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 $l.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 a=t.stateCache.glTexUnits[t.stateCache.texUnit];if(a.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_2D,e.glTexture),a.glTexture=e.glTexture),F_[e.format].isCompressed)for(var o=0;o<e.mipLevel;++o){var h=z_(e.format,n,r,1),u=new Uint8Array(h);i.compressedTexImage2D(i.TEXTURE_2D,o,e.glInternalFmt,n,r,0,u),n=Math.max(1,n>>1),r=Math.max(1,r>>1)}else for(var l=0;l<e.mipLevel;++l)i.texImage2D(i.TEXTURE_2D,l,e.glInternalFmt,n,r,0,e.glFormat,e.glType,null),n=Math.max(1,n>>1),r=Math.max(1,r>>1)}break;case $l.CUBE:e.glTarget=i.TEXTURE_CUBE_MAP;var c=Math.max(n,r);c>t.capabilities.maxCubeMapTextureSize&&Z(9100,c,t.capabilities.maxTextureSize);var _=t.stateCache.glTexUnits[t.stateCache.texUnit];if(_.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_CUBE_MAP,e.glTexture),_.glTexture=e.glTexture),F_[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=z_(e.format,n,r,1),m=new Uint8Array(p);i.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+d,f,e.glInternalFmt,n,r,0,m),n=Math.max(1,n>>1),r=Math.max(1,r>>1)}}else for(var g=0;g<6;++g){n=e.width,r=e.height;for(var v=0;v<e.mipLevel;++v)i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+g,v,e.glInternalFmt,n,r,0,e.glFormat,e.glType,null),n=Math.max(1,n>>1),r=Math.max(1,r>>1)}break;default:G("Unsupported TextureType, create texture failed."),e.type=$l.TEX2D,e.glTarget=i.TEXTURE_2D}}}(I8.instance,this._gpuTexture),I8.instance.memoryStatus.textureSize-=n,I8.instance.memoryStatus.textureSize+=this._size))}},i.initAsSwapchainTexture=function(t){var e=new t_;e.format=t.format,e.usage=F_[t.format].hasDepth?tc.DEPTH_STENCIL_ATTACHMENT:tc.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}(md),P6="webglcontextlost";function B6(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 N6(t){var e={EXT_texture_filter_anisotropic:B6(t,"EXT_texture_filter_anisotropic"),EXT_blend_minmax:B6(t,"EXT_blend_minmax"),EXT_frag_depth:B6(t,"EXT_frag_depth"),EXT_shader_texture_lod:B6(t,"EXT_shader_texture_lod"),EXT_sRGB:B6(t,"EXT_sRGB"),OES_vertex_array_object:B6(t,"OES_vertex_array_object"),EXT_color_buffer_half_float:B6(t,"EXT_color_buffer_half_float"),WEBGL_color_buffer_float:B6(t,"WEBGL_color_buffer_float"),WEBGL_compressed_texture_etc1:B6(t,"WEBGL_compressed_texture_etc1"),WEBGL_compressed_texture_etc:B6(t,"WEBGL_compressed_texture_etc"),WEBGL_compressed_texture_pvrtc:B6(t,"WEBGL_compressed_texture_pvrtc"),WEBGL_compressed_texture_s3tc:B6(t,"WEBGL_compressed_texture_s3tc"),WEBGL_compressed_texture_s3tc_srgb:B6(t,"WEBGL_compressed_texture_s3tc_srgb"),WEBGL_debug_shaders:B6(t,"WEBGL_debug_shaders"),WEBGL_draw_buffers:B6(t,"WEBGL_draw_buffers"),WEBGL_lose_context:B6(t,"WEBGL_lose_context"),WEBGL_depth_texture:B6(t,"WEBGL_depth_texture"),OES_texture_half_float:B6(t,"OES_texture_half_float"),OES_texture_half_float_linear:B6(t,"OES_texture_half_float_linear"),OES_texture_float:B6(t,"OES_texture_float"),OES_texture_float_linear:B6(t,"OES_texture_float_linear"),OES_standard_derivatives:B6(t,"OES_standard_derivatives"),OES_element_index_uint:B6(t,"OES_element_index_uint"),ANGLE_instanced_arrays:B6(t,"ANGLE_instanced_arrays"),WEBGL_debug_renderer_info:B6(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 al.os===il.IOS&&14===al.osMainVersion&&al.isBrowser||(e.WEBGL_compressed_texture_astc=B6(t,"WEBGL_compressed_texture_astc")),al.os!==il.ANDROID&&al.os!==il.IOS&&(e.WEBGL_multi_draw=B6(t,"WEBGL_multi_draw")),al.browserType===$u.UC&&(e.ANGLE_instanced_arrays=null),al.os===il.IOS&&al.osMainVersion<=10&&(e.destroyShadersImmediately=!1),e.OES_vertex_array_object&&(e.useVAO=!0),e}var L6=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).stateCache=new D6,e.cmdAllocator=new g6,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(P6,this._onWebGLContextLost);var e=I8.instance.gl;this.stateCache.initialize(I8.instance.capabilities.maxTextureUnits,I8.instance.capabilities.maxVertexAttributes),this._extensions=N6(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=jl.RGBA8,n=jl.DEPTH_STENCIL,r=e.getParameter(e.DEPTH_BITS),s=e.getParameter(e.STENCIL_BITS);r&&s?n=jl.DEPTH_STENCIL:r&&(n=jl.DEPTH),this._colorTexture=new M6,this._colorTexture.initAsSwapchainTexture({swapchain:this,format:i,width:t.width,height:t.height}),this._depthStencilTexture=new M6,this._depthStencilTexture.initAsSwapchainTexture({swapchain:this,format:n,width:t.width,height:t.height}),this.nullTex2D=I8.instance.createTexture(new t_($l.TEX2D,tc.SAMPLED,jl.RGBA8,2,2,ec.GEN_MIPMAP)),this.nullTexCube=I8.instance.createTexture(new t_($l.CUBE,tc.SAMPLED,jl.RGBA8,2,2,ec.GEN_MIPMAP,6));var a=new Vc;a.texExtent.width=2,a.texExtent.height=2;var o=new Uint8Array(this.nullTex2D.size);o.fill(0),I8.instance.copyBuffersToTexture([o],this.nullTex2D,[a]),a.texSubres.layerCount=6,I8.instance.copyBuffersToTexture([o,o,o,o,o,o],this.nullTexCube,[a]),this._blitManager=new f6},i.destroy=function(){this._canvas&&this._webGLContextLostHandler&&(this._canvas.removeEventListener(P6,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||(z("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),U(t)},n(e,[{key:"extensions",get:function(){return this._extensions}},{key:"blitManager",get:function(){return this._blitManager}}]),e}(td),F6=t("eO",function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._swapchain=null,e._context=null,e._bindingMappings=null,e._textureExclusive=new Array(jl.COUNT),e}s(e,t);var i=e.prototype;return i.initialize=function(t){I8.setInstance(this),this._gfxAPI=Vl.WEBGL;var e=this._bindingMappingInfo=t.bindingMappingInfo,i=[],n=[],r=e.setIndices[0];i[r]=0,n[r]=0;for(var s=1;s<e.setIndices.length;++s){var a=e.setIndices[s],o=e.setIndices[s-1];i[a]=e.maxBlockCounts[o]+i[o],n[a]=e.maxSamplerTextureCounts[o]+n[o]}for(var h=0;h<e.setIndices.length;++h){var u=e.setIndices[h];n[u]-=e.maxBlockCounts[u]}this._bindingMappings={blockOffsets:i,samplerTextureOffsets:n,flexibleSet:e.setIndices[e.setIndices.length-1]};var l=this._context=function(t){var e=null;try{var i={alpha:Ce.ENABLE_TRANSPARENT_CANVAS,antialias:Ce.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}(J_.canvas);if(!l)return console.error("This device does not support WebGL."),!1;this._queue=this.createQueue(new O_(bc.GRAPHICS)),this._cmdBuff=this.createCommandBuffer(new I_(this._queue)),this._caps.maxVertexAttributes=l.getParameter(l.MAX_VERTEX_ATTRIBS),this._caps.maxVertexUniformVectors=l.getParameter(l.MAX_VERTEX_UNIFORM_VECTORS),this._caps.maxFragmentUniformVectors=l.getParameter(l.MAX_FRAGMENT_UNIFORM_VECTORS),this._caps.maxTextureUnits=l.getParameter(l.MAX_TEXTURE_IMAGE_UNITS),this._caps.maxVertexTextureUnits=l.getParameter(l.MAX_VERTEX_TEXTURE_IMAGE_UNITS),this._caps.maxTextureSize=l.getParameter(l.MAX_TEXTURE_SIZE),this._caps.maxCubeMapTextureSize=l.getParameter(l.MAX_CUBE_MAP_TEXTURE_SIZE),this._caps.maxArrayTextureLayers=0,this._caps.max3DTextureSize=0,this._caps.maxUniformBufferBindings=16;var c=l.getSupportedExtensions(),_="";if(c)for(var f,p=d(c);!(f=p()).done;)_+=f.value+" ";var m=N6(l);m.WEBGL_debug_renderer_info?(this._renderer=l.getParameter(m.WEBGL_debug_renderer_info.UNMASKED_RENDERER_WEBGL),this._vendor=l.getParameter(m.WEBGL_debug_renderer_info.UNMASKED_VENDOR_WEBGL)):(this._renderer=l.getParameter(l.RENDERER),this._vendor=l.getParameter(l.VENDOR));var g=l.getParameter(l.VERSION);this._features.fill(!1),this.initFormatFeatures(m),m.EXT_blend_minmax&&(this._features[Xl.BLEND_MINMAX]=!0),m.OES_element_index_uint&&(this._features[Xl.ELEMENT_INDEX_UINT]=!0),m.ANGLE_instanced_arrays&&(this._features[Xl.INSTANCED_ARRAYS]=!0),m.WEBGL_draw_buffers&&(this._features[Xl.MULTIPLE_RENDER_TARGETS]=!0);var v="";return this.getFormatFeatures(jl.ETC_RGB8)&&(v+="etc1 "),this.getFormatFeatures(jl.ETC2_RGB8)&&(v+="etc2 "),this.getFormatFeatures(jl.BC1)&&(v+="dxt "),this.getFormatFeatures(jl.PVRTC_RGB2)&&(v+="pvrtc "),this.getFormatFeatures(jl.ASTC_RGBA_4X4)&&(v+="astc "),z("WebGL device initialized."),z("RENDERER: "+this._renderer),z("VENDOR: "+this._vendor),z("VERSION: "+g),z("COMPRESSED_FORMAT: "+v),z("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(ic.NONE),this._textureExclusive.fill(!0);var e=ic.RENDER_TARGET|ic.SAMPLED_TEXTURE|ic.LINEAR_FILTER;this._formatFeatures[jl.RGB8]=e,this._formatFeatures[jl.R5G6B5]=e,this._textureExclusive[jl.R5G6B5]=!1,this._formatFeatures[jl.RGBA8]=e,this._formatFeatures[jl.RGBA4]=e,this._textureExclusive[jl.RGBA4]=!1,this._formatFeatures[jl.RGB5A1]=e,this._textureExclusive[jl.RGB5A1]=!1,this._formatFeatures[jl.DEPTH]=ic.RENDER_TARGET,this._textureExclusive[jl.DEPTH]=!1,this._formatFeatures[jl.DEPTH_STENCIL]=ic.RENDER_TARGET,this._textureExclusive[jl.DEPTH_STENCIL]=!1,this._formatFeatures[jl.R8I]|=ic.VERTEX_ATTRIBUTE,this._formatFeatures[jl.RG8I]|=ic.VERTEX_ATTRIBUTE,this._formatFeatures[jl.RGB8I]|=ic.VERTEX_ATTRIBUTE,this._formatFeatures[jl.RGBA8I]|=ic.VERTEX_ATTRIBUTE,this._formatFeatures[jl.R8UI]|=ic.VERTEX_ATTRIBUTE,this._formatFeatures[jl.RG8UI]|=ic.VERTEX_ATTRIBUTE,this._formatFeatures[jl.RGB8UI]|=ic.VERTEX_ATTRIBUTE,this._formatFeatures[jl.RGBA8UI]|=ic.VERTEX_ATTRIBUTE,this._formatFeatures[jl.R8I]|=ic.VERTEX_ATTRIBUTE,this._formatFeatures[jl.RG8I]|=ic.VERTEX_ATTRIBUTE,this._formatFeatures[jl.RGB8I]|=ic.VERTEX_ATTRIBUTE,this._formatFeatures[jl.RGBA8I]|=ic.VERTEX_ATTRIBUTE,this._formatFeatures[jl.R8UI]|=ic.VERTEX_ATTRIBUTE,this._formatFeatures[jl.RG8UI]|=ic.VERTEX_ATTRIBUTE,this._formatFeatures[jl.RGB8UI]|=ic.VERTEX_ATTRIBUTE,this._formatFeatures[jl.RGBA8UI]|=ic.VERTEX_ATTRIBUTE,this._formatFeatures[jl.R32F]|=ic.VERTEX_ATTRIBUTE,this._formatFeatures[jl.RG32F]|=ic.VERTEX_ATTRIBUTE,this._formatFeatures[jl.RGB32F]|=ic.VERTEX_ATTRIBUTE,this._formatFeatures[jl.RGBA32F]|=ic.VERTEX_ATTRIBUTE,t.EXT_sRGB&&(this._formatFeatures[jl.SRGB8]=e,this._formatFeatures[jl.SRGB8_A8]=e,this._textureExclusive[jl.SRGB8_A8]=!1),t.WEBGL_depth_texture&&(this._formatFeatures[jl.DEPTH]|=e,this._formatFeatures[jl.DEPTH_STENCIL]|=e),t.WEBGL_color_buffer_float&&(this._formatFeatures[jl.RGB32F]|=ic.RENDER_TARGET,this._formatFeatures[jl.RGBA32F]|=ic.RENDER_TARGET,this._textureExclusive[jl.RGB32F]=!1,this._textureExclusive[jl.RGBA32F]=!1),t.EXT_color_buffer_half_float&&(this._formatFeatures[jl.RGB16F]|=ic.RENDER_TARGET,this._formatFeatures[jl.RGBA16F]|=ic.RENDER_TARGET,this._textureExclusive[jl.RGB16F]=!1,this._textureExclusive[jl.RGBA16F]=!1),t.OES_texture_float&&(this._formatFeatures[jl.RGB32F]|=ic.RENDER_TARGET|ic.SAMPLED_TEXTURE,this._formatFeatures[jl.RGBA32F]|=ic.RENDER_TARGET|ic.SAMPLED_TEXTURE),t.OES_texture_half_float&&(this._formatFeatures[jl.RGB16F]|=ic.RENDER_TARGET|ic.SAMPLED_TEXTURE,this._formatFeatures[jl.RGBA16F]|=ic.RENDER_TARGET|ic.SAMPLED_TEXTURE),t.OES_texture_float_linear&&(this._formatFeatures[jl.RGB32F]|=ic.LINEAR_FILTER,this._formatFeatures[jl.RGBA32F]|=ic.LINEAR_FILTER),t.OES_texture_half_float_linear&&(this._formatFeatures[jl.RGB16F]|=ic.LINEAR_FILTER,this._formatFeatures[jl.RGBA16F]|=ic.LINEAR_FILTER);var i=ic.SAMPLED_TEXTURE|ic.LINEAR_FILTER;t.WEBGL_compressed_texture_etc1&&(this._formatFeatures[jl.ETC_RGB8]=i),t.WEBGL_compressed_texture_etc&&(this._formatFeatures[jl.ETC2_RGB8]=i,this._formatFeatures[jl.ETC2_RGBA8]=i,this._formatFeatures[jl.ETC2_SRGB8]=i,this._formatFeatures[jl.ETC2_SRGB8_A8]=i,this._formatFeatures[jl.ETC2_RGB8_A1]=i,this._formatFeatures[jl.ETC2_SRGB8_A1]=i),t.WEBGL_compressed_texture_s3tc&&(this._formatFeatures[jl.BC1]=i,this._formatFeatures[jl.BC1_ALPHA]=i,this._formatFeatures[jl.BC1_SRGB]=i,this._formatFeatures[jl.BC1_SRGB_ALPHA]=i,this._formatFeatures[jl.BC2]=i,this._formatFeatures[jl.BC2_SRGB]=i,this._formatFeatures[jl.BC3]=i,this._formatFeatures[jl.BC3_SRGB]=i),t.WEBGL_compressed_texture_pvrtc&&(this._formatFeatures[jl.PVRTC_RGB2]|=i,this._formatFeatures[jl.PVRTC_RGBA2]|=i,this._formatFeatures[jl.PVRTC_RGB4]|=i,this._formatFeatures[jl.PVRTC_RGBA4]|=i),t.WEBGL_compressed_texture_astc&&(this._formatFeatures[jl.ASTC_RGBA_4X4]|=i,this._formatFeatures[jl.ASTC_RGBA_5X4]|=i,this._formatFeatures[jl.ASTC_RGBA_5X5]|=i,this._formatFeatures[jl.ASTC_RGBA_6X5]|=i,this._formatFeatures[jl.ASTC_RGBA_6X6]|=i,this._formatFeatures[jl.ASTC_RGBA_8X5]|=i,this._formatFeatures[jl.ASTC_RGBA_8X6]|=i,this._formatFeatures[jl.ASTC_RGBA_8X8]|=i,this._formatFeatures[jl.ASTC_RGBA_10X5]|=i,this._formatFeatures[jl.ASTC_RGBA_10X6]|=i,this._formatFeatures[jl.ASTC_RGBA_10X8]|=i,this._formatFeatures[jl.ASTC_RGBA_10X10]|=i,this._formatFeatures[jl.ASTC_RGBA_12X10]|=i,this._formatFeatures[jl.ASTC_RGBA_12X12]|=i,this._formatFeatures[jl.ASTC_SRGBA_4X4]|=i,this._formatFeatures[jl.ASTC_SRGBA_5X4]|=i,this._formatFeatures[jl.ASTC_SRGBA_5X5]|=i,this._formatFeatures[jl.ASTC_SRGBA_6X5]|=i,this._formatFeatures[jl.ASTC_SRGBA_6X6]|=i,this._formatFeatures[jl.ASTC_SRGBA_8X5]|=i,this._formatFeatures[jl.ASTC_SRGBA_8X6]|=i,this._formatFeatures[jl.ASTC_SRGBA_8X8]|=i,this._formatFeatures[jl.ASTC_SRGBA_10X5]|=i,this._formatFeatures[jl.ASTC_SRGBA_10X6]|=i,this._formatFeatures[jl.ASTC_SRGBA_10X8]|=i,this._formatFeatures[jl.ASTC_SRGBA_10X10]|=i,this._formatFeatures[jl.ASTC_SRGBA_12X10]|=i,this._formatFeatures[jl.ASTC_SRGBA_12X12]|=i)},i.createCommandBuffer=function(t){var e=new(t.type===wc.PRIMARY?b6:v6);return e.initialize(t),e},i.createSwapchain=function(t){var e=new L6;return this._swapchain=e,e.initialize(t),e},i.createBuffer=function(t){var e=new p6;return e.initialize(t),e},i.createTexture=function(t){var e=new M6;return e.initialize(t),e},i.createDescriptorSet=function(t){var e=new x8;return e.initialize(t),e},i.createShader=function(t){var e=new O6;return e.initialize(t),e},i.createInputAssembler=function(t){var e=new T6;return e.initialize(t),e},i.createRenderPass=function(t){var e=new w6;return e.initialize(t),e},i.createFramebuffer=function(t){var e=new y6;return e.initialize(t),e},i.createDescriptorSetLayout=function(t){var e=new S6;return e.initialize(t),e},i.createPipelineLayout=function(t){var e=new E6;return e.initialize(t),e},i.createPipelineState=function(t){var e=new R6;return e.initialize(t),e},i.createQueue=function(t){var e=new C6;return e.initialize(t),e},i.getSampler=function(t){var e=fd.computeHash(t);return this._samplers.has(e)||this._samplers.set(e,new I6(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=vd.computeHash(t);return this._textureBarriers.has(e)||this._textureBarriers.set(e,new vd(t,e)),this._textureBarriers.get(e)},i.getBufferBarrier=function(t){var e=yd.computeHash(t);return this._bufferBarriers.has(e)||this._bufferBarriers.set(e,new yd(t,e)),this._bufferBarriers.get(e)},i.copyBuffersToTexture=function(t,e,i){c6(this,t,e.gpuTexture,i)},i.copyTextureToBuffers=function(t,e,i){!function(t,e,i,n){var r=t.gl,s=t.stateCache,a=r.createFramebuffer();r.bindFramebuffer(r.FRAMEBUFFER,a);var o=0,h=0,u=1,l=1;switch(e.glTarget){case r.TEXTURE_2D:for(var c=0;c<n.length;c++){var _=n[c];r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,e.glTarget,e.glTexture,_.texSubres.mipLevel),o=_.texOffset.x,h=_.texOffset.y,u=_.texExtent.width,l=_.texExtent.height,r.readPixels(o,h,u,l,e.glFormat,e.glType,i[c])}break;default:G("Unsupported GL texture type, copy texture to buffers failed.")}r.bindFramebuffer(r.FRAMEBUFFER,null),s.glFramebuffer=null,r.deleteFramebuffer(a)}(this,t.gpuTexture,e,i)},i.copyTexImagesToTexture=function(t,e,i){!function(t,e,i,n){var r=t.gl,s=t.stateCache.glTexUnits[t.stateCache.texUnit];s.glTexture!==i.glTexture&&(r.bindTexture(i.glTarget,i.glTexture),s.glTexture=i.glTexture);var a=0,o=0;switch(i.glTarget){case r.TEXTURE_2D:for(var h=0;h<n.length;h++){var u=n[h];r.texSubImage2D(r.TEXTURE_2D,u.texSubres.mipLevel,u.texOffset.x,u.texOffset.y,i.glFormat,i.glType,e[a++])}break;case r.TEXTURE_CUBE_MAP:for(var l=0;l<n.length;l++){var c=n[l],_=c.texSubres.baseArrayLayer+c.texSubres.layerCount;for(o=c.texSubres.baseArrayLayer;o<_;++o)r.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+o,c.texSubres.mipLevel,c.texOffset.x,c.texOffset.y,i.glFormat,i.glType,e[a++])}break;default:G("Unsupported GL texture type, copy buffer to texture failed.")}i.flags&ec.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}(J_));v.WebGLDevice=F6;var k6,U6=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._gpuDescriptorSet=null,e}s(e,t);var i=e.prototype;return i.initialize=function(t){this._layout=t.layout;var e=t.layout.gpuDescriptorSetLayout,i=e.bindings,n=e.descriptorIndices,r=e.descriptorCount;this._buffers=Array(r).fill(null),this._textures=Array(r).fill(null),this._samplers=Array(r).fill(null);var s=[];this._gpuDescriptorSet={gpuDescriptors:s,descriptorIndices:n};for(var a=0;a<i.length;++a)for(var o=i[a],h=0;h<o.count;h++)s.push({type:o.descriptorType,gpuBuffer:null,gpuTextureView:null,gpuSampler:null})},i.destroy=function(){this._layout=null,this._gpuDescriptorSet=null},i.update=function(){if(this._isDirty&&this._gpuDescriptorSet){for(var t=this._gpuDescriptorSet.gpuDescriptors,e=0;e<t.length;++e)t[e].type&k_?this._buffers[e]&&(t[e].gpuBuffer=this._buffers[e].gpuBuffer):t[e].type&U_&&(this._textures[e]&&(t[e].gpuTextureView=this._textures[e].gpuTextureView),this._samplers[e]&&(t[e].gpuSampler=this._samplers[e].gpuSampler));this._isDirty=!1}},n(e,[{key:"gpuDescriptorSet",get:function(){return this._gpuDescriptorSet}}]),e}(nd);!function(t){t[t.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",t[t.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",t[t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",t[t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",t[t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",t[t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",t[t.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",t[t.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",t[t.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",t[t.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",t[t.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",t[t.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",t[t.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",t[t.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",t[t.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",t[t.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",t[t.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",t[t.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",t[t.COMPRESSED_RGBA_ASTC_5x4_KHR=37809]="COMPRESSED_RGBA_ASTC_5x4_KHR",t[t.COMPRESSED_RGBA_ASTC_5x5_KHR=37810]="COMPRESSED_RGBA_ASTC_5x5_KHR",t[t.COMPRESSED_RGBA_ASTC_6x5_KHR=37811]="COMPRESSED_RGBA_ASTC_6x5_KHR",t[t.COMPRESSED_RGBA_ASTC_6x6_KHR=37812]="COMPRESSED_RGBA_ASTC_6x6_KHR",t[t.COMPRESSED_RGBA_ASTC_8x5_KHR=37813]="COMPRESSED_RGBA_ASTC_8x5_KHR",t[t.COMPRESSED_RGBA_ASTC_8x6_KHR=37814]="COMPRESSED_RGBA_ASTC_8x6_KHR",t[t.COMPRESSED_RGBA_ASTC_8x8_KHR=37815]="COMPRESSED_RGBA_ASTC_8x8_KHR",t[t.COMPRESSED_RGBA_ASTC_10x5_KHR=37816]="COMPRESSED_RGBA_ASTC_10x5_KHR",t[t.COMPRESSED_RGBA_ASTC_10x6_KHR=37817]="COMPRESSED_RGBA_ASTC_10x6_KHR",t[t.COMPRESSED_RGBA_ASTC_10x8_KHR=37818]="COMPRESSED_RGBA_ASTC_10x8_KHR",t[t.COMPRESSED_RGBA_ASTC_10x10_KHR=37819]="COMPRESSED_RGBA_ASTC_10x10_KHR",t[t.COMPRESSED_RGBA_ASTC_12x10_KHR=37820]="COMPRESSED_RGBA_ASTC_12x10_KHR",t[t.COMPRESSED_RGBA_ASTC_12x12_KHR=37821]="COMPRESSED_RGBA_ASTC_12x12_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=37840]="COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR=37841]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR=37842]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR=37843]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR=37844]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR=37845]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR=37846]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR=37847]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR=37848]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR=37849]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR=37850]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR=37851]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR=37852]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR=37853]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR"}(k6||(k6={}));var G6=function(){function t(){}return t.setInstance=function(e){t._instance=e},n(t,null,[{key:"instance",get:function(){return t._instance}}]),t}();G6._instance=null;var H6=[10497,33648,33071,33071],z6=new Float32Array(4);function V6(t,e){switch(t){case jl.R8:return e.UNSIGNED_BYTE;case jl.R8SN:return e.BYTE;case jl.R8UI:return e.UNSIGNED_BYTE;case jl.R8I:return e.BYTE;case jl.R16F:return e.HALF_FLOAT;case jl.R16UI:return e.UNSIGNED_SHORT;case jl.R16I:return e.SHORT;case jl.R32F:return e.FLOAT;case jl.R32UI:return e.UNSIGNED_INT;case jl.R32I:return e.INT;case jl.RG8:return e.UNSIGNED_BYTE;case jl.RG8SN:return e.BYTE;case jl.RG8UI:return e.UNSIGNED_BYTE;case jl.RG8I:return e.BYTE;case jl.RG16F:return e.HALF_FLOAT;case jl.RG16UI:return e.UNSIGNED_SHORT;case jl.RG16I:return e.SHORT;case jl.RG32F:return e.FLOAT;case jl.RG32UI:return e.UNSIGNED_INT;case jl.RG32I:return e.INT;case jl.RGB8:case jl.SRGB8:return e.UNSIGNED_BYTE;case jl.RGB8SN:return e.BYTE;case jl.RGB8UI:return e.UNSIGNED_BYTE;case jl.RGB8I:return e.BYTE;case jl.RGB16F:return e.HALF_FLOAT;case jl.RGB16UI:return e.UNSIGNED_SHORT;case jl.RGB16I:return e.SHORT;case jl.RGB32F:return e.FLOAT;case jl.RGB32UI:return e.UNSIGNED_INT;case jl.RGB32I:return e.INT;case jl.BGRA8:case jl.RGBA8:case jl.SRGB8_A8:return e.UNSIGNED_BYTE;case jl.RGBA8SN:return e.BYTE;case jl.RGBA8UI:return e.UNSIGNED_BYTE;case jl.RGBA8I:return e.BYTE;case jl.RGBA16F:return e.HALF_FLOAT;case jl.RGBA16UI:return e.UNSIGNED_SHORT;case jl.RGBA16I:return e.SHORT;case jl.RGBA32F:return e.FLOAT;case jl.RGBA32UI:return e.UNSIGNED_INT;case jl.RGBA32I:return e.INT;case jl.R5G6B5:return e.UNSIGNED_SHORT_5_6_5;case jl.R11G11B10F:return e.UNSIGNED_INT_10F_11F_11F_REV;case jl.RGB5A1:return e.UNSIGNED_SHORT_5_5_5_1;case jl.RGBA4:return e.UNSIGNED_SHORT_4_4_4_4;case jl.RGB10A2:case jl.RGB10A2UI:return e.UNSIGNED_INT_2_10_10_10_REV;case jl.RGB9E5:case jl.DEPTH:return e.FLOAT;case jl.DEPTH_STENCIL:return e.UNSIGNED_INT_24_8;case jl.BC1:case jl.BC1_SRGB:case jl.BC2:case jl.BC2_SRGB:case jl.BC3:case jl.BC3_SRGB:case jl.BC4:return e.UNSIGNED_BYTE;case jl.BC4_SNORM:return e.BYTE;case jl.BC5:return e.UNSIGNED_BYTE;case jl.BC5_SNORM:return e.BYTE;case jl.BC6H_SF16:case jl.BC6H_UF16:return e.FLOAT;case jl.BC7:case jl.BC7_SRGB:case jl.ETC_RGB8:case jl.ETC2_RGB8:case jl.ETC2_SRGB8:case jl.ETC2_RGB8_A1:case jl.ETC2_SRGB8_A1:case jl.EAC_R11:return e.UNSIGNED_BYTE;case jl.EAC_R11SN:return e.BYTE;case jl.EAC_RG11:return e.UNSIGNED_BYTE;case jl.EAC_RG11SN:return e.BYTE;case jl.PVRTC_RGB2:case jl.PVRTC_RGBA2:case jl.PVRTC_RGB4:case jl.PVRTC_RGBA4:case jl.PVRTC2_2BPP:case jl.PVRTC2_4BPP:return e.UNSIGNED_BYTE;case jl.ASTC_RGBA_4X4:case jl.ASTC_RGBA_5X4:case jl.ASTC_RGBA_5X5:case jl.ASTC_RGBA_6X5:case jl.ASTC_RGBA_6X6:case jl.ASTC_RGBA_8X5:case jl.ASTC_RGBA_8X6:case jl.ASTC_RGBA_8X8:case jl.ASTC_RGBA_10X5:case jl.ASTC_RGBA_10X6:case jl.ASTC_RGBA_10X8:case jl.ASTC_RGBA_10X10:case jl.ASTC_RGBA_12X10:case jl.ASTC_RGBA_12X12:case jl.ASTC_SRGBA_4X4:case jl.ASTC_SRGBA_5X4:case jl.ASTC_SRGBA_5X5:case jl.ASTC_SRGBA_6X5:case jl.ASTC_SRGBA_6X6:case jl.ASTC_SRGBA_8X5:case jl.ASTC_SRGBA_8X6:case jl.ASTC_SRGBA_8X8:case jl.ASTC_SRGBA_10X5:case jl.ASTC_SRGBA_10X6:case jl.ASTC_SRGBA_10X8:case jl.ASTC_SRGBA_10X10:case jl.ASTC_SRGBA_12X10:case jl.ASTC_SRGBA_12X12:default:return e.UNSIGNED_BYTE}}function W6(t,e){switch(t){case Kl.BOOL:return e.BOOL;case Kl.BOOL2:return e.BOOL_VEC2;case Kl.BOOL3:return e.BOOL_VEC3;case Kl.BOOL4:return e.BOOL_VEC4;case Kl.INT:return e.INT;case Kl.INT2:return e.INT_VEC2;case Kl.INT3:return e.INT_VEC3;case Kl.INT4:return e.INT_VEC4;case Kl.UINT:return e.UNSIGNED_INT;case Kl.FLOAT:return e.FLOAT;case Kl.FLOAT2:return e.FLOAT_VEC2;case Kl.FLOAT3:return e.FLOAT_VEC3;case Kl.FLOAT4:return e.FLOAT_VEC4;case Kl.MAT2:return e.FLOAT_MAT2;case Kl.MAT2X3:return e.FLOAT_MAT2x3;case Kl.MAT2X4:return e.FLOAT_MAT2x4;case Kl.MAT3X2:return e.FLOAT_MAT3x2;case Kl.MAT3:return e.FLOAT_MAT3;case Kl.MAT3X4:return e.FLOAT_MAT3x4;case Kl.MAT4X2:return e.FLOAT_MAT4x2;case Kl.MAT4X3:return e.FLOAT_MAT4x3;case Kl.MAT4:return e.FLOAT_MAT4;case Kl.SAMPLER2D:return e.SAMPLER_2D;case Kl.SAMPLER2D_ARRAY:return e.SAMPLER_2D_ARRAY;case Kl.SAMPLER3D:return e.SAMPLER_3D;case Kl.SAMPLER_CUBE:return e.SAMPLER_CUBE;default:return G("Unsupported GLType, convert to GL type failed."),Kl.UNKNOWN}}function X6(t,e){switch(t){case e.BOOL:return Kl.BOOL;case e.BOOL_VEC2:return Kl.BOOL2;case e.BOOL_VEC3:return Kl.BOOL3;case e.BOOL_VEC4:return Kl.BOOL4;case e.INT:return Kl.INT;case e.INT_VEC2:return Kl.INT2;case e.INT_VEC3:return Kl.INT3;case e.INT_VEC4:return Kl.INT4;case e.UNSIGNED_INT:return Kl.UINT;case e.UNSIGNED_INT_VEC2:return Kl.UINT2;case e.UNSIGNED_INT_VEC3:return Kl.UINT3;case e.UNSIGNED_INT_VEC4:return Kl.UINT4;case e.FLOAT:return Kl.FLOAT;case e.FLOAT_VEC2:return Kl.FLOAT2;case e.FLOAT_VEC3:return Kl.FLOAT3;case e.FLOAT_VEC4:return Kl.FLOAT4;case e.FLOAT_MAT2:return Kl.MAT2;case e.FLOAT_MAT2x3:return Kl.MAT2X3;case e.FLOAT_MAT2x4:return Kl.MAT2X4;case e.FLOAT_MAT3x2:return Kl.MAT3X2;case e.FLOAT_MAT3:return Kl.MAT3;case e.FLOAT_MAT3x4:return Kl.MAT3X4;case e.FLOAT_MAT4x2:return Kl.MAT4X2;case e.FLOAT_MAT4x3:return Kl.MAT4X3;case e.FLOAT_MAT4:return Kl.MAT4;case e.SAMPLER_2D:return Kl.SAMPLER2D;case e.SAMPLER_2D_ARRAY:return Kl.SAMPLER2D_ARRAY;case e.SAMPLER_3D:return Kl.SAMPLER3D;case e.SAMPLER_CUBE:return Kl.SAMPLER_CUBE;default:return G("Unsupported GLType, convert to Type failed."),Kl.UNKNOWN}}function j6(t,e){switch(t){case e.BOOL:return 4;case e.BOOL_VEC2:return 8;case e.BOOL_VEC3:return 12;case e.BOOL_VEC4:return 16;case e.INT:return 4;case e.INT_VEC2:return 8;case e.INT_VEC3:return 12;case e.INT_VEC4:return 16;case e.UNSIGNED_INT:return 4;case e.UNSIGNED_INT_VEC2:return 8;case e.UNSIGNED_INT_VEC3:return 12;case e.UNSIGNED_INT_VEC4:return 16;case e.FLOAT:return 4;case e.FLOAT_VEC2:return 8;case e.FLOAT_VEC3:return 12;case e.FLOAT_VEC4:case e.FLOAT_MAT2:return 16;case e.FLOAT_MAT2x3:return 24;case e.FLOAT_MAT2x4:return 32;case e.FLOAT_MAT3x2:return 24;case e.FLOAT_MAT3:return 36;case e.FLOAT_MAT3x4:return 48;case e.FLOAT_MAT4x2:return 32;case e.FLOAT_MAT4x3:return 48;case e.FLOAT_MAT4:return 64;case e.SAMPLER_2D:case e.SAMPLER_2D_ARRAY:case e.SAMPLER_2D_ARRAY_SHADOW:case e.SAMPLER_3D:case e.SAMPLER_CUBE:case e.INT_SAMPLER_2D:case e.INT_SAMPLER_2D_ARRAY:case e.INT_SAMPLER_3D:case e.INT_SAMPLER_CUBE:case e.UNSIGNED_INT_SAMPLER_2D:case e.UNSIGNED_INT_SAMPLER_2D_ARRAY:case e.UNSIGNED_INT_SAMPLER_3D:case e.UNSIGNED_INT_SAMPLER_CUBE:return 4;default:return G("Unsupported GLType, get type failed."),0}}function Y6(t,e){switch(t){case e.FLOAT_MAT2:case e.FLOAT_MAT2x3:case e.FLOAT_MAT2x4:return 2;case e.FLOAT_MAT3x2:case e.FLOAT_MAT3:case e.FLOAT_MAT3x4:return 3;case e.FLOAT_MAT4x2:case e.FLOAT_MAT4x3:case e.FLOAT_MAT4:return 4;default:return 1}}var K6,q6=[512,513,514,515,516,517,518,519],Q6=[0,7680,7681,7682,7683,5386,34055,34056],Z6=[32774,32778,32779,32775,32776],J6=[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"}(K6||(K6={}));var $6=function(t){this.cmdType=void 0,this.refCount=0,this.cmdType=t},t7=function(t){function e(){var e;return(e=t.call(this,K6.BEGIN_RENDER_PASS)||this).gpuRenderPass=null,e.gpuFramebuffer=null,e.renderArea=new Fc,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}($6),e7=function(t){function e(){var e;return(e=t.call(this,K6.BIND_STATES)||this).gpuPipelineState=null,e.gpuInputAssembler=null,e.gpuDescriptorSets=[],e.dynamicOffsets=[],e.dynamicStates=new N_,e}return s(e,t),e.prototype.clear=function(){this.gpuPipelineState=null,this.gpuInputAssembler=null,this.gpuDescriptorSets.length=0,this.dynamicOffsets.length=0},e}($6),i7=function(t){function e(){var e;return(e=t.call(this,K6.DRAW)||this).drawInfo=new Zc,e}return s(e,t),e.prototype.clear=function(){},e}($6),n7=function(t){function e(){var e;return(e=t.call(this,K6.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}($6),r7=function(t){function e(){var e;return(e=t.call(this,K6.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}($6),s7=function(t){function e(){var e;return(e=t.call(this,K6.BLIT_TEXTURE)||this).srcTexture=null,e.dstTexture=null,e.regions=[],e.filter=sc.LINEAR,e}return s(e,t),e.prototype.clear=function(){this.srcTexture=null,this.dstTexture=null,this.regions.length=0},e}($6),a7=function(){function t(){this.cmds=new Nu(1),this.beginRenderPassCmds=new Nu(1),this.bindStatesCmds=new Nu(1),this.drawCmds=new Nu(1),this.updateBufferCmds=new Nu(1),this.copyBufferToTextureCmds=new Nu(1),this.blitTextureCmds=new Nu(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 o7(t,e,i,n,r){if(e.usage&ql.INDIRECT){e.indirects.clearDraws();for(var s=i.drawInfos,a=0;a<s.length;++a)e.indirects.setDrawInfo(n+a,s[a])}else{var o=i,h=t.gl,u=t.stateCache;switch(e.glTarget){case h.ARRAY_BUFFER:t.extensions.useVAO&&u.glVAO&&(h.bindVertexArray(null),u.glVAO=null),l7.gpuInputAssembler=null,u.glArrayBuffer!==e.glBuffer&&(h.bindBuffer(h.ARRAY_BUFFER,e.glBuffer),u.glArrayBuffer=e.glBuffer),r===o.byteLength?h.bufferSubData(e.glTarget,n,o):h.bufferSubData(e.glTarget,n,o.slice(0,r));break;case h.ELEMENT_ARRAY_BUFFER:t.extensions.useVAO&&u.glVAO&&(h.bindVertexArray(null),u.glVAO=null),l7.gpuInputAssembler=null,u.glElementArrayBuffer!==e.glBuffer&&(h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,e.glBuffer),u.glElementArrayBuffer=e.glBuffer),r===o.byteLength?h.bufferSubData(e.glTarget,n,o):h.bufferSubData(e.glTarget,n,o.slice(0,r));break;case h.UNIFORM_BUFFER:u.glUniformBuffer!==e.glBuffer&&(h.bindBuffer(h.UNIFORM_BUFFER,e.glBuffer),u.glUniformBuffer=e.glBuffer),r===o.byteLength?h.bufferSubData(e.glTarget,n,o):h.bufferSubData(e.glTarget,n,new Float32Array(o,0,r/4));break;default:G("Unsupported BufferType, update buffer failed.")}}}function h7(t,e){var i=t.gl;e.glInternalFmt=function(t,e){switch(t){case jl.A8:return e.ALPHA;case jl.L8:return e.LUMINANCE;case jl.LA8:return e.LUMINANCE_ALPHA;case jl.R8:return e.R8;case jl.R8SN:return e.R8_SNORM;case jl.R8UI:return e.R8UI;case jl.R8I:return e.R8I;case jl.RG8:return e.RG8;case jl.RG8SN:return e.RG8_SNORM;case jl.RG8UI:return e.RG8UI;case jl.RG8I:return e.RG8I;case jl.RGB8:return e.RGB8;case jl.RGB8SN:return e.RGB8_SNORM;case jl.RGB8UI:return e.RGB8UI;case jl.RGB8I:return e.RGB8I;case jl.BGRA8:case jl.RGBA8:return e.RGBA8;case jl.RGBA8SN:return e.RGBA8_SNORM;case jl.RGBA8UI:return e.RGBA8UI;case jl.RGBA8I:return e.RGBA8I;case jl.R16I:return e.R16I;case jl.R16UI:return e.R16UI;case jl.R16F:return e.R16F;case jl.RG16I:return e.RG16I;case jl.RG16UI:return e.RG16UI;case jl.RG16F:return e.RG16F;case jl.RGB16I:return e.RGB16I;case jl.RGB16UI:return e.RGB16UI;case jl.RGB16F:return e.RGB16F;case jl.RGBA16I:return e.RGBA16I;case jl.RGBA16UI:return e.RGBA16UI;case jl.RGBA16F:return e.RGBA16F;case jl.R32I:return e.R32I;case jl.R32UI:return e.R32UI;case jl.R32F:return e.R32F;case jl.RG32I:return e.RG32I;case jl.RG32UI:return e.RG32UI;case jl.RG32F:return e.RG32F;case jl.RGB32I:return e.RGB32I;case jl.RGB32UI:return e.RGB32UI;case jl.RGB32F:return e.RGB32F;case jl.RGBA32I:return e.RGBA32I;case jl.RGBA32UI:return e.RGBA32UI;case jl.RGBA32F:return e.RGBA32F;case jl.R5G6B5:return e.RGB565;case jl.RGB5A1:return e.RGB5_A1;case jl.RGBA4:return e.RGBA4;case jl.SRGB8:return e.SRGB8;case jl.SRGB8_A8:return e.SRGB8_ALPHA8;case jl.RGB10A2:return e.RGB10_A2;case jl.RGB10A2UI:return e.RGB10_A2UI;case jl.R11G11B10F:return e.R11F_G11F_B10F;case jl.DEPTH:return e.DEPTH_COMPONENT32F;case jl.DEPTH_STENCIL:return e.DEPTH24_STENCIL8;case jl.BC1:return k6.COMPRESSED_RGB_S3TC_DXT1_EXT;case jl.BC1_ALPHA:return k6.COMPRESSED_RGBA_S3TC_DXT1_EXT;case jl.BC1_SRGB:return k6.COMPRESSED_SRGB_S3TC_DXT1_EXT;case jl.BC1_SRGB_ALPHA:return k6.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;case jl.BC2:return k6.COMPRESSED_RGBA_S3TC_DXT3_EXT;case jl.BC2_SRGB:return k6.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;case jl.BC3:return k6.COMPRESSED_RGBA_S3TC_DXT5_EXT;case jl.BC3_SRGB:return k6.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;case jl.ETC_RGB8:return k6.COMPRESSED_RGB_ETC1_WEBGL;case jl.ETC2_RGB8:return k6.COMPRESSED_RGB8_ETC2;case jl.ETC2_SRGB8:return k6.COMPRESSED_SRGB8_ETC2;case jl.ETC2_RGB8_A1:return k6.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2;case jl.ETC2_SRGB8_A1:return k6.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2;case jl.ETC2_RGBA8:return k6.COMPRESSED_RGBA8_ETC2_EAC;case jl.ETC2_SRGB8_A8:return k6.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC;case jl.EAC_R11:return k6.COMPRESSED_R11_EAC;case jl.EAC_R11SN:return k6.COMPRESSED_SIGNED_R11_EAC;case jl.EAC_RG11:return k6.COMPRESSED_RG11_EAC;case jl.EAC_RG11SN:return k6.COMPRESSED_SIGNED_RG11_EAC;case jl.PVRTC_RGB2:return k6.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;case jl.PVRTC_RGBA2:return k6.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;case jl.PVRTC_RGB4:return k6.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;case jl.PVRTC_RGBA4:return k6.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;case jl.ASTC_RGBA_4X4:return k6.COMPRESSED_RGBA_ASTC_4x4_KHR;case jl.ASTC_RGBA_5X4:return k6.COMPRESSED_RGBA_ASTC_5x4_KHR;case jl.ASTC_RGBA_5X5:return k6.COMPRESSED_RGBA_ASTC_5x5_KHR;case jl.ASTC_RGBA_6X5:return k6.COMPRESSED_RGBA_ASTC_6x5_KHR;case jl.ASTC_RGBA_6X6:return k6.COMPRESSED_RGBA_ASTC_6x6_KHR;case jl.ASTC_RGBA_8X5:return k6.COMPRESSED_RGBA_ASTC_8x5_KHR;case jl.ASTC_RGBA_8X6:return k6.COMPRESSED_RGBA_ASTC_8x6_KHR;case jl.ASTC_RGBA_8X8:return k6.COMPRESSED_RGBA_ASTC_8x8_KHR;case jl.ASTC_RGBA_10X5:return k6.COMPRESSED_RGBA_ASTC_10x5_KHR;case jl.ASTC_RGBA_10X6:return k6.COMPRESSED_RGBA_ASTC_10x6_KHR;case jl.ASTC_RGBA_10X8:return k6.COMPRESSED_RGBA_ASTC_10x8_KHR;case jl.ASTC_RGBA_10X10:return k6.COMPRESSED_RGBA_ASTC_10x10_KHR;case jl.ASTC_RGBA_12X10:return k6.COMPRESSED_RGBA_ASTC_12x10_KHR;case jl.ASTC_RGBA_12X12:return k6.COMPRESSED_RGBA_ASTC_12x12_KHR;case jl.ASTC_SRGBA_4X4:return k6.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR;case jl.ASTC_SRGBA_5X4:return k6.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR;case jl.ASTC_SRGBA_5X5:return k6.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR;case jl.ASTC_SRGBA_6X5:return k6.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR;case jl.ASTC_SRGBA_6X6:return k6.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR;case jl.ASTC_SRGBA_8X5:return k6.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR;case jl.ASTC_SRGBA_8X6:return k6.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR;case jl.ASTC_SRGBA_8X8:return k6.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR;case jl.ASTC_SRGBA_10X5:return k6.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR;case jl.ASTC_SRGBA_10X6:return k6.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR;case jl.ASTC_SRGBA_10X8:return k6.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR;case jl.ASTC_SRGBA_10X10:return k6.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR;case jl.ASTC_SRGBA_12X10:return k6.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR;case jl.ASTC_SRGBA_12X12:return k6.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR;default:return G("Unsupported Format, convert to WebGL internal format failed."),e.RGBA}}(e.format,i),e.glFormat=function(t,e){switch(t){case jl.A8:return e.ALPHA;case jl.L8:return e.LUMINANCE;case jl.LA8:return e.LUMINANCE_ALPHA;case jl.R8:case jl.R8SN:return e.RED;case jl.R8UI:case jl.R8I:return e.RED;case jl.RG8:case jl.RG8SN:case jl.RG8UI:case jl.RG8I:return e.RG;case jl.RGB8:case jl.RGB8SN:case jl.RGB8UI:case jl.RGB8I:return e.RGB;case jl.BGRA8:case jl.RGBA8:case jl.RGBA8SN:case jl.RGBA8UI:case jl.RGBA8I:return e.RGBA;case jl.R16UI:case jl.R16I:case jl.R16F:return e.RED;case jl.RG16UI:case jl.RG16I:case jl.RG16F:return e.RG;case jl.RGB16UI:case jl.RGB16I:case jl.RGB16F:return e.RGB;case jl.RGBA16UI:case jl.RGBA16I:case jl.RGBA16F:return e.RGBA;case jl.R32UI:case jl.R32I:case jl.R32F:return e.RED;case jl.RG32UI:case jl.RG32I:case jl.RG32F:return e.RG;case jl.RGB32UI:case jl.RGB32I:case jl.RGB32F:return e.RGB;case jl.RGBA32UI:case jl.RGBA32I:case jl.RGBA32F:case jl.RGB10A2:return e.RGBA;case jl.R11G11B10F:case jl.R5G6B5:return e.RGB;case jl.RGB5A1:case jl.RGBA4:return e.RGBA;case jl.SRGB8:return e.RGB;case jl.SRGB8_A8:return e.RGBA;case jl.DEPTH:return e.DEPTH_COMPONENT;case jl.DEPTH_STENCIL:return e.DEPTH_STENCIL;case jl.BC1:return k6.COMPRESSED_RGB_S3TC_DXT1_EXT;case jl.BC1_ALPHA:return k6.COMPRESSED_RGBA_S3TC_DXT1_EXT;case jl.BC1_SRGB:return k6.COMPRESSED_SRGB_S3TC_DXT1_EXT;case jl.BC1_SRGB_ALPHA:return k6.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;case jl.BC2:return k6.COMPRESSED_RGBA_S3TC_DXT3_EXT;case jl.BC2_SRGB:return k6.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;case jl.BC3:return k6.COMPRESSED_RGBA_S3TC_DXT5_EXT;case jl.BC3_SRGB:return k6.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;case jl.ETC_RGB8:return k6.COMPRESSED_RGB_ETC1_WEBGL;case jl.ETC2_RGB8:return k6.COMPRESSED_RGB8_ETC2;case jl.ETC2_SRGB8:return k6.COMPRESSED_SRGB8_ETC2;case jl.ETC2_RGB8_A1:return k6.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2;case jl.ETC2_SRGB8_A1:return k6.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2;case jl.ETC2_RGBA8:return k6.COMPRESSED_RGBA8_ETC2_EAC;case jl.ETC2_SRGB8_A8:return k6.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC;case jl.EAC_R11:return k6.COMPRESSED_R11_EAC;case jl.EAC_R11SN:return k6.COMPRESSED_SIGNED_R11_EAC;case jl.EAC_RG11:return k6.COMPRESSED_RG11_EAC;case jl.EAC_RG11SN:return k6.COMPRESSED_SIGNED_RG11_EAC;case jl.PVRTC_RGB2:return k6.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;case jl.PVRTC_RGBA2:return k6.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;case jl.PVRTC_RGB4:return k6.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;case jl.PVRTC_RGBA4:return k6.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;case jl.ASTC_RGBA_4X4:return k6.COMPRESSED_RGBA_ASTC_4x4_KHR;case jl.ASTC_RGBA_5X4:return k6.COMPRESSED_RGBA_ASTC_5x4_KHR;case jl.ASTC_RGBA_5X5:return k6.COMPRESSED_RGBA_ASTC_5x5_KHR;case jl.ASTC_RGBA_6X5:return k6.COMPRESSED_RGBA_ASTC_6x5_KHR;case jl.ASTC_RGBA_6X6:return k6.COMPRESSED_RGBA_ASTC_6x6_KHR;case jl.ASTC_RGBA_8X5:return k6.COMPRESSED_RGBA_ASTC_8x5_KHR;case jl.ASTC_RGBA_8X6:return k6.COMPRESSED_RGBA_ASTC_8x6_KHR;case jl.ASTC_RGBA_8X8:return k6.COMPRESSED_RGBA_ASTC_8x8_KHR;case jl.ASTC_RGBA_10X5:return k6.COMPRESSED_RGBA_ASTC_10x5_KHR;case jl.ASTC_RGBA_10X6:return k6.COMPRESSED_RGBA_ASTC_10x6_KHR;case jl.ASTC_RGBA_10X8:return k6.COMPRESSED_RGBA_ASTC_10x8_KHR;case jl.ASTC_RGBA_10X10:return k6.COMPRESSED_RGBA_ASTC_10x10_KHR;case jl.ASTC_RGBA_12X10:return k6.COMPRESSED_RGBA_ASTC_12x10_KHR;case jl.ASTC_RGBA_12X12:return k6.COMPRESSED_RGBA_ASTC_12x12_KHR;case jl.ASTC_SRGBA_4X4:return k6.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR;case jl.ASTC_SRGBA_5X4:return k6.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR;case jl.ASTC_SRGBA_5X5:return k6.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR;case jl.ASTC_SRGBA_6X5:return k6.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR;case jl.ASTC_SRGBA_6X6:return k6.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR;case jl.ASTC_SRGBA_8X5:return k6.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR;case jl.ASTC_SRGBA_8X6:return k6.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR;case jl.ASTC_SRGBA_8X8:return k6.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR;case jl.ASTC_SRGBA_10X5:return k6.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR;case jl.ASTC_SRGBA_10X6:return k6.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR;case jl.ASTC_SRGBA_10X8:return k6.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR;case jl.ASTC_SRGBA_10X10:return k6.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR;case jl.ASTC_SRGBA_12X10:return k6.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR;case jl.ASTC_SRGBA_12X12:return k6.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR;default:return G("Unsupported Format, convert to WebGL format failed."),e.RGBA}}(e.format,i),e.glType=V6(e.format,i);var n=e.width,r=e.height,s=e.depth,a=e.arrayLayer;switch(e.type){case $l.TEX2D:e.glTarget=i.TEXTURE_2D;var o=Math.max(n,r);if(o>t.capabilities.maxTextureSize&&Z(9100,o,t.capabilities.maxTextureSize),e.samples===nc.X1){if(e.glTexture=i.createTexture(),e.size>0){var h=t.stateCache.glTexUnits[t.stateCache.texUnit];if(h.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_2D,e.glTexture),h.glTexture=e.glTexture),F_[e.format].isCompressed)for(var u=0;u<e.mipLevel;++u){var l=z_(e.format,n,r,1),c=new Uint8Array(l);i.compressedTexImage2D(i.TEXTURE_2D,u,e.glInternalFmt,n,r,0,c),n=Math.max(1,n>>1),r=Math.max(1,r>>1)}else e.flags&ec.MUTABLE_STORAGE?i.texImage2D(i.TEXTURE_2D,0,e.glInternalFmt,n,r,0,e.glFormat,e.glType,null):i.texStorage2D(i.TEXTURE_2D,e.mipLevel,e.glInternalFmt,n,r)}}else e.glRenderbuffer=i.createRenderbuffer(),e.size>0&&(t.stateCache.glRenderbuffer!==e.glRenderbuffer&&(i.bindRenderbuffer(i.RENDERBUFFER,e.glRenderbuffer),t.stateCache.glRenderbuffer=e.glRenderbuffer),i.renderbufferStorageMultisample(i.RENDERBUFFER,e.samples,e.glInternalFmt,e.width,e.height));break;case $l.TEX2D_ARRAY:e.glTarget=i.TEXTURE_2D_ARRAY;var _=Math.max(n,r);if(_>t.capabilities.maxTextureSize&&Z(9100,_,t.capabilities.maxTextureSize),a>t.capabilities.maxArrayTextureLayers&&Z(9100,a,t.capabilities.maxArrayTextureLayers),e.glTexture=i.createTexture(),e.size>0){var d=t.stateCache.glTexUnits[t.stateCache.texUnit];if(d.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_2D_ARRAY,e.glTexture),d.glTexture=e.glTexture),F_[e.format].isCompressed)for(var f=0;f<e.mipLevel;++f){var p=z_(e.format,n,r,a),m=new Uint8Array(p);i.compressedTexImage3D(i.TEXTURE_2D_ARRAY,f,e.glInternalFmt,n,r,a,0,m),n=Math.max(1,n>>1),r=Math.max(1,r>>1)}else i.texStorage3D(i.TEXTURE_2D_ARRAY,e.mipLevel,e.glInternalFmt,n,r,a)}break;case $l.TEX3D:e.glTarget=i.TEXTURE_3D;var g=Math.max(Math.max(n,r),s);if(g>t.capabilities.max3DTextureSize&&Z(9100,g,t.capabilities.max3DTextureSize),e.glTexture=i.createTexture(),e.size>0){var v=t.stateCache.glTexUnits[t.stateCache.texUnit];if(v.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_3D,e.glTexture),v.glTexture=e.glTexture),F_[e.format].isCompressed)for(var y=0;y<e.mipLevel;++y){var T=z_(e.format,n,r,s),S=new Uint8Array(T);i.compressedTexImage3D(i.TEXTURE_3D,y,e.glInternalFmt,n,r,s,0,S),n=Math.max(1,n>>1),r=Math.max(1,r>>1)}else i.texStorage3D(i.TEXTURE_3D,e.mipLevel,e.glInternalFmt,n,r,s)}break;case $l.CUBE:e.glTarget=i.TEXTURE_CUBE_MAP;var E=Math.max(n,r);if(E>t.capabilities.maxCubeMapTextureSize&&Z(9100,E,t.capabilities.maxTextureSize),e.glTexture=i.createTexture(),e.size>0){var A=t.stateCache.glTexUnits[t.stateCache.texUnit];if(A.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_CUBE_MAP,e.glTexture),A.glTexture=e.glTexture),F_[e.format].isCompressed)for(var R=0;R<e.mipLevel;++R){for(var b=z_(e.format,n,r,1),C=new Uint8Array(b),w=0;w<6;++w)i.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+w,R,e.glInternalFmt,n,r,0,C);n=Math.max(1,n>>1),r=Math.max(1,r>>1)}else i.texStorage2D(i.TEXTURE_CUBE_MAP,e.mipLevel,e.glInternalFmt,n,r)}break;default:G("Unsupported TextureType, create texture failed."),e.type=$l.TEX2D,e.glTarget=i.TEXTURE_2D}}function u7(t,e){var i=t.gl;if(e.glTexture){var n=t.stateCache.glTexUnits,r=t.stateCache.texUnit;i.deleteTexture(e.glTexture);for(var s=0;s<n.length;++s)n[s].glTexture===e.glTexture&&(i.activeTexture(i.TEXTURE0+s),r=s,i.bindTexture(e.glTarget,null),n[s].glTexture=null);t.stateCache.texUnit=r,e.glTexture=null}if(e.glRenderbuffer){var a=t.stateCache.glRenderbuffer;i.deleteRenderbuffer(e.glRenderbuffer),a===e.glRenderbuffer&&(i.bindRenderbuffer(i.RENDERBUFFER,null),a=null),e.glRenderbuffer=null}}var l7={gpuPipelineState:null,gpuInputAssembler:null,glPrimitive:0,invalidateAttachments:[]};function c7(t,e,i,n,r,s,a){var o=t.gl,h=t.stateCache,u=0;if(i&&e){h.glFramebuffer!==i.glFramebuffer&&(o.bindFramebuffer(o.FRAMEBUFFER,i.glFramebuffer),h.glFramebuffer=i.glFramebuffer),h.viewport.left===n.x&&h.viewport.top===n.y&&h.viewport.width===n.width&&h.viewport.height===n.height||(o.viewport(n.x,n.y,n.width,n.height),h.viewport.left=n.x,h.viewport.top=n.y,h.viewport.width=n.width,h.viewport.height=n.height),h.scissorRect.x===n.x&&h.scissorRect.y===n.y&&h.scissorRect.width===n.width&&h.scissorRect.height===n.height||(o.scissor(n.x,n.y,n.width,n.height),h.scissorRect.x=n.x,h.scissorRect.y=n.y,h.scissorRect.width=n.width,h.scissorRect.height=n.height),l7.invalidateAttachments.length=0;for(var l=0;l<r.length;++l){var c=e.colorAttachments[l];if(c.format!==jl.UNKNOWN)switch(c.loadOp){case dc.LOAD:break;case dc.CLEAR:if(h.bs.targets[0].blendColorMask!==cc.ALL&&o.colorMask(!0,!0,!0,!0),1===e.colorAttachments.length){var _=r[0];o.clearColor(_.x,_.y,_.z,_.w),u|=o.COLOR_BUFFER_BIT}else z6[0]=r[l].x,z6[1]=r[l].y,z6[2]=r[l].z,z6[3]=r[l].w,o.clearBufferfv(o.COLOR,l,z6);break;case dc.DISCARD:l7.invalidateAttachments.push(o.COLOR_ATTACHMENT0+l)}}if(e.depthStencilAttachment&&e.depthStencilAttachment.format!==jl.UNKNOWN){switch(e.depthStencilAttachment.depthLoadOp){case dc.LOAD:break;case dc.CLEAR:h.dss.depthWrite||o.depthMask(!0),o.clearDepth(s),u|=o.DEPTH_BUFFER_BIT;break;case dc.DISCARD:l7.invalidateAttachments.push(o.DEPTH_ATTACHMENT)}if(F_[e.depthStencilAttachment.format].hasStencil)switch(e.depthStencilAttachment.stencilLoadOp){case dc.LOAD:break;case dc.CLEAR:h.dss.stencilWriteMaskFront||o.stencilMaskSeparate(o.FRONT,65535),h.dss.stencilWriteMaskBack||o.stencilMaskSeparate(o.BACK,65535),o.clearStencil(a),u|=o.STENCIL_BUFFER_BIT;break;case dc.DISCARD:l7.invalidateAttachments.push(o.STENCIL_ATTACHMENT)}}if(i.glFramebuffer&&l7.invalidateAttachments.length&&o.invalidateFramebuffer(o.FRAMEBUFFER,l7.invalidateAttachments),u&&o.clear(u),u&o.COLOR_BUFFER_BIT){var d=h.bs.targets[0].blendColorMask;if(d!==cc.ALL){var f=(d&cc.R)!==cc.NONE,p=(d&cc.G)!==cc.NONE,m=(d&cc.B)!==cc.NONE,g=(d&cc.A)!==cc.NONE;o.colorMask(f,p,m,g)}}u&o.DEPTH_BUFFER_BIT&&!h.dss.depthWrite&&o.depthMask(!1),u&o.STENCIL_BUFFER_BIT&&(h.dss.stencilWriteMaskFront||o.stencilMaskSeparate(o.FRONT,0),h.dss.stencilWriteMaskBack||o.stencilMaskSeparate(o.BACK,0))}}function _7(t,e,i,n,r,s){var a=t.gl,o=t.stateCache,h=e&&e.gpuShader,u=!1;if(e&&l7.gpuPipelineState!==e){if(l7.gpuPipelineState=e,l7.glPrimitive=e.glPrimitive,h){var l=h.glProgram;o.glProgram!==l&&(a.useProgram(l),o.glProgram=l,u=!0)}var c=e.rs;if(c){if(o.rs.cullMode!==c.cullMode){switch(c.cullMode){case Sc.NONE:a.disable(a.CULL_FACE);break;case Sc.FRONT:a.enable(a.CULL_FACE),a.cullFace(a.FRONT);break;case Sc.BACK:a.enable(a.CULL_FACE),a.cullFace(a.BACK)}t.stateCache.rs.cullMode=c.cullMode}var _=c.isFrontFaceCCW;t.stateCache.rs.isFrontFaceCCW!==_&&(a.frontFace(_?a.CCW:a.CW),t.stateCache.rs.isFrontFaceCCW=_),t.stateCache.rs.depthBias===c.depthBias&&t.stateCache.rs.depthBiasSlop===c.depthBiasSlop||(a.polygonOffset(c.depthBias,c.depthBiasSlop),t.stateCache.rs.depthBias=c.depthBias,t.stateCache.rs.depthBiasSlop=c.depthBiasSlop),t.stateCache.rs.lineWidth!==c.lineWidth&&(a.lineWidth(c.lineWidth),t.stateCache.rs.lineWidth=c.lineWidth)}var d=e.dss;d&&(o.dss.depthTest!==d.depthTest&&(d.depthTest?a.enable(a.DEPTH_TEST):a.disable(a.DEPTH_TEST),o.dss.depthTest=d.depthTest),o.dss.depthWrite!==d.depthWrite&&(a.depthMask(d.depthWrite),o.dss.depthWrite=d.depthWrite),o.dss.depthFunc!==d.depthFunc&&(a.depthFunc(q6[d.depthFunc]),o.dss.depthFunc=d.depthFunc),o.dss.stencilTestFront===d.stencilTestFront&&o.dss.stencilTestBack===d.stencilTestBack||(d.stencilTestFront||d.stencilTestBack?a.enable(a.STENCIL_TEST):a.disable(a.STENCIL_TEST),o.dss.stencilTestFront=d.stencilTestFront,o.dss.stencilTestBack=d.stencilTestBack),o.dss.stencilFuncFront===d.stencilFuncFront&&o.dss.stencilRefFront===d.stencilRefFront&&o.dss.stencilReadMaskFront===d.stencilReadMaskFront||(a.stencilFuncSeparate(a.FRONT,q6[d.stencilFuncFront],d.stencilRefFront,d.stencilReadMaskFront),o.dss.stencilFuncFront=d.stencilFuncFront,o.dss.stencilRefFront=d.stencilRefFront,o.dss.stencilReadMaskFront=d.stencilReadMaskFront),o.dss.stencilFailOpFront===d.stencilFailOpFront&&o.dss.stencilZFailOpFront===d.stencilZFailOpFront&&o.dss.stencilPassOpFront===d.stencilPassOpFront||(a.stencilOpSeparate(a.FRONT,Q6[d.stencilFailOpFront],Q6[d.stencilZFailOpFront],Q6[d.stencilPassOpFront]),o.dss.stencilFailOpFront=d.stencilFailOpFront,o.dss.stencilZFailOpFront=d.stencilZFailOpFront,o.dss.stencilPassOpFront=d.stencilPassOpFront),o.dss.stencilWriteMaskFront!==d.stencilWriteMaskFront&&(a.stencilMaskSeparate(a.FRONT,d.stencilWriteMaskFront),o.dss.stencilWriteMaskFront=d.stencilWriteMaskFront),o.dss.stencilFuncBack===d.stencilFuncBack&&o.dss.stencilRefBack===d.stencilRefBack&&o.dss.stencilReadMaskBack===d.stencilReadMaskBack||(a.stencilFuncSeparate(a.BACK,q6[d.stencilFuncBack],d.stencilRefBack,d.stencilReadMaskBack),o.dss.stencilFuncBack=d.stencilFuncBack,o.dss.stencilRefBack=d.stencilRefBack,o.dss.stencilReadMaskBack=d.stencilReadMaskBack),o.dss.stencilFailOpBack===d.stencilFailOpBack&&o.dss.stencilZFailOpBack===d.stencilZFailOpBack&&o.dss.stencilPassOpBack===d.stencilPassOpBack||(a.stencilOpSeparate(a.BACK,Q6[d.stencilFailOpBack],Q6[d.stencilZFailOpBack],Q6[d.stencilPassOpBack]),o.dss.stencilFailOpBack=d.stencilFailOpBack,o.dss.stencilZFailOpBack=d.stencilZFailOpBack,o.dss.stencilPassOpBack=d.stencilPassOpBack),o.dss.stencilWriteMaskBack!==d.stencilWriteMaskBack&&(a.stencilMaskSeparate(a.BACK,d.stencilWriteMaskBack),o.dss.stencilWriteMaskBack=d.stencilWriteMaskBack));var f=e.bs;if(f){o.bs.isA2C!==f.isA2C&&(f.isA2C?a.enable(a.SAMPLE_ALPHA_TO_COVERAGE):a.disable(a.SAMPLE_ALPHA_TO_COVERAGE),o.bs.isA2C=f.isA2C),o.bs.blendColor.x===f.blendColor.x&&o.bs.blendColor.y===f.blendColor.y&&o.bs.blendColor.z===f.blendColor.z&&o.bs.blendColor.w===f.blendColor.w||(a.blendColor(f.blendColor.x,f.blendColor.y,f.blendColor.z,f.blendColor.w),o.bs.blendColor.x=f.blendColor.x,o.bs.blendColor.y=f.blendColor.y,o.bs.blendColor.z=f.blendColor.z,o.bs.blendColor.w=f.blendColor.w);var p=f.targets[0],m=o.bs.targets[0];m.blend!==p.blend&&(p.blend?a.enable(a.BLEND):a.disable(a.BLEND),m.blend=p.blend),m.blendEq===p.blendEq&&m.blendAlphaEq===p.blendAlphaEq||(a.blendEquationSeparate(Z6[p.blendEq],Z6[p.blendAlphaEq]),m.blendEq=p.blendEq,m.blendAlphaEq=p.blendAlphaEq),m.blendSrc===p.blendSrc&&m.blendDst===p.blendDst&&m.blendSrcAlpha===p.blendSrcAlpha&&m.blendDstAlpha===p.blendDstAlpha||(a.blendFuncSeparate(J6[p.blendSrc],J6[p.blendDst],J6[p.blendSrcAlpha],J6[p.blendDstAlpha]),m.blendSrc=p.blendSrc,m.blendDst=p.blendDst,m.blendSrcAlpha=p.blendSrcAlpha,m.blendDstAlpha=p.blendDstAlpha),m.blendColorMask!==p.blendColorMask&&(a.colorMask((p.blendColorMask&cc.R)!==cc.NONE,(p.blendColorMask&cc.G)!==cc.NONE,(p.blendColorMask&cc.B)!==cc.NONE,(p.blendColorMask&cc.A)!==cc.NONE),m.blendColorMask=p.blendColorMask)}}if(e&&e.gpuPipelineLayout&&h){for(var g=h.glBlocks.length,v=e.gpuPipelineLayout.dynamicOffsetIndices,y=0;y<g;y++){var T=h.glBlocks[y],S=n[T.set],E=S&&S.descriptorIndices[T.binding],A=E>=0&&S.gpuDescriptors[E];if(A&&A.gpuBuffer){var R=v[T.set],b=R&&R[T.binding],C=A.gpuBuffer.glOffset;b>=0&&(C+=r[b]),o.glBindUBOs[T.glBinding]===A.gpuBuffer.glBuffer&&o.glBindUBOOffsets[T.glBinding]===C||(C?a.bindBufferRange(a.UNIFORM_BUFFER,T.glBinding,A.gpuBuffer.glBuffer,C,A.gpuBuffer.size):a.bindBufferBase(a.UNIFORM_BUFFER,T.glBinding,A.gpuBuffer.glBuffer),o.glUniformBuffer=o.glBindUBOs[T.glBinding]=A.gpuBuffer.glBuffer,o.glBindUBOOffsets[T.glBinding]=C)}}for(var w=h.glSamplerTextures.length,x=0;x<w;x++)for(var I=h.glSamplerTextures[x],O=n[I.set],D=O&&O.descriptorIndices[I.binding],M=D>=0&&O.gpuDescriptors[D],P=0;P<I.units.length;P++){var B=I.units[P],N=o.glTexUnits[B];if(M&&M.gpuTextureView&&M.gpuTextureView.gpuTexture&&M.gpuSampler){var L=M.gpuTextureView,F=L.gpuTexture,k=L.baseLevel,U=k+L.levelCount;if(F.size>0){N.glTexture!==F.glTexture&&(o.texUnit!==B&&(a.activeTexture(a.TEXTURE0+B),o.texUnit=B),F.glTexture?a.bindTexture(F.glTarget,F.glTexture):a.bindTexture(F.glTarget,t.nullTex2D.gpuTexture.glTexture),N.glTexture=F.glTexture);var G=M.gpuSampler.getGLSampler(t,k,U);o.glSamplerUnits[B]!==G&&(a.bindSampler(B,G),o.glSamplerUnits[B]=G)}M=O.gpuDescriptors[++D]}}}if(i&&h&&(u||l7.gpuInputAssembler!==i))if(l7.gpuInputAssembler=i,t.extensions.useVAO){var H=i.glVAOs.get(h.glProgram);if(!H){var z;H=a.createVertexArray(),i.glVAOs.set(h.glProgram,H),a.bindVertexArray(H),a.bindBuffer(a.ARRAY_BUFFER,null),a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,null),o.glArrayBuffer=null,o.glElementArrayBuffer=null;for(var V=0;V<h.glInputs.length;V++){var W=h.glInputs[V];z=null;for(var X=0;X<i.glAttribs.length;X++){var j=i.glAttribs[X];if(j.name===W.name){z=j;break}}if(z){o.glArrayBuffer!==z.glBuffer&&(a.bindBuffer(a.ARRAY_BUFFER,z.glBuffer),o.glArrayBuffer=z.glBuffer);for(var Y=0;Y<z.componentCount;++Y){var K=W.glLoc+Y,q=z.offset+z.size*Y;a.enableVertexAttribArray(K),o.glCurrentAttribLocs[K]=!0,a.vertexAttribPointer(K,z.count,z.glType,z.isNormalized,z.stride,q),a.vertexAttribDivisor(K,z.isInstanced?1:0)}}}var Q=i.gpuIndexBuffer;Q&&a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,Q.glBuffer),a.bindVertexArray(null),a.bindBuffer(a.ARRAY_BUFFER,null),a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,null),o.glArrayBuffer=null,o.glElementArrayBuffer=null}o.glVAO!==H&&(a.bindVertexArray(H),o.glVAO=H)}else{for(var Z=0;Z<t.capabilities.maxVertexAttributes;++Z)o.glCurrentAttribLocs[Z]=!1;for(var J=0;J<h.glInputs.length;J++){for(var $=h.glInputs[J],tt=null,et=0;et<i.glAttribs.length;et++){var it=i.glAttribs[et];if(it.name===$.name){tt=it;break}}if(tt){o.glArrayBuffer!==tt.glBuffer&&(a.bindBuffer(a.ARRAY_BUFFER,tt.glBuffer),o.glArrayBuffer=tt.glBuffer);for(var nt=0;nt<tt.componentCount;++nt){var rt=$.glLoc+nt,st=tt.offset+tt.size*nt;!o.glEnabledAttribLocs[rt]&&rt>=0&&(a.enableVertexAttribArray(rt),o.glEnabledAttribLocs[rt]=!0),o.glCurrentAttribLocs[rt]=!0,a.vertexAttribPointer(rt,tt.count,tt.glType,tt.isNormalized,tt.stride,st),a.vertexAttribDivisor(rt,tt.isInstanced?1:0)}}}var at=i.gpuIndexBuffer;at&&o.glElementArrayBuffer!==at.glBuffer&&(a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,at.glBuffer),o.glElementArrayBuffer=at.glBuffer);for(var ot=0;ot<t.capabilities.maxVertexAttributes;++ot)o.glEnabledAttribLocs[ot]!==o.glCurrentAttribLocs[ot]&&(a.disableVertexAttribArray(ot),o.glEnabledAttribLocs[ot]=!1)}if(e&&e.dynamicStates.length)for(var ht=e.dynamicStates.length,ut=0;ut<ht;ut++)switch(e.dynamicStates[ut]){case Ec.LINE_WIDTH:o.rs.lineWidth!==s.lineWidth&&(a.lineWidth(s.lineWidth),o.rs.lineWidth=s.lineWidth);break;case Ec.DEPTH_BIAS:o.rs.depthBias===s.depthBiasConstant&&o.rs.depthBiasSlop===s.depthBiasSlope||(a.polygonOffset(s.depthBiasConstant,s.depthBiasSlope),o.rs.depthBias=s.depthBiasConstant,o.rs.depthBiasSlop=s.depthBiasSlope);break;case Ec.BLEND_CONSTANTS:var lt=s.blendConstant;o.bs.blendColor.x===lt.x&&o.bs.blendColor.y===lt.y&&o.bs.blendColor.z===lt.z&&o.bs.blendColor.w===lt.w||(a.blendColor(lt.x,lt.y,lt.z,lt.w),o.bs.blendColor.copy(lt));break;case Ec.STENCIL_WRITE_MASK:var ct=s.stencilStatesFront,_t=s.stencilStatesBack;o.dss.stencilWriteMaskFront!==ct.writeMask&&(a.stencilMaskSeparate(a.FRONT,ct.writeMask),o.dss.stencilWriteMaskFront=ct.writeMask),o.dss.stencilWriteMaskBack!==_t.writeMask&&(a.stencilMaskSeparate(a.BACK,_t.writeMask),o.dss.stencilWriteMaskBack=_t.writeMask);break;case Ec.STENCIL_COMPARE_MASK:var dt=s.stencilStatesFront,ft=s.stencilStatesBack;o.dss.stencilRefFront===dt.reference&&o.dss.stencilReadMaskFront===dt.compareMask||(a.stencilFuncSeparate(a.FRONT,q6[o.dss.stencilFuncFront],dt.reference,dt.compareMask),o.dss.stencilRefFront=dt.reference,o.dss.stencilReadMaskFront=dt.compareMask),o.dss.stencilRefBack===ft.reference&&o.dss.stencilReadMaskBack===ft.compareMask||(a.stencilFuncSeparate(a.BACK,q6[o.dss.stencilFuncBack],ft.reference,ft.compareMask),o.dss.stencilRefBack=ft.reference,o.dss.stencilReadMaskBack=ft.compareMask)}}function d7(t,e){var i=t.gl,n=l7.gpuInputAssembler,r=l7.glPrimitive,s=t.extensions.WEBGL_multi_draw;if(n){var a=n.gpuIndexBuffer;if(n.gpuIndirectBuffer){var o=n.gpuIndirectBuffer.indirects;if(o.drawByIndex){for(var h=0;h<o.drawCount;h++)o.byteOffsets[h]=o.offsets[h]*a.stride;if(s)o.instancedDraw?s.multiDrawElementsInstancedWEBGL(r,o.counts,0,n.glIndexType,o.byteOffsets,0,o.instances,0,o.drawCount):s.multiDrawElementsWEBGL(r,o.counts,0,n.glIndexType,o.byteOffsets,0,o.drawCount);else for(var u=0;u<o.drawCount;u++)o.instances[u]?i.drawElementsInstanced(r,o.counts[u],n.glIndexType,o.byteOffsets[u],o.instances[u]):i.drawElements(r,o.counts[u],n.glIndexType,o.byteOffsets[u])}else if(s)o.instancedDraw?s.multiDrawArraysInstancedWEBGL(r,o.offsets,0,o.counts,0,o.instances,0,o.drawCount):s.multiDrawArraysWEBGL(r,o.offsets,0,o.counts,0,o.drawCount);else for(var l=0;l<o.drawCount;l++)o.instances[l]?i.drawArraysInstanced(r,o.offsets[l],o.counts[l],o.instances[l]):i.drawArrays(r,o.offsets[l],o.counts[l])}else if(e.instanceCount)if(a){if(e.indexCount>0){var c=e.firstIndex*a.stride;i.drawElementsInstanced(r,e.indexCount,n.glIndexType,c,e.instanceCount)}}else e.vertexCount>0&&i.drawArraysInstanced(r,e.firstVertex,e.vertexCount,e.instanceCount);else if(a){if(e.indexCount>0){var _=e.firstIndex*a.stride;i.drawElements(r,e.indexCount,n.glIndexType,_)}}else e.vertexCount>0&&i.drawArrays(r,e.firstVertex,e.vertexCount)}}var f7=new Array(K6.COUNT);function p7(t,e){f7.fill(0);for(var i=0;i<e.cmds.length;++i){var n=e.cmds.array[i],r=f7[n]++;switch(n){case K6.BEGIN_RENDER_PASS:var s=e.beginRenderPassCmds.array[r];c7(t,s.gpuRenderPass,s.gpuFramebuffer,s.renderArea,s.clearColors,s.clearDepth,s.clearStencil);break;case K6.BIND_STATES:var a=e.bindStatesCmds.array[r];_7(t,a.gpuPipelineState,a.gpuInputAssembler,a.gpuDescriptorSets,a.dynamicOffsets,a.dynamicStates);break;case K6.DRAW:d7(t,e.drawCmds.array[r].drawInfo);break;case K6.UPDATE_BUFFER:var o=e.updateBufferCmds.array[r];o7(t,o.gpuBuffer,o.buffer,o.offset,o.size);break;case K6.COPY_BUFFER_TO_TEXTURE:var h=e.copyBufferToTextureCmds.array[r];v7(t,h.buffers,h.gpuTexture,h.regions);break;case K6.BLIT_TEXTURE:var u=e.blitTextureCmds.array[r];y7(t,u.srcTexture,u.dstTexture,u.regions,u.filter)}}}var m7=new Uint8Array(1);function g7(t,e,i,n,r){var s=Y_(e).height,a=z_(e,r.width,r.height,r.depth),o=z_(e,n.width,1,1),h=z_(e,n.width,n.height,1),u=z_(e,r.width,1,1),l=j_(F_[e]);m7.byteLength<a&&(m7=new Uint8Array(a));for(var c=0,_=i,d=0;d<r.depth;d++){_=i+h*d;for(var f=0;f<r.height;f+=s)m7.subarray(c,c+u).set(new Uint8Array(t.buffer,t.byteOffset+_,u)),c+=u,_+=o}var p=a/l.BYTES_PER_ELEMENT;return tt(Number.isInteger(p),9101),new l(m7.buffer,0,p)}function v7(t,e,i,n){var r=t.gl,s=t.stateCache.glTexUnits[t.stateCache.texUnit];s.glTexture!==i.glTexture&&(r.bindTexture(i.glTarget,i.glTexture),s.glTexture=i.glTexture);var a=0,o=0,h=F_[i.format],u=j_(h),l=h.isCompressed,c=Y_(i.format),_=new kc,d=new Lc,f=new kc;switch(i.glTarget){case r.TEXTURE_2D:for(var p=0;p<n.length;p++){var m=n[p],g=m.texSubres.mipLevel;d.x=0===m.texOffset.x?0:K_(m.texOffset.x,c.width),d.y=0===m.texOffset.y?0:K_(m.texOffset.y,c.height),_.width=m.texExtent.width<c.width?m.texExtent.width:K_(m.texExtent.width,c.width),_.height=m.texExtent.height<c.height?m.texExtent.width:K_(m.texExtent.height,c.height),f.width=m.buffStride>0?m.buffStride:_.width,f.height=m.buffTexHeight>0?m.buffTexHeight:_.height;var v=m.texExtent.width+d.x===i.width>>g?m.texExtent.width:_.width,y=m.texExtent.height+d.y===i.height>>g?m.texExtent.height:_.height,T=void 0,S=e[a++];if(f.width===_.width&&f.height===_.height){var E=z_(i.format,v,y,1)/u.BYTES_PER_ELEMENT;tt(Number.isInteger(E),9101),T=new u(S.buffer,S.byteOffset+m.buffOffset,E)}else T=g7(S,i.format,m.buffOffset,f,_);l?i.glInternalFmt!==k6.COMPRESSED_RGB_ETC1_WEBGL?r.compressedTexSubImage2D(r.TEXTURE_2D,g,d.x,d.y,v,y,i.glFormat,T):r.compressedTexImage2D(r.TEXTURE_2D,g,i.glInternalFmt,v,y,0,T):r.texSubImage2D(r.TEXTURE_2D,g,d.x,d.y,v,y,i.glFormat,i.glType,T)}break;case r.TEXTURE_2D_ARRAY:for(var A=0;A<n.length;A++){var R=n[A],b=R.texSubres.mipLevel;d.x=0===R.texOffset.x?0:K_(R.texOffset.x,c.width),d.y=0===R.texOffset.y?0:K_(R.texOffset.y,c.height),_.width=R.texExtent.width<c.width?R.texExtent.width:K_(R.texExtent.width,c.width),_.height=R.texExtent.height<c.height?R.texExtent.width:K_(R.texExtent.height,c.height),_.depth=1,f.width=R.buffStride>0?R.buffStride:_.width,f.height=R.buffTexHeight>0?R.buffTexHeight:_.height;var C=R.texExtent.width+d.x===i.width>>b?R.texExtent.width:_.width,w=R.texExtent.height+d.y===i.height>>b?R.texExtent.height:_.height,x=R.texSubres.baseArrayLayer+R.texSubres.layerCount;for(o=R.texSubres.baseArrayLayer;o<x;++o){d.z=o;var I=void 0,O=e[a++];if(f.width===_.width&&f.height===_.height){var D=z_(i.format,C,w,1)/u.BYTES_PER_ELEMENT;tt(Number.isInteger(D),9101),I=new u(O.buffer,O.byteOffset+R.buffOffset,D)}else I=g7(O,i.format,R.buffOffset,f,_);l?i.glInternalFmt!==k6.COMPRESSED_RGB_ETC1_WEBGL?r.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,b,d.x,d.y,d.z,C,w,_.depth,i.glFormat,I):r.compressedTexImage3D(r.TEXTURE_2D_ARRAY,b,i.glInternalFmt,C,w,_.depth,0,I):r.texSubImage3D(r.TEXTURE_2D_ARRAY,b,d.x,d.y,d.z,C,w,_.depth,i.glFormat,i.glType,I)}}break;case r.TEXTURE_3D:for(var M=0;M<n.length;M++){var P=n[M],B=P.texSubres.mipLevel;d.x=0===P.texOffset.x?0:K_(P.texOffset.x,c.width),d.y=0===P.texOffset.y?0:K_(P.texOffset.y,c.height),d.z=P.texOffset.z,_.width=P.texExtent.width<c.width?P.texExtent.width:K_(P.texExtent.width,c.width),_.height=P.texExtent.height<c.height?P.texExtent.width:K_(P.texExtent.height,c.height),_.depth=P.texExtent.depth,f.width=P.buffStride>0?P.buffStride:_.width,f.height=P.buffTexHeight>0?P.buffTexHeight:_.height;var N=P.texExtent.width+d.x===i.width>>B?P.texExtent.width:_.width,L=P.texExtent.height+d.y===i.height>>B?P.texExtent.height:_.height,F=void 0,k=e[a++];if(f.width===_.width&&f.height===_.height){var U=z_(i.format,N,L,_.depth)/u.BYTES_PER_ELEMENT;tt(Number.isInteger(U),9101),F=new u(k.buffer,k.byteOffset+P.buffOffset,U)}else F=g7(k,i.format,P.buffOffset,f,_);l?i.glInternalFmt!==k6.COMPRESSED_RGB_ETC1_WEBGL?r.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,B,d.x,d.y,d.z,N,L,_.depth,i.glFormat,F):r.compressedTexImage3D(r.TEXTURE_2D_ARRAY,B,i.glInternalFmt,N,L,_.depth,0,F):r.texSubImage3D(r.TEXTURE_2D_ARRAY,B,d.x,d.y,d.z,N,L,_.depth,i.glFormat,i.glType,F)}break;case r.TEXTURE_CUBE_MAP:for(var H=0;H<n.length;H++){var z=n[H],V=z.texSubres.mipLevel;d.x=0===z.texOffset.x?0:K_(z.texOffset.x,c.width),d.y=0===z.texOffset.y?0:K_(z.texOffset.y,c.height),_.width=z.texExtent.width<c.width?z.texExtent.width:K_(z.texExtent.width,c.width),_.height=z.texExtent.height<c.height?z.texExtent.width:K_(z.texExtent.height,c.height),f.width=z.buffStride>0?z.buffStride:_.width,f.height=z.buffTexHeight>0?z.buffTexHeight:_.height;var W=z.texExtent.width+d.x===i.width>>V?z.texExtent.width:_.width,X=z.texExtent.height+d.y===i.height>>V?z.texExtent.height:_.height,j=z.texSubres.baseArrayLayer+z.texSubres.layerCount;for(o=z.texSubres.baseArrayLayer;o<j;++o){var Y=void 0,K=e[a++];if(f.width===_.width&&f.height===_.height){var q=z_(i.format,W,X,1)/u.BYTES_PER_ELEMENT;tt(Number.isInteger(q),9101),Y=new u(K.buffer,K.byteOffset+z.buffOffset,q)}else Y=g7(K,i.format,z.buffOffset,f,_);l?i.glInternalFmt!==k6.COMPRESSED_RGB_ETC1_WEBGL?r.compressedTexSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+o,V,d.x,d.y,W,X,i.glFormat,Y):r.compressedTexImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+o,V,i.glInternalFmt,W,X,0,Y):r.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+o,V,d.x,d.y,W,X,i.glFormat,i.glType,Y)}}break;default:G("Unsupported GL texture type, copy buffer to texture failed.")}i.flags&ec.GEN_MIPMAP&&r.generateMipmap(i.glTarget)}function y7(t,e,i,n,r){var s=t.gl,a=t.stateCache,o=t.blitManager;if(o){var h=r===sc.LINEAR||r===sc.ANISOTROPIC?s.LINEAR:s.NEAREST,u=o.srcFramebuffer,l=o.dstFramebuffer,c=a.glReadFramebuffer,_=a.glFramebuffer,d=n[0].srcSubres.mipLevel,f=n[0].dstSubres.mipLevel,p=function(t){var e=0,i=s.COLOR_ATTACHMENT0;return t.hasStencil?i=s.DEPTH_STENCIL_ATTACHMENT:t.hasDepth&&(i=s.DEPTH_ATTACHMENT),t.hasDepth||t.hasStencil?(t.hasDepth&&(e|=s.DEPTH_BUFFER_BIT),t.hasStencil&&(e|=s.STENCIL_BUFFER_BIT)):e|=s.COLOR_BUFFER_BIT,{mask:e,attachment:i}},m=n.map((function(t,e){return e}));m.sort((function(t,e){return n[t].srcSubres.mipLevel-n[e].srcSubres.mipLevel}));var g=p(F_[e.format]),v=g.mask,y=g.attachment,T=p(F_[i.format]).attachment;a.glReadFramebuffer!==u&&(s.bindFramebuffer(s.READ_FRAMEBUFFER,u),a.glReadFramebuffer=u),a.glFramebuffer!==l&&(s.bindFramebuffer(s.DRAW_FRAMEBUFFER,l),a.glFramebuffer=l),e.glTexture?s.framebufferTexture2D(s.READ_FRAMEBUFFER,y,e.glTarget,e.glTexture,d):s.framebufferRenderbuffer(s.READ_FRAMEBUFFER,y,s.RENDERBUFFER,e.glRenderbuffer),i.glTexture?s.framebufferTexture2D(s.DRAW_FRAMEBUFFER,T,i.glTarget,i.glTexture,f):s.framebufferRenderbuffer(s.DRAW_FRAMEBUFFER,T,s.RENDERBUFFER,i.glRenderbuffer);for(var S=0;S<m.length;S++){var E=n[m[S]];e.glTexture&&d!==E.srcSubres.mipLevel&&(d=E.srcSubres.mipLevel,s.framebufferTexture2D(s.READ_FRAMEBUFFER,y,e.glTarget,e.glTexture,d)),i.glTexture&&f!==E.dstSubres.mipLevel&&(f=E.dstSubres.mipLevel,s.framebufferTexture2D(s.DRAW_FRAMEBUFFER,T,i.glTarget,i.glTexture,f)),s.blitFramebuffer(E.srcOffset.x,E.srcOffset.y,E.srcOffset.x+E.srcExtent.width,E.srcOffset.y+E.srcExtent.height,E.dstOffset.x,E.dstOffset.y,E.dstOffset.x+E.dstExtent.width,E.dstOffset.y+E.dstExtent.height,v,h)}a.glReadFramebuffer!==c&&(s.bindFramebuffer(s.READ_FRAMEBUFFER,c),a.glReadFramebuffer=c),a.glFramebuffer!==_&&(s.bindFramebuffer(s.DRAW_FRAMEBUFFER,_),a.glFramebuffer=_)}}var T7=function(){function t(){this.counts=void 0,this.offsets=void 0,this.instances=void 0,this.drawCount=0,this.drawByIndex=!1,this.instancedDraw=!1,this.byteOffsets=void 0,this._capacity=4,this.counts=new Int32Array(this._capacity),this.offsets=new Int32Array(this._capacity),this.instances=new Int32Array(this._capacity),this.byteOffsets=new Int32Array(this._capacity)}var e=t.prototype;return e.clearDraws=function(){this.drawCount=0,this.drawByIndex=!1,this.instancedDraw=!1},e.setDrawInfo=function(t,e){this._ensureCapacity(t),this.drawByIndex=e.indexCount>0,this.instancedDraw=!!e.instanceCount,this.drawCount=Math.max(t+1,this.drawCount),this.drawByIndex?(this.counts[t]=e.indexCount,this.offsets[t]=e.firstIndex):(this.counts[t]=e.vertexCount,this.offsets[t]=e.firstVertex),this.instances[t]=Math.max(1,e.instanceCount)},e._ensureCapacity=function(t){if(!(this._capacity>t)){this._capacity=Hi(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}(),S7=function(){function t(){this._srcFramebuffer=void 0,this._dstFramebuffer=void 0;var t=G6.instance.gl;this._srcFramebuffer=t.createFramebuffer(),this._dstFramebuffer=t.createFramebuffer()}return t.prototype.destroy=function(){var t=G6.instance.gl;t.deleteFramebuffer(this._srcFramebuffer),t.deleteFramebuffer(this._dstFramebuffer)},n(t,[{key:"srcFramebuffer",get:function(){return this._srcFramebuffer}},{key:"dstFramebuffer",get:function(){return this._dstFramebuffer}}]),t}(),E7=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._gpuBuffer=null,e}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._gpuBuffer={usage:this._usage,memUsage:this._memUsage,size:this._size,stride:this._stride,buffer:null,indirects:e.gpuBuffer.indirects,glTarget:e.gpuBuffer.glTarget,glBuffer:e.gpuBuffer.glBuffer,glOffset:t.offset}}else this._usage=t.usage,this._memUsage=t.memUsage,this._size=t.size,this._stride=Math.max(t.stride||this._size,1),this._count=this._size/this._stride,this._flags=t.flags,this._gpuBuffer={usage:this._usage,memUsage:this._memUsage,size:this._size,stride:this._stride,buffer:null,indirects:new T7,glTarget:0,glBuffer:null,glOffset:0},function(t,e){var i=t.gl,n=t.stateCache,r=e.memUsage&Jl.HOST?i.DYNAMIC_DRAW:i.STATIC_DRAW;if(e.usage&ql.VERTEX){e.glTarget=i.ARRAY_BUFFER;var s=i.createBuffer();s&&(e.glBuffer=s,e.size>0&&(t.extensions.useVAO&&n.glVAO&&(i.bindVertexArray(null),n.glVAO=null),l7.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&ql.INDEX){e.glTarget=i.ELEMENT_ARRAY_BUFFER;var a=i.createBuffer();a&&(e.glBuffer=a,e.size>0&&(t.extensions.useVAO&&n.glVAO&&(i.bindVertexArray(null),n.glVAO=null),l7.gpuInputAssembler=null,t.stateCache.glElementArrayBuffer!==e.glBuffer&&(i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.glBuffer),t.stateCache.glElementArrayBuffer=e.glBuffer),i.bufferData(i.ELEMENT_ARRAY_BUFFER,e.size,r),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,null),t.stateCache.glElementArrayBuffer=null))}else if(e.usage&ql.UNIFORM){e.glTarget=i.UNIFORM_BUFFER;var o=i.createBuffer();o&&e.size>0&&(e.glBuffer=o,t.stateCache.glUniformBuffer!==e.glBuffer&&(i.bindBuffer(i.UNIFORM_BUFFER,e.glBuffer),t.stateCache.glUniformBuffer=e.glBuffer),i.bufferData(i.UNIFORM_BUFFER,e.size,r),i.bindBuffer(i.UNIFORM_BUFFER,null),t.stateCache.glUniformBuffer=null)}else e.usage&ql.INDIRECT||e.usage&ql.TRANSFER_DST||e.usage&ql.TRANSFER_SRC||G("Unsupported BufferType, create buffer failed."),e.glTarget=i.NONE}(G6.instance,this._gpuBuffer),G6.instance.memoryStatus.bufferSize+=this._size},i.destroy=function(){this._gpuBuffer&&(this._isBufferView||(function(t,e){var i=t.gl,n=t.stateCache;if(e.glBuffer){switch(e.glTarget){case i.ARRAY_BUFFER:t.extensions.useVAO&&n.glVAO&&(i.bindVertexArray(null),t.stateCache.glVAO=null),l7.gpuInputAssembler=null,i.bindBuffer(i.ARRAY_BUFFER,null),t.stateCache.glArrayBuffer=null;break;case i.ELEMENT_ARRAY_BUFFER:t.extensions.useVAO&&n.glVAO&&(i.bindVertexArray(null),t.stateCache.glVAO=null),l7.gpuInputAssembler=null,i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,null),t.stateCache.glElementArrayBuffer=null;break;case i.UNIFORM_BUFFER:i.bindBuffer(i.UNIFORM_BUFFER,null),t.stateCache.glUniformBuffer=null}i.deleteBuffer(e.glBuffer),e.glBuffer=null}}(G6.instance,this._gpuBuffer),G6.instance.memoryStatus.bufferSize-=this._size),this._gpuBuffer=null)},i.resize=function(t){if(this._isBufferView)console.warn("cannot resize buffer views!");else{var e=this._size;e!==t&&(this._size=t,this._count=this._size/this._stride,this._gpuBuffer&&(this._gpuBuffer.size=t,t>0&&(function(t,e){var i=t.gl,n=t.stateCache,r=e.memUsage&Jl.HOST?i.DYNAMIC_DRAW:i.STATIC_DRAW;e.usage&ql.VERTEX?(t.extensions.useVAO&&n.glVAO&&(i.bindVertexArray(null),n.glVAO=null),l7.gpuInputAssembler=null,n.glArrayBuffer!==e.glBuffer&&i.bindBuffer(i.ARRAY_BUFFER,e.glBuffer),e.buffer?i.bufferData(i.ARRAY_BUFFER,e.buffer,r):i.bufferData(i.ARRAY_BUFFER,e.size,r),i.bindBuffer(i.ARRAY_BUFFER,null),n.glArrayBuffer=null):e.usage&ql.INDEX?(t.extensions.useVAO&&n.glVAO&&(i.bindVertexArray(null),n.glVAO=null),l7.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&ql.UNIFORM?(t.stateCache.glUniformBuffer!==e.glBuffer&&i.bindBuffer(i.UNIFORM_BUFFER,e.glBuffer),i.bufferData(i.UNIFORM_BUFFER,e.size,r),i.bindBuffer(i.UNIFORM_BUFFER,null),t.stateCache.glUniformBuffer=null):(e.usage&ql.INDIRECT||e.usage&ql.TRANSFER_DST||e.usage&ql.TRANSFER_SRC||G("Unsupported BufferType, create buffer failed."),e.glTarget=i.NONE)}(G6.instance,this._gpuBuffer),G6.instance.memoryStatus.bufferSize-=e,G6.instance.memoryStatus.bufferSize+=t)))}},i.update=function(t,e){var i;this._isBufferView?console.warn("cannot update through buffer views!"):(i=void 0!==e?e:this._usage&ql.INDIRECT?0:t.byteLength,o7(G6.instance,this._gpuBuffer,t,0,i))},n(e,[{key:"gpuBuffer",get:function(){return this._gpuBuffer}}]),e}(Q_),A7=function(){function t(t,e){this._frees=void 0,this._freeIdx=0,this._freeCmds=void 0,this._frees=new Array(e),this._freeCmds=new Nu(e);for(var i=0;i<e;++i)this._frees[i]=new t;this._freeIdx=e-1}var e=t.prototype;return e.alloc=function(t){if(this._freeIdx<0){var e=2*this._frees.length,i=this._frees;this._frees=new Array(e);for(var n=e-i.length,r=0;r<n;++r)this._frees[r]=new t;for(var s=n,a=0;s<e;++s,++a)this._frees[s]=i[a];this._freeIdx+=n}var o=this._frees[this._freeIdx];return this._frees[this._freeIdx--]=null,++o.refCount,o},e.free=function(t){0==--t.refCount&&this._freeCmds.push(t)},e.freeCmds=function(t){for(var e=0;e<t.length;++e)0==--t.array[e].refCount&&this._freeCmds.push(t.array[e])},e.release=function(){for(var t=0;t<this._freeCmds.length;++t){var e=this._freeCmds.array[t];e.clear(),this._frees[++this._freeIdx]=e}this._freeCmds.clear()},t}(),R7=function(){function t(){this.beginRenderPassCmdPool=void 0,this.bindStatesCmdPool=void 0,this.drawCmdPool=void 0,this.updateBufferCmdPool=void 0,this.copyBufferToTextureCmdPool=void 0,this.blitTextureCmdPool=void 0,this.beginRenderPassCmdPool=new A7(t7,1),this.bindStatesCmdPool=new A7(e7,1),this.drawCmdPool=new A7(i7,1),this.updateBufferCmdPool=new A7(n7,1),this.copyBufferToTextureCmdPool=new A7(r7,1),this.blitTextureCmdPool=new A7(s7,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}(),b7=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).cmdPackage=new a7,e._cmdAllocator=new R7,e._isInRenderPass=!1,e._curGPUPipelineState=null,e._curGPUDescriptorSets=[],e._curGPUInputAssembler=null,e._curDynamicOffsets=Array(8).fill(0),e._curDynamicStates=new N_,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=G6.instance.bindingMappings.blockOffsets.length,i=0;i<e;i++)this._curGPUDescriptorSets.push(null)},i.destroy=function(){this._cmdAllocator.clearCmds(this.cmdPackage)},i.begin=function(){this._cmdAllocator.clearCmds(this.cmdPackage),this._curGPUPipelineState=null,this._curGPUInputAssembler=null,this._curGPUDescriptorSets.length=0,this._numDrawCalls=0,this._numInstances=0,this._numTris=0},i.end=function(){this._isStateInvalied&&this.bindStates(),this._isInRenderPass=!1},i.beginRenderPass=function(t,e,i,n,r,s){var a=this._cmdAllocator.beginRenderPassCmdPool.alloc(t7);a.gpuRenderPass=t.gpuRenderPass,a.gpuFramebuffer=e.gpuFramebuffer,a.renderArea.copy(i);for(var o=0;o<n.length;++o)a.clearColors[o]=n[o];a.clearDepth=r,a.clearStencil=s,this.cmdPackage.beginRenderPassCmds.push(a),this.cmdPackage.cmds.push(K6.BEGIN_RENDER_PASS),this._isInRenderPass=!0},i.endRenderPass=function(){this._isInRenderPass=!1},i.bindPipelineState=function(t){var e=t.gpuPipelineState;e!==this._curGPUPipelineState&&(this._curGPUPipelineState=e,this._isStateInvalied=!0)},i.bindDescriptorSet=function(t,e,i){var n=e.gpuDescriptorSet;if(n!==this._curGPUDescriptorSets[t]&&(this._curGPUDescriptorSets[t]=n,this._isStateInvalied=!0),i){var r,s=null===(r=this._curGPUPipelineState)||void 0===r?void 0:r.gpuPipelineLayout;if(s){for(var a=this._curDynamicOffsets,o=s.dynamicOffsetOffsets[t],h=0;h<i.length;h++)a[o+h]=i[h];this._isStateInvalied=!0}}},i.bindInputAssembler=function(t){var e=t.gpuInputAssembler;this._curGPUInputAssembler=e,this._isStateInvalied=!0},i.setViewport=function(t){var e=this._curDynamicStates.viewport;e.left===t.left&&e.top===t.top&&e.width===t.width&&e.height===t.height&&e.minDepth===t.minDepth&&e.maxDepth===t.maxDepth||(e.left=t.left,e.top=t.top,e.width=t.width,e.height=t.height,e.minDepth=t.minDepth,e.maxDepth=t.maxDepth,this._isStateInvalied=!0)},i.setScissor=function(t){var e=this._curDynamicStates.scissor;e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height||(e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height,this._isStateInvalied=!0)},i.setLineWidth=function(t){this._curDynamicStates.lineWidth!==t&&(this._curDynamicStates.lineWidth=t,this._isStateInvalied=!0)},i.setDepthBias=function(t,e,i){var n=this._curDynamicStates;n.depthBiasConstant===t&&n.depthBiasClamp===e&&n.depthBiasSlope===i||(n.depthBiasConstant=t,n.depthBiasClamp=e,n.depthBiasSlope=i,this._isStateInvalied=!0)},i.setBlendConstants=function(t){var e=this._curDynamicStates.blendConstant;e.x===t.x&&e.y===t.y&&e.z===t.z&&e.w===t.w||(e.copy(t),this._isStateInvalied=!0)},i.setDepthBound=function(t,e){var i=this._curDynamicStates;i.depthMinBounds===t&&i.depthMaxBounds===e||(i.depthMinBounds=t,i.depthMaxBounds=e,this._isStateInvalied=!0)},i.setStencilWriteMask=function(t,e){var i=this._curDynamicStates.stencilStatesFront,n=this._curDynamicStates.stencilStatesBack;t&Ac.FRONT&&i.writeMask!==e&&(i.writeMask=e,this._isStateInvalied=!0),t&Ac.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&Ac.FRONT&&(n.compareMask===i&&n.reference===e||(n.reference=e,n.compareMask=i,this._isStateInvalied=!0)),t&Ac.BACK&&(r.compareMask===i&&r.reference===e||(r.reference=e,r.compareMask=i,this._isStateInvalied=!0))},i.draw=function(t){if(this._type===wc.PRIMARY&&this._isInRenderPass||this._type===wc.SECONDARY){this._isStateInvalied&&this.bindStates();var e="drawInfo"in t?t.drawInfo:t,i=this._cmdAllocator.drawCmdPool.alloc(i7);i.drawInfo.copy(e),this.cmdPackage.drawCmds.push(i),this.cmdPackage.cmds.push(K6.DRAW),++this._numDrawCalls,this._numInstances+=e.instanceCount;var n=e.indexCount||e.vertexCount;if(this._curGPUPipelineState)switch(this._curGPUPipelineState.glPrimitive){case 4:this._numTris+=n/3*Math.max(e.instanceCount,1);break;case 5:case 6:this._numTris+=(n-2)*Math.max(e.instanceCount,1)}}else console.error("Command 'draw' must be recorded inside a render pass.")},i.updateBuffer=function(t,e,i){if(this._type===wc.PRIMARY&&!this._isInRenderPass||this._type===wc.SECONDARY){var n=t.gpuBuffer;if(n){var r,s=this._cmdAllocator.updateBufferCmdPool.alloc(n7),a=0;t.usage&ql.INDIRECT||(a=void 0!==i?i:e.byteLength),r=e,s.gpuBuffer=n,s.buffer=r,s.offset=0,s.size=a,this.cmdPackage.updateBufferCmds.push(s),this.cmdPackage.cmds.push(K6.UPDATE_BUFFER)}}else console.error("Command 'updateBuffer' must be recorded outside a render pass.")},i.copyBuffersToTexture=function(t,e,i){if(this._type===wc.PRIMARY&&!this._isInRenderPass||this._type===wc.SECONDARY){var n=e.gpuTexture;if(n){var r=this._cmdAllocator.copyBufferToTextureCmdPool.alloc(r7);r.gpuTexture=n,r.regions=i,r.buffers=t,this.cmdPackage.copyBufferToTextureCmds.push(r),this.cmdPackage.cmds.push(K6.COPY_BUFFER_TO_TEXTURE)}}else console.error("Command 'copyBufferToTexture' must be recorded outside a render pass.")},i.execute=function(t,e){for(var i=0;i<e;++i){for(var n=t[i],r=0;r<n.cmdPackage.beginRenderPassCmds.length;++r){var s=n.cmdPackage.beginRenderPassCmds.array[r];++s.refCount,this.cmdPackage.beginRenderPassCmds.push(s)}for(var a=0;a<n.cmdPackage.bindStatesCmds.length;++a){var o=n.cmdPackage.bindStatesCmds.array[a];++o.refCount,this.cmdPackage.bindStatesCmds.push(o)}for(var h=0;h<n.cmdPackage.drawCmds.length;++h){var u=n.cmdPackage.drawCmds.array[h];++u.refCount,this.cmdPackage.drawCmds.push(u)}for(var l=0;l<n.cmdPackage.updateBufferCmds.length;++l){var c=n.cmdPackage.updateBufferCmds.array[l];++c.refCount,this.cmdPackage.updateBufferCmds.push(c)}for(var _=0;_<n.cmdPackage.copyBufferToTextureCmds.length;++_){var 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(e7);t.gpuPipelineState=this._curGPUPipelineState,Array.prototype.push.apply(t.gpuDescriptorSets,this._curGPUDescriptorSets),Array.prototype.push.apply(t.dynamicOffsets,this._curDynamicOffsets),t.gpuInputAssembler=this._curGPUInputAssembler,t.dynamicStates=this._curDynamicStates,this.cmdPackage.bindStatesCmds.push(t),this.cmdPackage.cmds.push(K6.BIND_STATES),this._isStateInvalied=!1},i.blitTexture=function(t,e,i,n){var r=this._cmdAllocator.blitTextureCmdPool.alloc(s7);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(K6.BLIT_TEXTURE)},e}(Z_),C7=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._gpuFramebuffer=null,e}s(e,t);var i=e.prototype;return i.initialize=function(t){this._renderPass=t.renderPass,this._colorTextures=t.colorTextures||[],this._depthStencilTexture=t.depthStencilTexture||null;for(var e=[],i=0;i<t.colorTextures.length;i++){var n=t.colorTextures[i];n&&e.push(n.gpuTextureView)}var r=null;t.depthStencilTexture&&(r=t.depthStencilTexture.gpuTextureView);var s=Number.MAX_SAFE_INTEGER,a=Number.MAX_SAFE_INTEGER;this._gpuFramebuffer={gpuRenderPass:t.renderPass.gpuRenderPass,gpuColorViews:e,gpuDepthStencilView:r,glFramebuffer:null,isOffscreen:!0,get width(){return this.gpuColorViews.length>0?this.gpuColorViews[0].gpuTexture.width:this.gpuDepthStencilView?this.gpuDepthStencilView.gpuTexture.width:s},set width(t){s=t},get height(){return this.gpuColorViews.length>0?this.gpuColorViews[0].gpuTexture.height:this.gpuDepthStencilView?this.gpuDepthStencilView.gpuTexture.height:a},set height(t){a=t}},function(t,e){for(var i=0;i<e.gpuColorViews.length;++i)if(e.gpuColorViews[i].gpuTexture.isSwapchainTexture)return void(e.isOffscreen=!1);var n=t.gl,r=[],s=n.createFramebuffer();if(s){e.glFramebuffer=s,t.stateCache.glFramebuffer!==e.glFramebuffer&&n.bindFramebuffer(n.FRAMEBUFFER,e.glFramebuffer);for(var a=0;a<e.gpuColorViews.length;++a){var o=e.gpuColorViews[a],h=o.gpuTexture;h&&(h.glTexture?n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+a,h.glTarget,h.glTexture,o.baseLevel):n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+a,n.RENDERBUFFER,h.glRenderbuffer),r.push(n.COLOR_ATTACHMENT0+a),e.width=Math.min(e.width,h.width>>o.baseLevel),e.height=Math.min(e.height,h.height>>o.baseLevel))}var u=e.gpuDepthStencilView;if(u){var l=u.gpuTexture,c=F_[l.format].hasStencil?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;l.glTexture?n.framebufferTexture2D(n.FRAMEBUFFER,c,l.glTarget,l.glTexture,e.gpuDepthStencilView.baseLevel):n.framebufferRenderbuffer(n.FRAMEBUFFER,c,n.RENDERBUFFER,l.glRenderbuffer),e.width=Math.min(e.width,l.width>>u.baseLevel),e.height=Math.min(e.height,l.height>>u.baseLevel)}n.drawBuffers(r);var _=n.checkFramebufferStatus(n.FRAMEBUFFER);if(_!==n.FRAMEBUFFER_COMPLETE)switch(_){case n.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:G("glCheckFramebufferStatus() - FRAMEBUFFER_INCOMPLETE_ATTACHMENT");break;case n.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:G("glCheckFramebufferStatus() - FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT");break;case n.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:G("glCheckFramebufferStatus() - FRAMEBUFFER_INCOMPLETE_DIMENSIONS");break;case n.FRAMEBUFFER_UNSUPPORTED:G("glCheckFramebufferStatus() - FRAMEBUFFER_UNSUPPORTED")}t.stateCache.glFramebuffer!==e.glFramebuffer&&n.bindFramebuffer(n.FRAMEBUFFER,t.stateCache.glFramebuffer)}}(G6.instance,this._gpuFramebuffer),this._width=this._gpuFramebuffer.width,this._height=this._gpuFramebuffer.height},i.destroy=function(){var t,e;this._gpuFramebuffer&&(t=G6.instance,(e=this._gpuFramebuffer).glFramebuffer&&(t.gl.deleteFramebuffer(e.glFramebuffer),t.stateCache.glFramebuffer===e.glFramebuffer&&(t.gl.bindFramebuffer(t.gl.FRAMEBUFFER,null),t.stateCache.glFramebuffer=null),e.glFramebuffer=null),this._gpuFramebuffer=null)},n(e,[{key:"gpuFramebuffer",get:function(){return this._gpuFramebuffer}}]),e}(ed),w7=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._gpuInputAssembler=null,e}s(e,t);var i=e.prototype;return i.initialize=function(t){if(0!==t.vertexBuffers.length){if(this._attributes=t.attributes,this._attributesHash=this.computeAttributesHash(),this._vertexBuffers=t.vertexBuffers,t.indexBuffer)this._indexBuffer=t.indexBuffer,this._drawInfo.indexCount=this._indexBuffer.size/this._indexBuffer.stride,this._drawInfo.firstIndex=0;else{var e=this._vertexBuffers[0];this._drawInfo.vertexCount=e.size/e.stride,this._drawInfo.firstVertex=0,this._drawInfo.vertexOffset=0}this._drawInfo.instanceCount=0,this._drawInfo.firstInstance=0,this._indirectBuffer=t.indirectBuffer||null;for(var i=new Array(t.vertexBuffers.length),n=0;n<t.vertexBuffers.length;++n){var r=t.vertexBuffers[n];r.gpuBuffer&&(i[n]=r.gpuBuffer)}var s=null,a=0;if(t.indexBuffer&&(s=t.indexBuffer.gpuBuffer))switch(s.stride){case 1:a=5121;break;case 2:a=5123;break;case 4:a=5125;break;default:console.error("Illegal index buffer stride.")}var o=null;t.indirectBuffer&&(o=t.indirectBuffer.gpuBuffer),this._gpuInputAssembler={attributes:t.attributes,gpuVertexBuffers:i,gpuIndexBuffer:s,gpuIndirectBuffer:o,glAttribs:[],glIndexType:a,glVAOs:new Map},function(t,e){var i=t.gl;e.glAttribs=new Array(e.attributes.length);for(var n=[0,0,0,0,0,0,0,0],r=0;r<e.attributes.length;++r){var s=e.attributes[r],a=void 0!==s.stream?s.stream:0,o=e.gpuVertexBuffers[a],h=V6(s.format,i),u=F_[s.format].size;e.glAttribs[r]={name:s.name,glBuffer:o.glBuffer,glType:h,size:u,count:F_[s.format].count,stride:o.stride,componentCount:Y6(h,i),isNormalized:void 0!==s.isNormalized&&s.isNormalized,isInstanced:void 0!==s.isInstanced&&s.isInstanced,offset:n[a]},n[a]+=u}}(G6.instance,this._gpuInputAssembler)}else console.error("InputAssemblerInfo.vertexBuffers is null.")},i.destroy=function(){var t=G6.instance;this._gpuInputAssembler&&t.extensions.useVAO&&function(t,e){for(var i=e.glVAOs.values(),n=i.next(),r=t.gl,s=t.stateCache.glVAO;!n.done;)r.deleteVertexArray(n.value),s===n.value&&(r.bindVertexArray(null),s=null),n=i.next();t.stateCache.glVAO=s,e.glVAOs.clear()}(t,this._gpuInputAssembler),this._gpuInputAssembler=null},n(e,[{key:"gpuInputAssembler",get:function(){return this._gpuInputAssembler}}]),e}(id),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)._gpuDescriptorSetLayout=null,e}s(e,t);var i=e.prototype;return i.initialize=function(t){Array.prototype.push.apply(this._bindings,t.bindings);for(var e=0,i=-1,n=[],r=0;r<this._bindings.length;r++){var s=this._bindings[r];n.push(e),e+=s.count,s.binding>i&&(i=s.binding)}this._bindingIndices=Array(i+1).fill(-1);for(var a=this._descriptorIndices=Array(i+1).fill(-1),o=0;o<this._bindings.length;o++){var h=this._bindings[o];this._bindingIndices[h.binding]=o,a[h.binding]=n[o]}for(var u=[],l=0;l<this._bindings.length;l++){var c=this._bindings[l];if(c.descriptorType&G_)for(var _=0;_<c.count;_++)u.push(c.binding)}this._gpuDescriptorSetLayout={bindings:this._bindings,dynamicBindings:u,descriptorIndices:a,descriptorCount:e}},i.destroy=function(){this._bindings.length=0},n(e,[{key:"gpuDescriptorSetLayout",get:function(){return this._gpuDescriptorSetLayout}}]),e}(rd),I7=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._gpuPipelineLayout=null,e}s(e,t);var i=e.prototype;return i.initialize=function(t){Array.prototype.push.apply(this._setLayouts,t.setLayouts);for(var e=[],i=[],n=0,r=[],s=0;s<this._setLayouts.length;s++){for(var a=this._setLayouts[s],o=a.gpuDescriptorSetLayout.dynamicBindings,h=Array(a.bindingIndices.length).fill(-1),u=0;u<o.length;u++){var l=o[u];h[l]<0&&(h[l]=n+u)}i.push(a.gpuDescriptorSetLayout),e.push(h),r.push(n),n+=o.length}this._gpuPipelineLayout={gpuSetLayouts:i,dynamicOffsetIndices:e,dynamicOffsetCount:n,dynamicOffsetOffsets:r}},i.destroy=function(){this._setLayouts.length=0},n(e,[{key:"gpuPipelineLayout",get:function(){return this._gpuPipelineLayout}}]),e}(sd),O7=[0,1,3,2,0,0,0,4,5,6,0,0,0,0],D7=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._gpuPipelineState=null,e}s(e,t);var i=e.prototype;return i.initialize=function(t){this._primitive=t.primitive,this._shader=t.shader,this._pipelineLayout=t.pipelineLayout;var e=this._bs;if(t.blendState){var i=t.blendState,n=i.targets;n&&n.forEach((function(t,i){e.setTarget(i,t)})),void 0!==i.isA2C&&(e.isA2C=i.isA2C),void 0!==i.isIndepend&&(e.isIndepend=i.isIndepend),void 0!==i.blendColor&&(e.blendColor=i.blendColor)}Object.assign(this._rs,t.rasterizerState),Object.assign(this._dss,t.depthStencilState),this._is=t.inputState,this._renderPass=t.renderPass,this._dynamicStates=t.dynamicStates;for(var r=[],s=0;s<31;s++)this._dynamicStates&1<<s&&r.push(1<<s);this._gpuPipelineState={glPrimitive:O7[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}(cd),M7=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){c7(G6.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;d7(G6.instance,e),++this._numDrawCalls,this._numInstances+=e.instanceCount;var i=e.indexCount||e.vertexCount;if(this._curGPUPipelineState)switch(this._curGPUPipelineState.glPrimitive){case 4:this._numTris+=i/3*Math.max(e.instanceCount,1);break;case 5:case 6:this._numTris+=(i-2)*Math.max(e.instanceCount,1)}}else console.error("Command 'draw' must be recorded inside a render pass.")},i.setViewport=function(t){var e=G6.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=G6.instance,i=e.stateCache,n=e.gl;i.scissorRect.x===t.x&&i.scissorRect.y===t.y&&i.scissorRect.width===t.width&&i.scissorRect.height===t.height||(n.scissor(t.x,t.y,t.width,t.height),i.scissorRect.x=t.x,i.scissorRect.y=t.y,i.scissorRect.width=t.width,i.scissorRect.height=t.height)},i.updateBuffer=function(t,e,i){if(this._isInRenderPass)console.error("Command 'updateBuffer' must be recorded outside a render pass.");else{var n,r=t.gpuBuffer;r&&(n=void 0!==i?i:t.usage&ql.INDIRECT?0:e.byteLength,o7(G6.instance,r,e,0,n))}},i.copyBuffersToTexture=function(t,e,i){if(this._isInRenderPass)console.error("Command 'copyBufferToTexture' must be recorded outside a render pass.");else{var n=e.gpuTexture;n&&v7(G6.instance,t,n,i)}},i.execute=function(t,e){for(var i=0;i<e;++i){var n=t[i];p7(G6.instance,n.cmdPackage),this._numDrawCalls+=n._numDrawCalls,this._numInstances+=n._numInstances,this._numTris+=n._numTris}},i.bindStates=function(){_7(G6.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;y7(G6.instance,r,s,i,n)},e}(b7),P7=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).numDrawCalls=0,e.numInstances=0,e.numTris=0,e}s(e,t);var i=e.prototype;return i.initialize=function(t){this._type=t.type},i.destroy=function(){},i.submit=function(t){for(var e=0;e<t.length;e++){var i=t[e];this.numDrawCalls+=i.numDrawCalls,this.numInstances+=i.numInstances,this.numTris+=i.numTris}},i.clear=function(){this.numDrawCalls=0,this.numInstances=0,this.numTris=0},e}(_d),B7=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._gpuRenderPass=null,e}s(e,t);var i=e.prototype;return i.initialize=function(t){this._colorInfos=t.colorAttachments,this._depthStencilInfo=t.depthStencilAttachment,this._subpasses=t.subpasses,this._gpuRenderPass={colorAttachments:this._colorInfos,depthStencilAttachment:this._depthStencilInfo},this._hash=this.computeHash()},i.destroy=function(){this._gpuRenderPass=null},n(e,[{key:"gpuRenderPass",get:function(){return this._gpuRenderPass}}]),e}(dd),N7=function(t){function e(e,i){var n,r,s,a;return(n=t.call(this,e,i)||this)._gpuSampler=null,n._gpuSampler={glSamplers:new Map,minFilter:n._info.minFilter,magFilter:n._info.magFilter,mipFilter:n._info.mipFilter,addressU:n._info.addressU,addressV:n._info.addressV,addressW:n._info.addressW,glMinFilter:0,glMagFilter:0,glWrapS:0,glWrapT:0,glWrapR:0,getGLSampler:function(t,e,i){var n=t.gl,r=e<<16|i;if(!this.glSamplers.has(r)){var s=n.createSampler();s&&(this.glSamplers.set(r,s),n.samplerParameteri(s,n.TEXTURE_MIN_FILTER,this.glMinFilter),n.samplerParameteri(s,n.TEXTURE_MAG_FILTER,this.glMagFilter),n.samplerParameteri(s,n.TEXTURE_WRAP_S,this.glWrapS),n.samplerParameteri(s,n.TEXTURE_WRAP_T,this.glWrapT),n.samplerParameteri(s,n.TEXTURE_WRAP_R,this.glWrapR),n.samplerParameterf(s,n.TEXTURE_MIN_LOD,e),n.samplerParameterf(s,n.TEXTURE_MAX_LOD,i))}return this.glSamplers.get(r)}},r=G6.instance,s=n._gpuSampler,a=r.gl,s.minFilter===sc.LINEAR||s.minFilter===sc.ANISOTROPIC?s.mipFilter===sc.LINEAR||s.mipFilter===sc.ANISOTROPIC?s.glMinFilter=a.LINEAR_MIPMAP_LINEAR:s.mipFilter===sc.POINT?s.glMinFilter=a.LINEAR_MIPMAP_NEAREST:s.glMinFilter=a.LINEAR:s.mipFilter===sc.LINEAR||s.mipFilter===sc.ANISOTROPIC?s.glMinFilter=a.NEAREST_MIPMAP_LINEAR:s.mipFilter===sc.POINT?s.glMinFilter=a.NEAREST_MIPMAP_NEAREST:s.glMinFilter=a.NEAREST,s.magFilter===sc.LINEAR||s.magFilter===sc.ANISOTROPIC?s.glMagFilter=a.LINEAR:s.glMagFilter=a.NEAREST,s.glWrapS=H6[s.addressU],s.glWrapT=H6[s.addressV],s.glWrapR=H6[s.addressW],n}return s(e,t),e.prototype.destroy=function(){this._gpuSampler&&(function(t,e){for(var i=t.gl,n=e.glSamplers.values().next();!n.done;){i.deleteSampler(n.value);for(var r=t.stateCache.glSamplerUnits,s=0;s<r.length;++s)r[s]===n.value&&(i.bindSampler(s,null),r[s]=null)}e.glSamplers.clear()}(G6.instance,this._gpuSampler),this._gpuSampler=null)},n(e,[{key:"gpuSampler",get:function(){return this._gpuSampler}}]),e}(fd),L7=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._gpuShader=null,e}s(e,t);var i=e.prototype;return i.initialize=function(t){this._name=t.name,this._stages=t.stages,this._attributes=t.attributes,this._blocks=t.blocks,this._samplers=t.samplers,this._gpuShader={name:t.name,blocks:t.blocks.slice(),samplerTextures:t.samplerTextures.slice(),subpassInputs:t.subpassInputs.slice(),gpuStages:new Array(t.stages.length),glProgram:null,glInputs:[],glUniforms:[],glBlocks:[],glSamplerTextures:[]};for(var e=0;e<t.stages.length;++e){var i=t.stages[e];this._gpuShader.gpuStages[e]={type:i.stage,source:i.source,glShader:null}}},i.destroy=function(){var t,e;this._gpuShader&&(t=G6.instance,(e=this._gpuShader).glProgram&&(t.gl.deleteProgram(e.glProgram),t.stateCache.glProgram===e.glProgram&&(t.gl.useProgram(null),t.stateCache.glProgram=null),e.glProgram=null),this._gpuShader=null)},n(e,[{key:"gpuShader",get:function(){return null===this._gpuShader.glProgram&&function(t,e){for(var i,n=t.gl,r=function(){var t=e.gpuStages[s],i=0,r="",a=1;switch(t.type){case _c.VERTEX:r="VertexShader",i=n.VERTEX_SHADER;break;case _c.FRAGMENT:r="FragmentShader",i=n.FRAGMENT_SHADER;break;default:return G("Unsupported ShaderType."),{v:void 0}}var o=n.createShader(i);if(o&&(t.glShader=o,n.shaderSource(t.glShader,"#version 300 es\n"+t.source),n.compileShader(t.glShader),!n.getShaderParameter(t.glShader,n.COMPILE_STATUS))){G(r+" in '"+e.name+"' compilation failed."),G("Shader source dump:",t.source.replace(/^|\n/g,(function(){return"\n"+a+++" "}))),G(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 a=n.createProgram();if(a){e.glProgram=a;for(var o=!(!v.rendering||!v.rendering.enableEffectImport),h=0;h<e.gpuStages.length;h++){var u=e.gpuStages[h];n.attachShader(e.glProgram,u.glShader)}n.linkProgram(e.glProgram);for(var l=0;l<e.gpuStages.length;l++){var c=e.gpuStages[l];c.glShader&&(n.detachShader(e.glProgram,c.glShader),n.deleteShader(c.glShader),c.glShader=null)}if(!n.getProgramParameter(e.glProgram,n.LINK_STATUS))return G("Failed to link shader '"+e.name+"'."),void G(n.getProgramInfoLog(e.glProgram));z("Shader '"+e.name+"' compilation succeeded.");var _=n.getProgramParameter(e.glProgram,n.ACTIVE_ATTRIBUTES);e.glInputs=new Array(_);for(var d=0;d<_;++d){var f=n.getActiveAttrib(e.glProgram,d);if(f){var p,m=f.name.indexOf("[");p=-1!==m?f.name.substr(0,m):f.name;var g=n.getAttribLocation(e.glProgram,p),y=X6(f.type,n),T=j6(f.type,n);e.glInputs[d]={name:p,type:y,stride:T,count:f.size,size:T*f.size,glType:f.type,glLoc:g}}}var S,E,A,R,b=n.getProgramParameter(e.glProgram,n.ACTIVE_UNIFORM_BLOCKS);if(b){e.glBlocks=new Array(b);for(var C=0;C<b;++C){var w=(S=n.getActiveUniformBlockName(e.glProgram,C)).indexOf("[");-1!==w&&(S=S.substr(0,w)),R=null;for(var x=0;x<e.blocks.length;x++)if(e.blocks[x].name===S){R=e.blocks[x];break}if(R){E=C,A=n.getActiveUniformBlockParameter(e.glProgram,E,n.UNIFORM_BLOCK_DATA_SIZE);var I=o?R.flattened:R.binding+(t.bindingMappings.blockOffsets[R.set]||0);n.uniformBlockBinding(e.glProgram,E,I),e.glBlocks[C]={set:R.set,binding:R.binding,idx:E,name:S,size:A,glBinding:I}}else G("Block '"+S+"' does not bound")}}for(var O=0;O<e.subpassInputs.length;++O){var D=e.subpassInputs[O];e.samplerTextures.push(new s_(D.set,D.binding,D.name,Kl.SAMPLER2D,D.count))}if(e.samplerTextures.length>0){e.glSamplerTextures=new Array(e.samplerTextures.length);for(var M=0;M<e.samplerTextures.length;++M){var P=e.samplerTextures[M];e.glSamplerTextures[M]={set:P.set,binding:P.binding,name:P.name,type:P.type,count:P.count,units:[],glUnits:null,glType:W6(P.type,n),glLoc:null}}}var B=[],N=[],L=t.stateCache.texUnitCacheMap;if(o)for(var F=0;F<e.samplerTextures.length;++F){var k=e.samplerTextures[F],U=n.getUniformLocation(e.glProgram,k.name);U&&-1!==U.id&&(B.push(e.glSamplerTextures[F]),N.push(U)),void 0===L[k.name]&&(L[k.name]=k.flattened%t.capabilities.maxTextureUnits)}else{for(var H=0,V=0;V<e.blocks.length;++V)e.blocks[V].set===t.bindingMappings.flexibleSet&&H++;for(var W=0,X=0;X<e.samplerTextures.length;++X){var j=e.samplerTextures[X],Y=n.getUniformLocation(e.glProgram,j.name);if(Y&&-1!==Y.id&&(B.push(e.glSamplerTextures[X]),N.push(Y)),void 0===L[j.name]){var K=j.binding+t.bindingMappings.samplerTextureOffsets[j.set]+W;j.set===t.bindingMappings.flexibleSet&&(K-=H),L[j.name]=K%t.capabilities.maxTextureUnits,W+=j.count-1}}}if(B.length){for(var q=[],Q=0;Q<B.length;++Q){var Z=B[Q],J=L[Z.name];if(void 0!==J){Z.glLoc=N[Q];for(var $=0;$<Z.count;++$){for(;q[J];)J=(J+1)%t.capabilities.maxTextureUnits;Z.units.push(J),q[J]=!0}}}for(var tt=0,et=0;et<B.length;++et){var it=B[et];if(!it.glLoc){for(it.glLoc=N[et];q[tt];)tt++;for(var nt=0;nt<it.count;++nt){for(;q[tt];)tt=(tt+1)%t.capabilities.maxTextureUnits;void 0===L[it.name]&&(L[it.name]=tt),it.units.push(tt),q[tt]=!0}}}t.stateCache.glProgram!==e.glProgram&&n.useProgram(e.glProgram);for(var rt=0;rt<B.length;rt++){var st=B[rt];st.glUnits=new Int32Array(st.units),n.uniform1iv(st.glLoc,st.glUnits)}t.stateCache.glProgram!==e.glProgram&&n.useProgram(t.stateCache.glProgram)}e.glSamplerTextures=B}}(G6.instance,this._gpuShader),this._gpuShader}}]),e}(pd),F7=function(){function t(){this.glArrayBuffer=null,this.glElementArrayBuffer=null,this.glUniformBuffer=null,this.glBindUBOs=[],this.glBindUBOOffsets=[],this.glVAO=null,this.texUnit=0,this.glTexUnits=[],this.glSamplerUnits=[],this.glRenderbuffer=null,this.glFramebuffer=null,this.glReadFramebuffer=null,this.viewport=new Wc,this.scissorRect=new Fc(0,0,0,0),this.rs=new ad,this.dss=new od,this.bs=new ud,this.glProgram=null,this.glEnabledAttribLocs=[],this.glCurrentAttribLocs=[],this.texUnitCacheMap={}}return t.prototype.initialize=function(t,e,i){for(var n=0;n<t;++n)this.glTexUnits.push({glTexture:null});this.glSamplerUnits.length=t,this.glSamplerUnits.fill(null),this.glBindUBOs.length=e,this.glBindUBOs.fill(null),this.glBindUBOOffsets.length=e,this.glBindUBOOffsets.fill(0),this.glEnabledAttribLocs.length=i,this.glEnabledAttribLocs.fill(!1),this.glCurrentAttribLocs.length=i,this.glCurrentAttribLocs.fill(!1)},t}(),k7=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._gpuTexture=null,e._gpuTextureView=null,e}s(e,t);var i=e.prototype;return i.initialize=function(t,e){var i=t,n=t;if("texture"in t&&(i=n.texture.info,this._isTextureView=!0),this._info.copy(i),this._isPowerOf2=H_(this._info.width)&&H_(this._info.height),this._size=V_(this._info.format,this.width,this.height,this.depth,this._info.levelCount)*this._info.layerCount,this._isTextureView){var r;if(this._viewInfo.copy(n),this._gpuTexture=n.texture._gpuTexture,(null===(r=this._gpuTexture)||void 0===r?void 0:r.format)!==i.format)return void console.log("GPU memory alias is not supported");this._gpuTextureView={gpuTexture:this._gpuTexture,type:n.type,format:n.format,baseLevel:n.baseLevel,levelCount:n.levelCount}}else this._gpuTexture={type:i.type,format:i.format,usage:i.usage,width:i.width,height:i.height,depth:i.depth,size:this._size,arrayLayer:i.layerCount,mipLevel:i.levelCount,samples:i.samples,flags:i.flags,isPowerOf2:this._isPowerOf2,glTarget:0,glInternalFmt:0,glFormat:0,glType:0,glUsage:0,glTexture:null,glRenderbuffer:null,glWrapS:0,glWrapT:0,glMinFilter:0,glMagFilter:0,isSwapchainTexture:e||!1},!this._gpuTexture.isSwapchainTexture&&this._gpuTexture&&(h7(G6.instance,this._gpuTexture),G6.instance.memoryStatus.textureSize+=this._size),this._viewInfo.texture=this,this._viewInfo.type=t.type,this._viewInfo.format=t.format,this._viewInfo.baseLevel=0,this._viewInfo.levelCount=t.levelCount,this._viewInfo.baseLayer=0,this._viewInfo.layerCount=t.layerCount,this._gpuTextureView={gpuTexture:this._gpuTexture,type:this._viewInfo.type,format:this._viewInfo.format,baseLevel:this._viewInfo.baseLevel,levelCount:this._viewInfo.levelCount}},i.destroy=function(){!this._isTextureView&&this._gpuTexture&&(u7(G6.instance,this._gpuTexture),G6.instance.memoryStatus.textureSize-=this._size,this._gpuTexture=null)},i.getGLTextureHandle=function(){var t=this._gpuTexture;return t?t.glTexture?t.glTexture:t.glRenderbuffer?t.glRenderbuffer:0:0},i.resize=function(t,i){if(this._info.width!==t||this._info.height!==i){this._info.levelCount===e.getLevelCount(this._info.width,this._info.height)?this._info.levelCount=e.getLevelCount(t,i):this._info.levelCount>1&&(this._info.levelCount=Math.min(this._info.levelCount,e.getLevelCount(t,i)));var n=this._size;this._info.width=t,this._info.height=i,this._size=V_(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,s=e.depth,a=e.arrayLayer;switch(e.type){case $l.TEX2D:e.glTarget=i.TEXTURE_2D;var o=Math.max(n,r);if(o>t.capabilities.maxTextureSize&&Z(9100,o,t.capabilities.maxTextureSize),e.samples===nc.X1){var h=t.stateCache.glTexUnits[t.stateCache.texUnit];if(h.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_2D,e.glTexture),h.glTexture=e.glTexture),F_[e.format].isCompressed)for(var u=0;u<e.mipLevel;++u){var l=z_(e.format,n,r,1),c=new Uint8Array(l);i.compressedTexImage2D(i.TEXTURE_2D,u,e.glInternalFmt,n,r,0,c),n=Math.max(1,n>>1),r=Math.max(1,r>>1)}else u7(t,e),h7(t,e)}else e.glRenderbuffer&&(t.stateCache.glRenderbuffer!==e.glRenderbuffer&&(i.bindRenderbuffer(i.RENDERBUFFER,e.glRenderbuffer),t.stateCache.glRenderbuffer=e.glRenderbuffer),i.renderbufferStorageMultisample(i.RENDERBUFFER,e.samples,e.glInternalFmt,e.width,e.height));break;case $l.TEX2D_ARRAY:e.glTarget=i.TEXTURE_2D_ARRAY;var _=Math.max(n,r);if(_>t.capabilities.maxTextureSize&&Z(9100,_,t.capabilities.maxTextureSize),a>t.capabilities.maxArrayTextureLayers&&Z(9100,a,t.capabilities.maxArrayTextureLayers),e.glTexture=i.createTexture(),e.size>0){var d=t.stateCache.glTexUnits[t.stateCache.texUnit];if(d.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_2D_ARRAY,e.glTexture),d.glTexture=e.glTexture),F_[e.format].isCompressed)for(var f=0;f<e.mipLevel;++f){var p=z_(e.format,n,r,a),m=new Uint8Array(p);i.compressedTexImage3D(i.TEXTURE_2D_ARRAY,f,e.glInternalFmt,n,r,a,0,m),n=Math.max(1,n>>1),r=Math.max(1,r>>1)}else i.texStorage3D(i.TEXTURE_2D_ARRAY,e.mipLevel,e.glInternalFmt,n,r,a)}break;case $l.TEX3D:e.glTarget=i.TEXTURE_3D;var g=Math.max(Math.max(n,r),s);if(g>t.capabilities.max3DTextureSize&&Z(9100,g,t.capabilities.max3DTextureSize),e.glTexture=i.createTexture(),e.size>0){var v=t.stateCache.glTexUnits[t.stateCache.texUnit];if(v.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_3D,e.glTexture),v.glTexture=e.glTexture),F_[e.format].isCompressed)for(var y=0;y<e.mipLevel;++y){var T=z_(e.format,n,r,s),S=new Uint8Array(T);i.compressedTexImage3D(i.TEXTURE_3D,y,e.glInternalFmt,n,r,s,0,S),n=Math.max(1,n>>1),r=Math.max(1,r>>1)}else i.texStorage3D(i.TEXTURE_3D,e.mipLevel,e.glInternalFmt,n,r,s)}break;case $l.CUBE:e.type=$l.CUBE,e.glTarget=i.TEXTURE_CUBE_MAP;var E=Math.max(n,r);E>t.capabilities.maxCubeMapTextureSize&&Z(9100,E,t.capabilities.maxTextureSize);var A=t.stateCache.glTexUnits[t.stateCache.texUnit];if(A.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_CUBE_MAP,e.glTexture),A.glTexture=e.glTexture),F_[e.format].isCompressed)for(var R=0;R<6;++R){n=e.width,r=e.height;for(var b=0;b<e.mipLevel;++b){var C=z_(e.format,n,r,1),w=new Uint8Array(C);i.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+R,b,e.glInternalFmt,n,r,0,w),n=Math.max(1,n>>1),r=Math.max(1,r>>1)}}else u7(t,e),h7(t,e);break;default:G("Unsupported TextureType, create texture failed."),e.type=$l.TEX2D,e.glTarget=i.TEXTURE_2D}}}(G6.instance,this._gpuTexture),G6.instance.memoryStatus.textureSize-=n,G6.instance.memoryStatus.textureSize+=this._size))}},i.initAsSwapchainTexture=function(t){var e=new t_;e.format=t.format,e.usage=F_[t.format].hasDepth?tc.DEPTH_STENCIL_ATTACHMENT:tc.COLOR_ATTACHMENT,e.width=t.width,e.height=t.height,this.initialize(e,!0)},n(e,[{key:"gpuTexture",get:function(){return this._gpuTexture}},{key:"gpuTextureView",get:function(){return this._gpuTextureView}}]),e}(md),U7="webglcontextlost";function G7(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 H7(t){var e={EXT_texture_filter_anisotropic:G7(t,"EXT_texture_filter_anisotropic"),EXT_color_buffer_half_float:G7(t,"EXT_color_buffer_half_float"),EXT_color_buffer_float:G7(t,"EXT_color_buffer_float"),WEBGL_compressed_texture_etc1:G7(t,"WEBGL_compressed_texture_etc1"),WEBGL_compressed_texture_etc:G7(t,"WEBGL_compressed_texture_etc"),WEBGL_compressed_texture_pvrtc:G7(t,"WEBGL_compressed_texture_pvrtc"),WEBGL_compressed_texture_astc:G7(t,"WEBGL_compressed_texture_astc"),WEBGL_compressed_texture_s3tc:G7(t,"WEBGL_compressed_texture_s3tc"),WEBGL_compressed_texture_s3tc_srgb:G7(t,"WEBGL_compressed_texture_s3tc_srgb"),WEBGL_debug_shaders:G7(t,"WEBGL_debug_shaders"),WEBGL_lose_context:G7(t,"WEBGL_lose_context"),WEBGL_debug_renderer_info:G7(t,"WEBGL_debug_renderer_info"),OES_texture_half_float_linear:G7(t,"OES_texture_half_float_linear"),OES_texture_float_linear:G7(t,"OES_texture_float_linear"),WEBGL_multi_draw:null,useVAO:!0};return al.os!==il.ANDROID&&al.os!==il.IOS&&(e.WEBGL_multi_draw=G7(t,"WEBGL_multi_draw")),e}var z7=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).stateCache=new F7,e.nullTex2D=null,e.nullTexCube=null,e._canvas=null,e._webGL2ContextLostHandler=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._webGL2ContextLostHandler=this._onWebGLContextLost.bind(this),this._canvas.addEventListener(U7,this._onWebGLContextLost);var e=G6.instance.gl;this.stateCache.initialize(G6.instance.capabilities.maxTextureUnits,G6.instance.capabilities.maxUniformBufferBindings,G6.instance.capabilities.maxVertexAttributes),this._extensions=H7(e),function(t){t.activeTexture(t.TEXTURE0),t.pixelStorei(t.PACK_ALIGNMENT,1),t.pixelStorei(t.UNPACK_ALIGNMENT,1),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,!1),t.bindFramebuffer(t.FRAMEBUFFER,null),t.enable(t.SCISSOR_TEST),t.enable(t.CULL_FACE),t.cullFace(t.BACK),t.frontFace(t.CCW),t.polygonOffset(0,0),t.enable(t.DEPTH_TEST),t.depthMask(!0),t.depthFunc(t.LESS),t.stencilFuncSeparate(t.FRONT,t.ALWAYS,1,65535),t.stencilOpSeparate(t.FRONT,t.KEEP,t.KEEP,t.KEEP),t.stencilMaskSeparate(t.FRONT,65535),t.stencilFuncSeparate(t.BACK,t.ALWAYS,1,65535),t.stencilOpSeparate(t.BACK,t.KEEP,t.KEEP,t.KEEP),t.stencilMaskSeparate(t.BACK,65535),t.disable(t.STENCIL_TEST),t.disable(t.SAMPLE_ALPHA_TO_COVERAGE),t.disable(t.BLEND),t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.ONE,t.ZERO,t.ONE,t.ZERO),t.colorMask(!0,!0,!0,!0),t.blendColor(0,0,0,0)}(e);var i=jl.RGBA8,n=jl.DEPTH_STENCIL,r=e.getParameter(e.DEPTH_BITS),s=e.getParameter(e.STENCIL_BITS);r&&s?n=jl.DEPTH_STENCIL:r&&(n=jl.DEPTH),this._colorTexture=new k7,this._colorTexture.initAsSwapchainTexture({swapchain:this,format:i,width:t.width,height:t.height}),this._depthStencilTexture=new k7,this._depthStencilTexture.initAsSwapchainTexture({swapchain:this,format:n,width:t.width,height:t.height}),this.nullTex2D=G6.instance.createTexture(new t_($l.TEX2D,tc.SAMPLED,jl.RGBA8,2,2,ec.NONE)),this.nullTexCube=G6.instance.createTexture(new t_($l.CUBE,tc.SAMPLED,jl.RGBA8,2,2,ec.NONE,6));var a=new Vc;a.texExtent.width=2,a.texExtent.height=2;var o=new Uint8Array(this.nullTex2D.size);o.fill(0),G6.instance.copyBuffersToTexture([o],this.nullTex2D,[a]),a.texSubres.layerCount=6,G6.instance.copyBuffersToTexture([o,o,o,o,o,o],this.nullTexCube,[a]),this._blitManager=new S7},i.destroy=function(){this._canvas&&this._webGL2ContextLostHandler&&(this._canvas.removeEventListener(U7,this._webGL2ContextLostHandler),this._webGL2ContextLostHandler=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||(z("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),U(t)},n(e,[{key:"extensions",get:function(){return this._extensions}},{key:"blitManager",get:function(){return this._blitManager}}]),e}(td),V7=t("eP",function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._swapchain=null,e._context=null,e._bindingMappings=null,e._textureExclusive=new Array(jl.COUNT),e}s(e,t);var i=e.prototype;return i.initialize=function(t){G6.setInstance(this),this._gfxAPI=Vl.WEBGL2;var e=this._bindingMappingInfo=t.bindingMappingInfo,i=[],n=[],r=e.setIndices[0];i[r]=0,n[r]=0;for(var s=1;s<e.setIndices.length;++s){var a=e.setIndices[s],o=e.setIndices[s-1];i[a]=e.maxBlockCounts[o]+i[o],n[a]=e.maxSamplerTextureCounts[o]+n[o]}for(var 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 l=this._context=function(t){var e=null;try{var i;if(null!==(i=globalThis.__globalXR)&&void 0!==i&&i.webxrCompatible){var n={alpha:Ce.ENABLE_TRANSPARENT_CANVAS,antialias:Ce.ENABLE_WEBGL_ANTIALIAS,depth:!0,stencil:!0,premultipliedAlpha:!1,preserveDrawingBuffer:!1,powerPreference:"default",failIfMajorPerformanceCaveat:!1,xrCompatible:!0};return t.getContext("webgl2",n)}var r={alpha:Ce.ENABLE_TRANSPARENT_CANVAS,antialias:Ce.ENABLE_WEBGL_ANTIALIAS,depth:!0,stencil:!0,premultipliedAlpha:!1,preserveDrawingBuffer:!1,powerPreference:"default",failIfMajorPerformanceCaveat:!1};e=t.getContext("webgl2",r)}catch(t){return null}return e}(J_.canvas);if(!l)return console.error("This device does not support WebGL2."),!1;if(this._queue=this.createQueue(new O_(bc.GRAPHICS)),this._cmdBuff=this.createCommandBuffer(new I_(this._queue)),this._caps.maxVertexAttributes=l.getParameter(l.MAX_VERTEX_ATTRIBS),this._caps.maxVertexUniformVectors=l.getParameter(l.MAX_VERTEX_UNIFORM_VECTORS),al.os===il.IOS){var c=this._caps.maxVertexUniformVectors;Ol.browserType===$u.WECHAT?this._caps.maxVertexUniformVectors=c<256?c:256:Ol.browserType===$u.SAFARI&&(this._caps.maxVertexUniformVectors=c<512?c:512)}this._caps.maxFragmentUniformVectors=l.getParameter(l.MAX_FRAGMENT_UNIFORM_VECTORS),this._caps.maxTextureUnits=l.getParameter(l.MAX_TEXTURE_IMAGE_UNITS),this._caps.maxVertexTextureUnits=l.getParameter(l.MAX_VERTEX_TEXTURE_IMAGE_UNITS),this._caps.maxUniformBufferBindings=l.getParameter(l.MAX_UNIFORM_BUFFER_BINDINGS),this._caps.maxUniformBlockSize=l.getParameter(l.MAX_UNIFORM_BLOCK_SIZE),this._caps.maxTextureSize=l.getParameter(l.MAX_TEXTURE_SIZE),this._caps.maxCubeMapTextureSize=l.getParameter(l.MAX_CUBE_MAP_TEXTURE_SIZE),this._caps.maxArrayTextureLayers=l.getParameter(l.MAX_ARRAY_TEXTURE_LAYERS),this._caps.max3DTextureSize=l.getParameter(l.MAX_3D_TEXTURE_SIZE),this._caps.uboOffsetAlignment=l.getParameter(l.UNIFORM_BUFFER_OFFSET_ALIGNMENT);var _=l.getSupportedExtensions(),f="";if(_)for(var p,m=d(_);!(p=m()).done;)f+=p.value+" ";var g=H7(l);g.WEBGL_debug_renderer_info?(this._renderer=l.getParameter(g.WEBGL_debug_renderer_info.UNMASKED_RENDERER_WEBGL),this._vendor=l.getParameter(g.WEBGL_debug_renderer_info.UNMASKED_VENDOR_WEBGL)):(this._renderer=l.getParameter(l.RENDERER),this._vendor=l.getParameter(l.VENDOR));var v=l.getParameter(l.VERSION);this._features.fill(!1),this.initFormatFeatures(g),this._features[Xl.ELEMENT_INDEX_UINT]=!0,this._features[Xl.INSTANCED_ARRAYS]=!0,this._features[Xl.MULTIPLE_RENDER_TARGETS]=!0,this._features[Xl.BLEND_MINMAX]=!0;var y="";return this.getFormatFeatures(jl.ETC_RGB8)&&(y+="etc1 "),this.getFormatFeatures(jl.ETC2_RGB8)&&(y+="etc2 "),this.getFormatFeatures(jl.BC1)&&(y+="dxt "),this.getFormatFeatures(jl.PVRTC_RGB2)&&(y+="pvrtc "),this.getFormatFeatures(jl.ASTC_RGBA_4X4)&&(y+="astc "),z("WebGL2 device initialized."),z("RENDERER: "+this._renderer),z("VENDOR: "+this._vendor),z("VERSION: "+v),z("COMPRESSED_FORMAT: "+y),z("EXTENSIONS: "+f),!0},i.destroy=function(){this._queue&&(this._queue.destroy(),this._queue=null),this._cmdBuff&&(this._cmdBuff.destroy(),this._cmdBuff=null);for(var t=this._samplers.values(),e=t.next();!e.done;)e.value.destroy(),e=t.next();this._swapchain=null},i.flushCommands=function(){},i.acquire=function(){},i.present=function(){var t=this._queue;this._numDrawCalls=t.numDrawCalls,this._numInstances=t.numInstances,this._numTris=t.numTris,t.clear()},i.initFormatFeatures=function(t){this._formatFeatures.fill(ic.NONE),this._textureExclusive.fill(!0);var e=ic.RENDER_TARGET|ic.SAMPLED_TEXTURE|ic.STORAGE_TEXTURE|ic.LINEAR_FILTER|ic.VERTEX_ATTRIBUTE;this._formatFeatures[jl.R8]=e,this._formatFeatures[jl.RG8]=e,this._formatFeatures[jl.RGB8]=e,this._formatFeatures[jl.RGBA8]=e,e=ic.RENDER_TARGET|ic.SAMPLED_TEXTURE|ic.STORAGE_TEXTURE|ic.LINEAR_FILTER,this._formatFeatures[jl.R8SN]=e,this._formatFeatures[jl.RG8SN]=e,this._formatFeatures[jl.RGB8SN]=e,this._formatFeatures[jl.RGBA8SN]=e,this._formatFeatures[jl.R5G6B5]=e,this._formatFeatures[jl.RGBA4]=e,this._formatFeatures[jl.RGB5A1]=e,this._formatFeatures[jl.RGB10A2]=e,this._formatFeatures[jl.SRGB8]=e,this._formatFeatures[jl.SRGB8_A8]=e,this._formatFeatures[jl.R11G11B10F]=e,this._formatFeatures[jl.RGB9E5]=e,this._formatFeatures[jl.DEPTH]=e,this._formatFeatures[jl.DEPTH_STENCIL]=e,this._formatFeatures[jl.RGB10A2UI]=ic.RENDER_TARGET|ic.STORAGE_TEXTURE|ic.SAMPLED_TEXTURE|ic.LINEAR_FILTER,e=ic.RENDER_TARGET|ic.SAMPLED_TEXTURE|ic.STORAGE_TEXTURE|ic.VERTEX_ATTRIBUTE,this._formatFeatures[jl.R16F]=e,this._formatFeatures[jl.RG16F]=e,this._formatFeatures[jl.RGB16F]=e,this._formatFeatures[jl.RGBA16F]=e,e=ic.STORAGE_TEXTURE|ic.SAMPLED_TEXTURE|ic.VERTEX_ATTRIBUTE,this._formatFeatures[jl.R32F]=e,this._formatFeatures[jl.RG32F]=e,this._formatFeatures[jl.RGB32F]=e,this._formatFeatures[jl.RGBA32F]=e,this._formatFeatures[jl.RGB10A2UI]=ic.RENDER_TARGET|ic.STORAGE_TEXTURE|ic.SAMPLED_TEXTURE|ic.LINEAR_FILTER,e=ic.RENDER_TARGET|ic.STORAGE_TEXTURE|ic.SAMPLED_TEXTURE|ic.LINEAR_FILTER|ic.VERTEX_ATTRIBUTE,this._formatFeatures[jl.R8I]=e,this._formatFeatures[jl.R8UI]=e,this._formatFeatures[jl.R16I]=e,this._formatFeatures[jl.R16UI]=e,this._formatFeatures[jl.R32I]=e,this._formatFeatures[jl.R32UI]=e,this._formatFeatures[jl.RG8I]=e,this._formatFeatures[jl.RG8UI]=e,this._formatFeatures[jl.RG16I]=e,this._formatFeatures[jl.RG16UI]=e,this._formatFeatures[jl.RG32I]=e,this._formatFeatures[jl.RG32UI]=e,this._formatFeatures[jl.RGB8I]=e,this._formatFeatures[jl.RGB8UI]=e,this._formatFeatures[jl.RGB16I]=e,this._formatFeatures[jl.RGB16UI]=e,this._formatFeatures[jl.RGB32I]=e,this._formatFeatures[jl.RGB32UI]=e,this._formatFeatures[jl.RGBA8I]=e,this._formatFeatures[jl.RGBA8UI]=e,this._formatFeatures[jl.RGBA16I]=e,this._formatFeatures[jl.RGBA16UI]=e,this._formatFeatures[jl.RGBA32I]=e,this._formatFeatures[jl.RGBA32UI]=e,this._textureExclusive[jl.R8]=!1,this._textureExclusive[jl.RG8]=!1,this._textureExclusive[jl.RGB8]=!1,this._textureExclusive[jl.R5G6B5]=!1,this._textureExclusive[jl.RGBA4]=!1,this._textureExclusive[jl.RGB5A1]=!1,this._textureExclusive[jl.RGBA8]=!1,this._textureExclusive[jl.RGB10A2]=!1,this._textureExclusive[jl.RGB10A2UI]=!1,this._textureExclusive[jl.SRGB8_A8]=!1,this._textureExclusive[jl.R8I]=!1,this._textureExclusive[jl.R8UI]=!1,this._textureExclusive[jl.R16I]=!1,this._textureExclusive[jl.R16UI]=!1,this._textureExclusive[jl.R32I]=!1,this._textureExclusive[jl.R32UI]=!1,this._textureExclusive[jl.RG8I]=!1,this._textureExclusive[jl.RG8UI]=!1,this._textureExclusive[jl.RG16I]=!1,this._textureExclusive[jl.RG16UI]=!1,this._textureExclusive[jl.RG32I]=!1,this._textureExclusive[jl.RG32UI]=!1,this._textureExclusive[jl.RGBA8I]=!1,this._textureExclusive[jl.RGBA8UI]=!1,this._textureExclusive[jl.RGBA16I]=!1,this._textureExclusive[jl.RGBA16UI]=!1,this._textureExclusive[jl.RGBA32I]=!1,this._textureExclusive[jl.RGBA32UI]=!1,this._textureExclusive[jl.DEPTH]=!1,this._textureExclusive[jl.DEPTH_STENCIL]=!1,t.EXT_color_buffer_float&&(this._formatFeatures[jl.R32F]|=ic.RENDER_TARGET,this._formatFeatures[jl.RG32F]|=ic.RENDER_TARGET,this._formatFeatures[jl.RGBA32F]|=ic.RENDER_TARGET,this._textureExclusive[jl.R32F]=!1,this._textureExclusive[jl.RG32F]=!1,this._textureExclusive[jl.RGBA32F]=!1),t.EXT_color_buffer_half_float&&(this._textureExclusive[jl.R16F]=!1,this._textureExclusive[jl.RG16F]=!1,this._textureExclusive[jl.RGBA16F]=!1),t.OES_texture_float_linear&&(this._formatFeatures[jl.RGB32F]|=ic.LINEAR_FILTER,this._formatFeatures[jl.RGBA32F]|=ic.LINEAR_FILTER,this._formatFeatures[jl.R32F]|=ic.LINEAR_FILTER,this._formatFeatures[jl.RG32F]|=ic.LINEAR_FILTER),t.OES_texture_half_float_linear&&(this._formatFeatures[jl.RGB16F]|=ic.LINEAR_FILTER,this._formatFeatures[jl.RGBA16F]|=ic.LINEAR_FILTER,this._formatFeatures[jl.R16F]|=ic.LINEAR_FILTER,this._formatFeatures[jl.RG16F]|=ic.LINEAR_FILTER);var i=ic.SAMPLED_TEXTURE|ic.LINEAR_FILTER;t.WEBGL_compressed_texture_etc1&&(this._formatFeatures[jl.ETC_RGB8]=i),t.WEBGL_compressed_texture_etc&&(this._formatFeatures[jl.ETC2_RGB8]=i,this._formatFeatures[jl.ETC2_RGBA8]=i,this._formatFeatures[jl.ETC2_SRGB8]=i,this._formatFeatures[jl.ETC2_SRGB8_A8]=i,this._formatFeatures[jl.ETC2_RGB8_A1]=i,this._formatFeatures[jl.ETC2_SRGB8_A1]=i),t.WEBGL_compressed_texture_s3tc&&(this._formatFeatures[jl.BC1]=i,this._formatFeatures[jl.BC1_ALPHA]=i,this._formatFeatures[jl.BC1_SRGB]=i,this._formatFeatures[jl.BC1_SRGB_ALPHA]=i,this._formatFeatures[jl.BC2]=i,this._formatFeatures[jl.BC2_SRGB]=i,this._formatFeatures[jl.BC3]=i,this._formatFeatures[jl.BC3_SRGB]=i),t.WEBGL_compressed_texture_pvrtc&&(this._formatFeatures[jl.PVRTC_RGB2]=i,this._formatFeatures[jl.PVRTC_RGBA2]=i,this._formatFeatures[jl.PVRTC_RGB4]=i,this._formatFeatures[jl.PVRTC_RGBA4]=i),t.WEBGL_compressed_texture_astc&&(this._formatFeatures[jl.ASTC_RGBA_4X4]=i,this._formatFeatures[jl.ASTC_RGBA_5X4]=i,this._formatFeatures[jl.ASTC_RGBA_5X5]=i,this._formatFeatures[jl.ASTC_RGBA_6X5]=i,this._formatFeatures[jl.ASTC_RGBA_6X6]=i,this._formatFeatures[jl.ASTC_RGBA_8X5]=i,this._formatFeatures[jl.ASTC_RGBA_8X6]=i,this._formatFeatures[jl.ASTC_RGBA_8X8]=i,this._formatFeatures[jl.ASTC_RGBA_10X5]=i,this._formatFeatures[jl.ASTC_RGBA_10X6]=i,this._formatFeatures[jl.ASTC_RGBA_10X8]=i,this._formatFeatures[jl.ASTC_RGBA_10X10]=i,this._formatFeatures[jl.ASTC_RGBA_12X10]=i,this._formatFeatures[jl.ASTC_RGBA_12X12]=i,this._formatFeatures[jl.ASTC_SRGBA_4X4]=i,this._formatFeatures[jl.ASTC_SRGBA_5X4]=i,this._formatFeatures[jl.ASTC_SRGBA_5X5]=i,this._formatFeatures[jl.ASTC_SRGBA_6X5]=i,this._formatFeatures[jl.ASTC_SRGBA_6X6]=i,this._formatFeatures[jl.ASTC_SRGBA_8X5]=i,this._formatFeatures[jl.ASTC_SRGBA_8X6]=i,this._formatFeatures[jl.ASTC_SRGBA_8X8]=i,this._formatFeatures[jl.ASTC_SRGBA_10X5]=i,this._formatFeatures[jl.ASTC_SRGBA_10X6]=i,this._formatFeatures[jl.ASTC_SRGBA_10X8]=i,this._formatFeatures[jl.ASTC_SRGBA_10X10]=i,this._formatFeatures[jl.ASTC_SRGBA_12X10]=i,this._formatFeatures[jl.ASTC_SRGBA_12X12]=i)},i.createCommandBuffer=function(t){var e=new(t.type===wc.PRIMARY?M7:b7);return e.initialize(t),e},i.createSwapchain=function(t){var e=new z7;return this._swapchain=e,e.initialize(t),e},i.createBuffer=function(t){var e=new E7;return e.initialize(t),e},i.createTexture=function(t){var e=new k7;return e.initialize(t),e},i.createDescriptorSet=function(t){var e=new U6;return e.initialize(t),e},i.createShader=function(t){var e=new L7;return e.initialize(t),e},i.createInputAssembler=function(t){var e=new w7;return e.initialize(t),e},i.createRenderPass=function(t){var e=new B7;return e.initialize(t),e},i.createFramebuffer=function(t){var e=new C7;return e.initialize(t),e},i.createDescriptorSetLayout=function(t){var e=new x7;return e.initialize(t),e},i.createPipelineLayout=function(t){var e=new I7;return e.initialize(t),e},i.createPipelineState=function(t){var e=new D7;return e.initialize(t),e},i.createQueue=function(t){var e=new P7;return e.initialize(t),e},i.getSampler=function(t){var e=fd.computeHash(t);return this._samplers.has(e)||this._samplers.set(e,new N7(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=vd.computeHash(t);return this._textureBarriers.has(e)||this._textureBarriers.set(e,new vd(t,e)),this._textureBarriers.get(e)},i.getBufferBarrier=function(t){var e=yd.computeHash(t);return this._bufferBarriers.has(e)||this._bufferBarriers.set(e,new yd(t,e)),this._bufferBarriers.get(e)},i.copyBuffersToTexture=function(t,e,i){v7(this,t,e.gpuTexture,i)},i.copyTextureToBuffers=function(t,e,i){!function(t,e,i,n){var r=t.gl,s=t.stateCache,a=r.createFramebuffer();r.bindFramebuffer(r.FRAMEBUFFER,a);var o=0,h=0,u=1,l=1;switch(e.glTarget){case r.TEXTURE_2D:for(var c=0;c<n.length;c++){var _=n[c];r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,e.glTarget,e.glTexture,_.texSubres.mipLevel),o=_.texOffset.x,h=_.texOffset.y,u=_.texExtent.width,l=_.texExtent.height,r.readPixels(o,h,u,l,e.glFormat,e.glType,i[c])}break;default:G("Unsupported GL texture type, copy texture to buffers failed.")}r.bindFramebuffer(r.FRAMEBUFFER,null),s.glFramebuffer=null,r.deleteFramebuffer(a)}(this,t.gpuTexture,e,i)},i.copyTexImagesToTexture=function(t,e,i){!function(t,e,i,n){var r=t.gl,s=t.stateCache.glTexUnits[t.stateCache.texUnit];s.glTexture!==i.glTexture&&(r.bindTexture(i.glTarget,i.glTexture),s.glTexture=i.glTexture);var a=0,o=0;switch(i.glTarget){case r.TEXTURE_2D:if(i.flags&ec.MUTABLE_STORAGE||function(t,e){if(t.length>1||e.length>1)return!1;if(t[0]instanceof HTMLVideoElement){var i=t[0];return 0===e[0].texOffset.x&&0===e[0].texOffset.y&&e[0].texExtent.width===i.videoWidth&&e[0].texExtent.height===i.videoHeight}return!1}(e,n))r.texImage2D(r.TEXTURE_2D,n[0].texSubres.mipLevel,i.glInternalFmt,n[0].texExtent.width,n[0].texExtent.height,0,i.glFormat,i.glType,e[0]);else for(var h=0;h<n.length;h++){var u=n[h];r.texSubImage2D(r.TEXTURE_2D,u.texSubres.mipLevel,u.texOffset.x,u.texOffset.y,i.glFormat,i.glType,e[a++])}break;case r.TEXTURE_CUBE_MAP:for(var l=0;l<n.length;l++){var c=n[l],_=c.texSubres.baseArrayLayer+c.texSubres.layerCount;for(o=c.texSubres.baseArrayLayer;o<_;++o)r.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+o,c.texSubres.mipLevel,c.texOffset.x,c.texOffset.y,i.glFormat,i.glType,e[a++])}break;default:G("Unsupported GL texture type, copy buffer to texture failed.")}i.flags&ec.GEN_MIPMAP&&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}(J_));v.WebGL2Device=V7;var W7,X7,j7,Y7,K7,q7,Q7,Z7,J7,$7,t9,e9,i9,n9,r9,s9,a9,o9,h9,u9,l9,c9,_9,d9,f9,p9,m9,g9,v9,y9,T9,S9,E9,A9,R9=t("eQ",ve({UNIFORM:0,ADAPTIVE:1})),b9=t("eR",function(){function t(){}return t.generate=function(t){switch(t.method){case R9.UNIFORM:return this.doGenerateUniform(t);case R9.ADAPTIVE:return this.doGenerateAdaptive(t);default:return[]}},t.doGenerateUniform=function(t){if(t.nProbesX<2||t.nProbesY<2||t.nProbesZ<2)return[];for(var e=[],i=new hn(0,0,0),n=new hn((t.maxPos.x-t.minPos.x)/(t.nProbesX-1),(t.maxPos.y-t.minPos.y)/(t.nProbesY-1),(t.maxPos.z-t.minPos.z)/(t.nProbesZ-1)),r=0;r<t.nProbesX;r++){i.x=r*n.x+t.minPos.x;for(var s=0;s<t.nProbesY;s++){i.y=s*n.y+t.minPos.y;for(var a=0;a<t.nProbesZ;a++)i.z=a*n.z+t.minPos.z,e.push(new hn(i))}}return e},t.doGenerateAdaptive=function(t){return this.doGenerateUniform(t)},t}()),C9=qs,w9=ra,x9=new vn,I9=new hn(0,0,0),O9=new hn(0,0,0),D9=new hn(0,0,0),M9=new hn(0,0,0),P9=new hn(0,0,0),B9=new hn(0,0,0),N9=new hn(0,0,0),L9=t("eS",C9("cc.Vertex")((X7=function(t){this.position=j7&&j7(),this.normal=Y7&&Y7(),this.coefficients=K7&&K7(),this.position.set(t)},j7=Gs(X7.prototype,"position",[w9],(function(){return new hn(0,0,0)})),Y7=Gs(X7.prototype,"normal",[w9],(function(){return new hn(0,0,0)})),K7=Gs(X7.prototype,"coefficients",[w9],(function(){return[]})),W7=X7))||W7),F9=(q7=function(){function t(t,e,i,n){this.tetrahedron=Q7&&Q7(),this.index=Z7&&Z7(),this.vertex0=J7&&J7(),this.vertex1=$7&&$7(),this.tetrahedron=t,this.index=e,i<n?(this.vertex0=i,this.vertex1=n):(this.vertex0=n,this.vertex1=i)}var e=t.prototype;return e.set=function(t,e,i,n){this.tetrahedron=t,this.index=e,i<n?(this.vertex0=i,this.vertex1=n):(this.vertex0=n,this.vertex1=i)},e.isSame=function(t){return this.vertex0===t.vertex0&&this.vertex1===t.vertex1},t}(),Q7=Gs(q7.prototype,"tetrahedron",[w9],(function(){return-1})),Z7=Gs(q7.prototype,"index",[w9],(function(){return-1})),J7=Gs(q7.prototype,"vertex0",[w9],(function(){return-1})),$7=Gs(q7.prototype,"vertex1",[w9],(function(){return-1})),q7),k9=(t9=function(){function t(t,e,i,n,r,s){this.invalid=e9&&e9(),this.isOuterFace=i9&&i9(),this.tetrahedron=n9&&n9(),this.index=r9&&r9(),this.vertex0=s9&&s9(),this.vertex1=a9&&a9(),this.vertex2=o9&&o9(),this.vertex3=h9&&h9(),this.tetrahedron=t,this.index=e,this.vertex3=s,i<n&&i<r?(this.vertex0=i,n<r?(this.vertex1=n,this.vertex2=r):(this.vertex1=r,this.vertex2=n)):n<i&&n<r?(this.vertex0=n,i<r?(this.vertex1=i,this.vertex2=r):(this.vertex1=r,this.vertex2=i)):(this.vertex0=r,i<n?(this.vertex1=i,this.vertex2=n):(this.vertex1=n,this.vertex2=i))}var e=t.prototype;return e.set=function(t,e,i,n,r,s){this.invalid=!1,this.isOuterFace=!0,this.tetrahedron=t,this.index=e,this.vertex3=s,i<n&&i<r?(this.vertex0=i,n<r?(this.vertex1=n,this.vertex2=r):(this.vertex1=r,this.vertex2=n)):n<i&&n<r?(this.vertex0=n,i<r?(this.vertex1=i,this.vertex2=r):(this.vertex1=r,this.vertex2=i)):(this.vertex0=r,i<n?(this.vertex1=i,this.vertex2=n):(this.vertex1=n,this.vertex2=i))},e.isSame=function(t){return this.vertex0===t.vertex0&&this.vertex1===t.vertex1&&this.vertex2===t.vertex2},t}(),e9=Gs(t9.prototype,"invalid",[w9],(function(){return!1})),i9=Gs(t9.prototype,"isOuterFace",[w9],(function(){return!0})),n9=Gs(t9.prototype,"tetrahedron",[w9],(function(){return-1})),r9=Gs(t9.prototype,"index",[w9],(function(){return-1})),s9=Gs(t9.prototype,"vertex0",[w9],(function(){return-1})),a9=Gs(t9.prototype,"vertex1",[w9],(function(){return-1})),o9=Gs(t9.prototype,"vertex2",[w9],(function(){return-1})),h9=Gs(t9.prototype,"vertex3",[w9],(function(){return-1})),t9),U9=t("eT",C9("cc.CircumSphere")((l9=function(){function t(){this.center=c9&&c9(),this.radiusSquared=_9&&_9()}return t.prototype.init=function(t,e,i,n){x9.set(e.x-t.x,e.y-t.y,e.z-t.z,i.x-t.x,i.y-t.y,i.z-t.z,n.x-t.x,n.y-t.y,n.z-t.z),x9.invert(),x9.transpose(),I9.set(.5*((e.x+t.x)*(e.x-t.x)+(e.y+t.y)*(e.y-t.y)+(e.z+t.z)*(e.z-t.z)),.5*((i.x+t.x)*(i.x-t.x)+(i.y+t.y)*(i.y-t.y)+(i.z+t.z)*(i.z-t.z)),.5*((n.x+t.x)*(n.x-t.x)+(n.y+t.y)*(n.y-t.y)+(n.z+t.z)*(n.z-t.z))),hn.transformMat3(this.center,I9,x9),this.radiusSquared=hn.squaredDistance(t,this.center)},t}(),c9=Gs(l9.prototype,"center",[w9],(function(){return new hn(0,0,0)})),_9=Gs(l9.prototype,"radiusSquared",[w9],(function(){return 0})),u9=l9))||u9),G9=t("eU",C9("cc.Tetrahedron")((f9=function(){function t(t,e,i,n,r){if(void 0===r&&(r=-1),this.invalid=p9&&p9(),this.vertex0=m9&&m9(),this.vertex1=g9&&g9(),this.vertex2=v9&&v9(),this.vertex3=y9&&y9(),this.neighbours=T9&&T9(),this.matrix=S9&&S9(),this.offset=E9&&E9(),this.sphere=A9&&A9(),this.vertex0=e,this.vertex1=i,this.vertex2=n,this.vertex3=r,r>=0){var s=t._probes,a=s[this.vertex0].position,o=s[this.vertex1].position,h=s[this.vertex2].position,u=s[this.vertex3].position;this.sphere.init(a,o,h,u)}}var e=t.prototype;return e.isInCircumSphere=function(t){return hn.squaredDistance(t,this.sphere.center)<this.sphere.radiusSquared-Ci},e.contain=function(t){return this.vertex0===t||this.vertex1===t||this.vertex2===t||this.vertex3===t},e.isInnerTetrahedron=function(){return this.vertex3>=0},e.isOuterCell=function(){return this.vertex3<0},t}(),p9=Gs(f9.prototype,"invalid",[w9],(function(){return!1})),m9=Gs(f9.prototype,"vertex0",[w9],(function(){return-1})),g9=Gs(f9.prototype,"vertex1",[w9],(function(){return-1})),v9=Gs(f9.prototype,"vertex2",[w9],(function(){return-1})),y9=Gs(f9.prototype,"vertex3",[w9],(function(){return-1})),T9=Gs(f9.prototype,"neighbours",[w9],(function(){return[-1,-1,-1,-1]})),S9=Gs(f9.prototype,"matrix",[w9],(function(){return new vn})),E9=Gs(f9.prototype,"offset",[w9],(function(){return new hn(0,0,0)})),A9=Gs(f9.prototype,"sphere",[w9],(function(){return new U9})),d9=f9))||d9),H9=t("eV",function(){function t(t){this._probes=[],this._tetrahedrons=[],this._triangles=[],this._edges=[],this._probes=t}var e=t.prototype;return e.build=function(){return this.reset(),this.tetrahedralize(),this.computeAdjacency(),this.computeMatrices(),this._tetrahedrons},e.reset=function(){this._tetrahedrons.length=0,this._triangles.length=0,this._edges.length=0},e.tetrahedralize=function(){for(var t=this._probes.length,e=this.initTetrahedron(),i=0;i<t;i++)this.addProbe(i);this._tetrahedrons=this._tetrahedrons.filter((function(e){var i=t;return!(e.contain(i)||e.contain(i+1)||e.contain(i+2)||e.contain(i+3))})),this._probes.length=t,this.reorder(e)},e.initTetrahedron=function(){for(var t=new hn(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),e=new hn(Number.MIN_VALUE,Number.MIN_VALUE,Number.MIN_VALUE),i=0;i<this._probes.length;i++){var n=this._probes[i].position;t.x=Math.min(t.x,n.x),e.x=Math.max(e.x,n.x),t.y=Math.min(t.y,n.y),e.y=Math.max(e.y,n.y),t.z=Math.min(t.z,n.z),e.z=Math.max(e.z,n.z)}var r=new hn(0,0,0);hn.add(r,t,e),hn.multiplyScalar(r,r,.5);var s=new hn(0,0,0);hn.subtract(s,e,t);var a=10*Math.max(s.x,s.y,s.z),o=new hn(r.x,r.y+a,r.z),h=new hn(r.x-a,r.y-a,r.z-a),u=new hn(r.x-a,r.y-a,r.z+a),l=new hn(r.x+a,r.y-a,r.z),c=this._probes.length;return this._probes.push(new L9(o)),this._probes.push(new L9(h)),this._probes.push(new L9(u)),this._probes.push(new L9(l)),this._tetrahedrons.push(new G9(this,c,c+1,c+2,c+3)),r},e.addTriangle=function(t,e,i,n,r,s,a){t<this._triangles.length?this._triangles[t].set(e,i,n,r,s,a):this._triangles.push(new k9(e,i,n,r,s,a))},e.addEdge=function(t,e,i,n,r){t<this._edges.length?this._edges[t].set(e,i,n,r):this._edges.push(new F9(e,i,n,r))},e.addProbe=function(t){for(var e=this._probes[t].position,i=0,n=0;n<this._tetrahedrons.length;n++){var r=this._tetrahedrons[n];r.isInCircumSphere(e)&&(r.invalid=!0,this.addTriangle(i,n,0,r.vertex1,r.vertex3,r.vertex2,r.vertex0),this.addTriangle(i+1,n,1,r.vertex0,r.vertex2,r.vertex3,r.vertex1),this.addTriangle(i+2,n,2,r.vertex0,r.vertex3,r.vertex1,r.vertex2),this.addTriangle(i+3,n,3,r.vertex0,r.vertex1,r.vertex2,r.vertex3),i+=4)}for(var s=0;s<i;s++)if(!this._triangles[s].invalid)for(var a=s+1;a<i;a++)if(this._triangles[s].isSame(this._triangles[a])){this._triangles[s].invalid=!0,this._triangles[a].invalid=!0;break}this._tetrahedrons=this._tetrahedrons.filter((function(t){return!t.invalid}));for(var o=0;o<i;o++){var h=this._triangles[o];h.invalid||this._tetrahedrons.push(new G9(this,h.vertex0,h.vertex1,h.vertex2,t))}},e.reorder=function(t){this._tetrahedrons.sort((function(e,i){return hn.squaredDistance(e.sphere.center,t)-hn.squaredDistance(i.sphere.center,t)}))},e.computeAdjacency=function(){for(var t=new hn(0,0,0),e=new hn(0,0,0),i=new hn(0,0,0),n=new hn(0,0,0),r=this._tetrahedrons.length,s=0,a=0;a<this._tetrahedrons.length;a++){var o=this._tetrahedrons[a];this.addTriangle(s,a,0,o.vertex1,o.vertex3,o.vertex2,o.vertex0),this.addTriangle(s+1,a,1,o.vertex0,o.vertex2,o.vertex3,o.vertex1),this.addTriangle(s+2,a,2,o.vertex0,o.vertex3,o.vertex1,o.vertex2),this.addTriangle(s+3,a,3,o.vertex0,o.vertex1,o.vertex2,o.vertex3),s+=4}for(var h=0;h<s;h++)if(this._triangles[h].isOuterFace){for(var u=h+1;u<s;u++)if(this._triangles[h].isSame(this._triangles[u])){this._tetrahedrons[this._triangles[h].tetrahedron].neighbours[this._triangles[h].index]=this._triangles[u].tetrahedron,this._tetrahedrons[this._triangles[u].tetrahedron].neighbours[this._triangles[u].index]=this._triangles[h].tetrahedron,this._triangles[h].isOuterFace=!1,this._triangles[u].isOuterFace=!1;break}if(this._triangles[h].isOuterFace){var l=this._probes[this._triangles[h].vertex0],c=this._probes[this._triangles[h].vertex1],_=this._probes[this._triangles[h].vertex2],d=this._probes[this._triangles[h].vertex3];hn.subtract(e,c.position,l.position),hn.subtract(i,_.position,l.position),hn.cross(t,e,i),hn.subtract(n,d.position,l.position);var f=hn.dot(t,n);f>0&&hn.negate(t,t),hn.add(l.normal,l.normal,t),hn.add(c.normal,c.normal,t),hn.add(_.normal,_.normal,t);var p=this._triangles[h].vertex0,m=f>0?this._triangles[h].vertex2:this._triangles[h].vertex1,g=f>0?this._triangles[h].vertex1:this._triangles[h].vertex2,v=new G9(this,p,m,g);v.neighbours[3]=this._triangles[h].tetrahedron,this._tetrahedrons[this._triangles[h].tetrahedron].neighbours[this._triangles[h].index]=this._tetrahedrons.length,this._tetrahedrons.push(v)}}for(var y=0,T=r;T<this._tetrahedrons.length;T++){var S=this._tetrahedrons[T];this.addEdge(y,T,0,S.vertex1,S.vertex2),this.addEdge(y+1,T,1,S.vertex2,S.vertex0),this.addEdge(y+2,T,2,S.vertex0,S.vertex1),y+=3}for(var E=0;E<y;E++)for(var A=E+1;A<y;A++)this._edges[E].isSame(this._edges[A])&&(this._tetrahedrons[this._edges[E].tetrahedron].neighbours[this._edges[E].index]=this._edges[A].tetrahedron,this._tetrahedrons[this._edges[A].tetrahedron].neighbours[this._edges[A].index]=this._edges[E].tetrahedron);for(var R=0;R<this._probes.length;R++)this._probes[R].normal.normalize()},e.computeMatrices=function(){for(var t=0;t<this._tetrahedrons.length;t++){var e=this._tetrahedrons[t];e.vertex3>=0?this.computeTetrahedronMatrix(e):this.computeOuterCellMatrix(e)}},e.computeTetrahedronMatrix=function(t){var e=this._probes[t.vertex0].position,i=this._probes[t.vertex1].position,n=this._probes[t.vertex2].position,r=this._probes[t.vertex3].position;t.matrix.set(e.x-r.x,i.x-r.x,n.x-r.x,e.y-r.y,i.y-r.y,n.y-r.y,e.z-r.z,i.z-r.z,n.z-r.z),t.matrix.invert(),t.matrix.transpose()},e.computeOuterCellMatrix=function(t){var e=[],i=[];e[0]=this._probes[t.vertex0].normal,e[1]=this._probes[t.vertex1].normal,e[2]=this._probes[t.vertex2].normal,i[0]=this._probes[t.vertex0].position,i[1]=this._probes[t.vertex1].position,i[2]=this._probes[t.vertex2].position,hn.subtract(O9,i[0],i[2]),hn.subtract(D9,e[0],e[2]),hn.subtract(M9,i[1],i[2]),hn.subtract(P9,e[1],e[2]),B9.set(i[2]),hn.negate(N9,e[2]);var n=[];n[0]=D9.y*P9.z-D9.z*P9.y,n[3]=-D9.x*P9.z+D9.z*P9.x,n[6]=D9.x*P9.y-D9.y*P9.x,n[9]=O9.x*P9.y*N9.z-O9.y*P9.x*N9.z+D9.x*M9.y*N9.z-D9.y*M9.x*N9.z+O9.z*P9.x*N9.y-O9.z*P9.y*N9.x+D9.z*M9.x*N9.y-D9.z*M9.y*N9.x-O9.x*P9.z*N9.y+O9.y*P9.z*N9.x-D9.x*M9.z*N9.y+D9.y*M9.z*N9.x,n[9]-=B9.x*n[0]+B9.y*n[3]+B9.z*n[6],n[1]=D9.y*M9.z+O9.y*P9.z-D9.z*M9.y-O9.z*P9.y,n[4]=-O9.x*P9.z-D9.x*M9.z+O9.z*P9.x+D9.z*M9.x,n[7]=O9.x*P9.y-O9.y*P9.x+D9.x*M9.y-D9.y*M9.x,n[10]=O9.x*M9.y*N9.z-O9.y*M9.x*N9.z-O9.x*M9.z*N9.y+O9.y*M9.z*N9.x+O9.z*M9.x*N9.y-O9.z*M9.y*N9.x,n[10]-=B9.x*n[1]+B9.y*n[4]+B9.z*n[7],n[2]=-O9.z*M9.y+O9.y*M9.z,n[5]=-O9.x*M9.z+O9.z*M9.x,n[8]=O9.x*M9.y-O9.y*M9.x,n[11]=0,n[11]-=B9.x*n[2]+B9.y*n[5]+B9.z*n[8];var r=D9.x*P9.y*N9.z-D9.y*P9.x*N9.z+D9.z*P9.x*N9.y-D9.z*P9.y*N9.x+D9.y*P9.z*N9.x-D9.x*P9.z*N9.y;if(Math.abs(r)>Ci)for(var s=0;s<12;s++)n[s]/=r;else t.vertex3=-2;t.matrix.set(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],n[8]),t.offset.set(n[9],n[10],n[11])},t}()),z9=t("eW",function(){function t(){}return t.uniformSampleSphere=function(t,e){var i=1-2*t,n=Math.sqrt(Math.max(0,1-i*i)),r=2*Math.PI*e,s=n*Math.cos(r),a=n*Math.sin(r);return new hn(s,a,i)},t.uniformSampleSphereAll=function(t){for(var e=Math.floor(Math.sqrt(t)),i=e,n=[],r=1/e,s=1/i,a=0;a<e;a++)for(var o=(a+.5)*r,h=0;h<i;h++){var u=(h+.5)*s,l=this.uniformSampleSphere(o,u);n.push(l)}return n},t.uniformSpherePdf=function(){return 1/(4*Math.PI)},t}()),V9=t("eX",function(){function t(){}return t.updateUBOData=function(t,e,i){t[e++]=i[3].x*this.basisOverPI[3],t[e++]=i[1].x*this.basisOverPI[1],t[e++]=i[2].x*this.basisOverPI[2],t[e++]=i[0].x*this.basisOverPI[0]-i[6].x*this.basisOverPI[6]/3,t[e++]=i[3].y*this.basisOverPI[3],t[e++]=i[1].y*this.basisOverPI[1],t[e++]=i[2].y*this.basisOverPI[2],t[e++]=i[0].y*this.basisOverPI[0]-i[6].y*this.basisOverPI[6]/3,t[e++]=i[3].z*this.basisOverPI[3],t[e++]=i[1].z*this.basisOverPI[1],t[e++]=i[2].z*this.basisOverPI[2],t[e++]=i[0].z*this.basisOverPI[0]-i[6].z*this.basisOverPI[6]/3,t[e++]=i[4].x*this.basisOverPI[4],t[e++]=i[5].x*this.basisOverPI[5],t[e++]=i[6].x*this.basisOverPI[6],t[e++]=i[7].x*this.basisOverPI[7],t[e++]=i[4].y*this.basisOverPI[4],t[e++]=i[5].y*this.basisOverPI[5],t[e++]=i[6].y*this.basisOverPI[6],t[e++]=i[7].y*this.basisOverPI[7],t[e++]=i[4].z*this.basisOverPI[4],t[e++]=i[5].z*this.basisOverPI[5],t[e++]=i[6].z*this.basisOverPI[6],t[e++]=i[7].z*this.basisOverPI[7],t[e++]=i[8].x*this.basisOverPI[8],t[e++]=i[8].y*this.basisOverPI[8],t[e++]=i[8].z*this.basisOverPI[8],t[e++]=0},t.shaderEvaluate=function(t,e){var i=new nn(e[3].x*this.basisOverPI[3],e[1].x*this.basisOverPI[1],e[2].x*this.basisOverPI[2],e[0].x*this.basisOverPI[0]-e[6].x*this.basisOverPI[6]/3),n=new nn(e[3].y*this.basisOverPI[3],e[1].y*this.basisOverPI[1],e[2].y*this.basisOverPI[2],e[0].y*this.basisOverPI[0]-e[6].y*this.basisOverPI[6]/3),r=new nn(e[3].z*this.basisOverPI[3],e[1].z*this.basisOverPI[1],e[2].z*this.basisOverPI[2],e[0].z*this.basisOverPI[0]-e[6].z*this.basisOverPI[6]/3),s=new nn(e[4].x*this.basisOverPI[4],e[5].x*this.basisOverPI[5],e[6].x*this.basisOverPI[6],e[7].x*this.basisOverPI[7]),a=new nn(e[4].y*this.basisOverPI[4],e[5].y*this.basisOverPI[5],e[6].y*this.basisOverPI[6],e[7].y*this.basisOverPI[7]),o=new nn(e[4].z*this.basisOverPI[4],e[5].z*this.basisOverPI[5],e[6].z*this.basisOverPI[6],e[7].z*this.basisOverPI[7]),h=new hn(e[8].x*this.basisOverPI[8],e[8].y*this.basisOverPI[8],e[8].z*this.basisOverPI[8]),u=new hn(0,0,0),l=new nn(t.x,t.y,t.z,1);u.x=nn.dot(i,l),u.y=nn.dot(n,l),u.z=nn.dot(r,l);var c=new nn(t.x*t.y,t.y*t.z,t.z*t.z,t.z*t.x),_=t.x*t.x-t.y*t.y;return u.x+=nn.dot(s,c),u.y+=nn.dot(a,c),u.z+=nn.dot(o,c),hn.scaleAndAdd(u,u,h,_),u},t.evaluate=function(t,e){for(var i=new hn(0,0,0),n=e.length,r=0;r<n;r++){var s=e[r];hn.scaleAndAdd(i,i,s,this.evaluateBasis(r,t))}return i},t.project=function(t,e){t.length>0&&(t.length,e.length);for(var i=this.getBasisCount(),n=t.length,r=1/(z9.uniformSpherePdf()*n),s=[],a=0;a<i;a++){for(var o=new hn(0,0,0),h=0;h<n;h++)hn.scaleAndAdd(o,o,e[h],this.evaluateBasis(a,t[h]));hn.multiplyScalar(o,o,r),s.push(o)}return s},t.convolveCosine=function(t){for(var e=[.8862268925,1.0233267546,.495415926],i=[],n=0;n<=this.LMAX;n++)for(var r=-n;r<=n;r++){var s=this.toIndex(n,r),a=new hn(0,0,0);hn.multiplyScalar(a,t[s],this.lambda(n)*e[n]),i.push(a)}return i},t.getBasisCount=function(){return 9},t.evaluateBasis=function(t,e){return this.getBasisCount(),(0,this.basisFunctions[t])(e)},t.reduceRinging=function(t,e){if(0!==e)for(var i=0;i<=this.LMAX;++i)for(var n=1/(1+e*i*i*(i+1)*(i+1)),r=-i;r<=i;++r){var s=this.toIndex(i,r);hn.multiplyScalar(t[s],t[s],n)}},t.lambda=function(t){return Math.sqrt(4*Math.PI/(2*t+1))},t.toIndex=function(t,e){return t*t+t+e},t}());V9.LMAX=2,V9.basisFunctions=[function(){return.282095},function(t){return.488603*t.y},function(t){return.488603*t.z},function(t){return.488603*t.x},function(t){return 1.09255*t.y*t.x},function(t){return 1.09255*t.y*t.z},function(t){return.946175*(t.z*t.z-1/3)},function(t){return 1.09255*t.z*t.x},function(t){return.546274*(t.x*t.x-t.y*t.y)}],V9.basisOverPI=[.0897936,.155527,.155527,.155527,.347769,.347769,.301177,.347769,.173884],v.internal.SH=V9;var W9,X9,j9,Y9,K9,q9,Q9,Z9=function(){function t(){}return t.getQuadraticUniqueRoot=function(t,e,i){return 0!==t?-e/(2*t):0!==e?-i/e:0},t.getCubicUniqueRoot=function(t,e,i){var n=[],r=-t/3,s=e/3-t*t/9,a=i/2+t*t*t/27-t*e/6,o=s*s*s+a*a;if(o>0){var h=Math.sqrt(o);n.push(Math.cbrt(-a+h)+Math.cbrt(-a-h))}else if(o<0){var u=Math.acos(-a*Math.sqrt(-s)/(s*s))/3;n.push(2*Math.sqrt(-s)*Math.cos(u)),n.push(2*Math.sqrt(-s)*Math.cos(u+2*Math.PI/3)),n.push(2*Math.sqrt(-s)*Math.cos(u+4*Math.PI/3))}else if(0===a)n.push(0);else{var l=Math.cbrt(a);n.push(l),n.push(-2*l)}for(var c=0;c<n.length;c++)if(n[c]+r>=0)return n[c]+r;return 0},t}(),J9=new hn(0,0,0),$9=new hn(0,0,0),ttt=new hn(0,0,0),ett=new hn(0,0,0),itt=new hn(0,0,0),ntt=new hn(0,0,0),rtt=new hn(0,0,0),stt=new hn(0,0,0),att=new hn(0,0,0),ott=new hn(0,0,0),htt=new hn(0,0,0),utt=new hn(0,0,0),ltt=new hn(0,0,0),ctt=new hn(0,0,0),_tt=new hn(0,0,0),dtt=t("eY",(W9=qs("cc.LightProbesData"),X9=xa([L9]),j9=xa([G9]),W9((K9=function(){function t(){this._probes=q9&&q9(),this._tetrahedrons=Q9&&Q9()}var e=t.prototype;return e.empty=function(){return 0===this._probes.length||0===this._tetrahedrons.length},e.reset=function(){this._probes.length=0,this._tetrahedrons.length=0},e.updateProbes=function(t){this._probes.length=t.length;for(var e=this._probes.length,i=0;i<e;i++){var n=this._probes[i];if(n)n.position.set(t[i]);else{n=new L9(t[i]);for(var r=0;r<V9.getBasisCount();r++)n.coefficients[r]=hn.ZERO;this._probes[i]=n}}},e.updateTetrahedrons=function(){var t=new H9(this._probes);this._tetrahedrons=t.build()},e.getInterpolationSHCoefficients=function(t,e,i){if(!this.hasCoefficients())return!1;var n=V9.getBasisCount(),r=this._tetrahedrons[t],s=this._probes[r.vertex0].coefficients,a=this._probes[r.vertex1].coefficients,o=this._probes[r.vertex2].coefficients;if(r.vertex3>=0)for(var h=this._probes[r.vertex3].coefficients,u=0;u<n;u++)i[u]=new hn(0,0,0),hn.scaleAndAdd(i[u],i[u],s[u],e.x),hn.scaleAndAdd(i[u],i[u],a[u],e.y),hn.scaleAndAdd(i[u],i[u],o[u],e.z),hn.scaleAndAdd(i[u],i[u],h[u],e.w);else for(var l=0;l<n;l++)i[l]=new hn(0,0,0),hn.scaleAndAdd(i[l],i[l],s[l],e.x),hn.scaleAndAdd(i[l],i[l],a[l],e.y),hn.scaleAndAdd(i[l],i[l],o[l],e.z);return!0},e.getInterpolationWeights=function(t,e,i){var n=this._tetrahedrons.length;(e<0||e>=n)&&(e=0);for(var r=-1,s=-1,a=0;a<n;a++){var o=this._tetrahedrons[e];if(this.getBarycentricCoord(t,o,i),i.x>=0&&i.y>=0&&i.z>=0&&i.w>=0)break;if(r===(s=i.x<i.y&&i.x<i.z&&i.x<i.w?o.neighbours[0]:i.y<i.z&&i.y<i.w?o.neighbours[1]:i.z<i.w?o.neighbours[2]:o.neighbours[3]))break;r=e,e=s}return e},e.hasCoefficients=function(){return!this.empty()&&0!==this._probes[0].coefficients.length},t.getTriangleBarycentricCoord=function(t,e,i,n){if(hn.subtract(J9,e,t),hn.subtract($9,i,t),hn.cross(ttt,J9,$9),ttt.lengthSqr()<=Ci)return new hn(0,0,0);var r=ttt.clone();r.normalize();var s=1/r.dot(ttt);hn.subtract(ett,t,n),hn.subtract(itt,e,n),hn.subtract(ntt,i,n),hn.cross(rtt,itt,ntt);var a=r.dot(rtt)*s;hn.cross(stt,ntt,ett);var o=r.dot(stt)*s;return new hn(a,o,1-a-o)},e.getBarycentricCoord=function(t,e,i){e.vertex3>=0?this.getTetrahedronBarycentricCoord(t,e,i):this.getOuterCellBarycentricCoord(t,e,i)},e.getTetrahedronBarycentricCoord=function(t,e,i){var n=new hn(0,0,0);hn.subtract(n,t,this._probes[e.vertex3].position),hn.transformMat3(n,n,e.matrix),i.set(n.x,n.y,n.z,1-n.x-n.y-n.z)},e.getOuterCellBarycentricCoord=function(e,i,n){var r=this._probes[i.vertex0].position,s=this._probes[i.vertex1].position,a=this._probes[i.vertex2].position;hn.subtract(ott,s,r),hn.subtract(htt,a,r),hn.cross(att,ott,htt),hn.subtract(utt,e,r);var o=hn.dot(utt,att);if(o<0)n.set(0,0,0,-1);else{var h=new hn(0,0,0);hn.transformMat3(h,e,i.matrix),hn.add(h,h,i.offset),o=-1===i.vertex3?Z9.getCubicUniqueRoot(h.x,h.y,h.z):Z9.getQuadraticUniqueRoot(h.x,h.y,h.z),hn.scaleAndAdd(ltt,r,this._probes[i.vertex0].normal,o),hn.scaleAndAdd(ctt,s,this._probes[i.vertex1].normal,o),hn.scaleAndAdd(_tt,a,this._probes[i.vertex2].normal,o);var u=t.getTriangleBarycentricCoord(ltt,ctt,_tt,e);n.set(u.x,u.y,u.z,0)}},n(t,[{key:"probes",get:function(){return this._probes}},{key:"tetrahedrons",get:function(){return this._tetrahedrons}}]),t}(),q9=Gs(K9.prototype,"_probes",[ra,X9],(function(){return[]})),Q9=Gs(K9.prototype,"_tetrahedrons",[ra,j9],(function(){return[]})),Y9=K9))||Y9));v.internal.LightProbesData=dtt;var ftt,ptt,mtt,gtt,vtt,ytt,Ttt,Stt,Ett,Att,Rtt,btt,Ctt,wtt,xtt,Itt=t("eZ",function(){function t(){this._giScale=1,this._giSamples=1024,this._bounces=2,this._reduceRinging=0,this._showProbe=!0,this._showWireframe=!0,this._showConvex=!1,this._data=null,this._lightProbeSphereVolume=1}var e=t.prototype;return e.initialize=function(t){this._giScale=t.giScale,this._giSamples=t.giSamples,this._bounces=t.bounces,this._reduceRinging=t.reduceRinging,this._showProbe=t.showProbe,this._showWireframe=t.showWireframe,this._showConvex=t.showConvex,this._data=t.data,this._lightProbeSphereVolume=t.lightProbeSphereVolume},e.empty=function(){return!this._data||this._data.empty()},n(t,[{key:"giScale",get:function(){return this._giScale},set:function(t){this._giScale=t}},{key:"giSamples",get:function(){return this._giSamples},set:function(t){this._giSamples=t}},{key:"bounces",get:function(){return this._bounces},set:function(t){this._bounces=t}},{key:"reduceRinging",get:function(){return this._reduceRinging},set:function(t){this._reduceRinging=t}},{key:"showProbe",get:function(){return this._showProbe},set:function(t){this._showProbe=t}},{key:"showWireframe",get:function(){return this._showWireframe},set:function(t){this._showWireframe=t}},{key:"showConvex",get:function(){return this._showConvex},set:function(t){this._showConvex=t}},{key:"data",get:function(){return this._data},set:function(t){this._data=t}},{key:"lightProbeSphereVolume",get:function(){return this._lightProbeSphereVolume},set:function(t){this._lightProbeSphereVolume=t}}]),t}());v.internal.LightProbes=Itt,t("e_",(ftt=qs("cc.LightProbeGroup"),ptt=xa([hn]),mtt=xa(R9),gtt=xa(Ke),vtt=xa(Ke),ytt=xa(Ke),ftt(Ttt=Js((Stt=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)._probes=Ett&&Ett(),e._method=Att&&Att(),e._minPos=Rtt&&Rtt(),e._maxPos=btt&&btt(),e._nProbesX=Ctt&&Ctt(),e._nProbesY=wtt&&wtt(),e._nProbesZ=xtt&&xtt(),e}s(e,t);var i=e.prototype;return i.onLoad=function(){},i.onEnable=function(){},i.onDisable=function(){},i.generateLightProbes=function(){this.node&&(this._probes=b9.generate({method:this._method,nProbesX:this._nProbesX,nProbesY:this._nProbesY,nProbesZ:this._nProbesZ,minPos:this._minPos,maxPos:this._maxPos}),this.onProbeChanged())},i.onProbeChanged=function(t,e){void 0===t&&(t=!0),void 0===e&&(e=!0),this.node.scene.globals.lightProbeInfo.syncData(this.node,this.probes),this.node.scene.globals.lightProbeInfo.update(t),e&&this.node.emit(um.LIGHT_PROBE_CHANGED)},n(e,[{key:"probes",get:function(){return this._probes},set:function(t){this._probes=t}},{key:"method",get:function(){return this._method}},{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:"nProbesX",get:function(){return this._nProbesX},set:function(t){this._nProbesX=t}},{key:"nProbesY",get:function(){return this._nProbesY},set:function(t){this._nProbesY=t}},{key:"nProbesZ",get:function(){return this._nProbesZ},set:function(t){this._nProbesZ=t}}]),e}(op),Ett=Gs(Stt.prototype,"_probes",[ra],(function(){return[]})),Att=Gs(Stt.prototype,"_method",[ra],(function(){return R9.UNIFORM})),Rtt=Gs(Stt.prototype,"_minPos",[ra],(function(){return new hn(-5,-5,-5)})),btt=Gs(Stt.prototype,"_maxPos",[ra],(function(){return new hn(5,5,5)})),Ctt=Gs(Stt.prototype,"_nProbesX",[ra],(function(){return 3})),wtt=Gs(Stt.prototype,"_nProbesY",[ra],(function(){return 3})),xtt=Gs(Stt.prototype,"_nProbesZ",[ra],(function(){return 3})),f(Stt.prototype,"probes",[ptt],Object.getOwnPropertyDescriptor(Stt.prototype,"probes"),Stt.prototype),f(Stt.prototype,"method",[mtt],Object.getOwnPropertyDescriptor(Stt.prototype,"method"),Stt.prototype),f(Stt.prototype,"nProbesX",[gtt],Object.getOwnPropertyDescriptor(Stt.prototype,"nProbesX"),Stt.prototype),f(Stt.prototype,"nProbesY",[vtt],Object.getOwnPropertyDescriptor(Stt.prototype,"nProbesY"),Stt.prototype),f(Stt.prototype,"nProbesZ",[ytt],Object.getOwnPropertyDescriptor(Stt.prototype,"nProbesZ"),Stt.prototype),Ttt=Stt))||Ttt)||Ttt));var Ott,Dtt,Mtt,Ptt,Btt,Ntt,Ltt,Ftt,ktt,Utt,Gtt,Htt,ztt,Vtt,Wtt,Xtt,jtt,Ytt,Ktt,qtt,Qtt,Ztt,Jtt,$tt,tet,eet,iet,net,ret=t("e$",(Ott=qs("cc.Billboard"),Dtt=xa(em),Mtt=xa(em),Ott((Btt=function(t){s(i,t);var e=i.prototype;function i(){var e;return(e=t.call(this)||this)._texture=Ntt&&Ntt(),e._height=Ltt&&Ltt(),e._width=Ftt&&Ftt(),e._rotation=ktt&&ktt(),e._techIndex=Utt&&Utt(),e._model=null,e._mesh=null,e._material=null,e._uniform=new nn(1,1,0,0),e}return e.updateTexture=function(){this._material&&this._material.setProperty("mainTexture",this._texture)},e.updateHeight=function(){this._material&&(this._uniform.y=this._height,this._material.setProperty("cc_size_rotation",this._uniform))},e.updateWidth=function(){this._material&&(this._uniform.x=this._width,this._material.setProperty("cc_size_rotation",this._uniform))},e.updateRotation=function(){this._material&&(this._uniform.z=this._rotation,this._material.setProperty("cc_size_rotation",this._uniform))},e.updateTechnique=function(){this._model&&this._mesh&&this._material&&this._material.technique!==this._techIndex&&(this.detachFromScene(),this._model.destroy(),this._model=null,this._material.destroy(),this._material=null,this._mesh.destroy(),this._mesh=null,this.createModel(),this.updateWidth(),this.updateHeight(),this.updateRotation(),this.updateTexture(),this.enabled?(this.attachToScene(),this._model.enabled=!0):this._model.enabled=!1)},e.onLoad=function(){this.createModel()},e.onEnable=function(){this.attachToScene(),this._model.enabled=!0,this.updateWidth(),this.updateHeight(),this.updateRotation(),this.updateTexture(),this.updateTechnique()},e.onDisable=function(){this.detachFromScene()},e.attachToScene=function(){this._model&&this.node&&this.node.scene&&(this._model.scene&&this.detachFromScene(),this._getRenderScene().addModel(this._model))},e.detachFromScene=function(){this._model&&this._model.scene&&this._model.scene.removeModel(this._model)},e.createModel=function(){this._mesh=aF({primitiveMode:vc.TRIANGLE_LIST,positions:[0,0,0,0,0,0,0,0,0,0,0,0],uvs:[0,0,1,0,0,1,1,1],colors:[pn.WHITE.r,pn.WHITE.g,pn.WHITE.b,pn.WHITE.a,pn.WHITE.r,pn.WHITE.g,pn.WHITE.b,pn.WHITE.a,pn.WHITE.r,pn.WHITE.g,pn.WHITE.b,pn.WHITE.a,pn.WHITE.r,pn.WHITE.g,pn.WHITE.b,pn.WHITE.a],attributes:[new __(Mc.ATTR_POSITION,jl.RGB32F),new __(Mc.ATTR_TEX_COORD,jl.RG32F),new __(Mc.ATTR_COLOR,jl.RGBA8UI,!0)],indices:[0,1,2,1,2,3]},void 0,{calculateBounds:!1});var t=this._model=v.director.root.createModel(IB,this.node);t.node=t.transform=this.node,null==this._material&&(this._material=new OS,this._material.copy(aS.get("default-billboard-material"),{technique:this._techIndex})),t.initSubModel(0,this._mesh.renderingSubMeshes[0],this._material)},n(i,[{key:"texture",get:function(){return this._texture},set:function(t){this._texture=t,this.updateTexture()}},{key:"height",get:function(){return this._height},set:function(t){this._height=t,this.updateHeight()}},{key:"width",get:function(){return this._width},set:function(t){this._width=t,this.updateWidth()}},{key:"rotation",get:function(){return Math.round(100*Pi(this._rotation))/100},set:function(t){this._rotation=Mi(t),this.updateRotation()}},{key:"technique",get:function(){return this._techIndex},set:function(t){var e,i;t=Math.floor(t);var n=null===(e=this._material)||void 0===e||null===(i=e.effectAsset)||void 0===i?void 0:i.techniques;n&&t>=n.length&&(t=n.length-1),t<0&&(t=0),this._techIndex=t,this.updateTechnique()}}]),i}(op),Ntt=Gs(Btt.prototype,"_texture",[Dtt],(function(){return null})),f(Btt.prototype,"texture",[Mtt],Object.getOwnPropertyDescriptor(Btt.prototype,"texture"),Btt.prototype),Ltt=Gs(Btt.prototype,"_height",[ra],(function(){return 0})),Ftt=Gs(Btt.prototype,"_width",[ra],(function(){return 0})),ktt=Gs(Btt.prototype,"_rotation",[ra],(function(){return 0})),Utt=Gs(Btt.prototype,"_techIndex",[ra],(function(){return 0})),Ptt=Btt))||Ptt)),set=[new __(Mc.ATTR_POSITION,jl.RGB32F),new __(Mc.ATTR_TEX_COORD,jl.RGBA32F),new __(Mc.ATTR_TEX_COORD1,jl.RGB32F),new __(Mc.ATTR_COLOR,jl.RGBA8,!0)],aet=new hn,oet=new hn,het=function(t){function e(){var e;return(e=t.call(this)||this)._capacity=void 0,e._vertSize=0,e._vBuffer=null,e._vertAttrsFloatCount=0,e._vdataF32=null,e._vdataUint32=null,e._subMeshData=null,e._vertCount=0,e._indexCount=0,e._material=null,e._iaVertCount=0,e._iaIndexCount=0,e.type=mB.LINE,e._capacity=100,e}s(e,t);var i=e.prototype;return i.setCapacity=function(t){this._capacity=t,this.createBuffer()},i.createBuffer=function(){this._vertSize=0;for(var t=0,e=set;t<e.length;t++){var i=e[t];i.offset=this._vertSize,this._vertSize+=F_[i.format].size}this._vertAttrsFloatCount=this._vertSize/4,this._vBuffer=this.createSubMeshData(),this._vdataF32=new Float32Array(this._vBuffer),this._vdataUint32=new Uint32Array(this._vBuffer)},i.updateMaterial=function(e){this._material=e,t.prototype.setSubModelMaterial.call(this,0,e)},i.createSubMeshData=function(){this._subMeshData&&this.destroySubMeshData(),this._vertCount=2,this._indexCount=6;var t=this._device.createBuffer(new qc(ql.VERTEX|ql.TRANSFER_DST,Jl.DEVICE,this._vertSize*this._capacity*this._vertCount,this._vertSize)),e=new ArrayBuffer(this._vertSize*this._capacity*this._vertCount);t.update(e);for(var i=new Uint16Array((this._capacity-1)*this._indexCount),n=0,r=0;r<this._capacity-1;++r){var s=2*r;i[n++]=s,i[n++]=s+1,i[n++]=s+2,i[n++]=s+3,i[n++]=s+2,i[n++]=s+1}var a=this._device.createBuffer(new qc(ql.INDEX|ql.TRANSFER_DST,Jl.DEVICE,(this._capacity-1)*this._indexCount*Uint16Array.BYTES_PER_ELEMENT,Uint16Array.BYTES_PER_ELEMENT));return a.update(i),this._iaVertCount=this._capacity*this._vertCount,this._iaIndexCount=(this._capacity-1)*this._indexCount,this._subMeshData=new Lx([t],set,vc.TRIANGLE_LIST,a),this.initSubModel(0,this._subMeshData,this._material),e},i.addLineVertexData=function(t,e,i){if(t.length>1){var n=0;hn.subtract(aet,t[1],t[0]),this._vdataF32[n++]=t[0].x,this._vdataF32[n++]=t[0].y,this._vdataF32[n++]=t[0].z,this._vdataF32[n++]=0,this._vdataF32[n++]=e.evaluate(0,1),this._vdataF32[n++]=0,this._vdataF32[n++]=0,this._vdataF32[n++]=aet.x,this._vdataF32[n++]=aet.y,this._vdataF32[n++]=aet.z,this._vdataUint32[n++]=i.evaluate(0,1)._val,this._vdataF32[n++]=t[0].x,this._vdataF32[n++]=t[0].y,this._vdataF32[n++]=t[0].z,this._vdataF32[n++]=1,this._vdataF32[n++]=e.evaluate(0,1),this._vdataF32[n++]=0,this._vdataF32[n++]=1,this._vdataF32[n++]=aet.x,this._vdataF32[n++]=aet.y,this._vdataF32[n++]=aet.z,this._vdataUint32[n++]=i.evaluate(0,1)._val;for(var r=1;r<t.length-1;r++){hn.subtract(aet,t[r-1],t[r]),hn.subtract(oet,t[r+1],t[r]),hn.subtract(oet,oet,aet);var s=r/t.length;this._vdataF32[n++]=t[r].x,this._vdataF32[n++]=t[r].y,this._vdataF32[n++]=t[r].z,this._vdataF32[n++]=0,this._vdataF32[n++]=e.evaluate(s,1),this._vdataF32[n++]=s,this._vdataF32[n++]=0,this._vdataF32[n++]=oet.x,this._vdataF32[n++]=oet.y,this._vdataF32[n++]=oet.z,this._vdataUint32[n++]=i.evaluate(s,1)._val,this._vdataF32[n++]=t[r].x,this._vdataF32[n++]=t[r].y,this._vdataF32[n++]=t[r].z,this._vdataF32[n++]=1,this._vdataF32[n++]=e.evaluate(s,1),this._vdataF32[n++]=s,this._vdataF32[n++]=1,this._vdataF32[n++]=oet.x,this._vdataF32[n++]=oet.y,this._vdataF32[n++]=oet.z,this._vdataUint32[n++]=i.evaluate(s,1)._val}hn.subtract(aet,t[t.length-1],t[t.length-2]),this._vdataF32[n++]=t[t.length-1].x,this._vdataF32[n++]=t[t.length-1].y,this._vdataF32[n++]=t[t.length-1].z,this._vdataF32[n++]=0,this._vdataF32[n++]=e.evaluate(1,1),this._vdataF32[n++]=1,this._vdataF32[n++]=0,this._vdataF32[n++]=aet.x,this._vdataF32[n++]=aet.y,this._vdataF32[n++]=aet.z,this._vdataUint32[n++]=i.evaluate(1,1)._val,this._vdataF32[n++]=t[t.length-1].x,this._vdataF32[n++]=t[t.length-1].y,this._vdataF32[n++]=t[t.length-1].z,this._vdataF32[n++]=1,this._vdataF32[n++]=e.evaluate(1,1),this._vdataF32[n++]=1,this._vdataF32[n++]=1,this._vdataF32[n++]=aet.x,this._vdataF32[n++]=aet.y,this._vdataF32[n++]=aet.z,this._vdataUint32[n++]=i.evaluate(1,1)._val}this.updateIA(Math.max(0,t.length-1))},i.updateIA=function(t){var e=this._subModels[0].inputAssembler;e.vertexBuffers[0].update(this._vdataF32),e.firstIndex=0,e.indexCount=this._indexCount*t,e.vertexCount=this._iaVertCount},i.destroySubMeshData=function(){this._subMeshData&&(this._subMeshData.destroy(),this._subMeshData=null)},e}(IB),uet=gi.Attr.setClassAttr,cet=[["mode","constant","multiplier"],["mode","spline","multiplier"],["mode","splineMin","splineMax","multiplier"],["mode","constantMin","constantMax","multiplier"]],_et=ve({Constant:0,Curve:1,TwoCurves:2,TwoConstants:3}),det=t("f3",qs("cc.CurveRange")(((Htt=function(){function t(){this.constant=0,this.constantMin=0,this.constantMax=0,this.multiplier=1,this._mode=_et.Constant}var e=t.prototype;return e.evaluate=function(t,e){switch(this._mode){default:case _et.Constant:return this.constant;case _et.Curve:return this.spline.evaluate(t)*this.multiplier;case _et.TwoCurves:return Di(this.splineMin.evaluate(t),this.splineMax.evaluate(t),e)*this.multiplier;case _et.TwoConstants:return Di(this.constantMin,this.constantMax,e)}},e.getMax=function(){switch(this._mode){default:case _et.Constant:return this.constant;case _et.Curve:return this.multiplier;case _et.TwoConstants:return this.constantMax;case _et.TwoCurves:return this.multiplier}},e.isZero=function(){switch(this._mode){default:case _et.Constant:return xi(this.constant,0,Ci);case _et.Curve:return xi(this.multiplier,0,Ci);case _et.TwoConstants:return xi(Math.max(Math.abs(this.constantMax),Math.abs(this.constantMin)),0,Ci);case _et.TwoCurves:return xi(this.multiplier,0,Ci)}},e._onBeforeSerialize=function(){return cet[this._mode]},n(t,[{key:"mode",get:function(){return this._mode},set:function(t){switch(this._mode=t,t){case _et.Constant:case _et.TwoConstants:break;case _et.Curve:this.spline||(this.spline=_u());break;case _et.TwoCurves:this.splineMax||(this.splineMax=_u()),this.splineMin||(this.splineMin=_u())}}},{key:"curve",get:function(){var t;return null!==(t=this._curve)&&void 0!==t?t:this._curve=new uu(this.spline)},set:function(t){this._curve=t,this.spline=t._internalCurve}},{key:"curveMin",get:function(){var t;return null!==(t=this._curveMin)&&void 0!==t?t:this._curveMin=new uu(this.splineMin)},set:function(t){this._curveMin=t,this.splineMin=t._internalCurve}},{key:"curveMax",get:function(){var t;return null!==(t=this._curveMax)&&void 0!==t?t:this._curveMax=new uu(this.splineMax)},set:function(t){this._curveMax=t,this.splineMax=t._internalCurve}}]),t}()).Mode=_et,Gtt=Htt))||Gtt);function fet(t,e,i){switch(t.mode){case _et.Constant:return t.constant;case _et.Curve:return t.spline.evaluate(e)*t.multiplier;case _et.TwoCurves:return 0===i?t.splineMin.evaluate(e)*t.multiplier:t.splineMax.evaluate(e)*t.multiplier;case _et.TwoConstants:return 0===i?t.constantMin:t.constantMax;default:return 0}}function pet(t){switch(t.mode){case _et.TwoConstants:case _et.TwoCurves:return 2;default:return 1}}function met(t,e,i,n){return null===t||i!==t.width||n!==t.height?(t&&t.destroy(),t=function(t,e,i){var n=new Df({width:e,height:i,_data:t,_compressed:!1,format:lf.RGBA32F}),r=new em;return r.setFilters(_f.NEAREST,_f.NEAREST),r.setMipFilter(_f.NONE),r.setWrapMode(cf.CLAMP_TO_EDGE,cf.CLAMP_TO_EDGE,cf.CLAMP_TO_EDGE),r.image=n,r}(e,i,n)):t.uploadData(e),t}function get(t,e,i,n,r,s,a){var o=Math.max(pet(n),pet(r),pet(s)),h=i*o*4;null!==e&&e.length===h||(e=new Float32Array(i*o*4));for(var u=[n,r,s],l=1/(i-1),c=0;c<o;c++)for(var _=0;_<3;_++)for(var d=u[_],f=0,p=0,m=0;m<i;m++){var g=fet(d,l*m,c);p=a?g:(f+=g)/(m+1),e[4*(c*i+m)+_]=p}return{texture:met(t,e,i,o),texdata:e}}gi.fastDefine("cc.CurveRange",det,{multiplier:1,constantMax:0,constantMin:0,constant:0,mode:_et.Constant,splineMax:Object.freeze(_u()),splineMin:Object.freeze(_u()),spline:Object.freeze(_u())}),uet(det,"multiplier","visible",!0),uet(det,"constantMax","visible",!0),uet(det,"constantMin","visible",!0),uet(det,"constant","visible",!0),hi(det,"mode",_et),uet(det,"mode","visible",!0),uet(det,"splineMax","type","Object"),uet(det,"splineMax","ctor",rh),uet(det,"splineMax","visible",!0),uet(det,"splineMin","type","Object"),uet(det,"splineMin","ctor",rh),uet(det,"splineMin","visible",!0),uet(det,"spline","type","Object"),uet(det,"spline","ctor",rh),uet(det,"spline","visible",!0);var vet,yet,Tet,Eet,Aet,Ret,bet,Cet,wet,xet,Iet,Oet,Det,Met,Pet,Bet,Net,Let,Fet,ket,Uet=ve({Color:0,Gradient:1,TwoColors:2,TwoGradients:3,RandomColor:4}),Get=new pn,Het=new pn,zet=t("f4",(ztt=qs("cc.GradientRange"),Vtt=xa(Uet),Wtt=xa(nu),Xtt=xa(nu),jtt=xa(nu),Ytt=xa(Uet),ztt(((net=function(){function t(){this.color=Qtt&&Qtt(),this.colorMin=Ztt&&Ztt(),this.colorMax=Jtt&&Jtt(),this.gradient=$tt&&$tt(),this.gradientMin=tet&&tet(),this.gradientMax=eet&&eet(),this._mode=iet&&iet(),this._color=pn.WHITE.clone()}var e=t.prototype;return e.evaluate=function(t,e){switch(this._mode){case Uet.Color:return this.color;case Uet.TwoColors:return pn.lerp(this._color,this.colorMin,this.colorMax,e),this._color;case Uet.RandomColor:return this.gradient.getRandomColor(this._color);case Uet.Gradient:return this.gradient.evaluateFast(this._color,t);case Uet.TwoGradients:return pn.lerp(this._color,this.gradientMin.evaluateFast(Get,t),this.gradientMax.evaluateFast(Het,t),e),this._color;default:return this.color}},e._onBeforeSerialize=function(){return(!1)[this._mode]},n(t,[{key:"mode",get:function(){return this._mode},set:function(t){this._mode=t}}]),t}()).Mode=Uet,f((qtt=net).prototype,"mode",[Vtt],Object.getOwnPropertyDescriptor(qtt.prototype,"mode"),qtt.prototype),Qtt=Gs(qtt.prototype,"color",[ra],(function(){return pn.WHITE.clone()})),Ztt=Gs(qtt.prototype,"colorMin",[ra],(function(){return pn.WHITE.clone()})),Jtt=Gs(qtt.prototype,"colorMax",[ra],(function(){return pn.WHITE.clone()})),$tt=Gs(qtt.prototype,"gradient",[Wtt],(function(){return new nu})),tet=Gs(qtt.prototype,"gradientMin",[Xtt],(function(){return new nu})),eet=Gs(qtt.prototype,"gradientMax",[jtt],(function(){return new nu})),iet=Gs(qtt.prototype,"_mode",[Ytt],(function(){return Uet.Color})),Ktt=qtt))||Ktt));function Vet(t,e,i){switch(t.mode){case Uet.Color:return t.color;case Uet.TwoColors:return 0===i?t.colorMin:t.colorMax;case Uet.RandomColor:return t.gradient.getRandomColor(Get);case Uet.Gradient:return t.gradient.evaluateFast(Get,e);case Uet.TwoGradients:return 0===i?t.gradientMin.evaluateFast(Get,e):t.gradientMax.evaluateFast(Get,e);default:return t.color}}var Wet={CC_USE_WORLD_SPACE:!1,CC_USE_WORLD_SCALE:!0},Xet=t("f0",(vet=qs("cc.Line"),yet=xa(em),Tet=xa(em),Eet=xa(OS),Aet=xa([hn]),Ret=xa([hn]),bet=xa(det),Cet=xa(zet),wet=xa(Fn),xet=xa(Fn),vet((Oet=function(t){function e(){var e;return(e=t.call(this)||this)._texture=Det&&Det(),e._material=Met&&Met(),e._worldSpace=Pet&&Pet(),e._positions=Bet&&Bet(),e._width=Net&&Net(),e._color=Let&&Let(),e._tile=Fet&&Fet(),e._tile_offset=new nn,e._offset=ket&&ket(),e}s(e,t);var i=e.prototype;return i.onLoad=function(){var t=v.director.root.createModel(het);if(0===this._models.length?this._models.push(t):this._models[0]=t,t.node=t.transform=this.node,this._material&&(this.lineMaterial=this._material,this._material=null),null===this.lineMaterial){var e=aS.get("default-trail-material");this.material=e}var i=this.getMaterialInstance(0);i&&(Wet.CC_USE_WORLD_SPACE=this.worldSpace,i.recompileShaders(Wet),t.updateMaterial(i)),t.setCapacity(100)},i.onEnable=function(){t.prototype.onEnable.call(this),0!==this._models.length&&this._models[0]&&(this._attachToScene(),this.texture=this._texture,this.tile=this._tile,this.offset=this._offset,this._models[0].addLineVertexData(this._positions,this.width,this.color))},i.onDisable=function(){this._models.length>0&&this._models[0]&&this._detachFromScene()},i._attachToScene=function(){if(t.prototype._attachToScene.call(this),this._models.length>0&&this._models[0]&&this.node&&this.node.scene){var e=this._models[0];e.scene&&this._detachFromScene(),this._getRenderScene().addModel(e)}},i._detachFromScene=function(){if(t.prototype._detachFromScene.call(this),this._models.length>0&&this._models[0]){var e=this._models[0];e.scene&&e.scene.removeModel(e)}},i._onMaterialModified=function(e,i){t.prototype._onMaterialModified.call(this,e,i);var n=this.getMaterialInstance(0);n&&(Wet.CC_USE_WORLD_SPACE=this.worldSpace,n.recompileShaders(Wet),this._models[0]&&this._models[0].updateMaterial(n))},n(e,[{key:"texture",get:function(){return this._texture},set:function(t){this._texture=t,this.material&&this.material.setProperty("mainTexture",t)}},{key:"lineMaterial",get:function(){return this.getSharedMaterial(0)},set:function(t){this.setSharedMaterial(t,0)}},{key:"sharedMaterials",get:function(){return t.prototype.sharedMaterials},set:function(t){this.sharedMaterials=t}},{key:"worldSpace",get:function(){return this._worldSpace},set:function(t){this._worldSpace=t;var e=this.getMaterialInstance(0);e&&(Wet.CC_USE_WORLD_SPACE=this.worldSpace,e.recompileShaders(Wet),this._models[0]&&this._models[0].setSubModelMaterial(0,e))}},{key:"positions",get:function(){return this._positions},set:function(t){this._positions=t,this._models[0]&&this._models[0].addLineVertexData(this._positions,this.width,this.color)}},{key:"width",get:function(){return this._width},set:function(t){this._width=t,this._models[0]&&this._models[0].addLineVertexData(this._positions,this._width,this._color)}},{key:"color",get:function(){return this._color},set:function(t){this._color=t,this._models[0]&&this._models[0].addLineVertexData(this._positions,this._width,this._color)}},{key:"tile",get:function(){return this._tile},set:function(t){this._tile.set(t),this.material&&(this._tile_offset.x=this._tile.x,this._tile_offset.y=this._tile.y,this.material.setProperty("mainTiling_Offset",this._tile_offset))}},{key:"offset",get:function(){return this._offset},set:function(t){this._offset.set(t),this.material&&(this._tile_offset.z=this._offset.x,this._tile_offset.w=this._offset.y,this.material.setProperty("mainTiling_Offset",this._tile_offset))}}]),e}(gW),Det=Gs(Oet.prototype,"_texture",[yet],(function(){return null})),f(Oet.prototype,"texture",[Tet],Object.getOwnPropertyDescriptor(Oet.prototype,"texture"),Oet.prototype),Met=Gs(Oet.prototype,"_material",[ra],(function(){return null})),f(Oet.prototype,"lineMaterial",[Eet],Object.getOwnPropertyDescriptor(Oet.prototype,"lineMaterial"),Oet.prototype),f(Oet.prototype,"sharedMaterials",[Ia,ra],Object.getOwnPropertyDescriptor(Oet.prototype,"sharedMaterials"),Oet.prototype),Pet=Gs(Oet.prototype,"_worldSpace",[ra],(function(){return!1})),Bet=Gs(Oet.prototype,"_positions",[Aet],(function(){return[]})),f(Oet.prototype,"positions",[Ret],Object.getOwnPropertyDescriptor(Oet.prototype,"positions"),Oet.prototype),f(Oet.prototype,"width",[bet],Object.getOwnPropertyDescriptor(Oet.prototype,"width"),Oet.prototype),Net=Gs(Oet.prototype,"_width",[ra],(function(){return new det})),f(Oet.prototype,"color",[Cet],Object.getOwnPropertyDescriptor(Oet.prototype,"color"),Oet.prototype),Let=Gs(Oet.prototype,"_color",[ra],(function(){return new zet})),Fet=Gs(Oet.prototype,"_tile",[ra],(function(){return new Fn(1,1)})),f(Oet.prototype,"tile",[wet],Object.getOwnPropertyDescriptor(Oet.prototype,"tile"),Oet.prototype),ket=Gs(Oet.prototype,"_offset",[ra],(function(){return new Fn(0,0)})),f(Oet.prototype,"offset",[xet],Object.getOwnPropertyDescriptor(Oet.prototype,"offset"),Oet.prototype),Iet=Oet))||Iet)),jet=function(){function t(t){this.particleSystem=void 0,this.position=void 0,this.velocity=void 0,this.animatedVelocity=void 0,this.ultimateVelocity=void 0,this.angularVelocity=void 0,this.axisOfRotation=void 0,this.rotation=void 0,this.startEuler=void 0,this.startRotation=void 0,this.startRotated=void 0,this.deltaQuat=void 0,this.deltaMat=void 0,this.localMat=void 0,this.startSize=void 0,this.size=void 0,this.startColor=void 0,this.color=void 0,this.randomSeed=void 0,this.remainingLifetime=void 0,this.loopCount=void 0,this.lastLoop=void 0,this.trailDelay=void 0,this.startLifetime=void 0,this.emitAccumulator0=void 0,this.emitAccumulator1=void 0,this.frameIndex=void 0,this.startRow=void 0,this.particleSystem=t,this.position=new hn(0,0,0),this.velocity=new hn(0,0,0),this.animatedVelocity=new hn(0,0,0),this.ultimateVelocity=new hn(0,0,0),this.angularVelocity=new hn(0,0,0),this.axisOfRotation=new hn(0,0,0),this.rotation=new hn(0,0,0),this.startEuler=new hn(0,0,0),this.startRotation=new En,this.startRotated=!1,this.deltaQuat=new En,this.deltaMat=new Dn,this.localMat=new Dn,this.startSize=new hn(0,0,0),this.size=new hn(0,0,0),this.startColor=pn.WHITE.clone(),this.color=pn.WHITE.clone(),this.randomSeed=0,this.remainingLifetime=0,this.loopCount=0,this.lastLoop=0,this.trailDelay=0,this.startLifetime=0,this.emitAccumulator0=0,this.emitAccumulator1=0,this.frameIndex=0,this.startRow=0}return t.prototype.reset=function(){this.rotation.set(0,0,0),this.startEuler.set(0,0,0),this.startRotation.set(0,0,0,1),this.startRotated=!1,this.deltaQuat.set(0,0,0,1),this.deltaMat.identity(),this.localMat.identity()},t}();jet.INDENTIFY_NEG_QUAT=10,jet.R2D=180/Math.PI;var Yet,Ket,qet,Qet,Zet,Jet,$et="colorModule",tit="rotationModule",eit="sizeModule",iit="textureModule",nit="noiseModule",rit=["sizeModule","colorModule","forceModule","velocityModule","limitModule","rotationModule","textureModule","noiseModule"],sit=["_colorOverLifetimeModule","_shapeModule","_sizeOvertimeModule","_velocityOvertimeModule","_forceOvertimeModule","_limitVelocityOvertimeModule","_rotationOvertimeModule","_textureAnimationModule","_noiseModule","_trailModule"],ait=function(){function t(){this.target=null,this.needUpdate=!1,this.needAnimate=!0,this.name=void 0}var e=t.prototype;return e.bindTarget=function(t){this.target=t},e.update=function(){},t}(),oit=ve({World:0,Local:1,Custom:2}),hit=ve({Pause:0,PauseAndCatchup:1,AlwaysSimulate:2}),uit=ve({World:0,Local:1,View:2}),lit=ve({Billboard:0,StrecthedBillboard:1,HorizontalBillboard:2,VerticalBillboard:3,Mesh:4}),cit=ve({Box:0,Circle:1,Cone:2,Sphere:3,Hemisphere:4}),_it=ve({Base:0,Edge:1,Shell:2,Volume:3}),dit=ve({Random:0,Loop:1,PingPong:2}),fit=ve({Particles:0}),pit=ve({Stretch:0}),mit=new hn(0,0,-1);function git(t,e,i,n){return e!==t?(t===oit.World||Dn.invert(i,i),Dn.getRotation(n,i),!0):(En.set(n,0,0,0,1),!1)}function vit(t,e){Fn.set(t,Math.cos(e),Math.sin(e))}function yit(t){var e=Li(-1,1),i=Li(0,2*Math.PI),n=Math.sqrt(1-e*e),r=n*Math.cos(i),s=n*Math.sin(i);hn.set(t,r,s,e)}function Tit(t,e,i){yit(t),hn.multiplyScalar(t,t,e+(i-e)*Bi())}function Sit(t,e,i,n){vit(t,n),t.z=0,hn.multiplyScalar(t,t,e+(i-e)*Bi())}function Eit(t){for(var e=0;e<t.length;e++){var i=e+Fi(0,t.length-e),n=t[i];t[i]=t[e],t[e]=n}}function Ait(){var t=Li(-1,1);return 0===t&&t++,E(t)}function Rit(t){var e=det.Mode;switch(t.mode){case e.TwoCurves:case e.TwoConstants:return!0;default:return!1}}var bit,Cit,wit,xit,Iit,Oit,Dit,Mit,Pit,Bit,Nit,Lit,Fit,kit,Uit,Git,Hit,zit,Vit,Wit,Xit,jit,Yit,Kit,qit,Qit,Zit,Jit,$it,tnt,ent,int,nnt,rnt,snt,ant,ont,hnt,unt,lnt=(Yet=qs("cc.ColorOvertimeModule"),Ket=xa(zet),Yet((Qet=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)._enable=Zet&&Zet(),e.color=Jet&&Jet(),e.name=$et,e}return s(e,t),e.prototype.animate=function(t){t.color.set(t.startColor);var e=function(t){var e=zet.Mode;switch(t.mode){case e.TwoGradients:case e.TwoColors:return!0;default:return!1}}(this.color)?ki(t.randomSeed+91041):0;t.color.multiply(this.color.evaluate(1-t.remainingLifetime/t.startLifetime,e))},n(e,[{key:"enable",get:function(){return this._enable},set:function(t){this._enable!==t&&(this._enable=t,this.target&&this.target.enableModule(this.name,t,this))}}]),e}(ait),Zet=Gs(Qet.prototype,"_enable",[ra],(function(){return!1})),Jet=Gs(Qet.prototype,"color",[Ket,ra],(function(){return new zet})),qet=Qet))||qet),cnt=212165,_nt=new hn,dnt=(bit=qs("cc.ForceOvertimeModule"),Cit=xa(det),wit=xa(det),xit=xa(det),Iit=xa(oit),bit((Dit=function(t){function e(){var e;return(e=t.call(this)||this)._enable=Mit&&Mit(),e.x=Pit&&Pit(),e.y=Bit&&Bit(),e.z=Nit&&Nit(),e.space=Lit&&Lit(),e.randomized=!1,e.rotation=void 0,e.needTransform=void 0,e.name="forceModule",e.rotation=new En,e.needTransform=!1,e.needUpdate=!0,e}s(e,t);var i=e.prototype;return i.update=function(t,e){this.needTransform=git(t,this.space,e,this.rotation)},i.animate=function(t,e){var i=1-t.remainingLifetime/t.startLifetime,n=Rit(this.x)?ki(t.randomSeed+cnt):0,r=Rit(this.y)?ki(t.randomSeed+cnt):0,s=Rit(this.z)?ki(t.randomSeed+cnt):0,a=hn.set(_nt,this.x.evaluate(i,n),this.y.evaluate(i,r),this.z.evaluate(i,s));this.needTransform&&hn.transformQuat(a,a,this.rotation),hn.scaleAndAdd(t.velocity,t.velocity,a,e),hn.copy(t.ultimateVelocity,t.velocity)},n(e,[{key:"enable",get:function(){return this._enable},set:function(t){this._enable!==t&&(this._enable=t,this.target&&this.target.enableModule(this.name,t,this))}}]),e}(ait),Mit=Gs(Dit.prototype,"_enable",[ra],(function(){return!1})),Pit=Gs(Dit.prototype,"x",[Cit,ra],(function(){return new det})),Bit=Gs(Dit.prototype,"y",[wit,ra],(function(){return new det})),Nit=Gs(Dit.prototype,"z",[xit,ra],(function(){return new det})),Lit=Gs(Dit.prototype,"space",[Iit,ra],(function(){return oit.Local})),Oit=Dit))||Oit),fnt=23541,pnt=new hn,mnt=new hn,gnt=(Fit=qs("cc.LimitVelocityOvertimeModule"),kit=xa(det),Uit=xa(det),Git=xa(det),Hit=xa(det),zit=xa(oit),Fit((Wit=function(t){function e(){var e;return(e=t.call(this)||this)._enable=Xit&&Xit(),e.limitX=jit&&jit(),e.limitY=Yit&&Yit(),e.limitZ=Kit&&Kit(),e.limit=qit&&qit(),e.dampen=Qit&&Qit(),e.separateAxes=Zit&&Zit(),e.space=Jit&&Jit(),e.drag=null,e.multiplyDragByParticleSize=!1,e.multiplyDragByParticleVelocity=!1,e.name="limitModule",e.rotation=void 0,e.needTransform=void 0,e.rotation=new En,e.needTransform=!1,e.needUpdate=!0,e}s(e,t);var i=e.prototype;return i.update=function(t,e){this.needTransform=git(t,this.space,e,this.rotation)},i.animate=function(t){var e=1-t.remainingLifetime/t.startLifetime,i=pnt;if(this.separateAxes){var n=Rit(this.limitX)?ki(t.randomSeed+fnt):0,r=Rit(this.limitY)?ki(t.randomSeed+fnt):0,s=Rit(this.limitZ)?ki(t.randomSeed+fnt):0;hn.set(mnt,this.limitX.evaluate(e,n),this.limitY.evaluate(e,r),this.limitZ.evaluate(e,s)),this.needTransform&&hn.transformQuat(mnt,mnt,this.rotation),hn.set(i,vnt(t.ultimateVelocity.x,mnt.x,this.dampen),vnt(t.ultimateVelocity.y,mnt.y,this.dampen),vnt(t.ultimateVelocity.z,mnt.z,this.dampen))}else{hn.normalize(i,t.ultimateVelocity);var a=Rit(this.limit)?ki(t.randomSeed+fnt):0;hn.multiplyScalar(i,i,vnt(t.ultimateVelocity.length(),this.limit.evaluate(e,a),this.dampen))}hn.copy(t.ultimateVelocity,i),hn.copy(t.velocity,t.ultimateVelocity)},n(e,[{key:"enable",get:function(){return this._enable},set:function(t){this._enable!==t&&(this._enable=t,this.target&&this.target.enableModule(this.name,t,this))}}]),e}(ait),Xit=Gs(Wit.prototype,"_enable",[ra],(function(){return!1})),jit=Gs(Wit.prototype,"limitX",[kit,ra],(function(){return new det})),Yit=Gs(Wit.prototype,"limitY",[Uit,ra],(function(){return new det})),Kit=Gs(Wit.prototype,"limitZ",[Git,ra],(function(){return new det})),qit=Gs(Wit.prototype,"limit",[Hit,ra],(function(){return new det})),Qit=Gs(Wit.prototype,"dampen",[ra],(function(){return 3})),Zit=Gs(Wit.prototype,"separateAxes",[ra],(function(){return!1})),Jit=Gs(Wit.prototype,"space",[zit,ra],(function(){return oit.Local})),Vit=Wit))||Vit);function vnt(t,e,i){var n=Math.sign(t),r=Math.abs(t);if(r>e){var s=r-r*i;r=s>e?s:e}return r*n}var ynt,Tnt,Snt,Ent,Ant,Rnt,bnt,Cnt,wnt,xnt,Int,Ont,Dnt,Mnt,Pnt,Bnt,Nnt,Lnt,Fnt,knt,Unt,Gnt,Hnt,znt,Vnt,Wnt,Xnt,jnt,Ynt,Knt,qnt,Qnt,Znt,Jnt,$nt,trt,ert,irt,nrt,rrt,srt,art,ort,hrt,urt,lrt,crt,_rt,drt,frt,prt,mrt,grt,vrt,yrt,Trt,Srt,Ert,Art,Rrt,brt,Crt,wrt,xrt,Irt,Ort,Drt,Mrt,Prt,Brt,Nrt,Lrt,Frt,krt,Urt,Grt,Hrt,zrt,Vrt,Wrt,Xrt,jrt,Yrt,Krt,qrt,Qrt,Zrt=125292,Jrt=($it=qs("cc.RotationOvertimeModule"),tnt=xa(det),ent=xa(det),int=xa(det),$it((rnt=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)._enable=snt&&snt(),e._separateAxes=ant&&ant(),e.x=ont&&ont(),e.y=hnt&&hnt(),e.z=unt&&unt(),e.name=tit,e._startMat=new Dn,e._matRot=new Dn,e._quatRot=new En,e._otherEuler=new hn,e}s(e,t);var i=e.prototype;return i._processRotation=function(t){var e=t.particleSystem.processor.getInfo().renderMode;e!==lit.Mesh&&e===lit.StrecthedBillboard&&this._quatRot.set(0,0,0,1),En.normalize(this._quatRot,this._quatRot),this._quatRot.w<0&&(this._quatRot.x+=jet.INDENTIFY_NEG_QUAT)},i.animate=function(t,e){var i=1-t.remainingLifetime/t.startLifetime,n=Rit(this.z)?ki(t.randomSeed+Zrt):0,r=t.particleSystem.processor.getInfo().renderMode;if(this._separateAxes&&r!==lit.VerticalBillboard&&r!==lit.HorizontalBillboard){var s=Rit(this.x)?ki(t.randomSeed+Zrt):0,a=Rit(this.y)?ki(t.randomSeed+Zrt):0;En.fromEuler(t.deltaQuat,this.x.evaluate(i,s)*e*jet.R2D,this.y.evaluate(i,a)*e*jet.R2D,this.z.evaluate(i,n)*e*jet.R2D)}else En.fromEuler(t.deltaQuat,0,0,this.z.evaluate(i,n)*e*jet.R2D);t.deltaMat=Dn.fromQuat(t.deltaMat,t.deltaQuat),t.localMat=t.localMat.multiply(t.deltaMat),t.startRotated||(r!==lit.Mesh&&(r===lit.StrecthedBillboard?t.startEuler.set(0,0,0):r!==lit.Billboard&&t.startEuler.set(0,0,t.startEuler.z)),En.fromEuler(t.startRotation,t.startEuler.x*jet.R2D,t.startEuler.y*jet.R2D,t.startEuler.z*jet.R2D),t.startRotated=!0),this._startMat=Dn.fromQuat(this._startMat,t.startRotation),this._matRot=this._startMat.multiply(t.localMat),Dn.getRotation(this._quatRot,this._matRot),this._processRotation(t,jet.R2D),t.rotation.set(this._quatRot.x,this._quatRot.y,this._quatRot.z)},n(e,[{key:"enable",get:function(){return this._enable},set:function(t){this._enable!==t&&(this._enable=t,this.target&&this.target.enableModule(this.name,t,this))}},{key:"separateAxes",get:function(){return this._separateAxes},set:function(t){this._separateAxes=t}}]),e}(ait),snt=Gs(rnt.prototype,"_enable",[ra],(function(){return!1})),ant=Gs(rnt.prototype,"_separateAxes",[ra],(function(){return!1})),ont=Gs(rnt.prototype,"x",[tnt,ra],(function(){return new det})),hnt=Gs(rnt.prototype,"y",[ent,ra],(function(){return new det})),unt=Gs(rnt.prototype,"z",[int,ra],(function(){return new det})),nnt=rnt))||nnt),$rt=39825,tst=(ynt=qs("cc.SizeOvertimeModule"),Tnt=xa(det),Snt=xa(det),Ent=xa(det),Ant=xa(det),ynt((bnt=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)._enable=Cnt&&Cnt(),e.separateAxes=wnt&&wnt(),e.size=xnt&&xnt(),e.x=Int&&Int(),e.y=Ont&&Ont(),e.z=Dnt&&Dnt(),e.name=eit,e}return s(e,t),e.prototype.animate=function(t){if(this.separateAxes){var e=1-t.remainingLifetime/t.startLifetime,i=Rit(this.x)?ki(t.randomSeed+$rt):0,n=Rit(this.y)?ki(t.randomSeed+$rt):0,r=Rit(this.z)?ki(t.randomSeed+$rt):0;t.size.x=t.startSize.x*this.x.evaluate(e,i),t.size.y=t.startSize.y*this.y.evaluate(e,n),t.size.z=t.startSize.z*this.z.evaluate(e,r)}else{var s=Rit(this.size)?ki(t.randomSeed+$rt):0;hn.multiplyScalar(t.size,t.startSize,this.size.evaluate(1-t.remainingLifetime/t.startLifetime,s))}},n(e,[{key:"enable",get:function(){return this._enable},set:function(t){this._enable!==t&&(this._enable=t,this.target&&this.target.enableModule(this.name,t,this))}}]),e}(ait),Cnt=Gs(bnt.prototype,"_enable",[ra],(function(){return!1})),wnt=Gs(bnt.prototype,"separateAxes",[ra],(function(){return!1})),xnt=Gs(bnt.prototype,"size",[Tnt,ra],(function(){return new det})),Int=Gs(bnt.prototype,"x",[Snt,ra],(function(){return new det})),Ont=Gs(bnt.prototype,"y",[Ent,ra],(function(){return new det})),Dnt=Gs(bnt.prototype,"z",[Ant,ra],(function(){return new det})),Rnt=bnt))||Rnt),est=ve({Grid:0}),ist=ve({WholeSheet:0,SingleRow:1}),nst=(Mnt=qs("cc.TextureAnimationModule"),Pnt=sa("numTilesX"),Bnt=sa("numTilesY"),Nnt=xa(est),Lnt=xa(est),Fnt=xa(ist),knt=xa(det),Unt=xa(det),Mnt((Hnt=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)._enable=znt&&znt(),e._numTilesX=Vnt&&Vnt(),e._numTilesY=Wnt&&Wnt(),e._mode=Xnt&&Xnt(),e.animation=jnt&&jnt(),e.frameOverTime=Ynt&&Ynt(),e.startFrame=Knt&&Knt(),e.cycleCount=qnt&&qnt(),e._flipU=Qnt&&Qnt(),e._flipV=Znt&&Znt(),e._uvChannelMask=Jnt&&Jnt(),e.randomRow=$nt&&$nt(),e.rowIndex=trt&&trt(),e.name=iit,e}s(e,t);var i=e.prototype;return i.init=function(t){t.startRow=Math.floor(Bi()*this.numTilesY)},i.animate=function(t){var e=1-t.remainingLifetime/t.startLifetime,i=Rit(this.startFrame)?ki(t.randomSeed+90794):0,n=Rit(this.frameOverTime)?ki(t.randomSeed+90794):0,r=this.startFrame.evaluate(e,i)/(this.numTilesX*this.numTilesY);if(this.animation===ist.WholeSheet)t.frameIndex=zi(this.cycleCount*(this.frameOverTime.evaluate(e,n)+r),1);else if(this.animation===ist.SingleRow){var s=1/this.numTilesY;if(this.randomRow){var a=zi(this.cycleCount*(this.frameOverTime.evaluate(e,n)+r),1),o=t.startRow*s,h=o+s;t.frameIndex=Di(o,h,a)}else{var u=this.rowIndex*s,l=u+s;t.frameIndex=Di(u,l,zi(this.cycleCount*(this.frameOverTime.evaluate(e,n)+r),1))}}},n(e,[{key:"enable",get:function(){return this._enable},set:function(t){this._enable!==t&&(this._enable=t,this.target&&(this.target.updateMaterialParams(),this.target.enableModule(this.name,t,this)))}},{key:"mode",get:function(){return this._mode},set:function(t){t!==est.Grid&&G("particle texture animation's sprites is not supported!")}},{key:"numTilesX",get:function(){return this._numTilesX},set:function(t){this._numTilesX!==t&&(this._numTilesX=t,this.target.updateMaterialParams())}},{key:"numTilesY",get:function(){return this._numTilesY},set:function(t){this._numTilesY!==t&&(this._numTilesY=t,this.target.updateMaterialParams())}},{key:"flipU",get:function(){return this._flipU},set:function(){G("particle texture animation's flipU is not supported!")}},{key:"flipV",get:function(){return this._flipV},set:function(){G("particle texture animation's flipV is not supported!")}},{key:"uvChannelMask",get:function(){return this._uvChannelMask},set:function(){G("particle texture animation's uvChannelMask is not supported!")}}]),e}(ait),znt=Gs(Hnt.prototype,"_enable",[ra],(function(){return!1})),Vnt=Gs(Hnt.prototype,"_numTilesX",[Pnt],(function(){return 0})),Wnt=Gs(Hnt.prototype,"_numTilesY",[Bnt],(function(){return 0})),Xnt=Gs(Hnt.prototype,"_mode",[Nnt],(function(){return est.Grid})),f(Hnt.prototype,"mode",[Lnt],Object.getOwnPropertyDescriptor(Hnt.prototype,"mode"),Hnt.prototype),jnt=Gs(Hnt.prototype,"animation",[Fnt,ra],(function(){return ist.WholeSheet})),Ynt=Gs(Hnt.prototype,"frameOverTime",[knt,ra],(function(){return new det})),Knt=Gs(Hnt.prototype,"startFrame",[Unt,ra],(function(){return new det})),qnt=Gs(Hnt.prototype,"cycleCount",[ra],(function(){return 0})),Qnt=Gs(Hnt.prototype,"_flipU",[ra],(function(){return 0})),Znt=Gs(Hnt.prototype,"_flipV",[ra],(function(){return 0})),Jnt=Gs(Hnt.prototype,"_uvChannelMask",[ra],(function(){return-1})),$nt=Gs(Hnt.prototype,"randomRow",[ra],(function(){return!1})),trt=Gs(Hnt.prototype,"rowIndex",[ra],(function(){return 0})),Gnt=Hnt))||Gnt),rst=197866,sst=new hn,ast=(ert=qs("cc.VelocityOvertimeModule"),irt=xa(det),nrt=xa(det),rrt=xa(det),srt=xa(det),art=xa(oit),ert((hrt=function(t){function e(){var e;return(e=t.call(this)||this)._enable=urt&&urt(),e.x=lrt&&lrt(),e.y=crt&&crt(),e.z=_rt&&_rt(),e.speedModifier=drt&&drt(),e.space=frt&&frt(),e.rotation=void 0,e.needTransform=void 0,e.name="velocityModule",e.rotation=new En,e.speedModifier.constant=1,e.needTransform=!1,e.needUpdate=!0,e}s(e,t);var i=e.prototype;return i.update=function(t,e){this.needTransform=git(t,this.space,e,this.rotation)},i.animate=function(t){var e=1-t.remainingLifetime/t.startLifetime,i=Rit(this.x)?ki(t.randomSeed^rst):0,n=Rit(this.y)?ki(156497^t.randomSeed):0,r=Rit(this.z)?ki(984136^t.randomSeed):0,s=Rit(this.speedModifier)?ki(t.randomSeed+rst):0,a=hn.set(sst,this.x.evaluate(e,i),this.y.evaluate(e,n),this.z.evaluate(e,r));this.needTransform&&hn.transformQuat(a,a,this.rotation),hn.add(t.animatedVelocity,t.animatedVelocity,a),hn.add(t.ultimateVelocity,t.velocity,t.animatedVelocity),hn.multiplyScalar(t.ultimateVelocity,t.ultimateVelocity,this.speedModifier.evaluate(1-t.remainingLifetime/t.startLifetime,s))},n(e,[{key:"enable",get:function(){return this._enable},set:function(t){this._enable!==t&&(this._enable=t,this.target&&this.target.enableModule(this.name,t,this))}}]),e}(ait),urt=Gs(hrt.prototype,"_enable",[ra],(function(){return!1})),lrt=Gs(hrt.prototype,"x",[irt,ra],(function(){return new det})),crt=Gs(hrt.prototype,"y",[nrt,ra],(function(){return new det})),_rt=Gs(hrt.prototype,"z",[rrt,ra],(function(){return new det})),drt=Gs(hrt.prototype,"speedModifier",[srt,ra],(function(){return new det})),frt=Gs(hrt.prototype,"space",[art,ra],(function(){return oit.Local})),ort=hrt))||ort),ost=t("f5",(prt=qs("cc.Burst"),mrt=xa(det),prt((vrt=function(){function t(){this._time=yrt&&yrt(),this._repeatCount=Trt&&Trt(),this.repeatInterval=Srt&&Srt(),this.count=Ert&&Ert(),this._remainingCount=void 0,this._curTime=void 0,this._remainingCount=0,this._curTime=0}var e=t.prototype;return e.update=function(t,e){if(0===this._remainingCount&&(this._remainingCount=this._repeatCount,this._curTime=this._time),this._remainingCount>0){var i=zi(t._time-t.startDelay.evaluate(0,1),t.duration)-e;i=i>0?i:0;var n=zi(t.time-t.startDelay.evaluate(0,1),t.duration);this._curTime>=i&&this._curTime<n&&(t.emit(this.count.evaluate(this._curTime/t.duration,1),e-(n-this._curTime)),this._curTime+=this.repeatInterval,--this._remainingCount)}},e.reset=function(){this._remainingCount=0,this._curTime=0},e.getMaxCount=function(t){return this.count.getMax()*Math.min(Math.ceil(t.duration/this.repeatInterval),this.repeatCount)},n(t,[{key:"time",get:function(){return this._time},set:function(t){this._time=t,this._curTime=t}},{key:"repeatCount",get:function(){return this._repeatCount},set:function(t){this._repeatCount=t,this._remainingCount=t}}]),t}(),yrt=Gs(vrt.prototype,"_time",[ra],(function(){return 0})),Trt=Gs(vrt.prototype,"_repeatCount",[ra],(function(){return 1})),Srt=Gs(vrt.prototype,"repeatInterval",[ra],(function(){return 1})),Ert=Gs(vrt.prototype,"count",[mrt,ra],(function(){return new det})),grt=vrt))||grt)),hst=new hn(0,0,0),ust=[],lst=new hn(.5,.5,.5),cst=(Art=qs("cc.ShapeModule"),Rrt=xa(cit),brt=sa("shapeType"),Crt=xa(cit),wrt=xa(_it),xrt=xa(dit),Irt=xa(det),Art((Drt=function(){function t(){this._enable=Mrt&&Mrt(),this._shapeType=Prt&&Prt(),this.emitFrom=Brt&&Brt(),this.alignToDirection=Nrt&&Nrt(),this.randomDirectionAmount=Lrt&&Lrt(),this.sphericalDirectionAmount=Frt&&Frt(),this.randomPositionAmount=krt&&krt(),this.radius=Urt&&Urt(),this.radiusThickness=Grt&&Grt(),this.arcMode=Hrt&&Hrt(),this.arcSpread=zrt&&zrt(),this.arcSpeed=Vrt&&Vrt(),this.length=Wrt&&Wrt(),this.boxThickness=Xrt&&Xrt(),this._position=jrt&&jrt(),this._rotation=Yrt&&Yrt(),this._scale=Krt&&Krt(),this._arc=qrt&&qrt(),this._angle=Qrt&&Qrt(),this.mat=void 0,this.quat=void 0,this.particleSystem=void 0,this.lastTime=void 0,this.totalAngle=void 0,this.mat=new Dn,this.quat=new En,this.particleSystem=null,this.lastTime=0,this.totalAngle=0}var e=t.prototype;return e.onInit=function(t){this.particleSystem=t,this.constructMat(),this.lastTime=this.particleSystem._time},e.emit=function(t){switch(this.shapeType){case cit.Box:!function(t,e,i,n){switch(t){case _it.Volume:r=i,s=lst,hn.set(r,Li(-s.x,s.x),Li(-s.y,s.y),Li(-s.z,s.z));break;case _it.Shell:ust.splice(0,ust.length),ust.push(Li(-.5,.5)),ust.push(Li(-.5,.5)),ust.push(.5*Ait()),Eit(ust),_st(ust,e),hn.set(i,ust[0],ust[1],ust[2]);break;case _it.Edge:ust.splice(0,ust.length),ust.push(Li(-.5,.5)),ust.push(.5*Ait()),ust.push(.5*Ait()),Eit(ust),_st(ust,e),hn.set(i,ust[0],ust[1],ust[2]);break;default:console.warn(t+" is not supported for box emitter.")}var r,s;hn.copy(n,mit)}(this.emitFrom,this.boxThickness,t.position,t.velocity);break;case cit.Circle:!function(t,e,i,n,r){Sit(n,t*(1-e),t,i),hn.normalize(r,n)}(this.radius,this.radiusThickness,this.generateArcAngle(),t.position,t.velocity);break;case cit.Cone:!function(t,e,i,n,r,s,a,o){switch(t){case _it.Base:Sit(a,e*(1-i),e,n),Fn.multiplyScalar(o,a,Math.sin(r)),o.z=-Math.cos(r)*e,hn.normalize(o,o),a.z=0;break;case _it.Shell:vit(a,n),Fn.multiplyScalar(o,a,Math.sin(r)),o.z=-Math.cos(r),hn.normalize(o,o),Fn.multiplyScalar(a,a,e),a.z=0;break;case _it.Volume:Sit(a,e*(1-i),e,n),Fn.multiplyScalar(o,a,Math.sin(r)),o.z=-Math.cos(r)*e,hn.normalize(o,o),a.z=0,hn.add(a,a,hn.multiplyScalar(hst,o,s*Bi()/-o.z));break;default:console.warn(t+" is not supported for cone emitter.")}}(this.emitFrom,this.radius,this.radiusThickness,this.generateArcAngle(),this._angle,this.length,t.position,t.velocity);break;case cit.Sphere:!function(t,e,i,n,r){switch(t){case _it.Volume:Tit(n,e*(1-i),e),hn.normalize(r,n);break;case _it.Shell:yit(n),hn.multiplyScalar(n,n,e),hn.normalize(r,n);break;default:console.warn(t+" is not supported for sphere emitter.")}}(this.emitFrom,this.radius,this.radiusThickness,t.position,t.velocity);break;case cit.Hemisphere:!function(t,e,i,n,r){switch(t){case _it.Volume:Tit(n,e*(1-i),e),n.z>0&&(n.z*=-1),hn.normalize(r,n);break;case _it.Shell:yit(n),hn.multiplyScalar(n,n,e),n.z>0&&(n.z*=-1),hn.normalize(r,n);break;default:console.warn(t+" is not supported for hemisphere emitter.")}}(this.emitFrom,this.radius,this.radiusThickness,t.position,t.velocity);break;default:console.warn(this.shapeType+" shapeType is not supported by ShapeModule.")}if(this.randomPositionAmount>0&&(t.position.x+=Li(-this.randomPositionAmount,this.randomPositionAmount),t.position.y+=Li(-this.randomPositionAmount,this.randomPositionAmount),t.position.z+=Li(-this.randomPositionAmount,this.randomPositionAmount)),hn.transformQuat(t.velocity,t.velocity,this.quat),hn.transformMat4(t.position,t.position,this.mat),this.sphericalDirectionAmount>0){var e=hn.normalize(hst,t.position);hn.lerp(t.velocity,t.velocity,e,this.sphericalDirectionAmount)}this.lastTime=this.particleSystem._time},e.constructMat=function(){En.fromEuler(this.quat,this._rotation.x,this._rotation.y,this._rotation.z),Dn.fromRTS(this.mat,this.quat,this._position,this._scale)},e.generateArcAngle=function(){if(this.arcMode===dit.Random)return Li(0,this._arc);var t=this.totalAngle+2*Math.PI*this.arcSpeed.evaluate(this.particleSystem._time,1)*(this.particleSystem._time-this.lastTime);switch(this.totalAngle=t,0!==this.arcSpread&&(t=Math.floor(t/(this._arc*this.arcSpread))*this._arc*this.arcSpread),this.arcMode){case dit.Loop:return zi(t,this._arc);case dit.PingPong:return Vi(t,this._arc);default:return zi(t,this._arc)}},n(t,[{key:"position",get:function(){return this._position},set:function(t){this._position=t,this.constructMat()}},{key:"rotation",get:function(){return this._rotation},set:function(t){this._rotation=t,this.constructMat()}},{key:"scale",get:function(){return this._scale},set:function(t){this._scale=t,this.constructMat()}},{key:"arc",get:function(){return Pi(this._arc)},set:function(t){this._arc=Mi(t)}},{key:"angle",get:function(){return Math.round(100*Pi(this._angle))/100},set:function(t){this._angle=Mi(t)}},{key:"enable",get:function(){return this._enable},set:function(t){this._enable=t}},{key:"shapeType",get:function(){return this._shapeType},set:function(t){switch(this._shapeType=t,this._shapeType){case cit.Box:this.emitFrom===_it.Base&&(this.emitFrom=_it.Volume);break;case cit.Cone:this.emitFrom===_it.Edge&&(this.emitFrom=_it.Base);break;case cit.Sphere:case cit.Hemisphere:this.emitFrom!==_it.Base&&this.emitFrom!==_it.Edge||(this.emitFrom=_it.Volume)}}}]),t}(),Mrt=Gs(Drt.prototype,"_enable",[ra],(function(){return!1})),Prt=Gs(Drt.prototype,"_shapeType",[Rrt,brt],(function(){return cit.Cone})),f(Drt.prototype,"shapeType",[Crt],Object.getOwnPropertyDescriptor(Drt.prototype,"shapeType"),Drt.prototype),Brt=Gs(Drt.prototype,"emitFrom",[wrt,ra],(function(){return _it.Volume})),Nrt=Gs(Drt.prototype,"alignToDirection",[ra],(function(){return!1})),Lrt=Gs(Drt.prototype,"randomDirectionAmount",[ra],(function(){return 0})),Frt=Gs(Drt.prototype,"sphericalDirectionAmount",[ra],(function(){return 0})),krt=Gs(Drt.prototype,"randomPositionAmount",[ra],(function(){return 0})),Urt=Gs(Drt.prototype,"radius",[ra],(function(){return 1})),Grt=Gs(Drt.prototype,"radiusThickness",[ra],(function(){return 1})),Hrt=Gs(Drt.prototype,"arcMode",[xrt,ra],(function(){return dit.Random})),zrt=Gs(Drt.prototype,"arcSpread",[ra],(function(){return 0})),Vrt=Gs(Drt.prototype,"arcSpeed",[Irt,ra],(function(){return new det})),Wrt=Gs(Drt.prototype,"length",[ra],(function(){return 5})),Xrt=Gs(Drt.prototype,"boxThickness",[ra],(function(){return new hn(0,0,0)})),jrt=Gs(Drt.prototype,"_position",[ra],(function(){return new hn(0,0,0)})),Yrt=Gs(Drt.prototype,"_rotation",[ra],(function(){return new hn(0,0,0)})),Krt=Gs(Drt.prototype,"_scale",[ra],(function(){return new hn(1,1,1)})),qrt=Gs(Drt.prototype,"_arc",[ra],(function(){return Mi(360)})),Qrt=Gs(Drt.prototype,"_angle",[ra],(function(){return Mi(25)})),Ort=Drt))||Ort);function _st(t,e){e.x>0&&(t[0]+=.5*Li(-e.x,e.x),t[0]=Ii(t[0],-.5,.5)),e.y>0&&(t[1]+=.5*Li(-e.y,e.y),t[1]=Ii(t[1],-.5,.5)),e.z>0&&(t[2]+=.5*Li(-e.z,e.z),t[2]=Ii(t[2],-.5,.5))}var dst=[0,0,1,0,0,1,1,1],fst=[0,0,0,1,0,0,0,1,0,1,1,0],pst=function(t){function e(){var e;return(e=t.call(this)||this)._capacity=void 0,e._bufferSize=void 0,e._vertAttrs=void 0,e._vertAttribSize=void 0,e._vBuffer=void 0,e._vertAttrsFloatCount=void 0,e._vdataF32=void 0,e._vdataUint32=void 0,e._subMeshData=void 0,e._mesh=void 0,e._vertCount=0,e._indexCount=0,e._startTimeOffset=0,e._lifeTimeOffset=0,e._material=null,e._vertAttribSizeStatic=void 0,e._vertStaticAttrsFloatCount=void 0,e._insBuffers=void 0,e._insIndices=void 0,e._useInstance=void 0,e._iaVertCount=0,e._iaIndexCount=0,e.type=mB.PARTICLE_BATCH,e._capacity=0,e._bufferSize=16,e._vertAttrs=null,e._vertAttribSize=0,e._vBuffer=null,e._vertAttrsFloatCount=0,e._vdataF32=null,e._vdataUint32=null,e._vertAttribSizeStatic=0,e._vertStaticAttrsFloatCount=0,e._insBuffers=[],e._insIndices=null,wd.gfxDevice.hasFeature(Xl.INSTANCED_ARRAYS)?e._useInstance=!0:e._useInstance=!1,e._subMeshData=null,e._mesh=null,e}s(e,t);var i=e.prototype;return i.setCapacity=function(t){var e=this._capacity!==t;this._capacity=t,this._bufferSize=Math.max(this._capacity,16),this._subMeshData&&e&&this.rebuild()},i.setVertexAttributes=function(t,e){if(this._useInstance)this.setVertexAttributesIns(t,e);else{if(this._mesh===t&&this._vertAttrs===e)return;this._mesh=t,this._vertAttrs=e,this._vertAttribSize=0;for(var i,n=d(this._vertAttrs);!(i=n()).done;){var r=i.value;r.offset=this._vertAttribSize,this._vertAttribSize+=F_[r.format].size}this._vertAttrsFloatCount=this._vertAttribSize/4,this.rebuild()}},i.setVertexAttributesIns=function(t,e){if(this._mesh!==t||this._vertAttrs!==e){this._mesh=t,this._vertAttrs=e,this._vertAttribSize=0,this._vertAttribSizeStatic=0;for(var i,n=d(this._vertAttrs);!(i=n()).done;){var r=i.value;0===r.stream?(r.offset=this._vertAttribSize,this._vertAttribSize+=F_[r.format].size):1===r.stream&&(r.offset=this._vertAttribSizeStatic,this._vertAttribSizeStatic+=F_[r.format].size)}this._vertAttrsFloatCount=this._vertAttribSize/4,this._vertStaticAttrsFloatCount=this._vertAttribSizeStatic/4,this.rebuild()}},i.createSubMeshData=function(){this.destroySubMeshData(),this._vertCount=4,this._indexCount=6,this._mesh&&(this._vertCount=this._mesh.struct.vertexBundles[this._mesh.struct.primitives[0].vertexBundelIndices[0]].view.count,this._indexCount=this._mesh.struct.primitives[0].indexView.count);var t=this._device.createBuffer(new qc(ql.VERTEX|ql.TRANSFER_DST,Jl.HOST|Jl.DEVICE,this._vertAttribSize*this._bufferSize*this._vertCount,this._vertAttribSize)),e=new ArrayBuffer(this._vertAttribSize*this._bufferSize*this._vertCount);if(this._mesh&&this._capacity>0){var i=this._vertAttrs[this._vertAttrs.findIndex((function(t){return t.name===Mc.ATTR_TEX_COORD}))].offset;this._mesh.copyAttribute(0,Mc.ATTR_TEX_COORD,e,this._vertAttribSize,i);var n=this._vertAttrs.findIndex((function(t){return t.name===Mc.ATTR_TEX_COORD3}));if(i=this._vertAttrs[n++].offset,this._mesh.copyAttribute(0,Mc.ATTR_POSITION,e,this._vertAttribSize,i),i=this._vertAttrs[n++].offset,this._mesh.copyAttribute(0,Mc.ATTR_NORMAL,e,this._vertAttribSize,i),i=this._vertAttrs[n++].offset,!this._mesh.copyAttribute(0,Mc.ATTR_COLOR,e,this._vertAttribSize,i))for(var r=new Uint32Array(e),s=0;s<this._vertCount;++s)r[s*this._vertAttrsFloatCount+i/4]=pn.WHITE._val;for(var a=new Float32Array(e),o=1;o<this._capacity;o++)a.copyWithin(o*this._vertAttribSize*this._vertCount/4,0,this._vertAttribSize*this._vertCount/4)}t.update(e);var h=new Uint16Array(this._bufferSize*this._indexCount);if(this._mesh&&this._capacity>0){this._mesh.copyIndices(0,h);for(var u=1;u<this._capacity;u++)for(var l=0;l<this._indexCount;l++)h[u*this._indexCount+l]=h[l]+u*this._vertCount}else for(var c=0,_=0;_<this._capacity;++_){var d=4*_;h[c++]=d,h[c++]=d+1,h[c++]=d+2,h[c++]=d+3,h[c++]=d+2,h[c++]=d+1}var f=this._device.createBuffer(new qc(ql.INDEX|ql.TRANSFER_DST,Jl.DEVICE,this._bufferSize*this._indexCount*Uint16Array.BYTES_PER_ELEMENT,Uint16Array.BYTES_PER_ELEMENT));return f.update(h),this._iaVertCount=this._capacity*this._vertCount,this._iaIndexCount=this._capacity*this._indexCount,this._subMeshData=new Lx([t],this._vertAttrs,vc.TRIANGLE_LIST,f),this.initSubModel(0,this._subMeshData,this._material),e},i.createSubMeshDataInsDynamic=function(){this._insBuffers.length=0,this.destroySubMeshData();var t=this._device.createBuffer(new qc(ql.VERTEX|ql.TRANSFER_DST,Jl.HOST|Jl.DEVICE,this._vertAttribSize*this._bufferSize,this._vertAttribSize)),e=new ArrayBuffer(this._vertAttribSize*this._bufferSize);return t.update(e),this._insBuffers.push(t),e},i.createSubMeshDataInsStatic=function(){this._vertCount=4,this._indexCount=6,this._mesh&&(this._vertCount=this._mesh.struct.vertexBundles[this._mesh.struct.primitives[0].vertexBundelIndices[0]].view.count,this._indexCount=this._mesh.struct.primitives[0].indexView.count);var t=this._device.createBuffer(new qc(ql.VERTEX|ql.TRANSFER_DST,Jl.HOST|Jl.DEVICE,this._vertAttribSizeStatic*this._vertCount,this._vertAttribSizeStatic)),e=new ArrayBuffer(this._vertAttribSizeStatic*this._vertCount);if(this._mesh){var i=this._vertAttrs.findIndex((function(t){return t.name===Mc.ATTR_TEX_COORD})),n=this._vertAttrs[i].offset;if(this._mesh.copyAttribute(0,Mc.ATTR_TEX_COORD,e,this._vertAttribSizeStatic,n),i=this._vertAttrs.findIndex((function(t){return t.name===Mc.ATTR_TEX_COORD3})),n=this._vertAttrs[i++].offset,this._mesh.copyAttribute(0,Mc.ATTR_POSITION,e,this._vertAttribSizeStatic,n),n=this._vertAttrs[i++].offset,this._mesh.copyAttribute(0,Mc.ATTR_NORMAL,e,this._vertAttribSizeStatic,n),n=this._vertAttrs[i++].offset,!this._mesh.copyAttribute(0,Mc.ATTR_COLOR,e,this._vertAttribSizeStatic,n))for(var r=new Uint32Array(e),s=0;s<this._vertCount;++s)r[s*this._vertStaticAttrsFloatCount+n/4]=pn.WHITE._val}else for(var a=new Float32Array(e),o=0;o<fst.length;++o)a[o]=fst[o];t.update(e);var h=new Uint16Array(this._indexCount);this._mesh?this._mesh.copyIndices(0,h):(h[0]=0,h[1]=1,h[2]=2,h[3]=3,h[4]=2,h[5]=1);var u=this._device.createBuffer(new qc(ql.INDEX|ql.TRANSFER_DST,Jl.DEVICE,this._indexCount*Uint16Array.BYTES_PER_ELEMENT,Uint16Array.BYTES_PER_ELEMENT));u.update(h),this._insIndices=u,this._iaVertCount=this._vertCount,this._iaIndexCount=this._indexCount,this._insBuffers.push(t)},i.createInsSubmesh=function(){this._subMeshData=new Lx(this._insBuffers,this._vertAttrs,vc.TRIANGLE_LIST,this._insIndices),this.initSubModel(0,this._subMeshData,this._material)},i.updateMaterial=function(t){this._material=t,this.setSubModelMaterial(0,t)},i.addParticleVertexData=function(t,e){if(this._useInstance)this.addParticleVertexDataIns(t,e);else if(this._mesh)for(var i=0;i<this._vertCount;i++){var n=(t*this._vertCount+i)*this._vertAttrsFloatCount;this._vdataF32[n++]=e.position.x,this._vdataF32[n++]=e.position.y,this._vdataF32[n++]=e.position.z,n+=2,this._vdataF32[n++]=e.texcoord.z,this._vdataF32[n++]=e.size.x,this._vdataF32[n++]=e.size.y,this._vdataF32[n++]=e.size.z,this._vdataF32[n++]=e.rotation.x,this._vdataF32[n++]=e.rotation.y,this._vdataF32[n++]=e.rotation.z,this._vdataUint32[n++]=e.color}else{var r=t*this._vertAttrsFloatCount;this._vdataF32[r++]=e.position.x,this._vdataF32[r++]=e.position.y,this._vdataF32[r++]=e.position.z,this._vdataF32[r++]=e.texcoord.x,this._vdataF32[r++]=e.texcoord.y,this._vdataF32[r++]=e.texcoord.z,this._vdataF32[r++]=e.size.x,this._vdataF32[r++]=e.size.y,this._vdataF32[r++]=e.size.z,this._vdataF32[r++]=e.rotation.x,this._vdataF32[r++]=e.rotation.y,this._vdataF32[r++]=e.rotation.z,this._vdataUint32[r++]=e.color,e.velocity&&(this._vdataF32[r++]=e.velocity.x,this._vdataF32[r++]=e.velocity.y,this._vdataF32[r++]=e.velocity.z)}},i.addParticleVertexDataIns=function(t,e){var i=t*this._vertAttrsFloatCount;this._mesh?(this._vdataF32[i++]=e.position.x,this._vdataF32[i++]=e.position.y,this._vdataF32[i++]=e.position.z,this._vdataF32[i++]=e.texcoord.z,this._vdataF32[i++]=e.size.x,this._vdataF32[i++]=e.size.y,this._vdataF32[i++]=e.size.z,this._vdataF32[i++]=e.rotation.x,this._vdataF32[i++]=e.rotation.y,this._vdataF32[i++]=e.rotation.z,this._vdataUint32[i++]=e.color):(this._vdataF32[i++]=e.position.x,this._vdataF32[i++]=e.position.y,this._vdataF32[i++]=e.position.z,this._vdataF32[i++]=e.texcoord.z,this._vdataF32[i++]=e.size.x,this._vdataF32[i++]=e.size.y,this._vdataF32[i++]=e.size.z,this._vdataF32[i++]=e.rotation.x,this._vdataF32[i++]=e.rotation.y,this._vdataF32[i++]=e.rotation.z,this._vdataUint32[i++]=e.color,e.velocity&&(this._vdataF32[i++]=e.velocity.x,this._vdataF32[i++]=e.velocity.y,this._vdataF32[i++]=e.velocity.z))},i.addGPUParticleVertexData=function(t,e,i){if(this._useInstance)this.addGPUParticleVertexDataIns(t,e,i);else for(var n=e*this._vertAttrsFloatCount*this._vertCount,r=0;r<this._vertCount;r++){var s=n;this._vdataF32[s++]=t.position.x,this._vdataF32[s++]=t.position.y,this._vdataF32[s++]=t.position.z,this._vdataF32[s++]=i,this._vdataF32[s++]=t.startSize.x,this._vdataF32[s++]=t.startSize.y,this._vdataF32[s++]=t.startSize.z,this._vdataF32[s++]=dst[2*r],this._vdataF32[s++]=t.rotation.x,this._vdataF32[s++]=t.rotation.y,this._vdataF32[s++]=t.rotation.z,this._vdataF32[s++]=dst[2*r+1],this._vdataF32[s++]=t.startColor.r/255,this._vdataF32[s++]=t.startColor.g/255,this._vdataF32[s++]=t.startColor.b/255,this._vdataF32[s++]=t.startColor.a/255,this._vdataF32[s++]=t.velocity.x,this._vdataF32[s++]=t.velocity.y,this._vdataF32[s++]=t.velocity.z,this._vdataF32[s++]=t.startLifetime,this._vdataF32[s++]=t.randomSeed,n+=this._vertAttrsFloatCount}},i.addGPUParticleVertexDataIns=function(t,e,i){var n=e*this._vertAttrsFloatCount,r=n;this._vdataF32[r++]=t.position.x,this._vdataF32[r++]=t.position.y,this._vdataF32[r++]=t.position.z,this._vdataF32[r++]=i,this._vdataF32[r++]=t.startSize.x,this._vdataF32[r++]=t.startSize.y,this._vdataF32[r++]=t.startSize.z,this._vdataF32[r++]=t.frameIndex,this._vdataF32[r++]=t.rotation.x,this._vdataF32[r++]=t.rotation.y,this._vdataF32[r++]=t.rotation.z,this._vdataF32[r++]=t.startColor.r/255,this._vdataF32[r++]=t.startColor.g/255,this._vdataF32[r++]=t.startColor.b/255,this._vdataF32[r++]=t.startColor.a/255,this._vdataF32[r++]=t.velocity.x,this._vdataF32[r++]=t.velocity.y,this._vdataF32[r++]=t.velocity.z,this._vdataF32[r++]=t.startLifetime,this._vdataF32[r++]=t.randomSeed,n+=this._vertAttrsFloatCount},i.updateGPUParticles=function(t,e,i){if(this._useInstance)return this.updateGPUParticlesIns(t,e,i);for(var n=this._vertAttrsFloatCount*this._vertCount,r=0,s=0,a=0,o=0;o<t;++o)r=o*n,s=this._vdataF32[r+this._startTimeOffset],this._vdataF32[r+this._lifeTimeOffset]-(e-s)<i&&(a=--t*n,this._vdataF32.copyWithin(r,a,a+n),o--);return t},i.updateGPUParticlesIns=function(t,e,i){for(var n=this._vertAttrsFloatCount,r=0,s=0,a=0,o=0;o<t;++o)r=o*n,s=this._vdataF32[r+this._startTimeOffset],this._vdataF32[r+this._lifeTimeOffset]-(e-s)<i&&(a=--t*n,this._vdataF32.copyWithin(r,a,a+n),o--);return t},i.constructAttributeIndex=function(){if(this._vertAttrs){var t=this._vertAttrs.findIndex((function(t){return"a_position_starttime"===t.name})),e=this._vertAttrs[t].offset;this._startTimeOffset=e/4+3,t=this._vertAttrs.findIndex((function(t){return"a_dir_life"===t.name})),e=this._vertAttrs[t].offset,this._lifeTimeOffset=e/4+3}},i.updateIA=function(t){if(this._useInstance)this.updateIAIns(t);else{if(t<=0)return;var e=this._subModels[0].inputAssembler;e.vertexBuffers[0].update(this._vdataF32),e.firstIndex=0,e.indexCount=this._indexCount*t,e.vertexCount=this._iaVertCount}},i.updateIAIns=function(t){if(!(t<=0)){var e=this._subModels[0].inputAssembler;e.vertexBuffers[0].update(this._vdataF32),e.instanceCount=t,e.firstIndex=0,e.indexCount=this._indexCount,e.instanceCount=t,e.vertexCount=this._iaVertCount}},i.clear=function(){this._useInstance?this.clearIns():this._subModels[0].inputAssembler.indexCount=0},i.clearIns=function(){this._subModels[0].inputAssembler.instanceCount=0},i.destroy=function(){t.prototype.destroy.call(this),this.doDestroy()},i.doDestroy=function(){this._vBuffer=null,this._vdataF32=null,this._vdataUint32=null,this._insBuffers=[],this._insIndices=null,this._vertAttrs=null,this._material=null,this._mesh=null,this.destroySubMeshData()},i.rebuild=function(){this._useInstance?this.rebuildIns():(this._vBuffer=this.createSubMeshData(),this._vdataF32=new Float32Array(this._vBuffer),this._vdataUint32=new Uint32Array(this._vBuffer))},i.rebuildIns=function(){this._vBuffer=this.createSubMeshDataInsDynamic(),this._vdataF32=new Float32Array(this._vBuffer),this._vdataUint32=new Uint32Array(this._vBuffer),this.createSubMeshDataInsStatic(),this.createInsSubmesh()},i.destroySubMeshData=function(){this._subMeshData&&(this._subMeshData.destroy(),this._subMeshData=null)},n(e,[{key:"useInstance",get:function(){return this._useInstance},set:function(t){this._useInstance!==t&&(this._useInstance=t)}}]),e}(IB),mst=function(){function t(t){this._particleSystem=null,this._model=null,this._renderInfo=null,this._vertAttrs=[],this._useInstance=void 0,this._renderInfo=t,wd.gfxDevice.hasFeature(Xl.INSTANCED_ARRAYS)?this._useInstance=!0:this._useInstance=!1}var e=t.prototype;return e.getUseInstance=function(){return this._useInstance},e.getInfo=function(){return this._renderInfo},e.onInit=function(t){this._particleSystem=t},e.onEnable=function(){if(this._particleSystem){this.attachToScene();var t=this._model;t&&(t.node=t.transform=this._particleSystem.node)}},e.onDisable=function(){this.detachFromScene()},e.onDestroy=function(){this._model&&(v.director.root.destroyModel(this._model),this._model=null)},e.attachToScene=function(){var t;this._model&&(this._model.scene&&this.detachFromScene(),null===(t=this._particleSystem)||void 0===t||t._getRenderScene().addModel(this._model))},e.detachFromScene=function(){this._model&&this._model.scene&&this._model.scene.removeModel(this._model)},e.setVertexAttributes=function(){this._model&&(this.updateVertexAttrib(),this._model.setVertexAttributes(this._renderInfo.renderMode===lit.Mesh?this._renderInfo.mesh:null,this._vertAttrs))},e.clear=function(){this._model&&(this._model.enabled=!1)},e.getModel=function(){return this._model},e._initModel=function(){!this._model&&this._particleSystem&&(this._model=v.director.root.createModel(pst),this._model.setCapacity(this._particleSystem.capacity),this._model.visFlags=this._particleSystem.visibility)},e.updateTrailMaterial=function(){},e.getDefaultTrailMaterial=function(){return null},n(t,[{key:"model",get:function(){return this._model}}]),t}(),gst=function(){function t(t){this.permutation=[151,160,137,91,90,15,131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23,190,6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33,88,237,149,56,87,174,20,125,136,171,168,68,175,74,165,71,134,139,48,27,166,77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244,102,143,54,65,25,63,161,1,216,80,73,209,76,132,187,208,89,18,169,200,196,135,130,116,188,159,86,164,100,109,198,173,186,3,64,52,217,226,250,124,123,5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42,223,183,170,213,119,248,152,2,44,154,163,70,221,153,101,155,167,43,172,9,129,22,39,253,19,98,108,110,79,113,224,232,178,185,112,104,218,246,97,228,251,34,242,193,238,210,144,12,191,179,162,241,81,51,145,235,249,14,239,107,49,192,214,31,181,199,106,157,184,84,204,176,115,121,50,45,127,4,150,254,138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180],this.accSpeed=new hn,this.noiseSpeed=new hn,this.noiseFrequency=0,this.noiseAbs=new hn,this.noiseAmplitude=new hn,this.octaves=new hn,this.dt=0,this.point=new hn,this.result=new hn,this.mixOut=new Fn,t&&(this.permutation=t)}var e=t.prototype;return e.noise=function(t,e,i,n,r){void 0===n&&(n=0),void 0===r&&(r=1);for(var s=new Array(512),a=0;a<256;a++)s[256+a]=s[a]=this.permutation[a];var o=255&Math.floor(t),h=255&Math.floor(e),u=255&Math.floor(i);t-=Math.floor(t),e-=Math.floor(e),i-=Math.floor(i);var l=this.fade(t),c=this.fade(e),_=this.fade(i),d=s[o]+h,f=s[d]+u,p=s[d+1]+u,m=s[o+1]+h,g=s[m]+u,v=s[m+1]+u;return n+this.scale(this.lerp(_,this.lerp(c,this.lerp(l,this.grad(s[f],t,e,i),this.grad(s[g],t-1,e,i)),this.lerp(l,this.grad(s[p],t,e-1,i),this.grad(s[v],t-1,e-1,i))),this.lerp(c,this.lerp(l,this.grad(s[f+1],t,e,i-1),this.grad(s[g+1],t-1,e,i-1)),this.lerp(l,this.grad(s[p+1],t,e-1,i-1),this.grad(s[v+1],t-1,e-1,i-1)))))*(r-n)},e.fade=function(t){return t*t*t*(t*(6*t-15)+10)},e.lerp=function(t,e,i){return e+t*(i-e)},e.grad=function(t,e,i,n){var r=15&t,s=r<8?e:i,a=r<4?i:12===r||14===r?e:n;return(0==(1&r)?s:-s)+(0==(2&r)?a:-a)},e.scale=function(t){return(1+t)/2},e.setSpeed=function(t,e,i){this.noiseSpeed.set(t,e,i)},e.setFrequency=function(t){this.noiseFrequency=t},e.setAbs=function(t,e,i){this.noiseAbs.set(t,e,i)},e.setAmplititude=function(t,e,i){this.noiseAmplitude.set(t,e,i)},e.setOctaves=function(t,e,i){this.octaves.set(t,e,i)},e.setTime=function(t){this.dt=t},e.setSamplePoint=function(t){this.point.set(t)},e.getResult=function(){return this.result},e.getNoise=function(t,e,i,n,r,s,a){var o=s,h=0;if(h+=this.noise(t*o,e*o,i*o,-1,1),1===a.x)return h;for(var u=1,l=1,c=1;c<a.x;++c)u*=a.y,o*=a.z,l+=u,h+=this.noise(t*o,e*o,i*o,-1,1)*u;return h/l},e.getNoiseMix=function(t,e,i,n,r,s){t.x=this.getNoise(e.x,e.y,e.z,i,n,r,s),t.y=this.getNoise(e.y,e.z,e.x,i,n,r,s)},e.getNoiseParticle=function(){this.accSpeed.set(this.noiseSpeed.x*this.dt,this.noiseSpeed.y*this.dt,this.noiseSpeed.z*this.dt);var t=this.getNoise(this.point.z+this.accSpeed.x,this.point.y,this.point.x,this.dt,this.accSpeed,this.noiseFrequency,this.octaves),e=this.getNoise(this.point.x+1e3,this.point.z+this.accSpeed.y,this.point.y,this.dt,this.accSpeed,this.noiseFrequency,this.octaves),i=this.getNoise(this.point.y,this.point.x+1e3,this.point.z+this.accSpeed.z,this.dt,this.accSpeed,this.noiseFrequency,this.octaves);this.result.set(t*this.noiseAmplitude.x,e*this.noiseAmplitude.y,i*this.noiseAmplitude.z)},e.getPreview=function(t,e,i){for(var n=0;n<i;++n)for(var r=0;r<e;++r){var s=(r-.5*e)/e+this.noiseSpeed.x*this.dt,a=(n-.5*i)/i+this.noiseSpeed.y*this.dt,o=this.getNoise(s,a,0,this.dt,this.accSpeed,this.noiseFrequency,this.octaves);t[n*e+r]=.5*(o+1)}},t}(),vst=new nn,yst=new hn,Tst=new Dn,Sst=new Dn,Est=new En;new hn;var Ast=["_colorOverLifetimeModule","_sizeOvertimeModule","_velocityOvertimeModule","_forceOvertimeModule","_limitVelocityOvertimeModule","_rotationOvertimeModule","_textureAnimationModule","_noiseModule"],Rst=[0,0,1,0,0,1,1,1],bst=[new __(Mc.ATTR_POSITION,jl.RGB32F),new __(Mc.ATTR_TEX_COORD,jl.RGB32F),new __(Mc.ATTR_TEX_COORD1,jl.RGB32F),new __(Mc.ATTR_TEX_COORD2,jl.RGB32F),new __(Mc.ATTR_COLOR,jl.RGBA8,!0)],Cst=[new __(Mc.ATTR_POSITION,jl.RGB32F),new __(Mc.ATTR_TEX_COORD,jl.RGB32F),new __(Mc.ATTR_TEX_COORD1,jl.RGB32F),new __(Mc.ATTR_TEX_COORD2,jl.RGB32F),new __(Mc.ATTR_COLOR,jl.RGBA8,!0),new __(Mc.ATTR_COLOR1,jl.RGB32F)],wst=[new __(Mc.ATTR_POSITION,jl.RGB32F),new __(Mc.ATTR_TEX_COORD,jl.RGB32F),new __(Mc.ATTR_TEX_COORD1,jl.RGB32F),new __(Mc.ATTR_TEX_COORD2,jl.RGB32F),new __(Mc.ATTR_COLOR,jl.RGBA8,!0),new __(Mc.ATTR_TEX_COORD3,jl.RGB32F),new __(Mc.ATTR_NORMAL,jl.RGB32F),new __(Mc.ATTR_COLOR1,jl.RGBA8,!0)],xst=[new __(Mc.ATTR_TEX_COORD4,jl.RGBA32F,!1,0,!0),new __(Mc.ATTR_TEX_COORD1,jl.RGB32F,!1,0,!0),new __(Mc.ATTR_TEX_COORD2,jl.RGB32F,!1,0,!0),new __(Mc.ATTR_COLOR,jl.RGBA8,!0,0,!0),new __(Mc.ATTR_TEX_COORD,jl.RGB32F,!1,1)],Ist=[new __(Mc.ATTR_TEX_COORD4,jl.RGBA32F,!1,0,!0),new __(Mc.ATTR_TEX_COORD1,jl.RGB32F,!1,0,!0),new __(Mc.ATTR_TEX_COORD2,jl.RGB32F,!1,0,!0),new __(Mc.ATTR_COLOR,jl.RGBA8,!0,0,!0),new __(Mc.ATTR_COLOR1,jl.RGB32F,!1,0,!0),new __(Mc.ATTR_TEX_COORD,jl.RGB32F,!1,1)],Ost=[new __(Mc.ATTR_TEX_COORD4,jl.RGBA32F,!1,0,!0),new __(Mc.ATTR_TEX_COORD1,jl.RGB32F,!1,0,!0),new __(Mc.ATTR_TEX_COORD2,jl.RGB32F,!1,0,!0),new __(Mc.ATTR_COLOR,jl.RGBA8,!0,0,!0),new __(Mc.ATTR_TEX_COORD,jl.RGB32F,!1,1),new __(Mc.ATTR_TEX_COORD3,jl.RGB32F,!1,1),new __(Mc.ATTR_NORMAL,jl.RGB32F,!1,1),new __(Mc.ATTR_COLOR1,jl.RGBA8,!0,1)],Dst={parent:null,owner:null,subModelIdx:0},Mst=function(){this.position=void 0,this.texcoord=void 0,this.size=void 0,this.rotation=void 0,this.color=void 0,this.velocity=void 0,this.position=new hn,this.texcoord=new hn,this.size=new hn,this.rotation=new hn,this.color=0,this.velocity=null},Pst=function(t){function e(e){var i;return(i=t.call(this,e)||this)._defines=void 0,i._trailDefines=void 0,i._frameTile_velLenScale=void 0,i._tmp_velLenScale=void 0,i._defaultMat=null,i._node_scale=void 0,i._particleVertexData=void 0,i._particles=null,i._defaultTrailMat=null,i._updateList=new Map,i._animateList=new Map,i._runAnimateList=new Array,i._fillDataFunc=null,i._uScaleHandle=0,i._uLenHandle=0,i._uNodeRotHandle=0,i._alignSpace=uit.View,i._inited=!1,i._localMat=new Dn,i._gravity=new nn,i.noise=new gst,i._model=null,i._frameTile_velLenScale=new nn(1,1,0,0),i._tmp_velLenScale=i._frameTile_velLenScale.clone(),i._node_scale=new hn,i._particleVertexData=new Mst,i._defines={CC_USE_WORLD_SPACE:!0,CC_USE_BILLBOARD:!0,CC_USE_STRETCHED_BILLBOARD:!1,CC_USE_HORIZONTAL_BILLBOARD:!1,CC_USE_VERTICAL_BILLBOARD:!1},i._trailDefines={CC_USE_WORLD_SPACE:!0},i}s(e,t);var i=e.prototype;return i.onInit=function(e){var i=this;t.prototype.onInit.call(this,e),this._particles=new Bu((function(){return new jet(i)}),16),this._setVertexAttrib(),this._setFillFunc(),this._initModuleList(),this._initModel(),this.updateMaterialParams(),this.updateTrailMaterial(),this.setVertexAttributes(),this._inited=!0},i.clear=function(){t.prototype.clear.call(this),this._particles.reset(),this._particleSystem&&this._particleSystem._trailModule&&this._particleSystem._trailModule.clear(),this.updateRenderData(),this._model.enabled=!1},i.updateRenderMode=function(){this._setVertexAttrib(),this._setFillFunc(),this.updateMaterialParams(),this.setVertexAttributes()},i.onDestroy=function(){var e;null===(e=this._particles)||void 0===e||e.destroy(),t.prototype.onDestroy.call(this)},i.getFreeParticle=function(){return this._particleSystem&&this._particles.length>=this._particleSystem.capacity?null:this._particles.add()},i.getDefaultTrailMaterial=function(){return this._defaultTrailMat},i.setNewParticle=function(){},i._initModuleList=function(){var t=this;Ast.forEach((function(e){if(t._particleSystem){var i=t._particleSystem[e];i&&i.enable&&(i.needUpdate&&(t._updateList[i.name]=i),i.needAnimate&&(t._animateList[i.name]=i))}})),this._runAnimateList.length=0;for(var e=0,i=rit.length;e<i;e++){var n=this._animateList[rit[e]];n&&this._runAnimateList.push(n)}},i.enableModule=function(t,e,i){e?(i.needUpdate&&(this._updateList[i.name]=i),i.needAnimate&&(this._animateList[i.name]=i)):(delete this._animateList[t],delete this._updateList[t]),this._runAnimateList.length=0;for(var n=0,r=rit.length;n<r;n++){var s=this._animateList[rit[n]];s&&this._runAnimateList.push(s)}this.updateMaterialParams()},i.updateAlignSpace=function(t){this._alignSpace=t},i.getDefaultMaterial=function(){return this._defaultMat},i.updateRotation=function(t){t&&this.doUpdateRotation(t)},i.doUpdateRotation=function(t){if(this._renderInfo.renderMode===lit.Mesh||this._alignSpace!==uit.View){var e;if(this._alignSpace===uit.Local)null===(e=this._particleSystem)||void 0===e||e.node.getRotation(Est);else if(this._alignSpace===uit.World){var i;null===(i=this._particleSystem)||void 0===i||i.node.getWorldRotation(Est)}else if(this._alignSpace===uit.View){var n,r;Est.set(0,0,0,1);var s=null===(n=this._particleSystem)||void 0===n||null===(r=n.node.scene.renderScene)||void 0===r?void 0:r.cameras;if(void 0!==s)for(var a=0;a<(null==s?void 0:s.length);++a){var o=s[a];if((o.visibility&this._particleSystem.node.layer)===this._particleSystem.node.layer){En.fromViewUp(Est,o.forward);break}}}else Est.set(0,0,0,1);t.setUniform(this._uNodeRotHandle,Est)}},i.updateScale=function(t){t&&this.doUpdateScale(t)},i.doUpdateScale=function(t){var e,i,n,r=this._node_scale;switch(null===(e=this._particleSystem)||void 0===e?void 0:e.scaleSpace){case oit.Local:null===(i=this._particleSystem)||void 0===i||i.node.getScale(r);break;case oit.World:null===(n=this._particleSystem)||void 0===n||n.node.getWorldScale(r)}t.setUniform(this._uScaleHandle,vst.set(r.x,r.y,r.z))},i.updateParticles=function(t){var e=this,i=this._particleSystem;if(!i)return this._particles.length;i.node.getWorldMatrix(Tst);var n=(i.getMaterialInstance(0)||this._defaultMat).passes[0];this.doUpdateScale(n),this.doUpdateRotation(n),this._updateList.forEach((function(t){t.update(i.simulationSpace,Tst)}));var r=i._trailModule,s=r&&r.enable;s&&r.update();var a=!i.gravityModifier.isZero();if(a){if(i.simulationSpace===oit.Local){var o=i.node.getRotation();Dn.fromQuat(this._localMat,o),this._localMat.transpose()}if(i.node.parent){var h=i.node.parent.getWorldRotation();Dn.fromQuat(Sst,h),Sst.transpose()}}for(var u=function(n){var o=e._particles.data[n];if(o.remainingLifetime-=t,hn.set(o.animatedVelocity,0,0,0),o.remainingLifetime<0)return s&&r.removeParticle(o),e._particles.removeAt(n),--n,l=n,1;if(a){var h=Rit(i.gravityModifier)?ki(o.randomSeed):0;if(i.simulationSpace===oit.Local){var u=1-o.remainingLifetime/o.startLifetime,c=9.8*-i.gravityModifier.evaluate(u,h)*t;e._gravity.x=0,e._gravity.y=c,e._gravity.z=0,e._gravity.w=1,xi(c,0,Ci)||(i.node.parent&&(e._gravity=e._gravity.transformMat4(Sst)),e._gravity=e._gravity.transformMat4(e._localMat),o.velocity.x+=e._gravity.x,o.velocity.y+=e._gravity.y,o.velocity.z+=e._gravity.z)}else o.velocity.y-=9.8*i.gravityModifier.evaluate(1-o.remainingLifetime/o.startLifetime,h)*t}hn.copy(o.ultimateVelocity,o.velocity),e._runAnimateList.forEach((function(e){e.animate(o,t)})),hn.scaleAndAdd(o.position,o.position,o.ultimateVelocity,t),s&&r.animate(o,t),l=n},l=0;l<this._particles.length;++l)u(l);return this._model.enabled=this._particles.length>0,this._particles.length},i.getNoisePreview=function(t,e,i){var n=this;this._runAnimateList.forEach((function(r){r.name===nit&&r.getNoisePreview(t,n._particleSystem,e,i)}))},i.updateRenderData=function(){for(var t=0,e=0;e<this._particles.length;++e){var i=this._particles.data[e],n=0,r=this._particleSystem._textureAnimationModule;r&&r.enable&&(n=i.frameIndex),t=4*e,this._fillDataFunc(i,t,n)}},i.beforeRender=function(){this._model.updateIA(this._particles.length)},i.getParticleCount=function(){return this._particles.length},i.onMaterialModified=function(t){this._inited&&(0===t?this.updateMaterialParams():this.updateTrailMaterial())},i.onRebuildPSO=function(t,e){this._model&&0===t&&this._model.setSubModelMaterial(0,e);var i=this._particleSystem._trailModule,n=null==i?void 0:i.getModel();n&&1===t&&n.setSubModelMaterial(0,e)},i._setFillFunc=function(){this._renderInfo.renderMode===lit.Mesh?this._fillDataFunc=this._fillMeshData:this._renderInfo.renderMode===lit.StrecthedBillboard?this._fillDataFunc=this._fillStrecthedData:this._fillDataFunc=this._fillNormalData},i._fillMeshData=function(t,e,i){var n=e/4;hn.copy(this._particleVertexData.position,t.position),yst.z=i,hn.copy(this._particleVertexData.texcoord,yst),hn.copy(this._particleVertexData.size,t.size),hn.copy(this._particleVertexData.rotation,t.rotation),this._particleVertexData.color=t.color._val,this._model.addParticleVertexData(n,this._particleVertexData)},i._fillStrecthedData=function(t,e,i){if(this._useInstance)this._fillStrecthedDataIns(t,e,i);else for(var n=0;n<4;++n)hn.copy(this._particleVertexData.position,t.position),yst.x=Rst[2*n],yst.y=Rst[2*n+1],yst.z=i,hn.copy(this._particleVertexData.texcoord,yst),hn.copy(this._particleVertexData.size,t.size),hn.copy(this._particleVertexData.rotation,t.rotation),this._particleVertexData.color=t.color._val,this._particleVertexData.velocity=t.ultimateVelocity,this._model.addParticleVertexData(e++,this._particleVertexData)},i._fillStrecthedDataIns=function(t,e,i){var n=e/4;hn.copy(this._particleVertexData.position,t.position),yst.z=i,hn.copy(this._particleVertexData.texcoord,yst),hn.copy(this._particleVertexData.size,t.size),hn.copy(this._particleVertexData.rotation,t.rotation),this._particleVertexData.color=t.color._val,this._particleVertexData.velocity=t.ultimateVelocity,this._model.addParticleVertexData(n,this._particleVertexData)},i._fillNormalData=function(t,e,i){if(this._useInstance)this._fillNormalDataIns(t,e,i);else for(var n=0;n<4;++n)hn.copy(this._particleVertexData.position,t.position),yst.x=Rst[2*n],yst.y=Rst[2*n+1],yst.z=i,hn.copy(this._particleVertexData.texcoord,yst),hn.copy(this._particleVertexData.size,t.size),hn.copy(this._particleVertexData.rotation,t.rotation),this._particleVertexData.color=t.color._val,this._model.addParticleVertexData(e++,this._particleVertexData)},i._fillNormalDataIns=function(t,e,i){var n=e/4;hn.copy(this._particleVertexData.position,t.position),yst.z=i,hn.copy(this._particleVertexData.texcoord,yst),hn.copy(this._particleVertexData.size,t.size),hn.copy(this._particleVertexData.rotation,t.rotation),this._particleVertexData.color=t.color._val,this._model.addParticleVertexData(n,this._particleVertexData)},i.updateVertexAttrib=function(){if(this._renderInfo.renderMode===lit.Mesh&&this._renderInfo.mesh){var t=this._renderInfo.mesh.readAttributeFormat(0,Mc.ATTR_COLOR);if(t){for(var e=jl.RGBA8,i=0;i<F_.length;++i)if(F_[i].name===t.name){e=i;break}this._vertAttrs[7]=new __(Mc.ATTR_COLOR1,e,!0,this._useInstance?1:0)}else{var n=jl.RGBA8;this._vertAttrs[7]=new __(Mc.ATTR_COLOR1,n,!0,this._useInstance?1:0)}}},i._setVertexAttrib=function(){if(this._useInstance)this._setVertexAttribIns();else switch(this._renderInfo.renderMode){case lit.StrecthedBillboard:this._vertAttrs=Cst.slice();break;case lit.Mesh:this._vertAttrs=wst.slice();break;default:this._vertAttrs=bst.slice()}},i._setVertexAttribIns=function(){switch(this._renderInfo.renderMode){case lit.StrecthedBillboard:this._vertAttrs=Ist.slice();break;case lit.Mesh:this._vertAttrs=Ost.slice();break;default:this._vertAttrs=xst.slice()}},i.updateMaterialParams=function(){if(this._particleSystem){var t=this._particleSystem,e=t.sharedMaterial;null!=e&&(this._renderInfo.mainTexture=e.getProperty("mainTexture",0)),null==t.sharedMaterial&&null==this._defaultMat&&(Dst.parent=aS.get("default-particle-material"),Dst.owner=this._particleSystem,Dst.subModelIdx=0,this._defaultMat=new US(Dst),Dst.parent=null,Dst.owner=null,Dst.subModelIdx=0,null!==this._renderInfo.mainTexture&&this._defaultMat.setProperty("mainTexture",this._renderInfo.mainTexture));var i=t.getMaterialInstance(0)||this._defaultMat;t.simulationSpace===oit.World?this._defines.CC_USE_WORLD_SPACE=!0:this._defines.CC_USE_WORLD_SPACE=!1;var n=i.passes[0];this._uScaleHandle=n.getHandle("scale"),this._uLenHandle=n.getHandle("frameTile_velLenScale"),this._uNodeRotHandle=n.getHandle("nodeRotation");var r=this._renderInfo.renderMode,s=this._frameTile_velLenScale;r===lit.Billboard?this._defines.CC_RENDER_MODE=0:r===lit.StrecthedBillboard?(this._defines.CC_RENDER_MODE=1,s.z=this._renderInfo.velocityScale,s.w=this._renderInfo.lengthScale):r===lit.HorizontalBillboard?this._defines.CC_RENDER_MODE=2:r===lit.VerticalBillboard?this._defines.CC_RENDER_MODE=3:r===lit.Mesh?this._defines.CC_RENDER_MODE=4:U("particle system renderMode "+r+" not support.");var a=t._textureAnimationModule;a&&a.enable?(nn.copy(this._tmp_velLenScale,s),Fn.set(this._tmp_velLenScale,a.numTilesX,a.numTilesY),n.setUniform(this._uLenHandle,this._tmp_velLenScale)):n.setUniform(this._uLenHandle,s);var o,h=this._particleSystem._rotationOvertimeModule;o=!!h&&h.enable,this._defines.ROTATION_OVER_TIME_MODULE_ENABLE=o,this._defines.CC_INSTANCE_PARTICLE=this._useInstance,i.recompileShaders(this._defines),this._model&&this._model.updateMaterial(i)}},i.updateTrailMaterial=function(){if(this._particleSystem){var t=this._particleSystem,e=t._trailModule;if(e&&e.enable){t.simulationSpace===oit.World||e.space===oit.World?this._trailDefines.CC_USE_WORLD_SPACE=!0:this._trailDefines.CC_USE_WORLD_SPACE=!1;var i=t.getMaterialInstance(1);null===i&&null===this._defaultTrailMat&&(Dst.parent=aS.get("default-trail-material"),Dst.owner=this._particleSystem,Dst.subModelIdx=1,this._defaultTrailMat=new US(Dst),Dst.parent=null,Dst.owner=null,Dst.subModelIdx=0),(i=i||this._defaultTrailMat).recompileShaders(this._trailDefines),e.updateMaterial()}}},i.setUseInstance=function(t){this._useInstance!==t&&(this._useInstance=t,this._model&&(this._model.useInstance=t,this._model.doDestroy()),this.updateRenderMode())},e}(mst),Bst=new nn,Nst=new Dn,Lst=new nn,Fst=new En,kst=new En;new hn;var Ust,Gst,Hst,zst,Vst,Wst,Xst,jst,Yst,Kst,qst,Qst,Zst,Jst,$st,tat,eat,iat,nat,rat,sat,aat=32,oat="a_position_starttime",hat="a_size_uv",uat="a_rotation_uv",lat="a_color",cat="a_dir_life",_at="a_rndSeed",dat="a_size_fid",fat="a_rotation",pat=[new __(oat,jl.RGBA32F),new __(hat,jl.RGBA32F),new __(uat,jl.RGBA32F),new __(lat,jl.RGBA32F),new __(cat,jl.RGBA32F),new __(_at,jl.R32F)],mat=[new __(oat,jl.RGBA32F),new __(hat,jl.RGBA32F),new __(uat,jl.RGBA32F),new __(lat,jl.RGBA32F),new __(cat,jl.RGBA32F),new __(_at,jl.R32F),new __(Mc.ATTR_TEX_COORD,jl.RGB32F),new __(Mc.ATTR_TEX_COORD3,jl.RGB32F),new __(Mc.ATTR_NORMAL,jl.RGB32F),new __(Mc.ATTR_COLOR1,jl.RGBA8,!0)],gat=[new __(oat,jl.RGBA32F,!1,0,!0),new __(dat,jl.RGBA32F,!1,0,!0),new __(fat,jl.RGB32F,!1,0,!0),new __(lat,jl.RGBA32F,!1,0,!0),new __(cat,jl.RGBA32F,!1,0,!0),new __(_at,jl.R32F,!1,0,!0),new __("a_uv",jl.RGB32F,!1,1)],vat=[new __(oat,jl.RGBA32F,!1,0,!0),new __(dat,jl.RGBA32F,!1,0,!0),new __(fat,jl.RGB32F,!1,0,!0),new __(lat,jl.RGBA32F,!1,0,!0),new __(cat,jl.RGBA32F,!1,0,!0),new __(_at,jl.R32F,!1,0,!0),new __(Mc.ATTR_TEX_COORD,jl.RGB32F,!1,1),new __(Mc.ATTR_TEX_COORD3,jl.RGB32F,!1,1),new __(Mc.ATTR_NORMAL,jl.RGB32F,!1,1),new __(Mc.ATTR_COLOR1,jl.RGBA8,!0,1)],yat={parent:null,owner:null,subModelIdx:0},Tat=function(t){function e(e){var i;return(i=t.call(this,e)||this)._defines=void 0,i._frameTile_velLenScale=void 0,i._unifrom_velLenScale=void 0,i._tmp_velLenScale=void 0,i._node_scale=void 0,i._vertAttrs=[],i._defaultMat=null,i._particleNum=0,i._tempParticle=null,i._colorTexture=null,i._forceTexture=null,i._velocityTexture=null,i._rotationTexture=null,i._sizeTexture=null,i._animTexture=null,i._colorData=null,i._forceData=null,i._velocityData=null,i._rotationData=null,i._sizeData=null,i._animData=null,i._uTimeHandle=0,i._uRotHandle=0,i._uNodeRotHandle=0,i._alignSpace=uit.View,i._inited=!1,i._frameTile_velLenScale=new nn(1,1,0,0),i._unifrom_velLenScale=i._frameTile_velLenScale.clone(),i._tmp_velLenScale=i._frameTile_velLenScale.clone(),i._node_scale=new hn,i._defines={CC_USE_WORLD_SPACE:!0,CC_USE_BILLBOARD:!0,CC_USE_STRETCHED_BILLBOARD:!1,CC_USE_HORIZONTAL_BILLBOARD:!1,CC_USE_VERTICAL_BILLBOARD:!1,COLOR_OVER_TIME_MODULE_ENABLE:!1},i._tempParticle=new jet(null),i._particleNum=0,i}s(e,t);var i=e.prototype;return i.onInit=function(e){t.prototype.onInit.call(this,e),this._setVertexAttrib(),this._initModel(),this.updateMaterialParams(),this.setVertexAttributes(),this._inited=!0},i.updateRenderMode=function(){this._setVertexAttrib(),this.updateMaterialParams(),this.setVertexAttributes()},i.setVertexAttributes=function(){t.prototype.setVertexAttributes.call(this),this._model.constructAttributeIndex()},i.clear=function(){t.prototype.clear.call(this),this._particleNum=0,this.updateRenderData()},i.onDestroy=function(){t.prototype.onDestroy.call(this),this._forceTexture&&this._forceTexture.destroy(),this._velocityTexture&&this._velocityTexture.destroy(),this._colorTexture&&this._colorTexture.destroy(),this._sizeTexture&&this._sizeTexture.destroy(),this._rotationTexture&&this._rotationTexture.destroy(),this._animTexture&&this._animTexture.destroy(),this._forceData=null,this._velocityData=null,this._colorData=null,this._sizeData=null,this._rotationData=null,this._animData=null},i.enableModule=function(){var t,e=(null===(t=this._particleSystem)||void 0===t?void 0:t.getMaterialInstance(0))||this._defaultMat;e&&(this.initShaderUniform(e),e.recompileShaders(this._defines),this._model&&this._model.setSubModelMaterial(0,e))},i.getFreeParticle=function(){var t;return this._particleSystem&&this._particleNum>=(null===(t=this._particleSystem)||void 0===t?void 0:t.capacity)?null:this._tempParticle},i.setNewParticle=function(t){this._particleSystem&&(this._model.addGPUParticleVertexData(t,this._particleNum,this._particleSystem.time),this._particleNum++)},i.getDefaultMaterial=function(){return this._defaultMat},i.updateRotation=function(t){t&&this.doUpdateRotation(t)},i.doUpdateRotation=function(t){if(this._renderInfo.renderMode===lit.Mesh||this._alignSpace!==uit.View){var e;if(this._alignSpace===uit.Local)null===(e=this._particleSystem)||void 0===e||e.node.getRotation(kst);else if(this._alignSpace===uit.World){var i;null===(i=this._particleSystem)||void 0===i||i.node.getWorldRotation(kst)}else if(this._alignSpace===uit.View){var n,r;kst.set(0,0,0,1);var s=null===(n=this._particleSystem)||void 0===n||null===(r=n.node.scene.renderScene)||void 0===r?void 0:r.cameras;if(void 0!==s&&this._particleSystem)for(var a=0;a<(null==s?void 0:s.length);++a){var o=s[a];if((o.visibility&this._particleSystem.node.layer)===this._particleSystem.node.layer){En.fromViewUp(kst,o.forward);break}}}else kst.set(0,0,0,1);t.setUniform(this._uNodeRotHandle,kst)}},i.updateScale=function(t){t&&this.doUpdateScale(t)},i.doUpdateScale=function(t){var e,i=this._node_scale;switch(null===(e=this._particleSystem)||void 0===e?void 0:e.scaleSpace){case oit.Local:this._particleSystem.node.getScale(i);break;case oit.World:this._particleSystem.node.getWorldScale(i)}t.setUniform(t.getHandle("scale"),Bst.set(i.x,i.y,i.z))},i.updateParticles=function(t){return this._particleSystem?(this._particleNum=this._model.updateGPUParticles(this._particleNum,this._particleSystem.time,t),this.updateShaderUniform(t),this._model.enabled=this._particleNum>0,this._particleNum):this._particleNum},i.updateRenderData=function(){},i.beforeRender=function(){this._model.updateIA(this._particleNum)},i.updateAlignSpace=function(t){this._alignSpace=t},i.updateShaderUniform=function(t){if(this._particleSystem){var e=this._particleSystem.getMaterialInstance(0)||this._defaultMat;if(e){var i=e.passes[0];Lst.x=this._particleSystem.time,Lst.y=t,i.setUniform(this._uTimeHandle,Lst),this._particleSystem.node.getWorldRotation(Fst),i.setUniform(this._uRotHandle,Fst),this.doUpdateRotation(i)}}},i.initShaderUniform=function(t){var e,i,n,r,s,a,o=t.passes[0];this._uTimeHandle=o.getHandle("u_timeDelta"),this._uRotHandle=o.getHandle("u_worldRot"),this._uNodeRotHandle=o.getHandle("nodeRotation"),this.doUpdateScale(o),o.setUniform(o.getHandle("frameTile_velLenScale"),this._unifrom_velLenScale),Lst.x=aat,Lst.y=.03125,o.setUniform(o.getHandle("u_sampleInfo"),Lst);var h=!1,u=null===(e=this._particleSystem)||void 0===e?void 0:e._forceOvertimeModule;if(h=!!u&&u.enable,this._defines.FORCE_OVER_TIME_MODULE_ENABLE=h,h){var l=get(this._forceTexture,this._forceData,aat,u.x,u.y,u.z);this._forceTexture=l.texture,this._forceData=l.texdata;var c=o.getHandle("force_over_time_tex0"),_=_S.getBindingFromHandle(c);o.bindSampler(_,this._forceTexture.getGFXSampler()),o.bindTexture(_,this._forceTexture.getGFXTexture());var d=o.getHandle("u_force_space");o.setUniform(d,u.space);var f=o.getHandle("u_force_mode");o.setUniform(f,this._forceTexture.height)}var p=null===(i=this._particleSystem)||void 0===i?void 0:i._velocityOvertimeModule;if(h=!!p&&p.enable,this._defines.VELOCITY_OVER_TIME_MODULE_ENABLE=h,h){var m=function(t,e,i,n,r,s,a){var o=Math.max(pet(n),pet(r),pet(s),pet(a)),h=i*o*4;null!==e&&e.length===h||(e=new Float32Array(i*o*4));for(var u=[n,r,s,a],l=0;l<o;l++)for(var c=0;c<4;c++)for(var _=u[c],d=0,f=0,p=0;p<i;p++){var m=fet(_,.03225806451612903*p,l);f=(d+=m)/(p+1),e[4*(l*i+p)+c]=f}return{texture:met(t,e,i,o),texdata:e}}(this._velocityTexture,this._velocityData,aat,p.x,p.y,p.z,p.speedModifier);this._velocityTexture=m.texture,this._velocityData=m.texdata;var g=o.getHandle("velocity_over_time_tex0"),v=_S.getBindingFromHandle(g);o.bindSampler(v,this._velocityTexture.getGFXSampler()),o.bindTexture(v,this._velocityTexture.getGFXTexture());var y=o.getHandle("u_velocity_space");o.setUniform(y,p.space);var T=o.getHandle("u_velocity_mode");o.setUniform(T,this._velocityTexture.height)}var S=null===(n=this._particleSystem)||void 0===n?void 0:n._colorOverLifetimeModule;if(h=!!S&&S.enable,this._defines.COLOR_OVER_TIME_MODULE_ENABLE=h,h){var E=function(t,e,i,n){var r=function(t){switch(t.mode){case Uet.TwoColors:case Uet.TwoGradients:return 2;default:return 1}}(n),s=i*r*4;null!==e&&e.length===s||(e=new Uint8Array(i*r*4));for(var a=1/(i-1),o=0,h=0;h<r;h++)for(var u=0;u<i;u++){var l=Vet(n,a*u,h);e[o]=l.r,e[o+1]=l.g,e[o+2]=l.b,e[o+3]=l.a,o+=4}return null!==t&&i===t.width&&r===t.height||(t&&t.destroy(),(t=new em).create(i,r,lf.RGBA8888),t.setFilters(_f.LINEAR,_f.LINEAR),t.setWrapMode(cf.CLAMP_TO_EDGE,cf.CLAMP_TO_EDGE)),t.uploadData(e),{texture:t,texdata:e}}(this._colorTexture,this._colorData,aat,S.color);this._colorTexture=E.texture,this._colorData=E.texdata;var A=o.getHandle("color_over_time_tex0"),R=_S.getBindingFromHandle(A);o.bindSampler(R,this._colorTexture.getGFXSampler()),o.bindTexture(R,this._colorTexture.getGFXTexture());var b=o.getHandle("u_color_mode");o.setUniform(b,this._colorTexture.height)}var C,w=null===(r=this._particleSystem)||void 0===r?void 0:r._rotationOvertimeModule;if(h=!!w&&w.enable,this._defines.ROTATION_OVER_TIME_MODULE_ENABLE=h,h&&(C=w.separateAxes?get(this._rotationTexture,this._rotationData,aat,w.x,w.y,w.z):function(t,e,i,n){var r=pet(n),s=128*r;null!==e&&e.length===s||(e=new Float32Array(128*r));for(var a=0,o=0;o<r;o++)for(var h=0;h<32;h++){var u=fet(n,.03225806451612903*h,o);e[a+2]=u,a+=4}return{texture:met(t,e,32,r),texdata:e}}(this._rotationTexture,this._rotationData,0,w.z),this._rotationTexture=C.texture,this._rotationData=C.texdata,this._rotationTexture)){var x=o.getHandle("rotation_over_time_tex0"),I=_S.getBindingFromHandle(x);o.bindSampler(I,this._rotationTexture.getGFXSampler()),o.bindTexture(I,this._rotationTexture.getGFXTexture());var O=o.getHandle("u_rotation_mode");o.setUniform(O,this._rotationTexture.height)}var D,M=null===(s=this._particleSystem)||void 0===s?void 0:s._sizeOvertimeModule;if(h=!!M&&M.enable,this._defines.SIZE_OVER_TIME_MODULE_ENABLE=h,h&&(D=M.separateAxes?get(this._sizeTexture,this._sizeData,aat,M.x,M.y,M.z,!0):function(t,e,i,n){var r=pet(n),s=128*r;null!==e&&e.length===s||(e=new Float32Array(128*r));for(var a=0,o=0,h=0;h<r;h++){0;for(var u=0;u<32;u++){var l=fet(n,.03225806451612903*u,h);a=l,e[o]=a,e[o+1]=a,e[o+2]=a,o+=4}}return{texture:met(t,e,32,r),texdata:e}}(this._sizeTexture,this._sizeData,0,M.size),this._sizeTexture=D.texture,this._sizeData=D.texdata,this._sizeTexture)){var P=o.getHandle("size_over_time_tex0"),B=_S.getBindingFromHandle(P);o.bindSampler(B,this._sizeTexture.getGFXSampler()),o.bindTexture(B,this._sizeTexture.getGFXTexture());var N=o.getHandle("u_size_mode");o.setUniform(N,this._sizeTexture.height)}var L=null===(a=this._particleSystem)||void 0===a?void 0:a._textureAnimationModule;if(h=!!L&&L.enable,this._defines.TEXTURE_ANIMATION_MODULE_ENABLE=h,h){var F=function(t,e,i,n,r){var s=Math.max(pet(n),pet(r)),a=i*s*4;null!==e&&e.length===a||(e=new Float32Array(i*s*4));for(var o=[n,r],h=0;h<s;h++)for(var u=0;u<2;u++)for(var l=o[u],c=0,_=0;_<i;_++){var d=fet(l,.03225806451612903*_,h);c=d,e[4*(h*i+_)+u]=c}return{texture:met(t,e,i,s),texdata:e}}(this._animTexture,this._animData,aat,L.startFrame,L.frameOverTime);this._animTexture=F.texture,this._animData=F.texdata;var k=o.getHandle("texture_animation_tex0"),U=_S.getBindingFromHandle(k);o.bindSampler(U,this._animTexture.getGFXSampler()),o.bindTexture(U,this._animTexture.getGFXTexture());var G=o.getHandle("u_anim_info");Lst.x=this._animTexture.height,Lst.y=L.numTilesX*L.numTilesY,Lst.z=L.cycleCount,o.setUniform(G,Lst)}this._defines.USE_VK_SHADER=wd.gfxDevice.gfxAPI===Vl.VULKAN,this._defines.CC_INSTANCE_PARTICLE=this._useInstance},i.getParticleCount=function(){return this._particleNum},i.onMaterialModified=function(){this._inited&&this.updateMaterialParams()},i.onRebuildPSO=function(t,e){this._model&&0===t&&this._model.setSubModelMaterial(0,e)},i.updateVertexAttrib=function(){if(this._renderInfo.renderMode===lit.Mesh&&this._renderInfo.mesh){var t=this._renderInfo.mesh.readAttributeFormat(0,Mc.ATTR_COLOR);if(t){for(var e=jl.RGBA8,i=0;i<F_.length;++i)if(F_[i].name===t.name){e=i;break}this._vertAttrs[9]=new __(Mc.ATTR_COLOR1,e,!0,this._useInstance?1:0)}else{var n=jl.RGBA8;this._vertAttrs[9]=new __(Mc.ATTR_COLOR1,n,!0,this._useInstance?1:0)}}},i._setVertexAttrib=function(){if(this._useInstance)this._setVertexAttribIns();else switch(this._renderInfo.renderMode){case lit.StrecthedBillboard:this._vertAttrs=pat.slice();break;case lit.Mesh:this._vertAttrs=mat.slice();break;default:this._vertAttrs=pat.slice()}},i._setVertexAttribIns=function(){switch(this._renderInfo.renderMode){case lit.StrecthedBillboard:this._vertAttrs=gat.slice();break;case lit.Mesh:this._vertAttrs=vat.slice();break;default:this._vertAttrs=gat.slice()}},i.updateMaterialParams=function(){if(this._particleSystem){var t=this._particleSystem,e=t.sharedMaterial;null!==e&&(this._renderInfo.mainTexture=e.getProperty("mainTexture",0)),null==t.sharedMaterial&&null==this._defaultMat&&(yat.parent=aS.get("default-particle-gpu-material"),yat.owner=t,yat.subModelIdx=0,this._defaultMat=new US(yat),yat.parent=null,yat.owner=null,yat.subModelIdx=0,null!==this._renderInfo.mainTexture&&this._defaultMat.setProperty("mainTexture",this._renderInfo.mainTexture));var i=t.getMaterialInstance(0)||this._defaultMat;t.node.getWorldMatrix(Nst),t.simulationSpace===oit.World?this._defines.CC_USE_WORLD_SPACE=!0:this._defines.CC_USE_WORLD_SPACE=!1;var n=this._renderInfo.renderMode;n===lit.Billboard?this._defines.CC_RENDER_MODE=0:n===lit.StrecthedBillboard?(this._defines.CC_RENDER_MODE=1,this._frameTile_velLenScale.z=this._renderInfo.velocityScale,this._frameTile_velLenScale.w=this._renderInfo.lengthScale):n===lit.HorizontalBillboard?this._defines.CC_RENDER_MODE=2:n===lit.VerticalBillboard?this._defines.CC_RENDER_MODE=3:n===lit.Mesh?this._defines.CC_RENDER_MODE=4:U("particle system renderMode "+n+" not support.");var r=t._textureAnimationModule;r&&r.enable?(Fn.set(this._frameTile_velLenScale,r.numTilesX,r.numTilesY),nn.copy(this._unifrom_velLenScale,this._frameTile_velLenScale)):(this._tmp_velLenScale.z=this._frameTile_velLenScale.z,this._tmp_velLenScale.w=this._frameTile_velLenScale.w,nn.copy(this._unifrom_velLenScale,this._tmp_velLenScale)),this.initShaderUniform(i),i.recompileShaders(this._defines),this._model&&this._model.updateMaterial(i)}},i.setUseInstance=function(t){this._useInstance!==t&&(this._useInstance=t,this._model&&(this._model.useInstance=t,this._model.doDestroy()),this.updateRenderMode())},i.getNoisePreview=function(){},e}(mst);function Sat(){var t=gL.root.device;return!!(t.capabilities.maxVertexTextureUnits>=8&&t.getFormatFeatures(jl.RGBA32F)&(ic.RENDER_TARGET|ic.SAMPLED_TEXTURE))||(v.warn("Maybe the device has restrictions on vertex textures or does not support float textures."),!1)}var Eat,Aat,Rat,bat,Cat,wat,xat,Iat,Oat,Dat,Mat,Pat,Bat,Nat,Lat,Fat,kat,Uat,Gat,Hat,zat,Vat,Wat,Xat,jat,Yat,Kat,qat,Qat,Zat,Jat,$at,tot,eot,iot,not,rot,sot,aot,oot,hot,uot,lot,cot,_ot,dot,fot,pot,mot,got,vot,yot,Tot,Sot,Eot,Aot,Rot,bot,Cot,wot,xot,Iot,Oot,Dot,Mot,Pot,Bot,Not,Lot,Fot,kot,Uot,Got,Hot,zot,Vot,Wot,Xot,jot,Yot,Kot,qot,Qot,Zot,Jot,$ot,tht,eht,iht,nht,rht,sht,aht,oht,hht,uht,lht,cht,_ht,dht,fht,pht,mht,ght,vht,yht,Tht,Sht,Eht,Aht,Rht,bht,Cht,wht,xht,Iht,Oht,Dht,Mht,Pht,Bht,Nht,Lht,Fht,kht,Uht,Ght,Hht,zht,Vht,Wht,Xht,jht,Yht,Kht,qht,Qht,Zht,Jht,$ht,tut,eut,iut,nut,rut,sut,aut,out,hut,uut,lut,cut,_ut,dut,fut,put,mut,gut=(Ust=qs("cc.ParticleSystemRenderer"),Gst=xa(lit),Hst=xa(lit),zst=xa(QL),Vst=xa(OS),Wst=xa(OS),Xst=xa(OS),jst=xa(OS),Yst=xa(uit),Ust(((sat=function(){function t(){this._renderMode=Qst&&Qst(),this._velocityScale=Zst&&Zst(),this._lengthScale=Jst&&Jst(),this._mesh=$st&&$st(),this._cpuMaterial=tat&&tat(),this._gpuMaterial=eat&&eat(),this._mainTexture=iat&&iat(),this._useGPU=nat&&nat(),this._alignSpace=rat&&rat(),this._particleSystem=null}var e=t.prototype;return e.create=function(t){null===this._particleSystem?this._particleSystem=t:this._particleSystem!==t&&Z(6033)},e.onInit=function(t){this.create(t);var e=this._useGPU&&Sat();this._particleSystem.processor?Z(6034):(this._particleSystem.processor=e?new Tat(this):new Pst(this),this._particleSystem.processor.updateAlignSpace(this.alignSpace),this._particleSystem.processor.onInit(t)),e?this.gpuMaterial=this.particleMaterial:(this.particleMaterial&&-1!==this.particleMaterial.effectName.indexOf("particle-gpu")&&(this.particleMaterial=null,q(6035)),this.cpuMaterial=this.particleMaterial)},e._switchProcessor=function(){if(this._particleSystem){this._particleSystem.processor&&(this._particleSystem.processor.detachFromScene(),this._particleSystem.processor.clear(),this._particleSystem.processor=null);var t=this._useGPU&&Sat();!t&&this.cpuMaterial&&(this.particleMaterial=this.cpuMaterial),t&&this.gpuMaterial&&(this.particleMaterial=this.gpuMaterial),this._particleSystem.processor=t?new Tat(this):new Pst(this),this._particleSystem.processor.updateAlignSpace(this.alignSpace),this._particleSystem.processor.onInit(this._particleSystem),this._particleSystem.processor.onEnable(),this._particleSystem.bindModule()}},n(t,[{key:"renderMode",get:function(){return this._renderMode},set:function(t){this._renderMode!==t&&(this._renderMode=t,this._particleSystem&&this._particleSystem.processor.updateRenderMode())}},{key:"velocityScale",get:function(){return this._velocityScale},set:function(t){this._velocityScale=t,this._particleSystem&&this._particleSystem.processor.updateMaterialParams()}},{key:"lengthScale",get:function(){return this._lengthScale},set:function(t){this._lengthScale=t,this._particleSystem&&this._particleSystem.processor.updateMaterialParams()}},{key:"mesh",get:function(){return this._mesh},set:function(t){this._mesh=t,this._particleSystem&&this._particleSystem.processor.setVertexAttributes()}},{key:"particleMaterial",get:function(){return this._particleSystem?this._particleSystem.getSharedMaterial(0):null},set:function(t){this._particleSystem&&this._particleSystem.setSharedMaterial(t,0)}},{key:"cpuMaterial",get:function(){return this._cpuMaterial},set:function(t){if(null!==t){var e=t.effectName;-1!==e.indexOf("particle")&&-1===e.indexOf("particle-gpu")?(this._cpuMaterial=t,this.particleMaterial=this._cpuMaterial):q(6035)}}},{key:"gpuMaterial",get:function(){return this._gpuMaterial},set:function(t){null!==t&&(-1!==t.effectName.indexOf("particle-gpu")?(this._gpuMaterial=t,this.particleMaterial=this._gpuMaterial):q(6035))}},{key:"trailMaterial",get:function(){return this._particleSystem?this._particleSystem.getSharedMaterial(1):null},set:function(t){this._particleSystem&&this._particleSystem.setSharedMaterial(t,1)}},{key:"mainTexture",get:function(){return this._mainTexture},set:function(t){this._mainTexture=t}},{key:"useGPU",get:function(){return this._useGPU},set:function(t){this._useGPU!==t&&(Sat()?this._useGPU=t:this._useGPU=!1,this._switchProcessor())}},{key:"alignSpace",get:function(){return this._alignSpace},set:function(t){this._alignSpace=t,this._particleSystem.processor.updateAlignSpace(this._alignSpace)}}]),t}()).AlignmentSpace=uit,f((qst=sat).prototype,"renderMode",[Gst],Object.getOwnPropertyDescriptor(qst.prototype,"renderMode"),qst.prototype),Qst=Gs(qst.prototype,"_renderMode",[Hst,ra],(function(){return lit.Billboard})),Zst=Gs(qst.prototype,"_velocityScale",[ra],(function(){return 1})),Jst=Gs(qst.prototype,"_lengthScale",[ra],(function(){return 1})),$st=Gs(qst.prototype,"_mesh",[ra],(function(){return null})),f(qst.prototype,"mesh",[zst],Object.getOwnPropertyDescriptor(qst.prototype,"mesh"),qst.prototype),f(qst.prototype,"particleMaterial",[Vst],Object.getOwnPropertyDescriptor(qst.prototype,"particleMaterial"),qst.prototype),f(qst.prototype,"cpuMaterial",[Wst],Object.getOwnPropertyDescriptor(qst.prototype,"cpuMaterial"),qst.prototype),tat=Gs(qst.prototype,"_cpuMaterial",[ra],(function(){return null})),f(qst.prototype,"gpuMaterial",[Xst],Object.getOwnPropertyDescriptor(qst.prototype,"gpuMaterial"),qst.prototype),eat=Gs(qst.prototype,"_gpuMaterial",[ra],(function(){return null})),f(qst.prototype,"trailMaterial",[jst],Object.getOwnPropertyDescriptor(qst.prototype,"trailMaterial"),qst.prototype),iat=Gs(qst.prototype,"_mainTexture",[ra],(function(){return null})),nat=Gs(qst.prototype,"_useGPU",[ra],(function(){return!1})),f(qst.prototype,"alignSpace",[Yst],Object.getOwnPropertyDescriptor(qst.prototype,"alignSpace"),qst.prototype),rat=Gs(qst.prototype,"_alignSpace",[ra],(function(){return uit.View})),Kst=qst))||Kst),vut=Math.cos(Mi(100)),yut={position:new hn,velocity:new hn},Tut=new En,Sut=new hn,Eut=new hn,Aut=new pn,Rut=function(){function t(t){for(this.start=void 0,this.end=void 0,this.trailElements=void 0,this.start=-1,this.end=-1,this.trailElements=[];t--;)this.trailElements.push({position:new hn,lifetime:0,width:0,velocity:new hn,direction:0,color:new pn})}var e=t.prototype;return e.getElement=function(t){return-1===this.start?null:(t<0&&(t=(t+this.trailElements.length)%this.trailElements.length),t>=this.trailElements.length&&(t%=this.trailElements.length),this.trailElements[t])},e.addElement=function(){if(0===this.trailElements.length)return null;if(-1===this.start)return this.start=0,this.end=1,this.trailElements[0];this.start===this.end&&(this.trailElements.splice(this.end,0,{position:new hn,lifetime:0,width:0,velocity:new hn,direction:0,color:new pn}),this.start++,this.start%=this.trailElements.length);var t=this.end++;return this.end%=this.trailElements.length,this.trailElements[t]},e.iterateElement=function(t,e,i,n){for(var r=this.start>=this.end?this.end+this.trailElements.length:this.end,s=this.start;s<r;s++)e(t,this.trailElements[s%this.trailElements.length],i,n)&&(this.start++,this.start%=this.trailElements.length);this.start===r&&(this.start=-1,this.end=-1)},e.count=function(){return this.start<this.end?this.end-this.start:this.trailElements.length+this.end-this.start},e.clear=function(){this.start=-1,this.end=-1},t}(),but=(Eat=qs("cc.TrailModule"),Aat=xa(fit),Rat=xa(det),bat=xa(oit),Cat=xa(pit),wat=xa(det),xat=xa(zet),Iat=xa(zet),Oat=xa(oit),Eat((Mat=function(){var t=e.prototype;function e(){this._enable=Pat&&Pat(),this.mode=Bat&&Bat(),this.lifeTime=Nat&&Nat(),this._minParticleDistance=Lat&&Lat(),this.existWithParticles=Fat&&Fat(),this.textureMode=kat&&kat(),this.widthFromParticle=Uat&&Uat(),this.widthRatio=Gat&&Gat(),this.colorFromParticle=Hat&&Hat(),this.colorOverTrail=zat&&zat(),this.colorOvertime=Vat&&Vat(),this._space=Wat&&Wat(),this._particleSystem=Xat&&Xat(),this._minSquaredDistance=0,this._vertSize=void 0,this._trailNum=0,this._trailLifetime=0,this.vbOffset=0,this.ibOffset=0,this._trailSegments=null,this._particleTrail=void 0,this._trailModel=null,this._subMeshData=null,this._vertAttrs=void 0,this._vbF32=null,this._vbUint32=null,this._iBuffer=null,this._needTransform=!1,this._material=null,this._psTransform=new Dn,this._iaVertCount=0,this._iaIndexCount=0,this._inited=void 0,this._vertAttrs=[new __(Mc.ATTR_POSITION,jl.RGB32F),new __(Mc.ATTR_TEX_COORD,jl.RGBA32F),new __(Mc.ATTR_TEX_COORD1,jl.RGB32F),new __(Mc.ATTR_COLOR,jl.RGBA8,!0)],this._vertSize=0;for(var t,e=d(this._vertAttrs);!(t=e()).done;){var i=t.value;this._vertSize+=F_[i.format].size}this._particleTrail=new Map,this._inited=!1}return t.getModel=function(){return this._trailModel},t.onInit=function(t){this._particleSystem=t,this.minParticleDistance=this._minParticleDistance;for(var e=0,i=t.startLifetime.getMax(),n=t.rateOverTime.getMax(),r=t.duration,s=0,a=t.bursts.length;s<a;s++)e+=t.bursts[s].getMaxCount(t)*Math.ceil(i/r);this.lifeTime.getMax()<1&&q(6036),this._trailNum=Math.ceil(i*Math.ceil(this.lifeTime.getMax())*60*(n*r+e)),this._trailSegments=new Pu((function(){return new Rut(10)}),Math.ceil(n*r),(function(t){return t.trailElements.length=0})),this._enable&&(this.enable=this._enable),this._inited=!0},t.onEnable=function(){this._attachToScene()},t.onDisable=function(){this._particleTrail.clear(),this._detachFromScene()},t._attachToScene=function(){this._trailModel&&(this._trailModel.scene&&this._detachFromScene(),this._particleSystem._getRenderScene().addModel(this._trailModel))},t._detachFromScene=function(){this._trailModel&&this._trailModel.scene&&this._trailModel.scene.removeModel(this._trailModel)},t.destroy=function(){this.destroySubMeshData(),this._trailModel&&(gL.root.destroyModel(this._trailModel),this._trailModel=null),this._trailSegments&&(this._trailSegments.destroy(),this._trailSegments=null)},t.play=function(){this._trailModel&&this._enable&&(this._trailModel.enabled=!0)},t.clear=function(){if(this.enable){for(var t=this._particleTrail.values(),e=t.next();!e.done;)e.value.clear(),e=t.next();this._particleTrail.clear(),this.updateRenderData(),this._trailModel&&(this._trailModel.enabled=!1)}},t.updateMaterial=function(){this._particleSystem&&(this._material=this._particleSystem.getMaterialInstance(1)||this._particleSystem.processor._defaultTrailMat,this._trailModel&&this._trailModel.setSubModelMaterial(0,this._material))},t.update=function(){this._trailLifetime=this.lifeTime.evaluate(this._particleSystem._time,1),this.space===oit.World&&this._particleSystem._simulationSpace===oit.Local?(this._needTransform=!0,this._particleSystem.node.getWorldMatrix(this._psTransform),this._particleSystem.node.getWorldRotation(Tut)):this._needTransform=!1},t.animate=function(t,e){if(this._trailSegments)if(t.loopCount>t.lastLoop)t.trailDelay>1?(t.lastLoop=t.loopCount,t.trailDelay=0):t.trailDelay++;else{var i=this._particleTrail.get(t);if(!i)return i=this._trailSegments.alloc(),void this._particleTrail.set(t,i);var n=i.getElement(i.end-1);if(this._needTransform?hn.transformMat4(Sut,t.position,this._psTransform):hn.copy(Sut,t.position),!(n&&(i.iterateElement(this,this._updateTrailElement,t,e),hn.squaredDistance(n.position,Sut)<this._minSquaredDistance))&&(n=i.addElement())){hn.copy(n.position,Sut),n.lifetime=0,this.widthFromParticle?n.width=t.size.x*this.widthRatio.evaluate(0,1):n.width=this.widthRatio.evaluate(0,1);var r=i.count();if(2===r){var s=i.getElement(i.end-2);hn.subtract(s.velocity,n.position,s.position)}else if(r>2){var a=i.getElement(i.end-2),o=i.getElement(i.end-3);hn.subtract(Sut,o.position,a.position),hn.subtract(Eut,n.position,a.position),hn.subtract(a.velocity,Eut,Sut),hn.equals(hn.ZERO,a.velocity)&&hn.copy(a.velocity,Sut),hn.normalize(a.velocity,a.velocity),this._checkDirectionReverse(a,o)}this.colorFromParticle?n.color.set(t.color):n.color.set(this.colorOvertime.evaluate(0,1))}}},t.removeParticle=function(t){var e=this._particleTrail.get(t);e&&this._trailSegments&&(e.clear(),this._trailSegments.free(e),this._particleTrail.delete(t))},t.updateRenderData=function(){this.vbOffset=0,this.ibOffset=0;for(var t,e=d(this._particleTrail.keys());!(t=e()).done;){var i=t.value,n=this._particleTrail.get(i);if(-1!==n.start){var r=4*this.vbOffset/this._vertSize,s=n.start>=n.end?n.end+n.trailElements.length:n.end,a=s-n.start,o=1/a,h=n.trailElements[n.start];this._fillVertexBuffer(h,this.colorOverTrail.evaluate(1,1),r,1,0,4);for(var u=n.start+1;u<s;u++){var l=n.trailElements[u%n.trailElements.length],c=u-n.start;this._fillVertexBuffer(l,this.colorOverTrail.evaluate(1-c/a,1),r,1-c*o,c,5)}this._needTransform?hn.transformMat4(yut.position,i.position,this._psTransform):hn.copy(yut.position,i.position);var _=this._trailModel;if(_&&_.node.invalidateChildren(om.POSITION),1===a||2===a){var f=n.getElement(n.end-1);hn.subtract(f.velocity,yut.position,f.position),this._vbF32[this.vbOffset-this._vertSize/4-4]=f.velocity.x,this._vbF32[this.vbOffset-this._vertSize/4-3]=f.velocity.y,this._vbF32[this.vbOffset-this._vertSize/4-2]=f.velocity.z,this._vbF32[this.vbOffset-4]=f.velocity.x,this._vbF32[this.vbOffset-3]=f.velocity.y,this._vbF32[this.vbOffset-2]=f.velocity.z,hn.subtract(yut.velocity,yut.position,f.position),this._checkDirectionReverse(yut,f)}else if(a>2){var p=n.getElement(n.end-1),m=n.getElement(n.end-2);hn.subtract(Sut,m.position,p.position),hn.subtract(Eut,yut.position,p.position),hn.normalize(Sut,Sut),hn.normalize(Eut,Eut),hn.subtract(p.velocity,Eut,Sut),hn.normalize(p.velocity,p.velocity),this._checkDirectionReverse(p,m),this.vbOffset-=this._vertSize/4*2,this.ibOffset-=6,this._fillVertexBuffer(p,this.colorOverTrail.evaluate(o,1),r,o,a-1,5),hn.subtract(yut.velocity,yut.position,p.position),hn.normalize(yut.velocity,yut.velocity),this._checkDirectionReverse(yut,p)}this.widthFromParticle?yut.width=i.size.x*this.widthRatio.evaluate(0,1):yut.width=this.widthRatio.evaluate(0,1),yut.color=i.color,hn.equals(yut.velocity,hn.ZERO)?this.ibOffset-=3:this._fillVertexBuffer(yut,this.colorOverTrail.evaluate(0,1),r,0,a,1)}}this._trailModel&&(this._trailModel.enabled=this.ibOffset>0)},t.updateIA=function(t){var e=this._trailModel&&this._trailModel.subModels;if(e&&e.length>0){var i=e[0];i.inputAssembler.vertexBuffers[0].update(this._vbF32),i.inputAssembler.indexBuffer.update(this._iBuffer),i.inputAssembler.firstIndex=0,i.inputAssembler.indexCount=t,i.inputAssembler.vertexCount=this._iaVertCount}},t.beforeRender=function(){this.updateIA(this.ibOffset)},t._createModel=function(){this._trailModel||(this._trailModel=v.director.root.createModel(IB))},t.rebuild=function(){var t=gL.root.device,e=t.createBuffer(new qc(ql.VERTEX|ql.TRANSFER_DST,Jl.HOST|Jl.DEVICE,this._vertSize*(this._trailNum+1)*2,this._vertSize)),i=new ArrayBuffer(this._vertSize*(this._trailNum+1)*2);this._vbF32=new Float32Array(i),this._vbUint32=new Uint32Array(i),e.update(i);var n=t.createBuffer(new qc(ql.INDEX|ql.TRANSFER_DST,Jl.HOST|Jl.DEVICE,6*Math.max(1,this._trailNum)*Uint16Array.BYTES_PER_ELEMENT,Uint16Array.BYTES_PER_ELEMENT));this._iBuffer=new Uint16Array(6*Math.max(1,this._trailNum)),n.update(this._iBuffer),this._iaVertCount=2*(this._trailNum+1),this._iaIndexCount=6*this._trailNum,this._subMeshData=new Lx([e],this._vertAttrs,vc.TRIANGLE_LIST,n);var r=this._trailModel;r&&this._material&&(r.node=r.transform=this._particleSystem.node,r.visFlags=this._particleSystem.visibility,r.initSubModel(0,this._subMeshData,this._material),r.enabled=!0)},t._updateTrailElement=function(t,e,i,n){return e.lifetime+=n,t.colorFromParticle?(e.color.set(i.color),e.color.multiply(t.colorOvertime.evaluate(1-i.remainingLifetime/i.startLifetime,1))):e.color.set(t.colorOvertime.evaluate(1-i.remainingLifetime/i.startLifetime,1)),t.widthFromParticle?e.width=i.size.x*t.widthRatio.evaluate(e.lifetime/t._trailLifetime,1):e.width=t.widthRatio.evaluate(e.lifetime/t._trailLifetime,1),e.lifetime>t._trailLifetime},t._fillVertexBuffer=function(t,e,i,n,r,s){this._vbF32[this.vbOffset++]=t.position.x,this._vbF32[this.vbOffset++]=t.position.y,this._vbF32[this.vbOffset++]=t.position.z,this._vbF32[this.vbOffset++]=t.direction,this._vbF32[this.vbOffset++]=t.width,this._vbF32[this.vbOffset++]=n,this._vbF32[this.vbOffset++]=0,this._vbF32[this.vbOffset++]=t.velocity.x,this._vbF32[this.vbOffset++]=t.velocity.y,this._vbF32[this.vbOffset++]=t.velocity.z,Aut.set(t.color),Aut.multiply(e),this._vbUint32[this.vbOffset++]=Aut._val,this._vbF32[this.vbOffset++]=t.position.x,this._vbF32[this.vbOffset++]=t.position.y,this._vbF32[this.vbOffset++]=t.position.z,this._vbF32[this.vbOffset++]=1-t.direction,this._vbF32[this.vbOffset++]=t.width,this._vbF32[this.vbOffset++]=n,this._vbF32[this.vbOffset++]=1,this._vbF32[this.vbOffset++]=t.velocity.x,this._vbF32[this.vbOffset++]=t.velocity.y,this._vbF32[this.vbOffset++]=t.velocity.z,this._vbUint32[this.vbOffset++]=Aut._val,1&s&&(this._iBuffer[this.ibOffset++]=i+2*r,this._iBuffer[this.ibOffset++]=i+2*r-1,this._iBuffer[this.ibOffset++]=i+2*r+1),4&s&&(this._iBuffer[this.ibOffset++]=i+2*r,this._iBuffer[this.ibOffset++]=i+2*r+1,this._iBuffer[this.ibOffset++]=i+2*r+2)},t._checkDirectionReverse=function(t,e){hn.dot(t.velocity,e.velocity)<vut?t.direction=1-e.direction:t.direction=e.direction},t.destroySubMeshData=function(){this._subMeshData&&(this._subMeshData.destroy(),this._subMeshData=null)},n(e,[{key:"enable",get:function(){return this._enable},set:function(t){t===this._enable&&this._trailModel||(t&&!this._enable&&(this._enable=t,this._particleSystem.processor&&this._particleSystem.processor.updateTrailMaterial()),t&&!this._trailModel&&(this._createModel(),this.rebuild()),this._enable=t,this._trailModel&&(this._trailModel.enabled=t),t?this.onEnable():this.onDisable())}},{key:"minParticleDistance",get:function(){return this._minParticleDistance},set:function(t){this._minParticleDistance=t,this._minSquaredDistance=t*t}},{key:"space",get:function(){return this._space},set:function(t){this._space=t;var e=this._particleSystem;e&&e.processor&&e.processor.updateTrailMaterial()}},{key:"inited",get:function(){return this._inited}}]),e}(),Pat=Gs(Mat.prototype,"_enable",[ra],(function(){return!1})),Bat=Gs(Mat.prototype,"mode",[Aat,ra],(function(){return fit.Particles})),Nat=Gs(Mat.prototype,"lifeTime",[Rat,ra],(function(){return new det})),Lat=Gs(Mat.prototype,"_minParticleDistance",[ra],(function(){return.1})),f(Mat.prototype,"space",[bat],Object.getOwnPropertyDescriptor(Mat.prototype,"space"),Mat.prototype),Fat=Gs(Mat.prototype,"existWithParticles",[ra],(function(){return!0})),kat=Gs(Mat.prototype,"textureMode",[Cat,ra],(function(){return pit.Stretch})),Uat=Gs(Mat.prototype,"widthFromParticle",[ra],(function(){return!0})),Gat=Gs(Mat.prototype,"widthRatio",[wat,ra],(function(){return new det})),Hat=Gs(Mat.prototype,"colorFromParticle",[ra],(function(){return!1})),zat=Gs(Mat.prototype,"colorOverTrail",[xat,ra],(function(){return new zet})),Vat=Gs(Mat.prototype,"colorOvertime",[Iat,ra],(function(){return new zet})),Wat=Gs(Mat.prototype,"_space",[Oat],(function(){return oit.World})),Xat=Gs(Mat.prototype,"_particleSystem",[ra],(function(){return null})),Dat=Mat))||Dat),Cut=new Dn,wut=new Dn,xut=new En,Iut=new hn,Out=["_colorOverLifetimeModule","_sizeOvertimeModule","_velocityOvertimeModule","_forceOvertimeModule","_limitVelocityOvertimeModule","_rotationOvertimeModule","_textureAnimationModule"],Dut=function(){function t(t){this._particleSystem=void 0,this._processor=void 0,this._node=void 0,this._particlesAll=void 0,this._updateList=new Map,this._animateList=new Map,this._runAnimateList=new Array,this._localMat=new Dn,this._gravity=new nn,this.minPos=new hn,this.maxPos=new hn,this._nodePos=new hn,this._nodeSize=new hn,this._particleSystem=t,this._processor=this._particleSystem.processor,this._node=t.node,this._particlesAll=[],this._initModuleList()}var e=t.prototype;return e._updateBoundingNode=function(){this._nodeSize.set(this.maxPos.x-this.minPos.x,this.maxPos.y-this.minPos.y,this.maxPos.z-this.minPos.z),this._nodePos.set(this.minPos.x+.5*this._nodeSize.x,this.minPos.y+.5*this._nodeSize.y,this.minPos.z+.5*this._nodeSize.z)},e.setBoundingBoxSize=function(t){this.maxPos.x=this._nodePos.x+t.x,this.maxPos.y=this._nodePos.y+t.y,this.maxPos.z=this._nodePos.z+t.z,this.minPos.x=this._nodePos.x-t.x,this.minPos.y=this._nodePos.y-t.y,this.minPos.z=this._nodePos.z-t.z,this._updateBoundingNode()},e.setBoundingBoxCenter=function(t,e,i){this.maxPos.x=t+.5*this._nodeSize.x,this.maxPos.y=e+.5*this._nodeSize.y,this.maxPos.z=i+.5*this._nodeSize.z,this.minPos.x=t-.5*this._nodeSize.x,this.minPos.y=e-.5*this._nodeSize.y,this.minPos.z=i-.5*this._nodeSize.z,this._updateBoundingNode()},e._initModuleList=function(){var t=this;Out.forEach((function(e){var i=t._particleSystem[e];i&&i.enable&&(i.needUpdate&&(t._updateList[i.name]=i),i.needAnimate&&(t._animateList[i.name]=i))})),this._runAnimateList.length=0;for(var e=0,i=rit.length;e<i;e++){var n=this._animateList[rit[e]];n&&this._runAnimateList.push(n)}},e._emit=function(t,e,i){var n=this._particleSystem,r=this._node,s=n.time%n.duration/n.duration;r.invalidateChildren(om.POSITION),n.simulationSpace===oit.World&&(r.getWorldMatrix(Cut),r.getWorldRotation(xut));for(var a=0;a<t;++a){var o=new jet(n);o.particleSystem=n,o.reset();var h=ki(Fi(0,S));n._shapeModule&&n._shapeModule.enable?n._shapeModule.emit(o):(hn.set(o.position,0,0,0),hn.copy(o.velocity,mit)),n._textureAnimationModule&&n._textureAnimationModule.enable&&n._textureAnimationModule.init(o);var u=n.startSpeed.evaluate(s,h);hn.multiplyScalar(o.velocity,o.velocity,u),n.simulationSpace===oit.World&&(hn.transformMat4(o.position,o.position,Cut),hn.transformQuat(o.velocity,o.velocity,xut)),hn.copy(o.ultimateVelocity,o.velocity),hn.set(o.rotation,0,0,0),n.startSize3D?hn.set(o.startSize,n.startSizeX.evaluate(s,h),n.startSizeY.evaluate(s,h),n.startSizeZ.evaluate(s,h)):(hn.set(o.startSize,n.startSizeX.evaluate(s,h),1,1),o.startSize.y=o.startSize.x),hn.copy(o.size,o.startSize),o.startLifetime=n.startLifetime.evaluate(s,h)+e,o.remainingLifetime=o.startLifetime,i.push(o)}},e._updateParticles=function(t,e){var i=this,n=this._particleSystem;switch(n.node.getWorldMatrix(Cut),n.scaleSpace){case oit.Local:n.node.getScale(Iut);break;case oit.World:n.node.getWorldScale(Iut)}if(this._updateList.forEach((function(t){t.update(n.simulationSpace,Cut)})),n.simulationSpace===oit.Local){var r=n.node.getRotation();Dn.fromQuat(this._localMat,r),this._localMat.transpose()}n.node.parent&&(n.node.parent.getWorldMatrix(wut),wut.invert());for(var s=function(){var r=e[a];if(r.remainingLifetime-=t,hn.set(r.animatedVelocity,0,0,0),n.gravityModifier.mode!==_et.Constant||0!==n.gravityModifier.constant){var s=Rit(n.gravityModifier)?ki(r.randomSeed):0;if(n.simulationSpace===oit.Local){var o=9.8*-n.gravityModifier.evaluate(1-r.remainingLifetime/r.startLifetime,s)*t;i._gravity.x=0,i._gravity.y=o,i._gravity.z=0,i._gravity.w=1,xi(o,0,Ci)||(n.node.parent&&(i._gravity=i._gravity.transformMat4(wut)),i._gravity=i._gravity.transformMat4(i._localMat),r.velocity.x+=i._gravity.x,r.velocity.y+=i._gravity.y,r.velocity.z+=i._gravity.z)}else r.velocity.y-=9.8*n.gravityModifier.evaluate(1-r.remainingLifetime/r.startLifetime,s)*t}hn.copy(r.ultimateVelocity,r.velocity),i._runAnimateList.forEach((function(e){e.animate(r,t)})),hn.scaleAndAdd(r.position,r.position,r.ultimateVelocity,t)},a=0;a<e.length;++a)s()},e._calculateBounding=function(t){var e=new hn,i=new hn,n=new hn,r=new hn,s=new hn(1,1,1);if(this._processor.getInfo().renderMode===lit.Mesh){var a=this._processor.getInfo().mesh;if(a&&a.struct.minPosition&&a.struct.maxPosition){var o=new Es;Es.fromPoints(o,a.struct.minPosition,a.struct.maxPosition);var h=Math.max(o.halfExtents.x,o.halfExtents.y,o.halfExtents.z);s.set(h,h,h)}}for(var u=this._particleSystem.node.worldMatrix,l=0;l<this._particlesAll.length;++l){var c=this._particlesAll[l];hn.multiply(e,Iut,c.size),hn.multiply(e,e,s),i.set(c.position),this._particleSystem.simulationSpace!==oit.World&&hn.transformMat4(i,i,u),t&&0===l?(hn.subtract(this.minPos,i,e),hn.add(this.maxPos,i,e)):(hn.subtract(n,i,e),hn.add(r,i,e),hn.min(this.minPos,this.minPos,n),hn.max(this.maxPos,this.maxPos,r))}},e.calculatePositions=function(){this._emit(this._particleSystem.capacity,0,this._particlesAll);var t=Rit(this._particleSystem.startLifetime)?ki(Fi(0,S)):0;this._updateParticles(0,this._particlesAll),this._calculateBounding(!0),this._updateParticles(this._particleSystem.startLifetime.evaluate(0,t),this._particlesAll),this._calculateBounding(!1),this._updateBoundingNode()},e.clear=function(){this._particlesAll.length=0},e.destroy=function(){},t}(),Mut=ra,Put=xa,But=(jat=qs("cc.NoiseModule"),Yat=Put(qe),Kat=Put(qe),qat=Put(qe),Qat=Put(qe),Zat=Put(qe),Jat=Put(qe),$at=Put(qe),tot=Put(qe),eot=Put(qe),iot=Put(qe),not=Put(Ke),rot=Put(qe),sot=Put(qe),jat((oot=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)._enable=hot&&hot(),e._strengthX=uot&&uot(),e._strengthY=lot&&lot(),e._strengthZ=cot&&cot(),e._noiseSpeedX=_ot&&_ot(),e._noiseSpeedY=dot&&dot(),e._noiseSpeedZ=fot&&fot(),e._noiseFrequency=pot&&pot(),e._remapX=mot&&mot(),e._remapY=got&&got(),e._remapZ=vot&&vot(),e._octaves=yot&&yot(),e._octaveMultiplier=Tot&&Tot(),e._octaveScale=Sot&&Sot(),e.name=nit,e.noise=new gst,e.samplePosition=new hn,e}s(e,t);var i=e.prototype;return i.animate=function(t,e){this.noise.setTime(t.particleSystem.time),this.noise.setSpeed(this.noiseSpeedX,this.noiseSpeedY,this.noiseSpeedZ),this.noise.setFrequency(this.noiseFrequency),this.noise.setAbs(this.remapX,this.remapY,this.remapZ),this.noise.setAmplititude(this.strengthX,this.strengthY,this.strengthZ),this.noise.setOctaves(this.octaves,this.octaveMultiplier,this.octaveScale),this.samplePosition.set(t.position),this.samplePosition.add3f(1*Bi(),1*Bi(),1*Bi()),this.noise.setSamplePoint(this.samplePosition),this.noise.getNoiseParticle();var i=this.noise.getResult();i.multiply3f(Bi(),Bi(),Bi()),hn.add(t.position,t.position,i.multiplyScalar(e))},i.getNoisePreview=function(t,e,i,n){this.noise.setTime(e.time),this.noise.setSpeed(this.noiseSpeedX,this.noiseSpeedY,this.noiseSpeedZ),this.noise.setFrequency(this.noiseFrequency),this.noise.setAbs(this.remapX,this.remapY,this.remapZ),this.noise.setAmplititude(this.strengthX,this.strengthY,this.strengthZ),this.noise.setOctaves(this.octaves,this.octaveMultiplier,this.octaveScale),this.noise.getNoiseParticle(),this.noise.getPreview(t,i,n)},n(e,[{key:"enable",get:function(){return this._enable},set:function(t){this._enable!==t&&(this._enable=t,this.target&&this.target.enableModule(this.name,t,this))}},{key:"strengthX",get:function(){return this._strengthX},set:function(t){this._strengthX=t}},{key:"strengthY",get:function(){return this._strengthY},set:function(t){this._strengthY=t}},{key:"strengthZ",get:function(){return this._strengthZ},set:function(t){this._strengthZ=t}},{key:"noiseSpeedX",get:function(){return this._noiseSpeedX},set:function(t){this._noiseSpeedX=t}},{key:"noiseSpeedY",get:function(){return this._noiseSpeedY},set:function(t){this._noiseSpeedY=t}},{key:"noiseSpeedZ",get:function(){return this._noiseSpeedZ},set:function(t){this._noiseSpeedZ=t}},{key:"noiseFrequency",get:function(){return this._noiseFrequency},set:function(t){this._noiseFrequency=t}},{key:"remapX",get:function(){return this._remapX},set:function(t){this._remapX=t}},{key:"remapY",get:function(){return this._remapY},set:function(t){this._remapY=t}},{key:"remapZ",get:function(){return this._remapZ},set:function(t){this._remapZ=t}},{key:"octaves",get:function(){return this._octaves},set:function(t){this._octaves=t}},{key:"octaveMultiplier",get:function(){return this._octaveMultiplier},set:function(t){this._octaveMultiplier=t}},{key:"octaveScale",get:function(){return this._octaveScale},set:function(t){this._octaveScale=t}}]),e}(ait),hot=Gs(oot.prototype,"_enable",[Mut],(function(){return!1})),f(oot.prototype,"strengthX",[Yat],Object.getOwnPropertyDescriptor(oot.prototype,"strengthX"),oot.prototype),uot=Gs(oot.prototype,"_strengthX",[Mut],(function(){return 10})),f(oot.prototype,"strengthY",[Kat],Object.getOwnPropertyDescriptor(oot.prototype,"strengthY"),oot.prototype),lot=Gs(oot.prototype,"_strengthY",[Mut],(function(){return 10})),f(oot.prototype,"strengthZ",[qat],Object.getOwnPropertyDescriptor(oot.prototype,"strengthZ"),oot.prototype),cot=Gs(oot.prototype,"_strengthZ",[Mut],(function(){return 10})),f(oot.prototype,"noiseSpeedX",[Qat],Object.getOwnPropertyDescriptor(oot.prototype,"noiseSpeedX"),oot.prototype),_ot=Gs(oot.prototype,"_noiseSpeedX",[Mut],(function(){return 0})),f(oot.prototype,"noiseSpeedY",[Zat],Object.getOwnPropertyDescriptor(oot.prototype,"noiseSpeedY"),oot.prototype),dot=Gs(oot.prototype,"_noiseSpeedY",[Mut],(function(){return 0})),f(oot.prototype,"noiseSpeedZ",[Jat],Object.getOwnPropertyDescriptor(oot.prototype,"noiseSpeedZ"),oot.prototype),fot=Gs(oot.prototype,"_noiseSpeedZ",[Mut],(function(){return 0})),f(oot.prototype,"noiseFrequency",[$at],Object.getOwnPropertyDescriptor(oot.prototype,"noiseFrequency"),oot.prototype),pot=Gs(oot.prototype,"_noiseFrequency",[Mut],(function(){return 1})),f(oot.prototype,"remapX",[tot],Object.getOwnPropertyDescriptor(oot.prototype,"remapX"),oot.prototype),mot=Gs(oot.prototype,"_remapX",[Mut],(function(){return 0})),f(oot.prototype,"remapY",[eot],Object.getOwnPropertyDescriptor(oot.prototype,"remapY"),oot.prototype),got=Gs(oot.prototype,"_remapY",[Mut],(function(){return 0})),f(oot.prototype,"remapZ",[iot],Object.getOwnPropertyDescriptor(oot.prototype,"remapZ"),oot.prototype),vot=Gs(oot.prototype,"_remapZ",[Mut],(function(){return 0})),f(oot.prototype,"octaves",[not],Object.getOwnPropertyDescriptor(oot.prototype,"octaves"),oot.prototype),yot=Gs(oot.prototype,"_octaves",[Mut],(function(){return 1})),f(oot.prototype,"octaveMultiplier",[rot],Object.getOwnPropertyDescriptor(oot.prototype,"octaveMultiplier"),oot.prototype),Tot=Gs(oot.prototype,"_octaveMultiplier",[Mut],(function(){return.5})),f(oot.prototype,"octaveScale",[sot],Object.getOwnPropertyDescriptor(oot.prototype,"octaveScale"),oot.prototype),Sot=Gs(oot.prototype,"_octaveScale",[Mut],(function(){return 2})),aot=oot))||aot),Nut=new Dn,Lut=new En,Fut=Object.getOwnPropertyDescriptor(RU.prototype,"sharedMaterials"),kut=t("f1",(Eot=qs("cc.ParticleSystem"),Aot=Zs(99),Rot=xa(zet),bot=xa(oit),Cot=sa("startSize"),wot=xa(det),xot=xa(det),Iot=xa(det),Oot=xa(det),Dot=xa(det),Mot=xa(det),Pot=xa(det),Bot=sa("startRotation"),Not=xa(det),Lot=xa(det),Fot=xa(oit),kot=xa(det),Uot=xa(det),Got=xa(det),Hot=xa([ost]),zot=xa(Qe),Vot=xa(hit),Wot=xa(qe),Xot=xa(qe),jot=xa(qe),Yot=sa("enableCulling"),Kot=xa(lnt),qot=xa(lnt),Qot=xa(cst),Zot=xa(cst),Jot=xa(tst),$ot=xa(tst),tht=xa(ast),eht=xa(ast),iht=xa(dnt),nht=xa(dnt),rht=xa(gnt),sht=xa(gnt),aht=xa(Jrt),oht=xa(Jrt),hht=xa(nst),uht=xa(nst),lht=xa(But),cht=xa(But),_ht=xa(but),dht=xa(but),fht=xa(gut),Eot(pht=Aot(((rut=function(t){function e(){var e;return(e=t.call(this)||this).startColor=ght&&ght(),e.scaleSpace=vht&&vht(),e.startSize3D=yht&&yht(),e.startSizeX=Tht&&Tht(),e.startSizeY=Sht&&Sht(),e.startSizeZ=Eht&&Eht(),e.startSpeed=Aht&&Aht(),e.startRotation3D=Rht&&Rht(),e.startRotationX=bht&&bht(),e.startRotationY=Cht&&Cht(),e.startRotationZ=wht&&wht(),e.startDelay=xht&&xht(),e.startLifetime=Iht&&Iht(),e.duration=Oht&&Oht(),e.loop=Dht&&Dht(),e.simulationSpeed=Mht&&Mht(),e.playOnAwake=Pht&&Pht(),e.gravityModifier=Bht&&Bht(),e.rateOverTime=Nht&&Nht(),e.rateOverDistance=Lht&&Lht(),e.bursts=Fht&&Fht(),e._renderCulling=kht&&kht(),e._cullingMode=Uht&&Uht(),e._aabbHalfX=Ght&&Ght(),e._aabbHalfY=Hht&&Hht(),e._aabbHalfZ=zht&&zht(),e._dataCulling=Vht&&Vht(),e._colorOverLifetimeModule=Wht&&Wht(),e._shapeModule=Xht&&Xht(),e._sizeOvertimeModule=jht&&jht(),e._velocityOvertimeModule=Yht&&Yht(),e._forceOvertimeModule=Kht&&Kht(),e._limitVelocityOvertimeModule=qht&&qht(),e._rotationOvertimeModule=Qht&&Qht(),e._textureAnimationModule=Zht&&Zht(),e._noiseModule=Jht&&Jht(),e._trailModule=$ht&&$ht(),e.renderer=tut&&tut(),e._isPlaying=void 0,e._isPaused=void 0,e._isStopped=void 0,e._isEmitting=void 0,e._needToRestart=void 0,e._needRefresh=void 0,e._time=void 0,e._emitRateTimeCounter=void 0,e._emitRateDistanceCounter=void 0,e._oldWPos=void 0,e._curWPos=void 0,e._boundingBox=void 0,e._culler=void 0,e._oldPos=void 0,e._curPos=void 0,e._isCulled=void 0,e._isSimulating=void 0,e._customData1=void 0,e._customData2=void 0,e._subEmitters=void 0,e._needAttach=void 0,e._prewarm=eut&&eut(),e._capacity=iut&&iut(),e._simulationSpace=nut&&nut(),e.processor=null,e.rateOverTime.constant=10,e.startLifetime.constant=5,e.startSizeX.constant=1,e.startSpeed.constant=5,e._isPlaying=!1,e._isPaused=!1,e._isStopped=!0,e._isEmitting=!1,e._needToRestart=!1,e._needRefresh=!0,e._needAttach=!1,e._time=0,e._emitRateTimeCounter=0,e._emitRateDistanceCounter=0,e._oldWPos=new hn,e._curWPos=new hn,e._boundingBox=null,e._culler=null,e._oldPos=null,e._curPos=null,e._isCulled=!1,e._isSimulating=!0,e._customData1=new Fn,e._customData2=new Fn,e._subEmitters=[],e}s(e,t);var i=e.prototype;return i.onFocusInEditor=function(){this.renderer.create(this)},i.onLoad=function(){this.renderer.onInit(this),this._shapeModule&&this._shapeModule.onInit(this),this._trailModule&&!this.renderer.useGPU&&this._trailModule.enable&&this._trailModule.onInit(this),this.bindModule(),this._resetPosition()},i._onMaterialModified=function(t,e){null!==this.processor&&this.processor.onMaterialModified(t,e)},i._onRebuildPSO=function(t,e){this.processor.onRebuildPSO(t,e)},i._collectModels=function(){return this._models.length=0,this._models.push(this.processor._model),this._trailModule&&this._trailModule.enable&&this._trailModule._trailModel&&this._models.push(this._trailModule._trailModel),this._models},i._attachToScene=function(){this.processor.attachToScene(),this._trailModule&&this._trailModule.enable&&this._trailModule._attachToScene()},i._detachFromScene=function(){this.processor.detachFromScene(),this._trailModule&&this._trailModule.enable&&this._trailModule._detachFromScene(),this._boundingBox&&(this._boundingBox=null),this._culler&&(this._culler.clear(),this._culler.destroy(),this._culler=null)},i.bindModule=function(){this._colorOverLifetimeModule&&this._colorOverLifetimeModule.bindTarget(this.processor),this._sizeOvertimeModule&&this._sizeOvertimeModule.bindTarget(this.processor),this._rotationOvertimeModule&&this._rotationOvertimeModule.bindTarget(this.processor),this._forceOvertimeModule&&this._forceOvertimeModule.bindTarget(this.processor),this._limitVelocityOvertimeModule&&this._limitVelocityOvertimeModule.bindTarget(this.processor),this._velocityOvertimeModule&&this._velocityOvertimeModule.bindTarget(this.processor),this._textureAnimationModule&&this._textureAnimationModule.bindTarget(this.processor),this._noiseModule&&this._noiseModule.bindTarget(this.processor)},i.play=function(){if(this._needToRestart&&(this.reset(),this._needToRestart=!1),this._isPaused&&(this._isPaused=!1),this._isStopped&&(this._isStopped=!1),this._isPlaying=!0,this._isEmitting=!0,this._resetPosition(),this._prewarm&&this._prewarmSystem(),this._trailModule&&this._trailModule.play(),this.processor){var t=this.processor.getModel();t&&(t.enabled=this.enabledInHierarchy)}},i.pause=function(){this._isStopped?U("pause(): particle system is already stopped."):(this._isPlaying&&(this._isPlaying=!1),this._isPaused=!0)},i.stopEmitting=function(){this._isEmitting=!1,this._needToRestart=!0},i.stop=function(){(this._isPlaying||this._isPaused)&&this.clear(),this._isPlaying&&(this._isPlaying=!1),this._isPaused&&(this._isPaused=!1),this._isEmitting&&(this._isEmitting=!1),this._isStopped=!0,this._needRefresh=!0,this.reset()},i.reset=function(){this._time=0,this._emitRateTimeCounter=0,this._emitRateDistanceCounter=0,this._resetPosition();for(var t,e=d(this.bursts);!(t=e()).done;)t.value.reset()},i.clear=function(){this.enabledInHierarchy&&(this.processor.clear(),this._trailModule&&this._trailModule.clear()),this._calculateBounding(!1)},i.getParticleCount=function(){return this.processor?this.processor.getParticleCount():0},i.setCustomData1=function(t,e){Fn.set(this._customData1,t,e)},i.setCustomData2=function(t,e){Fn.set(this._customData2,t,e)},i.onDestroy=function(){var t;this.stop(),null!==(t=this.processor.getModel())&&void 0!==t&&t.scene&&(this.processor.detachFromScene(),this._trailModule&&this._trailModule.enable&&this._trailModule._detachFromScene()),v.director.off(v.Director.EVENT_BEFORE_COMMIT,this.beforeRender,this),this.processor.onDestroy(),this._trailModule&&this._trailModule.destroy(),this._culler&&(this._culler.clear(),this._culler.destroy(),this._culler=null)},i.onEnable=function(){t.prototype.onEnable.call(this),v.director.on(v.Director.EVENT_BEFORE_COMMIT,this.beforeRender,this),this.playOnAwake&&this.play(),this.processor.onEnable(),this._trailModule&&this._trailModule.onEnable()},i.onDisable=function(){v.director.off(v.Director.EVENT_BEFORE_COMMIT,this.beforeRender,this),this.processor.onDisable(),this._trailModule&&this._trailModule.onDisable(),this._boundingBox&&(this._boundingBox=null),this._culler&&(this._culler.clear(),this._culler.destroy(),this._culler=null)},i._calculateBounding=function(t){this._boundingBox&&(this._culler||(this._culler=new Dut(this)),this._culler.calculatePositions(),Es.fromPoints(this._boundingBox,this._culler.minPos,this._culler.maxPos),t?(this.aabbHalfX=this._boundingBox.halfExtents.x,this.aabbHalfY=this._boundingBox.halfExtents.y,this.aabbHalfZ=this._boundingBox.halfExtents.z):(this.aabbHalfX?this.setBoundingX(this.aabbHalfX):this.aabbHalfX=this._boundingBox.halfExtents.x,this.aabbHalfY?this.setBoundingY(this.aabbHalfY):this.aabbHalfY=this._boundingBox.halfExtents.y,this.aabbHalfZ?this.setBoundingZ(this.aabbHalfZ):this.aabbHalfZ=this._boundingBox.halfExtents.z),this._culler.clear())},i.update=function(t){var e,i,n=t*this.simulationSpeed;if(this.renderCulling){var r;if(this._boundingBox||(this._boundingBox=new Es,this._calculateBounding(!1)),this._curPos||(this._curPos=new hn),this.node.getWorldPosition(this._curPos),this._oldPos||(this._oldPos=new hn,this._oldPos.set(this._curPos)),!this._curPos.equals(this._oldPos)&&this._boundingBox&&this._culler){var s=this._curPos.x-this._oldPos.x,a=this._curPos.y-this._oldPos.y,o=this._curPos.z-this._oldPos.z,h=this._boundingBox.center;h.x+=s,h.y+=a,h.z+=o,this._culler.setBoundingBoxCenter(h.x,h.y,h.z),this._oldPos.set(this._curPos)}var u=null===(r=this.node.scene.renderScene)||void 0===r?void 0:r.cameras,l=!0;if(void 0!==u&&this._boundingBox)for(var c=0;c<u.length;++c){var _=u[c];if((_.visibility&this.node.layer)===this.node.layer&&us.aabbFrustum(this._boundingBox,_.frustum)){l=!1;break}}if(l){if(this._cullingMode!==hit.AlwaysSimulate&&(this._isSimulating=!1),this._isCulled||(this.processor.detachFromScene(),this._isCulled=!0),this._trailModule&&this._trailModule.enable&&this._trailModule._detachFromScene(),this._cullingMode===hit.PauseAndCatchup&&(this._time+=n),this._cullingMode!==hit.AlwaysSimulate)return}else this._isCulled&&(this._attachToScene(),this._isCulled=!1),this._isSimulating||(this._isSimulating=!0);if(!this._isSimulating)return}else this._boundingBox&&(this._boundingBox=null),this._culler&&(this._culler.clear(),this._culler.destroy(),this._culler=null),this._isSimulating=!0;if(this._isPlaying)this._time+=n,this._emit(n),0!==this.processor.updateParticles(n)||this._isEmitting||this.stop();else{var d=(this.getMaterialInstance(0)||this.processor.getDefaultMaterial()).passes[0];this.processor.updateRotation(d),this.processor.updateScale(d)}this._needAttach&&this.getParticleCount()>0&&!this._isCulled&&(null!==(e=this.processor.getModel())&&void 0!==e&&e.scene||this.processor.attachToScene(),this._trailModule&&this._trailModule.enable&&(null!==(i=this._trailModule.getModel())&&void 0!==i&&i.scene||this._trailModule._attachToScene()),this._needAttach=!1);!this.renderer.useGPU&&this._trailModule&&this._trailModule.enable&&(this._trailModule.inited||(this._trailModule.clear(),this._trailModule.destroy(),this._trailModule.onInit(this),this._trailModule.enable=!1,this._trailModule.enable=!0))},i.beforeRender=function(){var t,e;this.getParticleCount()<=0?null!==(e=this.processor.getModel())&&void 0!==e&&e.scene&&(this.processor.detachFromScene(),this._trailModule&&this._trailModule.enable&&this._trailModule._detachFromScene(),this._needAttach=!1):null!==(t=this.processor.getModel())&&void 0!==t&&t.scene||(this._needAttach=!0),this._isPlaying&&(this.processor.updateRenderData(),this.processor.beforeRender(),this._trailModule&&this._trailModule.enable&&(this._trailModule.updateRenderData(),this._trailModule.beforeRender()))},i._onVisibilityChange=function(t){this.processor.model&&(this.processor.model.visFlags=t)},i.emit=function(t,e){var i=this._time%this.duration/this.duration;this._needRefresh&&(this.node.invalidateChildren(om.POSITION),this._needRefresh=!1),this._simulationSpace===oit.World&&(this.node.getWorldMatrix(Nut),this.node.getWorldRotation(Lut));for(var n=0;n<t;++n){var r=this.processor.getFreeParticle();if(null===r)return;r.particleSystem=this,r.reset();var s=ki(Fi(0,S));this._shapeModule&&this._shapeModule.enable?this._shapeModule.emit(r):(hn.set(r.position,0,0,0),hn.copy(r.velocity,mit)),this._textureAnimationModule&&this._textureAnimationModule.enable&&this._textureAnimationModule.init(r);var a=this.startSpeed.evaluate(i,s);hn.multiplyScalar(r.velocity,r.velocity,a),this._simulationSpace===oit.World&&(hn.transformMat4(r.position,r.position,Nut),hn.transformQuat(r.velocity,r.velocity,Lut)),hn.copy(r.ultimateVelocity,r.velocity),this.startRotation3D?r.startEuler.set(this.startRotationX.evaluate(i,s),this.startRotationY.evaluate(i,s),this.startRotationZ.evaluate(i,s)):r.startEuler.set(0,0,this.startRotationZ.evaluate(i,s)),r.rotation.set(r.startEuler),this.startSize3D?hn.set(r.startSize,this.startSizeX.evaluate(i,s),this.startSizeY.evaluate(i,s),this.startSizeZ.evaluate(i,s)):(hn.set(r.startSize,this.startSizeX.evaluate(i,s),1,1),r.startSize.y=r.startSize.x),hn.copy(r.size,r.startSize),r.startColor.set(this.startColor.evaluate(i,s)),r.color.set(r.startColor),r.startLifetime=this.startLifetime.evaluate(i,s)+e,r.remainingLifetime=r.startLifetime,r.randomSeed=Fi(0,233280),r.loopCount++,this.processor.setNewParticle(r)}},i._prewarmSystem=function(){this.startDelay.mode=_et.Constant,this.startDelay.constant=0;for(var t=this.duration/1,e=0;e<t;++e)this._time+=1,this._emit(1),this.processor.updateParticles(1)},i._emit=function(t){var e=this.startDelay.evaluate(0,1);if(this._time>e){if(this._time>this.duration+e&&(this.loop||(this._isEmitting=!1)),!this._isEmitting)return;if(this._emitRateTimeCounter+=this.rateOverTime.evaluate(this._time/this.duration,1)*t,this._emitRateTimeCounter>1){var i=Math.floor(this._emitRateTimeCounter);this._emitRateTimeCounter-=i,this.emit(i,t)}var n=this.rateOverDistance.evaluate(this._time/this.duration,1);if(n>0){hn.copy(this._oldWPos,this._curWPos),this.node.getWorldPosition(this._curWPos);var r=hn.distance(this._curWPos,this._oldWPos);this._emitRateDistanceCounter+=r*n}if(this._emitRateDistanceCounter>1){var s=Math.floor(this._emitRateDistanceCounter);this._emitRateDistanceCounter-=s,this.emit(s,t)}for(var a,o=d(this.bursts);!(a=o()).done;)a.value.update(this,t)}},i._resetPosition=function(){this.node.getWorldPosition(this._oldWPos),hn.copy(this._curWPos,this._oldWPos)},i.addSubEmitter=function(t){this._subEmitters.push(t)},i.removeSubEmitter=function(t){this._subEmitters.splice(this._subEmitters.indexOf(t),1)},i.addBurst=function(t){this.bursts.push(t)},i.removeBurst=function(t){this.bursts.splice(this.bursts.indexOf(t),1)},i.getBoundingX=function(){return this._aabbHalfX},i.getBoundingY=function(){return this._aabbHalfY},i.getBoundingZ=function(){return this._aabbHalfZ},i.setBoundingX=function(t){this._boundingBox&&this._culler&&(this._boundingBox.halfExtents.x=t,this._culler.setBoundingBoxSize(this._boundingBox.halfExtents),this._aabbHalfX=t)},i.setBoundingY=function(t){this._boundingBox&&this._culler&&(this._boundingBox.halfExtents.y=t,this._culler.setBoundingBoxSize(this._boundingBox.halfExtents),this._aabbHalfY=t)},i.setBoundingZ=function(t){this._boundingBox&&this._culler&&(this._boundingBox.halfExtents.z=t,this._culler.setBoundingBoxSize(this._boundingBox.halfExtents),this._aabbHalfZ=t)},i._onBeforeSerialize=function(t){var e=this;return this.dataCulling?t.filter((function(t){return!sit.includes(t)||e[t]&&e[t].enable})):t},i.getNoisePreview=function(t,e){var i=[];return this.processor&&this.processor.getNoisePreview(i,t,e),i},n(e,[{key:"capacity",get:function(){return this._capacity},set:function(t){this._capacity=Math.floor(t>0?t:0),this.processor&&this.processor.model&&this.processor.model.setCapacity(this._capacity)}},{key:"prewarm",get:function(){return this._prewarm},set:function(t){!0===t&&this.loop,this._prewarm=t}},{key:"simulationSpace",get:function(){return this._simulationSpace},set:function(t){t!==this._simulationSpace&&(this._simulationSpace=t,this.processor&&(this.processor.updateMaterialParams(),this.processor.updateTrailMaterial()))}},{key:"renderCulling",get:function(){return this._renderCulling},set:function(t){this._renderCulling=t,t&&(this._boundingBox||(this._boundingBox=new Es,this._calculateBounding(!1)))}},{key:"cullingMode",get:function(){return this._cullingMode},set:function(t){this._cullingMode=t}},{key:"aabbHalfX",get:function(){return this.getBoundingX()||0},set:function(t){this.setBoundingX(t)}},{key:"aabbHalfY",get:function(){return this.getBoundingY()||0},set:function(t){this.setBoundingY(t)}},{key:"aabbHalfZ",get:function(){return this.getBoundingZ()||0},set:function(t){this.setBoundingZ(t)}},{key:"dataCulling",get:function(){return this._dataCulling},set:function(t){this._dataCulling=t}},{key:"sharedMaterials",get:function(){return Fut.get.call(this)},set:function(t){Fut.set.call(this,t)}},{key:"colorOverLifetimeModule",get:function(){return this._colorOverLifetimeModule},set:function(t){t&&(this._colorOverLifetimeModule=t)}},{key:"shapeModule",get:function(){return this._shapeModule},set:function(t){t&&(this._shapeModule=t)}},{key:"sizeOvertimeModule",get:function(){return this._sizeOvertimeModule},set:function(t){t&&(this._sizeOvertimeModule=t)}},{key:"velocityOvertimeModule",get:function(){return this._velocityOvertimeModule},set:function(t){t&&(this._velocityOvertimeModule=t)}},{key:"forceOvertimeModule",get:function(){return this._forceOvertimeModule},set:function(t){t&&(this._forceOvertimeModule=t)}},{key:"limitVelocityOvertimeModule",get:function(){return this._limitVelocityOvertimeModule},set:function(t){t&&(this._limitVelocityOvertimeModule=t)}},{key:"rotationOvertimeModule",get:function(){return this._rotationOvertimeModule},set:function(t){t&&(this._rotationOvertimeModule=t)}},{key:"textureAnimationModule",get:function(){return this._textureAnimationModule},set:function(t){t&&(this._textureAnimationModule=t)}},{key:"noiseModule",get:function(){return this._noiseModule},set:function(t){t&&(this._noiseModule=t)}},{key:"trailModule",get:function(){return this._trailModule},set:function(t){t&&(this._trailModule=t)}},{key:"isPlaying",get:function(){return this._isPlaying}},{key:"isPaused",get:function(){return this._isPaused}},{key:"isStopped",get:function(){return this._isStopped}},{key:"isEmitting",get:function(){return this._isEmitting}},{key:"time",get:function(){return this._time}}]),e}(gW)).CullingMode=hit,ght=Gs((mht=rut).prototype,"startColor",[Rot,ra],(function(){return new zet})),vht=Gs(mht.prototype,"scaleSpace",[bot,ra],(function(){return oit.Local})),yht=Gs(mht.prototype,"startSize3D",[ra],(function(){return!1})),Tht=Gs(mht.prototype,"startSizeX",[Cot,wot],(function(){return new det})),Sht=Gs(mht.prototype,"startSizeY",[xot,ra],(function(){return new det})),Eht=Gs(mht.prototype,"startSizeZ",[Iot,ra],(function(){return new det})),Aht=Gs(mht.prototype,"startSpeed",[Oot,ra],(function(){return new det})),Rht=Gs(mht.prototype,"startRotation3D",[ra],(function(){return!1})),bht=Gs(mht.prototype,"startRotationX",[Dot,ra],(function(){return new det})),Cht=Gs(mht.prototype,"startRotationY",[Mot,ra],(function(){return new det})),wht=Gs(mht.prototype,"startRotationZ",[Pot,Bot],(function(){return new det})),xht=Gs(mht.prototype,"startDelay",[Not,ra],(function(){return new det})),Iht=Gs(mht.prototype,"startLifetime",[Lot,ra],(function(){return new det})),Oht=Gs(mht.prototype,"duration",[ra],(function(){return 5})),Dht=Gs(mht.prototype,"loop",[ra],(function(){return!0})),f(mht.prototype,"simulationSpace",[Fot,ra],Object.getOwnPropertyDescriptor(mht.prototype,"simulationSpace"),mht.prototype),Mht=Gs(mht.prototype,"simulationSpeed",[ra],(function(){return 1})),Pht=Gs(mht.prototype,"playOnAwake",[ra],(function(){return!0})),Bht=Gs(mht.prototype,"gravityModifier",[kot,ra],(function(){return new det})),Nht=Gs(mht.prototype,"rateOverTime",[Uot,ra],(function(){return new det})),Lht=Gs(mht.prototype,"rateOverDistance",[Got,ra],(function(){return new det})),Fht=Gs(mht.prototype,"bursts",[Hot,ra],(function(){return[]})),f(mht.prototype,"renderCulling",[zot],Object.getOwnPropertyDescriptor(mht.prototype,"renderCulling"),mht.prototype),kht=Gs(mht.prototype,"_renderCulling",[ra],(function(){return!1})),f(mht.prototype,"cullingMode",[Vot],Object.getOwnPropertyDescriptor(mht.prototype,"cullingMode"),mht.prototype),Uht=Gs(mht.prototype,"_cullingMode",[ra],(function(){return hit.Pause})),f(mht.prototype,"aabbHalfX",[Wot],Object.getOwnPropertyDescriptor(mht.prototype,"aabbHalfX"),mht.prototype),Ght=Gs(mht.prototype,"_aabbHalfX",[ra],(function(){return 0})),f(mht.prototype,"aabbHalfY",[Xot],Object.getOwnPropertyDescriptor(mht.prototype,"aabbHalfY"),mht.prototype),Hht=Gs(mht.prototype,"_aabbHalfY",[ra],(function(){return 0})),f(mht.prototype,"aabbHalfZ",[jot],Object.getOwnPropertyDescriptor(mht.prototype,"aabbHalfZ"),mht.prototype),zht=Gs(mht.prototype,"_aabbHalfZ",[ra],(function(){return 0})),Vht=Gs(mht.prototype,"_dataCulling",[ra,Yot],(function(){return!1})),f(mht.prototype,"sharedMaterials",[Ia,ra],Object.getOwnPropertyDescriptor(mht.prototype,"sharedMaterials"),mht.prototype),Wht=Gs(mht.prototype,"_colorOverLifetimeModule",[Kot],(function(){return null})),f(mht.prototype,"colorOverLifetimeModule",[qot],Object.getOwnPropertyDescriptor(mht.prototype,"colorOverLifetimeModule"),mht.prototype),Xht=Gs(mht.prototype,"_shapeModule",[Qot],(function(){return null})),f(mht.prototype,"shapeModule",[Zot],Object.getOwnPropertyDescriptor(mht.prototype,"shapeModule"),mht.prototype),jht=Gs(mht.prototype,"_sizeOvertimeModule",[Jot],(function(){return null})),f(mht.prototype,"sizeOvertimeModule",[$ot],Object.getOwnPropertyDescriptor(mht.prototype,"sizeOvertimeModule"),mht.prototype),Yht=Gs(mht.prototype,"_velocityOvertimeModule",[tht],(function(){return null})),f(mht.prototype,"velocityOvertimeModule",[eht],Object.getOwnPropertyDescriptor(mht.prototype,"velocityOvertimeModule"),mht.prototype),Kht=Gs(mht.prototype,"_forceOvertimeModule",[iht],(function(){return null})),f(mht.prototype,"forceOvertimeModule",[nht],Object.getOwnPropertyDescriptor(mht.prototype,"forceOvertimeModule"),mht.prototype),qht=Gs(mht.prototype,"_limitVelocityOvertimeModule",[rht],(function(){return null})),f(mht.prototype,"limitVelocityOvertimeModule",[sht],Object.getOwnPropertyDescriptor(mht.prototype,"limitVelocityOvertimeModule"),mht.prototype),Qht=Gs(mht.prototype,"_rotationOvertimeModule",[aht],(function(){return null})),f(mht.prototype,"rotationOvertimeModule",[oht],Object.getOwnPropertyDescriptor(mht.prototype,"rotationOvertimeModule"),mht.prototype),Zht=Gs(mht.prototype,"_textureAnimationModule",[hht],(function(){return null})),f(mht.prototype,"textureAnimationModule",[uht],Object.getOwnPropertyDescriptor(mht.prototype,"textureAnimationModule"),mht.prototype),Jht=Gs(mht.prototype,"_noiseModule",[lht],(function(){return null})),f(mht.prototype,"noiseModule",[cht],Object.getOwnPropertyDescriptor(mht.prototype,"noiseModule"),mht.prototype),$ht=Gs(mht.prototype,"_trailModule",[_ht],(function(){return null})),f(mht.prototype,"trailModule",[dht],Object.getOwnPropertyDescriptor(mht.prototype,"trailModule"),mht.prototype),tut=Gs(mht.prototype,"renderer",[fht,ra],(function(){return new gut})),eut=Gs(mht.prototype,"_prewarm",[ra],(function(){return!1})),iut=Gs(mht.prototype,"_capacity",[ra],(function(){return 100})),nut=Gs(mht.prototype,"_simulationSpace",[ra],(function(){return oit.Local})),pht=mht))||pht)||pht)),Uut=t("f2",function(){function t(){}return t.instantiate=function(t){return this.registeredSceneEvent||(gL.on(mL.EVENT_BEFORE_SCENE_LAUNCH,this.onSceneUnload,this),this.registeredSceneEvent=!0),this.particleSystemPool.has(t._uuid)||this.particleSystemPool.set(t._uuid,new Pu((function(){return y8(t)||new $m}),1,(function(t){return t.destroy()}))),this.particleSystemPool.get(t._uuid).alloc()},t.destroy=function(t){this.particleSystemPool.has(t._prefab.asset._uuid)&&(this.stop(t),this.particleSystemPool.get(t._prefab.asset._uuid).free(t))},t.play=function(t){for(var e,i=d(t.getComponentsInChildren(kut));!(e=i()).done;)e.value.play()},t.stop=function(t){for(var e,i=d(t.getComponentsInChildren(kut));!(e=i()).done;)e.value.stop()},t.onSceneUnload=function(){this.particleSystemPool.forEach((function(t){return t.destroy()})),this.particleSystemPool.clear()},t}());function Gut(t){v._global.CC_PHYSICS_BUILTIN="builtin"===t,v._global.CC_PHYSICS_CANNON="cannon.js"===t,v._global.CC_PHYSICS_AMMO="bullet"===t}Uut.particleSystemPool=new Map,Uut.registeredSceneEvent=!1,st(ost.prototype,"Burst.prototype",[{name:"minCount"},{name:"maxCount"}]),rt(kut.prototype,"ParticleSystem.prototype",[{name:"enableCulling",newName:"dataCulling"}]),v.ParticleSystemComponent=kut,Jt(kut,"cc.ParticleSystemComponent"),v.BillboardComponent=ret,Jt(ret,"cc.BillboardComponent"),v.LineComponent=Xet,Jt(Xet,"cc.LineComponent"),v.ParticleUtils=Uut,t("fw",sut),function(t){t[t.DYNAMIC=1]="DYNAMIC",t[t.STATIC=2]="STATIC",t[t.KINEMATIC=4]="KINEMATIC"}(sut||t("fw",sut={})),ve(sut),t("fv",aut),function(t){t[t.X_AXIS=0]="X_AXIS",t[t.Y_AXIS=1]="Y_AXIS",t[t.Z_AXIS=2]="Z_AXIS"}(aut||t("fv",aut={})),ve(aut),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"}(out||(out={})),ve(out),function(t){t[t.VERTEX=1]="VERTEX",t[t.LINE=2]="LINE",t[t.TRIANGLE=3]="TRIANGLE",t[t.TETRAHEDRON=4]="TETRAHEDRON"}(hut||(hut={})),ve(hut),t("fx",uut),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"}(uut||t("fx",uut={})),ve(uut),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"}(lut||(lut={})),ve(lut),function(t){t[t.FREE=0]="FREE",t[t.LIMITED=1]="LIMITED",t[t.LOCKED=2]="LOCKED"}(cut||(cut={})),ve(cut),function(t){t[t.DISABLED=0]="DISABLED",t[t.SERVO=1]="SERVO",t[t.INDUCTION=2]="INDUCTION"}(_ut||(_ut={})),ve(_ut),function(t){t[t.BOX=0]="BOX",t[t.CAPSULE=1]="CAPSULE"}(dut||(dut={})),ve(dut),function(t){t[t.DEFAULT=1]="DEFAULT"}(fut||(fut={})),ve(fut),t("fy",put),function(t){t[t.NONE=0]="NONE",t[t.WIRE_FRAME=1]="WIRE_FRAME",t[t.CONSTRAINT=2]="CONSTRAINT",t[t.AABB=4]="AABB"}(put||t("fy",put={})),ve(put);var Hut,zut={id:"",switchTo:function(t){if(zut.runInEditor){var e=zut;if(zut.physicsWorld&&t!==zut.id&&null!=zut.backend[t]?(zut.physicsWorld.destroy(),k("[PHYSICS]: switch from "+zut.id+" to "+t+"."),Gut(t),e.id=t,e.wrapper=zut.backend[t],e.physicsWorld=jut()):(k("[PHYSICS]: using "+t+"."),e.physicsWorld=jut()),mut){var i=e.physicsWorld;i.setGravity(mut.gravity),i.setAllowSleep(mut.allowSleep)}}},register:function(t,e){if(k("[PHYSICS]: register "+t+"."),zut.backend[t]=e,!zut.physicsWorld||zut.id===t){Gut(t);var i=zut;i.id=t,i.wrapper=e}},wrapper:{},backend:{},physicsWorld:null,runInEditor:!0},Vut=function(){return 0},Wut={impl:null,debugDrawFlags:0,debugDrawConstraintSize:0,setGravity:Vut,setAllowSleep:Vut,setDefaultMaterial:Vut,step:Vut,syncAfterEvents:Vut,syncSceneToPhysics:Vut,raycast:Vut,raycastClosest:Vut,sweepBox:Vut,sweepBoxClosest:Vut,sweepSphere:Vut,sweepSphereClosest:Vut,sweepCapsule:Vut,sweepCapsuleClosest:Vut,emitEvents:Vut,destroy:Vut};function Xut(t,e){return null==t&&(zut.id?U(zut.id+" physics does not support "+Hut[e]):Z(9600),!0)}function jut(){return Xut(zut.wrapper.PhysicsWorld,Hut.World)?Wut:new zut.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"}(Hut||(Hut={}));var Yut={impl:null,rigidBody:null,isAwake:!1,isSleepy:!1,isSleeping:!1,initialize:Vut,onEnable:Vut,onDisable:Vut,onDestroy:Vut,setType:Vut,setMass:Vut,setLinearDamping:Vut,setAngularDamping:Vut,useGravity:Vut,setLinearFactor:Vut,setAngularFactor:Vut,setAllowSleep:Vut,wakeUp:Vut,sleep:Vut,clearState:Vut,clearForces:Vut,clearVelocity:Vut,setSleepThreshold:Vut,getSleepThreshold:Vut,getLinearVelocity:Vut,setLinearVelocity:Vut,getAngularVelocity:Vut,setAngularVelocity:Vut,applyForce:Vut,applyLocalForce:Vut,applyImpulse:Vut,applyLocalImpulse:Vut,applyTorque:Vut,applyLocalTorque:Vut,setGroup:Vut,getGroup:Vut,addGroup:Vut,removeGroup:Vut,setMask:Vut,getMask:Vut,addMask:Vut,removeMask:Vut,isUsingCCD:Vut,useCCD:Vut},Kut={INITED:!1},qut={impl:null,collider:null,attachedRigidBody:null,initialize:Vut,onLoad:Vut,onEnable:Vut,onDisable:Vut,onDestroy:Vut,setGroup:Vut,getGroup:Vut,addGroup:Vut,removeGroup:Vut,setMask:Vut,getMask:Vut,addMask:Vut,removeMask:Vut,setMaterial:Vut,setAsTrigger:Vut,setCenter:Vut,getAABB:Vut,getBoundingSphere:Vut,updateSize:Vut,updateRadius:Vut,setRadius:Vut,setCylinderHeight:Vut,setDirection:Vut,setHeight:Vut,setShapeType:Vut,setVertices:Vut,setMesh:Vut,setTerrain:Vut,setNormal:Vut,setConstant:Vut,updateEventListener:Vut};var Qut={INITED:!1},Zut={impl:null,initialize:Vut,onLoad:Vut,onEnable:Vut,onDisable:Vut,onDestroy:Vut,setEnableCollision:Vut,setConnectedBody:Vut,setPivotA:Vut,setPivotB:Vut,setAxis:Vut,setSecondaryAxis:Vut,setBreakForce:Vut,setBreakTorque:Vut,setConstraintMode:Vut,setLinearLimit:Vut,setAngularExtent:Vut,setLinearSoftConstraint:Vut,setLinearStiffness:Vut,setLinearDamping:Vut,setLinearRestitution:Vut,setSwingSoftConstraint:Vut,setTwistSoftConstraint:Vut,setSwingStiffness:Vut,setSwingDamping:Vut,setSwingRestitution:Vut,setTwistStiffness:Vut,setTwistDamping:Vut,setTwistRestitution:Vut,setDriverMode:Vut,setLinearMotorTarget:Vut,setLinearMotorVelocity:Vut,setLinearMotorForceLimit:Vut,setAngularMotorTarget:Vut,setAngularMotorVelocity:Vut,setAngularMotorForceLimit:Vut,setAutoPivotB:Vut,setLimitEnabled:Vut,setLowerLimit:Vut,setUpperLimit:Vut,setMotorEnabled:Vut,setMotorVelocity:Vut,setMotorForceLimit:Vut};var Jut,$ut,tlt,elt={INITED:!1},ilt={initialize:Vut,onLoad:Vut,onEnable:Vut,onDisable:Vut,onDestroy:Vut,onGround:Vut,getPosition:Vut,setPosition:Vut,setStepOffset:Vut,setSlopeLimit:Vut,setContactOffset:Vut,setDetectCollisions:Vut,setOverlapRecovery:Vut,setGroup:Vut,getGroup:Vut,addGroup:Vut,removeGroup:Vut,setMask:Vut,getMask:Vut,addMask:Vut,removeMask:Vut,move:Vut,syncPhysicsToScene:Vut,updateEventListener:Vut,setHalfHeight:Vut,setHalfSideExtent:Vut,setHalfForwardExtent:Vut,setRadius:Vut,setHeight:Vut};!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"}(Jut||(Jut={})),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"}($ut||($ut={})),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"}(tlt||(tlt={}));var nlt={},rlt={BODY_CACHE_NAME:"body",CCT_CACHE_NAME:"cct"};AL.onPostInfrastructureInitDelegate.add((function(){return FL().then((function(){return Promise.all([e.import("./bullet.release.wasm-7961ac01.js"),e.import("./bullet.release.wasm-e702f478.js"),e.import("./bullet.release.asm-34d2d331.js")]).then((function(t){var e,i,n,r=t[0].default,s=t[1].default,a=t[2].default;return Ol.hasFeature(Ol.Feature.WASM)?(i=r,n=s,new Promise((function(t,e){var r=function(t){return"[bullet]: bullet wasm lib load failed: "+t};i({instantiateWasm:function(t,i){NL(n,t).then((function(t){i(t.instance,t.module)})).catch((function(t){return e(r(t))}))}}).then((function(t){k("[bullet]:bullet wasm lib loaded."),nlt=t})).then(t).catch((function(t){return e(r(t))}))}))):null!=(e=a)?e().then((function(t){k("[bullet]:bullet asm lib loaded."),nlt=t})):new Promise((function(t){t()}))}))})).catch((function(t){G(t)}))}));var slt={type:"onTriggerEnter",selfCollider:null,otherCollider:null,impl:null},alt={type:"onCollisionEnter",selfCollider:null,otherCollider:null,contacts:[],impl:null},olt={type:"onControllerTriggerEnter",collider:null,characterController:null,impl:null},hlt=function(){function t(){this.BT_TRANSFORM_0=nlt.Transform_new(),this.BT_TRANSFORM_1=nlt.Transform_new(),this.BT_V3_0=nlt.Vec3_new(0,0,0),this.BT_V3_1=nlt.Vec3_new(0,0,0),this.BT_V3_2=nlt.Vec3_new(0,0,0),this.BT_QUAT_0=nlt.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!==nlt.EmptyShape_static()},n(t,null,[{key:"instance",get:function(){return null==t._instance&&(t._instance=new t),t._instance}}]),t}();hlt._instance=void 0,hlt.ROOT={};var ult=new hn,llt=new hn,clt=new hn,_lt=new En,dlt=new En,flt=new Dn;new Dn;var plt,mlt,glt,vlt,ylt,Tlt,Slt,Elt,Alt,Rlt,blt,Clt,wlt=new pn;function xlt(t,e){return nlt.Vec3_set(t,e.x,e.y,e.z),t}function Ilt(t,e){var i=nlt.HEAPF32.subarray(e/4,e/4+3);return t.x=i[0],t.y=i[1],t.z=i[2],t}function Olt(t,e){return nlt.Quat_set(t,e.x,e.y,e.z,e.w),t}function Dlt(t,e){var i=nlt.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 Mlt(t,e){for(var i=e.renderingSubMeshes.length,n=0;n<i;n++){var r=e.renderingSubMeshes[n],s=r.geometricInfo;if(s){var a=r.primitiveMode,o=s.positions,h=s.indices,u=hlt.instance.BT_V3_0,l=hlt.instance.BT_V3_1,c=hlt.instance.BT_V3_2;if(a===vc.TRIANGLE_LIST)for(var _=h.length,d=0;d<_;d+=3){var f=3*h[d],p=3*h[d+1],m=3*h[d+2];nlt.Vec3_set(u,o[f],o[f+1],o[f+2]),nlt.Vec3_set(l,o[p],o[p+1],o[p+2]),nlt.Vec3_set(c,o[m],o[m+1],o[m+2]),nlt.TriangleMesh_addTriangle(t,u,l,c,!1)}else if(a===vc.TRIANGLE_STRIP)for(var g=h.length-2,v=0,y=0;y<g;y+=1){var T=3*h[y-v],S=3*h[y+v+1],E=3*h[y+2];v=~v,nlt.Vec3_set(u,o[T],o[T+1],o[T+2]),nlt.Vec3_set(l,o[S],o[S+1],o[S+2]),nlt.Vec3_set(c,o[E],o[E+1],o[E+2]),nlt.TriangleMesh_addTriangle(t,u,l,c,!1)}else if(a===vc.TRIANGLE_FAN){var A=h.length-1,R=3*h[0];nlt.Vec3_set(u,o[R],o[R+1],o[R+2]);for(var b=1;b<A;b+=1){var C=3*h[b],w=3*h[b+1];nlt.Vec3_set(l,o[C],o[C+1],o[C+2]),nlt.Vec3_set(c,o[w],o[w+1],o[w+2]),nlt.TriangleMesh_addTriangle(t,u,l,c,!1)}}}}return t}function Plt(t,e){return t*e}rlt.CACHE=hlt;var Blt=t("fb",(plt=qs("cc.PhysicsMaterial"),mlt=xa(qe),glt=xa(qe),vlt=xa(qe),ylt=xa(qe),plt(((Clt=function(t){function e(){var i;return(i=t.call(this)||this).id=void 0,i._friction=Elt&&Elt(),i._rollingFriction=Alt&&Alt(),i._spinningFriction=Rlt&&Rlt(),i._restitution=blt&&blt(),e.allMaterials.push(c(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){wi(this._friction,t)||(this._friction=t,this.emit(e.EVENT_UPDATE))}},{key:"rollingFriction",get:function(){return this._rollingFriction},set:function(t){wi(this._rollingFriction,t)||(this._rollingFriction=t,this.emit(e.EVENT_UPDATE))}},{key:"spinningFriction",get:function(){return this._spinningFriction},set:function(t){wi(this._spinningFriction,t)||(this._spinningFriction=t,this.emit(e.EVENT_UPDATE))}},{key:"restitution",get:function(){return this._restitution},set:function(t){wi(this._restitution,t)||(this._restitution=t,this.emit(e.EVENT_UPDATE))}}]),e}(uf)).allMaterials=[],Clt.EVENT_UPDATE="event_update",Clt._idCounter=0,f((Slt=Clt).prototype,"friction",[mlt],Object.getOwnPropertyDescriptor(Slt.prototype,"friction"),Slt.prototype),f(Slt.prototype,"rollingFriction",[glt],Object.getOwnPropertyDescriptor(Slt.prototype,"rollingFriction"),Slt.prototype),f(Slt.prototype,"spinningFriction",[vlt],Object.getOwnPropertyDescriptor(Slt.prototype,"spinningFriction"),Slt.prototype),f(Slt.prototype,"restitution",[ylt],Object.getOwnPropertyDescriptor(Slt.prototype,"restitution"),Slt.prototype),Elt=Gs(Slt.prototype,"_friction",[ra],(function(){return.6})),Alt=Gs(Slt.prototype,"_rollingFriction",[ra],(function(){return 0})),Rlt=Gs(Slt.prototype,"_spinningFriction",[ra],(function(){return 0})),blt=Gs(Slt.prototype,"_restitution",[ra],(function(){return 0})),Tlt=Slt))||Tlt)),Nlt=t("fc",function(){function t(){this._hitPoint=new hn,this._hitNormal=new hn,this._distance=0,this._collider=null}var e=t.prototype;return e._assign=function(t,e,i,n){hn.copy(this._hitPoint,t),hn.copy(this._hitNormal,n),this._distance=e,this._collider=i},e.clone=function(){var e=new t;return hn.copy(e._hitPoint,this._hitPoint),hn.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}()),Llt=t("fd",function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._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 hn.copy(t._hitPoint,this._hitPoint),hn.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}(Nlt)),Flt=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=fut.DEFAULT}else{for(var r=0;r<32;r++)this[""+(1<<r)]=0;this[1]=fut.DEFAULT}};v.internal.PhysicsGroup=fut;var klt,Ult,Glt,Hlt,zlt,Vlt,Wlt,Xlt,jlt,Ylt,Klt,qlt,Qlt,Zlt,Jlt,$lt,tct=t("f7",function(t){s(i,t);var e=i.prototype;function i(){var e;return(e=t.call(this)||this).raycastClosestResult=new Nlt,e.raycastResults=[],e.lineStripCastClosestResult=new Llt,e.lineStripCastResults=[],e.sweepCastClosestResult=new Nlt,e.sweepCastResults=[],e.collisionMatrix=new Flt(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 hn(0,-10,0),e._material=void 0,e.raycastOptions={group:-1,mask:-1,queryTrigger:!0,maxDistance:1e7},e.raycastResultPool=new Bu((function(){return new Nlt}),1),e.sweepResultPool=new Bu((function(){return new Nlt}),1),e}return e.setDefaultPhysicsMaterial=function(t){this._material=t,this.physicsWorld.setDefaultMaterial(this._material),this._material.on(Blt.EVENT_UPDATE,this._updateMaterial,this)},e.initDefaultMaterial=function(){var t=this;if(null!=this._material)return Promise.resolve();var e=aS.get("default-physics-material");if(!e)return console.error("PhysicsSystem initDefaultMaterial() Failed to load builtinMaterial"),Promise.resolve();var i=be.querySettings(Re.Category.PHYSICS,"defaultMaterial");return i?new Promise((function(t,e){eS.loadAny(i,(function(i,n){return!i&&n instanceof Blt?t(n):e(i)}))})).then((function(e){t.setDefaultPhysicsMaterial(e)})).catch((function(n){U(n),U("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,gL.emit(mL.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++}gL.emit(mL.EVENT_AFTER_PHYSICS)}}else this.physicsWorld.syncSceneToPhysics()},e.resetConfiguration=function(t){var e=t?t.allowSleep:be.querySettings(Re.Category.PHYSICS,"allowSleep");"boolean"==typeof e&&(this._allowSleep=e);var i=t?t.fixedTimeStep:be.querySettings(Re.Category.PHYSICS,"fixedTimeStep");"number"==typeof i&&(this._fixedTimeStep=i);var n=t?t.maxSubSteps:be.querySettings(Re.Category.PHYSICS,"maxSubSteps");"number"==typeof n&&(this._maxSubSteps=n);var r=t?t.sleepThreshold:be.querySettings(Re.Category.PHYSICS,"sleepThreshold");"number"==typeof r&&(this._sleepThreshold=r);var s=t?t.autoSimulation:be.querySettings(Re.Category.PHYSICS,"autoSimulation");"boolean"==typeof s&&(this.autoSimulation=s);var a=t?t.gravity:be.querySettings(Re.Category.PHYSICS,"gravity");a&&hn.copy(this._gravity,a);var o=t?t.collisionMatrix:be.querySettings(Re.Category.PHYSICS,"collisionMatrix");if(o)for(var h in o)this.collisionMatrix[""+(1<<parseInt(h))]=o[h];var u=t?t.collisionGroups:be.querySettings(Re.Category.PHYSICS,"collisionGroups");u&&u instanceof Array&&(u.forEach((function(t){fut[t.name]=1<<t.index})),ve.update(fut)),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 hr,a=1;a<t.length&&!(r>i);++a){var o=t[a-1],h=t[a],u=new hn;hn.subtract(u,h,o);var l=hn.len(u);if(r+=l,hn.multiplyScalar(u,u,1/l),s.d=u,s.o=o,this.raycast(s,e,l,n))for(var c=0;c<this.raycastResults.length;c++){var _=this.raycastResults[c];if(0!==c||!hn.equals(o,_.hitPoint)){var d=new Llt;d._assign(_.hitPoint,_.distance,_.collider,_.hitNormal,a-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 hr,a=!1,o=1;o<t.length&&!(r>i);++o){var h=t[o-1],u=t[o],l=new hn;hn.subtract(l,u,h);var c=hn.len(l);if(r+=c,hn.multiplyScalar(l,l,1/c),s.d=l,s.o=h,a=this.raycastClosest(s,e,c,n)){var _=this.raycastClosestResult,d=new Llt;d._assign(_.hitPoint,_.distance,_.collider,_.hitNormal,o-1),this.lineStripCastClosestResult=d;break}}return a},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,a){return void 0===r&&(r=4294967295),void 0===s&&(s=1e7),void 0===a&&(a=!0),!!this.physicsWorld&&(this.sweepResultPool.reset(),this.sweepCastResults.length=0,this.raycastOptions.mask=r>>>0,this.raycastOptions.maxDistance=s,this.raycastOptions.queryTrigger=a,this.physicsWorld.sweepCapsule(t,e,i,n,this.raycastOptions,this.sweepResultPool,this.sweepCastResults))},e.sweepCapsuleClosest=function(t,e,i,n,r,s,a){return void 0===r&&(r=4294967295),void 0===s&&(s=1e7),void 0===a&&(a=!0),!!this.physicsWorld&&(this.raycastOptions.mask=r>>>0,this.raycastOptions.maxDistance=s,this.raycastOptions.queryTrigger=a,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=be.querySettings(Re.Category.PHYSICS,"enabled"))||void 0===t||t)&&!i._instance){var e=new i;i._instance=e,e.resetConfiguration(),function(t){if(mut||(mut=t),zut.runInEditor&&!zut.physicsWorld){k("[PHYSICS]: using "+zut.id+".");var e=zut.physicsWorld=jut();e.setGravity(mut.gravity),e.setAllowSleep(mut.allowSleep)}}(e),gL.registerSystem(i.ID,e,e.priority),AL.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 zut.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!zut.id}},{key:"PHYSICS_BUILTIN",get:function(){return"builtin"===zut.id}},{key:"PHYSICS_CANNON",get:function(){return"cannon.js"===zut.id}},{key:"PHYSICS_BULLET",get:function(){return"bullet"===zut.id}},{key:"PHYSICS_PHYSX",get:function(){return"physx"===zut.id}},{key:"PhysicsGroup",get:function(){return fut}},{key:"instance",get:function(){return i._instance}}]),i}(Lu));tct.ID="PHYSICS",tct._instance=null,gL.once(mL.EVENT_INIT,(function(){tct.constructAndRegister()}));var ect,ict,nct,rct,sct,act,oct,hct,uct,lct,cct,_ct=t("f8",(klt=qs("cc.RigidBody"),Ult=Zs(-1),Glt=xa(tct.PhysicsGroup),Hlt=xa(sut),klt(zlt=Js(zlt=Ult((($lt=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=Wlt&&Wlt(),e._type=Xlt&&Xlt(),e._mass=jlt&&jlt(),e._allowSleep=Ylt&&Ylt(),e._linearDamping=Klt&&Klt(),e._angularDamping=qlt&&qlt(),e._useGravity=Qlt&&Qlt(),e._linearFactor=Zlt&&Zlt(),e._angularFactor=Jlt&&Jlt(),e}s(e,t);var i=e.prototype;return i.onLoad=function(){zut.runInEditor&&(this._body=Xut(zut.wrapper.RigidBody,Hut.RigidBody)?Yut:new zut.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){hn.copy(this._linearFactor,t),this._body&&this._body.setLinearFactor(this._linearFactor)}},{key:"angularFactor",get:function(){return this._angularFactor},set:function(t){hn.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===sut.STATIC},set:function(t){t&&this.isStatic||!t&&!this.isStatic||(this.type=t?sut.STATIC:sut.DYNAMIC)}},{key:"isDynamic",get:function(){return this._type===sut.DYNAMIC},set:function(t){t&&this.isDynamic||!t&&!this.isDynamic||(this.type=t?sut.DYNAMIC:sut.KINEMATIC)}},{key:"isKinematic",get:function(){return this._type===sut.KINEMATIC},set:function(t){t&&this.isKinematic||!t&&!this.isKinematic||(this.type=t?sut.KINEMATIC:sut.DYNAMIC)}},{key:"body",get:function(){return this._body}},{key:"_isInitialized",get:function(){var t=null===this._body;return t&&G("[Physics]: This component has not been call onLoad yet, please make sure the node has been added to the scene."),!t}}]),e}(op)).Type=sut,f((Vlt=$lt).prototype,"group",[Glt],Object.getOwnPropertyDescriptor(Vlt.prototype,"group"),Vlt.prototype),f(Vlt.prototype,"type",[Hlt],Object.getOwnPropertyDescriptor(Vlt.prototype,"type"),Vlt.prototype),Wlt=Gs(Vlt.prototype,"_group",[ra],(function(){return tct.PhysicsGroup.DEFAULT})),Xlt=Gs(Vlt.prototype,"_type",[ra],(function(){return sut.DYNAMIC})),jlt=Gs(Vlt.prototype,"_mass",[ra],(function(){return 1})),Ylt=Gs(Vlt.prototype,"_allowSleep",[ra],(function(){return!0})),Klt=Gs(Vlt.prototype,"_linearDamping",[ra],(function(){return.1})),qlt=Gs(Vlt.prototype,"_angularDamping",[ra],(function(){return.1})),Qlt=Gs(Vlt.prototype,"_useGravity",[ra],(function(){return!0})),Zlt=Gs(Vlt.prototype,"_linearFactor",[ra],(function(){return new hn(1,1,1)})),Jlt=Gs(Vlt.prototype,"_angularFactor",[ra],(function(){return new hn(1,1,1)})),zlt=Vlt))||zlt)||zlt)||zlt));_ct||t("f8",_ct={});var dct,fct,pct,mct,gct,vct=t("fe",(ect=qs("cc.Collider"),ict=xa(_ct),nct=xa(Blt),rct=xa(hn),sct=xa(Blt),ect(((cct=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=hct&&hct(),i._isTrigger=uct&&uct(),i._center=lct&&lct(),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(){zut.runInEditor&&(this.sharedMaterial=this._material,this._shape=function(t){return Kut.INITED||(Kut.INITED=!0,Kut[uut.BOX]=function(){return Xut(zut.wrapper.BoxShape,Hut.BoxCollider)?qut:new zut.wrapper.BoxShape},Kut[uut.SPHERE]=function(){return Xut(zut.wrapper.SphereShape,Hut.SphereCollider)?qut:new zut.wrapper.SphereShape},Kut[uut.CAPSULE]=function(){return Xut(zut.wrapper.CapsuleShape,Hut.CapsuleCollider)?qut:new zut.wrapper.CapsuleShape},Kut[uut.CYLINDER]=function(){return Xut(zut.wrapper.CylinderShape,Hut.CylinderCollider)?qut:new zut.wrapper.CylinderShape},Kut[uut.CONE]=function(){return Xut(zut.wrapper.ConeShape,Hut.ConeCollider)?qut:new zut.wrapper.ConeShape},Kut[uut.MESH]=function(){return Xut(zut.wrapper.TrimeshShape,Hut.MeshCollider)?qut:new zut.wrapper.TrimeshShape},Kut[uut.TERRAIN]=function(){return Xut(zut.wrapper.TerrainShape,Hut.TerrainCollider)?qut:new zut.wrapper.TerrainShape},Kut[uut.SIMPLEX]=function(){return Xut(zut.wrapper.SimplexShape,Hut.SimplexCollider)?qut:new zut.wrapper.SimplexShape},Kut[uut.PLANE]=function(){return Xut(zut.wrapper.PlaneShape,Hut.PlaneCollider)?qut:new zut.wrapper.PlaneShape}),Kut[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(Blt.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(_ct))&&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(Blt.EVENT_UPDATE,this._updateMaterial,this),this._material=this._material.clone(),this._material.on(Blt.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(Blt.EVENT_UPDATE,this._updateMaterial,this),t.on(Blt.EVENT_UPDATE,this._updateMaterial,this),this._isSharedMaterial=!1,this._material=t):t&&!this._material?(t.on(Blt.EVENT_UPDATE,this._updateMaterial,this),this._material=t):!t&&this._material&&(this._material.off(Blt.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){hn.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 Es),this._shape&&this._shape.getAABB(this._aabb),this._aabb}},{key:"boundingSphere",get:function(){return null==this._boundingSphere&&(this._boundingSphere=new yr),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&&G("[Physics]: This component has not been call onLoad yet, please make sure the node has been added to the scene."),!t}}]),e}(Zu(op))).Type=uut,cct.Axis=aut,f((oct=cct).prototype,"attachedRigidBody",[ict],Object.getOwnPropertyDescriptor(oct.prototype,"attachedRigidBody"),oct.prototype),f(oct.prototype,"sharedMaterial",[nct],Object.getOwnPropertyDescriptor(oct.prototype,"sharedMaterial"),oct.prototype),f(oct.prototype,"center",[rct],Object.getOwnPropertyDescriptor(oct.prototype,"center"),oct.prototype),hct=Gs(oct.prototype,"_material",[sct],(function(){return null})),uct=Gs(oct.prototype,"_isTrigger",[ra],(function(){return!1})),lct=Gs(oct.prototype,"_center",[ra],(function(){return new hn})),act=oct))||act));vct||t("fe",vct={});var yct,Tct,Sct,Ect,Act,Rct,bct,Cct,wct,xct,Ict,Oct,Dct,Mct,Pct,Bct,Nct,Lct,Fct,kct,Uct,Gct,Hct,zct,Vct,Wct,Xct,jct,Yct,Kct,qct,Qct,Zct,Jct,$ct,t_t,e_t,i_t,n_t,r_t,s_t,a_t,o_t,h_t,u_t,l_t,c_t,__t=t("ff",(dct=qs("cc.BoxCollider"),fct=xa(hn),dct((f((mct=function(t){function e(){var e;return(e=t.call(this,uut.BOX)||this)._size=gct&&gct(),e}return s(e,t),n(e,[{key:"size",get:function(){return this._size},set:function(t){hn.strictEquals(this._size,t)||(hn.copy(this._size,t),X$(this._size),this._shape&&this.shape.updateSize())}},{key:"shape",get:function(){return this._shape}}]),e}(vct)).prototype,"size",[fct],Object.getOwnPropertyDescriptor(mct.prototype,"size"),mct.prototype),gct=Gs(mct.prototype,"_size",[ra],(function(){return new hn(1,1,1)})),pct=mct))||pct)),d_t=t("fg",qs("cc.SphereCollider")((Tct=function(t){function e(){var e;return(e=t.call(this,uut.SPHERE)||this)._radius=Sct&&Sct(),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}(vct),Sct=Gs(Tct.prototype,"_radius",[ra],(function(){return.5})),yct=Tct))||yct),f_t=t("fh",(Ect=qs("cc.CapsuleCollider"),Act=xa(aut),Ect((f((bct=function(t){function e(){var e;return(e=t.call(this,uut.CAPSULE)||this)._radius=Cct&&Cct(),e._cylinderHeight=wct&&wct(),e._direction=xct&&xct(),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===aut.Y_AXIS?Math.abs(ji(t.x,t.z)):this._direction===aut.X_AXIS?Math.abs(ji(t.y,t.z)):Math.abs(ji(t.x,t.y))},i._getHeightScale=function(){if(null==this.node)return 1;var t=this.node.worldScale;return this._direction===aut.Y_AXIS?Math.abs(t.y):this._direction===aut.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))<aut.X_AXIS||t>aut.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}(vct)).prototype,"direction",[Act],Object.getOwnPropertyDescriptor(bct.prototype,"direction"),bct.prototype),Cct=Gs(bct.prototype,"_radius",[ra],(function(){return.5})),wct=Gs(bct.prototype,"_cylinderHeight",[ra],(function(){return 1})),xct=Gs(bct.prototype,"_direction",[ra],(function(){return aut.Y_AXIS})),Rct=bct))||Rct)),p_t=t("fj",(Ict=qs("cc.CylinderCollider"),Oct=xa(aut),Ict((f((Mct=function(t){function e(){var e;return(e=t.call(this,uut.CYLINDER)||this)._radius=Pct&&Pct(),e._height=Bct&&Bct(),e._direction=Nct&&Nct(),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<aut.X_AXIS||t>aut.Z_AXIS||(this._direction=t,this._shape&&this.shape.setDirection(t)))}},{key:"shape",get:function(){return this._shape}}]),e}(vct)).prototype,"direction",[Oct],Object.getOwnPropertyDescriptor(Mct.prototype,"direction"),Mct.prototype),Pct=Gs(Mct.prototype,"_radius",[ra],(function(){return.5})),Bct=Gs(Mct.prototype,"_height",[ra],(function(){return 2})),Nct=Gs(Mct.prototype,"_direction",[ra],(function(){return aut.Y_AXIS})),Dct=Mct))||Dct)),m_t=t("fk",(Lct=qs("cc.ConeCollider"),Fct=xa(aut),Lct((f((Uct=function(t){function e(){var e;return(e=t.call(this,uut.CONE)||this)._radius=Gct&&Gct(),e._height=Hct&&Hct(),e._direction=zct&&zct(),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<aut.X_AXIS||t>aut.Z_AXIS||(this._direction=t,this._shape&&this.shape.setDirection(t)))}},{key:"shape",get:function(){return this._shape}}]),e}(vct)).prototype,"direction",[Fct],Object.getOwnPropertyDescriptor(Uct.prototype,"direction"),Uct.prototype),Gct=Gs(Uct.prototype,"_radius",[ra],(function(){return.5})),Hct=Gs(Uct.prototype,"_height",[ra],(function(){return 1})),zct=Gs(Uct.prototype,"_direction",[ra],(function(){return aut.Y_AXIS})),kct=Uct))||kct)),g_t=t("fi",(Vct=qs("cc.MeshCollider"),Wct=xa(QL),Vct((f((jct=function(t){function e(){var e;return(e=t.call(this,uut.MESH)||this)._mesh=Yct&&Yct(),e._convex=Kct&&Kct(),e}return s(e,t),e.prototype.onEnable=function(){if(t.prototype.onEnable.call(this),this.node){var e=this.node.getComponent(_ct);e&&e.isValid&&e.type===sut.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}(vct)).prototype,"mesh",[Wct],Object.getOwnPropertyDescriptor(jct.prototype,"mesh"),jct.prototype),Yct=Gs(jct.prototype,"_mesh",[ra],(function(){return null})),Kct=Gs(jct.prototype,"_convex",[ra],(function(){return!1})),Xct=jct))||Xct)),v_t=t("fa",qs("cc.ConstantForce")(qct=Qs(_ct)(qct=Js((Qct=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=Zct&&Zct(),e._localForce=Jct&&Jct(),e._torque=$ct&&$ct(),e._localTorque=t_t&&t_t(),e._mask=0,e}s(e,t);var i=e.prototype;return i.onLoad=function(){this._rigidBody=this.node.getComponent(_ct),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(hn.ZERO)?this._mask&=~e:this._mask|=e},n(e,[{key:"force",get:function(){return this._force},set:function(t){hn.copy(this._force,t),this._maskUpdate(this._force,1)}},{key:"localForce",get:function(){return this._localForce},set:function(t){hn.copy(this._localForce,t),this._maskUpdate(this.localForce,2)}},{key:"torque",get:function(){return this._torque},set:function(t){hn.copy(this._torque,t),this._maskUpdate(this._torque,4)}},{key:"localTorque",get:function(){return this._localTorque},set:function(t){hn.copy(this._localTorque,t),this._maskUpdate(this._localTorque,8)}}]),e}(op),Zct=Gs(Qct.prototype,"_force",[ra],(function(){return new hn})),Jct=Gs(Qct.prototype,"_localForce",[ra],(function(){return new hn})),$ct=Gs(Qct.prototype,"_torque",[ra],(function(){return new hn})),t_t=Gs(Qct.prototype,"_localTorque",[ra],(function(){return new hn})),qct=Qct))||qct)||qct)||qct),y_t=32768,T_t=1/128,S_t=16842754,E_t=16842755,A_t=16842756,R_t=16842758,b_t=16842759,C_t=16842760,w_t=16843025,x_t=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}();qs("cc.TerrainLayerInfo")((e_t=function(){this.slot=i_t&&i_t(),this.tileSize=n_t&&n_t(),this.detailMap=r_t&&r_t(),this.normalMap=s_t&&s_t(),this.roughness=a_t&&a_t(),this.metallic=o_t&&o_t()},i_t=Gs(e_t.prototype,"slot",[ra],(function(){return 0})),n_t=Gs(e_t.prototype,"tileSize",[ra],(function(){return 1})),r_t=Gs(e_t.prototype,"detailMap",[ra],(function(){return null})),s_t=Gs(e_t.prototype,"normalMap",[ra],(function(){return null})),a_t=Gs(e_t.prototype,"roughness",[ra],(function(){return 1})),o_t=Gs(e_t.prototype,"metallic",[ra],(function(){return 0})),e_t));var I_t,O_t,D_t,M_t,P_t,B_t,N_t,L_t,F_t,k_t,U_t,G_t,H_t,z_t,V_t,W_t,X_t,j_t,Y_t=qs("cc.TerrainLayerBinaryInfo")(h_t=function(){this.slot=0,this.tileSize=1,this.roughness=1,this.metallic=0,this.detailMapId="",this.normalMapId=""})||h_t,K_t=qs("cc.TerrainAsset")((l_t=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=c_t&&c_t(),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]-y_t)*T_t},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 x_t;if(e.assign(t),this._version=e.readInt(),this._version===w_t)return!0;if(16842753!==this._version&&this._version!==S_t&&this._version!==E_t&&this._version!==A_t&&16842757!==this._version&&this._version!==R_t&&this._version!==b_t&&this._version!==C_t)return!1;this._version>=b_t?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<C_t)for(var r=0;r<this.heights.length;++r){var s=.001953125*(this._heights[r]-y_t),a=y_t+s/T_t;this.heights[r]=a}if(this._version>=R_t){var o=e.readInt();this.normals=new Float32Array(o);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 l=0;l<this.weights.length;++l)this.weights[l]=e.readInt8();if(this._version>=S_t){var c=e.readInt();this.layerBuffer=new Array(c);for(var _=0;_<this.layerBuffer.length;++_)this.layerBuffer[_]=e.readInt16()}if(this._version>=E_t){var d=e.readInt();this._layerBinaryInfos=new Array(d);for(var f=0;f<this._layerBinaryInfos.length;++f)this._layerBinaryInfos[f]=new Y_t,this._layerBinaryInfos[f].slot=e.readInt(),this._version>=b_t?this._layerBinaryInfos[f].tileSize=e.readDouble():this._layerBinaryInfos[f].tileSize=e.readFloat(),this._layerBinaryInfos[f].detailMapId=e.readString(),this._version>=A_t&&(this._layerBinaryInfos[f].normalMapId=e.readString(),this._version>=b_t?(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 x_t;t.writeInt32(C_t),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 a=0;a<s.length;++a){var o=this.layerInfos[a],h=new Y_t;h.slot=a,h.tileSize=o.tileSize,h.detailMapId=o.detailMap?o.detailMap._uuid:"",h.normalMapId=o.normalMap?o.normalMap._uuid:"",h.metallic=o.metallic,h.roughness=o.roughness,s[a]=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 x_t;return t.writeInt32(w_t),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}(uf),c_t=Gs(l_t.prototype,"_layerInfos",[ra],(function(){return[]})),u_t=l_t))||u_t,q_t=t("fl",(I_t=qs("cc.TerrainCollider"),O_t=xa(K_t),I_t((f((M_t=function(t){function e(){var e;return(e=t.call(this,uut.TERRAIN)||this)._terrain=P_t&&P_t(),e}return s(e,t),e.prototype.onEnable=function(){if(t.prototype.onEnable.call(this),this.node){var e=this.node.getComponent(_ct);e&&e.isValid&&e.type===sut.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}(vct)).prototype,"terrain",[O_t],Object.getOwnPropertyDescriptor(M_t.prototype,"terrain"),M_t.prototype),P_t=Gs(M_t.prototype,"_terrain",[ra],(function(){return null})),D_t=M_t))||D_t)),Q_t=t("fm",(B_t=qs("cc.SimplexCollider"),N_t=xa(hut),B_t(((G_t=function(t){function e(){var e;return(e=t.call(this,uut.SIMPLEX)||this)._shapeType=k_t&&k_t(),e._vertices=U_t&&U_t(),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){hn.copy(this._vertices[0],t),this.updateVertices()}},{key:"vertex1",get:function(){return this._vertices[1]},set:function(t){hn.copy(this._vertices[1],t),this.updateVertices()}},{key:"vertex2",get:function(){return this._vertices[2]},set:function(t){hn.copy(this._vertices[2],t),this.updateVertices()}},{key:"vertex3",get:function(){return this._vertices[3]},set:function(t){hn.copy(this._vertices[3],t),this.updateVertices()}},{key:"shape",get:function(){return this._shape}},{key:"vertices",get:function(){return this._vertices}}]),e}(vct)).ESimplexType=hut,f((F_t=G_t).prototype,"shapeType",[N_t],Object.getOwnPropertyDescriptor(F_t.prototype,"shapeType"),F_t.prototype),k_t=Gs(F_t.prototype,"_shapeType",[ra],(function(){return hut.TETRAHEDRON})),U_t=Gs(F_t.prototype,"_vertices",[ra],(function(){return[new hn(0,0,0),new hn(0,0,1),new hn(1,0,0),new hn(0,1,0)]})),L_t=F_t))||L_t));Q_t||t("fm",Q_t={});var Z_t,J_t,$_t,tdt,edt,idt,ndt,rdt,sdt,adt,odt,hdt,udt,ldt,cdt,_dt,ddt,fdt,pdt,mdt,gdt,vdt,ydt,Tdt,Sdt,Edt,Adt,Rdt,bdt,Cdt,wdt,xdt,Idt,Odt,Ddt,Mdt,Pdt,Bdt,Ndt,Ldt,Fdt,kdt,Udt,Gdt,Hdt,zdt,Vdt,Wdt,Xdt,jdt,Ydt,Kdt,qdt,Qdt,Zdt,Jdt,$dt=t("fn",(H_t=qs("cc.PlaneCollider"),z_t=xa(hn),H_t((f((W_t=function(t){function e(){var e;return(e=t.call(this,uut.PLANE)||this)._normal=X_t&&X_t(),e._constant=j_t&&j_t(),e}return s(e,t),e.prototype.onEnable=function(){if(t.prototype.onEnable.call(this),this.node){var e=this.node.getComponent(_ct);e&&e.isValid&&e.type===sut.DYNAMIC&&q(9630,this.node.name)}},n(e,[{key:"normal",get:function(){return this._normal},set:function(t){hn.strictEquals(this._normal,t)||(hn.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}(vct)).prototype,"normal",[z_t],Object.getOwnPropertyDescriptor(W_t.prototype,"normal"),W_t.prototype),X_t=Gs(W_t.prototype,"_normal",[ra],(function(){return new hn(0,1,0)})),j_t=Gs(W_t.prototype,"_constant",[ra],(function(){return 0})),V_t=W_t))||V_t)),tft=t("fo",(Z_t=qs("cc.Constraint"),J_t=Qs(_ct),$_t=xa(_ct),tdt=xa(_ct),edt=xa(_ct),Z_t(idt=J_t(((adt=function(t){function e(e){var i;return(i=t.call(this)||this).TYPE=void 0,i._enableCollision=rdt&&rdt(),i._connectedBody=sdt&&sdt(),i._constraint=null,i.TYPE=e,i}s(e,t);var i=e.prototype;return i.onLoad=function(){zut.runInEditor&&(this._constraint=function(t){return Qut.INITED||(Qut.INITED=!0,Qut[lut.POINT_TO_POINT]=function(){return Xut(zut.wrapper.PointToPointConstraint,Hut.PointToPointConstraint)?Zut:new zut.wrapper.PointToPointConstraint},Qut[lut.HINGE]=function(){return Xut(zut.wrapper.HingeConstraint,Hut.HingeConstraint)?Zut:new zut.wrapper.HingeConstraint},Qut[lut.FIXED]=function(){return Xut(zut.wrapper.FixedConstraint,Hut.FixedConstraint)?Zut:new zut.wrapper.FixedConstraint},Qut[lut.CONFIGURABLE]=function(){return Xut(zut.wrapper.ConfigurableConstraint,Hut.ConfigurableConstraint)?Zut:new zut.wrapper.ConfigurableConstraint}),Qut[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(_ct)}},{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}(Zu(op))).Type=lut,f((ndt=adt).prototype,"attachedBody",[$_t],Object.getOwnPropertyDescriptor(ndt.prototype,"attachedBody"),ndt.prototype),f(ndt.prototype,"connectedBody",[tdt],Object.getOwnPropertyDescriptor(ndt.prototype,"connectedBody"),ndt.prototype),rdt=Gs(ndt.prototype,"_enableCollision",[ra],(function(){return!0})),sdt=Gs(ndt.prototype,"_connectedBody",[edt],(function(){return null})),idt=ndt))||idt)||idt));tft||t("fo",tft={});var eft,ift,nft,rft,sft,aft,oft,hft,uft,lft,cft,_ft,dft,fft,pft,mft,gft,vft,yft,Tft,Sft,Eft,Aft,Rft,bft,Cft,wft,xft,Ift,Oft,Dft,Mft,Pft,Bft,Nft,Lft,Fft,kft,Uft,Gft,Hft,zft,Vft,Wft,Xft,jft,Yft,Kft,qft,Qft,Zft,Jft,$ft,tpt,ept,ipt,npt,rpt,spt,apt,opt,hpt,upt,lpt,cpt,_pt,dpt,fpt,ppt,mpt,gpt,vpt,ypt,Tpt,Spt,Ept,Apt,Rpt,bpt,Cpt,wpt,xpt,Ipt,Opt,Dpt,Mpt,Ppt,Bpt,Npt,Lpt,Fpt,kpt,Upt,Gpt,Hpt,zpt,Vpt,Wpt,Xpt,jpt,Ypt,Kpt,qpt,Qpt,Zpt,Jpt,$pt,tmt,emt,imt,nmt,rmt,smt,amt,omt,hmt,umt,lmt,cmt,_mt,dmt,fmt,pmt,mmt,gmt,vmt,ymt,Tmt,Smt,Emt,Amt,Rmt,bmt,Cmt,wmt,xmt,Imt,Omt,Dmt,Mmt,Pmt,Bmt,Nmt=(odt=qs("cc.HingeLimitData"),hdt=sa("enabled"),udt=sa("upperLimit"),ldt=sa("lowerLimit"),cdt=xa(Qe),_dt=xa(qe),ddt=xa(qe),odt((pdt=function(){function t(){this._enabled=mdt&&mdt(),this._upperLimit=gdt&&gdt(),this._lowerLimit=vdt&&vdt()}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}(),mdt=Gs(pdt.prototype,"_enabled",[ra,hdt],(function(){return!1})),gdt=Gs(pdt.prototype,"_upperLimit",[ra,udt],(function(){return Number.MAX_VALUE})),vdt=Gs(pdt.prototype,"_lowerLimit",[ra,ldt],(function(){return-Number.MAX_VALUE})),f(pdt.prototype,"enabled",[cdt],Object.getOwnPropertyDescriptor(pdt.prototype,"enabled"),pdt.prototype),f(pdt.prototype,"upperLimit",[_dt],Object.getOwnPropertyDescriptor(pdt.prototype,"upperLimit"),pdt.prototype),f(pdt.prototype,"lowerLimit",[ddt],Object.getOwnPropertyDescriptor(pdt.prototype,"lowerLimit"),pdt.prototype),fdt=pdt))||fdt),Lmt=(ydt=qs("cc.HingeMotorData"),Tdt=sa("enabled"),Sdt=sa("motorVelocity"),Edt=sa("motorForceLimit"),Adt=xa(Qe),Rdt=xa(qe),bdt=xa(qe),ydt((wdt=function(){function t(){this._enabled=xdt&&xdt(),this._motorVelocity=Idt&&Idt(),this._motorForceLimit=Odt&&Odt()}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}(),xdt=Gs(wdt.prototype,"_enabled",[ra,Tdt],(function(){return!1})),Idt=Gs(wdt.prototype,"_motorVelocity",[ra,Sdt],(function(){return 0})),Odt=Gs(wdt.prototype,"_motorForceLimit",[ra,Edt],(function(){return 0})),f(wdt.prototype,"enabled",[Adt],Object.getOwnPropertyDescriptor(wdt.prototype,"enabled"),wdt.prototype),f(wdt.prototype,"motorVelocity",[Rdt],Object.getOwnPropertyDescriptor(wdt.prototype,"motorVelocity"),wdt.prototype),f(wdt.prototype,"motorForceLimit",[bdt],Object.getOwnPropertyDescriptor(wdt.prototype,"motorForceLimit"),wdt.prototype),Cdt=wdt))||Cdt),Fmt=t("fp",(Ddt=qs("cc.HingeConstraint"),Mdt=xa(hn),Pdt=xa(hn),Bdt=xa(hn),Ndt=xa(Qe),Ldt=xa(qe),Fdt=xa(qe),kdt=xa(Qe),Udt=xa(qe),Gdt=xa(qe),Hdt=sa("axisA"),zdt=sa("pivotA"),Vdt=sa("pivotB"),Wdt=sa("limitData"),Xdt=sa("motorData"),Ddt((f((Ydt=function(t){function e(){var e;return(e=t.call(this,lut.HINGE)||this)._axis=Kdt&&Kdt(),e._pivotA=qdt&&qdt(),e._pivotB=Qdt&&Qdt(),e._limitData=Zdt&&Zdt(),e._motorData=Jdt&&Jdt(),e}return s(e,t),n(e,[{key:"pivotA",get:function(){return this._pivotA},set:function(t){hn.copy(this._pivotA,t),this.constraint.setPivotA(this._pivotA)}},{key:"pivotB",get:function(){return this._pivotB},set:function(t){hn.copy(this._pivotB,t),this.constraint.setPivotB(this._pivotB)}},{key:"axis",get:function(){return this._axis},set:function(t){hn.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}(tft)).prototype,"pivotA",[Mdt],Object.getOwnPropertyDescriptor(Ydt.prototype,"pivotA"),Ydt.prototype),f(Ydt.prototype,"pivotB",[Pdt],Object.getOwnPropertyDescriptor(Ydt.prototype,"pivotB"),Ydt.prototype),f(Ydt.prototype,"axis",[Bdt],Object.getOwnPropertyDescriptor(Ydt.prototype,"axis"),Ydt.prototype),f(Ydt.prototype,"limitEnabled",[Ndt],Object.getOwnPropertyDescriptor(Ydt.prototype,"limitEnabled"),Ydt.prototype),f(Ydt.prototype,"upperLimit",[Ldt],Object.getOwnPropertyDescriptor(Ydt.prototype,"upperLimit"),Ydt.prototype),f(Ydt.prototype,"lowerLimit",[Fdt],Object.getOwnPropertyDescriptor(Ydt.prototype,"lowerLimit"),Ydt.prototype),f(Ydt.prototype,"motorEnabled",[kdt],Object.getOwnPropertyDescriptor(Ydt.prototype,"motorEnabled"),Ydt.prototype),f(Ydt.prototype,"motorVelocity",[Udt],Object.getOwnPropertyDescriptor(Ydt.prototype,"motorVelocity"),Ydt.prototype),f(Ydt.prototype,"motorForceLimit",[Gdt],Object.getOwnPropertyDescriptor(Ydt.prototype,"motorForceLimit"),Ydt.prototype),Kdt=Gs(Ydt.prototype,"_axis",[ra,Hdt],(function(){return new hn})),qdt=Gs(Ydt.prototype,"_pivotA",[ra,zdt],(function(){return new hn})),Qdt=Gs(Ydt.prototype,"_pivotB",[ra,Vdt],(function(){return new hn})),Zdt=Gs(Ydt.prototype,"_limitData",[ra,Wdt],(function(){return new Nmt})),Jdt=Gs(Ydt.prototype,"_motorData",[ra,Xdt],(function(){return new Lmt})),jdt=Ydt))||jdt)),kmt=t("fr",(eft=qs("cc.FixedConstraint"),ift=xa(qe),nft=xa(qe),rft=sa("breakForce"),sft=sa("breakTorque"),eft((f((oft=function(t){function e(){var e;return(e=t.call(this,lut.FIXED)||this)._breakForce=hft&&hft(),e._breakTorque=uft&&uft(),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}(tft)).prototype,"breakForce",[ift],Object.getOwnPropertyDescriptor(oft.prototype,"breakForce"),oft.prototype),f(oft.prototype,"breakTorque",[nft],Object.getOwnPropertyDescriptor(oft.prototype,"breakTorque"),oft.prototype),hft=Gs(oft.prototype,"_breakForce",[ra,rft],(function(){return 1e8})),uft=Gs(oft.prototype,"_breakTorque",[ra,sft],(function(){return 1e8})),aft=oft))||aft)),Umt=(lft=qs("cc.LinearLimitSettings"),cft=xa(cut),_ft=xa(cut),dft=xa(cut),fft=xa(hn),pft=xa(hn),mft=xa(qe),gft=xa(Qe),vft=xa(qe),yft=xa(qe),lft((f((Sft=function(){function t(t){this._xMotion=Eft&&Eft(),this._yMotion=Aft&&Aft(),this._zMotion=Rft&&Rft(),this._upper=bft&&bft(),this._lower=Cft&&Cft(),this._enableSoftConstraint=wft&&wft(),this._bounciness=xft&&xft(),this._stiffness=Ift&&Ift(),this._damping=Oft&&Oft(),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){hn.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){hn.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",[cft],Object.getOwnPropertyDescriptor(Sft.prototype,"xMotion"),Sft.prototype),f(Sft.prototype,"yMotion",[_ft],Object.getOwnPropertyDescriptor(Sft.prototype,"yMotion"),Sft.prototype),f(Sft.prototype,"zMotion",[dft],Object.getOwnPropertyDescriptor(Sft.prototype,"zMotion"),Sft.prototype),f(Sft.prototype,"upper",[fft],Object.getOwnPropertyDescriptor(Sft.prototype,"upper"),Sft.prototype),f(Sft.prototype,"lower",[pft],Object.getOwnPropertyDescriptor(Sft.prototype,"lower"),Sft.prototype),f(Sft.prototype,"restitution",[mft],Object.getOwnPropertyDescriptor(Sft.prototype,"restitution"),Sft.prototype),f(Sft.prototype,"enableSoftConstraint",[gft],Object.getOwnPropertyDescriptor(Sft.prototype,"enableSoftConstraint"),Sft.prototype),f(Sft.prototype,"stiffness",[vft],Object.getOwnPropertyDescriptor(Sft.prototype,"stiffness"),Sft.prototype),f(Sft.prototype,"damping",[yft],Object.getOwnPropertyDescriptor(Sft.prototype,"damping"),Sft.prototype),Eft=Gs(Sft.prototype,"_xMotion",[ra],(function(){return cut.FREE})),Aft=Gs(Sft.prototype,"_yMotion",[ra],(function(){return cut.FREE})),Rft=Gs(Sft.prototype,"_zMotion",[ra],(function(){return cut.FREE})),bft=Gs(Sft.prototype,"_upper",[ra],(function(){return new hn})),Cft=Gs(Sft.prototype,"_lower",[ra],(function(){return new hn})),wft=Gs(Sft.prototype,"_enableSoftConstraint",[ra],(function(){return!1})),xft=Gs(Sft.prototype,"_bounciness",[ra],(function(){return 0})),Ift=Gs(Sft.prototype,"_stiffness",[ra],(function(){return 0})),Oft=Gs(Sft.prototype,"_damping",[ra],(function(){return 0})),Tft=Sft))||Tft),Gmt=(Dft=qs("cc.AngularLimitSettings"),Mft=xa(cut),Pft=xa(cut),Bft=xa(cut),Nft=xa(qe),Lft=xa(qe),Fft=xa(qe),kft=xa(qe),Uft=xa(qe),Gft=xa(Qe),Hft=xa(qe),zft=xa(qe),Vft=xa(Qe),Wft=xa(qe),Xft=xa(qe),Dft((f((Yft=function(){function t(t){this._swing1Motion=Kft&&Kft(),this._swing2Motion=qft&&qft(),this._twistMotion=Qft&&Qft(),this._twistExtent=Zft&&Zft(),this._swingExtent1=Jft&&Jft(),this._swingExtent2=$ft&&$ft(),this._enableSoftConstraintSwing=tpt&&tpt(),this._swingBounciness=ept&&ept(),this._swingStiffness=ipt&&ipt(),this._swingDamping=npt&&npt(),this._enableSoftConstraintTwist=rpt&&rpt(),this._twistBounciness=spt&&spt(),this._twistStiffness=apt&&apt(),this._twistDamping=opt&&opt(),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",[Mft],Object.getOwnPropertyDescriptor(Yft.prototype,"twistMotion"),Yft.prototype),f(Yft.prototype,"swingMotion1",[Pft],Object.getOwnPropertyDescriptor(Yft.prototype,"swingMotion1"),Yft.prototype),f(Yft.prototype,"swingMotion2",[Bft],Object.getOwnPropertyDescriptor(Yft.prototype,"swingMotion2"),Yft.prototype),f(Yft.prototype,"twistExtent",[Nft],Object.getOwnPropertyDescriptor(Yft.prototype,"twistExtent"),Yft.prototype),f(Yft.prototype,"swingExtent1",[Lft],Object.getOwnPropertyDescriptor(Yft.prototype,"swingExtent1"),Yft.prototype),f(Yft.prototype,"swingExtent2",[Fft],Object.getOwnPropertyDescriptor(Yft.prototype,"swingExtent2"),Yft.prototype),f(Yft.prototype,"twistRestitution",[kft],Object.getOwnPropertyDescriptor(Yft.prototype,"twistRestitution"),Yft.prototype),f(Yft.prototype,"swingRestitution",[Uft],Object.getOwnPropertyDescriptor(Yft.prototype,"swingRestitution"),Yft.prototype),f(Yft.prototype,"enableSoftConstraintTwist",[Gft],Object.getOwnPropertyDescriptor(Yft.prototype,"enableSoftConstraintTwist"),Yft.prototype),f(Yft.prototype,"twistStiffness",[Hft],Object.getOwnPropertyDescriptor(Yft.prototype,"twistStiffness"),Yft.prototype),f(Yft.prototype,"twistDamping",[zft],Object.getOwnPropertyDescriptor(Yft.prototype,"twistDamping"),Yft.prototype),f(Yft.prototype,"enableSoftConstraintSwing",[Vft],Object.getOwnPropertyDescriptor(Yft.prototype,"enableSoftConstraintSwing"),Yft.prototype),f(Yft.prototype,"swingStiffness",[Wft],Object.getOwnPropertyDescriptor(Yft.prototype,"swingStiffness"),Yft.prototype),f(Yft.prototype,"swingDamping",[Xft],Object.getOwnPropertyDescriptor(Yft.prototype,"swingDamping"),Yft.prototype),Kft=Gs(Yft.prototype,"_swing1Motion",[ra],(function(){return cut.FREE})),qft=Gs(Yft.prototype,"_swing2Motion",[ra],(function(){return cut.FREE})),Qft=Gs(Yft.prototype,"_twistMotion",[ra],(function(){return cut.FREE})),Zft=Gs(Yft.prototype,"_twistExtent",[ra],(function(){return 0})),Jft=Gs(Yft.prototype,"_swingExtent1",[ra],(function(){return 0})),$ft=Gs(Yft.prototype,"_swingExtent2",[ra],(function(){return 0})),tpt=Gs(Yft.prototype,"_enableSoftConstraintSwing",[ra],(function(){return!1})),ept=Gs(Yft.prototype,"_swingBounciness",[ra],(function(){return 0})),ipt=Gs(Yft.prototype,"_swingStiffness",[ra],(function(){return 0})),npt=Gs(Yft.prototype,"_swingDamping",[ra],(function(){return 0})),rpt=Gs(Yft.prototype,"_enableSoftConstraintTwist",[ra],(function(){return!1})),spt=Gs(Yft.prototype,"_twistBounciness",[ra],(function(){return 0})),apt=Gs(Yft.prototype,"_twistStiffness",[ra],(function(){return 0})),opt=Gs(Yft.prototype,"_twistDamping",[ra],(function(){return 0})),jft=Yft))||jft),Hmt=(hpt=qs("cc.LinearDriverSettings"),upt=xa(_ut),lpt=xa(_ut),cpt=xa(_ut),_pt=xa(hn),dpt=xa(hn),fpt=xa(qe),hpt((f((mpt=function(){function t(t){this._target=gpt&&gpt(),this._velocity=vpt&&vpt(),this._xDrive=ypt&&ypt(),this._yDrive=Tpt&&Tpt(),this._zDrive=Spt&&Spt(),this._strength=Ept&&Ept(),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){hn.copy(this._target,t),this._impl.setLinearMotorTarget(t)}},{key:"targetVelocity",get:function(){return this._velocity},set:function(t){hn.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",[upt],Object.getOwnPropertyDescriptor(mpt.prototype,"xDrive"),mpt.prototype),f(mpt.prototype,"yDrive",[lpt],Object.getOwnPropertyDescriptor(mpt.prototype,"yDrive"),mpt.prototype),f(mpt.prototype,"zDrive",[cpt],Object.getOwnPropertyDescriptor(mpt.prototype,"zDrive"),mpt.prototype),f(mpt.prototype,"targetPosition",[_pt],Object.getOwnPropertyDescriptor(mpt.prototype,"targetPosition"),mpt.prototype),f(mpt.prototype,"targetVelocity",[dpt],Object.getOwnPropertyDescriptor(mpt.prototype,"targetVelocity"),mpt.prototype),f(mpt.prototype,"strength",[fpt],Object.getOwnPropertyDescriptor(mpt.prototype,"strength"),mpt.prototype),gpt=Gs(mpt.prototype,"_target",[ra],(function(){return new hn})),vpt=Gs(mpt.prototype,"_velocity",[ra],(function(){return new hn})),ypt=Gs(mpt.prototype,"_xDrive",[ra],(function(){return _ut.DISABLED})),Tpt=Gs(mpt.prototype,"_yDrive",[ra],(function(){return _ut.DISABLED})),Spt=Gs(mpt.prototype,"_zDrive",[ra],(function(){return _ut.DISABLED})),Ept=Gs(mpt.prototype,"_strength",[ra],(function(){return 0})),ppt=mpt))||ppt),zmt=(Apt=qs("cc.AngularDriverSettings"),Rpt=xa(_ut),bpt=xa(_ut),Cpt=xa(_ut),wpt=xa(hn),xpt=xa(hn),Ipt=xa(qe),Apt((f((Dpt=function(){function t(t){this._swingDrive1=Mpt&&Mpt(),this._swingDrive2=Ppt&&Ppt(),this._twistDrive=Bpt&&Bpt(),this._targetOrientation=Npt&&Npt(),this._targetVelocity=Lpt&&Lpt(),this._strength=Fpt&&Fpt(),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){hn.copy(this._targetOrientation,t),this._impl.setAngularMotorTarget(t)}},{key:"targetVelocity",get:function(){return this._targetVelocity},set:function(t){hn.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",[Rpt],Object.getOwnPropertyDescriptor(Dpt.prototype,"twistDrive"),Dpt.prototype),f(Dpt.prototype,"swingDrive1",[bpt],Object.getOwnPropertyDescriptor(Dpt.prototype,"swingDrive1"),Dpt.prototype),f(Dpt.prototype,"swingDrive2",[Cpt],Object.getOwnPropertyDescriptor(Dpt.prototype,"swingDrive2"),Dpt.prototype),f(Dpt.prototype,"targetOrientation",[wpt],Object.getOwnPropertyDescriptor(Dpt.prototype,"targetOrientation"),Dpt.prototype),f(Dpt.prototype,"targetVelocity",[xpt],Object.getOwnPropertyDescriptor(Dpt.prototype,"targetVelocity"),Dpt.prototype),f(Dpt.prototype,"strength",[Ipt],Object.getOwnPropertyDescriptor(Dpt.prototype,"strength"),Dpt.prototype),Mpt=Gs(Dpt.prototype,"_swingDrive1",[ra],(function(){return _ut.DISABLED})),Ppt=Gs(Dpt.prototype,"_swingDrive2",[ra],(function(){return _ut.DISABLED})),Bpt=Gs(Dpt.prototype,"_twistDrive",[ra],(function(){return _ut.DISABLED})),Npt=Gs(Dpt.prototype,"_targetOrientation",[ra],(function(){return new hn})),Lpt=Gs(Dpt.prototype,"_targetVelocity",[ra],(function(){return new hn})),Fpt=Gs(Dpt.prototype,"_strength",[ra],(function(){return 0})),Opt=Dpt))||Opt),Vmt=t("fq",(kpt=qs("cc.ConfigurableConstraint"),Upt=xa(hn),Gpt=xa(hn),Hpt=xa(hn),zpt=xa(hn),Vpt=xa(Qe),Wpt=xa(qe),Xpt=xa(qe),jpt=xa(Umt),Ypt=xa(Gmt),Kpt=xa(Hmt),qpt=xa(zmt),Qpt=sa("linearLimitSettings"),Zpt=sa("angularLimitSettings"),Jpt=sa("linearDriverSettings"),$pt=sa("angularDriverSettings"),kpt((f((emt=function(t){function e(){var e;return(e=t.call(this,lut.CONFIGURABLE)||this)._breakForce=imt&&imt(),e._breakTorque=nmt&&nmt(),e._linearLimitSettings=rmt&&rmt(),e._angularLimitSettings=smt&&smt(),e._linearDriverSettings=amt&&amt(),e._angularDriverSettings=omt&&omt(),e._pivotA=hmt&&hmt(),e._pivotB=umt&&umt(),e._autoPivotB=lmt&&lmt(),e._axis=cmt&&cmt(),e._secondaryAxis=_mt&&_mt(),e._linearLimitSettings=new Umt(e.constraint),e._angularLimitSettings=new Gmt(e.constraint),e._linearDriverSettings=new Hmt(e.constraint),e._angularDriverSettings=new zmt(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){hn.copy(this._axis,t),this.constraint.setAxis(this._axis)}},{key:"secondaryAxis",get:function(){return this._secondaryAxis},set:function(t){hn.copy(this._secondaryAxis,t),this.constraint.setSecondaryAxis(this._secondaryAxis)}},{key:"pivotA",get:function(){return this._pivotA},set:function(t){hn.copy(this._pivotA,t),this.constraint.setPivotA(this._pivotA)}},{key:"pivotB",get:function(){return this._pivotB},set:function(t){hn.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}(tft)).prototype,"axis",[Upt],Object.getOwnPropertyDescriptor(emt.prototype,"axis"),emt.prototype),f(emt.prototype,"secondaryAxis",[Gpt],Object.getOwnPropertyDescriptor(emt.prototype,"secondaryAxis"),emt.prototype),f(emt.prototype,"pivotA",[Hpt],Object.getOwnPropertyDescriptor(emt.prototype,"pivotA"),emt.prototype),f(emt.prototype,"pivotB",[zpt],Object.getOwnPropertyDescriptor(emt.prototype,"pivotB"),emt.prototype),f(emt.prototype,"autoPivotB",[Vpt],Object.getOwnPropertyDescriptor(emt.prototype,"autoPivotB"),emt.prototype),f(emt.prototype,"breakForce",[Wpt],Object.getOwnPropertyDescriptor(emt.prototype,"breakForce"),emt.prototype),f(emt.prototype,"breakTorque",[Xpt],Object.getOwnPropertyDescriptor(emt.prototype,"breakTorque"),emt.prototype),f(emt.prototype,"linearLimitSettings",[jpt],Object.getOwnPropertyDescriptor(emt.prototype,"linearLimitSettings"),emt.prototype),f(emt.prototype,"angularLimitSettings",[Ypt],Object.getOwnPropertyDescriptor(emt.prototype,"angularLimitSettings"),emt.prototype),f(emt.prototype,"linearDriverSettings",[Kpt],Object.getOwnPropertyDescriptor(emt.prototype,"linearDriverSettings"),emt.prototype),f(emt.prototype,"angularDriverSettings",[qpt],Object.getOwnPropertyDescriptor(emt.prototype,"angularDriverSettings"),emt.prototype),imt=Gs(emt.prototype,"_breakForce",[ra],(function(){return 1e8})),nmt=Gs(emt.prototype,"_breakTorque",[ra],(function(){return 1e8})),rmt=Gs(emt.prototype,"_linearLimitSettings",[ra,Qpt],null),smt=Gs(emt.prototype,"_angularLimitSettings",[ra,Zpt],null),amt=Gs(emt.prototype,"_linearDriverSettings",[ra,Jpt],null),omt=Gs(emt.prototype,"_angularDriverSettings",[ra,$pt],null),hmt=Gs(emt.prototype,"_pivotA",[ra],(function(){return new hn})),umt=Gs(emt.prototype,"_pivotB",[ra],(function(){return new hn})),lmt=Gs(emt.prototype,"_autoPivotB",[ra],(function(){return!1})),cmt=Gs(emt.prototype,"_axis",[ra],(function(){return new hn(0,1,0)})),_mt=Gs(emt.prototype,"_secondaryAxis",[ra],(function(){return new hn(1,0,0)})),tmt=emt))||tmt)),Wmt=t("fs",(dmt=qs("cc.PointToPointConstraint"),fmt=xa(hn),pmt=xa(hn),dmt((f((gmt=function(t){function e(){var e;return(e=t.call(this,lut.POINT_TO_POINT)||this)._pivotA=vmt&&vmt(),e._pivotB=ymt&&ymt(),e}return s(e,t),n(e,[{key:"pivotA",get:function(){return this._pivotA},set:function(t){hn.copy(this._pivotA,t),this.constraint.setPivotA(this._pivotA)}},{key:"pivotB",get:function(){return this._pivotB},set:function(t){hn.copy(this._pivotB,t),this.constraint.setPivotB(this._pivotB)}},{key:"constraint",get:function(){return this._constraint}}]),e}(tft)).prototype,"pivotA",[fmt],Object.getOwnPropertyDescriptor(gmt.prototype,"pivotA"),gmt.prototype),f(gmt.prototype,"pivotB",[pmt],Object.getOwnPropertyDescriptor(gmt.prototype,"pivotB"),gmt.prototype),vmt=Gs(gmt.prototype,"_pivotA",[ra],(function(){return new hn})),ymt=Gs(gmt.prototype,"_pivotB",[ra],(function(){return new hn})),mmt=gmt))||mmt));new hn(0,0,0),new hn(0,0,0);var Xmt,jmt,Ymt,Kmt,qmt,Qmt,Zmt,Jmt,$mt,tgt,egt=t("f9",(Tmt=qs("cc.CharacterController"),Smt=xa(tct.PhysicsGroup),Emt=xa(qe),Amt=xa(qe),Rmt=xa(qe),bmt=xa(qe),Cmt=xa(hn),Tmt(wmt=Js((f((xmt=function(t){function e(e){var i;return(i=t.call(this)||this).type=void 0,i._cct=null,i._group=Imt&&Imt(),i._minMoveDistance=Omt&&Omt(),i._stepOffset=Dmt&&Dmt(),i._slopeLimit=Mmt&&Mmt(),i._skinWidth=Pmt&&Pmt(),i._center=Bmt&&Bmt(),i._initialized=!1,i._prevPos=new hn,i._currentPos=new hn,i._velocity=new hn,i._centerWorldPosition=new hn,i._needCollisionEvent=!1,i._needTriggerEvent=!1,i.type=e,i}s(e,t);var i=e.prototype;return i.onLoad=function(){zut.runInEditor&&(this._cct=function(t){return elt.INITED||(elt.INITED=!0,elt[dut.BOX]=function(){return Xut(zut.wrapper.BoxCharacterController,Hut.BoxCharacterController)?ilt:new zut.wrapper.BoxCharacterController},elt[dut.CAPSULE]=function(){return Xut(zut.wrapper.CapsuleCharacterController,Hut.CapsuleCharacterController)?ilt:new zut.wrapper.CapsuleCharacterController}),elt[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=tct.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){hn.equals(this._center,t)||hn.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}(Zu(op))).prototype,"group",[Smt],Object.getOwnPropertyDescriptor(xmt.prototype,"group"),xmt.prototype),f(xmt.prototype,"minMoveDistance",[Emt],Object.getOwnPropertyDescriptor(xmt.prototype,"minMoveDistance"),xmt.prototype),f(xmt.prototype,"stepOffset",[Amt],Object.getOwnPropertyDescriptor(xmt.prototype,"stepOffset"),xmt.prototype),f(xmt.prototype,"slopeLimit",[Rmt],Object.getOwnPropertyDescriptor(xmt.prototype,"slopeLimit"),xmt.prototype),f(xmt.prototype,"skinWidth",[bmt],Object.getOwnPropertyDescriptor(xmt.prototype,"skinWidth"),xmt.prototype),f(xmt.prototype,"center",[Cmt],Object.getOwnPropertyDescriptor(xmt.prototype,"center"),xmt.prototype),Imt=Gs(xmt.prototype,"_group",[ra],(function(){return tct.PhysicsGroup.DEFAULT})),Omt=Gs(xmt.prototype,"_minMoveDistance",[ra],(function(){return.001})),Dmt=Gs(xmt.prototype,"_stepOffset",[ra],(function(){return.5})),Mmt=Gs(xmt.prototype,"_slopeLimit",[ra],(function(){return 45})),Pmt=Gs(xmt.prototype,"_skinWidth",[ra],(function(){return.01})),Bmt=Gs(xmt.prototype,"_center",[ra],(function(){return new hn})),wmt=xmt))||wmt)||wmt));new hn(0,0,0);var igt,ngt,rgt,sgt,agt,ogt,hgt,ugt,lgt=t("fu",(Xmt=qs("cc.BoxCharacterController"),jmt=Zs(-1),Ymt=xa(qe),Kmt=xa(qe),qmt=xa(qe),Xmt(Qmt=jmt((f((Zmt=function(t){function e(){var e;return(e=t.call(this,dut.BOX)||this)._halfHeight=Jmt&&Jmt(),e._halfSideExtent=$mt&&$mt(),e._halfForwardExtent=tgt&&tgt(),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}(egt)).prototype,"halfHeight",[Ymt],Object.getOwnPropertyDescriptor(Zmt.prototype,"halfHeight"),Zmt.prototype),f(Zmt.prototype,"halfSideExtent",[Kmt],Object.getOwnPropertyDescriptor(Zmt.prototype,"halfSideExtent"),Zmt.prototype),f(Zmt.prototype,"halfForwardExtent",[qmt],Object.getOwnPropertyDescriptor(Zmt.prototype,"halfForwardExtent"),Zmt.prototype),Jmt=Gs(Zmt.prototype,"_halfHeight",[ra],(function(){return.5})),$mt=Gs(Zmt.prototype,"_halfSideExtent",[ra],(function(){return.5})),tgt=Gs(Zmt.prototype,"_halfForwardExtent",[ra],(function(){return.5})),Qmt=Zmt))||Qmt)||Qmt));new hn(0,0,0);var cgt=t("ft",(igt=qs("cc.CapsuleCharacterController"),ngt=Zs(-1),rgt=xa(qe),sgt=xa(qe),igt(agt=ngt((f((ogt=function(t){function e(){var e;return(e=t.call(this,dut.CAPSULE)||this)._radius=hgt&&hgt(),e._height=ugt&&ugt(),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}(egt)).prototype,"radius",[rgt],Object.getOwnPropertyDescriptor(ogt.prototype,"radius"),ogt.prototype),f(ogt.prototype,"height",[sgt],Object.getOwnPropertyDescriptor(ogt.prototype,"height"),ogt.prototype),hgt=Gs(ogt.prototype,"_radius",[ra],(function(){return.5})),ugt=Gs(ogt.prototype,"_height",[ra],(function(){return 1})),agt=ogt))||agt)||agt)),_gt=function(){this.worldPosition=new hn,this.worldNormal=new hn,this.motionDirection=new hn,this.motionLength=0};v.PhysicsSystem=tct,v.PhysicsMaterial=Blt,v.PhysicsRayResult=Nlt,v.ConstantForce=v_t;var dgt,fgt,pgt,mgt,ggt,vgt=Object.freeze({__proto__:null,PhysicsSystem:tct,PhysicsRayResult:Nlt,PhysicsLineStripCastResult:Llt,get Collider(){return vct},BoxCollider:__t,SphereCollider:d_t,CapsuleCollider:f_t,MeshCollider:g_t,CylinderCollider:p_t,ConeCollider:m_t,TerrainCollider:q_t,get SimplexCollider(){return Q_t},PlaneCollider:$dt,get Constraint(){return tft},HingeConstraint:Fmt,FixedConstraint:kmt,PointToPointConstraint:Wmt,ConfigurableConstraint:Vmt,get RigidBody(){return _ct},PhysicsMaterial:Blt,ConstantForce:v_t,CharacterController:egt,BoxCharacterController:lgt,CapsuleCharacterController:cgt,selector:zut,utils:m0,CharacterControllerContact:_gt,get ERigidBodyType(){return sut},get EAxisDirection(){return aut},get ED6Axis(){return out},get ESimplexType(){return hut},get EColliderType(){return uut},get EConstraintType(){return lut},get EConstraintMode(){return cut},get EDriverMode(){return _ut},get ECharacterControllerType(){return dut},get PhysicsGroup(){return fut},get EPhysicsDrawFlags(){return put}});t("f6",vgt),rt(tct,"PhysicsSystem",[{name:"ins",newName:"instance"},{name:"PHYSICS_AMMO",newName:"PHYSICS_BULLET"}]),rt(tct.prototype,"PhysicsSystem.prototype",[{name:"deltaTime",newName:"fixedTimeStep"},{name:"maxSubStep",newName:"maxSubSteps"}]),st(tct.prototype,"PhysicsSystem.prototype",[{name:"useFixedTime"},{name:"useCollisionMatrix"},{name:"updateCollisionMatrix"},{name:"resetCollisionMatrix"},{name:"isCollisionGroup"},{name:"setCollisionGroup"}]),rt(vct.prototype,"Collider.prototype",[{name:"attachedRigidbody",newName:"attachedRigidBody"},{name:"TYPE",newName:"type"}]),rt(vct,"Collider",[{name:"EColliderType",newName:"Type"},{name:"EAxisDirection",newName:"Axis"}]),rt(tft,"Constraint",[{name:"EConstraintType",newName:"Type"}]),rt(__t.prototype,"BoxCollider.prototype",[{name:"boxShape",newName:"shape"}]),rt(d_t.prototype,"SphereCollider.prototype",[{name:"sphereShape",newName:"shape"}]),rt(f_t.prototype,"CapsuleCollider.prototype",[{name:"capsuleShape",newName:"shape"}]),rt(_ct.prototype,"RigidBody.prototype",[{name:"rigidBody",newName:"body"}]),rt(_ct,"RigidBody",[{name:"ERigidBodyType",newName:"Type"}]),st(_ct.prototype,"RigidBody.prototype",[{name:"fixedRotation"}]),v.RigidBodyComponent=_ct,Jt(_ct,"cc.RigidBodyComponent"),v.ColliderComponent=vct,Jt(vct,"cc.ColliderComponent"),v.BoxColliderComponent=__t,Jt(__t,"cc.BoxColliderComponent"),v.SphereColliderComponent=d_t,Jt(d_t,"cc.SphereColliderComponent"),Jt(f_t,"cc.CapsuleColliderComponent"),Jt(g_t,"cc.MeshColliderComponent"),Jt(p_t,"cc.CylinderColliderComponent"),v.PhysicMaterial=Blt,Jt(Blt,"cc.PhysicMaterial"),v.physics=vgt,function(t){t[t.BODY_RE_ADD=1]="BODY_RE_ADD",t[t.GHOST_RE_ADD=2]="GHOST_RE_ADD"}(dgt||(dgt={})),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"}(fgt||(fgt={})),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"}(pgt||(pgt={})),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"}(mgt||(mgt={})),function(t){t[t.BT_DISABLE_WORLD_GRAVITY=1]="BT_DISABLE_WORLD_GRAVITY",t[t.BT_ENABLE_GYROPSCOPIC_FORCE=2]="BT_ENABLE_GYROPSCOPIC_FORCE"}(ggt||(ggt={}));var ygt=ult,Tgt=llt,Sgt=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&&(nlt.RigidBody_setMass(this.impl,t),this._wakeUpIfSleep(),this._sharedBody.dirty|=dgt.BODY_RE_ADD)},t.setType=function(t){this._sharedBody.setType(t)},t.setLinearDamping=function(){nlt.RigidBody_setDamping(this.impl,this._rigidBody.linearDamping,this._rigidBody.angularDamping)},t.setAngularDamping=function(){nlt.RigidBody_setDamping(this.impl,this._rigidBody.linearDamping,this._rigidBody.angularDamping)},t.useGravity=function(t){if(this._rigidBody.isDynamic){var e=nlt.RigidBody_getFlags(this.impl);t?e&=~ggt.BT_DISABLE_WORLD_GRAVITY:(nlt.RigidBody_setGravity(this.impl,xlt(hlt.instance.BT_V3_0,hn.ZERO)),e|=ggt.BT_DISABLE_WORLD_GRAVITY),nlt.RigidBody_setFlags(this.impl,e),this._wakeUpIfSleep(),this._sharedBody.dirty|=dgt.BODY_RE_ADD}},t.useCCD=function(t){nlt.CollisionObject_setCcdMotionThreshold(this.impl,t?.01:0),nlt.CollisionObject_setCcdSweptSphereRadius(this.impl,t?.1:0),this._isUsingCCD=t},t.isUsingCCD=function(){return this._isUsingCCD},t.setLinearFactor=function(t){nlt.RigidBody_setLinearFactor(this.impl,xlt(hlt.instance.BT_V3_0,t)),this._wakeUpIfSleep()},t.setAngularFactor=function(t){nlt.RigidBody_setAngularFactor(this.impl,xlt(hlt.instance.BT_V3_0,t)),this._wakeUpIfSleep()},t.setAllowSleep=function(t){this._rigidBody.isDynamic&&(t?nlt.CollisionObject_forceActivationState(this.impl,mgt.ACTIVE_TAG):nlt.CollisionObject_forceActivationState(this.impl,mgt.DISABLE_DEACTIVATION),this._wakeUpIfSleep())},t.clearState=function(){nlt.RigidBody_clearState(this.impl)},t.clearVelocity=function(){this.setLinearVelocity(hn.ZERO),this.setAngularVelocity(hn.ZERO)},t.clearForces=function(){nlt.RigidBody_clearForces(this.impl)},t.initialize=function(t){this._rigidBody=t,this._sharedBody=tct.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),nlt.CollisionObject_activate(this.impl,t)},t.sleep=function(){var t=nlt.CollisionObject_getActivationState(this.impl);t!==mgt.DISABLE_DEACTIVATION&&t!==mgt.DISABLE_SIMULATION&&nlt.CollisionObject_forceActivationState(this.impl,mgt.ISLAND_SLEEPING)},t.setSleepThreshold=function(t){this._wakeUpIfSleep(),nlt.RigidBody_setSleepingThresholds(this.impl,t,t)},t.getSleepThreshold=function(){return nlt.RigidBody_getLinearSleepingThreshold(this.impl)},t.getLinearVelocity=function(t){return Ilt(t,nlt.RigidBody_getLinearVelocity(this.impl))},t.setLinearVelocity=function(t){this._wakeUpIfSleep(),xlt(nlt.RigidBody_getLinearVelocity(this.impl),t)},t.getAngularVelocity=function(t){return Ilt(t,nlt.RigidBody_getAngularVelocity(this.impl))},t.setAngularVelocity=function(t){this._wakeUpIfSleep(),xlt(nlt.RigidBody_getAngularVelocity(this.impl),t)},t.applyLocalForce=function(t,e){this._sharedBody.syncSceneToPhysics(),this._wakeUpIfSleep();var i=this._sharedBody.node.worldRotation,n=hn.transformQuat(ygt,t,i),r=e?hn.transformQuat(Tgt,e,i):hn.ZERO;nlt.RigidBody_applyForce(this.impl,xlt(hlt.instance.BT_V3_0,n),xlt(hlt.instance.BT_V3_1,r))},t.applyLocalTorque=function(t){this._sharedBody.syncSceneToPhysics(),this._wakeUpIfSleep(),hn.transformQuat(ygt,t,this._sharedBody.node.worldRotation),nlt.RigidBody_applyTorque(this.impl,xlt(hlt.instance.BT_V3_0,ygt))},t.applyLocalImpulse=function(t,e){this._sharedBody.syncSceneToPhysics(),this._wakeUpIfSleep();var i=this._sharedBody.node.worldRotation,n=hn.transformQuat(ygt,t,i),r=e?hn.transformQuat(Tgt,e,i):hn.ZERO;nlt.RigidBody_applyImpulse(this.impl,xlt(hlt.instance.BT_V3_0,n),xlt(hlt.instance.BT_V3_1,r))},t.applyForce=function(t,e){this._sharedBody.syncSceneToPhysics(),this._wakeUpIfSleep();var i=e||hn.ZERO;nlt.RigidBody_applyForce(this.impl,xlt(hlt.instance.BT_V3_0,t),xlt(hlt.instance.BT_V3_1,i))},t.applyTorque=function(t){this._sharedBody.syncSceneToPhysics(),this._wakeUpIfSleep(),nlt.RigidBody_applyTorque(this.impl,xlt(hlt.instance.BT_V3_0,t))},t.applyImpulse=function(t,e){this._sharedBody.syncSceneToPhysics(),this._wakeUpIfSleep();var i=e||hn.ZERO;nlt.RigidBody_applyImpulse(this.impl,xlt(hlt.instance.BT_V3_0,t),xlt(hlt.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||nlt.CollisionObject_activate(this.impl,!0)},n(e,[{key:"isAwake",get:function(){var t=nlt.CollisionObject_getActivationState(this.impl);return t===mgt.ACTIVE_TAG||t===mgt.DISABLE_DEACTIVATION}},{key:"isSleepy",get:function(){return nlt.CollisionObject_getActivationState(this.impl)===mgt.WANTS_DEACTIVATION}},{key:"isSleeping",get:function(){return nlt.CollisionObject_getActivationState(this.impl)===mgt.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}();Sgt.idCounter=0;var Egt={syncPhysicsToGraphics:function(t){rlt.CACHE.getWrapper(t,rlt.BODY_CACHE_NAME).syncPhysicsToGraphics()},onShapeHitExt:function(t,e){rlt.CACHE.getWrapper(e,rlt.CCT_CACHE_NAME).onShapeHitExt(t)},onDebugDrawLine:function(t,e,i){var n=rlt.CACHE.world;n&&n.onDebugDrawLine(t,e,i)},clearLines:function(){var t=rlt.CACHE.world;t&&t.onClearLines()},flushLines:function(){}},Agt=ult,Rgt=_lt,bgt=0,Cgt=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=tct.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 a=fut.DEFAULT,o=tct.instance.collisionMatrix[a];r._collisionFilterGroup=a,r._collisionFilterMask=o,t.sharedBodesMap.set(e.uuid,r)}if(n){r._wrappedBody=n;var h=n.rigidBody.group,u=tct.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=hlt.instance.BT_TRANSFORM_0,i=hlt.instance.BT_QUAT_0;xlt(nlt.Transform_getOrigin(e),this.node.worldPosition),Olt(i,this.node.worldRotation),nlt.Transform_setRotation(e,i);var n=nlt.MotionState.implement(Egt).$$.ptr;nlt.ccMotionState_setup(n,this.id,e);var r=nlt.RigidBody_new(t,n),s=tct.instance.sleepThreshold;nlt.RigidBody_setSleepingThresholds(r,s,s),this._bodyStruct={id:bgt++,body:r,motionState:n,compound:nlt.ccCompoundShape_new(),wrappedShapes:[],useCompound:!1},hlt.setWrapper(this.id,rlt.BODY_CACHE_NAME,this),this._ghostStruct&&nlt.CollisionObject_setIgnoreCollisionCheck(this.ghost,this.body,!0),this._wrappedBody&&this.setBodyType(this._wrappedBody.rigidBody.type)}},e._instantiateGhostStruct=function(){if(!this._ghostStruct){var t=nlt.CollisionObject_new(),e=nlt.ccCompoundShape_new();nlt.CollisionObject_setCollisionShape(t,e),nlt.CollisionObject_setCollisionFlags(t,fgt.CF_STATIC_OBJECT|fgt.CF_NO_CONTACT_RESPONSE),this._ghostStruct={id:bgt++,ghost:t,compound:e,wrappedShapes:[]},this._bodyStruct&&nlt.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=nlt.CollisionObject_getCollisionFlags(e),s=hlt.instance.BT_V3_0;switch(t){case sut.DYNAMIC:r&=~fgt.CF_KINEMATIC_OBJECT,r&=~fgt.CF_STATIC_OBJECT,nlt.CollisionObject_setCollisionFlags(e,r),i.setMass(n.mass),i.useGravity(n.useGravity),i.setAllowSleep(n.allowSleep);break;case sut.KINEMATIC:nlt.Vec3_set(s,0,0,0),nlt.RigidBody_setMassProps(e,0,s),r|=fgt.CF_KINEMATIC_OBJECT,r&=~fgt.CF_STATIC_OBJECT,nlt.CollisionObject_setCollisionFlags(e,r),nlt.CollisionObject_forceActivationState(e,mgt.DISABLE_DEACTIVATION);break;case sut.STATIC:default:nlt.Vec3_set(s,0,0,0),nlt.RigidBody_setMassProps(e,0,s),r|=fgt.CF_STATIC_OBJECT,r&=~fgt.CF_KINEMATIC_OBJECT,nlt.CollisionObject_setCollisionFlags(e,r),nlt.CollisionObject_forceActivationState(e,mgt.ISLAND_SLEEPING)}this.dirty|=dgt.BODY_RE_ADD}},e.setGhostType=function(t){if(this._ghostStruct){var e=this._ghostStruct.ghost,i=nlt.CollisionObject_getCollisionFlags(e);switch(t){case sut.DYNAMIC:case sut.KINEMATIC:i&=~fgt.CF_STATIC_OBJECT,i|=fgt.CF_KINEMATIC_OBJECT,nlt.CollisionObject_setCollisionFlags(e,i),nlt.CollisionObject_forceActivationState(e,mgt.DISABLE_DEACTIVATION);break;case sut.STATIC:default:i&=~fgt.CF_KINEMATIC_OBJECT,i|=fgt.CF_STATIC_OBJECT,nlt.CollisionObject_setCollisionFlags(e,i),nlt.CollisionObject_forceActivationState(e,mgt.ISLAND_SLEEPING)}this.dirty|=dgt.GHOST_RE_ADD}},e.addShape=function(t,e){function i(t,e){nlt.CollisionObject_setCollisionShape(t.body,e),t.dirty|=dgt.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):nlt.CollisionObject_setCollisionShape(this.body,nlt.EmptyShape_static()),nlt.CollisionObject_activate(this.body,!0),this.dirty|=dgt.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&dgt.BODY_RE_ADD&&this.updateBodyByReAdd(),this.ghostIndex>=0&&this.dirty&dgt.GHOST_RE_ADD&&this.updateGhostByReAdd(),this.dirty=0)},e.syncSceneToPhysics=function(){if(this.node.hasChangedFlags){var t=hlt.instance.BT_QUAT_0,e=nlt.CollisionObject_getWorldTransform(this.body);if(Olt(t,this.node.worldRotation),xlt(nlt.Transform_getOrigin(e),this.node.worldPosition),nlt.Transform_setRotation(e,t),this.node.hasChangedFlags&om.SCALE&&this.syncBodyScale(),nlt.CollisionObject_isKinematicObject(this.body)){var i=nlt.RigidBody_getMotionState(this.body);i&&nlt.MotionState_setWorldTransform(i,e)}else this.isBodySleeping()&&nlt.CollisionObject_activate(this.body,!1)}},e.syncPhysicsToScene=function(){nlt.CollisionObject_isStaticOrKinematicObject(this.body)||this.syncPhysicsToGraphics()},e.syncPhysicsToGraphics=function(){if(!this.isBodySleeping()){var t=hlt.instance.BT_QUAT_0,e=hlt.instance.BT_TRANSFORM_0;nlt.RigidBody_getWorldTransform(this.body,e);var i=nlt.Transform_getRotationAndOrigin(e,t);if(this.node.worldRotation=Dlt(Rgt,t),this.node.worldPosition=Ilt(Agt,i),this._ghostStruct){var n=nlt.CollisionObject_getWorldTransform(this.ghost);xlt(nlt.Transform_getOrigin(n),this.node.worldPosition),Olt(t,this.node.worldRotation),nlt.Transform_setRotation(n,t)}}},e.syncSceneToGhost=function(){if(this.node.hasChangedFlags){var t=hlt.instance.BT_QUAT_0,e=nlt.CollisionObject_getWorldTransform(this.ghost);xlt(nlt.Transform_getOrigin(e),this.node.worldPosition),Olt(t,this.node.worldRotation),nlt.Transform_setRotation(e,t),this.node.hasChangedFlags&om.SCALE&&this.syncGhostScale(),nlt.CollisionObject_activate(this.ghost,!1)}},e.syncInitialBody=function(){var t=hlt.instance.BT_QUAT_0,e=nlt.CollisionObject_getWorldTransform(this.body);xlt(nlt.Transform_getOrigin(e),this.node.worldPosition),Olt(t,this.node.worldRotation),nlt.Transform_setRotation(e,t),this.syncBodyScale(),nlt.CollisionObject_activate(this.body,!1)},e.syncInitialGhost=function(){var t=hlt.instance.BT_QUAT_0,e=nlt.CollisionObject_getWorldTransform(this.ghost);xlt(nlt.Transform_getOrigin(e),this.node.worldPosition),Olt(t,this.node.worldRotation),nlt.Transform_setRotation(e,t),this.syncGhostScale(),nlt.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;hlt.delWrapper(e.body,rlt.BODY_CACHE_NAME),nlt._safe_delete(e.motionState,Jut.EBulletTypeMotionState),nlt._safe_delete(e.compound,Jut.EBulletTypeCollisionShape),nlt._safe_delete(e.body,Jut.EBulletTypeCollisionObject),this._bodyStruct=null}if(this._ghostStruct){var i=this._ghostStruct;nlt._safe_delete(i.compound,Jut.EBulletTypeCollisionShape),nlt._safe_delete(i.ghost,Jut.EBulletTypeCollisionObject),this._ghostStruct=null}},e.isBodySleeping=function(){return nlt.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|=dgt.BODY_RE_ADD,this.dirty|=dgt.GHOST_RE_ADD)}},{key:"collisionFilterMask",get:function(){return this._collisionFilterMask},set:function(t){t!==this._collisionFilterMask&&(this._collisionFilterMask=t,this.dirty|=dgt.BODY_RE_ADD,this.dirty|=dgt.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)&&(nlt.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}();Cgt.idCounter=0,Cgt.sharedBodesMap=new Map;var wgt=ult,xgt={},Igt=function(){function t(){this.id=t.idCounter++,this._isEnabled=!1,this._isTrigger=!1,this._isInitialized=!1,this._impl=0,this._compound=0,this.quat=nlt.Quat_new(0,0,0,1),this.transform=nlt.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?tct.instance.defaultMaterial:t;if(!this._isTrigger&&this._isEnabled)if(this._compound){xgt[e._uuid]||(xgt[e._uuid]=nlt.ccMaterial_new());var i=xgt[e._uuid];nlt.ccMaterial_set(i,e.restitution,e.friction,e.rollingFriction,e.spinningFriction),nlt.CollisionShape_setMaterial(this._impl,i)}else nlt.CollisionObject_setMaterial(this._sharedBody.body,e.restitution,e.friction,e.rollingFriction,e.spinningFriction)},e.setCenter=function(t){hn.copy(wgt,t),wgt.multiply(this._collider.node.worldScale),xlt(nlt.Transform_getOrigin(this.transform),wgt),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=hlt.instance.BT_TRANSFORM_0;nlt.Transform_setIdentity(e),nlt.Transform_setRotation(e,Olt(hlt.instance.BT_QUAT_0,this._collider.node.worldRotation));var i=hlt.instance.BT_V3_0,n=hlt.instance.BT_V3_1;nlt.CollisionShape_getAabb(this._impl,e,i,n),t.halfExtents.x=(nlt.Vec3_x(n)-nlt.Vec3_x(i))/2,t.halfExtents.y=(nlt.Vec3_y(n)-nlt.Vec3_y(i))/2,t.halfExtents.z=(nlt.Vec3_z(n)-nlt.Vec3_z(i))/2,hn.add(t.center,this._collider.node.worldPosition,this._collider.center)},e.getBoundingSphere=function(t){t.radius=nlt.CollisionShape_getLocalBoundingSphere(this._impl),hn.add(t.center,this._collider.node.worldPosition,this._collider.center)},e.initialize=function(t){this._collider=t,this._isInitialized=!0,this._sharedBody=tct.instance.physicsWorld.getSharedBody(this._collider.node),this._sharedBody.reference=!0,this.onComponentSet(),this.setWrapper()},e.setWrapper=function(){hlt.isNotEmptyShape(this._impl)&&(nlt.CollisionShape_setUserPointer(this._impl,this._impl),hlt.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,nlt._safe_delete(this.quat,Jut.EBulletTypeQuat),nlt._safe_delete(this.transform,Jut.EBulletTypeTransform),this._compound&&nlt._safe_delete(this._compound,Jut.EBulletTypeCollisionShape),hlt.isNotEmptyShape(this._impl)&&(nlt._safe_delete(this._impl,Jut.EBulletTypeCollisionShape),hlt.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&&nlt.CompoundShape_removeChildShape(this._compound,this._impl),t&&nlt.CompoundShape_addChildShape(t,this.transform,this._impl),this._compound=t},e.updateScale=function(){this.setCenter(this._collider.center)},e.updateCompoundTransform=function(){this._compound?nlt.CompoundShape_updateChildTransform(this._compound,this._impl,this.transform,!0):this._isEnabled&&!this._isTrigger&&this._sharedBody&&!this._sharedBody.bodyStruct.useCompound&&(this._sharedBody.dirty|=dgt.BODY_RE_ADD)},e.needCompound=function(){return this._collider.type===uut.TERRAIN||!this._collider.center.equals(hn.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}();Igt.TYPE="shape",Igt.idCounter=0;var Ogt=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}(),Dgt=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}(),Mgt=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&&Ilt(t,nlt.ManifoldPoint_get_m_localPointA(this.impl))},e.getLocalPointOnB=function(t){this.impl&&Ilt(t,nlt.ManifoldPoint_get_m_localPointB(this.impl))},e.getWorldPointOnA=function(t){this.impl&&Ilt(t,nlt.ManifoldPoint_get_m_positionWorldOnA(this.impl))},e.getWorldPointOnB=function(t){this.impl&&Ilt(t,nlt.ManifoldPoint_get_m_positionWorldOnB(this.impl))},e.getLocalNormalOnA=function(t){if(this.impl){var e=hlt.instance.BT_QUAT_0,i=nlt.PersistentManifold_getBody0(this.event.impl),n=nlt.CollisionObject_getWorldTransform(i);nlt.Transform_getRotation(n,e);var r=_lt;Dlt(r,e),En.conjugate(r,r),Ilt(t,nlt.ManifoldPoint_get_m_normalWorldOnB(this.impl)),this.isBodyA||hn.negate(t,t),hn.transformQuat(t,t,r)}},e.getLocalNormalOnB=function(t){if(this.impl){var e=hlt.instance.BT_QUAT_0,i=nlt.PersistentManifold_getBody1(this.event.impl),n=nlt.CollisionObject_getWorldTransform(i);nlt.Transform_getRotation(n,e);var r=_lt;Dlt(r,e),En.conjugate(r,r),Ilt(t,nlt.ManifoldPoint_get_m_normalWorldOnB(this.impl)),hn.transformQuat(t,t,r)}},e.getWorldNormalOnA=function(t){this.impl&&(Ilt(t,nlt.ManifoldPoint_get_m_normalWorldOnB(this.impl)),this.isBodyA||hn.negate(t,t))},e.getWorldNormalOnB=function(t){this.impl&&Ilt(t,nlt.ManifoldPoint_get_m_normalWorldOnB(this.impl))},n(t,[{key:"isBodyA",get:function(){return this.event.selfCollider.shape.sharedBody.body===nlt.PersistentManifold_getBody0(this.event.impl)}}]),t}(),Pgt=[],Bgt=ult,Ngt=llt,Lgt=clt,Fgt=wlt,kgt=new _gt,Ugt=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=put.NONE,this._debugConstraintSize=.3,this._needEmitEvents=!1,this._needSyncAfterEvents=!1,this._needEmitCCTEvents=!1,this.bodies=[],this.ghosts=[],this.ccts=[],this.constraints=[],this.triggerArrayMat=new Ogt,this.collisionArrayMat=new Ogt,this.contactsDic=new Dgt,this.oldContactsDic=new Dgt,this.cctShapeEventDic=new Dgt,this.cctContactsDic=new Dgt,this.cctOldContactsDic=new Dgt,rlt.CACHE.world=this,this._broadphase=nlt.DbvtBroadphase_new(),this._dispatcher=nlt.CollisionDispatcher_new(),this._solver=nlt.SequentialImpulseConstraintSolver_new(),this._world=nlt.ccDiscreteDynamicsWorld_new(this._dispatcher,this._broadphase,this._solver);var t=nlt.DebugDraw.implement(Egt);this._debugDraw=t.$$.ptr,nlt.CollisionWorld_setDebugDrawer(this._world,this._debugDraw),nlt.DebugDraw_setDebugMode(this._debugDraw,tlt.DBG_NoDebug),nlt.DebugDraw_setAABBColor(this._debugDraw,0,1,1),nlt.DebugDraw_setActiveObjectColor(this._debugDraw,1,0,1),nlt.DebugDraw_setDeactiveObjectColor(this._debugDraw,1,0,1),nlt.DebugDraw_setWantsDeactivationObjectColor(this._debugDraw,1,0,1),nlt.DebugDraw_setDisabledDeactivationObjectColor(this._debugDraw,1,0,1),nlt.DebugDraw_setDisabledSimulationObjectColor(this._debugDraw,1,0,1),nlt.DebugDraw_setConstraintLimitColor(this._debugDraw,.5,.5,.5)}return t.setDefaultMaterial=function(){},t.setAllowSleep=function(t){nlt.ccDiscreteDynamicsWorld_setAllowSleep(this._world,t)},t.setGravity=function(t){nlt.DynamicsWorld_setGravity(this._world,xlt(hlt.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 a=this.bodies[s].bodyStruct.wrappedShapes,o=0;o<a.length;o++){var h=a[o].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)&&G("You should destroy all physics component first."),nlt._safe_delete(this._world,Jut.EBulletTypeCollisionWorld),nlt._safe_delete(this._broadphase,Jut.EBulletTypeDbvtBroadPhase),nlt._safe_delete(this._dispatcher,Jut.EBulletTypeCollisionDispatcher),nlt._safe_delete(this._solver,Jut.EBulletTypeSequentialImpulseConstraintSolver),nlt._safe_delete(this._debugDraw,Jut.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,Pgt.length=0},t.step=function(t,e,i){void 0===i&&(i=0),(this.bodies.length||this.ghosts.length)&&(void 0===e&&(e=t),nlt.DynamicsWorld_stepSimulation(this._world,e,i,t),nlt.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 a=r[s];a.updateDirty(),a.syncSceneToPhysics()}},t.syncAfterEvents=function(){this._needSyncAfterEvents&&this.syncSceneToPhysics()},t.raycast=function(t,e,i,n){t.computeHit(Bgt,e.maxDistance);var r=xlt(hlt.instance.BT_V3_0,Bgt),s=xlt(hlt.instance.BT_V3_1,t.o),a=nlt.ccAllRayCallback_static();if(nlt.ccAllRayCallback_reset(a,s,r,e.mask>>>0,e.queryTrigger),nlt.ccAllRayCallback_setFlags(a,$ut.UseSubSimplexConvexCastRaytest),nlt.CollisionWorld_rayTest(this._world,s,r,a),nlt.RayCallback_hasHit(a)){for(var o=nlt.ccAllRayCallback_getHitPointWorld(a),h=nlt.ccAllRayCallback_getHitNormalWorld(a),u=nlt.ccAllRayCallback_getCollisionShapePtrs(a),l=0,c=nlt.int_array_size(u);l<c;l++){Ilt(Bgt,nlt.Vec3_array_at(o,l)),Ilt(Ngt,nlt.Vec3_array_at(h,l));var _=hlt.getWrapper(nlt.int_array_at(u,l),Igt.TYPE),d=i.add();n.push(d),d._assign(Bgt,hn.distance(t.o,Bgt),_.collider,Ngt)}return!0}return!1},t.raycastClosest=function(t,e,i){t.computeHit(Bgt,e.maxDistance);var n=xlt(hlt.instance.BT_V3_0,Bgt),r=xlt(hlt.instance.BT_V3_1,t.o),s=nlt.ccClosestRayCallback_static();if(nlt.ccClosestRayCallback_reset(s,r,n,e.mask>>>0,e.queryTrigger),nlt.ccClosestRayCallback_setFlags(s,$ut.UseSubSimplexConvexCastRaytest),nlt.CollisionWorld_rayTest(this._world,r,n,s),nlt.RayCallback_hasHit(s)){Ilt(Bgt,nlt.ccClosestRayCallback_getHitPointWorld(s)),Ilt(Ngt,nlt.ccClosestRayCallback_getHitNormalWorld(s));var a=hlt.getWrapper(nlt.ccClosestRayCallback_getCollisionShapePtr(s),Igt.TYPE);return i._assign(Bgt,hn.distance(t.o,Bgt),a.collider,Ngt),!0}return!1},t.sweepBox=function(t,i,n,r,s,a){var o=hlt.instance.BT_V3_0;return xlt(o,i),e._sweepBoxGeometry||(e._sweepBoxGeometry=nlt.BoxShape_new(o)),nlt.BoxShape_setUnscaledHalfExtents(e._sweepBoxGeometry,o),this.sweep(t,e._sweepBoxGeometry,n,r,s,a)},t.sweepBoxClosest=function(t,i,n,r,s){var a=hlt.instance.BT_V3_0;return xlt(a,i),e._sweepBoxGeometry||(e._sweepBoxGeometry=nlt.BoxShape_new(a)),nlt.BoxShape_setUnscaledHalfExtents(e._sweepBoxGeometry,a),this.sweepClosest(t,e._sweepBoxGeometry,n,r,s)},t.sweepSphere=function(t,i,n,r,s){return e._sweepSphereGeometry||(e._sweepSphereGeometry=nlt.SphereShape_new(i)),nlt.SphereShape_setUnscaledRadius(e._sweepSphereGeometry,i),this.sweep(t,e._sweepSphereGeometry,En.IDENTITY,n,r,s)},t.sweepSphereClosest=function(t,i,n,r){return e._sweepSphereGeometry||(e._sweepSphereGeometry=nlt.SphereShape_new(i)),nlt.SphereShape_setUnscaledRadius(e._sweepSphereGeometry,i),this.sweepClosest(t,e._sweepSphereGeometry,En.IDENTITY,n,r)},t.sweepCapsule=function(t,i,n,r,s,a,o){return e._sweepCapsuleGeometry||(e._sweepCapsuleGeometry=nlt.CapsuleShape_new(i,n)),nlt.CapsuleShape_updateProp(e._sweepCapsuleGeometry,i,.5*n,1),this.sweep(t,e._sweepCapsuleGeometry,r,s,a,o)},t.sweepCapsuleClosest=function(t,i,n,r,s,a){return e._sweepCapsuleGeometry||(e._sweepCapsuleGeometry=nlt.CapsuleShape_new(i,n)),nlt.CapsuleShape_updateProp(e._sweepCapsuleGeometry,i,.5*n,1),this.sweepClosest(t,e._sweepCapsuleGeometry,r,s,a)},t.sweep=function(t,e,i,n,r,s){var a=hlt.instance.BT_TRANSFORM_0,o=hlt.instance.BT_TRANSFORM_1,h=hlt.instance.BT_QUAT_0;xlt(nlt.Transform_getOrigin(a),t.o),Olt(h,i),nlt.Transform_setRotation(a,h),t.computeHit(Bgt,n.maxDistance),xlt(nlt.Transform_getOrigin(o),Bgt),Olt(h,i),nlt.Transform_setRotation(o,h);var u=nlt.ccAllConvexCallback_static();if(nlt.ccAllConvexCallback_reset(u,a,o,n.mask>>>0,n.queryTrigger),nlt.CollisionWorld_convexSweepTest(this._world,e,a,o,u,0),nlt.ConvexCallback_hasHit(u)){for(var l=nlt.ccAllConvexCallback_getHitPointWorld(u),c=nlt.ccAllConvexCallback_getHitNormalWorld(u),_=nlt.ccAllConvexCallback_getCollisionShapePtrs(u),d=0,f=nlt.int_array_size(_);d<f;d++){Ilt(Bgt,nlt.Vec3_array_at(l,d)),Ilt(Ngt,nlt.Vec3_array_at(c,d));var p=hlt.getWrapper(nlt.int_array_at(_,d),Igt.TYPE),m=r.add();s.push(m),m._assign(Bgt,hn.distance(t.o,Bgt),p.collider,Ngt)}return!0}return!1},t.sweepClosest=function(t,e,i,n,r){var s=hlt.instance.BT_TRANSFORM_0,a=hlt.instance.BT_TRANSFORM_1,o=hlt.instance.BT_QUAT_0;xlt(nlt.Transform_getOrigin(s),t.o),Olt(o,i),nlt.Transform_setRotation(s,o),t.computeHit(Bgt,n.maxDistance),xlt(nlt.Transform_getOrigin(a),Bgt),Olt(o,i),nlt.Transform_setRotation(a,o);var h=nlt.ccClosestConvexCallback_static();if(nlt.ccClosestConvexCallback_reset(h,s,a,n.mask>>>0,n.queryTrigger),nlt.CollisionWorld_convexSweepTest(this._world,e,s,a,h,0),nlt.ConvexCallback_hasHit(h)){Ilt(Bgt,nlt.ccClosestConvexCallback_getHitPointWorld(h)),Ilt(Ngt,nlt.ccClosestConvexCallback_getHitNormalWorld(h));var u=hlt.getWrapper(nlt.ccClosestConvexCallback_getCollisionShapePtr(h),Igt.TYPE);return r._assign(Bgt,hn.distance(t.o,Bgt),u.collider,Ngt),!0}return!1},t.getSharedBody=function(t,e){return Cgt.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;nlt.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),nlt.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;nlt.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),nlt.CollisionWorld_removeCollisionObject(this._world,t.ghost))},t.addCCT=function(t){if(this.ccts.indexOf(t)<0){this.ccts.push(t);var e=nlt.CharacterController_getGhostObject(t.impl),i=t.getGroup(),n=t.getMask();nlt.CollisionWorld_addCollisionObject(this._world,e,i>>>0,n>>>0),nlt.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=nlt.CharacterController_getGhostObject(t.impl);nlt.CollisionWorld_removeCollisionObject(this._world,i),nlt.DynamicsWorld_removeAction(this._world,t.impl)}},t.addConstraint=function(t){var e=this.constraints.indexOf(t);e<0&&(this.constraints.push(t),nlt.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),nlt.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--;){Pgt.push.apply(Pgt,alt.contacts),alt.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,a=r.collider;if(s&&a){if(s.isTrigger||a.isTrigger)this.triggerArrayMat.get(n.id,r.id)?slt.type="onTriggerStay":(slt.type="onTriggerEnter",this.triggerArrayMat.set(n.id,r.id,!0)),slt.impl=i.impl,slt.selfCollider=s,slt.otherCollider=a,s.emit(slt.type,slt),slt.selfCollider=a,slt.otherCollider=s,a.emit(slt.type,slt),this._needSyncAfterEvents=!0;else{var o=s.attachedRigidBody,h=a.attachedRigidBody;if(o&&h){if(o.isSleeping&&h.isSleeping)continue}else if(!o&&h){if(h.isSleeping)continue}else if(!h&&o&&o.isSleeping)continue;this.collisionArrayMat.get(n.id,r.id)?alt.type="onCollisionStay":(alt.type="onCollisionEnter",this.collisionArrayMat.set(n.id,r.id,!0));for(var u=0;u<i.contacts.length;u++){var l=i.contacts[u];if(Pgt.length>0){var c=Pgt.pop();c.impl=l,alt.contacts.push(c)}else{var _=new Mgt(alt);_.impl=l,alt.contacts.push(_)}}alt.impl=i.impl,alt.selfCollider=s,alt.otherCollider=a,s.emit(alt.type,alt),alt.selfCollider=a,alt.otherCollider=s,a.emit(alt.type,alt),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),m=p.shape0,g=p.shape1,v=m.collider,y=g.collider;if(v&&y){var T=v.isTrigger||y.isTrigger;null==this.contactsDic.getDataByKey(f)&&(T?this.triggerArrayMat.get(m.id,g.id)&&(slt.type="onTriggerExit",slt.selfCollider=v,slt.otherCollider=y,v.emit(slt.type,slt),slt.selfCollider=y,slt.otherCollider=v,y.emit(slt.type,slt),this.triggerArrayMat.set(m.id,g.id,!1),this.oldContactsDic.set(m.id,g.id,null),this._needSyncAfterEvents=!0):this.collisionArrayMat.get(m.id,g.id)&&(Pgt.push.apply(Pgt,alt.contacts),alt.contacts.length=0,alt.type="onCollisionExit",alt.selfCollider=v,alt.otherCollider=y,v.emit(alt.type,alt),alt.selfCollider=y,alt.otherCollider=v,y.emit(alt.type,alt),this.collisionArrayMat.set(m.id,g.id,!1),this.oldContactsDic.set(m.id,g.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,a=r.characterController;s&&a&&(s.isTrigger&&(this.triggerArrayMat.get(n.id,r.id)?olt.type="onControllerTriggerStay":(olt.type="onControllerTriggerEnter",this.triggerArrayMat.set(n.id,r.id,!0)),olt.impl=i.impl,olt.collider=s,olt.characterController=a,s.emit(olt.type,olt),olt.collider=s,olt.characterController=a,a.emit(olt.type,olt),this._needSyncAfterEvents=!0),null==this.cctOldContactsDic.get(n.id,r.id)&&this.cctOldContactsDic.set(n.id,r.id,i))}for(var o=this.cctOldContactsDic.getLength();o--;){var h=this.cctOldContactsDic.getKeyByIndex(o),u=this.cctOldContactsDic.getDataByKey(h),l=u.shape,c=u.cct,_=l.collider,d=c.characterController;if(_&&d){var f=_.isTrigger;null==this.cctContactsDic.getDataByKey(h)&&f&&this.triggerArrayMat.get(l.id,c.id)&&(olt.type="onControllerTriggerExit",olt.collider=_,olt.characterController=d,_.emit(olt.type,olt),olt.collider=_,olt.characterController=d,d.emit(olt.type,olt),this.triggerArrayMat.set(l.id,c.id,!1),this.cctOldContactsDic.set(l.id,c.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,a=n.worldPos,o=n.worldNormal,h=n.motionDir,u=n.motionLength;kgt.controller=r.characterController,kgt.collider=s.collider,kgt.worldPosition.set(a.x,a.y,a.z),kgt.worldNormal.set(o.x,o.y,o.z),kgt.motionDirection.set(h.x,h.y,h.z),kgt.motionLength=u,null===(e=kgt.controller)||void 0===e||e.emit("onControllerColliderHit",kgt),this._needSyncAfterEvents=!0}this.cctShapeEventDic.reset()},t.gatherConatactData=function(){for(var t=nlt.Dispatcher_getNumManifolds(this._dispatcher),e=0;e<t;e++)for(var i=nlt.Dispatcher_getManifoldByIndexInternal(this._dispatcher,e),n=nlt.PersistentManifold_getNumContacts(i),r=0;r<n;r++){var s=nlt.PersistentManifold_getContactPoint(i,r),a=nlt.ManifoldPoint_getShape0(s),o=nlt.ManifoldPoint_getShape1(s),h=!1;if(!h){var u=hlt.getWrapper(a,Igt.TYPE),l=hlt.getWrapper(o,Igt.TYPE);if(u&&l&&(h=!0,u.collider.needTriggerEvent||l.collider.needTriggerEvent||u.collider.needCollisionEvent||l.collider.needCollisionEvent)){var c=this.contactsDic.get(u.id,l.id);c||(c=this.contactsDic.set(u.id,l.id,{shape0:u,shape1:l,contacts:[],impl:i})),c.contacts.push(s)}}if(!h){var _=hlt.getWrapper(a,Igt.TYPE),d=hlt.getWrapper(o,rlt.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=hlt.getWrapper(a,rlt.CCT_CACHE_NAME),m=hlt.getWrapper(o,Igt.TYPE);if(m&&p&&(h=!0,m.collider.needTriggerEvent)){var g=this.cctContactsDic.get(m.id,p.id);g||(g=this.cctContactsDic.set(m.id,p.id,{shape:m,cct:p,contacts:[],impl:i})),g.contacts.push(s),h=!0}}}},t._setDebugDrawMode=function(){var t=0;this._debugDrawFlags&put.WIRE_FRAME&&(t|=tlt.DBG_DrawWireframe),this._debugDrawFlags&put.CONSTRAINT&&(t|=tlt.DBG_DrawConstraints,t|=tlt.DBG_DrawConstraintLimits),this._debugDrawFlags&put.AABB&&(t|=tlt.DBG_DrawAabb),nlt.DebugDraw_setDebugMode(this._debugDraw,t)},t._getDebugRenderer=function(){var t,e=null===(t=gL.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++,Ilt(Bgt,t),Ilt(Ngt,e),Ilt(Lgt,i),Fgt.set(255*Lgt.x,255*Lgt.y,255*Lgt.z,255),n.addLine(Bgt,Ngt,Fgt))},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}();Ugt._sweepBoxGeometry=void 0,Ugt._sweepSphereGeometry=void 0,Ugt._sweepCapsuleGeometry=void 0;var Ggt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.updateSize=function(){var t=hlt.instance.BT_V3_0;xlt(t,this.getMinUnscaledHalfExtents(W$)),nlt.BoxShape_setUnscaledHalfExtents(this.impl,t),this.updateCompoundTransform()},i.onComponentSet=function(){var t=hlt.instance.BT_V3_0;xlt(t,this.getMinUnscaledHalfExtents(W$)),this._impl=nlt.BoxShape_new(t),this.updateScale()},i.updateScale=function(){t.prototype.updateScale.call(this);var e=hlt.instance.BT_V3_0;nlt.CollisionShape_setLocalScaling(this._impl,xlt(e,this.getMinScale(W$))),this.updateCompoundTransform()},i.getMinUnscaledHalfExtents=function(t){var e=this.collider.size,i=X$(W$.set(this._collider.node.worldScale)),n=tct.instance.minVolumeSize,r=e.x/2,s=e.y/2,a=e.z/2,o=r*i.x<n?n/i.x:r,h=s*i.y<n?n/i.y:s,u=a*i.z<n?n/i.z:a;return t.set(o,h,u),t},i.getMinScale=function(t){var e=this.collider.size,i=X$(W$.set(this._collider.node.worldScale)),n=tct.instance.minVolumeSize,r=e.x/2,s=e.y/2,a=e.z/2,o=r*i.x<n?n/r:i.x,h=s*i.y<n?n/s:i.y,u=a*i.z<n?n/a:i.z;return t.set(o,h,u),t},n(e,[{key:"collider",get:function(){return this._collider}}]),e}(Igt),Hgt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.updateRadius=function(){nlt.SphereShape_setUnscaledRadius(this.impl,this.getMinUnscaledRadius()),this.updateCompoundTransform()},i.onComponentSet=function(){this._impl=nlt.SphereShape_new(this.getMinUnscaledRadius()),this.updateScale()},i.updateScale=function(){t.prototype.updateScale.call(this);var e=this.getMinScale();ult.set(e,e,e);var i=hlt.instance.BT_V3_0;nlt.CollisionShape_setLocalScaling(this._impl,xlt(i,ult)),this.updateCompoundTransform()},i.getMinUnscaledRadius=function(){var t=this.collider.radius,e=Math.abs(Xi(this._collider.node.worldScale)),i=tct.instance.minVolumeSize;return e*t<i?i/e:t},i.getMinScale=function(){var t=this.collider.radius,e=Math.abs(Xi(this._collider.node.worldScale)),i=tct.instance.minVolumeSize;return e*t<i?i/t:e},n(e,[{key:"collider",get:function(){return this._collider}}]),e}(Igt),zgt=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=nlt.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,a=n,o=i;1===o?(r=t*Math.abs(ji(a.x,a.z)),s=e/2*Math.abs(a.y)):0===o?(r=t*Math.abs(ji(a.y,a.z)),s=e/2*Math.abs(a.x)):(r=t*Math.abs(ji(a.x,a.y)),s=e/2*Math.abs(a.z)),nlt.CapsuleShape_updateProp(this._impl,r,s,o),this.updateCompoundTransform()},n(e,[{key:"collider",get:function(){return this._collider}}]),e}(Igt),Vgt=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=nlt.TriangleMesh_new(),Mlt(this.btTriangleMeshPtr,e),this.bulletBvhTriangleMeshShapePtr=nlt.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&&nlt._safe_delete(Jut.EBulletTypeCollisionShape,this.bulletBvhTriangleMeshShapePtr),this.btTriangleMeshPtr&&nlt._safe_delete(Jut.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}();Vgt.BulletBvhTriangleMeshShapeMap=new Map;var Wgt,Xgt,jgt=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&&hlt.isNotEmptyShape(this._impl)&&(this._compound&&nlt.CompoundShape_removeChildShape(this._compound,this._impl),nlt._safe_delete(this._impl,Jut.EBulletTypeCollisionShape),hlt.delWrapper(this._impl,Igt.TYPE),this._impl=0);var e=t;if(e&&e.renderingSubMeshes.length>0){if(this.collider.convex){var i=this._getBtTriangleMesh(e);this._impl=nlt.ConvexTriangleMeshShape_new(i)}else this.btBVHMeshShape=Vgt.getBulletBvhTriangleMeshShape(e.hash,e),this._impl=nlt.ScaledBvhTriangleMeshShape_new(this.btBVHMeshShape.bulletBvhTriangleMeshShapePtr,1,1,1);var n=hlt.instance.BT_V3_0;xlt(n,this._collider.node.worldScale),nlt.CollisionShape_setLocalScaling(this._impl,n),nlt.CollisionShape_setMargin(this._impl,.01),this.setCompound(this._compound),this.updateByReAdd(),this.setWrapper()}else this._impl=nlt.EmptyShape_static()}},i.onComponentSet=function(){this.setMesh(this.collider.mesh)},i.onDestroy=function(){this.collider.convex?this.refBtTriangleMesh&&nlt._safe_delete(this.refBtTriangleMesh,Jut.EBulletTypeTriangleMesh):this.btBVHMeshShape&&(this.btBVHMeshShape.reference=!1),t.prototype.onDestroy.call(this)},i.updateScale=function(){t.prototype.updateScale.call(this);var e=hlt.instance.BT_V3_0;xlt(e,this._collider.node.worldScale),nlt.CollisionShape_setLocalScaling(this._impl,e),this.updateCompoundTransform()},i._getBtTriangleMesh=function(t){return this.refBtTriangleMesh=nlt.TriangleMesh_new(),Mlt(this.refBtTriangleMesh,t),this.refBtTriangleMesh},n(e,[{key:"collider",get:function(){return this._collider}}]),e}(Igt),Ygt=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=hlt.instance.BT_V3_0;nlt.Vec3_set(t,.5,1,.5),this._impl=nlt.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,a=n,o=i;1===o?(s=e*Math.abs(a.y),r=t*Math.abs(ji(a.x,a.z))):0===o?(s=e*Math.abs(a.x),r=t*Math.abs(ji(a.y,a.z))):(s=e*Math.abs(a.z),r=t*Math.abs(ji(a.x,a.y))),nlt.CylinderShape_updateProp(this._impl,r,s/2,o),this.updateCompoundTransform()},n(e,[{key:"collider",get:function(){return this._collider}}]),e}(Igt),Kgt=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=nlt.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,a=n,o=i;1===o?(s=e*Math.abs(a.y),r=t*Math.abs(ji(a.x,a.z))):0===o?(s=e*Math.abs(a.x),r=t*Math.abs(ji(a.y,a.z))):(s=e*Math.abs(a.z),r=t*Math.abs(ji(a.x,a.y))),nlt.ConeShape_setRadius(this._impl,r),nlt.ConeShape_setHeight(this._impl,s),nlt.ConeShape_setConeUpIndex(this._impl,o);var h=hlt.instance.BT_V3_0;nlt.Vec3_set(h,1,1,1),nlt.CollisionShape_setLocalScaling(this._impl,h),this.updateCompoundTransform()},n(e,[{key:"impl",get:function(){return this._impl}},{key:"collider",get:function(){return this._collider}}]),e}(Igt),qgt=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 hn,e}s(e,t);var i=e.prototype;return i.setTerrain=function(t){if(this._isInitialized)if(this._impl&&hlt.isNotEmptyShape(this._impl))U("[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=nlt._malloc(4*i*n);for(var r=0,s=Number.MAX_SAFE_INTEGER,a=Number.MIN_SAFE_INTEGER,o=0;o<n;o++)for(var h=0;h<i;h++){var u=e.getHeight(h,o);nlt._write_f32(this._bufPtr+r,u),s>u&&(s=u),u>a&&(a=u),r+=4}a+=.01,s-=.01,this._localOffset.set((i-1)/2*this._tileSize,(a+s)/2,(n-1)/2*this._tileSize),this._impl=nlt.TerrainShape_new(i,n,this._bufPtr,1,s,a);var l=hlt.instance.BT_V3_0;nlt.Vec3_set(l,this._tileSize,1,this._tileSize),nlt.CollisionShape_setLocalScaling(this._impl,l),this.setCompound(this._compound),this.updateByReAdd(),this.setWrapper()}else this._impl=nlt.EmptyShape_static()}},i.onComponentSet=function(){this.setTerrain(this.collider.terrain)},i.onDestroy=function(){this._bufPtr&&nlt._free(this._bufPtr),t.prototype.onDestroy.call(this)},i.setCenter=function(t){hn.copy(ult,t),ult.add(this._localOffset),xlt(nlt.Transform_getOrigin(this.transform),ult),this.updateCompoundTransform()},n(e,[{key:"collider",get:function(){return this._collider}}]),e}(Igt),Qgt=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=nlt.SimplexShape_new();for(var t=this.collider.shapeType,e=this.collider.vertices,i=hlt.instance.BT_V3_0,n=0;n<t;n++)nlt.SimplexShape_addVertex(this._impl,xlt(i,e[n]));nlt.CollisionShape_setLocalScaling(this._impl,xlt(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=hlt.instance.BT_V3_0;nlt.CollisionShape_setLocalScaling(this._impl,xlt(e,this._collider.node.worldScale))},n(e,[{key:"collider",get:function(){return this._collider}}]),e}(Igt),Zgt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.setNormal=function(t){xlt(nlt.StaticPlaneShape_getPlaneNormal(this.impl),t),this.updateCompoundTransform()},i.setConstant=function(t){nlt.StaticPlaneShape_setPlaneConstant(this.impl,t),this.updateCompoundTransform()},i.updateScale=function(){t.prototype.updateScale.call(this);var e=hlt.instance.BT_V3_0;xlt(e,this._collider.node.worldScale),nlt.CollisionShape_setLocalScaling(this._impl,e),this.updateCompoundTransform()},i.onComponentSet=function(){var t=hlt.instance.BT_V3_0;xlt(t,this.collider.normal),this._impl=nlt.StaticPlaneShape_new(t,this.collider.constant),this.updateScale()},n(e,[{key:"collider",get:function(){return this._collider}}]),e}(Igt),Jgt=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),nlt._safe_delete(this._impl,Jut.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=tct.instance.physicsWorld.debugDrawConstraintSize;nlt.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(){nlt._safe_delete(this._impl,Jut.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}(),$gt=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=hlt.instance.BT_V3_0;hn.multiply(ult,t.node.worldScale,t.pivotA),xlt(e,ult),nlt.P2PConstraint_setPivotA(this._impl,e),t.connectedBody||this.setPivotB(t.pivotB)},i.setPivotB=function(){var t=this.constraint,e=this._rigidBody.node,i=hlt.instance.BT_V3_0,n=t.connectedBody;n?(hn.multiply(ult,n.node.worldScale,t.pivotB),xlt(i,ult)):(hn.multiply(ult,e.worldScale,t.pivotA),hn.transformQuat(ult,ult,e.worldRotation),hn.add(ult,ult,e.worldPosition),xlt(i,ult)),nlt.P2PConstraint_setPivotB(this._impl,i)},i.onComponentSet=function(){var t=this.constraint.connectedBody,e=this._rigidBody.body.impl,i=t?t.body.impl:nlt.TypedConstraint_getFixedBody(),n=hlt.instance.BT_V3_0,r=hlt.instance.BT_V3_1;this._impl=nlt.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}(Jgt),tvt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.setBreakForce=function(t){nlt.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:nlt.TypedConstraint_getFixedBody(),n=hlt.instance.BT_TRANSFORM_0,r=hlt.instance.BT_TRANSFORM_1;this._impl=nlt.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=ult,n=_lt,r=hlt.instance.BT_TRANSFORM_0,s=hlt.instance.BT_TRANSFORM_1,a=hlt.instance.BT_QUAT_0,o=flt;if(Dn.fromRT(o,e.node.worldRotation,e.node.worldPosition),Dn.invert(o,o),Dn.getRotation(n,o),Dn.getTranslation(i,o),xlt(nlt.Transform_getOrigin(r),i),Olt(a,n),nlt.Transform_setRotation(r,a),t){var h=t.body.sharedBody;Dn.fromRT(o,h.node.worldRotation,h.node.worldPosition),Dn.invert(o,o),Dn.getRotation(n,o),Dn.getTranslation(i,o),xlt(nlt.Transform_getOrigin(s),i),Olt(a,n),nlt.Transform_setRotation(s,a)}else nlt.Transform_setIdentity(s);nlt.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}(Jgt),evt=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?nlt.HingeConstraint_setLimit(this._impl,Mi(this.constraint.lowerLimit),Mi(this.constraint.upperLimit),.9,.3,1):nlt.HingeConstraint_setLimit(this._impl,1,0,.9,.3,1)},i.setLowerLimit=function(){this.constraint.limitEnabled&&nlt.HingeConstraint_setLimit(this._impl,Mi(this.constraint.lowerLimit),Mi(this.constraint.upperLimit),.9,.3,1)},i.setUpperLimit=function(){this.constraint.limitEnabled&&nlt.HingeConstraint_setLimit(this._impl,Mi(this.constraint.lowerLimit),Mi(this.constraint.upperLimit),.9,.3,1)},i.setMotorEnabled=function(t){nlt.HingeConstraint_enableMotor(this._impl,t);var e=-this.constraint.motorVelocity/60,i=Plt(this.constraint.motorForceLimit,tct.instance.fixedTimeStep);nlt.HingeConstraint_setMotorVelocity(this._impl,e),nlt.HingeConstraint_setMaxMotorImpulse(this._impl,i)},i.setMotorVelocity=function(t){if(this.constraint.motorEnabled){var e=-t/60;nlt.HingeConstraint_setMotorVelocity(this._impl,e)}},i.setMotorForceLimit=function(t){if(this.constraint.motorEnabled){var e=Plt(t,tct.instance.fixedTimeStep);nlt.HingeConstraint_setMaxMotorImpulse(this._impl,e)}},i.onComponentSet=function(){var t=this.constraint.connectedBody,e=this._rigidBody.body.impl,i=t?t.body.impl:nlt.TypedConstraint_getFixedBody(),n=hlt.instance.BT_TRANSFORM_0,r=hlt.instance.BT_TRANSFORM_1;this._impl=nlt.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=ult,n=_lt,r=dlt,s=hlt.instance.BT_TRANSFORM_0;hn.multiply(i,e.worldScale,t.pivotA),xlt(nlt.Transform_getOrigin(s),i);var a=hlt.instance.BT_QUAT_0;hn.normalize(i,t.axis),En.rotationTo(r,hn.UNIT_Z,i),Olt(a,r),nlt.Transform_setRotation(s,a);var o=hlt.instance.BT_TRANSFORM_1,h=this.constraint.connectedBody;h?(hn.multiply(i,h.node.worldScale,t.pivotB),En.multiply(r,e.worldRotation,r),En.invert(n,h.node.worldRotation),En.multiply(r,n,r)):(hn.multiply(i,e.worldScale,t.pivotA),hn.transformQuat(i,i,e.worldRotation),hn.add(i,i,e.worldPosition),En.multiply(r,e.worldRotation,r)),xlt(nlt.Transform_getOrigin(o),i),Olt(a,r),nlt.Transform_setRotation(o,a),nlt.HingeConstraint_setFrames(this._impl,s,o)},i.updateScale0=function(){this.updateFrames()},i.updateScale1=function(){this.updateFrames()},n(e,[{key:"constraint",get:function(){return this._com}}]),e}(Jgt);!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"}(Wgt||(Wgt={})),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"}(Xgt||(Xgt={}));var ivt=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 cut.LOCKED:nlt.Generic6DofSpring2Constraint_setLimit(this._impl,e,0,0);break;case cut.LIMITED:nlt.Generic6DofSpring2Constraint_setLimit(this._impl,e,i,n);break;case cut.FREE:nlt.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],a=0,o=0;switch(t){case 0:case 1:case 2:hn.toArray(r,i.lower),hn.toArray(s,i.upper),o=r[t],a=s[t];break;case 3:o=-(a=.5*Mi(n.twistExtent));break;case 4:o=-(a=.5*Mi(n.swingExtent1));break;case 5:o=-(a=.5*Mi(n.swingExtent2));break;default:G("idx should be in [0, 5], but give "+t)}this._setLimit(e,t,o,a)},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,Xgt.TWIST,.5*-Mi(t),.5*Mi(t)),this._setLimit(n.swingMotion1,Xgt.SWING1,.5*-Mi(e),.5*Mi(e)),this._setLimit(n.swingMotion2,Xgt.SWING2,.5*-Mi(i),.5*Mi(i))},i.setSwingSoftConstraint=function(t){nlt.Generic6DofSpring2Constraint_enableSpring(this._impl,Xgt.SWING1,t),nlt.Generic6DofSpring2Constraint_enableSpring(this._impl,Xgt.SWING2,t)},i.setTwistSoftConstraint=function(t){nlt.Generic6DofSpring2Constraint_enableSpring(this._impl,Xgt.TWIST,t)},i.setLinearSoftConstraint=function(t){nlt.Generic6DofSpring2Constraint_enableSpring(this._impl,Xgt.X,t),nlt.Generic6DofSpring2Constraint_enableSpring(this._impl,Xgt.Y,t),nlt.Generic6DofSpring2Constraint_enableSpring(this._impl,Xgt.Z,t)},i.setLinearStiffness=function(t){nlt.Generic6DofSpring2Constraint_setStiffness(this._impl,Xgt.X,t),nlt.Generic6DofSpring2Constraint_setStiffness(this._impl,Xgt.Y,t),nlt.Generic6DofSpring2Constraint_setStiffness(this._impl,Xgt.Z,t)},i.setLinearDamping=function(t){nlt.Generic6DofSpring2Constraint_setDamping(this._impl,Xgt.X,t),nlt.Generic6DofSpring2Constraint_setDamping(this._impl,Xgt.Y,t),nlt.Generic6DofSpring2Constraint_setDamping(this._impl,Xgt.Z,t)},i.setLinearRestitution=function(t){nlt.Generic6DofSpring2Constraint_setBounce(this._impl,Xgt.X,t),nlt.Generic6DofSpring2Constraint_setBounce(this._impl,Xgt.Y,t),nlt.Generic6DofSpring2Constraint_setBounce(this._impl,Xgt.Z,t)},i.setSwingStiffness=function(t){nlt.Generic6DofSpring2Constraint_setStiffness(this._impl,Xgt.SWING1,t),nlt.Generic6DofSpring2Constraint_setStiffness(this._impl,Xgt.SWING2,t)},i.setSwingDamping=function(t){nlt.Generic6DofSpring2Constraint_setDamping(this._impl,Xgt.SWING1,t),nlt.Generic6DofSpring2Constraint_setDamping(this._impl,Xgt.SWING2,t)},i.setSwingRestitution=function(t){nlt.Generic6DofSpring2Constraint_setBounce(this._impl,Xgt.SWING1,t),nlt.Generic6DofSpring2Constraint_setBounce(this._impl,Xgt.SWING2,t)},i.setTwistStiffness=function(t){nlt.Generic6DofSpring2Constraint_setStiffness(this._impl,Xgt.TWIST,t)},i.setTwistDamping=function(t){nlt.Generic6DofSpring2Constraint_setDamping(this._impl,Xgt.TWIST,t)},i.setTwistRestitution=function(t){nlt.Generic6DofSpring2Constraint_setBounce(this._impl,Xgt.TWIST,t)},i.setDriverMode=function(t,e){e===_ut.DISABLED?nlt.Generic6DofSpring2Constraint_enableMotor(this._impl,t,!1):e===_ut.SERVO?(nlt.Generic6DofSpring2Constraint_enableMotor(this._impl,t,!0),nlt.Generic6DofSpring2Constraint_setServo(this._impl,t,!0)):e===_ut.INDUCTION&&(nlt.Generic6DofSpring2Constraint_enableMotor(this._impl,t,!0),nlt.Generic6DofSpring2Constraint_setServo(this._impl,t,!1))},i._updateMotorTargetAndVelocity=function(t){var e=_ut.DISABLED,i=0,n=0,r=0,s=this.constraint.linearDriverSettings,a=this.constraint.angularDriverSettings;switch(t){case 0:i=Xgt.X,e=s.xDrive,n=s.targetPosition.x,r=-s.targetVelocity.x;break;case 1:i=Xgt.Y,e=s.yDrive,n=s.targetPosition.y,r=-s.targetVelocity.y;break;case 2:i=Xgt.Z,e=s.zDrive,n=s.targetPosition.z,r=-s.targetVelocity.z;break;case 3:i=Xgt.TWIST,e=a.twistDrive,n=-Mi(a.targetOrientation.x),r=-Mi(a.targetVelocity.x);break;case 4:i=Xgt.SWING1,e=a.swingDrive1,n=-Mi(a.targetOrientation.y),r=-Mi(a.targetVelocity.y);break;case 5:i=Xgt.SWING2,e=a.swingDrive2,n=-Mi(a.targetOrientation.z),r=-Mi(a.targetVelocity.z)}var o=t>2?a.strength:s.strength;nlt.Generic6DofSpring2Constraint_setServoTarget(this._impl,i,n),e===_ut.SERVO?t>2?nlt.Generic6DofSpring2Constraint_setTargetVelocity(this._impl,i,-n*o*.1):nlt.Generic6DofSpring2Constraint_setTargetVelocity(this._impl,i,n*o*.1):e===_ut.INDUCTION&&nlt.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){nlt.Generic6DofSpring2Constraint_setMaxMotorForce(this._impl,Xgt.X,t),nlt.Generic6DofSpring2Constraint_setMaxMotorForce(this._impl,Xgt.Y,t),nlt.Generic6DofSpring2Constraint_setMaxMotorForce(this._impl,Xgt.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){nlt.Generic6DofSpring2Constraint_setMaxMotorForce(this._impl,Xgt.TWIST,t),nlt.Generic6DofSpring2Constraint_setMaxMotorForce(this._impl,Xgt.SWING1,t),nlt.Generic6DofSpring2Constraint_setMaxMotorForce(this._impl,Xgt.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=Plt(Math.max(this.constraint.breakForce,this.constraint.breakTorque),tct.instance.fixedTimeStep);nlt.TypedConstraint_setMaxImpulseThreshold(this._impl,t)},i.setBreakTorque=function(){var t=Plt(Math.max(this.constraint.breakForce,this.constraint.breakTorque),tct.instance.fixedTimeStep);nlt.TypedConstraint_setMaxImpulseThreshold(this._impl,t)},i.onComponentSet=function(){var t=this.constraint.connectedBody,e=this._rigidBody.body.impl,i=t&&t.body.impl||nlt.TypedConstraint_getFixedBody(),n=hlt.instance.BT_TRANSFORM_0,r=hlt.instance.BT_TRANSFORM_1;this._impl=nlt.Generic6DofSpring2Constraint_new(e,i,n,r,Wgt.RO_YZX);var s=this.constraint.linearLimitSettings,a=this.constraint.angularLimitSettings;this.setConstraintMode(0,s.xMotion),this.setConstraintMode(1,s.yMotion),this.setConstraintMode(2,s.zMotion),this.setConstraintMode(3,a.twistMotion),this.setConstraintMode(4,a.swingMotion1),this.setConstraintMode(5,a.swingMotion2),this.setLinearSoftConstraint(s.enableSoftConstraint),this.setLinearStiffness(s.stiffness),this.setLinearDamping(s.damping),this.setLinearRestitution(s.restitution),this.setSwingSoftConstraint(a.enableSoftConstraintSwing),this.setSwingRestitution(a.swingRestitution),this.setSwingStiffness(a.swingStiffness),this.setSwingDamping(a.swingDamping),this.setTwistSoftConstraint(a.enableSoftConstraintTwist),this.setTwistRestitution(a.twistRestitution),this.setTwistStiffness(a.twistStiffness),this.setTwistDamping(a.twistDamping);var o=this.constraint.linearDriverSettings,h=this.constraint.angularDriverSettings;this.setDriverMode(0,o.xDrive),this.setDriverMode(1,o.yDrive),this.setDriverMode(2,o.zDrive),this.setDriverMode(3,h.twistDrive),this.setDriverMode(4,h.swingDrive1),this.setDriverMode(5,h.swingDrive2),this.setLinearMotorTarget(o.targetPosition),this.setLinearMotorVelocity(o.targetVelocity),this.setLinearMotorForceLimit(o.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=ult,n=_lt,r=dlt,s=hlt.instance.BT_TRANSFORM_0;hn.multiply(i,e.worldScale,t.pivotA),xlt(nlt.Transform_getOrigin(s),i);var a=hlt.instance.BT_QUAT_0,o=t.axis,h=t.secondaryAxis,u=hn.cross(llt,o,h);Dn.set(flt,o.x,o.y,o.z,0,h.x,h.y,h.z,0,u.x,u.y,u.z,0,0,0,0,1).getRotation(n),Olt(a,n),nlt.Transform_setRotation(s,a);var l=hlt.instance.BT_TRANSFORM_1,c=this.constraint.connectedBody;c?(En.multiply(n,e.worldRotation,n),En.invert(r,c.node.worldRotation),En.multiply(n,r,n),t.autoPivotB?(hn.multiply(i,t.node.worldScale,t.pivotA),hn.transformQuat(i,i,e.worldRotation),hn.add(i,i,t.node.worldPosition),hn.subtract(i,i,c.node.worldPosition),hn.transformQuat(i,i,r)):hn.multiply(i,c.node.worldScale,t.pivotB)):(hn.multiply(i,e.worldScale,t.pivotA),hn.transformQuat(i,i,e.worldRotation),hn.add(i,i,e.worldPosition),En.multiply(n,e.worldRotation,n)),xlt(nlt.Transform_getOrigin(l),i),Olt(a,n),nlt.Transform_setRotation(l,a),nlt.Generic6DofSpring2Constraint_setFrames(this._impl,s,l)},i.updateScale0=function(){this.updateFrames()},i.updateScale1=function(){this.updateFrames()},n(e,[{key:"constraint",get:function(){return this._com}}]),e}(Jgt),nvt=new hn(0,0,0),rvt=new hn(0,0,0);new hn(0,0,0);var svt=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=fut.DEFAULT,this._collisionFilterMask=-1,this.id=t.idCounter++,this.wrappedWorld=tct.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=tct.instance.collisionMatrix[e];return this._collisionFilterGroup=e,this._collisionFilterMask=i,this.onComponentSet(),0!==this._impl||(G("[Physics]: Initialize BulletCharacterController failed"),!1)},e.setWrapper=function(){hlt.setWrapper(this._impl,rlt.CCT_CACHE_NAME,this);var t=nlt.CharacterController_getCollisionShape(this.impl);hlt.setWrapper(t,rlt.CCT_CACHE_NAME,this)},e.onEnable=function(){this._isEnabled=!0,this._impl||this.onComponentSet(),this.setDetectCollisions(!1),this.setOverlapRecovery(!0),tct.instance.physicsWorld.addCCT(this),this.setWrapper()},e.onDisable=function(){this._isEnabled=!1,this.wrappedWorld.removeCCT(this),this.onDestroy()},e.onDestroy=function(){nlt._safe_delete(this._impl,Jut.EBulletTypeCharacterController),hlt.delWrapper(this._impl,rlt.CCT_CACHE_NAME),this._impl=0},e.onLoad=function(){},e.getPosition=function(t){this._impl&&Ilt(t,nlt.CharacterController_getPosition(this.impl))},e.setPosition=function(t){this._impl&&(xlt(nlt.CharacterController_getPosition(this.impl),t),this.syncPhysicsToScene())},e.setContactOffset=function(t){this._impl&&nlt.CharacterController_setContactOffset(this._impl,t)},e.setStepOffset=function(t){this._impl&&nlt.CharacterController_setStepOffset(this._impl,t)},e.setSlopeLimit=function(t){this._impl&&nlt.CharacterController_setSlopeLimit(this._impl,Ue(t))},e.setDetectCollisions=function(t){this._impl&&nlt.CharacterController_setCollision(this.impl,t)},e.setOverlapRecovery=function(t){this._impl&&nlt.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&om.SCALE&&this.syncScale(),t.hasChangedFlags&om.POSITION&&(hn.add(nvt,t.worldPosition,this.scaledCenter),this.setPosition(nvt)))},e.syncPhysicsToScene=function(){this.getPosition(nvt),nvt.subtract(this.scaledCenter),this._comp.node.setWorldPosition(nvt)},e.syncScale=function(){this.updateScale()},e.move=function(t,e,i){if(this._isEnabled){var n=hlt.instance.BT_V3_0;nlt.Vec3_set(n,t.x,t.y,t.z),this._btCollisionFlags=nlt.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&&(tct.instance.physicsWorld.removeCCT(this),tct.instance.physicsWorld.addCCT(this),this._dirty=!1)},e.onShapeHitExt=function(t){var e=nlt.ControllerShapeHit_getHitShape(t),i=tct.instance.physicsWorld;i.cctShapeEventDic.get(this.impl,e);var n=new hn;Ilt(n,nlt.ControllerHit_getHitWorldPos(t));var r=new hn;Ilt(r,nlt.ControllerHit_getHitWorldNormal(t));var s=new hn;Ilt(s,nlt.ControllerHit_getHitMotionDir(t));var a=nlt.ControllerHit_getHitMotionLength(t),o=hlt.getWrapper(e,Igt.TYPE);o&&i.cctShapeEventDic.set(this.impl,e,{BulletCharacterController:this,BulletShape:o,worldPos:n,worldNormal:r,motionDir:s,motionLength:a})},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 hn.multiply(rvt,this._comp.center,this._comp.node.worldScale),rvt}}]),t}();svt.idCounter=0;var avt,ovt,hvt,uvt,lvt,cvt,_vt,dvt,fvt=new hn(0,0,0),pvt=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(fvt),fvt.add(this.scaledCenter);var t=hlt.instance.BT_V3_0;nlt.Vec3_set(t,fvt.x,fvt.y,fvt.z);var e=hn.UNIT_Y,i=hlt.instance.BT_V3_1;nlt.Vec3_set(i,e.x,e.y,e.z);var n=nlt.ControllerHitReport.implement(Egt).$$.ptr,r=tct.instance.physicsWorld,s=nlt.CapsuleCharacterControllerDesc_new(Ue(this.component.slopeLimit),this.component.stepOffset,this.component.skinWidth,i,t,n,this.component.radius,this.component.height);this._impl=nlt.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*ji(t.x,t.z),i=this.component.height*Math.abs(t.y);nlt.CapsuleCharacterController_setRadius(this.impl,e),nlt.CapsuleCharacterController_setHeight(this.impl,i),this._dirty=!0},n(e,[{key:"component",get:function(){return this._comp}}]),e}(svt),mvt=new hn(0,0,0),gvt=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(mvt),mvt.add(this.scaledCenter);var t=hlt.instance.BT_V3_0;nlt.Vec3_set(t,mvt.x,mvt.y,mvt.z);var e=hn.UNIT_Y,i=hlt.instance.BT_V3_1;nlt.Vec3_set(i,e.x,e.y,e.z);var n=nlt.ControllerHitReport.implement(Egt).$$.ptr,r=tct.instance.physicsWorld,s=nlt.BoxCharacterControllerDesc_new(Ue(this.component.slopeLimit),this.component.stepOffset,this.component.skinWidth,i,t,n,this.component.halfHeight,this.component.halfSideExtent,this.component.halfForwardExtent);this._impl=nlt.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;nlt.BoxCharacterController_setHalfSideExtent(this.impl,this.component.halfSideExtent*t.x),nlt.BoxCharacterController_setHalfHeight(this.impl,this.component.halfHeight*t.y),nlt.BoxCharacterController_setHalfForwardExtent(this.impl,this.component.halfForwardExtent*t.z),this._dirty=!0},n(e,[{key:"component",get:function(){return this._comp}}]),e}(svt);AL.once(EL.EVENT_PRE_SUBSYSTEM_INIT,(function(){zut.register("bullet",{PhysicsWorld:Ugt,RigidBody:Sgt,BoxShape:Ggt,SphereShape:Hgt,CapsuleShape:zgt,TrimeshShape:jgt,CylinderShape:Ygt,ConeShape:Kgt,TerrainShape:qgt,SimplexShape:Qgt,PlaneShape:Zgt,PointToPointConstraint:$gt,HingeConstraint:evt,FixedConstraint:tvt,ConfigurableConstraint:ivt,BoxCharacterController:gvt,CapsuleCharacterController:pvt})})),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"}(dvt||(dvt={})),Se(dvt);var vvt=t("fA",(avt=qs("cc.Primitive"),ovt=xa(dvt),avt(((_vt=function(t){function e(e){var i;return void 0===e&&(e=dvt.BOX),(i=t.call(this)||this).type=lvt&&lvt(),i.info=cvt&&cvt(),i.type=e,i}return s(e,t),e.prototype.onLoaded=function(){aF(V$[dvt[this.type].toLowerCase()](this.info),this)},e}(QL)).PrimitiveType=dvt,lvt=Gs((uvt=_vt).prototype,"type",[ovt],(function(){return dvt.BOX})),cvt=Gs(uvt.prototype,"info",[ra],(function(){return{}})),hvt=uvt))||hvt));v.Primitive=vvt,v.primitives=V$;var yvt,Tvt,Svt=function(){function t(t,e,i){this._opts=void 0,this._total=0,this._value=0,this._averageValue=0,this._accumValue=0,this._accumSamples=0,this._id=t,this._opts=e,this._accumStart=i}var e=t.prototype;return e.sample=function(t){this._average(this._value,t)},e.human=function(){var t=this._opts,e=t.average,i=t.isInteger,n=e?this._averageValue:this._value;return i?Math.round(n):Math.round(100*n)/100},e.alarm=function(){return this._opts.below&&this._value<this._opts.below||this._opts.over&&this._value>this._opts.over},e._average=function(t,e){if(void 0===e&&(e=0),this._opts.average){this._accumValue+=t,++this._accumSamples;var i=e;i-this._accumStart>=this._opts.average&&(this._averageValue=this._accumValue/this._accumSamples,this._accumValue=0,this._accumStart=i,this._accumSamples=0)}},n(t,[{key:"value",get:function(){return this._value},set:function(t){this._value=t}}]),t}(),Evt=qs("cc.PerfCounter")(yvt=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}(Svt))||yvt,Avt="0123456789. ",Rvt=500,bvt={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,".":10},Cvt={fps:{desc:"Framerate (FPS)",below:30,average:Rvt,isInteger:!0},draws:{desc:"Draw call",isInteger:!0},frame:{desc:"Frame time (ms)",min:0,max:50,average:Rvt},instances:{desc:"Instance Count",isInteger:!0},tricount:{desc:"Triangle",isInteger:!0},logic:{desc:"Game Logic (ms)",min:0,max:50,average:Rvt,color:"#080"},physics:{desc:"Physics (ms)",min:0,max:50,average:Rvt},render:{desc:"Renderer (ms)",min:0,max:50,average:Rvt,color:"#f90"},present:{desc:"Present (ms)",min:0,max:50,average:Rvt,color:"#f90"},textureMemory:{desc:"GFX Texture Mem(M)"},bufferMemory:{desc:"GFX Buffer Mem(M)"}},wvt=t("fB",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 Vc,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(Cvt).length+1),e._wordHeight=0,e._eachNumWidth=0,e._totalLines=0,e.lastTime=0,e._canvas=T.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(){be.querySettings(Re.Category.PROFILING,"showFPS")?this.showStats():this.hideStats()},i.isShowingStats=function(){return this._showFPS},i.hideStats=function(){this._showFPS&&(this._rootNode&&(this._rootNode.active=!1),v.director.off(v.Director.EVENT_BEFORE_UPDATE,this.beforeUpdate,this),v.director.off(v.Director.EVENT_AFTER_UPDATE,this.afterUpdate,this),v.director.off(v.Director.EVENT_BEFORE_PHYSICS,this.beforePhysics,this),v.director.off(v.Director.EVENT_AFTER_PHYSICS,this.afterPhysics,this),v.director.off(v.Director.EVENT_BEFORE_DRAW,this.beforeDraw,this),v.director.off(v.Director.EVENT_AFTER_RENDER,this.afterRender,this),v.director.off(v.Director.EVENT_AFTER_DRAW,this.afterPresent,this),this._showFPS=!1,gL.root.pipeline.profiler=null,v.game.config.showFPS=!1)},i.showStats=function(){if(!this._showFPS){if(!this._device){var t=v.director.root;this._device=wd.gfxDevice,this._swapchain=t.mainWindow.swapchain}this.generateCanvas(),this.generateStats(),v.game.once(v.Game.EVENT_ENGINE_INITED,this.generateNode,this),v.game.on(v.Game.EVENT_RESTART,this.generateNode,this),this._rootNode&&(this._rootNode.active=!0),v.director.on(v.Director.EVENT_BEFORE_UPDATE,this.beforeUpdate,this),v.director.on(v.Director.EVENT_AFTER_UPDATE,this.afterUpdate,this),v.director.on(v.Director.EVENT_BEFORE_PHYSICS,this.beforePhysics,this),v.director.on(v.Director.EVENT_AFTER_PHYSICS,this.afterPhysics,this),v.director.on(v.Director.EVENT_BEFORE_DRAW,this.beforeDraw,this),v.director.on(v.Director.EVENT_AFTER_RENDER,this.afterRender,this),v.director.on(v.Director.EVENT_AFTER_DRAW,this.afterPresent,this),this._showFPS=!0,this._canvasDone=!0,this._statsDone=!0,v.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 t_($l.TEX2D,tc.SAMPLED|tc.TRANSFER_DST,jl.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 Cvt){var n=Cvt[i];this._ctx.fillText(n.desc,0,e*this._lineHeight),n.counter=new Evt(i,n,t),e++}this._totalLines=e,this._wordHeight=this._totalLines*this._lineHeight/this._canvas.height;for(var r=0;r<Avt.length;++r){var s=this._ctx.measureText(Avt[r]).width;this._eachNumWidth=Math.max(this._eachNumWidth,s)}for(var a=0;a<Avt.length;++a)this._ctx.fillText(Avt[a],a*this._eachNumWidth,this._totalLines*this._lineHeight);this._eachNumWidth/=this._canvas.width,this._profilerStats=Cvt,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 $m("PROFILER_NODE"),this._rootNode._objFlags=v.Object.Flags.DontSave|v.Object.Flags.HideInHierarchy,v.game.addPersistRootNode(this._rootNode);var t=new $m("Profiler_Root");t.parent=this._rootNode;for(var e=.4,i=e/this._totalLines,n=e/this._wordHeight,r=i/23,s=this._eachNumWidth*this._canvas.width*r,a=[0,e,0,n,e,0,n,0,0,0,0,0],o=[0,2,1,0,3,2],h=[0,0,-1,0,1,0,-1,0,1,this._wordHeight,-1,0,0,this._wordHeight,-1,0],u=0,l=0;l<this._totalLines;l++)for(var c=0;c<8;c++){a.push(n+c*s,e-l*i,0),a.push(n+(c+1)*s,e-l*i,0),a.push(n+(c+1)*s,e-(l+1)*i,0),a.push(n+c*s,e-(l+1)*i,0),u=4*(8*l+c+1),o.push(0+u,2+u,1+u,0+u,3+u,2+u);var _=8*l+c,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(VK),this._meshRenderer.mesh=aF({positions:a,indices:o,colors:h});var p=new OS;p.initialize({effectName:"util/profiler"});var m=this.pass=p.passes[0],g=m.getBinding("mainTexture"),y=m.getBinding("digits"),T=m.getBinding("offset");m.bindTexture(g,this._texture),this.digitsData=m.blocks[y],this.offsetData=m.blocks[T],this.offsetData[3]=-1,this._meshRenderer.material=p,this._meshRenderer.node.layer=sm.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();v.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=On[t],n=-.9,r=-.9*e;Ol.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?gL.root.pipeline.profiler=this._meshRenderer.model:gL.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<Rvt)){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 a=s.counter.human().toString(),o=7;o>=0;o--){var h=8*i+o,u=a[a.length-(8-o)],l=bvt[u];void 0===l&&(l=11),n[h]=l}i++}}}},n(e,[{key:"_stats",get:function(){return U("Profiler._stats is deprecated, please use Profiler.stats instead."),this._profilerStats}},{key:"stats",get:function(){return this._profilerStats}}]),e}(Lu)),xvt=t("fC",new wvt);gL.registerSystem("profiler",xvt,0),v.profiler=xvt,function(t){var e,i,n,r,s,a,o,h,u,l;(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",(a=t.PositionMode||(t.PositionMode={}))[a.Fixed=0]="Fixed",a[a.Percent=1]="Percent",(o=t.SpacingMode||(t.SpacingMode={}))[o.Length=0]="Length",o[o.Fixed=1]="Fixed",o[o.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",(l=t.TextureWrap||(t.TextureWrap={}))[l.MirroredRepeat=33648]="MirroredRepeat",l[l.ClampToEdge=33071]="ClampToEdge",l[l.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={}))}(Tvt||(Tvt={}));var Ivt=Tvt,Ovt=0,Dvt=0,Mvt=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=++Dvt;i.setTrackEntryListener(n,e),t._trackSet.set(n,e)}return e.listener},t.emitListener=function(e,i,n){var r=t._listenerSet.get(e);r&&r&&r(i,n)},t.emitTrackEntryListener=function(t,e,i,n){var r=this._trackSet.get(t);if(r)switch(n){case Ivt.EventType.start:r.listener.start&&r.listener.start(e);break;case Ivt.EventType.interrupt:r.listener.interrupt&&r.listener.interrupt(e);break;case Ivt.EventType.end:r.listener.end&&r.listener.end(e);break;case Ivt.EventType.dispose:r.listener.dispose&&r.listener.dispose(e),this._trackSet.delete(t),r.listener=null;break;case Ivt.EventType.complete:r.listener.complete&&r.listener.complete(e);break;case Ivt.EventType.event:r.listener.event&&r.listener.event(e,i);break;default:U("TrackEntry doesn't handled",n)}},t.addListener=function(e){var i=++Ovt;return t._listenerSet.set(i,e),i},t}();function Pvt(t,e){return t?e===t.length?t:e<t.length?t.slice(0,e):new Array(e):new Array(e)}function Bvt(t,e,i){var n="_"+i;Object.defineProperty(t,i,{get:function(){var t=e.call(this),i=t.size(),r=this[n];r=Pvt(r,i);for(var s=0;s<i;s++)r[s]=t.get(s);return this[n]=r,r}})}Mvt._listenerSet=new Map,Mvt._trackSet=new Map,globalThis.TrackEntryListeners=Mvt;var Nvt,Lvt=null,Fvt=[];AL.onPostInfrastructureInitDelegate.add((function(){return FL().then((function(){return Promise.all([e.import("./spine.asm-8c7702b2.js"),e.import("./spine.js-6d0b02e3.js"),e.import("./spine.wasm-fa9507cf.js"),e.import("./spine-9a8528df.js")]).then((function(t){var e=t[0].default,i=t[1].default,n=t[2].default,r=t[3].default;return Ol.hasFeature(Ol.Feature.WASM)?function(t,e){return new Promise((function(i,n){var r=function(t){return"[Spine]: Spine wasm load failed: "+t};t({instantiateWasm:function(t,i){NL(e,t).then((function(t){i(t.instance,t.module)})).catch((function(t){return n(r(t))}))}}).then((function(t){Lvt=t,Fvt.forEach((function(t){t(Lvt)}))})).then(i).catch((function(t){return n(r(t))}))}))}(n,r):function(t,e){return new Promise((function(i,n){LL(e).then((function(e){var i={};return i.buffer=new ArrayBuffer(33554432),t({wasmMemory:i,memoryInitializerRequest:{response:e,status:200}}).then((function(t){Lvt=t,Fvt.forEach((function(t){t(Lvt)}))}))})).then(i).catch(n)}))}(e,i)}))})).catch((function(t){G(t)}))})),Fvt.push((function(t){var e;!function(t){Ivt.wasmUtil=t.SpineWasmUtil,Ivt.wasmUtil.wasm=t,Ivt.wasmUtil.spineWasmInit(),Ivt.SPVectorFloat=t.SPVectorFloat,Ivt.MathUtils=t.MathUtils,Ivt.Color=t.Color,Ivt.String=t.String,Ivt.Vector2=t.Vector2,Ivt.Interpolation=t.Interpolation,Ivt.Triangulator=t.Triangulator,Ivt.ConstraintData=t.ConstraintData,Ivt.IkConstraintData=t.IkConstraintData,Ivt.PathConstraintData=t.PathConstraintData,Ivt.SkeletonBounds=t.SkeletonBounds,Ivt.Event=t.Event,Ivt.EventData=t.EventData,Ivt.Attachment=t.Attachment,Ivt.VertexAttachment=t.VertexAttachment,Ivt.BoundingBoxAttachment=t.BoundingBoxAttachment,Ivt.ClippingAttachment=t.ClippingAttachment,Ivt.MeshAttachment=t.MeshAttachment,Ivt.PathAttachment=t.PathAttachment,Ivt.PointAttachment=t.PointAttachment,Ivt.RegionAttachment=t.RegionAttachment,Ivt.AtlasAttachmentLoader=t.AtlasAttachmentLoader,Ivt.TextureAtlasPage=t.TextureAtlasPage,Ivt.TextureAtlasRegion=t.TextureAtlasRegion,Ivt.TextureAtlas=t.TextureAtlas,Ivt.PowOut=t.PowOut,Ivt.BoneData=t.BoneData,Ivt.SlotData=t.SlotData,Ivt.Updatable=t.Updatable,Ivt.IkConstraint=t.IkConstraint,Ivt.PathConstraint=t.PathConstraint,Ivt.TransformConstraintData=t.TransformConstraintData,Ivt.TransformConstraint=t.TransformConstraint,Ivt.Bone=t.Bone,Ivt.Slot=t.Slot,Ivt.Skin=t.Skin,Ivt.SkinEntry=t.SkinEntry,Ivt.SkeletonClipping=t.SkeletonClipping,Ivt.SkeletonData=t.SkeletonData,Ivt.TranslateTimeline=t.TranslateTimeline,Ivt.ScaleTimeline=t.ScaleTimeline,Ivt.ShearTimeline=t.ShearTimeline,Ivt.RotateTimeline=t.RotateTimeline,Ivt.ColorTimeline=t.ColorTimeline,Ivt.TwoColorTimeline=t.TwoColorTimeline,Ivt.AttachmentTimeline=t.AttachmentTimeline,Ivt.DeformTimeline=t.DeformTimeline,Ivt.EventTimeline=t.EventTimeline,Ivt.DrawOrderTimeline=t.DrawOrderTimeline,Ivt.IkConstraintTimeline=t.IkConstraintTimeline,Ivt.TransformConstraintTimeline=t.TransformConstraintTimeline,Ivt.PathConstraintPositionTimeline=t.PathConstraintPositionTimeline,Ivt.PathConstraintMixTimeline=t.PathConstraintMixTimeline,Ivt.TrackEntry=t.TrackEntry,Ivt.AnimationStateData=t.AnimationStateData,Ivt.AnimationState=t.AnimationState,Ivt.Animation=t.Animation,Ivt.EventQueue=t.EventQueue,Ivt.AnimationStateAdapter=t.AnimationStateAdapter,Ivt.Skeleton=t.Skeleton,Ivt.SkeletonBinary=t.SkeletonBinary,Ivt.SkeletonJson=t.SkeletonJson,Ivt.VertexEffect=t.VertexEffect,Ivt.JitterEffect=t.JitterEffect,Ivt.SwirlEffect=t.SwirlEffect,Ivt.SkeletonInstance=t.SkeletonInstance,Ivt.SkeletonSystem=t.SkeletonSystem}(t),[{proto:e=Ivt.String.prototype,property:"length",getter:e.length},{proto:e,property:"isEmpty",getter:e.isEmpty},{proto:e,property:"str",getter:e.str}].forEach((function(t){xt(t.proto,t.property,t.getter)})),function(t,e){Object.defineProperty(t,"strPtr",{value:function(){var t=e.call(this),i=Ivt.wasmUtil.wasm.HEAPU8,n=this.length,r=i.subarray(t,t+n);return String.fromCharCode.apply(String,r)}})}(e,e.strPtr),function(){var t=Ivt.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){xt(t.proto,t.property,t.getter,t.setter)}))}(),function(){var t=Ivt.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=Ivt.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=Ivt.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)})),Bvt(t,t.getBones,"bones")}(),function(){var t=Ivt.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)})),Bvt(t,t.getBones,"bones")}(),function(){var t=Ivt.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=Ivt.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=Ivt.BoundingBoxAttachment.prototype;[{proto:t,property:"name",getter:t.getName}].forEach((function(t){wt(t.proto,t.property,t.getter)}))}(),function(){var t=Ivt.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=Ivt.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)})),Bvt(t,t.getRegionUVs,"regionUVs"),Bvt(t,t.getUVs,"uvs"),Bvt(t,t.getTriangles,"triangles"),Bvt(t,t.getEdges,"edges")}(),function(){var t=Ivt.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)})),Bvt(t,t.getLengths,"lengths")}(),function(){var t=Ivt.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=Ivt.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)})),Bvt(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=Pvt(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 Ivt.SPVectorFloat;Object.defineProperty(t,"computeWorldVertices",{value:function(t,e,i,s){var a=e.length;r.resize(a,0);for(var o=0;o<a;o++)r.set(o,e[o]);n.call(this,t,r,i,s);for(var h=0;h<a;h++)e[h]=r.get(h)}})}(),function(){var t=Ivt.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)})),Bvt(t,t.getBones,"bones"),Bvt(t,t.getVertices,"vertices");var e=t.computeWorldVertices,i=new Ivt.SPVectorFloat;Object.defineProperty(t,"computeWorldVertices",{value:function(t,n,r,s,a,o){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,a,o);for(var l=0;l<h;l++)s[l]=i.get(l)}})}(),function(){var t=Ivt.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=Ivt.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)})),Bvt(t,t.getBones,"bones")}(),function(){var t=Ivt.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)})),Bvt(t,t.getBones,"bones")}(),function(){var t=Ivt.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)})),Bvt(t,t.getBones,"bones")}(),function(){var t=Ivt.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)})),Bvt(t,t.getBones,"bones")}(),function(){var t=Ivt.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)})),Bvt(t,t.getChildren,"children")}(),function(){var t=Ivt.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)})),Bvt(t,t.getDeform,"deform")}(),function(){var t=Ivt.Skin.prototype;[{proto:t,property:"name",getter:t.getName}].forEach((function(t){wt(t.proto,t.property,t.getter)})),Bvt(t,t.getBones,"bones"),Bvt(t,t.getAttachments,"attachments"),Bvt(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=Pvt(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=Pvt(i,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=Pvt(e,r);for(var s=0;s<r;s++)e[s]=n.get(s);n.delete()}})}(),function(){var t=Ivt.Attachment.prototype;[{proto:t,property:"name",getter:t.getName}].forEach((function(t){wt(t.proto,t.property,t.getter)}))}(),function(){var t=Ivt.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=Ivt.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=Ivt.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)})),Bvt(t,t.getBones,"bones"),Bvt(t,t.getSlots,"slots"),Bvt(t,t.getSkins,"skins"),Bvt(t,t.getAnimations,"animations"),Bvt(t,t.getEvents,"events"),Bvt(t,t.getIkConstraints,"ikConstraints"),Bvt(t,t.getTransformConstraints,"transformConstraints"),Bvt(t,t.getPathConstraints,"pathConstraints")}(),function(){var t=Ivt.RotateTimeline.prototype;[{proto:t,property:"boneIndex",getter:t.getBoneIndex}].forEach((function(t){wt(t.proto,t.property,t.getter)})),Bvt(t,t.getFrames,"frames")}(),function(){var t=Ivt.ColorTimeline.prototype;[{proto:t,property:"slotIndex",getter:t.getSlotIndex}].forEach((function(t){wt(t.proto,t.property,t.getter)})),Bvt(t,t.getFrames,"frames")}(),function(){var t=Ivt.TwoColorTimeline.prototype;[{proto:t,property:"slotIndex",getter:t.getSlotIndex}].forEach((function(t){wt(t.proto,t.property,t.getter)}))}(),function(){var t=Ivt.AttachmentTimeline.prototype;[{proto:t,property:"slotIndex",getter:t.getSlotIndex}].forEach((function(t){wt(t.proto,t.property,t.getter)})),Bvt(t,t.getFrames,"frames"),Bvt(t,t.getAttachmentNames,"attachmentNames")}(),function(){var t=Ivt.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)})),Bvt(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=Pvt(r,i);for(var s=0;s<i;s++){var a=t.get(s),o=a.size(),h=r[s];h=Pvt(h,o);for(var u=0;u<o;u++)h[u]=a.get(u);r[s]=h}return this[n]=r,r}})}(t,t.getFrameVertices,"frameVertices")}(),function(){var t=Ivt.EventTimeline.prototype;Bvt(t,t.getFrames,"frames"),Bvt(t,t.getEvents,"events")}(),function(){var t=Ivt.DrawOrderTimeline.prototype;Bvt(t,t.getFrames,"frames")}(),function(){var t=Ivt.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=Ivt.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=Ivt.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)})),Bvt(t,t.getTracks,"tracks")}(),function(){var t=Ivt.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)})),Bvt(t,t.getTimelines,"timelines")}(),function(){var t=Ivt.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)})),Bvt(t,t.getBones,"bones"),Bvt(t,t.getSlots,"slots"),Bvt(t,t.getDrawOrder,"drawOrder"),Bvt(t,t.getIkConstraints,"ikConstraints"),Bvt(t,t.getTransformConstraints,"transformConstraints"),Bvt(t,t.getPathConstraints,"pathConstraints"),Bvt(t,t.getUpdateCacheList,"_updateCache")}(),function(){var t=Ivt.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=Ivt.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 kvt=1/60;yk(pk);var Uvt,Gvt,Hvt,zvt,Vvt,Wvt,Xvt,jvt,Yvt,Kvt,qvt=yk(gk),Qvt=function(){this.a=0,this.b=0,this.c=0,this.d=0,this.worldX=0,this.worldY=0},Zvt=function(){this.vCount=0,this.iCount=0,this.vData=null,this.iData=null,this.meshes=[]},Jvt=function(){this.iCount=0,this.blendMode=0,this.textureID=0},$vt=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 Ivt.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/kvt),this._maxFrameIdex<=0&&(this._maxFrameIdex=1),this._instance.setAnimation(0,t,!1)):U("find no animation named "+t+" !!!")},e.updateToFrame=function(t){if(this._inited&&(this.begin(),this.needToUpdate(t)))do{this._frameIdx++,this.totalTime+=kvt,this._instance.updateAnimation(kvt);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=qvt/Float32Array.BYTES_PER_ELEMENT,s=new Uint8Array(Float32Array.BYTES_PER_ELEMENT*r*i),a=new Uint16Array(n),o=Ivt.wasmUtil.wasm.HEAPU8,h=e.vPtr,u=i*Float32Array.BYTES_PER_ELEMENT*r;s.set(o.subarray(h,h+u));var l=e.iPtr,c=Uint16Array.BYTES_PER_ELEMENT*n;new Uint8Array(a.buffer).set(o.subarray(l,l+c));var _=new Zvt;_.vCount=i,_.iCount=n,_.vData=s,_.iData=a;for(var d=e.getData(),f=d.size(),p=0;p<f;p+=6){var m=new Jvt;m.iCount=d.get(p+3),m.blendMode=d.get(p+4),m.textureID=d.get(p+5),_.meshes.push(m)}var g=this._skeleton.bones,v=[];g.forEach((function(t){var e=new Qvt;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}(),tyt=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._privateMode?function(t,e){e.destroy()}:function(i,n){e._animationPool[t+"#"+i]=n,n.clear()},r=this._skeletonCache[t];if(r){var s=r.animationsCache;for(var a in s){var o=s[a];o&&n(a,o)}r.skeleton&&Ivt.wasmUtil.destroySpineSkeleton(r.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 Ivt.Skeleton(i),s=new Mvt;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,a=s[i];if(!a){var o=t+"#"+i;(a=this._animationPool[o])?delete this._animationPool[o]:(a=new $vt(n))._privateMode=this._privateMode,a.init(r,i),s[i]=a}return a.init(r,i),a.setAnimation(i),a},e.destroyCachedAnimations=function(t){if(t){var e=this._animationPool;for(var i in e)i.includes(t)&&(e[i].destroy(),delete e[i])}else{var n=this._animationPool;for(var r in n)n[r].destroy(),delete n[r]}},t}();Nvt=tyt,tyt.FrameTime=kvt,tyt.sharedCache=new Nvt;var eyt=(Uvt=qs("sp.SkeletonData"),Gvt=xa([em]),Hvt=xa([Ze]),Uvt((Vvt=function(t){function e(){var e;return(e=t.call(this)||this)._skeletonJson=Wvt&&Wvt(),e.textures=Xvt&&Xvt(),e.textureNames=jvt&&jvt(),e.scale=Yvt&&Yvt(),e._atlasText=Kvt&&Kvt(),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 $m(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||G(this.name+" no textures found!"),null;var e=Ivt.wasmUtil.querySpineSkeletonDataByUUID(this._uuid);if(e)this._skeletonCache=e;else if(this.skeletonJsonStr)this._skeletonCache=Ivt.wasmUtil.createSpineSkeletonDataWithJson(this.skeletonJsonStr,this._atlasText),Ivt.wasmUtil.registerSpineSkeletonDataWithUUID(this._skeletonCache,this._uuid);else{var i=new Uint8Array(this._nativeAsset),n=i.length,r=Ivt.wasmUtil.queryStoreMemory(n);Ivt.wasmUtil.wasm.HEAPU8.subarray(r,r+n).set(i),this._skeletonCache=Ivt.wasmUtil.createSpineSkeletonDataWithBinary(n,this._atlasText),Ivt.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=ve(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=ve(e)}return null},i.destroy=function(){return tyt.sharedCache.destroyCachedAnimations(this._uuid),this._skeletonCache&&Ivt.wasmUtil.registerSpineSkeletonDataWithUUID(this._skeletonCache,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}(uf),Wvt=Gs(Vvt.prototype,"_skeletonJson",[ra],(function(){return null})),Xvt=Gs(Vvt.prototype,"textures",[ra,Gvt],(function(){return[]})),jvt=Gs(Vvt.prototype,"textureNames",[ra,Hvt],(function(){return[]})),Yvt=Gs(Vvt.prototype,"scale",[ra],(function(){return 1})),Kvt=Gs(Vvt.prototype,"_atlasText",[ra],(function(){return""})),zvt=Vvt))||zvt);v.internal.SpineSkeletonData=eyt;var iyt=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,gL.registerSystem(e.ID,e._instance,Lu.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}(Lu);iyt.ID="SKELETON",iyt._instance=void 0,v.internal.SpineSkeletonSystem=iyt;var nyt,ryt,syt,ayt,oyt,hyt,uyt,lyt,cyt,_yt,dyt,fyt,pyt,myt,gyt,vyt,yyt,Tyt,Syt,Eyt,Ayt,Ryt,byt,Cyt,wyt,xyt,Iyt,Oyt,Dyt,Myt,Pyt,Byt,Nyt,Lyt,Fyt=new Dn,kyt=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 a=this._skeletonBones[r];a&&this.matrixHandle(s,a)}else this._keysToDelete.push(r)}if(!(this._keysToDelete.length<=0)){for(var o,h=d(this._keysToDelete);!(o=h()).done;){var u=o.value;e.delete(u)}this._keysToDelete.length=0}}},e.matrixHandle=function(t,e){var i=Fyt;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=Fyt},t}(),Uyt=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"}(Pyt||(Pyt={})),Se(Pyt),function(t){t[t.default=0]="default"}(Byt||(Byt={})),Se(Byt),function(t){t[t["<None>"]=0]="<None>"}(Nyt||(Nyt={})),Se(Nyt),function(t){t[t.COLORED_TEXTURED=0]="COLORED_TEXTURED",t[t.TWO_COLORED=1]="TWO_COLORED"}(Lyt||(Lyt={}));var Gyt=(nyt=qs("sp.Skeleton.SpineSocket"),ryt=xa($m),nyt((ayt=function(t,e){void 0===t&&(t=""),void 0===e&&(e=null),this.path=oyt&&oyt(),this.target=hyt&&hyt(),this.path=t,this.target=e},oyt=Gs(ayt.prototype,"path",[ra],(function(){return""})),hyt=Gs(ayt.prototype,"target",[ryt,ra],(function(){return null})),syt=ayt))||syt);Jt(Gyt,"sp.Skeleton.SpineSocket");var Hyt=(uyt=qs("sp.Skeleton"),lyt=xa(eyt),cyt=xa(Byt),_yt=xa(Nyt),dyt=xa(Pyt),fyt=xa([Gyt]),pyt=xa(OS),uyt(((Myt=function(t){function e(){var e;return(e=t.call(this)||this)._skeletonData=vyt&&vyt(),e.defaultSkin=yyt&&yyt(),e.defaultAnimation=Tyt&&Tyt(),e._premultipliedAlpha=Syt&&Syt(),e._timeScale=Eyt&&Eyt(),e._preCacheMode=Ayt&&Ayt(),e._cacheMode=Ryt&&Ryt(),e._sockets=byt&&byt(),e._useTint=Cyt&&Cyt(),e._debugMesh=wyt&&wyt(),e._debugBones=xyt&&xyt(),e._debugSlots=Iyt&&Iyt(),e._enableBatch=Oyt&&Oyt(),e._runtimeData=null,e._skeleton=null,e._instance=null,e._state=null,e._textures=[],e._skeletonInfo=null,e._animationName="",e._skinName="",e._drawList=new Bu((function(){return{material:null,texture:null,indexOffset:0,indexCount:0}}),1),e._materialCache={},e.paused=!1,e._enumSkins=ve({}),e._enumAnimations=ve({}),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.loop=Dyt&&Dyt(),e._useVertexOpacity=!0,e._startEntry={animation:{name:""},trackIndex:0},e._endEntry={animation:{name:""},trackIndex:0},e._startSlotIndex=-1,e._endSlotIndex=-1,e._instance=new Ivt.SkeletonInstance,e._instance.dtRate=1*e._timeScale,e._instance.isCache=e.isAnimationCached(),e.attachUtil=new kyt,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(),iyt.getInstance().add(this)},i.onDisable=function(){t.prototype.onDisable.call(this),this._instance&&(this._instance.enable=!1),iyt.getInstance().remove(this)},i.onDestroy=function(){var e;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,iyt.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===Pyt.SHARED_CACHE?this._skeletonCache=tyt.sharedCache:this._cacheMode===Pyt.PRIVATE_CACHE?(this._skeletonCache=new tyt,this._skeletonCache.enablePrivateMode()):this._skeletonCache=null,e!==this._skeletonCache&&this._destroySkeletonInfo(e),this.isAnimationCached()){(this.debugBones||this.debugSlots)&&U("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()?U("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 Y(7511),null;if(!this._skeleton.data.findAnimation(e))return Y(7509,e),null;var n=null;if(void 0===i&&(i=!0),this._playTimes=i?0:1,this.isAnimationCached()){if(0!==t&&U("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&&U("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):(Y(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())U("'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(t*=1*this._timeScale,this.isAnimationCached()){if(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=tyt.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(),a=s.indexOffset,o=0;o<this._drawList.length;o++){var h=this._drawList.data[o];h.texture&&t.commitMiddleware(this,s,a+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,a=null===(s=this._slotTextures)||void 0===s?void 0:s.get(e);a&&(r.texture=a)}return r.indexOffset=i,r.indexCount=n,r},i._updateBuiltinMaterial=function(){return aS.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 US({parent:s,subModelIdx:0,owner:this}),this._materialCache[n]=r,r.overridePipelineStates({blendState:{blendColor:pn.WHITE,targets:[{blendEq:lc.ADD,blendAlphaEq:lc.ADD,blendSrc:t,blendDst:e,blendSrcAlpha:t,blendDstAlpha:e}]}});var a=!1;i===Lyt.TWO_COLORED&&(a=!0);var o=!this._enableBatch;return r.recompileShaders({TWO_COLORED:a,USE_LOCAL:o}),r},i._updateAnimEnum=function(){var t;t=this.skeletonData?this.skeletonData.getAnimsEnum():Nyt,this._enumAnimations=ve({}),Object.assign(this._enumAnimations,t),ve.update(this._enumAnimations),hi(this,"_animationIndex",this._enumAnimations)},i._updateSkinEnum=function(){var t;t=this.skeletonData?this.skeletonData.getSkinsEnum():Byt,this._enumSkins=ve({}),Object.assign(this._enumSkins,t),ve.update(this._enumSkins),hi(this,"_defaultSkinIndex",this._enumSkins)},i._refreshInspector=function(){},i.destroyRenderData=function(){this._drawList.reset(),t.prototype.destroyRenderData.call(this)},i.createRenderEntity=function(){var t=new Kk(Dk.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!==Pyt.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()?U("cached mode not support setMix!!!"):this._state&&this._instance.setMix(t,e,i)},i.clearTracks=function(){this.isAnimationCached()?U("'clearTracks' interface can not be invoked in cached mode."):this._state&&(this._state.clearTracks(),this.setToSetupPose())},i.clearTrack=function(t){this.isAnimationCached()?U("'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||G("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)?G("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){G("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 $m("DEBUG_DRAW_NODE");t.hideFlags|=Wa.Flags.DontSave|Wa.Flags.HideInHierarchy;var e=t.addComponent(iz);e.lineWidth=1,e.strokeColor=new pn(255,0,0,255),this._debugRenderer=e,t.parent=this.node}this.isAnimationCached()?U("Debug bones or slots is invalid in cached mode"):this._instance.setDebugMode(!0)}else this._debugRenderer&&(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 Mvt)},i.setStartListener=function(t){this._ensureListener();var e=Mvt.addListener(t);this._instance.setListener(e,Ivt.EventType.start),this._listener.start=t},i.setInterruptListener=function(t){this._ensureListener();var e=Mvt.addListener(t);this._instance.setListener(e,Ivt.EventType.interrupt),this._listener.interrupt=t},i.setEndListener=function(t){this._ensureListener();var e=Mvt.addListener(t);this._instance.setListener(e,Ivt.EventType.end),this._listener.end=t},i.setDisposeListener=function(t){this._ensureListener();var e=Mvt.addListener(t);this._instance.setListener(e,Ivt.EventType.dispose),this._listener.dispose=t},i.setCompleteListener=function(t){this._ensureListener();var e=Mvt.addListener(t);this._instance.setListener(e,Ivt.EventType.complete),this._listener.complete=t},i.setEventListener=function(t){this._ensureListener();var e=Mvt.addListener(t);this._instance.setListener(e,Ivt.EventType.event),this._listener.event=t},i.setTrackStartListener=function(t,e){Mvt.getListeners(t,this._instance).start=e},i.setTrackInterruptListener=function(t,e){Mvt.getListeners(t,this._instance).interrupt=e},i.setTrackEndListener=function(t,e){Mvt.getListeners(t,this._instance).end=e},i.setTrackDisposeListener=function(t,e){Mvt.getListeners(t,this._instance).dispose=e},i.setTrackCompleteListener=function(t,e){Mvt.getListeners(t,this._instance).complete=function(t){var i=Math.floor(t.trackTime/t.animationEnd);Mvt.addListener(e),e(t,i)}},i.setTrackEventListener=function(t,e){Mvt.getListeners(t,this._instance).event=e},i.getDebugShapes=function(){return this._instance.getDebugShapes()},i.setSlotTexture=function(t,e,i){if(this.isAnimationCached())G("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 a=0;this._slotTextures.forEach((function(t,i){t===e&&(a=i)})),0===a&&(a=++Uyt,this._slotTextures.set(a,e)),this._instance.setSlotTexture(t,a)}else G("No slot named:"+t)},i._destroySkeletonInfo=function(t){t&&this._skeletonInfo&&(t.destroySkeleton(this._skeletonInfo.assetUUID),this._skeletonInfo=null)},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()):G(this.name+" skin enums are invalid")}else G(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):G(this.name+" animation enums are invalid")}else G(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}(bU)).SpineSocket=Gyt,Myt.AnimationCacheMode=Pyt,vyt=Gs((gyt=Myt).prototype,"_skeletonData",[ra],(function(){return null})),yyt=Gs(gyt.prototype,"defaultSkin",[ra],(function(){return""})),Tyt=Gs(gyt.prototype,"defaultAnimation",[ra],(function(){return""})),Syt=Gs(gyt.prototype,"_premultipliedAlpha",[ra],(function(){return!0})),Eyt=Gs(gyt.prototype,"_timeScale",[ra],(function(){return 1})),Ayt=Gs(gyt.prototype,"_preCacheMode",[ra],(function(){return Pyt.UNSET})),Ryt=Gs(gyt.prototype,"_cacheMode",[ra],(function(){return Pyt.REALTIME})),byt=Gs(gyt.prototype,"_sockets",[ra],(function(){return[]})),Cyt=Gs(gyt.prototype,"_useTint",[ra],(function(){return!1})),wyt=Gs(gyt.prototype,"_debugMesh",[ra],(function(){return!1})),xyt=Gs(gyt.prototype,"_debugBones",[ra],(function(){return!1})),Iyt=Gs(gyt.prototype,"_debugSlots",[ra],(function(){return!1})),Oyt=Gs(gyt.prototype,"_enableBatch",[ra],(function(){return!1})),f(gyt.prototype,"skeletonData",[lyt],Object.getOwnPropertyDescriptor(gyt.prototype,"skeletonData"),gyt.prototype),f(gyt.prototype,"_defaultSkinIndex",[cyt],Object.getOwnPropertyDescriptor(gyt.prototype,"_defaultSkinIndex"),gyt.prototype),f(gyt.prototype,"_animationIndex",[_yt],Object.getOwnPropertyDescriptor(gyt.prototype,"_animationIndex"),gyt.prototype),f(gyt.prototype,"defaultCacheMode",[dyt],Object.getOwnPropertyDescriptor(gyt.prototype,"defaultCacheMode"),gyt.prototype),Dyt=Gs(gyt.prototype,"loop",[ra],(function(){return!0})),f(gyt.prototype,"sockets",[fyt],Object.getOwnPropertyDescriptor(gyt.prototype,"sockets"),gyt.prototype),f(gyt.prototype,"customMaterial",[Ia,pyt],Object.getOwnPropertyDescriptor(gyt.prototype,"customMaterial"),gyt.prototype),myt=gyt))||myt);v.internal.SpineSkeleton=Hyt;var zyt,Vyt,Wyt,Xyt,jyt=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 Ivt.JitterEffect(t,e),this._vertexEffect},e.initSwirlWithPow=function(t,e){return this._effectType="swirl",this._interpolation=new Ivt.Pow(e),this._vertexEffect=new Ivt.SwirlEffect(t,this._interpolation),this._vertexEffect},e.initSwirlWithPowOut=function(t,e){return this._effectType="swirl",this._interpolation=new Ivt.PowOut(e),this._vertexEffect=new Ivt.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}(),Yyt=new pn(0,0,255,255),Kyt=new pn(255,0,0,255),qyt=new pn(0,255,0,255),Qyt=new pn(255,255,0,255),Zyt=null,Jyt=null,$yt=!1,tTt=!1,eTt=yk(pk),iTt=yk(gk),nTt=new hn(0,0,0);function rTt(t,e){var i,n;switch(t){case 1:i=$yt?uc.ONE:uc.SRC_ALPHA,n=uc.ONE;break;case 2:i=uc.DST_COLOR,n=uc.ONE_MINUS_SRC_ALPHA;break;case 3:i=uc.ONE,n=uc.ONE_MINUS_SRC_COLOR;break;case 0:default:i=$yt?uc.ONE:uc.SRC_ALPHA,n=uc.ONE_MINUS_SRC_ALPHA}return e.getMaterialForBlendAndTint(i,n,tTt?Lyt.TWO_COLORED:Lyt.COLORED_TEXTURED)}var sTt={vCount:32767,ensureAccessor:function(t){var e=t?Jyt:Zyt;if(!e){var i=gL.root.device,n=gL.root.batcher2D,r=t?gk:pk;t?(e=Jyt=new Ok(i,r,this.vCount),n.registerBufferAccessor(Number.parseInt("SPINETINT",36),Jyt)):(e=Zyt=new Ok(i,r,this.vCount),n.registerBufferAccessor(Number.parseInt("SPINE",36),Zyt))}return e},createData:function(t){var e=t.renderData;if(!e){var i=t.useTint||t.isAnimationCached(),n=this.ensureAccessor(i);e=Zk.add(i?gk:pk,n)}return e},updateRenderData:function(t){t._skeleton&&function(t){if(t.drawList.reset(),0!==t.color.a){t._updateColor(),$yt=t.premultipliedAlpha,tTt=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,a=new Uint8Array(s.buffer,s.byteOffset,Float32Array.BYTES_PER_ELEMENT*s.length);a.set(e.vData);var o=t.color;if(4294967295!==o._val||$yt){zyt=o.r/255,Vyt=o.g/255,Wyt=o.b/255,Xyt=o.a/255;for(var h=0;h<i;h++){var u=h*iTt+5*Float32Array.BYTES_PER_ELEMENT,l=a[u],c=a[u+1],_=a[u+2],d=a[u+3]*Xyt,f=$yt?d/255:1;a[u]=Math.floor(f*l*zyt),a[u+1]=Math.floor(f*c*Vyt),a[u+2]=Math.floor(f*_*Wyt),a[u+3]=Math.floor(d),a[u+4]=Math.floor(a[u+4]*zyt),a[u+5]=Math.floor(a[u+5]*Vyt),a[u+6]=Math.floor(a[u+6]*Wyt),a[u+7]=$yt?255:0}}var p=r.indices;p.set(e.iData);for(var m=r.chunk.vertexOffset,g=0;g<n;g++)p[g]+=m;for(var v=e.meshes,y=v.length,T=0,S=0,E=0;E<y;E++){var A=v[E],R=rTt(A.blendMode,t),b=A.textureID;S=A.iCount,t.requestDrawData(R,b,T,S),T+=S}var C=iTt/Float32Array.BYTES_PER_ELEMENT;if(t.enableBatch)for(var w=t.node.worldMatrix,x=0,I=0;I<i;I++)x=I*C,nTt.x=s[x],nTt.y=s[x+1],nTt.z=0,nTt.transformMat4(w),s[x]=nTt.x,s[x+1]=nTt.y,s[x+2]=nTt.z}}}(t):function(t){var e,i,n=(t.useTint?iTt:eTt)/Float32Array.BYTES_PER_ELEMENT,r=t.updateRenderData(),s=r.vCount,a=r.iCount;if(!(s<1||a<1)){var o=t.renderData;o.vertexCount===s&&o.indexCount===a||(o.resize(s,a),o.indices=new Uint16Array(a),t._vLength=s*Float32Array.BYTES_PER_ELEMENT*n,t._vBuffer=new Uint8Array(o.chunk.vb.buffer,o.chunk.vb.byteOffset,Float32Array.BYTES_PER_ELEMENT*o.chunk.vb.length),t._iLength=Uint16Array.BYTES_PER_ELEMENT*a,t._iBuffer=new Uint8Array(o.indices.buffer));var h=o.chunk.vb,u=r.vPtr,l=r.iPtr,c=o.indices,_=Ivt.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(l,l+t._iLength),0);for(var d=o.chunk.vertexOffset,f=0;f<a;f++)c[f]+=d;for(var p=r.getData(),m=p.size(),g=0,v=0,y=0;y<m;y+=6){v=p.get(y+3);var T=rTt(p.get(y+4),t),S=p.get(y+5);t.requestDrawData(T,S,g,v),g+=v}if(t.enableBatch)for(var E=t.node.worldMatrix,A=0,R=0;R<s;R++)A=R*n,nTt.x=h[A],nTt.y=h[A+1],nTt.transformMat4(E),h[A]=nTt.x,h[A+1]=nTt.y,h[A+2]=0;var b=t._debugRenderer,C=t._skeleton;if(b&&(t.debugBones||t.debugSlots||t.debugMesh)){b.clear(),b.lineWidth=5;for(var w=t.getDebugShapes(),x=w.size(),I=0;I<x;I++){var O=w.get(I);if(0===O.type&&t.debugSlots){b.strokeColor=Yyt;var D=O.vOffset*n,M=O.vCount*n;b.moveTo(h[D],h[D+1]);for(var P=D+n,B=D+M;P<B;P+=n)b.lineTo(h[P],h[P+1]);b.close(),b.stroke()}else if(1===O.type&&t.debugMesh){b.strokeColor=Qyt;for(var N=O.iCount,L=O.iOffset,F=L,k=L+N;F<k;F+=3){var U=c[F]*n,G=c[F+1]*n,H=c[F+2]*n;b.moveTo(h[U],h[U+1]),b.lineTo(h[G],h[G+1]),b.lineTo(h[H],h[H+1]),b.close(),b.stroke()}}}if(t.debugBones){b.strokeColor=Kyt,b.fillColor=Yyt;for(var z=0,V=C.bones.length;z<V;z++){var W=C.bones[z],X=W.data.length*W.a+W.worldX,j=W.data.length*W.c+W.worldY;b.moveTo(W.worldX,W.worldY),b.lineTo(X,j),b.stroke(),b.circle(W.worldX,W.worldY,1.5*Math.PI),b.fill(),0===z&&(b.fillColor=qyt)}}}}}(t);var e=t.renderData,i=tTt?Jyt:Zyt;t.syncAttachedNode(),(e.vertexCount>0||e.indexCount>0)&&i.getMeshBuffer(e.chunk.bufferId).setDirty()}}(t)}};v.internal.SpineAssembler=sTt;var aTt,oTt,hTt={getAssembler:function(){return sTt}};Hyt.Assembler=hTt,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"}(aTt||(aTt={})),Se(aTt),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"}(oTt||(oTt={})),Se(oTt),t("fD",Object.freeze({__proto__:null,spine:Ivt,get ATTACHMENT_TYPE(){return aTt},get AnimationEventType(){return oTt},timeScale:1,get AnimationCacheMode(){return Pyt},get DefaultSkinsEnum(){return Byt},get DefaultAnimsEnum(){return Nyt},get SpineMaterialType(){return Lyt},SpineSocket:Gyt,Skeleton:Hyt,SkeletonData:eyt,VertexEffectDelegate:jyt,simpleSpineAssembler:hTt}));var uTt=function(){function t(){this.originalTarget=null,this.target=null,this.tag=t.TAG_INVALID}var e=t.prototype;return e.clone=function(){var e=new t;return e.originalTarget=null,e.target=null,e.tag=this.tag,e},e.isDone=function(){return!0},e.startWithTarget=function(t){this.originalTarget=t,this.target=t},e.stop=function(){this.target=null},e.step=function(){Y(1006)},e.update=function(){Y(1007)},e.getTarget=function(){return this.target},e.setTarget=function(t){this.target=t},e.getOriginalTarget=function(){return this.originalTarget},e.setOriginalTarget=function(t){this.originalTarget=t},e.getTag=function(){return this.tag},e.setTag=function(t){this.tag=t},e.reverse=function(){return Y(1008),null},e.retain=function(){},e.release=function(){},t}();uTt.TAG_INVALID=-1;var lTt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._duration=0,e._timesForRepeat=1,e}s(e,t);var i=e.prototype;return i.getDuration=function(){return this._duration*(this._timesForRepeat||1)},i.setDuration=function(t){this._duration=t},i.clone=function(){return new e},e}(uTt);!function(t){function e(e,i){var n;return void 0===i&&(i=1),(n=t.call(this)||this)._speed=0,n._innerAction=null,e&&n.initWithAction(e,i),n}s(e,t);var i=e.prototype;i.getSpeed=function(){return this._speed},i.setSpeed=function(t){this._speed=t},i.initWithAction=function(t,e){return t?(this._innerAction=t,this._speed=e,!0):(Z(1021),!1)},i.clone=function(){var t=new e;return t.initWithAction(this._innerAction.clone(),this._speed),t},i.startWithTarget=function(t){uTt.prototype.startWithTarget.call(this,t),this._innerAction.startWithTarget(t)},i.stop=function(){this._innerAction.stop(),uTt.prototype.stop.call(this)},i.step=function(t){this._innerAction.step(t*this._speed)},i.isDone=function(){return this._innerAction.isDone()},i.reverse=function(){return new e(this._innerAction.reverse(),this._speed)},i.setInnerAction=function(t){this._innerAction!==t&&(this._innerAction=t)},i.getInnerAction=function(){return this._innerAction}}(uTt);var cTt=0,_Tt=function(){this.actions=[],this.target=null,this.actionIndex=0,this.currentAction=null,this.paused=!1,this.lock=!1},dTt=function(){function t(){this._hashTargets=new Map,this._arrayTargets=[],this._currentTarget=void 0,this._elementPool=[]}var e=t.prototype;return e._searchElementByTarget=function(t,e){for(var i=0;i<t.length;i++)if(e===t[i].target)return t[i];return null},e._getElement=function(t,e){var i=this._elementPool.pop();return i||(i=new _Tt),i.target=t,i.paused=!!e,i},e._putElement=function(t){t.actions.length=0,t.actionIndex=0,t.currentAction=null,t.paused=!1,t.target=null,t.lock=!1,this._elementPool.push(t)},e.addAction=function(t,e,i){if(t&&e){null==e.uuid&&(e.uuid="_TWEEN_UUID_"+cTt++);var n=this._hashTargets.get(e);n?n.actions||(n.actions=[]):(n=this._getElement(e,i),this._hashTargets.set(e,n),this._arrayTargets.push(n)),n.target=e,n.actions.push(t),t.startWithTarget(e)}else Z(1e3)},e.removeAllActions=function(){for(var t=this._arrayTargets,e=0;e<t.length;e++){var i=t[e];i&&this._putElement(i)}this._arrayTargets.length=0,this._hashTargets=new Map},e.removeAllActionsFromTarget=function(t){if(null!=t){var e=this._hashTargets.get(t);e&&(e.actions.length=0,this._deleteHashElement(e))}},e.removeAction=function(t){if(null!=t){var e=t.getOriginalTarget(),i=this._hashTargets.get(e);if(i)for(var n=0;n<i.actions.length;n++)if(i.actions[n]===t){i.actions.splice(n,1),i.actionIndex>=n&&i.actionIndex--;break}}},e._removeActionByTag=function(t,e,i){for(var n=0,r=e.actions.length;n<r;++n){var s=e.actions[n];if(s&&s.getTag()===t){if(i&&s.getOriginalTarget()!==i)continue;this._removeActionAtIndex(n,e);break}}},e._removeAllActionsByTag=function(t,e,i){for(var n=e.actions.length-1;n>=0;--n){var r=e.actions[n];if(r&&r.getTag()===t){if(i&&r.getOriginalTarget()!==i)continue;this._removeActionAtIndex(n,e)}}},e.removeActionByTag=function(t,e){var i=this;t===uTt.TAG_INVALID&&Y(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===uTt.TAG_INVALID&&Y(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===uTt.TAG_INVALID&&Y(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}Y(1005,t)}return null},e.getNumberOfRunningActionsInTarget=function(t){var e=this._hashTargets.get(t);return e&&e.actions?e.actions.length:0},e.pauseTarget=function(t){var e=this._hashTargets.get(t);e&&(e.paused=!0)},e.resumeTarget=function(t){var e=this._hashTargets.get(t);e&&(e.paused=!1)},e.pauseAllRunningActions=function(){for(var t=[],e=this._arrayTargets,i=0;i<e.length;i++){var n=e[i];n&&!n.paused&&(n.paused=!0,t.push(n.target))}return t},e.resumeTargets=function(t){if(t)for(var e=0;e<t.length;e++)t[e]&&this.resumeTarget(t[e])},e.pauseTargets=function(t){if(t)for(var e=0;e<t.length;e++)t[e]&&this.pauseTarget(t[e])},e.purgeSharedManager=function(){v.director.getScheduler().unscheduleUpdate(this)},e._removeActionAtIndex=function(t,e){e.actions[t],e.actions.splice(t,1),e.actionIndex>=t&&e.actionIndex--,0===e.actions.length&&this._deleteHashElement(e)},e._deleteHashElement=function(t){var e=!1;if(t&&!t.lock&&this._hashTargets.get(t.target)){this._hashTargets.delete(t.target);for(var i=this._arrayTargets,n=0,r=i.length;n<r;n++)if(i[n]===t){i.splice(n,1);break}this._putElement(t),e=!0}return e},e.update=function(t){for(var e,i=this._arrayTargets,n=0;n<i.length;n++){this._currentTarget=i[n];var r=(e=this._currentTarget).target;if(!Xa(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*(this._isActionInternal(e.currentAction)?e.currentAction.getSpeed():1)),e.currentAction&&e.currentAction.isDone()){e.currentAction.stop();var s=e.currentAction;e.currentAction=null,this.removeAction(s)}e.currentAction=null}e.lock=!1}0===e.actions.length&&this._deleteHashElement(e)&&n--}else this.removeAllActionsFromTarget(r),n--}},e._isActionInternal=function(t){return void 0!==t._speedMethod},t}(),fTt=t("fE",function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).actionMgr=new dTt,e}return s(e,t),e.prototype.update=function(t){this.actionMgr.update(t)},n(e,[{key:"ActionManager",get:function(){return this.actionMgr}}]),e}(Lu));fTt.ID="TWEEN",fTt.instance=void 0,gL.on(mL.EVENT_INIT,(function(){var t=new fTt;fTt.instance=t,gL.registerSystem(fTt.ID,t,Lu.Priority.MEDIUM)}));var pTt=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.clone=function(){return new e},e}(lTt),mTt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.update=function(){for(var t=this.target.getComponentsInChildren(RU),e=0;e<t.length;++e)t[e].enabled=!0},i.reverse=function(){return new gTt},i.clone=function(){return new e},e}(pTt),gTt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.update=function(){for(var t=this.target.getComponentsInChildren(RU),e=0;e<t.length;++e)t[e].enabled=!1},i.reverse=function(){return new mTt},i.clone=function(){return new e},e}(pTt);!function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;i.update=function(){for(var t=this.target.getComponentsInChildren(RU),e=0;e<t.length;++e){var i=t[e];i.enabled=!i.enabled}},i.reverse=function(){return new e},i.clone=function(){return new e}}(pTt);var vTt=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(){this.target.removeFromParent(),this._isNeedCleanUp&&this.target.destroy()},i.init=function(t){return this._isNeedCleanUp=t,!0},i.reverse=function(){return new e(this._isNeedCleanUp)},i.clone=function(){return new e(this._isNeedCleanUp)},e}(pTt);function yTt(t){return new vTt(t)}var TTt,STt,ETt=function(t){function e(e,i,n){var r;return(r=t.call(this)||this)._selectorTarget=null,r._function=null,r._data=null,r.initWithFunction(e,i,n),r}s(e,t);var i=e.prototype;return i.initWithFunction=function(t,e,i){return t&&(this._function=t),e&&(this._selectorTarget=e),void 0!==i&&(this._data=i),!0},i.execute=function(){this._function&&this._function.call(this._selectorTarget,this.target,this._data)},i.update=function(){this.execute()},i.getTargetCallback=function(){return this._selectorTarget},i.setTargetCallback=function(t){t!==this._selectorTarget&&(this._selectorTarget&&(this._selectorTarget=null),this._selectorTarget=t)},i.clone=function(){var t=new e;return t.initWithFunction(this._function,this._selectorTarget,this._data),t},e}(pTt),ATt=function(t){function e(e){var i;return(i=t.call(this)||this).MAX_VALUE=2,i._elapsed=0,i._firstTick=!1,i._easeList=[],i._speed=1,i._repeatForever=!1,i._repeatMethod=!1,i._speedMethod=!1,void 0===e||Number.isNaN(e)||i.initWithDuration(e),i}s(e,t);var i=e.prototype;return i.getElapsed=function(){return this._elapsed},i.initWithDuration=function(t){return this._duration=0===t?Ce.FLT_EPSILON:t,this._elapsed=0,this._firstTick=!0,!0},i.isDone=function(){return this._elapsed>=this._duration},i._cloneDecoration=function(t){t._repeatForever=this._repeatForever,t._speed=this._speed,t._timesForRepeat=this._timesForRepeat,t._easeList=this._easeList,t._speedMethod=this._speedMethod,t._repeatMethod=this._repeatMethod},i._reverseEaseList=function(t){if(this._easeList){t._easeList=[];for(var e=0;e<this._easeList.length;e++)t._easeList.push(this._easeList[e])}},i.clone=function(){var t=new e(this._duration);return this._cloneDecoration(t),t},i.easing=function(t){this._easeList?this._easeList.length=0:this._easeList=[];for(var e=0;e<arguments.length;e++)this._easeList.push(arguments[e]);return this},i._computeEaseTime=function(t){return t},i.step=function(t){this._firstTick?(this._firstTick=!1,this._elapsed=0):this._elapsed+=t;var e=this._elapsed/(this._duration>1.192092896e-7?this._duration:1.192092896e-7);e=e<1?e:1,this.update(e>0?e:0),this._repeatMethod&&this._timesForRepeat>1&&this.isDone()&&(this._repeatForever||this._timesForRepeat--,this.startWithTarget(this.target),this.step(this._elapsed-this._duration))},i.startWithTarget=function(t){uTt.prototype.startWithTarget.call(this,t),this._elapsed=0,this._firstTick=!0},i.reverse=function(){return Y(1010),this},i.setAmplitudeRate=function(){Y(1011)},i.getAmplitudeRate=function(){return Y(1012),0},i.speed=function(t){return t<=0?(Y(1013),this):(this._speedMethod=!0,this._speed*=t,this)},i.getSpeed=function(){return this._speed},i.setSpeed=function(t){return this._speed=t,this},i.repeat=function(t){return t=Math.round(t),Number.isNaN(t)||t<1?(Y(1014),this):(this._repeatMethod=!0,this._timesForRepeat*=t,this)},i.repeatForever=function(){return this._repeatMethod=!0,this._timesForRepeat=this.MAX_VALUE,this._repeatForever=!0,this},e}(lTt),RTt=function(t){function e(i){var n;(n=t.call(this)||this)._actions=[],n._split=0,n._last=0,n._reversed=!1;var r=i instanceof Array?i:arguments;if(1===r.length)return Z(1019),c(n);var s=r.length-1;if(s>=0&&null==r[s]&&Y(1015),s>=0){for(var a,o=r[0],h=1;h<s;h++)r[h]&&(a=o,o=e._actionOneTwo(a,r[h]));n.initWithTwoActions(o,r[s])}return n}s(e,t);var i=e.prototype;return i.initWithTwoActions=function(t,e){if(!t||!e)return Z(1025),!1;var i=t._duration,n=e._duration,r=(i*=t._repeatMethod?t._timesForRepeat:1)+(n*=e._repeatMethod?e._timesForRepeat:1);return this.initWithDuration(r),this._actions[0]=t,this._actions[1]=e,!0},i.clone=function(){var t=new e;return this._cloneDecoration(t),t.initWithTwoActions(this._actions[0].clone(),this._actions[1].clone()),t},i.startWithTarget=function(t){ATt.prototype.startWithTarget.call(this,t),this._split=this._actions[0]._duration/this._duration,this._split*=this._actions[0]._repeatMethod?this._actions[0]._timesForRepeat:1,this._last=-1},i.stop=function(){-1!==this._last&&this._actions[this._last].stop(),uTt.prototype.stop.call(this)},i.update=function(t){var e,i,n=0,r=this._split,s=this._actions,a=this._last;(t=this._computeEaseTime(t))<r?(e=0!==r?t/r:1,0===n&&1===a&&this._reversed&&(s[1].update(0),s[1].stop())):(n=1,e=1===r?1:(t-r)/(1-r),-1===a&&(s[0].startWithTarget(this.target),s[0].update(1),s[0].stop()),0===a&&(s[0].update(1),s[0].stop())),i=s[n],a===n&&i.isDone()||(a!==n&&i.startWithTarget(this.target),e*=i._timesForRepeat,i.update(e>1?e%1:e),this._last=n)},i.reverse=function(){var t=e._actionOneTwo(this._actions[1].reverse(),this._actions[0].reverse());return this._cloneDecoration(t),this._reverseEaseList(t),t._reversed=!0,t},e}(ATt);function bTt(t){var e=t instanceof Array?t:arguments;if(1===e.length)return e[0];var i=e.length-1;i>=0&&null==e[i]&&Y(1015);var n=null;if(i>=0){n=e[0];for(var r=1;r<=i;r++)e[r]&&(n=RTt._actionOneTwo(n,e[r]))}return n}TTt=RTt,RTt._actionOneTwo=function(t,e){var i=new TTt;return i.initWithTwoActions(t,e),i};var CTt=function(t){function e(e,i){var n;return(n=t.call(this)||this)._times=0,n._total=0,n._nextDt=0,n._actionInstant=!1,n._innerAction=null,void 0!==i&&n.initWithAction(e,i),n}s(e,t);var i=e.prototype;return i.initWithAction=function(t,e){var i=t._duration*e;return!!this.initWithDuration(i)&&(this._times=e,this._innerAction=t,t instanceof pTt&&(this._actionInstant=!0,this._times-=1),this._total=0,!0)},i.clone=function(){var t=new e;return this._cloneDecoration(t),t.initWithAction(this._innerAction.clone(),this._times),t},i.startWithTarget=function(t){this._total=0,this._nextDt=this._innerAction._duration/this._duration,ATt.prototype.startWithTarget.call(this,t),this._innerAction.startWithTarget(t)},i.stop=function(){this._innerAction.stop(),uTt.prototype.stop.call(this)},i.update=function(t){t=this._computeEaseTime(t);var e=this._innerAction,i=this._duration,n=this._times,r=this._nextDt;if(t>=r){for(;t>r&&this._total<n;)e.update(1),this._total++,e.stop(),e.startWithTarget(this.target),r+=e._duration/i,this._nextDt=r>1?1:r;t>=1&&this._total<n&&(e.update(1),this._total++),this._actionInstant||(this._total===n?e.stop():e.update(t-(r-e._duration/i)))}else e.update(t*n%1)},i.isDone=function(){return this._total===this._times},i.reverse=function(){var t=new e(this._innerAction.reverse(),this._times);return this._cloneDecoration(t),this._reverseEaseList(t),t},i.setInnerAction=function(t){this._innerAction!==t&&(this._innerAction=t)},i.getInnerAction=function(){return this._innerAction},e}(ATt),wTt=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,!0):(Z(1026),!1)},i.clone=function(){var t=new e;return this._cloneDecoration(t),t.initWithAction(this._innerAction.clone()),t},i.startWithTarget=function(t){ATt.prototype.startWithTarget.call(this,t),this._innerAction.startWithTarget(t)},i.step=function(t){var e=this._innerAction;e.step(t),e.isDone()&&(e.startWithTarget(this.target),e.step(e.getElapsed()-e._duration))},i.isDone=function(){return!1},i.reverse=function(){var t=new e(this._innerAction.reverse());return this._cloneDecoration(t),this._reverseEaseList(t),t},i.setInnerAction=function(t){this._innerAction!==t&&(this._innerAction=t)},i.getInnerAction=function(){return this._innerAction},e}(ATt),xTt=function(t){function e(i){var n;(n=t.call(this)||this)._one=null,n._two=null;var r=i instanceof Array?i:arguments;if(1===r.length)return Z(1020),c(n);var s=r.length-1;if(s>=0&&null==r[s]&&Y(1015),s>=0){for(var a,o=r[0],h=1;h<s;h++)r[h]&&(a=o,o=e._actionOneTwo(a,r[h]));n.initWithTwoActions(o,r[s])}return n}s(e,t);var i=e.prototype;return i.initWithTwoActions=function(t,e){if(!t||!e)return Z(1027),!1;var i=!1,n=t._duration,r=e._duration;return this.initWithDuration(Math.max(n,r))&&(this._one=t,this._two=e,n>r?this._two=RTt._actionOneTwo(e,DTt(n-r)):n<r&&(this._one=RTt._actionOneTwo(t,DTt(r-n))),i=!0),i},i.clone=function(){var t=new e;return this._cloneDecoration(t),t.initWithTwoActions(this._one.clone(),this._two.clone()),t},i.startWithTarget=function(t){ATt.prototype.startWithTarget.call(this,t),this._one.startWithTarget(t),this._two.startWithTarget(t)},i.stop=function(){this._one.stop(),this._two.stop(),uTt.prototype.stop.call(this)},i.update=function(t){t=this._computeEaseTime(t),this._one&&this._one.update(t),this._two&&this._two.update(t)},i.reverse=function(){var t=e._actionOneTwo(this._one.reverse(),this._two.reverse());return this._cloneDecoration(t),this._reverseEaseList(t),t},e}(ATt);function ITt(t){var e=t instanceof Array?t:arguments;if(1===e.length)return Z(1020),null;e.length>0&&null==e[e.length-1]&&Y(1015);for(var i=e[0],n=1;n<e.length;n++)null!=e[n]&&(i=xTt._actionOneTwo(i,e[n]));return i}STt=xTt,xTt._actionOneTwo=function(t,e){var i=new STt;return i.initWithTwoActions(t,e),i};var OTt=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),this._reverseEaseList(t),t},i.clone=function(){var t=new e;return this._cloneDecoration(t),t.initWithDuration(this._duration),t},e}(ATt);function DTt(t){return new OTt(t)}var MTt,PTt,BTt,NTt,LTt,FTt,kTt,UTt,GTt,HTt,zTt,VTt,WTt,XTt,jTt,YTt,KTt,qTt,QTt,ZTt,JTt,$Tt,tSt,eSt,iSt,nSt,rSt,sSt,aSt,oSt,hSt,uSt=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(t){return t?t===this._other?(Z(1029),!1):!!ATt.prototype.initWithDuration.call(this,t._duration)&&(this._other=t,!0):(Z(1028),!1)},i.clone=function(){var t=new e;return this._cloneDecoration(t),t.initWithAction(this._other.clone()),t},i.startWithTarget=function(t){ATt.prototype.startWithTarget.call(this,t),this._other.startWithTarget(t)},i.update=function(t){t=this._computeEaseTime(t),this._other&&this._other.update(1-t)},i.reverse=function(){return this._other.clone()},i.stop=function(){this._other.stop(),uTt.prototype.stop.call(this)},e}(ATt),lSt=t("fI",function(t){function e(e,i,n){var r;if((r=t.call(this)||this)._opts=void 0,r._props=void 0,r._originProps=void 0,null==n)n=Object.create(null);else if(function(t){var e=" [Tween:] ",i=" option is not support in v + "+y,n=t;n.delay&&U(e+"delay"+i),n.repeat&&U(e+"repeat"+i),n.repeatDelay&&U(e+"repeatDelay"+i),n.interpolation&&U(e+"interpolation"+i),n.onStop&&U(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=Yo[s],n.easing||q(1031,s)}for(var a in r._opts=n,r._props=Object.create(null),i)if(i.hasOwnProperty(a)){var o=i[a];if("function"==typeof o&&(o=o()),null!=o&&"string"!=typeof o){var h=void 0,u=void 0;void 0!==o.value&&(o.easing||o.progress)&&("string"==typeof o.easing?(h=Yo[o.easing])||q(1031,o.easing):h=o.easing,u=o.progress,o=o.value);var l=Object.create(null);l.value=o,l.easing=h,l.progress=u,r._props[a]=l}}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 this._cloneDecoration(t),t},i.startWithTarget=function(t){ATt.prototype.startWithTarget.call(this,t);var e=!!this._opts.relative,i=this._props;for(var n in i){var r=t[n];if(void 0!==r){var s=i[n],a=s.value;if("number"==typeof r)s.start=r,s.current=r,s.end=e?r+a:a;else if("object"==typeof r)for(var o in null==s.start&&(s.start={},s.current={},s.end={}),a)isNaN(r[o])||(s.start[o]=r[o],s.current[o]=r[o],s.end[o]=e?r[o]+a[o]:a[o])}}this._opts.onStart&&this._opts.onStart(this.target)},i.update=function(t){var e=this.target;if(e){var i=this._props,n=this._opts,r=t;n.easing&&(r=n.easing(t));var s=n.progress;for(var a in i){var o=i[a],h=o.easing?o.easing(t):r,u=o.progress?o.progress:s,l=o.start,c=o.end;if("number"==typeof l)o.current=u(l,c,o.current,h);else if("object"==typeof l)for(var _ in l)o.current[_]=u(l[_],c[_],o.current[_],h);e[a]=o.current}n.onUpdate&&n.onUpdate(this.target,t),1===t&&n.onComplete&&n.onComplete(this.target)}},i.progress=function(t,e,i,n){return t+(e-t)*n},e}(ATt)),cSt=function(t){function e(e){var i;return(i=t.call(this)||this)._props=void 0,i._props={},void 0!==e&&i.init(e),i}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.init(this._props),t},e}(pTt),_St=t("fH",function(){function t(t){this._actions=[],this._finalAction=null,this._target=null,this._tag=uTt.TAG_INVALID,this._target=void 0===t?null:t}var e=t.prototype;return e.tag=function(t){return this._tag=t,this},e.then=function(t){return t instanceof uTt?this._actions.push(t.clone()):this._actions.push(t._union()),this},e.target=function(t){return this._target=t,this},e.start=function(){return this._target?(this._finalAction&&fTt.instance.ActionManager.removeAction(this._finalAction),this._finalAction=this._union(),this._finalAction.setTag(this._tag),fTt.instance.ActionManager.addAction(this._finalAction,this._target,!1),this):(U("Please set target to tween first"),this)},e.stop=function(){return this._finalAction&&fTt.instance.ActionManager.removeAction(this._finalAction),this},e.clone=function(t){var e=this._union();return dSt(t).then(e.clone())},e.union=function(){var t=this._union();return this._actions.length=0,this._actions.push(t),this},e.to=function(t,e,i){(i=i||Object.create(null)).relative=!1;var n=new lSt(t,e,i);return this._actions.push(n),this},e.by=function(t,e,i){(i=i||Object.create(null)).relative=!0;var n=new lSt(t,e,i);return this._actions.push(n),this},e.set=function(t){var e=new cSt(t);return this._actions.push(e),this},e.delay=function(t){var e=DTt(t);return this._actions.push(e),this},e.call=function(t){var e=function(t){return new ETt(t,void 0,void 0)}(t);return this._actions.push(e),this},e.sequence=function(){var e=t._wrappedSequence.apply(t,arguments);return this._actions.push(e),this},e.parallel=function(){var e=t._wrappedParallel.apply(t,arguments);return this._actions.push(e),this},e.repeat=function(e,i){if(e===1/0)return this.repeatForever(i);var n,r=this._actions;return n=i instanceof t?i._union():r.pop(),r.push(function(t,e){return new CTt(t,e)}(n,e)),this},e.repeatForever=function(e){var i,n=this._actions;return i=e instanceof t?e._union():n.pop(),n.push(function(t){return new wTt(t)}(i)),this},e.reverseTime=function(e){var i,n=this._actions;return i=e instanceof t?e._union():n.pop(),n.push(function(t){return new uSt(t)}(i)),this},e.hide=function(){var t=new gTt;return this._actions.push(t),this},e.show=function(){var t=new mTt;return this._actions.push(t),this},e.removeSelf=function(){var t=yTt(!1);return this._actions.push(t),this},e.destroySelf=function(){var t=yTt(!0);return this._actions.push(t),this},t.stopAll=function(){fTt.instance.ActionManager.removeAllActions()},t.stopAllByTag=function(t,e){fTt.instance.ActionManager.removeAllActionsByTag(t,e)},t.stopAllByTarget=function(t){fTt.instance.ActionManager.removeAllActionsFromTarget(t)},e._union=function(){var t=this._actions;return 1===t.length?t[0]:bTt(t)},e._destroy=function(){this.stop()},t._wrappedSequence=function(){var e=t._tmp_args;e.length=0;for(var i=arguments.length,n=0;n<i;n++){var r=e[n]=n<0||arguments.length<=n?void 0:arguments[n];r instanceof t&&(e[n]=r._union())}return bTt.apply(bTt,e)},t._wrappedParallel=function(){var e=t._tmp_args;e.length=0;for(var i=arguments.length,n=0;n<i;n++){var r=e[n]=n<0||arguments.length<=n?void 0:arguments[n];r instanceof t&&(e[n]=r._union())}return ITt.apply(ITt,e)},t}());function dSt(t){return new _St(t)}function fSt(t){return U("tweenUtil' is deprecated, please use 'tween' instead "),new _St(t)}_St._tmp_args=[],v.Tween=_St,v.tween=dSt,v.tweenUtil=fSt,function(t){t[t.Other=0]="Other",t[t.Left=1]="Left",t[t.Right=2]="Right"}(MTt||(MTt={})),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"}(PTt||(PTt={})),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"}(BTt||(BTt={})),s((function(){for(var t,e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return(t=hSt.call.apply(hSt,[this].concat(i))||this).deviceType=MTt.Other,t.hitPoint=new hn,t}),hSt=wC);var pSt,mSt,gSt,vSt=new pn;!function(t){t[t.NONE=0]="NONE",t[t.COLOR=1]="COLOR",t[t.SPRITE=2]="SPRITE",t[t.SCALE=3]="SCALE"}(pSt||(pSt={})),Se(pSt),function(t){t.NORMAL="normal",t.HOVER="hover",t.PRESSED="pressed",t.DISABLED="disabled"}(mSt||(mSt={})),function(t){t.CLICK="click"}(gSt||(gSt={}));var ySt=t("fJ",(NTt=qs("cc.Button"),LTt=Zs(110),FTt=Qs(oU),kTt=xa($m),UTt=xa(pSt),GTt=xa(yF),HTt=xa(yF),zTt=xa(yF),VTt=xa(yF),WTt=xa([rp]),NTt(XTt=LTt(XTt=FTt(((oSt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).clickEvents=YTt&&YTt(),e._interactable=KTt&&KTt(),e._transition=qTt&&qTt(),e._normalColor=QTt&&QTt(),e._hoverColor=ZTt&&ZTt(),e._pressedColor=JTt&&JTt(),e._disabledColor=$Tt&&$Tt(),e._normalSprite=tSt&&tSt(),e._hoverSprite=eSt&&eSt(),e._pressedSprite=iSt&&iSt(),e._disabledSprite=nSt&&nSt(),e._duration=rSt&&rSt(),e._zoomScale=sSt&&sSt(),e._target=aSt&&aSt(),e._pressed=!1,e._hovered=!1,e._fromColor=new pn,e._toColor=new pn,e._time=0,e._transitionFinished=!0,e._fromScale=new hn,e._toScale=new hn,e._originalScale=null,e._sprite=null,e._targetScale=new hn,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===pSt.COLOR||this._transition===pSt.SCALE)){this._time+=t;var i=1;if(this._duration>0&&(i=this._time/this._duration),i>=1&&(i=1),this._transition===pSt.COLOR){var n=e._uiProps.uiComp;pn.lerp(vSt,this._fromColor,this._toColor,i),n&&(n.color=vSt)}else this.transition===pSt.SCALE&&(e.getScale(this._targetScale),this._targetScale.x=Di(this._fromScale.x,this._toScale.x,i),this._targetScale.y=Di(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===pSt.COLOR&&this._interactable){var i=t.getComponent(bU);i&&(i.color=this._normalColor)}else e===pSt.SCALE&&this._originalScale&&t.setScale(this._originalScale);this._transitionFinished=!0}},i._registerNodeEvent=function(){this.node.on(um.TOUCH_START,this._onTouchBegan,this),this.node.on(um.TOUCH_MOVE,this._onTouchMove,this),this.node.on(um.TOUCH_END,this._onTouchEnded,this),this.node.on(um.TOUCH_CANCEL,this._onTouchCancel,this),this.node.on(um.MOUSE_ENTER,this._onMouseMoveIn,this),this.node.on(um.MOUSE_LEAVE,this._onMouseMoveOut,this),this.node.on(PTt.XRUI_HOVER_ENTERED,this._xrHoverEnter,this),this.node.on(PTt.XRUI_HOVER_EXITED,this._xrHoverExit,this),this.node.on(PTt.XRUI_CLICK,this._xrClick,this),this.node.on(PTt.XRUI_UNCLICK,this._xrUnClick,this)},i._registerTargetEvent=function(t){t.on(um.TRANSFORM_CHANGED,this._onTargetTransformChanged,this)},i._unregisterNodeEvent=function(){this.node.off(um.TOUCH_START,this._onTouchBegan,this),this.node.off(um.TOUCH_MOVE,this._onTouchMove,this),this.node.off(um.TOUCH_END,this._onTouchEnded,this),this.node.off(um.TOUCH_CANCEL,this._onTouchCancel,this),this.node.off(um.MOUSE_ENTER,this._onMouseMoveIn,this),this.node.off(um.MOUSE_LEAVE,this._onMouseMoveOut,this),this.node.off(PTt.XRUI_HOVER_ENTERED,this._xrHoverEnter,this),this.node.off(PTt.XRUI_HOVER_EXITED,this._xrHoverExit,this),this.node.off(PTt.XRUI_CLICK,this._xrClick,this),this.node.off(PTt.XRUI_UNCLICK,this._xrUnClick,this)},i._unregisterTargetEvent=function(t){t.off(um.TRANSFORM_CHANGED)},i._getTargetSprite=function(t){var e=null;return t&&(e=t.getComponent(dz)),e},i._applyTarget=function(){this.target&&(this._sprite=this._getTargetSprite(this.target),this._originalScale||(this._originalScale=new hn),hn.copy(this._originalScale,this.target.getScale()),this._registerTargetEvent(this.target))},i._onTargetSpriteFrameChanged=function(t){this._transition===pSt.SPRITE&&this._setCurrentStateSpriteFrame(t.spriteFrame)},i._setCurrentStateSpriteFrame=function(t){if(t)switch(this._getButtonState()){case mSt.NORMAL:this._normalSprite=t;break;case mSt.HOVER:this._hoverSprite=t;break;case mSt.PRESSED:this._pressedSprite=t;break;case mSt.DISABLED:this._disabledSprite=t}},i._onTargetColorChanged=function(t){this._transition===pSt.COLOR&&this._setCurrentStateColor(t)},i._setCurrentStateColor=function(t){switch(this._getButtonState()){case mSt.NORMAL:this._normalColor=t;break;case mSt.HOVER:this._hoverColor=t;break;case mSt.PRESSED:this._pressedColor=t;break;case mSt.DISABLED:this._disabledColor=t}},i._onTargetTransformChanged=function(t){t&om.SCALE&&this._originalScale&&this._transition===pSt.SCALE&&this._transitionFinished&&hn.copy(this._originalScale,this.target.getScale())},i._onTouchBegan=function(t){this._interactable&&this.enabledInHierarchy&&(this._pressed=!0,this._updateState(),t&&(t.propagationStopped=!0))},i._onTouchMove=function(t){if(this._interactable&&this.enabledInHierarchy&&this._pressed&&t){var e=t.touch;if(e){var i,n=this.node._uiProps.uiTransformComp.hitTest(e.getLocation(),t.windowId);this._transition===pSt.SCALE&&this.target&&this._originalScale?n?(hn.copy(this._fromScale,this._originalScale),hn.multiplyScalar(this._toScale,this._originalScale,this._zoomScale),this._transitionFinished=!1):(this._time=0,this._transitionFinished=!0,this.target.setScale(this._originalScale)):(i=n?mSt.PRESSED:mSt.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(gSt.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!==pSt.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=mSt.NORMAL;return this._interactable?this._pressed?t=mSt.PRESSED:this._hovered&&(t=mSt.HOVER):t=mSt.DISABLED,t.toString()},i._updateColorTransition=function(t){var e,i=this[t+"Color"],n=null===(e=this.target)||void 0===e?void 0:e.getComponent(bU);n&&(t===mSt.DISABLED.toString()?n.color=i:(this._fromColor=n.color.clone(),this._toColor=i,this._time=0,this._transitionFinished=!1))},i._updateSpriteTransition=function(t){var e=this[t+"Sprite"];this._sprite&&e&&(this._sprite.spriteFrame=e)},i._updateScaleTransition=function(t){this._interactable&&(t===mSt.PRESSED.toString()?this._zoomUp():this._zoomBack())},i._zoomUp=function(){this._originalScale&&(hn.copy(this._fromScale,this._originalScale),hn.multiplyScalar(this._toScale,this._originalScale,this._zoomScale),this._time=0,this._transitionFinished=!1)},i._zoomBack=function(){this.target&&this._originalScale&&(hn.copy(this._fromScale,this.target.getScale()),hn.copy(this._toScale,this._originalScale),this._time=0,this._transitionFinished=!1)},i._applyTransition=function(t){var e=this._transition;e===pSt.COLOR?this._updateColorTransition(t):e===pSt.SPRITE?this._updateSpriteTransition(t):e===pSt.SCALE&&this._updateScaleTransition(t)},i._xrHoverEnter=function(){this._onMouseMoveIn(),this._updateState()},i._xrHoverExit=function(){this._onMouseMoveOut(),this._pressed&&(this._pressed=!1,this._updateState())},i._xrClick=function(){this._interactable&&this.enabledInHierarchy&&(this._pressed=!0,this._updateState())},i._xrUnClick=function(){this._interactable&&this.enabledInHierarchy&&(this._pressed&&(rp.emitEvents(this.clickEvents,this),this.node.emit(gSt.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===pSt.COLOR?this._updateColorTransition(mSt.NORMAL):this._transition===pSt.SPRITE&&this._updateSpriteTransition(mSt.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(dz);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}(op)).Transition=pSt,oSt.EventType=gSt,f((jTt=oSt).prototype,"target",[kTt],Object.getOwnPropertyDescriptor(jTt.prototype,"target"),jTt.prototype),f(jTt.prototype,"transition",[UTt],Object.getOwnPropertyDescriptor(jTt.prototype,"transition"),jTt.prototype),f(jTt.prototype,"normalSprite",[GTt],Object.getOwnPropertyDescriptor(jTt.prototype,"normalSprite"),jTt.prototype),f(jTt.prototype,"pressedSprite",[HTt],Object.getOwnPropertyDescriptor(jTt.prototype,"pressedSprite"),jTt.prototype),f(jTt.prototype,"hoverSprite",[zTt],Object.getOwnPropertyDescriptor(jTt.prototype,"hoverSprite"),jTt.prototype),f(jTt.prototype,"disabledSprite",[VTt],Object.getOwnPropertyDescriptor(jTt.prototype,"disabledSprite"),jTt.prototype),YTt=Gs(jTt.prototype,"clickEvents",[WTt,ra],(function(){return[]})),KTt=Gs(jTt.prototype,"_interactable",[ra],(function(){return!0})),qTt=Gs(jTt.prototype,"_transition",[ra],(function(){return pSt.NONE})),QTt=Gs(jTt.prototype,"_normalColor",[ra],(function(){return pn.WHITE.clone()})),ZTt=Gs(jTt.prototype,"_hoverColor",[ra],(function(){return new pn(211,211,211,255)})),JTt=Gs(jTt.prototype,"_pressedColor",[ra],(function(){return pn.WHITE.clone()})),$Tt=Gs(jTt.prototype,"_disabledColor",[ra],(function(){return new pn(124,124,124,255)})),tSt=Gs(jTt.prototype,"_normalSprite",[ra],(function(){return null})),eSt=Gs(jTt.prototype,"_hoverSprite",[ra],(function(){return null})),iSt=Gs(jTt.prototype,"_pressedSprite",[ra],(function(){return null})),nSt=Gs(jTt.prototype,"_disabledSprite",[ra],(function(){return null})),rSt=Gs(jTt.prototype,"_duration",[ra],(function(){return.1})),sSt=Gs(jTt.prototype,"_zoomScale",[ra],(function(){return 1.2})),aSt=Gs(jTt.prototype,"_target",[ra],(function(){return null})),XTt=jTt))||XTt)||XTt)||XTt));v.Button=ySt;var TSt,SSt,ESt,ASt=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}();ASt._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"}(TSt||(TSt={})),ve(TSt),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"}(SSt||(SSt={})),ve(SSt),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"}(ESt||(ESt={})),ve(ESt);var RSt,bSt,CSt,wSt,xSt,ISt,OSt,DSt,MSt,PSt,BSt,NSt,LSt,FSt,kSt,USt,GSt,HSt,zSt,VSt,WSt,XSt,jSt,YSt,KSt,qSt,QSt,ZSt,JSt,$St,tEt=function(){function t(){this._editing=!1,this._delegate=null}var e=t.prototype;return e.init=function(){},e.onEnable=function(){},e.update=function(){},e.onDisable=function(){this._editing&&this.endEditing()},e.clear=function(){this._delegate=null},e.setTabIndex=function(){},e.setSize=function(){},e.setFocus=function(t){t?this.beginEditing():this.endEditing()},e.isFocused=function(){return this._editing},e.beginEditing=function(){},e.endEditing=function(){},t}(),eEt=T.document,iEt=new Dn,nEt=new Dn,rEt=new hn,sEt=null,aEt=0,oEt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._delegate=null,e._inputMode=-1,e._inputFlag=-1,e._returnType=-1,e.__eventListeners={},e.__autoResize=!1,e.__orientationChanged=void 0,e._edTxt=null,e._isTextArea=!1,e._textLabelFont=null,e._textLabelFontSize=null,e._textLabelFontColor=null,e._textLabelAlign=null,e._placeholderLabelFont=null,e._placeholderLabelFontSize=null,e._placeholderLabelFontColor=null,e._placeholderLabelAlign=null,e._placeholderLineHeight=null,e._placeholderStyleSheet=null,e._domId="EditBoxId_"+ ++aEt,e}s(e,t);var i=e.prototype;return i.init=function(t){t&&(this._delegate=t,t.inputMode===SSt.ANY?this._createTextArea():this._createInput(),ASt.add(this),this.setTabIndex(t.tabIndex),this._initStyleSheet(),this._registerEventListeners(),this._addDomToGameContainer(),RV.instance.on("canvas-resize",this._resize,this))},i.clear=function(){this._removeEventListeners(),this._removeDomFromGameContainer(),ASt.remove(this),sEt===this&&(sEt=null),this._delegate=null},i._resize=function(){this._delegate.node.hasChangedFlags=1},i.update=function(){this._delegate.node.hasChangedFlags&&this._updateMatrix()},i.setTabIndex=function(t){this._edTxt.tabIndex=t,ASt.resort()},i.setSize=function(t,e){var i=this._edTxt;i&&(i.style.width=t+"px",i.style.height=e+"px")},i.beginEditing=function(){sEt&&sEt!==this&&sEt.setFocus(!1),this._editing=!0,sEt=this,this._delegate._editBoxEditingDidBegan(),this._showDom(),this._edTxt.focus()},i.endEditing=function(){this._edTxt.blur()},i._createInput=function(){this._isTextArea=!1,this._edTxt=eEt.createElement("input")},i._createTextArea=function(){this._isTextArea=!0,this._edTxt=eEt.createElement("textarea")},i._addDomToGameContainer=function(){AL.container&&this._edTxt&&(AL.container.appendChild(this._edTxt),eEt.head.appendChild(this._placeholderStyleSheet))},i._removeDomFromGameContainer=function(){Be(AL.container,this._edTxt)&&this._edTxt&&AL.container.removeChild(this._edTxt),Be(eEt.head,this._placeholderStyleSheet)&&eEt.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()),Ol.isMobile&&this._showDomOnMobile()},i._hideDom=function(){var t=this._edTxt;t&&this._delegate&&(t.style.display="none",this._delegate._showLabels()),Ol.isMobile&&this._hideDomOnMobile()},i._showDomOnMobile=function(){Ol.os!==il.ANDROID&&Ol.os!==il.OHOS||(wl.handleResizeEvent=!1,this._adjustWindowScroll())},i._hideDomOnMobile=function(){Ol.os!==il.ANDROID&&Ol.os!==il.OHOS||(wl.handleResizeEvent=!0),this._scrollBackWindow()},i._isElementInViewport=function(){if(this._edTxt){var t=this._edTxt.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=(T.innerHeight||eEt.documentElement.clientHeight)&&t.right<=(T.innerWidth||eEt.documentElement.clientWidth)}return!1},i._adjustWindowScroll=function(){var t=this;setTimeout((function(){T.scrollY<40&&!t._isElementInViewport()&&t._edTxt.scrollIntoView({block:"start",inline:"nearest",behavior:"smooth"})}),400)},i._scrollBackWindow=function(){setTimeout((function(){Ol.browserType!==$u.WECHAT||Ol.os!==il.IOS?T.scrollTo(0,0):T.top&&T.top.scrollTo(0,0)}),400)},i._updateMatrix=function(){if(this._edTxt){var t=this._delegate.node,e=IV.getScaleX(),i=IV.getScaleY(),n=IV.getViewportRect(),r=wl.devicePixelRatio;t.getWorldMatrix(iEt);var s=t._uiProps.uiTransformComp;if(s&&(hn.set(rEt,-s.anchorX*s.width,-s.anchorY*s.height,rEt.z),Dn.transform(iEt,iEt,rEt)),t._uiProps.uiTransformComp){var a=gL.root.batcher2D.getFirstRenderCamera(t);if(a){a.node.getWorldRT(nEt);var o=nEt.m12,h=nEt.m13,u=Dl.center;nEt.m12=u.x-(nEt.m00*o+nEt.m04*h),nEt.m13=u.y-(nEt.m01*o+nEt.m05*h),e/=r,i/=r,hn.set(rEt,e,i,1),Dn.scale(nEt,nEt,rEt);var l=AL.container,c=parseInt(l&&l.style.paddingLeft||"0");c+=n.x/r;var _=parseInt(l&&l.style.paddingBottom||"0");_+=n.y/r,nEt.m12+=c,nEt.m13+=_,Dn.multiply(nEt,nEt,iEt);var d="matrix("+nEt.m00+","+-nEt.m01+","+-nEt.m04+","+nEt.m05+","+nEt.m12+","+-nEt.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===ESt.INITIAL_CAPS_ALL_CHARACTERS?s="uppercase":i===ESt.INITIAL_CAPS_WORD&&(s="capitalize"),void(r.style.textTransform=s)}if(r=r,i===ESt.PASSWORD)return r.type="password",void(r.style.textTransform="none");var a=r.type;e===SSt.EMAIL_ADDR?a="email":e===SSt.NUMERIC?a="number":e===SSt.DECIMAL?a="digit":e===SSt.PHONE_NUMBER?(a="tel",r.addEventListener("wheel",(function(){return!1}))):e===SSt.URL?a="url":(a="text",n===TSt.SEARCH&&(a="search")),r.type=a;var o="none";i===ESt.INITIAL_CAPS_ALL_CHARACTERS?o="uppercase":i===ESt.INITIAL_CAPS_WORD&&(o="capitalize"),r.style.textTransform=o}},i._updateMaxLength=function(){var t=this._delegate.maxLength;t<0&&(t=65535),this._edTxt.maxLength=t},i._initStyleSheet=function(){if(this._edTxt){var t=this._edTxt;t.style.color="#000000",t.style.border="0px",t.style.background="transparent",t.style.width="100%",t.style.height="100%",t.style.outline="medium",t.style.padding="0",t.style.textTransform="none",t.style.display="none",t.style.position="absolute",t.style.bottom="0px",t.style.left="2px",t.className="cocosEditBox",t.style.fontFamily="Arial",t.id=this._domId,this._isTextArea?(t.style.resize="none",t.style.overflowY="scroll"):((t=t).type="text",t.style["-moz-appearance"]="textfield"),this._placeholderStyleSheet=eEt.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 kF?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 fG.HorizontalAlign.LEFT:n.style.textAlign="left";break;case fG.HorizontalAlign.CENTER:n.style.textAlign="center";break;case fG.HorizontalAlign.RIGHT:n.style.textAlign="right"}}}},i._updatePlaceholderLabel=function(t){if(t){var e=t.font;e=!e||e instanceof kF?t.fontFamily:t.font._fontFamily;var i=t.fontSize*t.node.scale.y;if(this._placeholderLabelFont!==e||this._placeholderLabelFontSize!==i||this._placeholderLabelFontColor!==t.fontColor||this._placeholderLabelAlign!==t.horizontalAlign||this._placeholderLineHeight!==t.fontSize){this._placeholderLabelFont=e,this._placeholderLabelFontSize=i,this._placeholderLabelFontColor=t.fontColor,this._placeholderLabelAlign=t.horizontalAlign,this._placeholderLineHeight=t.fontSize;var n=this._placeholderStyleSheet,r=t.color.toCSS(),s=t.fontSize,a="";switch(t.horizontalAlign){case fG.HorizontalAlign.LEFT:a="left";break;case fG.HorizontalAlign.CENTER:a="center";break;case fG.HorizontalAlign.RIGHT:a="right"}n.innerHTML="#"+this._domId+"::-webkit-input-placeholder{text-transform: initial;-family: "+e+";font-size: "+i+"px;color: "+r+";line-height: "+s+"px;text-align: "+a+";}#"+this._domId+"::-moz-placeholder{text-transform: initial;-family: "+e+";font-size: "+i+"px;color: "+r+";line-height: "+s+"px;text-align: "+a+";}#"+this._domId+"::-ms-input-placeholder{text-transform: initial;-family: "+e+";font-size: "+i+"px;color: "+r+";line-height: "+s+"px;text-align: "+a+";}",Ol.browserType===$u.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&&Ol.isMobile&&t._adjustWindowScroll()},n.onKeydown=function(i){i.keyCode===PC.ENTER?(i.propagationStopped=!0,t._delegate._editBoxEditingReturn(),t._isTextArea||e.blur()):i.keyCode===PC.TAB&&(i.propagationStopped=!0,i.preventDefault(),ASt.next(t))},n.onBlur=function(){Ol.isMobile&&i&&n.compositionEnd(),t._editing=!1,sEt=null,t._hideDom(),t._delegate._editBoxEditingDidEnded()},e.addEventListener("compositionstart",n.compositionStart),e.addEventListener("compositionend",n.compositionEnd),e.addEventListener("input",n.onInput),e.addEventListener("keydown",n.onKeydown),e.addEventListener("blur",n.onBlur),e.addEventListener("touchstart",n.onClick)}},i._removeEventListeners=function(){if(this._edTxt){var t=this._edTxt,e=this.__eventListeners;t.removeEventListener("compositionstart",e.compositionStart),t.removeEventListener("compositionend",e.compositionEnd),t.removeEventListener("input",e.onInput),t.removeEventListener("keydown",e.onKeydown),t.removeEventListener("blur",e.onBlur),t.removeEventListener("touchstart",e.onClick),e.compositionStart=null,e.compositionEnd=null,e.onInput=null,e.onKeydown=null,e.onBlur=null,e.onClick=null}},e}(tEt);!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"}($St||($St={}));var hEt,uEt,lEt,cEt,_Et,dEt,fEt,pEt,mEt,gEt,vEt,yEt,TEt,SEt,EEt,AEt,REt,bEt,CEt,wEt,xEt,IEt,OEt,DEt,MEt,PEt,BEt,NEt,LEt,FEt,kEt,UEt,GEt,HEt,zEt=t("fK",(RSt=qs("cc.EditBox"),bSt=Zs(110),CSt=Qs(oU),wSt=xa(fG),xSt=xa(fG),ISt=xa(yF),OSt=xa(ESt),DSt=xa(SSt),MSt=xa(TSt),PSt=xa([rp]),BSt=xa([rp]),NSt=xa([rp]),LSt=xa([rp]),RSt(FSt=bSt(FSt=CSt(((JSt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).editingDidBegan=USt&&USt(),e.textChanged=GSt&&GSt(),e.editingDidEnded=HSt&&HSt(),e.editingReturn=zSt&&zSt(),e._impl=null,e._background=null,e._textLabel=VSt&&VSt(),e._placeholderLabel=WSt&&WSt(),e._returnType=XSt&&XSt(),e._string=jSt&&jSt(),e._tabIndex=YSt&&YSt(),e._backgroundImage=KSt&&KSt(),e._inputFlag=qSt&&qSt(),e._inputMode=QSt&&QSt(),e._maxLength=ZSt&&ZSt(),e._isLabelVisible=!1,e}s(e,t);var i=e.prototype;return i.__preload=function(){this._init()},i.onEnable=function(){this._registerEvent(),this._ensureBackgroundSprite(),this._impl&&this._impl.onEnable()},i.update=function(){this._impl&&this._impl.update()},i.onDisable=function(){this._unregisterEvent(),this._unregisterBackgroundEvent(),this._impl&&this._impl.onDisable()},i.onDestroy=function(){this._impl&&this._impl.clear()},i.setFocus=function(){this._impl&&this._impl.setFocus(!0)},i.focus=function(){this._impl&&this._impl.setFocus(!0)},i.blur=function(){this._impl&&this._impl.setFocus(!1)},i.isFocused=function(){return!!this._impl&&this._impl.isFocused()},i._editBoxEditingDidBegan=function(){rp.emitEvents(this.editingDidBegan,this),this.node.emit($St.EDITING_DID_BEGAN,this)},i._editBoxEditingDidEnded=function(t){rp.emitEvents(this.editingDidEnded,this),this.node.emit($St.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($St.TEXT_CHANGED,this)},i._editBoxEditingReturn=function(t){rp.emitEvents(this.editingReturn,this),this.node.emit($St.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(um.SIZE_CHANGED,this._resizeChildNodes,this),(this._impl=new e._EditBoxImpl).init(this),this._updateString(this._string),this._syncSize()},i._ensureBackgroundSprite=function(){if(!this._background){var t=this.node.getComponent(dz);t||(t=this.node.addComponent(dz)),t!==this._background&&(t.type=dz.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 $m("TEXT_LABEL")).layer=this.node.layer),(t=e.getComponent(fG))||(t=e.addComponent(fG)),e.parent=this.node,this._textLabel=t}this._inputMode===SSt.ANY?(t.verticalAlign=oG.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 $m("PLACEHOLDER_LABEL")).layer=this.node.layer),(t=e.getComponent(fG))||(t=e.addComponent(fG)),e.parent=this.node,this._placeholderLabel=t}this._inputMode===SSt.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!==ESt.PASSWORD)n===ESt.INITIAL_CAPS_ALL_CHARACTERS?t=t.toUpperCase():n===ESt.INITIAL_CAPS_WORD?t=t.replace(/(?:^|\s)\S/g,(function(t){return t.toUpperCase()})):n===ESt.INITIAL_CAPS_SENTENCE&&(t=(i=t).charAt(0).toUpperCase()+i.slice(1));else{for(var r="",s=t.length,a=0;a<s;++a)r+="●";t=r}return t},i._registerEvent=function(){this.node.on(um.TOUCH_START,this._onTouchBegan,this),this.node.on(um.TOUCH_END,this._onTouchEnded,this),this.node.on(PTt.XRUI_UNCLICK,this._xrUnClick,this),this.node.on(BTt.XR_KEYBOARD_INPUT,this._xrKeyBoardInput,this)},i._unregisterEvent=function(){this.node.off(um.TOUCH_START,this._onTouchBegan,this),this.node.off(um.TOUCH_END,this._onTouchEnded,this),this.node.off(PTt.XRUI_UNCLICK,this._xrUnClick,this),this.node.off(BTt.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(dz.EventType.SPRITE_FRAME_CHANGED,this._onBackgroundSpriteFrameChanged,this)},i._unregisterBackgroundEvent=function(){var t=this._background&&this._background.node;null==t||t.off(dz.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===SSt.ANY&&(s.verticalAlign=oG.TOP),s.enableWrapText=this._inputMode===SSt.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===SSt.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($St.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}(op))._EditBoxImpl=tEt,JSt.KeyboardReturnType=TSt,JSt.InputFlag=ESt,JSt.InputMode=SSt,JSt.EventType=$St,f((kSt=JSt).prototype,"textLabel",[wSt],Object.getOwnPropertyDescriptor(kSt.prototype,"textLabel"),kSt.prototype),f(kSt.prototype,"placeholderLabel",[xSt],Object.getOwnPropertyDescriptor(kSt.prototype,"placeholderLabel"),kSt.prototype),f(kSt.prototype,"backgroundImage",[ISt],Object.getOwnPropertyDescriptor(kSt.prototype,"backgroundImage"),kSt.prototype),f(kSt.prototype,"inputFlag",[OSt],Object.getOwnPropertyDescriptor(kSt.prototype,"inputFlag"),kSt.prototype),f(kSt.prototype,"inputMode",[DSt],Object.getOwnPropertyDescriptor(kSt.prototype,"inputMode"),kSt.prototype),f(kSt.prototype,"returnType",[MSt],Object.getOwnPropertyDescriptor(kSt.prototype,"returnType"),kSt.prototype),USt=Gs(kSt.prototype,"editingDidBegan",[PSt,ra],(function(){return[]})),GSt=Gs(kSt.prototype,"textChanged",[BSt,ra],(function(){return[]})),HSt=Gs(kSt.prototype,"editingDidEnded",[NSt,ra],(function(){return[]})),zSt=Gs(kSt.prototype,"editingReturn",[LSt,ra],(function(){return[]})),VSt=Gs(kSt.prototype,"_textLabel",[ra],(function(){return null})),WSt=Gs(kSt.prototype,"_placeholderLabel",[ra],(function(){return null})),XSt=Gs(kSt.prototype,"_returnType",[ra],(function(){return TSt.DEFAULT})),jSt=Gs(kSt.prototype,"_string",[ra],(function(){return""})),YSt=Gs(kSt.prototype,"_tabIndex",[ra],(function(){return 0})),KSt=Gs(kSt.prototype,"_backgroundImage",[ra],(function(){return null})),qSt=Gs(kSt.prototype,"_inputFlag",[ra],(function(){return ESt.DEFAULT})),QSt=Gs(kSt.prototype,"_inputMode",[ra],(function(){return SSt.ANY})),ZSt=Gs(kSt.prototype,"_maxLength",[ra],(function(){return 20})),FSt=kSt))||FSt)||FSt)||FSt));"object"==typeof window&&"object"==typeof document&&(zEt._EditBoxImpl=oEt),v.internal.EditBox=zEt,function(t){t[t.NONE=0]="NONE",t[t.HORIZONTAL=1]="HORIZONTAL",t[t.VERTICAL=2]="VERTICAL",t[t.GRID=3]="GRID"}(LEt||(LEt={})),Se(LEt),function(t){t[t.NONE=0]="NONE",t[t.CONTAINER=1]="CONTAINER",t[t.CHILDREN=2]="CHILDREN"}(FEt||(FEt={})),Se(FEt),function(t){t[t.HORIZONTAL=0]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(kEt||(kEt={})),Se(kEt),function(t){t[t.BOTTOM_TO_TOP=0]="BOTTOM_TO_TOP",t[t.TOP_TO_BOTTOM=1]="TOP_TO_BOTTOM"}(UEt||(UEt={})),Se(UEt),function(t){t[t.LEFT_TO_RIGHT=0]="LEFT_TO_RIGHT",t[t.RIGHT_TO_LEFT=1]="RIGHT_TO_LEFT"}(GEt||(GEt={})),Se(GEt),function(t){t[t.NONE=0]="NONE",t[t.FIXED_ROW=1]="FIXED_ROW",t[t.FIXED_COL=2]="FIXED_COL"}(HEt||(HEt={})),Se(HEt);var VEt,WEt,XEt,jEt,YEt,KEt,qEt,QEt,ZEt,JEt,$Et,tAt,eAt,iAt,nAt=new hn,rAt=t("fL",(hEt=qs("cc.Layout"),uEt=Zs(110),lEt=Qs(oU),cEt=xa(LEt),_Et=xa(FEt),dEt=xa(kEt),fEt=xa(UEt),pEt=xa(GEt),mEt=xa(HEt),hEt(gEt=uEt(gEt=lEt(((NEt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._resizeMode=yEt&&yEt(),e._layoutType=TEt&&TEt(),e._cellSize=SEt&&SEt(),e._startAxis=EEt&&EEt(),e._paddingLeft=AEt&&AEt(),e._paddingRight=REt&&REt(),e._paddingTop=bEt&&bEt(),e._paddingBottom=CEt&&CEt(),e._spacingX=wEt&&wEt(),e._spacingY=xEt&&xEt(),e._verticalDirection=IEt&&IEt(),e._horizontalDirection=OEt&&OEt(),e._constraint=DEt&&DEt(),e._constraintNum=MEt&&MEt(),e._affectedByScale=PEt&&PEt(),e._isAlign=BEt&&BEt(),e._layoutSize=new Hn(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(Hn.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(){gL.on(mL.EVENT_AFTER_UPDATE,this.updateLayout,this),this.node.on(um.SIZE_CHANGED,this._resized,this),this.node.on(um.ANCHOR_CHANGED,this._doLayoutDirty,this),this.node.on(um.CHILD_ADDED,this._childAdded,this),this.node.on(um.CHILD_REMOVED,this._childRemoved,this),this.node.on(um.CHILDREN_ORDER_CHANGED,this._childrenChanged,this),this.node.on("childrenSiblingOrderChanged",this.updateLayout,this),this._addChildrenEventListeners()},i._removeEventListeners=function(){gL.off(mL.EVENT_AFTER_UPDATE,this.updateLayout,this),this.node.off(um.SIZE_CHANGED,this._resized,this),this.node.off(um.ANCHOR_CHANGED,this._doLayoutDirty,this),this.node.off(um.CHILD_ADDED,this._childAdded,this),this.node.off(um.CHILD_REMOVED,this._childRemoved,this),this.node.off(um.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(um.SIZE_CHANGED,this._doLayoutDirty,this),i.on(um.TRANSFORM_CHANGED,this._transformDirty,this),i.on(um.ANCHOR_CHANGED,this._doLayoutDirty,this),i.on(um.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(um.SIZE_CHANGED,this._doLayoutDirty,this),i.off(um.TRANSFORM_CHANGED,this._transformDirty,this),i.off(um.ANCHOR_CHANGED,this._doLayoutDirty,this),i.off(um.ACTIVE_IN_HIERARCHY_CHANGED,this._childrenChanged,this)}},i._childAdded=function(t){t.on(um.SIZE_CHANGED,this._doLayoutDirty,this),t.on(um.TRANSFORM_CHANGED,this._transformDirty,this),t.on(um.ANCHOR_CHANGED,this._doLayoutDirty,this),t.on(um.ACTIVE_IN_HIERARCHY_CHANGED,this._childrenChanged,this),this._childrenChanged()},i._childRemoved=function(t){t.off(um.SIZE_CHANGED,this._doLayoutDirty,this),t.off(um.TRANSFORM_CHANGED,this._transformDirty,this),t.off(um.ANCHOR_CHANGED,this._doLayoutDirty,this),t.off(um.ACTIVE_IN_HIERARCHY_CHANGED,this._childrenChanged,this),this._childrenChanged()},i._resized=function(){this._layoutSize.set(this.node._uiProps.uiTransformComp.contentSize),this._doLayoutDirty()},i._doLayoutHorizontally=function(t,e,i,n){var r=this.node._uiProps.uiTransformComp.anchorPoint,s=this._getFixedBreakingNum(),a=1,o=this._paddingLeft;this._horizontalDirection===GEt.RIGHT_TO_LEFT&&(a=-1,o=this._paddingRight);var h=(this._horizontalDirection-r.x)*t+a*o,u=h-a*this._spacingX,l=0,c=0,_=0,d=0,f=!1,p=this._usefulLayoutObj.length,m=this._cellSize.width,g=this._getPaddingH();this._layoutType!==LEt.GRID&&this._resizeMode===FEt.CHILDREN&&(m=(t-g-(p-1)*this._spacingX)/p);for(var v=this._usefulLayoutObj,y=0;y<v.length;++y){var T=v[y],S=T.node,E=S.scale,A=this._getUsedScaleValue(E.x),R=this._getUsedScaleValue(E.y);this._resizeMode===FEt.CHILDREN&&(T.width=m/A,this._layoutType===LEt.GRID&&(T.height=this._cellSize.height/R));var b=Math.abs(this._horizontalDirection-T.anchorX),C=T.width*A,w=T.height*R;w>_&&(d=Math.max(_,d),c=_||w,_=w),u+=a*(b*C+this._spacingX);var x=a*(1-b)*C;if(e){if(s>0)(f=y/s>0&&y%s==0)&&(c=_>w?_:c);else if(C>t-g)u>h+a*b*C&&(f=!0);else{var I=(1-this._horizontalDirection-r.x)*t,O=u+x+a*(a>0?this._paddingRight:this._paddingLeft);f=Math.abs(O)>Math.abs(I)}f&&(u=h+a*b*C,w!==_&&(c=_),l+=c+this._spacingY,c=_=w)}var D=i(S,T,l);n&&S.setPosition(u,D),u+=x}return c=Math.max(c,_),Math.max(d,l+c)+this._getPaddingV()},i._doLayoutVertically=function(t,e,i,n){var r=this.node._uiProps.uiTransformComp.anchorPoint,s=this._getFixedBreakingNum(),a=1,o=this._paddingBottom;this._verticalDirection===UEt.TOP_TO_BOTTOM&&(a=-1,o=this._paddingTop);var h=(this._verticalDirection-r.y)*t+a*o,u=h-a*this._spacingY,l=0,c=0,_=0,d=0,f=!1,p=this._usefulLayoutObj.length,m=this._cellSize.height,g=this._getPaddingV();this._layoutType!==LEt.GRID&&this._resizeMode===FEt.CHILDREN&&(m=(t-g-(p-1)*this._spacingY)/p);for(var v=this._usefulLayoutObj,y=0;y<v.length;++y){var T=v[y],S=T.node,E=S.scale,A=this._getUsedScaleValue(E.x),R=this._getUsedScaleValue(E.y);this._resizeMode===FEt.CHILDREN&&(T.height=m/R,this._layoutType===LEt.GRID&&(T.width=this._cellSize.width/A));var b=Math.abs(this._verticalDirection-T.anchorY),C=T.width*A,w=T.height*R;C>l&&(c=Math.max(l,c),_=l||C,l=C),u+=a*(b*w+this._spacingY);var x=a*(1-b)*w;if(e){if(s>0)(f=y/s>0&&y%s==0)&&(_=l>w?l:_);else if(w>t-g)u>h+a*b*w&&(f=!0);else{var I=(1-this._verticalDirection-r.y)*t,O=u+x+a*(a>0?this._paddingTop:this._paddingBottom);f=Math.abs(O)>Math.abs(I)}f&&(u=h+a*b*w,C!==l&&(_=l),d+=_+this._spacingX,_=l=C)}var D=i(S,T,d);n&&(S.getPosition(nAt),S.setPosition(D,u,nAt.z)),u+=x}return _=Math.max(_,l),Math.max(c,d+_)+this._getPaddingH()},i._doLayoutGridAxisHorizontal=function(t,e){var i=this,n=e.width,r=1,s=-t.y*e.height,a=this._paddingBottom;this._verticalDirection===UEt.TOP_TO_BOTTOM&&(r=-1,s=(1-t.y)*e.height,a=this._paddingTop);var o=function(t,e,n){return s+r*(n+(1-e.anchorY)*e.height*i._getUsedScaleValue(t.scale.y)+a)},h=0;this._resizeMode===FEt.CONTAINER&&(h=this._doLayoutHorizontally(n,!0,o,!1),s=-t.y*h,this._verticalDirection===UEt.TOP_TO_BOTTOM&&(r=-1,s=(1-t.y)*h)),this._doLayoutHorizontally(n,!0,o,!0),this._resizeMode===FEt.CONTAINER&&this.node._uiProps.uiTransformComp.setContentSize(n,h)},i._doLayoutGridAxisVertical=function(t,e){var i=this,n=e.height,r=1,s=-t.x*e.width,a=this._paddingLeft;this._horizontalDirection===GEt.RIGHT_TO_LEFT&&(r=-1,s=(1-t.x)*e.width,a=this._paddingRight);var o=function(t,e,n){return s+r*(n+(1-e.anchorX)*e.width*i._getUsedScaleValue(t.scale.x)+a)},h=0;this._resizeMode===FEt.CONTAINER&&(h=this._doLayoutVertically(n,!0,o,!1),s=-t.x*h,this._horizontalDirection===GEt.RIGHT_TO_LEFT&&(r=-1,s=(1-t.x)*h)),this._doLayoutVertically(n,!0,o,!0),this._resizeMode===FEt.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===kEt.HORIZONTAL?this._doLayoutGridAxisHorizontal(e,i):this.startAxis===kEt.VERTICAL&&this._doLayoutGridAxisVertical(e,i)},i._getHorizontalBaseWidth=function(){var t=this._usefulLayoutObj,e=0,i=t.length;if(this._resizeMode===FEt.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===FEt.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===LEt.HORIZONTAL){var e=this._getHorizontalBaseWidth();this._doLayoutHorizontally(e,!1,(function(e){return(t._isAlign?hn.ZERO:e.position).y}),!0),this.node._uiProps.uiTransformComp.width=e}else if(this._layoutType===LEt.VERTICAL){var i=this._getVerticalBaseHeight();this._doLayoutVertically(i,!1,(function(e){return(t._isAlign?hn.ZERO:e.position).x}),!0),this.node._uiProps.uiTransformComp.height=i}else this._layoutType===LEt.GRID&&this._doLayoutGrid()},i._getUsedScaleValue=function(t){return this._affectedByScale?Math.abs(t):1},i._transformDirty=function(t){t&om.SCALE&&t&om.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!==LEt.GRID||this._constraint===HEt.NONE||this._constraintNum<=0)return 0;var t=this._constraint===HEt.FIXED_ROW?Math.ceil(this._usefulLayoutObj.length/this._constraintNum):this._constraintNum;return this._startAxis===kEt.VERTICAL&&(t=this._constraint===HEt.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===LEt.HORIZONTAL&&(this._isAlign=t,this._doLayoutDirty())}},{key:"alignVertical",get:function(){return this._isAlign},set:function(t){this._layoutType===LEt.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!==LEt.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!==LEt.NONE&&this._constraint!==t&&(this._constraint=t,this._doLayoutDirty())}},{key:"constraintNum",get:function(){return this._constraintNum},set:function(t){this._constraint!==HEt.NONE&&this._constraintNum!==t&&(t<=0&&U("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}(op)).Type=LEt,NEt.VerticalDirection=UEt,NEt.HorizontalDirection=GEt,NEt.ResizeMode=FEt,NEt.AxisDirection=kEt,NEt.Constraint=HEt,f((vEt=NEt).prototype,"type",[cEt],Object.getOwnPropertyDescriptor(vEt.prototype,"type"),vEt.prototype),f(vEt.prototype,"resizeMode",[_Et],Object.getOwnPropertyDescriptor(vEt.prototype,"resizeMode"),vEt.prototype),f(vEt.prototype,"startAxis",[dEt],Object.getOwnPropertyDescriptor(vEt.prototype,"startAxis"),vEt.prototype),f(vEt.prototype,"verticalDirection",[fEt],Object.getOwnPropertyDescriptor(vEt.prototype,"verticalDirection"),vEt.prototype),f(vEt.prototype,"horizontalDirection",[pEt],Object.getOwnPropertyDescriptor(vEt.prototype,"horizontalDirection"),vEt.prototype),f(vEt.prototype,"constraint",[mEt],Object.getOwnPropertyDescriptor(vEt.prototype,"constraint"),vEt.prototype),yEt=Gs(vEt.prototype,"_resizeMode",[ra],(function(){return FEt.NONE})),TEt=Gs(vEt.prototype,"_layoutType",[ra],(function(){return LEt.NONE})),SEt=Gs(vEt.prototype,"_cellSize",[ra],(function(){return new Hn(40,40)})),EEt=Gs(vEt.prototype,"_startAxis",[ra],(function(){return kEt.HORIZONTAL})),AEt=Gs(vEt.prototype,"_paddingLeft",[ra],(function(){return 0})),REt=Gs(vEt.prototype,"_paddingRight",[ra],(function(){return 0})),bEt=Gs(vEt.prototype,"_paddingTop",[ra],(function(){return 0})),CEt=Gs(vEt.prototype,"_paddingBottom",[ra],(function(){return 0})),wEt=Gs(vEt.prototype,"_spacingX",[ra],(function(){return 0})),xEt=Gs(vEt.prototype,"_spacingY",[ra],(function(){return 0})),IEt=Gs(vEt.prototype,"_verticalDirection",[ra],(function(){return UEt.TOP_TO_BOTTOM})),OEt=Gs(vEt.prototype,"_horizontalDirection",[ra],(function(){return GEt.LEFT_TO_RIGHT})),DEt=Gs(vEt.prototype,"_constraint",[ra],(function(){return HEt.NONE})),MEt=Gs(vEt.prototype,"_constraintNum",[ra],(function(){return 2})),PEt=Gs(vEt.prototype,"_affectedByScale",[ra],(function(){return!1})),BEt=Gs(vEt.prototype,"_isAlign",[ra],(function(){return!1})),gEt=vEt))||gEt)||gEt)||gEt));v.Layout=rAt,function(t){t[t.HORIZONTAL=0]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL",t[t.FILLED=2]="FILLED"}(iAt||(iAt={})),ve(iAt);var sAt,aAt,oAt,hAt,uAt,lAt,cAt,_At,dAt,fAt,pAt,mAt,gAt,vAt=t("fM",(VEt=qs("cc.ProgressBar"),WEt=Zs(110),XEt=Qs(oU),jEt=xa(dz),YEt=xa(iAt),VEt(KEt=WEt(KEt=XEt(((eAt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._barSprite=QEt&&QEt(),e._mode=ZEt&&ZEt(),e._totalLength=JEt&&JEt(),e._progress=$Et&&$Et(),e._reverse=tAt&&tAt(),e}s(e,t);var i=e.prototype;return i._initBarSprite=function(){if(this._barSprite){var t=this._barSprite.node;if(!t)return;var e=this.node._uiProps.uiTransformComp,i=e.contentSize,n=e.anchorPoint,r=t._uiProps.uiTransformComp.contentSize;if(this._barSprite.fillType===dz.FillType.RADIAL&&(this._mode=iAt.FILLED),this._mode===iAt.HORIZONTAL?this.totalLength=r.width:this._mode===iAt.VERTICAL?this.totalLength=r.height:this.totalLength=this._barSprite.fillRange,t.parent===this.node){var s=-i.width*n.x;t.setPosition(s,0,0)}}},i._updateBarStatus=function(){if(this._barSprite){var t=this._barSprite.node;if(!t)return;var e=t._uiProps.uiTransformComp,i=e.anchorPoint,n=e.contentSize,r=t.getPosition(),s=new Fn(0,.5),a=Oi(this._progress),o=this._totalLength*a,h=n,u=0,l=0;switch(this._mode){case iAt.HORIZONTAL:this._reverse&&(s=new Fn(1,.5)),h=new Hn(o,n.height),u=this._totalLength,l=n.height;break;case iAt.VERTICAL:s=this._reverse?new Fn(.5,1):new Fn(.5,0),h=new Hn(n.width,o),u=n.width,l=this._totalLength}if(this._mode===iAt.FILLED)this._barSprite.type!==dz.Type.FILLED?U("ProgressBar FILLED mode only works when barSprite's Type is FILLED!"):(this._reverse&&(o*=-1),this._barSprite.fillRange=o);else if(this._barSprite.type!==dz.Type.FILLED){var c=s.x-i.x,_=s.y-i.y,d=new hn(u*c,l*_,0);t.setPosition(r.x+d.x,r.y+d.y,r.z),e.setAnchorPoint(s),e.setContentSize(h)}else U("ProgressBar non-FILLED mode only works when barSprite's Type is non-FILLED!")}},n(e,[{key:"barSprite",get:function(){return this._barSprite},set:function(t){this._barSprite!==t&&(this._barSprite=t,this._initBarSprite())}},{key:"mode",get:function(){return this._mode},set:function(t){if(this._mode!==t&&(this._mode=t,this._barSprite)){var e=this._barSprite.node;if(!e)return;var i=e._uiProps.uiTransformComp.contentSize;this._mode===iAt.HORIZONTAL?this.totalLength=i.width:this._mode===iAt.VERTICAL?this.totalLength=i.height:this._mode===iAt.FILLED&&(this.totalLength=this._barSprite.fillRange)}}},{key:"totalLength",get:function(){return this._totalLength},set:function(t){this._mode===iAt.FILLED&&(t=Oi(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}(op)).Mode=iAt,f((qEt=eAt).prototype,"barSprite",[jEt],Object.getOwnPropertyDescriptor(qEt.prototype,"barSprite"),qEt.prototype),f(qEt.prototype,"mode",[YEt],Object.getOwnPropertyDescriptor(qEt.prototype,"mode"),qEt.prototype),QEt=Gs(qEt.prototype,"_barSprite",[ra],(function(){return null})),ZEt=Gs(qEt.prototype,"_mode",[ra],(function(){return iAt.HORIZONTAL})),JEt=Gs(qEt.prototype,"_totalLength",[ra],(function(){return 1})),$Et=Gs(qEt.prototype,"_progress",[ra],(function(){return.1})),tAt=Gs(qEt.prototype,"_reverse",[ra],(function(){return!1})),KEt=qEt))||KEt)||KEt)||KEt));v.ProgressBar=vAt;var yAt,TAt=new hn,SAt=new hn,EAt=new hn,AAt=new Fn,RAt=new pn,bAt=new Fn;!function(t){t[t.HORIZONTAL=0]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(yAt||(yAt={})),Se(yAt);var CAt,wAt=t("fN",(sAt=qs("cc.ScrollBar"),aAt=Zs(110),oAt=Qs(oU),hAt=xa(dz),uAt=xa(yAt),sAt(lAt=aAt(lAt=oAt(((gAt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._scrollView=_At&&_At(),e._handle=dAt&&dAt(),e._direction=fAt&&fAt(),e._enableAutoHide=pAt&&pAt(),e._autoHideTime=mAt&&mAt(),e._touching=!1,e._opacity=255,e._autoHideRemainingTime=0,e}s(e,t);var i=e.prototype;return i.hide=function(){this._autoHideRemainingTime=0,this._setOpacity(0)},i.show=function(){this._autoHideRemainingTime=this._autoHideTime,this._opacity=255,this._setOpacity(this._opacity)},i.onScroll=function(t){if(this._scrollView){var e=this._scrollView.content;if(e){var i=e._uiProps.uiTransformComp.contentSize,n=this._scrollView.node._uiProps.uiTransformComp.contentSize,r=this.node._uiProps.uiTransformComp.contentSize;if(!this._conditionalDisableScrollBar(i,n)){this._enableAutoHide&&(this._autoHideRemainingTime=this._autoHideTime,this._setOpacity(this._opacity));var s=0,a=0,o=0,h=0,u=0,l=bAt;l.set(0,0),this._direction===yAt.HORIZONTAL?(s=i.width,a=n.width,u=r.width,o=t.x,this._convertToScrollViewSpace(l,e),h=-l.x):this._direction===yAt.VERTICAL&&(s=i.height,a=n.height,u=r.height,o=t.y,this._convertToScrollViewSpace(l,e),h=-l.y);var c=this._calculateLength(s,a,u,o),_=bAt;this._calculatePosition(_,s,a,u,h,o,c),this._updateLength(c),this._updateHandlerPosition(_)}}}},i.setScrollView=function(t){this._scrollView=t},i.onTouchBegan=function(){this._enableAutoHide&&(this._touching=!0)},i.onTouchEnded=function(){if(this._enableAutoHide&&(this._touching=!1,!(this._autoHideTime<=0))){if(this._scrollView){var t=this._scrollView.content;if(t){var e=t._uiProps.uiTransformComp.contentSize,i=this._scrollView.node._uiProps.uiTransformComp.contentSize;if(this._conditionalDisableScrollBar(e,i))return}}this._autoHideRemainingTime=this._autoHideTime}},i.onEnable=function(){var t=this.node.getComponent(dz);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){TAt.set(-n.anchorX*n.width,-n.anchorY*n.height,0),n.convertToWorldSpaceAR(TAt,SAt);var r=i.convertToNodeSpaceAR(SAt);r.x+=i.anchorX*i.width,r.y+=i.anchorY*i.height,t.set(r.x,r.y)}else t.set(Fn.ZERO)},i._setOpacity=function(t){if(this._handle){var e=this.node.getComponent(dz);e&&(RAt.set(e.color),RAt.a=t,e.color=RAt),(e=this._handle.getComponent(dz))&&(RAt.set(e.color),RAt.a=t,e.color=RAt)}},i._updateHandlerPosition=function(t){if(this._handle){var e=EAt;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;hn.set(TAt,-i.width*n.x,-i.height*n.y,0);var a=this.node._uiProps.uiTransformComp.convertToWorldSpaceAR(TAt,SAt),o=t;o.set(0,0,0),s._uiProps.uiTransformComp.convertToNodeSpaceAR(a,o),this.direction===yAt.HORIZONTAL?o.set(o.x,o.y+(i.height-r.height)/2,o.z):this.direction===yAt.VERTICAL&&o.set(o.x+(i.width-r.width)/2,o.y,o.z),this.handle.node.setPosition(o)},i._conditionalDisableScrollBar=function(t,e){return t.width<=e.width&&this._direction===yAt.HORIZONTAL||t.height<=e.height&&this._direction===yAt.VERTICAL},i._calculateLength=function(t,e,i,n){var r=t;return n&&(r+=20*(n>0?n:-n)),i*(e/r)},i._calculatePosition=function(t,e,i,n,r,s,a){var o=e-i;s&&(o+=Math.abs(s));var h=0;o&&(h=Oi(h=r/o));var u=(n-a)*h;this._direction===yAt.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===AAt.x&&n.y===AAt.y||e.setAnchorPoint(AAt),this._direction===yAt.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(Fn.ZERO))}},{key:"direction",get:function(){return this._direction},set:function(t){this._direction!==t&&(this._direction=t,this.onScroll(Fn.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}(op)).Direction=yAt,f((cAt=gAt).prototype,"handle",[hAt],Object.getOwnPropertyDescriptor(cAt.prototype,"handle"),cAt.prototype),f(cAt.prototype,"direction",[uAt],Object.getOwnPropertyDescriptor(cAt.prototype,"direction"),cAt.prototype),_At=Gs(cAt.prototype,"_scrollView",[ra],(function(){return null})),dAt=Gs(cAt.prototype,"_handle",[ra],(function(){return null})),fAt=Gs(cAt.prototype,"_direction",[ra],(function(){return yAt.HORIZONTAL})),pAt=Gs(cAt.prototype,"_enableAutoHide",[ra],(function(){return!1})),mAt=Gs(cAt.prototype,"_autoHideTime",[ra],(function(){return 1})),lAt=cAt))||lAt)||lAt)||lAt));v.ScrollBar=wAt;var xAt,IAt,OAt,DAt,MAt,PAt,BAt,NAt,LAt,FAt,kAt,UAt,GAt,HAt,zAt,VAt,WAt,XAt,jAt,YAt,KAt,qAt=t("fS",qs("cc.ViewGroup")(CAt=Zs(110)(CAt=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(op))||CAt)||CAt);v.ViewGroup=qAt;var QAt,ZAt,JAt=1e-4,$At=new hn,tRt=new hn,eRt=new Fn,iRt=new Fn,nRt=function(){return(new Date).getMilliseconds()},rRt={"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"}(QAt||(QAt={})),function(t){t[t.NONE=0]="NONE",t[t.LEFT=1]="LEFT",t[t.RIGHT=2]="RIGHT"}(ZAt||(ZAt={}));var sRt,aRt,oRt,hRt,uRt,lRt,cRt,_Rt,dRt,fRt,pRt,mRt,gRt,vRt=t("fO",(xAt=qs("cc.ScrollView"),IAt=Zs(110),OAt=Qs(oU),DAt=xa($m),MAt=xa(wAt),PAt=xa(wAt),BAt=xa([rp]),xAt(NAt=IAt(NAt=OAt(((KAt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).bounceDuration=FAt&&FAt(),e.brake=kAt&&kAt(),e.elastic=UAt&&UAt(),e.inertia=GAt&&GAt(),e.horizontal=HAt&&HAt(),e.vertical=zAt&&zAt(),e.cancelInnerEvents=VAt&&VAt(),e.scrollEvents=WAt&&WAt(),e._autoScrolling=!1,e._scrolling=!1,e._content=XAt&&XAt(),e._horizontalScrollBar=jAt&&jAt(),e._verticalScrollBar=YAt&&YAt(),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 hn,e._autoScrollTargetDelta=new hn,e._autoScrollTotalTime=0,e._autoScrollAccumulatedTime=0,e._autoScrollCurrentlyOutOfBoundary=!1,e._autoScrollBraking=!1,e._autoScrollBrakingStartPosition=new hn,e._outOfBoundaryAmount=new hn,e._outOfBoundaryAmountDirty=!0,e._stopMouseWheel=!1,e._mouseWheelEventElapsedTime=0,e._isScrollEndedWithThresholdEventFired=!1,e._scrollEventEmitMask=0,e._isBouncing=!1,e._contentPos=new hn,e._deltaPos=new hn,e._deltaAmount=new hn,e._hoverIn=ZAt.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 Fn(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 Fn(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 Fn(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 Fn(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 Fn(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 Fn(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 Fn(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 Fn(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 Fn(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 Fn(e,t)},i.getMaxScrollOffset=function(){if(!this._content||!this.view)return Fn.ZERO;var t=this._content._uiProps.uiTransformComp.contentSize,e=t.width-this.view.width,i=t.height-this.view.height;return new Fn(e=e>=0?e:0,i=i>=0?i:0)},i.scrollToPercentHorizontal=function(t,e,i){var n=this._calculateMovePercentDelta({anchor:new Fn(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 Fn(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 Fn(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)<JAt&&Math.abs(t.y-e.y)<JAt||(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):hn.ZERO.clone()},i.isScrolling=function(){return this._scrolling},i.isAutoScrolling=function(){return this._autoScrolling},i.getScrollEndedEventTiming=function(){return JAt},i.start=function(){this._calculateBoundary(),this._content&&gL.once(mL.EVENT_BEFORE_DRAW,this._adjustContentOutOfBoundary,this)},i.onEnable=function(){this._registerEvent(),this._content&&(this._content.on(um.SIZE_CHANGED,this._calculateBoundary,this),this._content.on(um.TRANSFORM_CHANGED,this._scaleChanged,this),this.view&&(this.view.node.on(um.TRANSFORM_CHANGED,this._scaleChanged,this),this.view.node.on(um.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(um.SIZE_CHANGED,this._calculateBoundary,this),this._content.off(um.TRANSFORM_CHANGED,this._scaleChanged,this),this.view&&(this.view.node.off(um.TRANSFORM_CHANGED,this._scaleChanged,this),this.view.node.off(um.SIZE_CHANGED,this._calculateBoundary,this))),this._deltaAmount.set(0,0),this._hideScrollBar(),this.stopAutoScroll()},i._registerEvent=function(){this.node.on(um.TOUCH_START,this._onTouchBegan,this,!0),this.node.on(um.TOUCH_MOVE,this._onTouchMoved,this,!0),this.node.on(um.TOUCH_END,this._onTouchEnded,this,!0),this.node.on(um.TOUCH_CANCEL,this._onTouchCancelled,this,!0),this.node.on(um.MOUSE_WHEEL,this._onMouseWheel,this,!0),this.node.on(PTt.XRUI_HOVER_ENTERED,this._xrHoverEnter,this),this.node.on(PTt.XRUI_HOVER_EXITED,this._xrHoverExit,this),Cw.on(bw.EventType.HANDLE_INPUT,this._dispatchEventHandleInput,this),Cw.on(bw.EventType.GAMEPAD_INPUT,this._dispatchEventHandleInput,this)},i._unregisterEvent=function(){this.node.off(um.TOUCH_START,this._onTouchBegan,this,!0),this.node.off(um.TOUCH_MOVE,this._onTouchMoved,this,!0),this.node.off(um.TOUCH_END,this._onTouchEnded,this,!0),this.node.off(um.TOUCH_CANCEL,this._onTouchCancelled,this,!0),this.node.off(um.MOUSE_WHEEL,this._onMouseWheel,this,!0),this.node.off(PTt.XRUI_HOVER_ENTERED,this._xrHoverEnter,this),this.node.off(PTt.XRUI_HOVER_EXITED,this._xrHoverExit,this),Cw.off(bw.EventType.HANDLE_INPUT,this._dispatchEventHandleInput,this),Cw.off(bw.EventType.GAMEPAD_INPUT,this._dispatchEventHandleInput,this)},i._onMouseWheel=function(t,e){if(this.enabledInHierarchy&&!this._hasNestedViewGroup(t,e)){var i=new hn,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(eRt);if(n.subtract(i.getUIStartLocation(iRt)),n.length()>7&&!this._touchMoved&&t.target!==this.node){var r=new MC(t.getTouches(),t.bubbles,bC.TOUCH_CANCEL);r.touch=t.touch,r.simulate=!0,t.target.dispatchEvent(r),this._touchMoved=!0}this._stopPropagationIfTargetIsMe(t)}}},i._onTouchEnded=function(t,e){if(this.enabledInHierarchy&&this._content&&t&&!this._hasNestedViewGroup(t,e)){this._dispatchEvent(QAt.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(rAt);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!==wC.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(qAt));if(r.getComponent(qAt))return!0}return!1},i._startInertiaScroll=function(t){var e=new hn(t);e.multiplyScalar(.7),this._startAttenuatingAutoScroll(e,t)},i._calculateAttenuatedFactor=function(t){return this.brake<=0?1-this.brake:(1-this.brake)*(1/(1+14e-6*t+t*t*8e-9))},i._startAttenuatingAutoScroll=function(t,e){var i=t.clone();if(i.normalize(),this._content&&this.view){var n=this._content._uiProps.uiTransformComp.contentSize,r=this.view.contentSize,s=n.width-r.width,a=n.height-r.height,o=this._calculateAttenuatedFactor(s),h=this._calculateAttenuatedFactor(a);i.x=i.x*s*(1-this.brake)*o,i.y=i.y*a*h*(1-this.brake),i.z=0}var u=t.length(),l=i.length()/u;if(i.add(t),this.brake>0&&l>7){l=Math.sqrt(l);var c=t.clone();c.multiplyScalar(l),i.set(c),i.add(t)}var _=this._calculateAutoScrollTimeByInitialSpeed(e.length());this.brake>0&&l>3&&(_*=l=3),0===this.brake&&l>1&&(_*=l),this._startAutoScroll(i,_,!0)},i._calculateAutoScrollTimeByInitialSpeed=function(t){return Math.sqrt(Math.sqrt(t/5))},i._startAutoScroll=function(t,e,i){void 0===i&&(i=!1);var n=this._flattenVectorByDirection(t);this._autoScrolling=!0,this._autoScrollTargetDelta=n,this._autoScrollAttenuate=i,hn.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(hn.ZERO,JAt)||(this._autoScrollCurrentlyOutOfBoundary=!0)},i._calculateTouchMoveVelocity=function(){var t=new hn,e=0;if((e=this._touchMoveTimeDeltas.reduce((function(t,e){return t+e}),e))<=0||e>=.5)t.set(hn.ZERO);else{var i=new hn;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);$At.set(this._getContentPosition()),$At.add(i),$At.set(Math.round(1e4*$At.x)*JAt,Math.round(1e4*$At.y)*JAt,$At.z),this._setContentPosition($At);var n=this._getHowMuchOutOfBoundary();eRt.set(n.x,n.y),this._updateScrollBar(eRt),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 hn).equals(hn.ZERO,JAt)&&!this._outOfBoundaryAmountDirty)return this._outOfBoundaryAmount;var e=new hn,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(hn.ZERO,JAt)&&(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===QAt.SCROLL_ENDED)this._scrollEventEmitMask=0;else if(t===QAt.SCROLL_TO_TOP||t===QAt.SCROLL_TO_BOTTOM||t===QAt.SCROLL_TO_LEFT||t===QAt.SCROLL_TO_RIGHT){var e=1<<rRt[t];if(this._scrollEventEmitMask&e)return;this._scrollEventEmitMask|=e}rp.emitEvents(this.scrollEvents,this,rRt[t]),this.node.emit(t,this)},i._adjustContentOutOfBoundary=function(){if(this._content){this._outOfBoundaryAmountDirty=!0;var t=this._getHowMuchOutOfBoundary();!t.equals(hn.ZERO,JAt)&&($At.set(this._getContentPosition()),$At.add(t),this._setContentPosition($At),this._updateScrollBar(Fn.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||xi(e.height,t.height)?this._verticalScrollBar.hide():this._verticalScrollBar.show()),this._horizontalScrollBar&&this._horizontalScrollBar.isValid&&(e.width<t.width||xi(e.width,t.width)?this._horizontalScrollBar.hide():this._horizontalScrollBar.show())}},i._stopPropagationIfTargetIsMe=function(t){t.eventPhase===wC.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(QAt.SCROLL_ENDED))},i._getLocalAxisAlignDelta=function(t,e){var i=this.node._uiProps.uiTransformComp,n=new hn;i&&(e.getUILocation(eRt),e.getUIPreviousLocation(iRt),$At.set(eRt.x,eRt.y,0),tRt.set(iRt.x,iRt.y,0),i.convertToNodeSpaceAR($At,$At),i.convertToNodeSpaceAR(tRt,tRt),hn.subtract(n,$At,tRt)),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=QAt.NONE,r=QAt.NONE;if(this._content){var s=this._content._uiProps.uiTransformComp,a=s.anchorX,o=s.anchorY,h=s.width,u=s.height,l=this._content.position||hn.ZERO;this.vertical&&(i.y>0?l.y-o*u+i.y>=this._bottomBoundary&&(n=QAt.SCROLL_TO_BOTTOM):i.y<0&&l.y-o*u+u+i.y<=this._topBoundary&&(n=QAt.SCROLL_TO_TOP)),this.horizontal&&(i.x<0?l.x-a*h+h+i.x<=this._rightBoundary&&(r=QAt.SCROLL_TO_RIGHT):i.x>0&&l.x-a*h+i.x>=this._leftBoundary&&(r=QAt.SCROLL_TO_LEFT))}this._moveContent(i,!1),(this.horizontal&&0!==i.x||this.vertical&&0!==i.y)&&(this._scrolling||(this._scrolling=!0,this._dispatchEvent(QAt.SCROLL_BEGAN)),this._dispatchEvent(QAt.SCROLLING)),n!==QAt.NONE&&this._dispatchEvent(n),r!==QAt.NONE&&this._dispatchEvent(r)},i._handlePressLogic=function(){this._autoScrolling&&this._dispatchEvent(QAt.SCROLL_ENDED),this._autoScrolling=!1,this._isBouncing=!1,this._touchMovePreviousTimestamp=nRt(),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=nRt();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(hn.ZERO,JAt))return!1;var e=Math.max(this.bounceDuration,0);return this._startAutoScroll(t,e,!0),this._isBouncing||(t.y>0&&this._dispatchEvent(QAt.BOUNCE_TOP),t.y<0&&this._dispatchEvent(QAt.BOUNCE_BOTTOM),t.x>0&&this._dispatchEvent(QAt.BOUNCE_RIGHT),t.x<0&&this._dispatchEvent(QAt.BOUNCE_LEFT),this._isBouncing=!0),!0},i._processInertiaScroll=function(){if(!this._startBounceBackIfNeeded()&&this.inertia){var t=this._calculateTouchMoveVelocity();!t.equals($At,JAt)&&this.brake<1&&this._startInertiaScroll(t)}this._onScrollBarTouchEnded()},i._isOutOfBoundary=function(){return!this._getHowMuchOutOfBoundary().equals(hn.ZERO,JAt)},i._isNecessaryAutoScrollBrake=function(){if(this._autoScrollBraking)return!0;if(this._isOutOfBoundary()){if(!this._autoScrollCurrentlyOutOfBoundary)return this._autoScrollCurrentlyOutOfBoundary=!0,this._autoScrollBraking=!0,hn.copy(this._autoScrollBrakingStartPosition,this._getContentPosition()),!0}else this._autoScrollCurrentlyOutOfBoundary=!1;return!1},i._processAutoScrolling=function(t){var e=this._isNecessaryAutoScrollBrake(),i=e?.05:1;this._autoScrollAccumulatedTime+=t*(1/i);var n,r=Math.min(1,this._autoScrollAccumulatedTime/this._autoScrollTotalTime);this._autoScrollAttenuate&&(n=r,r=(n-=1)*n*n*n*n+1);var s=this._autoScrollTargetDelta.clone();s.multiplyScalar(r);var a=this._autoScrollStartPosition.clone();a.add(s);var o=Math.abs(r-1)<=JAt;if(Math.abs(r-1)<=this.getScrollEndedEventTiming()&&!this._isScrollEndedWithThresholdEventFired&&(this._dispatchEvent(QAt.SCROLL_ENG_WITH_THRESHOLD),this._isScrollEndedWithThresholdEventFired=!0),this.elastic){var h=a.clone();h.subtract(this._autoScrollBrakingStartPosition),e&&h.multiplyScalar(i),a.set(this._autoScrollBrakingStartPosition),a.add(h)}else{var u=a.clone();u.subtract(this.getContentPosition());var l=this._getHowMuchOutOfBoundary(u);l.equals(hn.ZERO,JAt)||(a.add(l),o=!0)}o&&(this._autoScrolling=!1);var c=a.clone();c.subtract(this._getContentPosition()),this._clampDelta(c),this._moveContent(c,o),this._dispatchEvent(QAt.SCROLLING),this._autoScrolling||(this._isBouncing=!1,this._scrolling=!1,this._dispatchEvent(QAt.SCROLL_ENDED))},i._checkMouseWheel=function(t){if(!this._getHowMuchOutOfBoundary().equals(hn.ZERO,JAt))return this._processInertiaScroll(),this._scrolling&&(this._scrolling=!1,this._autoScrolling||this._dispatchEvent(QAt.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(QAt.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(Fn.ZERO,Fn.ONE);var r=this._getContentBottomBoundary()-this._bottomBoundary;r=-r;var s=this._getContentLeftBoundary()-this._leftBoundary;s=-s;var a=new hn;if(this._content&&this.view){var o=0,h=this._content._uiProps.uiTransformComp.contentSize,u=this.view.contentSize;i&&(o=h.width-u.width,a.x=s-o*e.x),n&&(o=h.height-u.height,a.y=r-o*e.y)}return a},i._moveContentToTopLeft=function(t){var e=this._getContentBottomBoundary()-this._bottomBoundary;e=-e;var i=new hn,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===om.SCALE&&this._calculateBoundary()},i._xrHoverEnter=function(t){t.deviceType===MTt.Left?this._hoverIn=ZAt.LEFT:t.deviceType===MTt.Right&&(this._hoverIn=ZAt.RIGHT)},i._xrHoverExit=function(){this._hoverIn=ZAt.NONE},i._dispatchEventHandleInput=function(t){var e,i;t instanceof BC?e=t.gamepad:t instanceof NC&&(e=t.handleInputDevice),this.enabledInHierarchy&&this._hoverIn!==ZAt.NONE&&(this._hoverIn===ZAt.LEFT?(i=e.leftStick.getValue()).equals(Fn.ZERO)||this._xrThumbStickMove(i):this._hoverIn===ZAt.RIGHT&&((i=e.rightStick.getValue()).equals(Fn.ZERO)||this._xrThumbStickMove(i)))},i._xrThumbStickMove=function(t){if(this.enabledInHierarchy){var e=new hn,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()):Y(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(Fn.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(Fn.ZERO)))}},{key:"view",get:function(){var t=this._content&&this._content.parent;return t?t._uiProps.uiTransformComp:null}}]),e}(qAt)).EventType=QAt,FAt=Gs((LAt=KAt).prototype,"bounceDuration",[ra],(function(){return 1})),kAt=Gs(LAt.prototype,"brake",[ra],(function(){return.5})),UAt=Gs(LAt.prototype,"elastic",[ra],(function(){return!0})),GAt=Gs(LAt.prototype,"inertia",[ra],(function(){return!0})),f(LAt.prototype,"content",[DAt],Object.getOwnPropertyDescriptor(LAt.prototype,"content"),LAt.prototype),HAt=Gs(LAt.prototype,"horizontal",[ra],(function(){return!0})),f(LAt.prototype,"horizontalScrollBar",[MAt],Object.getOwnPropertyDescriptor(LAt.prototype,"horizontalScrollBar"),LAt.prototype),zAt=Gs(LAt.prototype,"vertical",[ra],(function(){return!0})),f(LAt.prototype,"verticalScrollBar",[PAt],Object.getOwnPropertyDescriptor(LAt.prototype,"verticalScrollBar"),LAt.prototype),VAt=Gs(LAt.prototype,"cancelInnerEvents",[ra],(function(){return!0})),WAt=Gs(LAt.prototype,"scrollEvents",[BAt,ra],(function(){return[]})),XAt=Gs(LAt.prototype,"_content",[ra],(function(){return null})),jAt=Gs(LAt.prototype,"_horizontalScrollBar",[ra],(function(){return null})),YAt=Gs(LAt.prototype,"_verticalScrollBar",[ra],(function(){return null})),NAt=LAt))||NAt)||NAt)||NAt));v.ScrollView=vRt;var yRt,TRt=new hn;!function(t){t[t.Horizontal=0]="Horizontal",t[t.Vertical=1]="Vertical"}(yRt||(yRt={})),Se(yRt);var SRt,ERt,ARt,RRt,bRt,CRt,wRt,xRt,IRt,ORt,DRt,MRt,PRt=t("fP",(sRt=qs("cc.Slider"),aRt=Zs(110),oRt=Qs(oU),hRt=xa(dz),uRt=xa(yRt),lRt=xa([rp]),sRt(cRt=aRt(cRt=oRt(((gRt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).slideEvents=dRt&&dRt(),e._handle=fRt&&fRt(),e._direction=pRt&&pRt(),e._progress=mRt&&mRt(),e._offset=new hn,e._dragging=!1,e._touchHandle=!1,e._handleLocalPos=new hn,e._touchPos=new hn,e}s(e,t);var i=e.prototype;return i.__preload=function(){this._updateHandlePosition()},i.onEnable=function(){this._updateHandlePosition(),this.node.on(um.TOUCH_START,this._onTouchBegan,this),this.node.on(um.TOUCH_MOVE,this._onTouchMoved,this),this.node.on(um.TOUCH_END,this._onTouchEnded,this),this.node.on(um.TOUCH_CANCEL,this._onTouchCancelled,this),this.node.on(PTt.XRUI_HOVER_STAY,this._xrHoverStay,this),this.node.on(PTt.XRUI_CLICK,this._xrClick,this),this.node.on(PTt.XRUI_UNCLICK,this._xrUnClick,this),this._handle&&this._handle.isValid&&(this._handle.node.on(um.TOUCH_START,this._onHandleDragStart,this),this._handle.node.on(um.TOUCH_MOVE,this._onTouchMoved,this),this._handle.node.on(um.TOUCH_END,this._onTouchEnded,this))},i.onDisable=function(){this.node.off(um.TOUCH_START,this._onTouchBegan,this),this.node.off(um.TOUCH_MOVE,this._onTouchMoved,this),this.node.off(um.TOUCH_END,this._onTouchEnded,this),this.node.off(um.TOUCH_CANCEL,this._onTouchCancelled,this),this.node.off(PTt.XRUI_HOVER_STAY,this._xrHoverStay,this),this.node.off(PTt.XRUI_CLICK,this._xrClick,this),this.node.off(PTt.XRUI_UNCLICK,this._xrUnClick,this),this._handle&&this._handle.isValid&&(this._handle.node.off(um.TOUCH_START,this._onHandleDragStart,this),this._handle.node.off(um.TOUCH_MOVE,this._onTouchMoved,this),this._handle.node.off(um.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();hn.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 hn,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();hn.set(this._touchPos,e.x,e.y,0);var i=this.node._uiProps.uiTransformComp,n=i.convertToNodeSpaceAR(this._touchPos,TRt);this.direction===yRt.Horizontal?this.progress=Oi(.5+(n.x-this._offset.x)/i.width):this.progress=Oi(.5+(n.y-this._offset.y)/i.height)}},i._updateHandlePosition=function(){if(this._handle){this._handleLocalPos.set(this._handle.node.getPosition());var t=this.node._uiProps.uiTransformComp;this._direction===yRt.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===yRt.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,TRt),this.direction===yRt.Horizontal?this.progress=Oi(.5+(TRt.x-this.node.position.x)/e.width):this.progress=Oi(.5+(TRt.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}(op)).Direction=yRt,f((_Rt=gRt).prototype,"handle",[hRt],Object.getOwnPropertyDescriptor(_Rt.prototype,"handle"),_Rt.prototype),f(_Rt.prototype,"direction",[uRt],Object.getOwnPropertyDescriptor(_Rt.prototype,"direction"),_Rt.prototype),dRt=Gs(_Rt.prototype,"slideEvents",[lRt,ra],(function(){return[]})),fRt=Gs(_Rt.prototype,"_handle",[ra],(function(){return null})),pRt=Gs(_Rt.prototype,"_direction",[ra],(function(){return yRt.Horizontal})),mRt=Gs(_Rt.prototype,"_progress",[ra],(function(){return.1})),cRt=_Rt))||cRt)||cRt)||cRt));function BRt(){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))}v.Slider=PRt,function(t){t.TOGGLE="toggle"}(MRt||(MRt={}));var NRt,LRt,FRt,kRt,URt,GRt,HRt,zRt=t("fQ",(SRt=qs("cc.Toggle"),ERt=Zs(110),ARt=Qs(oU),RRt=xa(dz),bRt=xa([rp]),SRt(CRt=ERt(CRt=ARt(((DRt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).checkEvents=xRt&&xRt(),e._isChecked=IRt&&IRt(),e._checkMark=ORt&&ORt(),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 v.Node.isNode(t)?t.getComponent("cc.ToggleContainer"):null}}]),e}(ySt)).EventType=BRt(MRt,gSt),f((wRt=DRt).prototype,"checkMark",[RRt],Object.getOwnPropertyDescriptor(wRt.prototype,"checkMark"),wRt.prototype),xRt=Gs(wRt.prototype,"checkEvents",[bRt,ra],(function(){return[]})),IRt=Gs(wRt.prototype,"_isChecked",[ra],(function(){return!0})),ORt=Gs(wRt.prototype,"_checkMark",[ra],(function(){return null})),CRt=wRt))||CRt)||CRt)||CRt));v.Toggle=zRt;var VRt,WRt,XRt,jRt,YRt,KRt,qRt,QRt,ZRt,JRt,$Rt,tbt,ebt,ibt,nbt,rbt,sbt,abt,obt,hbt,ubt,lbt,cbt,_bt,dbt,fbt,pbt=t("fR",(NRt=qs("cc.ToggleContainer"),LRt=Zs(110),FRt=xa([rp]),NRt(kRt=LRt((URt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._allowSwitchOff=GRt&&GRt(),e.checkEvents=HRt&&HRt(),e}s(e,t);var i=e.prototype;return i.onEnable=function(){this.ensureValidState(),this.node.on(um.CHILD_ADDED,this.ensureValidState,this),this.node.on(um.CHILD_REMOVED,this.ensureValidState,this)},i.onDisable=function(){this.node.off(um.CHILD_ADDED,this.ensureValidState,this),this.node.off(um.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&&v.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}(op),GRt=Gs(URt.prototype,"_allowSwitchOff",[ra],(function(){return!1})),HRt=Gs(URt.prototype,"checkEvents",[FRt,ra],(function(){return[]})),kRt=URt))||kRt)||kRt));v.ToggleContainer=pbt;var mbt,gbt,vbt=new Fn;function ybt(t){return t instanceof AC?Dl:t._uiProps.uiTransformComp?t._uiProps.uiTransformComp.contentSize:Hn.ZERO}function Tbt(t,e,i,n){t.parent?vbt.set(t.parent.getScale().x,t.parent.getScale().y):vbt.set(0,0);for(var r=vbt.x,s=vbt.y,a=0,o=0,h=t.parent;;){if(!h)return i.x=i.y=0,void(n.x=n.y=1);var u=h.getPosition();if(a+=u.x,o+=u.y,(h=h.parent)===e)break;h?vbt.set(h.getScale().x,h.getScale().y):vbt.set(0,0);var l=vbt.x,c=vbt.y;a*=l,o*=c,r*=l,s*=c}n.x=0!==r?1/r:1,n.y=0!==s?1/s:1,i.x=-a,i.y=-o}!function(t){t[t.ONCE=0]="ONCE",t[t.ALWAYS=1]="ALWAYS",t[t.ON_WINDOW_RESIZE=2]="ON_WINDOW_RESIZE"}(mbt||(mbt={})),Se(mbt),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"}(gbt||(gbt={}));var Sbt,Ebt,Abt,Rbt,bbt,Cbt,wbt,xbt,Ibt,Obt,Dbt,Mbt,Pbt=gbt.TOP|gbt.BOT,Bbt=gbt.LEFT|gbt.RIGHT,Nbt=t("fT",(VRt=qs("cc.Widget"),WRt=Zs(110),XRt=Qs(oU),jRt=xa($m),YRt=xa(mbt),VRt(KRt=WRt(KRt=XRt(((fbt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._lastPos=new hn,e._lastSize=new Hn,e._dirty=!0,e._hadAlignOnce=!1,e._alignFlags=QRt&&QRt(),e._target=ZRt&&ZRt(),e._left=JRt&&JRt(),e._right=$Rt&&$Rt(),e._top=tbt&&tbt(),e._bottom=ebt&&ebt(),e._horizontalCenter=ibt&&ibt(),e._verticalCenter=nbt&&nbt(),e._isAbsLeft=rbt&&rbt(),e._isAbsRight=sbt&&sbt(),e._isAbsTop=abt&&abt(),e._isAbsBottom=obt&&obt(),e._isAbsHorizontalCenter=hbt&&hbt(),e._isAbsVerticalCenter=ubt&&ubt(),e._originalWidth=lbt&&lbt(),e._originalHeight=cbt&&cbt(),e._alignMode=_bt&&_bt(),e._lockFlags=dbt&&dbt(),e}s(e,t);var i=e.prototype;return i.updateAlignment=function(){v._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),v._widgetManager.add(this),this._hadAlignOnce=!1,this._registerEvent(),this._registerTargetEvents()},i.onDisable=function(){v._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(um.TRANSFORM_CHANGED,this._setDirtyByMode,this),this.node.on(um.SIZE_CHANGED,this._setDirtyByMode,this),this.node.on(um.ANCHOR_CHANGED,this._adjustWidgetToAnchorChanged,this),this.node.on(um.PARENT_CHANGED,this._adjustTargetToParentChanged,this)},i._unregisterEvent=function(){this.node.off(um.TRANSFORM_CHANGED,this._setDirtyByMode,this),this.node.off(um.SIZE_CHANGED,this._setDirtyByMode,this),this.node.off(um.ANCHOR_CHANGED,this._adjustWidgetToAnchorChanged,this)},i._removeParentEvent=function(){this.node.off(um.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:Dl;this.isAlignLeft&&t===gbt.LEFT?this._left=e?this._left*r.width:this._left/r.width:this.isAlignRight&&t===gbt.RIGHT?this._right=e?this._right*r.width:this._right/r.width:this.isAlignHorizontalCenter&&t===gbt.CENTER?this._horizontalCenter=e?this._horizontalCenter*r.width:this._horizontalCenter/r.width:this.isAlignTop&&t===gbt.TOP?this._top=e?this._top*r.height:this._top/r.height:this.isAlignBottom&&t===gbt.BOT?this._bottom=e?this._bottom*r.height:this._bottom/r.height:this.isAbsoluteVerticalCenter&&t===gbt.MID&&(this._verticalCenter=this._verticalCenter/r.height),this._recursiveDirty()}},i._registerTargetEvents=function(){var t=this._target||this.node.parent;t&&t.getComponent(oU)&&(t.on(um.TRANSFORM_CHANGED,this._setDirtyByMode,this),t.on(um.SIZE_CHANGED,this._setDirtyByMode,this),t.on(um.ANCHOR_CHANGED,this._setDirtyByMode,this))},i._unregisterTargetEvents=function(){var t=this._target||this.node.parent;t&&(t.off(um.TRANSFORM_CHANGED,this._setDirtyByMode,this),t.off(um.SIZE_CHANGED,this._setDirtyByMode,this),t.off(um.ANCHOR_CHANGED,this._setDirtyByMode,this))},i._unregisterOldParentEvents=function(t){var e=this._target||t;e&&(e.off(um.TRANSFORM_CHANGED,this._setDirtyByMode,this),e.off(um.SIZE_CHANGED,this._setDirtyByMode,this))},i._setDirtyByMode=function(){this.alignMode===mbt.ALWAYS&&this._recursiveDirty()},i._setAlign=function(t,e){if(e!==(this._alignFlags&t)>0){var i=(t&Bbt)>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&gbt.TOP)>0},set:function(t){this._setAlign(gbt.TOP,t),this._recursiveDirty()}},{key:"isAlignBottom",get:function(){return(this._alignFlags&gbt.BOT)>0},set:function(t){this._setAlign(gbt.BOT,t),this._recursiveDirty()}},{key:"isAlignLeft",get:function(){return(this._alignFlags&gbt.LEFT)>0},set:function(t){this._setAlign(gbt.LEFT,t),this._recursiveDirty()}},{key:"isAlignRight",get:function(){return(this._alignFlags&gbt.RIGHT)>0},set:function(t){this._setAlign(gbt.RIGHT,t),this._recursiveDirty()}},{key:"isAlignVerticalCenter",get:function(){return(this._alignFlags&gbt.MID)>0},set:function(t){t?(this.isAlignTop=!1,this.isAlignBottom=!1,this._alignFlags|=gbt.MID):this._alignFlags&=~gbt.MID,this._recursiveDirty()}},{key:"isAlignHorizontalCenter",get:function(){return(this._alignFlags&gbt.CENTER)>0},set:function(t){t?(this.isAlignLeft=!1,this.isAlignRight=!1,this._alignFlags|=gbt.CENTER):this._alignFlags&=~gbt.CENTER,this._recursiveDirty()}},{key:"isStretchWidth",get:function(){return(this._alignFlags&Bbt)===Bbt}},{key:"isStretchHeight",get:function(){return(this._alignFlags&Pbt)===Pbt}},{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(gbt.TOP,this._isAbsTop))}},{key:"isAbsoluteBottom",get:function(){return this._isAbsBottom},set:function(t){this._isAbsBottom!==t&&(this._isAbsBottom=t,this._autoChangedValue(gbt.BOT,this._isAbsBottom))}},{key:"isAbsoluteLeft",get:function(){return this._isAbsLeft},set:function(t){this._isAbsLeft!==t&&(this._isAbsLeft=t,this._autoChangedValue(gbt.LEFT,this._isAbsLeft))}},{key:"isAbsoluteRight",get:function(){return this._isAbsRight},set:function(t){this._isAbsRight!==t&&(this._isAbsRight=t,this._autoChangedValue(gbt.RIGHT,this._isAbsRight))}},{key:"isAbsoluteHorizontalCenter",get:function(){return this._isAbsHorizontalCenter},set:function(t){this._isAbsHorizontalCenter!==t&&(this._isAbsHorizontalCenter=t,this._autoChangedValue(gbt.CENTER,this._isAbsHorizontalCenter))}},{key:"isAbsoluteVerticalCenter",get:function(){return this._isAbsVerticalCenter},set:function(t){this._isAbsVerticalCenter!==t&&(this._isAbsVerticalCenter=t,this._autoChangedValue(gbt.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}(op)).AlignMode=mbt,f((qRt=fbt).prototype,"target",[jRt],Object.getOwnPropertyDescriptor(qRt.prototype,"target"),qRt.prototype),f(qRt.prototype,"alignMode",[YRt],Object.getOwnPropertyDescriptor(qRt.prototype,"alignMode"),qRt.prototype),QRt=Gs(qRt.prototype,"_alignFlags",[ra],(function(){return 0})),ZRt=Gs(qRt.prototype,"_target",[ra],(function(){return null})),JRt=Gs(qRt.prototype,"_left",[ra],(function(){return 0})),$Rt=Gs(qRt.prototype,"_right",[ra],(function(){return 0})),tbt=Gs(qRt.prototype,"_top",[ra],(function(){return 0})),ebt=Gs(qRt.prototype,"_bottom",[ra],(function(){return 0})),ibt=Gs(qRt.prototype,"_horizontalCenter",[ra],(function(){return 0})),nbt=Gs(qRt.prototype,"_verticalCenter",[ra],(function(){return 0})),rbt=Gs(qRt.prototype,"_isAbsLeft",[ra],(function(){return!0})),sbt=Gs(qRt.prototype,"_isAbsRight",[ra],(function(){return!0})),abt=Gs(qRt.prototype,"_isAbsTop",[ra],(function(){return!0})),obt=Gs(qRt.prototype,"_isAbsBottom",[ra],(function(){return!0})),hbt=Gs(qRt.prototype,"_isAbsHorizontalCenter",[ra],(function(){return!0})),ubt=Gs(qRt.prototype,"_isAbsVerticalCenter",[ra],(function(){return!0})),lbt=Gs(qRt.prototype,"_originalWidth",[ra],(function(){return 0})),cbt=Gs(qRt.prototype,"_originalHeight",[ra],(function(){return 0})),_bt=Gs(qRt.prototype,"_alignMode",[ra],(function(){return mbt.ON_WINDOW_RESIZE})),dbt=Gs(qRt.prototype,"_lockFlags",[ra,aa],(function(){return 0})),KRt=qRt))||KRt)||KRt)||KRt));v.internal.computeInverseTransForTarget=Tbt,v.internal.getReadonlyNodeSize=ybt,v.Widget=Nbt;var Lbt,Fbt=new pn;!function(t){t[t.HORIZONTAL=0]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(Lbt||(Lbt={})),Se(Lbt);var kbt,Ubt,Gbt,Hbt,zbt,Vbt,Wbt,Xbt,jbt,Ybt,Kbt,qbt,Qbt,Zbt,Jbt,$bt,tCt,eCt,iCt,nCt,rCt,sCt,aCt,oCt,hCt=t("fV",(Sbt=qs("cc.PageViewIndicator"),Ebt=Zs(110),Abt=xa(yF),Rbt=xa(Lbt),bbt=xa(Hn),Sbt(Cbt=Ebt(((Mbt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).spacing=xbt&&xbt(),e._spriteFrame=Ibt&&Ibt(),e._direction=Obt&&Obt(),e._cellSize=Dbt&&Dbt(),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(rAt),this._layout||(this._layout=this.addComponent(rAt));var t=this._layout;this.direction===Lbt.HORIZONTAL?(t.type=rAt.Type.HORIZONTAL,t.spacingX=this.spacing):this.direction===Lbt.VERTICAL&&(t.type=rAt.Type.VERTICAL,t.spacingY=this.spacing),t.resizeMode=rAt.ResizeMode.CONTAINER},i._createIndicator=function(){var t=new $m;t.layer=this.node.layer;var e=t.addComponent(dz);return e.spriteFrame=this.spriteFrame,e.sizeMode=dz.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;Fbt.set(r.color),Fbt.a=127.5,r.color=Fbt}}if(t[e]._uiProps.uiComp){var s=t[e]._uiProps.uiComp;Fbt.set(s.color),Fbt.a=255,s.color=Fbt}}}},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}(op)).Direction=Lbt,f((wbt=Mbt).prototype,"spriteFrame",[Abt],Object.getOwnPropertyDescriptor(wbt.prototype,"spriteFrame"),wbt.prototype),f(wbt.prototype,"direction",[Rbt],Object.getOwnPropertyDescriptor(wbt.prototype,"direction"),wbt.prototype),f(wbt.prototype,"cellSize",[bbt],Object.getOwnPropertyDescriptor(wbt.prototype,"cellSize"),wbt.prototype),xbt=Gs(wbt.prototype,"spacing",[ra],(function(){return 0})),Ibt=Gs(wbt.prototype,"_spriteFrame",[ra],(function(){return null})),Obt=Gs(wbt.prototype,"_direction",[ra],(function(){return Lbt.HORIZONTAL})),Dbt=Gs(wbt.prototype,"_cellSize",[ra],(function(){return new Hn(20,20)})),Cbt=wbt))||Cbt)||Cbt));v.PageViewIndicator=hCt;var uCt,lCt,cCt,_Ct=new Fn;!function(t){t[t.Unified=0]="Unified",t[t.Free=1]="Free"}(uCt||(uCt={})),Se(uCt),function(t){t[t.Horizontal=0]="Horizontal",t[t.Vertical=1]="Vertical"}(lCt||(lCt={})),Se(lCt),function(t){t.PAGE_TURNING="page-turning"}(cCt||(cCt={}));var dCt=t("fU",(kbt=qs("cc.PageView"),Ubt=Zs(110),Gbt=xa(uCt),Hbt=xa(lCt),zbt=xa(hCt),Vbt=xa(wAt),Wbt=xa(wAt),Xbt=xa([rp]),jbt=xa([rp]),kbt(Ybt=Ubt(((oCt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).autoPageTurningThreshold=qbt&&qbt(),e.horizontal=Qbt&&Qbt(),e.vertical=Zbt&&Zbt(),e.cancelInnerEvents=Jbt&&Jbt(),e.scrollEvents=$bt&&$bt(),e.pageTurningSpeed=tCt&&tCt(),e.pageEvents=eCt&&eCt(),e._sizeMode=iCt&&iCt(),e._direction=nCt&&nCt(),e._scrollThreshold=rCt&&rCt(),e._pageTurningEventTiming=sCt&&sCt(),e._indicator=aCt&&aCt(),e._curPageIdx=0,e._lastPageIdx=0,e._pages=[],e._initContentPos=new hn,e._scrollCenterOffsetX=[],e._scrollCenterOffsetY=[],e._touchBeganPosition=new Fn,e._touchEndPosition=new Fn,e}s(e,t);var i=e.prototype;return i.onEnable=function(){t.prototype.onEnable.call(this),this.node.on(um.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(um.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()):Y(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 Y(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(rAt);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===lCt.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===uCt.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(_Ct),Fn.set(this._touchBeganPosition,_Ct.x,_Ct.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(_Ct),Fn.set(this._touchEndPosition,_Ct.x,_Ct.y),t.prototype._onTouchEnded.call(this,e,i)},i._onTouchCancelled=function(e,i){e.touch.getUILocation(_Ct),Fn.set(this._touchEndPosition,_Ct.x,_Ct.y),t.prototype._onTouchCancelled.call(this,e,i)},i._onMouseWheel=function(){},i._syncScrollDirection=function(){this.horizontal=this.direction===lCt.Horizontal,this.vertical=this.direction===lCt.Vertical},i._syncSizeMode=function(){var t=this.view;if(this.content&&t){var e=this.content.getComponent(rAt);if(e){if(this._sizeMode===uCt.Free&&this._pages.length>0){var i=this._pages[0]._uiProps.uiTransformComp,n=this._pages[this._pages.length-1]._uiProps.uiTransformComp;this.direction===lCt.Horizontal?(e.paddingLeft=(t.width-i.width)/2,e.paddingRight=(t.width-n.width)/2):this.direction===lCt.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,cCt.PAGE_TURNING),this.node.emit(cCt.PAGE_TURNING,this))},i._isQuicklyScrollable=function(t){if(this.direction===lCt.Horizontal){if(Math.abs(t.x)>this.autoPageTurningThreshold)return!0}else if(this.direction===lCt.Vertical&&Math.abs(t.y)>this.autoPageTurningThreshold)return!0;return!1},i._moveOffsetValue=function(t){var e=new Fn;if(this._sizeMode===uCt.Free)this.direction===lCt.Horizontal?e.x=this._scrollCenterOffsetX[t]:this.direction===lCt.Vertical&&(e.y=this._scrollCenterOffsetY[t]);else{var i=this.view;if(!i)return e;this.direction===lCt.Horizontal?e.x=t*i.width:this.direction===lCt.Vertical&&(e.y=t*i.height)}return e},i._getDragDirection=function(t){return this._direction===lCt.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===uCt.Free){var n=0,r=0;if(this.direction===lCt.Horizontal)return n=this._scrollCenterOffsetX[e],r=this._scrollCenterOffsetX[i],Math.abs(t.x)>=Math.abs(n-r)*this.scrollThreshold;if(this.direction===lCt.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===lCt.Horizontal)return Math.abs(t.x)>=s.width*this.scrollThreshold;if(this.direction===lCt.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 Fn;Fn.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}(vRt)).SizeMode=uCt,oCt.Direction=lCt,oCt.EventType=BRt(cCt,QAt),f((Kbt=oCt).prototype,"sizeMode",[Gbt],Object.getOwnPropertyDescriptor(Kbt.prototype,"sizeMode"),Kbt.prototype),f(Kbt.prototype,"direction",[Hbt],Object.getOwnPropertyDescriptor(Kbt.prototype,"direction"),Kbt.prototype),f(Kbt.prototype,"indicator",[zbt],Object.getOwnPropertyDescriptor(Kbt.prototype,"indicator"),Kbt.prototype),qbt=Gs(Kbt.prototype,"autoPageTurningThreshold",[ra],(function(){return 100})),f(Kbt.prototype,"verticalScrollBar",[Vbt,Ia],Object.getOwnPropertyDescriptor(Kbt.prototype,"verticalScrollBar"),Kbt.prototype),f(Kbt.prototype,"horizontalScrollBar",[Wbt,Ia],Object.getOwnPropertyDescriptor(Kbt.prototype,"horizontalScrollBar"),Kbt.prototype),Qbt=Gs(Kbt.prototype,"horizontal",[Ia,ra],(function(){return!0})),Zbt=Gs(Kbt.prototype,"vertical",[Ia,ra],(function(){return!0})),Jbt=Gs(Kbt.prototype,"cancelInnerEvents",[Ia,ra],(function(){return!0})),$bt=Gs(Kbt.prototype,"scrollEvents",[Xbt,ra,Ia],(function(){return[]})),tCt=Gs(Kbt.prototype,"pageTurningSpeed",[ra],(function(){return.3})),eCt=Gs(Kbt.prototype,"pageEvents",[jbt,ra],(function(){return[]})),iCt=Gs(Kbt.prototype,"_sizeMode",[ra],(function(){return uCt.Unified})),nCt=Gs(Kbt.prototype,"_direction",[ra],(function(){return lCt.Horizontal})),rCt=Gs(Kbt.prototype,"_scrollThreshold",[ra],(function(){return.5})),sCt=Gs(Kbt.prototype,"_pageTurningEventTiming",[ra],(function(){return.1})),aCt=Gs(Kbt.prototype,"_indicator",[ra],(function(){return null})),Ybt=Kbt))||Ybt)||Ybt));v.PageView=dCt;var fCt=new hn,pCt=new Fn,mCt=new Fn,gCt=new Fn(1,1),vCt=new Fn,yCt=new Fn;function TCt(t,e){if(!e._hadAlignOnce){e.alignMode===mbt.ONCE&&(e._hadAlignOnce=!0);var i,n=e.target,r=mCt,s=gCt;n?Tbt(t,i=n,r,s):i=t.parent;var a=ybt(i),o=i instanceof AC||!i.getComponent(oU),h=o?pCt:i.getComponent(oU).anchorPoint,u=o;t.getPosition(fCt);var l=t._uiProps.uiTransformComp,c=fCt.x,_=fCt.y,d=l.anchorPoint,f=t.getScale();if(e.alignFlags&gbt.HORIZONTAL){var p=0,m=0,g=a.width;u?(p=Dl.left.x,m=Dl.right.x):m=(p=-h.x*g)+g,p+=e.isAbsoluteLeft?e.left:e.left*g,m-=e.isAbsoluteRight?e.right:e.right*g,n&&(p+=r.x,p*=s.x,m+=r.x,m*=s.x);var v=0,y=d.x,T=f.x;if(T<0&&(y=1-y,T=-T),e.isStretchWidth)v=m-p,0!==T&&(l.width=v/T),c=p+y*v;else{if(v=l.width*T,e.isAlignHorizontalCenter){var S=e.isAbsoluteHorizontalCenter?e.horizontalCenter:e.horizontalCenter*g,E=(.5-h.x)*a.width;n&&(S*=s.x,E+=r.x,E*=s.x),c=E+(y-.5)*v+S}else c=e.isAlignLeft?p+y*v:m+(y-1)*v;xi(T,0,Ci)?v=l.width:v/=T}e._lastSize.width=v}if(e.alignFlags&gbt.VERTICAL){var A=0,R=0,b=a.height;u?(R=Dl.bottom.y,A=Dl.top.y):A=(R=-h.y*b)+b,R+=e.isAbsoluteBottom?e.bottom:e.bottom*b,A-=e.isAbsoluteTop?e.top:e.top*b,n&&(R+=r.y,R*=s.y,A+=r.y,A*=s.y);var C=0,w=d.y,x=f.y;if(x<0&&(w=1-w,x=-x),e.isStretchHeight)C=A-R,0!==x&&(l.height=C/x),_=R+w*C;else{if(C=l.height*x,e.isAlignVerticalCenter){var I=e.isAbsoluteVerticalCenter?e.verticalCenter:e.verticalCenter*b,O=(.5-h.y)*a.height;n&&(I*=s.y,O+=r.y,O*=s.y),_=O+(w-.5)*C+I}else _=e.isAlignBottom?R+w*C:A+(w-1)*C;xi(x,0,Ci)?C=l.height:C/=x}e._lastSize.height=C}t.setPosition(c,_,fCt.z),hn.set(e._lastPos,c,_,fCt.z)}}function SCt(t){var e=t.getComponent(Nbt);if(e&&e.enabled){if(!v.isValid(t,!0))return;RCt.push(e)}for(var i,n=d(t.children);!(i=n()).done;){var r=i.value;r.active&&SCt(r)}}function ECt(){var t=gL.getScene();if(t){bCt.isAligning=!0,bCt._nodesOrderDirty&&(RCt.length=0,SCt(t),bCt._nodesOrderDirty=!1);var e=null,i=bCt._activeWidgetsIterator;for(i.i=0;i.i<RCt.length;++i.i)(e=RCt[i.i])._dirty&&(TCt(e.node,e),e._dirty=!1);bCt.isAligning=!1}}var ACt,RCt=[],bCt=t("f_",v._widgetManager={isAligning:!1,_nodesOrderDirty:!1,_activeWidgetsIterator:new ae(RCt),animationState:null,init:function(){gL.on(mL.EVENT_AFTER_SCENE_LAUNCH,ECt),gL.on(mL.EVENT_AFTER_UPDATE,ECt),RV.instance.on("design-resolution-changed",this.onResized,this);var t=this.onResized.bind(this);RV.instance.on("canvas-resize",t),wl.on("window-resize",t)},add:function(){this._nodesOrderDirty=!0},remove:function(t){this._activeWidgetsIterator.remove(t)},onResized:function(){var t=gL.getScene();t&&this.refreshWidgetOnResized(t)},refreshWidgetOnResized:function(t){var e=$m.isNode(t)&&t.getComponent(Nbt);e&&e.enabled&&(e.alignMode===mbt.ON_WINDOW_RESIZE||e.alignMode===mbt.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=vCt;s.set(0,0);var a=yCt;if(a.set(1,1),t.target&&Tbt(n,r=t.target,s,a),!e)return;var o=r._uiProps&&r._uiProps.uiTransformComp,h=o?o.anchorPoint:pCt,u=n._uiProps.uiTransformComp,l=ybt(r),c=u.anchorPoint,_=n.getPosition(),d=gbt,f=n.getScale(),p=0;if(e&d.LEFT){var m=-h.x*l.width;m+=s.x,m*=a.x,p=_.x-c.x*u.width*Math.abs(f.x)-m,t.isAbsoluteLeft||(p/=l.width),p/=a.x,t.left=i(t.left,p)}if(e&d.RIGHT){var g=(1-h.x)*l.width;g+=s.x,p=(g*=a.x)-(_.x+(1-c.x)*u.width*Math.abs(f.x)),t.isAbsoluteRight||(p/=l.width),p/=a.x,t.right=i(t.right,p)}if(e&d.TOP){var v=(1-h.y)*l.height;v+=s.y,p=(v*=a.y)-(_.y+(1-c.y)*u.height*Math.abs(f.y)),t.isAbsoluteTop||(p/=l.height),p/=a.y,t.top=i(t.top,p)}if(e&d.BOT){var y=-h.y*l.height;y+=s.y,y*=a.y,p=_.y-c.y*u.height*Math.abs(f.y)-y,t.isAbsoluteBottom||(p/=l.height),p/=a.y,t.bottom=i(t.bottom,p)}}},updateAlignment:function t(e){var i=e.parent;i&&$m.isNode(i)&&t(i);var n=e.getComponent(Nbt);n&&i&&TCt(e,n)},AlignMode:mbt,AlignFlags:gbt});gL.on(mL.EVENT_INIT,(function(){bCt.init()}));var CCt,wCt,xCt,ICt,OCt,DCt,MCt,PCt,BCt,NCt,LCt,FCt,kCt=t("fW",qs("cc.SafeArea")(ACt=Zs(110)(ACt=Qs(Nbt)(ACt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.onEnable=function(){this.updateArea(),wl.on("window-resize",this.updateArea,this),wl.on("orientation-change",this.updateArea,this)},i.onDisable=function(){wl.off("window-resize",this.updateArea,this),wl.off("orientation-change",this.updateArea,this)},i.updateArea=function(){var t=this.node.getComponent(Nbt),e=this.node.getComponent(oU);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=IV.getVisibleSize(),s=r.width,a=r.height,o=Ol.getSafeAreaRect();t.top=a-o.y-o.height,t.bottom=o.y,t.left=o.x,t.right=s-o.x-o.width,t.updateAlignment();var h=this.node.position.clone(),u=n.x-(h.x-i.x)/e.width,l=n.y-(h.y-i.y)/e.height;e.setAnchorPoint(u,l),bCt.add(t)}},e}(op))||ACt)||ACt)||ACt);v.SafeArea=kCt;var UCt,GCt=t("fX",(CCt=qs("cc.UICoordinateTracker"),wCt=Zs(110),xCt=xa($m),ICt=xa(SV),OCt=xa([rp]),CCt(DCt=wCt((f((MCt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).syncEvents=PCt&&PCt(),e._target=BCt&&BCt(),e._camera=NCt&&NCt(),e._useScale=LCt&&LCt(),e._distance=FCt&&FCt(),e._transformPos=new hn,e._viewPos=new hn,e._canMove=!0,e._lastWPos=new hn,e._lastCameraPos=new hn,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&&hn.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}(op)).prototype,"target",[xCt],Object.getOwnPropertyDescriptor(MCt.prototype,"target"),MCt.prototype),f(MCt.prototype,"camera",[ICt],Object.getOwnPropertyDescriptor(MCt.prototype,"camera"),MCt.prototype),PCt=Gs(MCt.prototype,"syncEvents",[OCt,ra],(function(){return[]})),BCt=Gs(MCt.prototype,"_target",[ra],(function(){return null})),NCt=Gs(MCt.prototype,"_camera",[ra],(function(){return null})),LCt=Gs(MCt.prototype,"_useScale",[ra],(function(){return!0})),FCt=Gs(MCt.prototype,"_distance",[ra],(function(){return 1})),DCt=MCt))||DCt)||DCt)),HCt=[um.TOUCH_START,um.TOUCH_END,um.TOUCH_MOVE,um.MOUSE_DOWN,um.MOUSE_MOVE,um.MOUSE_UP,um.MOUSE_ENTER,um.MOUSE_LEAVE,um.MOUSE_WHEEL];function zCt(t){t.propagationStopped=!0}var VCt,WCt,XCt,jCt,YCt,KCt=t("fY",qs("cc.BlockInputEvents")(UCt=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<HCt.length;t++)this.node.on(HCt[t],zCt,this)},i.onDisable=function(){for(var t=0;t<HCt.length;t++)this.node.off(HCt[t],zCt,this)},e}(op))||UCt),qCt=t("fZ",qs("cc.SubContextView")(VCt=Zs(110)(VCt=Qs(oU)((WCt=function(t){function e(){var e;return(e=t.call(this)||this)._fps=XCt&&XCt(),e._sprite=void 0,e._imageAsset=void 0,e._texture=void 0,e._updatedTime=0,e._updateInterval=0,e._openDataContext=void 0,e._content=void 0,e._designResolutionSize=jCt&&jCt(),e._content=new $m("content"),e._content.hideFlags|=Wa.Flags.DontSave|Wa.Flags.HideInHierarchy,e._sprite=null,e._imageAsset=new Df,e._openDataContext=null,e._updatedTime=performance.now(),e._texture=new em,e}s(e,t);var i=e.prototype;return i.onLoad=function(){Od.getOpenDataContext?(this._updateInterval=1e3/this._fps,this._openDataContext=Od.getOpenDataContext(),this._initSharedCanvas(),this._initContentNode(),this._updateSubContextView(),this._updateContentLayer()):this.enabled=!1},i.onEnable=function(){this._registerNodeEvent()},i.onDisable=function(){this._unregisterNodeEvent()},i._initSharedCanvas=function(){if(this._openDataContext){var t=this._openDataContext.canvas,e=this._designResolutionSize.width,i=this._designResolutionSize.height;t.width=e,t.height=i}},i._initContentNode=function(){if(this._openDataContext){var t=this._openDataContext.canvas,e=this._imageAsset;if(e.reset(t),this._texture.image=e,this._texture.create(t.width,t.height),this._sprite=this._content.getComponent(dz),this._sprite||(this._sprite=this._content.addComponent(dz)),this._sprite.spriteFrame)this._sprite.spriteFrame.texture=this._texture;else{var i=new yF;i.texture=this._texture,this._sprite.spriteFrame=i}this._content.parent=this.node}},i._updateSubContextView=function(){if(this._openDataContext){var t=this.node.getComponent(oU),e=this._content.getComponent(oU),i=t.width/e.width,n=t.height/e.height,r=i>n?n:i;e.width*=r,e.height*=r;var s=IV.getViewportRect(),a=e.getBoundingBoxToWorld(),o=IV.getVisibleSize(),h=wl.devicePixelRatio,u=(s.width*(a.x/o.width)+s.x)/h,l=(s.height*(a.y/o.height)+s.y)/h,c=s.width*(a.width/o.width)/h,_=s.height*(a.height/o.height)/h;this._openDataContext.postMessage({fromEngine:!0,type:"engine",event:"viewport",x:u,y:l,width:c,height:_})}},i._updateSubContextTexture=function(){var t=this._imageAsset;if(t&&this._openDataContext&&!(t.width<=0||t.height<=0)){var e=this._openDataContext.canvas;t.reset(e),(e.width>t.width||e.height>t.height)&&this._texture.create(e.width,e.height),this._texture.uploadData(e)}},i._registerNodeEvent=function(){this.node.on(um.TRANSFORM_CHANGED,this._updateSubContextView,this),this.node.on(um.SIZE_CHANGED,this._updateSubContextView,this),this.node.on(um.LAYER_CHANGED,this._updateContentLayer,this)},i._unregisterNodeEvent=function(){this.node.off(um.TRANSFORM_CHANGED,this._updateSubContextView,this),this.node.off(um.SIZE_CHANGED,this._updateSubContextView,this),this.node.off(um.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}(op),XCt=Gs(WCt.prototype,"_fps",[ra],(function(){return 60})),jCt=Gs(WCt.prototype,"_designResolutionSize",[ra],(function(){return new Hn(640,960)})),VCt=WCt))||VCt)||VCt)||VCt);v.SubContextView=qCt,mt({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 QCt=t("g2",qs("cc.UIReorderComponent")(YCt=function(){q(1408,"UIReorderComponent")})||YCt);v.UIReorderComponent=QCt,v.ButtonComponent=ySt,Jt(ySt,"cc.ButtonComponent"),v.EditBoxComponent=zEt,Jt(zEt,"cc.EditBoxComponent"),v.LayoutComponent=rAt,Jt(rAt,"cc.LayoutComponent"),v.ProgressBarComponent=vAt,Jt(vAt,"cc.ProgressBarComponent"),v.ScrollViewComponent=vRt,Jt(vRt,"cc.ScrollViewComponent"),v.ScrollBarComponent=wAt,Jt(wAt,"cc.ScrollBarComponent"),v.SliderComponent=PRt,Jt(PRt,"cc.SliderComponent"),v.ToggleComponent=zRt,Jt(zRt,"cc.ToggleComponent"),v.ToggleContainerComponent=pbt,Jt(pbt,"cc.ToggleContainerComponent"),v.WidgetComponent=Nbt,Jt(Nbt,"cc.WidgetComponent"),v.PageViewComponent=dCt,Jt(dCt,"cc.PageViewComponent"),v.PageViewIndicatorComponent=hCt,Jt(hCt,"cc.PageViewIndicatorComponent"),v.SafeAreaComponent=kCt,Jt(kCt,"cc.SafeAreaComponent"),Jt(GCt,"cc.UICoordinateTrackerComponent"),v.BlockInputEventsComponent=KCt,Jt(KCt,"cc.BlockInputEventsComponent"),st(RV.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"}]),at(RV.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"}])}}}));