123 |
- 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,d(n.key),n)}}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 f(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(i)return(i=i.call(t)).next.bind(i);if(Array.isArray(t)||(i=function(t,e){if(t){if("string"==typeof t)return _(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?_(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function d(t){var e=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)}(t,"string");return"symbol"==typeof e?e:String(e)}function p(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 m(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:UL,K:zL,N:HL,P:function(t){return VL.test(t)},W:function(t){return GL.test(t)},X:XL,Y:jL,Z:YL,_:f,a$:Li,aB:mn,aE:Tn,aG:bn,aI:$i,aN:Ti,aO:Ei,aP:bi,aQ:xi,aR:Ci,aS:Ri,aT:wi,aV:Bi,aW:Di,aX:Pi,aY:Oi,aZ:Mi,a_:Ni,aa:kq,ab:Gq,ad:function(t,e){for(var i=t,n="";null!==i&&i!==e;)n=i.name+"/"+n,i=i.parent;return n.slice(0,-1)},ae:function(t,e,i){for(fn.identity(i);t!==e;)fn.fromRTS(TQ,t.rotation,t.position,t.scale),fn.multiply(i,TQ,i),t=t.parent;return i},as:vn,au:qi,aw:Hi,ay:cn,b0:Fi,b1:ki,b2:Gi,b3:Vi,b4:Ui,bD:function(t){return t[Fs]},bG:Bu,bI:U,bJ:F,bK:G,bL:k,bM:V,bN:j,bO:J,bP:q,bQ:$,bR:et,bS:it,bT:tt,ba:de,bb:me,bc:ve,bh:function(t){t>0&&(ut=t)},bl:dt,bm:function(t){for(var e,i=f(t);!(e=i()).done;)pt(e.value)},bn:function(t){return _t||(_t="undefined"==typeof Proxy?{}:new Proxy(t,{get:function(t,e,i){return pt(e),Reflect.get(t,e,i)}})),_t},bo:tl,bp:el,bs:fi,bt:di,cB: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))}))}))},cC:z,cD:function(t,e){return ds(t,e,0)},cE:ds,cF: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},cG:function(){},cH:function(){},cI:pe,cJ:vl,cL:XO,cc:fl,cd:ih,ce:vh,cq:Gs,cs:function(t,e,i){if(pe(t,e),pe(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},cx:xa,cy:Ca,dH:mp,dJ:MZ,dc:fM,fh:Nut,fi:Lut}),m("CC_WECHAT",!1),m("CC_BAIDU",!1),m("CC_XIAOMI",!1),m("CC_ALIPAY",!1),m("CC_BYTEDANCE",!1),m("CC_OPPO",!1),m("CC_VIVO",!1),m("CC_HUAWEI",!1),m("CC_COCOSPLAY",!1),m("CC_QTT",!1),m("CC_LINKSURE",!1);const g=!1;m("CC_EDITOR",!1);m("CC_PREVIEW",!1),m("CC_BUILD",!0),m("CC_TEST",!1),m("CC_DEBUG",!1),m("CC_DEV",!1),m("CC_MINIGAME",!1),m("CC_RUNTIME_BASED",!1),m("CC_SUPPORT_JIT",!0),m("CC_JSB",!1);var y="undefined"==typeof window?global:window,v=t("ap",{_global:y});v.internal={};var S=t("ao","3.8.0");y.CocosEngine=v.ENGINE_VERSION=S,y.cc=v;var A=void 0!==globalThis.jsb&&void 0!==jsb.window?jsb.window:globalThis;function T(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 E(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 x(t){return--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,1+(t|=t>>>16)}y.ccwindow=A;var C=new Array(256);!function(t){for(var e=0;e<256;++e){var i=e,n=e,r=7;for(i>>>=1;i;i>>>=1)n<<=1,n|=1&i,--r;t[e]=n<<r&255}}(C);var R=Object.freeze({__proto__:null,INT_BITS:32,INT_MAX:2147483647,INT_MIN:-2147483648,sign:function(t){return(t>0)-(t<0)},abs:function(t){var e=t>>31;return(t^e)-e},min:function(t,e){return e^(t^e)&-(t<e)},max:function(t,e){return t^(t^e)&-(t<e)},isPow2:function(t){return!(t&t-1||!t)},log2:T,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:E,countTrailingZeros:b,nextPow2:x,prevPow2:function(t){return t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)-(t>>>1)},parity:function(t){return t^=t>>>16,t^=t>>>8,t^=t>>>4,27030>>>(t&=15)&1},reverse:function(t){return C[255&t]<<24|C[t>>>8&255]<<16|C[t>>>16&255]<<8|C[t>>>24&255]},interleave2:function(t,e){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t&=65535)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e&=65535)|e<<8))|e<<4))|e<<2))|e<<1))<<1},deinterleave2:function(t,e){return(t=65535&((t=16711935&((t=252645135&((t=858993459&((t=t>>>e&1431655765)|t>>>1))|t>>>2))|t>>>4))|t>>>16))<<16>>16},interleave3:function(t,e,i){return t=1227133513&((t=3272356035&((t=251719695&((t=4278190335&((t&=1023)|t<<16))|t<<8))|t<<4))|t<<2),(t|=(e=1227133513&((e=3272356035&((e=251719695&((e=4278190335&((e&=1023)|e<<16))|e<<8))|e<<4))|e<<2))<<1)|(i=1227133513&((i=3272356035&((i=251719695&((i=4278190335&((i&=1023)|i<<16))|i<<8))|i<<4))|i<<2))<<2},deinterleave3:function(t,e){return(t=1023&((t=4278190335&((t=251719695&((t=3272356035&((t=t>>>e&1227133513)|t>>>2))|t>>>4))|t>>>8))|t>>>16))<<22>>22},nextCombination:function(t){var e=t|t-1;return e+1|(~e&-~e)-1>>>b(t)+1}});t("aq",R);var w=A.document,I="https://github.com/cocos-creator/engine/blob/develop/EngineErrorMap.md",B=null,D=console.log.bind(console),P=D,O=D,M=function(t,e){if(!t){for(var i=arguments.length,n=new Array(i>2?i-2:0),r=2;r<i;r++)n[r-2]=arguments[r];console.log("ASSERT: "+L.apply(void 0,[e].concat(n)))}},N=D;function L(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 v.js.formatStr.apply(null,[t].concat(i))}function F(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];return D.apply(void 0,[t].concat(i))}function k(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];return P.apply(void 0,[t].concat(i))}function G(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];return O.apply(void 0,[t].concat(i))}function V(t,e){for(var i=arguments.length,n=new Array(i>2?i-2:0),r=2;r<i;r++)n[r-2]=arguments[r];return M.apply(void 0,[t,e].concat(n))}function U(){return N.apply(void 0,arguments)}function z(t){if(D=P=O=M=N=function(){},t!==Q.NONE){if(t>Q.ERROR){var e=function(t){if(v.game.canvas){if(!B){var e=w.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",(B=w.createElement("textarea")).setAttribute("rows","20"),B.setAttribute("cols","30"),B.setAttribute("disabled","true");var n=B.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(B),v.game.canvas.parentNode.appendChild(e)}B.value=B.value+t+"\r\n",B.scrollTop=B.scrollHeight}};O=function(t){for(var i=arguments.length,n=new Array(i>1?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];e("ERROR : "+L.apply(void 0,[t].concat(n)))},M=function(t,i){if(!t){for(var n=arguments.length,r=new Array(n>2?n-2:0),s=2;s<n;s++)r[s-2]=arguments[s];e("ASSERT: "+L.apply(void 0,[i].concat(r)))}},t!==Q.ERROR_FOR_WEB_PAGE&&(P=function(t){for(var i=arguments.length,n=new Array(i>1?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];e("WARN : "+L.apply(void 0,[t].concat(n)))}),t===Q.INFO_FOR_WEB_PAGE&&(D=function(t){for(var i=arguments.length,n=new Array(i>1?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];e(L.apply(void 0,[t].concat(n)))})}else console&&(console.error||(console.error=console.log),console.warn||(console.warn=console.log),O=console.error.bind?console.error.bind(console):function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];return console.error.apply(console,[t].concat(i))},M=function(t,e){if(!t){for(var i=arguments.length,n=new Array(i>2?i-2:0),r=2;r<i;r++)n[r-2]=arguments[r];var s=L.apply(void 0,[e].concat(n));throw new Error(s)}});if(t!==Q.ERROR&&(P=console.warn.bind?console.warn.bind(console):function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];return console.warn.apply(console,[t].concat(i))}),t<=Q.INFO&&(D=console.log.bind?console.log.bind(console):function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];return console.log.apply(console,[t].concat(i))}),t<=Q.VERBOSE&&"function"==typeof console.debug){var i=console.debug.bind(console);N=function(){return i.apply(void 0,arguments)}}}}function H(t){G(t.stack||t)}function W(t){return function(e){for(var i=t+" "+e+", please go to "+I+"#"+e+" to see details.",n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return 0===r.length?i:i+" Arguments: "+r.join(", ")}}var X=W("Log");function j(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];F(X.apply(void 0,[t].concat(i)))}var Y=W("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];k(Y.apply(void 0,[t].concat(i)))}var K=W("Error");function J(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];G(K.apply(void 0,[t].concat(i)))}var Q,Z=W("Assert");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];V(!1,Z.apply(void 0,[e].concat(n)))}}function tt(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 K.apply(void 0,[t].concat(i))}function et(){return!!v.profiler&&v.profiler.isShowingStats()}function it(t){v.profiler&&(t?v.profiler.showStats():v.profiler.hideStats())}t("bU",Q),function(t){t[t.NONE=0]="NONE",t[t.VERBOSE=1]="VERBOSE",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.INFO_FOR_WEB_PAGE=5]="INFO_FOR_WEB_PAGE",t[t.WARN_FOR_WEB_PAGE=6]="WARN_FOR_WEB_PAGE",t[t.ERROR_FOR_WEB_PAGE=7]="ERROR_FOR_WEB_PAGE"}(Q||t("bU",Q={}));var nt,rt,st,at,ot,ht=Object.freeze({__proto__:null,log:F,warn:k,error:G,assert:V,debug:U,_resetDebugSetting:z,_throw:H,logID:j,warnID:q,errorID:J,assertID:$,get DebugMode(){return Q},getError:tt,isDisplayStats:et,setDisplayStats:it}),ut=10;t("bi",nt),t("bj",rt),t("bk",st);var lt=0,ct=new Map;at=function(t,e,i,n,r,s,a){var o=ct.get(s);o&&o.logTimes>o.count&&(r("'%s' is deprecated, please use '%s' instead. "+a,t+"."+e,i+"."+n),o.count++)},t("bi",nt=function(t,e,i){null!=t&&i.forEach((function(i){var n=lt++;ct.set(n,{id:n,count:0,logTimes:void 0!==i.logTimes?i.logTimes:ut});var r=null!=i.target?i.target:t,s=null!=i.newName?i.newName:i.name,a=null!=i.targetName?i.targetName:e,o=r===t,h=i.suggest?"("+i.suggest+")":"";if(null!=i.customFunction)t[i.name]=function(){var t;return at(e,i.name,a,s,k,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 at(e,i.name,a,s,k,n,h),i.customGetter.call(this)},set:function(t){at(e,i.name,a,s,k,n,h),i.customSetter.call(this,t)},enumerable:!1}):u?Object.defineProperty(t,i.name,{set:function(t){at(e,i.name,a,s,k,n,h),i.customSetter.call(this,t)},enumerable:!1}):l&&Object.defineProperty(t,i.name,{get:function(){return at(e,i.name,a,s,k,n,h),i.customGetter.call(this)},enumerable:!1})}else Object.defineProperty(t,i.name,{get:function(){return at(e,i.name,a,s,k,n,h),o?this[s]:r[s]},set:function(t){at(e,i.name,a,s,k,n,h),o?this[s]=t:r[s]=t},enumerable:!1})}))}),ot=function(t,e,i,n,r){var s=ct.get(n);s&&s.logTimes>s.count&&(i("'%s' has been removed. "+r,t+"."+e),s.count++)},t("bj",rt=function(t,e,i){null!=t&&i.forEach((function(i){var n=lt++;ct.set(n,{id:n,count:0,logTimes:void 0!==i.logTimes?i.logTimes:ut});var r=i.suggest?"("+i.suggest+")":"";Object.defineProperty(t,i.name,{get:function(){return ot(e,i.name,G,n,r)},set:function(){ot(e,i.name,G,n,r)},enumerable:!1})}))}),t("bk",st=function(){});var _t,ft={};function dt(t){for(var e in t){var i=t[e];ft[e]=i}}function pt(t){var e=ft[t];if(e){var i=e.newName,n=e.since;e.removed?i?J(16003,t,n,i):J(16002,t,n):i?q(16001,t,n,i):q(16e3,t,n)}}var mt=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}();mt.global=new mt("global");var gt=new mt("TmpCId."),yt="undefined"==typeof Symbol?"__aliases__":Symbol("[[Aliases]]"),vt="__cid__";function St(t){return"number"==typeof t||t instanceof Number}function At(t){return"string"==typeof t||t instanceof String}function Tt(t){for(var e in t)return!1;return!0}var Et,bt=(Et={value:void 0,enumerable:!1,writable:!1,configurable:!0},function(t,e,i,n,r){Et.value=i,Et.writable=n,Et.enumerable=r,Object.defineProperty(t,e,Et),Et.value=void 0}),xt=function(){var t={get:void 0,set:void 0,enumerable:!1};return function(e,i,n,r,s,a){void 0===s&&(s=!1),void 0===a&&(a=!1),"boolean"==typeof r&&(console.log("Set `setter` to boolean is deprecated. Please don not use like this again."),s=r,r=void 0),t.get=n,t.set=r,t.enumerable=s,t.configurable=a,Object.defineProperty(e,i,t),t.get=void 0,t.set=void 0}}(),Ct=function(){var t={get:void 0,enumerable:!1,configurable:!1};return function(e,i,n,r,s){t.get=n,t.enumerable=r,t.configurable=s,Object.defineProperty(e,i,t),t.get=void 0}}(),Rt=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 wt(t){var e=Object.create(null);return t&&(e["."]=1,e["/"]=1,delete e["."],delete e["/"]),e}function It(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?It(t.constructor):""}function Bt(t,e,i,n){var r=/([^.]+)$/,s=r.exec(e)[0],a=r.exec(i)[0];function o(){return this[a]}n?xt(t,s,o,(function(t){this[a]=t})):Ct(t,s,o)}function Dt(t,e,i,n){for(var r in i)Bt(t,e+"."+r,i[r],n)}var Pt=/(%d)|(%s)/,Ot=/%s/;function Mt(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];if(0===arguments.length)return"";if(0===i.length)return""+t;var r="string"==typeof t&&Pt.test(t);if(r)for(var s,a=f(i);!(s=a()).done;){var o=s.value,h="number"==typeof o?Pt:Ot;if(h.test(t)){var u=""+o;t=t.replace(h,u)}else t+=" "+o}else for(var l,c=f(i);!(l=c()).done;){var _=l.value;t+=" "+_}return t}function Nt(){for(var t=arguments.length-1,e=new Array(t),i=0;i<t;++i)e[i]=arguments[i+1];return e}function Lt(t,e){for(;t;){var i=Object.getOwnPropertyDescriptor(t,e);if(i)return i;t=Object.getPrototypeOf(t)}return null}function Ft(t,e,i){var n=Lt(e,t);n&&Object.defineProperty(i,t,n)}function kt(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){J(5402,a);continue}for(var o in a)o in t||Ft(o,a,t)}}return t}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){J(5403,a);continue}for(var o in a)Ft(o,a,t)}}return t}function Vt(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 Ut(t){var e=t.prototype,i=e&&Object.getPrototypeOf(e);return i&&i.constructor}function zt(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=Ut(t)))return!1;if(t===e)return!0}}return!1}function Ht(t){for(var e=0,i=Object.keys(t);e<i.length;e++)delete t[i[e]]}var Wt=wt(!0),Xt=wt(!0);function jt(t,e,i){return function(n,r){if(r.prototype.hasOwnProperty(t)&&delete e[r.prototype[t]],bt(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 Yt=jt("__cid__",Wt,!1),qt=jt("__classname__",Xt,!0);function Kt(t,e){if(qt(t,e),!e.prototype.hasOwnProperty(vt)){var i=t||gt.getNewId();i&&Yt(i,e)}}function Jt(t,e){var i=Xt[e],n=Wt[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[yt];s||(s=[],t[yt]=s),s.push(e),Xt[e]=t,Wt[e]=t}}function Qt(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];for(var n=0,r=e;n<r.length;n++){var s=r[n],a=s.prototype,o=a.__cid__;o&&delete Wt[o];var h=a.__classname__;h&&delete Xt[h];var u=a[yt];if(u)for(var l=0;l<u.length;++l){var c=u[l];delete Xt[c],delete Wt[c]}}}function Zt(t){return $t(t)}function $t(t){return Wt[t]}function te(t){return Xt[t]}function ee(t,e){return ie(t,e)}function ie(t,e){if(e=void 0===e||e,"function"==typeof t&&t.prototype.hasOwnProperty(vt))return t.prototype.__cid__;if(t&&t.constructor){var i=t.constructor.prototype;if(i&&i.hasOwnProperty(vt))return t.__cid__}return""}var ne=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}(),re=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 se(t,e){t.splice(e,1)}function ae(t,e){var i=t.length;e<0||e>=i||(t[e]=t[i-1],t.length=i-1)}function oe(t,e){var i=t.indexOf(e);return i>=0&&(se(t,i),!0)}function he(t,e){var i=t.indexOf(e);i>=0&&(t[i]=t[t.length-1],--t.length)}function ue(t,e){var i=t.findIndex(e);if(i>=0){var n=t[i];return se(t,i),n}}function le(t,e){return t.indexOf(e)>=0}var ce=Object.freeze({__proto__:null,removeAt:se,fastRemoveAt:ae,remove:oe,fastRemove:he,removeIf:ue,verifyType:function(t,e){if(t&&t.length>0)for(var i,n=f(t);!(i=n()).done;)if(!(i.value instanceof e))return j(1300),!1;return!0},removeArray:function(t,e){for(var i=0,n=e.length;i<n;i++)oe(t,e[i])},appendObjectsAt:function(t,e,i){return t.splice.apply(t,[i,0].concat(e)),t},contains:le,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:re}),_e={IDGenerator:mt,Pool:ne,array:ce,isNumber:St,isString:At,isEmptyObject:Tt,getPropertyDescriptor:Lt,addon:kt,mixin:Gt,extend:Vt,getSuper:Ut,isChildClassOf:zt,clear:Ht,value:bt,getset:xt,get:Ct,set:Rt,unregisterClass:Qt,getClassName:It,setClassName:Kt,setClassAlias:Jt,getClassByName:te,getClassById:$t,get _registeredClassNames(){return r({},Xt)},set _registeredClassNames(t){Ht(Xt),Object.assign(Xt,t)},get _registeredClassIds(){return r({},Wt)},set _registeredClassIds(t){Ht(Wt),Object.assign(Wt,t)},_getClassId:ee,getClassId:ie,_setClassId:Yt,_getClassById:Zt,obsolete:Bt,obsoletes:Dt,formatStr:Mt,shiftArguments:Nt,createMap:wt};v.js=_e;var fe=Object.freeze({__proto__:null,array:ce,js:_e,IDGenerator:mt,Pool:ne,isNumber:St,isString:At,isEmptyObject:Tt,value:bt,getset:xt,get:Ct,set:Rt,createMap:wt,getClassName:It,obsolete:Bt,obsoletes:Dt,formatStr:Mt,shiftArguments:Nt,getPropertyDescriptor:Lt,copyAllProperties:function(t,e,i){for(var n=Object.getOwnPropertyNames(t),r=0,s=n.length;r<s;++r){var a=n[r];-1===i.indexOf(a)&&Ft(a,t,e)}},addon:kt,mixin:Gt,extend:Vt,getSuper:Ut,isChildClassOf:zt,clear:Ht,_idToClass:Wt,_nameToClass:Xt,_setClassId:Yt,setClassName:Kt,setClassAlias:Jt,unregisterClass:Qt,_getClassById:Zt,getClassById:$t,getClassByName:te,_getClassId:ee,getClassId:ie});function de(t){if("__bitmask__"in t)return t;bt(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&&bt(t,a,r)}return t}function pe(t,e){e>=0&&t.length,t.length}function me(t){return"__enums__"in t?t:(bt(t,"__enums__",null,!0),me.update(t))}function ge(t){t.hasOwnProperty("__enums__")}function ye(t){ge(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 ve(t){"__enums__"in t||bt(t,"__enums__",null,!0)}t("be",fe),de.isBitMask=function(t){return t&&t.hasOwnProperty("__bitmask__")},de.getList=function(t){return t.__bitmask__?t.__bitmask__:de.update(t)},de.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=de,me.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&&bt(t,a,r)}return Array.isArray(t.__enums__)&&ye(t),t},me||t("bb",me={}),me.isEnum=function(t){return t&&t.hasOwnProperty("__enums__")},me.getList=function(t){return ge(t),t.__enums__?t.__enums__:ye(t)},me.sortList=function(t,e){ge(t),Array.isArray(t.__enums__)&&t.__enums__.sort(e)},v.Enum=me;var Se,Ae=t("bd",function(){function t(){}var e=t.prototype;return e.clone=function(){return J(100,It(this)+".clone"),this},e.equals=function(){return!1},e.set=function(){J(100,It(this)+".set")},e.toString=function(){return""},t}());Kt("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"}(Se||(Se={}));var Te=t("c8",function(){function t(){this._settings={},this._override={}}var i=t.prototype;return i.init=function(t,i){var n=this;for(var r in void 0===t&&(t=""),void 0===i&&(i={}),i){var s=i[r];if(s)for(var a in s)this.overrideSettings(r,a,s[a])}return t?window.oh?new Promise((function(t,i){e.import("../settings.js").then((function(e){n._settings=e.default,t()})).catch((function(t){return i(t)}))})):new Promise((function(e,i){var r=new XMLHttpRequest;r.open("GET",t),r.responseType="text",r.onload=function(){n._settings=JSON.parse(r.response),e()},r.onerror=function(){i(new Error("request settings failed!"))},r.send(null)})):Promise.resolve()},i.overrideSettings=function(t,e,i){t in this._override||(this._override[t]={}),this._override[t][e]=i},i.querySettings=function(t,e){if(t in this._override){var i=this._override[t];if(i&&e in i)return i[e]}if(t in this._settings){var n=this._settings[t];if(n&&e in n)return n[e]}return null},t}());Te.Category=Se;var Ee=t("c9",new Te);v.settings=Ee;var be=t("bX",{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=Ee.querySettings(Te.Category.ENGINE,"macros");if(t)for(var e in t)be[e]=t[e]}});v.macro=be;for(var xe=/^(?:cc|dragonBones|sp|ccsg)\..+/,Ce=new Array(123),Re=0;Re<123;++Re)Ce[Re]=64;for(var we=0;we<64;++we)Ce["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charCodeAt(we)]=we;var Ie=Ce;function Be(t,e,i){function n(t,e,i,n){var r=Object.getOwnPropertyDescriptor(t,e);if(r)r.get&&(t[i]=r.get),r.set&&n&&(t[n]=r.set);else{var s=t[i];xt(t,e,s,t[n])}}for(var r,s=t.prototype,a=0;a<e.length;a++){var o=(r=e[a])[0].toUpperCase()+r.slice(1);n(s,r,"get"+o,"set"+o)}for(r in i){var h=i[r];n(s,r,h[0],h[1])}}function De(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 Pe(t,e){if("function"==typeof t.contains)return t.contains(e);if("function"==typeof t.compareDocumentPosition)return!!(16&t.compareDocumentPosition(e));var i=e.parentNode;if(i)do{if(i===t)return!0;i=i.parentNode}while(null!==i);return!1}function Oe(t){return"object"==typeof window&&"function"==typeof Node?t instanceof Node:!!t&&"object"==typeof t&&"number"==typeof t.nodeType&&"string"==typeof t.nodeName}function Me(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 Ne(t){return!(!t||t.constructor!==Object)&&Tt(t)}function Le(t,e,i){if(e>i){var n=e;e=i,i=n}return t<e?e:t<i?t:i}function Fe(t){return t*be.RAD}function ke(t){return t*be.DEG}v.misc={BUILTIN_CLASSID_RE:xe,BASE64_VALUES:Ie,propertyDefine:Be,pushToMap:De,contains:Pe,isDomNode:Oe,callInNextTick:Me,isPlainEmptyObj_DEV:Ne,clampf:Le,degreesToRadians:Fe,radiansToDegrees:ke},t("bf",Object.freeze({__proto__:null,BUILTIN_CLASSID_RE:xe,BASE64_VALUES:Ie,propertyDefine:Be,pushToMap:De,contains:Pe,isDomNode:Oe,callInNextTick:Me,tryCatchFunctor_EDITOR:function(t){return Function("target","try {\n target."+t+"();\n}\ncatch (e) {\n cc._throw(e);\n}")},isPlainEmptyObj_DEV:Ne,clampf:Le,degreesToRadians:Fe,radiansToDegrees:ke}));var Ge="$_$";function Ve(t,e){var i=e?Object.create(e):{};return bt(t,"__attrs__",i),i}function Ue(t){if("function"!=typeof t)return Ve(t,He(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__||Ve(r,(e=i[n+1])&&e.__attrs__)}return Ve(t,(e=i[0])&&e.__attrs__),t.__attrs__}function ze(t,e){var i=He(t),n=e+Ge,r={};for(var s in i)s.startsWith(n)&&(r[s.slice(n.length)]=i[s]);return r}function He(t){return t.hasOwnProperty("__attrs__")&&t.__attrs__||Ue(t)}function We(t,e,i,n){He(t)[e+Ge+i]=n}var Xe=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}(),je=t("bv",new Xe("Integer",0));v.Integer=je,v.CCInteger=je;var Ye=t("bw",new Xe("Float",0));v.Float=Ye,v.CCFloat=Ye;var qe=t("bx",new Xe("Boolean",!1));v.Boolean=qe,v.CCBoolean=qe;var Ke=t("by",new Xe("String",""));function Je(t,e){return function(i,n){var r='"'+It(i)+"."+n+'"',s=ze(i,n),a=s.type;if(a===je||a===Ye?a="Number":a!==Ke&&a!==qe||(a=""+a),a===t){if(s.hasOwnProperty("default")){var o=s.default;if(void 0!==o&&!Array.isArray(o)&&!Ne(o)){var h=typeof o,u=t.toLowerCase();if(h===u)if("object"===u){if(!o||o instanceof s.ctor)return;q(3605,r,It(s.ctor))}else"Number"!==t&&q(3606,e,r,t);else{if("function"===h)return;t===Ke.default&&null==o?q(3607,r):q(3611,e,r,h)}delete s.type}}}else q(3604,r)}}v.String=Ke,v.CCString=Ke;var Qe=Object.freeze({__proto__:null,DELIMETER:Ge,createAttrsSingle:Ve,createAttrs:Ue,attr:ze,getClassAttrs:He,setClassAttr:We,PrimitiveType:Xe,CCInteger:je,CCFloat:Ye,CCBoolean:qe,CCString:Ke,getTypeChecker_ET:Je,getObjTypeChecker_ET:function(t){return function(e,i){Je("Object","type")(e,i);var n=He(e)[i+Ge+"default"],r=v.Class.getDefault(n);if(!Array.isArray(r)&&zt(t,v.ValueType)){var s=It(t),a=Mt('No need to specify the "type" of "%s.%s" because %s is a child class of ValueType.',It(e),i,s);n?F(a):q(3612,a,s,It(e),i,s)}}}}),Ze={default:{},serializable:{},editorOnly:{},formerlySerializedAs:{}};function $e(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,Ze){var o=Ze[a];t.hasOwnProperty(a)&&(s[a]=t[a],o.canUsedInGet||delete t[a])}}}function ti(t,e,i,n){if(Array.isArray(e)){if(!(e.length>0))return J(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 ei(t,e,i){var n=t||void 0===e?{_short:!0}:{_short:!0,default:e};return i&&(n.type=i),n}function ii(t,e){if(!t||t.constructor!==Object){if(Array.isArray(t)&&t.length>0)return ei(e,[],t);if("function"==typeof t){var i=t;return ei(e,zt(i,v.ValueType)?new i:null,i)}return t instanceof Xe?ei(e,void 0,t):ei(e,t)}return null}var ni,ri=[];function si(){return ri[ri.length-1]}v._RF={push:function(t,e,i,n){void 0===i&&(i=e,e=""),ri.push({uuid:e,script:i,module:t,exports:t.exports,beh:null,importMeta:n})},pop:function(){var t=ri.pop(),e=t.module,i=e.exports;if(i===t.exports){for(var n in i)return;e.exports=i=t.cls}},peek:si},function(t){t[t.STANDALONE=1]="STANDALONE",t[t.IMPLICIT_VISIBLE=2]="IMPLICIT_VISIBLE",t[t.IMPLICIT_SERIALIZABLE=4]="IMPLICIT_SERIALIZABLE"}(ni||(ni={}));var ai=Ge,oi="__ctors__",hi=t("cv","Enum"),ui=t("cw","BitMask");function li(t,e,i,n){!function(t,e){!function(t,e){t.indexOf(e)<0&&t.push(e)}(t.__props__,e)}(t,i),mi(t,n,e,i)}function ci(t,e,i,n){var r=n.get;n.set,r&&(mi(t,n,e,i),We(t,i,"serializable",!1))}function _i(t){return"function"==typeof t?t():t}function fi(t){var e=t.name,i=t.extends,n=function(t,e,i){var n=v.Component,r=si();if(r&&zt(e,n)){if(zt(r.cls,n))return J(3615),null;t=t||r.script}var s=function(t,e,i){var n=i.ctor;return bt(n,oi,!0,!0),n.prototype,e&&(n.$super=e),Kt(t,n),n}(t,e,i);if(r)if(zt(e,n)){var a=r.uuid;a&&Yt(a,s),r.cls=s}else zt(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=ii(n,!1);if(r&&(n=t[i]=r),n){var s=n.notify;s&&$e(n,i,s,t),"type"in n&&ti(n,n.type,e,i)}}}(i,e),i){var s=i[r];s.get||s.set?ci(t,e,r,s):li(t,e,r,s)}var a=He(t);t.__values__=t.__props__.filter((function(t){return!1!==a[t+ai+"serializable"]}))}(n,e,t.properties,i);var r=t.editor;return r&&zt(i,v.Component)&&v.Component._registerEditorProps(n,r),n}function di(t){var e;return null==t||null===(e=t.hasOwnProperty)||void 0===e?void 0:e.call(t,"__values__")}fi._isCCClass=function(t){var e;return null==t||null===(e=t.hasOwnProperty)||void 0===e?void 0:e.call(t,oi)},fi.fastDefine=function(t,e,i){Kt(t,e);for(var n=e.__props__=e.__values__=Object.keys(i),r=He(e),s=0;s<n.length;s++){var a=n[s];r[a+ai+"visible"]=!1,r[a+ai+"default"]=i[a]}},fi.Attr=Qe,fi.attr=ze,fi.isCCClassOrFastDefined=di,fi.getInheritanceChain=function(t){for(var e=[];t=Ut(t);)t!==Object&&e.push(t);return e};var pi={Integer:"Number",Float:"Number",Boolean:"Boolean",String:"String"};function mi(t,e,i,n){var r=null,s="";function a(){return s=n+ai,r=He(t)}"type"in e&&void 0===e.type&&q(3660,n,i);var o=e.type;o&&(pi[o]?(r||a())[s+"type"]=o:"Object"===o||("object"==typeof o?me.isEnum(o)?((r||a())[s+"type"]=hi,r[s+"enumList"]=me.getList(o)):de.isBitMask(o)&&((r||a())[s+"type"]=ui,r[s+"bitmaskList"]=de.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&ni.STANDALONE?h=!0===e.serializable||0!=(e.__internalFlags&ni.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")}fi.isArray=function(t){return t=_i(t),Array.isArray(t)},fi.getDefault=_i,fi.escapeForJS=function(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")},fi.IDENTIFIER_RE=/^[A-Za-z_$][0-9A-Za-z_$]*$/,fi.getNewValueTypeCode=function(t){for(var e=It(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=fi;var gi=Math.PI/180,yi=180/Math.PI,vi=t("aK",.5*Math.PI),Si=t("aL",2*Math.PI),Ai=t("aM",1e-6);function Ti(t,e){return Math.abs(t-e)<=Ai*Math.max(1,Math.abs(t),Math.abs(e))}function Ei(t,e,i){return i=i||Ai,Math.abs(t-e)<=i}function bi(t,e,i){if(e>i){var n=e;e=i,i=n}return t<e?e:t>i?i:t}function xi(t){return t<0?0:t>1?1:t}function Ci(t,e,i){return t+(e-t)*i}function Ri(t){return t*gi}function wi(t){return t*yi}var Ii=t("aU",Math.random);function Bi(t,e){return Math.random()*(e-t)+t}function Di(t,e){return Math.floor(Bi(t,e))}function Pi(t){return(t=(9301*t+49297)%233280)/233280}function Oi(t,e,i){return Pi(t)*(i-e)+e}function Mi(t,e,i){return Math.floor(Oi(t,e,i))}function Ni(t){return x(t)}function Li(t,e){return t-Math.floor(t/e)*e}function Fi(t,e){return t=Li(t,2*e),e-Math.abs(t-e)}function ki(t,e,i){return(i-t)/(e-t)}function Gi(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 Vi(t,e){return Math.abs(t)>Math.abs(e)?t:e}function Ui(t,e){e.forEach((function(e){Object.defineProperty(t,e,{enumerable:!0})}))}var zi=t("av",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)<Ai?t.x=0:t.x=1/i,Math.abs(n)<Ai?t.y=0:t.y=1/n,Math.abs(r)<Ai?t.z=0:t.z=1/r,Math.abs(s)<Ai?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*Ii()*Math.PI,n=2*Ii()-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,f=-a*n-o*r-h*s;return t.x=l*u+f*-a+c*-h-_*-o,t.y=c*u+f*-o+_*-a-l*-h,t.z=_*u+f*-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=Ai),!(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=Ai),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=Ai),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=bi(this.x,t.x,e.x),this.y=bi(this.y,t.y,e.y),this.z=bi(this.z,t.z,e.z),this.w=bi(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 Hi(t,e,i,n){return new zi(t,e,i,n)}zi.ZERO=Object.freeze(new zi(0,0,0,0)),zi.ONE=Object.freeze(new zi(1,1,1,1)),zi.NEG_ONE=Object.freeze(new zi(-1,-1,-1,-1)),zi.UNIT_X=Object.freeze(new zi(1,0,0,0)),zi.UNIT_Y=Object.freeze(new zi(0,1,0,0)),zi.UNIT_Z=Object.freeze(new zi(0,0,1,0)),zi.UNIT_W=Object.freeze(new zi(0,0,0,1)),fi.fastDefine("cc.Vec4",zi,{x:0,y:0,z:0,w:0}),v.Vec4=zi,v.v4=Hi;var Wi,Xi,ji,Yi=t("at",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)<Ai?t.x=0:t.x=1/i,Math.abs(n)<Ai?t.y=0:t.y=1/n,Math.abs(r)<Ai?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*Ii()*Math.PI,n=2*Ii()-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),f=s*(h*h*(1-c)+c)+a*(h*u*(1-c)-h*_)+o*(h*l*(1-c)+u*_),d=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=f+i.x,t.y=d+i.y,t.z=p+i.z,t},e.toArray=function(t,e,i){return void 0===i&&(i=0),t[i+0]=e.x,t[i+1]=e.y,t[i+2]=e.z,t},e.fromArray=function(t,e,i){return void 0===i&&(i=0),t.x=e[i+0],t.y=e[i+1],t.z=e[i+2],t},e.strictEquals=function(t,e){return t.x===e.x&&t.y===e.y&&t.z===e.z},e.equals=function(t,e,i){void 0===i&&(i=Ai);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=bi(r,-1,1),Math.acos(r)},e.projectOnPlane=function(t,i,n){return e.subtract(t,i,e.project(t,i,n))},e.project=function(t,i,n){var r=e.lengthSqr(n);return r<1e-6?e.set(t,0,0,0):e.multiplyScalar(t,n,e.dot(i,n)/r)},e.moveTowards=function(t,e,i,n){var r=i.x-e.x,s=i.y-e.y,a=i.z-e.z,o=r*r+s*s+a*a;if(0===o||n>=0&&o<n*n)return t.x=i.x,t.y=i.y,t.z=i.z,t;var h=n/Math.sqrt(o);return t.x=e.x+r*h,t.y=e.y+s*h,t.z=e.z+a*h,t};var i=e.prototype;return i.clone=function(){return new e(this.x,this.y,this.z)},i.set=function(t,e,i){return"object"==typeof t?(this.x=t.x,this.y=t.y,this.z=t.z):(this.x=t||0,this.y=e||0,this.z=i||0),this},i.equals=function(t,e){return void 0===e&&(e=Ai),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=Ai),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=bi(this.x,t.x,e.x),this.y=bi(this.y,t.y,e.y),this.z=bi(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 qi(t,e,i){return new Yi(t,e,i)}Yi.UNIT_X=Object.freeze(new Yi(1,0,0)),Yi.UNIT_Y=Object.freeze(new Yi(0,1,0)),Yi.UNIT_Z=Object.freeze(new Yi(0,0,1)),Yi.RIGHT=Object.freeze(new Yi(1,0,0)),Yi.UP=Object.freeze(new Yi(0,1,0)),Yi.FORWARD=Object.freeze(new Yi(0,0,-1)),Yi.ZERO=Object.freeze(new Yi(0,0,0)),Yi.ONE=Object.freeze(new Yi(1,1,1)),Yi.NEG_ONE=Object.freeze(new Yi(-1,-1,-1)),Yi.slerp=(Wi=new Yi,Xi=new Yi,ji=new Yi,function(t,e,i,n){var r=1e-5,s=Yi.len(e),a=Yi.len(i);if(s<r||a<r)return Yi.lerp(t,e,i,n);var o=Ci(s,a,n),h=Yi.dot(e,i)/(s*a);if(h>.99999)return Yi.lerp(t,e,i,n);if(h<-.99999){var u=Yi.multiplyScalar(Wi,e,1/s),l=function(t,e){var i=e.x,n=e.y,r=e.z,s=Math.abs(i),a=Math.abs(n),o=Math.abs(r);return s<a&&s<o?Yi.set(t,0,r,-n):a<o?Yi.set(t,r,0,-i):Yi.set(t,n,-i,0),Yi.normalize(t,t)}(Xi,u),c=Math.PI*n;return Ji(ji,u,l,c),Yi.multiplyScalar(t,ji,o),t}var _=h,f=Math.acos(_)*n,d=Yi.multiplyScalar(Wi,e,1/s),p=Yi.multiplyScalar(Xi,i,1/a);return Yi.scaleAndAdd(ji,p,d,-_),Yi.normalize(ji,ji),Yi.multiplyScalar(ji,ji,Math.sin(f)),Yi.scaleAndAdd(ji,ji,d,Math.cos(f)),Yi.multiplyScalar(t,ji,o),t}),fi.fastDefine("cc.Vec3",Yi,{x:0,y:0,z:0}),v.Vec3=Yi;var Ki,Ji=(Ki={x:0,y:0,z:0,w:0},function(t,e,i,n){var r=.5*n,s=Math.sin(r);return Ki.x=s*i.x,Ki.y=s*i.y,Ki.z=s*i.z,Ki.w=Math.cos(r),Yi.transformQuat(t,e,Ki),t});v.v3=qi;var Qi=1/255,Zi=t("aH",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 zi).x=t.r*Qi,e.y=t.g*Qi,e.z=t.b*Qi,e.w=t.a*Qi,e},e.fromVec4=function(t,i){return(i=void 0===i?new e:i).r=Math.floor(t.x/Qi),i.g=Math.floor(t.y/Qi),i.b=Math.floor(t.z/Qi),i.a=Math.floor(t.w/Qi),i},e.fromHEX=function(t,e){e=0===e.indexOf("#")?e.substring(1):e,t.r=parseInt(e.substr(0,2),16)||0,t.g=parseInt(e.substr(2,2),16)||0,t.b=parseInt(e.substr(4,2),16)||0;var i=parseInt(e.substr(6,2),16);return t.a=Number.isNaN(i)?255:i,t._val=(t.a<<24>>>0)+(t.b<<16)+(t.g<<8)+t.r,t},e.add=function(t,e,i){return t.r=e.r+i.r,t.g=e.g+i.g,t.b=e.b+i.b,t.a=e.a+i.a,t},e.subtract=function(t,e,i){return t.r=e.r-i.r,t.g=e.g-i.g,t.b=e.b-i.b,t.a=e.a-i.a,t},e.multiply=function(t,e,i){return t.r=e.r*i.r,t.g=e.g*i.g,t.b=e.b*i.b,t.a=e.a*i.a,t},e.divide=function(t,e,i){return t.r=e.r/i.r,t.g=e.g/i.g,t.b=e.b/i.b,t.a=e.a/i.a,t},e.scale=function(t,e,i){return t.r=e.r*i,t.g=e.g*i,t.b=e.b*i,t.a=e.a*i,t},e.lerp=function(t,e,i,n){var r=e.r,s=e.g,a=e.b,o=e.a;return r+=(i.r-r)*n,s+=(i.g-s)*n,a+=(i.b-a)*n,o+=(i.a-o)*n,t._val=Math.floor((o<<24>>>0)+(a<<16)+(s<<8)+r),t},e.toArray=function(t,i,n){void 0===n&&(n=0);var r=i instanceof e||i.a>1?1/255:1;return t[n+0]=i.r*r,t[n+1]=i.g*r,t[n+2]=i.b*r,t[n+3]=i.a*r,t},e.fromArray=function(t,e,i){return void 0===i&&(i=0),e.r=255*t[i+0],e.g=255*t[i+1],e.b=255*t[i+2],e.a=255*t[i+3],e},e.fromUint32=function(t,e){return t._val=e,t},e.toUint32=function(t){return t._val},e.strictEquals=function(t,e){return t.r===e.r&&t.g===e.g&&t.b===e.b&&t.a===e.a},e.equals=function(t,e,i){return void 0===i&&(i=Ai),!(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*Qi).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*Qi,e=this.g*Qi,i=this.b*Qi,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=~~bi(t,0,255),this._val=(4294967040&this._val|t)>>>0}},{key:"g",get:function(){return(65280&this._val)>>8},set:function(t){t=~~bi(t,0,255),this._val=(4294902015&this._val|t<<8)>>>0}},{key:"b",get:function(){return(16711680&this._val)>>16},set:function(t){t=~~bi(t,0,255),this._val=(4278255615&this._val|t<<16)>>>0}},{key:"a",get:function(){return(4278190080&this._val)>>>24},set:function(t){t=~~bi(t,0,255),this._val=(16777215&this._val|t<<24)>>>0}},{key:"x",get:function(){return this.r*Qi},set:function(t){this.r=255*t}},{key:"y",get:function(){return this.g*Qi},set:function(t){this.g=255*t}},{key:"z",get:function(){return this.b*Qi},set:function(t){this.b=255*t}},{key:"w",get:function(){return this.a*Qi},set:function(t){this.a=255*t}}]),e}(Ae));function $i(t,e,i,n){return new Zi(t,e,i,n)}function tn(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}Zi.WHITE=Object.freeze(new Zi(255,255,255,255)),Zi.GRAY=Object.freeze(new Zi(127,127,127,255)),Zi.BLACK=Object.freeze(new Zi(0,0,0,255)),Zi.TRANSPARENT=Object.freeze(new Zi(0,0,0,0)),Zi.RED=Object.freeze(new Zi(255,0,0,255)),Zi.GREEN=Object.freeze(new Zi(0,255,0,255)),Zi.BLUE=Object.freeze(new Zi(0,0,255,255)),Zi.CYAN=Object.freeze(new Zi(0,255,255,255)),Zi.MAGENTA=Object.freeze(new Zi(255,0,255,255)),Zi.YELLOW=Object.freeze(new Zi(255,255,0,255)),fi.fastDefine("cc.Color",Zi,{r:0,g:0,b:0,a:255}),v.Color=Zi,v.color=$i;var en=t("az",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,f=u*s-a*h,d=i*c+n*_+r*f;return 0===d?(t.m00=0,t.m01=0,t.m02=0,t.m03=0,t.m04=0,t.m05=0,t.m06=0,t.m07=0,t.m08=0,t):(d=1/d,t.m00=c*d,t.m01=(-l*n+r*u)*d,t.m02=(o*n-r*a)*d,t.m03=_*d,t.m04=(l*i-r*h)*d,t.m05=(-o*i+r*s)*d,t.m06=f*d,t.m07=(-u*i+n*h)*d,t.m08=(a*i-n*s)*d,t)},e.determinant=function(t){var e=t.m00,i=t.m01,n=t.m02,r=t.m03,s=t.m04,a=t.m05,o=t.m06,h=t.m07,u=t.m08;return e*(u*s-a*h)+i*(-u*r+a*o)+n*(h*r-s*o)},e.multiply=function(t,e,i){var n=e.m00,r=e.m01,s=e.m02,a=e.m03,o=e.m04,h=e.m05,u=e.m06,l=e.m07,c=e.m08,_=i.m00,f=i.m01,d=i.m02,p=i.m03,m=i.m04,g=i.m05,y=i.m06,v=i.m07,S=i.m08;return t.m00=_*n+f*a+d*u,t.m01=_*r+f*o+d*l,t.m02=_*s+f*h+d*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=y*n+v*a+S*u,t.m07=y*r+v*o+S*l,t.m08=y*s+v*h+S*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,f=i.m01,d=i.m02,p=i.m04,m=i.m05,g=i.m06,y=i.m08,v=i.m09,S=i.m10;return t.m00=_*n+f*a+d*u,t.m01=_*r+f*o+d*l,t.m02=_*s+f*h+d*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=y*n+v*a+S*u,t.m07=y*r+v*o+S*l,t.m08=y*s+v*h+S*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,f=i.y;return t.m00=n,t.m01=r,t.m02=s,t.m03=a,t.m04=o,t.m05=h,t.m06=_*n+f*a+u,t.m07=_*r+f*o+l,t.m08=_*s+f*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),f=Math.cos(i);return t.m00=f*n+_*a,t.m01=f*r+_*o,t.m02=f*s+_*h,t.m03=f*a-_*n,t.m04=f*o-_*r,t.m05=f*h-_*s,t.m06=u,t.m07=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 Yi.lengthSqr(i)<Ai*Ai?(e.identity(t),t):(n=n||Yi.UNIT_Y,Yi.normalize(nn,Yi.cross(nn,n,i)),Yi.lengthSqr(nn)<Ai*Ai?(e.identity(t),t):(Yi.cross(rn,i,nn),e.set(t,nn.x,nn.y,nn.z,rn.x,rn.y,rn.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,f=r*o,d=r*h,p=s*a,m=s*o,g=s*h;return t.m00=1-c-d,t.m03=l-g,t.m06=_+m,t.m01=l+g,t.m04=1-u-d,t.m07=f-p,t.m02=_-m,t.m05=f+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,f=e.m11,d=e.m12,p=e.m13,m=e.m14,g=e.m15,y=i*o-n*a,v=i*h-r*a,S=i*u-s*a,A=n*h-r*o,T=n*u-s*o,E=r*u-s*h,b=l*p-c*d,x=l*m-_*d,C=l*g-f*d,R=c*m-_*p,w=c*g-f*p,I=_*g-f*m,B=y*I-v*w+S*R+A*C-T*x+E*b;return B?(B=1/B,t.m00=(o*I-h*w+u*R)*B,t.m01=(h*C-a*I-u*x)*B,t.m02=(a*w-o*C+u*b)*B,t.m03=(r*w-n*I-s*R)*B,t.m04=(i*I-r*C+s*x)*B,t.m05=(n*C-i*w-s*b)*B,t.m06=(p*E-m*T+g*A)*B,t.m07=(m*S-d*E-g*v)*B,t.m08=(d*T-p*S+g*y)*B,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=Ai),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=vi,e.y=Math.atan2(r,i),e.z=0,!1):(e.x=-vi,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=Ai),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,f=t.m03,d=t.m04,p=t.m05,m=t.m06,g=t.m07,y=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=f*e+d*r+p*o,this.m04=f*i+d*s+p*h,this.m05=f*n+d*a+p*u,this.m06=m*e+g*r+y*o,this.m07=m*i+g*s+y*h,this.m08=m*n+g*a+y*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,f=n*o,d=r*s,p=r*a,m=r*o;return this.m00=1-l-f,this.m03=u-m,this.m06=c+p,this.m01=u+m,this.m04=1-h-f,this.m07=_-d,this.m02=c-p,this.m05=_+d,this.m08=1-h-l,this},e}(Ae));en.IDENTITY=Object.freeze(new en);var nn=new Yi,rn=new Yi;fi.fastDefine("cc.Mat3",en,{m00:1,m01:0,m02:0,m03:0,m04:1,m05:0,m06:0,m07:0,m08:1}),v.Mat3=en;var sn=t("ax",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=Yi.dot(i,n);return r<-.999999?(Yi.cross(hn,Yi.UNIT_X,i),hn.length()<1e-6&&Yi.cross(hn,Yi.UNIT_Y,i),Yi.normalize(hn,hn),e.fromAxisAngle(t,hn,Math.PI),t):r>.999999?(t.x=0,t.y=0,t.z=0,t.w=1,t):(Yi.cross(hn,i,n),t.x=hn.x,t.y=hn.y,t.z=hn.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(an,i),Yi.transformQuat(hn,n,an),e.fromAxisAngle(an,hn,r),e.multiply(t,i,an),t},e.rotateAroundLocal=function(t,i,n,r){return e.fromAxisAngle(an,n,r),e.multiply(t,i,an),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(an,i,s,a),e.slerp(on,n,r,a),e.slerp(t,an,on,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 en.set(un,i.x,i.y,i.z,n.x,n.y,n.z,r.x,r.y,r.z),e.normalize(t,e.fromMat3(t,un))},e.fromViewUp=function(t,i,n){return en.fromViewUp(un,i,n),e.normalize(t,e.fromMat3(t,un))},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,f=l-i-a,d=0,p=i+a+l;c>p&&(p=c,d=1),_>p&&(p=_,d=2),f>p&&(p=f,d=3);var m=.5*Math.sqrt(p+1),g=.25/m;switch(d){case 0:t.w=m,t.x=(o-u)*g,t.y=(h-r)*g,t.z=(n-s)*g;break;case 1:t.w=(o-u)*g,t.x=m,t.y=(n+s)*g,t.z=(h+r)*g;break;case 2:t.w=(h-r)*g,t.x=(n+s)*g,t.y=m,t.z=(o+u)*g;break;case 3:t.w=(n-s)*g,t.x=(h+r)*g,t.y=(o+u)*g,t.z=m;break;default:t.w=1,t.x=0,t.y=0,t.z=0}return t},e.fromEuler=function(t,e,i,n){e*=ln,i*=ln,n*=ln;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*=ln,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=wi(2*Math.atan2(n,a)),u=90;else if(l<-.499999)o=0,h=-wi(2*Math.atan2(n,a)),u=-90;else{var c=n*n,_=r*r,f=s*s;o=wi(Math.atan2(2*n*a-2*r*s,1-2*c-2*f)),h=wi(Math.atan2(2*r*a-2*n*s,1-2*_-2*f)),u=wi(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){en.fromQuat(un,e),en.toEuler(un,t),t.x=wi(t.x),t.y=wi(t.y),t.z=wi(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=Ai),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/wi(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=Ai),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));sn.IDENTITY=Object.freeze(new sn);var an=new sn,on=new sn,hn=new Yi,un=new en,ln=.5*Math.PI/180;function cn(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 sn(t,e,i,n)}fi.fastDefine("cc.Quat",sn,{x:0,y:0,z:0,w:1}),v.Quat=sn,v.quat=cn;var _n=t("aJ",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])])),fn=t("aA",function(t){function e(e,i,n,r,s,a,o,h,u,l,c,_,f,d,p,m){var g;return void 0===e&&(e=1),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=1),void 0===o&&(o=0),void 0===h&&(h=0),void 0===u&&(u=0),void 0===l&&(l=0),void 0===c&&(c=1),void 0===_&&(_=0),void 0===f&&(f=0),void 0===d&&(d=0),void 0===p&&(p=0),void 0===m&&(m=1),g=t.call(this)||this,"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=f,g.m13=d,g.m14=p,g.m15=m),g}s(e,t),e.clone=function(t){return new e(t.m00,t.m01,t.m02,t.m03,t.m04,t.m05,t.m06,t.m07,t.m08,t.m09,t.m10,t.m11,t.m12,t.m13,t.m14,t.m15)},e.copy=function(t,e){return t.m00=e.m00,t.m01=e.m01,t.m02=e.m02,t.m03=e.m03,t.m04=e.m04,t.m05=e.m05,t.m06=e.m06,t.m07=e.m07,t.m08=e.m08,t.m09=e.m09,t.m10=e.m10,t.m11=e.m11,t.m12=e.m12,t.m13=e.m13,t.m14=e.m14,t.m15=e.m15,t},e.set=function(t,e,i,n,r,s,a,o,h,u,l,c,_,f,d,p,m){return t.m00=e,t.m01=i,t.m02=n,t.m03=r,t.m04=s,t.m05=a,t.m06=o,t.m07=h,t.m08=u,t.m09=l,t.m10=c,t.m11=_,t.m12=f,t.m13=d,t.m14=p,t.m15=m,t},e.identity=function(t){return t.m00=1,t.m01=0,t.m02=0,t.m03=0,t.m04=0,t.m05=1,t.m06=0,t.m07=0,t.m08=0,t.m09=0,t.m10=1,t.m11=0,t.m12=0,t.m13=0,t.m14=0,t.m15=1,t},e.transpose=function(t,e){if(t===e){var i=e.m01,n=e.m02,r=e.m03,s=e.m06,a=e.m07,o=e.m11;t.m01=e.m04,t.m02=e.m08,t.m03=e.m12,t.m04=i,t.m06=e.m09,t.m07=e.m13,t.m08=n,t.m09=s,t.m11=e.m14,t.m12=r,t.m13=a,t.m14=o}else t.m00=e.m00,t.m01=e.m04,t.m02=e.m08,t.m03=e.m12,t.m04=e.m01,t.m05=e.m05,t.m06=e.m09,t.m07=e.m13,t.m08=e.m02,t.m09=e.m06,t.m10=e.m10,t.m11=e.m14,t.m12=e.m03,t.m13=e.m07,t.m14=e.m11,t.m15=e.m15;return t},e.invert=function(t,e){var i=e.m00,n=e.m01,r=e.m02,s=e.m03,a=e.m04,o=e.m05,h=e.m06,u=e.m07,l=e.m08,c=e.m09,_=e.m10,f=e.m11,d=e.m12,p=e.m13,m=e.m14,g=e.m15,y=i*o-n*a,v=i*h-r*a,S=i*u-s*a,A=n*h-r*o,T=n*u-s*o,E=r*u-s*h,b=l*p-c*d,x=l*m-_*d,C=l*g-f*d,R=c*m-_*p,w=c*g-f*p,I=_*g-f*m,B=y*I-v*w+S*R+A*C-T*x+E*b;return 0===B?(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):(B=1/B,t.m00=(o*I-h*w+u*R)*B,t.m01=(r*w-n*I-s*R)*B,t.m02=(p*E-m*T+g*A)*B,t.m03=(_*T-c*E-f*A)*B,t.m04=(h*C-a*I-u*x)*B,t.m05=(i*I-r*C+s*x)*B,t.m06=(m*S-d*E-g*v)*B,t.m07=(l*E-_*S+f*v)*B,t.m08=(a*w-o*C+u*b)*B,t.m09=(n*C-i*w-s*b)*B,t.m10=(d*T-p*S+g*y)*B,t.m11=(c*S-l*T-f*y)*B,t.m12=(o*x-a*R-h*b)*B,t.m13=(i*R-n*x+r*b)*B,t.m14=(p*v-d*A-m*y)*B,t.m15=(l*A-c*v+_*y)*B,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,f=t.m12,d=t.m13,p=t.m14,m=t.m15;return(e*a-i*s)*(c*m-_*p)-(e*o-n*s)*(l*m-_*d)+(e*h-r*s)*(l*p-c*d)+(i*o-n*a)*(u*m-_*f)-(i*h-r*a)*(u*p-c*f)+(n*h-r*o)*(u*d-l*f)},e.multiply=function(t,e,i){var n=e.m00,r=e.m01,s=e.m02,a=e.m03,o=e.m04,h=e.m05,u=e.m06,l=e.m07,c=e.m08,_=e.m09,f=e.m10,d=e.m11,p=e.m12,m=e.m13,g=e.m14,y=e.m15,v=i.m00,S=i.m01,A=i.m02,T=i.m03;return t.m00=v*n+S*o+A*c+T*p,t.m01=v*r+S*h+A*_+T*m,t.m02=v*s+S*u+A*f+T*g,t.m03=v*a+S*l+A*d+T*y,v=i.m04,S=i.m05,A=i.m06,T=i.m07,t.m04=v*n+S*o+A*c+T*p,t.m05=v*r+S*h+A*_+T*m,t.m06=v*s+S*u+A*f+T*g,t.m07=v*a+S*l+A*d+T*y,v=i.m08,S=i.m09,A=i.m10,T=i.m11,t.m08=v*n+S*o+A*c+T*p,t.m09=v*r+S*h+A*_+T*m,t.m10=v*s+S*u+A*f+T*g,t.m11=v*a+S*l+A*d+T*y,v=i.m12,S=i.m13,A=i.m14,T=i.m15,t.m12=v*n+S*o+A*c+T*p,t.m13=v*r+S*h+A*_+T*m,t.m14=v*s+S*u+A*f+T*g,t.m15=v*a+S*l+A*d+T*y,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,f=e.m07,d=e.m08,p=e.m09,m=e.m10,g=e.m11;t.m00=a,t.m01=o,t.m02=h,t.m03=u,t.m04=l,t.m05=c,t.m06=_,t.m07=f,t.m08=d,t.m09=p,t.m10=m,t.m11=g,t.m12=a*n+l*r+d*s+e.m12,t.m13=o*n+c*r+p*s+e.m13,t.m14=h*n+_*r+m*s+e.m14,t.m15=u*n+f*r+g*s+e.m15}return t},e.translate=function(t,e,i){return e===t?(t.m12+=i.x,t.m13+=i.y,t.m14+=i.z):(t.m00=e.m00,t.m01=e.m01,t.m02=e.m02,t.m03=e.m03,t.m04=e.m04,t.m05=e.m05,t.m06=e.m06,t.m07=e.m07,t.m08=e.m08,t.m09=e.m09,t.m10=e.m10,t.m11=e.m11,t.m12=e.m12+i.x,t.m13=e.m13+i.y,t.m14=e.m14+i.z,t.m15=e.m15),t},e.scale=function(t,e,i){var n=i.x,r=i.y,s=i.z;return t.m00=e.m00*n,t.m01=e.m01*n,t.m02=e.m02*n,t.m03=e.m03*n,t.m04=e.m04*r,t.m05=e.m05*r,t.m06=e.m06*r,t.m07=e.m07*r,t.m08=e.m08*s,t.m09=e.m09*s,t.m10=e.m10*s,t.m11=e.m11*s,t.m12=e.m12,t.m13=e.m13,t.m14=e.m14,t.m15=e.m15,t},e.rotate=function(t,e,i,n){var r=n.x,s=n.y,a=n.z,o=Math.sqrt(r*r+s*s+a*a);if(Math.abs(o)<Ai)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,f=e.m02,d=e.m03,p=e.m04,m=e.m05,g=e.m06,y=e.m07,v=e.m08,S=e.m09,A=e.m10,T=e.m11,E=r*r*l+u,b=s*r*l+a*h,x=a*r*l-s*h,C=r*s*l-a*h,R=s*s*l+u,w=a*s*l+r*h,I=r*a*l+s*h,B=s*a*l-r*h,D=a*a*l+u;return t.m00=c*E+p*b+v*x,t.m01=_*E+m*b+S*x,t.m02=f*E+g*b+A*x,t.m03=d*E+y*b+T*x,t.m04=c*C+p*R+v*w,t.m05=_*C+m*R+S*w,t.m06=f*C+g*R+A*w,t.m07=d*C+y*R+T*w,t.m08=c*I+p*B+v*D,t.m09=_*I+m*B+S*D,t.m10=f*I+g*B+A*D,t.m11=d*I+y*B+T*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)<Ai)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,f=r*h,d=r*u,p=s*u,m=a*o,g=a*h,y=a*u;return t.m00=1-(f+p),t.m01=c+y,t.m02=_-g,t.m03=0,t.m04=c-y,t.m05=1-(l+p),t.m06=d+m,t.m07=0,t.m08=_+g,t.m09=d-m,t.m10=1-(l+f),t.m11=0,t.m12=i.x,t.m13=i.y,t.m14=i.z,t.m15=1,t},e.getTranslation=function(t,e){return t.x=e.m12,t.y=e.m13,t.z=e.m14,t},e.getScaling=function(t,e){var i=pn.m00=e.m00,n=pn.m01=e.m01,r=pn.m02=e.m02,s=pn.m03=e.m04,a=pn.m04=e.m05,o=pn.m05=e.m06,h=pn.m06=e.m08,u=pn.m07=e.m09,l=pn.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),en.determinant(pn)<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=Yi.set(dn,t.m00,t.m01,t.m02).length(),s=Yi.set(dn,t.m04,t.m05,t.m06).length(),a=Yi.set(dn,t.m08,t.m09,t.m10).length();pn.m00=t.m00/r,pn.m01=t.m01/r,pn.m02=t.m02/r,pn.m03=t.m04/s,pn.m04=t.m05/s,pn.m05=t.m06/s,pn.m06=t.m08/a,pn.m07=t.m09/a,pn.m08=t.m10/a;var o=en.determinant(pn);n&&(Yi.set(n,r,s,a),o<0&&(n.x*=-1)),i&&Yi.set(i,t.m12,t.m13,t.m14),e&&(o<0&&(pn.m00*=-1,pn.m01*=-1,pn.m02*=-1),sn.fromMat3(e,pn))},e.toSRT=function(t,e,i,n){var r=Yi.set(dn,t.m00,t.m01,t.m02).length(),s=Yi.set(dn,t.m04,t.m05,t.m06).length(),a=Yi.set(dn,t.m08,t.m09,t.m10).length();n&&(n.x=r,n.y=s,n.z=a),i&&Yi.set(i,t.m12,t.m13,t.m14),e&&(pn.m00=t.m00/r,pn.m01=t.m01/r,pn.m02=t.m02/r,pn.m03=t.m04/s,pn.m04=t.m05/s,pn.m05=t.m06/s,pn.m06=t.m08/a,pn.m07=t.m09/a,pn.m08=t.m10/a,en.determinant(pn)<0&&(n&&(n.x*=-1),pn.m00*=-1,pn.m01*=-1,pn.m02*=-1),sn.fromMat3(e,pn))},e.toEuler=function(t,e){return en.set(pn,t.m00,t.m01,t.m02,t.m04,t.m05,t.m06,t.m08,t.m09,t.m10),en.toEuler(pn,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,f=r*l,d=s*u,p=s*l,m=a*l,g=o*h,y=o*u,v=o*l,S=n.x,A=n.y,T=n.z;return t.m00=(1-(d+m))*S,t.m01=(_+v)*S,t.m02=(f-y)*S,t.m03=0,t.m04=(_-v)*A,t.m05=(1-(c+m))*A,t.m06=(p+g)*A,t.m07=0,t.m08=(f+y)*T,t.m09=(p-g)*T,t.m10=(1-(c+d))*T,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,f=r*l,d=s*u,p=s*l,m=a*l,g=o*h,y=o*u,v=o*l,S=n.x,A=n.y,T=n.z;return t.m00=(1-(d+m))*S,t.m01=(_+v)*S,t.m02=(f-y)*S,t.m03=0,t.m04=(_-v)*A,t.m05=(1-(c+m))*A,t.m06=(p+g)*A,t.m07=0,t.m08=(f+y)*T,t.m09=(p-g)*T,t.m10=(1-(c+d))*T,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,f=s*l,d=s*c,p=a*l,m=a*c,g=o*c,y=h*u,v=h*l,S=h*c,A=n.x,T=n.y,E=n.z,b=r.x,x=r.y,C=r.z;return t.m00=(1-(p+g))*A,t.m01=(f+S)*A,t.m02=(d-v)*A,t.m03=0,t.m04=(f-S)*T,t.m05=(1-(_+g))*T,t.m06=(m+y)*T,t.m07=0,t.m08=(d+v)*E,t.m09=(m-y)*E,t.m10=(1-(_+p))*E,t.m11=0,t.m12=i.x+b-(t.m00*b+t.m04*x+t.m08*C),t.m13=i.y+x-(t.m01*b+t.m05*x+t.m09*C),t.m14=i.z+C-(t.m02*b+t.m06*x+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,f=s*l,d=s*c,p=a*l,m=a*c,g=o*c,y=h*u,v=h*l,S=h*c,A=n.x,T=n.y,E=n.z,b=r.x,x=r.y,C=r.z;return t.m00=(1-(p+g))*A,t.m01=(f+S)*A,t.m02=(d-v)*A,t.m03=0,t.m04=(f-S)*T,t.m05=(1-(_+g))*T,t.m06=(m+y)*T,t.m07=0,t.m08=(d+v)*E,t.m09=(m-y)*E,t.m10=(1-(_+p))*E,t.m11=0,t.m12=i.x+b-(t.m00*b+t.m04*x+t.m08*C),t.m13=i.y+x-(t.m01*b+t.m05*x+t.m09*C),t.m14=i.z+C-(t.m02*b+t.m06*x+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,f=r*o,d=r*h,p=s*a,m=s*o,g=s*h;return t.m00=1-c-d,t.m01=l+g,t.m02=_-m,t.m03=0,t.m04=l-g,t.m05=1-u-d,t.m06=f+p,t.m07=0,t.m08=_+m,t.m09=f-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,f=_n[h];return t.m00=c*f[0],t.m01=c*f[1],t.m02=0,t.m03=0,t.m04=_*f[2],t.m05=_*f[3],t.m06=0,t.m07=0,t.m08=0,t.m09=0,t.m10=(r-a*n)*l,t.m11=-1,t.m12=0,t.m13=0,t.m14=r*n*l*(1-a),t.m15=0,t},e.ortho=function(t,e,i,n,r,s,a,o,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),f=-2*l,d=-2*c,p=(e+i)*l,m=(r+n)*c,g=_n[u];return t.m00=f*g[0],t.m01=f*g[1],t.m02=0,t.m03=0,t.m04=d*g[2],t.m05=d*g[3],t.m06=0,t.m07=0,t.m08=0,t.m09=0,t.m10=_*(1-o),t.m11=0,t.m12=p*g[0]+m*g[2],t.m13=p*g[1]+m*g[3],t.m14=(s-o*a)*_,t.m15=1,t},e.lookAt=function(t,e,i,n){var r=e.x,s=e.y,a=e.z,o=n.x,h=n.y,u=n.z,l=r-i.x,c=s-i.y,_=a-i.z,f=1/Math.sqrt(l*l+c*c+_*_),d=h*(_*=f)-u*(c*=f),p=u*(l*=f)-o*_,m=o*c-h*l,g=c*(m*=f=1/Math.sqrt(d*d+p*p+m*m))-_*(p*=f),y=_*(d*=f)-l*m,v=l*p-c*d;return t.m00=d,t.m01=g,t.m02=l,t.m03=0,t.m04=p,t.m05=y,t.m06=c,t.m07=0,t.m08=m,t.m09=v,t.m10=_,t.m11=0,t.m12=-(d*r+p*s+m*a),t.m13=-(g*r+y*s+v*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,f=e.m11,d=e.m12,p=e.m13,m=e.m14,g=e.m15,y=i*o-n*a,v=i*h-r*a,S=i*u-s*a,A=n*h-r*o,T=n*u-s*o,E=r*u-s*h,b=l*p-c*d,x=l*m-_*d,C=l*g-f*d,R=c*m-_*p,w=c*g-f*p,I=_*g-f*m,B=y*I-v*w+S*R+A*C-T*x+E*b;return B?(B=1/B,t.m00=(o*I-h*w+u*R)*B,t.m01=(h*C-a*I-u*x)*B,t.m02=(a*w-o*C+u*b)*B,t.m03=0,t.m04=(r*w-n*I-s*R)*B,t.m05=(i*I-r*C+s*x)*B,t.m06=(n*C-i*w-s*b)*B,t.m07=0,t.m08=(p*E-m*T+g*A)*B,t.m09=(m*S-d*E-g*v)*B,t.m10=(d*T-p*S+g*y)*B,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=Ai),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,_,f,d,p){return void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=1),void 0===a&&(a=0),void 0===o&&(o=0),void 0===h&&(h=0),void 0===u&&(u=0),void 0===l&&(l=1),void 0===c&&(c=0),void 0===_&&(_=0),void 0===f&&(f=0),void 0===d&&(d=0),void 0===p&&(p=1),"object"==typeof t?(this.m01=t.m01,this.m02=t.m02,this.m03=t.m03,this.m04=t.m04,this.m05=t.m05,this.m06=t.m06,this.m07=t.m07,this.m08=t.m08,this.m09=t.m09,this.m10=t.m10,this.m11=t.m11,this.m12=t.m12,this.m13=t.m13,this.m14=t.m14,this.m15=t.m15,this.m00=t.m00):(this.m01=e,this.m02=i,this.m03=n,this.m04=r,this.m05=s,this.m06=a,this.m07=o,this.m08=h,this.m09=u,this.m10=l,this.m11=c,this.m12=_,this.m13=f,this.m14=d,this.m15=p,this.m00=t),this},i.equals=function(t,e){return void 0===e&&(e=Ai),!(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,f=this.m13,d=this.m14,p=this.m15,m=t*s-e*r,g=t*a-i*r,y=t*o-n*r,v=e*a-i*s,S=e*o-n*s,A=i*o-n*a,T=h*f-u*_,E=h*d-l*_,b=h*p-c*_,x=u*d-l*f,C=u*p-c*f,R=l*p-c*d,w=m*R-g*C+y*x+v*b-S*E+A*T;return 0===w?(this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),this):(w=1/w,this.m00=(s*R-a*C+o*x)*w,this.m01=(i*C-e*R-n*x)*w,this.m02=(f*A-d*S+p*v)*w,this.m03=(l*S-u*A-c*v)*w,this.m04=(a*b-r*R-o*E)*w,this.m05=(t*R-i*b+n*E)*w,this.m06=(d*y-_*A-p*g)*w,this.m07=(h*A-l*y+c*g)*w,this.m08=(r*C-s*b+o*T)*w,this.m09=(e*b-t*C-n*T)*w,this.m10=(_*S-f*y+p*m)*w,this.m11=(u*y-h*S-c*m)*w,this.m12=(s*E-r*x-a*T)*w,this.m13=(t*x-e*E+i*T)*w,this.m14=(f*g-_*v-d*m)*w,this.m15=(h*v-u*g+l*m)*w,this)},i.determinant=function(){var t=this.m00,e=this.m01,i=this.m02,n=this.m03,r=this.m04,s=this.m05,a=this.m06,o=this.m07,h=this.m08,u=this.m09,l=this.m10,c=this.m11,_=this.m12,f=this.m13,d=this.m14,p=this.m15;return(t*s-e*r)*(l*p-c*d)-(t*a-i*r)*(u*p-c*f)+(t*o-n*r)*(u*d-l*f)+(e*a-i*s)*(h*p-c*_)-(e*o-n*s)*(h*d-l*_)+(i*o-n*a)*(h*f-u*_)},i.add=function(t){return this.m00+=t.m00,this.m01+=t.m01,this.m02+=t.m02,this.m03+=t.m03,this.m04+=t.m04,this.m05+=t.m05,this.m06+=t.m06,this.m07+=t.m07,this.m08+=t.m08,this.m09+=t.m09,this.m10+=t.m10,this.m11+=t.m11,this.m12+=t.m12,this.m13+=t.m13,this.m14+=t.m14,this.m15+=t.m15,this},i.subtract=function(t){return this.m00-=t.m00,this.m01-=t.m01,this.m02-=t.m02,this.m03-=t.m03,this.m04-=t.m04,this.m05-=t.m05,this.m06-=t.m06,this.m07-=t.m07,this.m08-=t.m08,this.m09-=t.m09,this.m10-=t.m10,this.m11-=t.m11,this.m12-=t.m12,this.m13-=t.m13,this.m14-=t.m14,this.m15-=t.m15,this},i.multiply=function(t){var e=this.m00,i=this.m01,n=this.m02,r=this.m03,s=this.m04,a=this.m05,o=this.m06,h=this.m07,u=this.m08,l=this.m09,c=this.m10,_=this.m11,f=this.m12,d=this.m13,p=this.m14,m=this.m15,g=t.m00,y=t.m01,v=t.m02,S=t.m03;return this.m00=g*e+y*s+v*u+S*f,this.m01=g*i+y*a+v*l+S*d,this.m02=g*n+y*o+v*c+S*p,this.m03=g*r+y*h+v*_+S*m,g=t.m04,y=t.m05,v=t.m06,S=t.m07,this.m04=g*e+y*s+v*u+S*f,this.m05=g*i+y*a+v*l+S*d,this.m06=g*n+y*o+v*c+S*p,this.m07=g*r+y*h+v*_+S*m,g=t.m08,y=t.m09,v=t.m10,S=t.m11,this.m08=g*e+y*s+v*u+S*f,this.m09=g*i+y*a+v*l+S*d,this.m10=g*n+y*o+v*c+S*p,this.m11=g*r+y*h+v*_+S*m,g=t.m12,y=t.m13,v=t.m14,S=t.m15,this.m12=g*e+y*s+v*u+S*f,this.m13=g*i+y*a+v*l+S*d,this.m14=g*n+y*o+v*c+S*p,this.m15=g*r+y*h+v*_+S*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,f=this.m09,d=this.m10,p=this.m11;return this.m12=r*e+h*i+_*n+this.m12,this.m13=s*e+u*i+f*n+this.m13,this.m14=a*e+l*i+d*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)<Ai)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,f=this.m04,d=this.m05,p=this.m06,m=this.m07,g=this.m08,y=this.m09,v=this.m10,S=this.m11,A=i*i*h+o,T=n*i*h+r*a,E=r*i*h-n*a,b=i*n*h-r*a,x=n*n*h+o,C=r*n*h+i*a,R=i*r*h+n*a,w=n*r*h-i*a,I=r*r*h+o;return this.m00=u*A+f*T+g*E,this.m01=l*A+d*T+y*E,this.m02=c*A+p*T+v*E,this.m03=_*A+m*T+S*E,this.m04=u*b+f*x+g*C,this.m05=l*b+d*x+y*C,this.m06=c*b+p*x+v*C,this.m07=_*b+m*x+S*C,this.m08=u*R+f*w+g*I,this.m09=l*R+d*w+y*I,this.m10=c*R+p*w+v*I,this.m11=_*R+m*w+S*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=pn.m00=this.m00,i=pn.m01=this.m01,n=pn.m02=this.m02,r=pn.m03=this.m04,s=pn.m04=this.m05,a=pn.m05=this.m06,o=pn.m06=this.m08,h=pn.m07=this.m09,u=pn.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),en.determinant(pn)<0&&(t.x*=-1),t},i.getRotation=function(t){var e=Yi.set(dn,this.m00,this.m01,this.m02).length(),i=Yi.set(dn,this.m04,this.m05,this.m06).length(),n=Yi.set(dn,this.m08,this.m09,this.m10).length();return pn.m00=this.m00/e,pn.m01=this.m01/e,pn.m02=this.m02/e,pn.m03=this.m04/i,pn.m04=this.m05/i,pn.m05=this.m06/i,pn.m06=this.m08/n,pn.m07=this.m09/n,pn.m08=this.m10/n,en.determinant(pn)<0&&(pn.m00*=-1,pn.m01*=-1,pn.m02*=-1),sn.fromMat3(t,pn)},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,f=r*h,d=r*u,p=s*u,m=a*o,g=a*h,y=a*u,v=i.x,S=i.y,A=i.z;return this.m00=(1-(f+p))*v,this.m01=(c+y)*v,this.m02=(_-g)*v,this.m03=0,this.m04=(c-y)*S,this.m05=(1-(l+p))*S,this.m06=(d+m)*S,this.m07=0,this.m08=(_+g)*A,this.m09=(d-m)*A,this.m10=(1-(l+f))*A,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,f=r*h,d=r*u,p=s*u,m=a*o,g=a*h,y=a*u,v=i.x,S=i.y,A=i.z;return this.m00=(1-(f+p))*v,this.m01=(c+y)*v,this.m02=(_-g)*v,this.m03=0,this.m04=(c-y)*S,this.m05=(1-(l+p))*S,this.m06=(d+m)*S,this.m07=0,this.m08=(_+g)*A,this.m09=(d-m)*A,this.m10=(1-(l+f))*A,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,f=n*o,d=r*s,p=r*a,m=r*o;return this.m00=1-l-f,this.m01=u+m,this.m02=c-p,this.m03=0,this.m04=u-m,this.m05=1-h-f,this.m06=_+d,this.m07=0,this.m08=c+p,this.m09=_-d,this.m10=1-h-l,this.m11=0,this.m12=0,this.m13=0,this.m14=0,this.m15=1,this},e}(Ae));fn.IDENTITY=Object.freeze(new fn);var dn=new Yi,pn=new en;function mn(t,e,i,n,r,s,a,o,h,u,l,c,_,f,d,p){return new fn(t,e,i,n,r,s,a,o,h,u,l,c,_,f,d,p)}fi.fastDefine("cc.Mat4",fn,{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=fn,v.mat4=mn;var gn,yn=t("ar",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)<Ai?t.x=0:t.x=1/i,Math.abs(n)<Ai?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 Yi?(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*Ii()*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=Ai),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=bi(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=Ai),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=Ai),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=bi(this.x,t.x,e.x),this.y=bi(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=bi(n,-1,1),Math.acos(n)},i.signAngle=function(t){var e=this.angle(t);return this.cross(t)<0?-e:e},i.rotate=function(t){var e=this.x,i=this.y,n=Math.sin(t),r=Math.cos(t);return this.x=r*e-n*i,this.y=n*e+r*i,this},i.project=function(t){var e=this.dot(t)/t.dot(t);return this.x=t.x*e,this.y=t.y*e,this},i.transformMat4=function(t){var e=this.x,i=this.y;return this.x=t.m00*e+t.m04*i+t.m12,this.y=t.m01*e+t.m05*i+t.m13,this},e}(Ae));function vn(t,e){return new yn(t,e)}yn.ZERO=Object.freeze(new yn(0,0)),yn.ONE=Object.freeze(new yn(1,1)),yn.NEG_ONE=Object.freeze(new yn(-1,-1)),yn.UNIT_X=Object.freeze(new yn(1,0)),yn.UNIT_Y=Object.freeze(new yn(0,1)),fi.fastDefine("cc.Vec2",yn,{x:0,y:0}),v.Vec2=yn,v.v2=vn,nt(yn,"Vec2",[{name:"sub",newName:"subtract",target:yn,targetName:"Vec2"},{name:"mul",newName:"multiply",target:yn,targetName:"Vec2"},{name:"div",newName:"divide",target:yn,targetName:"Vec2"},{name:"dist",newName:"distance",target:yn,targetName:"Vec2"},{name:"sqrDist",newName:"squaredDistance",target:yn,targetName:"Vec2"},{name:"mag",newName:"len",target:yn,targetName:"Vec2"},{name:"sqrMag",newName:"lengthSqr",target:yn,targetName:"Vec2"},{name:"scale",newName:"multiplyScalar",target:yn,targetName:"Vec2"},{name:"exactEquals",newName:"strictEquals",target:yn,targetName:"Vec2"}]),nt(yn.prototype,"Vec2",[{name:"mag",newName:"length",target:yn.prototype,targetName:"Vec2"},{name:"magSqr",newName:"lengthSqr",target:yn.prototype,targetName:"Vec2"},{name:"scale",newName:"multiplyScalar",target:yn.prototype,targetName:"Vec2"},{name:"exactEquals",newName:"strictEquals",target:yn.prototype,targetName:"Vec2"}]),nt(Yi,"Vec3",[{name:"sub",newName:"subtract",target:Yi,targetName:"Vec3"},{name:"mul",newName:"multiply",target:Yi,targetName:"Vec3"},{name:"div",newName:"divide",target:Yi,targetName:"Vec3"},{name:"dist",newName:"distance",target:Yi,targetName:"Vec3"},{name:"sqrDist",newName:"squaredDistance",target:Yi,targetName:"Vec3"},{name:"mag",newName:"len",target:Yi,targetName:"Vec3"},{name:"sqrMag",newName:"lengthSqr",target:Yi,targetName:"Vec3"},{name:"scale",newName:"multiplyScalar",target:Yi,targetName:"Vec3"},{name:"exactEquals",newName:"strictEquals",target:Yi,targetName:"Vec3"}]),nt(Yi.prototype,"Vec3",[{name:"mag",newName:"length",target:Yi.prototype,targetName:"Vec3"},{name:"magSqr",newName:"lengthSqr",target:Yi.prototype,targetName:"Vec3"},{name:"scale",newName:"multiplyScalar",target:Yi.prototype,targetName:"Vec3"},{name:"exactEquals",newName:"strictEquals",target:Yi.prototype,targetName:"Vec3"}]),nt(zi,"Vec4",[{name:"sub",newName:"subtract",target:zi,targetName:"Vec4"},{name:"mul",newName:"multiply",target:zi,targetName:"Vec4"},{name:"div",newName:"divide",target:zi,targetName:"Vec4"},{name:"dist",newName:"distance",target:zi,targetName:"Vec4"},{name:"sqrDist",newName:"squaredDistance",target:zi,targetName:"Vec4"},{name:"mag",newName:"len",target:zi,targetName:"Vec4"},{name:"sqrMag",newName:"lengthSqr",target:zi,targetName:"Vec4"},{name:"scale",newName:"multiplyScalar",target:zi,targetName:"Vec4"},{name:"exactEquals",newName:"strictEquals",target:zi,targetName:"Vec4"}]),nt(zi.prototype,"Vec4",[{name:"mag",newName:"length",target:zi.prototype,targetName:"Vec4"},{name:"magSqr",newName:"lengthSqr",target:zi.prototype,targetName:"Vec4"},{name:"scale",newName:"multiplyScalar",target:zi.prototype,targetName:"Vec4"},{name:"exactEquals",newName:"strictEquals",target:zi.prototype,targetName:"Vec4"}]),nt(sn,"Quat",[{name:"mag",newName:"len",target:sn,targetName:"Quat"},{name:"mul",newName:"multiply",target:sn,targetName:"Quat"},{name:"sqrMag",newName:"lengthSqr",target:sn,targetName:"Quat"},{name:"scale",newName:"multiplyScalar",target:sn,targetName:"Quat"},{name:"exactEquals",newName:"strictEquals",target:sn,targetName:"Quat"}]),nt(sn.prototype,"Quat",[{name:"scale",newName:"multiplyScalar",target:sn.prototype,targetName:"Quat"},{name:"exactEquals",newName:"strictEquals",target:sn.prototype,targetName:"Quat"}]),nt(Zi,"Color",[{name:"sub",newName:"subtract",target:Zi,targetName:"Color"},{name:"mul",newName:"multiply",target:Zi,targetName:"Color"},{name:"div",newName:"divide",target:Zi,targetName:"Color"},{name:"exactEquals",newName:"strictEquals",target:Zi,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)}}]),nt(en,"Mat3",[{name:"sub",newName:"subtract",target:en,targetName:"Mat3"},{name:"mul",newName:"multiply",target:en,targetName:"Mat3"},{name:"exactEquals",newName:"strictEquals",target:en,targetName:"Mat3"},{name:"transfrom",newName:"transform",target:en,targetName:"Mat3"}]),nt(en.prototype,"Mat3",[{name:"sub",newName:"subtract",target:en.prototype,targetName:"Mat3"},{name:"mul",newName:"multiply",target:en.prototype,targetName:"Mat3"},{name:"mulScalar",newName:"multiplyScalar",target:en.prototype,targetName:"Mat3"},{name:"exactEquals",newName:"strictEquals",target:en.prototype,targetName:"Mat3"}]),nt(fn,"Mat4",[{name:"sub",newName:"subtract",target:fn,targetName:"Mat4"},{name:"mul",newName:"multiply",target:fn,targetName:"Mat4"},{name:"exactEquals",newName:"strictEquals",target:fn,targetName:"Mat4"}]),nt(fn.prototype,"Mat4",[{name:"sub",newName:"subtract",target:fn.prototype,targetName:"Mat4"},{name:"mul",newName:"multiply",target:fn.prototype,targetName:"Mat4"},{name:"mulScalar",newName:"multiplyScalar",target:fn.prototype,targetName:"Mat4"},{name:"exactEquals",newName:"strictEquals",target:fn.prototype,targetName:"Mat4"}]),function(t){t[t.VEC2=0]="VEC2",t[t.VEC3=1]="VEC3",t[t.VEC4=2]="VEC4",t[t.QUATERNION=3]="QUATERNION",t[t.MAT3=4]="MAT3",t[t.MAT4=5]="MAT4",t[t.SIZE=6]="SIZE",t[t.RECT=7]="RECT",t[t.COLOR=8]="COLOR"}(gn||(gn={}));var Sn=t("aC",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,f=Math.min(s,o,u,c),d=Math.max(s,o,u,c),p=Math.min(a,h,l,_),m=Math.max(a,h,l,_);t.x=f,t.y=p,t.width=d-f,t.height=m-p},t.transformObb=function(t,e,i,n,r,s,a){void 0===a&&(a=!0);var o=s.a*r.x+s.c*r.y+s.tx,h=s.b*r.x+s.d*r.y+s.ty,u=s.a*r.width,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=Sn;var An=t("aD",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 Tn(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),new An(t,e)}An.ZERO=Object.freeze(new An(0,0)),An.ONE=Object.freeze(new An(1,1)),fi.fastDefine("cc.Size",An,{width:0,height:0}),v.size=Tn,v.Size=An;var En=t("aF",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,f=Math.min(s,o,u,c),d=Math.max(s,o,u,c),p=Math.min(a,h,l,_),m=Math.max(a,h,l,_);return this.x=f,this.y=p,this.width=d-f,this.height=m-p,this},i.transformMat4ToPoints=function(t,e,i,n,r){var s=this.x,a=this.y,o=s+this.width,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 yn(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 yn(this.x,this.y)},set:function(t){this.x=t.x,this.y=t.y}},{key:"size",get:function(){return new An(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 bn(t,e,i,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),new En(t,e,i,n)}fi.fastDefine("cc.Rect",En,{x:0,y:0,width:0,height:0}),v.Rect=En,v.rect=bn;var xn=t("b5",Float64Array),Cn=t("b6",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)),Rn=Object.freeze({__proto__:null,bits:R,Vec2:yn,v2:vn,Vec3:Yi,v3:qi,Vec4:zi,v4:Hi,Quat:sn,quat:cn,Mat3:en,Mat4:fn,mat4:mn,AffineTransform:Sn,Size:An,size:Tn,Rect:En,rect:bn,Color:Zi,color:$i,preTransforms:_n,HALF_PI:vi,TWO_PI:Si,EPSILON:Ai,equals:Ti,approx:Ei,clamp:bi,clamp01:xi,lerp:Ci,toRadian:Ri,toDegree:wi,random:Ii,randomRange:Bi,randomRangeInt:Di,pseudoRandom:Pi,pseudoRandomRange:Oi,pseudoRandomRangeInt:Mi,nextPow2:Ni,repeat:Li,pingPong:Fi,inverseLerp:ki,absMaxComponent:Gi,absMax:Vi,enumerableProps:Ui,MATH_FLOAT_ARRAY:xn,MathBase:Cn});t("al",Rn);var wn=new Yi,In=new Yi,Bn=new Yi,Dn=new Yi,Pn=new Yi,On=new Yi,Mn=new Array(3),Nn=new Array(3);function Ln(t,e){return Yi.dot(e.n,t)-e.d}function Fn(t,e,i){return Yi.copy(t,e),Yi.subtract(Pn,i.center,i.halfExtents),Yi.add(On,i.center,i.halfExtents),t.x=t.x<Pn.x?Pn.x:t.x,t.y=t.y<Pn.y?Pn.y:t.y,t.z=t.z<Pn.z?Pn.z:t.z,t.x=t.x>On.x?On.x:t.x,t.y=t.y>On.y?On.y:t.y,t.z=t.z>On.z?On.z:t.z,t}function kn(t,e,i){Yi.set(wn,i.orientation.m00,i.orientation.m01,i.orientation.m02),Yi.set(In,i.orientation.m03,i.orientation.m04,i.orientation.m05),Yi.set(Bn,i.orientation.m06,i.orientation.m07,i.orientation.m08),Mn[0]=wn,Mn[1]=In,Mn[2]=Bn,Nn[0]=i.halfExtents.x,Nn[1]=i.halfExtents.y,Nn[2]=i.halfExtents.z,Yi.subtract(Dn,e,i.center),Yi.set(t,i.center.x,i.center.y,i.center.z);for(var n=0;n<3;n++){var r=Yi.dot(Dn,Mn[n]);r>Nn[n]&&(r=Nn[n]),r<-Nn[n]&&(r=-Nn[n]),t.x+=r*Mn[n].x,t.y+=r*Mn[n].y,t.z+=r*Mn[n].z}return t}var Gn=Object.freeze({__proto__:null,point_plane:Ln,pt_point_plane:function(t,e,i){var n=Ln(e,i);return Yi.subtract(t,e,Yi.multiplyScalar(t,i.n,n))},pt_point_aabb:Fn,pt_point_obb:kn,pt_point_line:function(t,e,i,n){Yi.subtract(wn,i,n);var r=wn.clone(),s=Yi.lengthSqr(r);if(0===s)Yi.copy(t,i);else{Yi.subtract(wn,e,i);var a=Yi.dot(wn,r)/s;a<0?Yi.copy(t,i):a>1?Yi.copy(t,n):Yi.scaleAndAdd(t,i,r,a)}}}),Vn={SHAPE_RAY:1,SHAPE_LINE:2,SHAPE_SPHERE:4,SHAPE_AABB:8,SHAPE_OBB:16,SHAPE_PLANE:32,SHAPE_TRIANGLE:64,SHAPE_FRUSTUM:128,SHAPE_FRUSTUM_ACCURATE:256,SHAPE_CAPSULE:512,SHAPE_SPLINE:1024},Un=function(){function t(t,e,i,n,r,s){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=-1),this.s=void 0,this.e=void 0,this._type=void 0,this._type=Vn.SHAPE_LINE,this.s=new Yi(t,e,i),this.e=new Yi(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 Yi.copy(t.s,e.s),Yi.copy(t.e,e.e),t},t.fromPoints=function(t,e,i){return Yi.copy(t.s,e),Yi.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 Yi.distance(t.s,t.e)},t.prototype.length=function(){return Yi.distance(this.s,this.e)},n(t,[{key:"type",get:function(){return this._type}}]),t}(),zn=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=Vn.SHAPE_RAY,this.o=new Yi(t,e,i),this.d=new Yi(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 Yi.copy(t.o,e.o),Yi.copy(t.d,e.d),t},t.fromPoints=function(t,e,i){return Yi.copy(t.o,e),Yi.normalize(t.d,Yi.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){Yi.normalize(t,this.d),Yi.scaleAndAdd(t,this.o,t,e)},n(t,[{key:"type",get:function(){return this._type}}]),t}(),Hn=new Yi,Wn=new Yi,Xn=new Yi,jn=new Yi;function Yn(t){return Math.max(Math.max(t.x,t.y),t.z)}var qn,Kn,Jn,Qn,Zn,$n=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 Yi(0,0,0),this._radius=0,this._type=void 0,this._type=Vn.SHAPE_SPHERE,this._center=new Yi(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 Yi.copy(t.center,e.center),t.radius=e.radius,t},t.fromPoints=function(t,e,i){return Yi.multiplyScalar(t.center,Yi.add(Hn,e,i),.5),t.radius=.5*Yi.subtract(Hn,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){Yi.set(t,this.center.x-this.radius,this.center.y-this.radius,this.center.z-this.radius),Yi.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){Yi.transformMat4(r.center,this.center,t),r.radius=this.radius*Yn(n)},e.translateAndRotate=function(t,e,i){Yi.transformMat4(i.center,this.center,t)},e.setScale=function(t,e){e.radius=this.radius*Yn(t)},e.mergePoint=function(t){this.radius<0&&(this.center.set(t),this.radius=0),Yi.subtract(Wn,t,this.center);var e=Wn.length();if(e>this.radius){var i=.5*(e-this.radius);this.radius+=i,Yi.multiplyScalar(Wn,Wn,i/e),Yi.add(this.center,this.center,Wn)}},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(Xn,jn),this.mergePoint(Xn),this.mergePoint(jn)},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=Yi.dot(t.d,e.n);if(Math.abs(i)<Number.EPSILON)return 0;var n=-Ln(t.o,e)/i;return n<0?0:n},er=(qn=new Yi(0,0,0),Kn=new Yi(0,0,0),Jn=new Yi(0,0,0),Qn=new Yi(0,0,0),Zn=new Yi(0,0,0),function(t,e,i){Yi.subtract(qn,e.b,e.a),Yi.subtract(Kn,e.c,e.a),Yi.cross(Jn,t.d,Kn);var n=Yi.dot(qn,Jn);if(n<Number.EPSILON&&(!i||n>-Number.EPSILON))return 0;var r=1/n;Yi.subtract(Qn,t.o,e.a);var s=Yi.dot(Qn,Jn)*r;if(s<0||s>1)return 0;Yi.cross(Zn,Qn,qn);var a=Yi.dot(t.d,Zn)*r;if(a<0||s+a>1)return 0;var o=Yi.dot(Kn,Zn)*r;return o<0?0:o}),ir=function(){var t=new Yi(0,0,0);return function(e,i){var n=i.radius,r=i.center,s=e.o,a=e.d,o=n*n;Yi.subtract(t,r,s);var h=t.lengthSqr(),u=Yi.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:_}}(),nr=function(){var t=new Yi,e=new Yi;return function(i,n){return Yi.subtract(t,n.center,n.halfExtents),Yi.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,f=(i.z-n.z)*o,d=Math.max(Math.max(Math.min(h,u),Math.min(l,c)),Math.min(_,f)),p=Math.min(Math.min(Math.max(h,u),Math.max(l,c)),Math.max(_,f));return p<0||d>p?0:d>0?d:p}(i,t,e)}}(),rr=function(){var t=new Yi,e=new Yi,i=new Yi,n=new Yi,r=new Yi,s=new Yi,a=new Yi,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,Yi.set(n,_.orientation.m00,_.orientation.m01,_.orientation.m02),Yi.set(r,_.orientation.m03,_.orientation.m04,_.orientation.m05),Yi.set(s,_.orientation.m06,_.orientation.m07,_.orientation.m08),Yi.subtract(a,t,e),h[0]=Yi.dot(n,i),h[1]=Yi.dot(r,i),h[2]=Yi.dot(s,i),u[0]=Yi.dot(n,a),u[1]=Yi.dot(r,a),u[2]=Yi.dot(s,a);for(var f=0;f<3;++f){if(0===h[f]){if(-u[f]-o[f]>0||-u[f]+o[f]<0)return 0;h[f]=1e-7}l[2*f+0]=(u[f]+o[f])/h[f],l[2*f+1]=(u[f]-o[f])/h[f]}var d=Math.max(Math.max(Math.min(l[0],l[1]),Math.min(l[2],l[3])),Math.min(l[4],l[5])),p=Math.min(Math.min(Math.max(l[0],l[1]),Math.max(l[2],l[3])),Math.max(l[4],l[5]));return p<0||d>p?0:d>0?d:p}}(),sr=function(){var t=new Yi,e=new Yi,i=new Yi,n=new Yi,r=new Yi,s=new Yi,a=new Yi,o=new $n;return function(h,u){var l=u.ellipseCenter0,c=u.ellipseCenter1,_=Yi.subtract(e,c,l);if(_.length()<Ai)return o.radius=u.radius,o.center.set(u.ellipseCenter0),Hr.raySphere(h,o);var f=h.o,d=Yi.subtract(i,f,l),p=Yi.normalize(t,h.d),m=Yi.cross(n,p,_),g=m.lengthSqr();if(0===g){o.radius=u.radius;var y=Yi.subtract(r,c,f);return d.lengthSqr()<y.lengthSqr()?o.center.set(l):o.center.set(c),Hr.raySphere(h,o)}var v=Yi.cross(r,d,_),S=_.lengthSqr(),A=2*Yi.dot(m,v),T=u.radius*u.radius,E=A*A-4*g*(v.lengthSqr()-T*S);if(E<0)return 0;var b=(-A-Math.sqrt(E))/(2*g);if(b<0){o.radius=u.radius;var x=Yi.subtract(s,c,f);return d.lengthSqr()<x.lengthSqr()?o.center.set(u.ellipseCenter0):o.center.set(u.ellipseCenter1),Hr.raySphere(h,o)}var C=Yi.scaleAndAdd(s,h.o,p,b),R=Yi.subtract(a,C,l),w=Yi.dot(R,_)/S;return w>=0&&w<=1?b:w<0?(o.radius=u.radius,o.center.set(u.ellipseCenter0),Hr.raySphere(h,o)):w>1?(o.radius=u.radius,o.center.set(u.ellipseCenter1),Hr.raySphere(h,o)):0}}(),ar=function(){var t=new Yi(0,0,0);return function(e,i){Yi.subtract(t,e.e,e.s);var n=-Ln(e.s,i)/Yi.dot(t,i.n);return n<0||n>1?0:n}}(),or=function(){var t=new Yi(0,0,0),e=new Yi(0,0,0),i=new Yi(0,0,0),n=new Yi(0,0,0),r=new Yi(0,0,0),s=new Yi(0,0,0);return function(a,o,h){Yi.subtract(t,o.b,o.a),Yi.subtract(e,o.c,o.a),Yi.subtract(i,a.s,a.e),Yi.cross(r,t,e);var u=Yi.dot(i,r);if(u<=0)return 0;Yi.subtract(n,a.s,o.a);var l=Yi.dot(n,r);if(l<0||l>u)return 0;Yi.cross(s,i,n);var c=Yi.dot(e,s);if(c<0||c>u)return 0;var _=-Yi.dot(t,s);if(_<0||c+_>u)return 0;if(h){var f=1/u,d=1-(c*=f)-(_*=f);Yi.set(h,o.a.x*d+o.b.x*c+o.c.x*_,o.a.y*d+o.b.y*c+o.c.y*_,o.a.z*d+o.b.z*c+o.c.z*_)}return 1}}(),hr=new zn;function ur(t,e){hr.o.set(t.s),Yi.subtract(hr.d,t.e,t.s),hr.d.normalize();var i=nr(hr,e);return i<=t.length()?i:0}function lr(t,e){hr.o.set(t.s),Yi.subtract(hr.d,t.e,t.s),hr.d.normalize();var i=rr(hr,e);return i<=t.length()?i:0}function cr(t,e){hr.o.set(t.s),Yi.subtract(hr.d,t.e,t.s),hr.d.normalize();var i=ir(hr,e);return i<=t.length()?i:0}var _r,fr,dr,pr,mr=(_r=new Yi,fr=new Yi,dr=new Yi,pr=new Yi,function(t,e){return Yi.subtract(_r,t.center,t.halfExtents),Yi.add(fr,t.center,t.halfExtents),Yi.subtract(dr,e.center,e.halfExtents),Yi.add(pr,e.center,e.halfExtents),_r.x<=pr.x&&fr.x>=dr.x&&_r.y<=pr.y&&fr.y>=dr.y&&_r.z<=pr.z&&fr.z>=dr.z});function gr(t,e,i,n,r,s){Yi.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),Yi.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),Yi.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),Yi.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),Yi.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),Yi.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),Yi.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),Yi.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 yr(t,e){for(var i=Yi.dot(e,t[0]),n=i,r=1;r<8;++r){var s=Yi.dot(e,t[r]);i=s<i?s:i,n=s>n?s:n}return[i,n]}var vr,Sr,Ar,Tr,Er,br=function(){for(var t=new Array(15),e=0;e<15;e++)t[e]=new Yi(0,0,0);for(var i=new Array(8),n=new Array(8),r=0;r<8;r++)i[r]=new Yi(0,0,0),n[r]=new Yi(0,0,0);var s=new Yi,a=new Yi;return function(e,r){Yi.set(t[0],1,0,0),Yi.set(t[1],0,1,0),Yi.set(t[2],0,0,1),Yi.set(t[3],r.orientation.m00,r.orientation.m01,r.orientation.m02),Yi.set(t[4],r.orientation.m03,r.orientation.m04,r.orientation.m05),Yi.set(t[5],r.orientation.m06,r.orientation.m07,r.orientation.m08);for(var o=0;o<3;++o)Yi.cross(t[6+3*o],t[o],t[3]),Yi.cross(t[7+3*o],t[o],t[4]),Yi.cross(t[7+3*o],t[o],t[5]);Yi.subtract(s,e.center,e.halfExtents),Yi.add(a,e.center,e.halfExtents),function(t,e,i){Yi.set(i[0],t.x,e.y,e.z),Yi.set(i[1],t.x,e.y,t.z),Yi.set(i[2],t.x,t.y,e.z),Yi.set(i[3],t.x,t.y,t.z),Yi.set(i[4],e.x,e.y,e.z),Yi.set(i[5],e.x,e.y,t.z),Yi.set(i[6],e.x,t.y,e.z),Yi.set(i[7],e.x,t.y,t.z)}(s,a,i),gr(r.center,r.halfExtents,t[3],t[4],t[5],n);for(var h=0;h<15;++h){var u=yr(i,t[h]),l=yr(n,t[h]);if(l[0]>u[1]||u[0]>l[1])return 0}return 1}}(),Cr=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=Yi.dot(e.n,t.center);return n+i<e.d?-1:n-i>e.d?0:1},Rr=function(t,e){for(var i=0;i<e.planes.length;i++)if(-1===Cr(t,e.planes[i]))return 0;return 1},wr=function(){for(var t=new Array(8),e=0,i=0,n=0;n<t.length;n++)t[n]=new Yi(0,0,0);return function(n,r){for(var s=0,a=!1,o=0;o<r.planes.length;o++){if(-1===(s=Cr(n,r.planes[o])))return 0;1===s&&(a=!0)}if(!a)return 1;for(var h=0;h<r.vertices.length;h++)Yi.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}}(),Ir=(vr=new Yi(0,0,0),Sr=new en,function(t,e){return Yi.subtract(vr,e,t.center),Yi.transformMat3(vr,vr,en.transpose(Sr,t.orientation)),i=vr,n=t.halfExtents,Math.abs(i.x)<n.x&&Math.abs(i.y)<n.y&&Math.abs(i.z)<n.z;var i,n}),Br=(Ar=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*Ar(e.n,t.orientation.m00,t.orientation.m01,t.orientation.m02)+t.halfExtents.y*Ar(e.n,t.orientation.m03,t.orientation.m04,t.orientation.m05)+t.halfExtents.z*Ar(e.n,t.orientation.m06,t.orientation.m07,t.orientation.m08),n=Yi.dot(e.n,t.center);return n+i<e.d?-1:n-i>e.d?0:1}),Dr=function(t,e){for(var i=0;i<e.planes.length;i++)if(-1===Br(t,e.planes[i]))return 0;return 1},Pr=function(){for(var t=new Array(8),e=0,i=0,n=0,r=0;r<t.length;r++)t[r]=new Yi(0,0,0);var s=function(t,e,i,n){return t.x*e+t.y*i+t.z*n};return function(r,a){for(var o=0,h=!1,u=0;u<a.planes.length;u++){if(-1===(o=Br(r,a.planes[u])))return 0;1===o&&(h=!0)}if(!h)return 1;for(var l=0;l<a.vertices.length;l++)Yi.subtract(t[l],a.vertices[l],r.center);i=0,n=0;for(var c=0;c<a.vertices.length;c++)(e=s(t[c],r.orientation.m00,r.orientation.m01,r.orientation.m02))>r.halfExtents.x?i++:e<-r.halfExtents.x&&n++;if(i===a.vertices.length||n===a.vertices.length)return 0;i=0,n=0;for(var _=0;_<a.vertices.length;_++)(e=s(t[_],r.orientation.m03,r.orientation.m04,r.orientation.m05))>r.halfExtents.y?i++:e<-r.halfExtents.y&&n++;if(i===a.vertices.length||n===a.vertices.length)return 0;i=0,n=0;for(var f=0;f<a.vertices.length;f++)(e=s(t[f],r.orientation.m06,r.orientation.m07,r.orientation.m08))>r.halfExtents.z?i++:e<-r.halfExtents.z&&n++;return i===a.vertices.length||n===a.vertices.length?0:1}}(),Or=function(){for(var t=new Array(15),e=0;e<15;e++)t[e]=new Yi(0,0,0);for(var i=new Array(8),n=new Array(8),r=0;r<8;r++)i[r]=new Yi(0,0,0),n[r]=new Yi(0,0,0);return function(e,r){Yi.set(t[0],e.orientation.m00,e.orientation.m01,e.orientation.m02),Yi.set(t[1],e.orientation.m03,e.orientation.m04,e.orientation.m05),Yi.set(t[2],e.orientation.m06,e.orientation.m07,e.orientation.m08),Yi.set(t[3],r.orientation.m00,r.orientation.m01,r.orientation.m02),Yi.set(t[4],r.orientation.m03,r.orientation.m04,r.orientation.m05),Yi.set(t[5],r.orientation.m06,r.orientation.m07,r.orientation.m08);for(var s=0;s<3;++s)Yi.cross(t[6+3*s],t[s],t[3]),Yi.cross(t[7+3*s],t[s],t[4]),Yi.cross(t[8+3*s],t[s],t[5]);gr(e.center,e.halfExtents,t[0],t[1],t[2],i),gr(r.center,r.halfExtents,t[3],t[4],t[5],n);for(var a=0;a<15;++a){var o=yr(i,t[a]),h=yr(n,t[a]);if(h[0]>o[1]||o[0]>h[1])return 0}return 1}}(),Mr=function(){for(var t=new $n,e=new Yi,i=new Yi,n=new Yi,r=new Array(8),s=0;s<8;s++)r[s]=new Yi;for(var a=new Array(8),o=0;o<8;o++)a[o]=new Yi;return function(s,o){if(0===Yi.squaredDistance(o.ellipseCenter0,o.ellipseCenter1))return t.radius=o.radius,t.center.set(o.ellipseCenter0),Hr.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,gr(s.center,s.halfExtents,e,i,n,r);var h=a,u=Yi.copy(h[0],e),l=Yi.copy(h[1],i),c=Yi.copy(h[2],n);Yi.subtract(h[3],o.center,s.center).normalize();var _=Yi.subtract(h[4],o.ellipseCenter0,o.ellipseCenter1);_.normalize(),Yi.cross(h[5],u,_),Yi.cross(h[6],l,_),Yi.cross(h[7],c,_);for(var f=0;f<8;++f){var d=yr(r,h[f]),p=Yi.dot(h[f],o.ellipseCenter0),m=Yi.dot(h[f],o.ellipseCenter1),g=Math.max(p,m),y=Math.min(p,m)-o.radius,v=g+o.radius;if(y>d[1]||d[0]>v)return 0}return 1}}(),Nr=function(t,e){var i=Yi.dot(e.n,t.center),n=t.radius*e.n.length();return i+n<e.d?-1:i-n>e.d?0:1},Lr=function(t,e){for(var i=0;i<e.planes.length;i++)if(-1===Nr(t,e.planes[i]))return 0;return 1},Fr=(Tr=new Yi(0,0,0),Er=[1,-1,1,-1,1,-1],function(t,e){for(var i=0;i<6;i++){var n=e.planes[i],r=t.radius,s=t.center,a=n.n,o=n.d,h=Yi.dot(a,s);if(h+r<o)return 0;if(!(h-r>o)){Yi.add(Tr,s,Yi.multiplyScalar(Tr,a,r));for(var u=0;u<6;u++)if(u!==i&&u!==i+Er[i]){var l=e.planes[u];if(Yi.dot(l.n,Tr)<l.d)return 0}}}return 1}),kr=function(t,e){var i=t.radius+e.radius;return Yi.squaredDistance(t.center,e.center)<i*i},Gr=function(){var t=new Yi;return function(e,i){return Fn(t,e.center,i),Yi.squaredDistance(e.center,t)<e.radius*e.radius}}(),Vr=function(){var t=new Yi;return function(e,i){return kn(t,e.center,i),Yi.squaredDistance(e.center,t)<e.radius*e.radius}}(),Ur=function(){var t=new Yi,e=new Yi;return function(i,n){var r=i.radius+n.radius,s=r*r,a=Yi.squaredDistance(n.ellipseCenter0,n.ellipseCenter1);if(0===a)return Yi.squaredDistance(i.center,n.center)<s;Yi.subtract(t,i.center,n.ellipseCenter0),Yi.subtract(e,n.ellipseCenter1,n.ellipseCenter0);var o=Yi.dot(t,e)/a;return o<0?Yi.squaredDistance(i.center,n.ellipseCenter0)<s:o>1?Yi.squaredDistance(i.center,n.ellipseCenter1)<s:(Yi.scaleAndAdd(t,n.ellipseCenter0,e,o),Yi.squaredDistance(i.center,t)<s)}}(),zr=function(){var t=new Yi,e=new Yi,i=new Yi,n=new Yi,r=new Yi,s=new Yi;return function(a,o){var h,u,l=Yi.subtract(t,a.ellipseCenter1,a.ellipseCenter0),c=Yi.subtract(e,o.ellipseCenter1,o.ellipseCenter0),_=Yi.subtract(i,a.ellipseCenter0,o.ellipseCenter0),f=Yi.dot(l,l),d=Yi.dot(l,c),p=Yi.dot(c,c),m=Yi.dot(l,_),g=Yi.dot(c,_),y=f*p-d*d,v=y,S=y;y<Ai?(h=0,v=1,u=g,S=p):(u=f*g-d*m,(h=d*g-p*m)<0?(h=0,u=g,S=p):h>v&&(h=v,u=g+d,S=p)),u<0?(u=0,-m<0?h=0:-m>f?h=v:(h=-m,v=f)):u>S&&(u=S,-m+d<0?h=0:-m+d>f?h=v:(h=-m+d,v=f));var A=Math.abs(h)<Ai?0:h/v,T=Math.abs(u)<Ai?0:u/S,E=n;E.set(_),E.add(Yi.multiplyScalar(r,l,A)),E.subtract(Yi.multiplyScalar(s,c,T));var b=a.radius+o.radius;return E.lengthSqr()<b*b}}(),Hr={raySphere:ir,rayAABB:nr,rayOBB:rr,rayPlane:tr,rayTriangle:er,rayCapsule:sr,raySubMesh:null,rayMesh:null,rayModel:null,lineSphere:cr,lineAABB:ur,lineOBB:lr,linePlane:ar,lineTriangle:or,sphereWithSphere:kr,sphereAABB:Gr,sphereOBB:Vr,spherePlane:Nr,sphereFrustum:Lr,sphereFrustumAccurate:Fr,sphereCapsule:Ur,aabbWithAABB:mr,aabbWithOBB:br,aabbPlane:Cr,aabbFrustum:Rr,aabbFrustumAccurate:wr,obbWithOBB:Or,obbPlane:Br,obbFrustum:Dr,obbFrustumAccurate:Pr,obbPoint:Ir,obbCapsule:Mr,aabbFrustumCompletelyInside:function(t,e){for(var i=0;i<e.planes.length;i++)if(0!==Cr(t,e.planes[i]))return 0;return 1},capsuleWithCapsule:zr,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)}};Hr[Vn.SHAPE_RAY|Vn.SHAPE_SPHERE]=ir,Hr[Vn.SHAPE_RAY|Vn.SHAPE_AABB]=nr,Hr[Vn.SHAPE_RAY|Vn.SHAPE_OBB]=rr,Hr[Vn.SHAPE_RAY|Vn.SHAPE_PLANE]=tr,Hr[Vn.SHAPE_RAY|Vn.SHAPE_TRIANGLE]=er,Hr[Vn.SHAPE_RAY|Vn.SHAPE_CAPSULE]=sr,Hr[Vn.SHAPE_LINE|Vn.SHAPE_SPHERE]=cr,Hr[Vn.SHAPE_LINE|Vn.SHAPE_AABB]=ur,Hr[Vn.SHAPE_LINE|Vn.SHAPE_OBB]=lr,Hr[Vn.SHAPE_LINE|Vn.SHAPE_PLANE]=ar,Hr[Vn.SHAPE_LINE|Vn.SHAPE_TRIANGLE]=or,Hr[Vn.SHAPE_SPHERE]=kr,Hr[Vn.SHAPE_SPHERE|Vn.SHAPE_AABB]=Gr,Hr[Vn.SHAPE_SPHERE|Vn.SHAPE_OBB]=Vr,Hr[Vn.SHAPE_SPHERE|Vn.SHAPE_PLANE]=Nr,Hr[Vn.SHAPE_SPHERE|Vn.SHAPE_FRUSTUM]=Lr,Hr[Vn.SHAPE_SPHERE|Vn.SHAPE_FRUSTUM_ACCURATE]=Fr,Hr[Vn.SHAPE_SPHERE|Vn.SHAPE_CAPSULE]=Ur,Hr[Vn.SHAPE_AABB]=mr,Hr[Vn.SHAPE_AABB|Vn.SHAPE_OBB]=br,Hr[Vn.SHAPE_AABB|Vn.SHAPE_PLANE]=Cr,Hr[Vn.SHAPE_AABB|Vn.SHAPE_FRUSTUM]=Rr,Hr[Vn.SHAPE_AABB|Vn.SHAPE_FRUSTUM_ACCURATE]=wr,Hr[Vn.SHAPE_OBB]=Or,Hr[Vn.SHAPE_OBB|Vn.SHAPE_PLANE]=Br,Hr[Vn.SHAPE_OBB|Vn.SHAPE_FRUSTUM]=Dr,Hr[Vn.SHAPE_OBB|Vn.SHAPE_FRUSTUM_ACCURATE]=Pr,Hr[Vn.SHAPE_OBB|Vn.SHAPE_CAPSULE]=Mr,Hr[Vn.SHAPE_CAPSULE]=zr,nt(Un.prototype,"line",[{name:"mag",newName:"len"},{name:"magnitude",newName:"len"}]),rt(Hr,"intersect",[{name:"line_quad"}]);var Wr=new Yi(0,0,0),Xr=new Yi(0,0,0),jr=v.mat4(),Yr=v.v4(),qr=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=Vn.SHAPE_PLANE,this.n=new Yi(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 Yi.copy(t.n,e.n),t.d=e.d,t},t.fromPoints=function(t,e,i,n){return Yi.subtract(Wr,i,e),Yi.subtract(Xr,n,e),Yi.normalize(t.n,Yi.cross(t.n,Wr,Xr)),t.d=Yi.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 Yi.copy(t.n,e),t.d=Yi.dot(e,i),t},t.normalize=function(t,e){var i=e.n.length();return Yi.normalize(t.n,e.n),i>0&&(t.d=e.d/i),t},t.prototype.transform=function(t){fn.invert(jr,t),fn.transpose(jr,jr),zi.set(Yr,this.n.x,this.n.y,this.n.z,-this.d),zi.transformMat4(Yr,Yr,jr),Yi.set(this.n,Yr.x,Yr.y,Yr.z),this.d=-Yr.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}(),Kr=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=Vn.SHAPE_TRIANGLE,this.a=new Yi(t,e,i),this.b=new Yi(n,r,s),this.c=new Yi(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 Yi.copy(t.a,e.a),Yi.copy(t.b,e.b),Yi.copy(t.c,e.c),t},t.fromPoints=function(t,e,i,n){return Yi.copy(t.a,e),Yi.copy(t.b,i),Yi.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}(),Jr=new Yi,Qr=new Yi,Zr=new Yi,$r=new Yi,ts=new en,es=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),Yi.transformMat3(t,e,ts)},is=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=Vn.SHAPE_AABB,this.center=new Yi(t,e,i),this.halfExtents=new Yi(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 Yi.copy(t.center,e.center),Yi.copy(t.halfExtents,e.halfExtents),t},t.fromPoints=function(t,e,i){return Yi.add(Jr,i,e),Yi.subtract(Qr,i,e),Yi.multiplyScalar(t.center,Jr,.5),Yi.multiplyScalar(t.halfExtents,Qr,.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 Yi.subtract(Jr,i.center,i.halfExtents),Yi.subtract(Qr,n.center,n.halfExtents),Yi.add(Zr,i.center,i.halfExtents),Yi.add($r,n.center,n.halfExtents),Yi.max($r,Zr,$r),Yi.min(Zr,Jr,Qr),t.fromPoints(e,Zr,$r)},t.toBoundingSphere=function(t,e){return t.center.set(e.center),t.radius=e.halfExtents.length(),t},t.transform=function(t,e,i){return Yi.transformMat4(t.center,e.center,i),es(t.halfExtents,e.halfExtents,i),t};var e=t.prototype;return e.getBoundary=function(t,e){Yi.subtract(t,this.center,this.halfExtents),Yi.add(e,this.center,this.halfExtents)},e.transform=function(t,e,i,n,r){Yi.transformMat4(r.center,this.center,t),es(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(Jr,Qr),t.x<Jr.x&&(Jr.x=t.x),t.y<Jr.y&&(Jr.y=t.y),t.z<Jr.z&&(Jr.z=t.z),t.x>Qr.x&&(Qr.x=t.x),t.y>Qr.y&&(Qr.y=t.y),t.z>Qr.z&&(Qr.z=t.z),Yi.add(Zr,Jr,Qr),this.center.set(Yi.multiplyScalar(Zr,Zr,.5)),this.halfExtents.set(Qr.x-Zr.x,Qr.y-Zr.y,Qr.z-Zr.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}(),ns=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=Vn.SHAPE_CAPSULE,this.radius=t,this.halfHeight=e,this.axis=i,this.center=new Yi,this.rotation=new sn,this.ellipseCenter0=new Yi(0,e,0),this.ellipseCenter1=new Yi(0,-e,0),this.updateCache()}var e=t.prototype;return e.transform=function(t,e,i,n,r){var s=n,a=Gi(s);r.radius=this.radius*Math.abs(a);var o=(this.halfHeight+this.radius)*Math.abs(s.y)-r.radius;o<0&&(o=0),r.halfHeight=o,Yi.transformMat4(r.center,this.center,t),sn.multiply(r.rotation,this.rotation,i),r.updateCache()},e.updateCache=function(){this.updateLocalCenter(),Yi.transformQuat(this.ellipseCenter0,this.ellipseCenter0,this.rotation),Yi.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 Yi(1,1,1),rs[1]=new Yi(-1,1,1),rs[2]=new Yi(-1,-1,1),rs[3]=new Yi(1,-1,1),rs[4]=new Yi(1,1,-1),rs[5]=new Yi(-1,1,-1),rs[6]=new Yi(-1,-1,-1),rs[7]=new Yi(1,-1,-1);var ss,as=new Yi,os=new Yi,hs=new Yi,us=function(){e.createOrthographic=function(t,e,i,n,r,s){var a=e/2,o=i/2;Yi.set(hs,a,o,-n),Yi.transformMat4(t.vertices[0],hs,s),Yi.set(hs,-a,o,-n),Yi.transformMat4(t.vertices[1],hs,s),Yi.set(hs,-a,-o,-n),Yi.transformMat4(t.vertices[2],hs,s),Yi.set(hs,a,-o,-n),Yi.transformMat4(t.vertices[3],hs,s),Yi.set(hs,a,o,-r),Yi.transformMat4(t.vertices[4],hs,s),Yi.set(hs,-a,o,-r),Yi.transformMat4(t.vertices[5],hs,s),Yi.set(hs,-a,-o,-r),Yi.transformMat4(t.vertices[6],hs,s),Yi.set(hs,a,-o,-r),Yi.transformMat4(t.vertices[7],hs,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;as.set(n*o,n*a,n),os.set(r*o,r*a,r);var h=t.vertices;hs.set(as.x,as.y,-as.z),Yi.transformMat4(h[0],hs,s),hs.set(-as.x,as.y,-as.z),Yi.transformMat4(h[1],hs,s),hs.set(-as.x,-as.y,-as.z),Yi.transformMat4(h[2],hs,s),hs.set(as.x,-as.y,-as.z),Yi.transformMat4(h[3],hs,s),hs.set(os.x,os.y,-os.z),Yi.transformMat4(h[4],hs,s),hs.set(-os.x,os.y,-os.z),Yi.transformMat4(h[5],hs,s),hs.set(-os.x,-os.y,-os.z),Yi.transformMat4(h[6],hs,s),hs.set(os.x,-os.y,-os.z),Yi.transformMat4(h[7],hs,s),t.updatePlanes()},e.createFromAABB=function(t,e){var i=new Yi,n=new Yi;return Yi.subtract(i,e.center,e.halfExtents),Yi.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=Vn.SHAPE_FRUSTUM,this.planes=new Array(6);for(var t=0;t<6;++t)this.planes[t]=qr.create(0,0,0,0);this.vertices=new Array(8);for(var e=0;e<8;++e)this.vertices[e]=new Yi}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)qr.copy(t.planes[i],e.planes[i]);for(var n=0;n<8;++n)Yi.copy(t.vertices[n],e.vertices[n]);return t},t.update=function(t,e){Yi.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),Yi.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),Yi.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),Yi.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),Yi.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),Yi.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();Yi.multiplyScalar(n.n,n.n,r),n.d*=r}for(var s=0;s<8;s++)Yi.transformMat4(this.vertices[s],rs[s],e)},t.transform=function(t){for(var e=0;e<8;e++)Yi.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++)qr.set(this.planes[e],0,0,0,0)},t.updatePlanes=function(){qr.fromPoints(this.planes[0],this.vertices[1],this.vertices[6],this.vertices[5]),qr.fromPoints(this.planes[1],this.vertices[3],this.vertices[4],this.vertices[7]),qr.fromPoints(this.planes[2],this.vertices[6],this.vertices[3],this.vertices[7]),qr.fromPoints(this.planes[3],this.vertices[0],this.vertices[5],this.vertices[4]),qr.fromPoints(this.planes[4],this.vertices[2],this.vertices[0],this.vertices[3]),qr.fromPoints(this.planes[5],this.vertices[7],this.vertices[5],this.vertices[6])},n(e,[{key:"accurate",set:function(t){this._type=t?Vn.SHAPE_FRUSTUM_ACCURATE:Vn.SHAPE_FRUSTUM}},{key:"type",get:function(){return this._type}}]),e}(),ls=new Yi,cs=new Yi,_s=new en,fs=function(){function t(t,e,i,n,r,s,a,o,h,u,l,c,_,f,d){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1),void 0===r&&(r=1),void 0===s&&(s=1),void 0===a&&(a=1),void 0===o&&(o=0),void 0===h&&(h=0),void 0===u&&(u=0),void 0===l&&(l=1),void 0===c&&(c=0),void 0===_&&(_=0),void 0===f&&(f=0),void 0===d&&(d=1),this.center=void 0,this.halfExtents=void 0,this.orientation=void 0,this._type=void 0,this._type=Vn.SHAPE_OBB,this.center=new Yi(t,e,i),this.halfExtents=new Yi(n,r,s),this.orientation=new en(a,o,h,u,l,c,_,f,d)}t.create=function(e,i,n,r,s,a,o,h,u,l,c,_,f,d,p){return new t(e,i,n,r,s,a,o,h,u,l,c,_,f,d,p)},t.clone=function(e){return new t(e.center.x,e.center.y,e.center.z,e.halfExtents.x,e.halfExtents.y,e.halfExtents.z,e.orientation.m00,e.orientation.m01,e.orientation.m02,e.orientation.m03,e.orientation.m04,e.orientation.m05,e.orientation.m06,e.orientation.m07,e.orientation.m08)},t.copy=function(t,e){return Yi.copy(t.center,e.center),Yi.copy(t.halfExtents,e.halfExtents),en.copy(t.orientation,e.orientation),t},t.fromPoints=function(t,e,i){return Yi.multiplyScalar(t.center,Yi.add(ls,e,i),.5),Yi.multiplyScalar(t.halfExtents,Yi.subtract(cs,i,e),.5),en.identity(t.orientation),t},t.set=function(t,e,i,n,r,s,a,o,h,u,l,c,_,f,d,p){return Yi.set(t.center,e,i,n),Yi.set(t.halfExtents,r,s,a),en.set(t.orientation,o,h,u,l,c,_,f,d,p),t};var e=t.prototype;return e.getBoundary=function(t,e){!function(t,e,i){_s.m00=Math.abs(i.m00),_s.m01=Math.abs(i.m01),_s.m02=Math.abs(i.m02),_s.m03=Math.abs(i.m03),_s.m04=Math.abs(i.m04),_s.m05=Math.abs(i.m05),_s.m06=Math.abs(i.m06),_s.m07=Math.abs(i.m07),_s.m08=Math.abs(i.m08),Yi.transformMat3(t,e,_s)}(ls,this.halfExtents,this.orientation),Yi.subtract(t,this.center,ls),Yi.add(e,this.center,ls)},e.transform=function(t,e,i,n,r){Yi.transformMat4(r.center,this.center,t),en.fromQuat(r.orientation,i),Yi.multiply(r.halfExtents,this.halfExtents,n)},e.translateAndRotate=function(t,e,i){Yi.transformMat4(i.center,this.center,t),en.fromQuat(i.orientation,e)},e.setScale=function(t,e){Yi.multiply(e.halfExtents,this.halfExtents,t)},n(t,[{key:"type",get:function(){return this._type}}]),t}();function ds(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}ss=Symbol.iterator;var ps,ms,gs,ys=function(){function t(){this._times=[],this._values=[]}var e=t.prototype;return e[ss]=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 ds(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 ds(this._times,t)},e.setKeyframes=function(t,e){t.length,e.length,function(t){t.every((function(t,e,i){return 0===e||t>i[e-1]||Ei(t,i[e-1],1e-6)}))}(t),this._times=t,this._values=e},e._insertNewKeyframe=function(t,e){var i=this._times,n=this._values,r=i.length,s=ds(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 vs(t){return t>-1e-9&&t<1e-9}function Ss(t,e,i,n){return i.slice().reverse().reduce((function(i,n){return n(t,e,i)||i}),n)}fi.fastDefine("cc.KeyframeCurve",ys,{_times:[],_values:[]}),t("b$",ps),function(t){t[t.LINEAR=0]="LINEAR",t[t.CONSTANT=1]="CONSTANT",t[t.CUBIC=2]="CUBIC"}(ps||t("b$",ps={})),t("c0",ms),function(t){t[t.LINEAR=0]="LINEAR",t[t.CLAMP=1]="CLAMP",t[t.LOOP=2]="LOOP",t[t.PING_PONG=3]="PING_PONG"}(ms||t("c0",ms={})),t("c1",gs),function(t){t[t.NONE=0]="NONE",t[t.LEFT=1]="LEFT",t[t.RIGHT=2]="RIGHT",t[t.BOTH=3]="BOTH"}(gs||t("c1",gs={}));var As=function(){},Ts=function(){return As},Es=bs((function(){}));function bs(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=Rs(t);if(n){var r=ws(n,"proto");ws(r,"editor")[e]=i}}(i,t,e)}}}var Cs="__ccclassCache__";function Rs(t){return ws(t,Cs)}function ws(t,e){return t[e]||(t[e]={})}var Is=bs((function(t,e){var i=Ut(t);i===Object&&(i=null);var n={name:e,extends:i,ctor:t},r=t[Cs];if(r){var s=r.proto;s&&Gt(n,s),t[Cs]=void 0}return fi(n)})),Bs=xs("requireComponent"),Ds=xs("executionOrder"),Ps=Es;function Os(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=ii(r,o));var h=Gt(e,a||r||{});o?(s.get&&(h.get=s.get),s.set&&(h.set=s.set)):Ls(t,h,i,n,s)}(function(t){return Rs(t.constructor)}(t),function(t,e){var i,n,r=ws(Rs(t.constructor),"proto"),s=ws(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?Os({type:void 0}):void 0===e?(n=t,r):void r(t,e,i)}function Ms(t){var e;try{e=t()}catch(e){return t}return"object"!=typeof e||null===e?e:t}function Ns(t,e,i){var n,r,s=Rs(t.constructor),a=ws(s,"proto"),o=ws(a,"properties"),h=null!==(r=o[n=e])&&void 0!==r?r:o[n]={};return h.__internalFlags|=ni.STANDALONE,i&&"function"!=typeof i&&(i.get||i.set)?(i.get&&(h.get=i.get),i.set&&(h.set=i.set)):Ls(s,h,t.constructor,e,i),h}function Ls(t,e,i,n,r){if(void 0!==r)"function"==typeof r?e.default=Ms(r):null===r||r.initializer&&(e.default=Ms(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 Fs=Symbol("cc:SerializationMetadata"),ks=t("cr",(function(t,e,i){Us(Ns(t,e,i))}));function Gs(t){return function(e,i,n){var r=Ns(e,i,n);r.formerlySerializedAs=t,Us(r)}}var Vs=function(t,e,i){var n=Ns(t,e,i);n.editorOnly=!0,Us(n)};function Us(t){t.__internalFlags|=ni.IMPLICIT_SERIALIZABLE}var zs=As,Hs=Es,Ws=Ts,Xs=Es,js=Ts,Ys=Ts,qs=Ts,Ks=t("cg",As),Js=t("ci",Ts),Qs=t("cj",Ts),Zs=t("ch",Ts),$s=t("cl",Ts),ta=t("cm",Ts),ea=t("cn",As),ia=t("ck",Ts),na=t("co",As),ra=ha(je),sa=ha(Ye),aa=ha(qe),oa=ha(Ke);function ha(t){return Os({type:t})}var ua=t("cp",(function(t,e,i){Ns(t,e,i).override=!0})),la=t("bA","__editorExtras__"),ca=t("bE",(function(){})),_a=Object.freeze({__proto__:null,uniquelyReferenced:zs,ccclass:Is,property:Os,requireComponent:Bs,executionOrder:Ds,disallowMultiple:Ps,executeInEditMode:Hs,menu:Ws,playOnFocus:Xs,inspector:js,icon:Ys,help:qs,type:ha,integer:ra,float:sa,boolean:aa,string:oa,editable:Ks,tooltip:Zs,visible:Js,displayName:Qs,displayOrder:ia,range:$s,rangeStep:ta,slide:ea,disallowAnimation:na,override:ua,formerlySerializedAs:Gs,serializable:ks});t("br",_a);var fa,da,pa,ma,ga,ya,va,Sa,Aa,Ta,Ea=[],ba=t("bu",function(){function t(t){void 0===t&&(t=""),this._objFlags=void 0,this._name=void 0,this._name=t,this._objFlags=0}t._deferredDestroy=function(){for(var t=Ea.length,e=0;e<t;++e){var i=Ea[e];1&i._objFlags||i._destroyImmediate()}t===Ea.length?Ea.length=0:Ea.splice(0,t)};var e=t.prototype;return e.destroy=function(){return 1&this._objFlags?(q(5e3),!1):!(4&this._objFlags||(this._objFlags|=4,Ea.push(this),0))},e._destruct=function(){var t=this.constructor,e=t.__destruct__;e||(e=function(t,e){var i,n=t instanceof 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(fi._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=fi.IDENTIFIER_RE.test(i)?"o."+i+"=":"o["+fi.escapeForJS(i)+"]=";var _=s[i];""===_&&(_='""'),l+=c+_+";\n"}return Function("o",l)}(this,t),bt(t,"__destruct__",e,!0)),e(this)},e._destroyImmediate=function(){var t;1&this._objFlags?J(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 ba}function Ca(t,e){return"object"==typeof t?!(!t||t._objFlags&(e?5:1)):void 0!==t}function Ra(t,e){return(e<<3)+t}function wa(t){return Ba[t]}function Ia(t){switch(t){case Aa.Uint8:return Uint8Array;case Aa.Uint16:return Uint16Array;case Aa.Uint32:return Uint32Array;case Aa.Int8:return Int8Array;case Aa.Int16:return Int16Array;case Aa.Int32:return Int32Array;case Aa.Float32:return Float32Array;case Aa.Float64:return Float64Array}}ba.prototype._deserialize=null,fi.fastDefine("cc.Object",ba,{_name:"",_objFlags:0}),bt(ba,"Flags",{Destroyed:1,DontSave:8,EditorOnly:16,Dirty:32,DontDestroy:64,PersistentMask:-4192741,Destroying:128,Deactivating:256,LockedInEditor:512,HideInHierarchy:1024,AllHideMasks:1560,IsPreloadStarted:8192,IsOnLoadStarted:32768,IsOnLoadCalled:16384,IsOnEnableCalled:2048,IsStartCalled:65536,IsEditorOnEnableCalled:4096,IsPositionLocked:1<<21,IsRotationLocked:1<<17,IsScaleLocked:1<<18,IsAnchorLocked:1<<19,IsSizeLocked:1<<20}),v.isValid=Ca,v.Object=ba,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"}(Aa||(Aa={})),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"}(Ta||(Ta={})),t("bz",Is("cc.CompactValueTypeArray")(((va=function(){function t(){this._byteOffset=pa&&pa(),this._unitCount=ma&&ma(),this._unitElement=ga&&ga(),this._length=ya&&ya()}return t.lengthFor=function(t,e,i){return wa(e).requiredUnits*t.length*Ia(i).BYTES_PER_ELEMENT},t.compress=function(e,i,n,r,s,a){for(var o=wa(i),h=Ia(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=Ra(n,i),_._byteOffset=a,_._unitCount=u,_._length=e.length,_},t.prototype.decompress=function(t){for(var e,i={storageUnit:7&(e=this._unitElement),elementType:e>>3},n=i.storageUnit,r=wa(i.elementType),s=new(Ia(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=Aa,va.ElementType=Ta,pa=Ss((da=va).prototype,"_byteOffset",[ks],(function(){return 0})),ma=Ss(da.prototype,"_unitCount",[ks],(function(){return 0})),ga=Ss(da.prototype,"_unitElement",[ks],(function(){return Ra(Aa.Uint8,Ta.Scalar)})),ya=Ss(da.prototype,"_length",[ks],(function(){return 0})),fa=da))||fa);var Ba=((Sa={})[Ta.Scalar]={requiredUnits:1,compress:function(t,e,i){t[e]=i},decompress:function(t,e){return t[e]}},Sa[Ta.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 Yi(t[2*e],t[2*e+1])}},Sa[Ta.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 Yi(t[3*e],t[3*e+1],t[3*e+2])}},Sa[Ta.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 zi(t[4*e],t[4*e+1],t[4*e+2],t[4*e+3])}},Sa[Ta.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 sn(t[4*e],t[4*e+1],t[4*e+2],t[4*e+3])}},Sa[Ta.Mat4]={requiredUnits:16,compress:function(t,e,i){fn.toArray(t,i,16*e)},decompress:function(t,e){return fn.fromArray(new fn,t,16*e)}},Sa),Da=t("bC",Symbol("[[Serialize]]")),Pa=t("bB",Symbol("[[Deserialize]]"));function Oa(){return 0}function Ma(t){return t}function Na(t){return t*t}function La(t){return t*(2-t)}function Fa(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)}function ka(t){return t*t*t}function Ga(t){return--t*t*t+1}function Va(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)}function Ua(t){return t*t*t*t}function za(t){return 1- --t*t*t*t}function Ha(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)}function Wa(t){return t*t*t*t*t}function Xa(t){return--t*t*t*t*t+1}function ja(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)}function Ya(t){return 1===t?1:1-Math.cos(t*Math.PI/2)}function qa(t){return Math.sin(t*Math.PI/2)}function Ka(t){return.5*(1-Math.cos(Math.PI*t))}function Ja(t){return 0===t?0:Math.pow(1024,t-1)}function Qa(t){return 1===t?1:1-Math.pow(2,-10*t)}function Za(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 $a(t){return 1-Math.sqrt(1-t*t)}function to(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 io(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 no(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 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),(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 so(t){if(1===t)return 1;var e=1.70158;return t*t*((e+1)*t-e)}function ao(t){if(0===t)return 0;var e=1.70158;return--t*t*((e+1)*t+e)+1}function oo(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 ho(t){return 1-uo(1-t)}function uo(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 lo(t){return t<.5?.5*ho(2*t):.5*uo(2*t-1)+.5}function co(t){return t<=0?0:t>=1?1:t*t*(3-2*t)}function _o(t){return t<=0?0:t>=1?1:t*t*t*(t*(6*t-15)+10)}v._decorator=_a;var fo=bo(Na,La),po=bo(ka,Ga),mo=bo(Ua,za),go=bo(Wa,Xa),yo=bo(Ya,qa),vo=bo(Ja,Qa),So=bo($a,to),Ao=bo(io,no),To=bo(so,ao),Eo=bo(ho,uo);function bo(t,e){return function(i){return i<.5?e(2*i)/2:t(2*i-1)/2+.5}}var xo,Co,Ro=Object.freeze({__proto__:null,constant:Oa,linear:Ma,quadIn:Na,quadOut:La,quadInOut:Fa,cubicIn:ka,cubicOut:Ga,cubicInOut:Va,quartIn:Ua,quartOut:za,quartInOut:Ha,quintIn:Wa,quintOut:Xa,quintInOut:ja,sineIn:Ya,sineOut:qa,sineInOut:Ka,expoIn:Ja,expoOut:Qa,expoInOut:Za,circIn:$a,circOut:to,circInOut:eo,elasticIn:io,elasticOut:no,elasticInOut:ro,backIn:so,backOut:ao,backInOut:oo,bounceIn:ho,bounceOut:uo,bounceInOut:lo,smooth:co,fade:_o,quadOutIn:fo,cubicOutIn:po,quartOutIn:mo,quintOutIn:go,sineOutIn:yo,expoOutIn:vo,circOutIn:So,elasticOutIn:Ao,backOutIn:To,bounceOutIn:Eo});t("cb",Ro),t("cz",Co),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"}(Co||t("cz",Co={}));var wo,Io=((xo={})[Co.CONSTANT]=Oa,xo[Co.LINEAR]=Ma,xo[Co.QUAD_IN]=Na,xo[Co.QUAD_OUT]=La,xo[Co.QUAD_IN_OUT]=Fa,xo[Co.QUAD_OUT_IN]=fo,xo[Co.CUBIC_IN]=ka,xo[Co.CUBIC_OUT]=Ga,xo[Co.CUBIC_IN_OUT]=Va,xo[Co.CUBIC_OUT_IN]=po,xo[Co.QUART_IN]=Ua,xo[Co.QUART_OUT]=za,xo[Co.QUART_IN_OUT]=Ha,xo[Co.QUART_OUT_IN]=mo,xo[Co.QUINT_IN]=Wa,xo[Co.QUINT_OUT]=Xa,xo[Co.QUINT_IN_OUT]=ja,xo[Co.QUINT_OUT_IN]=go,xo[Co.SINE_IN]=Ya,xo[Co.SINE_OUT]=qa,xo[Co.SINE_IN_OUT]=Ka,xo[Co.SINE_OUT_IN]=yo,xo[Co.EXPO_IN]=Ja,xo[Co.EXPO_OUT]=Qa,xo[Co.EXPO_IN_OUT]=Za,xo[Co.EXPO_OUT_IN]=vo,xo[Co.CIRC_IN]=$a,xo[Co.CIRC_OUT]=to,xo[Co.CIRC_IN_OUT]=eo,xo[Co.CIRC_OUT_IN]=So,xo[Co.ELASTIC_IN]=io,xo[Co.ELASTIC_OUT]=no,xo[Co.ELASTIC_IN_OUT]=ro,xo[Co.ELASTIC_OUT_IN]=Ao,xo[Co.BACK_IN]=so,xo[Co.BACK_OUT]=ao,xo[Co.BACK_IN_OUT]=oo,xo[Co.BACK_OUT_IN]=To,xo[Co.BOUNCE_IN]=ho,xo[Co.BOUNCE_OUT]=uo,xo[Co.BOUNCE_IN_OUT]=lo,xo[Co.BOUNCE_OUT_IN]=Eo,xo[Co.SMOOTH]=co,xo[Co.FADE]=_o,xo);function Bo(t){return Io[t]}E(255),E(65280);var Do,Po,Oo,Mo=ps.LINEAR<<0|gs.NONE<<8|Co.LINEAR<<16,No=function(t){function e(){for(var e,i=arguments.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=Mo,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}(ca);function Lo(t){var e=new No;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[la];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[la]=l)}return e}fi.fastDefine("cc.RealKeyframeValue",No,((wo={interpolationMode:ps.LINEAR,tangentWeightMode:gs.NONE,value:0,rightTangent:0,rightTangentWeight:0,leftTangent:0,leftTangentWeight:0,easingMethod:Co.LINEAR})[la]=void 0,wo)),fi.Attr.setClassAttr(No,la,"editorOnly",!0),(Do=No,null!==(Oo=(Po=Do)[Fs])&&void 0!==Oo?Oo:Po[Fs]={}).uniquelyReferenced=!0;var Fo,ko=t("b_",function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).preExtrapolation=ms.CLAMP,e.postExtrapolation=ms.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===ms.CLAMP||n<2)return o.value;switch(a){case ms.LINEAR:return th(r,i[0].value,e[1],i[1].value,t);case ms.LOOP:t=Zo(t,r,s);break;case ms.PING_PONG:t=$o(t,r,s);break;default:return o.value}}else if(t>s){var h=this.postExtrapolation,u=i[n-1];if(h===ms.CLAMP||n<2)return u.value;switch(h){case ms.LINEAR:return th(s,u.value,e[n-2],i[n-2].value,t);case ms.LOOP:t=Zo(t,r,s);break;case ms.PING_PONG:t=$o(t,r,s);break;default:return u.value}}var l=ds(e,t);if(l>=0)return i[l].value;var c=~l,_=c-1,f=e[_],d=i[_],p=e[c];return function(t,e,i,n,r){var s=i-t;switch(e.interpolationMode){default:case ps.CONSTANT:return e.value;case ps.LINEAR:var a=e.easingMethod===Co.LINEAR?r:Bo(e.easingMethod)(r);return Ci(e.value,n.value,a);case ps.CUBIC:var o=1/3,h=e.rightTangent,u=e.rightTangentWeight,l=0!=(e.tangentWeightMode&gs.RIGHT),c=n.leftTangent,_=n.leftTangentWeight,f=0!=(n.tangentWeightMode&gs.LEFT);if(l||f){var d=0;if(l)d=u;else{var p=s,m=s*h;d=Math.sqrt(p*p+m*m)*o}var g=Math.atan(h),y=Math.cos(g)*d+t,v=Math.sin(g)*d+e.value,S=0;if(f)S=_;else{var A=s,T=s*c;S=Math.sqrt(A*A+T*T)*o}var E=Math.atan(c),b=(y-t)/s,x=(-Math.cos(E)*S+i-t)/s,C=v,R=-Math.sin(E)*S+n.value,w=[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(vs(c)){if(vs(u))return r[0]=0,1;var f=Math.cbrt(-u);return r[0]=2*f,r[1]=-f,2}if(c<0){var d=1/3*Math.acos(-u/Math.sqrt(-l)),p=2*Math.sqrt(-h);r[0]=p*Math.cos(d),r[1]=-p*Math.cos(d+Math.PI/3),r[2]=-p*Math.cos(d-Math.PI/3),_=3}else{var m=Math.sqrt(c),g=Math.cbrt(m-u),y=-Math.cbrt(m+u);r[0]=g+y,_=1}for(var v=1/3*s,S=0;S<_;++S)r[S]-=v;return _}(0-r,3*b,3*x-6*b,3*(b-x)+1,w),B=function(t,e,i){var n=i;if(1===e)n=t[0];else{n=-1/0;for(var r=0;r<e;++r){var s=t[r];s>=0&&s<=1&&s>n&&(n=s)}n===-1/0&&(n=0)}return n}(w,I,r);return eh(e.value,C,R,n.value,B)}var D=e.value+o*h*s,P=n.value-o*c*s;return eh(e.value,D,P,n.value,r)}}(f,d,p,i[c],(t-f)/(p-f))},i.addKeyFrame=function(e,i){return t.prototype.addKeyFrame.call(this,e,Lo(i))},i.assignSorted=function(t,e){if(void 0!==e)this.setKeyframes(t.slice(),e.map((function(t){return Lo(t)})));else{var i=Array.from(t);this.setKeyframes(i.map((function(t){return t[0]})),i.map((function(t){return Lo(t[1])})))}},i.isConstant=function(t){if(this._values.length<=1)return!0;var e=this._values[0].value;return this._values.every((function(i){return Ei(i.value,e,t)}))},i[Da]=function(t,e){if(e.toCCON){var i=this._times,n=this._values,r=i.length,s=new DataView(new ArrayBuffer(0+Go+Go+Vo+Uo*r+Ko*r)),a=0;s.setUint8(a,this.preExtrapolation),a+=Go,s.setUint8(a,this.postExtrapolation),a+=Go,s.setUint32(a,r,!0),a+=Vo,i.forEach((function(t,e){return s.setFloat32(a+Uo*e,t,!0)})),a+=Uo*r;for(var o,h=f(n);!(o=h()).done;){var u=o.value;a=Jo(s,u,a)}var l=new Uint8Array(s.buffer,0,a);t.writeProperty("bytes",l);var c=n.map((function(t){return t[la]}));c.some((function(t){return void 0!==t}))&&t.writeProperty("keyframeValueEditorExtras",c)}else t.writeThis()},i[Pa]=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+=Go,this.postExtrapolation=n.getUint8(r),r+=Go;var s=n.getUint32(r,!0);r+=Vo;var a=Array.from({length:s},(function(t,e){return n.getFloat32(r+Uo*e,!0)}));r+=Uo*s;for(var o=new Array(s),h=0;h<s;++h){var u=Lo({});r=Qo(n,u,r),o[h]=u}i.byteLength;var l=t.readProperty("keyframeValueEditorExtras");l&&(l.length,l.forEach((function(t,e){return o[e][la]=t}))),this._times=a,this._values=o}else t.readThis()},e}(ys));fi.fastDefine("cc.RealCurve",ko,{_times:[],_values:[],preExtrapolation:ms.CLAMP,postExtrapolation:ms.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"}(Fo||(Fo={}));var Go=1,Vo=4,Uo=4,zo=Lo({}),Ho=zo.interpolationMode,Wo=zo.tangentWeightMode,Xo=zo.leftTangent,jo=zo.leftTangentWeight,Yo=zo.rightTangent,qo=zo.rightTangentWeight,Ko=26;function Jo(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,f=e.easingMethod;return t.setFloat32(r,a,!0),r+=4,o!==Ho&&(n|=Fo.INTERPOLATION_MODE,t.setUint8(r,o),r+=1),h!==Wo&&(n|=Fo.TANGENT_WEIGHT_MODE,t.setUint8(r,h),r+=1),c!==Xo&&(n|=Fo.LEFT_TANGENT,t.setFloat32(r,c,!0),r+=4),_!==jo&&(n|=Fo.LEFT_TANGENT_WEIGHT,t.setFloat32(r,_,!0),r+=4),u!==Yo&&(n|=Fo.RIGHT_TANGENT,t.setFloat32(r,u,!0),r+=4),l!==qo&&(n|=Fo.RIGHT_TANGENT_WEIGHT,t.setFloat32(r,l,!0),r+=4),n|=f<<8,t.setUint32(s,n,!0),r}function Qo(t,e,i){var n=i,r=t.getUint32(n,!0);n+=4,e.value=t.getFloat32(n,!0),n+=4,r&Fo.INTERPOLATION_MODE&&(e.interpolationMode=t.getUint8(n),n+=1),r&Fo.TANGENT_WEIGHT_MODE&&(e.tangentWeightMode=t.getUint8(n),n+=1),r&Fo.LEFT_TANGENT&&(e.leftTangent=t.getFloat32(n,!0),n+=4),r&Fo.LEFT_TANGENT_WEIGHT&&(e.leftTangentWeight=t.getFloat32(n,!0),n+=4),r&Fo.RIGHT_TANGENT&&(e.rightTangent=t.getFloat32(n,!0),n+=4),r&Fo.RIGHT_TANGENT_WEIGHT&&(e.rightTangentWeight=t.getFloat32(n,!0),n+=4);var s=(65280&r)>>8;return e.easingMethod=s,n}function Zo(t,e,i){return e+Li(t-e,i-e)}function $o(t,e,i){return e+Fi(t-e,i-e)}function th(t,e,i,n,r){return e+(n-e)/(i-t)*(r-t)}function eh(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 ih(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=ih;var nh,rh,sh,ah,oh,hh,uh,lh,ch,_h,fh=Math.cos,dh=Math.acos,ph=Math.max,mh=2*Math.PI,gh=Math.sqrt;function yh(t){return t<0?-Math.pow(-t,1/3):Math.pow(t,1/3)}function vh(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,f=(h-6*o+l)*c,d=f*_,p=(-h+u)*c,m=(3*p-f*f)*_,g=m*_,y=(2*f*f*f-9*f*p+a*c*27)/27,v=y/2,S=v*v+g*g*g;if(S<0){var A=-m*_,T=gh(A*A*A),E=-y/(2*T),b=dh(E<-1?-1:E>1?1:E),x=2*yh(T);return n=x*fh(b*_)-d,r=x*fh((b+mh)*_)-d,s=x*fh((b+2*mh)*_)-d,n>=0&&n<=1?r>=0&&r<=1?s>=0&&s<=1?ph(n,r,s):ph(n,r):s>=0&&s<=1?ph(n,s):n:r>=0&&r<=1?s>=0&&s<=1?ph(r,s):r:s}if(0===S)return r=-(i=v<0?yh(-v):-yh(v))-d,(n=2*i-d)>=0&&n<=1?r>=0&&r<=1?ph(n,r):n:r;var C=gh(S);return(i=yh(-v+C))-yh(v+C)-d}(t,e),n=t[1];return((1-i)*(n+(t[3]-n)*i)*3+i*i)*i}v.bezierByTime=vh,t("c3",_h),function(t){t[t.SLERP=0]="SLERP",t[t.CONSTANT=1]="CONSTANT"}(_h||t("c3",_h={}));var Sh=Is("cc.QuatKeyframeValue")(nh=zs((rh=function(t){var e=void 0===t?{}:t,i=e.value,n=e.interpolationMode,r=e.easingMethod;this.interpolationMode=sh&&sh(),this.value=ah&&ah(),this.easingMethod=oh&&oh(),this.value=i?sn.clone(i):this.value,this.interpolationMode=null!=n?n:this.interpolationMode,this.easingMethod=null!=r?r:this.easingMethod},sh=Ss(rh.prototype,"interpolationMode",[ks],(function(){return _h.SLERP})),ah=Ss(rh.prototype,"value",[ks],(function(){return sn.clone(sn.IDENTITY)})),oh=Ss(rh.prototype,"easingMethod",[ks],(function(){return Co.LINEAR})),nh=rh))||nh)||nh;function Ah(t){return new Sh(t)}var Th,Eh=t("c2",Is("cc.QuatCurve")((uh=function(t){function e(){for(var e,i=arguments.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=lh&&lh(),e.postExtrapolation=ch&&ch(),e}s(e,t);var i=e.prototype;return i.evaluate=function(t,e){var i;null!==(i=e)&&void 0!==i||(e=new sn);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 ms.LOOP:t=h+Li(t-h,u-h);break;case ms.PING_PONG:t=h+Fi(t-h,u-h);break;case ms.CLAMP:default:return sn.copy(e,l.value)}}else if(t>u){var c=r[o-1];switch(s){case ms.LOOP:t=h+Li(t-h,u-h);break;case ms.PING_PONG:t=h+Fi(t-h,u-h);break;case ms.CLAMP:default:return sn.copy(e,c.value)}}var _=ds(n,t);if(_>=0)return sn.copy(e,r[_].value);var f=~_,d=f-1,p=n[d],m=r[d],g=n[f],y=r[f],v=(t-p)/(g-p);switch(m.interpolationMode){default:case _h.CONSTANT:return sn.copy(e,m.value);case _h.SLERP:var S=m.easingMethod,A=S===Co.LINEAR?v:Array.isArray(S)?vh(S,v):Bo(S)(v);return sn.slerp(e,m.value,y.value,A)}},i.addKeyFrame=function(e,i){var n=new Sh(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 Ah(t)})));else{var i=Array.from(t);this.setKeyframes(i.map((function(t){return t[0]})),i.map((function(t){return Ah(t[1])})))}},i[Da]=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=Ih*(r?1:s),o=n.reduce((function(t,e){var i=e.easingMethod;return t+(Array.isArray(i)?Bh+4*Ph:Bh)}),0),h=0,u=new DataView(new ArrayBuffer(h+=xh+Ch+Rh*s+4*wh*s+o+a+0)),l=0,c=0;r&&(c|=Th.INTERPOLATION_MODE),u.setUint32(l,c,!0),l+=xh,u.setUint32(l,s,!0),l+=Ch,i.forEach((function(t,e){return u.setFloat32(l+Rh*e,t,!0)})),l+=Rh*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*wh*e;u.setFloat32(o+0*wh,n,!0),u.setFloat32(o+1*wh,r,!0),u.setFloat32(o+2*wh,s,!0),u.setFloat32(o+3*wh,a,!0)})),l+=4*wh*s,n.forEach((function(t){var e=t.easingMethod;Array.isArray(e)?(u.setUint8(l,Dh),++l,u.setFloat32(l+0*Ph,e[0],!0),u.setFloat32(l+1*Ph,e[1],!0),u.setFloat32(l+2*Ph,e[2],!0),u.setFloat32(l+3*Ph,e[3],!0),l+=4*Ph):(u.setUint8(l,e),++l)}));var _=l;l+=a;var f=_;n.forEach((function(t){var e=t.interpolationMode;u.setUint8(f,e),r||(f+=Ih)}));var d=new Uint8Array(u.buffer);t.writeProperty("bytes",d)}else t.writeThis()},i[Pa]=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&Th.INTERPOLATION_MODE,o=n.getUint32(r,!0);r+=Ch;var h=Array.from({length:o},(function(t,e){return n.getFloat32(r+Rh*e,!0)})),u=r+=Rh*o;r+=4*wh*o;var l=Array.from({length:o},(function(t,e){var i=u+4*wh*e,s=n.getFloat32(i+0*wh,!0),a=n.getFloat32(i+1*wh,!0),o=n.getFloat32(i+2*wh,!0),h=n.getFloat32(i+3*wh,!0),l=n.getUint8(r);++r;var c=Ah({value:{x:s,y:a,z:o,w:h}});return l!==Dh?c.easingMethod=l:(c.easingMethod=[n.getFloat32(r+0*Ph,!0),n.getFloat32(r+1*Ph,!0),n.getFloat32(r+2*Ph,!0),n.getFloat32(r+3*Ph,!0)],r+=4*Ph),c}));if(a){var c=n.getUint8(r);++r;for(var _=0;_<o;++_)l[_].interpolationMode=c}else{for(var f=0;f<o;++f){var d=n.getUint8(r+f);l[f].interpolationMode=d}r+=o}this._times=h,this._values=l}else t.readThis()},e}(ys),lh=Ss(uh.prototype,"preExtrapolation",[ks],(function(){return ms.CLAMP})),ch=Ss(uh.prototype,"postExtrapolation",[ks],(function(){return ms.CLAMP})),hh=uh))||hh);!function(t){t[t.INTERPOLATION_MODE=1]="INTERPOLATION_MODE"}(Th||(Th={}));var bh,xh=1,Ch=4,Rh=4,wh=4,Ih=1,Bh=1,Dh=255,Ph=4,Oh=t("c4",Is("cc.ObjectCurve")(bh=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=bi(~e-1,0,this._values.length-1);return this._values[i]},e}(ys))||bh),Mh=me({Blend:0,Fixed:1}),Nh=t("c5",(function(){this.color=Zi.WHITE.clone(),this.time=0}));fi.fastDefine("cc.ColorKey",Nh,{color:Zi.WHITE.clone(),time:0}),fi.Attr.setClassAttr(Nh,"color","visible",!0),fi.Attr.setClassAttr(Nh,"time","visible",!0);var Lh=t("c6",(function(){this.alpha=1,this.time=0}));fi.fastDefine("cc.AlphaKey",Lh,{alpha:1,time:0}),fi.Attr.setClassAttr(Lh,"alpha","visible",!0),fi.Attr.setClassAttr(Lh,"time","visible",!0);var Fh=t("c7",function(){function t(){this.colorKeys=[],this.alphaKeys=[],this.mode=Mh.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 Zi,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 Zi)},e.getRandomColor=function(t){var e=this.colorKeys[Math.trunc(Math.random()*this.colorKeys.length)],i=this.alphaKeys[Math.trunc(Math.random()*this.alphaKeys.length)];return t.set(e.color),t._set_a_unsafe(i.alpha),t},e.getRGB=function(t,e){var i=this.colorKeys,n=i.length;if(n>1){e=Li(e,1+Ai);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===Mh.Fixed)return Zi.copy(t,i[r].color),t;var o=(e-s)/(a-s);return Zi.lerp(t,i[r-1].color,i[r].color,o),t}}var h=n-1;Ei(e,i[h].time,Ai)?Zi.copy(t,i[h].color):e<i[0].time?Zi.lerp(t,Zi.BLACK,i[0].color,e/i[0].time):e>i[h].time&&Zi.lerp(t,i[h].color,Zi.BLACK,(e-i[h].time)/(1-i[h].time))}else 1===n?Zi.copy(t,i[0].color):Zi.copy(t,Zi.WHITE);return t},e.getAlpha=function(t){var e=this.alphaKeys,i=e.length;if(i>1){t=Li(t,1+Ai);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===Mh.Fixed)return e[n].alpha;var a=(t-r)/(s-r);return Ci(e[n-1].alpha,e[n].alpha,a)}}var o=i-1;return Ei(t,e[o].time,Ai)?e[o].alpha:t<e[0].time?Ci(0,e[0].alpha,t/e[0].time):t>e[o].time?Ci(e[o].alpha,0,(t-e[o].time)/(1-e[o].time)):255}return 1===i?e[0].alpha:255},t}());Fh.Mode=Mh,fi.fastDefine("cc.Gradient",Fh,{colorKeys:[],alphaKeys:[],mode:Mh.Blend}),fi.Attr.setClassAttr(Fh,"colorKeys","visible",!0),fi.Attr.setClassAttr(Fh,"alphaKeys","visible",!0),fi.Attr.setClassAttr(Fh,"mode","visible",!0);var kh=function(){this.time=0,this.value=0,this.inTangent=0,this.outTangent=0};fi.fastDefine("cc.Keyframe",kh,{time:0,value:0,inTangent:0,outTangent:0});var Gh=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 Vh(t-this.time,this.coefficient)},t}();function Vh(t,e){return t*(t*(t*e[0]+e[1])+e[2])+e[3]}var Uh,zh,Hh=function(){function t(t){if(void 0===t&&(t=null),this._curve=void 0,this.cachedKey=void 0,t instanceof ko)this._curve=t;else{var e=new ko;this._curve=e,e.preExtrapolation=ms.LOOP,e.postExtrapolation=ms.CLAMP,t?e.assignSorted(t.map((function(t){return[t.time,{interpolationMode:ps.CUBIC,value:t.value,leftTangent:t.inTangent,rightTangent:t.outTangent}]}))):e.assignSorted([[0,{interpolationMode:ps.CUBIC,value:1}],[1,{interpolationMode:ps.CUBIC,value:1}]])}this.cachedKey=new Gh}var e=t.prototype;return e.addKey=function(t){t?this._curve.addKeyFrame(t.time,{interpolationMode:ps.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 ms.LOOP:r=Li(t-a,o-a)+a;break;case ms.PING_PONG:r=Fi(t-a,o-a)+a;break;case ms.CLAMP:default:r=bi(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,f=1/(c*c),d=o*c,p=l*c;t.coefficient[0]=(d+p-_-_)*f/c,t.coefficient[1]=(_+_+_-d-d-p)*f,t.coefficient[2]=o,t.coefficient[3]=a},e.findIndex=function(t,e){var i=this._curve,n=i.keyFramesCount,r=t.index;if(-1!==r)if(e>i.getKeyframeTime(r))for(var s=0;s<3;s++){var a=r+s;if(a+1<n&&i.getKeyframeTime(a+1)>e)return a}else for(var o=0;o<3;o++){var 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 kh;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:ps.CUBIC,value:t.value,leftTangent:t.inTangent,rightTangent:t.outTangent}]})))}},{key:"preWrapMode",get:function(){return Xh(this._curve.preExtrapolation)},set:function(t){this._curve.preExtrapolation=Wh(t)}},{key:"postWrapMode",get:function(){return Xh(this._curve.postExtrapolation)},set:function(t){this._curve.postExtrapolation=Wh(t)}}]),t}();function Wh(t){switch(t){default:case Uh.Default:case Uh.Normal:case Uh.Clamp:return ms.CLAMP;case Uh.PingPong:return ms.PING_PONG;case Uh.Loop:return ms.LOOP}}function Xh(t){switch(t){default:case ms.LINEAR:case ms.CLAMP:return Uh.Clamp;case ms.PING_PONG:return Uh.PingPong;case ms.LOOP:return Uh.Loop}}Hh.defaultKF=[{time:0,value:1,inTangent:0,outTangent:0},{time:1,value:1,inTangent:0,outTangent:0}],fi.fastDefine("cc.AnimationCurve",Hh,{_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"}(Uh||(Uh={})),function(t){t[t.LINEAR=0]="LINEAR",t[t.BEZIER=1]="BEZIER",t[t.CATMULL_ROM=2]="CATMULL_ROM"}(zh||(zh={}));var jh,Yh=4294967295,qh=new Yi,Kh=new Yi,Jh=new Yi,Qh=new Yi,Zh=function(){function t(t,e){void 0===t&&(t=zh.CATMULL_ROM),void 0===e&&(e=[]),this._type=void 0,this._mode=zh.CATMULL_ROM,this._knots=[],this._type=Vn.SHAPE_SPLINE,this._mode=t;for(var i=0;i<e.length;i++)this._knots[i]=new Yi(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 Yi(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 Yi(e[i])},e.clearKnots=function(){this._knots.length=0},e.getKnotCount=function(){return this._knots.length},e.addKnot=function(t){this._knots.push(new Yi(t))},e.insertKnot=function(t,e){var i=new Yi(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=Yh),e=bi(e,0,1);var n=this.getSegments();if(0===n)return new Yi(0,0,0);if(i===Yh){var r=1/n;i=Math.floor(e/r),e=e%r/r}if(i>=n)return new Yi(this._knots[this._knots.length-1]);switch(this._mode){case zh.LINEAR:return t.calcLinear(this._knots[i],this._knots[i+1],e);case zh.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 zh.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 Yi(0,0,0)}},e.getPoints=function(t,e){if(void 0===e&&(e=Yh),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 zh.LINEAR:case zh.CATMULL_ROM:return t<2?(q(14300),0):t-1;case zh.BEZIER:return t<4||t%4!=0?(q(14301),0):t/4}},t.calcLinear=function(t,e,i){var n=new Yi;return Yi.multiplyScalar(qh,t,1-i),Yi.multiplyScalar(Kh,e,i),Yi.add(n,qh,Kh),n},t.calcBezier=function(t,e,i,n,r){var s=new Yi,a=1-r;return Yi.multiplyScalar(qh,t,a*a*a),Yi.multiplyScalar(Kh,e,3*r*a*a),Yi.multiplyScalar(Jh,i,3*r*r*a),Yi.multiplyScalar(Qh,n,r*r*r),Yi.add(qh,qh,Kh),Yi.add(Jh,Jh,Qh),Yi.add(s,qh,Jh),s},t.calcCatmullRom=function(t,e,i,n,r){var s=new Yi,a=r*r,o=a*r;return Yi.multiplyScalar(qh,t,-.5*o+a-.5*r),Yi.multiplyScalar(Kh,e,1.5*o-2.5*a+1),Yi.multiplyScalar(Jh,i,-1.5*o+2*a+.5*r),Yi.multiplyScalar(Qh,n,.5*o-.5*a),Yi.add(qh,qh,Kh),Yi.add(Jh,Jh,Qh),Yi.add(s,qh,Jh),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 $h(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"}(jh||(jh={})),nt(Hr,"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 tu=function(t){function e(){var e;return e=t.call(this)||this,$h("line","Line"),e}return s(e,t),e}(Un),eu=function(t){function e(){var e;return e=t.call(this)||this,$h("plane","Plane"),e}return s(e,t),e}(qr),iu=function(t){function e(){var e;return e=t.call(this)||this,$h("ray","Ray"),e}return s(e,t),e}(zn),nu=function(t){function e(){var e;return e=t.call(this)||this,$h("triangle","Triangle"),e}return s(e,t),e}(Kr),ru=function(t){function e(){var e;return e=t.call(this)||this,$h("sphere","Sphere"),e}return s(e,t),e}($n),su=function(t){function e(){var e;return e=t.call(this)||this,$h("aabb","AABB"),e}return s(e,t),e}(is),au=function(t){function e(){var e;return e=t.call(this)||this,$h("obb","OBB"),e}return s(e,t),e}(fs),ou=function(t){function e(){var e;return e=t.call(this)||this,$h("capsule","Capsule"),e}return s(e,t),e}(ns),hu=function(t){function e(){var e;return e=t.call(this)||this,$h("frustum","Frustum"),e}return s(e,t),e}(us),uu=Object.freeze({__proto__:null,distance:Gn,enums:Vn,intersect:Hr,Line:Un,Plane:qr,Ray:zn,Triangle:Kr,Sphere:$n,AABB:is,OBB:fs,Capsule:ns,Frustum:us,Keyframe:kh,AnimationCurve:Hh,get WrapModeMask(){return Uh},get SplineMode(){return zh},Spline:Zh,constructLegacyCurveAndConvert:function(){var t=new ko;return t.assignSorted([[0,{interpolationMode:ps.CUBIC,value:1}],[1,{interpolationMode:ps.CUBIC,value:1}]]),t},OptimizedKey:Gh,evalOptCurve:Vh,get ERaycastMode(){return jh},line:tu,plane:eu,ray:iu,triangle:nu,sphere:ru,aabb:su,obb:au,capsule:ou,frustum:hu});t("an",uu);var lu=function(){function t(){this._poolHandle=-1,cu.addContainer(this)}return t.prototype.destroy=function(){cu.removeContainer(this)},t}(),cu=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,ae(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}()),_u=t("b7",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}(lu)),fu=t("b8",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}(lu)),du=t("b9",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}(lu));t("am",Object.freeze({__proto__:null,Pool:_u,RecyclePool:fu,CachedArray:du}));var pu=t("ca",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}());pu.Priority=me({LOW:0,MEDIUM:100,HIGH:200,SCHEDULER:1<<31>>>0});var mu=new mt("Scheduler"),gu=function(t,e,i,n){this.target=void 0,this.priority=void 0,this.paused=void 0,this.markedForDeletion=void 0,this.target=t,this.priority=e,this.paused=i,this.markedForDeletion=n};gu.get=function(t,e,i,n){var r=gu._listEntries.pop();return r?(r.target=t,r.priority=e,r.paused=i,r.markedForDeletion=n):r=new gu(t,e,i,n),r},gu.put=function(t){gu._listEntries.length<20&&(t.target=null,gu._listEntries.push(t))},gu._listEntries=[];var yu=function(t,e,i,n){this.list=void 0,this.entry=void 0,this.target=void 0,this.callback=void 0,this.list=t,this.entry=e,this.target=i,this.callback=n};yu.get=function(t,e,i,n){var r=yu._hashUpdateEntries.pop();return r?(r.list=t,r.entry=e,r.target=i,r.callback=n):r=new yu(t,e,i,n),r},yu.put=function(t){yu._hashUpdateEntries.length<20&&(t.list=t.entry=t.target=t.callback=null,yu._hashUpdateEntries.push(t))},yu._hashUpdateEntries=[];var vu=function(t,e,i,n,r,s){this.timers=void 0,this.target=void 0,this.timerIndex=void 0,this.currentTimer=void 0,this.currentTimerSalvaged=void 0,this.paused=void 0,this.timers=t,this.target=e,this.timerIndex=i,this.currentTimer=n,this.currentTimerSalvaged=r,this.paused=s};vu.get=function(t,e,i,n,r,s){var a=vu._hashTimerEntries.pop();return a?(a.timers=t,a.target=e,a.timerIndex=i,a.currentTimer=n,a.currentTimerSalvaged=r,a.paused=s):a=new vu(t,e,i,n,r,s),a},vu.put=function(t){vu._hashTimerEntries.length<20&&(t.timers=t.target=t.currentTimer=null,vu._hashTimerEntries.push(t))},vu._hashTimerEntries=[];var Su=function(){function t(){this._lock=void 0,this._scheduler=void 0,this._elapsed=void 0,this._runForever=void 0,this._useDelay=void 0,this._timesExecuted=void 0,this._repeat=void 0,this._delay=void 0,this._interval=void 0,this._target=void 0,this._callback=void 0,this._lock=!1,this._scheduler=null,this._elapsed=-1,this._runForever=!1,this._useDelay=!1,this._timesExecuted=0,this._repeat=0,this._delay=0,this._interval=0,this._target=null}var e=t.prototype;return e.initWithCallback=function(t,e,i,n,r,s){return this._lock=!1,this._scheduler=t,this._target=i,this._callback=e,this._elapsed=-1,this._interval=n,this._delay=s,this._useDelay=this._delay>0,this._repeat=r,this._runForever=this._repeat===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.unschedule(this._callback,this._target)},t}();Su._timers=[],Su.get=function(){return Su._timers.pop()||new Su},Su.put=function(t){Su._timers.length<20&&!t._lock&&(t._scheduler=t._target=t._callback=null,Su._timers.push(t))};var Au=t("bZ",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=wt(!0),e._hashForTimers=wt(!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=mu.getNewId())};var i=e.prototype;return i.setTimeScale=function(t){this._timeScale=t},i.getTimeScale=function(){return this._timeScale},i.update=function(t){var e,i,n,r,s;for(this._updateHashLocked=!0,1!==this._timeScale&&(t*=this._timeScale),e=0,n=(i=this._updatesNegList).length;e<n;e++)(r=i[e]).paused||r.markedForDeletion||r.target.update(t);for(e=0,n=(i=this._updates0List).length;e<n;e++)(r=i[e]).paused||r.markedForDeletion||r.target.update(t);for(e=0,n=(i=this._updatesPosList).length;e<n;e++)(r=i[e]).paused||r.markedForDeletion||r.target.update(t);var a=this._arrayForTimers;for(e=0;e<a.length;e++){if(s=a[e],this._currentTarget=s,this._currentTargetSalvaged=!1,!s.paused)for(s.timerIndex=0;s.timerIndex<s.timers.length;++s.timerIndex)s.currentTimer=s.timers[s.timerIndex],s.currentTimerSalvaged=!1,s.currentTimer.update(t),s.currentTimer=null;this._currentTargetSalvaged&&0===this._currentTarget.timers.length&&(this._removeHashElement(this._currentTarget),--e)}for(e=0,i=this._updatesNegList;e<i.length;)(r=i[e]).markedForDeletion?this._removeUpdateFromHash(r):e++;for(e=0,i=this._updates0List;e<i.length;)(r=i[e]).markedForDeletion?this._removeUpdateFromHash(r):e++;for(e=0,i=this._updatesPosList;e<i.length;)(r=i[e]).markedForDeletion?this._removeUpdateFromHash(r):e++;this._updateHashLocked=!1,this._currentTarget=null},i.schedule=function(t,e,i,n,r,s){if("function"!=typeof t){q(1514);var a=t;t=e,e=a}3!==arguments.length&&4!==arguments.length&&5!==arguments.length||(s=!!n,n=v.macro.REPEAT_FOREVER,r=0),$(e,1502);var o=e.uuid||e.id;if(o){var h,u,l=this._hashForTimers[o];if(l?l.paused!==s&&q(1511):(l=vu.get(null,e,0,null,null,s),this._arrayForTimers.push(l),this._hashForTimers[o]=l),null==l.timers)l.timers=[];else for(u=0;u<l.timers.length;++u)if((h=l.timers[u])&&t===h._callback)return j(1507,h.getInterval(),i),void(h._interval=i);(h=Su.get()).initWithCallback(this,t,e,i,n,r),l.timers.push(h),this._currentTarget===l&&this._currentTargetSalvaged&&(this._currentTargetSalvaged=!1)}else J(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 j(1506),r.entry.markedForDeletion=!1,void(r.entry.paused=i);this.unscheduleUpdate(t)}var s,a=gu.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]=yu.get(s,a,t,null)}else J(1510)},i.unschedule=function(t,e){if(e&&t){var i=e.uuid||e.id;if(i){var n=this._hashForTimers[i];if(n)for(var r=n.timers,s=0,a=r.length;s<a;s++){var o=r[s];if(t===o._callback)return o!==n.currentTimer||n.currentTimerSalvaged||(n.currentTimerSalvaged=!0),r.splice(s,1),Su.put(o),n.timerIndex>=s&&n.timerIndex--,void(0===r.length&&(this._currentTarget===n?this._currentTargetSalvaged=!0:this._removeHashElement(n)))}}else J(1510)}},i.unscheduleUpdate=function(t){if(t){var e=t.uuid||t.id;if(e){var i=this._hashForUpdates[e];i&&(this._updateHashLocked?i.entry.markedForDeletion=!0:this._removeUpdateFromHash(i.entry))}else J(1510)}},i.unscheduleAllForTarget=function(t){if(t){var e=t.uuid||t.id;if(e){var i=this._hashForTimers[e];if(i){var n=i.timers;n.indexOf(i.currentTimer)>-1&&!i.currentTimerSalvaged&&(i.currentTimerSalvaged=!0);for(var r=0,s=n.length;r<s;r++)Su.put(n[r]);n.length=0,this._currentTarget===i?this._currentTargetSalvaged=!0:this._removeHashElement(i)}this.unscheduleUpdate(t)}else J(1510)}},i.unscheduleAll=function(){this.unscheduleAllWithMinPriority(pu.Priority.SCHEDULER)},i.unscheduleAllWithMinPriority=function(t){var e,i,n,r=this._arrayForTimers;for(e=r.length-1;e>=0;e--)i=r[e],this.unscheduleAllForTarget(i.target);var s=0;if(t<0)for(e=0;e<this._updatesNegList.length;)s=this._updatesNegList.length,(n=this._updatesNegList[e])&&n.priority>=t&&this.unscheduleUpdate(n.target),s===this._updatesNegList.length&&e++;if(t<=0)for(e=0;e<this._updates0List.length;)s=this._updates0List.length,(n=this._updates0List[e])&&this.unscheduleUpdate(n.target),s===this._updates0List.length&&e++;for(e=0;e<this._updatesPosList.length;)s=this._updatesPosList.length,(n=this._updatesPosList[e])&&n.priority>=t&&this.unscheduleUpdate(n.target),s===this._updatesPosList.length&&e++},i.isScheduled=function(t,e){$(t,1508),$(e,1509);var i=e.uuid||e.id;if(!i)return J(1510),!1;var n=this._hashForTimers[i];if(!n)return!1;if(null==n.timers)return!1;for(var r=n.timers,s=0;s<r.length;++s)if(t===r[s]._callback)return!0;return!1},i.pauseAllTargets=function(){return this.pauseAllTargetsWithMinPriority(pu.Priority.SCHEDULER)},i.pauseAllTargetsWithMinPriority=function(t){var e,i,n,r,s=[],a=this._arrayForTimers;for(i=0,n=a.length;i<n;i++)(e=a[i])&&(e.paused=!0,s.push(e.target));if(t<0)for(i=0;i<this._updatesNegList.length;i++)(r=this._updatesNegList[i])&&r.priority>=t&&(r.paused=!0,s.push(r.target));if(t<=0)for(i=0;i<this._updates0List.length;i++)(r=this._updates0List[i])&&(r.paused=!0,s.push(r.target));for(i=0;i<this._updatesPosList.length;i++)(r=this._updatesPosList[i])&&r.priority>=t&&(r.paused=!0,s.push(r.target));return s},i.resumeTargets=function(t){if(t)for(var e=0;e<t.length;e++)this.resumeTarget(t[e])},i.pauseTarget=function(t){$(t,1503);var e=t.uuid||t.id;if(e){var i=this._hashForTimers[e];i&&(i.paused=!0);var n=this._hashForUpdates[e];n&&(n.entry.paused=!0)}else J(1510)},i.resumeTarget=function(t){$(t,1504);var e=t.uuid||t.id;if(e){var i=this._hashForTimers[e];i&&(i.paused=!1);var n=this._hashForUpdates[e];n&&(n.entry.paused=!1)}else J(1510)},i.isTargetPaused=function(t){$(t,1505);var e=t.uuid||t.id;if(!e)return J(1510),!1;var i=this._hashForTimers[e];if(i)return i.paused;var n=this._hashForUpdates[e];return!!n&&n.entry.paused},i._removeHashElement=function(t){var e=t.target.uuid||t.target.id;delete this._hashForTimers[e];for(var i=this._arrayForTimers,n=0,r=i.length;n<r;n++)if(i[n]===t){i.splice(n,1);break}vu.put(t)},i._removeUpdateFromHash=function(t){var e=t.target.uuid||t.target.id,i=this._hashForUpdates[e];if(i){for(var n=i.list,r=i.entry,s=0,a=n.length;s<a;s++)if(n[s]===r){n.splice(s,1);break}delete this._hashForUpdates[e],gu.put(r),yu.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}(pu));Au.ID="scheduler",v.Scheduler=Au;var Tu={};nt(Tu,"vmath",[{name:"vec2",newName:"Vec2",target:Rn,targetName:"math"},{name:"vec3",newName:"Vec3",target:Rn,targetName:"math"},{name:"vec4",newName:"Vec4",target:Rn,targetName:"math"},{name:"quat",newName:"Quat",target:Rn,targetName:"math"},{name:"mat3",newName:"Mat3",target:Rn,targetName:"math"},{name:"mat4",newName:"Mat4",target:Rn,targetName:"math"},{name:"color4",newName:"Color",target:Rn,targetName:"math"},{name:"rect",newName:"Rect",target:Rn,targetName:"math"},{name:"approx",newName:"approx",target:Rn,targetName:"math"},{name:"EPSILON",newName:"EPSILON",target:Rn,targetName:"math"},{name:"equals",newName:"equals",target:Rn,targetName:"math"},{name:"clamp",newName:"clamp",target:Rn,targetName:"math"},{name:"clamp01",newName:"clamp01",target:Rn,targetName:"math"},{name:"lerp",newName:"lerp",target:Rn,targetName:"math"},{name:"toRadian",newName:"toRadian",target:Rn,targetName:"math"},{name:"toDegree",newName:"toDegree",target:Rn,targetName:"math"},{name:"random",newName:"random",target:Rn,targetName:"math"},{name:"randomRange",newName:"randomRange",target:Rn,targetName:"math"},{name:"randomRangeInt",newName:"randomRangeInt",target:Rn,targetName:"math"},{name:"pseudoRandom",newName:"pseudoRandom",target:Rn,targetName:"math"},{name:"pseudoRandomRangeInt",newName:"pseudoRandomRangeInt",target:Rn,targetName:"math"},{name:"nextPow2",newName:"nextPow2",target:Rn,targetName:"math"},{name:"repeat",newName:"repeat",target:Rn,targetName:"math"},{name:"pingPong",newName:"pingPong",target:Rn,targetName:"math"},{name:"inverseLerp",newName:"inverseLerp",target:Rn,targetName:"math"}]),v.vmath=Tu,nt(Au.prototype,"Scheduler.prototype",[{name:"enableForTarget",newName:"enableForTarget",target:Au,targetName:"Scheduler"}]),nt(Au,"Scheduler",[{name:"PRIORITY_SYSTEM",newName:"System.Priority.SCHEDULER",customGetter:function(){return pu.Priority.SCHEDULER}}]),rt(Au,"Scheduler",[{name:"PRIORITY_NON_SYSTEM",suggest:"Use enum` System.Priority` instead"}]),dt({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 Eu=ae;function bu(){}var xu=function(){function t(){this.callback=bu,this.target=void 0,this.once=!1}var e=t.prototype;return e.set=function(t,e,i){this.callback=t||bu,this.target=e,this.once=!!i},e.reset=function(){this.target=void 0,this.callback=bu,this.once=!1},e.check=function(){return!(xa(this.target)&&!Ca(this.target,!0))},t}(),Cu=new _u((function(){return new xu}),32),Ru=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(),Cu.free(i),Eu(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(),Cu.free(i),Eu(this.callbackInfos,e),--e)}},e.cancel=function(t){var e=this.callbackInfos[t];e&&(e.reset(),this.isInvoking?this.callbackInfos[t]=null:Eu(this.callbackInfos,t),Cu.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(),Cu.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]||Eu(this.callbackInfos,t);this.containCanceled=!1},e.clear=function(){this.cancelAll(),this.callbackInfos.length=0,this.isInvoking=!1,this.containCanceled=!1},t}(),wu=new _u((function(){return new Ru}),16),Iu=t("cA",function(){function t(){this._callbackTable=wt(!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]=wu.alloc());var s=Cu.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(),wu.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,f=c.target;c.once&&this.off(t,_,f),c.check()?f?_.call(f,e,i,n,r,s):_(e,i,n,r,s):this.off(t,_,f)}}o&&(a.isInvoking=!1,a.containCanceled&&a.purgeCanceled())}},e.clear=function(){for(var t in this._callbackTable){var e=this._callbackTable[t];e&&(e.clear(),wu.free(e),delete this._callbackTable[t])}},e._registerOffCallback=function(t){this._offCallback=t},t}());function Bu(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=wt(!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=Iu.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 Du=t("bF",Bu((function(){})));v.EventTarget=Du;var Pu,Ou,Mu,Nu,Lu,Fu,ku=t("bH",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){he(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"}(Pu||(Pu={})),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"}(Ou||(Ou={})),function(t){t[t.NONE=0]="NONE",t[t.LAN=1]="LAN",t[t.WWAN=2]="WWAN"}(Mu||(Mu={})),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"}(Nu||(Nu={})),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"}(Lu||(Lu={})),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"}(Fu||(Fu={}));var Gu=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=Mu.LAN,r.isNative=!1,r.isBrowser=!0,r.isMobile=/mobile|android|iphone|ipad/.test(o),r.platform=r.isMobile?Lu.MOBILE_BROWSER:Lu.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]:Ou.ENGLISH,r.language=h;var u=!1,l=!1,c="",_=0,f=/android\s*(\d+(?:\.\d+)*)/i.exec(o)||/android\s*(\d+(?:\.\d+)*)/i.exec(a.platform);f&&(u=!0,c=f[1]||"",_=parseInt(c)||0),(f=/(iPad|iPhone|iPod).*OS ((\d+_?){2,3})/i.exec(o))?(l=!0,c=f[2]||"",_=parseInt(c)||0):(/(iPhone|iPad|iPod)/.exec(a.platform)||"MacIntel"===a.platform&&a.maxTouchPoints&&a.maxTouchPoints>1)&&(l=!0,c="",_=0);var d=Nu.UNKNOWN;-1!==a.appVersion.indexOf("Win")?d=Nu.WINDOWS:l?d=Nu.IOS:-1!==a.appVersion.indexOf("Mac")?d=Nu.OSX:-1!==a.appVersion.indexOf("X11")&&-1===a.appVersion.indexOf("Linux")?d=Nu.LINUX:u?d=Nu.ANDROID:-1===a.appVersion.indexOf("Linux")&&-1===o.indexOf("ubuntu")||(d=Nu.LINUX),r.os=d,r.osVersion=c,r.osMainVersion=_,r.browserType=Pu.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),m=p?p[0].toLowerCase():Nu.UNKNOWN;("safari"===m&&u||"qq"===m&&/android.*applewebkit/i.test(o))&&(m=Pu.ANDROID);var y={micromessenger:Pu.WECHAT,wechat:Pu.WECHAT,weixin:Pu.WECHAT,trident:Pu.IE,edge:Pu.EDGE,"360 aphone":Pu.BROWSER_360,mxbrowser:Pu.MAXTHON,"opr/":Pu.OPERA,ubrowser:Pu.UC,huaweibrowser:Pu.HUAWEI};r.browserType=y[m]||m,r.browserVersion="";var v=/(mqqbrowser|micromessenger|qqbrowser|sogou|qzone|liebao|maxthon|uc|ucbs|360 aphone|360|baiduboxapp|baidu|maxthon|mxbrowser|miui(?:.hybrid)?)(mobile)?(browser)?\/?([\d.]+)/i.exec(o);v||(v=/(qq|chrome|safari|firefox|trident|opera|opr\/|oupeng)(mobile)?(browser)?\/?([\d.]+)/i.exec(o)),r.browserVersion=v?v[4]:"",r.isXR=!1;var S,A=document.createElement("canvas");A.getContext("2d");try{S=A.toDataURL("image/webp").startsWith("data:image/webp")}catch(t){S=!1}if(r.browserType===Pu.SAFARI){var T,E=null===(T=/ version\/(\d+)/.exec(o))||void 0===T?void 0:T[1];"string"==typeof E&&Number.parseInt(E)>=14&&(S=!0)}var b=void 0!==document.documentElement.ontouchstart||void 0!==document.ontouchstart||g,x=void 0!==document.documentElement.onmouseup||g,C=void 0!==navigator.xr,R=function(){if((r.os===Nu.IOS||r.os===Nu.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={})[Fu.WEBP]=S,n[Fu.IMAGE_BITMAP]=!1,n[Fu.WEB_VIEW]=!0,n[Fu.VIDEO_PLAYER]=!0,n[Fu.SAFE_AREA]=!1,n[Fu.HPE]=!1,n[Fu.INPUT_TOUCH]=b,n[Fu.EVENT_KEYBOARD]=void 0!==document.documentElement.onkeyup||g,n[Fu.EVENT_MOUSE]=x,n[Fu.EVENT_TOUCH]=b||x,n[Fu.EVENT_ACCELEROMETER]=void 0!==window.DeviceMotionEvent||void 0!==window.DeviceOrientationEvent,n[Fu.EVENT_GAMEPAD]=void 0!==navigator.getGamepads||void 0!==navigator.webkitGetGamepads||C,n[Fu.EVENT_HANDLE]=false,n[Fu.EVENT_HMD]=C,n[Fu.EVENT_HANDHELD]=C,n[Fu.WASM]=R,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(Fu.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.close=function(){this.emit("close"),window.close()},e}(Du)),Vu=/(\.[^\.\/\?\\]*)(\?.*)?$/,Uu=/((.*)(\/|\\|\\\\))?(.*?\..*$)?/,zu=/[^\.\/]+\/\.\.\//;function Hu(){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 Wu(t){var e=Vu.exec(t);return e?e[1]:""}function Xu(t){if(t){var e=t.lastIndexOf(".");if(-1!==e)return t.substring(0,e)}return t}function ju(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 Yu(t){var e=Uu.exec(t);return e?e[2]:""}function qu(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 Ku(t,e,i){if(0===e.indexOf("."))return qu(t,e);var n=t.indexOf("?"),r="",s=i?Wu(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 Ju(t){var e=t=String(t);do{e=t,t=t.replace(zu,"")}while(e.length!==t.length);return t}function Qu(t){return t.replace(/[\/\\]$/,"")}function Zu(){return Gu.os===Nu.WINDOWS?"\\":"/"}t("bg",Object.freeze({__proto__:null,join:Hu,extname:Wu,mainFileName:Xu,basename:ju,dirname:Yu,changeExtname:qu,changeBasename:Ku,_normalize:Ju,stripSep:Qu,getSeperator:Zu}));var $u=new Yi;function tl(t,e,i,n){n||(n=new Yi),t.convertToUINode(e,i,n);var r=i.position;return n.add(r),n}function el(t,e,i){return i||(i=new Yi),t.worldToScreen(e,i),i.x/=v.view.getScaleX(),i.y/=v.view.getScaleY(),i}var il,nl=t("bq",{WorldNode3DToLocalNodeUI:tl,WorldNode3DToWorldNodeUI:el});v.pipelineUtils=nl,nt(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]||$u;return n.convertToUINode(e[1],e[2],r),r.add(e[2].position),e[3]||r.clone()}}]),st(fe,"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"}(il||(il={}));var rl,sl={auto:il.AUTO,landscape:il.LANDSCAPE,portrait:il.PORTRAIT};!function(t){t[t.Unknown=0]="Unknown",t[t.SubFrame=1]="SubFrame",t[t.BrowserWindow=2]="BrowserWindow",t[t.Fullscreen=3]="Fullscreen"}(rl||(rl={}));var al=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 An(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=il.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=sl[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===rl.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===rl.Fullscreen?document[this._fn.fullscreenElement]:t===rl.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=Gu.isMobile&&(e&&t===il.PORTRAIT||!e&&t===il.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===rl.SubFrame?this._resizeFrame(this._convertToSizeInCssPixels(t)):q(9202)}},{key:"resolution",get:function(){var t=this.windowSize,e=this.resolutionScale;return new An(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 An(this._gameContainer.clientWidth,this._gameContainer.clientHeight):(q(9201),new An(0,0));var t,e,i;switch(this._windowType){case rl.SubFrame:return this._gameFrame?new An(this._gameFrame.clientWidth,this._gameFrame.clientHeight):(q(9201),new An(0,0));case rl.Fullscreen:return t=this._getFullscreenTarget(),e=this.isFrameRotated?t.clientHeight:t.clientWidth,i=this.isFrameRotated?t.clientWidth:t.clientHeight,new An(e,i);case rl.BrowserWindow:return e=this.isFrameRotated?window.innerHeight:window.innerWidth,i=this.isFrameRotated?window.innerWidth:window.innerHeight,new An(e,i);case rl.Unknown:default:return new An(0,0)}}},{key:"_windowType",get:function(){return this._isHeadlessMode?rl.Unknown:this.isFullScreen?rl.Fullscreen:this._gameFrame?this._exactFitScreen?rl.BrowserWindow:rl.SubFrame:(q(9201),rl.Unknown)}}]),e}(Du)),ol=function(){function t(){}var e=t.prototype;return e.init=function(){var t,e,i=null===(t=Ee.querySettings(Te.Category.SCREEN,"exactFitScreen"))||void 0===t||t,n=null!==(e=Ee.querySettings(Te.Category.SCREEN,"orientation"))&&void 0!==e?e:"auto",r=3===Ee.querySettings(Te.Category.RENDERING,"renderMode");al.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=al.resolutionScale:q(1220)}))},e.fullScreen=function(){return al.isFullScreen},e.requestFullScreen=function(t,e,i){return arguments.length>0&&q(1400,"screen.requestFullScreen(element, onFullScreenChange?, onFullScreenError?)","screen.requestFullScreen(): Promise"),al.requestFullScreen().then((function(){null==e||e.call(document)})).catch((function(t){console.error(t),null==i||i.call(document)}))},e.exitFullScreen=function(){return al.exitFullScreen()},e.autoFullScreen=function(t,e){var i;null===(i=this.requestFullScreen(t,e))||void 0===i||i.catch((function(){}))},e.disableAutoFullScreen=function(){},e.on=function(t,e,i){al.on(t,e,i)},e.once=function(t,e,i){al.once(t,e,i)},e.off=function(t,e,i){al.off(t,e,i)},n(t,[{key:"devicePixelRatio",get:function(){return al.devicePixelRatio}},{key:"windowSize",get:function(){return al.windowSize},set:function(t){al.windowSize=t}},{key:"resolution",get:function(){return al.resolution}},{key:"supportsFullScreen",get:function(){return al.supportFullScreen}}]),t}(),hl=t("bV",new ol);v.screen=hl;var ul=t("bW",{Feature:Fu,hasFeature:function(t){return Gu.hasFeature(t)},NetworkType:Mu,Language:Ou,OS:Nu,Platform:Lu,BrowserType:Pu,isNative:Gu.isNative,isBrowser:Gu.isBrowser,isMobile:Gu.isMobile,isLittleEndian:Gu.isLittleEndian,platform:Gu.platform,language:Gu.language,languageCode:Gu.nativeLanguage,os:Gu.os,osVersion:Gu.osVersion,osMainVersion:Gu.osMainVersion,browserType:Gu.browserType,browserVersion:Gu.browserVersion,isXR:Gu.isXR,windowPixelResolution:hl.windowSize,capabilities:{canvas:!0,opengl:!0,webp:Gu.hasFeature(Fu.WEBP),imageBitmap:Gu.hasFeature(Fu.IMAGE_BITMAP),touches:Gu.hasFeature(Fu.INPUT_TOUCH),mouse:Gu.hasFeature(Fu.EVENT_MOUSE),keyboard:Gu.hasFeature(Fu.EVENT_KEYBOARD),accelerometer:Gu.hasFeature(Fu.EVENT_ACCELEROMETER)},localStorage:{},getNetworkType:function(){return Gu.networkType},getBatteryLevel:function(){return Gu.getBatteryLevel()},garbageCollect:function(){Gu.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: "+ul.hasFeature(Fu.WEBP)+"\r\n",t+="supports bitmap: "+ul.hasFeature(Fu.IMAGE_BITMAP)+"\r\n",t+="supports touches: "+ul.hasFeature(Fu.INPUT_TOUCH)+"\r\n",t+="supports mouse: "+ul.hasFeature(Fu.EVENT_MOUSE)+"\r\n",t+="supports keyboard: "+ul.hasFeature(Fu.EVENT_KEYBOARD)+"\r\n",t+="supports accelerometer: "+ul.hasFeature(Fu.EVENT_ACCELEROMETER)+"\r\n",t+="os : "+this.os+"\r\n",t+="osVersion : "+this.osVersion+"\r\n",t+="platform : "+this.platform+"\r\n",F(t+="Using "+(v.game.renderType===v.game.RENDER_TYPE_WEBGL?"WEBGL":"CANVAS")+" renderer.\r\n")},openURL:function(t){Gu.openURL(t)},init:function(){var t=this;return Promise.resolve().then((function(){return Gu.init()})).then((function(){try{var e=ul.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=(ul.os===Nu.IOS||ul.os===Nu.OSX)&&Gu.isBrowser&&/(OS 14)|(Version\/14)/.test(window.navigator.userAgent)}))},now:function(){return Gu.now()},restartVM:function(){Gu.restartJSVM()},getSafeAreaRect:function(){var t=v.view,e=al.safeAreaEdge,i=al.windowSize,n=new yn(e.left,e.bottom),r=new yn(i.width-e.right,i.height-e.top);t._convertToUISpace(n),t._convertToUISpace(r);var s=n.x,a=n.y,o=r.x-n.x,h=r.y-n.y;return new En(s,a,o,h)}});v.sys=ul,st(v,"cc",[{name:"winSize",suggest:"please use view.getVisibleSize() instead."}]),st(ul,"sys",[{name:"capabilities",suggest:"please use sys.hasFeature() method instead."}]),nt(ul,"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:ul.Language,targetName:"sys.Language"}}))),nt(ul,"sys",["UNKNOWN","IOS","ANDROID","WINDOWS","LINUX","OSX"].map((function(t){return{name:"OS_"+t,newName:t,target:ul.OS,targetName:"sys.OS"}}))),nt(ul,"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:ul.BrowserType,targetName:"sys.BrowserType"}}))),nt(ul,"sys",[{name:"BROWSER_TYPE_360",newName:"BROWSER_360",target:ul.BrowserType,targetName:"sys.BrowserType"}]),nt(ul,"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:ul.Platform,targetName:"sys.Platform"}}))),nt(ul,"sys",[{name:"IPHONE",newName:"IOS",target:ul.Platform,targetName:"sys.Platform"},{name:"IPAD",newName:"IOS",target:ul.Platform,targetName:"sys.Platform"}]),rt(ul,"sys",["LINUX","BLACKBERRY","NACL","EMSCRIPTEN","TIZEN","WINRT","WP8","QQ_PLAY","FB_PLAYABLE_ADS"].map((function(t){return{name:t}}))),nt(ul,"sys",[{name:"windowPixelResolution",target:hl,targetName:"screen",newName:"windowSize"}]),st(hl,"screen",[{name:"autoFullScreen",suggest:"please use screen.requestFullScreen() instead."},{name:"disableAutoFullScreen"}]);var ll=t("bY",{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=ll;var cl=String.prototype.charCodeAt;function _l(t){return this[t]}function fl(t,e){for(var i=t.length,n=e^i,r=0,s="string"==typeof t?cl:_l;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 dl(){}v.easing=Ro,dl.prototype.once=function(t,e,i){return this.on(t,e,i,!0)},dl.prototype.targetOff=function(t){this.removeAll(t)},t("cf",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:dl}));var pl=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}(),ml=t("ct",new pl),gl=t("cu",function(){function t(){return ml.registerGCObject(this)}return t.prototype.destroy=function(){},t}());function yl(t,e){for(var i,n=f(e);!(i=n()).done;){var r=i.value;Array.isArray(r)?yl(t,r):t.push(r)}}function vl(t){var e=[];return yl(e,t),e.join("")}v.math=Rn,v.geometry=uu;var Sl,Al,Tl,El,bl,xl,Cl,Rl,wl,Il,Bl,Dl,Pl,Ol,Ml,Nl,Ll,Fl,kl,Gl,Vl,Ul,zl,Hl,Wl,Xl,jl,Yl,ql,Kl,Jl,Ql,Zl,$l,tc,ec,ic,nc,rc,sc,ac,oc,hc,uc,lc=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"}(Sl||(Sl={})),function(t){t[t.UNREADY=0]="UNREADY",t[t.FAILED=1]="FAILED",t[t.SUCCESS=2]="SUCCESS"}(Al||(Al={})),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"}(Tl||(Tl={})),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"}(El||(El={})),function(t){t[t.ELEMENT_INDEX_UINT=0]="ELEMENT_INDEX_UINT",t[t.INSTANCED_ARRAYS=1]="INSTANCED_ARRAYS",t[t.MULTIPLE_RENDER_TARGETS=2]="MULTIPLE_RENDER_TARGETS",t[t.BLEND_MINMAX=3]="BLEND_MINMAX",t[t.COMPUTE_SHADER=4]="COMPUTE_SHADER",t[t.INPUT_ATTACHMENT_BENEFIT=5]="INPUT_ATTACHMENT_BENEFIT",t[t.SUBPASS_COLOR_INPUT=6]="SUBPASS_COLOR_INPUT",t[t.SUBPASS_DEPTH_STENCIL_INPUT=7]="SUBPASS_DEPTH_STENCIL_INPUT",t[t.RASTERIZATION_ORDER_COHERENT=8]="RASTERIZATION_ORDER_COHERENT",t[t.COUNT=9]="COUNT"}(bl||(bl={})),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"}(xl||(xl={})),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"}(Cl||(Cl={})),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"}(Rl||(Rl={})),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"}(wl||(wl={})),function(t){t[t.NONE=0]="NONE"}(Il||(Il={})),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"}(Bl||(Bl={})),function(t){t[t.NONE=0]="NONE",t[t.DEVICE=1]="DEVICE",t[t.HOST=2]="HOST"}(Dl||(Dl={})),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"}(Pl||(Pl={})),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"}(Ol||(Ol={})),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"}(Ml||(Ml={})),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"}(Nl||(Nl={})),function(t){t[t.ONE=0]="ONE",t[t.MULTIPLE_PERFORMANCE=1]="MULTIPLE_PERFORMANCE",t[t.MULTIPLE_BALANCE=2]="MULTIPLE_BALANCE",t[t.MULTIPLE_QUALITY=3]="MULTIPLE_QUALITY"}(Ll||(Ll={})),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"}(Fl||(Fl={})),function(t){t[t.NONE=0]="NONE",t[t.POINT=1]="POINT",t[t.LINEAR=2]="LINEAR",t[t.ANISOTROPIC=3]="ANISOTROPIC"}(kl||(kl={})),function(t){t[t.WRAP=0]="WRAP",t[t.MIRROR=1]="MIRROR",t[t.CLAMP=2]="CLAMP",t[t.BORDER=3]="BORDER"}(Gl||(Gl={})),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"}(Vl||(Vl={})),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"}(Ul||(Ul={})),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"}(zl||(zl={})),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"}(Hl||(Hl={})),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"}(Wl||(Wl={})),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"}(Xl||(Xl={})),function(t){t[t.LOAD=0]="LOAD",t[t.CLEAR=1]="CLEAR",t[t.DISCARD=2]="DISCARD"}(jl||(jl={})),function(t){t[t.STORE=0]="STORE",t[t.DISCARD=1]="DISCARD"}(Yl||(Yl={})),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"}(ql||(ql={})),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"}(Kl||(Kl={})),function(t){t[t.GRAPHICS=0]="GRAPHICS",t[t.COMPUTE=1]="COMPUTE",t[t.RAY_TRACING=2]="RAY_TRACING"}(Jl||(Jl={})),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"}(Ql||(Ql={})),function(t){t[t.FILL=0]="FILL",t[t.POINT=1]="POINT",t[t.LINE=2]="LINE"}(Zl||(Zl={})),function(t){t[t.GOURAND=0]="GOURAND",t[t.FLAT=1]="FLAT"}($l||($l={})),function(t){t[t.NONE=0]="NONE",t[t.FRONT=1]="FRONT",t[t.BACK=2]="BACK"}(tc||(tc={})),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"}(ic||(ic={})),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"}(nc||(nc={})),function(t){t[t.GRAPHICS=0]="GRAPHICS",t[t.COMPUTE=1]="COMPUTE",t[t.TRANSFER=2]="TRANSFER"}(rc||(rc={})),function(t){t[t.OCCLUSION=0]="OCCLUSION",t[t.PIPELINE_STATISTICS=1]="PIPELINE_STATISTICS",t[t.TIMESTAMP=2]="TIMESTAMP"}(sc||(sc={})),function(t){t[t.PRIMARY=0]="PRIMARY",t[t.SECONDARY=1]="SECONDARY"}(ac||(ac={})),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"}(oc||(oc={})),function(t){t[t.FULL=0]="FULL",t[t.SPLIT_BEGIN=1]="SPLIT_BEGIN",t[t.SPLIT_END=2]="SPLIT_END"}(hc||(hc={})),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"}(uc||(uc={}));var cc,_c=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,r,s,a,o,h,u,l,c,_,f,d,p,m,g,y,v,S,A,T,E){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===f&&(f=0),void 0===d&&(d=0),void 0===p&&(p=1),void 0===m&&(m=0),void 0===g&&(g=0),void 0===y&&(y=new _c),void 0===v&&(v=new _c),void 0===S&&(S=!1),void 0===A&&(A=-1),void 0===T&&(T=1),void 0===E&&(E=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=f,this.max3DTextureSize=d,this.uboOffsetAlignment=p,this.maxComputeSharedMemorySize=m,this.maxComputeWorkGroupInvocations=g,this.maxComputeWorkGroupSize=y,this.maxComputeWorkGroupCount=v,this.supportQuery=S,this.clipSpaceMinZ=A,this.screenSpaceSignY=T,this.clipSpaceSignY=E}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}(),dc=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}(),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}(),mc=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}(),gc=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}(),yc=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}(),vc=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}(),Sc=function(){function t(t,e,i,n,r){void 0===t&&(t=new yc),void 0===e&&(e=new pc),void 0===i&&(i=new yc),void 0===n&&(n=new pc),void 0===r&&(r=new gc),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}(),Ac=function(){function t(t,e,i,n,r,s){void 0===t&&(t=new yc),void 0===e&&(e=new pc),void 0===i&&(i=new gc),void 0===n&&(n=new yc),void 0===r&&(r=new pc),void 0===s&&(s=new gc),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}(),Tc=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 pc),void 0===r&&(r=new gc),void 0===s&&(s=new yc),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}(),Ec=function(){function t(t,e,i,n,r,s){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=1),this.left=t,this.top=e,this.width=i,this.height=n,this.minDepth=r,this.maxDepth=s}return t.prototype.copy=function(t){return this.left=t.left,this.top=t.top,this.width=t.width,this.height=t.height,this.minDepth=t.minDepth,this.maxDepth=t.maxDepth,this},t}(),bc=function(){function t(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),this.x=t,this.y=e,this.z=i,this.w=n}var e=t.prototype;return e.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},e.set=function(t,e,i,n){return this.x=t,this.y=e,this.z=i,this.w=n,this},t}(),xc=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}(),Cc=function(){function t(t,e,i,n,r){void 0===t&&(t=0),void 0===e&&(e=null),void 0===i&&(i=Fl.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}(),Rc=function(){function t(t){void 0===t&&(t=new xc),this.bindingMappingInfo=t}return t.prototype.copy=function(t){return this.bindingMappingInfo.copy(t.bindingMappingInfo),this},t}(),wc=function(){function t(t,e,i,n,r){void 0===t&&(t=wl.NONE),void 0===e&&(e=Dl.NONE),void 0===i&&(i=0),void 0===n&&(n=1),void 0===r&&(r=Il.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}(),Ic=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}(),Bc=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}(),Dc=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}(),Pc=function(){function t(t){void 0===t&&(t=[]),this.drawInfos=t}return t.prototype.copy=function(t){return lc(this.drawInfos,t.drawInfos,Bc),this},t}(),Oc=function(){function t(t,e,i,n,r,s,a,o,h,u,l){void 0===t&&(t=Pl.TEX2D),void 0===e&&(e=Ol.NONE),void 0===i&&(i=xl.UNKNOWN),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=Ml.NONE),void 0===a&&(a=1),void 0===o&&(o=1),void 0===h&&(h=Ll.ONE),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}(),Mc=function(){function t(t,e,i,n,r,s,a){void 0===t&&(t=null),void 0===e&&(e=Pl.TEX2D),void 0===i&&(i=xl.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}(),Nc=function(){function t(t,e,i,n,r,s,a,o){void 0===t&&(t=kl.LINEAR),void 0===e&&(e=kl.LINEAR),void 0===i&&(i=kl.NONE),void 0===n&&(n=Gl.WRAP),void 0===r&&(r=Gl.WRAP),void 0===s&&(s=Gl.WRAP),void 0===a&&(a=0),void 0===o&&(o=Vl.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}(),Lc=function(){function t(t,e,i){void 0===t&&(t=""),void 0===e&&(e=Rl.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}(),Fc=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,lc(this.members,t.members,Lc),this.count=t.count,this.flattened=t.flattened,this},t}(),kc=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=Rl.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}(),Gc=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}(),Vc=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=Rl.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}(),Uc=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=Rl.UNKNOWN),void 0===r&&(r=0),void 0===s&&(s=Bl.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}(),zc=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=Bl.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}(),Hc=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}(),Wc=function(){function t(t,e){void 0===t&&(t=Xl.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}(),Xc=function(){function t(t,e,i,n,r,s){void 0===t&&(t=""),void 0===e&&(e=xl.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}(),jc=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,lc(this.stages,t.stages,Wc),lc(this.attributes,t.attributes,Xc),lc(this.blocks,t.blocks,Fc),lc(this.buffers,t.buffers,zc),lc(this.samplerTextures,t.samplerTextures,kc),lc(this.samplers,t.samplers,Gc),lc(this.textures,t.textures,Vc),lc(this.images,t.images,Uc),lc(this.subpassInputs,t.subpassInputs,Hc),this},t}(),Yc=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 lc(this.attributes,t.attributes,Xc),this.vertexBuffers=t.vertexBuffers.slice(),this.indexBuffer=t.indexBuffer,this.indirectBuffer=t.indirectBuffer,this},t}(),qc=function(){function t(t,e,i,n,r){void 0===t&&(t=xl.UNKNOWN),void 0===e&&(e=Ll.ONE),void 0===i&&(i=jl.CLEAR),void 0===n&&(n=Yl.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}(),Kc=function(){function t(t,e,i,n,r,s,a){void 0===t&&(t=xl.UNKNOWN),void 0===e&&(e=Ll.ONE),void 0===i&&(i=jl.CLEAR),void 0===n&&(n=Yl.STORE),void 0===r&&(r=jl.CLEAR),void 0===s&&(s=Yl.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}(),Jc=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=Kl.NONE),void 0===o&&(o=Kl.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}(),Qc=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=[ql.NONE]),void 0===r&&(r=[ql.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}(),Zc=function(){function t(t,e,i,n){void 0===t&&(t=[]),void 0===e&&(e=new Kc),void 0===i&&(i=[]),void 0===n&&(n=[]),this.colorAttachments=t,this.depthStencilAttachment=e,this.subpasses=i,this.dependencies=n}return t.prototype.copy=function(t){return lc(this.colorAttachments,t.colorAttachments,qc),this.depthStencilAttachment.copy(t.depthStencilAttachment),lc(this.subpasses,t.subpasses,Jc),lc(this.dependencies,t.dependencies,Qc),this},t}(),$c=function(){function t(t,e,i){void 0===t&&(t=ql.NONE),void 0===e&&(e=ql.NONE),void 0===i&&(i=hc.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}(),t_=function(){function t(t,e,i,n,r,s,a,o,h,u){void 0===t&&(t=ql.NONE),void 0===e&&(e=ql.NONE),void 0===i&&(i=hc.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=ql.NONE),void 0===e&&(e=ql.NONE),void 0===i&&(i=hc.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}(),i_=function(){function t(t,e,i){void 0===t&&(t=null),void 0===e&&(e=[]),void 0===i&&(i=null),this.renderPass=t,this.colorTextures=e,this.depthStencilTexture=i}return t.prototype.copy=function(t){return this.renderPass=t.renderPass,this.colorTextures=t.colorTextures.slice(),this.depthStencilTexture=t.depthStencilTexture,this},t}(),n_=function(){function t(t,e,i,n,r){void 0===t&&(t=-1),void 0===e&&(e=nc.UNKNOWN),void 0===i&&(i=0),void 0===n&&(n=Xl.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}(),r_=function(){function t(t){void 0===t&&(t=[]),this.bindings=t}return t.prototype.copy=function(t){return lc(this.bindings,t.bindings,n_),this},t}(),s_=function(){function t(t){void 0===t&&(t=null),this.layout=t}return t.prototype.copy=function(t){return this.layout=t.layout,this},t}(),a_=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}(),o_=function(){function t(t){void 0===t&&(t=[]),this.attributes=t}return t.prototype.copy=function(t){return lc(this.attributes,t.attributes,Xc),this},t}(),h_=function(){function t(t,e){void 0===t&&(t=null),void 0===e&&(e=ac.PRIMARY),this.queue=t,this.type=e}return t.prototype.copy=function(t){return this.queue=t.queue,this.type=t.type,this},t}(),u_=function(){function t(t){void 0===t&&(t=rc.GRAPHICS),this.type=t}return t.prototype.copy=function(t){return this.type=t.type,this},t}(),l_=function(){function t(t,e,i){void 0===t&&(t=sc.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}(),c_=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=Cl.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},__=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}(),f_=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}(),d_=function(){function t(t,e,i,n,r,s,a,o,h,u,l){void 0===t&&(t=new Ec),void 0===e&&(e=new mc),void 0===i&&(i=new bc),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 f_),void 0===l&&(l=new f_),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}(),p_=function(t){function e(i){var n;return(n=t.call(this)||this)._objectType=Sl.UNKNOWN,n._objectID=0,n._typedID=0,n._objectType=i,n._objectID=e._idTable[Sl.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}(gl);p_._idTable=Array(Sl.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"}(cc||(cc={}));var m_=Object.freeze([new c_("UNKNOWN",0,0,Cl.NONE,!1,!1,!1,!1),new c_("A8",1,1,Cl.UNORM,!0,!1,!1,!1),new c_("L8",1,1,Cl.UNORM,!1,!1,!1,!1),new c_("LA8",1,2,Cl.UNORM,!0,!1,!1,!1),new c_("R8",1,1,Cl.UNORM,!1,!1,!1,!1),new c_("R8SN",1,1,Cl.SNORM,!1,!1,!1,!1),new c_("R8UI",1,1,Cl.UINT,!1,!1,!1,!1),new c_("R8I",1,1,Cl.INT,!1,!1,!1,!1),new c_("R16F",2,1,Cl.FLOAT,!1,!1,!1,!1),new c_("R16UI",2,1,Cl.UINT,!1,!1,!1,!1),new c_("R16I",2,1,Cl.INT,!1,!1,!1,!1),new c_("R32F",4,1,Cl.FLOAT,!1,!1,!1,!1),new c_("R32UI",4,1,Cl.UINT,!1,!1,!1,!1),new c_("R32I",4,1,Cl.INT,!1,!1,!1,!1),new c_("RG8",2,2,Cl.UNORM,!1,!1,!1,!1),new c_("RG8SN",2,2,Cl.SNORM,!1,!1,!1,!1),new c_("RG8UI",2,2,Cl.UINT,!1,!1,!1,!1),new c_("RG8I",2,2,Cl.INT,!1,!1,!1,!1),new c_("RG16F",4,2,Cl.FLOAT,!1,!1,!1,!1),new c_("RG16UI",4,2,Cl.UINT,!1,!1,!1,!1),new c_("RG16I",4,2,Cl.INT,!1,!1,!1,!1),new c_("RG32F",8,2,Cl.FLOAT,!1,!1,!1,!1),new c_("RG32UI",8,2,Cl.UINT,!1,!1,!1,!1),new c_("RG32I",8,2,Cl.INT,!1,!1,!1,!1),new c_("RGB8",3,3,Cl.UNORM,!1,!1,!1,!1),new c_("SRGB8",3,3,Cl.UNORM,!1,!1,!1,!1),new c_("RGB8SN",3,3,Cl.SNORM,!1,!1,!1,!1),new c_("RGB8UI",3,3,Cl.UINT,!1,!1,!1,!1),new c_("RGB8I",3,3,Cl.INT,!1,!1,!1,!1),new c_("RGB16F",6,3,Cl.FLOAT,!1,!1,!1,!1),new c_("RGB16UI",6,3,Cl.UINT,!1,!1,!1,!1),new c_("RGB16I",6,3,Cl.INT,!1,!1,!1,!1),new c_("RGB32F",12,3,Cl.FLOAT,!1,!1,!1,!1),new c_("RGB32UI",12,3,Cl.UINT,!1,!1,!1,!1),new c_("RGB32I",12,3,Cl.INT,!1,!1,!1,!1),new c_("RGBA8",4,4,Cl.UNORM,!0,!1,!1,!1),new c_("BGRA8",4,4,Cl.UNORM,!0,!1,!1,!1),new c_("SRGB8_A8",4,4,Cl.UNORM,!0,!1,!1,!1),new c_("RGBA8SN",4,4,Cl.SNORM,!0,!1,!1,!1),new c_("RGBA8UI",4,4,Cl.UINT,!0,!1,!1,!1),new c_("RGBA8I",4,4,Cl.INT,!0,!1,!1,!1),new c_("RGBA16F",8,4,Cl.FLOAT,!0,!1,!1,!1),new c_("RGBA16UI",8,4,Cl.UINT,!0,!1,!1,!1),new c_("RGBA16I",8,4,Cl.INT,!0,!1,!1,!1),new c_("RGBA32F",16,4,Cl.FLOAT,!0,!1,!1,!1),new c_("RGBA32UI",16,4,Cl.UINT,!0,!1,!1,!1),new c_("RGBA32I",16,4,Cl.INT,!0,!1,!1,!1),new c_("R5G6B5",2,3,Cl.UNORM,!1,!1,!1,!1),new c_("R11G11B10F",4,3,Cl.FLOAT,!1,!1,!1,!1),new c_("RGB5A1",2,4,Cl.UNORM,!0,!1,!1,!1),new c_("RGBA4",2,4,Cl.UNORM,!0,!1,!1,!1),new c_("RGB10A2",2,4,Cl.UNORM,!0,!1,!1,!1),new c_("RGB10A2UI",2,4,Cl.UINT,!0,!1,!1,!1),new c_("RGB9E5",2,4,Cl.FLOAT,!0,!1,!1,!1),new c_("DEPTH",4,1,Cl.FLOAT,!1,!0,!1,!1),new c_("DEPTH_STENCIL",5,2,Cl.FLOAT,!1,!0,!0,!1),new c_("BC1",1,3,Cl.UNORM,!1,!1,!1,!0),new c_("BC1_ALPHA",1,4,Cl.UNORM,!0,!1,!1,!0),new c_("BC1_SRGB",1,3,Cl.UNORM,!1,!1,!1,!0),new c_("BC1_SRGB_ALPHA",1,4,Cl.UNORM,!0,!1,!1,!0),new c_("BC2",1,4,Cl.UNORM,!0,!1,!1,!0),new c_("BC2_SRGB",1,4,Cl.UNORM,!0,!1,!1,!0),new c_("BC3",1,4,Cl.UNORM,!0,!1,!1,!0),new c_("BC3_SRGB",1,4,Cl.UNORM,!0,!1,!1,!0),new c_("BC4",1,1,Cl.UNORM,!1,!1,!1,!0),new c_("BC4_SNORM",1,1,Cl.SNORM,!1,!1,!1,!0),new c_("BC5",1,2,Cl.UNORM,!1,!1,!1,!0),new c_("BC5_SNORM",1,2,Cl.SNORM,!1,!1,!1,!0),new c_("BC6H_UF16",1,3,Cl.UFLOAT,!1,!1,!1,!0),new c_("BC6H_SF16",1,3,Cl.FLOAT,!1,!1,!1,!0),new c_("BC7",1,4,Cl.UNORM,!0,!1,!1,!0),new c_("BC7_SRGB",1,4,Cl.UNORM,!0,!1,!1,!0),new c_("ETC_RGB8",1,3,Cl.UNORM,!1,!1,!1,!0),new c_("ETC2_RGB8",1,3,Cl.UNORM,!1,!1,!1,!0),new c_("ETC2_SRGB8",1,3,Cl.UNORM,!1,!1,!1,!0),new c_("ETC2_RGB8_A1",1,4,Cl.UNORM,!0,!1,!1,!0),new c_("ETC2_SRGB8_A1",1,4,Cl.UNORM,!0,!1,!1,!0),new c_("ETC2_RGBA8",2,4,Cl.UNORM,!0,!1,!1,!0),new c_("ETC2_SRGB8_A8",2,4,Cl.UNORM,!0,!1,!1,!0),new c_("EAC_R11",1,1,Cl.UNORM,!1,!1,!1,!0),new c_("EAC_R11SN",1,1,Cl.SNORM,!1,!1,!1,!0),new c_("EAC_RG11",2,2,Cl.UNORM,!1,!1,!1,!0),new c_("EAC_RG11SN",2,2,Cl.SNORM,!1,!1,!1,!0),new c_("PVRTC_RGB2",2,3,Cl.UNORM,!1,!1,!1,!0),new c_("PVRTC_RGBA2",2,4,Cl.UNORM,!0,!1,!1,!0),new c_("PVRTC_RGB4",2,3,Cl.UNORM,!1,!1,!1,!0),new c_("PVRTC_RGBA4",2,4,Cl.UNORM,!0,!1,!1,!0),new c_("PVRTC2_2BPP",2,4,Cl.UNORM,!0,!1,!1,!0),new c_("PVRTC2_4BPP",2,4,Cl.UNORM,!0,!1,!1,!0),new c_("ASTC_RGBA_4x4",1,4,Cl.UNORM,!0,!1,!1,!0),new c_("ASTC_RGBA_5x4",1,4,Cl.UNORM,!0,!1,!1,!0),new c_("ASTC_RGBA_5x5",1,4,Cl.UNORM,!0,!1,!1,!0),new c_("ASTC_RGBA_6x5",1,4,Cl.UNORM,!0,!1,!1,!0),new c_("ASTC_RGBA_6x6",1,4,Cl.UNORM,!0,!1,!1,!0),new c_("ASTC_RGBA_8x5",1,4,Cl.UNORM,!0,!1,!1,!0),new c_("ASTC_RGBA_8x6",1,4,Cl.UNORM,!0,!1,!1,!0),new c_("ASTC_RGBA_8x8",1,4,Cl.UNORM,!0,!1,!1,!0),new c_("ASTC_RGBA_10x5",1,4,Cl.UNORM,!0,!1,!1,!0),new c_("ASTC_RGBA_10x6",1,4,Cl.UNORM,!0,!1,!1,!0),new c_("ASTC_RGBA_10x8",1,4,Cl.UNORM,!0,!1,!1,!0),new c_("ASTC_RGBA_10x10",1,4,Cl.UNORM,!0,!1,!1,!0),new c_("ASTC_RGBA_12x10",1,4,Cl.UNORM,!0,!1,!1,!0),new c_("ASTC_RGBA_12x12",1,4,Cl.UNORM,!0,!1,!1,!0),new c_("ASTC_SRGBA_4x4",1,4,Cl.UNORM,!0,!1,!1,!0),new c_("ASTC_SRGBA_5x4",1,4,Cl.UNORM,!0,!1,!1,!0),new c_("ASTC_SRGBA_5x5",1,4,Cl.UNORM,!0,!1,!1,!0),new c_("ASTC_SRGBA_6x5",1,4,Cl.UNORM,!0,!1,!1,!0),new c_("ASTC_SRGBA_6x6",1,4,Cl.UNORM,!0,!1,!1,!0),new c_("ASTC_SRGBA_8x5",1,4,Cl.UNORM,!0,!1,!1,!0),new c_("ASTC_SRGBA_8x6",1,4,Cl.UNORM,!0,!1,!1,!0),new c_("ASTC_SRGBA_8x8",1,4,Cl.UNORM,!0,!1,!1,!0),new c_("ASTC_SRGBA_10x5",1,4,Cl.UNORM,!0,!1,!1,!0),new c_("ASTC_SRGBA_10x6",1,4,Cl.UNORM,!0,!1,!1,!0),new c_("ASTC_SRGBA_10x8",1,4,Cl.UNORM,!0,!1,!1,!0),new c_("ASTC_SRGBA_10x10",1,4,Cl.UNORM,!0,!1,!1,!0),new c_("ASTC_SRGBA_12x10",1,4,Cl.UNORM,!0,!1,!1,!0),new c_("ASTC_SRGBA_12x12",1,4,Cl.UNORM,!0,!1,!1,!0)]),g_=nc.UNIFORM_BUFFER|nc.DYNAMIC_UNIFORM_BUFFER|nc.STORAGE_BUFFER|nc.DYNAMIC_STORAGE_BUFFER,y_=nc.SAMPLER_TEXTURE|nc.SAMPLER|nc.TEXTURE|nc.STORAGE_IMAGE|nc.INPUT_ATTACHMENT,v_=nc.DYNAMIC_STORAGE_BUFFER|nc.DYNAMIC_UNIFORM_BUFFER;function S_(t){return t>0&&0==(t&t-1)}function A_(t,e,i,n){if(!m_[t].isCompressed)return e*i*n*m_[t].size;switch(t){case xl.BC1:case xl.BC1_ALPHA:case xl.BC1_SRGB:case xl.BC1_SRGB_ALPHA:return Math.ceil(e/4)*Math.ceil(i/4)*8*n;case xl.BC2:case xl.BC2_SRGB:case xl.BC3:case xl.BC3_SRGB:case xl.BC4:case xl.BC4_SNORM:case xl.BC6H_SF16:case xl.BC6H_UF16:case xl.BC7:case xl.BC7_SRGB:return Math.ceil(e/4)*Math.ceil(i/4)*16*n;case xl.BC5:case xl.BC5_SNORM:return Math.ceil(e/4)*Math.ceil(i/4)*32*n;case xl.ETC_RGB8:case xl.ETC2_RGB8:case xl.ETC2_SRGB8:case xl.ETC2_RGB8_A1:case xl.EAC_R11:case xl.EAC_R11SN:return Math.ceil(e/4)*Math.ceil(i/4)*8*n;case xl.ETC2_RGBA8:case xl.ETC2_SRGB8_A1:case xl.EAC_RG11:case xl.EAC_RG11SN:return Math.ceil(e/4)*Math.ceil(i/4)*16*n;case xl.PVRTC_RGB2:case xl.PVRTC_RGBA2:case xl.PVRTC2_2BPP:return Math.ceil(e/8)*Math.ceil(i/4)*8*n;case xl.PVRTC_RGB4:case xl.PVRTC_RGBA4:case xl.PVRTC2_4BPP:return Math.ceil(e/4)*Math.ceil(i/4)*8*n;case xl.ASTC_RGBA_4X4:case xl.ASTC_SRGBA_4X4:return Math.ceil(e/4)*Math.ceil(i/4)*16*n;case xl.ASTC_RGBA_5X4:case xl.ASTC_SRGBA_5X4:return Math.ceil(e/5)*Math.ceil(i/4)*16*n;case xl.ASTC_RGBA_5X5:case xl.ASTC_SRGBA_5X5:return Math.ceil(e/5)*Math.ceil(i/5)*16*n;case xl.ASTC_RGBA_6X5:case xl.ASTC_SRGBA_6X5:return Math.ceil(e/6)*Math.ceil(i/5)*16*n;case xl.ASTC_RGBA_6X6:case xl.ASTC_SRGBA_6X6:return Math.ceil(e/6)*Math.ceil(i/6)*16*n;case xl.ASTC_RGBA_8X5:case xl.ASTC_SRGBA_8X5:return Math.ceil(e/8)*Math.ceil(i/5)*16*n;case xl.ASTC_RGBA_8X6:case xl.ASTC_SRGBA_8X6:return Math.ceil(e/8)*Math.ceil(i/6)*16*n;case xl.ASTC_RGBA_8X8:case xl.ASTC_SRGBA_8X8:return Math.ceil(e/8)*Math.ceil(i/8)*16*n;case xl.ASTC_RGBA_10X5:case xl.ASTC_SRGBA_10X5:return Math.ceil(e/10)*Math.ceil(i/5)*16*n;case xl.ASTC_RGBA_10X6:case xl.ASTC_SRGBA_10X6:return Math.ceil(e/10)*Math.ceil(i/6)*16*n;case xl.ASTC_RGBA_10X8:case xl.ASTC_SRGBA_10X8:return Math.ceil(e/10)*Math.ceil(i/8)*16*n;case xl.ASTC_RGBA_10X10:case xl.ASTC_SRGBA_10X10:return Math.ceil(e/10)*Math.ceil(i/10)*16*n;case xl.ASTC_RGBA_12X10:case xl.ASTC_SRGBA_12X10:return Math.ceil(e/12)*Math.ceil(i/10)*16*n;case xl.ASTC_RGBA_12X12:case xl.ASTC_SRGBA_12X12:return Math.ceil(e/12)*Math.ceil(i/12)*16*n;default:return 0}}function T_(t,e,i,n,r){for(var s=0,a=0;a<r;++a)s+=A_(t,e,i,n),e=Math.max(e>>1,1),i=Math.max(i>>1,1);return s}var E_=[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 b_(t){return E_[t]||0}function x_(t){if(t.isCompressed)return Uint8Array;var e=t.size/t.count;switch(t.type){case Cl.UNORM:case Cl.UINT:switch(e){case 1:return Uint8Array;case 2:return Uint16Array;case 4:return Uint32Array;default:return Uint8Array}case Cl.SNORM:case Cl.INT:switch(e){case 1:return Int8Array;case 2:return Int16Array;case 4:return Int32Array;default:return Int8Array}case Cl.FLOAT:return Float32Array}return Float32Array}function C_(t){switch(t){case xl.BC1:case xl.BC1_ALPHA:case xl.BC1_SRGB:case xl.BC1_SRGB_ALPHA:case xl.BC2:case xl.BC2_SRGB:case xl.BC3:case xl.BC3_SRGB:case xl.BC4:case xl.BC4_SNORM:case xl.BC6H_SF16:case xl.BC6H_UF16:case xl.BC7:case xl.BC7_SRGB:case xl.BC5:case xl.BC5_SNORM:case xl.ETC_RGB8:case xl.ETC2_RGB8:case xl.ETC2_SRGB8:case xl.ETC2_RGB8_A1:case xl.EAC_R11:case xl.EAC_R11SN:case xl.ETC2_RGBA8:case xl.ETC2_SRGB8_A1:case xl.EAC_RG11:case xl.EAC_RG11SN:return{width:4,height:4};case xl.PVRTC_RGB2:case xl.PVRTC_RGBA2:case xl.PVRTC2_2BPP:return{width:8,height:4};case xl.PVRTC_RGB4:case xl.PVRTC_RGBA4:case xl.PVRTC2_4BPP:return{width:4,height:4};case xl.ASTC_RGBA_4X4:case xl.ASTC_SRGBA_4X4:return{width:4,height:4};case xl.ASTC_RGBA_5X4:case xl.ASTC_SRGBA_5X4:return{width:5,height:4};case xl.ASTC_RGBA_5X5:case xl.ASTC_SRGBA_5X5:return{width:5,height:5};case xl.ASTC_RGBA_6X5:case xl.ASTC_SRGBA_6X5:return{width:6,height:5};case xl.ASTC_RGBA_6X6:case xl.ASTC_SRGBA_6X6:return{width:6,height:6};case xl.ASTC_RGBA_8X5:case xl.ASTC_SRGBA_8X5:return{width:8,height:5};case xl.ASTC_RGBA_8X6:case xl.ASTC_SRGBA_8X6:return{width:8,height:6};case xl.ASTC_RGBA_8X8:case xl.ASTC_SRGBA_8X8:return{width:8,height:8};case xl.ASTC_RGBA_10X5:case xl.ASTC_SRGBA_10X5:return{width:10,height:5};case xl.ASTC_RGBA_10X6:case xl.ASTC_SRGBA_10X6:return{width:10,height:6};case xl.ASTC_RGBA_10X8:case xl.ASTC_SRGBA_10X8:return{width:10,height:8};case xl.ASTC_RGBA_10X10:case xl.ASTC_SRGBA_10X10:return{width:10,height:10};case xl.ASTC_RGBA_12X10:case xl.ASTC_SRGBA_12X10:return{width:12,height:10};case xl.ASTC_RGBA_12X12:case xl.ASTC_SRGBA_12X12:return{width:12,height:12};default:return{width:1,height:1}}}function R_(t,e){return Math.ceil(t/e)*e}var w_=Object.freeze({__proto__:null,get ObjectType(){return Sl},get Status(){return Al},get API(){return Tl},get SurfaceTransform(){return El},get Feature(){return bl},get Format(){return xl},get FormatType(){return Cl},get Type(){return Rl},get BufferUsageBit(){return wl},get BufferFlagBit(){return Il},get MemoryAccessBit(){return Bl},get MemoryUsageBit(){return Dl},get TextureType(){return Pl},get TextureUsageBit(){return Ol},get TextureFlagBit(){return Ml},get FormatFeatureBit(){return Nl},get SampleCount(){return Ll},get VsyncMode(){return Fl},get Filter(){return kl},get Address(){return Gl},get ComparisonFunc(){return Vl},get StencilOp(){return Ul},get BlendFactor(){return zl},get BlendOp(){return Hl},get ColorMask(){return Wl},get ShaderStageFlagBit(){return Xl},get LoadOp(){return jl},get StoreOp(){return Yl},get AccessFlagBit(){return ql},get ResolveMode(){return Kl},get PipelineBindPoint(){return Jl},get PrimitiveMode(){return Ql},get PolygonMode(){return Zl},get ShadeModel(){return $l},get CullMode(){return tc},get DynamicStateFlagBit(){return ec},get StencilFace(){return ic},get DescriptorType(){return nc},get QueueType(){return rc},get QueryType(){return sc},get CommandBufferType(){return ac},get ClearFlagBit(){return oc},get BarrierType(){return hc},get PassType(){return uc},Size:_c,DeviceCaps:fc,DeviceOptions:dc,Offset:pc,Rect:mc,Extent:gc,TextureSubresLayers:yc,TextureSubresRange:vc,TextureCopy:Sc,TextureBlit:Ac,BufferTextureCopy:Tc,Viewport:Ec,Color:bc,BindingMappingInfo:xc,SwapchainInfo:Cc,DeviceInfo:Rc,BufferInfo:wc,BufferViewInfo:Ic,DrawInfo:Bc,DispatchInfo:Dc,IndirectBuffer:Pc,TextureInfo:Oc,TextureViewInfo:Mc,SamplerInfo:Nc,Uniform:Lc,UniformBlock:Fc,UniformSamplerTexture:kc,UniformSampler:Gc,UniformTexture:Vc,UniformStorageImage:Uc,UniformStorageBuffer:zc,UniformInputAttachment:Hc,ShaderStage:Wc,Attribute:Xc,ShaderInfo:jc,InputAssemblerInfo:Yc,ColorAttachment:qc,DepthStencilAttachment:Kc,SubpassInfo:Jc,SubpassDependency:Qc,RenderPassInfo:Zc,GeneralBarrierInfo:$c,TextureBarrierInfo:t_,BufferBarrierInfo:e_,FramebufferInfo:i_,DescriptorSetLayoutBinding:n_,DescriptorSetLayoutInfo:r_,DescriptorSetInfo:s_,PipelineLayoutInfo:a_,InputState:o_,CommandBufferInfo:h_,QueueInfo:u_,QueryPoolInfo:l_,FormatInfo:c_,MemoryStatus:__,DynamicStencilStates:f_,DynamicStates:d_,GFXObject:p_,get AttributeName(){return cc},FormatInfos:m_,DESCRIPTOR_BUFFER_TYPE:g_,DESCRIPTOR_SAMPLER_TYPE:y_,DESCRIPTOR_DYNAMIC_TYPE:v_,DRAW_INFO_SIZE:28,IsPowerOf2:S_,FormatSize:A_,FormatSurfaceSize:T_,GetTypeSize:b_,getTypedArrayConstructor:x_,formatAlignment:C_,alignTo:R_}),I_=function(t){function e(){var e;return(e=t.call(this,Sl.BUFFER)||this)._usage=wl.NONE,e._memUsage=Dl.NONE,e._size=0,e._stride=1,e._count=0,e._flags=Il.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}(p_),B_=function(t){function e(){var e;return(e=t.call(this,Sl.COMMAND_BUFFER)||this)._queue=null,e._type=ac.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}(p_),D_=function(){function t(){this._gfxAPI=Tl.UNKNOWN,this._renderer="",this._vendor="",this._features=new Array(bl.COUNT),this._formatFeatures=new Array(xl.COUNT),this._queue=null,this._cmdBuff=null,this._numDrawCalls=0,this._numInstances=0,this._numTris=0,this._memoryStatus=new __,this._caps=new fc,this._bindingMappingInfo=new xc,this._samplers=new Map,this._generalBarrierss=new Map,this._textureBarriers=new Map,this._bufferBarriers=new Map}var e=t.prototype;return e.hasFeature=function(t){return this._features[t]},e.getFormatFeatures=function(t){return this._formatFeatures[t]},e.enableAutoBarrier=function(){},n(t,[{key:"gfxAPI",get:function(){return this._gfxAPI}},{key:"queue",get:function(){return this._queue}},{key:"commandBuffer",get:function(){return this._cmdBuff}},{key:"renderer",get:function(){return this._renderer}},{key:"vendor",get:function(){return this._vendor}},{key:"numDrawCalls",get:function(){return this._numDrawCalls}},{key:"numInstances",get:function(){return this._numInstances}},{key:"numTris",get:function(){return this._numTris}},{key:"memoryStatus",get:function(){return this._memoryStatus}},{key:"capabilities",get:function(){return this._caps}},{key:"bindingMappingInfo",get:function(){return this._bindingMappingInfo}}]),t}();D_.canvas=void 0;var P_=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 Oc(Pl.TEX2D,Ol.STORAGE|Ol.SAMPLED,xl.RGBA8,2,2,Ml.NONE));var i=new Tc(0,0,0,new pc(0,0,0),new gc(2,2,1));t.copyBuffersToTexture([e],this._texture2D,[i])}if(t.capabilities.maxTextureSize>=2){this._textureCube=t.createTexture(new Oc(Pl.CUBE,Ol.STORAGE|Ol.SAMPLED,xl.RGBA8,2,2,Ml.NONE,6));var n=new Tc(0,0,0,new pc(0,0,0),new gc(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 Oc(Pl.TEX3D,Ol.STORAGE|Ol.SAMPLED,xl.RGBA8,2,2,Ml.NONE,1,1,Ll.ONE,2));var r=new Tc(0,0,0,new pc(0,0,0),new gc(2,2,2),new yc(0,0,1));t.copyBuffersToTexture([e],this._texture3D,[r])}if(t.capabilities.maxArrayTextureLayers>=2){this._texture2DArray=t.createTexture(new Oc(Pl.TEX2D_ARRAY,Ol.STORAGE|Ol.SAMPLED,xl.RGBA8,2,2,Ml.NONE,2));var s=new Tc(0,0,0,new pc(0,0,0),new gc(2,2,1),new yc(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 Pl.TEX2D:return this._texture2D;case Pl.TEX3D:return this._texture3D;case Pl.CUBE:return this._textureCube;case Pl.TEX2D_ARRAY:return this._texture2DArray;default:return null}},t}(),O_=function(t){function e(){var e;return(e=t.call(this,Sl.SWAPCHAIN)||this)._transform=El.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}(p_),M_=function(t){function e(){var e;return(e=t.call(this,Sl.FRAMEBUFFER)||this)._renderPass=null,e._colorTextures=[],e._depthStencilTexture=null,e}return s(e,t),n(e,[{key:"renderPass",get:function(){return this._renderPass}},{key:"colorTextures",get:function(){return this._colorTextures}},{key:"depthStencilTexture",get:function(){return this._depthStencilTexture}}]),e}(p_),N_=function(t){function e(){var e;return(e=t.call(this,Sl.INPUT_ASSEMBLER)||this)._attributes=[],e._attributesHash=0,e._vertexBuffers=[],e._indexBuffer=null,e._indirectBuffer=null,e._drawInfo=new Bc,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 fl(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}(p_),L_=function(t){function e(){var e;return(e=t.call(this,Sl.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&g_){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&y_){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&y_){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}(p_),F_=function(t){function e(){var e;return(e=t.call(this,Sl.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}(p_),k_=function(t){function e(){var e;return(e=t.call(this,Sl.PIPELINE_LAYOUT)||this)._setLayouts=[],e}return s(e,t),n(e,[{key:"setLayouts",get:function(){return this._setLayouts}}]),e}(p_),G_=function(){function t(t,e,i,n,r,s,a,o,h,u,l,c){void 0===t&&(t=!1),void 0===e&&(e=Zl.FILL),void 0===i&&(i=$l.GOURAND),void 0===n&&(n=tc.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=Zl.FILL,this.shadeModel=$l.GOURAND,this.cullMode=tc.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}(),V_=function(){function t(t,e,i,n,r,s,a,o,h,u,l,c,_,f,d,p,m,g,y){void 0===t&&(t=!0),void 0===e&&(e=!0),void 0===i&&(i=Vl.LESS),void 0===n&&(n=!1),void 0===r&&(r=Vl.ALWAYS),void 0===s&&(s=65535),void 0===a&&(a=65535),void 0===o&&(o=Ul.KEEP),void 0===h&&(h=Ul.KEEP),void 0===u&&(u=Ul.KEEP),void 0===l&&(l=1),void 0===c&&(c=!1),void 0===_&&(_=Vl.ALWAYS),void 0===f&&(f=65535),void 0===d&&(d=65535),void 0===p&&(p=Ul.KEEP),void 0===m&&(m=Ul.KEEP),void 0===g&&(g=Ul.KEEP),void 0===y&&(y=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=f,this.stencilWriteMaskBack=d,this.stencilFailOpBack=p,this.stencilZFailOpBack=m,this.stencilPassOpBack=g,this.stencilRefBack=y}var e=t.prototype;return e.reset=function(){this.depthTest=!0,this.depthWrite=!0,this.depthFunc=Vl.LESS,this.stencilTestFront=!1,this.stencilFuncFront=Vl.ALWAYS,this.stencilReadMaskFront=65535,this.stencilWriteMaskFront=65535,this.stencilFailOpFront=Ul.KEEP,this.stencilZFailOpFront=Ul.KEEP,this.stencilPassOpFront=Ul.KEEP,this.stencilRefFront=1,this.stencilTestBack=!1,this.stencilFuncBack=Vl.ALWAYS,this.stencilReadMaskBack=65535,this.stencilWriteMaskBack=65535,this.stencilFailOpBack=Ul.KEEP,this.stencilZFailOpBack=Ul.KEEP,this.stencilPassOpBack=Ul.KEEP,this.stencilRefBack=1},e.assign=function(t){Object.assign(this,t)},e.destroy=function(){},n(t,[{key:"native",get:function(){return this}}]),t}(),U_=function(){function t(t,e,i,n,r,s,a,o){void 0===t&&(t=!1),void 0===e&&(e=zl.ONE),void 0===i&&(i=zl.ZERO),void 0===n&&(n=Hl.ADD),void 0===r&&(r=zl.ONE),void 0===s&&(s=zl.ZERO),void 0===a&&(a=Hl.ADD),void 0===o&&(o=Wl.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=zl.ONE,this.blendDst=zl.ZERO,this.blendEq=Hl.ADD,this.blendSrcAlpha=zl.ONE,this.blendDstAlpha=zl.ZERO,this.blendAlphaEq=Hl.ADD,this.blendColorMask=Wl.ALL},e.assign=function(t){Object.assign(this,t)},e.destroy=function(){},t}(),z_=function(){function t(t,e,i,n){void 0===t&&(t=!1),void 0===e&&(e=!1),void 0===i&&(i=new bc),void 0===n&&(n=[new U_]),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 U_),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}(),H_=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 o_),void 0===r&&(r=new G_),void 0===s&&(s=new V_),void 0===a&&(a=new z_),void 0===o&&(o=Ql.TRIANGLE_LIST),void 0===h&&(h=ec.NONE),void 0===u&&(u=Jl.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},W_=function(t){function e(){var e;return(e=t.call(this,Sl.PIPELINE_STATE)||this)._shader=null,e._pipelineLayout=null,e._primitive=Ql.TRIANGLE_LIST,e._is=null,e._rs=new G_,e._dss=new V_,e._bs=new z_,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}(p_),X_=function(t){function e(){var e;return(e=t.call(this,Sl.QUEUE)||this)._type=rc.GRAPHICS,e}return s(e,t),n(e,[{key:"type",get:function(){return this._type}}]),e}(p_),j_=function(t){function e(){var e;return(e=t.call(this,Sl.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 fl(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}(p_),Y_=function(t){function e(e,i){var n;return(n=t.call(this,Sl.SAMPLER)||this)._info=new Nc,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 Nc;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}(p_),q_=function(t){function e(){var e;return(e=t.call(this,Sl.SHADER)||this)._name="",e._stages=[],e._attributes=[],e._blocks=[],e._samplers=[],e}return s(e,t),n(e,[{key:"name",get:function(){return this._name}},{key:"attributes",get:function(){return this._attributes}},{key:"blocks",get:function(){return this._blocks}},{key:"samplers",get:function(){return this._samplers}}]),e}(p_),K_=function(t){function e(){var e;return(e=t.call(this,Sl.TEXTURE)||this)._info=new Oc,e._viewInfo=new Mc,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}(p_),J_=function(t){function e(e,i){var n;return(n=t.call(this,Sl.GLOBAL_BARRIER)||this)._info=new $c,n._hash=0,n._info.copy(e),n._hash=i,n}return s(e,t),e.computeHash=function(t){return fl(t.prevAccesses+" "+t.nextAccesses+" "+t.type,666)},n(e,[{key:"info",get:function(){return this._info}},{key:"hash",get:function(){return this._hash}}]),e}(p_),Q_=function(t){function e(e,i){var n;return(n=t.call(this,Sl.TEXTURE_BARRIER)||this)._info=new t_,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,fl(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}(p_),Z_=function(t){function e(e,i){var n;return(n=t.call(this,Sl.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,fl(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}(p_),$_={Device:D_,Swapchain:O_,Buffer:I_,Texture:K_,Sampler:Y_,Shader:q_,InputAssembler:N_,RenderPass:j_,Framebuffer:M_,DescriptorSet:L_,DescriptorSetLayout:F_,PipelineLayout:k_,PipelineState:W_,CommandBuffer:B_,Queue:X_,GeneralBarrier:J_,TextureBarrier:Q_,BufferBarrier:Z_,RasterizerState:G_,BlendState:z_,BlendTarget:U_,DepthStencilState:V_,PipelineStateInfo:H_};Object.assign($_,w_),v.gfx=$_;var tf,ef,nf={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 rf in nf){var sf=nf[rf];!0===sf?sf=rf.slice(3):!1===sf&&(sf=rf),nt(v,"cc",[{name:rf,newName:sf,target:v.gfx,targetName:"cc.gfx"}])}rt(v,"cc",[{name:"GFX_MAX_VERTEX_ATTRIBUTES"},{name:"GFX_MAX_TEXTURE_UNITS"},{name:"GFX_MAX_ATTACHMENTS"},{name:"GFX_MAX_BUFFER_BINDINGS"},{name:"GFXTextureLayout"}]),rt(bl,"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;"}]),rt(qc.prototype,"ColorAttachment",[{name:"beginAccesses",suggest:"Please assign to ColorAttachment.barrier instead"},{name:"endAccesses",suggest:"Please assign to ColorAttachment.barrier instead"}]),rt(Kc.prototype,"DepthStencilAttachment",[{name:"beginAccesses",suggest:"Please assign to DepthStencilAttachment.barrier instead"},{name:"endAccesses",suggest:"Please assign to DepthStencilAttachment.barrier instead"}]),nt(D_.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"}(tf||(tf={})),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"}(ef||(ef={}));var af=function(){function t(){this.initialized=!1,this._gfxDevice=void 0,this._canvas=null,this._swapchain=void 0,this._renderType=ef.UNKNOWN}var e=t.prototype;return e.init=function(t,e){if(!this.initialized){var i=Ee.querySettings(Te.Category.RENDERING,"renderMode");if(this._canvas=t,this._renderType=this._determineRenderType(i),this._renderType===ef.WEBGL){var n=new Rc(e),r=!!globalThis.WebGL2RenderingContext;globalThis.navigator.userAgent.toLowerCase(),ul.browserType===Pu.UC&&(r=!1);var s=[];r&&v.WebGL2Device&&s.push(v.WebGL2Device),v.WebGLDevice&&s.push(v.WebGLDevice),v.EmptyDevice&&s.push(v.EmptyDevice),D_.canvas=t;for(var a=0;a<s.length&&(this._gfxDevice=new s[a],!this._gfxDevice.initialize(n));a++);this._initSwapchain()}else this._renderType===ef.HEADLESS&&v.EmptyDevice&&(this._gfxDevice=new v.EmptyDevice,this._gfxDevice.initialize(new Rc(e)),this._initSwapchain());if(!this._gfxDevice)return G("can not support canvas rendering in 3D"),void(this._renderType=ef.UNKNOWN);this._canvas&&(this._canvas.oncontextmenu=function(){return!1})}},e._initSwapchain=function(){var t=new Cc(1,this._canvas),e=hl.windowSize;t.width=e.width,t.height=e.height,this._swapchain=this._gfxDevice.createSwapchain(t)},e._determineRenderType=function(t){("number"!=typeof t||t>ef.HEADLESS||t<tf.AUTO)&&(t=tf.AUTO);var e=ef.CANVAS,i=!1;if(t===tf.CANVAS?(e=ef.CANVAS,i=!0):t===tf.AUTO||t===tf.WEBGL?(e=ef.WEBGL,i=!0):t===tf.HEADLESS&&(e=ef.HEADLESS,i=!0),!i)throw new Error(tt(3820,t));return e},n(t,[{key:"gfxDevice",get:function(){return this._gfxDevice}},{key:"swapchain",get:function(){return this._swapchain}}]),t}(),of=new af;t("ai",Object.freeze({__proto__:null,DescriptorSet:L_,Buffer:I_,CommandBuffer:B_,get ObjectType(){return Sl},get Status(){return Al},get API(){return Tl},get SurfaceTransform(){return El},get Feature(){return bl},get Format(){return xl},get FormatType(){return Cl},get Type(){return Rl},get BufferUsageBit(){return wl},get BufferFlagBit(){return Il},get MemoryAccessBit(){return Bl},get MemoryUsageBit(){return Dl},get TextureType(){return Pl},get TextureUsageBit(){return Ol},get TextureFlagBit(){return Ml},get FormatFeatureBit(){return Nl},get SampleCount(){return Ll},get VsyncMode(){return Fl},get Filter(){return kl},get Address(){return Gl},get ComparisonFunc(){return Vl},get StencilOp(){return Ul},get BlendFactor(){return zl},get BlendOp(){return Hl},get ColorMask(){return Wl},get ShaderStageFlagBit(){return Xl},get LoadOp(){return jl},get StoreOp(){return Yl},get AccessFlagBit(){return ql},get ResolveMode(){return Kl},get PipelineBindPoint(){return Jl},get PrimitiveMode(){return Ql},get PolygonMode(){return Zl},get ShadeModel(){return $l},get CullMode(){return tc},get DynamicStateFlagBit(){return ec},get StencilFace(){return ic},get DescriptorType(){return nc},get QueueType(){return rc},get QueryType(){return sc},get CommandBufferType(){return ac},get ClearFlagBit(){return oc},get BarrierType(){return hc},get PassType(){return uc},Size:_c,DeviceCaps:fc,DeviceOptions:dc,Offset:pc,Rect:mc,Extent:gc,TextureSubresLayers:yc,TextureSubresRange:vc,TextureCopy:Sc,TextureBlit:Ac,BufferTextureCopy:Tc,Viewport:Ec,Color:bc,BindingMappingInfo:xc,SwapchainInfo:Cc,DeviceInfo:Rc,BufferInfo:wc,BufferViewInfo:Ic,DrawInfo:Bc,DispatchInfo:Dc,IndirectBuffer:Pc,TextureInfo:Oc,TextureViewInfo:Mc,SamplerInfo:Nc,Uniform:Lc,UniformBlock:Fc,UniformSamplerTexture:kc,UniformSampler:Gc,UniformTexture:Vc,UniformStorageImage:Uc,UniformStorageBuffer:zc,UniformInputAttachment:Hc,ShaderStage:Wc,Attribute:Xc,ShaderInfo:jc,InputAssemblerInfo:Yc,ColorAttachment:qc,DepthStencilAttachment:Kc,SubpassInfo:Jc,SubpassDependency:Qc,RenderPassInfo:Zc,GeneralBarrierInfo:$c,TextureBarrierInfo:t_,BufferBarrierInfo:e_,FramebufferInfo:i_,DescriptorSetLayoutBinding:n_,DescriptorSetLayoutInfo:r_,DescriptorSetInfo:s_,PipelineLayoutInfo:a_,InputState:o_,CommandBufferInfo:h_,QueueInfo:u_,QueryPoolInfo:l_,FormatInfo:c_,MemoryStatus:__,DynamicStencilStates:f_,DynamicStates:d_,GFXObject:p_,get AttributeName(){return cc},FormatInfos:m_,DESCRIPTOR_BUFFER_TYPE:g_,DESCRIPTOR_SAMPLER_TYPE:y_,DESCRIPTOR_DYNAMIC_TYPE:v_,DRAW_INFO_SIZE:28,IsPowerOf2:S_,FormatSize:A_,FormatSurfaceSize:T_,GetTypeSize:b_,getTypedArrayConstructor:x_,formatAlignment:C_,alignTo:R_,Device:D_,DefaultResource:P_,Swapchain:O_,Framebuffer:M_,InputAssembler:N_,DescriptorSetLayout:F_,PipelineLayout:k_,BlendState:z_,BlendTarget:U_,RasterizerState:G_,DepthStencilState:V_,PipelineStateInfo:H_,PipelineState:W_,Queue:X_,RenderPass:j_,Sampler:Y_,Shader:q_,Texture:K_,GeneralBarrier:J_,TextureBarrier:Q_,get LegacyRenderMode(){return tf},get RenderType(){return ef},DeviceManager:af,deviceManager:of}));var hf=new fn;function uf(t,e,i,n){var r=i.chunk,s=i.data,a=r.vb,o=i.vertexCount;t.getWorldMatrix(hf);for(var h=0,u=0;u<o;u++){var l=s[u],c=l.x,_=l.y,f=hf.m03*c+hf.m07*_+hf.m15;f=f?1/f:1,a[h+0]=(hf.m00*c+hf.m04*_+hf.m12)*f,a[h+1]=(hf.m01*c+hf.m05*_+hf.m13)*f,a[h+2]=(hf.m02*c+hf.m06*_+hf.m14)*f,Zi.toArray(a,n,h+5),h+=9}r.bufferId;for(var d=r.vertexOffset,p=r.meshBuffer,m=r.meshBuffer.iData,g=p.indexOffset,y=0,v=o/4;y<v;y++){var S=d+4*y;m[g++]=S,m[g++]=S+1,m[g++]=S+2,m[g++]=S+1,m[g++]=S+3,m[g++]=S+2}p.indexOffset+=i.indexCount,p.setDirty()}var lf={},cf=function(){function t(t){this._map=null,this._count=0,t?(this._map=t,this._count=Object.keys(t).length):(this._map=wt(!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=wt(!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}(),_f=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}();_f._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=wt(!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 ff,df=new cf,pf=new cf,mf=new cf,gf=new cf,yf=new _f("normal load",[]),vf=new _f("fetch",[]),Sf=new _f("transform url",[]),Af=new Map;!function(t){t.UUID="uuid",t.PATH="path",t.DIR="dir",t.URL="url",t.SCENE="scene"}(ff||(ff={}));var Tf,Ef={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"}(Tf||(Tf={}));var bf=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}();bf.MAX_DEAD_NUM=500,bf._taskId=0,bf._deadPool=[];var xf="0123456789abcdef".split(""),Cf=["","","",""],Rf=Cf.concat(Cf,"-",Cf,"-",Cf,"-",Cf,"-",Cf,Cf,Cf),wf=Rf.map((function(t,e){return"-"===t?NaN:e})).filter(Number.isFinite);function If(t){var e=t.split("@")[0];if(22!==e.length)return t;Rf[0]=t[0],Rf[1]=t[1];for(var i=2,n=2;i<22;i+=2){var r=Ie[t.charCodeAt(i)],s=Ie[t.charCodeAt(i+1)];Rf[wf[n++]]=xf[r>>2],Rf[wf[n++]]=xf[(3&r)<<2|s>>4],Rf[wf[n++]]=xf[15&s]}return t.replace(e,Rf.join(""))}var Bf=/.*[/\\][0-9a-fA-F]{2}[/\\]([0-9a-fA-F-@]{8,}).*/;function Df(t){var e=Bf.exec(t);return e?e[1]:""}function Pf(t,e){(e=e||Object.create(null)).__isNative__=e.isNative,e.nativeExt&&(e.ext=e.nativeExt);var i=gf.find((function(e){return!!e.getAssetInfo(t)}));return i&&(e.bundle=i.name),Nf(t,e)}function Of(t){return!!t&&(t instanceof v.SceneAsset||t instanceof v.Scene)}function Mf(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 Nf(t,e){var i=bf.create({input:t,options:e}),n=[];try{for(var r,s=f(Sf.sync(i));!(r=s()).done;){var a=r.value,o=a.url;a.recycle(),n.push(o)}}catch(t){for(var h,u=f(i.output);!(h=u()).done;)h.value.recycle();G(t.message,t.stack)}return i.recycle(),n.length>1?n:n[0]}var Lf,Ff,kf,Gf=Object.freeze({__proto__:null,getUuidFromURL:Df,getUrlWithUuid:Pf,isScene:Of,normalize:Mf,transform:Nf,decodeUuid:If}),Vf=ks,Uf=Os,zf=t("dK",Is("cc.Asset")((Ff=function(t){function e(){for(var e,i=arguments.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=kf&&kf(),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 U(tt(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=Pf(this._uuid,{nativeExt:t,isNative:!0}):this._nativeUrl=Pf(this._uuid,{__nativeName__:t,nativeExt:Wu(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}(Bu(ba)),kf=Ss(Ff.prototype,"_native",[Vf],(function(){return""})),p(Ff.prototype,"_nativeAsset",[Uf],Object.getOwnPropertyDescriptor(Ff.prototype,"_nativeAsset"),Ff.prototype),Lf=Ff))||Lf);zf.prototype.createNode=null,v.Asset=zf;var Hf,Wf,Xf,jf,Yf,qf;!function(t){t[t.RGB565=xl.R5G6B5]="RGB565",t[t.RGB5A1=xl.RGB5A1]="RGB5A1",t[t.RGBA4444=xl.RGBA4]="RGBA4444",t[t.RGB888=xl.RGB8]="RGB888",t[t.RGB32F=xl.RGB32F]="RGB32F",t[t.RGBA8888=xl.RGBA8]="RGBA8888",t[t.RGBA32F=xl.RGBA32F]="RGBA32F",t[t.A8=xl.A8]="A8",t[t.I8=xl.L8]="I8",t[t.AI8=xl.LA8]="AI8",t[t.RGB_PVRTC_2BPPV1=xl.PVRTC_RGB2]="RGB_PVRTC_2BPPV1",t[t.RGBA_PVRTC_2BPPV1=xl.PVRTC_RGBA2]="RGBA_PVRTC_2BPPV1",t[t.RGB_A_PVRTC_2BPPV1=1024]="RGB_A_PVRTC_2BPPV1",t[t.RGB_PVRTC_4BPPV1=xl.PVRTC_RGB4]="RGB_PVRTC_4BPPV1",t[t.RGBA_PVRTC_4BPPV1=xl.PVRTC_RGBA4]="RGBA_PVRTC_4BPPV1",t[t.RGB_A_PVRTC_4BPPV1=1025]="RGB_A_PVRTC_4BPPV1",t[t.RGB_ETC1=xl.ETC_RGB8]="RGB_ETC1",t[t.RGBA_ETC1=1026]="RGBA_ETC1",t[t.RGB_ETC2=xl.ETC2_RGB8]="RGB_ETC2",t[t.RGBA_ETC2=xl.ETC2_RGBA8]="RGBA_ETC2",t[t.RGBA_ASTC_4x4=xl.ASTC_RGBA_4X4]="RGBA_ASTC_4x4",t[t.RGBA_ASTC_5x4=xl.ASTC_RGBA_5X4]="RGBA_ASTC_5x4",t[t.RGBA_ASTC_5x5=xl.ASTC_RGBA_5X5]="RGBA_ASTC_5x5",t[t.RGBA_ASTC_6x5=xl.ASTC_RGBA_6X5]="RGBA_ASTC_6x5",t[t.RGBA_ASTC_6x6=xl.ASTC_RGBA_6X6]="RGBA_ASTC_6x6",t[t.RGBA_ASTC_8x5=xl.ASTC_RGBA_8X5]="RGBA_ASTC_8x5",t[t.RGBA_ASTC_8x6=xl.ASTC_RGBA_8X6]="RGBA_ASTC_8x6",t[t.RGBA_ASTC_8x8=xl.ASTC_RGBA_8X8]="RGBA_ASTC_8x8",t[t.RGBA_ASTC_10x5=xl.ASTC_RGBA_10X5]="RGBA_ASTC_10x5",t[t.RGBA_ASTC_10x6=xl.ASTC_RGBA_10X6]="RGBA_ASTC_10x6",t[t.RGBA_ASTC_10x8=xl.ASTC_RGBA_10X8]="RGBA_ASTC_10x8",t[t.RGBA_ASTC_10x10=xl.ASTC_RGBA_10X10]="RGBA_ASTC_10x10",t[t.RGBA_ASTC_12x10=xl.ASTC_RGBA_12X10]="RGBA_ASTC_12x10",t[t.RGBA_ASTC_12x12=xl.ASTC_RGBA_12X12]="RGBA_ASTC_12x12"}(Hf||(Hf={})),function(t){t[t.REPEAT=Gl.WRAP]="REPEAT",t[t.CLAMP_TO_EDGE=Gl.CLAMP]="CLAMP_TO_EDGE",t[t.MIRRORED_REPEAT=Gl.MIRROR]="MIRRORED_REPEAT",t[t.CLAMP_TO_BORDER=Gl.BORDER]="CLAMP_TO_BORDER"}(Wf||(Wf={})),function(t){t[t.NONE=kl.NONE]="NONE",t[t.LINEAR=kl.LINEAR]="LINEAR",t[t.NEAREST=kl.POINT]="NEAREST"}(Xf||(Xf={}));var Kf=1346981187,Jf=me({PVR:0,PKM:1,ASTC:2});function Qf(t,e){return t[e]<<8|t[e+1]}function Zf(t){return!!(ul.hasFeature(ul.Feature.IMAGE_BITMAP)&&t instanceof ImageBitmap)}var $f,td,ed,id,nd,rd,sd,ad,od,hd,ud,ld=t("dQ",Is("cc.ImageAsset")(((qf=function(t){s(i,t),i.mergeCompressedTextureMips=function(t){var e=new Uint8Array(0),i=null;try{for(var n,r=8+4*t.length,s=0,a=f(t);!(n=a()).done;)s+=n.value.byteLength;s+=r,e=new Uint8Array(s);var o=new DataView(e.buffer,e.byteOffset,e.byteLength);o.setUint32(0,Kf,!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)===Kf){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 Jf.PVR:i.parsePVRTexture(t,e,n,r,a);break;case Jf.PKM:i.parsePKMTexture(t,e,n,r,a);break;case Jf.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 f=new Uint8Array(s,c,_),d=new Uint8Array(r._data.byteLength+f.byteLength);d.set(r._data),d.set(f,r._data.byteLength),r._data=d,r.mipmapLevelDataSize[e]=_}else r._data=new Uint8Array(s,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=Qf(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:Qf(a,12),r.height=e>0?r.height:Qf(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?Hf.RGBA_ASTC_4x4:5===t?4===e?Hf.RGBA_ASTC_5x4:Hf.RGBA_ASTC_5x5:6===t?5===e?Hf.RGBA_ASTC_6x5:Hf.RGBA_ASTC_6x6:8===t?5===e?Hf.RGBA_ASTC_8x5:6===e?Hf.RGBA_ASTC_8x6:Hf.RGBA_ASTC_8x8:10===t?5===e?Hf.RGBA_ASTC_10x5:6===e?Hf.RGBA_ASTC_10x6:8===e?Hf.RGBA_ASTC_10x8:Hf.RGBA_ASTC_10x10:10===e?Hf.RGBA_ASTC_12x10:Hf.RGBA_ASTC_12x12}(o,h),c=i+16,_=n-16;if(n>0){var f=new Uint8Array(s,c,_),d=new Uint8Array(r._data.byteLength+f.byteLength);d.set(r._data),d.set(f,r._data.byteLength),r._data=d,r.mipmapLevelDataSize[e]=_}else r._data=new Uint8Array(s,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=Hf.RGBA8888,i._width=0,i._height=0,i._nativeData={_data:null,width:0,height:0,format:0,_compressed:!1,mipmapLevelDataSize:[]},void 0!==e&&i.reset(e),i}return e.extractMipmap0=function(){if(this.mipmapLevelDataSize&&this.mipmapLevelDataSize.length>0){var t=this.mipmapLevelDataSize[0],e=this.data,n=new i({_data:new Uint8Array(e.buffer,0,t),_compressed:!0,width:this.width,height:this.height,format:this.format,mipmapLevelDataSize:[]});return n._uuid=""+this._uuid,n}return this},e.extractMipmaps=function(){var t=[];if(this.mipmapLevelDataSize&&this.mipmapLevelDataSize.length>0)for(var e,n=this.mipmapLevelDataSize,r=this.data,s=0,a=this.height,o=this.width,h=f(n);!(e=h()).done;){var u=e.value,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){Zf(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(Zf(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=of.gfxDevice,s=e.split("_"),a=Number.MAX_VALUE,o=this._format,h="",u=be.SUPPORT_TEXTURE_FORMATS,l=f(s);!(n=l()).done;){var c=n.value.split("@"),_=parseInt(c[0],void 0),d=i.extnames[_]||c[0],p=u.indexOf(d);if(-1!==p&&p<a){var m=c[1]?parseInt(c[1]):this._format;if(!(".astc"!==d||r&&r.getFormatFeatures(xl.ASTC_RGBA_4X4)&Nl.SAMPLED_TEXTURE))continue;if(!(".pvr"!==d||r&&r.getFormatFeatures(xl.PVRTC_RGBA4)&Nl.SAMPLED_TEXTURE))continue;if(!(m!==Hf.RGB_ETC1&&m!==Hf.RGBA_ETC1||r&&r.getFormatFeatures(xl.ETC_RGB8)&Nl.SAMPLED_TEXTURE))continue;if(!(m!==Hf.RGB_ETC2&&m!==Hf.RGBA_ETC2||r&&r.getFormatFeatures(xl.ETC2_RGB8)&Nl.SAMPLED_TEXTURE))continue;if(".webp"===d&&!ul.hasFeature(ul.Feature.WEBP))continue;a=p,h=d,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=A.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||Zf(t)||(t.format=t.format||this._format),this.reset(t)}},{key:"data",get:function(){return(t=this._nativeData)instanceof HTMLImageElement||t instanceof HTMLCanvasElement||Zf(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>=Hf.RGB_ETC1&&this._format<=Hf.RGBA_ASTC_12x12||this._format>=Hf.RGB_A_PVRTC_2BPPV1&&this._format<=Hf.RGBA_ETC1}},{key:"mipmapLevelDataSize",get:function(){return this._nativeData.mipmapLevelDataSize}},{key:"url",get:function(){return this.nativeUrl}}]),i}(zf)).extnames=[".png",".jpg",".jpeg",".bmp",".webp",".pvr",".pkm",".astc"],qf._sharedPlaceHolderCanvas=null,p((Yf=qf).prototype,"_nativeAsset",[ua],Object.getOwnPropertyDescriptor(Yf.prototype,"_nativeAsset"),Yf.prototype),jf=Yf))||jf);v.ImageAsset=ld,ve(xl);var cd,_d,fd,dd=new mt("Tex"),pd=Is("cc.TextureBase")(((ud=function(t){function e(){var e;return(e=t.call(this)||this)._format=ed&&ed(),e._minFilter=id&&id(),e._magFilter=nd&&nd(),e._mipFilter=rd&&rd(),e._wrapS=sd&&sd(),e._wrapT=ad&&ad(),e._wrapR=od&&od(),e._anisotropy=hd&&hd(),e._width=1,e._height=1,e._id=void 0,e._samplerInfo=new Nc,e._gfxSampler=null,e._gfxDevice=null,e._textureHash=0,e._id=dd.getNewId(),e._gfxDevice=e._getGFXDevice(),e._textureHash=fl(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):J(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 of.gfxDevice},i._getGFXFormat=function(){return this._getGFXPixelFormat(this._format)},i._setGFXFormat=function(t){this._format=void 0===t?Hf.RGBA8888:t},i._getGFXPixelFormat=function(t){return t===Hf.RGBA_ETC1?t=Hf.RGB_ETC1:t===Hf.RGB_A_PVRTC_4BPPV1?t=Hf.RGB_PVRTC_4BPPV1:t===Hf.RGB_A_PVRTC_2BPPV1&&(t=Hf.RGB_PVRTC_2BPPV1),t},n(e,[{key:"isCompressed",get:function(){return this._format>=Hf.RGB_ETC1&&this._format<=Hf.RGBA_ASTC_12x12||this._format>=Hf.RGB_A_PVRTC_2BPPV1&&this._format<=Hf.RGBA_ETC1}},{key:"width",get:function(){return this._width}},{key:"height",get:function(){return this._height}}]),e}(zf)).PixelFormat=Hf,ud.WrapMode=Wf,ud.Filter=Xf,ed=Ss((td=ud).prototype,"_format",[ks],(function(){return Hf.RGBA8888})),id=Ss(td.prototype,"_minFilter",[ks],(function(){return Xf.LINEAR})),nd=Ss(td.prototype,"_magFilter",[ks],(function(){return Xf.LINEAR})),rd=Ss(td.prototype,"_mipFilter",[ks],(function(){return Xf.NONE})),sd=Ss(td.prototype,"_wrapS",[ks],(function(){return Wf.REPEAT})),ad=Ss(td.prototype,"_wrapT",[ks],(function(){return Wf.REPEAT})),od=Ss(td.prototype,"_wrapR",[ks],(function(){return Wf.REPEAT})),hd=Ss(td.prototype,"_anisotropy",[ks],(function(){return 0})),$f=td))||$f;v.TextureBase=pd;var md=t("dW",Is("cc.Script")(cd=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(zf))||cd);v._Script=md;var gd=t("dX",Is("cc.JavaScript")(_d=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(md))||_d);v._JavaScript=gd;var yd,vd,Sd,Ad,Td,Ed,bd,xd=t("dY",Is("cc.TypeScript")(fd=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(md))||fd);v._TypeScript=xd;var Cd,Rd,wd,Id,Bd,Dd,Pd,Od,Md,Nd,Ld,Fd=t("dd",Is("cc.ClickEvent")((vd=function(){function t(){this.target=Sd&&Sd(),this.component=Ad&&Ad(),this._componentId=Td&&Td(),this.handler=Ed&&Ed(),this.customEventData=bd&&bd()}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}(),Sd=Ss(vd.prototype,"target",[ks],(function(){return null})),Ad=Ss(vd.prototype,"component",[ks],(function(){return""})),Td=Ss(vd.prototype,"_componentId",[ks],(function(){return""})),Ed=Ss(vd.prototype,"handler",[ks],(function(){return""})),bd=Ss(vd.prototype,"customEventData",[ks],(function(){return""})),yd=vd))||yd),kd=new mt("Comp"),Gd=ba.Flags.IsOnLoadCalled,Vd=t("de",(Cd=Is("cc.Component"),Rd=ha(md),Cd(((Od=function(t){function e(){for(var e,i=arguments.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=Bd&&Bd(),e._enabled=Dd&&Dd(),e.__prefab=Pd&&Pd(),e._sceneGetter=null,e._id=kd.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),$(t,1619),$((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=It(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&Gd}}]),e}(ba)).EventHandler=Fd,Od.system=null,p((Id=Od).prototype,"__scriptAsset",[Rd],Object.getOwnPropertyDescriptor(Id.prototype,"__scriptAsset"),Id.prototype),Bd=Ss(Id.prototype,"node",[ks],(function(){return null})),Dd=Ss(Id.prototype,"_enabled",[ks],(function(){return!0})),Pd=Ss(Id.prototype,"__prefab",[ks],(function(){return null})),wd=Id))||wd)),Ud=Vd.prototype;Ud.update=void 0,Ud.lateUpdate=void 0,Ud.__preload=void 0,Ud.onLoad=void 0,Ud.start=void 0,Ud.onEnable=void 0,Ud.onDisable=void 0,Ud.onDestroy=void 0,Ud.onFocusInEditor=void 0,Ud.onLostFocusInEditor=void 0,Ud.resetInEditor=void 0,Ud._getLocalBounds=void 0,Ud.onRestore=void 0,Vd._requireComponent=null,Vd._executionOrder=0,bt(Vd,"_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=Vd;var zd=t("dB",Is("cc.MissingScript")((Nd=function(t){function e(){var e;return(e=t.call(this)||this)._$erialized=Ld&&Ld(),e}return s(e,t),e.safeFindClass=function(t){var e=$t(t);if(e)return e;v.deserialize.reportMissingClass(t)},e.prototype.onLoad=function(){q(4600,this.node.name)},e}(Vd),Ld=Ss(Nd.prototype,"_$erialized",[ks,Vs],(function(){return null})),Md=Nd))||Md);v._MissingScript=zd;try{var Hd=zd.__values__;0!==Hd.length&&"_$erialized"===Hd[Hd.length-1]||(G("The '_$erialized' prop in MissingScript is missing. Please contact jare."),G(" Error props: ['"+Hd+"']"))}catch(Nn){G("Error when checking MissingScript 5, "+Nn)}var Wd=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 Xd(t){var e=t;return{chunks:e.chunks,document:e.document}}function jd(t){if(t.length<16)throw new Yd(tt(13102));var e=new DataView(t.buffer,t.byteOffset,t.byteLength);if(1313817411!==e.getUint32(0,!0))throw new Yd(tt(13100));var i=e.getUint32(4,!0);if(1!==i)throw new Yd(tt(13101,i));if(e.getUint32(8,!0)!==e.byteLength)throw new Yd(tt(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(tt(13104))}(s);try{a=JSON.parse(o)}catch(t){throw new Yd(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 Yd(tt(13102));return new Wd(a,h)}var Yd=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(l(Error));function qd(t,e,i,n,r){if(e instanceof v.ValueType){r||t.push("if(prop){");var s=It(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=Xd,v.internal.decodeCCONBinary=jd,v.internal.CCON=Wd;var Kd=fi.Attr.DELIMETER,Jd=Kd+"type",Qd=Kd+"default",Zd=Kd+"formerlySerializedAs",$d=function(t){function e(){return t.call(this,(function(t){t.clear()}),1)||this}return s(e,t),e}(ne);$d.prototype.get=function(t,e,i,n,r){var s=this._get();return s?(s.reset(t,e,i,n,r),s):new tp(t,e,i,n,r)};var tp=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 Wd?(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===$t&&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[Pa]?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=Ut(i);r&&n._deserializeInto(t,e,r)}};e[Pa](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=fi.Attr.getClassAttrs(e),n=e.__values__,r=["var prop;"],s=xe.test(ie(e)),a=0;a<n.length;a++){var o=n[a],h=void 0,u=void 0;fi.IDENTIFIER_RE.test(o)?(u='"'+o+'"',h="."+o):h="["+(u=fi.escapeForJS(o))+"]";var l=h;if(i[o+Zd]){var c=i[o+Zd];l=fi.IDENTIFIER_RE.test(c)?"."+c:"["+fi.escapeForJS(c)+"]"}r.push("prop=d"+l+";"),r.push('if(typeof prop!=="undefined"){');var _=fi.getDefault(i[o+Qd]),f=i[o+Jd];if(s&&(void 0!==_||f)){var d=void 0;if(void 0===_)d=f instanceof fi.Attr.PrimitiveType||f===hi||f===ui;else{var p=typeof _;d="string"===p||"number"===p||"boolean"===p}d?r.push("o"+h+"=prop;"):qd(r,_,h,u,!0)}else r.push('if(typeof prop!=="object"){o'+h+"=prop;}else{"),qd(r,_,h,u,!1),r.push("}");r.push("}")}return(zt(e,v.Node)||zt(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===zd){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)}bt(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=fi.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=fi.getDefault(n[a+Qd])),"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}();tp.pool=new $d;var ep=[yn,Yi,zi,sn,Zi,An,En,fn];function ip(t,e){t.x=e[1],t.y=e[2],t.z=e[3],t.w=e[4]}var np=[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]},ip,ip,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){fn.fromArray(t,e,1)}],rp=t("dI",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 sp(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,cp[l])(t,r,u,e[h])}return r}function ap(t,e,i){var n=new e;return n._deserialize?n._deserialize(i,t[0]):J(5303,It(e)),n}function op(t,e,i,n){n>=0?e[i]=t[5][n]:t[7][3*~n]=e}function hp(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 up(t,e,i,n){e[i]=null,t[8][n]=e}function lp(t,e,i,n){e[i]=sp(t,n)}rp.pool=new ne((function(t){t.reset()}),5),rp.pool.get=function(){return this._get()||new rp};var cp=new Array(13);function _p(t,e,i){return t||i(e),Object}function fp(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)||_p(s,n,a);return e[i]=r,new r}}(i,n,e));o=_p(s,e,a)}i[n]=o}function dp(t,e,i,n){for(var r=i||$t,s=t[3],a=0;a<s.length;++a){var o=s[a];"string"!=typeof o?fp(r,o[0],o,0,e,i,n):fp(r,o,s,a,e,i,n)}}function pp(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 mp(t,e,i){"string"==typeof t&&(t=JSON.parse(t));var n,r=!e;if(e=e||rp.pool.get(),function(t){if(Array.isArray(t)){var e=t[0];return"number"==typeof e||e instanceof gp}return!1}(t)){e.init(t),i=i||{};var s,a=t[0],o=!1;if("object"==typeof a&&(o=a.preprocessed,a=a.version),a<1)throw new Error(tt(5304,a));i._version=a,i.result=e,t[0]=i,o||(dp(t,!1,i.classFinder,null!==(s=i.reportMissingClass)&&void 0!==s?s:mp.reportMissingClass),pp(t)),v.game._isCloning=!0;var h=t[5],u=function(t){var e=t[5],i=t[6],n=0===i?0:i.length,r=e[e.length-1],s=e.length-n;"number"!=typeof r?r=0:(r<0&&(r=~r),--s);for(var a=0;a<s;++a)e[a]=sp(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]=ap(t,c,l)}else(0,cp[u=~u])(t,e,a,l)}return r}(t);v.game._isCloning=!1,t[7]&&function(t,e,i){for(var n=t.length-1,r=0,s=3*t[n];r<s;r+=3){var a=t[r],o=e[t[r+2]],h=t[r+1];h>=0?a[i[h]]=o:a[~h]=o}for(;r<n;r+=3){var u=e[t[r]],l=e[t[r+2]],c=t[r+1];c>=0?u[i[c]]=l:u[~c]=l}}(t[7],h,t[2]),function(t){for(var e=t[5],i=t[2],n=t[1],r=t[8],s=t[9],a=t[10],o=0;o<r.length;++o){var h=r[o];"number"==typeof h&&(r[o]=e[h]);var u=s[o];"number"==typeof u&&(u=u>=0?i[u]:~u,s[o]=u);var l=a[o];"number"==typeof l&&(a[o]=n[l])}}(t),n=h[u]}else n=function(t,e,i){var n,r=(i=i||{}).classFinder||$t,s=i.createAssetRefs||ul.platform===Lu.EDITOR_CORE,a=i.customEnv,o=i.ignoreEditorOnly,h=null!==(n=i.reportMissingClass)&&void 0!==n?n:v.deserialize.reportMissingClass;e.init();var u=tp.pool.get(e,r,h,a,o);v.game._isCloning=!0;var l=u.deserialize(t);return v.game._isCloning=!1,tp.pool.put(u),s&&e.assignAssetsBy((function(t,e){return EditorExtends.serialize.asAsset(t,e.type)})),l}(t,e,i);return r&&rp.pool.put(e),n}cp[0]=function(t,e,i,n){e[i]=n},cp[1]=op,cp[2]=hp(op),cp[3]=hp(up),cp[4]=lp,cp[5]=function(t,e,i,n){np[n[0]](e[i],n)},cp[6]=up,cp[7]=function(t,e,i,n){e[i].set(n)},cp[8]=function(t,e,i,n){var r=new ep[n[0]];np[n[0]](r,n),e[i]=r},cp[9]=hp(lp),cp[10]=function(t,e,i,n){var r=t[3][n[0]];e[i]=ap(t,r,n[1])},cp[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,cp[o])(t,r,a,h)}},cp[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,cp[o])(t,r,s,a)}e[i]=r},mp.Details=rp,mp.reportMissingClass=function(t){J(5302,t)};var gp=function(t){this.preprocessed=!0,this.version=t};function yp(t,e,i){return[1,0,0,[t],0,i?[e,-1]:[e],[0],0,[],[],[]]}v.deserialize=mp;var vp=new WeakMap,Sp=new WeakSet,Ap=new WeakSet;function Tp(t,e){var i;i=zd.safeFindClass;var n,r=rp.pool.get();try{n=mp(t,r,{classFinder:i,customEnv:e})}catch(t){throw G(t),rp.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:If(c),owner:a[l],prop:o[l],type:$t(h[l])}}return vp.set(n,u),n._native&&Sp.add(n),rp.pool.put(r),n}var Ep=function(){function t(){this._depends=new cf}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 Wd){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=Tp(e,{__uuid__:t});(r=this._parseDepsFromAsset(s)).nativeDep&&(r.nativeDep.uuid=t),mf.add(t+"@import",s)}catch(e){pf.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=vp.get(t),n=0,r=i.length;n<r;n++)e.deps.push(i[n].uuid);return Sp.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]=If(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}();Ep._instance=void 0;var bp,xp=Ep.instance,Cp=[new Tc];function Rp(t){return t&&0==(t&t-1)}var wp,Ip,Bp,Dp,Pp,Op=Is("cc.SimpleTexture")(bp=function(t){function e(){for(var e,i=arguments.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=Cp[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,Cp):n.copyTexImagesToTexture([t],this._gfxTexture,Cp)}}},i._assignImage=function(t,e,i){var n=t.data;if(n&&(this.uploadData(n,e,i),this._checkTextureLoaded(),be.CLEANUP_IMAGE_CACHE)){var r=xp.getDeps(this._uuid),s=r.indexOf(t._uuid);-1!==s&&(ae(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){$(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=Ml.NONE;this._mipFilter!==Xf.NONE&&function(t,e,i){return!(t.gfxAPI===Tl.WEBGL)||Rp(e)&&Rp(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=Ml.GEN_MIPMAP));var i=this._getGfxTextureCreateInfo({usage:Ol.SAMPLED|Ol.TRANSFER_DST,format:this._getGFXFormat(),levelCount:this._mipmapLevel,flags:e});if(i){var n=t.createTexture(i);this._textureWidth=i.width,this._textureHeight=i.height,this._gfxTexture=n}}},i._createTextureView=function(t){if(!this._gfxTexture)return null;var e=this._maxLevel<this._mipmapLevel?this._maxLevel:this._mipmapLevel-1,i=this._getGfxTextureViewCreateInfo({texture:this._gfxTexture,format:this._getGFXFormat(),baseLevel:this._baseLevel,levelCount:e-this._baseLevel+1});return i?t.createTexture(i):null},i._tryDestroyTexture=function(){this._gfxTexture&&(this._gfxTexture.destroy(),this._gfxTexture=null)},i._tryDestroyTextureView=function(){this._gfxTextureView&&(this._gfxTextureView.destroy(),this._gfxTextureView=null)},n(e,[{key:"mipmapLevel",get:function(){return this._mipmapLevel}}]),e}(pd))||bp;v.SimpleTexture=Op;var Mp=t("dR",(wp=Is("cc.Texture2D"),Ip=ha([ld]),wp((Dp=function(t){function e(){for(var e,i=arguments.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=Pp&&Pp(),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=Hf.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 ld,n.mipmaps[r]){var s=n.mipmaps[r];i.result.push(this._mipmaps,""+r,s,ie(ld))}},i._getGfxTextureCreateInfo=function(t){var e=new Oc(Pl.TEX2D);return e.width=this._width,e.height=this._height,Object.assign(e,t),e},i._getGfxTextureViewCreateInfo=function(t){var e=new Mc;return e.type=Pl.TEX2D,Object.assign(e,t),e},i.initDefault=function(e){t.prototype.initDefault.call(this,e);var i=new ld;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}(Op),Pp=Ss(Dp.prototype,"_mipmaps",[Ip],(function(){return[]})),Bp=Dp))||Bp));v.Texture2D=Mp;var Np=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 Lp;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}(),Lp=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=Hf.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 Tc;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}(Mp),Fp={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},kp=t("db",function(){function t(){}return t.init=function(){var e=Ee.querySettings(Te.Category.ENGINE,"customLayers");if(e)for(var i=0;i<e.length;i++){var n=e[i];t.addLayer(n.name,n.bit)}},t.makeMaskInclude=function(t){for(var e,i=0,n=f(t);!(e=n()).done;)i|=e.value;return i},t.makeMaskExclude=function(e){return~t.makeMaskInclude(e)},t.addLayer=function(e,i){if(void 0!==i)if(i>19||i<0)console.warn("maximum layers reached.");else{var n=1<<i;t.Enum[e],tt(2104,e),t.Enum[e]=n,bt(t.Enum,String(n),e),t.BitMask[e]=n,bt(t.BitMask,String(n),e),de.update(t.BitMask),me.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],de.update(t.BitMask),me.update(t.Enum)}},t.nameToLayer=function(e){return void 0===e?(console.warn("name can't be undefined"),-1):T(t.Enum[e])},t.layerToName=function(e){return e>31||e<0?(console.warn("Unable to access unknown layer."),""):t.Enum[1<<e]},t}());kp.Enum=me(Fp),kp.BitMask=de(r({},Fp)),v.Layers=kp;var Gp,Vp,Up=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}();ba.Flags.Destroying,v.GAME_VIEW,t("dh",Gp),function(t){t[t.LOCAL=0]="LOCAL",t[t.WORLD=1]="WORLD"}(Gp||t("dh",Gp={})),t("di",Vp),function(t){t[t.NONE=0]="NONE",t[t.POSITION=1]="POSITION",t[t.ROTATION=2]="ROTATION",t[t.SCALE=4]="SCALE",t[t.RS=t.ROTATION|t.SCALE]="RS",t[t.TRS=t.POSITION|t.ROTATION|t.SCALE]="TRS",t[t.TRS_MASK=~t.TRS]="TRS_MASK"}(Vp||t("di",Vp={})),v.internal.TransformBit=Vp;var zp,Hp,Wp,Xp,jp,Yp,qp,Kp,Jp,Qp,Zp,$p,tm,em,im,nm,rm,sm,am=t("dj",me({Static:0,Stationary:1,Movable:2}));t("dk",zp),function(t){t.TOUCH_START="touch-start",t.TOUCH_MOVE="touch-move",t.TOUCH_END="touch-end",t.TOUCH_CANCEL="touch-cancel",t.MOUSE_DOWN="mouse-down",t.MOUSE_MOVE="mouse-move",t.MOUSE_UP="mouse-up",t.MOUSE_WHEEL="mouse-wheel",t.MOUSE_ENTER="mouse-enter",t.MOUSE_LEAVE="mouse-leave",t.KEY_DOWN="keydown",t.KEY_UP="keyup",t.DEVICEMOTION="devicemotion",t.TRANSFORM_CHANGED="transform-changed",t.MOBILITY_CHANGED="mobility-changed",t.SCENE_CHANGED_FOR_PERSISTS="scene-changed-for-persists",t.SIZE_CHANGED="size-changed",t.ANCHOR_CHANGED="anchor-changed",t.COLOR_CHANGED="color-changed",t.CHILD_ADDED="child-added",t.CHILD_REMOVED="child-removed",t.PARENT_CHANGED="parent-changed",t.NODE_DESTROYED="node-destroyed",t.LAYER_CHANGED="layer-changed",t.SIBLING_ORDER_CHANGED="sibling-order-changed",t.ACTIVE_IN_HIERARCHY_CHANGED="active-in-hierarchy-changed",t.COMPONENT_ADDED="component-added",t.COMPONENT_REMOVED="component-removed",t.LIGHT_PROBE_CHANGED="light-probe-changed",t.LIGHT_PROBE_BAKING_CHANGED="light-probe-baking-changed"}(zp||t("dk",zp={}));var om=ba.Flags.Destroying,hm=ba.Flags.DontDestroy,um=ba.Flags.Deactivating,lm=new mt("Node");function cm(t){return t?"string"==typeof t?te(t):t:(J(3804),null)}var _m=new Yi,fm=new Yi,dm=new sn,pm=new sn,mm=new sn,gm=new en;new en;var ym,vm,Sm,Am,Tm,Em,bm,xm,Cm,Rm=new fn,wm=new fn,Im=[],Bm=Symbol("ReserveContentsForAllSyncablePrefab"),Dm=0,Pm=t("d9",(Hp=Is("cc.Node"),Wp=ha(Yi),Xp=ha(am),Hp(((sm=function(t){s(i,t),i._setScene=function(t){t._updateScene()},i._findComponent=function(t,e){var i=e,n=t._components;if(i._sealed)for(var r=0;r<n.length;++r){var s=n[r];if(s.constructor===e)return s}else for(var a=0;a<n.length;++a){var o=n[a];if(o instanceof e)return o}return null},i._findComponents=function(t,e,i){var n=e,r=t._components;if(n._sealed)for(var s=0;s<r.length;++s){var a=r[s];a.constructor===e&&i.push(a)}else for(var o=0;o<r.length;++o){var h=r[o];h instanceof e&&i.push(h)}},i._findChildComponent=function(t,e){for(var n=0;n<t.length;++n){var r=t[n],s=i._findComponent(r,e);if(s)return s;if(r._children.length>0&&(s=i._findChildComponent(r._children,e)))return s}return null},i._findChildComponents=function(t,e,n){for(var r=0;r<t.length;++r){var s=t[r];i._findComponents(s,e,n),s._children.length>0&&i._findChildComponents(s._children,e,n)}};var e=i.prototype;function i(e){var i;return(i=t.call(this,e)||this)._parent=qp&&qp(),i._children=Kp&&Kp(),i._active=Jp&&Jp(),i._components=Qp&&Qp(),i._prefab=Zp&&Zp(),i._scene=null,i._activeInHierarchy=!1,i._id=lm.getNewId(),i._name=void 0,i._eventProcessor=new v.NodeEventProcessor(c(i)),i._eventMask=0,i._siblingIndex=0,i._originalSceneId="",i._uiProps=new Up(c(i)),i._static=!1,i._lpos=$p&&$p(),i._lrot=tm&&tm(),i._lscale=em&&em(),i._mobility=im&&im(),i._layer=nm&&nm(),i._euler=rm&&rm(),i._transformFlags=Vp.NONE,i._eulerDirty=!1,i._flagChangeVersion=0,i._hasChangedFlags=0,i._name=void 0!==e?e:"New Node",i._pos=new Yi,i._rot=new sn,i._scale=new Yi(1,1,1),i._mat=new fn,i}return 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){Gt(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(zp.PARENT_CHANGED,i),i&&!(i._objFlags&om)){var r=i._children.indexOf(this);i._children.splice(r,1),i._updateSiblingIndex(),i.emit&&i.emit(zp.CHILD_REMOVED,this)}n&&(n._children.push(this),this._siblingIndex=n._children.length-1,n.emit&&n.emit(zp.CHILD_ADDED,this)),this._onHierarchyChanged(i)}},e.getChildByUuid=function(t){if(!t)return F("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 F("Invalid name"),null;for(var e=this._children,i=0,n=e.length;i<n;i++)if(e[i]._name===t)return e[i];return null},e.getChildByPath=function(t){for(var e=t.split("/"),i=this,n=function(){var t=e[r];if(0===t.length)return"continue";var n=i.children.find((function(e){return e.name===t}));if(!n)return{v:null};i=n},r=0;r<e.length;++r){var s=n();if("continue"!==s&&"object"==typeof s)return s.v}return i},e.addChild=function(t){t.setParent(this)},e.insertChild=function(t,e){t.setParent(this),t.setSiblingIndex(e)},e.getSiblingIndex=function(){return this._siblingIndex},e.setSiblingIndex=function(t){if(this._parent)if(this._parent._objFlags&um)J(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=cm(t);return e?i._findComponent(this,e):null},e.getComponents=function(t){var e=cm(t),n=[];return e&&i._findComponents(this,e,n),n},e.getComponentInChildren=function(t){var e=cm(t);return e?i._findChildComponent(this._children,e):null},e.getComponentsInChildren=function(t){var e=cm(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=te(t)))throw v._RF.peek()&&J(3808,t),TypeError(tt(3807,t))}else{if(!t)throw TypeError(tt(3804));e=t}if("function"!=typeof e)throw TypeError(tt(3809));if(!zt(e,v.Component))throw TypeError(tt(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(zp.COMPONENT_ADDED,a),this._activeInHierarchy&&v.director._nodeActivator.activateComp(a),a},e.removeComponent=function(t){if(t){var e=null;(e=t instanceof Vd?t:this.getComponent(t))&&e.destroy()}else J(3813)},e.on=function(t,e,i,n){switch(void 0===n&&(n=!1),t){case zp.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 zp.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(zp.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&om)){var e=this._components.indexOf(t);-1!==e?(this._components.splice(e,1),this.emit(zp.COMPONENT_REMOVED,t)):t.node!==this&&J(3815)}}else J(3814)},e._updateSiblingIndex=function(){for(var t=0;t<this._children.length;++t)this._children[t]._siblingIndex=t;this.emit(zp.SIBLING_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|=om;var t=this._parent,e=!!t&&0!=(t._objFlags&om);if(this._persistNode&&v.game.removePersistRootNode(this),!e&&t){this.emit(zp.PARENT_CHANGED,this);var i=t._children.indexOf(this);t._children.splice(i,1),this._siblingIndex=0,t._updateSiblingIndex(),t.emit&&t.emit(zp.CHILD_REMOVED,this)}this.emit(zp.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[Da]=function(t){t.writeThis()},e._onSetParent=function(t,e){if(void 0===e&&(e=!1),this._parent&&(null!=t&&t._scene===this._parent._scene||null==this._parent._scene||this.walk(i._setScene)),e){var n=this._parent;n?(n.updateWorldTransform(),Ei(fn.determinant(n._mat),0,Ai)?(q(14300),this._transformFlags|=Vp.TRS,this.updateWorldTransform()):(fn.multiply(Rm,fn.invert(Rm,n._mat),this._mat),fn.toRTS(Rm,this._lrot,this._lpos,this._lscale))):(Yi.copy(this._lpos,this._pos),sn.copy(this._lrot,this._rot),Yi.copy(this._lscale,this._scale)),this._eulerDirty=!0}this.invalidateChildren(Vp.TRS)},e._onHierarchyChanged=function(t){this.eventProcessor.reattach(),this._onHierarchyChangedBase(t)},e._onBatchCreated=function(t){this.hasChangedFlags=Vp.TRS,this._transformFlags|=Vp.TRS;for(var e=this._children.length,i=0;i<e;++i)this._children[i]._siblingIndex=i,this._children[i]._onBatchCreated(t)},e._onBeforeSerialize=function(){this.eulerAngles},e._onPostActivated=function(t){t?(this._eventProcessor.setEnabled(!0),this.invalidateChildren(Vp.TRS),this._uiProps&&this._uiProps.uiComp&&(this._uiProps.uiComp.setNodeDirty(),this._uiProps.uiComp.setTextureDirty(),this._uiProps.uiComp.markForUpdateRenderData())):this._eventProcessor.setEnabled(!1)},e.translate=function(t,e){var i=e||Gp.LOCAL;if(i===Gp.LOCAL)Yi.transformQuat(_m,t,this._lrot),this._lpos.x+=_m.x,this._lpos.y+=_m.y,this._lpos.z+=_m.z;else if(i===Gp.WORLD)if(this._parent){sn.invert(dm,this._parent.worldRotation),Yi.transformQuat(_m,t,dm);var n=this.worldScale;this._lpos.x+=_m.x/n.x,this._lpos.y+=_m.y/n.y,this._lpos.z+=_m.z/n.z}else this._lpos.x+=t.x,this._lpos.y+=t.y,this._lpos.z+=t.z;this.invalidateChildren(Vp.POSITION),1&this._eventMask&&this.emit(zp.TRANSFORM_CHANGED,Vp.POSITION)},e.rotate=function(t,e){var i=e||Gp.LOCAL;if(sn.normalize(dm,t),i===Gp.LOCAL)sn.multiply(this._lrot,this._lrot,dm);else if(i===Gp.WORLD){var n=this.worldRotation;sn.multiply(pm,dm,n),sn.invert(dm,n),sn.multiply(pm,dm,pm),sn.multiply(this._lrot,this._lrot,pm)}this._eulerDirty=!0,this.invalidateChildren(Vp.ROTATION),1&this._eventMask&&this.emit(zp.TRANSFORM_CHANGED,Vp.ROTATION)},e.lookAt=function(t,e){this.getWorldPosition(_m),Yi.subtract(_m,_m,t),Yi.normalize(_m,_m),sn.fromViewUp(dm,_m,e),this.setWorldRotation(dm)},e.invalidateChildren=function(t){var e,i,n=0,r=0,s=0,a=0,o=t|Vp.POSITION;for(Im[0]=this;n>=0;){if(a=(e=Im[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++)Im[++n]=i[r];t=o}},e.updateWorldTransform=function(){if(this._transformFlags){for(var t,e=this,i=0;e&&e._transformFlags;)Im[i++]=e,e=e._parent;for(var n=0;i;){if(n|=(t=Im[--i])._transformFlags,e){if(n&Vp.POSITION&&(Yi.transformMat4(t._pos,t._lpos,e._mat),t._mat.m12=t._pos.x,t._mat.m13=t._pos.y,t._mat.m14=t._pos.z),n&Vp.RS){fn.fromRTS(t._mat,t._lrot,t._lpos,t._lscale),fn.multiply(t._mat,e._mat,t._mat);var r=n&Vp.ROTATION?t._rot:null;fn.toRTS(t._mat,r,null,t._scale)}}else n&Vp.POSITION&&(Yi.copy(t._pos,t._lpos),t._mat.m12=t._pos.x,t._mat.m13=t._pos.y,t._mat.m14=t._pos.z),n&Vp.RS&&(n&Vp.ROTATION&&sn.copy(t._rot,t._lrot),n&Vp.SCALE&&Yi.copy(t._scale,t._lscale),fn.fromRTS(t._mat,t._rot,t._pos,t._scale));t._transformFlags=Vp.NONE,e=t}}},e.setPosition=function(t,e,i){void 0===e&&void 0===i?Yi.copy(this._lpos,t):void 0===i?Yi.set(this._lpos,t,e,this._lpos.z):Yi.set(this._lpos,t,e,i),this.invalidateChildren(Vp.POSITION),1&this._eventMask&&this.emit(zp.TRANSFORM_CHANGED,Vp.POSITION)},e.getPosition=function(t){return t?Yi.set(t,this._lpos.x,this._lpos.y,this._lpos.z):Yi.copy(new Yi,this._lpos)},e.setRotation=function(t,e,i,n){void 0===e||void 0===i||void 0===n?sn.copy(this._lrot,t):sn.set(this._lrot,t,e,i,n),this._eulerDirty=!0,this.invalidateChildren(Vp.ROTATION),1&this._eventMask&&this.emit(zp.TRANSFORM_CHANGED,Vp.ROTATION)},e.setRotationFromEuler=function(t,e,i){var n=void 0===i?this._euler.z:i;void 0===e?(Yi.copy(this._euler,t),sn.fromEuler(this._lrot,t.x,t.y,t.z)):(Yi.set(this._euler,t,e,n),sn.fromEuler(this._lrot,t,e,n)),this._eulerDirty=!1,this.invalidateChildren(Vp.ROTATION),1&this._eventMask&&this.emit(zp.TRANSFORM_CHANGED,Vp.ROTATION)},e.getRotation=function(t){return t?sn.set(t,this._lrot.x,this._lrot.y,this._lrot.z,this._lrot.w):sn.copy(new sn,this._lrot)},e.setScale=function(t,e,i){void 0===e&&void 0===i?Yi.copy(this._lscale,t):void 0===i?Yi.set(this._lscale,t,e,this._lscale.z):Yi.set(this._lscale,t,e,i),this.invalidateChildren(Vp.SCALE),1&this._eventMask&&this.emit(zp.TRANSFORM_CHANGED,Vp.SCALE)},e.getScale=function(t){return t?Yi.set(t,this._lscale.x,this._lscale.y,this._lscale.z):Yi.copy(new Yi,this._lscale)},e.inverseTransformPoint=function(t,e){Yi.copy(t,e);for(var i=this,n=0;i._parent;)Im[n++]=i,i=i._parent;for(;n>=0;)Yi.transformInverseRTS(t,t,i._lrot,i._lpos,i._lscale),i=Im[--n];return t},e.setWorldPosition=function(t,e,i){void 0===e||void 0===i?Yi.copy(this._pos,t):Yi.set(this._pos,t,e,i);var n=this._parent,r=this._lpos;n?(n.updateWorldTransform(),Yi.transformMat4(r,this._pos,fn.invert(Rm,n._mat))):Yi.copy(r,this._pos),this.invalidateChildren(Vp.POSITION),1&this._eventMask&&this.emit(zp.TRANSFORM_CHANGED,Vp.POSITION)},e.getWorldPosition=function(t){return this.updateWorldTransform(),t?Yi.copy(t,this._pos):Yi.copy(new Yi,this._pos)},e.setWorldRotation=function(t,e,i,n){void 0===e||void 0===i||void 0===n?sn.copy(this._rot,t):sn.set(this._rot,t,e,i,n),this._parent?(this._parent.updateWorldTransform(),sn.multiply(this._lrot,sn.conjugate(this._lrot,this._parent._rot),this._rot)):sn.copy(this._lrot,this._rot),this._eulerDirty=!0,this.invalidateChildren(Vp.ROTATION),1&this._eventMask&&this.emit(zp.TRANSFORM_CHANGED,Vp.ROTATION)},e.setWorldRotationFromEuler=function(t,e,i){sn.fromEuler(this._rot,t,e,i),this._parent?(this._parent.updateWorldTransform(),sn.multiply(this._lrot,sn.conjugate(this._lrot,this._parent._rot),this._rot)):sn.copy(this._lrot,this._rot),this._eulerDirty=!0,this.invalidateChildren(Vp.ROTATION),1&this._eventMask&&this.emit(zp.TRANSFORM_CHANGED,Vp.ROTATION)},e.getWorldRotation=function(t){return this.updateWorldTransform(),t?sn.copy(t,this._rot):sn.copy(new sn,this._rot)},e.setWorldScale=function(t,e,i){var n=this._parent;n&&this.updateWorldTransform(),void 0===e||void 0===i?Yi.copy(this._scale,t):Yi.set(this._scale,t,e,i),n?(_m.x=this._scale.x/Yi.set(fm,this._mat.m00,this._mat.m01,this._mat.m02).length(),_m.y=this._scale.y/Yi.set(fm,this._mat.m04,this._mat.m05,this._mat.m06).length(),_m.z=this._scale.z/Yi.set(fm,this._mat.m08,this._mat.m09,this._mat.m10).length(),fn.scale(Rm,this._mat,_m),fn.multiply(wm,fn.invert(wm,n._mat),Rm),en.fromQuat(gm,sn.conjugate(mm,this._lrot)),en.multiplyMat4(gm,gm,wm),this._lscale.x=Yi.set(_m,gm.m00,gm.m01,gm.m02).length(),this._lscale.y=Yi.set(_m,gm.m03,gm.m04,gm.m05).length(),this._lscale.z=Yi.set(_m,gm.m06,gm.m07,gm.m08).length()):Yi.copy(this._lscale,this._scale),this.invalidateChildren(Vp.SCALE),1&this._eventMask&&this.emit(zp.TRANSFORM_CHANGED,Vp.SCALE)},e.getWorldScale=function(t){return this.updateWorldTransform(),t?Yi.copy(t,this._scale):Yi.copy(new Yi,this._scale)},e.getWorldMatrix=function(t){this.updateWorldTransform();var e=t||new fn;return fn.copy(e,this._mat)},e.getWorldRS=function(t){this.updateWorldTransform();var e=t||new fn;return fn.copy(e,this._mat),e.m12=0,e.m13=0,e.m14=0,e},e.getWorldRT=function(t){this.updateWorldTransform();var e=t||new fn;return fn.fromRT(e,this._rot,this._pos)},e.setRTS=function(t,e,i){var n=0;t&&(n|=Vp.ROTATION,void 0!==t.w?(sn.copy(this._lrot,t),this._eulerDirty=!0):(Yi.copy(this._euler,t),sn.fromEuler(this._lrot,t.x,t.y,t.z),this._eulerDirty=!1)),e&&(Yi.copy(this._lpos,e),n|=Vp.POSITION),i&&(Yi.copy(this._lscale,i),n|=Vp.SCALE),n&&(this.invalidateChildren(n),1&this._eventMask&&this.emit(zp.TRANSFORM_CHANGED,n))},e.isTransformDirty=function(){return this._transformFlags!==Vp.NONE},e.pauseSystemEvents=function(t){this._eventProcessor.setEnabled(!1,t)},e.resumeSystemEvents=function(t){this._eventProcessor.setEnabled(!0,t)},i.resetHasChangedFlags=function(){Dm+=1},i.clearNodeArray=function(){i.ClearFrame<i.ClearRound?i.ClearFrame++:(i.ClearFrame=0,Im.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&hm)>0},set:function(t){t?this._objFlags|=hm:this._objFlags&=~hm}},{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:"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&&(sn.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){Yi.set(this._euler,0,0,t),sn.fromAngleZ(this._lrot,t),this._eulerDirty=!1,this.invalidateChildren(Vp.ROTATION),1&this._eventMask&&this.emit(zp.TRANSFORM_CHANGED,Vp.ROTATION)}},{key:"worldRotation",get:function(){return this.updateWorldTransform(),this._rot},set:function(t){this.setWorldRotation(t)}},{key:"scale",get:function(){return this._lscale},set:function(t){this.setScale(t)}},{key:"worldScale",get:function(){return this.updateWorldTransform(),this._scale},set:function(t){this.setWorldScale(t)}},{key:"matrix",set:function(t){fn.toRTS(t,this._lrot,this._lpos,this._lscale),this.invalidateChildren(Vp.TRS),this._eulerDirty=!0,1&this._eventMask&&this.emit(zp.TRANSFORM_CHANGED,Vp.TRS)}},{key:"worldMatrix",get:function(){return this.updateWorldTransform(),this._mat}},{key:"forward",get:function(){return Yi.transformQuat(new Yi,Yi.FORWARD,this.worldRotation)},set:function(t){var e=t.length();Yi.multiplyScalar(_m,t,-1/e),sn.fromViewUp(dm,_m),this.setWorldRotation(dm)}},{key:"up",get:function(){return Yi.transformQuat(new Yi,Yi.UP,this.worldRotation)}},{key:"right",get:function(){return Yi.transformQuat(new Yi,Yi.RIGHT,this.worldRotation)}},{key:"mobility",get:function(){return this._mobility},set:function(t){this._mobility=t,this.emit(zp.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(zp.LAYER_CHANGED,this._layer)}},{key:"flagChangedVersion",get:function(){return this._flagChangeVersion}},{key:"hasChangedFlags",get:function(){return this._flagChangeVersion===Dm?this._hasChangedFlags:0},set:function(t){this._flagChangeVersion=Dm,this._hasChangedFlags=t}}]),i}(ba)).idGenerator=lm,sm._stacks=[[]],sm._stackId=0,sm.EventType=zp,sm.NodeSpace=Gp,sm.TransformDirtyBit=Vp,sm.TransformBit=Vp,sm.reserveContentsForAllSyncablePrefabTag=Bm,sm.ClearFrame=0,sm.ClearRound=1e3,p((Yp=sm).prototype,"_persistNode",[Os],Object.getOwnPropertyDescriptor(Yp.prototype,"_persistNode"),Yp.prototype),qp=Ss(Yp.prototype,"_parent",[ks],(function(){return null})),Kp=Ss(Yp.prototype,"_children",[ks],(function(){return[]})),Jp=Ss(Yp.prototype,"_active",[ks],(function(){return!0})),Qp=Ss(Yp.prototype,"_components",[ks],(function(){return[]})),Zp=Ss(Yp.prototype,"_prefab",[ks],(function(){return null})),$p=Ss(Yp.prototype,"_lpos",[ks],(function(){return new Yi})),tm=Ss(Yp.prototype,"_lrot",[ks],(function(){return new sn})),em=Ss(Yp.prototype,"_lscale",[ks],(function(){return new Yi(1,1,1)})),im=Ss(Yp.prototype,"_mobility",[ks],(function(){return am.Static})),nm=Ss(Yp.prototype,"_layer",[ks],(function(){return kp.Enum.DEFAULT})),rm=Ss(Yp.prototype,"_euler",[ks],(function(){return new Yi})),p(Yp.prototype,"eulerAngles",[Wp],Object.getOwnPropertyDescriptor(Yp.prototype,"eulerAngles"),Yp.prototype),p(Yp.prototype,"mobility",[Xp],Object.getOwnPropertyDescriptor(Yp.prototype,"mobility"),Yp.prototype),jp=Yp))||jp));v.Node=Pm,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"}(xm||(xm={})),function(t){t[t.NONE=0]="NONE",t[t.AUTO=1]="AUTO",t[t.BAKED_CONVOLUTION_MAP=2]="BAKED_CONVOLUTION_MAP"}(Cm||(Cm={}));var Om=t("dS",Is("cc.TextureCube")(((bm=function(t){function e(){for(var e,i=arguments.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=Sm&&Sm(),e._mipmapAtlas=Am&&Am(),e._mipmapMode=Tm&&Tm(),e._mipmaps=Em&&Em(),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){Mm(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===Cm.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+xm.front].image,back:t[a+xm.back].image,left:t[a+xm.left].image,right:t[a+xm.right].image,top:t[a+xm.top].image,bottom:t[a+xm.bottom].image})}return(i=i||new e).mipmaps=n,i},i.onLoaded=function(){this._mipmapMode===Cm.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;Mm(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===Cm.BAKED_CONVOLUTION_MAP){var r=n.mipmapAtlas,s=n.mipmapLayout;this._mipmapAtlas={atlas:{},layout:s},this._mipmapAtlas.atlas={front:new ld,back:new ld,left:new ld,right:new ld,top:new ld,bottom:new ld};var a=ie(ld);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 ld,back:new ld,left:new ld,right:new ld,top:new ld,bottom:new ld};var h=n.mipmaps[o],u=ie(ld);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 Oc(Pl.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 Mc;return e.type=Pl.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}),Mm(this._mipmapAtlas.atlas,(function(i,n){var r=new Mp;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 Tc;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 ld({_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 ld;i.initDefault(),this.mipmaps=[{front:i,back:i,top:i,bottom:i,left:i,right:i}]},i.validate=function(){if(this._mipmapMode===Cm.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(A.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];Mm(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 ld({_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}(Op)).FaceIndex=xm,Sm=Ss((vm=bm).prototype,"isRGBE",[ks],(function(){return!1})),Am=Ss(vm.prototype,"_mipmapAtlas",[ks],(function(){return null})),Tm=Ss(vm.prototype,"_mipmapMode",[ks],(function(){return Cm.NONE})),Em=Ss(vm.prototype,"_mipmaps",[ks],(function(){return[]})),ym=vm))||ym);function Mm(t,e){e(t.front,xm.front),e(t.back,xm.back),e(t.left,xm.left),e(t.right,xm.right),e(t.top,xm.top),e(t.bottom,xm.bottom)}v.TextureCube=Om;var Nm=function(){function t(){this._groundAlbedoHDR=new zi(.2,.2,.2,1),this._skyColorHDR=new zi(.2,.5,.8,1),this._skyIllumHDR=0,this._groundAlbedoLDR=new zi(.2,.2,.2,1),this._skyColorLDR=new zi(.2,.5,.8,1),this._skyIllumLDR=0,this._mipmapCount=1,this._enabled=!1}return 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}();Nm.SUN_ILLUM=65e3,Nm.SKY_ILLUM=2e4,v.Ambient=Nm;var Lm,Fm,km="MainFlow",Gm="ForwardFlow",Vm="ShadowFlow";!function(t){t[t.DEFAULT=100]="DEFAULT",t[t.UI=200]="UI"}(Lm||(Lm={})),v.RenderPassStage=Lm,function(t){t[t.MIN=0]="MIN",t[t.MAX=255]="MAX",t[t.DEFAULT=128]="DEFAULT"}(Fm||(Fm={}));var Um,zm={bindings:[],layouts:{}},Hm={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"}(Um||(Um={}));var Wm,Xm=Um.SAMPLER_SHADOWMAP,jm=Um.COUNT-Xm;!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"}(Wm||(Wm={}));var Ym,qm=Wm.SAMPLER_JOINTS,Km=Wm.STORAGE_REFLECTION-qm,Jm=Wm.COUNT-qm-Km;!function(t){t[t.GLOBAL=0]="GLOBAL",t[t.MATERIAL=1]="MATERIAL",t[t.LOCAL=2]="LOCAL",t[t.COUNT=3]="COUNT"}(Ym||(Ym={}));var Qm=new xc([Xm,0,qm,0],[jm,0,Km,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,Jm,0],[0,0,0,0],[0,2,1,3]),Zm=function(){};Zm.SIZE=4*(Zm.COUNT=4+(Zm.DEBUG_VIEW_MODE_OFFSET=4+(Zm.PROBE_INFO_OFFSET=4+(Zm.NATIVE_SIZE_OFFSET=4+(Zm.SCREEN_SIZE_OFFSET=4+(Zm.TIME_OFFSET=0)))))),Zm.NAME="CCGlobal",Zm.BINDING=Um.UBO_GLOBAL,Zm.DESCRIPTOR=new n_(Zm.BINDING,nc.UNIFORM_BUFFER,1,Xl.ALL),Zm.LAYOUT=new Fc(Ym.GLOBAL,Zm.BINDING,Zm.NAME,[new Lc("cc_time",Rl.FLOAT4,1),new Lc("cc_screenSize",Rl.FLOAT4,1),new Lc("cc_nativeSize",Rl.FLOAT4,1),new Lc("cc_probeInfo",Rl.FLOAT4,1),new Lc("cc_debug_view_mode",Rl.FLOAT4,1)],1),zm.layouts[Zm.NAME]=Zm.LAYOUT,zm.bindings[Zm.BINDING]=Zm.DESCRIPTOR;var $m=function(){};$m.SIZE=4*($m.COUNT=4+($m.VIEW_PORT_OFFSET=4+($m.NEAR_FAR_OFFSET=4+($m.GLOBAL_FOG_ADD_OFFSET=4+($m.GLOBAL_FOG_BASE_OFFSET=4+($m.GLOBAL_FOG_COLOR_OFFSET=4+($m.AMBIENT_GROUND_OFFSET=4+($m.AMBIENT_SKY_OFFSET=4+($m.MAIN_LIT_COLOR_OFFSET=4+($m.MAIN_LIT_DIR_OFFSET=4+($m.EXPOSURE_OFFSET=4+($m.SCREEN_SCALE_OFFSET=4+($m.SURFACE_TRANSFORM_OFFSET=4+($m.CAMERA_POS_OFFSET=16+($m.MAT_VIEW_PROJ_INV_OFFSET=16+($m.MAT_VIEW_PROJ_OFFSET=16+($m.MAT_PROJ_INV_OFFSET=16+($m.MAT_PROJ_OFFSET=16+($m.MAT_VIEW_INV_OFFSET=16+($m.MAT_VIEW_OFFSET=0)))))))))))))))))))),$m.NAME="CCCamera",$m.BINDING=Um.UBO_CAMERA,$m.DESCRIPTOR=new n_($m.BINDING,nc.UNIFORM_BUFFER,1,Xl.ALL),$m.LAYOUT=new Fc(Ym.GLOBAL,$m.BINDING,$m.NAME,[new Lc("cc_matView",Rl.MAT4,1),new Lc("cc_matViewInv",Rl.MAT4,1),new Lc("cc_matProj",Rl.MAT4,1),new Lc("cc_matProjInv",Rl.MAT4,1),new Lc("cc_matViewProj",Rl.MAT4,1),new Lc("cc_matViewProjInv",Rl.MAT4,1),new Lc("cc_cameraPos",Rl.FLOAT4,1),new Lc("cc_surfaceTransform",Rl.FLOAT4,1),new Lc("cc_screenScale",Rl.FLOAT4,1),new Lc("cc_exposure",Rl.FLOAT4,1),new Lc("cc_mainLitDir",Rl.FLOAT4,1),new Lc("cc_mainLitColor",Rl.FLOAT4,1),new Lc("cc_ambientSky",Rl.FLOAT4,1),new Lc("cc_ambientGround",Rl.FLOAT4,1),new Lc("cc_fogColor",Rl.FLOAT4,1),new Lc("cc_fogBase",Rl.FLOAT4,1),new Lc("cc_fogAdd",Rl.FLOAT4,1),new Lc("cc_nearFar",Rl.FLOAT4,1),new Lc("cc_viewPort",Rl.FLOAT4,1)],1),zm.layouts[$m.NAME]=$m.LAYOUT,zm.bindings[$m.BINDING]=$m.DESCRIPTOR;var tg=function(){};tg.SIZE=4*(tg.COUNT=4+(tg.PLANAR_NORMAL_DISTANCE_INFO_OFFSET=4+(tg.SHADOW_COLOR_OFFSET=4+(tg.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET=4+(tg.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET=4+(tg.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET=4+(tg.SHADOW_PROJ_INFO_OFFSET=4+(tg.SHADOW_PROJ_DEPTH_INFO_OFFSET=4+(tg.SHADOW_INV_PROJ_DEPTH_INFO_OFFSET=16+(tg.MAT_LIGHT_VIEW_PROJ_OFFSET=16+(tg.MAT_LIGHT_VIEW_OFFSET=0))))))))))),tg.NAME="CCShadow",tg.BINDING=Um.UBO_SHADOW,tg.DESCRIPTOR=new n_(tg.BINDING,nc.UNIFORM_BUFFER,1,Xl.ALL),tg.LAYOUT=new Fc(Ym.GLOBAL,tg.BINDING,tg.NAME,[new Lc("cc_matLightView",Rl.MAT4,1),new Lc("cc_matLightViewProj",Rl.MAT4,1),new Lc("cc_shadowInvProjDepthInfo",Rl.FLOAT4,1),new Lc("cc_shadowProjDepthInfo",Rl.FLOAT4,1),new Lc("cc_shadowProjInfo",Rl.FLOAT4,1),new Lc("cc_shadowNFLSInfo",Rl.FLOAT4,1),new Lc("cc_shadowWHPBInfo",Rl.FLOAT4,1),new Lc("cc_shadowLPNNInfo",Rl.FLOAT4,1),new Lc("cc_shadowColor",Rl.FLOAT4,1),new Lc("cc_planarNDInfo",Rl.FLOAT4,1)],1),zm.layouts[tg.NAME]=tg.LAYOUT,zm.bindings[tg.BINDING]=tg.DESCRIPTOR;var eg=function(){};eg.CSM_LEVEL_COUNT=4,eg.SIZE=4*(eg.COUNT=4+(eg.CSM_SPLITS_INFO_OFFSET=(eg.CSM_PROJ_INFO_OFFSET=(eg.CSM_PROJ_DEPTH_INFO_OFFSET=(eg.MAT_CSM_VIEW_PROJ_OFFSET=(eg.CSM_ATLAS_OFFSET=(eg.CSM_VIEW_DIR_2_OFFSET=(eg.CSM_VIEW_DIR_1_OFFSET=(eg.CSM_VIEW_DIR_0_OFFSET=0)+4*eg.CSM_LEVEL_COUNT)+4*eg.CSM_LEVEL_COUNT)+4*eg.CSM_LEVEL_COUNT)+4*eg.CSM_LEVEL_COUNT)+16*eg.CSM_LEVEL_COUNT)+4*eg.CSM_LEVEL_COUNT)+4*eg.CSM_LEVEL_COUNT)),eg.NAME="CCCSM",eg.BINDING=Um.UBO_CSM,eg.DESCRIPTOR=new n_(eg.BINDING,nc.UNIFORM_BUFFER,1,Xl.FRAGMENT),eg.LAYOUT=new Fc(Ym.GLOBAL,eg.BINDING,eg.NAME,[new Lc("cc_csmViewDir0",Rl.FLOAT4,eg.CSM_LEVEL_COUNT),new Lc("cc_csmViewDir1",Rl.FLOAT4,eg.CSM_LEVEL_COUNT),new Lc("cc_csmViewDir2",Rl.FLOAT4,eg.CSM_LEVEL_COUNT),new Lc("cc_csmAtlas",Rl.FLOAT4,eg.CSM_LEVEL_COUNT),new Lc("cc_matCSMViewProj",Rl.MAT4,eg.CSM_LEVEL_COUNT),new Lc("cc_csmProjDepthInfo",Rl.FLOAT4,eg.CSM_LEVEL_COUNT),new Lc("cc_csmProjInfo",Rl.FLOAT4,eg.CSM_LEVEL_COUNT),new Lc("cc_csmSplitsInfo",Rl.FLOAT4,1)],1),zm.layouts[eg.NAME]=eg.LAYOUT,zm.bindings[eg.BINDING]=eg.DESCRIPTOR;var ig=Um.SAMPLER_SHADOWMAP,ng=new n_(ig,nc.SAMPLER_TEXTURE,1,Xl.FRAGMENT),rg=new kc(Ym.GLOBAL,ig,"cc_shadowMap",Rl.SAMPLER2D,1);zm.layouts.cc_shadowMap=rg,zm.bindings[ig]=ng;var sg=Um.SAMPLER_ENVIRONMENT,ag=new n_(sg,nc.SAMPLER_TEXTURE,1,Xl.FRAGMENT),og=new kc(Ym.GLOBAL,sg,"cc_environment",Rl.SAMPLER_CUBE,1);zm.layouts.cc_environment=og,zm.bindings[sg]=ag;var hg=Um.SAMPLER_DIFFUSEMAP,ug=new n_(hg,nc.SAMPLER_TEXTURE,1,Xl.FRAGMENT),lg=new kc(Ym.GLOBAL,hg,"cc_diffuseMap",Rl.SAMPLER_CUBE,1);zm.layouts.cc_diffuseMap=lg,zm.bindings[hg]=ug;var cg=Um.SAMPLER_SPOT_SHADOW_MAP,_g=new n_(cg,nc.SAMPLER_TEXTURE,1,Xl.FRAGMENT),fg=new kc(Ym.GLOBAL,cg,"cc_spotShadowMap",Rl.SAMPLER2D,1);zm.layouts.cc_spotShadowMap=fg,zm.bindings[cg]=_g;var dg=function(){};dg.SIZE=4*(dg.COUNT=4+(dg.REFLECTION_PROBE_BLEND_DATA2=4+(dg.REFLECTION_PROBE_BLEND_DATA1=4+(dg.REFLECTION_PROBE_DATA2=4+(dg.REFLECTION_PROBE_DATA1=4+(dg.LOCAL_SHADOW_BIAS=4+(dg.LIGHTINGMAP_UVPARAM=16+(dg.MAT_WORLD_IT_OFFSET=16+(dg.MAT_WORLD_OFFSET=0))))))))),dg.NAME="CCLocal",dg.BINDING=Wm.UBO_LOCAL,dg.DESCRIPTOR=new n_(dg.BINDING,nc.UNIFORM_BUFFER,1,Xl.VERTEX|Xl.COMPUTE),dg.LAYOUT=new Fc(Ym.LOCAL,dg.BINDING,dg.NAME,[new Lc("cc_matWorld",Rl.MAT4,1),new Lc("cc_matWorldIT",Rl.MAT4,1),new Lc("cc_lightingMapUVParam",Rl.FLOAT4,1),new Lc("cc_localShadowBias",Rl.FLOAT4,1),new Lc("cc_reflectionProbeData1",Rl.FLOAT4,1),new Lc("cc_reflectionProbeData2",Rl.FLOAT4,1),new Lc("cc_reflectionProbeBlendData1",Rl.FLOAT4,1),new Lc("cc_reflectionProbeBlendData2",Rl.FLOAT4,1)],1),Hm.layouts[dg.NAME]=dg.LAYOUT,Hm.bindings[dg.BINDING]=dg.DESCRIPTOR;var pg=function(){};pg.SIZE=4*(pg.COUNT=4+(pg.WORLD_BOUND_HALF_EXTENTS=4+(pg.WORLD_BOUND_CENTER=0))),pg.NAME="CCWorldBound",pg.BINDING=Wm.UBO_LOCAL,pg.DESCRIPTOR=new n_(pg.BINDING,nc.UNIFORM_BUFFER,1,Xl.VERTEX|Xl.COMPUTE),pg.LAYOUT=new Fc(Ym.LOCAL,pg.BINDING,pg.NAME,[new Lc("cc_worldBoundCenter",Rl.FLOAT4,1),new Lc("cc_worldBoundHalfExtents",Rl.FLOAT4,1)],1),Hm.layouts[pg.NAME]=pg.LAYOUT,Hm.bindings[pg.BINDING]=pg.DESCRIPTOR;var mg="a_matWorld0",gg="a_sh_linear_const_r",yg=function(){};yg.BATCHING_COUNT=10,yg.MAT_WORLDS_OFFSET=0,yg.SIZE=4*(yg.COUNT=16*yg.BATCHING_COUNT),yg.NAME="CCLocalBatched",yg.BINDING=Wm.UBO_LOCAL,yg.DESCRIPTOR=new n_(yg.BINDING,nc.UNIFORM_BUFFER,1,Xl.VERTEX|Xl.COMPUTE),yg.LAYOUT=new Fc(Ym.LOCAL,yg.BINDING,yg.NAME,[new Lc("cc_matWorlds",Rl.MAT4,yg.BATCHING_COUNT)],1),Hm.layouts[yg.NAME]=yg.LAYOUT,Hm.bindings[yg.BINDING]=yg.DESCRIPTOR;var vg=function(){};vg.LIGHTS_PER_PASS=1,vg.SIZE=4*(vg.COUNT=(vg.LIGHT_BOUNDING_SIZE_VS_OFFSET=(vg.LIGHT_DIR_OFFSET=(vg.LIGHT_SIZE_RANGE_ANGLE_OFFSET=(vg.LIGHT_COLOR_OFFSET=(vg.LIGHT_POS_OFFSET=0)+4*vg.LIGHTS_PER_PASS)+4*vg.LIGHTS_PER_PASS)+4*vg.LIGHTS_PER_PASS)+4*vg.LIGHTS_PER_PASS)+4*vg.LIGHTS_PER_PASS),vg.NAME="CCForwardLight",vg.BINDING=Wm.UBO_FORWARD_LIGHTS,vg.DESCRIPTOR=new n_(vg.BINDING,nc.DYNAMIC_UNIFORM_BUFFER,1,Xl.FRAGMENT),vg.LAYOUT=new Fc(Ym.LOCAL,vg.BINDING,vg.NAME,[new Lc("cc_lightPos",Rl.FLOAT4,vg.LIGHTS_PER_PASS),new Lc("cc_lightColor",Rl.FLOAT4,vg.LIGHTS_PER_PASS),new Lc("cc_lightSizeRangeAngle",Rl.FLOAT4,vg.LIGHTS_PER_PASS),new Lc("cc_lightDir",Rl.FLOAT4,vg.LIGHTS_PER_PASS),new Lc("cc_lightBoundingSizeVS",Rl.FLOAT4,vg.LIGHTS_PER_PASS)],1),Hm.layouts[vg.NAME]=vg.LAYOUT,Hm.bindings[vg.BINDING]=vg.DESCRIPTOR;var Sg=function(){};Sg.LIGHTS_PER_PASS=10;var Ag=function(){};Ag.SIZE=4*(Ag.COUNT=4+(Ag.JOINTS_TEXTURE_INFO_OFFSET=0)),Ag.NAME="CCSkinningTexture",Ag.BINDING=Wm.UBO_SKINNING_TEXTURE,Ag.DESCRIPTOR=new n_(Ag.BINDING,nc.UNIFORM_BUFFER,1,Xl.VERTEX),Ag.LAYOUT=new Fc(Ym.LOCAL,Ag.BINDING,Ag.NAME,[new Lc("cc_jointTextureInfo",Rl.FLOAT4,1)],1),Hm.layouts[Ag.NAME]=Ag.LAYOUT,Hm.bindings[Ag.BINDING]=Ag.DESCRIPTOR;var Tg=function(){};Tg.SIZE=4*(Tg.COUNT=4+(Tg.JOINTS_ANIM_INFO_OFFSET=0)),Tg.NAME="CCSkinningAnimation",Tg.BINDING=Wm.UBO_SKINNING_ANIMATION,Tg.DESCRIPTOR=new n_(Tg.BINDING,nc.UNIFORM_BUFFER,1,Xl.VERTEX),Tg.LAYOUT=new Fc(Ym.LOCAL,Tg.BINDING,Tg.NAME,[new Lc("cc_jointAnimInfo",Rl.FLOAT4,1)],1),Hm.layouts[Tg.NAME]=Tg.LAYOUT,Hm.bindings[Tg.BINDING]=Tg.DESCRIPTOR;var Eg=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 bg(t){Eg.initLayout(t),Hm.layouts[Eg.NAME]=Eg.LAYOUT,Hm.bindings[Eg.BINDING]=Eg.DESCRIPTOR}Eg._jointUniformCapacity=0,Eg._count=0,Eg._size=0,Eg.NAME="CCSkinning",Eg.BINDING=Wm.UBO_SKINNING_TEXTURE,Eg.DESCRIPTOR=new n_(Eg.BINDING,nc.UNIFORM_BUFFER,1,Xl.VERTEX),Eg.LAYOUT=new Fc(Ym.LOCAL,Eg.BINDING,Eg.NAME,[new Lc("cc_joints",Rl.FLOAT4,1)],1);var xg=function(){};xg.MAX_MORPH_TARGET_COUNT=60,xg.OFFSET_OF_WEIGHTS=0,xg.OFFSET_OF_VERTICES_COUNT=4+(xg.OFFSET_OF_DISPLACEMENT_TEXTURE_HEIGHT=4+(xg.OFFSET_OF_DISPLACEMENT_TEXTURE_WIDTH=4*xg.MAX_MORPH_TARGET_COUNT)),xg.COUNT_BASE_4_BYTES=4*Math.ceil(xg.MAX_MORPH_TARGET_COUNT/4)+4,xg.SIZE=4*xg.COUNT_BASE_4_BYTES,xg.NAME="CCMorph",xg.BINDING=Wm.UBO_MORPH,xg.DESCRIPTOR=new n_(xg.BINDING,nc.UNIFORM_BUFFER,1,Xl.VERTEX),xg.LAYOUT=new Fc(Ym.LOCAL,xg.BINDING,xg.NAME,[new Lc("cc_displacementWeights",Rl.FLOAT4,xg.MAX_MORPH_TARGET_COUNT/4),new Lc("cc_displacementTextureInfo",Rl.FLOAT4,1)],1),Hm.layouts[xg.NAME]=xg.LAYOUT,Hm.bindings[xg.BINDING]=xg.DESCRIPTOR;var Cg=function(){};Cg.NAME="CCUILocal",Cg.BINDING=Wm.UBO_UI_LOCAL,Cg.DESCRIPTOR=new n_(Cg.BINDING,nc.DYNAMIC_UNIFORM_BUFFER,1,Xl.VERTEX),Cg.LAYOUT=new Fc(Ym.LOCAL,Cg.BINDING,Cg.NAME,[new Lc("cc_local_data",Rl.FLOAT4,1)],1),Hm.layouts[Cg.NAME]=Cg.LAYOUT,Hm.bindings[Cg.BINDING]=Cg.DESCRIPTOR;var Rg=function(){};Rg.SIZE=4*(Rg.COUNT=4+(Rg.SH_QUADRATIC_A_OFFSET=4+(Rg.SH_QUADRATIC_B_OFFSET=4+(Rg.SH_QUADRATIC_G_OFFSET=4+(Rg.SH_QUADRATIC_R_OFFSET=4+(Rg.SH_LINEAR_CONST_B_OFFSET=4+(Rg.SH_LINEAR_CONST_G_OFFSET=4+(Rg.SH_LINEAR_CONST_R_OFFSET=0)))))))),Rg.NAME="CCSH",Rg.BINDING=Wm.UBO_SH,Rg.DESCRIPTOR=new n_(Rg.BINDING,nc.UNIFORM_BUFFER,1,Xl.FRAGMENT),Rg.LAYOUT=new Fc(Ym.LOCAL,Rg.BINDING,Rg.NAME,[new Lc("cc_sh_linear_const_r",Rl.FLOAT4,1),new Lc("cc_sh_linear_const_g",Rl.FLOAT4,1),new Lc("cc_sh_linear_const_b",Rl.FLOAT4,1),new Lc("cc_sh_quadratic_r",Rl.FLOAT4,1),new Lc("cc_sh_quadratic_g",Rl.FLOAT4,1),new Lc("cc_sh_quadratic_b",Rl.FLOAT4,1),new Lc("cc_sh_quadratic_a",Rl.FLOAT4,1)],1),Hm.layouts[Rg.NAME]=Rg.LAYOUT,Hm.bindings[Rg.BINDING]=Rg.DESCRIPTOR;var wg=Wm.SAMPLER_JOINTS,Ig=new n_(wg,nc.SAMPLER_TEXTURE,1,Xl.VERTEX),Bg=new kc(Ym.LOCAL,wg,"cc_jointTexture",Rl.SAMPLER2D,1);Hm.layouts.cc_jointTexture=Bg,Hm.bindings[wg]=Ig;var Dg=Wm.SAMPLER_JOINTS,Pg=new n_(Dg,nc.SAMPLER_TEXTURE,1,Xl.VERTEX),Og=new kc(Ym.LOCAL,Dg,"cc_realtimeJoint",Rl.SAMPLER2D,1);Hm.layouts.cc_realtimeJoint=Og,Hm.bindings[Dg]=Pg;var Mg=Wm.SAMPLER_MORPH_POSITION,Ng=new n_(Mg,nc.SAMPLER_TEXTURE,1,Xl.VERTEX),Lg=new kc(Ym.LOCAL,Mg,"cc_PositionDisplacements",Rl.SAMPLER2D,1);Hm.layouts.cc_PositionDisplacements=Lg,Hm.bindings[Mg]=Ng;var Fg=Wm.SAMPLER_MORPH_NORMAL,kg=new n_(Fg,nc.SAMPLER_TEXTURE,1,Xl.VERTEX),Gg=new kc(Ym.LOCAL,Fg,"cc_NormalDisplacements",Rl.SAMPLER2D,1);Hm.layouts.cc_NormalDisplacements=Gg,Hm.bindings[Fg]=kg;var Vg=Wm.SAMPLER_MORPH_TANGENT,Ug=new n_(Vg,nc.SAMPLER_TEXTURE,1,Xl.VERTEX),zg=new kc(Ym.LOCAL,Vg,"cc_TangentDisplacements",Rl.SAMPLER2D,1);Hm.layouts.cc_TangentDisplacements=zg,Hm.bindings[Vg]=Ug;var Hg=Wm.SAMPLER_LIGHTMAP,Wg=new n_(Hg,nc.SAMPLER_TEXTURE,1,Xl.FRAGMENT),Xg=new kc(Ym.LOCAL,Hg,"cc_lightingMap",Rl.SAMPLER2D,1);Hm.layouts.cc_lightingMap=Xg,Hm.bindings[Hg]=Wg;var jg=Wm.SAMPLER_SPRITE,Yg=new n_(jg,nc.SAMPLER_TEXTURE,1,Xl.FRAGMENT),qg=new kc(Ym.LOCAL,jg,"cc_spriteTexture",Rl.SAMPLER2D,1);Hm.layouts.cc_spriteTexture=qg,Hm.bindings[jg]=Yg;var Kg=Wm.SAMPLER_REFLECTION,Jg=new n_(Kg,nc.SAMPLER_TEXTURE,1,Xl.FRAGMENT),Qg=new kc(Ym.LOCAL,Kg,"cc_reflectionTexture",Rl.SAMPLER2D,1);Hm.layouts.cc_reflectionTexture=Qg,Hm.bindings[Kg]=Jg;var Zg=Wm.STORAGE_REFLECTION,$g=new n_(Zg,nc.STORAGE_IMAGE,1,Xl.COMPUTE),ty=new Uc(Ym.LOCAL,Zg,"cc_reflectionStorage",Rl.IMAGE2D,1);Hm.layouts.cc_reflectionStorage=ty,Hm.bindings[Zg]=$g;var ey=Wm.SAMPLER_REFLECTION_PROBE_CUBE,iy=new n_(ey,nc.SAMPLER_TEXTURE,1,Xl.FRAGMENT),ny=new kc(Ym.LOCAL,ey,"cc_reflectionProbeCubemap",Rl.SAMPLER_CUBE,1);Hm.layouts.cc_reflectionProbeCubemap=ny,Hm.bindings[ey]=iy;var ry=Wm.SAMPLER_REFLECTION_PROBE_PLANAR,sy=new n_(ry,nc.SAMPLER_TEXTURE,1,Xl.FRAGMENT),ay=new kc(Ym.LOCAL,ry,"cc_reflectionProbePlanarMap",Rl.SAMPLER2D,1);Hm.layouts.cc_reflectionProbePlanarMap=ay,Hm.bindings[ry]=sy;var oy=Wm.SAMPLER_REFLECTION_PROBE_DATA_MAP,hy=new n_(oy,nc.SAMPLER_TEXTURE,1,Xl.FRAGMENT),uy=new kc(Ym.LOCAL,oy,"cc_reflectionProbeDataMap",Rl.SAMPLER2D,1);Hm.layouts.cc_reflectionProbeDataMap=uy,Hm.bindings[oy]=hy;var ly=Wm.SAMPLER_REFLECTION_PROBE_BLEND_CUBE,cy=new n_(ly,nc.SAMPLER_TEXTURE,1,Xl.FRAGMENT),_y=new kc(Ym.LOCAL,ly,"cc_reflectionProbeBlendCubemap",Rl.SAMPLER_CUBE,1);Hm.layouts.cc_reflectionProbeBlendCubemap=_y,Hm.bindings[ly]=cy;var fy,dy,py,my=kp.makeMaskExclude([kp.BitMask.UI_2D,kp.BitMask.GIZMOS,kp.BitMask.EDITOR,kp.BitMask.SCENE_GIZMO,kp.BitMask.PROFILER]),gy=kp.makeMaskExclude([kp.BitMask.UI_2D,kp.BitMask.PROFILER]),yy=kp.Enum.ALL;function vy(t){return(t.getFormatFeatures(xl.R32F)&(Nl.RENDER_TARGET|Nl.SAMPLED_TEXTURE))==(Nl.RENDER_TARGET|Nl.SAMPLED_TEXTURE)&&!(t.gfxAPI===Tl.WEBGL)}function Sy(t){return(t.getFormatFeatures(xl.RGBA16F)&(Nl.RENDER_TARGET|Nl.SAMPLED_TEXTURE))==(Nl.RENDER_TARGET|Nl.SAMPLED_TEXTURE)&&!(t.gfxAPI===Tl.WEBGL)}function Ay(){return!(!v.rendering||!v.rendering.enableEffectImport)}t("cK",Object.freeze({__proto__:null,PIPELINE_FLOW_MAIN:km,PIPELINE_FLOW_FORWARD:Gm,PIPELINE_FLOW_SHADOW:Vm,PIPELINE_FLOW_SMAA:"SMAAFlow",PIPELINE_FLOW_TONEMAP:"ToneMapFlow",get RenderPassStage(){return Lm},get RenderPriority(){return Fm},globalDescriptorSetLayout:zm,localDescriptorSetLayout:Hm,get PipelineGlobalBindings(){return Um},get ModelLocalBindings(){return Wm},get SetIndex(){return Ym},bindingMappingInfo:Qm,UBOGlobal:Zm,UBOCamera:$m,UBOShadow:tg,UBOCSM:eg,UNIFORM_SHADOWMAP_BINDING:ig,UNIFORM_ENVIRONMENT_BINDING:sg,UNIFORM_DIFFUSEMAP_BINDING:hg,UNIFORM_SPOT_SHADOW_MAP_TEXTURE_BINDING:cg,UBOLocal:dg,UBOWorldBound:pg,INST_MAT_WORLD:mg,INST_SH:gg,UBOLocalBatched:yg,UBOForwardLight:vg,UBODeferredLight:Sg,JOINT_UNIFORM_CAPACITY:30,UBOSkinningTexture:Ag,UBOSkinningAnimation:Tg,INST_JOINT_ANIM_INFO:"a_jointAnimInfo",UBOSkinning:Eg,localDescriptorSetLayout_ResizeMaxJoints:bg,UBOMorph:xg,UBOUILocal:Cg,UBOSH:Rg,UNIFORM_JOINT_TEXTURE_BINDING:wg,UNIFORM_REALTIME_JOINT_TEXTURE_BINDING:Dg,UNIFORM_POSITION_MORPH_TEXTURE_BINDING:Mg,UNIFORM_NORMAL_MORPH_TEXTURE_BINDING:Fg,UNIFORM_TANGENT_MORPH_TEXTURE_BINDING:Vg,UNIFORM_LIGHTMAP_TEXTURE_BINDING:Hg,UNIFORM_SPRITE_TEXTURE_BINDING:jg,UNIFORM_REFLECTION_TEXTURE_BINDING:Kg,UNIFORM_REFLECTION_STORAGE_BINDING:Zg,UNIFORM_REFLECTION_PROBE_CUBEMAP_BINDING:ey,UNIFORM_REFLECTION_PROBE_TEXTURE_BINDING:ry,UNIFORM_REFLECTION_PROBE_DATA_MAP_BINDING:oy,UNIFORM_REFLECTION_PROBE_BLEND_CUBEMAP_BINDING:ly,CAMERA_DEFAULT_MASK:my,CAMERA_EDITOR_MASK:gy,MODEL_ALWAYS_MASK:yy,supportsR16HalfFloatTexture:function(t){return(t.getFormatFeatures(xl.R16F)&(Nl.RENDER_TARGET|Nl.SAMPLED_TEXTURE))==(Nl.RENDER_TARGET|Nl.SAMPLED_TEXTURE)},supportsR32FloatTexture:vy,supportsRGBA16HalfFloatTexture:Sy,supportsRGBA32FloatTexture:function(t){return(t.getFormatFeatures(xl.RGBA32F)&(Nl.RENDER_TARGET|Nl.SAMPLED_TEXTURE))==(Nl.RENDER_TARGET|Nl.SAMPLED_TEXTURE)&&!(t.gfxAPI===Tl.WEBGL)},isEnableEffect:Ay}));var Ty=4227858432,Ey=66060288,by=1044480,xy=function(t,e,i,n){return void 0===n&&(n=0),e<<26&Ty|t<<20&Ey|i<<12&by|4095&n},Cy=function(t){return(t&Ty)>>>26},Ry=function(t){return(t&Ey)>>>20},wy=function(t){return(t&by)>>>12},Iy=function(t){return 4095&t},By=function(t,e){return 67108863&t|e<<26&Ty},Dy=((fy={})[Rl.UNKNOWN]=function(t,e,i){return void 0===i&&(i=0),q(12010,i)},fy[Rl.INT]=function(t,e,i){return void 0===i&&(i=0),t[i]},fy[Rl.INT2]=function(t,e,i){return void 0===i&&(i=0),yn.fromArray(e,t,i)},fy[Rl.INT3]=function(t,e,i){return void 0===i&&(i=0),Yi.fromArray(e,t,i)},fy[Rl.INT4]=function(t,e,i){return void 0===i&&(i=0),zi.fromArray(e,t,i)},fy[Rl.FLOAT]=function(t,e,i){return void 0===i&&(i=0),t[i]},fy[Rl.FLOAT2]=function(t,e,i){return void 0===i&&(i=0),yn.fromArray(e,t,i)},fy[Rl.FLOAT3]=function(t,e,i){return void 0===i&&(i=0),Yi.fromArray(e,t,i)},fy[Rl.FLOAT4]=function(t,e,i){return void 0===i&&(i=0),zi.fromArray(e,t,i)},fy[Rl.MAT3]=function(t,e,i){return void 0===i&&(i=0),en.fromArray(e,t,i)},fy[Rl.MAT4]=function(t,e,i){return void 0===i&&(i=0),fn.fromArray(e,t,i)},fy),Py=((dy={})[Rl.UNKNOWN]=function(t,e,i){return void 0===i&&(i=0),q(12010,i)},dy[Rl.INT]=function(t,e,i){return void 0===i&&(i=0),t[i]=e},dy[Rl.INT2]=function(t,e,i){return void 0===i&&(i=0),yn.toArray(t,e,i)},dy[Rl.INT3]=function(t,e,i){return void 0===i&&(i=0),Yi.toArray(t,e,i)},dy[Rl.INT4]=function(t,e,i){return void 0===i&&(i=0),zi.toArray(t,e,i)},dy[Rl.FLOAT]=function(t,e,i){return void 0===i&&(i=0),t[i]=e},dy[Rl.FLOAT2]=function(t,e,i){return void 0===i&&(i=0),yn.toArray(t,e,i)},dy[Rl.FLOAT3]=function(t,e,i){return void 0===i&&(i=0),Yi.toArray(t,e,i)},dy[Rl.FLOAT4]=function(t,e,i){return void 0===i&&(i=0),zi.toArray(t,e,i)},dy[Rl.MAT3]=function(t,e,i){return void 0===i&&(i=0),en.toArray(t,e,i)},dy[Rl.MAT4]=function(t,e,i){return void 0===i&&(i=0),fn.toArray(t,e,i)},dy),Oy=((py={})[Rl.INT]=function(t){return"number"==typeof t},py[Rl.FLOAT]=function(t){return"number"==typeof t},py[Rl.INT2]=function(t){return!!(t instanceof yn)},py[Rl.FLOAT2]=function(t){return!!(t instanceof yn)},py[Rl.INT3]=function(t){return!!(t instanceof Yi)},py[Rl.FLOAT3]=function(t){return!!(t instanceof Yi)},py[Rl.INT4]=function(t){return!!(t instanceof zi)},py[Rl.FLOAT4]=function(t){return!!(t instanceof zi||t instanceof Zi||t instanceof sn)},py[Rl.MAT3]=function(t){return!!(t instanceof en)},py[Rl.MAT4]=function(t){return!!(t instanceof fn)},py),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 Ny(t){switch(t){case Rl.BOOL:case Rl.INT:case Rl.UINT:case Rl.FLOAT:return My[0];case Rl.BOOL2:case Rl.INT2:case Rl.UINT2:case Rl.FLOAT2:return My[1];case Rl.BOOL4:case Rl.INT4:case Rl.UINT4:case Rl.FLOAT4:return My[2];case Rl.MAT4:return My[3];case Rl.SAMPLER2D:return"default-texture";case Rl.SAMPLER_CUBE:return"default-cube-texture";case Rl.SAMPLER2D_ARRAY:return"default-array-texture";case Rl.SAMPLER3D:return"default-3d-texture"}return My[0]}function Ly(t){switch(t){case Rl.SAMPLER2D:return"-texture";case Rl.SAMPLER_CUBE:return"-cube-texture";case Rl.SAMPLER2D_ARRAY:return"-array-texture";case Rl.SAMPLER3D:return"-3d-texture";default:return"-unknown"}}function Fy(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 ky(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 Gy(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 Vy=new Map;function Uy(t,e){if(e.count)return t+b_(e.type)*e.count;var i=Vy.get(e.name);return void 0!==i?t+b_(e.type)*i:(console.error("uniform '"+e.name+"' must have a count"),t)}function zy(t){return Math.ceil(Math.log2(Math.max(t,2)))}Vy.set("cc_joints",Eg.LAYOUT.members[0].count),Vy.set("cc_lightPos",vg.LIGHTS_PER_PASS),Vy.set("cc_lightColor",vg.LIGHTS_PER_PASS),Vy.set("cc_lightSizeRangeAngle",vg.LIGHTS_PER_PASS),Vy.set("cc_lightDir",vg.LIGHTS_PER_PASS),Vy.set("cc_lightBoundingSizeVS",vg.LIGHTS_PER_PASS);var Hy=new r_;function Wy(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&g_))return console.warn("builtin UBO '"+t.name+"' not available!"),"continue";a.push(e),r&&!r.includes(n)&&r.push(n)},h=0;h<s.blocks.length;h++)o();Array.prototype.unshift.apply(e.shaderInfo.blocks,a);for(var u=[],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&y_))return console.warn("builtin samplerTexture '"+t.name+"' not available!"),"continue";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 Xy(t){switch(t.gfxAPI){case Tl.GLES2:case Tl.WEBGL:return"glsl1";case Tl.GLES3:case Tl.WEBGL2:return"glsl3";default:return"glsl4"}}var jy,Yy,qy,Ky,Jy,Qy,Zy,$y=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=zy(s[1]-s[0]+1),i._map=function(t){return t-s[0]}}else"string"===i.type?(r=zy(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 jc,n.blockSizes=[],n.bindings=[];for(var s=0;s<i.blocks.length;s++){var a=i.blocks[s];n.blockSizes.push(a.members.reduce(Uy,0)),n.bindings.push(new n_(a.binding,nc.UNIFORM_BUFFER,1,a.stageFlags)),n.shaderInfo.blocks.push(new Fc(Ym.MATERIAL,a.binding,a.name,a.members.map((function(t){return new Lc(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 n_(h.binding,nc.SAMPLER_TEXTURE,h.count,h.stageFlags)),n.shaderInfo.samplerTextures.push(new kc(Ym.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 n_(l.binding,nc.SAMPLER,l.count,l.stageFlags)),n.shaderInfo.samplers.push(new Gc(Ym.MATERIAL,l.binding,l.name,l.count))}for(var c=0;c<i.textures.length;c++){var _=i.textures[c];n.bindings.push(new n_(_.binding,nc.TEXTURE,_.count,_.stageFlags)),n.shaderInfo.textures.push(new Vc(Ym.MATERIAL,_.binding,_.name,_.type,_.count))}for(var f=0;f<i.buffers.length;f++){var d=i.buffers[f];n.bindings.push(new n_(d.binding,nc.STORAGE_BUFFER,1,d.stageFlags)),n.shaderInfo.buffers.push(new zc(Ym.MATERIAL,d.binding,d.name,1,d.memoryAccess))}for(var p=0;p<i.images.length;p++){var m=i.images[p];n.bindings.push(new n_(m.binding,nc.STORAGE_IMAGE,m.count,m.stageFlags)),n.shaderInfo.images.push(new Uc(Ym.MATERIAL,m.binding,m.name,m.type,m.count,m.memoryAccess))}for(var g=0;g<i.subpassInputs.length;g++){var y=i.subpassInputs[g];n.bindings.push(new n_(y.binding,nc.INPUT_ATTACHMENT,y.count,y.stageFlags)),n.shaderInfo.subpassInputs.push(new Hc(Ym.MATERIAL,y.binding,y.name,y.count))}n.gfxAttributes=[];for(var v=0;v<i.attributes.length;v++){var S=i.attributes[v];n.gfxAttributes.push(new Xc(S.name,S.format,S.isNormalized,0,S.isInstanced,S.location))}Wy(i,n,Hm,"locals"),n.shaderInfo.stages.push(new Wc(Xl.VERTEX,"")),n.shaderInfo.stages.push(new Wc(Xl.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]=xy(n.binding,o.type,o.count,s),s+=(b_(o.type)>>2)*o.count}for(var h=0;h<t.samplerTextures.length;h++){var u=t.samplerTextures[h];e[u.name]=xy(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||(Hy.bindings=r.bindings,r.setLayouts[Ym.MATERIAL]=t.createDescriptorSetLayout(Hy),Hy.bindings=Hm.bindings,r.setLayouts[Ym.LOCAL]=t.createDescriptorSetLayout(Hy)),r.setLayouts[i?Ym.LOCAL:Ym.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];U("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),Wy(a,o,zm,"globals"),o.setLayouts[Ym.GLOBAL]=n.descriptorSetLayout,o.pipelineLayout=t.createPipelineLayout(new a_(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=ky(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=Xy(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++)Gy(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=$y;var tv=["planar-shadow","skybox","deferred-lighting","bloom","hbao","copy-pass","post-process","profiler","splash-screen","unlit","sprite","particle","particle-gpu","particle-trail","billboard","terrain","graphics","clear-stencil","spine","occlusion-query","geometry-renderer","debug-renderer","ssss-blur","tone-mapping"],ev=t("dT",Is("cc.EffectAsset")(((Zy=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).techniques=qy&&qy(),e.shaders=Ky&&Ky(),e.combinations=Jy&&Jy(),e.hideInEditor=Qy&&Qy(),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 tv.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(){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),v.rendering.programLib.addEffect(this)):$y.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(of.gfxDevice,this);else for(var e=v.director.root,i=function(){var i=t.shaders[n],s=t.combinations[n];if(!s)return"continue";(function(t){return Object.keys(t).reduce((function(e,i){return e.reduce((function(e,n){for(var s=t[i],a=0;a<s.length;++a){var o=r({},n);o[i]=s[a],e.push(o)}return e}),[])}),[{}])})(s).forEach((function(t){return $y.getGFXShader(of.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}(zf))._effects={},Zy._layoutValid=!0,qy=Ss((Yy=Zy).prototype,"techniques",[ks],(function(){return[]})),Ky=Ss(Yy.prototype,"shaders",[ks],(function(){return[]})),Jy=Ss(Yy.prototype,"combinations",[ks],(function(){return[]})),Qy=Ss(Yy.prototype,"hideInEditor",[ks,Vs],(function(){return!1})),jy=Yy))||jy);v.EffectAsset=ev;var iv=function(){function t(){this.name="",this.base="",this.importBase="",this.nativeBase="",this.deps=null,this.assetInfos=new cf,this.scenes=new cf,this.paths=new cf}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]=If(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,f=e.length;_<f;_++){var d=e[_];e[_]=c[d]=If(d)}e=c}for(var p in i){var m=i[p];s[e[p]]=m}var g=t.scenes;for(var y in g){var v=g[y];g[y]=e[v]}var S=t.packs;for(var A in S)for(var T=S[A],E=0;E<T.length;++E)T[E]=e[T[E]];var b=t.versions;if(b)for(var x in b)for(var C=b[x],R=0;R<C.length;R+=2){var w=C[R];C[R]=e[w]||w}var I=t.redirect;if(I)for(var B=0;B<I.length;B+=2)I[B]=e[I[B]],I[B+1]=r[I[B+1]];if(t.extensionMap){var D=function(i){if(!Object.prototype.hasOwnProperty.call(t.extensionMap,i))return"continue";t.extensionMap[i].forEach((function(n,r){t.extensionMap[i][r]=e[n]||n}))};for(var P in t.extensionMap)D(P)}}(t),this.importBase=t.importBase||"",this.nativeBase=t.nativeBase||"",this.base=t.base||"",this.name=t.name||"",this.deps=t.deps||[],this._initUuid(t.uuids),this._initPath(t.paths),this._initScene(t.scenes),this._initPackage(t.packs),this._initVersion(t.versions),this._initRedirect(t.redirect);var i=function(i){if(!Object.prototype.hasOwnProperty.call(t.extensionMap,i))return"continue";t.extensionMap[i].forEach((function(t){var n=e.assetInfos.get(t);n&&(n.extension=i)}))};for(var n in t.extensionMap)i(n)},e.getInfoWithPath=function(t,e){if(!t)return null;t=Mf(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(zt(s.ctor,e))return s}}return null},e.getDirWithPath=function(t,e,i){"/"===(t=Mf(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&&!zt(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=$t(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 nv(t,e){t._uuid&&e.push(t._uuid)}function rv(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 zf&&nv(o,e)}else if(s.constructor&&s.constructor!==Object)s instanceof zf&&nv(s,e);else for(var h=Object.getOwnPropertyNames(s),u=0;u<h.length;u++){var l=s[h[u]];l instanceof zf&&nv(l,e)}}}}function sv(t,e){for(var i=0;i<t._components.length;i++)rv(t._components[i],e);for(var n=0;n<t._children.length;n++)sv(t._children[n],e)}function av(t,e,i,n){i.push(t._uuid);for(var r=xp.getDeps(t._uuid),s=0,a=r.length;s<a;s++){var o=df.get(r[s]);if(o){var h=o._uuid;h in e?e[h]+=n:e[h]=o.refCount+n,i.includes(h)||av(o,e,i,n)}}}var ov=[],hv=new(function(){function t(){this._persistNodeDeps=new cf,this._toDelete=new cf,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=[];sv(t,e);for(var i=0,n=e.length;i<n;i++){var r=df.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=df.get(e[i]);r&&r.decRef()}this._persistNodeDeps.remove(t.uuid)}},e._autoRelease=function(t,e,i){if(t){for(var n=xp.getDeps(t.uuid),r=0,s=n.length;r<s;r++){var a=df.get(n[r]);a&&a.decRef(t.autoReleaseAssets)}var o=xp._depends.get(t.uuid);if(o&&o.persistDeps)for(var h=o.persistDeps,u=0,l=h.length;u<l;u++){var c=df.get(h[u]);c&&c.decRef(t.autoReleaseAssets)}t.uuid!==e.uuid&&xp.remove(t.uuid)}var _=xp._depends.get(e.uuid);for(var d in _&&(_.persistDeps=[]),i){for(var p,m,g=i[d],y=this._persistNodeDeps.get(g.uuid),v=f(y);!(m=v()).done;){var S=m.value,A=df.get(S);A&&A.addRef()}_&&(p=_.persistDeps).push.apply(p,y)}},e.tryRelease=function(t,e){void 0===e&&(e=!1),t instanceof zf&&(e?this._free(t,e):(this._toDelete.add(t._uuid,t),this._eventListener||(this._eventListener=!0,Me(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),Ca(t,!0)&&-1===this._dontDestroyAssets.indexOf(i)&&!(!e&&t.refCount>0&&function(t){var e=Object.create(null);if(e[t._uuid]=t.refCount,av(t,e,ov,-1),ov.length=0,0!==e[t._uuid])return e[t._uuid];for(var i in e)0!==e[i]&&av(df.get(i),e,ov,1);return ov.length=0,e[t._uuid]}(t)>0)){df.remove(i);for(var n=xp.getDeps(i),r=0,s=n.length;r<s;r++){var a=df.get(n[r]);a&&(a.decRef(!1),this._free(a,!1))}t.destroy(),xp.remove(i)}},t}()),uv=null;function lv(t,e){for(var i=0,n=t.input.length;i<n;i++){var r=t.input[i];e&&!r.isNative&&r.content instanceof zf&&r.content.decRef(!1),r.recycle()}t.input=null}function cv(t,e){return e?/\?/.test(t)?t+"&_t="+Date.now():t+"?_t="+Date.now():t}function _v(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(){_v(t,e,i,n,r)}),i)}))}function fv(t,e,i,n,s){try{for(var a=xp.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 dv(t,e,i){e&&(i=void 0!==i?i:v.assetManager.cacheAsset,Of(e)||!i||e.isDefault||df.add(t,e))}function pv(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 mv(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 gv(t,e,i){var n=t,r=e,s=i;if(void 0===i){var a=zt(t,zf);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||uv,onComplete:s}}function yv(t,e,i,n){if(void 0===n&&(n={}),!i[e]||n[e])return!1;n[e]=!0;var r=!1,s=xp.getDeps(e);if(s)for(var a=0,o=s.length;a<o;a++){var h=s[a];if(h===t||yv(t,h,i,n)){r=!0;break}}return r}function vv(t){return function(e,i){if(t){var n=[];Array.isArray(i)?i.forEach((function(t){return t instanceof zf&&n.push(t.addRef())})):i instanceof zf&&n.push(i.addRef()),Me((function(){n.forEach((function(t){return t.decRef(!1)})),t(e,i)}))}}}var Sv=function(){function t(){this._config=new iv}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),gf.add(t.name,this)},e.load=function(t,e,i,n){var r=gv(e,i,n),s=r.type,a=r.onProgress,o=r.onComplete,h={__requestType__:ff.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=gv(e,i,n),s=r.type,a=r.onProgress,o=r.onComplete;v.assetManager.preloadAny(t,{__requestType__:ff.PATH,type:s,bundle:this.name},a,o)},e.loadDir=function(t,e,i,n){var r=gv(e,i,n),s=r.type,a=r.onProgress,o=r.onComplete;v.assetManager.loadAny(t,{__requestType__:ff.DIR,type:s,bundle:this.name,__outputAsArray__:!0},a,o)},e.preloadDir=function(t,e,i,n){var r=gv(e,i,n),s=r.type,a=r.onProgress,o=r.onComplete;v.assetManager.preloadAny(t,{__requestType__:ff.DIR,type:s,bundle:this.name},a,o)},e.loadScene=function(t,e,i,n){var r=mv(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=mv(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&&J(1210,t,e.message),o&&o(e)}))},e.get=function(t,e){var i=this.getInfoWithPath(t,e);return i&&df.get(i.uuid)||null},e.release=function(t,e){var i=this.get(t,e);i&&hv.tryRelease(i,!0)},e.releaseUnusedAssets=function(){var t=this;df.forEach((function(e){var i=t.getAssetInfo(e._uuid);i&&!i.redirect&&hv.tryRelease(e)}))},e.releaseAll=function(){var t=this;df.forEach((function(e){var i=t.getAssetInfo(e._uuid);i&&!i.redirect&&hv.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}(),Av=t("d$",new Sv);function Tv(t,e,i){var n=new A.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(tt(4930,t)))}return"file:"!==A.location.protocol&&(n.crossOrigin="anonymous"),n.addEventListener("load",r),n.addEventListener("error",s),n.src=t,n}function Ev(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=Av;var bv=A.document,xv={};function Cv(t,e,i){if(xv[t])return i&&i(null),null;var n=bv.createElement("script");function r(){n.parentNode.removeChild(n),n.removeEventListener("load",r,!1),n.removeEventListener("error",s,!1),xv[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(tt(4928,t)))}return"file:"!==A.location.protocol&&(n.crossOrigin="anonymous"),n.async=e.scriptAsyncLoading||!1,n.src=t,n.addEventListener("load",r,!1),n.addEventListener("error",s,!1),bv.body.appendChild(n),n}var Rv=/^(?:\w+:\/\/|\.+\/).+/,wv=function(t,e,i){(ul.hasFeature(ul.Feature.IMAGE_BITMAP)&&v.assetManager.allowImageBitmap?Iv:Tv)(t,e,i)},Iv=function(t,e,i){e.xhrResponseType="blob",Ev(t,e,e.onFileProgress,i)},Bv=function(t,e,i){e.xhrResponseType="json",Ev(t,e,e.onFileProgress,i)},Dv=function(t,e,i){e.xhrResponseType="arraybuffer",Ev(t,e,e.onFileProgress,i)},Pv=function(t,e,i){Bv(t,e,(function(e,n){if(e)i(e);else{var r=Xd(n);Promise.all(r.chunks.map((function(i){return new Promise((function(n,r){Dv(""+Xu(t)+i,{},(function(t,i){e?r(e):n(new Uint8Array(i))}))}))}))).then((function(t){var e=new Wd(r.document,t);i(null,e)})).catch((function(t){i(t)}))}}))},Ov=function(t,e,i){Dv(t,e,(function(t,e){if(t)i(t);else try{var n=jd(new Uint8Array(e));i(null,n)}catch(t){i(t)}}))},Mv=function(t,e,i){e.xhrResponseType="text",Ev(t,e,e.onFileProgress,i)},Nv=function(t,e,i){var n=ju(t),r=t;Rv.test(r)||(r=-1!==Hv.remoteBundles.indexOf(n)?Hv.remoteServerAddress+"remote/"+n:"assets/"+n);var s=e.version||Hv.bundleVers[n],a=0,o=null,h=null;Bv(r+"/config."+(s?s+".":"")+"json",e,(function(t,e){h=t||h,(o=e)&&(o.base=r+"/"),2==++a&&i(h,o)})),Cv(r+"/index."+(s?s+".":"")+"js",e,(function(t){h=t||h,2==++a&&i(h,o)}))},Lv=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=Tv,this.downloadDomAudio=null,this.downloadFile=Ev,this.downloadScript=Cv,this._downloaders={".png":wv,".jpg":wv,".bmp":wv,".jpeg":wv,".gif":wv,".ico":wv,".tiff":wv,".webp":wv,".image":wv,".pvr":Dv,".pkm":Dv,".astc":Dv,".txt":Mv,".xml":Mv,".vsh":Mv,".fsh":Mv,".atlas":Mv,".tmx":Mv,".tsx":Mv,".json":Bv,".ExportJson":Bv,".plist":Mv,".ccon":Pv,".cconb":Ov,".fnt":Mv,".binary":Dv,".bin":Dv,".dbbin":Dv,".skel":Dv,".js":Cv,bundle:Nv,default:Mv},this._downloading=new cf,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?Gt(this._downloaders,t):this._downloaders[t]=e},t.download=function(t,e,i,n,r){var s=this,a=pf.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,f=this._downloaders[i]||this._downloaders.default;_v((function(i,a){if(0===i&&s._downloading.add(t,[r]),s.limited){s._updateTime();var o=function(t,e){s._totalNum--,s._handleQueueInNextFrame(c,_),a(t,e)};s._totalNum<c&&s._totalNumThisPeriod<_?(f(cv(e,s.appendTimeStamp),n,o),s._totalNum++,s._totalNumThisPeriod++):(s._queue.push({id:t,priority:n.priority||0,url:e,options:n,done:o,handler:f}),s._queueDirty=!0,s._totalNum<c&&s._handleQueueInNextFrame(c,_))}else f(cv(e,s.appendTimeStamp),n,a)}),l,this.retryInterval,(function(e,i){e||pf.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(cv(i.url,this.appendTimeStamp),i.options,i.done)}this._handleQueueInNextFrame(t,e)},t._handleQueueInNextFrame=function(t,e){!this._checkNextPeriod&&this._queue.length>0&&(Me(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}();Lv._instance=void 0;var Fv,kv,Gv,Vv,Uv,zv,Hv=Lv.instance,Wv=Lv.instance,Xv=t("dP",Is("cc.JsonAsset")((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).json=Gv&&Gv(),e}return s(e,t),e}(zf),Gv=Ss(kv.prototype,"json",[ks],(function(){return null})),Fv=kv))||Fv);v.JsonAsset=Xv;var jv,Yv,qv=t("dO",Is("cc.TextAsset")((Uv=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).text=zv&&zv(),e}return s(e,t),e.prototype.toString=function(){return this.text},e}(zf),zv=Ss(Uv.prototype,"text",[ks],(function(){return""})),Vv=Uv))||Vv);v.TextAsset=qv;var Kv=t("dL",Is("cc.BufferAsset")((p((Yv=function(t){function e(){for(var e,i=arguments.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}(zf)).prototype,"_nativeAsset",[ua],Object.getOwnPropertyDescriptor(Yv.prototype,"_nativeAsset"),Yv.prototype),jv=Yv))||jv);function Jv(t,e,i,n){var r=null,s=null;try{(r=new ld)._nativeUrl=t,r._nativeAsset=e}catch(t){s=t}n(s,r)}function Qv(t,e,i,n){var r=new Xv;r.json=e,n(null,r)}function Zv(t,e,i,n){var r=new qv;r.text=e,n(null,r)}function $v(t,e,i,n){var r=new Kv;r._nativeUrl=t,r._nativeAsset=e,n(null,r)}function tS(t,e,i,n){var r=new zf;r._nativeUrl=t,r._nativeAsset=e,n(null,r)}function eS(t,i,n,r){var s=gf.get(i.name);s||(s=i.name===Tf.RESOURCES?Av:new Sv,i.base=i.base||t+"/",s.init(i)),e.import("virtual:///prerequisite-imports/"+s.name).then((function(){r(null,s)})).catch(r)}v.BufferAsset=Kv;var iS=new(function(){function t(){this._creating=new cf,this._producers={".png":Jv,".jpg":Jv,".bmp":Jv,".jpeg":Jv,".gif":Jv,".ico":Jv,".tiff":Jv,".webp":Jv,".image":Jv,".pvr":Jv,".pkm":Jv,".txt":Zv,".xml":Zv,".vsh":Zv,".fsh":Zv,".atlas":Zv,".tmx":Zv,".tsx":Zv,".fnt":Zv,".json":Qv,".ExportJson":Qv,".binary":$v,".bin":$v,".dbbin":$v,".skel":$v,bundle:eS,default:tS}}var e=t.prototype;return e.register=function(t,e){"object"==typeof t?Gt(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=df.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 zf&&(i._uuid=t,dv(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}()),nS=new(function(){function t(){this._loading=new cf,this._unpackers={".json":this.unpackJson}}var e=t.prototype;return e.unpackJson=function(t,e,i,n){var r=wt(!0),s=null;if(Array.isArray(e)){(e=function(t){if(t[0]<1)throw new Error(tt(5304,t[0]));dp(t,!0,void 0,mp.reportMissingClass),pp(t);for(var e=new gp(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&&J(4915);for(var a=0;a<t.length;a++)r[t[a]+"@import"]=e[a]}else{var o=ie(Mp),h=ie(ld);if(e.type===o&&e.data){var u=e.data;u.length!==t.length&&J(4915);for(var l=0;l<t.length;l++)r[t[l]+"@import"]=yp(o,{base:u[l][0],mipmaps:u[l][1]})}else if(e.type===h&&e.data){var c=e.data;c.length!==t.length&&J(4915);for(var _=0;_<t.length;_++)r[t[_]+"@import"]=c[_]}else s=new Error("unmatched type pack!"),r=null}n(s,r)},e.init=function(){this._loading.clear()},e.register=function(t,e){"object"==typeof t?Gt(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(pf.has(t.id))i(null,pf.get(t.id));else{var r=t.info.packs,s=r.find((function(t){return n._loading.has(t.uuid)}));if(s)this._loading.get(s.uuid).push({onComplete:i,id:t.id});else{s=r[0],this._loading.add(s.uuid,[{onComplete:i,id:t.id}]);var a=Nf(s.uuid,{ext:s.ext,bundle:t.config.name});Wv.download(s.uuid,a,s.ext,t.options,(function(e,i){pf.remove(s.uuid),e&&G(e.message,e.stack),n.unpack(s.packedUuids,i,s.ext,t.options,(function(t,i){if(!t)for(var r in i)pf.add(r,i[r]);for(var a=n._loading.remove(s.uuid),o=0,h=a.length;o<h;o++){var u=a[o];if(e||t)u.onComplete(e||t);else{var l=i[u.id];l?u.onComplete(null,l):u.onComplete(new Error("can not retrieve data from package"))}}}))}))}}else Wv.download(t.id,t.url,t.ext,t.options,i)},t}());function rS(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=[],pv(t.input,(function(n,h){if(!n.isNative&&df.has(n.uuid)){var u=df.get(n.uuid);return n.content=u.addRef(),t.output.push(n),r.canInvoke&&t.dispatch("progress",++r.finish,r.total,n),void h()}nS.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,fv(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 lv(t,!0),void t.dispatch("error");if(s.length>0){var a=bf.create({input:s,progress:r,options:n,onProgress:t.onProgress,onError:bf.prototype.recycle,onComplete:function(n){var r;n||((r=t.output).push.apply(r,a.output),a.recycle()),i&&sS(t),e(n)}});vf.async(a)}else i&&sS(t),e()}))}function sS(t){for(var e=t.output,i=0,n=e.length;i<n;i++)e[i].content&&e[i].content.decRef(!1)}var aS=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}(),oS=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}(aS)),hS=function(){function t(){this._parsing=new cf,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=ld.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=ld.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=ld.parseCompressedTextures(t,2)}catch(t){n=t,console.warn(n)}i(n,r)},e.parsePlist=function(t,e,i){var n=null,r=oS.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=Tp(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?Gt(this._parsers,t):this._parsers[t]=e},e.parse=function(t,e,i,n,r){var s=this,a=mf.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?pf.remove(t):Of(i)||mf.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}();hS._instance=void 0;var uS=hS.instance;function lS(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=[],pv(t.input,(function(s,a){var o=bf.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)}});cS.async(o)}),(function(){if(n.__exclude__=null,t.isFinished)return lv(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),lv(t,!0),e()}))}var cS=new _f("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&&df.has(s)?e():nS.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)uS.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),pf.remove(s),mf.remove(s),e())}));else{var h=i.uuid;if(h in r){var u=r[h],l=u.finish,c=u.content,_=u.err,d=u.callbacks;n.canInvoke&&t.dispatch("progress",++n.finish,n.total,i),l||yv(h,h,r)?(c&&c.addRef(),i.content=c,e(_)):d.push({done:e,item:i})}else if(!o.reloadAsset&&df.has(h)){var p=df.get(h);i.content=p.addRef(),n.canInvoke&&t.dispatch("progress",++n.finish,n.total,i),e()}else o.__uuid__=h,uS.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(),fv(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}]},d=bf.create({input:c,options:t.options,onProgress:t.onProgress,onError:bf.prototype.recycle,progress:r,onComplete:function(t){if(e.decRef&&e.decRef(!1),_.finish=!0,_.err=t,!t){for(var i,n=Array.isArray(d.output)?d.output:[d.output],r=Object.create(null),s=f(n);!(i=s()).done;){var h=i.value;h&&(r[h instanceof zf?h._uuid+"@import":a+"@native"]=h)}!function(t,e,i){var n=vp.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!==zf){var h=new a.type;h.initDefault(a.uuid),a.owner[a.prop]=h}!0}}vp.delete(e)}Sp.has(e)&&(i[t+"@native"]?e._nativeAsset=i[t+"@native"]:(!0,console.error("the native asset of "+t+" is missing!")),Sp.delete(e))}(a,e,r);try{"function"!=typeof e.onLoaded||Ap.has(e)||Sp.has(e)||(e.onLoaded(),Ap.add(e))}catch(t){G("The asset "+a+" is invalid for some reason, detail message: "+t.message+", stack: "+t.stack)}pf.remove(o),mf.remove(o),dv(a,e,l),d.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}});yf.async(d)}(t,n,e)}))}}]);function _S(t,e){var i=t.options,n=Object.create(null),r=Object.create(null);for(var s in i)switch(s){case ff.PATH:case ff.UUID:case ff.DIR:case ff.SCENE:case ff.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=bf.create({input:t.input,options:n}),o=null;try{t.output=t.source=Sf.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 fS=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}();fS.MAX_DEAD_NUM=500,fS._deadPool=[];var dS=[];function pS(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=fS.create(),a=null,o=null;if("string"==typeof n&&((n=Object.create(null))[e.__requestType__||ff.UUID]=i[r]),"object"==typeof n){kt(n,e),n.preset&&kt(n,Ef[n.preset]);var h=function(){var t;switch(u){case ff.UUID:var e,r=s.uuid=If(n.uuid);if(!n.bundle){var h=gf.find((function(t){return!!t.getAssetInfo(r)}));n.bundle=h&&h.name}if(gf.has(n.bundle)){if(a=gf.get(n.bundle).config,(o=a.getAssetInfo(r))&&o.redirect){if(!gf.has(o.redirect))throw new Error("Please load bundle "+o.redirect+" first");a=gf.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 ff.DIR:if(gf.has(n.bundle)){gf.get(n.bundle).config.getDirWithPath(n.dir,n.type,dS);for(var l,c=f(dS);!(l=c()).done;){var _=l.value;i.push({uuid:_.uuid,__isNative__:!1,ext:_.extension||".json",bundle:n.bundle})}dS.length=0}s.recycle(),s=null;break;case ff.PATH:if(gf.has(n.bundle)){if(a=gf.get(n.bundle).config,(o=a.getInfoWithPath(n.path,n.type))&&o.redirect){if(!gf.has(o.redirect))throw new Error("you need to load bundle "+o.redirect+" first");a=gf.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 ff.SCENE:if(!n.bundle){var d=gf.find((function(t){return!!t.getSceneInfo(n.scene)}));n.bundle=d&&d.name}if(gf.has(n.bundle)){if(a=gf.get(n.bundle).config,(o=a.getSceneInfo(n.scene))&&o.redirect){if(!gf.has(o.redirect))throw new Error("you need to load bundle "+o.redirect+" first");a=gf.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 ff.URL:s.url=n.url,s.uuid=n.uuid||n.url,s.ext=n.ext||Wu(n.url),s.isNative=void 0===n.__isNative__||n.__isNative__;break;default:s.options[u]=n[u]}if(!s)return"break"};for(var u in n)if("break"===h())break}if(!s)return"continue";if(t.output.push(s),!s.uuid&&!s.url)throw new Error("Can not parse this input:"+JSON.stringify(n))},r=0;r<i.length;r++)n();return null}function mS(t){for(var e=t.output=t.input,i=function(){var t=e[n];if(Af.has(t.uuid)){var i=Af.get(t.uuid),r=gf.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(!gf.has(o.redirect))throw new Error("Please load bundle "+o.redirect+" first");o=(a=gf.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 gS(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 yS="asset-missing",vS=t("d_",function(){function t(){this.pipeline=yf.append(_S).append(lS),this.fetchPipeline=vf.append(_S).append(rS),this.transformPipeline=Sf.append(pS).append(mS).append(gS),this.bundles=gf,this.assets=df,this.assetsOverrideMap=Af,this.generalImportBase="",this.generalNativeBase="",this.dependUtil=xp,this.force=false,this.allowImageBitmap=!ul.isMobile,this.utils=Gf,this.downloader=Wv,this.parser=uS,this.packManager=nS,this.cacheAsset=!0,this.cacheManager=null,this.presets=Ef,this.factory=iS,this.preprocessPipe=_S,this.fetchPipe=rS,this.loadPipe=lS,this.references=null,this._releaseManager=hv,this._files=pf,this._parsed=mf,this._parsePipeline=null,this._projectBundles=[],this._eventTarget=new Du}var e=t.prototype;return e.onAssetMissing=function(t,e){this._eventTarget.on(yS,t,e)},e.offAssetMissing=function(t,e){this._eventTarget.off(yS,t,e)},e.dispatchAssetMissing=function(t,e,i,n){this._eventTarget.emit(yS,t,e,i,n)},e.init=function(t){void 0===t&&(t={});var e=t.server||Ee.querySettings(Te.Category.ASSETS,"server")||"",i=t.bundleVers||Ee.querySettings(Te.Category.ASSETS,"bundleVers")||{},n=t.remoteBundles||Ee.querySettings(Te.Category.ASSETS,"remoteBundles")||[];this._files.clear(),this._parsed.clear(),this._releaseManager.init(),this.assets.clear(),this.bundles.clear(),this.packManager.init(),this.downloader.init(e,i,n),this.parser.init(),this.dependUtil.init();var r=t.importBase||Ee.querySettings(Te.Category.ASSETS,"importBase")||"";r&&r.endsWith("/")&&(r=r.substr(0,r.length-1));var s=t.nativeBase||Ee.querySettings(Te.Category.ASSETS,"nativeBase")||"";s&&s.endsWith("/")&&(s=s.substr(0,s.length-1)),this.generalImportBase=r,this.generalNativeBase=s,this._projectBundles=Ee.querySettings(Te.Category.ASSETS,"projectBundles")||[];var a=Ee.querySettings(Te.Category.ASSETS,"assetsOverrides")||{};for(var o in a)this.assetsOverrideMap.set(o,a[o])},e.getBundle=function(t){return gf.get(t)||null},e.removeBundle=function(t){t._destroy(),gf.remove(t.name)},e.loadAny=function(t,e,i,n){var r=mv(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=bf.create({input:t,onProgress:a,onComplete:vv(o),options:s});yf.async(h)},e.preloadAny=function(t,e,i,n){var r=mv(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=bf.create({input:t,onProgress:a,onComplete:vv(o),options:s});vf.async(h)},e.loadRemote=function(t,e,i){var n=mv(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)):iS.create(t,i,r.ext||Wu(t),r,(function(t,e){s&&s(t,e)}))}))):vv(s)(null,this.assets.get(t))},e.loadBundle=function(t,e,i){var n=mv(e,void 0,i),r=n.options,s=n.onComplete,a=ju(t);this.bundles.has(a)?vv(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)):iS.create(t,i,"bundle",r,(function(t,e){s&&s(t,e)}))})))},e.releaseAsset=function(t){hv.tryRelease(t,!0)},e.releaseUnusedAssets=function(){df.forEach((function(t){hv.tryRelease(t)}))},e.releaseAll=function(){df.forEach((function(t){hv.tryRelease(t,!0)}))},e.loadWithJson=function(){throw new Error("Only valid in Editor")},n(t,[{key:"main",get:function(){return gf.get(Tf.MAIN)||null}},{key:"resources",get:function(){return gf.get(Tf.RESOURCES)||null}}],[{key:"instance",get:function(){return this._instance||(this._instance=new t),this._instance}}]),t}());vS._instance=void 0,vS.Pipeline=_f,vS.Task=bf,vS.Cache=cf,vS.RequestItem=fS,vS.Bundle=Sv,vS.BuiltinBundleName=Tf,vS.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},vS.Downloader=Lv,vS.Parser=hS,vS.DependUtil=Ep;var SS=t("dZ",v.assetManager=vS.instance);v.AssetManager=vS;var AS,TS,ES,bS=t("e4",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 f=0;f<8;f++)h[a]=85,h[a+1]=85,h[a+2]=85,h[a+3]=255,a+=4;a+=32}var d={width:2,height:2,_data:e,_compressed:!1,format:Mp.PixelFormat.RGBA8888},p={width:2,height:2,_data:i,_compressed:!1,format:Mp.PixelFormat.RGBA8888},m={width:2,height:2,_data:n,_compressed:!1,format:Mp.PixelFormat.RGBA8888},g={width:2,height:2,_data:r,_compressed:!1,format:Mp.PixelFormat.RGBA8888},y={width:2,height:2,_data:s,_compressed:!1,format:Mp.PixelFormat.RGBA8888},S={width:16,height:16,_data:h,_compressed:!1,format:Mp.PixelFormat.RGBA8888},A=new ld(d),T=new Mp;T._uuid="black-texture",T.image=A,t[T._uuid]=T;var E=new ld(p),b=new Mp;b._uuid="empty-texture",b.image=E,t[b._uuid]=b;var x=new Om;x._uuid="black-cube-texture",x.setMipFilter(Om.Filter.NEAREST),x.image={front:new ld(d),back:new ld(d),left:new ld(d),right:new ld(d),top:new ld(d),bottom:new ld(d)},t[x._uuid]=x;var C=new ld(m),R=new Mp;R._uuid="grey-texture",R.image=C,t[R._uuid]=R;var w=new Om;w._uuid="grey-cube-texture",w.setMipFilter(Om.Filter.NEAREST),w.image={front:new ld(m),back:new ld(m),left:new ld(m),right:new ld(m),top:new ld(m),bottom:new ld(m)},t[w._uuid]=w;var I=new ld(g),B=new Mp;B._uuid="white-texture",B.image=I,t[B._uuid]=B;var D=new Om;D._uuid="white-cube-texture",D.setMipFilter(Om.Filter.NEAREST),D.image={front:new ld(g),back:new ld(g),left:new ld(g),right:new ld(g),top:new ld(g),bottom:new ld(g)},t[D._uuid]=D;var P=new ld(y),O=new Mp;O._uuid="normal-texture",O.image=P,t[O._uuid]=O;var M=new ld(S),N=new Mp;N._uuid="default-texture",N.image=M,t[N._uuid]=N;var L=new Om;if(L.setMipFilter(Om.Filter.NEAREST),L._uuid="default-cube-texture",L.image={front:new ld(S),back:new ld(S),left:new ld(S),right:new ld(S),top:new ld(S),bottom:new ld(S)},t[L._uuid]=L,v.SpriteFrame){var F=new v.SpriteFrame,k=A,G=new Mp;G.image=k,F.texture=G,F._uuid="default-spriteframe",t[F._uuid]=F}},e.addAsset=function(t,e){this._resources[t]=e},e.get=function(t){return this._resources[t]},e.loadBuiltinAssets=function(){var t=this,e=Ee.querySettings(Te.Category.ENGINE,"builtinAssets");if(!e)return Promise.resolve();var i=this._resources;return new Promise((function(n,r){SS.loadBundle(Tf.INTERNAL,(function(s){s?r(s):SS.loadAny(e,(function(e,s){e?r(e):(s.forEach((function(e){i[e.name]=e,hv.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}()),xS=t("e5",v.builtinResMgr=new bS),CS=t("d6",(AS=new Map,TS=0,function(t){return"number"==typeof t?t:(AS.has(t)||(AS.set(t,1<<TS),TS++),AS.get(t))})),RS=t("c$",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(Hg),o=t.descriptorSet.getTexture(ey),h=t.descriptorSet.getTexture(ry),u=t.descriptorSet.getTexture(ly),l=t.useReflectionProbeType,c=i;c||(c=t.shaders[e]);for(var _=t.descriptorSet,f=0;f<this.instances.length;++f){var d,p,m=this.instances[f];if(!((null===(d=m.ia.indexBuffer)||void 0===d?void 0:d.objectID)!==(null===(p=s.indexBuffer)||void 0===p?void 0:p.objectID)||m.count>=1024)&&m.lightingMap.objectID===a.objectID&&m.useReflectionProbeType===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,y=m.data;m.data=new Uint8Array(g),m.data.set(y),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 v=this._device.createBuffer(new wc(wl.VERTEX|wl.TRANSFER_DST,Dl.HOST|Dl.DEVICE,32*r,r)),S=new Uint8Array(32*r),A=s.vertexBuffers.slice(),T=s.attributes.slice(),E=s.indexBuffer,b=0;b<n.attributes.length;b++){var x=n.attributes[b],C=new Xc(x.name,x.format,x.isNormalized,A.length,!0);T.push(C)}S.set(n.buffer),A.push(v);var R=new Yc(T,A,E),w=this._device.createInputAssembler(R);this.instances.push({count:1,capacity:32,vb:v,data:S,ia:w,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}()),wS=new wc(wl.UNIFORM|wl.TRANSFER_DST,Dl.DEVICE),IS=new Ic(null),BS=new s_(null);!function(t){t[t.NONE=0]="NONE",t[t.INSTANCING=1]="INSTANCING"}(ES||(ES={}));var DS=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 z_,this._dss=new V_,this._rs=new G_,this._priority=Fm.DEFAULT,this._stage=Lm.DEFAULT,this._phase=CS("default"),this._passID=4294967295,this._phaseID=4294967295,this._primitive=Ql.TRIANGLE_LIST,this._batchingScheme=ES.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=of.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=CS(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=$y.getKey(t.program,t.defines);var n,r=e+","+t._primitive+","+t._dynamicStates;return r+=function(t){for(var e,i=",bs,"+t.isA2C,n=f(t.targets);!(e=n()).done;){var r=e.value;i+=",bt,"+r.blend+","+r.blendEq+","+r.blendAlphaEq+","+r.blendColorMask,i+=","+r.blendSrc+","+r.blendDst+","+r.blendSrcAlpha+","+r.blendDstAlpha}return i}(t._bs),r+=function(t){var e=",dss,"+t.depthTest+","+t.depthWrite+","+t.depthFunc;return e+=","+t.stencilTestFront+","+t.stencilFuncFront+","+t.stencilRefFront+","+t.stencilReadMaskFront,e+=","+t.stencilFailOpFront+","+t.stencilZFailOpFront+","+t.stencilPassOpFront+","+t.stencilWriteMaskFront,(e+=","+t.stencilTestBack+","+t.stencilFuncBack+","+t.stencilRefBack+","+t.stencilReadMaskBack)+","+t.stencilFailOpBack+","+t.stencilZFailOpBack+","+t.stencilPassOpBack+","+t.stencilWriteMaskBack}(t._dss),fl(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=Rl.UNKNOWN);var n=this._propertyHandleMap[t];return n?(i?n=By(n,i):e&&(n=By(n,Cy(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);Py[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=b_(r)>>2,a=this._getBlockView(r,n),o=t.getOffsetFromHandle(e),h=0;h<i.length;h++,o+=s)null!==i[h]&&Py[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()):J(12006)},e.getInstancedBuffer=function(t){return void 0===t&&(t=0),this._instancedBuffers[t]||(this._instancedBuffers[t]=new RS(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||Ny(n),l=(b_(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=t.getTypeFromHandle(n),s=t.getBindingFromHandle(n),a=this._properties[e],o=a&&a.value,h=o?""+o+Ly(r):Ny(r),u=xS.get(h),l=u&&u.getGFXTexture(),c=a&&void 0!==a.samplerHash?Y_.unpackFromHash(a.samplerHash):u&&u.getSamplerInfo(),_=this._device.getSampler(c);this._descriptorSet.bindSampler(s,_,i||0),this._descriptorSet.bindTexture(s,l,i||0)}},e.resetUBOs=function(){for(var t=0;t<this._shaderInfo.blocks.length;t++)for(var e=this._shaderInfo.blocks[t],i=0,n=0;n<e.members.length;n++){for(var r=e.members[n],s=this._getBlockView(r.type,e.binding),a=this._properties[r.name],o=a&&a.value||Ny(r.type),h=(b_(r.type)>>2)*r.count,u=0;u+o.length<=h;u+=o.length)s.set(o,i+u);i+=h}this._rootBufferDirty=!0},e.resetTextures=function(){for(var t=0;t<this._shaderInfo.samplerTextures.length;t++)for(var e=this._shaderInfo.samplerTextures[t],i=0;i<e.count;i++)this.resetTexture(e.name,i)},e.tryCompile=function(){var e=this._root.pipeline;if(!e)return!1;if(this._syncBatchingScheme(),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=$y.getGFXShader(this._device,this._programName,this._defines,e);if(!r)return q(12104,this._programName),!1;this._shader=r,this._pipelineLayout=$y.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}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=$y.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=Fm.DEFAULT,this._stage=Lm.DEFAULT,v.rendering&&v.rendering.enableEffectImport){var n=v.rendering;if("number"==typeof e.phase?(this._passID=e._passID,this._phaseID=e._phaseID):(this._passID=n.getPassID(e.pass),this._passID!==n.INVALID_ID&&(this._phaseID=n.getPhaseID(this._passID,e.phase))),this._passID===n.INVALID_ID)return void J(12107,e.program);if(this._phaseID===n.INVALID_ID)return void J(12108,e.program)}this._phase=CS("default"),this._primitive=Ql.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=$y.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?BS.layout=v.rendering.programLib.getMaterialDescriptorSetLayout(this._device,this._phaseID,e.program):BS.layout=$y.getDescriptorSetLayout(this._device,e.program),this._descriptorSet=this._device.createDescriptorSet(BS);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=$y.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,f={};for(var d in this._properties){var p=this._properties[d];p.handleInfo&&(f[d]=this.getHandle.apply(this,p.handleInfo))}Object.assign(_,f)},e._buildUniformBlocks=function(t,e,i){for(var n=t.capabilities.uboOffsetAlignment,r=[],s=0,a=0,o=0;o<e.length;o++){var h=i[o];r.push(a),a+=Math.ceil(h/n)*n,s=h}var u=r[r.length-1]+s;u&&(wS.size=16*Math.ceil(u/16),this._rootBuffer=t.createBuffer(wS),this._rootBlock=new ArrayBuffer(u));for(var l=0,c=0;l<e.length;l++){var _=e[l].binding,f=i[l];IS.buffer=this._rootBuffer,IS.offset=r[c++],IS.range=16*Math.ceil(f/16);var d=this._buffers[_]=t.createBuffer(IS);this._blocks[_]=new Float32Array(this._rootBlock,IS.offset,f/Float32Array.BYTES_PER_ELEMENT),this._blocksInt[_]=new Int32Array(this._blocks[_].buffer,this._blocks[_].byteOffset,this._blocks[_].length),this._descriptorSet.bindBuffer(_,d)}},e._buildMaterialUniformBlocks=function(t,e,i){for(var n=t.capabilities.uboOffsetAlignment,r=[],s=0,a=0,o=0;o<e.length;o++)if(1===e[o].set){var h=i[o];r.push(a),a+=Math.ceil(h/n)*n,s=h}if(0!==s){var u=r[r.length-1]+s;u&&(wS.size=16*Math.ceil(u/16),this._rootBuffer=t.createBuffer(wS),this._rootBlock=new ArrayBuffer(u))}for(var l=0,c=0;l<e.length;l++)if(1===e[l].set){var _=e[l].binding,f=i[l];IS.buffer=this._rootBuffer,IS.offset=r[c++],IS.range=16*Math.ceil(f/16);var d=this._buffers[_]=t.createBuffer(IS);this._blocks[_]=new Float32Array(this._rootBlock,IS.offset,f/Float32Array.BYTES_PER_ELEMENT),this._blocksInt[_]=new Int32Array(this._blocks[_].buffer,this._blocks[_].byteOffset,this._blocks[_].length),this._descriptorSet.bindBuffer(_,d)}},e._syncBatchingScheme=function(){this._defines.USE_INSTANCING?this._device.hasFeature(bl.INSTANCED_ARRAYS)?this._batchingScheme=ES.INSTANCING:(this._defines.USE_INSTANCING=!1,this._batchingScheme=ES.NONE):this._batchingScheme=ES.NONE},e._getBlockView=function(t,e){return t<Rl.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=$y.getTemplateInfo(this._programName).pipelineLayout,this._hash=t._hash^i},e._updatePassHash=function(){this._hash=t.getPassHash(this)},e.setRootBufferDirty=function(t){this._rootBufferDirty=t},e.setPriority=function(t){this._priority=t},n(t,[{key:"root",get:function(){return this._root}},{key:"device",get:function(){return this._device}},{key:"shaderInfo",get:function(){return this._shaderInfo}},{key:"localSetLayout",get:function(){return v.rendering&&v.rendering.enableEffectImport?v.rendering.programLib.getLocalDescriptorSetLayout(this._device,this._phaseID,this._programName):$y.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}();DS.getTypeFromHandle=Cy,DS.getBindingFromHandle=Ry,DS.getCountFromHandle=wy,DS.getOffsetFromHandle=Iy;var PS=t("d0",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 o_(r.attributes),u=new H_(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}());PS._PSOHashMap=new Map;var OS=new Ec,MS=new mc;function NS(t,e){t.x=e.x*e.x,t.y=e.y*e.y,t.z=e.z*e.z}var LS,FS,kS,GS,VS,US,zS,HS,WS,XS=null;function jS(){return XS}function YS(t,e,i,n,r){if(!Ay()&&n&&n.enabled&&r===XS){var s=n.subModels[0],a=s.inputAssembler,o=s.passes,h=s.shaders,u=s.descriptorSet;OS.width=MS.width=r.window.width,OS.height=MS.height=r.window.height;var l=PS.getOrCreatePipelineState(t,o[0],h[0],e,a);i.setViewport(OS),i.setScissor(MS),i.bindPipelineState(l),i.bindDescriptorSet(Ym.MATERIAL,o[0].descriptorSet),i.bindDescriptorSet(Ym.LOCAL,u),i.bindInputAssembler(a),i.draw(a)}}var qS=new zi,KS=t("dU",(LS=Is("cc.Material"),FS=ha(ev),LS((GS=function(t){function e(){var e;return(e=t.call(this)||this)._effectAsset=VS&&VS(),e._techIdx=US&&US(),e._defines=zS&&zS(),e._states=HS&&HS(),e._props=WS&&WS(),e._passes=[],e._hash=0,e}s(e,t),e.getHash=function(t){for(var e,i=0,n=f(t.passes);!(e=n()).done;)i^=e.value.hash;return i};var i=e.prototype;return i.initialize=function(t){this._passes.length?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=f(this._passes);!(i=n()).done;){var r=i.value;r.resetUBOs(),r.resetTextures()}},i.setProperty=function(t,e,i){var n=!1;if(void 0===i)for(var r=this._passes,s=r.length,a=0;a<s;a++){var o=r[a];this._uploadProperty(o,t,e)&&(this._props[o.propertyIndex][t]=e,n=!0)}else{if(i>=this._passes.length)return void console.warn("illegal pass index: "+i+".");var h=this._passes[i];this._uploadProperty(h,t,e)&&(this._props[h.propertyIndex][t]=e,n=!0)}n||console.warn("illegal property name: "+t+".")},i.getProperty=function(t,e){if(void 0===e)for(var i=this._props,n=i.length,r=0;r<n;r++){var s=i[r];if(t in s)return s[t]}else{if(e>=this._passes.length)return console.warn("illegal pass index: "+e+"."),null;var a=this._props[this._passes[e].propertyIndex];if(t in a)return a[t]}return null},i.copy=function(t,e){this._techIdx=t._techIdx,this._props.length=t._props.length;for(var i=0;i<t._props.length;i++)this._props[i]=r({},t._props[i]);this._defines.length=t._defines.length;for(var n=0;n<t._defines.length;n++)this._defines[n]=r({},t._defines[n]);this._states.length=t._states.length;for(var s=0;s<t._states.length;s++)this._states[s]=r({},t._states[s]);this._effectAsset=t._effectAsset,e&&this._fillInfo(e),this._update()},i._fillInfo=function(t){void 0!==t.technique&&(this._techIdx=t.technique),t.effectAsset?this._effectAsset=t.effectAsset:t.effectName&&(this._effectAsset=ev.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 DS(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(DS.getTypeFromHandle(n)<Rl.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;NS(qS,s),qS.w=s.w,i=qS}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=DS.getBindingFromHandle(e);if(i instanceof K_)t.bindTexture(r,i,n);else if(i instanceof pd){var s=i.getGFXTexture();if(!s||!s.width||!s.height)return;t.bindTexture(r,s,n),t.bindSampler(r,i.getGFXSampler(),n)}},i._doDestroy=function(){if(this._passes&&this._passes.length)for(var t,e=f(this._passes);!(t=e()).done;)t.value.destroy();this._passes.length=0},i.initDefault=function(e){t.prototype.initDefault.call(this,e),this.initialize({effectName:"builtin-unlit",defines:{USE_COLOR:!0},technique:0}),this.setProperty("mainColor",new Zi("#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}(zf),VS=Ss(GS.prototype,"_effectAsset",[FS],(function(){return null})),US=Ss(GS.prototype,"_techIdx",[ks],(function(){return 0})),zS=Ss(GS.prototype,"_defines",[ks],(function(){return[]})),HS=Ss(GS.prototype,"_states",[ks],(function(){return[]})),WS=Ss(GS.prototype,"_props",[ks],(function(){return[]})),kS=GS))||kS));v.Material=KS;var JS=me({Low_256x256:256,Medium_512x512:512,High_1024x1024:1024,Ultra_2048x2048:2048}),QS=me({Planar:0,ShadowMap:1}),ZS=me({HARD:0,SOFT:1,SOFT_2X:2,SOFT_4X:3}),$S=me({LEVEL_1:1,LEVEL_2:2,LEVEL_3:3,LEVEL_4:4}),tA=me({NONE:1,RemoveDuplicates:2,DisableRotationFix:3}),eA=QS.ShadowMap+1,iA=function(){function t(){this.fixedSphere=new $n(0,0,0,.01),this.maxReceived=4,this._matLight=new fn,this._material=null,this._instancingMaterial=null,this._enabled=!1,this._type=eA,this._distance=0,this._normal=new Yi(0,1,0),this._shadowColor=new Zi(0,0,0,76),this._size=new yn(1024,1024),this._shadowMapDirty=!1}var e=t.prototype;return e.getPlanarShader=function(t){this._material||(this._material=new KS,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:eA,this.normal=t.planeDirection,this.distance=t.planeHeight,this.shadowColor=t.shadowColor,this.maxReceived=t.maxReceived,t.shadowMapSize!==this._size.x&&(this.size.set(t.shadowMapSize,t.shadowMapSize),this._shadowMapDirty=!0)},e.activate=function(){if(this._enabled)if(this.type===QS.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 KS,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:eA,this.activate()}},{key:"normal",get:function(){return this._normal},set:function(t){Yi.copy(this._normal,t)}},{key:"distance",get:function(){return this._distance},set:function(t){this._distance=t}},{key:"shadowColor",get:function(){return this._shadowColor},set:function(t){this._shadowColor=t}},{key:"size",get:function(){return this._size},set:function(t){this._size.set(t)}},{key:"shadowMapDirty",get:function(){return this._shadowMapDirty},set:function(t){this._shadowMapDirty=t}},{key:"matLight",get:function(){return this._matLight}},{key:"material",get:function(){return this._material}},{key:"instancingMaterial",get:function(){return this._instancingMaterial}}]),t}();iA.MAX_FAR=2e3,iA.COEFFICIENT_OF_EXPANSION=2*Math.sqrt(3),v.Shadows=iA;var nA=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 f=h._descriptorSet.getSampler(l.binding,_),d=h._descriptorSet.getTexture(l.binding,_);n._descriptorSet.bindSampler(l.binding,f,_),n._descriptorSet.bindTexture(l.binding,d,_)}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(),DS.fillPipelineInfo(this,t),DS.fillPipelineInfo(this,e),this._onStateChange()},i.tryCompile=function(e){if(e&&!Fy(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=ES.NONE},i._onStateChange=function(){this._hash=DS.getPassHash(this),this._owner.onPassStateChange(this._dontNotify)},n(e,[{key:"parent",get:function(){return this._parent}}]),e}(DS),rA=function(t){function e(e){var i;return(i=t.call(this)||this)._passes=[],i._parent=void 0,i._owner=void 0,i._subModelIdx=0,i._parent=e.parent,i._owner=e.owner||null,i._subModelIdx=e.subModelIdx||0,i.copy(i._parent),i}s(e,t);var i=e.prototype;return i.recompileShaders=function(t,e){if(this._passes&&this.effectAsset)if(void 0===e)for(var i,n=f(this._passes);!(i=n()).done;)i.value.tryCompile(t);else this._passes[e].tryCompile(t)},i.overridePipelineStates=function(t,e){if(this._passes&&this.effectAsset){var i=this.effectAsset.techniques[this.technique].passes;if(void 0===e)for(var n=0;n<this._passes.length;n++){var r=this._passes[n],s=this._states[n]||(this._states[n]={});for(var a in t)s[a]=t[a];r.overridePipelineStates(i[r.passIndex],s)}else{var o=this._states[e]||(this._states[e]={});for(var h in t)o[h]=t[h];this._passes[e].overridePipelineStates(i[e],o)}}},i.destroy=function(){return this._doDestroy(),!0},i.onPassStateChange=function(t){this._hash=KS.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 nA(e[i],this));return t},n(e,[{key:"parent",get:function(){return this._parent}},{key:"owner",get:function(){return this._owner}}]),e}(KS),sA=null,aA=null,oA=me({HEMISPHERE_DIFFUSE:0,AUTOGEN_HEMISPHERE_DIFFUSE_WITH_REFLECTION:1,DIFFUSEMAP_WITH_REFLECTION:2}),hA=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 rA({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=xS.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()),!aA){var i=new KS;i.initialize({effectName:"pipeline/skybox",defines:{USE_RGBE_CUBEMAP:e}}),aA=new rA({parent:i})}this.enabled&&(sA||(sA=v.utils.createMesh(v.primitives.box({width:2,height:2,length:2}))),this._editableMaterial?this._model.initSubModel(0,sA.renderingSubMeshes[0],this._editableMaterial):this._model.initSubModel(0,sA.renderingSubMeshes[0],aA)),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.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:aA;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=of.gfxDevice;if(this.reflectionMap){var e=this.reflectionMap.getGFXTexture(),i=t.getSampler(this.reflectionMap.getSamplerInfo());this._globalDSManager.bindSampler(sg,i),this._globalDSManager.bindTexture(sg,e)}else{var n=this.envmap?this.envmap:this._default;if(n){var r=n.getGFXTexture(),s=t.getSampler(n.getSamplerInfo());this._globalDSManager.bindSampler(sg,s),this._globalDSManager.bindTexture(sg,r)}}var a=this.diffuseMap?this.diffuseMap:this._default;if(a){var o=a.getGFXTexture(),h=t.getSampler(a.getSamplerInfo());this._globalDSManager.bindSampler(hg,h),this._globalDSManager.bindTexture(hg,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=hA;var uA,lA,cA,_A,fA,dA,pA,mA,gA,yA,vA,SA,AA,TA,EA,bA,xA,CA,RA,wA,IA,BA,DA,PA,OA,MA,NA,LA,FA,kA,GA,VA,UA,zA,HA,WA,XA,jA,YA,qA,KA,JA,QA,ZA,$A,tT,eT,iT,nT,rT,sT,aT,oT,hT,uT,lT,cT,_T,fT,dT,pT,mT,gT,yT,vT,ST,AT,TT,ET,bT,xT,CT,RT,wT,IT,BT,DT,PT,OT,MT,NT,LT,FT,kT,GT,VT,UT,zT,HT,WT,XT,jT,YT,qT,KT,JT,QT,ZT,$T,tE,eE,iE,nE,rE,sE,aE,oE,hE,uE,lE,cE,_E,fE,dE,pE,mE,gE,yE,vE,SE,AE,TE,EE=new zi,bE=me({LINEAR:0,EXP:1,EXP_SQUARED:2,LAYERED:3}),xE=bE.LAYERED+1,CE=function(){function t(){this._fogColor=new Zi("#C8C8C8"),this._colorArray=new zi(.2,.2,.2,1),this._enabled=!1,this._accurate=!1,this._type=0,this._fogDensity=.3,this._fogStart=.5,this._fogEnd=300,this._fogAtten=5,this._fogTop=1.5,this._fogRange=1.2,this._activated=!1}var 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:xE,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:xE,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=xE,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),EE.set(t.x,t.y,t.z,t.w),NS(this._colorArray,EE)}},{key:"type",get:function(){return this._type},set:function(t){this._type=this.enabled?t:xE,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=CE;var RE=new Yi(0,1,0),wE=new Yi,IE=new zi,BE=new Zi,DE=new sn,PE=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)},OE=t("dl",(uA=Is("cc.AmbientInfo"),lA=ha(Ye),cA=Gs("_skyColor"),_A=Gs("_skyIllum"),fA=Gs("_groundAlbedo"),uA((p((pA=function(){function t(){this._skyColorHDR=mA&&mA(),this._skyIllumHDR=gA&&gA(),this._groundAlbedoHDR=yA&&yA(),this._skyColorLDR=vA&&vA(),this._skyIllumLDR=SA&&SA(),this._groundAlbedoLDR=AA&&AA(),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 IE.set(t?this._skyColorHDR:this._skyColorLDR),PE(IE),BE.set(255*IE.x,255*IE.y,255*IE.z,255)},set:function(t){IE.set(t.x,t.y,t.z,t.w),v.director.root.pipeline.pipelineSceneData.isHDR?this._skyColorHDR.set(IE):this._skyColorLDR.set(IE),this._resource&&this._resource.skyColor.set(IE)}},{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 IE.set(t?this._groundAlbedoHDR:this._groundAlbedoLDR),PE(IE),BE.set(255*IE.x,255*IE.y,255*IE.z,255)},set:function(t){IE.set(t.x,t.y,t.z,t.w),v.director.root.pipeline.pipelineSceneData.isHDR?this._groundAlbedoHDR.set(IE):this._groundAlbedoLDR.set(IE),this._resource&&this._resource.groundAlbedo.set(IE)}},{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",[lA],Object.getOwnPropertyDescriptor(pA.prototype,"skyIllum"),pA.prototype),mA=Ss(pA.prototype,"_skyColorHDR",[ks,cA],(function(){return new zi(.2,.5,.8,1)})),gA=Ss(pA.prototype,"_skyIllumHDR",[ks,_A],(function(){return Nm.SKY_ILLUM})),yA=Ss(pA.prototype,"_groundAlbedoHDR",[ks,fA],(function(){return new zi(.2,.2,.2,1)})),vA=Ss(pA.prototype,"_skyColorLDR",[ks],(function(){return new zi(.2,.5,.8,1)})),SA=Ss(pA.prototype,"_skyIllumLDR",[ks],(function(){return Nm.SKY_ILLUM})),AA=Ss(pA.prototype,"_groundAlbedoLDR",[ks],(function(){return new zi(.2,.2,.2,1)})),dA=pA))||dA));v.AmbientInfo=OE;var ME=t("dm",(TA=Is("cc.SkyboxInfo"),EA=ha(oA),bA=ha(Om),xA=ha(Ye),CA=ha(Om),RA=ha(Om),wA=ha(KS),IA=ha(Om),BA=Gs("_envmap"),DA=ha(Om),PA=ha(Om),OA=ha(Om),MA=ha(KS),NA=ha(Om),LA=ha(Om),TA((p((kA=function(){function t(){this._envLightingType=GA&&GA(),this._envmapHDR=VA&&VA(),this._envmapLDR=UA&&UA(),this._diffuseMapHDR=zA&&zA(),this._diffuseMapLDR=HA&&HA(),this._enabled=WA&&WA(),this._useHDR=XA&&XA(),this._editableMaterial=jA&&jA(),this._reflectionHDR=YA&&YA(),this._reflectionLDR=qA&&qA(),this._rotationAngle=KA&&KA(),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=oA.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 oA.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||oA.HEMISPHERE_DIFFUSE===t?(oA.HEMISPHERE_DIFFUSE===t?(this.useIBL=!1,this.applyDiffuseMap=!1):oA.AUTOGEN_HEMISPHERE_DIFFUSE_WITH_REFLECTION===t?(this.useIBL=!0,this.applyDiffuseMap=!1):oA.DIFFUSEMAP_WITH_REFLECTION===t&&(this.useIBL=!0,this.applyDiffuseMap=!0),this._envLightingType=t):(this.useIBL=!1,this.applyDiffuseMap=!1,this._envLightingType=oA.HEMISPHERE_DIFFUSE,q(15001))}},{key:"useIBL",get:function(){return oA.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===oA.DIFFUSEMAP_WITH_REFLECTION&&(null===this.diffuseMap?(this.envLightingType=oA.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=oA.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",[EA],Object.getOwnPropertyDescriptor(kA.prototype,"envLightingType"),kA.prototype),p(kA.prototype,"envmap",[bA],Object.getOwnPropertyDescriptor(kA.prototype,"envmap"),kA.prototype),p(kA.prototype,"rotationAngle",[xA],Object.getOwnPropertyDescriptor(kA.prototype,"rotationAngle"),kA.prototype),p(kA.prototype,"diffuseMap",[CA],Object.getOwnPropertyDescriptor(kA.prototype,"diffuseMap"),kA.prototype),p(kA.prototype,"reflectionMap",[RA],Object.getOwnPropertyDescriptor(kA.prototype,"reflectionMap"),kA.prototype),p(kA.prototype,"skyboxMaterial",[wA],Object.getOwnPropertyDescriptor(kA.prototype,"skyboxMaterial"),kA.prototype),GA=Ss(kA.prototype,"_envLightingType",[ks],(function(){return oA.HEMISPHERE_DIFFUSE})),VA=Ss(kA.prototype,"_envmapHDR",[ks,IA,BA],(function(){return null})),UA=Ss(kA.prototype,"_envmapLDR",[ks,DA],(function(){return null})),zA=Ss(kA.prototype,"_diffuseMapHDR",[ks,PA],(function(){return null})),HA=Ss(kA.prototype,"_diffuseMapLDR",[ks,OA],(function(){return null})),WA=Ss(kA.prototype,"_enabled",[ks],(function(){return!1})),XA=Ss(kA.prototype,"_useHDR",[ks],(function(){return!0})),jA=Ss(kA.prototype,"_editableMaterial",[ks,MA],(function(){return null})),YA=Ss(kA.prototype,"_reflectionHDR",[ks,NA],(function(){return null})),qA=Ss(kA.prototype,"_reflectionLDR",[ks,LA],(function(){return null})),KA=Ss(kA.prototype,"_rotationAngle",[ks],(function(){return 0})),FA=kA))||FA));v.SkyboxInfo=ME;var NE=t("dn",(JA=Is("cc.FogInfo"),QA=ha(bE),ZA=ha(Ye),$A=ha(Ye),tT=ha(Ye),eT=ha(Ye),iT=ha(Ye),nT=ha(Ye),JA(((mT=function(){function t(){this._type=aT&&aT(),this._fogColor=oT&&oT(),this._enabled=hT&&hT(),this._fogDensity=uT&&uT(),this._fogStart=lT&&lT(),this._fogEnd=cT&&cT(),this._fogAtten=_T&&_T(),this._fogTop=fT&&fT(),this._fogRange=dT&&dT(),this._accurate=pT&&pT(),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=bE,p((sT=mT).prototype,"type",[QA],Object.getOwnPropertyDescriptor(sT.prototype,"type"),sT.prototype),p(sT.prototype,"fogDensity",[ZA],Object.getOwnPropertyDescriptor(sT.prototype,"fogDensity"),sT.prototype),p(sT.prototype,"fogStart",[$A],Object.getOwnPropertyDescriptor(sT.prototype,"fogStart"),sT.prototype),p(sT.prototype,"fogEnd",[tT],Object.getOwnPropertyDescriptor(sT.prototype,"fogEnd"),sT.prototype),p(sT.prototype,"fogAtten",[eT],Object.getOwnPropertyDescriptor(sT.prototype,"fogAtten"),sT.prototype),p(sT.prototype,"fogTop",[iT],Object.getOwnPropertyDescriptor(sT.prototype,"fogTop"),sT.prototype),p(sT.prototype,"fogRange",[nT],Object.getOwnPropertyDescriptor(sT.prototype,"fogRange"),sT.prototype),aT=Ss(sT.prototype,"_type",[ks],(function(){return bE.LINEAR})),oT=Ss(sT.prototype,"_fogColor",[ks],(function(){return new Zi("#C8C8C8")})),hT=Ss(sT.prototype,"_enabled",[ks],(function(){return!1})),uT=Ss(sT.prototype,"_fogDensity",[ks],(function(){return.3})),lT=Ss(sT.prototype,"_fogStart",[ks],(function(){return.5})),cT=Ss(sT.prototype,"_fogEnd",[ks],(function(){return 300})),_T=Ss(sT.prototype,"_fogAtten",[ks],(function(){return 5})),fT=Ss(sT.prototype,"_fogTop",[ks],(function(){return 1.5})),dT=Ss(sT.prototype,"_fogRange",[ks],(function(){return 1.2})),pT=Ss(sT.prototype,"_accurate",[ks],(function(){return!1})),rT=sT))||rT)),LE=t("dp",(gT=Is("cc.ShadowsInfo"),yT=ha(QS),vT=ha(Ye),ST=ha(je),AT=ha(JS),gT((p((ET=function(){function t(){this._enabled=bT&&bT(),this._type=xT&&xT(),this._normal=CT&&CT(),this._distance=RT&&RT(),this._shadowColor=wT&&wT(),this._maxReceived=IT&&IT(),this._size=BT&&BT(),this._resource=null}var e=t.prototype;return e.setPlaneFromNode=function(t){t.getWorldRotation(DE),this.planeDirection=Yi.transformQuat(wE,RE,DE),t.getWorldPosition(wE),this.planeHeight=Yi.dot(this._normal,wE)},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){Yi.copy(this._normal,t),this._resource&&(this._resource.normal=t)}},{key:"planeHeight",get:function(){return this._distance},set:function(t){this._distance=t,this._resource&&(this._resource.distance=t)}},{key:"maxReceived",get:function(){return this._maxReceived},set:function(t){this._maxReceived=t,this._resource&&(this._resource.maxReceived=t)}},{key:"shadowMapSize",get:function(){return this._size.x},set:function(t){this._size.set(t,t),this._resource&&(this._resource.size.set(t,t),this._resource.shadowMapDirty=!0)}}]),t}()).prototype,"type",[yT],Object.getOwnPropertyDescriptor(ET.prototype,"type"),ET.prototype),p(ET.prototype,"planeHeight",[vT],Object.getOwnPropertyDescriptor(ET.prototype,"planeHeight"),ET.prototype),p(ET.prototype,"maxReceived",[ST],Object.getOwnPropertyDescriptor(ET.prototype,"maxReceived"),ET.prototype),p(ET.prototype,"shadowMapSize",[AT],Object.getOwnPropertyDescriptor(ET.prototype,"shadowMapSize"),ET.prototype),bT=Ss(ET.prototype,"_enabled",[ks],(function(){return!1})),xT=Ss(ET.prototype,"_type",[ks],(function(){return QS.Planar})),CT=Ss(ET.prototype,"_normal",[ks],(function(){return new Yi(0,1,0)})),RT=Ss(ET.prototype,"_distance",[ks],(function(){return 0})),wT=Ss(ET.prototype,"_shadowColor",[ks],(function(){return new Zi(0,0,0,76)})),IT=Ss(ET.prototype,"_maxReceived",[ks],(function(){return 4})),BT=Ss(ET.prototype,"_size",[ks],(function(){return new yn(1024,1024)})),TT=ET))||TT));v.ShadowsInfo=LE;var FE=t("dq",new Yi(-1024,-1024,-1024)),kE=t("dr",new Yi(1024,1024,1024)),GE=t("ds",8),VE=t("dt",(DT=Is("cc.OctreeInfo"),PT=ha(je),DT((p((MT=function(){function t(){this._enabled=NT&&NT(),this._minPos=LT&<(),this._maxPos=FT&&FT(),this._depth=kT&&kT(),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",[PT],Object.getOwnPropertyDescriptor(MT.prototype,"depth"),MT.prototype),NT=Ss(MT.prototype,"_enabled",[ks],(function(){return!1})),LT=Ss(MT.prototype,"_minPos",[ks],(function(){return new Yi(FE)})),FT=Ss(MT.prototype,"_maxPos",[ks],(function(){return new Yi(kE)})),kT=Ss(MT.prototype,"_depth",[ks],(function(){return GE})),OT=MT))||OT));v.OctreeInfo=VE;var UE=t("du",(GT=Is("cc.SkinInfo"),VT=ha(Ye),UT=ha(Ye),GT((p((HT=function(){function t(){this._enabled=WT&&WT(),this._blurRadius=XT&&XT(),this._sssIntensity=jT&&jT(),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",[VT],Object.getOwnPropertyDescriptor(HT.prototype,"blurRadius"),HT.prototype),p(HT.prototype,"sssIntensity",[UT],Object.getOwnPropertyDescriptor(HT.prototype,"sssIntensity"),HT.prototype),WT=Ss(HT.prototype,"_enabled",[ks],(function(){return!0})),XT=Ss(HT.prototype,"_blurRadius",[ks],(function(){return.01})),jT=Ss(HT.prototype,"_sssIntensity",[ks],(function(){return 3})),zT=HT))||zT));v.SkinInfo=UE;var zE,HE,WE,XE,jE,YE,qE,KE,JE,QE,ZE,$E,tb,eb,ib,nb,rb,sb,ab,ob,hb,ub,lb,cb,_b,fb,db,pb,mb,gb,yb,vb,Sb,Ab,Tb,Eb,bb,xb,Cb,Rb,wb,Ib,Bb,Db,Pb,Ob,Mb,Nb,Lb,Fb,kb,Gb,Vb,Ub,zb,Hb,Wb,Xb,jb,Yb,qb,Kb,Jb,Qb,Zb,$b,tx,ex,ix,nx=t("dv",(YT=Is("cc.LightProbeInfo"),qT=ha(Ye),KT=ha(je),JT=ha(je),QT=ha(Ye),ZT=ha(Ye),YT((p((tE=function(){function t(){this._giScale=eE&&eE(),this._giSamples=iE&&iE(),this._bounces=nE&&nE(),this._reduceRinging=rE&&rE(),this._showProbe=sE&&sE(),this._showWireframe=aE&&aE(),this._showConvex=oE&&oE(),this._data=hE&&hE(),this._lightProbeSphereVolume=uE&&uE(),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(zp.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 Yi(0,0,0);Yi.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",[qT],Object.getOwnPropertyDescriptor(tE.prototype,"giScale"),tE.prototype),p(tE.prototype,"giSamples",[KT],Object.getOwnPropertyDescriptor(tE.prototype,"giSamples"),tE.prototype),p(tE.prototype,"bounces",[JT],Object.getOwnPropertyDescriptor(tE.prototype,"bounces"),tE.prototype),p(tE.prototype,"reduceRinging",[QT],Object.getOwnPropertyDescriptor(tE.prototype,"reduceRinging"),tE.prototype),p(tE.prototype,"lightProbeSphereVolume",[ZT],Object.getOwnPropertyDescriptor(tE.prototype,"lightProbeSphereVolume"),tE.prototype),eE=Ss(tE.prototype,"_giScale",[ks],(function(){return 1})),iE=Ss(tE.prototype,"_giSamples",[ks],(function(){return 1024})),nE=Ss(tE.prototype,"_bounces",[ks],(function(){return 2})),rE=Ss(tE.prototype,"_reduceRinging",[ks],(function(){return 0})),sE=Ss(tE.prototype,"_showProbe",[ks],(function(){return!0})),aE=Ss(tE.prototype,"_showWireframe",[ks],(function(){return!0})),oE=Ss(tE.prototype,"_showConvex",[ks],(function(){return!1})),hE=Ss(tE.prototype,"_data",[ks],(function(){return null})),uE=Ss(tE.prototype,"_lightProbeSphereVolume",[ks],(function(){return 1})),$T=tE))||$T)),rx=t("dw",(lE=Is("cc.SceneGlobals"),cE=ha(ME),lE((fE=function(){function t(){this.ambient=dE&&dE(),this.shadows=pE&&pE(),this._skybox=mE&&mE(),this.fog=gE&&gE(),this.octree=yE&&yE(),this.skin=vE&&vE(),this.lightProbeInfo=SE&&SE(),this.bakedWithStationaryMainLight=AE&&AE(),this.bakedWithHighpLightmap=TE&&TE(),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.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}(),dE=Ss(fE.prototype,"ambient",[ks],(function(){return new OE})),pE=Ss(fE.prototype,"shadows",[ks],(function(){return new LE})),mE=Ss(fE.prototype,"_skybox",[ks],(function(){return new ME})),gE=Ss(fE.prototype,"fog",[ks],(function(){return new NE})),p(fE.prototype,"skybox",[cE],Object.getOwnPropertyDescriptor(fE.prototype,"skybox"),fE.prototype),yE=Ss(fE.prototype,"octree",[ks],(function(){return new VE})),vE=Ss(fE.prototype,"skin",[ks],(function(){return new UE})),SE=Ss(fE.prototype,"lightProbeInfo",[ks],(function(){return new nx})),AE=Ss(fE.prototype,"bakedWithStationaryMainLight",[ks],(function(){return!1})),TE=Ss(fE.prototype,"bakedWithHighpLightmap",[ks],(function(){return!1})),_E=fE))||_E));v.SceneGlobals=rx;var sx=(zE=Is("cc.TargetInfo"),HE=ha([Ke]),zE((XE=function(){this.localID=jE&&jE()},jE=Ss(XE.prototype,"localID",[ks,HE],(function(){return[]})),WE=XE))||WE),ax=(YE=Is("cc.TargetOverrideInfo"),qE=ha(ba),KE=ha(sx),JE=ha([Ke]),QE=ha(Pm),ZE=ha(sx),YE((tb=function(){this.source=eb&&eb(),this.sourceInfo=ib&&ib(),this.propertyPath=nb&&nb(),this.target=rb&&rb(),this.targetInfo=sb&&sb()},eb=Ss(tb.prototype,"source",[ks,qE],(function(){return null})),ib=Ss(tb.prototype,"sourceInfo",[ks,KE],(function(){return null})),nb=Ss(tb.prototype,"propertyPath",[ks,JE],(function(){return[]})),rb=Ss(tb.prototype,"target",[ks,QE],(function(){return null})),sb=Ss(tb.prototype,"targetInfo",[ks,ZE],(function(){return null})),$E=tb))||$E),ox=Is("cc.CompPrefabInfo")((ob=function(){this.fileId=hb&&hb()},hb=Ss(ob.prototype,"fileId",[ks],(function(){return""})),ab=ob))||ab,hx=(ub=Is("CCPropertyOverrideInfo"),lb=ha(sx),cb=ha([Ke]),ub((fb=function(){function t(){this.targetInfo=db&&db(),this.propertyPath=pb&&pb(),this.value=mb&&mb()}return t.prototype.isTarget=function(){},t}(),db=Ss(fb.prototype,"targetInfo",[ks,lb],(function(){return null})),pb=Ss(fb.prototype,"propertyPath",[ks,cb],(function(){return[]})),mb=Ss(fb.prototype,"value",[ks],null),_b=fb))||_b),ux=(gb=Is("cc.MountedChildrenInfo"),yb=ha(sx),vb=ha([Pm]),gb((Ab=function(){function t(){this.targetInfo=Tb&&Tb(),this.nodes=Eb&&Eb()}return t.prototype.isTarget=function(){},t}(),Tb=Ss(Ab.prototype,"targetInfo",[ks,yb],(function(){return null})),Eb=Ss(Ab.prototype,"nodes",[ks,vb],(function(){return[]})),Sb=Ab))||Sb),lx=(bb=Is("cc.MountedComponentsInfo"),xb=ha(sx),Cb=ha([Vd]),bb((wb=function(){function t(){this.targetInfo=Ib&&Ib(),this.components=Bb&&Bb()}return t.prototype.isTarget=function(){},t}(),Ib=Ss(wb.prototype,"targetInfo",[ks,xb],(function(){return null})),Bb=Ss(wb.prototype,"components",[ks,Cb],(function(){return[]})),Rb=wb))||Rb),cx=(Db=Is("cc.PrefabInstance"),Pb=ha(Pm),Ob=ha([ux]),Mb=ha([lx]),Nb=ha([hx]),Lb=ha([sx]),Db((kb=function(){function t(){this.fileId=Gb&&Gb(),this.prefabRootNode=Vb&&Vb(),this.mountedChildren=Ub&&Ub(),this.mountedComponents=zb&&zb(),this.propertyOverrides=Hb&&Hb(),this.removedComponents=Wb&&Wb(),this.targetMap={},this.expanded=!1}var e=t.prototype;return e.findPropertyOverride=function(){},e.removePropertyOverride=function(){},t}(),Gb=Ss(kb.prototype,"fileId",[ks],(function(){return""})),Vb=Ss(kb.prototype,"prefabRootNode",[ks,Pb],null),Ub=Ss(kb.prototype,"mountedChildren",[ks,Ob],(function(){return[]})),zb=Ss(kb.prototype,"mountedComponents",[ks,Mb],(function(){return[]})),Hb=Ss(kb.prototype,"propertyOverrides",[ks,Nb],(function(){return[]})),Wb=Ss(kb.prototype,"removedComponents",[ks,Lb],(function(){return[]})),Fb=kb))||Fb),_x=(Xb=Is("cc.PrefabInfo"),jb=ha(Pm),Yb=ha(cx),qb=ha([ax]),Xb((Jb=function(){this.root=Qb&&Qb(),this.asset=Zb&&Zb(),this.fileId=$b&&$b(),this.instance=tx&&tx(),this.targetOverrides=ex&&ex(),this.nestedPrefabInstanceRoots=ix&&ix()},Qb=Ss(Jb.prototype,"root",[ks,jb],null),Zb=Ss(Jb.prototype,"asset",[ks],null),$b=Ss(Jb.prototype,"fileId",[ks],(function(){return""})),tx=Ss(Jb.prototype,"instance",[ks,Yb],null),ex=Ss(Jb.prototype,"targetOverrides",[ks,qb],null),ix=Ss(Jb.prototype,"nestedPrefabInstanceRoots",[ks],null),Kb=Jb))||Kb);function fx(t){var e=t._prefab;if(e&&e.instance){if(!e.asset)return J(3701,t.name),void(e.instance=void 0);var i=t._objFlags,n=t.getParent(),r=t.uuid,s=t._prefab;t[la],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=null==s?void 0:s.instance)}}function dx(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++)dx(t.children[l],r,!1)}}function px(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 mx(t,e,i){if(e)for(var n=0;n<e.length;n++){var r=e[n];if(r&&r.targetInfo){var s=px(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),dx(l,a,!1),l.siblingIndex=s.children.length-1,Ax(l,!0))}}}}function gx(t,e,i){if(e)for(var n=0;n<e.length;n++){var r=e[n];if(r&&r.targetInfo){var s=px(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 yx(t,e,i){if(e)for(var n=0;n<e.length;n++){var r=e[n];if(r){var s=px(r.localID,i);if(!s||!s.node)continue;var a=s.node.components.indexOf(s);a>=0&&s.node.getWritableComponents().splice(a,1)}}}function vx(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=px(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 Sx(t){var e,i=null===(e=t._prefab)||void 0===e?void 0:e.targetOverrides;if(i)for(var n=0;n<i.length;n++){var r,s,a=i[n],o=a.source,h=a.sourceInfo;if(h){var u,l,c=null===(u=a.source)||void 0===u||null===(l=u._prefab)||void 0===l?void 0:l.instance;c&&c.targetMap&&(o=px(h.localID,c.targetMap))}if(o){var _,f=a.targetInfo;if(f){var d=null===(r=a.target)||void 0===r||null===(s=r._prefab)||void 0===s?void 0:s.instance;if(d&&d.targetMap&&(_=px(f.localID,d.targetMap))){var p=a.propertyPath.slice(),m=o;if(p.length>0){var g=p.pop();if(!g)return;for(var y=0;y<p.length&&(m=m[p[y]]);y++);if(!m)continue;m[g]=_}}}}}}function Ax(t,e){void 0===e&&(e=!1);var i=t._prefab,n=null==i?void 0:i.instance;if(n&&!n.expanded){fx(t),e&&t&&t.children&&t.children.forEach((function(t){Ax(t,!0)}));var r={};n.targetMap=r,dx(t,r,!0),mx(0,n.mountedChildren,r),yx(0,n.removedComponents,r),gx(0,n.mountedComponents,r),vx(0,n.propertyOverrides,r),n.expanded=!0}else e&&t&&t.children&&t.children.forEach((function(t){Ax(t,!0)}))}function Tx(t){var e=t._prefab;e&&e.nestedPrefabInstanceRoots&&e.nestedPrefabInstanceRoots.forEach((function(t){var e,i,n;Ax(t),Ex(t,null!==(e=null===(i=t._prefab)||void 0===i||null===(n=i.instance)||void 0===n?void 0:n.fileId)&&void 0!==e?e:"")}))}function Ex(t,e){for(var i=t.components,n=t.children,r=0;r<i.length;r++){var s,a,o=i[r],h=null!==(s=null===(a=o.__prefab)||void 0===a?void 0:a.fileId)&&void 0!==s?s:"";o._id=""+e+h}for(var u=0;u<n.length;u++){var l=n[u],c=l._prefab,_=null!=c&&c.instance?c.instance.fileId:null==c?void 0:c.fileId;_&&(l.id=""+e+_,null!=c&&c.instance||Ex(l,e))}}v._PrefabInfo=_x;var bx,xx,Cx,Rx,wx,Ix,Bx,Dx=Object.freeze({__proto__:null,createNodeWithPrefab:fx,generateTargetMap:dx,getTarget:px,applyMountedChildren:mx,applyMountedComponents:gx,applyRemovedComponents:yx,applyPropertyOverrides:vx,applyTargetOverrides:Sx,expandPrefabInstanceNode:Ax,expandNestedPrefabInstanceNode:Tx,applyNodeAndComponentId:Ex,TargetInfo:sx,TargetOverrideInfo:ax,CompPrefabInfo:ox,PropertyOverrideInfo:hx,MountedChildrenInfo:ux,MountedComponentsInfo:lx,PrefabInstance:cx,PrefabInfo:_x}),Px=t("da",Is("cc.Scene")((xx=function(t){s(i,t);var e=i.prototype;function i(e){var i;return(i=t.call(this,e)||this).autoReleaseAssets=Cx&&Cx(),i._globals=Rx&&Rx(),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=ba.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(tt(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||(Tx(this),Sx(this),this._onBatchCreated(g),this._inited=!0),this.walk(Pm._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}(Pm),Cx=Ss(xx.prototype,"autoReleaseAssets",[ks],(function(){return!1})),Rx=Ss(xx.prototype,"_globals",[ks],(function(){return new rx})),bx=xx))||bx);v.Scene=Px;var Ox=t("dN",Is("cc.SceneAsset")((Ix=function(t){function e(){for(var e,i=arguments.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=Bx&&Bx(),e}s(e,t);var i=e.prototype;return i.initDefault=function(e){t.prototype.initDefault.call(this,e),this.scene=new Px("New Scene")},i.validate=function(){return!!this.scene},e}(zf),Bx=Ss(Ix.prototype,"scene",[ks],(function(){return null})),wx=Ix))||wx);v.SceneAsset=Ox,dt({SystemEventType:{newName:"Input.EventType",since:"3.3.0",removed:!1}}),dt({SystemEvent:{newName:"Input",since:"3.4.0",removed:!1},systemEvent:{newName:"input",since:"3.4.0",removed:!1}});var Mx,Nx,Lx=t("e8",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}());Lx.NO_TYPE="no_type",Lx.TOUCH="touch",Lx.MOUSE="mouse",Lx.KEYBOARD="keyboard",Lx.ACCELERATION="acceleration",Lx.NONE=0,Lx.CAPTURING_PHASE=1,Lx.AT_TARGET=2,Lx.BUBBLING_PHASE=3,v.Event=Lx,t("e7",Mx),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"}(Mx||t("e7",Mx={})),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"}(Nx||(Nx={})),v.SystemEventType=Mx;var Fx=t("e9",function(t){function e(e,i){var n;return(n=t.call(this,Mx.DEVICEMOTION,i)||this).acc=void 0,n.acc=e,n}return s(e,t),e}(Lx));Lx.EventAcceleration=Fx;var kx=t("ea",function(t){function e(e,i,n){var r;return"boolean"==typeof i&&(i=i?Mx.KEY_DOWN:Mx.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!==Mx.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}(Lx));Lx.EventKeyboard=kx;var Gx=t("eb",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 yn),yn.set(t,this._x,this._y),t},i.getLocationInView=function(t){return t||(t=new yn),yn.set(t,this._x,v.view._designResolutionSize.height-this._y),t},i.getUILocation=function(t){return t||(t=new yn),yn.set(t,this._x,this._y),v.view._convertToUISpace(t),t},i.getPreviousLocation=function(t){return t||(t=new yn),yn.set(t,this._prevX,this._prevY),t},i.getUIPreviousLocation=function(t){return t||(t=new yn),yn.set(t,this._prevX,this._prevY),v.view._convertToUISpace(t),t},i.getDelta=function(t){return t||(t=new yn),yn.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 yn),yn.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}(Lx));Gx.BUTTON_MISSING=-1,Gx.BUTTON_LEFT=0,Gx.BUTTON_RIGHT=2,Gx.BUTTON_MIDDLE=1,Gx.BUTTON_4=3,Gx.BUTTON_5=4,Gx.BUTTON_6=5,Gx.BUTTON_7=6,Gx.BUTTON_8=7,Lx.EventMouse=Gx;var Vx=new yn,Ux=t("ec",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 yn},i.getUILocation=function(t){return this.touch?this.touch.getUILocation(t):new yn},i.getLocationInView=function(t){return this.touch?this.touch.getLocationInView(t):new yn},i.getPreviousLocation=function(t){return this.touch?this.touch.getPreviousLocation(t):new yn},i.getStartLocation=function(t){return this.touch?this.touch.getStartLocation(t):new yn},i.getUIStartLocation=function(t){return this.touch?this.touch.getUIStartLocation(t):new yn},i.getID=function(){return this.touch?this.touch.getID():null},i.getDelta=function(t){return this.touch?this.touch.getDelta(t):new yn},i.getUIDelta=function(t){return this.touch?this.touch.getUIDelta(t):new yn},i.getDeltaX=function(){return this.touch?this.touch.getDelta(Vx).x:0},i.getDeltaY=function(){return this.touch?this.touch.getDelta(Vx).y:0},i.getLocationX=function(){return this.touch?this.touch.getLocationX():0},i.getLocationY=function(){return this.touch?this.touch.getLocationY():0},e}(Lx));Ux.MAX_TOUCHES=5,Lx.EventTouch=Ux;var zx,Hx=t("ed",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}(Lx)),Wx=t("ee",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}(Lx)),Xx=t("ef",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}(Lx)),jx=(t("eg",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}(Lx)),t("eh",(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("ei",zx),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"}(zx||t("ei",zx={}));var Yx=new yn,qx=t("ej",function(){function t(t,e,i){void 0===i&&(i=0),this._point=new yn,this._prevPoint=new yn,this._lastModified=0,this._id=0,this._startPoint=new yn,this._startPointCaptured=!1,this.setTouchInfo(i,t,e)}var e=t.prototype;return e.getLocation=function(t){return t||(t=new yn),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 yn),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 yn),t.set(this._prevPoint.x,this._prevPoint.y),t},e.getUIPreviousLocation=function(t){return t||(t=new yn),t.set(this._prevPoint.x,this._prevPoint.y),v.view._convertToUISpace(t),t},e.getStartLocation=function(t){return t||(t=new yn),t.set(this._startPoint.x,this._startPoint.y),t},e.getUIStartLocation=function(t){return t||(t=new yn),t.set(this._startPoint.x,this._startPoint.y),v.view._convertToUISpace(t),t},e.getDelta=function(t){return t||(t=new yn),t.set(this._point),t.subtract(this._prevPoint),t},e.getUIDelta=function(t){return t||(t=new yn),Yx.set(this._point),Yx.subtract(this._prevPoint),t.set(v.view.getScaleX(),v.view.getScaleY()),yn.divide(t,Yx,t),t},e.getLocationInView=function(t){return t||(t=new yn),t.set(this._point.x,v.view._designResolutionSize.height-this._point.y),t},e.getPreviousLocationInView=function(t){return t||(t=new yn),t.set(this._prevPoint.x,v.view._designResolutionSize.height-this._prevPoint.y),t},e.getStartLocationInView=function(t){return t||(t=new yn),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),this._prevPoint=this._point,this._point=new yn(e||0,i||0),this._id=t,this._startPointCaptured||(this._startPoint=new yn(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 yn(t.x,t.y):new yn(t||0,e||0),this._lastModified=v.game.frameStartTime},n(t,[{key:"lastModified",get:function(){return this._lastModified}}]),t}());v.Touch=qx;var Kx=function(){function t(){this._intervalInMileSeconds=200,this._accelTimer=0,this._eventTarget=new Du,this._deviceEventName=void 0,this._globalEventClass=void 0,this._didAccelerateFunc=void 0,this._globalEventClass=window.DeviceMotionEvent||window.DeviceOrientationEvent,Gu.browserType===Pu.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(al.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),Gu.os===Nu.ANDROID&&Gu.browserType!==Pu.MOBILE_QQ&&(i=-i,n=-n);var u=performance.now(),l=new jx(i,n,r,u),c=new Fx(l);this._eventTarget.emit(Nx.DEVICEMOTION,c)}},e.start=function(){var t=this;window.DeviceMotionEvent&&"function"==typeof DeviceMotionEvent.requestPermission?DeviceMotionEvent.requestPermission().then((function(e){"granted"===e&&t._registerEvent()})).catch((function(){})):this._registerEvent()},e.stop=function(){this._unregisterEvent()},e.setInterval=function(t){this._intervalInMileSeconds=t},e.on=function(t,e,i){this._eventTarget.on(t,e,i)},t}(),Jx=function(){},Qx=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}(Jx),Zx=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}(Jx),$x=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}(Jx),tC=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}(Jx),eC=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}(Qx),iC=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 eC({positive:i.right,negative:i.left}),i.yAxis=new eC({positive:i.up,negative:i.down}),i}return s(e,t),e.prototype.getValue=function(){return new yn(this.xAxis.getValue(),this.yAxis.getValue())},e}(Zx);!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 eC({positive:i.right,negative:i.left}),i.yAxis=new eC({positive:i.up,negative:i.down}),i.zAxis=new eC({positive:i.forward,negative:i.backward}),i}s(e,t),e.prototype.getValue=function(){return new Yi(this.xAxis.getValue(),this.yAxis.getValue(),this.zAxis.getValue())}}($x);var nC,rC=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}(Qx),sC=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(iC),aC=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(iC),oC=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}(tC),hC=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}($x),uC="left",lC="right";!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"}(nC||(nC={}));var cC,_C,fC,dC=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={})[nC.HAND_LEFT]={position:Yi.ZERO,orientation:sn.IDENTITY},e[nC.HAND_RIGHT]={position:Yi.ZERO,orientation:sn.IDENTITY},e[nC.AIM_LEFT]={position:Yi.ZERO,orientation:sn.IDENTITY},e[nC.AIM_RIGHT]={position:Yi.ZERO,orientation:sn.IDENTITY},e),this._deviceId=t,this._initInputSource()}t._init=function(){Gu.hasFeature(Fu.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&&ae(t.all,i)},t._getOrCreateInputDevice=function(e,i){var n=t.all.find((function(t){return t.deviceId===e}));return n||(n=new t(e),t.all.push(n)),n._connected=i,n},t._ensureDirectorDefined=function(){return new Promise((function(e){t._intervalId=setInterval((function(){v.director&&v.Director&&(clearInterval(t._intervalId),t._intervalId=-1,e())}),50)}))},t._registerEvent=function(){t._ensureDirectorDefined().then((function(){v.director.on(v.Director.EVENT_BEGIN_FRAME,t._scanGamepads)})).catch((function(){})),window.addEventListener("gamepadconnected",(function(e){t._cachedWebGamepads[e.gamepad.index]=e.gamepad;var i=t._getOrCreateInputDevice(e.gamepad.index,!0);t._eventTarget.emit(Nx.GAMEPAD_CHANGE,new Hx(Nx.GAMEPAD_CHANGE,i))})),window.addEventListener("gamepaddisconnected",(function(e){t._cachedWebGamepads[e.gamepad.index]=null;var i=t._getOrCreateInputDevice(e.gamepad.index,!1);t._removeInputDevice(e.gamepad.index),t._eventTarget.emit(Nx.GAMEPAD_CHANGE,new Hx(Nx.GAMEPAD_CHANGE,i))}))},t._scanWebGamepads=function(e){var i=t._getWebGamePads();if(i){for(var n=0;n<i.length;++n){var r=null==i?void 0: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 f=c[_],d=r.axes[_];if(Math.abs(f-d)>.01){a=t._getOrCreateInputDevice(r.index,!0);break}}if(a){e.push(a);continue}}}}t._cachedWebGamepads=i}},t._scanGamepads=function(){var e=[];t._scanWebGamepads(e),t._scanWebXRGamepads(e);for(var i=0;i<e.length;++i){var n=e[i];t._eventTarget.emit(Nx.GAMEPAD_INPUT,new Hx(Nx.GAMEPAD_INPUT,n))}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(Nx.GAMEPAD_CHANGE,new Hx(Nx.GAMEPAD_CHANGE,t.xr)),e.push(t.xr)));t.xr||(t.xr=new t(-1));var s=r.get(uC),a=r.get(lC);s||a?t.xr._connected||(t.xr._connected=!0,t._eventTarget.emit(Nx.GAMEPAD_CHANGE,new Hx(Nx.GAMEPAD_CHANGE,t.xr))):t.xr._connected&&(t.xr._connected=!1,t._eventTarget.emit(Nx.GAMEPAD_CHANGE,new Hx(Nx.GAMEPAD_CHANGE,t.xr))),(t.checkGamepadChanged(s,null===(i=t._cachedWebXRGamepadMap)||void 0===i?void 0:i.get(uC))||t.checkGamepadChanged(a,null===(n=t._cachedWebXRGamepadMap)||void 0===n?void 0:n.get(lC)))&&e.push(t.xr),t._cachedWebXRGamepadMap||(t._cachedWebXRGamepadMap=new Map),t._cachedWebXRGamepadMap.set(uC,t._copyCacheGamepadValue(s)),t._cachedWebXRGamepadMap.set(lC,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(Nx.HANDLE_POSE_INPUT,new Hx(Nx.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!==nC.HAND_LEFT&&t.code!==nC.AIM_LEFT&&t.code!==nC.HAND_RIGHT&&t.code!==nC.AIM_RIGHT||(this._webPoseState[t.code]={position:new Yi(t.position.x,t.position.y,t.position.z),orientation:new sn(t.orientation.x,t.orientation.y,t.orientation.z,t.orientation.w)})},e._initInputSource=function(){var e=this;this._buttonNorth=new rC,this._buttonNorth.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(uC);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 rC,this._buttonEast.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(lC);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 rC,this._buttonWest.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(uC);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 rC,this._buttonSouth.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(lC);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 rC,this._buttonL1.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[4].value:0},this._buttonL2=new rC,this._buttonL2.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(uC);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 rC,this._buttonL3.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(uC);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 rC,this._buttonR1.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[5].value:0},this._buttonR2=new rC,this._buttonR2.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(lC);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 rC,this._buttonR3.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(lC);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 rC,this._buttonShare.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[8].value:0},this._buttonOptions=new rC,this._buttonOptions.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[9].value:0};var i=new rC;i.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[12].value:0};var n=new rC;n.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[13].value:0};var r=new rC;r.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[14].value:0};var s=new rC;s.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[15].value:0},this._dpad=new sC({up:i,down:n,left:r,right:s});var a=new rC;a.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(uC);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 rC;o.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(uC);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 rC;h.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(uC);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 rC;u.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(uC);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 aC({up:a,down:o,left:h,right:u});var l=new rC;l.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(lC);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 rC;c.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(lC);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 rC;_.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(lC);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 f=new rC;f.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(lC);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 aC({up:l,down:c,left:_,right:f}),this._buttonStart=new rC,this._buttonStart.getValue=function(){return 0},this._gripLeft=new rC,this._gripLeft.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(uC);if(n&&n.buttons.length>1)return n.buttons[1].value}return 0},this._gripRight=new rC,this._gripRight.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(lC);if(n&&n.buttons.length>1)return n.buttons[1].value}return 0},this._handLeftPosition=new hC,this._handLeftPosition.getValue=function(){return e._webPoseState[nC.HAND_LEFT].position},this._handLeftOrientation=new oC,this._handLeftOrientation.getValue=function(){return e._webPoseState[nC.HAND_LEFT].orientation},this._handRightPosition=new hC,this._handRightPosition.getValue=function(){return e._webPoseState[nC.HAND_RIGHT].position},this._handRightOrientation=new oC,this._handRightOrientation.getValue=function(){return e._webPoseState[nC.HAND_RIGHT].orientation},this._aimLeftPosition=new hC,this._aimLeftPosition.getValue=function(){return e._webPoseState[nC.AIM_LEFT].position},this._aimLeftOrientation=new oC,this._aimLeftOrientation.getValue=function(){return e._webPoseState[nC.AIM_LEFT].orientation},this._aimRightPosition=new hC,this._aimRightPosition.getValue=function(){return e._webPoseState[nC.AIM_RIGHT].position},this._aimRightOrientation=new oC,this._aimRightOrientation.getValue=function(){return e._webPoseState[nC.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}();dC.all=[],dC.xr=null,dC._eventTarget=new Du,dC._cachedWebGamepads=[],dC._cachedWebXRGamepadMap=null,dC._intervalId=-1,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"}(cC||(cC={})),function(t){t[t.KET_CLICK=0]="KET_CLICK",t[t.KET_STICK=1]="KET_STICK",t[t.KET_GRAB=2]="KET_GRAB"}(_C||(_C={})),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.LEFT_TRIGGER=7]="LEFT_TRIGGER",t[t.RIGHT_TIRGGER=8]="RIGHT_TIRGGER",t[t.LEFT_GRIP=9]="LEFT_GRIP",t[t.RIGHT_GRIP=10]="RIGHT_GRIP"}(fC||(fC={}));var pC,mC={1:cC.BUTTON_EAST,2:cC.BUTTON_SOUTH,3:cC.BUTTON_NORTH,4:cC.BUTTON_WEST,9:cC.BUTTON_LEFT_STICK,10:cC.BUTTON_RIGHT_STICK,11:cC.ROKID_MENU,12:cC.ROKID_START,13:cC.BUTTON_TRIGGER_LEFT,14:cC.BUTTON_TRIGGER_RIGHT},gC=function(){function t(){var t,e=this;this._eventTarget=new Du,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._nativeButtonState=((t={})[cC.BUTTON_SOUTH]=0,t[cC.BUTTON_EAST]=0,t[cC.BUTTON_WEST]=0,t[cC.BUTTON_NORTH]=0,t[cC.BUTTON_TRIGGER_LEFT]=0,t[cC.BUTTON_TRIGGER_RIGHT]=0,t[cC.TRIGGER_LEFT]=0,t[cC.TRIGGER_RIGHT]=0,t[cC.GRIP_LEFT]=0,t[cC.GRIP_RIGHT]=0,t[cC.LEFT_STICK_UP]=0,t[cC.LEFT_STICK_DOWN]=0,t[cC.LEFT_STICK_LEFT]=0,t[cC.LEFT_STICK_RIGHT]=0,t[cC.RIGHT_STICK_UP]=0,t[cC.RIGHT_STICK_DOWN]=0,t[cC.RIGHT_STICK_LEFT]=0,t[cC.RIGHT_STICK_RIGHT]=0,t[cC.BUTTON_LEFT_STICK]=0,t[cC.BUTTON_RIGHT_STICK]=0,t[cC.ROKID_MENU]=0,t[cC.ROKID_START]=0,t),this._initInputSource(),window.addEventListener("xr-remote-input",(function(t){var i=t,n=i.detail.keyEventType,r=i.detail.stickAxisCode,s=i.detail.stickAxisValue,a=i.detail.stickKeyCode,o=i.detail.isButtonPressed;if(n===_C.KET_CLICK){var h=mC[a];e._nativeButtonState[h]=o?1:0}else if(n===_C.KET_STICK||n===_C.KET_GRAB){var u,l,c;switch(r){case fC.LEFT_STICK_X:u=cC.LEFT_STICK_LEFT,l=cC.LEFT_STICK_RIGHT,c=e._axisToButtons(s);break;case fC.LEFT_STICK_Y:u=cC.LEFT_STICK_DOWN,l=cC.LEFT_STICK_UP,c=e._axisToButtons(s);break;case fC.RIGHT_STICK_X:u=cC.RIGHT_STICK_LEFT,l=cC.RIGHT_STICK_RIGHT,c=e._axisToButtons(s);break;case fC.RIGHT_STICK_Y:u=cC.RIGHT_STICK_DOWN,l=cC.RIGHT_STICK_UP,c=e._axisToButtons(s);break;case fC.LEFT_TRIGGER:e._nativeButtonState[cC.TRIGGER_LEFT]=s;break;case fC.RIGHT_TIRGGER:e._nativeButtonState[cC.TRIGGER_RIGHT]=s;break;case fC.LEFT_GRIP:e._nativeButtonState[cC.GRIP_LEFT]=s;break;case fC.RIGHT_GRIP:e._nativeButtonState[cC.GRIP_RIGHT]=s}u&&l&&c&&(e._nativeButtonState[u]=c.negative,e._nativeButtonState[l]=c.positive)}e._eventTarget.emit(Nx.HANDLE_INPUT,new Wx(Nx.HANDLE_INPUT,e))}))}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 rC,this._buttonNorth.getValue=function(){return t._nativeButtonState[cC.BUTTON_NORTH]},this._buttonEast=new rC,this._buttonEast.getValue=function(){return t._nativeButtonState[cC.BUTTON_EAST]},this._buttonWest=new rC,this._buttonWest.getValue=function(){return t._nativeButtonState[cC.BUTTON_WEST]},this._buttonSouth=new rC,this._buttonSouth.getValue=function(){return t._nativeButtonState[cC.BUTTON_SOUTH]},this._buttonTriggerLeft=new rC,this._buttonTriggerLeft.getValue=function(){return t._nativeButtonState[cC.BUTTON_TRIGGER_LEFT]},this._buttonTriggerRight=new rC,this._buttonTriggerRight.getValue=function(){return t._nativeButtonState[cC.BUTTON_TRIGGER_RIGHT]},this._triggerLeft=new rC,this._triggerLeft.getValue=function(){return t._nativeButtonState[cC.TRIGGER_LEFT]},this._triggerRight=new rC,this._triggerRight.getValue=function(){return t._nativeButtonState[cC.TRIGGER_RIGHT]},this._gripLeft=new rC,this._gripLeft.getValue=function(){return t._nativeButtonState[cC.GRIP_LEFT]},this._gripRight=new rC,this._gripRight.getValue=function(){return t._nativeButtonState[cC.GRIP_RIGHT]},this._buttonLeftStick=new rC,this._buttonLeftStick.getValue=function(){return t._nativeButtonState[cC.BUTTON_LEFT_STICK]};var e=new rC;e.getValue=function(){return t._nativeButtonState[cC.LEFT_STICK_UP]};var i=new rC;i.getValue=function(){return t._nativeButtonState[cC.LEFT_STICK_DOWN]};var n=new rC;n.getValue=function(){return t._nativeButtonState[cC.LEFT_STICK_LEFT]};var r=new rC;r.getValue=function(){return t._nativeButtonState[cC.LEFT_STICK_RIGHT]},this._leftStick=new aC({up:e,down:i,left:n,right:r}),this._buttonRightStick=new rC,this._buttonRightStick.getValue=function(){return t._nativeButtonState[cC.BUTTON_RIGHT_STICK]};var s=new rC;s.getValue=function(){return t._nativeButtonState[cC.RIGHT_STICK_UP]};var a=new rC;a.getValue=function(){return t._nativeButtonState[cC.RIGHT_STICK_DOWN]};var o=new rC;o.getValue=function(){return t._nativeButtonState[cC.RIGHT_STICK_LEFT]};var h=new rC;h.getValue=function(){return t._nativeButtonState[cC.RIGHT_STICK_RIGHT]},this._rightStick=new aC({up:s,down:a,left:o,right:h}),this._buttonOptions=new rC,this._buttonOptions.getValue=function(){return t._nativeButtonState[cC.ROKID_MENU]},this._buttonStart=new rC,this._buttonStart.getValue=function(){return t._nativeButtonState[cC.ROKID_START]},this._handLeftPosition=new hC,this._handLeftPosition.getValue=function(){return Yi.ZERO},this._handLeftOrientation=new oC,this._handLeftOrientation.getValue=function(){return sn.IDENTITY},this._handRightPosition=new hC,this._handRightPosition.getValue=function(){return Yi.ZERO},this._handRightOrientation=new oC,this._handRightOrientation.getValue=function(){return sn.IDENTITY},this._aimLeftPosition=new hC,this._aimLeftPosition.getValue=function(){return Yi.ZERO},this._aimLeftOrientation=new oC,this._aimLeftOrientation.getValue=function(){return sn.IDENTITY},this._aimRightPosition=new hC,this._aimRightPosition.getValue=function(){return Yi.ZERO},this._aimRightOrientation=new oC,this._aimRightOrientation.getValue=function(){return sn.IDENTITY}},n(t,[{key:"buttonNorth",get:function(){return this._buttonNorth}},{key:"buttonEast",get:function(){return this._buttonEast}},{key:"buttonWest",get:function(){return this._buttonWest}},{key:"buttonSouth",get:function(){return this._buttonSouth}},{key:"buttonTriggerLeft",get:function(){return this._buttonTriggerLeft}},{key:"buttonTriggerRight",get:function(){return this._buttonTriggerRight}},{key:"triggerLeft",get:function(){return this._triggerLeft}},{key:"triggerRight",get:function(){return this._triggerRight}},{key:"gripLeft",get:function(){return this._gripLeft}},{key:"gripRight",get:function(){return this._gripRight}},{key:"leftStick",get:function(){return this._leftStick}},{key:"rightStick",get:function(){return this._rightStick}},{key:"buttonLeftStick",get:function(){return this._buttonLeftStick}},{key:"buttonRightStick",get:function(){return this._buttonRightStick}},{key:"buttonOptions",get:function(){return this._buttonOptions}},{key:"buttonStart",get:function(){return this._buttonStart}},{key:"handLeftPosition",get:function(){return this._handLeftPosition}},{key:"handLeftOrientation",get:function(){return this._handLeftOrientation}},{key:"handRightPosition",get:function(){return this._handRightPosition}},{key:"handRightOrientation",get:function(){return this._handRightOrientation}},{key:"aimLeftPosition",get:function(){return this._aimLeftPosition}},{key:"aimLeftOrientation",get:function(){return this._aimLeftOrientation}},{key:"aimRightPosition",get:function(){return this._aimRightPosition}},{key:"aimRightOrientation",get:function(){return this._aimRightOrientation}}]),t}();!function(t){t[t.VIEW_LEFT=0]="VIEW_LEFT",t[t.VIEW_RIGHT=3]="VIEW_RIGHT",t[t.HEAD_MIDDLE=6]="HEAD_MIDDLE"}(pC||(pC={}));var yC,vC,SC=function(){function t(){var t;this._eventTarget=new Du,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={})[pC.VIEW_LEFT]={position:Yi.ZERO,orientation:sn.IDENTITY},t[pC.VIEW_RIGHT]={position:Yi.ZERO,orientation:sn.IDENTITY},t[pC.HEAD_MIDDLE]={position:Yi.ZERO,orientation:sn.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(Nx.HMD_POSE_INPUT,new Xx(Nx.HMD_POSE_INPUT,this))}},e._on=function(t,e,i){this._eventTarget.on(t,e,i)},e._updateWebPoseState=function(t){t.code!==pC.VIEW_LEFT&&t.code!==pC.VIEW_RIGHT&&t.code!==pC.HEAD_MIDDLE||(this._webPoseState[t.code]={position:new Yi(t.position.x,t.position.y,t.position.z),orientation:new sn(t.orientation.x,t.orientation.y,t.orientation.z,t.orientation.w)})},e._initInputSource=function(){var t=this;this._viewLeftPosition=new hC,this._viewLeftPosition.getValue=function(){return t._webPoseState[pC.VIEW_LEFT].position},this._viewLeftOrientation=new oC,this._viewLeftOrientation.getValue=function(){return t._webPoseState[pC.VIEW_LEFT].orientation},this._viewRightPosition=new hC,this._viewRightPosition.getValue=function(){return t._webPoseState[pC.VIEW_RIGHT].position},this._viewRightOrientation=new oC,this._viewRightOrientation.getValue=function(){return t._webPoseState[pC.VIEW_RIGHT].orientation},this._headMiddlePosition=new hC,this._headMiddlePosition.getValue=function(){return t._webPoseState[pC.HEAD_MIDDLE].position},this._headMiddleOrientation=new oC,this._headMiddleOrientation.getValue=function(){return t._webPoseState[pC.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}(),AC=function(){function t(){this._eventTarget=new Du,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 hC,this._handheldPosition.getValue=function(){return Yi.ZERO},this._handheldOrientation=new oC,this._handheldOrientation.getValue=function(){return sn.IDENTITY}},n(t,[{key:"handheldPosition",get:function(){return this._handheldPosition}},{key:"handheldOrientation",get:function(){return this._handheldOrientation}}]),t}(),TC={Backspace:zx.BACKSPACE,Tab:zx.TAB,Enter:zx.ENTER,ShiftLeft:zx.SHIFT_LEFT,ControlLeft:zx.CTRL_LEFT,AltLeft:zx.ALT_LEFT,ShiftRight:zx.SHIFT_RIGHT,ControlRight:zx.CTRL_RIGHT,AltRight:zx.ALT_RIGHT,Pause:zx.PAUSE,CapsLock:zx.CAPS_LOCK,Escape:zx.ESCAPE,Space:zx.SPACE,PageUp:zx.PAGE_UP,PageDown:zx.PAGE_DOWN,End:zx.END,Home:zx.HOME,ArrowLeft:zx.ARROW_LEFT,ArrowUp:zx.ARROW_UP,ArrowRight:zx.ARROW_RIGHT,ArrowDown:zx.ARROW_DOWN,Insert:zx.INSERT,Delete:zx.DELETE,Digit0:zx.DIGIT_0,Digit1:zx.DIGIT_1,Digit2:zx.DIGIT_2,Digit3:zx.DIGIT_3,Digit4:zx.DIGIT_4,Digit5:zx.DIGIT_5,Digit6:zx.DIGIT_6,Digit7:zx.DIGIT_7,Digit8:zx.DIGIT_8,Digit9:zx.DIGIT_9,KeyA:zx.KEY_A,KeyB:zx.KEY_B,KeyC:zx.KEY_C,KeyD:zx.KEY_D,KeyE:zx.KEY_E,KeyF:zx.KEY_F,KeyG:zx.KEY_G,KeyH:zx.KEY_H,KeyI:zx.KEY_I,KeyJ:zx.KEY_J,KeyK:zx.KEY_K,KeyL:zx.KEY_L,KeyM:zx.KEY_M,KeyN:zx.KEY_N,KeyO:zx.KEY_O,KeyP:zx.KEY_P,KeyQ:zx.KEY_Q,KeyR:zx.KEY_R,KeyS:zx.KEY_S,KeyT:zx.KEY_T,KeyU:zx.KEY_U,KeyV:zx.KEY_V,KeyW:zx.KEY_W,KeyX:zx.KEY_X,KeyY:zx.KEY_Y,KeyZ:zx.KEY_Z,Numpad0:zx.NUM_0,Numpad1:zx.NUM_1,Numpad2:zx.NUM_2,Numpad3:zx.NUM_3,Numpad4:zx.NUM_4,Numpad5:zx.NUM_5,Numpad6:zx.NUM_6,Numpad7:zx.NUM_7,Numpad8:zx.NUM_8,Numpad9:zx.NUM_9,NumpadMultiply:zx.NUM_MULTIPLY,NumpadAdd:zx.NUM_PLUS,NumpadSubtract:zx.NUM_SUBTRACT,NumpadDecimal:zx.NUM_DECIMAL,NumpadDivide:zx.NUM_DIVIDE,NumpadEnter:zx.NUM_ENTER,F1:zx.F1,F2:zx.F2,F3:zx.F3,F4:zx.F4,F5:zx.F5,F6:zx.F6,F7:zx.F7,F8:zx.F8,F9:zx.F9,F10:zx.F10,F11:zx.F11,F12:zx.F12,NumLock:zx.NUM_LOCK,ScrollLock:zx.SCROLL_LOCK,Semicolon:zx.SEMICOLON,Equal:zx.EQUAL,Comma:zx.COMMA,Minus:zx.DASH,Period:zx.PERIOD,Slash:zx.SLASH,Backquote:zx.BACK_QUOTE,BracketLeft:zx.BRACKET_LEFT,Backslash:zx.BACKSLASH,BracketRight:zx.BRACKET_RIGHT,Quote:zx.QUOTE},EC=function(){function t(){this._eventTarget=new Du,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,TC[i]||zx.NONE);return new kx(n,e)},e._handleKeyboardDown=function(t){if(t.stopPropagation(),t.preventDefault(),t.repeat){var e=this._getInputEvent(t,Nx.KEY_PRESSING);this._eventTarget.emit(Nx.KEY_PRESSING,e)}else{var i=this._getInputEvent(t,Nx.KEY_DOWN);this._eventTarget.emit(Nx.KEY_DOWN,i)}},e._handleKeyboardUp=function(t){var e=this._getInputEvent(t,Nx.KEY_UP);t.stopPropagation(),t.preventDefault(),this._eventTarget.emit(Nx.KEY_UP,e)},t}(),bC=function(){function t(){this._canvas=void 0,this._eventTarget=new Du,this._pointLocked=!1,this._isPressed=!1,this._preMousePos=new yn,this._handleMouseDown=void 0,this._handleMouseMove=void 0,this._handleMouseUp=void 0,Gu.hasFeature(Fu.EVENT_MOUSE)&&(this._canvas=document.getElementById("GameCanvas"),this._canvas||console.warn("failed to access canvas"),this._handleMouseDown=this._createCallback(Nx.MOUSE_DOWN),this._handleMouseMove=this._createCallback(Nx.MOUSE_MOVE),this._handleMouseUp=this._createCallback(Nx.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 En(e.x,e.y,e.width,e.height):new En(0,0,0,0)},e._getLocation=function(t){var e=this._getCanvasRect(),i=al.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 yn(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 Nx.MOUSE_DOWN:null===(n=e._canvas)||void 0===n||n.focus(),e._isPressed=!0;break;case Nx.MOUSE_UP:e._isPressed=!1;break;case Nx.MOUSE_MOVE:o=1&a?Gx.BUTTON_LEFT:2&a?Gx.BUTTON_RIGHT:4&a?Gx.BUTTON_MIDDLE:Gx.BUTTON_MISSING}var h=new Gx(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=Nx.MOUSE_WHEEL,i=this._getLocation(t),n=t.button,r=new Gx(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}(),xC=new yn,CC=new(function(){function t(){this._touchMap=void 0,this._maxTouches=8,this._touchMap=new Map}var e=t.prototype;return e._cloneTouch=function(t){var e=t.getID();t.getStartLocation(xC);var i=new qx(xC.x,xC.y,e);return t.getLocation(xC),i.setPoint(xC.x,xC.y),t.getPreviousLocation(xC),i.setPrevPoint(xC),i},e._createTouch=function(t,e,i){if(this._touchMap.has(t))console.log("Cannot create the same touch object.");else{if(!this._checkTouchMapSizeMoreThanMax(t)){var n=new qx(e,i,t);return this._touchMap.set(t,n),this._updateTouch(n,e,i),this._cloneTouch(n)}console.log("The touches is more than MAX_TOUCHES.")}},e.releaseTouch=function(t){this._touchMap.has(t)&&this._touchMap.delete(t)},e.getTouch=function(t,e,i){var n=this._touchMap.get(t);return n?this._updateTouch(n,e,i):n=this._createTouch(t,e,i),n?this._cloneTouch(n):void 0},e.getAllTouches=function(){var t=this,e=[];return this._touchMap.forEach((function(i){if(i){var n=t._cloneTouch(i);e.push(n)}})),e},e._updateTouch=function(t,e,i){t.getLocation(xC),t.setPrevPoint(xC),t.setPoint(e,i)},e._checkTouchMapSizeMoreThanMax=function(t){var e=this;if(this._touchMap.has(t))return!1;var i=be.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>be.TOUCH_TIMEOUT&&(console.log("The touches is more than MAX_TOUCHES, release touch id "+t.getID()+"."),e.releaseTouch(t.getID()))})),i>=this._touchMap.size},t}()),RC=function(){function t(){this._canvas=void 0,this._eventTarget=new Du,Gu.hasFeature(Fu.INPUT_TOUCH)&&(this._canvas=document.getElementById("GameCanvas"),this._canvas||console.warn("failed to access canvas"),this._registerEvent())}var e=t.prototype;return e._registerEvent=function(){var t,e,i,n;null===(t=this._canvas)||void 0===t||t.addEventListener("touchstart",this._createCallback(Nx.TOUCH_START)),null===(e=this._canvas)||void 0===e||e.addEventListener("touchmove",this._createCallback(Nx.TOUCH_MOVE)),null===(i=this._canvas)||void 0===i||i.addEventListener("touchend",this._createCallback(Nx.TOUCH_END)),null===(n=this._canvas)||void 0===n||n.addEventListener("touchcancel",this._createCallback(Nx.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=CC.getTouch(u,l.x,l.y);c&&(t!==Nx.TOUCH_END&&t!==Nx.TOUCH_CANCEL||CC.releaseTouch(u),s.push(c))}}if(i.stopPropagation(),i.target===e._canvas&&i.preventDefault(),t===Nx.TOUCH_START&&(null===(n=e._canvas)||void 0===n||n.focus()),s.length>0){var _=new Ux(s,!1,t,be.ENABLE_MULTI_TOUCH?CC.getAllTouches():s);e._eventTarget.emit(t,_)}}},e._getCanvasRect=function(){var t=this._canvas,e=null==t?void 0:t.getBoundingClientRect();return e?new En(e.x,e.y,e.width,e.height):new En(0,0,0,0)},e._getLocation=function(t,e){if(globalThis.__globalXR&&globalThis.__globalXR.ar&&globalThis.__globalXR.ar.isWebXR())return new yn(t.clientX,t.clientY);var i=t.clientX-e.x,n=e.y+e.height-t.clientY;if(al.isFrameRotated){var r=i;i=e.height-n,n=r}var s=al.devicePixelRatio;return new yn(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"}(vC||(vC={}));var wC=function(){function t(t){this.priority=vC.GLOBAL,this._inputEventTarget=void 0,this._inputEventTarget=t}return t.prototype.dispatchEvent=function(t){return this._inputEventTarget.emit(t.type,t),!0},t}(),IC=((yC={})[Nx.MOUSE_DOWN]=Nx.TOUCH_START,yC[Nx.MOUSE_MOVE]=Nx.TOUCH_MOVE,yC[Nx.MOUSE_UP]=Nx.TOUCH_END,yC),BC=t("el",function(){function t(){this._dispatchImmediately=!0,this._eventTarget=new Du,this._touchInput=new RC,this._mouseInput=new bC,this._keyboardInput=new EC,this._accelerometerInput=new Kx,this._handleInput=new gC,this._hmdInput=new SC,this._handheldInput=new AC,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 wC(this._eventTarget),this._registerEventDispatcher(this._inputEventDispatcher),dC._init()}var e=t.prototype;return e._dispatchMouseDownEvent=function(t){var e,i;null===(e=(i=this._mouseInput).dispatchMouseDownEvent)||void 0===e||e.call(i,t)},e._dispatchMouseMoveEvent=function(t){var e,i;null===(e=(i=this._mouseInput).dispatchMouseMoveEvent)||void 0===e||e.call(i,t)},e._dispatchMouseUpEvent=function(t){var e,i;null===(e=(i=this._mouseInput).dispatchMouseUpEvent)||void 0===e||e.call(i,t)},e._dispatchMouseScrollEvent=function(t){var e,i;null===(e=(i=this._mouseInput).dispatchScrollEvent)||void 0===e||e.call(i,t)},e._dispatchKeyboardDownEvent=function(t){var e,i;null===(e=(i=this._keyboardInput).dispatchKeyboardDownEvent)||void 0===e||e.call(i,t)},e._dispatchKeyboardUpEvent=function(t){var e,i;null===(e=(i=this._keyboardInput).dispatchKeyboardUpEvent)||void 0===e||e.call(i,t)},e.on=function(t,e,i){return this._eventTarget.on(t,e,i),e},e.once=function(t,e,i){return this._eventTarget.once(t,e,i),e},e.off=function(t,e,i){this._eventTarget.off(t,e,i)},e.setAccelerometerEnabled=function(t){t?this._accelerometerInput.start():this._accelerometerInput.stop()},e.setAccelerometerInterval=function(t){this._accelerometerInput.setInterval(t)},e._simulateEventTouch=function(t){var e=IC[t.type],i=CC.getTouch(0,t.getLocationX(),t.getLocationY());if(i){var n=[i],r=new Ux(n,!1,e,e===Nx.TOUCH_END?[]:n);r.windowId=t.windowId,e===Nx.TOUCH_END&&CC.releaseTouch(0),this._dispatchOrPushEventTouch(r,this._eventTouchList)}},e._registerEventDispatcher=function(t){this._eventDispatcherList.push(t),this._eventDispatcherList.sort((function(t,e){return e.priority-t.priority}))},e._emitEvent=function(t){for(var e=this._eventDispatcherList.length,i=0;i<e;++i){var n=this._eventDispatcherList[i];try{if(!n.dispatchEvent(t))break}catch(e){console.error("Error occurs in an event listener: "+t.type),console.error(e)}}},e._registerEvent=function(){var t=this;if(ul.hasFeature(ul.Feature.INPUT_TOUCH)){var e=this._eventTouchList;this._touchInput.on(Nx.TOUCH_START,(function(i){t._dispatchOrPushEventTouch(i,e)})),this._touchInput.on(Nx.TOUCH_MOVE,(function(i){t._dispatchOrPushEventTouch(i,e)})),this._touchInput.on(Nx.TOUCH_END,(function(i){t._dispatchOrPushEventTouch(i,e)})),this._touchInput.on(Nx.TOUCH_CANCEL,(function(i){t._dispatchOrPushEventTouch(i,e)}))}if(ul.hasFeature(ul.Feature.EVENT_MOUSE)){var i=this._eventMouseList;this._mouseInput.on(Nx.MOUSE_DOWN,(function(e){t._needSimulateTouchMoveEvent=!0,t._simulateEventTouch(e),t._dispatchOrPushEvent(e,i)})),this._mouseInput.on(Nx.MOUSE_MOVE,(function(e){t._needSimulateTouchMoveEvent&&t._simulateEventTouch(e),t._dispatchOrPushEvent(e,i)})),this._mouseInput.on(Nx.MOUSE_UP,(function(e){t._needSimulateTouchMoveEvent=!1,t._simulateEventTouch(e),t._dispatchOrPushEvent(e,i)})),this._mouseInput.on(Nx.MOUSE_WHEEL,(function(e){t._dispatchOrPushEvent(e,i)}))}if(ul.hasFeature(ul.Feature.EVENT_KEYBOARD)){var n=this._eventKeyboardList;this._keyboardInput.on(Nx.KEY_DOWN,(function(e){t._dispatchOrPushEvent(e,n)})),this._keyboardInput.on(Nx.KEY_PRESSING,(function(e){t._dispatchOrPushEvent(e,n)})),this._keyboardInput.on(Nx.KEY_UP,(function(e){t._dispatchOrPushEvent(e,n)}))}if(ul.hasFeature(ul.Feature.EVENT_ACCELEROMETER)){var r=this._eventAccelerationList;this._accelerometerInput.on(Nx.DEVICEMOTION,(function(e){t._dispatchOrPushEvent(e,r)}))}if(ul.hasFeature(ul.Feature.EVENT_GAMEPAD)){var s=this._eventGamepadList;dC._on(Nx.GAMEPAD_CHANGE,(function(e){t._dispatchOrPushEvent(e,s)})),dC._on(Nx.GAMEPAD_INPUT,(function(e){t._dispatchOrPushEvent(e,s)})),dC._on(Nx.HANDLE_POSE_INPUT,(function(e){t._dispatchOrPushEvent(e,s)}))}if(ul.hasFeature(ul.Feature.EVENT_HANDLE)){var a=this._eventHandleList;this._handleInput._on(Nx.HANDLE_INPUT,(function(e){t._dispatchOrPushEvent(e,a)})),this._handleInput._on(Nx.HANDLE_POSE_INPUT,(function(e){t._dispatchOrPushEvent(e,a)}))}if(ul.hasFeature(ul.Feature.EVENT_HMD)){var o=this._eventHMDList;this._hmdInput._on(Nx.HMD_POSE_INPUT,(function(e){t._dispatchOrPushEvent(e,o)}))}if(ul.hasFeature(ul.Feature.EVENT_HANDHELD)){var h=this._eventHandheldList;this._handheldInput._on(Nx.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,f=0,d=_.length;f<d;++f)for(var p=_[f],m=p.getTouches(),g=m.length,y=0;y<g;++y)p.touch=m[y],p.propagationStopped=p.propagationImmediateStopped=!1,this._emitEvent(p);for(var v=this._eventKeyboardList,S=0,A=v.length;S<A;++S){var T=v[S];this._emitEvent(T)}for(var E=this._eventAccelerationList,b=0,x=E.length;b<x;++b){var C=E[b];this._emitEvent(C)}for(var R=this._eventGamepadList,w=0,I=R.length;w<I;++w){var B=R[w];this._emitEvent(B)}for(var D=this._eventHandleList,P=0,O=D.length;P<O;++P){var M=D[P];this._emitEvent(M)}this._clearEvents()},t}());BC.EventType=Nx;var DC=t("ek",new BC),PC=t("en",function(t){function e(){var e;return e=t.call(this)||this,DC.on(Nx.MOUSE_DOWN,(function(t){e.emit(Mx.MOUSE_DOWN,t)})),DC.on(Nx.MOUSE_MOVE,(function(t){e.emit(Mx.MOUSE_MOVE,t)})),DC.on(Nx.MOUSE_UP,(function(t){e.emit(Mx.MOUSE_UP,t)})),DC.on(Nx.MOUSE_WHEEL,(function(t){e.emit(Mx.MOUSE_WHEEL,t)})),DC.on(Nx.TOUCH_START,(function(t){e.emit(Mx.TOUCH_START,t.touch,t)})),DC.on(Nx.TOUCH_MOVE,(function(t){e.emit(Mx.TOUCH_MOVE,t.touch,t)})),DC.on(Nx.TOUCH_END,(function(t){e.emit(Mx.TOUCH_END,t.touch,t)})),DC.on(Nx.TOUCH_CANCEL,(function(t){e.emit(Mx.TOUCH_CANCEL,t.touch,t)})),DC.on(Nx.KEY_DOWN,(function(t){e.emit(Mx.KEY_DOWN,t)})),DC.on(Nx.KEY_PRESSING,(function(t){e.emit(Mx.KEY_DOWN,t)})),DC.on(Nx.KEY_UP,(function(t){e.emit(Mx.KEY_UP,t)})),DC.on(Nx.DEVICEMOTION,(function(t){e.emit(Mx.DEVICEMOTION,t)})),e}s(e,t);var i=e.prototype;return i.setAccelerometerEnabled=function(t){DC.setAccelerometerEnabled(t)},i.setAccelerometerInterval=function(t){DC.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}(Du));PC.EventType=Mx,v.SystemEvent=PC;var OC,MC,NC,LC,FC,kC,GC,VC,UC=t("em",new PC);v.systemEvent=UC,nt(Mx,"Node.EventType",[{name:"POSITION_PART",newName:"TRANSFORM_CHANGED"},{name:"ROTATION_PART",newName:"TRANSFORM_CHANGED"},{name:"SCALE_PART",newName:"TRANSFORM_CHANGED"}]),nt(Lx,"Event",[{name:"ACCELERATION",newName:"DEVICEMOTION",target:PC.EventType,targetName:"SystemEvent.EventType"}]),st(Lx,"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"}]),nt(Gx,"EventMouse",["DOWN","UP","MOVE"].map((function(t){return{name:t,newName:"MOUSE_"+t,target:PC.EventType,targetName:"SystemEvent.EventType"}}))),nt(Gx,"EventMouse",[{name:"SCROLL",newName:"MOUSE_WHEEL",target:PC.EventType,targetName:"SystemEvent.EventType"}]),st(Gx.prototype,"EventMouse.prototype",[{name:"eventType",suggest:"please use EventMouse.prototype.type instead"}]),nt(Ux,"EventTouch",[{name:"BEGAN",newName:"TOUCH_START",target:PC.EventType,targetName:"SystemEvent.EventType"}]),nt(Ux,"EventTouch",[{name:"MOVED",newName:"TOUCH_MOVE",target:PC.EventType,targetName:"SystemEvent.EventType"}]),nt(Ux,"EventTouch",[{name:"ENDED",newName:"TOUCH_END",target:PC.EventType,targetName:"SystemEvent.EventType"}]),nt(Ux,"EventTouch",[{name:"CANCELLED",newName:"TOUCH_CANCEL",target:PC.EventType,targetName:"SystemEvent.EventType"}]),st(Ux.prototype,"EventTouch.prototype",[{name:"getEventCode",suggest:"please use EventTouch.prototype.type instead"}]),nt(Ux.prototype,"EventTouch.prototype",[{name:"getUILocationInView",newName:"getLocationInView",target:Ux,targetName:"EventTouch"}]),st(be.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}}))),st(be.KEY,"macro.KEY",[{name:"shift",suggest:"please use KeyCode.SHIFT_LEFT instead"}]),st(be.KEY,"macro.KEY",[{name:"ctrl",suggest:"please use KeyCode.CTRL_LEFT instead"}]),st(be.KEY,"macro.KEY",[{name:"alt",suggest:"please use KeyCode.ALT_LEFT instead"}]),st(be,"macro",[{name:"KEY",suggest:"please use KeyCode instead"}]),function(t){t[t.VERTICAL=0]="VERTICAL",t[t.HORIZONTAL=1]="HORIZONTAL"}(OC||(OC={})),function(t){t[t.ORTHO=0]="ORTHO",t[t.PERSPECTIVE=1]="PERSPECTIVE"}(MC||(MC={})),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"}(NC||(NC={})),function(t){t[t.ISO100=0]="ISO100",t[t.ISO200=1]="ISO200",t[t.ISO400=2]="ISO400",t[t.ISO800=3]="ISO800"}(LC||(LC={})),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"}(FC||(FC={})),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"}(kC||(kC={})),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"}(GC||(GC={})),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"}(VC||(VC={}));var zC=[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],HC=[1,.5,1/4,1/8,1/15,1/30,1/60,.008,.004,.002,.001,5e-4,1/4e3],WC=[100,200,400,800],XC=new Yi,jC=new Yi,YC=new fn,qC=oc.STENCIL<<1,KC=[],JC=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=OC.VERTICAL,this._fov=Ri(45),this._nearClip=1,this._farClip=1e3,this._clearColor=new bc(.2,.2,.2,1),this._viewport=new En(0,0,1,1),this._orientedViewport=new En(0,0,1,1),this._curTransform=El.IDENTITY,this._isProjDirty=!0,this._matView=new fn,this._matProj=new fn,this._matProjInv=new fn,this._matViewProj=new fn,this._matViewProjInv=new fn,this._frustum=new us,this._forward=new Yi,this._position=new Yi,this._priority=0,this._aperture=NC.F16_0,this._apertureValue=void 0,this._shutter=FC.D125,this._shutterValue=0,this._iso=LC.ISO100,this._isoValue=0,this._window=null,this._width=1,this._height=1,this._clearFlag=oc.NONE,this._clearDepth=1,this._visibility=my,this._exposure=0,this._clearStencil=0,this._geometryRenderer=null,this._windowId=0,this._cameraType=kC.DEFAULT,this._trackingType=GC.NO_TRACKING,this._usage=VC.GAME,this._device=t,this._apertureValue=zC[this._aperture],this._shutterValue=HC[this._shutter],this._isoValue=WC[this._iso],this._aspect=this.screenScale=1,this._frustum.accurate=!0,!KC.length){var e=t.capabilities.clipSpaceSignY;KC[El.IDENTITY]=new fn(1,0,0,0,0,e),KC[El.ROTATE_90]=new fn(0,1,0,0,-e,0),KC[El.ROTATE_180]=new fn(-1,0,0,0,0,-e),KC[El.ROTATE_270]=new fn(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||El.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=oc.NONE,this.clearDepth=1,this.visibility=my,this._name=t.name,this._proj=t.projection,this._priority=t.priority||0,this._aspect=this.screenScale=1,this.updateExposure(),this.changeTargetWindow(t.window)},e.destroy=function(){var t;this._node=null,this.detachFromScene(),this._window&&(this._window.detachCamera(this),this.window=null),this._name=null,null===(t=this._geometryRenderer)||void 0===t||t.destroy()},e.attachToScene=function(t){this._enabled=!0,this._scene=t},e.detachFromScene=function(){this._enabled=!1,this._scene=null},e.resize=function(t,e){this._window&&(this._width=t,this._height=e,this._aspect=t*this._viewport.width/(e*this._viewport.height),this._isProjDirty=!0)},e.setFixedSize=function(t,e){this._width=t,this._height=e,this._updateAspect(),this.isWindowSize=!1},e.syncCameraEditor=function(){},e.update=function(t){var e;if(void 0===t&&(t=!1),this._node){var i=!1,n=globalThis.__globalXR;if(n&&n.isWebXR&&n.webXRWindowMap&&n.updateViewport){var r=n.webXRMatProjs?1/n.webXRMatProjs.length:1,s=n.webXRWindowMap.get(this._window);this.setViewportInOrientedSpace(new En(r*s,0,r,1))}(this._node.hasChangedFlags||t)&&(fn.invert(this._matView,this._node.worldMatrix),this._forward.x=-this._matView.m02,this._forward.y=-this._matView.m06,this._forward.z=-this._matView.m10,fn.multiply(this._matView,(new fn).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||El.IDENTITY;if(this._isProjDirty||this._curTransform!==o){this._curTransform=o;var h=this._device.capabilities.clipSpaceSignY;if(this._proj===MC.PERSPECTIVE)if(n&&n.isWebXR&&n.webXRWindowMap&&n.webXRMatProjs){var u=n.webXRWindowMap.get(this._window);this._matProj.set(n.webXRMatProjs[u])}else fn.perspective(this._matProj,this._fov,this._aspect,this._nearClip,this._farClip,this._fovAxis===OC.VERTICAL,this._device.capabilities.clipSpaceMinZ,h,o);else{var l=this._orthoHeight*this._aspect,c=this._orthoHeight;fn.ortho(this._matProj,-l,l,-c,c,this._nearClip,this._farClip,this._device.capabilities.clipSpaceMinZ,h,o)}fn.invert(this._matProjInv,this._matProj),i=!0,this._isProjDirty=!1}i&&(fn.multiply(this._matViewProj,this._matProj,this._matView),fn.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||El.IDENTITY){case El.ROTATE_90:this._viewport.x=1-s-r,this._viewport.y=i,this._viewport.width=r,this._viewport.height=n;break;case El.ROTATE_180:this._viewport.x=1-i-n,this._viewport.y=1-s-r,this._viewport.width=n,this._viewport.height=r;break;case El.ROTATE_270:this._viewport.x=s,this._viewport.y=1-i-n,this._viewport.width=r,this._viewport.height=n;break;case El.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||El.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===MC.PERSPECTIVE,l=this._device.capabilities.clipSpaceSignY,c=_n[this._curTransform];Yi.set(XC,(e-s)/o*2-1,(i-a)/h*2-1,u?1:-1);var _=XC.x,f=XC.y;return XC.x=_*c[0]+f*c[2]*l,XC.y=_*c[1]+f*c[3]*l,Yi.transformMat4(u?XC:t.o,XC,this._matViewProjInv),u?(this._node.getWorldPosition(jC),zn.fromPoints(t,jC,XC)):Yi.transformQuat(t.d,Yi.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=_n[this._curTransform];if(this._proj===MC.PERSPECTIVE){Yi.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,Yi.transformMat4(t,t,this._matViewProjInv),this._node&&this._node.getWorldPosition(XC),Yi.lerp(t,XC,t,Ci(this._nearClip/this._farClip,1,e.z))}else{Yi.set(t,(e.x-r)/a*2-1,(e.y-s)/o*2-1,2*e.z-1);var _=t.x,f=t.y;t.x=_*u[0]+f*u[2]*h,t.y=_*u[1]+f*u[3]*h,Yi.transformMat4(t,t,this._matViewProjInv)}return t},e.worldToScreen=function(t,e){var i=this._device.capabilities.clipSpaceSignY,n=_n[this._curTransform];Yi.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){fn.multiply(t,this._matViewProj,e),fn.multiply(t,KC[this._curTransform],t);var r=i/2,s=n/2;return fn.identity(YC),fn.transform(YC,YC,Yi.set(XC,r,s,0)),fn.scale(YC,YC,Yi.set(XC,r,s,1)),fn.multiply(t,YC,t),t},e.calculateObliqueMat=function(t){var e=new zi(Math.sign(t.x),Math.sign(t.y),1,1).transformMat4(this._matProjInv),i=new zi(this._matProj.m03,this._matProj.m07,this._matProj.m11,this._matProj.m15),n=2/zi.dot(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=VC.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=zC[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=HC[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=WC[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}(),QC=new Yi,ZC=$n.create(0,0,0,1),$C=new is(0,0,0,.5,.5,.5),tR=new is,eR=new _u((function(){return{model:null,depth:0}}),128);function iR(t,e){var i=0;t.node&&(Yi.subtract(QC,t.node.worldPosition,e.position),i=Yi.dot(QC,e.forward));var n=eR.alloc();return n.model=t,n.depth=i,n}function nR(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||($n.set(ZC,a.position.x,a.position.y,a.position.z,a.range),Hr.sphereFrustum(ZC,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||($n.set(ZC,u.position.x,u.position.y,u.position.z,u.range),Hr.sphereFrustum(ZC,e.frustum)&&n.push(u))}for(var l=e.scene.pointLights,c=0;c<l.length;c++){var _=l[c];_.baked||($n.set(ZC,_.position.x,_.position.y,_.position.z,_.range),Hr.sphereFrustum(ZC,e.frustum)&&n.push(_))}for(var f=e.scene.rangedDirLights,d=0;d<f.length;d++){var p=f[d];is.transform(tR,$C,p.node.getWorldMatrix()),Hr.aabbFrustum(tR,e.frustum)&&n.push(p)}i.validPunctualLights=n}function rR(t,e){var i=e.scene,n=i.mainLight,r=t.pipelineSceneData,s=r.shadows,a=r.skybox,o=r.csmLayers,h=r.renderObjects;eR.freeArray(h),h.length=0;var u=o.castShadowObjects;u.length=0;var l=o.layerObjects;l.clear(),s.enabled&&(t.pipelineUBO.updateShadowUBORange(tg.SHADOW_COLOR_OFFSET,s.shadowColor),s.type===QS.ShadowMap&&n&&n.node&&o.update(r,e)),e.clearFlag&qC&&(a.enabled&&a.model?h.push(iR(a.model,e)):e.cameraUsage!==VC.EDITOR&&e.cameraUsage!==VC.SCENE_VIEW&&v.warnID(15100,e.name));var c=i.models,_=e.visibility;function f(t){if(t.enabled){if(i.isCulledByLod(e,t))return;if(t.castShadow&&(u.push(iR(t,e)),l.push(iR(t,e))),t.node&&(_&t.node.layer)===t.node.layer||_&t.visFlags){if(t.worldBounds&&!Hr.aabbFrustum(t.worldBounds,e.frustum))return;h.push(iR(t,e))}}}for(var d=0;d<c.length;d++)f(c[d])}var sR,aR=new s_(null),oR=function(){function t(){this._device=null,this._passes=null,this._shaders=null,this._subMesh=null,this._patches=null,this._priority=Fm.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=of.gfxDevice,aR.layout=e[0].localSetLayout,this._inputAssembler=this._device.createInputAssembler(t.iaInfo),this._descriptorSet=this._device.createDescriptorSet(aR);var r=v.director.root.pipeline.pipelineSceneData.getOcclusionQueryPass();if(r){var s=new s_(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=Fm.DEFAULT;var a=v.rendering;if((!a||!a.enableEffectImport)&&e[0].phase===CS("reflection")||Ay()&&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 Oc(Pl.TEX2D,Ol.STORAGE|Ol.TRANSFER_SRC|Ol.SAMPLED,xl.RGBA8,o,h)),this.descriptorSet.bindTexture(Kg,this._reflectionTex),this._reflectionSampler=this._device.getSampler(new Nc(kl.LINEAR,kl.LINEAR,kl.NONE,Gl.CLAMP,Gl.CLAMP,Gl.CLAMP)),this.descriptorSet.bindSampler(Kg,this._reflectionSampler),this.descriptorSet.bindTexture(Zg,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=Fm.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=(Rg.SH_QUADRATIC_R_OFFSET-Rg.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(bl.INSTANCED_ARRAYS)){for(var i=0,n=0;n<t.length;n++){var r=t[n];r.isInstanced&&(i+=m_[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 Xc;u.format=h.format,u.name=h.name,u.isNormalized=h.isNormalized,u.location=h.location,s.attributes.push(u);var l=m_[h.format],c=new(x_(l))(s.buffer.buffer,a,l.count);s.views.push(c),a+=l.size}}e.batchingScheme===ES.INSTANCING&&e.getInstancedBuffer().destroy(),this.instancedWorldMatrixIndex=this.getInstancedAttributeIndex(mg),this.instancedSHIndex=this.getInstancedAttributeIndex(gg)}},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?J(12004,8):(this._passes=t,this._flushPassInfo(),this._descriptorSet&&(this._descriptorSet.destroy(),aR.layout=t[0].localSetLayout,this._descriptorSet=this._device.createDescriptorSet(aR)))}},{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}(),hR=new qc;hR.format=xl.RGBA8;var uR=new Kc;uR.format=xl.DEPTH_STENCIL;var lR,cR,_R=new Zc([hR],uR),fR={width:1,height:1,renderPassInfo:_R},dR=t("dV",Is("cc.RenderTexture")(sR=function(t){function e(){for(var e,i=arguments.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(bi(t,1,2048)),this._height=Math.floor(bi(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;fR.title=this._name,fR.width=this._width,fR.height=this._height,fR.renderPassInfo=t&&t.passInfo?t.passInfo:_R,fR.externalResLow=t&&t.externalResLow?t.externalResLow:0,fR.externalResHigh=t&&t.externalResHigh?t.externalResHigh:0,fR.externalFlag=t&&t.externalFlag?t.externalFlag:Ml.NONE,hR.barrier=of.gfxDevice.getGeneralBarrier(new $c(ql.FRAGMENT_SHADER_READ_TEXTURE,ql.FRAGMENT_SHADER_READ_TEXTURE)),this._window?(this._window.destroy(),this._window.initialize(of.gfxDevice,fR)):this._window=e.createWindow(fR)},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 J(7606),null;var a=4*i*n;if(void 0===r)r=new Uint8Array(a);else if(r.length<a)return J(7607,a),null;var o=this._getGFXDevice(),h=[],u=[],l=new Tc;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}(pd))||sR);v.RenderTexture=dR,function(t){t[t.SKYBOX=qC|oc.DEPTH_STENCIL]="SKYBOX",t[t.SOLID_COLOR=oc.ALL]="SOLID_COLOR"}(lR||(lR={})),function(t){t[t.CUBE=0]="CUBE",t[t.PLANAR=1]="PLANAR"}(cR||(cR={}));var pR,mR=[new Yi(0,-90,0),new Yi(0,90,0),new Yi(90,0,0),new Yi(-90,0,0),new Yi(0,0,0),new Yi(0,180,0)],gR=function(){function t(t){this.bakedCubeTextures=[],this.realtimePlanarTexture=null,this._resolution=256,this._clearFlag=lR.SKYBOX,this._backgroundColor=new Zi(0,0,0,255),this._visibility=my,this._probeType=cR.CUBE,this._cubemap=null,this._size=new Yi(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 Yi,this._cameraWorldRotation=new sn,this._forward=new Yi,this._up=new Yi,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=is.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===cR.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===cR.PLANAR?new yn(this.realtimePlanarTexture.width,this.realtimePlanarTexture.height):new yn(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(mR[t]),this.camera.update(!0)},e.updateBoundingBox=function(){if(this.node){this.node.updateWorldTransform();var t=this.node.getWorldPosition();is.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===cR.PLANAR){var e;if(!this.realtimePlanarTexture)return!1;if((null===(e=this.realtimePlanarTexture.window)||void 0===e?void 0:e.framebuffer)===t)return!0}else{if(0===this.bakedCubeTextures.length)return!1;for(var i=0;i<this.bakedCubeTextures.length;i++){var n;if((null===(n=this.bakedCubeTextures[i].window)||void 0===n?void 0:n.framebuffer)===t)return!0}}return!1},e.isRGBE=function(){return!0},e._syncCameraParams=function(t){this.camera.projectionType=t.projectionType,this.camera.orthoHeight=t.orthoHeight,this.camera.nearClip=t.nearClip,this.camera.farClip=t.farClip,this.camera.fov=t.fov,this.camera.visibility=t.visibility,this.camera.clearFlag=t.clearFlag,this.camera.clearColor=t.clearColor,this.camera.priority=t.priority-1,this.camera.resize(t.width,t.height)},e._createCamera=function(t){if(v.director.root,!this._camera){if(this._camera=v.director.root.createCamera(),!this._camera)return null;this._camera.initialize({name:t.name,node:t,projection:MC.PERSPECTIVE,window:v.director.root&&v.director.root.tempWindow,priority:0,cameraType:kC.DEFAULT,trackingType:GC.NO_TRACKING})}return this._camera.setViewportInOrientedSpace(new En(0,0,1,1)),this._camera.fovAxis=OC.VERTICAL,this._camera.fov=Ri(90),this._camera.orthoHeight=10,this._camera.nearClip=1,this._camera.farClip=1e3,this._camera.clearColor=this._backgroundColor,this._camera.clearDepth=1,this._camera.clearStencil=0,this._camera.clearFlag=this._clearFlag,this._camera.visibility=this._visibility,this._camera.aperture=NC.F16_0,this._camera.shutter=FC.D125,this._camera.iso=LC.ISO100,this._camera},e._resetCameraParams=function(){this.camera.projectionType=MC.PERSPECTIVE,this.camera.orthoHeight=10,this.camera.nearClip=1,this.camera.farClip=1e3,this.camera.fov=Ri(90),this.camera.priority=0,this.camera.resize(this.resolution,this.resolution),this.camera.visibility=this._visibility,this.camera.clearFlag=this._clearFlag,this.camera.clearColor=this._backgroundColor,this.cameraNode.worldPosition=this.node.worldPosition,this.cameraNode.worldRotation=this.node.worldRotation,this.camera.update(!0)},e._createTargetTexture=function(t,e){var i=new dR;return i.reset({width:t,height:e}),i},e._transformReflectionCamera=function(t){var e=Yi.dot(this.node.worldPosition,this.node.up);this._reflect(this._cameraWorldPos,t.node.worldPosition,this.node.up,e),this.cameraNode.worldPosition=this._cameraWorldPos,Yi.transformQuat(this._forward,Yi.FORWARD,t.node.worldRotation),this._reflect(this._forward,this._forward,this.node.up,0),this._forward.normalize(),this._forward.negative(),Yi.transformQuat(this._up,Yi.UP,t.node.worldRotation),this._reflect(this._up,this._up,this.node.up,0),this._up.normalize(),sn.fromViewUp(this._cameraWorldRotation,this._forward,this._up),this.cameraNode.worldRotation=this._cameraWorldRotation,this.camera.update(!0);var i=new zi(this.node.up.x,this.node.up.y,this.node.up.z,-Yi.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=Yi.clone(i);r.normalize();var s=Yi.dot(r,e)-n;return r.multiplyScalar(2*s),Yi.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();is.set(this._boundingBox,e.x,e.y,e.z,this._size.x,this._size.y,this._size.z)}},{key:"cubemap",get:function(){return this._cubemap},set:function(t){this._cubemap=t}},{key:"node",get:function(){return this._node}},{key:"camera",get:function(){return this._camera}},{key:"needRefresh",get:function(){return this._needRefresh},set:function(t){this._needRefresh=t}},{key:"needRender",get:function(){return this._needRender},set:function(t){this._needRender=t}},{key:"boundingBox",get:function(){return this._boundingBox}},{key:"cameraNode",get:function(){return this._cameraNode},set:function(t){this._cameraNode=t}},{key:"previewSphere",get:function(){return this._previewSphere},set:function(t){this._previewSphere=t}},{key:"previewPlane",get:function(){return this._previewPlane},set:function(t){this._previewPlane=t}}]),t}();!function(t){t[t.NONE=0]="NONE",t[t.BAKED_CUBEMAP=1]="BAKED_CUBEMAP",t[t.PLANAR_REFLECTION=2]="PLANAR_REFLECTION",t[t.BLEND_PROBES=3]="BLEND_PROBES",t[t.BLEND_PROBES_AND_SKYBOX=4]="BLEND_PROBES_AND_SKYBOX"}(pR||(pR={}));var yR,vR=new fn,SR=[{name:"CC_RECEIVE_SHADOW",value:!0}],AR=[{name:"CC_USE_LIGHTMAP",value:1}],TR=[{name:"CC_USE_LIGHTMAP",value:2}],ER=[{name:"CC_LIGHT_MAP_VERSION",value:2}],bR=[{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"}(yR||(yR={}));var xR,CR=new Nc(kl.LINEAR,kl.LINEAR,kl.NONE,Gl.CLAMP,Gl.CLAMP,Gl.CLAMP),RR=new Nc(kl.LINEAR,kl.LINEAR,kl.LINEAR,Gl.CLAMP,Gl.CLAMP,Gl.CLAMP),wR=function(){function t(){this.type=yR.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(dg.COUNT),this._localBuffer=null,this._localSHData=null,this._localSHBuffer=null,this._lightmap=null,this._lightmapUVParam=new zi,this._tetrahedronIndex=-1,this._lastWorldBoundCenter=new Yi(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=kp.Enum.NONE,this._priority=0,this._bakeToReflectionProbe=!0,this._reflectionProbeType=pR.NONE,this._device=of.gfxDevice}var e=t.prototype;return e.initialize=function(){this._inited||(this._receiveShadow=!0,this.castShadow=!1,this.enabled=!0,this.visFlags=kp.Enum.NONE,this._inited=!0,this._bakeToReflectionProbe=!0,this._reflectionProbeType=pR.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===QS.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&&(fn.toArray(this._localData,r,dg.MAT_WORLD_OFFSET),fn.invert(vR,r),fn.transpose(vR,vR),fn.toArray(this._localData,vR,dg.MAT_WORLD_IT_OFFSET),this._localBuffer.update(this._localData))}},e.showTetrahedron=function(){return this.isLightProbeAvailable()},e.isLightProbeAvailable=function(){if(!this._useLightProbe)return!1;var t=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<Rg.COUNT;t++)this._localSHData[t]=0;this.updateSHBuffer()}},e.updateSHUBOs=function(){if(this.isLightProbeAvailable()){var t=this._worldBounds.center;if(!t.equals(this._lastWorldBoundCenter,Ai)){var e=[],i=new zi(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,Rg.SH_LINEAR_CONST_R_OFFSET,e),this.updateSHBuffer())}}},e.createBoundingShape=function(t,e){t&&e&&(this._modelBounds||(this._modelBounds=is.create()),this._worldBounds||(this._worldBounds=is.create()),is.fromPoints(this._modelBounds,t,e),is.copy(this._worldBounds,this._modelBounds))},e._createSubModel=function(){return new oR},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){zi.toArray(this._localData,e,dg.LIGHTINGMAP_UVPARAM),this._localDataUpdated=!0,this._lightmap=t,this._lightmapUVParam=e,this.onMacroPatchesStateChanged(),t||(t=xS.get("empty-texture"));var i=t.getGFXTexture();if(i)for(var n=this._device.getSampler(t.mipmaps.length>1?RR:CR),r=this._subModels,s=0;s<r.length;s++){var a=r[s].descriptorSet;a.bindTexture(Hg,i),a.bindSampler(Hg,n),a.update()}},e.updateReflectionProbeCubemap=function(t){this._localDataUpdated=!0,this.onMacroPatchesStateChanged(),t||(t=xS.get("default-cube-texture"));var e=t.getGFXTexture();if(e)for(var i=this._device.getSampler(t.getSamplerInfo()),n=this._subModels,r=0;r<n.length;r++){var s=n[r].descriptorSet;s&&(s.bindSampler(ey,i),s.bindTexture(ey,e),s.update())}},e.updateReflectionProbeBlendCubemap=function(t){this._localDataUpdated=!0,this.onMacroPatchesStateChanged(),t||(t=xS.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(ly,i),s.bindTexture(ly,e),s.update())}},e.updateReflectionProbePlanarMap=function(t){this._localDataUpdated=!0,this.onMacroPatchesStateChanged();var e=this._device.getSampler(new Nc(kl.LINEAR,kl.LINEAR,kl.NONE,Gl.CLAMP,Gl.CLAMP,Gl.CLAMP));if(t||(t=xS.get("empty-texture").getGFXTexture()),t)for(var i=this._subModels,n=0;n<i.length;n++){var r=i[n].descriptorSet;r&&(r.bindTexture(ry,t),r.bindSampler(ry,e),r.update())}},e.updateReflectionProbeDataMap=function(t){this._localDataUpdated=!0,this.onMacroPatchesStateChanged(),t||(t=xS.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(oy,e),r.bindSampler(oy,t.getGFXSampler()),r.update())}},e.updateLocalShadowBias=function(){var t=this._localData;t[dg.LOCAL_SHADOW_BIAS+0]=this._shadowBias,t[dg.LOCAL_SHADOW_BIAS+1]=this._shadowNormalBias,this._localDataUpdated=!0},e.updateReflectionProbeId=function(){var t=this._localData;t[dg.LOCAL_SHADOW_BIAS+2]=this._reflectionProbeId,t[dg.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===cR.PLANAR)t[dg.REFLECTION_PROBE_DATA1]=e.node.up.x,t[dg.REFLECTION_PROBE_DATA1+1]=e.node.up.y,t[dg.REFLECTION_PROBE_DATA1+2]=e.node.up.z,t[dg.REFLECTION_PROBE_DATA1+3]=1,t[dg.REFLECTION_PROBE_DATA2]=1,t[dg.REFLECTION_PROBE_DATA2+1]=0,t[dg.REFLECTION_PROBE_DATA2+2]=0,t[dg.REFLECTION_PROBE_DATA2+3]=1;else{t[dg.REFLECTION_PROBE_DATA1]=e.node.worldPosition.x,t[dg.REFLECTION_PROBE_DATA1+1]=e.node.worldPosition.y,t[dg.REFLECTION_PROBE_DATA1+2]=e.node.worldPosition.z,t[dg.REFLECTION_PROBE_DATA1+3]=0,t[dg.REFLECTION_PROBE_DATA2]=e.size.x,t[dg.REFLECTION_PROBE_DATA2+1]=e.size.y,t[dg.REFLECTION_PROBE_DATA2+2]=e.size.z;var n=e.isRGBE()?1e3:0;t[dg.REFLECTION_PROBE_DATA2+3]=e.cubemap?e.cubemap.mipmapLevel+n:1+n}if(this._reflectionProbeType===pR.BLEND_PROBES||this._reflectionProbeType===pR.BLEND_PROBES_AND_SKYBOX)if(i){t[dg.REFLECTION_PROBE_BLEND_DATA1]=i.node.worldPosition.x,t[dg.REFLECTION_PROBE_BLEND_DATA1+1]=i.node.worldPosition.y,t[dg.REFLECTION_PROBE_BLEND_DATA1+2]=i.node.worldPosition.z,t[dg.REFLECTION_PROBE_BLEND_DATA1+3]=this.reflectionProbeBlendWeight,t[dg.REFLECTION_PROBE_BLEND_DATA2]=i.size.x,t[dg.REFLECTION_PROBE_BLEND_DATA2+1]=i.size.y,t[dg.REFLECTION_PROBE_BLEND_DATA2+2]=i.size.z;var r=i.isRGBE()?1e3:0;t[dg.REFLECTION_PROBE_BLEND_DATA2+3]=i.cubemap?i.cubemap.mipmapLevel+r:1+r}else this._reflectionProbeType===pR.BLEND_PROBES_AND_SKYBOX&&(t[dg.REFLECTION_PROBE_BLEND_DATA1+3]=this.reflectionProbeBlendWeight)}this._localDataUpdated=!0},e.getMacroPatches=function(){var t=this.receiveShadow?SR:null;if(null!=this._lightmap&&this.node&&this.node.scene&&!this.node.scene.globals.disableLightmap){var e=this.node.scene.globals.bakedWithStationaryMainLight?TR:AR;t=t?t.concat(e):e,this.node.scene.globals.bakedWithHighpLightmap&&(t=t.concat(ER))}this._useLightProbe&&(t=t?t.concat(bR):bR);var i=[{name:"CC_USE_REFLECTION_PROBE",value:this._reflectionProbeType}];t=t?t.concat(i):i;var n=[{name:"CC_DISABLE_DIRECTIONAL_LIGHT",value:!this._receiveDirLight}];return t?t.concat(n):n},e._updateAttributesAndBinding=function(t){var e=this._subModels[t];if(e){this._initLocalDescriptors(t),this._updateLocalDescriptors(t,e.descriptorSet),this._initLocalSHDescriptors(t),this._updateLocalSHDescriptors(t,e.descriptorSet),this._initWorldBoundDescriptors(t),e.worldBoundDescriptorSet&&this._updateWorldBoundDescriptors(t,e.worldBoundDescriptorSet);for(var i,n=[],r=new Set,s=f(e.passes);!(i=s()).done;)for(var a,o=f(i.value.getShaderVariant(e.patches).attributes);!(a=o()).done;){var h=a.value;r.has(h.name)||(n.push(h),r.add(h.name))}this._updateInstancedAttributes(n,e)}},e._updateInstancedAttributes=function(t,e){e.UpdateInstancedAttributes(t),this._localDataUpdated=!0},e._initLocalDescriptors=function(){this._localBuffer||(this._localBuffer=this._device.createBuffer(new wc(wl.UNIFORM|wl.TRANSFER_DST,Dl.DEVICE,dg.SIZE,dg.SIZE)))},e._initLocalSHDescriptors=function(){this._useLightProbe&&(this._localSHData||(this._localSHData=new Float32Array(Rg.COUNT)),this._localSHBuffer||(this._localSHBuffer=this._device.createBuffer(new wc(wl.UNIFORM|wl.TRANSFER_DST,Dl.DEVICE,Rg.SIZE,Rg.SIZE))))},e._initWorldBoundDescriptors=function(){this._worldBoundBuffer||(this._worldBoundBuffer=this._device.createBuffer(new wc(wl.UNIFORM|wl.TRANSFER_DST,Dl.DEVICE,pg.SIZE,pg.SIZE)))},e._updateLocalDescriptors=function(t,e){this._localBuffer&&e.bindBuffer(dg.BINDING,this._localBuffer)},e._updateLocalSHDescriptors=function(t,e){this._localSHBuffer&&e.bindBuffer(Rg.BINDING,this._localSHBuffer)},e._updateWorldBoundDescriptors=function(t,e){this._worldBoundBuffer&&e.bindBuffer(pg.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}(),IR=function(){function t(){this._enabled=!1,this._minPos=new Yi(0,0,0),this._maxPos=new Yi(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}(),BR=function(){function t(){this._enabled=!0,this._blurRadius=.01,this._sssIntensity=3}return t.prototype.initialize=function(t){this._enabled=t.enabled,this._blurRadius=t.blurRadius,this._sssIntensity=t.sssIntensity},n(t,[{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled=t}},{key:"blurRadius",get:function(){return this._blurRadius},set:function(t){this._blurRadius=t}},{key:"sssIntensity",get:function(){return this._sssIntensity},set:function(t){this._sssIntensity=t}}]),t}();function DR(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"}(xR||(xR={}));var PR,OR,MR,NR,LR,FR,kR,GR,VR,UR,zR,HR,WR=function(t){return 4*Math.PI*Math.PI*t*t},XR=function(){function t(){this._baked=!1,this._color=new Yi(1,1,1),this._colorTemp=6550,this._colorTempRGB=new Yi(1,1,1),this._finalColor=new Yi(1,1,1),this._scene=null,this._node=null,this._name=null,this._useColorTemperature=!1,this._type=xR.UNKNOWN,this._visibility=my}var e=t.prototype;return e.initialize=function(){this.color=new Yi(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&&Yi.multiply(this._finalColor,this._color,this._colorTempRGB)}},{key:"useColorTemperature",get:function(){return this._useColorTemperature},set:function(t){this._useColorTemperature=t,t&&Yi.multiply(this._finalColor,this._color,this._colorTempRGB)}},{key:"colorTemperature",get:function(){return this._colorTemp},set:function(t){this._colorTemp=t,DR(this._colorTempRGB,this._colorTemp),this._useColorTemperature&&Yi.multiply(this._finalColor,this._color,this._colorTempRGB)}},{key:"colorTemperatureRGB",get:function(){return this._colorTempRGB}},{key:"finalColor",get:function(){return this._finalColor}},{key:"visibility",get:function(){return this._visibility},set:function(t){this._visibility=t}},{key:"node",get:function(){return this._node},set:function(t){this._node=t,this._node&&(this._node.hasChangedFlags|=Vp.ROTATION)}},{key:"type",get:function(){return this._type}},{key:"name",get:function(){return this._name},set:function(t){this._name=t}},{key:"scene",get:function(){return this._scene}}]),t}(),jR=new Yi(0,0,-1),YR=new Yi,qR=function(t){function e(){var e;return(e=t.call(this)||this)._dir=new Yi(1,-1,-1),e._illuminanceHDR=Nm.SUN_ILLUM,e._illuminanceLDR=1,e._shadowEnabled=!1,e._shadowPcf=ZS.HARD,e._shadowBias=1e-5,e._shadowNormalBias=0,e._shadowSaturation=1,e._shadowDistance=50,e._shadowInvisibleOcclusionRange=200,e._csmLevel=$S.LEVEL_4,e._csmNeedUpdate=!1,e._csmLayerLambda=.75,e._csmOptimizationMode=tA.DisableRotationFix,e._csmLayersTransition=!1,e._csmTransitionRange=.05,e._shadowFixedArea=!1,e._shadowNear=.1,e._shadowFar=10,e._shadowOrthoSize=5,e._type=xR.DIRECTIONAL,e}s(e,t);var i=e.prototype;return i.initialize=function(){t.prototype.initialize.call(this),this.illuminance=Nm.SUN_ILLUM,this.direction=new Yi(1,-1,-1)},i.update=function(){this._node&&this._node.hasChangedFlags&&(this.direction=Yi.transformQuat(YR,jR,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){Yi.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,iA.MAX_FAR)}},{key:"shadowInvisibleOcclusionRange",get:function(){return this._shadowInvisibleOcclusionRange},set:function(t){this._shadowInvisibleOcclusionRange=Math.min(t,iA.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,iA.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}(XR),KR=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=is.create(),e._pos=new Yi,e._type=xR.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/WR(.15),this.luminanceLDR=1},i.update=function(){if(this._node&&(this._node.hasChangedFlags||this._needUpdate)){this._node.getWorldPosition(this._pos);var t=this._range;is.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}(XR),JR=new Yi(0,0,-1),QR=new sn,ZR=new fn,$R=new fn,tw=new fn,ew=new fn,iw=function(t){function e(){var e;return(e=t.call(this)||this)._dir=new Yi(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=ZS.HARD,e._shadowBias=1e-5,e._shadowNormalBias=0,e._aabb=is.create(),e._frustum=us.create(),e._pos=new Yi,e._type=xR.SPOT,e}s(e,t);var i=e.prototype;return i.initialize=function(){t.prototype.initialize.call(this),this.size=.15,this.luminanceHDR=1700/WR(.15),this.luminanceLDR=1,this.range=Math.cos(Math.PI/6),this._dir.set(new Yi(1,-1,-1))},i.update=function(){this._node&&(this._node.hasChangedFlags||this._needUpdate)&&(this._node.getWorldPosition(this._pos),Yi.transformQuat(this._dir,JR,this._node.getWorldRotation(QR)),Yi.normalize(this._dir,this._dir),is.set(this._aabb,this._pos.x,this._pos.y,this._pos.z,this._range,this._range,this._range),this._node.getWorldRT(ZR),fn.invert(ZR,ZR),fn.perspective($R,this._angle,1,.001,this._range),fn.multiply(tw,$R,ZR),this._frustum.update(tw,ew),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}(XR),nw=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=is.create(),e._pos=new Yi,e._type=xR.POINT,e}s(e,t);var i=e.prototype;return i.initialize=function(){t.prototype.initialize.call(this),this.range=1,this.luminanceHDR=1700/WR(1),this.luminanceLDR=1},i.update=function(){if(this._node&&(this._node.hasChangedFlags||this._needUpdate)){this._node.getWorldPosition(this._pos);var t=this._range;is.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}(XR),rw=new Yi(0,0,-1),sw=function(t){function e(){var e;return(e=t.call(this)||this)._dir=new Yi(0,0,-1),e._pos=new Yi(0,0,0),e._scale=new Yi(1,1,1),e._right=new Yi(1,0,0),e._illuminanceHDR=Nm.SUN_ILLUM,e._illuminanceLDR=1,e._type=xR.RANGED_DIRECTIONAL,e}s(e,t);var i=e.prototype;return i.initialize=function(){t.prototype.initialize.call(this),this.illuminance=Nm.SUN_ILLUM},i.update=function(){this._node&&this._node.hasChangedFlags&&(this._node.getWorldPosition(this._pos),this._node.getWorldScale(this._scale),Yi.transformQuat(this._dir,rw,this._node.worldRotation),Yi.transformQuat(this._right,Yi.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}(XR),aw=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}(),ow=function(){function t(){this.scene=void 0,this.node=null,this._device=void 0,this.enabled=!0,this._localBoundaryCenter=new Yi(0,0,0),this._objectSize=1,this._lodDataArray=[],this._lockedLODLevelVec=[],this._isLockLevelChanged=!1,this._device=of.gfxDevice}var e=t.prototype;return e.attachToScene=function(t){this.scene=t},e.detachFromScene=function(){this.scene=null},e.lockLODLevels=function(t){if(t.length!==this._lockedLODLevelVec.length)this._isLockLevelChanged=!0;else for(var e=t.length,i=0;i<e;i++)if(t[i]!==this._lockedLODLevelVec[i]){this._isLockLevelChanged=!0;break}this._lockedLODLevelVec=t},e.isLockLevelChanged=function(){return this._isLockLevelChanged},e.resetLockChangeFlag=function(){this._isLockLevelChanged=!1},e.getLockedLODLevels=function(){return this._lockedLODLevelVec},e.clearLODs=function(){this._lodDataArray.length=0},e.insertLOD=function(t,e){this._lodDataArray.splice(t,0,e)},e.updateLOD=function(t,e){this._lodDataArray[t]=e},e.eraseLOD=function(t){this._lodDataArray.splice(t,1)},e.getVisibleLODLevel=function(t){for(var e=this.getScreenUsagePercentage(t),i=-1,n=0;n<this.lodCount;++n)if(e>=this.lodDataArray[n].screenUsagePercentage){i=n;break}return i},e.getScreenUsagePercentage=function(t){return this.node?(t.projectionType===MC.PERSPECTIVE&&(e=Yi.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===MC.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}(),hw=Object.freeze({__proto__:null,get CameraFOVAxis(){return OC},get CameraProjection(){return MC},get CameraAperture(){return NC},get CameraISO(){return LC},get CameraShutter(){return FC},get CameraType(){return kC},get TrackingType(){return GC},get CameraUsage(){return VC},SKYBOX_FLAG:qC,Camera:JC,get ModelType(){return yR},Model:wR,SubModel:oR,Ambient:Nm,EnvironmentLightingType:oA,Skybox:hA,ShadowSize:JS,ShadowType:QS,PCFType:ZS,CSMLevel:$S,CSMOptimizationMode:tA,Shadows:iA,FogType:bE,Fog:CE,Octree:IR,Skin:BR,ColorTemperatureToRGB:DR,get LightType(){return xR},nt2lm:WR,Light:XR,DirectionalLight:qR,SphereLight:KR,SpotLight:iw,PointLight:nw,RangedDirectionalLight:sw,get ProbeClearFlag(){return lR},get ProbeType(){return cR},ReflectionProbe:gR,LODData:aw,LODGroup:ow});!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"}(PR||(PR={})),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"}(OR||(OR={})),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"}(MR||(MR={})),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"}(NR||(NR={})),function(t){t[t.BUFFER=0]="BUFFER",t[t.TEXTURE1D=1]="TEXTURE1D",t[t.TEXTURE2D=2]="TEXTURE2D",t[t.TEXTURE3D=3]="TEXTURE3D"}(LR||(LR={})),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"}(FR||(FR={})),function(t){t[t.SYNC=0]="SYNC",t[t.ASYNC=1]="ASYNC"}(kR||(kR={})),function(t){t[t.NONE=0]="NONE",t[t.OPAQUE=1]="OPAQUE",t[t.MASK=2]="MASK",t[t.BLEND=4]="BLEND",t[t.OPAQUE_OBJECT=1]="OPAQUE_OBJECT",t[t.CUTOUT_OBJECT=2]="CUTOUT_OBJECT",t[t.TRANSPARENT_OBJECT=4]="TRANSPARENT_OBJECT",t[t.SHADOW_CASTER=8]="SHADOW_CASTER",t[t.UI=16]="UI",t[t.DEFAULT_LIGHTING=32]="DEFAULT_LIGHTING",t[t.VOLUMETRIC_LIGHTING=64]="VOLUMETRIC_LIGHTING",t[t.CLUSTERED_LIGHTING=128]="CLUSTERED_LIGHTING",t[t.PLANAR_SHADOW=256]="PLANAR_SHADOW",t[t.GEOMETRY=512]="GEOMETRY",t[t.PROFILER=1024]="PROFILER",t[t.DRAW_INSTANCING=2048]="DRAW_INSTANCING",t[t.DRAW_NON_INSTANCING=4096]="DRAW_NON_INSTANCING",t[t.REFLECTION_PROBE=8192]="REFLECTION_PROBE",t[t.ALL=4294967295]="ALL"}(GR||(GR={})),function(t){t[t.NONE=0]="NONE",t[t.DEFAULT=1]="DEFAULT",t[t.CLUSTERED=2]="CLUSTERED"}(VR||(VR={})),function(t){t[t.RENDER_TARGET=0]="RENDER_TARGET",t[t.DEPTH_STENCIL=1]="DEPTH_STENCIL",t[t.SHADING_RATE=2]="SHADING_RATE"}(UR||(UR={})),function(t){t[t.READ=0]="READ",t[t.READ_WRITE=1]="READ_WRITE",t[t.WRITE=2]="WRITE"}(zR||(zR={})),function(t){t[t.NONE=0]="NONE",t[t.FLOAT_TYPE=1]="FLOAT_TYPE",t[t.INT_TYPE=2]="INT_TYPE"}(HR||(HR={}));var uw,lw,cw=function(t,e){void 0===t&&(t=null),void 0===e&&(e=0),this.light=void 0,this.level=void 0,this.light=t,this.level=e};!function(t){t[t.UNIFORM_BUFFER=0]="UNIFORM_BUFFER",t[t.DYNAMIC_UNIFORM_BUFFER=1]="DYNAMIC_UNIFORM_BUFFER",t[t.SAMPLER_TEXTURE=2]="SAMPLER_TEXTURE",t[t.SAMPLER=3]="SAMPLER",t[t.TEXTURE=4]="TEXTURE",t[t.STORAGE_BUFFER=5]="STORAGE_BUFFER",t[t.DYNAMIC_STORAGE_BUFFER=6]="DYNAMIC_STORAGE_BUFFER",t[t.STORAGE_IMAGE=7]="STORAGE_IMAGE",t[t.INPUT_ATTACHMENT=8]="INPUT_ATTACHMENT"}(uw||(uw={})),function(t){t[t.NONE=0]="NONE",t[t.COLOR=1]="COLOR",t[t.DEPTH=2]="DEPTH",t[t.STENCIL=4]="STENCIL"}(lw||(lw={}));var _w,fw=function(t,e,i,n,r,s,a){void 0===t&&(t=new Uint8Array(0)),void 0===e&&(e=""),void 0===i&&(i=4294967295),void 0===n&&(n=4294967295),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=0),this.source=void 0,this.target=void 0,this.mipLevels=void 0,this.numSlices=void 0,this.targetMostDetailedMip=void 0,this.targetFirstSlice=void 0,this.targetPlaneSlice=void 0,this.source=t,this.target=e,this.mipLevels=i,this.numSlices=n,this.targetMostDetailedMip=r,this.targetFirstSlice=s,this.targetPlaneSlice=a};rt(pd.prototype,"TextureBase.prototype",[{name:"hasPremultipliedAlpha"},{name:"setPremultiplyAlpha"},{name:"setFlipY"}]),nt(dR.prototype,"RenderTexture.prototype",[{name:"getGFXWindow",customFunction:function(){return this.window}}]);var dw=((_w={})[Cl.UNORM]="Uint",_w[Cl.SNORM]="Int",_w[Cl.UINT]="Uint",_w[Cl.INT]="Int",_w[Cl.UFLOAT]="Float",_w[Cl.FLOAT]="Float",_w.default="Uint",_w);function pw(t){return""+(dw[t.type]||dw.default)+t.size/t.count*8}function mw(t,e,i,n,r){void 0===i&&(i=xl.R32F),void 0===n&&(n=0),void 0===r&&(r=0);var s=m_[i];r||(r=s.size);for(var a="set"+pw(s),o=s.size/s.count,h=Math.floor(e.length/s.count),u=ul.isLittleEndian,l=0;l<h;++l)for(var c=n+r*l,_=0;_<s.count;++_){var f=c+o*_;t[a](f,e[s.count*l+_],u)}}var gw,yw=t("dM",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 Yc(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 f=_*o,d=c[_]*o,p=0;p<o;++p)l[f+p]=u[d+p];this._flatBuffers.push({stride:o,count:a,buffer:l})}else l.set(t.data.subarray(s.view.offset,s.view.offset+s.view.length)),this._flatBuffers.push({stride:o,count:a,buffer:l})}}},e.destroy=function(){for(var t=0;t<this.vertexBuffers.length;t++)this.vertexBuffers[t].destroy();if(this.vertexBuffers.length=0,this._indexBuffer&&(this._isOwnerOfIndexBuffer&&this._indexBuffer.destroy(),this._indexBuffer=null),this._jointMappedBuffers&&this._jointMappedBufferIndices){for(var e=0;e<this._jointMappedBufferIndices.length;e++)this._jointMappedBuffers[this._jointMappedBufferIndices[e]].destroy();this._jointMappedBuffers=void 0,this._jointMappedBufferIndices=void 0}this._indirectBuffer&&(this._indirectBuffer.destroy(),this._indirectBuffer=null)},e.enableVertexIdChannel=function(t){if(!this._vertexIdChannel){var e=this.vertexBuffers.length,i=this.attributes.length,n=this._allocVertexIdBuffer(t);this._vertexBuffers.push(n),this._attributes.push(new Xc("a_vertexId",xl.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 wc(wl.VERTEX|wl.TRANSFER_DST,Dl.DEVICE,i.byteLength,i.BYTES_PER_ELEMENT));return r.update(i),r},n(t,[{key:"attributes",get:function(){return this._attributes}},{key:"vertexBuffers",get:function(){return this._vertexBuffers}},{key:"indexBuffer",get:function(){return this._indexBuffer}},{key:"indirectBuffer",get:function(){return this._indirectBuffer}},{key:"primitiveMode",get:function(){return this._primitiveMode}},{key:"geometricInfo",get:function(){if(this._geometricInfo)return this._geometricInfo;if(void 0===this.mesh)return{positions:new Float32Array,indices:new Uint8Array,boundingBox:{min:Yi.ZERO,max:Yi.ZERO}};if(void 0===this.subMeshIdx)return{positions:new Float32Array,indices:new Uint8Array,boundingBox:{min:Yi.ZERO,max:Yi.ZERO}};var t=this.mesh,e=this.subMeshIdx,i=t.readAttribute(e,cc.ATTR_POSITION),n=t.readIndices(e),r=new Yi,s=new Yi,a=this.attributes.find((function(t){return t.name===cc.ATTR_POSITION}));if(a){var o=m_[a.format].count;2===o?(r.set(i[0],i[1],0),s.set(i[0],i[1],0)):(r.set(i[0],i[1],i[2]),s.set(i[0],i[1],i[2]));for(var h=0;h<i.length;h+=o)2===o?(r.x=i[h]>r.x?i[h]:r.x,r.y=i[h+1]>r.y?i[h+1]:r.y,s.x=i[h]<s.x?i[h]:s.x,s.y=i[h+1]<s.y?i[h+1]:s.y):(r.x=i[h]>r.x?i[h]:r.x,r.y=i[h+1]>r.y?i[h+1]:r.y,r.z=i[h+2]>r.z?i[h+2]:r.z,s.x=i[h]<s.x?i[h]:s.x,s.y=i[h+1]<s.y?i[h+1]:s.y,s.z=i[h+2]<s.z?i[h+2]:s.z)}return this._geometricInfo={positions:i,indices:n,boundingBox:{max:r,min:s}},this._geometricInfo}},{key:"drawInfo",get:function(){return this._drawInfo},set:function(t){this._drawInfo=t}},{key:"flatBuffers",get:function(){return this._flatBuffers}},{key:"jointMappedBuffers",get:function(){var t=this;if(this._jointMappedBuffers)return this._jointMappedBuffers;var e=this._jointMappedBuffers=[],i=this._jointMappedBufferIndices=[];if(!this.mesh||void 0===this.subMeshIdx)return this._jointMappedBuffers=this.vertexBuffers;var n,r,s=this.mesh.struct,a=s.primitives[this.subMeshIdx];if(!s.jointMaps||void 0===a.jointMapIndex||!s.jointMaps[a.jointMapIndex])return this._jointMappedBuffers=this.vertexBuffers;for(var o=v.director.root.device,h=function(){var h=s.vertexBundles[a.vertexBundelIndices[u]];r=0,n=xl.UNKNOWN;for(var l=0;l<h.attributes.length;l++){var c=h.attributes[l];if(c.name===cc.ATTR_JOINTS){n=c.format;break}r+=m_[c.format].size}if(n){var _=new Uint8Array(t.mesh.data.buffer,h.view.offset,h.view.length),f=new DataView(_.slice().buffer),d=s.jointMaps[a.jointMapIndex];!function(t,e,i,n,r,s,a){void 0===i&&(i=xl.R32F),void 0===n&&(n=0),void 0===r&&(r=t.byteLength-n),void 0===s&&(s=0),a||(a=new DataView(t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)));var o,h=m_[i];s||(s=h.size);for(var u="set"+pw(h),l="get"+pw(h),c=h.size/h.count,_=Math.floor(r/s),f=ul.isLittleEndian,p=0;p<_;++p)for(var m=n+s*p,g=0;g<h.count;++g){var y=m+c*g,v=t[l](y,f);a[u](y,(o=v,d.indexOf(o)),f)}}(f,0,n,r,h.view.length,h.view.stride,f);var p=o.createBuffer(new wc(wl.VERTEX|wl.TRANSFER_DST,Dl.DEVICE,h.view.length,h.view.stride));p.update(f.buffer),e.push(p),i.push(u)}else e.push(t.vertexBuffers[a.vertexBundelIndices[u]])},u=0;u<a.vertexBundelIndices.length;u++)h();return this._vertexIdChannel&&e.push(this._allocVertexIdBuffer(o)),e}},{key:"iaInfo",get:function(){return this._iaInfo}}]),t}()),vw=t("d3",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()}}]),t}()),Sw=new is(0,0,0,.5,.5,.5),Aw=new is;function Tw(t,e){var i=t.pipelineSceneData,n=i.validPunctualLights;n.length=0;for(var r=$n.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||($n.set(r,o.position.x,o.position.y,o.position.z,o.range),Hr.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||($n.set(r,l.position.x,l.position.y,l.position.z,l.range),Hr.sphereFrustum(r,e.frustum)&&n.push(l))}for(var c=e.scene.pointLights,_=0;_<c.length;_++){var f=c[_];f.baked||($n.set(r,f.position.x,f.position.y,f.position.z,f.range),Hr.sphereFrustum(r,e.frustum)&&n.push(f))}for(var d=e.scene.rangedDirLights,p=0;p<d.length;p++){var m=d[p];is.transform(Aw,Sw,m.node.getWorldMatrix()),Hr.aabbFrustum(Aw,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"}(gw||(gw={}));var Ew=[];function bw(t){return Ew.includes(t)||Ew.push(t),Ew.indexOf(t)}function xw(t,e){var i=jl.CLEAR;return t&oc.COLOR||e!==UR.RENDER_TARGET||(i=t&qC?jl.CLEAR:jl.LOAD),(t&oc.DEPTH_STENCIL)!==oc.DEPTH_STENCIL&&e===UR.DEPTH_STENCIL&&(t&oc.DEPTH||(i=jl.LOAD),t&oc.STENCIL||(i=jl.LOAD)),i}function Cw(t,e,i,n,r,s){void 0===n&&(n=null),void 0===r&&(r=0),s=s||new mc;var a=t?t.viewport:new mc(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 xR.DIRECTIONAL:var u=n;if(u.shadowFixedArea||u.csmLevel===$S.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 xR.SPOT:s.x=0,s.y=0,s.width=o,s.height=h}return s}var Rw=function(){function t(t){void 0===t&&(t=gw.NONE),this.antiAliasing=gw.NONE,this.antiAliasing=t,this._init()}return t.prototype._init=function(){this.postMaterial=new KS,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}(),ww=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 ww;var Iw=function(){function t(t){this.enableCluster=void 0,this.enableCluster=t?1:0,this._init()}return t.prototype._init=function(){this.deferredLightingMaterial=new KS,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 Bw(t,e){for(var i,n=f(e.descriptorSetLayoutData.descriptorBlocks);!(i=n()).done;)for(var r=i.value,s=0;s!==r.descriptors.length;++s)if(t===r.descriptors[s].descriptorID)return r.offset+s;return-1}function Dw(t){for(var e,i=v.director.root.pipeline.layoutGraph,n=i.vertices(),r=i.attributeIndex.get(t),s=f(n);!(e=s()).done;)for(var a,o=e.value,h=f(i.getLayout(o).descriptorSets);!(a=h()).done;){var u=a.value;u[0];for(var l,c=u[1],_=f(c.descriptorSetLayoutData.descriptorBlocks);!(l=_()).done;)for(var d,p=f(l.value.descriptors);!(d=p()).done;)if(d.value.descriptorID===r)return Bw(r,c)}return-1}var Pw=new Map;function Ow(t){var e=Pw.get(t);if(e)return e;var i=v.director.root.pipeline,n=i.layoutGraph.locateChild(i.layoutGraph.nullVertex(),t);V(4294967295!==n);var r=i.layoutGraph.getLayout(n).descriptorSets.get(PR.PER_PASS);return Pw.set(t,r),r}var Mw=[.0484,.187,.567,1.99,7.41],Nw=[.1,.118,.113,.358,.078],Lw=new Yi,Fw=new Yi,kw=new zi,Gw=new zi;!function(){var t=e.prototype;function e(){this.ssssFov=45/57.3,this.ssssWidth=.01,this.boundingBox=.4,this.ssssScale=3,this._v3SSSSStrength=new Yi(.48,.41,.28),this._v3SSSSFallOff=new Yi(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(Fw,Mw[i],e),Fw.multiplyScalar(Nw[i]),t.add(Fw)},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;Lw.set(0),this._profile(Lw,this._kernel[r].w),Lw.multiplyScalar(s),this._kernel[r].x=Lw.x,this._kernel[r].y=Lw.y,this._kernel[r].z=Lw.z}kw.set(this._kernel[12]);for(var a=12;a>0;a--)Gw.set(this._kernel[a-1]),this._kernel[a].set(Gw);this._kernel[0].set(kw),Lw.set(0);for(var o=0;o<25;o++)Lw.add3f(this._kernel[o].x,this._kernel[o].y,this._kernel[o].z);for(var h=0;h<25;h++)this._kernel[h].x/=Lw.x,this._kernel[h].y/=Lw.y,this._kernel[h].z/=Lw.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 KS,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 zi;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 zi,this._radiusParam=new zi,this._miscParam=new zi,this._blurParam=new zi,this._depthTexFullResolution=new yn(1024),this._depthTexResolution=new yn(1024),this._sceneScale=1,this._cameraFov=Ri(45),this._radiusScale=1,this._angleBiasDegree=10,this._aoStrength=1,this._blurSharpness=8,this._aoSaturation=1,this._randomDirAndJitter=[238,91,87,255,251,44,119,255,247,64,250,255,232,5,225,255,253,177,140,255,250,51,84,255,243,76,97,255,252,36,232,255,235,100,24,255,252,36,158,255,254,20,142,255,245,135,124,255,251,43,121,255,253,31,145,255,235,98,160,255,240,146,198,255],this._init(),this.update()}t._init=function(){if(!this.hbaoMaterial){this.hbaoMaterial=new KS,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=Mp.PixelFormat.RGBA8888,i=new Uint8Array(64),n=0;n<this._randomDirAndJitter.length;n++)i[n]=this._randomDirAndJitter[n];var r=new ld({width:4,height:4,_data:i,_compressed:!1,format:e});this.randomTexture=new Mp,this.randomTexture.setFilters(Mp.Filter.NEAREST,Mp.Filter.NEAREST),this.randomTexture.setMipFilter(Mp.Filter.NONE),this.randomTexture.setWrapMode(Mp.WrapMode.REPEAT,Mp.WrapMode.REPEAT,Mp.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 yn(this._depthTexResolution.y/this._depthTexResolution.x,1),s=new yn(r.x/Math.tan(.5*this._cameraFov),r.y/Math.tan(.5*this._cameraFov)),a=Math.tan(Ri(this._angleBiasDegree)),o=this._aoStrength;this._miscParam.set(s.x,s.y,a,o);var h=new yn(2/s.x,-2/s.y),u=new yn(-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 yn;var Vw=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 KS;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}(),Uw=null;function zw(t,e){!function(t,e){Tw(e,t);var i=e.pipelineSceneData,n=80*Ni(Math.max(i.validPunctualLights.length,1)),r=bw(t),s="clusterLightBuffer"+r,a="globalIndexBuffer"+r,o=e;o.containsResource(a)||o.addStorageBuffer(a,xl.UNKNOWN,4,MR.PERSISTENT),o.containsResource(s)||o.addStorageBuffer(s,xl.UNKNOWN,n,MR.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=f(o.validPunctualLights);!(r=l()).done;){var c=r.value,_=20*u,d=_+0,p=_+4,m=_+8,g=_+12,y=_+16,v=0,S=0,A=void 0;if(c.type===xR.POINT){var T=c;A=T.position,S=T.luminanceLDR,v=T.luminanceHDR,a[m]=0,a[m+1]=T.range,a[m+2]=0,a[m+3]=0}else if(c.type===xR.SPHERE){var E=c;A=E.position,S=E.luminanceLDR,v=E.luminanceHDR,a[m]=E.size,a[m+1]=E.range,a[m+2]=0,a[m+3]=0}else if(c.type===xR.SPOT){var b=c;A=b.position,S=b.luminanceLDR,v=b.luminanceHDR,a[m]=b.size,a[m+1]=b.range,a[m+2]=b.spotAngle,a[m+3]=0;var x=b.direction;a[g]=x.x,a[g+1]=x.y,a[g+2]=x.z,a[g+3]=0}else if(c.type===xR.RANGED_DIRECTIONAL){var C=c;A=C.position,S=C.illuminanceLDR,v=C.illuminanceHDR;var R=C.right;a[m]=R.x,a[m+1]=R.y,a[m+2]=R.z,a[m+3]=0;var w=C.direction;a[g]=w.x,a[g+1]=w.y,a[g+2]=w.z,a[g+3]=0;var I=C.scale;a[y]=.5*I.x,a[y+1]=.5*I.y,a[y+2]=.5*I.z,a[y+3]=0}a[d]=A.x,a[d+1]=A.y,a[d+2]=A.z,a[d+3]=c.type;var B=c.color;if(c.useColorTemperature){var D=c.colorTemperatureRGB;a[p]=B.x*D.x,a[p+1]=B.y*D.y,a[p+2]=B.z*D.z}else a[p]=B.x,a[p+1]=B.y,a[p+2]=B.z;a[p+3]=o.isHDR?v*h*1e4:S,u++}return a[15]=o.validPunctualLights.length,s}(n,0,t,e),u=new ArrayBuffer(4);new Uint32Array(u)[0]=0;var l=new fw(new Uint8Array(h),s),c=new fw(new Uint8Array(u),a);o.addUploadPass([l,c])}(t,e);var i=e;Uw||(Uw=new Vw),function(t,e,i){var n="clusterBuffer"+bw(t);i.containsResource(n)||i.addStorageBuffer(n,xl.UNKNOWN,98304,MR.MANAGED),i.updateStorageBuffer(n,98304);var r=i.addComputePass("cluster-build-cs");r.addStorageBuffer(n,zR.WRITE,"b_clustersBuffer"),r.addQueue().addDispatch(e.dispatchX,e.dispatchY,e.dispatchZ,e.clusterBuildCS,0);var s=t.width*i.pipelineSceneData.shadingScale,a=t.height*i.pipelineSceneData.shadingScale;r.setVec4("cc_nearFar",new zi(t.nearClip,t.farClip,t.getClipSpaceMinz(),0)),r.setVec4("cc_viewPort",new zi(0,0,s,a)),r.setVec4("cc_workGroup",new zi(16,8,24,0)),r.setMat4("cc_matView",t.matView),r.setMat4("cc_matProjInv",t.matProjInv)}(t,Uw,i),function(t,e,i){var n=bw(t),r="clusterBuffer"+n,s="clusterLightBuffer"+n,a="globalIndexBuffer"+n,o="clusterLightIndicesBuffer"+n,h="clusterLightGridBuffer"+n;i.containsResource(o)||i.addStorageBuffer(o,xl.UNKNOWN,1228800,MR.MANAGED),i.containsResource(h)||i.addStorageBuffer(h,xl.UNKNOWN,49152,MR.MANAGED);var u=i.addComputePass("cluster-culling-cs");u.addStorageBuffer(s,zR.READ,"b_ccLightsBuffer"),u.addStorageBuffer(r,zR.READ,"b_clustersBuffer"),u.addStorageBuffer(o,zR.WRITE,"b_clusterLightIndicesBuffer"),u.addStorageBuffer(h,zR.WRITE,"b_clusterLightGridBuffer"),u.addStorageBuffer(a,zR.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;u.setVec4("cc_nearFar",new zi(t.nearClip,t.farClip,t.getClipSpaceMinz(),0)),u.setVec4("cc_viewPort",new zi(l,c,l,c)),u.setVec4("cc_workGroup",new zi(16,8,24,0)),u.setMat4("cc_matView",t.matView),u.setMat4("cc_matProjInv",t.matProjInv)}(t,Uw,i)}var Hw,Ww,Xw,jw,Yw,qw=new Nc(kl.LINEAR,kl.LINEAR,kl.NONE,Gl.CLAMP,Gl.CLAMP,Gl.CLAMP),Kw=new Nc(kl.POINT,kl.POINT,kl.NONE,Gl.CLAMP,Gl.CLAMP,Gl.CLAMP),Jw=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(qw),this._pointSampler=this._device.getSampler(Kw);var e=new r_(zm.bindings);this._descriptorSetLayout=this._device.createDescriptorSetLayout(e),this._globalDescriptorSet=this._device.createDescriptorSet(new s_(this._descriptorSetLayout))}var e=t.prototype;return e.regenLayout=function(){var t=new r_(zm.bindings);this._descriptorSetLayout=this._device.createDescriptorSetLayout(t),this._globalDescriptorSet=this._device.createDescriptorSet(new s_(this._descriptorSetLayout))},e.bindBuffer=function(t,e){this._globalDescriptorSet.bindBuffer(t,e);for(var i=this._descriptorSetMap.values(),n=i.next();!n.done;)n.value.bindBuffer(t,e),n=i.next()},e.bindSampler=function(t,e){this._globalDescriptorSet.bindSampler(t,e);for(var i=this._descriptorSetMap.values(),n=i.next();!n.done;)n.value.bindSampler(t,e),n=i.next()},e.bindTexture=function(t,e){this._globalDescriptorSet.bindTexture(t,e);for(var i=this._descriptorSetMap.values(),n=i.next();!n.done;)n.value.bindTexture(t,e),n=i.next()},e.update=function(){this._globalDescriptorSet.update();for(var t=this._descriptorSetMap.values(),e=t.next();!e.done;)e.value.update(),e=t.next()},e.getOrCreateDescriptorSet=function(t){var e=this._device;if(!this._descriptorSetMap.has(t)){var i=Ay()?Ow("default").descriptorSet:this._globalDescriptorSet,n=e.createDescriptorSet(new s_(Ay()?Ow("default").descriptorSetLayout:this._descriptorSetLayout));this._descriptorSetMap.set(t,n);for(var r=Um.UBO_GLOBAL;r<Um.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 wc(wl.UNIFORM|wl.TRANSFER_DST,Dl.HOST|Dl.DEVICE,tg.SIZE,tg.SIZE)),a=Ay()?Dw("CCShadow"):tg.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}(),Qw=new fn,Zw=new fn,$w=new fn,tI=new zi,eI=new zi(0,0,1,0),iI=new Yi,nI=function(){function t(){this._globalUBO=new Float32Array(Zm.COUNT),this._cameraUBO=new Float32Array($m.COUNT),this._shadowUBO=new Float32Array(tg.COUNT),this._csmUBO=new Float32Array(eg.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[Zm.TIME_OFFSET]=n.cumulativeTime,r[Zm.TIME_OFFSET+1]=n.frameTime,r[Zm.TIME_OFFSET+2]=i.getTotalFrames(),r[Zm.TIME_OFFSET+3]=n.cumulativeTime-Math.floor(n.frameTime),r[Zm.SCREEN_SIZE_OFFSET]=s,r[Zm.SCREEN_SIZE_OFFSET+1]=a,r[Zm.SCREEN_SIZE_OFFSET+2]=1/s,r[Zm.SCREEN_SIZE_OFFSET+3]=1/a,r[Zm.NATIVE_SIZE_OFFSET]=s,r[Zm.NATIVE_SIZE_OFFSET+1]=a,r[Zm.NATIVE_SIZE_OFFSET+2]=1/r[Zm.NATIVE_SIZE_OFFSET],r[Zm.NATIVE_SIZE_OFFSET+3]=1/r[Zm.NATIVE_SIZE_OFFSET+1],v.internal.reflectionProbeManager&&(r[Zm.PROBE_INFO_OFFSET]=v.internal.reflectionProbeManager.getMaxProbeId()+1);var o=n.debugView;r[Zm.DEBUG_VIEW_MODE_OFFSET]=o.singleMode;for(var h=1;h<=3;h++)r[Zm.DEBUG_VIEW_MODE_OFFSET+h]=0;for(var u=0;u<17;u++){var l=u%8;r[Zm.DEBUG_VIEW_MODE_OFFSET+1+(u>>3)]+=(o.isCompositeModeEnabled(u)?1:0)*Math.pow(10,l)}r[Zm.DEBUG_VIEW_MODE_OFFSET+3]+=(o.lightingWithAlbedo?1:0)*Math.pow(10,6),r[Zm.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[$m.SCREEN_SCALE_OFFSET]=s.shadingScale,l[$m.SCREEN_SCALE_OFFSET+1]=s.shadingScale,l[$m.SCREEN_SCALE_OFFSET+2]=1/l[$m.SCREEN_SCALE_OFFSET],l[$m.SCREEN_SCALE_OFFSET+3]=1/l[$m.SCREEN_SCALE_OFFSET+1],l[$m.EXPOSURE_OFFSET]=c,l[$m.EXPOSURE_OFFSET+1]=1/c,l[$m.EXPOSURE_OFFSET+2]=_?1:0,l[$m.EXPOSURE_OFFSET+3]=1/JC.standardExposureValue,r){var f=r.shadowEnabled&&u.type===QS.ShadowMap?1:0,d=r.direction;if(eI.set(d.x,d.y,d.z,f),zi.toArray(l,eI,$m.MAIN_LIT_DIR_OFFSET),Yi.toArray(l,r.color,$m.MAIN_LIT_COLOR_OFFSET),r.useColorTemperature){var p=r.colorTemperatureRGB;l[$m.MAIN_LIT_COLOR_OFFSET]*=p.x,l[$m.MAIN_LIT_COLOR_OFFSET+1]*=p.y,l[$m.MAIN_LIT_COLOR_OFFSET+2]*=p.z}l[$m.MAIN_LIT_COLOR_OFFSET+3]=_?r.illuminance*c:r.illuminance}else eI.set(0,0,1,0),zi.toArray(l,eI,$m.MAIN_LIT_DIR_OFFSET),zi.toArray(l,zi.ZERO,$m.MAIN_LIT_COLOR_OFFSET);var m=a.skyColor;m.w=_?a.skyIllum*c:a.skyIllum,l[$m.AMBIENT_SKY_OFFSET+0]=m.x,l[$m.AMBIENT_SKY_OFFSET+1]=m.y,l[$m.AMBIENT_SKY_OFFSET+2]=m.z,l[$m.AMBIENT_SKY_OFFSET+3]=m.w,l[$m.AMBIENT_GROUND_OFFSET+0]=a.groundAlbedo.x,l[$m.AMBIENT_GROUND_OFFSET+1]=a.groundAlbedo.y,l[$m.AMBIENT_GROUND_OFFSET+2]=a.groundAlbedo.z,l[$m.AMBIENT_GROUND_OFFSET+3]=o.envmap?null===(n=o.envmap)||void 0===n?void 0:n.mipmapLevel:1,fn.toArray(l,i.matView,$m.MAT_VIEW_OFFSET),fn.toArray(l,i.node.worldMatrix,$m.MAT_VIEW_INV_OFFSET),Yi.toArray(l,i.position,$m.CAMERA_POS_OFFSET),fn.toArray(l,i.matProj,$m.MAT_PROJ_OFFSET),fn.toArray(l,i.matProjInv,$m.MAT_PROJ_INV_OFFSET),fn.toArray(l,i.matViewProj,$m.MAT_VIEW_PROJ_OFFSET),fn.toArray(l,i.matViewProjInv,$m.MAT_VIEW_PROJ_INV_OFFSET),l[$m.CAMERA_POS_OFFSET+3]=this.getCombineSignY(),l[$m.SURFACE_TRANSFORM_OFFSET]=i.surfaceTransform,l[$m.SURFACE_TRANSFORM_OFFSET+1]=i.cameraUsage,l[$m.SURFACE_TRANSFORM_OFFSET+2]=Math.cos(Ri(s.skybox.getRotationAngle())),l[$m.SURFACE_TRANSFORM_OFFSET+3]=Math.sin(Ri(s.skybox.getRotationAngle()));var g=h.colorArray;l[$m.GLOBAL_FOG_COLOR_OFFSET]=g.x,l[$m.GLOBAL_FOG_COLOR_OFFSET+1]=g.y,l[$m.GLOBAL_FOG_COLOR_OFFSET+2]=g.z,l[$m.GLOBAL_FOG_COLOR_OFFSET+3]=g.z,l[$m.GLOBAL_FOG_BASE_OFFSET]=h.fogStart,l[$m.GLOBAL_FOG_BASE_OFFSET+1]=h.fogEnd,l[$m.GLOBAL_FOG_BASE_OFFSET+2]=h.fogDensity,l[$m.GLOBAL_FOG_ADD_OFFSET]=h.fogTop,l[$m.GLOBAL_FOG_ADD_OFFSET+1]=h.fogRange,l[$m.GLOBAL_FOG_ADD_OFFSET+2]=h.fogAtten,l[$m.NEAR_FAR_OFFSET]=i.nearClip,l[$m.NEAR_FAR_OFFSET+1]=i.farClip,l[$m.NEAR_FAR_OFFSET+2]=i.getClipSpaceMinz(),l[$m.VIEW_PORT_OFFSET]=s.shadingScale*i.window.width*i.viewport.x,l[$m.VIEW_PORT_OFFSET+1]=s.shadingScale*i.window.height*i.viewport.y,l[$m.VIEW_PORT_OFFSET+2]=s.shadingScale*i.window.width*i.viewport.z,l[$m.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 ZS.HARD:return 0;case ZS.SOFT:return 1/(.5*i);case ZS.SOFT_2X:return 2/(.5*i);case ZS.SOFT_4X:return 3/(.5*i)}return 0},t.updatePlanarNormalAndDistance=function(t,e){Yi.normalize(iI,t.normal),e[tg.PLANAR_NORMAL_DISTANCE_INFO_OFFSET+0]=iI.x,e[tg.PLANAR_NORMAL_DISTANCE_INFO_OFFSET+1]=iI.y,e[tg.PLANAR_NORMAL_DISTANCE_INFO_OFFSET+2]=iI.z,e[tg.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,f=vy(s)?0:1;if(a&&h.enabled){if(h.type===QS.ShadowMap){if(a.shadowEnabled){if(a.shadowFixedArea||a.csmLevel===$S.LEVEL_1||!_){var d=u.specialLayer.matShadowView,p=u.specialLayer.matShadowProj,m=u.specialLayer.matShadowViewProj,g=.1,y=0,v=0;a.shadowFixedArea?(g=a.shadowNear,y=a.shadowFar,v=0):(y=u.specialLayer.shadowCameraFar,v=1),fn.toArray(l,d,tg.MAT_LIGHT_VIEW_OFFSET),l[tg.SHADOW_PROJ_DEPTH_INFO_OFFSET+0]=p.m10,l[tg.SHADOW_PROJ_DEPTH_INFO_OFFSET+1]=p.m14,l[tg.SHADOW_PROJ_DEPTH_INFO_OFFSET+2]=p.m11,l[tg.SHADOW_PROJ_DEPTH_INFO_OFFSET+3]=p.m15,l[tg.SHADOW_PROJ_INFO_OFFSET+0]=p.m00,l[tg.SHADOW_PROJ_INFO_OFFSET+1]=p.m05,l[tg.SHADOW_PROJ_INFO_OFFSET+2]=1/p.m00,l[tg.SHADOW_PROJ_INFO_OFFSET+3]=1/p.m05,fn.toArray(l,m,tg.MAT_LIGHT_VIEW_PROJ_OFFSET),tI.set(g,y,0,1-a.shadowSaturation),zi.toArray(l,tI,tg.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET),tI.set(xR.DIRECTIONAL,f,a.shadowNormalBias,v),zi.toArray(l,tI,tg.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET)}else{for(var S=this.getPCFRadius(h,a),A=0;A<a.csmLevel;A++){var T=u.layers[A],E=T.matShadowView;tI.set(E.m00,E.m04,E.m08,S),zi.toArray(c,tI,eg.CSM_VIEW_DIR_0_OFFSET+4*A),tI.set(E.m01,E.m05,E.m09,T.splitCameraNear),zi.toArray(c,tI,eg.CSM_VIEW_DIR_1_OFFSET+4*A),tI.set(E.m02,E.m06,E.m10,T.splitCameraFar),zi.toArray(c,tI,eg.CSM_VIEW_DIR_2_OFFSET+4*A);var b=T.csmAtlas;zi.toArray(c,b,eg.CSM_ATLAS_OFFSET+4*A);var x=T.matShadowViewProj;fn.toArray(c,x,eg.MAT_CSM_VIEW_PROJ_OFFSET+16*A);var C=T.matShadowProj;c[eg.CSM_PROJ_DEPTH_INFO_OFFSET+0+4*A]=C.m10,c[eg.CSM_PROJ_DEPTH_INFO_OFFSET+1+4*A]=C.m14,c[eg.CSM_PROJ_DEPTH_INFO_OFFSET+2+4*A]=C.m11,c[eg.CSM_PROJ_DEPTH_INFO_OFFSET+3+4*A]=C.m15,c[eg.CSM_PROJ_INFO_OFFSET+0+4*A]=C.m00,c[eg.CSM_PROJ_INFO_OFFSET+1+4*A]=C.m05,c[eg.CSM_PROJ_INFO_OFFSET+2+4*A]=1/C.m00,c[eg.CSM_PROJ_INFO_OFFSET+3+4*A]=1/C.m05}tI.set(a.csmTransitionRange,0,0,0),zi.toArray(c,tI,eg.CSM_SPLITS_INFO_OFFSET),tI.set(.1,a.shadowDistance,0,1-a.shadowSaturation),zi.toArray(l,tI,tg.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET),tI.set(xR.DIRECTIONAL,f,a.shadowNormalBias,a.csmLevel),zi.toArray(l,tI,tg.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET)}tI.set(h.size.x,h.size.y,a.shadowPcf,a.shadowBias),zi.toArray(l,tI,tg.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET)}}else t.updatePlanarNormalAndDistance(h,l);Zi.toArray(l,h.shadowColor,tg.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=vy(r)?0:1,l=t.device.capabilities,c=s.csmSupported;switch(i.type){case xR.DIRECTIONAL:var _=i;if(a.enabled&&_&&_.shadowEnabled&&a.type===QS.ShadowMap){var f,d,p,m=.1,g=0,y=0;if(_.shadowFixedArea||_.csmLevel===$S.LEVEL_1||!c)f=o.specialLayer.matShadowView,d=o.specialLayer.matShadowProj,p=o.specialLayer.matShadowViewProj,_.shadowFixedArea?(m=_.shadowNear,g=_.shadowFar,y=0):(m=.1,g=o.specialLayer.shadowCameraFar,y=1),tI.set(xR.DIRECTIONAL,u,_.shadowNormalBias,0),zi.toArray(h,tI,tg.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET);else{var v=o.layers[n];f=v.matShadowView,d=v.matShadowProj,p=v.matShadowViewProj,m=v.splitCameraNear,g=v.splitCameraFar,y=_.csmLevel}fn.toArray(h,f,tg.MAT_LIGHT_VIEW_OFFSET),h[tg.SHADOW_PROJ_DEPTH_INFO_OFFSET+0]=d.m10,h[tg.SHADOW_PROJ_DEPTH_INFO_OFFSET+1]=d.m14,h[tg.SHADOW_PROJ_DEPTH_INFO_OFFSET+2]=d.m11,h[tg.SHADOW_PROJ_DEPTH_INFO_OFFSET+3]=d.m15,h[tg.SHADOW_PROJ_INFO_OFFSET+0]=d.m00,h[tg.SHADOW_PROJ_INFO_OFFSET+1]=d.m05,h[tg.SHADOW_PROJ_INFO_OFFSET+2]=1/d.m00,h[tg.SHADOW_PROJ_INFO_OFFSET+3]=1/d.m05,fn.toArray(h,p,tg.MAT_LIGHT_VIEW_PROJ_OFFSET),tI.set(m,g,0,1-_.shadowSaturation),zi.toArray(h,tI,tg.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET),tI.set(xR.DIRECTIONAL,u,_.shadowNormalBias,y),zi.toArray(h,tI,tg.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET),tI.set(a.size.x,a.size.y,_.shadowPcf,_.shadowBias),zi.toArray(h,tI,tg.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET)}break;case xR.SPOT:var S=i;a.enabled&&S&&S.shadowEnabled&&(fn.invert(Qw,i.node.getWorldMatrix()),fn.toArray(h,Qw,tg.MAT_LIGHT_VIEW_OFFSET),fn.perspective(Zw,i.angle,1,.001,i.range,!0,l.clipSpaceMinZ,l.clipSpaceSignY,0),fn.multiply($w,Zw,Qw),fn.toArray(h,$w,tg.MAT_LIGHT_VIEW_PROJ_OFFSET),tI.set(.01,i.range,0,0),zi.toArray(h,tI,tg.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET),tI.set(a.size.x,a.size.y,S.shadowPcf,S.shadowBias),zi.toArray(h,tI,tg.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET),tI.set(xR.SPOT,u,S.shadowNormalBias,0),zi.toArray(h,tI,tg.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET))}Zi.toArray(h,a.shadowColor,tg.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(!Ay()){this._initCombineSignY();var n=t.createBuffer(new wc(wl.UNIFORM|wl.TRANSFER_DST,Dl.HOST|Dl.DEVICE,Zm.SIZE,Zm.SIZE));i.bindBuffer(Zm.BINDING,n);var r=t.createBuffer(new wc(wl.UNIFORM|wl.TRANSFER_DST,Dl.HOST|Dl.DEVICE,$m.SIZE,$m.SIZE));i.bindBuffer($m.BINDING,r);var s=t.createBuffer(new wc(wl.UNIFORM|wl.TRANSFER_DST,Dl.HOST|Dl.DEVICE,tg.SIZE,tg.SIZE)),a=Ay()?Dw("CCShadow"):tg.BINDING;i.bindBuffer(a,s);var o=t.createBuffer(new wc(wl.UNIFORM|wl.TRANSFER_DST,Dl.HOST|Dl.DEVICE,eg.SIZE,eg.SIZE)),h=Ay()?Dw("CCCSM"):eg.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(Zm.BINDING),this._globalUBO),i.bindBuffer(Zm.BINDING,n.getBuffer(Zm.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($m.BINDING),this._cameraUBO),i.bindBuffer($m.BINDING,n.getBuffer($m.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(ig,s.get(a).colorTextures[0]),t.updateShadowUBOView(this._pipeline,this._shadowUBO,this._csmUBO,e),n.update();var o=Ay()?Dw("CCShadow"):tg.BINDING;r[0].updateBuffer(n.getBuffer(o),this._shadowUBO);var h=Ay()?Dw("CCCSM"):eg.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(ig,xS.get("default-texture").getGFXTexture()),e.bindTexture(cg,xS.get("default-texture").getGFXTexture()),e.update();var r=Ay()?Dw("CCShadow"):tg.BINDING;this._pipeline.commandBuffers[0].updateBuffer(e.getBuffer(r),this._shadowUBO)},e.updateShadowUBORange=function(t,e){e instanceof fn?fn.toArray(this._shadowUBO,e,t):e instanceof Zi&&Zi.toArray(this._shadowUBO,e,t)},e.destroy=function(){},t}();nI._combineSignY=0;var rI,sI,aI,oI,hI,uI,lI,cI,_I=t("cO",Is("RenderStage")((Ww=function(){function t(){this._name=Xw&&Xw(),this._priority=jw&&jw(),this._enabled=!0,this._tag=Yw&&Yw(),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}(),Xw=Ss(Ww.prototype,"_name",[ks],(function(){return""})),jw=Ss(Ww.prototype,"_priority",[ks],(function(){return 0})),Yw=Ss(Ww.prototype,"_tag",[ks],(function(){return 0})),Hw=Ww))||Hw);v.RenderStage=_I;var fI,dI=t("cN",(rI=Is("RenderFlow"),sI=ha([_I]),rI((oI=function(){function t(){this._name=hI&&hI(),this._priority=uI&&uI(),this._tag=lI&&lI(),this._stages=cI&&cI(),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}(),hI=Ss(oI.prototype,"_name",[ks],(function(){return""})),uI=Ss(oI.prototype,"_priority",[ks],(function(){return 0})),lI=Ss(oI.prototype,"_tag",[ks],(function(){return 0})),cI=Ss(oI.prototype,"_stages",[sI,ks],(function(){return[]})),aI=oI))||aI));v.RenderFlow=dI,t("d2",fI),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"}(fI||t("d2",fI={}));var pI,mI,gI,yI,vI,SI,AI,TI,EI,bI,xI,CI,RI,wI,II,BI,DI,PI,OI,MI,NI,LI,FI,kI,GI,VI,UI,zI,HI,WI,XI,jI,YI,qI,KI,JI,QI,ZI,$I,tB,eB,iB,nB,rB,sB,aB,oB,hB,uB,lB,cB,_B,fB,dB,pB,mB,gB,yB,vB,SB,AB,TB,EB,bB,xB,CB,RB,wB,IB,BB,DB,PB,OB,MB,NB,LB,FB,kB,GB,VB,UB,zB,HB,WB,XB,jB,YB,qB,KB,JB,QB=t("d1",function(t){function e(){for(var e,i=arguments.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}(Du)),ZB=new mc,$B=new Ec,tD=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},eD=function(){this.quadIB=null,this.quadVB=null,this.quadIA=null},iD=t("cM",(pI=Is("cc.RenderPipeline"),mI=ha([dI]),pI((yI=function(t){function e(){for(var e,i=arguments.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=vI&&vI(),e._flows=SI&&SI(),e._quadIB=null,e._quadVBOnscreen=null,e._quadVBOffscreen=null,e._quadIAOnscreen=null,e._quadIAOffscreen=null,e._eventProcessor=new QB,e._device=void 0,e._globalDSManager=void 0,e._descriptorSet=void 0,e._commandBuffers=[],e._pipelineUBO=new nI,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 mc,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 qc,s=new Kc;r.format=e,s.format=i,s.stencilStoreOp=Yl.DISCARD,s.depthStoreOp=Yl.DISCARD,t&oc.COLOR||(t&qC?r.loadOp=jl.CLEAR:(r.loadOp=jl.LOAD,r.barrier=n.getGeneralBarrier(new $c(ql.COLOR_ATTACHMENT_WRITE,ql.COLOR_ATTACHMENT_WRITE)))),(t&oc.DEPTH_STENCIL)!==oc.DEPTH_STENCIL&&(t&oc.DEPTH||(s.depthLoadOp=jl.LOAD),t&oc.STENCIL||(s.stencilLoadOp=jl.LOAD)),s.barrier=n.getGeneralBarrier(new $c(ql.DEPTH_STENCIL_ATTACHMENT_WRITE,ql.DEPTH_STENCIL_ATTACHMENT_WRITE));var a=new Zc([r],s);return n.createRenderPass(a)},i.getRenderPass=function(t,e){var i=function(t){for(var e,i=666,n=f(t.colorTextures);!(e=n()).done;){var r=e.value,s=null==r?void 0:r.info;i=fl(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=fl(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=fl(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 i_(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,ZB),e||(e=$B);var i=this.pipelineSceneData.shadingScale;return e.left=ZB.x*i,e.top=ZB.y*i,e.width=ZB.width*i,e.height=ZB.height*i,e},i.generateScissor=function(t,e){e||(e=ZB),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=of.gfxDevice,this._generateConstantMacros(),this._globalDSManager=new Jw(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(fI.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(XS=i)}XS=null}(t);for(var e=0;e<t.length;e++){var i=t[e];if(i.scene){this.emit(fI.RENDER_CAMERA_BEGIN,i),nR(this,i),rR(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(fI.RENDER_CAMERA_END,i)}}this.emit(fI.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 El.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 El.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 El.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 El.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 eD,e=4*Float32Array.BYTES_PER_ELEMENT,i=4*e,n=this._device.createBuffer(new wc(wl.VERTEX|wl.TRANSFER_DST,Dl.DEVICE|Dl.HOST,i,e));if(!n)return t;var r=Uint8Array.BYTES_PER_ELEMENT,s=6*r,a=this._device.createBuffer(new wc(wl.INDEX|wl.TRANSFER_DST,Dl.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 Xc("a_position",xl.RG32F),h[1]=new Xc("a_texCoord",xl.RG32F);var u=this._device.createInputAssembler(new Yc(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(El.IDENTITY,t);this._quadVBOffscreen.update(n);var r=this._genQuadVertexData(e.swapchain&&e.swapchain.surfaceTransform||El.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(xl.RGBA32F)&(Nl.RENDER_TARGET|Nl.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(bl.INPUT_ATTACHMENT_BENEFIT)?1:0)+"\n",t+="#define CC_PLATFORM_ANDROID_AND_WEBGL "+(Gu.os===Nu.ANDROID&&Gu.isBrowser?1:0)+"\n",t+="#define CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES "+(be.ENABLE_WEBGL_HIGHP_STRUCT_VALUES?1:0)+"\n",t+="#define CC_JOINT_UNIFORM_CAPACITY "+Eg.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 tD,e=this.device,i=new qc;i.format=xl.RGBA8,i.loadOp=jl.CLEAR,i.storeOp=Yl.STORE,i.barrier=e.getGeneralBarrier(new $c(ql.NONE,ql.COLOR_ATTACHMENT_WRITE)),t.renderPass=e.createRenderPass(new Zc([i]));var n=this._width,r=this._height;t.prefiterTex=e.createTexture(new Oc(Pl.TEX2D,Ol.COLOR_ATTACHMENT|Ol.SAMPLED,xl.RGBA8,n>>1,r>>1)),t.prefilterFramebuffer=e.createFramebuffer(new i_(t.renderPass,[t.prefiterTex])),n>>=1,r>>=1;for(var s=0;s<6;++s)t.downsampleTexs.push(e.createTexture(new Oc(Pl.TEX2D,Ol.COLOR_ATTACHMENT|Ol.SAMPLED,xl.RGBA8,n>>1,r>>1))),t.downsampleFramebuffers[s]=e.createFramebuffer(new i_(t.renderPass,[t.downsampleTexs[s]])),t.upsampleTexs.push(e.createTexture(new Oc(Pl.TEX2D,Ol.COLOR_ATTACHMENT|Ol.SAMPLED,xl.RGBA8,n,r))),t.upsampleFramebuffers[s]=e.createFramebuffer(new i_(t.renderPass,[t.upsampleTexs[s]])),n>>=1,r>>=1;t.combineTex=e.createTexture(new Oc(Pl.TEX2D,Ol.COLOR_ATTACHMENT|Ol.SAMPLED,xl.RGBA8,this._width,this._height)),t.combineFramebuffer=e.createFramebuffer(new i_(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(fI.ATTACHMENT_SCALE_CAHNGED,t))}}]),e}(zf),vI=Ss(yI.prototype,"_tag",[ks],(function(){return 0})),SI=Ss(yI.prototype,"_flows",[mI,ks],(function(){return[]})),gI=yI))||gI));v.RenderPipeline=iD,st(iD.prototype,"RenderPipeline.prototype",[{name:"geometryRenderer",suggest:"please use camera.geometryRenderer instead."}]),function(t){t[t.BLOOM=18]="BLOOM",t[t.POST_PROCESS=19]="POST_PROCESS",t[t.UI=20]="UI"}(AI||(AI={})),function(t){t[t.AR=5]="AR",t[t.FORWARD=10]="FORWARD"}(TI||(TI={})),function(t){t[t.SHADOW=0]="SHADOW",t[t.FORWARD=1]="FORWARD",t[t.UI=10]="UI"}(EI||(EI={})),function(t){t[t.GBUFFER=10]="GBUFFER",t[t.LIGHTING=15]="LIGHTING",t[t.TRANSPARENT=18]="TRANSPARENT"}(bI||(bI={})),function(t){t[t.SHADOW=0]="SHADOW",t[t.MAIN=1]="MAIN",t[t.UI=10]="UI"}(xI||(xI={})),ve(Pl),ve(Ol),ve(Yl),ve(jl),ve(ql),ve(xl),function(t){t[t.SCENE=0]="SCENE",t[t.POSTPROCESS=1]="POSTPROCESS",t[t.UI=2]="UI"}(JB||(JB={})),ve(JB),CI=Is("RenderTextureDesc"),RI=ha(Pl),wI=ha(Ol),II=ha(xl),CI((BI=function(){this.name=DI&&DI(),this.type=PI&&PI(),this.usage=OI&&OI(),this.format=MI&&MI(),this.width=NI&&NI(),this.height=LI&&LI()},DI=Ss(BI.prototype,"name",[ks],(function(){return""})),PI=Ss(BI.prototype,"type",[RI],(function(){return Pl.TEX2D})),OI=Ss(BI.prototype,"usage",[wI],(function(){return Ol.COLOR_ATTACHMENT})),MI=Ss(BI.prototype,"format",[II],(function(){return xl.UNKNOWN})),NI=Ss(BI.prototype,"width",[ks],(function(){return-1})),LI=Ss(BI.prototype,"height",[ks],(function(){return-1})),BI));var nD=(FI=Is("RenderTextureConfig"),kI=ha(dR),FI((VI=function(){this.name=UI&&UI(),this.texture=zI&&zI()},UI=Ss(VI.prototype,"name",[ks],(function(){return""})),zI=Ss(VI.prototype,"texture",[kI],(function(){return null})),GI=VI))||GI);HI=Is("MaterialConfig"),WI=ha(KS),HI((XI=function(){this.name=jI&&jI(),this.material=YI&&YI()},jI=Ss(XI.prototype,"name",[ks],(function(){return""})),YI=Ss(XI.prototype,"material",[WI],(function(){return null})),XI)),qI=Is("FrameBufferDesc"),KI=ha([Ke]),JI=ha(dR),qI((QI=function(){this.name=ZI&&ZI(),this.renderPass=$I&&$I(),this.colorTextures=tB&&tB(),this.depthStencilTexture=eB&&eB(),this.texture=iB&&iB()},ZI=Ss(QI.prototype,"name",[ks],(function(){return""})),$I=Ss(QI.prototype,"renderPass",[ks],(function(){return 0})),tB=Ss(QI.prototype,"colorTextures",[KI],(function(){return[]})),eB=Ss(QI.prototype,"depthStencilTexture",[ks],(function(){return""})),iB=Ss(QI.prototype,"texture",[JI],(function(){return null})),QI));var rD,sD=(nB=Is("ColorDesc"),rB=ha(xl),sB=ha(jl),aB=ha(Yl),oB=ha(ql),hB=ha(ql),nB((lB=function(){this.format=cB&&cB(),this.loadOp=_B&&_B(),this.storeOp=fB&&fB(),this.sampleCount=dB&&dB(),this.beginAccesses=pB&&pB(),this.endAccesses=mB&&mB()},cB=Ss(lB.prototype,"format",[rB],(function(){return xl.UNKNOWN})),_B=Ss(lB.prototype,"loadOp",[sB],(function(){return jl.CLEAR})),fB=Ss(lB.prototype,"storeOp",[aB],(function(){return Yl.STORE})),dB=Ss(lB.prototype,"sampleCount",[ks],(function(){return 1})),pB=Ss(lB.prototype,"beginAccesses",[oB],(function(){return ql.NONE})),mB=Ss(lB.prototype,"endAccesses",[hB],(function(){return ql.COLOR_ATTACHMENT_WRITE})),uB=lB))||uB),aD=(gB=Is("DepthStencilDesc"),yB=ha(xl),vB=ha(jl),SB=ha(Yl),AB=ha(jl),TB=ha(Yl),EB=ha(ql),bB=ha(ql),gB((CB=function(){this.format=RB&&RB(),this.depthLoadOp=wB&&wB(),this.depthStoreOp=IB&&IB(),this.stencilLoadOp=BB&&BB(),this.stencilStoreOp=DB&&DB(),this.sampleCount=PB&&PB(),this.beginAccesses=OB&&OB(),this.endAccesses=MB&&MB()},RB=Ss(CB.prototype,"format",[yB],(function(){return xl.UNKNOWN})),wB=Ss(CB.prototype,"depthLoadOp",[vB],(function(){return jl.CLEAR})),IB=Ss(CB.prototype,"depthStoreOp",[SB],(function(){return Yl.STORE})),BB=Ss(CB.prototype,"stencilLoadOp",[AB],(function(){return jl.CLEAR})),DB=Ss(CB.prototype,"stencilStoreOp",[TB],(function(){return Yl.STORE})),PB=Ss(CB.prototype,"sampleCount",[ks],(function(){return 1})),OB=Ss(CB.prototype,"beginAccesses",[EB],(function(){return ql.NONE})),MB=Ss(CB.prototype,"endAccesses",[bB],(function(){return ql.DEPTH_STENCIL_ATTACHMENT_WRITE})),xB=CB))||xB);NB=Is("RenderPassDesc"),LB=ha([sD]),FB=ha(aD),NB((kB=function(){this.index=GB&&GB(),this.colorAttachments=VB&&VB(),this.depthStencilAttachment=UB&&UB()},GB=Ss(kB.prototype,"index",[ks],(function(){return-1})),VB=Ss(kB.prototype,"colorAttachments",[LB],(function(){return[]})),UB=Ss(kB.prototype,"depthStencilAttachment",[FB],(function(){return new aD})),kB)),function(t){t[t.FRONT_TO_BACK=0]="FRONT_TO_BACK",t[t.BACK_TO_FRONT=1]="BACK_TO_FRONT"}(rD||(rD={})),ve(rD);var oD=(zB=Is("RenderQueueDesc"),HB=ha(rD),WB=ha([Ke]),zB((jB=function(){this.isTransparent=YB&&YB(),this.sortMode=qB&&qB(),this.stages=KB&&KB()},YB=Ss(jB.prototype,"isTransparent",[ks],(function(){return!1})),qB=Ss(jB.prototype,"sortMode",[HB],(function(){return rD.FRONT_TO_BACK})),KB=Ss(jB.prototype,"stages",[WB],(function(){return[]})),XB=jB))||XB);function hD(t,e){return t.hash-e.hash||t.depth-e.depth||t.shaderId-e.shaderId}function uD(t,e){return t.priority-e.priority||t.hash-e.hash||e.depth-t.depth||t.shaderId-e.shaderId}var lD=function(){function t(t){this.queue=void 0,this._passDesc=void 0,this._passPool=void 0,this._passDesc=t,this._passPool=new fu((function(){return{priority:0,hash:0,depth:0,shaderId:0,subModel:null,passIdx:0}}),64),this.queue=new du(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=PS.getOrCreatePipelineState(t,h,u,e,o);i.bindPipelineState(l),i.bindDescriptorSet(Ym.MATERIAL,h.descriptorSet),i.bindDescriptorSet(Ym.LOCAL,s.descriptorSet),i.bindInputAssembler(o),i.draw(o)}},t}();function cD(t){for(var e=0,i=0;i<t.stages.length;i++)e|=CS(t.stages[i]);var n=hD;switch(t.sortMode){case rD.BACK_TO_FRONT:n=uD;break;case rD.FRONT_TO_BACK:n=hD}return new lD({isTransparent:t.isTransparent,phases:e,sortFunc:n})}function _D(t){t.clear()}function fD(t){t.sort()}var dD=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(Ym.MATERIAL,u.descriptorSet);for(var l=null,c=0;c<h.length;++c){var _=h[c];if(_.count){var f=_.shader,d=PS.getOrCreatePipelineState(t,u,f,e,_.ia);l!==d&&(i.bindPipelineState(d),l=d),n&&i.bindDescriptorSet(Ym.GLOBAL,n),r?i.bindDescriptorSet(Ym.LOCAL,_.descriptorSet,r):i.bindDescriptorSet(Ym.LOCAL,_.descriptorSet,a.value.dynamicOffsets),i.bindInputAssembler(_.ia),i.draw(_.ia)}}}a=s.next()}},t}(),pD=new _u((function(){return{subModel:null,passIdx:-1,dynamicOffsets:[],lights:[]}}),16),mD=new Yi,gD=new Float32Array(4),yD=[],vD=[],SD=new fn,AD=new fn,TD=new is(0,0,0,.5,.5,.5),ED=new is;function bD(t,e){return!(!e.worldBounds||Hr.aabbWithAABB(e.worldBounds,t.aabb))}function xD(t,e){return!(!e.worldBounds||Hr.aabbWithAABB(e.worldBounds,t.aabb)&&Hr.aabbFrustum(e.worldBounds,t.frustum))}function CD(t,e){return!(!e.worldBounds||Hr.aabbWithAABB(e.worldBounds,t.aabb))}function RD(t,e){return is.transform(ED,TD,t.node.getWorldMatrix()),!(!e.worldBounds||Hr.aabbWithAABB(e.worldBounds,ED))}var wD="forward-add",ID=CS(wD),BD=[];function DD(t,e,i){void 0===i&&(i="default");var n=v.rendering;Ay()&&(ID=n.getPhaseID(n.getPassID(i),wD)),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===ID||Ay()&&a[h].phaseID===ID){o=h,r=!0;break}e.push(o)}return r}var PD=function(){function t(t){this._pipeline=void 0,this._device=void 0,this._lightPasses=[],this._instancedLightPassPool=pD.alloc(),this._shadowUBO=new Float32Array(tg.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(vg.SIZE/e)*e,this._lightBufferElementCount=this._lightBufferStride/Float32Array.BYTES_PER_ELEMENT,this._lightBuffer=this._device.createBuffer(new wc(wl.UNIFORM|wl.TRANSFER_DST,Dl.HOST|Dl.DEVICE,this._lightBufferStride*this._lightBufferCount,this._lightBufferStride)),this._firstLightBufferView=this._device.createBuffer(new Ic(this._lightBuffer,0,vg.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}pD.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=Ay()?Dw("CCShadow"):tg.BINDING;r.getBuffer(s).destroy(),r.getTexture(ig).destroy(),r.getTexture(cg).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(DD(s,BD,e)&&(vD.length=0,this._lightCulling(r,t),vD.length||!(t.length>0)))for(var a=0;a<s.length;a++){var o=BD[a];if(!(o<0)){var h=s[a],u=h.passes[o];h.passes[0].blendState.targets[0].blend||(Ay()&&Dw("CCForwardLight"),h.descriptorSet.bindBuffer(vg.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];yD[0]=this._instancedLightPassPool.dynamicOffsets[r];var a=n.getOrCreateDescriptorSet(s);this._instancedQueues[r].recordCommandBuffer(t,e,i,a,yD)}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,f=u.passes[l],d=u.shaders[l],p=u.inputAssembler,m=PS.getOrCreatePipelineState(t,f,d,e,p),g=f.descriptorSet,y=u.descriptorSet;i.bindPipelineState(m),i.bindDescriptorSet(Ym.MATERIAL,g),i.bindInputAssembler(p);for(var v=0;v<c.length;++v){var S=_[v],A=n.getOrCreateDescriptorSet(S);yD[0]=c[v],i.bindDescriptorSet(Ym.GLOBAL,A),i.bindDescriptorSet(Ym.LOCAL,y,yD),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 xR.SPHERE:i=bD(r,t);break;case xR.SPOT:i=xD(r,t);break;case xR.POINT:i=CD(r,t);break;case xR.RANGED_DIRECTIONAL:i=RD(r,t)}i||vD.push(n)}},e._addRenderQueue=function(t,e,i,n){var r=this._pipeline.pipelineSceneData.validPunctualLights,s=t.batchingScheme,a=null;s===ES.NONE&&((a=pD.alloc()).subModel=e,a.passIdx=n);for(var o=0;o<vD.length;o++){var h=vD[o],u=r[h];if((u.visibility&i.node.layer)===i.node.layer)switch(s){case ES.INSTANCING:var l=t.getInstancedBuffer(o);l.merge(e,n),l.dynamicOffsets[0]=this._lightBufferStride,this._instancedQueues[o]||(this._instancedQueues[o]=new dD),this._instancedQueues[o].queue.add(l);break;default:a.lights.push(u),a.dynamicOffsets.push(this._lightBufferStride*h)}}s===ES.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=vy(i)?0:1,h=this._pipeline.globalDSManager,u=n.validPunctualLights,l=this._pipeline.device.capabilities,c=0;c<u.length;c++){var _=u[c],f=h.getOrCreateDescriptorSet(_);if(f){var d=void 0,p=void 0;switch(_.type){case xR.SPHERE:a&&nI.updatePlanarNormalAndDistance(r,this._shadowUBO),this._shadowUBO[tg.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+0]=r.size.x,this._shadowUBO[tg.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+1]=r.size.y,this._shadowUBO[tg.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+2]=1,this._shadowUBO[tg.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+3]=0,this._shadowUBO[tg.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+0]=xR.SPHERE,this._shadowUBO[tg.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+1]=o,this._shadowUBO[tg.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+2]=0,this._shadowUBO[tg.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+3]=0,Zi.toArray(this._shadowUBO,r.shadowColor,tg.SHADOW_COLOR_OFFSET);break;case xR.SPOT:var m=_;if(a&&nI.updatePlanarNormalAndDistance(r,this._shadowUBO),fn.invert(SD,_.node.getWorldMatrix()),fn.perspective(AD,_.angle,1,.001,_.range,!0,l.clipSpaceMinZ,l.clipSpaceSignY,0),d=AD.clone(),p=AD.clone().invert(),fn.multiply(AD,AD,SD),fn.toArray(this._shadowUBO,SD,tg.MAT_LIGHT_VIEW_OFFSET),fn.toArray(this._shadowUBO,AD,tg.MAT_LIGHT_VIEW_PROJ_OFFSET),this._shadowUBO[tg.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET+0]=.01,this._shadowUBO[tg.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET+1]=_.range,this._shadowUBO[tg.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET+2]=0,this._shadowUBO[tg.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET+3]=0,this._shadowUBO[tg.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+0]=r.size.x,this._shadowUBO[tg.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+1]=r.size.y,this._shadowUBO[tg.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+2]=m.shadowPcf,this._shadowUBO[tg.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+3]=m.shadowBias,this._shadowUBO[tg.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+0]=xR.SPOT,this._shadowUBO[tg.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+1]=o,this._shadowUBO[tg.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+2]=m.shadowNormalBias,this._shadowUBO[tg.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+3]=0,this._shadowUBO[tg.SHADOW_PROJ_DEPTH_INFO_OFFSET+0]=d.m10,this._shadowUBO[tg.SHADOW_PROJ_DEPTH_INFO_OFFSET+1]=d.m14,this._shadowUBO[tg.SHADOW_PROJ_DEPTH_INFO_OFFSET+2]=d.m11,this._shadowUBO[tg.SHADOW_PROJ_DEPTH_INFO_OFFSET+3]=d.m15,this._shadowUBO[tg.SHADOW_INV_PROJ_DEPTH_INFO_OFFSET+0]=p.m10,this._shadowUBO[tg.SHADOW_INV_PROJ_DEPTH_INFO_OFFSET+1]=p.m14,this._shadowUBO[tg.SHADOW_INV_PROJ_DEPTH_INFO_OFFSET+2]=p.m11,this._shadowUBO[tg.SHADOW_INV_PROJ_DEPTH_INFO_OFFSET+3]=p.m15,this._shadowUBO[tg.SHADOW_PROJ_INFO_OFFSET+0]=d.m00,this._shadowUBO[tg.SHADOW_PROJ_INFO_OFFSET+1]=d.m05,this._shadowUBO[tg.SHADOW_PROJ_INFO_OFFSET+2]=1/d.m00,this._shadowUBO[tg.SHADOW_PROJ_INFO_OFFSET+3]=1/d.m05,Zi.toArray(this._shadowUBO,r.shadowColor,tg.SHADOW_COLOR_OFFSET),s.has(_)){var g,y=null===(g=s.get(_))||void 0===g?void 0:g.colorTextures[0];y&&f.bindTexture(cg,y)}break;case xR.POINT:a&&nI.updatePlanarNormalAndDistance(r,this._shadowUBO),this._shadowUBO[tg.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+0]=r.size.x,this._shadowUBO[tg.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+1]=r.size.y,this._shadowUBO[tg.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+2]=1,this._shadowUBO[tg.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+3]=0,this._shadowUBO[tg.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+0]=xR.POINT,this._shadowUBO[tg.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+1]=o,this._shadowUBO[tg.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+2]=0,this._shadowUBO[tg.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+3]=0,Zi.toArray(this._shadowUBO,r.shadowColor,tg.SHADOW_COLOR_OFFSET)}f.update();var v=Ay()?Dw("CCShadow"):tg.BINDING;e.updateBuffer(f.getBuffer(v),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=Ni(a.length),this._lightBuffer.resize(this._lightBufferStride*this._lightBufferCount),this._lightBufferData=new Float32Array(this._lightBufferElementCount*this._lightBufferCount),this._firstLightBufferView.initialize(new Ic(this._lightBuffer,0,vg.SIZE)));for(var o=0,h=0;o<a.length;o++,h+=this._lightBufferElementCount){var u=a[o];switch(u.type){case xR.SPHERE:if(Yi.toArray(gD,u.position),gD[3]=xR.SPHERE,this._lightBufferData.set(gD,h+vg.LIGHT_POS_OFFSET),gD[0]=u.size,gD[1]=u.range,gD[2]=0,gD[3]=0,this._lightBufferData.set(gD,h+vg.LIGHT_SIZE_RANGE_ANGLE_OFFSET),Yi.toArray(gD,u.color),u.useColorTemperature){var l=u.finalColor;gD[0]=l.x,gD[1]=l.y,gD[2]=l.z}gD[3]=r?u.luminance*i*this._lightMeterScale:u.luminance,this._lightBufferData.set(gD,h+vg.LIGHT_COLOR_OFFSET);break;case xR.SPOT:if(Yi.toArray(gD,u.position),gD[3]=xR.SPOT,this._lightBufferData.set(gD,h+vg.LIGHT_POS_OFFSET),gD[0]=u.size,gD[1]=u.range,gD[2]=u.spotAngle,gD[3]=s.enabled&&u.shadowEnabled&&s.type===QS.ShadowMap?1:0,this._lightBufferData.set(gD,h+vg.LIGHT_SIZE_RANGE_ANGLE_OFFSET),Yi.toArray(gD,u.direction),this._lightBufferData.set(gD,h+vg.LIGHT_DIR_OFFSET),Yi.toArray(gD,u.color),u.useColorTemperature){var c=u.finalColor;gD[0]=c.x,gD[1]=c.y,gD[2]=c.z}gD[3]=r?u.luminance*i*this._lightMeterScale:u.luminance,this._lightBufferData.set(gD,h+vg.LIGHT_COLOR_OFFSET);break;case xR.POINT:if(Yi.toArray(gD,u.position),gD[3]=xR.POINT,this._lightBufferData.set(gD,h+vg.LIGHT_POS_OFFSET),gD[0]=0,gD[1]=u.range,gD[2]=0,gD[3]=0,this._lightBufferData.set(gD,h+vg.LIGHT_SIZE_RANGE_ANGLE_OFFSET),Yi.toArray(gD,u.color),u.useColorTemperature){var _=u.finalColor;gD[0]=_.x,gD[1]=_.y,gD[2]=_.z}gD[3]=r?u.luminance*i*this._lightMeterScale:u.luminance,this._lightBufferData.set(gD,h+vg.LIGHT_COLOR_OFFSET);break;case xR.RANGED_DIRECTIONAL:Yi.toArray(gD,u.position),gD[3]=xR.RANGED_DIRECTIONAL,this._lightBufferData.set(gD,h+vg.LIGHT_POS_OFFSET),Yi.toArray(gD,u.right),gD[3]=0,this._lightBufferData.set(gD,h+vg.LIGHT_SIZE_RANGE_ANGLE_OFFSET),Yi.toArray(gD,u.direction),gD[3]=0,this._lightBufferData.set(gD,h+vg.LIGHT_DIR_OFFSET);var f=u.scale;if(mD.set(.5*f.x,.5*f.y,.5*f.z),Yi.toArray(gD,mD),gD[3]=0,this._lightBufferData.set(gD,h+vg.LIGHT_BOUNDING_SIZE_VS_OFFSET),Yi.toArray(gD,u.color),u.useColorTemperature){var d=u.finalColor;gD[0]=d.x,gD[1]=d.y,gD[2]=d.z}gD[3]=r?u.illuminance*i:u.illuminance,this._lightBufferData.set(gD,h+vg.LIGHT_COLOR_OFFSET)}}e.updateBuffer(this._lightBuffer,this._lightBufferData)},t}(),OD=new is,MD=CS("planar-shadow");function ND(t){var e=t.passes,i=v.rendering;Ay()&&(MD=i.getPhaseID(i.getPassID("default"),"planar-shadow"));for(var n=0;n<e.length;n++)if((!i||!i.enableEffectImport)&&e[n].phase===MD||Ay()&&e[n].phaseID===MD)return n;return-1}var LD,FD,kD,GD,VD,UD,zD,HD,WD=function(){function t(t){this._subModelArray=[],this._shaderArray=[],this._passArray=[],this._castModels=[],this._instancedQueue=new dD,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===QS.Planar&&!(i.normal.length()<1e-6)){var n=t.scene,r=t.frustum,s=0!=(t.visibility&kp.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||(is.transform(OD,c.worldBounds,i.matLight),Hr.aabbFrustum(OD,r)))for(var _=c.subModels,f=0;f<_.length;f++){var d=_[f],p=ND(d);if(p<0){this._subModelArray.push(d);var m=i.getPlanarShader(d.patches);if(!m)continue;this._shaderArray.push(m),this._passArray.push(i.material.passes[0])}else{var g=d.passes[p];if(g.batchingScheme===ES.INSTANCING){var y=g.getInstancedBuffer();y.merge(d,p),this._instancedQueue.queue.add(y)}else{var v=d.shaders[p];this._subModelArray.push(d),v&&this._shaderArray.push(v),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===QS.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=PS.getOrCreatePipelineState(t,o,a,e,h),l=o.descriptorSet;i.bindPipelineState(u),i.bindDescriptorSet(Ym.MATERIAL,l),i.bindDescriptorSet(Ym.LOCAL,s.descriptorSet),i.bindInputAssembler(h),i.draw(h)}}},t}(),XD=function(){function t(){this._phaseID=CS("default");var t=v.rendering;Ay()&&(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],f=o.inputAssembler,d=PS.getOrCreatePipelineState(n,c,_,e,f);r.bindPipelineState(d),r.bindDescriptorSet(Ym.MATERIAL,c.descriptorSet);var p=o.descriptorSet;r.bindDescriptorSet(Ym.LOCAL,p),r.bindInputAssembler(f),r.draw(f)}}}},t}(),jD=[new bc(0,0,0,1)],YD=t("cS",(LD=Is("ForwardStage"),FD=ha([oD]),LD(((UD=function(t){function e(){var e;return(e=t.call(this)||this).renderQueues=VD&&VD(),e._renderQueues=[],e._renderArea=new mc,e._instancedQueue=void 0,e._phaseID=CS("default"),e._clearFlag=4294967295,e.additiveInstanceQueues=[],e._instancedQueue=new dD,e._uiPhase=new XD,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]=cD(this.renderQueues[n]);this._additiveLightQueue=new PD(this._pipeline),this._planarQueue=new WD(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(_D);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 f=_[a];if(f.phase===this._phaseID)if(f.batchingScheme===ES.INSTANCING){var d=f.getInstancedBuffer();d.merge(c,a),this._instancedQueue.queue.add(d)}else for(o=0;o<this._renderQueues.length;o++)this._renderQueues[o].insertRenderPass(u,s,a)}}}this._instancedQueue.sort(),this._renderQueues.forEach(fD);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&oc.COLOR&&(jD[0].x=t.clearColor.x,jD[0].y=t.clearColor.y,jD[0].z=t.clearColor.z,jD[0].w=t.clearColor.w),i.generateRenderArea(t,this._renderArea);var g=t.window.framebuffer,y=i.getRenderPass(t.clearFlag&this._clearFlag,g);p.beginRenderPass(y,g,this._renderArea,jD,t.clearDepth,t.clearStencil),p.bindDescriptorSet(Ym.GLOBAL,i.descriptorSet),this._renderQueues[0].recordCommandBuffer(n,y,p);for(var v=0;v<this.additiveInstanceQueues.length;v++)this.additiveInstanceQueues[v].recordCommandBuffer(n,y,p);this._instancedQueue.recordCommandBuffer(n,y,p),this._additiveLightQueue.recordCommandBuffer(n,y,p),p.bindDescriptorSet(Ym.GLOBAL,i.descriptorSet),this._planarQueue.recordCommandBuffer(n,y,p),this._renderQueues[1].recordCommandBuffer(n,y,p),null===(e=t.geometryRenderer)||void 0===e||e.render(y,p,i.pipelineSceneData),this._uiPhase.render(t,y),YS(n,y,p,i.profiler,t),p.endRenderPass()},e}(_I)).initInfo={name:"ForwardStage",priority:TI.FORWARD,tag:0,renderQueues:[{isTransparent:!1,sortMode:rD.FRONT_TO_BACK,stages:["default"]},{isTransparent:!0,sortMode:rD.BACK_TO_FRONT,stages:["default","planarShadow"]}]},VD=Ss((GD=UD).prototype,"renderQueues",[FD,ks],(function(){return[]})),kD=GD))||kD)),qD=t("cR",Is("ForwardFlow")(((HD=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 YD;i.initialize(YD.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}(dI)).initInfo={name:Gm,priority:EI.FORWARD,stages:[]},zD=HD))||zD),KD=CS("shadow-caster");function JD(t){var e=t.passes,i=v.rendering;Ay()&&(KD=i.getPhaseID(i.getPassID("default"),"shadow-caster"));for(var n=0;n<e.length;n++)if((!i||!i.enableEffectImport)&&e[n].phase===KD||Ay()&&e[n].phaseID===KD)return n;return-1}var QD,ZD,$D,tP,eP=function(){function t(t){this._pipeline=void 0,this._subModelsArray=[],this._passArray=[],this._shaderArray=[],this._instancedQueue=void 0,this._pipeline=t,this._instancedQueue=new dD}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===QS.ShadowMap){switch(e.type){case xR.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?Hr.aabbFrustum(l.worldBounds,s)&&(a.push(u),i.level<n.csmLevel&&n.csmOptimizationMode===tA.RemoveDuplicates&&Hr.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 xR.SPOT:var _=e;if(_.shadowEnabled)for(var f=_.visibility,d=r.csmLayers.castShadowObjects,p=0;p<d.length;p++){var m=d[p].model;(!m.worldBounds||(f&m.node.layer)===m.node.layer&&Hr.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=JD(r);if(!(s<0)){var a=r.passes[s];if(a.batchingScheme===ES.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=PS.getOrCreatePipelineState(t,a,s,e,o),u=a.descriptorSet;i.bindPipelineState(h),i.bindDescriptorSet(Ym.MATERIAL,u),i.bindDescriptorSet(Ym.LOCAL,r.descriptorSet),i.bindInputAssembler(o),i.draw(o)}},t}(),iP=[new bc(1,1,1,1)],nP=t("c_",Is("ShadowStage")(((ZD=function(t){function e(){for(var e,i=arguments.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 mc,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){iP[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,iP,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 xR.DIRECTIONAL:var u=this._light;if(u.shadowFixedArea||u.csmLevel===$S.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 xR.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,iP,t.clearDepth,t.clearStencil),s.bindDescriptorSet(Ym.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 eP(e),this._isShadowMapCleared=!1},e}(_I)).initInfo={name:"ShadowStage",priority:TI.FORWARD,tag:0},QD=ZD))||QD),rP=[],sP=t("cZ",Is("ShadowFlow")(((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)._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 nP;i.initialize(nP.initInfo),this._stages.push(i)}return!0},i.activate=function(e){t.prototype.activate.call(this,e);var i=vy(e.device)?0:1;e.macros.CC_SHADOWMAP_FORMAT=i;var n=e.device.gfxAPI===Tl.WEBGL?1:0;e.macros.CC_SHADOWMAP_USE_LINEAR_DEPTH=n,e.pipelineSceneData.csmSupported=e.device.capabilities.maxFragmentUniformVectors>=(Zm.COUNT+$m.COUNT+tg.COUNT+eg.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=ZS.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===QS.ShadowMap){for(var o=0,h=0;o<i.maxReceived&&h<a.length;){var u=a[h];u.type===xR.SPOT&&u.shadowEnabled&&(rP.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 f=e.pipelineSceneData.csmSupported?l.csmLevel:1,d=0;d<f;d++)this._renderStage(t,l,_,c,d)}for(var p=0;p<rP.length;p++){var m=rP[p],g=e.globalDSManager.getOrCreateDescriptorSet(m);r.has(m)||this._initShadowFrameBuffer(e,m,t.window.swapchain);var y=r.get(m);this._renderStage(t,m,y,g)}rP.length=0}else this.clearShadowMap(rP,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=vy(i)?xl.R32F:xl.RGBA8;if(!this._shadowRenderPass){var a=new qc;a.format=s,a.loadOp=jl.CLEAR,a.storeOp=Yl.STORE,a.sampleCount=1;var o=new Kc;o.format=xl.DEPTH_STENCIL,o.depthLoadOp=jl.CLEAR,o.depthStoreOp=Yl.DISCARD,o.stencilLoadOp=jl.CLEAR,o.stencilStoreOp=Yl.DISCARD,o.sampleCount=1;var h=new Zc([a],o);this._shadowRenderPass=i.createRenderPass(h)}var u=[];u.push(i.createTexture(new Oc(Pl.TEX2D,Ol.COLOR_ATTACHMENT|Ol.SAMPLED,s,n.x,n.y)));var l=i.createTexture(new Oc(Pl.TEX2D,Ol.DEPTH_STENCIL_ATTACHMENT,xl.DEPTH_STENCIL,n.x,n.y)),c=i.createFramebuffer(new i_(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),f=0;f<this._stages.length;f++){var d=this._stages[f];d.setUsage(c,l,_),d.clearFramebuffer(e)}}},i.resizeShadowMap=function(){for(var t,e=this._pipeline.pipelineSceneData.shadows,i=e.size,n=this._pipeline,r=n.device,s=n.pipelineSceneData.shadowFrameBufferMap,a=vy(r)?xl.R32F:xl.RGBA8,o=f(s.keys());!(t=o()).done;){var h=t.value,u=s.get(h);if(u){var l=[];l.push(n.device.createTexture(new Oc(Pl.TEX2D,Ol.COLOR_ATTACHMENT|Ol.SAMPLED,a,i.x,i.y)));var c=u.depthStencilTexture;c&&c.resize(i.x,i.y);var _=u.renderPass;u.destroy();var d=r.createFramebuffer(new i_(_,l,c));s.set(h,d)}}e.shadowMapDirty=!1},e}(dI)).initInfo={name:Vm,priority:EI.SHADOW,tag:JB.SCENE,stages:[]},$D=tP))||$D),aP=new fn,oP=new fn,hP=new fn,uP=new fn,lP=new fn,cP=new fn,_P=new fn,fP=new Yi(0,0,0),dP=new Yi,pP=new yn,mP=new Yi,gP=new Yi,yP=new Yi(1e7,1e7,1e7),vP=new Yi(-1e7,-1e7,-1e7),SP=new Yi,AP=0,TP=0,EP=function(){function t(t){this._shadowObjects=[],this._shadowCameraFar=0,this._level=void 0,this._matShadowView=new fn,this._matShadowProj=new fn,this._matShadowViewProj=new fn,this._validFrustum=new us,this._splitFrustum=new us,this._lightViewFrustum=new us,this._castLightViewBoundingBox=new is,this._level=t,this._validFrustum.accurate=!0,this._splitFrustum.accurate=!0,this._lightViewFrustum.accurate=!0}var e=t.prototype;return e.copyToValidFrustum=function(t){us.copy(this._validFrustum,t)},e.calculateValidFrustumOrtho=function(t,e,i,n,r){us.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;us.copy(this._lightViewFrustum,this._splitFrustum),fn.fromRT(oP,t.node.rotation,fP),fn.invert(hP,oP);var s,a,o=hP.clone();this._lightViewFrustum.transform(hP),is.fromPoints(this._castLightViewBoundingBox,yP,vP),this._castLightViewBoundingBox.mergeFrustum(this._lightViewFrustum),t.csmOptimizationMode===tA.DisableRotationFix?(s=2*this._castLightViewBoundingBox.halfExtents.x,a=2*this._castLightViewBoundingBox.halfExtents.y):s=a=Yi.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===tA.RemoveDuplicates)if(this._level>=h-1)TP=this._castLightViewBoundingBox.halfExtents.z,AP=this._castLightViewBoundingBox.center.z;else{var u=Math.abs(this._castLightViewBoundingBox.center.z-AP)+TP;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(SP.set(c.x,c.y,c.z+l+r),Yi.transformMat4(SP,SP,oP),fn.fromRT(oP,t.node.rotation,SP),fn.invert(hP,oP),!i){var _=.5*s,f=.5*a;fn.ortho(uP,-_,_,-f,f,.1,this._shadowCameraFar,n.capabilities.clipSpaceMinZ,n.capabilities.clipSpaceSignY),fn.multiply(cP,uP,o),Yi.transformMat4(dP,SP,cP);var d=2/e;pP.set(d,d);var p=dP.x%pP.x,m=dP.y%pP.y;mP.set(dP.x-p,dP.y-m,dP.z),fn.invert(_P,cP),Yi.transformMat4(gP,mP,_P),fn.fromRT(oP,t.node.rotation,gP),fn.invert(hP,oP),fn.multiply(lP,uP,hP),fn.copy(this._matShadowView,hP),fn.copy(this._matShadowProj,uP),fn.copy(this._matShadowViewProj,lP)}us.createOrtho(this._validFrustum,s,a,.1,this._shadowCameraFar,oP)},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}(),bP=function(t){function e(e){var i;return(i=t.call(this,e)||this)._splitCameraNear=0,i._splitCameraFar=0,i._csmAtlas=new zi,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}(EP),xP=function(){function t(){this._castShadowObjects=[],this._layerObjects=new du(64),this._layers=[],this._levelCount=0,this._specialLayer=new EP(1),this._shadowDistance=0;for(var t=0;t<$S.LEVEL_4;t++)this._layers[t]=new bP(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;fn.fromRT(oP,t.node.getWorldRotation(),t.node.getWorldPosition()),fn.invert(hP,oP),fn.ortho(uP,-i,i,-n,n,r,s,e.capabilities.clipSpaceMinZ,e.capabilities.clipSpaceSignY),fn.multiply(lP,uP,hP),this._specialLayer.matShadowView=hP,this._specialLayer.matShadowProj=uP,this._specialLayer.matShadowViewProj=lP,this._specialLayer.calculateValidFrustumOrtho(2*i,2*n,r,s,oP)},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(aP,t);for(var s=n-1;s>=0;s--){var a=this._layers[s],o=a.splitCameraNear,h=a.splitCameraFar;a.calculateSplitFrustum(t,aP,o,h),a.createMatrix(e,r,!1)}n===$S.LEVEL_1?(this._specialLayer.shadowCameraFar=this._layers[0].shadowCameraFar,fn.copy(this._specialLayer.matShadowView,this._layers[0].matShadowView),fn.copy(this._specialLayer.matShadowProj,this._layers[0].matShadowProj),fn.copy(this._specialLayer.matShadowViewProj,this._layers[0].matShadowViewProj),this._specialLayer.copyToValidFrustum(this._layers[0].validFrustum)):(this._specialLayer.calculateSplitFrustum(t,aP,.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();fn.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}(),CP=t("cP",function(){function t(){this.fog=new CE,this.ambient=new Nm,this.skybox=new hA,this.shadows=new iA,this.csmLayers=new xP,this.octree=new IR,this.skin=new BR,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 KS,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 KS;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 wc(wl.VERTEX|wl.TRANSFER_DST,Dl.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 wc(wl.INDEX|wl.TRANSFER_DST,Dl.DEVICE,a,s)),this._occlusionQueryIndicesBuffer.update(r);var o=[new Xc("a_position",xl.RGB32F)],h=new Yc(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}()),RP=kp.makeMaskExclude([kp.BitMask.UI_2D,kp.BitMask.UI_3D,kp.BitMask.GIZMOS,kp.BitMask.EDITOR,kp.BitMask.SCENE_GIZMO,kp.BitMask.PROFILER]),wP="CC_USE_RGBE_OUTPUT",IP=CS("default"),BP=CS("reflect-map");function DP(t){var e=t.passes,i=v.rendering;Ay()&&(IP=i.getPhaseID(i.getPassID("default"),"default"));for(var n=0;n<e.length;n++)if((!i||!i.enableEffectImport)&&e[n].phase===IP||Ay()&&e[n].phaseID===IP)return n;return-1}function PP(t){var e=t.passes,i=v.rendering;Ay()&&(BP=i.getPhaseID(i.getPassID("default"),"reflect-map"));for(var n=0;n<e.length;n++)if((!i||!i.enableEffectImport)&&e[n].phase===BP||Ay()&&e[n].phaseID===BP)return n;return-1}var OP,MP,NP,LP,FP,kP,GP,VP,UP,zP,HP,WP,XP,jP,YP,qP,KP,JP,QP,ZP,$P,tO,eO,iO,nO,rO,sO,aO,oO,hO,uO,lO,cO=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 dD}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&qC&&this.add(r.model);for(var s=n.models,a=t.camera.visibility,o=0;o<s.length;o++){var h=s[o];n.isCulledByLod(e,h)||h.enabled&&h.node&&h.worldBounds&&h.bakeToReflectionProbe&&(t.probeType===cR.CUBE?((a&h.node.layer)===h.node.layer||a&h.visFlags)&&Hr.aabbWithAABB(h.worldBounds,t.boundingBox)&&this.add(h):((h.node.layer&RP)===h.node.layer||RP&h.visFlags)&&Hr.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=PP(n),s=!0;if(r<0&&(r=DP(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:wP,value:!0}];this._patches=this._patches.concat(h),n.onMacroPatchesStateChanged(this._patches),this._rgbeSubModelsArray.push(n)}if(o===ES.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=PS.getOrCreatePipelineState(t,a,s,e,o),u=a.descriptorSet;i.bindPipelineState(h),i.bindDescriptorSet(Ym.MATERIAL,u),i.bindDescriptorSet(Ym.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===wP){this._patches.splice(i,1);break}e.onMacroPatchesStateChanged(this._patches)}}},t}(),_O=[new bc(1,1,1,1)],fO=t("d5",Is("ReflectionProbeStage")(((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)._frameBuffer=null,e._renderArea=new mc,e._probe=null,e._probeRenderQueue=void 0,e._rgbeColor=new Yi,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){_O[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,_O,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&oc.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=bi((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 Yi(0,0,0),new Yi(1,1,1));r.multiplyScalar(255);var s,a,o=tn(r).add((s=r.subtract(tn(r)))<(a=new Yi(.5,.5,.5))?a:s);return new zi(o.x/255,o.y/255,o.z/255,i/255)}(this._rgbeColor);_O[0].x=r.x,_O[0].y=r.y,_O[0].z=r.z,_O[0].w=r.w}var s=e.device;i.beginRenderPass(n,this._frameBuffer,this._renderArea,_O,this._probe.camera.clearDepth,this._probe.camera.clearStencil),i.bindDescriptorSet(Ym.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 cO(e)},e}(_I)).initInfo={name:"ReflectionProbeStage",priority:TI.FORWARD,tag:0},OP=MP))||OP),dO=t("d4",Is("ReflectionProbeFlow")(((LP=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 fO;i.initialize(fO.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===cR.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===cR.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}(dI)).initInfo={name:"PIPELINE_FLOW_RELECTION_PROBE",priority:0,tag:JB.SCENE,stages:[]},NP=LP))||NP),pO=t("cQ",(FP=Is("ForwardPipeline"),kP=ha([nD]),FP((VP=function(t){function e(){for(var e,i=arguments.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=UP&&UP(),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 sP;i.initialize(sP.initInfo),this._flows.push(i);var n=new dO;n.initialize(dO.initInfo),this._flows.push(n);var r=new qD;r.initialize(qD.initInfo),this._flows.push(r)}return!0},i.activate=function(e){return this._macros={CC_PIPELINE_TYPE:0},this._pipelineSceneData=new CP,!(!t.prototype.activate.call(this,e)||!this._activeRenderer(e)&&(J(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(ig,e),this._descriptorSet.bindTexture(ig,xS.get("default-texture").getGFXTexture()),this._descriptorSet.bindSampler(cg,e),this._descriptorSet.bindTexture(cg,xS.get("default-texture").getGFXTexture()),this._descriptorSet.update(),!0},i._destroyUBOs=function(){this._descriptorSet&&(this._descriptorSet.getBuffer(Zm.BINDING).destroy(),this._descriptorSet.getBuffer(tg.BINDING).destroy(),this._descriptorSet.getBuffer($m.BINDING).destroy(),this._descriptorSet.getTexture(ig).destroy(),this._descriptorSet.getTexture(cg).destroy())},n(e,[{key:"postRenderPass",get:function(){return this._postRenderPass}}]),e}(iD),UP=Ss(VP.prototype,"renderTextures",[kP,ks],(function(){return[]})),GP=VP))||GP)),mO=[new bc(0,0,0,0),new bc(0,0,0,0),new bc(0,0,0,0)],gO=t("cV",(zP=Is("GbufferStage"),HP=ha([oD]),zP(((YP=function(t){function e(){var e;return(e=t.call(this)||this).renderQueues=jP&&jP(),e._renderQueues=[],e._renderArea=new mc,e._instancedQueue=void 0,e._phaseID=CS("default"),e._instancedQueue=new dD,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]=cD(this.renderQueues[n])},i.destroy=function(){},i.render=function(t){this._instancedQueue.clear();var e=this._pipeline,i=e.device;this._renderQueues.forEach(_D),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===ES.INSTANCING){var f=_.getInstancedBuffer();f.merge(l,s),this._instancedQueue.queue.add(f)}else for(a=0;a<this._renderQueues.length;a++)this._renderQueues[a].insertRenderPass(h,r,s)}}}this._renderQueues.forEach(fD);var d=e.commandBuffers[0];this._instancedQueue.uploadBuffers(d),t.clearFlag&oc.COLOR&&(e.pipelineSceneData.isHDR?NS(mO[0],t.clearColor):(mO[0].x=t.clearColor.x,mO[0].y=t.clearColor.y,mO[0].z=t.clearColor.z)),mO[0].w=t.clearColor.w;var p=e.getPipelineRenderData().gbufferFrameBuffer,m=p.renderPass;d.beginRenderPass(m,p,this._renderArea,mO,t.clearDepth,t.clearStencil),d.setScissor(e.generateScissor(t)),d.setViewport(e.generateViewport(t)),d.bindDescriptorSet(Ym.GLOBAL,e.descriptorSet);for(var g=0;g<this.renderQueues.length;g++)this._renderQueues[g].recordCommandBuffer(i,m,d);this._instancedQueue.recordCommandBuffer(i,m,d),d.endRenderPass()},e}(_I)).initInfo={name:"GbufferStage",priority:bI.GBUFFER,tag:0,renderQueues:[{isTransparent:!1,sortMode:rD.FRONT_TO_BACK,stages:["default"]},{isTransparent:!0,sortMode:rD.BACK_TO_FRONT,stages:["default"]}]},jP=Ss((XP=YP).prototype,"renderQueues",[HP,ks],(function(){return[]})),WP=XP))||WP)),yO=new Yi,vO=new is(0,0,0,.5,.5,.5),SO=new is,AO=[new bc(0,0,0,1)],TO=t("cW",(qP=Is("LightingStage"),KP=ha(KS),JP=ha([oD]),qP(((eO=function(t){function e(){var e;return(e=t.call(this)||this)._deferredLitsBufs=null,e._maxDeferredLights=Sg.LIGHTS_PER_PASS,e._lightBufferData=void 0,e._lightMeterScale=1e4,e._descriptorSet=null,e._descriptorSetLayout=void 0,e._renderArea=new mc,e._uiPhase=void 0,e._deferredMaterial=$P&&$P(),e.renderQueues=tO&&tO(),e._phaseID=CS("default"),e._renderQueues=[],e._uiPhase=new XD,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=$n.create(0,0,0,1),h=new Float32Array(4),u=t.exposure,l=0,c=zi.length,_=c*this._maxDeferredLights,f=0;f<n.length&&l<this._maxDeferredLights;f++,++l){var d=n[f];if($n.set(o,d.position.x,d.position.y,d.position.z,d.range),Hr.sphereFrustum(o,t.frustum)){if(Yi.toArray(h,d.position),h[3]=xR.SPHERE,this._lightBufferData.set(h,l*c),Yi.toArray(h,d.color),d.useColorTemperature){var p=d.finalColor;h[0]=p.x,h[1]=p.y,h[2]=p.z}e.pipelineSceneData.isHDR?h[3]=d.luminance*u*this._lightMeterScale:h[3]=d.luminance,this._lightBufferData.set(h,l*c+1*_),h[0]=d.size,h[1]=d.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($n.set(o,g.position.x,g.position.y,g.position.z,g.range),Hr.sphereFrustum(o,t.frustum)){if(Yi.toArray(h,g.position),h[3]=xR.SPOT,this._lightBufferData.set(h,l*c+0*_),Yi.toArray(h,g.color),g.useColorTemperature){var y=g.finalColor;h[0]=y.x,h[1]=y.y,h[2]=y.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*_),Yi.toArray(h,g.direction),this._lightBufferData.set(h,l*c+3*_)}}for(var v=0;v<s.length&&l<this._maxDeferredLights;v++,++l){var S=s[v];if($n.set(o,S.position.x,S.position.y,S.position.z,S.range),Hr.sphereFrustum(o,t.frustum)){if(Yi.toArray(h,S.position),h[3]=xR.POINT,this._lightBufferData.set(h,l*c),Yi.toArray(h,S.color),S.useColorTemperature){var A=S.finalColor;h[0]=A.x,h[1]=A.y,h[2]=A.z}e.pipelineSceneData.isHDR?h[3]=S.luminance*u*this._lightMeterScale:h[3]=S.luminance,this._lightBufferData.set(h,l*c+1*_),h[0]=0,h[1]=S.range,h[2]=0,this._lightBufferData.set(h,l*c+2*_)}}for(var T=0;T<a.length&&l<this._maxDeferredLights;T++,++l){var E=a[T];if(is.transform(SO,vO,E.node.getWorldMatrix()),Hr.aabbFrustum(SO,t.frustum)){if(Yi.toArray(h,E.position),h[3]=xR.RANGED_DIRECTIONAL,this._lightBufferData.set(h,l*c),Yi.toArray(h,E.color),E.useColorTemperature){var b=E.finalColor;h[0]=b.x,h[1]=b.y,h[2]=b.z}e.pipelineSceneData.isHDR?h[3]=E.illuminance*u:h[3]=E.illuminance,this._lightBufferData.set(h,l*c+1*_),Yi.toArray(h,E.right),h[3]=0,this._lightBufferData.set(h,l*c+2*_),Yi.toArray(h,E.direction),h[3]=0,this._lightBufferData.set(h,l*c+3*_);var x=E.scale;yO.set(.5*x.x,.5*x.y,.5*x.z),Yi.toArray(h,yO),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 wc(wl.UNIFORM|wl.TRANSFER_DST,Dl.HOST|Dl.DEVICE,i,e.capabilities.uboOffsetAlignment));var n=e.createBuffer(new Ic(this._deferredLitsBufs,0,i));this._lightBufferData=new Float32Array(i/Float32Array.BYTES_PER_ELEMENT),this._descriptorSet=e.createDescriptorSet(new s_(t.localSetLayout)),this._descriptorSet.bindBuffer(vg.BINDING,n);var r=e.createBuffer(new wc(wl.UNIFORM|wl.TRANSFER_DST,Dl.DEVICE,dg.SIZE,dg.SIZE));this._descriptorSet.bindBuffer(dg.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]=cD(this.renderQueues[n]);this._planarQueue=new WD(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&oc.COLOR&&(AO[0].x=t.clearColor.x,AO[0].y=t.clearColor.y,AO[0].z=t.clearColor.z),AO[0].w=0;var c=o.outputFrameBuffer,_=c.renderPass;i.pipelineUBO.updateShadowUBO(t),r.beginRenderPass(_,c,this._renderArea,AO,t.clearDepth,t.clearStencil),r.setScissor(i.generateScissor(t)),r.setViewport(i.generateViewport(t)),r.bindDescriptorSet(Ym.GLOBAL,i.descriptorSet);var f=i.quadIAOffscreen,d=null;null!=h&&null!=u&&null!=f&&(d=PS.getOrCreatePipelineState(n,h,u,_,f)),null!=d&&(this._descriptorSet.update(),r.bindPipelineState(d),r.bindDescriptorSet(Ym.MATERIAL,h.descriptorSet),r.bindDescriptorSet(Ym.LOCAL,this._descriptorSet),r.bindInputAssembler(f),r.draw(f)),this._renderQueues.forEach(_D);for(var p=0,m=0,g=0,y=0;y<a.length;++y){var v=a[y],S=v.model.subModels;for(p=0;p<S.length;++p){var A=S[p].passes;for(m=0;m<A.length;++m)if(A[m].phase===this._phaseID)for(g=0;g<this._renderQueues.length;g++)this._renderQueues[g].insertRenderPass(v,p,m)}}if(a.length>0){this._renderQueues.forEach(fD);for(var T=0;T<this._renderQueues.length;T++)this._renderQueues[T].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}(_I)).initInfo={name:"LightingStage",priority:bI.LIGHTING,tag:0},$P=Ss((ZP=eO).prototype,"_deferredMaterial",[KP,ks],(function(){return null})),tO=Ss(ZP.prototype,"renderQueues",[JP,ks],(function(){return[]})),QP=ZP))||QP)),EO=[new bc(0,0,0,1)],bO=t("cY",(iO=Is("PostProcessStage"),nO=ha(KS),rO=ha([oD]),iO(((uO=function(t){function e(){var e;return(e=t.call(this)||this)._postProcessMaterial=oO&&oO(),e.renderQueues=hO&&hO(),e._renderArea=new mc,e._stageDesc=void 0,e._localUBO=void 0,e._uiPhase=new XD,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&oc.COLOR&&(EO[0].x=t.clearColor.x,EO[0].y=t.clearColor.y,EO[0].z=t.clearColor.z),EO[0].w=t.clearColor.w,r.beginRenderPass(h,o,this._renderArea,EO,t.clearDepth,t.clearStencil),r.bindDescriptorSet(Ym.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&&(_=PS.getOrCreatePipelineState(i,u,l,h,c));var f=e.pipelineSceneData.renderObjects;null!=_&&f.length>0&&(this._stageDesc||(this._stageDesc=i.createDescriptorSet(new s_(u.localSetLayout)),this._localUBO=i.createBuffer(new wc(wl.UNIFORM|wl.TRANSFER_DST,Dl.DEVICE,dg.SIZE,dg.SIZE)),this._stageDesc.bindBuffer(dg.BINDING,this._localUBO)),this._stageDesc.update(),r.bindPipelineState(_),r.bindDescriptorSet(Ym.MATERIAL,u.descriptorSet),r.bindDescriptorSet(Ym.LOCAL,this._stageDesc),r.bindInputAssembler(c),r.draw(c)),this._uiPhase.render(t,h),YS(i,h,r,e.profiler,t),r.endRenderPass()},e}(_I)).initInfo={name:"PostProcessStage",priority:AI.POST_PROCESS,tag:0},oO=Ss((aO=uO).prototype,"_postProcessMaterial",[nO,ks],(function(){return null})),hO=Ss(aO.prototype,"renderQueues",[rO,ks],(function(){return[]})),sO=aO))||sO));!function(t){t[t.NONE=0]="NONE",t[t.FXAA=1]="FXAA"}(lO||(lO={}));var xO,CO,RO,wO,IO,BO,DO=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._antiAliasing=lO.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 KS;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 KS;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 KS;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 KS;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}(CP),PO=[new bc(0,0,0,1)],OO=function(){};OO.SIZE=4*(OO.COUNT=4+(OO.TEXTURE_SIZE_OFFSET=0));var MO,NO,LO,FO,kO,GO,VO,UO=t("cX",(xO=Is("BloomStage"),CO=ha(KS),xO(((BO=function(t){function e(){var e;return(e=t.call(this)||this).threshold=1,e.intensity=.8,e.iterations=2,e._bloomMaterial=IO&&IO(),e._renderArea=new mc,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 wc(wl.UNIFORM|wl.TRANSFER_DST,Dl.HOST|Dl.DEVICE,OO.SIZE,OO.SIZE));t.clearFlag&oc.COLOR&&(PO[0].x=t.clearColor.x,PO[0].y=t.clearColor.y,PO[0].z=t.clearColor.z),PO[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(OO.COUNT);a[OO.TEXTURE_SIZE_OFFSET+2]=this.threshold,i.updateBuffer(this._bloomUBO[0],a),i.beginRenderPass(s.renderPass,s.prefilterFramebuffer,this._renderArea,PO,0,0),i.bindDescriptorSet(Ym.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(Ym.MATERIAL,n.descriptorSet);var o=t.window.swapchain?e.quadIAOffscreen:e.quadIAOnscreen,h=null,u=n.getShaderVariant();null!=n&&null!=u&&null!=o&&(h=PS.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(OO.COUNT),a=0;a<this.iterations;++a){s[OO.TEXTURE_SIZE_OFFSET+0]=this._renderArea.width,s[OO.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,PO,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(Ym.MATERIAL,o.descriptorSet);var u=t.window.swapchain?e.quadIAOffscreen:e.quadIAOnscreen,l=null;null!=o&&null!=h&&null!=u&&(l=PS.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(OO.COUNT),a=0;a<this.iterations;++a){var o=a+6+1;s[OO.TEXTURE_SIZE_OFFSET+0]=this._renderArea.width,s[OO.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,PO,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(Ym.MATERIAL,h.descriptorSet);var l=t.window.swapchain?e.quadIAOffscreen:e.quadIAOnscreen,c=null;null!=h&&null!=u&&null!=l&&(c=PS.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(OO.COUNT);a[OO.TEXTURE_SIZE_OFFSET+3]=this.intensity,i.updateBuffer(this._bloomUBO[13],a),i.beginRenderPass(s.renderPass,s.combineFramebuffer,this._renderArea,PO,0,0),i.bindDescriptorSet(Ym.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(Ym.MATERIAL,o.descriptorSet);var h=t.window.swapchain?e.quadIAOffscreen:e.quadIAOnscreen,u=null,l=o.getShaderVariant();null!=o&&null!=l&&null!=h&&(u=PS.getOrCreatePipelineState(e.device,o,l,s.renderPass,h)),null!=u&&(i.bindPipelineState(u),i.bindInputAssembler(h),i.draw(h)),i.endRenderPass()},e}(_I)).initInfo={name:"BloomStage",priority:AI.BLOOM,tag:0},IO=Ss((wO=BO).prototype,"_bloomMaterial",[CO,ks],(function(){return null})),RO=wO))||RO)),zO=t("cU",Is("MainFlow")(((NO=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 gO;i.initialize(gO.initInfo),this._stages.push(i);var n=new TO;n.initialize(TO.initInfo),this._stages.push(n);var r=new UO;r.initialize(UO.initInfo),this._stages.push(r);var s=new bO;s.initialize(bO.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}(dI)).initInfo={name:km,priority:xI.MAIN,stages:[]},MO=NO))||MO),HO=function(t){function e(){for(var e,i=arguments.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})),WO=t("cT",(LO=Is("DeferredPipeline"),FO=ha([nD]),LO((GO=function(t){function e(){for(var e,i=arguments.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=VO&&VO(),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 sP;i.initialize(sP.initInfo),this._flows.push(i);var n=new zO;n.initialize(zO.initInfo),this._flows.push(n)}return!0},i.activate=function(e){return this._macros={CC_PIPELINE_TYPE:1},this._pipelineSceneData=new DO,!(!t.prototype.activate.call(this,e)||!this._activeRenderer(e)&&(J(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(ig,i),this._descriptorSet.bindTexture(ig,xS.get("default-texture").getGFXTexture()),this._descriptorSet.bindSampler(cg,i),this._descriptorSet.bindTexture(cg,xS.get("default-texture").getGFXTexture()),this._descriptorSet.update();var n=new eD;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 qc;s.format=xl.RGBA16F,s.loadOp=jl.CLEAR,s.storeOp=Yl.STORE;var a=new qc;a.format=xl.RGBA16F,a.loadOp=jl.CLEAR,a.storeOp=Yl.STORE;var o=new qc;o.format=xl.RGBA16F,o.loadOp=jl.CLEAR,o.storeOp=Yl.STORE;var h=new Kc;h.format=xl.DEPTH_STENCIL,h.depthLoadOp=jl.CLEAR,h.depthStoreOp=Yl.STORE,h.stencilLoadOp=jl.CLEAR,h.stencilStoreOp=Yl.STORE;var u=new Zc([s,a,o],h);this._gbufferRenderPass=e.createRenderPass(u)}if(!this._lightingRenderPass){var l=new qc;l.format=xl.RGBA8,l.loadOp=jl.CLEAR,l.storeOp=Yl.STORE,l.barrier=e.getGeneralBarrier(new $c(ql.NONE,ql.COLOR_ATTACHMENT_WRITE));var c=new Kc;c.format=xl.DEPTH_STENCIL,c.depthLoadOp=jl.LOAD,c.depthStoreOp=Yl.DISCARD,c.stencilLoadOp=jl.LOAD,c.stencilStoreOp=Yl.DISCARD,l.barrier=e.getGeneralBarrier(new $c(ql.DEPTH_STENCIL_ATTACHMENT_WRITE,ql.DEPTH_STENCIL_ATTACHMENT_WRITE));var _=new Zc([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(Zm.BINDING).destroy(),this._descriptorSet.getBuffer(tg.BINDING).destroy(),this._descriptorSet.getBuffer($m.BINDING).destroy(),this._descriptorSet.getTexture(ig).destroy(),this._descriptorSet.getTexture(cg).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 HO,n=this.pipelineSceneData,r=0;r<3;++r)i.gbufferRenderTargets.push(e.createTexture(new Oc(Pl.TEX2D,Ol.COLOR_ATTACHMENT|Ol.SAMPLED,xl.RGBA16F,this._width*n.shadingScale,this._height*n.shadingScale)));i.outputDepth=e.createTexture(new Oc(Pl.TEX2D,Ol.DEPTH_STENCIL_ATTACHMENT|Ol.SAMPLED,xl.DEPTH_STENCIL,this._width*n.shadingScale,this._height*n.shadingScale)),i.gbufferFrameBuffer=e.createFramebuffer(new i_(this._gbufferRenderPass,i.gbufferRenderTargets,i.outputDepth)),i.outputRenderTargets.push(e.createTexture(new Oc(Pl.TEX2D,Ol.COLOR_ATTACHMENT|Ol.SAMPLED,xl.RGBA16F,this._width*n.shadingScale,this._height*n.shadingScale))),i.outputFrameBuffer=e.createFramebuffer(new i_(this._lightingRenderPass,i.outputRenderTargets,null)),i.sampler=this.globalDSManager.pointSampler,this.on(fI.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}(iD),VO=Ss(GO.prototype,"renderTextures",[FO,ks],(function(){return[]})),kO=GO))||kO));function XO(){var t=new pO;return t.initialize({flows:[]}),t}var jO,YO,qO,KO,JO=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 ZO(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=f(this._cameras);!(t=e()).done;){var i=t.value;i.detachFromScene(),this._lodStateCache.removeCamera(i)}this._cameras.splice(0)},e.setMainLight=function(t){this._mainLight=t,this._mainLight&&this._mainLight.activate()},e.unsetMainLight=function(t){if(this._mainLight===t){var e=this._directionalLights;if(e.length)return this.setMainLight(e[e.length-1]),void(this._mainLight.node&&(this._mainLight.node.hasChangedFlags|=Vp.ROTATION));this.setMainLight(null)}},e.addDirectionalLight=function(t){t.attachToScene(this),this._directionalLights.push(t)},e.removeDirectionalLight=function(t){for(var e=0;e<this._directionalLights.length;++e)if(this._directionalLights[e]===t)return t.detachFromScene(),void this._directionalLights.splice(e,1)},e.addSphereLight=function(t){t.attachToScene(this),this._sphereLights.push(t)},e.removeSphereLight=function(t){for(var e=0;e<this._sphereLights.length;++e)if(this._sphereLights[e]===t)return t.detachFromScene(),void this._sphereLights.splice(e,1)},e.addSpotLight=function(t){t.attachToScene(this),this._spotLights.push(t)},e.removeSpotLight=function(t){for(var e=0;e<this._spotLights.length;++e)if(this._spotLights[e]===t)return t.detachFromScene(),void this._spotLights.splice(e,1)},e.removeSphereLights=function(){for(var t=0;t<this._sphereLights.length;++t)this._sphereLights[t].detachFromScene();this._sphereLights.length=0},e.removeSpotLights=function(){for(var t=0;t<this._spotLights.length;++t)this._spotLights[t].detachFromScene();this._spotLights.length=0},e.addPointLight=function(t){t.attachToScene(this),this._pointLights.push(t)},e.removePointLight=function(t){for(var e=0;e<this._pointLights.length;++e)if(this._pointLights[e]===t)return t.detachFromScene(),void this._pointLights.splice(e,1)},e.removePointLights=function(){for(var t=0;t<this._pointLights.length;++t)this._pointLights[t].detachFromScene();this._pointLights.length=0},e.addRangedDirLight=function(t){t.attachToScene(this),this._rangedDirLights.push(t)},e.removeRangedDirLight=function(t){for(var e=0;e<this._rangedDirLights.length;++e)if(this._rangedDirLights[e]===t)return t.detachFromScene(),void this._rangedDirLights.splice(e,1)},e.removeRangedDirLights=function(){for(var t=0;t<this._rangedDirLights.length;++t)this._rangedDirLights[t].detachFromScene();this._rangedDirLights.length=0},e.addModel=function(t){t.attachToScene(this),this._models.push(t)},e.removeModel=function(t){for(var e=0;e<this._models.length;++e)if(this._models[e]===t)return this._lodStateCache.removeModel(t),t.detachFromScene(),void this._models.splice(e,1)},e.removeModels=function(){for(var t,e=f(this._models);!(t=e()).done;){var i=t.value;this._lodStateCache.removeModel(i),i.detachFromScene(),i.destroy()}this._models.length=0},e.addBatch=function(t){this._batches.push(t)},e.removeBatch=function(t){for(var e=0;e<this._batches.length;++e)if(this._batches[e]===t)return void this._batches.splice(e,1)},e.removeBatches=function(){this._batches.length=0},e.addLODGroup=function(t){this._lodGroups.push(t),t.attachToScene(this),this._lodStateCache.addLodGroup(t)},e.removeLODGroup=function(t){var e=this._lodGroups.indexOf(t);e>=0&&(this._lodGroups.splice(e,1),t.detachFromScene(),this._lodStateCache.removeLodGroup(t))},e.removeLODGroups=function(){for(var t,e=f(this._lodGroups);!(t=e()).done;){var i=t.value;this._lodStateCache.removeLodGroup(i)}this._lodGroups.length=0},e.onGlobalPipelineStateChanged=function(){for(var t,e=f(this._models);!(t=e()).done;)t.value.onGlobalPipelineStateChanged()},e.generateModelId=function(){return this._modelId++},n(t,[{key:"root",get:function(){return this._root}},{key:"name",get:function(){return this._name}},{key:"cameras",get:function(){return this._cameras}},{key:"mainLight",get:function(){return this._mainLight}},{key:"sphereLights",get:function(){return this._sphereLights}},{key:"spotLights",get:function(){return this._spotLights}},{key:"pointLights",get:function(){return this._pointLights}},{key:"rangedDirLights",get:function(){return this._rangedDirLights}},{key:"models",get:function(){return this._models}},{key:"batches",get:function(){return this._batches}},{key:"lodGroups",get:function(){return this._lodGroups}}]),t}(),QO=function(){this.usedLevel=-1,this.lastUsedLevel=-1,this.transformDirty=!0},ZO=function(){function t(t){this._renderScene=null,this._modelsInLODGroup=new Map,this._lodStateInCamera=new Map,this._newAddedLodGroupVec=new Array,this._levelModels=new Map,this._renderScene=t}var e=t.prototype;return e.addCamera=function(t){for(var e,i=f(this._renderScene.lodGroups);!(e=i()).done;){var n=e.value.node.layer;if((t.visibility&n)===n){this._lodStateInCamera.has(t)||this._lodStateInCamera.set(t,new Map);break}}},e.removeCamera=function(t){this._lodStateInCamera.has(t)&&this._lodStateInCamera.delete(t)},e.addLodGroup=function(t){this._newAddedLodGroupVec.push(t);for(var e,i=f(this._renderScene.cameras);!(e=i()).done;){var n=e.value;if(!this._lodStateInCamera.has(n)){var r=t.node.layer;(n.visibility&r)===r&&this._lodStateInCamera.set(n,new Map)}}},e.removeLodGroup=function(t){for(var e=0;e<t.lodCount;e++)for(var i,n=f(t.lodDataArray[e].models);!(i=n()).done;){var r=i.value;this._modelsInLODGroup.delete(r)}for(var s,a=f(this._lodStateInCamera);!(s=a()).done;)s.value[1].delete(t);this._levelModels.delete(t)},e.removeModel=function(t){this._modelsInLODGroup.has(t)&&this._modelsInLODGroup.delete(t)},e.updateLodState=function(){for(var t,e=this,i=f(this._newAddedLodGroupVec);!(t=i()).done;){var n=t.value,r=this._levelModels.get(n);r||(r=new Map,this._levelModels.set(n,r));for(var s=0;s<n.lodCount;s++){var a=r.get(s);a||(a=new Array);for(var o,h=f(n.lodDataArray[s].models);!(o=h()).done;){var u=o.value,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=f(e._lodStateInCamera);!(n=r()).done;){var s=n.value,a=s[1].get(t);a||(a=new QO,s[1].set(t,a)),a.transformDirty=!0}if(t.isLockLevelChanged()){t.resetLockChangeFlag();var o=e._levelModels.get(t);if(o){o.forEach((function(t){t.forEach((function(t){var i=e._modelsInLODGroup.get(t);i&&i.clear()}))}));for(var h,u=f(i);!(h=u()).done;){var 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=f(e._lodStateInCamera);!(n=r()).done;){var s=n.value;i.set(s[0],!0)}}))}}}return"continue"}for(var d,p=!1,m=f(e._lodStateInCamera);!(d=m()).done;){var g=d.value,y=g[1].get(t);y||(y=new QO,g[1].set(t,y));var v=g[0].node.hasChangedFlags,S=t.node.hasChangedFlags;if(v>0||S>0||y.transformDirty){y.transformDirty&&(y.transformDirty=!1);var A=t.getVisibleLODLevel(g[0]);A!==y.usedLevel&&(y.lastUsedLevel=y.usedLevel,y.usedLevel=A,p=!0)}}var T=e._levelModels.get(t);if(!T)return"continue";t.isLockLevelChanged()?(t.resetLockChangeFlag(),T.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=T.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=T.get(s);a&&a.forEach((function(t){var i=e._modelsInLODGroup.get(t);i&&t.node&&t.node.active&&i.set(n,!0)}))}}))}},d=f(this._renderScene.lodGroups);!(c=d()).done;)_()},e.isLodModelCulled=function(t,e){var i=this._modelsInLODGroup.get(e);return!!i&&!i.has(t)},e.clearCache=function(){this._levelModels.clear(),this._modelsInLODGroup.clear(),this._lodStateInCamera.clear(),this._newAddedLodGroupVec.length=0},e.isLodGroupVisibleByCamera=function(t,e){var i=t.node.layer;return(e.visibility&i)===i},t}(),$O=((jO={})[il.PORTRAIT]=El.IDENTITY,jO[il.LANDSCAPE_RIGHT]=El.ROTATE_90,jO[il.PORTRAIT_UPSIDE_DOWN]=El.ROTATE_180,jO[il.LANDSCAPE_LEFT]=El.ROTATE_270,jO),tM=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 Oc(Pl.TEX2D,Ol.COLOR_ATTACHMENT|Ol.SAMPLED|Ol.TRANSFER_SRC,e.renderPassInfo.colorAttachments[i].format,this._width,this._height);e.externalFlag&&(e.externalFlag&Ml.EXTERNAL_NORMAL||e.externalFlag&Ml.EXTERNAL_OES)&&(n.flags|=e.externalFlag,n.externalRes=e.externalResLow?e.externalResLow:0),this._colorTextures.push(t.createTexture(n))}e.renderPassInfo.depthStencilAttachment.format!==xl.UNKNOWN&&(this._depthStencilTexture=t.createTexture(new Oc(Pl.TEX2D,Ol.DEPTH_STENCIL_ATTACHMENT|Ol.SAMPLED,e.renderPassInfo.depthStencilAttachment.format,this._width,this._height)),this._hasOffScreenAttachments=!0)}return this._framebuffer=t.createFramebuffer(new i_(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,$O[al.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 i_(this._renderPass,this._colorTextures,this._depthStencilTexture)));for(var n,r=f(this._cameras);!(n=r()).done;)n.value.resize(t,e)},e.extractRenderCameras=function(t){for(var e=0;e<this._cameras.length;e++){var i=this._cameras[e];i.enabled&&(i.update(),t.push(i))}},e.attachCamera=function(t){for(var e=0;e<this._cameras.length;e++)if(this._cameras[e]===t)return;this._cameras.push(t),this.sortCameras()},e.detachCamera=function(t){for(var e=0;e<this._cameras.length;++e)if(this._cameras[e]===t)return void this._cameras.splice(e,1)},e.clearCameras=function(){this._cameras.length=0},e.sortCameras=function(){this._cameras.sort((function(t,e){return t.priority-e.priority}))},n(t,[{key:"width",get:function(){return this._width}},{key:"height",get:function(){return this._height}},{key:"swapchain",get:function(){return this._swapchain}},{key:"framebuffer",get:function(){return this._framebuffer}},{key:"cameras",get:function(){return this._cameras}}]),t}();!function(t){t[t.NONE=-1]="NONE",t[t.LEFT=0]="LEFT",t[t.RIGHT=1]="RIGHT"}(YO||(YO={})),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"}(qO||(qO={})),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"}(KO||(KO={}));var eM=t("ak",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 vw,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),JO.registerCreateFunc(this),tM.registerCreateFunc(this),this._cameraPool=new _u((function(){return new JC(e._device)}),4,(function(t){return t.destroy()}))}var e=t.prototype;return e.initialize=function(){var t,e=of.swapchain,i=new qc;i.format=e.colorTexture.format;var n=new Kc;n.format=e.depthStencilTexture.format,n.depthStoreOp=Yl.DISCARD,n.stencilStoreOp=Yl.DISCARD;var r=new Zc([i],n);this._mainWindow=this.createWindow({title:"rootMainWindow",width:e.width,height:e.height,renderPassInfo:r,swapchain:e}),this._curWindow=this._mainWindow;var s=Ee.querySettings(Te.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=f(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 WO&&(this._useDeferredPipeline=!0);var r=!1;if(t||(t=XO(),r=!0),this._useDeferredPipeline&&this.device.hasFeature(bl.COMPUTE_SHADER)||(t.clusterEnabled=!1),t.bloomEnabled=!1,""!==be.CUSTOM_PIPELINE_NAME&&n&&this.usesCustomPipeline?(this._customPipeline=n.createCustomPipeline(),r=!0,this._pipeline=this._customPipeline,this._pipelineEvent=t):(this._classicPipeline=t,this._pipeline=this._classicPipeline,this._pipelineEvent=this._classicPipeline,this._usesCustomPipeline=!1),(Ee.querySettings(Te.Category.RENDERING,"renderMode")!==tf.HEADLESS||this._classicPipeline)&&!this._pipeline.activate(this._mainWindow.swapchain))return r&&this._pipeline.destroy(),this._classicPipeline=null,this._customPipeline=null,this._pipeline=null,this._pipelineEvent=null,!1;var s=i.getScene();return s&&s.globals.activate(),this.onGlobalPipelineStateChanged(),!(!this._batcher&&e.Batcher2D&&(this._batcher=new e.Batcher2D(this),!this._batcher.initialize())&&(this.destroy(),1))},e.onGlobalPipelineStateChanged=function(){for(var t=0;t<this._scenes.length;t++)this._scenes[t].onGlobalPipelineStateChanged();this._pipeline.onGlobalPipelineStateChanged()},e.activeWindow=function(t){this._curWindow=t},e.resetCumulativeTime=function(){this._cumulativeTime=0},e.frameMove=function(t){var e;this._frameTime=t,++this._frameCount,this._cumulativeTime+=t,this._fpsTime+=t,this._fpsTime>1&&(this._fps=this._frameCount,this._frameCount=0,this._fpsTime=0),null!==(e=globalThis.__globalXR)&&void 0!==e&&e.isWebXR?this._doWebXRFrameMove():(this._frameMoveBegin(),this._frameMoveProcess(),this._frameMoveEnd())},e.createWindow=function(t){var e=this._createWindowFun(this);return e.initialize(this.device,t),this._windows.push(e),e},e.destroyWindow=function(t){for(var e=0;e<this._windows.length;++e)if(this._windows[e]===t)return t.destroy(),void this._windows.splice(e,1)},e.destroyWindows=function(){for(var t,e=f(this._windows);!(t=e()).done;)t.value.destroy();this._windows.length=0},e.createScene=function(t){var e=this._createSceneFun(this);return e.initialize(t),this._scenes.push(e),e},e.destroyScene=function(t){for(var e=0;e<this._scenes.length;++e)if(this._scenes[e]===t)return t.destroy(),void this._scenes.splice(e,1)},e.destroyScenes=function(){for(var t,e=f(this._scenes);!(t=e()).done;)t.value.destroy();this._scenes.length=0},e.createModel=function(t){var e=this._modelPools.get(t);e||(this._modelPools.set(t,new _u((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 _u((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 xR.DIRECTIONAL:t.scene.removeDirectionalLight(t);break;case xR.SPHERE:t.scene.removeSphereLight(t);break;case xR.SPOT:t.scene.removeSpotLight(t);break;case xR.POINT:t.scene.removePointLight(t);break;case xR.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 xR.DIRECTIONAL:t.scene.removeDirectionalLight(t);break;case xR.SPHERE:t.scene.removeSphereLight(t);break;case xR.SPOT:t.scene.removeSpotLight(t);break;case xR.POINT:t.scene.removePointLight(t);break;case xR.RANGED_DIRECTIONAL:t.scene.removeRangedDirLight(t)}},e._doWebXRFrameMove=function(){var t=globalThis.__globalXR;if(t){var e=this._windows,i=this._cameraList,n=t.webXRMatProjs?t.webXRMatProjs.length:1;t.webXRWindowMap||(t.webXRWindowMap=new Map);for(var r=[],s=t.webxrHmdPoseInfos,a=0;a<n;a++){for(var o,h=f(e);!(o=h()).done;){var u=o.value;r=r.concat(u.cameras),u.swapchain&&t.webXRWindowMap.set(u,a)}if(s){for(var l=[0,0,0],c=0;c<s.length;c++){var _=s[c];if(_.code===KO.VIEW_LEFT&&a===YO.LEFT||_.code===KO.VIEW_RIGHT&&a===YO.RIGHT){l[0]=_.position.x,l[1]=_.position.y,l[2]=_.position.z;break}}for(var d,p=f(r);!(d=p()).done;){var m=d.value;m.trackingType!==GC.NO_TRACKING&&m.node&&(m.trackingType===GC.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 y=i[g];(a===YO.LEFT&&y.cameraType===kC.RIGHT_EYE||a===YO.RIGHT&&y.cameraType===kC.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([of.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((Zm.COUNT+$m.COUNT+tg.COUNT+dg.COUNT+pg.COUNT)/4,100),e=Math.floor((of.gfxDevice.capabilities.maxVertexUniformVectors-t)/3);bg(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=eM,fi.Attr.setClassAttr(Fd,"target","type","Object"),fi.Attr.setClassAttr(Fd,"target","ctor",Pm);var iM,nM=new Array(16),rM=null,sM=new yn,aM=[zp.TOUCH_START,zp.TOUCH_MOVE,zp.TOUCH_END,zp.TOUCH_CANCEL],oM=[zp.MOUSE_DOWN,zp.MOUSE_ENTER,zp.MOUSE_MOVE,zp.MOUSE_LEAVE,zp.MOUSE_UP,zp.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"}(iM||(iM={}));var hM,uM=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(iM.MARK_LIST_DIRTY),i&&n.length>0)for(var r=0;r<n.length;++r)n[r]._eventProcessor.setEnabled(e,!0);if(this._dispatchingTouch&&!this._isEnabled){var s=new Ux([this._dispatchingTouch],!0,Nx.TOUCH_CANCEL);s.touch=this._dispatchingTouch,this.dispatchEvent(s),this.claimedTouchIdList.length=0,this._dispatchingTouch=null}}},e.reattach=function(){var e,i=this;this.node.walk((function(n){e||(e=i._searchComponentsInParent(t._maskComp)),n.eventProcessor.maskList=e}))},e.destroy=function(){if(rM===this._node&&(rM=null),this.capturingTarget&&this.capturingTarget.clear(),this.bubblingTarget&&this.bubblingTarget.clear(),t.callbacksInvoker.emit(iM.REMOVE_POINTER_EVENT_PROCESSOR,this),this._dispatchingTouch){var e=new Ux([this._dispatchingTouch],!0,Nx.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(iM.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,nM.length=0,this.getCapturingTargets(t.type,nM),t.eventPhase=1,n=nM.length-1;n>=0;--n)if((e=nM[n]).eventProcessor.capturingTarget&&(t.currentTarget=e,e.eventProcessor.capturingTarget.emit(t.type,t,nM),t.propagationStopped))return void(nM.length=0);if(nM.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,nM),t.eventPhase=3,n=0;n<nM.length;++n)if((e=nM[n]).eventProcessor.bubblingTarget&&(t.currentTarget=e,e.eventProcessor.bubblingTarget.emit(t.type,t),t.propagationStopped))return void(nM.length=0);nM.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(iM.MARK_LIST_DIRTY)},e._searchComponentsInParent=function(t){var e=this.node;if(t){for(var i=0,n=[],r=e;r&&Pm.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!==aM.indexOf(t)},e._isMouseEvent=function(t){return-1!==oM.indexOf(t)},e._hasTouchListeners=function(){for(var t=0;t<aM.length;++t){var e=aM[t];if(this.hasEventListener(e))return!0}return!1},e._hasMouseListeners=function(){for(var t=0;t<oM.length;++t){var e=oM[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(iM.ADD_POINTER_EVENT_PROCESSOR,this)},e._newCallbacksInvoker=function(){var e=this,i=new Iu;return i._registerOffCallback((function(){e.shouldHandleEventTouch&&!e._hasTouchListeners()&&(e.shouldHandleEventTouch=!1),e.shouldHandleEventMouse&&!e._hasMouseListeners()&&(e.shouldHandleEventMouse=!1),e._hasPointerListeners()||t.callbacksInvoker.emit(iM.REMOVE_POINTER_EVENT_PROCESSOR,e)})),i},e._handleEventMouse=function(t){switch(t.type){case Nx.MOUSE_DOWN:return this._handleMouseDown(t);case Nx.MOUSE_MOVE:return this._handleMouseMove(t);case Nx.MOUSE_UP:return this._handleMouseUp(t);case Nx.MOUSE_WHEEL:return this._handleMouseWheel(t);default:return!1}},e._handleMouseDown=function(t){var e=this._node;return!(!e||!e._uiProps.uiTransformComp||(t.getLocation(sM),!e._uiProps.uiTransformComp.hitTest(sM,t.windowId)||(t.type=zp.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(sM),e._uiProps.uiTransformComp.hitTest(sM,t.windowId)?(this.previousMouseIn||(rM&&rM!==e&&(t.type=zp.MOUSE_LEAVE,rM.dispatchEvent(t),rM.eventProcessor.previousMouseIn=!1),rM=e,t.type=zp.MOUSE_ENTER,e.dispatchEvent(t),this.previousMouseIn=!0),t.type=zp.MOUSE_MOVE,t.bubbles=!0,e.dispatchEvent(t),t.propagationStopped=!0,0):(this.previousMouseIn&&(t.type=zp.MOUSE_LEAVE,e.dispatchEvent(t),this.previousMouseIn=!1,rM=null),1)))},e._handleMouseUp=function(t){var e=this._node;return!(!e||!e._uiProps.uiTransformComp||(t.getLocation(sM),!e._uiProps.uiTransformComp.hitTest(sM,t.windowId)||(t.type=zp.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(sM),!e._uiProps.uiTransformComp.hitTest(sM,t.windowId)||(t.type=zp.MOUSE_WHEEL,t.bubbles=!0,e.dispatchEvent(t),t.propagationStopped=!0,0)))},e._handleEventTouch=function(t){switch(t.type){case Nx.TOUCH_START:return this._handleTouchStart(t);case Nx.TOUCH_MOVE:return this._handleTouchMove(t);case Nx.TOUCH_END:return this._handleTouchEnd(t);case Nx.TOUCH_CANCEL:return this._handleTouchCancel(t);default:return!1}},e._handleTouchStart=function(t){var e=this.node;return!(!e||!e._uiProps.uiTransformComp||(t.getLocation(sM),!e._uiProps.uiTransformComp.hitTest(sM,t.windowId)||(t.type=zp.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=zp.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(sM),e._uiProps.uiTransformComp.hitTest(sM,t.windowId)?t.type=zp.TOUCH_END:t.type=zp.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=zp.TOUCH_CANCEL,t.bubbles=!0,e.dispatchEvent(t))},n(t,[{key:"isEnabled",get:function(){return this._isEnabled}},{key:"node",get:function(){return this._node}}]),t}();uM._maskComp=null,uM.callbacksInvoker=new Iu,v.NodeEventProcessor=uM,nt(Pm.prototype,"Node",[{name:"childrenCount",newName:"children.length",customGetter:function(){return this.children.length}}]),nt(Pm.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 yn),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 An),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)}}]),rt(rx.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"}]),nt(rx.prototype,"SceneGlobals.prototype",[{name:"distance",newName:"planeHeight"},{name:"normal",newName:"planeDirection"},{name:"size",newName:"shadowMapSize"}]),rt(Pm.prototype,"Node.prototype",[{name:"addLayer"},{name:"removeLayer"}]),nt(Up.prototype,"NodeUIProperties",[{name:"opacityDirty",newName:"colorDirty"}]),rt(kp,"Layers",[{name:"All"},{name:"RaycastMask"},{name:"check"}]),nt(kp,"Layers",[{name:"Default",newName:"DEFAULT",target:kp.Enum,targetName:"Layers.Enum"},{name:"Always",newName:"ALWAYS",target:kp.Enum,targetName:"Layers.Enum"},{name:"IgnoreRaycast",newName:"IGNORE_RAYCAST",target:kp.Enum,targetName:"Layers.Enum"},{name:"Gizmos",newName:"GIZMOS",target:kp.Enum,targetName:"Layers.Enum"},{name:"Editor",newName:"EDITOR",target:kp.Enum,targetName:"Layers.Enum"},{name:"UI",newName:"UI_3D",target:kp.Enum,targetName:"Layers.Enum"},{name:"UI2D",newName:"UI_2D",target:kp.Enum,targetName:"Layers.Enum"},{name:"SceneGizmo",newName:"SCENE_GIZMO",target:kp.Enum,targetName:"Layers.Enum"},{name:"makeInclusiveMask",newName:"makeMaskInclude",target:kp,targetName:"Layers"},{name:"makeExclusiveMask",newName:"makeMaskExclude",target:kp,targetName:"Layers"}]),rt(kp.Enum,"Layers.Enum",[{name:"ALWAYS"}]),rt(kp.BitMask,"Layers.BitMask",[{name:"ALWAYS"}]);var lM=ba.Flags.HideInHierarchy,cM=ba.Flags.DontSave,_M=t("dx",Is("cc.PrivateNode")(hM=function(t){function e(e){var i;return q(12003,(i=t.call(this,e)||this).name),i.hideFlags|=cM|lM,i}return s(e,t),e}(Pm))||hM);function fM(t,e){if(!e){var i=v.director.getScene();if(!i)return null;e=i}return e.getChildByPath(t)}nt(Mx,"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:Pm.EventType,targetName:"Node.EventType"}}))),nt(Pm.EventType,"Node.EventType",[{name:"DEVICEMOTION",target:PC.EventType,targetName:"SystemEvent.EventType"},{name:"KEY_DOWN",target:PC.EventType,targetName:"SystemEvent.EventType"},{name:"KEY_UP",target:PC.EventType,targetName:"SystemEvent.EventType"}]),v.PrivateNode=_M,dt({BaseNode:{newName:"Node",since:"3.7.0",removed:!1}}),v.find=fM;var dM=ae,pM=ba.Flags.IsStartCalled,mM=ba.Flags.IsOnEnableCalled;function gM(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 yM(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))}}ba.Flags.IsEditorOnEnableCalled;var vM=function(t){this._zero=void 0,this._neg=void 0,this._pos=void 0,this._invoke=void 0;var e=re;this._zero=new e([]),this._neg=new e([]),this._pos=new e([]),this._invoke=t};function SM(t,e){return t.constructor._executionOrder-e.constructor._executionOrder}vM.stableRemoveInactive=yM;var AM=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){yM(this._zero,t),yM(this._neg,t),yM(this._pos,t)},i.invoke=function(){var t=this._neg;t.array.length>0&&(t.array.sort(SM),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(SM),this._invoke(e),e.array.length=0)},e}(vM),TM=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=gM(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=gM(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}(vM);function EM(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 bM=EM("c.start();c._objFlags|="+pM,!1,pM),xM=EM("c.update(dt)",!0),CM=EM("c.lateUpdate(dt)",!0),RM=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))}},wM=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 AM(bM),this.updateInvoker=new TM(xM),this.lateUpdateInvoker=new TM(CM),this._updating=!1},e._onEnabled=function(t){v.director.getScheduler().resumeTarget(t),t._objFlags|=mM,this._updating?this._deferredComps.push(t):this._scheduleImmediate(t)},e._onDisabled=function(t){v.director.getScheduler().pauseTarget(t),t._objFlags&=~mM;var e=this._deferredComps.indexOf(t);e>=0?dM(this._deferredComps,e):(!t.start||t._objFlags&pM||this.startInvoker.remove(t),t.update&&this.updateInvoker.remove(t),t.lateUpdate&&this.lateUpdateInvoker.remove(t))},e.enableComp=function(t,e){if(!(t._objFlags&mM)){if(t.onEnable){if(e)return void e.add(t);if(t.onEnable(),!t.node._activeInHierarchy)return}this._onEnabled(t)}},e.disableComp=function(t){t._objFlags&mM&&(t.onDisable&&t.onDisable(),this._onDisabled(t))},e.startPhase=function(){this._updating=!0,this.startInvoker.invoke(),this._startForNewComps()},e.updatePhase=function(t){this.updateInvoker.invoke(t)},e.lateUpdatePhase=function(t){this.lateUpdateInvoker.invoke(t),this._updating=!1,this._startForNewComps()},e._startForNewComps=function(){this._deferredComps.length>0&&(this._deferredSchedule(),this.startInvoker.invoke())},e._scheduleImmediate=function(t){"function"!=typeof t.start||t._objFlags&pM||this.startInvoker.add(t),"function"==typeof t.update&&this.updateInvoker.add(t),"function"==typeof t.lateUpdate&&this.lateUpdateInvoker.add(t)},e._deferredSchedule=function(){for(var t=this._deferredComps,e=0,i=t.length;e<i;e++)this._scheduleImmediate(t[e]);t.length=0},t}(),IM=ba.Flags.IsPreloadStarted,BM=ba.Flags.IsOnLoadStarted,DM=ba.Flags.IsOnLoadCalled,PM=ba.Flags.Deactivating,OM=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){vM.stableRemoveInactive(this._zero,t)},i.invoke=function(){this._invoke(this._zero),this._zero.array.length=0},e}(vM),MM=EM("c.__preload();"),NM=EM("c.onLoad();c._objFlags|="+DM,!1,DM),LM=new ne(4);function FM(t,e,i){J(3817,t.name,i),console.log("Corrupted component value:",e),e?t._removeComponent(e):se(t._components,i)}LM.get=function(){var t=this._get()||{preload:new OM(MM),onLoad:new AM(NM),onEnable:new AM(RM)};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 kM=t("df",function(){function t(){this.resetComp=void 0,this._activatingStack=void 0,this.reset()}var e=t.prototype;return e.reset=function(){this._activatingStack=[]},e.activateNode=function(t,e){if(e){var i=LM.get();this._activatingStack.push(i),this._activateNodeRecursively(t,i.preload,i.onLoad,i.onEnable),i.preload.invoke(),i.onLoad.invoke(),i.onEnable.invoke(),this._activatingStack.pop(),LM.put(i)}else{this._deactivateNodeRecursively(t);for(var n,r=f(this._activatingStack);!(n=r()).done;){var s=n.value;s.preload.cancelInactive(IM),s.onLoad.cancelInactive(BM),s.onEnable.cancelInactive()}}t.emit(zp.ACTIVE_IN_HIERARCHY_CHANGED,t)},e.activateComp=function(t,e,i,n){if(Ca(t,!0)&&(t._objFlags&IM||(t._objFlags|=IM,t.__preload&&(e?e.add(t):t.__preload())),t._objFlags&BM||(t._objFlags|=BM,t.onLoad?i?i.add(t):(t.onLoad(),t._objFlags|=DM):t._objFlags|=DM),t._enabled)){if(!t.node._activeInHierarchy)return;v.director._compScheduler.enableComp(t,n)}},e.destroyComp=function(t){v.director._compScheduler.disableComp(t),t.onDestroy&&t._objFlags&DM&&t.onDestroy()},e._activateNodeRecursively=function(t,e,i,n){if(t._objFlags&PM)J(3816,t.name);else{t._activeInHierarchy=!0;for(var r=t._components.length,s=0;s<r;++s){var a=t._components[s];a instanceof v.Component?this.activateComp(a,e,i,n):(FM(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|=PM,t._activeInHierarchy=!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&=~PM)}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&=~PM)}t._onPostActivated(!1),t._objFlags&=~PM},t}()),GM=ba.Flags.Destroyed,VM=ba.Flags.PersistentMask,UM=fi.Attr.DELIMETER+"default",zM=fi.IDENTIFIER_RE,HM="var ",WM="o",XM={"cc.ClickEvent":!1,"cc.PrefabInfo":!1},jM=fi.escapeForJS,YM=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 HM+this.varName+"="+this.expression+";"},t}();function qM(t,e){return e instanceof YM?new YM(e.varName,t+e.expression):t+e}function KM(t,e,i){Array.isArray(i)?(i[0]=qM(e,i[0]),t.push(i)):t.push(qM(e,i)+";")}var JM=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];KM(t,e+QM(n[0])+"=",n[1])}},t}();function QM(t){return zM.test(t)?"."+t:"["+jM(t)+"]"}JM.pool=void 0,JM.pool=new ne((function(t){t._exps.length=0,t._targetExp=null}),1),JM.pool.get=function(t){var e=this._get()||new JM;return e._targetExp=t,e};var ZM,$M,tN,eN,iN,nN,rN=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=wt(),Gt(this.funcModuleCache,XM),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=HM+this.globalVariables.join(",")+";");var n=vl(["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=It(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=JM.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),JM.pool.put(r)},e.enumerateCCClass=function(t,e,i){for(var n=i.__values__,r=fi.Attr.getClassAttrs(i),s=0;s<n.length;s++){var a=n[s],o=e[a],h=r[a+UM];if(!sN(h,o))if("object"==typeof o&&o instanceof v.ValueType&&(h=fi.getDefault(h))&&h.constructor===o.constructor){var u=WM+QM(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 YM(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)KM(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 YM(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]&&KM(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]=qM(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?jM(i):("_objFlags"===e&&xa(t)&&(i&=VM),i)},e.setObjProp=function(t,e,i,n){KM(t,WM+QM(i)+"=",this.enumerateField(e,i,n))},e.enumerateObject=function(t,e){var i=e.constructor;if(di(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 fi.getNewValueTypeCode(t);if(t instanceof v.Asset)return this.getObjRef(t);if(t._objFlags&GM)return null;var e,i=t.constructor;if(di(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 YM(WM,"new "+this.getFuncModule(i,!0)+"()")}else if(i===Object)e=new YM(WM,"{}");else{if(i)return this.getObjRef(t);e=new YM(WM,"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 sN(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 Tt(t)&&Tt(e)}return!1}var aN=me({AUTO:0,SINGLE_INSTANCE:1,MULTI_INSTANCE:2}),oN=t("dg",Is("cc.Prefab")(((nN=function(t){function e(){var e;return(e=t.call(this)||this).data=tN&&tN(),e.optimizationPolicy=eN&&eN(),e.persistent=iN&&iN(),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 rN(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!==aN.SINGLE_INSTANCE&&(this.optimizationPolicy===aN.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 Pm,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;Tx(t),Sx(t)},e}(zf)).OptimizationPolicy=aN,nN.OptimizationPolicyThreshold=3,tN=Ss(($M=nN).prototype,"data",[ks],(function(){return null})),eN=Ss($M.prototype,"optimizationPolicy",[ks],(function(){return aN.AUTO})),iN=Ss($M.prototype,"persistent",[ks],(function(){return!1})),ZM=$M))||ZM);bt(oN,"_utils",Dx),v.Prefab=oN,Bt(v,"cc._Prefab","Prefab");var hN=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,ae(this._allRenderers,e),t._internalId=-1,t._dirtyVersion===this._dirtyVersion&&(he(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}()),uN=[".png",".jpg",".bmp",".jpeg",".gif",".ico",".tiff",".webp",".image",".pvr",".pkm",".astc"],lN=[".mp3",".ogg",".wav",".m4a"];function cN(){return!0}var _N={transformURL:function(t){var e=Df(t);if(!e)return t;var i=gf.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"===Wu(t)&&(s=!0),s){var a=Yu(t),o=ju(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}},fN=t("e0",function(){function t(){this._autoReleaseSetting=Object.create(null),this._parseLoadResArgs=gv}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=[];SS.loadAny(n,null,(function(t,i,n){n.content&&(uN.includes(n.ext)?a.push(n.content):lN.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 zf)){var r=i,s=n[t].url;a.includes(r)?iS.create(s,i,".png",{},(function(i,n){r=e[t]=n})):o.includes(r)&&iS.create(s,i,".mp3",{},(function(i,n){r=e[t]=n})),df.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:cN,_map:u}}else r=e[0]}i&&i(t,r)}))},e.getXMLHttpRequest=function(){return new XMLHttpRequest},e.getItem=function(t){return SS.assets.has(t)?{content:SS.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=Wu(t);h&&!Av.getInfoWithPath(t,s)&&(t=t.slice(0,-h.length)),Av.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=Wu(e);n&&!Av.getInfoWithPath(e,s)&&(t[i]=e.slice(0,-n.length))})),Av.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;Av.loadDir(t,s,a,(function(e,i){var n=[];e||(n=Av.getDirWithPath(t,s).map((function(t){return t.path}))),o&&o(e,i,n)}))},e.getRes=function(t,e){return df.has(t)?df.get(t):Av.get(t,e)},e.getResCount=function(){return df.count},e.getDependsRecursively=function(t){if(!t)return[];var e="string"==typeof t?t:t._uuid;return xp.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();Wv.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();uS.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=df.get(i)),SS.releaseAsset(i)}else t&&("string"==typeof t&&(t=df.get(t)),SS.releaseAsset(t))},e.releaseAsset=function(t){SS.releaseAsset(t)},e.releaseRes=function(t,e){Av.release(t,e)},e.releaseAll=function(){SS.releaseAll(),df.clear()},e.removeItem=function(t){return!!df.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=xp.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){uv=t}},{key:"_cache",get:function(){if(df instanceof cf)return df.map;var t={};return df.forEach((function(e,i){t[i]=e})),t}},{key:"md5Pipe",get:function(){return _N}},{key:"downloader",get:function(){return Wv}},{key:"loader",get:function(){return SS.parser}}]),t}()),dN=t("e1",new fN),pN=t("e2",{init:function(t){t.importBase=t.libraryPath,t.nativeBase=t.rawAssetsBase,SS.init(t),t.rawAssets&&Av.init({base:"",deps:[],scenes:{},redirect:[],debug:!0,packs:{},types:[],versions:{import:[],native:[]},name:Tf.RESOURCES,importBase:t.importBase,nativeBase:t.nativeBase,paths:t.rawAssets.assets,uuids:Object.keys(t.rawAssets.assets),extensionMap:{}})},loadAsset:function(t,e){SS.loadAny(t,e)}}),mN=t("e3",{});nt(mN,"url",[{name:"normalize",target:SS.utils,targetName:"assetManager.utils",newName:"normalize"},{name:"raw",targetName:"Asset.prototype",newName:"nativeUrl",customFunction:function(t){return t.startsWith("resources/")?Nf({path:qu(t.substr(10)),bundle:Tf.RESOURCES,__isNative__:!0,ext:Wu(t)}):""}}]),rt(pN,"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"}]),rt(dN,"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"}]),nt(v,"cc",[{name:"loader",newName:"assetManager",logTimes:1,customGetter:function(){return dN}},{name:"AssetLibrary",newName:"assetManager",logTimes:1,customGetter:function(){return pN}},{name:"Pipeline",target:vS,targetName:"AssetManager",newName:"Pipeline",logTimes:1},{name:"url",targetName:"assetManager",newName:"utils",logTimes:1,customGetter:function(){return mN}}]),rt(v,"cc",[{name:"LoadingItems",suggest:tt(1400,"LoadingItems","AssetManager.Task")}]),nt(be,"macro",[{name:"DOWNLOAD_MAX_CONCURRENT",target:Wv,targetName:"assetManager.downloader",newName:"maxConcurrency"}]);var gN=hv._autoRelease;hv._autoRelease=function(t,e,i){gN.call(hv,t,e,i);for(var n=dN._autoReleaseSetting,r=Object.keys(n),s=0;s<r.length;s++){var a=r[s];if(!0===n[a]){var o=df.get(a);o&&hv.tryRelease(o)}}};var yN=t("dD",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 Au,e._compScheduler=new wM,e._nodeActivator=new kM,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(),Ca(this._scene)&&this._scene.destroy(),this._scene=null,this.stopAnimation(),SS.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 Ox&&(t=t.scene),$(t instanceof Px,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(Pm.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&=~ba.Flags.DontSave,o.hideFlags|=ba.Flags.DontSave&h.hideFlags,h._destroyImmediate(),t.insertChild(o,u)}else o.hideFlags|=ba.Flags.DontSave,o.parent=t}var l=this._scene;Ca(l)&&l.destroy(),hv._autoRelease(l,t,this._persistRootNodes),this._scene=null,ba._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 Ox&&(t=t.scene),$(t,1205),$(t instanceof Px,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=SS.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):(J(1209,t),!1)},i.preloadScene=function(t,e,i){var n=SS.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(Au.ID,t,200))},i.registerSystem=function(t,e,i){e.id=t,e.priority=i,this._systems.push(e),this._systems.sort(pu.sortByPriority)},i.unregisterSystem=function(t){he(this._systems,t),this._systems.sort(pu.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),DC._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),ba._deferredDestroy();for(var n=0;n<this._systems.length;++n)this._systems[n].postUpdate(t)}this.emit(e.EVENT_BEFORE_DRAW),hN.updateAllDirtyRenderers(),this._root.frameMove(t),this.emit(e.EVENT_AFTER_DRAW),Pm.resetHasChangedFlags(),Pm.clearNodeArray(),cu.update(t),this.emit(e.EVENT_END_FRAME),this._totalFrames++}},i.buildRenderPipeline=function(){this._root&&(this._root.customPipeline.beginSetup(),v.rendering.getCustomPipeline(be.CUSTOM_PIPELINE_NAME).setup(this._root.cameraList,this._root.customPipeline),this._root.customPipeline.endSetup())},i.setupRenderPipelineBuilder=function(){""!==be.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(Au.ID,this._scheduler,200),this._root=new eM(of.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(Pm.isNode(t)&&t.uuid){var e=t.uuid;if(!this._persistRootNodes[e]){var i=this._scene;if(Ca(i))if(t.parent){if(!(t.parent instanceof Px))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,hv._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="",hv._removePersistNodeRef(t))},i.isPersistRootNode=function(t){return!!t._persistNode},n(e,[{key:"root",get:function(){return this._root}}]),e}(Du));yN.EVENT_INIT="director_init",yN.EVENT_RESET="director_reset",yN.EVENT_BEFORE_SCENE_LOADING="director_before_scene_loading",yN.EVENT_BEFORE_SCENE_LAUNCH="director_before_scene_launch",yN.EVENT_AFTER_SCENE_LAUNCH="director_after_scene_launch",yN.EVENT_BEFORE_UPDATE="director_before_update",yN.EVENT_AFTER_UPDATE="director_after_update",yN.EVENT_BEFORE_DRAW="director_before_draw",yN.EVENT_AFTER_DRAW="director_after_draw",yN.EVENT_BEFORE_COMMIT="director_before_commit",yN.EVENT_BEFORE_RENDER="director_before_render",yN.EVENT_AFTER_RENDER="director_after_render",yN.EVENT_BEFORE_PHYSICS="director_before_physics",yN.EVENT_AFTER_PHYSICS="director_after_physics",yN.EVENT_BEGIN_FRAME="director_begin_frame",yN.EVENT_END_FRAME="director_end_frame",yN.instance=void 0,v.Director=yN;var vN=t("dE",yN.instance=v.director=new yN),SN=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=this;this._isPlaying||(this._startTime=performance.now(),this._stHandle=this._stTime((function e(){t._isPlaying&&(t._stHandle=t._stTime(e)),t._onTick&&t._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}(),AN=new yn,TN=function(){var t=e.prototype;function e(){this.settings=void 0,this._curTime=0,this.device=void 0,this.swapchain=void 0,this.shader=void 0,this.sampler=void 0,this.cmdBuff=void 0,this.quadAssmebler=void 0,this.vertexBuffers=void 0,this.indicesBuffers=void 0,this.renderArea=void 0,this.clearColors=void 0,this.projection=void 0,this.isMobile=!1,this.bgMat=void 0,this.bgImage=void 0,this.bgTexture=void 0,this.logoMat=void 0,this.logoImage=void 0,this.logoTexture=void 0,this.watermarkMat=void 0,this.watermarkTexture=void 0,this.bgWidth=1920,this.bgHeight=1080,this.bgRatio=16/9,this.logoWidthTemp=140,this.logoHeightTemp=200,this.logoWidth=0,this.logoHeight=0,this.logoXTrans=.5,this.logoYTrans=1/6+2.5/6,this.textSize=24,this.textHeight=24,this.textXTrans=.5,this.textYExtraTrans=32,this.textExpandSize=4,this.scaleSize=1}return t.init=function(){var t,e,i,n,r,s,a,o,h=this;if(this.settings={displayRatio:null!==(t=Ee.querySettings(Te.Category.SPLASH_SCREEN,"displayRatio"))&&void 0!==t?t:.4,totalTime:null!==(e=Ee.querySettings(Te.Category.SPLASH_SCREEN,"totalTime"))&&void 0!==e?e:3e3,watermarkLocation:null!==(i=Ee.querySettings(Te.Category.SPLASH_SCREEN,"watermarkLocation"))&&void 0!==i?i:"default",autoFit:null===(n=Ee.querySettings(Te.Category.SPLASH_SCREEN,"autoFit"))||void 0===n||n,url:null!==(r=Ee.querySettings(Te.Category.SPLASH_SCREEN,"url"))&&void 0!==r?r:"",type:null!==(s=Ee.querySettings(Te.Category.SPLASH_SCREEN,"type"))&&void 0!==s?s:"default",bgBase64:null!==(a=Ee.querySettings(Te.Category.SPLASH_SCREEN,"bgBase64"))&&void 0!==a?a:"",base64src:null!==(o=Ee.querySettings(Te.Category.SPLASH_SCREEN,"base64src"))&&void 0!==o?o:""},this._curTime=0,!(""===this.settings.base64src||this.settings.totalTime<=0)){this.device=v.director.root.device,this.swapchain=v.director.root.mainWindow.swapchain,this.preInit(),this.initLayout(),this.initWaterMark();var u=new Promise((function(t,e){h.bgImage=new A.Image,h.bgImage.onload=function(){h.initBG(),t()},h.bgImage.onerror=function(){e()},h.bgImage.src=h.settings.bgBase64})),l=new Promise((function(t,e){h.logoImage=new A.Image,h.logoImage.onload=function(){h.initLogo(),t()},h.logoImage.onerror=function(){e()},h.logoImage.src=h.settings.base64src}));return Promise.all([u,l])}return this.settings.totalTime=0,Promise.resolve([])},t.preInit=function(){this.clearColors=[new bc(0,0,0,255)];var t=this.device,e=this.swapchain;this.renderArea=new mc(0,0,e.width,e.height),this.cmdBuff=t.commandBuffer;var i=new Float32Array([.5,.5,1,0,-.5,.5,0,0,.5,-.5,1,1,-.5,-.5,0,1]),n=4*Float32Array.BYTES_PER_ELEMENT,r=4*n;this.vertexBuffers=t.createBuffer(new wc(wl.VERTEX|wl.TRANSFER_DST,Dl.DEVICE,r,n)),this.vertexBuffers.update(i);var s=new Uint16Array([0,1,2,1,3,2]),a=Uint16Array.BYTES_PER_ELEMENT,o=6*a;this.indicesBuffers=t.createBuffer(new wc(wl.INDEX|wl.TRANSFER_DST,Dl.DEVICE,o,a)),this.indicesBuffers.update(s);var h=[new Xc("a_position",xl.RG32F),new Xc("a_texCoord",xl.RG32F)],u=new Yc(h,[this.vertexBuffers],this.indicesBuffers);this.quadAssmebler=t.createInputAssembler(u),this.projection=new fn,fn.ortho(this.projection,-1,1,-1,1,-1,1,t.capabilities.clipSpaceMinZ,t.capabilities.clipSpaceSignY,e.surfaceTransform),this.isMobile=ul.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;fn.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=Ga(xi(this._curTime/e.totalTime)),o=1,h=1;r<s?(o=s*this.bgRatio,h=s):(o=r,h=r*this.bgRatio),this.bgMat.setProperty("resolution",AN.set(r,s),0),this.bgMat.setProperty("scale",AN.set(o,h),0),this.bgMat.setProperty("translate",AN.set(.5*r,.5*s),0),this.bgMat.setProperty("percent",1),this.bgMat.setProperty("u_projection",this.projection),this.bgMat.passes[0].update(),o=1,h=1,o=this.logoWidth*this.scaleSize*e.displayRatio,h=this.logoHeight*this.scaleSize*e.displayRatio;var u=s*this.logoYTrans;if(this.logoMat.setProperty("resolution",AN.set(r,s),0),this.logoMat.setProperty("scale",AN.set(o,h),0),this.logoMat.setProperty("translate",AN.set(r*this.logoXTrans,u),0),this.logoMat.setProperty("percent",a),this.logoMat.setProperty("u_projection",this.projection),this.logoMat.passes[0].update(),this.watermarkMat){var 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",AN.set(r,s),0),this.watermarkMat.setProperty("scale",AN.set(o,h),0),this.watermarkMat.setProperty("translate",AN.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 KS,this.bgMat.initialize({effectName:"util/splash-screen"});var e=new Nc;e.addressU=Gl.CLAMP,e.addressV=Gl.CLAMP,e.addressW=Gl.CLAMP,this.sampler=t.getSampler(e),this.bgTexture=t.createTexture(new Oc(Pl.TEX2D,Ol.SAMPLED|Ol.TRANSFER_DST,xl.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 Tc;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 KS,this.logoMat.initialize({effectName:"util/splash-screen"});var e=new Nc;e.addressU=Gl.CLAMP,e.addressV=Gl.CLAMP,e.addressW=Gl.CLAMP,this.sampler=t.getSampler(e),this.logoTexture=t.createTexture(new Oc(Pl.TEX2D,Ol.SAMPLED|Ol.TRANSFER_DST,xl.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 Tc;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=A.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 Tc;r.texExtent.width=t.width,r.texExtent.height=t.height,r.texExtent.depth=1,this.watermarkTexture=this.device.createTexture(new Oc(Pl.TEX2D,Ol.SAMPLED|Ol.TRANSFER_DST,xl.RGBA8,t.width,t.height)),this.device.copyTexImagesToTexture([t],this.watermarkTexture,[r]),this.watermarkMat=new KS,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(!ul.isXR||xr.entry.isRenderAllowable())for(var i=ul.isXR?2:1,n=0;n<i;n++){if(ul.isXR){xr.entry.renderLoopStart(n);var r=xr.entry.getEyeFov(n),s=1,a=1;n===YO.LEFT?s=Math.abs(Math.tan(r[0]))/Math.abs(Math.tan(r[1])):n===YO.RIGHT&&(a=Math.abs(Math.tan(r[1]))/Math.abs(Math.tan(r[0]))),fn.ortho(this.projection,-s,a,-1,1,-1,1,t.capabilities.clipSpaceMinZ,t.capabilities.clipSpaceSignY,e.surfaceTransform),this.projection.m00=_n[e.surfaceTransform][0],this.projection.m05=_n[e.surfaceTransform][3]*t.capabilities.clipSpaceSignY,this.bgMat.setProperty("u_projection",this.projection),this.bgMat.passes[0].update(),this.logoMat.setProperty("u_projection",this.projection),this.logoMat.passes[0].update(),this.watermarkMat&&(this.watermarkMat.setProperty("u_projection",this.projection),this.watermarkMat.passes[0].update())}t.enableAutoBarrier(!0),t.acquire([e]);var o=this.cmdBuff,h=v.director.root.mainWindow.framebuffer,u=this.renderArea;u.width=e.width,u.height=e.height,o.begin(),o.beginRenderPass(h.renderPass,h,u,this.clearColors,1,0);var l=this.bgMat.passes[0],c=PS.getOrCreatePipelineState(t,l,this.shader,h.renderPass,this.quadAssmebler);o.bindPipelineState(c),o.bindDescriptorSet(Ym.MATERIAL,l.descriptorSet),o.bindInputAssembler(this.quadAssmebler),o.draw(this.quadAssmebler);var _=this.logoMat.passes[0],f=PS.getOrCreatePipelineState(t,_,this.shader,h.renderPass,this.quadAssmebler);if(o.bindPipelineState(f),o.bindDescriptorSet(Ym.MATERIAL,_.descriptorSet),o.bindInputAssembler(this.quadAssmebler),o.draw(this.quadAssmebler),this.watermarkMat){var d=this.watermarkMat.passes[0],p=PS.getOrCreatePipelineState(t,d,this.shader,h.renderPass,this.quadAssmebler);o.bindPipelineState(p),o.bindDescriptorSet(Ym.MATERIAL,d.descriptorSet),o.bindInputAssembler(this.quadAssmebler),o.draw(this.quadAssmebler)}o.endRenderPass(),o.end(),t.flushCommands([o]),t.queue.submit([o]),t.present(),t.enableAutoBarrier(!v.rendering),ul.isXR&&xr.entry.renderLoopEnd(n)}},t.destroy=function(){this.device=null,this.swapchain=null,this.clearColors=null,this.bgImage.destroy&&this.bgImage.destroy(),this.bgImage=null,this.bgMat.destroy(),this.bgMat=null,this.bgTexture.destroy(),this.bgTexture=null,this.logoImage.destroy&&this.logoImage.destroy(),this.logoImage=null,this.renderArea=null,this.cmdBuff=null,this.shader=null,this.logoMat.destroy(),this.logoMat=null,this.logoTexture.destroy(),this.logoTexture=null,this.quadAssmebler.destroy(),this.quadAssmebler=null,this.vertexBuffers.destroy(),this.vertexBuffers=null,this.indicesBuffers.destroy(),this.indicesBuffers=null,this.sampler=null,this.watermarkTexture&&(this.watermarkMat.destroy(),this.watermarkMat=null,this.watermarkTexture.destroy(),this.watermarkTexture=null),this.settings=null},n(e,[{key:"isFinished",get:function(){return this._curTime>=this.settings.totalTime}},{key:"curTime",get:function(){return this._curTime},set:function(t){this._curTime=t}}],[{key:"instance",get:function(){return e._ins||(e._ins=new e),e._ins}}]),e}();TN._ins=void 0,v.internal.SplashScreen=TN;var EN=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=EN;var bN=t("dF",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 ku,e.onPostBaseInitDelegate=new ku,e.onPreInfrastructureInitDelegate=new ku,e.onPostInfrastructureInitDelegate=new ku,e.onPreSubsystemInitDelegate=new ku,e.onPostSubsystemInitDelegate=new ku,e.onPreProjectInitDelegate=new ku,e.onPostProjectInitDelegate=new ku,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(){vN.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&&(DC._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){vN.once(yN.EVENT_END_FRAME,(function(){return t()}))})).then((function(){vN.reset(),v.Object._deferredDestroy(),t.pause(),t.resume(),t._shouldLoadLaunchScene=!0,TN.instance.curTime=0,t._safeEmit(i.EVENT_RESTART)}))},r.end=function(){Gu.close()},r.on=function(t,e,n,r){return(this._engineInited&&t===i.EVENT_ENGINE_INITED||this._inited&&t===i.EVENT_GAME_INITED||this._rendererInitialized&&t===i.EVENT_RENDERER_INITED)&&e.call(n),this.eventTargetOn(t,e,n,r)},r.once=function(t,e,n){return this._engineInited&&t===i.EVENT_ENGINE_INITED?e.call(n):this.eventTargetOnce(t,e,n)},r.init=function(t){var n=this;return this._compatibleWithOldParams(t),Promise.resolve().then((function(){return n.emit(i.EVENT_PRE_BASE_INIT),n.onPreBaseInitDelegate.dispatch()})).then((function(){z(t.debugMode||Q.NONE)})).then((function(){return ul.init()})).then((function(){n._initEvents()})).then((function(){return Ee.init(t.settingsPath,t.overrideSettings)})).then((function(){return n.emit(i.EVENT_POST_BASE_INIT),n.onPostBaseInitDelegate.dispatch()})).then((function(){return n.emit(i.EVENT_PRE_INFRASTRUCTURE_INIT),n.onPreInfrastructureInitDelegate.dispatch()})).then((function(){be.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),hl.init(),ml.init(),of.init(n.canvas,Qm),""===be.CUSTOM_PIPELINE_NAME&&(v.rendering=void 0),SS.init(),xS.init(),kp.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 EN.init(Ee.querySettings(Te.Category.RENDERING,"effectSettingsPath"))})).then((function(){if(v.rendering&&v.rendering.enableEffectImport)if(Ee.querySettings(Te.Category.RENDERING,"renderMode")!==tf.HEADLESS){var t=EN.data;null!==t?v.rendering.init(of.gfxDevice,t):console.error("Effect settings not found, effects will not be imported.")}else v.rendering.init(of.gfxDevice,null)})).then((function(){return vN.init(),xS.loadBuiltinAssets()})).then((function(){return n.emit(i.EVENT_POST_SUBSYSTEM_INIT),n.onPostSubsystemInitDelegate.dispatch()})).then((function(){console.log("Cocos Creator v"+S),n.emit(i.EVENT_ENGINE_INITED),n._engineInited=!0})).then((function(){return n.emit(i.EVENT_PRE_PROJECT_INIT),n.onPreProjectInitDelegate.dispatch()})).then((function(){var t=Ee.querySettings(Te.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(){var t=Ee.querySettings(Te.Category.SCRIPTING,"scriptPackages");return t?Promise.all(t.map((function(t){return e.import(t)}))):Promise.resolve([])})).then((function(){return n._loadProjectBundles()})).then((function(){return n._loadCCEScripts()})).then((function(){return n._setupRenderPipeline()})).then((function(){return n._loadPreloadAssets()})).then((function(){return xS.compileBuiltinMaterial(),TN.instance.init()})).then((function(){return n.emit(i.EVENT_POST_PROJECT_INIT),n.onPostProjectInitDelegate.dispatch()})).then((function(){n._inited=!0,n._safeEmit(i.EVENT_GAME_INITED)}))},r._initXR=function(){var t;if(void 0===globalThis.__globalXR&&(globalThis.__globalXR={}),globalThis.__globalXR.webxrCompatible=null!==(t=Ee.querySettings(Te.Category.XR,"webxrCompatible"))&&void 0!==t&&t,ul.isXR){var e,i;xr.entry=xr.XrEntry.getInstance();var n=null!==(e=Ee.querySettings(Te.Category.RENDERING,"msaa"))&&void 0!==e?e:1,r=null!==(i=Ee.querySettings(Te.Category.RENDERING,"renderingScale"))&&void 0!==i?i:1;xr.entry.setMultisamplesRTT(n),xr.entry.setRenderingScale(r)}},r._compatibleWithOldParams=function(t){var e=t.overrideSettings=t.overrideSettings||{};"showFPS"in t&&(e.profiling=e.profiling||{},e.profiling.showFPS=t.showFPS),"frameRate"in t&&(e.screen=e.screen||{},e.screen.frameRate=t.frameRate),"renderMode"in t&&(e.rendering=e.rendering||{},e.rendering.renderMode=t.renderMode),"renderPipeline"in t&&(e.rendering=e.rendering||{},e.rendering.renderPipeline=t.renderPipeline),"assetOptions"in t&&(e.assets=e.assets||{},Object.assign(e.assets,t.assetOptions)),"customJointTextureLayouts"in t&&(e.animation=e.animation||{},e.animation.customJointTextureLayouts=t.customJointTextureLayouts),"physics"in t&&(e.physics=e.physics||{},Object.assign(e.physics,t.physics)),"orientation"in t&&(e.screen=e.screen||{},e.screen.orientation=t.orientation),"exactFitScreen"in t&&(e.screen=e.screen||{},e.screen.exactFitScreen=t.exactFitScreen)},r._loadPreloadAssets=function(){var t=Ee.querySettings(Te.Category.ASSETS,"preloadAssets");return t?Promise.all(t.map((function(t){return new Promise((function(e,i){SS.loadAny(t,(function(t){t?i(t):e()}))}))}))):Promise.resolve([])},r._loadCCEScripts=function(){return new Promise((function(t){t()}))},r._loadProjectBundles=function(){var t=Ee.querySettings(Te.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),SS.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(TN.instance.isFinished)if(this._shouldLoadLaunchScene){this._shouldLoadLaunchScene=!1;var e,i=Ee.querySettings(Te.Category.LAUNCH,"launchScene");i?vN.loadScene(i,(function(){var e;console.log("Success to load scene: "+i),t._initTime=performance.now(),vN.startAnimation(),null===(e=t.onStart)||void 0===e||e.call(t)})):(this._initTime=performance.now(),vN.startAnimation(),null===(e=this.onStart)||void 0===e||e.call(this))}else vN.tick(this._calculateDT(!1));else TN.instance.update(this._calculateDT(!1))},r.initPacer=function(){var t,e=null!==(t=Ee.querySettings(Te.Category.SCREEN,"frameRate"))&&void 0!==t?t:60;V("number"==typeof e),this._pacer=new SN,this._pacer.onTick=this._updateCallback.bind(this),this.frameRate=e},r._initEvents=function(){Gu.on("show",this._onShow,this),Gu.on("hide",this._onHide,this),Gu.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),Gu.exit()},r.addPersistRootNode=function(t){vN.addPersistRootNode(t)},r.removePersistRootNode=function(t){vN.removePersistRootNode(t)},r.isPersistRootNode=function(t){return vN.isPersistRootNode(t)},r._setupRenderPipeline=function(){var t=this,e=Ee.querySettings(Te.Category.RENDERING,"renderPipeline");return e?new Promise((function(t,i){SS.loadAny(e,(function(e,n){return!e&&n instanceof iD?t(n):i(e)}))})).then((function(e){t._setRenderPipeline(e)})).catch((function(i){k(i),k("Failed load render pipeline: "+e+", engine failed to initialize, will fallback to default pipeline"),t._setRenderPipeline()})):this._setRenderPipeline()},r._setRenderPipeline=function(t){vN.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}(Du));bN.EVENT_HIDE="game_on_hide",bN.EVENT_SHOW="game_on_show",bN.EVENT_LOW_MEMORY="game_on_low_memory",bN.EVENT_GAME_INITED="game_inited",bN.EVENT_ENGINE_INITED="engine_inited",bN.EVENT_RENDERER_INITED="renderer_inited",bN.EVENT_PRE_BASE_INIT="pre_base_init",bN.EVENT_POST_BASE_INIT="post_base_init",bN.EVENT_PRE_INFRASTRUCTURE_INIT="pre_infrastructure_init",bN.EVENT_POST_INFRASTRUCTURE_INIT="post_infrastructure_init",bN.EVENT_PRE_SUBSYSTEM_INIT="pre_subsystem_init",bN.EVENT_POST_SUBSYSTEM_INIT="post_subsystem_init",bN.EVENT_PRE_PROJECT_INIT="pre_project_init",bN.EVENT_POST_PROJECT_INIT="post_project_init",bN.EVENT_RESTART="game_on_restart",bN.EVENT_PAUSE="game_on_pause",bN.EVENT_RESUME="game_on_resume",bN.EVENT_CLOSE="game_on_close",bN.RENDER_TYPE_CANVAS=0,bN.RENDER_TYPE_WEBGL=1,bN.RENDER_TYPE_OPENGL=2,bN.RENDER_TYPE_HEADLESS=3,bN.DEBUG_DT_THRESHOLD=1,v.Game=bN;var xN=t("dG",v.game=new bN);st(yN.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"}]),rt(yN.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"}]),nt(vN,"director",[{name:"_getSceneUuid",targetName:"assetManager.main",newName:"getSceneInfo",customFunction:function(t){var e;return SS.main?null===(e=SS.main.getSceneInfo(t))||void 0===e?void 0:e.uuid:""}}]),st(xN,"game",[{name:"collisionMatrix"},{name:"groupList"}]),nt(xN,"game",[{name:"_sceneInfos",targetName:"assetManager.main",newName:"getSceneInfo",customGetter:function(){var t=[];return SS.main&&SS.main.config.scenes.forEach((function(e){t.push(e)})),t}}]);var CN=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 Np(this._textureSize,this._textureSize),this._atlases.push(t)),t},i.beforeSceneLoad=function(){this.reset()},i.init=function(){this.enabled=!be.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!==Xf.LINEAR||e.magFilter!==Xf.LINEAR||e.mipFilter!==Xf.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--)he(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}(pu));CN.instance=void 0;var RN,wN=t("a0",CN.instance=new CN);vN.registerSystem("dynamicAtlasManager",wN,0),v.internal.dynamicAtlasManager=wN,function(t){t[t.positions=cc.ATTR_POSITION]="positions",t[t.normals=cc.ATTR_NORMAL]="normals",t[t.uvs=cc.ATTR_TEX_COORD]="uvs",t[t.colors=cc.ATTR_COLOR]="colors"}(RN||(RN={}));var IN,BN,DN,PN,ON,MN=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}(),NN=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>xg.MAX_MORPH_TARGET_COUNT?this._subMeshRenderings[n]=new FN(this._mesh,n,this._mesh.struct.morph,e):this._subMeshRenderings[n]=new LN(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(cc.ATTR_POSITION)&&s.push({name:"CC_MORPH_TARGET_HAS_POSITION",value:!0}),n.attributes.includes(cc.ATTR_NORMAL)&&s.push({name:"CC_MORPH_TARGET_HAS_NORMAL",value:!0}),n.attributes.includes(cc.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}(),LN=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,UN(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=VN(n,s*a);this._textureInfo={width:o.width,height:o.height},this._attributes=r.attributes.map((function(e,i){var n=o.create(),a=n.valueView;return r.targets.forEach((function(e,n){for(var r=e.displacements[i],o=new Float32Array(t.data.buffer,t.data.byteOffset+r.offset,r.count),h=s*n*4,u=0;u<s;++u)a[h+4*u+0]=o[3*u+0],a[h+4*u+1]=o[3*u+1],a[h+4*u+2]=o[3*u+2]})),n.updatePixels(),{name:e,morphTexture:n}}))}var e=t.prototype;return e.destroy=function(){for(var t,e=f(this._attributes);!(t=e()).done;)t.value.morphTexture.destroy()},e.createInstance=function(){var t=this,e=new GN(this._gfxDevice,this._subMeshMorph.targets.length);return e.setMorphTextureInfo(this._textureInfo.width,this._textureInfo.height),e.setVerticesCount(this._verticesCount),e.commit(),{setWeights:function(t){e.setWeights(t),e.commit()},requiredPatches:function(){return[{name:"CC_MORPH_TARGET_USE_TEXTURE",value:!0}]},adaptPipelineState:function(i){for(var n,r=f(t._attributes);!(n=r()).done;){var s=n.value,a=void 0;switch(s.name){case cc.ATTR_POSITION:a=Mg;break;case cc.ATTR_NORMAL:a=Fg;break;case cc.ATTR_TANGENT:a=Vg;break;default:k("Unexpected attribute!")}void 0!==a&&(i.bindSampler(a,s.morphTexture.sampler),i.bindTexture(a,s.morphTexture.texture))}i.bindBuffer(xg.BINDING,e.buffer),i.update()},destroy:function(){}}},t}(),FN=function(){function t(t,e,i,n){this._gfxDevice=void 0,this._attributes=[],this._gfxDevice=n;var r=i.subMeshMorphs[e];UN(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 kN(this,this._attributes[0].targets[0].displacements.length/3,this._gfxDevice)},n(t,[{key:"data",get:function(){return this._attributes}}]),t}(),kN=function(){function t(t,e,i){this._attributes=void 0,this._owner=void 0,this._morphUniforms=void 0,this._owner=t,this._morphUniforms=new GN(i,0);var n=VN(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=f(this._attributes);!(e=i()).done;){var n=e.value,r=void 0;switch(n.attributeName){case cc.ATTR_POSITION:r=Mg;break;case cc.ATTR_NORMAL:r=Fg;break;case cc.ATTR_TANGENT:r=Vg;break;default:k("Unexpected attribute!")}void 0!==r&&(t.bindSampler(r,n.morphTexture.sampler),t.bindTexture(r,n.morphTexture.texture))}t.bindBuffer(xg.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}(),GN=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(xg.SIZE)),this._remoteBuffer=t.createBuffer(new wc(wl.UNIFORM|wl.TRANSFER_DST,Dl.HOST|Dl.DEVICE,xg.SIZE,xg.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(xg.OFFSET_OF_WEIGHTS+4*e,t[e],v.sys.isLittleEndian)},e.setMorphTextureInfo=function(t,e){this._localBuffer.setFloat32(xg.OFFSET_OF_DISPLACEMENT_TEXTURE_WIDTH,t,v.sys.isLittleEndian),this._localBuffer.setFloat32(xg.OFFSET_OF_DISPLACEMENT_TEXTURE_HEIGHT,e,v.sys.isLittleEndian)},e.setVerticesCount=function(t){this._localBuffer.setFloat32(xg.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 VN(t,e){var i,n,r,s;t.getFormatFeatures(xl.RGBA32F)&Nl.SAMPLED_TEXTURE?(i=e,r=16,n=Mp.PixelFormat.RGBA32F,s=Float32Array):(i=4*e,r=4,n=Mp.PixelFormat.RGBA8888,s=Uint8Array);var a=function(t){t<5&&(t=5);var e=T(Ni(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 ld({width:o,height:h,_data:a,_compressed:!1,format:n}),l=new Mp;l.setFilters(Mp.Filter.NEAREST,Mp.Filter.NEAREST),l.setMipFilter(Mp.Filter.NONE),l.setWrapMode(Mp.WrapMode.CLAMP_TO_EDGE,Mp.WrapMode.CLAMP_TO_EDGE,Mp.WrapMode.CLAMP_TO_EDGE),l.image=u,l.getGFXTexture()||k("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 UN(t,e,i){t.renderingSubMeshes[e].enableVertexIdChannel(i)}function zN(t){switch(t){case 1:return Uint8Array;case 2:return Uint16Array;case 4:return Uint32Array;default:return Uint8Array}}var HN=new Yi,WN=new Yi,XN=new Uint8Array,jN=Is("cc.Mesh")((BN=function(t){function e(){var e;return(e=t.call(this)||this).morphRendering=null,e._struct=DN&&DN(),e._hash=PN&&PN(),e._data=XN,e._initialized=!1,e._allowDataAccess=ON&&ON(),e._isMeshDataUploaded=!1,e._renderingSubMeshes=null,e._boneSpaceBounds=new Map,e._jointBufferIndices=null,e}s(e,t);var i=e.prototype;return i.onLoaded=function(){this.initialize()},i.initialize=function(){if(!this._initialized)if(this._initialized=!0,this._struct.dynamic){for(var t=of.gfxDevice,e=[],i=[],n=0;n<this._struct.vertexBundles.length;n++){var r=this._struct.vertexBundles[n],s=t.createBuffer(new wc(wl.VERTEX|wl.TRANSFER_DST,Dl.DEVICE,r.view.length,r.view.stride));e.push(s)}for(var a=0;a<this._struct.primitives.length;a++){var o=this._struct.primitives[a],h=o.indexView,u=null;h&&(u=t.createBuffer(new wc(wl.INDEX|wl.TRANSFER_DST,Dl.DEVICE,h.length,h.stride)));for(var l=[],c=0;c<o.vertexBundelIndices.length;c++){var _=o.vertexBundelIndices[c];l.push(e[_])}for(var d=[],p=0;p<o.vertexBundelIndices.length;p++)for(var m,g=o.vertexBundelIndices[p],y=f(this._struct.vertexBundles[g].attributes);!(m=y()).done;){var v=m.value,S=new Xc;S.copy(v),d.push(S)}var A=new yw(l,d,o.primitiveMode,u);A.drawInfo=new Bc,A.mesh=this,A.subMeshIdx=a,i.push(A)}this._renderingSubMeshes=i}else{for(var T=this._data.buffer,E=of.gfxDevice,b=this._createVertexBuffers(E,T),x=[],C=[],R=0;R<this._struct.primitives.length;R++){var w=this._struct.primitives[R];if(0!==w.vertexBundelIndices.length){var I=null,B=null;if(w.indexView){var D=w.indexView,P=D.stride,O=D.length;if(4===P&&!E.hasFeature(bl.ELEMENT_INDEX_UINT)){var M=this._struct.vertexBundles[w.vertexBundelIndices[0]].view.count;if(M>=65536){q(10001,M,65536);continue}P>>=1,O>>=1}I=E.createBuffer(new wc(wl.INDEX,Dl.DEVICE,O,P)),x.push(I),B=new(zN(D.stride))(T,D.offset,D.count),D.stride!==P&&(B=zN(P).from(B)),I.update(B)}var N=w.vertexBundelIndices.map((function(t){return b[t]})),L=[];if(w.vertexBundelIndices.length>0)for(var F=w.vertexBundelIndices[0],k=this._struct.vertexBundles[F].attributes,G=0;G<k.length;++G){var V=k[G];L[G]=new Xc(V.name,V.format,V.isNormalized,V.stream,V.isInstanced,V.location)}var U=new yw(N,L,w.primitiveMode,I);U.mesh=this,U.subMeshIdx=R,C.push(U)}}this._renderingSubMeshes=C,this._struct.morph&&(this.morphRendering=function(t,e){return new NN(t,e)}(this,E)),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,d=l.byteLength/_,p=l.byteLength,m=new Uint8Array(this._data.buffer,c.view.offset,p),g=new Uint8Array(l.buffer,l.byteOffset,p),y=o.vertexBuffers[u];s.maxSubMeshVertices,p>0&&(m.set(g),y.update(g,p)),c.view.count=d,h.vertexCount=d}if(a.indexView){var v=a.indexView,S=v.stride,A=2===S?e.indices16.length:e.indices32.length,T=A*S,E=new Uint8Array(this._data.buffer,v.offset,T),b=2===S?new Uint8Array(e.indices16.buffer,e.indices16.byteOffset,T):new Uint8Array(e.indices32.buffer,e.indices32.byteOffset,T),x=o.indexBuffer;s.maxSubMeshIndices,T>0&&(E.set(b),x.update(b,T)),v.count=A,h.indexCount=A}if(e.minPos&&e.maxPos){var C=new Yi(e.minPos.x,e.minPos.y,e.minPos.z),R=new Yi(e.maxPos.x,e.maxPos.y,e.maxPos.z);r.bounds[t]||(r.bounds[t]=new is),is.fromPoints(r.bounds[t],C,R);for(var w,I=new Yi,B=new Yi,D=f(r.bounds);!(w=D()).done;){var P=w.value;P&&(P.getBoundary(I,B),Yi.min(C,I,C),Yi.max(R,B,R))}this._struct.minPosition=new Yi(C.x,C.y,C.z),this._struct.maxPosition=new Yi(R.x,R.y,R.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 is(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,cc.ATTR_JOINTS),h=this.readAttribute(a,cc.ATTR_WEIGHTS),u=this.readAttribute(a,cc.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++){Yi.set(HN,u[3*c+0],u[3*c+1],u[3*c+2]);for(var _=0;_<4;++_){var f=4*c+_,d=o[f];if(!(0===h[f]||d>=n.length)){Yi.transformMat4(WN,HN,n[d]),i[d]=!0;var p=e[d];Yi.min(p.center,p.center,WN),Yi.max(p.halfExtents,p.halfExtents,WN)}}}}for(var m=0;m<n.length;m++){var g=e[m];i[m]?is.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 Yi,r=e&&new sn,s=e&&new is;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&&(Yi.add(s.center,a.maxPosition,a.minPosition),Yi.multiplyScalar(s.center,s.center,.5),Yi.subtract(s.halfExtents,a.maxPosition,a.minPosition),Yi.multiplyScalar(s.halfExtents,s.halfExtents,.5),is.transform(s,s,e),Yi.add(a.maxPosition,s.center,s.halfExtents),Yi.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===cc.ATTR_POSITION||u.attributes[l].name===cc.ATTR_NORMAL){var c=u.attributes[l].format,_=new DataView(o.buffer,u.view.offset+YN(u.attributes,l)),d=JN(_,c),p=QN(_,c);if(!d||!p)continue;for(var m=u.view.count,g=u.view.stride,y=KN(c),v=0;v<m;v++){var S=v*g,A=S+y,T=A+y;switch(n.set(d(S),d(A),d(T)),u.attributes[l].name){case cc.ATTR_POSITION:n.transformMat4(e);break;case cc.ATTR_NORMAL:Yi.transformQuat(n,n,r)}p(S,n.x),p(A,n.y),p(T,n.z)}}}return this.reset({struct:a,data:o}),this.initialize(),!0}for(var E,b,x,C,R,w=new MN,I=0,B=0,D=0,P=0,O=0,M=0,N=0,L=0,F=!1,k=new Array(this._struct.vertexBundles.length),G=0;G<this._struct.vertexBundles.length;++G){var V=this._struct.vertexBundles[G],U=t._struct.vertexBundles[G];D=V.view.offset,P=U.view.offset,B=V.view.stride,I=V.view.count+U.view.count,E=new ArrayBuffer(I*B),b=new Uint8Array(E),D+=(x=this._data.subarray(D,D+V.view.length)).length,P+=(C=t._data.subarray(P,P+U.view.length)).length,b.set(x),O=0;for(var z,H=f(V.attributes);!(z=H()).done;){var W=z.value;N=0,F=!1;for(var X,j=f(U.attributes);!(X=j()).done;){var Y=X.value;if(W.name===Y.name&&W.format===Y.format){F=!0;break}N+=m_[Y.format].size}if(F){L=m_[W.format].size,M=V.view.length+O;for(var q=0;q<U.view.count;++q){if(R=C.subarray(N,N+L),b.set(R,M),(W.name===cc.ATTR_POSITION||W.name===cc.ATTR_NORMAL)&&e){var K=new Float32Array(b.buffer,M,3);switch(n.set(K[0],K[1],K[2]),W.name){case cc.ATTR_POSITION:n.transformMat4(e);break;case cc.ATTR_NORMAL:Yi.transformQuat(n,n,r)}K[0]=n.x,K[1]=n.y,K[2]=n.z}M+=V.view.stride,N+=U.view.stride}}O+=m_[W.format].size}k[G]={attributes:V.attributes,view:{offset:w.getLength(),length:E.byteLength,count:I,stride:B}},w.addBuffer(E)}for(var J,Q,Z,$=0,tt=2,et=new Array(this._struct.primitives.length),it=0;it<this._struct.primitives.length;++it){var nt=this._struct.primitives[it],rt=t._struct.primitives[it];et[it]={primitiveMode:nt.primitiveMode,vertexBundelIndices:nt.vertexBundelIndices};for(var st,at=0,ot=f(nt.vertexBundelIndices);!(st=ot()).done;){var ht=st.value;at=Math.max(at,this._struct.vertexBundles[ht].view.count)}if(nt.indexView&&rt.indexView){$=nt.indexView.count,$+=rt.indexView.count,D=nt.indexView.offset,P=rt.indexView.offset,tt=$<256?1:$<65536?2:4;var ut=new ArrayBuffer($*tt);if(J=2===tt?new Uint16Array(ut):1===tt?new Uint8Array(ut):new Uint32Array(ut),Q=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)J.set(Q);else for(var lt=0;lt<nt.indexView.count;++lt)J[lt]=Q[lt];D+=nt.indexView.length,Z=2===rt.indexView.stride?new Uint16Array(t._data.buffer,P,rt.indexView.count):1===rt.indexView.stride?new Uint8Array(t._data.buffer,P,rt.indexView.count):new Uint32Array(t._data.buffer,P,rt.indexView.count);for(var ct=0;ct<rt.indexView.count;++ct)J[nt.indexView.count+ct]=at+Z[ct];P+=rt.indexView.length,et[it].indexView={offset:w.getLength(),length:ut.byteLength,count:$,stride:tt},w.setNextAlignment(tt),w.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?(Yi.add(s.center,t._struct.maxPosition,t._struct.minPosition),Yi.multiplyScalar(s.center,s.center,.5),Yi.subtract(s.halfExtents,t._struct.maxPosition,t._struct.minPosition),Yi.multiplyScalar(s.halfExtents,s.halfExtents,.5),is.transform(s,s,e),Yi.add(n,s.center,s.halfExtents),Yi.max(_t.maxPosition,_t.maxPosition,n),Yi.subtract(n,s.center,s.halfExtents),Yi.min(_t.minPosition,_t.minPosition,n)):(Yi.min(_t.minPosition,_t.minPosition,t._struct.minPosition),Yi.max(_t.maxPosition,_t.maxPosition,t._struct.maxPosition))),this.reset({struct:_t,data:new Uint8Array(w.getCombined())}),this.initialize(),!0},i.validateMergingMesh=function(t){if(this._struct.dynamic||t._struct.dynamic)return!1;if(this._struct.vertexBundles.length!==t._struct.vertexBundles.length)return!1;for(var e=0;e<this._struct.vertexBundles.length;++e){var i=this._struct.vertexBundles[e],n=t._struct.vertexBundles[e];if(i.attributes.length!==n.attributes.length)return!1;for(var r=0;r<i.attributes.length;++r)if(i.attributes[r].format!==n.attributes[r].format)return!1}if(this._struct.primitives.length!==t._struct.primitives.length)return!1;for(var s=0;s<this._struct.primitives.length;++s){var a=this._struct.primitives[s],o=t._struct.primitives[s];if(a.vertexBundelIndices.length!==o.vertexBundelIndices.length)return!1;for(var h=0;h<a.vertexBundelIndices.length;++h)if(a.vertexBundelIndices[h]!==o.vertexBundelIndices[h])return!1;if(a.primitiveMode!==o.primitiveMode)return!1;if(a.indexView){if(void 0===o.indexView)return!1}else if(o.indexView)return!1}return!0},i.readAttribute=function(t,e){var i=this,n=null;return this._accessAttribute(t,e,(function(t,e){var r=t.view.count,s=t.attributes[e].format,a=x_(m_[s]);if(0!==r){var o=new DataView(i._data.buffer,t.view.offset+YN(t.attributes,e)),h=m_[s],u=JN(o,s);if(a&&u){for(var l=h.count,c=new a(r*l),_=t.view.stride,f=0;f<r;++f)for(var d=0;d<l;++d)c[l*f+d]=u(_*f+c.BYTES_PER_ELEMENT*d);n=c}}})),n},i.copyAttribute=function(t,e,i,n,r){var s=this,a=!1;return this._accessAttribute(t,e,(function(t,e){var o=t.view.count;if(0!==o){var h=t.attributes[e].format,u=new DataView(s._data.buffer,t.view.offset+YN(t.attributes,e)),l=new DataView(i,r),c=m_[h],_=JN(u,h),f=QN(l,h);if(_&&f){for(var d=c.count,p=t.view.stride,m=KN(h),g=n,y=m,v=0;v<o;++v)for(var S=0;S<d;++S)f(g*v+y*S,_(p*v+m*S));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?xl.R8UI:2===i.indexView.stride?xl.R16UI:xl.R32UI,s=JN(new DataView(this._data.buffer),r),a=0;a<n;++a)e[a]=s(i.indexView.offset+m_[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=m_[n]})),i},i._accessAttribute=function(t,e,i){if(!(t>=this._struct.primitives.length))for(var n,r=f(this._struct.primitives[t].vertexBundelIndices);!(n=r()).done;){var s=n.value,a=this._struct.vertexBundles[s],o=a.attributes.findIndex((function(t){return t.name===e}));if(!(o<0)){i(a,o);break}}},i._createVertexBuffers=function(t,e){return this._struct.vertexBundles.map((function(i){var n=t.createBuffer(new wc(wl.VERTEX,Dl.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:XN})},i.releaseData=function(){this._data=XN},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=fl(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}(zf),DN=Ss(BN.prototype,"_struct",[ks],(function(){return{vertexBundles:[],primitives:[]}})),PN=Ss(BN.prototype,"_hash",[ks],(function(){return 0})),ON=Ss(BN.prototype,"_allowDataAccess",[ks],(function(){return!0})),IN=BN))||IN;function YN(t,e){for(var i=0,n=0;n<e;++n){var r=t[n];i+=m_[r.format].size}return i}v.Mesh=jN;var qN=ul.isLittleEndian;function KN(t){var e=m_[t];return e.size/e.count}function JN(t,e){var i=m_[e],n=i.size/i.count;switch(i.type){case Cl.UNORM:switch(n){case 1:return function(e){return t.getUint8(e)};case 2:return function(e){return t.getUint16(e,qN)};case 4:return function(e){return t.getUint32(e,qN)}}break;case Cl.SNORM:case Cl.INT:switch(n){case 1:return function(e){return t.getInt8(e)};case 2:return function(e){return t.getInt16(e,qN)};case 4:return function(e){return t.getInt32(e,qN)}}break;case Cl.UINT:switch(n){case 1:return function(e){return t.getUint8(e)};case 2:return function(e){return t.getUint16(e,qN)};case 4:return function(e){return t.getUint32(e,qN)}}break;case Cl.FLOAT:return function(e){return t.getFloat32(e,qN)}}return null}function QN(t,e){var i=m_[e],n=i.size/i.count;switch(i.type){case Cl.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,qN)};case 4:return function(e,i){return t.setUint32(e,i,qN)}}break;case Cl.SNORM:case Cl.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,qN)};case 4:return function(e,i){return t.setInt32(e,i,qN)}}break;case Cl.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,qN)};case 4:return function(e,i){return t.setUint32(e,i,qN)}}break;case Cl.FLOAT:return function(e,i){return t.setFloat32(e,i,qN)}}return null}var ZN,$N,tL=[new Xc(cc.ATTR_POSITION,xl.RGB32F),new Xc(cc.ATTR_NORMAL,xl.RGB32F),new Xc(cc.ATTR_TEX_COORD,xl.RG32F),new Xc(cc.ATTR_TANGENT,xl.RGBA32F),new Xc(cc.ATTR_COLOR,xl.RGBA32F)],eL=new Yi;function iL(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=f(t.attributes);!(u=l()).done;){var c=u.value;if(c.name===cc.ATTR_POSITION){n=c;break}}n||(n=tL[0]),r.push(n);var _=m_[n.format];o=Math.max(o,Math.floor(h.length/_.count)),a.push({offset:s,data:h,attribute:n}),s+=_.size}if(t.normals&&t.normals.length>0){if(n=null,t.attributes)for(var d,p=f(t.attributes);!(d=p()).done;){var m=d.value;if(m.name===cc.ATTR_NORMAL){n=m;break}}n||(n=tL[1]);var g=m_[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 y,v=f(t.attributes);!(y=v()).done;){var S=y.value;if(S.name===cc.ATTR_TEX_COORD){n=S;break}}n||(n=tL[2]);var A=m_[n.format];r.push(n),o=Math.max(o,Math.floor(t.uvs.length/A.count)),a.push({offset:s,data:t.uvs,attribute:n}),s+=A.size}if(t.tangents&&t.tangents.length>0){if(n=null,t.attributes)for(var T,E=f(t.attributes);!(T=E()).done;){var b=T.value;if(b.name===cc.ATTR_TANGENT){n=b;break}}n||(n=tL[3]);var x=m_[n.format];r.push(n),o=Math.max(o,Math.floor(t.tangents.length/x.count)),a.push({offset:s,data:t.tangents,attribute:n}),s+=x.size}if(t.colors&&t.colors.length>0){if(n=null,t.attributes)for(var C,R=f(t.attributes);!(C=R()).done;){var w=C.value;if(w.name===cc.ATTR_COLOR){n=w;break}}n||(n=tL[4]);var I=m_[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 B=0;B<t.customAttributes.length;B++){var D=t.customAttributes[B],P=m_[D.attr.format];r.push(D.attr),o=Math.max(o,Math.floor(D.values.length/P.count)),a.push({offset:s,data:D.values,attribute:D.attr}),s+=P.size}for(var O=new MN,M=new ArrayBuffer(o*s),N=new DataView(M),L=0,F=a;L<F.length;L++){var k=F[L];mw(N,k.data,k.attribute.format,k.offset,s)}O.setNextAlignment(0);var G={attributes:r,view:{offset:O.getLength(),length:M.byteLength,count:o,stride:s}};O.addBuffer(M);var V=null,U=0;if(t.indices){var z=t.indices;U=z.length,V=new ArrayBuffer(2*U),mw(new DataView(V),z,xl.R16UI)}var H={primitiveMode:t.primitiveMode||Ql.TRIANGLE_LIST,vertexBundelIndices:[0]};V&&(O.setNextAlignment(2),H.indexView={offset:O.getLength(),length:V.byteLength,count:U,stride:2},O.addBuffer(V));var W=t.minPos;if(!W&&i.calculateBounds){W=Yi.set(new Yi,1/0,1/0,1/0);for(var X=0;X<o;++X)Yi.set(eL,h[3*X+0],h[3*X+1],h[3*X+2]),Yi.min(W,W,eL)}var j=t.maxPos;if(!j&&i.calculateBounds){j=Yi.set(new Yi,-1/0,-1/0,-1/0);for(var Y=0;Y<o;++Y)Yi.set(eL,h[3*Y+0],h[3*Y+1],h[3*Y+2]),Yi.max(j,j,eL)}var q={vertexBundles:[G],primitives:[H]};return W&&(q.minPosition=new Yi(W.x,W.y,W.z)),j&&(q.maxPosition=new Yi(j.x,j.y,j.z)),e||(e=new jN),e.reset({struct:q,data:new Uint8Array(O.getCombined())}),e}var nL,rL=new Yi,sL=new fn;!function(t){t[t.RECT=0]="RECT",t[t.POLYGON=1]="POLYGON"}(nL||(nL={}));var aL,oL,hL,uL=[{u:0,v:0},{u:0,v:0},{u:0,v:0},{u:0,v:0}],lL=t("b",Is("cc.SpriteFrame")((($N=function(t){function e(){var e;return(e=t.call(this)||this).vertices=null,e.uv=[],e.unbiasUV=[],e.uvSliced=[],e._rect=new En,e._trimmedBorder=new zi,e._offset=new yn,e._originalSize=new An,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 yn(.5,.5),e._meshType=nL.RECT,e._extrude=0,e._customOutLine=[],e._minPos=new Yi,e._maxPos=new Yi,e}s(e,t),e.createWithImage=function(t){var i=t instanceof ld?t:new ld(t),n=new Mp;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?(J(3300,this.name+"/"+t.name,i,t.width),!1):!(n>t.height&&(J(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&&wN&&wN.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){uL[0].u=t.x/n,uL[1].u=(t.x+u)/n,uL[2].u=(t.x+u+l)/n,uL[3].u=(t.x+t.height)/n,uL[3].v=t.y/r,uL[2].v=(t.y+s)/r,uL[1].v=(t.y+s+o)/r,uL[0].v=(t.y+t.width)/r;for(var _=0;_<4;++_)for(var f=uL[_],d=0;d<4;++d){var p=uL[3-d];c.push({u:f.u,v:p.v})}}else{uL[0].u=t.x/n,uL[1].u=(t.x+s)/n,uL[2].u=(t.x+s+o)/n,uL[3].u=(t.x+t.width)/n,uL[3].v=t.y/r,uL[2].v=(t.y+h)/r,uL[1].v=(t.y+h+l)/r,uL[0].v=(t.y+t.height)/r;for(var m=0;m<4;++m)for(var g=uL[m],y=0;y<4;++y){var v=uL[y];c.push({u:v.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,f=0===s?1:(t.y+t.width)/s;this._isFlipUVX&&this._isFlipUVY?(i[0]=c,i[1]=f,i[2]=c,i[3]=_,i[4]=l,i[5]=f,i[6]=l,i[7]=_):this._isFlipUVX?(i[0]=c,i[1]=_,i[2]=c,i[3]=f,i[4]=l,i[5]=_,i[6]=l,i[7]=f):this._isFlipUVY?(i[0]=l,i[1]=f,i[2]=l,i[3]=_,i[4]=c,i[5]=f,i[6]=c,i[7]=_):(i[0]=l,i[1]=_,i[2]=l,i[3]=f,i[4]=c,i[5]=_,i[6]=c,i[7]=f)}else{var d=0===r?0:t.x/r,p=0===r?1:(t.x+t.width)/r,m=0===s?1:(t.y+t.height)/s,g=0===s?0:t.y/s;this._isFlipUVX&&this._isFlipUVY?(e[0]=p,e[1]=g,e[2]=d,e[3]=g,e[4]=p,e[5]=m,e[6]=d,e[7]=m):this._isFlipUVX?(e[0]=p,e[1]=m,e[2]=d,e[3]=m,e[4]=p,e[5]=g,e[6]=d,e[7]=g):this._isFlipUVY?(e[0]=d,e[1]=g,e[2]=p,e[3]=g,e[4]=d,e[5]=m,e[6]=p,e[7]=m):(e[0]=d,e[1]=m,e[2]=p,e[3]=m,e[4]=d,e[5]=g,e[6]=p,e[7]=g);var y=0===r?0:t.x/r,v=0===r?1:(t.x+t.width)/r,S=0===s?1:(t.y+t.height)/s,A=0===s?0:t.y/s;this._isFlipUVX&&this._isFlipUVY?(i[0]=v,i[1]=A,i[2]=y,i[3]=A,i[4]=v,i[5]=S,i[6]=y,i[7]=S):this._isFlipUVX?(i[0]=v,i[1]=S,i[2]=y,i[3]=S,i[4]=v,i[5]=A,i[6]=y,i[7]=A):this._isFlipUVY?(i[0]=y,i[1]=A,i[2]=v,i[3]=A,i[4]=y,i[5]=S,i[6]=v,i[7]=S):(i[0]=y,i[1]=S,i[2]=v,i[3]=S,i[4]=y,i[5]=A,i[6]=v,i[7]=A)}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=wN;if(t){var e=this._texture;if(e instanceof Mp&&!e.isCompressed){var i=this.width,n=this.height;if(!e.image||i>t.maxFrameSize||n>t.maxFrameSize)this._packable=!1;else{var r=A.HTMLCanvasElement;e.image&&e.image instanceof r&&(this._packable=!0)}}else this._packable=!1}},i._serialize=function(){return null},i._deserialize=function(t){var e=t,i=e.rect;i&&(this._rect=new En(i.x,i.y,i.width,i.height));var n=e.offset;e.offset&&(this._offset=new yn(n.x,n.y));var r=e.originalSize;e.originalSize&&(this._originalSize=new An(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 yn(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 Yi(o.minPos.x,o.minPos.y,o.minPos.z),maxPos:new Yi(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 Yi(h[u],h[u+1],h[u+2]));this._updateMeshVertices()}},i.clone=function(){var t,i,n,r,s=new e,a=this.vertices;return s.vertices=a?{rawPosition:a.rawPosition.slice(0),positions:a.positions.slice(0),indexes:a.indexes.slice(0),uv:a.uv.slice(0),nuv:a.nuv.slice(0),minPos:a.minPos.clone(),maxPos:a.minPos.clone()}:null,(t=s.uv).splice.apply(t,[0,s.uv.length].concat(this.uv)),(i=s.unbiasUV).splice.apply(i,[0,s.unbiasUV.length].concat(this.unbiasUV)),(n=s.uvSliced).splice.apply(n,[0,s.uvSliced.length].concat(this.uvSliced)),s._rect.set(this._rect),s._offset.set(this._offset),s._originalSize.set(this._originalSize),s._rotated=this._rotated,(r=s._capInsets).splice.apply(r,[0,s._capInsets.length].concat(this._capInsets)),s._atlasUuid=this._atlasUuid,s._texture=this._texture,s._isFlipUVX=this._isFlipUVX,s._isFlipUVY=this._isFlipUVY,s._pixelsToUnit=this._pixelsToUnit,s._pivot.set(this._pivot),s._meshType=this._meshType,s},i._refreshTexture=function(t){this._texture=t;var e=this._texture,i={},n=!1;0!==this._rect.width&&0!==this._rect.height&&this.checkRect(e)||(i.rect=new En(0,0,e.width,e.height),n=!0),(0===this._originalSize.width||0===this._originalSize.height||n)&&(i.originalSize=new An(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 Mp;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 Yi,maxPos:new Yi},this._meshType===nL.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,f=0===i?0:n.y/i;rL.set(-h,-u,0),this.vertices.rawPosition.push(rL.clone()),this.vertices.uv.push(a),this.vertices.uv.push(o+s),this.vertices.nuv.push(l),this.vertices.nuv.push(f),this.vertices.minPos.set(rL),rL.set(h,-u,0),this.vertices.rawPosition.push(rL.clone()),this.vertices.uv.push(a+r),this.vertices.uv.push(o+s),this.vertices.nuv.push(c),this.vertices.nuv.push(f),rL.set(-h,u,0),this.vertices.rawPosition.push(rL.clone()),this.vertices.uv.push(a),this.vertices.uv.push(o),this.vertices.nuv.push(l),this.vertices.nuv.push(_),rL.set(h,u,0),this.vertices.rawPosition.push(rL.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(rL),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(){sL.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 Yi(e,i,0);sL.transform(n),n.set(t,t,1),sL.scale(n);for(var r=this.vertices,s=0;s<r.rawPosition.length;s++){var a=r.rawPosition[s];Yi.transformMat4(n,a,sL),Yi.toArray(r.positions,n,3*s)}Yi.transformMat4(this._minPos,r.minPos,sL),Yi.transformMat4(this._maxPos,r.maxPos,sL)},i._createMesh=function(){this._mesh=iL({primitiveMode:Ql.TRIANGLE_LIST,positions:this.vertices.positions,uvs:this.vertices.nuv,indices:this.vertices.indexes,minPos:this._minPos,maxPos:this._maxPos,attributes:[new Xc(cc.ATTR_POSITION,xl.RGB32F),new Xc(cc.ATTR_TEX_COORD,xl.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}(zf)).EVENT_UV_UPDATED="uv_updated",$N.MeshType=nL,ZN=$N))||ZN);v.SpriteFrame=lL;var cL,_L=t("a",Is("cc.SpriteAtlas")((oL=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).spriteFrames=hL&&hL(),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=wt();for(var r=0;r<n.length;r+=2)e.result.push(this.spriteFrames,n[r],n[r+1],ie(lL))},e}(zf),hL=Ss(oL.prototype,"spriteFrames",[ks],(function(){return wt()})),aL=oL))||aL);v.SpriteAtlas=_L;var fL,dL,pL,mL=t("F",Is("cc.Font")(cL=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(zf))||cL);v.Font=mL;var gL,yL,vL,SL,AL,TL,EL,bL,xL=t("T",Is("cc.TTFFont")((dL=function(t){function e(){for(var e,i=arguments.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=pL&&pL(),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:Wu(this._native),__isNative__:!0}}}]),e}(mL),pL=Ss(dL.prototype,"_fontFamily",[ks],(function(){return null})),p(dL.prototype,"_nativeAsset",[ua,oa],Object.getOwnPropertyDescriptor(dL.prototype,"_nativeAsset"),dL.prototype),p(dL.prototype,"_nativeDep",[ua],Object.getOwnPropertyDescriptor(dL.prototype,"_nativeDep"),dL.prototype),fL=dL))||fL);v.TTFFont=xL;var CL,RL=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},wL=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 RL;Gt(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}(),IL=t("B",(gL=Is("cc.BitmapFont"),yL=ha(lL),gL((SL=function(t){function e(){for(var e,i=arguments.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=AL&&AL(),e.spriteFrame=TL&&TL(),e.fontSize=EL&&EL(),e.fntConfig=bL&&bL(),e}return s(e,t),e.prototype.onLoaded=function(){var t=this.spriteFrame;!this.fontDefDictionary&&t&&(this.fontDefDictionary=new wL(t.texture));var e=this.fntConfig;if(e){var i=e.fontDefDictionary;for(var n in i){var r=new RL,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 k("The fnt config is not exists!")},e}(mL),AL=Ss(SL.prototype,"fntDataStr",[ks],(function(){return""})),TL=Ss(SL.prototype,"spriteFrame",[yL],(function(){return null})),EL=Ss(SL.prototype,"fontSize",[ks],(function(){return-1})),bL=Ss(SL.prototype,"fntConfig",[ks],(function(){return null})),vL=SL))||vL));v.BitmapFont=IL;var BL=t("L",Is("cc.LabelAtlas")(CL=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(IL))||CL);v.LabelAtlas=BL;var DL=t("z",.26),PL=t("A",(DL+1)/2-DL);var OL=new ne(2);OL.get=function(){return this._get()||{key:"",value:0,prev:null,next:null}};var ML,NL=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=OL.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,OL.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),LL=/([a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûа-яА-ЯЁё]+|\S)/,FL=/^[!,.:;'}\]%\?>、‘“》?。,!]/,kL=/([a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûаíìÍÌïÁÀáàÉÈÒÓòóŐőÙÚŰúűñÑæÆœŒÃÂãÔõěščřžýáíéóúůťďňĚŠČŘŽÁÍÉÓÚŤżźśóńłęćąŻŹŚÓŃŁĘĆĄ-яА-ЯЁёáàảạãăắằẳẵặâấầẩẫậéèẻẽẹêếềểễệiíìỉĩịóòỏõọôốồổỗộơớờởỡợúùủũụưứừửữựýỳỷỹỵđÁÀẢẠÃĂẮẰẲẴẶÂẤẦẨẪẬÉÈẺẼẸÊẾỀỂỄỆIÍÌỈĨỊÓÒỎÕỌÔỐỒỔỖỘƠỚỜỞỠỢÚÙỦŨỤƯỨỪỬỮỰÝỲỶỸỴĐ]+|\S)$/,GL=/[a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûаíìÍÌïÁÀáàÉÈÒÓòóŐőÙÚŰúűñÑæÆœŒÃÂãÔõěščřžýáíéóúůťďňĚŠČŘŽÁÍÉÓÚŤżźśóńłęćąŻŹŚÓŃŁĘĆĄ-яА-ЯЁёáàảạãăắằẳẵặâấầẩẫậéèẻẽẹêếềểễệiíìỉĩịóòỏõọôốồổỗộơớờởỡợúùủũụưứừửữựýỳỷỹỵđÁÀẢẠÃĂẮẰẲẴẶÂẤẦẨẪẬÉÈẺẼẸÊẾỀỂỄỆIÍÌỈĨỊÓÒỎÕỌÔỐỒỔỖỘƠỚỜỞỠỢÚÙỦŨỤƯỨỪỬỮỰÝỲỶỸỴĐ]+$/,VL=/^[a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûаíìÍÌïÁÀáàÉÈÒÓòóŐőÙÚŰúűñÑæÆœŒÃÂãÔõěščřžýáíéóúůťďňĚŠČŘŽÁÍÉÓÚŤżźśóńłęćąŻŹŚÓŃŁĘĆĄ-яА-ЯЁёáàảạãăắằẳẵặâấầẩẫậéèẻẽẹêếềểễệiíìỉĩịóòỏõọôốồổỗộơớờởỡợúùủũụưứừửữựýỳỷỹỵđÁÀẢẠÃĂẮẰẲẴẶÂẤẦẨẪẬÉÈẺẼẸÊẾỀỂỄỆIÍÌỈĨỊÓÒỎÕỌÔỐỒỔỖỘƠỚỜỞỠỢÚÙỦŨỤƯỨỪỬỮỰÝỲỶỸỴĐ]/;function UL(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 zL(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 HL(t,e,i){var n=(i||t.font)+"🎮"+e,r=NL.get(n);if(null!==r)return r;var s=t.measureText(e),a=s&&s.width||0;return NL.put(n,a),a}function WL(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 XL(t){return VL.exec(t)}function jL(t){return GL.exec(t)}function YL(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=WL(s,a),h=e-n(o),u=o,l=0,c=0;h>i&&c++<100;)a*=i/h,h=e-n(o=WL(s,a|=0));for(c=0;o&&h<=i&&c++<100;){var _=LL.exec(o);u=o,h=e-n(o=WL(s,a+=l=_?_[0].length:1))}0==(a-=l)?(a=1,u=WL(s,1)):1===a&&s[0]>="\ud800"&&s[0]<="\udbff"&&(a=2,u=WL(s,2));var f=WL(s,0,a),d=void 0;FL.test(u||o)&&(0==(a-=(d=kL.exec(f))?d[0].length:0)&&(a=1),u=WL(s,a),f=WL(s,0,a)),VL.test(u)&&(d=GL.exec(f))&&f!==d[0]&&(u=WL(s,a-=d[0].length),f=WL(s,0,a)),(0===r.length||(f=f.trim()).length>0)&&r.push(f),e=n(s=u||o)}return(0===r.length||(s=s.trim()).length>0)&&r.push(s),r}var qL,KL=function(){function t(){this.pool=[]}t.getInstance=function(){return ML||(ML=new t),ML};var e=t.prototype;return e.get=function(){var t=this.pool.pop();if(!t){var e=A.document.createElement("canvas"),i=e.getContext("2d");t={canvas:e,context:i}}return t},e.put=function(t){this.pool.length>=be.MAX_LABEL_CANVAS_POOL_SIZE||this.pool.push(t)},t}(),JL=Zi.WHITE.clone(),QL=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},ZL="rgba(255, 255, 255, "+(1/255).toFixed(3)+")",$L=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,KL.getInstance().put(this.data)},e._updateProperties=function(){if(this.data=KL.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=HL(this.context,this.char,this.labelInfo.fontDesc),i=2*this.labelInfo.margin+2;this.width=parseFloat(e.toFixed(2))*t+i,this.height=(1+DL)*this.labelInfo.fontSize*t+i,this.offsetY=-this.labelInfo.fontSize*DL*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 ld),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=ZL,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*PL+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||JL;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}(),tF=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=Hf.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 Tc;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}(Mp),eF=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 tF;i.initWithSize(t,e),this.fontDefDictionary=new wL(i),this._halfBleed=1,this._width=t,this._height=e,vN.on(yN.EVENT_BEFORE_SCENE_LAUNCH,this.beforeSceneLoad,this)}var e=t.prototype;return e.insertLetterTexture=function(t){var e=t.image,i=vN.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 QL;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 tF;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 $L(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}(),iF={fontAtlas:null,fontSize:0,lineHeight:0,hAlign:0,vAlign:0,hash:"",fontFamily:"",fontDesc:"Arial",color:Zi.WHITE.clone(),isOutlined:!1,out:Zi.WHITE.clone(),margin:0,fontScale:1},nF=[new Xc(cc.ATTR_POSITION,xl.RGB32F)],rF=[new Xc(cc.ATTR_POSITION,xl.RGB32F),new Xc(cc.ATTR_COLOR,xl.RGBA32F)],sF=[new Xc(cc.ATTR_POSITION,xl.RGB32F),new Xc(cc.ATTR_TEX_COORD,xl.RG32F),new Xc(cc.ATTR_COLOR,xl.RGBA32F)],aF=[new Xc(cc.ATTR_POSITION,xl.RGB32F),new Xc(cc.ATTR_TEX_COORD,xl.RG32F),new Xc(cc.ATTR_COLOR,xl.RGBA8,!0)],oF=[new Xc(cc.ATTR_POSITION,xl.RGB32F),new Xc(cc.ATTR_TEX_COORD,xl.RG32F),new Xc(cc.ATTR_COLOR,xl.RGBA32F),new Xc(cc.ATTR_COLOR2,xl.RGBA32F)],hF=[new Xc(cc.ATTR_POSITION,xl.RGB32F),new Xc(cc.ATTR_TEX_COORD,xl.RG32F),new Xc(cc.ATTR_COLOR,xl.RGBA8,!0),new Xc(cc.ATTR_COLOR2,xl.RGBA8,!0)];function uF(t){for(var e=0,i=0;i<t.length;i++){var n=t[i];e+=m_[n.format].count}return e}function lF(t){for(var e=0,i=0;i<t.length;i++){var n=t[i];e+=m_[n.format].size}return e}v.internal.vfmtPosUvColor=sF,v.internal.vfmtPosUvTwoColor=oF,v.internal.vfmtPosUvColor4B=aF,v.internal.vfmtPosUvTwoColor4B=hF,t("v",Object.freeze({__proto__:null,vfmt:nF,vfmtPosColor:rF,vfmtPosUvColor:sF,vfmtPosUvColor4B:aF,vfmtPosUvTwoColor:oF,vfmtPosUvTwoColor4B:hF,getComponentPerVertex:uF,getAttributeStride:lF})),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"}(qL||(qL={}));var cF,_F,fF,dF,pF=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=lF(e)>>2,this._initVDataCount,this._floatsPerVertex,tt(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=ul.__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(ul.__isWebIOS14OrIPadOS14Env||!this._iaPool[0]){var r=this._vertexFormatBytes=this._floatsPerVertex*Float32Array.BYTES_PER_ELEMENT,s=Uint16Array.BYTES_PER_ELEMENT,a=t.createBuffer(new wc(wl.VERTEX|wl.TRANSFER_DST,Dl.HOST|Dl.DEVICE,r,r));n=t.createBuffer(new wc(wl.INDEX|wl.TRANSFER_DST,Dl.HOST|Dl.DEVICE,s,s)),i=[a],this._iaInfo=new Yc(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}()),mF=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=lF(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}(),gF=new _u((function(){return{offset:0,length:0}}),32),yF=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}(),vF=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*be.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)gF.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 yF(this,s,r,l,c,e)}return J(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),gF.free(h),h=null),s=!0),!s&&h){if(0==h.offset-(n+r))h.offset=n,h.length+=r;else{var u=gF.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=gF.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),$(r>=0,9004,t,i.offset,i.length),0===r?(this._freeLists[t].splice(e,1),gF.free(i)):(i.offset+=n,i.length=r)},i._allocateBuffer=function(){$(this._buffers.length===this._freeLists.length,9003);var t=new pF,e=this._vCount*this._floatsPerVertex;t.initialize(this._device,this._attributes,e,this._iCount),this._buffers.push(t);var i=gF.alloc();i.offset=0,i.length=t.vData.byteLength;var n=[i];return this._freeLists.push(n),vN.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}(mF);vF.IB_SCALE=4,vF.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"}(cF||(cF={})),function(t){t[t.BufferID=0]="BufferID",t[t.AccessorID=1]="AccessorID",t[t.Count=2]="Count"}(_F||(_F={})),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"}(fF||(fF={})),function(t){t[t.COMP=0]="COMP",t[t.MODEL=1]="MODEL",t[t.MIDDLEWARE=2]="MIDDLEWARE",t[t.SUB_NODE=3]="SUB_NODE"}(dF||(dF={}));var SF,AF,TF=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=dF.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,cF.Count),i+=cF.Count*Uint8Array.BYTES_PER_ELEMENT,this._uint16SharedBuffer=new Uint16Array(e,i,_F.Count),i+=_F.Count*Uint16Array.BYTES_PER_ELEMENT,this._uint32SharedBuffer=new Uint32Array(e,i,fF.Count)}var e=t.prototype;return 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}}]),t}();!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"}(SF||(SF={})),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"}(AF||(AF={}));var EF,bF,xF,CF,RF,wF=t("S",function(){function t(){this._maskStack=[],this._stencilPattern={stencilTest:!0,func:Vl.ALWAYS,stencilMask:65535,writeMask:65535,failOp:Ul.KEEP,zFailOp:Ul.KEEP,passOp:Ul.KEEP,ref:1},this._stage=SF.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!==SF.ENTER_LEVEL?SF.CLEAR_INVERTED:SF.CLEAR},e.enableMask=function(){this.stage=SF.ENABLED},e.exitMask=function(){0!==this._maskStack.length&&(this._maskStack.pop(),0===this._maskStack.length?this.stage=SF.DISABLED:this.stage=SF.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=SF.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=Vl.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 V_(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===SF.DISABLED?(e.stencilTest=!1,e.func=Vl.ALWAYS,e.failOp=Ul.KEEP,e.stencilMask=e.writeMask=65535,e.ref=1):(e.stencilTest=!0,t===SF.ENABLED?(e.func=Vl.EQUAL,e.failOp=Ul.KEEP,e.stencilMask=e.ref=this.getStencilRef(),e.writeMask=this.getWriteMask()):t===SF.CLEAR?(e.func=Vl.NEVER,e.failOp=Ul.ZERO,e.writeMask=e.stencilMask=e.ref=this.getWriteMask()):t===SF.CLEAR_INVERTED||t===SF.ENTER_LEVEL?(e.func=Vl.NEVER,e.failOp=Ul.REPLACE,e.writeMask=e.stencilMask=e.ref=this.getWriteMask()):t===SF.ENTER_LEVEL_INVERTED&&(e.func=Vl.NEVER,e.failOp=Ul.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}());wF.sharedManager=null,wF.sharedManager=new wF,function(t){t[t.STATIC=0]="STATIC",t[t.DYNAMIC=1]="DYNAMIC",t[t.CROSSED=2]="CROSSED"}(EF||(EF={})),function(t){t[t.localOpacity=0]="localOpacity",t[t.count=1]="count"}(bF||(bF={})),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"}(xF||(xF={})),function(t){t[t.colorDirty=0]="colorDirty",t[t.enabled=1]="enabled",t[t.useLocal=2]="useLocal",t[t.count=3]="count"}(CF||(CF={})),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"}(RF||(RF={}));var IF,BF,DF,PF,OF,MF=function(){function t(){this._renderEntityType=EF.STATIC,this._dynamicDrawInfoArr=[],this._node=null,this._renderTransform=null,this._stencilStage=SF.DISABLED,this._useLocal=!1,this._maskMode=RF.NONE,this._color=Zi.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}(),NF=lF(sF)>>2,LF=t("r",function(){function t(t){void 0===t&&(t=sF),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=sF,this._drawInfoType=dF.COMP,this._multiOwner=!1,this._batcher=null,this._floatStride=t===sF?NF:lF(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=dF.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=vN.root.batcher2D),this._batcher}}]),t}()),FF=t("t",function(t){function e(e,i){var n;return void 0===e&&(e=sF),(n=t.call(this,e)||this)._vertDirty=!0,n._textureHash=0,n.indices=null,n.layer=0,n.nodeDirty=!0,n.passDirty=!0,n.textureDirty=!0,n.hashDirty=!0,n._data=[],n._pivotX=0,n._pivotY=0,n._width=0,n._height=0,n._frame=null,n._accessor=null,n.vertexRow=1,n.vertexCol=1,i||(i=n.batcher.switchBufferAccessor(n._vertexFormat)),n._accessor=i,n}s(e,t),e.add=function(t,i){void 0===t&&(t=sF);var n=new e(t,i);return i||(i=vN.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=fl(t,666),this.hashDirty=!1},i.updateRenderData=function(t,e){if(this.passDirty&&(this.material=t.getRenderMaterial(0),this.passDirty=!1,this.hashDirty=!0,this._renderDrawInfo&&this._renderDrawInfo.setMaterial(this.material)),this.nodeDirty){var i=t.node.scene?t._getRenderScene():null;this.layer=t.node.layer,null!==i&&(this.nodeDirty=!1),this.hashDirty=!0}this.textureDirty&&(this.frame=e,this.textureHash=e.getHash(),this.textureDirty=!1,this.hashDirty=!0,this._renderDrawInfo&&(this._renderDrawInfo.setTexture(this.frame?this.frame.getGFXTexture():null),this._renderDrawInfo.setSampler(this.frame?this.frame.getGFXSampler():null))),this.hashDirty&&(this.updateHash(),this._renderDrawInfo&&this._renderDrawInfo.setDataHash(this.dataHash))},i.updateSizeNPivot=function(t,e,i,n){t===this._width&&e===this._height&&i===this._pivotX&&n===this._pivotY||(this._width=t,this._height=e,this._pivotX=i,this._pivotY=n,this.vertDirty=!0)},i.clear=function(){this.resize(0,0),this._data.length=0,this._pivotX=0,this._pivotY=0,this._width=0,this._height=0,this.indices=null,this.vertDirty=!0,this.material=null,this.nodeDirty=!0,this.passDirty=!0,this.textureDirty=!0,this.hashDirty=!0,this.layer=0,this.frame=null,this.textureHash=0,this.dataHash=0},e.createStaticVBAccessor=function(t,e,i){var n=vN.root.device;return new vF(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:Zi.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}(LF)),kF=t("u",function(t){function e(e){var i;return void 0===e&&(e=sF),(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=sF);var i=new e;return i._floatStride=t===sF?NF:lF(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 wc(wl.VERTEX|wl.TRANSFER_DST,Dl.DEVICE,i,i)));var r=Uint16Array.BYTES_PER_ELEMENT;this._indexBuffer||(this._indexBuffer=t.createBuffer(new wc(wl.INDEX|wl.TRANSFER_DST,Dl.DEVICE,r,r))),this._iaInfo=new Yc(this._vertexFormat,n,this._indexBuffer),this._iaPool=new fu((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}(LF));new fu((function(){return new kF}),32);var GF,VF,UF,zF,HF,WF,XF=new yn,jF=new yn,YF=new Yi,qF=new fn,KF=new fn,JF=new fn,QF=new fn(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),ZF=new En,$F=t("d",Is("cc.UITransform")(IF=Ds(110)(IF=Ps(((OF=function(t){function e(){for(var e,i=arguments.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=DF&&DF(),e._anchorPoint=PF&&PF(),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(zp.PARENT_CHANGED,this._parentChanged,this),this._markRenderDataDirty()},i.onDisable=function(){this.node.off(zp.PARENT_CHANGED,this._parentChanged,this)},i.onDestroy=function(){this.node._uiProps.uiTransformComp=null},i.setContentSize=function(t,e){var i,n,r=this._contentSize;if(void 0===e){if(Ei((t=t).width,r.width,Ai)&&Ei(t.height,r.height,Ai))return;i=t.width,n=t.height}else{if(Ei(t=t,r.width,Ai)&&Ei(e,r.height,Ai))return;i=t,n=e}r.width=i,r.height=n,this.node.emit(zp.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(zp.ANCHOR_CHANGED,this._anchorPoint),this._markRenderDataDirty()},i.isHit=function(t){for(var e=this._contentSize.width,i=this._contentSize.height,n=XF,r=jF,s=this._getRenderScene().cameras,a=0;a<s.length;a++){var o=s[a];if(o.visibility&this.node.layer){o.node.getWorldRT(qF);var h=qF.m12,u=qF.m13,l=ll.center;if(qF.m12=l.x-(qF.m00*h+qF.m04*u),qF.m13=l.y-(qF.m01*h+qF.m05*u),fn.invert(qF,qF),yn.transformMat4(n,t,qF),this.node.getWorldMatrix(JF),fn.invert(qF,JF),!fn.strictEquals(qF,QF)){yn.transformMat4(r,n,qF),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=YF,s=XF,a=jF,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&&(Yi.set(r,t.x,t.y,0),u.screenToWorld(r,r),yn.set(s,r.x,r.y),this.node.getWorldMatrix(JF),fn.invert(qF,JF),!fn.strictEquals(qF,QF))){yn.transformMat4(a,s,qF),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(JF),fn.invert(qF,JF),e||(e=new Yi),Yi.transformMat4(e,t,qF)},i.convertToWorldSpaceAR=function(t,e){return this.node.getWorldMatrix(JF),e||(e=new Yi),Yi.transformMat4(e,t,JF)},i.getBoundingBox=function(){var t=new En;return this._selfBoundingBox(t),fn.fromSRT(KF,this.node.rotation,this.node.position,this.node.scale),t.transformMat4(KF),t},i.getBoundingBoxToWorld=function(){for(var t=new En,i=this.node.children,n=0;n<i.length;++n){var r=i[n];if(r&&r.active){var s=r.getComponent(e);s&&s.contentSize.width&&s.contentSize.height&&(s._selfBoundingBox(ZF),ZF.transformMat4(r.worldMatrix),0===t.width?t.set(ZF):En.union(t,t,ZF))}}return this._contentSize.width&&this._contentSize.height&&(this._selfBoundingBox(ZF),ZF.transformMat4(this.node.worldMatrix),0===t.width?t.set(ZF):En.union(t,t,ZF)),t},i.getBoundingBoxTo=function(t){var i=new En,n=this.node.children;fn.invert(qF,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(ZF),fn.multiply(KF,s.worldMatrix,qF),ZF.transformMat4(KF),0===i.width?i.set(ZF):En.union(i,i,ZF))}}return this._contentSize.width&&this._contentSize.height&&(this._selfBoundingBox(ZF),fn.multiply(KF,this.node.worldMatrix,qF),ZF.transformMat4(KF),0===i.width?i.set(ZF):En.union(i,i,ZF)),i},i.getComputeAABB=function(t){var e=this._contentSize.width,i=this._contentSize.height;ZF.set(-this._anchorPoint.x*e,-this._anchorPoint.y*i,e,i),ZF.transformMat4(this.node.worldMatrix);var n=ZF.x+.5*ZF.width,r=ZF.y+.5*ZF.height,s=this.node.worldPosition.z,a=ZF.width/2,o=ZF.height/2;return null!=t?(is.set(t,n,r,s,a,o,.001),t):new is(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(zp.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(zp.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(zp.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(zp.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(zp.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(zp.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=vN.root.batcher2D.getFirstRenderCamera(this.node);return t?t.visibility:0}},{key:"cameraPriority",get:function(){var t=vN.root.batcher2D.getFirstRenderCamera(this.node);return t?t.priority:0}}]),e}(Vd)).EventType=zp,OF.priorityChangeNodeMap=new Map,DF=Ss((BF=OF).prototype,"_contentSize",[ks],(function(){return new An(100,100)})),PF=Ss(BF.prototype,"_anchorPoint",[ks],(function(){return new yn(.5,.5)})),IF=BF))||IF)||IF)||IF);vN.on(yN.EVENT_AFTER_UPDATE,$F._sortSiblings),vN.on(yN.EVENT_BEFORE_SCENE_LAUNCH,$F._cleanChangeMap);var tk,ek,ik,nk,rk,sk,ak,ok,hk,uk,lk,ck,_k,fk={parent:null,owner:null,subModelIdx:0},dk=Ps,pk=ha,mk=t("dA",(GF=Is("cc.Renderer"),VF=pk(KS),UF=pk([KS]),GF(zF=dk((p((HF=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._materials=WF&&WF(),e._materialInstances=[],e}s(e,t);var i=e.prototype;return i.getMaterial=function(t){return this.getSharedMaterial(t)},i.getSharedMaterial=function(t){return t<0||t>=this._materials.length?null:this._materials[t]},i.setMaterial=function(t,e){t&&t instanceof rA&&console.error("Can't set a material instance to a sharedMaterial slot"),this._materials[e]=t;var i=this._materialInstances[e];i&&(i.destroy(),this._materialInstances[e]=null),this._onMaterialModified(e,this._materials[e])},i.getMaterialInstance=function(t){if(!this._materials[t])return null;if(!this._materialInstances[t]){fk.parent=this._materials[t],fk.owner=this,fk.subModelIdx=t;var e=new rA(fk);fk.parent=null,fk.owner=null,fk.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.setMaterial(t,e)},i.getRenderMaterial=function(t){return this._materialInstances[t]||this._materials[t]},i._onMaterialModified=function(){},i._onRebuildPSO=function(){},i._clearMaterials=function(){},n(e,[{key:"sharedMaterial",get:function(){return this.getSharedMaterial(0)}},{key:"sharedMaterials",get:function(){return this._materials},set:function(t){for(var e=0;e<t.length;e++)t[e]!==this._materials[e]&&this.setMaterial(t[e],e);if(t.length<this._materials.length){for(var i=t.length;i<this._materials.length;i++)this.setMaterial(null,i);this._materials.splice(t.length)}}},{key:"material",get:function(){return this.getMaterialInstance(0)},set:function(t){(1!==this._materials.length||this._materialInstances[0]||this._materials[0]!==t)&&this.setMaterialInstance(t,0)}},{key:"materials",get:function(){for(var t=0;t<this._materials.length;t++)this._materialInstances[t]=this.getMaterialInstance(t);return this._materialInstances},set:function(t){for(var e=t.length,i=this._materials.length,n=e;n<i;n++)this.setMaterialInstance(null,n);this._materials.length=e,this._materialInstances.length=e;for(var r=0;r<e;r++)this._materialInstances[r]!=t[r]&&this.setMaterialInstance(t[r],r)}}]),e}(Vd)).prototype,"sharedMaterials",[VF],Object.getOwnPropertyDescriptor(HF.prototype,"sharedMaterials"),HF.prototype),WF=Ss(HF.prototype,"_materials",[UF],(function(){return[]})),zF=HF))||zF)||zF));ve(zl),ve(Hl),ve(Wl),t("I",_k),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"}(_k||t("I",_k={}));var gk=t("c",(tk=Is("cc.UIRenderer"),ek=Bs($F),ik=ha(KS),nk=ha(KS),tk(rk=ek(((ck=function(t){function e(){var e;return(e=t.call(this)||this)._renderData=null,e._materials=ak&&ak(),e._customMaterial=ok&&ok(),e._srcBlendFactor=hk&&hk(),e._dstBlendFactor=uk&&uk(),e._color=lk&&lk(),e._stencilStage=SF.DISABLED,e._assembler=null,e._postAssembler=null,e._renderDataFlag=!0,e._renderFlag=!0,e._renderEntity=void 0,e._instanceMaterialType=-1,e._srcBlendFactorCache=zl.SRC_ALPHA,e._dstBlendFactorCache=zl.ONE_MINUS_SRC_ALPHA,e._dirtyVersion=-1,e._internalId=-1,e._useVertexOpacity=!1,e._lastParent=null,e._renderEntity=e.createRenderEntity(),e}s(e,t);var i=e.prototype;return i.setRenderData=function(t){this._renderData=t},i.onLoad=function(){this._renderEntity.setNode(this.node)},i.__preload=function(){this.node._uiProps.uiComp=this,this._flushAssembler&&this._flushAssembler()},i.onEnable=function(){this.node.on(zp.ANCHOR_CHANGED,this._nodeStateChange,this),this.node.on(zp.SIZE_CHANGED,this._nodeStateChange,this),this.node.on(zp.PARENT_CHANGED,this._colorDirty,this),this.updateMaterial(),this._colorDirty(),hN.addRenderer(this),this.markForUpdateRenderData()},i.onRestore=function(){this.updateMaterial(),this.markForUpdateRenderData()},i.onDisable=function(){this.node.off(zp.ANCHOR_CHANGED,this._nodeStateChange,this),this.node.off(zp.SIZE_CHANGED,this._nodeStateChange,this),this.node.off(zp.PARENT_CHANGED,this._colorDirty,this),hN.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),hN.markDirtyRenderer(this)}},i.requestRenderData=function(t){void 0===t&&(t=dF.COMP);var e=FF.add();return e.initRenderDrawInfo(this,t),this._renderData=e,e},i.destroyRenderData=function(){this._renderData&&(this._renderData.removeRenderDrawInfo(this),FF.remove(this._renderData),this._renderData=null)},i.updateRenderer=function(){this._assembler&&this._assembler.updateRenderData(this),this._renderFlag=this._canRender(),this._renderEntity.enabled=this._renderFlag},i.fillBuffers=function(t){this._renderFlag&&this._render(t)},i.postUpdateAssembler=function(t){this._postAssembler&&this._renderFlag&&this._postRender(t)},i._render=function(){},i._postRender=function(){},i._canRender=function(){return null!==this.getSharedMaterial(0)&&this._enabled&&this._color.a>0},i._postCanRender=function(){},i.updateMaterial=function(){if(this._customMaterial)this.getSharedMaterial(0)!==this._customMaterial&&this.setMaterial(this._customMaterial,0);else{var t=this._updateBuiltinMaterial();this.setMaterial(t,0),this.stencilStage!==SF.ENTER_LEVEL&&this.stencilStage!==SF.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=zl.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 _k.ADD_COLOR:t=xS.get("ui-base-material");break;case _k.GRAYSCALE:t=xS.get("ui-sprite-gray-material");break;case _k.USE_ALPHA_SEPARATED:t=xS.get("ui-sprite-alpha-sep-material");break;case _k.USE_ALPHA_SEPARATED_AND_GRAY:t=xS.get("ui-sprite-gray-alpha-sep-material");break;default:t=xS.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 MF(EF.STATIC)},n(e,[{key:"sharedMaterials",get:function(){return this._materials},set:function(t){for(var e=0;e<t.length;e++)t[e]!==this._materials[e]&&this.setMaterial(t[e],e);if(t.length<this._materials.length){for(var i=t.length;i<this._materials.length;i++)this.setMaterial(null,i);this._materials.splice(t.length)}}},{key:"customMaterial",get:function(){return this._customMaterial},set:function(t){this._customMaterial=t,this.updateMaterial()}},{key:"color",get:function(){return this._color},set:function(t){this._color.equals(t)||(this._color.set(t),this._updateColor())}},{key:"renderData",get:function(){return this._renderData}},{key:"useVertexOpacity",get:function(){return this._useVertexOpacity}},{key:"stencilStage",get:function(){return this._stencilStage},set:function(t){this._stencilStage=t,this._renderEntity.setStencilStage(t)}},{key:"srcBlendFactor",get:function(){return this._srcBlendFactor},set:function(t){this._srcBlendFactor=t}},{key:"batcher",get:function(){return vN.root.batcher2D}},{key:"renderEntity",get:function(){return this._renderEntity}}]),e}(mk)).BlendState=zl,ck.Assembler=null,ck.PostAssembler=null,p((sk=ck).prototype,"sharedMaterials",[ua],Object.getOwnPropertyDescriptor(sk.prototype,"sharedMaterials"),sk.prototype),p(sk.prototype,"customMaterial",[ik],Object.getOwnPropertyDescriptor(sk.prototype,"customMaterial"),sk.prototype),ak=Ss(sk.prototype,"_materials",[ua],(function(){return[]})),ok=Ss(sk.prototype,"_customMaterial",[nk],(function(){return null})),hk=Ss(sk.prototype,"_srcBlendFactor",[ks],(function(){return zl.SRC_ALPHA})),uk=Ss(sk.prototype,"_dstBlendFactor",[ks],(function(){return zl.ONE_MINUS_SRC_ALPHA})),lk=Ss(sk.prototype,"_color",[ks],(function(){return Zi.WHITE.clone()})),rk=sk))||rk)||rk));v.internal.UIRenderer=gk;var yk,vk,Sk,Ak,Tk,Ek,bk,xk,Ck,Rk,wk,Ik,Bk,Dk,Pk,Ok,Mk,Nk,Lk,Fk,kk,Gk,Vk,Uk,zk,Hk,Wk,Xk,jk,Yk,qk,Kk=function(){function t(){this.isBold=!1,this.isItalic=!1,this.isUnderline=!1,this.underlineHeight=1,this.isOutlined=!1,this.outlineColor=Zi.WHITE.clone(),this.outlineWidth=1,this.hasShadow=!1,this.shadowColor=Zi.BLACK.clone(),this.shadowBlur=2,this.shadowOffsetX=0,this.shadowOffsetY=0,this.color=Zi.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}(),Jk=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 An,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}(),Qk=function(){function t(){this.parsedString=[],this.nodeContentSize=An.ZERO.clone(),this.canvasSize=new An,this.canvasPadding=new En,this.contentSizeExtend=An.ZERO.clone(),this.startPosition=yn.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}(),Zk=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}();Zi.WHITE.clone(),t("H",Xk),function(t){t[t.LEFT=0]="LEFT",t[t.CENTER=1]="CENTER",t[t.RIGHT=2]="RIGHT"}(Xk||t("H",Xk={})),ve(Xk),t("V",jk),function(t){t[t.TOP=0]="TOP",t[t.CENTER=1]="CENTER",t[t.BOTTOM=2]="BOTTOM"}(jk||t("V",jk={})),ve(jk),t("O",Yk),function(t){t[t.NONE=0]="NONE",t[t.CLAMP=1]="CLAMP",t[t.SHRINK=2]="SHRINK",t[t.RESIZE_HEIGHT=3]="RESIZE_HEIGHT"}(Yk||t("O",Yk={})),ve(Yk),t("p",qk),function(t){t[t.NONE=0]="NONE",t[t.BITMAP=1]="BITMAP",t[t.CHAR=2]="CHAR"}(qk||t("p",qk={})),ve(qk);var $k=t("q",(yk=Is("cc.Label"),vk=Ds(110),Sk=ha(Xk),Ak=ha(jk),Tk=ha(Yk),Ek=ha(mL),bk=ha(qk),yk(xk=vk(((Wk=function(t){function e(){var e;return(e=t.call(this)||this)._string=Rk&&Rk(),e._horizontalAlign=wk&&wk(),e._verticalAlign=Ik&&Ik(),e._actualFontSize=Bk&&Bk(),e._fontSize=Dk&&Dk(),e._fontFamily=Pk&&Pk(),e._lineHeight=Ok&&Ok(),e._overflow=Mk&&Mk(),e._enableWrapText=Nk&&Nk(),e._font=Lk&&Lk(),e._isSystemFontUsed=Fk&&Fk(),e._spacingX=kk&&kk(),e._isItalic=Gk&&Gk(),e._isBold=Vk&&Vk(),e._isUnderline=Uk&&Uk(),e._underlineHeight=zk&&zk(),e._cacheMode=Hk&&Hk(),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 Kk,e._textLayout=new Jk,e._textLayoutData=new Qk,e._textRenderData=new Zk,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 IL){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 IL){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===qk.CHAR)this._letterTexture=this._assembler.getAssemblerData(),this._texture=this._letterTexture;else if(!this._ttfSpriteFrame){this._ttfSpriteFrame=new lL,this._assemblerData=this._assembler.getAssemblerData();var i=new ld(this._assemblerData.canvas),n=new Mp;n.image=i,this._ttfSpriteFrame.texture=n}this.cacheMode!==qk.CHAR&&(this._texture=this._ttfSpriteFrame),this.changeMaterialForDefine()}},i.changeMaterialForDefine=function(){if(this._texture){var t=!1;if(this.cacheMode!==qk.CHAR){var e=this._texture.texture;if(e instanceof pd){var i=e.getPixelFormat();t=i===Hf.RGBA_ETC1||i===Hf.RGB_A_PVRTC_4BPPV1||i===Hf.RGB_A_PVRTC_2BPPV1}}this._instanceMaterialType=t?_k.USE_ALPHA_SEPARATED:_k.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!==qk.BITMAP||this._font instanceof IL||!this._ttfSpriteFrame||this._ttfSpriteFrame._resetDynamicAtlasFrame(),this._cacheMode===qk.CHAR&&(this._ttfSpriteFrame=null),this._cacheMode=t,this.updateRenderData(!0))}},{key:"isBold",get:function(){return this._isBold},set:function(t){this._isBold!==t&&(this._isBold=t,this.markForUpdateRenderData())}},{key:"isItalic",get:function(){return this._isItalic},set:function(t){this._isItalic!==t&&(this._isItalic=t,this.markForUpdateRenderData())}},{key:"isUnderline",get:function(){return this._isUnderline},set:function(t){this._isUnderline!==t&&(this._isUnderline=t,this.markForUpdateRenderData())}},{key:"underlineHeight",get:function(){return this._underlineHeight},set:function(t){this._underlineHeight!==t&&(this._underlineHeight=t,this.markForUpdateRenderData())}},{key:"spriteFrame",get:function(){return this._texture}},{key:"ttfSpriteFrame",get:function(){return this._ttfSpriteFrame}},{key:"assemblerData",get:function(){return this._assemblerData}},{key:"fontAtlas",get:function(){return this._fontAtlas},set:function(t){this._fontAtlas=t}},{key:"_bmFontOriginalSize",get:function(){return this._font instanceof IL?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}(gk)).HorizontalAlign=Xk,Wk.VerticalAlign=jk,Wk.Overflow=Yk,Wk.CacheMode=qk,Wk._canvasPool=KL.getInstance(),p((Ck=Wk).prototype,"horizontalAlign",[Sk],Object.getOwnPropertyDescriptor(Ck.prototype,"horizontalAlign"),Ck.prototype),p(Ck.prototype,"verticalAlign",[Ak],Object.getOwnPropertyDescriptor(Ck.prototype,"verticalAlign"),Ck.prototype),p(Ck.prototype,"overflow",[Tk],Object.getOwnPropertyDescriptor(Ck.prototype,"overflow"),Ck.prototype),p(Ck.prototype,"font",[Ek],Object.getOwnPropertyDescriptor(Ck.prototype,"font"),Ck.prototype),p(Ck.prototype,"cacheMode",[bk],Object.getOwnPropertyDescriptor(Ck.prototype,"cacheMode"),Ck.prototype),Rk=Ss(Ck.prototype,"_string",[ks],(function(){return"label"})),wk=Ss(Ck.prototype,"_horizontalAlign",[ks],(function(){return Xk.CENTER})),Ik=Ss(Ck.prototype,"_verticalAlign",[ks],(function(){return jk.CENTER})),Bk=Ss(Ck.prototype,"_actualFontSize",[ks],(function(){return 0})),Dk=Ss(Ck.prototype,"_fontSize",[ks],(function(){return 40})),Pk=Ss(Ck.prototype,"_fontFamily",[ks],(function(){return"Arial"})),Ok=Ss(Ck.prototype,"_lineHeight",[ks],(function(){return 40})),Mk=Ss(Ck.prototype,"_overflow",[ks],(function(){return Yk.NONE})),Nk=Ss(Ck.prototype,"_enableWrapText",[ks],(function(){return!0})),Lk=Ss(Ck.prototype,"_font",[ks],(function(){return null})),Fk=Ss(Ck.prototype,"_isSystemFontUsed",[ks],(function(){return!0})),kk=Ss(Ck.prototype,"_spacingX",[ks],(function(){return 0})),Gk=Ss(Ck.prototype,"_isItalic",[ks],(function(){return!1})),Vk=Ss(Ck.prototype,"_isBold",[ks],(function(){return!1})),Uk=Ss(Ck.prototype,"_isUnderline",[ks],(function(){return!1})),zk=Ss(Ck.prototype,"_underlineHeight",[ks],(function(){return 2})),Hk=Ss(Ck.prototype,"_cacheMode",[ks],(function(){return qk.NONE})),xk=Ck))||xk)||xk));v.Label=$k;var tG,eG,iG=0,nG={};function rG(t){return--t,t|=t>>16,t|=t>>8,t|=t>>4,t|=t>>2,t|=t>>1,++t}function sG(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"}(tG||(tG={})),function(t){t[t.DEFAULT=1]="DEFAULT",t[t.FORWARD=2]="FORWARD",t[t.SHADOWCAST=4]="SHADOWCAST"}(eG||(eG={}));var aG,oG,hG,uG,lG,cG,_G,fG,dG,pG=function(){function t(t){this._device=void 0,this._format=xl.UNKNOWN,this._formatSize=0,this._chunks=[],this._chunkCount=0,this._handles=[],this._region0=new Tc,this._region1=new Tc,this._region2=new Tc,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=m_[t.format];this._format=t.format,this._formatSize=e.size,this._channels=e.count,this._bufferViewCtor=x_(e),this._roundUpFn=t.roundUpFn||null,this._alignment=t.alignment||1,t.inOrderFree&&(this.alloc=this._McDonaldAlloc)},e.destroy=function(){for(var t=0;t<this._chunkCount;++t)this._chunks[t].texture.destroy();this._chunks.length=0,this._handles.length=0},e.alloc=function(t,e){t=sG(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,rG(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;U("TextureBufferPool: Allocate chunk "+this._chunkCount+", size: "+e+", format: "+this._format);var i={texture:this._device.createTexture(new Oc(Pl.TEX2D,Ol.SAMPLED|Ol.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=sG(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,rG(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}(),mG=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"}(dG||(dG={}));var gG,yG,vG=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 mG(t,r,this._stride);var s=dG.NEVER,a=!1,o=!1;for(var h in e){if(a=this._hasFloat32,(o=this._hasUint32)&&a)break;s=e[h],a||s!==dG.FLOAT32?o||s!==dG.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]===dG.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"}(gG||(gG={})),function(t){t[t.POSITION=0]="POSITION",t[t.UV=3]="UV",t[t.COLOR=5]="COLOR",t[t.COUNT=9]="COUNT"}(yG||(yG={}));var SG,AG=((aG={})[yG.POSITION]=dG.FLOAT32,aG[yG.UV]=dG.FLOAT32,aG[yG.COLOR]=dG.UINT32,aG[yG.COUNT]=dG.NEVER,aG),TG=((oG={})[yG.POSITION]=yG.UV-yG.POSITION,oG[yG.UV]=yG.COLOR-yG.UV,oG[yG.COLOR]=yG.COUNT-yG.COLOR,oG[yG.COUNT]=1,oG),EG=new vG(gG.RENDER2D,AG,TG,yG);!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"}(SG||(SG={}));var bG,xG=((hG={})[SG.DIRTY_FLAG]=dG.UINT32,hG[SG.LAYER]=dG.UINT32,hG[SG.WORLD_SCALE]=dG.FLOAT32,hG[SG.WORLD_POSITION]=dG.FLOAT32,hG[SG.WORLD_ROTATION]=dG.FLOAT32,hG[SG.WORLD_MATRIX]=dG.FLOAT32,hG[SG.LOCAL_SCALE]=dG.FLOAT32,hG[SG.LOCAL_POSITION]=dG.FLOAT32,hG[SG.LOCAL_ROTATION]=dG.FLOAT32,hG[SG.COUNT]=dG.NEVER,hG),CG=((uG={})[SG.DIRTY_FLAG]=SG.LAYER-SG.DIRTY_FLAG,uG[SG.LAYER]=SG.WORLD_SCALE-SG.LAYER,uG[SG.WORLD_SCALE]=SG.WORLD_POSITION-SG.WORLD_SCALE,uG[SG.WORLD_POSITION]=SG.WORLD_ROTATION-SG.WORLD_POSITION,uG[SG.WORLD_ROTATION]=SG.WORLD_MATRIX-SG.WORLD_ROTATION,uG[SG.WORLD_MATRIX]=SG.LOCAL_SCALE-SG.WORLD_MATRIX,uG[SG.LOCAL_SCALE]=SG.LOCAL_POSITION-SG.LOCAL_SCALE,uG[SG.LOCAL_POSITION]=SG.LOCAL_ROTATION-SG.LOCAL_POSITION,uG[SG.LOCAL_ROTATION]=SG.COUNT-SG.LOCAL_ROTATION,uG[SG.COUNT]=1,uG),RG=new vG(gG.NODE,xG,CG,SG);!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"}(bG||(bG={}));var wG,IG=((lG={})[bG.PRIORITY]=dG.UINT32,lG[bG.STAGE]=dG.UINT32,lG[bG.PHASE]=dG.UINT32,lG[bG.PRIMITIVE]=dG.UINT32,lG[bG.BATCHING_SCHEME]=dG.UINT32,lG[bG.DYNAMIC_STATE]=dG.UINT32,lG[bG.HASH]=dG.UINT32,lG[bG.COUNT]=dG.NEVER,lG),BG=((cG={})[bG.PRIORITY]=bG.STAGE-bG.PRIORITY,cG[bG.STAGE]=bG.PHASE-bG.STAGE,cG[bG.PHASE]=bG.PRIMITIVE-bG.PHASE,cG[bG.PRIMITIVE]=bG.BATCHING_SCHEME-bG.PRIMITIVE,cG[bG.BATCHING_SCHEME]=bG.DYNAMIC_STATE-bG.BATCHING_SCHEME,cG[bG.DYNAMIC_STATE]=bG.HASH-bG.DYNAMIC_STATE,cG[bG.HASH]=bG.COUNT-bG.HASH,cG[bG.COUNT]=1,cG),DG=new vG(gG.PASS,IG,BG,bG);!function(t){t[t.CENTER=0]="CENTER",t[t.HALFEXTENTS=3]="HALFEXTENTS",t[t.COUNT=6]="COUNT"}(wG||(wG={}));var PG=((_G={})[wG.CENTER]=dG.FLOAT32,_G[wG.HALFEXTENTS]=dG.FLOAT32,_G[wG.COUNT]=dG.NEVER,_G),OG=((fG={})[wG.CENTER]=wG.HALFEXTENTS-wG.CENTER,fG[wG.HALFEXTENTS]=wG.COUNT-wG.HALFEXTENTS,fG[wG.COUNT]=1,fG),MG=new vG(gG.AABB,PG,OG,wG);rt(JO.prototype,"RenderScene.prototype",[{name:"raycastUI2DNode"},{name:"raycastUINode"}]),rt(JO.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"}]),rt(wR.prototype,"Model.prototype",[{name:"isInstancingEnabled"},{name:"instancedAttributes"}]);var NG={};rt(NG,"CameraVisFlags",[{name:"GENERAL"}]),nt(NG,"CameraVisFlags",[{name:"PROFILER",newName:"PROFILER",target:kp.BitMask,targetName:"PROFILER"},{name:"GIZMOS",newName:"GIZMOS",target:kp.BitMask,targetName:"GIZMOS"},{name:"EDITOR",newName:"EDITOR",target:kp.BitMask,targetName:"EDITOR"},{name:"UI",newName:"UI",target:kp.BitMask,targetName:"UI_3D"},{name:"UI2D",newName:"UI2D",target:kp.BitMask,targetName:"UI_2D"}]),v.CameraVisFlags=NG;var LG={};rt(LG,"VisibilityFlags",[{name:"GENERAL"}]),nt(LG,"VisibilityFlags",[{name:"ALWALS",newName:"ALWALS",target:kp.Enum,targetName:"ALWALS"},{name:"PROFILER",newName:"PROFILER",target:kp.Enum,targetName:"PROFILER"},{name:"GIZMOS",newName:"GIZMOS",target:kp.Enum,targetName:"GIZMOS"},{name:"EDITOR",newName:"EDITOR",target:kp.Enum,targetName:"EDITOR"},{name:"UI",newName:"UI",target:kp.Enum,targetName:"UI_3D"},{name:"UI2D",newName:"UI2D",target:kp.Enum,targetName:"UI_2D"}]),v.VisibilityFlags=LG,nt(DS.prototype,"Pass.prototype",[{name:"getBindingTypeFromHandle",newName:"getDescriptorTypeFromHandle"}]),rt(JC.prototype,"Camera.prototype",[{name:"getSplitFrustum"},{name:"setMatView"},{name:"setMatViewInv"},{name:"setMatProjInv"},{name:"setMatViewProjInv"},{name:"setMatProj"},{name:"setMatViewProj"},{name:"getMatViewInv"}]),rt(iA.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"}]),rt(iw.prototype,"SpotLight.prototype",[{name:"aspect"}]),nt(oR.prototype,"SubModel.prototype",[{name:"subMeshData",newName:"subMesh"}]),rt(oR.prototype,"SubModel.prototype",[{name:"getSubModel",suggest:"Use `subModels[i]` instead"},{name:"subModelNum",suggest:"Use `subModels.length` instead"}]);var FG,kG,GG,VG=function(t){if(void 0===nG[t]){var e=1<<iG;nG[t]=e,iG+=1}},UG=Object.freeze({__proto__:null,addStage:VG,scene:hw,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 Xc(cc.ATTR_POSITION,xl.RGB32F)),e.normals&&s.push(new Xc(cc.ATTR_NORMAL,xl.RGB32F)),e.uvs&&s.push(new Xc(cc.ATTR_TEX_COORD,xl.RG32F)),e.colors&&s.push(new Xc(cc.ATTR_COLOR,xl.RGB32F));var a=t.createBuffer(new wc(wl.VERTEX|wl.TRANSFER_DST,Dl.DEVICE,4*i.length,4*i.length/n));a.update(new Float32Array(i));var o=null;return e.indices&&(o=t.createBuffer(new wc(wl.INDEX|wl.TRANSFER_DST,Dl.DEVICE,2*e.indices.length,2))).update(new Uint16Array(e.indices)),t.createInputAssembler(new Yc(s,[a],o))},programLib:$y,getDeviceShaderVersion:Xy,get RenderQueue(){return tG},get PassStage(){return eG},genHandle:xy,getTypeFromHandle:Cy,getBindingFromHandle:Ry,getCountFromHandle:wy,getOffsetFromHandle:Iy,customizeType:By,type2reader:Dy,type2writer:Py,type2validator:Oy,getDefaultFromType:Ny,getStringFromType:Ly,overrideMacros:Fy,get BatchingSchemes(){return ES},Pass:DS,nearestPOT:rG,TextureBufferPool:pG,MaterialInstance:rA,PassInstance:nA,get PoolType(){return gG},NULL_HANDLE:0,get Render2dView(){return yG},Render2dPool:EG,get NodeView(){return SG},NodePool:RG,get PassView(){return bG},PassPool:DG,get AABBView(){return wG},AABBPool:MG,RenderScene:JO,CameraVisFlags:NG,VisibilityFlags:LG});t("aj",UG),function(t){t[t.BUTT=0]="BUTT",t[t.ROUND=1]="ROUND",t[t.SQUARE=2]="SQUARE"}(FG||(FG={})),ve(FG),function(t){t[t.BEVEL=0]="BEVEL",t[t.ROUND=1]="ROUND",t[t.MITER=2]="MITER"}(kG||(kG={})),ve(kG),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"}(GG||(GG={})),ve(GG);var zG=Math.PI,HG=Math.min,WG=Math.max,XG=Math.cos,jG=Math.sin,YG=Math.abs,qG=Math.sign,KG=.5522847493;function JG(t,e,i,n,r){t.moveTo(e-n,i),t.bezierCurveTo(e-n,i+r*KG,e-n*KG,i+r,e,i+r),t.bezierCurveTo(e+n*KG,i+r,e+n,i+r*KG,e+n,i),t.bezierCurveTo(e+n,i-r*KG,e+n*KG,i-r,e,i-r),t.bezierCurveTo(e-n*KG,i-r,e-n,i-r*KG,e-n,i),t.close()}function QG(t,e,i,n,r,s,a,o,h,u,l){var c,_,f,d,p,m,g,y,v,S,A,T,E,b,x,C;u>10||(p=.5*(s+o),m=.5*(a+h),g=.5*((c=.5*(e+n))+(f=.5*(n+s))),y=.5*((_=.5*(i+r))+(d=.5*(r+a))),((x=YG((n-o)*(b=h-i)-(r-h)*(E=o-e)))+(C=YG((s-o)*b-(a-h)*E)))*(x+C)<t.tessTol*(E*E+b*b)?t.addPoint(o,h,0===l?l|GG.PT_BEVEL:l):(QG(t,e,i,c,_,g,y,A=.5*(g+(v=.5*(f+p))),T=.5*(y+(S=.5*(d+m))),u+1,0),QG(t,A,T,v,S,p,m,o,h,u+1,l)))}var ZG,$G,tV,eV,iV,nV,rV,sV,aV,oV,hV,uV,lV,cV,_V,fV,dV,pV,mV,gV,yV,vV,SV,AV,TV,EV,bV,xV,CV,RV,wV,IV,BV,DV,PV,OV,MV,NV=function(t){function e(){for(var e,i=arguments.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}(yn),LV=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}(),FV=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=Zi.WHITE.clone(),this.lineCap=FG.BUTT,this.strokeColor=Zi.BLACK.clone(),this.lineJoin=kG.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,GG.PT_CORNER),this._commandX=t,this._commandY=e},e.lineTo=function(t,e){this.addPoint(t,e,GG.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?(QG(this,o.x,o.y,t,e,i,n,r,s,0,GG.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,f=0,d=0,p=0,m=0,g=0,y=0,v=0,S=0,A=0,T=0;if(l=s-r,a=a||!1)if(YG(l)>=2*zG)l=2*zG;else for(;l<0;)l+=2*zG;else if(YG(l)>=2*zG)l=2*-zG;else for(;l>0;)l-=2*zG;for(h=0|WG(1,HG(YG(l)/(.5*zG)+.5,5)),c=YG(4/3*(1-XG(o=l/h/2))/jG(o)),a||(c=-c),T=0;T<=h;T++)d=e+(_=XG(u=r+l*(T/h)))*n,p=i+(f=jG(u))*n,m=-f*n*c,g=_*n*c,0===T?t.moveTo(d,p):t.bezierCurveTo(y+S,v+A,d-m,p-g,d,p),y=d,v=p,S=m,A=g}(this,t,e,i,n,r,s)},e.ellipse=function(t,e,i,n){JG(this,t,e,i,n),this._curPath.complex=!1},e.circle=function(t,e,i){JG(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=HG(s,.5*YG(n))*qG(n),o=HG(s,.5*YG(r))*qG(r);t.moveTo(e,i+o),t.lineTo(e,i+r-o),t.bezierCurveTo(e,i+r-o*(1-KG),e+a*(1-KG),i+r,e+a,i+r),t.lineTo(e+n-a,i+r),t.bezierCurveTo(e+n-a*(1-KG),i+r,e+n,i+r-o*(1-KG),e+n,i+r-o),t.lineTo(e+n,i+o),t.bezierCurveTo(e+n,i+o*(1-KG),e+n-a*(1-KG),i,e+n-a,i),t.lineTo(e+a,i),t.bezierCurveTo(e+a*(1-KG),i,e,i+o*(1-KG),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&&(kF.remove(n),n.removeRenderDrawInfo(this._comp))}this._renderDataList.length=0},e.close=function(){this._curPath.closed=!0},e.requestRenderData=function(){var t=kF.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 NV(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 LV,this.paths.push(e)),this.pathLength++,this._curPath=e,e},t}(),kV=rF.concat([new Xc("a_dist",xl.R32F)]),GV=uF(kV),VV=lF(kV),UV=t("G",(ZG=Is("cc.Graphics"),$G=Ds(110),tV=ha(kG),eV=ha(FG),ZG(iV=$G(((lV=function(t){function e(){var e;return(e=t.call(this)||this).impl=null,e.model=null,e._lineWidth=rV&&rV(),e._strokeColor=sV&&sV(),e._lineJoin=aV&&aV(),e._lineCap=oV&&oV(),e._fillColor=hV&&hV(),e._miterLimit=uV&&uV(),e._isDrawing=!1,e._isNeedUploadData=!0,e._graphicsUseSubMeshes=[],e._instanceMaterialType=_k.ADD_COLOR,e.impl=new FV(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=vN.root.createModel(wR),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&&(vN.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=xS.get("ui-graphics-material"),this.setMaterial(t,0),(t=this.getMaterialInstance(0)).recompileShaders({USE_LOCAL:!0}))},i.activeSubModel=function(t){if(this.model){if(this.model.subModels.length<=t){var e=of.gfxDevice,i=e.createBuffer(new wc(wl.VERTEX|wl.TRANSFER_DST,Dl.DEVICE,65535*VV,VV)),n=e.createBuffer(new wc(wl.INDEX|wl.TRANSFER_DST,Dl.DEVICE,131070*Uint16Array.BYTES_PER_ELEMENT,Uint16Array.BYTES_PER_ELEMENT)),r=new yw([i],kV,Ql.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*GV);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 MF(EF.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}(gk)).LineJoin=kG,lV.LineCap=FG,p((nV=lV).prototype,"lineJoin",[tV],Object.getOwnPropertyDescriptor(nV.prototype,"lineJoin"),nV.prototype),p(nV.prototype,"lineCap",[eV],Object.getOwnPropertyDescriptor(nV.prototype,"lineCap"),nV.prototype),p(nV.prototype,"color",[ua],Object.getOwnPropertyDescriptor(nV.prototype,"color"),nV.prototype),rV=Ss(nV.prototype,"_lineWidth",[ks],(function(){return 1})),sV=Ss(nV.prototype,"_strokeColor",[ks],(function(){return Zi.BLACK.clone()})),aV=Ss(nV.prototype,"_lineJoin",[ks],(function(){return kG.MITER})),oV=Ss(nV.prototype,"_lineCap",[ks],(function(){return FG.BUTT})),hV=Ss(nV.prototype,"_fillColor",[ks],(function(){return Zi.WHITE.clone()})),uV=Ss(nV.prototype,"_miterLimit",[ks],(function(){return 10})),iV=nV))||iV)||iV));v.Graphics=UV,function(t){t[t.SIMPLE=0]="SIMPLE",t[t.SLICED=1]="SLICED",t[t.TILED=2]="TILED",t[t.FILLED=3]="FILLED"}(DV||(DV={})),ve(DV),function(t){t[t.HORIZONTAL=0]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL",t[t.RADIAL=2]="RADIAL"}(PV||(PV={})),ve(PV),function(t){t[t.CUSTOM=0]="CUSTOM",t[t.TRIMMED=1]="TRIMMED",t[t.RAW=2]="RAW"}(OV||(OV={})),ve(OV),function(t){t.SPRITE_FRAME_CHANGED="spriteframe-changed"}(MV||(MV={}));var zV,HV,WV,XV,jV,YV,qV,KV,JV,QV,ZV=t("i",(cV=Is("cc.Sprite"),_V=Ds(110),fV=ha(_L),dV=ha(lL),pV=ha(DV),mV=ha(PV),gV=ha(OV),cV(yV=_V(((BV=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._spriteFrame=SV&&SV(),e._type=AV&&AV(),e._fillType=TV&&TV(),e._sizeMode=EV&&EV(),e._fillCenter=bV&&bV(),e._fillStart=xV&&xV(),e._fillRange=CV&&CV(),e._isTrimmedMode=RV&&RV(),e._useGrayscale=wV&&wV(),e._atlas=IV&&IV(),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===DV.SLICED&&e.on(lL.EVENT_UV_UPDATED,this._updateUVs,this))},i.onDisable=function(){t.prototype.onDisable.call(this),this._spriteFrame&&this._type===DV.SLICED&&this._spriteFrame.off(lL.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 pd){var n=t.getPixelFormat();i=n===Hf.RGBA_ETC1||n===Hf.RGB_A_PVRTC_4BPPV1||n===Hf.RGB_A_PVRTC_2BPPV1}i&&this.grayscale?this._instanceMaterialType=_k.USE_ALPHA_SEPARATED_AND_GRAY:i?this._instanceMaterialType=_k.USE_ALPHA_SEPARATED:this.grayscale?this._instanceMaterialType=_k.GRAYSCALE:this._instanceMaterialType=_k.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 dR){var i=r({SAMPLE_FROM_RT:!0},e.passes[0].defines),n=new KS;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===DV.SLICED?this._spriteFrame.on(lL.EVENT_UV_UPDATED,this._updateUVs,this):this._spriteFrame.off(lL.EVENT_UV_UPDATED,this._updateUVs,this))},i._applySpriteSize=function(){if(this._spriteFrame)if(OV.RAW===this._sizeMode){var t=this._spriteFrame.originalSize;this.node._uiProps.uiTransformComp.setContentSize(t)}else if(OV.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===DV.SLICED&&t.off(lL.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===DV.SLICED&&e.on(lL.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===PV.RADIAL||this._fillType===PV.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===DV.FILLED&&this.renderData&&this.markForUpdateRenderData()}},{key:"fillStart",get:function(){return this._fillStart},set:function(t){this._fillStart=bi(t,0,1),this._type===DV.FILLED&&this.renderData&&(this.markForUpdateRenderData(),this._updateUVs())}},{key:"fillRange",get:function(){return this._fillRange},set:function(t){this._fillRange=bi(t,-1,1),this._type===DV.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===DV.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!==OV.CUSTOM&&this._applySpriteSize())}}]),e}(gk)).FillType=PV,BV.Type=DV,BV.SizeMode=OV,BV.EventType=MV,p((vV=BV).prototype,"spriteAtlas",[fV],Object.getOwnPropertyDescriptor(vV.prototype,"spriteAtlas"),vV.prototype),p(vV.prototype,"spriteFrame",[dV],Object.getOwnPropertyDescriptor(vV.prototype,"spriteFrame"),vV.prototype),p(vV.prototype,"type",[pV],Object.getOwnPropertyDescriptor(vV.prototype,"type"),vV.prototype),p(vV.prototype,"fillType",[mV],Object.getOwnPropertyDescriptor(vV.prototype,"fillType"),vV.prototype),p(vV.prototype,"sizeMode",[gV],Object.getOwnPropertyDescriptor(vV.prototype,"sizeMode"),vV.prototype),SV=Ss(vV.prototype,"_spriteFrame",[ks],(function(){return null})),AV=Ss(vV.prototype,"_type",[ks],(function(){return DV.SIMPLE})),TV=Ss(vV.prototype,"_fillType",[ks],(function(){return PV.HORIZONTAL})),EV=Ss(vV.prototype,"_sizeMode",[ks],(function(){return OV.TRIMMED})),bV=Ss(vV.prototype,"_fillCenter",[ks],(function(){return new yn(0,0)})),xV=Ss(vV.prototype,"_fillStart",[ks],(function(){return 0})),CV=Ss(vV.prototype,"_fillRange",[ks],(function(){return 0})),RV=Ss(vV.prototype,"_isTrimmedMode",[ks],(function(){return!0})),wV=Ss(vV.prototype,"_useGrayscale",[ks],(function(){return!1})),IV=Ss(vV.prototype,"_atlas",[ks],(function(){return null})),yV=vV))||yV)||yV));v.Sprite=ZV;var $V,tU=new fn,eU=new yn,iU=new fn,nU=[];!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"}($V||($V={})),ve($V);var rU=t("f",(zV=Is("cc.Mask"),HV=Ds(110),WV=ha($V),zV(XV=HV(((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)._type=YV&&YV(),e._inverted=qV&&qV(),e._segments=KV&&KV(),e._alphaThreshold=JV&&JV(),e._sprite=null,e._graphics=null,e._stencilStage=SF.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(zp.ANCHOR_CHANGED,this._nodeStateChange,this),this.node.on(zp.SIZE_CHANGED,this._nodeStateChange,this)},i.onRestore=function(){this._changeRenderType(),this._updateGraphics()},i.onDisable=function(){this._disableRender(),this.node.off(zp.ANCHOR_CHANGED,this._nodeStateChange,this),this.node.off(zp.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=eU;this.node.getWorldMatrix(tU),fn.invert(iU,tU),yn.transformMat4(s,t,iU);var a=e.anchorPoint;s.x+=a.x*n,s.y+=a.y*r;var o=!1;if(this.type===$V.GRAPHICS_RECT||this.type===$V.GRAPHICS_STENCIL||this.type===$V.SPRITE_STENCIL)o=s.x>=0&&s.y>=0&&s.x<=n&&s.y<=r;else if(this.type===$V.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!==$V.SPRITE_STENCIL?this._createGraphics():this._createSprite()},i._createSprite=function(){if(!this._sprite){var t=this._sprite=this.node.getComponent(ZV);if(!t){var e=this.node;t=this._sprite=e.addComponent(ZV)}t.color=Zi.WHITE.clone(),t.sizeMode=0}this._sprite.stencilStage=this.inverted?SF.ENTER_LEVEL_INVERTED:SF.ENTER_LEVEL,this._sprite.updateMaterial()},i._createGraphics=function(){if(!this._graphics){var t=this._graphics=this.node.getComponent(UV);if(!t){var e=this.node;t=this._graphics=e.addComponent(UV)}t.lineWidth=1;var i=Zi.WHITE.clone();i.a=0,t.fillColor=i}this._graphics.stencilStage=this.inverted?SF.ENTER_LEVEL_INVERTED:SF.ENTER_LEVEL},i._updateGraphics=function(){if(this._graphics&&(this._type===$V.GRAPHICS_RECT||this._type===$V.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===$V.GRAPHICS_RECT)e.rect(a,o,n,r);else if(this._type===$V.GRAPHICS_ELLIPSE){for(var h=function(t,e,i){nU.length=0;for(var n=2*Math.PI/i,r=0;r<i;++r)nU.push(new Yi(e.x*Math.cos(n*r)+t.x,e.y*Math.sin(n*r)+t.y,0));return nU}(new Yi(a+n/2,o+r/2,0),new Yi(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=SF.DISABLED,this.subComp.updateMaterial(),this.node.activeInHierarchy&&(this.subComp.enabled=!1))},i._removeMaskNode=function(){this._sprite&&(this._sprite.destroy(),this._sprite=null),this._graphics&&(this._graphics.destroy(),this._graphics=null)},i.markForUpdateRenderData=function(t){void 0===t&&(t=!0),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!==$V.SPRITE_STENCIL?(this._sprite&&(this.node.removeComponent(ZV),this._sprite._destroyImmediate(),this._sprite=null),this._changeRenderType(),this._updateGraphics()):(this._graphics&&(this._graphics.clear(),this.node.removeComponent(UV),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?SF.ENTER_LEVEL_INVERTED:SF.ENTER_LEVEL}},{key:"segments",get:function(){return this._segments},set:function(t){this._segments!==t&&(this._segments=bi(t,3,1e4),this._updateGraphics())}},{key:"spriteFrame",get:function(){return this._sprite?this._sprite.spriteFrame:null},set:function(t){this._sprite?this._sprite.spriteFrame=t:console.error("please change type to sprite_stencil first")}},{key:"alphaThreshold",get:function(){return this._alphaThreshold},set:function(t){this._alphaThreshold!==t&&(this._alphaThreshold=t,this.type===$V.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}(Vd)).Type=$V,p((jV=QV).prototype,"type",[WV],Object.getOwnPropertyDescriptor(jV.prototype,"type"),jV.prototype),YV=Ss(jV.prototype,"_type",[ks],(function(){return $V.GRAPHICS_RECT})),qV=Ss(jV.prototype,"_inverted",[ks],(function(){return!1})),KV=Ss(jV.prototype,"_segments",[ks],(function(){return 64})),JV=Ss(jV.prototype,"_alphaThreshold",[ks],(function(){return.1})),XV=jV))||XV)||XV));uM._maskComp=rU,v.Mask=rU;var sU,aU,oU,hU,uU,lU,cU,_U,fU,dU,pU=/^(click)(\s)*=|(param)(\s)*=/,mU=/(\s)*src(\s)*=|(\s)*height(\s)*=|(\s)*width(\s)*=|(\s)*align(\s)*=|(\s)*offset(\s)*=|(\s)*click(\s)*=|(\s)*param(\s)*=/,gU=t("y",function(){function t(){this._specialSymbolArray=[],this._stack=[],this._resultObjectArray=[],this._specialSymbolArray.push([/</g,"<"]),this._specialSymbolArray.push([/>/g,">"]),this._specialSymbolArray.push([/&/g,"&"]),this._specialSymbolArray.push([/"/g,'"']),this._specialSymbolArray.push([/'/g,"'"])}var e=t.prototype;return e.parse=function(t){this._resultObjectArray.length=0,this._stack.length=0;for(var e=0,i=t.length;e<i;){var n=t.indexOf(">",e),r=-1;if(n>=0&&(r=t.lastIndexOf("<",n))<e-1&&(r=t.indexOf("<",n+1),n=t.indexOf(">",r+1)),r<0)this._stack.pop(),this._processResult(t.substring(e)),e=i;else{var s=t.substring(e,r),a=t.substring(r+1,n);""===a&&(s=t.substring(e,n+1)),this._processResult(s),-1===n?n=r:"/"===t.charAt(r+1)?this._stack.pop():this._addToStack(a),e=n+1}}return this._resultObjectArray},e._attributeToObject=function(t){t=t.trim();var e={},i=/^(color|size)(\s)*=/.exec(t),n="",r=0,s="";if(i){if(n=i[0],""===(t=t.substring(n.length).trim()))return e;switch(r=t.indexOf(" "),n[0]){case"c":e.color=r>-1?t.substring(0,r).trim():t;break;case"s":e.size=parseInt(t)}return r>-1&&(s=t.substring(r+1).trim(),e.event=this._processEventHandler(s)),e}if((i=/^(br(\s)*\/)/.exec(t))&&i[0].length>0&&(n=i[0].trim()).startsWith("br")&&"/"===n[n.length-1])return e.isNewLine=!0,this._resultObjectArray.push({text:"",style:{isNewLine:!0}}),e;var a="",o=-1;if((i=/^(img(\s)*src(\s)*=[^>]+\/)/.exec(t))&&i[0].length>0&&(n=i[0].trim()).startsWith("img")&&"/"===n[n.length-1]){var h;i=mU.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=mU.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 _,f=/(\s)*color(\s)*=|(\s)*width(\s)*=|(\s)*click(\s)*=|(\s)*param(\s)*=/;for(i=f.exec(t);i;)n=(t=t.substring(t.indexOf(i[0]))).substr(0,i[0].length),_=(r=(a=t.substring(n.length).trim()).indexOf(" "))>-1?a.substr(0,r):a,n=(n=n.replace(/[^a-zA-Z]/g,"").trim()).toLowerCase(),t=a.substring(r).trim(),"click"===n?e.event=this._processEventHandler(n+"="+_):"color"===n?c.color=_:"width"===n&&(c.width=parseInt(_)),e.event&&"param"===n&&(e.event[n]=_.replace(/^"|"$/g,"")),i=f.exec(t)}e.outline=c}if((i=/^(on|u|b|i)(\s)*/.exec(t))&&i[0].length>0){switch(n=i[0],t=t.substring(n.length).trim(),n[0]){case"u":e.underline=!0;break;case"i":e.italic=!0;break;case"b":e.bold=!0}if(""===t)return e;e.event=this._processEventHandler(t)}return e},e.getRightQuotationIndex=function(t){var e=-1,i=-1,n=t.indexOf("'"),r=t.indexOf('"'),s=r>-1&&(r<n||-1===n);return n>-1&&(n<r||-1===r)?(e=n,i=t.indexOf("'",e+1>=t.length?-1:e+1)):s&&(e=r,i=t.indexOf('"',e+1>=t.length?-1:e+1)),i},e._processEventHandler=function(t){for(var e={},i=0,n=!1,r=pU.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=pU.exec(t)}return e},e._addToStack=function(t){var e=this._attributeToObject(t);if(0===this._stack.length)this._stack.push(e);else{if(e.isNewLine||e.isImage)return;var i=this._stack[this._stack.length-1];for(var n in i)e[n]||(e[n]=i[n]);this._stack.push(e)}},e._processResult=function(t){0!==t.length&&(t=this._escapeSpecialSymbol(t),this._stack.length>0?this._resultObjectArray.push({text:t,style:this._stack[this._stack.length-1]}):this._resultObjectArray.push({text:t}))},e._escapeSpecialSymbol=function(t){for(var e,i=f(this._specialSymbolArray);!(e=i()).done;){var n=e.value,r=n[0],s=n[1];t=t.replace(r,s)}return t},t}()),yU=t("k",Is("cc.LabelOutline")(sU=Ds(110)(sU=Bs($k)((aU=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._color=oU&&oU(),e._width=hU&&hU(),e}s(e,t);var i=e.prototype;return i.onEnable=function(){this._updateRenderData()},i.onDisable=function(){this._updateRenderData()},i._updateRenderData=function(){var t=this.node.getComponent($k);t&&t.updateRenderData(!0)},n(e,[{key:"color",get:function(){return this._color},set:function(t){this._color!==t&&(this._color.set(t),this._updateRenderData())}},{key:"width",get:function(){return this._width},set:function(t){this._width!==t&&(this._width=t,this._updateRenderData())}}]),e}(Vd),oU=Ss(aU.prototype,"_color",[ks],(function(){return new Zi(0,0,0,255)})),hU=Ss(aU.prototype,"_width",[ks],(function(){return 2})),sU=aU))||sU)||sU)||sU);v.LabelOutline=yU,dt({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}}),dt({UIRenderable:{newName:"UIRenderer",since:"3.0.0",removed:!0}}),dt({Renderable2D:{newName:"UIRenderer",since:"3.6.0",removed:!1}});var vU,SU,AU,TU,EU,bU,xU,CU,RU,wU,IU,BU,DU,PU,OU,MU,NU,LU,FU,kU,GU,VU,UU,zU,HU,WU,XU,jU,YU,qU,KU,JU,QU,ZU,$U,tz,ez=Is("cc.PostProcess")(uU=Ps(((dU=function(t){function e(){for(var e,i=arguments.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=cU&&cU(),e._shadingScale=_U&&_U(),e.enableShadingScaleInEditor=fU&&fU(),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}(Vd)).all=[],cU=Ss((lU=dU).prototype,"global",[Os],(function(){return!0})),_U=Ss(lU.prototype,"_shadingScale",[Os],(function(){return 1})),p(lU.prototype,"shadingScale",[Os],Object.getOwnPropertyDescriptor(lU.prototype,"shadingScale"),lU.prototype),fU=Ss(lU.prototype,"enableShadingScaleInEditor",[Os],(function(){return!1})),uU=lU))||uU)||uU,iz=new Yi,nz=me(MC),rz=me(OC),sz=me(NC),az=me(FC),oz=me(LC),hz=me({SKYBOX:qC|oc.DEPTH_STENCIL,SOLID_COLOR:oc.ALL,DEPTH_ONLY:oc.DEPTH_STENCIL,DONT_CLEAR:oc.NONE}),uz=t("dy",(vU=Is("cc.Camera"),SU=ha(kp.BitMask),AU=ha(hz),TU=ha(nz),EU=ha(rz),bU=ha(sz),xU=ha(az),CU=ha(oz),RU=ha(dR),wU=ha(ez),vU((($U=function(t){function e(){for(var e,i=arguments.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=DU&&DU(),e._priority=PU&&PU(),e._fov=OU&&OU(),e._fovAxis=MU&&MU(),e._orthoHeight=NU&&NU(),e._near=LU&&LU(),e._far=FU&&FU(),e._color=kU&&kU(),e._depth=GU&&GU(),e._stencil=VU&&VU(),e._clearFlags=UU&&UU(),e._rect=zU&&zU(),e._aperture=HU&&HU(),e._shutter=WU&&WU(),e._iso=XU&&XU(),e._screenScale=jU&&jU(),e._visibility=YU&&YU(),e._targetTexture=qU&&qU(),e._postProcess=KU&&KU(),e._usePostProcess=JU&&JU(),e._camera=null,e._inEditorMode=!1,e._flows=void 0,e._cameraType=QU&&QU(),e._trackingType=ZU&&ZU(),e}s(e,t);var i=e.prototype;return i.onLoad=function(){this._createCamera()},i.onEnable=function(){this.node.hasChangedFlags|=Vp.POSITION,this._camera&&this._attachToScene()},i.onDisable=function(){this._camera&&this._detachFromScene()},i.onDestroy=function(){this._camera&&(this._camera.destroy(),this._camera=null),this._targetTexture&&this._targetTexture.off("resize")},i.screenPointToRay=function(t,e,i){return i||(i=zn.create()),this._camera&&this._camera.screenPointToRay(i,t,e),i},i.worldToScreen=function(t,e){return e||(e=new Yi),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 Yi),!this._camera)return i;this.worldToScreen(t,iz);var n=e.getComponent("cc.UITransform"),r=v.view.getVisibleSize(),s=iz.x-.5*this._camera.width,a=iz.y-.5*this._camera.height;return iz.x=s/v.view.getScaleX()+.5*r.width,iz.y=a/v.view.getScaleY()+.5*r.height,n&&n.convertToNodeSpaceAR(iz,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=Ri(this._fov),this._camera.orthoHeight=this._orthoHeight,this._camera.nearClip=this._near,this._camera.farClip=this._far,this._camera.clearColor=this._color,this._camera.clearDepth=this._depth,this._camera.clearStencil=this._stencil,this._camera.clearFlag=this._clearFlags,this._camera.visibility=this._visibility,this._camera.aperture=this._aperture,this._camera.shutter=this._shutter,this._camera.iso=this._iso,this._camera.postProcess=this._postProcess,this._camera.usePostProcess=this._usePostProcess),this._updateTargetTexture()},i._attachToScene=function(){this.node.scene&&this._camera&&(this._camera&&this._camera.scene&&this._camera.scene.removeCamera(this._camera),this._getRenderScene().addCamera(this._camera))},i._detachFromScene=function(){this._camera&&this._camera.scene&&this._camera.scene.removeCamera(this._camera)},i._checkTargetTextureEvent=function(t){var e=this;t&&t.off("resize"),this._targetTexture&&this._targetTexture.on("resize",(function(t){e._camera&&e._camera.setFixedSize(t.width,t.height)}),this)},i._updateTargetTexture=function(){if(this._camera&&this._targetTexture){var t=this._targetTexture.window;this._camera.changeTargetWindow(t),this._camera.setFixedSize(t.width,t.height)}},n(e,[{key:"camera",get:function(){return this._camera}},{key:"priority",get:function(){return this._priority},set:function(t){this._priority=t,this._camera&&(this._camera.priority=t)}},{key:"visibility",get:function(){return this._visibility},set:function(t){this._visibility=t,this._camera&&(this._camera.visibility=t)}},{key:"clearFlags",get:function(){return this._clearFlags},set:function(t){this._clearFlags=t,this._camera&&(this._camera.clearFlag=t)}},{key:"clearColor",get:function(){return this._color},set:function(t){this._color.set(t),this._camera&&(this._camera.clearColor=this._color)}},{key:"clearDepth",get:function(){return this._depth},set:function(t){this._depth=t,this._camera&&(this._camera.clearDepth=t)}},{key:"clearStencil",get:function(){return this._stencil},set:function(t){this._stencil=t,this._camera&&(this._camera.clearStencil=t)}},{key:"projection",get:function(){return this._projection},set:function(t){this._projection=t,this._camera&&(this._camera.projectionType=t)}},{key:"fovAxis",get:function(){return this._fovAxis},set:function(t){t!==this._fovAxis&&(this._fovAxis=t,this._camera&&(this._camera.fovAxis=t,t===OC.VERTICAL?this.fov=this._fov*this._camera.aspect:this.fov=this._fov/this._camera.aspect))}},{key:"fov",get:function(){return this._fov},set:function(t){this._fov=t,this._camera&&(this._camera.fov=Ri(t))}},{key:"orthoHeight",get:function(){return this._orthoHeight},set:function(t){this._orthoHeight=t,this._camera&&(this._camera.orthoHeight=t)}},{key:"near",get:function(){return this._near},set:function(t){this._near=t,this._camera&&(this._camera.nearClip=t)}},{key:"far",get:function(){return this._far},set:function(t){this._far=t,this._camera&&(this._camera.farClip=t)}},{key:"aperture",get:function(){return this._aperture},set:function(t){this._aperture=t,this._camera&&(this._camera.aperture=t)}},{key:"shutter",get:function(){return this._shutter},set:function(t){this._shutter=t,this._camera&&(this._camera.shutter=t)}},{key:"iso",get:function(){return this._iso},set:function(t){this._iso=t,this._camera&&(this._camera.iso=t)}},{key:"rect",get:function(){return this._rect},set:function(t){this._rect=t,this._camera&&this._camera.setViewportInOrientedSpace(t)}},{key:"targetTexture",get:function(){return this._targetTexture},set:function(t){if(this._targetTexture!==t){var i=this._targetTexture;this._targetTexture=t,this._checkTargetTextureEvent(i),this._updateTargetTexture(),!t&&this._camera&&(this._camera.changeTargetWindow(null),this._camera.isWindowSize=!0),this.node.emit(e.TARGET_TEXTURE_CHANGE,this)}}},{key:"usePostProcess",get:function(){return this._usePostProcess},set:function(t){this._usePostProcess=t,this._camera&&(this._camera.usePostProcess=t)}},{key:"postProcess",get:function(){return this._postProcess},set:function(t){this._postProcess=t,this._camera&&(this._camera.postProcess=t)}},{key:"screenScale",get:function(){return this._screenScale},set:function(t){this._screenScale=t,this._camera&&(this._camera.screenScale=t)}},{key:"inEditorMode",get:function(){return this._inEditorMode},set:function(t){this._inEditorMode=t,this._camera&&this._camera.changeTargetWindow(t?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}(Vd)).ProjectionType=nz,$U.FOVAxis=rz,$U.ClearFlag=hz,$U.Aperture=sz,$U.Shutter=az,$U.ISO=oz,$U.TARGET_TEXTURE_CHANGE="tex-change",DU=Ss((BU=$U).prototype,"_projection",[ks],(function(){return nz.PERSPECTIVE})),PU=Ss(BU.prototype,"_priority",[ks],(function(){return 0})),OU=Ss(BU.prototype,"_fov",[ks],(function(){return 45})),MU=Ss(BU.prototype,"_fovAxis",[ks],(function(){return rz.VERTICAL})),NU=Ss(BU.prototype,"_orthoHeight",[ks],(function(){return 10})),LU=Ss(BU.prototype,"_near",[ks],(function(){return 1})),FU=Ss(BU.prototype,"_far",[ks],(function(){return 1e3})),kU=Ss(BU.prototype,"_color",[ks],(function(){return new Zi("#333333")})),GU=Ss(BU.prototype,"_depth",[ks],(function(){return 1})),VU=Ss(BU.prototype,"_stencil",[ks],(function(){return 0})),UU=Ss(BU.prototype,"_clearFlags",[ks],(function(){return hz.SOLID_COLOR})),zU=Ss(BU.prototype,"_rect",[ks],(function(){return new En(0,0,1,1)})),HU=Ss(BU.prototype,"_aperture",[ks],(function(){return sz.F16_0})),WU=Ss(BU.prototype,"_shutter",[ks],(function(){return az.D125})),XU=Ss(BU.prototype,"_iso",[ks],(function(){return oz.ISO100})),jU=Ss(BU.prototype,"_screenScale",[ks],(function(){return 1})),YU=Ss(BU.prototype,"_visibility",[ks],(function(){return my})),qU=Ss(BU.prototype,"_targetTexture",[ks],(function(){return null})),KU=Ss(BU.prototype,"_postProcess",[ks],(function(){return null})),JU=Ss(BU.prototype,"_usePostProcess",[ks],(function(){return!1})),QU=Ss(BU.prototype,"_cameraType",[ks],(function(){return kC.DEFAULT})),ZU=Ss(BU.prototype,"_trackingType",[ks],(function(){return GC.NO_TRACKING})),p(BU.prototype,"visibility",[SU],Object.getOwnPropertyDescriptor(BU.prototype,"visibility"),BU.prototype),p(BU.prototype,"clearFlags",[AU],Object.getOwnPropertyDescriptor(BU.prototype,"clearFlags"),BU.prototype),p(BU.prototype,"projection",[TU],Object.getOwnPropertyDescriptor(BU.prototype,"projection"),BU.prototype),p(BU.prototype,"fovAxis",[EU],Object.getOwnPropertyDescriptor(BU.prototype,"fovAxis"),BU.prototype),p(BU.prototype,"aperture",[bU],Object.getOwnPropertyDescriptor(BU.prototype,"aperture"),BU.prototype),p(BU.prototype,"shutter",[xU],Object.getOwnPropertyDescriptor(BU.prototype,"shutter"),BU.prototype),p(BU.prototype,"iso",[CU],Object.getOwnPropertyDescriptor(BU.prototype,"iso"),BU.prototype),p(BU.prototype,"targetTexture",[RU],Object.getOwnPropertyDescriptor(BU.prototype,"targetTexture"),BU.prototype),p(BU.prototype,"usePostProcess",[Os],Object.getOwnPropertyDescriptor(BU.prototype,"usePostProcess"),BU.prototype),p(BU.prototype,"postProcess",[wU],Object.getOwnPropertyDescriptor(BU.prototype,"postProcess"),BU.prototype),IU=BU))||IU));v.Camera=uz;var lz=new An,cz=((tz={})[be.ORIENTATION_AUTO]=il.AUTO,tz[be.ORIENTATION_LANDSCAPE]=il.LANDSCAPE,tz[be.ORIENTATION_PORTRAIT]=il.PORTRAIT,tz),_z=t("fD",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=fz,n=dz;return e._designResolutionSize=new An(0,0),e._scaleX=1,e._scaleY=1,e._viewportRect=new En(0,0,0,0),e._visibleRect=new En(0,0,0,0),e._autoFullScreen=!1,e._retinaEnabled=!1,e._resizeCallback=null,e._rpExactFit=new pz(i.EQUAL_TO_FRAME,n.EXACT_FIT),e._rpShowAll=new pz(i.EQUAL_TO_FRAME,n.SHOW_ALL),e._rpNoBorder=new pz(i.EQUAL_TO_FRAME,n.NO_BORDER),e._rpFixedHeight=new pz(i.EQUAL_TO_FRAME,n.FIXED_HEIGHT),e._rpFixedWidth=new pz(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=hl.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,lz.width=this._visibleRect.width,lz.height=this._visibleRect.height,ll&&ll.init(this._visibleRect),this.resizeWithBrowserSize(!0);var n=Ee.querySettings(Te.Category.SCREEN,"designResolution");n&&this.setDesignResolutionSize(Number(n.width),Number(n.height),n.policy||pz.FIXED_HEIGHT),hl.on("window-resize",this._updateAdaptResult,this),hl.on("orientation-change",this._updateAdaptResult,this),hl.on("fullscreen-change",this._updateAdaptResult,this)},i.resizeWithBrowserSize=function(t){al.handleResizeEvent=t},i.setResizeCallback=function(t){"function"!=typeof t&&null!=t||(this._resizeCallback=t)},i.setOrientation=function(t){al.orientation=cz[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&&hl.requestFullScreen().catch((function(){})))},i.isAutoFullScreenEnabled=function(){return this._autoFullScreen},i.setCanvasSize=function(t,e){al.resolutionScale=1;var i=al.devicePixelRatio,n=new An(t*i,e*i);hl.windowSize=n},i.getCanvasSize=function(){return hl.windowSize},i.getFrameSize=function(){var t=al.devicePixelRatio,e=hl.windowSize;return e.width/=t,e.height/=t,e},i.setFrameSize=function(t,e){var i=al.devicePixelRatio;hl.windowSize=new An(t*i,e*i)},i.getVisibleSize=function(){return new An(this._visibleRect.width,this._visibleRect.height)},i.getVisibleSizeInPixel=function(){return new An(this._visibleRect.width*this._scaleX,this._visibleRect.height*this._scaleY)},i.getVisibleOrigin=function(){return new yn(this._visibleRect.x,this._visibleRect.y)},i.getVisibleOriginInPixel=function(){return new yn(this._visibleRect.x*this._scaleX,this._visibleRect.y*this._scaleY)},i.getResolutionPolicy=function(){return this._resolutionPolicy},i._updateResolutionPolicy=function(t){if(t instanceof pz)this._resolutionPolicy=t;else{var e=pz;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=gz.getDesignResolutionSize();gz.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),lz.width=this._visibleRect.width,lz.height=this._visibleRect.height,ll&&ll.init(this._visibleRect),this.emit("design-resolution-changed")}else J(2200)},i.getDesignResolutionSize=function(){return new An(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 al.devicePixelRatio},i.convertToLocationInView=function(t,e,i,n){void 0===n&&(n=new yn);var r=al.devicePixelRatio*(t-i.left),s=al.devicePixelRatio*(i.top+i.height-e);return al.isFrameRotated?(n.x=hl.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}(Bu(pu)));_z.instance=void 0;var fz=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=hl.windowSize;t.width!==e.width&&(t.width=e.width),t.height!==e.height&&(t.height=e.height)}},t}();fz.EQUAL_TO_FRAME=void 0,fz.PROPORTION_TO_FRAME=void 0;var dz=function(){function t(){this.name="ContentStrategy",this._result=void 0,this._result={scale:[1,1],viewport:null}}var e=t.prototype;return e.preApply=function(){},e.apply=function(){return{scale:[1,1]}},e.postApply=function(){},e._buildResult=function(t,e,i,n,r,s){Math.abs(t-i)<2&&(i=t),Math.abs(e-n)<2&&(n=e);var a=new En(Math.round((t-i)/2),Math.round((e-n)/2),i,n);return this._result.scale=[r,s],this._result.viewport=a,this._result},t}();dz.EXACT_FIT=void 0,dz.SHOW_ALL=void 0,dz.NO_BORDER=void 0,dz.FIXED_HEIGHT=void 0,dz.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(){al.isProportionalToFrame=!1,this._setupCanvas()},e}(fz),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(){al.isProportionalToFrame=!0,this._setupCanvas()},e}(fz);fz.EQUAL_TO_FRAME=new t,fz.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=hl.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}(dz),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=hl.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}(dz),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=hl.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}(dz),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=hl.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}(dz),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=hl.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}(dz);dz.EXACT_FIT=new i,dz.SHOW_ALL=new n,dz.NO_BORDER=new r,dz.FIXED_HEIGHT=new a,dz.FIXED_WIDTH=new o}();var pz=t("fE",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 fz&&(this._containerStrategy=t)},e.setContentStrategy=function(t){t instanceof dz&&(this._contentStrategy=t)},n(t,[{key:"canvasSize",get:function(){return hl.windowSize}}]),t}());pz.EXACT_FIT=0,pz.NO_BORDER=1,pz.SHOW_ALL=2,pz.FIXED_HEIGHT=3,pz.FIXED_WIDTH=4,pz.UNKNOWN=5,pz.ContainerStrategy=fz,pz.ContentStrategy=dz,v.ResolutionPolicy=pz;var mz,gz=t("fF",_z.instance=v.view=new _z);vN.registerSystem("view",gz,0),v.winSize=lz;var yz,vz,Sz,Az,Tz,Ez,bz,xz,Cz,Rz=t("R",Is("cc.RenderRoot2D")(mz=Ds(100)(mz=Bs($F)(mz=Ps(mz=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}(Vd))||mz)||mz)||mz)||mz),wz=new Yi,Iz=me({OVERLAY:0,INTERSPERSE:1}),Bz=t("C",(yz=Is("cc.Canvas"),vz=Ds(100),Sz=ha(uz),Az=ha(uz),yz(Tz=vz(Tz=Ps((p((Ez=function(t){function e(){var e;return(e=t.call(this)||this)._cameraComponent=bz&&bz(),e._alignCanvasWithScreen=xz&&xz(),e._thisOnCameraResized=void 0,e._fitDesignResolution=void 0,e._pos=new Yi,e._renderMode=Iz.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(uz.TARGET_TEXTURE_CHANGE,this._thisOnCameraResized)),this._onResizeCamera(),this.node.on(zp.TRANSFORM_CHANGED,this._thisOnCameraResized)},i.onEnable=function(){t.prototype.onEnable.call(this),this._cameraComponent&&this._cameraComponent.node.on(uz.TARGET_TEXTURE_CHANGE,this._thisOnCameraResized)},i.onDisable=function(){t.prototype.onDisable.call(this),this._cameraComponent&&this._cameraComponent.node.off(uz.TARGET_TEXTURE_CHANGE,this._thisOnCameraResized)},i.onDestroy=function(){t.prototype.onDestroy.call(this),this.node.off(zp.TRANSFORM_CHANGED,this._thisOnCameraResized)},i._onResizeCamera=function(){if(this._cameraComponent&&this._alignCanvasWithScreen){if(this._cameraComponent.targetTexture)this._cameraComponent.orthoHeight=ll.height/2;else{var t=hl.windowSize;this._cameraComponent.orthoHeight=t.height/gz.getScaleY()/2}this.node.getWorldPosition(wz),this._cameraComponent.node.setWorldPosition(wz.x,wz.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===Iz.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}(Rz)).prototype,"cameraComponent",[Sz],Object.getOwnPropertyDescriptor(Ez.prototype,"cameraComponent"),Ez.prototype),bz=Ss(Ez.prototype,"_cameraComponent",[Az],(function(){return null})),xz=Ss(Ez.prototype,"_alignCanvasWithScreen",[ks],(function(){return!0})),Tz=Ez))||Tz)||Tz)||Tz));function Dz(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,f=(i.z-n.z)*o,d=Math.max(Math.max(Math.min(h,u),Math.min(l,c)),Math.min(_,f)),p=Math.min(Math.min(Math.max(h,u),Math.max(l,c)),Math.max(_,f));return p<0||d>p?0:d>0?d:p}v.Canvas=Bz,rt(t("U",Is("cc.UIComponent")(Cz=Bs($F)(Cz=Ds(110)(Cz=Ps(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)._lastParent=null,e.stencilStage=SF.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}(Vd))||Cz)||Cz)||Cz)||Cz).prototype,"UIComponent",[{name:"_visibility"},{name:"setVisibility"}]),nt(Bz.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:Zi.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}}]),st($F.prototype,"UITransform.prototype",[{name:"priority",suggest:"Please use setSiblingIndex to change index of the current node in its parent's children array."}]),v.UITransformComponent=$F,Jt($F,"cc.UITransformComponent"),Jt(gk,"cc.RenderComponent"),v.CanvasComponent=Bz,Jt(Bz,"cc.CanvasComponent"),v.internal.Renderable2D=gk,Jt(gk,"cc.Renderable2D");var Pz,Oz,Mz,Nz,Lz,Fz,kz,Gz=(Pz=Kr.create(),Oz={distance:1/0,doubleSided:!1,mode:jh.ANY},Mz=0,Nz=function(t,e,i,n,r,s){t===jh.CLOSEST?(Mz>e||0===Mz)&&(Mz=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))):(Mz=e,s&&s.push({distance:e,vertexIndex0:i/3,vertexIndex1:n/3,vertexIndex2:r/3}))},function(t,e,i){if(Mz=0,0===e.geometricInfo.positions.length)return Mz;var n=void 0===i?Oz:i;if(Dz(t,e.geometricInfo.boundingBox.min,e.geometricInfo.boundingBox.max)){var r=e.primitiveMode,s=e.geometricInfo;!function(t,e,i,n,r){if(i===Ql.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];Yi.set(Pz.a,t[o],t[o+1],t[o+2]),Yi.set(Pz.b,t[h],t[h+1],t[h+2]),Yi.set(Pz.c,t[u],t[u+1],t[u+2]);var l=Hr.rayTriangle(n,Pz,r.doubleSided);if(!(0===l||l>r.distance)&&(Nz(r.mode,l,o,h,u,r.result),r.mode===jh.ANY))return l}else if(i===Ql.TRIANGLE_STRIP)for(var c=e.length-2,_=0,f=0;f<c;f+=1){var d=3*e[f-_],p=3*e[f+_+1],m=3*e[f+2];Yi.set(Pz.a,t[d],t[d+1],t[d+2]),Yi.set(Pz.b,t[p],t[p+1],t[p+2]),Yi.set(Pz.c,t[m],t[m+1],t[m+2]),_=~_;var g=Hr.rayTriangle(n,Pz,r.doubleSided);if(!(0===g||g>r.distance)&&(Nz(r.mode,g,d,p,m,r.result),r.mode===jh.ANY))return g}else if(i===Ql.TRIANGLE_FAN){var y=e.length-1,v=3*e[0];Yi.set(Pz.a,t[v],t[v+1],t[v+2]);for(var S=1;S<y;S+=1){var A=3*e[S],T=3*e[S+1];Yi.set(Pz.b,t[A],t[A+1],t[A+2]),Yi.set(Pz.c,t[T],t[T+1],t[T+2]);var E=Hr.rayTriangle(n,Pz,r.doubleSided);if(!(0===E||E>r.distance)&&(Nz(r.mode,E,v,A,T,r.result),r.mode===jh.ANY))return E}}}(s.positions,s.indices,r,t,n)}return Mz}),Vz=function(){var t=0,e={distance:1/0,doubleSided:!1,mode:jh.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&&!Dz(i,o,h))return t;for(var u=0;u<a;u++){var l=n.renderingSubMeshes[u],c=Gz(i,l,s);if(c)if(s.mode===jh.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===jh.ANY)return c}return t&&s.mode===jh.CLOSEST&&(s.result&&(s.result[0].distance=t,s.result.length=1),s.subIndices&&(s.subIndices.length=1)),t}}(),Uz=function(){var t=0,e={distance:1/0,doubleSided:!1,mode:jh.ANY},i=new zn,n=new fn;return function(r,s,a){t=0;var o=void 0===a?e:a,h=s.worldBounds;if(h&&!Hr.rayAABB(r,h))return t;zn.copy(i,r),s.node&&(fn.invert(n,s.node.getWorldMatrix(n)),Yi.transformMat4(i.o,r.o,n),Yi.transformMat4Normal(i.d,r.d,n));for(var u=s.subModels,l=0;l<u.length;l++){var c=u[l].subMesh,_=Gz(i,c,o);if(_)if(o.mode===jh.CLOSEST)(0===t||t>_)&&(t=_,o.subIndices&&(o.subIndices[0]=l));else if(t=_,o.subIndices&&o.subIndices.push(l),o.mode===jh.ANY)return _}return t&&o.mode===jh.CLOSEST&&(o.result&&(o.result[0].distance=t,o.result.length=1),o.subIndices&&(o.subIndices.length=1)),t}}();Hr.rayModel=Uz,Hr.raySubMesh=Gz,Hr.rayMesh=Vz,CS("specular-pass");var zz,Hz,Wz,Xz,jz,Yz,qz,Kz,Jz,Qz,Zz,$z,tH,eH,iH,nH,rH,sH=t("dz",Is("cc.ModelRenderer")((Fz=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._visFlags=kz&&kz(),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}(mk),kz=Ss(Fz.prototype,"_visFlags",[ks],(function(){return kp.Enum.NONE})),Lz=Fz))||Lz),aH=ks,oH=ha;t("dC",(zz=Is("cc.PrefabLink"),Hz=oH(oN),zz((Xz=function(t){function e(){for(var e,i=arguments.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=jz&&jz(),e}return s(e,t),e}(Vd),jz=Ss(Xz.prototype,"prefab",[Hz,aH],(function(){return null})),Wz=Xz))||Wz)),nt(uz,"Camera",[{name:"CameraClearFlag",newName:"ClearFlag"}]),nt(uz.prototype,"Camera.prototype",[{name:"color",newName:"clearColor"},{name:"depth",newName:"clearDepth"},{name:"stencil",newName:"clearStencil"}]),st(mk.prototype,"Renderer.prototype",[{name:"getMaterial",suggest:"please use renderer.getSharedMaterial instead."}]),v.CameraComponent=uz,Jt(uz,"cc.CameraComponent"),v.RenderableComponent=sH,Jt(sH,"cc.RenderableComponent"),function(t){t[t.SIMPLE=0]="SIMPLE",t[t.SLICED=1]="SLICED",t[t.TILED=2]="TILED"}(rH||(rH={})),t("e",(Yz=Is("cc.SpriteRenderer"),qz=Ds(100),Kz=ha(lL),Yz(Jz=qz((p((Qz=function(t){function e(){for(var e,i=arguments.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=Zz&&Zz(),e._mode=$z&&$z(),e._color=tH&&tH(),e._flipX=eH&&eH(),e._flipY=iH&&iH(),e._size=nH&&nH(),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(wR);t.visFlags=this.visibility,t.node=t.transform=this.node,this._models.length=0,this._models.push(this._model)},i._updateModelParams=function(){if(this._spriteFrame&&this._model){this._spriteFrame.ensureMeshData();var t=this._spriteFrame.mesh;this.node.hasChangedFlags|=Vp.POSITION,this._model.transform.hasChangedFlags|=Vp.POSITION;var e=t?t.renderingSubMeshes.length:0,i=t.renderingSubMeshes;if(i)for(var n=0;n<e;++n){var r=this.getRenderMaterial(n);r&&!r.isValid&&(r=null);var s=i[n];s&&this._model.initSubModel(n,s,r||this._getBuiltinMaterial())}this._model.enabled=!0}},i._getBuiltinMaterial=function(){return xS.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=Wm.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}(sH)).prototype,"spriteFrame",[Kz],Object.getOwnPropertyDescriptor(Qz.prototype,"spriteFrame"),Qz.prototype),Zz=Ss(Qz.prototype,"_spriteFrame",[ks],(function(){return null})),$z=Ss(Qz.prototype,"_mode",[ks],(function(){return rH.SIMPLE})),tH=Ss(Qz.prototype,"_color",[ks],(function(){return Zi.WHITE.clone()})),eH=Ss(Qz.prototype,"_flipX",[ks],(function(){return!1})),iH=Ss(Qz.prototype,"_flipY",[ks],(function(){return!1})),nH=Ss(Qz.prototype,"_size",[ks],(function(){return new yn})),Jz=Qz))||Jz)||Jz));var hH,uH,lH,cH,_H,fH,dH,pH,mH,gH,yH,vH,SH,AH,TH,EH,bH,xH,CH,RH,wH,IH,BH,DH=new gU,PH="RICHTEXT_CHILD",OH="RICHTEXT_Image_CHILD",MH=new yn,NH=new yn,LH=new ne((function(t){if(!v.isValid(t.node))return!1;var e=t.node.getComponent(yU);return e&&(e.width=0),!0}),20),FH=new ne((function(t){return v.isValid(t.node)}),10);function kH(t){return{node:new Pm(t),comp:null,lineCount:0,styleIndex:0,imageOffset:"",clickParam:"",clickHandler:"",type:t}}function GH(t,e){var i;t===PH?i=LH._get():t===OH&&(i=FH._get());var n=(i=i||kH(t)).node;return n||(n=new Pm(t)),n.hideFlags|=ba.Flags.DontSave|ba.Flags.HideInHierarchy,n.active=!0,t===OH?(i.comp=n.getComponent(ZV)||n.addComponent(ZV),i.comp.spriteFrame=e,i.comp.type=ZV.Type.SLICED,i.comp.sizeMode=ZV.SizeMode.CUSTOM):(i.comp=n.getComponent($k)||n.addComponent($k),i.comp.string=e,i.comp.horizontalAlign=Xk.LEFT,i.comp.verticalAlign=jk.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 VH,UH=t("h",(hH=Is("cc.RichText"),uH=Ds(110),lH=ha(Xk),cH=ha(jk),_H=ha(mL),fH=ha(qk),dH=ha(_L),hH(pH=uH(((BH=function(t){function e(){var e;return(e=t.call(this)||this)._lineHeight=gH&&gH(),e._string=yH&&yH(),e._horizontalAlign=vH&&vH(),e._verticalAlign=SH&&SH(),e._fontSize=AH&&AH(),e._maxWidth=TH&&TH(),e._fontFamily=EH&&EH(),e._font=bH&&bH(),e._isSystemFontUsed=xH&&xH(),e._userDefinedFont=CH&&CH(),e._cacheMode=RH&&RH(),e._imageAtlas=wH&&wH(),e._handleTouchEvent=IH&&IH(),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(zp.LAYER_CHANGED,this._applyLayer,this),this.node.on(zp.ANCHOR_CHANGED,this._updateRichTextPosition,this)},i.onEnable=function(){this.handleTouchEvent&&this._addEventListeners(),this._updateRichText(),this._activateChildren(!0)},i.onDisable=function(){this.handleTouchEvent&&this._removeEventListeners(),this._activateChildren(!1)},i.onRestore=function(){},i.onDestroy=function(){for(var t,e=f(this._segments);!(t=e()).done;){var i=t.value;i.node.removeFromParent(),i.type===PH?LH.put(i):i.type===OH&&FH.put(i)}this.node.off(zp.ANCHOR_CHANGED,this._updateRichTextPosition,this),this.node.off(zp.LAYER_CHANGED,this._applyLayer,this)},i._addEventListeners=function(){this.node.on(zp.TOUCH_END,this._onTouchEnded,this)},i._removeEventListeners=function(){this.node.off(zp.TOUCH_END,this._onTouchEnded,this)},i._updateLabelSegmentTextAttributes=function(){var t=this;this._segments.forEach((function(e){t._applyTextAttribute(e)}))},i._createFontLabel=function(t){return GH(PH,t)},i._createImage=function(t){return GH(OH,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(MH,e,t),MH.x<2048)i.push(t);else for(var n=t.split("\n"),r=0;r<n.length;r++)if(this._calculateSize(MH,e,n[r]),MH.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(MH,e,a),u=this._calculateSize(NH,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,f=1;_&&r<t.length;){for(;_&&h.x<c;){var d=XL(o);d&&d.length>0&&(f=d[0].length),s+=f,a=n.substring(r,s),o=n.substring(s),this._calculateSize(h,e,a),_--}for(;_&&a.length>=2&&h.x>c;)s-=f,a=n.substring(r,s),this._calculateSize(h,e,a),f=1,_--;if(a.length>=2){var p=jL(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(MH,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($k).string=i,n.styleIndex=e,this._applyTextAttribute(n);var r=n.node._uiProps.uiTransformComp.contentSize;return yn.set(t,r.x,r.y),t},i._onTouchEnded=function(t){for(var e,i=this,n=this.node.getComponents(Vd),r=function(){var r=e.value,s=r.clickHandler,a=r.clickParam;s&&i._containsTouchLocation(r,t.touch.getUILocation())&&(n.forEach((function(e){var i=e[s];e.enabledInHierarchy&&i&&i.call(e,t,a)})),t.propagationStopped=!0)},s=f(this._segments);!(e=s()).done;)r()},i._containsTouchLocation=function(t,e){var i=t.node.getComponent($F);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===PH||i.name===OH){i.parent=null;var n=kH(i.name);n.node=i,i.name===PH?(n.comp=i.getComponent($k),LH.put(n)):(n.comp=i.getComponent(ZV),FH.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!==PH&&i.name!==OH||(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($k);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=YL(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._updateRichText=function(){if(this.enabledInHierarchy){var t=DH.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+DL)*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(UL(n)||zL(n))return 1;for(var r=1,s=e+1;s<i&&!zL(n=t.charAt(s))&&!UL(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 Xk.LEFT:break;case Xk.CENTER:u-=this._linesWidth[h-1]/2;break;case Xk.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(ZV)){var c=o.node.position.clone(),_=this._lineHeight,f=this._lineHeight*(1+DL);switch(o.node._uiProps.uiTransformComp.anchorY){case 1:c.y+=_+(f-_)/2;break;case.5:c.y+=f/2;break;default:c.y+=(f-_)/2}if(o.imageOffset){var d=o.imageOffset.split(",");if(1===d.length&&d[0]){var p=parseFloat(d[0]);Number.isInteger(p)&&(c.y+=p)}else if(2===d.length){var m=parseFloat(d[0]),g=parseFloat(d[1]);Number.isInteger(m)&&(c.x+=m),Number.isInteger(g)&&(c.y+=g)}}o.node.position=c}var y=o.node.getComponent(yU);if(y){var v=o.node.position.clone();v.y-=y.width,o.node.position=v}}},i._convertLiteralColorValue=function(t){var e=t.toUpperCase();return Zi[e]?Zi[e]:(new Zi).fromHEX(t)},i._applyTextAttribute=function(t){var e=t.node.getComponent($k);if(e){this._resetLabelState(e);var i,n=t.styleIndex;if(this._textArray[n]&&(i=this._textArray[n].style),i){if(e.color=this._convertLiteralColorValue(i.color||"white"),e.isBold=!!i.bold,e.isItalic=!!i.italic,e.isUnderline=!!i.underline,i.outline){var r=t.node.getComponent(yU);r||(r=t.node.addComponent(yU)),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 mL&&!this._isSystemFontUsed?e.font=this._font:e.fontFamily=this._fontFamily,e.useSystemFont=this._isSystemFontUsed,e.lineHeight=this._lineHeight,e.updateRenderData(!0)}},i._applyLayer=function(){for(var t,e=f(this._segments);!(t=e()).done;)t.value.node.layer=this.node.layer},i._resetLabelState=function(t){t.fontSize=this._fontSize,t.color=Zi.WHITE,t.isBold=!1,t.isItalic=!1,t.isUnderline=!1},n(e,[{key:"string",get:function(){return this._string},set:function(t){this._string!==t&&(this._string=t,this._updateRichTextStatus())}},{key:"horizontalAlign",get:function(){return this._horizontalAlign},set:function(t){this.horizontalAlign!==t&&(this._horizontalAlign=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"verticalAlign",get:function(){return this._verticalAlign},set:function(t){this._verticalAlign!==t&&(this._verticalAlign=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"fontSize",get:function(){return this._fontSize},set:function(t){this._fontSize!==t&&(this._fontSize=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"fontFamily",get:function(){return this._fontFamily},set:function(t){this._fontFamily!==t&&(this._fontFamily=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"font",get:function(){return this._font},set:function(t){this._font!==t&&(this._font=t,this._layoutDirty=!0,this._font?(this.useSystemFont=!1,this._onTTFLoaded()):this.useSystemFont=!0,this._updateRichTextStatus())}},{key:"useSystemFont",get:function(){return this._isSystemFontUsed},set:function(t){this._isSystemFontUsed!==t&&(this._isSystemFontUsed=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"cacheMode",get:function(){return this._cacheMode},set:function(t){this._cacheMode!==t&&(this._cacheMode=t,this._updateRichTextStatus())}},{key:"maxWidth",get:function(){return this._maxWidth},set:function(t){this._maxWidth!==t&&(this._maxWidth=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"lineHeight",get:function(){return this._lineHeight},set:function(t){this._lineHeight!==t&&(this._lineHeight=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"imageAtlas",get:function(){return this._imageAtlas},set:function(t){this._imageAtlas!==t&&(this._imageAtlas=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"handleTouchEvent",get:function(){return this._handleTouchEvent},set:function(t){this._handleTouchEvent!==t&&(this._handleTouchEvent=t,this.enabledInHierarchy&&(this.handleTouchEvent?this._addEventListeners():this._removeEventListeners()))}}]),e}(Vd)).HorizontalAlign=Xk,BH.VerticalAlign=jk,p((mH=BH).prototype,"horizontalAlign",[lH],Object.getOwnPropertyDescriptor(mH.prototype,"horizontalAlign"),mH.prototype),p(mH.prototype,"verticalAlign",[cH],Object.getOwnPropertyDescriptor(mH.prototype,"verticalAlign"),mH.prototype),p(mH.prototype,"font",[_H],Object.getOwnPropertyDescriptor(mH.prototype,"font"),mH.prototype),p(mH.prototype,"cacheMode",[fH],Object.getOwnPropertyDescriptor(mH.prototype,"cacheMode"),mH.prototype),p(mH.prototype,"imageAtlas",[dH],Object.getOwnPropertyDescriptor(mH.prototype,"imageAtlas"),mH.prototype),gH=Ss(mH.prototype,"_lineHeight",[ks],(function(){return 40})),yH=Ss(mH.prototype,"_string",[ks],(function(){return"<color=#00ff00>Rich</color><color=#0fffff>Text</color>"})),vH=Ss(mH.prototype,"_horizontalAlign",[ks],(function(){return Xk.LEFT})),SH=Ss(mH.prototype,"_verticalAlign",[ks],(function(){return jk.TOP})),AH=Ss(mH.prototype,"_fontSize",[ks],(function(){return 40})),TH=Ss(mH.prototype,"_maxWidth",[ks],(function(){return 0})),EH=Ss(mH.prototype,"_fontFamily",[ks],(function(){return"Arial"})),bH=Ss(mH.prototype,"_font",[ks],(function(){return null})),xH=Ss(mH.prototype,"_isSystemFontUsed",[ks],(function(){return!0})),CH=Ss(mH.prototype,"_userDefinedFont",[ks],(function(){return null})),RH=Ss(mH.prototype,"_cacheMode",[ks],(function(){return qk.NONE})),wH=Ss(mH.prototype,"_imageAtlas",[ks],(function(){return null})),IH=Ss(mH.prototype,"_handleTouchEvent",[ks],(function(){return!0})),pH=mH))||pH)||pH));v.RichText=UH;var zH=t("j",Is("cc.UIMeshRenderer")(VH=Ds(110)(VH=function(t){function e(){var e;return(e=t.call(this)||this)._modelComponent=null,e._dirtyVersion=-1,e._internalId=-1,e.stencilStage=SF.DISABLED,e._renderData=null,e._renderEntity=new MF(EF.DYNAMIC),e}s(e,t);var i=e.prototype;return i.__preload=function(){this.node._uiProps.uiComp=this},i.onEnable=function(){hN.addRenderer(this),this.markForUpdateRenderData()},i.onDisable=function(){hN.removeRenderer(this),this.renderEntity.enabled=this._canRender()},i.onLoad=function(){this.node._uiProps.uiTransformComp||this.node.addComponent("cc.UITransform"),this._modelComponent=this.getComponent("cc.ModelRenderer"),this._modelComponent?this.renderEntity.setNode(this.node):console.warn("node '"+(this.node&&this.node.name)+"' doesn't have any renderable component")},i.onDestroy=function(){this.renderEntity.setNode(null),this.node._uiProps.uiComp===this&&(this.node._uiProps.uiComp=null),this._modelComponent=this.getComponent("cc.ModelRenderer"),this._modelComponent&&(this._modelComponent._sceneGetter=null)},i._render=function(t){if(this._modelComponent){var e=this._modelComponent._collectModels();this._modelComponent._detachFromScene();for(var i=0;i<e.length;i++)e[i].enabled&&t.commitModel(this,e[i],this._modelComponent.material);return!0}return!1},i.fillBuffers=function(t){this.enabled&&this._render(t)},i.updateRenderer=function(){},i._uploadRenderData=function(){},i.postUpdateAssembler=function(){},i.update=function(){this._fitUIRenderQueue()},i._fitUIRenderQueue=function(){if(this._modelComponent)for(var t=this._modelComponent.sharedMaterials.length,e=0;e<t;e++){var i=this._modelComponent.getMaterialInstance(e);if(null!=i)for(var n=i.passes,r=n.length,s=0;s<r;s++)n[s].setPriority(Fm.MAX-11),i.recompileShaders({CC_FORCE_FORWARD_SHADING:!0},s)}},i.markForUpdateRenderData=function(){hN.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}(Vd))||VH)||VH);v.UIMeshRenderer=zH;var HH,WH,XH,jH,YH,qH,KH,JH,QH,ZH,$H=kp.Enum.NONE|kp.Enum.UI_3D,tW=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=$H,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=$H},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 DS(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}(),eW=t("m",Is("cc.UIStaticBatch")(HH=Ds(110)((p((WH=function(t){function e(){for(var e,i=arguments.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 tW;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 vN.root&&vN.root.batcher2D?vN.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}(gk)).prototype,"color",[ua],Object.getOwnPropertyDescriptor(WH.prototype,"color"),WH.prototype),HH=WH))||HH)||HH),iW=t("n",Is("cc.LabelShadow")(XH=Ds(110)(XH=Bs($k)((jH=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._color=YH&&YH(),e._offset=qH&&qH(),e._blur=KH&&KH(),e}s(e,t);var i=e.prototype;return i.onEnable=function(){this._updateRenderData()},i.onDisable=function(){this._updateRenderData()},i._updateRenderData=function(){var t=this.node.getComponent($k);t&&t.updateRenderData(!0)},n(e,[{key:"color",get:function(){return this._color},set:function(t){this._color!==t&&(this._color.set(t),this._updateRenderData())}},{key:"offset",get:function(){return this._offset},set:function(t){this._offset=t,this._updateRenderData()}},{key:"blur",get:function(){return this._blur},set:function(t){this._blur=t,this._updateRenderData()}}]),e}(Vd),YH=Ss(jH.prototype,"_color",[ks],(function(){return new Zi(0,0,0,255)})),qH=Ss(jH.prototype,"_offset",[ks],(function(){return new yn(2,2)})),KH=Ss(jH.prototype,"_blur",[ks],(function(){return 2})),XH=jH))||XH)||XH)||XH),nW=t("o",Is("cc.UIOpacity")(JH=Ds(110)(JH=Ps((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)._opacity=ZH&&ZH(),e}s(e,t);var i=e.prototype;return i.setEntityLocalOpacityDirtyRecursively=function(){},e.setEntityLocalOpacityDirtyRecursively=function(t,i,n){if(t.isValid){var r=t._uiProps.uiComp,s=t.getComponent(e),a=n;r&&r.color?(r.renderEntity.colorDirty=i,r.renderEntity.localOpacity=s?a*s.opacity/255:a,a=1):s&&(a=a*s.opacity/255);for(var o=0;o<t.children.length;o++)e.setEntityLocalOpacityDirtyRecursively(t.children[o],i||a<1,a)}},i.onEnable=function(){this.node._uiProps.localOpacity=this._opacity/255,this.setEntityLocalOpacityDirtyRecursively(!0)},i.onDisable=function(){this.node._uiProps.localOpacity=1,this.setEntityLocalOpacityDirtyRecursively(!0)},n(e,[{key:"opacity",get:function(){return this._opacity},set:function(t){this._opacity!==t&&(t=Le(t,0,255),this._opacity=t,this.node._uiProps.localOpacity=t/255,this.setEntityLocalOpacityDirtyRecursively(!0))}}]),e}(Vd),ZH=Ss(QH.prototype,"_opacity",[ks],(function(){return 255})),JH=QH))||JH)||JH)||JH);v.MaskComponent=rU,Jt(rU,"cc.MaskComponent"),v.LabelComponent=$k,Jt($k,"cc.LabelComponent"),v.LabelOutlineComponent=yU,Jt(yU,"cc.LabelOutlineComponent"),v.RichTextComponent=UH,Jt(UH,"cc.RichTextComponent"),v.SpriteComponent=ZV,Jt(ZV,"cc.SpriteComponent"),v.UIModelComponent=zH,Jt(zH,"cc.UIModelComponent"),v.GraphicsComponent=UV,Jt(UV,"cc.GraphicsComponent"),Jt(eW,"cc.UIStaticBatchComponent"),Jt(nW,"cc.UIOpacityComponent"),nt(rU.prototype,"Mask",[{name:"graphics",newName:"subComp",target:rU.prototype,targetName:"Mask"}]),nt($V,"MaskType",[{name:"RECT",newName:"GRAPHICS_RECT",target:$V,targetName:"MaskType"},{name:"ELLIPSE",newName:"GRAPHICS_ELLIPSE",target:$V,targetName:"MaskType"},{name:"IMAGE_STENCIL",newName:"SPRITE_STENCIL",target:$V,targetName:"MaskType"}]);var rW=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 sW(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=EW(s,t[s],t[s+1],a);else for(s=i-n;s>=e;s-=n)a=EW(s,t[s],t[s+1],a);return a&&vW(a,a.next)&&(bW(a),a=a.next),a}function aW(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||!vW(i,i.next)&&0!==yW(i.prev,i,i.next))i=i.next;else{if(bW(i),(i=e=i.prev)===i.next)return null;n=!0}}while(n||i!==e);return e}function oW(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=dW(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?uW(t,n,r,s):hW(t))e.push(h.i/i),e.push(t.i/i),e.push(u.i/i),bW(t),t=u.next,o=u.next;else if((t=u)===o){a?1===a?oW(t=lW(t,e,i),e,i,n,r,s,2):2===a&&cW(t,e,i,n,r,s):oW(aW(t),e,i,n,r,s,1);break}}}function hW(t){var e=t.prev,i=t,n=t.next;if(yW(e,i,n)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(mW(e.x,e.y,i.x,i.y,n.x,n.y,r.x,r.y)&&yW(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function uW(t,e,i,n){var r=t.prev,s=t,a=t.next;if(yW(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=dW(o,h,e,i,n),_=dW(u,l,e,i,n),f=t.nextZ;f&&f.z<=_;){if(f!==t.prev&&f!==t.next&&mW(r.x,r.y,s.x,s.y,a.x,a.y,f.x,f.y)&&yW(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(f=t.prevZ;f&&f.z>=c;){if(f!==t.prev&&f!==t.next&&mW(r.x,r.y,s.x,s.y,a.x,a.y,f.x,f.y)&&yW(f.prev,f,f.next)>=0)return!1;f=f.prevZ}return!0}function lW(t,e,i){var n=t;do{var r=n.prev,s=n.next.next;!vW(r,s)&&SW(r,n,n.next,s)&&AW(r,s)&&AW(s,r)&&(e.push(r.i/i),e.push(n.i/i),e.push(s.i/i),bW(n),bW(n.next),n=t=s),n=n.next}while(n!==t);return n}function cW(t,e,i,n,r,s){var a=t;do{for(var o=a.next.next;o!==a.prev;){if(a.i!==o.i&&gW(a,o)){var h=TW(a,o);return a=aW(a,a.next),h=aW(h,h.next),oW(a,e,i,n,r,s),void oW(h,e,i,n,r,s)}o=o.next}a=a.next}while(a!==t)}function _W(t,e){return t.x-e.x}function fW(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&&mW(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)&&AW(i,t)&&(a=i,_=h),i=i.next;return a}(t,e)){var i=TW(e,t);aW(i,i.next)}}function dW(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 pW(t){var e=t,i=t;do{e.x<i.x&&(i=e),e=e.next}while(e!==t);return i}function mW(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 gW(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&&SW(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&AW(t,e)&&AW(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 yW(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function vW(t,e){return t.x===e.x&&t.y===e.y}function SW(t,e,i,n){return!!(vW(t,e)&&vW(i,n)||vW(t,n)&&vW(i,e))||yW(t,e,i)>0!=yW(t,e,n)>0&&yW(i,n,t)>0!=yW(i,n,e)>0}function AW(t,e){return yW(t.prev,t,t.next)<0?yW(t,e,t.next)>=0&&yW(t,t.prev,e)>=0:yW(t,e,t.prev)<0||yW(t,t.next,e)<0}function TW(t,e){var i=new rW(t.i,t.x,t.y),n=new rW(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 EW(t,e,i,n){var r=new rW(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 bW(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 xW(t,e,i){i=i||3;var n=e?e.length:0,r=n?e[0]*i:t.length,s=sW(t,0,r,i,!0),a=[];if(!s)return a;var o=0,h=0,u=0,l=0,c=0,_=0,f=0;if(n&&(s=function(t,e,i,n){var r,s=[],a=0,o=null;for(a=0,r=e.length;a<r;a++)(o=sW(t,e[a]*n,a<r-1?e[a+1]*n:t.length,n,!1))&&(o===o.next&&(o.steiner=!0),s.push(pW(o)));if(s.sort(_W),!i)return i;for(a=0;a<s.length;a++)fW(s[a],i),i=aW(i,i.next);return i}(t,e,s,i)),t.length>80*i){o=u=t[0],h=l=t[1];for(var d=i;d<r;d+=i)(c=t[d])<o&&(o=c),(_=t[d+1])<h&&(h=_),c>u&&(u=c),_>l&&(l=_);f=Math.max(u-o,l-h)}return oW(s,a,i,o,h,f),a}for(var CW=Math.PI,RW=Math.min,wW=Math.max,IW=Math.ceil,BW=Math.acos,DW=Math.cos,PW=Math.sin,OW=Math.atan2,MW=null,NW=null,LW=new Zi,FW=[],kW=0;kW<4;kW++)FW.push(new Yi);function GW(t,e,i){return t<e?e:t>i?i:t}var VW={useModel:!0,updateRenderData:function(){},fillBuffers:function(){},renderIA:function(){},getRenderData:function(t,e){if(!NW)return null;var i=NW.getRenderDataList(),n=i[NW.dataOffset];if(!n)return null;var r=n,s=r?r.vertexStart+e:0;return(s>65535||3*s>131070)&&(++NW.dataOffset,NW.dataOffset<i.length?n=i[NW.dataOffset]:(n=NW.requestRenderData(),i[NW.dataOffset]=n),r=n),r&&r.vertexCount<s&&r.request(e,3*e),n},stroke:function(t){Zi.copy(LW,t.strokeColor),t.impl&&(this._flattenPaths(t.impl),this._expandStroke(t),t.impl.updatePathOffset=!0,this.end(t))},fill:function(t){Zi.copy(LW,t.fillColor),this._expandFill(t),t.impl&&(t.impl.updatePathOffset=!0),this.end(t)},end:function(t){t.markForUpdateRenderData()},_expandStroke:function(t){var e,i,n,r,s=.5*t.lineWidth,a=t.lineCap,o=t.lineJoin,h=t.miterLimit;if(NW=t.impl){var u=(e=s,i=CW,n=NW.tessTol,r=2*BW(e/(e+n)),wW(2,IW(i/r)));this._calculateJoins(NW,s,o,h);for(var l=NW.paths,c=0,_=NW.pathOffset,f=NW.pathLength;_<f;_++){var d=l[_],p=d.points.length;o===kG.ROUND?c+=2*(p+d.bevel*(u+2)+1):c+=2*(p+5*d.bevel+1),d.closed||(a===FG.ROUND?c+=2*(2*u+2):c+=12)}var m=MW=this.getRenderData(t,c);if(m){for(var g=m.vData,y=m.iData,v=NW.pathOffset,S=NW.pathLength;v<S;v++){var A=l[v],T=A.points,E=T.length,b=m.vertexStart,x=void 0,C=void 0,R=0,w=0,I=A.closed;if(I?(x=T[E-1],C=T[0],R=0,w=E):(x=T[0],C=T[1],R=1,w=E-1),C=C||x,!I){var B=new NV(C.x,C.y);B.subtract(x),B.normalize();var D=B.x,P=B.y;a===FG.BUTT?this._buttCapStart(x,D,P,s,0):a===FG.SQUARE?this._buttCapStart(x,D,P,s,s):a===FG.ROUND&&this._roundCapStart(x,D,P,s,u)}for(var O=R;O<w;++O)o===kG.ROUND?this._roundJoin(x,C,s,s,u):0!=(C.flags&(GG.PT_BEVEL|GG.PT_INNERBEVEL))?this._bevelJoin(x,C,s,s):(this._vSet(C.x+C.dmx*s,C.y+C.dmy*s,1),this._vSet(C.x-C.dmx*s,C.y-C.dmy*s,-1)),x=C,C=T[O+1];if(I){var M=8*b;this._vSet(g[M],g[M+1],1),this._vSet(g[M+8],g[M+8+1],-1)}else{var N=new NV(C.x,C.y);N.subtract(x),N.normalize();var L=N.x,F=N.y;a===FG.BUTT?this._buttCapEnd(C,L,F,s,0):a===FG.SQUARE?this._buttCapEnd(C,L,F,s,s):a===FG.ROUND&&this._roundCapEnd(C,L,F,s,u)}for(var k=m.indexStart,G=b+2,V=m.vertexStart;G<V;G++)y[k++]=G-2,y[k++]=G-1,y[k++]=G;m.indexStart=k}MW=null,NW=null}}},_expandFill:function(t){if(NW=t.impl){for(var e=NW.paths,i=0,n=NW.pathOffset,r=NW.pathLength;n<r;n++)i+=e[n].points.length;var s=MW=this.getRenderData(t,i);if(s){for(var a=s,o=a.vData,h=a.iData,u=NW.pathOffset,l=NW.pathLength;u<l;u++){var c=e[u],_=c.points,f=_.length;if(0!==f){for(var d=s.vertexStart,p=0;p<f;++p)this._vSet(_[p].x,_[p].y);var m=s.indexStart;if(c.complex){for(var g=[],y=d,v=s.vertexStart;y<v;y++){var S=8*y;g.push(o[S++]),g.push(o[S++]),g.push(o[S++])}var A=xW(g,null,3);if(!A||0===A.length)continue;for(var T=0,E=A.length;T<E;T++)h[m++]=A[T]+d}else for(var b=d,x=d+2,C=a.vertexStart;x<C;x++)h[m++]=b,h[m++]=x-1,h[m++]=x;a.indexStart=m}}MW=null,NW=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 f=0;f<l;f++){var d,p,m=c.dy,g=-c.dx,y=_.dy,v=-_.dx;if(_.dmx=.5*(m+y),_.dmy=.5*(g+v),(d=_.dmx*_.dmx+_.dmy*_.dmy)>1e-6){var S=1/d;S>600&&(S=600),_.dmx*=S,_.dmy*=S}_.dx*c.dy-c.dx*_.dy>0&&(_.flags|=GG.PT_LEFT),d*(p=wW(11,RW(c.len,_.len)*r))*p<1&&(_.flags|=GG.PT_INNERBEVEL),_.flags&GG.PT_CORNER&&(d*n*n<1||i===kG.BEVEL||i===kG.ROUND)&&(_.flags|=GG.PT_BEVEL),0!=(_.flags&(GG.PT_BEVEL|GG.PT_INNERBEVEL))&&h.bevel++,c=_,_=u[f+1]}}},_flattenPaths:function(t){for(var e=t.paths,i=t.pathOffset,n=t.pathLength;i<n;i++){var r=e[i],s=r.points,a=s[s.length-1],o=s[0];s.length>2&&a.equals(o)&&(r.closed=!0,s.pop(),a=s[s.length-1]);for(var h=0,u=s.length;h<u;h++){var l=new NV(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)*CW,c=DW(l)*n,_=PW(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)*CW,c=DW(l)*n,_=PW(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&GG.PT_LEFT)){var c=this._chooseBevel(e.flags&GG.PT_INNERBEVEL,t,e,i),_=c[0],f=c[1],d=c[2],p=c[3],m=OW(-a,-s),g=OW(-h,-o);g>m&&(g-=2*CW),this._vSet(_,f,1),this._vSet(u-s*n,e.y-a*n,-1);for(var y=GW(IW((m-g)/CW)*r,2,r),v=0;v<y;v++){var S=m+v/(y-1)*(g-m),A=u+DW(S)*n,T=l+PW(S)*n;this._vSet(u,l,0),this._vSet(A,T,-1)}this._vSet(d,p,1),this._vSet(u-o*n,l-h*n,-1)}else{var E=this._chooseBevel(e.flags&GG.PT_INNERBEVEL,t,e,-n),b=E[0],x=E[1],C=E[2],R=E[3],w=OW(a,s),I=OW(h,o);I<w&&(I+=2*CW),this._vSet(u+s*n,l+a*n,1),this._vSet(b,x,-1);for(var B=GW(IW((I-w)/CW)*r,2,r),D=0;D<B;D++){var P=w+D/(B-1)*(I-w),O=u+DW(P)*i,M=l+PW(P)*i;this._vSet(O,M,1),this._vSet(u,l,0)}this._vSet(u+o*n,l+h*n,1),this._vSet(C,R,-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,f=-t.dx,d=e.dy,p=-e.dx;if(e.flags&GG.PT_LEFT){var m=this._chooseBevel(e.flags&GG.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-f*n,-1),this._vSet(l,c,1),this._vSet(e.x-d*n,e.y-p*n,-1)}else{var g=this._chooseBevel(e.flags&GG.PT_INNERBEVEL,t,e,-n);r=g[0],s=g[1],a=g[2],o=g[3],this._vSet(e.x+_*i,e.y+f*i,1),this._vSet(r,s,-1),this._vSet(e.x+d*i,e.y+p*i,1),this._vSet(a,o,-1)}},_vSet:function(t,e,i){if(void 0===i&&(i=0),MW){var n=MW,r=8*n.vertexStart,s=n.vData;s[r++]=t,s[r++]=e,s[r++]=0,Zi.toArray(s,LW,r),r+=4,s[r++]=i,n.vertexStart++}}},UW=t("g",{getAssembler:function(){return VW}});UV.Assembler=UW;var zW=["left","center","right"],HW=2048,WW=(1/255).toFixed(3),XW=function(){this.char="",this.valid=!0,this.x=0,this.y=0,this.line=0,this.hash=""},jW=function(){function t(){this._context=null,this._canvas=null,this._canvasData=null,this._lettersInfo=[],this._tmpRect=new En,this._maxFontSize=100,this._fontScale=1,this._canvasData=KL.getInstance().get(),this._canvas=this._canvasData.canvas,this._context=this._canvasData.context}var e=t.prototype;return e.destroy=function(){KL.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),iF.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>HW||n.canvasSize.height>HW)&&a<=3;){if(++a>3)this._fontScale=1;else{var o=Math.max(n.canvasSize.width,n.canvasSize.height),h=HW/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 Yk.NONE:for(var o=0,h=0;h<r.length;++h){var u=HL(this._context,r[h],a);o=o>u?o:u}var l=o,c=(s.length+DL)*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 Yk.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 Yk.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 Yk.RESIZE_HEIGHT:this._calculateWrapText(r,t,e,i);var _=(i.parsedString.length+DL)*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,f=0|e.actualFontSize+1,d=0;_<f;){if((d=_+f+1>>1)<=0){j(4003);break}u=d,r=this._getFontDesc(u,e.fontFamily,e.isBold,e.isItalic),this._context.font=r;var p=this._getLineHeight(i.lineHeight,u,e.fontSize);for(o=0,a=0;a<t.length;++a){var m=HL(this._context,t[a],r);o+=YL(t[a],m,l,this._measureText(this._context,r)).length*p}o>c?f=d-1:_=d}0===_?j(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,y=n.canvasSize.height*this._fontScale/o;u=e.actualFontSize*Math.min(1,g,y)|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=HL(this._context,t[o],a),u=YL(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 HL(t,i,e)}},e._calculateParagraphLength=function(t,e,i){for(var n,r=[],s=f(t);!(n=s()).done;){var a=HL(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,HW),i.canvasSize.height=Math.min(i.canvasSize.height,HW),this._canvas.width=i.canvasSize.width,this._canvas.height=i.canvasSize.height,this._context.font=t.fontDesc,this._context.textAlign=zW[e.horizontalAlign],this._context.textBaseline="alphabetic"},e._calculateFillTextStartPosition=function(t,e,i){var n=0;e.horizontalAlign===Xk.RIGHT?n=i.canvasSize.width-i.canvasPadding.width:e.horizontalAlign===Xk.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-DL/2);if(e.verticalAlign!==jk.TOP){var a=r+i.canvasPadding.height+t.actualFontSize-i.canvasSize.height;e.verticalAlign===jk.BOTTOM?s-=a+=DL/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+", "+WW+")",this._context.fillRect(0,0,this._canvas.width,this._canvas.height)):(this._context.fillStyle="rgba("+t.color.r+", "+t.color.g+", "+t.color.b+", "+WW+")",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 yn(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 lL?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(Wf.CLAMP_TO_EDGE,Wf.CLAMP_TO_EDGE),t.texture instanceof lL&&(t.texture.rect=new En(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 yn;n.horizontalAlign===Xk.RIGHT?c.x=t.x-l:n.horizontalAlign===Xk.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:Zi.WHITE.clone()});e.length=i}},e._setupBMFontOverflowMetrics=function(t,e){var i=e.nodeContentSize.width,n=e.nodeContentSize.height;t.overFlow===Yk.RESIZE_HEIGHT&&(n=0),t.overFlow===Yk.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===Yk.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,f=0,d=null,p=0;p<a;){var m=s.charAt(p);if("\n"!==m){for(var g=r(t,e,s,p,a),y=_,v=f,S=c,A=h,T=!1,E=new yn,b=0;b<g;++b){var x=p+b;if("\r"!==(m=s.charAt(x)))if(d=iF.fontAtlas.getLetterDefinitionForChar(m,iF)){var C=A+d.offsetX*t.bmfontScale-iF.margin;if(e.wrapping&&e.maxLineWidth>0&&h>0&&C+d.w*t.bmfontScale>e.maxLineWidth&&!zL(m)){e.linesWidth.push(c),c=0,o++,h=0,u-=e.lineHeight*this._getFontScale(t,e)+0,T=!0;break}E.x=C,E.y=u-d.offsetY*t.bmfontScale,this._recordLetterInfo(E,m,x,o),x+1<e.horizontalKerning.length&&x<a-1&&(A+=e.horizontalKerning[x+1]*t.bmfontScale),A+=d.xAdvance*t.bmfontScale+e.spacingX,S=E.x+d.w*t.bmfontScale,y<E.y&&(y=E.y),v>E.y-d.h*t.bmfontScale&&(v=E.y-d.h*t.bmfontScale)}else this._recordPlaceholderInfo(x,m),F("Can't find letter definition in texture atlas "+t.fntConfig.atlasName+" for letter:"+m);else this._recordPlaceholderInfo(x,m)}T||(h=A,_<y&&(_=y),f>v&&(f=v),l<(c=S)&&(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*iF.margin),e.textHeightTemp<=0&&(i.nodeContentSize.height=parseFloat(e.textDesiredHeight.toFixed(2))+2*iF.margin),e.tailoredTopY=i.nodeContentSize.height,e.tailoredBottomY=0,_>0&&(e.tailoredTopY=i.nodeContentSize.height+_),f<-e.textDesiredHeight&&(e.tailoredBottomY=e.textDesiredHeight+f),!0},e._recordPlaceholderInfo=function(t,e){if(t>=this._lettersInfo.length){var i=new XW;this._lettersInfo.push(i)}this._lettersInfo[t].char=e,this._lettersInfo[t].hash=""+e.charCodeAt(0)+iF.hash,this._lettersInfo[t].valid=!1},e._recordLetterInfo=function(t,e,i,n){if(i>=this._lettersInfo.length){var r=new XW;this._lettersInfo.push(r)}var s=""+e.charCodeAt(0)+iF.hash;this._lettersInfo[i].line=n,this._lettersInfo[i].char=e,this._lettersInfo[i].hash=s,this._lettersInfo[i].valid=iF.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(UL(s)||"\n"===s||zL(s))return 1;var a=1,o=iF.fontAtlas.getLetterDefinitionForChar(s,iF);if(!o)return a;for(var h=o.xAdvance*t.bmfontScale+e.spacingX,u=n+1;u<r&&(s=i.charAt(u),o=iF.fontAtlas.getLetterDefinitionForChar(s,iF));++u){if(h+o.offsetX*t.bmfontScale+o.w*t.bmfontScale>e.maxLineWidth&&!zL(s)&&e.maxLineWidth>0)return a;if(h+=o.xAdvance*t.bmfontScale+e.spacingX,"\n"===s||zL(s)||UL(s))break;a++}return a},e._computeAlignmentOffset=function(t,e,i){switch(e.linesOffsetX.length=0,e.letterOffsetY=0,e.horizontalAlign){case Xk.LEFT:for(var n=0;n<e.numberOfLines;++n)e.linesOffsetX.push(0);break;case Xk.CENTER:for(var r=0,s=e.linesWidth.length;r<s;r++)e.linesOffsetX.push((i.nodeContentSize.width-e.linesWidth[r])/2);break;case Xk.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!==jk.TOP){var h=i.nodeContentSize.height-e.textDesiredHeight+e.lineHeight*this._getFontScale(t,e)-t.originFontSize*this._fontScale*t.bmfontScale;e.verticalAlign===jk.BOTTOM?e.letterOffsetY-=h:e.letterOffsetY-=h/2}},e._getFontScale=function(t,e){return e.overFlow===Yk.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=iF.fontAtlas.getLetterDefinitionForChar(h.char,iF);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:iF.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 _=iF.fontAtlas.getLetter(c.hash);if(_){this._tmpRect.height=_.h,this._tmpRect.width=_.w,this._tmpRect.x=_.u,this._tmpRect.y=_.v;var f=c.y+e.letterOffsetY;if(e.textHeightTemp>0){if(f>e.tailoredTopY){var d=f-e.tailoredTopY;this._tmpRect.y+=d,this._tmpRect.height-=d,f-=d}f-this._tmpRect.height*t.bmfontScale<e.tailoredBottomY&&e.overFlow===Yk.CLAMP&&(this._tmpRect.height=f<e.tailoredBottomY?0:(f-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===Yk.CLAMP&&(this._tmpRect.width=0),this._tmpRect.height>0&&this._tmpRect.width>0){var g=this._determineRect(t),y=c.x+e.linesOffsetX[c.line],v=n.quadCount;n.quadCount+=4,this.updateQuatCount(n),s(t,i,n,v,a,this._tmpRect,g,y-o,f-h)}}else k("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}();jW.instance=void 0,jW.instance=new jW;var YW,qW=new eF(64,64),KW=new wL(null),JW=null,QW=null,ZW=null,$W=null,tX={updateProcessingData:function(t,e,i,n,r,s){t.fontSize=r.fontSize,t.actualFontSize=r.fontSize,t.originFontSize=ZW?ZW.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===Yk.NONE?(e.wrapping=!1,i.nodeContentSize.width+=2*iF.margin,i.nodeContentSize.height+=2*iF.margin):a===Yk.RESIZE_HEIGHT?(e.wrapping=!0,i.nodeContentSize.height+=2*iF.margin):e.wrapping=r.enableWrapText,n.uiTransAnchorX=s.anchorX,n.uiTransAnchorY=s.anchorY,iF.lineHeight=r.lineHeight,iF.fontSize=r.fontSize,t.spriteFrame=$W,t.fntConfig=ZW,t.fontFamily=iF.fontFamily,t.color.set(r.color)},updateRenderData:function(t){if(t.renderData&&JW!==t){if(t.renderData.vertDirty){QW=(JW=t).node._uiProps.uiTransformComp;var e=t.renderData,i=jW.instance,n=t.textStyle,r=t.textLayout,s=t.textLayoutData,a=t.textRenderData;n.fontScale=gz.getScaleX(),this._updateFontFamily(t),this.updateProcessingData(n,r,s,a,t,QW),this._updateLabelInfo(t),n.fontDesc=iF.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(YW),JW.actualFontSize=n.actualFontSize,QW.setContentSize(s.nodeContentSize),this.updateUVs(t),this.updateColor(t),e.vertDirty=!1,JW=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,f=r.height,d=s.width,p=s.height,m=0,g=0,y=0,v=0;a?(m=s.x/_,v=(s.x+p)/_,g=(s.y+d)/f,y=s.y/f,c[u].u=m,c[u].v=y,c[u+1].u=m,c[u+1].v=g,c[u+2].u=v,c[u+2].v=y,c[u+3].u=v,c[u+3].v=g):(m=s.x/_,v=(s.x+d)/_,g=(s.y+p)/f,y=s.y/f,c[u].u=m,c[u].v=g,c[u+1].u=v,c[u+1].v=g,c[u+2].u=m,c[u+2].v=y,c[u+3].u=v,c[u+3].v=y),c[u].x=o,c[u].y=h-p*l,c[u+1].x=o+d*l,c[u+1].y=h-p*l,c[u+2].x=o,c[u+2].y=h,c[u+3].x=o+d*l,c[u+3].y=h},_updateFontFamily:function(t){var e=t.font;$W=e.spriteFrame,ZW=e.fntConfig,iF.fontAtlas=e.fontDefDictionary,iF.fontAtlas||(t.cacheMode===qk.CHAR?iF.fontAtlas=qW:iF.fontAtlas=KW),wN.packToDynamicAtlas(t,$W)},_updateLabelInfo:function(){iF.hash="",iF.margin=0},_resetProperties:function(){ZW=null,$W=null,iF.hash="",iF.margin=0},createQuadIndices:function(t){if(t%6==0){var e=t/6;YW=null,YW=new Uint16Array(t);for(var i=0,n=0;n<e;n++)YW[i++]=0+4*n,YW[i++]=1+4*n,YW[i++]=2+4*n,YW[i++]=1+4*n,YW[i++]=3+4*n,YW[i++]=2+4*n}else console.error("illegal index count!")}},eX=new Zi(255,255,255,255),iX={createData:function(t){var e=t.requestRenderData();return e.resize(0,0),e},fillBuffers:function(t){var e=t.node;eX.set(t.color),eX.a=255*e._uiProps.opacity,uf(e,0,t.renderData,eX)},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,f=i.height,d=0,p=0,m=0,g=0;n?(d=i.x/l,g=(i.x+f)/l,p=(i.y+_)/c,m=i.y/c,u[h].u=d,u[h].v=m,u[h+1].u=d,u[h+1].v=p,u[h+2].u=g,u[h+2].v=m,u[h+3].u=g,u[h+3].v=p):(d=i.x/l,g=(i.x+_)/l,p=(i.y+f)/c,m=i.y/c,u[h].u=d,u[h].v=p,u[h+1].u=g,u[h+1].v=p,u[h+2].u=d,u[h+2].v=m,u[h+3].u=g,u[h+3].v=m),u[h].x=r,u[h].y=s-f*a,u[h+1].x=r+_*a,u[h+1].y=s-f*a,u[h+2].x=r,u[h+2].y=s,u[h+3].x=r+_*a,u[h+3].y=s}}};kt(iX,tX);var nX=null,rX=Gt(tX,{getAssemblerData:function(){return nX||(nX=new eF(1024,1024)),nX.getTexture()},_updateFontFamily:function(t){iF.fontAtlas=nX,iF.fontFamily=this._getFontFamily(t);var e=t.getComponent(yU);e&&e.enabled?(iF.isOutlined=!0,iF.margin=e.width,iF.out=e.color.clone(),iF.out.a=e.color.a*t.color.a/255):(iF.isOutlined=!1,iF.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){iF.fontDesc=this._getFontDesc(),iF.color=t.color,iF.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}(iF)},_getFontDesc:function(){return iF.fontSize.toString()+"px "+iF.fontFamily}}),sX=new Zi(255,255,255,255),aX={createData:function(t){var e=t.requestRenderData();return e.resize(0,0),e},fillBuffers:function(t){if(t.renderData){var e=t.node;sX.a=255*e._uiProps.opacity,uf(e,0,t.renderData,sX)}},updateColor:function(){}};kt(aX,rX);var oX=$k.Overflow,hX={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===oX.NONE?e.wrapping=!1:r.overflow===oX.RESIZE_HEIGHT?e.wrapping=!0:e.wrapping=r.enableWrapText,t.isBold=r.isBold,t.isItalic=r.isItalic,t.isUnderline=r.isUnderline,t.underlineHeight=r.underlineHeight;var a=yU&&r.getComponent(yU);(a=a&&a.enabled&&a.width>0?a:null)?(t.isOutlined=!0,t.outlineColor.set(a.color),t.outlineWidth=a.width):t.isOutlined=!1;var o=iW&&r.getComponent(iW);(o=o&&o.enabled?o:null)?(t.hasShadow=!0,t.shadowColor.set(o.color),t.shadowBlur=o.blur,t.shadowOffsetX=o.offset.x,t.shadowOffsetY=o.offset.y):t.hasShadow=!1,t.color.set(r.color),n.texture=r.spriteFrame,n.uiTransAnchorX=s.anchorX,n.uiTransAnchorY=s.anchorY,e.horizontalAlign=r.horizontalAlign,e.verticalAlign=r.verticalAlign},getAssemblerData:function(){var t=$k._canvasPool.get();return t.canvas.width=t.canvas.height=1,t},resetAssemblerData:function(t){t&&$k._canvasPool.put(t)},updateRenderData:function(t){if(t.renderData){if(t.renderData.vertDirty){var e=t.node._uiProps.uiTransformComp,i=jW.instance,n=t.textStyle,r=t.textLayout,s=t.textLayoutData,a=t.textRenderData;n.fontScale=gz.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!==$k.CacheMode.BITMAP||e.canvasSize.width<=0||e.canvasSize.height<=0)){var i=t.ttfSpriteFrame;wN.packToDynamicAtlas(t,i)}},_resetDynamicAtlas:function(t){if(t.cacheMode===$k.CacheMode.BITMAP){var e=t.ttfSpriteFrame;wN.deleteAtlasSpriteFrame(e),e._resetDynamicAtlasFrame()}}},uX=Zi.WHITE.clone(),lX=Uint16Array.from([0,1,2,1,3,2]),cX={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++)Zi.toArray(i,uX,n),n+=9;return e.vertexRow=2,e.vertexCol=2,e.chunk.setIndexBuffer(lX),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,f=c.y,d=a.m03*_+a.m07*f+a.m15;d=d?1/d:1,s[0+(h=l*o)]=(a.m00*_+a.m04*f+a.m12)*d,s[h+1]=(a.m01*_+a.m05*f+a.m13)*d,s[h+2]=(a.m02*_+a.m06*f+a.m14)*d}var p=i.vertexOffset,m=i.meshBuffer,g=i.meshBuffer.iData,y=m.indexOffset;g[y++]=p,g[y++]=p+1,g[y++]=p+2,g[y++]=p+2,g[y++]=p+1,g[y++]=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(){}};kt(cX,hX);var _X=t("l",{getAssembler:function(t){var e=cX;return t.font instanceof IL?e=iX:t.cacheMode===$k.CacheMode.CHAR&&(e=aX),e}});$k.Assembler=_X;var fX,dX=ZV.FillType,pX=new fn,mX=Uint16Array.from([0,1,2,1,3,2]),gX={updateRenderData:function(t){var e=t.spriteFrame;wN.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,f=0,d=0,p=0,m=0,g=0;switch(n.isRotated()?(h=o.x/s,u=(o.y+o.width)/a,l=_=h,d=m=(o.x+o.height)/s,f=g=u,c=p=o.y/a):(h=o.x/s,u=(o.y+o.height)/a,l=d=h,_=m=(o.x+o.width)/s,c=f=u,p=g=o.y/a),t.fillType){case dX.HORIZONTAL:r[3]=l+(_-l)*e,r[4]=c+(f-c)*e,r[12]=l+(_-l)*i,r[13]=c+(f-c)*i,r[21]=d+(m-d)*e,r[22]=p+(g-p)*e,r[30]=d+(m-d)*i,r[31]=p+(g-p)*i;break;case dX.VERTICAL:r[3]=l+(d-l)*e,r[4]=c+(p-c)*e,r[12]=_+(m-_)*e,r[13]=f+(g-f)*e,r[21]=l+(d-l)*i,r[22]=c+(p-c)*i,r[30]=_+(m-_)*i,r[31]=f+(g-f)*i;break;default:J(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,f=0;switch(t.fillType){case dX.HORIZONTAL:f=u+(c-u)*i,u+=(c-u)*e,c=f;break;case dX.VERTICAL:f=l+(_-l)*i,l+=(_-l)*e,_=f;break;default:J(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.vertexRow=2,e.vertexCol=2,e.chunk.setIndexBuffer(mX);for(var i,n=f(e.data);!(i=n()).done;)i.value.z=0;return e},updateWorldVertexData:function(t,e){t.node.getWorldMatrix(pX);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=pX.m03*h+pX.m07*u+pX.m15;l=l?1/l:1,r[s=a*i]=(pX.m00*h+pX.m04*u+pX.m12)*l,r[s+1]=(pX.m01*h+pX.m05*u+pX.m13)*l,r[s+2]=(pX.m02*h+pX.m06*u+pX.m14)*l}},fillBuffers:function(t){var e=t.renderData,i=e.chunk;(t.node.hasChangedFlags||e.vertDirty)&&(this.updateWorldVertexData(t,i),e.vertDirty=!1),i.bufferId;var n=i.vertexOffset,r=i.meshBuffer,s=i.meshBuffer.iData,a=r.indexOffset;s[a++]=n,s[a++]=n+1,s[a++]=n+2,s[a++]=n+2,s[a++]=n+1,s[a++]=n+3,r.indexOffset+=6},updateColor:function(t){for(var e=t.renderData,i=e.chunk.vb,n=e.floatStride,r=5,s=t.color,a=s.r/255,o=s.g/255,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}},yX=2*Math.PI,vX=1e-6,SX=new fn,AX=[new yn,new yn,new yn,new yn],TX=new Array(4),EX=new Array(8),bX=[new yn,new yn,new yn,new yn],xX=[new yn,new yn,new yn,new yn],CX=new yn,RX=[new yn,new yn,new yn,new yn];function wX(t,e,i,n,r,s,a){var o=Math.sin(s);o=Math.abs(o)>vX?o:0;var h=Math.cos(s),u=0,l=0;if(0!==(h=Math.abs(h)>vX?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 f=r.x+l*(n-r.y);a[3].x=f,a[3].y=n}if((i-r.y)*o>0){var d=r.x+l*(i-r.y);a[1].x=d,a[1].y=i}}}function IX(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 BX(t,e,i,n,r){var s=TX,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,DX((i.x-a)/(h-a),(i.y-o)/(u-o),t,e),DX((n.x-a)/(h-a),(n.y-o)/(u-o),t,e+1),DX((r.x-a)/(h-a),(r.y-o)/(u-o),t,e+2)}function DX(t,e,i,n){var r=EX,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 PX={useModel:!1,createData:function(t){return t.requestRenderData()},updateRenderData:function(t){var e=t.spriteFrame;wN.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*=yX)+(s*=yX);!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=TX;l[0]=a,l[1]=o,l[2]=h,l[3]=u;var c=t.fillCenter,_=CX.x=Math.min(Math.max(0,c.x),1)*(h-a)+a,f=CX.y=Math.min(Math.max(0,c.y),1)*(u-o)+o;AX[0].x=AX[3].x=a,AX[1].x=AX[2].x=h,AX[0].y=AX[1].y=o,AX[2].y=AX[3].y=u;for(var d=0,p=RX;d<p.length;d++){var m=p[d];yn.set(m,0,0)}_!==l[0]&&yn.set(RX[0],3,0),_!==l[2]&&yn.set(RX[2],1,2),f!==l[1]&&yn.set(RX[1],0,1),f!==l[3]&&yn.set(RX[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=EX;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),wX(TX[0],TX[2],TX[1],TX[3],CX,r,bX),wX(TX[0],TX[2],TX[1],TX[3],CX,r+s,xX);for(var o=0,h=0;h<4;++h){var u=RX[h];if(u)if(s>=yX)i.dataLength=o+3,BX(n,o,CX,AX[u.x],AX[u.y]),o+=3;else{var l=IX(CX,AX[u.x]),c=IX(CX,AX[u.y]);c<l&&(c+=yX),l-=yX,c-=yX;for(var _=0;_<3;++_)l>=a||(l>=r?(i.dataLength=o+3,BX(n,o,CX,AX[u.x],c>=a?xX[h]:AX[u.y]),o+=3):c>r&&(c<=a?(i.dataLength=o+3,BX(n,o,CX,bX[h],AX[u.y]),o+=3):(i.dataLength=o+3,BX(n,o,CX,bX[h],xX[h]),o+=3))),l+=yX,c+=yX}}0===o&&(i.dataLength=0),i.resize(o,o),i.updateRenderData(t,e)}},createQuadIndices:function(t){fX=null,fX=new Uint16Array(t);for(var e=0,i=0;i<t;i++)fX[e++]=i},fillBuffers:function(t){var e=t.node,i=t.renderData,n=i.chunk;(e.hasChangedFlags||i.vertDirty)&&(this.updateWorldVertexAndUVData(t,n),i.vertDirty=!1),this.updateColorLate(t),n.bufferId;for(var r=n.vertexOffset,s=n.meshBuffer,a=n.meshBuffer.iData,o=s.indexOffset,h=0;h<i.indexCount;h++)a[o+h]=r+h;s.indexOffset+=i.indexCount,s.setDirty()},updateWorldUVData:function(t){for(var e=t.renderData,i=e.floatStride,n=e.data,r=e.chunk.vb,s=0;s<n.length;s++){var a=s*i;r[a+3]=n[s].u,r[a+4]=n[s].v}},updateWorldVertexAndUVData:function(t,e){t.node.getWorldMatrix(SX);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,_=SX.m03*l+SX.m07*c+SX.m15;_=_?1/_:1,s[o+0]=(SX.m00*l+SX.m04*c+SX.m12)*_,s[o+1]=(SX.m01*l+SX.m05*c+SX.m13)*_,s[o+2]=(SX.m02*l+SX.m06*c+SX.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(){}},OX=Uint16Array.from([0,1,2,1,3,2]),MX={createData:function(t){var e=t.requestRenderData();return e.dataLength=4,e.resize(4,6),e.vertexRow=2,e.vertexCol=2,e.chunk.setIndexBuffer(OX),e},updateRenderData:function(t){var e=t.spriteFrame;wN.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,f=s.m03*c+s.m07*_+s.m15;f=f?1/f:1,n[0+(o=u*a)]=(s.m00*c+s.m04*_+s.m12)*f,n[o+1]=(s.m01*c+s.m05*_+s.m13)*f,n[o+2]=(s.m02*c+s.m06*_+s.m14)*f}},fillBuffers:function(t){if(null!==t){var e=t.renderData,i=e.chunk;(t.node.hasChangedFlags||e.vertDirty)&&(this.updateWorldVerts(t,i),e.vertDirty=!1),i.bufferId;for(var n=i.vertexOffset,r=i.meshBuffer,s=i.meshBuffer.iData,a=r.indexOffset,o=0;o<e.vertexRow-1;o++)for(var h=0;h<e.vertexCol-1;h++){var u=n+o*e.vertexCol+h;s[a++]=u,s[a++]=u+1,s[a++]=u+e.vertexCol,s[a++]=u+1,s[a++]=u+1+e.vertexCol,s[a++]=u+e.vertexCol,r.indexOffset+=6}}},updateVertexData:function(t){var e=t.renderData;if(e){var i=t.node._uiProps.uiTransformComp,n=e.data,r=i.width,s=i.height,a=i.anchorX*r,o=i.anchorY*s,h=0,u=0,l=0,c=0;if(t.trim)h=-a,u=-o,l=r-a,c=s-o;else{var _=t.spriteFrame,f=_.originalSize,d=r/f.width,p=s/f.height,m=_.trimmedBorder;h=m.x*d-a,u=m.z*p-o,l=r+m.y*d-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}},NX=new fn,LX=[],FX=0;FX<4;FX++)LX.push({x:0,y:0,z:0,u:0,v:0,color:new Zi});var kX,GX,VX,UX,zX,HX,WX,XX,jX={createData:function(t){var e=t.requestRenderData();return e.dataLength=16,e.resize(16,54),e.vertexRow=4,e.vertexCol=4,this.QUAD_INDICES=new Uint16Array(54),this.createQuadIndices(4,4),e.chunk.setIndexBuffer(this.QUAD_INDICES),e},createQuadIndices:function(t,e){for(var i=0,n=0;n<t-1;n++)for(var r=0;r<e-1;r++){var s=n*e+r;this.QUAD_INDICES[i++]=s,this.QUAD_INDICES[i++]=s+1,this.QUAD_INDICES[i++]=s+e,this.QUAD_INDICES[i++]=s+1,this.QUAD_INDICES[i++]=s+1+e,this.QUAD_INDICES[i++]=s+e}},updateRenderData:function(t){var e=t.spriteFrame;wN.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,f=r-u-l,d=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,f=f<0?0:f,d=d<0?0:d,LX[0].x=-a,LX[0].y=-o,LX[1].x=u*p-a,LX[1].y=_*m-o,LX[2].x=LX[1].x+f,LX[2].y=LX[1].y+d,LX[3].x=r-a,LX[3].y=s-o;for(var g=0;g<e.vertexRow;g++)for(var y=0;y<e.vertexCol;y++){var v=g*e.vertexCol+y;v<e.dataLength&&g<LX.length&&y<LX.length&&(i[v].x=LX[y].x,i[v].y=LX[g].y)}},fillBuffers:function(t){var e=t.renderData,i=e.chunk;(t.node.hasChangedFlags||e.vertDirty)&&(this.updateWorldVertexData(t,i),e.vertDirty=!1),i.bufferId;for(var n=i.vertexOffset,r=i.meshBuffer,s=i.meshBuffer.iData,a=r.indexOffset,o=0;o<3;++o)for(var h=0;h<3;++h){var u=n+4*o+h;s[a++]=u,s[a++]=u+1,s[a++]=u+4,s[a++]=u+1,s[a++]=u+5,s[a++]=u+4}r.indexOffset=a},updateWorldVertexData:function(t,e){t.node.getWorldMatrix(NX);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,_=NX.m03*l+NX.m07*c+NX.m15;_=_?1/_:1,s[0+(a=(4*o+u)*n)]=(NX.m00*l+NX.m04*c+NX.m12)*_,s[a+1]=(NX.m01*l+NX.m05*c+NX.m13)*_,s[a+2]=(NX.m02*l+NX.m06*c+NX.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}},YX=new fn,qX=0,KX=[];function JX(t){return t&&(t.insetTop>0||t.insetBottom>0||t.insetLeft>0||t.insetRight>0)?2:0}var QX={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,f=r-o-h,d=s-l-c;f=f>0?f:0,d=d>0?d:0;var p=0===u?f:f/u,m=0===_?d:d/_,g=JX(i),y=Math.ceil(m+g),v=Math.ceil(p+g);e.dataLength=4*y*v,this.updateVerts(t,f,d,y,v),e.vertexCount!==y*v*4&&(t.renderEntity.colorDirty=!0),e.resize(y*v*4,y*v*6),e.updateRenderData(t,i)}},createQuadIndices:function(t){if(t%6==0){var e=t/6;XX=null,XX=new Uint16Array(t);for(var i=0,n=0;n<e;n++)XX[i++]=0+4*n,XX[i++]=1+4*n,XX[i++]=2+4*n,XX[i++]=1+4*n,XX[i++]=3+4*n,XX[i++]=2+4*n}else console.error("illegal index count!")},updateUVs:function(t){t.renderData.vertDirty=!0,t.markForUpdateRenderData()},fillBuffers:function(t){var e=t.node,i=t.renderData,n=i.chunk;(e.hasChangedFlags||i.vertDirty)&&(this.updateWorldVertexAndUVData(t,n),i.vertDirty=!1),this.updateColorLate(t),n.bufferId;for(var r=n.vertexOffset,s=n.meshBuffer,a=n.meshBuffer.iData,o=s.indexOffset,h=0;h<i.indexCount;h+=6)a[o++]=r,a[o++]=r+1,a[o++]=r+2,a[o++]=r+1,a[o++]=r+3,a[o++]=r+2,r+=4,s.indexOffset+=6;s.setDirty()},updateWorldUVData:function(t){for(var e=t.renderData,i=e.floatStride,n=e.data,r=e.chunk.vb,s=0;s<n.length;s++){var a=s*i;r[a+3]=n[s].u,r[a+4]=n[s].v}},updateWorldVertexAndUVData:function(t,e){t.node.getWorldMatrix(YX);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=YX.m03*h+YX.m07*u+YX.m11*l+YX.m15;c=c?1/c:1;var _=o*n;s[_]=(YX.m00*h+YX.m04*u+YX.m08*l+YX.m12)*c,s[_+1]=(YX.m01*h+YX.m05*u+YX.m09*l+YX.m13)*c,s[_+2]=(YX.m02*h+YX.m06*u+YX.m10*l+YX.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),f=o.anchorX*c,d=o.anchorY*_,p=u.insetLeft,m=u.insetRight,g=l.width-p-m,y=u.insetTop,v=u.insetBottom,S=l.height-y-v,A=o.width/(p+m)>1?1:o.width/(p+m),T=o.height/(y+v)>1?1:o.height/(y+v);s=g>0?Math.floor(1e3*e)/1e3%g==0?g:e%g:e,a=S>0?Math.floor(1e3*i)/1e3%S==0?S:i%S:i,KX.length=0,qX=Math.max(n+1,r+1);for(var E=0;E<qX;E++)KX.push({x:0,y:0,z:0,u:0,v:0,color:new Zi});var b=JX(u);if(0===b)for(var x=0;x<qX;x++)KX[x].x=x>=r?c-f:x*g-f,KX[x].y=x>=n?_-d:x*S-d;else for(var C=0;C<qX;C++)0===C?KX[C].x=-f:1===C?KX[C].x=p*A-f:C>1&&C<r-1?KX[C].x=g>0?p*A-f+g*(C-1):p+e-f:C===r-1?KX[C].x=p*A-f+s+g*(C-2):C>=r&&(KX[C].x=Math.min(p+e+m,c)-f),0===C?KX[C].y=-d:1===C?KX[C].y=v*T-d:C>1&&C<n-1?KX[C].y=S>0?v*T-d+S*(C-1):v+i-d:C===n-1?KX[C].y=v*T-d+a+S*(C-2):C>=n&&(KX[C].y=Math.min(v+i+y,_)-d);for(var R=0,w=0,I=0,B=0,D=0;D<n;++D){I=KX[D].y,B=KX[D+1].y;for(var P=0;P<r;++P){R=KX[P].x,w=KX[P+1].x;var O=4*(D*r+P);h[O].x=R,h[O].y=I,h[O+1].x=w,h[O+1].y=I,h[O+2].x=R,h[O+2].y=B,h[O+3].x=w,h[O+3].y=B}}var M=u.rotated;u.uv;var N=u.uvSliced;kX=N[0],GX=N[1],VX=N[2],UX=N[3],zX=N[4],HX=N[8],WX=N[12];for(var L=0,F=0,k=0===g?e:e/g,G=0===S?i:i/S,V=[],U=[],z=0;z<n;++z){F=i>S?i>=(b>0?z:z+1)*S?1:G%1:G;for(var H=0;H<r;++H){L=e>g?e>=(b>0?H:H+1)*g?1:k%1:k,M?(0===b?(V[0]=zX.u,V[1]=zX.u,V[2]=zX.u+(HX.u-zX.u)*F,U[0]=GX.v,U[1]=GX.v+(VX.v-GX.v)*L,U[2]=GX.v):(0===z?(V[0]=kX.u,V[1]=kX.u,V[2]=zX.u):z<n-1?(V[0]=zX.u,V[1]=zX.u,V[2]=zX.u+(HX.u-zX.u)*F):z===n-1&&(V[0]=HX.u,V[1]=HX.u,V[2]=WX.u),0===H?(U[0]=kX.v,U[1]=GX.v,U[2]=kX.v):H<r-1?(U[0]=GX.v,U[1]=GX.v+(VX.v-GX.v)*L,U[2]=GX.v):H===r-1&&(U[0]=VX.v,U[1]=UX.v,U[2]=VX.v)),V[3]=V[2],U[3]=U[1]):(0===b?(V[0]=GX.u,V[1]=GX.u+(VX.u-GX.u)*L,V[2]=GX.u,U[0]=zX.v,U[1]=zX.v,U[2]=zX.v+(HX.v-zX.v)*F):(0===H?(V[0]=kX.u,V[1]=GX.u,V[2]=kX.u):H<r-1?(V[0]=GX.u,V[1]=GX.u+(VX.u-GX.u)*L,V[2]=GX.u):H===r-1&&(V[0]=VX.u,V[1]=UX.u,V[2]=VX.u),0===z?(U[0]=kX.v,U[1]=kX.v,U[2]=zX.v):z<n-1?(U[0]=zX.v,U[1]=zX.v,U[2]=zX.v+(HX.v-zX.v)*F):z===n-1&&(U[0]=HX.v,U[1]=HX.v,U[2]=WX.v)),V[3]=V[1],U[3]=U[2]);var W=4*(z*r+H);h[W].u=V[0],h[W].v=U[0],h[W+1].u=V[1],h[W+1].v=U[1],h[W+2].u=V[2],h[W+2].v=U[2],h[W+3].u=V[3],h[W+3].v=U[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(){}},ZX=ZV.Type,$X=ZV.FillType,tj=t("s",{getAssembler:function(t){var e=MX,i=t;switch(i.type){case ZX.SLICED:e=jX;break;case ZX.TILED:e=QX;break;case ZX.FILLED:e=i.fillType===$X.RADIAL?PX:gX}return e}});ZV.Assembler=tj;var ej=[BC.EventType.MOUSE_DOWN,BC.EventType.MOUSE_MOVE,BC.EventType.MOUSE_UP,BC.EventType.MOUSE_WHEEL],ij=[BC.EventType.TOUCH_START,BC.EventType.TOUCH_MOVE,BC.EventType.TOUCH_END,BC.EventType.TOUCH_CANCEL];new(function(){function t(){this.priority=vC.UI,this._isListDirty=!1,this._inDispatchCount=0,this._pointerEventProcessorList=[],this._processorListToAdd=[],this._processorListToRemove=[],DC._registerEventDispatcher(this),uM.callbacksInvoker.on(iM.ADD_POINTER_EVENT_PROCESSOR,this.addPointerEventProcessor,this),uM.callbacksInvoker.on(iM.REMOVE_POINTER_EVENT_PROCESSOR,this.removePointerEventProcessor,this),uM.callbacksInvoker.on(iM.MARK_LIST_DIRTY,this._markListDirty,this)}var e=t.prototype;return e.dispatchEvent=function(t){var e=t.type;return ij.includes(e)?this.dispatchEventTouch(t):!ej.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),oe(this._processorListToRemove,t)},e.removePointerEventProcessor=function(t){0===this._inDispatchCount?(oe(this._pointerEventProcessorList,t),this._isListDirty=!0):this._processorListToRemove.includes(t)||this._processorListToRemove.push(t),oe(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===Nx.TOUCH_START){if(a._handleEventTouch(t)){if(a.claimedTouchIdList.push(n.getID()),r=!1,!t.preventSwallow)break;t.preventSwallow=!1}}else if(a.claimedTouchIdList.length>0){var o=a.claimedTouchIdList.indexOf(n.getID());if(-1!==o){if(a._handleEventTouch(t),t.type!==Nx.TOUCH_END&&t.type!==Nx.TOUCH_CANCEL||se(a.claimedTouchIdList,o),r=!1,!t.preventSwallow)break;t.preventSwallow=!1}}}return--this._inDispatchCount<=0&&this._updatePointerEventProcessorList(),r},e._updatePointerEventProcessorList=function(){for(var t=this._processorListToAdd,e=t.length,i=0;i<e;++i)this.addPointerEventProcessor(t[i]);t.length=0;for(var n=this._processorListToRemove,r=n.length,s=0;s<r;++s)this.removePointerEventProcessor(n[s]);n.length=0},e._sortPointerEventProcessorList=function(){if(this._isListDirty){for(var t=this._pointerEventProcessorList,e=t.length,i=0;i<e;++i){var n=t[i],r=n.node;if(r._uiProps){var s=r._uiProps.uiTransformComp;n.cachedCameraPriority=s.cameraPriority}}t.sort(this._sortByPriority),this._isListDirty=!1}},e._sortByPriority=function(t,e){var i=t.node,n=e.node;if(!(e&&n&&n.activeInHierarchy&&n._uiProps.uiTransformComp))return-1;if(!(t&&i&&i.activeInHierarchy&&i._uiProps.uiTransformComp))return 1;if(t.cachedCameraPriority!==e.cachedCameraPriority)return e.cachedCameraPriority-t.cachedCameraPriority;for(var r=i,s=n,a=!1;(null===(o=r.parent)||void 0===o?void 0:o.uuid)!==(null===(h=s.parent)||void 0===h?void 0:h.uuid);){var o,h,u,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 f=r?r.getSiblingIndex():0,d=s?s.getSiblingIndex():0;return a?f-d:d-f},e._markListDirty=function(){this._isListDirty=!0},t}());var nj=new s_(null),rj=new fn,sj=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 KS,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 oj,this._meshDataArray=[],this._maskClearModel=null,this._maskClearMtl=null,this._maskModelMesh=null,this._root=t,this.device=t.device,this._batches=new du(64),this._drawBatchPool=new _u((function(){return new tW}),128,(function(t){return t.destroy(e)}))}var e=t.prototype;return e.initialize=function(){return!0},e.destroy=function(){for(var t=0;t<this._batches.length;t++)this._batches.array[t]&&this._batches.array[t].destroy(this);this._batches.destroy();for(var e,i=f(this._bufferAccessors.values());!(e=i()).done;)e.value.destroy();this._bufferAccessors.clear(),this._drawBatchPool&&this._drawBatchPool.destroy(),this._descriptorSetCache.destroy(),wF.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=f(this._bufferAccessors.values());!(i=n()).done;){var r=i.value;r.uploadBuffers(),r.reset()}this._descriptorSetCache.update()}},e.reset=function(){for(var t=0;t<this._batches.length;++t){var e=this._batches.array[t];e.isStatic||(e.clear(),this._drawBatchPool.free(e))}for(var i,n=f(this._bufferAccessors.values());!(i=n()).done;)i.value.reset();for(var r=this._meshDataArray.length,s=0;s<r;s++)this._meshDataArray[s].freeIAPool();this._meshDataArray.length=0,this._staticVBBuffer=null,this._currBID=-1,this._indexStart=0,this._currHash=0,this._currLayer=0,this._currRenderData=null,this._currMaterial=this._emptyMaterial,this._currTexture=null,this._currSampler=null,this._currComponent=null,this._currTransform=null,this._batches.clear(),wF.sharedManager.reset()},e.switchBufferAccessor=function(t){void 0===t&&(t=sF);var e=t===sF?36:lF(t);if(!this._staticVBBuffer||this._staticVBBuffer.vertexFormatBytes!==e){var i=this._bufferAccessors.get(e);i||(i=new vF(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===SF.ENTER_LEVEL||t.stencilStage===SF.ENTER_LEVEL_INVERTED?this._insertMaskBatch(t):t.stencilStage=wF.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=wF.sharedManager.stage,s=null!==t.customMaterial?wF.sharedManager.getStencilStage(t.stencilStage,n):wF.sharedManager.getStencilStage(t.stencilStage),a=wF.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===SF.ENTER_LEVEL||t.stencilStage===SF.ENTER_LEVEL_INVERTED?this._insertMaskBatch(t):t.stencilStage=wF.sharedManager.stage,n=wF.sharedManager.getStencilStage(t.stencilStage,i),r=wF.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){var h,u=0;t&&(h=null!==t.customMaterial?wF.sharedManager.getStencilStage(t.stencilStage,e):wF.sharedManager.getStencilStage(t.stencilStage),u=wF.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=wF.sharedManager.stage,e=null!==t.customMaterial?wF.sharedManager.getStencilStage(t.stencilStage,this._currMaterial):wF.sharedManager.getStencilStage(t.stencilStage),i=wF.sharedManager.getStencilHash(t.stencilStage);var n=this._currStaticRoot?this._currStaticRoot._requireDrawBatch():this._drawBatchPool.alloc();n.visFlags=t.node.layer;var r=this._middlewareBuffer.requireFreeIA(this.device);r.firstIndex=this._middlewareIndexStart,r.indexCount=this._middlewareIndexCount,n.inputAssembler=r,n.useLocalData=this._currTransform,n.texture=this._currTexture,n.sampler=this._currSampler,n.textureHash=this._currTextureHash,n.samplerHash=this._currSamplerHash,n.fillPasses(this._currMaterial||null,e,i,null),this._batches.push(n),this._currIsMiddleware=!1,this._middlewareBuffer=null},e.forceMergeBatches=function(t,e,i){this._currMaterial=t,e?(this._currTexture=e.getGFXTexture(),this._currSampler=e.getGFXSampler(),this._currTextureHash=e.getHash(),this._currSamplerHash=this._currSampler.hash):(this._currTexture=this._currSampler=null,this._currTextureHash=this._currSamplerHash=0),this._currLayer=i.node.layer,this.autoMergeBatches(i)},e.resetRenderStates=function(){this._currMaterial=this._emptyMaterial,this._currRenderData=null,this._currTexture=null,this._currComponent=null,this._currTransform=null,this._currTextureHash=0,this._currSamplerHash=0,this._currLayer=0},e.finishMergeBatches=function(){this.autoMergeBatches(),this.resetRenderStates()},e.flushMaterial=function(t){this._currMaterial=t},e.walk=function(t,e){if(void 0===e&&(e=0),t.activeInHierarchy){var i=t.children,n=t._uiProps,r=n.uiComp,s=this._pOpacity,a=s,o=r&&r.color?r.color.a/255:1;if(this._pOpacity=a*=o*n.localOpacity,n.setOpacity(a),!Ei(a,0,Ai)){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=m_[i.format]).hasAlpha)if(r=t.floatStride,n.size/n.count==1)for(var u=~~bi(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===SF.ENTER_LEVEL||r.stencilStage===SF.ENTER_LEVEL_INVERTED)&&wF.sharedManager.getMaskStackSize()>0&&(this.autoMergeBatches(this._currComponent),this.resetRenderStates(),wF.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=xS.get("default-clear-stencil"),this._maskClearModel=v.director.root.createModel(wR);var t=lF(nF),e=of.gfxDevice,i=e.createBuffer(new wc(wl.VERTEX|wl.TRANSFER_DST,Dl.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 wc(wl.INDEX|wl.TRANSFER_DST,Dl.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 yw([i],nF,Ql.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=wF.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}()),aj=function(){function t(){this._descriptorSet=null,this._transform=null,this._textureHash=0,this._samplerHash=0,this._localBuffer=null,this._transformUpdate=!0;var t=of.gfxDevice;this._localData=new Float32Array(dg.COUNT),this._localBuffer=t.createBuffer(new wc(wl.UNIFORM|wl.TRANSFER_DST,Dl.HOST|Dl.DEVICE,dg.SIZE,dg.SIZE))}var e=t.prototype;return e.initialize=function(t){var e=of.gfxDevice;this._transform=t.useLocalData,this._textureHash=t.textureHash,this._samplerHash=t.samplerHash,nj.layout=t.passes[0].localSetLayout,this._descriptorSet=e.createDescriptorSet(nj),this._descriptorSet.bindBuffer(dg.BINDING,this._localBuffer);var i=Wm.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;fn.toArray(this._localData,e,dg.MAT_WORLD_OFFSET),fn.invert(rj,e),fn.transpose(rj,rj);var i=fn.determinant(rj),n=1/Math.sqrt(i);fn.multiplyScalar(rj,rj,n),fn.toArray(this._localData,rj,dg.MAT_WORLD_IT_OFFSET),this._localBuffer.update(this._localData),this._transformUpdate=!1}},n(t,[{key:"descriptorSet",get:function(){return this._descriptorSet}}]),t}(),oj=function(){function t(){this._descriptorSetCache=new Map,this._dsCacheHashByTexture=new Map,this._localDescriptorSetCache=[],this._localCachePool=void 0,this._localCachePool=new _u((function(){return new aj}),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);nj.layout=t.passes[0].localSetLayout;var o=of.gfxDevice.createDescriptorSet(nj),h=Wm.SAMPLER_SPRITE;return o.bindTexture(h,t.texture),o.bindSampler(h,t.sampler),o.update(),this._descriptorSetCache.set(e,o),this._dsCacheHashByTexture.set(t.textureHash,e),o},e.update=function(){var t=this._localDescriptorSetCache,e=t.length;if(0!==e){for(var i=[],n=0;n<e;n++){var r=t[n];if(r.isValid())r.uploadLocalData();else{r.reset();var s=t.indexOf(r);i.push(s)}}for(var a=i.length-1;a>=0;a--){var o=i[a],h=t[o];t.splice(o,1),this._localCachePool.free(h)}}},e.reset=function(){for(var t=this._localDescriptorSetCache,e=t.length,i=0;i<e;i++){var n=t[i];this._localCachePool.free(n)}this._localDescriptorSetCache.length=0},e.releaseDescriptorSetCache=function(t){var e=this._dsCacheHashByTexture.get(t);e&&this._descriptorSetCache.has(e)&&(this._descriptorSetCache.get(e).destroy(),this._descriptorSetCache.delete(e),this._dsCacheHashByTexture.delete(t))},e.destroy=function(){for(var t,e=f(this._descriptorSetCache.values());!(t=e()).done;)t.value.destroy();this._descriptorSetCache.clear(),this._dsCacheHashByTexture.clear(),this._localDescriptorSetCache.length=0,this._localCachePool.destroy()},t}();v.internal.Batcher2D=sj,t("x",function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(tW)),st(pF.prototype,"MeshBuffer",["byteStart","vertexStart","indicesStart","request"].map((function(t){return{name:t,suggest:"please use meshBuffer.accessor."+t+" instead"}}))),nt(pF.prototype,"MeshBuffer",[{name:"indicesOffset",newName:"indexOffset"}]),rt(pF.prototype,"MeshBuffer",[{name:"vertexBuffers"},{name:"indexBuffer"}]),nt(sj.prototype,"Batcher2D",[{name:"currBufferBatch",newName:"currBufferAccessor"},{name:"acquireBufferBatch",newName:"switchBufferAccessor"}]),rt(kF.prototype,"MeshRenderData",[{name:"formatByte"},{name:"byteStart"},{name:"byteCount"}]),nt(kF.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}(kF));var hj,uj=A.document,lj=null,cj=-1,_j="BES bswy:->@123丁ぁᄁ",fj=Object.create(null),dj=[],pj=3e3;function mj(){for(var t=!0,e=Date.now(),i=dj.length-1;i>=0;i--){var n=dj[i],r=n.fontFamilyName;if(e-n.startTime>pj)q(4933,r),n.onComplete(null,r),dj.splice(i,1);else{var s=n.refWidth,a="40px "+r;lj.font=a,s!==HL(lj,_j,a)?(dj.splice(i,1),n.onComplete(null,r)):t=!1}}t&&(clearInterval(cj),cj=-1)}function gj(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(fj[n])i(null,n);else{if(!lj){var r=uj.createElement("canvas");r.width=100,r.height=100,lj=r.getContext("2d")}var s=HL(lj,_j,"40px "+n),a=uj.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+"}",uj.body.appendChild(a);var h=uj.createElement("div"),u=h.style;if(u.fontFamily=n,h.innerHTML=".",u.position="absolute",u.left="-100px",u.top="-100px",uj.body.appendChild(h),function(){if(void 0===hj)if("FontFace"in A){var t=/Gecko.*Firefox\/(\d+)/.exec(A.navigator.userAgent),e=/OS X.*Version\/10\..*Safari/.exec(A.navigator.userAgent)&&/Apple/.exec(A.navigator.vendor);hj=t?parseInt(t[1],10)>42:!e}else hj=!1;return hj}())!function(t,e,i){var n=new Promise((function(i,n){!function r(){Date.now()-t>=pj?n():uj.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,pj)}));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:s,onComplete:i,startTime:Date.now()};dj.push(l),-1===cj&&(cj=setInterval(mj,100))}fj[n]=a}}function yj(t,e,i,n){var r=new xL;r._nativeUrl=t,r._nativeAsset=e,n(null,r)}Wv.register({".font":gj,".eot":gj,".ttf":gj,".woff":gj,".svg":gj,".ttc":gj}),iS.register({".font":yj,".eot":yj,".ttf":yj,".woff":yj,".svg":yj,".ttc":yj}),v.UI={MeshBuffer:pF,spriteAssembler:tj,graphicsAssembler:UW,labelAssembler:_X,RenderData:FF,MeshRenderData:kF},xN.on(bN.EVENT_POST_SUBSYSTEM_INIT,(function(){xj.init()}));var vj,Sj,Aj,Tj,Ej,bj,xj=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):J(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):J(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 J(2106),0},t.isLayerValid=function(t){return!!this.indexMap.has(t)||(J(2105),!1)},t.getBuiltinLayers=function(){return[{id:0,name:"default",value:0}]},t.init=function(){var e=Ee.querySettings(Te.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}me.update(t.Enum),me.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}());xj.nameMap=new Map,xj.indexMap=new Map,xj.Enum=me({default:0}),t("a2",(vj=Is("cc.Sorting"),Sj=ha(xj.Enum),vj(Aj=Ps((p((Tj=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._sortingLayer=Ej&&Ej(),e._sortingOrder=bj&&bj(),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=xj.getLayerIndex(this._sortingLayer),e=xj.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&&xj.isLayerValid(t)&&(this._sortingLayer=t,this._updateSortingPriority())}},{key:"sortingOrder",get:function(){return this._sortingOrder},set:function(t){t!==this._sortingOrder&&(this._sortingOrder=bi(t,-32768,32767),this._updateSortingPriority())}}]),e}(Vd)).prototype,"sortingLayer",[Sj],Object.getOwnPropertyDescriptor(Tj.prototype,"sortingLayer"),Tj.prototype),Ej=Ss(Tj.prototype,"_sortingLayer",[ks],(function(){return xj.Enum.default})),bj=Ss(Tj.prototype,"_sortingOrder",[ks],(function(){return 0})),Aj=Tj))||Aj)||Aj));var Cj,Rj,wj,Ij,Bj,Dj=Symbol("CreateEval");Is("cc.animation.EmbeddedPlayer")((Cj=function(t){function e(){for(var e,i=arguments.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=Rj&&Rj(),e.end=wj&&wj(),e.reconciledSpeed=Ij&&Ij(),e.playable=Bj&&Bj(),e}return s(e,t),e}(ca),Rj=Ss(Cj.prototype,"begin",[ks],(function(){return 0})),wj=Ss(Cj.prototype,"end",[ks],(function(){return 0})),Ij=Ss(Cj.prototype,"reconciledSpeed",[ks],(function(){return!1})),Bj=Ss(Cj.prototype,"playable",[ks],(function(){return null})),Cj));var Pj,Oj=function(){},Mj=function(){function t(t){this._randomAccess=t}return t.prototype.setTime=function(){},n(t,[{key:"randomAccess",get:function(){return this._randomAccess}}]),t}(),Nj=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(tt(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=Uh.Default]="Default",t[t.Normal=Uh.Normal]="Normal",t[t.Reverse=Uh.Reverse]="Reverse",t[t.Loop=Uh.Loop]="Loop",t[t.LoopReverse=Uh.Loop|Uh.Reverse]="LoopReverse",t[t.PingPong=Uh.PingPong]="PingPong",t[t.PingPongReverse=Uh.PingPong|Uh.Reverse]="PingPongReverse"}(Pj||(Pj={})),ve(Pj);var Lj,Fj=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}(),kj=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 Gj(){return v.director.getAnimationManager()}!function(t){t.PLAY="play",t.STOP="stop",t.PAUSE="pause",t.RESUME="resume",t.LASTFRAME="lastframe",t.FINISHED="finished"}(Lj||(Lj={})),ve(Lj);var Vj,Uj,zj,Hj=t("a5",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=Pj.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 Fj,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||U("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&Uh.Loop)===Uh.Loop?this.repeatCount=1/0:this.repeatCount=1,!this._doNotCreateEval){var r,s,a,o=null!==(r=null!=e?e:null===(s=Gj())||void 0===s?void 0:s.blendState)&&void 0!==r?r:null;o&&(this._poseOutput=new kj(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||Gj().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];Gj().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(Lj.PLAY,this),null===(t=this._clipEmbeddedPlayerEval)||void 0===t||t.notifyHostPlay(this.current)},i.onStop=function(){var t;this.isPaused||this._onPauseOrStop(),this.emit(Lj.STOP,this),null===(t=this._clipEmbeddedPlayerEval)||void 0===t||t.notifyHostStop()},i.onResume=function(){var t;this._onReplayOrResume(),this.emit(Lj.RESUME,this),null===(t=this._clipEmbeddedPlayerEval)||void 0===t||t.notifyHostPlay(this.current)},i.onPause=function(){var t;this._onPauseOrStop(),this.emit(Lj.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 Fj(e),this.repeatCount>1&&(0|e.iterations)>(0|t.iterations)&&this.emit(Lj.LASTFRAME,this),t.set(e)),e.stopped&&(this.stop(),this.emit(Lj.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(Lj.LASTFRAME,this),this._lastIterations=n)},i._needReverse=function(t){var e=this.wrapMode,i=!1;return(e&Uh.PingPong)===Uh.PingPong&&(t-(0|t)==0&&t>0&&(t-=1),1&t&&(i=!i)),(e&Uh.Reverse)===Uh.Reverse&&(i=!i),i},i.getWrappedInfo=function(t,e){e=e||new Fj;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&Uh.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(){Gj().addAnimation(this)},i._onPauseOrStop=function(){Gj().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&Uh.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&Uh.ShouldWrap,i=(this.wrapMode&Uh.Reverse)===Uh.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}(Nj));v.AnimationState=Hj,Is("cc.animation.EmbeddedAnimationClipPlayable")((Vj=function(t){function e(){for(var e,i=arguments.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=Uj&&Uj(),e.clip=zj&&zj(),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 J(3938,i,t.getPathInHierarchy(),e.name),null;var r=new Hj(e);return r.initialize(n),new jj(r)},e}(Oj),Uj=Ss(Vj.prototype,"path",[ks],(function(){return""})),zj=Ss(Vj.prototype,"clip",[ks],(function(){return null})),Vj));var Wj,Xj,jj=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}(Mj);Is("cc.animation.EmbeddedParticleSystemPlayable")((Wj=function(t){function e(){for(var e,i=arguments.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=Xj&&Xj(),e}return s(e,t),e.prototype.instantiate=function(t){var e=t.getChildByPath(this.path);if(!e)return k("Hierarchy path "+this.path+" does not exists."),null;var i=te("cc.ParticleSystem");if(!i)return k("Particle system is required for embedded particle system player."),null;var n=e.getComponent(i);return n?new $j(n):(k(this.path+" does not includes a particle system component."),null)},e}(Oj),Xj=Ss(Wj.prototype,"path",[ks],(function(){return""})),Wj));var Yj,qj,Kj,Jj,Qj,Zj,$j=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}(Mj);function tY(t){return"string"==typeof t||"number"==typeof t}var eY,iY,nY,rY,sY,aY,oY,hY,uY,lY,cY,_Y,fY,dY,pY,mY,gY,yY,vY,SY=Is("cc.animation.HierarchyPath")((qj=function(){function t(t){this.path=Kj&&Kj(),this.path=t||""}return t.prototype.get=function(t){return t instanceof Pm?t.getChildByPath(this.path)||(q(3926,t.name,this.path),null):(q(3925),null)},t}(),Kj=Ss(qj.prototype,"path",[ks],(function(){return""})),Yj=qj))||Yj,AY=Is("cc.animation.ComponentPath")((Qj=function(){function t(t){this.component=Zj&&Zj(),this.component=t||""}return t.prototype.get=function(t){return t instanceof Pm?t.getComponent(this.component)||(q(3928,t.name,this.component),null):(q(3927),null)},t}(),Zj=Ss(Qj.prototype,"component",[ks],(function(){return""})),Jj=Qj))||Jj,TY=Symbol("NormalizedFollow"),EY=Symbol("ConvertAsTrsPath"),bY=Symbol("TrackBinding"),xY=Is("cc.animation.TrackPath")((iY=function(){function t(){this._paths=nY&&nY()}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 SY(t)),this},e.toComponent=function(t){var e=new AY("string"==typeof t?t:It(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 SY},e.parseHierarchyAt=function(t){return this.isHierarchyAt(t),this._paths[t].path},e.isComponentAt=function(t){return this._paths[t]instanceof AY},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[TY](t,e,i)},e[EY]=function(){for(var t,e=this._paths,i=e.length,n=0,r="";n<i;++n){var s=e[n];if(!(s instanceof SY))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[TY]=function(t,e,i){for(var n=this._paths,r=t,s=e;s<i;++s){var a=n[s];if(tY(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}(),nY=Ss(iY.prototype,"_paths",[ks],(function(){return[]})),eY=iY))||eY,CY=Is("cc.animation.TrackBinding")(rY=zs(((hY=function(){function t(){this.path=aY&&aY(),this.proxy=oY&&oY()}var e=t.prototype;return e.parseTrsPath=function(){return this.proxy?null:this.path[EY]()},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[TY](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 J(3921),null}var _=r.isPropertyAt(o)?r.parsePropertyAt(o):r.parseElementAt(o),f=r[TY](e,0,a-1);if(null===f)return null;if(i&&f instanceof Pm&&function(t){return"position"===t||"rotation"===t||"scale"===t||"eulerAngles"===t}(_))return i.createPoseWriter(f,_,n);var d=t._animationFunctions.get(f.constructor);d||(d=new Map,t._animationFunctions.set(f.constructor,d));var p=d.get(_);return p||(p={setValue:Function("value","this.target."+_+" = value;"),getValue:Function("return this.target."+_+";")},d.set(_,p)),{target:f,setValue:p.setValue,getValue:p.getValue}},e.isMaskedOff=function(t){var e=this.parseTrsPath();if(!e)return!1;for(var i=t.joints[Symbol.iterator](),n=i.next();!n.done;n=i.next()){var r=n.value;if(r.path===e.node)return!r.enabled}return!1},t}())._animationFunctions=new WeakMap,aY=Ss((sY=hY).prototype,"path",[ks],(function(){return new xY})),oY=Ss(sY.prototype,"proxy",[ks],null),rY=sY))||rY)||rY,RY=Is("cc.animation.Track")((lY=function(){function t(){this._binding=cY&&cY()}var e=t.prototype;return e.channels=function(){return[]},e.range=function(){for(var t,e={min:1/0,max:-1/0},i=f(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:bY,get:function(){return this._binding}}]),t}(),cY=Ss(lY.prototype,"_binding",[ks],(function(){return new CY})),uY=lY))||uY,wY=Is("cc.animation.Channel")((fY=function(){function t(t){this.name="",this._curve=dY&&dY(),this._curve=t}return n(t,[{key:"curve",get:function(){return this._curve}}]),t}(),dY=Ss(fY.prototype,"_curve",[ks],null),_Y=fY))||_Y,IY=Is("cc.animation.SingleChannelTrack")((mY=function(t){function e(){var e;return(e=t.call(this)||this)._channel=gY&&gY(),e._channel=new wY(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[Dj]=function(){var t=this._channel.curve;return new BY(t)},n(e,[{key:"channel",get:function(){return this._channel}}]),e}(RY),gY=Ss(mY.prototype,"_channel",[ks],null),pY=mY))||pY,BY=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}(),DY=ks;Is("cc.animation.RealArrayTrack")((yY=function(t){function e(){for(var e,i=arguments.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=vY&&vY(),e}s(e,t);var i=e.prototype;return i.channels=function(){return this._channels},i[Dj]=function(){return new JY(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 wY(new ko)})))}}}]),e}(RY),vY=Ss(yY.prototype,"_channels",[DY],(function(){return[]})),yY));var PY,OY,MY,NY,LY,FY,kY,GY,VY,UY,zY,HY,WY,XY,jY,YY,qY,KY,JY=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}(),QY=Is("cc.animation.UniformProxyFactory")((OY=function(){function t(t,e){this.passIndex=MY&&MY(),this.uniformName=NY&&NY(),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,LY,this),this.passIndex=e||0,this.uniformName=t||""}return t.prototype.forTarget=function(t){if(t instanceof KS){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(DS.getTypeFromHandle(s)<Rl.SAMPLER1D){var a=void 0===n?s:r.getHandle(i,n,Rl.FLOAT);return a?function(t,e){for(var i,n=f(t.shaderInfo.blocks);!(i=n()).done;)for(var r,s=f(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=DS.getBindingFromHandle(s),h=r.properties[i],u=h&&h.value?""+h.value+Ly(h.type):Ny(h.type),l=xS.get(u);return l||(k("Illegal texture default value: "+u+"."),l=xS.get("default-texture")),{set:function(t){t||(t=l);var e=t.getGFXTexture();e&&e.width&&e.height&&(r.bindTexture(o,e),t instanceof pd&&r.bindSampler(o,of.gfxDevice.getSampler(t.getSamplerInfo())))}}}q(3942,t.name,e,i)}}else q(3940,t)},t}(),MY=Ss(OY.prototype,"passIndex",[ks],(function(){return 0})),NY=Ss(OY.prototype,"uniformName",[ks],(function(){return""})),LY=p(OY.prototype,"channelIndex",[sa],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){}}),PY=OY))||PY,ZY=Is("cc.animation.MorphWeightValueProxy")((kY=function(){function t(){this.subMeshIndex=GY&&GY(),this.shapeIndex=VY&&VY()}return t.prototype.forTarget=function(t){var e=this;return{set:function(i){t.setWeight(i,e.subMeshIndex,e.shapeIndex)}}},t}(),GY=Ss(kY.prototype,"subMeshIndex",[ks],(function(){return 0})),VY=Ss(kY.prototype,"shapeIndex",[ks],(function(){return 0})),FY=kY))||FY,$Y=Is("cc.animation.MorphWeightsValueProxy")((zY=function(){function t(){this.subMeshIndex=HY&&HY()}return t.prototype.forTarget=function(t){var e=this;return{set:function(i){t.setWeights(i,e.subMeshIndex)}}},t}(),HY=Ss(zY.prototype,"subMeshIndex",[ks],(function(){return 0})),UY=zY))||UY,tq=Is("cc.animation.MorphWeightsAllValueProxy")(WY=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}())||WY;function eq(t,e,i,n){var r,s,a,o,h,u=new e,l=new e,c=new e,_=Is(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,f=-2*o+3*h,d=o-h;return u=i(u,s,2*o-3*h+1),u=n(u,u,l,_),u=n(u,u,a,f),u=n(u,u,c,d)},r.getNoLerp=function(){return this.dataPoint},t}(),a=Ss(s.prototype,"dataPoint",[ks],(function(){return new e})),o=Ss(s.prototype,"inTangent",[ks],(function(){return new e})),h=Ss(s.prototype,"outTangent",[ks],(function(){return new e})),r=s))||r;if(e===sn){var f=_.prototype.lerp;_.prototype.lerp=function(t,e,i){var n=f.call(this,t,e,i);return sn.normalize(n,n),n}}return _}var iq,nq,rq,sq,aq,oq=eq("cc.CubicSplineVec2Value",yn,yn.multiplyScalar,yn.scaleAndAdd),hq=eq("cc.CubicSplineVec3Value",Yi,Yi.multiplyScalar,Yi.scaleAndAdd),uq=eq("cc.CubicSplineVec4Value",zi,zi.multiplyScalar,zi.scaleAndAdd),lq=eq("cc.CubicSplineQuatValue",sn,sn.multiplyScalar,sn.scaleAndAdd),cq=Is("cc.CubicSplineNumberValue")((jY=function(){function t(t,e,i){this.dataPoint=YY&&YY(),this.inTangent=qY&&qY(),this.outTangent=KY&&KY(),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}(),YY=Ss(jY.prototype,"dataPoint",[ks],(function(){return 0})),qY=Ss(jY.prototype,"inTangent",[ks],(function(){return 0})),KY=Ss(jY.prototype,"outTangent",[ks],(function(){return 0})),XY=jY))||XY,_q=Is("cc.animation.RealTrack")(iq=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.createCurve=function(){return new ko},e}(IY))||iq;function fq(t){return 0===t.keyFramesCount?void 0:t}var dq,pq,mq,gq,yq,vq,Sq,Aq,Tq=["X","Y","Z","W"],Eq=Is("cc.animation.VectorTrack")((rq=function(t){function e(){var e;(e=t.call(this)||this)._channels=sq&&sq(),e._nComponents=aq&&aq(),e._channels=new Array(4);for(var i=0;i<e._channels.length;++i){var n=new wY(new ko);n.name=Tq[i],e._channels[i]=n}return e}s(e,t);var i=e.prototype;return i.channels=function(){return this._channels},i[Dj]=function(){switch(this._nComponents){default:case 2:return new bq(fq(this._channels[0].curve),fq(this._channels[1].curve));case 3:return new xq(fq(this._channels[0].curve),fq(this._channels[1].curve),fq(this._channels[2].curve));case 4:return new Cq(fq(this._channels[0].curve),fq(this._channels[1].curve),fq(this._channels[2].curve),fq(this._channels[3].curve))}},n(e,[{key:"componentsCount",get:function(){return this._nComponents},set:function(t){this._nComponents=t}}]),e}(RY),sq=Ss(rq.prototype,"_channels",[ks],null),aq=Ss(rq.prototype,"_nComponents",[ks],(function(){return 4})),nq=rq))||nq,bq=function(){function t(t,e){this._result=new yn,this._x=t,this._y=e}return t.prototype.evaluate=function(t,e){return e&&yn.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}(),xq=function(){function t(t,e,i){this._result=new Yi,this._x=t,this._y=e,this._z=i}return t.prototype.evaluate=function(t,e){return e&&Yi.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._result},n(t,[{key:"requiresDefault",get:function(){return!this._x||!this._y||!this._z}}]),t}(),Cq=function(){function t(t,e,i,n){this._result=new zi,this._x=t,this._y=e,this._z=i,this._w=n}return t.prototype.evaluate=function(t,e){return e&&zi.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}(),Rq=Is("cc.animation.QuatTrack")(dq=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.createCurve=function(){return new Eh},i[Dj]=function(){return new wq(this.channels()[0].curve)},e}(IY))||dq,wq=function(){function t(t){this._result=new sn,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}(),Iq=["Red","Green","Blue","Alpha"],Bq=Is("cc.animation.ColorTrack")((mq=function(t){function e(){var e;(e=t.call(this)||this)._channels=gq&&gq(),e._channels=new Array(4);for(var i=0;i<e._channels.length;++i){var n=new wY(new ko);n.name=Iq[i],e._channels[i]=n}return e}s(e,t);var i=e.prototype;return i.channels=function(){return this._channels},i[Dj]=function(){return new Dq(fq(this._channels[0].curve),fq(this._channels[1].curve),fq(this._channels[2].curve),fq(this._channels[3].curve))},e}(RY),gq=Ss(mq.prototype,"_channels",[ks],null),pq=mq))||pq,Dq=function(){function t(t,e,i,n){this._result=new Zi,this._x=t,this._y=e,this._z=i,this._w=n}return t.prototype.evaluate=function(t,e){return e&&Zi.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}(),Pq=["Width","Height"],Oq=Is("cc.animation.SizeTrack")((vq=function(t){function e(){var e;(e=t.call(this)||this)._channels=Sq&&Sq(),e._channels=new Array(2);for(var i=0;i<e._channels.length;++i){var n=new wY(new ko);n.name=Pq[i],e._channels[i]=n}return e}s(e,t);var i=e.prototype;return i.channels=function(){return this._channels},i[Dj]=function(){return new Mq(fq(this._channels[0].curve),fq(this._channels[1].curve))},e}(RY),Sq=Ss(vq.prototype,"_channels",[ks],null),yq=vq))||yq,Mq=function(){function t(t,e){this._result=new An,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}(),Nq=Is("cc.animation.ObjectTrack")(Aq=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.createCurve=function(){return new Oh},e}(IY))||Aq;t("a3",Object.freeze({__proto__:null,UniformProxyFactory:QY,MorphWeightValueProxy:ZY,MorphWeightsValueProxy:$Y,MorphWeightsAllValueProxy:tq,Track:RY,TrackPath:xY,RealTrack:_q,VectorTrack:Eq,QuatTrack:Rq,ColorTrack:Bq,SizeTrack:Oq,ObjectTrack:Nq,isPropertyPath:tY,isCustomPath:function(t,e){return t instanceof e},HierarchyPath:SY,ComponentPath:AY,CubicSplineVec2Value:oq,CubicSplineVec3Value:hq,CubicSplineVec4Value:uq,CubicSplineQuatValue:lq,CubicSplineNumberValue:cq}));var Lq=t("a7",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?Vq:ds}return t.prototype.sample=function(t){return this._findRatio(this.ratios,t)},t}());v.RatioSampler=Lq;var Fq=t("a8",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=Yq(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=Gq(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 f=0;f<this._array.length;++f)this._array[f]=this._values[this._array.length*e+f];return this._array},e.empty=function(){return 0===this._values.length},e.constant=function(){return 1===this._values.length},t}());function kq(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 Gq(t,e){if("string"==typeof e){var i=Ro[e];i?t=i(t):J(3906,e)}else Array.isArray(e)&&(t=vh(e,t));return t}function Vq(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)}Fq.Linear=null,v.AnimCurve=Fq,t("a9",function(){function t(){this.events=[]}return t.prototype.add=function(t,e){this.events.push({func:t||"",params:e||[]})},t}()),v.sampleAnimationCurve=kq;var Uq,zq,Hq,Wq,Xq,jq,Yq=function(){function t(t,e,i,n){return t.lerp(e,i,n)}return function(e){if(null!==e){if("number"==typeof e)return Ci;if("object"==typeof e&&e.constructor){if(e instanceof sn)return i=new sn,function(t,e,n){return sn.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 Ci;if("function"==typeof e.lerp)return t}var i}}}(),qq=Symbol("BakeNodeCurves"),Kq=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[qq](0,r,n),t.pool.set(e,i)}return i},t.destroy=function(e){t.pool.delete(e)},t}();Kq.pool=new Map;var Jq=Is("cc.animation.UntypedTrackChannel")((zq=function(t){function e(){var e;return(e=t.call(this,new ko)||this).property=Hq&&Hq(),e}return s(e,t),e}(wY),Hq=Ss(zq.prototype,"property",[ks],(function(){return""})),Uq=zq))||Uq,Qq=Is("cc.animation.UntypedTrack")((Xq=function(t){function e(){for(var e,i=arguments.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=jq&&jq(),e}s(e,t);var i=e.prototype;return i.channels=function(){return this._channels},i[Dj]=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(tt(3931));case t instanceof yn:return new bq(i("x"),i("y"));case t instanceof Yi:return new xq(i("x"),i("y"),i("z"));case t instanceof zi:return new Cq(i("x"),i("y"),i("z"),i("w"));case t instanceof Zi:return new Dq(i("r"),i("g"),i("b"),i("a"));case t instanceof An:return new Mq(i("width"),i("height"))}},i.addChannel=function(t){var e=new Jq;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 Eq;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 Bq,c=l.channels(),_=c[0],f=c[1],d=c[2],p=c[3];return i("r",_),i("g",f),i("b",d),i("a",p),i("x",_),i("y",f),i("z",d),i("w",p),l;case"size":}return null},e}(RY),jq=Ss(Xq.prototype,"_channels",[ks],(function(){return[]})),Wq=Xq))||Wq,Zq=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 xY,s=f(e);!(n=s()).done;){var a=n.value;"string"==typeof a?r.toProperty(a):"number"==typeof a?r.toElement(a):a instanceof SY?r.toHierarchy(a.path):a instanceof AY?r.toComponent(a.component):r.toCustomized(a)}t.path=r,t.proxy=i},a=r.map((function(t){var i=new Qq;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"continue";var u=o.keys<0?[0]:i[o.keys],l=h[0],c=null===(n=o.interpolate)||void 0===n||n;o._arrayLength;var _,f=new tK(o,u.length),d=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),"continue";if(r.valueAdapter||1!==r.modifiers.length||"string"!=typeof r.modifiers[0])return q(3933),"continue";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 _q;d(i),e.push(i),t=i.channel.curve}var n=c?ps.LINEAR:ps.CONSTANT;return t.assignSorted(u,h.map((function(t){return{value:t,interpolationMode:n}}))),void f.convert(t)}if("object"==typeof l)switch(!0){default:break;case $q(h,yn):case $q(h,Yi):case $q(h,zi):var r=l instanceof yn?2:l instanceof Yi?3:4,s=new Eq;d(s),s.componentsCount=r;var a=s.channels(),o=a[0].curve,p=a[1].curve,m=a[2].curve,g=a[3].curve,y=c?ps.LINEAR:ps.CONSTANT,v=function(t){return{value:t,interpolationMode:y}};switch(r){case 4:g.assignSorted(u,h.map((function(t){return v(t.w)}))),f.convert(g);case 3:m.assignSorted(u,h.map((function(t){return v(t.z)}))),f.convert(m);default:o.assignSorted(u,h.map((function(t){return v(t.x)}))),f.convert(o),p.assignSorted(u,h.map((function(t){return v(t.y)}))),f.convert(p)}return void e.push(s);case $q(h,sn):var S=new Rq;d(S);var A=c?_h.SLERP:_h.CONSTANT;return S.channel.curve.assignSorted(u,h.map((function(t){return{value:sn.clone(t),interpolationMode:A}}))),f.convertQuatCurve(S.channel.curve),void e.push(S);case $q(h,Zi):var T=new Bq;d(T);var E=T.channels(),b=E[0].curve,x=E[1].curve,C=E[2].curve,R=E[3].curve,w=c?ps.LINEAR:ps.CONSTANT,I=function(t){return{value:t,interpolationMode:w}};return b.assignSorted(u,h.map((function(t){return I(t.r)}))),f.convert(b),x.assignSorted(u,h.map((function(t){return I(t.g)}))),f.convert(x),C.assignSorted(u,h.map((function(t){return I(t.b)}))),f.convert(C),R.assignSorted(u,h.map((function(t){return I(t.a)}))),f.convert(R),void e.push(T);case $q(h,An):var B=new Oq;d(B);var D=B.channels(),P=D[0].curve,O=D[1].curve,M=c?ps.LINEAR:ps.CONSTANT,N=function(t){return{value:t,interpolationMode:M}};return P.assignSorted(u,h.map((function(t){return N(t.width)}))),f.convert(P),O.assignSorted(u,h.map((function(t){return N(t.height)}))),f.convert(O),void e.push(B);case $q(h,cq):f.nil;var L=new _q;d(L);var F=c?ps.CUBIC:ps.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 $q(h,oq):case $q(h,hq):case $q(h,uq):f.nil;var k=l instanceof oq?2:l instanceof hq?3:4,G=new Eq;d(G),G.componentsCount=k;var V=G.channels(),U=V[0],z=V[1],H=V[2],W=V[3],X=c?ps.LINEAR:ps.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:H.curve.assignSorted(u,h.map((function(t){return j(t.dataPoint.z,t.inTangent.z,t.outTangent.z)})));default:U.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(G);case h.every((function(t){return t instanceof lq})):q(3935)}var Y=new Nq;d(Y),Y.channel.curve.assignSorted(u,h),e.push(Y)}()},h=f(n);!(t=h()).done;)o();return e},e._createPropertyCurves=function(){var t=this;this._ratioSamplers=this._keys.map((function(e){return new Lq(e.map((function(e){return e/t._duration})))})),this._runtimeCurves=this._curves.map((function(e){return{curve:new Fq(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 $q(t,e){return t.every((function(t){return t instanceof e}))}var tK=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,_,f,d,p,m,g,y,v,S,A,T,E=this._easingMethods;if(E){var b=t.keyFramesCount;if(!(t.keyFramesCount<2)){Array.isArray(E)&&E.length;for(var x=b-1,C=0;C<x;++C){var R=E[C];R&&(Array.isArray(R)?(e=R,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,f=void 0,d=void 0,p=void 0,m=void 0,g=void 0,y=void 0,v=void 0,S=void 0,A=void 0,T=void 0,o=e[0],h=e[1],u=e[2],l=e[3],c=n.value,_=3*(r-i),f=3*(s.value-c),m=(1-u)*_,g=(1-l)*f,y=1/3,v=(p=h*f)/(d=o*_),S=Math.sqrt(d*d+p*p)*y,A=g/m,T=Math.sqrt(m*m+g*g)*y,n.interpolationMode=ps.CUBIC,n.tangentWeightMode=(a=n.tangentWeightMode)===gs.NONE?gs.RIGHT:a===gs.LEFT?gs.BOTH:a,n.rightTangent=v,n.rightTangentWeight=S,s.tangentWeightMode=function(t){return t===gs.NONE?gs.LEFT:t===gs.RIGHT?gs.BOTH:t}(s.tangentWeightMode),s.leftTangent=A,s.leftTangentWeight=T):eK(R,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():iK(s,t,r))}}}},n(t,[{key:"nil",get:function(){return!this._easingMethods||this._easingMethods.every((function(t){return null==t}))}}]),t}();function eK(t,e,i){e.keyFramesCount;var n=e.getKeyframeValue(i),r=RK[t];r===Co.CONSTANT?n.interpolationMode=ps.CONSTANT:(n.interpolationMode=ps.LINEAR,n.easingMethod=r)}function iK(t,e,i){e.keyFramesCount;var n=e.getKeyframeValue(i),r=RK[t];n.easingMethod=r}var nK,rK,sK,aK,oK,hK,uK,lK,cK,_K,fK,dK,pK,mK,gK,yK,vK,SK,AK,TK,EK,bK,xK,CK,RK={constant:Co.CONSTANT,linear:Co.LINEAR,quadIn:Co.QUAD_IN,quadOut:Co.QUAD_OUT,quadInOut:Co.QUAD_IN_OUT,quadOutIn:Co.QUAD_OUT_IN,cubicIn:Co.CUBIC_IN,cubicOut:Co.CUBIC_OUT,cubicInOut:Co.CUBIC_IN_OUT,cubicOutIn:Co.CUBIC_OUT_IN,quartIn:Co.QUART_IN,quartOut:Co.QUART_OUT,quartInOut:Co.QUART_IN_OUT,quartOutIn:Co.QUART_OUT_IN,quintIn:Co.QUINT_IN,quintOut:Co.QUINT_OUT,quintInOut:Co.QUINT_IN_OUT,quintOutIn:Co.QUINT_OUT_IN,sineIn:Co.SINE_IN,sineOut:Co.SINE_OUT,sineInOut:Co.SINE_IN_OUT,sineOutIn:Co.SINE_OUT_IN,expoIn:Co.EXPO_IN,expoOut:Co.EXPO_OUT,expoInOut:Co.EXPO_IN_OUT,expoOutIn:Co.EXPO_OUT_IN,circIn:Co.CIRC_IN,circOut:Co.CIRC_OUT,circInOut:Co.CIRC_IN_OUT,circOutIn:Co.CIRC_OUT_IN,elasticIn:Co.ELASTIC_IN,elasticOut:Co.ELASTIC_OUT,elasticInOut:Co.ELASTIC_IN_OUT,elasticOutIn:Co.ELASTIC_OUT_IN,backIn:Co.BACK_IN,backOut:Co.BACK_OUT,backInOut:Co.BACK_IN_OUT,backOutIn:Co.BACK_OUT_IN,bounceIn:Co.BOUNCE_IN,bounceOut:Co.BOUNCE_OUT,bounceInOut:Co.BOUNCE_IN_OUT,bounceOutIn:Co.BOUNCE_OUT_IN,smooth:Co.SMOOTH,fade:Co.FADE};var wK=Is,IK=ks;function BK(){throw new Error("split() only valid in Editor.")}wK("cc.animation.ExoticAnimation")((nK=function(){function t(){this._nodeAnimations=rK&&rK()}var e=t.prototype;return e.createEvaluator=function(t){return new VK(this._nodeAnimations,t)},e.createEvaluatorForAnimationGraph=function(t){return new HK(this._nodeAnimations,t)},e.addNodeAnimation=function(t){var e=new DK(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 BK()},e.toHashString=function(){return this._nodeAnimations.map((function(t){return t.toHashString()})).join("\n")},t}(),rK=Ss(nK.prototype,"_nodeAnimations",[IK],(function(){return[]})),nK));var DK=wK("cc.animation.ExoticNodeAnimation")((aK=function(){function t(t){this._path=oK&&oK(),this._position=hK&&hK(),this._rotation=uK&&uK(),this._scale=lK&&lK(),this._path=t}var e=t.prototype;return e.createPosition=function(t,e){this._position=new FK(t,new NK(e))},e.createRotation=function(t,e){this._rotation=new FK(t,new LK(e))},e.createScale=function(t,e){this._scale=new FK(t,new NK(e))},e.createEvaluator=function(t){return new UK(this._path,this._position,this._rotation,this._scale,t)},e.createEvaluatorForAnimationGraph=function(t){var e=t.bindTransform(this._path);return e?new WK(e,this._position,this._rotation,this._scale):null},e.split=function(){return BK()},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}(),oK=Ss(aK.prototype,"_path",[IK],(function(){return""})),hK=Ss(aK.prototype,"_position",[IK],(function(){return null})),uK=Ss(aK.prototype,"_rotation",[IK],(function(){return null})),lK=Ss(aK.prototype,"_scale",[IK],(function(){return null})),sK=aK))||sK;function PK(t){return t.toPrecision(2)}function OK(t){return t.map((function(t){return Number.parseFloat(PK(t))})).join(" ")}var MK=wK("cc.animation.ExoticVectorLikeTrackValues")((_K=function(){function t(t){this._values=fK&&fK(),this._isQuantized=dK&&dK(),this._values=t,this._isQuantized=!1}var e=t.prototype;return e.quantize=function(t){this._isQuantized,this._values=function(t,e){var i=XK[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 QK(jK(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():OK(e))},n(t,[{key:"precision",get:function(){return this._isQuantized?this._values.originalPrecision:jK(this._values)}}]),t}(),fK=Ss(_K.prototype,"_values",[IK],null),dK=Ss(_K.prototype,"_isQuantized",[IK],null),cK=_K))||cK,NK=wK("cc.animation.ExoticVec3TrackValues")(pK=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?tJ(i,t,e):Yi.fromArray(e,i,3*t)},i.lerp=function(t,e,i,n,r,s){var a=this._values;this._isQuantized?(tJ(a,t,n),tJ(a,e,r)):(Yi.fromArray(n,a,3*t),Yi.fromArray(r,a,3*e)),Yi.lerp(s,n,r,i)},e}(MK))||pK,LK=wK("cc.animation.ExoticQuatTrackValues")(mK=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?eJ(i,t,e):sn.fromArray(e,i,4*t)},i.lerp=function(t,e,i,n,r,s){var a=this._values;this._isQuantized?(eJ(a,t,n),eJ(a,e,r)):(sn.fromArray(n,a,4*t),sn.fromArray(r,a,4*e)),sn.slerp(s,n,r,i)},e}(MK))||mK,FK=wK("cc.animation.ExoticTrack")((yK=function(){function t(t,e){this.times=vK&&vK(),this.values=SK&&SK(),this.times=t,this.values=e}return t.prototype.toHashString=function(){var t=this.times,e=this.values;return"times: "+OK(t)+"; values: "+e.toHashString()},t}(),vK=Ss(yK.prototype,"times",[IK],null),SK=Ss(yK.prototype,"values",[IK],null),gK=yK))||gK;function kK(t,e){t.length,t.length;var i=0,n=0,r=ds(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=kK(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=kK(t,i);u=c.index,l=c.ratio}var _=!o,f=!l;a!==u||o!==l?(_||(this.preLerpIndex=a,this.preLerpRatio=o),this.directKeyframesBegin=_?a:a+1,this.directKeyframesEnd=u+1,f||(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 GK,VK=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}(),UK=function(){function t(t,e,i,n,r){this._position=null,this._rotation=null,this._scale=null,e&&(this._position=$K(e.times,e.values,Yi,t,"position",r)),i&&(this._rotation=$K(i.times,i.values,sn,t,"rotation",r)),n&&(this._scale=$K(n.times,n.values,Yi,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}(),zK=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=ds(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}(),HK=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}(),WK=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 zK(e.times,e.values,Yi)),i&&(this._rotation=new zK(i.times,i.values,sn)),n&&(this._scale=new zK(n.times,n.values,Yi))}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}(),XK={uint8:Uint8Array,uint16:Uint16Array};function jK(t){switch(t.BYTES_PER_ELEMENT){default:case 4:return GK.FLOAT_32;case 8:return GK.FLOAT_64}}!function(t){t[t.FLOAT_32=0]="FLOAT_32",t[t.FLOAT_64=1]="FLOAT_64"}(GK||(GK={}));var YK,qK,KK,JK,QK=wK("cc.animation.QuantizedFloatArray")((TK=function(){function t(t,e,i,n){void 0===n&&(n=0),this.originalPrecision=EK&&EK(),this.min=bK&&bK(),this.extent=xK&&xK(),this.values=CK&&CK(),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+" "+PK(e)+" "+PK(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}(),EK=Ss(TK.prototype,"originalPrecision",[IK],null),bK=Ss(TK.prototype,"min",[IK],null),xK=Ss(TK.prototype,"extent",[IK],null),CK=Ss(TK.prototype,"values",[IK],null),AK=TK))||AK;function ZK(t,e){return t.values[e]/(1<<t.values.BYTES_PER_ELEMENT)*t.extent+t.min}function $K(t,e,i,n,r,s){var a=new CY;a.path=(new xY).toHierarchy(n).toProperty(r);var o=s(a);return o?{runtimeBinding:o,evaluator:new zK(t,e,i)}:null}function tJ(t,e,i){Yi.set(i,ZK(t,3*e+0),ZK(t,3*e+1),ZK(t,3*e+2))}function eJ(t,e,i){sn.set(i,ZK(t,4*e+0),ZK(t,4*e+1),ZK(t,4*e+2),ZK(t,4*e+3))}var iJ,nJ,rJ,sJ,aJ,oJ,hJ,uJ,lJ,cJ,_J,fJ,dJ,pJ,mJ,gJ,yJ,vJ,SJ,AJ=Is("cc.animation.AuxiliaryCurveEntry")((qK=function(){this.name=KK&&KK(),this.curve=JK&&JK()},KK=Ss(qK.prototype,"name",[ks],(function(){return""})),JK=Ss(qK.prototype,"curve",[ks],(function(){return new ko})),YK=qK))||YK;function TJ(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 EJ=Symbol("SearchForRootBonePath"),bJ=Symbol("ExoticAnimation"),xJ=Symbol("[[EmbeddedPlayerCount]]"),CJ=Symbol("[[GetEmbeddedPlayers]]"),RJ=Symbol("[[AddEmbeddedPlayer]]"),wJ=Symbol("[[RemoveEmbeddedPlayer]]"),IJ=Symbol("[[ClearEmbeddedPlayers]]"),BJ=Symbol("[[Additive Settings]]"),DJ=t("a4",Is("cc.AnimationClip")(((mJ=function(t){function e(){for(var e,i=arguments.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=rJ&&rJ(),e.speed=sJ&&sJ(),e.wrapMode=aJ&&aJ(),e.enableTrsBlending=oJ&&oJ(),e._duration=hJ&&hJ(),e._hash=uJ&&uJ(),e.frameRate=0,e._tracks=lJ&&lJ(),e._exoticAnimation=cJ&&cJ(),e._legacyData=void 0,e._legacyDataDirty=!1,e._events=_J&&_J(),e._embeddedPlayers=fJ&&fJ(),e._additiveSettings=dJ&&dJ(),e._auxiliaryCurveEntries=pJ&&pJ(),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 Nq;return s.path=(new xY).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 zJ(t,this._runtimeEvents.ratios,this._runtimeEvents.eventGroups,this.wrapMode)},i.containsAnyEmbeddedPlayer=function(){return 0!==this._embeddedPlayers.length},i.createEmbeddedPlayerEvaluator=function(t){return new MJ(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),Kq.destroy(this),t.prototype.destroy.call(this)},i[qq]=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 fn}))};var h=r.reduce((function(t,e){return t[e]=new FJ,t}),{});for(var u in h){var l=h[u],c=u.lastIndexOf("/");if(c>=0){var _=u.substring(0,c),f=h[_];f&&(l.parent=f)}}for(var d=this._createEvalWithBinder(void 0,(function(t){var e=t.parseTrsPath();if(e){var i=h[e.node];if(i)return UJ(i,e.property)}}),void 0),p=0;p<i;++p){var m=t+n*p;d.evaluate(m);for(var g=0;g<s;++g){var y=r[g];fn.copy(a[y].transforms[p],h[y].globalTransform)}for(var v=0;v<s;++v){var S=r[v];h[S].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 Qq){var o=a.upgrade(t);o&&(e.push(o),i.push(a))}}for(var h=i.length,u=0;u<h;++u)oe(n,i[u]);n.push.apply(n,e)},i[EJ]=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[CJ]=function(){return this._embeddedPlayers},i[RJ]=function(t){this._embeddedPlayers.push(t)},i[wJ]=function(t){var e=this._embeddedPlayers.indexOf(t);e>=0&&this._embeddedPlayers.splice(e,1)},i[IJ]=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 AJ).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){ue(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[bY]);if(c){var _=void 0;if(l instanceof Qq){if(!c.getValue){J(3930);continue}var f=c.getValue();_=l.createLegacyEval(f)}else _=l[Dj]();a.push(new OJ(c,_))}}}return this._exoticAnimation&&(s=this._exoticAnimation.createEvaluator(e)),new NJ(a,s,n)},i._createRootMotionEvaluation=function(t,e,i){if(t instanceof Pm){var n=this._searchForRootBonePath();if(n){var r=t.getChildByPath(n);if(r){for(var s=new LJ,a=[],o=this._tracks,h=o.length,u=0;u<h;++u){var l=o[u],c=l[bY].parseTrsPath();if(c&&c.node===n){i.push(l);var _=UJ(s,c.property);if(_){var f=l[Dj]();a.push(new OJ(_,f))}}}return new GJ(r,this._duration,s,a)}q(3924)}else q(3923)}else J(3920)},i._searchForRootBonePath=function(){var t=this._tracks.map((function(t){var e=t[bY].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 Zq(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][bY].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=fl(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:bJ,get:function(){return this._exoticAnimation}},{key:bJ,set:function(t){this._exoticAnimation=t}},{key:"isAdditive_experimental",get:function(){return this._additiveSettings.enabled}},{key:BJ,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:xJ,get:function(){return this._embeddedPlayers.length}},{key:"auxiliaryCurveCount_experimental",get:function(){return this._auxiliaryCurveEntries.length}}]),e}(zf)).WrapMode=Pj,rJ=Ss((nJ=mJ).prototype,"sample",[ks],(function(){return 60})),sJ=Ss(nJ.prototype,"speed",[ks],(function(){return 1})),aJ=Ss(nJ.prototype,"wrapMode",[ks],(function(){return Pj.Normal})),oJ=Ss(nJ.prototype,"enableTrsBlending",[ks],(function(){return!1})),hJ=Ss(nJ.prototype,"_duration",[ks],(function(){return 0})),uJ=Ss(nJ.prototype,"_hash",[ks],(function(){return 0})),lJ=Ss(nJ.prototype,"_tracks",[ks],(function(){return[]})),cJ=Ss(nJ.prototype,"_exoticAnimation",[ks],(function(){return null})),_J=Ss(nJ.prototype,"_events",[ks],(function(){return[]})),fJ=Ss(nJ.prototype,"_embeddedPlayers",[ks],(function(){return[]})),dJ=Ss(nJ.prototype,"_additiveSettings",[ks],(function(){return new PJ})),pJ=Ss(nJ.prototype,"_auxiliaryCurveEntries",[ks],(function(){return[]})),iJ=nJ))||iJ),PJ=Is("cc.AnimationClipAdditiveSettings")((yJ=function(){this.enabled=vJ&&vJ(),this.refClip=SJ&&SJ()},vJ=Ss(yJ.prototype,"enabled",[ks],(function(){return!1})),SJ=Ss(yJ.prototype,"refClip",[ks],(function(){return null})),gJ=yJ))||gJ;v.AnimationClip=DJ;var OJ=function(){function t(t,e){this._binding=void 0,this._trackEval=void 0,this._binding=t,this._trackEval=e}return t.prototype.evaluate=function(t){var e=this._binding,i=this._trackEval,n=e.getValue&&i.requiresDefault?e.getValue():void 0,r=i.evaluate(t,n);e.setValue(r)},t}(),MJ=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 f=t-c;a.instantiatedPlayer.setTime(f)}}}},e.notifyHostSpeedChanged=function(t){for(var e=this._embeddedPlayers,i=this._embeddedPlayerEvaluationInfos,n=e.length,r=0;r<n;++r){var s=i[r];if(s){var a=s.instantiatedPlayer;e[r].reconciledSpeed&&a.setSpeed(t)}}},e.notifyHostPlay=function(t){for(var e=this._embeddedPlayers,i=this._embeddedPlayerEvaluationInfos,n=e.length,r=0;r<n;++r){var s=i[r];if(s){var a=e[r],o=a.begin,h=a.end,u=s.instantiatedPlayer;if(s.entered){var l=s.hostPauseTime;if(u.randomAccess||Ei(l,t,1e-5)){var c=bi(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}(),NJ=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}(),LJ=function(){function t(){this.position=new Yi,this.scale=new Yi(1,1,1),this.rotation=new sn,this.eulerAngles=new Yi}return t.prototype.getTransform=function(t){fn.fromRTS(t,this.rotation,this.position,this.scale)},t}(),FJ=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).parent=null,e._dirty=!0,e._transform=new fn,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,fn.fromRTS(t,this.rotation,this.position,this.scale),this.parent&&fn.multiply(t,this.parent.globalTransform,t)),this._transform}}]),e}(LJ),kJ=new fn,GJ=function(){function t(t,e,i,n){this._initialTransformCache=new fn,this._clipEndTransformCache=new fn,this._startTransformCache=new fn,this._endTransformCache=new fn,this._motionTransformCache=new fn,this._translationMotionCache=new Yi,this._rotationMotionCache=new sn,this._scaleMotionCache=new Yi,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;fn.toRTS(i,r,n,s),Yi.add(n,n,a.position),a.setPosition(n),sn.multiply(r,r,a.rotation),a.setRotation(r),Yi.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);VJ(i,s,a)}else{fn.identity(i);var o=function(t,e){VJ(kJ,t,e),fn.multiply(i,i,kJ)},h=e-r,u=Math.floor(h/n),l=h-u*n,c=this._evaluateAt(0,this._initialTransformCache),_=this._evaluateAt(n,this._clipEndTransformCache),f=this._evaluateAt(l,this._endTransformCache);o(s,_),VJ(kJ,c,_);for(var d=0;d<u;++d)fn.multiply(i,i,kJ);o(c,f)}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 VJ(t,e,i){fn.invert(t,e),fn.multiply(t,i,t)}function UJ(t,e){switch(e){default:return;case"position":return{setValue:function(e){Yi.copy(t.position,e)}};case"rotation":return{setValue:function(e){sn.copy(t.rotation,e)}};case"scale":return{setValue:function(e){Yi.copy(t.scale,e)}};case"eulerAngles":return{setValue:function(e){Yi.copy(t.eulerAngles,e)}}}}var zJ=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=WJ(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=WJ(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=HJ(i),o=HJ(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&Uh.PingPong)===Uh.PingPong?e*=-1:h=n,o++):1===e&&h===n-1&&r<n-1&&((s&Uh.PingPong)===Uh.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?Gj().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];TJ(this._targetNode,s.functionName,s.parameters)}}},t}();function HJ(t){return t-(0|t)==0&&(t-=1),0|t}function WJ(t,e){return ds(e,t)}var XJ,jJ=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 YJ(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}(),YJ=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"}(XJ||(XJ={})),XJ.POSITION,XJ.ROTATION,XJ.SCALE,XJ.EULER_ANGLES;var qJ,KJ,JJ=function(){function t(){this.refCount=0,this.accumulatedWeight=0,this.result=new Yi}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;Yi.lerp(t,t,n,a)}}else Yi.copy(t,n);return s}(this.result,this.result,this.accumulatedWeight,t,e)},e.reset=function(){this.accumulatedWeight=0,Yi.zero(this.result)},t}(),QJ=function(){function t(){this.refCount=0,this.accumulatedWeight=0,this.result=new sn}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;sn.slerp(t,e,n,a)}}else sn.copy(t,n);return s}(this.result,this.result,this.accumulatedWeight,t,e)},e.reset=function(){this.accumulatedWeight=0,sn.identity(this.result)},t}(),ZJ=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|=XJ.POSITION,n.accumulatedWeight<1&&n.blend(e.position,1-n.accumulatedWeight)),r&&r.accumulatedWeight&&(this._transformApplyFlags|=XJ.SCALE,r.accumulatedWeight<1&&r.blend(e.scale,1-r.accumulatedWeight)),a&&a.accumulatedWeight&&(this._transformApplyFlags|=XJ.EULER_ANGLES,a.accumulatedWeight<1&&a.blend(e.eulerAngles,1-a.accumulatedWeight)),s&&s.accumulatedWeight&&(this._transformApplyFlags|=XJ.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 JJ},i._createQuatBlendState=function(){return new QJ},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&XJ.POSITION&&(e=a.result),o&&r&XJ.SCALE&&(i=o.result),u&&r&XJ.EULER_ANGLES&&(n=u.result),h&&r&XJ.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}()),$J=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.createNodeBlendState=function(){return new ZJ},e}(jJ),tQ=[],eQ=new Map;function iQ(t,e){for(var i=0,n=fn.IDENTITY;t;){if(t.stamp===e||t.stamp+1===e&&!t.node.hasChangedFlags){n=t.world,t.stamp=e;break}t.stamp=e,tQ[i++]=t,t=t.parent}for(;i>0;){t=tQ[--i],tQ[i]=null;var r=t.node;fn.fromRTS(t.local,r.rotation,r.position,r.scale),n=fn.multiply(t.world,n,t.local)}return n}function nQ(t){for(var e=eQ.get(t.uuid)||null;e;)eQ.delete(e.node.uuid),e=e.parent}var rQ=t("ac",Is(((KJ=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._anims=new re([]),e._crossFades=new re([]),e._delayEvents=[],e._blendStateBuffer=new $J,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):J(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=vN.getTotalFrames(),u=0,l=n.length;u<l;u++){var c=n[u],_=c.target,f=c.transform;_.matrix=iQ(f,h)}for(var d=0,p=e.length;d<p;d++){var m=e[d];m.fn.apply(m.thisArg,m.args)}e.length=0},i.destruct=function(){},i.addAnimation=function(t){-1===this._anims.array.indexOf(t)&&this._anims.push(t)},i.removeAnimation=function(t){var e=this._anims.array.indexOf(t);e>=0?this._anims.fastRemoveAt(e):J(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"continue";var s=t.getChildByPath(n.path),a=n.target&&s&&function(t,e){for(var i,n=null,r=0;t!==e;){var s=t.uuid;if(eQ.has(s)){n=eQ.get(s);break}n={node:t,local:new fn,world:new fn,stamp:-1,parent:null},eQ.set(s,n),tQ[r++]=n,t=t.parent,n=null}for(;r>0;)i=tQ[--r],tQ[r]=null,i.parent=n,n=i;return n}(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){nQ(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}(pu)).ID="animation",qJ=KJ))||qJ);vN.on(yN.EVENT_INIT,(function(){var t=new rQ;vN.registerSystem(rQ.ID,t,pu.Priority.HIGH)})),v.AnimationManager=rQ;var sQ,aQ,oQ,hQ,uQ,lQ,cQ,_Q,fQ,dQ,pQ,mQ=function(t){function e(e){var i;return(i=t.call(this)||this)._managedStates=[],i._fadings=[],i._scheduled=!1,i._scheduler=null!=e?e:Gj(),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:xi(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(),oe(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}(Nj),gQ=t("a6",(sQ=Is("cc.Animation"),aQ=Ds(99),oQ=ha([DJ]),hQ=ha(DJ),uQ=ha([DJ]),sQ(lQ=aQ(((pQ=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).playOnLoad=_Q&&_Q(),e._crossFade=new mQ,e._nameToState=wt(!0),e._clips=fQ&&fQ(),e._defaultClip=dQ&&dQ(),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=wt(!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 le(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===Lj.LASTFRAME&&this._syncAllowLastFrameEvent(),s},i.once=function(e,i,n){var r=t.prototype.once.call(this,e,i,n);return e===Lj.LASTFRAME&&this._syncAllowLastFrameEvent(),r},i.off=function(e,i,n){t.prototype.off.call(this,e,i,n),e===Lj.LASTFRAME&&this._syncDisallowLastFrameEvent()},i._createState=function(t,e){return new Hj(t,e)},i._doCreateState=function(t,e){var i=this._createState(t,e);return i._setEventTarget(this),i.allowLastFrameEvent(this.hasEventListener(Lj.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];yQ(t,i.clip)&&(i.stop(),delete this._nameToState[e])}},i._syncAllowLastFrameEvent=function(){if(this.hasEventListener(Lj.LASTFRAME))for(var t in this._nameToState)this._nameToState[t].allowLastFrameEvent(!0)},i._syncDisallowLastFrameEvent=function(){if(!this.hasEventListener(Lj.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=f(this._clips);!(i=n()).done;){var r=i.value;r&&this._removeStateOfAutomaticClip(r)}for(var s,a=f(t);!(s=a()).done;){var o=s.value;o&&this.createState(o)}var h=t.find((function(t){return yQ(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 yQ(e,t)}))>=0||(this._clips.push(t),this.createState(t)))}}]),e}(Bu(Vd))).EventType=Lj,p((cQ=pQ).prototype,"clips",[oQ],Object.getOwnPropertyDescriptor(cQ.prototype,"clips"),cQ.prototype),p(cQ.prototype,"defaultClip",[hQ],Object.getOwnPropertyDescriptor(cQ.prototype,"defaultClip"),cQ.prototype),_Q=Ss(cQ.prototype,"playOnLoad",[ks],(function(){return!1})),fQ=Ss(cQ.prototype,"_clips",[uQ],(function(){return[]})),dQ=Ss(cQ.prototype,"_defaultClip",[ks],(function(){return null})),lQ=cQ))||lQ)||lQ));function yQ(t,e){return t===e||!!t&&!!e&&t._uuid===e._uuid&&t._uuid}v.Animation=gQ,v.AnimationComponent=gQ,Jt(gQ,"cc.AnimationComponent");var vQ,SQ,AQ,TQ=new fn;!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"}(vQ||(vQ={})),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"}(SQ||(SQ={})),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"}(AQ||(AQ={}));var EQ,bQ=t("ah",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}()),xQ=0;function CQ(t,e){var i;e.invoking||(e.invoking=!0,(i=e.func).call.apply(i,[t].concat(e.args)).then((function(){e.invoking=!1,t._operationQueue.shift(),t._eventTarget.emit(e.id.toString());var i=t._operationQueue[0];i&&CQ(t,i)})).catch((function(){})))}function RQ(t,e,i){var n=i.value;i.value=function(){for(var t=this,e=arguments.length,i=new Array(e),r=0;r<e;r++)i[r]=arguments[r];return new Promise((function(e){var r=xQ++,s=t;s._operationQueue.push({id:r,func:n,args:i,invoking:!1}),s._eventTarget.once(r.toString(),e),CQ(s,s._operationQueue[0])}))}}function wQ(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 IQ,BQ,DQ=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;wQ(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}(),PQ=(p((EQ=function(){function t(t){var e=this;this._domAudio=void 0,this._state=AQ.INIT,this._onEnded=void 0,this._eventTarget=new Du,this._operationQueue=[],this._domAudio=t,xN.on(bN.EVENT_PAUSE,this._onInterruptedBegin,this),xN.on(bN.EVENT_RESUME,this._onInterruptedEnd,this),this._onEnded=function(){e.seek(0).catch((function(){})),e._state=AQ.INIT,e._eventTarget.emit(vQ.ENDED)},this._domAudio.addEventListener("ended",this._onEnded)}var e=t.prototype;return e.destroy=function(){xN.off(bN.EVENT_PAUSE,this._onInterruptedBegin,this),xN.off(bN.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";Gu.os===Nu.IOS?r="loadedmetadata":Gu.browserType===Pu.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 DQ(t,i);n(e)})).catch(r)}))},e._onInterruptedBegin=function(){var t=this;this._state===AQ.PLAYING&&this.pause().then((function(){t._state=AQ.INTERRUPTED,t._eventTarget.emit(vQ.INTERRUPTION_BEGIN)})).catch((function(){}))},e._onInterruptedEnd=function(){var t=this;this._state===AQ.INTERRUPTED&&this.play().then((function(){t._eventTarget.emit(vQ.INTERRUPTION_END)})).catch((function(){}))},e.getPCMData=function(){},e.seek=function(t){return t=bi(t,0,this.duration),this._domAudio.currentTime=t,Promise.resolve()},e.play=function(){var t=this;return new Promise((function(e){wQ(t._domAudio).then((function(){t._state=AQ.PLAYING,e()})).catch((function(){}))}))},e.pause=function(){return this._domAudio.pause(),this._state=AQ.PAUSED,Promise.resolve()},e.stop=function(){var t=this;return new Promise((function(e){t._domAudio.pause(),t._domAudio.currentTime=0,t._state=AQ.STOPPED,e()}))},e.onInterruptionBegin=function(t){this._eventTarget.on(vQ.INTERRUPTION_BEGIN,t)},e.offInterruptionBegin=function(t){this._eventTarget.off(vQ.INTERRUPTION_BEGIN,t)},e.onInterruptionEnd=function(t){this._eventTarget.on(vQ.INTERRUPTION_END,t)},e.offInterruptionEnd=function(t){this._eventTarget.off(vQ.INTERRUPTION_END,t)},e.onEnded=function(t){this._eventTarget.on(vQ.ENDED,t)},e.offEnded=function(t){this._eventTarget.off(vQ.ENDED,t)},n(t,[{key:"src",get:function(){return this._domAudio?this._domAudio.src:""}},{key:"type",get:function(){return SQ.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=xi(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",[RQ],Object.getOwnPropertyDescriptor(EQ.prototype,"seek"),EQ.prototype),p(EQ.prototype,"play",[RQ],Object.getOwnPropertyDescriptor(EQ.prototype,"play"),EQ.prototype),p(EQ.prototype,"pause",[RQ],Object.getOwnPropertyDescriptor(EQ.prototype,"pause"),EQ.prototype),p(EQ.prototype,"stop",[RQ],Object.getOwnPropertyDescriptor(EQ.prototype,"stop"),EQ.prototype),EQ),OQ=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=bi(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}(),MQ=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}()),NQ=window.AudioContext||window.webkitAudioContext||window.mozAudioContext,LQ="on-context-running",FQ=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 Du,this._context.onstatechange=function(){"running"===t._context.state?(t._isRunning=!0,t._eventTarget.emit(LQ)):t._isRunning=!1}}var e=t.prototype;return e.onceRunning=function(t,e){this._eventTarget.once(LQ,t,e)},e.offRunning=function(t,e){this._eventTarget.off(LQ,t,e)},e.decodeAudioData=function(t){var e=this;return new Promise((function(i){var n=e._context.decodeAudioData(t,(function(t){i(t)}),(function(t){console.error("failed to load Web Audio",t)}));null==n||n.catch((function(){}))}))},e.runContext=function(){var t=this;return new Promise((function(e){if(t.isRunning)e();else{var i=t._context;if(i.resume)if(i.resume().catch((function(){})),"running"!==i.state){var n=document.getElementById("GameCanvas"),r=function t(){i.resume().then((function(){null==n||n.removeEventListener("touchend",t,{capture:!0}),null==n||n.removeEventListener("mouseup",t,{capture:!0}),e()})).catch((function(){}))};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}();FQ.support=!!NQ,FQ.support&&(BQ=new FQ);var kQ,GQ,VQ,UQ,zQ=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=BQ.createBufferSource(t,!1);var n=BQ.createGain(e);this._bufferSourceNode.connect(n),BQ.connectContext(n)}var e=t.prototype;return e.play=function(){var t=this;this._bufferSourceNode.start(),BQ.runContext().then((function(){var e;null===(e=t.onPlay)||void 0===e||e.call(t),t._currentTimer=window.setTimeout((function(){var e;MQ.tryReleasingCache(t._url),null===(e=t.onEnd)||void 0===e||e.call(t)}),1e3*t._duration)})).catch((function(){}))},e.stop=function(){clearTimeout(this._currentTimer),MQ.tryReleasingCache(this._url),this._bufferSourceNode.stop(),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}(),HQ=(p((IQ=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=AQ.INIT,this._audioTimer=void 0,this._runningCallback=void 0,this._eventTarget=new Du,this._operationQueue=[],this._audioBuffer=t,this._audioTimer=new OQ(t),this._gainNode=BQ.createGain(),BQ.connectContext(this._gainNode),this._src=e,xN.on(bN.EVENT_PAUSE,this._onInterruptedBegin,this),xN.on(bN.EVENT_RESUME,this._onInterruptedEnd,this)}var e=t.prototype;return e.destroy=function(){this._audioTimer.destroy(),this._audioBuffer&&(this._audioBuffer=null),MQ.tryReleasingCache(this._src),xN.off(bN.EVENT_PAUSE,this._onInterruptedBegin,this),xN.off(bN.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.loadNative=function(t){return new Promise((function(e,i){var n=MQ.getCache(t);if(n)return MQ.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?BQ.decodeAudioData(r.response).then((function(i){MQ.addCache(t,i),e(i)})).catch((function(){})):i(new Error(""+s+r.status+"(no response)"))},r.onerror=function(){i(new Error(""+s+r.status+"(error)"))},r.ontimeout=function(){i(new Error(""+s+r.status+"(time out)"))},r.onabort=function(){i(new Error(""+s+r.status+"(abort)"))},r.send(null)}))},t.loadOneShotAudio=function(e,i){return new Promise((function(n,r){t.loadNative(e).then((function(t){var r=new zQ(t,i,e);n(r)})).catch(r)}))},e.getPCMData=function(t){return new bQ(this._audioBuffer.getChannelData(t),1)},e._onInterruptedBegin=function(){var t=this;this._state===AQ.PLAYING&&this.pause().then((function(){t._state=AQ.INTERRUPTED,t._eventTarget.emit(vQ.INTERRUPTION_BEGIN)})).catch((function(){}))},e._onInterruptedEnd=function(){var t=this;this._state===AQ.INTERRUPTED&&this.play().then((function(){t._eventTarget.emit(vQ.INTERRUPTION_END)})).catch((function(){}))},e.offRunning=function(){this._runningCallback&&(BQ.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===AQ.PLAYING?e._doPlay().then(i).catch((function(){})):i()}))},e.play=function(){return this.offRunning(),this._doPlay()},e._doPlay=function(){var t=this;return new Promise((function(e){BQ.isRunning?(t._startSourceNode(),e()):(t.offRunning(),t._runningCallback=function(){t._startSourceNode(),e()},BQ.onceRunning(t._runningCallback),BQ.runContext().catch((function(){})))}))},e._startSourceNode=function(){var t=this;this._stopSourceNode(),this._sourceNode=BQ.createBufferSource(this._audioBuffer,this.loop),this._sourceNode.connect(this._gainNode),this._sourceNode.start(0,this._audioTimer.currentTime),this._state=AQ.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(vQ.ENDED),t._state=AQ.INIT)}),1e3*(this._audioBuffer.duration-this._audioTimer.currentTime))},e._stopSourceNode=function(){try{this._sourceNode&&(this._sourceNode.stop(),this._sourceNode.buffer=null)}catch(t){}},e.pause=function(){return this.offRunning(),this._state===AQ.PLAYING&&this._sourceNode?(this._audioTimer.pause(),this._state=AQ.PAUSED,window.clearTimeout(this._currentTimer),this._stopSourceNode(),Promise.resolve()):Promise.resolve()},e.stop=function(){return this.offRunning(),this._sourceNode?(this._audioTimer.stop(),this._state=AQ.STOPPED,window.clearTimeout(this._currentTimer),this._stopSourceNode(),Promise.resolve()):Promise.resolve()},e.onInterruptionBegin=function(t){this._eventTarget.on(vQ.INTERRUPTION_BEGIN,t)},e.offInterruptionBegin=function(t){this._eventTarget.off(vQ.INTERRUPTION_BEGIN,t)},e.onInterruptionEnd=function(t){this._eventTarget.on(vQ.INTERRUPTION_END,t)},e.offInterruptionEnd=function(t){this._eventTarget.off(vQ.INTERRUPTION_END,t)},e.onEnded=function(t){this._eventTarget.on(vQ.ENDED,t)},e.offEnded=function(t){this._eventTarget.off(vQ.ENDED,t)},n(t,[{key:"sampleRate",get:function(){return this._audioBuffer.sampleRate}},{key:"src",get:function(){return this._src}},{key:"type",get:function(){return SQ.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=xi(t),this._volume=t,BQ.setGainValue(this._gainNode,t)}},{key:"duration",get:function(){return this._audioBuffer.duration}},{key:"currentTime",get:function(){return this._audioTimer.currentTime}}]),t}()).prototype,"seek",[RQ],Object.getOwnPropertyDescriptor(IQ.prototype,"seek"),IQ.prototype),p(IQ.prototype,"play",[RQ],Object.getOwnPropertyDescriptor(IQ.prototype,"play"),IQ.prototype),p(IQ.prototype,"pause",[RQ],Object.getOwnPropertyDescriptor(IQ.prototype,"pause"),IQ.prototype),p(IQ.prototype,"stop",[RQ],Object.getOwnPropertyDescriptor(IQ.prototype,"stop"),IQ.prototype),IQ),WQ=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}(),XQ=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)!==SQ.DOM_AUDIO&&FQ.support?HQ.load(e).then((function(e){n(new t(e))})).catch((function(){})):(FQ.support||q(5201),PQ.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)!==SQ.DOM_AUDIO&&FQ.support?HQ.loadNative(t):(FQ.support||q(5201),PQ.loadNative(t))},t.loadOneShotAudio=function(t,e,i){return new Promise((function(n,r){(null==i?void 0:i.audioLoadMode)!==SQ.DOM_AUDIO&&FQ.support?HQ.loadOneShotAudio(t,e).then((function(t){n(new WQ(t))})).catch(r):(FQ.support||q(5201),PQ.loadOneShotAudio(t,e).then((function(t){n(new WQ(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}();XQ.maxAudioChannel=24;var jQ=t("ag",Is("cc.AudioClip")(((UQ=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._duration=VQ&&VQ(),e._loadMode=SQ.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&&XQ.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=SQ.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:AQ.INIT}}]),e}(zf)).AudioType=SQ,VQ=Ss((GQ=UQ).prototype,"_duration",[ks],(function(){return 0})),p(GQ.prototype,"_nativeDep",[ua],Object.getOwnPropertyDescriptor(GQ.prototype,"_nativeDep"),GQ.prototype),kQ=GQ))||kQ);function YQ(t,e,i){XQ.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 qQ(t,e,i,n){var r=new jQ;r._nativeUrl=t,r._nativeAsset=e,r.duration=e.duration,n(null,r)}v.AudioClip=jQ,Wv.register({".mp3":YQ,".ogg":YQ,".wav":YQ,".m4a":YQ}),iS.register({".mp3":qQ,".ogg":qQ,".wav":qQ,".m4a":qQ});var KQ,JQ,QQ,ZQ,$Q,tZ,eZ,iZ,nZ,rZ,sZ,aZ=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 XQ?this._tryAddPlaying(this._audioPlayerInfoList,t):this._tryAddPlaying(this._oneShotAudioInfoList,t)},e._tryRemovePlaying=function(t,e){var i=this._findIndex(t,e);return-1!==i&&(ae(t,i),!0)},e.removePlaying=function(t){t instanceof XQ?this._tryRemovePlaying(this._audioPlayerInfoList,t):this._tryRemovePlaying(this._oneShotAudioInfoList,t)},e.discardOnePlayingIfNeeded=function(){var t;this._audioPlayerInfoList.length+this._oneShotAudioInfoList.length<XQ.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}()),oZ="audiosource-loaded";!function(t){t.STARTED="started",t.ENDED="ended"}(sZ||(sZ={}));var hZ=t("af",(KQ=Is("cc.AudioSource"),JQ=ha(jQ),QQ=ha(jQ),KQ(((rZ=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._clip=tZ&&tZ(),e._player=null,e._loop=eZ&&eZ(),e._playOnAwake=iZ&&iZ(),e._volume=nZ&&nZ(),e._cachedCurrentTime=0,e._operationsBeforeLoading=[],e._isLoaded=!1,e._lastSetClip=null,e}s(e,t);var i=e.prototype;return i._resetPlayer=function(){this._player&&(aZ.removePlaying(this._player),this._player.offEnded(),this._player.offInterruptionBegin(),this._player.offInterruptionEnd(),this._player.destroy(),this._player=null)},i._syncPlayer=function(){var t=this,e=this._clip;if(this._lastSetClip!==e)return e?void(e._nativeAsset?(this._isLoaded=!1,this._lastSetClip=e,this._operationsBeforeLoading.length=0,XQ.load(e._nativeAsset.url,{audioLoadMode:e.loadMode}).then((function(i){var n;t._lastSetClip===e?(t._isLoaded=!0,t._resetPlayer(),t._player=i,i.onEnded((function(){var e;aZ.removePlaying(i),null===(e=t.node)||void 0===e||e.emit(sZ.ENDED,t)})),i.onInterruptionBegin((function(){aZ.removePlaying(i)})),i.onInterruptionEnd((function(){aZ.addPlaying(i)})),t._syncStates(),null===(n=t.node)||void 0===n||n.emit(oZ)):i.destroy()})).catch((function(){}))):console.error("Invalid audio clip")):(this._lastSetClip=null,void this._resetPlayer())},i.onLoad=function(){this._syncPlayer()},i.onEnable=function(){this._playOnAwake&&!this.playing&&this.play()},i.onDisable=function(){var t=this._getRootNode();null!=t&&t._persistNode||this.pause()},i.onDestroy=function(){var t;this.stop(),null===(t=this._player)||void 0===t||t.destroy(),this._player=null},i.getPCMData=function(t){var e=this;return new Promise((function(i){if(0!==t&&1!==t)return console.warn("Only support channel index 0 or 1 to get buffer"),void i(void 0);var n;e._player?i(e._player.getPCMData(t)):null===(n=e.node)||void 0===n||n.once(oZ,(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(oZ,(function(){e(t._player.sampleRate)}))}))},i._getRootNode=function(){for(var t,e,i=this.node,n=null===(t=i)||void 0===t||null===(e=t.parent)||void 0===e?void 0:e.parent;n;){var r,s,a;n=null===(s=i=null===(r=i)||void 0===r?void 0:r.parent)||void 0===s||null===(a=s.parent)||void 0===a?void 0:a.parent}return i},i.play=function(){var t,e=this;if(this._isLoaded||!this.clip){var i;aZ.discardOnePlayingIfNeeded(),this.state===AQ.PLAYING&&(null===(i=this._player)||void 0===i||i.stop().catch((function(){})));var n=this._player;null===(t=this._player)||void 0===t||t.play().then((function(){var t;aZ.addPlaying(n),null===(t=e.node)||void 0===t||t.emit(sZ.STARTED,e)})).catch((function(){}))}else this._operationsBeforeLoading.push("play")},i.pause=function(){var t;if(this._isLoaded||!this.clip){var e=this._player;null===(t=this._player)||void 0===t||t.pause().then((function(){aZ.removePlaying(e)})).catch((function(){}))}else this._operationsBeforeLoading.push("pause")},i.stop=function(){var t;if(this._isLoaded||!this.clip){var e=this._player;null===(t=this._player)||void 0===t||t.stop().then((function(){aZ.removePlaying(e)})).catch((function(){}))}else this._operationsBeforeLoading.push("stop")},i.playOneShot=function(t,e){void 0===e&&(e=1),t._nativeAsset?XQ.loadOneShotAudio(t._nativeAsset.url,this._volume*e,{audioLoadMode:t.loadMode}).then((function(t){aZ.discardOnePlayingIfNeeded(),t.onPlay=function(){aZ.addPlaying(t)},t.onEnd=function(){aZ.removePlaying(t)},t.play()})).catch((function(){})):console.error("Invalid audio clip")},i._syncStates=function(){var t=this;this._player&&this._player.seek(this._cachedCurrentTime).then((function(){t._player&&(t._player.loop=t._loop,t._player.volume=t._volume,t._operationsBeforeLoading.forEach((function(e){var i;null===(i=t[e])||void 0===i||i.call(t)})),t._operationsBeforeLoading.length=0)})).catch((function(){}))},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=bi(t,0,1),this._player?(this._player.volume=t,this._volume=this._player.volume):this._volume=t)}},{key:"currentTime",get:function(){return this._player?this._player.currentTime:this._cachedCurrentTime},set:function(t){var e;Number.isNaN(t)?console.warn("illegal audio time!"):(t=bi(t,0,this.duration),this._cachedCurrentTime=t,null===(e=this._player)||void 0===e||e.seek(this._cachedCurrentTime).catch((function(){})))}},{key:"duration",get:function(){var t,e;return null!==(t=null===(e=this._clip)||void 0===e?void 0:e.getDuration())&&void 0!==t?t:this._player?this._player.duration:0}},{key:"state",get:function(){return this._player?this._player.state:AQ.INIT}},{key:"playing",get:function(){return this.state===e.AudioState.PLAYING}}],[{key:"maxAudioChannel",get:function(){return XQ.maxAudioChannel}}]),e}(Vd)).AudioState=AQ,rZ.EventType=sZ,tZ=Ss(($Q=rZ).prototype,"_clip",[JQ],(function(){return null})),eZ=Ss($Q.prototype,"_loop",[ks],(function(){return!1})),iZ=Ss($Q.prototype,"_playOnAwake",[ks],(function(){return!0})),nZ=Ss($Q.prototype,"_volume",[ks],(function(){return 1})),p($Q.prototype,"clip",[QQ],Object.getOwnPropertyDescriptor($Q.prototype,"clip"),$Q.prototype),ZQ=$Q))||ZQ));function uZ(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}nt(jQ,"AudioClip",[{name:"PlayingState",newName:"AudioState",target:hZ,targetName:"AudioSource"}]),st(jQ.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=hZ,Jt(hZ,"cc.AudioSourceComponent"),v.log=F,v.warn=k,v.error=G,v.assert=V,v._throw=H,v.logID=j,v.warnID=q,v.errorID=J,v.assertID=$,v.debug=ht,v.path={join:Hu,extname:Wu,mainFileName:Xu,basename:ju,dirname:Yu,changeExtname:qu,changeBasename:Ku,_normalize:Ju,stripSep:Qu,get sep(){return Zu()}};var lZ=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},cZ=new Map,_Z=new Map;function fZ(t){var e=_Z.get(t.window);return void 0===e&&(e=_Z.size,_Z.set(t.window,e)),e}function dZ(t,e,i,n){var r=cZ.get(e);if(void 0!==r)return e.window.width,e.window.height,fZ(e),n(t,r),r;var s=fZ(e);return i(t,r=new lZ(e,cZ.size,s,e.window.width?e.window.width:1,e.window.height?e.window.height:1)),cZ.set(e,r),r}function pZ(t,e,i,n){var r=i,s=n,a=e,o=t.device;if(!t.containsResource(a)){var h=vy(o)?xl.R32F:xl.RGBA8;t.addRenderTarget(a,h,r,s,MR.MANAGED),t.addDepthStencil(a+"Depth",xl.DEPTH_STENCIL,r,s,MR.MANAGED)}t.updateRenderTarget(a,r,s),t.updateDepthStencil(a+"Depth",r,s)}var mZ=new ww;function gZ(t,e){var i=e.camera;Tw(t,i);var n=t,r=n.pipelineSceneData.shadows,s=t.pipelineSceneData.validPunctualLights,a=t.pipelineSceneData.shadows;if(mZ.reset(),!r.enabled||r.type!==QS.ShadowMap)return mZ;mZ.shadowEnabled=!0;for(var o=mZ.validLights,h=0,u=0;h<r.maxReceived&&u<s.length;){var l=s[u];l.type===xR.SPOT&&l.shadowEnabled&&(o.push(l),h++),u++}var c=i.scene.mainLight,_=a.size.x,f=a.size.y;if(c&&c.shadowEnabled)if(mZ.mainLightShadowNames[0]="MainLightShadow"+e.id,c.shadowFixedArea)pZ(t,mZ.mainLightShadowNames[0],_,f);else{var d=n.pipelineSceneData.csmSupported?c.csmLevel:1;mZ.mainLightShadowNames[0]="MainLightShadow"+e.id;for(var p=0;p<d;p++)pZ(t,mZ.mainLightShadowNames[0],_,f)}for(var m=0;m<o.length;m++){o[m];var g="SpotLightShadow"+m.toString()+e.id;mZ.spotLightShadowNames[m]=g,pZ(t,mZ.spotLightShadowNames[m],_,f)}return mZ}var yZ,vZ=gZ;function SZ(t,e,i,n,r,s,a){var o=s,h=a,u=Cw(i,s,a,n,r);s=u.width,a=u.height;var l=t;r||((yZ=e.addRenderPass(s,a,"default")).name=t,yZ.setViewport(new Ec(0,0,o,h)),yZ.addRenderTarget(l,jl.CLEAR,Yl.STORE,new bc(1,1,1,i.clearColor.w)),yZ.addDepthStencil(l+"Depth",jl.CLEAR,Yl.DISCARD,i.clearDepth,i.clearStencil,oc.DEPTH_STENCIL));var c=yZ.addQueue(NR.RENDER_OPAQUE,"shadow-caster");c.addSceneOfCamera(i,new cw(n,r),GR.SHADOW_CASTER),c.setViewport(new Ec(u.x,u.y,u.width,u.height))}function AZ(t,e){if(mZ.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(mZ.mainLightShadowNames[0]="MainLightShadow"+e.id,a.shadowFixedArea)SZ(mZ.mainLightShadowNames[0],t,i,a,0,r,s);else{var o=t.pipelineSceneData.csmSupported?a.csmLevel:1;mZ.mainLightShadowNames[0]="MainLightShadow"+e.id;for(var h=0;h<o;h++)SZ(mZ.mainLightShadowNames[0],t,i,a,h,r,s)}for(var u=0;u<mZ.validLights.length;u++){var l=mZ.validLights[u],c="SpotLightShadow"+u.toString()+e.id;mZ.spotLightShadowNames[u]=c,SZ(c,t,i,l,0,r,s)}}}function TZ(t,e,i){var n=Cw(e.camera,e.camera.window.width,e.camera.window.height),r=n.width,s=n.height,a=t.addRenderPass(r,s,"default"),o=e.camera;a.addRenderTarget(i,jl.LOAD,Yl.STORE),a.addDepthStencil(CZ.ds,jl.LOAD,Yl.DISCARD);for(var h,u=f(mZ.mainLightShadowNames);!(h=u()).done;){var l=h.value;t.containsResource(l)&&a.addTexture(l,"cc_shadowMap")}for(var c,_=f(mZ.spotLightShadowNames);!(c=_()).done;){var d=c.value;t.containsResource(d)&&a.addTexture(d,"cc_spotShadowMap")}a.addQueue(NR.RENDER_OPAQUE,"deferred-forward").addSceneOfCamera(o,new cw,GR.OPAQUE_OBJECT|GR.PLANAR_SHADOW|GR.CUTOUT_OBJECT|GR.DEFAULT_LIGHTING|GR.DRAW_INSTANCING),a.addQueue(NR.RENDER_TRANSPARENT,"deferred-forward").addSceneOfCamera(o,new cw,GR.TRANSPARENT_OBJECT|GR.GEOMETRY)}function EZ(t,e,i,n){void 0===i&&(i=!1),void 0===n&&(n=!0),AZ(t,e);var r=e.id,s=Cw(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 Ec(s.x,s.y,a,o));for(var u,l=f(mZ.mainLightShadowNames);!(u=l()).done;){var c=u.value;t.containsResource(c)&&h.addTexture(c,"cc_shadowMap")}for(var _,d=f(mZ.spotLightShadowNames);!(_=d()).done;){var p=_.value;t.containsResource(p)&&h.addTexture(p,"cc_spotShadowMap")}var m=e.camera;h.addRenderTarget("ForwardColor"+e.id,i?jl.CLEAR:xw(m.clearFlag,UR.RENDER_TARGET),Yl.STORE,new bc(m.clearColor.x,m.clearColor.y,m.clearColor.z,m.clearColor.w)),h.addDepthStencil("ForwardDepthStencil"+e.id,i?jl.CLEAR:xw(m.clearFlag,UR.DEPTH_STENCIL),i?Yl.DISCARD:Yl.STORE,m.clearDepth,m.clearStencil,m.clearFlag),h.addQueue(NR.RENDER_OPAQUE).addSceneOfCamera(m,new cw,GR.OPAQUE_OBJECT|GR.PLANAR_SHADOW|GR.CUTOUT_OBJECT|GR.DEFAULT_LIGHTING|GR.DRAW_INSTANCING);var g=GR.TRANSPARENT_OBJECT|GR.GEOMETRY;return i||(g|=GR.UI,h.showStatistics=!0),n&&h.addQueue(NR.RENDER_TRANSPARENT).addSceneOfCamera(m,new cw,g),{rtName:"ForwardColor"+e.id,dsName:"ForwardDepthStencil"+e.id}}var bZ,xZ,CZ=new function(){this.color=void 0,this.normal=void 0,this.emissive=void 0,this.ds=void 0};function RZ(t,e){var i=e.camera,n=Cw(i,i.window.width,i.window.height),r=n.width,s=n.height,a=CZ.color,o=CZ.normal,h=CZ.emissive,u=CZ.ds,l=t.addRenderPass(r,s,"gbuffer");l.name="CameraGBufferPass"+e.id,l.setViewport(new Ec(n.x,n.y,r,s));var c=new bc(0,0,0,0);return i.clearFlag&oc.COLOR&&(t.pipelineSceneData.isHDR?NS(c,i.clearColor):(c.x=i.clearColor.x,c.y=i.clearColor.y,c.z=i.clearColor.z)),l.addRenderTarget(a,jl.CLEAR,Yl.STORE,c),l.addRenderTarget(h,jl.CLEAR,Yl.STORE,new bc(0,0,0,0)),l.addRenderTarget(o,jl.CLEAR,Yl.STORE,new bc(0,0,0,0)),l.addDepthStencil(u,jl.CLEAR,Yl.STORE,i.clearDepth,i.clearStencil,i.clearFlag),l.addQueue(NR.RENDER_OPAQUE,"gbuffer").addSceneOfCamera(i,new cw,GR.OPAQUE_OBJECT|GR.CUTOUT_OBJECT),l}function wZ(t,e,i){AZ(t,e),bZ||(bZ=new Iw(i));var n=t,r=e.camera,s=Cw(r,r.window.width,r.window.height),a=s.width,o=s.height,h=bw(r),u="deferredLightingPassRTName"+e.id,l=n.addRenderPass(a,o,"deferred-lighting");l.name="CameraLightingPass"+e.id,l.setViewport(new Ec(s.x,s.y,a,o));for(var c,_=f(mZ.mainLightShadowNames);!(c=_()).done;){var d=c.value;n.containsResource(d)&&l.addTexture(d,"cc_shadowMap")}for(var p,m=f(mZ.spotLightShadowNames);!(p=m()).done;){var g=p.value;n.containsResource(g)&&l.addTexture(g,"cc_spotShadowMap")}n.containsResource(CZ.color)&&(l.addTexture(CZ.color,"albedoMap"),l.addTexture(CZ.normal,"normalMap"),l.addTexture(CZ.emissive,"emissiveMap"),l.addTexture(CZ.ds,"depthStencil"));var y="clusterLightBuffer"+h,v="clusterLightIndicesBuffer"+h,S="clusterLightGridBuffer"+h;n.containsResource(y)&&(l.addStorageBuffer(y,zR.READ,"b_ccLightsBuffer"),l.addStorageBuffer(v,zR.READ,"b_clusterLightIndicesBuffer"),l.addStorageBuffer(S,zR.READ,"b_clusterLightGridBuffer"));var A=new bc(0,0,0,0);return r.clearFlag&oc.COLOR&&(A.x=r.clearColor.x,A.y=r.clearColor.y,A.z=r.clearColor.z),A.w=0,l.addRenderTarget(u,jl.CLEAR,Yl.STORE,A),l.addQueue(NR.RENDER_TRANSPARENT).addCameraQuad(r,bZ.deferredLightingMaterial,0,GR.VOLUMETRIC_LIGHTING),{rtName:u}}function IZ(t,e,i){xZ||(xZ=new Rw);var n=e.id,r=e.camera,s=Cw(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 Ec(s.x,s.y,s.width,s.height)),t.containsResource(i)&&l.addTexture(i,"outputResultMap");var c=new bc(0,0,0,r.clearColor.w);return r.clearFlag&oc.COLOR&&(c.x=r.clearColor.x,c.y=r.clearColor.y,c.z=r.clearColor.z),l.addRenderTarget(h,xw(r.clearFlag,UR.RENDER_TARGET),Yl.STORE,c),l.addDepthStencil(u,xw(r.clearFlag,UR.DEPTH_STENCIL),Yl.STORE,r.clearDepth,r.clearStencil,r.clearFlag),l.addQueue(NR.NONE).addCameraQuad(r,xZ.postMaterial,0,GR.NONE),jS()===r&&(l.showStatistics=!0),{rtName:h,dsName:u}}function BZ(t,e){var i=e.camera,n=Cw(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 Ec(n.x,n.y,r,s)),h.addRenderTarget(a,xw(i.clearFlag,UR.RENDER_TARGET),Yl.STORE,new bc(i.clearColor.x,i.clearColor.y,i.clearColor.z,i.clearColor.w)),h.addDepthStencil(o,xw(i.clearFlag,UR.DEPTH_STENCIL),Yl.STORE,i.clearDepth,i.clearStencil,i.clearFlag);var u=GR.UI;h.addQueue(NR.RENDER_TRANSPARENT).addSceneOfCamera(i,new cw,u),jS()===i&&(h.showStatistics=!0)}new bc(0,0,0,0),t("d7",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),EZ(e,dZ(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=Cw(n,n.window.width,n.window.height),s=r.width,a=r.height;gZ(t,e),i?t.addRenderTarget("ForwardColor"+e.id,function(t){var e=t.getMacroBool("CC_USE_FLOAT_OUTPUT");return t.pipelineSceneData.isHDR&&e&&Sy(t.device)?xl.RGBA16F:xl.RGBA8}(t),s,a,MR.PERSISTENT):t.addRenderWindow("ForwardColor"+e.id,xl.BGRA8,s,a,e.camera.window),t.addDepthStencil("ForwardDepthStencil"+e.id,xl.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=Cw(n,n.window.width,n.window.height),s=r.width,a=r.height;vZ(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("d8",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(bl.COMPUTE_SHADER),s=n.cameraUsage===VC.GAME||n.cameraUsage===VC.GAME_VIEW,a=dZ(e,n,this.initResource,this.updateResource);if(s)if(uZ(n))BZ(e,a);else{r&&zw(n,e),RZ(e,a);var o=wZ(e,a,r);TZ(e,a,o.rtName),IZ(e,a,o.rtName)}else EZ(e,a)}}},e.initResource=function(t,e){uZ(e.camera)?function(t,e){var i=e.camera,n=Cw(i,i.window.width,i.window.height),r=n.width,s=n.height,a="dsUIAndProfilerPassColor"+e.id,o="dsUIAndProfilerPassDS"+e.id;t.addRenderWindow(a,xl.BGRA8,r,s,i.window),t.addDepthStencil(o,xl.DEPTH_STENCIL,r,s,MR.MANAGED)}(t,e):(function(t,e){var i=e.camera,n=Cw(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=xl.RGBA16F;t.addRenderTarget(a,l,r,s,MR.MANAGED),t.addRenderTarget(h,l,r,s,MR.MANAGED),t.addRenderTarget(o,l,r,s,MR.MANAGED),t.addDepthStencil(u,xl.DEPTH_STENCIL,r,s,MR.MANAGED),CZ.color=a,CZ.normal=o,CZ.emissive=h,CZ.ds=u}(t,e),function(t,e){gZ(t,e);var i=e.camera,n=Cw(i,i.window.width,i.window.height),r=n.width,s=n.height,a="deferredLightingPassRTName"+e.id;t.addRenderTarget(a,xl.RGBA8,r,s,MR.MANAGED)}(t,e),function(t,e){var i=e.id,n=e.camera,r=Cw(n,n.window.width,n.window.height),s=r.width,a=r.height,o="postprocessPassRTName"+i,h="postprocessPassDS"+i;t.addRenderWindow(o,xl.BGRA8,s,a,n.window),t.addDepthStencil(h,xl.DEPTH_STENCIL,s,a,MR.MANAGED)}(t,e))},e.updateResource=function(t,e){uZ(e.camera)?function(t,e){var i=e.camera,n=Cw(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=Cw(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){vZ(t,e);var i=e.camera,n=Cw(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=Cw(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 DZ=ba.Flags.Destroyed,PZ=ba.Flags.PersistentMask,OZ=[];function MZ(t){var e;if(xa(t)){if(t._instantiate)return v.game._isCloning=!0,e=t._instantiate(null,!0),v.game._isCloning=!1,e;if(t instanceof v.Asset)throw new TypeError(tt(6903))}return v.game._isCloning=!0,e=NZ(t),v.game._isCloning=!1,e}function NZ(t,e){var i;LZ(t,i=t._iN$t?t._iN$t:t.constructor?new(0,t.constructor):Object.create(null),e);for(var n=0,r=OZ.length;n<r;++n)OZ[n]._iN$t=null;return OZ.length=0,i}function LZ(t,e,i){bt(t,"_iN$t",e,!0),OZ.push(t);var n=t.constructor;if(di(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||FZ(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||FZ(s,i)}else e[r]=s}xa(t)&&(e._objFlags&=PZ)}function FZ(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,OZ.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,OZ.push(t);for(var a=0;a<s;++a){var o=t[a];i[a]="object"==typeof o&&o?o._iN$t||FZ(o,e):o}return i}if(t._objFlags&DZ)return null;var h=t.constructor;if(di(h)){if(e)if(e instanceof v.Component){if(t instanceof v.Node||t instanceof v.Component)return t}else if(e instanceof v.Node)if(t instanceof v.Node){if(!t.isChildOf(e))return t}else if(t instanceof v.Component&&t.node&&!t.node.isChildOf(e))return t;i=new h}else if(h===Object)i={};else{if(h)return t;i=Object.create(null)}return LZ(t,i,e),i}MZ._clone=NZ,v.instantiate=MZ;var kZ,GZ,VZ=t("e6",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=VZ;var UZ=null!==(kZ=globalThis.jsb)&&void 0!==kZ?kZ:{};t("eo",{DownloaderHints:UZ.DownloaderHints,Downloader:UZ.Downloader,zipUtils:UZ.zipUtils,fileUtils:UZ.fileUtils,DebugRenderer:UZ.DebugRenderer,copyTextToClipboard:null===(GZ=UZ.copyTextToClipboard)||void 0===GZ?void 0:GZ.bind(UZ),garbageCollect:UZ.garbageCollect,reflection:UZ.reflection,bridge:UZ.bridge,jsbBridgeWrapper:UZ.jsbBridgeWrapper,AssetsManager:UZ.AssetsManager,EventAssetsManager:UZ.EventAssetsManager,Manifest:UZ.Manifest,saveImageData:UZ.saveImageData,process:UZ.process}),v.renderer=UG;var zZ=Object.setPrototypeOf,HZ={};HZ||(HZ={}),function(t){var e=function(){function e(i){this._clock=new t.WorldClock,this._events=[],this._objects=[],this._eventManager=null,this._eventManager=i,console.info("DragonBones: "+e.VERSION+"\nWebsite: http://dragonbones.com/\nSource and Demo: https://github.com/DragonBones/")}return e.prototype.advanceTime=function(e){if(this._objects.length>0){for(var i=0,n=this._objects;i<n.length;i++)n[i].returnToPool();this._objects.length=0}if(this._clock.advanceTime(e),this._events.length>0){for(var r=0;r<this._events.length;++r){var s=this._events[r],a=s.armature;null!==a._armatureData&&(a.eventDispatcher.dispatchDBEvent(s.type,s),s.type===t.EventObject.SOUND_EVENT&&this._eventManager.dispatchDBEvent(s.type,s)),this.bufferObject(s)}this._events.length=0}},e.prototype.bufferEvent=function(t){this._events.indexOf(t)<0&&this._events.push(t)},e.prototype.bufferObject=function(t){this._objects.indexOf(t)<0&&this._objects.push(t)},Object.defineProperty(e.prototype,"clock",{get:function(){return this._clock},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"eventManager",{get:function(){return this._eventManager},enumerable:!0,configurable:!0}),e.VERSION="5.6.300",e.yDown=!1,e.debug=!1,e.debugDraw=!1,e.webAssembly=!1,e}();t.DragonBones=e}(HZ||(HZ={})),console.warn||(console.warn=function(){}),console.assert||(console.assert=function(){}),Date.now||(Date.now=function(){return(new Date).getTime()}),zZ=function(t,e){function i(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);i.prototype=e.prototype,t.prototype=new i},function(t){var e=function(){function t(){this.hashCode=t._hashCode++,this._isInPool=!1}return t._returnObject=function(e){var i=String(e.constructor),n=i in t._maxCountMap?t._maxCountMap[i]:t._defaultMaxCount,r=t._poolsMap[i]=t._poolsMap[i]||[];r.length<n&&(e._isInPool?console.warn("The object is already in the pool."):(e._isInPool=!0,r.push(e)))},t.toString=function(){throw new Error},t.setMaxCount=function(e,i){if((i<0||i!=i)&&(i=0),null!==e)null!==(r=(n=String(e))in t._poolsMap?t._poolsMap[n]:null)&&r.length>i&&(r.length=i),t._maxCountMap[n]=i;else for(var n in t._defaultMaxCount=i,t._poolsMap){var r;(r=t._poolsMap[n]).length>i&&(r.length=i),n in t._maxCountMap&&(t._maxCountMap[n]=i)}},t.clearPool=function(e){if(void 0===e&&(e=null),null!==e){var i=String(e);null!==(r=i in t._poolsMap?t._poolsMap[i]:null)&&r.length>0&&(r.length=0)}else for(var n in t._poolsMap){var r;(r=t._poolsMap[n]).length=0}},t.borrowObject=function(e){var i=String(e),n=i in t._poolsMap?t._poolsMap[i]:null;if(null!==n&&n.length>0){var r=n.pop();return r._isInPool=!1,r}var s=new e;return s._onClear(),s},t.prototype.returnToPool=function(){this._onClear(),t._returnObject(this)},t._hashCode=0,t._defaultMaxCount=3e3,t._maxCountMap={},t._poolsMap={},t}();t.BaseObject=e}(HZ||(HZ={})),function(t){var e=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.prototype.toString=function(){return"[object dragonBones.Matrix] a:"+this.a+" b:"+this.b+" c:"+this.c+" d:"+this.d+" tx:"+this.tx+" ty:"+this.ty},t.prototype.copyFrom=function(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this},t.prototype.copyFromArray=function(t,e){return void 0===e&&(e=0),this.a=t[e],this.b=t[e+1],this.c=t[e+2],this.d=t[e+3],this.tx=t[e+4],this.ty=t[e+5],this},t.prototype.identity=function(){return this.a=this.d=1,this.b=this.c=0,this.tx=this.ty=0,this},t.prototype.concat=function(t){var e=this.a*t.a,i=0,n=0,r=this.d*t.d,s=this.tx*t.a+t.tx,a=this.ty*t.d+t.ty;return 0===this.b&&0===this.c||(e+=this.b*t.c,i+=this.b*t.d,n+=this.c*t.a,r+=this.c*t.b),0===t.b&&0===t.c||(i+=this.a*t.b,n+=this.d*t.c,s+=this.ty*t.c,a+=this.tx*t.b),this.a=e,this.b=i,this.c=n,this.d=r,this.tx=s,this.ty=a,this},t.prototype.invert=function(){var t=this.a,e=this.b,i=this.c,n=this.d,r=this.tx,s=this.ty;if(0===e&&0===i)return this.b=this.c=0,0===t||0===n?this.a=this.b=this.tx=this.ty=0:(t=this.a=1/t,n=this.d=1/n,this.tx=-t*r,this.ty=-n*s),this;var a=t*n-e*i;if(0===a)return this.a=this.d=1,this.b=this.c=0,this.tx=this.ty=0,this;a=1/a;var o=this.a=n*a;return e=this.b=-e*a,i=this.c=-i*a,n=this.d=t*a,this.tx=-(o*r+i*s),this.ty=-(e*r+n*s),this},t.prototype.transformPoint=function(t,e,i,n){void 0===n&&(n=!1),i.x=this.a*t+this.c*e,i.y=this.b*t+this.d*e,n||(i.x+=this.tx,i.y+=this.ty)},t.prototype.transformRectangle=function(t,e){void 0===e&&(e=!1);var i=this.a,n=this.b,r=this.c,s=this.d,a=e?0:this.tx,o=e?0:this.ty,h=t.x,u=t.y,l=h+t.width,c=u+t.height,_=i*h+r*u+a,f=n*h+s*u+o,d=i*l+r*u+a,p=n*l+s*u+o,m=i*l+r*c+a,g=n*l+s*c+o,y=i*h+r*c+a,v=n*h+s*c+o,S=0;_>d&&(S=_,_=d,d=S),m>y&&(S=m,m=y,y=S),t.x=Math.floor(_<m?_:m),t.width=Math.ceil((d>y?d:y)-t.x),f>p&&(S=f,f=p,p=S),g>v&&(S=g,g=v,v=S),t.y=Math.floor(f<g?f:g),t.height=Math.ceil((p>v?p:v)-t.y)},t}();t.Matrix=e}(HZ||(HZ={})),function(t){var e=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=1),void 0===s&&(s=1),this.x=t,this.y=e,this.skew=i,this.rotation=n,this.scaleX=r,this.scaleY=s}return t.normalizeRadian=function(t){return(t=(t+Math.PI)%(2*Math.PI))+(t>0?-Math.PI:Math.PI)},t.prototype.toString=function(){return"[object dragonBones.Transform] x:"+this.x+" y:"+this.y+" skewX:"+180*this.skew/Math.PI+" skewY:"+180*this.rotation/Math.PI+" scaleX:"+this.scaleX+" scaleY:"+this.scaleY},t.prototype.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.skew=t.skew,this.rotation=t.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this},t.prototype.identity=function(){return this.x=this.y=0,this.skew=this.rotation=0,this.scaleX=this.scaleY=1,this},t.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this.skew+=t.skew,this.rotation+=t.rotation,this.scaleX*=t.scaleX,this.scaleY*=t.scaleY,this},t.prototype.minus=function(t){return this.x-=t.x,this.y-=t.y,this.skew-=t.skew,this.rotation-=t.rotation,this.scaleX/=t.scaleX,this.scaleY/=t.scaleY,this},t.prototype.fromMatrix=function(e){var i=this.scaleX,n=this.scaleY,r=t.PI_Q;this.x=e.tx,this.y=e.ty,this.rotation=Math.atan(e.b/e.a);var s=Math.atan(-e.c/e.d);return this.scaleX=this.rotation>-r&&this.rotation<r?e.a/Math.cos(this.rotation):e.b/Math.sin(this.rotation),this.scaleY=s>-r&&s<r?e.d/Math.cos(s):-e.c/Math.sin(s),i>=0&&this.scaleX<0&&(this.scaleX=-this.scaleX,this.rotation=this.rotation-Math.PI),n>=0&&this.scaleY<0&&(this.scaleY=-this.scaleY,s-=Math.PI),this.skew=s-this.rotation,this},t.prototype.toMatrix=function(t){return 0===this.rotation?(t.a=1,t.b=0):(t.a=Math.cos(this.rotation),t.b=Math.sin(this.rotation)),0===this.skew?(t.c=-t.b,t.d=t.a):(t.c=-Math.sin(this.skew+this.rotation),t.d=Math.cos(this.skew+this.rotation)),1!==this.scaleX&&(t.a*=this.scaleX,t.b*=this.scaleX),1!==this.scaleY&&(t.c*=this.scaleY,t.d*=this.scaleY),t.tx=this.x,t.ty=this.y,this},t.PI=Math.PI,t.PI_D=2*Math.PI,t.PI_H=Math.PI/2,t.PI_Q=Math.PI/4,t.RAD_DEG=180/Math.PI,t.DEG_RAD=Math.PI/180,t}();t.Transform=e}(HZ||(HZ={})),function(t){var e=function(){function t(t,e,i,n,r,s,a,o){void 0===t&&(t=1),void 0===e&&(e=1),void 0===i&&(i=1),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),this.alphaMultiplier=t,this.redMultiplier=e,this.greenMultiplier=i,this.blueMultiplier=n,this.alphaOffset=r,this.redOffset=s,this.greenOffset=a,this.blueOffset=o}return t.prototype.copyFrom=function(t){this.alphaMultiplier=t.alphaMultiplier,this.redMultiplier=t.redMultiplier,this.greenMultiplier=t.greenMultiplier,this.blueMultiplier=t.blueMultiplier,this.alphaOffset=t.alphaOffset,this.redOffset=t.redOffset,this.greenOffset=t.greenOffset,this.blueOffset=t.blueOffset},t.prototype.identity=function(){this.alphaMultiplier=this.redMultiplier=this.greenMultiplier=this.blueMultiplier=1,this.alphaOffset=this.redOffset=this.greenOffset=this.blueOffset=0},t}();t.ColorTransform=e}(HZ||(HZ={})),function(t){var e=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=t,this.y=e}return t.prototype.copyFrom=function(t){this.x=t.x,this.y=t.y},t.prototype.clear=function(){this.x=this.y=0},t}();t.Point=e}(HZ||(HZ={})),function(t){var e=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.copyFrom=function(t){this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height},t.prototype.clear=function(){this.x=this.y=0,this.width=this.height=0},t}();t.Rectangle=e}(HZ||(HZ={})),function(t){var e=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.ints=[],e.floats=[],e.strings=[],e}return zZ(e,t),e.toString=function(){return"[class dragonBones.UserData]"},e.prototype._onClear=function(){this.ints.length=0,this.floats.length=0,this.strings.length=0},e.prototype.addInt=function(t){this.ints.push(t)},e.prototype.addFloat=function(t){this.floats.push(t)},e.prototype.addString=function(t){this.strings.push(t)},e.prototype.getInt=function(t){return void 0===t&&(t=0),t>=0&&t<this.ints.length?this.ints[t]:0},e.prototype.getFloat=function(t){return void 0===t&&(t=0),t>=0&&t<this.floats.length?this.floats[t]:0},e.prototype.getString=function(t){return void 0===t&&(t=0),t>=0&&t<this.strings.length?this.strings[t]:""},e}(t.BaseObject);t.UserData=e;var i=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.data=null,e}return zZ(e,t),e.toString=function(){return"[class dragonBones.ActionData]"},e.prototype._onClear=function(){null!==this.data&&this.data.returnToPool(),this.type=0,this.name="",this.bone=null,this.slot=null,this.data=null},e}(t.BaseObject);t.ActionData=i}(HZ||(HZ={})),function(t){var e=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.frameIndices=[],e.cachedFrames=[],e.armatureNames=[],e.armatures={},e.userData=null,e}return zZ(e,t),e.toString=function(){return"[class dragonBones.DragonBonesData]"},e.prototype._onClear=function(){for(var t in this.armatures)this.armatures[t].returnToPool(),delete this.armatures[t];null!==this.userData&&this.userData.returnToPool(),this.autoSearch=!1,this.frameRate=0,this.version="",this.name="",this.stage=null,this.frameIndices.length=0,this.cachedFrames.length=0,this.armatureNames.length=0,this.binary=null,this.intArray=null,this.floatArray=null,this.frameIntArray=null,this.frameFloatArray=null,this.frameArray=null,this.timelineArray=null,this.userData=null},e.prototype.addArmature=function(t){t.name in this.armatures?console.warn("Same armature: "+t.name):(t.parent=this,this.armatures[t.name]=t,this.armatureNames.push(t.name))},e.prototype.getArmature=function(t){return t in this.armatures?this.armatures[t]:null},e.prototype.dispose=function(){console.warn("已废弃"),this.returnToPool()},e}(t.BaseObject);t.DragonBonesData=e}(HZ||(HZ={})),function(t){var e=function(e){function i(){var i=null!==e&&e.apply(this,arguments)||this;return i.aabb=new t.Rectangle,i.animationNames=[],i.sortedBones=[],i.sortedSlots=[],i.defaultActions=[],i.actions=[],i.bones={},i.slots={},i.constraints={},i.skins={},i.animations={},i.canvas=null,i.userData=null,i}return zZ(i,e),i.toString=function(){return"[class dragonBones.ArmatureData]"},i.prototype._onClear=function(){for(var t=0,e=this.defaultActions;t<e.length;t++)e[t].returnToPool();for(var i=0,n=this.actions;i<n.length;i++)n[i].returnToPool();for(var r in this.bones)this.bones[r].returnToPool(),delete this.bones[r];for(var r in this.slots)this.slots[r].returnToPool(),delete this.slots[r];for(var r in this.constraints)this.constraints[r].returnToPool(),delete this.constraints[r];for(var r in this.skins)this.skins[r].returnToPool(),delete this.skins[r];for(var r in this.animations)this.animations[r].returnToPool(),delete this.animations[r];null!==this.canvas&&this.canvas.returnToPool(),null!==this.userData&&this.userData.returnToPool(),this.type=0,this.frameRate=0,this.cacheFrameRate=0,this.scale=1,this.name="",this.aabb.clear(),this.animationNames.length=0,this.sortedBones.length=0,this.sortedSlots.length=0,this.defaultActions.length=0,this.actions.length=0,this.defaultSkin=null,this.defaultAnimation=null,this.canvas=null,this.userData=null,this.parent=null},i.prototype.sortBones=function(){var t=this.sortedBones.length;if(!(t<=0)){var e=this.sortedBones.concat(),i=0,n=0;for(this.sortedBones.length=0;n<t;){var r=e[i++];if(i>=t&&(i=0),!(this.sortedBones.indexOf(r)>=0)){var s=!1;for(var a in this.constraints){var o=this.constraints[a];if(o.root===r&&this.sortedBones.indexOf(o.target)<0){s=!0;break}}s||null!==r.parent&&this.sortedBones.indexOf(r.parent)<0||(this.sortedBones.push(r),n++)}}}},i.prototype.cacheFrames=function(t){if(!(this.cacheFrameRate>0))for(var e in this.cacheFrameRate=t,this.animations)this.animations[e].cacheFrames(this.cacheFrameRate)},i.prototype.setCacheFrame=function(t,e){var i=this.parent.cachedFrames,n=i.length;return i.length+=10,i[n]=t.a,i[n+1]=t.b,i[n+2]=t.c,i[n+3]=t.d,i[n+4]=t.tx,i[n+5]=t.ty,i[n+6]=e.rotation,i[n+7]=e.skew,i[n+8]=e.scaleX,i[n+9]=e.scaleY,n},i.prototype.getCacheFrame=function(t,e,i){var n=this.parent.cachedFrames;t.a=n[i],t.b=n[i+1],t.c=n[i+2],t.d=n[i+3],t.tx=n[i+4],t.ty=n[i+5],e.rotation=n[i+6],e.skew=n[i+7],e.scaleX=n[i+8],e.scaleY=n[i+9],e.x=t.tx,e.y=t.ty},i.prototype.addBone=function(t){t.name in this.bones?console.warn("Same bone: "+t.name):(this.bones[t.name]=t,this.sortedBones.push(t))},i.prototype.addSlot=function(t){t.name in this.slots?console.warn("Same slot: "+t.name):(this.slots[t.name]=t,this.sortedSlots.push(t))},i.prototype.addConstraint=function(t){t.name in this.constraints?console.warn("Same constraint: "+t.name):this.constraints[t.name]=t},i.prototype.addSkin=function(t){t.name in this.skins?console.warn("Same skin: "+t.name):(t.parent=this,this.skins[t.name]=t,null===this.defaultSkin&&(this.defaultSkin=t),"default"===t.name&&(this.defaultSkin=t))},i.prototype.addAnimation=function(t){t.name in this.animations?console.warn("Same animation: "+t.name):(t.parent=this,this.animations[t.name]=t,this.animationNames.push(t.name),null===this.defaultAnimation&&(this.defaultAnimation=t))},i.prototype.addAction=function(t,e){e?this.defaultActions.push(t):this.actions.push(t)},i.prototype.getBone=function(t){return t in this.bones?this.bones[t]:null},i.prototype.getSlot=function(t){return t in this.slots?this.slots[t]:null},i.prototype.getConstraint=function(t){return t in this.constraints?this.constraints[t]:null},i.prototype.getSkin=function(t){return t in this.skins?this.skins[t]:null},i.prototype.getMesh=function(t,e,i){var n=this.getSkin(t);return null===n?null:n.getDisplay(e,i)},i.prototype.getAnimation=function(t){return t in this.animations?this.animations[t]:null},i}(t.BaseObject);t.ArmatureData=e;var i=function(e){function i(){var i=null!==e&&e.apply(this,arguments)||this;return i.transform=new t.Transform,i.userData=null,i}return zZ(i,e),i.toString=function(){return"[class dragonBones.BoneData]"},i.prototype._onClear=function(){null!==this.userData&&this.userData.returnToPool(),this.inheritTranslation=!1,this.inheritRotation=!1,this.inheritScale=!1,this.inheritReflection=!1,this.type=0,this.length=0,this.name="",this.transform.identity(),this.userData=null,this.parent=null},i}(t.BaseObject);t.BoneData=i;var n=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.vertices=[],e}return zZ(e,t),e.toString=function(){return"[class dragonBones.SurfaceData]"},e.prototype._onClear=function(){t.prototype._onClear.call(this),this.type=1,this.segmentX=0,this.segmentY=0,this.vertices.length=0},e}(i);t.SurfaceData=n;var r=function(e){function i(){var t=null!==e&&e.apply(this,arguments)||this;return t.color=null,t.userData=null,t}return zZ(i,e),i.createColor=function(){return new t.ColorTransform},i.toString=function(){return"[class dragonBones.SlotData]"},i.prototype._onClear=function(){null!==this.userData&&this.userData.returnToPool(),this.blendMode=0,this.displayIndex=0,this.zOrder=0,this.name="",this.color=null,this.userData=null,this.parent=null},i.DEFAULT_COLOR=new t.ColorTransform,i}(t.BaseObject);t.SlotData=r}(HZ||(HZ={})),function(t){var e=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return zZ(e,t),e.prototype._onClear=function(){this.order=0,this.name="",this.type=0,this.target=null,this.root=null,this.bone=null},e}(t.BaseObject);t.ConstraintData=e;var i=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return zZ(e,t),e.toString=function(){return"[class dragonBones.IKConstraintData]"},e.prototype._onClear=function(){t.prototype._onClear.call(this),this.scaleEnabled=!1,this.bendPositive=!1,this.weight=1},e}(e);t.IKConstraintData=i;var n=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.bones=[],e}return zZ(e,t),e.toString=function(){return"[class dragonBones.PathConstraintData]"},e.prototype._onClear=function(){t.prototype._onClear.call(this),this.pathSlot=null,this.pathDisplayData=null,this.bones.length=0,this.positionMode=0,this.spacingMode=1,this.rotateMode=1,this.position=0,this.spacing=0,this.rotateOffset=0,this.rotateMix=0,this.translateMix=0},e.prototype.AddBone=function(t){this.bones.push(t)},e}(e);t.PathConstraintData=n}(HZ||(HZ={})),function(t){var e=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return zZ(e,t),e.toString=function(){return"[class dragonBones.CanvasData]"},e.prototype._onClear=function(){this.hasBackground=!1,this.color=0,this.x=0,this.y=0,this.width=0,this.height=0},e}(t.BaseObject);t.CanvasData=e}(HZ||(HZ={})),function(t){var e=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.displays={},e}return zZ(e,t),e.toString=function(){return"[class dragonBones.SkinData]"},e.prototype._onClear=function(){for(var t in this.displays){for(var e=0,i=this.displays[t];e<i.length;e++){var n=i[e];null!==n&&n.returnToPool()}delete this.displays[t]}this.name="",this.parent=null},e.prototype.addDisplay=function(t,e){t in this.displays||(this.displays[t]=[]),null!==e&&(e.parent=this),this.displays[t].push(e)},e.prototype.getDisplay=function(t,e){var i=this.getDisplays(t);if(null!==i)for(var n=0,r=i;n<r.length;n++){var s=r[n];if(null!==s&&s.name===e)return s}return null},e.prototype.getDisplays=function(t){return t in this.displays?this.displays[t]:null},e}(t.BaseObject);t.SkinData=e}(HZ||(HZ={})),function(t){var e=function(){function t(){this.weight=null}return t.prototype.clear=function(){this.isShared||null===this.weight||this.weight.returnToPool(),this.isShared=!1,this.inheritDeform=!1,this.offset=0,this.data=null,this.weight=null},t.prototype.shareFrom=function(t){this.isShared=!0,this.offset=t.offset,this.weight=t.weight},t}();t.VerticesData=e;var i=function(e){function i(){var i=null!==e&&e.apply(this,arguments)||this;return i.transform=new t.Transform,i}return zZ(i,e),i.prototype._onClear=function(){this.name="",this.path="",this.transform.identity(),this.parent=null},i}(t.BaseObject);t.DisplayData=i;var n=function(e){function i(){var i=null!==e&&e.apply(this,arguments)||this;return i.pivot=new t.Point,i}return zZ(i,e),i.toString=function(){return"[class dragonBones.ImageDisplayData]"},i.prototype._onClear=function(){e.prototype._onClear.call(this),this.type=0,this.pivot.clear(),this.texture=null},i}(i);t.ImageDisplayData=n;var r=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.actions=[],e}return zZ(e,t),e.toString=function(){return"[class dragonBones.ArmatureDisplayData]"},e.prototype._onClear=function(){t.prototype._onClear.call(this);for(var e=0,i=this.actions;e<i.length;e++)i[e].returnToPool();this.type=1,this.inheritAnimation=!1,this.actions.length=0,this.armature=null},e.prototype.addAction=function(t){this.actions.push(t)},e}(i);t.ArmatureDisplayData=r;var s=function(t){function i(){var i=null!==t&&t.apply(this,arguments)||this;return i.vertices=new e,i}return zZ(i,t),i.toString=function(){return"[class dragonBones.MeshDisplayData]"},i.prototype._onClear=function(){t.prototype._onClear.call(this),this.type=2,this.vertices.clear(),this.texture=null},i}(i);t.MeshDisplayData=s;var a=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.boundingBox=null,e}return zZ(e,t),e.toString=function(){return"[class dragonBones.BoundingBoxDisplayData]"},e.prototype._onClear=function(){t.prototype._onClear.call(this),null!==this.boundingBox&&this.boundingBox.returnToPool(),this.type=3,this.boundingBox=null},e}(i);t.BoundingBoxDisplayData=a;var o=function(t){function i(){var i=null!==t&&t.apply(this,arguments)||this;return i.vertices=new e,i.curveLengths=[],i}return zZ(i,t),i.toString=function(){return"[class dragonBones.PathDisplayData]"},i.prototype._onClear=function(){t.prototype._onClear.call(this),this.type=4,this.closed=!1,this.constantSpeed=!1,this.vertices.clear(),this.curveLengths.length=0},i}(i);t.PathDisplayData=o;var h=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.bones=[],e}return zZ(e,t),e.toString=function(){return"[class dragonBones.WeightData]"},e.prototype._onClear=function(){this.count=0,this.offset=0,this.bones.length=0},e.prototype.addBone=function(t){this.bones.push(t)},e}(t.BaseObject);t.WeightData=h}(HZ||(HZ={})),function(t){var e=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return zZ(e,t),e.prototype._onClear=function(){this.color=0,this.width=0,this.height=0},e}(t.BaseObject);t.BoundingBoxData=e;var i=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return zZ(e,t),e.toString=function(){return"[class dragonBones.RectangleBoundingBoxData]"},e._computeOutCode=function(t,e,i,n,r,s){var a=0;return t<i?a|=1:t>r&&(a|=2),e<n?a|=4:e>s&&(a|=8),a},e.rectangleIntersectsSegment=function(t,i,n,r,s,a,o,h,u,l,c){void 0===u&&(u=null),void 0===l&&(l=null),void 0===c&&(c=null);var _=t>s&&t<o&&i>a&&i<h,f=n>s&&n<o&&r>a&&r<h;if(_&&f)return-1;for(var d=0,p=e._computeOutCode(t,i,s,a,o,h),m=e._computeOutCode(n,r,s,a,o,h);;){if(0==(p|m)){d=2;break}if(0!=(p&m))break;var g=0,y=0,v=0,S=0!==p?p:m;0!=(4&S)?(g=t+(n-t)*(a-i)/(r-i),y=a,null!==c&&(v=.5*-Math.PI)):0!=(8&S)?(g=t+(n-t)*(h-i)/(r-i),y=h,null!==c&&(v=.5*Math.PI)):0!=(2&S)?(y=i+(r-i)*(o-t)/(n-t),g=o,null!==c&&(v=0)):0!=(1&S)&&(y=i+(r-i)*(s-t)/(n-t),g=s,null!==c&&(v=Math.PI)),S===p?(t=g,i=y,p=e._computeOutCode(t,i,s,a,o,h),null!==c&&(c.x=v)):(n=g,r=y,m=e._computeOutCode(n,r,s,a,o,h),null!==c&&(c.y=v))}return d&&(_?(d=2,null!==u&&(u.x=n,u.y=r),null!==l&&(l.x=n,l.y=n),null!==c&&(c.x=c.y+Math.PI)):f?(d=1,null!==u&&(u.x=t,u.y=i),null!==l&&(l.x=t,l.y=i),null!==c&&(c.y=c.x+Math.PI)):(d=3,null!==u&&(u.x=t,u.y=i),null!==l&&(l.x=n,l.y=r))),d},e.prototype._onClear=function(){t.prototype._onClear.call(this),this.type=0},e.prototype.containsPoint=function(t,e){var i=.5*this.width;if(t>=-i&&t<=i){var n=.5*this.height;if(e>=-n&&e<=n)return!0}return!1},e.prototype.intersectsSegment=function(t,i,n,r,s,a,o){void 0===s&&(s=null),void 0===a&&(a=null),void 0===o&&(o=null);var h=.5*this.width,u=.5*this.height;return e.rectangleIntersectsSegment(t,i,n,r,-h,-u,h,u,s,a,o)},e}(e);t.RectangleBoundingBoxData=i;var n=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return zZ(e,t),e.toString=function(){return"[class dragonBones.EllipseData]"},e.ellipseIntersectsSegment=function(t,e,i,n,r,s,a,o,h,u,l){void 0===h&&(h=null),void 0===u&&(u=null),void 0===l&&(l=null);var c=a/o,_=c*c,f=i-t,d=(n*=c)-(e*=c),p=Math.sqrt(f*f+d*d),m=f/p,g=d/p,y=(r-t)*m+(s-e)*g,v=a*a,S=v-(t*t+e*e)+y*y,A=0;if(S>=0){var T=Math.sqrt(S),E=y-T,b=y+T,x=E<0?-1:E<=p?0:1,C=b<0?-1:b<=p?0:1,R=x*C;if(R<0)return-1;0===R&&(-1===x?(A=2,i=t+b*m,n=(e+b*g)/c,null!==h&&(h.x=i,h.y=n),null!==u&&(u.x=i,u.y=n),null!==l&&(l.x=Math.atan2(n/v*_,i/v),l.y=l.x+Math.PI)):1===C?(A=1,t+=E*m,e=(e+E*g)/c,null!==h&&(h.x=t,h.y=e),null!==u&&(u.x=t,u.y=e),null!==l&&(l.x=Math.atan2(e/v*_,t/v),l.y=l.x+Math.PI)):(A=3,null!==h&&(h.x=t+E*m,h.y=(e+E*g)/c,null!==l&&(l.x=Math.atan2(h.y/v*_,h.x/v))),null!==u&&(u.x=t+b*m,u.y=(e+b*g)/c,null!==l&&(l.y=Math.atan2(u.y/v*_,u.x/v)))))}return A},e.prototype._onClear=function(){t.prototype._onClear.call(this),this.type=1},e.prototype.containsPoint=function(t,e){var i=.5*this.width;if(t>=-i&&t<=i){var n=.5*this.height;if(e>=-n&&e<=n)return e*=i/n,Math.sqrt(t*t+e*e)<=i}return!1},e.prototype.intersectsSegment=function(t,i,n,r,s,a,o){return void 0===s&&(s=null),void 0===a&&(a=null),void 0===o&&(o=null),e.ellipseIntersectsSegment(t,i,n,r,0,0,.5*this.width,.5*this.height,s,a,o)},e}(e);t.EllipseBoundingBoxData=n;var r=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.vertices=[],e}return zZ(e,t),e.toString=function(){return"[class dragonBones.PolygonBoundingBoxData]"},e.polygonIntersectsSegment=function(t,e,i,n,r,s,a,o){void 0===s&&(s=null),void 0===a&&(a=null),void 0===o&&(o=null),t===i&&(t=i+1e-6),e===n&&(e=n+1e-6);for(var h=r.length,u=t-i,l=e-n,c=t*n-e*i,_=0,f=r[h-2],d=r[h-1],p=0,m=0,g=0,y=0,v=0,S=0,A=0;A<h;A+=2){var T=r[A],E=r[A+1];f===T&&(f=T+1e-4),d===E&&(d=E+1e-4);var b=f-T,x=d-E,C=f*E-d*T,R=u*x-l*b,w=(c*b-u*C)/R;if((w>=f&&w<=T||w>=T&&w<=f)&&(0===u||w>=t&&w<=i||w>=i&&w<=t)){var I=(c*x-l*C)/R;if((I>=d&&I<=E||I>=E&&I<=d)&&(0===l||I>=e&&I<=n||I>=n&&I<=e)){if(null===a){g=w,y=I,v=w,S=I,_++,null!==o&&(o.x=Math.atan2(E-d,T-f)-.5*Math.PI,o.y=o.x);break}var B=w-t;B<0&&(B=-B),0===_?(p=B,m=B,g=w,y=I,v=w,S=I,null!==o&&(o.x=Math.atan2(E-d,T-f)-.5*Math.PI,o.y=o.x)):(B<p&&(p=B,g=w,y=I,null!==o&&(o.x=Math.atan2(E-d,T-f)-.5*Math.PI)),B>m&&(m=B,v=w,S=I,null!==o&&(o.y=Math.atan2(E-d,T-f)-.5*Math.PI))),_++}}f=T,d=E}return 1===_?(null!==s&&(s.x=g,s.y=y),null!==a&&(a.x=g,a.y=y),null!==o&&(o.y=o.x+Math.PI)):_>1&&(_++,null!==s&&(s.x=g,s.y=y),null!==a&&(a.x=v,a.y=S)),_},e.prototype._onClear=function(){t.prototype._onClear.call(this),this.type=2,this.x=0,this.y=0,this.vertices.length=0},e.prototype.containsPoint=function(t,e){var i=!1;if(t>=this.x&&t<=this.width&&e>=this.y&&e<=this.height)for(var n=0,r=this.vertices.length,s=r-2;n<r;n+=2){var a=this.vertices[s+1],o=this.vertices[n+1];if(o<e&&a>=e||a<e&&o>=e){var h=this.vertices[s],u=this.vertices[n];(e-o)*(h-u)/(a-o)+u<t&&(i=!i)}s=n}return i},e.prototype.intersectsSegment=function(t,n,r,s,a,o,h){void 0===a&&(a=null),void 0===o&&(o=null),void 0===h&&(h=null);var u=0;return 0!==i.rectangleIntersectsSegment(t,n,r,s,this.x,this.y,this.x+this.width,this.y+this.height,null,null,null)&&(u=e.polygonIntersectsSegment(t,n,r,s,this.vertices,a,o,h)),u},e}(e);t.PolygonBoundingBoxData=r}(HZ||(HZ={})),function(t){var e=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.cachedFrames=[],e.boneTimelines={},e.surfaceTimelines={},e.slotTimelines={},e.constraintTimelines={},e.animationTimelines={},e.boneCachedFrameIndices={},e.slotCachedFrameIndices={},e.actionTimeline=null,e.zOrderTimeline=null,e}return zZ(e,t),e.toString=function(){return"[class dragonBones.AnimationData]"},e.prototype._onClear=function(){for(var t in this.boneTimelines){for(var e=0,i=this.boneTimelines[t];e<i.length;e++)i[e].returnToPool();delete this.boneTimelines[t]}for(var t in this.surfaceTimelines){for(var n=0,r=this.surfaceTimelines[t];n<r.length;n++)r[n].returnToPool();delete this.surfaceTimelines[t]}for(var t in this.slotTimelines){for(var s=0,a=this.slotTimelines[t];s<a.length;s++)a[s].returnToPool();delete this.slotTimelines[t]}for(var t in this.constraintTimelines){for(var o=0,h=this.constraintTimelines[t];o<h.length;o++)h[o].returnToPool();delete this.constraintTimelines[t]}for(var t in this.animationTimelines){for(var u=0,l=this.animationTimelines[t];u<l.length;u++)l[u].returnToPool();delete this.animationTimelines[t]}for(var t in this.boneCachedFrameIndices)delete this.boneCachedFrameIndices[t];for(var t in this.slotCachedFrameIndices)delete this.slotCachedFrameIndices[t];null!==this.actionTimeline&&this.actionTimeline.returnToPool(),null!==this.zOrderTimeline&&this.zOrderTimeline.returnToPool(),this.frameIntOffset=0,this.frameFloatOffset=0,this.frameOffset=0,this.frameCount=0,this.playTimes=0,this.duration=0,this.scale=1,this.fadeInTime=0,this.cacheFrameRate=0,this.name="",this.cachedFrames.length=0,this.actionTimeline=null,this.zOrderTimeline=null,this.parent=null},e.prototype.cacheFrames=function(t){if(!(this.cacheFrameRate>0)){this.cacheFrameRate=Math.max(Math.ceil(t*this.scale),1);var e=Math.ceil(this.cacheFrameRate*this.duration)+1;this.cachedFrames.length=e;for(var i=0,n=this.cacheFrames.length;i<n;++i)this.cachedFrames[i]=!1;for(var r=0,s=this.parent.sortedBones;r<s.length;r++){var a=s[r];for(i=0,n=(u=new Array(e)).length;i<n;++i)u[i]=-1;this.boneCachedFrameIndices[a.name]=u}for(var o=0,h=this.parent.sortedSlots;o<h.length;o++){var u,l=h[o];for(i=0,n=(u=new Array(e)).length;i<n;++i)u[i]=-1;this.slotCachedFrameIndices[l.name]=u}}},e.prototype.addBoneTimeline=function(t,e){var i=t.name in this.boneTimelines?this.boneTimelines[t.name]:this.boneTimelines[t.name]=[];i.indexOf(e)<0&&i.push(e)},e.prototype.addSurfaceTimeline=function(t,e){var i=t.name in this.surfaceTimelines?this.surfaceTimelines[t.name]:this.surfaceTimelines[t.name]=[];i.indexOf(e)<0&&i.push(e)},e.prototype.addSlotTimeline=function(t,e){var i=t.name in this.slotTimelines?this.slotTimelines[t.name]:this.slotTimelines[t.name]=[];i.indexOf(e)<0&&i.push(e)},e.prototype.addConstraintTimeline=function(t,e){var i=t.name in this.constraintTimelines?this.constraintTimelines[t.name]:this.constraintTimelines[t.name]=[];i.indexOf(e)<0&&i.push(e)},e.prototype.addAnimationTimeline=function(t,e){var i=t in this.animationTimelines?this.animationTimelines[t]:this.animationTimelines[t]=[];i.indexOf(e)<0&&i.push(e)},e.prototype.getBoneTimelines=function(t){return t in this.boneTimelines?this.boneTimelines[t]:null},e.prototype.getSurfaceTimelines=function(t){return t in this.surfaceTimelines?this.surfaceTimelines[t]:null},e.prototype.getSlotTimelines=function(t){return t in this.slotTimelines?this.slotTimelines[t]:null},e.prototype.getConstraintTimelines=function(t){return t in this.constraintTimelines?this.constraintTimelines[t]:null},e.prototype.getAnimationTimelines=function(t){return t in this.animationTimelines?this.animationTimelines[t]:null},e.prototype.getBoneCachedFrameIndices=function(t){return t in this.boneCachedFrameIndices?this.boneCachedFrameIndices[t]:null},e.prototype.getSlotCachedFrameIndices=function(t){return t in this.slotCachedFrameIndices?this.slotCachedFrameIndices[t]:null},e}(t.BaseObject);t.AnimationData=e;var i=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return zZ(e,t),e.toString=function(){return"[class dragonBones.TimelineData]"},e.prototype._onClear=function(){this.type=10,this.offset=0,this.frameIndicesOffset=-1},e}(t.BaseObject);t.TimelineData=i}(HZ||(HZ={})),function(t){var e=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.boneMask=[],e}return zZ(e,t),e.toString=function(){return"[class dragonBones.AnimationConfig]"},e.prototype._onClear=function(){this.pauseFadeOut=!0,this.fadeOutMode=4,this.fadeOutTweenType=1,this.fadeOutTime=-1,this.actionEnabled=!0,this.additiveBlending=!1,this.displayControl=!0,this.pauseFadeIn=!0,this.resetToPose=!0,this.fadeInTweenType=1,this.playTimes=-1,this.layer=0,this.position=0,this.duration=-1,this.timeScale=-100,this.weight=1,this.fadeInTime=-1,this.autoFadeOutTime=-1,this.name="",this.animation="",this.group="",this.boneMask.length=0},e.prototype.clear=function(){this._onClear()},e.prototype.copyFrom=function(t){this.pauseFadeOut=t.pauseFadeOut,this.fadeOutMode=t.fadeOutMode,this.autoFadeOutTime=t.autoFadeOutTime,this.fadeOutTweenType=t.fadeOutTweenType,this.actionEnabled=t.actionEnabled,this.additiveBlending=t.additiveBlending,this.displayControl=t.displayControl,this.pauseFadeIn=t.pauseFadeIn,this.resetToPose=t.resetToPose,this.playTimes=t.playTimes,this.layer=t.layer,this.position=t.position,this.duration=t.duration,this.timeScale=t.timeScale,this.fadeInTime=t.fadeInTime,this.fadeOutTime=t.fadeOutTime,this.fadeInTweenType=t.fadeInTweenType,this.weight=t.weight,this.name=t.name,this.animation=t.animation,this.group=t.group,this.boneMask.length=t.boneMask.length;for(var e=0,i=this.boneMask.length;e<i;++e)this.boneMask[e]=t.boneMask[e]},e.prototype.containsBoneMask=function(t){return 0===this.boneMask.length||this.boneMask.indexOf(t)>=0},e.prototype.addBoneMask=function(t,e,i){void 0===i&&(i=!0);var n=t.getBone(e);if(null!==n&&(this.boneMask.indexOf(e)<0&&this.boneMask.push(e),i))for(var r=0,s=t.getBones();r<s.length;r++){var a=s[r];this.boneMask.indexOf(a.name)<0&&n.contains(a)&&this.boneMask.push(a.name)}},e.prototype.removeBoneMask=function(t,e,i){void 0===i&&(i=!0);var n=this.boneMask.indexOf(e);if(n>=0&&this.boneMask.splice(n,1),i){var r=t.getBone(e);if(null!==r)if(this.boneMask.length>0)for(var s=0,a=t.getBones();s<a.length;s++){var o=a[s],h=this.boneMask.indexOf(o.name);h>=0&&r.contains(o)&&this.boneMask.splice(h,1)}else for(var u=0,l=t.getBones();u<l.length;u++)(o=l[u])!==r&&(r.contains(o)||this.boneMask.push(o.name))}},e}(t.BaseObject);t.AnimationConfig=e}(HZ||(HZ={})),function(t){var e=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.textures={},e}return zZ(e,t),e.prototype._onClear=function(){for(var t in this.textures)this.textures[t].returnToPool(),delete this.textures[t];this.autoSearch=!1,this.width=0,this.height=0,this.scale=1,this.name="",this.imagePath=""},e.prototype.copyFrom=function(t){for(var e in this.autoSearch=t.autoSearch,this.scale=t.scale,this.width=t.width,this.height=t.height,this.name=t.name,this.imagePath=t.imagePath,this.textures)this.textures[e].returnToPool(),delete this.textures[e];for(var e in t.textures){var i=this.createTexture();i.copyFrom(t.textures[e]),this.textures[e]=i}},e.prototype.addTexture=function(t){t.name in this.textures?console.warn("Same texture: "+t.name):(t.parent=this,this.textures[t.name]=t)},e.prototype.getTexture=function(t){return t in this.textures?this.textures[t]:null},e}(t.BaseObject);t.TextureAtlasData=e;var i=function(e){function i(){var i=null!==e&&e.apply(this,arguments)||this;return i.region=new t.Rectangle,i.frame=null,i}return zZ(i,e),i.createRectangle=function(){return new t.Rectangle},i.prototype._onClear=function(){this.rotated=!1,this.name="",this.region.clear(),this.parent=null,this.frame=null},i.prototype.copyFrom=function(t){this.rotated=t.rotated,this.name=t.name,this.region.copyFrom(t.region),this.parent=t.parent,null===this.frame&&null!==t.frame?this.frame=i.createRectangle():null!==this.frame&&null===t.frame&&(this.frame=null),null!==this.frame&&null!==t.frame&&this.frame.copyFrom(t.frame)},i}(t.BaseObject);t.TextureData=i}(HZ||(HZ={})),function(t){var e=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.vertices=[],e.bones=[],e}return zZ(e,t),e.toString=function(){return"[class dragonBones.DeformVertices]"},e.prototype._onClear=function(){this.verticesDirty=!1,this.vertices.length=0,this.bones.length=0,this.verticesData=null},e.prototype.init=function(t,e){if(this.verticesData=t,null!==this.verticesData){var i;i=null!==this.verticesData.weight?2*this.verticesData.weight.count:2*this.verticesData.data.intArray[this.verticesData.offset+0],this.verticesDirty=!0,this.vertices.length=i,this.bones.length=0;for(var n=0,r=this.vertices.length;n<r;++n)this.vertices[n]=0;if(null!==this.verticesData.weight)for(n=0,r=this.verticesData.weight.bones.length;n<r;++n){var s=e.getBone(this.verticesData.weight.bones[n].name);this.bones.push(s)}}else this.verticesDirty=!1,this.vertices.length=0,this.bones.length=0,this.verticesData=null},e.prototype.isBonesUpdate=function(){for(var t=0,e=this.bones;t<e.length;t++){var i=e[t];if(null!==i&&i._childrenTransformDirty)return!0}return!1},e}(t.BaseObject);t.DeformVertices=e}(HZ||(HZ={})),function(t){var e=function(e){function i(){var t=null!==e&&e.apply(this,arguments)||this;return t._bones=[],t._slots=[],t._constraints=[],t._actions=[],t._animation=null,t._proxy=null,t._replaceTextureAtlasData=null,t._clock=null,t}return zZ(i,e),i.toString=function(){return"[class dragonBones.Armature]"},i._onSortSlots=function(t,e){return t._zOrder>e._zOrder?1:-1},i.prototype._onClear=function(){null!==this._clock&&this._clock.remove(this);for(var t=0,e=this._bones;t<e.length;t++)e[t].returnToPool();for(var i=0,n=this._slots;i<n.length;i++)n[i].returnToPool();for(var r=0,s=this._constraints;r<s.length;r++)s[r].returnToPool();for(var a=0,o=this._actions;a<o.length;a++)o[a].returnToPool();null!==this._animation&&this._animation.returnToPool(),null!==this._proxy&&this._proxy.dbClear(),null!==this._replaceTextureAtlasData&&this._replaceTextureAtlasData.returnToPool(),this.inheritAnimation=!0,this.userData=null,this._lockUpdate=!1,this._slotsDirty=!0,this._zOrderDirty=!1,this._flipX=!1,this._flipY=!1,this._cacheFrameIndex=-1,this._bones.length=0,this._slots.length=0,this._constraints.length=0,this._actions.length=0,this._armatureData=null,this._animation=null,this._proxy=null,this._display=null,this._replaceTextureAtlasData=null,this._replacedTexture=null,this._dragonBones=null,this._clock=null,this._parent=null},i.prototype._sortZOrder=function(t,e){var i=this._armatureData.sortedSlots,n=null===t;if(this._zOrderDirty||!n){for(var r=0,s=i.length;r<s;++r){var a=n?r:t[e+r];if(!(a<0||a>=s)){var o=i[a],h=this.getSlot(o.name);null!==h&&h._setZorder(r)}}this._slotsDirty=!0,this._zOrderDirty=!n}},i.prototype._addBone=function(t){this._bones.indexOf(t)<0&&this._bones.push(t)},i.prototype._addSlot=function(t){this._slots.indexOf(t)<0&&this._slots.push(t)},i.prototype._addConstraint=function(t){this._constraints.indexOf(t)<0&&this._constraints.push(t)},i.prototype._bufferAction=function(t,e){this._actions.indexOf(t)<0&&(e?this._actions.push(t):this._actions.unshift(t))},i.prototype.dispose=function(){null!==this._armatureData&&(this._lockUpdate=!0,this._dragonBones.bufferObject(this))},i.prototype.init=function(e,i,n,r){null===this._armatureData&&(this._armatureData=e,this._animation=t.BaseObject.borrowObject(t.Animation),this._proxy=i,this._display=n,this._dragonBones=r,this._proxy.dbInit(this),this._animation.init(this),this._animation.animations=this._armatureData.animations)},i.prototype.advanceTime=function(t){if(!this._lockUpdate)if(null!==this._armatureData)if(null!==this._armatureData.parent){var e=this._cacheFrameIndex;if(this._animation.advanceTime(t),this._slotsDirty&&(this._slotsDirty=!1,this._slots.sort(i._onSortSlots)),this._cacheFrameIndex<0||this._cacheFrameIndex!==e){var n=0,r=0;for(n=0,r=this._bones.length;n<r;++n)this._bones[n].update(this._cacheFrameIndex);for(n=0,r=this._slots.length;n<r;++n)this._slots[n].update(this._cacheFrameIndex)}if(this._actions.length>0){this._lockUpdate=!0;for(var s=0,a=this._actions;s<a.length;s++){var o=a[s],h=o.actionData;if(null!==h&&0===h.type)if(null!==o.slot)null!==(c=o.slot.childArmature)&&c.animation.fadeIn(h.name);else if(null!==o.bone)for(var u=0,l=this.getSlots();u<l.length;u++){var c,_=l[u];_.parent===o.bone&&null!==(c=_.childArmature)&&c.animation.fadeIn(h.name)}else this._animation.fadeIn(h.name);o.returnToPool()}this._actions.length=0,this._lockUpdate=!1}this._proxy.dbUpdate()}else console.warn("The armature data has been disposed.\nPlease make sure dispose armature before call factory.clear().");else console.warn("The armature has been disposed.")},i.prototype.invalidUpdate=function(t,e){if(void 0===t&&(t=null),void 0===e&&(e=!1),null!==t&&t.length>0){if(null!==(a=this.getBone(t))&&(a.invalidUpdate(),e))for(var i=0,n=this._slots;i<n.length;i++)(u=n[i]).parent===a&&u.invalidUpdate()}else{for(var r=0,s=this._bones;r<s.length;r++){var a;(a=s[r]).invalidUpdate()}if(e)for(var o=0,h=this._slots;o<h.length;o++){var u;(u=h[o]).invalidUpdate()}}},i.prototype.containsPoint=function(t,e){for(var i=0,n=this._slots;i<n.length;i++){var r=n[i];if(r.containsPoint(t,e))return r}return null},i.prototype.intersectsSegment=function(t,e,i,n,r,s,a){void 0===r&&(r=null),void 0===s&&(s=null),void 0===a&&(a=null);for(var o=t===i,h=0,u=0,l=0,c=0,_=0,f=0,d=0,p=0,m=null,g=null,y=0,v=this._slots;y<v.length;y++){var S=v[y];if(S.intersectsSegment(t,e,i,n,r,s,a)>0){if(null===r&&null===s){m=S;break}var A;null!==r&&((A=o?r.y-e:r.x-t)<0&&(A=-A),(null===m||A<h)&&(h=A,l=r.x,c=r.y,m=S,a&&(d=a.x))),null!==s&&((A=s.x-t)<0&&(A=-A),(null===g||A>u)&&(u=A,_=s.x,f=s.y,g=S,null!==a&&(p=a.y)))}}return null!==m&&null!==r&&(r.x=l,r.y=c,null!==a&&(a.x=d)),null!==g&&null!==s&&(s.x=_,s.y=f,null!==a&&(a.y=p)),m},i.prototype.getBone=function(t){for(var e=0,i=this._bones;e<i.length;e++){var n=i[e];if(n.name===t)return n}return null},i.prototype.getBoneByDisplay=function(t){var e=this.getSlotByDisplay(t);return null!==e?e.parent:null},i.prototype.getSlot=function(t){for(var e=0,i=this._slots;e<i.length;e++){var n=i[e];if(n.name===t)return n}return null},i.prototype.getSlotByDisplay=function(t){if(null!==t)for(var e=0,i=this._slots;e<i.length;e++){var n=i[e];if(n.display===t)return n}return null},i.prototype.getBones=function(){return this._bones},i.prototype.getSlots=function(){return this._slots},Object.defineProperty(i.prototype,"flipX",{get:function(){return this._flipX},set:function(t){this._flipX!==t&&(this._flipX=t,this.invalidUpdate())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"flipY",{get:function(){return this._flipY},set:function(t){this._flipY!==t&&(this._flipY=t,this.invalidUpdate())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"cacheFrameRate",{get:function(){return this._armatureData.cacheFrameRate},set:function(t){if(this._armatureData.cacheFrameRate!==t){this._armatureData.cacheFrames(t);for(var e=0,i=this._slots;e<i.length;e++){var n=i[e].childArmature;null!==n&&(n.cacheFrameRate=t)}}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"name",{get:function(){return this._armatureData.name},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"armatureData",{get:function(){return this._armatureData},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"animation",{get:function(){return this._animation},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"proxy",{get:function(){return this._proxy},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"eventDispatcher",{get:function(){return this._proxy},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"display",{get:function(){return this._display},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"replacedTexture",{get:function(){return this._replacedTexture},set:function(t){if(this._replacedTexture!==t){null!==this._replaceTextureAtlasData&&(this._replaceTextureAtlasData.returnToPool(),this._replaceTextureAtlasData=null),this._replacedTexture=t;for(var e=0,i=this._slots;e<i.length;e++){var n=i[e];n.invalidUpdate(),n.update(-1)}}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"clock",{get:function(){return this._clock},set:function(t){if(this._clock!==t){null!==this._clock&&this._clock.remove(this),this._clock=t,this._clock&&this._clock.add(this);for(var e=0,i=this._slots;e<i.length;e++){var n=i[e].childArmature;null!==n&&(n.clock=this._clock)}}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"parent",{get:function(){return this._parent},enumerable:!0,configurable:!0}),i.prototype.replaceTexture=function(t){this.replacedTexture=t},i.prototype.hasEventListener=function(t){return this._proxy.hasDBEventListener(t)},i.prototype.addEventListener=function(t,e,i){this._proxy.addDBEventListener(t,e,i)},i.prototype.removeEventListener=function(t,e,i){this._proxy.removeDBEventListener(t,e,i)},i.prototype.enableAnimationCache=function(t){console.warn("Deprecated."),this.cacheFrameRate=t},i.prototype.getDisplay=function(){return this._display},i}(t.BaseObject);t.Armature=e}(HZ||(HZ={})),function(t){var e=function(e){function i(){var i=null!==e&&e.apply(this,arguments)||this;return i.globalTransformMatrix=new t.Matrix,i.global=new t.Transform,i.offset=new t.Transform,i}return zZ(i,e),i.prototype._onClear=function(){this.globalTransformMatrix.identity(),this.global.identity(),this.offset.identity(),this.origin=null,this.userData=null,this._globalDirty=!1,this._armature=null},i.prototype.updateGlobalTransform=function(){this._globalDirty&&(this._globalDirty=!1,this.global.fromMatrix(this.globalTransformMatrix))},Object.defineProperty(i.prototype,"armature",{get:function(){return this._armature},enumerable:!0,configurable:!0}),i._helpMatrix=new t.Matrix,i._helpTransform=new t.Transform,i._helpPoint=new t.Point,i}(t.BaseObject);t.TransformObject=e}(HZ||(HZ={})),function(t){var e=function(e){function i(){var i=null!==e&&e.apply(this,arguments)||this;return i.animationPose=new t.Transform,i._blendState=new t.BlendState,i}return zZ(i,e),i.toString=function(){return"[class dragonBones.Bone]"},i.prototype._onClear=function(){e.prototype._onClear.call(this),this.offsetMode=1,this.animationPose.identity(),this._transformDirty=!1,this._childrenTransformDirty=!1,this._localDirty=!0,this._hasConstraint=!1,this._visible=!0,this._cachedFrameIndex=-1,this._blendState.clear(),this._boneData=null,this._parent=null,this._cachedFrameIndices=null},i.prototype._updateGlobalTransformMatrix=function(e){var i=this._boneData,n=this.global,r=this.globalTransformMatrix,s=this.origin,a=this.offset,o=this.animationPose,h=this._parent,u=this._armature.flipX,l=this._armature.flipY===t.DragonBones.yDown,c=null!==h,_=0;if(1===this.offsetMode?null!==s?(n.x=s.x+a.x+o.x,n.scaleX=s.scaleX*a.scaleX*o.scaleX,n.scaleY=s.scaleY*a.scaleY*o.scaleY,t.DragonBones.yDown?(n.y=s.y+a.y+o.y,n.skew=s.skew+a.skew+o.skew,n.rotation=s.rotation+a.rotation+o.rotation):(n.y=s.y-a.y+o.y,n.skew=s.skew-a.skew+o.skew,n.rotation=s.rotation-a.rotation+o.rotation)):(n.copyFrom(a),t.DragonBones.yDown||(n.y=-n.y,n.skew=-n.skew,n.rotation=-n.rotation),n.add(o)):0===this.offsetMode?null!==s?n.copyFrom(s).add(o):n.copyFrom(o):(c=!1,n.copyFrom(a),t.DragonBones.yDown||(n.y=-n.y,n.skew=-n.skew,n.rotation=-n.rotation)),c){var f=0===h._boneData.type?h.globalTransformMatrix:h._getGlobalTransformMatrix(n.x,n.y);if(i.inheritScale)i.inheritRotation||(h.updateGlobalTransform(),_=u&&l?n.rotation-(h.global.rotation+Math.PI):u?n.rotation+h.global.rotation+Math.PI:l?n.rotation+h.global.rotation:n.rotation-h.global.rotation,n.rotation=_),n.toMatrix(r),r.concat(f),i.inheritTranslation?(n.x=r.tx,n.y=r.ty):(r.tx=n.x,r.ty=n.y),e?n.fromMatrix(r):this._globalDirty=!0;else{if(i.inheritTranslation){var d=n.x,p=n.y;n.x=f.a*d+f.c*p+f.tx,n.y=f.b*d+f.d*p+f.ty}else u&&(n.x=-n.x),l&&(n.y=-n.y);i.inheritRotation?(h.updateGlobalTransform(),_=h.global.scaleX<0?n.rotation+h.global.rotation+Math.PI:n.rotation+h.global.rotation,f.a*f.d-f.b*f.c<0&&(_-=2*n.rotation,(u!==l||i.inheritReflection)&&(n.skew+=Math.PI),t.DragonBones.yDown||(n.skew=-n.skew)),n.rotation=_):(u||l)&&(u&&l?_=n.rotation+Math.PI:(_=u?Math.PI-n.rotation:-n.rotation,n.skew+=Math.PI),n.rotation=_),n.toMatrix(r)}}else(u||l)&&(u&&(n.x=-n.x),l&&(n.y=-n.y),u&&l?_=n.rotation+Math.PI:(_=u?Math.PI-n.rotation:-n.rotation,n.skew+=Math.PI),n.rotation=_),n.toMatrix(r)},i.prototype.init=function(t,e){null===this._boneData&&(this._boneData=t,this._armature=e,null!==this._boneData.parent&&(this._parent=this._armature.getBone(this._boneData.parent.name)),this._armature._addBone(this),this.origin=this._boneData.transform)},i.prototype.update=function(t){if(this._blendState.dirty=!1,t>=0&&null!==this._cachedFrameIndices){var e=this._cachedFrameIndices[t];if(e>=0&&this._cachedFrameIndex===e)this._transformDirty=!1;else if(e>=0)this._transformDirty=!0,this._cachedFrameIndex=e;else{if(this._hasConstraint)for(var i=0,n=this._armature._constraints;i<n.length;i++)(a=n[i])._root===this&&a.update();this._transformDirty||null!==this._parent&&this._parent._childrenTransformDirty?(this._transformDirty=!0,this._cachedFrameIndex=-1):this._cachedFrameIndex>=0?(this._transformDirty=!1,this._cachedFrameIndices[t]=this._cachedFrameIndex):(this._transformDirty=!0,this._cachedFrameIndex=-1)}}else{if(this._hasConstraint)for(var r=0,s=this._armature._constraints;r<s.length;r++){var a;(a=s[r])._root===this&&a.update()}(this._transformDirty||null!==this._parent&&this._parent._childrenTransformDirty)&&(t=-1,this._transformDirty=!0,this._cachedFrameIndex=-1)}if(this._transformDirty)if(this._transformDirty=!1,this._childrenTransformDirty=!0,this._cachedFrameIndex<0){var o=t>=0;this._localDirty&&this._updateGlobalTransformMatrix(o),o&&null!==this._cachedFrameIndices&&(this._cachedFrameIndex=this._cachedFrameIndices[t]=this._armature._armatureData.setCacheFrame(this.globalTransformMatrix,this.global))}else this._armature._armatureData.getCacheFrame(this.globalTransformMatrix,this.global,this._cachedFrameIndex);else this._childrenTransformDirty&&(this._childrenTransformDirty=!1);this._localDirty=!0},i.prototype.updateByConstraint=function(){this._localDirty&&(this._localDirty=!1,(this._transformDirty||null!==this._parent&&this._parent._childrenTransformDirty)&&this._updateGlobalTransformMatrix(!0),this._transformDirty=!0)},i.prototype.invalidUpdate=function(){this._transformDirty=!0},i.prototype.contains=function(t){if(t===this)return!1;for(var e=t;e!==this&&null!==e;)e=e.parent;return e===this},Object.defineProperty(i.prototype,"boneData",{get:function(){return this._boneData},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"visible",{get:function(){return this._visible},set:function(t){if(this._visible!==t){this._visible=t;for(var e=0,i=this._armature.getSlots();e<i.length;e++){var n=i[e];n.parent===this&&n._updateVisible()}}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"name",{get:function(){return this._boneData.name},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"parent",{get:function(){return this._parent},enumerable:!0,configurable:!0}),i.prototype.getBones=function(){console.warn("Deprecated.");for(var t=new Array,e=0,i=this._armature.getBones();e<i.length;e++){var n=i[e];n.parent===this&&t.push(n)}return t},i.prototype.getSlots=function(){console.warn("Deprecated.");for(var t=new Array,e=0,i=this._armature.getSlots();e<i.length;e++){var n=i[e];n.parent===this&&t.push(n)}return t},Object.defineProperty(i.prototype,"slot",{get:function(){console.warn("Deprecated.");for(var t=0,e=this._armature.getSlots();t<e.length;t++){var i=e[t];if(i.parent===this)return i}return null},enumerable:!0,configurable:!0}),i}(t.TransformObject);t.Bone=e}(HZ||(HZ={})),function(t){var e=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._vertices=[],e._deformVertices=[],e._hullCache=[],e._matrixCahce=[],e}return zZ(e,t),e.toString=function(){return"[class dragonBones.Surface]"},e.prototype._onClear=function(){t.prototype._onClear.call(this),this._dX=0,this._dY=0,this._k=0,this._kX=0,this._kY=0,this._vertices.length=0,this._deformVertices.length=0,this._matrixCahce.length=0,this._hullCache.length=0},e.prototype._getAffineTransform=function(t,e,i,n,r,s,a,o,h,u,l,c,_){var f=a-r,d=o-s,p=h-r,m=u-s;l.rotation=Math.atan2(d,f),l.skew=Math.atan2(m,p)-.5*Math.PI-l.rotation,_&&(l.rotation+=Math.PI),l.scaleX=Math.sqrt(f*f+d*d)/i,l.scaleY=Math.sqrt(p*p+m*m)/n,l.toMatrix(c),l.x=c.tx=r-(c.a*t+c.c*e),l.y=c.ty=s-(c.b*t+c.d*e)},e.prototype._updateVertices=function(){var t=this._boneData.vertices,e=this._vertices,i=this._deformVertices;if(null!==this._parent)if(1===this._parent._boneData.type)for(var n=0,r=t.length;n<r;n+=2){var s=t[n]+i[n],a=t[n+1]+i[n],o=this._parent._getGlobalTransformMatrix(s,a);e[n]=o.a*s+o.c*a+o.tx,e[n+1]=o.b*s+o.d*a+o.ty}else{var h=this._parent.globalTransformMatrix;for(n=0,r=t.length;n<r;n+=2)s=t[n]+i[n],a=t[n+1]+i[n+1],e[n]=h.a*s+h.c*a+h.tx,e[n+1]=h.b*s+h.d*a+h.ty}else for(n=0,r=t.length;n<r;n+=2)e[n]=t[n]+i[n],e[n+1]=t[n+1]+i[n+1]},e.prototype._updateGlobalTransformMatrix=function(){var t=2*this._boneData.segmentX,e=this._vertices.length-2,i=this._vertices[0],n=this._vertices[1],r=this._vertices[t],s=this._vertices[t+1],a=this._vertices[e],o=this._vertices[e+1],h=this._vertices[e-t],u=this._vertices[e-t+1],l=i+.5*(a-i),c=n+.5*(o-n),_=l+.5*(r+.5*(h-r)-l),f=c+.5*(s+.5*(u-s)-c),d=r+.5*(a-r),p=s+.5*(o-s),m=h+.5*(a-h),g=u+.5*(o-u);this._globalDirty=!1,this._getAffineTransform(0,0,200,200,_,f,d,p,m,g,this.global,this.globalTransformMatrix,!1)},e.prototype._getGlobalTransformMatrix=function(t,i){var n=1e3;if(t<-n||n<t||i<-n||n<i)return this.globalTransformMatrix;var r=!1,s=200,a=this._boneData,o=a.segmentX,h=a.segmentY,u=2*a.segmentX,l=this._dX,c=this._dY,_=Math.floor((t+s)/l),f=Math.floor((i+s)/c),d=0,p=_*l-s,m=f*c-s,g=this._matrixCahce,y=e._helpMatrix;if(t<-s){if(i<-s||i>=s)return this.globalTransformMatrix;if(d=7*(2*(o*(h+1)+2*o+h+f)+((r=i>this._kX*(t+s)+m)?1:0)),this._matrixCahce[d]>0)y.copyFromArray(g,d+1);else{var v=f*(u+2),S=this._hullCache[4],A=this._hullCache[5],T=this._hullCache[2]-(h-f)*S,E=this._hullCache[3]-(h-f)*A,b=this._vertices;r?this._getAffineTransform(-s,m+c,800,c,b[v+u+2],b[v+u+3],T+S,E+A,b[v],b[v+1],e._helpTransform,y,!0):this._getAffineTransform(-n,m,800,c,T,E,b[v],b[v+1],T+S,E+A,e._helpTransform,y,!1),g[d]=1,g[d+1]=y.a,g[d+2]=y.b,g[d+3]=y.c,g[d+4]=y.d,g[d+5]=y.tx,g[d+6]=y.ty}}else if(t>=s){if(i<-s||i>=s)return this.globalTransformMatrix;d=7*(2*(o*(h+1)+o+f)+((r=i>this._kX*(t-n)+m)?1:0)),this._matrixCahce[d]>0?y.copyFromArray(g,d+1):(v=(f+1)*(u+2)-2,S=this._hullCache[4],A=this._hullCache[5],T=this._hullCache[0]+f*S,E=this._hullCache[1]+f*A,b=this._vertices,r?this._getAffineTransform(n,m+c,800,c,T+S,E+A,b[v+u+2],b[v+u+3],T,E,e._helpTransform,y,!0):this._getAffineTransform(s,m,800,c,b[v],b[v+1],T,E,b[v+u+2],b[v+u+3],e._helpTransform,y,!1),g[d]=1,g[d+1]=y.a,g[d+2]=y.b,g[d+3]=y.c,g[d+4]=y.d,g[d+5]=y.tx,g[d+6]=y.ty)}else if(i<-s){if(t<-s||t>=s)return this.globalTransformMatrix;d=7*(o*(h+1)+2*_+((r=i>this._kY*(t-p-l)-n)?1:0)),this._matrixCahce[d]>0?y.copyFromArray(g,d+1):(v=2*_,S=this._hullCache[10],A=this._hullCache[11],T=this._hullCache[8]+_*S,E=this._hullCache[9]+_*A,b=this._vertices,r?this._getAffineTransform(p+l,-s,l,800,b[v+2],b[v+3],b[v],b[v+1],T+S,E+A,e._helpTransform,y,!0):this._getAffineTransform(p,-n,l,800,T,E,T+S,E+A,b[v],b[v+1],e._helpTransform,y,!1),g[d]=1,g[d+1]=y.a,g[d+2]=y.b,g[d+3]=y.c,g[d+4]=y.d,g[d+5]=y.tx,g[d+6]=y.ty)}else if(i>=s){if(t<-s||t>=s)return this.globalTransformMatrix;d=7*(2*(o*(h+1)+o+h+f)+((r=i>this._kY*(t-p-l)+s)?1:0)),this._matrixCahce[d]>0?y.copyFromArray(g,d+1):(v=h*(u+2)+2*_,S=this._hullCache[10],A=this._hullCache[11],T=this._hullCache[6]-(o-_)*S,E=this._hullCache[7]-(o-_)*A,b=this._vertices,r?this._getAffineTransform(p+l,n,l,800,T+S,E+A,T,E,b[v+2],b[v+3],e._helpTransform,y,!0):this._getAffineTransform(p,s,l,800,b[v],b[v+1],b[v+2],b[v+3],T,E,e._helpTransform,y,!1),g[d]=1,g[d+1]=y.a,g[d+2]=y.b,g[d+3]=y.c,g[d+4]=y.d,g[d+5]=y.tx,g[d+6]=y.ty)}else d=7*(2*(o*f+_)+((r=i>this._k*(t-p-l)+m)?1:0)),this._matrixCahce[d]>0?y.copyFromArray(g,d+1):(v=2*_+f*(u+2),b=this._vertices,r?this._getAffineTransform(p+l,m+c,l,c,b[v+u+4],b[v+u+5],b[v+u+2],b[v+u+3],b[v+2],b[v+3],e._helpTransform,y,!0):this._getAffineTransform(p,m,l,c,b[v],b[v+1],b[v+2],b[v+3],b[v+u+2],b[v+u+3],e._helpTransform,y,!1),g[d]=1,g[d+1]=y.a,g[d+2]=y.b,g[d+3]=y.c,g[d+4]=y.d,g[d+5]=y.tx,g[d+6]=y.ty);return y},e.prototype.init=function(e,i){if(null===this._boneData){t.prototype.init.call(this,e,i);var n=e.segmentX,r=e.segmentY,s=e.vertices.length;this._dX=400/n,this._dY=400/r,this._k=-this._dY/this._dX,this._kX=-this._dY/800,this._kY=-800/this._dX,this._vertices.length=s,this._deformVertices.length=s,this._matrixCahce.length=14*(n*r+2*n+2*r),this._hullCache.length=10;for(var a=0;a<s;++a)this._deformVertices[a]=0}},e.prototype.update=function(t){if(this._blendState.dirty=!1,t>=0&&null!==this._cachedFrameIndices){var i=this._cachedFrameIndices[t];if(i>=0&&this._cachedFrameIndex===i)this._transformDirty=!1;else if(i>=0)this._transformDirty=!0,this._cachedFrameIndex=i;else{if(this._hasConstraint)for(var n=0,r=this._armature._constraints;n<r.length;n++)(o=r[n])._root===this&&o.update();this._transformDirty||null!==this._parent&&this._parent._childrenTransformDirty?(this._transformDirty=!0,this._cachedFrameIndex=-1):this._cachedFrameIndex>=0?(this._transformDirty=!1,this._cachedFrameIndices[t]=this._cachedFrameIndex):(this._transformDirty=!0,this._cachedFrameIndex=-1)}}else{if(this._hasConstraint)for(var s=0,a=this._armature._constraints;s<a.length;s++){var o;(o=a[s])._root===this&&o.update()}(this._transformDirty||null!==this._parent&&this._parent._childrenTransformDirty)&&(t=-1,this._transformDirty=!0,this._cachedFrameIndex=-1)}if(this._transformDirty){this._transformDirty=!1,this._childrenTransformDirty=!0;for(var h=0,u=this._matrixCahce.length;h<u;h+=7)this._matrixCahce[h]=-1;if(this._updateVertices(),this._cachedFrameIndex<0){var l=t>=0;this._localDirty&&this._updateGlobalTransformMatrix(l),l&&null!==this._cachedFrameIndices&&(this._cachedFrameIndex=this._cachedFrameIndices[t]=this._armature._armatureData.setCacheFrame(this.globalTransformMatrix,this.global))}else this._armature._armatureData.getCacheFrame(this.globalTransformMatrix,this.global,this._cachedFrameIndex);var c=2*this.global.x,_=2*this.global.y,f=e._helpPoint;this.globalTransformMatrix.transformPoint(1e3,-200,f),this._hullCache[0]=f.x,this._hullCache[1]=f.y,this._hullCache[2]=c-f.x,this._hullCache[3]=_-f.y,this.globalTransformMatrix.transformPoint(0,this._dY,f,!0),this._hullCache[4]=f.x,this._hullCache[5]=f.y,this.globalTransformMatrix.transformPoint(200,1e3,f),this._hullCache[6]=f.x,this._hullCache[7]=f.y,this._hullCache[8]=c-f.x,this._hullCache[9]=_-f.y,this.globalTransformMatrix.transformPoint(this._dX,0,f,!0),this._hullCache[10]=f.x,this._hullCache[11]=f.y}else this._childrenTransformDirty&&(this._childrenTransformDirty=!1);this._localDirty=!0},e}(t.Bone);t.Surface=e}(HZ||(HZ={})),function(t){var e=function(e){function i(){var i=null!==e&&e.apply(this,arguments)||this;return i._localMatrix=new t.Matrix,i._colorTransform=new t.ColorTransform,i._displayDatas=[],i._displayList=[],i._deformVertices=null,i._rawDisplay=null,i._meshDisplay=null,i}return zZ(i,e),i.prototype._onClear=function(){e.prototype._onClear.call(this);for(var i=[],n=0,r=this._displayList;n<r.length;n++)null!==(o=r[n])&&o!==this._rawDisplay&&o!==this._meshDisplay&&i.indexOf(o)<0&&i.push(o);for(var s=0,a=i;s<a.length;s++){var o;(o=a[s])instanceof t.Armature?o.dispose():this._disposeDisplay(o,!0)}null!==this._deformVertices&&this._deformVertices.returnToPool(),null!==this._meshDisplay&&this._meshDisplay!==this._rawDisplay&&this._disposeDisplay(this._meshDisplay,!1),null!==this._rawDisplay&&this._disposeDisplay(this._rawDisplay,!1),this.displayController=null,this._displayDirty=!1,this._zOrderDirty=!1,this._blendModeDirty=!1,this._colorDirty=!1,this._transformDirty=!1,this._visible=!0,this._blendMode=0,this._displayIndex=-1,this._animationDisplayIndex=-1,this._zOrder=0,this._cachedFrameIndex=-1,this._pivotX=0,this._pivotY=0,this._localMatrix.identity(),this._colorTransform.identity(),this._displayList.length=0,this._displayDatas.length=0,this._slotData=null,this._rawDisplayDatas=null,this._displayData=null,this._boundingBoxData=null,this._textureData=null,this._deformVertices=null,this._rawDisplay=null,this._meshDisplay=null,this._display=null,this._childArmature=null,this._parent=null,this._cachedFrameIndices=null},i.prototype._getDefaultRawDisplayData=function(t){var e=this._armature._armatureData.defaultSkin;if(null!==e){var i=e.getDisplays(this._slotData.name);if(null!==i)return t<i.length?i[t]:null}return null},i.prototype._updateDisplayData=function(){var e=this._displayData,n=null!==this._deformVertices?this._deformVertices.verticesData:null,r=this._textureData,s=null,a=null;if(this._displayData=null,this._boundingBoxData=null,this._textureData=null,this._displayIndex>=0&&(null!==this._rawDisplayDatas&&(s=this._displayIndex<this._rawDisplayDatas.length?this._rawDisplayDatas[this._displayIndex]:null),null===s&&(s=this._getDefaultRawDisplayData(this._displayIndex)),this._displayIndex<this._displayDatas.length&&(this._displayData=this._displayDatas[this._displayIndex])),null!==this._displayData&&(2===this._displayData.type||4===this._displayData.type?a=this._displayData.vertices:null!==s&&(2===s.type||4===s.type)&&(a=s.vertices),3===this._displayData.type?this._boundingBoxData=this._displayData.boundingBox:null!==s&&3===s.type&&(this._boundingBoxData=s.boundingBox),(0===this._displayData.type||2===this._displayData.type)&&(this._textureData=this._displayData.texture)),this._displayData!==e||a!==n||this._textureData!==r){if(null===a&&null!==this._textureData){var o=this._displayData,h=this._textureData.parent.scale*this._armature._armatureData.scale,u=this._textureData.frame;this._pivotX=o.pivot.x,this._pivotY=o.pivot.y;var l=null!==u?u:this._textureData.region,c=l.width,_=l.height;this._textureData.rotated&&null===u&&(c=l.height,_=l.width),this._pivotX*=c*h,this._pivotY*=_*h,null!==u&&(this._pivotX+=u.x*h,this._pivotY+=u.y*h),null!==this._displayData&&null!==s&&this._displayData!==s&&(s.transform.toMatrix(i._helpMatrix),i._helpMatrix.invert(),i._helpMatrix.transformPoint(0,0,i._helpPoint),this._pivotX-=i._helpPoint.x,this._pivotY-=i._helpPoint.y,this._displayData.transform.toMatrix(i._helpMatrix),i._helpMatrix.invert(),i._helpMatrix.transformPoint(0,0,i._helpPoint),this._pivotX+=i._helpPoint.x,this._pivotY+=i._helpPoint.y),t.DragonBones.yDown||(this._pivotY=(this._textureData.rotated?this._textureData.region.width:this._textureData.region.height)*h-this._pivotY)}else this._pivotX=0,this._pivotY=0;null!==s?this.origin=s.transform:null!==this._displayData?this.origin=this._displayData.transform:this.origin=null,a!==n?(null===this._deformVertices&&(this._deformVertices=t.BaseObject.borrowObject(t.DeformVertices)),this._deformVertices.init(a,this._armature)):null!==this._deformVertices&&this._textureData!==r&&(this._deformVertices.verticesDirty=!0),this._displayDirty=!0,this._transformDirty=!0}},i.prototype._updateDisplay=function(){var e=null!==this._display?this._display:this._rawDisplay,i=this._childArmature;this._displayIndex>=0&&this._displayIndex<this._displayList.length?(this._display=this._displayList[this._displayIndex],null!==this._display&&this._display instanceof t.Armature?(this._childArmature=this._display,this._display=this._childArmature.display):this._childArmature=null):(this._display=null,this._childArmature=null);var n=null!==this._display?this._display:this._rawDisplay;if(n!==e&&(this._onUpdateDisplay(),this._replaceDisplay(e),this._transformDirty=!0,this._visibleDirty=!0,this._blendModeDirty=!0,this._colorDirty=!0),n!==this._rawDisplay&&n!==this._meshDisplay||this._updateFrame(),this._childArmature!==i&&(null!==i&&(i._parent=null,i.clock=null,i.inheritAnimation&&i.animation.reset()),null!==this._childArmature&&(this._childArmature._parent=this,this._childArmature.clock=this._armature.clock,this._childArmature.inheritAnimation))){if(0===this._childArmature.cacheFrameRate){var r=this._armature.cacheFrameRate;0!==r&&(this._childArmature.cacheFrameRate=r)}var s=null;if(null!==this._displayData&&1===this._displayData.type)s=this._displayData.actions;else if(this._displayIndex>=0&&null!==this._rawDisplayDatas){var a=this._displayIndex<this._rawDisplayDatas.length?this._rawDisplayDatas[this._displayIndex]:null;null===a&&(a=this._getDefaultRawDisplayData(this._displayIndex)),null!==a&&1===a.type&&(s=a.actions)}if(null!==s&&s.length>0)for(var o=0,h=s;o<h.length;o++){var u=h[o],l=t.BaseObject.borrowObject(t.EventObject);t.EventObject.actionDataToInstance(u,l,this._armature),l.slot=this,this._armature._bufferAction(l,!1)}else this._childArmature.animation.play()}},i.prototype._updateGlobalTransformMatrix=function(t){var e=0===this._parent._boneData.type?this._parent.globalTransformMatrix:this._parent._getGlobalTransformMatrix(this.global.x,this.global.y);this.globalTransformMatrix.copyFrom(this._localMatrix),this.globalTransformMatrix.concat(e),t?this.global.fromMatrix(this.globalTransformMatrix):this._globalDirty=!0},i.prototype._setDisplayIndex=function(t,e){if(void 0===e&&(e=!1),e){if(this._animationDisplayIndex===t)return!1;this._animationDisplayIndex=t}return this._displayIndex!==t&&(this._displayIndex=t,this._displayDirty=!0,this._updateDisplayData(),this._displayDirty)},i.prototype._setZorder=function(t){return this._zOrder,this._zOrder=t,this._zOrderDirty=!0,this._zOrderDirty},i.prototype._setColor=function(t){return this._colorTransform.copyFrom(t),this._colorDirty=!0,this._colorDirty},i.prototype._setDisplayList=function(e){if(null!==e&&e.length>0){this._displayList.length!==e.length&&(this._displayList.length=e.length);for(var i=0,n=e.length;i<n;++i){var r=e[i];null!==r&&r!==this._rawDisplay&&r!==this._meshDisplay&&!(r instanceof t.Armature)&&this._displayList.indexOf(r)<0&&this._initDisplay(r,!0),this._displayList[i]=r}}else this._displayList.length>0&&(this._displayList.length=0);return this._displayIndex>=0&&this._displayIndex<this._displayList.length?this._displayDirty=this._display!==this._displayList[this._displayIndex]:this._displayDirty=null!==this._display,this._updateDisplayData(),this._displayDirty},i.prototype.init=function(t,e,i,n){if(null===this._slotData){this._slotData=t,this._isFromCache=!1,this._visibleDirty=!0,this._blendModeDirty=!0,this._colorDirty=!0,this._blendMode=this._slotData.blendMode,this._zOrder=this._slotData.zOrder,this._colorTransform.copyFrom(this._slotData.color),this._rawDisplay=i,this._meshDisplay=n,this._armature=e;var r=this._armature.getBone(this._slotData.parent.name);null!==r&&(this._parent=r),this._armature._addSlot(this),this._initDisplay(this._rawDisplay,!1),this._rawDisplay!==this._meshDisplay&&this._initDisplay(this._meshDisplay,!1),this._onUpdateDisplay(),this._addDisplay()}},i.prototype.update=function(t){if(this._isFromCache=!1,this._displayDirty&&(this._displayDirty=!1,this._updateDisplay(),this._transformDirty&&(null!==this.origin?this.global.copyFrom(this.origin).add(this.offset).toMatrix(this._localMatrix):this.global.copyFrom(this.offset).toMatrix(this._localMatrix))),this._zOrderDirty&&(this._zOrderDirty=!1,this._updateZOrder()),t>=0&&null!==this._cachedFrameIndices){var e=this._cachedFrameIndices[t];e>=0&&this._cachedFrameIndex===e?this._transformDirty=!1:e>=0?(this._transformDirty=!0,this._cachedFrameIndex=e):this._transformDirty||this._parent._childrenTransformDirty?(this._transformDirty=!0,this._cachedFrameIndex=-1):this._cachedFrameIndex>=0?(this._transformDirty=!1,this._cachedFrameIndices[t]=this._cachedFrameIndex):(this._transformDirty=!0,this._cachedFrameIndex=-1)}else(this._transformDirty||this._parent._childrenTransformDirty)&&(t=-1,this._transformDirty=!0,this._cachedFrameIndex=-1);if(null!==this._display){if(this._visibleDirty&&(this._visibleDirty=!1,this._updateVisible()),this._blendModeDirty&&(this._blendModeDirty=!1,this._updateBlendMode()),this._colorDirty&&(this._colorDirty=!1,this._updateColor()),null!==this._deformVertices&&null!==this._deformVertices.verticesData&&this._display===this._meshDisplay){var i=null!==this._deformVertices.verticesData.weight,n=0!==this._parent._boneData.type;if((this._deformVertices.verticesDirty||i&&this._deformVertices.isBonesUpdate()||n&&this._parent._childrenTransformDirty)&&(this._deformVertices.verticesDirty=!1,this._updateMesh()),i||n)return}if(this._transformDirty){if(this._transformDirty=!1,this._cachedFrameIndex<0){var r=t>=0;this._updateGlobalTransformMatrix(r),r&&null!==this._cachedFrameIndices&&(this._cachedFrameIndex=this._cachedFrameIndices[t]=this._armature._armatureData.setCacheFrame(this.globalTransformMatrix,this.global))}else this._isFromCache=!0,this._armature._armatureData.getCacheFrame(this.globalTransformMatrix,this.global,this._cachedFrameIndex);this._updateTransform()}}},i.prototype.updateTransformAndMatrix=function(){this._transformDirty&&(this._transformDirty=!1,this._updateGlobalTransformMatrix(!1))},i.prototype.replaceDisplayData=function(t,e){if(void 0===e&&(e=-1),e<0&&(e=this._displayIndex<0?0:this._displayIndex),this._displayDatas.length<=e){this._displayDatas.length=e+1;for(var i=0,n=this._displayDatas.length;i<n;++i)this._displayDatas[i]||(this._displayDatas[i]=null)}this._displayDatas[e]=t},i.prototype.containsPoint=function(t,e){return null!==this._boundingBoxData&&(this.updateTransformAndMatrix(),i._helpMatrix.copyFrom(this.globalTransformMatrix),i._helpMatrix.invert(),i._helpMatrix.transformPoint(t,e,i._helpPoint),this._boundingBoxData.containsPoint(i._helpPoint.x,i._helpPoint.y))},i.prototype.intersectsSegment=function(t,e,n,r,s,a,o){if(void 0===s&&(s=null),void 0===a&&(a=null),void 0===o&&(o=null),null===this._boundingBoxData)return 0;this.updateTransformAndMatrix(),i._helpMatrix.copyFrom(this.globalTransformMatrix),i._helpMatrix.invert(),i._helpMatrix.transformPoint(t,e,i._helpPoint),t=i._helpPoint.x,e=i._helpPoint.y,i._helpMatrix.transformPoint(n,r,i._helpPoint),n=i._helpPoint.x,r=i._helpPoint.y;var h=this._boundingBoxData.intersectsSegment(t,e,n,r,s,a,o);return h>0&&(1===h||2===h?null!==s?(this.globalTransformMatrix.transformPoint(s.x,s.y,s),null!==a&&(a.x=s.x,a.y=s.y)):null!==a&&this.globalTransformMatrix.transformPoint(a.x,a.y,a):(null!==s&&this.globalTransformMatrix.transformPoint(s.x,s.y,s),null!==a&&this.globalTransformMatrix.transformPoint(a.x,a.y,a)),null!==o&&(this.globalTransformMatrix.transformPoint(Math.cos(o.x),Math.sin(o.x),i._helpPoint,!0),o.x=Math.atan2(i._helpPoint.y,i._helpPoint.x),this.globalTransformMatrix.transformPoint(Math.cos(o.y),Math.sin(o.y),i._helpPoint,!0),o.y=Math.atan2(i._helpPoint.y,i._helpPoint.x))),h},i.prototype.invalidUpdate=function(){this._displayDirty=!0,this._transformDirty=!0},Object.defineProperty(i.prototype,"visible",{get:function(){return this._visible},set:function(t){this._visible!==t&&(this._visible=t,this._updateVisible())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"displayIndex",{get:function(){return this._displayIndex},set:function(t){this._setDisplayIndex(t)&&this.update(-1)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"name",{get:function(){return this._slotData.name},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"displayList",{get:function(){return this._displayList.concat()},set:function(e){var i=this._displayList.concat(),n=new Array;this._setDisplayList(e)&&this.update(-1);for(var r=0,s=i;r<s.length;r++)null!==(h=s[r])&&h!==this._rawDisplay&&h!==this._meshDisplay&&this._displayList.indexOf(h)<0&&n.indexOf(h)<0&&n.push(h);for(var a=0,o=n;a<o.length;a++){var h;(h=o[a])instanceof t.Armature||this._disposeDisplay(h,!0)}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"slotData",{get:function(){return this._slotData},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"rawDisplayDatas",{get:function(){return this._rawDisplayDatas},set:function(t){if(this._rawDisplayDatas!==t)if(this._displayDirty=!0,this._rawDisplayDatas=t,null!==this._rawDisplayDatas){this._displayDatas.length=this._rawDisplayDatas.length;for(var e=0,i=this._displayDatas.length;e<i;++e){var n=this._rawDisplayDatas[e];null===n&&(n=this._getDefaultRawDisplayData(e)),this._displayDatas[e]=n}}else this._displayDatas.length=0},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"displayData",{get:function(){return this._displayData},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"boundingBoxData",{get:function(){return this._boundingBoxData},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"rawDisplay",{get:function(){return this._rawDisplay},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"meshDisplay",{get:function(){return this._meshDisplay},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"display",{get:function(){return this._display},set:function(t){if(this._display!==t){var e=this._displayList.length;if(this._displayIndex<0&&0===e&&(this._displayIndex=0),!(this._displayIndex<0)){var i=this.displayList;e<=this._displayIndex&&(i.length=this._displayIndex+1),i[this._displayIndex]=t,this.displayList=i}}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"childArmature",{get:function(){return this._childArmature},set:function(t){this._childArmature!==t&&(this.display=t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"parent",{get:function(){return this._parent},enumerable:!0,configurable:!0}),i.prototype.getDisplay=function(){return this._display},i.prototype.setDisplay=function(t){this.display=t},i}(t.TransformObject);t.Slot=e}(HZ||(HZ={})),function(t){var e=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return zZ(i,e),i.prototype._onClear=function(){this._armature=null,this._target=null,this._root=null,this._bone=null},Object.defineProperty(i.prototype,"name",{get:function(){return this._constraintData.name},enumerable:!0,configurable:!0}),i._helpMatrix=new t.Matrix,i._helpTransform=new t.Transform,i._helpPoint=new t.Point,i}(t.BaseObject);t.Constraint=e;var i=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return zZ(i,e),i.toString=function(){return"[class dragonBones.IKConstraint]"},i.prototype._onClear=function(){e.prototype._onClear.call(this),this._scaleEnabled=!1,this._bendPositive=!1,this._weight=1,this._constraintData=null},i.prototype._computeA=function(){var e=this._target.global,i=this._root.global,n=this._root.globalTransformMatrix,r=Math.atan2(e.y-i.y,e.x-i.x);i.scaleX<0&&(r+=Math.PI),i.rotation+=t.Transform.normalizeRadian(r-i.rotation)*this._weight,i.toMatrix(n)},i.prototype._computeB=function(){var e=this._bone._boneData.length,i=this._root,n=this._target.global,r=i.global,s=this._bone.global,a=this._bone.globalTransformMatrix,o=a.a*e,h=a.b*e,u=o*o+h*h,l=Math.sqrt(u),c=s.x-r.x,_=s.y-r.y,f=c*c+_*_,d=Math.sqrt(f),p=s.rotation,m=r.rotation,g=Math.atan2(_,c),y=(c=n.x-r.x)*c+(_=n.y-r.y)*_,v=Math.sqrt(y),S=0;if(l+d<=v||v+l<=d||v+d<=l)S=Math.atan2(n.y-r.y,n.x-r.x),l+d<=v||d<l&&(S+=Math.PI);else{var A=(f-u+y)/(2*y),T=Math.sqrt(f-A*A*y)/v,E=r.x+c*A,b=r.y+_*A,x=-_*T,C=c*T,R=!1,w=i.parent;if(null!==w){var I=w.globalTransformMatrix;R=I.a*I.d-I.b*I.c<0}R!==this._bendPositive?(s.x=E-x,s.y=b-C):(s.x=E+x,s.y=b+C),S=Math.atan2(s.y-r.y,s.x-r.x)}var B=t.Transform.normalizeRadian(S-g);r.rotation=m+B*this._weight,r.toMatrix(i.globalTransformMatrix);var D=g+B*this._weight;s.x=r.x+Math.cos(D)*d,s.y=r.y+Math.sin(D)*d;var P=Math.atan2(n.y-s.y,n.x-s.x);s.scaleX<0&&(P+=Math.PI),s.rotation=r.rotation+p-m+t.Transform.normalizeRadian(P-B-p)*this._weight,s.toMatrix(a)},i.prototype.init=function(t,e){if(null===this._constraintData){this._constraintData=t,this._armature=e,this._target=this._armature.getBone(this._constraintData.target.name),this._root=this._armature.getBone(this._constraintData.root.name),this._bone=null!==this._constraintData.bone?this._armature.getBone(this._constraintData.bone.name):null;var i=this._constraintData;this._scaleEnabled=i.scaleEnabled,this._bendPositive=i.bendPositive,this._weight=i.weight,this._root._hasConstraint=!0}},i.prototype.update=function(){this._root.updateByConstraint(),null!==this._bone?(this._bone.updateByConstraint(),this._computeB()):this._computeA()},i.prototype.invalidUpdate=function(){this._root.invalidUpdate(),null!==this._bone&&this._bone.invalidUpdate()},i}(e);t.IKConstraint=i;var n=function(e){function i(){var t=null!==e&&e.apply(this,arguments)||this;return t._bones=[],t._spaces=[],t._positions=[],t._curves=[],t._boneLengths=[],t._pathGlobalVertices=[],t._segments=[10],t}return zZ(i,e),i.toString=function(){return"[class dragonBones.PathConstraint]"},i.prototype._onClear=function(){e.prototype._onClear.call(this),this.dirty=!1,this.pathOffset=0,this.position=0,this.spacing=0,this.rotateOffset=0,this.rotateMix=1,this.translateMix=1,this._pathSlot=null,this._bones.length=0,this._spaces.length=0,this._positions.length=0,this._curves.length=0,this._boneLengths.length=0,this._pathGlobalVertices.length=0},i.prototype._updatePathVertices=function(t){var e=this._armature,i=e.armatureData.parent,n=e.armatureData.scale,r=i.intArray,s=i.floatArray,a=t.offset,o=r[a+0],h=r[a+2];this._pathGlobalVertices.length=2*o;var u=t.weight;if(null!==u)for(var l=this._pathSlot._deformVertices.bones,c=u.bones.length,_=u.offset,f=r[_+1],d=_+2+c,p=(b=0,0);b<o;b++){for(var m=0,g=0,y=0,v=r[d++];y<v;y++){var S=l[r[d++]];if(null!==S){S.updateByConstraint(),E=S.globalTransformMatrix;var A=s[f++];C=s[f++]*n,R=s[f++]*n,m+=(E.a*C+E.c*R+E.tx)*A,g+=(E.b*C+E.d*R+E.ty)*A}}this._pathGlobalVertices[p++]=m,this._pathGlobalVertices[p++]=g}else{var T=this._pathSlot.parent;T.updateByConstraint();for(var E=T.globalTransformMatrix,b=0,x=h;b<o;b+=2){var C=s[x++]*n,R=s[x++]*n,w=E.a*C+E.c*R+E.tx,I=E.b*C+E.d*R+E.ty;this._pathGlobalVertices[b]=w,this._pathGlobalVertices[b+1]=I}}},i.prototype._computeVertices=function(t,e,i,n){for(var r=i,s=t;r<e;r+=2)n[r]=this._pathGlobalVertices[s++],n[r+1]=this._pathGlobalVertices[s++]},i.prototype._computeBezierCurve=function(t,e,i,n,r){var s=this._armature.armatureData.parent.intArray[t.vertices.offset+0],a=this._positions,o=this._spaces,h=t.closed,u=Array(),l=2*s,c=l/6,_=-1,f=this.position;a.length=3*e+2;var d=0;if(t.constantSpeed){h?(l+=2,u.length=s,this._computeVertices(2,l-4,0,u),this._computeVertices(0,2,l-4,u),u[l-2]=u[0],u[l-1]=u[1]):(c--,l-=4,u.length=l,this._computeVertices(2,l,0,u));var p=new Array(c);d=0;for(var m,g,y,v,S,A,T,E,b=u[0],x=u[1],C=0,R=0,w=0,I=0,B=0,D=0,P=(z=0,2);z<c;z++,P+=6)C=u[P],R=u[P+1],w=u[P+2],I=u[P+3],S=2*(m=.1875*(b-2*C+w))+(y=.09375*(3*(C-w)-b+(B=u[P+4]))),A=2*(g=.1875*(x-2*R+I))+(v=.09375*(3*(R-I)-x+(D=u[P+5]))),T=.75*(C-b)+m+.16666667*y,E=.75*(R-x)+g+.16666667*v,d+=Math.sqrt(T*T+E*E),T+=S,E+=A,S+=y,A+=v,d+=Math.sqrt(T*T+E*E),T+=S,E+=A,d+=Math.sqrt(T*T+E*E),T+=S+y,E+=A+v,d+=Math.sqrt(T*T+E*E),p[z]=d,b=B,x=D;if(n&&(f*=d),r)for(z=0;z<e;z++)o[z]*=d;for(var O=this._segments,M=0,N=(z=0,H=0,W=0,0);z<e;z++,H+=3){var L=f+=o[z];if(h)(L%=d)<0&&(L+=d),W=0;else{if(L<0)continue;if(L>d)continue}for(;;W++){var F=p[W];if(!(L>F)){0===W?L/=F:L=(L-(V=p[W-1]))/(F-V);break}}if(W!==_){_=W;var k=6*W;for(b=u[k],x=u[k+1],C=u[k+2],R=u[k+3],w=u[k+4],I=u[k+5],S=2*(m=.03*(b-2*C+w))+(y=.006*(3*(C-w)-b+(B=u[k+6]))),A=2*(g=.03*(x-2*R+I))+(v=.006*(3*(R-I)-x+(D=u[k+7]))),T=.3*(C-b)+m+.16666667*y,E=.3*(R-x)+g+.16666667*v,M=Math.sqrt(T*T+E*E),O[0]=M,k=1;k<8;k++)T+=S,E+=A,S+=y,A+=v,M+=Math.sqrt(T*T+E*E),O[k]=M;T+=S,E+=A,M+=Math.sqrt(T*T+E*E),O[8]=M,T+=S+y,E+=A+v,M+=Math.sqrt(T*T+E*E),O[9]=M,N=0}for(L*=M;;N++){var G=O[N];if(!(L>G)){var V;0===N?L/=G:L=N+(L-(V=O[N-1]))/(G-V);break}}this.addCurvePosition(.1*L,b,x,C,R,w,I,B,D,a,H,i)}}else{var U=t.curveLengths;if(d=U[c-=h?1:2],n&&(f*=d),r)for(var z=0;z<e;z++)o[z]*=d;u.length=8;z=0;for(var H=0,W=0;z<e;z++,H+=3){if(f+=o[z],h)(f%=d)<0&&(f+=d),W=0;else{if(f<0)continue;if(f>d)continue}for(var X=0;;W++){var j=U[W];if(!(f>j)){if(0===W)X=f/j;else{var Y=U[W-1];X=(f-Y)/(j-Y)}break}}W!==_&&(_=W,h&&W===c?(this._computeVertices(l-4,4,0,u),this._computeVertices(0,4,4,u)):this._computeVertices(6*W+2,8,0,u)),this.addCurvePosition(X,u[0],u[1],u[2],u[3],u[4],u[5],u[6],u[7],a,H,i)}}},i.prototype.addCurvePosition=function(t,e,i,n,r,s,a,o,h,u,l,c){if(0===t)return u[l]=e,u[l+1]=i,void(u[l+2]=0);if(1===t)return u[l]=o,u[l+1]=h,void(u[l+2]=0);var _=1-t,f=_*_,d=t*t,p=f*_,m=f*t*3,g=_*d*3,y=t*d,v=p*e+m*n+g*s+y*o,S=p*i+m*r+g*a+y*h;u[l]=v,u[l+1]=S,u[l+2]=c?Math.atan2(S-(p*i+m*r+g*a),v-(p*e+m*n+g*s)):0},i.prototype.init=function(t,e){this._constraintData=t,this._armature=e;var i=t;this.pathOffset=i.pathDisplayData.vertices.offset,this.position=i.position,this.spacing=i.spacing,this.rotateOffset=i.rotateOffset,this.rotateMix=i.rotateMix,this.translateMix=i.translateMix,this._root=this._armature.getBone(i.root.name),this._target=this._armature.getBone(i.target.name),this._pathSlot=this._armature.getSlot(i.pathSlot.name);for(var n=0,r=i.bones.length;n<r;n++){var s=this._armature.getBone(i.bones[n].name);null!==s&&this._bones.push(s)}2===i.rotateMode&&(this._boneLengths.length=this._bones.length),this._root._hasConstraint=!0},i.prototype.update=function(){var e=this._pathSlot;if(null!==e._deformVertices&&null!==e._deformVertices.verticesData&&e._deformVertices.verticesData.offset===this.pathOffset){var i=this._constraintData,n=e._displayData,r=!1,s=e._deformVertices;if(this._root._childrenTransformDirty?(this._updatePathVertices(n.vertices),r=!0):null!==s&&(s.verticesDirty||s.isBonesUpdate())&&(this._updatePathVertices(n.vertices),s.verticesDirty=!1,r=!0),r||this.dirty){var a=i.positionMode,o=i.spacingMode,h=i.rotateMode,u=this._bones,l=0===o,c=2===h,_=0===h,f=u.length,d=_?f:f+1,p=this.spacing,m=this._spaces;if(m.length=d,c||l){m[0]=0;for(var g=0,y=d-1;g<y;g++){(D=u[g]).updateByConstraint();var v=D._boneData.length,S=v*(P=D.globalTransformMatrix).a,A=v*P.b,T=Math.sqrt(S*S+A*A);c&&(this._boneLengths[g]=T),m[g+1]=(v+p)*T/v}}else for(g=0;g<d;g++)m[g]=p;this._computeBezierCurve(n,d,_,1===a,2===o);var E,b=this._positions,x=this.rotateOffset,C=b[0],R=b[1];0===x?E=1===h:(E=!1,null!==(D=e.parent)&&(x*=(P=D.globalTransformMatrix).a*P.d-P.b*P.c>0?t.Transform.DEG_RAD:-t.Transform.DEG_RAD));for(var w=this.rotateMix,I=this.translateMix,B=(g=0,3);g<f;g++,B+=3){var D,P;(D=u[g]).updateByConstraint(),(P=D.globalTransformMatrix).tx+=(C-P.tx)*I,P.ty+=(R-P.ty)*I;var O=(S=b[B])-C,M=(A=b[B+1])-R;if(c){var N=this._boneLengths[g],L=(Math.sqrt(O*O+M*M)/N-1)*w+1;P.a*=L,P.b*=L}if(C=S,R=A,w>0){var F=P.a,k=P.b,G=P.c,V=P.d,U=void 0,z=void 0,H=void 0;if(U=_?b[B-1]:Math.atan2(M,O),U-=Math.atan2(k,F),E){z=Math.cos(U),H=Math.sin(U);var W=D._boneData.length;C+=(W*(z*F-H*k)-O)*w,R+=(W*(H*F+z*k)-M)*w}else U+=x;U>t.Transform.PI?U-=t.Transform.PI_D:U<-t.Transform.PI&&(U+=t.Transform.PI_D),U*=w,z=Math.cos(U),H=Math.sin(U),P.a=z*F-H*k,P.b=H*F+z*k,P.c=z*G-H*V,P.d=H*G+z*V}D.global.fromMatrix(P)}this.dirty=!1}}},i.prototype.invalidUpdate=function(){},i}(e);t.PathConstraint=n}(HZ||(HZ={})),function(t){var e=function(){function t(t){void 0===t&&(t=0),this.time=0,this.timeScale=1,this._systemTime=0,this._animatebles=[],this._clock=null,this.time=t,this._systemTime=.001*(new Date).getTime()}return t.prototype.advanceTime=function(t){t!=t&&(t=0);var e=.001*Date.now();if(t<0&&(t=e-this._systemTime),this._systemTime=e,1!==this.timeScale&&(t*=this.timeScale),0!==t){t<0?this.time-=t:this.time+=t;for(var i=0,n=0,r=this._animatebles.length;i<r;++i){var s=this._animatebles[i];null!==s?(n>0&&(this._animatebles[i-n]=s,this._animatebles[i]=null),s.advanceTime(t)):n++}if(n>0){for(r=this._animatebles.length;i<r;++i){var a=this._animatebles[i];null!==a?this._animatebles[i-n]=a:n++}this._animatebles.length-=n}}},t.prototype.contains=function(t){if(t===this)return!1;for(var e=t;e!==this&&null!==e;)e=e.clock;return e===this},t.prototype.add=function(t){this._animatebles.indexOf(t)<0&&(this._animatebles.push(t),t.clock=this)},t.prototype.remove=function(t){var e=this._animatebles.indexOf(t);e>=0&&(this._animatebles[e]=null,t.clock=null)},t.prototype.clear=function(){for(var t=0,e=this._animatebles;t<e.length;t++){var i=e[t];null!==i&&(i.clock=null)}},Object.defineProperty(t.prototype,"clock",{get:function(){return this._clock},set:function(t){this._clock!==t&&(null!==this._clock&&this._clock.remove(this),this._clock=t,null!==this._clock&&this._clock.add(this))},enumerable:!0,configurable:!0}),t.clock=new t,t}();t.WorldClock=e}(HZ||(HZ={})),function(t){var e=function(e){function i(){var t=null!==e&&e.apply(this,arguments)||this;return t._animationNames=[],t._animationStates=[],t._animations={},t._animationConfig=null,t}return zZ(i,e),i.toString=function(){return"[class dragonBones.Animation]"},i.prototype._onClear=function(){for(var t=0,e=this._animationStates;t<e.length;t++)e[t].returnToPool();for(var i in this._animations)delete this._animations[i];null!==this._animationConfig&&this._animationConfig.returnToPool(),this.timeScale=1,this._lockUpdate=!1,this._animationDirty=!1,this._inheritTimeScale=1,this._animationNames.length=0,this._animationStates.length=0,this._armature=null,this._animationConfig=null,this._lastAnimationState=null},i.prototype._fadeOut=function(t){switch(t.fadeOutMode){case 1:for(var e=0,i=this._animationStates;e<i.length;e++)null===(u=i[e])._parent&&u.layer===t.layer&&u.fadeOut(t.fadeOutTime,t.pauseFadeOut);break;case 2:for(var n=0,r=this._animationStates;n<r.length;n++)null===(u=r[n])._parent&&u.group===t.group&&u.fadeOut(t.fadeOutTime,t.pauseFadeOut);break;case 3:for(var s=0,a=this._animationStates;s<a.length;s++)null===(u=a[s])._parent&&u.layer===t.layer&&u.group===t.group&&u.fadeOut(t.fadeOutTime,t.pauseFadeOut);break;case 4:for(var o=0,h=this._animationStates;o<h.length;o++){var u;null===(u=h[o])._parent&&u.fadeOut(t.fadeOutTime,t.pauseFadeOut)}}},i.prototype.init=function(e){null===this._armature&&(this._armature=e,this._animationConfig=t.BaseObject.borrowObject(t.AnimationConfig))},i.prototype.advanceTime=function(t){t<0&&(t=-t),this._armature.inheritAnimation&&null!==this._armature._parent?this._inheritTimeScale=this._armature._parent._armature.animation._inheritTimeScale*this.timeScale:this._inheritTimeScale=this.timeScale,1!==this._inheritTimeScale&&(t*=this._inheritTimeScale);var e=this._animationStates.length;if(1===e)if((d=this._animationStates[0])._fadeState>0&&d._subFadeState>0)this._armature._dragonBones.bufferObject(d),this._animationStates.length=0,this._lastAnimationState=null;else{var i=d._animationData,n=i.cacheFrameRate;if(this._animationDirty&&n>0){this._animationDirty=!1;for(var r=0,s=this._armature.getBones();r<s.length;r++){var a=s[r];a._cachedFrameIndices=i.getBoneCachedFrameIndices(a.name)}for(var o=0,h=this._armature.getSlots();o<h.length;o++){var u=h[o],l=u.rawDisplayDatas;if(null!==l&&l.length>0){var c=l[0];if(null!==c&&c.parent===this._armature.armatureData.defaultSkin){u._cachedFrameIndices=i.getSlotCachedFrameIndices(u.name);continue}}u._cachedFrameIndices=null}}d.advanceTime(t,n)}else if(e>1){for(var _=0,f=0;_<e;++_){var d;(d=this._animationStates[_])._fadeState>0&&d._subFadeState>0?(f++,this._armature._dragonBones.bufferObject(d),this._animationDirty=!0,this._lastAnimationState===d&&(this._lastAnimationState=null)):(f>0&&(this._animationStates[_-f]=d),d.advanceTime(t,0)),_===e-1&&f>0&&(this._animationStates.length-=f,null===this._lastAnimationState&&this._animationStates.length>0&&(this._lastAnimationState=this._animationStates[this._animationStates.length-1]))}this._armature._cacheFrameIndex=-1}else this._armature._cacheFrameIndex=-1},i.prototype.reset=function(){for(var t=0,e=this._animationStates;t<e.length;t++)e[t].returnToPool();this._animationDirty=!1,this._animationConfig.clear(),this._animationStates.length=0,this._lastAnimationState=null},i.prototype.stop=function(t){if(void 0===t&&(t=null),null!==t)null!==(n=this.getState(t))&&n.stop();else for(var e=0,i=this._animationStates;e<i.length;e++){var n;(n=i[e]).stop()}},i.prototype.playConfig=function(e){var i=e.animation;if(!(i in this._animations))return console.warn("Non-existent animation.\n","DragonBones name: "+this._armature.armatureData.parent.name,"Armature name: "+this._armature.name,"Animation name: "+i),null;var n=this._animations[i];if(5===e.fadeOutMode)for(var r=0,s=this._animationStates;r<s.length;r++){var a=s[r];if(a._animationData===n)return a}0===this._animationStates.length?e.fadeInTime=0:e.fadeInTime<0&&(e.fadeInTime=n.fadeInTime),e.fadeOutTime<0&&(e.fadeOutTime=e.fadeInTime),e.timeScale<=-100&&(e.timeScale=1/n.scale),n.frameCount>1?(e.position<0?(e.position%=n.duration,e.position=n.duration-e.position):e.position===n.duration?e.position-=1e-6:e.position>n.duration&&(e.position%=n.duration),e.duration>0&&e.position+e.duration>n.duration&&(e.duration=n.duration-e.position),e.playTimes<0&&(e.playTimes=n.playTimes)):(e.playTimes=1,e.position=0,e.duration>0&&(e.duration=0)),0===e.duration&&(e.duration=-1),this._fadeOut(e);var o=t.BaseObject.borrowObject(t.AnimationState);if(o.init(this._armature,n,e),this._animationDirty=!0,this._armature._cacheFrameIndex=-1,this._animationStates.length>0){for(var h=!1,u=0,l=this._animationStates.length;u<l;++u){if(o.layer>this._animationStates[u].layer){h=!0,this._animationStates.splice(u,0,o);break}if(u!==l-1&&o.layer>this._animationStates[u+1].layer){h=!0,this._animationStates.splice(u+1,0,o);break}}h||this._animationStates.push(o)}else this._animationStates.push(o);for(var c=0,_=this._armature.getSlots();c<_.length;c++){var f=_[c].childArmature;null!==f&&f.inheritAnimation&&f.animation.hasAnimation(i)&&null===f.animation.getState(i)&&f.animation.fadeIn(i)}var d=!1;for(var p in n.animationTimelines){this._lockUpdate||(d=!0,this._lockUpdate=!0);var m=this.fadeIn(p,e.fadeInTime,1,o.layer,null,0);null!==m&&(m.resetToPose=!1,m._parent=o,m.stop())}return d&&(this._lockUpdate=!1),this._lockUpdate||(e.fadeInTime<=0&&this._armature.advanceTime(0),this._lastAnimationState=o),o},i.prototype.play=function(t,e){if(void 0===t&&(t=null),void 0===e&&(e=-1),this._animationConfig.clear(),this._animationConfig.resetToPose=!0,this._animationConfig.playTimes=e,this._animationConfig.fadeInTime=0,this._animationConfig.animation=null!==t?t:"",null!==t&&t.length>0)this.playConfig(this._animationConfig);else if(null===this._lastAnimationState){var i=this._armature.armatureData.defaultAnimation;null!==i&&(this._animationConfig.animation=i.name,this.playConfig(this._animationConfig))}else this._lastAnimationState.isPlaying||this._lastAnimationState.isCompleted?(this._animationConfig.animation=this._lastAnimationState.name,this.playConfig(this._animationConfig)):this._lastAnimationState.play();return this._lastAnimationState},i.prototype.fadeIn=function(t,e,i,n,r,s){return void 0===e&&(e=-1),void 0===i&&(i=-1),void 0===n&&(n=0),void 0===r&&(r=null),void 0===s&&(s=3),this._animationConfig.clear(),this._animationConfig.fadeOutMode=s,this._animationConfig.playTimes=i,this._animationConfig.layer=n,this._animationConfig.fadeInTime=e,this._animationConfig.animation=t,this._animationConfig.group=null!==r?r:"",this.playConfig(this._animationConfig)},i.prototype.gotoAndPlayByTime=function(t,e,i){return void 0===e&&(e=0),void 0===i&&(i=-1),this._animationConfig.clear(),this._animationConfig.resetToPose=!0,this._animationConfig.playTimes=i,this._animationConfig.position=e,this._animationConfig.fadeInTime=0,this._animationConfig.animation=t,this.playConfig(this._animationConfig)},i.prototype.gotoAndPlayByFrame=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=-1),this._animationConfig.clear(),this._animationConfig.resetToPose=!0,this._animationConfig.playTimes=i,this._animationConfig.fadeInTime=0,this._animationConfig.animation=t;var n=t in this._animations?this._animations[t]:null;return null!==n&&(this._animationConfig.position=n.duration*e/n.frameCount),this.playConfig(this._animationConfig)},i.prototype.gotoAndPlayByProgress=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=-1),this._animationConfig.clear(),this._animationConfig.resetToPose=!0,this._animationConfig.playTimes=i,this._animationConfig.fadeInTime=0,this._animationConfig.animation=t;var n=t in this._animations?this._animations[t]:null;return null!==n&&(this._animationConfig.position=n.duration*(e>0?e:0)),this.playConfig(this._animationConfig)},i.prototype.gotoAndStopByTime=function(t,e){void 0===e&&(e=0);var i=this.gotoAndPlayByTime(t,e,1);return null!==i&&i.stop(),i},i.prototype.gotoAndStopByFrame=function(t,e){void 0===e&&(e=0);var i=this.gotoAndPlayByFrame(t,e,1);return null!==i&&i.stop(),i},i.prototype.gotoAndStopByProgress=function(t,e){void 0===e&&(e=0);var i=this.gotoAndPlayByProgress(t,e,1);return null!==i&&i.stop(),i},i.prototype.getState=function(t){for(var e=this._animationStates.length;e--;){var i=this._animationStates[e];if(i.name===t)return i}return null},i.prototype.hasAnimation=function(t){return t in this._animations},i.prototype.getStates=function(){return this._animationStates},Object.defineProperty(i.prototype,"isPlaying",{get:function(){for(var t=0,e=this._animationStates;t<e.length;t++)if(e[t].isPlaying)return!0;return!1},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"isCompleted",{get:function(){for(var t=0,e=this._animationStates;t<e.length;t++)if(!e[t].isCompleted)return!1;return this._animationStates.length>0},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"lastAnimationName",{get:function(){return null!==this._lastAnimationState?this._lastAnimationState.name:""},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"animationNames",{get:function(){return this._animationNames},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"animations",{get:function(){return this._animations},set:function(t){if(this._animations!==t){for(var e in this._animationNames.length=0,this._animations)delete this._animations[e];for(var e in t)this._animationNames.push(e),this._animations[e]=t[e]}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"animationConfig",{get:function(){return this._animationConfig.clear(),this._animationConfig},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"lastAnimationState",{get:function(){return this._lastAnimationState},enumerable:!0,configurable:!0}),i.prototype.gotoAndPlay=function(t,e,i,n,r,s,a){void 0===e&&(e=-1),void 0===i&&(i=-1),void 0===n&&(n=-1),void 0===r&&(r=0),void 0===s&&(s=null),void 0===a&&(a=3),console.warn("Deprecated."),this._animationConfig.clear(),this._animationConfig.resetToPose=!0,this._animationConfig.fadeOutMode=a,this._animationConfig.playTimes=n,this._animationConfig.layer=r,this._animationConfig.fadeInTime=e,this._animationConfig.animation=t,this._animationConfig.group=null!==s?s:"";var o=this._animations[t];return o&&i>0&&(this._animationConfig.timeScale=o.duration/i),this.playConfig(this._animationConfig)},i.prototype.gotoAndStop=function(t,e){return void 0===e&&(e=0),console.warn("Deprecated."),this.gotoAndStopByTime(t,e)},Object.defineProperty(i.prototype,"animationList",{get:function(){return console.warn("Deprecated."),this._animationNames},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"animationDataList",{get:function(){console.warn("Deprecated.");for(var t=[],e=0,i=this._animationNames.length;e<i;++e)t.push(this._animations[this._animationNames[e]]);return t},enumerable:!0,configurable:!0}),i}(t.BaseObject);t.Animation=e}(HZ||(HZ={})),function(t){var e=function(e){function r(){var t=null!==e&&e.apply(this,arguments)||this;return t._blendState=new n,t._boneMask=[],t._boneTimelines=[],t._surfaceTimelines=[],t._slotTimelines=[],t._constraintTimelines=[],t._animationTimelines=[],t._poseTimelines=[],t._bonePoses={},t._actionTimeline=null,t._zOrderTimeline=null,t._parent=null,t}return zZ(r,e),r.toString=function(){return"[class dragonBones.AnimationState]"},r.prototype._onClear=function(){for(var t=0,e=this._boneTimelines;t<e.length;t++)e[t].returnToPool();for(var i=0,n=this._surfaceTimelines;i<n.length;i++)n[i].returnToPool();for(var r=0,s=this._slotTimelines;r<s.length;r++)s[r].returnToPool();for(var a=0,o=this._constraintTimelines;a<o.length;a++)o[a].returnToPool();for(var h=0,u=this._animationTimelines;h<u.length;h++)u[h].returnToPool();for(var l in this._bonePoses)this._bonePoses[l].returnToPool(),delete this._bonePoses[l];null!==this._actionTimeline&&this._actionTimeline.returnToPool(),null!==this._zOrderTimeline&&this._zOrderTimeline.returnToPool(),this.actionEnabled=!1,this.additiveBlending=!1,this.displayControl=!1,this.resetToPose=!1,this.playTimes=1,this.layer=0,this.timeScale=1,this.weight=1,this.autoFadeOutTime=0,this.fadeTotalTime=0,this.name="",this.group="",this._timelineDirty=2,this._playheadState=0,this._fadeState=-1,this._subFadeState=-1,this._position=0,this._duration=0,this._fadeTime=0,this._time=0,this._fadeProgress=0,this._weightResult=0,this._blendState.clear(),this._boneMask.length=0,this._boneTimelines.length=0,this._surfaceTimelines.length=0,this._slotTimelines.length=0,this._constraintTimelines.length=0,this._animationTimelines.length=0,this._poseTimelines.length=0,this._animationData=null,this._armature=null,this._actionTimeline=null,this._zOrderTimeline=null,this._parent=null},r.prototype._updateTimelines=function(){for(var e=0,i=this._armature._constraints;e<i.length;e++){var n=i[e];if(null!==(h=this._animationData.getConstraintTimelines(n.name)))for(var r=0,s=h;r<s.length;r++)switch((_=s[r]).type){case 30:(f=t.BaseObject.borrowObject(t.IKConstraintTimelineState)).constraint=n,f.init(this._armature,this,_),this._constraintTimelines.push(f)}else this.resetToPose&&((f=t.BaseObject.borrowObject(t.IKConstraintTimelineState)).constraint=n,f.init(this._armature,this,null),this._constraintTimelines.push(f),this._poseTimelines.push(f))}for(var a=0,o=this._armature.animation.getStates();a<o.length;a++){var h,u=o[a];if(u._parent===this&&null!==(h=this._animationData.getAnimationTimelines(u.name)))for(var l=0,c=h;l<c.length;l++){var _;switch((_=c[l]).type){case 40:var f;(f=t.BaseObject.borrowObject(t.AnimationTimelineState)).animationState=u,f.init(this._armature,this,_),this._animationTimelines.push(f)}}}},r.prototype._updateBoneAndSlotTimelines=function(){for(var e={},n=0,r=this._boneTimelines;n<r.length;n++)(h=(y=r[n]).bone.name)in e||(e[h]=[]),e[h].push(y);for(var s=0,a=this._armature.getBones();s<a.length;s++){var o=a[s],h=o.name;if(this.containsBoneMask(h))if(h in e)delete e[h];else if(0===o._boneData.type){var u=this._animationData.getBoneTimelines(h),l=h in this._bonePoses?this._bonePoses[h]:this._bonePoses[h]=t.BaseObject.borrowObject(i);if(null!==u)for(var c=0,_=u;c<_.length;c++)switch((D=_[c]).type){case 10:(y=t.BaseObject.borrowObject(t.BoneAllTimelineState)).bone=o,y.bonePose=l,y.init(this._armature,this,D),this._boneTimelines.push(y);break;case 11:(y=t.BaseObject.borrowObject(t.BoneTranslateTimelineState)).bone=o,y.bonePose=l,y.init(this._armature,this,D),this._boneTimelines.push(y);break;case 12:(y=t.BaseObject.borrowObject(t.BoneRotateTimelineState)).bone=o,y.bonePose=l,y.init(this._armature,this,D),this._boneTimelines.push(y);break;case 13:(y=t.BaseObject.borrowObject(t.BoneScaleTimelineState)).bone=o,y.bonePose=l,y.init(this._armature,this,D),this._boneTimelines.push(y)}else this.resetToPose&&((y=t.BaseObject.borrowObject(t.BoneAllTimelineState)).bone=o,y.bonePose=l,y.init(this._armature,this,null),this._boneTimelines.push(y),this._poseTimelines.push(y))}else if(1===o._boneData.type)if(null!==(u=this._animationData.getSurfaceTimelines(h)))for(var f=0,d=u;f<d.length;f++)switch((D=d[f]).type){case 50:(y=t.BaseObject.borrowObject(t.SurfaceTimelineState)).surface=o,y.init(this._armature,this,D),this._surfaceTimelines.push(y)}else this.resetToPose&&((y=t.BaseObject.borrowObject(t.SurfaceTimelineState)).surface=o,y.init(this._armature,this,null),this._surfaceTimelines.push(y),this._poseTimelines.push(y))}for(var p in e)for(var m=0,g=e[p];m<g.length;m++){var y=g[m];this._boneTimelines.splice(this._boneTimelines.indexOf(y),1),y.returnToPool()}for(var v={},S=[],A=0,T=this._slotTimelines;A<T.length;A++)(h=(y=T[A]).slot.name)in v||(v[h]=[]),v[h].push(y);for(var E=0,b=this._armature.getSlots();E<b.length;E++){var x=b[E],C=x.parent.name;if(this.containsBoneMask(C))if(h=x.name,u=this._animationData.getSlotTimelines(h),h in v)delete v[h];else{var R=!1,w=!1;if(S.length=0,null!==u)for(var I=0,B=u;I<B.length;I++){var D;switch((D=B[I]).type){case 20:(y=t.BaseObject.borrowObject(t.SlotDislayTimelineState)).slot=x,y.init(this._armature,this,D),this._slotTimelines.push(y),R=!0;break;case 21:(y=t.BaseObject.borrowObject(t.SlotColorTimelineState)).slot=x,y.init(this._armature,this,D),this._slotTimelines.push(y),w=!0;break;case 22:(y=t.BaseObject.borrowObject(t.DeformTimelineState)).slot=x,y.init(this._armature,this,D),this._slotTimelines.push(y),S.push(y.vertexOffset)}}if(this.resetToPose&&(R||((y=t.BaseObject.borrowObject(t.SlotDislayTimelineState)).slot=x,y.init(this._armature,this,null),this._slotTimelines.push(y),this._poseTimelines.push(y)),w||((y=t.BaseObject.borrowObject(t.SlotColorTimelineState)).slot=x,y.init(this._armature,this,null),this._slotTimelines.push(y),this._poseTimelines.push(y)),null!==x.rawDisplayDatas))for(var P=0,O=x.rawDisplayDatas;P<O.length;P++){var M=O[P];if(null!==M&&2===M.type){var N=M.vertices.offset;S.indexOf(N)<0&&((y=t.BaseObject.borrowObject(t.DeformTimelineState)).vertexOffset=N,y.slot=x,y.init(this._armature,this,null),this._slotTimelines.push(y),this._poseTimelines.push(y))}}}}for(var p in v)for(var L=0,F=v[p];L<F.length;L++)y=F[L],this._slotTimelines.splice(this._slotTimelines.indexOf(y),1),y.returnToPool()},r.prototype._advanceFadeTime=function(e){var i,n=this._fadeState>0;if(this._subFadeState<0){this._subFadeState=0;var r=n?t.EventObject.FADE_OUT:t.EventObject.FADE_IN;this._armature.eventDispatcher.hasDBEventListener(r)&&((i=t.BaseObject.borrowObject(t.EventObject)).type=r,i.armature=this._armature,i.animationState=this,this._armature._dragonBones.bufferEvent(i))}(e<0&&(e=-e),this._fadeTime+=e,this._fadeTime>=this.fadeTotalTime?(this._subFadeState=1,this._fadeProgress=n?0:1):this._fadeTime>0?this._fadeProgress=n?1-this._fadeTime/this.fadeTotalTime:this._fadeTime/this.fadeTotalTime:this._fadeProgress=n?1:0,this._subFadeState>0)&&(n||(this._playheadState|=1,this._fadeState=0),r=n?t.EventObject.FADE_OUT_COMPLETE:t.EventObject.FADE_IN_COMPLETE,this._armature.eventDispatcher.hasDBEventListener(r)&&((i=t.BaseObject.borrowObject(t.EventObject)).type=r,i.armature=this._armature,i.animationState=this,this._armature._dragonBones.bufferEvent(i)))},r.prototype.init=function(e,i,n){if(null===this._armature){if(this._armature=e,this._animationData=i,this.resetToPose=n.resetToPose,this.additiveBlending=n.additiveBlending,this.displayControl=n.displayControl,this.actionEnabled=n.actionEnabled,this.layer=n.layer,this.playTimes=n.playTimes,this.timeScale=n.timeScale,this.fadeTotalTime=n.fadeInTime,this.autoFadeOutTime=n.autoFadeOutTime,this.weight=n.weight,this.name=n.name.length>0?n.name:n.animation,this.group=n.group,n.pauseFadeIn?this._playheadState=2:this._playheadState=3,n.duration<0?(this._position=0,this._duration=this._animationData.duration,0!==n.position?this.timeScale>=0?this._time=n.position:this._time=n.position-this._duration:this._time=0):(this._position=n.position,this._duration=n.duration,this._time=0),this.timeScale<0&&0===this._time&&(this._time=-1e-6),this.fadeTotalTime<=0&&(this._fadeProgress=.999999),n.boneMask.length>0){this._boneMask.length=n.boneMask.length;for(var r=0,s=this._boneMask.length;r<s;++r)this._boneMask[r]=n.boneMask[r]}this._actionTimeline=t.BaseObject.borrowObject(t.ActionTimelineState),this._actionTimeline.init(this._armature,this,this._animationData.actionTimeline),this._actionTimeline.currentTime=this._time,this._actionTimeline.currentTime<0&&(this._actionTimeline.currentTime=this._duration-this._actionTimeline.currentTime),null!==this._animationData.zOrderTimeline&&(this._zOrderTimeline=t.BaseObject.borrowObject(t.ZOrderTimelineState),this._zOrderTimeline.init(this._armature,this,this._animationData.zOrderTimeline))}},r.prototype.advanceTime=function(e,i){if(this._blendState.dirty=!1,0===this._fadeState&&0===this._subFadeState||this._advanceFadeTime(e),3===this._playheadState&&(1!==this.timeScale&&(e*=this.timeScale),this._time+=e),0!==this._timelineDirty&&(2===this._timelineDirty&&this._updateTimelines(),this._timelineDirty=0,this._updateBoneAndSlotTimelines()),0!==this.weight){var n=0===this._fadeState&&i>0,r=!0,s=!0,a=this._time;if(this._weightResult=this.weight*this._fadeProgress,null!==this._parent&&(this._weightResult*=this._parent._weightResult/this._parent._fadeProgress),this._actionTimeline.playState<=0&&this._actionTimeline.update(a),n){var o=2*i;this._actionTimeline.currentTime=Math.floor(this._actionTimeline.currentTime*o)/o}if(null!==this._zOrderTimeline&&this._zOrderTimeline.playState<=0&&this._zOrderTimeline.update(a),n){var h=Math.floor(this._actionTimeline.currentTime*i);this._armature._cacheFrameIndex===h?(r=!1,s=!1):(this._armature._cacheFrameIndex=h,this._animationData.cachedFrames[h]?s=!1:this._animationData.cachedFrames[h]=!0)}if(r){if(s)for(var u=0,l=this._boneTimelines.length;u<l;++u)(p=this._boneTimelines[u]).playState<=0&&p.update(a),(u===l-1||p.bone!==this._boneTimelines[u+1].bone)&&0!==(c=p.bone._blendState.update(this._weightResult,this.layer))&&p.blend(c);for(u=0,l=this._surfaceTimelines.length;u<l;++u){var c=(p=this._surfaceTimelines[u]).surface._blendState.update(this._weightResult,this.layer);p.playState<=0&&p.update(a),0!==c&&p.blend(c)}if(this.displayControl)for(u=0,l=this._slotTimelines.length;u<l;++u){var _=(p=this._slotTimelines[u]).slot.displayController;null!==_&&_!==this.name&&_!==this.group||p.playState<=0&&p.update(a)}for(u=0,l=this._constraintTimelines.length;u<l;++u)(p=this._constraintTimelines[u]).playState<=0&&p.update(a);for(u=0,l=this._animationTimelines.length;u<l;++u)c=(p=this._animationTimelines[u]).animationState._blendState.update(this._weightResult,this.layer),p.playState<=0&&p.update(a),0!==c&&p.blend(c)}if(0===this._fadeState){if(this._subFadeState>0&&(this._subFadeState=0,this._poseTimelines.length>0)){for(var f=0,d=this._poseTimelines;f<d.length;f++){var p;(p=d[f])instanceof t.BoneTimelineState?this._boneTimelines.splice(this._boneTimelines.indexOf(p),1):p instanceof t.SurfaceTimelineState?this._surfaceTimelines.splice(this._surfaceTimelines.indexOf(p),1):p instanceof t.SlotTimelineState?this._slotTimelines.splice(this._slotTimelines.indexOf(p),1):p instanceof t.ConstraintTimelineState&&this._constraintTimelines.splice(this._constraintTimelines.indexOf(p),1),p.returnToPool()}this._poseTimelines.length=0}this._actionTimeline.playState>0&&this.autoFadeOutTime>=0&&this.fadeOut(this.autoFadeOutTime)}}},r.prototype.play=function(){this._playheadState=3},r.prototype.stop=function(){this._playheadState&=1},r.prototype.fadeOut=function(t,e){if(void 0===e&&(e=!0),t<0&&(t=0),e&&(this._playheadState&=2),this._fadeState>0){if(t>this.fadeTotalTime-this._fadeTime)return}else{this._fadeState=1,this._subFadeState=-1,(t<=0||this._fadeProgress<=0)&&(this._fadeProgress=1e-6);for(var i=0,n=this._boneTimelines;i<n.length;i++)(_=n[i]).fadeOut();for(var r=0,s=this._surfaceTimelines;r<s.length;r++)(_=s[r]).fadeOut();for(var a=0,o=this._slotTimelines;a<o.length;a++)(_=o[a]).fadeOut();for(var h=0,u=this._constraintTimelines;h<u.length;h++)(_=u[h]).fadeOut();for(var l=0,c=this._animationTimelines;l<c.length;l++){var _;(_=c[l]).animationState.fadeOut(t,e),_.fadeOut()}}this.displayControl=!1,this.fadeTotalTime=this._fadeProgress>1e-6?t/this._fadeProgress:0,this._fadeTime=this.fadeTotalTime*(1-this._fadeProgress)},r.prototype.containsBoneMask=function(t){return 0===this._boneMask.length||this._boneMask.indexOf(t)>=0},r.prototype.addBoneMask=function(t,e){void 0===e&&(e=!0);var i=this._armature.getBone(t);if(null!==i){if(this._boneMask.indexOf(t)<0&&this._boneMask.push(t),e)for(var n=0,r=this._armature.getBones();n<r.length;n++){var s=r[n];this._boneMask.indexOf(s.name)<0&&i.contains(s)&&this._boneMask.push(s.name)}this._timelineDirty=1}},r.prototype.removeBoneMask=function(t,e){void 0===e&&(e=!0);var i=this._boneMask.indexOf(t);if(i>=0&&this._boneMask.splice(i,1),e){var n=this._armature.getBone(t);if(null!==n){var r=this._armature.getBones();if(this._boneMask.length>0)for(var s=0,a=r;s<a.length;s++){var o=a[s],h=this._boneMask.indexOf(o.name);h>=0&&n.contains(o)&&this._boneMask.splice(h,1)}else for(var u=0,l=r;u<l.length;u++)(o=l[u])!==n&&(n.contains(o)||this._boneMask.push(o.name))}}this._timelineDirty=1},r.prototype.removeAllBoneMask=function(){this._boneMask.length=0,this._timelineDirty=1},Object.defineProperty(r.prototype,"isFadeIn",{get:function(){return this._fadeState<0},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"isFadeOut",{get:function(){return this._fadeState>0},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"isFadeComplete",{get:function(){return 0===this._fadeState},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"isPlaying",{get:function(){return 0!=(2&this._playheadState)&&this._actionTimeline.playState<=0},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"isCompleted",{get:function(){return this._actionTimeline.playState>0},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"currentPlayTimes",{get:function(){return this._actionTimeline.currentPlayTimes},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"totalTime",{get:function(){return this._duration},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"currentTime",{get:function(){return this._actionTimeline.currentTime},set:function(t){var e=this._actionTimeline.currentPlayTimes-(this._actionTimeline.playState>0?1:0);if((t<0||this._duration<t)&&(t=t%this._duration+e*this._duration)<0&&(t+=this._duration),this.playTimes>0&&e===this.playTimes-1&&t===this._duration&&(t=this._duration-1e-6),this._time!==t){this._time=t,this._actionTimeline.setCurrentTime(this._time),null!==this._zOrderTimeline&&(this._zOrderTimeline.playState=-1);for(var i=0,n=this._boneTimelines;i<n.length;i++)n[i].playState=-1;for(var r=0,s=this._slotTimelines;r<s.length;r++)s[r].playState=-1}},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"animationData",{get:function(){return this._animationData},enumerable:!0,configurable:!0}),r}(t.BaseObject);t.AnimationState=e;var i=function(e){function i(){var i=null!==e&&e.apply(this,arguments)||this;return i.current=new t.Transform,i.delta=new t.Transform,i.result=new t.Transform,i}return zZ(i,e),i.toString=function(){return"[class dragonBones.BonePose]"},i.prototype._onClear=function(){this.current.identity(),this.delta.identity(),this.result.identity()},i}(t.BaseObject);t.BonePose=i;var n=function(){function t(){}return t.prototype.update=function(t,e){if(this.dirty){if(!(this.leftWeight>0))return 0;if(this.layer!==e){if(this.layerWeight>=this.leftWeight)return this.leftWeight=0,0;this.layer=e,this.leftWeight-=this.layerWeight,this.layerWeight=0}return t*=this.leftWeight,this.layerWeight+=t,this.blendWeight=t,2}return this.dirty=!0,this.layer=e,this.layerWeight=t,this.leftWeight=1,this.blendWeight=t,1},t.prototype.clear=function(){this.dirty=!1,this.layer=0,this.leftWeight=0,this.layerWeight=0,this.blendWeight=0},t}();t.BlendState=n}(HZ||(HZ={})),function(t){var e=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return zZ(e,t),e.prototype._onClear=function(){this.playState=-1,this.currentPlayTimes=-1,this.currentTime=-1,this._tweenState=0,this._frameRate=0,this._frameValueOffset=0,this._frameCount=0,this._frameOffset=0,this._frameIndex=-1,this._frameRateR=0,this._position=0,this._duration=0,this._timeScale=1,this._timeOffset=0,this._dragonBonesData=null,this._animationData=null,this._timelineData=null,this._armature=null,this._animationState=null,this._actionTimeline=null,this._frameArray=null,this._frameIntArray=null,this._frameFloatArray=null,this._timelineArray=null,this._frameIndices=null},e.prototype._setCurrentTime=function(t){var e=this.playState,i=this.currentPlayTimes,n=this.currentTime;if(null!==this._actionTimeline&&this._frameCount<=1)this.playState=this._actionTimeline.playState>=0?1:-1,this.currentPlayTimes=1,this.currentTime=this._actionTimeline.currentTime;else if(null===this._actionTimeline||1!==this._timeScale||0!==this._timeOffset){var r=this._animationState.playTimes,s=r*this._duration;t*=this._timeScale,0!==this._timeOffset&&(t+=this._timeOffset*this._animationData.duration),r>0&&(t>=s||t<=-s)?(this.playState<=0&&3===this._animationState._playheadState&&(this.playState=1),this.currentPlayTimes=r,this.currentTime=t<0?0:this._duration+1e-6):(0!==this.playState&&3===this._animationState._playheadState&&(this.playState=0),t<0?(t=-t,this.currentPlayTimes=Math.floor(t/this._duration),this.currentTime=this._duration-t%this._duration):(this.currentPlayTimes=Math.floor(t/this._duration),this.currentTime=t%this._duration)),this.currentTime+=this._position}else this.playState=this._actionTimeline.playState,this.currentPlayTimes=this._actionTimeline.currentPlayTimes,this.currentTime=this._actionTimeline.currentTime;return(this.currentPlayTimes!==i||this.currentTime!==n)&&((e<0&&this.playState!==e||this.playState<=0&&this.currentPlayTimes!==i)&&(this._frameIndex=-1),!0)},e.prototype.init=function(t,e,i){this._armature=t,this._animationState=e,this._timelineData=i,this._actionTimeline=this._animationState._actionTimeline,this===this._actionTimeline&&(this._actionTimeline=null),this._animationData=this._animationState._animationData,this._frameRate=this._animationData.parent.frameRate,this._frameRateR=1/this._frameRate,this._position=this._animationState._position,this._duration=this._animationState._duration,this._dragonBonesData=this._animationData.parent.parent,null!==this._timelineData&&(this._frameIntArray=this._dragonBonesData.frameIntArray,this._frameFloatArray=this._dragonBonesData.frameFloatArray,this._frameArray=this._dragonBonesData.frameArray,this._timelineArray=this._dragonBonesData.timelineArray,this._frameIndices=this._dragonBonesData.frameIndices,this._frameCount=this._timelineArray[this._timelineData.offset+2],this._frameValueOffset=this._timelineArray[this._timelineData.offset+4],this._timeScale=100/this._timelineArray[this._timelineData.offset+0],this._timeOffset=.01*this._timelineArray[this._timelineData.offset+1])},e.prototype.fadeOut=function(){},e.prototype.update=function(t){if(this._setCurrentTime(t)){if(this._frameCount>1){var e=Math.floor(this.currentTime*this._frameRate),i=this._frameIndices[this._timelineData.frameIndicesOffset+e];this._frameIndex!==i&&(this._frameIndex=i,this._frameOffset=this._animationData.frameOffset+this._timelineArray[this._timelineData.offset+5+this._frameIndex],this._onArriveAtFrame())}else this._frameIndex<0&&(this._frameIndex=0,null!==this._timelineData&&(this._frameOffset=this._animationData.frameOffset+this._timelineArray[this._timelineData.offset+5]),this._onArriveAtFrame());0!==this._tweenState&&this._onUpdateFrame()}},e}(t.BaseObject);t.TimelineState=e;var i=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return zZ(e,t),e._getEasingValue=function(t,e,i){var n=e;switch(t){case 3:n=Math.pow(e,2);break;case 4:n=1-Math.pow(1-e,2);break;case 5:n=.5*(1-Math.cos(e*Math.PI))}return(n-e)*i+e},e._getEasingCurveValue=function(t,e,i,n){if(t<=0)return 0;if(t>=1)return 1;var r=i+1,s=Math.floor(t*r),a=0===s?0:e[n+s-1];return 1e-4*(a+((s===r-1?1e4:e[n+s])-a)*(t*r-s))},e.prototype._onClear=function(){t.prototype._onClear.call(this),this._tweenType=0,this._curveCount=0,this._framePosition=0,this._frameDurationR=0,this._tweenProgress=0,this._tweenEasing=0},e.prototype._onArriveAtFrame=function(){if(this._frameCount>1&&(this._frameIndex!==this._frameCount-1||0===this._animationState.playTimes||this._animationState.currentPlayTimes<this._animationState.playTimes-1))if(this._tweenType=this._frameArray[this._frameOffset+1],this._tweenState=0===this._tweenType?1:2,2===this._tweenType?this._curveCount=this._frameArray[this._frameOffset+2]:0!==this._tweenType&&1!==this._tweenType&&(this._tweenEasing=.01*this._frameArray[this._frameOffset+2]),this._framePosition=this._frameArray[this._frameOffset]*this._frameRateR,this._frameIndex===this._frameCount-1)this._frameDurationR=1/(this._animationData.duration-this._framePosition);else{var t=this._animationData.frameOffset+this._timelineArray[this._timelineData.offset+5+this._frameIndex+1],e=this._frameArray[t]*this._frameRateR-this._framePosition;this._frameDurationR=e>0?1/e:0}else this._tweenState=1},e.prototype._onUpdateFrame=function(){2===this._tweenState?(this._tweenProgress=(this.currentTime-this._framePosition)*this._frameDurationR,2===this._tweenType?this._tweenProgress=e._getEasingCurveValue(this._tweenProgress,this._frameArray,this._curveCount,this._frameOffset+3):1!==this._tweenType&&(this._tweenProgress=e._getEasingValue(this._tweenType,this._tweenProgress,this._tweenEasing))):this._tweenProgress=0},e}(e);t.TweenTimelineState=i;var n=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return zZ(e,t),e.prototype._onClear=function(){t.prototype._onClear.call(this),this.bone=null,this.bonePose=null},e.prototype.blend=function(t){var e=this.bone._blendState.blendWeight,i=this.bone.animationPose,n=this.bonePose.result;2===t?(i.x+=n.x*e,i.y+=n.y*e,i.rotation+=n.rotation*e,i.skew+=n.skew*e,i.scaleX+=(n.scaleX-1)*e,i.scaleY+=(n.scaleY-1)*e):1!==e?(i.x=n.x*e,i.y=n.y*e,i.rotation=n.rotation*e,i.skew=n.skew*e,i.scaleX=(n.scaleX-1)*e+1,i.scaleY=(n.scaleY-1)*e+1):(i.x=n.x,i.y=n.y,i.rotation=n.rotation,i.skew=n.skew,i.scaleX=n.scaleX,i.scaleY=n.scaleY),0===this._animationState._fadeState&&0===this._animationState._subFadeState||(this.bone._transformDirty=!0)},e}(i);t.BoneTimelineState=n;var r=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return zZ(e,t),e.prototype._onClear=function(){t.prototype._onClear.call(this),this.slot=null},e}(i);t.SlotTimelineState=r;var s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return zZ(e,t),e.prototype._onClear=function(){t.prototype._onClear.call(this),this.constraint=null},e}(i);t.ConstraintTimelineState=s}(HZ||(HZ={})),function(t){var e=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return zZ(i,e),i.toString=function(){return"[class dragonBones.ActionTimelineState]"},i.prototype._onCrossFrame=function(e){var i=this._armature.eventDispatcher;if(this._animationState.actionEnabled)for(var n=this._animationData.frameOffset+this._timelineArray[this._timelineData.offset+5+e],r=this._frameArray[n+1],s=this._animationData.parent.actions,a=0;a<r;++a){var o=s[this._frameArray[n+2+a]];if(0===o.type)(h=t.BaseObject.borrowObject(t.EventObject)).time=this._frameArray[n]/this._frameRate,h.animationState=this._animationState,t.EventObject.actionDataToInstance(o,h,this._armature),this._armature._bufferAction(h,!0);else{var h,u=10===o.type?t.EventObject.FRAME_EVENT:t.EventObject.SOUND_EVENT;(11===o.type||i.hasDBEventListener(u))&&((h=t.BaseObject.borrowObject(t.EventObject)).time=this._frameArray[n]/this._frameRate,h.animationState=this._animationState,t.EventObject.actionDataToInstance(o,h,this._armature),this._armature._dragonBones.bufferEvent(h))}}},i.prototype._onArriveAtFrame=function(){},i.prototype._onUpdateFrame=function(){},i.prototype.update=function(e){var i=this.playState,n=this.currentPlayTimes,r=this.currentTime;if(this._setCurrentTime(e)){var s=this._armature.eventDispatcher;if(i<0){if(this.playState===i)return;if(this._animationState.displayControl&&this._animationState.resetToPose&&this._armature._sortZOrder(null,0),n=this.currentPlayTimes,s.hasDBEventListener(t.EventObject.START)){var a=t.BaseObject.borrowObject(t.EventObject);a.type=t.EventObject.START,a.armature=this._armature,a.animationState=this._animationState,this._armature._dragonBones.bufferEvent(a)}}var o=this._animationState.timeScale<0,h=null,u=null;if(this.currentPlayTimes!==n&&(s.hasDBEventListener(t.EventObject.LOOP_COMPLETE)&&((h=t.BaseObject.borrowObject(t.EventObject)).type=t.EventObject.LOOP_COMPLETE,h.armature=this._armature,h.animationState=this._animationState),this.playState>0&&s.hasDBEventListener(t.EventObject.COMPLETE)&&((u=t.BaseObject.borrowObject(t.EventObject)).type=t.EventObject.COMPLETE,u.armature=this._armature,u.animationState=this._animationState)),this._frameCount>1){var l=this._timelineData,c=Math.floor(this.currentTime*this._frameRate),_=this._frameIndices[l.frameIndicesOffset+c];if(this._frameIndex!==_){var f=this._frameIndex;if(this._frameIndex=_,null!==this._timelineArray)if(this._frameOffset=this._animationData.frameOffset+this._timelineArray[l.offset+5+this._frameIndex],o){if(f<0){var d=Math.floor(r*this._frameRate);f=this._frameIndices[l.frameIndicesOffset+d],this.currentPlayTimes===n&&f===_&&(f=-1)}for(;f>=0;){var p=this._animationData.frameOffset+this._timelineArray[l.offset+5+f],m=this._frameArray[p]/this._frameRate;if(this._position<=m&&m<=this._position+this._duration&&this._onCrossFrame(f),null!==h&&0===f&&(this._armature._dragonBones.bufferEvent(h),h=null),f>0?f--:f=this._frameCount-1,f===_)break}}else for(f<0&&(d=Math.floor(r*this._frameRate),f=this._frameIndices[l.frameIndicesOffset+d],p=this._animationData.frameOffset+this._timelineArray[l.offset+5+f],m=this._frameArray[p]/this._frameRate,this.currentPlayTimes===n&&(r<=m?f>0?f--:f=this._frameCount-1:f===_&&(f=-1)));f>=0&&(f<this._frameCount-1?f++:f=0,p=this._animationData.frameOffset+this._timelineArray[l.offset+5+f],m=this._frameArray[p]/this._frameRate,this._position<=m&&m<=this._position+this._duration&&this._onCrossFrame(f),null!==h&&0===f&&(this._armature._dragonBones.bufferEvent(h),h=null),f!==_););}}else this._frameIndex<0&&(this._frameIndex=0,null!==this._timelineData)&&(this._frameOffset=this._animationData.frameOffset+this._timelineArray[this._timelineData.offset+5],m=this._frameArray[this._frameOffset]/this._frameRate,this.currentPlayTimes===n?r<=m&&this._onCrossFrame(this._frameIndex):this._position<=m&&(o||null===h||(this._armature._dragonBones.bufferEvent(h),h=null),this._onCrossFrame(this._frameIndex)));null!==h&&this._armature._dragonBones.bufferEvent(h),null!==u&&this._armature._dragonBones.bufferEvent(u)}},i.prototype.setCurrentTime=function(t){this._setCurrentTime(t),this._frameIndex=-1},i}(t.TimelineState);t.ActionTimelineState=e;var i=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return zZ(e,t),e.toString=function(){return"[class dragonBones.ZOrderTimelineState]"},e.prototype._onArriveAtFrame=function(){this.playState>=0&&(this._frameArray[this._frameOffset+1]>0?this._armature._sortZOrder(this._frameArray,this._frameOffset+2):this._armature._sortZOrder(null,0))},e.prototype._onUpdateFrame=function(){},e}(t.TimelineState);t.ZOrderTimelineState=i;var n=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return zZ(i,e),i.toString=function(){return"[class dragonBones.BoneAllTimelineState]"},i.prototype._onArriveAtFrame=function(){if(e.prototype._onArriveAtFrame.call(this),null!==this._timelineData){var t=this._animationData.frameFloatOffset+this._frameValueOffset+6*this._frameIndex,i=this._armature._armatureData.scale,n=this._frameFloatArray,r=this.bonePose.current,s=this.bonePose.delta;r.x=n[t++]*i,r.y=n[t++]*i,r.rotation=n[t++],r.skew=n[t++],r.scaleX=n[t++],r.scaleY=n[t++],2===this._tweenState?(this._frameIndex===this._frameCount-1&&(t=this._animationData.frameFloatOffset+this._frameValueOffset),s.x=n[t++]*i-r.x,s.y=n[t++]*i-r.y,s.rotation=n[t++]-r.rotation,s.skew=n[t++]-r.skew,s.scaleX=n[t++]-r.scaleX,s.scaleY=n[t++]-r.scaleY):(s.x=0,s.y=0,s.rotation=0,s.skew=0,s.scaleX=0,s.scaleY=0)}else r=this.bonePose.current,s=this.bonePose.delta,r.x=0,r.y=0,r.rotation=0,r.skew=0,r.scaleX=1,r.scaleY=1,s.x=0,s.y=0,s.rotation=0,s.skew=0,s.scaleX=0,s.scaleY=0},i.prototype._onUpdateFrame=function(){e.prototype._onUpdateFrame.call(this);var t=this.bonePose.current,i=this.bonePose.delta,n=this.bonePose.result;this.bone._transformDirty=!0,2!==this._tweenState&&(this._tweenState=0),n.x=t.x+i.x*this._tweenProgress,n.y=t.y+i.y*this._tweenProgress,n.rotation=t.rotation+i.rotation*this._tweenProgress,n.skew=t.skew+i.skew*this._tweenProgress,n.scaleX=t.scaleX+i.scaleX*this._tweenProgress,n.scaleY=t.scaleY+i.scaleY*this._tweenProgress},i.prototype.fadeOut=function(){var e=this.bonePose.result;e.rotation=t.Transform.normalizeRadian(e.rotation),e.skew=t.Transform.normalizeRadian(e.skew)},i}(t.BoneTimelineState);t.BoneAllTimelineState=n;var r=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return zZ(e,t),e.toString=function(){return"[class dragonBones.BoneTranslateTimelineState]"},e.prototype._onArriveAtFrame=function(){if(t.prototype._onArriveAtFrame.call(this),null!==this._timelineData){var e=this._animationData.frameFloatOffset+this._frameValueOffset+2*this._frameIndex,i=this._armature._armatureData.scale,n=this._frameFloatArray,r=this.bonePose.current,s=this.bonePose.delta;r.x=n[e++]*i,r.y=n[e++]*i,2===this._tweenState?(this._frameIndex===this._frameCount-1&&(e=this._animationData.frameFloatOffset+this._frameValueOffset),s.x=n[e++]*i-r.x,s.y=n[e++]*i-r.y):(s.x=0,s.y=0)}else r=this.bonePose.current,s=this.bonePose.delta,r.x=0,r.y=0,s.x=0,s.y=0},e.prototype._onUpdateFrame=function(){t.prototype._onUpdateFrame.call(this);var e=this.bonePose.current,i=this.bonePose.delta,n=this.bonePose.result;this.bone._transformDirty=!0,2!==this._tweenState&&(this._tweenState=0),n.x=e.x+i.x*this._tweenProgress,n.y=e.y+i.y*this._tweenProgress},e}(t.BoneTimelineState);t.BoneTranslateTimelineState=r;var s=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return zZ(i,e),i.toString=function(){return"[class dragonBones.BoneRotateTimelineState]"},i.prototype._onArriveAtFrame=function(){if(e.prototype._onArriveAtFrame.call(this),null!==this._timelineData){var i=this._animationData.frameFloatOffset+this._frameValueOffset+2*this._frameIndex,n=this._frameFloatArray,r=this.bonePose.current,s=this.bonePose.delta;r.rotation=n[i++],r.skew=n[i++],2===this._tweenState?(this._frameIndex===this._frameCount-1?(i=this._animationData.frameFloatOffset+this._frameValueOffset,s.rotation=t.Transform.normalizeRadian(n[i++]-r.rotation)):s.rotation=n[i++]-r.rotation,s.skew=n[i++]-r.skew):(s.rotation=0,s.skew=0)}else r=this.bonePose.current,s=this.bonePose.delta,r.rotation=0,r.skew=0,s.rotation=0,s.skew=0},i.prototype._onUpdateFrame=function(){e.prototype._onUpdateFrame.call(this);var t=this.bonePose.current,i=this.bonePose.delta,n=this.bonePose.result;this.bone._transformDirty=!0,2!==this._tweenState&&(this._tweenState=0),n.rotation=t.rotation+i.rotation*this._tweenProgress,n.skew=t.skew+i.skew*this._tweenProgress},i.prototype.fadeOut=function(){var e=this.bonePose.result;e.rotation=t.Transform.normalizeRadian(e.rotation),e.skew=t.Transform.normalizeRadian(e.skew)},i}(t.BoneTimelineState);t.BoneRotateTimelineState=s;var a=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return zZ(e,t),e.toString=function(){return"[class dragonBones.BoneScaleTimelineState]"},e.prototype._onArriveAtFrame=function(){if(t.prototype._onArriveAtFrame.call(this),null!==this._timelineData){var e=this._animationData.frameFloatOffset+this._frameValueOffset+2*this._frameIndex,i=this._frameFloatArray,n=this.bonePose.current,r=this.bonePose.delta;n.scaleX=i[e++],n.scaleY=i[e++],2===this._tweenState?(this._frameIndex===this._frameCount-1&&(e=this._animationData.frameFloatOffset+this._frameValueOffset),r.scaleX=i[e++]-n.scaleX,r.scaleY=i[e++]-n.scaleY):(r.scaleX=0,r.scaleY=0)}else n=this.bonePose.current,r=this.bonePose.delta,n.scaleX=1,n.scaleY=1,r.scaleX=0,r.scaleY=0},e.prototype._onUpdateFrame=function(){t.prototype._onUpdateFrame.call(this);var e=this.bonePose.current,i=this.bonePose.delta,n=this.bonePose.result;this.bone._transformDirty=!0,2!==this._tweenState&&(this._tweenState=0),n.scaleX=e.scaleX+i.scaleX*this._tweenProgress,n.scaleY=e.scaleY+i.scaleY*this._tweenProgress},e}(t.BoneTimelineState);t.BoneScaleTimelineState=a;var o=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._current=[],e._delta=[],e._result=[],e}return zZ(e,t),e.toString=function(){return"[class dragonBones.SurfaceTimelineState]"},e.prototype._onClear=function(){t.prototype._onClear.call(this),this.surface=null,this._frameFloatOffset=0,this._valueCount=0,this._deformCount=0,this._valueOffset=0,this._current.length=0,this._delta.length=0,this._result.length=0},e.prototype._onArriveAtFrame=function(){if(t.prototype._onArriveAtFrame.call(this),null!==this._timelineData){var e=this._animationData.frameFloatOffset+this._frameValueOffset+this._frameIndex*this._valueCount,i=this._armature._armatureData.scale,n=this._frameFloatArray;if(2===this._tweenState){var r=e+this._valueCount;this._frameIndex===this._frameCount-1&&(r=this._animationData.frameFloatOffset+this._frameValueOffset);for(var s=0;s<this._valueCount;++s)this._delta[s]=n[r+s]*i-(this._current[s]=n[e+s]*i)}else for(s=0;s<this._valueCount;++s)this._current[s]=n[e+s]*i}else for(s=0;s<this._valueCount;++s)this._current[s]=0},e.prototype._onUpdateFrame=function(){t.prototype._onUpdateFrame.call(this),this.surface._transformDirty=!0,2!==this._tweenState&&(this._tweenState=0);for(var e=0;e<this._valueCount;++e)this._result[e]=this._current[e]+this._delta[e]*this._tweenProgress},e.prototype.init=function(e,i,n){if(t.prototype.init.call(this,e,i,n),null!==this._timelineData){var r=this._animationData.frameIntOffset+this._timelineArray[this._timelineData.offset+3];this._deformCount=this._frameIntArray[r+1],this._valueCount=this._frameIntArray[r+2],this._valueOffset=this._frameIntArray[r+3],this._frameFloatOffset=this._frameIntArray[r+4]+this._animationData.frameFloatOffset}else this._deformCount=this.surface._deformVertices.length,this._valueCount=this._deformCount,this._valueOffset=0,this._frameFloatOffset=0;this._current.length=this._valueCount,this._delta.length=this._valueCount,this._result.length=this._valueCount;for(var s=0;s<this._valueCount;++s)this._delta[s]=0},e.prototype.blend=function(t){for(var e=this.surface._blendState.blendWeight,i=this.surface._deformVertices,n=0;n<this._deformCount;++n){var r;r=n<this._valueOffset?this._frameFloatArray[this._frameFloatOffset+n]:n<this._valueOffset+this._valueCount?this._result[n-this._valueOffset]:this._frameFloatArray[this._frameFloatOffset+n-this._valueCount],2===t?i[n]+=r*e:i[n]=1!==e?r*e:r}0===this._animationState._fadeState&&0===this._animationState._subFadeState||(this.surface._transformDirty=!0)},e}(t.TweenTimelineState);t.SurfaceTimelineState=o;var h=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return zZ(e,t),e.toString=function(){return"[class dragonBones.SlotDislayTimelineState]"},e.prototype._onArriveAtFrame=function(){if(this.playState>=0){var t=null!==this._timelineData?this._frameArray[this._frameOffset+1]:this.slot._slotData.displayIndex;this.slot.displayIndex!==t&&this.slot._setDisplayIndex(t,!0)}},e}(t.SlotTimelineState);t.SlotDislayTimelineState=h;var u=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._current=[0,0,0,0,0,0,0,0],e._delta=[0,0,0,0,0,0,0,0],e._result=[0,0,0,0,0,0,0,0],e}return zZ(e,t),e.toString=function(){return"[class dragonBones.SlotColorTimelineState]"},e.prototype._onClear=function(){t.prototype._onClear.call(this),this._dirty=!1},e.prototype._onArriveAtFrame=function(){if(t.prototype._onArriveAtFrame.call(this),null!==this._timelineData){var e=this._dragonBonesData.intArray,i=this._frameIntArray,n=this._animationData.frameIntOffset+this._frameValueOffset+1*this._frameIndex,r=i[n];r<0&&(r+=65536),this._current[0]=e[r++],this._current[1]=e[r++],this._current[2]=e[r++],this._current[3]=e[r++],this._current[4]=e[r++],this._current[5]=e[r++],this._current[6]=e[r++],this._current[7]=e[r++],2===this._tweenState&&((r=this._frameIndex===this._frameCount-1?i[this._animationData.frameIntOffset+this._frameValueOffset]:i[n+1])<0&&(r+=65536),this._delta[0]=e[r++]-this._current[0],this._delta[1]=e[r++]-this._current[1],this._delta[2]=e[r++]-this._current[2],this._delta[3]=e[r++]-this._current[3],this._delta[4]=e[r++]-this._current[4],this._delta[5]=e[r++]-this._current[5],this._delta[6]=e[r++]-this._current[6],this._delta[7]=e[r++]-this._current[7])}else{var s=this.slot._slotData.color;this._current[0]=100*s.alphaMultiplier,this._current[1]=100*s.redMultiplier,this._current[2]=100*s.greenMultiplier,this._current[3]=100*s.blueMultiplier,this._current[4]=s.alphaOffset,this._current[5]=s.redOffset,this._current[6]=s.greenOffset,this._current[7]=s.blueOffset}},e.prototype._onUpdateFrame=function(){t.prototype._onUpdateFrame.call(this),this._dirty=!0,2!==this._tweenState&&(this._tweenState=0),this._result[0]=.01*(this._current[0]+this._delta[0]*this._tweenProgress),this._result[1]=.01*(this._current[1]+this._delta[1]*this._tweenProgress),this._result[2]=.01*(this._current[2]+this._delta[2]*this._tweenProgress),this._result[3]=.01*(this._current[3]+this._delta[3]*this._tweenProgress),this._result[4]=this._current[4]+this._delta[4]*this._tweenProgress,this._result[5]=this._current[5]+this._delta[5]*this._tweenProgress,this._result[6]=this._current[6]+this._delta[6]*this._tweenProgress,this._result[7]=this._current[7]+this._delta[7]*this._tweenProgress},e.prototype.fadeOut=function(){this._tweenState=0,this._dirty=!1},e.prototype.update=function(e){if(t.prototype.update.call(this,e),0!==this._tweenState||this._dirty){var i=this.slot._colorTransform;if(0!==this._animationState._fadeState||0!==this._animationState._subFadeState){if(i.alphaMultiplier!==this._result[0]||i.redMultiplier!==this._result[1]||i.greenMultiplier!==this._result[2]||i.blueMultiplier!==this._result[3]||i.alphaOffset!==this._result[4]||i.redOffset!==this._result[5]||i.greenOffset!==this._result[6]||i.blueOffset!==this._result[7]){var n=Math.pow(this._animationState._fadeProgress,4);i.alphaMultiplier+=(this._result[0]-i.alphaMultiplier)*n,i.redMultiplier+=(this._result[1]-i.redMultiplier)*n,i.greenMultiplier+=(this._result[2]-i.greenMultiplier)*n,i.blueMultiplier+=(this._result[3]-i.blueMultiplier)*n,i.alphaOffset+=(this._result[4]-i.alphaOffset)*n,i.redOffset+=(this._result[5]-i.redOffset)*n,i.greenOffset+=(this._result[6]-i.greenOffset)*n,i.blueOffset+=(this._result[7]-i.blueOffset)*n,this.slot._colorDirty=!0}}else this._dirty&&(this._dirty=!1,i.alphaMultiplier===this._result[0]&&i.redMultiplier===this._result[1]&&i.greenMultiplier===this._result[2]&&i.blueMultiplier===this._result[3]&&i.alphaOffset===this._result[4]&&i.redOffset===this._result[5]&&i.greenOffset===this._result[6]&&i.blueOffset===this._result[7]||(i.alphaMultiplier=this._result[0],i.redMultiplier=this._result[1],i.greenMultiplier=this._result[2],i.blueMultiplier=this._result[3],i.alphaOffset=this._result[4],i.redOffset=this._result[5],i.greenOffset=this._result[6],i.blueOffset=this._result[7],this.slot._colorDirty=!0))}},e}(t.SlotTimelineState);t.SlotColorTimelineState=u;var l=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._current=[],e._delta=[],e._result=[],e}return zZ(e,t),e.toString=function(){return"[class dragonBones.DeformTimelineState]"},e.prototype._onClear=function(){t.prototype._onClear.call(this),this.vertexOffset=0,this._dirty=!1,this._frameFloatOffset=0,this._valueCount=0,this._deformCount=0,this._valueOffset=0,this._current.length=0,this._delta.length=0,this._result.length=0},e.prototype._onArriveAtFrame=function(){if(t.prototype._onArriveAtFrame.call(this),null!==this._timelineData){var e=this._animationData.frameFloatOffset+this._frameValueOffset+this._frameIndex*this._valueCount,i=this._armature._armatureData.scale,n=this._frameFloatArray;if(2===this._tweenState){var r=e+this._valueCount;this._frameIndex===this._frameCount-1&&(r=this._animationData.frameFloatOffset+this._frameValueOffset);for(var s=0;s<this._valueCount;++s)this._delta[s]=n[r+s]*i-(this._current[s]=n[e+s]*i)}else for(s=0;s<this._valueCount;++s)this._current[s]=n[e+s]*i}else for(s=0;s<this._valueCount;++s)this._current[s]=0},e.prototype._onUpdateFrame=function(){t.prototype._onUpdateFrame.call(this),this._dirty=!0,2!==this._tweenState&&(this._tweenState=0);for(var e=0;e<this._valueCount;++e)this._result[e]=this._current[e]+this._delta[e]*this._tweenProgress},e.prototype.init=function(e,i,n){if(t.prototype.init.call(this,e,i,n),null!==this._timelineData){var r=this._animationData.frameIntOffset+this._timelineArray[this._timelineData.offset+3];this.vertexOffset=this._frameIntArray[r+0],this.vertexOffset<0&&(this.vertexOffset+=65536),this._deformCount=this._frameIntArray[r+1],this._valueCount=this._frameIntArray[r+2],this._valueOffset=this._frameIntArray[r+3],this._frameFloatOffset=this._frameIntArray[r+4]+this._animationData.frameFloatOffset}else{var s=this.slot._deformVertices;this._deformCount=null!==s?s.vertices.length:0,this._valueCount=this._deformCount,this._valueOffset=0,this._frameFloatOffset=0}this._current.length=this._valueCount,this._delta.length=this._valueCount,this._result.length=this._valueCount;for(var a=0;a<this._valueCount;++a)this._delta[a]=0},e.prototype.fadeOut=function(){this._tweenState=0,this._dirty=!1},e.prototype.update=function(e){var i=this.slot._deformVertices;if(null!==i&&null!==i.verticesData&&i.verticesData.offset===this.vertexOffset&&(t.prototype.update.call(this,e),0!==this._tweenState||this._dirty)){var n=i.vertices;if(0!==this._animationState._fadeState||0!==this._animationState._subFadeState){for(var r=Math.pow(this._animationState._fadeProgress,2),s=0;s<this._deformCount;++s)s<this._valueOffset?n[s]+=(this._frameFloatArray[this._frameFloatOffset+s]-n[s])*r:s<this._valueOffset+this._valueCount?n[s]+=(this._result[s-this._valueOffset]-n[s])*r:n[s]+=(this._frameFloatArray[this._frameFloatOffset+s-this._valueCount]-n[s])*r;i.verticesDirty=!0}else if(this._dirty){for(this._dirty=!1,s=0;s<this._deformCount;++s)s<this._valueOffset?n[s]=this._frameFloatArray[this._frameFloatOffset+s]:s<this._valueOffset+this._valueCount?n[s]=this._result[s-this._valueOffset]:n[s]=this._frameFloatArray[this._frameFloatOffset+s-this._valueCount];i.verticesDirty=!0}}},e}(t.SlotTimelineState);t.DeformTimelineState=l;var c=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return zZ(e,t),e.toString=function(){return"[class dragonBones.IKConstraintTimelineState]"},e.prototype._onClear=function(){t.prototype._onClear.call(this),this._current=0,this._delta=0},e.prototype._onArriveAtFrame=function(){t.prototype._onArriveAtFrame.call(this);var e=this.constraint;if(null!==this._timelineData){var i=this._animationData.frameIntOffset+this._frameValueOffset+2*this._frameIndex,n=this._frameIntArray,r=0!==n[i++];this._current=.01*n[i++],2===this._tweenState?(this._frameIndex===this._frameCount-1&&(i=this._animationData.frameIntOffset+this._frameValueOffset),this._delta=.01*n[i+1]-this._current):this._delta=0,e._bendPositive=r}else{var s=e._constraintData;this._current=s.weight,this._delta=0,e._bendPositive=s.bendPositive}e.invalidUpdate()},e.prototype._onUpdateFrame=function(){t.prototype._onUpdateFrame.call(this),2!==this._tweenState&&(this._tweenState=0);var e=this.constraint;e._weight=this._current+this._delta*this._tweenProgress,e.invalidUpdate()},e}(t.ConstraintTimelineState);t.IKConstraintTimelineState=c;var _=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._floats=[0,0,0,0,0,0],e}return zZ(e,t),e.toString=function(){return"[class dragonBones.AnimationTimelineState]"},e.prototype._onClear=function(){t.prototype._onClear.call(this),this.animationState=null},e.prototype._onArriveAtFrame=function(){if(t.prototype._onArriveAtFrame.call(this),null!==this._timelineData){var e=this._animationData.frameIntOffset+this._frameValueOffset+2*this._frameIndex,i=1/this.animationState._animationData.parent.frameRate,n=this._frameIntArray;this._floats[0]=n[e++]*i,this._floats[3]=.01*n[e++],2===this._tweenState?(this._frameIndex===this._frameCount-1&&(e=this._animationData.frameIntOffset+this._frameValueOffset),this._floats[1]=n[e++]*i-this._floats[0],this._floats[4]=.01*n[e++]-this._floats[3]):(this._floats[1]=0,this._floats[4]=0)}},e.prototype._onUpdateFrame=function(){t.prototype._onUpdateFrame.call(this),2!==this._tweenState&&(this._tweenState=0),this._floats[0]>=0&&(this._floats[2]=this._floats[0]+this._floats[1]*this._tweenProgress),this._floats[5]=this._floats[3]+this._floats[4]*this._tweenProgress},e.prototype.blend=function(t){var e=this.animationState,i=e._blendState.blendWeight;2===t?(e.weight+=this._floats[5]*i,e.currentTime+=this._floats[2]*i):(e.weight=this._floats[5]*i,e.currentTime=this._floats[2]*i)},e}(t.TweenTimelineState);t.AnimationTimelineState=_}(HZ||(HZ={})),function(t){var e=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return zZ(e,t),e.actionDataToInstance=function(t,i,n){0===t.type?i.type=e.FRAME_EVENT:i.type=10===t.type?e.FRAME_EVENT:e.SOUND_EVENT,i.name=t.name,i.armature=n,i.actionData=t,i.data=t.data,null!==t.bone&&(i.bone=n.getBone(t.bone.name)),null!==t.slot&&(i.slot=n.getSlot(t.slot.name))},e.toString=function(){return"[class dragonBones.EventObject]"},e.prototype._onClear=function(){this.time=0,this.type="",this.name="",this.armature=null,this.bone=null,this.slot=null,this.animationState=null,this.actionData=null,this.data=null},e.START="start",e.LOOP_COMPLETE="loopComplete",e.COMPLETE="complete",e.FADE_IN="fadeIn",e.FADE_IN_COMPLETE="fadeInComplete",e.FADE_OUT="fadeOut",e.FADE_OUT_COMPLETE="fadeOutComplete",e.FRAME_EVENT="frameEvent",e.SOUND_EVENT="soundEvent",e}(t.BaseObject);t.EventObject=e}(HZ||(HZ={})),function(t){var e=function(){function e(){}return e._getArmatureType=function(t){switch(t.toLowerCase()){case"stage":return 2;case"armature":return 0;case"movieclip":return 1;default:return 0}},e._getBoneType=function(t){switch(t.toLowerCase()){case"bone":return 0;case"surface":return 1;default:return 0}},e._getDisplayType=function(t){switch(t.toLowerCase()){case"image":return 0;case"mesh":return 2;case"armature":return 1;case"boundingbox":return 3;case"path":return 4;default:return 0}},e._getBoundingBoxType=function(t){switch(t.toLowerCase()){case"rectangle":return 0;case"ellipse":return 1;case"polygon":return 2;default:return 0}},e._getActionType=function(t){switch(t.toLowerCase()){case"play":return 0;case"frame":return 10;case"sound":return 11;default:return 0}},e._getBlendMode=function(t){switch(t.toLowerCase()){case"normal":return 0;case"add":return 1;case"alpha":return 2;case"darken":return 3;case"difference":return 4;case"erase":return 5;case"hardlight":return 6;case"invert":return 7;case"layer":return 8;case"lighten":return 9;case"multiply":return 10;case"overlay":return 11;case"screen":return 12;case"subtract":return 13;default:return 0}},e._getPositionMode=function(t){switch(t.toLocaleLowerCase()){case"percent":return 1;case"fixed":return 0;default:return 1}},e._getSpacingMode=function(t){switch(t.toLocaleLowerCase()){case"length":return 0;case"percent":return 2;case"fixed":return 1;default:return 0}},e._getRotateMode=function(t){switch(t.toLocaleLowerCase()){case"tangent":return 0;case"chain":return 1;case"chainscale":return 2;default:return 0}},e.parseDragonBonesData=function(e){return console.warn("Deprecated."),e instanceof ArrayBuffer?t.BinaryDataParser.getInstance().parseDragonBonesData(e):t.ObjectDataParser.getInstance().parseDragonBonesData(e)},e.parseTextureAtlasData=function(i,n){void 0===n&&(n=1),console.warn("已废弃");for(var r={},s=i[e.SUB_TEXTURE],a=0,o=s.length;a<o;a++){var h=s[a],u=h[e.NAME],l=new t.Rectangle,c=null;l.x=h[e.X]/n,l.y=h[e.Y]/n,l.width=h[e.WIDTH]/n,l.height=h[e.HEIGHT]/n,e.FRAME_WIDTH in h&&((c=new t.Rectangle).x=h[e.FRAME_X]/n,c.y=h[e.FRAME_Y]/n,c.width=h[e.FRAME_WIDTH]/n,c.height=h[e.FRAME_HEIGHT]/n),r[u]={region:l,frame:c,rotated:!1}}return r},e.DATA_VERSION_2_3="2.3",e.DATA_VERSION_3_0="3.0",e.DATA_VERSION_4_0="4.0",e.DATA_VERSION_4_5="4.5",e.DATA_VERSION_5_0="5.0",e.DATA_VERSION_5_5="5.5",e.DATA_VERSION=e.DATA_VERSION_5_5,e.DATA_VERSIONS=[e.DATA_VERSION_4_0,e.DATA_VERSION_4_5,e.DATA_VERSION_5_0,e.DATA_VERSION_5_5],e.TEXTURE_ATLAS="textureAtlas",e.SUB_TEXTURE="SubTexture",e.FORMAT="format",e.IMAGE_PATH="imagePath",e.WIDTH="width",e.HEIGHT="height",e.ROTATED="rotated",e.FRAME_X="frameX",e.FRAME_Y="frameY",e.FRAME_WIDTH="frameWidth",e.FRAME_HEIGHT="frameHeight",e.DRADON_BONES="dragonBones",e.USER_DATA="userData",e.ARMATURE="armature",e.BONE="bone",e.SURFACE="surface",e.SLOT="slot",e.CONSTRAINT="constraint",e.IK="ik",e.PATH_CONSTRAINT="path",e.SKIN="skin",e.DISPLAY="display",e.ANIMATION="animation",e.Z_ORDER="zOrder",e.FFD="ffd",e.FRAME="frame",e.TRANSLATE_FRAME="translateFrame",e.ROTATE_FRAME="rotateFrame",e.SCALE_FRAME="scaleFrame",e.DISPLAY_FRAME="displayFrame",e.COLOR_FRAME="colorFrame",e.DEFAULT_ACTIONS="defaultActions",e.ACTIONS="actions",e.EVENTS="events",e.INTS="ints",e.FLOATS="floats",e.STRINGS="strings",e.CANVAS="canvas",e.TRANSFORM="transform",e.PIVOT="pivot",e.AABB="aabb",e.COLOR="color",e.VERSION="version",e.COMPATIBLE_VERSION="compatibleVersion",e.FRAME_RATE="frameRate",e.TYPE="type",e.SUB_TYPE="subType",e.NAME="name",e.PARENT="parent",e.TARGET="target",e.STAGE="stage",e.SHARE="share",e.PATH="path",e.LENGTH="length",e.DISPLAY_INDEX="displayIndex",e.BLEND_MODE="blendMode",e.INHERIT_TRANSLATION="inheritTranslation",e.INHERIT_ROTATION="inheritRotation",e.INHERIT_SCALE="inheritScale",e.INHERIT_REFLECTION="inheritReflection",e.INHERIT_ANIMATION="inheritAnimation",e.INHERIT_DEFORM="inheritDeform",e.SEGMENT_X="segmentX",e.SEGMENT_Y="segmentY",e.BEND_POSITIVE="bendPositive",e.CHAIN="chain",e.WEIGHT="weight",e.FADE_IN_TIME="fadeInTime",e.PLAY_TIMES="playTimes",e.SCALE="scale",e.OFFSET="offset",e.POSITION="position",e.DURATION="duration",e.TWEEN_EASING="tweenEasing",e.TWEEN_ROTATE="tweenRotate",e.TWEEN_SCALE="tweenScale",e.CLOCK_WISE="clockwise",e.CURVE="curve",e.SOUND="sound",e.EVENT="event",e.ACTION="action",e.X="x",e.Y="y",e.SKEW_X="skX",e.SKEW_Y="skY",e.SCALE_X="scX",e.SCALE_Y="scY",e.VALUE="value",e.ROTATE="rotate",e.SKEW="skew",e.ALPHA_OFFSET="aO",e.RED_OFFSET="rO",e.GREEN_OFFSET="gO",e.BLUE_OFFSET="bO",e.ALPHA_MULTIPLIER="aM",e.RED_MULTIPLIER="rM",e.GREEN_MULTIPLIER="gM",e.BLUE_MULTIPLIER="bM",e.UVS="uvs",e.VERTICES="vertices",e.TRIANGLES="triangles",e.WEIGHTS="weights",e.SLOT_POSE="slotPose",e.BONE_POSE="bonePose",e.GLUE_WEIGHTS="glueWeights",e.GLUE_MESHES="glueMeshes",e.BONES="bones",e.POSITION_MODE="positionMode",e.SPACING_MODE="spacingMode",e.ROTATE_MODE="rotateMode",e.SPACING="spacing",e.ROTATE_OFFSET="rotateOffset",e.ROTATE_MIX="rotateMix",e.TRANSLATE_MIX="translateMix",e.TARGET_DISPLAY="targetDisplay",e.CLOSED="closed",e.CONSTANT_SPEED="constantSpeed",e.VERTEX_COUNT="vertexCount",e.LENGTHS="lengths",e.GOTO_AND_PLAY="gotoAndPlay",e.DEFAULT_NAME="default",e}();t.DataParser=e}(HZ||(HZ={})),function(t){var e=function(e){function n(){var i=null!==e&&e.apply(this,arguments)||this;return i._rawTextureAtlasIndex=0,i._rawBones=[],i._data=null,i._armature=null,i._bone=null,i._surface=null,i._slot=null,i._skin=null,i._mesh=null,i._animation=null,i._timeline=null,i._rawTextureAtlases=null,i._defaultColorOffset=-1,i._prevClockwise=0,i._prevRotation=0,i._helpMatrixA=new t.Matrix,i._helpMatrixB=new t.Matrix,i._helpTransform=new t.Transform,i._helpColorTransform=new t.ColorTransform,i._helpPoint=new t.Point,i._helpArray=[],i._intArray=[],i._floatArray=[],i._frameIntArray=[],i._frameFloatArray=[],i._frameArray=[],i._timelineArray=[],i._cacheRawMeshes=[],i._cacheMeshes=[],i._actionFrames=[],i._weightSlotPose={},i._weightBonePoses={},i._cacheBones={},i._slotChildActions={},i}return zZ(n,e),n._getBoolean=function(t,e,i){if(e in t){var n=t[e],r=typeof n;if("boolean"===r)return n;if("string"!==r)return!!n;switch(n){case"0":case"NaN":case"":case"false":case"null":case"undefined":return!1;default:return!0}}return i},n._getNumber=function(t,e,i){if(e in t){var n=t[e];return null===n||"NaN"===n?i:+n||0}return i},n._getString=function(e,i,n){if(i in e){var r=e[i];if("string"==typeof r){if(t.DragonBones.webAssembly)for(var s=0,a=r.length;s<a;++s)if(r.charCodeAt(s)>255)return encodeURI(r);return r}return String(r)}return n},n.prototype._getCurvePoint=function(t,e,i,n,r,s,a,o,h,u){var l=1-h,c=l*l,_=h*h,f=l*c,d=3*h*c,p=3*l*_,m=h*_;u.x=f*t+d*i+p*r+m*a,u.y=f*e+d*n+p*s+m*o},n.prototype._samplingEasingCurve=function(t,e){for(var i=t.length,n=-2,r=0,s=e.length;r<s;++r){for(var a=(r+1)/(s+1);(n+6<i?t[n+6]:1)<a;)n+=6;for(var o=n>=0&&n+6<i,h=o?t[n]:0,u=o?t[n+1]:0,l=t[n+2],c=t[n+3],_=t[n+4],f=t[n+5],d=o?t[n+6]:1,p=o?t[n+7]:1,m=0,g=1;g-m>1e-4;){var y=.5*(g+m);this._getCurvePoint(h,u,l,c,_,f,d,p,y,this._helpPoint),a-this._helpPoint.x>0?m=y:g=y}e[r]=this._helpPoint.y}},n.prototype._parseActionDataInFrame=function(e,i,n,r){t.DataParser.EVENT in e&&this._mergeActionFrame(e[t.DataParser.EVENT],i,10,n,r),t.DataParser.SOUND in e&&this._mergeActionFrame(e[t.DataParser.SOUND],i,11,n,r),t.DataParser.ACTION in e&&this._mergeActionFrame(e[t.DataParser.ACTION],i,0,n,r),t.DataParser.EVENTS in e&&this._mergeActionFrame(e[t.DataParser.EVENTS],i,10,n,r),t.DataParser.ACTIONS in e&&this._mergeActionFrame(e[t.DataParser.ACTIONS],i,0,n,r)},n.prototype._mergeActionFrame=function(e,n,r,s,a){for(var o=t.DragonBones.webAssembly?this._armature.actions.size():this._armature.actions.length,h=this._parseActionData(e,r,s,a),u=0,l=null,c=0,_=h;c<_.length;c++){var f=_[c];this._armature.addAction(f,!1)}0===this._actionFrames.length&&((l=new i).frameStart=0,this._actionFrames.push(l),l=null);for(var d=0,p=this._actionFrames;d<p.length;d++){var m=p[d];if(m.frameStart===n){l=m;break}if(m.frameStart>n)break;u++}null===l&&((l=new i).frameStart=n,this._actionFrames.splice(u+1,0,l));for(var g=0;g<h.length;++g)l.actions.push(o+g)},n.prototype._parseArmature=function(e,i){var r=t.BaseObject.borrowObject(t.ArmatureData);if(r.name=n._getString(e,t.DataParser.NAME,""),r.frameRate=n._getNumber(e,t.DataParser.FRAME_RATE,this._data.frameRate),r.scale=i,t.DataParser.TYPE in e&&"string"==typeof e[t.DataParser.TYPE]?r.type=t.DataParser._getArmatureType(e[t.DataParser.TYPE]):r.type=n._getNumber(e,t.DataParser.TYPE,0),0===r.frameRate&&(r.frameRate=24),this._armature=r,t.DataParser.CANVAS in e){var s=e[t.DataParser.CANVAS],a=t.BaseObject.borrowObject(t.CanvasData);t.DataParser.COLOR in s?a.hasBackground=!0:a.hasBackground=!1,a.color=n._getNumber(s,t.DataParser.COLOR,0),a.x=n._getNumber(s,t.DataParser.X,0)*r.scale,a.y=n._getNumber(s,t.DataParser.Y,0)*r.scale,a.width=n._getNumber(s,t.DataParser.WIDTH,0)*r.scale,a.height=n._getNumber(s,t.DataParser.HEIGHT,0)*r.scale,r.canvas=a}if(t.DataParser.AABB in e){var o=e[t.DataParser.AABB];r.aabb.x=n._getNumber(o,t.DataParser.X,0)*r.scale,r.aabb.y=n._getNumber(o,t.DataParser.Y,0)*r.scale,r.aabb.width=n._getNumber(o,t.DataParser.WIDTH,0)*r.scale,r.aabb.height=n._getNumber(o,t.DataParser.HEIGHT,0)*r.scale}if(t.DataParser.BONE in e)for(var h=0,u=e[t.DataParser.BONE];h<u.length;h++){var l=u[h],c=n._getString(l,t.DataParser.PARENT,""),_=this._parseBone(l);if(c.length>0){var f=r.getBone(c);null!==f?_.parent=f:(c in this._cacheBones||(this._cacheBones[c]=[]),this._cacheBones[c].push(_))}if(_.name in this._cacheBones){for(var d=0,p=this._cacheBones[_.name];d<p.length;d++)p[d].parent=_;delete this._cacheBones[_.name]}r.addBone(_),this._rawBones.push(_)}if(t.DataParser.IK in e)for(var m=0,g=e[t.DataParser.IK];m<g.length;m++){var y=g[m];(w=this._parseIKConstraint(y))&&r.addConstraint(w)}if(r.sortBones(),t.DataParser.SLOT in e)for(var v=0,S=0,A=e[t.DataParser.SLOT];S<A.length;S++){var T=A[S];r.addSlot(this._parseSlot(T,v++))}if(t.DataParser.SKIN in e)for(var E=0,b=e[t.DataParser.SKIN];E<b.length;E++){var x=b[E];r.addSkin(this._parseSkin(x))}if(t.DataParser.PATH_CONSTRAINT in e)for(var C=0,R=e[t.DataParser.PATH_CONSTRAINT];C<R.length;C++){var w,I=R[C];(w=this._parsePathConstraint(I))&&r.addConstraint(w)}for(var B=0,D=this._cacheRawMeshes.length;B<D;++B){var P=this._cacheRawMeshes[B];t.DataParser.GLUE_WEIGHTS in P&&t.DataParser.GLUE_MESHES in P&&this._parseMeshGlue(P,this._cacheMeshes[B])}for(B=0,D=this._cacheRawMeshes.length;B<D;++B){var O=this._cacheRawMeshes[B],M=n._getString(O,t.DataParser.SHARE,"");if(0!==M.length){var N=n._getString(O,t.DataParser.SKIN,t.DataParser.DEFAULT_NAME);0===N.length&&(N=t.DataParser.DEFAULT_NAME);var L=r.getMesh(N,"",M);null!==L&&this._cacheMeshes[B].vertices.shareFrom(L.vertices)}}if(t.DataParser.ANIMATION in e)for(var F=0,k=e[t.DataParser.ANIMATION];F<k.length;F++){var G=k[F],V=this._parseAnimation(G);r.addAnimation(V)}if(t.DataParser.DEFAULT_ACTIONS in e)for(var U=0,z=this._parseActionData(e[t.DataParser.DEFAULT_ACTIONS],0,null,null);U<z.length;U++){var H=z[U];r.addAction(H,!0),0===H.type&&null!==(V=r.getAnimation(H.name))&&(r.defaultAnimation=V)}if(t.DataParser.ACTIONS in e)for(var W=0,X=this._parseActionData(e[t.DataParser.ACTIONS],0,null,null);W<X.length;W++)H=X[W],r.addAction(H,!1);for(var j in this._rawBones.length=0,this._cacheRawMeshes.length=0,this._cacheMeshes.length=0,this._armature=null,this._weightSlotPose)delete this._weightSlotPose[j];for(var j in this._weightBonePoses)delete this._weightBonePoses[j];for(var j in this._cacheBones)delete this._cacheBones[j];for(var j in this._slotChildActions)delete this._slotChildActions[j];return r},n.prototype._parseBone=function(e){var i=this._armature.scale;if(0===(t.DataParser.TYPE in e&&"string"==typeof e[t.DataParser.TYPE]?t.DataParser._getBoneType(e[t.DataParser.TYPE]):n._getNumber(e,t.DataParser.TYPE,0))){var r=t.BaseObject.borrowObject(t.BoneData);return r.inheritTranslation=n._getBoolean(e,t.DataParser.INHERIT_TRANSLATION,!0),r.inheritRotation=n._getBoolean(e,t.DataParser.INHERIT_ROTATION,!0),r.inheritScale=n._getBoolean(e,t.DataParser.INHERIT_SCALE,!0),r.inheritReflection=n._getBoolean(e,t.DataParser.INHERIT_REFLECTION,!0),r.length=n._getNumber(e,t.DataParser.LENGTH,0)*i,r.name=n._getString(e,t.DataParser.NAME,""),t.DataParser.TRANSFORM in e&&this._parseTransform(e[t.DataParser.TRANSFORM],r.transform,i),r}var s=t.BaseObject.borrowObject(t.SurfaceData);if(s.name=n._getString(e,t.DataParser.NAME,""),s.segmentX=n._getNumber(e,t.DataParser.SEGMENT_X,0),s.segmentY=n._getNumber(e,t.DataParser.SEGMENT_Y,0),s.vertices.length=(s.segmentX+1)*(s.segmentY+1)*2,t.DataParser.VERTICES in e)for(var a=e[t.DataParser.VERTICES],o=0,h=s.vertices.length;o<h;++o)o<a.length?s.vertices[o]=a[o]*i:s.vertices[o]=0;return s},n.prototype._parseIKConstraint=function(e){var i=this._armature.getBone(n._getString(e,t.DataParser.BONE,""));if(null===i)return null;var r=this._armature.getBone(n._getString(e,t.DataParser.TARGET,""));if(null===r)return null;var s=t.BaseObject.borrowObject(t.IKConstraintData);return s.scaleEnabled=n._getBoolean(e,t.DataParser.SCALE,!1),s.bendPositive=n._getBoolean(e,t.DataParser.BEND_POSITIVE,!0),s.weight=n._getNumber(e,t.DataParser.WEIGHT,1),s.name=n._getString(e,t.DataParser.NAME,""),s.type=0,s.target=r,n._getNumber(e,t.DataParser.CHAIN,0)>0&&null!==i.parent?(s.root=i.parent,s.bone=i):(s.root=i,s.bone=null),s},n.prototype._parsePathConstraint=function(e){var i=this._armature.getSlot(n._getString(e,t.DataParser.TARGET,""));if(null===i)return null;var r=this._armature.defaultSkin;if(null===r)return null;var s=r.getDisplay(i.name,n._getString(e,t.DataParser.TARGET_DISPLAY,i.name));if(null===s||!(s instanceof t.PathDisplayData))return null;var a=e[t.DataParser.BONES];if(null===a||0===a.length)return null;var o=t.BaseObject.borrowObject(t.PathConstraintData);o.name=n._getString(e,t.DataParser.NAME,""),o.type=1,o.pathSlot=i,o.pathDisplayData=s,o.target=i.parent,o.positionMode=t.DataParser._getPositionMode(n._getString(e,t.DataParser.POSITION_MODE,"")),o.spacingMode=t.DataParser._getSpacingMode(n._getString(e,t.DataParser.SPACING_MODE,"")),o.rotateMode=t.DataParser._getRotateMode(n._getString(e,t.DataParser.ROTATE_MODE,"")),o.position=n._getNumber(e,t.DataParser.POSITION,0),o.spacing=n._getNumber(e,t.DataParser.SPACING,0),o.rotateOffset=n._getNumber(e,t.DataParser.ROTATE_OFFSET,0),o.rotateMix=n._getNumber(e,t.DataParser.ROTATE_MIX,1),o.translateMix=n._getNumber(e,t.DataParser.TRANSLATE_MIX,1);for(var h=0,u=a;h<u.length;h++){var l=u[h],c=this._armature.getBone(l);null!==c&&(o.AddBone(c),null===o.root&&(o.root=c))}return o},n.prototype._parseSlot=function(e,i){var r=t.BaseObject.borrowObject(t.SlotData);return r.displayIndex=n._getNumber(e,t.DataParser.DISPLAY_INDEX,0),r.zOrder=i,r.name=n._getString(e,t.DataParser.NAME,""),r.parent=this._armature.getBone(n._getString(e,t.DataParser.PARENT,"")),t.DataParser.BLEND_MODE in e&&"string"==typeof e[t.DataParser.BLEND_MODE]?r.blendMode=t.DataParser._getBlendMode(e[t.DataParser.BLEND_MODE]):r.blendMode=n._getNumber(e,t.DataParser.BLEND_MODE,0),t.DataParser.COLOR in e?(r.color=t.SlotData.createColor(),this._parseColorTransform(e[t.DataParser.COLOR],r.color)):r.color=t.SlotData.DEFAULT_COLOR,t.DataParser.ACTIONS in e&&(this._slotChildActions[r.name]=this._parseActionData(e[t.DataParser.ACTIONS],0,null,null)),r},n.prototype._parseSkin=function(e){var i=t.BaseObject.borrowObject(t.SkinData);if(i.name=n._getString(e,t.DataParser.NAME,t.DataParser.DEFAULT_NAME),0===i.name.length&&(i.name=t.DataParser.DEFAULT_NAME),t.DataParser.SLOT in e){var r=e[t.DataParser.SLOT];this._skin=i;for(var s=0,a=r;s<a.length;s++){var o=a[s],h=n._getString(o,t.DataParser.NAME,""),u=this._armature.getSlot(h);if(null!==u){if(this._slot=u,t.DataParser.DISPLAY in o)for(var l=0,c=o[t.DataParser.DISPLAY];l<c.length;l++){var _=c[l];_?i.addDisplay(h,this._parseDisplay(_)):i.addDisplay(h,null)}this._slot=null}}this._skin=null}return i},n.prototype._parseDisplay=function(e){var i=n._getString(e,t.DataParser.NAME,""),r=n._getString(e,t.DataParser.PATH,""),s=0,a=null;switch(s=t.DataParser.TYPE in e&&"string"==typeof e[t.DataParser.TYPE]?t.DataParser._getDisplayType(e[t.DataParser.TYPE]):n._getNumber(e,t.DataParser.TYPE,s)){case 0:var o=a=t.BaseObject.borrowObject(t.ImageDisplayData);o.name=i,o.path=r.length>0?r:i,this._parsePivot(e,o);break;case 1:var h=a=t.BaseObject.borrowObject(t.ArmatureDisplayData);if(h.name=i,h.path=r.length>0?r:i,h.inheritAnimation=!0,t.DataParser.ACTIONS in e)for(var u=0,l=this._parseActionData(e[t.DataParser.ACTIONS],0,null,null);u<l.length;u++){var c=l[u];h.addAction(c)}else if(this._slot.name in this._slotChildActions){var _=this._skin.getDisplays(this._slot.name);if(null===_?0===this._slot.displayIndex:this._slot.displayIndex===_.length){for(var f=0,d=this._slotChildActions[this._slot.name];f<d.length;f++)c=d[f],h.addAction(c);delete this._slotChildActions[this._slot.name]}}break;case 2:var p=a=t.BaseObject.borrowObject(t.MeshDisplayData);p.vertices.inheritDeform=n._getBoolean(e,t.DataParser.INHERIT_DEFORM,!0),p.name=i,p.path=r.length>0?r:i,p.vertices.data=this._data,t.DataParser.SHARE in e?(this._cacheRawMeshes.push(e),this._cacheMeshes.push(p)):this._parseMesh(e,p),t.DataParser.GLUE_WEIGHTS in e&&t.DataParser.GLUE_MESHES in e&&(this._cacheRawMeshes.push(e),this._cacheMeshes.push(p));break;case 3:var m=this._parseBoundingBox(e);if(null!==m){var g=a=t.BaseObject.borrowObject(t.BoundingBoxDisplayData);g.name=i,g.path=r.length>0?r:i,g.boundingBox=m}break;case 4:var y=e[t.DataParser.LENGTHS],v=a=t.BaseObject.borrowObject(t.PathDisplayData);v.closed=n._getBoolean(e,t.DataParser.CLOSED,!1),v.constantSpeed=n._getBoolean(e,t.DataParser.CONSTANT_SPEED,!1),v.name=i,v.path=r.length>0?r:i,v.vertices.data=this._data,v.curveLengths.length=y.length;for(var S=0,A=y.length;S<A;++S)v.curveLengths[S]=y[S];this._parsePath(e,v)}return null!==a&&t.DataParser.TRANSFORM in e&&this._parseTransform(e[t.DataParser.TRANSFORM],a.transform,this._armature.scale),a},n.prototype._parsePath=function(e,i){var r=e[t.DataParser.VERTICES],s=n._getNumber(e,t.DataParser.VERTEX_COUNT,0),a=this._floatArray.length,o=this._intArray.length;if(i.vertices.offset=o,this._intArray.length+=2,this._intArray[o+0]=s,this._intArray[o+2]=a,t.DataParser.WEIGHTS in e){var h=e[t.DataParser.WEIGHTS],u=e[t.DataParser.BONES],l=u.length,c=Math.floor(h.length-s)/2,_=this._intArray.length,f=this._floatArray.length,d=this._armature.sortedBones,p=t.BaseObject.borrowObject(t.WeightData);for(p.count=c,p.offset=_,this._intArray.length+=2+l+s+c,this._intArray[_+0]=l,this._intArray[_+1]=f,w=0;w<l;w++){var m=u[w],g=this._rawBones[m];p.addBone(g),this._intArray[_+2+w]=d.indexOf(g)}this._floatArray.length+=3*c,w=0;for(var y=0,v=0,S=_+2+l,A=f;w<c;w++){var T=h[y++];this._intArray[S++]=T;for(var E=0;E<T;E++){var b=h[y++],x=h[y++],C=r[v++],R=r[v++];this._intArray[S++]=u.indexOf(b),this._floatArray[A++]=x,this._floatArray[A++]=C,this._floatArray[A++]=R}}i.vertices.weight=p}else{this._floatArray.length+=r.length;for(var w=0,I=r.length;w<I;++w)this._floatArray[a+w]=r[w]}},n.prototype._parsePivot=function(e,i){if(t.DataParser.PIVOT in e){var r=e[t.DataParser.PIVOT];i.pivot.x=n._getNumber(r,t.DataParser.X,0),i.pivot.y=n._getNumber(r,t.DataParser.Y,0)}else i.pivot.x=.5,i.pivot.y=.5},n.prototype._parseMesh=function(e,i){var n=e[t.DataParser.VERTICES],r=e[t.DataParser.UVS],s=e[t.DataParser.TRIANGLES],a=Math.floor(n.length/2),o=Math.floor(s.length/3),h=this._floatArray.length,u=h+2*a,l=this._intArray.length,c=this._skin.name+"_"+this._slot.name+"_"+i.name;i.vertices.offset=l,this._intArray.length+=4+3*o,this._intArray[l+0]=a,this._intArray[l+1]=o,this._intArray[l+2]=h;for(var _=0,f=3*o;_<f;++_)this._intArray[l+4+_]=s[_];for(this._floatArray.length+=2*a+2*a,_=0,f=2*a;_<f;++_)this._floatArray[h+_]=n[_],this._floatArray[u+_]=r[_];if(t.DataParser.WEIGHTS in e){var d=e[t.DataParser.WEIGHTS],p=e[t.DataParser.SLOT_POSE],m=e[t.DataParser.BONE_POSE],g=this._armature.sortedBones,y=new Array,v=Math.floor(m.length/7),S=this._floatArray.length,A=Math.floor(d.length-a)/2,T=this._intArray.length,E=t.BaseObject.borrowObject(t.WeightData);for(E.count=A,E.offset=T,y.length=v,this._intArray.length+=2+v+a+A,this._intArray[T+1]=S,_=0;_<v;++_){var b=m[7*_],x=this._rawBones[b];E.addBone(x),y[_]=b,this._intArray[T+2+_]=g.indexOf(x)}this._floatArray.length+=3*A,this._helpMatrixA.copyFromArray(p,0),_=0;for(var C=0,R=T+2+v,w=S;_<a;++_){var I=2*_,B=this._intArray[R++]=d[C++],D=this._floatArray[h+I],P=this._floatArray[h+I+1];this._helpMatrixA.transformPoint(D,P,this._helpPoint),D=this._helpPoint.x,P=this._helpPoint.y;for(var O=0;O<B;++O){b=d[C++];var M=y.indexOf(b);this._helpMatrixB.copyFromArray(m,7*M+1),this._helpMatrixB.invert(),this._helpMatrixB.transformPoint(D,P,this._helpPoint),this._intArray[R++]=M,this._floatArray[w++]=d[C++],this._floatArray[w++]=this._helpPoint.x,this._floatArray[w++]=this._helpPoint.y}}i.vertices.weight=E,this._weightSlotPose[c]=p,this._weightBonePoses[c]=m}},n.prototype._parseMeshGlue=function(){},n.prototype._parseBoundingBox=function(e){var i=null,r=0;switch(r=t.DataParser.SUB_TYPE in e&&"string"==typeof e[t.DataParser.SUB_TYPE]?t.DataParser._getBoundingBoxType(e[t.DataParser.SUB_TYPE]):n._getNumber(e,t.DataParser.SUB_TYPE,r)){case 0:i=t.BaseObject.borrowObject(t.RectangleBoundingBoxData);break;case 1:i=t.BaseObject.borrowObject(t.EllipseBoundingBoxData);break;case 2:i=this._parsePolygonBoundingBox(e)}return null!==i&&(i.color=n._getNumber(e,t.DataParser.COLOR,0),0!==i.type&&1!==i.type||(i.width=n._getNumber(e,t.DataParser.WIDTH,0),i.height=n._getNumber(e,t.DataParser.HEIGHT,0))),i},n.prototype._parsePolygonBoundingBox=function(e){var i=t.BaseObject.borrowObject(t.PolygonBoundingBoxData);if(t.DataParser.VERTICES in e){var n=this._armature.scale,r=e[t.DataParser.VERTICES],s=i.vertices;t.DragonBones.webAssembly?s.resize(r.length,0):s.length=r.length;for(var a=0,o=r.length;a<o;a+=2){var h=r[a]*n,u=r[a+1]*n;t.DragonBones.webAssembly?(s.set(a,h),s.set(a+1,u)):(s[a]=h,s[a+1]=u),0===a?(i.x=h,i.y=u,i.width=h,i.height=u):(h<i.x?i.x=h:h>i.width&&(i.width=h),u<i.y?i.y=u:u>i.height&&(i.height=u))}i.width-=i.x,i.height-=i.y}else console.warn("Data error.\n Please reexport DragonBones Data to fixed the bug.");return i},n.prototype._parseAnimation=function(e){var i=t.BaseObject.borrowObject(t.AnimationData);if(i.frameCount=Math.max(n._getNumber(e,t.DataParser.DURATION,1),1),i.playTimes=n._getNumber(e,t.DataParser.PLAY_TIMES,1),i.duration=i.frameCount/this._armature.frameRate,i.fadeInTime=n._getNumber(e,t.DataParser.FADE_IN_TIME,0),i.scale=n._getNumber(e,t.DataParser.SCALE,1),i.name=n._getString(e,t.DataParser.NAME,t.DataParser.DEFAULT_NAME),0===i.name.length&&(i.name=t.DataParser.DEFAULT_NAME),i.frameIntOffset=this._frameIntArray.length,i.frameFloatOffset=this._frameFloatArray.length,i.frameOffset=this._frameArray.length,this._animation=i,t.DataParser.FRAME in e){var r=e[t.DataParser.FRAME],s=r.length;if(s>0)for(var a=0,o=0;a<s;++a){var h=r[a];this._parseActionDataInFrame(h,o,null,null),o+=n._getNumber(h,t.DataParser.DURATION,1)}}if(t.DataParser.Z_ORDER in e&&(this._animation.zOrderTimeline=this._parseTimeline(e[t.DataParser.Z_ORDER],null,t.DataParser.FRAME,1,!1,!1,0,this._parseZOrderFrame)),t.DataParser.BONE in e)for(var u=0,l=e[t.DataParser.BONE];u<l.length;u++){var c=l[u];this._parseBoneTimeline(c)}if(t.DataParser.SURFACE in e)for(var _=0,f=e[t.DataParser.SURFACE];_<f.length;_++){c=f[_];var d=n._getString(c,t.DataParser.NAME,"");this._surface=this._armature.getBone(d),null!==this._surface&&(null!==(w=this._parseTimeline(c,null,t.DataParser.FRAME,50,!1,!0,0,this._parseSurfaceFrame))&&this._animation.addSurfaceTimeline(this._surface,w),this._surface=null)}if(t.DataParser.SLOT in e)for(var p=0,m=e[t.DataParser.SLOT];p<m.length;p++)c=m[p],this._parseSlotTimeline(c);if(t.DataParser.FFD in e)for(var g=0,y=e[t.DataParser.FFD];g<y.length;g++){c=y[g];var v=n._getString(c,t.DataParser.SKIN,t.DataParser.DEFAULT_NAME),S=n._getString(c,t.DataParser.SLOT,""),A=n._getString(c,t.DataParser.NAME,"");0===v.length&&(v=t.DataParser.DEFAULT_NAME),this._slot=this._armature.getSlot(S),this._mesh=this._armature.getMesh(v,S,A),null!==this._slot&&null!==this._mesh&&(null!==(w=this._parseTimeline(c,null,t.DataParser.FRAME,22,!1,!0,0,this._parseSlotFFDFrame))&&this._animation.addSlotTimeline(this._slot,w),this._slot=null,this._mesh=null)}if(t.DataParser.IK in e)for(var T=0,E=e[t.DataParser.IK];T<E.length;T++){c=E[T];var b=n._getString(c,t.DataParser.NAME,""),x=this._armature.getConstraint(b);null!==x&&null!==(w=this._parseTimeline(c,null,t.DataParser.FRAME,30,!0,!1,2,this._parseIKConstraintFrame))&&this._animation.addConstraintTimeline(x,w)}if(t.DataParser.ANIMATION in e)for(var C=0,R=e[t.DataParser.ANIMATION];C<R.length;C++){c=R[C];var w,I=n._getString(c,t.DataParser.NAME,"");null!==(w=this._parseTimeline(c,null,t.DataParser.FRAME,40,!0,!1,2,this._parseAnimationFrame))&&this._animation.addAnimationTimeline(I,w)}return this._actionFrames.length>0&&(this._animation.actionTimeline=this._parseTimeline(null,this._actionFrames,"",0,!1,!1,0,this._parseActionFrame),this._actionFrames.length=0),this._animation=null,i},n.prototype._parseTimeline=function(e,r,s,a,o,h,u,l){if(null!==e&&s.length>0&&s in e&&(r=e[s]),null===r)return null;var c=r.length;if(0===c)return null;var _=this._frameIntArray.length,f=this._frameFloatArray.length,d=t.BaseObject.borrowObject(t.TimelineData),p=this._timelineArray.length;if(this._timelineArray.length+=5+c,null!==e?(this._timelineArray[p+0]=Math.round(100*n._getNumber(e,t.DataParser.SCALE,1)),this._timelineArray[p+1]=Math.round(100*n._getNumber(e,t.DataParser.OFFSET,0))):(this._timelineArray[p+0]=100,this._timelineArray[p+1]=0),this._timelineArray[p+2]=c,this._timelineArray[p+3]=u,this._timelineArray[p+4]=o?_-this._animation.frameIntOffset:h?f-this._animation.frameFloatOffset:0,this._timeline=d,d.type=a,d.offset=p,1===c)d.frameIndicesOffset=-1,this._timelineArray[p+5+0]=l.call(this,r[0],0,0)-this._animation.frameOffset;else{var m=this._animation.frameCount+1,g=this._data.frameIndices,y=0;t.DragonBones.webAssembly?(y=g.size(),g.resize(y+m,0)):(y=g.length,g.length+=m),d.frameIndicesOffset=y;for(var v=0,S=0,A=0,T=0;v<m;++v){if(A+T<=v&&S<c){var E=r[S];A=v,T=S===c-1?this._animation.frameCount-A:E instanceof i?this._actionFrames[S+1].frameStart-A:n._getNumber(E,t.DataParser.DURATION,1),this._timelineArray[p+5+S]=l.call(this,E,A,T)-this._animation.frameOffset,S++}t.DragonBones.webAssembly?g.set(y+v,S-1):g[y+v]=S-1}}return this._timeline=null,d},n.prototype._parseBoneTimeline=function(e){var i,r=this._armature.getBone(n._getString(e,t.DataParser.NAME,""));null!==r&&(this._bone=r,this._slot=this._armature.getSlot(this._bone.name),t.DataParser.TRANSLATE_FRAME in e&&null!==(i=this._parseTimeline(e,null,t.DataParser.TRANSLATE_FRAME,11,!1,!0,2,this._parseBoneTranslateFrame))&&this._animation.addBoneTimeline(r,i),t.DataParser.ROTATE_FRAME in e&&null!==(i=this._parseTimeline(e,null,t.DataParser.ROTATE_FRAME,12,!1,!0,2,this._parseBoneRotateFrame))&&this._animation.addBoneTimeline(r,i),t.DataParser.SCALE_FRAME in e&&null!==(i=this._parseTimeline(e,null,t.DataParser.SCALE_FRAME,13,!1,!0,2,this._parseBoneScaleFrame))&&this._animation.addBoneTimeline(r,i),t.DataParser.FRAME in e&&null!==(i=this._parseTimeline(e,null,t.DataParser.FRAME,10,!1,!0,6,this._parseBoneAllFrame))&&this._animation.addBoneTimeline(r,i),this._bone=null,this._slot=null)},n.prototype._parseSlotTimeline=function(e){var i=this._armature.getSlot(n._getString(e,t.DataParser.NAME,""));if(null!==i){this._slot=i;var r;null!==(r=t.DataParser.DISPLAY_FRAME in e?this._parseTimeline(e,null,t.DataParser.DISPLAY_FRAME,20,!1,!1,0,this._parseSlotDisplayFrame):this._parseTimeline(e,null,t.DataParser.FRAME,20,!1,!1,0,this._parseSlotDisplayFrame))&&this._animation.addSlotTimeline(i,r);var s;null!==(s=t.DataParser.COLOR_FRAME in e?this._parseTimeline(e,null,t.DataParser.COLOR_FRAME,21,!0,!1,1,this._parseSlotColorFrame):this._parseTimeline(e,null,t.DataParser.FRAME,21,!0,!1,1,this._parseSlotColorFrame))&&this._animation.addSlotTimeline(i,s),this._slot=null}},n.prototype._parseFrame=function(t,e){var i=this._frameArray.length;return this._frameArray.length+=1,this._frameArray[i+0]=e,i},n.prototype._parseTweenFrame=function(e,i,r){var s=this._parseFrame(e,i,r);if(r>0)if(t.DataParser.CURVE in e){var a=r+1;this._helpArray.length=a,this._samplingEasingCurve(e[t.DataParser.CURVE],this._helpArray),this._frameArray.length+=2+this._helpArray.length,this._frameArray[s+1]=2,this._frameArray[s+2]=a;for(var o=0;o<a;++o)this._frameArray[s+3+o]=Math.round(1e4*this._helpArray[o])}else{var h=-2;t.DataParser.TWEEN_EASING in e&&(h=n._getNumber(e,t.DataParser.TWEEN_EASING,-2)),-2===h?(this._frameArray.length+=1,this._frameArray[s+1]=0):0===h?(this._frameArray.length+=1,this._frameArray[s+1]=1):h<0?(this._frameArray.length+=2,this._frameArray[s+1]=3,this._frameArray[s+2]=Math.round(100*-h)):h<=1?(this._frameArray.length+=2,this._frameArray[s+1]=4,this._frameArray[s+2]=Math.round(100*h)):(this._frameArray.length+=2,this._frameArray[s+1]=5,this._frameArray[s+2]=Math.round(100*h-100))}else this._frameArray.length+=1,this._frameArray[s+1]=0;return s},n.prototype._parseActionFrame=function(t,e){var i=this._frameArray.length,n=t.actions.length;this._frameArray.length+=2+n,this._frameArray[i+0]=e,this._frameArray[i+0+1]=n;for(var r=0;r<n;++r)this._frameArray[i+0+2+r]=t.actions[r];return i},n.prototype._parseZOrderFrame=function(e,i,n){var r=this._parseFrame(e,i,n);if(t.DataParser.Z_ORDER in e){var s=e[t.DataParser.Z_ORDER];if(s.length>0){for(var a=this._armature.sortedSlots.length,o=new Array(a-s.length/2),h=new Array(a),u=0;u<o.length;++u)o[u]=0;for(var l=0;l<a;++l)h[l]=-1;for(var c=0,_=0,f=0,d=s.length;f<d;f+=2){for(var p=s[f],m=s[f+1];c!==p;)o[_++]=c++;h[c+m]=c++}for(;c<a;)o[_++]=c++;this._frameArray.length+=1+a,this._frameArray[r+1]=a;for(var g=a;g--;)-1===h[g]?this._frameArray[r+2+g]=o[--_]||0:this._frameArray[r+2+g]=h[g]||0;return r}}return this._frameArray.length+=1,this._frameArray[r+1]=0,r},n.prototype._parseBoneAllFrame=function(e,i,r){this._helpTransform.identity(),t.DataParser.TRANSFORM in e&&this._parseTransform(e[t.DataParser.TRANSFORM],this._helpTransform,1);var s=this._helpTransform.rotation;0!==i&&(0===this._prevClockwise?s=this._prevRotation+t.Transform.normalizeRadian(s-this._prevRotation):((this._prevClockwise>0?s>=this._prevRotation:s<=this._prevRotation)&&(this._prevClockwise=this._prevClockwise>0?this._prevClockwise-1:this._prevClockwise+1),s=this._prevRotation+s-this._prevRotation+t.Transform.PI_D*this._prevClockwise)),this._prevClockwise=n._getNumber(e,t.DataParser.TWEEN_ROTATE,0),this._prevRotation=s;var a=this._parseTweenFrame(e,i,r),o=this._frameFloatArray.length;return this._frameFloatArray.length+=6,this._frameFloatArray[o++]=this._helpTransform.x,this._frameFloatArray[o++]=this._helpTransform.y,this._frameFloatArray[o++]=s,this._frameFloatArray[o++]=this._helpTransform.skew,this._frameFloatArray[o++]=this._helpTransform.scaleX,this._frameFloatArray[o++]=this._helpTransform.scaleY,this._parseActionDataInFrame(e,i,this._bone,this._slot),a},n.prototype._parseBoneTranslateFrame=function(e,i,r){var s=this._parseTweenFrame(e,i,r),a=this._frameFloatArray.length;return this._frameFloatArray.length+=2,this._frameFloatArray[a++]=n._getNumber(e,t.DataParser.X,0),this._frameFloatArray[a++]=n._getNumber(e,t.DataParser.Y,0),s},n.prototype._parseBoneRotateFrame=function(e,i,r){var s=n._getNumber(e,t.DataParser.ROTATE,0)*t.Transform.DEG_RAD;0!==i&&(0===this._prevClockwise?s=this._prevRotation+t.Transform.normalizeRadian(s-this._prevRotation):((this._prevClockwise>0?s>=this._prevRotation:s<=this._prevRotation)&&(this._prevClockwise=this._prevClockwise>0?this._prevClockwise-1:this._prevClockwise+1),s=this._prevRotation+s-this._prevRotation+t.Transform.PI_D*this._prevClockwise)),this._prevClockwise=n._getNumber(e,t.DataParser.CLOCK_WISE,0),this._prevRotation=s;var a=this._parseTweenFrame(e,i,r),o=this._frameFloatArray.length;return this._frameFloatArray.length+=2,this._frameFloatArray[o++]=s,this._frameFloatArray[o++]=n._getNumber(e,t.DataParser.SKEW,0)*t.Transform.DEG_RAD,a},n.prototype._parseBoneScaleFrame=function(e,i,r){var s=this._parseTweenFrame(e,i,r),a=this._frameFloatArray.length;return this._frameFloatArray.length+=2,this._frameFloatArray[a++]=n._getNumber(e,t.DataParser.X,1),this._frameFloatArray[a++]=n._getNumber(e,t.DataParser.Y,1),s},n.prototype._parseSurfaceFrame=function(e,i,r){var s=this._frameFloatArray.length,a=this._parseTweenFrame(e,i,r),o=e[t.DataParser.VERTICES],h=n._getNumber(e,t.DataParser.OFFSET,0),u=this._surface.vertices.length/2,l=0,c=0;this._frameFloatArray.length+=2*u;for(var _=0;_<2*u;_+=2)l=_<h||_-h>=o.length?0:o[_-h],c=_+1<h||_+1-h>=o.length?0:o[_+1-h],this._frameFloatArray[s+_]=l,this._frameFloatArray[s+_+1]=c;if(0===i){var f=this._frameIntArray.length;this._frameIntArray.length+=5,this._frameIntArray[f+0]=0,this._frameIntArray[f+1]=this._frameFloatArray.length-s,this._frameIntArray[f+2]=this._frameFloatArray.length-s,this._frameIntArray[f+3]=0,this._frameIntArray[f+4]=s-this._animation.frameFloatOffset,this._timelineArray[this._timeline.offset+3]=f-this._animation.frameIntOffset}return a},n.prototype._parseSlotDisplayFrame=function(e,i,r){var s=this._parseFrame(e,i,r);return this._frameArray.length+=1,t.DataParser.VALUE in e?this._frameArray[s+1]=n._getNumber(e,t.DataParser.VALUE,0):this._frameArray[s+1]=n._getNumber(e,t.DataParser.DISPLAY_INDEX,0),this._parseActionDataInFrame(e,i,this._slot.parent,this._slot),s},n.prototype._parseSlotColorFrame=function(e,i,n){var r=this._parseTweenFrame(e,i,n),s=-1;if(t.DataParser.VALUE in e||t.DataParser.COLOR in e){var a=t.DataParser.VALUE in e?e[t.DataParser.VALUE]:e[t.DataParser.COLOR];for(var o in a){this._parseColorTransform(a,this._helpColorTransform),s=this._intArray.length,this._intArray.length+=8,this._intArray[s++]=Math.round(100*this._helpColorTransform.alphaMultiplier),this._intArray[s++]=Math.round(100*this._helpColorTransform.redMultiplier),this._intArray[s++]=Math.round(100*this._helpColorTransform.greenMultiplier),this._intArray[s++]=Math.round(100*this._helpColorTransform.blueMultiplier),this._intArray[s++]=Math.round(this._helpColorTransform.alphaOffset),this._intArray[s++]=Math.round(this._helpColorTransform.redOffset),this._intArray[s++]=Math.round(this._helpColorTransform.greenOffset),this._intArray[s++]=Math.round(this._helpColorTransform.blueOffset),s-=8;break}}s<0&&(this._defaultColorOffset<0&&(this._defaultColorOffset=s=this._intArray.length,this._intArray.length+=8,this._intArray[s++]=100,this._intArray[s++]=100,this._intArray[s++]=100,this._intArray[s++]=100,this._intArray[s++]=0,this._intArray[s++]=0,this._intArray[s++]=0,this._intArray[s++]=0),s=this._defaultColorOffset);var h=this._frameIntArray.length;return this._frameIntArray.length+=1,this._frameIntArray[h]=s,r},n.prototype._parseSlotFFDFrame=function(e,i,r){var s=this._frameFloatArray.length,a=this._parseTweenFrame(e,i,r),o=t.DataParser.VERTICES in e?e[t.DataParser.VERTICES]:null,h=n._getNumber(e,t.DataParser.OFFSET,0),u=this._intArray[this._mesh.vertices.offset+0],l=this._mesh.parent.name+"_"+this._slot.name+"_"+this._mesh.name,c=this._mesh.vertices.weight,_=0,f=0,d=0,p=0;if(null!==c){var m=this._weightSlotPose[l];this._helpMatrixA.copyFromArray(m,0),this._frameFloatArray.length+=2*c.count,d=c.offset+2+c.bones.length}else this._frameFloatArray.length+=2*u;for(var g=0;g<2*u;g+=2)if(null===o?(_=0,f=0):(_=g<h||g-h>=o.length?0:o[g-h],f=g+1<h||g+1-h>=o.length?0:o[g+1-h]),null!==c){var y=this._weightBonePoses[l],v=this._intArray[d++];this._helpMatrixA.transformPoint(_,f,this._helpPoint,!0),_=this._helpPoint.x,f=this._helpPoint.y;for(var S=0;S<v;++S){var A=this._intArray[d++];this._helpMatrixB.copyFromArray(y,7*A+1),this._helpMatrixB.invert(),this._helpMatrixB.transformPoint(_,f,this._helpPoint,!0),this._frameFloatArray[s+p++]=this._helpPoint.x,this._frameFloatArray[s+p++]=this._helpPoint.y}}else this._frameFloatArray[s+g]=_,this._frameFloatArray[s+g+1]=f;if(0===i){var T=this._frameIntArray.length;this._frameIntArray.length+=5,this._frameIntArray[T+0]=this._mesh.vertices.offset,this._frameIntArray[T+1]=this._frameFloatArray.length-s,this._frameIntArray[T+2]=this._frameFloatArray.length-s,this._frameIntArray[T+3]=0,this._frameIntArray[T+4]=s-this._animation.frameFloatOffset,this._timelineArray[this._timeline.offset+3]=T-this._animation.frameIntOffset}return a},n.prototype._parseIKConstraintFrame=function(e,i,r){var s=this._parseTweenFrame(e,i,r),a=this._frameIntArray.length;return this._frameIntArray.length+=2,this._frameIntArray[a++]=n._getBoolean(e,t.DataParser.BEND_POSITIVE,!0)?1:0,this._frameIntArray[a++]=Math.round(100*n._getNumber(e,t.DataParser.WEIGHT,1)),s},n.prototype._parseAnimationFrame=function(e,i,r){var s=this._parseTweenFrame(e,i,r),a=this._frameIntArray.length;return this._frameIntArray.length+=2,this._frameIntArray[a++]=n._getNumber(e,t.DataParser.VALUE,0),this._frameIntArray[a++]=Math.round(100*n._getNumber(e,t.DataParser.WEIGHT,1)),s},n.prototype._parseActionData=function(e,i,r,s){var a=new Array;if("string"==typeof e)(l=t.BaseObject.borrowObject(t.ActionData)).type=i,l.name=e,l.bone=r,l.slot=s,a.push(l);else if(e instanceof Array)for(var o=0,h=e;o<h.length;o++){var u=h[o],l=t.BaseObject.borrowObject(t.ActionData);if(t.DataParser.GOTO_AND_PLAY in u?(l.type=0,l.name=n._getString(u,t.DataParser.GOTO_AND_PLAY,"")):(t.DataParser.TYPE in u&&"string"==typeof u[t.DataParser.TYPE]?l.type=t.DataParser._getActionType(u[t.DataParser.TYPE]):l.type=n._getNumber(u,t.DataParser.TYPE,i),l.name=n._getString(u,t.DataParser.NAME,"")),t.DataParser.BONE in u){var c=n._getString(u,t.DataParser.BONE,"");l.bone=this._armature.getBone(c)}else l.bone=r;if(t.DataParser.SLOT in u){var _=n._getString(u,t.DataParser.SLOT,"");l.slot=this._armature.getSlot(_)}else l.slot=s;var f=null;if(t.DataParser.INTS in u){null===f&&(f=t.BaseObject.borrowObject(t.UserData));for(var d=0,p=u[t.DataParser.INTS];d<p.length;d++){var m=p[d];f.addInt(m)}}if(t.DataParser.FLOATS in u){null===f&&(f=t.BaseObject.borrowObject(t.UserData));for(var g=0,y=u[t.DataParser.FLOATS];g<y.length;g++)m=y[g],f.addFloat(m)}if(t.DataParser.STRINGS in u){null===f&&(f=t.BaseObject.borrowObject(t.UserData));for(var v=0,S=u[t.DataParser.STRINGS];v<S.length;v++)m=S[v],f.addString(m)}l.data=f,a.push(l)}return a},n.prototype._parseTransform=function(e,i,r){i.x=n._getNumber(e,t.DataParser.X,0)*r,i.y=n._getNumber(e,t.DataParser.Y,0)*r,t.DataParser.ROTATE in e||t.DataParser.SKEW in e?(i.rotation=t.Transform.normalizeRadian(n._getNumber(e,t.DataParser.ROTATE,0)*t.Transform.DEG_RAD),i.skew=t.Transform.normalizeRadian(n._getNumber(e,t.DataParser.SKEW,0)*t.Transform.DEG_RAD)):(t.DataParser.SKEW_X in e||t.DataParser.SKEW_Y in e)&&(i.rotation=t.Transform.normalizeRadian(n._getNumber(e,t.DataParser.SKEW_Y,0)*t.Transform.DEG_RAD),i.skew=t.Transform.normalizeRadian(n._getNumber(e,t.DataParser.SKEW_X,0)*t.Transform.DEG_RAD)-i.rotation),i.scaleX=n._getNumber(e,t.DataParser.SCALE_X,1),i.scaleY=n._getNumber(e,t.DataParser.SCALE_Y,1)},n.prototype._parseColorTransform=function(e,i){i.alphaMultiplier=.01*n._getNumber(e,t.DataParser.ALPHA_MULTIPLIER,100),i.redMultiplier=.01*n._getNumber(e,t.DataParser.RED_MULTIPLIER,100),i.greenMultiplier=.01*n._getNumber(e,t.DataParser.GREEN_MULTIPLIER,100),i.blueMultiplier=.01*n._getNumber(e,t.DataParser.BLUE_MULTIPLIER,100),i.alphaOffset=n._getNumber(e,t.DataParser.ALPHA_OFFSET,0),i.redOffset=n._getNumber(e,t.DataParser.RED_OFFSET,0),i.greenOffset=n._getNumber(e,t.DataParser.GREEN_OFFSET,0),i.blueOffset=n._getNumber(e,t.DataParser.BLUE_OFFSET,0)},n.prototype._parseArray=function(){this._intArray.length=0,this._floatArray.length=0,this._frameIntArray.length=0,this._frameFloatArray.length=0,this._frameArray.length=0,this._timelineArray.length=0},n.prototype._modifyArray=function(){this._intArray.length%Int16Array.BYTES_PER_ELEMENT!=0&&this._intArray.push(0),this._frameIntArray.length%Int16Array.BYTES_PER_ELEMENT!=0&&this._frameIntArray.push(0),this._frameArray.length%Int16Array.BYTES_PER_ELEMENT!=0&&this._frameArray.push(0),this._timelineArray.length%Uint16Array.BYTES_PER_ELEMENT!=0&&this._timelineArray.push(0);var e=this._intArray.length*Int16Array.BYTES_PER_ELEMENT,i=this._floatArray.length*Float32Array.BYTES_PER_ELEMENT,n=this._frameIntArray.length*Int16Array.BYTES_PER_ELEMENT,r=this._frameFloatArray.length*Float32Array.BYTES_PER_ELEMENT,s=this._frameArray.length*Int16Array.BYTES_PER_ELEMENT,a=this._timelineArray.length*Uint16Array.BYTES_PER_ELEMENT,o=e+i+n+r+s+a;if(t.DragonBones.webAssembly){for(var h=t.webAssemblyModule.HEAP16.buffer,u=t.webAssemblyModule._malloc(o),l=new Int16Array(h,u,this._intArray.length),c=new Float32Array(h,u+e,this._floatArray.length),_=new Int16Array(h,u+e+i,this._frameIntArray.length),f=new Float32Array(h,u+e+i+n,this._frameFloatArray.length),d=new Int16Array(h,u+e+i+n+r,this._frameArray.length),p=new Uint16Array(h,u+e+i+n+r+s,this._timelineArray.length),m=0,g=this._intArray.length;m<g;++m)l[m]=this._intArray[m];for(m=0,g=this._floatArray.length;m<g;++m)c[m]=this._floatArray[m];for(m=0,g=this._frameIntArray.length;m<g;++m)_[m]=this._frameIntArray[m];for(m=0,g=this._frameFloatArray.length;m<g;++m)f[m]=this._frameFloatArray[m];for(m=0,g=this._frameArray.length;m<g;++m)d[m]=this._frameArray[m];for(m=0,g=this._timelineArray.length;m<g;++m)p[m]=this._timelineArray[m];t.webAssemblyModule.setDataBinary(this._data,u,e,i,n,r,s,a)}else{var y=new ArrayBuffer(o);for(l=new Int16Array(y,0,this._intArray.length),c=new Float32Array(y,e,this._floatArray.length),_=new Int16Array(y,e+i,this._frameIntArray.length),f=new Float32Array(y,e+i+n,this._frameFloatArray.length),d=new Int16Array(y,e+i+n+r,this._frameArray.length),p=new Uint16Array(y,e+i+n+r+s,this._timelineArray.length),m=0,g=this._intArray.length;m<g;++m)l[m]=this._intArray[m];for(m=0,g=this._floatArray.length;m<g;++m)c[m]=this._floatArray[m];for(m=0,g=this._frameIntArray.length;m<g;++m)_[m]=this._frameIntArray[m];for(m=0,g=this._frameFloatArray.length;m<g;++m)f[m]=this._frameFloatArray[m];for(m=0,g=this._frameArray.length;m<g;++m)d[m]=this._frameArray[m];for(m=0,g=this._timelineArray.length;m<g;++m)p[m]=this._timelineArray[m];this._data.binary=y,this._data.intArray=l,this._data.floatArray=c,this._data.frameIntArray=_,this._data.frameFloatArray=f,this._data.frameArray=d,this._data.timelineArray=p}this._defaultColorOffset=-1},n.prototype.parseDragonBonesData=function(e,i){void 0===i&&(i=1),console.assert(null!=e,"Data error.");var r=n._getString(e,t.DataParser.VERSION,""),s=n._getString(e,t.DataParser.COMPATIBLE_VERSION,"");if(t.DataParser.DATA_VERSIONS.indexOf(r)>=0||t.DataParser.DATA_VERSIONS.indexOf(s)>=0){var a=t.BaseObject.borrowObject(t.DragonBonesData);if(a.version=r,a.name=n._getString(e,t.DataParser.NAME,""),a.frameRate=n._getNumber(e,t.DataParser.FRAME_RATE,24),0===a.frameRate&&(a.frameRate=24),t.DataParser.ARMATURE in e){this._data=a,this._parseArray(e);for(var o=0,h=e[t.DataParser.ARMATURE];o<h.length;o++){var u=h[o];a.addArmature(this._parseArmature(u,i))}this._data.binary||this._modifyArray(),t.DataParser.STAGE in e?a.stage=a.getArmature(n._getString(e,t.DataParser.STAGE,"")):a.armatureNames.length>0&&(a.stage=a.getArmature(a.armatureNames[0])),this._data=null}return t.DataParser.TEXTURE_ATLAS in e&&(this._rawTextureAtlases=e[t.DataParser.TEXTURE_ATLAS]),a}return console.assert(!1,"Nonsupport data version: "+r+"\nPlease convert DragonBones data to support version.\nRead more: https://github.com/DragonBones/Tools/"),null},n.prototype.parseTextureAtlasData=function(e,i,r){if(void 0===r&&(r=1),console.assert(void 0!==e),null===e){if(null===this._rawTextureAtlases||0===this._rawTextureAtlases.length)return!1;var s=this._rawTextureAtlases[this._rawTextureAtlasIndex++];return this.parseTextureAtlasData(s,i,r),this._rawTextureAtlasIndex>=this._rawTextureAtlases.length&&(this._rawTextureAtlasIndex=0,this._rawTextureAtlases=null),!0}if(i.width=n._getNumber(e,t.DataParser.WIDTH,0),i.height=n._getNumber(e,t.DataParser.HEIGHT,0),i.scale=1===r?1/n._getNumber(e,t.DataParser.SCALE,1):r,i.name=n._getString(e,t.DataParser.NAME,""),i.imagePath=n._getString(e,t.DataParser.IMAGE_PATH,""),t.DataParser.SUB_TEXTURE in e)for(var a=e[t.DataParser.SUB_TEXTURE],o=0,h=a.length;o<h;++o){var u=a[o],l=i.createTexture();l.rotated=n._getBoolean(u,t.DataParser.ROTATED,!1),l.name=n._getString(u,t.DataParser.NAME,""),l.region.x=n._getNumber(u,t.DataParser.X,0),l.region.y=n._getNumber(u,t.DataParser.Y,0),l.region.width=n._getNumber(u,t.DataParser.WIDTH,0),l.region.height=n._getNumber(u,t.DataParser.HEIGHT,0);var c=n._getNumber(u,t.DataParser.FRAME_WIDTH,-1),_=n._getNumber(u,t.DataParser.FRAME_HEIGHT,-1);c>0&&_>0&&(l.frame=t.TextureData.createRectangle(),l.frame.x=n._getNumber(u,t.DataParser.FRAME_X,0),l.frame.y=n._getNumber(u,t.DataParser.FRAME_Y,0),l.frame.width=c,l.frame.height=_),i.addTexture(l)}return!0},n.getInstance=function(){return null===n._objectDataParserInstance&&(n._objectDataParserInstance=new n),n._objectDataParserInstance},n._objectDataParserInstance=null,n}(t.DataParser);t.ObjectDataParser=e;var i=function(){this.frameStart=0,this.actions=[]};t.ActionFrame=i}(HZ||(HZ={})),function(t){var e=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return zZ(i,e),i.prototype._inRange=function(t,e,i){return e<=t&&t<=i},i.prototype._decodeUTF8=function(t){for(var e,i=0,n="",r=0,s=0,a=0,o=0;t.length>i;){var h=t[i++];if(-1===h)e=0!==s?65533:-1;else if(0===s)this._inRange(h,0,127)?e=h:(this._inRange(h,194,223)?(s=1,o=128,r=h-192):this._inRange(h,224,239)?(s=2,o=2048,r=h-224):this._inRange(h,240,244)&&(s=3,o=65536,r=h-240),r*=Math.pow(64,s),e=null);else if(this._inRange(h,128,191))if(a+=1,r+=(h-128)*Math.pow(64,s-a),a!==s)e=null;else{var u=r,l=o;r=0,s=0,a=0,o=0,e=this._inRange(u,l,1114111)&&!this._inRange(u,55296,57343)?u:h}else r=0,s=0,a=0,o=0,i--,e=h;null!==e&&-1!==e&&(e<=65535?e>0&&(n+=String.fromCharCode(e)):(e-=65536,n+=String.fromCharCode(55296+(e>>10&1023)),n+=String.fromCharCode(56320+(1023&e))))}return n},i.prototype._getUTF16Key=function(t){for(var e=0,i=t.length;e<i;++e)if(t.charCodeAt(e)>255)return encodeURI(t);return t},i.prototype._parseBinaryTimeline=function(e,i,n){void 0===n&&(n=null);var r=null!==n?n:t.BaseObject.borrowObject(t.TimelineData);r.type=e,r.offset=i,this._timeline=r;var s=this._timelineArrayBuffer[r.offset+2];if(1===s)r.frameIndicesOffset=-1;else{var a=0,o=this._animation.frameCount+1,h=this._data.frameIndices;t.DragonBones.webAssembly?(a=h.size(),h.resize(a+o,0)):(a=h.length,h.length+=o),r.frameIndicesOffset=a;for(var u=0,l=0,c=0,_=0;u<o;++u)c+_<=u&&l<s&&(c=this._frameArrayBuffer[this._animation.frameOffset+this._timelineArrayBuffer[r.offset+5+l]],_=l===s-1?this._animation.frameCount-c:this._frameArrayBuffer[this._animation.frameOffset+this._timelineArrayBuffer[r.offset+5+l+1]]-c,l++),t.DragonBones.webAssembly?h.set(a+u,l-1):h[a+u]=l-1}return this._timeline=null,r},i.prototype._parseVertices=function(e,i){i.offset=e[t.DataParser.OFFSET];var n=this._intArrayBuffer[i.offset+3];if(n>=0){var r=t.BaseObject.borrowObject(t.WeightData),s=this._intArrayBuffer[i.offset+0],a=this._intArrayBuffer[n+0];r.offset=n;for(var o=0;o<a;++o){var h=this._intArrayBuffer[n+2+o];r.addBone(this._rawBones[h])}for(var u=n+2+a,l=0,c=(o=0,s);o<c;++o){var _=this._intArrayBuffer[u++];l+=_,u+=_}r.count=l,i.weight=r}},i.prototype._parseMesh=function(t,e){this._parseVertices(t,e.vertices)},i.prototype._parsePath=function(t,e){this._parseVertices(t,e.vertices)},i.prototype._parseAnimation=function(e){var i=t.BaseObject.borrowObject(t.AnimationData);i.frameCount=Math.max(t.ObjectDataParser._getNumber(e,t.DataParser.DURATION,1),1),i.playTimes=t.ObjectDataParser._getNumber(e,t.DataParser.PLAY_TIMES,1),i.duration=i.frameCount/this._armature.frameRate,i.fadeInTime=t.ObjectDataParser._getNumber(e,t.DataParser.FADE_IN_TIME,0),i.scale=t.ObjectDataParser._getNumber(e,t.DataParser.SCALE,1),i.name=t.ObjectDataParser._getString(e,t.DataParser.NAME,t.DataParser.DEFAULT_NAME),0===i.name.length&&(i.name=t.DataParser.DEFAULT_NAME);var n=e[t.DataParser.OFFSET];if(i.frameIntOffset=n[0],i.frameFloatOffset=n[1],i.frameOffset=n[2],this._animation=i,t.DataParser.ACTION in e&&(i.actionTimeline=this._parseBinaryTimeline(0,e[t.DataParser.ACTION])),t.DataParser.Z_ORDER in e&&(i.zOrderTimeline=this._parseBinaryTimeline(1,e[t.DataParser.Z_ORDER])),t.DataParser.BONE in e){var r=e[t.DataParser.BONE];for(var s in r){var a=r[s];t.DragonBones.webAssembly&&(s=this._getUTF16Key(s));var o=this._armature.getBone(s);if(null!==o)for(var h=0,u=a.length;h<u;h+=2){var l=a[h],c=a[h+1],_=this._parseBinaryTimeline(l,c);this._animation.addBoneTimeline(o,_)}}}if(t.DataParser.SURFACE in e)for(var s in r=e[t.DataParser.SURFACE]){a=r[s],t.DragonBones.webAssembly&&(s=this._getUTF16Key(s));var f=this._armature.getBone(s);if(null!==f)for(h=0,u=a.length;h<u;h+=2)l=a[h],c=a[h+1],_=this._parseBinaryTimeline(l,c),this._animation.addSurfaceTimeline(f,_)}if(t.DataParser.SLOT in e)for(var s in r=e[t.DataParser.SLOT]){a=r[s],t.DragonBones.webAssembly&&(s=this._getUTF16Key(s));var d=this._armature.getSlot(s);if(null!==d)for(h=0,u=a.length;h<u;h+=2)l=a[h],c=a[h+1],_=this._parseBinaryTimeline(l,c),this._animation.addSlotTimeline(d,_)}if(t.DataParser.CONSTRAINT in e)for(var s in r=e[t.DataParser.CONSTRAINT]){a=r[s],t.DragonBones.webAssembly&&(s=this._getUTF16Key(s));var p=this._armature.getConstraint(s);if(null!==p)for(h=0,u=a.length;h<u;h+=2)l=a[h],c=a[h+1],_=this._parseBinaryTimeline(l,c),this._animation.addConstraintTimeline(p,_)}if(t.DataParser.ANIMATION in e)for(var s in r=e[t.DataParser.ANIMATION])for(a=r[s],t.DragonBones.webAssembly&&(s=this._getUTF16Key(s)),h=0,u=a.length;h<u;h+=2)l=a[h],c=a[h+1],_=this._parseBinaryTimeline(l,c),this._animation.addAnimationTimeline(s,_);return this._animation=null,i},i.prototype._parseArray=function(e){var i=e[t.DataParser.OFFSET],n=i[1],r=i[3],s=i[5],a=i[7],o=i[9],h=i[11],u=new Int16Array(this._binary,this._binaryOffset+i[0],n/Int16Array.BYTES_PER_ELEMENT),l=new Float32Array(this._binary,this._binaryOffset+i[2],r/Float32Array.BYTES_PER_ELEMENT),c=new Int16Array(this._binary,this._binaryOffset+i[4],s/Int16Array.BYTES_PER_ELEMENT),_=new Float32Array(this._binary,this._binaryOffset+i[6],a/Float32Array.BYTES_PER_ELEMENT),f=new Int16Array(this._binary,this._binaryOffset+i[8],o/Int16Array.BYTES_PER_ELEMENT),d=new Uint16Array(this._binary,this._binaryOffset+i[10],h/Uint16Array.BYTES_PER_ELEMENT);if(t.DragonBones.webAssembly){for(var p=n+r+s+a+o+h,m=t.webAssemblyModule._malloc(p),g=new Uint8Array(this._binary,this._binaryOffset,p/Uint8Array.BYTES_PER_ELEMENT),y=new Uint8Array(t.webAssemblyModule.HEAP16.buffer,m,g.length),v=0,S=g.length;v<S;++v)y[v]=g[v];t.webAssemblyModule.setDataBinary(this._data,m,n,r,s,a,o,h),this._intArrayBuffer=u,this._floatArrayBuffer=l,this._frameIntArrayBuffer=c,this._frameFloatArrayBuffer=_,this._frameArrayBuffer=f,this._timelineArrayBuffer=d}else this._data.binary=this._binary,this._data.intArray=this._intArrayBuffer=u,this._data.floatArray=this._floatArrayBuffer=l,this._data.frameIntArray=this._frameIntArrayBuffer=c,this._data.frameFloatArray=this._frameFloatArrayBuffer=_,this._data.frameArray=this._frameArrayBuffer=f,this._data.timelineArray=this._timelineArrayBuffer=d},i.prototype.parseDragonBonesData=function(t,i){void 0===i&&(i=1),console.assert(null!=t&&t instanceof ArrayBuffer,"Data error.");var n=new Uint8Array(t,0,8);if(n[0]!=="D".charCodeAt(0)||n[1]!=="B".charCodeAt(0)||n[2]!=="D".charCodeAt(0)||n[3]!=="T".charCodeAt(0))return console.assert(!1,"Nonsupport data."),null;var r=new Uint32Array(t,8,1)[0],s=new Uint8Array(t,12,r),a=this._decodeUTF8(s),o=JSON.parse(a);return this._binaryOffset=12+r,this._binary=t,e.prototype.parseDragonBonesData.call(this,o,i)},i.getInstance=function(){return null===i._binaryDataParserInstance&&(i._binaryDataParserInstance=new i),i._binaryDataParserInstance},i._binaryDataParserInstance=null,i}(t.ObjectDataParser);t.BinaryDataParser=e}(HZ||(HZ={})),function(t){var e=function(){function e(i){void 0===i&&(i=null),this.autoSearch=!1,this._dragonBonesDataMap={},this._textureAtlasDataMap={},this._dragonBones=null,this._dataParser=null,null===e._objectParser&&(e._objectParser=new t.ObjectDataParser),null===e._binaryParser&&(e._binaryParser=new t.BinaryDataParser),this._dataParser=null!==i?i:e._objectParser}return e.prototype._isSupportMesh=function(){return!0},e.prototype._getTextureData=function(t,e){if(t in this._textureAtlasDataMap)for(var i=0,n=this._textureAtlasDataMap[t];i<n.length;i++)if(null!==(h=(o=n[i]).getTexture(e)))return h;if(this.autoSearch)for(var r in this._textureAtlasDataMap)for(var s=0,a=this._textureAtlasDataMap[r];s<a.length;s++){var o,h;if((o=a[s]).autoSearch&&null!==(h=o.getTexture(e)))return h}return null},e.prototype._fillBuildArmaturePackage=function(t,e,i,n,r){var s=null,a=null;if(e.length>0&&e in this._dragonBonesDataMap&&(a=(s=this._dragonBonesDataMap[e]).getArmature(i)),null===a&&(0===e.length||this.autoSearch))for(var o in this._dragonBonesDataMap)if(s=this._dragonBonesDataMap[o],(0===e.length||s.autoSearch)&&null!==(a=s.getArmature(i))){e=o;break}if(null!==a){if(t.dataName=e,t.textureAtlasName=r,t.data=s,t.armature=a,t.skin=null,n.length>0&&(t.skin=a.getSkin(n),null===t.skin&&this.autoSearch))for(var o in this._dragonBonesDataMap){var h=this._dragonBonesDataMap[o].getArmature(n);if(null!==h){t.skin=h.defaultSkin;break}}return null===t.skin&&(t.skin=a.defaultSkin),!0}return!1},e.prototype._buildBones=function(e,i){for(var n=0,r=e.armature.sortedBones;n<r.length;n++){var s=r[n];t.BaseObject.borrowObject(0===s.type?t.Bone:t.Surface).init(s,i)}},e.prototype._buildSlots=function(e,i){var n=e.skin,r=e.armature.defaultSkin;if(null!==n&&null!==r){var s={};for(var a in r.displays){var o=r.getDisplays(a);s[a]=o}if(n!==r)for(var a in n.displays)o=n.getDisplays(a),s[a]=o;for(var h=0,u=e.armature.sortedSlots;h<u.length;h++){var l=u[h],c=l.name in s?s[l.name]:null,_=this._buildSlot(e,l,i);if(_.rawDisplayDatas=c,null!==c){for(var f=new Array,d=0,p=t.DragonBones.webAssembly?c.size():c.length;d<p;++d){var m=t.DragonBones.webAssembly?c.get(d):c[d];null!==m?f.push(this._getSlotDisplay(e,m,null,_)):f.push(null)}_._setDisplayList(f)}_._setDisplayIndex(l.displayIndex,!0)}}},e.prototype._buildConstraints=function(e,i){var n=e.armature.constraints;for(var r in n){var s=n[r];switch(s.type){case 0:var a=t.BaseObject.borrowObject(t.IKConstraint);a.init(s,i),i._addConstraint(a);break;case 1:var o=t.BaseObject.borrowObject(t.PathConstraint);o.init(s,i),i._addConstraint(o);break;default:var h=t.BaseObject.borrowObject(t.IKConstraint);h.init(s,i),i._addConstraint(h)}}},e.prototype._buildChildArmature=function(t,e,i){return this.buildArmature(i.path,null!==t?t.dataName:"","",null!==t?t.textureAtlasName:"")},e.prototype._getSlotDisplay=function(e,i,n,r){var s=null!==e?e.dataName:i.parent.parent.parent.name,a=null;switch(i.type){case 0:var o=i;null!==e&&e.textureAtlasName.length>0&&(o.texture=this._getTextureData(e.textureAtlasName,i.path)),null===o.texture&&(o.texture=this._getTextureData(s,i.path)),a=null!==n&&2===n.type&&this._isSupportMesh()?r.meshDisplay:r.rawDisplay;break;case 2:var h=i;null!==e&&e.textureAtlasName.length>0&&(h.texture=this._getTextureData(e.textureAtlasName,h.path)),null===h.texture&&(h.texture=this._getTextureData(s,h.path)),a=this._isSupportMesh()?r.meshDisplay:r.rawDisplay;break;case 1:var u=i,l=this._buildChildArmature(e,r,i);if(null!==l){if(l.inheritAnimation=u.inheritAnimation,!l.inheritAnimation){var c=u.actions.length>0?u.actions:l.armatureData.defaultActions;if(c.length>0)for(var _=0,f=c;_<f.length;_++){var d=f[_],p=t.BaseObject.borrowObject(t.EventObject);t.EventObject.actionDataToInstance(d,p,r.armature),p.slot=r,r.armature._bufferAction(p,!1)}else l.animation.play()}u.armature=l.armatureData}a=l}return a},e.prototype.parseDragonBonesData=function(t,i,n){void 0===i&&(i=null),void 0===n&&(n=1);for(var r=t instanceof ArrayBuffer?e._binaryParser:this._dataParser,s=r.parseDragonBonesData(t,n);;){var a=this._buildTextureAtlasData(null,null);if(!r.parseTextureAtlasData(null,a,n)){a.returnToPool();break}this.addTextureAtlasData(a,i)}return null!==s&&this.addDragonBonesData(s,i),s},e.prototype.parseTextureAtlasData=function(t,e,i,n){void 0===i&&(i=null),void 0===n&&(n=1);var r=this._buildTextureAtlasData(null,null);return this._dataParser.parseTextureAtlasData(t,r,n),this._buildTextureAtlasData(r,e||null),this.addTextureAtlasData(r,i),r},e.prototype.updateTextureAtlasData=function(t,e){var i=this.getTextureAtlasData(t);if(null!==i)for(var n=0,r=i.length;n<r;++n)n<e.length&&this._buildTextureAtlasData(i[n],e[n])},e.prototype.getDragonBonesData=function(t){return t in this._dragonBonesDataMap?this._dragonBonesDataMap[t]:null},e.prototype.addDragonBonesData=function(t,e){if(void 0===e&&(e=null),(e=null!==e?e:t.name)in this._dragonBonesDataMap){if(this._dragonBonesDataMap[e]===t)return;console.warn("Can not add same name data: "+e)}else this._dragonBonesDataMap[e]=t},e.prototype.removeDragonBonesData=function(t,e){void 0===e&&(e=!0),t in this._dragonBonesDataMap&&(e&&this._dragonBones.bufferObject(this._dragonBonesDataMap[t]),delete this._dragonBonesDataMap[t])},e.prototype.getTextureAtlasData=function(t){return t in this._textureAtlasDataMap?this._textureAtlasDataMap[t]:null},e.prototype.addTextureAtlasData=function(t,e){void 0===e&&(e=null);var i=(e=null!==e?e:t.name)in this._textureAtlasDataMap?this._textureAtlasDataMap[e]:this._textureAtlasDataMap[e]=[];i.indexOf(t)<0&&i.push(t)},e.prototype.removeTextureAtlasData=function(t,e){if(void 0===e&&(e=!0),t in this._textureAtlasDataMap){var i=this._textureAtlasDataMap[t];if(e)for(var n=0,r=i;n<r.length;n++){var s=r[n];this._dragonBones.bufferObject(s)}delete this._textureAtlasDataMap[t]}},e.prototype.getArmatureData=function(t,e){void 0===e&&(e="");var n=new i;return this._fillBuildArmaturePackage(n,e,t,"","")?n.armature:null},e.prototype.clear=function(t){for(var e in void 0===t&&(t=!0),this._dragonBonesDataMap)t&&this._dragonBones.bufferObject(this._dragonBonesDataMap[e]),delete this._dragonBonesDataMap[e];for(var e in this._textureAtlasDataMap){if(t)for(var i=0,n=this._textureAtlasDataMap[e];i<n.length;i++){var r=n[i];this._dragonBones.bufferObject(r)}delete this._textureAtlasDataMap[e]}},e.prototype.buildArmature=function(t,e,n,r){void 0===e&&(e=""),void 0===n&&(n=""),void 0===r&&(r="");var s=new i;if(!this._fillBuildArmaturePackage(s,e||"",t,n||"",r||""))return console.warn("No armature data: "+t+", "+(null!==e?e:"")),null;var a=this._buildArmature(s);return this._buildBones(s,a),this._buildSlots(s,a),this._buildConstraints(s,a),a.invalidUpdate(null,!0),a.advanceTime(0),a},e.prototype.replaceDisplay=function(e,i,n){void 0===n&&(n=-1),n<0&&(n=e.displayIndex),n<0&&(n=0),e.replaceDisplayData(i,n);var r=e.displayList;if(r.length<=n){r.length=n+1;for(var s=0,a=r.length;s<a;++s)r[s]||(r[s]=null)}if(null!==i){var o=e.rawDisplayDatas,h=null;o&&(t.DragonBones.webAssembly?n<o.size()&&(h=o.get(n)):n<o.length&&(h=o[n])),r[n]=this._getSlotDisplay(null,i,h,e)}else r[n]=null;e.displayList=r},e.prototype.replaceSlotDisplay=function(t,e,i,n,r,s){void 0===s&&(s=-1);var a=this.getArmatureData(e,t||"");if(!a||!a.defaultSkin)return!1;var o=a.defaultSkin.getDisplay(i,n);return!!o&&(this.replaceDisplay(r,o,s),!0)},e.prototype.replaceSlotDisplayList=function(e,i,n,r){var s=this.getArmatureData(i,e||"");if(!s||!s.defaultSkin)return!1;var a=s.defaultSkin.getDisplays(n);if(!a)return!1;for(var o=0,h=0,u=t.DragonBones.webAssembly?a.size():a.length;h<u;++h){var l=t.DragonBones.webAssembly?a.get(h):a[h];this.replaceDisplay(r,l,o++)}return!0},e.prototype.replaceSkin=function(e,i,n,r){void 0===n&&(n=!1),void 0===r&&(r=null);for(var s=!1,a=i.parent.defaultSkin,o=0,h=e.getSlots();o<h.length;o++){var u=h[o];if(!(null!==r&&r.indexOf(u.name)>=0)){var l=i.getDisplays(u.name);if(l||(null!==a&&i!==a&&(l=a.getDisplays(u.name)),l)){var c=t.DragonBones.webAssembly?l.size():l.length,_=u.displayList;_.length=c;for(var f=0,d=c;f<d;++f){var p=t.DragonBones.webAssembly?l.get(f):l[f];_[f]=null!==p?this._getSlotDisplay(null,p,null,u):null}s=!0,u.rawDisplayDatas=l,u.displayList=_}else n&&(u.rawDisplayDatas=null,u.displayList=[])}}return s},e.prototype.replaceAnimation=function(e,i,n){void 0===n&&(n=!0);var r=i.defaultSkin;if(null===r)return!1;if(n)e.animation.animations=i.animations;else{var s=e.animation.animations,a={};for(var o in s)a[o]=s[o];for(var o in i.animations)a[o]=i.animations[o];e.animation.animations=a}for(var h=0,u=e.getSlots();h<u.length;h++)for(var l=u[h],c=0,_=0,f=l.displayList;_<f.length;_++){var d=f[_];if(d instanceof t.Armature){var p=r.getDisplays(l.name);if(null!==p&&c<(t.DragonBones.webAssembly?p.size():p.length)){var m=t.DragonBones.webAssembly?p.get(c):p[c];if(null!==m&&1===m.type){var g=this.getArmatureData(m.path,m.parent.parent.parent.name);g&&this.replaceAnimation(d,g,n)}}}c++}return!0},e.prototype.getAllDragonBonesData=function(){return this._dragonBonesDataMap},e.prototype.getAllTextureAtlasData=function(){return this._textureAtlasDataMap},Object.defineProperty(e.prototype,"clock",{get:function(){return this._dragonBones.clock},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dragonBones",{get:function(){return this._dragonBones},enumerable:!0,configurable:!0}),e.prototype.changeSkin=function(t,e,i){return void 0===i&&(i=null),this.replaceSkin(t,e,!1,i)},e.prototype.copyAnimationsToArmature=function(t,e,i,n,r){void 0===n&&(n=""),void 0===r&&(r=!0);var s=this.getArmatureData(e,n);return!!s&&this.replaceAnimation(t,s,r)},e._objectParser=null,e._binaryParser=null,e}();t.BaseFactory=e;var i=function(){this.dataName="",this.textureAtlasName="",this.skin=null};t.BuildArmaturePackage=i}(HZ||(HZ={})),function(t){t.BinaryOffset={WeigthBoneCount:0,WeigthFloatOffset:1,WeigthBoneIndices:2,MeshVertexCount:0,MeshTriangleCount:1,MeshFloatOffset:2,MeshWeightOffset:3,MeshVertexIndices:4,TimelineScale:0,TimelineOffset:1,TimelineKeyFrameCount:2,TimelineFrameValueCount:3,TimelineFrameValueOffset:4,TimelineFrameOffset:5,FramePosition:0,FrameTweenType:1,FrameTweenEasingOrCurveSampleCount:2,FrameCurveSamples:3,DeformMeshOffset:0,DeformCount:1,DeformValueCount:2,DeformValueOffset:3,DeformFloatOffset:4},t.ArmatureType={Armature:0,MovieClip:1,Stage:2},t.BoneType={Bone:0,Surface:1},t.DisplayType={Image:0,Armature:1,Mesh:2,BoundingBox:3},t.BoundingBoxType={Rectangle:0,Ellipse:1,Polygon:2},t.ActionType={Play:0,Stop:1,GotoAndPlay:2,GotoAndStop:3,FadeIn:4,FadeOut:5,Frame:10,Sound:11},t.BlendMode={Normal:0,Add:1,Alpha:2,Darken:3,Difference:4,Erase:5,HardLight:6,Invert:7,Layer:8,Lighten:9,Multiply:10,Overlay:11,Screen:12,Subtract:13},t.TweenType={None:0,Line:1,Curve:2,QuadIn:3,QuadOut:4,QuadInOut:5},t.TimelineType={Action:0,ZOrder:1,BoneAll:10,BoneTranslate:11,BoneRotate:12,BoneScale:13,Surface:50,SlotDisplay:20,SlotColor:21,SlotFFD:22,IKConstraint:30,AnimationTime:40,AnimationWeight:41}}(HZ||(HZ={}));var WZ,XZ,jZ,YZ,qZ,KZ,JZ,QZ,ZZ,$Z,t$,e$=HZ.DragonBones,i$=HZ.BaseObject,n$=HZ.Matrix,r$=HZ.Transform,s$=HZ.ColorTransform,a$=HZ.Point,o$=HZ.Rectangle,h$=HZ.UserData,u$=HZ.ActionData,l$=HZ.DragonBonesData,c$=HZ.ArmatureData,_$=HZ.BoneData,f$=HZ.SurfaceData,d$=HZ.SlotData,p$=HZ.ConstraintData,m$=HZ.IKConstraintData,g$=HZ.PathConstraintData,y$=HZ.CanvasData,v$=HZ.SkinData,S$=HZ.VerticesData,A$=HZ.DisplayData,T$=HZ.ImageDisplayData,E$=HZ.ArmatureDisplayData,b$=HZ.MeshDisplayData,x$=HZ.BoundingBoxDisplayData,C$=HZ.PathDisplayData,R$=HZ.WeightData,w$=HZ.BoundingBoxData,I$=HZ.RectangleBoundingBoxData,B$=HZ.EllipseBoundingBoxData,D$=HZ.PolygonBoundingBoxData,P$=HZ.AnimationData,O$=HZ.TimelineData,M$=HZ.AnimationConfig,N$=HZ.TextureAtlasData,L$=HZ.TextureData,F$=HZ.DeformVertices,k$=HZ.Armature,G$=HZ.TransformObject,V$=HZ.Bone,U$=HZ.Surface,z$=HZ.Slot,H$=HZ.Constraint,W$=HZ.IKConstraint,X$=HZ.PathConstraint,j$=HZ.WorldClock,Y$=HZ.Animation,q$=HZ.AnimationState,K$=HZ.BonePose,J$=HZ.BlendState,Q$=HZ.TimelineState,Z$=HZ.TweenTimelineState,$$=HZ.BoneTimelineState,t0=HZ.SlotTimelineState,e0=HZ.ConstraintTimelineState,i0=HZ.ActionTimelineState,n0=HZ.ZOrderTimelineState,r0=HZ.BoneAllTimelineState,s0=HZ.BoneTranslateTimelineState,a0=HZ.BoneRotateTimelineState,o0=HZ.BoneScaleTimelineState,h0=HZ.SurfaceTimelineState,u0=HZ.SlotDislayTimelineState,l0=HZ.SlotColorTimelineState,c0=HZ.DeformTimelineState,_0=HZ.IKConstraintTimelineState,f0=HZ.AnimationTimelineState,d0=HZ.EventObject,p0=HZ.DataParser,m0=HZ.ObjectDataParser,g0=HZ.ActionFrame,y0=HZ.BinaryDataParser,v0=HZ.BaseFactory,S0=HZ.BuildArmaturePackage,A0=HZ.BinaryOffset,T0=HZ.ArmatureType,E0=HZ.BoneType,b0=HZ.DisplayType,x0=HZ.BoundingBoxType,C0=HZ.ActionType,R0=HZ.BlendMode,w0=HZ.TweenType,I0=HZ.TimelineType,B0=Is,D0=B0("dragonBones.CCTextureAtlasData")(WZ=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._renderTexture=null,e}s(e,t),e.toString=function(){return"[class dragonBones.CCTextureAtlasData]"};var i=e.prototype;return i.createTexture=function(){return i$.borrowObject(P0)},i._onClear=function(){t.prototype._onClear.call(this),this.renderTexture=null},n(e,[{key:"renderTexture",get:function(){return this._renderTexture},set:function(t){if(this._renderTexture=t,t)for(var e in this.textures){var i=this.textures[e];if(!i.spriteFrame){var n=null;i.rotated?n=new En(i.region.x,i.region.y,i.region.height,i.region.width):(n=new En(i.region.x,i.region.y,i.region.width,i.region.height),i.spriteFrame=new lL,i.spriteFrame.texture=t,i.spriteFrame.rect=n)}}else for(var r in this.textures)this.textures[r].spriteFrame=null}}]),e}(N$))||WZ,P0=B0("dragonBones.CCTextureData")(XZ=function(t){function e(){for(var e,i=arguments.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=null,e}return s(e,t),e.toString=function(){return"[class dragonBones.CCTextureData]"},e.prototype._onClear=function(){t.prototype._onClear.call(this),this.spriteFrame=null},e}(L$))||XZ,O0=Is("dragonBones.CCSlot")(jZ=function(t){function e(){var e;return(e=t.call(this)||this)._localVertices=void 0,e._indices=void 0,e._matrix=void 0,e._worldMatrix=void 0,e._worldMatrixDirty=void 0,e._color=void 0,e._localVertices=[],e._indices=[],e._matrix=new fn,e._worldMatrix=new fn,e._worldMatrixDirty=!0,e._visible=!1,e._color=new Zi,e}s(e,t),e.toString=function(){return"[class dragonBones.CCSlot]"};var i=e.prototype;return i.getTexture=function(){return this._textureData?this._textureData.spriteFrame.texture:null},i.calculWorldMatrix=function(){var t=this._armature._parent;t?this._mulMat(this._worldMatrix,t._worldMatrix,this._matrix):fn.copy(this._worldMatrix,this._matrix),this._worldMatrixDirty=!1},i._onClear=function(){t.prototype._onClear.call(this),this._localVertices.length=0,this._indices.length=0,fn.identity(this._matrix),fn.identity(this._worldMatrix),this._worldMatrixDirty=!0,this._color=new Zi,this._visible=!1},i._onUpdateDisplay=function(){},i._initDisplay=function(){},i._addDisplay=function(){this._visible=!0},i._replaceDisplay=function(){},i._removeDisplay=function(){this._visible=!1},i._disposeDisplay=function(){},i._updateVisible=function(){this._visible=this.parent.visible},i._updateGlueMesh=function(){},i._updateZOrder=function(){},i._updateBlendMode=function(){if(this._childArmature)for(var t=this._childArmature.getSlots(),e=0,i=t.length;e<i;e++){var n=t[e];n._blendMode=this._blendMode,n._updateBlendMode()}},i._updateColor=function(){var t=this._color;t.r=255*this._colorTransform.redMultiplier,t.g=255*this._colorTransform.greenMultiplier,t.b=255*this._colorTransform.blueMultiplier,t.a=255*this._colorTransform.alphaMultiplier},i._updateFrame=function(){this._indices.length=0;var t=this._indices,e=this._localVertices,i=0,n=0,r=this._textureData;if(this._display&&!(this._displayIndex<0)&&r&&r.spriteFrame){var s=r.spriteFrame.texture,a=s.width,o=s.height,h=r.region;if(0!==a&&0!==o){var u=null!==this._deformVertices&&this._display===this._meshDisplay?this._deformVertices.verticesData:null;if(u){var l=u.data,c=l.intArray,_=l.floatArray,f=c[u.offset+A0.MeshVertexCount],d=c[u.offset+A0.MeshTriangleCount],p=c[u.offset+A0.MeshFloatOffset];p<0&&(p+=65536);for(var m=p+2*f,g=this._armature._armatureData.scale,y=0,v=2*f;y<v;y+=2)e[n++]=_[p+y]*g,e[n++]=-_[p+y+1]*g,u.rotated?(e[n++]=(h.x+(1-_[m+y])*h.width)/a,e[n++]=(h.y+_[m+y+1]*h.height)/o):(e[n++]=(h.x+_[m+y]*h.width)/a,e[n++]=(h.y+_[m+y+1]*h.height)/o);for(var S=0;S<3*d;++S)t[i++]=c[u.offset+A0.MeshVertexIndices+S];e.length=n,t.length=i,u.weight&&this._identityTransform()}else{var A=h.x/a,T=(h.y+h.height)/o,E=(h.x+h.width)/a,b=h.y/o;e[n++]=0,e[n++]=0,e[n++]=A,e[n++]=T,e[n++]=h.width,e[n++]=0,e[n++]=E,e[n++]=T,e[n++]=0,e[n++]=h.height,e[n++]=A,e[n++]=b,e[n++]=h.width,e[n++]=h.height,e[n++]=E,e[n++]=b,t[0]=0,t[1]=1,t[2]=2,t[3]=1,t[4]=3,t[5]=2,e.length=n,t.length=6}this._visibleDirty=!0,this._blendModeDirty=!0,this._colorDirty=!0}else console.error("SpriteFrame "+r.spriteFrame.name+" incorrect size "+a+" x "+o)}},i._updateMesh=function(){var t=this._armature._armatureData.scale,e=this._deformVertices.vertices,i=this._deformVertices.bones,n=this._deformVertices.verticesData,r=n.weight,s=e.length>0&&n.inheritDeform,a=this._localVertices;if(r){var o=n.data,h=o.intArray,u=o.floatArray,l=h[n.offset+A0.MeshVertexCount],c=h[r.offset+A0.WeigthFloatOffset];c<0&&(c+=65536);for(var _=0,f=r.offset+A0.WeigthBoneIndices+i.length,d=c,p=0,m=0;_<l;_++,m+=4){for(var g=h[f++],y=0,v=0,S=0;S<g;++S){var A=i[h[f++]];if(null!==A){var T=A.globalTransformMatrix,E=u[d++],b=u[d++]*t,x=u[d++]*t;s&&(b+=e[p++],x+=e[p++]),y+=(T.a*b+T.c*x+T.tx)*E,v+=(T.b*b+T.d*x+T.ty)*E}}a[m]=y,a[m+1]=-v}}else if(s){var C=this._parent._boneData.type!==E0.Bone,R=n.data,w=R.intArray,I=R.floatArray,B=w[n.offset+A0.MeshVertexCount],D=w[n.offset+A0.MeshFloatOffset];D<0&&(D+=65536);for(var P=0,O=B,M=0;P<O;P++,M+=4){var N=I[D+2*P]*t+e[2*P],L=I[D+2*P+1]*t+e[2*P+1];if(C){var F=this._parent._getGlobalTransformMatrix(N,L);a[M]=F.a*N+F.c*L+F.tx,a[M+1]=-F.b*N+F.d*L+F.ty}else a[M]=N,a[M+1]=-L}}r&&this._identityTransform()},i._identityTransform=function(){var t=this._matrix;t.m00=1,t.m01=0,t.m04=-0,t.m05=-1,t.m12=0,t.m13=0,this._worldMatrixDirty=!0},i._updateTransform=function(){var t=this._matrix;t.m00=this.globalTransformMatrix.a,t.m01=this.globalTransformMatrix.b,t.m04=-this.globalTransformMatrix.c,t.m05=-this.globalTransformMatrix.d,this._childArmature?(t.m12=this.globalTransformMatrix.tx,t.m13=this.globalTransformMatrix.ty):(t.m12=this.globalTransformMatrix.tx-(this.globalTransformMatrix.a*this._pivotX-this.globalTransformMatrix.c*this._pivotY),t.m13=this.globalTransformMatrix.ty-(this.globalTransformMatrix.b*this._pivotX-this.globalTransformMatrix.d*this._pivotY)),this._worldMatrixDirty=!0},i.updateWorldMatrix=function(){if(this._armature){var t=this._armature._parent;if(t&&t.updateWorldMatrix(),this._worldMatrixDirty){this.calculWorldMatrix();var e=this.childArmature;if(!e)return;for(var i=e.getSlots(),n=0,r=i.length;n<r;n++){var s=i[n];s&&(s._worldMatrixDirty=!0)}}}},i._mulMat=function(t,e,i){var n=e.m00,r=e.m01,s=e.m04,a=e.m05,o=e.m12,h=e.m13,u=i.m00,l=i.m01,c=i.m04,_=i.m05,f=i.m12,d=i.m13;0!==r||0!==s?(t.m00=u*n+l*s,t.m01=u*r+l*a,t.m04=c*n+_*s,t.m05=c*r+_*a,t.m12=n*f+s*d+o,t.m13=r*f+a*d+h):(t.m00=u*n,t.m01=l*a,t.m04=c*n,t.m05=_*a,t.m12=n*f+o,t.m13=a*d+h)},e}(z$))||jZ,M0=Is("dragonBones.CCArmatureDisplay")(YZ=function(t){function e(){var e;return(e=t.call(this)||this).shouldAdvanced=!1,e._ccNode=null,e._ccComponent=null,e._eventTarget=void 0,e._armature=null,e._eventTarget=new Du,e}s(e,t);var i=e.prototype;return i.hasEvent=function(){return console.warn("Method not implemented."),!1},i.addEvent=function(){console.warn("Method not implemented.")},i.removeEvent=function(){console.warn("Method not implemented.")},i.setEventTarget=function(t){this._eventTarget=t},i.getRootDisplay=function(){var t,e=this._armature._parent;if(!e)return this;for(;e;)t=e,e=e._armature._parent;return t._armature.display},i.convertToRootSpace=function(t){var e=this._armature._parent;if(!e)return t;e.updateWorldMatrix();var i=e._worldMatrix,n=new Yi(0,0);return n.x=t.x*i.m00+t.y*i.m04+i.m12,n.y=t.x*i.m01+t.y*i.m05+i.m13,n},i.convertToWorldSpace=function(t){var e,i=this.convertToRootSpace(t),n=this.getRootNode();return null==n||null===(e=n._uiProps.uiTransformComp)||void 0===e?void 0:e.convertToWorldSpaceAR(i)},i.getRootNode=function(){var t=this.getRootDisplay();return t&&t._ccNode},i.dbInit=function(t){this._armature=t},i.dbClear=function(){this._armature=null},i.dbUpdate=function(){this._ccComponent&&this._ccComponent.markForUpdateRenderData()},i.advanceTimeBySelf=function(t){this.shouldAdvanced=!!t},i.hasDBEventListener=function(t){return this._eventTarget.hasEventListener(t)},i.addDBEventListener=function(t,e,i){this._eventTarget.on(t,e,i)},i.removeDBEventListener=function(t,e,i){this._eventTarget.off(t,e,i)},i.dispatchDBEvent=function(t,e){this._eventTarget.emit(t,e)},n(e,[{key:"node",get:function(){return this}}]),e}(A$))||YZ,N0=Is("CCFactory")(((KZ=function(t){function e(){var e;(e=t.call(this)||this).id=void 0,e.uuid=void 0,e._slots=void 0;var i=new M0;return e._dragonBones=new e$(i),vN.getScheduler()&&(xN.on(bN.EVENT_RESTART,e.onRestart,c(e)),e.initUpdate()),e.id=e.uuid="CCFactory",e}s(e,t),e.getInstance=function(){return e._factory||(e._factory=new e),e._factory};var i=e.prototype;return i.onRestart=function(){e._factory=null},i.initUpdate=function(){Au.enableForTarget(this),vN.getScheduler().scheduleUpdate(this,pu.Priority.HIGH,!1)},i.update=function(t){this._dragonBones.advanceTime(t)},i.getDragonBonesDataByRawData=function(t){return(t instanceof ArrayBuffer?v0._binaryParser:this._dataParser).parseDragonBonesData(t,1)},i.buildArmatureDisplay=function(t,e,i,n){var r=this.buildArmature(t,e,i,n);return r?r._display:null},i.createArmatureNode=function(t,e,i){var n=(i=i||new Pm).getComponent("dragonBones.ArmatureDisplay");return n||(n=i.addComponent("dragonBones.ArmatureDisplay")),i.name=e,n._armatureName=e,n._dragonAsset=t.dragonAsset,n._dragonAtlasAsset=t.dragonAtlasAsset,n._init(),n},i._buildTextureAtlasData=function(t,e){return t?t.renderTexture=e:t=i$.borrowObject(D0),t},i._sortSlots=function(){for(var t=this._slots,e=[],i=0,n=t.length;i<n;i++){for(var r=t[i],s=r._zOrder,a=!1,o=e.length-1;o>=0;o--)if(s>=e[o]._zOrder){e.splice(o+1,0,r),a=!0;break}a||e.unshift(r)}this._slots=e},i._buildArmature=function(t){var e=i$.borrowObject(k$);e._skinData=t.skin,e._animation=i$.borrowObject(Y$),e._animation._armature=e,e._animation.animations=t.armature.animations,e._isChildArmature=!1;var i=new M0;return e.init(t.armature,i,i,this._dragonBones),e},i._buildSlot=function(t,e,i){var n=i$.borrowObject(O0),r=n;return n.init(e,i,r,r),n},i.getDragonBonesDataByUUID=function(t){for(var e in this._dragonBonesDataMap)if(-1!==e.indexOf(t))return this._dragonBonesDataMap[e];return null},i.removeDragonBonesDataByUUID=function(t,e){for(var i in void 0===e&&(e=!0),this._dragonBonesDataMap)-1!==i.indexOf(t)&&(e&&this._dragonBones.bufferObject(this._dragonBonesDataMap[i]),delete this._dragonBonesDataMap[i])},e}(v0))._factory=null,qZ=KZ))||qZ,L0=1/60,F0=[],k0=[],G0=0,V0=0,U0=0,z0=null,H0=null,W0=0,X0=0,j0=0,Y0=0,q0=0,K0=function(){function t(){this.maxVertexCount=0,this.maxIndexCount=0,this._privateMode=!1,this._inited=!1,this._invalid=!0,this._enableCacheAttachedInfo=!1,this.frames=[],this.totalTime=0,this.isCompleted=!1,this._frameIdx=-1,this._armatureInfo=null,this._animationName=null,this._tempSegments=null,this._tempColors=null,this._tempBoneInfos=null}var e=t.prototype;return e.init=function(t,e){this._inited=!0,this._armatureInfo=t,this._animationName=e},e.clear=function(){this._inited=!1;for(var t=0,e=this.frames.length;t<e;t++)this.frames[t].segments.length=0;this.invalidAllFrame()},e.begin=function(){if(this._invalid){var t=this._armatureInfo,e=t.curAnimationCache;e&&e!==this&&(this._privateMode?e.invalidAllFrame():e.updateToFrame()),t.armature.animation.play(this._animationName,1),t.curAnimationCache=this,this._invalid=!1,this._frameIdx=-1,this.totalTime=0,this.isCompleted=!1}},e.end=function(){this._needToUpdate()||(this._armatureInfo.curAnimationCache=null,this.frames.length=this._frameIdx+1,this.isCompleted=!0)},e._needToUpdate=function(t){return!this._armatureInfo.armature.animation.isCompleted&&this.totalTime<30&&(void 0===t||this._frameIdx<t)},e.updateToFrame=function(t){if(this._inited&&(this.begin(),this._needToUpdate(t))){var e=this._armatureInfo.armature;do{e.advanceTime(L0),this._frameIdx++,this.updateFrame(e,this._frameIdx),this.totalTime+=L0}while(this._needToUpdate(t));this.end()}},e.isInited=function(){return this._inited},e.isInvalid=function(){return this._invalid},e.invalidAllFrame=function(){this.isCompleted=!1,this._invalid=!0},e.updateAllFrame=function(){this.invalidAllFrame(),this.updateToFrame()},e.enableCacheAttachedInfo=function(){this._enableCacheAttachedInfo||(this._enableCacheAttachedInfo=!0,this.invalidAllFrame())},e.updateFrame=function(t,e){U0=0,G0=0,V0=0,z0=null,H0=null,W0=0,X0=0,j0=0,Y0=0,q0=0,this.frames[e]=this.frames[e]||{segments:[],colors:[],boneInfos:[],vertices:new Float32Array,uintVert:new Uint32Array,indices:new Uint16Array};var i=this.frames[e],n=this._tempSegments=i.segments,r=this._tempColors=i.colors,s=this._tempBoneInfos=i.boneInfos;this._traverseArmature(t,1),Y0>0&&(r[Y0-1].vfOffset=U0),r.length=Y0,s.length=G0;var a=j0-1;if(a>=0)if(X0>0){var o=n[a];o.indexCount=X0,o.vfCount=9*W0,o.vertexCount=W0,n.length=j0}else n.length=j0-1;if(0!==n.length){var h,u=i.vertices,l=U0/5,c=9*l;(!u||u.length<U0)&&(u=i.vertices=new Float32Array(c));for(var _=0,f=0;_<c;)u[_]=F0[f++],u[_+1]=F0[f++],u[_+3]=F0[f++],u[_+4]=F0[f++],h=F0[f++],u[_+5]=(255&h)/255,u[_+6]=(h>>8&255)/255,u[_+7]=(h>>16&255)/255,u[_+8]=(h>>24&255)/255,_+=9;var d=i.indices;(!d||d.length<V0)&&(d=i.indices=new Uint16Array(V0));for(var p=0;p<V0;p++)d[p]=k0[p];i.vertices=u,i.indices=d,this.maxVertexCount=l>this.maxVertexCount?l:this.maxVertexCount,this.maxIndexCount=d.length>this.maxIndexCount?d.length:this.maxIndexCount}},e._traverseArmature=function(t,e){var i,n,r,s,a,o,h,u,l,c=this._tempColors,_=this._tempSegments,f=this._tempBoneInfos,d=t._slots,p=t._bones;if(this._enableCacheAttachedInfo)for(var m=0,g=p.length;m<g;m++,G0++){var y=p[m],v=f[G0];v||(v=f[G0]={globalTransformMatrix:new n$});var S=y.globalTransformMatrix;v.globalTransformMatrix.copyFrom(S)}for(var A=0,T=d.length;A<T;A++)if((r=d[A])._visible&&r._displayData)if(r.updateWorldMatrix(),a=r._color,r.childArmature)this._traverseArmature(r.childArmature,e*a.a/255);else if(h=r.getTexture()){z0===h.nativeUrl&&H0===r._blendMode||(z0=h.nativeUrl,H0=r._blendMode,(u=j0-1)>=0&&(X0>0?((l=_[u]).indexCount=X0,l.vertexCount=W0,l.vfCount=9*W0):j0--),_[j0]={tex:h,blendMode:r._blendMode,indexCount:0,vertexCount:0,vfCount:0},j0++,X0=0,W0=0),o=(a.a*e<<24>>>0)+(a.b<<16)+(a.g<<8)+a.r,q0!==o&&(q0=o,Y0>0&&(c[Y0-1].vfOffset=U0),c[Y0++]={r:a.r,g:a.g,b:a.b,a:a.a*e,vfOffset:0}),i=r._localVertices,n=r._indices,s=r._worldMatrix;for(var E=0,b=i.length;E<b;)JZ=i[E++],QZ=i[E++],F0[U0++]=JZ*s.m00+QZ*s.m04+s.m12,F0[U0++]=JZ*s.m01+QZ*s.m05+s.m13,F0[U0++]=i[E++],F0[U0++]=i[E++],F0[U0++]=o;for(var x=0,C=n.length;x<C;x++)k0[V0++]=W0+n[x];X0+=n.length,W0+=i.length/4}},t}(),J0=function(){function t(){this._privateMode=!1,this._animationPool={},this._armatureCache={}}var e=t.prototype;return e.enablePrivateMode=function(){this._privateMode=!0},e.dispose=function(){for(var t in this._armatureCache){var e=this._armatureCache[t];if(e){var i=e.armature;i&&i.dispose()}}this._armatureCache={},this._animationPool={}},e._removeArmature=function(t){var e=this._armatureCache[t],i=e.animationsCache;for(var n in i){var r=i[n];r&&(this._animationPool[t+"#"+n]=r,r.clear())}var s=e.armature;s&&s.dispose(),delete this._armatureCache[t]},e.resetArmature=function(t){for(var e in this._armatureCache)-1!==e.indexOf(t)&&this._removeArmature(e)},e.getArmatureCache=function(e,i,n){var r,s=this._armatureCache[i];if(s)r=s.armature;else{var a=N0.getInstance().buildArmatureDisplay(e,i,"",n);if(!a||!a._armature)return null;if(r=a._armature,!t.canCache(r))return r.dispose(),null;this._armatureCache[i]={armature:r,animationsCache:{},curAnimationCache:null}}return r},e.getAnimationCache=function(t,e){var i=this._armatureCache[t];return i?i.animationsCache[e]:null},e.initAnimationCache=function(t,e){if(!e)return null;var i=this._armatureCache[t],n=i&&i.armature;if(!n)return null;if(!n.animation.hasAnimation(e))return null;var r=i.animationsCache,s=r[e];if(!s){var a=t+"#"+e;(s=this._animationPool[a])?delete this._animationPool[a]:(s=new K0)._privateMode=this._privateMode,s.init(i,e),r[e]=s}return s},e.invalidAnimationCache=function(t){var e=this._armatureCache[t];if(e&&e.armature){var i=e.animationsCache;for(var n in i)i[n].invalidAllFrame()}},e.updateAnimationCache=function(t,e){if(e){var i=this.initAnimationCache(t,e);if(!i)return;i.updateAllFrame()}else{var n=this._armatureCache[t];if(!n||!n.armature)return;var r=n.animationsCache;for(var s in r)r[s].updateAllFrame()}},t.canCache=function(t){for(var e=t._slots,i=0,n=e.length;i<n;i++)if(e[i].childArmature)return!1;return!0},t}();J0.FrameTime=L0,J0.sharedCache=new J0;var Q0,Z0,$0,t1,e1,i1,n1,r1,s1=ks,a1=Is("dragonBones.DragonBonesAsset")(($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)._dragonBonesJson=t$&&t$(),e._factory=null,e._dragonBonesJsonData=void 0,e._armaturesEnum=null,e}s(e,t);var i=e.prototype;return i.constructctor=function(){this.reset()},i.createNode=function(t){var e=new Pm(this.name);return e.addComponent("dragonBones.ArmatureDisplay").dragonAsset=this,t(null,e)},i.reset=function(){this._clear()},i.init=function(t,e){this._factory=t||N0.getInstance(),!this._dragonBonesJsonData&&this.dragonBonesJson&&(this._dragonBonesJsonData=JSON.parse(this.dragonBonesJson));var i;if(i=this._dragonBonesJsonData?this._dragonBonesJsonData:this._nativeAsset,!this._uuid){var n=this._factory.getDragonBonesDataByRawData(i);n?this._uuid=n.name:console.warn("dragonbones name is empty")}var r=this._uuid+"#"+e;return this._factory.getDragonBonesData(r)||this._factory.parseDragonBonesData(i instanceof ArrayBuffer?i:i.buffer instanceof ArrayBuffer?i.buffer:i,r),r},i.getArmatureEnum=function(){if(this._armaturesEnum)return this._armaturesEnum;this.init();var t=this._factory.getDragonBonesDataByUUID(this._uuid);if(t){for(var e=t.armatureNames,i={},n=0;n<e.length;n++)i[e[n]]=n;return this._armaturesEnum=me(i)}return null},i.getAnimsEnum=function(t){this.init();var e=this._factory.getDragonBonesDataByUUID(this._uuid);if(e){var i=e.getArmature(t);if(!i)return null;var n={"<None>":0},r=i.animations,s=0;for(var a in r)r.hasOwnProperty(a)&&(n[a]=s+1,s++);return me(n)}return null},i.destroy=function(){return this._clear(),t.prototype.destroy.call(this)},i._clear=function(){this._factory&&(J0.sharedCache.resetArmature(this._uuid),this._factory.removeDragonBonesDataByUUID(this._uuid,!0))},n(e,[{key:"dragonBonesJson",get:function(){return this._dragonBonesJson},set:function(t){this._dragonBonesJson=t,this._dragonBonesJsonData=JSON.parse(t),this.reset()}}]),e}(zf),t$=Ss($Z.prototype,"_dragonBonesJson",[s1],(function(){return""})),ZZ=$Z))||ZZ;v.internal.DragonBonesAsset=a1;var o1,h1=ks,u1=ha,l1=(Q0=Is("dragonBones.DragonBonesAtlasAsset"),Z0=u1(Mp),Q0((t1=function(t){function e(){var e;return(e=t.call(this)||this)._atlasJson=e1&&e1(),e._texture=i1&&i1(),e._atlasJsonData=n1&&n1(),e._factory=null,e._textureAtlasData=r1&&r1(),e._clear(),e}s(e,t);var i=e.prototype;return i.createNode=function(t){var e=new Pm(this.name);return e.addComponent("dragonBones.ArmatureDisplay").dragonAtlasAsset=this,t(null,e)},i.init=function(t){this._factory=t,this._atlasJsonData||(this._atlasJsonData=JSON.parse(this.atlasJson));var e=this._atlasJsonData;this._uuid=this._uuid||e.name,this._textureAtlasData?t.addTextureAtlasData(this._textureAtlasData,this._uuid):this._textureAtlasData=t.parseTextureAtlasData(e,this.texture,this._uuid)},i.destroy=function(){return this._clear(),t.prototype.destroy.call(this)},i._clear=function(){this._factory&&(J0.sharedCache.resetArmature(this._uuid),this._factory.removeTextureAtlasData(this._uuid,!0),this._factory.removeDragonBonesDataByUUID(this._uuid,!0)),this._textureAtlasData=null},n(e,[{key:"atlasJson",get:function(){return this._atlasJson},set:function(t){this._atlasJson=t,this._atlasJsonData=JSON.parse(this.atlasJson),this._clear()}},{key:"texture",get:function(){return this._texture},set:function(t){this._texture=t,this._clear()}}]),e}(zf),e1=Ss(t1.prototype,"_atlasJson",[h1],(function(){return""})),i1=Ss(t1.prototype,"_texture",[h1,Z0],(function(){return null})),n1=Ss(t1.prototype,"_atlasJsonData",[h1],(function(){return{}})),r1=Ss(t1.prototype,"_textureAtlasData",[h1],(function(){return null})),$0=t1))||$0);v.internal.DragonBonesAtlasAsset=l1;var c1,_1,f1,d1,p1,m1,g1,y1,v1,S1,A1,T1,E1,b1,x1,C1,R1,w1,I1,B1,D1,P1,O1,M1,N1,L1,F1,k1,G1,V1,U1,z1,H1,W1,X1=new fn,j1=Is("dragonBones.AttachUtil")(o1=function(){function t(){this._inited=!1,this._armature=null,this._armatureNode=null,this._armatureDisplay=null}var e=t.prototype;return e.init=function(t){this._inited=!0,this._armature=t._armature,this._armatureNode=t.node,this._armatureDisplay=t},e.reset=function(){this._inited=!1,this._armature=null,this._armatureNode=null,this._armatureDisplay=null},e._syncAttachedNode=function(){if(this._inited){this._armatureNode.worldMatrix;var t=null,e=this._armatureDisplay.isAnimationCached();if(!e||!this._armatureDisplay||(t=this._armatureDisplay._curFrame&&this._armatureDisplay._curFrame.boneInfos))for(var i,n,r,s=this._armatureDisplay.sockets,a=this._armatureDisplay.socketNodes,o=this._armature.getBones(),h=s.length-1;h>=0;h--){var u=s[h],l=u.target;if(l)if(l.isValid){var c=e?t[u.boneIndex]:o[u.boneIndex];c&&(i=l,n=c.globalTransformMatrix,r=void 0,(r=X1).m00=n.a,r.m01=n.b,r.m04=-n.c,r.m05=-n.d,r.m12=n.tx,r.m13=n.ty,i.matrix=X1)}else a.delete(u.path),s.splice(h,1)}}},t}())||o1,Y1=function(t){function e(){var e;return(e=t.call(this)||this)._armatures=new Set,e}s(e,t),e.getInstance=function(){return e._instance||(e._instance=new e,vN.registerSystem(e.ID,e._instance,pu.Priority.HIGH)),e._instance};var i=e.prototype;return i.add=function(t){t&&(this._armatures.has(t)||this._armatures.add(t))},i.remove=function(t){t&&this._armatures.has(t)&&this._armatures.delete(t)},i.postUpdate=function(t){this._armatures&&this._armatures.forEach((function(e){e.updateAnimation(t),e.syncAttachedNode()}))},i.prepareRenderData=function(){this._armatures&&this._armatures.forEach((function(t){t.markForUpdateRenderData()}))},e}(pu);Y1.ID="ARMATURE",Y1._instance=void 0,v.internal.ArmatureSystem=Y1,function(t){t[t.default=-1]="default"}(U1||(U1={})),ve(U1),function(t){t[t["<None>"]=0]="<None>"}(z1||(z1={})),ve(z1),function(t){t[t.REALTIME=0]="REALTIME"}(H1||(H1={})),ve(z1),function(t){t[t.REALTIME=0]="REALTIME",t[t.SHARED_CACHE=1]="SHARED_CACHE",t[t.PRIVATE_CACHE=2]="PRIVATE_CACHE"}(W1||(W1={})),ve(W1);var q1=Is,K1=ks,J1=ha,Q1=ua;function Z1(t,e,i){fi.Attr.setClassAttr(t,e,"type","Enum"),fi.Attr.setClassAttr(t,e,"enumList",me.getList(i))}var $1=(c1=q1("dragonBones.ArmatureDisplay.DragonBoneSocket"),_1=J1(Pm),c1((d1=function(t,e){void 0===t&&(t=""),void 0===e&&(e=null),this.path=p1&&p1(),this.target=m1&&m1(),this.boneIndex=null,this.path=t,this.target=e},p1=Ss(d1.prototype,"path",[K1],(function(){return""})),m1=Ss(d1.prototype,"target",[_1,K1],(function(){return null})),f1=d1))||f1);Jt($1,"dragonBones.ArmatureDisplay.DragonBoneSocket");var t2=(g1=q1("dragonBones.ArmatureDisplay"),y1=J1(a1),v1=J1(l1),S1=J1(U1),A1=J1(z1),T1=J1([$1]),E1=J1(KS),g1(((V1=function(t){s(i,t);var e=i.prototype;function i(){var e;return(e=t.call(this)||this).playTimes=C1&&C1(),e.premultipliedAlpha=R1&&R1(),e._armature=null,e.attachUtil=void 0,e._defaultArmatureIndexValue=w1&&w1(),e._dragonAsset=I1&&I1(),e._dragonAtlasAsset=B1&&B1(),e._armatureName=D1&&D1(),e._animationName=P1&&P1(),e._animationIndexValue=O1&&O1(),e._preCacheMode=-1,e._cacheMode=W1.REALTIME,e._defaultCacheModeValue=M1&&M1(),e._timeScale=N1&&N1(),e._playTimes=L1&&L1(),e._debugBones=F1&&F1(),e._enableBatch=k1&&k1(),e._debugDraw=null,e._armatureKey="",e._accTime=0,e._playCount=0,e._frameCache=null,e._curFrame=null,e._playing=!1,e._armatureCache=null,e._eventTarget=void 0,e._factory=null,e._displayProxy=null,e._drawIdx=0,e._drawList=new fu((function(){return{material:null,texture:null,indexOffset:0,indexCount:0}}),1),e.maxVertexCount=0,e.maxIndexCount=0,e._materialCache={},e._enumArmatures=me({}),e._enumAnimations=me({}),e._socketNodes=new Map,e._cachedSockets=new Map,e._sockets=G1&&G1(),e._inited=void 0,e._drawInfoList=[],e._cacheModeEnum=void 0,e._eventTarget=new Du,e._inited=!1,e.attachUtil=new j1,e.initFactory(),Z1(c(e),"_animationIndex",e._enumAnimations),Z1(c(e),"_defaultArmatureIndex",e._enumArmatures),e._useVertexOpacity=!0,e}return e.requestDrawInfo=function(t){return this._drawInfoList[t]||(this._drawInfoList[t]=new TF),this._drawInfoList[t]},e.initFactory=function(){this._factory=N0.getInstance()},e.onLoad=function(){t.prototype.onLoad.call(this)},e._requestDrawData=function(t,e,i,n){var r=this._drawList.add();return r.material=t,r.texture=e,r.indexOffset=i,r.indexCount=n,r},e.destroyRenderData=function(){this._drawList.reset(),t.prototype.destroyRenderData.call(this)},e.getMaterialTemplate=function(){return null!==this.customMaterial?this.customMaterial:(this.material||this.updateMaterial(),this.material)},e.getMaterialForBlend=function(t,e){var i=t+"/"+e,n=this._materialCache[i];if(n)return n;var r=this.getMaterialTemplate();return(n=new rA({parent:r,subModelIdx:0,owner:this})).recompileShaders({TWO_COLORED:!1,USE_LOCAL:!1}),this._materialCache[i]=n,n.overridePipelineStates({blendState:{targets:[{blendSrc:t,blendDst:e}]}}),n},e._updateBuiltinMaterial=function(){return xS.get("default-spine-material")},e.updateMaterial=function(){var t;t=this._customMaterial?this._customMaterial:this._updateBuiltinMaterial(),this.setMaterial(t,0),this._cleanMaterialCache()},e._render=function(t){var e=0;if(this.renderData&&this._drawList){for(var i=this.renderData,n=i.chunk,r=n.vertexAccessor,s=i.getMeshBuffer(),a=s.indexOffset,o=0;o<this._drawList.length;o++){this._drawIdx=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)}},e.__preload=function(){t.prototype.__preload.call(this),this._init()},e._init=function(){if(this._cacheMode=this._defaultCacheMode,!this._inited){this._inited=!0,this._parseDragonAtlasAsset(),this._refresh();for(var t=this.node.children,e=0,i=t.length;e<i;e++){var n=t[e];n&&"DEBUG_DRAW_NODE"===n.name&&n.destroy()}this._updateDebugDraw(),this._indexBoneSockets(),this._updateSocketBindings()}},e.getArmatureKey=function(){return this._armatureKey},e.setAnimationCacheMode=function(t){this._preCacheMode!==t&&(this._cacheMode=t,this._buildArmature(),this._armature&&!this.isAnimationCached()&&this._factory._dragonBones.clock.add(this._armature),this._updateSocketBindings(),this.markForUpdateRenderData())},e.isAnimationCached=function(){return this._cacheMode!==W1.REALTIME},e.onEnable=function(){t.prototype.onEnable.call(this),this._armature&&!this.isAnimationCached()&&this._factory._dragonBones.clock.add(this._armature),this._flushAssembler(),Y1.getInstance().add(this)},e.onDisable=function(){t.prototype.onDisable.call(this),this._armature&&!this.isAnimationCached()&&this._factory._dragonBones.clock.remove(this._armature),Y1.getInstance().remove(this)},e._emitCacheCompleteEvent=function(){this._eventTarget.emit(d0.LOOP_COMPLETE),this._eventTarget.emit(d0.COMPLETE)},e.updateAnimation=function(t){if(this.markForUpdateRenderData(),this.isAnimationCached()&&this._frameCache){var e=this._frameCache;if(e.isInited()){var i=e.frames;if(this._playing){var n=J0.FrameTime;0===this._accTime&&0===this._playCount&&this._eventTarget.emit(d0.START),this._accTime+=t*this.timeScale*1;var r=Math.floor(this._accTime/n);if(e.isCompleted||(e.updateToFrame(r),this.renderData&&(this.renderData.vertexCount<e.maxVertexCount||this.renderData.indexCount<e.maxIndexCount)&&(this.maxVertexCount=e.maxVertexCount>this.maxVertexCount?e.maxVertexCount:this.maxVertexCount,this.maxIndexCount=e.maxIndexCount>this.maxIndexCount?e.maxIndexCount:this.maxIndexCount,this.renderData.resize(this.maxVertexCount,this.maxIndexCount),(!this.renderData.indices||this.maxIndexCount>this.renderData.indices.length)&&(this.renderData.indices=new Uint16Array(this.maxIndexCount)))),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._playing=!1,this._playCount=0,this._emitCacheCompleteEvent(),void this.attachUtil._syncAttachedNode();this._accTime=0,r=0,this._emitCacheCompleteEvent()}this._curFrame=i[r],this.attachUtil._syncAttachedNode()}else e.isInvalid()&&(e.updateToFrame(),this._curFrame=i[i.length-1],this.renderData&&(this.renderData.vertexCount<e.maxVertexCount||this.renderData.indexCount<e.maxIndexCount)&&(this.maxVertexCount=e.maxVertexCount>this.maxVertexCount?e.maxVertexCount:this.maxVertexCount,this.maxIndexCount=e.maxIndexCount>this.maxIndexCount?e.maxIndexCount:this.maxIndexCount,this.renderData.resize(this.maxVertexCount,this.maxIndexCount),(!this.renderData.indices||this.maxIndexCount>this.renderData.indices.length)&&(this.renderData.indices=new Uint16Array(this.maxIndexCount))))}}},e.onDestroy=function(){this._materialInstances=this._materialInstances.filter((function(t){return!!t})),this._inited=!1,this._cacheMode===W1.PRIVATE_CACHE?(this._armatureCache.dispose(),this._armatureCache=null,this._armature=null):this._cacheMode===W1.SHARED_CACHE?(this._armatureCache=null,this._armature=null):this._armature&&(this._armature.dispose(),this._armature=null),this._drawList.destroy(),t.prototype.onDestroy.call(this)},e._updateDebugDraw=function(){if(this.debugBones){if(!this._debugDraw){var t=new Pm("DEBUG_DRAW_NODE");t.hideFlags|=ba.Flags.DontSave|ba.Flags.HideInHierarchy;var e=t.addComponent(UV);e.lineWidth=1,e.strokeColor=new Zi(255,0,0,255),this._debugDraw=e}this._debugDraw.node.parent=this.node}else this._debugDraw&&(this._debugDraw.node.parent=null);this.markForUpdateRenderData()},e._updateBatch=function(){this._cleanMaterialCache(),this.markForUpdateRenderData()},e._buildArmature=function(){if(this.dragonAsset&&this.dragonAtlasAsset&&this.armatureName){this._armature&&(this._preCacheMode===W1.PRIVATE_CACHE?this._armatureCache.dispose():this._preCacheMode===W1.REALTIME&&this._armature.dispose(),this._armatureCache=null,this._armature=null,this._displayProxy=null,this._frameCache=null,this._curFrame=null,this._playing=!1,this._preCacheMode=-1),this._cacheMode===W1.SHARED_CACHE?this._armatureCache=J0.sharedCache:this._cacheMode===W1.PRIVATE_CACHE&&(this._armatureCache=new J0,this._armatureCache.enablePrivateMode());var t=this.dragonAtlasAsset._uuid;if(this._armatureKey=this.dragonAsset.init(this._factory,t),this.isAnimationCached()&&(this._armature=this._armatureCache.getArmatureCache(this.armatureName,this._armatureKey,t),this._armature||(this._cacheMode=W1.REALTIME)),this._preCacheMode=this._cacheMode,this._cacheMode===W1.REALTIME){if(this._displayProxy=this._factory.buildArmatureDisplay(this.armatureName,this._armatureKey,"",t),!this._displayProxy)return;this._displayProxy._ccNode=this.node,this._displayProxy._ccComponent=this,this._displayProxy.setEventTarget(this._eventTarget),this._armature=this._displayProxy._armature,this._armature.animation.timeScale=this.timeScale}if(this._cacheMode!==W1.REALTIME&&this.debugBones&&console.warn("Debug bones is invalid in cached mode"),this._armature){var e=this._armature.armatureData.aabb;this.node._uiProps.uiTransformComp.setContentSize(e.width,e.height)}this.attachUtil.init(this),this.animationName&&this.playAnimation(this.animationName,this.playTimes),this._flushAssembler()}},e.querySockets=function(){return this._armature?(0===this._cachedSockets.size&&this._indexBoneSockets(),Array.from(this._cachedSockets.keys()).sort()):[]},e.querySocketPathByName=function(t){for(var e,i=[],n=f(this._cachedSockets.keys());!(e=n()).done;){var r=e.value;r.endsWith(t)&&i.push(r)}return i},e._parseDragonAtlasAsset=function(){this.dragonAtlasAsset&&this.dragonAtlasAsset.init(this._factory)},e._refresh=function(){this._buildArmature(),this._indexBoneSockets(),this.markForUpdateRenderData()},e._updateCacheModeEnum=function(){this._cacheModeEnum=me({}),this._armature?Object.assign(this._cacheModeEnum,W1):Object.assign(this._cacheModeEnum,H1),Z1(this,"_defaultCacheMode",this._cacheModeEnum)},e._updateAnimEnum=function(){var t;t=this.dragonAsset?this.dragonAsset.getAnimsEnum(this.armatureName):z1,this._enumAnimations=me({}),Object.assign(this._enumAnimations,t||z1),me.update(this._enumAnimations),Z1(this,"_animationIndex",this._enumAnimations)},e._updateArmatureEnum=function(){var t;t=this.dragonAsset?this.dragonAsset.getArmatureEnum():U1,this._enumArmatures=me({}),Object.assign(this._enumArmatures,t||U1),me.update(this._enumArmatures),Z1(this,"_defaultArmatureIndex",this._enumArmatures)},e._indexBoneSockets=function(){if(this._armature){this._cachedSockets.clear();var t=this._cachedSockets,e=function t(e,i,n){if(n.has(e))return n.get(e);var r=i[e];if(!r.parent)return n.set(e,r.name),r.path=r.name,r.name;var s=t(r.parent._boneIndex,i,n)+"/"+r.name;return n.set(e,s),r.path=s,s};!function i(n,r){for(var s=r.getBones(),a=new Map,o=0;o<s.length;o++)s[o]._boneIndex=o;for(var h=0;h<s.length;h++)e(h,s,a);for(var u,l=f(a.keys());!(u=l()).done;){var c=u.value;t.set(""+n+a.get(c),c)}for(var _=r.getSlots(),d=0;d<_.length;d++)_[d].childArmature&&i(_[d].name,_[d].childArmature)}("",this._armature)}},e.playAnimation=function(t,e){if(this.playTimes=void 0===e?-1:e,this.animationName=t,this.isAnimationCached()){var i=this._armatureCache.getAnimationCache(this._armatureKey,t);i||(i=this._armatureCache.initAnimationCache(this._armatureKey,t)),i&&(this._accTime=0,this._playCount=0,this._frameCache=i,this._sockets.length>0&&this._frameCache.enableCacheAttachedInfo(),this._frameCache.updateToFrame(0),this._playing=!0,this._curFrame=this._frameCache.frames[0])}else if(this._armature)return this._armature.animation.play(t,this.playTimes);return this.markForUpdateRenderData(),null},e.updateAnimationCache=function(t){this.isAnimationCached()&&this._armatureCache.updateAnimationCache(this._armatureKey,t)},e.invalidAnimationCache=function(){this.isAnimationCached()&&this._armatureCache.invalidAnimationCache(this._armatureKey)},e.getArmatureNames=function(){var t=this._factory.getDragonBonesData(this._armatureKey);return t&&t.armatureNames||[]},e.getAnimationNames=function(t){var e=[],i=this._factory.getDragonBonesData(this._armatureKey);if(i){var n=i.getArmature(t);if(n)for(var r in n.animations)n.animations.hasOwnProperty(r)&&e.push(r)}return e},e.on=function(t,e,i){this.addEventListener(t,e,i)},e.off=function(t,e,i){this.removeEventListener(t,e,i)},e.once=function(t,e,i){this._eventTarget.once(t,e,i)},e.addEventListener=function(t,e,i){this._eventTarget.on(t,e,i)},e.removeEventListener=function(t,e,i){this._eventTarget.off(t,e,i)},e.buildArmature=function(t,e){return this._factory.createArmatureNode(this,t,e)},e.armature=function(){return this._armature},e._flushAssembler=function(){var t=i.Assembler.getAssembler(this);this._assembler!==t&&(this._assembler=t),this._armature&&this._assembler&&(this._renderData=this._assembler.createData(this),this._renderData&&(this.maxVertexCount=this._renderData.vertexCount,this.maxIndexCount=this._renderData.indexCount),this.markForUpdateRenderData(),this._updateColor())},e._updateSocketBindings=function(){if(this._armature){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){console.error("Skeleton data does not contain path "+i.path);continue}i.boneIndex=n,this._socketNodes.set(i.path,i.target)}}}},e._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||console.error("Target node "+n.name+" is expected to be a direct child of "+this.node.name)}},e._cleanMaterialCache=function(){for(var t in this._materialCache)this._materialCache[t].destroy();this._materialCache={}},e.createRenderEntity=function(){var t=new MF(EF.DYNAMIC);return t.setUseLocal(!1),t},e.markForUpdateRenderData=function(e){void 0===e&&(e=!0),t.prototype.markForUpdateRenderData.call(this,e),this._debugDraw&&this._debugDraw.markForUpdateRenderData(e)},e.syncAttachedNode=function(){this.attachUtil._syncAttachedNode()},n(i,[{key:"dragonAsset",get:function(){return this._dragonAsset},set:function(t){this._dragonAsset=t,this.destroyRenderData(),this._refresh()}},{key:"dragonAtlasAsset",get:function(){return this._dragonAtlasAsset},set:function(t){this._dragonAtlasAsset=t,this._parseDragonAtlasAsset(),this._refresh()}},{key:"armatureName",get:function(){return this._armatureName},set:function(t){this._armatureName=t;var e=this.getAnimationNames(this._armatureName);(!this.animationName||e.indexOf(this.animationName)<0)&&(this.animationName=""),this._armature&&!this.isAnimationCached()&&this._factory._dragonBones.clock.remove(this._armature),this._refresh(),this._armature&&!this.isAnimationCached()&&this._factory._dragonBones.clock.add(this._armature)}},{key:"animationName",get:function(){return this._animationName},set:function(t){this._animationName=t}},{key:"_defaultArmatureIndex",get:function(){return this._defaultArmatureIndexValue},set:function(t){this._defaultArmatureIndexValue=t;var e="";if(this.dragonAsset){var i;if(this.dragonAsset&&(i=this.dragonAsset.getArmatureEnum()),!i)return void J(7400,this.name);e=i[this._defaultArmatureIndex]}void 0!==e?this.armatureName=e:J(7401,this.name),this.markForUpdateRenderData()}},{key:"_animationIndex",get:function(){return this._animationIndexValue},set:function(t){var e;if(this._animationIndexValue=t,0!==this._animationIndex){if(this.dragonAsset&&(e=this.dragonAsset.getAnimsEnum(this.armatureName)),e){var i=e[this._animationIndex];void 0!==i?this.playAnimation(i,this.playTimes):J(7402,this.name)}}else this.animationName=""}},{key:"_defaultCacheMode",get:function(){return this._defaultCacheModeValue},set:function(t){if(this._defaultCacheModeValue=t,this._defaultCacheMode!==W1.REALTIME&&this._armature&&!J0.canCache(this._armature))return this._defaultCacheMode=W1.REALTIME,void console.warn("Animation cache mode doesn't support skeletal nesting");this.setAnimationCacheMode(this._defaultCacheMode)}},{key:"timeScale",get:function(){return this._timeScale},set:function(t){this._timeScale=t,this._armature&&!this.isAnimationCached()&&(this._armature.animation.timeScale=this.timeScale)}},{key:"debugBones",get:function(){return this._debugBones},set:function(t){this._debugBones=t,this._updateDebugDraw()}},{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._verifySockets(t),this._sockets=t,this._updateSocketBindings(),t.length>0&&this._frameCache&&this._frameCache.enableCacheAttachedInfo()}},{key:"socketNodes",get:function(){return this._socketNodes}},{key:"drawList",get:function(){return this._drawList}},{key:"customMaterial",get:function(){return this._customMaterial},set:function(t){this._customMaterial=t,this.updateMaterial(),this.markForUpdateRenderData()}}]),i}(gk)).AnimationCacheMode=W1,p((x1=V1).prototype,"dragonAsset",[y1],Object.getOwnPropertyDescriptor(x1.prototype,"dragonAsset"),x1.prototype),p(x1.prototype,"dragonAtlasAsset",[v1],Object.getOwnPropertyDescriptor(x1.prototype,"dragonAtlasAsset"),x1.prototype),p(x1.prototype,"_defaultArmatureIndex",[S1],Object.getOwnPropertyDescriptor(x1.prototype,"_defaultArmatureIndex"),x1.prototype),p(x1.prototype,"_animationIndex",[A1],Object.getOwnPropertyDescriptor(x1.prototype,"_animationIndex"),x1.prototype),p(x1.prototype,"timeScale",[K1],Object.getOwnPropertyDescriptor(x1.prototype,"timeScale"),x1.prototype),C1=Ss(x1.prototype,"playTimes",[K1],(function(){return-1})),R1=Ss(x1.prototype,"premultipliedAlpha",[K1],(function(){return!1})),p(x1.prototype,"sockets",[T1],Object.getOwnPropertyDescriptor(x1.prototype,"sockets"),x1.prototype),w1=Ss(x1.prototype,"_defaultArmatureIndexValue",[K1],(function(){return U1.default})),I1=Ss(x1.prototype,"_dragonAsset",[K1],(function(){return null})),B1=Ss(x1.prototype,"_dragonAtlasAsset",[K1],(function(){return null})),D1=Ss(x1.prototype,"_armatureName",[K1],(function(){return""})),P1=Ss(x1.prototype,"_animationName",[K1],(function(){return""})),O1=Ss(x1.prototype,"_animationIndexValue",[K1],(function(){return 0})),M1=Ss(x1.prototype,"_defaultCacheModeValue",[K1],(function(){return W1.REALTIME})),N1=Ss(x1.prototype,"_timeScale",[K1],(function(){return 1})),L1=Ss(x1.prototype,"_playTimes",[K1],(function(){return-1})),F1=Ss(x1.prototype,"_debugBones",[K1],(function(){return!1})),k1=Ss(x1.prototype,"_enableBatch",[K1],(function(){return!1})),G1=Ss(x1.prototype,"_sockets",[K1],(function(){return[]})),p(x1.prototype,"customMaterial",[Q1,E1],Object.getOwnPropertyDescriptor(x1.prototype,"customMaterial"),x1.prototype),b1=x1))||b1);v.internal.ArmatureDisplay=t2;var e2,i2,n2,r2,s2,a2,o2,h2,u2,l2,c2,_2=new Zi(255,0,0,255),f2=new Zi(0,0,255,255),d2=new Zi(0,255,0,255),p2=0,m2=0,g2=0,y2=0,v2=0,S2=0,A2=0,T2=0,E2=0,b2=new Float32Array(4),x2=new Yi(0,0,0),C2=new fn,R2=null,w2=null;function I2(t,e){if(!t)return null;var i,n;switch(e){case 1:i=s2?zl.ONE:zl.SRC_ALPHA,n=zl.ONE;break;case 10:i=zl.DST_COLOR,n=zl.ONE_MINUS_SRC_ALPHA;break;case 12:i=zl.ONE,n=zl.ONE_MINUS_SRC_COLOR;break;case 0:default:i=s2?zl.ONE:zl.SRC_ALPHA,n=zl.ONE_MINUS_SRC_ALPHA}return l2.getMaterialForBlend(i,n)}function B2(t,e){var i=t.a*e*r2,n=s2?i/255:1,r=t.r*e2*n/255,s=t.g*i2*n/255,a=t.b*n2*n/255;b2[0]=r,b2[1]=s,b2[2]=a,b2[3]=s2?1:i/255}var D2=null,P2={accessor:D2,vCount:32767,ensureAccessor:function(){if(!D2){var t=vN.root.device,e=vN.root.batcher2D,i=sF;this.accessor=D2=new vF(t,i,this.vCount),e.registerBufferAccessor(Number.parseInt("DRAGONBONES",36),D2)}return this.accessor},createData:function(t){var e=t.renderData;if(!e){this.ensureAccessor();for(var i=t._armature._slots,n=0,r=0,s=0;s<i.length;++s){var a=i[s],o=a._localVertices.length%4;n+=0===o?a._localVertices.length/4:(a._localVertices.length-o)/4+1,r+=a._indices.length}(e=FF.add(sF,this.accessor)).resize(n,r),e.indices&&r===e.indices.length||(e.indices=new Uint16Array(r))}return e},updateRenderData:function(t){l2=t,t._armature&&function(t){var e=t._armature;if(e&&null!==t.renderData){a2=!0,s2=t.premultipliedAlpha,t.drawList.reset(),l2=t,t.node,o2=t.renderData,l2=t,c2=0,R2=null;var i=t.color;e2=i.r/255,i2=i.g/255,n2=i.b/255,r2=t.node._uiProps.opacity,4294967295!==i._val&&(c2|=1);var n=t.node.getWorldMatrix();if(p2=0,g2=0,y2=0,v2=0,S2=0,E2=0,A2=l2.maxVertexCount,T2=l2.maxIndexCount,t.isAnimationCached())!function(t,e){if(t){var i=t.segments;if(0!==i.length){var n=null,r=t.vertices,s=t.indices,a=0,o=0,h=0,u=0,l=0,c=t.colors,_=c[l++],f=_.vfOffset;B2(_,1);for(var d=o2,p=d.chunk.vb,m=d.indices,g=0,y=i.length;g<y;g++){var v=i[g];if(n=I2(v.tex,v.blendMode)){if(R2||(R2=n),a2||n.hash!==R2.hash||v.tex&&v.tex!==w2){a2=!1;var S=S2-E2;S>0&&(l2._requestDrawData(R2,w2,E2,S),E2=S2),R2=n,w2=v.tex}m2=v.vertexCount,v2=v.indexCount,a=d.chunk.vertexOffset;for(var A=S2,T=S2+v2;A<T;A++)m[A]=a+g2+s[h++];u=v.vfCount;var E=r.subarray(o,u);p.set(E,o);var b=0;if(e)for(var x=0,C=m2;x<C;x++)x2.x=p[b],x2.y=p[b+1],x2.z=0,x2.transformMat4(e),p[b]=x2.x,p[b+1]=x2.y,p[b+2]=x2.z,b+=9;if(1&c2)for(var R=o/9*5,w=o,I=o+u;w<I;w+=9,R+=5)R>=f&&(B2(_=c[l++],1),f=_.vfOffset),p.set(b2,w+5);o+=u,g2+=m2,S2+=v2,m2=0,v2=0}}var B=S2-E2;w2&&B>0&&l2._requestDrawData(R2,w2,E2,B)}}}(t._curFrame,n);else{O2(e,1,n);var r=t._debugDraw;if(t.debugBones&&r){r.clear(),r.lineWidth=5,r.strokeColor=_2,r.fillColor=f2;for(var s=e.getBones(),a=0,o=s.length;a<o;a++){var h=s[a],u=Math.max(h.boneData.length,5),l=h.globalTransformMatrix.tx,c=h.globalTransformMatrix.ty,_=l+h.globalTransformMatrix.a*u,f=c+h.globalTransformMatrix.b*u;r.moveTo(l,c),r.lineTo(_,f),r.stroke(),r.circle(l,c,2*Math.PI),r.fill(),0===a&&(r.fillColor=d2)}}}D2.getMeshBuffer(o2.chunk.bufferId).setDirty(),l2=void 0}}(t)},updateColor:function(t){t&&(l2=t).markForUpdateRenderData()}};function O2(t,e,i){var n=o2;u2=n.chunk.vb,h2=n.indices;for(var r,s,a,o,h,u,l=t._slots,c=0,_=l.length;c<_;c++)if(o=(h=l[c])._color,h._visible&&h._displayData)if(i?fn.multiply(h._worldMatrix,i,h._matrix):fn.copy(h._worldMatrix,h._matrix),h.childArmature)O2(h.childArmature,o.a/255,h._worldMatrix);else if(r=I2(h.getTexture(),h._blendMode)){R2||(R2=r);var f=h.getTexture();if(a2||r.hash!==R2.hash||f&&w2!==f){a2=!1;var d=S2-E2;d>0&&(l2._requestDrawData(R2,w2,E2,d),E2=S2),w2=f,R2=r}B2(o,e),C2.set(h._worldMatrix),s=h._localVertices,m2=s.length/4,p2=9*m2,a=h._indices,v2=a.length;var p=!1;if(g2+m2>A2&&(A2=g2+m2,p=!0),S2+v2>T2&&(T2=S2+v2,p=!0),p){var m=h2,g=n.chunk.vertexOffset;n.resizeAndCopy(A2,T2>n.indexCount?T2:n.indexCount),u2=n.chunk.vb,T2>h2.length&&(h2=n.indices=new Uint16Array(T2));for(var y=n.chunk.vertexOffset-g,v=0;v<S2;++v)h2[v]=m[v]+y}for(var S=0,A=s.length,T=y2;S<A;T+=9)x2.x=s[S++],x2.y=s[S++],x2.z=0,x2.transformMat4(C2),u2[T]=x2.x,u2[T+1]=x2.y,u2[T+2]=x2.z,u2[T+3]=s[S++],u2[T+4]=s[S++],u2.set(b2,T+5);for(var E=n.chunk.vertexOffset,b=0,x=a.length,C=S2;b<x;b++,C++)h2[C]=g2+a[b]+E;y2+=p2,g2+=m2,S2+=v2,m2=0,v2=0}u=S2-E2,w2&&u>0&&(l2._requestDrawData(R2,w2,E2,u),E2=S2),l2.maxIndexCount<T2&&(l2.maxIndexCount=T2),l2.maxVertexCount<A2&&(l2.maxVertexCount=A2)}v.internal.DragonBonesAssembler=P2;var M2,N2,L2,F2={getAssembler:function(){return P2}};t2.Assembler=F2,function(t){t[t.FFD=0]="FFD",t[t.AdjustColor=10]="AdjustColor",t[t.BevelFilter=11]="BevelFilter",t[t.BlurFilter=12]="BlurFilter",t[t.DropShadowFilter=13]="DropShadowFilter",t[t.GlowFilter=14]="GlowFilter",t[t.GradientBevelFilter=15]="GradientBevelFilter",t[t.GradientGlowFilter=16]="GradientGlowFilter"}(M2||(M2={})),function(t){t[t.Frame=0]="Frame",t[t.Sound=1]="Sound"}(N2||(N2={})),function(t){t[t.None=0]="None",t[t.SameLayer=1]="SameLayer",t[t.SameGroup=2]="SameGroup",t[t.SameLayerAndGroup=3]="SameLayerAndGroup",t[t.All=4]="All"}(L2||(L2={})),t("ep",Object.freeze({__proto__:null,get ExtensionType(){return M2},get EventType(){return N2},get AnimationFadeOutMode(){return L2},CCFactory:N0,CCSlot:O0,CCTextureAtlasData:D0,CCTextureData:P0,CCArmatureDisplay:M0,AnimationCache:K0,ArmatureCache:J0,DragonBonesAsset:a1,DragonBonesAtlasAsset:l1,timeScale:1,get AnimationCacheMode(){return W1},DragonBoneSocket:$1,ArmatureDisplay:t2,AttachUtil:j1,simpleDragonBoneAssembler:F2,DragonBones:e$,BaseObject:i$,Matrix:n$,Transform:r$,ColorTransform:s$,Point:a$,Rectangle:o$,UserData:h$,ActionData:u$,DragonBonesData:l$,ArmatureData:c$,BoneData:_$,SurfaceData:f$,SlotData:d$,ConstraintData:p$,IKConstraintData:m$,PathConstraintData:g$,CanvasData:y$,SkinData:v$,VerticesData:S$,DisplayData:A$,ImageDisplayData:T$,ArmatureDisplayData:E$,MeshDisplayData:b$,BoundingBoxDisplayData:x$,PathDisplayData:C$,WeightData:R$,BoundingBoxData:w$,RectangleBoundingBoxData:I$,EllipseBoundingBoxData:B$,PolygonBoundingBoxData:D$,AnimationData:P$,TimelineData:O$,AnimationConfig:M$,TextureAtlasData:N$,TextureData:L$,DeformVertices:F$,Armature:k$,TransformObject:G$,Bone:V$,Surface:U$,Slot:z$,Constraint:H$,IKConstraint:W$,PathConstraint:X$,WorldClock:j$,Animation:Y$,AnimationState:q$,BonePose:K$,BlendState:J$,TimelineState:Q$,TweenTimelineState:Z$,BoneTimelineState:$$,SlotTimelineState:t0,ConstraintTimelineState:e0,ActionTimelineState:i0,ZOrderTimelineState:n0,BoneAllTimelineState:r0,BoneTranslateTimelineState:s0,BoneRotateTimelineState:a0,BoneScaleTimelineState:o0,SurfaceTimelineState:h0,SlotDislayTimelineState:u0,SlotColorTimelineState:l0,DeformTimelineState:c0,IKConstraintTimelineState:_0,AnimationTimelineState:f0,EventObject:d0,DataParser:p0,ObjectDataParser:m0,ActionFrame:g0,BinaryDataParser:y0,BaseFactory:v0,BuildArmaturePackage:S0,BinaryOffset:A0,ArmatureType:T0,BoneType:E0,DisplayType:b0,BoundingBoxType:x0,ActionType:C0,BlendMode:R0,TweenType:w0,TimelineType:I0}));var k2,G2=function(t){function e(){for(var e,i=arguments.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&g_){var i=this._buffers[e];i&&(t[e].gpuBuffer=i.gpuBuffer||i.gpuBufferView)}else t[e].type&y_&&(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}(L_);!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"}(k2||(k2={}));var V2=function(){function t(){}return t.setInstance=function(e){t._instance=e},n(t,null,[{key:"instance",get:function(){return t._instance}}]),t}();function U2(t,e){switch(t){case xl.R8:return e.UNSIGNED_BYTE;case xl.R8SN:return e.BYTE;case xl.R8UI:return e.UNSIGNED_BYTE;case xl.R8I:return e.BYTE;case xl.R16F:return k2.HALF_FLOAT_OES;case xl.R16UI:return e.UNSIGNED_SHORT;case xl.R16I:return e.SHORT;case xl.R32F:return e.FLOAT;case xl.R32UI:return e.UNSIGNED_INT;case xl.R32I:return e.INT;case xl.RG8:return e.UNSIGNED_BYTE;case xl.RG8SN:return e.BYTE;case xl.RG8UI:return e.UNSIGNED_BYTE;case xl.RG8I:return e.BYTE;case xl.RG16F:return k2.HALF_FLOAT_OES;case xl.RG16UI:return e.UNSIGNED_SHORT;case xl.RG16I:return e.SHORT;case xl.RG32F:return e.FLOAT;case xl.RG32UI:return e.UNSIGNED_INT;case xl.RG32I:return e.INT;case xl.RGB8:case xl.SRGB8:return e.UNSIGNED_BYTE;case xl.RGB8SN:return e.BYTE;case xl.RGB8UI:return e.UNSIGNED_BYTE;case xl.RGB8I:return e.BYTE;case xl.RGB16F:return k2.HALF_FLOAT_OES;case xl.RGB16UI:return e.UNSIGNED_SHORT;case xl.RGB16I:return e.SHORT;case xl.RGB32F:return e.FLOAT;case xl.RGB32UI:return e.UNSIGNED_INT;case xl.RGB32I:return e.INT;case xl.BGRA8:case xl.RGBA8:case xl.SRGB8_A8:return e.UNSIGNED_BYTE;case xl.RGBA8SN:return e.BYTE;case xl.RGBA8UI:return e.UNSIGNED_BYTE;case xl.RGBA8I:return e.BYTE;case xl.RGBA16F:return k2.HALF_FLOAT_OES;case xl.RGBA16UI:return e.UNSIGNED_SHORT;case xl.RGBA16I:return e.SHORT;case xl.RGBA32F:return e.FLOAT;case xl.RGBA32UI:return e.UNSIGNED_INT;case xl.RGBA32I:return e.INT;case xl.R5G6B5:return e.UNSIGNED_SHORT_5_6_5;case xl.R11G11B10F:return e.FLOAT;case xl.RGB5A1:return e.UNSIGNED_SHORT_5_5_5_1;case xl.RGBA4:return e.UNSIGNED_SHORT_4_4_4_4;case xl.RGB10A2:return e.UNSIGNED_BYTE;case xl.RGB10A2UI:return e.UNSIGNED_INT;case xl.RGB9E5:return e.UNSIGNED_BYTE;case xl.DEPTH:return e.UNSIGNED_INT;case xl.DEPTH_STENCIL:return k2.UNSIGNED_INT_24_8_WEBGL;case xl.BC1:case xl.BC1_SRGB:case xl.BC2:case xl.BC2_SRGB:case xl.BC3:case xl.BC3_SRGB:case xl.BC4:return e.UNSIGNED_BYTE;case xl.BC4_SNORM:return e.BYTE;case xl.BC5:return e.UNSIGNED_BYTE;case xl.BC5_SNORM:return e.BYTE;case xl.BC6H_SF16:case xl.BC6H_UF16:return e.FLOAT;case xl.BC7:case xl.BC7_SRGB:case xl.ETC_RGB8:case xl.ETC2_RGB8:case xl.ETC2_SRGB8:case xl.ETC2_RGB8_A1:case xl.ETC2_SRGB8_A1:case xl.EAC_R11:return e.UNSIGNED_BYTE;case xl.EAC_R11SN:return e.BYTE;case xl.EAC_RG11:return e.UNSIGNED_BYTE;case xl.EAC_RG11SN:return e.BYTE;case xl.PVRTC_RGB2:case xl.PVRTC_RGBA2:case xl.PVRTC_RGB4:case xl.PVRTC_RGBA4:case xl.PVRTC2_2BPP:case xl.PVRTC2_4BPP:return e.UNSIGNED_BYTE;case xl.ASTC_RGBA_4X4:case xl.ASTC_RGBA_5X4:case xl.ASTC_RGBA_5X5:case xl.ASTC_RGBA_6X5:case xl.ASTC_RGBA_6X6:case xl.ASTC_RGBA_8X5:case xl.ASTC_RGBA_8X6:case xl.ASTC_RGBA_8X8:case xl.ASTC_RGBA_10X5:case xl.ASTC_RGBA_10X6:case xl.ASTC_RGBA_10X8:case xl.ASTC_RGBA_10X10:case xl.ASTC_RGBA_12X10:case xl.ASTC_RGBA_12X12:case xl.ASTC_SRGBA_4X4:case xl.ASTC_SRGBA_5X4:case xl.ASTC_SRGBA_5X5:case xl.ASTC_SRGBA_6X5:case xl.ASTC_SRGBA_6X6:case xl.ASTC_SRGBA_8X5:case xl.ASTC_SRGBA_8X6:case xl.ASTC_SRGBA_8X8:case xl.ASTC_SRGBA_10X5:case xl.ASTC_SRGBA_10X6:case xl.ASTC_SRGBA_10X8:case xl.ASTC_SRGBA_10X10:case xl.ASTC_SRGBA_12X10:case xl.ASTC_SRGBA_12X12:default:return e.UNSIGNED_BYTE}}function z2(t,e){switch(t){case Rl.BOOL:return e.BOOL;case Rl.BOOL2:return e.BOOL_VEC2;case Rl.BOOL3:return e.BOOL_VEC3;case Rl.BOOL4:return e.BOOL_VEC4;case Rl.INT:return e.INT;case Rl.INT2:return e.INT_VEC2;case Rl.INT3:return e.INT_VEC3;case Rl.INT4:return e.INT_VEC4;case Rl.UINT:return e.UNSIGNED_INT;case Rl.FLOAT:return e.FLOAT;case Rl.FLOAT2:return e.FLOAT_VEC2;case Rl.FLOAT3:return e.FLOAT_VEC3;case Rl.FLOAT4:return e.FLOAT_VEC4;case Rl.MAT2:return e.FLOAT_MAT2;case Rl.MAT3:return e.FLOAT_MAT3;case Rl.MAT4:return e.FLOAT_MAT4;case Rl.SAMPLER2D:return e.SAMPLER_2D;case Rl.SAMPLER_CUBE:return e.SAMPLER_CUBE;default:return console.error("Unsupported GLType, convert to GL type failed."),Rl.UNKNOWN}}function H2(t){switch(t){case Rl.BOOL:case Rl.BOOL2:case Rl.BOOL3:case Rl.BOOL4:case Rl.INT:case Rl.INT2:case Rl.INT3:case Rl.INT4:case Rl.UINT:return Int32Array;case Rl.FLOAT:case Rl.FLOAT2:case Rl.FLOAT3:case Rl.FLOAT4:case Rl.MAT2:case Rl.MAT3:case Rl.MAT4:return Float32Array;default:return console.error("Unsupported GLType, convert to TypedArrayConstructor failed."),Float32Array}}function W2(t,e){switch(t){case e.BOOL:return Rl.BOOL;case e.BOOL_VEC2:return Rl.BOOL2;case e.BOOL_VEC3:return Rl.BOOL3;case e.BOOL_VEC4:return Rl.BOOL4;case e.INT:return Rl.INT;case e.INT_VEC2:return Rl.INT2;case e.INT_VEC3:return Rl.INT3;case e.INT_VEC4:return Rl.INT4;case e.UNSIGNED_INT:return Rl.UINT;case e.FLOAT:return Rl.FLOAT;case e.FLOAT_VEC2:return Rl.FLOAT2;case e.FLOAT_VEC3:return Rl.FLOAT3;case e.FLOAT_VEC4:return Rl.FLOAT4;case e.FLOAT_MAT2:return Rl.MAT2;case e.FLOAT_MAT3:return Rl.MAT3;case e.FLOAT_MAT4:return Rl.MAT4;case e.SAMPLER_2D:return Rl.SAMPLER2D;case e.SAMPLER_CUBE:return Rl.SAMPLER_CUBE;default:return console.error("Unsupported GLType, convert to Type failed."),Rl.UNKNOWN}}function X2(t,e){switch(t){case e.BOOL:return 4;case e.BOOL_VEC2:return 8;case e.BOOL_VEC3:return 12;case e.BOOL_VEC4:return 16;case e.INT:return 4;case e.INT_VEC2:return 8;case e.INT_VEC3:return 12;case e.INT_VEC4:return 16;case e.UNSIGNED_INT:case e.FLOAT:return 4;case e.FLOAT_VEC2:return 8;case e.FLOAT_VEC3:return 12;case e.FLOAT_VEC4:case e.FLOAT_MAT2:return 16;case e.FLOAT_MAT3:return 36;case e.FLOAT_MAT4:return 64;case e.SAMPLER_2D:case e.SAMPLER_CUBE:return 4;default:return console.error("Unsupported GLType, get type failed."),0}}function j2(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}}V2._instance=null;var Y2,q2=[512,513,514,515,516,517,518,519],K2=[0,7680,7681,7682,7683,5386,34055,34056],J2=[32774,32778,32779,32775,32776],Q2=[0,1,770,772,771,773,768,774,769,775,776,32769,32770,32771,32772];!function(t){t[t.BEGIN_RENDER_PASS=0]="BEGIN_RENDER_PASS",t[t.END_RENDER_PASS=1]="END_RENDER_PASS",t[t.BIND_STATES=2]="BIND_STATES",t[t.DRAW=3]="DRAW",t[t.UPDATE_BUFFER=4]="UPDATE_BUFFER",t[t.COPY_BUFFER_TO_TEXTURE=5]="COPY_BUFFER_TO_TEXTURE",t[t.BLIT_TEXTURE=6]="BLIT_TEXTURE",t[t.COUNT=7]="COUNT"}(Y2||(Y2={}));var Z2=function(t){this.cmdType=void 0,this.refCount=0,this.cmdType=t},$2=function(t){function e(){var e;return(e=t.call(this,Y2.BEGIN_RENDER_PASS)||this).gpuRenderPass=null,e.gpuFramebuffer=null,e.renderArea=new mc,e.clearFlag=oc.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}(Z2),t3=function(t){function e(){var e;return(e=t.call(this,Y2.BIND_STATES)||this).gpuPipelineState=null,e.gpuInputAssembler=null,e.gpuDescriptorSets=[],e.dynamicOffsets=[],e.dynamicStates=new d_,e}return s(e,t),e.prototype.clear=function(){this.gpuPipelineState=null,this.gpuDescriptorSets.length=0,this.gpuInputAssembler=null,this.dynamicOffsets.length=0},e}(Z2),e3=function(t){function e(){var e;return(e=t.call(this,Y2.DRAW)||this).drawInfo=new Bc,e}return s(e,t),e.prototype.clear=function(){},e}(Z2),i3=function(t){function e(){var e;return(e=t.call(this,Y2.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}(Z2),n3=function(t){function e(){var e;return(e=t.call(this,Y2.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}(Z2),r3=function(t){function e(){var e;return(e=t.call(this,Y2.BLIT_TEXTURE)||this).srcTexture=null,e.dstTexture=null,e.regions=[],e.filter=kl.LINEAR,e}return s(e,t),e.prototype.clear=function(){this.srcTexture=null,this.dstTexture=null,this.regions.length=0},e}(Z2),s3=function(){function t(){this.cmds=new du(1),this.beginRenderPassCmds=new du(1),this.bindStatesCmds=new du(1),this.drawCmds=new du(1),this.updateBufferCmds=new du(1),this.copyBufferToTextureCmds=new du(1),this.blitTextureCmds=new du(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 a3(t,e){var i=t.gl,n=t.stateCache,r=e.memUsage&Dl.HOST?i.DYNAMIC_DRAW:i.STATIC_DRAW;if(e.usage&wl.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),f3.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&wl.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),f3.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&wl.UNIFORM?(e.glTarget=i.NONE,e.buffer&&(e.vf32=new Float32Array(e.buffer.buffer))):(e.usage&wl.INDIRECT||e.usage&wl.TRANSFER_DST||e.usage&wl.TRANSFER_SRC||console.error("Unsupported BufferType, create buffer failed."),e.glTarget=i.NONE)}function o3(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),f3.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),f3.gpuInputAssembler=null,i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,null),t.stateCache.glElementArrayBuffer=null}i.deleteBuffer(e.glBuffer),e.glBuffer=null}}function h3(t,e,i,n,r){if(e.usage&wl.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&wl.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),f3.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),f3.gpuInputAssembler=null,t.stateCache.glElementArrayBuffer!==e.glBuffer&&(h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,e.glBuffer),t.stateCache.glElementArrayBuffer=e.glBuffer);break;default:return void console.error("Unsupported BufferType, update buffer failed.")}r===o.byteLength?h.bufferSubData(e.glTarget,n,o):h.bufferSubData(e.glTarget,n,o.slice(0,r))}}function u3(t,e){for(var i=t.gl,n=function(){var t=e.gpuStages[r],n=0,s="",a=1;switch(t.type){case Xl.VERTEX:s="VertexShader",n=i.VERTEX_SHADER;break;case Xl.FRAGMENT:s="FragmentShader",n=i.FRAGMENT_SHADER;break;default:return console.error("Unsupported ShaderType."),{v:void 0}}var o=i.createShader(n);if(o&&(t.glShader=o,i.shaderSource(t.glShader,t.source),i.compileShader(t.glShader),!i.getShaderParameter(t.glShader,i.COMPILE_STATUS))){console.error(s+" in '"+e.name+"' compilation failed."),console.error("Shader source dump:",t.source.replace(/^|\n/g,(function(){return"\n"+a+++" "}))),console.error(i.getShaderInfoLog(t.glShader));for(var h=0;h<e.gpuStages.length;h++){var u=e.gpuStages[r];u.glShader&&(i.deleteShader(u.glShader),u.glShader=null)}return{v:void 0}}},r=0;r<e.gpuStages.length;r++){var s=n();if("object"==typeof s)return s.v}var a=i.createProgram();if(a){e.glProgram=a;for(var o=0;o<e.gpuStages.length;o++){var h=e.gpuStages[o];i.attachShader(e.glProgram,h.glShader)}if(i.linkProgram(e.glProgram),t.extensions.destroyShadersImmediately)for(var u=0;u<e.gpuStages.length;u++){var l=e.gpuStages[u];l.glShader&&(i.detachShader(e.glProgram,l.glShader),i.deleteShader(l.glShader),l.glShader=null)}if(!i.getProgramParameter(e.glProgram,i.LINK_STATUS))return console.error("Failed to link shader '"+e.name+"'."),void console.error(i.getProgramInfoLog(e.glProgram));U("Shader '"+e.name+"' compilation succeeded.");var c=i.getProgramParameter(e.glProgram,i.ACTIVE_ATTRIBUTES);e.glInputs=new Array(c);for(var _=0;_<c;++_){var f=i.getActiveAttrib(e.glProgram,_);if(f){var d,p=f.name.indexOf("[");d=-1!==p?f.name.substr(0,p):f.name;var m=i.getAttribLocation(e.glProgram,d),g=W2(f.type,i),y=X2(f.type,i);e.glInputs[_]={binding:m,name:d,type:g,stride:y,count:f.size,size:y*f.size,glType:f.type,glLoc:m}}}if(e.blocks.length>0){e.glBlocks=new Array(e.blocks.length);for(var S=0;S<e.blocks.length;++S){var A=e.blocks[S],T={set:A.set,binding:A.binding,name:A.name,size:0,glUniforms:new Array(A.members.length),glActiveUniforms:[]};e.glBlocks[S]=T;for(var E=0;E<A.members.length;++E){var b=A.members[E],x=z2(b.type,i),C=X2(x,i),R=C*b.count;T.glUniforms[E]={binding:-1,name:b.name,type:b.type,stride:C,count:b.count,size:R,offset:0,glType:x,glLoc:null,array:null}}}}for(var w=0;w<e.subpassInputs.length;++w){var I=e.subpassInputs[w];e.samplerTextures.push(new kc(I.set,I.binding,I.name,Rl.SAMPLER2D,I.count))}if(e.samplerTextures.length>0){e.glSamplerTextures=new Array(e.samplerTextures.length);for(var B=0;B<e.samplerTextures.length;++B){var D=e.samplerTextures[B];e.glSamplerTextures[B]={set:D.set,binding:D.binding,name:D.name,type:D.type,count:D.count,units:[],glUnits:null,glType:z2(D.type,i),glLoc:null}}}for(var P=i.getProgramParameter(e.glProgram,i.ACTIVE_UNIFORMS),O=0;O<P;++O){var M=i.getActiveUniform(e.glProgram,O);if(M&&M.type!==i.SAMPLER_2D&&M.type!==i.SAMPLER_CUBE){var N=i.getUniformLocation(e.glProgram,M.name);if(t.extensions.isLocationActive(N)){var L,F=M.name.indexOf("[");L=-1!==F?M.name.substr(0,F):M.name;for(var k=0;k<e.glBlocks.length;k++)for(var G=e.glBlocks[k],V=0;V<G.glUniforms.length;V++){var z=G.glUniforms[V];if(z.name===L){z.glLoc=N,z.count=M.size,z.size=z.stride*z.count,z.array=new(H2(z.type))(z.size/4),G.glActiveUniforms.push(z);break}}}}}for(var H=0;H<e.glBlocks.length;H++)for(var W=e.glBlocks[H],X=0;X<W.glUniforms.length;X++){var j=W.glUniforms[X];j.offset=W.size/4,W.size+=j.size}var Y=[],q=[],K=t.bindingMappings,J=t.stateCache.texUnitCacheMap;if(v.rendering&&v.rendering.enableEffectImport)for(var Q=0;Q<e.samplerTextures.length;++Q){var Z=e.samplerTextures[Q],$=i.getUniformLocation(e.glProgram,Z.name);t.extensions.isLocationActive($)&&(Y.push(e.glSamplerTextures[Q]),q.push($)),void 0===J[Z.name]&&(J[Z.name]=Z.flattened%t.capabilities.maxTextureUnits)}else{for(var tt=0,et=0;et<e.blocks.length;++et)e.blocks[et].set===K.flexibleSet&&tt++;for(var it=0,nt=0;nt<e.samplerTextures.length;++nt){var rt=e.samplerTextures[nt],st=i.getUniformLocation(e.glProgram,rt.name);if(t.extensions.isLocationActive(st)&&(Y.push(e.glSamplerTextures[nt]),q.push(st)),void 0===J[rt.name]){var at=rt.binding+K.samplerTextureOffsets[rt.set]+it;rt.set===K.flexibleSet&&(at-=tt),J[rt.name]=at%t.capabilities.maxTextureUnits,it+=rt.count-1}}}if(Y.length){for(var ot=[],ht=0;ht<Y.length;++ht){var ut=Y[ht],lt=J[ut.name];if(void 0!==lt){ut.glLoc=q[ht];for(var ct=0;ct<ut.count;++ct){for(;ot[lt];)lt=(lt+1)%t.capabilities.maxTextureUnits;ut.units.push(lt),ot[lt]=!0}}}for(var _t=0,ft=0;ft<Y.length;++ft){var dt=Y[ft];if(!t.extensions.isLocationActive(dt.glLoc)){dt.glLoc=q[ft];for(var pt=0;pt<dt.count;++pt){for(;ot[_t];)_t=(_t+1)%t.capabilities.maxTextureUnits;void 0===J[dt.name]&&(J[dt.name]=_t),dt.units.push(_t),ot[_t]=!0}}}t.stateCache.glProgram!==e.glProgram&&i.useProgram(e.glProgram);for(var mt=0;mt<Y.length;mt++){var gt=Y[mt];gt.glUnits=new Int32Array(gt.units),i.uniform1iv(gt.glLoc,gt.glUnits)}t.stateCache.glProgram!==e.glProgram&&i.useProgram(t.stateCache.glProgram)}for(var 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=Y}}function l3(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 c3(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=U2(s.format,i),u=m_[s.format].size;e.glAttribs[r]={name:s.name,glBuffer:o.glBuffer,glType:h,size:u,count:m_[s.format].count,stride:o.stride,componentCount:j2(h,i),isNormalized:void 0!==s.isNormalized&&s.isNormalized,isInstanced:void 0!==s.isInstanced&&s.isInstanced,offset:n[a]},n[a]+=u}}function _3(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 f3={gpuPipelineState:null,gpuInputAssembler:null,glPrimitive:0},d3=new mc;function p3(t,e,i,n,r,s,a){var o=t.gl,h=t.stateCache,u=0;if(i&&(d3.x=n.x<<i.lodLevel,d3.y=n.y<<i.lodLevel,d3.width=n.width<<i.lodLevel,d3.height=n.height<<i.lodLevel),i&&e){h.glFramebuffer!==i.glFramebuffer&&(o.bindFramebuffer(o.FRAMEBUFFER,i.glFramebuffer),h.glFramebuffer=i.glFramebuffer),h.viewport.left===d3.x&&h.viewport.top===d3.y&&h.viewport.width===d3.width&&h.viewport.height===d3.height||(o.viewport(d3.x,d3.y,d3.width,d3.height),h.viewport.left=d3.x,h.viewport.top=d3.y,h.viewport.width=d3.width,h.viewport.height=d3.height),h.scissorRect.x===d3.x&&h.scissorRect.y===d3.y&&h.scissorRect.width===d3.width&&h.scissorRect.height===d3.height||(o.scissor(d3.x,d3.y,d3.width,d3.height),h.scissorRect.x=d3.x,h.scissorRect.y=d3.y,h.scissorRect.width=d3.width,h.scissorRect.height=d3.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!==xl.UNKNOWN)switch(_.loadOp){case jl.LOAD:break;case jl.CLEAR:h.bs.targets[0].blendColorMask!==Wl.ALL&&o.colorMask(!0,!0,!0,!0);var f=r[0];o.clearColor(f.x,f.y,f.z,f.w),u|=o.COLOR_BUFFER_BIT;break;case jl.DISCARD:}}if(e.depthStencilAttachment&&e.depthStencilAttachment.format!==xl.UNKNOWN){switch(e.depthStencilAttachment.depthLoadOp){case jl.LOAD:break;case jl.CLEAR:h.dss.depthWrite||o.depthMask(!0),o.clearDepth(s),u|=o.DEPTH_BUFFER_BIT;break;case jl.DISCARD:}if(m_[e.depthStencilAttachment.format].hasStencil)switch(e.depthStencilAttachment.stencilLoadOp){case jl.LOAD:break;case jl.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 jl.DISCARD:}}if(u&&o.clear(u),u&o.COLOR_BUFFER_BIT){var d=h.bs.targets[0].blendColorMask;if(d!==Wl.ALL){var p=(d&Wl.R)!==Wl.NONE,m=(d&Wl.G)!==Wl.NONE,g=(d&Wl.B)!==Wl.NONE,y=(d&Wl.A)!==Wl.NONE;o.colorMask(p,m,g,y)}}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 m3(t,e,i,n,r,s){var a,o,h,u=t.gl,l=t.stateCache,c=e&&e.gpuShader,_=!1;if(e&&f3.gpuPipelineState!==e){if(f3.gpuPipelineState=e,f3.glPrimitive=e.glPrimitive,e.gpuShader){var f=e.gpuShader.glProgram;l.glProgram!==f&&(u.useProgram(f),l.glProgram=f,_=!0)}var d=e.rs;if(d){if(l.rs.cullMode!==d.cullMode){switch(d.cullMode){case tc.NONE:u.disable(u.CULL_FACE);break;case tc.FRONT:u.enable(u.CULL_FACE),u.cullFace(u.FRONT);break;case tc.BACK:u.enable(u.CULL_FACE),u.cullFace(u.BACK)}l.rs.cullMode=d.cullMode}var p=d.isFrontFaceCCW;l.rs.isFrontFaceCCW!==p&&(u.frontFace(p?u.CCW:u.CW),l.rs.isFrontFaceCCW=p),l.rs.depthBias===d.depthBias&&l.rs.depthBiasSlop===d.depthBiasSlop||(u.polygonOffset(d.depthBias,d.depthBiasSlop),l.rs.depthBias=d.depthBias,l.rs.depthBiasSlop=d.depthBiasSlop),l.rs.lineWidth!==d.lineWidth&&(u.lineWidth(d.lineWidth),l.rs.lineWidth=d.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(q2[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,q2[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,K2[m.stencilFailOpFront],K2[m.stencilZFailOpFront],K2[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,q2[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,K2[m.stencilFailOpBack],K2[m.stencilZFailOpBack],K2[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 y=g.targets[0],v=l.bs.targets[0];v.blend!==y.blend&&(y.blend?u.enable(u.BLEND):u.disable(u.BLEND),v.blend=y.blend),v.blendEq===y.blendEq&&v.blendAlphaEq===y.blendAlphaEq||(u.blendEquationSeparate(J2[y.blendEq],J2[y.blendAlphaEq]),v.blendEq=y.blendEq,v.blendAlphaEq=y.blendAlphaEq),v.blendSrc===y.blendSrc&&v.blendDst===y.blendDst&&v.blendSrcAlpha===y.blendSrcAlpha&&v.blendDstAlpha===y.blendDstAlpha||(u.blendFuncSeparate(Q2[y.blendSrc],Q2[y.blendDst],Q2[y.blendSrcAlpha],Q2[y.blendDstAlpha]),v.blendSrc=y.blendSrc,v.blendDst=y.blendDst,v.blendSrcAlpha=y.blendSrcAlpha,v.blendDstAlpha=y.blendDstAlpha),v.blendColorMask!==y.blendColorMask&&(u.colorMask((y.blendColorMask&Wl.R)!==Wl.NONE,(y.blendColorMask&Wl.G)!==Wl.NONE,(y.blendColorMask&Wl.B)!==Wl.NONE,(y.blendColorMask&Wl.A)!==Wl.NONE),v.blendColorMask=y.blendColorMask)}}if(e&&e.gpuPipelineLayout&&c){for(var S=c.glBlocks.length,A=e.gpuPipelineLayout.dynamicOffsetIndices,T=0;T<S;T++){var E=c.glBlocks[T],b=n[E.set],x=b&&b.descriptorIndices[E.binding],C=x>=0&&b.gpuDescriptors[x],R=null,w=0;if(C&&C.gpuBuffer){var I=C.gpuBuffer,B=A[E.set],D=B&&B[E.binding];D>=0&&(w=r[D]),"vf32"in I?R=I.vf32:(w+=I.offset,R=I.gpuBuffer.vf32),w>>=2}if(R)for(var P=E.glActiveUniforms.length,O=0;O<P;O++){var M=E.glActiveUniforms[O];switch(M.glType){case u.BOOL:case u.INT:for(var N=0;N<M.array.length;++N){var L=M.offset+w+N;if(R[L]!==M.array[N]){for(var F=N,k=L;F<M.array.length;++F,++k)M.array[F]=R[k];u.uniform1iv(M.glLoc,M.array);break}}break;case u.BOOL_VEC2:case u.INT_VEC2:for(var G=0;G<M.array.length;++G){var V=M.offset+w+G;if(R[V]!==M.array[G]){for(var U=G,z=V;U<M.array.length;++U,++z)M.array[U]=R[z];u.uniform2iv(M.glLoc,M.array);break}}break;case u.BOOL_VEC3:case u.INT_VEC3:for(var H=0;H<M.array.length;++H){var W=M.offset+w+H;if(R[W]!==M.array[H]){for(var X=H,j=W;X<M.array.length;++X,++j)M.array[X]=R[j];u.uniform3iv(M.glLoc,M.array);break}}break;case u.BOOL_VEC4:case u.INT_VEC4:for(var Y=0;Y<M.array.length;++Y){var q=M.offset+w+Y;if(R[q]!==M.array[Y]){for(var K=Y,J=q;K<M.array.length;++K,++J)M.array[K]=R[J];u.uniform4iv(M.glLoc,M.array);break}}break;case u.FLOAT:for(var Q=0;Q<M.array.length;++Q){var Z=M.offset+w+Q;if(R[Z]!==M.array[Q]){for(var $=Q,tt=Z;$<M.array.length;++$,++tt)M.array[$]=R[tt];u.uniform1fv(M.glLoc,M.array);break}}break;case u.FLOAT_VEC2:for(var et=0;et<M.array.length;++et){var it=M.offset+w+et;if(R[it]!==M.array[et]){for(var nt=et,rt=it;nt<M.array.length;++nt,++rt)M.array[nt]=R[rt];u.uniform2fv(M.glLoc,M.array);break}}break;case u.FLOAT_VEC3:for(var st=0;st<M.array.length;++st){var at=M.offset+w+st;if(R[at]!==M.array[st]){for(var ot=st,ht=at;ot<M.array.length;++ot,++ht)M.array[ot]=R[ht];u.uniform3fv(M.glLoc,M.array);break}}break;case u.FLOAT_VEC4:for(var ut=0;ut<M.array.length;++ut){var lt=M.offset+w+ut;if(R[lt]!==M.array[ut]){for(var ct=ut,_t=lt;ct<M.array.length;++ct,++_t)M.array[ct]=R[_t];u.uniform4fv(M.glLoc,M.array);break}}break;case u.FLOAT_MAT2:for(var ft=0;ft<M.array.length;++ft){var dt=M.offset+w+ft;if(R[dt]!==M.array[ft]){for(var pt=ft,mt=dt;pt<M.array.length;++pt,++mt)M.array[pt]=R[mt];u.uniformMatrix2fv(M.glLoc,!1,M.array);break}}break;case u.FLOAT_MAT3:for(var gt=0;gt<M.array.length;++gt){var yt=M.offset+w+gt;if(R[yt]!==M.array[gt]){for(var vt=gt,St=yt;vt<M.array.length;++vt,++St)M.array[vt]=R[St];u.uniformMatrix3fv(M.glLoc,!1,M.array);break}}break;case u.FLOAT_MAT4:for(var At=0;At<M.array.length;++At){var Tt=M.offset+w+At;if(R[Tt]!==M.array[At]){for(var Et=At,bt=Tt;Et<M.array.length;++Et,++bt)M.array[Et]=R[bt];u.uniformMatrix4fv(M.glLoc,!1,M.array);break}}}}}for(var xt=c.glSamplerTextures.length,Ct=0;Ct<xt;Ct++)for(var Rt=c.glSamplerTextures[Ct],wt=n[Rt.set],It=wt&&wt.descriptorIndices[Rt.binding],Bt=It>=0&&wt.gpuDescriptors[It],Dt=Rt.units.length,Pt=0;Pt<Dt;Pt++){var Ot=Rt.units[Pt];if(Bt&&Bt.gpuSampler){if(Bt.gpuTexture&&Bt.gpuTexture.size>0){var Mt=Bt.gpuTexture,Nt=l.glTexUnits[Ot];Nt.glTexture!==Mt.glTexture&&(l.texUnit!==Ot&&(u.activeTexture(u.TEXTURE0+Ot),l.texUnit=Ot),Mt.glTexture?u.bindTexture(Mt.glTarget,Mt.glTexture):u.bindTexture(Mt.glTarget,t.nullTex2D.gpuTexture.glTexture),Nt.glTexture=Mt.glTexture);var Lt=Bt.gpuSampler;Mt.isPowerOf2?(a=Lt.glWrapS,o=Lt.glWrapT):(a=u.CLAMP_TO_EDGE,o=u.CLAMP_TO_EDGE),h=Mt.isPowerOf2?Mt.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,Mt.glWrapS!==a&&(l.texUnit!==Ot&&(u.activeTexture(u.TEXTURE0+Ot),l.texUnit=Ot),u.texParameteri(Mt.glTarget,u.TEXTURE_WRAP_S,a),Mt.glWrapS=a),Mt.glWrapT!==o&&(l.texUnit!==Ot&&(u.activeTexture(u.TEXTURE0+Ot),l.texUnit=Ot),u.texParameteri(Mt.glTarget,u.TEXTURE_WRAP_T,o),Mt.glWrapT=o),Mt.glMinFilter!==h&&(l.texUnit!==Ot&&(u.activeTexture(u.TEXTURE0+Ot),l.texUnit=Ot),u.texParameteri(Mt.glTarget,u.TEXTURE_MIN_FILTER,h),Mt.glMinFilter=h),Mt.glMagFilter!==Lt.glMagFilter&&(l.texUnit!==Ot&&(u.activeTexture(u.TEXTURE0+Ot),l.texUnit=Ot),u.texParameteri(Mt.glTarget,u.TEXTURE_MAG_FILTER,Lt.glMagFilter),Mt.glMagFilter=Lt.glMagFilter)}Bt=wt.gpuDescriptors[++It]}}}if(i&&c&&(_||f3.gpuInputAssembler!==i)){f3.gpuInputAssembler=i;var Ft=t.extensions.ANGLE_instanced_arrays;if(t.extensions.useVAO){var kt=t.extensions.OES_vertex_array_object,Gt=i.glVAOs.get(c.glProgram);if(!Gt){var Vt;Gt=kt.createVertexArrayOES(),i.glVAOs.set(c.glProgram,Gt),kt.bindVertexArrayOES(Gt),u.bindBuffer(u.ARRAY_BUFFER,null),u.bindBuffer(u.ELEMENT_ARRAY_BUFFER,null),l.glArrayBuffer=null,l.glElementArrayBuffer=null;for(var Ut=c.glInputs.length,zt=0;zt<Ut;zt++){var Ht=c.glInputs[zt];Vt=null;for(var Wt=i.glAttribs.length,Xt=0;Xt<Wt;Xt++){var jt=i.glAttribs[Xt];if(jt.name===Ht.name){Vt=jt;break}}if(Vt){l.glArrayBuffer!==Vt.glBuffer&&(u.bindBuffer(u.ARRAY_BUFFER,Vt.glBuffer),l.glArrayBuffer=Vt.glBuffer);for(var Yt=0;Yt<Vt.componentCount;++Yt){var qt=Ht.glLoc+Yt,Kt=Vt.offset+Vt.size*Yt;u.enableVertexAttribArray(qt),l.glCurrentAttribLocs[qt]=!0,u.vertexAttribPointer(qt,Vt.count,Vt.glType,Vt.isNormalized,Vt.stride,Kt),Ft&&Ft.vertexAttribDivisorANGLE(qt,Vt.isInstanced?1:0)}}}var Jt=i.gpuIndexBuffer;Jt&&u.bindBuffer(u.ELEMENT_ARRAY_BUFFER,Jt.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!==Gt&&(kt.bindVertexArrayOES(Gt),l.glVAO=Gt)}else{for(var Qt=0;Qt<t.capabilities.maxVertexAttributes;++Qt)l.glCurrentAttribLocs[Qt]=!1;for(var Zt=c.glInputs.length,$t=0;$t<Zt;$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 fe=s.stencilStatesFront,de=s.stencilStatesBack;l.dss.stencilWriteMaskFront!==fe.writeMask&&(u.stencilMaskSeparate(u.FRONT,fe.writeMask),l.dss.stencilWriteMaskFront=fe.writeMask),l.dss.stencilWriteMaskBack!==de.writeMask&&(u.stencilMaskSeparate(u.BACK,de.writeMask),l.dss.stencilWriteMaskBack=de.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,q2[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,q2[l.dss.stencilFuncBack],me.reference,me.compareMask),l.dss.stencilRefBack=me.reference,l.dss.stencilReadMaskBack=me.compareMask)}}function g3(t,e){var i=t.gl,n=t.extensions,r=n.ANGLE_instanced_arrays,s=n.WEBGL_multi_draw,a=f3.gpuInputAssembler,o=f3.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 f=e.firstIndex*h.stride;r.drawElementsInstancedANGLE(o,e.indexCount,a.glIndexType,f,e.instanceCount)}}else e.vertexCount>0&&r.drawArraysInstancedANGLE(o,e.firstVertex,e.vertexCount,e.instanceCount);else if(h){if(e.indexCount>0){var d=e.firstIndex*h.stride;i.drawElements(o,e.indexCount,a.glIndexType,d)}}else e.vertexCount>0&&i.drawArrays(o,e.firstVertex,e.vertexCount)}}var y3=new Array(Y2.COUNT);function v3(t,e){y3.fill(0);for(var i=0;i<e.cmds.length;++i){var n=e.cmds.array[i],r=y3[n]++;switch(n){case Y2.BEGIN_RENDER_PASS:var s=e.beginRenderPassCmds.array[r];p3(t,s.gpuRenderPass,s.gpuFramebuffer,s.renderArea,s.clearColors,s.clearDepth,s.clearStencil);break;case Y2.BIND_STATES:var a=e.bindStatesCmds.array[r];m3(t,a.gpuPipelineState,a.gpuInputAssembler,a.gpuDescriptorSets,a.dynamicOffsets,a.dynamicStates);break;case Y2.DRAW:g3(t,e.drawCmds.array[r].drawInfo);break;case Y2.UPDATE_BUFFER:var o=e.updateBufferCmds.array[r];h3(t,o.gpuBuffer,o.buffer,o.offset,o.size);break;case Y2.COPY_BUFFER_TO_TEXTURE:var h=e.copyBufferToTextureCmds.array[r];T3(t,h.buffers,h.gpuTexture,h.regions);break;case Y2.BLIT_TEXTURE:var u=e.blitTextureCmds.array[r];E3(t,u.srcTexture,u.dstTexture,u.regions,u.filter)}}}var S3=new Uint8Array(1);function A3(t,e,i,n,r){var s=C_(e).height,a=A_(e,r.width,r.height,r.depth),o=A_(e,n.width,1,1),h=A_(e,n.width,n.height,1),u=A_(e,r.width,1,1),l=x_(m_[e]);S3.byteLength<a&&(S3=new Uint8Array(a));for(var c=0,_=i,f=0;f<r.depth;f++){_=i+h*f;for(var d=0;d<r.height;d+=s)S3.subarray(c,c+u).set(new Uint8Array(t.buffer,t.byteOffset+_,u)),c+=u,_+=o}var p=a/l.BYTES_PER_ELEMENT;return $(Number.isInteger(p),9101),new l(S3.buffer,0,p)}function T3(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=m_[i.format],u=x_(h),l=h.isCompressed,c=C_(i.format),_=new gc,f=new pc,d=new gc;switch(i.glTarget){case r.TEXTURE_2D:for(var p=0;p<n.length;p++){var m=n[p],g=m.texSubres.mipLevel;f.x=0===m.texOffset.x?0:R_(m.texOffset.x,c.width),f.y=0===m.texOffset.y?0:R_(m.texOffset.y,c.height),_.width=m.texExtent.width<c.width?m.texExtent.width:R_(m.texExtent.width,c.width),_.height=m.texExtent.height<c.height?m.texExtent.width:R_(m.texExtent.height,c.height),d.width=m.buffStride>0?m.buffStride:_.width,d.height=m.buffTexHeight>0?m.buffTexHeight:_.height;var y=m.texExtent.width+f.x===i.width>>g?m.texExtent.width:_.width,v=m.texExtent.height+f.y===i.height>>g?m.texExtent.height:_.height,S=void 0,A=e[a++];if(d.width===_.width&&d.height===_.height){var T=A_(i.format,y,v,1)/u.BYTES_PER_ELEMENT;$(Number.isInteger(T),9101),S=new u(A.buffer,A.byteOffset+m.buffOffset,T)}else S=A3(A,i.format,m.buffOffset,d,_);l?i.glInternalFmt===k2.COMPRESSED_RGB_ETC1_WEBGL||t.extensions.noCompressedTexSubImage2D?r.compressedTexImage2D(r.TEXTURE_2D,g,i.glInternalFmt,y,v,0,S):r.compressedTexSubImage2D(r.TEXTURE_2D,g,f.x,f.y,y,v,i.glFormat,S):r.texSubImage2D(r.TEXTURE_2D,g,f.x,f.y,y,v,i.glFormat,i.glType,S)}break;case r.TEXTURE_CUBE_MAP:for(var E=0;E<n.length;E++){var b=n[E],x=b.texSubres.mipLevel;f.x=0===b.texOffset.x?0:R_(b.texOffset.x,c.width),f.y=0===b.texOffset.y?0:R_(b.texOffset.y,c.height),_.width=b.texExtent.width<c.width?b.texExtent.width:R_(b.texExtent.width,c.width),_.height=b.texExtent.height<c.height?b.texExtent.width:R_(b.texExtent.height,c.height),d.width=b.buffStride>0?b.buffStride:_.width,d.height=b.buffTexHeight>0?b.buffTexHeight:_.height;var C=b.texExtent.width+f.x===i.width>>x?b.texExtent.width:_.width,R=b.texExtent.height+f.y===i.height>>x?b.texExtent.height:_.height,w=b.texSubres.baseArrayLayer+b.texSubres.layerCount;for(o=b.texSubres.baseArrayLayer;o<w;++o){var I=void 0,B=e[a++];if(d.width===_.width&&d.height===_.height){var D=A_(i.format,C,R,1)/u.BYTES_PER_ELEMENT;$(Number.isInteger(D),9101),I=new u(B.buffer,B.byteOffset+b.buffOffset,D)}else I=A3(B,i.format,b.buffOffset,d,_);l?i.glInternalFmt===k2.COMPRESSED_RGB_ETC1_WEBGL||t.extensions.noCompressedTexSubImage2D?r.compressedTexImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+o,x,i.glInternalFmt,C,R,0,I):r.compressedTexSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+o,x,f.x,f.y,C,R,i.glFormat,I):r.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+o,x,f.x,f.y,C,R,i.glFormat,i.glType,I)}}break;default:console.error("Unsupported GL texture type, copy buffer to texture failed.")}i.flags&Ml.GEN_MIPMAP&&r.generateMipmap(i.glTarget)}function E3(t,e,i,n,r){t.blitManager.draw(e,i,n,r)}var b3=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=Ni(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}(),x3=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=V2.instance.gl,e=V2.instance.bindingMappingInfo.maxBlockCounts[0];this._gpuShader={name:"Blit Pass",blocks:[new Fc(0,0,"BlitParams",[new Lc("tilingOffsetSrc",Rl.FLOAT4,1),new Lc("tilingOffsetDst",Rl.FLOAT4,1)],1)],samplerTextures:[new kc(0,e,"textureSrc",Rl.SAMPLER2D,1)],subpassInputs:[],gpuStages:[{type:Xl.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:Xl.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:[]},u3(V2.instance,this._gpuShader),this._gpuDescriptorSetLayout={bindings:[new n_(0,nc.UNIFORM_BUFFER,1,Xl.VERTEX),new n_(e,nc.SAMPLER_TEXTURE,1,Xl.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 V_(!1,!1),bs:null,dynamicStates:[],gpuRenderPass:null},this._gpuVertexBuffer={usage:wl.VERTEX,memUsage:Dl.DEVICE,size:16*Float32Array.BYTES_PER_ELEMENT,stride:4*Float32Array.BYTES_PER_ELEMENT,buffer:null,vf32:null,indirects:new b3,glTarget:0,glBuffer:null},a3(V2.instance,this._gpuVertexBuffer),V2.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]);h3(V2.instance,this._gpuVertexBuffer,n,0,n.length),this._gpuInputAssembler={attributes:[new Xc("a_position",xl.RG32F),new Xc("a_texCoord",xl.RG32F)],gpuVertexBuffers:[this._gpuVertexBuffer],gpuIndexBuffer:null,gpuIndirectBuffer:null,glAttribs:[],glIndexType:0,glVAOs:new Map},c3(V2.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:wl.UNIFORM,memUsage:Dl.DEVICE,size:8*Float32Array.BYTES_PER_ELEMENT,stride:8*Float32Array.BYTES_PER_ELEMENT,buffer:this._uniformBuffer,vf32:null,indirects:new b3,glTarget:0,glBuffer:null},a3(V2.instance,this._gpuUniformBuffer),V2.instance.memoryStatus.bufferSize+=this._gpuUniformBuffer.size,this._gpuDescriptorSet={gpuDescriptors:[{type:nc.UNIFORM_BUFFER,gpuBuffer:this._gpuUniformBuffer,gpuTexture:null,gpuSampler:null},{type:nc.SAMPLER_TEXTURE,gpuBuffer:null,gpuTexture:null,gpuSampler:null}],descriptorIndices:this._gpuDescriptorSetLayout.descriptorIndices},this._drawInfo=new Bc(4,0,0,0,0,0,0),this._glFramebuffer=V2.instance.gl.createFramebuffer()}var e=t.prototype;return e.destroy=function(){this._glFramebuffer&&(V2.instance.gl.deleteFramebuffer(this._glFramebuffer),this._glFramebuffer=null),this._gpuVertexBuffer&&(V2.instance.memoryStatus.bufferSize-=this._gpuVertexBuffer.size,o3(V2.instance,this._gpuVertexBuffer)),this._gpuUniformBuffer&&(V2.instance.memoryStatus.bufferSize-=this._gpuUniformBuffer.size,o3(V2.instance,this._gpuUniformBuffer)),this._gpuShader&&l3(V2.instance,this._gpuShader),this._gpuInputAssembler&&_3(V2.instance,this._gpuInputAssembler)},e.draw=function(t,e,i,n){var r=V2.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===kl.POINT?this._gpuPointSampler:this._gpuLinearSampler;var u=m_[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 f=0;f<c.length;++f){var d=i[c[f]];t.glTexture&&_!==d.srcSubres.mipLevel&&(_=d.srcSubres.mipLevel,s.framebufferTexture2D(s.FRAMEBUFFER,l,e.glTarget,e.glTexture,_));var p=t.width,m=t.height,g=e.width,y=e.height;this._uniformBuffer[0]=d.srcExtent.width/p,this._uniformBuffer[1]=d.srcExtent.height/m,this._uniformBuffer[2]=d.srcOffset.x/p,this._uniformBuffer[3]=d.srcOffset.y/m,this._uniformBuffer[4]=d.dstExtent.width/g,this._uniformBuffer[5]=d.dstExtent.height/y,this._uniformBuffer[6]=d.dstOffset.x/g,this._uniformBuffer[7]=d.dstOffset.y/y,h3(r,this._gpuUniformBuffer,this._uniformBuffer,0,this._uniformBuffer.length*Float32Array.BYTES_PER_ELEMENT),m3(r,this._gpuPipelineState,this._gpuInputAssembler,[this._gpuDescriptorSet],[],null),g3(r,this._drawInfo)}a.glFramebuffer!==o&&(r.gl.bindFramebuffer(r.gl.FRAMEBUFFER,o),a.glFramebuffer=o);var v=a.viewport;s.viewport(v.left,v.top,v.width,v.height);var S=a.scissorRect;s.scissor(S.x,S.y,S.width,S.height)}},t}(),C3=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._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&wl.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 b3,glTarget:0,glBuffer:null},this._usage&wl.UNIFORM&&(this._gpuBuffer.buffer=this._uniformBuffer),a3(V2.instance,this._gpuBuffer),V2.instance.memoryStatus.bufferSize+=this._size},i.destroy=function(){this._gpuBuffer&&(o3(V2.instance,this._gpuBuffer),V2.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&Dl.HOST?i.DYNAMIC_DRAW:i.STATIC_DRAW;e.usage&wl.VERTEX?(t.extensions.useVAO&&n.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),n.glVAO=null),f3.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&wl.INDEX?(t.extensions.useVAO&&n.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),n.glVAO=null),f3.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&wl.UNIFORM?e.buffer&&(e.vf32=new Float32Array(e.buffer.buffer)):(e.usage&wl.INDIRECT||e.usage&wl.TRANSFER_DST||e.usage&wl.TRANSFER_SRC||console.error("Unsupported BufferType, create buffer failed."),e.glTarget=i.NONE)}(V2.instance,this._gpuBuffer),V2.instance.memoryStatus.bufferSize-=e,V2.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&wl.INDIRECT?0:t.byteLength,h3(V2.instance,this._gpuBuffer,t,0,i))},n(e,[{key:"gpuBuffer",get:function(){return this._gpuBuffer}},{key:"gpuBufferView",get:function(){return this._gpuBufferView}}]),e}(I_),R3=function(){function t(t,e){this._frees=void 0,this._freeIdx=0,this._freeCmds=void 0,this._frees=new Array(e),this._freeCmds=new du(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}(),w3=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 R3($2,1),this.bindStatesCmdPool=new R3(t3,1),this.drawCmdPool=new R3(e3,1),this.updateBufferCmdPool=new R3(i3,1),this.copyBufferToTextureCmdPool=new R3(n3,1),this.blitTextureCmdPool=new R3(r3,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}(),I3=function(t){function e(){for(var e,i=arguments.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 s3,e._cmdAllocator=new w3,e._isInRenderPass=!1,e._curGPUPipelineState=null,e._curGPUInputAssembler=null,e._curGPUDescriptorSets=[],e._curDynamicOffsets=Array(8).fill(0),e._curDynamicStates=new d_,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=V2.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($2);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(Y2.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&ic.FRONT&&i.writeMask!==e&&(i.writeMask=e,this._isStateInvalied=!0),t&ic.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&ic.FRONT&&(n.compareMask===i&&n.reference===e||(n.reference=e,n.compareMask=i,this._isStateInvalied=!0)),t&ic.BACK&&(r.compareMask===i&&r.reference===e||(r.reference=e,r.compareMask=i,this._isStateInvalied=!0))},i.draw=function(t){if(this._type===ac.PRIMARY&&this._isInRenderPass||this._type===ac.SECONDARY){this._isStateInvalied&&this.bindStates();var e="drawInfo"in t?t.drawInfo:t,i=this._cmdAllocator.drawCmdPool.alloc(e3);i.drawInfo.copy(e),this.cmdPackage.drawCmds.push(i),this.cmdPackage.cmds.push(Y2.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===ac.PRIMARY&&!this._isInRenderPass||this._type===ac.SECONDARY){var n=t.gpuBuffer;if(n){var r,s=this._cmdAllocator.updateBufferCmdPool.alloc(i3),a=0;t.usage&wl.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(Y2.UPDATE_BUFFER)}}else console.error("Command 'updateBuffer' must be recorded outside a render pass.")},i.copyBuffersToTexture=function(t,e,i){if(this._type===ac.PRIMARY&&!this._isInRenderPass||this._type===ac.SECONDARY){var n=e.gpuTexture;if(n){var r=this._cmdAllocator.copyBufferToTextureCmdPool.alloc(n3);r&&(r.gpuTexture=n,r.regions=i,r.buffers=t,this.cmdPackage.copyBufferToTextureCmds.push(r),this.cmdPackage.cmds.push(Y2.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 f=n.cmdPackage.copyBufferToTextureCmds.array[_];++f.refCount,this.cmdPackage.copyBufferToTextureCmds.push(f)}for(var d=0;d<n.cmdPackage.blitTextureCmds.length;++d){var p=n.cmdPackage.blitTextureCmds.array[d];++p.refCount,this.cmdPackage.blitTextureCmds.push(p)}this.cmdPackage.cmds.concat(n.cmdPackage.cmds.array),this._numDrawCalls+=n._numDrawCalls,this._numInstances+=n._numInstances,this._numTris+=n._numTris}},i.pipelineBarrier=function(){},i.bindStates=function(){var t=this._cmdAllocator.bindStatesCmdPool.alloc(t3);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(Y2.BIND_STATES),this._isStateInvalied=!1)},i.blitTexture=function(t,e,i,n){var r=this._cmdAllocator.blitTextureCmdPool.alloc(r3);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(Y2.BLIT_TEXTURE)},e}(B_),B3=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._gpuFramebuffer=null,e}s(e,t);var i=e.prototype;return i.initialize=function(t){this._renderPass=t.renderPass,this._colorTextures=t.colorTextures||[],this._depthStencilTexture=t.depthStencilTexture||null;for(var e=0,i=[],n=0;n<t.colorTextures.length;++n){var r=t.colorTextures[n];r&&(i.push(r.gpuTexture),e=r.lodLevel)}var s=null;t.depthStencilTexture&&(s=t.depthStencilTexture.gpuTexture,e=t.depthStencilTexture.lodLevel);var a=Number.MAX_SAFE_INTEGER,o=Number.MAX_SAFE_INTEGER;this._gpuFramebuffer={gpuRenderPass:t.renderPass.gpuRenderPass,gpuColorTextures:i,gpuDepthStencilTexture:s,glFramebuffer:null,isOffscreen:!0,get width(){return this.isOffscreen?a:this.gpuColorTextures[0].width},set width(t){a=t},get height(){return this.isOffscreen?o:this.gpuColorTextures[0].height},set height(t){o=t},lodLevel:e},function(t,e){for(var i=0;i<e.gpuColorTextures.length;++i)if(e.gpuColorTextures[i].isSwapchainTexture)return void(e.isOffscreen=!1);var n=t.gl,r=[],s=n.createFramebuffer();if(s){e.glFramebuffer=s,t.stateCache.glFramebuffer!==e.glFramebuffer&&n.bindFramebuffer(n.FRAMEBUFFER,e.glFramebuffer);for(var a=0;a<e.gpuColorTextures.length;++a){var o=e.gpuColorTextures[a];o&&(o.glTexture?n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+a,o.glTarget,o.glTexture,0):n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+a,n.RENDERBUFFER,o.glRenderbuffer),r.push(n.COLOR_ATTACHMENT0+a),e.width=Math.min(e.width,o.width),e.height=Math.min(e.height,o.height))}var h=e.gpuDepthStencilTexture;if(h){var u=m_[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:console.error("glCheckFramebufferStatus() - FRAMEBUFFER_INCOMPLETE_ATTACHMENT");break;case n.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:console.error("glCheckFramebufferStatus() - FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT");break;case n.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:console.error("glCheckFramebufferStatus() - FRAMEBUFFER_INCOMPLETE_DIMENSIONS");break;case n.FRAMEBUFFER_UNSUPPORTED:console.error("glCheckFramebufferStatus() - FRAMEBUFFER_UNSUPPORTED")}t.stateCache.glFramebuffer!==e.glFramebuffer&&n.bindFramebuffer(n.FRAMEBUFFER,t.stateCache.glFramebuffer)}}(V2.instance,this._gpuFramebuffer)},i.destroy=function(){var t,e;this._gpuFramebuffer&&(t=V2.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}(M_),D3=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._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},c3(V2.instance,this._gpuInputAssembler)}else console.error("InputAssemblerInfo.vertexBuffers is null.")},i.destroy=function(){var t=V2.instance;this._gpuInputAssembler&&t.extensions.useVAO&&_3(t,this._gpuInputAssembler),this._gpuInputAssembler=null},n(e,[{key:"gpuInputAssembler",get:function(){return this._gpuInputAssembler}}]),e}(N_),P3=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._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&v_)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}(F_),O3=function(t){function e(){for(var e,i=arguments.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}(k_),M3=[0,1,3,2,0,0,0,4,5,6,0,0,0,0],N3=function(t){function e(){for(var e,i=arguments.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:M3[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}(W_),L3=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){p3(V2.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;g3(V2.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=V2.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=V2.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&wl.INDIRECT?0:e.byteLength,h3(V2.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&&T3(V2.instance,t,n,i)}},i.execute=function(t,e){for(var i=0;i<e;++i){var n=t[i];v3(V2.instance,n.cmdPackage),this._numDrawCalls+=n._numDrawCalls,this._numInstances+=n._numInstances,this._numTris+=n._numTris}},i.bindStates=function(){m3(V2.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;E3(V2.instance,r,s,i,n)},e}(I3),F3=function(t){function e(){for(var e,i=arguments.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}(X_),k3=function(t){function e(){for(var e,i=arguments.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}(j_),G3=[10497,33648,33071,33071],V3=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===kl.LINEAR||a===kl.ANISOTROPIC?h===kl.LINEAR||h===kl.ANISOTROPIC?9987:h===kl.POINT?9985:9729:h===kl.LINEAR||h===kl.ANISOTROPIC?9986:h===kl.POINT?9984:9728,s=o===kl.LINEAR||o===kl.ANISOTROPIC?9729:9728;var u=G3[n._info.addressU],l=G3[n._info.addressV],c=G3[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}(Y_),U3=function(t){function e(){for(var e,i=arguments.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&&(l3(V2.instance,this._gpuShader),this._gpuShader=null)},n(e,[{key:"gpuShader",get:function(){return null===this._gpuShader.glProgram&&u3(V2.instance,this._gpuShader),this._gpuShader}}]),e}(q_),z3=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 Ec,this.scissorRect=new mc(0,0,0,0),this.rs=new G_,this.dss=new V_,this.bs=new z_,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}(),H3=function(t){function e(){for(var e,i=arguments.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=S_(this._info.width)&&S_(this._info.height),this._size=T_(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 xl.A8:return e.ALPHA;case xl.L8:return e.LUMINANCE;case xl.LA8:return e.LUMINANCE_ALPHA;case xl.RGB8:case xl.RGB16F:case xl.RGB32F:return e.RGB;case xl.BGRA8:case xl.RGBA8:case xl.SRGB8_A8:case xl.RGBA16F:case xl.RGBA32F:return e.RGBA;case xl.R5G6B5:return e.RGB;case xl.RGB5A1:case xl.RGBA4:return e.RGBA;case xl.DEPTH:return e.DEPTH_COMPONENT;case xl.DEPTH_STENCIL:return e.DEPTH_STENCIL;case xl.BC1:return k2.COMPRESSED_RGB_S3TC_DXT1_EXT;case xl.BC1_ALPHA:return k2.COMPRESSED_RGBA_S3TC_DXT1_EXT;case xl.BC1_SRGB:return k2.COMPRESSED_SRGB_S3TC_DXT1_EXT;case xl.BC1_SRGB_ALPHA:return k2.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;case xl.BC2:return k2.COMPRESSED_RGBA_S3TC_DXT3_EXT;case xl.BC2_SRGB:return k2.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;case xl.BC3:return k2.COMPRESSED_RGBA_S3TC_DXT5_EXT;case xl.BC3_SRGB:return k2.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;case xl.ETC_RGB8:return k2.COMPRESSED_RGB_ETC1_WEBGL;case xl.ETC2_RGB8:return k2.COMPRESSED_RGB8_ETC2;case xl.ETC2_SRGB8:return k2.COMPRESSED_SRGB8_ETC2;case xl.ETC2_RGB8_A1:return k2.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2;case xl.ETC2_SRGB8_A1:return k2.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2;case xl.ETC2_RGBA8:return k2.COMPRESSED_RGBA8_ETC2_EAC;case xl.ETC2_SRGB8_A8:return k2.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC;case xl.EAC_R11:return k2.COMPRESSED_R11_EAC;case xl.EAC_R11SN:return k2.COMPRESSED_SIGNED_R11_EAC;case xl.EAC_RG11:return k2.COMPRESSED_RG11_EAC;case xl.EAC_RG11SN:return k2.COMPRESSED_SIGNED_RG11_EAC;case xl.PVRTC_RGB2:return k2.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;case xl.PVRTC_RGBA2:return k2.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;case xl.PVRTC_RGB4:return k2.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;case xl.PVRTC_RGBA4:return k2.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;case xl.ASTC_RGBA_4X4:return k2.COMPRESSED_RGBA_ASTC_4x4_KHR;case xl.ASTC_RGBA_5X4:return k2.COMPRESSED_RGBA_ASTC_5x4_KHR;case xl.ASTC_RGBA_5X5:return k2.COMPRESSED_RGBA_ASTC_5x5_KHR;case xl.ASTC_RGBA_6X5:return k2.COMPRESSED_RGBA_ASTC_6x5_KHR;case xl.ASTC_RGBA_6X6:return k2.COMPRESSED_RGBA_ASTC_6x6_KHR;case xl.ASTC_RGBA_8X5:return k2.COMPRESSED_RGBA_ASTC_8x5_KHR;case xl.ASTC_RGBA_8X6:return k2.COMPRESSED_RGBA_ASTC_8x6_KHR;case xl.ASTC_RGBA_8X8:return k2.COMPRESSED_RGBA_ASTC_8x8_KHR;case xl.ASTC_RGBA_10X5:return k2.COMPRESSED_RGBA_ASTC_10x5_KHR;case xl.ASTC_RGBA_10X6:return k2.COMPRESSED_RGBA_ASTC_10x6_KHR;case xl.ASTC_RGBA_10X8:return k2.COMPRESSED_RGBA_ASTC_10x8_KHR;case xl.ASTC_RGBA_10X10:return k2.COMPRESSED_RGBA_ASTC_10x10_KHR;case xl.ASTC_RGBA_12X10:return k2.COMPRESSED_RGBA_ASTC_12x10_KHR;case xl.ASTC_RGBA_12X12:return k2.COMPRESSED_RGBA_ASTC_12x12_KHR;case xl.ASTC_SRGBA_4X4:return k2.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR;case xl.ASTC_SRGBA_5X4:return k2.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR;case xl.ASTC_SRGBA_5X5:return k2.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR;case xl.ASTC_SRGBA_6X5:return k2.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR;case xl.ASTC_SRGBA_6X6:return k2.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR;case xl.ASTC_SRGBA_8X5:return k2.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR;case xl.ASTC_SRGBA_8X6:return k2.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR;case xl.ASTC_SRGBA_8X8:return k2.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR;case xl.ASTC_SRGBA_10X5:return k2.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR;case xl.ASTC_SRGBA_10X6:return k2.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR;case xl.ASTC_SRGBA_10X8:return k2.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR;case xl.ASTC_SRGBA_10X10:return k2.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR;case xl.ASTC_SRGBA_12X10:return k2.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR;case xl.ASTC_SRGBA_12X12:return k2.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR;default:return console.error("Unsupported Format, convert to WebGL format failed."),e.RGBA}}(e.format,i),e.glType=U2(e.format,i);var n=e.width,r=e.height;switch(e.type){case Pl.TEX2D:e.glTarget=i.TEXTURE_2D;var s=Math.max(n,r);if(s>t.capabilities.maxTextureSize&&J(9100,s,t.capabilities.maxTextureSize),t.textureExclusive[e.format]||t.extensions.WEBGL_depth_texture||!m_[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),m_[e.format].isCompressed)for(var o=0;o<e.mipLevel;++o){var h=A_(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 xl.R5G6B5:return e.RGB565;case xl.RGB5A1:return e.RGB5_A1;case xl.RGBA4:return e.RGBA4;case xl.RGBA16F:return k2.RGBA16F_EXT;case xl.RGBA32F:return k2.RGBA32F_EXT;case xl.SRGB8_A8:return k2.SRGB8_ALPHA8_EXT;case xl.DEPTH:return e.DEPTH_COMPONENT16;case xl.DEPTH_STENCIL:return e.DEPTH_STENCIL;default:return console.error("Unsupported Format, convert to WebGL internal format failed."),e.RGBA}}(e.format,i),e.glRenderbuffer=i.createRenderbuffer(),e.size>0&&(t.stateCache.glRenderbuffer!==e.glRenderbuffer&&(i.bindRenderbuffer(i.RENDERBUFFER,e.glRenderbuffer),t.stateCache.glRenderbuffer=e.glRenderbuffer),i.renderbufferStorage(i.RENDERBUFFER,e.glInternalFmt,n,r));break;case Pl.CUBE:e.glTarget=i.TEXTURE_CUBE_MAP;var c=Math.max(n,r);if(c>t.capabilities.maxCubeMapTextureSize&&J(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),m_[e.format].isCompressed)for(var f=0;f<6;++f){n=e.width,r=e.height;for(var d=0;d<e.mipLevel;++d){var p=A_(e.format,n,r,1),m=new Uint8Array(p);i.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+f,d,e.glInternalFmt,n,r,0,m),n=Math.max(1,n>>1),r=Math.max(1,r>>1)}}else for(var g=0;g<6;++g){n=e.width,r=e.height;for(var y=0;y<e.mipLevel;++y)i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+g,y,e.glInternalFmt,n,r,0,e.glFormat,e.glType,null),n=Math.max(1,n>>1),r=Math.max(1,r>>1)}e.isPowerOf2?(e.glWrapS=i.REPEAT,e.glWrapT=i.REPEAT):(e.glWrapS=i.CLAMP_TO_EDGE,e.glWrapT=i.CLAMP_TO_EDGE),e.glMinFilter=i.LINEAR,e.glMagFilter=i.LINEAR,i.texParameteri(e.glTarget,i.TEXTURE_WRAP_S,e.glWrapS),i.texParameteri(e.glTarget,i.TEXTURE_WRAP_T,e.glWrapT),i.texParameteri(e.glTarget,i.TEXTURE_MIN_FILTER,e.glMinFilter),i.texParameteri(e.glTarget,i.TEXTURE_MAG_FILTER,e.glMagFilter)}break;default:console.error("Unsupported TextureType, create texture failed."),e.type=Pl.TEX2D,e.glTarget=i.TEXTURE_2D}}(V2.instance,this._gpuTexture),V2.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}}(V2.instance,this._gpuTexture),V2.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=T_(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 Pl.TEX2D:e.glTarget=i.TEXTURE_2D;var s=Math.max(n,r);if(s>t.capabilities.maxTextureSize&&J(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),m_[e.format].isCompressed)for(var o=0;o<e.mipLevel;++o){var h=A_(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 Pl.CUBE:e.glTarget=i.TEXTURE_CUBE_MAP;var c=Math.max(n,r);c>t.capabilities.maxCubeMapTextureSize&&J(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),m_[e.format].isCompressed)for(var f=0;f<6;++f){n=e.width,r=e.height;for(var d=0;d<e.mipLevel;++d){var p=A_(e.format,n,r,1),m=new Uint8Array(p);i.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+f,d,e.glInternalFmt,n,r,0,m),n=Math.max(1,n>>1),r=Math.max(1,r>>1)}}else for(var g=0;g<6;++g){n=e.width,r=e.height;for(var y=0;y<e.mipLevel;++y)i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+g,y,e.glInternalFmt,n,r,0,e.glFormat,e.glType,null),n=Math.max(1,n>>1),r=Math.max(1,r>>1)}break;default:console.error("Unsupported TextureType, create texture failed."),e.type=Pl.TEX2D,e.glTarget=i.TEXTURE_2D}}}(V2.instance,this._gpuTexture),V2.instance.memoryStatus.textureSize-=n,V2.instance.memoryStatus.textureSize+=this._size))}},i.initAsSwapchainTexture=function(t){var e=new Oc;e.format=t.format,e.usage=m_[t.format].hasDepth?Ol.DEPTH_STENCIL_ATTACHMENT:Ol.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}(K_),W3="webglcontextlost";function X3(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 j3(t){var e={EXT_texture_filter_anisotropic:X3(t,"EXT_texture_filter_anisotropic"),EXT_blend_minmax:X3(t,"EXT_blend_minmax"),EXT_frag_depth:X3(t,"EXT_frag_depth"),EXT_shader_texture_lod:X3(t,"EXT_shader_texture_lod"),EXT_sRGB:X3(t,"EXT_sRGB"),OES_vertex_array_object:X3(t,"OES_vertex_array_object"),EXT_color_buffer_half_float:X3(t,"EXT_color_buffer_half_float"),WEBGL_color_buffer_float:X3(t,"WEBGL_color_buffer_float"),WEBGL_compressed_texture_etc1:X3(t,"WEBGL_compressed_texture_etc1"),WEBGL_compressed_texture_etc:X3(t,"WEBGL_compressed_texture_etc"),WEBGL_compressed_texture_pvrtc:X3(t,"WEBGL_compressed_texture_pvrtc"),WEBGL_compressed_texture_s3tc:X3(t,"WEBGL_compressed_texture_s3tc"),WEBGL_compressed_texture_s3tc_srgb:X3(t,"WEBGL_compressed_texture_s3tc_srgb"),WEBGL_debug_shaders:X3(t,"WEBGL_debug_shaders"),WEBGL_draw_buffers:X3(t,"WEBGL_draw_buffers"),WEBGL_lose_context:X3(t,"WEBGL_lose_context"),WEBGL_depth_texture:X3(t,"WEBGL_depth_texture"),OES_texture_half_float:X3(t,"OES_texture_half_float"),OES_texture_half_float_linear:X3(t,"OES_texture_half_float_linear"),OES_texture_float:X3(t,"OES_texture_float"),OES_texture_float_linear:X3(t,"OES_texture_float_linear"),OES_standard_derivatives:X3(t,"OES_standard_derivatives"),OES_element_index_uint:X3(t,"OES_element_index_uint"),ANGLE_instanced_arrays:X3(t,"ANGLE_instanced_arrays"),WEBGL_debug_renderer_info:X3(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 Gu.os===Nu.IOS&&14===Gu.osMainVersion&&Gu.isBrowser||(e.WEBGL_compressed_texture_astc=X3(t,"WEBGL_compressed_texture_astc")),Gu.os!==Nu.ANDROID&&Gu.os!==Nu.IOS&&(e.WEBGL_multi_draw=X3(t,"WEBGL_multi_draw")),Gu.browserType===Pu.UC&&(e.ANGLE_instanced_arrays=null),Gu.os===Nu.IOS&&Gu.osMainVersion<=10&&(e.destroyShadersImmediately=!1),e.OES_vertex_array_object&&(e.useVAO=!0),e}var Y3=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).stateCache=new z3,e.cmdAllocator=new w3,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(W3,this._onWebGLContextLost);var e=V2.instance.gl;this.stateCache.initialize(V2.instance.capabilities.maxTextureUnits,V2.instance.capabilities.maxVertexAttributes),this._extensions=j3(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=xl.RGBA8,n=xl.DEPTH_STENCIL,r=e.getParameter(e.DEPTH_BITS),s=e.getParameter(e.STENCIL_BITS);r&&s?n=xl.DEPTH_STENCIL:r&&(n=xl.DEPTH),this._colorTexture=new H3,this._colorTexture.initAsSwapchainTexture({swapchain:this,format:i,width:t.width,height:t.height}),this._depthStencilTexture=new H3,this._depthStencilTexture.initAsSwapchainTexture({swapchain:this,format:n,width:t.width,height:t.height}),this.nullTex2D=V2.instance.createTexture(new Oc(Pl.TEX2D,Ol.SAMPLED,xl.RGBA8,2,2,Ml.GEN_MIPMAP)),this.nullTexCube=V2.instance.createTexture(new Oc(Pl.CUBE,Ol.SAMPLED,xl.RGBA8,2,2,Ml.GEN_MIPMAP,6));var a=new Tc;a.texExtent.width=2,a.texExtent.height=2;var o=new Uint8Array(this.nullTex2D.size);o.fill(0),V2.instance.copyBuffersToTexture([o],this.nullTex2D,[a]),a.texSubres.layerCount=6,V2.instance.copyBuffersToTexture([o,o,o,o,o,o],this.nullTexCube,[a]),this._blitManager=new x3},i.destroy=function(){this._canvas&&this._webGLContextLostHandler&&(this._canvas.removeEventListener(W3,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||(U("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),k(t)},n(e,[{key:"extensions",get:function(){return this._extensions}},{key:"blitManager",get:function(){return this._blitManager}}]),e}(O_),q3=t("eq",function(t){function e(){for(var e,i=arguments.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(xl.COUNT),e}s(e,t);var i=e.prototype;return i.initialize=function(t){V2.setInstance(this),this._gfxAPI=Tl.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:be.ENABLE_TRANSPARENT_CANVAS,antialias:be.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}(D_.canvas);if(!l)return console.error("This device does not support WebGL."),!1;this._queue=this.createQueue(new u_(rc.GRAPHICS)),this._cmdBuff=this.createCommandBuffer(new h_(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 d,p=f(c);!(d=p()).done;)_+=d.value+" ";var m=j3(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[bl.BLEND_MINMAX]=!0),m.OES_element_index_uint&&(this._features[bl.ELEMENT_INDEX_UINT]=!0),m.ANGLE_instanced_arrays&&(this._features[bl.INSTANCED_ARRAYS]=!0),m.WEBGL_draw_buffers&&(this._features[bl.MULTIPLE_RENDER_TARGETS]=!0);var y="";return this.getFormatFeatures(xl.ETC_RGB8)&&(y+="etc1 "),this.getFormatFeatures(xl.ETC2_RGB8)&&(y+="etc2 "),this.getFormatFeatures(xl.BC1)&&(y+="dxt "),this.getFormatFeatures(xl.PVRTC_RGB2)&&(y+="pvrtc "),this.getFormatFeatures(xl.ASTC_RGBA_4X4)&&(y+="astc "),U("WebGL device initialized."),U("RENDERER: "+this._renderer),U("VENDOR: "+this._vendor),U("VERSION: "+g),U("COMPRESSED_FORMAT: "+y),U("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(Nl.NONE),this._textureExclusive.fill(!0);var e=Nl.RENDER_TARGET|Nl.SAMPLED_TEXTURE|Nl.LINEAR_FILTER;this._formatFeatures[xl.RGB8]=e,this._formatFeatures[xl.R5G6B5]=e,this._textureExclusive[xl.R5G6B5]=!1,this._formatFeatures[xl.RGBA8]=e,this._formatFeatures[xl.RGBA4]=e,this._textureExclusive[xl.RGBA4]=!1,this._formatFeatures[xl.RGB5A1]=e,this._textureExclusive[xl.RGB5A1]=!1,this._formatFeatures[xl.DEPTH]=Nl.RENDER_TARGET,this._textureExclusive[xl.DEPTH]=!1,this._formatFeatures[xl.DEPTH_STENCIL]=Nl.RENDER_TARGET,this._textureExclusive[xl.DEPTH_STENCIL]=!1,this._formatFeatures[xl.R8I]|=Nl.VERTEX_ATTRIBUTE,this._formatFeatures[xl.RG8I]|=Nl.VERTEX_ATTRIBUTE,this._formatFeatures[xl.RGB8I]|=Nl.VERTEX_ATTRIBUTE,this._formatFeatures[xl.RGBA8I]|=Nl.VERTEX_ATTRIBUTE,this._formatFeatures[xl.R8UI]|=Nl.VERTEX_ATTRIBUTE,this._formatFeatures[xl.RG8UI]|=Nl.VERTEX_ATTRIBUTE,this._formatFeatures[xl.RGB8UI]|=Nl.VERTEX_ATTRIBUTE,this._formatFeatures[xl.RGBA8UI]|=Nl.VERTEX_ATTRIBUTE,this._formatFeatures[xl.R8I]|=Nl.VERTEX_ATTRIBUTE,this._formatFeatures[xl.RG8I]|=Nl.VERTEX_ATTRIBUTE,this._formatFeatures[xl.RGB8I]|=Nl.VERTEX_ATTRIBUTE,this._formatFeatures[xl.RGBA8I]|=Nl.VERTEX_ATTRIBUTE,this._formatFeatures[xl.R8UI]|=Nl.VERTEX_ATTRIBUTE,this._formatFeatures[xl.RG8UI]|=Nl.VERTEX_ATTRIBUTE,this._formatFeatures[xl.RGB8UI]|=Nl.VERTEX_ATTRIBUTE,this._formatFeatures[xl.RGBA8UI]|=Nl.VERTEX_ATTRIBUTE,this._formatFeatures[xl.R32F]|=Nl.VERTEX_ATTRIBUTE,this._formatFeatures[xl.RG32F]|=Nl.VERTEX_ATTRIBUTE,this._formatFeatures[xl.RGB32F]|=Nl.VERTEX_ATTRIBUTE,this._formatFeatures[xl.RGBA32F]|=Nl.VERTEX_ATTRIBUTE,t.EXT_sRGB&&(this._formatFeatures[xl.SRGB8]=e,this._formatFeatures[xl.SRGB8_A8]=e,this._textureExclusive[xl.SRGB8_A8]=!1),t.WEBGL_depth_texture&&(this._formatFeatures[xl.DEPTH]|=e,this._formatFeatures[xl.DEPTH_STENCIL]|=e),t.WEBGL_color_buffer_float&&(this._formatFeatures[xl.RGB32F]|=Nl.RENDER_TARGET,this._formatFeatures[xl.RGBA32F]|=Nl.RENDER_TARGET,this._textureExclusive[xl.RGB32F]=!1,this._textureExclusive[xl.RGBA32F]=!1),t.EXT_color_buffer_half_float&&(this._formatFeatures[xl.RGB16F]|=Nl.RENDER_TARGET,this._formatFeatures[xl.RGBA16F]|=Nl.RENDER_TARGET,this._textureExclusive[xl.RGB16F]=!1,this._textureExclusive[xl.RGBA16F]=!1),t.OES_texture_float&&(this._formatFeatures[xl.RGB32F]|=Nl.RENDER_TARGET|Nl.SAMPLED_TEXTURE,this._formatFeatures[xl.RGBA32F]|=Nl.RENDER_TARGET|Nl.SAMPLED_TEXTURE),t.OES_texture_half_float&&(this._formatFeatures[xl.RGB16F]|=Nl.RENDER_TARGET|Nl.SAMPLED_TEXTURE,this._formatFeatures[xl.RGBA16F]|=Nl.RENDER_TARGET|Nl.SAMPLED_TEXTURE),t.OES_texture_float_linear&&(this._formatFeatures[xl.RGB32F]|=Nl.LINEAR_FILTER,this._formatFeatures[xl.RGBA32F]|=Nl.LINEAR_FILTER),t.OES_texture_half_float_linear&&(this._formatFeatures[xl.RGB16F]|=Nl.LINEAR_FILTER,this._formatFeatures[xl.RGBA16F]|=Nl.LINEAR_FILTER);var i=Nl.SAMPLED_TEXTURE|Nl.LINEAR_FILTER;t.WEBGL_compressed_texture_etc1&&(this._formatFeatures[xl.ETC_RGB8]=i),t.WEBGL_compressed_texture_etc&&(this._formatFeatures[xl.ETC2_RGB8]=i,this._formatFeatures[xl.ETC2_RGBA8]=i,this._formatFeatures[xl.ETC2_SRGB8]=i,this._formatFeatures[xl.ETC2_SRGB8_A8]=i,this._formatFeatures[xl.ETC2_RGB8_A1]=i,this._formatFeatures[xl.ETC2_SRGB8_A1]=i),t.WEBGL_compressed_texture_s3tc&&(this._formatFeatures[xl.BC1]=i,this._formatFeatures[xl.BC1_ALPHA]=i,this._formatFeatures[xl.BC1_SRGB]=i,this._formatFeatures[xl.BC1_SRGB_ALPHA]=i,this._formatFeatures[xl.BC2]=i,this._formatFeatures[xl.BC2_SRGB]=i,this._formatFeatures[xl.BC3]=i,this._formatFeatures[xl.BC3_SRGB]=i),t.WEBGL_compressed_texture_pvrtc&&(this._formatFeatures[xl.PVRTC_RGB2]|=i,this._formatFeatures[xl.PVRTC_RGBA2]|=i,this._formatFeatures[xl.PVRTC_RGB4]|=i,this._formatFeatures[xl.PVRTC_RGBA4]|=i),t.WEBGL_compressed_texture_astc&&(this._formatFeatures[xl.ASTC_RGBA_4X4]|=i,this._formatFeatures[xl.ASTC_RGBA_5X4]|=i,this._formatFeatures[xl.ASTC_RGBA_5X5]|=i,this._formatFeatures[xl.ASTC_RGBA_6X5]|=i,this._formatFeatures[xl.ASTC_RGBA_6X6]|=i,this._formatFeatures[xl.ASTC_RGBA_8X5]|=i,this._formatFeatures[xl.ASTC_RGBA_8X6]|=i,this._formatFeatures[xl.ASTC_RGBA_8X8]|=i,this._formatFeatures[xl.ASTC_RGBA_10X5]|=i,this._formatFeatures[xl.ASTC_RGBA_10X6]|=i,this._formatFeatures[xl.ASTC_RGBA_10X8]|=i,this._formatFeatures[xl.ASTC_RGBA_10X10]|=i,this._formatFeatures[xl.ASTC_RGBA_12X10]|=i,this._formatFeatures[xl.ASTC_RGBA_12X12]|=i,this._formatFeatures[xl.ASTC_SRGBA_4X4]|=i,this._formatFeatures[xl.ASTC_SRGBA_5X4]|=i,this._formatFeatures[xl.ASTC_SRGBA_5X5]|=i,this._formatFeatures[xl.ASTC_SRGBA_6X5]|=i,this._formatFeatures[xl.ASTC_SRGBA_6X6]|=i,this._formatFeatures[xl.ASTC_SRGBA_8X5]|=i,this._formatFeatures[xl.ASTC_SRGBA_8X6]|=i,this._formatFeatures[xl.ASTC_SRGBA_8X8]|=i,this._formatFeatures[xl.ASTC_SRGBA_10X5]|=i,this._formatFeatures[xl.ASTC_SRGBA_10X6]|=i,this._formatFeatures[xl.ASTC_SRGBA_10X8]|=i,this._formatFeatures[xl.ASTC_SRGBA_10X10]|=i,this._formatFeatures[xl.ASTC_SRGBA_12X10]|=i,this._formatFeatures[xl.ASTC_SRGBA_12X12]|=i)},i.createCommandBuffer=function(t){var e=new(t.type===ac.PRIMARY?L3:I3);return e.initialize(t),e},i.createSwapchain=function(t){var e=new Y3;return this._swapchain=e,e.initialize(t),e},i.createBuffer=function(t){var e=new C3;return e.initialize(t),e},i.createTexture=function(t){var e=new H3;return e.initialize(t),e},i.createDescriptorSet=function(t){var e=new G2;return e.initialize(t),e},i.createShader=function(t){var e=new U3;return e.initialize(t),e},i.createInputAssembler=function(t){var e=new D3;return e.initialize(t),e},i.createRenderPass=function(t){var e=new k3;return e.initialize(t),e},i.createFramebuffer=function(t){var e=new B3;return e.initialize(t),e},i.createDescriptorSetLayout=function(t){var e=new P3;return e.initialize(t),e},i.createPipelineLayout=function(t){var e=new O3;return e.initialize(t),e},i.createPipelineState=function(t){var e=new N3;return e.initialize(t),e},i.createQueue=function(t){var e=new F3;return e.initialize(t),e},i.getSampler=function(t){var e=Y_.computeHash(t);return this._samplers.has(e)||this._samplers.set(e,new V3(t,e)),this._samplers.get(e)},i.getSwapchains=function(){return[this._swapchain]},i.getGeneralBarrier=function(t){var e=J_.computeHash(t);return this._generalBarrierss.has(e)||this._generalBarrierss.set(e,new J_(t,e)),this._generalBarrierss.get(e)},i.getTextureBarrier=function(t){var e=Q_.computeHash(t);return this._textureBarriers.has(e)||this._textureBarriers.set(e,new Q_(t,e)),this._textureBarriers.get(e)},i.getBufferBarrier=function(t){var e=Z_.computeHash(t);return this._bufferBarriers.has(e)||this._bufferBarriers.set(e,new Z_(t,e)),this._bufferBarriers.get(e)},i.copyBuffersToTexture=function(t,e,i){T3(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:console.error("Unsupported GL texture type, copy texture to buffers failed.")}r.bindFramebuffer(r.FRAMEBUFFER,null),s.glFramebuffer=null,r.deleteFramebuffer(a)}(this,t.gpuTexture,e,i)},i.copyTexImagesToTexture=function(t,e,i){!function(t,e,i,n){var r=t.gl,s=t.stateCache.glTexUnits[t.stateCache.texUnit];s.glTexture!==i.glTexture&&(r.bindTexture(i.glTarget,i.glTexture),s.glTexture=i.glTexture);var a=0,o=0;switch(i.glTarget){case r.TEXTURE_2D:for(var h=0;h<n.length;h++){var u=n[h];r.texSubImage2D(r.TEXTURE_2D,u.texSubres.mipLevel,u.texOffset.x,u.texOffset.y,i.glFormat,i.glType,e[a++])}break;case r.TEXTURE_CUBE_MAP:for(var l=0;l<n.length;l++){var c=n[l],_=c.texSubres.baseArrayLayer+c.texSubres.layerCount;for(o=c.texSubres.baseArrayLayer;o<_;++o)r.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+o,c.texSubres.mipLevel,c.texOffset.x,c.texOffset.y,i.glFormat,i.glType,e[a++])}break;default:console.error("Unsupported GL texture type, copy buffer to texture failed.")}i.flags&Ml.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}(D_));v.WebGLDevice=q3;var K3,J3=function(t){function e(){for(var e,i=arguments.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&g_?this._buffers[e]&&(t[e].gpuBuffer=this._buffers[e].gpuBuffer):t[e].type&y_&&(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}(L_);!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"}(K3||(K3={}));var Q3=function(){function t(){}return t.setInstance=function(e){t._instance=e},n(t,null,[{key:"instance",get:function(){return t._instance}}]),t}();Q3._instance=null;var Z3=[10497,33648,33071,33071],$3=new Float32Array(4);function t5(t,e){switch(t){case xl.R8:return e.UNSIGNED_BYTE;case xl.R8SN:return e.BYTE;case xl.R8UI:return e.UNSIGNED_BYTE;case xl.R8I:return e.BYTE;case xl.R16F:return e.HALF_FLOAT;case xl.R16UI:return e.UNSIGNED_SHORT;case xl.R16I:return e.SHORT;case xl.R32F:return e.FLOAT;case xl.R32UI:return e.UNSIGNED_INT;case xl.R32I:return e.INT;case xl.RG8:return e.UNSIGNED_BYTE;case xl.RG8SN:return e.BYTE;case xl.RG8UI:return e.UNSIGNED_BYTE;case xl.RG8I:return e.BYTE;case xl.RG16F:return e.HALF_FLOAT;case xl.RG16UI:return e.UNSIGNED_SHORT;case xl.RG16I:return e.SHORT;case xl.RG32F:return e.FLOAT;case xl.RG32UI:return e.UNSIGNED_INT;case xl.RG32I:return e.INT;case xl.RGB8:case xl.SRGB8:return e.UNSIGNED_BYTE;case xl.RGB8SN:return e.BYTE;case xl.RGB8UI:return e.UNSIGNED_BYTE;case xl.RGB8I:return e.BYTE;case xl.RGB16F:return e.HALF_FLOAT;case xl.RGB16UI:return e.UNSIGNED_SHORT;case xl.RGB16I:return e.SHORT;case xl.RGB32F:return e.FLOAT;case xl.RGB32UI:return e.UNSIGNED_INT;case xl.RGB32I:return e.INT;case xl.BGRA8:case xl.RGBA8:case xl.SRGB8_A8:return e.UNSIGNED_BYTE;case xl.RGBA8SN:return e.BYTE;case xl.RGBA8UI:return e.UNSIGNED_BYTE;case xl.RGBA8I:return e.BYTE;case xl.RGBA16F:return e.HALF_FLOAT;case xl.RGBA16UI:return e.UNSIGNED_SHORT;case xl.RGBA16I:return e.SHORT;case xl.RGBA32F:return e.FLOAT;case xl.RGBA32UI:return e.UNSIGNED_INT;case xl.RGBA32I:return e.INT;case xl.R5G6B5:return e.UNSIGNED_SHORT_5_6_5;case xl.R11G11B10F:return e.UNSIGNED_INT_10F_11F_11F_REV;case xl.RGB5A1:return e.UNSIGNED_SHORT_5_5_5_1;case xl.RGBA4:return e.UNSIGNED_SHORT_4_4_4_4;case xl.RGB10A2:case xl.RGB10A2UI:return e.UNSIGNED_INT_2_10_10_10_REV;case xl.RGB9E5:case xl.DEPTH:return e.FLOAT;case xl.DEPTH_STENCIL:return e.UNSIGNED_INT_24_8;case xl.BC1:case xl.BC1_SRGB:case xl.BC2:case xl.BC2_SRGB:case xl.BC3:case xl.BC3_SRGB:case xl.BC4:return e.UNSIGNED_BYTE;case xl.BC4_SNORM:return e.BYTE;case xl.BC5:return e.UNSIGNED_BYTE;case xl.BC5_SNORM:return e.BYTE;case xl.BC6H_SF16:case xl.BC6H_UF16:return e.FLOAT;case xl.BC7:case xl.BC7_SRGB:case xl.ETC_RGB8:case xl.ETC2_RGB8:case xl.ETC2_SRGB8:case xl.ETC2_RGB8_A1:case xl.ETC2_SRGB8_A1:case xl.EAC_R11:return e.UNSIGNED_BYTE;case xl.EAC_R11SN:return e.BYTE;case xl.EAC_RG11:return e.UNSIGNED_BYTE;case xl.EAC_RG11SN:return e.BYTE;case xl.PVRTC_RGB2:case xl.PVRTC_RGBA2:case xl.PVRTC_RGB4:case xl.PVRTC_RGBA4:case xl.PVRTC2_2BPP:case xl.PVRTC2_4BPP:return e.UNSIGNED_BYTE;case xl.ASTC_RGBA_4X4:case xl.ASTC_RGBA_5X4:case xl.ASTC_RGBA_5X5:case xl.ASTC_RGBA_6X5:case xl.ASTC_RGBA_6X6:case xl.ASTC_RGBA_8X5:case xl.ASTC_RGBA_8X6:case xl.ASTC_RGBA_8X8:case xl.ASTC_RGBA_10X5:case xl.ASTC_RGBA_10X6:case xl.ASTC_RGBA_10X8:case xl.ASTC_RGBA_10X10:case xl.ASTC_RGBA_12X10:case xl.ASTC_RGBA_12X12:case xl.ASTC_SRGBA_4X4:case xl.ASTC_SRGBA_5X4:case xl.ASTC_SRGBA_5X5:case xl.ASTC_SRGBA_6X5:case xl.ASTC_SRGBA_6X6:case xl.ASTC_SRGBA_8X5:case xl.ASTC_SRGBA_8X6:case xl.ASTC_SRGBA_8X8:case xl.ASTC_SRGBA_10X5:case xl.ASTC_SRGBA_10X6:case xl.ASTC_SRGBA_10X8:case xl.ASTC_SRGBA_10X10:case xl.ASTC_SRGBA_12X10:case xl.ASTC_SRGBA_12X12:default:return e.UNSIGNED_BYTE}}function e5(t,e){switch(t){case Rl.BOOL:return e.BOOL;case Rl.BOOL2:return e.BOOL_VEC2;case Rl.BOOL3:return e.BOOL_VEC3;case Rl.BOOL4:return e.BOOL_VEC4;case Rl.INT:return e.INT;case Rl.INT2:return e.INT_VEC2;case Rl.INT3:return e.INT_VEC3;case Rl.INT4:return e.INT_VEC4;case Rl.UINT:return e.UNSIGNED_INT;case Rl.FLOAT:return e.FLOAT;case Rl.FLOAT2:return e.FLOAT_VEC2;case Rl.FLOAT3:return e.FLOAT_VEC3;case Rl.FLOAT4:return e.FLOAT_VEC4;case Rl.MAT2:return e.FLOAT_MAT2;case Rl.MAT2X3:return e.FLOAT_MAT2x3;case Rl.MAT2X4:return e.FLOAT_MAT2x4;case Rl.MAT3X2:return e.FLOAT_MAT3x2;case Rl.MAT3:return e.FLOAT_MAT3;case Rl.MAT3X4:return e.FLOAT_MAT3x4;case Rl.MAT4X2:return e.FLOAT_MAT4x2;case Rl.MAT4X3:return e.FLOAT_MAT4x3;case Rl.MAT4:return e.FLOAT_MAT4;case Rl.SAMPLER2D:return e.SAMPLER_2D;case Rl.SAMPLER2D_ARRAY:return e.SAMPLER_2D_ARRAY;case Rl.SAMPLER3D:return e.SAMPLER_3D;case Rl.SAMPLER_CUBE:return e.SAMPLER_CUBE;default:return console.error("Unsupported GLType, convert to GL type failed."),Rl.UNKNOWN}}function i5(t,e){switch(t){case e.BOOL:return Rl.BOOL;case e.BOOL_VEC2:return Rl.BOOL2;case e.BOOL_VEC3:return Rl.BOOL3;case e.BOOL_VEC4:return Rl.BOOL4;case e.INT:return Rl.INT;case e.INT_VEC2:return Rl.INT2;case e.INT_VEC3:return Rl.INT3;case e.INT_VEC4:return Rl.INT4;case e.UNSIGNED_INT:return Rl.UINT;case e.UNSIGNED_INT_VEC2:return Rl.UINT2;case e.UNSIGNED_INT_VEC3:return Rl.UINT3;case e.UNSIGNED_INT_VEC4:return Rl.UINT4;case e.FLOAT:return Rl.FLOAT;case e.FLOAT_VEC2:return Rl.FLOAT2;case e.FLOAT_VEC3:return Rl.FLOAT3;case e.FLOAT_VEC4:return Rl.FLOAT4;case e.FLOAT_MAT2:return Rl.MAT2;case e.FLOAT_MAT2x3:return Rl.MAT2X3;case e.FLOAT_MAT2x4:return Rl.MAT2X4;case e.FLOAT_MAT3x2:return Rl.MAT3X2;case e.FLOAT_MAT3:return Rl.MAT3;case e.FLOAT_MAT3x4:return Rl.MAT3X4;case e.FLOAT_MAT4x2:return Rl.MAT4X2;case e.FLOAT_MAT4x3:return Rl.MAT4X3;case e.FLOAT_MAT4:return Rl.MAT4;case e.SAMPLER_2D:return Rl.SAMPLER2D;case e.SAMPLER_2D_ARRAY:return Rl.SAMPLER2D_ARRAY;case e.SAMPLER_3D:return Rl.SAMPLER3D;case e.SAMPLER_CUBE:return Rl.SAMPLER_CUBE;default:return console.error("Unsupported GLType, convert to Type failed."),Rl.UNKNOWN}}function n5(t,e){switch(t){case e.BOOL:return 4;case e.BOOL_VEC2:return 8;case e.BOOL_VEC3:return 12;case e.BOOL_VEC4:return 16;case e.INT:return 4;case e.INT_VEC2:return 8;case e.INT_VEC3:return 12;case e.INT_VEC4:return 16;case e.UNSIGNED_INT:return 4;case e.UNSIGNED_INT_VEC2:return 8;case e.UNSIGNED_INT_VEC3:return 12;case e.UNSIGNED_INT_VEC4:return 16;case e.FLOAT:return 4;case e.FLOAT_VEC2:return 8;case e.FLOAT_VEC3:return 12;case e.FLOAT_VEC4:case e.FLOAT_MAT2:return 16;case e.FLOAT_MAT2x3:return 24;case e.FLOAT_MAT2x4:return 32;case e.FLOAT_MAT3x2:return 24;case e.FLOAT_MAT3:return 36;case e.FLOAT_MAT3x4:return 48;case e.FLOAT_MAT4x2:return 32;case e.FLOAT_MAT4x3:return 48;case e.FLOAT_MAT4:return 64;case e.SAMPLER_2D:case e.SAMPLER_2D_ARRAY:case e.SAMPLER_2D_ARRAY_SHADOW:case e.SAMPLER_3D:case e.SAMPLER_CUBE:case e.INT_SAMPLER_2D:case e.INT_SAMPLER_2D_ARRAY:case e.INT_SAMPLER_3D:case e.INT_SAMPLER_CUBE:case e.UNSIGNED_INT_SAMPLER_2D:case e.UNSIGNED_INT_SAMPLER_2D_ARRAY:case e.UNSIGNED_INT_SAMPLER_3D:case e.UNSIGNED_INT_SAMPLER_CUBE:return 4;default:return console.error("Unsupported GLType, get type failed."),0}}function r5(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 s5,a5=[512,513,514,515,516,517,518,519],o5=[0,7680,7681,7682,7683,5386,34055,34056],h5=[32774,32778,32779,32775,32776],u5=[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"}(s5||(s5={}));var l5=function(t){this.cmdType=void 0,this.refCount=0,this.cmdType=t},c5=function(t){function e(){var e;return(e=t.call(this,s5.BEGIN_RENDER_PASS)||this).gpuRenderPass=null,e.gpuFramebuffer=null,e.renderArea=new mc,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}(l5),_5=function(t){function e(){var e;return(e=t.call(this,s5.BIND_STATES)||this).gpuPipelineState=null,e.gpuInputAssembler=null,e.gpuDescriptorSets=[],e.dynamicOffsets=[],e.dynamicStates=new d_,e}return s(e,t),e.prototype.clear=function(){this.gpuPipelineState=null,this.gpuInputAssembler=null,this.gpuDescriptorSets.length=0,this.dynamicOffsets.length=0},e}(l5),f5=function(t){function e(){var e;return(e=t.call(this,s5.DRAW)||this).drawInfo=new Bc,e}return s(e,t),e.prototype.clear=function(){},e}(l5),d5=function(t){function e(){var e;return(e=t.call(this,s5.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}(l5),p5=function(t){function e(){var e;return(e=t.call(this,s5.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}(l5),m5=function(t){function e(){var e;return(e=t.call(this,s5.BLIT_TEXTURE)||this).srcTexture=null,e.dstTexture=null,e.regions=[],e.filter=kl.LINEAR,e}return s(e,t),e.prototype.clear=function(){this.srcTexture=null,this.dstTexture=null,this.regions.length=0},e}(l5),g5=function(){function t(){this.cmds=new du(1),this.beginRenderPassCmds=new du(1),this.bindStatesCmds=new du(1),this.drawCmds=new du(1),this.updateBufferCmds=new du(1),this.copyBufferToTextureCmds=new du(1),this.blitTextureCmds=new du(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 y5(t,e,i,n,r){if(e.usage&wl.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),A5.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),A5.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:console.error("Unsupported BufferType, update buffer failed.")}}}function v5(t,e){var i=t.gl;e.glInternalFmt=function(t,e){switch(t){case xl.A8:return e.ALPHA;case xl.L8:return e.LUMINANCE;case xl.LA8:return e.LUMINANCE_ALPHA;case xl.R8:return e.R8;case xl.R8SN:return e.R8_SNORM;case xl.R8UI:return e.R8UI;case xl.R8I:return e.R8I;case xl.RG8:return e.RG8;case xl.RG8SN:return e.RG8_SNORM;case xl.RG8UI:return e.RG8UI;case xl.RG8I:return e.RG8I;case xl.RGB8:return e.RGB8;case xl.RGB8SN:return e.RGB8_SNORM;case xl.RGB8UI:return e.RGB8UI;case xl.RGB8I:return e.RGB8I;case xl.BGRA8:case xl.RGBA8:return e.RGBA8;case xl.RGBA8SN:return e.RGBA8_SNORM;case xl.RGBA8UI:return e.RGBA8UI;case xl.RGBA8I:return e.RGBA8I;case xl.R16I:return e.R16I;case xl.R16UI:return e.R16UI;case xl.R16F:return e.R16F;case xl.RG16I:return e.RG16I;case xl.RG16UI:return e.RG16UI;case xl.RG16F:return e.RG16F;case xl.RGB16I:return e.RGB16I;case xl.RGB16UI:return e.RGB16UI;case xl.RGB16F:return e.RGB16F;case xl.RGBA16I:return e.RGBA16I;case xl.RGBA16UI:return e.RGBA16UI;case xl.RGBA16F:return e.RGBA16F;case xl.R32I:return e.R32I;case xl.R32UI:return e.R32UI;case xl.R32F:return e.R32F;case xl.RG32I:return e.RG32I;case xl.RG32UI:return e.RG32UI;case xl.RG32F:return e.RG32F;case xl.RGB32I:return e.RGB32I;case xl.RGB32UI:return e.RGB32UI;case xl.RGB32F:return e.RGB32F;case xl.RGBA32I:return e.RGBA32I;case xl.RGBA32UI:return e.RGBA32UI;case xl.RGBA32F:return e.RGBA32F;case xl.R5G6B5:return e.RGB565;case xl.RGB5A1:return e.RGB5_A1;case xl.RGBA4:return e.RGBA4;case xl.SRGB8:return e.SRGB8;case xl.SRGB8_A8:return e.SRGB8_ALPHA8;case xl.RGB10A2:return e.RGB10_A2;case xl.RGB10A2UI:return e.RGB10_A2UI;case xl.R11G11B10F:return e.R11F_G11F_B10F;case xl.DEPTH:return e.DEPTH_COMPONENT32F;case xl.DEPTH_STENCIL:return e.DEPTH24_STENCIL8;case xl.BC1:return K3.COMPRESSED_RGB_S3TC_DXT1_EXT;case xl.BC1_ALPHA:return K3.COMPRESSED_RGBA_S3TC_DXT1_EXT;case xl.BC1_SRGB:return K3.COMPRESSED_SRGB_S3TC_DXT1_EXT;case xl.BC1_SRGB_ALPHA:return K3.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;case xl.BC2:return K3.COMPRESSED_RGBA_S3TC_DXT3_EXT;case xl.BC2_SRGB:return K3.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;case xl.BC3:return K3.COMPRESSED_RGBA_S3TC_DXT5_EXT;case xl.BC3_SRGB:return K3.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;case xl.ETC_RGB8:return K3.COMPRESSED_RGB_ETC1_WEBGL;case xl.ETC2_RGB8:return K3.COMPRESSED_RGB8_ETC2;case xl.ETC2_SRGB8:return K3.COMPRESSED_SRGB8_ETC2;case xl.ETC2_RGB8_A1:return K3.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2;case xl.ETC2_SRGB8_A1:return K3.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2;case xl.ETC2_RGBA8:return K3.COMPRESSED_RGBA8_ETC2_EAC;case xl.ETC2_SRGB8_A8:return K3.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC;case xl.EAC_R11:return K3.COMPRESSED_R11_EAC;case xl.EAC_R11SN:return K3.COMPRESSED_SIGNED_R11_EAC;case xl.EAC_RG11:return K3.COMPRESSED_RG11_EAC;case xl.EAC_RG11SN:return K3.COMPRESSED_SIGNED_RG11_EAC;case xl.PVRTC_RGB2:return K3.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;case xl.PVRTC_RGBA2:return K3.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;case xl.PVRTC_RGB4:return K3.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;case xl.PVRTC_RGBA4:return K3.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;case xl.ASTC_RGBA_4X4:return K3.COMPRESSED_RGBA_ASTC_4x4_KHR;case xl.ASTC_RGBA_5X4:return K3.COMPRESSED_RGBA_ASTC_5x4_KHR;case xl.ASTC_RGBA_5X5:return K3.COMPRESSED_RGBA_ASTC_5x5_KHR;case xl.ASTC_RGBA_6X5:return K3.COMPRESSED_RGBA_ASTC_6x5_KHR;case xl.ASTC_RGBA_6X6:return K3.COMPRESSED_RGBA_ASTC_6x6_KHR;case xl.ASTC_RGBA_8X5:return K3.COMPRESSED_RGBA_ASTC_8x5_KHR;case xl.ASTC_RGBA_8X6:return K3.COMPRESSED_RGBA_ASTC_8x6_KHR;case xl.ASTC_RGBA_8X8:return K3.COMPRESSED_RGBA_ASTC_8x8_KHR;case xl.ASTC_RGBA_10X5:return K3.COMPRESSED_RGBA_ASTC_10x5_KHR;case xl.ASTC_RGBA_10X6:return K3.COMPRESSED_RGBA_ASTC_10x6_KHR;case xl.ASTC_RGBA_10X8:return K3.COMPRESSED_RGBA_ASTC_10x8_KHR;case xl.ASTC_RGBA_10X10:return K3.COMPRESSED_RGBA_ASTC_10x10_KHR;case xl.ASTC_RGBA_12X10:return K3.COMPRESSED_RGBA_ASTC_12x10_KHR;case xl.ASTC_RGBA_12X12:return K3.COMPRESSED_RGBA_ASTC_12x12_KHR;case xl.ASTC_SRGBA_4X4:return K3.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR;case xl.ASTC_SRGBA_5X4:return K3.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR;case xl.ASTC_SRGBA_5X5:return K3.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR;case xl.ASTC_SRGBA_6X5:return K3.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR;case xl.ASTC_SRGBA_6X6:return K3.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR;case xl.ASTC_SRGBA_8X5:return K3.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR;case xl.ASTC_SRGBA_8X6:return K3.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR;case xl.ASTC_SRGBA_8X8:return K3.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR;case xl.ASTC_SRGBA_10X5:return K3.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR;case xl.ASTC_SRGBA_10X6:return K3.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR;case xl.ASTC_SRGBA_10X8:return K3.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR;case xl.ASTC_SRGBA_10X10:return K3.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR;case xl.ASTC_SRGBA_12X10:return K3.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR;case xl.ASTC_SRGBA_12X12:return K3.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR;default:return console.error("Unsupported Format, convert to WebGL internal format failed."),e.RGBA}}(e.format,i),e.glFormat=function(t,e){switch(t){case xl.A8:return e.ALPHA;case xl.L8:return e.LUMINANCE;case xl.LA8:return e.LUMINANCE_ALPHA;case xl.R8:case xl.R8SN:return e.RED;case xl.R8UI:case xl.R8I:return e.RED;case xl.RG8:case xl.RG8SN:case xl.RG8UI:case xl.RG8I:return e.RG;case xl.RGB8:case xl.RGB8SN:case xl.RGB8UI:case xl.RGB8I:return e.RGB;case xl.BGRA8:case xl.RGBA8:case xl.RGBA8SN:case xl.RGBA8UI:case xl.RGBA8I:return e.RGBA;case xl.R16UI:case xl.R16I:case xl.R16F:return e.RED;case xl.RG16UI:case xl.RG16I:case xl.RG16F:return e.RG;case xl.RGB16UI:case xl.RGB16I:case xl.RGB16F:return e.RGB;case xl.RGBA16UI:case xl.RGBA16I:case xl.RGBA16F:return e.RGBA;case xl.R32UI:case xl.R32I:case xl.R32F:return e.RED;case xl.RG32UI:case xl.RG32I:case xl.RG32F:return e.RG;case xl.RGB32UI:case xl.RGB32I:case xl.RGB32F:return e.RGB;case xl.RGBA32UI:case xl.RGBA32I:case xl.RGBA32F:case xl.RGB10A2:return e.RGBA;case xl.R11G11B10F:case xl.R5G6B5:return e.RGB;case xl.RGB5A1:case xl.RGBA4:return e.RGBA;case xl.SRGB8:return e.RGB;case xl.SRGB8_A8:return e.RGBA;case xl.DEPTH:return e.DEPTH_COMPONENT;case xl.DEPTH_STENCIL:return e.DEPTH_STENCIL;case xl.BC1:return K3.COMPRESSED_RGB_S3TC_DXT1_EXT;case xl.BC1_ALPHA:return K3.COMPRESSED_RGBA_S3TC_DXT1_EXT;case xl.BC1_SRGB:return K3.COMPRESSED_SRGB_S3TC_DXT1_EXT;case xl.BC1_SRGB_ALPHA:return K3.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;case xl.BC2:return K3.COMPRESSED_RGBA_S3TC_DXT3_EXT;case xl.BC2_SRGB:return K3.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;case xl.BC3:return K3.COMPRESSED_RGBA_S3TC_DXT5_EXT;case xl.BC3_SRGB:return K3.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;case xl.ETC_RGB8:return K3.COMPRESSED_RGB_ETC1_WEBGL;case xl.ETC2_RGB8:return K3.COMPRESSED_RGB8_ETC2;case xl.ETC2_SRGB8:return K3.COMPRESSED_SRGB8_ETC2;case xl.ETC2_RGB8_A1:return K3.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2;case xl.ETC2_SRGB8_A1:return K3.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2;case xl.ETC2_RGBA8:return K3.COMPRESSED_RGBA8_ETC2_EAC;case xl.ETC2_SRGB8_A8:return K3.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC;case xl.EAC_R11:return K3.COMPRESSED_R11_EAC;case xl.EAC_R11SN:return K3.COMPRESSED_SIGNED_R11_EAC;case xl.EAC_RG11:return K3.COMPRESSED_RG11_EAC;case xl.EAC_RG11SN:return K3.COMPRESSED_SIGNED_RG11_EAC;case xl.PVRTC_RGB2:return K3.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;case xl.PVRTC_RGBA2:return K3.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;case xl.PVRTC_RGB4:return K3.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;case xl.PVRTC_RGBA4:return K3.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;case xl.ASTC_RGBA_4X4:return K3.COMPRESSED_RGBA_ASTC_4x4_KHR;case xl.ASTC_RGBA_5X4:return K3.COMPRESSED_RGBA_ASTC_5x4_KHR;case xl.ASTC_RGBA_5X5:return K3.COMPRESSED_RGBA_ASTC_5x5_KHR;case xl.ASTC_RGBA_6X5:return K3.COMPRESSED_RGBA_ASTC_6x5_KHR;case xl.ASTC_RGBA_6X6:return K3.COMPRESSED_RGBA_ASTC_6x6_KHR;case xl.ASTC_RGBA_8X5:return K3.COMPRESSED_RGBA_ASTC_8x5_KHR;case xl.ASTC_RGBA_8X6:return K3.COMPRESSED_RGBA_ASTC_8x6_KHR;case xl.ASTC_RGBA_8X8:return K3.COMPRESSED_RGBA_ASTC_8x8_KHR;case xl.ASTC_RGBA_10X5:return K3.COMPRESSED_RGBA_ASTC_10x5_KHR;case xl.ASTC_RGBA_10X6:return K3.COMPRESSED_RGBA_ASTC_10x6_KHR;case xl.ASTC_RGBA_10X8:return K3.COMPRESSED_RGBA_ASTC_10x8_KHR;case xl.ASTC_RGBA_10X10:return K3.COMPRESSED_RGBA_ASTC_10x10_KHR;case xl.ASTC_RGBA_12X10:return K3.COMPRESSED_RGBA_ASTC_12x10_KHR;case xl.ASTC_RGBA_12X12:return K3.COMPRESSED_RGBA_ASTC_12x12_KHR;case xl.ASTC_SRGBA_4X4:return K3.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR;case xl.ASTC_SRGBA_5X4:return K3.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR;case xl.ASTC_SRGBA_5X5:return K3.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR;case xl.ASTC_SRGBA_6X5:return K3.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR;case xl.ASTC_SRGBA_6X6:return K3.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR;case xl.ASTC_SRGBA_8X5:return K3.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR;case xl.ASTC_SRGBA_8X6:return K3.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR;case xl.ASTC_SRGBA_8X8:return K3.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR;case xl.ASTC_SRGBA_10X5:return K3.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR;case xl.ASTC_SRGBA_10X6:return K3.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR;case xl.ASTC_SRGBA_10X8:return K3.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR;case xl.ASTC_SRGBA_10X10:return K3.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR;case xl.ASTC_SRGBA_12X10:return K3.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR;case xl.ASTC_SRGBA_12X12:return K3.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR;default:return console.error("Unsupported Format, convert to WebGL format failed."),e.RGBA}}(e.format,i),e.glType=t5(e.format,i);var n=e.width,r=e.height,s=e.depth,a=e.arrayLayer;switch(e.type){case Pl.TEX2D:e.glTarget=i.TEXTURE_2D;var o=Math.max(n,r);if(o>t.capabilities.maxTextureSize&&J(9100,o,t.capabilities.maxTextureSize),e.samples===Ll.ONE){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),m_[e.format].isCompressed)for(var u=0;u<e.mipLevel;++u){var l=A_(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 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 Pl.TEX2D_ARRAY:e.glTarget=i.TEXTURE_2D_ARRAY;var _=Math.max(n,r);if(_>t.capabilities.maxTextureSize&&J(9100,_,t.capabilities.maxTextureSize),a>t.capabilities.maxArrayTextureLayers&&J(9100,a,t.capabilities.maxArrayTextureLayers),e.glTexture=i.createTexture(),e.size>0){var f=t.stateCache.glTexUnits[t.stateCache.texUnit];if(f.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_2D_ARRAY,e.glTexture),f.glTexture=e.glTexture),m_[e.format].isCompressed)for(var d=0;d<e.mipLevel;++d){var p=A_(e.format,n,r,a),m=new Uint8Array(p);i.compressedTexImage3D(i.TEXTURE_2D_ARRAY,d,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 Pl.TEX3D:e.glTarget=i.TEXTURE_3D;var g=Math.max(Math.max(n,r),s);if(g>t.capabilities.max3DTextureSize&&J(9100,g,t.capabilities.max3DTextureSize),e.glTexture=i.createTexture(),e.size>0){var y=t.stateCache.glTexUnits[t.stateCache.texUnit];if(y.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_3D,e.glTexture),y.glTexture=e.glTexture),m_[e.format].isCompressed)for(var v=0;v<e.mipLevel;++v){var S=A_(e.format,n,r,s),A=new Uint8Array(S);i.compressedTexImage3D(i.TEXTURE_3D,v,e.glInternalFmt,n,r,s,0,A),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 Pl.CUBE:e.glTarget=i.TEXTURE_CUBE_MAP;var T=Math.max(n,r);if(T>t.capabilities.maxCubeMapTextureSize&&J(9100,T,t.capabilities.maxTextureSize),e.glTexture=i.createTexture(),e.size>0){var E=t.stateCache.glTexUnits[t.stateCache.texUnit];if(E.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_CUBE_MAP,e.glTexture),E.glTexture=e.glTexture),m_[e.format].isCompressed)for(var b=0;b<e.mipLevel;++b){for(var x=A_(e.format,n,r,1),C=new Uint8Array(x),R=0;R<6;++R)i.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+R,b,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:console.error("Unsupported TextureType, create texture failed."),e.type=Pl.TEX2D,e.glTarget=i.TEXTURE_2D}}function S5(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 A5={gpuPipelineState:null,gpuInputAssembler:null,glPrimitive:0,invalidateAttachments:[]};function T5(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),A5.invalidateAttachments.length=0;for(var l=0;l<r.length;++l){var c=e.colorAttachments[l];if(c.format!==xl.UNKNOWN)switch(c.loadOp){case jl.LOAD:break;case jl.CLEAR:if(h.bs.targets[0].blendColorMask!==Wl.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 $3[0]=r[l].x,$3[1]=r[l].y,$3[2]=r[l].z,$3[3]=r[l].w,o.clearBufferfv(o.COLOR,l,$3);break;case jl.DISCARD:A5.invalidateAttachments.push(o.COLOR_ATTACHMENT0+l)}}if(e.depthStencilAttachment&&e.depthStencilAttachment.format!==xl.UNKNOWN){switch(e.depthStencilAttachment.depthLoadOp){case jl.LOAD:break;case jl.CLEAR:h.dss.depthWrite||o.depthMask(!0),o.clearDepth(s),u|=o.DEPTH_BUFFER_BIT;break;case jl.DISCARD:A5.invalidateAttachments.push(o.DEPTH_ATTACHMENT)}if(m_[e.depthStencilAttachment.format].hasStencil)switch(e.depthStencilAttachment.stencilLoadOp){case jl.LOAD:break;case jl.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 jl.DISCARD:A5.invalidateAttachments.push(o.STENCIL_ATTACHMENT)}}if(i.glFramebuffer&&A5.invalidateAttachments.length&&o.invalidateFramebuffer(o.FRAMEBUFFER,A5.invalidateAttachments),u&&o.clear(u),u&o.COLOR_BUFFER_BIT){var f=h.bs.targets[0].blendColorMask;if(f!==Wl.ALL){var d=(f&Wl.R)!==Wl.NONE,p=(f&Wl.G)!==Wl.NONE,m=(f&Wl.B)!==Wl.NONE,g=(f&Wl.A)!==Wl.NONE;o.colorMask(d,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 E5(t,e,i,n,r,s){var a=t.gl,o=t.stateCache,h=e&&e.gpuShader,u=!1;if(e&&A5.gpuPipelineState!==e){if(A5.gpuPipelineState=e,A5.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 tc.NONE:a.disable(a.CULL_FACE);break;case tc.FRONT:a.enable(a.CULL_FACE),a.cullFace(a.FRONT);break;case tc.BACK:a.enable(a.CULL_FACE),a.cullFace(a.BACK)}t.stateCache.rs.cullMode=c.cullMode}var _=c.isFrontFaceCCW;t.stateCache.rs.isFrontFaceCCW!==_&&(a.frontFace(_?a.CCW:a.CW),t.stateCache.rs.isFrontFaceCCW=_),t.stateCache.rs.depthBias===c.depthBias&&t.stateCache.rs.depthBiasSlop===c.depthBiasSlop||(a.polygonOffset(c.depthBias,c.depthBiasSlop),t.stateCache.rs.depthBias=c.depthBias,t.stateCache.rs.depthBiasSlop=c.depthBiasSlop),t.stateCache.rs.lineWidth!==c.lineWidth&&(a.lineWidth(c.lineWidth),t.stateCache.rs.lineWidth=c.lineWidth)}var f=e.dss;f&&(o.dss.depthTest!==f.depthTest&&(f.depthTest?a.enable(a.DEPTH_TEST):a.disable(a.DEPTH_TEST),o.dss.depthTest=f.depthTest),o.dss.depthWrite!==f.depthWrite&&(a.depthMask(f.depthWrite),o.dss.depthWrite=f.depthWrite),o.dss.depthFunc!==f.depthFunc&&(a.depthFunc(a5[f.depthFunc]),o.dss.depthFunc=f.depthFunc),o.dss.stencilTestFront===f.stencilTestFront&&o.dss.stencilTestBack===f.stencilTestBack||(f.stencilTestFront||f.stencilTestBack?a.enable(a.STENCIL_TEST):a.disable(a.STENCIL_TEST),o.dss.stencilTestFront=f.stencilTestFront,o.dss.stencilTestBack=f.stencilTestBack),o.dss.stencilFuncFront===f.stencilFuncFront&&o.dss.stencilRefFront===f.stencilRefFront&&o.dss.stencilReadMaskFront===f.stencilReadMaskFront||(a.stencilFuncSeparate(a.FRONT,a5[f.stencilFuncFront],f.stencilRefFront,f.stencilReadMaskFront),o.dss.stencilFuncFront=f.stencilFuncFront,o.dss.stencilRefFront=f.stencilRefFront,o.dss.stencilReadMaskFront=f.stencilReadMaskFront),o.dss.stencilFailOpFront===f.stencilFailOpFront&&o.dss.stencilZFailOpFront===f.stencilZFailOpFront&&o.dss.stencilPassOpFront===f.stencilPassOpFront||(a.stencilOpSeparate(a.FRONT,o5[f.stencilFailOpFront],o5[f.stencilZFailOpFront],o5[f.stencilPassOpFront]),o.dss.stencilFailOpFront=f.stencilFailOpFront,o.dss.stencilZFailOpFront=f.stencilZFailOpFront,o.dss.stencilPassOpFront=f.stencilPassOpFront),o.dss.stencilWriteMaskFront!==f.stencilWriteMaskFront&&(a.stencilMaskSeparate(a.FRONT,f.stencilWriteMaskFront),o.dss.stencilWriteMaskFront=f.stencilWriteMaskFront),o.dss.stencilFuncBack===f.stencilFuncBack&&o.dss.stencilRefBack===f.stencilRefBack&&o.dss.stencilReadMaskBack===f.stencilReadMaskBack||(a.stencilFuncSeparate(a.BACK,a5[f.stencilFuncBack],f.stencilRefBack,f.stencilReadMaskBack),o.dss.stencilFuncBack=f.stencilFuncBack,o.dss.stencilRefBack=f.stencilRefBack,o.dss.stencilReadMaskBack=f.stencilReadMaskBack),o.dss.stencilFailOpBack===f.stencilFailOpBack&&o.dss.stencilZFailOpBack===f.stencilZFailOpBack&&o.dss.stencilPassOpBack===f.stencilPassOpBack||(a.stencilOpSeparate(a.BACK,o5[f.stencilFailOpBack],o5[f.stencilZFailOpBack],o5[f.stencilPassOpBack]),o.dss.stencilFailOpBack=f.stencilFailOpBack,o.dss.stencilZFailOpBack=f.stencilZFailOpBack,o.dss.stencilPassOpBack=f.stencilPassOpBack),o.dss.stencilWriteMaskBack!==f.stencilWriteMaskBack&&(a.stencilMaskSeparate(a.BACK,f.stencilWriteMaskBack),o.dss.stencilWriteMaskBack=f.stencilWriteMaskBack));var d=e.bs;if(d){o.bs.isA2C!==d.isA2C&&(d.isA2C?a.enable(a.SAMPLE_ALPHA_TO_COVERAGE):a.disable(a.SAMPLE_ALPHA_TO_COVERAGE),o.bs.isA2C=d.isA2C),o.bs.blendColor.x===d.blendColor.x&&o.bs.blendColor.y===d.blendColor.y&&o.bs.blendColor.z===d.blendColor.z&&o.bs.blendColor.w===d.blendColor.w||(a.blendColor(d.blendColor.x,d.blendColor.y,d.blendColor.z,d.blendColor.w),o.bs.blendColor.x=d.blendColor.x,o.bs.blendColor.y=d.blendColor.y,o.bs.blendColor.z=d.blendColor.z,o.bs.blendColor.w=d.blendColor.w);var p=d.targets[0],m=o.bs.targets[0];m.blend!==p.blend&&(p.blend?a.enable(a.BLEND):a.disable(a.BLEND),m.blend=p.blend),m.blendEq===p.blendEq&&m.blendAlphaEq===p.blendAlphaEq||(a.blendEquationSeparate(h5[p.blendEq],h5[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(u5[p.blendSrc],u5[p.blendDst],u5[p.blendSrcAlpha],u5[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&Wl.R)!==Wl.NONE,(p.blendColorMask&Wl.G)!==Wl.NONE,(p.blendColorMask&Wl.B)!==Wl.NONE,(p.blendColorMask&Wl.A)!==Wl.NONE),m.blendColorMask=p.blendColorMask)}}if(e&&e.gpuPipelineLayout&&h){for(var g=h.glBlocks.length,y=e.gpuPipelineLayout.dynamicOffsetIndices,v=0;v<g;v++){var S=h.glBlocks[v],A=n[S.set],T=A&&A.descriptorIndices[S.binding],E=T>=0&&A.gpuDescriptors[T];if(E&&E.gpuBuffer){var b=y[S.set],x=b&&b[S.binding],C=E.gpuBuffer.glOffset;x>=0&&(C+=r[x]),o.glBindUBOs[S.glBinding]===E.gpuBuffer.glBuffer&&o.glBindUBOOffsets[S.glBinding]===C||(C?a.bindBufferRange(a.UNIFORM_BUFFER,S.glBinding,E.gpuBuffer.glBuffer,C,E.gpuBuffer.size):a.bindBufferBase(a.UNIFORM_BUFFER,S.glBinding,E.gpuBuffer.glBuffer),o.glUniformBuffer=o.glBindUBOs[S.glBinding]=E.gpuBuffer.glBuffer,o.glBindUBOOffsets[S.glBinding]=C)}}for(var R=h.glSamplerTextures.length,w=0;w<R;w++)for(var I=h.glSamplerTextures[w],B=n[I.set],D=B&&B.descriptorIndices[I.binding],P=D>=0&&B.gpuDescriptors[D],O=0;O<I.units.length;O++){var M=I.units[O],N=o.glTexUnits[M];if(P&&P.gpuTextureView&&P.gpuTextureView.gpuTexture&&P.gpuSampler){var L=P.gpuTextureView,F=L.gpuTexture,k=L.baseLevel,G=k+L.levelCount;if(F.size>0){N.glTexture!==F.glTexture&&(o.texUnit!==M&&(a.activeTexture(a.TEXTURE0+M),o.texUnit=M),F.glTexture?a.bindTexture(F.glTarget,F.glTexture):a.bindTexture(F.glTarget,t.nullTex2D.gpuTexture.glTexture),N.glTexture=F.glTexture);var V=P.gpuSampler.getGLSampler(t,k,G);o.glSamplerUnits[M]!==V&&(a.bindSampler(M,V),o.glSamplerUnits[M]=V)}P=B.gpuDescriptors[++D]}}}if(i&&h&&(u||A5.gpuInputAssembler!==i))if(A5.gpuInputAssembler=i,t.extensions.useVAO){var U=i.glVAOs.get(h.glProgram);if(!U){var z;U=a.createVertexArray(),i.glVAOs.set(h.glProgram,U),a.bindVertexArray(U),a.bindBuffer(a.ARRAY_BUFFER,null),a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,null),o.glArrayBuffer=null,o.glElementArrayBuffer=null;for(var H=0;H<h.glInputs.length;H++){var W=h.glInputs[H];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 q=W.glLoc+Y,K=z.offset+z.size*Y;a.enableVertexAttribArray(q),o.glCurrentAttribLocs[q]=!0,a.vertexAttribPointer(q,z.count,z.glType,z.isNormalized,z.stride,K),a.vertexAttribDivisor(q,z.isInstanced?1:0)}}}var J=i.gpuIndexBuffer;J&&a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,J.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!==U&&(a.bindVertexArray(U),o.glVAO=U)}else{for(var Q=0;Q<t.capabilities.maxVertexAttributes;++Q)o.glCurrentAttribLocs[Q]=!1;for(var Z=0;Z<h.glInputs.length;Z++){for(var $=h.glInputs[Z],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 ft=s.stencilStatesFront,dt=s.stencilStatesBack;o.dss.stencilRefFront===ft.reference&&o.dss.stencilReadMaskFront===ft.compareMask||(a.stencilFuncSeparate(a.FRONT,a5[o.dss.stencilFuncFront],ft.reference,ft.compareMask),o.dss.stencilRefFront=ft.reference,o.dss.stencilReadMaskFront=ft.compareMask),o.dss.stencilRefBack===dt.reference&&o.dss.stencilReadMaskBack===dt.compareMask||(a.stencilFuncSeparate(a.BACK,a5[o.dss.stencilFuncBack],dt.reference,dt.compareMask),o.dss.stencilRefBack=dt.reference,o.dss.stencilReadMaskBack=dt.compareMask)}}function b5(t,e){var i=t.gl,n=A5.gpuInputAssembler,r=A5.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 x5=new Array(s5.COUNT);function C5(t,e){x5.fill(0);for(var i=0;i<e.cmds.length;++i){var n=e.cmds.array[i],r=x5[n]++;switch(n){case s5.BEGIN_RENDER_PASS:var s=e.beginRenderPassCmds.array[r];T5(t,s.gpuRenderPass,s.gpuFramebuffer,s.renderArea,s.clearColors,s.clearDepth,s.clearStencil);break;case s5.BIND_STATES:var a=e.bindStatesCmds.array[r];E5(t,a.gpuPipelineState,a.gpuInputAssembler,a.gpuDescriptorSets,a.dynamicOffsets,a.dynamicStates);break;case s5.DRAW:b5(t,e.drawCmds.array[r].drawInfo);break;case s5.UPDATE_BUFFER:var o=e.updateBufferCmds.array[r];y5(t,o.gpuBuffer,o.buffer,o.offset,o.size);break;case s5.COPY_BUFFER_TO_TEXTURE:var h=e.copyBufferToTextureCmds.array[r];I5(t,h.buffers,h.gpuTexture,h.regions);break;case s5.BLIT_TEXTURE:var u=e.blitTextureCmds.array[r];B5(t,u.srcTexture,u.dstTexture,u.regions,u.filter)}}}var R5=new Uint8Array(1);function w5(t,e,i,n,r){var s=C_(e).height,a=A_(e,r.width,r.height,r.depth),o=A_(e,n.width,1,1),h=A_(e,n.width,n.height,1),u=A_(e,r.width,1,1),l=x_(m_[e]);R5.byteLength<a&&(R5=new Uint8Array(a));for(var c=0,_=i,f=0;f<r.depth;f++){_=i+h*f;for(var d=0;d<r.height;d+=s)R5.subarray(c,c+u).set(new Uint8Array(t.buffer,t.byteOffset+_,u)),c+=u,_+=o}var p=a/l.BYTES_PER_ELEMENT;return $(Number.isInteger(p),9101),new l(R5.buffer,0,p)}function I5(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=m_[i.format],u=x_(h),l=h.isCompressed,c=C_(i.format),_=new gc,f=new pc,d=new gc;switch(i.glTarget){case r.TEXTURE_2D:for(var p=0;p<n.length;p++){var m=n[p],g=m.texSubres.mipLevel;f.x=0===m.texOffset.x?0:R_(m.texOffset.x,c.width),f.y=0===m.texOffset.y?0:R_(m.texOffset.y,c.height),_.width=m.texExtent.width<c.width?m.texExtent.width:R_(m.texExtent.width,c.width),_.height=m.texExtent.height<c.height?m.texExtent.width:R_(m.texExtent.height,c.height),d.width=m.buffStride>0?m.buffStride:_.width,d.height=m.buffTexHeight>0?m.buffTexHeight:_.height;var y=m.texExtent.width+f.x===i.width>>g?m.texExtent.width:_.width,v=m.texExtent.height+f.y===i.height>>g?m.texExtent.height:_.height,S=void 0,A=e[a++];if(d.width===_.width&&d.height===_.height){var T=A_(i.format,y,v,1)/u.BYTES_PER_ELEMENT;$(Number.isInteger(T),9101),S=new u(A.buffer,A.byteOffset+m.buffOffset,T)}else S=w5(A,i.format,m.buffOffset,d,_);l?i.glInternalFmt!==K3.COMPRESSED_RGB_ETC1_WEBGL?r.compressedTexSubImage2D(r.TEXTURE_2D,g,f.x,f.y,y,v,i.glFormat,S):r.compressedTexImage2D(r.TEXTURE_2D,g,i.glInternalFmt,y,v,0,S):r.texSubImage2D(r.TEXTURE_2D,g,f.x,f.y,y,v,i.glFormat,i.glType,S)}break;case r.TEXTURE_2D_ARRAY:for(var E=0;E<n.length;E++){var b=n[E],x=b.texSubres.mipLevel;f.x=0===b.texOffset.x?0:R_(b.texOffset.x,c.width),f.y=0===b.texOffset.y?0:R_(b.texOffset.y,c.height),_.width=b.texExtent.width<c.width?b.texExtent.width:R_(b.texExtent.width,c.width),_.height=b.texExtent.height<c.height?b.texExtent.width:R_(b.texExtent.height,c.height),_.depth=1,d.width=b.buffStride>0?b.buffStride:_.width,d.height=b.buffTexHeight>0?b.buffTexHeight:_.height;var C=b.texExtent.width+f.x===i.width>>x?b.texExtent.width:_.width,R=b.texExtent.height+f.y===i.height>>x?b.texExtent.height:_.height,w=b.texSubres.baseArrayLayer+b.texSubres.layerCount;for(o=b.texSubres.baseArrayLayer;o<w;++o){f.z=o;var I=void 0,B=e[a++];if(d.width===_.width&&d.height===_.height){var D=A_(i.format,C,R,1)/u.BYTES_PER_ELEMENT;$(Number.isInteger(D),9101),I=new u(B.buffer,B.byteOffset+b.buffOffset,D)}else I=w5(B,i.format,b.buffOffset,d,_);l?i.glInternalFmt!==K3.COMPRESSED_RGB_ETC1_WEBGL?r.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,x,f.x,f.y,f.z,C,R,_.depth,i.glFormat,I):r.compressedTexImage3D(r.TEXTURE_2D_ARRAY,x,i.glInternalFmt,C,R,_.depth,0,I):r.texSubImage3D(r.TEXTURE_2D_ARRAY,x,f.x,f.y,f.z,C,R,_.depth,i.glFormat,i.glType,I)}}break;case r.TEXTURE_3D:for(var P=0;P<n.length;P++){var O=n[P],M=O.texSubres.mipLevel;f.x=0===O.texOffset.x?0:R_(O.texOffset.x,c.width),f.y=0===O.texOffset.y?0:R_(O.texOffset.y,c.height),f.z=O.texOffset.z,_.width=O.texExtent.width<c.width?O.texExtent.width:R_(O.texExtent.width,c.width),_.height=O.texExtent.height<c.height?O.texExtent.width:R_(O.texExtent.height,c.height),_.depth=O.texExtent.depth,d.width=O.buffStride>0?O.buffStride:_.width,d.height=O.buffTexHeight>0?O.buffTexHeight:_.height;var N=O.texExtent.width+f.x===i.width>>M?O.texExtent.width:_.width,L=O.texExtent.height+f.y===i.height>>M?O.texExtent.height:_.height,F=void 0,k=e[a++];if(d.width===_.width&&d.height===_.height){var G=A_(i.format,N,L,_.depth)/u.BYTES_PER_ELEMENT;$(Number.isInteger(G),9101),F=new u(k.buffer,k.byteOffset+O.buffOffset,G)}else F=w5(k,i.format,O.buffOffset,d,_);l?i.glInternalFmt!==K3.COMPRESSED_RGB_ETC1_WEBGL?r.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,M,f.x,f.y,f.z,N,L,_.depth,i.glFormat,F):r.compressedTexImage3D(r.TEXTURE_2D_ARRAY,M,i.glInternalFmt,N,L,_.depth,0,F):r.texSubImage3D(r.TEXTURE_2D_ARRAY,M,f.x,f.y,f.z,N,L,_.depth,i.glFormat,i.glType,F)}break;case r.TEXTURE_CUBE_MAP:for(var V=0;V<n.length;V++){var U=n[V],z=U.texSubres.mipLevel;f.x=0===U.texOffset.x?0:R_(U.texOffset.x,c.width),f.y=0===U.texOffset.y?0:R_(U.texOffset.y,c.height),_.width=U.texExtent.width<c.width?U.texExtent.width:R_(U.texExtent.width,c.width),_.height=U.texExtent.height<c.height?U.texExtent.width:R_(U.texExtent.height,c.height),d.width=U.buffStride>0?U.buffStride:_.width,d.height=U.buffTexHeight>0?U.buffTexHeight:_.height;var H=U.texExtent.width+f.x===i.width>>z?U.texExtent.width:_.width,W=U.texExtent.height+f.y===i.height>>z?U.texExtent.height:_.height,X=U.texSubres.baseArrayLayer+U.texSubres.layerCount;for(o=U.texSubres.baseArrayLayer;o<X;++o){var j=void 0,Y=e[a++];if(d.width===_.width&&d.height===_.height){var q=A_(i.format,H,W,1)/u.BYTES_PER_ELEMENT;$(Number.isInteger(q),9101),j=new u(Y.buffer,Y.byteOffset+U.buffOffset,q)}else j=w5(Y,i.format,U.buffOffset,d,_);l?i.glInternalFmt!==K3.COMPRESSED_RGB_ETC1_WEBGL?r.compressedTexSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+o,z,f.x,f.y,H,W,i.glFormat,j):r.compressedTexImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+o,z,i.glInternalFmt,H,W,0,j):r.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+o,z,f.x,f.y,H,W,i.glFormat,i.glType,j)}}break;default:console.error("Unsupported GL texture type, copy buffer to texture failed.")}i.flags&Ml.GEN_MIPMAP&&r.generateMipmap(i.glTarget)}function B5(t,e,i,n,r){var s=t.gl,a=t.stateCache,o=t.blitManager;if(o){var h=r===kl.LINEAR||r===kl.ANISOTROPIC?s.LINEAR:s.NEAREST,u=o.srcFramebuffer,l=o.dstFramebuffer,c=a.glReadFramebuffer,_=a.glFramebuffer,f=n[0].srcSubres.mipLevel,d=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(m_[e.format]),y=g.mask,v=g.attachment,S=p(m_[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,v,e.glTarget,e.glTexture,f):s.framebufferRenderbuffer(s.READ_FRAMEBUFFER,v,s.RENDERBUFFER,e.glRenderbuffer),i.glTexture?s.framebufferTexture2D(s.DRAW_FRAMEBUFFER,S,i.glTarget,i.glTexture,d):s.framebufferRenderbuffer(s.DRAW_FRAMEBUFFER,S,s.RENDERBUFFER,i.glRenderbuffer);for(var A=0;A<m.length;A++){var T=n[m[A]];e.glTexture&&f!==T.srcSubres.mipLevel&&(f=T.srcSubres.mipLevel,s.framebufferTexture2D(s.READ_FRAMEBUFFER,v,e.glTarget,e.glTexture,f)),i.glTexture&&d!==T.dstSubres.mipLevel&&(d=T.dstSubres.mipLevel,s.framebufferTexture2D(s.DRAW_FRAMEBUFFER,S,i.glTarget,i.glTexture,d)),s.blitFramebuffer(T.srcOffset.x,T.srcOffset.y,T.srcOffset.x+T.srcExtent.width,T.srcOffset.y+T.srcExtent.height,T.dstOffset.x,T.dstOffset.y,T.dstOffset.x+T.dstExtent.width,T.dstOffset.y+T.dstExtent.height,y,h)}a.glReadFramebuffer!==c&&(s.bindFramebuffer(s.READ_FRAMEBUFFER,c),a.glReadFramebuffer=c),a.glFramebuffer!==_&&(s.bindFramebuffer(s.DRAW_FRAMEBUFFER,_),a.glFramebuffer=_)}}var D5=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=Ni(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}(),P5=function(){function t(){this._srcFramebuffer=void 0,this._dstFramebuffer=void 0;var t=Q3.instance.gl;this._srcFramebuffer=t.createFramebuffer(),this._dstFramebuffer=t.createFramebuffer()}return t.prototype.destroy=function(){var t=Q3.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}(),O5=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._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 D5,glTarget:0,glBuffer:null,glOffset:0},function(t,e){var i=t.gl,n=t.stateCache,r=e.memUsage&Dl.HOST?i.DYNAMIC_DRAW:i.STATIC_DRAW;if(e.usage&wl.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),A5.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&wl.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),A5.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&wl.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&wl.INDIRECT||e.usage&wl.TRANSFER_DST||e.usage&wl.TRANSFER_SRC||console.error("Unsupported BufferType, create buffer failed."),e.glTarget=i.NONE}(Q3.instance,this._gpuBuffer),Q3.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),A5.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),A5.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}}(Q3.instance,this._gpuBuffer),Q3.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&Dl.HOST?i.DYNAMIC_DRAW:i.STATIC_DRAW;e.usage&wl.VERTEX?(t.extensions.useVAO&&n.glVAO&&(i.bindVertexArray(null),n.glVAO=null),A5.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&wl.INDEX?(t.extensions.useVAO&&n.glVAO&&(i.bindVertexArray(null),n.glVAO=null),A5.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&wl.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&wl.INDIRECT||e.usage&wl.TRANSFER_DST||e.usage&wl.TRANSFER_SRC||console.error("Unsupported BufferType, create buffer failed."),e.glTarget=i.NONE)}(Q3.instance,this._gpuBuffer),Q3.instance.memoryStatus.bufferSize-=e,Q3.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&wl.INDIRECT?0:t.byteLength,y5(Q3.instance,this._gpuBuffer,t,0,i))},n(e,[{key:"gpuBuffer",get:function(){return this._gpuBuffer}}]),e}(I_),M5=function(){function t(t,e){this._frees=void 0,this._freeIdx=0,this._freeCmds=void 0,this._frees=new Array(e),this._freeCmds=new du(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}(),N5=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 M5(c5,1),this.bindStatesCmdPool=new M5(_5,1),this.drawCmdPool=new M5(f5,1),this.updateBufferCmdPool=new M5(d5,1),this.copyBufferToTextureCmdPool=new M5(p5,1),this.blitTextureCmdPool=new M5(m5,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}(),L5=function(t){function e(){for(var e,i=arguments.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 g5,e._cmdAllocator=new N5,e._isInRenderPass=!1,e._curGPUPipelineState=null,e._curGPUDescriptorSets=[],e._curGPUInputAssembler=null,e._curDynamicOffsets=Array(8).fill(0),e._curDynamicStates=new d_,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=Q3.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(c5);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(s5.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&ic.FRONT&&i.writeMask!==e&&(i.writeMask=e,this._isStateInvalied=!0),t&ic.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&ic.FRONT&&(n.compareMask===i&&n.reference===e||(n.reference=e,n.compareMask=i,this._isStateInvalied=!0)),t&ic.BACK&&(r.compareMask===i&&r.reference===e||(r.reference=e,r.compareMask=i,this._isStateInvalied=!0))},i.draw=function(t){if(this._type===ac.PRIMARY&&this._isInRenderPass||this._type===ac.SECONDARY){this._isStateInvalied&&this.bindStates();var e="drawInfo"in t?t.drawInfo:t,i=this._cmdAllocator.drawCmdPool.alloc(f5);i.drawInfo.copy(e),this.cmdPackage.drawCmds.push(i),this.cmdPackage.cmds.push(s5.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===ac.PRIMARY&&!this._isInRenderPass||this._type===ac.SECONDARY){var n=t.gpuBuffer;if(n){var r,s=this._cmdAllocator.updateBufferCmdPool.alloc(d5),a=0;t.usage&wl.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(s5.UPDATE_BUFFER)}}else console.error("Command 'updateBuffer' must be recorded outside a render pass.")},i.copyBuffersToTexture=function(t,e,i){if(this._type===ac.PRIMARY&&!this._isInRenderPass||this._type===ac.SECONDARY){var n=e.gpuTexture;if(n){var r=this._cmdAllocator.copyBufferToTextureCmdPool.alloc(p5);r.gpuTexture=n,r.regions=i,r.buffers=t,this.cmdPackage.copyBufferToTextureCmds.push(r),this.cmdPackage.cmds.push(s5.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 f=n.cmdPackage.copyBufferToTextureCmds.array[_];++f.refCount,this.cmdPackage.copyBufferToTextureCmds.push(f)}for(var d=0;d<n.cmdPackage.blitTextureCmds.length;++d){var p=n.cmdPackage.blitTextureCmds.array[d];++p.refCount,this.cmdPackage.blitTextureCmds.push(p)}this.cmdPackage.cmds.concat(n.cmdPackage.cmds.array),this._numDrawCalls+=n._numDrawCalls,this._numInstances+=n._numInstances,this._numTris+=n._numTris}},i.pipelineBarrier=function(){},i.bindStates=function(){var t=this._cmdAllocator.bindStatesCmdPool.alloc(_5);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(s5.BIND_STATES),this._isStateInvalied=!1},i.blitTexture=function(t,e,i,n){var r=this._cmdAllocator.blitTextureCmdPool.alloc(m5);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(s5.BLIT_TEXTURE)},e}(B_),F5=function(t){function e(){for(var e,i=arguments.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;this._gpuFramebuffer={gpuRenderPass:t.renderPass.gpuRenderPass,gpuColorViews:e,gpuDepthStencilView:r,glFramebuffer:null,isOffscreen:!0,get width(){return this.isOffscreen?s:this.gpuColorViews.length>0?this.gpuColorViews[0].gpuTexture.width:this.gpuDepthStencilView.gpuTexture.width},set width(t){s=t},get height(){return this.isOffscreen?s:this.gpuColorViews.length>0?this.gpuColorViews[0].gpuTexture.height:this.gpuDepthStencilView.gpuTexture.height},set height(t){}},function(t,e){for(var i=0;i<e.gpuColorViews.length;++i)if(e.gpuColorViews[i].gpuTexture.isSwapchainTexture)return void(e.isOffscreen=!1);var n=t.gl,r=[],s=n.createFramebuffer();if(s){e.glFramebuffer=s,t.stateCache.glFramebuffer!==e.glFramebuffer&&n.bindFramebuffer(n.FRAMEBUFFER,e.glFramebuffer);for(var a=0;a<e.gpuColorViews.length;++a){var o=e.gpuColorViews[a],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=m_[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:console.error("glCheckFramebufferStatus() - FRAMEBUFFER_INCOMPLETE_ATTACHMENT");break;case n.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:console.error("glCheckFramebufferStatus() - FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT");break;case n.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:console.error("glCheckFramebufferStatus() - FRAMEBUFFER_INCOMPLETE_DIMENSIONS");break;case n.FRAMEBUFFER_UNSUPPORTED:console.error("glCheckFramebufferStatus() - FRAMEBUFFER_UNSUPPORTED")}t.stateCache.glFramebuffer!==e.glFramebuffer&&n.bindFramebuffer(n.FRAMEBUFFER,t.stateCache.glFramebuffer)}}(Q3.instance,this._gpuFramebuffer)},i.destroy=function(){var t,e;this._gpuFramebuffer&&(t=Q3.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}(M_),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)._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=t5(s.format,i),u=m_[s.format].size;e.glAttribs[r]={name:s.name,glBuffer:o.glBuffer,glType:h,size:u,count:m_[s.format].count,stride:o.stride,componentCount:r5(h,i),isNormalized:void 0!==s.isNormalized&&s.isNormalized,isInstanced:void 0!==s.isInstanced&&s.isInstanced,offset:n[a]},n[a]+=u}}(Q3.instance,this._gpuInputAssembler)}else console.error("InputAssemblerInfo.vertexBuffers is null.")},i.destroy=function(){var t=Q3.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}(N_),G5=function(t){function e(){for(var e,i=arguments.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&v_)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}(F_),V5=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._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}(k_),U5=[0,1,3,2,0,0,0,4,5,6,0,0,0,0],z5=function(t){function e(){for(var e,i=arguments.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:U5[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}(W_),H5=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){T5(Q3.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;b5(Q3.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=Q3.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=Q3.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&wl.INDIRECT?0:e.byteLength,y5(Q3.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&&I5(Q3.instance,t,n,i)}},i.execute=function(t,e){for(var i=0;i<e;++i){var n=t[i];C5(Q3.instance,n.cmdPackage),this._numDrawCalls+=n._numDrawCalls,this._numInstances+=n._numInstances,this._numTris+=n._numTris}},i.bindStates=function(){E5(Q3.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;B5(Q3.instance,r,s,i,n)},e}(L5),W5=function(t){function e(){for(var e,i=arguments.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}(X_),X5=function(t){function e(){for(var e,i=arguments.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}(j_),j5=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=Q3.instance,s=n._gpuSampler,a=r.gl,s.minFilter===kl.LINEAR||s.minFilter===kl.ANISOTROPIC?s.mipFilter===kl.LINEAR||s.mipFilter===kl.ANISOTROPIC?s.glMinFilter=a.LINEAR_MIPMAP_LINEAR:s.mipFilter===kl.POINT?s.glMinFilter=a.LINEAR_MIPMAP_NEAREST:s.glMinFilter=a.LINEAR:s.mipFilter===kl.LINEAR||s.mipFilter===kl.ANISOTROPIC?s.glMinFilter=a.NEAREST_MIPMAP_LINEAR:s.mipFilter===kl.POINT?s.glMinFilter=a.NEAREST_MIPMAP_NEAREST:s.glMinFilter=a.NEAREST,s.magFilter===kl.LINEAR||s.magFilter===kl.ANISOTROPIC?s.glMagFilter=a.LINEAR:s.glMagFilter=a.NEAREST,s.glWrapS=Z3[s.addressU],s.glWrapT=Z3[s.addressV],s.glWrapR=Z3[s.addressW],n}return 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()}(Q3.instance,this._gpuSampler),this._gpuSampler=null)},n(e,[{key:"gpuSampler",get:function(){return this._gpuSampler}}]),e}(Y_),Y5=function(t){function e(){for(var e,i=arguments.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=Q3.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=t.gl,n=function(){var t=e.gpuStages[r],n=0,s="",a=1;switch(t.type){case Xl.VERTEX:s="VertexShader",n=i.VERTEX_SHADER;break;case Xl.FRAGMENT:s="FragmentShader",n=i.FRAGMENT_SHADER;break;default:return console.error("Unsupported ShaderType."),{v:void 0}}var o=i.createShader(n);if(o&&(t.glShader=o,i.shaderSource(t.glShader,"#version 300 es\n"+t.source),i.compileShader(t.glShader),!i.getShaderParameter(t.glShader,i.COMPILE_STATUS))){console.error(s+" in '"+e.name+"' compilation failed."),console.error("Shader source dump:",t.source.replace(/^|\n/g,(function(){return"\n"+a+++" "}))),console.error(i.getShaderInfoLog(t.glShader));for(var h=0;h<e.gpuStages.length;h++){var u=e.gpuStages[r];u.glShader&&(i.deleteShader(u.glShader),u.glShader=null)}return{v:void 0}}},r=0;r<e.gpuStages.length;r++){var s=n();if("object"==typeof s)return s.v}var a=i.createProgram();if(a){e.glProgram=a;for(var o=!(!v.rendering||!v.rendering.enableEffectImport),h=0;h<e.gpuStages.length;h++){var u=e.gpuStages[h];i.attachShader(e.glProgram,u.glShader)}i.linkProgram(e.glProgram);for(var l=0;l<e.gpuStages.length;l++){var c=e.gpuStages[l];c.glShader&&(i.detachShader(e.glProgram,c.glShader),i.deleteShader(c.glShader),c.glShader=null)}if(!i.getProgramParameter(e.glProgram,i.LINK_STATUS))return console.error("Failed to link shader '"+e.name+"'."),void console.error(i.getProgramInfoLog(e.glProgram));U("Shader '"+e.name+"' compilation succeeded.");var _=i.getProgramParameter(e.glProgram,i.ACTIVE_ATTRIBUTES);e.glInputs=new Array(_);for(var f=0;f<_;++f){var d=i.getActiveAttrib(e.glProgram,f);if(d){var p,m=d.name.indexOf("[");p=-1!==m?d.name.substr(0,m):d.name;var g=i.getAttribLocation(e.glProgram,p),y=i5(d.type,i),S=n5(d.type,i);e.glInputs[f]={name:p,type:y,stride:S,count:d.size,size:S*d.size,glType:d.type,glLoc:g}}}var A,T,E,b,x=i.getProgramParameter(e.glProgram,i.ACTIVE_UNIFORM_BLOCKS);if(x){e.glBlocks=new Array(x);for(var C=0;C<x;++C){var R=(A=i.getActiveUniformBlockName(e.glProgram,C)).indexOf("[");-1!==R&&(A=A.substr(0,R)),b=null;for(var w=0;w<e.blocks.length;w++)if(e.blocks[w].name===A){b=e.blocks[w];break}if(b){T=C,E=i.getActiveUniformBlockParameter(e.glProgram,T,i.UNIFORM_BLOCK_DATA_SIZE);var I=o?b.flattened:b.binding+(t.bindingMappings.blockOffsets[b.set]||0);i.uniformBlockBinding(e.glProgram,T,I),e.glBlocks[C]={set:b.set,binding:b.binding,idx:T,name:A,size:E,glBinding:I}}else G("Block '"+A+"' does not bound")}}for(var B=0;B<e.subpassInputs.length;++B){var D=e.subpassInputs[B];e.samplerTextures.push(new kc(D.set,D.binding,D.name,Rl.SAMPLER2D,D.count))}if(e.samplerTextures.length>0){e.glSamplerTextures=new Array(e.samplerTextures.length);for(var P=0;P<e.samplerTextures.length;++P){var O=e.samplerTextures[P];e.glSamplerTextures[P]={set:O.set,binding:O.binding,name:O.name,type:O.type,count:O.count,units:[],glUnits:null,glType:e5(O.type,i),glLoc:null}}}var M=[],N=[],L=t.stateCache.texUnitCacheMap;if(o)for(var F=0;F<e.samplerTextures.length;++F){var k=e.samplerTextures[F],V=i.getUniformLocation(e.glProgram,k.name);V&&-1!==V.id&&(M.push(e.glSamplerTextures[F]),N.push(V)),void 0===L[k.name]&&(L[k.name]=k.flattened%t.capabilities.maxTextureUnits)}else{for(var z=0,H=0;H<e.blocks.length;++H)e.blocks[H].set===t.bindingMappings.flexibleSet&&z++;for(var W=0,X=0;X<e.samplerTextures.length;++X){var j=e.samplerTextures[X],Y=i.getUniformLocation(e.glProgram,j.name);if(Y&&-1!==Y.id&&(M.push(e.glSamplerTextures[X]),N.push(Y)),void 0===L[j.name]){var q=j.binding+t.bindingMappings.samplerTextureOffsets[j.set]+W;j.set===t.bindingMappings.flexibleSet&&(q-=z),L[j.name]=q%t.capabilities.maxTextureUnits,W+=j.count-1}}}if(M.length){for(var K=[],J=0;J<M.length;++J){var Q=M[J],Z=L[Q.name];if(void 0!==Z){Q.glLoc=N[J];for(var $=0;$<Q.count;++$){for(;K[Z];)Z=(Z+1)%t.capabilities.maxTextureUnits;Q.units.push(Z),K[Z]=!0}}}for(var tt=0,et=0;et<M.length;++et){var it=M[et];if(!it.glLoc){for(it.glLoc=N[et];K[tt];)tt++;for(var nt=0;nt<it.count;++nt){for(;K[tt];)tt=(tt+1)%t.capabilities.maxTextureUnits;void 0===L[it.name]&&(L[it.name]=tt),it.units.push(tt),K[tt]=!0}}}t.stateCache.glProgram!==e.glProgram&&i.useProgram(e.glProgram);for(var rt=0;rt<M.length;rt++){var st=M[rt];st.glUnits=new Int32Array(st.units),i.uniform1iv(st.glLoc,st.glUnits)}t.stateCache.glProgram!==e.glProgram&&i.useProgram(t.stateCache.glProgram)}e.glSamplerTextures=M}}(Q3.instance,this._gpuShader),this._gpuShader}}]),e}(q_),q5=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 Ec,this.scissorRect=new mc(0,0,0,0),this.rs=new G_,this.dss=new V_,this.bs=new z_,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}(),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)._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=S_(this._info.width)&&S_(this._info.height),this._size=T_(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&&(v5(Q3.instance,this._gpuTexture),Q3.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&&(S5(Q3.instance,this._gpuTexture),Q3.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=T_(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 Pl.TEX2D:e.glTarget=i.TEXTURE_2D;var o=Math.max(n,r);if(o>t.capabilities.maxTextureSize&&J(9100,o,t.capabilities.maxTextureSize),e.samples===Ll.ONE){var h=t.stateCache.glTexUnits[t.stateCache.texUnit];if(h.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_2D,e.glTexture),h.glTexture=e.glTexture),m_[e.format].isCompressed)for(var u=0;u<e.mipLevel;++u){var l=A_(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 S5(t,e),v5(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 Pl.TEX2D_ARRAY:e.glTarget=i.TEXTURE_2D_ARRAY;var _=Math.max(n,r);if(_>t.capabilities.maxTextureSize&&J(9100,_,t.capabilities.maxTextureSize),a>t.capabilities.maxArrayTextureLayers&&J(9100,a,t.capabilities.maxArrayTextureLayers),e.glTexture=i.createTexture(),e.size>0){var f=t.stateCache.glTexUnits[t.stateCache.texUnit];if(f.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_2D_ARRAY,e.glTexture),f.glTexture=e.glTexture),m_[e.format].isCompressed)for(var d=0;d<e.mipLevel;++d){var p=A_(e.format,n,r,a),m=new Uint8Array(p);i.compressedTexImage3D(i.TEXTURE_2D_ARRAY,d,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 Pl.TEX3D:e.glTarget=i.TEXTURE_3D;var g=Math.max(Math.max(n,r),s);if(g>t.capabilities.max3DTextureSize&&J(9100,g,t.capabilities.max3DTextureSize),e.glTexture=i.createTexture(),e.size>0){var y=t.stateCache.glTexUnits[t.stateCache.texUnit];if(y.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_3D,e.glTexture),y.glTexture=e.glTexture),m_[e.format].isCompressed)for(var v=0;v<e.mipLevel;++v){var S=A_(e.format,n,r,s),A=new Uint8Array(S);i.compressedTexImage3D(i.TEXTURE_3D,v,e.glInternalFmt,n,r,s,0,A),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 Pl.CUBE:e.type=Pl.CUBE,e.glTarget=i.TEXTURE_CUBE_MAP;var T=Math.max(n,r);T>t.capabilities.maxCubeMapTextureSize&&J(9100,T,t.capabilities.maxTextureSize);var E=t.stateCache.glTexUnits[t.stateCache.texUnit];if(E.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_CUBE_MAP,e.glTexture),E.glTexture=e.glTexture),m_[e.format].isCompressed)for(var b=0;b<6;++b){n=e.width,r=e.height;for(var x=0;x<e.mipLevel;++x){var C=A_(e.format,n,r,1),R=new Uint8Array(C);i.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+b,x,e.glInternalFmt,n,r,0,R),n=Math.max(1,n>>1),r=Math.max(1,r>>1)}}else S5(t,e),v5(t,e);break;default:console.error("Unsupported TextureType, create texture failed."),e.type=Pl.TEX2D,e.glTarget=i.TEXTURE_2D}}}(Q3.instance,this._gpuTexture),Q3.instance.memoryStatus.textureSize-=n,Q3.instance.memoryStatus.textureSize+=this._size))}},i.initAsSwapchainTexture=function(t){var e=new Oc;e.format=t.format,e.usage=m_[t.format].hasDepth?Ol.DEPTH_STENCIL_ATTACHMENT:Ol.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}(K_),J5="webglcontextlost";function Q5(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 Z5(t){var e={EXT_texture_filter_anisotropic:Q5(t,"EXT_texture_filter_anisotropic"),EXT_color_buffer_half_float:Q5(t,"EXT_color_buffer_half_float"),EXT_color_buffer_float:Q5(t,"EXT_color_buffer_float"),WEBGL_compressed_texture_etc1:Q5(t,"WEBGL_compressed_texture_etc1"),WEBGL_compressed_texture_etc:Q5(t,"WEBGL_compressed_texture_etc"),WEBGL_compressed_texture_pvrtc:Q5(t,"WEBGL_compressed_texture_pvrtc"),WEBGL_compressed_texture_astc:Q5(t,"WEBGL_compressed_texture_astc"),WEBGL_compressed_texture_s3tc:Q5(t,"WEBGL_compressed_texture_s3tc"),WEBGL_compressed_texture_s3tc_srgb:Q5(t,"WEBGL_compressed_texture_s3tc_srgb"),WEBGL_debug_shaders:Q5(t,"WEBGL_debug_shaders"),WEBGL_lose_context:Q5(t,"WEBGL_lose_context"),WEBGL_debug_renderer_info:Q5(t,"WEBGL_debug_renderer_info"),OES_texture_half_float_linear:Q5(t,"OES_texture_half_float_linear"),OES_texture_float_linear:Q5(t,"OES_texture_float_linear"),WEBGL_multi_draw:null,useVAO:!0};return Gu.os!==Nu.ANDROID&&Gu.os!==Nu.IOS&&(e.WEBGL_multi_draw=Q5(t,"WEBGL_multi_draw")),e}var $5=function(t){function e(){for(var e,i=arguments.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 q5,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(J5,this._onWebGLContextLost);var e=Q3.instance.gl;this.stateCache.initialize(Q3.instance.capabilities.maxTextureUnits,Q3.instance.capabilities.maxUniformBufferBindings,Q3.instance.capabilities.maxVertexAttributes),this._extensions=Z5(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=xl.RGBA8,n=xl.DEPTH_STENCIL,r=e.getParameter(e.DEPTH_BITS),s=e.getParameter(e.STENCIL_BITS);r&&s?n=xl.DEPTH_STENCIL:r&&(n=xl.DEPTH),this._colorTexture=new K5,this._colorTexture.initAsSwapchainTexture({swapchain:this,format:i,width:t.width,height:t.height}),this._depthStencilTexture=new K5,this._depthStencilTexture.initAsSwapchainTexture({swapchain:this,format:n,width:t.width,height:t.height}),this.nullTex2D=Q3.instance.createTexture(new Oc(Pl.TEX2D,Ol.SAMPLED,xl.RGBA8,2,2,Ml.NONE)),this.nullTexCube=Q3.instance.createTexture(new Oc(Pl.CUBE,Ol.SAMPLED,xl.RGBA8,2,2,Ml.NONE,6));var a=new Tc;a.texExtent.width=2,a.texExtent.height=2;var o=new Uint8Array(this.nullTex2D.size);o.fill(0),Q3.instance.copyBuffersToTexture([o],this.nullTex2D,[a]),a.texSubres.layerCount=6,Q3.instance.copyBuffersToTexture([o,o,o,o,o,o],this.nullTexCube,[a]),this._blitManager=new P5},i.destroy=function(){this._canvas&&this._webGL2ContextLostHandler&&(this._canvas.removeEventListener(J5,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||(U("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),k(t)},n(e,[{key:"extensions",get:function(){return this._extensions}},{key:"blitManager",get:function(){return this._blitManager}}]),e}(O_),t4=t("er",function(t){function e(){for(var e,i=arguments.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(xl.COUNT),e}s(e,t);var i=e.prototype;return i.initialize=function(t){Q3.setInstance(this),this._gfxAPI=Tl.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:be.ENABLE_TRANSPARENT_CANVAS,antialias:be.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:be.ENABLE_TRANSPARENT_CANVAS,antialias:be.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}(D_.canvas);if(!l)return console.error("This device does not support WebGL2."),!1;if(this._queue=this.createQueue(new u_(rc.GRAPHICS)),this._cmdBuff=this.createCommandBuffer(new h_(this._queue)),this._caps.maxVertexAttributes=l.getParameter(l.MAX_VERTEX_ATTRIBS),this._caps.maxVertexUniformVectors=l.getParameter(l.MAX_VERTEX_UNIFORM_VECTORS),Gu.os===Nu.IOS){var c=this._caps.maxVertexUniformVectors;ul.browserType===Pu.WECHAT?this._caps.maxVertexUniformVectors=c<256?c:256:ul.browserType===Pu.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(),d="";if(_)for(var p,m=f(_);!(p=m()).done;)d+=p.value+" ";var g=Z5(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 y=l.getParameter(l.VERSION);this._features.fill(!1),this.initFormatFeatures(g),this._features[bl.ELEMENT_INDEX_UINT]=!0,this._features[bl.INSTANCED_ARRAYS]=!0,this._features[bl.MULTIPLE_RENDER_TARGETS]=!0,this._features[bl.BLEND_MINMAX]=!0;var v="";return this.getFormatFeatures(xl.ETC_RGB8)&&(v+="etc1 "),this.getFormatFeatures(xl.ETC2_RGB8)&&(v+="etc2 "),this.getFormatFeatures(xl.BC1)&&(v+="dxt "),this.getFormatFeatures(xl.PVRTC_RGB2)&&(v+="pvrtc "),this.getFormatFeatures(xl.ASTC_RGBA_4X4)&&(v+="astc "),U("WebGL2 device initialized."),U("RENDERER: "+this._renderer),U("VENDOR: "+this._vendor),U("VERSION: "+y),U("COMPRESSED_FORMAT: "+v),U("EXTENSIONS: "+d),!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(Nl.NONE),this._textureExclusive.fill(!0);var e=Nl.RENDER_TARGET|Nl.SAMPLED_TEXTURE|Nl.STORAGE_TEXTURE|Nl.LINEAR_FILTER|Nl.VERTEX_ATTRIBUTE;this._formatFeatures[xl.R8]=e,this._formatFeatures[xl.RG8]=e,this._formatFeatures[xl.RGB8]=e,this._formatFeatures[xl.RGBA8]=e,e=Nl.RENDER_TARGET|Nl.SAMPLED_TEXTURE|Nl.STORAGE_TEXTURE|Nl.LINEAR_FILTER,this._formatFeatures[xl.R8SN]=e,this._formatFeatures[xl.RG8SN]=e,this._formatFeatures[xl.RGB8SN]=e,this._formatFeatures[xl.RGBA8SN]=e,this._formatFeatures[xl.R5G6B5]=e,this._formatFeatures[xl.RGBA4]=e,this._formatFeatures[xl.RGB5A1]=e,this._formatFeatures[xl.RGB10A2]=e,this._formatFeatures[xl.SRGB8]=e,this._formatFeatures[xl.SRGB8_A8]=e,this._formatFeatures[xl.R11G11B10F]=e,this._formatFeatures[xl.RGB9E5]=e,this._formatFeatures[xl.DEPTH]=e,this._formatFeatures[xl.DEPTH_STENCIL]=e,this._formatFeatures[xl.RGB10A2UI]=Nl.RENDER_TARGET|Nl.STORAGE_TEXTURE|Nl.SAMPLED_TEXTURE|Nl.LINEAR_FILTER,e=Nl.RENDER_TARGET|Nl.SAMPLED_TEXTURE|Nl.STORAGE_TEXTURE|Nl.VERTEX_ATTRIBUTE,this._formatFeatures[xl.R16F]=e,this._formatFeatures[xl.RG16F]=e,this._formatFeatures[xl.RGB16F]=e,this._formatFeatures[xl.RGBA16F]=e,e=Nl.STORAGE_TEXTURE|Nl.SAMPLED_TEXTURE|Nl.VERTEX_ATTRIBUTE,this._formatFeatures[xl.R32F]=e,this._formatFeatures[xl.RG32F]=e,this._formatFeatures[xl.RGB32F]=e,this._formatFeatures[xl.RGBA32F]=e,this._formatFeatures[xl.RGB10A2UI]=Nl.RENDER_TARGET|Nl.STORAGE_TEXTURE|Nl.SAMPLED_TEXTURE|Nl.LINEAR_FILTER,e=Nl.RENDER_TARGET|Nl.STORAGE_TEXTURE|Nl.SAMPLED_TEXTURE|Nl.LINEAR_FILTER|Nl.VERTEX_ATTRIBUTE,this._formatFeatures[xl.R8I]=e,this._formatFeatures[xl.R8UI]=e,this._formatFeatures[xl.R16I]=e,this._formatFeatures[xl.R16UI]=e,this._formatFeatures[xl.R32I]=e,this._formatFeatures[xl.R32UI]=e,this._formatFeatures[xl.RG8I]=e,this._formatFeatures[xl.RG8UI]=e,this._formatFeatures[xl.RG16I]=e,this._formatFeatures[xl.RG16UI]=e,this._formatFeatures[xl.RG32I]=e,this._formatFeatures[xl.RG32UI]=e,this._formatFeatures[xl.RGB8I]=e,this._formatFeatures[xl.RGB8UI]=e,this._formatFeatures[xl.RGB16I]=e,this._formatFeatures[xl.RGB16UI]=e,this._formatFeatures[xl.RGB32I]=e,this._formatFeatures[xl.RGB32UI]=e,this._formatFeatures[xl.RGBA8I]=e,this._formatFeatures[xl.RGBA8UI]=e,this._formatFeatures[xl.RGBA16I]=e,this._formatFeatures[xl.RGBA16UI]=e,this._formatFeatures[xl.RGBA32I]=e,this._formatFeatures[xl.RGBA32UI]=e,this._textureExclusive[xl.R8]=!1,this._textureExclusive[xl.RG8]=!1,this._textureExclusive[xl.RGB8]=!1,this._textureExclusive[xl.R5G6B5]=!1,this._textureExclusive[xl.RGBA4]=!1,this._textureExclusive[xl.RGB5A1]=!1,this._textureExclusive[xl.RGBA8]=!1,this._textureExclusive[xl.RGB10A2]=!1,this._textureExclusive[xl.RGB10A2UI]=!1,this._textureExclusive[xl.SRGB8_A8]=!1,this._textureExclusive[xl.R8I]=!1,this._textureExclusive[xl.R8UI]=!1,this._textureExclusive[xl.R16I]=!1,this._textureExclusive[xl.R16UI]=!1,this._textureExclusive[xl.R32I]=!1,this._textureExclusive[xl.R32UI]=!1,this._textureExclusive[xl.RG8I]=!1,this._textureExclusive[xl.RG8UI]=!1,this._textureExclusive[xl.RG16I]=!1,this._textureExclusive[xl.RG16UI]=!1,this._textureExclusive[xl.RG32I]=!1,this._textureExclusive[xl.RG32UI]=!1,this._textureExclusive[xl.RGBA8I]=!1,this._textureExclusive[xl.RGBA8UI]=!1,this._textureExclusive[xl.RGBA16I]=!1,this._textureExclusive[xl.RGBA16UI]=!1,this._textureExclusive[xl.RGBA32I]=!1,this._textureExclusive[xl.RGBA32UI]=!1,this._textureExclusive[xl.DEPTH]=!1,this._textureExclusive[xl.DEPTH_STENCIL]=!1,t.EXT_color_buffer_float&&(this._formatFeatures[xl.R32F]|=Nl.RENDER_TARGET,this._formatFeatures[xl.RG32F]|=Nl.RENDER_TARGET,this._formatFeatures[xl.RGBA32F]|=Nl.RENDER_TARGET,this._textureExclusive[xl.R32F]=!1,this._textureExclusive[xl.RG32F]=!1,this._textureExclusive[xl.RGBA32F]=!1),t.EXT_color_buffer_half_float&&(this._textureExclusive[xl.R16F]=!1,this._textureExclusive[xl.RG16F]=!1,this._textureExclusive[xl.RGBA16F]=!1),t.OES_texture_float_linear&&(this._formatFeatures[xl.RGB32F]|=Nl.LINEAR_FILTER,this._formatFeatures[xl.RGBA32F]|=Nl.LINEAR_FILTER,this._formatFeatures[xl.R32F]|=Nl.LINEAR_FILTER,this._formatFeatures[xl.RG32F]|=Nl.LINEAR_FILTER),t.OES_texture_half_float_linear&&(this._formatFeatures[xl.RGB16F]|=Nl.LINEAR_FILTER,this._formatFeatures[xl.RGBA16F]|=Nl.LINEAR_FILTER,this._formatFeatures[xl.R16F]|=Nl.LINEAR_FILTER,this._formatFeatures[xl.RG16F]|=Nl.LINEAR_FILTER);var i=Nl.SAMPLED_TEXTURE|Nl.LINEAR_FILTER;t.WEBGL_compressed_texture_etc1&&(this._formatFeatures[xl.ETC_RGB8]=i),t.WEBGL_compressed_texture_etc&&(this._formatFeatures[xl.ETC2_RGB8]=i,this._formatFeatures[xl.ETC2_RGBA8]=i,this._formatFeatures[xl.ETC2_SRGB8]=i,this._formatFeatures[xl.ETC2_SRGB8_A8]=i,this._formatFeatures[xl.ETC2_RGB8_A1]=i,this._formatFeatures[xl.ETC2_SRGB8_A1]=i),t.WEBGL_compressed_texture_s3tc&&(this._formatFeatures[xl.BC1]=i,this._formatFeatures[xl.BC1_ALPHA]=i,this._formatFeatures[xl.BC1_SRGB]=i,this._formatFeatures[xl.BC1_SRGB_ALPHA]=i,this._formatFeatures[xl.BC2]=i,this._formatFeatures[xl.BC2_SRGB]=i,this._formatFeatures[xl.BC3]=i,this._formatFeatures[xl.BC3_SRGB]=i),t.WEBGL_compressed_texture_pvrtc&&(this._formatFeatures[xl.PVRTC_RGB2]=i,this._formatFeatures[xl.PVRTC_RGBA2]=i,this._formatFeatures[xl.PVRTC_RGB4]=i,this._formatFeatures[xl.PVRTC_RGBA4]=i),t.WEBGL_compressed_texture_astc&&(this._formatFeatures[xl.ASTC_RGBA_4X4]=i,this._formatFeatures[xl.ASTC_RGBA_5X4]=i,this._formatFeatures[xl.ASTC_RGBA_5X5]=i,this._formatFeatures[xl.ASTC_RGBA_6X5]=i,this._formatFeatures[xl.ASTC_RGBA_6X6]=i,this._formatFeatures[xl.ASTC_RGBA_8X5]=i,this._formatFeatures[xl.ASTC_RGBA_8X6]=i,this._formatFeatures[xl.ASTC_RGBA_8X8]=i,this._formatFeatures[xl.ASTC_RGBA_10X5]=i,this._formatFeatures[xl.ASTC_RGBA_10X6]=i,this._formatFeatures[xl.ASTC_RGBA_10X8]=i,this._formatFeatures[xl.ASTC_RGBA_10X10]=i,this._formatFeatures[xl.ASTC_RGBA_12X10]=i,this._formatFeatures[xl.ASTC_RGBA_12X12]=i,this._formatFeatures[xl.ASTC_SRGBA_4X4]=i,this._formatFeatures[xl.ASTC_SRGBA_5X4]=i,this._formatFeatures[xl.ASTC_SRGBA_5X5]=i,this._formatFeatures[xl.ASTC_SRGBA_6X5]=i,this._formatFeatures[xl.ASTC_SRGBA_6X6]=i,this._formatFeatures[xl.ASTC_SRGBA_8X5]=i,this._formatFeatures[xl.ASTC_SRGBA_8X6]=i,this._formatFeatures[xl.ASTC_SRGBA_8X8]=i,this._formatFeatures[xl.ASTC_SRGBA_10X5]=i,this._formatFeatures[xl.ASTC_SRGBA_10X6]=i,this._formatFeatures[xl.ASTC_SRGBA_10X8]=i,this._formatFeatures[xl.ASTC_SRGBA_10X10]=i,this._formatFeatures[xl.ASTC_SRGBA_12X10]=i,this._formatFeatures[xl.ASTC_SRGBA_12X12]=i)},i.createCommandBuffer=function(t){var e=new(t.type===ac.PRIMARY?H5:L5);return e.initialize(t),e},i.createSwapchain=function(t){var e=new $5;return this._swapchain=e,e.initialize(t),e},i.createBuffer=function(t){var e=new O5;return e.initialize(t),e},i.createTexture=function(t){var e=new K5;return e.initialize(t),e},i.createDescriptorSet=function(t){var e=new J3;return e.initialize(t),e},i.createShader=function(t){var e=new Y5;return e.initialize(t),e},i.createInputAssembler=function(t){var e=new k5;return e.initialize(t),e},i.createRenderPass=function(t){var e=new X5;return e.initialize(t),e},i.createFramebuffer=function(t){var e=new F5;return e.initialize(t),e},i.createDescriptorSetLayout=function(t){var e=new G5;return e.initialize(t),e},i.createPipelineLayout=function(t){var e=new V5;return e.initialize(t),e},i.createPipelineState=function(t){var e=new z5;return e.initialize(t),e},i.createQueue=function(t){var e=new W5;return e.initialize(t),e},i.getSampler=function(t){var e=Y_.computeHash(t);return this._samplers.has(e)||this._samplers.set(e,new j5(t,e)),this._samplers.get(e)},i.getSwapchains=function(){return[this._swapchain]},i.getGeneralBarrier=function(t){var e=J_.computeHash(t);return this._generalBarrierss.has(e)||this._generalBarrierss.set(e,new J_(t,e)),this._generalBarrierss.get(e)},i.getTextureBarrier=function(t){var e=Q_.computeHash(t);return this._textureBarriers.has(e)||this._textureBarriers.set(e,new Q_(t,e)),this._textureBarriers.get(e)},i.getBufferBarrier=function(t){var e=Z_.computeHash(t);return this._bufferBarriers.has(e)||this._bufferBarriers.set(e,new Z_(t,e)),this._bufferBarriers.get(e)},i.copyBuffersToTexture=function(t,e,i){I5(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:console.error("Unsupported GL texture type, copy texture to buffers failed.")}r.bindFramebuffer(r.FRAMEBUFFER,null),s.glFramebuffer=null,r.deleteFramebuffer(a)}(this,t.gpuTexture,e,i)},i.copyTexImagesToTexture=function(t,e,i){!function(t,e,i,n){var r=t.gl,s=t.stateCache.glTexUnits[t.stateCache.texUnit];s.glTexture!==i.glTexture&&(r.bindTexture(i.glTarget,i.glTexture),s.glTexture=i.glTexture);var a=0,o=0;switch(i.glTarget){case r.TEXTURE_2D:if(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:console.error("Unsupported GL texture type, copy buffer to texture failed.")}i.flags&Ml.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}(D_));function e4(t,e,i,n){var r=(n.x-i.x)*(t.y-i.y)-(n.y-i.y)*(t.x-i.x),s=(e.x-t.x)*(t.y-i.y)-(e.y-t.y)*(t.x-i.x),a=(n.y-i.y)*(e.x-t.x)-(n.x-i.x)*(e.y-t.y);if(0!==a){var o=r/a,h=s/a;if(o>=0&&o<=1&&h>=0&&h<=1)return!0}return!1}v.WebGL2Device=t4;var i4=new yn,n4=new yn,r4=new yn,s4=new yn;function a4(t,e,i){for(var n=i.length,r=0;r<n;++r)if(e4(t,e,i[r],i[(r+1)%n]))return!0;return!1}function o4(t,e){for(var i=!1,n=t.x,r=t.y,s=e.length,a=0,o=s-1;a<s;o=a++){var h=e[a].x,u=e[a].y,l=e[o].x,c=e[o].y;u>r!=c>r&&n<(l-h)*(r-u)/(c-u)+h&&(i=!i)}return i}function h4(t,e,i,n){var r,s=i.x-e.x,a=i.y-e.y,o=s*s+a*a,h=((t.x-e.x)*s+(t.y-e.y)*a)/o;return r=n?o?h<0?e:h>1?i:i4.set(e.x+h*s,e.y+h*a):e:i4.set(e.x+h*s,e.y+h*a),s=t.x-r.x,a=t.y-r.y,Math.sqrt(s*s+a*a)}var u4=t("es",(function(){}));u4.lineLine=e4,u4.lineRect=function(t,e,i){var n=i4.set(i.x,i.y),r=n4.set(i.x,i.yMax),s=r4.set(i.xMax,i.yMax),a=s4.set(i.xMax,i.y);return!!(e4(t,e,n,r)||e4(t,e,r,s)||e4(t,e,s,a)||e4(t,e,a,n))},u4.linePolygon=a4,u4.rectRect=function(t,e){var i=t.x,n=t.y,r=t.x+t.width,s=t.y+t.height,a=e.x,o=e.y,h=e.x+e.width,u=e.y+e.height;return i<=h&&r>=a&&n<=u&&s>=o},u4.rectPolygon=function(t,e){var i=i4.set(t.x,t.y),n=n4.set(t.x,t.yMax),r=r4.set(t.xMax,t.yMax),s=s4.set(t.xMax,t.y);if(a4(i,n,e))return!0;if(a4(n,r,e))return!0;if(a4(r,s,e))return!0;if(a4(s,i,e))return!0;for(var a=0,o=e.length;a<o;++a)if(t.contains(e[a]))return!0;return!!(o4(i,e)||o4(n,e)||o4(r,e)||o4(s,e))},u4.rectCircle=function(t,e,i){var n=e.x,r=e.y,s=t.x,a=t.y,o=t.width,h=t.height,u=n,l=r;n<s?u=s:n>s+o&&(u=s+o),r<a?l=a:r>a+h&&(l=a+h);var c=n-u,_=r-l;return Math.sqrt(c*c+_*_)<=i},u4.polygonPolygon=function(t,e){var i,n;for(i=0,n=t.length;i<n;++i)if(a4(t[i],t[(i+1)%n],e))return!0;for(i=0,n=e.length;i<n;++i)if(o4(e[i],t))return!0;for(i=0,n=t.length;i<n;++i)if(o4(t[i],e))return!0;return!1},u4.circleCircle=function(t,e,i,n){return yn.distance(t,i)<e+n},u4.polygonCircle=function(t,e,i){var n=e;if(o4(n,t))return!0;for(var r=0,s=t.length;r<s;r++)if(h4(n,0===r?t[t.length-1]:t[r-1],t[r],!0)<i)return!0;return!1},u4.pointInPolygon=o4,u4.pointLineDistance=h4;var l4,c4,_4,f4,d4,p4,m4,g4,y4,v4,S4,A4,T4,E4,b4,x4,C4,R4,w4,I4,B4,D4,P4,O4,M4,N4,L4,F4,k4,G4,V4,U4,z4,H4,W4=t("et",me({UNIFORM:0,ADAPTIVE:1})),X4=t("eu",function(){function t(){}return t.generate=function(t){switch(t.method){case W4.UNIFORM:return this.doGenerateUniform(t);case W4.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 Yi(0,0,0),n=new Yi((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 Yi(i))}}return e},t.doGenerateAdaptive=function(t){return this.doGenerateUniform(t)},t}()),j4=Is,Y4=ks,q4=new en,K4=new Yi(0,0,0),J4=new Yi(0,0,0),Q4=new Yi(0,0,0),Z4=new Yi(0,0,0),$4=new Yi(0,0,0),t8=new Yi(0,0,0),e8=new Yi(0,0,0),i8=t("ev",j4("cc.Vertex")((c4=function(t){this.position=_4&&_4(),this.normal=f4&&f4(),this.coefficients=d4&&d4(),this.position.set(t)},_4=Ss(c4.prototype,"position",[Y4],(function(){return new Yi(0,0,0)})),f4=Ss(c4.prototype,"normal",[Y4],(function(){return new Yi(0,0,0)})),d4=Ss(c4.prototype,"coefficients",[Y4],(function(){return[]})),l4=c4))||l4),n8=(p4=function(){function t(t,e,i,n){this.tetrahedron=m4&&m4(),this.index=g4&&g4(),this.vertex0=y4&&y4(),this.vertex1=v4&&v4(),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}(),m4=Ss(p4.prototype,"tetrahedron",[Y4],(function(){return-1})),g4=Ss(p4.prototype,"index",[Y4],(function(){return-1})),y4=Ss(p4.prototype,"vertex0",[Y4],(function(){return-1})),v4=Ss(p4.prototype,"vertex1",[Y4],(function(){return-1})),p4),r8=(S4=function(){function t(t,e,i,n,r,s){this.invalid=A4&&A4(),this.isOuterFace=T4&&T4(),this.tetrahedron=E4&&E4(),this.index=b4&&b4(),this.vertex0=x4&&x4(),this.vertex1=C4&&C4(),this.vertex2=R4&&R4(),this.vertex3=w4&&w4(),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}(),A4=Ss(S4.prototype,"invalid",[Y4],(function(){return!1})),T4=Ss(S4.prototype,"isOuterFace",[Y4],(function(){return!0})),E4=Ss(S4.prototype,"tetrahedron",[Y4],(function(){return-1})),b4=Ss(S4.prototype,"index",[Y4],(function(){return-1})),x4=Ss(S4.prototype,"vertex0",[Y4],(function(){return-1})),C4=Ss(S4.prototype,"vertex1",[Y4],(function(){return-1})),R4=Ss(S4.prototype,"vertex2",[Y4],(function(){return-1})),w4=Ss(S4.prototype,"vertex3",[Y4],(function(){return-1})),S4),s8=t("ew",j4("cc.CircumSphere")((B4=function(){function t(){this.center=D4&&D4(),this.radiusSquared=P4&&P4()}return t.prototype.init=function(t,e,i,n){q4.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),q4.invert(),q4.transpose(),K4.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))),Yi.transformMat3(this.center,K4,q4),this.radiusSquared=Yi.squaredDistance(t,this.center)},t}(),D4=Ss(B4.prototype,"center",[Y4],(function(){return new Yi(0,0,0)})),P4=Ss(B4.prototype,"radiusSquared",[Y4],(function(){return 0})),I4=B4))||I4),a8=t("ex",j4("cc.Tetrahedron")((M4=function(){function t(t,e,i,n,r){if(void 0===r&&(r=-1),this.invalid=N4&&N4(),this.vertex0=L4&&L4(),this.vertex1=F4&&F4(),this.vertex2=k4&&k4(),this.vertex3=G4&&G4(),this.neighbours=V4&&V4(),this.matrix=U4&&U4(),this.offset=z4&&z4(),this.sphere=H4&&H4(),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 Yi.squaredDistance(t,this.sphere.center)<this.sphere.radiusSquared-Ai},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}(),N4=Ss(M4.prototype,"invalid",[Y4],(function(){return!1})),L4=Ss(M4.prototype,"vertex0",[Y4],(function(){return-1})),F4=Ss(M4.prototype,"vertex1",[Y4],(function(){return-1})),k4=Ss(M4.prototype,"vertex2",[Y4],(function(){return-1})),G4=Ss(M4.prototype,"vertex3",[Y4],(function(){return-1})),V4=Ss(M4.prototype,"neighbours",[Y4],(function(){return[-1,-1,-1,-1]})),U4=Ss(M4.prototype,"matrix",[Y4],(function(){return new en})),z4=Ss(M4.prototype,"offset",[Y4],(function(){return new Yi(0,0,0)})),H4=Ss(M4.prototype,"sphere",[Y4],(function(){return new s8})),O4=M4))||O4),o8=t("ey",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 Yi(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),e=new Yi(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 Yi(0,0,0);Yi.add(r,t,e),Yi.multiplyScalar(r,r,.5);var s=new Yi(0,0,0);Yi.subtract(s,e,t);var a=10*Math.max(s.x,s.y,s.z),o=new Yi(r.x,r.y+a,r.z),h=new Yi(r.x-a,r.y-a,r.z-a),u=new Yi(r.x-a,r.y-a,r.z+a),l=new Yi(r.x+a,r.y-a,r.z),c=this._probes.length;return this._probes.push(new i8(o)),this._probes.push(new i8(h)),this._probes.push(new i8(u)),this._probes.push(new i8(l)),this._tetrahedrons.push(new a8(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 r8(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 n8(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 a8(this,h.vertex0,h.vertex1,h.vertex2,t))}},e.reorder=function(t){this._tetrahedrons.sort((function(e,i){return Yi.squaredDistance(e.sphere.center,t)-Yi.squaredDistance(i.sphere.center,t)}))},e.computeAdjacency=function(){for(var t=new Yi(0,0,0),e=new Yi(0,0,0),i=new Yi(0,0,0),n=new Yi(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],f=this._probes[this._triangles[h].vertex3];Yi.subtract(e,c.position,l.position),Yi.subtract(i,_.position,l.position),Yi.cross(t,e,i),Yi.subtract(n,f.position,l.position);var d=Yi.dot(t,n);d>0&&Yi.negate(t,t),Yi.add(l.normal,l.normal,t),Yi.add(c.normal,c.normal,t),Yi.add(_.normal,_.normal,t);var p=this._triangles[h].vertex0,m=d>0?this._triangles[h].vertex2:this._triangles[h].vertex1,g=d>0?this._triangles[h].vertex1:this._triangles[h].vertex2,y=new a8(this,p,m,g);y.neighbours[3]=this._triangles[h].tetrahedron,this._tetrahedrons[this._triangles[h].tetrahedron].neighbours[this._triangles[h].index]=this._tetrahedrons.length,this._tetrahedrons.push(y)}}for(var v=0,S=r;S<this._tetrahedrons.length;S++){var A=this._tetrahedrons[S];this.addEdge(v,S,0,A.vertex1,A.vertex2),this.addEdge(v+1,S,1,A.vertex2,A.vertex0),this.addEdge(v+2,S,2,A.vertex0,A.vertex1),v+=3}for(var T=0;T<v;T++)for(var E=T+1;E<v;E++)this._edges[T].isSame(this._edges[E])&&(this._tetrahedrons[this._edges[T].tetrahedron].neighbours[this._edges[T].index]=this._edges[E].tetrahedron,this._tetrahedrons[this._edges[E].tetrahedron].neighbours[this._edges[E].index]=this._edges[T].tetrahedron);for(var b=0;b<this._probes.length;b++)this._probes[b].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,Yi.subtract(J4,i[0],i[2]),Yi.subtract(Q4,e[0],e[2]),Yi.subtract(Z4,i[1],i[2]),Yi.subtract($4,e[1],e[2]),t8.set(i[2]),Yi.negate(e8,e[2]);var n=[];n[0]=Q4.y*$4.z-Q4.z*$4.y,n[3]=-Q4.x*$4.z+Q4.z*$4.x,n[6]=Q4.x*$4.y-Q4.y*$4.x,n[9]=J4.x*$4.y*e8.z-J4.y*$4.x*e8.z+Q4.x*Z4.y*e8.z-Q4.y*Z4.x*e8.z+J4.z*$4.x*e8.y-J4.z*$4.y*e8.x+Q4.z*Z4.x*e8.y-Q4.z*Z4.y*e8.x-J4.x*$4.z*e8.y+J4.y*$4.z*e8.x-Q4.x*Z4.z*e8.y+Q4.y*Z4.z*e8.x,n[9]-=t8.x*n[0]+t8.y*n[3]+t8.z*n[6],n[1]=Q4.y*Z4.z+J4.y*$4.z-Q4.z*Z4.y-J4.z*$4.y,n[4]=-J4.x*$4.z-Q4.x*Z4.z+J4.z*$4.x+Q4.z*Z4.x,n[7]=J4.x*$4.y-J4.y*$4.x+Q4.x*Z4.y-Q4.y*Z4.x,n[10]=J4.x*Z4.y*e8.z-J4.y*Z4.x*e8.z-J4.x*Z4.z*e8.y+J4.y*Z4.z*e8.x+J4.z*Z4.x*e8.y-J4.z*Z4.y*e8.x,n[10]-=t8.x*n[1]+t8.y*n[4]+t8.z*n[7],n[2]=-J4.z*Z4.y+J4.y*Z4.z,n[5]=-J4.x*Z4.z+J4.z*Z4.x,n[8]=J4.x*Z4.y-J4.y*Z4.x,n[11]=0,n[11]-=t8.x*n[2]+t8.y*n[5]+t8.z*n[8];var r=Q4.x*$4.y*e8.z-Q4.y*$4.x*e8.z+Q4.z*$4.x*e8.y-Q4.z*$4.y*e8.x+Q4.y*$4.z*e8.x-Q4.x*$4.z*e8.y;if(Math.abs(r)>Ai)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}()),h8=t("ez",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 Yi(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}()),u8=t("eA",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 zi(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 zi(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 zi(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 zi(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 zi(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 zi(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 Yi(e[8].x*this.basisOverPI[8],e[8].y*this.basisOverPI[8],e[8].z*this.basisOverPI[8]),u=new Yi(0,0,0),l=new zi(t.x,t.y,t.z,1);u.x=zi.dot(i,l),u.y=zi.dot(n,l),u.z=zi.dot(r,l);var c=new zi(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+=zi.dot(s,c),u.y+=zi.dot(a,c),u.z+=zi.dot(o,c),Yi.scaleAndAdd(u,u,h,_),u},t.evaluate=function(t,e){for(var i=new Yi(0,0,0),n=e.length,r=0;r<n;r++){var s=e[r];Yi.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/(h8.uniformSpherePdf()*n),s=[],a=0;a<i;a++){for(var o=new Yi(0,0,0),h=0;h<n;h++)Yi.scaleAndAdd(o,o,e[h],this.evaluateBasis(a,t[h]));Yi.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 Yi(0,0,0);Yi.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);Yi.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}());u8.LMAX=2,u8.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)}],u8.basisOverPI=[.0897936,.155527,.155527,.155527,.347769,.347769,.301177,.347769,.173884],v.internal.SH=u8;var l8,c8,_8,f8,d8,p8,m8,g8=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}(),y8=new Yi(0,0,0),v8=new Yi(0,0,0),S8=new Yi(0,0,0),A8=new Yi(0,0,0),T8=new Yi(0,0,0),E8=new Yi(0,0,0),b8=new Yi(0,0,0),x8=new Yi(0,0,0),C8=new Yi(0,0,0),R8=new Yi(0,0,0),w8=new Yi(0,0,0),I8=new Yi(0,0,0),B8=new Yi(0,0,0),D8=new Yi(0,0,0),P8=new Yi(0,0,0),O8=t("eB",(l8=Is("cc.LightProbesData"),c8=ha([i8]),_8=ha([a8]),l8((d8=function(){function t(){this._probes=p8&&p8(),this._tetrahedrons=m8&&m8()}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=0;for(var e=t.length,i=0;i<e;i++)this._probes.push(new i8(t[i]))},e.updateTetrahedrons=function(){var t=new o8(this._probes);this._tetrahedrons=t.build()},e.getInterpolationSHCoefficients=function(t,e,i){if(!this.hasCoefficients())return!1;var n=u8.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 Yi(0,0,0),Yi.scaleAndAdd(i[u],i[u],s[u],e.x),Yi.scaleAndAdd(i[u],i[u],a[u],e.y),Yi.scaleAndAdd(i[u],i[u],o[u],e.z),Yi.scaleAndAdd(i[u],i[u],h[u],e.w);else for(var l=0;l<n;l++)i[l]=new Yi(0,0,0),Yi.scaleAndAdd(i[l],i[l],s[l],e.x),Yi.scaleAndAdd(i[l],i[l],a[l],e.y),Yi.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(Yi.subtract(y8,e,t),Yi.subtract(v8,i,t),Yi.cross(S8,y8,v8),S8.lengthSqr()<=Ai)return new Yi(0,0,0);var r=S8.clone();r.normalize();var s=1/r.dot(S8);Yi.subtract(A8,t,n),Yi.subtract(T8,e,n),Yi.subtract(E8,i,n),Yi.cross(b8,T8,E8);var a=r.dot(b8)*s;Yi.cross(x8,E8,A8);var o=r.dot(x8)*s;return new Yi(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 Yi(0,0,0);Yi.subtract(n,t,this._probes[e.vertex3].position),Yi.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;Yi.subtract(R8,s,r),Yi.subtract(w8,a,r),Yi.cross(C8,R8,w8),Yi.subtract(I8,e,r);var o=Yi.dot(I8,C8);if(o<0)n.set(0,0,0,-1);else{var h=new Yi(0,0,0);Yi.transformMat3(h,e,i.matrix),Yi.add(h,h,i.offset),o=-1===i.vertex3?g8.getCubicUniqueRoot(h.x,h.y,h.z):g8.getQuadraticUniqueRoot(h.x,h.y,h.z),Yi.scaleAndAdd(B8,r,this._probes[i.vertex0].normal,o),Yi.scaleAndAdd(D8,s,this._probes[i.vertex1].normal,o),Yi.scaleAndAdd(P8,a,this._probes[i.vertex2].normal,o);var u=t.getTriangleBarycentricCoord(B8,D8,P8,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}(),p8=Ss(d8.prototype,"_probes",[ks,c8],(function(){return[]})),m8=Ss(d8.prototype,"_tetrahedrons",[ks,_8],(function(){return[]})),f8=d8))||f8));v.internal.LightProbesData=O8;var M8,N8,L8,F8,k8,G8,V8,U8,z8,H8,W8,X8,j8,Y8,q8,K8=t("eC",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=K8,t("eD",(M8=Is("cc.LightProbeGroup"),N8=ha([Yi]),L8=ha(W4),F8=ha(je),k8=ha(je),G8=ha(je),M8(V8=Ps((U8=function(t){function e(){for(var e,i=arguments.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=z8&&z8(),e._method=H8&&H8(),e._minPos=W8&&W8(),e._maxPos=X8&&X8(),e._nProbesX=j8&&j8(),e._nProbesY=Y8&&Y8(),e._nProbesZ=q8&&q8(),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=X4.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(zp.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}(Vd),z8=Ss(U8.prototype,"_probes",[ks],(function(){return[]})),H8=Ss(U8.prototype,"_method",[ks],(function(){return W4.UNIFORM})),W8=Ss(U8.prototype,"_minPos",[ks],(function(){return new Yi(-5,-5,-5)})),X8=Ss(U8.prototype,"_maxPos",[ks],(function(){return new Yi(5,5,5)})),j8=Ss(U8.prototype,"_nProbesX",[ks],(function(){return 3})),Y8=Ss(U8.prototype,"_nProbesY",[ks],(function(){return 3})),q8=Ss(U8.prototype,"_nProbesZ",[ks],(function(){return 3})),p(U8.prototype,"probes",[N8],Object.getOwnPropertyDescriptor(U8.prototype,"probes"),U8.prototype),p(U8.prototype,"method",[L8],Object.getOwnPropertyDescriptor(U8.prototype,"method"),U8.prototype),p(U8.prototype,"nProbesX",[F8],Object.getOwnPropertyDescriptor(U8.prototype,"nProbesX"),U8.prototype),p(U8.prototype,"nProbesY",[k8],Object.getOwnPropertyDescriptor(U8.prototype,"nProbesY"),U8.prototype),p(U8.prototype,"nProbesZ",[G8],Object.getOwnPropertyDescriptor(U8.prototype,"nProbesZ"),U8.prototype),V8=U8))||V8)||V8));var J8,Q8,Z8,$8=me({GRAVITY:0,RADIUS:1}),t6=me({FREE:0,RELATIVE:1,GROUPED:2}),e6=new yn(0,0),i6=new yn,n6=new yn,r6=new yn,s6=new yn,a6=uF(sF),o6=function(){this.pos=new yn(0,0),this.startPos=new yn(0,0),this.color=new Zi(0,0,0,255),this.deltaColor={r:0,g:0,b:0,a:255},this.size=0,this.deltaSize=0,this.rotation=0,this.deltaRotation=0,this.timeToLive=0,this.drawPos=new yn(0,0),this.aspectRatio=1,this.dir=new yn(0,0),this.radialAccel=0,this.tangentialAccel=0,this.angle=0,this.degreesPerSecond=0,this.radius=0,this.deltaRadius=0},h6=new(function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.get=function(){return this._get()||new o6},e}(ne))((function(t){t.pos.set(e6),t.startPos.set(e6),t.color._val=4278190080,t.deltaColor.r=t.deltaColor.g=t.deltaColor.b=0,t.deltaColor.a=255,t.size=0,t.deltaSize=0,t.rotation=0,t.deltaRotation=0,t.timeToLive=0,t.drawPos.set(e6),t.aspectRatio=1,t.dir.set(e6),t.radialAccel=0,t.tangentialAccel=0,t.angle=0,t.degreesPerSecond=0,t.radius=0,t.deltaRadius=0}),1024),u6=function(){function t(t){this.particles=[],this.active=!1,this.uvFilled=0,this.finished=!1,this.readyToPlay=!0,this.elapsed=0,this.emitCounter=0,this._worldRotation=0,this.sys=t,this.particles=[],this.active=!1,this.readyToPlay=!0,this.finished=!1,this.elapsed=0,this.emitCounter=0,this.uvFilled=0,this._worldRotation=0}var e=t.prototype;return e.stop=function(){this.active=!1,this.readyToPlay=!1,this.elapsed=this.sys.duration,this.emitCounter=0},e.reset=function(){this.active=!0,this.readyToPlay=!0,this.elapsed=0,this.emitCounter=0,this.finished=!1;for(var t=this.particles,e=0;e<t.length;++e)h6.put(t[e]);t.length=0},e.emitParticle=function(t){var e=this.sys,i=h6.get();this.particles.push(i),i.timeToLive=e.life+e.lifeVar*(Math.random()-.5)*2;var n=i.timeToLive=Math.max(0,i.timeToLive);i.pos.x=e.sourcePos.x+e.posVar.x*(Math.random()-.5)*2,i.pos.y=e.sourcePos.y+e.posVar.y*(Math.random()-.5)*2;var r,s,a,o,h=e.startColor,u=e.startColorVar,l=e.endColor,c=e.endColorVar;i.color.r=r=Le(h.r+u.r*(Math.random()-.5)*2,0,255),i.color.g=s=Le(h.g+u.g*(Math.random()-.5)*2,0,255),i.color.b=a=Le(h.b+u.b*(Math.random()-.5)*2,0,255),i.color.a=o=Le(h.a+u.a*(Math.random()-.5)*2,0,255),i.deltaColor.r=(Le(l.r+c.r*(Math.random()-.5)*2,0,255)-r)/n,i.deltaColor.g=(Le(l.g+c.g*(Math.random()-.5)*2,0,255)-s)/n,i.deltaColor.b=(Le(l.b+c.b*(Math.random()-.5)*2,0,255)-a)/n,i.deltaColor.a=(Le(l.a+c.a*(Math.random()-.5)*2,0,255)-o)/n;var _=e.startSize+e.startSizeVar*(Math.random()-.5)*2;if(_=Math.max(0,_),i.size=_,-1===e.endSize)i.deltaSize=0;else{var f=e.endSize+e.endSizeVar*(Math.random()-.5)*2;f=Math.max(0,f),i.deltaSize=(f-_)/n}var d=e.startSpin+e.startSpinVar*(Math.random()-.5)*2,p=e.endSpin+e.endSpinVar*(Math.random()-.5)*2;i.rotation=d,i.deltaRotation=(p-d)/n,i.startPos.x=t.x,i.startPos.y=t.y,i.aspectRatio=e.aspectRatio||1;var m=Fe(e.angle+this._worldRotation+e.angleVar*(Math.random()-.5)*2);if(e.emitterMode===$8.GRAVITY){var g=e.speed+e.speedVar*(Math.random()-.5)*2;i.dir.x=Math.cos(m),i.dir.y=Math.sin(m),i.dir.multiplyScalar(g),i.radialAccel=e.radialAccel+e.radialAccelVar*(Math.random()-.5)*2,i.tangentialAccel=e.tangentialAccel+e.tangentialAccelVar*(Math.random()-.5)*2,e.rotationIsDir&&(i.rotation=-ke(Math.atan2(i.dir.y,i.dir.x)))}else{var y=e.startRadius+e.startRadiusVar*(Math.random()-.5)*2,v=e.endRadius+e.endRadiusVar*(Math.random()-.5)*2;i.radius=y,i.deltaRadius=-1===e.endRadius?0:(v-y)/n,i.angle=m,i.degreesPerSecond=Fe(e.rotatePerS+e.rotatePerSVar*(Math.random()-.5)*2)}},e.updateUVs=function(t){var e=this.renderData;if(e&&this.sys._renderSpriteFrame){for(var i=e.vData,n=this.sys._renderSpriteFrame.uv,r=t?0:this.uvFilled,s=this.particles.length,a=r;a<s;a++){var o=a*a6*4;i[o+3]=n[0],i[o+4]=n[1],i[o+12]=n[2],i[o+13]=n[3],i[o+21]=n[4],i[o+22]=n[5],i[o+30]=n[6],i[o+31]=n[7]}this.uvFilled=s}},e.updateParticleBuffer=function(t,e,i,n){var r=i.vData,s=e.x,a=e.y,o=t.size,h=o,u=t.aspectRatio;u>1?h=o/u:o=h*u;var l=o/2,c=h/2;if(t.rotation){var _=-l,f=-c,d=l,p=c,m=-Fe(t.rotation),g=Math.cos(m),y=Math.sin(m);r[n]=_*g-f*y+s,r[n+1]=_*y+f*g+a,r[n+2]=0,r[n+9]=d*g-f*y+s,r[n+10]=d*y+f*g+a,r[n+11]=0,r[n+18]=_*g-p*y+s,r[n+19]=_*y+p*g+a,r[n+20]=0,r[n+27]=d*g-p*y+s,r[n+28]=d*y+p*g+a,r[n+29]=0}else r[n]=s-l,r[n+1]=a-c,r[n+2]=0,r[n+9]=s+l,r[n+10]=a-c,r[n+11]=0,r[n+18]=s-l,r[n+19]=a+c,r[n+20]=0,r[n+27]=s+l,r[n+28]=a+c,r[n+29]=0;Zi.toArray(r,t.color,n+5),Zi.toArray(r,t.color,n+14),Zi.toArray(r,t.color,n+23),Zi.toArray(r,t.color,n+32)},e.step=function(t){var e=this.sys.assembler,i=this.sys,n=i.node,r=this.particles;if(t=t>e.maxParticleDeltaTime?e.maxParticleDeltaTime:t,n.updateWorldTransform(),i.positionType===t6.FREE){this._worldRotation=function(t){for(var e=0,i=t;i;)e+=i.eulerAngles.z,i=i.parent;return e}(n);var s=n.worldMatrix;i6.x=s.m12,i6.y=s.m13}else i.positionType===t6.RELATIVE?(this._worldRotation=n.eulerAngles.z,i6.x=n.position.x,i6.y=n.position.y):this._worldRotation=0;if(this.active&&i.emissionRate){var a=1/i.emissionRate;for(r.length<i.totalParticles&&(this.emitCounter+=t);r.length<i.totalParticles&&this.emitCounter>a;)this.emitParticle(i6),this.emitCounter-=a;this.elapsed+=t,-1!==i.duration&&i.duration<this.elapsed&&i.stopSystem()}var o=this.renderData,h=r.length;o.reset(),this.requestData(4*h,6*h),h>this.uvFilled&&this.updateUVs();for(var u=0;u<r.length;){n6.x=n6.y=r6.x=r6.y=s6.x=s6.y=0;var l=r[u];if(l.timeToLive-=t,l.timeToLive>0){if(i.emitterMode===$8.GRAVITY){var c=s6,_=n6,f=r6;(l.pos.x||l.pos.y)&&(_.set(l.pos),_.normalize()),f.set(_),_.multiplyScalar(l.radialAccel);var d=f.x;f.x=-f.y,f.y=d,f.multiplyScalar(l.tangentialAccel),c.set(_),c.add(f),c.add(i.gravity),c.multiplyScalar(t),l.dir.add(c),c.set(l.dir),c.multiplyScalar(t),l.pos.add(c)}else l.angle+=l.degreesPerSecond*t,l.radius+=l.deltaRadius*t,l.pos.x=-Math.cos(l.angle)*l.radius,l.pos.y=-Math.sin(l.angle)*l.radius;l.color.r+=l.deltaColor.r*t,l.color.g+=l.deltaColor.g*t,l.color.b+=l.deltaColor.b*t,l.color.a+=l.deltaColor.a*t,l.size+=l.deltaSize*t,l.size<0&&(l.size=0),l.rotation+=l.deltaRotation*t;var p=n6;p.set(l.pos),i.positionType!==t6.GROUPED&&p.add(l.startPos);var m=a6*u*4;this.updateParticleBuffer(l,p,o,m),++u}else{var g=r[u];u!==r.length-1&&(r[u]=r[r.length-1]),h6.put(g),r.length--,o.resize(o.vertexCount-4,o.indexCount-6)}}this.renderData.material=this.sys.getRenderMaterial(0),this.renderData.frame=this.sys._renderSpriteFrame,o.setRenderDrawInfoAttributes(),0!==r.length||this.active||this.readyToPlay||(this.finished=!0,i._finishedSimulation())},e.requestData=function(t,e){var i=this.renderData.indexCount;this.renderData.request(t,e);for(var n=this.renderData.indexCount/6,r=this.renderData.iData,s=i;s<n;s++){var a=4*s;r[i++]=a,r[i++]=a+1,r[i++]=a+2,r[i++]=a+1,r[i++]=a+3,r[i++]=a+2}},e.initDrawInfo=function(){this.renderData.setRenderDrawInfoAttributes()},t}(),l6=ks,c6=t("eI",Is("cc.ParticleAsset")((Q8=function(t){function e(){for(var e,i=arguments.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=Z8&&Z8(),e}return s(e,t),e}(zf),Z8=Ss(Q8.prototype,"spriteFrame",[l6],(function(){return null})),J8=Q8))||J8);v.ParticleAsset=c6;
- /** @license zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License */
- var _6={};(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?(f[255&t]<<24|f[t>>>8&255]<<16|f[t>>>16&255]<<8|f[t>>>24&255])>>32-e:f[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++]=f[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]=f[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 f=u;function d(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,f=Number.POSITIVE_INFINITY;for(u=0;u<c;++u)t[u]>_&&(_=t[u]),t[u]<f&&(f=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,_,f]}function m(t,e){this.h=y,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))}d.prototype.getParent=function(t){return 2*((t-2)/4|0)},d.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},d.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,y=2,v={NONE:0,r:1,j:y,N:3},S=[];for(g=0;288>g;g++)switch(i){case 143>=g:S.push([g+48,8]);break;case 255>=g:S.push([g-144+400,9]);break;case 279>=g:S.push([g-256+0,7]);break;case 287>=g:S.push([g-280+192,8]);break;default:t("invalid literal: "+g)}function A(t,e){this.length=t,this.G=e}function T(){var e=E;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,_,f=r=s?u.subarray(a,a+65535):u.slice(a,a+65535),d=(a+=r.length)===h,p=e,m=e,g=this.a,v=this.b;if(s){for(g=new Uint8Array(this.a.buffer);g.length<=v+f.length+5;)g=new Uint8Array(g.length<<1);g.set(this.a)}if(l=d?1:0,g[v++]=0|l,_=65536+~(c=f.length)&65535,g[v++]=255&c,g[v++]=c>>>8&255,g[v++]=255&_,g[v++]=_>>>8&255,s)g.set(f,v),v+=f.length,g=g.subarray(0,v);else{for(p=0,m=f.length;p<m;++p)g[v++]=f[p];g.length=v}this.b=v,this.a=g}break;case 1:var A=new o(new Uint8Array(this.a.buffer),this.b);A.d(1,1,i),A.d(1,2,i);var T,E,b,x=R(this,u);for(T=0,E=x.length;T<E;T++)if(b=x[T],o.prototype.d.apply(A,S[b]),256<b)A.d(x[++T],x[++T],i),A.d(x[++T],5),A.d(x[++T],x[++T],i);else if(256===b)break;this.a=A.finish(),this.b=this.a.length;break;case y:var C,B,D,P,O,M,N,L,F,k,G,V,U,z,H,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=y,W.d(1,1,i),W.d(C,2,i),B=R(this,u),N=I(M=w(this.L,15)),F=I(L=w(this.K,7)),D=286;257<D&&0===M[D-1];D--);for(P=30;1<P&&0===L[P-1];P--);var Y,q,K,J,Q,Z,$=D,tt=P,et=new(s?Uint32Array:Array)($+tt),it=new(s?Uint32Array:Array)(316),nt=new(s?Uint8Array:Array)(19);for(Y=q=0;Y<$;Y++)et[q++]=M[Y];for(Y=0;Y<tt;Y++)et[q++]=L[Y];if(!s)for(Y=0,J=nt.length;Y<J;++Y)nt[Y]=0;for(Y=Q=0,J=et.length;Y<J;Y+=q){for(q=1;Y+q<J&&et[Y+q]===et[Y];++q);if(K=q,0===et[Y])if(3>K)for(;0<K--;)it[Q++]=0,nt[0]++;else for(;0<K;)(Z=138>K?K:138)>K-3&&Z<K&&(Z=K-3),10>=Z?(it[Q++]=17,it[Q++]=Z-3,nt[17]++):(it[Q++]=18,it[Q++]=Z-11,nt[18]++),K-=Z;else if(it[Q++]=et[Y],nt[et[Y]]++,3>--K)for(;0<K--;)it[Q++]=et[Y],nt[et[Y]]++;else for(;0<K;)(Z=6>K?K:6)>K-3&&Z<K&&(Z=K-3),it[Q++]=16,it[Q++]=Z-3,nt[16]++,K-=Z}for(n=s?it.subarray(0,Q):it.slice(0,Q),k=w(nt,7),z=0;19>z;z++)j[z]=k[X[z]];for(O=19;4<O&&0===j[O-1];O--);for(G=I(k),W.d(D-257,5,i),W.d(P-1,5,i),W.d(O-4,4,i),z=0;z<O;z++)W.d(j[z],3,i);for(z=0,H=n.length;z<H;z++)if(V=n[z],W.d(G[V],k[V],i),16<=V){switch(z++,V){case 16:U=2;break;case 17:U=3;break;case 18:U=7;break;default:t("invalid code: "+V)}W.d(n[z],U,i)}var rt,st,at,ot,ht,ut,lt,ct,_t=[N,M],ft=[F,L];for(ht=_t[0],ut=_t[1],lt=ft[0],ct=ft[1],rt=0,st=B.length;rt<st;++rt)if(at=B[rt],W.d(ht[at],ut[at],i),256<at)W.d(B[++rt],B[++rt],i),ot=B[++rt],W.d(lt[ot],ct[ot],i),W.d(B[++rt],B[++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 E,b,x=[];for(E=3;258>=E;E++)b=T(),x[E]=b[2]<<24|b[1]<<16|b[0];var C=s?new Uint32Array(x):x;function R(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[y++]=u[a];S[u[0]]++,T[u[3]]++,v=e.length+n-1,d=null}var o,h,u,l,c,_,f,d,p,m={},g=s?new Uint16Array(2*r.length):[],y=0,v=0,S=new(s?Uint32Array:Array)(286),T=new(s?Uint32Array:Array)(30),E=n.w;if(!s){for(u=0;285>=u;)S[u++]=0;for(u=0;29>=u;)T[u++]=0}for(S[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<v--)){for(;0<_.length&&32768<o-_[0];)_.shift();if(o+3>=h){for(d&&a(d,-1),u=0,l=h-o;u<l;++u)p=r[o+u],g[y++]=p,++S[p];break}if(0<_.length){var b=e,x=e,R=0,w=e,I=e,B=e,D=r.length,P=(I=0,_.length);t:for(;I<P;I++){if(b=_[P-I-1],w=3,3<R){for(B=R;3<B;B--)if(r[b+B-1]!==r[o+B-1])continue t;w=R}for(;258>w&&o+w<D&&r[b+w]===r[o+w];)++w;if(w>R&&(x=b,R=w),258===w)break}f=new A(R,o-x),d?d.length<f.length?(p=r[o-1],g[y++]=p,++S[p],a(f,0)):a(d,-1):f.length<E?d=f:a(f,0)}else d?a(d,-1):(p=r[o],g[y++]=p,++S[p])}_.push(o)}return g[y++]=256,S[256]++,n.L=S,n.K=T,s?g.subarray(0,y):g}function w(t,e){function i(t){var e=E[t][b[t]];e===y?(i(t+1),i(t+1)):--A[e],++b[t]}var n,r,a,o,h,u=t.length,l=new d(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 _,f,p,m,g,y=r.length,v=new(s?Uint16Array:Array)(e),S=new(s?Uint8Array:Array)(e),A=new(s?Uint8Array:Array)(y),T=Array(e),E=Array(e),b=Array(e),x=(1<<e)-y,C=1<<e-1;for(v[e-1]=y,f=0;f<e;++f)x<C?S[f]=0:(S[f]=1,x-=C),x<<=1,v[e-2-f]=(v[e-1-f]/2|0)+y;for(v[0]=S[0],T[0]=Array(v[0]),E[0]=Array(v[0]),f=1;f<e;++f)v[f]>2*v[f-1]+S[f]&&(v[f]=2*v[f-1]+S[f]),T[f]=Array(v[f]),E[f]=Array(v[f]);for(_=0;_<y;++_)A[_]=e;for(p=0;p<v[e-1];++p)T[e-1][p]=r[p],E[e-1][p]=p;for(_=0;_<e;++_)b[_]=0;for(1===S[e-1]&&(--A[0],++b[e-1]),f=e-2;0<=f;--f){for(m=_=0,g=b[f+1],p=0;p<v[f];p++)(m=T[f+1][g]+T[f+1][g+1])>r[_]?(T[f][p]=m,E[f][p]=y,g+=2):(T[f][p]=r[_],E[f][p]=_,++_);b[f]=0,1===S[f]&&i(f)}for(a=A,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 B(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=v;function P(e,i){switch(this.k=[],this.l=32768,this.e=this.g=this.c=this.q=0,this.input=s?new Uint8Array(e):e,this.s=!1,this.m=M,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 O:this.b=32768,this.a=new(s?Uint8Array:Array)(32768+this.l+258);break;case M: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"))}}B.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",B),r("Zlib.Deflate.compress",(function(t,e){return new B(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 O=0,M=1,N={D:O,C:M};P.prototype.p=function(){for(;!this.s;){var n=tt(this,3);switch(1&n&&(this.s=i),n>>>=1){case 0:var r=this.input,a=this.c,o=this.a,h=this.b,u=e,l=e,c=e,_=o.length,f=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 O:for(;h+l>o.length;){if(l-=f=_-h,s)o.set(r.subarray(a,a+f),h),h+=f,a+=f;else for(;f--;)o[h++]=r[a++];this.b=h,o=this.f(),h=this.b}break;case M: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(Q,$);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],G=s?new Uint16Array(k):k,V=[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],U=s?new Uint16Array(V):V,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],H=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,q=new(s?Uint8Array:Array)(288);for(L=0,F=q.length;L<F;++L)q[L]=143>=L?8:255>=L?9:279>=L?7:8;var K,J,Q=p(q),Z=new(s?Uint8Array:Array)(30);for(K=0,J=Z.length;K<J;++K)Z[K]=5;var $=p(Z);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)(G.length);for(a=0;a<u;++a)l[G[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 P(e,{index:this.c,bufferSize:i.bufferSize,bufferType:i.bufferType,resize:i.resize})}P.prototype.o=function(t,e){var i=this.a,n=this.b;this.u=t;for(var r,s,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=U[s=r-257],0<H[s]&&(o+=tt(this,H[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},P.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=U[s=r-257],0<H[s]&&(o+=tt(this,H[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},P.prototype.f=function(){var t,e,i=new(s?Uint8Array:Array)(this.b-32768),n=this.b-32768,r=this.a;if(s)i.set(r.subarray(32768,i.length));else for(t=0,e=i.length;t<e;++t)i[t]=r[t+32768];if(this.k.push(i),this.q+=i.length,s)r.set(r.subarray(n,n+32768));else for(t=0;32768>t;++t)r[t]=r[n+t];return this.b=32768,r},P.prototype.J=function(t){var e,i,n,r=this.input.length/this.c+1|0,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},P.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},P.prototype.H=function(){var t,e=this.b;return s?this.B?(t=new Uint8Array(e)).set(this.a.subarray(0,e)):t=this.a.subarray(0,e):(this.a.length>e&&(this.a.length=e),t=this.a),this.buffer=t},nt.prototype.p=function(){var e,i=this.input;return e=this.A.p(),this.c=this.A.c,this.M&&(i[this.c++]<<24|i[this.c++]<<16|i[this.c++]<<8|i[this.c++])>>>0!==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(_6);var f6=_6.Zlib;f6.Deflate=f6.Deflate,f6.Deflate.compress=f6.Deflate.compress,f6.Inflate=f6.Inflate,f6.Inflate.BufferType=f6.Inflate.BufferType,f6.Inflate.prototype.decompress=f6.Inflate.prototype.decompress;for(var d6=function(){function t(t){var e,i=this;this.pos=8,this.palette=[],this.imgData=[],this.text={},this.width=0,this.height=0,this.bits=0,this.colorType=0,this.compressionMethod=0,this.filterMethod=0,this.interlaceMethod=0,this.colors=0,this.hasAlphaChannel=!1,this.pixelBitlength=0,this.data=t,this.transparency={indexed:[],rgb:0,grayscale:0};for(var n=0,r=0,s=0;;){s=this.readUInt32();var a=function(){var t=[];for(n=0;n<4;++n)t.push(String.fromCharCode(i.data[i.pos++]));return t}.call(this).join("");switch(a){case"IHDR":this.width=this.readUInt32(),this.height=this.readUInt32(),this.bits=this.data[this.pos++],this.colorType=this.data[this.pos++],this.compressionMethod=this.data[this.pos++],this.filterMethod=this.data[this.pos++],this.interlaceMethod=this.data[this.pos++];break;case"acTL":this.animation={numFrames:this.readUInt32(),numPlays:this.readUInt32()||1/0,frames:[]};break;case"PLTE":this.palette=this.read(s);break;case"fcTL":e&&this.animation.frames.push(e),this.pos+=4,e={width:this.readUInt32(),height:this.readUInt32(),xOffset:this.readUInt32(),yOffset:this.readUInt32()};var o=this.readUInt16(),h=this.readUInt16()||100;e.delay=1e3*o/h,e.disposeOp=this.data[this.pos++],e.blendOp=this.data[this.pos++],e.data=[];break;case"IDAT":case"fdAT":for("fdAT"===a&&(this.pos+=4,s-=4),t=(null!=e?e.data:void 0)||this.imgData,n=0;s>=0?n<s:n>s;s>=0?++n:--n)t.push(this.data[this.pos++]);break;case"tRNS":switch(this.transparency={},this.colorType){case 3:this.transparency.indexed=this.read(s);var u=255-this.transparency.indexed.length;if(u>0)for(r=0;u>=0?r<u:r>u;u>=0?++r:--r)this.transparency.indexed.push(255);break;case 0:this.transparency.grayscale=this.read(s)[0];break;case 2:this.transparency.rgb=this.read(s)}break;case"tEXt":var l=this.read(s),c=l.indexOf(0),_=String.fromCharCode.apply(String,l.slice(0,c));this.text[_]=String.fromCharCode.apply(String,l.slice(c+1));break;case"IEND":e&&this.animation.frames.push(e),this.colors=function(){switch(i.colorType){case 0:case 3:case 4:return 1;case 2:case 6:return 3}}.call(this);var f=this.colorType;this.hasAlphaChannel=4===f||6===f;var d=this.colors+(this.hasAlphaChannel?1:0);return this.pixelBitlength=this.bits*d,this.colorSpace=function(){switch(i.colors){case 1:return"DeviceGray";case 3:return"DeviceRGB"}}.call(this),void(this.imgData instanceof Uint8Array||(this.imgData=new Uint8Array(this.imgData)));default:this.pos+=s}if(this.pos+=4,this.pos>this.data.length)throw new Error(tt(6017))}}var e=t.prototype;return e.read=function(t){var e=0,i=[];for(e=0;t>=0?e<t:e>t;t>=0?++e:--e)i.push(this.data[this.pos++]);return i},e.readUInt32=function(){return this.data[this.pos++]<<24|this.data[this.pos++]<<16|this.data[this.pos++]<<8|this.data[this.pos++]},e.readUInt16=function(){return this.data[this.pos++]<<8|this.data[this.pos++]},e.decodePixels=function(t){if(null==t&&(t=this.imgData),0===t.length)return new Uint8Array(0);t=new f6.Inflate(t,{index:0,verify:!1}).decompress();for(var e=this.pixelBitlength/8,i=e*this.width,n=new Uint8Array(i*this.height),r=t.length,s=0,a=0,o=0,h=0,u=0,l=0,c=0,_=0,f=0,d=0,p=0,m=0,g=0,y=0,v=0,S=0,A=0,T=0,E=0;a<r;){switch(t[a++]){case 0:for(l=c=0;c<i;l=c+=1)n[o++]=t[a++];break;case 1:for(l=_=0;_<i;l=_+=1)h=t[a++],m=l<e?0:n[o-e],n[o++]=(h+m)%256;break;case 2:for(l=f=0;f<i;l=f+=1)h=t[a++],u=(l-l%e)/e,T=s&&n[(s-1)*i+u*e+l%e],n[o++]=(T+h)%256;break;case 3:for(l=d=0;d<i;l=d+=1)h=t[a++],u=(l-l%e)/e,m=l<e?0:n[o-e],T=s&&n[(s-1)*i+u*e+l%e],n[o++]=(h+Math.floor((m+T)/2))%256;break;case 4:for(l=p=0;p<i;l=p+=1)h=t[a++],u=(l-l%e)/e,m=l<e?0:n[o-e],0===s?T=E=0:(T=n[(s-1)*i+u*e+l%e],E=u&&n[(s-1)*i+(u-1)*e+l%e]),g=m+T-E,y=Math.abs(g-m),S=Math.abs(g-T),A=Math.abs(g-E),v=y<=S&&y<=A?m:S<=A?T:E,n[o++]=(h+v)%256;break;default:throw new Error(tt(6018,t[a-1]))}s++}return n},e.copyToImageData=function(t,e){var i,n=this.hasAlphaChannel,r=this.colors;this.palette.length&&(i=null!=this._decodedPalette?this._decodedPalette:this._decodedPalette=this.decodePalette(),r=4,n=!0);var s=t.data||t,a=s.length,o=i||e,h=0,u=0,l=0,c=0;if(1===r)for(;h<a;)l=i?4*e[h/4]:u,c=o[l++],s[h++]=c,s[h++]=c,s[h++]=c,s[h++]=n?o[l++]:255,u=l;else for(;h<a;)l=i?4*e[h/4]:u,s[h++]=o[l++],s[h++]=o[l++],s[h++]=o[l++],s[h++]=n?o[l++]:255,u=l},e.decodePalette=function(){for(var t=this.palette,e=this.transparency.indexed||[],i=new Uint8Array((e.length||0)+t.length),n=0,r=0,s=0,a=0,o=0,h=t.length;o<h;a=o+=3)i[n++]=t[a],i[n++]=t[a+1],i[n++]=t[a+2],s=e[r++],i[n++]=null!=s?s:255;return i},e.render=function(t){t.width=this.width,t.height=this.height;var e=t.getContext("2d"),i=e.createImageData(this.width,this.height);return this.copyToImageData(i,this.decodePixels(null)),e.putImageData(i,0,0)},t}(),p6=function(){function t(){this._littleEndian=!1,this._tiffData=[],this._fileDirectories=[]}var e=t.prototype;return e.getUint8=function(t){return this._tiffData[t]},e.getUint16=function(t){return this._littleEndian?this._tiffData[t+1]<<8|this._tiffData[t]:this._tiffData[t]<<8|this._tiffData[t+1]},e.getUint32=function(t){var e=this._tiffData;return this._littleEndian?e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t]:e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]},e.checkLittleEndian=function(){var t=this.getUint16(0);if(18761===t)this._littleEndian=!0;else{if(19789!==t)throw console.log(t),TypeError(tt(6019));this._littleEndian=!1}return this._littleEndian},e.hasTowel=function(){if(42!==this.getUint16(2))throw RangeError(tt(6020));return!0},e.getFieldTypeName=function(t){return t in g6?g6[t]:null},e.getFieldTagName=function(t){return t in m6?m6[t]:(j(6021,t),"Tag"+t)},e.getFieldTypeLength=function(t){return-1!==["BYTE","ASCII","SBYTE","UNDEFINED"].indexOf(t)?1:-1!==["SHORT","SSHORT"].indexOf(t)?2:-1!==["LONG","SLONG","FLOAT"].indexOf(t)?4:-1!==["RATIONAL","SRATIONAL","DOUBLE"].indexOf(t)?8:0},e.getFieldValues=function(t,e,i,n){var r=[],s=this.getFieldTypeLength(e);if(s*i<=4)!1===this._littleEndian?r.push(n>>>8*(4-s)):r.push(n);else for(var a=0;a<i;a++){var o=s*a;s>=8?-1!==["RATIONAL","SRATIONAL"].indexOf(e)?(r.push(this.getUint32(n+o)),r.push(this.getUint32(n+o+4))):j(8e3):r.push(this.getBytes(s,n+o))}return"ASCII"===e&&r.forEach((function(t,e,i){i[e]=String.fromCharCode(t)})),r},e.getBytes=function(t,e){if(t<=0)j(8001);else{if(t<=1)return this.getUint8(e);if(t<=2)return this.getUint16(e);if(t<=3)return this.getUint32(e)>>>8;if(t<=4)return this.getUint32(e);j(8002)}return 0},e.getBits=function(t,e,i){i=i||0;var n=e+Math.floor(i/8),r=i+t,s=32-t,a=0,o=0;return r<=0?j(6023):r<=8?(a=24+i,o=this.getUint8(n)):r<=16?(a=16+i,o=this.getUint16(n)):r<=32?(a=i,o=this.getUint32(n)):j(6022),{bits:o<<a>>>s,byteOffset:n+Math.floor(r/8),bitOffset:r%8}},e.parseFileDirectory=function(t){var e=this.getUint16(t),i=[],n=0,r=0;for(n=t+2,r=0;r<e;n+=12,r++){var s=this.getUint16(n),a=this.getUint16(n+2),o=this.getUint32(n+4),h=this.getUint32(n+8),u=this.getFieldTagName(s),l=this.getFieldTypeName(a),c=this.getFieldValues(u,l,o,h);i[u]={type:l,values:c}}this._fileDirectories.push(i);var _=this.getUint32(n);0!==_&&this.parseFileDirectory(_)},e.clampColorSample=function(t,e){var i=Math.pow(2,8-e);return Math.floor(t*i+(i-1))},e.parseTIFF=function(t,e){var i=this;if(e=e||A.document.createElement("canvas"),this._tiffData=t,this._canvas=e,this.checkLittleEndian(),this.hasTowel()){var n=this.getUint32(4);this._fileDirectories.length=0,this.parseFileDirectory(n);var r=this._fileDirectories[0],s=r.ImageWidth.values[0],a=r.ImageLength.values[0];this._canvas.width=s,this._canvas.height=a;var o=[],h=r.Compression?r.Compression.values[0]:1,u=r.SamplesPerPixel.values[0],l=[],c=0,_=!1;r.BitsPerSample.values.forEach((function(t,e){l[e]={bitsPerSample:t,hasBytesPerSample:!1,bytesPerSample:void 0},t%8==0&&(l[e].hasBytesPerSample=!0,l[e].bytesPerSample=t/8),c+=t}),this);var f=0;c%8==0&&(_=!0,f=c/8);var d,p=r.StripOffsets.values,m=p.length;if(r.StripByteCounts)d=r.StripByteCounts.values;else{if(j(8003),1!==m)throw Error(tt(6024));d=[Math.ceil(s*a*c/8)]}for(var g=1,y=1,v=0;v<m;v++){var S=p[v];o[v]=[];for(var T=d[v],E=0,b=0,x=1,C=!0,R=[],w=0,I=0,B=0;E<T;E+=x)switch(h){case 1:R=[];for(var D=0;D<u;D++){var P=l[D];if(!P.hasBytesPerSample){var O=this.getBits(P.bitsPerSample,S+E,b);throw R.push(O.bits),E=O.byteOffset-S,b=O.bitOffset,RangeError(tt(6025))}var M=P.bytesPerSample*D;R.push(this.getBytes(P.bytesPerSample,S+E+M))}if(o[v].push(R),!_)throw x=0,RangeError(tt(6026));x=f;break;case 2:case 3:case 4:case 5:case 6:case 7:break;case 32773:if(C){C=!1;var N=this.getUint8(S+E);N>=0&&N<=127?g=N+1:N>=-127&&N<=-1?y=1-N:C=!0}else{for(var L=this.getUint8(S+E),F=0;F<y;F++){var k=l[I];if(!k.hasBytesPerSample)throw RangeError(tt(6025));B=B<<8*w|L,++w===k.bytesPerSample&&(R.push(B),B=w=0,I++),I===u&&(o[v].push(R),R=[],I=0)}0==--g&&(C=!0)}x=1}}if(e.getContext){var G=this._canvas.getContext("2d");G.fillStyle="rgba(255, 255, 255, 0)";var V=r.RowsPerStrip?r.RowsPerStrip.values[0]:a,U=o.length,z=a%V,H=0===z?V:z,W=V,X=0,Y=r.PhotometricInterpretation.values[0],q=[],K=0;r.ExtraSamples&&(q=r.ExtraSamples.values,K=q.length);var J=[],Q=0;r.ColorMap&&(J=r.ColorMap.values,Q=Math.pow(2,l[0].bitsPerSample));for(var Z=0;Z<U;Z++){Z+1===U&&(W=H);for(var $=o[Z].length,et=X*Z,it=0,nt=0;it<W&&nt<$;it++)for(var rt=function(){var t=o[Z][nt],e=0,n=0,r=0,s=1;if(K>0)for(var a=0;a<K;a++)if(1===q[a]||2===q[a]){s=t[3+a]/256;break}switch(Y){case 0:var h=0;l[0].hasBytesPerSample&&(h=Math.pow(16,2*l[0].bytesPerSample)),t.forEach((function(t,e,i){i[e]=h-t}));case 1:e=n=r=i.clampColorSample(t[0],l[0].bitsPerSample);break;case 2:e=i.clampColorSample(t[0],l[0].bitsPerSample),n=i.clampColorSample(t[1],l[1].bitsPerSample),r=i.clampColorSample(t[2],l[2].bitsPerSample);break;case 3:if(void 0===J)throw Error(tt(6027));var u=t[0];e=i.clampColorSample(J[u],16),n=i.clampColorSample(J[Q+u],16),r=i.clampColorSample(J[2*Q+u],16);break;default:throw RangeError(tt(6028,Y))}G.fillStyle="rgba("+e+", "+n+", "+r+", "+s+")",G.fillRect(st,et+it,1,1)},st=0;st<s;st++,nt++)rt();X=W}}return this._canvas}},t}(),m6={315:"Artist",258:"BitsPerSample",265:"CellLength",264:"CellWidth",320:"ColorMap",259:"Compression",33432:"Copyright",306:"DateTime",338:"ExtraSamples",266:"FillOrder",289:"FreeByteCounts",288:"FreeOffsets",291:"GrayResponseCurve",290:"GrayResponseUnit",316:"HostComputer",270:"ImageDescription",257:"ImageLength",256:"ImageWidth",271:"Make",281:"MaxSampleValue",280:"MinSampleValue",272:"Model",254:"NewSubfileType",274:"Orientation",262:"PhotometricInterpretation",284:"PlanarConfiguration",296:"ResolutionUnit",278:"RowsPerStrip",277:"SamplesPerPixel",305:"Software",279:"StripByteCounts",273:"StripOffsets",255:"SubfileType",263:"Threshholding",282:"XResolution",283:"YResolution",326:"BadFaxLines",327:"CleanFaxData",343:"ClipPath",328:"ConsecutiveBadFaxLines",433:"Decode",434:"DefaultImageColor",269:"DocumentName",336:"DotRange",321:"HalftoneHints",346:"Indexed",347:"JPEGTables",285:"PageName",297:"PageNumber",317:"Predictor",319:"PrimaryChromaticities",532:"ReferenceBlackWhite",339:"SampleFormat",559:"StripRowCounts",330:"SubIFDs",292:"T4Options",293:"T6Options",325:"TileByteCounts",323:"TileLength",324:"TileOffsets",322:"TileWidth",301:"TransferFunction",318:"WhitePoint",344:"XClipPathUnits",286:"XPosition",529:"YCbCrCoefficients",531:"YCbCrPositioning",530:"YCbCrSubSampling",345:"YClipPathUnits",287:"YPosition",37378:"ApertureValue",40961:"ColorSpace",36868:"DateTimeDigitized",36867:"DateTimeOriginal",34665:"Exif IFD",36864:"ExifVersion",33434:"ExposureTime",41728:"FileSource",37385:"Flash",40960:"FlashpixVersion",33437:"FNumber",42016:"ImageUniqueID",37384:"LightSource",37500:"MakerNote",37377:"ShutterSpeedValue",37510:"UserComment",33723:"IPTC",34675:"ICC Profile",700:"XMP",42112:"GDAL_METADATA",42113:"GDAL_NODATA",34377:"Photoshop"},g6={1:"BYTE",2:"ASCII",3:"SHORT",4:"LONG",5:"RATIONAL",6:"SBYTE",7:"UNDEFINED",8:"SSHORT",9:"SLONG",10:"SRATIONAL",11:"FLOAT",12:"DOUBLE"},y6=new Array(123),v6=0;v6<123;++v6)y6[v6]=64;for(var S6=0;S6<64;++S6)y6["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charCodeAt(S6)]=S6;var A6={name:"Jacob__Codec__Base64",decode:function(t){var e,i,n,r,s,a,o=[],h=0;for(t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");h<t.length;)e=y6[t.charCodeAt(h++)]<<2|(r=y6[t.charCodeAt(h++)])>>4,i=(15&r)<<4|(s=y6[t.charCodeAt(h++)])>>2,n=(3&s)<<6|(a=y6[t.charCodeAt(h++)]),o.push(String.fromCharCode(e)),64!==s&&o.push(String.fromCharCode(i)),64!==a&&o.push(String.fromCharCode(n));return o.join("")},decodeAsArray:function(t,e){var i,n,r,s=this.decode(t),a=[];for(i=0,r=s.length/e;i<r;i++)for(a[i]=0,n=e-1;n>=0;--n)a[i]+=s.charCodeAt(i*e+n)<<8*n;return a}},T6=function(t){this.data=t,this.debug=!1,this.gpflags=void 0,this.files=0,this.unzipped=[],this.buf32k=new Array(32768),this.bIdx=0,this.modeZIP=!1,this.bytepos=0,this.bb=1,this.bits=0,this.nameBuf=[],this.fileout=void 0,this.literalTree=new Array(T6.LITERALS),this.distanceTree=new Array(32),this.treepos=0,this.Places=null,this.len=0,this.fpos=new Array(17),this.fpos[0]=0,this.flens=void 0,this.fmax=void 0};T6.gunzip=function(t){return t.constructor===Array||t.constructor,new T6(t).gunzip()[0][0]},T6.HufNode=function(){this.b0=0,this.b1=0,this.jump=null,this.jumppos=-1},T6.LITERALS=288,T6.NAMEMAX=256,T6.bitReverse=[0,128,64,192,32,160,96,224,16,144,80,208,48,176,112,240,8,136,72,200,40,168,104,232,24,152,88,216,56,184,120,248,4,132,68,196,36,164,100,228,20,148,84,212,52,180,116,244,12,140,76,204,44,172,108,236,28,156,92,220,60,188,124,252,2,130,66,194,34,162,98,226,18,146,82,210,50,178,114,242,10,138,74,202,42,170,106,234,26,154,90,218,58,186,122,250,6,134,70,198,38,166,102,230,22,150,86,214,54,182,118,246,14,142,78,206,46,174,110,238,30,158,94,222,62,190,126,254,1,129,65,193,33,161,97,225,17,145,81,209,49,177,113,241,9,137,73,201,41,169,105,233,25,153,89,217,57,185,121,249,5,133,69,197,37,165,101,229,21,149,85,213,53,181,117,245,13,141,77,205,45,173,109,237,29,157,93,221,61,189,125,253,3,131,67,195,35,163,99,227,19,147,83,211,51,179,115,243,11,139,75,203,43,171,107,235,27,155,91,219,59,187,123,251,7,135,71,199,39,167,103,231,23,151,87,215,55,183,119,247,15,143,79,207,47,175,111,239,31,159,95,223,63,191,127,255],T6.cplens=[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,0,0],T6.cplext=[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,99,99],T6.cpdist=[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],T6.cpdext=[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],T6.border=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],T6.prototype.gunzip=function(){return this.outputArr=[],this.nextFile(),this.unzipped},T6.prototype.readByte=function(){return this.bits+=8,this.bytepos<this.data.length?this.data.charCodeAt(this.bytepos++):-1},T6.prototype.byteAlign=function(){this.bb=1},T6.prototype.readBit=function(){var t;return this.bits++,t=1&this.bb,this.bb>>=1,0===this.bb&&(this.bb=this.readByte(),t=1&this.bb,this.bb=this.bb>>1|128),t},T6.prototype.readBits=function(t){for(var e=0,i=t;i--;)e=e<<1|this.readBit();return t&&(e=T6.bitReverse[e]>>8-t),e},T6.prototype.flushBuffer=function(){this.bIdx=0},T6.prototype.addBuffer=function(t){this.buf32k[this.bIdx++]=t,this.outputArr.push(String.fromCharCode(t)),32768===this.bIdx&&(this.bIdx=0)},T6.prototype.IsPat=function(){for(;;){if(this.fpos[this.len]>=this.fmax)return-1;if(this.flens[this.fpos[this.len]]===this.len)return this.fpos[this.len]++;this.fpos[this.len]++}},T6.prototype.Rec=function(){var t,e=this.Places[this.treepos];if(17===this.len)return-1;if(this.treepos++,this.len++,(t=this.IsPat())>=0)e.b0=t;else if(e.b0=32768,this.Rec())return-1;if((t=this.IsPat())>=0)e.b1=t,e.jump=null;else if(e.b1=32768,e.jump=this.Places[this.treepos],e.jumppos=this.treepos,this.Rec())return-1;return this.len--,0},T6.prototype.CreateTree=function(t,e,i){var n;for(this.Places=t,this.treepos=0,this.flens=i,this.fmax=e,n=0;n<17;n++)this.fpos[n]=0;return this.len=0,this.Rec()?-1:0},T6.prototype.DecodeValue=function(t){for(var e,i,n=0,r=t[n];;)if(this.readBit()){if(!(32768&r.b1))return r.b1;for(r=r.jump,e=t.length,i=0;i<e;i++)if(t[i]===r){n=i;break}}else{if(!(32768&r.b0))return r.b0;r=t[++n]}return-1},T6.prototype.DeflateLoop=function(){var t,e,i;do{var n,r;if(t=this.readBit(),0===(e=this.readBits(2)))for(this.byteAlign(),n=this.readByte(),n|=this.readByte()<<8,r=this.readByte(),65535&(n^~(r|=this.readByte()<<8))&&document.write("BlockLen checksum mismatch\n");n--;)s=this.readByte(),this.addBuffer(s);else if(1===e)for(;;)if((a=T6.bitReverse[this.readBits(7)]>>1)>23?(a=a<<1|this.readBit())>199?a=(a-=128)<<1|this.readBit():(a-=48)>143&&(a+=136):a+=256,a<256)this.addBuffer(a);else{if(256===a)break;for(a-=257,d=this.readBits(T6.cplext[a])+T6.cplens[a],a=T6.bitReverse[this.readBits(5)]>>3,T6.cpdext[a]>8?(p=this.readBits(8),p|=this.readBits(T6.cpdext[a]-8)<<8):p=this.readBits(T6.cpdext[a]),p+=T6.cpdist[a],a=0;a<d;a++){var s=this.buf32k[this.bIdx-p&32767];this.addBuffer(s)}}else if(2===e){var a,o,h,u,l,c=new Array(320);for(h=257+this.readBits(5),u=1+this.readBits(5),l=4+this.readBits(4),a=0;a<19;a++)c[a]=0;for(a=0;a<l;a++)c[T6.border[a]]=this.readBits(3);for(d=this.distanceTree.length,i=0;i<d;i++)this.distanceTree[i]=new T6.HufNode;if(this.CreateTree(this.distanceTree,19,c,0))return this.flushBuffer(),1;for(o=h+u,i=0;i<o;)if((a=this.DecodeValue(this.distanceTree))<16)c[i++]=a;else if(16===a){var _;if(i+(a=3+this.readBits(2))>o)return this.flushBuffer(),1;for(_=i?c[i-1]:0;a--;)c[i++]=_}else{if(i+(a=17===a?3+this.readBits(3):11+this.readBits(7))>o)return this.flushBuffer(),1;for(;a--;)c[i++]=0}for(d=this.literalTree.length,i=0;i<d;i++)this.literalTree[i]=new T6.HufNode;if(this.CreateTree(this.literalTree,h,c,0))return this.flushBuffer(),1;for(d=this.literalTree.length,i=0;i<d;i++)this.distanceTree[i]=new T6.HufNode;var f=new Array;for(i=h;i<c.length;i++)f[i-h]=c[i];if(this.CreateTree(this.distanceTree,u,f,0))return this.flushBuffer(),1;for(;;)if((a=this.DecodeValue(this.literalTree))>=256){var d,p;if(0==(a-=256))break;for(a--,d=this.readBits(T6.cplext[a])+T6.cplens[a],a=this.DecodeValue(this.distanceTree),T6.cpdext[a]>8?(p=this.readBits(8),p|=this.readBits(T6.cpdext[a]-8)<<8):p=this.readBits(T6.cpdext[a]),p+=T6.cpdist[a];d--;)s=this.buf32k[this.bIdx-p&32767],this.addBuffer(s)}else this.addBuffer(a)}}while(!t);return this.flushBuffer(),this.byteAlign(),0},T6.prototype.unzipFile=function(t){var e;for(this.gunzip(),e=0;e<this.unzipped.length;e++)if(this.unzipped[e][1]===t)return this.unzipped[e][0]},T6.prototype.nextFile=function(){this.outputArr=[],this.modeZIP=!1;var t=[];if(t[0]=this.readByte(),t[1]=this.readByte(),120===t[0]&&218===t[1]&&(this.DeflateLoop(),this.unzipped[this.files]=[this.outputArr.join(""),"geonext.gxt"],this.files++),31===t[0]&&139===t[1]&&(this.skipdir(),this.unzipped[this.files]=[this.outputArr.join(""),"file"],this.files++),80===t[0]&&75===t[1]&&(this.modeZIP=!0,t[2]=this.readByte(),t[3]=this.readByte(),3===t[2]&&4===t[3])){t[0]=this.readByte(),t[1]=this.readByte(),this.gpflags=this.readByte(),this.gpflags|=this.readByte()<<8;var e=this.readByte();e|=this.readByte()<<8,this.readByte(),this.readByte(),this.readByte(),this.readByte(),this.readByte(),this.readByte(),this.readByte(),this.readByte(),this.readByte(),this.readByte(),this.readByte(),this.readByte();var i=this.readByte();i|=this.readByte()<<8;var n=this.readByte();for(n|=this.readByte()<<8,s=0,this.nameBuf=[];i--;){var r=this.readByte();"/"===r|":"===r?s=0:s<T6.NAMEMAX-1&&(this.nameBuf[s++]=String.fromCharCode(r))}this.fileout||(this.fileout=this.nameBuf);for(var s=0;s<n;)r=this.readByte(),s++;8===e&&(this.DeflateLoop(),this.unzipped[this.files]=[this.outputArr.join(""),this.nameBuf.join("")],this.files++),this.skipdir()}},T6.prototype.skipdir=function(){var t,e,i=[];if(8&this.gpflags&&(i[0]=this.readByte(),i[1]=this.readByte(),i[2]=this.readByte(),i[3]=this.readByte(),this.readByte(),this.readByte(),this.readByte(),this.readByte(),this.readByte(),this.readByte(),this.readByte(),this.readByte()),this.modeZIP&&this.nextFile(),i[0]=this.readByte(),8!==i[0])return 0;if(this.gpflags=this.readByte(),this.readByte(),this.readByte(),this.readByte(),this.readByte(),this.readByte(),this.readByte(),4&this.gpflags)for(i[0]=this.readByte(),i[2]=this.readByte(),this.len=i[0]+256*i[1],t=0;t<this.len;t++)this.readByte();if(8&this.gpflags)for(t=0,this.nameBuf=[];e=this.readByte();)"7"!==e&&":"!==e||(t=0),t<T6.NAMEMAX-1&&(this.nameBuf[t++]=e);if(16&this.gpflags)for(;e=this.readByte(););2&this.gpflags&&(this.readByte(),this.readByte()),this.DeflateLoop(),this.readByte(),this.readByte(),this.readByte(),this.readByte(),this.modeZIP&&this.nextFile()};var E6,b6,x6,C6,R6,w6,I6,B6,D6,P6,O6,M6,N6,L6,F6,k6,G6,V6,U6,z6,H6,W6,X6,j6,Y6,q6,K6,J6,Q6,Z6,$6,t7,e7,i7,n7,r7,s7,a7,o7,h7,u7,l7,c7,_7,f7,d7,p7,m7,g7,y7,v7,S7,A7,T7={name:"Jacob__Codec"};function E7(t){var e=t.parent,i=t.getComponent(N7);return e&&i?E7(e):t.getComponentsInChildren(N7)}T7.Base64=A6,T7.GZip=T6,T7.unzip=function(){return T7.GZip.gunzip.apply(T7.GZip,arguments)},T7.unzipBase64=function(){var t=T7.Base64.decode.apply(T7.Base64,arguments);try{return T7.GZip.gunzip.call(T7.GZip,t)}catch(e){return t.slice(7)}},T7.unzipBase64AsArray=function(t,e){e=e||1;var i,n,r,s=this.unzipBase64(t),a=[];for(i=0,r=s.length/e;i<r;i++)for(a[i]=0,n=e-1;n>=0;--n)a[i]+=s.charCodeAt(i*e+n)<<8*n;return a},T7.unzipAsArray=function(t,e){e=e||1;var i,n,r,s=this.unzip(t),a=[];for(i=0,r=s.length/e;i<r;i++)for(a[i]=0,n=e-1;n>=0;--n)a[i]+=s.charCodeAt(i*e+n)<<8*n;return a},function(t){t[t.JPG=0]="JPG",t[t.PNG=1]="PNG",t[t.TIFF=2]="TIFF",t[t.WEBP=3]="WEBP",t[t.PVR=4]="PVR",t[t.ETC=5]="ETC",t[t.S3TC=6]="S3TC",t[t.ATITC=7]="ATITC",t[t.TGA=8]="TGA",t[t.RAWDATA=9]="RAWDATA",t[t.UNKNOWN=10]="UNKNOWN"}(A7||(A7={}));var b7,x7,C7,R7,w7,I7,B7,D7,P7,O7,M7,N7=t("eE",(E6=Is("cc.ParticleSystem2D"),b6=ha(c6),x6=ha(lL),C6=ha(t6),R6=ha($8),w6=Gs("preview"),E6(((S7=function(t){function e(){var e;return(e=t.call(this)||this).duration=D6&&D6(),e.emissionRate=P6&&P6(),e.life=O6&&O6(),e.lifeVar=M6&&M6(),e.angle=N6&&N6(),e.angleVar=L6&&L6(),e.startSize=F6&&F6(),e.startSizeVar=k6&&k6(),e.endSize=G6&&G6(),e.endSizeVar=V6&&V6(),e.startSpin=U6&&U6(),e.startSpinVar=z6&&z6(),e.endSpin=H6&&H6(),e.endSpinVar=W6&&W6(),e.sourcePos=X6&&X6(),e.posVar=j6&&j6(),e.emitterMode=Y6&&Y6(),e.gravity=q6&&q6(),e.speed=K6&&K6(),e.speedVar=J6&&J6(),e.tangentialAccel=Q6&&Q6(),e.tangentialAccelVar=Z6&&Z6(),e.radialAccel=$6&&$6(),e.radialAccelVar=t7&&t7(),e.rotationIsDir=e7&&e7(),e.startRadius=i7&&i7(),e.startRadiusVar=n7&&n7(),e.endRadius=r7&&r7(),e.endRadiusVar=s7&&s7(),e.rotatePerS=a7&&a7(),e.rotatePerSVar=o7&&o7(),e.aspectRatio=1,e.playOnLoad=h7&&h7(),e.autoRemoveOnFinish=u7&&u7(),e._preview=l7&&l7(),e._custom=c7&&c7(),e._file=_7&&_7(),e._spriteFrame=f7&&f7(),e._totalParticles=d7&&d7(),e._startColor=p7&&p7(),e._startColorVar=m7&&m7(),e._endColor=g7&&g7(),e._endColorVar=y7&&y7(),e._positionType=v7&&v7(),e._stopped=!0,e._useFile=void 0,e.initProperties(),e._useFile=!1,e}s(e,t);var i=e.prototype;return i.onEnable=function(){t.prototype.onEnable.call(this),this._updateMaterial(),this._updatePositionType()},i.onDestroy=function(){t.prototype.onDestroy.call(this),this.autoRemoveOnFinish&&(this.autoRemoveOnFinish=!1),this._simulator.uvFilled=0,this._simulator.renderData&&this._assembler&&this._assembler.removeData(this._simulator.renderData)},i.initProperties=function(){this._previewTimer=null,this._focused=!1,this.aspectRatio=1,this._simulator=new u6(this)},i.onFocusInEditor=function(){this._focused=!0;for(var t=E7(this.node),e=0;e<t.length;++e)t[e]._startPreview()},i.onLostFocusInEditor=function(){this._focused=!1;for(var t=E7(this.node),e=0;e<t.length;++e)t[e]._stopPreview()},i._startPreview=function(){this._preview&&this.resetSystem()},i._stopPreview=function(){this._preview&&(this.resetSystem(),this.stopSystem()),this._previewTimer&&clearInterval(this._previewTimer)},i.__preload=function(){t.prototype.__preload.call(this),this._custom&&this.spriteFrame&&!this._renderSpriteFrame?this._applySpriteFrame():this._file&&(this._custom?!this._getTexture()&&this._applyFile():this._applyFile()),this.playOnLoad&&this.resetSystem()},i._flushAssembler=function(){var t=e.Assembler.getAssembler(this);this._assembler!==t&&(this._assembler=t),this._assembler&&this._assembler.createData&&(this._simulator.renderData=this._assembler.createData(this),this._simulator.renderData.particleInitRenderDrawInfo(this.renderEntity),this._simulator.initDrawInfo())},i.lateUpdate=function(t){this._simulator.finished||this._simulator.step(t)},i.addParticle=function(){},i.stopSystem=function(){this._stopped=!0,this._simulator.stop()},i.resetSystem=function(){this._stopped=!1,this._simulator.reset(),this.markForUpdateRenderData()},i.isFull=function(){return this.particleCount>=this.totalParticles},i._applyFile=function(){var t=this._file;if(t){if(!t)return void J(6029);if(!this.isValid)return;this._plistFile=t.nativeUrl,this._custom||(this._spriteFrame!==t.spriteFrame&&(this.spriteFrame=t.spriteFrame),this._initWithDictionary(t._nativeAsset)),this._spriteFrame?!this._renderSpriteFrame&&this._spriteFrame&&this._applySpriteFrame():t.spriteFrame?this.spriteFrame=t.spriteFrame:this._custom&&this._initTextureWithDictionary(t._nativeAsset)}},i._initTextureWithDictionary=function(t){var e,i=this;if(t.spriteFrameUuid){var n=t.spriteFrameUuid;SS.loadAny(n,(function(e,n){e?(t.spriteFrameUuid=void 0,i._initTextureWithDictionary(t),G(e)):i.spriteFrame=n}))}else{var r=Ku(this._plistFile,t.textureFileName||"");if(t.textureFileName)SS.loadRemote(r,(function(e,n){e?(t.textureFileName=void 0,i._initTextureWithDictionary(t),G(e)):i.spriteFrame=n?lL.createWithImage(n):lL.createWithImage(xS.get("white-texture"))}));else if(t.textureImageData){var s=t.textureImageData;if(!(s&&s.length>0))return!1;var a=r;this.file&&(a+="-"+this.file.uuid);var o=SS.assets.get(a);if(!o){var h=T7.unzipBase64AsArray(s,1);if(!h)return q(6030,this._file.name),!1;var u=(e=h).length>8&&137===e[0]&&80===e[1]&&78===e[2]&&71===e[3]&&13===e[4]&&10===e[5]&&26===e[6]&&10===e[7]?A7.PNG:e.length>2&&(73===e[0]&&73===e[1]||77===e[0]&&77===e[1]||255===e[0]&&216===e[1])?A7.TIFF:A7.UNKNOWN;if(u!==A7.TIFF&&u!==A7.PNG)return q(6031,this._file.name),!1;var l=A.document.createElement("canvas");u===A7.PNG?new d6(h).render(l):(this._tiffReader||(this._tiffReader=new p6),this._tiffReader.parseTIFF(h,l)),o=new ld(l),SS.assets.add(a,o)}o||q(6032,this._file.name),this.spriteFrame=o?lL.createWithImage(o):lL.createWithImage(xS.get("white-texture"))}}return!0},i._initWithDictionary=function(t){this._useFile=!0,this.totalParticles=parseInt(t.maxParticles||0),this.life=parseFloat(t.particleLifespan||0),this.lifeVar=parseFloat(t.particleLifespanVariance||0);var e=t.emissionRate;this.emissionRate=e||Math.min(this.totalParticles/this.life,Number.MAX_VALUE),this.duration=parseFloat(t.duration||0),this._srcBlendFactor=parseInt(t.blendFuncSource||zl.SRC_ALPHA),this._dstBlendFactor=parseInt(t.blendFuncDestination||zl.ONE_MINUS_SRC_ALPHA);var i=this._startColor;i.r=255*parseFloat(t.startColorRed||0),i.g=255*parseFloat(t.startColorGreen||0),i.b=255*parseFloat(t.startColorBlue||0),i.a=255*parseFloat(t.startColorAlpha||0);var n=this._startColorVar;n.r=255*parseFloat(t.startColorVarianceRed||0),n.g=255*parseFloat(t.startColorVarianceGreen||0),n.b=255*parseFloat(t.startColorVarianceBlue||0),n.a=255*parseFloat(t.startColorVarianceAlpha||0);var r=this._endColor;r.r=255*parseFloat(t.finishColorRed||0),r.g=255*parseFloat(t.finishColorGreen||0),r.b=255*parseFloat(t.finishColorBlue||0),r.a=255*parseFloat(t.finishColorAlpha||0);var s=this._endColorVar;if(s.r=255*parseFloat(t.finishColorVarianceRed||0),s.g=255*parseFloat(t.finishColorVarianceGreen||0),s.b=255*parseFloat(t.finishColorVarianceBlue||0),s.a=255*parseFloat(t.finishColorVarianceAlpha||0),this.startSize=parseFloat(t.startParticleSize||0),this.startSizeVar=parseFloat(t.startParticleSizeVariance||0),this.endSize=parseFloat(t.finishParticleSize||0),this.endSizeVar=parseFloat(t.finishParticleSizeVariance||0),this.positionType=parseFloat(void 0!==t.positionType?t.positionType:t6.FREE),this.sourcePos.set(0,0),this.posVar.set(parseFloat(t.sourcePositionVariancex||0),parseFloat(t.sourcePositionVariancey||0)),this.angle=parseFloat(t.angle||0),this.angleVar=parseFloat(t.angleVariance||0),this.startSpin=parseFloat(t.rotationStart||0),this.startSpinVar=parseFloat(t.rotationStartVariance||0),this.endSpin=parseFloat(t.rotationEnd||0),this.endSpinVar=parseFloat(t.rotationEndVariance||0),this.emitterMode=parseInt(t.emitterType||$8.GRAVITY),this.emitterMode===$8.GRAVITY){this.gravity.set(parseFloat(t.gravityx||0),parseFloat(t.gravityy||0)),this.speed=parseFloat(t.speed||0),this.speedVar=parseFloat(t.speedVariance||0),this.radialAccel=parseFloat(t.radialAcceleration||0),this.radialAccelVar=parseFloat(t.radialAccelVariance||0),this.tangentialAccel=parseFloat(t.tangentialAcceleration||0),this.tangentialAccelVar=parseFloat(t.tangentialAccelVariance||0);var a=t.rotationIsDir||"";null!==a?(a=a.toString().toLowerCase(),this.rotationIsDir="true"===a||"1"===a):this.rotationIsDir=!1}else{if(this.emitterMode!==$8.RADIUS)return q(6009),!1;this.startRadius=parseFloat(t.maxRadius||0),this.startRadiusVar=parseFloat(t.maxRadiusVariance||0),this.endRadius=parseFloat(t.minRadius||0),this.endRadiusVar=parseFloat(t.minRadiusVariance||0),this.rotatePerS=parseFloat(t.rotatePerSecond||0),this.rotatePerSVar=parseFloat(t.rotatePerSecondVariance||0)}return this._initTextureWithDictionary(t),!0},i._syncAspect=function(){if(this._renderSpriteFrame){var t=this._renderSpriteFrame.rect;this.aspectRatio=t.width/t.height}},i._applySpriteFrame=function(){this._renderSpriteFrame=this._renderSpriteFrame||this._spriteFrame,this._renderSpriteFrame?this._renderSpriteFrame.texture&&(this._simulator&&this._simulator.updateUVs(!0),this._syncAspect(),this._updateMaterial(),this._stopped=!1,this.markForUpdateRenderData()):this.resetSystem()},i._getTexture=function(){return this._renderSpriteFrame&&this._renderSpriteFrame.texture},i._updateMaterial=function(){if(this._customMaterial){this.setMaterial(this._customMaterial,0);var t=this.getRenderMaterial(0).passes[0].blendState.targets[0];this._dstBlendFactor=t.blendDst,this._srcBlendFactor=t.blendSrc}var e=this.getMaterialInstance(0);e&&e.recompileShaders({USE_LOCAL:this._positionType!==t6.FREE}),e&&e.passes.length>0&&this._updateBlendFunc()},i._finishedSimulation=function(){this.resetSystem(),this.stopSystem(),this.markForUpdateRenderData(),this.autoRemoveOnFinish&&this._stopped&&this.node.destroy()},i._canRender=function(){return t.prototype._canRender.call(this)&&!this._stopped&&null!==this._renderSpriteFrame&&void 0!==this._renderSpriteFrame},i._render=function(t){this._positionType===t6.RELATIVE?t.commitComp(this,this._simulator.renderData,this._renderSpriteFrame,this._assembler,this.node.parent):this.positionType===t6.GROUPED?t.commitComp(this,this._simulator.renderData,this._renderSpriteFrame,this._assembler,this.node):t.commitComp(this,this._simulator.renderData,this._renderSpriteFrame,this._assembler,null)},i._updatePositionType=function(){this._positionType===t6.RELATIVE?(this._renderEntity.setRenderTransform(this.node.parent),this._renderEntity.setUseLocal(!0)):this.positionType===t6.GROUPED?(this._renderEntity.setRenderTransform(this.node),this._renderEntity.setUseLocal(!0)):(this._renderEntity.setRenderTransform(null),this._renderEntity.setUseLocal(!1))},n(e,[{key:"custom",get:function(){return this._custom},set:function(t){this._custom!==t&&(this._custom=t,this._applyFile(),this._updateMaterial())}},{key:"file",get:function(){return this._file},set:function(t){this._file!==t&&(this._file=t,t?this._applyFile():this.custom=!0)}},{key:"spriteFrame",get:function(){return this._spriteFrame},set:function(t){this._renderSpriteFrame!==t&&(this._renderSpriteFrame=t,t&&!t._uuid||(this._spriteFrame=t),this._applySpriteFrame())}},{key:"particleCount",get:function(){return this._simulator.particles.length}},{key:"totalParticles",get:function(){return this._totalParticles},set:function(t){this._totalParticles!==t&&(this._totalParticles=t)}},{key:"startColor",get:function(){return this._startColor},set:function(t){this._startColor.r=t.r,this._startColor.g=t.g,this._startColor.b=t.b,this._startColor.a=t.a}},{key:"startColorVar",get:function(){return this._startColorVar},set:function(t){this._startColorVar.r=t.r,this._startColorVar.g=t.g,this._startColorVar.b=t.b,this._startColorVar.a=t.a}},{key:"color",get:function(){return this._color},set:function(){}},{key:"endColor",get:function(){return this._endColor},set:function(t){this._endColor.r=t.r,this._endColor.g=t.g,this._endColor.b=t.b,this._endColor.a=t.a}},{key:"endColorVar",get:function(){return this._endColorVar},set:function(t){this._endColorVar.r=t.r,this._endColorVar.g=t.g,this._endColorVar.b=t.b,this._endColorVar.a=t.a}},{key:"positionType",get:function(){return this._positionType},set:function(t){this._positionType=t,this._updateMaterial(),this._updatePositionType()}},{key:"preview",get:function(){return this._preview},set:function(t){t?this._startPreview():this._stopPreview(),this._preview=t}},{key:"stopped",get:function(){return this._stopped}},{key:"active",get:function(){return this._simulator.active}},{key:"assembler",get:function(){return this._assembler}}]),e}(gk)).EmitterMode=$8,S7.PositionType=t6,S7.DURATION_INFINITY=-1,S7.START_SIZE_EQUAL_TO_END_SIZE=-1,S7.START_RADIUS_EQUAL_TO_END_RADIUS=-1,p((B6=S7).prototype,"file",[b6],Object.getOwnPropertyDescriptor(B6.prototype,"file"),B6.prototype),p(B6.prototype,"spriteFrame",[x6],Object.getOwnPropertyDescriptor(B6.prototype,"spriteFrame"),B6.prototype),D6=Ss(B6.prototype,"duration",[ks],(function(){return-1})),P6=Ss(B6.prototype,"emissionRate",[ks],(function(){return 10})),O6=Ss(B6.prototype,"life",[ks],(function(){return 1})),M6=Ss(B6.prototype,"lifeVar",[ks],(function(){return 0})),p(B6.prototype,"color",[ua],Object.getOwnPropertyDescriptor(B6.prototype,"color"),B6.prototype),N6=Ss(B6.prototype,"angle",[ks],(function(){return 90})),L6=Ss(B6.prototype,"angleVar",[ks],(function(){return 20})),F6=Ss(B6.prototype,"startSize",[ks],(function(){return 50})),k6=Ss(B6.prototype,"startSizeVar",[ks],(function(){return 0})),G6=Ss(B6.prototype,"endSize",[ks],(function(){return 0})),V6=Ss(B6.prototype,"endSizeVar",[ks],(function(){return 0})),U6=Ss(B6.prototype,"startSpin",[ks],(function(){return 0})),z6=Ss(B6.prototype,"startSpinVar",[ks],(function(){return 0})),H6=Ss(B6.prototype,"endSpin",[ks],(function(){return 0})),W6=Ss(B6.prototype,"endSpinVar",[ks],(function(){return 0})),X6=Ss(B6.prototype,"sourcePos",[ks],(function(){return yn.ZERO.clone()})),j6=Ss(B6.prototype,"posVar",[ks],(function(){return yn.ZERO.clone()})),p(B6.prototype,"positionType",[C6],Object.getOwnPropertyDescriptor(B6.prototype,"positionType"),B6.prototype),Y6=Ss(B6.prototype,"emitterMode",[ks,R6],(function(){return $8.GRAVITY})),q6=Ss(B6.prototype,"gravity",[ks],(function(){return yn.ZERO.clone()})),K6=Ss(B6.prototype,"speed",[ks],(function(){return 180})),J6=Ss(B6.prototype,"speedVar",[ks],(function(){return 50})),Q6=Ss(B6.prototype,"tangentialAccel",[ks],(function(){return 80})),Z6=Ss(B6.prototype,"tangentialAccelVar",[ks],(function(){return 0})),$6=Ss(B6.prototype,"radialAccel",[ks],(function(){return 0})),t7=Ss(B6.prototype,"radialAccelVar",[ks],(function(){return 0})),e7=Ss(B6.prototype,"rotationIsDir",[ks],(function(){return!1})),i7=Ss(B6.prototype,"startRadius",[ks],(function(){return 0})),n7=Ss(B6.prototype,"startRadiusVar",[ks],(function(){return 0})),r7=Ss(B6.prototype,"endRadius",[ks],(function(){return 0})),s7=Ss(B6.prototype,"endRadiusVar",[ks],(function(){return 0})),a7=Ss(B6.prototype,"rotatePerS",[ks],(function(){return 0})),o7=Ss(B6.prototype,"rotatePerSVar",[ks],(function(){return 0})),h7=Ss(B6.prototype,"playOnLoad",[ks],(function(){return!0})),u7=Ss(B6.prototype,"autoRemoveOnFinish",[ks],(function(){return!1})),l7=Ss(B6.prototype,"_preview",[w6],(function(){return!0})),c7=Ss(B6.prototype,"_custom",[ks],(function(){return!1})),_7=Ss(B6.prototype,"_file",[ks],(function(){return null})),f7=Ss(B6.prototype,"_spriteFrame",[ks],(function(){return null})),d7=Ss(B6.prototype,"_totalParticles",[ks],(function(){return 150})),p7=Ss(B6.prototype,"_startColor",[ks],(function(){return new Zi(255,255,255,255)})),m7=Ss(B6.prototype,"_startColorVar",[ks],(function(){return new Zi(0,0,0,0)})),g7=Ss(B6.prototype,"_endColor",[ks],(function(){return new Zi(255,255,255,0)})),y7=Ss(B6.prototype,"_endColorVar",[ks],(function(){return new Zi(0,0,0,0)})),v7=Ss(B6.prototype,"_positionType",[ks],(function(){return t6.FREE})),I6=B6))||I6)),L7=function(){function t(t,e){this.point=new yn,this.dir=new yn,this.distance=0,this.time=0,t&&this.point.set(t),e&&this.dir.set(e)}var e=t.prototype;return e.setPoint=function(t,e){this.point.x=t,this.point.y=e},e.setDir=function(t,e){this.dir.x=t,this.dir.y=e},t}(),F7=t("eF",(b7=Is("cc.MotionStreak"),x7=ha(Mp),b7(((M7=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._preview=w7&&w7(),e._fadeTime=I7&&I7(),e._minSeg=B7&&B7(),e._stroke=D7&&D7(),e._texture=P7&&P7(),e._fastMode=O7&&O7(),e._points=[],e}s(e,t);var i=e.prototype;return i.onEnable=function(){t.prototype.onEnable.call(this),this.reset()},i._flushAssembler=function(){var t=e.Assembler.getAssembler(this);this._assembler!==t&&(this._assembler=t),this._renderData||this._assembler&&this._assembler.createData&&(this._renderData=this._assembler.createData(this),this._renderData.material=this.material,this._updateColor())},i.onFocusInEditor=function(){this._preview&&this.reset()},i.onLostFocusInEditor=function(){this._preview&&this.reset()},i.reset=function(){this._points.length=0,this._renderData&&this._renderData.clear()},i.lateUpdate=function(t){this._assembler&&this._assembler.update(this,t)},i._render=function(t){t.commitComp(this,this._renderData,this._texture,this._assembler,null)},n(e,[{key:"preview",get:function(){return this._preview},set:function(t){this._preview=t,this.reset()}},{key:"fadeTime",get:function(){return this._fadeTime},set:function(t){this._fadeTime=t,this.reset()}},{key:"minSeg",get:function(){return this._minSeg},set:function(t){this._minSeg=t}},{key:"stroke",get:function(){return this._stroke},set:function(t){this._stroke=t}},{key:"texture",get:function(){return this._texture},set:function(t){this._texture!==t&&(this._texture=t)}},{key:"fastMode",get:function(){return this._fastMode},set:function(t){this._fastMode=t}},{key:"points",get:function(){return this._points}}]),e}(gk)).Point=L7,p((R7=M7).prototype,"texture",[x7],Object.getOwnPropertyDescriptor(R7.prototype,"texture"),R7.prototype),w7=Ss(R7.prototype,"_preview",[ks],(function(){return!1})),I7=Ss(R7.prototype,"_fadeTime",[ks],(function(){return 1})),B7=Ss(R7.prototype,"_minSeg",[ks],(function(){return 1})),D7=Ss(R7.prototype,"_stroke",[ks],(function(){return 64})),P7=Ss(R7.prototype,"_texture",[ks],(function(){return null})),O7=Ss(R7.prototype,"_fastMode",[ks],(function(){return!1})),C7=R7))||C7));new yn;var k7,G7=new yn,V7=new yn;function U7(t,e){return t.x=-e.y,t.y=e.x,t}var z7={createData:function(t){var e=t.requestRenderData();return e.dataLength=4,e.resize(16,42),e},update:function(t,e){var i,n=t.stroke/2,r=t.node.worldMatrix,s=r.m12,a=r.m13,o=t.points;if(o.length>1){var h=o[0],u=h.point.x-s,l=h.point.y-a;u*u+l*l<t.minSeg&&(i=h)}i||(i=new F7.Point,o.unshift(i)),i.setPoint(s,a),i.time=t.fadeTime+e;var c,_=0;if(!(o.length<2)){var f=t.renderData;this.updateRenderDataCache(t,f);var d=t.color,p=d.r,m=d.g,g=d.b,y=d.a,v=o[1];v.distance=yn.subtract(V7,i.point,v.point).length(),V7.normalize(),v.setDir(V7.x,V7.y),i.setDir(V7.x,V7.y),f.dataLength=2*o.length;for(var S=f.data,A=t.fadeTime,T=!1,E=o.length-1;E>=0;E--){var b=o[E],x=b.point,C=b.dir;if(b.time-=e,b.time<0)o.splice(E,1);else{var R=b.time/A,w=o[E-1];if(!T){if(!w){o.splice(E,1);continue}x.x=w.point.x-C.x*R,x.y=w.point.y-C.y*R}T=!0,U7(G7,C);var I=(R*y<<24>>>0)+(g<<16)+(m<<8)+p,B=_;S[B].x=x.x+G7.x*n,S[B].y=x.y+G7.y*n,S[B].u=1,S[B].v=R,S[B].color._val=I,S[B+=1].x=x.x-G7.x*n,S[B].y=x.y-G7.y*n,S[B].u=0,S[B].v=R,S[B].color._val=I,_+=2}}c=_<=2?0:3*(_-2),f.resize(_,c)}},updateWorldVertexAllData: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+0]=n[s].x,r[a+1]=n[s].y,r[a+2]=n[s].z,r[a+3]=n[s].u,r[a+4]=n[s].v,Zi.toArray(r,n[s].color,a+5)}},createQuadIndices:function(t,e){var i=t.renderData.chunk.meshBuffer.indexOffset;k7=null,k7=new Uint16Array(e);for(var n=0,r=e;n<r;n+=2){var s=0+n;k7[i++]=s,k7[i++]=s+2,k7[i++]=s+1,k7[i++]=s+1,k7[i++]=s+2,k7[i++]=s+3}},updateRenderDataCache:function(t,e){e.passDirty&&e.updatePass(t),e.nodeDirty&&e.updateNode(t),e.textureDirty&&t.texture&&(e.updateTexture(t.texture),e.material=t.getRenderMaterial(0)),e.hashDirty&&e.updateHash()},updateRenderData:function(){},updateColor:function(){},fillBuffers:function(t){for(var e=t.renderData,i=e.chunk,n=e.data,r=e.vertexCount,s=e.indexCount,a=i.vb,o=0,h=0;h<r;h++){var u=n[h];a[o++]=u.x,a[o++]=u.y,a[o++]=u.z,a[o++]=u.u,a[o++]=u.v,Zi.toArray(a,u.color,o),o+=4}i.bufferId;for(var l=i.vertexOffset,c=i.meshBuffer,_=i.meshBuffer.iData,f=c.indexOffset,d=0,p=s;d<p;d+=2){var m=l+d;_[f++]=m,_[f++]=m+2,_[f++]=m+1,_[f++]=m+1,_[f++]=m+2,_[f++]=m+3}c.indexOffset+=e.indexCount,c.setDirty()}},H7=t("eG",{getAssembler:function(){return z7}});F7.Assembler=H7;var W7,X7,j7,Y7,q7,K7={maxParticleDeltaTime:0,createData:function(){return kF.add()},removeData:function(t){kF.remove(t)},updateRenderData:function(){},fillBuffers:function(){}},J7=t("eH",{getAssembler:function(){return K7.maxParticleDeltaTime||(K7.maxParticleDeltaTime=v.game.frameTime/1e3*2),K7}});N7.Assembler=J7,t("eK",W7),function(t){t[t.Static=0]="Static",t[t.Kinematic=1]="Kinematic",t[t.Dynamic=2]="Dynamic",t[t.Animated=3]="Animated"}(W7||t("eK",W7={})),me(W7),t("eL",X7),function(t){t[t.None=0]="None",t[t.BOX=1]="BOX",t[t.CIRCLE=2]="CIRCLE",t[t.POLYGON=3]="POLYGON"}(X7||t("eL",X7={})),me(X7),t("eM",j7),function(t){t[t.None=0]="None",t[t.DISTANCE=1]="DISTANCE",t[t.SPRING=2]="SPRING",t[t.WHEEL=3]="WHEEL",t[t.MOUSE=4]="MOUSE",t[t.FIXED=5]="FIXED",t[t.SLIDER=6]="SLIDER",t[t.RELATIVE=7]="RELATIVE",t[t.HINGE=8]="HINGE"}(j7||t("eM",j7={})),me(j7),t("eN",Y7),function(t){t[t.DEFAULT=1]="DEFAULT"}(Y7||t("eN",Y7={})),me(Y7),t("eO",q7),function(t){t[t.Closest=0]="Closest",t[t.Any=1]="Any",t[t.AllClosest=2]="AllClosest",t[t.All=3]="All"}(q7||t("eO",q7={}));var Q7,Z7=t("eP",{None:"none-contact",BEGIN_CONTACT:"begin-contact",END_CONTACT:"end-contact",PRE_SOLVE:"pre-solve",POST_SOLVE:"post-solve"});t("eQ",Q7),function(t){t[t.None=0]="None",t[t.Shape=1]="Shape",t[t.Joint=2]="Joint",t[t.Aabb=4]="Aabb",t[t.Pair=8]="Pair",t[t.CenterOfMass=16]="CenterOfMass",t[t.Particle=32]="Particle",t[t.Controller=64]="Controller",t[t.All=63]="All"}(Q7||t("eQ",Q7={}));var $7=t("eR",32),t9={id:"",switchTo:function(t){var e=t9;t9.physicsWorld&&t!==t9.id&&null!=t9.backend[t]?(console.info("[PHYSICS2D]: switch from "+t9.id+" to "+t+"."),e.id=t,e.wrapper=t9.backend[t],e.physicsWorld=i9()):(console.info("[PHYSICS2D]: using "+e.id+"."),e.physicsWorld=i9())},register:function(t,e){if(console.info("[PHYSICS2D]: register "+t+"."),t9.backend[t]=e,!t9.physicsWorld||t9.id===t){var i=t9;i.id=t,i.wrapper=e}},wrapper:{},backend:{},physicsWorld:null,runInEditor:!0},e9=function(){return 0};function i9(){return new t9.wrapper.PhysicsWorld}var n9={impl:null,rigidBody:null,isAwake:!1,isSleeping:!1,initialize:e9,setType:e9,setLinearDamping:e9,setAngularDamping:e9,setGravityScale:e9,setFixedRotation:e9,setAllowSleep:e9,isActive:e9,setActive:e9,wakeUp:e9,sleep:e9,getMass:e9,getInertia:e9,getLinearVelocity:e9,setLinearVelocity:e9,getLinearVelocityFromWorldPoint:e9,getAngularVelocity:e9,setAngularVelocity:e9,getLocalVector:e9,getWorldVector:e9,getLocalPoint:e9,getWorldPoint:e9,getLocalCenter:e9,getWorldCenter:e9,applyForce:e9,applyForceToCenter:e9,applyTorque:e9,applyLinearImpulse:e9,applyLinearImpulseToCenter:e9,applyAngularImpulse:e9,onEnable:e9,onDisable:e9,onDestroy:e9},r9={INITED:!1};var s9={INITED:!1},a9={impl:null,initialize:e9,setDampingRatio:e9,setFrequency:e9,setMaxForce:e9,setTarget:e9,setDistance:e9,setAngularOffset:e9,setCorrectionFactor:e9,setLinearOffset:e9,setMaxLength:e9,setMaxTorque:e9,setLowerLimit:e9,setUpperLimit:e9,setMaxMotorForce:e9,setMaxMotorTorque:e9,setMotorSpeed:e9,enableLimit:e9,enableMotor:e9,setLowerAngle:e9,setUpperAngle:e9};"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var o9,h9=function(t,e){return function(t){function e(t){if(!t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];throw u(Error,i)}}function i(t,e){return void 0!==t?t:e}var r=1e37,a=1e-5,o=a*a,h=3.14159265359,l=2,c=8,_=.1,d=2,p=.008,m=2/180*h,g=2*p,y=8,v=32,S=1,A=.2,T=8/180*h,E=2,b=E*E,x=.5*h,C=x*x,R=.2,w=.75,I=-1,B=2147483647,D=.75,P=1,O=.25,M=.5,N=2,L=N*N,F=256,k=2.5,G=.5,V=.01,U=2/180*h;function z(){return null}function H(){}function W(){}var X=function(){function t(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this.major=0,this.minor=0,this.revision=0,this.major=t,this.minor=e,this.revision=i}return t.prototype.toString=function(){return this.major+"."+this.minor+"."+this.revision},t}(),j=new X(2,3,2),Y="master",q="fbf51801d80fc389d43dc46524520e89043b6faf";function K(t){return parseInt(t,10)}function J(t){return Math.abs(parseInt(t,10))}function Q(t,e){for(var i=new Array(t),n=0;n<t;++n)i[n]=e(n);return i}function Z(t){for(var e=new Array(t),i=0;i<t;++i)e[i]=null;return e}function $(t,e){void 0===e&&(e=0);for(var i=new Array(t),n=0;n<t;++n)i[n]=e;return i}var tt=h/180,et=180/h,it=2*h,nt=Math.abs;function rt(t,e){return t<e?t:e}function st(t,e){return t>e?t:e}function at(t,e,i){return t<e?e:t>i?i:t}function ot(t,e){var i=t[0];t[0]=e[0],e[0]=i}var ht=isFinite;function ut(t){return t*t}function lt(t){return 1/Math.sqrt(t)}var ct=Math.sqrt,_t=Math.pow;function ft(t){return t*tt}function dt(t){return t*et}var pt=Math.cos,mt=Math.sin,gt=Math.acos,yt=Math.asin,vt=Math.atan2;function St(t){return t|=t>>1&2147483647,t|=t>>2&1073741823,t|=t>>4&268435455,1+((t|=t>>8&16777215)|t>>16&65535)}function At(t){return t>0&&0==(t&t-1)}function Tt(){return 2*Math.random()-1}function Et(t,e){return(e-t)*Math.random()+t}var bt=function(){function t(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];if(e[0]instanceof Float32Array){if(2!==e[0].length)throw new Error;this.data=e[0]}else{var n="number"==typeof e[0]?e[0]:0,r="number"==typeof e[1]?e[1]:0;this.data=new Float32Array([n,r])}}var e=t.prototype;return e.Clone=function(){return new t(this.x,this.y)},e.SetZero=function(){return this.x=0,this.y=0,this},e.Set=function(t,e){return this.x=t,this.y=e,this},e.Copy=function(t){return this.x=t.x,this.y=t.y,this},e.SelfAdd=function(t){return this.x+=t.x,this.y+=t.y,this},e.SelfAddXY=function(t,e){return this.x+=t,this.y+=e,this},e.SelfSub=function(t){return this.x-=t.x,this.y-=t.y,this},e.SelfSubXY=function(t,e){return this.x-=t,this.y-=e,this},e.SelfMul=function(t){return this.x*=t,this.y*=t,this},e.SelfMulAdd=function(t,e){return this.x+=t*e.x,this.y+=t*e.y,this},e.SelfMulSub=function(t,e){return this.x-=t*e.x,this.y-=t*e.y,this},e.Dot=function(t){return this.x*t.x+this.y*t.y},e.Cross=function(t){return this.x*t.y-this.y*t.x},e.Length=function(){var t=this.x,e=this.y;return Math.sqrt(t*t+e*e)},e.LengthSquared=function(){var t=this.x,e=this.y;return t*t+e*e},e.Normalize=function(){var t=this.Length();if(t>=a){var e=1/t;this.x*=e,this.y*=e}return t},e.SelfNormalize=function(){var t=this.Length();if(t>=a){var e=1/t;this.x*=e,this.y*=e}return this},e.SelfRotate=function(t){var e=Math.cos(t),i=Math.sin(t),n=this.x;return this.x=e*n-i*this.y,this.y=i*n+e*this.y,this},e.SelfRotateCosSin=function(t,e){var i=this.x;return this.x=t*i-e*this.y,this.y=e*i+t*this.y,this},e.IsValid=function(){return isFinite(this.x)&&isFinite(this.y)},e.SelfCrossVS=function(t){var e=this.x;return this.x=t*this.y,this.y=-t*e,this},e.SelfCrossSV=function(t){var e=this.x;return this.x=-t*this.y,this.y=t*e,this},e.SelfMinV=function(t){return this.x=rt(this.x,t.x),this.y=rt(this.y,t.y),this},e.SelfMaxV=function(t){return this.x=st(this.x,t.x),this.y=st(this.y,t.y),this},e.SelfAbs=function(){return this.x=nt(this.x),this.y=nt(this.y),this},e.SelfNeg=function(){return this.x=-this.x,this.y=-this.y,this},e.SelfSkew=function(){var t=this.x;return this.x=-this.y,this.y=t,this},t.MakeArray=function(e){return Q(e,(function(){return new t}))},t.AbsV=function(t,e){return e.x=nt(t.x),e.y=nt(t.y),e},t.MinV=function(t,e,i){return i.x=rt(t.x,e.x),i.y=rt(t.y,e.y),i},t.MaxV=function(t,e,i){return i.x=st(t.x,e.x),i.y=st(t.y,e.y),i},t.ClampV=function(t,e,i,n){return n.x=at(t.x,e.x,i.x),n.y=at(t.y,e.y,i.y),n},t.RotateV=function(t,e,i){var n=t.x,r=t.y,s=Math.cos(e),a=Math.sin(e);return i.x=s*n-a*r,i.y=a*n+s*r,i},t.DotVV=function(t,e){return t.x*e.x+t.y*e.y},t.CrossVV=function(t,e){return t.x*e.y-t.y*e.x},t.CrossVS=function(t,e,i){var n=t.x;return i.x=e*t.y,i.y=-e*n,i},t.CrossVOne=function(t,e){var i=t.x;return e.x=t.y,e.y=-i,e},t.CrossSV=function(t,e,i){var n=e.x;return i.x=-t*e.y,i.y=t*n,i},t.CrossOneV=function(t,e){var i=t.x;return e.x=-t.y,e.y=i,e},t.AddVV=function(t,e,i){return i.x=t.x+e.x,i.y=t.y+e.y,i},t.SubVV=function(t,e,i){return i.x=t.x-e.x,i.y=t.y-e.y,i},t.MulSV=function(t,e,i){return i.x=e.x*t,i.y=e.y*t,i},t.MulVS=function(t,e,i){return i.x=t.x*e,i.y=t.y*e,i},t.AddVMulSV=function(t,e,i,n){return n.x=t.x+e*i.x,n.y=t.y+e*i.y,n},t.SubVMulSV=function(t,e,i,n){return n.x=t.x-e*i.x,n.y=t.y-e*i.y,n},t.AddVCrossSV=function(t,e,i,n){var r=i.x;return n.x=t.x-e*i.y,n.y=t.y+e*r,n},t.MidVV=function(t,e,i){return i.x=.5*(t.x+e.x),i.y=.5*(t.y+e.y),i},t.ExtVV=function(t,e,i){return i.x=.5*(e.x-t.x),i.y=.5*(e.y-t.y),i},t.IsEqualToV=function(t,e){return t.x===e.x&&t.y===e.y},t.DistanceVV=function(t,e){var i=t.x-e.x,n=t.y-e.y;return Math.sqrt(i*i+n*n)},t.DistanceSquaredVV=function(t,e){var i=t.x-e.x,n=t.y-e.y;return i*i+n*n},t.NegV=function(t,e){return e.x=-t.x,e.y=-t.y,e},n(t,[{key:"x",get:function(){return this.data[0]},set:function(t){this.data[0]=t}},{key:"y",get:function(){return this.data[1]},set:function(t){this.data[1]=t}}]),t}();bt.ZERO=new bt(0,0),bt.UNITX=new bt(1,0),bt.UNITY=new bt(0,1),bt.s_t0=new bt,bt.s_t1=new bt,bt.s_t2=new bt,bt.s_t3=new bt;var xt=new bt(0,0),Ct=function(){function t(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];if(e[0]instanceof Float32Array){if(3!==e[0].length)throw new Error;this.data=e[0]}else{var n="number"==typeof e[0]?e[0]:0,r="number"==typeof e[1]?e[1]:0,s="number"==typeof e[2]?e[2]:0;this.data=new Float32Array([n,r,s])}}var e=t.prototype;return e.Clone=function(){return new t(this.x,this.y,this.z)},e.SetZero=function(){return this.x=0,this.y=0,this.z=0,this},e.SetXYZ=function(t,e,i){return this.x=t,this.y=e,this.z=i,this},e.Copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},e.SelfNeg=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},e.SelfAdd=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this},e.SelfAddXYZ=function(t,e,i){return this.x+=t,this.y+=e,this.z+=i,this},e.SelfSub=function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this},e.SelfSubXYZ=function(t,e,i){return this.x-=t,this.y-=e,this.z-=i,this},e.SelfMul=function(t){return this.x*=t,this.y*=t,this.z*=t,this},t.DotV3V3=function(t,e){return t.x*e.x+t.y*e.y+t.z*e.z},t.CrossV3V3=function(t,e,i){var n=t.x,r=t.y,s=t.z,a=e.x,o=e.y,h=e.z;return i.x=r*h-s*o,i.y=s*a-n*h,i.z=n*o-r*a,i},n(t,[{key:"x",get:function(){return this.data[0]},set:function(t){this.data[0]=t}},{key:"y",get:function(){return this.data[1]},set:function(t){this.data[1]=t}},{key:"z",get:function(){return this.data[2]},set:function(t){this.data[2]=t}}]),t}();Ct.ZERO=new Ct(0,0,0),Ct.s_t0=new Ct;var Rt=function(){function t(){this.data=new Float32Array([1,0,0,1]),this.ex=new bt(this.data.subarray(0,2)),this.ey=new bt(this.data.subarray(2,4))}var e=t.prototype;return e.Clone=function(){return(new t).Copy(this)},t.FromVV=function(e,i){return(new t).SetVV(e,i)},t.FromSSSS=function(e,i,n,r){return(new t).SetSSSS(e,i,n,r)},t.FromAngle=function(e){return(new t).SetAngle(e)},e.SetSSSS=function(t,e,i,n){return this.ex.Set(t,i),this.ey.Set(e,n),this},e.SetVV=function(t,e){return this.ex.Copy(t),this.ey.Copy(e),this},e.SetAngle=function(t){var e=Math.cos(t),i=Math.sin(t);return this.ex.Set(e,i),this.ey.Set(-i,e),this},e.Copy=function(t){return this.ex.Copy(t.ex),this.ey.Copy(t.ey),this},e.SetIdentity=function(){return this.ex.Set(1,0),this.ey.Set(0,1),this},e.SetZero=function(){return this.ex.SetZero(),this.ey.SetZero(),this},e.GetAngle=function(){return Math.atan2(this.ex.y,this.ex.x)},e.GetInverse=function(t){var e=this.ex.x,i=this.ey.x,n=this.ex.y,r=this.ey.y,s=e*r-i*n;return 0!==s&&(s=1/s),t.ex.x=s*r,t.ey.x=-s*i,t.ex.y=-s*n,t.ey.y=s*e,t},e.Solve=function(t,e,i){var n=this.ex.x,r=this.ey.x,s=this.ex.y,a=this.ey.y,o=n*a-r*s;return 0!==o&&(o=1/o),i.x=o*(a*t-r*e),i.y=o*(n*e-s*t),i},e.SelfAbs=function(){return this.ex.SelfAbs(),this.ey.SelfAbs(),this},e.SelfInv=function(){return this.GetInverse(this),this},e.SelfAddM=function(t){return this.ex.SelfAdd(t.ex),this.ey.SelfAdd(t.ey),this},e.SelfSubM=function(t){return this.ex.SelfSub(t.ex),this.ey.SelfSub(t.ey),this},t.AbsM=function(t,e){var i=t.ex,n=t.ey;return e.ex.x=nt(i.x),e.ex.y=nt(i.y),e.ey.x=nt(n.x),e.ey.y=nt(n.y),e},t.MulMV=function(t,e,i){var n=t.ex,r=t.ey,s=e.x,a=e.y;return i.x=n.x*s+r.x*a,i.y=n.y*s+r.y*a,i},t.MulTMV=function(t,e,i){var n=t.ex,r=t.ey,s=e.x,a=e.y;return i.x=n.x*s+n.y*a,i.y=r.x*s+r.y*a,i},t.AddMM=function(t,e,i){var n=t.ex,r=t.ey,s=e.ex,a=e.ey;return i.ex.x=n.x+s.x,i.ex.y=n.y+s.y,i.ey.x=r.x+a.x,i.ey.y=r.y+a.y,i},t.MulMM=function(t,e,i){var n=t.ex.x,r=t.ex.y,s=t.ey.x,a=t.ey.y,o=e.ex.x,h=e.ex.y,u=e.ey.x,l=e.ey.y;return i.ex.x=n*o+s*h,i.ex.y=r*o+a*h,i.ey.x=n*u+s*l,i.ey.y=r*u+a*l,i},t.MulTMM=function(t,e,i){var n=t.ex.x,r=t.ex.y,s=t.ey.x,a=t.ey.y,o=e.ex.x,h=e.ex.y,u=e.ey.x,l=e.ey.y;return i.ex.x=n*o+r*h,i.ex.y=s*o+a*h,i.ey.x=n*u+r*l,i.ey.y=s*u+a*l,i},t}();Rt.IDENTITY=new Rt;var wt=function(){function t(){this.data=new Float32Array([1,0,0,0,1,0,0,0,1]),this.ex=new Ct(this.data.subarray(0,3)),this.ey=new Ct(this.data.subarray(3,6)),this.ez=new Ct(this.data.subarray(6,9))}var e=t.prototype;return e.Clone=function(){return(new t).Copy(this)},e.SetVVV=function(t,e,i){return this.ex.Copy(t),this.ey.Copy(e),this.ez.Copy(i),this},e.Copy=function(t){return this.ex.Copy(t.ex),this.ey.Copy(t.ey),this.ez.Copy(t.ez),this},e.SetIdentity=function(){return this.ex.SetXYZ(1,0,0),this.ey.SetXYZ(0,1,0),this.ez.SetXYZ(0,0,1),this},e.SetZero=function(){return this.ex.SetZero(),this.ey.SetZero(),this.ez.SetZero(),this},e.SelfAddM=function(t){return this.ex.SelfAdd(t.ex),this.ey.SelfAdd(t.ey),this.ez.SelfAdd(t.ez),this},e.Solve33=function(t,e,i,n){var r=this.ex.x,s=this.ex.y,a=this.ex.z,o=this.ey.x,h=this.ey.y,u=this.ey.z,l=this.ez.x,c=this.ez.y,_=this.ez.z,f=r*(h*_-u*c)+s*(u*l-o*_)+a*(o*c-h*l);return 0!==f&&(f=1/f),n.x=f*(t*(h*_-u*c)+e*(u*l-o*_)+i*(o*c-h*l)),n.y=f*(r*(e*_-i*c)+s*(i*l-t*_)+a*(t*c-e*l)),n.z=f*(r*(h*i-u*e)+s*(u*t-o*i)+a*(o*e-h*t)),n},e.Solve22=function(t,e,i){var n=this.ex.x,r=this.ey.x,s=this.ex.y,a=this.ey.y,o=n*a-r*s;return 0!==o&&(o=1/o),i.x=o*(a*t-r*e),i.y=o*(n*e-s*t),i},e.GetInverse22=function(t){var e=this.ex.x,i=this.ey.x,n=this.ex.y,r=this.ey.y,s=e*r-i*n;0!==s&&(s=1/s),t.ex.x=s*r,t.ey.x=-s*i,t.ex.z=0,t.ex.y=-s*n,t.ey.y=s*e,t.ey.z=0,t.ez.x=0,t.ez.y=0,t.ez.z=0},e.GetSymInverse33=function(t){var e=Ct.DotV3V3(this.ex,Ct.CrossV3V3(this.ey,this.ez,Ct.s_t0));0!==e&&(e=1/e);var i=this.ex.x,n=this.ey.x,r=this.ez.x,s=this.ey.y,a=this.ez.y,o=this.ez.z;t.ex.x=e*(s*o-a*a),t.ex.y=e*(r*a-n*o),t.ex.z=e*(n*a-r*s),t.ey.x=t.ex.y,t.ey.y=e*(i*o-r*r),t.ey.z=e*(r*n-i*a),t.ez.x=t.ex.z,t.ez.y=t.ey.z,t.ez.z=e*(i*s-n*n)},t.MulM33V3=function(t,e,i){var n=e.x,r=e.y,s=e.z;return i.x=t.ex.x*n+t.ey.x*r+t.ez.x*s,i.y=t.ex.y*n+t.ey.y*r+t.ez.y*s,i.z=t.ex.z*n+t.ey.z*r+t.ez.z*s,i},t.MulM33XYZ=function(t,e,i,n,r){return r.x=t.ex.x*e+t.ey.x*i+t.ez.x*n,r.y=t.ex.y*e+t.ey.y*i+t.ez.y*n,r.z=t.ex.z*e+t.ey.z*i+t.ez.z*n,r},t.MulM33V2=function(t,e,i){var n=e.x,r=e.y;return i.x=t.ex.x*n+t.ey.x*r,i.y=t.ex.y*n+t.ey.y*r,i},t.MulM33XY=function(t,e,i,n){return n.x=t.ex.x*e+t.ey.x*i,n.y=t.ex.y*e+t.ey.y*i,n},t}();wt.IDENTITY=new wt;var It=function(){function t(t){void 0===t&&(t=0),this.s=0,this.c=1,t&&(this.s=Math.sin(t),this.c=Math.cos(t))}var e=t.prototype;return e.Clone=function(){return(new t).Copy(this)},e.Copy=function(t){return this.s=t.s,this.c=t.c,this},e.SetAngle=function(t){return this.s=Math.sin(t),this.c=Math.cos(t),this},e.SetIdentity=function(){return this.s=0,this.c=1,this},e.GetAngle=function(){return Math.atan2(this.s,this.c)},e.GetXAxis=function(t){return t.x=this.c,t.y=this.s,t},e.GetYAxis=function(t){return t.x=-this.s,t.y=this.c,t},t.MulRR=function(t,e,i){var n=t.c,r=t.s,s=e.c,a=e.s;return i.s=r*s+n*a,i.c=n*s-r*a,i},t.MulTRR=function(t,e,i){var n=t.c,r=t.s,s=e.c,a=e.s;return i.s=n*a-r*s,i.c=n*s+r*a,i},t.MulRV=function(t,e,i){var n=t.c,r=t.s,s=e.x,a=e.y;return i.x=n*s-r*a,i.y=r*s+n*a,i},t.MulTRV=function(t,e,i){var n=t.c,r=t.s,s=e.x,a=e.y;return i.x=n*s+r*a,i.y=-r*s+n*a,i},t}();It.IDENTITY=new It;var Bt=function(){function t(){this.p=new bt,this.q=new It}var e=t.prototype;return e.Clone=function(){return(new t).Copy(this)},e.Copy=function(t){return this.p.Copy(t.p),this.q.Copy(t.q),this},e.SetIdentity=function(){return this.p.SetZero(),this.q.SetIdentity(),this},e.SetPositionRotation=function(t,e){return this.p.Copy(t),this.q.Copy(e),this},e.SetPositionAngle=function(t,e){return this.p.Copy(t),this.q.SetAngle(e),this},e.SetPosition=function(t){return this.p.Copy(t),this},e.SetPositionXY=function(t,e){return this.p.Set(t,e),this},e.SetRotation=function(t){return this.q.Copy(t),this},e.SetRotationAngle=function(t){return this.q.SetAngle(t),this},e.GetPosition=function(){return this.p},e.GetRotation=function(){return this.q},e.GetRotationAngle=function(){return this.q.GetAngle()},e.GetAngle=function(){return this.q.GetAngle()},t.MulXV=function(t,e,i){var n=t.q.c,r=t.q.s,s=e.x,a=e.y;return i.x=n*s-r*a+t.p.x,i.y=r*s+n*a+t.p.y,i},t.MulTXV=function(t,e,i){var n=t.q.c,r=t.q.s,s=e.x-t.p.x,a=e.y-t.p.y;return i.x=n*s+r*a,i.y=-r*s+n*a,i},t.MulXX=function(t,e,i){return It.MulRR(t.q,e.q,i.q),bt.AddVV(It.MulRV(t.q,e.p,i.p),t.p,i.p),i},t.MulTXX=function(t,e,i){return It.MulTRR(t.q,e.q,i.q),It.MulTRV(t.q,bt.SubVV(e.p,t.p,i.p),i.p),i},t}();Bt.IDENTITY=new Bt;var Dt,Pt=function(){function t(){this.localCenter=new bt,this.c0=new bt,this.c=new bt,this.a0=0,this.a=0,this.alpha0=0}var e=t.prototype;return e.Clone=function(){return(new t).Copy(this)},e.Copy=function(t){return this.localCenter.Copy(t.localCenter),this.c0.Copy(t.c0),this.c.Copy(t.c),this.a0=t.a0,this.a=t.a,this.alpha0=t.alpha0,this},e.GetTransform=function(t,e){var i=1-e;t.p.x=i*this.c0.x+e*this.c.x,t.p.y=i*this.c0.y+e*this.c.y;var n=i*this.a0+e*this.a;return t.q.SetAngle(n),t.p.SelfSub(It.MulRV(t.q,this.localCenter,bt.s_t0)),t},e.Advance=function(t){var e=(t-this.alpha0)/(1-this.alpha0),i=1-e;this.c0.x=i*this.c0.x+e*this.c.x,this.c0.y=i*this.c0.y+e*this.c.y,this.a0=i*this.a0+e*this.a,this.alpha0=t},e.Normalize=function(){var t=it*Math.floor(this.a0/it);this.a0-=t,this.a-=t},t}(),Ot=function(){function t(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];if(e[0]instanceof Float32Array){if(4!==e[0].length)throw new Error;this.data=e[0]}else{var n="number"==typeof e[0]?e[0]:.5,r="number"==typeof e[1]?e[1]:.5,s="number"==typeof e[2]?e[2]:.5,a="number"==typeof e[3]?e[3]:1;this.data=new Float32Array([n,r,s,a])}}var e=t.prototype;return e.Clone=function(){return(new t).Copy(this)},e.Copy=function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this},e.IsEqual=function(t){return this.r===t.r&&this.g===t.g&&this.b===t.b&&this.a===t.a},e.IsZero=function(){return 0===this.r&&0===this.g&&0===this.b&&0===this.a},e.Set=function(t,e,i,n){void 0===n&&(n=this.a),this.SetRGBA(t,e,i,n)},e.SetByteRGB=function(t,e,i){return this.r=t/255,this.g=e/255,this.b=i/255,this},e.SetByteRGBA=function(t,e,i,n){return this.r=t/255,this.g=e/255,this.b=i/255,this.a=n/255,this},e.SetRGB=function(t,e,i){return this.r=t,this.g=e,this.b=i,this},e.SetRGBA=function(t,e,i,n){return this.r=t,this.g=e,this.b=i,this.a=n,this},e.SelfAdd=function(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this.a+=t.a,this},e.Add=function(t,e){return e.r=this.r+t.r,e.g=this.g+t.g,e.b=this.b+t.b,e.a=this.a+t.a,e},e.SelfSub=function(t){return this.r-=t.r,this.g-=t.g,this.b-=t.b,this.a-=t.a,this},e.Sub=function(t,e){return e.r=this.r-t.r,e.g=this.g-t.g,e.b=this.b-t.b,e.a=this.a-t.a,e},e.SelfMul=function(t){return this.r*=t,this.g*=t,this.b*=t,this.a*=t,this},e.Mul=function(t,e){return e.r=this.r*t,e.g=this.g*t,e.b=this.b*t,e.a=this.a*t,e},e.Mix=function(e,i){t.MixColors(this,e,i)},t.MixColors=function(t,e,i){var n=i*(e.r-t.r),r=i*(e.g-t.g),s=i*(e.b-t.b),a=i*(e.a-t.a);t.r+=n,t.g+=r,t.b+=s,t.a+=a,e.r-=n,e.g-=r,e.b-=s,e.a-=a},e.MakeStyleString=function(e){return void 0===e&&(e=this.a),t.MakeStyleString(this.r,this.g,this.b,e)},t.MakeStyleString=function(t,e,i,n){return void 0===n&&(n=1),t*=255,e*=255,i*=255,n<1?"rgba("+t+","+e+","+i+","+n+")":"rgb("+t+","+e+","+i+")"},n(t,[{key:"r",get:function(){return this.data[0]},set:function(t){this.data[0]=t}},{key:"g",get:function(){return this.data[1]},set:function(t){this.data[1]=t}},{key:"b",get:function(){return this.data[2]},set:function(t){this.data[2]=t}},{key:"a",get:function(){return this.data[3]},set:function(t){this.data[3]=t}}]),t}();Ot.ZERO=new Ot(0,0,0,0),Ot.RED=new Ot(1,0,0),Ot.GREEN=new Ot(0,1,0),Ot.BLUE=new Ot(0,0,1),(Dt=t.b2DrawFlags||(t.b2DrawFlags={}))[Dt.e_none=0]="e_none",Dt[Dt.e_shapeBit=1]="e_shapeBit",Dt[Dt.e_jointBit=2]="e_jointBit",Dt[Dt.e_aabbBit=4]="e_aabbBit",Dt[Dt.e_pairBit=8]="e_pairBit",Dt[Dt.e_centerOfMassBit=16]="e_centerOfMassBit",Dt[Dt.e_particleBit=32]="e_particleBit",Dt[Dt.e_controllerBit=64]="e_controllerBit",Dt[Dt.e_all=63]="e_all";var Mt=function(){function t(){this.m_drawFlags=0}var e=t.prototype;return e.SetFlags=function(t){this.m_drawFlags=t},e.GetFlags=function(){return this.m_drawFlags},e.AppendFlags=function(t){this.m_drawFlags|=t},e.ClearFlags=function(t){this.m_drawFlags&=~t},t}(),Nt=function(){function t(){this.m_start=Date.now()}var e=t.prototype;return e.Reset=function(){return this.m_start=Date.now(),this},e.GetMilliseconds=function(){return Date.now()-this.m_start},t}(),Lt=function(){function t(){this.m_count=0,this.m_min_count=0,this.m_max_count=0}var e=t.prototype;return e.GetCount=function(){return this.m_count},e.GetMinCount=function(){return this.m_min_count},e.GetMaxCount=function(){return this.m_max_count},e.ResetCount=function(){var t=this.m_count;return this.m_count=0,t},e.ResetMinCount=function(){this.m_min_count=0},e.ResetMaxCount=function(){this.m_max_count=0},e.Increment=function(){this.m_count++,this.m_max_count<this.m_count&&(this.m_max_count=this.m_count)},e.Decrement=function(){this.m_count--,this.m_min_count>this.m_count&&(this.m_min_count=this.m_count)},t}(),Ft=function(){function t(t){this.m_stack=[],this.m_count=0,this.m_stack=Q(t,(function(){return null})),this.m_count=0}var e=t.prototype;return e.Reset=function(){return this.m_count=0,this},e.Push=function(t){this.m_stack[this.m_count]=t,this.m_count++},e.Pop=function(){this.m_count--;var t=this.m_stack[this.m_count];if(this.m_stack[this.m_count]=null,null===t)throw new Error;return t},e.GetCount=function(){return this.m_count},t}(),kt=function(){},Gt=function(){},Vt=function(){function t(){this.m_buffer=bt.MakeArray(2),this.m_vertices=this.m_buffer,this.m_count=0,this.m_radius=0}var e=t.prototype;return e.Copy=function(t){return t.m_vertices===t.m_buffer?(this.m_vertices=this.m_buffer,this.m_buffer[0].Copy(t.m_buffer[0]),this.m_buffer[1].Copy(t.m_buffer[1])):this.m_vertices=t.m_vertices,this.m_count=t.m_count,this.m_radius=t.m_radius,this},e.Reset=function(){return this.m_vertices=this.m_buffer,this.m_count=0,this.m_radius=0,this},e.SetShape=function(t,e){t.SetupDistanceProxy(this,e)},e.SetVerticesRadius=function(t,e,i){this.m_vertices=t,this.m_count=e,this.m_radius=i},e.GetSupport=function(t){for(var e=0,i=bt.DotVV(this.m_vertices[0],t),n=1;n<this.m_count;++n){var r=bt.DotVV(this.m_vertices[n],t);r>i&&(e=n,i=r)}return e},e.GetSupportVertex=function(t){for(var e=0,i=bt.DotVV(this.m_vertices[0],t),n=1;n<this.m_count;++n){var r=bt.DotVV(this.m_vertices[n],t);r>i&&(e=n,i=r)}return this.m_vertices[e]},e.GetVertexCount=function(){return this.m_count},e.GetVertex=function(t){return this.m_vertices[t]},t}(),Ut=function(){function t(){this.metric=0,this.count=0,this.indexA=[0,0,0],this.indexB=[0,0,0]}return t.prototype.Reset=function(){return this.metric=0,this.count=0,this},t}(),zt=function(){function t(){this.proxyA=new Vt,this.proxyB=new Vt,this.transformA=new Bt,this.transformB=new Bt,this.useRadii=!1}return t.prototype.Reset=function(){return this.proxyA.Reset(),this.proxyB.Reset(),this.transformA.SetIdentity(),this.transformB.SetIdentity(),this.useRadii=!1,this},t}(),Ht=function(){function t(){this.pointA=new bt,this.pointB=new bt,this.distance=0,this.iterations=0}return t.prototype.Reset=function(){return this.pointA.SetZero(),this.pointB.SetZero(),this.distance=0,this.iterations=0,this},t}(),Wt=function(){this.proxyA=new Vt,this.proxyB=new Vt,this.transformA=new Bt,this.transformB=new Bt,this.translationB=new bt},Xt=function(){this.point=new bt,this.normal=new bt,this.lambda=0,this.iterations=0};function jt(){t.b2_gjkCalls=0,t.b2_gjkIters=0,t.b2_gjkMaxIters=0}t.b2_gjkCalls=0,t.b2_gjkIters=0,t.b2_gjkMaxIters=0;var Yt=function(){function t(){this.wA=new bt,this.wB=new bt,this.w=new bt,this.a=0,this.indexA=0,this.indexB=0}return t.prototype.Copy=function(t){return this.wA.Copy(t.wA),this.wB.Copy(t.wB),this.w.Copy(t.w),this.a=t.a,this.indexA=t.indexA,this.indexB=t.indexB,this},t}(),qt=function(){function t(){this.m_v1=new Yt,this.m_v2=new Yt,this.m_v3=new Yt,this.m_vertices=[],this.m_count=0,this.m_vertices[0]=this.m_v1,this.m_vertices[1]=this.m_v2,this.m_vertices[2]=this.m_v3}var e=t.prototype;return e.ReadCache=function(t,e,i,n,r){this.m_count=t.count;for(var s=this.m_vertices,o=0;o<this.m_count;++o){var h=s[o];h.indexA=t.indexA[o],h.indexB=t.indexB[o];var u=e.GetVertex(h.indexA),l=n.GetVertex(h.indexB);Bt.MulXV(i,u,h.wA),Bt.MulXV(r,l,h.wB),bt.SubVV(h.wB,h.wA,h.w),h.a=0}if(this.m_count>1){var c=t.metric,_=this.GetMetric();(_<.5*c||2*c<_||_<a)&&(this.m_count=0)}if(0===this.m_count){var f=s[0];f.indexA=0,f.indexB=0;var d=e.GetVertex(0),p=n.GetVertex(0);Bt.MulXV(i,d,f.wA),Bt.MulXV(r,p,f.wB),bt.SubVV(f.wB,f.wA,f.w),f.a=1,this.m_count=1}},e.WriteCache=function(t){t.metric=this.GetMetric(),t.count=this.m_count;for(var e=this.m_vertices,i=0;i<this.m_count;++i)t.indexA[i]=e[i].indexA,t.indexB[i]=e[i].indexB},e.GetSearchDirection=function(t){switch(this.m_count){case 1:return bt.NegV(this.m_v1.w,t);case 2:var e=bt.SubVV(this.m_v2.w,this.m_v1.w,t);return bt.CrossVV(e,bt.NegV(this.m_v1.w,bt.s_t0))>0?bt.CrossOneV(e,t):bt.CrossVOne(e,t);default:return t.SetZero()}},e.GetClosestPoint=function(t){switch(this.m_count){case 0:return t.SetZero();case 1:return t.Copy(this.m_v1.w);case 2:return t.Set(this.m_v1.a*this.m_v1.w.x+this.m_v2.a*this.m_v2.w.x,this.m_v1.a*this.m_v1.w.y+this.m_v2.a*this.m_v2.w.y);case 3:default:return t.SetZero()}},e.GetWitnessPoints=function(t,e){switch(this.m_count){case 0:break;case 1:t.Copy(this.m_v1.wA),e.Copy(this.m_v1.wB);break;case 2:t.x=this.m_v1.a*this.m_v1.wA.x+this.m_v2.a*this.m_v2.wA.x,t.y=this.m_v1.a*this.m_v1.wA.y+this.m_v2.a*this.m_v2.wA.y,e.x=this.m_v1.a*this.m_v1.wB.x+this.m_v2.a*this.m_v2.wB.x,e.y=this.m_v1.a*this.m_v1.wB.y+this.m_v2.a*this.m_v2.wB.y;break;case 3:e.x=t.x=this.m_v1.a*this.m_v1.wA.x+this.m_v2.a*this.m_v2.wA.x+this.m_v3.a*this.m_v3.wA.x,e.y=t.y=this.m_v1.a*this.m_v1.wA.y+this.m_v2.a*this.m_v2.wA.y+this.m_v3.a*this.m_v3.wA.y}},e.GetMetric=function(){switch(this.m_count){case 0:case 1:return 0;case 2:return bt.DistanceVV(this.m_v1.w,this.m_v2.w);case 3:return bt.CrossVV(bt.SubVV(this.m_v2.w,this.m_v1.w,bt.s_t0),bt.SubVV(this.m_v3.w,this.m_v1.w,bt.s_t1));default:return 0}},e.Solve2=function(){var e=this.m_v1.w,i=this.m_v2.w,n=bt.SubVV(i,e,t.s_e12),r=-bt.DotVV(e,n);if(r<=0)return this.m_v1.a=1,void(this.m_count=1);var s=bt.DotVV(i,n);if(s<=0)return this.m_v2.a=1,this.m_count=1,void this.m_v1.Copy(this.m_v2);var a=1/(s+r);this.m_v1.a=s*a,this.m_v2.a=r*a,this.m_count=2},e.Solve3=function(){var e=this.m_v1.w,i=this.m_v2.w,n=this.m_v3.w,r=bt.SubVV(i,e,t.s_e12),s=bt.DotVV(e,r),a=bt.DotVV(i,r),o=-s,h=bt.SubVV(n,e,t.s_e13),u=bt.DotVV(e,h),l=bt.DotVV(n,h),c=-u,_=bt.SubVV(n,i,t.s_e23),f=bt.DotVV(i,_),d=bt.DotVV(n,_),p=-f,m=bt.CrossVV(r,h),g=m*bt.CrossVV(i,n),y=m*bt.CrossVV(n,e),v=m*bt.CrossVV(e,i);if(o<=0&&c<=0)return this.m_v1.a=1,void(this.m_count=1);if(a>0&&o>0&&v<=0){var S=1/(a+o);return this.m_v1.a=a*S,this.m_v2.a=o*S,void(this.m_count=2)}if(l>0&&c>0&&y<=0){var A=1/(l+c);return this.m_v1.a=l*A,this.m_v3.a=c*A,this.m_count=2,void this.m_v2.Copy(this.m_v3)}if(a<=0&&p<=0)return this.m_v2.a=1,this.m_count=1,void this.m_v1.Copy(this.m_v2);if(l<=0&&d<=0)return this.m_v3.a=1,this.m_count=1,void this.m_v1.Copy(this.m_v3);if(d>0&&p>0&&g<=0){var T=1/(d+p);return this.m_v2.a=d*T,this.m_v3.a=p*T,this.m_count=2,void this.m_v1.Copy(this.m_v3)}var E=1/(g+y+v);this.m_v1.a=g*E,this.m_v2.a=y*E,this.m_v3.a=v*E,this.m_count=3},t}();qt.s_e12=new bt,qt.s_e13=new bt,qt.s_e23=new bt;var Kt=new qt,Jt=[0,0,0],Qt=[0,0,0],Zt=new bt,$t=new bt,te=new bt,ee=new bt,ie=new bt;function ne(e,i,n){++t.b2_gjkCalls;var r=n.proxyA,s=n.proxyB,h=n.transformA,u=n.transformB,l=Kt;l.ReadCache(i,r,h,s,u);for(var c=l.m_vertices,_=20,f=Jt,d=Qt,p=0,m=0;m<_;){p=l.m_count;for(var g=0;g<p;++g)f[g]=c[g].indexA,d[g]=c[g].indexB;switch(l.m_count){case 1:break;case 2:l.Solve2();break;case 3:l.Solve3()}if(3===l.m_count)break;var y=l.GetSearchDirection($t);if(y.LengthSquared()<o)break;var v=c[l.m_count];v.indexA=r.GetSupport(It.MulTRV(h.q,bt.NegV(y,bt.s_t0),ee)),Bt.MulXV(h,r.GetVertex(v.indexA),v.wA),v.indexB=s.GetSupport(It.MulTRV(u.q,y,ie)),Bt.MulXV(u,s.GetVertex(v.indexB),v.wB),bt.SubVV(v.wB,v.wA,v.w),++m,++t.b2_gjkIters;for(var S=!1,A=0;A<p;++A)if(v.indexA===f[A]&&v.indexB===d[A]){S=!0;break}if(S)break;++l.m_count}if(t.b2_gjkMaxIters=st(t.b2_gjkMaxIters,m),l.GetWitnessPoints(e.pointA,e.pointB),e.distance=bt.DistanceVV(e.pointA,e.pointB),e.iterations=m,l.WriteCache(i),n.useRadii){var T=r.m_radius,E=s.m_radius;if(e.distance>T+E&&e.distance>a){e.distance-=T+E;var b=bt.SubVV(e.pointB,e.pointA,te);b.Normalize(),e.pointA.SelfMulAdd(T,b),e.pointB.SelfMulSub(E,b)}else{var x=bt.MidVV(e.pointA,e.pointB,Zt);e.pointA.Copy(x),e.pointB.Copy(x),e.distance=0}}}var re,se=new bt,ae=new qt,oe=new bt,he=new bt,ue=new bt,le=new bt,ce=new bt,_e=new bt;function fe(t,e){t.iterations=0,t.lambda=1,t.normal.SetZero(),t.point.SetZero();var i=e.proxyA,n=e.proxyB,r=st(i.m_radius,g)+st(n.m_radius,g),s=e.transformA,a=e.transformB,o=e.translationB,h=se.Set(0,0),u=0,l=ae;l.m_count=0;for(var c=l.m_vertices,_=i.GetSupport(It.MulTRV(s.q,bt.NegV(o,bt.s_t1),bt.s_t0)),f=Bt.MulXV(s,i.GetVertex(_),oe),d=n.GetSupport(It.MulTRV(a.q,o,bt.s_t0)),m=Bt.MulXV(a,n.GetVertex(d),he),y=bt.SubVV(f,m,ue),v=st(g,r-g),S=.5*p,A=20,T=0;T<A&&nt(y.Length()-v)>S;){t.iterations+=1,_=i.GetSupport(It.MulTRV(s.q,bt.NegV(y,bt.s_t1),bt.s_t0)),f=Bt.MulXV(s,i.GetVertex(_),oe),d=n.GetSupport(It.MulTRV(a.q,y,bt.s_t0)),m=Bt.MulXV(a,n.GetVertex(d),he);var E=bt.SubVV(f,m,le);y.Normalize();var b=bt.DotVV(y,E),x=bt.DotVV(y,o);if(b-v>u*x){if(x<=0)return!1;if((u=(b-v)/x)>1)return!1;h.Copy(y).SelfNeg(),l.m_count=0}var C=c[l.m_count];switch(C.indexA=d,C.wA.Copy(m).SelfMulAdd(u,o),C.indexB=_,C.wB.Copy(f),C.w.Copy(C.wB).SelfSub(C.wA),C.a=1,l.m_count+=1,l.m_count){case 1:break;case 2:l.Solve2();break;case 3:l.Solve3()}if(3===l.m_count)return!1;l.GetClosestPoint(y),++T}var R=ce,w=_e;return l.GetWitnessPoints(R,w),y.LengthSquared()>0&&(h.Copy(y).SelfNeg(),h.Normalize()),t.normal.Copy(h),t.lambda=u,t.iterations=T,!0}(re=t.b2ContactFeatureType||(t.b2ContactFeatureType={}))[re.e_vertex=0]="e_vertex",re[re.e_face=1]="e_face";var de,pe=function(){function t(){this._key=0,this._key_invalid=!1,this._indexA=0,this._indexB=0,this._typeA=0,this._typeB=0}return n(t,[{key:"key",get:function(){return this._key_invalid&&(this._key_invalid=!1,this._key=this._indexA|this._indexB<<8|this._typeA<<16|this._typeB<<24),this._key},set:function(t){this._key=t,this._key_invalid=!1,this._indexA=255&this._key,this._indexB=this._key>>8&255,this._typeA=this._key>>16&255,this._typeB=this._key>>24&255}},{key:"indexA",get:function(){return this._indexA},set:function(t){this._indexA=t,this._key_invalid=!0}},{key:"indexB",get:function(){return this._indexB},set:function(t){this._indexB=t,this._key_invalid=!0}},{key:"typeA",get:function(){return this._typeA},set:function(t){this._typeA=t,this._key_invalid=!0}},{key:"typeB",get:function(){return this._typeB},set:function(t){this._typeB=t,this._key_invalid=!0}}]),t}(),me=function(){function t(){this.cf=new pe}var e=t.prototype;return e.Copy=function(t){return this.key=t.key,this},e.Clone=function(){return(new t).Copy(this)},n(t,[{key:"key",get:function(){return this.cf.key},set:function(t){this.cf.key=t}}]),t}(),ge=function(){function t(){this.localPoint=new bt,this.normalImpulse=0,this.tangentImpulse=0,this.id=new me}t.MakeArray=function(e){return Q(e,(function(){return new t}))};var e=t.prototype;return e.Reset=function(){this.localPoint.SetZero(),this.normalImpulse=0,this.tangentImpulse=0,this.id.key=0},e.Copy=function(t){return this.localPoint.Copy(t.localPoint),this.normalImpulse=t.normalImpulse,this.tangentImpulse=t.tangentImpulse,this.id.Copy(t.id),this},t}();(de=t.b2ManifoldType||(t.b2ManifoldType={}))[de.e_unknown=-1]="e_unknown",de[de.e_circles=0]="e_circles",de[de.e_faceA=1]="e_faceA",de[de.e_faceB=2]="e_faceB";var ye,ve=function(){function e(){this.points=ge.MakeArray(l),this.localNormal=new bt,this.localPoint=new bt,this.type=t.b2ManifoldType.e_unknown,this.pointCount=0}var i=e.prototype;return i.Reset=function(){for(var e=0;e<l;++e)this.points[e].Reset();this.localNormal.SetZero(),this.localPoint.SetZero(),this.type=t.b2ManifoldType.e_unknown,this.pointCount=0},i.Copy=function(t){this.pointCount=t.pointCount;for(var e=0;e<l;++e)this.points[e].Copy(t.points[e]);return this.localNormal.Copy(t.localNormal),this.localPoint.Copy(t.localPoint),this.type=t.type,this},i.Clone=function(){return(new e).Copy(this)},e}(),Se=function(){function e(){this.normal=new bt,this.points=bt.MakeArray(l),this.separations=$(l)}return e.prototype.Initialize=function(i,n,r,s,a){if(0!==i.pointCount)switch(i.type){case t.b2ManifoldType.e_circles:this.normal.Set(1,0);var h=Bt.MulXV(n,i.localPoint,e.Initialize_s_pointA),u=Bt.MulXV(s,i.points[0].localPoint,e.Initialize_s_pointB);bt.DistanceSquaredVV(h,u)>o&&bt.SubVV(u,h,this.normal).SelfNormalize();var l=bt.AddVMulSV(h,r,this.normal,e.Initialize_s_cA),c=bt.SubVMulSV(u,a,this.normal,e.Initialize_s_cB);bt.MidVV(l,c,this.points[0]),this.separations[0]=bt.DotVV(bt.SubVV(c,l,bt.s_t0),this.normal);break;case t.b2ManifoldType.e_faceA:It.MulRV(n.q,i.localNormal,this.normal);for(var _=Bt.MulXV(n,i.localPoint,e.Initialize_s_planePoint),f=0;f<i.pointCount;++f){var d=Bt.MulXV(s,i.points[f].localPoint,e.Initialize_s_clipPoint),p=r-bt.DotVV(bt.SubVV(d,_,bt.s_t0),this.normal),m=bt.AddVMulSV(d,p,this.normal,e.Initialize_s_cA),g=bt.SubVMulSV(d,a,this.normal,e.Initialize_s_cB);bt.MidVV(m,g,this.points[f]),this.separations[f]=bt.DotVV(bt.SubVV(g,m,bt.s_t0),this.normal)}break;case t.b2ManifoldType.e_faceB:It.MulRV(s.q,i.localNormal,this.normal);for(var y=Bt.MulXV(s,i.localPoint,e.Initialize_s_planePoint),v=0;v<i.pointCount;++v){var S=Bt.MulXV(n,i.points[v].localPoint,e.Initialize_s_clipPoint),A=a-bt.DotVV(bt.SubVV(S,y,bt.s_t0),this.normal),T=bt.AddVMulSV(S,A,this.normal,e.Initialize_s_cB),E=bt.SubVMulSV(S,r,this.normal,e.Initialize_s_cA);bt.MidVV(E,T,this.points[v]),this.separations[v]=bt.DotVV(bt.SubVV(E,T,bt.s_t0),this.normal)}this.normal.SelfNeg()}},e}();function Ae(e,i,n,r){var s;for(s=0;s<n.pointCount;++s){var a=n.points[s].id.key;e[s]=t.b2PointState.b2_removeState;for(var o=0,h=r.pointCount;o<h;++o)if(r.points[o].id.key===a){e[s]=t.b2PointState.b2_persistState;break}}for(;s<l;++s)e[s]=t.b2PointState.b2_nullState;for(s=0;s<r.pointCount;++s){var u=r.points[s].id.key;i[s]=t.b2PointState.b2_addState;for(var c=0,_=n.pointCount;c<_;++c)if(n.points[c].id.key===u){i[s]=t.b2PointState.b2_persistState;break}}for(;s<l;++s)i[s]=t.b2PointState.b2_nullState}Se.Initialize_s_pointA=new bt,Se.Initialize_s_pointB=new bt,Se.Initialize_s_cA=new bt,Se.Initialize_s_cB=new bt,Se.Initialize_s_planePoint=new bt,Se.Initialize_s_clipPoint=new bt,(ye=t.b2PointState||(t.b2PointState={}))[ye.b2_nullState=0]="b2_nullState",ye[ye.b2_addState=1]="b2_addState",ye[ye.b2_persistState=2]="b2_persistState",ye[ye.b2_removeState=3]="b2_removeState";var Te=function(){function t(){this.v=new bt,this.id=new me}return t.MakeArray=function(e){return Q(e,(function(){return new t}))},t.prototype.Copy=function(t){return this.v.Copy(t.v),this.id.Copy(t.id),this},t}(),Ee=function(){function t(){this.p1=new bt,this.p2=new bt,this.maxFraction=1}return t.prototype.Copy=function(t){return this.p1.Copy(t.p1),this.p2.Copy(t.p2),this.maxFraction=t.maxFraction,this},t}(),be=function(){function t(){this.normal=new bt,this.fraction=0}return t.prototype.Copy=function(t){return this.normal.Copy(t.normal),this.fraction=t.fraction,this},t}(),xe=function(){function t(){this.lowerBound=new bt,this.upperBound=new bt,this.m_cache_center=new bt,this.m_cache_extent=new bt}var e=t.prototype;return e.Copy=function(t){return this.lowerBound.Copy(t.lowerBound),this.upperBound.Copy(t.upperBound),this},e.IsValid=function(){return!(!this.lowerBound.IsValid()||!this.upperBound.IsValid()||this.upperBound.x<this.lowerBound.x||this.upperBound.y<this.lowerBound.y)},e.GetCenter=function(){return bt.MidVV(this.lowerBound,this.upperBound,this.m_cache_center)},e.GetExtents=function(){return bt.ExtVV(this.lowerBound,this.upperBound,this.m_cache_extent)},e.GetPerimeter=function(){return 2*(this.upperBound.x-this.lowerBound.x+(this.upperBound.y-this.lowerBound.y))},e.Combine1=function(t){return this.lowerBound.x=rt(this.lowerBound.x,t.lowerBound.x),this.lowerBound.y=rt(this.lowerBound.y,t.lowerBound.y),this.upperBound.x=st(this.upperBound.x,t.upperBound.x),this.upperBound.y=st(this.upperBound.y,t.upperBound.y),this},e.Combine2=function(t,e){return this.lowerBound.x=rt(t.lowerBound.x,e.lowerBound.x),this.lowerBound.y=rt(t.lowerBound.y,e.lowerBound.y),this.upperBound.x=st(t.upperBound.x,e.upperBound.x),this.upperBound.y=st(t.upperBound.y,e.upperBound.y),this},t.Combine=function(t,e,i){return i.Combine2(t,e),i},e.Contains=function(t){return!(this.lowerBound.x<=t.lowerBound.x||this.lowerBound.y<=t.lowerBound.y||t.upperBound.x<=this.upperBound.x||t.upperBound.y<=this.upperBound.y)},e.RayCast=function(t,e){var i=-r,n=r,s=e.p1.x,o=e.p1.y,h=e.p2.x-e.p1.x,u=e.p2.y-e.p1.y,l=nt(h),c=nt(u),_=t.normal;if(l<a){if(s<this.lowerBound.x||this.upperBound.x<s)return!1}else{var f=1/h,d=(this.lowerBound.x-s)*f,p=(this.upperBound.x-s)*f,m=-1;if(d>p){var g=d;d=p,p=g,m=1}if(d>i&&(_.x=m,_.y=0,i=d),i>(n=rt(n,p)))return!1}if(c<a){if(o<this.lowerBound.y||this.upperBound.y<o)return!1}else{var y=1/u,v=(this.lowerBound.y-o)*y,S=(this.upperBound.y-o)*y,A=-1;if(v>S){var T=v;v=S,S=T,A=1}if(v>i&&(_.x=0,_.y=A,i=v),i>(n=rt(n,S)))return!1}return!(i<0||e.maxFraction<i||(t.fraction=i,0))},e.TestContain=function(t){return!(t.x<this.lowerBound.x||this.upperBound.x<t.x||t.y<this.lowerBound.y||this.upperBound.y<t.y)},e.TestOverlap=function(t){return!(this.upperBound.x<t.lowerBound.x||this.upperBound.y<t.lowerBound.y||t.upperBound.x<this.lowerBound.x||t.upperBound.y<this.lowerBound.y)},t}();function Ce(t,e){return!(t.upperBound.x<e.lowerBound.x||t.upperBound.y<e.lowerBound.y||e.upperBound.x<t.lowerBound.x||e.upperBound.y<t.lowerBound.y)}function Re(e,i,n,r,s){var a=0,o=i[0],h=i[1],u=bt.DotVV(n,o.v)-r,l=bt.DotVV(n,h.v)-r;if(u<=0&&e[a++].Copy(o),l<=0&&e[a++].Copy(h),u*l<0){var c=u/(u-l),_=e[a].v;_.x=o.v.x+c*(h.v.x-o.v.x),_.y=o.v.y+c*(h.v.y-o.v.y);var f=e[a].id;f.cf.indexA=s,f.cf.indexB=o.id.cf.indexB,f.cf.typeA=t.b2ContactFeatureType.e_vertex,f.cf.typeB=t.b2ContactFeatureType.e_face,++a}return a}var we=new zt,Ie=new Ut,Be=new Ht;function De(t,e,i,n,r,s){var o=we.Reset();o.proxyA.SetShape(t,e),o.proxyB.SetShape(i,n),o.transformA.Copy(r),o.transformB.Copy(s),o.useRadii=!0;var h=Ie.Reset();h.count=0;var u=Be.Reset();return ne(u,h,o),u.distance<10*a}function Pe(t){if(null===t)throw new Error;return t}var Oe=function(){function t(t){void 0===t&&(t=0),this.m_id=0,this.aabb=new xe,this._userData=null,this.parent=null,this.child1=null,this.child2=null,this.height=0,this.m_id=t}var e=t.prototype;return e.Reset=function(){this._userData=null},e.IsLeaf=function(){return null===this.child1},n(t,[{key:"userData",get:function(){if(null===this._userData)throw new Error;return this._userData},set:function(t){if(null!==this._userData)throw new Error;this._userData=t}}]),t}(),Me=function(){function t(){this.m_root=null,this.m_freeList=null,this.m_path=0,this.m_insertionCount=0,this.m_stack=new Ft(256)}var e=t.prototype;return e.Query=function(t,e){var i=this.m_stack.Reset();for(i.Push(this.m_root);i.GetCount()>0;){var n=i.Pop();if(null!==n&&n.aabb.TestOverlap(t))if(n.IsLeaf()){if(!e(n))return}else i.Push(n.child1),i.Push(n.child2)}},e.QueryPoint=function(t,e){var i=this.m_stack.Reset();for(i.Push(this.m_root);i.GetCount()>0;){var n=i.Pop();if(null!==n&&n.aabb.TestContain(t))if(n.IsLeaf()){if(!e(n))return}else i.Push(n.child1),i.Push(n.child2)}},e.RayCast=function(e,i){var n=e.p1,r=e.p2,s=bt.SubVV(r,n,t.s_r);s.Normalize();var a=bt.CrossOneV(s,t.s_v),o=bt.AbsV(a,t.s_abs_v),h=e.maxFraction,u=t.s_segmentAABB,l=n.x+h*(r.x-n.x),c=n.y+h*(r.y-n.y);u.lowerBound.x=rt(n.x,l),u.lowerBound.y=rt(n.y,c),u.upperBound.x=st(n.x,l),u.upperBound.y=st(n.y,c);var _=this.m_stack.Reset();for(_.Push(this.m_root);_.GetCount()>0;){var f=_.Pop();if(null!==f&&Ce(f.aabb,u)){var d=f.aabb.GetCenter(),p=f.aabb.GetExtents();if(!(nt(bt.DotVV(a,bt.SubVV(n,d,bt.s_t0)))-bt.DotVV(o,p)>0))if(f.IsLeaf()){var m=t.s_subInput;m.p1.Copy(e.p1),m.p2.Copy(e.p2),m.maxFraction=h;var g=i(m,f);if(0===g)return;g>0&&(h=g,l=n.x+h*(r.x-n.x),c=n.y+h*(r.y-n.y),u.lowerBound.x=rt(n.x,l),u.lowerBound.y=rt(n.y,c),u.upperBound.x=st(n.x,l),u.upperBound.y=st(n.y,c))}else _.Push(f.child1),_.Push(f.child2)}}},e.AllocateNode=function(){if(null!==this.m_freeList){var e=this.m_freeList;return this.m_freeList=e.parent,e.parent=null,e.child1=null,e.child2=null,e.height=0,e}return new Oe(t.s_node_id++)},e.FreeNode=function(t){t.parent=this.m_freeList,t.child1=null,t.child2=null,t.height=-1,t.Reset(),this.m_freeList=t},e.CreateProxy=function(t,e){var i=this.AllocateNode(),n=_,r=_;return i.aabb.lowerBound.x=t.lowerBound.x-n,i.aabb.lowerBound.y=t.lowerBound.y-r,i.aabb.upperBound.x=t.upperBound.x+n,i.aabb.upperBound.y=t.upperBound.y+r,i.userData=e,i.height=0,this.InsertLeaf(i),i},e.DestroyProxy=function(t){this.RemoveLeaf(t),this.FreeNode(t)},e.MoveProxy=function(t,e,i){if(t.aabb.Contains(e))return!1;this.RemoveLeaf(t);var n=_,r=_;t.aabb.lowerBound.x=e.lowerBound.x-n,t.aabb.lowerBound.y=e.lowerBound.y-r,t.aabb.upperBound.x=e.upperBound.x+n,t.aabb.upperBound.y=e.upperBound.y+r;var s=d*i.x,a=d*i.y;return s<0?t.aabb.lowerBound.x+=s:t.aabb.upperBound.x+=s,a<0?t.aabb.lowerBound.y+=a:t.aabb.upperBound.y+=a,this.InsertLeaf(t),!0},e.InsertLeaf=function(e){if(++this.m_insertionCount,null===this.m_root)return this.m_root=e,void(this.m_root.parent=null);for(var i=e.aabb,n=this.m_root;!n.IsLeaf();){var r=Pe(n.child1),s=Pe(n.child2),a=n.aabb.GetPerimeter(),o=t.s_combinedAABB;o.Combine2(n.aabb,i);var h=o.GetPerimeter(),u=2*h,l=2*(h-a),c=void 0,_=t.s_aabb,f=void 0;r.IsLeaf()?(_.Combine2(i,r.aabb),c=_.GetPerimeter()+l):(_.Combine2(i,r.aabb),f=r.aabb.GetPerimeter(),c=_.GetPerimeter()-f+l);var d=void 0;if(s.IsLeaf()?(_.Combine2(i,s.aabb),d=_.GetPerimeter()+l):(_.Combine2(i,s.aabb),f=s.aabb.GetPerimeter(),d=_.GetPerimeter()-f+l),u<c&&u<d)break;n=c<d?r:s}var p=n.parent,m=this.AllocateNode();m.parent=p,m.aabb.Combine2(i,n.aabb),m.height=n.height+1,null!==p?(p.child1===n?p.child1=m:p.child2=m,m.child1=n,m.child2=e,n.parent=m,e.parent=m):(m.child1=n,m.child2=e,n.parent=m,e.parent=m,this.m_root=m);for(var g=e.parent;null!==g;){var y=Pe((g=this.Balance(g)).child1),v=Pe(g.child2);g.height=1+st(y.height,v.height),g.aabb.Combine2(y.aabb,v.aabb),g=g.parent}},e.RemoveLeaf=function(t){if(t!==this.m_root){var e=Pe(t.parent),i=e&&e.parent,n=Pe(e.child1===t?e.child2:e.child1);if(null!==i){i.child1===e?i.child1=n:i.child2=n,n.parent=i,this.FreeNode(e);for(var r=i;null!==r;){var s=Pe((r=this.Balance(r)).child1),a=Pe(r.child2);r.aabb.Combine2(s.aabb,a.aabb),r.height=1+st(s.height,a.height),r=r.parent}}else this.m_root=n,n.parent=null,this.FreeNode(e)}else this.m_root=null},e.Balance=function(t){if(t.IsLeaf()||t.height<2)return t;var e=Pe(t.child1),i=Pe(t.child2),n=i.height-e.height;if(n>1){var r=Pe(i.child1),s=Pe(i.child2);return i.child1=t,i.parent=t.parent,t.parent=i,null!==i.parent?i.parent.child1===t?i.parent.child1=i:i.parent.child2=i:this.m_root=i,r.height>s.height?(i.child2=r,t.child2=s,s.parent=t,t.aabb.Combine2(e.aabb,s.aabb),i.aabb.Combine2(t.aabb,r.aabb),t.height=1+st(e.height,s.height),i.height=1+st(t.height,r.height)):(i.child2=s,t.child2=r,r.parent=t,t.aabb.Combine2(e.aabb,r.aabb),i.aabb.Combine2(t.aabb,s.aabb),t.height=1+st(e.height,r.height),i.height=1+st(t.height,s.height)),i}if(n<-1){var a=Pe(e.child1),o=Pe(e.child2);return e.child1=t,e.parent=t.parent,t.parent=e,null!==e.parent?e.parent.child1===t?e.parent.child1=e:e.parent.child2=e:this.m_root=e,a.height>o.height?(e.child2=a,t.child1=o,o.parent=t,t.aabb.Combine2(i.aabb,o.aabb),e.aabb.Combine2(t.aabb,a.aabb),t.height=1+st(i.height,o.height),e.height=1+st(t.height,a.height)):(e.child2=o,t.child1=a,a.parent=t,t.aabb.Combine2(i.aabb,a.aabb),e.aabb.Combine2(t.aabb,o.aabb),t.height=1+st(i.height,a.height),e.height=1+st(t.height,o.height)),e}return t},e.GetHeight=function(){return null===this.m_root?0:this.m_root.height},t.GetAreaNode=function(e){if(null===e)return 0;if(e.IsLeaf())return 0;var i=e.aabb.GetPerimeter();return(i+=t.GetAreaNode(e.child1))+t.GetAreaNode(e.child2)},e.GetAreaRatio=function(){if(null===this.m_root)return 0;var e=this.m_root.aabb.GetPerimeter();return t.GetAreaNode(this.m_root)/e},t.ComputeHeightNode=function(e){return null===e||e.IsLeaf()?0:1+st(t.ComputeHeightNode(e.child1),t.ComputeHeightNode(e.child2))},e.ComputeHeight=function(){return t.ComputeHeightNode(this.m_root)},e.ValidateStructure=function(t){if(null!==t&&(this.m_root,!t.IsLeaf())){var e=Pe(t.child1),i=Pe(t.child2);this.ValidateStructure(e),this.ValidateStructure(i)}},e.ValidateMetrics=function(e){if(null!==e&&!e.IsLeaf()){var i=Pe(e.child1),n=Pe(e.child2);t.s_aabb.Combine2(i.aabb,n.aabb),this.ValidateMetrics(i),this.ValidateMetrics(n)}},e.Validate=function(){},t.GetMaxBalanceNode=function(t,e){if(null===t)return e;if(t.height<=1)return e;var i=Pe(t.child1),n=Pe(t.child2);return st(e,nt(n.height-i.height))},e.GetMaxBalance=function(){return t.GetMaxBalanceNode(this.m_root,0)},e.RebuildBottomUp=function(){this.Validate()},t.ShiftOriginNode=function(e,i){if(null!==e&&!(e.height<=1)){var n=e.child1,r=e.child2;t.ShiftOriginNode(n,i),t.ShiftOriginNode(r,i),e.aabb.lowerBound.SelfSub(i),e.aabb.upperBound.SelfSub(i)}},e.ShiftOrigin=function(e){t.ShiftOriginNode(this.m_root,e)},t}();function Ne(t,e,i){var n=t[e];t[e]=t[i],t[i]=n}function Le(t,e){return t<e}function Fe(t,e,i,n){void 0===e&&(e=0),void 0===i&&(i=t.length-e),void 0===n&&(n=Le);for(var r=e,s=[],a=0;;){for(;r+1<i;i++){var o=t[r+Math.floor(Math.random()*(i-r))];s[a++]=i;for(var h=r-1;;){for(;n(t[++h],o););for(;n(o,t[--i]););if(h>=i)break;Ne(t,h,i)}}if(0===a)break;r=i,i=s[--a]}return t}Me.s_r=new bt,Me.s_v=new bt,Me.s_abs_v=new bt,Me.s_segmentAABB=new xe,Me.s_subInput=new Ee,Me.s_combinedAABB=new xe,Me.s_aabb=new xe,Me.s_node_id=0;var ke=function(t,e){this.proxyA=t,this.proxyB=e},Ge=function(){function t(){this.m_tree=new Me,this.m_proxyCount=0,this.m_moveCount=0,this.m_moveBuffer=[],this.m_pairCount=0,this.m_pairBuffer=[]}var e=t.prototype;return e.CreateProxy=function(t,e){var i=this.m_tree.CreateProxy(t,e);return++this.m_proxyCount,this.BufferMove(i),i},e.DestroyProxy=function(t){this.UnBufferMove(t),--this.m_proxyCount,this.m_tree.DestroyProxy(t)},e.MoveProxy=function(t,e,i){this.m_tree.MoveProxy(t,e,i)&&this.BufferMove(t)},e.TouchProxy=function(t){this.BufferMove(t)},e.GetProxyCount=function(){return this.m_proxyCount},e.UpdatePairs=function(t){var e=this;this.m_pairCount=0;for(var i=function(){var t=e.m_moveBuffer[n];if(null===t)return"continue";var i=t.aabb;e.m_tree.Query(i,(function(i){if(i.m_id===t.m_id)return!0;var n,r;if(i.m_id<t.m_id?(n=i,r=t):(n=t,r=i),e.m_pairCount===e.m_pairBuffer.length)e.m_pairBuffer[e.m_pairCount]=new ke(n,r);else{var s=e.m_pairBuffer[e.m_pairCount];s.proxyA=n,s.proxyB=r}return++e.m_pairCount,!0}))},n=0;n<this.m_moveCount;++n)i();this.m_moveCount=0,Fe(this.m_pairBuffer,0,this.m_pairCount,Ve);for(var r=0;r<this.m_pairCount;){var s=this.m_pairBuffer[r];for(t(s.proxyA.userData,s.proxyB.userData),++r;r<this.m_pairCount;){var a=this.m_pairBuffer[r];if(a.proxyA.m_id!==s.proxyA.m_id||a.proxyB.m_id!==s.proxyB.m_id)break;++r}}},e.Query=function(t,e){this.m_tree.Query(t,e)},e.QueryPoint=function(t,e){this.m_tree.QueryPoint(t,e)},e.RayCast=function(t,e){this.m_tree.RayCast(t,e)},e.GetTreeHeight=function(){return this.m_tree.GetHeight()},e.GetTreeBalance=function(){return this.m_tree.GetMaxBalance()},e.GetTreeQuality=function(){return this.m_tree.GetAreaRatio()},e.ShiftOrigin=function(t){this.m_tree.ShiftOrigin(t)},e.BufferMove=function(t){this.m_moveBuffer[this.m_moveCount]=t,++this.m_moveCount},e.UnBufferMove=function(t){var e=this.m_moveBuffer.indexOf(t);this.m_moveBuffer[e]=null},t}();function Ve(t,e){return t.proxyA.m_id<e.proxyA.m_id||t.proxyA.m_id===e.proxyA.m_id&&t.proxyB.m_id<e.proxyB.m_id}function Ue(){t.b2_toiTime=0,t.b2_toiMaxTime=0,t.b2_toiCalls=0,t.b2_toiIters=0,t.b2_toiMaxIters=0,t.b2_toiRootIters=0,t.b2_toiMaxRootIters=0}t.b2_toiTime=0,t.b2_toiMaxTime=0,t.b2_toiCalls=0,t.b2_toiIters=0,t.b2_toiMaxIters=0,t.b2_toiRootIters=0,t.b2_toiMaxRootIters=0;var ze,He=new Bt,We=new Bt,Xe=new bt,je=new bt,Ye=new bt,qe=new bt,Ke=new bt,Je=function(){this.proxyA=new Vt,this.proxyB=new Vt,this.sweepA=new Pt,this.sweepB=new Pt,this.tMax=0};(ze=t.b2TOIOutputState||(t.b2TOIOutputState={}))[ze.e_unknown=0]="e_unknown",ze[ze.e_failed=1]="e_failed",ze[ze.e_overlapped=2]="e_overlapped",ze[ze.e_touching=3]="e_touching",ze[ze.e_separated=4]="e_separated";var Qe,Ze=function(){this.state=t.b2TOIOutputState.e_unknown,this.t=0};(Qe=t.b2SeparationFunctionType||(t.b2SeparationFunctionType={}))[Qe.e_unknown=-1]="e_unknown",Qe[Qe.e_points=0]="e_points",Qe[Qe.e_faceA=1]="e_faceA",Qe[Qe.e_faceB=2]="e_faceB";var $e=function(){function e(){this.m_sweepA=new Pt,this.m_sweepB=new Pt,this.m_type=t.b2SeparationFunctionType.e_unknown,this.m_localPoint=new bt,this.m_axis=new bt}var i=e.prototype;return i.Initialize=function(e,i,n,r,s,a){this.m_proxyA=i,this.m_proxyB=r;var o=e.count;this.m_sweepA.Copy(n),this.m_sweepB.Copy(s);var h=He,u=We;if(this.m_sweepA.GetTransform(h,a),this.m_sweepB.GetTransform(u,a),1===o){this.m_type=t.b2SeparationFunctionType.e_points;var l=this.m_proxyA.GetVertex(e.indexA[0]),c=this.m_proxyB.GetVertex(e.indexB[0]),_=Bt.MulXV(h,l,Xe),f=Bt.MulXV(u,c,je);bt.SubVV(f,_,this.m_axis);var d=this.m_axis.Normalize();return this.m_localPoint.SetZero(),d}if(e.indexA[0]===e.indexA[1]){this.m_type=t.b2SeparationFunctionType.e_faceB;var p=this.m_proxyB.GetVertex(e.indexB[0]),m=this.m_proxyB.GetVertex(e.indexB[1]);bt.CrossVOne(bt.SubVV(m,p,bt.s_t0),this.m_axis).SelfNormalize();var g=It.MulRV(u.q,this.m_axis,Ye);bt.MidVV(p,m,this.m_localPoint);var y=Bt.MulXV(u,this.m_localPoint,je),v=this.m_proxyA.GetVertex(e.indexA[0]),S=Bt.MulXV(h,v,Xe),A=bt.DotVV(bt.SubVV(S,y,bt.s_t0),g);return A<0&&(this.m_axis.SelfNeg(),A=-A),A}this.m_type=t.b2SeparationFunctionType.e_faceA;var T=this.m_proxyA.GetVertex(e.indexA[0]),E=this.m_proxyA.GetVertex(e.indexA[1]);bt.CrossVOne(bt.SubVV(E,T,bt.s_t0),this.m_axis).SelfNormalize();var b=It.MulRV(h.q,this.m_axis,Ye);bt.MidVV(T,E,this.m_localPoint);var x=Bt.MulXV(h,this.m_localPoint,Xe),C=this.m_proxyB.GetVertex(e.indexB[0]),R=Bt.MulXV(u,C,je),w=bt.DotVV(bt.SubVV(R,x,bt.s_t0),b);return w<0&&(this.m_axis.SelfNeg(),w=-w),w},i.FindMinSeparation=function(e,i,n){var r=He,s=We;switch(this.m_sweepA.GetTransform(r,n),this.m_sweepB.GetTransform(s,n),this.m_type){case t.b2SeparationFunctionType.e_points:var a=It.MulTRV(r.q,this.m_axis,qe),o=It.MulTRV(s.q,bt.NegV(this.m_axis,bt.s_t0),Ke);e[0]=this.m_proxyA.GetSupport(a),i[0]=this.m_proxyB.GetSupport(o);var h=this.m_proxyA.GetVertex(e[0]),u=this.m_proxyB.GetVertex(i[0]),l=Bt.MulXV(r,h,Xe),c=Bt.MulXV(s,u,je);return bt.DotVV(bt.SubVV(c,l,bt.s_t0),this.m_axis);case t.b2SeparationFunctionType.e_faceA:var _=It.MulRV(r.q,this.m_axis,Ye),f=Bt.MulXV(r,this.m_localPoint,Xe),d=It.MulTRV(s.q,bt.NegV(_,bt.s_t0),Ke);e[0]=-1,i[0]=this.m_proxyB.GetSupport(d);var p=this.m_proxyB.GetVertex(i[0]),m=Bt.MulXV(s,p,je);return bt.DotVV(bt.SubVV(m,f,bt.s_t0),_);case t.b2SeparationFunctionType.e_faceB:var g=It.MulRV(s.q,this.m_axis,Ye),y=Bt.MulXV(s,this.m_localPoint,je),v=It.MulTRV(r.q,bt.NegV(g,bt.s_t0),qe);i[0]=-1,e[0]=this.m_proxyA.GetSupport(v);var S=this.m_proxyA.GetVertex(e[0]),A=Bt.MulXV(r,S,Xe);return bt.DotVV(bt.SubVV(A,y,bt.s_t0),g);default:return e[0]=-1,i[0]=-1,0}},i.Evaluate=function(e,i,n){var r=He,s=We;switch(this.m_sweepA.GetTransform(r,n),this.m_sweepB.GetTransform(s,n),this.m_type){case t.b2SeparationFunctionType.e_points:var a=this.m_proxyA.GetVertex(e),o=this.m_proxyB.GetVertex(i),h=Bt.MulXV(r,a,Xe),u=Bt.MulXV(s,o,je);return bt.DotVV(bt.SubVV(u,h,bt.s_t0),this.m_axis);case t.b2SeparationFunctionType.e_faceA:var l=It.MulRV(r.q,this.m_axis,Ye),c=Bt.MulXV(r,this.m_localPoint,Xe),_=this.m_proxyB.GetVertex(i),f=Bt.MulXV(s,_,je);return bt.DotVV(bt.SubVV(f,c,bt.s_t0),l);case t.b2SeparationFunctionType.e_faceB:var d=It.MulRV(s.q,this.m_axis,Ye),p=Bt.MulXV(s,this.m_localPoint,je),m=this.m_proxyA.GetVertex(e),g=Bt.MulXV(r,m,Xe);return bt.DotVV(bt.SubVV(g,p,bt.s_t0),d);default:return 0}},e}(),ti=new Nt,ei=new Ut,ii=new zt,ni=new Ht,ri=new $e,si=[0],ai=[0],oi=new Pt,hi=new Pt;function ui(e,i){var n=ti.Reset();++t.b2_toiCalls,e.state=t.b2TOIOutputState.e_unknown,e.t=i.tMax;var r=i.proxyA,s=i.proxyB,a=st(c,st(r.m_count,s.m_count)),o=oi.Copy(i.sweepA),h=hi.Copy(i.sweepB);o.Normalize(),h.Normalize();var u=i.tMax,l=r.m_radius+s.m_radius,_=st(p,l-3*p),f=.25*p,d=0,m=20,g=0,y=ei;y.count=0;var v=ii;for(v.proxyA.Copy(i.proxyA),v.proxyB.Copy(i.proxyB),v.useRadii=!1;;){var S=He,A=We;o.GetTransform(S,d),h.GetTransform(A,d),v.transformA.Copy(S),v.transformB.Copy(A);var T=ni;if(ne(T,y,v),T.distance<=0){e.state=t.b2TOIOutputState.e_overlapped,e.t=0;break}if(T.distance<_+f){e.state=t.b2TOIOutputState.e_touching,e.t=d;break}var E=ri;E.Initialize(y,r,o,s,h,d);for(var b=!1,x=u,C=0;;){var R=si,w=ai,I=E.FindMinSeparation(R,w,x);if(I>_+f){e.state=t.b2TOIOutputState.e_separated,e.t=u,b=!0;break}if(I>_-f){d=x;break}var B=E.Evaluate(R[0],w[0],d);if(B<_-f){e.state=t.b2TOIOutputState.e_failed,e.t=d,b=!0;break}if(B<=_+f){e.state=t.b2TOIOutputState.e_touching,e.t=d,b=!0;break}for(var D=0,P=d,O=x;;){var M=0;M=1&D?P+(_-B)*(O-P)/(I-B):.5*(P+O),++D,++t.b2_toiRootIters;var N=E.Evaluate(R[0],w[0],M);if(nt(N-_)<f){x=M;break}if(N>_?(P=M,B=N):(O=M,I=N),50===D)break}if(t.b2_toiMaxRootIters=st(t.b2_toiMaxRootIters,D),++C===a)break}if(++g,++t.b2_toiIters,b)break;if(g===m){e.state=t.b2TOIOutputState.e_failed,e.t=d;break}}t.b2_toiMaxIters=st(t.b2_toiMaxIters,g);var L=n.GetMilliseconds();t.b2_toiMaxTime=st(t.b2_toiMaxTime,L),t.b2_toiTime+=L}var li=new bt,ci=new bt;function _i(e,i,n,r,s){e.pointCount=0;var a=Bt.MulXV(n,i.m_p,li),o=Bt.MulXV(s,r.m_p,ci),h=bt.DistanceSquaredVV(a,o),u=i.m_radius+r.m_radius;h>u*u||(e.type=t.b2ManifoldType.e_circles,e.localPoint.Copy(i.m_p),e.localNormal.SetZero(),e.pointCount=1,e.points[0].localPoint.Copy(r.m_p),e.points[0].id.key=0)}var fi=new bt,di=new bt,pi=new bt;function mi(e,i,n,s,o){e.pointCount=0;for(var h=Bt.MulXV(o,s.m_p,fi),u=Bt.MulTXV(n,h,di),l=0,c=-r,_=i.m_radius+s.m_radius,f=i.m_count,d=i.m_vertices,p=i.m_normals,m=0;m<f;++m){var g=bt.DotVV(p[m],bt.SubVV(u,d[m],bt.s_t0));if(g>_)return;g>c&&(c=g,l=m)}var y=l,v=(y+1)%f,S=d[y],A=d[v];if(c<a)return e.pointCount=1,e.type=t.b2ManifoldType.e_faceA,e.localNormal.Copy(p[l]),bt.MidVV(S,A,e.localPoint),e.points[0].localPoint.Copy(s.m_p),void(e.points[0].id.key=0);var T=bt.DotVV(bt.SubVV(u,S,bt.s_t0),bt.SubVV(A,S,bt.s_t1)),E=bt.DotVV(bt.SubVV(u,A,bt.s_t0),bt.SubVV(S,A,bt.s_t1));if(T<=0){if(bt.DistanceSquaredVV(u,S)>_*_)return;e.pointCount=1,e.type=t.b2ManifoldType.e_faceA,bt.SubVV(u,S,e.localNormal).SelfNormalize(),e.localPoint.Copy(S),e.points[0].localPoint.Copy(s.m_p),e.points[0].id.key=0}else if(E<=0){if(bt.DistanceSquaredVV(u,A)>_*_)return;e.pointCount=1,e.type=t.b2ManifoldType.e_faceA,bt.SubVV(u,A,e.localNormal).SelfNormalize(),e.localPoint.Copy(A),e.points[0].localPoint.Copy(s.m_p),e.points[0].id.key=0}else{var b=bt.MidVV(S,A,pi);if(bt.DotVV(bt.SubVV(u,b,bt.s_t1),p[y])>_)return;e.pointCount=1,e.type=t.b2ManifoldType.e_faceA,e.localNormal.Copy(p[y]).SelfNormalize(),e.localPoint.Copy(b),e.points[0].localPoint.Copy(s.m_p),e.points[0].id.key=0}}var gi=new bt,yi=new bt,vi=new bt,Si=new bt;function Ai(t,e,i,n,s){for(var a=t.m_vertices,o=t.m_normals,h=n.m_count,u=n.m_vertices,l=It.MulRV(e.q,o[i],gi),c=It.MulTRV(s.q,l,yi),_=0,f=r,d=0;d<h;++d){var p=bt.DotVV(u[d],c);p<f&&(f=p,_=d)}var m=Bt.MulXV(e,a[i],vi),g=Bt.MulXV(s,u[_],Si);return bt.DotVV(bt.SubVV(g,m,bt.s_t0),l)}var Ti=new bt,Ei=new bt;function bi(t,e,i,n,s){for(var a=e.m_count,o=e.m_normals,h=bt.SubVV(Bt.MulXV(s,n.m_centroid,bt.s_t0),Bt.MulXV(i,e.m_centroid,bt.s_t1),Ti),u=It.MulTRV(i.q,h,Ei),l=0,c=-r,_=0;_<a;++_){var f=bt.DotVV(o[_],u);f>c&&(c=f,l=_)}var d=Ai(e,i,l,n,s),p=(l+a-1)%a,m=Ai(e,i,p,n,s),g=(l+1)%a,y=Ai(e,i,g,n,s),v=0,S=0,A=0;if(m>d&&m>y)A=-1,v=p,S=m;else{if(!(y>d))return t[0]=l,d;A=1,v=g,S=y}for(;(d=Ai(e,i,l=-1===A?(v+a-1)%a:(v+1)%a,n,s))>S;)v=l,S=d;return t[0]=v,S}var xi=new bt;function Ci(e,i,n,s,a,o){for(var h=i.m_normals,u=a.m_count,l=a.m_vertices,c=a.m_normals,_=It.MulTRV(o.q,It.MulRV(n.q,h[s],bt.s_t0),xi),f=0,d=r,p=0;p<u;++p){var m=bt.DotVV(_,c[p]);m<d&&(d=m,f=p)}var g=f,y=(g+1)%u,v=e[0];Bt.MulXV(o,l[g],v.v);var S=v.id.cf;S.indexA=s,S.indexB=g,S.typeA=t.b2ContactFeatureType.e_face,S.typeB=t.b2ContactFeatureType.e_vertex;var A=e[1];Bt.MulXV(o,l[y],A.v);var T=A.id.cf;T.indexA=s,T.indexB=y,T.typeA=t.b2ContactFeatureType.e_face,T.typeB=t.b2ContactFeatureType.e_vertex}var Ri=Te.MakeArray(2),wi=Te.MakeArray(2),Ii=Te.MakeArray(2),Bi=[0],Di=[0],Pi=new bt,Oi=new bt,Mi=new bt,Ni=new bt,Li=new bt,Fi=new bt,ki=new bt,Gi=new bt;function Vi(e,i,n,r,s){e.pointCount=0;var a=i.m_radius+r.m_radius,o=Bi;o[0]=0;var h=bi(o,i,n,r,s);if(!(h>a)){var u=Di;u[0]=0;var c=bi(u,r,s,i,n);if(!(c>a)){var _,f,d,p,m=0,g=0;c>.98*h+.001?(_=r,f=i,d=s,p=n,m=u[0],e.type=t.b2ManifoldType.e_faceB,g=1):(_=i,f=r,d=n,p=s,m=o[0],e.type=t.b2ManifoldType.e_faceA,g=0);var y=Ri;Ci(y,_,d,m,f,p);var v=_.m_count,S=_.m_vertices,A=m,T=(m+1)%v,E=S[A],b=S[T],x=bt.SubVV(b,E,Pi);x.Normalize();var C=bt.CrossVOne(x,Oi),R=bt.MidVV(E,b,Mi),w=It.MulRV(d.q,x,Li),I=bt.CrossVOne(w,Ni),B=Bt.MulXV(d,E,ki),D=Bt.MulXV(d,b,Gi),P=bt.DotVV(I,B),O=-bt.DotVV(w,B)+a,M=bt.DotVV(w,D)+a,N=wi,L=Ii;if(!(Re(N,y,bt.NegV(w,Fi),O,A)<2||Re(L,N,w,M,T)<2)){e.localNormal.Copy(C),e.localPoint.Copy(R);for(var F=0,k=0;k<l;++k){var G=L[k];if(bt.DotVV(I,G.v)-P<=a){var V=e.points[F];if(Bt.MulTXV(p,G.v,V.localPoint),V.id.Copy(G.id),g){var U=V.id.cf;V.id.cf.indexA=U.indexB,V.id.cf.indexB=U.indexA,V.id.cf.typeA=U.typeB,V.id.cf.typeB=U.typeA}++F}}e.pointCount=F}}}}var Ui,zi=new bt,Hi=new bt,Wi=new bt,Xi=new bt,ji=new bt,Yi=new bt,qi=new bt,Ki=new me;function Ji(e,i,n,r,s){e.pointCount=0;var a=Bt.MulTXV(n,Bt.MulXV(s,r.m_p,bt.s_t0),zi),o=i.m_vertex1,h=i.m_vertex2,u=bt.SubVV(h,o,Hi),l=bt.DotVV(u,bt.SubVV(h,a,bt.s_t0)),c=bt.DotVV(u,bt.SubVV(a,o,bt.s_t0)),_=i.m_radius+r.m_radius,f=Ki;if(f.cf.indexB=0,f.cf.typeB=t.b2ContactFeatureType.e_vertex,c<=0){var d=o,p=bt.SubVV(a,d,Wi);if(bt.DotVV(p,p)>_*_)return;if(i.m_hasVertex0){var m=i.m_vertex0,g=o,y=bt.SubVV(g,m,Xi);if(bt.DotVV(y,bt.SubVV(g,a,bt.s_t0))>0)return}return f.cf.indexA=0,f.cf.typeA=t.b2ContactFeatureType.e_vertex,e.pointCount=1,e.type=t.b2ManifoldType.e_circles,e.localNormal.SetZero(),e.localPoint.Copy(d),e.points[0].id.Copy(f),void e.points[0].localPoint.Copy(r.m_p)}if(l<=0){var v=h,S=bt.SubVV(a,v,Wi);if(bt.DotVV(S,S)>_*_)return;if(i.m_hasVertex3){var A=i.m_vertex3,T=h,E=bt.SubVV(A,T,ji);if(bt.DotVV(E,bt.SubVV(a,T,bt.s_t0))>0)return}return f.cf.indexA=1,f.cf.typeA=t.b2ContactFeatureType.e_vertex,e.pointCount=1,e.type=t.b2ManifoldType.e_circles,e.localNormal.SetZero(),e.localPoint.Copy(v),e.points[0].id.Copy(f),void e.points[0].localPoint.Copy(r.m_p)}var b=bt.DotVV(u,u),x=Yi;x.x=1/b*(l*o.x+c*h.x),x.y=1/b*(l*o.y+c*h.y);var C=bt.SubVV(a,x,Wi);if(!(bt.DotVV(C,C)>_*_)){var R=qi.Set(-u.y,u.x);bt.DotVV(R,bt.SubVV(a,o,bt.s_t0))<0&&R.Set(-R.x,-R.y),R.Normalize(),f.cf.indexA=0,f.cf.typeA=t.b2ContactFeatureType.e_face,e.pointCount=1,e.type=t.b2ManifoldType.e_faceA,e.localNormal.Copy(R),e.localPoint.Copy(o),e.points[0].id.Copy(f),e.points[0].localPoint.Copy(r.m_p)}}!function(t){t[t.e_unknown=0]="e_unknown",t[t.e_edgeA=1]="e_edgeA",t[t.e_edgeB=2]="e_edgeB"}(Ui||(Ui={}));var Qi,Zi=function(){this.type=Ui.e_unknown,this.index=0,this.separation=0},$i=function(){this.vertices=[],this.normals=[],this.count=0},tn=function(){this.i1=0,this.i2=0,this.v1=new bt,this.v2=new bt,this.normal=new bt,this.sideNormal1=new bt,this.sideOffset1=0,this.sideNormal2=new bt,this.sideOffset2=0};!function(t){t[t.e_isolated=0]="e_isolated",t[t.e_concave=1]="e_concave",t[t.e_convex=2]="e_convex"}(Qi||(Qi={}));var en=function(){function e(){this.m_polygonB=new $i,this.m_xf=new Bt,this.m_centroidB=new bt,this.m_v0=new bt,this.m_v1=new bt,this.m_v2=new bt,this.m_v3=new bt,this.m_normal0=new bt,this.m_normal1=new bt,this.m_normal2=new bt,this.m_normal=new bt,this.m_type1=Qi.e_isolated,this.m_type2=Qi.e_isolated,this.m_lowerLimit=new bt,this.m_upperLimit=new bt,this.m_radius=0,this.m_front=!1}var i=e.prototype;return i.Collide=function(i,n,r,s,a){Bt.MulTXX(r,a,this.m_xf),Bt.MulXV(this.m_xf,s.m_centroid,this.m_centroidB),this.m_v0.Copy(n.m_vertex0),this.m_v1.Copy(n.m_vertex1),this.m_v2.Copy(n.m_vertex2),this.m_v3.Copy(n.m_vertex3);var o=n.m_hasVertex0,h=n.m_hasVertex3,u=bt.SubVV(this.m_v2,this.m_v1,e.s_edge1);u.Normalize(),this.m_normal1.Set(u.y,-u.x);var c=bt.DotVV(this.m_normal1,bt.SubVV(this.m_centroidB,this.m_v1,bt.s_t0)),_=0,f=0,d=!1,p=!1;if(o){var m=bt.SubVV(this.m_v1,this.m_v0,e.s_edge0);m.Normalize(),this.m_normal0.Set(m.y,-m.x),d=bt.CrossVV(m,u)>=0,_=bt.DotVV(this.m_normal0,bt.SubVV(this.m_centroidB,this.m_v0,bt.s_t0))}if(h){var g=bt.SubVV(this.m_v3,this.m_v2,e.s_edge2);g.Normalize(),this.m_normal2.Set(g.y,-g.x),p=bt.CrossVV(u,g)>0,f=bt.DotVV(this.m_normal2,bt.SubVV(this.m_centroidB,this.m_v2,bt.s_t0))}o&&h?d&&p?(this.m_front=_>=0||c>=0||f>=0,this.m_front?(this.m_normal.Copy(this.m_normal1),this.m_lowerLimit.Copy(this.m_normal0),this.m_upperLimit.Copy(this.m_normal2)):(this.m_normal.Copy(this.m_normal1).SelfNeg(),this.m_lowerLimit.Copy(this.m_normal1).SelfNeg(),this.m_upperLimit.Copy(this.m_normal1).SelfNeg())):d?(this.m_front=_>=0||c>=0&&f>=0,this.m_front?(this.m_normal.Copy(this.m_normal1),this.m_lowerLimit.Copy(this.m_normal0),this.m_upperLimit.Copy(this.m_normal1)):(this.m_normal.Copy(this.m_normal1).SelfNeg(),this.m_lowerLimit.Copy(this.m_normal2).SelfNeg(),this.m_upperLimit.Copy(this.m_normal1).SelfNeg())):p?(this.m_front=f>=0||_>=0&&c>=0,this.m_front?(this.m_normal.Copy(this.m_normal1),this.m_lowerLimit.Copy(this.m_normal1),this.m_upperLimit.Copy(this.m_normal2)):(this.m_normal.Copy(this.m_normal1).SelfNeg(),this.m_lowerLimit.Copy(this.m_normal1).SelfNeg(),this.m_upperLimit.Copy(this.m_normal0).SelfNeg())):(this.m_front=_>=0&&c>=0&&f>=0,this.m_front?(this.m_normal.Copy(this.m_normal1),this.m_lowerLimit.Copy(this.m_normal1),this.m_upperLimit.Copy(this.m_normal1)):(this.m_normal.Copy(this.m_normal1).SelfNeg(),this.m_lowerLimit.Copy(this.m_normal2).SelfNeg(),this.m_upperLimit.Copy(this.m_normal0).SelfNeg())):o?d?(this.m_front=_>=0||c>=0,this.m_front?(this.m_normal.Copy(this.m_normal1),this.m_lowerLimit.Copy(this.m_normal0),this.m_upperLimit.Copy(this.m_normal1).SelfNeg()):(this.m_normal.Copy(this.m_normal1).SelfNeg(),this.m_lowerLimit.Copy(this.m_normal1),this.m_upperLimit.Copy(this.m_normal1).SelfNeg())):(this.m_front=_>=0&&c>=0,this.m_front?(this.m_normal.Copy(this.m_normal1),this.m_lowerLimit.Copy(this.m_normal1),this.m_upperLimit.Copy(this.m_normal1).SelfNeg()):(this.m_normal.Copy(this.m_normal1).SelfNeg(),this.m_lowerLimit.Copy(this.m_normal1),this.m_upperLimit.Copy(this.m_normal0).SelfNeg())):h?p?(this.m_front=c>=0||f>=0,this.m_front?(this.m_normal.Copy(this.m_normal1),this.m_lowerLimit.Copy(this.m_normal1).SelfNeg(),this.m_upperLimit.Copy(this.m_normal2)):(this.m_normal.Copy(this.m_normal1).SelfNeg(),this.m_lowerLimit.Copy(this.m_normal1).SelfNeg(),this.m_upperLimit.Copy(this.m_normal1))):(this.m_front=c>=0&&f>=0,this.m_front?(this.m_normal.Copy(this.m_normal1),this.m_lowerLimit.Copy(this.m_normal1).SelfNeg(),this.m_upperLimit.Copy(this.m_normal1)):(this.m_normal.Copy(this.m_normal1).SelfNeg(),this.m_lowerLimit.Copy(this.m_normal2).SelfNeg(),this.m_upperLimit.Copy(this.m_normal1))):(this.m_front=c>=0,this.m_front?(this.m_normal.Copy(this.m_normal1),this.m_lowerLimit.Copy(this.m_normal1).SelfNeg(),this.m_upperLimit.Copy(this.m_normal1).SelfNeg()):(this.m_normal.Copy(this.m_normal1).SelfNeg(),this.m_lowerLimit.Copy(this.m_normal1),this.m_upperLimit.Copy(this.m_normal1))),this.m_polygonB.count=s.m_count;for(var y=0;y<s.m_count;++y)this.m_polygonB.vertices.length<=y&&this.m_polygonB.vertices.push(new bt),this.m_polygonB.normals.length<=y&&this.m_polygonB.normals.push(new bt),Bt.MulXV(this.m_xf,s.m_vertices[y],this.m_polygonB.vertices[y]),It.MulRV(this.m_xf.q,s.m_normals[y],this.m_polygonB.normals[y]);this.m_radius=s.m_radius+n.m_radius,i.pointCount=0;var v=this.ComputeEdgeSeparation(e.s_edgeAxis);if(v.type!==Ui.e_unknown&&!(v.separation>this.m_radius)){var S=this.ComputePolygonSeparation(e.s_polygonAxis);if(!(S.type!==Ui.e_unknown&&S.separation>this.m_radius)){var A,T=.98,E=.001;A=S.type===Ui.e_unknown?v:S.separation>T*v.separation+E?S:v;var b=e.s_ie,x=e.s_rf;if(A.type===Ui.e_edgeA){i.type=t.b2ManifoldType.e_faceA;for(var C=0,R=bt.DotVV(this.m_normal,this.m_polygonB.normals[0]),w=1;w<this.m_polygonB.count;++w){var I=bt.DotVV(this.m_normal,this.m_polygonB.normals[w]);I<R&&(R=I,C=w)}var B=C,D=(B+1)%this.m_polygonB.count,P=b[0];P.v.Copy(this.m_polygonB.vertices[B]),P.id.cf.indexA=0,P.id.cf.indexB=B,P.id.cf.typeA=t.b2ContactFeatureType.e_face,P.id.cf.typeB=t.b2ContactFeatureType.e_vertex;var O=b[1];O.v.Copy(this.m_polygonB.vertices[D]),O.id.cf.indexA=0,O.id.cf.indexB=D,O.id.cf.typeA=t.b2ContactFeatureType.e_face,O.id.cf.typeB=t.b2ContactFeatureType.e_vertex,this.m_front?(x.i1=0,x.i2=1,x.v1.Copy(this.m_v1),x.v2.Copy(this.m_v2),x.normal.Copy(this.m_normal1)):(x.i1=1,x.i2=0,x.v1.Copy(this.m_v2),x.v2.Copy(this.m_v1),x.normal.Copy(this.m_normal1).SelfNeg())}else{i.type=t.b2ManifoldType.e_faceB;var M=b[0];M.v.Copy(this.m_v1),M.id.cf.indexA=0,M.id.cf.indexB=A.index,M.id.cf.typeA=t.b2ContactFeatureType.e_vertex,M.id.cf.typeB=t.b2ContactFeatureType.e_face;var N=b[1];N.v.Copy(this.m_v2),N.id.cf.indexA=0,N.id.cf.indexB=A.index,N.id.cf.typeA=t.b2ContactFeatureType.e_vertex,N.id.cf.typeB=t.b2ContactFeatureType.e_face,x.i1=A.index,x.i2=(x.i1+1)%this.m_polygonB.count,x.v1.Copy(this.m_polygonB.vertices[x.i1]),x.v2.Copy(this.m_polygonB.vertices[x.i2]),x.normal.Copy(this.m_polygonB.normals[x.i1])}x.sideNormal1.Set(x.normal.y,-x.normal.x),x.sideNormal2.Copy(x.sideNormal1).SelfNeg(),x.sideOffset1=bt.DotVV(x.sideNormal1,x.v1),x.sideOffset2=bt.DotVV(x.sideNormal2,x.v2);var L=e.s_clipPoints1,F=e.s_clipPoints2;if(!(Re(L,b,x.sideNormal1,x.sideOffset1,x.i1)<l||Re(F,L,x.sideNormal2,x.sideOffset2,x.i2)<l)){A.type===Ui.e_edgeA?(i.localNormal.Copy(x.normal),i.localPoint.Copy(x.v1)):(i.localNormal.Copy(s.m_normals[x.i1]),i.localPoint.Copy(s.m_vertices[x.i1]));for(var k=0,G=0;G<l;++G)if(bt.DotVV(x.normal,bt.SubVV(F[G].v,x.v1,bt.s_t0))<=this.m_radius){var V=i.points[k];A.type===Ui.e_edgeA?(Bt.MulTXV(this.m_xf,F[G].v,V.localPoint),V.id.Copy(F[G].id)):(V.localPoint.Copy(F[G].v),V.id.cf.typeA=F[G].id.cf.typeB,V.id.cf.typeB=F[G].id.cf.typeA,V.id.cf.indexA=F[G].id.cf.indexB,V.id.cf.indexB=F[G].id.cf.indexA),++k}i.pointCount=k}}}},i.ComputeEdgeSeparation=function(t){var e=t;e.type=Ui.e_edgeA,e.index=this.m_front?0:1,e.separation=r;for(var i=0;i<this.m_polygonB.count;++i){var n=bt.DotVV(this.m_normal,bt.SubVV(this.m_polygonB.vertices[i],this.m_v1,bt.s_t0));n<e.separation&&(e.separation=n)}return e},i.ComputePolygonSeparation=function(t){var i=t;i.type=Ui.e_unknown,i.index=-1,i.separation=-r;for(var n=e.s_perp.Set(-this.m_normal.y,this.m_normal.x),s=0;s<this.m_polygonB.count;++s){var a=bt.NegV(this.m_polygonB.normals[s],e.s_n),o=rt(bt.DotVV(a,bt.SubVV(this.m_polygonB.vertices[s],this.m_v1,bt.s_t0)),bt.DotVV(a,bt.SubVV(this.m_polygonB.vertices[s],this.m_v2,bt.s_t0)));if(o>this.m_radius)return i.type=Ui.e_edgeB,i.index=s,i.separation=o,i;if(bt.DotVV(a,n)>=0){if(bt.DotVV(bt.SubVV(a,this.m_upperLimit,bt.s_t0),this.m_normal)<-m)continue}else if(bt.DotVV(bt.SubVV(a,this.m_lowerLimit,bt.s_t0),this.m_normal)<-m)continue;o>i.separation&&(i.type=Ui.e_edgeB,i.index=s,i.separation=o)}return i},e}();en.s_edge1=new bt,en.s_edge0=new bt,en.s_edge2=new bt,en.s_ie=Te.MakeArray(2),en.s_rf=new tn,en.s_clipPoints1=Te.MakeArray(2),en.s_clipPoints2=Te.MakeArray(2),en.s_edgeAxis=new Zi,en.s_polygonAxis=new Zi,en.s_n=new bt,en.s_perp=new bt;var nn=new en;function rn(t,e,i,n,r){nn.Collide(t,e,i,n,r)}var sn,an=function(){this.mass=0,this.center=new bt(0,0),this.I=0};(sn=t.b2ShapeType||(t.b2ShapeType={}))[sn.e_unknown=-1]="e_unknown",sn[sn.e_circleShape=0]="e_circleShape",sn[sn.e_edgeShape=1]="e_edgeShape",sn[sn.e_polygonShape=2]="e_polygonShape",sn[sn.e_chainShape=3]="e_chainShape",sn[sn.e_shapeTypeCount=4]="e_shapeTypeCount";var on=function(){function e(e,i){this.m_type=t.b2ShapeType.e_unknown,this.m_radius=0,this.m_type=e,this.m_radius=i}var i=e.prototype;return i.Copy=function(t){return this.m_radius=t.m_radius,this},i.GetType=function(){return this.m_type},e}(),hn=function(e){function i(i){var n;return void 0===i&&(i=0),(n=e.call(this,t.b2ShapeType.e_circleShape,i)||this).m_p=new bt,n}s(i,e);var n=i.prototype;return n.Set=function(t,e){return void 0===e&&(e=this.m_radius),this.m_p.Copy(t),this.m_radius=e,this},n.Clone=function(){return(new i).Copy(this)},n.Copy=function(t){return e.prototype.Copy.call(this,t),this.m_p.Copy(t.m_p),this},n.GetChildCount=function(){return 1},n.TestPoint=function(t,e){var n=Bt.MulXV(t,this.m_p,i.TestPoint_s_center),r=bt.SubVV(e,n,i.TestPoint_s_d);return bt.DotVV(r,r)<=ut(this.m_radius)},n.ComputeDistance=function(t,e,n){var r=Bt.MulXV(t,this.m_p,i.ComputeDistance_s_center);return bt.SubVV(e,r,n),n.Normalize()-this.m_radius},n.RayCast=function(t,e,n){var r=Bt.MulXV(n,this.m_p,i.RayCast_s_position),s=bt.SubVV(e.p1,r,i.RayCast_s_s),o=bt.DotVV(s,s)-ut(this.m_radius),h=bt.SubVV(e.p2,e.p1,i.RayCast_s_r),u=bt.DotVV(s,h),l=bt.DotVV(h,h),c=u*u-l*o;if(c<0||l<a)return!1;var _=-(u+ct(c));return 0<=_&&_<=e.maxFraction*l&&(_/=l,t.fraction=_,bt.AddVMulSV(s,_,h,t.normal).SelfNormalize(),!0)},n.ComputeAABB=function(t,e){var n=Bt.MulXV(e,this.m_p,i.ComputeAABB_s_p);t.lowerBound.Set(n.x-this.m_radius,n.y-this.m_radius),t.upperBound.Set(n.x+this.m_radius,n.y+this.m_radius)},n.ComputeMass=function(t,e){var i=ut(this.m_radius);t.mass=e*h*i,t.center.Copy(this.m_p),t.I=t.mass*(.5*i+bt.DotVV(this.m_p,this.m_p))},n.SetupDistanceProxy=function(t){t.m_vertices=t.m_buffer,t.m_vertices[0].Copy(this.m_p),t.m_count=1,t.m_radius=this.m_radius},n.ComputeSubmergedArea=function(t,e,i,n){var r=Bt.MulXV(i,this.m_p,new bt),s=-(bt.DotVV(t,r)-e);if(s<-this.m_radius+a)return 0;if(s>this.m_radius)return n.Copy(r),h*this.m_radius*this.m_radius;var o=this.m_radius*this.m_radius,u=s*s,l=o*(yt(s/this.m_radius)+h/2)+s*ct(o-u),c=-2/3*_t(o-u,1.5)/l;return n.x=r.x+t.x*c,n.y=r.y+t.y*c,l},n.Dump=function(t){t(" const shape: b2CircleShape = new b2CircleShape();\n"),t(" shape.m_radius = %.15f;\n",this.m_radius),t(" shape.m_p.Set(%.15f, %.15f);\n",this.m_p.x,this.m_p.y)},i}(on);hn.TestPoint_s_center=new bt,hn.TestPoint_s_d=new bt,hn.ComputeDistance_s_center=new bt,hn.RayCast_s_position=new bt,hn.RayCast_s_s=new bt,hn.RayCast_s_r=new bt,hn.ComputeAABB_s_p=new bt;var un=function(e){function i(){var i;return(i=e.call(this,t.b2ShapeType.e_polygonShape,g)||this).m_centroid=new bt(0,0),i.m_vertices=[],i.m_normals=[],i.m_count=0,i}s(i,e);var n=i.prototype;return n.Clone=function(){return(new i).Copy(this)},n.Copy=function(t){e.prototype.Copy.call(this,t),this.m_centroid.Copy(t.m_centroid),this.m_count=t.m_count,this.m_vertices=bt.MakeArray(this.m_count),this.m_normals=bt.MakeArray(this.m_count);for(var i=0;i<this.m_count;++i)this.m_vertices[i].Copy(t.m_vertices[i]),this.m_normals[i].Copy(t.m_normals[i]);return this},n.GetChildCount=function(){return 1},n.Set=function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];if("number"==typeof e[0][0]){var n=e[0];if(n.length%2!=0)throw new Error;return this._Set((function(t){return{x:n[2*t],y:n[2*t+1]}}),n.length/2)}var r=e[0],s=e[1]||r.length;return this._Set((function(t){return r[t]}),s)},n._Set=function(t,e){if(e<3)return this.SetAsBox(1,1);for(var n=e,r=[],s=0;s<n;++s){for(var a=t(s),o=!0,h=0;h<r.length;++h)if(bt.DistanceSquaredVV(a,r[h])<.25*p*p){o=!1;break}o&&r.push(a)}if((n=r.length)<3)return this.SetAsBox(1,1);for(var u=0,l=r[0].x,c=1;c<n;++c){var _=r[c].x;(_>l||_===l&&r[c].y<r[u].y)&&(u=c,l=_)}for(var f=[],d=0,m=u;;){f[d]=m;for(var g=0,y=1;y<n;++y)if(g!==m){var v=bt.SubVV(r[g],r[f[d]],i.Set_s_r),S=bt.SubVV(r[y],r[f[d]],i.Set_s_v),A=bt.CrossVV(v,S);A<0&&(g=y),0===A&&S.LengthSquared()>v.LengthSquared()&&(g=y)}else g=y;if(++d,m=g,g===u)break}this.m_count=d,this.m_vertices=bt.MakeArray(this.m_count),this.m_normals=bt.MakeArray(this.m_count);for(var T=0;T<d;++T)this.m_vertices[T].Copy(r[f[T]]);for(var E=0;E<d;++E){var b=this.m_vertices[E],x=this.m_vertices[(E+1)%d],C=bt.SubVV(x,b,bt.s_t0);bt.CrossVOne(C,this.m_normals[E]).SelfNormalize()}return i.ComputeCentroid(this.m_vertices,d,this.m_centroid),this},n.SetAsBox=function(t,e,i,n){if(void 0===n&&(n=0),this.m_count=4,this.m_vertices=bt.MakeArray(this.m_count),this.m_normals=bt.MakeArray(this.m_count),this.m_vertices[0].Set(-t,-e),this.m_vertices[1].Set(t,-e),this.m_vertices[2].Set(t,e),this.m_vertices[3].Set(-t,e),this.m_normals[0].Set(0,-1),this.m_normals[1].Set(1,0),this.m_normals[2].Set(0,1),this.m_normals[3].Set(-1,0),this.m_centroid.SetZero(),i){this.m_centroid.Copy(i);var r=new Bt;r.SetPosition(i),r.SetRotationAngle(n);for(var s=0;s<this.m_count;++s)Bt.MulXV(r,this.m_vertices[s],this.m_vertices[s]),It.MulRV(r.q,this.m_normals[s],this.m_normals[s])}return this},n.TestPoint=function(t,e){for(var n=Bt.MulTXV(t,e,i.TestPoint_s_pLocal),r=0;r<this.m_count;++r)if(bt.DotVV(this.m_normals[r],bt.SubVV(n,this.m_vertices[r],bt.s_t0))>0)return!1;return!0},n.ComputeDistance=function(t,e,n){for(var s=Bt.MulTXV(t,e,i.ComputeDistance_s_pLocal),a=-r,o=i.ComputeDistance_s_normalForMaxDistance.Copy(s),h=0;h<this.m_count;++h){var u=bt.DotVV(this.m_normals[h],bt.SubVV(s,this.m_vertices[h],bt.s_t0));u>a&&(a=u,o.Copy(this.m_normals[h]))}if(a>0){for(var l=i.ComputeDistance_s_minDistance.Copy(o),c=a*a,_=0;_<this.m_count;++_){var f=bt.SubVV(s,this.m_vertices[_],i.ComputeDistance_s_distance),d=f.LengthSquared();c>d&&(l.Copy(f),c=d)}return It.MulRV(t.q,l,n),n.Normalize(),Math.sqrt(c)}return It.MulRV(t.q,o,n),a},n.RayCast=function(t,e,n){for(var r=Bt.MulTXV(n,e.p1,i.RayCast_s_p1),s=Bt.MulTXV(n,e.p2,i.RayCast_s_p2),a=bt.SubVV(s,r,i.RayCast_s_d),o=0,h=e.maxFraction,u=-1,l=0;l<this.m_count;++l){var c=bt.DotVV(this.m_normals[l],bt.SubVV(this.m_vertices[l],r,bt.s_t0)),_=bt.DotVV(this.m_normals[l],a);if(0===_){if(c<0)return!1}else _<0&&c<o*_?(o=c/_,u=l):_>0&&c<h*_&&(h=c/_);if(h<o)return!1}return u>=0&&(t.fraction=o,It.MulRV(n.q,this.m_normals[u],t.normal),!0)},n.ComputeAABB=function(t,e){for(var n=Bt.MulXV(e,this.m_vertices[0],t.lowerBound),r=t.upperBound.Copy(n),s=0;s<this.m_count;++s){var a=Bt.MulXV(e,this.m_vertices[s],i.ComputeAABB_s_v);bt.MinV(a,n,n),bt.MaxV(a,r,r)}var o=this.m_radius;n.SelfSubXY(o,o),r.SelfAddXY(o,o)},n.ComputeMass=function(t,e){for(var n=i.ComputeMass_s_center.SetZero(),r=0,s=0,a=i.ComputeMass_s_s.SetZero(),o=0;o<this.m_count;++o)a.SelfAdd(this.m_vertices[o]);a.SelfMul(1/this.m_count);for(var h=1/3,u=0;u<this.m_count;++u){var l=bt.SubVV(this.m_vertices[u],a,i.ComputeMass_s_e1),c=bt.SubVV(this.m_vertices[(u+1)%this.m_count],a,i.ComputeMass_s_e2),_=bt.CrossVV(l,c),f=.5*_;r+=f,n.SelfAdd(bt.MulSV(f*h,bt.AddVV(l,c,bt.s_t0),bt.s_t1));var d=l.x,p=l.y,m=c.x,g=c.y;s+=.25*h*_*(d*d+m*d+m*m+p*p+g*p+g*g)}t.mass=e*r,n.SelfMul(1/r),bt.AddVV(n,a,t.center),t.I=e*s,t.I+=t.mass*(bt.DotVV(t.center,t.center)-bt.DotVV(n,n))},n.Validate=function(){for(var t=0;t<this.m_count;++t)for(var e=t,n=(t+1)%this.m_count,r=this.m_vertices[e],s=bt.SubVV(this.m_vertices[n],r,i.Validate_s_e),a=0;a<this.m_count;++a)if(a!==e&&a!==n){var o=bt.SubVV(this.m_vertices[a],r,i.Validate_s_v);if(bt.CrossVV(s,o)<0)return!1}return!0},n.SetupDistanceProxy=function(t){t.m_vertices=this.m_vertices,t.m_count=this.m_count,t.m_radius=this.m_radius},n.ComputeSubmergedArea=function(t,e,n,r){for(var s=It.MulTRV(n.q,t,i.ComputeSubmergedArea_s_normalL),o=e-bt.DotVV(t,n.p),h=[],u=0,l=-1,c=-1,_=!1,f=0;f<this.m_count;++f){h[f]=bt.DotVV(s,this.m_vertices[f])-o;var d=h[f]<-a;f>0&&(d?_||(l=f-1,u++):_&&(c=f-1,u++)),_=d}switch(u){case 0:if(_){var p=i.ComputeSubmergedArea_s_md;return this.ComputeMass(p,1),Bt.MulXV(n,p.center,r),p.mass}return 0;case 1:-1===l?l=this.m_count-1:c=this.m_count-1}for(var m,g=(l+1)%this.m_count,y=(c+1)%this.m_count,v=(0-h[l])/(h[g]-h[l]),S=(0-h[c])/(h[y]-h[c]),A=i.ComputeSubmergedArea_s_intoVec.Set(this.m_vertices[l].x*(1-v)+this.m_vertices[g].x*v,this.m_vertices[l].y*(1-v)+this.m_vertices[g].y*v),T=i.ComputeSubmergedArea_s_outoVec.Set(this.m_vertices[c].x*(1-S)+this.m_vertices[y].x*S,this.m_vertices[c].y*(1-S)+this.m_vertices[y].y*S),E=0,b=i.ComputeSubmergedArea_s_center.SetZero(),x=this.m_vertices[g],C=g;C!==y;){m=(C=(C+1)%this.m_count)===y?T:this.m_vertices[C];var R=.5*((x.x-A.x)*(m.y-A.y)-(x.y-A.y)*(m.x-A.x));E+=R,b.x+=R*(A.x+x.x+m.x)/3,b.y+=R*(A.y+x.y+m.y)/3,x=m}return b.SelfMul(1/E),Bt.MulXV(n,b,r),E},n.Dump=function(t){t(" const shape: b2PolygonShape = new b2PolygonShape();\n"),t(" const vs: b2Vec2[] = [];\n");for(var e=0;e<this.m_count;++e)t(" vs[%d] = new b2Vec2(%.15f, %.15f);\n",e,this.m_vertices[e].x,this.m_vertices[e].y);t(" shape.Set(vs, %d);\n",this.m_count)},i.ComputeCentroid=function(t,e,n){var r=n;r.SetZero();for(var s=0,a=i.ComputeCentroid_s_pRef.SetZero(),o=1/3,h=0;h<e;++h){var u=a,l=t[h],c=t[(h+1)%e],_=bt.SubVV(l,u,i.ComputeCentroid_s_e1),f=bt.SubVV(c,u,i.ComputeCentroid_s_e2),d=.5*bt.CrossVV(_,f);s+=d,r.x+=d*o*(u.x+l.x+c.x),r.y+=d*o*(u.y+l.y+c.y)}return r.SelfMul(1/s),r},i}(on);un.Set_s_r=new bt,un.Set_s_v=new bt,un.TestPoint_s_pLocal=new bt,un.ComputeDistance_s_pLocal=new bt,un.ComputeDistance_s_normalForMaxDistance=new bt,un.ComputeDistance_s_minDistance=new bt,un.ComputeDistance_s_distance=new bt,un.RayCast_s_p1=new bt,un.RayCast_s_p2=new bt,un.RayCast_s_d=new bt,un.ComputeAABB_s_v=new bt,un.ComputeMass_s_center=new bt,un.ComputeMass_s_s=new bt,un.ComputeMass_s_e1=new bt,un.ComputeMass_s_e2=new bt,un.Validate_s_e=new bt,un.Validate_s_v=new bt,un.ComputeSubmergedArea_s_normalL=new bt,un.ComputeSubmergedArea_s_md=new an,un.ComputeSubmergedArea_s_intoVec=new bt,un.ComputeSubmergedArea_s_outoVec=new bt,un.ComputeSubmergedArea_s_center=new bt,un.ComputeCentroid_s_pRef=new bt,un.ComputeCentroid_s_e1=new bt,un.ComputeCentroid_s_e2=new bt;var ln=function(e){function i(){var i;return(i=e.call(this,t.b2ShapeType.e_edgeShape,g)||this).m_vertex1=new bt,i.m_vertex2=new bt,i.m_vertex0=new bt,i.m_vertex3=new bt,i.m_hasVertex0=!1,i.m_hasVertex3=!1,i}s(i,e);var n=i.prototype;return n.Set=function(t,e){return this.m_vertex1.Copy(t),this.m_vertex2.Copy(e),this.m_hasVertex0=!1,this.m_hasVertex3=!1,this},n.Clone=function(){return(new i).Copy(this)},n.Copy=function(t){return e.prototype.Copy.call(this,t),this.m_vertex1.Copy(t.m_vertex1),this.m_vertex2.Copy(t.m_vertex2),this.m_vertex0.Copy(t.m_vertex0),this.m_vertex3.Copy(t.m_vertex3),this.m_hasVertex0=t.m_hasVertex0,this.m_hasVertex3=t.m_hasVertex3,this},n.GetChildCount=function(){return 1},n.TestPoint=function(){return!1},n.ComputeDistance=function(t,e,n){var r=Bt.MulXV(t,this.m_vertex1,i.ComputeDistance_s_v1),s=Bt.MulXV(t,this.m_vertex2,i.ComputeDistance_s_v2),a=bt.SubVV(e,r,i.ComputeDistance_s_d),o=bt.SubVV(s,r,i.ComputeDistance_s_s),h=bt.DotVV(a,o);if(h>0){var u=bt.DotVV(o,o);h>u?bt.SubVV(e,s,a):a.SelfMulSub(h/u,o)}return n.Copy(a),n.Normalize()},n.RayCast=function(t,e,n){var r=Bt.MulTXV(n,e.p1,i.RayCast_s_p1),s=Bt.MulTXV(n,e.p2,i.RayCast_s_p2),a=bt.SubVV(s,r,i.RayCast_s_d),o=this.m_vertex1,h=this.m_vertex2,u=bt.SubVV(h,o,i.RayCast_s_e),l=t.normal.Set(u.y,-u.x).SelfNormalize(),c=bt.DotVV(l,bt.SubVV(o,r,bt.s_t0)),_=bt.DotVV(l,a);if(0===_)return!1;var f=c/_;if(f<0||e.maxFraction<f)return!1;var d=bt.AddVMulSV(r,f,a,i.RayCast_s_q),p=bt.SubVV(h,o,i.RayCast_s_r),m=bt.DotVV(p,p);if(0===m)return!1;var g=bt.DotVV(bt.SubVV(d,o,bt.s_t0),p)/m;return!(g<0||1<g||(t.fraction=f,It.MulRV(n.q,t.normal,t.normal),c>0&&t.normal.SelfNeg(),0))},n.ComputeAABB=function(t,e){var n=Bt.MulXV(e,this.m_vertex1,i.ComputeAABB_s_v1),r=Bt.MulXV(e,this.m_vertex2,i.ComputeAABB_s_v2);bt.MinV(n,r,t.lowerBound),bt.MaxV(n,r,t.upperBound);var s=this.m_radius;t.lowerBound.SelfSubXY(s,s),t.upperBound.SelfAddXY(s,s)},n.ComputeMass=function(t){t.mass=0,bt.MidVV(this.m_vertex1,this.m_vertex2,t.center),t.I=0},n.SetupDistanceProxy=function(t){t.m_vertices=t.m_buffer,t.m_vertices[0].Copy(this.m_vertex1),t.m_vertices[1].Copy(this.m_vertex2),t.m_count=2,t.m_radius=this.m_radius},n.ComputeSubmergedArea=function(t,e,i,n){return n.SetZero(),0},n.Dump=function(t){t(" const shape: b2EdgeShape = new b2EdgeShape();\n"),t(" shape.m_radius = %.15f;\n",this.m_radius),t(" shape.m_vertex0.Set(%.15f, %.15f);\n",this.m_vertex0.x,this.m_vertex0.y),t(" shape.m_vertex1.Set(%.15f, %.15f);\n",this.m_vertex1.x,this.m_vertex1.y),t(" shape.m_vertex2.Set(%.15f, %.15f);\n",this.m_vertex2.x,this.m_vertex2.y),t(" shape.m_vertex3.Set(%.15f, %.15f);\n",this.m_vertex3.x,this.m_vertex3.y),t(" shape.m_hasVertex0 = %s;\n",this.m_hasVertex0),t(" shape.m_hasVertex3 = %s;\n",this.m_hasVertex3)},i}(on);ln.ComputeDistance_s_v1=new bt,ln.ComputeDistance_s_v2=new bt,ln.ComputeDistance_s_d=new bt,ln.ComputeDistance_s_s=new bt,ln.RayCast_s_p1=new bt,ln.RayCast_s_p2=new bt,ln.RayCast_s_d=new bt,ln.RayCast_s_e=new bt,ln.RayCast_s_q=new bt,ln.RayCast_s_r=new bt,ln.ComputeAABB_s_v1=new bt,ln.ComputeAABB_s_v2=new bt;var cn=function(e){function i(){var i;return(i=e.call(this,t.b2ShapeType.e_chainShape,g)||this).m_vertices=[],i.m_count=0,i.m_prevVertex=new bt,i.m_nextVertex=new bt,i.m_hasPrevVertex=!1,i.m_hasNextVertex=!1,i}s(i,e);var n=i.prototype;return n.CreateLoop=function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];if("number"==typeof e[0][0]){var n=e[0];if(n.length%2!=0)throw new Error;return this._CreateLoop((function(t){return{x:n[2*t],y:n[2*t+1]}}),n.length/2)}var r=e[0],s=e[1]||r.length;return this._CreateLoop((function(t){return r[t]}),s)},n._CreateLoop=function(t,e){if(e<3)return this;this.m_count=e+1,this.m_vertices=bt.MakeArray(this.m_count);for(var i=0;i<e;++i)this.m_vertices[i].Copy(t(i));return this.m_vertices[e].Copy(this.m_vertices[0]),this.m_prevVertex.Copy(this.m_vertices[this.m_count-2]),this.m_nextVertex.Copy(this.m_vertices[1]),this.m_hasPrevVertex=!0,this.m_hasNextVertex=!0,this},n.CreateChain=function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];if("number"==typeof e[0][0]){var n=e[0];if(n.length%2!=0)throw new Error;return this._CreateChain((function(t){return{x:n[2*t],y:n[2*t+1]}}),n.length/2)}var r=e[0],s=e[1]||r.length;return this._CreateChain((function(t){return r[t]}),s)},n._CreateChain=function(t,e){this.m_count=e,this.m_vertices=bt.MakeArray(e);for(var i=0;i<e;++i)this.m_vertices[i].Copy(t(i));return this.m_hasPrevVertex=!1,this.m_hasNextVertex=!1,this.m_prevVertex.SetZero(),this.m_nextVertex.SetZero(),this},n.SetPrevVertex=function(t){return this.m_prevVertex.Copy(t),this.m_hasPrevVertex=!0,this},n.SetNextVertex=function(t){return this.m_nextVertex.Copy(t),this.m_hasNextVertex=!0,this},n.Clone=function(){return(new i).Copy(this)},n.Copy=function(t){return e.prototype.Copy.call(this,t),this._CreateChain((function(e){return t.m_vertices[e]}),t.m_count),this.m_prevVertex.Copy(t.m_prevVertex),this.m_nextVertex.Copy(t.m_nextVertex),this.m_hasPrevVertex=t.m_hasPrevVertex,this.m_hasNextVertex=t.m_hasNextVertex,this},n.GetChildCount=function(){return this.m_count-1},n.GetChildEdge=function(t,e){t.m_radius=this.m_radius,t.m_vertex1.Copy(this.m_vertices[e]),t.m_vertex2.Copy(this.m_vertices[e+1]),e>0?(t.m_vertex0.Copy(this.m_vertices[e-1]),t.m_hasVertex0=!0):(t.m_vertex0.Copy(this.m_prevVertex),t.m_hasVertex0=this.m_hasPrevVertex),e<this.m_count-2?(t.m_vertex3.Copy(this.m_vertices[e+2]),t.m_hasVertex3=!0):(t.m_vertex3.Copy(this.m_nextVertex),t.m_hasVertex3=this.m_hasNextVertex)},n.TestPoint=function(){return!1},n.ComputeDistance=function(t,e,n,r){var s=i.ComputeDistance_s_edgeShape;return this.GetChildEdge(s,r),s.ComputeDistance(t,e,n,0)},n.RayCast=function(t,e,n,r){var s=i.RayCast_s_edgeShape;return s.m_vertex1.Copy(this.m_vertices[r]),s.m_vertex2.Copy(this.m_vertices[(r+1)%this.m_count]),s.RayCast(t,e,n,0)},n.ComputeAABB=function(t,e,n){var r=this.m_vertices[n],s=this.m_vertices[(n+1)%this.m_count],a=Bt.MulXV(e,r,i.ComputeAABB_s_v1),o=Bt.MulXV(e,s,i.ComputeAABB_s_v2);bt.MinV(a,o,t.lowerBound),bt.MaxV(a,o,t.upperBound)},n.ComputeMass=function(t){t.mass=0,t.center.SetZero(),t.I=0},n.SetupDistanceProxy=function(t,e){t.m_vertices=t.m_buffer,t.m_vertices[0].Copy(this.m_vertices[e]),e+1<this.m_count?t.m_vertices[1].Copy(this.m_vertices[e+1]):t.m_vertices[1].Copy(this.m_vertices[0]),t.m_count=2,t.m_radius=this.m_radius},n.ComputeSubmergedArea=function(t,e,i,n){return n.SetZero(),0},n.Dump=function(t){t(" const shape: b2ChainShape = new b2ChainShape();\n"),t(" const vs: b2Vec2[] = [];\n");for(var e=0;e<this.m_count;++e)t(" vs[%d] = new bVec2(%.15f, %.15f);\n",e,this.m_vertices[e].x,this.m_vertices[e].y);t(" shape.CreateChain(vs, %d);\n",this.m_count),t(" shape.m_prevVertex.Set(%.15f, %.15f);\n",this.m_prevVertex.x,this.m_prevVertex.y),t(" shape.m_nextVertex.Set(%.15f, %.15f);\n",this.m_nextVertex.x,this.m_nextVertex.y),t(" shape.m_hasPrevVertex = %s;\n",this.m_hasPrevVertex?"true":"false"),t(" shape.m_hasNextVertex = %s;\n",this.m_hasNextVertex?"true":"false")},i}(on);cn.ComputeDistance_s_edgeShape=new ln,cn.RayCast_s_edgeShape=new ln,cn.ComputeAABB_s_v1=new bt,cn.ComputeAABB_s_v2=new bt;var _n=function(){function t(){this.categoryBits=1,this.maskBits=65535,this.groupIndex=0}var e=t.prototype;return e.Clone=function(){return(new t).Copy(this)},e.Copy=function(t){return this.categoryBits=t.categoryBits,this.maskBits=t.maskBits,this.groupIndex=t.groupIndex||0,this},t}();_n.DEFAULT=new _n;var fn=function(){this.userData=null,this.friction=.2,this.restitution=0,this.density=0,this.isSensor=!1,this.filter=new _n},dn=function(){function t(t,e){this.aabb=new xe,this.childIndex=0,this.fixture=t,this.childIndex=e,this.fixture.m_shape.ComputeAABB(this.aabb,this.fixture.m_body.GetTransform(),e),this.treeNode=this.fixture.m_body.m_world.m_contactManager.m_broadPhase.CreateProxy(this.aabb,this)}var e=t.prototype;return e.Reset=function(){this.fixture.m_body.m_world.m_contactManager.m_broadPhase.DestroyProxy(this.treeNode)},e.Touch=function(){this.fixture.m_body.m_world.m_contactManager.m_broadPhase.TouchProxy(this.treeNode)},e.Synchronize=function(e,i,n){if(e===i)this.fixture.m_shape.ComputeAABB(this.aabb,e,this.childIndex),this.fixture.m_body.m_world.m_contactManager.m_broadPhase.MoveProxy(this.treeNode,this.aabb,n);else{var r=t.Synchronize_s_aabb1,s=t.Synchronize_s_aabb2;this.fixture.m_shape.ComputeAABB(r,e,this.childIndex),this.fixture.m_shape.ComputeAABB(s,i,this.childIndex),this.aabb.Combine2(r,s),this.fixture.m_body.m_world.m_contactManager.m_broadPhase.MoveProxy(this.treeNode,this.aabb,n)}},t}();dn.Synchronize_s_aabb1=new xe,dn.Synchronize_s_aabb2=new xe;var pn,mn=function(){function t(t,e){this.m_density=0,this.m_next=null,this.m_friction=0,this.m_restitution=0,this.m_proxies=[],this.m_filter=new _n,this.m_isSensor=!1,this.m_userData=null,this.m_body=t,this.m_shape=e.shape.Clone(),this.m_userData=i(e.userData,null),this.m_friction=i(e.friction,.2),this.m_restitution=i(e.restitution,0),this.m_filter.Copy(i(e.filter,_n.DEFAULT)),this.m_isSensor=i(e.isSensor,!1),this.m_density=i(e.density,0)}var e=t.prototype;return e.Reset=function(){},e.GetType=function(){return this.m_shape.GetType()},e.GetShape=function(){return this.m_shape},e.SetSensor=function(t){t!==this.m_isSensor&&(this.m_body.SetAwake(!0),this.m_isSensor=t)},e.IsSensor=function(){return this.m_isSensor},e.SetFilterData=function(t){this.m_filter.Copy(t),this.Refilter()},e.GetFilterData=function(){return this.m_filter},e.Refilter=function(){for(var t=this.m_body.GetContactList();t;){var e=t.contact,i=e.GetFixtureA(),n=e.GetFixtureB();i!==this&&n!==this||e.FlagForFiltering(),t=t.next}this.TouchProxies()},e.GetBody=function(){return this.m_body},e.GetNext=function(){return this.m_next},e.GetUserData=function(){return this.m_userData},e.SetUserData=function(t){this.m_userData=t},e.TestPoint=function(t){return this.m_shape.TestPoint(this.m_body.GetTransform(),t)},e.ComputeDistance=function(t,e,i){return this.m_shape.ComputeDistance(this.m_body.GetTransform(),t,e,i)},e.RayCast=function(t,e,i){return this.m_shape.RayCast(t,e,this.m_body.GetTransform(),i)},e.GetMassData=function(t){return void 0===t&&(t=new an),this.m_shape.ComputeMass(t,this.m_density),t},e.SetDensity=function(t){this.m_density=t},e.GetDensity=function(){return this.m_density},e.GetFriction=function(){return this.m_friction},e.SetFriction=function(t){this.m_friction=t},e.GetRestitution=function(){return this.m_restitution},e.SetRestitution=function(t){this.m_restitution=t},e.GetAABB=function(t){return this.m_proxies[t].aabb},e.Dump=function(t,e){t(" const fd: b2FixtureDef = new b2FixtureDef();\n"),t(" fd.friction = %.15f;\n",this.m_friction),t(" fd.restitution = %.15f;\n",this.m_restitution),t(" fd.density = %.15f;\n",this.m_density),t(" fd.isSensor = %s;\n",this.m_isSensor?"true":"false"),t(" fd.filter.categoryBits = %d;\n",this.m_filter.categoryBits),t(" fd.filter.maskBits = %d;\n",this.m_filter.maskBits),t(" fd.filter.groupIndex = %d;\n",this.m_filter.groupIndex),this.m_shape.Dump(t),t("\n"),t(" fd.shape = shape;\n"),t("\n"),t(" bodies[%d].CreateFixture(fd);\n",e)},e.CreateProxies=function(){if(0!==this.m_proxies.length)throw new Error;for(var t=0;t<this.m_shape.GetChildCount();++t)this.m_proxies[t]=new dn(this,t)},e.DestroyProxies=function(){for(var t,e=f(this.m_proxies);!(t=e()).done;)t.value.Reset();this.m_proxies.length=0},e.TouchProxies=function(){for(var t,e=f(this.m_proxies);!(t=e()).done;)t.value.Touch()},e.SynchronizeProxies=function(t,e,i){for(var n,r=f(this.m_proxies);!(n=r()).done;)n.value.Synchronize(t,e,i)},n(t,[{key:"m_proxyCount",get:function(){return this.m_proxies.length}}]),t}();(pn=t.b2BodyType||(t.b2BodyType={}))[pn.b2_unknown=-1]="b2_unknown",pn[pn.b2_staticBody=0]="b2_staticBody",pn[pn.b2_kinematicBody=1]="b2_kinematicBody",pn[pn.b2_dynamicBody=2]="b2_dynamicBody";var gn,yn,vn=function(){this.type=t.b2BodyType.b2_staticBody,this.position=new bt(0,0),this.angle=0,this.linearVelocity=new bt(0,0),this.angularVelocity=0,this.linearDamping=0,this.angularDamping=0,this.allowSleep=!0,this.awake=!0,this.fixedRotation=!1,this.bullet=!1,this.active=!0,this.userData=null,this.gravityScale=1},Sn=function(){function e(e,n){this.m_type=t.b2BodyType.b2_staticBody,this.m_islandFlag=!1,this.m_awakeFlag=!1,this.m_autoSleepFlag=!1,this.m_bulletFlag=!1,this.m_fixedRotationFlag=!1,this.m_activeFlag=!1,this.m_toiFlag=!1,this.m_islandIndex=0,this.m_xf=new Bt,this.m_xf0=new Bt,this.m_sweep=new Pt,this.m_linearVelocity=new bt,this.m_angularVelocity=0,this.m_force=new bt,this.m_torque=0,this.m_prev=null,this.m_next=null,this.m_fixtureList=null,this.m_fixtureCount=0,this.m_jointList=null,this.m_contactList=null,this.m_mass=1,this.m_invMass=1,this.m_I=0,this.m_invI=0,this.m_linearDamping=0,this.m_angularDamping=0,this.m_gravityScale=1,this.m_sleepTime=0,this.m_userData=null,this.m_controllerList=null,this.m_controllerCount=0,this.m_bulletFlag=i(e.bullet,!1),this.m_fixedRotationFlag=i(e.fixedRotation,!1),this.m_autoSleepFlag=i(e.allowSleep,!0),this.m_awakeFlag=i(e.awake,!0),this.m_activeFlag=i(e.active,!0),this.m_world=n,this.m_xf.p.Copy(i(e.position,bt.ZERO)),this.m_xf.q.SetAngle(i(e.angle,0)),this.m_xf0.Copy(this.m_xf),this.m_sweep.localCenter.SetZero(),this.m_sweep.c0.Copy(this.m_xf.p),this.m_sweep.c.Copy(this.m_xf.p),this.m_sweep.a0=this.m_sweep.a=this.m_xf.q.GetAngle(),this.m_sweep.alpha0=0,this.m_linearVelocity.Copy(i(e.linearVelocity,bt.ZERO)),this.m_angularVelocity=i(e.angularVelocity,0),this.m_linearDamping=i(e.linearDamping,0),this.m_angularDamping=i(e.angularDamping,0),this.m_gravityScale=i(e.gravityScale,1),this.m_force.SetZero(),this.m_torque=0,this.m_sleepTime=0,this.m_type=i(e.type,t.b2BodyType.b2_staticBody),e.type===t.b2BodyType.b2_dynamicBody?(this.m_mass=1,this.m_invMass=1):(this.m_mass=0,this.m_invMass=0),this.m_I=0,this.m_invI=0,this.m_userData=e.userData,this.m_fixtureList=null,this.m_fixtureCount=0,this.m_controllerList=null,this.m_controllerCount=0}var n=e.prototype;return n.CreateFixture=function(t,e){return void 0===e&&(e=0),t instanceof on?this.CreateFixtureShapeDensity(t,e):this.CreateFixtureDef(t)},n.CreateFixtureDef=function(t){if(this.m_world.IsLocked())throw new Error;var e=new mn(this,t);return this.m_activeFlag&&e.CreateProxies(),e.m_next=this.m_fixtureList,this.m_fixtureList=e,++this.m_fixtureCount,e.m_density>0&&this.ResetMassData(),this.m_world.m_newFixture=!0,e},n.CreateFixtureShapeDensity=function(t,i){void 0===i&&(i=0);var n=e.CreateFixtureShapeDensity_s_def;return n.shape=t,n.density=i,this.CreateFixtureDef(n)},n.DestroyFixture=function(t){if(this.m_world.IsLocked())throw new Error;for(var e=this.m_fixtureList,i=null;null!==e;){if(e===t){i?i.m_next=t.m_next:this.m_fixtureList=t.m_next;break}i=e,e=e.m_next}for(var n=this.m_contactList;n;){var r=n.contact;n=n.next;var s=r.GetFixtureA(),a=r.GetFixtureB();t!==s&&t!==a||this.m_world.m_contactManager.Destroy(r)}this.m_activeFlag&&t.DestroyProxies(),t.m_next=null,t.Reset(),--this.m_fixtureCount,this.ResetMassData()},n.SetTransformVec=function(t,e){this.SetTransformXY(t.x,t.y,e)},n.SetTransformXY=function(t,e,i){if(this.m_world.IsLocked())throw new Error;this.m_xf.q.SetAngle(i),this.m_xf.p.Set(t,e),this.m_xf0.Copy(this.m_xf),Bt.MulXV(this.m_xf,this.m_sweep.localCenter,this.m_sweep.c),this.m_sweep.a=i,this.m_sweep.c0.Copy(this.m_sweep.c),this.m_sweep.a0=i;for(var n=this.m_fixtureList;n;n=n.m_next)n.SynchronizeProxies(this.m_xf,this.m_xf,bt.ZERO);this.m_world.m_contactManager.FindNewContacts()},n.SetTransform=function(t){this.SetTransformVec(t.p,t.GetAngle())},n.GetTransform=function(){return this.m_xf},n.GetPosition=function(){return this.m_xf.p},n.SetPosition=function(t){this.SetTransformVec(t,this.GetAngle())},n.SetPositionXY=function(t,e){this.SetTransformXY(t,e,this.GetAngle())},n.GetAngle=function(){return this.m_sweep.a},n.SetAngle=function(t){this.SetTransformVec(this.GetPosition(),t)},n.GetWorldCenter=function(){return this.m_sweep.c},n.GetLocalCenter=function(){return this.m_sweep.localCenter},n.SetLinearVelocity=function(e){this.m_type!==t.b2BodyType.b2_staticBody&&(bt.DotVV(e,e)>0&&this.SetAwake(!0),this.m_linearVelocity.Copy(e))},n.GetLinearVelocity=function(){return this.m_linearVelocity},n.SetAngularVelocity=function(e){this.m_type!==t.b2BodyType.b2_staticBody&&(e*e>0&&this.SetAwake(!0),this.m_angularVelocity=e)},n.GetAngularVelocity=function(){return this.m_angularVelocity},n.GetDefinition=function(t){return t.type=this.GetType(),t.allowSleep=this.m_autoSleepFlag,t.angle=this.GetAngle(),t.angularDamping=this.m_angularDamping,t.gravityScale=this.m_gravityScale,t.angularVelocity=this.m_angularVelocity,t.fixedRotation=this.m_fixedRotationFlag,t.bullet=this.m_bulletFlag,t.awake=this.m_awakeFlag,t.linearDamping=this.m_linearDamping,t.linearVelocity.Copy(this.GetLinearVelocity()),t.position.Copy(this.GetPosition()),t.userData=this.GetUserData(),t},n.ApplyForce=function(e,i,n){void 0===n&&(n=!0),this.m_type===t.b2BodyType.b2_dynamicBody&&(n&&!this.m_awakeFlag&&this.SetAwake(!0),this.m_awakeFlag&&(this.m_force.x+=e.x,this.m_force.y+=e.y,this.m_torque+=(i.x-this.m_sweep.c.x)*e.y-(i.y-this.m_sweep.c.y)*e.x))},n.ApplyForceToCenter=function(e,i){void 0===i&&(i=!0),this.m_type===t.b2BodyType.b2_dynamicBody&&(i&&!this.m_awakeFlag&&this.SetAwake(!0),this.m_awakeFlag&&(this.m_force.x+=e.x,this.m_force.y+=e.y))},n.ApplyTorque=function(e,i){void 0===i&&(i=!0),this.m_type===t.b2BodyType.b2_dynamicBody&&(i&&!this.m_awakeFlag&&this.SetAwake(!0),this.m_awakeFlag&&(this.m_torque+=e))},n.ApplyLinearImpulse=function(e,i,n){void 0===n&&(n=!0),this.m_type===t.b2BodyType.b2_dynamicBody&&(n&&!this.m_awakeFlag&&this.SetAwake(!0),this.m_awakeFlag&&(this.m_linearVelocity.x+=this.m_invMass*e.x,this.m_linearVelocity.y+=this.m_invMass*e.y,this.m_angularVelocity+=this.m_invI*((i.x-this.m_sweep.c.x)*e.y-(i.y-this.m_sweep.c.y)*e.x)))},n.ApplyLinearImpulseToCenter=function(e,i){void 0===i&&(i=!0),this.m_type===t.b2BodyType.b2_dynamicBody&&(i&&!this.m_awakeFlag&&this.SetAwake(!0),this.m_awakeFlag&&(this.m_linearVelocity.x+=this.m_invMass*e.x,this.m_linearVelocity.y+=this.m_invMass*e.y))},n.ApplyAngularImpulse=function(e,i){void 0===i&&(i=!0),this.m_type===t.b2BodyType.b2_dynamicBody&&(i&&!this.m_awakeFlag&&this.SetAwake(!0),this.m_awakeFlag&&(this.m_angularVelocity+=this.m_invI*e))},n.GetMass=function(){return this.m_mass},n.GetInertia=function(){return this.m_I+this.m_mass*bt.DotVV(this.m_sweep.localCenter,this.m_sweep.localCenter)},n.GetMassData=function(t){return t.mass=this.m_mass,t.I=this.m_I+this.m_mass*bt.DotVV(this.m_sweep.localCenter,this.m_sweep.localCenter),t.center.Copy(this.m_sweep.localCenter),t},n.SetMassData=function(i){if(this.m_world.IsLocked())throw new Error;if(this.m_type===t.b2BodyType.b2_dynamicBody){this.m_invMass=0,this.m_I=0,this.m_invI=0,this.m_mass=i.mass,this.m_mass<=0&&(this.m_mass=1),this.m_invMass=1/this.m_mass,i.I>0&&!this.m_fixedRotationFlag&&(this.m_I=i.I-this.m_mass*bt.DotVV(i.center,i.center),this.m_invI=1/this.m_I);var n=e.SetMassData_s_oldCenter.Copy(this.m_sweep.c);this.m_sweep.localCenter.Copy(i.center),Bt.MulXV(this.m_xf,this.m_sweep.localCenter,this.m_sweep.c),this.m_sweep.c0.Copy(this.m_sweep.c),bt.AddVCrossSV(this.m_linearVelocity,this.m_angularVelocity,bt.SubVV(this.m_sweep.c,n,bt.s_t0),this.m_linearVelocity)}},n.ResetMassData=function(){if(this.m_mass=0,this.m_invMass=0,this.m_I=0,this.m_invI=0,this.m_sweep.localCenter.SetZero(),this.m_type===t.b2BodyType.b2_staticBody||this.m_type===t.b2BodyType.b2_kinematicBody)return this.m_sweep.c0.Copy(this.m_xf.p),this.m_sweep.c.Copy(this.m_xf.p),void(this.m_sweep.a0=this.m_sweep.a);for(var i=e.ResetMassData_s_localCenter.SetZero(),n=this.m_fixtureList;n;n=n.m_next)if(0!==n.m_density){var r=n.GetMassData(e.ResetMassData_s_massData);this.m_mass+=r.mass,i.x+=r.center.x*r.mass,i.y+=r.center.y*r.mass,this.m_I+=r.I}this.m_mass>0?(this.m_invMass=1/this.m_mass,i.x*=this.m_invMass,i.y*=this.m_invMass):(this.m_mass=1,this.m_invMass=1),this.m_I>0&&!this.m_fixedRotationFlag?(this.m_I-=this.m_mass*bt.DotVV(i,i),this.m_invI=1/this.m_I):(this.m_I=0,this.m_invI=0);var s=e.ResetMassData_s_oldCenter.Copy(this.m_sweep.c);this.m_sweep.localCenter.Copy(i),Bt.MulXV(this.m_xf,this.m_sweep.localCenter,this.m_sweep.c),this.m_sweep.c0.Copy(this.m_sweep.c),bt.AddVCrossSV(this.m_linearVelocity,this.m_angularVelocity,bt.SubVV(this.m_sweep.c,s,bt.s_t0),this.m_linearVelocity)},n.GetWorldPoint=function(t,e){return Bt.MulXV(this.m_xf,t,e)},n.GetWorldVector=function(t,e){return It.MulRV(this.m_xf.q,t,e)},n.GetLocalPoint=function(t,e){return Bt.MulTXV(this.m_xf,t,e)},n.GetLocalVector=function(t,e){return It.MulTRV(this.m_xf.q,t,e)},n.GetLinearVelocityFromWorldPoint=function(t,e){return bt.AddVCrossSV(this.m_linearVelocity,this.m_angularVelocity,bt.SubVV(t,this.m_sweep.c,bt.s_t0),e)},n.GetLinearVelocityFromLocalPoint=function(t,e){return this.GetLinearVelocityFromWorldPoint(this.GetWorldPoint(t,e),e)},n.GetLinearDamping=function(){return this.m_linearDamping},n.SetLinearDamping=function(t){this.m_linearDamping=t},n.GetAngularDamping=function(){return this.m_angularDamping},n.SetAngularDamping=function(t){this.m_angularDamping=t},n.GetGravityScale=function(){return this.m_gravityScale},n.SetGravityScale=function(t){this.m_gravityScale=t},n.SetType=function(e){if(this.m_world.IsLocked())throw new Error;if(this.m_type!==e){this.m_type=e,this.ResetMassData(),this.m_type===t.b2BodyType.b2_staticBody&&(this.m_linearVelocity.SetZero(),this.m_angularVelocity=0,this.m_sweep.a0=this.m_sweep.a,this.m_sweep.c0.Copy(this.m_sweep.c),this.SynchronizeFixtures()),this.SetAwake(!0),this.m_force.SetZero(),this.m_torque=0;for(var i=this.m_contactList;i;){var n=i;i=i.next,this.m_world.m_contactManager.Destroy(n.contact)}this.m_contactList=null;for(var r=this.m_fixtureList;r;r=r.m_next)r.TouchProxies()}},n.GetType=function(){return this.m_type},n.SetBullet=function(t){this.m_bulletFlag=t},n.IsBullet=function(){return this.m_bulletFlag},n.SetSleepingAllowed=function(t){this.m_autoSleepFlag=t,t||this.SetAwake(!0)},n.IsSleepingAllowed=function(){return this.m_autoSleepFlag},n.SetAwake=function(t){t?(this.m_awakeFlag=!0,this.m_sleepTime=0):(this.m_awakeFlag=!1,this.m_sleepTime=0,this.m_linearVelocity.SetZero(),this.m_angularVelocity=0,this.m_force.SetZero(),this.m_torque=0)},n.IsAwake=function(){return this.m_awakeFlag},n.SetActive=function(t){if(this.m_world.IsLocked())throw new Error;if(t!==this.IsActive())if(this.m_activeFlag=t,t)for(var e=this.m_fixtureList;e;e=e.m_next)e.CreateProxies();else{for(var i=this.m_fixtureList;i;i=i.m_next)i.DestroyProxies();for(var n=this.m_contactList;n;){var r=n;n=n.next,this.m_world.m_contactManager.Destroy(r.contact)}this.m_contactList=null}},n.IsActive=function(){return this.m_activeFlag},n.SetFixedRotation=function(t){this.m_fixedRotationFlag!==t&&(this.m_fixedRotationFlag=t,this.m_angularVelocity=0,this.ResetMassData())},n.IsFixedRotation=function(){return this.m_fixedRotationFlag},n.GetFixtureList=function(){return this.m_fixtureList},n.GetJointList=function(){return this.m_jointList},n.GetContactList=function(){return this.m_contactList},n.GetNext=function(){return this.m_next},n.GetUserData=function(){return this.m_userData},n.SetUserData=function(t){this.m_userData=t},n.GetWorld=function(){return this.m_world},n.Dump=function(e){var i=this.m_islandIndex;e("{\n"),e(" const bd: b2BodyDef = new b2BodyDef();\n");var n="";switch(this.m_type){case t.b2BodyType.b2_staticBody:n="b2BodyType.b2_staticBody";break;case t.b2BodyType.b2_kinematicBody:n="b2BodyType.b2_kinematicBody";break;case t.b2BodyType.b2_dynamicBody:n="b2BodyType.b2_dynamicBody"}e(" bd.type = %s;\n",n),e(" bd.position.Set(%.15f, %.15f);\n",this.m_xf.p.x,this.m_xf.p.y),e(" bd.angle = %.15f;\n",this.m_sweep.a),e(" bd.linearVelocity.Set(%.15f, %.15f);\n",this.m_linearVelocity.x,this.m_linearVelocity.y),e(" bd.angularVelocity = %.15f;\n",this.m_angularVelocity),e(" bd.linearDamping = %.15f;\n",this.m_linearDamping),e(" bd.angularDamping = %.15f;\n",this.m_angularDamping),e(" bd.allowSleep = %s;\n",this.m_autoSleepFlag?"true":"false"),e(" bd.awake = %s;\n",this.m_awakeFlag?"true":"false"),e(" bd.fixedRotation = %s;\n",this.m_fixedRotationFlag?"true":"false"),e(" bd.bullet = %s;\n",this.m_bulletFlag?"true":"false"),e(" bd.active = %s;\n",this.m_activeFlag?"true":"false"),e(" bd.gravityScale = %.15f;\n",this.m_gravityScale),e("\n"),e(" bodies[%d] = this.m_world.CreateBody(bd);\n",this.m_islandIndex),e("\n");for(var r=this.m_fixtureList;r;r=r.m_next)e(" {\n"),r.Dump(e,i),e(" }\n");e("}\n")},n.SynchronizeFixtures=function(){var t=e.SynchronizeFixtures_s_xf1;t.q.SetAngle(this.m_sweep.a0),It.MulRV(t.q,this.m_sweep.localCenter,t.p),bt.SubVV(this.m_sweep.c0,t.p,t.p);for(var i=bt.SubVV(this.m_sweep.c,this.m_sweep.c0,e.SynchronizeFixtures_s_displacement),n=this.m_fixtureList;n;n=n.m_next)n.SynchronizeProxies(t,this.m_xf,i)},n.SynchronizeTransform=function(){this.m_xf.q.SetAngle(this.m_sweep.a),It.MulRV(this.m_xf.q,this.m_sweep.localCenter,this.m_xf.p),bt.SubVV(this.m_sweep.c,this.m_xf.p,this.m_xf.p)},n.ShouldCollide=function(e){return(this.m_type!==t.b2BodyType.b2_staticBody||e.m_type!==t.b2BodyType.b2_staticBody)&&this.ShouldCollideConnected(e)},n.ShouldCollideConnected=function(t){for(var e=this.m_jointList;e;e=e.next)if(e.other===t&&!e.joint.m_collideConnected)return!1;return!0},n.Advance=function(t){this.m_sweep.Advance(t),this.m_sweep.c.Copy(this.m_sweep.c0),this.m_sweep.a=this.m_sweep.a0,this.m_xf.q.SetAngle(this.m_sweep.a),It.MulRV(this.m_xf.q,this.m_sweep.localCenter,this.m_xf.p),bt.SubVV(this.m_sweep.c,this.m_xf.p,this.m_xf.p)},n.GetControllerList=function(){return this.m_controllerList},n.GetControllerCount=function(){return this.m_controllerCount},e}();Sn.CreateFixtureShapeDensity_s_def=new fn,Sn.SetMassData_s_oldCenter=new bt,Sn.ResetMassData_s_localCenter=new bt,Sn.ResetMassData_s_oldCenter=new bt,Sn.ResetMassData_s_massData=new an,Sn.SynchronizeFixtures_s_xf1=new Bt,Sn.SynchronizeFixtures_s_displacement=new bt,(yn=t.b2JointType||(t.b2JointType={}))[yn.e_unknownJoint=0]="e_unknownJoint",yn[yn.e_revoluteJoint=1]="e_revoluteJoint",yn[yn.e_prismaticJoint=2]="e_prismaticJoint",yn[yn.e_distanceJoint=3]="e_distanceJoint",yn[yn.e_pulleyJoint=4]="e_pulleyJoint",yn[yn.e_mouseJoint=5]="e_mouseJoint",yn[yn.e_gearJoint=6]="e_gearJoint",yn[yn.e_wheelJoint=7]="e_wheelJoint",yn[yn.e_weldJoint=8]="e_weldJoint",yn[yn.e_frictionJoint=9]="e_frictionJoint",yn[yn.e_ropeJoint=10]="e_ropeJoint",yn[yn.e_motorJoint=11]="e_motorJoint",yn[yn.e_areaJoint=12]="e_areaJoint",(gn=t.b2LimitState||(t.b2LimitState={}))[gn.e_inactiveLimit=0]="e_inactiveLimit",gn[gn.e_atLowerLimit=1]="e_atLowerLimit",gn[gn.e_atUpperLimit=2]="e_atUpperLimit",gn[gn.e_equalLimits=3]="e_equalLimits";var An=function(){function t(){this.linear=new bt,this.angularA=0,this.angularB=0}var e=t.prototype;return e.SetZero=function(){return this.linear.SetZero(),this.angularA=0,this.angularB=0,this},e.Set=function(t,e,i){return this.linear.Copy(t),this.angularA=e,this.angularB=i,this},t}(),Tn=function(){function t(t){this._other=null,this.prev=null,this.next=null,this.joint=t}return t.prototype.Reset=function(){this._other=null,this.prev=null,this.next=null},n(t,[{key:"other",get:function(){if(null===this._other)throw new Error;return this._other},set:function(t){if(null!==this._other)throw new Error;this._other=t}}]),t}(),En=function(e){this.type=t.b2JointType.e_unknownJoint,this.userData=null,this.collideConnected=!1,this.type=e},bn=function(){function e(e){this.m_type=t.b2JointType.e_unknownJoint,this.m_prev=null,this.m_next=null,this.m_edgeA=new Tn(this),this.m_edgeB=new Tn(this),this.m_index=0,this.m_islandFlag=!1,this.m_collideConnected=!1,this.m_userData=null,this.m_type=e.type,this.m_edgeA.other=e.bodyB,this.m_edgeB.other=e.bodyA,this.m_bodyA=e.bodyA,this.m_bodyB=e.bodyB,this.m_collideConnected=i(e.collideConnected,!1),this.m_userData=i(e.userData,null)}var n=e.prototype;return n.GetType=function(){return this.m_type},n.GetBodyA=function(){return this.m_bodyA},n.GetBodyB=function(){return this.m_bodyB},n.GetNext=function(){return this.m_next},n.GetUserData=function(){return this.m_userData},n.SetUserData=function(t){this.m_userData=t},n.IsActive=function(){return this.m_bodyA.IsActive()&&this.m_bodyB.IsActive()},n.GetCollideConnected=function(){return this.m_collideConnected},n.Dump=function(t){t("// Dump is not supported for this joint type.\n")},n.ShiftOrigin=function(){},e}(),xn=function(e){function i(){var i;return(i=e.call(this,t.b2JointType.e_distanceJoint)||this).localAnchorA=new bt,i.localAnchorB=new bt,i.length=1,i.frequencyHz=0,i.dampingRatio=0,i}return s(i,e),i.prototype.Initialize=function(t,e,i,n){this.bodyA=t,this.bodyB=e,this.bodyA.GetLocalPoint(i,this.localAnchorA),this.bodyB.GetLocalPoint(n,this.localAnchorB),this.length=bt.DistanceVV(i,n),this.frequencyHz=0,this.dampingRatio=0},i}(En),Cn=function(t){function e(e){var n;return(n=t.call(this,e)||this).m_frequencyHz=0,n.m_dampingRatio=0,n.m_bias=0,n.m_localAnchorA=new bt,n.m_localAnchorB=new bt,n.m_gamma=0,n.m_impulse=0,n.m_length=0,n.m_indexA=0,n.m_indexB=0,n.m_u=new bt,n.m_rA=new bt,n.m_rB=new bt,n.m_localCenterA=new bt,n.m_localCenterB=new bt,n.m_invMassA=0,n.m_invMassB=0,n.m_invIA=0,n.m_invIB=0,n.m_mass=0,n.m_qA=new It,n.m_qB=new It,n.m_lalcA=new bt,n.m_lalcB=new bt,n.m_frequencyHz=i(e.frequencyHz,0),n.m_dampingRatio=i(e.dampingRatio,0),n.m_localAnchorA.Copy(e.localAnchorA),n.m_localAnchorB.Copy(e.localAnchorB),n.m_length=e.length,n}s(e,t);var n=e.prototype;return n.GetAnchorA=function(t){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA,t)},n.GetAnchorB=function(t){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB,t)},n.GetReactionForce=function(t,e){return e.x=t*this.m_impulse*this.m_u.x,e.y=t*this.m_impulse*this.m_u.y,e},n.GetReactionTorque=function(){return 0},n.GetLocalAnchorA=function(){return this.m_localAnchorA},n.GetLocalAnchorB=function(){return this.m_localAnchorB},n.SetLength=function(t){this.m_length=t},n.Length=function(){return this.m_length},n.SetFrequency=function(t){this.m_frequencyHz=t},n.GetFrequency=function(){return this.m_frequencyHz},n.SetDampingRatio=function(t){this.m_dampingRatio=t},n.GetDampingRatio=function(){return this.m_dampingRatio},n.Dump=function(t){var e=this.m_bodyA.m_islandIndex,i=this.m_bodyB.m_islandIndex;t(" const jd: b2DistanceJointDef = new b2DistanceJointDef();\n"),t(" jd.bodyA = bodies[%d];\n",e),t(" jd.bodyB = bodies[%d];\n",i),t(" jd.collideConnected = %s;\n",this.m_collideConnected?"true":"false"),t(" jd.localAnchorA.Set(%.15f, %.15f);\n",this.m_localAnchorA.x,this.m_localAnchorA.y),t(" jd.localAnchorB.Set(%.15f, %.15f);\n",this.m_localAnchorB.x,this.m_localAnchorB.y),t(" jd.length = %.15f;\n",this.m_length),t(" jd.frequencyHz = %.15f;\n",this.m_frequencyHz),t(" jd.dampingRatio = %.15f;\n",this.m_dampingRatio),t(" joints[%d] = this.m_world.CreateJoint(jd);\n",this.m_index)},n.InitVelocityConstraints=function(t){this.m_indexA=this.m_bodyA.m_islandIndex,this.m_indexB=this.m_bodyB.m_islandIndex,this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter),this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter),this.m_invMassA=this.m_bodyA.m_invMass,this.m_invMassB=this.m_bodyB.m_invMass,this.m_invIA=this.m_bodyA.m_invI,this.m_invIB=this.m_bodyB.m_invI;var i=t.positions[this.m_indexA].c,n=t.positions[this.m_indexA].a,r=t.velocities[this.m_indexA].v,s=t.velocities[this.m_indexA].w,a=t.positions[this.m_indexB].c,o=t.positions[this.m_indexB].a,u=t.velocities[this.m_indexB].v,l=t.velocities[this.m_indexB].w,c=this.m_qA.SetAngle(n),_=this.m_qB.SetAngle(o);bt.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA),It.MulRV(c,this.m_lalcA,this.m_rA),bt.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB),It.MulRV(_,this.m_lalcB,this.m_rB),this.m_u.x=a.x+this.m_rB.x-i.x-this.m_rA.x,this.m_u.y=a.y+this.m_rB.y-i.y-this.m_rA.y;var f=this.m_u.Length();f>p?this.m_u.SelfMul(1/f):this.m_u.SetZero();var d=bt.CrossVV(this.m_rA,this.m_u),m=bt.CrossVV(this.m_rB,this.m_u),g=this.m_invMassA+this.m_invIA*d*d+this.m_invMassB+this.m_invIB*m*m;if(this.m_mass=0!==g?1/g:0,this.m_frequencyHz>0){var y=f-this.m_length,v=2*h*this.m_frequencyHz,S=2*this.m_mass*this.m_dampingRatio*v,A=this.m_mass*v*v,T=t.step.dt;this.m_gamma=T*(S+T*A),this.m_gamma=0!==this.m_gamma?1/this.m_gamma:0,this.m_bias=y*T*A*this.m_gamma,g+=this.m_gamma,this.m_mass=0!==g?1/g:0}else this.m_gamma=0,this.m_bias=0;if(t.step.warmStarting){this.m_impulse*=t.step.dtRatio;var E=bt.MulSV(this.m_impulse,this.m_u,e.InitVelocityConstraints_s_P);r.SelfMulSub(this.m_invMassA,E),s-=this.m_invIA*bt.CrossVV(this.m_rA,E),u.SelfMulAdd(this.m_invMassB,E),l+=this.m_invIB*bt.CrossVV(this.m_rB,E)}else this.m_impulse=0;t.velocities[this.m_indexA].w=s,t.velocities[this.m_indexB].w=l},n.SolveVelocityConstraints=function(t){var i=t.velocities[this.m_indexA].v,n=t.velocities[this.m_indexA].w,r=t.velocities[this.m_indexB].v,s=t.velocities[this.m_indexB].w,a=bt.AddVCrossSV(i,n,this.m_rA,e.SolveVelocityConstraints_s_vpA),o=bt.AddVCrossSV(r,s,this.m_rB,e.SolveVelocityConstraints_s_vpB),h=bt.DotVV(this.m_u,bt.SubVV(o,a,bt.s_t0)),u=-this.m_mass*(h+this.m_bias+this.m_gamma*this.m_impulse);this.m_impulse+=u;var l=bt.MulSV(u,this.m_u,e.SolveVelocityConstraints_s_P);i.SelfMulSub(this.m_invMassA,l),n-=this.m_invIA*bt.CrossVV(this.m_rA,l),r.SelfMulAdd(this.m_invMassB,l),s+=this.m_invIB*bt.CrossVV(this.m_rB,l),t.velocities[this.m_indexA].w=n,t.velocities[this.m_indexB].w=s},n.SolvePositionConstraints=function(t){if(this.m_frequencyHz>0)return!0;var i=t.positions[this.m_indexA].c,n=t.positions[this.m_indexA].a,r=t.positions[this.m_indexB].c,s=t.positions[this.m_indexB].a,a=this.m_qA.SetAngle(n),o=this.m_qB.SetAngle(s),h=It.MulRV(a,this.m_lalcA,this.m_rA),u=It.MulRV(o,this.m_lalcB,this.m_rB),l=this.m_u;l.x=r.x+u.x-i.x-h.x,l.y=r.y+u.y-i.y-h.y;var c=this.m_u.Normalize()-this.m_length;c=at(c,-A,A);var _=-this.m_mass*c,f=bt.MulSV(_,l,e.SolvePositionConstraints_s_P);return i.SelfMulSub(this.m_invMassA,f),n-=this.m_invIA*bt.CrossVV(h,f),r.SelfMulAdd(this.m_invMassB,f),s+=this.m_invIB*bt.CrossVV(u,f),t.positions[this.m_indexA].a=n,t.positions[this.m_indexB].a=s,nt(c)<p},e}(bn);Cn.InitVelocityConstraints_s_P=new bt,Cn.SolveVelocityConstraints_s_vpA=new bt,Cn.SolveVelocityConstraints_s_vpB=new bt,Cn.SolveVelocityConstraints_s_P=new bt,Cn.SolvePositionConstraints_s_P=new bt;var Rn=function(e){function i(){var i;return(i=e.call(this,t.b2JointType.e_areaJoint)||this).bodies=[],i.frequencyHz=0,i.dampingRatio=0,i}return s(i,e),i.prototype.AddBody=function(t){this.bodies.push(t),1===this.bodies.length?this.bodyA=t:2===this.bodies.length&&(this.bodyB=t)},i}(En),wn=function(t){function e(e){var n;(n=t.call(this,e)||this).m_frequencyHz=0,n.m_dampingRatio=0,n.m_impulse=0,n.m_targetArea=0,n.m_delta=new bt,n.m_bodies=e.bodies,n.m_frequencyHz=i(e.frequencyHz,0),n.m_dampingRatio=i(e.dampingRatio,0),n.m_targetLengths=$(e.bodies.length),n.m_normals=bt.MakeArray(e.bodies.length),n.m_joints=[],n.m_deltas=bt.MakeArray(e.bodies.length);var r=new xn;r.frequencyHz=n.m_frequencyHz,r.dampingRatio=n.m_dampingRatio,n.m_targetArea=0;for(var s=0;s<n.m_bodies.length;++s){var a=n.m_bodies[s],o=n.m_bodies[(s+1)%n.m_bodies.length],h=a.GetWorldCenter(),u=o.GetWorldCenter();n.m_targetLengths[s]=bt.DistanceVV(h,u),n.m_targetArea+=bt.CrossVV(h,u),r.Initialize(a,o,h,u),n.m_joints[s]=a.GetWorld().CreateJoint(r)}return n.m_targetArea*=.5,n}s(e,t);var n=e.prototype;return n.GetAnchorA=function(t){return t},n.GetAnchorB=function(t){return t},n.GetReactionForce=function(t,e){return e},n.GetReactionTorque=function(){return 0},n.SetFrequency=function(t){this.m_frequencyHz=t;for(var e=0;e<this.m_joints.length;++e)this.m_joints[e].SetFrequency(t)},n.GetFrequency=function(){return this.m_frequencyHz},n.SetDampingRatio=function(t){this.m_dampingRatio=t;for(var e=0;e<this.m_joints.length;++e)this.m_joints[e].SetDampingRatio(t)},n.GetDampingRatio=function(){return this.m_dampingRatio},n.Dump=function(t){t("Area joint dumping is not supported.\n")},n.InitVelocityConstraints=function(t){for(var e=0;e<this.m_bodies.length;++e){var i=this.m_bodies[(e+this.m_bodies.length-1)%this.m_bodies.length],n=this.m_bodies[(e+1)%this.m_bodies.length],r=t.positions[i.m_islandIndex].c,s=t.positions[n.m_islandIndex].c,a=this.m_deltas[e];bt.SubVV(s,r,a)}if(t.step.warmStarting){this.m_impulse*=t.step.dtRatio;for(var o=0;o<this.m_bodies.length;++o){var h=this.m_bodies[o],u=t.velocities[h.m_islandIndex].v,l=this.m_deltas[o];u.x+=h.m_invMass*l.y*.5*this.m_impulse,u.y+=h.m_invMass*-l.x*.5*this.m_impulse}}else this.m_impulse=0},n.SolveVelocityConstraints=function(t){for(var e=0,i=0,n=0;n<this.m_bodies.length;++n){var r=this.m_bodies[n],s=t.velocities[r.m_islandIndex].v,a=this.m_deltas[n];e+=a.LengthSquared()/r.GetMass(),i+=bt.CrossVV(s,a)}var o=-2*i/e;this.m_impulse+=o;for(var h=0;h<this.m_bodies.length;++h){var u=this.m_bodies[h],l=t.velocities[u.m_islandIndex].v,c=this.m_deltas[h];l.x+=u.m_invMass*c.y*.5*o,l.y+=u.m_invMass*-c.x*.5*o}},n.SolvePositionConstraints=function(t){for(var e=0,i=0,n=0;n<this.m_bodies.length;++n){var r=this.m_bodies[n],s=this.m_bodies[(n+1)%this.m_bodies.length],o=t.positions[r.m_islandIndex].c,h=t.positions[s.m_islandIndex].c,u=bt.SubVV(h,o,this.m_delta),l=u.Length();l<a&&(l=1),this.m_normals[n].x=u.y/l,this.m_normals[n].y=-u.x/l,e+=l,i+=bt.CrossVV(o,h)}i*=.5;for(var c=.5*(this.m_targetArea-i)/e,_=!0,f=0;f<this.m_bodies.length;++f){var d=this.m_bodies[f],m=t.positions[d.m_islandIndex].c,g=(f+1)%this.m_bodies.length,y=bt.AddVV(this.m_normals[f],this.m_normals[g],this.m_delta);y.SelfMul(c);var v=y.LengthSquared();v>ut(A)&&y.SelfMul(A/ct(v)),v>ut(p)&&(_=!1),m.x+=y.x,m.y+=y.y}return _},e}(bn),In=function(e){function i(){var i;return(i=e.call(this,t.b2JointType.e_frictionJoint)||this).localAnchorA=new bt,i.localAnchorB=new bt,i.maxForce=0,i.maxTorque=0,i}return s(i,e),i.prototype.Initialize=function(t,e,i){this.bodyA=t,this.bodyB=e,this.bodyA.GetLocalPoint(i,this.localAnchorA),this.bodyB.GetLocalPoint(i,this.localAnchorB)},i}(En),Bn=function(t){function e(e){var n;return(n=t.call(this,e)||this).m_localAnchorA=new bt,n.m_localAnchorB=new bt,n.m_linearImpulse=new bt,n.m_angularImpulse=0,n.m_maxForce=0,n.m_maxTorque=0,n.m_indexA=0,n.m_indexB=0,n.m_rA=new bt,n.m_rB=new bt,n.m_localCenterA=new bt,n.m_localCenterB=new bt,n.m_invMassA=0,n.m_invMassB=0,n.m_invIA=0,n.m_invIB=0,n.m_linearMass=new Rt,n.m_angularMass=0,n.m_qA=new It,n.m_qB=new It,n.m_lalcA=new bt,n.m_lalcB=new bt,n.m_K=new Rt,n.m_localAnchorA.Copy(e.localAnchorA),n.m_localAnchorB.Copy(e.localAnchorB),n.m_linearImpulse.SetZero(),n.m_maxForce=i(e.maxForce,0),n.m_maxTorque=i(e.maxTorque,0),n.m_linearMass.SetZero(),n}s(e,t);var n=e.prototype;return n.InitVelocityConstraints=function(t){this.m_indexA=this.m_bodyA.m_islandIndex,this.m_indexB=this.m_bodyB.m_islandIndex,this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter),this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter),this.m_invMassA=this.m_bodyA.m_invMass,this.m_invMassB=this.m_bodyB.m_invMass,this.m_invIA=this.m_bodyA.m_invI,this.m_invIB=this.m_bodyB.m_invI;var e=t.positions[this.m_indexA].a,i=t.velocities[this.m_indexA].v,n=t.velocities[this.m_indexA].w,r=t.positions[this.m_indexB].a,s=t.velocities[this.m_indexB].v,a=t.velocities[this.m_indexB].w,o=this.m_qA.SetAngle(e),h=this.m_qB.SetAngle(r);bt.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var u=It.MulRV(o,this.m_lalcA,this.m_rA);bt.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var l=It.MulRV(h,this.m_lalcB,this.m_rB),c=this.m_invMassA,_=this.m_invMassB,f=this.m_invIA,d=this.m_invIB,p=this.m_K;if(p.ex.x=c+_+f*u.y*u.y+d*l.y*l.y,p.ex.y=-f*u.x*u.y-d*l.x*l.y,p.ey.x=p.ex.y,p.ey.y=c+_+f*u.x*u.x+d*l.x*l.x,p.GetInverse(this.m_linearMass),this.m_angularMass=f+d,this.m_angularMass>0&&(this.m_angularMass=1/this.m_angularMass),t.step.warmStarting){this.m_linearImpulse.SelfMul(t.step.dtRatio),this.m_angularImpulse*=t.step.dtRatio;var m=this.m_linearImpulse;i.SelfMulSub(c,m),n-=f*(bt.CrossVV(this.m_rA,m)+this.m_angularImpulse),s.SelfMulAdd(_,m),a+=d*(bt.CrossVV(this.m_rB,m)+this.m_angularImpulse)}else this.m_linearImpulse.SetZero(),this.m_angularImpulse=0;t.velocities[this.m_indexA].w=n,t.velocities[this.m_indexB].w=a},n.SolveVelocityConstraints=function(t){var i=t.velocities[this.m_indexA].v,n=t.velocities[this.m_indexA].w,r=t.velocities[this.m_indexB].v,s=t.velocities[this.m_indexB].w,a=this.m_invMassA,o=this.m_invMassB,h=this.m_invIA,u=this.m_invIB,l=t.step.dt,c=s-n,_=-this.m_angularMass*c,f=this.m_angularImpulse,d=l*this.m_maxTorque;this.m_angularImpulse=at(this.m_angularImpulse+_,-d,d),n-=h*(_=this.m_angularImpulse-f),s+=u*_;var p=bt.SubVV(bt.AddVCrossSV(r,s,this.m_rB,bt.s_t0),bt.AddVCrossSV(i,n,this.m_rA,bt.s_t1),e.SolveVelocityConstraints_s_Cdot_v2),m=Rt.MulMV(this.m_linearMass,p,e.SolveVelocityConstraints_s_impulseV).SelfNeg(),g=e.SolveVelocityConstraints_s_oldImpulseV.Copy(this.m_linearImpulse);this.m_linearImpulse.SelfAdd(m);var y=l*this.m_maxForce;this.m_linearImpulse.LengthSquared()>y*y&&(this.m_linearImpulse.Normalize(),this.m_linearImpulse.SelfMul(y)),bt.SubVV(this.m_linearImpulse,g,m),i.SelfMulSub(a,m),n-=h*bt.CrossVV(this.m_rA,m),r.SelfMulAdd(o,m),s+=u*bt.CrossVV(this.m_rB,m),t.velocities[this.m_indexA].w=n,t.velocities[this.m_indexB].w=s},n.SolvePositionConstraints=function(){return!0},n.GetAnchorA=function(t){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA,t)},n.GetAnchorB=function(t){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB,t)},n.GetReactionForce=function(t,e){return e.x=t*this.m_linearImpulse.x,e.y=t*this.m_linearImpulse.y,e},n.GetReactionTorque=function(t){return t*this.m_angularImpulse},n.GetLocalAnchorA=function(){return this.m_localAnchorA},n.GetLocalAnchorB=function(){return this.m_localAnchorB},n.SetMaxForce=function(t){this.m_maxForce=t},n.GetMaxForce=function(){return this.m_maxForce},n.SetMaxTorque=function(t){this.m_maxTorque=t},n.GetMaxTorque=function(){return this.m_maxTorque},n.Dump=function(t){var e=this.m_bodyA.m_islandIndex,i=this.m_bodyB.m_islandIndex;t(" const jd: b2FrictionJointDef = new b2FrictionJointDef();\n"),t(" jd.bodyA = bodies[%d];\n",e),t(" jd.bodyB = bodies[%d];\n",i),t(" jd.collideConnected = %s;\n",this.m_collideConnected?"true":"false"),t(" jd.localAnchorA.Set(%.15f, %.15f);\n",this.m_localAnchorA.x,this.m_localAnchorA.y),t(" jd.localAnchorB.Set(%.15f, %.15f);\n",this.m_localAnchorB.x,this.m_localAnchorB.y),t(" jd.maxForce = %.15f;\n",this.m_maxForce),t(" jd.maxTorque = %.15f;\n",this.m_maxTorque),t(" joints[%d] = this.m_world.CreateJoint(jd);\n",this.m_index)},e}(bn);Bn.SolveVelocityConstraints_s_Cdot_v2=new bt,Bn.SolveVelocityConstraints_s_impulseV=new bt,Bn.SolveVelocityConstraints_s_oldImpulseV=new bt;var Dn=function(e){function i(){var i;return(i=e.call(this,t.b2JointType.e_gearJoint)||this).ratio=1,i}return s(i,e),i}(En),Pn=function(e){function n(n){var r,s,a;(r=e.call(this,n)||this).m_typeA=t.b2JointType.e_unknownJoint,r.m_typeB=t.b2JointType.e_unknownJoint,r.m_localAnchorA=new bt,r.m_localAnchorB=new bt,r.m_localAnchorC=new bt,r.m_localAnchorD=new bt,r.m_localAxisC=new bt,r.m_localAxisD=new bt,r.m_referenceAngleA=0,r.m_referenceAngleB=0,r.m_constant=0,r.m_ratio=0,r.m_impulse=0,r.m_indexA=0,r.m_indexB=0,r.m_indexC=0,r.m_indexD=0,r.m_lcA=new bt,r.m_lcB=new bt,r.m_lcC=new bt,r.m_lcD=new bt,r.m_mA=0,r.m_mB=0,r.m_mC=0,r.m_mD=0,r.m_iA=0,r.m_iB=0,r.m_iC=0,r.m_iD=0,r.m_JvAC=new bt,r.m_JvBD=new bt,r.m_JwA=0,r.m_JwB=0,r.m_JwC=0,r.m_JwD=0,r.m_mass=0,r.m_qA=new It,r.m_qB=new It,r.m_qC=new It,r.m_qD=new It,r.m_lalcA=new bt,r.m_lalcB=new bt,r.m_lalcC=new bt,r.m_lalcD=new bt,r.m_joint1=n.joint1,r.m_joint2=n.joint2,r.m_typeA=r.m_joint1.GetType(),r.m_typeB=r.m_joint2.GetType(),r.m_bodyC=r.m_joint1.GetBodyA(),r.m_bodyA=r.m_joint1.GetBodyB();var o=r.m_bodyA.m_xf,h=r.m_bodyA.m_sweep.a,u=r.m_bodyC.m_xf,l=r.m_bodyC.m_sweep.a;if(r.m_typeA===t.b2JointType.e_revoluteJoint){var c=n.joint1;r.m_localAnchorC.Copy(c.m_localAnchorA),r.m_localAnchorA.Copy(c.m_localAnchorB),r.m_referenceAngleA=c.m_referenceAngle,r.m_localAxisC.SetZero(),s=h-l-r.m_referenceAngleA}else{var _=n.joint1;r.m_localAnchorC.Copy(_.m_localAnchorA),r.m_localAnchorA.Copy(_.m_localAnchorB),r.m_referenceAngleA=_.m_referenceAngle,r.m_localAxisC.Copy(_.m_localXAxisA);var f=r.m_localAnchorC,d=It.MulTRV(u.q,bt.AddVV(It.MulRV(o.q,r.m_localAnchorA,bt.s_t0),bt.SubVV(o.p,u.p,bt.s_t1),bt.s_t0),bt.s_t0);s=bt.DotVV(bt.SubVV(d,f,bt.s_t0),r.m_localAxisC)}r.m_bodyD=r.m_joint2.GetBodyA(),r.m_bodyB=r.m_joint2.GetBodyB();var p=r.m_bodyB.m_xf,m=r.m_bodyB.m_sweep.a,g=r.m_bodyD.m_xf,y=r.m_bodyD.m_sweep.a;if(r.m_typeB===t.b2JointType.e_revoluteJoint){var v=n.joint2;r.m_localAnchorD.Copy(v.m_localAnchorA),r.m_localAnchorB.Copy(v.m_localAnchorB),r.m_referenceAngleB=v.m_referenceAngle,r.m_localAxisD.SetZero(),a=m-y-r.m_referenceAngleB}else{var S=n.joint2;r.m_localAnchorD.Copy(S.m_localAnchorA),r.m_localAnchorB.Copy(S.m_localAnchorB),r.m_referenceAngleB=S.m_referenceAngle,r.m_localAxisD.Copy(S.m_localXAxisA);var A=r.m_localAnchorD,T=It.MulTRV(g.q,bt.AddVV(It.MulRV(p.q,r.m_localAnchorB,bt.s_t0),bt.SubVV(p.p,g.p,bt.s_t1),bt.s_t0),bt.s_t0);a=bt.DotVV(bt.SubVV(T,A,bt.s_t0),r.m_localAxisD)}return r.m_ratio=i(n.ratio,1),r.m_constant=s+r.m_ratio*a,r.m_impulse=0,r}s(n,e);var r=n.prototype;return r.InitVelocityConstraints=function(e){this.m_indexA=this.m_bodyA.m_islandIndex,this.m_indexB=this.m_bodyB.m_islandIndex,this.m_indexC=this.m_bodyC.m_islandIndex,this.m_indexD=this.m_bodyD.m_islandIndex,this.m_lcA.Copy(this.m_bodyA.m_sweep.localCenter),this.m_lcB.Copy(this.m_bodyB.m_sweep.localCenter),this.m_lcC.Copy(this.m_bodyC.m_sweep.localCenter),this.m_lcD.Copy(this.m_bodyD.m_sweep.localCenter),this.m_mA=this.m_bodyA.m_invMass,this.m_mB=this.m_bodyB.m_invMass,this.m_mC=this.m_bodyC.m_invMass,this.m_mD=this.m_bodyD.m_invMass,this.m_iA=this.m_bodyA.m_invI,this.m_iB=this.m_bodyB.m_invI,this.m_iC=this.m_bodyC.m_invI,this.m_iD=this.m_bodyD.m_invI;var i=e.positions[this.m_indexA].a,r=e.velocities[this.m_indexA].v,s=e.velocities[this.m_indexA].w,a=e.positions[this.m_indexB].a,o=e.velocities[this.m_indexB].v,h=e.velocities[this.m_indexB].w,u=e.positions[this.m_indexC].a,l=e.velocities[this.m_indexC].v,c=e.velocities[this.m_indexC].w,_=e.positions[this.m_indexD].a,f=e.velocities[this.m_indexD].v,d=e.velocities[this.m_indexD].w,p=this.m_qA.SetAngle(i),m=this.m_qB.SetAngle(a),g=this.m_qC.SetAngle(u),y=this.m_qD.SetAngle(_);if(this.m_mass=0,this.m_typeA===t.b2JointType.e_revoluteJoint)this.m_JvAC.SetZero(),this.m_JwA=1,this.m_JwC=1,this.m_mass+=this.m_iA+this.m_iC;else{var v=It.MulRV(g,this.m_localAxisC,n.InitVelocityConstraints_s_u);bt.SubVV(this.m_localAnchorC,this.m_lcC,this.m_lalcC);var S=It.MulRV(g,this.m_lalcC,n.InitVelocityConstraints_s_rC);bt.SubVV(this.m_localAnchorA,this.m_lcA,this.m_lalcA);var A=It.MulRV(p,this.m_lalcA,n.InitVelocityConstraints_s_rA);this.m_JvAC.Copy(v),this.m_JwC=bt.CrossVV(S,v),this.m_JwA=bt.CrossVV(A,v),this.m_mass+=this.m_mC+this.m_mA+this.m_iC*this.m_JwC*this.m_JwC+this.m_iA*this.m_JwA*this.m_JwA}if(this.m_typeB===t.b2JointType.e_revoluteJoint)this.m_JvBD.SetZero(),this.m_JwB=this.m_ratio,this.m_JwD=this.m_ratio,this.m_mass+=this.m_ratio*this.m_ratio*(this.m_iB+this.m_iD);else{var T=It.MulRV(y,this.m_localAxisD,n.InitVelocityConstraints_s_u);bt.SubVV(this.m_localAnchorD,this.m_lcD,this.m_lalcD);var E=It.MulRV(y,this.m_lalcD,n.InitVelocityConstraints_s_rD);bt.SubVV(this.m_localAnchorB,this.m_lcB,this.m_lalcB);var b=It.MulRV(m,this.m_lalcB,n.InitVelocityConstraints_s_rB);bt.MulSV(this.m_ratio,T,this.m_JvBD),this.m_JwD=this.m_ratio*bt.CrossVV(E,T),this.m_JwB=this.m_ratio*bt.CrossVV(b,T),this.m_mass+=this.m_ratio*this.m_ratio*(this.m_mD+this.m_mB)+this.m_iD*this.m_JwD*this.m_JwD+this.m_iB*this.m_JwB*this.m_JwB}this.m_mass=this.m_mass>0?1/this.m_mass:0,e.step.warmStarting?(r.SelfMulAdd(this.m_mA*this.m_impulse,this.m_JvAC),s+=this.m_iA*this.m_impulse*this.m_JwA,o.SelfMulAdd(this.m_mB*this.m_impulse,this.m_JvBD),h+=this.m_iB*this.m_impulse*this.m_JwB,l.SelfMulSub(this.m_mC*this.m_impulse,this.m_JvAC),c-=this.m_iC*this.m_impulse*this.m_JwC,f.SelfMulSub(this.m_mD*this.m_impulse,this.m_JvBD),d-=this.m_iD*this.m_impulse*this.m_JwD):this.m_impulse=0,e.velocities[this.m_indexA].w=s,e.velocities[this.m_indexB].w=h,e.velocities[this.m_indexC].w=c,e.velocities[this.m_indexD].w=d},r.SolveVelocityConstraints=function(t){var e=t.velocities[this.m_indexA].v,i=t.velocities[this.m_indexA].w,n=t.velocities[this.m_indexB].v,r=t.velocities[this.m_indexB].w,s=t.velocities[this.m_indexC].v,a=t.velocities[this.m_indexC].w,o=t.velocities[this.m_indexD].v,h=t.velocities[this.m_indexD].w,u=bt.DotVV(this.m_JvAC,bt.SubVV(e,s,bt.s_t0))+bt.DotVV(this.m_JvBD,bt.SubVV(n,o,bt.s_t0));u+=this.m_JwA*i-this.m_JwC*a+(this.m_JwB*r-this.m_JwD*h);var l=-this.m_mass*u;this.m_impulse+=l,e.SelfMulAdd(this.m_mA*l,this.m_JvAC),i+=this.m_iA*l*this.m_JwA,n.SelfMulAdd(this.m_mB*l,this.m_JvBD),r+=this.m_iB*l*this.m_JwB,s.SelfMulSub(this.m_mC*l,this.m_JvAC),a-=this.m_iC*l*this.m_JwC,o.SelfMulSub(this.m_mD*l,this.m_JvBD),h-=this.m_iD*l*this.m_JwD,t.velocities[this.m_indexA].w=i,t.velocities[this.m_indexB].w=r,t.velocities[this.m_indexC].w=a,t.velocities[this.m_indexD].w=h},r.SolvePositionConstraints=function(e){var i,r,s,a,o,h,u=e.positions[this.m_indexA].c,l=e.positions[this.m_indexA].a,c=e.positions[this.m_indexB].c,_=e.positions[this.m_indexB].a,f=e.positions[this.m_indexC].c,d=e.positions[this.m_indexC].a,m=e.positions[this.m_indexD].c,g=e.positions[this.m_indexD].a,y=this.m_qA.SetAngle(l),v=this.m_qB.SetAngle(_),S=this.m_qC.SetAngle(d),A=this.m_qD.SetAngle(g),T=0,E=this.m_JvAC,b=this.m_JvBD,x=0;if(this.m_typeA===t.b2JointType.e_revoluteJoint)E.SetZero(),s=1,o=1,x+=this.m_iA+this.m_iC,i=l-d-this.m_referenceAngleA;else{var C=It.MulRV(S,this.m_localAxisC,n.SolvePositionConstraints_s_u),R=It.MulRV(S,this.m_lalcC,n.SolvePositionConstraints_s_rC),w=It.MulRV(y,this.m_lalcA,n.SolvePositionConstraints_s_rA);E.Copy(C),o=bt.CrossVV(R,C),s=bt.CrossVV(w,C),x+=this.m_mC+this.m_mA+this.m_iC*o*o+this.m_iA*s*s;var I=this.m_lalcC,B=It.MulTRV(S,bt.AddVV(w,bt.SubVV(u,f,bt.s_t0),bt.s_t0),bt.s_t0);i=bt.DotVV(bt.SubVV(B,I,bt.s_t0),this.m_localAxisC)}if(this.m_typeB===t.b2JointType.e_revoluteJoint)b.SetZero(),a=this.m_ratio,h=this.m_ratio,x+=this.m_ratio*this.m_ratio*(this.m_iB+this.m_iD),r=_-g-this.m_referenceAngleB;else{var D=It.MulRV(A,this.m_localAxisD,n.SolvePositionConstraints_s_u),P=It.MulRV(A,this.m_lalcD,n.SolvePositionConstraints_s_rD),O=It.MulRV(v,this.m_lalcB,n.SolvePositionConstraints_s_rB);bt.MulSV(this.m_ratio,D,b),h=this.m_ratio*bt.CrossVV(P,D),a=this.m_ratio*bt.CrossVV(O,D),x+=this.m_ratio*this.m_ratio*(this.m_mD+this.m_mB)+this.m_iD*h*h+this.m_iB*a*a;var M=this.m_lalcD,N=It.MulTRV(A,bt.AddVV(O,bt.SubVV(c,m,bt.s_t0),bt.s_t0),bt.s_t0);r=bt.DotVV(bt.SubVV(N,M,bt.s_t0),this.m_localAxisD)}var L=i+this.m_ratio*r-this.m_constant,F=0;return x>0&&(F=-L/x),u.SelfMulAdd(this.m_mA*F,E),l+=this.m_iA*F*s,c.SelfMulAdd(this.m_mB*F,b),_+=this.m_iB*F*a,f.SelfMulSub(this.m_mC*F,E),d-=this.m_iC*F*o,m.SelfMulSub(this.m_mD*F,b),g-=this.m_iD*F*h,e.positions[this.m_indexA].a=l,e.positions[this.m_indexB].a=_,e.positions[this.m_indexC].a=d,e.positions[this.m_indexD].a=g,T<p},r.GetAnchorA=function(t){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA,t)},r.GetAnchorB=function(t){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB,t)},r.GetReactionForce=function(t,e){return bt.MulSV(t*this.m_impulse,this.m_JvAC,e)},r.GetReactionTorque=function(t){return t*this.m_impulse*this.m_JwA},r.GetJoint1=function(){return this.m_joint1},r.GetJoint2=function(){return this.m_joint2},r.GetRatio=function(){return this.m_ratio},r.SetRatio=function(t){this.m_ratio=t},r.Dump=function(t){var e=this.m_bodyA.m_islandIndex,i=this.m_bodyB.m_islandIndex,n=this.m_joint1.m_index,r=this.m_joint2.m_index;t(" const jd: b2GearJointDef = new b2GearJointDef();\n"),t(" jd.bodyA = bodies[%d];\n",e),t(" jd.bodyB = bodies[%d];\n",i),t(" jd.collideConnected = %s;\n",this.m_collideConnected?"true":"false"),t(" jd.joint1 = joints[%d];\n",n),t(" jd.joint2 = joints[%d];\n",r),t(" jd.ratio = %.15f;\n",this.m_ratio),t(" joints[%d] = this.m_world.CreateJoint(jd);\n",this.m_index)},n}(bn);Pn.InitVelocityConstraints_s_u=new bt,Pn.InitVelocityConstraints_s_rA=new bt,Pn.InitVelocityConstraints_s_rB=new bt,Pn.InitVelocityConstraints_s_rC=new bt,Pn.InitVelocityConstraints_s_rD=new bt,Pn.SolvePositionConstraints_s_u=new bt,Pn.SolvePositionConstraints_s_rA=new bt,Pn.SolvePositionConstraints_s_rB=new bt,Pn.SolvePositionConstraints_s_rC=new bt,Pn.SolvePositionConstraints_s_rD=new bt;var On=function(e){function i(){var i;return(i=e.call(this,t.b2JointType.e_motorJoint)||this).linearOffset=new bt(0,0),i.angularOffset=0,i.maxForce=1,i.maxTorque=1,i.correctionFactor=.3,i}return s(i,e),i.prototype.Initialize=function(t,e){this.bodyA=t,this.bodyB=e,this.bodyA.GetLocalPoint(this.bodyB.GetPosition(),this.linearOffset);var i=this.bodyA.GetAngle(),n=this.bodyB.GetAngle();this.angularOffset=n-i},i}(En),Mn=function(t){function e(e){var n;return(n=t.call(this,e)||this).m_linearOffset=new bt,n.m_angularOffset=0,n.m_linearImpulse=new bt,n.m_angularImpulse=0,n.m_maxForce=0,n.m_maxTorque=0,n.m_correctionFactor=.3,n.m_indexA=0,n.m_indexB=0,n.m_rA=new bt,n.m_rB=new bt,n.m_localCenterA=new bt,n.m_localCenterB=new bt,n.m_linearError=new bt,n.m_angularError=0,n.m_invMassA=0,n.m_invMassB=0,n.m_invIA=0,n.m_invIB=0,n.m_linearMass=new Rt,n.m_angularMass=0,n.m_qA=new It,n.m_qB=new It,n.m_K=new Rt,n.m_linearOffset.Copy(i(e.linearOffset,bt.ZERO)),n.m_linearImpulse.SetZero(),n.m_maxForce=i(e.maxForce,0),n.m_maxTorque=i(e.maxTorque,0),n.m_correctionFactor=i(e.correctionFactor,.3),n}s(e,t);var n=e.prototype;return n.GetAnchorA=function(t){var e=this.m_bodyA.GetPosition();return t.x=e.x,t.y=e.y,t},n.GetAnchorB=function(t){var e=this.m_bodyB.GetPosition();return t.x=e.x,t.y=e.y,t},n.GetReactionForce=function(t,e){return bt.MulSV(t,this.m_linearImpulse,e)},n.GetReactionTorque=function(t){return t*this.m_angularImpulse},n.SetLinearOffset=function(t){bt.IsEqualToV(t,this.m_linearOffset)||(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_linearOffset.Copy(t))},n.GetLinearOffset=function(){return this.m_linearOffset},n.SetAngularOffset=function(t){t!==this.m_angularOffset&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_angularOffset=t)},n.GetAngularOffset=function(){return this.m_angularOffset},n.SetMaxForce=function(t){this.m_maxForce=t},n.GetMaxForce=function(){return this.m_maxForce},n.SetMaxTorque=function(t){this.m_maxTorque=t},n.GetMaxTorque=function(){return this.m_maxTorque},n.InitVelocityConstraints=function(t){this.m_indexA=this.m_bodyA.m_islandIndex,this.m_indexB=this.m_bodyB.m_islandIndex,this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter),this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter),this.m_invMassA=this.m_bodyA.m_invMass,this.m_invMassB=this.m_bodyB.m_invMass,this.m_invIA=this.m_bodyA.m_invI,this.m_invIB=this.m_bodyB.m_invI;var e=t.positions[this.m_indexA].c,i=t.positions[this.m_indexA].a,n=t.velocities[this.m_indexA].v,r=t.velocities[this.m_indexA].w,s=t.positions[this.m_indexB].c,a=t.positions[this.m_indexB].a,o=t.velocities[this.m_indexB].v,h=t.velocities[this.m_indexB].w,u=this.m_qA.SetAngle(i),l=this.m_qB.SetAngle(a),c=It.MulRV(u,bt.SubVV(this.m_linearOffset,this.m_localCenterA,bt.s_t0),this.m_rA),_=It.MulRV(l,bt.NegV(this.m_localCenterB,bt.s_t0),this.m_rB),f=this.m_invMassA,d=this.m_invMassB,p=this.m_invIA,m=this.m_invIB,g=this.m_K;if(g.ex.x=f+d+p*c.y*c.y+m*_.y*_.y,g.ex.y=-p*c.x*c.y-m*_.x*_.y,g.ey.x=g.ex.y,g.ey.y=f+d+p*c.x*c.x+m*_.x*_.x,g.GetInverse(this.m_linearMass),this.m_angularMass=p+m,this.m_angularMass>0&&(this.m_angularMass=1/this.m_angularMass),bt.SubVV(bt.AddVV(s,_,bt.s_t0),bt.AddVV(e,c,bt.s_t1),this.m_linearError),this.m_angularError=a-i-this.m_angularOffset,t.step.warmStarting){this.m_linearImpulse.SelfMul(t.step.dtRatio),this.m_angularImpulse*=t.step.dtRatio;var y=this.m_linearImpulse;n.SelfMulSub(f,y),r-=p*(bt.CrossVV(c,y)+this.m_angularImpulse),o.SelfMulAdd(d,y),h+=m*(bt.CrossVV(_,y)+this.m_angularImpulse)}else this.m_linearImpulse.SetZero(),this.m_angularImpulse=0;t.velocities[this.m_indexA].w=r,t.velocities[this.m_indexB].w=h},n.SolveVelocityConstraints=function(t){var i=t.velocities[this.m_indexA].v,n=t.velocities[this.m_indexA].w,r=t.velocities[this.m_indexB].v,s=t.velocities[this.m_indexB].w,a=this.m_invMassA,o=this.m_invMassB,h=this.m_invIA,u=this.m_invIB,l=t.step.dt,c=t.step.inv_dt,_=s-n+c*this.m_correctionFactor*this.m_angularError,f=-this.m_angularMass*_,d=this.m_angularImpulse,p=l*this.m_maxTorque;this.m_angularImpulse=at(this.m_angularImpulse+f,-p,p),n-=h*(f=this.m_angularImpulse-d),s+=u*f;var m=this.m_rA,g=this.m_rB,y=bt.AddVV(bt.SubVV(bt.AddVV(r,bt.CrossSV(s,g,bt.s_t0),bt.s_t0),bt.AddVV(i,bt.CrossSV(n,m,bt.s_t1),bt.s_t1),bt.s_t2),bt.MulSV(c*this.m_correctionFactor,this.m_linearError,bt.s_t3),e.SolveVelocityConstraints_s_Cdot_v2),v=Rt.MulMV(this.m_linearMass,y,e.SolveVelocityConstraints_s_impulse_v2).SelfNeg(),S=e.SolveVelocityConstraints_s_oldImpulse_v2.Copy(this.m_linearImpulse);this.m_linearImpulse.SelfAdd(v);var A=l*this.m_maxForce;this.m_linearImpulse.LengthSquared()>A*A&&(this.m_linearImpulse.Normalize(),this.m_linearImpulse.SelfMul(A)),bt.SubVV(this.m_linearImpulse,S,v),i.SelfMulSub(a,v),n-=h*bt.CrossVV(m,v),r.SelfMulAdd(o,v),s+=u*bt.CrossVV(g,v),t.velocities[this.m_indexA].w=n,t.velocities[this.m_indexB].w=s},n.SolvePositionConstraints=function(){return!0},n.Dump=function(t){var e=this.m_bodyA.m_islandIndex,i=this.m_bodyB.m_islandIndex;t(" const jd: b2MotorJointDef = new b2MotorJointDef();\n"),t(" jd.bodyA = bodies[%d];\n",e),t(" jd.bodyB = bodies[%d];\n",i),t(" jd.collideConnected = %s;\n",this.m_collideConnected?"true":"false"),t(" jd.linearOffset.Set(%.15f, %.15f);\n",this.m_linearOffset.x,this.m_linearOffset.y),t(" jd.angularOffset = %.15f;\n",this.m_angularOffset),t(" jd.maxForce = %.15f;\n",this.m_maxForce),t(" jd.maxTorque = %.15f;\n",this.m_maxTorque),t(" jd.correctionFactor = %.15f;\n",this.m_correctionFactor),t(" joints[%d] = this.m_world.CreateJoint(jd);\n",this.m_index)},e}(bn);Mn.SolveVelocityConstraints_s_Cdot_v2=new bt,Mn.SolveVelocityConstraints_s_impulse_v2=new bt,Mn.SolveVelocityConstraints_s_oldImpulse_v2=new bt;var Nn=function(e){function i(){var i;return(i=e.call(this,t.b2JointType.e_mouseJoint)||this).target=new bt,i.maxForce=0,i.frequencyHz=5,i.dampingRatio=.7,i}return s(i,e),i}(En),Ln=function(t){function e(e){var n;return(n=t.call(this,e)||this).m_localAnchorB=new bt,n.m_targetA=new bt,n.m_frequencyHz=0,n.m_dampingRatio=0,n.m_beta=0,n.m_impulse=new bt,n.m_maxForce=0,n.m_gamma=0,n.m_indexA=0,n.m_indexB=0,n.m_rB=new bt,n.m_localCenterB=new bt,n.m_invMassB=0,n.m_invIB=0,n.m_mass=new Rt,n.m_C=new bt,n.m_qB=new It,n.m_lalcB=new bt,n.m_K=new Rt,n.m_targetA.Copy(i(e.target,bt.ZERO)),Bt.MulTXV(n.m_bodyB.GetTransform(),n.m_targetA,n.m_localAnchorB),n.m_maxForce=i(e.maxForce,0),n.m_impulse.SetZero(),n.m_frequencyHz=i(e.frequencyHz,0),n.m_dampingRatio=i(e.dampingRatio,0),n.m_beta=0,n.m_gamma=0,n}s(e,t);var n=e.prototype;return n.SetTarget=function(t){this.m_bodyB.IsAwake()||this.m_bodyB.SetAwake(!0),this.m_targetA.Copy(t)},n.GetTarget=function(){return this.m_targetA},n.SetMaxForce=function(t){this.m_maxForce=t},n.GetMaxForce=function(){return this.m_maxForce},n.SetFrequency=function(t){this.m_frequencyHz=t},n.GetFrequency=function(){return this.m_frequencyHz},n.SetDampingRatio=function(t){this.m_dampingRatio=t},n.GetDampingRatio=function(){return this.m_dampingRatio},n.InitVelocityConstraints=function(t){this.m_indexB=this.m_bodyB.m_islandIndex,this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter),this.m_invMassB=this.m_bodyB.m_invMass,this.m_invIB=this.m_bodyB.m_invI;var e=t.positions[this.m_indexB].c,i=t.positions[this.m_indexB].a,n=t.velocities[this.m_indexB].v,r=t.velocities[this.m_indexB].w,s=this.m_qB.SetAngle(i),a=this.m_bodyB.GetMass(),o=2*h*this.m_frequencyHz,u=2*a*this.m_dampingRatio*o,l=a*o*o,c=t.step.dt;this.m_gamma=c*(u+c*l),0!==this.m_gamma&&(this.m_gamma=1/this.m_gamma),this.m_beta=c*l*this.m_gamma,bt.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB),It.MulRV(s,this.m_lalcB,this.m_rB);var _=this.m_K;_.ex.x=this.m_invMassB+this.m_invIB*this.m_rB.y*this.m_rB.y+this.m_gamma,_.ex.y=-this.m_invIB*this.m_rB.x*this.m_rB.y,_.ey.x=_.ex.y,_.ey.y=this.m_invMassB+this.m_invIB*this.m_rB.x*this.m_rB.x+this.m_gamma,_.GetInverse(this.m_mass),this.m_C.x=e.x+this.m_rB.x-this.m_targetA.x,this.m_C.y=e.y+this.m_rB.y-this.m_targetA.y,this.m_C.SelfMul(this.m_beta),r*=.98,t.step.warmStarting?(this.m_impulse.SelfMul(t.step.dtRatio),n.x+=this.m_invMassB*this.m_impulse.x,n.y+=this.m_invMassB*this.m_impulse.y,r+=this.m_invIB*bt.CrossVV(this.m_rB,this.m_impulse)):this.m_impulse.SetZero(),t.velocities[this.m_indexB].w=r},n.SolveVelocityConstraints=function(t){var i=t.velocities[this.m_indexB].v,n=t.velocities[this.m_indexB].w,r=bt.AddVCrossSV(i,n,this.m_rB,e.SolveVelocityConstraints_s_Cdot),s=Rt.MulMV(this.m_mass,bt.AddVV(r,bt.AddVV(this.m_C,bt.MulSV(this.m_gamma,this.m_impulse,bt.s_t0),bt.s_t0),bt.s_t0).SelfNeg(),e.SolveVelocityConstraints_s_impulse),a=e.SolveVelocityConstraints_s_oldImpulse.Copy(this.m_impulse);this.m_impulse.SelfAdd(s);var o=t.step.dt*this.m_maxForce;this.m_impulse.LengthSquared()>o*o&&this.m_impulse.SelfMul(o/this.m_impulse.Length()),bt.SubVV(this.m_impulse,a,s),i.SelfMulAdd(this.m_invMassB,s),n+=this.m_invIB*bt.CrossVV(this.m_rB,s),t.velocities[this.m_indexB].w=n},n.SolvePositionConstraints=function(){return!0},n.GetAnchorA=function(t){return t.x=this.m_targetA.x,t.y=this.m_targetA.y,t},n.GetAnchorB=function(t){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB,t)},n.GetReactionForce=function(t,e){return bt.MulSV(t,this.m_impulse,e)},n.GetReactionTorque=function(){return 0},n.Dump=function(t){t("Mouse joint dumping is not supported.\n")},n.ShiftOrigin=function(t){this.m_targetA.SelfSub(t)},e}(bn);Ln.SolveVelocityConstraints_s_Cdot=new bt,Ln.SolveVelocityConstraints_s_impulse=new bt,Ln.SolveVelocityConstraints_s_oldImpulse=new bt;var Fn=function(e){function i(){var i;return(i=e.call(this,t.b2JointType.e_prismaticJoint)||this).localAnchorA=new bt,i.localAnchorB=new bt,i.localAxisA=new bt(1,0),i.referenceAngle=0,i.enableLimit=!1,i.lowerTranslation=0,i.upperTranslation=0,i.enableMotor=!1,i.maxMotorForce=0,i.motorSpeed=0,i}return s(i,e),i.prototype.Initialize=function(t,e,i,n){this.bodyA=t,this.bodyB=e,this.bodyA.GetLocalPoint(i,this.localAnchorA),this.bodyB.GetLocalPoint(i,this.localAnchorB),this.bodyA.GetLocalVector(n,this.localAxisA),this.referenceAngle=this.bodyB.GetAngle()-this.bodyA.GetAngle()},i}(En),kn=function(e){function n(n){var r;return(r=e.call(this,n)||this).m_localAnchorA=new bt,r.m_localAnchorB=new bt,r.m_localXAxisA=new bt,r.m_localYAxisA=new bt,r.m_referenceAngle=0,r.m_impulse=new Ct(0,0,0),r.m_motorImpulse=0,r.m_lowerTranslation=0,r.m_upperTranslation=0,r.m_maxMotorForce=0,r.m_motorSpeed=0,r.m_enableLimit=!1,r.m_enableMotor=!1,r.m_limitState=t.b2LimitState.e_inactiveLimit,r.m_indexA=0,r.m_indexB=0,r.m_localCenterA=new bt,r.m_localCenterB=new bt,r.m_invMassA=0,r.m_invMassB=0,r.m_invIA=0,r.m_invIB=0,r.m_axis=new bt(0,0),r.m_perp=new bt(0,0),r.m_s1=0,r.m_s2=0,r.m_a1=0,r.m_a2=0,r.m_K=new wt,r.m_K3=new wt,r.m_K2=new Rt,r.m_motorMass=0,r.m_qA=new It,r.m_qB=new It,r.m_lalcA=new bt,r.m_lalcB=new bt,r.m_rA=new bt,r.m_rB=new bt,r.m_localAnchorA.Copy(i(n.localAnchorA,bt.ZERO)),r.m_localAnchorB.Copy(i(n.localAnchorB,bt.ZERO)),r.m_localXAxisA.Copy(i(n.localAxisA,new bt(1,0))).SelfNormalize(),bt.CrossOneV(r.m_localXAxisA,r.m_localYAxisA),r.m_referenceAngle=i(n.referenceAngle,0),r.m_lowerTranslation=i(n.lowerTranslation,0),r.m_upperTranslation=i(n.upperTranslation,0),r.m_maxMotorForce=i(n.maxMotorForce,0),r.m_motorSpeed=i(n.motorSpeed,0),r.m_enableLimit=i(n.enableLimit,!1),r.m_enableMotor=i(n.enableMotor,!1),r}s(n,e);var r=n.prototype;return r.InitVelocityConstraints=function(e){this.m_indexA=this.m_bodyA.m_islandIndex,this.m_indexB=this.m_bodyB.m_islandIndex,this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter),this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter),this.m_invMassA=this.m_bodyA.m_invMass,this.m_invMassB=this.m_bodyB.m_invMass,this.m_invIA=this.m_bodyA.m_invI,this.m_invIB=this.m_bodyB.m_invI;var i=e.positions[this.m_indexA].c,r=e.positions[this.m_indexA].a,s=e.velocities[this.m_indexA].v,a=e.velocities[this.m_indexA].w,o=e.positions[this.m_indexB].c,h=e.positions[this.m_indexB].a,u=e.velocities[this.m_indexB].v,l=e.velocities[this.m_indexB].w,c=this.m_qA.SetAngle(r),_=this.m_qB.SetAngle(h);bt.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var f=It.MulRV(c,this.m_lalcA,this.m_rA);bt.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var d=It.MulRV(_,this.m_lalcB,this.m_rB),m=bt.AddVV(bt.SubVV(o,i,bt.s_t0),bt.SubVV(d,f,bt.s_t1),n.InitVelocityConstraints_s_d),g=this.m_invMassA,y=this.m_invMassB,v=this.m_invIA,S=this.m_invIB;if(It.MulRV(c,this.m_localXAxisA,this.m_axis),this.m_a1=bt.CrossVV(bt.AddVV(m,f,bt.s_t0),this.m_axis),this.m_a2=bt.CrossVV(d,this.m_axis),this.m_motorMass=g+y+v*this.m_a1*this.m_a1+S*this.m_a2*this.m_a2,this.m_motorMass>0&&(this.m_motorMass=1/this.m_motorMass),It.MulRV(c,this.m_localYAxisA,this.m_perp),this.m_s1=bt.CrossVV(bt.AddVV(m,f,bt.s_t0),this.m_perp),this.m_s2=bt.CrossVV(d,this.m_perp),this.m_K.ex.x=g+y+v*this.m_s1*this.m_s1+S*this.m_s2*this.m_s2,this.m_K.ex.y=v*this.m_s1+S*this.m_s2,this.m_K.ex.z=v*this.m_s1*this.m_a1+S*this.m_s2*this.m_a2,this.m_K.ey.x=this.m_K.ex.y,this.m_K.ey.y=v+S,0===this.m_K.ey.y&&(this.m_K.ey.y=1),this.m_K.ey.z=v*this.m_a1+S*this.m_a2,this.m_K.ez.x=this.m_K.ex.z,this.m_K.ez.y=this.m_K.ey.z,this.m_K.ez.z=g+y+v*this.m_a1*this.m_a1+S*this.m_a2*this.m_a2,this.m_enableLimit){var A=bt.DotVV(this.m_axis,m);nt(this.m_upperTranslation-this.m_lowerTranslation)<2*p?this.m_limitState=t.b2LimitState.e_equalLimits:A<=this.m_lowerTranslation?this.m_limitState!==t.b2LimitState.e_atLowerLimit&&(this.m_limitState=t.b2LimitState.e_atLowerLimit,this.m_impulse.z=0):A>=this.m_upperTranslation?this.m_limitState!==t.b2LimitState.e_atUpperLimit&&(this.m_limitState=t.b2LimitState.e_atUpperLimit,this.m_impulse.z=0):(this.m_limitState=t.b2LimitState.e_inactiveLimit,this.m_impulse.z=0)}else this.m_limitState=t.b2LimitState.e_inactiveLimit,this.m_impulse.z=0;if(this.m_enableMotor||(this.m_motorImpulse=0),e.step.warmStarting){this.m_impulse.SelfMul(e.step.dtRatio),this.m_motorImpulse*=e.step.dtRatio;var T=bt.AddVV(bt.MulSV(this.m_impulse.x,this.m_perp,bt.s_t0),bt.MulSV(this.m_motorImpulse+this.m_impulse.z,this.m_axis,bt.s_t1),n.InitVelocityConstraints_s_P),E=this.m_impulse.x*this.m_s1+this.m_impulse.y+(this.m_motorImpulse+this.m_impulse.z)*this.m_a1,b=this.m_impulse.x*this.m_s2+this.m_impulse.y+(this.m_motorImpulse+this.m_impulse.z)*this.m_a2;s.SelfMulSub(g,T),a-=v*E,u.SelfMulAdd(y,T),l+=S*b}else this.m_impulse.SetZero(),this.m_motorImpulse=0;e.velocities[this.m_indexA].w=a,e.velocities[this.m_indexB].w=l},r.SolveVelocityConstraints=function(e){var i=e.velocities[this.m_indexA].v,r=e.velocities[this.m_indexA].w,s=e.velocities[this.m_indexB].v,a=e.velocities[this.m_indexB].w,o=this.m_invMassA,h=this.m_invMassB,u=this.m_invIA,l=this.m_invIB;if(this.m_enableMotor&&this.m_limitState!==t.b2LimitState.e_equalLimits){var c=bt.DotVV(this.m_axis,bt.SubVV(s,i,bt.s_t0))+this.m_a2*a-this.m_a1*r,_=this.m_motorMass*(this.m_motorSpeed-c),f=this.m_motorImpulse,d=e.step.dt*this.m_maxMotorForce;this.m_motorImpulse=at(this.m_motorImpulse+_,-d,d),_=this.m_motorImpulse-f;var p=bt.MulSV(_,this.m_axis,n.SolveVelocityConstraints_s_P),m=_*this.m_a1,g=_*this.m_a2;i.SelfMulSub(o,p),r-=u*m,s.SelfMulAdd(h,p),a+=l*g}var y=bt.DotVV(this.m_perp,bt.SubVV(s,i,bt.s_t0))+this.m_s2*a-this.m_s1*r,v=a-r;if(this.m_enableLimit&&this.m_limitState!==t.b2LimitState.e_inactiveLimit){var S=bt.DotVV(this.m_axis,bt.SubVV(s,i,bt.s_t0))+this.m_a2*a-this.m_a1*r,A=n.SolveVelocityConstraints_s_f1.Copy(this.m_impulse),T=this.m_K.Solve33(-y,-v,-S,n.SolveVelocityConstraints_s_df3);this.m_impulse.SelfAdd(T),this.m_limitState===t.b2LimitState.e_atLowerLimit?this.m_impulse.z=st(this.m_impulse.z,0):this.m_limitState===t.b2LimitState.e_atUpperLimit&&(this.m_impulse.z=rt(this.m_impulse.z,0));var E=-y-(this.m_impulse.z-A.z)*this.m_K.ez.x,b=-v-(this.m_impulse.z-A.z)*this.m_K.ez.y,x=this.m_K.Solve22(E,b,n.SolveVelocityConstraints_s_f2r);x.x+=A.x,x.y+=A.y,this.m_impulse.x=x.x,this.m_impulse.y=x.y,T.x=this.m_impulse.x-A.x,T.y=this.m_impulse.y-A.y,T.z=this.m_impulse.z-A.z;var C=bt.AddVV(bt.MulSV(T.x,this.m_perp,bt.s_t0),bt.MulSV(T.z,this.m_axis,bt.s_t1),n.SolveVelocityConstraints_s_P),R=T.x*this.m_s1+T.y+T.z*this.m_a1,w=T.x*this.m_s2+T.y+T.z*this.m_a2;i.SelfMulSub(o,C),r-=u*R,s.SelfMulAdd(h,C),a+=l*w}else{var I=this.m_K.Solve22(-y,-v,n.SolveVelocityConstraints_s_df2);this.m_impulse.x+=I.x,this.m_impulse.y+=I.y;var B=bt.MulSV(I.x,this.m_perp,n.SolveVelocityConstraints_s_P),D=I.x*this.m_s1+I.y,P=I.x*this.m_s2+I.y;i.SelfMulSub(o,B),r-=u*D,s.SelfMulAdd(h,B),a+=l*P}e.velocities[this.m_indexA].w=r,e.velocities[this.m_indexB].w=a},r.SolvePositionConstraints=function(t){var e=t.positions[this.m_indexA].c,i=t.positions[this.m_indexA].a,r=t.positions[this.m_indexB].c,s=t.positions[this.m_indexB].a,a=this.m_qA.SetAngle(i),o=this.m_qB.SetAngle(s),h=this.m_invMassA,u=this.m_invMassB,l=this.m_invIA,c=this.m_invIB,_=It.MulRV(a,this.m_lalcA,this.m_rA),f=It.MulRV(o,this.m_lalcB,this.m_rB),d=bt.SubVV(bt.AddVV(r,f,bt.s_t0),bt.AddVV(e,_,bt.s_t1),n.SolvePositionConstraints_s_d),g=It.MulRV(a,this.m_localXAxisA,this.m_axis),y=bt.CrossVV(bt.AddVV(d,_,bt.s_t0),g),v=bt.CrossVV(f,g),S=It.MulRV(a,this.m_localYAxisA,this.m_perp),T=bt.CrossVV(bt.AddVV(d,_,bt.s_t0),S),E=bt.CrossVV(f,S),b=n.SolvePositionConstraints_s_impulse,x=bt.DotVV(S,d),C=s-i-this.m_referenceAngle,R=nt(x),w=nt(C),I=!1,B=0;if(this.m_enableLimit){var D=bt.DotVV(g,d);nt(this.m_upperTranslation-this.m_lowerTranslation)<2*p?(B=at(D,-A,A),R=st(R,nt(D)),I=!0):D<=this.m_lowerTranslation?(B=at(D-this.m_lowerTranslation+p,-A,0),R=st(R,this.m_lowerTranslation-D),I=!0):D>=this.m_upperTranslation&&(B=at(D-this.m_upperTranslation-p,0,A),R=st(R,D-this.m_upperTranslation),I=!0)}if(I){var P=h+u+l*T*T+c*E*E,O=l*T+c*E,M=l*T*y+c*E*v,N=l+c;0===N&&(N=1);var L=l*y+c*v,F=h+u+l*y*y+c*v*v,k=this.m_K3;k.ex.SetXYZ(P,O,M),k.ey.SetXYZ(O,N,L),k.ez.SetXYZ(M,L,F),b=k.Solve33(-x,-C,-B,b)}else{var G=h+u+l*T*T+c*E*E,V=l*T+c*E,U=l+c;0===U&&(U=1);var z=this.m_K2;z.ex.Set(G,V),z.ey.Set(V,U);var H=z.Solve(-x,-C,n.SolvePositionConstraints_s_impulse1);b.x=H.x,b.y=H.y,b.z=0}var W=bt.AddVV(bt.MulSV(b.x,S,bt.s_t0),bt.MulSV(b.z,g,bt.s_t1),n.SolvePositionConstraints_s_P),X=b.x*T+b.y+b.z*y,j=b.x*E+b.y+b.z*v;return e.SelfMulSub(h,W),i-=l*X,r.SelfMulAdd(u,W),s+=c*j,t.positions[this.m_indexA].a=i,t.positions[this.m_indexB].a=s,R<=p&&w<=m},r.GetAnchorA=function(t){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA,t)},r.GetAnchorB=function(t){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB,t)},r.GetReactionForce=function(t,e){return e.x=t*(this.m_impulse.x*this.m_perp.x+(this.m_motorImpulse+this.m_impulse.z)*this.m_axis.x),e.y=t*(this.m_impulse.x*this.m_perp.y+(this.m_motorImpulse+this.m_impulse.z)*this.m_axis.y),e},r.GetReactionTorque=function(t){return t*this.m_impulse.y},r.GetLocalAnchorA=function(){return this.m_localAnchorA},r.GetLocalAnchorB=function(){return this.m_localAnchorB},r.GetLocalAxisA=function(){return this.m_localXAxisA},r.GetReferenceAngle=function(){return this.m_referenceAngle},r.GetJointTranslation=function(){var t=this.m_bodyA.GetWorldPoint(this.m_localAnchorA,n.GetJointTranslation_s_pA),e=this.m_bodyB.GetWorldPoint(this.m_localAnchorB,n.GetJointTranslation_s_pB),i=bt.SubVV(e,t,n.GetJointTranslation_s_d),r=this.m_bodyA.GetWorldVector(this.m_localXAxisA,n.GetJointTranslation_s_axis);return bt.DotVV(i,r)},r.GetJointSpeed=function(){var t=this.m_bodyA,e=this.m_bodyB;bt.SubVV(this.m_localAnchorA,t.m_sweep.localCenter,this.m_lalcA);var i=It.MulRV(t.m_xf.q,this.m_lalcA,this.m_rA);bt.SubVV(this.m_localAnchorB,e.m_sweep.localCenter,this.m_lalcB);var n=It.MulRV(e.m_xf.q,this.m_lalcB,this.m_rB),r=bt.AddVV(t.m_sweep.c,i,bt.s_t0),s=bt.AddVV(e.m_sweep.c,n,bt.s_t1),a=bt.SubVV(s,r,bt.s_t2),o=t.GetWorldVector(this.m_localXAxisA,this.m_axis),h=t.m_linearVelocity,u=e.m_linearVelocity,l=t.m_angularVelocity,c=e.m_angularVelocity;return bt.DotVV(a,bt.CrossSV(l,o,bt.s_t0))+bt.DotVV(o,bt.SubVV(bt.AddVCrossSV(u,c,n,bt.s_t0),bt.AddVCrossSV(h,l,i,bt.s_t1),bt.s_t0))},r.IsLimitEnabled=function(){return this.m_enableLimit},r.EnableLimit=function(t){t!==this.m_enableLimit&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_enableLimit=t,this.m_impulse.z=0)},r.GetLowerLimit=function(){return this.m_lowerTranslation},r.GetUpperLimit=function(){return this.m_upperTranslation},r.SetLimits=function(t,e){t===this.m_lowerTranslation&&e===this.m_upperTranslation||(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_lowerTranslation=t,this.m_upperTranslation=e,this.m_impulse.z=0)},r.IsMotorEnabled=function(){return this.m_enableMotor},r.EnableMotor=function(t){t!==this.m_enableMotor&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_enableMotor=t)},r.SetMotorSpeed=function(t){t!==this.m_motorSpeed&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_motorSpeed=t)},r.GetMotorSpeed=function(){return this.m_motorSpeed},r.SetMaxMotorForce=function(t){t!==this.m_maxMotorForce&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_maxMotorForce=t)},r.GetMaxMotorForce=function(){return this.m_maxMotorForce},r.GetMotorForce=function(t){return t*this.m_motorImpulse},r.Dump=function(t){var e=this.m_bodyA.m_islandIndex,i=this.m_bodyB.m_islandIndex;t(" const jd: b2PrismaticJointDef = new b2PrismaticJointDef();\n"),t(" jd.bodyA = bodies[%d];\n",e),t(" jd.bodyB = bodies[%d];\n",i),t(" jd.collideConnected = %s;\n",this.m_collideConnected?"true":"false"),t(" jd.localAnchorA.Set(%.15f, %.15f);\n",this.m_localAnchorA.x,this.m_localAnchorA.y),t(" jd.localAnchorB.Set(%.15f, %.15f);\n",this.m_localAnchorB.x,this.m_localAnchorB.y),t(" jd.localAxisA.Set(%.15f, %.15f);\n",this.m_localXAxisA.x,this.m_localXAxisA.y),t(" jd.referenceAngle = %.15f;\n",this.m_referenceAngle),t(" jd.enableLimit = %s;\n",this.m_enableLimit?"true":"false"),t(" jd.lowerTranslation = %.15f;\n",this.m_lowerTranslation),t(" jd.upperTranslation = %.15f;\n",this.m_upperTranslation),t(" jd.enableMotor = %s;\n",this.m_enableMotor?"true":"false"),t(" jd.motorSpeed = %.15f;\n",this.m_motorSpeed),t(" jd.maxMotorForce = %.15f;\n",this.m_maxMotorForce),t(" joints[%d] = this.m_world.CreateJoint(jd);\n",this.m_index)},n}(bn);kn.InitVelocityConstraints_s_d=new bt,kn.InitVelocityConstraints_s_P=new bt,kn.SolveVelocityConstraints_s_P=new bt,kn.SolveVelocityConstraints_s_f2r=new bt,kn.SolveVelocityConstraints_s_f1=new Ct,kn.SolveVelocityConstraints_s_df3=new Ct,kn.SolveVelocityConstraints_s_df2=new bt,kn.SolvePositionConstraints_s_d=new bt,kn.SolvePositionConstraints_s_impulse=new Ct,kn.SolvePositionConstraints_s_impulse1=new bt,kn.SolvePositionConstraints_s_P=new bt,kn.GetJointTranslation_s_pA=new bt,kn.GetJointTranslation_s_pB=new bt,kn.GetJointTranslation_s_d=new bt,kn.GetJointTranslation_s_axis=new bt;var Gn=2,Vn=function(e){function i(){var i;return(i=e.call(this,t.b2JointType.e_pulleyJoint)||this).groundAnchorA=new bt(-1,1),i.groundAnchorB=new bt(1,1),i.localAnchorA=new bt(-1,0),i.localAnchorB=new bt(1,0),i.lengthA=0,i.lengthB=0,i.ratio=1,i.collideConnected=!0,i}return s(i,e),i.prototype.Initialize=function(t,e,i,n,r,s,a){this.bodyA=t,this.bodyB=e,this.groundAnchorA.Copy(i),this.groundAnchorB.Copy(n),this.bodyA.GetLocalPoint(r,this.localAnchorA),this.bodyB.GetLocalPoint(s,this.localAnchorB),this.lengthA=bt.DistanceVV(r,i),this.lengthB=bt.DistanceVV(s,n),this.ratio=a},i}(En),Un=function(t){function e(e){var n;return(n=t.call(this,e)||this).m_groundAnchorA=new bt,n.m_groundAnchorB=new bt,n.m_lengthA=0,n.m_lengthB=0,n.m_localAnchorA=new bt,n.m_localAnchorB=new bt,n.m_constant=0,n.m_ratio=0,n.m_impulse=0,n.m_indexA=0,n.m_indexB=0,n.m_uA=new bt,n.m_uB=new bt,n.m_rA=new bt,n.m_rB=new bt,n.m_localCenterA=new bt,n.m_localCenterB=new bt,n.m_invMassA=0,n.m_invMassB=0,n.m_invIA=0,n.m_invIB=0,n.m_mass=0,n.m_qA=new It,n.m_qB=new It,n.m_lalcA=new bt,n.m_lalcB=new bt,n.m_groundAnchorA.Copy(i(e.groundAnchorA,new bt(-1,1))),n.m_groundAnchorB.Copy(i(e.groundAnchorB,new bt(1,0))),n.m_localAnchorA.Copy(i(e.localAnchorA,new bt(-1,0))),n.m_localAnchorB.Copy(i(e.localAnchorB,new bt(1,0))),n.m_lengthA=i(e.lengthA,0),n.m_lengthB=i(e.lengthB,0),n.m_ratio=i(e.ratio,1),n.m_constant=i(e.lengthA,0)+n.m_ratio*i(e.lengthB,0),n.m_impulse=0,n}s(e,t);var n=e.prototype;return n.InitVelocityConstraints=function(t){this.m_indexA=this.m_bodyA.m_islandIndex,this.m_indexB=this.m_bodyB.m_islandIndex,this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter),this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter),this.m_invMassA=this.m_bodyA.m_invMass,this.m_invMassB=this.m_bodyB.m_invMass,this.m_invIA=this.m_bodyA.m_invI,this.m_invIB=this.m_bodyB.m_invI;var i=t.positions[this.m_indexA].c,n=t.positions[this.m_indexA].a,r=t.velocities[this.m_indexA].v,s=t.velocities[this.m_indexA].w,a=t.positions[this.m_indexB].c,o=t.positions[this.m_indexB].a,h=t.velocities[this.m_indexB].v,u=t.velocities[this.m_indexB].w,l=this.m_qA.SetAngle(n),c=this.m_qB.SetAngle(o);bt.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA),It.MulRV(l,this.m_lalcA,this.m_rA),bt.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB),It.MulRV(c,this.m_lalcB,this.m_rB),this.m_uA.Copy(i).SelfAdd(this.m_rA).SelfSub(this.m_groundAnchorA),this.m_uB.Copy(a).SelfAdd(this.m_rB).SelfSub(this.m_groundAnchorB);var _=this.m_uA.Length(),f=this.m_uB.Length();_>10*p?this.m_uA.SelfMul(1/_):this.m_uA.SetZero(),f>10*p?this.m_uB.SelfMul(1/f):this.m_uB.SetZero();var d=bt.CrossVV(this.m_rA,this.m_uA),m=bt.CrossVV(this.m_rB,this.m_uB),g=this.m_invMassA+this.m_invIA*d*d,y=this.m_invMassB+this.m_invIB*m*m;if(this.m_mass=g+this.m_ratio*this.m_ratio*y,this.m_mass>0&&(this.m_mass=1/this.m_mass),t.step.warmStarting){this.m_impulse*=t.step.dtRatio;var v=bt.MulSV(-this.m_impulse,this.m_uA,e.InitVelocityConstraints_s_PA),S=bt.MulSV(-this.m_ratio*this.m_impulse,this.m_uB,e.InitVelocityConstraints_s_PB);r.SelfMulAdd(this.m_invMassA,v),s+=this.m_invIA*bt.CrossVV(this.m_rA,v),h.SelfMulAdd(this.m_invMassB,S),u+=this.m_invIB*bt.CrossVV(this.m_rB,S)}else this.m_impulse=0;t.velocities[this.m_indexA].w=s,t.velocities[this.m_indexB].w=u},n.SolveVelocityConstraints=function(t){var i=t.velocities[this.m_indexA].v,n=t.velocities[this.m_indexA].w,r=t.velocities[this.m_indexB].v,s=t.velocities[this.m_indexB].w,a=bt.AddVCrossSV(i,n,this.m_rA,e.SolveVelocityConstraints_s_vpA),o=bt.AddVCrossSV(r,s,this.m_rB,e.SolveVelocityConstraints_s_vpB),h=-bt.DotVV(this.m_uA,a)-this.m_ratio*bt.DotVV(this.m_uB,o),u=-this.m_mass*h;this.m_impulse+=u;var l=bt.MulSV(-u,this.m_uA,e.SolveVelocityConstraints_s_PA),c=bt.MulSV(-this.m_ratio*u,this.m_uB,e.SolveVelocityConstraints_s_PB);i.SelfMulAdd(this.m_invMassA,l),n+=this.m_invIA*bt.CrossVV(this.m_rA,l),r.SelfMulAdd(this.m_invMassB,c),s+=this.m_invIB*bt.CrossVV(this.m_rB,c),t.velocities[this.m_indexA].w=n,t.velocities[this.m_indexB].w=s},n.SolvePositionConstraints=function(t){var i=t.positions[this.m_indexA].c,n=t.positions[this.m_indexA].a,r=t.positions[this.m_indexB].c,s=t.positions[this.m_indexB].a,a=this.m_qA.SetAngle(n),o=this.m_qB.SetAngle(s);bt.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var h=It.MulRV(a,this.m_lalcA,this.m_rA);bt.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var u=It.MulRV(o,this.m_lalcB,this.m_rB),l=this.m_uA.Copy(i).SelfAdd(h).SelfSub(this.m_groundAnchorA),c=this.m_uB.Copy(r).SelfAdd(u).SelfSub(this.m_groundAnchorB),_=l.Length(),f=c.Length();_>10*p?l.SelfMul(1/_):l.SetZero(),f>10*p?c.SelfMul(1/f):c.SetZero();var d=bt.CrossVV(h,l),m=bt.CrossVV(u,c),g=this.m_invMassA+this.m_invIA*d*d,y=this.m_invMassB+this.m_invIB*m*m,v=g+this.m_ratio*this.m_ratio*y;v>0&&(v=1/v);var S=this.m_constant-_-this.m_ratio*f,A=nt(S),T=-v*S,E=bt.MulSV(-T,l,e.SolvePositionConstraints_s_PA),b=bt.MulSV(-this.m_ratio*T,c,e.SolvePositionConstraints_s_PB);return i.SelfMulAdd(this.m_invMassA,E),n+=this.m_invIA*bt.CrossVV(h,E),r.SelfMulAdd(this.m_invMassB,b),s+=this.m_invIB*bt.CrossVV(u,b),t.positions[this.m_indexA].a=n,t.positions[this.m_indexB].a=s,A<p},n.GetAnchorA=function(t){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA,t)},n.GetAnchorB=function(t){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB,t)},n.GetReactionForce=function(t,e){return e.x=t*this.m_impulse*this.m_uB.x,e.y=t*this.m_impulse*this.m_uB.y,e},n.GetReactionTorque=function(){return 0},n.GetGroundAnchorA=function(){return this.m_groundAnchorA},n.GetGroundAnchorB=function(){return this.m_groundAnchorB},n.GetLengthA=function(){return this.m_lengthA},n.GetLengthB=function(){return this.m_lengthB},n.GetRatio=function(){return this.m_ratio},n.GetCurrentLengthA=function(){var t=this.m_bodyA.GetWorldPoint(this.m_localAnchorA,e.GetCurrentLengthA_s_p),i=this.m_groundAnchorA;return bt.DistanceVV(t,i)},n.GetCurrentLengthB=function(){var t=this.m_bodyB.GetWorldPoint(this.m_localAnchorB,e.GetCurrentLengthB_s_p),i=this.m_groundAnchorB;return bt.DistanceVV(t,i)},n.Dump=function(t){var e=this.m_bodyA.m_islandIndex,i=this.m_bodyB.m_islandIndex;t(" const jd: b2PulleyJointDef = new b2PulleyJointDef();\n"),t(" jd.bodyA = bodies[%d];\n",e),t(" jd.bodyB = bodies[%d];\n",i),t(" jd.collideConnected = %s;\n",this.m_collideConnected?"true":"false"),t(" jd.groundAnchorA.Set(%.15f, %.15f);\n",this.m_groundAnchorA.x,this.m_groundAnchorA.y),t(" jd.groundAnchorB.Set(%.15f, %.15f);\n",this.m_groundAnchorB.x,this.m_groundAnchorB.y),t(" jd.localAnchorA.Set(%.15f, %.15f);\n",this.m_localAnchorA.x,this.m_localAnchorA.y),t(" jd.localAnchorB.Set(%.15f, %.15f);\n",this.m_localAnchorB.x,this.m_localAnchorB.y),t(" jd.lengthA = %.15f;\n",this.m_lengthA),t(" jd.lengthB = %.15f;\n",this.m_lengthB),t(" jd.ratio = %.15f;\n",this.m_ratio),t(" joints[%d] = this.m_world.CreateJoint(jd);\n",this.m_index)},n.ShiftOrigin=function(t){this.m_groundAnchorA.SelfSub(t),this.m_groundAnchorB.SelfSub(t)},e}(bn);Un.InitVelocityConstraints_s_PA=new bt,Un.InitVelocityConstraints_s_PB=new bt,Un.SolveVelocityConstraints_s_vpA=new bt,Un.SolveVelocityConstraints_s_vpB=new bt,Un.SolveVelocityConstraints_s_PA=new bt,Un.SolveVelocityConstraints_s_PB=new bt,Un.SolvePositionConstraints_s_PA=new bt,Un.SolvePositionConstraints_s_PB=new bt,Un.GetCurrentLengthA_s_p=new bt,Un.GetCurrentLengthB_s_p=new bt;var zn=function(e){function i(){var i;return(i=e.call(this,t.b2JointType.e_revoluteJoint)||this).localAnchorA=new bt(0,0),i.localAnchorB=new bt(0,0),i.referenceAngle=0,i.enableLimit=!1,i.lowerAngle=0,i.upperAngle=0,i.enableMotor=!1,i.motorSpeed=0,i.maxMotorTorque=0,i}return s(i,e),i.prototype.Initialize=function(t,e,i){this.bodyA=t,this.bodyB=e,this.bodyA.GetLocalPoint(i,this.localAnchorA),this.bodyB.GetLocalPoint(i,this.localAnchorB),this.referenceAngle=this.bodyB.GetAngle()-this.bodyA.GetAngle()},i}(En),Hn=function(e){function n(n){var r;return(r=e.call(this,n)||this).m_localAnchorA=new bt,r.m_localAnchorB=new bt,r.m_impulse=new Ct,r.m_motorImpulse=0,r.m_enableMotor=!1,r.m_maxMotorTorque=0,r.m_motorSpeed=0,r.m_enableLimit=!1,r.m_referenceAngle=0,r.m_lowerAngle=0,r.m_upperAngle=0,r.m_indexA=0,r.m_indexB=0,r.m_rA=new bt,r.m_rB=new bt,r.m_localCenterA=new bt,r.m_localCenterB=new bt,r.m_invMassA=0,r.m_invMassB=0,r.m_invIA=0,r.m_invIB=0,r.m_mass=new wt,r.m_motorMass=0,r.m_limitState=t.b2LimitState.e_inactiveLimit,r.m_qA=new It,r.m_qB=new It,r.m_lalcA=new bt,r.m_lalcB=new bt,r.m_K=new Rt,r.m_localAnchorA.Copy(i(n.localAnchorA,bt.ZERO)),r.m_localAnchorB.Copy(i(n.localAnchorB,bt.ZERO)),r.m_referenceAngle=i(n.referenceAngle,0),r.m_impulse.SetZero(),r.m_motorImpulse=0,r.m_lowerAngle=i(n.lowerAngle,0),r.m_upperAngle=i(n.upperAngle,0),r.m_maxMotorTorque=i(n.maxMotorTorque,0),r.m_motorSpeed=i(n.motorSpeed,0),r.m_enableLimit=i(n.enableLimit,!1),r.m_enableMotor=i(n.enableMotor,!1),r.m_limitState=t.b2LimitState.e_inactiveLimit,r}s(n,e);var r=n.prototype;return r.InitVelocityConstraints=function(e){this.m_indexA=this.m_bodyA.m_islandIndex,this.m_indexB=this.m_bodyB.m_islandIndex,this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter),this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter),this.m_invMassA=this.m_bodyA.m_invMass,this.m_invMassB=this.m_bodyB.m_invMass,this.m_invIA=this.m_bodyA.m_invI,this.m_invIB=this.m_bodyB.m_invI;var i=e.positions[this.m_indexA].a,r=e.velocities[this.m_indexA].v,s=e.velocities[this.m_indexA].w,a=e.positions[this.m_indexB].a,o=e.velocities[this.m_indexB].v,h=e.velocities[this.m_indexB].w,u=this.m_qA.SetAngle(i),l=this.m_qB.SetAngle(a);bt.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA),It.MulRV(u,this.m_lalcA,this.m_rA),bt.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB),It.MulRV(l,this.m_lalcB,this.m_rB);var c=this.m_invMassA,_=this.m_invMassB,f=this.m_invIA,d=this.m_invIB,p=f+d===0;if(this.m_mass.ex.x=c+_+this.m_rA.y*this.m_rA.y*f+this.m_rB.y*this.m_rB.y*d,this.m_mass.ey.x=-this.m_rA.y*this.m_rA.x*f-this.m_rB.y*this.m_rB.x*d,this.m_mass.ez.x=-this.m_rA.y*f-this.m_rB.y*d,this.m_mass.ex.y=this.m_mass.ey.x,this.m_mass.ey.y=c+_+this.m_rA.x*this.m_rA.x*f+this.m_rB.x*this.m_rB.x*d,this.m_mass.ez.y=this.m_rA.x*f+this.m_rB.x*d,this.m_mass.ex.z=this.m_mass.ez.x,this.m_mass.ey.z=this.m_mass.ez.y,this.m_mass.ez.z=f+d,this.m_motorMass=f+d,this.m_motorMass>0&&(this.m_motorMass=1/this.m_motorMass),this.m_enableMotor&&!p||(this.m_motorImpulse=0),this.m_enableLimit&&!p){var g=a-i-this.m_referenceAngle;nt(this.m_upperAngle-this.m_lowerAngle)<2*m?this.m_limitState=t.b2LimitState.e_equalLimits:g<=this.m_lowerAngle?(this.m_limitState!==t.b2LimitState.e_atLowerLimit&&(this.m_impulse.z=0),this.m_limitState=t.b2LimitState.e_atLowerLimit):g>=this.m_upperAngle?(this.m_limitState!==t.b2LimitState.e_atUpperLimit&&(this.m_impulse.z=0),this.m_limitState=t.b2LimitState.e_atUpperLimit):(this.m_limitState=t.b2LimitState.e_inactiveLimit,this.m_impulse.z=0)}else this.m_limitState=t.b2LimitState.e_inactiveLimit;if(e.step.warmStarting){this.m_impulse.SelfMul(e.step.dtRatio),this.m_motorImpulse*=e.step.dtRatio;var y=n.InitVelocityConstraints_s_P.Set(this.m_impulse.x,this.m_impulse.y);r.SelfMulSub(c,y),s-=f*(bt.CrossVV(this.m_rA,y)+this.m_motorImpulse+this.m_impulse.z),o.SelfMulAdd(_,y),h+=d*(bt.CrossVV(this.m_rB,y)+this.m_motorImpulse+this.m_impulse.z)}else this.m_impulse.SetZero(),this.m_motorImpulse=0;e.velocities[this.m_indexA].w=s,e.velocities[this.m_indexB].w=h},r.SolveVelocityConstraints=function(e){var i=e.velocities[this.m_indexA].v,r=e.velocities[this.m_indexA].w,s=e.velocities[this.m_indexB].v,a=e.velocities[this.m_indexB].w,o=this.m_invMassA,h=this.m_invMassB,u=this.m_invIA,l=this.m_invIB,c=u+l===0;if(this.m_enableMotor&&this.m_limitState!==t.b2LimitState.e_equalLimits&&!c){var _=a-r-this.m_motorSpeed,f=-this.m_motorMass*_,d=this.m_motorImpulse,p=e.step.dt*this.m_maxMotorTorque;this.m_motorImpulse=at(this.m_motorImpulse+f,-p,p),r-=u*(f=this.m_motorImpulse-d),a+=l*f}if(this.m_enableLimit&&this.m_limitState!==t.b2LimitState.e_inactiveLimit&&!c){var m=bt.SubVV(bt.AddVCrossSV(s,a,this.m_rB,bt.s_t0),bt.AddVCrossSV(i,r,this.m_rA,bt.s_t1),n.SolveVelocityConstraints_s_Cdot1),g=a-r,y=this.m_mass.Solve33(m.x,m.y,g,n.SolveVelocityConstraints_s_impulse_v3).SelfNeg();if(this.m_limitState===t.b2LimitState.e_equalLimits)this.m_impulse.SelfAdd(y);else if(this.m_limitState===t.b2LimitState.e_atLowerLimit)if(this.m_impulse.z+y.z<0){var v=-m.x+this.m_impulse.z*this.m_mass.ez.x,S=-m.y+this.m_impulse.z*this.m_mass.ez.y,A=this.m_mass.Solve22(v,S,n.SolveVelocityConstraints_s_reduced_v2);y.x=A.x,y.y=A.y,y.z=-this.m_impulse.z,this.m_impulse.x+=A.x,this.m_impulse.y+=A.y,this.m_impulse.z=0}else this.m_impulse.SelfAdd(y);else if(this.m_limitState===t.b2LimitState.e_atUpperLimit)if(this.m_impulse.z+y.z>0){var T=-m.x+this.m_impulse.z*this.m_mass.ez.x,E=-m.y+this.m_impulse.z*this.m_mass.ez.y,b=this.m_mass.Solve22(T,E,n.SolveVelocityConstraints_s_reduced_v2);y.x=b.x,y.y=b.y,y.z=-this.m_impulse.z,this.m_impulse.x+=b.x,this.m_impulse.y+=b.y,this.m_impulse.z=0}else this.m_impulse.SelfAdd(y);var x=n.SolveVelocityConstraints_s_P.Set(y.x,y.y);i.SelfMulSub(o,x),r-=u*(bt.CrossVV(this.m_rA,x)+y.z),s.SelfMulAdd(h,x),a+=l*(bt.CrossVV(this.m_rB,x)+y.z)}else{var C=bt.SubVV(bt.AddVCrossSV(s,a,this.m_rB,bt.s_t0),bt.AddVCrossSV(i,r,this.m_rA,bt.s_t1),n.SolveVelocityConstraints_s_Cdot_v2),R=this.m_mass.Solve22(-C.x,-C.y,n.SolveVelocityConstraints_s_impulse_v2);this.m_impulse.x+=R.x,this.m_impulse.y+=R.y,i.SelfMulSub(o,R),r-=u*bt.CrossVV(this.m_rA,R),s.SelfMulAdd(h,R),a+=l*bt.CrossVV(this.m_rB,R)}e.velocities[this.m_indexA].w=r,e.velocities[this.m_indexB].w=a},r.SolvePositionConstraints=function(e){var i=e.positions[this.m_indexA].c,r=e.positions[this.m_indexA].a,s=e.positions[this.m_indexB].c,a=e.positions[this.m_indexB].a,o=this.m_qA.SetAngle(r),h=this.m_qB.SetAngle(a),u=0,l=0,c=this.m_invIA+this.m_invIB===0;if(this.m_enableLimit&&this.m_limitState!==t.b2LimitState.e_inactiveLimit&&!c){var _=a-r-this.m_referenceAngle,f=0;if(this.m_limitState===t.b2LimitState.e_equalLimits){var d=at(_-this.m_lowerAngle,-T,T);f=-this.m_motorMass*d,u=nt(d)}else if(this.m_limitState===t.b2LimitState.e_atLowerLimit){var g=_-this.m_lowerAngle;u=-g,g=at(g+m,-T,0),f=-this.m_motorMass*g}else if(this.m_limitState===t.b2LimitState.e_atUpperLimit){var y=_-this.m_upperAngle;u=y,y=at(y-m,0,T),f=-this.m_motorMass*y}r-=this.m_invIA*f,a+=this.m_invIB*f}o.SetAngle(r),h.SetAngle(a),bt.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var v=It.MulRV(o,this.m_lalcA,this.m_rA);bt.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var S=It.MulRV(h,this.m_lalcB,this.m_rB),A=bt.SubVV(bt.AddVV(s,S,bt.s_t0),bt.AddVV(i,v,bt.s_t1),n.SolvePositionConstraints_s_C_v2);l=A.Length();var E=this.m_invMassA,b=this.m_invMassB,x=this.m_invIA,C=this.m_invIB,R=this.m_K;R.ex.x=E+b+x*v.y*v.y+C*S.y*S.y,R.ex.y=-x*v.x*v.y-C*S.x*S.y,R.ey.x=R.ex.y,R.ey.y=E+b+x*v.x*v.x+C*S.x*S.x;var w=R.Solve(A.x,A.y,n.SolvePositionConstraints_s_impulse).SelfNeg();return i.SelfMulSub(E,w),r-=x*bt.CrossVV(v,w),s.SelfMulAdd(b,w),a+=C*bt.CrossVV(S,w),e.positions[this.m_indexA].a=r,e.positions[this.m_indexB].a=a,l<=p&&u<=m},r.GetAnchorA=function(t){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA,t)},r.GetAnchorB=function(t){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB,t)},r.GetReactionForce=function(t,e){return e.x=t*this.m_impulse.x,e.y=t*this.m_impulse.y,e},r.GetReactionTorque=function(t){return t*this.m_impulse.z},r.GetLocalAnchorA=function(){return this.m_localAnchorA},r.GetLocalAnchorB=function(){return this.m_localAnchorB},r.GetReferenceAngle=function(){return this.m_referenceAngle},r.GetJointAngle=function(){return this.m_bodyB.m_sweep.a-this.m_bodyA.m_sweep.a-this.m_referenceAngle},r.GetJointSpeed=function(){return this.m_bodyB.m_angularVelocity-this.m_bodyA.m_angularVelocity},r.IsMotorEnabled=function(){return this.m_enableMotor},r.EnableMotor=function(t){t!==this.m_enableMotor&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_enableMotor=t)},r.GetMotorTorque=function(t){return t*this.m_motorImpulse},r.GetMotorSpeed=function(){return this.m_motorSpeed},r.SetMaxMotorTorque=function(t){t!==this.m_maxMotorTorque&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_maxMotorTorque=t)},r.GetMaxMotorTorque=function(){return this.m_maxMotorTorque},r.IsLimitEnabled=function(){return this.m_enableLimit},r.EnableLimit=function(t){t!==this.m_enableLimit&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_enableLimit=t,this.m_impulse.z=0)},r.GetLowerLimit=function(){return this.m_lowerAngle},r.GetUpperLimit=function(){return this.m_upperAngle},r.SetLimits=function(t,e){t===this.m_lowerAngle&&e===this.m_upperAngle||(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_impulse.z=0,this.m_lowerAngle=t,this.m_upperAngle=e)},r.SetMotorSpeed=function(t){t!==this.m_motorSpeed&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_motorSpeed=t)},r.Dump=function(t){var e=this.m_bodyA.m_islandIndex,i=this.m_bodyB.m_islandIndex;t(" const jd: b2RevoluteJointDef = new b2RevoluteJointDef();\n"),t(" jd.bodyA = bodies[%d];\n",e),t(" jd.bodyB = bodies[%d];\n",i),t(" jd.collideConnected = %s;\n",this.m_collideConnected?"true":"false"),t(" jd.localAnchorA.Set(%.15f, %.15f);\n",this.m_localAnchorA.x,this.m_localAnchorA.y),t(" jd.localAnchorB.Set(%.15f, %.15f);\n",this.m_localAnchorB.x,this.m_localAnchorB.y),t(" jd.referenceAngle = %.15f;\n",this.m_referenceAngle),t(" jd.enableLimit = %s;\n",this.m_enableLimit?"true":"false"),t(" jd.lowerAngle = %.15f;\n",this.m_lowerAngle),t(" jd.upperAngle = %.15f;\n",this.m_upperAngle),t(" jd.enableMotor = %s;\n",this.m_enableMotor?"true":"false"),t(" jd.motorSpeed = %.15f;\n",this.m_motorSpeed),t(" jd.maxMotorTorque = %.15f;\n",this.m_maxMotorTorque),t(" joints[%d] = this.m_world.CreateJoint(jd);\n",this.m_index)},n}(bn);Hn.InitVelocityConstraints_s_P=new bt,Hn.SolveVelocityConstraints_s_P=new bt,Hn.SolveVelocityConstraints_s_Cdot_v2=new bt,Hn.SolveVelocityConstraints_s_Cdot1=new bt,Hn.SolveVelocityConstraints_s_impulse_v3=new Ct,Hn.SolveVelocityConstraints_s_reduced_v2=new bt,Hn.SolveVelocityConstraints_s_impulse_v2=new bt,Hn.SolvePositionConstraints_s_C_v2=new bt,Hn.SolvePositionConstraints_s_impulse=new bt;var Wn=function(e){function i(){var i;return(i=e.call(this,t.b2JointType.e_ropeJoint)||this).localAnchorA=new bt(-1,0),i.localAnchorB=new bt(1,0),i.maxLength=0,i}return s(i,e),i}(En),Xn=function(e){function n(n){var r;return(r=e.call(this,n)||this).m_localAnchorA=new bt,r.m_localAnchorB=new bt,r.m_maxLength=0,r.m_length=0,r.m_impulse=0,r.m_indexA=0,r.m_indexB=0,r.m_u=new bt,r.m_rA=new bt,r.m_rB=new bt,r.m_localCenterA=new bt,r.m_localCenterB=new bt,r.m_invMassA=0,r.m_invMassB=0,r.m_invIA=0,r.m_invIB=0,r.m_mass=0,r.m_state=t.b2LimitState.e_inactiveLimit,r.m_qA=new It,r.m_qB=new It,r.m_lalcA=new bt,r.m_lalcB=new bt,r.m_localAnchorA.Copy(i(n.localAnchorA,new bt(-1,0))),r.m_localAnchorB.Copy(i(n.localAnchorB,new bt(1,0))),r.m_maxLength=i(n.maxLength,0),r}s(n,e);var r=n.prototype;return r.InitVelocityConstraints=function(e){this.m_indexA=this.m_bodyA.m_islandIndex,this.m_indexB=this.m_bodyB.m_islandIndex,this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter),this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter),this.m_invMassA=this.m_bodyA.m_invMass,this.m_invMassB=this.m_bodyB.m_invMass,this.m_invIA=this.m_bodyA.m_invI,this.m_invIB=this.m_bodyB.m_invI;var i=e.positions[this.m_indexA].c,r=e.positions[this.m_indexA].a,s=e.velocities[this.m_indexA].v,a=e.velocities[this.m_indexA].w,o=e.positions[this.m_indexB].c,h=e.positions[this.m_indexB].a,u=e.velocities[this.m_indexB].v,l=e.velocities[this.m_indexB].w,c=this.m_qA.SetAngle(r),_=this.m_qB.SetAngle(h);bt.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA),It.MulRV(c,this.m_lalcA,this.m_rA),bt.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB),It.MulRV(_,this.m_lalcB,this.m_rB),this.m_u.Copy(o).SelfAdd(this.m_rB).SelfSub(i).SelfSub(this.m_rA),this.m_length=this.m_u.Length();var f=this.m_length-this.m_maxLength;if(this.m_state=f>0?t.b2LimitState.e_atUpperLimit:t.b2LimitState.e_inactiveLimit,!(this.m_length>p))return this.m_u.SetZero(),this.m_mass=0,void(this.m_impulse=0);this.m_u.SelfMul(1/this.m_length);var d=bt.CrossVV(this.m_rA,this.m_u),m=bt.CrossVV(this.m_rB,this.m_u),g=this.m_invMassA+this.m_invIA*d*d+this.m_invMassB+this.m_invIB*m*m;if(this.m_mass=0!==g?1/g:0,e.step.warmStarting){this.m_impulse*=e.step.dtRatio;var y=bt.MulSV(this.m_impulse,this.m_u,n.InitVelocityConstraints_s_P);s.SelfMulSub(this.m_invMassA,y),a-=this.m_invIA*bt.CrossVV(this.m_rA,y),u.SelfMulAdd(this.m_invMassB,y),l+=this.m_invIB*bt.CrossVV(this.m_rB,y)}else this.m_impulse=0;e.velocities[this.m_indexA].w=a,e.velocities[this.m_indexB].w=l},r.SolveVelocityConstraints=function(t){var e=t.velocities[this.m_indexA].v,i=t.velocities[this.m_indexA].w,r=t.velocities[this.m_indexB].v,s=t.velocities[this.m_indexB].w,a=bt.AddVCrossSV(e,i,this.m_rA,n.SolveVelocityConstraints_s_vpA),o=bt.AddVCrossSV(r,s,this.m_rB,n.SolveVelocityConstraints_s_vpB),h=this.m_length-this.m_maxLength,u=bt.DotVV(this.m_u,bt.SubVV(o,a,bt.s_t0));h<0&&(u+=t.step.inv_dt*h);var l=-this.m_mass*u,c=this.m_impulse;this.m_impulse=rt(0,this.m_impulse+l),l=this.m_impulse-c;var _=bt.MulSV(l,this.m_u,n.SolveVelocityConstraints_s_P);e.SelfMulSub(this.m_invMassA,_),i-=this.m_invIA*bt.CrossVV(this.m_rA,_),r.SelfMulAdd(this.m_invMassB,_),s+=this.m_invIB*bt.CrossVV(this.m_rB,_),t.velocities[this.m_indexA].w=i,t.velocities[this.m_indexB].w=s},r.SolvePositionConstraints=function(t){var e=t.positions[this.m_indexA].c,i=t.positions[this.m_indexA].a,r=t.positions[this.m_indexB].c,s=t.positions[this.m_indexB].a,a=this.m_qA.SetAngle(i),o=this.m_qB.SetAngle(s);bt.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var h=It.MulRV(a,this.m_lalcA,this.m_rA);bt.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var u=It.MulRV(o,this.m_lalcB,this.m_rB),l=this.m_u.Copy(r).SelfAdd(u).SelfSub(e).SelfSub(h),c=l.Normalize(),_=c-this.m_maxLength;_=at(_,0,A);var f=-this.m_mass*_,d=bt.MulSV(f,l,n.SolvePositionConstraints_s_P);return e.SelfMulSub(this.m_invMassA,d),i-=this.m_invIA*bt.CrossVV(h,d),r.SelfMulAdd(this.m_invMassB,d),s+=this.m_invIB*bt.CrossVV(u,d),t.positions[this.m_indexA].a=i,t.positions[this.m_indexB].a=s,c-this.m_maxLength<p},r.GetAnchorA=function(t){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA,t)},r.GetAnchorB=function(t){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB,t)},r.GetReactionForce=function(t,e){return bt.MulSV(t*this.m_impulse,this.m_u,e)},r.GetReactionTorque=function(){return 0},r.GetLocalAnchorA=function(){return this.m_localAnchorA},r.GetLocalAnchorB=function(){return this.m_localAnchorB},r.SetMaxLength=function(t){this.m_maxLength=t},r.GetMaxLength=function(){return this.m_maxLength},r.GetLimitState=function(){return this.m_state},r.Dump=function(t){var e=this.m_bodyA.m_islandIndex,i=this.m_bodyB.m_islandIndex;t(" const jd: b2RopeJointDef = new b2RopeJointDef();\n"),t(" jd.bodyA = bodies[%d];\n",e),t(" jd.bodyB = bodies[%d];\n",i),t(" jd.collideConnected = %s;\n",this.m_collideConnected?"true":"false"),t(" jd.localAnchorA.Set(%.15f, %.15f);\n",this.m_localAnchorA.x,this.m_localAnchorA.y),t(" jd.localAnchorB.Set(%.15f, %.15f);\n",this.m_localAnchorB.x,this.m_localAnchorB.y),t(" jd.maxLength = %.15f;\n",this.m_maxLength),t(" joints[%d] = this.m_world.CreateJoint(jd);\n",this.m_index)},n}(bn);Xn.InitVelocityConstraints_s_P=new bt,Xn.SolveVelocityConstraints_s_vpA=new bt,Xn.SolveVelocityConstraints_s_vpB=new bt,Xn.SolveVelocityConstraints_s_P=new bt,Xn.SolvePositionConstraints_s_P=new bt;var jn=function(e){function i(){var i;return(i=e.call(this,t.b2JointType.e_weldJoint)||this).localAnchorA=new bt,i.localAnchorB=new bt,i.referenceAngle=0,i.frequencyHz=0,i.dampingRatio=0,i}return s(i,e),i.prototype.Initialize=function(t,e,i){this.bodyA=t,this.bodyB=e,this.bodyA.GetLocalPoint(i,this.localAnchorA),this.bodyB.GetLocalPoint(i,this.localAnchorB),this.referenceAngle=this.bodyB.GetAngle()-this.bodyA.GetAngle()},i}(En),Yn=function(t){function e(e){var n;return(n=t.call(this,e)||this).m_frequencyHz=0,n.m_dampingRatio=0,n.m_bias=0,n.m_localAnchorA=new bt,n.m_localAnchorB=new bt,n.m_referenceAngle=0,n.m_gamma=0,n.m_impulse=new Ct(0,0,0),n.m_indexA=0,n.m_indexB=0,n.m_rA=new bt,n.m_rB=new bt,n.m_localCenterA=new bt,n.m_localCenterB=new bt,n.m_invMassA=0,n.m_invMassB=0,n.m_invIA=0,n.m_invIB=0,n.m_mass=new wt,n.m_qA=new It,n.m_qB=new It,n.m_lalcA=new bt,n.m_lalcB=new bt,n.m_K=new wt,n.m_frequencyHz=i(e.frequencyHz,0),n.m_dampingRatio=i(e.dampingRatio,0),n.m_localAnchorA.Copy(i(e.localAnchorA,bt.ZERO)),n.m_localAnchorB.Copy(i(e.localAnchorB,bt.ZERO)),n.m_referenceAngle=i(e.referenceAngle,0),n.m_impulse.SetZero(),n}s(e,t);var n=e.prototype;return n.InitVelocityConstraints=function(t){this.m_indexA=this.m_bodyA.m_islandIndex,this.m_indexB=this.m_bodyB.m_islandIndex,this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter),this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter),this.m_invMassA=this.m_bodyA.m_invMass,this.m_invMassB=this.m_bodyB.m_invMass,this.m_invIA=this.m_bodyA.m_invI,this.m_invIB=this.m_bodyB.m_invI;var i=t.positions[this.m_indexA].a,n=t.velocities[this.m_indexA].v,r=t.velocities[this.m_indexA].w,s=t.positions[this.m_indexB].a,a=t.velocities[this.m_indexB].v,o=t.velocities[this.m_indexB].w,u=this.m_qA.SetAngle(i),l=this.m_qB.SetAngle(s);bt.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA),It.MulRV(u,this.m_lalcA,this.m_rA),bt.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB),It.MulRV(l,this.m_lalcB,this.m_rB);var c=this.m_invMassA,_=this.m_invMassB,f=this.m_invIA,d=this.m_invIB,p=this.m_K;if(p.ex.x=c+_+this.m_rA.y*this.m_rA.y*f+this.m_rB.y*this.m_rB.y*d,p.ey.x=-this.m_rA.y*this.m_rA.x*f-this.m_rB.y*this.m_rB.x*d,p.ez.x=-this.m_rA.y*f-this.m_rB.y*d,p.ex.y=p.ey.x,p.ey.y=c+_+this.m_rA.x*this.m_rA.x*f+this.m_rB.x*this.m_rB.x*d,p.ez.y=this.m_rA.x*f+this.m_rB.x*d,p.ex.z=p.ez.x,p.ey.z=p.ez.y,p.ez.z=f+d,this.m_frequencyHz>0){p.GetInverse22(this.m_mass);var m=f+d,g=m>0?1/m:0,y=s-i-this.m_referenceAngle,v=2*h*this.m_frequencyHz,S=2*g*this.m_dampingRatio*v,A=g*v*v,T=t.step.dt;this.m_gamma=T*(S+T*A),this.m_gamma=0!==this.m_gamma?1/this.m_gamma:0,this.m_bias=y*T*A*this.m_gamma,m+=this.m_gamma,this.m_mass.ez.z=0!==m?1/m:0}else p.GetSymInverse33(this.m_mass),this.m_gamma=0,this.m_bias=0;if(t.step.warmStarting){this.m_impulse.SelfMul(t.step.dtRatio);var E=e.InitVelocityConstraints_s_P.Set(this.m_impulse.x,this.m_impulse.y);n.SelfMulSub(c,E),r-=f*(bt.CrossVV(this.m_rA,E)+this.m_impulse.z),a.SelfMulAdd(_,E),o+=d*(bt.CrossVV(this.m_rB,E)+this.m_impulse.z)}else this.m_impulse.SetZero();t.velocities[this.m_indexA].w=r,t.velocities[this.m_indexB].w=o},n.SolveVelocityConstraints=function(t){var i=t.velocities[this.m_indexA].v,n=t.velocities[this.m_indexA].w,r=t.velocities[this.m_indexB].v,s=t.velocities[this.m_indexB].w,a=this.m_invMassA,o=this.m_invMassB,h=this.m_invIA,u=this.m_invIB;if(this.m_frequencyHz>0){var l=s-n,c=-this.m_mass.ez.z*(l+this.m_bias+this.m_gamma*this.m_impulse.z);this.m_impulse.z+=c,n-=h*c,s+=u*c;var _=bt.SubVV(bt.AddVCrossSV(r,s,this.m_rB,bt.s_t0),bt.AddVCrossSV(i,n,this.m_rA,bt.s_t1),e.SolveVelocityConstraints_s_Cdot1),f=wt.MulM33XY(this.m_mass,_.x,_.y,e.SolveVelocityConstraints_s_impulse1).SelfNeg();this.m_impulse.x+=f.x,this.m_impulse.y+=f.y;var d=f;i.SelfMulSub(a,d),n-=h*bt.CrossVV(this.m_rA,d),r.SelfMulAdd(o,d),s+=u*bt.CrossVV(this.m_rB,d)}else{var p=bt.SubVV(bt.AddVCrossSV(r,s,this.m_rB,bt.s_t0),bt.AddVCrossSV(i,n,this.m_rA,bt.s_t1),e.SolveVelocityConstraints_s_Cdot1),m=s-n,g=wt.MulM33XYZ(this.m_mass,p.x,p.y,m,e.SolveVelocityConstraints_s_impulse).SelfNeg();this.m_impulse.SelfAdd(g);var y=e.SolveVelocityConstraints_s_P.Set(g.x,g.y);i.SelfMulSub(a,y),n-=h*(bt.CrossVV(this.m_rA,y)+g.z),r.SelfMulAdd(o,y),s+=u*(bt.CrossVV(this.m_rB,y)+g.z)}t.velocities[this.m_indexA].w=n,t.velocities[this.m_indexB].w=s},n.SolvePositionConstraints=function(t){var i=t.positions[this.m_indexA].c,n=t.positions[this.m_indexA].a,r=t.positions[this.m_indexB].c,s=t.positions[this.m_indexB].a,a=this.m_qA.SetAngle(n),o=this.m_qB.SetAngle(s),h=this.m_invMassA,u=this.m_invMassB,l=this.m_invIA,c=this.m_invIB;bt.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var _=It.MulRV(a,this.m_lalcA,this.m_rA);bt.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var f,d,g=It.MulRV(o,this.m_lalcB,this.m_rB),y=this.m_K;if(y.ex.x=h+u+_.y*_.y*l+g.y*g.y*c,y.ey.x=-_.y*_.x*l-g.y*g.x*c,y.ez.x=-_.y*l-g.y*c,y.ex.y=y.ey.x,y.ey.y=h+u+_.x*_.x*l+g.x*g.x*c,y.ez.y=_.x*l+g.x*c,y.ex.z=y.ez.x,y.ey.z=y.ez.y,y.ez.z=l+c,this.m_frequencyHz>0){var v=bt.SubVV(bt.AddVV(r,g,bt.s_t0),bt.AddVV(i,_,bt.s_t1),e.SolvePositionConstraints_s_C1);f=v.Length(),d=0;var S=y.Solve22(v.x,v.y,e.SolvePositionConstraints_s_P).SelfNeg();i.SelfMulSub(h,S),n-=l*bt.CrossVV(_,S),r.SelfMulAdd(u,S),s+=c*bt.CrossVV(g,S)}else{var A=bt.SubVV(bt.AddVV(r,g,bt.s_t0),bt.AddVV(i,_,bt.s_t1),e.SolvePositionConstraints_s_C1),T=s-n-this.m_referenceAngle;f=A.Length(),d=nt(T);var E=y.Solve33(A.x,A.y,T,e.SolvePositionConstraints_s_impulse).SelfNeg(),b=e.SolvePositionConstraints_s_P.Set(E.x,E.y);i.SelfMulSub(h,b),n-=l*(bt.CrossVV(this.m_rA,b)+E.z),r.SelfMulAdd(u,b),s+=c*(bt.CrossVV(this.m_rB,b)+E.z)}return t.positions[this.m_indexA].a=n,t.positions[this.m_indexB].a=s,f<=p&&d<=m},n.GetAnchorA=function(t){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA,t)},n.GetAnchorB=function(t){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB,t)},n.GetReactionForce=function(t,e){return e.x=t*this.m_impulse.x,e.y=t*this.m_impulse.y,e},n.GetReactionTorque=function(t){return t*this.m_impulse.z},n.GetLocalAnchorA=function(){return this.m_localAnchorA},n.GetLocalAnchorB=function(){return this.m_localAnchorB},n.GetReferenceAngle=function(){return this.m_referenceAngle},n.SetFrequency=function(t){this.m_frequencyHz=t},n.GetFrequency=function(){return this.m_frequencyHz},n.SetDampingRatio=function(t){this.m_dampingRatio=t},n.GetDampingRatio=function(){return this.m_dampingRatio},n.Dump=function(t){var e=this.m_bodyA.m_islandIndex,i=this.m_bodyB.m_islandIndex;t(" const jd: b2WeldJointDef = new b2WeldJointDef();\n"),t(" jd.bodyA = bodies[%d];\n",e),t(" jd.bodyB = bodies[%d];\n",i),t(" jd.collideConnected = %s;\n",this.m_collideConnected?"true":"false"),t(" jd.localAnchorA.Set(%.15f, %.15f);\n",this.m_localAnchorA.x,this.m_localAnchorA.y),t(" jd.localAnchorB.Set(%.15f, %.15f);\n",this.m_localAnchorB.x,this.m_localAnchorB.y),t(" jd.referenceAngle = %.15f;\n",this.m_referenceAngle),t(" jd.frequencyHz = %.15f;\n",this.m_frequencyHz),t(" jd.dampingRatio = %.15f;\n",this.m_dampingRatio),t(" joints[%d] = this.m_world.CreateJoint(jd);\n",this.m_index)},e}(bn);Yn.InitVelocityConstraints_s_P=new bt,Yn.SolveVelocityConstraints_s_Cdot1=new bt,Yn.SolveVelocityConstraints_s_impulse1=new bt,Yn.SolveVelocityConstraints_s_impulse=new Ct,Yn.SolveVelocityConstraints_s_P=new bt,Yn.SolvePositionConstraints_s_C1=new bt,Yn.SolvePositionConstraints_s_P=new bt,Yn.SolvePositionConstraints_s_impulse=new Ct;var qn=function(e){function i(){var i;return(i=e.call(this,t.b2JointType.e_wheelJoint)||this).localAnchorA=new bt(0,0),i.localAnchorB=new bt(0,0),i.localAxisA=new bt(1,0),i.enableMotor=!1,i.maxMotorTorque=0,i.motorSpeed=0,i.frequencyHz=2,i.dampingRatio=.7,i}return s(i,e),i.prototype.Initialize=function(t,e,i,n){this.bodyA=t,this.bodyB=e,this.bodyA.GetLocalPoint(i,this.localAnchorA),this.bodyB.GetLocalPoint(i,this.localAnchorB),this.bodyA.GetLocalVector(n,this.localAxisA)},i}(En),Kn=function(t){function e(e){var n;return(n=t.call(this,e)||this).m_frequencyHz=0,n.m_dampingRatio=0,n.m_localAnchorA=new bt,n.m_localAnchorB=new bt,n.m_localXAxisA=new bt,n.m_localYAxisA=new bt,n.m_impulse=0,n.m_motorImpulse=0,n.m_springImpulse=0,n.m_maxMotorTorque=0,n.m_motorSpeed=0,n.m_enableMotor=!1,n.m_indexA=0,n.m_indexB=0,n.m_localCenterA=new bt,n.m_localCenterB=new bt,n.m_invMassA=0,n.m_invMassB=0,n.m_invIA=0,n.m_invIB=0,n.m_ax=new bt,n.m_ay=new bt,n.m_sAx=0,n.m_sBx=0,n.m_sAy=0,n.m_sBy=0,n.m_mass=0,n.m_motorMass=0,n.m_springMass=0,n.m_bias=0,n.m_gamma=0,n.m_qA=new It,n.m_qB=new It,n.m_lalcA=new bt,n.m_lalcB=new bt,n.m_rA=new bt,n.m_rB=new bt,n.m_frequencyHz=i(e.frequencyHz,2),n.m_dampingRatio=i(e.dampingRatio,.7),n.m_localAnchorA.Copy(i(e.localAnchorA,bt.ZERO)),n.m_localAnchorB.Copy(i(e.localAnchorB,bt.ZERO)),n.m_localXAxisA.Copy(i(e.localAxisA,bt.UNITX)),bt.CrossOneV(n.m_localXAxisA,n.m_localYAxisA),n.m_maxMotorTorque=i(e.maxMotorTorque,0),n.m_motorSpeed=i(e.motorSpeed,0),n.m_enableMotor=i(e.enableMotor,!1),n.m_ax.SetZero(),n.m_ay.SetZero(),n}s(e,t);var n=e.prototype;return n.GetMotorSpeed=function(){return this.m_motorSpeed},n.GetMaxMotorTorque=function(){return this.m_maxMotorTorque},n.SetSpringFrequencyHz=function(t){this.m_frequencyHz=t},n.GetSpringFrequencyHz=function(){return this.m_frequencyHz},n.SetSpringDampingRatio=function(t){this.m_dampingRatio=t},n.GetSpringDampingRatio=function(){return this.m_dampingRatio},n.InitVelocityConstraints=function(t){this.m_indexA=this.m_bodyA.m_islandIndex,this.m_indexB=this.m_bodyB.m_islandIndex,this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter),this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter),this.m_invMassA=this.m_bodyA.m_invMass,this.m_invMassB=this.m_bodyB.m_invMass,this.m_invIA=this.m_bodyA.m_invI,this.m_invIB=this.m_bodyB.m_invI;var i=this.m_invMassA,n=this.m_invMassB,r=this.m_invIA,s=this.m_invIB,a=t.positions[this.m_indexA].c,o=t.positions[this.m_indexA].a,u=t.velocities[this.m_indexA].v,l=t.velocities[this.m_indexA].w,c=t.positions[this.m_indexB].c,_=t.positions[this.m_indexB].a,f=t.velocities[this.m_indexB].v,d=t.velocities[this.m_indexB].w,p=this.m_qA.SetAngle(o),m=this.m_qB.SetAngle(_);bt.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var g=It.MulRV(p,this.m_lalcA,this.m_rA);bt.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var y=It.MulRV(m,this.m_lalcB,this.m_rB),v=bt.SubVV(bt.AddVV(c,y,bt.s_t0),bt.AddVV(a,g,bt.s_t1),e.InitVelocityConstraints_s_d);if(It.MulRV(p,this.m_localYAxisA,this.m_ay),this.m_sAy=bt.CrossVV(bt.AddVV(v,g,bt.s_t0),this.m_ay),this.m_sBy=bt.CrossVV(y,this.m_ay),this.m_mass=i+n+r*this.m_sAy*this.m_sAy+s*this.m_sBy*this.m_sBy,this.m_mass>0&&(this.m_mass=1/this.m_mass),this.m_springMass=0,this.m_bias=0,this.m_gamma=0,this.m_frequencyHz>0){It.MulRV(p,this.m_localXAxisA,this.m_ax),this.m_sAx=bt.CrossVV(bt.AddVV(v,g,bt.s_t0),this.m_ax),this.m_sBx=bt.CrossVV(y,this.m_ax);var S=i+n+r*this.m_sAx*this.m_sAx+s*this.m_sBx*this.m_sBx;if(S>0){this.m_springMass=1/S;var A=bt.DotVV(v,this.m_ax),T=2*h*this.m_frequencyHz,E=2*this.m_springMass*this.m_dampingRatio*T,b=this.m_springMass*T*T,x=t.step.dt;this.m_gamma=x*(E+x*b),this.m_gamma>0&&(this.m_gamma=1/this.m_gamma),this.m_bias=A*x*b*this.m_gamma,this.m_springMass=S+this.m_gamma,this.m_springMass>0&&(this.m_springMass=1/this.m_springMass)}}else this.m_springImpulse=0;if(this.m_enableMotor?(this.m_motorMass=r+s,this.m_motorMass>0&&(this.m_motorMass=1/this.m_motorMass)):(this.m_motorMass=0,this.m_motorImpulse=0),t.step.warmStarting){this.m_impulse*=t.step.dtRatio,this.m_springImpulse*=t.step.dtRatio,this.m_motorImpulse*=t.step.dtRatio;var C=bt.AddVV(bt.MulSV(this.m_impulse,this.m_ay,bt.s_t0),bt.MulSV(this.m_springImpulse,this.m_ax,bt.s_t1),e.InitVelocityConstraints_s_P),R=this.m_impulse*this.m_sAy+this.m_springImpulse*this.m_sAx+this.m_motorImpulse,w=this.m_impulse*this.m_sBy+this.m_springImpulse*this.m_sBx+this.m_motorImpulse;u.SelfMulSub(this.m_invMassA,C),l-=this.m_invIA*R,f.SelfMulAdd(this.m_invMassB,C),d+=this.m_invIB*w}else this.m_impulse=0,this.m_springImpulse=0,this.m_motorImpulse=0;t.velocities[this.m_indexA].w=l,t.velocities[this.m_indexB].w=d},n.SolveVelocityConstraints=function(t){var i=this.m_invMassA,n=this.m_invMassB,r=this.m_invIA,s=this.m_invIB,a=t.velocities[this.m_indexA].v,o=t.velocities[this.m_indexA].w,h=t.velocities[this.m_indexB].v,u=t.velocities[this.m_indexB].w,l=bt.DotVV(this.m_ax,bt.SubVV(h,a,bt.s_t0))+this.m_sBx*u-this.m_sAx*o,c=-this.m_springMass*(l+this.m_bias+this.m_gamma*this.m_springImpulse);this.m_springImpulse+=c;var _=bt.MulSV(c,this.m_ax,e.SolveVelocityConstraints_s_P),f=c*this.m_sAx,d=c*this.m_sBx;a.SelfMulSub(i,_),o-=r*f,h.SelfMulAdd(n,_);var p=(u+=s*d)-o-this.m_motorSpeed,m=-this.m_motorMass*p,g=this.m_motorImpulse,y=t.step.dt*this.m_maxMotorTorque;this.m_motorImpulse=at(this.m_motorImpulse+m,-y,y),o-=r*(m=this.m_motorImpulse-g),u+=s*m;var v=bt.DotVV(this.m_ay,bt.SubVV(h,a,bt.s_t0))+this.m_sBy*u-this.m_sAy*o,S=-this.m_mass*v;this.m_impulse+=S;var A=bt.MulSV(S,this.m_ay,e.SolveVelocityConstraints_s_P),T=S*this.m_sAy,E=S*this.m_sBy;a.SelfMulSub(i,A),o-=r*T,h.SelfMulAdd(n,A),u+=s*E,t.velocities[this.m_indexA].w=o,t.velocities[this.m_indexB].w=u},n.SolvePositionConstraints=function(t){var i=t.positions[this.m_indexA].c,n=t.positions[this.m_indexA].a,r=t.positions[this.m_indexB].c,s=t.positions[this.m_indexB].a,a=this.m_qA.SetAngle(n),o=this.m_qB.SetAngle(s);bt.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var h=It.MulRV(a,this.m_lalcA,this.m_rA);bt.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var u,l=It.MulRV(o,this.m_lalcB,this.m_rB),c=bt.AddVV(bt.SubVV(r,i,bt.s_t0),bt.SubVV(l,h,bt.s_t1),e.SolvePositionConstraints_s_d),_=It.MulRV(a,this.m_localYAxisA,this.m_ay),f=bt.CrossVV(bt.AddVV(c,h,bt.s_t0),_),d=bt.CrossVV(l,_),m=bt.DotVV(c,this.m_ay),g=this.m_invMassA+this.m_invMassB+this.m_invIA*this.m_sAy*this.m_sAy+this.m_invIB*this.m_sBy*this.m_sBy;u=0!==g?-m/g:0;var y=bt.MulSV(u,_,e.SolvePositionConstraints_s_P),v=u*f,S=u*d;return i.SelfMulSub(this.m_invMassA,y),n-=this.m_invIA*v,r.SelfMulAdd(this.m_invMassB,y),s+=this.m_invIB*S,t.positions[this.m_indexA].a=n,t.positions[this.m_indexB].a=s,nt(m)<=p},n.GetDefinition=function(t){return t},n.GetAnchorA=function(t){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA,t)},n.GetAnchorB=function(t){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB,t)},n.GetReactionForce=function(t,e){return e.x=t*(this.m_impulse*this.m_ay.x+this.m_springImpulse*this.m_ax.x),e.y=t*(this.m_impulse*this.m_ay.y+this.m_springImpulse*this.m_ax.y),e},n.GetReactionTorque=function(t){return t*this.m_motorImpulse},n.GetLocalAnchorA=function(){return this.m_localAnchorA},n.GetLocalAnchorB=function(){return this.m_localAnchorB},n.GetLocalAxisA=function(){return this.m_localXAxisA},n.GetJointTranslation=function(){return this.GetPrismaticJointTranslation()},n.GetJointLinearSpeed=function(){return this.GetPrismaticJointSpeed()},n.GetJointAngle=function(){return this.GetRevoluteJointAngle()},n.GetJointAngularSpeed=function(){return this.GetRevoluteJointSpeed()},n.GetPrismaticJointTranslation=function(){var t=this.m_bodyA,e=this.m_bodyB,i=t.GetWorldPoint(this.m_localAnchorA,new bt),n=e.GetWorldPoint(this.m_localAnchorB,new bt),r=bt.SubVV(n,i,new bt),s=t.GetWorldVector(this.m_localXAxisA,new bt);return bt.DotVV(r,s)},n.GetPrismaticJointSpeed=function(){var t=this.m_bodyA,e=this.m_bodyB;bt.SubVV(this.m_localAnchorA,t.m_sweep.localCenter,this.m_lalcA);var i=It.MulRV(t.m_xf.q,this.m_lalcA,this.m_rA);bt.SubVV(this.m_localAnchorB,e.m_sweep.localCenter,this.m_lalcB);var n=It.MulRV(e.m_xf.q,this.m_lalcB,this.m_rB),r=bt.AddVV(t.m_sweep.c,i,bt.s_t0),s=bt.AddVV(e.m_sweep.c,n,bt.s_t1),a=bt.SubVV(s,r,bt.s_t2),o=t.GetWorldVector(this.m_localXAxisA,new bt),h=t.m_linearVelocity,u=e.m_linearVelocity,l=t.m_angularVelocity,c=e.m_angularVelocity;return bt.DotVV(a,bt.CrossSV(l,o,bt.s_t0))+bt.DotVV(o,bt.SubVV(bt.AddVCrossSV(u,c,n,bt.s_t0),bt.AddVCrossSV(h,l,i,bt.s_t1),bt.s_t0))},n.GetRevoluteJointAngle=function(){return this.m_bodyB.m_sweep.a-this.m_bodyA.m_sweep.a},n.GetRevoluteJointSpeed=function(){var t=this.m_bodyA.m_angularVelocity;return this.m_bodyB.m_angularVelocity-t},n.IsMotorEnabled=function(){return this.m_enableMotor},n.EnableMotor=function(t){t!==this.m_enableMotor&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_enableMotor=t)},n.SetMotorSpeed=function(t){t!==this.m_motorSpeed&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_motorSpeed=t)},n.SetMaxMotorTorque=function(t){t!==this.m_maxMotorTorque&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_maxMotorTorque=t)},n.GetMotorTorque=function(t){return t*this.m_motorImpulse},n.Dump=function(t){var e=this.m_bodyA.m_islandIndex,i=this.m_bodyB.m_islandIndex;t(" const jd: b2WheelJointDef = new b2WheelJointDef();\n"),t(" jd.bodyA = bodies[%d];\n",e),t(" jd.bodyB = bodies[%d];\n",i),t(" jd.collideConnected = %s;\n",this.m_collideConnected?"true":"false"),t(" jd.localAnchorA.Set(%.15f, %.15f);\n",this.m_localAnchorA.x,this.m_localAnchorA.y),t(" jd.localAnchorB.Set(%.15f, %.15f);\n",this.m_localAnchorB.x,this.m_localAnchorB.y),t(" jd.localAxisA.Set(%.15f, %.15f);\n",this.m_localXAxisA.x,this.m_localXAxisA.y),t(" jd.enableMotor = %s;\n",this.m_enableMotor?"true":"false"),t(" jd.motorSpeed = %.15f;\n",this.m_motorSpeed),t(" jd.maxMotorTorque = %.15f;\n",this.m_maxMotorTorque),t(" jd.frequencyHz = %.15f;\n",this.m_frequencyHz),t(" jd.dampingRatio = %.15f;\n",this.m_dampingRatio),t(" joints[%d] = this.m_world.CreateJoint(jd);\n",this.m_index)},e}(bn);function Jn(t,e){return ct(t*e)}function Qn(t,e){return t>e?t:e}Kn.InitVelocityConstraints_s_d=new bt,Kn.InitVelocityConstraints_s_P=new bt,Kn.SolveVelocityConstraints_s_P=new bt,Kn.SolvePositionConstraints_s_d=new bt,Kn.SolvePositionConstraints_s_P=new bt;var Zn=function(){function t(t){this._other=null,this.prev=null,this.next=null,this.contact=t}return t.prototype.Reset=function(){this._other=null,this.prev=null,this.next=null},n(t,[{key:"other",get:function(){if(null===this._other)throw new Error;return this._other},set:function(t){if(null!==this._other)throw new Error;this._other=t}}]),t}(),$n=function(){function t(){this.m_islandFlag=!1,this.m_touchingFlag=!1,this.m_enabledFlag=!1,this.m_filterFlag=!1,this.m_bulletHitFlag=!1,this.m_toiFlag=!1,this.m_prev=null,this.m_next=null,this.m_nodeA=new Zn(this),this.m_nodeB=new Zn(this),this.m_indexA=0,this.m_indexB=0,this.m_manifold=new ve,this.m_toiCount=0,this.m_toi=0,this.m_friction=0,this.m_restitution=0,this.m_tangentSpeed=0,this.m_oldManifold=new ve}var e=t.prototype;return e.GetManifold=function(){return this.m_manifold},e.GetWorldManifold=function(t){var e=this.m_fixtureA.GetBody(),i=this.m_fixtureB.GetBody(),n=this.GetShapeA(),r=this.GetShapeB();t.Initialize(this.m_manifold,e.GetTransform(),n.m_radius,i.GetTransform(),r.m_radius)},e.IsTouching=function(){return this.m_touchingFlag},e.SetEnabled=function(t){this.m_enabledFlag=t},e.IsEnabled=function(){return this.m_enabledFlag},e.GetNext=function(){return this.m_next},e.GetFixtureA=function(){return this.m_fixtureA},e.GetChildIndexA=function(){return this.m_indexA},e.GetShapeA=function(){return this.m_fixtureA.GetShape()},e.GetFixtureB=function(){return this.m_fixtureB},e.GetChildIndexB=function(){return this.m_indexB},e.GetShapeB=function(){return this.m_fixtureB.GetShape()},e.FlagForFiltering=function(){this.m_filterFlag=!0},e.SetFriction=function(t){this.m_friction=t},e.GetFriction=function(){return this.m_friction},e.ResetFriction=function(){this.m_friction=Jn(this.m_fixtureA.m_friction,this.m_fixtureB.m_friction)},e.SetRestitution=function(t){this.m_restitution=t},e.GetRestitution=function(){return this.m_restitution},e.ResetRestitution=function(){this.m_restitution=Qn(this.m_fixtureA.m_restitution,this.m_fixtureB.m_restitution)},e.SetTangentSpeed=function(t){this.m_tangentSpeed=t},e.GetTangentSpeed=function(){return this.m_tangentSpeed},e.Reset=function(t,e,i,n){this.m_islandFlag=!1,this.m_touchingFlag=!1,this.m_enabledFlag=!0,this.m_filterFlag=!1,this.m_bulletHitFlag=!1,this.m_toiFlag=!1,this.m_fixtureA=t,this.m_fixtureB=i,this.m_indexA=e,this.m_indexB=n,this.m_manifold.pointCount=0,this.m_prev=null,this.m_next=null,this.m_nodeA.Reset(),this.m_nodeB.Reset(),this.m_toiCount=0,this.m_friction=Jn(this.m_fixtureA.m_friction,this.m_fixtureB.m_friction),this.m_restitution=Qn(this.m_fixtureA.m_restitution,this.m_fixtureB.m_restitution)},e.Update=function(t){var e=this.m_oldManifold;this.m_oldManifold=this.m_manifold,this.m_manifold=e,this.m_enabledFlag=!0;var i=!1,n=this.m_touchingFlag,r=this.m_fixtureA.IsSensor(),s=this.m_fixtureB.IsSensor(),a=r||s,o=this.m_fixtureA.GetBody(),h=this.m_fixtureB.GetBody(),u=o.GetTransform(),l=h.GetTransform();if(a){var c=this.GetShapeA(),_=this.GetShapeB();i=De(c,this.m_indexA,_,this.m_indexB,u,l),this.m_manifold.pointCount=0}else{this.Evaluate(this.m_manifold,u,l),i=this.m_manifold.pointCount>0;for(var f=0;f<this.m_manifold.pointCount;++f){var d=this.m_manifold.points[f];d.normalImpulse=0,d.tangentImpulse=0;for(var p=d.id,m=0;m<this.m_oldManifold.pointCount;++m){var g=this.m_oldManifold.points[m];if(g.id.key===p.key){d.normalImpulse=g.normalImpulse,d.tangentImpulse=g.tangentImpulse;break}}}i!==n&&(o.SetAwake(!0),h.SetAwake(!0))}this.m_touchingFlag=i,!n&&i&&t&&t.BeginContact(this),n&&!i&&t&&t.EndContact(this),!a&&i&&t&&t.PreSolve(this,this.m_oldManifold)},e.ComputeTOI=function(e,i){var n=t.ComputeTOI_s_input;n.proxyA.SetShape(this.GetShapeA(),this.m_indexA),n.proxyB.SetShape(this.GetShapeB(),this.m_indexB),n.sweepA.Copy(e),n.sweepB.Copy(i),n.tMax=p;var r=t.ComputeTOI_s_output;return ui(r,n),r.t},t}();$n.ComputeTOI_s_input=new Je,$n.ComputeTOI_s_output=new Ze;var tr=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.Create=function(){return new e},e.Destroy=function(){},e.prototype.Evaluate=function(t,e,i){_i(t,this.GetShapeA(),e,this.GetShapeB(),i)},e}($n),er=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.Create=function(){return new e},e.Destroy=function(){},e.prototype.Evaluate=function(t,e,i){Vi(t,this.GetShapeA(),e,this.GetShapeB(),i)},e}($n),ir=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.Create=function(){return new e},e.Destroy=function(){},e.prototype.Evaluate=function(t,e,i){mi(t,this.GetShapeA(),e,this.GetShapeB(),i)},e}($n),nr=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.Create=function(){return new e},e.Destroy=function(){},e.prototype.Evaluate=function(t,e,i){Ji(t,this.GetShapeA(),e,this.GetShapeB(),i)},e}($n),rr=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.Create=function(){return new e},e.Destroy=function(){},e.prototype.Evaluate=function(t,e,i){rn(t,this.GetShapeA(),e,this.GetShapeB(),i)},e}($n),sr=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.Create=function(){return new e},e.Destroy=function(){},e.prototype.Evaluate=function(t,i,n){var r=e.Evaluate_s_edge;this.GetShapeA().GetChildEdge(r,this.m_indexA),Ji(t,r,i,this.GetShapeB(),n)},e}($n);sr.Evaluate_s_edge=new ln;var ar=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.Create=function(){return new e},e.Destroy=function(){},e.prototype.Evaluate=function(t,i,n){var r=e.Evaluate_s_edge;this.GetShapeA().GetChildEdge(r,this.m_indexA),rn(t,r,i,this.GetShapeB(),n)},e}($n);ar.Evaluate_s_edge=new ln;var or=function(){this.pool=[],this.createFcn=null,this.destroyFcn=null,this.primary=!1},hr=function(){function e(){this.m_registers=[],this.InitializeRegisters()}var i=e.prototype;return i.AddType=function(t,e,i,n){var r=[];function s(){return r.pop()||t()}function a(t){r.push(t)}this.m_registers[i][n].pool=r,this.m_registers[i][n].createFcn=s,this.m_registers[i][n].destroyFcn=a,this.m_registers[i][n].primary=!0,i!==n&&(this.m_registers[n][i].pool=r,this.m_registers[n][i].createFcn=s,this.m_registers[n][i].destroyFcn=a,this.m_registers[n][i].primary=!1)},i.InitializeRegisters=function(){for(var e=0;e<t.b2ShapeType.e_shapeTypeCount;e++){this.m_registers[e]=[];for(var i=0;i<t.b2ShapeType.e_shapeTypeCount;i++)this.m_registers[e][i]=new or}this.AddType(tr.Create,tr.Destroy,t.b2ShapeType.e_circleShape,t.b2ShapeType.e_circleShape),this.AddType(ir.Create,ir.Destroy,t.b2ShapeType.e_polygonShape,t.b2ShapeType.e_circleShape),this.AddType(er.Create,er.Destroy,t.b2ShapeType.e_polygonShape,t.b2ShapeType.e_polygonShape),this.AddType(nr.Create,nr.Destroy,t.b2ShapeType.e_edgeShape,t.b2ShapeType.e_circleShape),this.AddType(rr.Create,rr.Destroy,t.b2ShapeType.e_edgeShape,t.b2ShapeType.e_polygonShape),this.AddType(sr.Create,sr.Destroy,t.b2ShapeType.e_chainShape,t.b2ShapeType.e_circleShape),this.AddType(ar.Create,ar.Destroy,t.b2ShapeType.e_chainShape,t.b2ShapeType.e_polygonShape)},i.Create=function(t,e,i,n){var r=t.GetType(),s=i.GetType(),a=this.m_registers[r][s];if(a.createFcn){var o=a.createFcn();return a.primary?o.Reset(t,e,i,n):o.Reset(i,n,t,e),o}return null},i.Destroy=function(t){var e=t.m_fixtureA.GetType(),i=t.m_fixtureB.GetType(),n=this.m_registers[e][i];n.destroyFcn&&n.destroyFcn(t)},e}(),ur=function(){function t(){}var e=t.prototype;return e.SayGoodbyeJoint=function(){},e.SayGoodbyeFixture=function(){},e.SayGoodbyeParticleGroup=function(){},e.SayGoodbyeParticle=function(){},t}(),lr=function(){function e(){}var i=e.prototype;return i.ShouldCollide=function(e,i){var n=e.GetBody(),r=i.GetBody();if(r.GetType()===t.b2BodyType.b2_staticBody&&n.GetType()===t.b2BodyType.b2_staticBody)return!1;if(!r.ShouldCollideConnected(n))return!1;var s=e.GetFilterData(),a=i.GetFilterData();return s.groupIndex===a.groupIndex&&0!==s.groupIndex?s.groupIndex>0:0!=(s.maskBits&a.categoryBits)&&0!=(s.categoryBits&a.maskBits)},i.ShouldCollideFixtureParticle=function(){return!0},i.ShouldCollideParticleParticle=function(){return!0},e}();lr.b2_defaultFilter=new lr;var cr=function(){this.normalImpulses=$(l),this.tangentImpulses=$(l),this.count=0},_r=function(){function t(){}var e=t.prototype;return e.BeginContact=function(){},e.EndContact=function(){},e.BeginContactFixtureParticle=function(){},e.EndContactFixtureParticle=function(){},e.BeginContactParticleParticle=function(){},e.EndContactParticleParticle=function(){},e.PreSolve=function(){},e.PostSolve=function(){},t}();_r.b2_defaultListener=new _r;var fr=function(){function t(){}var e=t.prototype;return e.ReportFixture=function(){return!0},e.ReportParticle=function(){return!1},e.ShouldQueryParticleSystem=function(){return!0},t}(),dr=function(){function t(){}var e=t.prototype;return e.ReportFixture=function(t,e,i,n){return n},e.ReportParticle=function(){return 0},e.ShouldQueryParticleSystem=function(){return!0},t}(),pr=function(){function e(){this.m_broadPhase=new Ge,this.m_contactList=null,this.m_contactCount=0,this.m_contactFilter=lr.b2_defaultFilter,this.m_contactListener=_r.b2_defaultListener,this.m_contactFactory=new hr}var i=e.prototype;return i.AddPair=function(t,e){var i=t.fixture,n=e.fixture,r=t.childIndex,s=e.childIndex,a=i.GetBody(),o=n.GetBody();if(a!==o){for(var h=o.GetContactList();h;){if(h.other===a){var u=h.contact.GetFixtureA(),l=h.contact.GetFixtureB(),c=h.contact.GetChildIndexA(),_=h.contact.GetChildIndexB();if(u===i&&l===n&&c===r&&_===s)return;if(u===n&&l===i&&c===s&&_===r)return}h=h.next}if(!this.m_contactFilter||this.m_contactFilter.ShouldCollide(i,n)){var f=this.m_contactFactory.Create(i,r,n,s);null!==f&&(i=f.GetFixtureA(),n=f.GetFixtureB(),r=f.GetChildIndexA(),s=f.GetChildIndexB(),a=i.m_body,o=n.m_body,f.m_prev=null,f.m_next=this.m_contactList,null!==this.m_contactList&&(this.m_contactList.m_prev=f),this.m_contactList=f,f.m_nodeA.other=o,f.m_nodeA.prev=null,f.m_nodeA.next=a.m_contactList,null!==a.m_contactList&&(a.m_contactList.prev=f.m_nodeA),a.m_contactList=f.m_nodeA,f.m_nodeB.other=a,f.m_nodeB.prev=null,f.m_nodeB.next=o.m_contactList,null!==o.m_contactList&&(o.m_contactList.prev=f.m_nodeB),o.m_contactList=f.m_nodeB,i.IsSensor()||n.IsSensor()||(a.SetAwake(!0),o.SetAwake(!0)),++this.m_contactCount)}}},i.FindNewContacts=function(){var t=this;this.m_broadPhase.UpdatePairs((function(e,i){t.AddPair(e,i)}))},i.Destroy=function(t){var e=t.GetFixtureA(),i=t.GetFixtureB(),n=e.GetBody(),r=i.GetBody();this.m_contactListener&&t.IsTouching()&&this.m_contactListener.EndContact(t),t.m_prev&&(t.m_prev.m_next=t.m_next),t.m_next&&(t.m_next.m_prev=t.m_prev),t===this.m_contactList&&(this.m_contactList=t.m_next),t.m_nodeA.prev&&(t.m_nodeA.prev.next=t.m_nodeA.next),t.m_nodeA.next&&(t.m_nodeA.next.prev=t.m_nodeA.prev),t.m_nodeA===n.m_contactList&&(n.m_contactList=t.m_nodeA.next),t.m_nodeB.prev&&(t.m_nodeB.prev.next=t.m_nodeB.next),t.m_nodeB.next&&(t.m_nodeB.next.prev=t.m_nodeB.prev),t.m_nodeB===r.m_contactList&&(r.m_contactList=t.m_nodeB.next),t.m_manifold.pointCount>0&&!e.IsSensor()&&!i.IsSensor()&&(e.GetBody().SetAwake(!0),i.GetBody().SetAwake(!0)),this.m_contactFactory.Destroy(t),--this.m_contactCount},i.Collide=function(){for(var e=this.m_contactList;e;){var i=e.GetFixtureA(),n=e.GetFixtureB(),r=e.GetChildIndexA(),s=e.GetChildIndexB(),a=i.GetBody(),o=n.GetBody();if(e.m_filterFlag){if(this.m_contactFilter&&!this.m_contactFilter.ShouldCollide(i,n)){var h=e;e=h.m_next,this.Destroy(h);continue}e.m_filterFlag=!1}var u=a.IsAwake()&&a.m_type!==t.b2BodyType.b2_staticBody,l=o.IsAwake()&&o.m_type!==t.b2BodyType.b2_staticBody;if(u||l){var c=i.m_proxies[r].treeNode,_=n.m_proxies[s].treeNode;if(Ce(c.aabb,_.aabb))e.Update(this.m_contactListener),e=e.m_next;else{var f=e;e=f.m_next,this.Destroy(f)}}else e=e.m_next}},e}(),mr=function(){function t(){this.step=0,this.collide=0,this.solve=0,this.solveInit=0,this.solveVelocity=0,this.solvePosition=0,this.broadphase=0,this.solveTOI=0}return t.prototype.Reset=function(){return this.step=0,this.collide=0,this.solve=0,this.solveInit=0,this.solveVelocity=0,this.solvePosition=0,this.broadphase=0,this.solveTOI=0,this},t}(),gr=function(){function t(){this.dt=0,this.inv_dt=0,this.dtRatio=0,this.velocityIterations=0,this.positionIterations=0,this.particleIterations=0,this.warmStarting=!1}return t.prototype.Copy=function(t){return this.dt=t.dt,this.inv_dt=t.inv_dt,this.dtRatio=t.dtRatio,this.positionIterations=t.positionIterations,this.velocityIterations=t.velocityIterations,this.particleIterations=t.particleIterations,this.warmStarting=t.warmStarting,this},t}(),yr=function(){function t(){this.c=new bt,this.a=0}return t.MakeArray=function(e){return Q(e,(function(){return new t}))},t}(),vr=function(){function t(){this.v=new bt,this.w=0}return t.MakeArray=function(e){return Q(e,(function(){return new t}))},t}(),Sr=function(){this.step=new gr},Ar=!1,Tr=function(){function t(){this.rA=new bt,this.rB=new bt,this.normalImpulse=0,this.tangentImpulse=0,this.normalMass=0,this.tangentMass=0,this.velocityBias=0}return t.MakeArray=function(e){return Q(e,(function(){return new t}))},t}(),Er=function(){function t(){this.points=Tr.MakeArray(l),this.normal=new bt,this.tangent=new bt,this.normalMass=new Rt,this.K=new Rt,this.indexA=0,this.indexB=0,this.invMassA=0,this.invMassB=0,this.invIA=0,this.invIB=0,this.friction=0,this.restitution=0,this.tangentSpeed=0,this.pointCount=0,this.contactIndex=0}return t.MakeArray=function(e){return Q(e,(function(){return new t}))},t}(),br=function(){function e(){this.localPoints=bt.MakeArray(l),this.localNormal=new bt,this.localPoint=new bt,this.indexA=0,this.indexB=0,this.invMassA=0,this.invMassB=0,this.localCenterA=new bt,this.localCenterB=new bt,this.invIA=0,this.invIB=0,this.type=t.b2ManifoldType.e_unknown,this.radiusA=0,this.radiusB=0,this.pointCount=0}return e.MakeArray=function(t){return Q(t,(function(){return new e}))},e}(),xr=function(){this.step=new gr,this.count=0},Cr=function(){function e(){this.normal=new bt,this.point=new bt,this.separation=0}return e.prototype.Initialize=function(i,n,r,s){var a=e.Initialize_s_pointA,o=e.Initialize_s_pointB,h=e.Initialize_s_planePoint,u=e.Initialize_s_clipPoint;switch(i.type){case t.b2ManifoldType.e_circles:Bt.MulXV(n,i.localPoint,a),Bt.MulXV(r,i.localPoints[0],o),bt.SubVV(o,a,this.normal).SelfNormalize(),bt.MidVV(a,o,this.point),this.separation=bt.DotVV(bt.SubVV(o,a,bt.s_t0),this.normal)-i.radiusA-i.radiusB;break;case t.b2ManifoldType.e_faceA:It.MulRV(n.q,i.localNormal,this.normal),Bt.MulXV(n,i.localPoint,h),Bt.MulXV(r,i.localPoints[s],u),this.separation=bt.DotVV(bt.SubVV(u,h,bt.s_t0),this.normal)-i.radiusA-i.radiusB,this.point.Copy(u);break;case t.b2ManifoldType.e_faceB:It.MulRV(r.q,i.localNormal,this.normal),Bt.MulXV(r,i.localPoint,h),Bt.MulXV(n,i.localPoints[s],u),this.separation=bt.DotVV(bt.SubVV(u,h,bt.s_t0),this.normal)-i.radiusA-i.radiusB,this.point.Copy(u),this.normal.SelfNeg()}},e}();Cr.Initialize_s_pointA=new bt,Cr.Initialize_s_pointB=new bt,Cr.Initialize_s_planePoint=new bt,Cr.Initialize_s_clipPoint=new bt;var Rr=function(){function t(){this.m_step=new gr,this.m_positionConstraints=br.MakeArray(1024),this.m_velocityConstraints=Er.MakeArray(1024),this.m_count=0}var e=t.prototype;return e.Initialize=function(t){if(this.m_step.Copy(t.step),this.m_count=t.count,this.m_positionConstraints.length<this.m_count)for(var e=st(2*this.m_positionConstraints.length,this.m_count);this.m_positionConstraints.length<e;)this.m_positionConstraints[this.m_positionConstraints.length]=new br;if(this.m_velocityConstraints.length<this.m_count)for(var i=st(2*this.m_velocityConstraints.length,this.m_count);this.m_velocityConstraints.length<i;)this.m_velocityConstraints[this.m_velocityConstraints.length]=new Er;this.m_positions=t.positions,this.m_velocities=t.velocities,this.m_contacts=t.contacts;for(var n=0;n<this.m_count;++n){var r=this.m_contacts[n],s=r.m_fixtureA,a=r.m_fixtureB,o=s.GetShape(),h=a.GetShape(),u=o.m_radius,l=h.m_radius,c=s.GetBody(),_=a.GetBody(),f=r.GetManifold(),d=f.pointCount,p=this.m_velocityConstraints[n];p.friction=r.m_friction,p.restitution=r.m_restitution,p.tangentSpeed=r.m_tangentSpeed,p.indexA=c.m_islandIndex,p.indexB=_.m_islandIndex,p.invMassA=c.m_invMass,p.invMassB=_.m_invMass,p.invIA=c.m_invI,p.invIB=_.m_invI,p.contactIndex=n,p.pointCount=d,p.K.SetZero(),p.normalMass.SetZero();var m=this.m_positionConstraints[n];m.indexA=c.m_islandIndex,m.indexB=_.m_islandIndex,m.invMassA=c.m_invMass,m.invMassB=_.m_invMass,m.localCenterA.Copy(c.m_sweep.localCenter),m.localCenterB.Copy(_.m_sweep.localCenter),m.invIA=c.m_invI,m.invIB=_.m_invI,m.localNormal.Copy(f.localNormal),m.localPoint.Copy(f.localPoint),m.pointCount=d,m.radiusA=u,m.radiusB=l,m.type=f.type;for(var g=0;g<d;++g){var y=f.points[g],v=p.points[g];this.m_step.warmStarting?(v.normalImpulse=this.m_step.dtRatio*y.normalImpulse,v.tangentImpulse=this.m_step.dtRatio*y.tangentImpulse):(v.normalImpulse=0,v.tangentImpulse=0),v.rA.SetZero(),v.rB.SetZero(),v.normalMass=0,v.tangentMass=0,v.velocityBias=0,m.localPoints[g].Copy(y.localPoint)}}return this},e.InitializeVelocityConstraints=function(){for(var e=t.InitializeVelocityConstraints_s_xfA,i=t.InitializeVelocityConstraints_s_xfB,n=t.InitializeVelocityConstraints_s_worldManifold,r=1e3,s=0;s<this.m_count;++s){var a=this.m_velocityConstraints[s],o=this.m_positionConstraints[s],h=o.radiusA,u=o.radiusB,l=this.m_contacts[a.contactIndex].GetManifold(),c=a.indexA,_=a.indexB,f=a.invMassA,d=a.invMassB,p=a.invIA,m=a.invIB,g=o.localCenterA,y=o.localCenterB,v=this.m_positions[c].c,A=this.m_positions[c].a,T=this.m_velocities[c].v,E=this.m_velocities[c].w,b=this.m_positions[_].c,x=this.m_positions[_].a,C=this.m_velocities[_].v,R=this.m_velocities[_].w;e.q.SetAngle(A),i.q.SetAngle(x),bt.SubVV(v,It.MulRV(e.q,g,bt.s_t0),e.p),bt.SubVV(b,It.MulRV(i.q,y,bt.s_t0),i.p),n.Initialize(l,e,h,i,u),a.normal.Copy(n.normal),bt.CrossVOne(a.normal,a.tangent);for(var w=a.pointCount,I=0;I<w;++I){var B=a.points[I];bt.SubVV(n.points[I],v,B.rA),bt.SubVV(n.points[I],b,B.rB);var D=bt.CrossVV(B.rA,a.normal),P=bt.CrossVV(B.rB,a.normal),O=f+d+p*D*D+m*P*P;B.normalMass=O>0?1/O:0;var M=a.tangent,N=bt.CrossVV(B.rA,M),L=bt.CrossVV(B.rB,M),F=f+d+p*N*N+m*L*L;B.tangentMass=F>0?1/F:0,B.velocityBias=0;var k=bt.DotVV(a.normal,bt.SubVV(bt.AddVCrossSV(C,R,B.rB,bt.s_t0),bt.AddVCrossSV(T,E,B.rA,bt.s_t1),bt.s_t0));k<-S&&(B.velocityBias+=-a.restitution*k)}if(2===a.pointCount&&Ar){var G=a.points[0],V=a.points[1],U=bt.CrossVV(G.rA,a.normal),z=bt.CrossVV(G.rB,a.normal),H=bt.CrossVV(V.rA,a.normal),W=bt.CrossVV(V.rB,a.normal),X=f+d+p*U*U+m*z*z,j=f+d+p*H*H+m*W*W,Y=f+d+p*U*H+m*z*W;X*X<r*(X*j-Y*Y)?(a.K.ex.Set(X,Y),a.K.ey.Set(Y,j),a.K.GetInverse(a.normalMass)):a.pointCount=1}}},e.WarmStart=function(){for(var e=t.WarmStart_s_P,i=0;i<this.m_count;++i){for(var n=this.m_velocityConstraints[i],r=n.indexA,s=n.indexB,a=n.invMassA,o=n.invIA,h=n.invMassB,u=n.invIB,l=n.pointCount,c=this.m_velocities[r].v,_=this.m_velocities[r].w,f=this.m_velocities[s].v,d=this.m_velocities[s].w,p=n.normal,m=n.tangent,g=0;g<l;++g){var y=n.points[g];bt.AddVV(bt.MulSV(y.normalImpulse,p,bt.s_t0),bt.MulSV(y.tangentImpulse,m,bt.s_t1),e),_-=o*bt.CrossVV(y.rA,e),c.SelfMulSub(a,e),d+=u*bt.CrossVV(y.rB,e),f.SelfMulAdd(h,e)}this.m_velocities[r].w=_,this.m_velocities[s].w=d}},e.SolveVelocityConstraints=function(){for(var e=t.SolveVelocityConstraints_s_dv,i=t.SolveVelocityConstraints_s_dv1,n=t.SolveVelocityConstraints_s_dv2,r=t.SolveVelocityConstraints_s_P,s=t.SolveVelocityConstraints_s_a,a=t.SolveVelocityConstraints_s_b,o=t.SolveVelocityConstraints_s_x,h=t.SolveVelocityConstraints_s_d,u=t.SolveVelocityConstraints_s_P1,l=t.SolveVelocityConstraints_s_P2,c=t.SolveVelocityConstraints_s_P1P2,_=0;_<this.m_count;++_){for(var f=this.m_velocityConstraints[_],d=f.indexA,p=f.indexB,m=f.invMassA,g=f.invIA,y=f.invMassB,v=f.invIB,S=f.pointCount,A=this.m_velocities[d].v,T=this.m_velocities[d].w,E=this.m_velocities[p].v,b=this.m_velocities[p].w,x=f.normal,C=f.tangent,R=f.friction,w=0;w<S;++w){var I=f.points[w];bt.SubVV(bt.AddVCrossSV(E,b,I.rB,bt.s_t0),bt.AddVCrossSV(A,T,I.rA,bt.s_t1),e);var B=bt.DotVV(e,C)-f.tangentSpeed,D=I.tangentMass*-B,P=R*I.normalImpulse,O=at(I.tangentImpulse+D,-P,P);D=O-I.tangentImpulse,I.tangentImpulse=O,bt.MulSV(D,C,r),A.SelfMulSub(m,r),T-=g*bt.CrossVV(I.rA,r),E.SelfMulAdd(y,r),b+=v*bt.CrossVV(I.rB,r)}if(1===f.pointCount||!1===Ar)for(var M=0;M<S;++M){var N=f.points[M];bt.SubVV(bt.AddVCrossSV(E,b,N.rB,bt.s_t0),bt.AddVCrossSV(A,T,N.rA,bt.s_t1),e);var L=bt.DotVV(e,x),F=-N.normalMass*(L-N.velocityBias),k=st(N.normalImpulse+F,0);F=k-N.normalImpulse,N.normalImpulse=k,bt.MulSV(F,x,r),A.SelfMulSub(m,r),T-=g*bt.CrossVV(N.rA,r),E.SelfMulAdd(y,r),b+=v*bt.CrossVV(N.rB,r)}else{var G=f.points[0],V=f.points[1];s.Set(G.normalImpulse,V.normalImpulse),bt.SubVV(bt.AddVCrossSV(E,b,G.rB,bt.s_t0),bt.AddVCrossSV(A,T,G.rA,bt.s_t1),i),bt.SubVV(bt.AddVCrossSV(E,b,V.rB,bt.s_t0),bt.AddVCrossSV(A,T,V.rA,bt.s_t1),n);var U=bt.DotVV(i,x),z=bt.DotVV(n,x);for(a.x=U-G.velocityBias,a.y=z-V.velocityBias,a.SelfSub(Rt.MulMV(f.K,s,bt.s_t0));;){if(Rt.MulMV(f.normalMass,a,o).SelfNeg(),o.x>=0&&o.y>=0){bt.SubVV(o,s,h),bt.MulSV(h.x,x,u),bt.MulSV(h.y,x,l),bt.AddVV(u,l,c),A.SelfMulSub(m,c),T-=g*(bt.CrossVV(G.rA,u)+bt.CrossVV(V.rA,l)),E.SelfMulAdd(y,c),b+=v*(bt.CrossVV(G.rB,u)+bt.CrossVV(V.rB,l)),G.normalImpulse=o.x,V.normalImpulse=o.y;break}if(o.x=-G.normalMass*a.x,o.y=0,U=0,z=f.K.ex.y*o.x+a.y,o.x>=0&&z>=0){bt.SubVV(o,s,h),bt.MulSV(h.x,x,u),bt.MulSV(h.y,x,l),bt.AddVV(u,l,c),A.SelfMulSub(m,c),T-=g*(bt.CrossVV(G.rA,u)+bt.CrossVV(V.rA,l)),E.SelfMulAdd(y,c),b+=v*(bt.CrossVV(G.rB,u)+bt.CrossVV(V.rB,l)),G.normalImpulse=o.x,V.normalImpulse=o.y;break}if(o.x=0,o.y=-V.normalMass*a.y,U=f.K.ey.x*o.y+a.x,z=0,o.y>=0&&U>=0){bt.SubVV(o,s,h),bt.MulSV(h.x,x,u),bt.MulSV(h.y,x,l),bt.AddVV(u,l,c),A.SelfMulSub(m,c),T-=g*(bt.CrossVV(G.rA,u)+bt.CrossVV(V.rA,l)),E.SelfMulAdd(y,c),b+=v*(bt.CrossVV(G.rB,u)+bt.CrossVV(V.rB,l)),G.normalImpulse=o.x,V.normalImpulse=o.y;break}if(o.x=0,o.y=0,U=a.x,z=a.y,U>=0&&z>=0){bt.SubVV(o,s,h),bt.MulSV(h.x,x,u),bt.MulSV(h.y,x,l),bt.AddVV(u,l,c),A.SelfMulSub(m,c),T-=g*(bt.CrossVV(G.rA,u)+bt.CrossVV(V.rA,l)),E.SelfMulAdd(y,c),b+=v*(bt.CrossVV(G.rB,u)+bt.CrossVV(V.rB,l)),G.normalImpulse=o.x,V.normalImpulse=o.y;break}break}}this.m_velocities[d].w=T,this.m_velocities[p].w=b}},e.StoreImpulses=function(){for(var t=0;t<this.m_count;++t)for(var e=this.m_velocityConstraints[t],i=this.m_contacts[e.contactIndex].GetManifold(),n=0;n<e.pointCount;++n)i.points[n].normalImpulse=e.points[n].normalImpulse,i.points[n].tangentImpulse=e.points[n].tangentImpulse},e.SolvePositionConstraints=function(){for(var e=t.SolvePositionConstraints_s_xfA,i=t.SolvePositionConstraints_s_xfB,n=t.SolvePositionConstraints_s_psm,r=t.SolvePositionConstraints_s_rA,s=t.SolvePositionConstraints_s_rB,a=t.SolvePositionConstraints_s_P,o=0,h=0;h<this.m_count;++h){for(var u=this.m_positionConstraints[h],l=u.indexA,c=u.indexB,_=u.localCenterA,f=u.invMassA,d=u.invIA,m=u.localCenterB,g=u.invMassB,y=u.invIB,v=u.pointCount,S=this.m_positions[l].c,T=this.m_positions[l].a,E=this.m_positions[c].c,b=this.m_positions[c].a,x=0;x<v;++x){e.q.SetAngle(T),i.q.SetAngle(b),bt.SubVV(S,It.MulRV(e.q,_,bt.s_t0),e.p),bt.SubVV(E,It.MulRV(i.q,m,bt.s_t0),i.p),n.Initialize(u,e,i,x);var C=n.normal,w=n.point,I=n.separation;bt.SubVV(w,S,r),bt.SubVV(w,E,s),o=rt(o,I);var B=at(R*(I+p),-A,0),D=bt.CrossVV(r,C),P=bt.CrossVV(s,C),O=f+g+d*D*D+y*P*P,M=O>0?-B/O:0;bt.MulSV(M,C,a),S.SelfMulSub(f,a),T-=d*bt.CrossVV(r,a),E.SelfMulAdd(g,a),b+=y*bt.CrossVV(s,a)}this.m_positions[l].a=T,this.m_positions[c].a=b}return o>-3*p},e.SolveTOIPositionConstraints=function(e,i){for(var n=t.SolveTOIPositionConstraints_s_xfA,r=t.SolveTOIPositionConstraints_s_xfB,s=t.SolveTOIPositionConstraints_s_psm,a=t.SolveTOIPositionConstraints_s_rA,o=t.SolveTOIPositionConstraints_s_rB,h=t.SolveTOIPositionConstraints_s_P,u=0,l=0;l<this.m_count;++l){var c=this.m_positionConstraints[l],_=c.indexA,f=c.indexB,d=c.localCenterA,m=c.localCenterB,g=c.pointCount,y=0,v=0;_!==e&&_!==i||(y=c.invMassA,v=c.invIA);var S=0,T=0;f!==e&&f!==i||(S=c.invMassB,T=c.invIB);for(var E=this.m_positions[_].c,b=this.m_positions[_].a,x=this.m_positions[f].c,C=this.m_positions[f].a,R=0;R<g;++R){n.q.SetAngle(b),r.q.SetAngle(C),bt.SubVV(E,It.MulRV(n.q,d,bt.s_t0),n.p),bt.SubVV(x,It.MulRV(r.q,m,bt.s_t0),r.p),s.Initialize(c,n,r,R);var I=s.normal,B=s.point,D=s.separation;bt.SubVV(B,E,a),bt.SubVV(B,x,o),u=rt(u,D);var P=at(w*(D+p),-A,0),O=bt.CrossVV(a,I),M=bt.CrossVV(o,I),N=y+S+v*O*O+T*M*M,L=N>0?-P/N:0;bt.MulSV(L,I,h),E.SelfMulSub(y,h),b-=v*bt.CrossVV(a,h),x.SelfMulAdd(S,h),C+=T*bt.CrossVV(o,h)}this.m_positions[_].a=b,this.m_positions[f].a=C}return u>=-1.5*p},t}();Rr.InitializeVelocityConstraints_s_xfA=new Bt,Rr.InitializeVelocityConstraints_s_xfB=new Bt,Rr.InitializeVelocityConstraints_s_worldManifold=new Se,Rr.WarmStart_s_P=new bt,Rr.SolveVelocityConstraints_s_dv=new bt,Rr.SolveVelocityConstraints_s_dv1=new bt,Rr.SolveVelocityConstraints_s_dv2=new bt,Rr.SolveVelocityConstraints_s_P=new bt,Rr.SolveVelocityConstraints_s_a=new bt,Rr.SolveVelocityConstraints_s_b=new bt,Rr.SolveVelocityConstraints_s_x=new bt,Rr.SolveVelocityConstraints_s_d=new bt,Rr.SolveVelocityConstraints_s_P1=new bt,Rr.SolveVelocityConstraints_s_P2=new bt,Rr.SolveVelocityConstraints_s_P1P2=new bt,Rr.SolvePositionConstraints_s_xfA=new Bt,Rr.SolvePositionConstraints_s_xfB=new Bt,Rr.SolvePositionConstraints_s_psm=new Cr,Rr.SolvePositionConstraints_s_rA=new bt,Rr.SolvePositionConstraints_s_rB=new bt,Rr.SolvePositionConstraints_s_P=new bt,Rr.SolveTOIPositionConstraints_s_xfA=new Bt,Rr.SolveTOIPositionConstraints_s_xfB=new Bt,Rr.SolveTOIPositionConstraints_s_psm=new Cr,Rr.SolveTOIPositionConstraints_s_rA=new bt,Rr.SolveTOIPositionConstraints_s_rB=new bt,Rr.SolveTOIPositionConstraints_s_P=new bt;var wr,Ir=function(){function e(){this.m_bodies=[],this.m_contacts=[],this.m_joints=[],this.m_positions=yr.MakeArray(1024),this.m_velocities=vr.MakeArray(1024),this.m_bodyCount=0,this.m_jointCount=0,this.m_contactCount=0,this.m_bodyCapacity=0,this.m_contactCapacity=0,this.m_jointCapacity=0}var i=e.prototype;return i.Initialize=function(t,e,i,n){if(this.m_bodyCapacity=t,this.m_contactCapacity=e,this.m_jointCapacity=i,this.m_bodyCount=0,this.m_contactCount=0,this.m_jointCount=0,this.m_listener=n,this.m_positions.length<t)for(var r=st(2*this.m_positions.length,t);this.m_positions.length<r;)this.m_positions[this.m_positions.length]=new yr;if(this.m_velocities.length<t)for(var s=st(2*this.m_velocities.length,t);this.m_velocities.length<s;)this.m_velocities[this.m_velocities.length]=new vr},i.Clear=function(){this.m_bodyCount=0,this.m_contactCount=0,this.m_jointCount=0},i.AddBody=function(t){t.m_islandIndex=this.m_bodyCount,this.m_bodies[this.m_bodyCount++]=t},i.AddContact=function(t){this.m_contacts[this.m_contactCount++]=t},i.AddJoint=function(t){this.m_joints[this.m_jointCount++]=t},i.Solve=function(i,n,s,a){for(var o=e.s_timer.Reset(),h=n.dt,u=0;u<this.m_bodyCount;++u){var l=this.m_bodies[u];this.m_positions[u].c.Copy(l.m_sweep.c);var c=l.m_sweep.a,_=this.m_velocities[u].v.Copy(l.m_linearVelocity),f=l.m_angularVelocity;l.m_sweep.c0.Copy(l.m_sweep.c),l.m_sweep.a0=l.m_sweep.a,l.m_type===t.b2BodyType.b2_dynamicBody&&(_.x+=h*(l.m_gravityScale*s.x+l.m_invMass*l.m_force.x),_.y+=h*(l.m_gravityScale*s.y+l.m_invMass*l.m_force.y),f+=h*l.m_invI*l.m_torque,_.SelfMul(1/(1+h*l.m_linearDamping)),f*=1/(1+h*l.m_angularDamping)),this.m_positions[u].a=c,this.m_velocities[u].w=f}o.Reset();var d=e.s_solverData;d.step.Copy(n),d.positions=this.m_positions,d.velocities=this.m_velocities;var p=e.s_contactSolverDef;p.step.Copy(n),p.contacts=this.m_contacts,p.count=this.m_contactCount,p.positions=this.m_positions,p.velocities=this.m_velocities;var m=e.s_contactSolver.Initialize(p);m.InitializeVelocityConstraints(),n.warmStarting&&m.WarmStart();for(var g=0;g<this.m_jointCount;++g)this.m_joints[g].InitVelocityConstraints(d);i.solveInit=o.GetMilliseconds(),o.Reset();for(var y=0;y<n.velocityIterations;++y){for(var v=0;v<this.m_jointCount;++v)this.m_joints[v].SolveVelocityConstraints(d);m.SolveVelocityConstraints()}m.StoreImpulses(),i.solveVelocity=o.GetMilliseconds();for(var S=0;S<this.m_bodyCount;++S){var A=this.m_positions[S].c,T=this.m_positions[S].a,R=this.m_velocities[S].v,w=this.m_velocities[S].w,I=bt.MulSV(h,R,e.s_translation);if(bt.DotVV(I,I)>b){var B=E/I.Length();R.SelfMul(B)}var D=h*w;D*D>C&&(w*=x/nt(D)),A.x+=h*R.x,A.y+=h*R.y,T+=h*w,this.m_positions[S].a=T,this.m_velocities[S].w=w}o.Reset();for(var P=!1,O=0;O<n.positionIterations;++O){for(var M=m.SolvePositionConstraints(),N=!0,L=0;L<this.m_jointCount;++L){var F=this.m_joints[L].SolvePositionConstraints(d);N=N&&F}if(M&&N){P=!0;break}}for(var k=0;k<this.m_bodyCount;++k){var z=this.m_bodies[k];z.m_sweep.c.Copy(this.m_positions[k].c),z.m_sweep.a=this.m_positions[k].a,z.m_linearVelocity.Copy(this.m_velocities[k].v),z.m_angularVelocity=this.m_velocities[k].w,z.SynchronizeTransform()}if(i.solvePosition=o.GetMilliseconds(),this.Report(m.m_velocityConstraints),a){for(var H=r,W=V*V,X=U*U,j=0;j<this.m_bodyCount;++j){var Y=this.m_bodies[j];Y.GetType()!==t.b2BodyType.b2_staticBody&&(!Y.m_autoSleepFlag||Y.m_angularVelocity*Y.m_angularVelocity>X||bt.DotVV(Y.m_linearVelocity,Y.m_linearVelocity)>W?(Y.m_sleepTime=0,H=0):(Y.m_sleepTime+=h,H=rt(H,Y.m_sleepTime)))}if(H>=G&&P)for(var q=0;q<this.m_bodyCount;++q)this.m_bodies[q].SetAwake(!1)}},i.SolveTOI=function(t,i,n){for(var r=0;r<this.m_bodyCount;++r){var s=this.m_bodies[r];this.m_positions[r].c.Copy(s.m_sweep.c),this.m_positions[r].a=s.m_sweep.a,this.m_velocities[r].v.Copy(s.m_linearVelocity),this.m_velocities[r].w=s.m_angularVelocity}var a=e.s_contactSolverDef;a.contacts=this.m_contacts,a.count=this.m_contactCount,a.step.Copy(t),a.positions=this.m_positions,a.velocities=this.m_velocities;for(var o=e.s_contactSolver.Initialize(a),h=0;h<t.positionIterations&&!o.SolveTOIPositionConstraints(i,n);++h);this.m_bodies[i].m_sweep.c0.Copy(this.m_positions[i].c),this.m_bodies[i].m_sweep.a0=this.m_positions[i].a,this.m_bodies[n].m_sweep.c0.Copy(this.m_positions[n].c),this.m_bodies[n].m_sweep.a0=this.m_positions[n].a,o.InitializeVelocityConstraints();for(var u=0;u<t.velocityIterations;++u)o.SolveVelocityConstraints();for(var l=t.dt,c=0;c<this.m_bodyCount;++c){var _=this.m_positions[c].c,f=this.m_positions[c].a,d=this.m_velocities[c].v,p=this.m_velocities[c].w,m=bt.MulSV(l,d,e.s_translation);if(bt.DotVV(m,m)>b){var g=E/m.Length();d.SelfMul(g)}var y=l*p;y*y>C&&(p*=x/nt(y)),_.SelfMulAdd(l,d),f+=l*p,this.m_positions[c].a=f,this.m_velocities[c].w=p;var v=this.m_bodies[c];v.m_sweep.c.Copy(_),v.m_sweep.a=f,v.m_linearVelocity.Copy(d),v.m_angularVelocity=p,v.SynchronizeTransform()}this.Report(o.m_velocityConstraints)},i.Report=function(t){if(null!==this.m_listener)for(var i=0;i<this.m_contactCount;++i){var n=this.m_contacts[i];if(n){var r=t[i],s=e.s_impulse;s.count=r.pointCount;for(var a=0;a<r.pointCount;++a)s.normalImpulses[a]=r.points[a].normalImpulse,s.tangentImpulses[a]=r.points[a].tangentImpulse;this.m_listener.PostSolve(n,s)}}},e}();Ir.s_timer=new Nt,Ir.s_solverData=new Sr,Ir.s_contactSolverDef=new xr,Ir.s_contactSolver=new Rr,Ir.s_translation=new bt,Ir.s_impulse=new cr,(wr=t.b2ParticleFlag||(t.b2ParticleFlag={}))[wr.b2_waterParticle=0]="b2_waterParticle",wr[wr.b2_zombieParticle=2]="b2_zombieParticle",wr[wr.b2_wallParticle=4]="b2_wallParticle",wr[wr.b2_springParticle=8]="b2_springParticle",wr[wr.b2_elasticParticle=16]="b2_elasticParticle",wr[wr.b2_viscousParticle=32]="b2_viscousParticle",wr[wr.b2_powderParticle=64]="b2_powderParticle",wr[wr.b2_tensileParticle=128]="b2_tensileParticle",wr[wr.b2_colorMixingParticle=256]="b2_colorMixingParticle",wr[wr.b2_destructionListenerParticle=512]="b2_destructionListenerParticle",wr[wr.b2_barrierParticle=1024]="b2_barrierParticle",wr[wr.b2_staticPressureParticle=2048]="b2_staticPressureParticle",wr[wr.b2_reactiveParticle=4096]="b2_reactiveParticle",wr[wr.b2_repulsiveParticle=8192]="b2_repulsiveParticle",wr[wr.b2_fixtureContactListenerParticle=16384]="b2_fixtureContactListenerParticle",wr[wr.b2_particleContactListenerParticle=32768]="b2_particleContactListenerParticle",wr[wr.b2_fixtureContactFilterParticle=65536]="b2_fixtureContactFilterParticle",wr[wr.b2_particleContactFilterParticle=131072]="b2_particleContactFilterParticle";var Br=function(){this.flags=0,this.position=new bt,this.velocity=new bt,this.color=new Ot(0,0,0,0),this.lifetime=0,this.userData=null,this.group=null};function Dr(t,e,i){var n=8,r=.01;return at(Math.ceil(Math.sqrt(t/(r*e))*i),1,n)}var Pr,Or=function(){function t(){this.m_index=I}var e=t.prototype;return e.GetIndex=function(){return this.m_index},e.SetIndex=function(t){this.m_index=t},t}();(Pr=t.b2ParticleGroupFlag||(t.b2ParticleGroupFlag={}))[Pr.b2_solidParticleGroup=1]="b2_solidParticleGroup",Pr[Pr.b2_rigidParticleGroup=2]="b2_rigidParticleGroup",Pr[Pr.b2_particleGroupCanBeEmpty=4]="b2_particleGroupCanBeEmpty",Pr[Pr.b2_particleGroupWillBeDestroyed=8]="b2_particleGroupWillBeDestroyed",Pr[Pr.b2_particleGroupNeedsUpdateDepth=16]="b2_particleGroupNeedsUpdateDepth",Pr[Pr.b2_particleGroupInternalMask=24]="b2_particleGroupInternalMask";var Mr=function(){this.flags=0,this.groupFlags=0,this.position=new bt,this.angle=0,this.linearVelocity=new bt,this.angularVelocity=0,this.color=new Ot,this.strength=1,this.shapeCount=0,this.stride=0,this.particleCount=0,this.lifetime=0,this.userData=null,this.group=null},Nr=function(){function e(t){this.m_firstIndex=0,this.m_lastIndex=0,this.m_groupFlags=0,this.m_strength=1,this.m_prev=null,this.m_next=null,this.m_timestamp=-1,this.m_mass=0,this.m_inertia=0,this.m_center=new bt,this.m_linearVelocity=new bt,this.m_angularVelocity=0,this.m_transform=new Bt,this.m_userData=null,this.m_system=t}var i=e.prototype;return i.GetNext=function(){return this.m_next},i.GetParticleSystem=function(){return this.m_system},i.GetParticleCount=function(){return this.m_lastIndex-this.m_firstIndex},i.GetBufferIndex=function(){return this.m_firstIndex},i.ContainsParticle=function(t){return this.m_firstIndex<=t&&t<this.m_lastIndex},i.GetAllParticleFlags=function(){if(!this.m_system.m_flagsBuffer.data)throw new Error;for(var t=0,e=this.m_firstIndex;e<this.m_lastIndex;e++)t|=this.m_system.m_flagsBuffer.data[e];return t},i.GetGroupFlags=function(){return this.m_groupFlags},i.SetGroupFlags=function(e){e|=this.m_groupFlags&t.b2ParticleGroupFlag.b2_particleGroupInternalMask,this.m_system.SetGroupFlags(this,e)},i.GetMass=function(){return this.UpdateStatistics(),this.m_mass},i.GetInertia=function(){return this.UpdateStatistics(),this.m_inertia},i.GetCenter=function(){return this.UpdateStatistics(),this.m_center},i.GetLinearVelocity=function(){return this.UpdateStatistics(),this.m_linearVelocity},i.GetAngularVelocity=function(){return this.UpdateStatistics(),this.m_angularVelocity},i.GetTransform=function(){return this.m_transform},i.GetPosition=function(){return this.m_transform.p},i.GetAngle=function(){return this.m_transform.q.GetAngle()},i.GetLinearVelocityFromWorldPoint=function(t,i){var n=e.GetLinearVelocityFromWorldPoint_s_t0;return this.UpdateStatistics(),bt.AddVCrossSV(this.m_linearVelocity,this.m_angularVelocity,bt.SubVV(t,this.m_center,n),i)},i.GetUserData=function(){return this.m_userData},i.SetUserData=function(t){this.m_userData=t},i.ApplyForce=function(t){this.m_system.ApplyForce(this.m_firstIndex,this.m_lastIndex,t)},i.ApplyLinearImpulse=function(t){this.m_system.ApplyLinearImpulse(this.m_firstIndex,this.m_lastIndex,t)},i.DestroyParticles=function(t){if(this.m_system.m_world.IsLocked())throw new Error;for(var e=this.m_firstIndex;e<this.m_lastIndex;e++)this.m_system.DestroyParticle(e,t)},i.UpdateStatistics=function(){if(!this.m_system.m_positionBuffer.data)throw new Error;if(!this.m_system.m_velocityBuffer.data)throw new Error;var t=new bt,e=new bt;if(this.m_timestamp!==this.m_system.m_timestamp){var i=this.m_system.GetParticleMass();this.m_mass=i*(this.m_lastIndex-this.m_firstIndex),this.m_center.SetZero(),this.m_linearVelocity.SetZero();for(var n=this.m_firstIndex;n<this.m_lastIndex;n++)this.m_center.SelfMulAdd(i,this.m_system.m_positionBuffer.data[n]),this.m_linearVelocity.SelfMulAdd(i,this.m_system.m_velocityBuffer.data[n]);if(this.m_mass>0){var r=1/this.m_mass;this.m_center.SelfMul(r),this.m_linearVelocity.SelfMul(r)}this.m_inertia=0,this.m_angularVelocity=0;for(var s=this.m_firstIndex;s<this.m_lastIndex;s++)bt.SubVV(this.m_system.m_positionBuffer.data[s],this.m_center,t),bt.SubVV(this.m_system.m_velocityBuffer.data[s],this.m_linearVelocity,e),this.m_inertia+=i*bt.DotVV(t,t),this.m_angularVelocity+=i*bt.CrossVV(t,e);this.m_inertia>0&&(this.m_angularVelocity*=1/this.m_inertia),this.m_timestamp=this.m_system.m_timestamp}},e}();Nr.GetLinearVelocityFromWorldPoint_s_t0=new bt;var Lr=function(){function t(t){this.m_buffer=[],this.m_front=0,this.m_back=0,this.m_buffer.fill(null,0,t)}var e=t.prototype;return e.Push=function(t){if(this.m_back>=this.m_capacity){for(var e=this.m_front;e<this.m_back;e++)this.m_buffer[e-this.m_front]=this.m_buffer[e];this.m_back-=this.m_front,this.m_front=0}this.m_buffer[this.m_back]=t,this.m_back++},e.Pop=function(){this.m_buffer[this.m_front]=null,this.m_front++},e.Empty=function(){return this.m_front===this.m_back},e.Front=function(){var t=this.m_buffer[this.m_front];if(!t)throw new Error;return t},n(t,[{key:"m_capacity",get:function(){return this.m_buffer.length}}]),t}(),Fr=function(){function t(t){this.m_generatorCapacity=0,this.m_generatorCount=0,this.m_countX=0,this.m_countY=0,this.m_diagram=[],this.m_generatorBuffer=Q(t,(function(){return new kr})),this.m_generatorCapacity=t}var e=t.prototype;return e.AddGenerator=function(t,e,i){var n=this.m_generatorBuffer[this.m_generatorCount++];n.center.Copy(t),n.tag=e,n.necessary=i},e.Generate=function(t,e){for(var i=1/t,n=new bt(+r,+r),s=new bt(-r,-r),a=0,o=0;o<this.m_generatorCount;o++){var h=this.m_generatorBuffer[o];h.necessary&&(bt.MinV(n,h.center,n),bt.MaxV(s,h.center,s),++a)}if(0===a)return this.m_countX=0,void(this.m_countY=0);n.x-=e,n.y-=e,s.x+=e,s.y+=e,this.m_countX=1+Math.floor(i*(s.x-n.x)),this.m_countY=1+Math.floor(i*(s.y-n.y)),this.m_diagram=[];for(var u=new Lr(4*this.m_countX*this.m_countY),l=0;l<this.m_generatorCount;l++){var c=this.m_generatorBuffer[l];c.center.SelfSub(n).SelfMul(i);var _=Math.floor(c.center.x),f=Math.floor(c.center.y);_>=0&&f>=0&&_<this.m_countX&&f<this.m_countY&&u.Push(new Gr(_,f,_+f*this.m_countX,c))}for(;!u.Empty();){var d=u.Front(),p=d.m_x,m=d.m_y,g=d.m_i,y=d.m_generator;u.Pop(),this.m_diagram[g]||(this.m_diagram[g]=y,p>0&&u.Push(new Gr(p-1,m,g-1,y)),m>0&&u.Push(new Gr(p,m-1,g-this.m_countX,y)),p<this.m_countX-1&&u.Push(new Gr(p+1,m,g+1,y)),m<this.m_countY-1&&u.Push(new Gr(p,m+1,g+this.m_countX,y)))}for(var v=0;v<this.m_countY;v++)for(var S=0;S<this.m_countX-1;S++){var A=S+v*this.m_countX,T=this.m_diagram[A],E=this.m_diagram[A+1];T!==E&&(u.Push(new Gr(S,v,A,E)),u.Push(new Gr(S+1,v,A+1,T)))}for(var b=0;b<this.m_countY-1;b++)for(var x=0;x<this.m_countX;x++){var C=x+b*this.m_countX,R=this.m_diagram[C],w=this.m_diagram[C+this.m_countX];R!==w&&(u.Push(new Gr(x,b,C,w)),u.Push(new Gr(x,b+1,C+this.m_countX,R)))}for(;!u.Empty();){var I=u.Front(),B=I.m_x,D=I.m_y,P=I.m_i,O=I.m_generator;u.Pop();var M=this.m_diagram[P],N=O;if(M!==N){var L=M.center.x-B,F=M.center.y-D,k=N.center.x-B,G=N.center.y-D;L*L+F*F>k*k+G*G&&(this.m_diagram[P]=N,B>0&&u.Push(new Gr(B-1,D,P-1,N)),D>0&&u.Push(new Gr(B,D-1,P-this.m_countX,N)),B<this.m_countX-1&&u.Push(new Gr(B+1,D,P+1,N)),D<this.m_countY-1&&u.Push(new Gr(B,D+1,P+this.m_countX,N)))}}},e.GetNodes=function(t){for(var e=0;e<this.m_countY-1;e++)for(var i=0;i<this.m_countX-1;i++){var n=i+e*this.m_countX,r=this.m_diagram[n],s=this.m_diagram[n+1],a=this.m_diagram[n+this.m_countX],o=this.m_diagram[n+1+this.m_countX];s!==a&&(r!==s&&r!==a&&(r.necessary||s.necessary||a.necessary)&&t(r.tag,s.tag,a.tag),o!==s&&o!==a&&(r.necessary||s.necessary||a.necessary)&&t(s.tag,o.tag,a.tag))}},t}(),kr=function(){this.center=new bt,this.tag=0,this.necessary=!1},Gr=function(t,e,i,n){this.m_x=t,this.m_y=e,this.m_i=i,this.m_generator=n};function Vr(t,e,i){var n=t[e];t[e]=t[i],t[i]=n}function Ur(t,e){return t<e}function zr(t,e,i,n){void 0===e&&(e=0),void 0===i&&(i=t.length-e),void 0===n&&(n=Ur);for(var r=e,s=[],a=0;;){for(;r+1<i;i++){var o=t[r+Math.floor(Math.random()*(i-r))];s[a++]=i;for(var h=r-1;;){for(;n(t[++h],o););for(;n(o,t[--i]););if(h>=i)break;Vr(t,h,i)}}if(0===a)break;r=i,i=s[--a]}return t}function Hr(t,e,i,n){return void 0===e&&(e=0),void 0===i&&(i=t.length-e),void 0===n&&(n=Ur),zr(t,e,i,n)}function Wr(t,e,i){void 0===i&&(i=t.length);for(var n=0,r=0;r<i;++r)e(t[r])||(r!==n?Vr(t,n++,r):++n);return n}function Xr(t,e,i,n,r){for(var s=i-e;s>0;){var a=Math.floor(s/2),o=e+a;r(t[o],n)?(e=++o,s-=a+1):s=a}return e}function jr(t,e,i,n,r){for(var s=i-e;s>0;){var a=Math.floor(s/2),o=e+a;r(n,t[o])?s=a:(e=++o,s-=a+1)}return e}function Yr(t,e,i,n){for(var r=i;e!==r;)Vr(t,e++,r++),r===n?r=i:e===i&&(i=r)}function qr(t,e,i,n){if(e===i)return i;for(var r=e;++e!==i;)n(t[r],t[e])||Vr(t,++r,e);return++r}var Kr=function(){function t(t){this.data=[],this.count=0,this.capacity=0,this.allocator=t}var e=t.prototype;return e.Append=function(){return this.count>=this.capacity&&this.Grow(),this.count++},e.Reserve=function(t){if(!(this.capacity>=t)){for(var e=this.capacity;e<t;++e)this.data[e]=this.allocator();this.capacity=t}},e.Grow=function(){var t=this.capacity?2*this.capacity:F;this.Reserve(t)},e.Free=function(){0!==this.data.length&&(this.data=[],this.capacity=0,this.count=0)},e.Shorten=function(){},e.Data=function(){return this.data},e.GetCount=function(){return this.count},e.SetCount=function(t){this.count=t},e.GetCapacity=function(){return this.capacity},e.RemoveIf=function(t){this.count=Wr(this.data,t,this.count)},e.Unique=function(t){this.count=qr(this.data,0,this.count,t)},t}(),Jr=function(t){function e(e){var i;return(i=t.call(this)||this).m_system=e,i}s(e,t);var i=e.prototype;return i.ShouldQueryParticleSystem=function(){return!1},i.ReportFixture=function(t){if(t.IsSensor())return!0;for(var e=t.GetShape().GetChildCount(),i=0;i<e;i++)for(var n=t.GetAABB(i),r=this.m_system.GetInsideBoundsEnumerator(n),s=void 0;(s=r.GetNext())>=0;)this.ReportFixtureAndParticle(t,i,s);return!0},i.ReportParticle=function(){return!1},i.ReportFixtureAndParticle=function(){},e}(fr),Qr=function(){function t(){this.indexA=0,this.indexB=0,this.weight=0,this.normal=new bt,this.flags=0}var e=t.prototype;return e.SetIndices=function(t,e){this.indexA=t,this.indexB=e},e.SetWeight=function(t){this.weight=t},e.SetNormal=function(t){this.normal.Copy(t)},e.SetFlags=function(t){this.flags=t},e.GetIndexA=function(){return this.indexA},e.GetIndexB=function(){return this.indexB},e.GetWeight=function(){return this.weight},e.GetNormal=function(){return this.normal},e.GetFlags=function(){return this.flags},e.IsEqual=function(t){return this.indexA===t.indexA&&this.indexB===t.indexB&&this.flags===t.flags&&this.weight===t.weight&&this.normal.x===t.normal.x&&this.normal.y===t.normal.y},e.IsNotEqual=function(t){return!this.IsEqual(t)},e.ApproximatelyEqual=function(t){var e=.01,i=1e-4;return this.indexA===t.indexA&&this.indexB===t.indexB&&this.flags===t.flags&&nt(this.weight-t.weight)<e&&bt.DistanceSquaredVV(this.normal,t.normal)<i},t}(),Zr=function(){this.index=0,this.weight=0,this.normal=new bt,this.mass=0},$r=function(){this.indexA=0,this.indexB=0,this.flags=0,this.strength=0,this.distance=0},ts=function(){this.indexA=0,this.indexB=0,this.indexC=0,this.flags=0,this.strength=0,this.pa=new bt(0,0),this.pb=new bt(0,0),this.pc=new bt(0,0),this.ka=0,this.kb=0,this.kc=0,this.s=0},es=function(){function t(){this.strictContactCheck=!1,this.density=1,this.gravityScale=1,this.radius=1,this.maxCount=0,this.pressureStrength=.005,this.dampingStrength=1,this.elasticStrength=.25,this.springStrength=.25,this.viscousStrength=.25,this.surfaceTensionPressureStrength=.2,this.surfaceTensionNormalStrength=.2,this.repulsiveStrength=1,this.powderStrength=.5,this.ejectionStrength=.5,this.staticPressureStrength=.2,this.staticPressureRelaxation=.2,this.staticPressureIterations=8,this.colorMixingStrength=.5,this.destroyByAge=!0,this.lifetimeGranularity=1/60}var e=t.prototype;return e.Copy=function(t){return this.strictContactCheck=t.strictContactCheck,this.density=t.density,this.gravityScale=t.gravityScale,this.radius=t.radius,this.maxCount=t.maxCount,this.pressureStrength=t.pressureStrength,this.dampingStrength=t.dampingStrength,this.elasticStrength=t.elasticStrength,this.springStrength=t.springStrength,this.viscousStrength=t.viscousStrength,this.surfaceTensionPressureStrength=t.surfaceTensionPressureStrength,this.surfaceTensionNormalStrength=t.surfaceTensionNormalStrength,this.repulsiveStrength=t.repulsiveStrength,this.powderStrength=t.powderStrength,this.ejectionStrength=t.ejectionStrength,this.staticPressureStrength=t.staticPressureStrength,this.staticPressureRelaxation=t.staticPressureRelaxation,this.staticPressureIterations=t.staticPressureIterations,this.colorMixingStrength=t.colorMixingStrength,this.destroyByAge=t.destroyByAge,this.lifetimeGranularity=t.lifetimeGranularity,this},e.Clone=function(){return(new t).Copy(this)},t}(),is=function(){function e(t,e){this.m_paused=!1,this.m_timestamp=0,this.m_allParticleFlags=0,this.m_needsUpdateAllParticleFlags=!1,this.m_allGroupFlags=0,this.m_needsUpdateAllGroupFlags=!1,this.m_hasForce=!1,this.m_iterationIndex=0,this.m_inverseDensity=0,this.m_particleDiameter=0,this.m_inverseDiameter=0,this.m_squaredDiameter=0,this.m_count=0,this.m_internalAllocatedCapacity=0,this.m_handleIndexBuffer=new ns,this.m_flagsBuffer=new ns,this.m_positionBuffer=new ns,this.m_velocityBuffer=new ns,this.m_forceBuffer=[],this.m_weightBuffer=[],this.m_staticPressureBuffer=[],this.m_accumulationBuffer=[],this.m_accumulation2Buffer=[],this.m_depthBuffer=[],this.m_colorBuffer=new ns,this.m_groupBuffer=[],this.m_userDataBuffer=new ns,this.m_stuckThreshold=0,this.m_lastBodyContactStepBuffer=new ns,this.m_bodyContactCountBuffer=new ns,this.m_consecutiveContactStepsBuffer=new ns,this.m_stuckParticleBuffer=new Kr((function(){return 0})),this.m_proxyBuffer=new Kr((function(){return new rs})),this.m_contactBuffer=new Kr((function(){return new Qr})),this.m_bodyContactBuffer=new Kr((function(){return new Zr})),this.m_pairBuffer=new Kr((function(){return new $r})),this.m_triadBuffer=new Kr((function(){return new ts})),this.m_expirationTimeBuffer=new ns,this.m_indexByExpirationTimeBuffer=new ns,this.m_timeElapsed=0,this.m_expirationTimeBufferRequiresSorting=!1,this.m_groupCount=0,this.m_groupList=null,this.m_def=new es,this.m_prev=null,this.m_next=null,this.UpdateBodyContacts_callback=null,this.SolveCollision_callback=null,this.SetStrictContactCheck(t.strictContactCheck),this.SetDensity(t.density),this.SetGravityScale(t.gravityScale),this.SetRadius(t.radius),this.SetMaxParticleCount(t.maxCount),this.m_def=t.Clone(),this.m_world=e,this.SetDestructionByAge(this.m_def.destroyByAge)}e.computeTag=function(t,i){return(i+e.yOffset>>>0<<e.yShift)+(e.xScale*t+e.xOffset>>>0)>>>0},e.computeRelativeTag=function(t,i,n){return t+(n<<e.yShift)+(i<<e.xShift)>>>0};var n=e.prototype;return n.Drop=function(){for(;this.m_groupList;)this.DestroyParticleGroup(this.m_groupList);this.FreeUserOverridableBuffer(this.m_handleIndexBuffer),this.FreeUserOverridableBuffer(this.m_flagsBuffer),this.FreeUserOverridableBuffer(this.m_lastBodyContactStepBuffer),this.FreeUserOverridableBuffer(this.m_bodyContactCountBuffer),this.FreeUserOverridableBuffer(this.m_consecutiveContactStepsBuffer),this.FreeUserOverridableBuffer(this.m_positionBuffer),this.FreeUserOverridableBuffer(this.m_velocityBuffer),this.FreeUserOverridableBuffer(this.m_colorBuffer),this.FreeUserOverridableBuffer(this.m_userDataBuffer),this.FreeUserOverridableBuffer(this.m_expirationTimeBuffer),this.FreeUserOverridableBuffer(this.m_indexByExpirationTimeBuffer),this.FreeBuffer(this.m_forceBuffer,this.m_internalAllocatedCapacity),this.FreeBuffer(this.m_weightBuffer,this.m_internalAllocatedCapacity),this.FreeBuffer(this.m_staticPressureBuffer,this.m_internalAllocatedCapacity),this.FreeBuffer(this.m_accumulationBuffer,this.m_internalAllocatedCapacity),this.FreeBuffer(this.m_accumulation2Buffer,this.m_internalAllocatedCapacity),this.FreeBuffer(this.m_depthBuffer,this.m_internalAllocatedCapacity),this.FreeBuffer(this.m_groupBuffer,this.m_internalAllocatedCapacity)},n.CreateParticle=function(t){if(this.m_world.IsLocked())throw new Error;if(this.m_count>=this.m_internalAllocatedCapacity){var e=this.m_count?2*this.m_count:F;this.ReallocateInternalAllocatedBuffers(e)}if(this.m_count>=this.m_internalAllocatedCapacity){if(!this.m_def.destroyByAge)return I;this.DestroyOldestParticle(0,!1),this.SolveZombie()}var n=this.m_count++;this.m_flagsBuffer.data[n]=0,this.m_lastBodyContactStepBuffer.data&&(this.m_lastBodyContactStepBuffer.data[n]=0),this.m_bodyContactCountBuffer.data&&(this.m_bodyContactCountBuffer.data[n]=0),this.m_consecutiveContactStepsBuffer.data&&(this.m_consecutiveContactStepsBuffer.data[n]=0),this.m_positionBuffer.data[n]=(this.m_positionBuffer.data[n]||new bt).Copy(i(t.position,bt.ZERO)),this.m_velocityBuffer.data[n]=(this.m_velocityBuffer.data[n]||new bt).Copy(i(t.velocity,bt.ZERO)),this.m_weightBuffer[n]=0,this.m_forceBuffer[n]=(this.m_forceBuffer[n]||new bt).SetZero(),this.m_staticPressureBuffer&&(this.m_staticPressureBuffer[n]=0),this.m_depthBuffer&&(this.m_depthBuffer[n]=0);var r=(new Ot).Copy(i(t.color,Ot.ZERO));!this.m_colorBuffer.data&&r.IsZero()||(this.m_colorBuffer.data=this.RequestBuffer(this.m_colorBuffer.data),this.m_colorBuffer.data[n]=(this.m_colorBuffer.data[n]||new Ot).Copy(r)),(this.m_userDataBuffer.data||t.userData)&&(this.m_userDataBuffer.data=this.RequestBuffer(this.m_userDataBuffer.data),this.m_userDataBuffer.data[n]=t.userData),this.m_handleIndexBuffer.data&&(this.m_handleIndexBuffer.data[n]=null);var s=this.m_proxyBuffer.data[this.m_proxyBuffer.Append()],a=i(t.lifetime,0),o=a>0;(this.m_expirationTimeBuffer.data||o)&&(this.SetParticleLifetime(n,o?a:this.ExpirationTimeToLifetime(-this.GetQuantizedTimeElapsed())),this.m_indexByExpirationTimeBuffer.data[n]=n),s.index=n;var h=i(t.group,null);return this.m_groupBuffer[n]=h,h&&(h.m_firstIndex<h.m_lastIndex?(this.RotateBuffer(h.m_firstIndex,h.m_lastIndex,n),h.m_lastIndex=n+1):(h.m_firstIndex=n,h.m_lastIndex=n+1)),this.SetParticleFlags(n,i(t.flags,0)),n},n.GetParticleHandleFromIndex=function(t){this.m_handleIndexBuffer.data=this.RequestBuffer(this.m_handleIndexBuffer.data);var e=this.m_handleIndexBuffer.data[t];return e||((e=new Or).SetIndex(t),this.m_handleIndexBuffer.data[t]=e,e)},n.DestroyParticle=function(e,i){void 0===i&&(i=!1);var n=t.b2ParticleFlag.b2_zombieParticle;i&&(n|=t.b2ParticleFlag.b2_destructionListenerParticle),this.SetParticleFlags(e,this.m_flagsBuffer.data[e]|n)},n.DestroyOldestParticle=function(t,e){void 0===e&&(e=!1);var i=this.GetParticleCount(),n=this.m_indexByExpirationTimeBuffer.data[i-(t+1)],r=this.m_indexByExpirationTimeBuffer.data[t];this.DestroyParticle(this.m_expirationTimeBuffer.data[n]>0?n:r,e)},n.DestroyParticlesInShape=function(t,i,n){void 0===n&&(n=!1);var r=e.DestroyParticlesInShape_s_aabb;if(this.m_world.IsLocked())throw new Error;var s=new fs(this,t,i,n),a=r;return t.ComputeAABB(a,i,0),this.m_world.QueryAABB(s,a),s.Destroyed()},n.CreateParticleGroup=function(t){var n=e.CreateParticleGroup_s_transform;if(this.m_world.IsLocked())throw new Error;var r=n;r.SetPositionAngle(i(t.position,bt.ZERO),i(t.angle,0));var s=this.m_count;if(t.shape&&this.CreateParticlesWithShapeForGroup(t.shape,t,r),t.shapes&&this.CreateParticlesWithShapesForGroup(t.shapes,i(t.shapeCount,t.shapes.length),t,r),t.positionData)for(var a=i(t.particleCount,t.positionData.length),o=0;o<a;o++){var h=t.positionData[o];this.CreateParticleForGroup(t,r,h)}var u=this.m_count,l=new Nr(this);l.m_firstIndex=s,l.m_lastIndex=u,l.m_strength=i(t.strength,1),l.m_userData=t.userData,l.m_transform.Copy(r),l.m_prev=null,l.m_next=this.m_groupList,this.m_groupList&&(this.m_groupList.m_prev=l),this.m_groupList=l,++this.m_groupCount;for(var c=s;c<u;c++)this.m_groupBuffer[c]=l;this.SetGroupFlags(l,i(t.groupFlags,0));var _=new _s;return this.UpdateContacts(!0),this.UpdatePairsAndTriads(s,u,_),t.group&&(this.JoinParticleGroups(t.group,l),l=t.group),l},n.JoinParticleGroups=function(t,e){if(this.m_world.IsLocked())throw new Error;this.RotateBuffer(e.m_firstIndex,e.m_lastIndex,this.m_count),this.RotateBuffer(t.m_firstIndex,t.m_lastIndex,e.m_firstIndex);var i=new ds(e.m_firstIndex);this.UpdateContacts(!0),this.UpdatePairsAndTriads(t.m_firstIndex,e.m_lastIndex,i);for(var n=e.m_firstIndex;n<e.m_lastIndex;n++)this.m_groupBuffer[n]=t;var r=t.m_groupFlags|e.m_groupFlags;this.SetGroupFlags(t,r),t.m_lastIndex=e.m_lastIndex,e.m_firstIndex=e.m_lastIndex,this.DestroyParticleGroup(e)},n.SplitParticleGroup=function(t){this.UpdateContacts(!0);var i=Q(t.GetParticleCount(),(function(){return new as}));e.InitializeParticleLists(t,i),this.MergeParticleListsInContact(t,i);var n=e.FindLongestParticleList(t,i);this.MergeZombieParticleListNodes(t,i,n),this.CreateParticleGroupsFromParticleList(t,i,n),this.UpdatePairsAndTriadsWithParticleList(t,i)},n.GetParticleGroupList=function(){return this.m_groupList},n.GetParticleGroupCount=function(){return this.m_groupCount},n.GetParticleCount=function(){return this.m_count},n.GetMaxParticleCount=function(){return this.m_def.maxCount},n.SetMaxParticleCount=function(t){this.m_def.maxCount=t},n.GetAllParticleFlags=function(){return this.m_allParticleFlags},n.GetAllGroupFlags=function(){return this.m_allGroupFlags},n.SetPaused=function(t){this.m_paused=t},n.GetPaused=function(){return this.m_paused},n.SetDensity=function(t){this.m_def.density=t,this.m_inverseDensity=1/this.m_def.density},n.GetDensity=function(){return this.m_def.density},n.SetGravityScale=function(t){this.m_def.gravityScale=t},n.GetGravityScale=function(){return this.m_def.gravityScale},n.SetDamping=function(t){this.m_def.dampingStrength=t},n.GetDamping=function(){return this.m_def.dampingStrength},n.SetStaticPressureIterations=function(t){this.m_def.staticPressureIterations=t},n.GetStaticPressureIterations=function(){return this.m_def.staticPressureIterations},n.SetRadius=function(t){this.m_particleDiameter=2*t,this.m_squaredDiameter=this.m_particleDiameter*this.m_particleDiameter,this.m_inverseDiameter=1/this.m_particleDiameter},n.GetRadius=function(){return this.m_particleDiameter/2},n.GetPositionBuffer=function(){return this.m_positionBuffer.data},n.GetVelocityBuffer=function(){return this.m_velocityBuffer.data},n.GetColorBuffer=function(){return this.m_colorBuffer.data=this.RequestBuffer(this.m_colorBuffer.data),this.m_colorBuffer.data},n.GetGroupBuffer=function(){return this.m_groupBuffer},n.GetWeightBuffer=function(){return this.m_weightBuffer},n.GetUserDataBuffer=function(){return this.m_userDataBuffer.data=this.RequestBuffer(this.m_userDataBuffer.data),this.m_userDataBuffer.data},n.GetFlagsBuffer=function(){return this.m_flagsBuffer.data},n.SetParticleFlags=function(e,i){this.m_flagsBuffer.data[e]&~i&&(this.m_needsUpdateAllParticleFlags=!0),~this.m_allParticleFlags&i&&(i&t.b2ParticleFlag.b2_tensileParticle&&(this.m_accumulation2Buffer=this.RequestBuffer(this.m_accumulation2Buffer)),i&t.b2ParticleFlag.b2_colorMixingParticle&&(this.m_colorBuffer.data=this.RequestBuffer(this.m_colorBuffer.data)),this.m_allParticleFlags|=i),this.m_flagsBuffer.data[e]=i},n.GetParticleFlags=function(t){return this.m_flagsBuffer.data[t]},n.SetFlagsBuffer=function(t){this.SetUserOverridableBuffer(this.m_flagsBuffer,t)},n.SetPositionBuffer=function(t){if(t instanceof Float32Array){if(t.length%2!=0)throw new Error;for(var e=t.length/2,i=new Array(e),n=0;n<e;++n)i[n]=new bt(t.subarray(2*n,2*n+2));t=i}this.SetUserOverridableBuffer(this.m_positionBuffer,t)},n.SetVelocityBuffer=function(t){if(t instanceof Float32Array){if(t.length%2!=0)throw new Error;for(var e=t.length/2,i=new Array(e),n=0;n<e;++n)i[n]=new bt(t.subarray(2*n,2*n+2));t=i}this.SetUserOverridableBuffer(this.m_velocityBuffer,t)},n.SetColorBuffer=function(t){if(t instanceof Float32Array){if(t.length%4!=0)throw new Error;for(var e=t.length/4,i=new Array(e),n=0;n<e;++n)i[n]=new Ot(t.subarray(4*n,4*n+4));t=i}this.SetUserOverridableBuffer(this.m_colorBuffer,t)},n.SetUserDataBuffer=function(t){this.SetUserOverridableBuffer(this.m_userDataBuffer,t)},n.GetContacts=function(){return this.m_contactBuffer.data},n.GetContactCount=function(){return this.m_contactBuffer.count},n.GetBodyContacts=function(){return this.m_bodyContactBuffer.data},n.GetBodyContactCount=function(){return this.m_bodyContactBuffer.count},n.GetPairs=function(){return this.m_pairBuffer.data},n.GetPairCount=function(){return this.m_pairBuffer.count},n.GetTriads=function(){return this.m_triadBuffer.data},n.GetTriadCount=function(){return this.m_triadBuffer.count},n.SetStuckThreshold=function(t){this.m_stuckThreshold=t,t>0&&(this.m_lastBodyContactStepBuffer.data=this.RequestBuffer(this.m_lastBodyContactStepBuffer.data),this.m_bodyContactCountBuffer.data=this.RequestBuffer(this.m_bodyContactCountBuffer.data),this.m_consecutiveContactStepsBuffer.data=this.RequestBuffer(this.m_consecutiveContactStepsBuffer.data))},n.GetStuckCandidates=function(){return this.m_stuckParticleBuffer.Data()},n.GetStuckCandidateCount=function(){return this.m_stuckParticleBuffer.GetCount()},n.ComputeCollisionEnergy=function(){for(var t=e.ComputeCollisionEnergy_s_v,i=this.m_velocityBuffer.data,n=0,r=0;r<this.m_contactBuffer.count;r++){var s=this.m_contactBuffer.data[r],a=s.indexA,o=s.indexB,h=s.normal,u=bt.SubVV(i[o],i[a],t),l=bt.DotVV(u,h);l<0&&(n+=l*l)}return.5*this.GetParticleMass()*n},n.SetStrictContactCheck=function(t){this.m_def.strictContactCheck=t},n.GetStrictContactCheck=function(){return this.m_def.strictContactCheck},n.SetParticleLifetime=function(t,e){var i=null===this.m_indexByExpirationTimeBuffer.data;if(this.m_expirationTimeBuffer.data=this.RequestBuffer(this.m_expirationTimeBuffer.data),this.m_indexByExpirationTimeBuffer.data=this.RequestBuffer(this.m_indexByExpirationTimeBuffer.data),i)for(var n=this.GetParticleCount(),r=0;r<n;++r)this.m_indexByExpirationTimeBuffer.data[r]=r;var s=e/this.m_def.lifetimeGranularity,a=s>0?this.GetQuantizedTimeElapsed()+s:s;a!==this.m_expirationTimeBuffer.data[t]&&(this.m_expirationTimeBuffer.data[t]=a,this.m_expirationTimeBufferRequiresSorting=!0)},n.GetParticleLifetime=function(t){return this.ExpirationTimeToLifetime(this.GetExpirationTimeBuffer()[t])},n.SetDestructionByAge=function(t){t&&this.GetExpirationTimeBuffer(),this.m_def.destroyByAge=t},n.GetDestructionByAge=function(){return this.m_def.destroyByAge},n.GetExpirationTimeBuffer=function(){return this.m_expirationTimeBuffer.data=this.RequestBuffer(this.m_expirationTimeBuffer.data),this.m_expirationTimeBuffer.data},n.ExpirationTimeToLifetime=function(t){return(t>0?t-this.GetQuantizedTimeElapsed():t)*this.m_def.lifetimeGranularity},n.GetIndexByExpirationTimeBuffer=function(){return this.GetParticleCount()?this.SetParticleLifetime(0,this.GetParticleLifetime(0)):this.m_indexByExpirationTimeBuffer.data=this.RequestBuffer(this.m_indexByExpirationTimeBuffer.data),this.m_indexByExpirationTimeBuffer.data},n.ParticleApplyLinearImpulse=function(t,e){this.ApplyLinearImpulse(t,t+1,e)},n.ApplyLinearImpulse=function(t,e,i){for(var n=this.m_velocityBuffer.data,r=(e-t)*this.GetParticleMass(),s=(new bt).Copy(i).SelfMul(1/r),a=t;a<e;a++)n[a].SelfAdd(s)},e.IsSignificantForce=function(t){return 0!==t.x||0!==t.y},n.ParticleApplyForce=function(t,i){e.IsSignificantForce(i)&&this.ForceCanBeApplied(this.m_flagsBuffer.data[t])&&(this.PrepareForceBuffer(),this.m_forceBuffer[t].SelfAdd(i))},n.ApplyForce=function(t,i,n){var r=(new bt).Copy(n).SelfMul(1/(i-t));if(e.IsSignificantForce(r)){this.PrepareForceBuffer();for(var s=t;s<i;s++)this.m_forceBuffer[s].SelfAdd(r)}},n.GetNext=function(){return this.m_next},n.QueryAABB=function(t,i){if(0!==this.m_proxyBuffer.count)for(var n=0,r=this.m_proxyBuffer.count,s=Xr(this.m_proxyBuffer.data,n,r,e.computeTag(this.m_inverseDiameter*i.lowerBound.x,this.m_inverseDiameter*i.lowerBound.y),rs.CompareProxyTag),a=jr(this.m_proxyBuffer.data,s,r,e.computeTag(this.m_inverseDiameter*i.upperBound.x,this.m_inverseDiameter*i.upperBound.y),rs.CompareTagProxy),o=this.m_positionBuffer.data,h=s;h<a;++h){var u=this.m_proxyBuffer.data[h].index,l=o[u];if(i.lowerBound.x<l.x&&l.x<i.upperBound.x&&i.lowerBound.y<l.y&&l.y<i.upperBound.y&&!t.ReportParticle(this,u))break}},n.QueryShapeAABB=function(t,i,n,r){void 0===r&&(r=0);var s=e.QueryShapeAABB_s_aabb;i.ComputeAABB(s,n,r),this.QueryAABB(t,s)},n.QueryPointAABB=function(t,i,n){void 0===n&&(n=p);var r=e.QueryPointAABB_s_aabb;r.lowerBound.Set(i.x-n,i.y-n),r.upperBound.Set(i.x+n,i.y+n),this.QueryAABB(t,r)},n.RayCast=function(t,i,n){var r=e.RayCast_s_aabb,s=e.RayCast_s_p,a=e.RayCast_s_v,o=e.RayCast_s_n,h=e.RayCast_s_point;if(0!==this.m_proxyBuffer.count){var u=this.m_positionBuffer.data,l=r;bt.MinV(i,n,l.lowerBound),bt.MaxV(i,n,l.upperBound);for(var c,_=1,f=bt.SubVV(n,i,a),d=bt.DotVV(f,f),p=this.GetInsideBoundsEnumerator(l);(c=p.GetNext())>=0;){var m=bt.SubVV(i,u[c],s),g=bt.DotVV(m,f),y=g*g-d*(bt.DotVV(m,m)-this.m_squaredDiameter);if(y>=0){var v=ct(y),S=(-g-v)/d;if(S>_)continue;if(S<0&&((S=(-g+v)/d)<0||S>_))continue;var A=bt.AddVMulSV(m,S,f,o);if(A.Normalize(),(_=rt(_,t.ReportParticle(this,c,bt.AddVMulSV(i,S,f,h),A,S)))<=0)break}}}},n.ComputeAABB=function(t){var e=this.GetParticleCount();t.lowerBound.x=+r,t.lowerBound.y=+r,t.upperBound.x=-r,t.upperBound.y=-r;for(var i=this.m_positionBuffer.data,n=0;n<e;n++){var s=i[n];bt.MinV(t.lowerBound,s,t.lowerBound),bt.MaxV(t.upperBound,s,t.upperBound)}t.lowerBound.x-=this.m_particleDiameter,t.lowerBound.y-=this.m_particleDiameter,t.upperBound.x+=this.m_particleDiameter,t.upperBound.y+=this.m_particleDiameter},n.FreeBuffer=function(t){null!==t&&(t.length=0)},n.FreeUserOverridableBuffer=function(t){0===t.userSuppliedCapacity&&this.FreeBuffer(t.data,this.m_internalAllocatedCapacity)},n.ReallocateBuffer3=function(t,e,i){if(i<=e)throw new Error;var n=t?t.slice():[];return n.length=i,n},n.ReallocateBuffer5=function(t,e,i,n,r){if(n<=i)throw new Error;if(e&&!(n<=e))throw new Error;return r&&!t||e||(t=this.ReallocateBuffer3(t,i,n)),t},n.ReallocateBuffer4=function(t,e,i,n){return this.ReallocateBuffer5(t.data,t.userSuppliedCapacity,e,i,n)},n.RequestBuffer=function(t){return t||(0===this.m_internalAllocatedCapacity&&this.ReallocateInternalAllocatedBuffers(F),(t=[]).length=this.m_internalAllocatedCapacity),t},n.ReallocateHandleBuffers=function(t){this.m_handleIndexBuffer.data=this.ReallocateBuffer4(this.m_handleIndexBuffer,this.m_internalAllocatedCapacity,t,!0)},n.ReallocateInternalAllocatedBuffers=function(t){function e(t,e){return e&&t>e?e:t}if(t=e(t,this.m_def.maxCount),t=e(t,this.m_flagsBuffer.userSuppliedCapacity),t=e(t,this.m_positionBuffer.userSuppliedCapacity),t=e(t,this.m_velocityBuffer.userSuppliedCapacity),t=e(t,this.m_colorBuffer.userSuppliedCapacity),t=e(t,this.m_userDataBuffer.userSuppliedCapacity),this.m_internalAllocatedCapacity<t){this.ReallocateHandleBuffers(t),this.m_flagsBuffer.data=this.ReallocateBuffer4(this.m_flagsBuffer,this.m_internalAllocatedCapacity,t,!1);var i=this.m_stuckThreshold>0;this.m_lastBodyContactStepBuffer.data=this.ReallocateBuffer4(this.m_lastBodyContactStepBuffer,this.m_internalAllocatedCapacity,t,i),this.m_bodyContactCountBuffer.data=this.ReallocateBuffer4(this.m_bodyContactCountBuffer,this.m_internalAllocatedCapacity,t,i),this.m_consecutiveContactStepsBuffer.data=this.ReallocateBuffer4(this.m_consecutiveContactStepsBuffer,this.m_internalAllocatedCapacity,t,i),this.m_positionBuffer.data=this.ReallocateBuffer4(this.m_positionBuffer,this.m_internalAllocatedCapacity,t,!1),this.m_velocityBuffer.data=this.ReallocateBuffer4(this.m_velocityBuffer,this.m_internalAllocatedCapacity,t,!1),this.m_forceBuffer=this.ReallocateBuffer5(this.m_forceBuffer,0,this.m_internalAllocatedCapacity,t,!1),this.m_weightBuffer=this.ReallocateBuffer5(this.m_weightBuffer,0,this.m_internalAllocatedCapacity,t,!1),this.m_staticPressureBuffer=this.ReallocateBuffer5(this.m_staticPressureBuffer,0,this.m_internalAllocatedCapacity,t,!0),this.m_accumulationBuffer=this.ReallocateBuffer5(this.m_accumulationBuffer,0,this.m_internalAllocatedCapacity,t,!1),this.m_accumulation2Buffer=this.ReallocateBuffer5(this.m_accumulation2Buffer,0,this.m_internalAllocatedCapacity,t,!0),this.m_depthBuffer=this.ReallocateBuffer5(this.m_depthBuffer,0,this.m_internalAllocatedCapacity,t,!0),this.m_colorBuffer.data=this.ReallocateBuffer4(this.m_colorBuffer,this.m_internalAllocatedCapacity,t,!0),this.m_groupBuffer=this.ReallocateBuffer5(this.m_groupBuffer,0,this.m_internalAllocatedCapacity,t,!1),this.m_userDataBuffer.data=this.ReallocateBuffer4(this.m_userDataBuffer,this.m_internalAllocatedCapacity,t,!0),this.m_expirationTimeBuffer.data=this.ReallocateBuffer4(this.m_expirationTimeBuffer,this.m_internalAllocatedCapacity,t,!0),this.m_indexByExpirationTimeBuffer.data=this.ReallocateBuffer4(this.m_indexByExpirationTimeBuffer,this.m_internalAllocatedCapacity,t,!1),this.m_internalAllocatedCapacity=t}},n.CreateParticleForGroup=function(t,e,n){var r=new Br;r.flags=i(t.flags,0),Bt.MulXV(e,n,r.position),bt.AddVV(i(t.linearVelocity,bt.ZERO),bt.CrossSV(i(t.angularVelocity,0),bt.SubVV(r.position,i(t.position,bt.ZERO),bt.s_t0),bt.s_t0),r.velocity),r.color.Copy(i(t.color,Ot.ZERO)),r.lifetime=i(t.lifetime,0),r.userData=t.userData,this.CreateParticle(r)},n.CreateParticlesStrokeShapeForGroup=function(n,r,s){var a=e.CreateParticlesStrokeShapeForGroup_s_edge,o=e.CreateParticlesStrokeShapeForGroup_s_d,h=e.CreateParticlesStrokeShapeForGroup_s_p,u=i(r.stride,0);0===u&&(u=this.GetParticleStride());for(var l=0,c=n.GetChildCount(),_=0;_<c;_++){var f=null;n.GetType()===t.b2ShapeType.e_edgeShape?f=n:(f=a,n.GetChildEdge(f,_));for(var d=bt.SubVV(f.m_vertex2,f.m_vertex1,o),p=d.Length();l<p;){var m=bt.AddVMulSV(f.m_vertex1,l/p,d,h);this.CreateParticleForGroup(r,s,m),l+=u}l-=p}},n.CreateParticlesFillShapeForGroup=function(t,n,r){var s=e.CreateParticlesFillShapeForGroup_s_aabb,a=e.CreateParticlesFillShapeForGroup_s_p,o=i(n.stride,0);0===o&&(o=this.GetParticleStride());var h=Bt.IDENTITY,u=s;t.ComputeAABB(u,h,0);for(var l=Math.floor(u.lowerBound.y/o)*o;l<u.upperBound.y;l+=o)for(var c=Math.floor(u.lowerBound.x/o)*o;c<u.upperBound.x;c+=o){var _=a.Set(c,l);t.TestPoint(h,_)&&this.CreateParticleForGroup(n,r,_)}},n.CreateParticlesWithShapeForGroup=function(e,i,n){switch(e.GetType()){case t.b2ShapeType.e_edgeShape:case t.b2ShapeType.e_chainShape:this.CreateParticlesStrokeShapeForGroup(e,i,n);break;case t.b2ShapeType.e_polygonShape:case t.b2ShapeType.e_circleShape:this.CreateParticlesFillShapeForGroup(e,i,n)}},n.CreateParticlesWithShapesForGroup=function(t,e,i,n){var r=new ps(t,e);this.CreateParticlesFillShapeForGroup(r,i,n)},n.CloneParticle=function(t,e){var i=new Br;i.flags=this.m_flagsBuffer.data[t],i.position.Copy(this.m_positionBuffer.data[t]),i.velocity.Copy(this.m_velocityBuffer.data[t]),this.m_colorBuffer.data&&i.color.Copy(this.m_colorBuffer.data[t]),this.m_userDataBuffer.data&&(i.userData=this.m_userDataBuffer.data[t]),i.group=e;var n=this.CreateParticle(i);if(this.m_handleIndexBuffer.data){var r=this.m_handleIndexBuffer.data[t];r&&r.SetIndex(n),this.m_handleIndexBuffer.data[n]=r,this.m_handleIndexBuffer.data[t]=null}return this.m_lastBodyContactStepBuffer.data&&(this.m_lastBodyContactStepBuffer.data[n]=this.m_lastBodyContactStepBuffer.data[t]),this.m_bodyContactCountBuffer.data&&(this.m_bodyContactCountBuffer.data[n]=this.m_bodyContactCountBuffer.data[t]),this.m_consecutiveContactStepsBuffer.data&&(this.m_consecutiveContactStepsBuffer.data[n]=this.m_consecutiveContactStepsBuffer.data[t]),this.m_hasForce&&this.m_forceBuffer[n].Copy(this.m_forceBuffer[t]),this.m_staticPressureBuffer&&(this.m_staticPressureBuffer[n]=this.m_staticPressureBuffer[t]),this.m_depthBuffer&&(this.m_depthBuffer[n]=this.m_depthBuffer[t]),this.m_expirationTimeBuffer.data&&(this.m_expirationTimeBuffer.data[n]=this.m_expirationTimeBuffer.data[t]),n},n.DestroyParticlesInGroup=function(t,e){void 0===e&&(e=!1);for(var i=t.m_firstIndex;i<t.m_lastIndex;i++)this.DestroyParticle(i,e)},n.DestroyParticleGroup=function(t){this.m_world.m_destructionListener&&this.m_world.m_destructionListener.SayGoodbyeParticleGroup(t),this.SetGroupFlags(t,0);for(var e=t.m_firstIndex;e<t.m_lastIndex;e++)this.m_groupBuffer[e]=null;t.m_prev&&(t.m_prev.m_next=t.m_next),t.m_next&&(t.m_next.m_prev=t.m_prev),t===this.m_groupList&&(this.m_groupList=t.m_next),--this.m_groupCount},e.ParticleCanBeConnected=function(e,i){return 0!=(e&(t.b2ParticleFlag.b2_wallParticle|t.b2ParticleFlag.b2_springParticle|t.b2ParticleFlag.b2_elasticParticle))||null!==i&&0!=(i.GetGroupFlags()&t.b2ParticleGroupFlag.b2_rigidParticleGroup)},n.UpdatePairsAndTriads=function(i,n,r){for(var s=e.UpdatePairsAndTriads_s_dab,a=e.UpdatePairsAndTriads_s_dbc,o=e.UpdatePairsAndTriads_s_dca,h=this.m_positionBuffer.data,u=0,l=i;l<n;l++)u|=this.m_flagsBuffer.data[l];if(u&e.k_pairFlags)for(var c=0;c<this.m_contactBuffer.count;c++){var _=this.m_contactBuffer.data[c],f=_.indexA,d=_.indexB,p=this.m_flagsBuffer.data[f],m=this.m_flagsBuffer.data[d],g=this.m_groupBuffer[f],y=this.m_groupBuffer[d];if(f>=i&&f<n&&d>=i&&d<n&&!((p|m)&t.b2ParticleFlag.b2_zombieParticle)&&(p|m)&e.k_pairFlags&&(r.IsNecessary(f)||r.IsNecessary(d))&&e.ParticleCanBeConnected(p,g)&&e.ParticleCanBeConnected(m,y)&&r.ShouldCreatePair(f,d)){var v=this.m_pairBuffer.data[this.m_pairBuffer.Append()];v.indexA=f,v.indexB=d,v.flags=_.flags,v.strength=rt(g?g.m_strength:1,y?y.m_strength:1),v.distance=bt.DistanceVV(h[f],h[d])}Hr(this.m_pairBuffer.data,0,this.m_pairBuffer.count,e.ComparePairIndices),this.m_pairBuffer.Unique(e.MatchPairIndices)}if(u&e.k_triadFlags){for(var S=new Fr(n-i),A=i;A<n;A++){var T=this.m_flagsBuffer.data[A],E=this.m_groupBuffer[A];T&t.b2ParticleFlag.b2_zombieParticle||!e.ParticleCanBeConnected(T,E)||S.AddGenerator(h[A],A,r.IsNecessary(A))}var b=this.GetParticleStride();S.Generate(b/2,2*b);var x=this,C=function(t,i,n){var u=x.m_flagsBuffer.data[t],l=x.m_flagsBuffer.data[i],c=x.m_flagsBuffer.data[n];if((u|l|c)&e.k_triadFlags&&r.ShouldCreateTriad(t,i,n)){var _=h[t],f=h[i],d=h[n],p=bt.SubVV(_,f,s),m=bt.SubVV(f,d,a),g=bt.SubVV(d,_,o),y=L*x.m_squaredDiameter;if(bt.DotVV(p,p)>y||bt.DotVV(m,m)>y||bt.DotVV(g,g)>y)return;var v=x.m_groupBuffer[t],S=x.m_groupBuffer[i],A=x.m_groupBuffer[n],T=x.m_triadBuffer.data[x.m_triadBuffer.Append()];T.indexA=t,T.indexB=i,T.indexC=n,T.flags=u|l|c,T.strength=rt(rt(v?v.m_strength:1,S?S.m_strength:1),A?A.m_strength:1);var E=(_.x+f.x+d.x)/3,b=(_.y+f.y+d.y)/3;T.pa.x=_.x-E,T.pa.y=_.y-b,T.pb.x=f.x-E,T.pb.y=f.y-b,T.pc.x=d.x-E,T.pc.y=d.y-b,T.ka=-bt.DotVV(g,p),T.kb=-bt.DotVV(p,m),T.kc=-bt.DotVV(m,g),T.s=bt.CrossVV(_,f)+bt.CrossVV(f,d)+bt.CrossVV(d,_)}};S.GetNodes(C),Hr(this.m_triadBuffer.data,0,this.m_triadBuffer.count,e.CompareTriadIndices),this.m_triadBuffer.Unique(e.MatchTriadIndices)}},n.UpdatePairsAndTriadsWithReactiveParticles=function(){var e=new ms(this.m_flagsBuffer);this.UpdatePairsAndTriads(0,this.m_count,e);for(var i=0;i<this.m_count;i++)this.m_flagsBuffer.data[i]&=~t.b2ParticleFlag.b2_reactiveParticle;this.m_allParticleFlags&=~t.b2ParticleFlag.b2_reactiveParticle},e.ComparePairIndices=function(t,e){var i=t.indexA-e.indexA;return 0!==i?i<0:t.indexB<e.indexB},e.MatchPairIndices=function(t,e){return t.indexA===e.indexA&&t.indexB===e.indexB},e.CompareTriadIndices=function(t,e){var i=t.indexA-e.indexA;if(0!==i)return i<0;var n=t.indexB-e.indexB;return 0!==n?n<0:t.indexC<e.indexC},e.MatchTriadIndices=function(t,e){return t.indexA===e.indexA&&t.indexB===e.indexB&&t.indexC===e.indexC},e.InitializeParticleLists=function(t,e){for(var i=t.GetBufferIndex(),n=t.GetParticleCount(),r=0;r<n;r++){var s=e[r];s.list=s,s.next=null,s.count=1,s.index=r+i}},n.MergeParticleListsInContact=function(t,i){for(var n=t.GetBufferIndex(),r=0;r<this.m_contactBuffer.count;r++){var s=this.m_contactBuffer.data[r],a=s.indexA,o=s.indexB;if(t.ContainsParticle(a)&&t.ContainsParticle(o)){var h=i[a-n].list,u=i[o-n].list;if(h!==u){if(h.count<u.count){var l=h;h=u,u=l}e.MergeParticleLists(h,u)}}}},e.MergeParticleLists=function(t,e){for(var i=e;;){i.list=t;var n=i.next;if(!n){i.next=t.next;break}i=n}t.next=e,t.count+=e.count,e.count=0},e.FindLongestParticleList=function(t,e){for(var i=t.GetParticleCount(),n=e[0],r=0;r<i;r++){var s=e[r];n.count<s.count&&(n=s)}return n},n.MergeZombieParticleListNodes=function(i,n,r){for(var s=i.GetParticleCount(),a=0;a<s;a++){var o=n[a];o!==r&&this.m_flagsBuffer.data[o.index]&t.b2ParticleFlag.b2_zombieParticle&&e.MergeParticleListAndNode(r,o)}},e.MergeParticleListAndNode=function(t,e){e.list=t,e.next=t.next,t.next=e,t.count++,e.count=0},n.CreateParticleGroupsFromParticleList=function(e,i,n){var r=e.GetParticleCount(),s=new Mr;s.groupFlags=e.GetGroupFlags(),s.userData=e.GetUserData();for(var a=0;a<r;a++){var o=i[a];if(o.count&&o!==n)for(var h=this.CreateParticleGroup(s),u=o;u;u=u.next){var l=u.index,c=this.CloneParticle(l,h);this.m_flagsBuffer.data[l]|=t.b2ParticleFlag.b2_zombieParticle,u.index=c}}},n.UpdatePairsAndTriadsWithParticleList=function(t,e){for(var i=t.GetBufferIndex(),n=0;n<this.m_pairBuffer.count;n++){var r=this.m_pairBuffer.data[n],s=r.indexA,a=r.indexB;t.ContainsParticle(s)&&(r.indexA=e[s-i].index),t.ContainsParticle(a)&&(r.indexB=e[a-i].index)}for(var o=0;o<this.m_triadBuffer.count;o++){var h=this.m_triadBuffer.data[o],u=h.indexA,l=h.indexB,c=h.indexC;t.ContainsParticle(u)&&(h.indexA=e[u-i].index),t.ContainsParticle(l)&&(h.indexB=e[l-i].index),t.ContainsParticle(c)&&(h.indexC=e[c-i].index)}},n.ComputeDepth=function(){for(var e=[],i=0,n=0;n<this.m_contactBuffer.count;n++){var s=this.m_contactBuffer.data[n],a=s.indexA,o=s.indexB,h=this.m_groupBuffer[a],u=this.m_groupBuffer[o];h&&h===u&&h.m_groupFlags&t.b2ParticleGroupFlag.b2_particleGroupNeedsUpdateDepth&&(e[i++]=s)}for(var l=[],c=0,_=this.m_groupList;_;_=_.GetNext())if(_.m_groupFlags&t.b2ParticleGroupFlag.b2_particleGroupNeedsUpdateDepth){l[c++]=_,this.SetGroupFlags(_,_.m_groupFlags&~t.b2ParticleGroupFlag.b2_particleGroupNeedsUpdateDepth);for(var f=_.m_firstIndex;f<_.m_lastIndex;f++)this.m_accumulationBuffer[f]=0}for(var d=0;d<i;d++){var p=e[d],m=p.indexA,g=p.indexB,y=p.weight;this.m_accumulationBuffer[m]+=y,this.m_accumulationBuffer[g]+=y}for(var v=0;v<c;v++)for(var S=l[v],A=S.m_firstIndex;A<S.m_lastIndex;A++){var T=this.m_accumulationBuffer[A];this.m_depthBuffer[A]=T<.8?0:r}for(var E=ct(this.m_count)>>0,b=0;b<E;b++){for(var x=!1,C=0;C<i;C++){var R=e[C],w=R.indexA,I=R.indexB,B=1-R.weight,D=this.m_depthBuffer[w],P=this.m_depthBuffer[I],O=P+B,M=D+B;D>O&&(this.m_depthBuffer[w]=O,x=!0),P>M&&(this.m_depthBuffer[I]=M,x=!0)}if(!x)break}for(var N=0;N<c;N++)for(var L=l[N],F=L.m_firstIndex;F<L.m_lastIndex;F++)this.m_depthBuffer[F]<r?this.m_depthBuffer[F]*=this.m_particleDiameter:this.m_depthBuffer[F]=0},n.GetInsideBoundsEnumerator=function(t){var i=e.computeTag(this.m_inverseDiameter*t.lowerBound.x-1,this.m_inverseDiameter*t.lowerBound.y-1),n=e.computeTag(this.m_inverseDiameter*t.upperBound.x+1,this.m_inverseDiameter*t.upperBound.y+1),r=0,s=this.m_proxyBuffer.count,a=Xr(this.m_proxyBuffer.data,r,s,i,rs.CompareProxyTag),o=jr(this.m_proxyBuffer.data,r,s,n,rs.CompareTagProxy);return new ss(this,i,n,a,o)},n.UpdateAllParticleFlags=function(){this.m_allParticleFlags=0;for(var t=0;t<this.m_count;t++)this.m_allParticleFlags|=this.m_flagsBuffer.data[t];this.m_needsUpdateAllParticleFlags=!1},n.UpdateAllGroupFlags=function(){this.m_allGroupFlags=0;for(var t=this.m_groupList;t;t=t.GetNext())this.m_allGroupFlags|=t.m_groupFlags;this.m_needsUpdateAllGroupFlags=!1},n.AddContact=function(t,i){var n=this.m_flagsBuffer.data,r=this.m_positionBuffer.data,s=bt.SubVV(r[i],r[t],e.AddContact_s_d),a=bt.DotVV(s,s);if(0<a&&a<this.m_squaredDiameter){var o=lt(a),h=this.m_contactBuffer.data[this.m_contactBuffer.Append()];h.indexA=t,h.indexB=i,h.flags=n[t]|n[i],h.weight=1-a*o*this.m_inverseDiameter,h.normal.x=o*s.x,h.normal.y=o*s.y}},n.FindContacts_Reference=function(){var t=0,i=this.m_proxyBuffer.count;this.m_contactBuffer.count=0;for(var n=t,r=t;n<i;n++){for(var s=e.computeRelativeTag(this.m_proxyBuffer.data[n].tag,1,0),a=n+1;a<i&&!(s<this.m_proxyBuffer.data[a].tag);a++)this.AddContact(this.m_proxyBuffer.data[n].index,this.m_proxyBuffer.data[a].index,this.m_contactBuffer);for(var o=e.computeRelativeTag(this.m_proxyBuffer.data[n].tag,-1,1);r<i&&!(o<=this.m_proxyBuffer.data[r].tag);r++);for(var h=e.computeRelativeTag(this.m_proxyBuffer.data[n].tag,1,1),u=r;u<i&&!(h<this.m_proxyBuffer.data[u].tag);u++)this.AddContact(this.m_proxyBuffer.data[n].index,this.m_proxyBuffer.data[u].index,this.m_contactBuffer)}},n.FindContacts=function(t){this.FindContacts_Reference(t)},n.UpdateProxies_Reference=function(){for(var t=this.m_positionBuffer.data,i=this.m_inverseDiameter,n=0;n<this.m_proxyBuffer.count;++n){var r=this.m_proxyBuffer.data[n],s=t[r.index];r.tag=e.computeTag(i*s.x,i*s.y)}},n.UpdateProxies=function(t){this.UpdateProxies_Reference(t)},n.SortProxies=function(){zr(this.m_proxyBuffer.data,0,this.m_proxyBuffer.count,rs.CompareProxyProxy)},n.FilterContacts=function(){var e=this.GetParticleContactFilter();if(null!==e){var i=this,n=function(n){return 0!=(n.flags&t.b2ParticleFlag.b2_particleContactFilterParticle)&&!e.ShouldCollideParticleParticle(i,n.indexA,n.indexB)};this.m_contactBuffer.RemoveIf(n)}},n.NotifyContactListenerPreContact=function(t){if(null!==this.GetParticleContactListener())throw t.Initialize(this.m_contactBuffer,this.m_flagsBuffer),new Error},n.NotifyContactListenerPostContact=function(){var t=this.GetParticleContactListener();if(null!==t){for(var e=0;e<this.m_contactBuffer.count;++e){var i=this.m_contactBuffer.data[e];t.BeginContactParticleParticle(this,i)}throw new Error}},e.b2ParticleContactIsZombie=function(e){return(e.flags&t.b2ParticleFlag.b2_zombieParticle)===t.b2ParticleFlag.b2_zombieParticle},n.UpdateContacts=function(t){this.UpdateProxies(this.m_proxyBuffer),this.SortProxies(this.m_proxyBuffer);var i=new cs;this.NotifyContactListenerPreContact(i),this.FindContacts(this.m_contactBuffer),this.FilterContacts(this.m_contactBuffer),this.NotifyContactListenerPostContact(i),t&&this.m_contactBuffer.RemoveIf(e.b2ParticleContactIsZombie)},n.NotifyBodyContactListenerPreContact=function(t){if(null!==this.GetFixtureContactListener())throw t.Initialize(this.m_bodyContactBuffer,this.m_flagsBuffer),new Error},n.NotifyBodyContactListenerPostContact=function(){var t=this.GetFixtureContactListener();if(null!==t){for(var e=0;e<this.m_bodyContactBuffer.count;e++){var i=this.m_bodyContactBuffer.data[e];t.BeginContactFixtureParticle(this,i)}throw new Error}},n.UpdateBodyContacts=function(){var t=e.UpdateBodyContacts_s_aabb,i=new us;if(this.NotifyBodyContactListenerPreContact(i),this.m_stuckThreshold>0)for(var n=this.GetParticleCount(),r=0;r<n;r++)this.m_bodyContactCountBuffer.data[r]=0,this.m_timestamp>this.m_lastBodyContactStepBuffer.data[r]+1&&(this.m_consecutiveContactStepsBuffer.data[r]=0);this.m_bodyContactBuffer.SetCount(0),this.m_stuckParticleBuffer.SetCount(0);var s=t;this.ComputeAABB(s),null===this.UpdateBodyContacts_callback&&(this.UpdateBodyContacts_callback=new gs(this));var a=this.UpdateBodyContacts_callback;a.m_contactFilter=this.GetFixtureContactFilter(),this.m_world.QueryAABB(a,s),this.m_def.strictContactCheck&&this.RemoveSpuriousBodyContacts(),this.NotifyBodyContactListenerPostContact(i)},n.Solve=function(i){var n=e.Solve_s_subStep;if(0!==this.m_count&&(this.m_expirationTimeBuffer.data&&this.SolveLifetimes(i),this.m_allParticleFlags&t.b2ParticleFlag.b2_zombieParticle&&this.SolveZombie(),this.m_needsUpdateAllParticleFlags&&this.UpdateAllParticleFlags(),this.m_needsUpdateAllGroupFlags&&this.UpdateAllGroupFlags(),!this.m_paused))for(this.m_iterationIndex=0;this.m_iterationIndex<i.particleIterations;this.m_iterationIndex++){++this.m_timestamp;var r=n.Copy(i);r.dt/=i.particleIterations,r.inv_dt*=i.particleIterations,this.UpdateContacts(!1),this.UpdateBodyContacts(),this.ComputeWeight(),this.m_allGroupFlags&t.b2ParticleGroupFlag.b2_particleGroupNeedsUpdateDepth&&this.ComputeDepth(),this.m_allParticleFlags&t.b2ParticleFlag.b2_reactiveParticle&&this.UpdatePairsAndTriadsWithReactiveParticles(),this.m_hasForce&&this.SolveForce(r),this.m_allParticleFlags&t.b2ParticleFlag.b2_viscousParticle&&this.SolveViscous(),this.m_allParticleFlags&t.b2ParticleFlag.b2_repulsiveParticle&&this.SolveRepulsive(r),this.m_allParticleFlags&t.b2ParticleFlag.b2_powderParticle&&this.SolvePowder(r),this.m_allParticleFlags&t.b2ParticleFlag.b2_tensileParticle&&this.SolveTensile(r),this.m_allGroupFlags&t.b2ParticleGroupFlag.b2_solidParticleGroup&&this.SolveSolid(r),this.m_allParticleFlags&t.b2ParticleFlag.b2_colorMixingParticle&&this.SolveColorMixing(),this.SolveGravity(r),this.m_allParticleFlags&t.b2ParticleFlag.b2_staticPressureParticle&&this.SolveStaticPressure(r),this.SolvePressure(r),this.SolveDamping(r),this.m_allParticleFlags&e.k_extraDampingFlags&&this.SolveExtraDamping(),this.m_allParticleFlags&t.b2ParticleFlag.b2_elasticParticle&&this.SolveElastic(r),this.m_allParticleFlags&t.b2ParticleFlag.b2_springParticle&&this.SolveSpring(r),this.LimitVelocity(r),this.m_allGroupFlags&t.b2ParticleGroupFlag.b2_rigidParticleGroup&&this.SolveRigidDamping(),this.m_allParticleFlags&t.b2ParticleFlag.b2_barrierParticle&&this.SolveBarrier(r),this.SolveCollision(r),this.m_allGroupFlags&t.b2ParticleGroupFlag.b2_rigidParticleGroup&&this.SolveRigid(r),this.m_allParticleFlags&t.b2ParticleFlag.b2_wallParticle&&this.SolveWall();for(var s=0;s<this.m_count;s++)this.m_positionBuffer.data[s].SelfMulAdd(r.dt,this.m_velocityBuffer.data[s])}},n.SolveCollision=function(t){var i=e.SolveCollision_s_aabb,n=this.m_positionBuffer.data,s=this.m_velocityBuffer.data,a=i;a.lowerBound.x=+r,a.lowerBound.y=+r,a.upperBound.x=-r,a.upperBound.y=-r;for(var o=0;o<this.m_count;o++){var h=s[o],u=n[o],l=u.x+t.dt*h.x,c=u.y+t.dt*h.y;a.lowerBound.x=rt(a.lowerBound.x,rt(u.x,l)),a.lowerBound.y=rt(a.lowerBound.y,rt(u.y,c)),a.upperBound.x=st(a.upperBound.x,st(u.x,l)),a.upperBound.y=st(a.upperBound.y,st(u.y,c))}null===this.SolveCollision_callback&&(this.SolveCollision_callback=new ys(this,t));var _=this.SolveCollision_callback;_.m_step=t,this.m_world.QueryAABB(_,a)},n.LimitVelocity=function(t){for(var e=this.m_velocityBuffer.data,i=this.GetCriticalVelocitySquared(t),n=0;n<this.m_count;n++){var r=e[n],s=bt.DotVV(r,r);s>i&&r.SelfMul(ct(i/s))}},n.SolveGravity=function(t){for(var i=e.SolveGravity_s_gravity,n=this.m_velocityBuffer.data,r=bt.MulSV(t.dt*this.m_def.gravityScale,this.m_world.GetGravity(),i),s=0;s<this.m_count;s++)n[s].SelfAdd(r)},n.SolveBarrier=function(i){for(var n=e.SolveBarrier_s_aabb,r=e.SolveBarrier_s_va,s=e.SolveBarrier_s_vb,a=e.SolveBarrier_s_pba,o=e.SolveBarrier_s_vba,h=e.SolveBarrier_s_vc,u=e.SolveBarrier_s_pca,l=e.SolveBarrier_s_vca,c=e.SolveBarrier_s_qba,_=e.SolveBarrier_s_qca,f=e.SolveBarrier_s_dv,d=e.SolveBarrier_s_f,p=this.m_positionBuffer.data,m=this.m_velocityBuffer.data,g=0;g<this.m_count;g++)0!=(this.m_flagsBuffer.data[g]&e.k_barrierWallFlags)&&m[g].SetZero();for(var y=k*i.dt,v=this.GetParticleMass(),S=0;S<this.m_pairBuffer.count;S++){var A=this.m_pairBuffer.data[S];if(A.flags&t.b2ParticleFlag.b2_barrierParticle){var T=A.indexA,E=A.indexB,b=p[T],x=p[E],C=n;bt.MinV(b,x,C.lowerBound),bt.MaxV(b,x,C.upperBound);for(var R=this.m_groupBuffer[T],w=this.m_groupBuffer[E],I=this.GetLinearVelocity(R,T,b,r),B=this.GetLinearVelocity(w,E,x,s),D=bt.SubVV(x,b,a),P=bt.SubVV(B,I,o),O=this.GetInsideBoundsEnumerator(C),M=void 0;(M=O.GetNext())>=0;){var N=p[M],L=this.m_groupBuffer[M];if(R!==L&&w!==L){var F=this.GetLinearVelocity(L,M,N,h),G=bt.SubVV(N,b,u),V=bt.SubVV(F,I,l),U=bt.CrossVV(P,V),z=bt.CrossVV(D,V)-bt.CrossVV(G,P),H=bt.CrossVV(D,G),W=void 0,X=void 0,j=c,Y=_;if(0===U){if(0===z)continue;if(!((X=-H/z)>=0&&X<y))continue;if(bt.AddVMulSV(D,X,P,j),bt.AddVMulSV(G,X,V,Y),!((W=bt.DotVV(j,Y)/bt.DotVV(j,j))>=0&&W<=1))continue}else{var q=z*z-4*H*U;if(q<0)continue;var K=ct(q),J=(-z-K)/(2*U),Q=(-z+K)/(2*U);if(J>Q){var Z=J;J=Q,Q=Z}if(X=J,bt.AddVMulSV(D,X,P,j),bt.AddVMulSV(G,X,V,Y),W=bt.DotVV(j,Y)/bt.DotVV(j,j),!(X>=0&&X<y&&W>=0&&W<=1)){if(!((X=Q)>=0&&X<y))continue;if(bt.AddVMulSV(D,X,P,j),bt.AddVMulSV(G,X,V,Y),!((W=bt.DotVV(j,Y)/bt.DotVV(j,j))>=0&&W<=1))continue}}var $=f;$.x=I.x+W*P.x-F.x,$.y=I.y+W*P.y-F.y;var tt=bt.MulSV(v,$,d);if(L&&this.IsRigidGroup(L)){var et=L.GetMass(),it=L.GetInertia();et>0&&L.m_linearVelocity.SelfMulAdd(1/et,tt),it>0&&(L.m_angularVelocity+=bt.CrossVV(bt.SubVV(N,L.GetCenter(),bt.s_t0),tt)/it)}else m[M].SelfAdd($);this.ParticleApplyForce(M,tt.SelfMul(-i.inv_dt))}}}}},n.SolveStaticPressure=function(e){this.m_staticPressureBuffer=this.RequestBuffer(this.m_staticPressureBuffer);for(var i=this.GetCriticalPressure(e),n=this.m_def.staticPressureStrength*i,r=O*i,s=this.m_def.staticPressureRelaxation,a=0;a<this.m_def.staticPressureIterations;a++){for(var o=0;o<this.m_count;o++)this.m_accumulationBuffer[o]=0;for(var h=0;h<this.m_contactBuffer.count;h++){var u=this.m_contactBuffer.data[h];if(u.flags&t.b2ParticleFlag.b2_staticPressureParticle){var l=u.indexA,c=u.indexB,_=u.weight;this.m_accumulationBuffer[l]+=_*this.m_staticPressureBuffer[c],this.m_accumulationBuffer[c]+=_*this.m_staticPressureBuffer[l]}}for(var f=0;f<this.m_count;f++){var d=this.m_weightBuffer[f];if(this.m_flagsBuffer.data[f]&t.b2ParticleFlag.b2_staticPressureParticle){var p=(this.m_accumulationBuffer[f]+n*(d-P))/(d+s);this.m_staticPressureBuffer[f]=at(p,0,r)}else this.m_staticPressureBuffer[f]=0}}},n.ComputeWeight=function(){for(var t=0;t<this.m_count;t++)this.m_weightBuffer[t]=0;for(var e=0;e<this.m_bodyContactBuffer.count;e++){var i=this.m_bodyContactBuffer.data[e],n=i.index,r=i.weight;this.m_weightBuffer[n]+=r}for(var s=0;s<this.m_contactBuffer.count;s++){var a=this.m_contactBuffer.data[s],o=a.indexA,h=a.indexB,u=a.weight;this.m_weightBuffer[o]+=u,this.m_weightBuffer[h]+=u}},n.SolvePressure=function(i){for(var n=e.SolvePressure_s_f,r=this.m_positionBuffer.data,s=this.m_velocityBuffer.data,a=this.GetCriticalPressure(i),o=this.m_def.pressureStrength*a,h=O*a,u=0;u<this.m_count;u++){var l=o*st(0,this.m_weightBuffer[u]-P);this.m_accumulationBuffer[u]=rt(l,h)}if(this.m_allParticleFlags&e.k_noPressureFlags)for(var c=0;c<this.m_count;c++)this.m_flagsBuffer.data[c]&e.k_noPressureFlags&&(this.m_accumulationBuffer[c]=0);if(this.m_allParticleFlags&t.b2ParticleFlag.b2_staticPressureParticle)for(var _=0;_<this.m_count;_++)this.m_flagsBuffer.data[_]&t.b2ParticleFlag.b2_staticPressureParticle&&(this.m_accumulationBuffer[_]+=this.m_staticPressureBuffer[_]);for(var f=i.dt/(this.m_def.density*this.m_particleDiameter),d=this.GetParticleInvMass(),p=0;p<this.m_bodyContactBuffer.count;p++){var m=this.m_bodyContactBuffer.data[p],g=m.index,y=m.body,v=m.weight,S=m.mass,A=m.normal,T=r[g],E=this.m_accumulationBuffer[g]+o*v,b=bt.MulSV(f*v*S*E,A,n);s[g].SelfMulSub(d,b),y.ApplyLinearImpulse(b,T,!0)}for(var x=0;x<this.m_contactBuffer.count;x++){var C=this.m_contactBuffer.data[x],R=C.indexA,w=C.indexB,I=C.weight,B=C.normal,D=this.m_accumulationBuffer[R]+this.m_accumulationBuffer[w],M=bt.MulSV(f*I*D,B,n);s[R].SelfSub(M),s[w].SelfAdd(M)}},n.SolveDamping=function(t){for(var i=e.SolveDamping_s_v,n=e.SolveDamping_s_f,r=this.m_positionBuffer.data,s=this.m_velocityBuffer.data,a=this.m_def.dampingStrength,o=1/this.GetCriticalVelocity(t),h=this.GetParticleInvMass(),u=0;u<this.m_bodyContactBuffer.count;u++){var l=this.m_bodyContactBuffer.data[u],c=l.index,_=l.body,f=l.weight,d=l.mass,p=l.normal,m=r[c],g=bt.SubVV(_.GetLinearVelocityFromWorldPoint(m,bt.s_t0),s[c],i),y=bt.DotVV(g,p);if(y<0){var v=st(a*f,rt(-o*y,.5)),S=bt.MulSV(v*d*y,p,n);s[c].SelfMulAdd(h,S),_.ApplyLinearImpulse(S.SelfNeg(),m,!0)}}for(var A=0;A<this.m_contactBuffer.count;A++){var T=this.m_contactBuffer.data[A],E=T.indexA,b=T.indexB,x=T.weight,C=T.normal,R=bt.SubVV(s[b],s[E],i),w=bt.DotVV(R,C);if(w<0){var I=st(a*x,rt(-o*w,.5)),B=bt.MulSV(I*w,C,n);s[E].SelfAdd(B),s[b].SelfSub(B)}}},n.SolveRigidDamping=function(){for(var t=e.SolveRigidDamping_s_t0,i=e.SolveRigidDamping_s_t1,n=e.SolveRigidDamping_s_p,r=e.SolveRigidDamping_s_v,s=[0],a=[0],o=[0],h=[0],u=[0],l=[0],c=this.m_positionBuffer.data,_=this.m_def.dampingStrength,f=0;f<this.m_bodyContactBuffer.count;f++){var d=this.m_bodyContactBuffer.data[f],p=d.index,m=this.m_groupBuffer[p];if(m&&this.IsRigidGroup(m)){var g=d.body,y=d.normal,v=d.weight,S=c[p],A=bt.SubVV(g.GetLinearVelocityFromWorldPoint(S,t),m.GetLinearVelocityFromWorldPoint(S,i),r),T=bt.DotVV(A,y);if(T<0){this.InitDampingParameterWithRigidGroupOrParticle(s,a,o,!0,m,p,S,y),this.InitDampingParameter(h,u,l,g.GetMass(),g.GetInertia()-g.GetMass()*g.GetLocalCenter().LengthSquared(),g.GetWorldCenter(),S,y);var E=_*rt(v,1)*this.ComputeDampingImpulse(s[0],a[0],o[0],h[0],u[0],l[0],T);this.ApplyDamping(s[0],a[0],o[0],!0,m,p,E,y),g.ApplyLinearImpulse(bt.MulSV(-E,y,bt.s_t0),S,!0)}}}for(var b=0;b<this.m_contactBuffer.count;b++){var x=this.m_contactBuffer.data[b],C=x.indexA,R=x.indexB,w=x.normal,I=x.weight,B=this.m_groupBuffer[C],D=this.m_groupBuffer[R],P=this.IsRigidGroup(B),O=this.IsRigidGroup(D);if(B!==D&&(P||O)){var M=bt.MidVV(c[C],c[R],n),N=bt.SubVV(this.GetLinearVelocity(D,R,M,t),this.GetLinearVelocity(B,C,M,i),r),L=bt.DotVV(N,w);if(L<0){this.InitDampingParameterWithRigidGroupOrParticle(s,a,o,P,B,C,M,w),this.InitDampingParameterWithRigidGroupOrParticle(h,u,l,O,D,R,M,w);var F=_*I*this.ComputeDampingImpulse(s[0],a[0],o[0],h[0],u[0],l[0],L);this.ApplyDamping(s[0],a[0],o[0],P,B,C,F,w),this.ApplyDamping(h[0],u[0],l[0],O,D,R,-F,w)}}}},n.SolveExtraDamping=function(){for(var t=e.SolveExtraDamping_s_v,i=e.SolveExtraDamping_s_f,n=this.m_velocityBuffer.data,r=this.m_positionBuffer.data,s=this.GetParticleInvMass(),a=0;a<this.m_bodyContactBuffer.count;a++){var o=this.m_bodyContactBuffer.data[a],h=o.index;if(this.m_flagsBuffer.data[h]&e.k_extraDampingFlags){var u=o.body,l=o.mass,c=o.normal,_=r[h],f=bt.SubVV(u.GetLinearVelocityFromWorldPoint(_,bt.s_t0),n[h],t),d=bt.DotVV(f,c);if(d<0){var p=bt.MulSV(.5*l*d,c,i);n[h].SelfMulAdd(s,p),u.ApplyLinearImpulse(p.SelfNeg(),_,!0)}}}},n.SolveWall=function(){for(var e=this.m_velocityBuffer.data,i=0;i<this.m_count;i++)this.m_flagsBuffer.data[i]&t.b2ParticleFlag.b2_wallParticle&&e[i].SetZero()},n.SolveRigid=function(i){for(var n=e.SolveRigid_s_position,r=e.SolveRigid_s_rotation,s=e.SolveRigid_s_transform,a=e.SolveRigid_s_velocityTransform,o=this.m_positionBuffer.data,h=this.m_velocityBuffer.data,u=this.m_groupList;u;u=u.GetNext())if(u.m_groupFlags&t.b2ParticleGroupFlag.b2_rigidParticleGroup){u.UpdateStatistics();var l=r;l.SetAngle(i.dt*u.m_angularVelocity);var c=bt.AddVV(u.m_center,bt.SubVV(bt.MulSV(i.dt,u.m_linearVelocity,bt.s_t0),It.MulRV(l,u.m_center,bt.s_t1),bt.s_t0),n),_=s;_.SetPositionRotation(c,l),Bt.MulXX(_,u.m_transform,u.m_transform);var f=a;f.p.x=i.inv_dt*_.p.x,f.p.y=i.inv_dt*_.p.y,f.q.s=i.inv_dt*_.q.s,f.q.c=i.inv_dt*(_.q.c-1);for(var d=u.m_firstIndex;d<u.m_lastIndex;d++)Bt.MulXV(f,o[d],h[d])}},n.SolveElastic=function(i){for(var n=e.SolveElastic_s_pa,r=e.SolveElastic_s_pb,s=e.SolveElastic_s_pc,a=e.SolveElastic_s_r,o=e.SolveElastic_s_t0,h=this.m_positionBuffer.data,u=this.m_velocityBuffer.data,l=i.inv_dt*this.m_def.elasticStrength,c=0;c<this.m_triadBuffer.count;c++){var _=this.m_triadBuffer.data[c];if(_.flags&t.b2ParticleFlag.b2_elasticParticle){var f=_.indexA,d=_.indexB,p=_.indexC,m=_.pa,g=_.pb,y=_.pc,v=n.Copy(h[f]),S=r.Copy(h[d]),A=s.Copy(h[p]),T=u[f],E=u[d],b=u[p];v.SelfMulAdd(i.dt,T),S.SelfMulAdd(i.dt,E),A.SelfMulAdd(i.dt,b);var x=(v.x+S.x+A.x)/3,C=(v.y+S.y+A.y)/3;v.x-=x,v.y-=C,S.x-=x,S.y-=C,A.x-=x,A.y-=C;var R=a;R.s=bt.CrossVV(m,v)+bt.CrossVV(g,S)+bt.CrossVV(y,A),R.c=bt.DotVV(m,v)+bt.DotVV(g,S)+bt.DotVV(y,A);var w=lt(R.s*R.s+R.c*R.c);isFinite(w)||(w=198177537e11),R.s*=w,R.c*=w;var I=l*_.strength;It.MulRV(R,m,o),bt.SubVV(o,v,o),bt.MulSV(I,o,o),T.SelfAdd(o),It.MulRV(R,g,o),bt.SubVV(o,S,o),bt.MulSV(I,o,o),E.SelfAdd(o),It.MulRV(R,y,o),bt.SubVV(o,A,o),bt.MulSV(I,o,o),b.SelfAdd(o)}}},n.SolveSpring=function(i){for(var n=e.SolveSpring_s_pa,r=e.SolveSpring_s_pb,s=e.SolveSpring_s_d,a=e.SolveSpring_s_f,o=this.m_positionBuffer.data,h=this.m_velocityBuffer.data,u=i.inv_dt*this.m_def.springStrength,l=0;l<this.m_pairBuffer.count;l++){var c=this.m_pairBuffer.data[l];if(c.flags&t.b2ParticleFlag.b2_springParticle){var _=c.indexA,f=c.indexB,d=n.Copy(o[_]),p=r.Copy(o[f]),m=h[_],g=h[f];d.SelfMulAdd(i.dt,m),p.SelfMulAdd(i.dt,g);var y=bt.SubVV(p,d,s),v=c.distance,S=y.Length(),A=u*c.strength,T=bt.MulSV(A*(v-S)/S,y,a);m.SelfSub(T),g.SelfAdd(T)}}},n.SolveTensile=function(i){for(var n=e.SolveTensile_s_weightedNormal,r=e.SolveTensile_s_s,s=e.SolveTensile_s_f,a=this.m_velocityBuffer.data,o=0;o<this.m_count;o++)this.m_accumulation2Buffer[o]=new bt,this.m_accumulation2Buffer[o].SetZero();for(var h=0;h<this.m_contactBuffer.count;h++){var u=this.m_contactBuffer.data[h];if(u.flags&t.b2ParticleFlag.b2_tensileParticle){var l=u.indexA,c=u.indexB,_=u.weight,f=u.normal,d=bt.MulSV((1-_)*_,f,n);this.m_accumulation2Buffer[l].SelfSub(d),this.m_accumulation2Buffer[c].SelfAdd(d)}}for(var p=this.GetCriticalVelocity(i),m=this.m_def.surfaceTensionPressureStrength*p,g=this.m_def.surfaceTensionNormalStrength*p,y=M*p,v=0;v<this.m_contactBuffer.count;v++){var S=this.m_contactBuffer.data[v];if(S.flags&t.b2ParticleFlag.b2_tensileParticle){var A=S.indexA,T=S.indexB,E=S.weight,b=S.normal,x=this.m_weightBuffer[A]+this.m_weightBuffer[T],C=bt.SubVV(this.m_accumulation2Buffer[T],this.m_accumulation2Buffer[A],r),R=rt(m*(x-2)+g*bt.DotVV(C,b),y)*E,w=bt.MulSV(R,b,s);a[A].SelfSub(w),a[T].SelfAdd(w)}}},n.SolveViscous=function(){for(var i=e.SolveViscous_s_v,n=e.SolveViscous_s_f,r=this.m_positionBuffer.data,s=this.m_velocityBuffer.data,a=this.m_def.viscousStrength,o=this.GetParticleInvMass(),h=0;h<this.m_bodyContactBuffer.count;h++){var u=this.m_bodyContactBuffer.data[h],l=u.index;if(this.m_flagsBuffer.data[l]&t.b2ParticleFlag.b2_viscousParticle){var c=u.body,_=u.weight,f=u.mass,d=r[l],p=bt.SubVV(c.GetLinearVelocityFromWorldPoint(d,bt.s_t0),s[l],i),m=bt.MulSV(a*f*_,p,n);s[l].SelfMulAdd(o,m),c.ApplyLinearImpulse(m.SelfNeg(),d,!0)}}for(var g=0;g<this.m_contactBuffer.count;g++){var y=this.m_contactBuffer.data[g];if(y.flags&t.b2ParticleFlag.b2_viscousParticle){var v=y.indexA,S=y.indexB,A=y.weight,T=bt.SubVV(s[S],s[v],i),E=bt.MulSV(a*A,T,n);s[v].SelfAdd(E),s[S].SelfSub(E)}}},n.SolveRepulsive=function(i){for(var n=e.SolveRepulsive_s_f,r=this.m_velocityBuffer.data,s=this.m_def.repulsiveStrength*this.GetCriticalVelocity(i),a=0;a<this.m_contactBuffer.count;a++){var o=this.m_contactBuffer.data[a];if(o.flags&t.b2ParticleFlag.b2_repulsiveParticle){var h=o.indexA,u=o.indexB;if(this.m_groupBuffer[h]!==this.m_groupBuffer[u]){var l=o.weight,c=o.normal,_=bt.MulSV(s*l,c,n);r[h].SelfSub(_),r[u].SelfAdd(_)}}}},n.SolvePowder=function(i){for(var n=e.SolvePowder_s_f,r=this.m_positionBuffer.data,s=this.m_velocityBuffer.data,a=this.m_def.powderStrength*this.GetCriticalVelocity(i),o=1-D,h=this.GetParticleInvMass(),u=0;u<this.m_bodyContactBuffer.count;u++){var l=this.m_bodyContactBuffer.data[u],c=l.index;if(this.m_flagsBuffer.data[c]&t.b2ParticleFlag.b2_powderParticle){var _=l.weight;if(_>o){var f=l.body,d=l.mass,p=r[c],m=l.normal,g=bt.MulSV(a*d*(_-o),m,n);s[c].SelfMulSub(h,g),f.ApplyLinearImpulse(g,p,!0)}}}for(var y=0;y<this.m_contactBuffer.count;y++){var v=this.m_contactBuffer.data[y];if(v.flags&t.b2ParticleFlag.b2_powderParticle){var S=v.weight;if(S>o){var A=v.indexA,T=v.indexB,E=v.normal,b=bt.MulSV(a*(S-o),E,n);s[A].SelfSub(b),s[T].SelfAdd(b)}}}},n.SolveSolid=function(t){var i=e.SolveSolid_s_f,n=this.m_velocityBuffer.data;this.m_depthBuffer=this.RequestBuffer(this.m_depthBuffer);for(var r=t.inv_dt*this.m_def.ejectionStrength,s=0;s<this.m_contactBuffer.count;s++){var a=this.m_contactBuffer.data[s],o=a.indexA,h=a.indexB;if(this.m_groupBuffer[o]!==this.m_groupBuffer[h]){var u=a.weight,l=a.normal,c=this.m_depthBuffer[o]+this.m_depthBuffer[h],_=bt.MulSV(r*c*u,l,i);n[o].SelfSub(_),n[h].SelfAdd(_)}}},n.SolveForce=function(t){for(var e=this.m_velocityBuffer.data,i=t.dt*this.GetParticleInvMass(),n=0;n<this.m_count;n++)e[n].SelfMulAdd(i,this.m_forceBuffer[n]);this.m_hasForce=!1},n.SolveColorMixing=function(){var e=.5*this.m_def.colorMixingStrength;if(e)for(var i=0;i<this.m_contactBuffer.count;i++){var n=this.m_contactBuffer.data[i],r=n.indexA,s=n.indexB;if(this.m_flagsBuffer.data[r]&this.m_flagsBuffer.data[s]&t.b2ParticleFlag.b2_colorMixingParticle){var a=this.m_colorBuffer.data[r],o=this.m_colorBuffer.data[s];Ot.MixColors(a,o,e)}}},n.SolveZombie=function(){for(var e=0,i=[],n=0;n<this.m_count;n++)i[n]=I;for(var r=0,s=0;s<this.m_count;s++){var a=this.m_flagsBuffer.data[s];if(a&t.b2ParticleFlag.b2_zombieParticle){var o=this.m_world.m_destructionListener;if(a&t.b2ParticleFlag.b2_destructionListenerParticle&&o&&o.SayGoodbyeParticle(this,s),this.m_handleIndexBuffer.data){var h=this.m_handleIndexBuffer.data[s];h&&(h.SetIndex(I),this.m_handleIndexBuffer.data[s]=null)}i[s]=I}else{if(i[s]=e,s!==e){if(this.m_handleIndexBuffer.data){var u=this.m_handleIndexBuffer.data[s];u&&u.SetIndex(e),this.m_handleIndexBuffer.data[e]=u}this.m_flagsBuffer.data[e]=this.m_flagsBuffer.data[s],this.m_lastBodyContactStepBuffer.data&&(this.m_lastBodyContactStepBuffer.data[e]=this.m_lastBodyContactStepBuffer.data[s]),this.m_bodyContactCountBuffer.data&&(this.m_bodyContactCountBuffer.data[e]=this.m_bodyContactCountBuffer.data[s]),this.m_consecutiveContactStepsBuffer.data&&(this.m_consecutiveContactStepsBuffer.data[e]=this.m_consecutiveContactStepsBuffer.data[s]),this.m_positionBuffer.data[e].Copy(this.m_positionBuffer.data[s]),this.m_velocityBuffer.data[e].Copy(this.m_velocityBuffer.data[s]),this.m_groupBuffer[e]=this.m_groupBuffer[s],this.m_hasForce&&this.m_forceBuffer[e].Copy(this.m_forceBuffer[s]),this.m_staticPressureBuffer&&(this.m_staticPressureBuffer[e]=this.m_staticPressureBuffer[s]),this.m_depthBuffer&&(this.m_depthBuffer[e]=this.m_depthBuffer[s]),this.m_colorBuffer.data&&this.m_colorBuffer.data[e].Copy(this.m_colorBuffer.data[s]),this.m_userDataBuffer.data&&(this.m_userDataBuffer.data[e]=this.m_userDataBuffer.data[s]),this.m_expirationTimeBuffer.data&&(this.m_expirationTimeBuffer.data[e]=this.m_expirationTimeBuffer.data[s])}e++,r|=a}}for(var l={IsProxyInvalid:function(t){return t.index<0},IsContactInvalid:function(t){return t.indexA<0||t.indexB<0},IsBodyContactInvalid:function(t){return t.index<0},IsPairInvalid:function(t){return t.indexA<0||t.indexB<0},IsTriadInvalid:function(t){return t.indexA<0||t.indexB<0||t.indexC<0}},c=0;c<this.m_proxyBuffer.count;c++){var _=this.m_proxyBuffer.data[c];_.index=i[_.index]}this.m_proxyBuffer.RemoveIf(l.IsProxyInvalid);for(var f=0;f<this.m_contactBuffer.count;f++){var d=this.m_contactBuffer.data[f];d.indexA=i[d.indexA],d.indexB=i[d.indexB]}this.m_contactBuffer.RemoveIf(l.IsContactInvalid);for(var p=0;p<this.m_bodyContactBuffer.count;p++){var m=this.m_bodyContactBuffer.data[p];m.index=i[m.index]}this.m_bodyContactBuffer.RemoveIf(l.IsBodyContactInvalid);for(var g=0;g<this.m_pairBuffer.count;g++){var y=this.m_pairBuffer.data[g];y.indexA=i[y.indexA],y.indexB=i[y.indexB]}this.m_pairBuffer.RemoveIf(l.IsPairInvalid);for(var v=0;v<this.m_triadBuffer.count;v++){var S=this.m_triadBuffer.data[v];S.indexA=i[S.indexA],S.indexB=i[S.indexB],S.indexC=i[S.indexC]}if(this.m_triadBuffer.RemoveIf(l.IsTriadInvalid),this.m_indexByExpirationTimeBuffer.data)for(var A=0,T=0;T<this.m_count;T++){var E=i[this.m_indexByExpirationTimeBuffer.data[T]];E!==I&&(this.m_indexByExpirationTimeBuffer.data[A++]=E)}for(var b=this.m_groupList;b;b=b.GetNext()){for(var x=e,C=0,R=!1,w=b.m_firstIndex;w<b.m_lastIndex;w++){var B=i[w];B>=0?(x=rt(x,B),C=st(C,B+1)):R=!0}x<C?(b.m_firstIndex=x,b.m_lastIndex=C,R&&b.m_groupFlags&t.b2ParticleGroupFlag.b2_solidParticleGroup&&this.SetGroupFlags(b,b.m_groupFlags|t.b2ParticleGroupFlag.b2_particleGroupNeedsUpdateDepth)):(b.m_firstIndex=0,b.m_lastIndex=0,b.m_groupFlags&t.b2ParticleGroupFlag.b2_particleGroupCanBeEmpty||this.SetGroupFlags(b,b.m_groupFlags|t.b2ParticleGroupFlag.b2_particleGroupWillBeDestroyed))}this.m_count=e,this.m_allParticleFlags=r,this.m_needsUpdateAllParticleFlags=!1;for(var D=this.m_groupList;D;){var P=D.GetNext();D.m_groupFlags&t.b2ParticleGroupFlag.b2_particleGroupWillBeDestroyed&&this.DestroyParticleGroup(D),D=P}},n.SolveLifetimes=function(t){this.m_timeElapsed=this.LifetimeToExpirationTime(t.dt);var e=this.GetQuantizedTimeElapsed(),i=this.m_expirationTimeBuffer.data,n=this.m_indexByExpirationTimeBuffer.data,r=this.GetParticleCount();this.m_expirationTimeBufferRequiresSorting&&(zr(n,0,r,(function(t,e){var n=i[t],r=i[e],s=n<=0;return s===r<=0?n>r:s})),this.m_expirationTimeBufferRequiresSorting=!1);for(var s=r-1;s>=0;--s){var a=n[s],o=i[a];if(e<o||o<=0)break;this.DestroyParticle(a)}},n.RotateBuffer=function(t,e,i){if(t!==e&&e!==i){if(Yr(this.m_flagsBuffer.data,t,e,i),this.m_lastBodyContactStepBuffer.data&&Yr(this.m_lastBodyContactStepBuffer.data,t,e,i),this.m_bodyContactCountBuffer.data&&Yr(this.m_bodyContactCountBuffer.data,t,e,i),this.m_consecutiveContactStepsBuffer.data&&Yr(this.m_consecutiveContactStepsBuffer.data,t,e,i),Yr(this.m_positionBuffer.data,t,e,i),Yr(this.m_velocityBuffer.data,t,e,i),Yr(this.m_groupBuffer,t,e,i),this.m_hasForce&&Yr(this.m_forceBuffer,t,e,i),this.m_staticPressureBuffer&&Yr(this.m_staticPressureBuffer,t,e,i),this.m_depthBuffer&&Yr(this.m_depthBuffer,t,e,i),this.m_colorBuffer.data&&Yr(this.m_colorBuffer.data,t,e,i),this.m_userDataBuffer.data&&Yr(this.m_userDataBuffer.data,t,e,i),this.m_handleIndexBuffer.data){Yr(this.m_handleIndexBuffer.data,t,e,i);for(var n=t;n<i;++n){var r=this.m_handleIndexBuffer.data[n];r&&r.SetIndex(v(r.GetIndex()))}}if(this.m_expirationTimeBuffer.data){Yr(this.m_expirationTimeBuffer.data,t,e,i);for(var s=this.GetParticleCount(),a=this.m_indexByExpirationTimeBuffer.data,o=0;o<s;++o)a[o]=v(a[o])}for(var h=0;h<this.m_proxyBuffer.count;h++){var u=this.m_proxyBuffer.data[h];u.index=v(u.index)}for(var l=0;l<this.m_contactBuffer.count;l++){var c=this.m_contactBuffer.data[l];c.indexA=v(c.indexA),c.indexB=v(c.indexB)}for(var _=0;_<this.m_bodyContactBuffer.count;_++){var f=this.m_bodyContactBuffer.data[_];f.index=v(f.index)}for(var d=0;d<this.m_pairBuffer.count;d++){var p=this.m_pairBuffer.data[d];p.indexA=v(p.indexA),p.indexB=v(p.indexB)}for(var m=0;m<this.m_triadBuffer.count;m++){var g=this.m_triadBuffer.data[m];g.indexA=v(g.indexA),g.indexB=v(g.indexB),g.indexC=v(g.indexC)}for(var y=this.m_groupList;y;y=y.GetNext())y.m_firstIndex=v(y.m_firstIndex),y.m_lastIndex=v(y.m_lastIndex-1)+1}function v(n){return n<t?n:n<e?n+i-e:n<i?n+t-e:n}},n.GetCriticalVelocity=function(t){return this.m_particleDiameter*t.inv_dt},n.GetCriticalVelocitySquared=function(t){var e=this.GetCriticalVelocity(t);return e*e},n.GetCriticalPressure=function(t){return this.m_def.density*this.GetCriticalVelocitySquared(t)},n.GetParticleStride=function(){return D*this.m_particleDiameter},n.GetParticleMass=function(){var t=this.GetParticleStride();return this.m_def.density*t*t},n.GetParticleInvMass=function(){var t=this.m_inverseDiameter*(1/D);return this.m_inverseDensity*t*t},n.GetFixtureContactFilter=function(){return this.m_allParticleFlags&t.b2ParticleFlag.b2_fixtureContactFilterParticle?this.m_world.m_contactManager.m_contactFilter:null},n.GetParticleContactFilter=function(){return this.m_allParticleFlags&t.b2ParticleFlag.b2_particleContactFilterParticle?this.m_world.m_contactManager.m_contactFilter:null},n.GetFixtureContactListener=function(){return this.m_allParticleFlags&t.b2ParticleFlag.b2_fixtureContactListenerParticle?this.m_world.m_contactManager.m_contactListener:null},n.GetParticleContactListener=function(){return this.m_allParticleFlags&t.b2ParticleFlag.b2_particleContactListenerParticle?this.m_world.m_contactManager.m_contactListener:null},n.SetUserOverridableBuffer=function(t,e){t.data=e,t.userSuppliedCapacity=e.length},n.SetGroupFlags=function(e,i){var n=e.m_groupFlags;(n^i)&t.b2ParticleGroupFlag.b2_solidParticleGroup&&(i|=t.b2ParticleGroupFlag.b2_particleGroupNeedsUpdateDepth),n&~i&&(this.m_needsUpdateAllGroupFlags=!0),~this.m_allGroupFlags&i&&(i&t.b2ParticleGroupFlag.b2_solidParticleGroup&&(this.m_depthBuffer=this.RequestBuffer(this.m_depthBuffer)),this.m_allGroupFlags|=i),e.m_groupFlags=i},e.BodyContactCompare=function(t,e){return t.index===e.index?t.weight>e.weight:t.index<e.index},n.RemoveSpuriousBodyContacts=function(){zr(this.m_bodyContactBuffer.data,0,this.m_bodyContactBuffer.count,e.BodyContactCompare);var t=e.RemoveSpuriousBodyContacts_s_n,i=e.RemoveSpuriousBodyContacts_s_pos,n=e.RemoveSpuriousBodyContacts_s_normal,r=3,s=this,a=-1,o=0,h=function(e){if(e.index!==a&&(o=0,a=e.index),o++>r)return!0;var h=t.Copy(e.normal);h.SelfMul(s.m_particleDiameter*(1-e.weight));var u=bt.AddVV(s.m_positionBuffer.data[e.index],h,i);if(!e.fixture.TestPoint(u)){for(var l=e.fixture.GetShape().GetChildCount(),c=0;c<l;c++){var _=n;if(e.fixture.ComputeDistance(u,_,c)<p)return!1}return!0}return!1};this.m_bodyContactBuffer.count=Wr(this.m_bodyContactBuffer.data,h,this.m_bodyContactBuffer.count)},n.DetectStuckParticle=function(t){this.m_stuckThreshold<=0||(++this.m_bodyContactCountBuffer.data[t],2===this.m_bodyContactCountBuffer.data[t]&&(++this.m_consecutiveContactStepsBuffer.data[t],this.m_consecutiveContactStepsBuffer.data[t]>this.m_stuckThreshold&&(this.m_stuckParticleBuffer.data[this.m_stuckParticleBuffer.Append()]=t)),this.m_lastBodyContactStepBuffer.data[t]=this.m_timestamp)},n.ValidateParticleIndex=function(t){return t>=0&&t<this.GetParticleCount()&&t!==I},n.GetQuantizedTimeElapsed=function(){return Math.floor(this.m_timeElapsed/4294967296)},n.LifetimeToExpirationTime=function(t){return this.m_timeElapsed+Math.floor(t/this.m_def.lifetimeGranularity*4294967296)},n.ForceCanBeApplied=function(e){return!(e&t.b2ParticleFlag.b2_wallParticle)},n.PrepareForceBuffer=function(){if(!this.m_hasForce){for(var t=0;t<this.m_count;t++)this.m_forceBuffer[t].SetZero();this.m_hasForce=!0}},n.IsRigidGroup=function(e){return null!==e&&0!=(e.m_groupFlags&t.b2ParticleGroupFlag.b2_rigidParticleGroup)},n.GetLinearVelocity=function(t,e,i,n){return t&&this.IsRigidGroup(t)?t.GetLinearVelocityFromWorldPoint(i,n):n.Copy(this.m_velocityBuffer.data[e])},n.InitDampingParameter=function(t,e,i,n,r,s,a,o){t[0]=n>0?1/n:0,e[0]=r>0?1/r:0,i[0]=bt.CrossVV(bt.SubVV(a,s,bt.s_t0),o)},n.InitDampingParameterWithRigidGroupOrParticle=function(e,i,n,r,s,a,o,h){if(s&&r)this.InitDampingParameter(e,i,n,s.GetMass(),s.GetInertia(),s.GetCenter(),o,h);else{var u=this.m_flagsBuffer.data[a];this.InitDampingParameter(e,i,n,u&t.b2ParticleFlag.b2_wallParticle?0:this.GetParticleMass(),0,o,o,h)}},n.ComputeDampingImpulse=function(t,e,i,n,r,s,a){var o=t+e*i*i+n+r*s*s;return o>0?a/o:0},n.ApplyDamping=function(t,e,i,n,r,s,a,o){r&&n?(r.m_linearVelocity.SelfMulAdd(a*t,o),r.m_angularVelocity+=a*i*e):this.m_velocityBuffer.data[s].SelfMulAdd(a*t,o)},e}();is.xTruncBits=12,is.yTruncBits=12,is.tagBits=32,is.yOffset=1<<is.yTruncBits-1,is.yShift=is.tagBits-is.yTruncBits,is.xShift=is.tagBits-is.yTruncBits-is.xTruncBits,is.xScale=1<<is.xShift,is.xOffset=is.xScale*(1<<is.xTruncBits-1),is.yMask=(1<<is.yTruncBits)-1<<is.yShift,is.xMask=~is.yMask,is.DestroyParticlesInShape_s_aabb=new xe,is.CreateParticleGroup_s_transform=new Bt,is.ComputeCollisionEnergy_s_v=new bt,is.QueryShapeAABB_s_aabb=new xe,is.QueryPointAABB_s_aabb=new xe,is.RayCast_s_aabb=new xe,is.RayCast_s_p=new bt,is.RayCast_s_v=new bt,is.RayCast_s_n=new bt,is.RayCast_s_point=new bt,is.k_pairFlags=t.b2ParticleFlag.b2_springParticle,is.k_triadFlags=t.b2ParticleFlag.b2_elasticParticle,is.k_noPressureFlags=t.b2ParticleFlag.b2_powderParticle|t.b2ParticleFlag.b2_tensileParticle,is.k_extraDampingFlags=t.b2ParticleFlag.b2_staticPressureParticle,is.k_barrierWallFlags=t.b2ParticleFlag.b2_barrierParticle|t.b2ParticleFlag.b2_wallParticle,is.CreateParticlesStrokeShapeForGroup_s_edge=new ln,is.CreateParticlesStrokeShapeForGroup_s_d=new bt,is.CreateParticlesStrokeShapeForGroup_s_p=new bt,is.CreateParticlesFillShapeForGroup_s_aabb=new xe,is.CreateParticlesFillShapeForGroup_s_p=new bt,is.UpdatePairsAndTriads_s_dab=new bt,is.UpdatePairsAndTriads_s_dbc=new bt,is.UpdatePairsAndTriads_s_dca=new bt,is.AddContact_s_d=new bt,is.UpdateBodyContacts_s_aabb=new xe,is.Solve_s_subStep=new gr,is.SolveCollision_s_aabb=new xe,is.SolveGravity_s_gravity=new bt,is.SolveBarrier_s_aabb=new xe,is.SolveBarrier_s_va=new bt,is.SolveBarrier_s_vb=new bt,is.SolveBarrier_s_pba=new bt,is.SolveBarrier_s_vba=new bt,is.SolveBarrier_s_vc=new bt,is.SolveBarrier_s_pca=new bt,is.SolveBarrier_s_vca=new bt,is.SolveBarrier_s_qba=new bt,is.SolveBarrier_s_qca=new bt,is.SolveBarrier_s_dv=new bt,is.SolveBarrier_s_f=new bt,is.SolvePressure_s_f=new bt,is.SolveDamping_s_v=new bt,is.SolveDamping_s_f=new bt,is.SolveRigidDamping_s_t0=new bt,is.SolveRigidDamping_s_t1=new bt,is.SolveRigidDamping_s_p=new bt,is.SolveRigidDamping_s_v=new bt,is.SolveExtraDamping_s_v=new bt,is.SolveExtraDamping_s_f=new bt,is.SolveRigid_s_position=new bt,is.SolveRigid_s_rotation=new It,is.SolveRigid_s_transform=new Bt,is.SolveRigid_s_velocityTransform=new Bt,is.SolveElastic_s_pa=new bt,is.SolveElastic_s_pb=new bt,is.SolveElastic_s_pc=new bt,is.SolveElastic_s_r=new It,is.SolveElastic_s_t0=new bt,is.SolveSpring_s_pa=new bt,is.SolveSpring_s_pb=new bt,is.SolveSpring_s_d=new bt,is.SolveSpring_s_f=new bt,is.SolveTensile_s_weightedNormal=new bt,is.SolveTensile_s_s=new bt,is.SolveTensile_s_f=new bt,is.SolveViscous_s_v=new bt,is.SolveViscous_s_f=new bt,is.SolveRepulsive_s_f=new bt,is.SolvePowder_s_f=new bt,is.SolveSolid_s_f=new bt,is.RemoveSpuriousBodyContacts_s_n=new bt,is.RemoveSpuriousBodyContacts_s_pos=new bt,is.RemoveSpuriousBodyContacts_s_normal=new bt;var ns=function(){function t(){this._data=null,this.userSuppliedCapacity=0}return n(t,[{key:"data",get:function(){return this._data},set:function(t){this._data=t}}]),t}(),rs=function(){function t(){this.index=I,this.tag=0}return t.CompareProxyProxy=function(t,e){return t.tag<e.tag},t.CompareTagProxy=function(t,e){return t<e.tag},t.CompareProxyTag=function(t,e){return t.tag<e},t}(),ss=function(){function t(t,e,i,n,r){this.m_system=t,this.m_xLower=(e&is.xMask)>>>0,this.m_xUpper=(i&is.xMask)>>>0,this.m_yLower=(e&is.yMask)>>>0,this.m_yUpper=(i&is.yMask)>>>0,this.m_first=n,this.m_last=r}return t.prototype.GetNext=function(){for(;this.m_first<this.m_last;){var t=(this.m_system.m_proxyBuffer.data[this.m_first].tag&is.xMask)>>>0;if(t>=this.m_xLower&&t<=this.m_xUpper)return this.m_system.m_proxyBuffer.data[this.m_first++].index;this.m_first++}return I},t}(),as=function(){this.next=null,this.count=0,this.index=0},os=function(){function t(){}var e=t.prototype;return e.Allocate=function(t,e){return e},e.Clear=function(){},e.GetCount=function(){return 0},e.Invalidate=function(){},e.GetValidBuffer=function(){return[]},e.GetBuffer=function(){return[]},e.SetCount=function(){},t}(),hs=function(t,e){this.second=I,this.first=t,this.second=e},us=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.Initialize=function(){},i.Find=function(){return I},e}(os),ls=function(t,e){this.first=I,this.second=I,this.first=t,this.second=e},cs=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.Initialize=function(){},i.Find=function(){return I},e}(os),_s=function(){function t(){}var e=t.prototype;return e.IsNecessary=function(){return!0},e.ShouldCreatePair=function(){return!0},e.ShouldCreateTriad=function(){return!0},t}(),fs=function(t){function e(e,i,n,r){var s;return(s=t.call(this)||this).m_callDestructionListener=!1,s.m_destroyed=0,s.m_system=e,s.m_shape=i,s.m_xf=n,s.m_callDestructionListener=r,s.m_destroyed=0,s}s(e,t);var i=e.prototype;return i.ReportFixture=function(){return!1},i.ReportParticle=function(t,e){return t===this.m_system&&(this.m_shape.TestPoint(this.m_xf,this.m_system.m_positionBuffer.data[e])&&(this.m_system.DestroyParticle(e,this.m_callDestructionListener),this.m_destroyed++),!0)},i.Destroyed=function(){return this.m_destroyed},e}(fr),ds=function(t){function e(e){var i;return(i=t.call(this)||this).m_threshold=0,i.m_threshold=e,i}s(e,t);var i=e.prototype;return i.ShouldCreatePair=function(t,e){return t<this.m_threshold&&this.m_threshold<=e||e<this.m_threshold&&this.m_threshold<=t},i.ShouldCreateTriad=function(t,e,i){return(t<this.m_threshold||e<this.m_threshold||i<this.m_threshold)&&(this.m_threshold<=t||this.m_threshold<=e||this.m_threshold<=i)},e}(_s),ps=function(e){function i(i,n){var r;return void 0===n&&(n=i.length),(r=e.call(this,t.b2ShapeType.e_unknown,0)||this).m_shapeCount=0,r.m_shapes=i,r.m_shapeCount=n,r}s(i,e);var n=i.prototype;return n.Clone=function(){throw new Error},n.GetChildCount=function(){return 1},n.TestPoint=function(t,e){for(var i=0;i<this.m_shapeCount;i++)if(this.m_shapes[i].TestPoint(t,e))return!0;return!1},n.ComputeDistance=function(){return 0},n.RayCast=function(){return!1},n.ComputeAABB=function(t,e){var i=new xe;t.lowerBound.x=+r,t.lowerBound.y=+r,t.upperBound.x=-r,t.upperBound.y=-r;for(var n=0;n<this.m_shapeCount;n++)for(var s=this.m_shapes[n].GetChildCount(),a=0;a<s;a++){var o=i;this.m_shapes[n].ComputeAABB(o,e,a),t.Combine1(o)}},n.ComputeMass=function(){},n.SetupDistanceProxy=function(){},n.ComputeSubmergedArea=function(){return 0},n.Dump=function(){},i}(on),ms=function(e){function i(t){var i;return(i=e.call(this)||this).m_flagsBuffer=t,i}return s(i,e),i.prototype.IsNecessary=function(e){return 0!=(this.m_flagsBuffer.data[e]&t.b2ParticleFlag.b2_reactiveParticle)},i}(_s),gs=function(e){function i(t,i){var n;return void 0===i&&(i=null),(n=e.call(this,t)||this).m_contactFilter=null,n.m_contactFilter=i,n}s(i,e);var n=i.prototype;return n.ShouldCollideFixtureParticle=function(e,i,n){return!(this.m_contactFilter&&this.m_system.GetFlagsBuffer()[n]&t.b2ParticleFlag.b2_fixtureContactFilterParticle)||this.m_contactFilter.ShouldCollideFixtureParticle(e,this.m_system,n)},n.ReportFixtureAndParticle=function(e,n,r){var s=i.ReportFixtureAndParticle_s_n,a=i.ReportFixtureAndParticle_s_rp,o=this.m_system.m_positionBuffer.data[r],h=s,u=e.ComputeDistance(o,h,n);if(u<this.m_system.m_particleDiameter&&this.ShouldCollideFixtureParticle(e,this.m_system,r)){var l=e.GetBody(),c=l.GetWorldCenter(),_=l.GetMass(),f=l.GetInertia()-_*l.GetLocalCenter().LengthSquared(),d=_>0?1/_:0,p=f>0?1/f:0,m=this.m_system.m_flagsBuffer.data[r]&t.b2ParticleFlag.b2_wallParticle?0:this.m_system.GetParticleInvMass(),g=bt.SubVV(o,c,a),y=bt.CrossVV(g,h),v=m+d+p*y*y,S=this.m_system.m_bodyContactBuffer.data[this.m_system.m_bodyContactBuffer.Append()];S.index=r,S.body=l,S.fixture=e,S.weight=1-u*this.m_system.m_inverseDiameter,S.normal.Copy(h.SelfNeg()),S.mass=v>0?1/v:0,this.m_system.DetectStuckParticle(r)}},i}(Jr);gs.ReportFixtureAndParticle_s_n=new bt,gs.ReportFixtureAndParticle_s_rp=new bt;var ys=function(e){function i(t,i){var n;return(n=e.call(this,t)||this).m_step=i,n}s(i,e);var n=i.prototype;return n.ReportFixtureAndParticle=function(e,n,r){var s=i.ReportFixtureAndParticle_s_p1,a=i.ReportFixtureAndParticle_s_output,o=i.ReportFixtureAndParticle_s_input,h=i.ReportFixtureAndParticle_s_p,u=i.ReportFixtureAndParticle_s_v,l=i.ReportFixtureAndParticle_s_f,c=e.GetBody(),_=this.m_system.m_positionBuffer.data[r],f=this.m_system.m_velocityBuffer.data[r],d=a,m=o;if(0===this.m_system.m_iterationIndex){var g=Bt.MulTXV(c.m_xf0,_,s);e.GetShape().GetType()===t.b2ShapeType.e_circleShape&&(g.SelfSub(c.GetLocalCenter()),It.MulRV(c.m_xf0.q,g,g),It.MulTRV(c.m_xf.q,g,g),g.SelfAdd(c.GetLocalCenter())),Bt.MulXV(c.m_xf,g,m.p1)}else m.p1.Copy(_);if(bt.AddVMulSV(_,this.m_step.dt,f,m.p2),m.maxFraction=1,e.RayCast(d,m,n)){var y=d.normal,v=h;v.x=(1-d.fraction)*m.p1.x+d.fraction*m.p2.x+p*y.x,v.y=(1-d.fraction)*m.p1.y+d.fraction*m.p2.y+p*y.y;var S=u;S.x=this.m_step.inv_dt*(v.x-_.x),S.y=this.m_step.inv_dt*(v.y-_.y),this.m_system.m_velocityBuffer.data[r].Copy(S);var A=l;A.x=this.m_step.inv_dt*this.m_system.GetParticleMass()*(f.x-S.x),A.y=this.m_step.inv_dt*this.m_system.GetParticleMass()*(f.y-S.y),this.m_system.ParticleApplyForce(r,A)}},n.ReportParticle=function(){return!1},i}(Jr);ys.ReportFixtureAndParticle_s_p1=new bt,ys.ReportFixtureAndParticle_s_output=new be,ys.ReportFixtureAndParticle_s_input=new Ee,ys.ReportFixtureAndParticle_s_p=new bt,ys.ReportFixtureAndParticle_s_v=new bt,ys.ReportFixtureAndParticle_s_f=new bt;var vs=function(){function e(t){this.m_newFixture=!1,this.m_locked=!1,this.m_clearForces=!0,this.m_contactManager=new pr,this.m_bodyList=null,this.m_jointList=null,this.m_particleSystemList=null,this.m_bodyCount=0,this.m_jointCount=0,this.m_gravity=new bt,this.m_allowSleep=!0,this.m_destructionListener=null,this.m_debugDraw=null,this.m_inv_dt0=0,this.m_warmStarting=!0,this.m_continuousPhysics=!0,this.m_subStepping=!1,this.m_stepComplete=!0,this.m_profile=new mr,this.m_island=new Ir,this.s_stack=[],this.m_controllerList=null,this.m_controllerCount=0,this.m_gravity.Copy(t)}var i=e.prototype;return i.SetDestructionListener=function(t){this.m_destructionListener=t},i.SetContactFilter=function(t){this.m_contactManager.m_contactFilter=t},i.SetContactListener=function(t){this.m_contactManager.m_contactListener=t},i.SetDebugDraw=function(t){this.m_debugDraw=t},i.CreateBody=function(t){if(void 0===t&&(t={}),this.IsLocked())throw new Error;var e=new Sn(t,this);return e.m_prev=null,e.m_next=this.m_bodyList,this.m_bodyList&&(this.m_bodyList.m_prev=e),this.m_bodyList=e,++this.m_bodyCount,e},i.DestroyBody=function(t){if(this.IsLocked())throw new Error;for(var e=t.m_jointList;e;){var i=e;e=e.next,this.m_destructionListener&&this.m_destructionListener.SayGoodbyeJoint(i.joint),this.DestroyJoint(i.joint),t.m_jointList=e}t.m_jointList=null;for(var n=t.m_controllerList;n;){var r=n;n=n.nextController,r.controller.RemoveBody(t)}for(var s=t.m_contactList;s;){var a=s;s=s.next,this.m_contactManager.Destroy(a.contact)}t.m_contactList=null;for(var o=t.m_fixtureList;o;){var h=o;o=o.m_next,this.m_destructionListener&&this.m_destructionListener.SayGoodbyeFixture(h),h.DestroyProxies(),h.Reset(),t.m_fixtureList=o,t.m_fixtureCount-=1}t.m_fixtureList=null,t.m_fixtureCount=0,t.m_prev&&(t.m_prev.m_next=t.m_next),t.m_next&&(t.m_next.m_prev=t.m_prev),t===this.m_bodyList&&(this.m_bodyList=t.m_next),--this.m_bodyCount},e._Joint_Create=function(e){switch(e.type){case t.b2JointType.e_distanceJoint:return new Cn(e);case t.b2JointType.e_mouseJoint:return new Ln(e);case t.b2JointType.e_prismaticJoint:return new kn(e);case t.b2JointType.e_revoluteJoint:return new Hn(e);case t.b2JointType.e_pulleyJoint:return new Un(e);case t.b2JointType.e_gearJoint:return new Pn(e);case t.b2JointType.e_wheelJoint:return new Kn(e);case t.b2JointType.e_weldJoint:return new Yn(e);case t.b2JointType.e_frictionJoint:return new Bn(e);case t.b2JointType.e_ropeJoint:return new Xn(e);case t.b2JointType.e_motorJoint:return new Mn(e);case t.b2JointType.e_areaJoint:return new wn(e)}throw new Error},e._Joint_Destroy=function(){},i.CreateJoint=function(t){if(this.IsLocked())throw new Error;var i=e._Joint_Create(t);i.m_prev=null,i.m_next=this.m_jointList,this.m_jointList&&(this.m_jointList.m_prev=i),this.m_jointList=i,++this.m_jointCount,i.m_edgeA.prev=null,i.m_edgeA.next=i.m_bodyA.m_jointList,i.m_bodyA.m_jointList&&(i.m_bodyA.m_jointList.prev=i.m_edgeA),i.m_bodyA.m_jointList=i.m_edgeA,i.m_edgeB.prev=null,i.m_edgeB.next=i.m_bodyB.m_jointList,i.m_bodyB.m_jointList&&(i.m_bodyB.m_jointList.prev=i.m_edgeB),i.m_bodyB.m_jointList=i.m_edgeB;var n=i.m_bodyA,r=i.m_bodyB;if(!i.m_collideConnected)for(var s=r.GetContactList();s;)s.other===n&&s.contact.FlagForFiltering(),s=s.next;return i},i.DestroyJoint=function(t){if(this.IsLocked())throw new Error;t.m_prev&&(t.m_prev.m_next=t.m_next),t.m_next&&(t.m_next.m_prev=t.m_prev),t===this.m_jointList&&(this.m_jointList=t.m_next);var i=t.m_bodyA,n=t.m_bodyB,r=t.m_collideConnected;if(i.SetAwake(!0),n.SetAwake(!0),t.m_edgeA.prev&&(t.m_edgeA.prev.next=t.m_edgeA.next),t.m_edgeA.next&&(t.m_edgeA.next.prev=t.m_edgeA.prev),t.m_edgeA===i.m_jointList&&(i.m_jointList=t.m_edgeA.next),t.m_edgeA.Reset(),t.m_edgeB.prev&&(t.m_edgeB.prev.next=t.m_edgeB.next),t.m_edgeB.next&&(t.m_edgeB.next.prev=t.m_edgeB.prev),t.m_edgeB===n.m_jointList&&(n.m_jointList=t.m_edgeB.next),t.m_edgeB.Reset(),e._Joint_Destroy(t),--this.m_jointCount,!r)for(var s=n.GetContactList();s;)s.other===i&&s.contact.FlagForFiltering(),s=s.next},i.CreateParticleSystem=function(t){if(this.IsLocked())throw new Error;var e=new is(t,this);return e.m_prev=null,e.m_next=this.m_particleSystemList,this.m_particleSystemList&&(this.m_particleSystemList.m_prev=e),this.m_particleSystemList=e,e},i.DestroyParticleSystem=function(t){if(this.IsLocked())throw new Error;t.m_prev&&(t.m_prev.m_next=t.m_next),t.m_next&&(t.m_next.m_prev=t.m_prev),t===this.m_particleSystemList&&(this.m_particleSystemList=t.m_next)},i.CalculateReasonableParticleIterations=function(t){if(null===this.m_particleSystemList)return 1;function e(t){for(var e=r,i=t.GetParticleSystemList();null!==i;i=i.m_next)e=rt(e,i.GetRadius());return e}return Dr(this.m_gravity.Length(),e(this),t)},i.Step=function(t,i,n,r){void 0===r&&(r=this.CalculateReasonableParticleIterations(t));var s=e.Step_s_stepTimer.Reset();this.m_newFixture&&(this.m_contactManager.FindNewContacts(),this.m_newFixture=!1),this.m_locked=!0;var a=e.Step_s_step;a.dt=t,a.velocityIterations=i,a.positionIterations=n,a.particleIterations=r,a.inv_dt=t>0?1/t:0,a.dtRatio=this.m_inv_dt0*t,a.warmStarting=this.m_warmStarting;var o=e.Step_s_timer.Reset();if(this.m_contactManager.Collide(),this.m_profile.collide=o.GetMilliseconds(),this.m_stepComplete&&a.dt>0){for(var h=e.Step_s_timer.Reset(),u=this.m_particleSystemList;u;u=u.m_next)u.Solve(a);this.Solve(a),this.m_profile.solve=h.GetMilliseconds()}if(this.m_continuousPhysics&&a.dt>0){var l=e.Step_s_timer.Reset();this.SolveTOI(a),this.m_profile.solveTOI=l.GetMilliseconds()}a.dt>0&&(this.m_inv_dt0=a.inv_dt),this.m_clearForces&&this.ClearForces(),this.m_locked=!1,this.m_profile.step=s.GetMilliseconds()},i.ClearForces=function(){for(var t=this.m_bodyList;t;t=t.m_next)t.m_force.SetZero(),t.m_torque=0},i.DrawParticleSystem=function(t){if(null!==this.m_debugDraw){var e=t.GetParticleCount();if(e){var i=t.GetRadius(),n=t.GetPositionBuffer();if(t.m_colorBuffer.data){var r=t.GetColorBuffer();this.m_debugDraw.DrawParticles(n,i,r,e)}else this.m_debugDraw.DrawParticles(n,i,null,e)}}},i.DrawDebugData=function(){if(null!==this.m_debugDraw){var i=this.m_debugDraw.GetFlags(),n=e.DrawDebugData_s_color.SetRGB(0,0,0);if(i&t.b2DrawFlags.e_shapeBit)for(var r=this.m_bodyList;r;r=r.m_next){var s=r.m_xf;this.m_debugDraw.PushTransform(s);for(var a=r.GetFixtureList();a;a=a.m_next)r.IsActive()?r.GetType()===t.b2BodyType.b2_staticBody?(n.SetRGB(.5,.9,.5),this.DrawShape(a,n)):r.GetType()===t.b2BodyType.b2_kinematicBody?(n.SetRGB(.5,.5,.9),this.DrawShape(a,n)):r.IsAwake()?(n.SetRGB(.9,.7,.7),this.DrawShape(a,n)):(n.SetRGB(.6,.6,.6),this.DrawShape(a,n)):(n.SetRGB(.5,.5,.3),this.DrawShape(a,n));this.m_debugDraw.PopTransform(s)}if(i&t.b2DrawFlags.e_particleBit)for(var o=this.m_particleSystemList;o;o=o.m_next)this.DrawParticleSystem(o);if(i&t.b2DrawFlags.e_jointBit)for(var h=this.m_jointList;h;h=h.m_next)this.DrawJoint(h);if(i&t.b2DrawFlags.e_aabbBit){n.SetRGB(.9,.3,.9);for(var u=e.DrawDebugData_s_vs,l=this.m_bodyList;l;l=l.m_next)if(l.IsActive())for(var c=l.GetFixtureList();c;c=c.m_next)for(var _=0;_<c.m_proxyCount;++_){var f=c.m_proxies[_].treeNode.aabb;u[0].Set(f.lowerBound.x,f.lowerBound.y),u[1].Set(f.upperBound.x,f.lowerBound.y),u[2].Set(f.upperBound.x,f.upperBound.y),u[3].Set(f.lowerBound.x,f.upperBound.y),this.m_debugDraw.DrawPolygon(u,4,n)}}if(i&t.b2DrawFlags.e_centerOfMassBit)for(var d=this.m_bodyList;d;d=d.m_next){var p=e.DrawDebugData_s_xf;p.q.Copy(d.m_xf.q),p.p.Copy(d.GetWorldCenter()),this.m_debugDraw.DrawTransform(p)}if(i&t.b2DrawFlags.e_controllerBit)for(var m=this.m_controllerList;m;m=m.m_next)m.Draw(this.m_debugDraw)}},i.QueryAABB=function(){(arguments.length<=0?void 0:arguments[0])instanceof fr?this._QueryAABB(arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1]):this._QueryAABB(null,arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1])},i._QueryAABB=function(t,e,i){if(this.m_contactManager.m_broadPhase.Query(e,(function(e){var n=e.userData.fixture;return t?t.ReportFixture(n):!i||i(n)})),t instanceof fr)for(var n=this.m_particleSystemList;n;n=n.m_next)t.ShouldQueryParticleSystem(n)&&n.QueryAABB(t,e)},i.QueryAllAABB=function(t,e){return void 0===e&&(e=[]),this.QueryAABB(t,(function(t){return e.push(t),!0})),e},i.QueryPointAABB=function(){(arguments.length<=0?void 0:arguments[0])instanceof fr?this._QueryPointAABB(arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1]):this._QueryPointAABB(null,arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1])},i._QueryPointAABB=function(t,e,i){if(this.m_contactManager.m_broadPhase.QueryPoint(e,(function(e){var n=e.userData.fixture;return t?t.ReportFixture(n):!i||i(n)})),t instanceof fr)for(var n=this.m_particleSystemList;n;n=n.m_next)t.ShouldQueryParticleSystem(n)&&n.QueryPointAABB(t,e)},i.QueryAllPointAABB=function(t,e){return void 0===e&&(e=[]),this.QueryPointAABB(t,(function(t){return e.push(t),!0})),e},i.QueryFixtureShape=function(){(arguments.length<=0?void 0:arguments[0])instanceof fr?this._QueryFixtureShape(arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1],arguments.length<=2?void 0:arguments[2],arguments.length<=3?void 0:arguments[3]):this._QueryFixtureShape(null,arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1],arguments.length<=2?void 0:arguments[2],arguments.length<=3?void 0:arguments[3])},i._QueryFixtureShape=function(t,i,n,r,s){var a=e.QueryFixtureShape_s_aabb;if(i.ComputeAABB(a,r,n),this.m_contactManager.m_broadPhase.Query(a,(function(e){var a=e.userData,o=a.fixture;if(De(i,n,o.GetShape(),a.childIndex,r,o.GetBody().GetTransform())){if(t)return t.ReportFixture(o);if(s)return s(o)}return!0})),t instanceof fr)for(var o=this.m_particleSystemList;o;o=o.m_next)t.ShouldQueryParticleSystem(o)&&o.QueryAABB(t,a)},i.QueryAllFixtureShape=function(t,e,i,n){return void 0===n&&(n=[]),this.QueryFixtureShape(t,e,i,(function(t){return n.push(t),!0})),n},i.QueryFixturePoint=function(){(arguments.length<=0?void 0:arguments[0])instanceof fr?this._QueryFixturePoint(arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1]):this._QueryFixturePoint(null,arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1])},i._QueryFixturePoint=function(t,e,i){if(this.m_contactManager.m_broadPhase.QueryPoint(e,(function(n){var r=n.userData.fixture;if(r.TestPoint(e)){if(t)return t.ReportFixture(r);if(i)return i(r)}return!0})),t)for(var n=this.m_particleSystemList;n;n=n.m_next)t.ShouldQueryParticleSystem(n)&&n.QueryPointAABB(t,e)},i.QueryAllFixturePoint=function(t,e){return void 0===e&&(e=[]),this.QueryFixturePoint(t,(function(t){return e.push(t),!0})),e},i.RayCast=function(){(arguments.length<=0?void 0:arguments[0])instanceof dr?this._RayCast(arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1],arguments.length<=2?void 0:arguments[2]):this._RayCast(null,arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1],arguments.length<=2?void 0:arguments[2])},i._RayCast=function(t,i,n,r){var s=e.RayCast_s_input;if(s.maxFraction=1,s.p1.Copy(i),s.p2.Copy(n),this.m_contactManager.m_broadPhase.RayCast(s,(function(s,a){var o=a.userData,h=o.fixture,u=o.childIndex,l=e.RayCast_s_output;if(h.RayCast(l,s,u)){var c=l.fraction,_=e.RayCast_s_point;if(_.Set((1-c)*i.x+c*n.x,(1-c)*i.y+c*n.y),t)return t.ReportFixture(h,_,l.normal,c);if(r)return r(h,_,l.normal,c)}return s.maxFraction})),t)for(var a=this.m_particleSystemList;a;a=a.m_next)t.ShouldQueryParticleSystem(a)&&a.RayCast(t,i,n)},i.RayCastOne=function(t,e){var i=null,n=1;return this.RayCast(t,e,(function(t,e,r,s){return s<n&&(n=s,i=t),n})),i},i.RayCastAll=function(t,e,i){return void 0===i&&(i=[]),this.RayCast(t,e,(function(t){return i.push(t),1})),i},i.GetBodyList=function(){return this.m_bodyList},i.GetJointList=function(){return this.m_jointList},i.GetParticleSystemList=function(){return this.m_particleSystemList},i.GetContactList=function(){return this.m_contactManager.m_contactList},i.SetAllowSleeping=function(t){if(t!==this.m_allowSleep&&(this.m_allowSleep=t,!this.m_allowSleep))for(var e=this.m_bodyList;e;e=e.m_next)e.SetAwake(!0)},i.GetAllowSleeping=function(){return this.m_allowSleep},i.SetWarmStarting=function(t){this.m_warmStarting=t},i.GetWarmStarting=function(){return this.m_warmStarting},i.SetContinuousPhysics=function(t){this.m_continuousPhysics=t},i.GetContinuousPhysics=function(){return this.m_continuousPhysics},i.SetSubStepping=function(t){this.m_subStepping=t},i.GetSubStepping=function(){return this.m_subStepping},i.GetProxyCount=function(){return this.m_contactManager.m_broadPhase.GetProxyCount()},i.GetBodyCount=function(){return this.m_bodyCount},i.GetJointCount=function(){return this.m_jointCount},i.GetContactCount=function(){return this.m_contactManager.m_contactCount},i.GetTreeHeight=function(){return this.m_contactManager.m_broadPhase.GetTreeHeight()},i.GetTreeBalance=function(){return this.m_contactManager.m_broadPhase.GetTreeBalance()},i.GetTreeQuality=function(){return this.m_contactManager.m_broadPhase.GetTreeQuality()},i.SetGravity=function(t,e){if(void 0===e&&(e=!0),!bt.IsEqualToV(this.m_gravity,t)&&(this.m_gravity.Copy(t),e))for(var i=this.m_bodyList;i;i=i.m_next)i.SetAwake(!0)},i.GetGravity=function(){return this.m_gravity},i.IsLocked=function(){return this.m_locked},i.SetAutoClearForces=function(t){this.m_clearForces=t},i.GetAutoClearForces=function(){return this.m_clearForces},i.ShiftOrigin=function(t){if(this.IsLocked())throw new Error;for(var e=this.m_bodyList;e;e=e.m_next)e.m_xf.p.SelfSub(t),e.m_sweep.c0.SelfSub(t),e.m_sweep.c.SelfSub(t);for(var i=this.m_jointList;i;i=i.m_next)i.ShiftOrigin(t);this.m_contactManager.m_broadPhase.ShiftOrigin(t)},i.GetContactManager=function(){return this.m_contactManager},i.GetProfile=function(){return this.m_profile},i.Dump=function(e){if(!this.m_locked){e("const g: b2Vec2 = new b2Vec2(%.15f, %.15f);\n",this.m_gravity.x,this.m_gravity.y),e("this.m_world.SetGravity(g);\n"),e("const bodies: b2Body[] = [];\n"),e("const joints: b2Joint[] = [];\n");for(var i=0,n=this.m_bodyList;n;n=n.m_next)n.m_islandIndex=i,n.Dump(e),++i;i=0;for(var r=this.m_jointList;r;r=r.m_next)r.m_index=i,++i;for(var s=this.m_jointList;s;s=s.m_next)s.m_type!==t.b2JointType.e_gearJoint&&(e("{\n"),s.Dump(e),e("}\n"));for(var a=this.m_jointList;a;a=a.m_next)a.m_type===t.b2JointType.e_gearJoint&&(e("{\n"),a.Dump(e),e("}\n"))}},i.DrawJoint=function(i){if(null!==this.m_debugDraw){var n=i.GetBodyA(),r=i.GetBodyB(),s=n.m_xf,a=r.m_xf,o=s.p,h=a.p,u=i.GetAnchorA(e.DrawJoint_s_p1),l=i.GetAnchorB(e.DrawJoint_s_p2),c=e.DrawJoint_s_color.SetRGB(.5,.8,.8);switch(i.m_type){case t.b2JointType.e_distanceJoint:this.m_debugDraw.DrawSegment(u,l,c);break;case t.b2JointType.e_pulleyJoint:var _=i,f=_.GetGroundAnchorA(),d=_.GetGroundAnchorB();this.m_debugDraw.DrawSegment(f,u,c),this.m_debugDraw.DrawSegment(d,l,c),this.m_debugDraw.DrawSegment(f,d,c);break;case t.b2JointType.e_mouseJoint:var p=e.DrawJoint_s_c;p.Set(0,1,0),this.m_debugDraw.DrawPoint(u,4,p),this.m_debugDraw.DrawPoint(l,4,p),p.Set(.8,.8,.8),this.m_debugDraw.DrawSegment(u,l,p);break;default:this.m_debugDraw.DrawSegment(o,u,c),this.m_debugDraw.DrawSegment(u,l,c),this.m_debugDraw.DrawSegment(h,l,c)}}},i.DrawShape=function(i,n){if(null!==this.m_debugDraw){var r=i.GetShape();switch(r.m_type){case t.b2ShapeType.e_circleShape:var s=r,a=s.m_p,o=s.m_radius,h=bt.UNITX;this.m_debugDraw.DrawSolidCircle(a,o,h,n);break;case t.b2ShapeType.e_edgeShape:var u=r,l=u.m_vertex1,c=u.m_vertex2;this.m_debugDraw.DrawSegment(l,c,n);break;case t.b2ShapeType.e_chainShape:var _=r,f=_.m_count,d=_.m_vertices,p=e.DrawShape_s_ghostColor.SetRGBA(.75*n.r,.75*n.g,.75*n.b,n.a),m=d[0];if(this.m_debugDraw.DrawPoint(m,4,n),_.m_hasPrevVertex){var g=_.m_prevVertex;this.m_debugDraw.DrawSegment(g,m,p),this.m_debugDraw.DrawCircle(g,.1,p)}for(var y=1;y<f;++y){var v=d[y];this.m_debugDraw.DrawSegment(m,v,n),this.m_debugDraw.DrawPoint(v,4,n),m=v}if(_.m_hasNextVertex){var S=_.m_nextVertex;this.m_debugDraw.DrawSegment(S,m,p),this.m_debugDraw.DrawCircle(S,.1,p)}break;case t.b2ShapeType.e_polygonShape:var A=r,T=A.m_count,E=A.m_vertices;this.m_debugDraw.DrawSolidPolygon(E,T,n)}}},i.Solve=function(e){for(var i=this.m_bodyList;i;i=i.m_next)i.m_xf0.Copy(i.m_xf);for(var n=this.m_controllerList;n;n=n.m_next)n.Step(e);this.m_profile.solveInit=0,this.m_profile.solveVelocity=0,this.m_profile.solvePosition=0;var r=this.m_island;r.Initialize(this.m_bodyCount,this.m_contactManager.m_contactCount,this.m_jointCount,this.m_contactManager.m_contactListener);for(var s=this.m_bodyList;s;s=s.m_next)s.m_islandFlag=!1;for(var a=this.m_contactManager.m_contactList;a;a=a.m_next)a.m_islandFlag=!1;for(var o=this.m_jointList;o;o=o.m_next)o.m_islandFlag=!1;for(var h=this.s_stack,u=this.m_bodyList;u;u=u.m_next)if(!u.m_islandFlag&&u.IsAwake()&&u.IsActive()&&u.GetType()!==t.b2BodyType.b2_staticBody){r.Clear();var l=0;for(h[l++]=u,u.m_islandFlag=!0;l>0;){var c=h[--l];if(!c)throw new Error;if(r.AddBody(c),c.m_awakeFlag=!0,c.GetType()!==t.b2BodyType.b2_staticBody){for(var _=c.m_contactList;_;_=_.next){var f=_.contact;if(!f.m_islandFlag&&f.IsEnabled()&&f.IsTouching()){var d=f.m_fixtureA.m_isSensor,p=f.m_fixtureB.m_isSensor;if(!d&&!p){r.AddContact(f),f.m_islandFlag=!0;var m=_.other;m.m_islandFlag||(h[l++]=m,m.m_islandFlag=!0)}}}for(var g=c.m_jointList;g;g=g.next)if(!g.joint.m_islandFlag){var y=g.other;y.IsActive()&&(r.AddJoint(g.joint),g.joint.m_islandFlag=!0,y.m_islandFlag||(h[l++]=y,y.m_islandFlag=!0))}}}var v=new mr;r.Solve(v,e,this.m_gravity,this.m_allowSleep),this.m_profile.solveInit+=v.solveInit,this.m_profile.solveVelocity+=v.solveVelocity,this.m_profile.solvePosition+=v.solvePosition;for(var S=0;S<r.m_bodyCount;++S){var A=r.m_bodies[S];A.GetType()===t.b2BodyType.b2_staticBody&&(A.m_islandFlag=!1)}}for(var T=0;T<h.length&&h[T];++T)h[T]=null;for(var E=new Nt,b=this.m_bodyList;b;b=b.m_next)b.m_islandFlag&&b.GetType()!==t.b2BodyType.b2_staticBody&&b.SynchronizeFixtures();this.m_contactManager.FindNewContacts(),this.m_profile.broadphase=E.GetMilliseconds()},i.SolveTOI=function(i){var n=this.m_island;if(n.Initialize(2*v,v,0,this.m_contactManager.m_contactListener),this.m_stepComplete){for(var r=this.m_bodyList;r;r=r.m_next)r.m_islandFlag=!1,r.m_sweep.alpha0=0;for(var s=this.m_contactManager.m_contactList;s;s=s.m_next)s.m_toiFlag=!1,s.m_islandFlag=!1,s.m_toiCount=0,s.m_toi=1}for(;;){for(var o=null,h=1,u=this.m_contactManager.m_contactList;u;u=u.m_next)if(u.IsEnabled()&&!(u.m_toiCount>y)){var l=1;if(u.m_toiFlag)l=u.m_toi;else{var c=u.GetFixtureA(),_=u.GetFixtureB();if(c.IsSensor()||_.IsSensor())continue;var f=c.GetBody(),d=_.GetBody(),p=f.m_type,m=d.m_type,g=f.IsAwake()&&p!==t.b2BodyType.b2_staticBody,S=d.IsAwake()&&m!==t.b2BodyType.b2_staticBody;if(!g&&!S)continue;var A=f.IsBullet()||p!==t.b2BodyType.b2_dynamicBody,T=d.IsBullet()||m!==t.b2BodyType.b2_dynamicBody;if(!A&&!T)continue;var E=f.m_sweep.alpha0;f.m_sweep.alpha0<d.m_sweep.alpha0?(E=d.m_sweep.alpha0,f.m_sweep.Advance(E)):d.m_sweep.alpha0<f.m_sweep.alpha0&&(E=f.m_sweep.alpha0,d.m_sweep.Advance(E));var b=u.GetChildIndexA(),x=u.GetChildIndexB(),C=e.SolveTOI_s_toi_input;C.proxyA.SetShape(c.GetShape(),b),C.proxyB.SetShape(_.GetShape(),x),C.sweepA.Copy(f.m_sweep),C.sweepB.Copy(d.m_sweep),C.tMax=1;var R=e.SolveTOI_s_toi_output;ui(R,C);var w=R.t;l=R.state===t.b2TOIOutputState.e_touching?rt(E+(1-E)*w,1):1,u.m_toi=l,u.m_toiFlag=!0}l<h&&(o=u,h=l)}if(null===o||1-10*a<h){this.m_stepComplete=!0;break}var I=o.GetFixtureA(),B=o.GetFixtureB(),D=I.GetBody(),P=B.GetBody(),O=e.SolveTOI_s_backup1.Copy(D.m_sweep),M=e.SolveTOI_s_backup2.Copy(P.m_sweep);if(D.Advance(h),P.Advance(h),o.Update(this.m_contactManager.m_contactListener),o.m_toiFlag=!1,++o.m_toiCount,o.IsEnabled()&&o.IsTouching()){D.SetAwake(!0),P.SetAwake(!0),n.Clear(),n.AddBody(D),n.AddBody(P),n.AddContact(o),D.m_islandFlag=!0,P.m_islandFlag=!0,o.m_islandFlag=!0;for(var N=0;N<2;++N){var L=0===N?D:P;if(L.m_type===t.b2BodyType.b2_dynamicBody)for(var F=L.m_contactList;F&&n.m_bodyCount!==n.m_bodyCapacity&&n.m_contactCount!==n.m_contactCapacity;F=F.next){var k=F.contact;if(!k.m_islandFlag){var G=F.other;if(G.m_type!==t.b2BodyType.b2_dynamicBody||L.IsBullet()||G.IsBullet()){var V=k.m_fixtureA.m_isSensor,U=k.m_fixtureB.m_isSensor;if(!V&&!U){var z=e.SolveTOI_s_backup.Copy(G.m_sweep);G.m_islandFlag||G.Advance(h),k.Update(this.m_contactManager.m_contactListener),k.IsEnabled()&&k.IsTouching()?(k.m_islandFlag=!0,n.AddContact(k),G.m_islandFlag||(G.m_islandFlag=!0,G.m_type!==t.b2BodyType.b2_staticBody&&G.SetAwake(!0),n.AddBody(G))):(G.m_sweep.Copy(z),G.SynchronizeTransform())}}}}}var H=e.SolveTOI_s_subStep;H.dt=(1-h)*i.dt,H.inv_dt=1/H.dt,H.dtRatio=1,H.positionIterations=20,H.velocityIterations=i.velocityIterations,H.particleIterations=i.particleIterations,H.warmStarting=!1,n.SolveTOI(H,D.m_islandIndex,P.m_islandIndex);for(var W=0;W<n.m_bodyCount;++W){var X=n.m_bodies[W];if(X.m_islandFlag=!1,X.m_type===t.b2BodyType.b2_dynamicBody){X.SynchronizeFixtures();for(var j=X.m_contactList;j;j=j.next)j.contact.m_toiFlag=!1,j.contact.m_islandFlag=!1}}if(this.m_contactManager.FindNewContacts(),this.m_subStepping){this.m_stepComplete=!1;break}}else o.SetEnabled(!1),D.m_sweep.Copy(O),P.m_sweep.Copy(M),D.SynchronizeTransform(),P.SynchronizeTransform()}},i.AddController=function(t){return t.m_next=this.m_controllerList,t.m_prev=null,this.m_controllerList&&(this.m_controllerList.m_prev=t),this.m_controllerList=t,++this.m_controllerCount,t},i.RemoveController=function(t){return t.m_prev&&(t.m_prev.m_next=t.m_next),t.m_next&&(t.m_next.m_prev=t.m_prev),this.m_controllerList===t&&(this.m_controllerList=t.m_next),--this.m_controllerCount,t.m_prev=null,t.m_next=null,t},e}();vs.Step_s_step=new gr,vs.Step_s_stepTimer=new Nt,vs.Step_s_timer=new Nt,vs.DrawDebugData_s_color=new Ot(0,0,0),vs.DrawDebugData_s_vs=bt.MakeArray(4),vs.DrawDebugData_s_xf=new Bt,vs.QueryFixtureShape_s_aabb=new xe,vs.RayCast_s_input=new Ee,vs.RayCast_s_output=new be,vs.RayCast_s_point=new bt,vs.DrawJoint_s_p1=new bt,vs.DrawJoint_s_p2=new bt,vs.DrawJoint_s_color=new Ot(.5,.8,.8),vs.DrawJoint_s_c=new Ot,vs.DrawShape_s_ghostColor=new Ot,vs.SolveTOI_s_subStep=new gr,vs.SolveTOI_s_backup=new Pt,vs.SolveTOI_s_backup1=new Pt,vs.SolveTOI_s_backup2=new Pt,vs.SolveTOI_s_toi_input=new Je,vs.SolveTOI_s_toi_output=new Ze;var Ss=function(t,e){this.prevBody=null,this.nextBody=null,this.prevController=null,this.nextController=null,this.controller=t,this.body=e},As=function(){function t(){this.m_bodyList=null,this.m_bodyCount=0,this.m_prev=null,this.m_next=null}var e=t.prototype;return e.GetNext=function(){return this.m_next},e.GetPrev=function(){return this.m_prev},e.GetBodyList=function(){return this.m_bodyList},e.AddBody=function(t){var e=new Ss(this,t);e.nextBody=this.m_bodyList,e.prevBody=null,this.m_bodyList&&(this.m_bodyList.prevBody=e),this.m_bodyList=e,++this.m_bodyCount,e.nextController=t.m_controllerList,e.prevController=null,t.m_controllerList&&(t.m_controllerList.prevController=e),t.m_controllerList=e,++t.m_controllerCount},e.RemoveBody=function(t){if(this.m_bodyCount<=0)throw new Error;for(var e=this.m_bodyList;e&&e.body!==t;)e=e.nextBody;if(null===e)throw new Error;e.prevBody&&(e.prevBody.nextBody=e.nextBody),e.nextBody&&(e.nextBody.prevBody=e.prevBody),this.m_bodyList===e&&(this.m_bodyList=e.nextBody),--this.m_bodyCount,e.nextController&&(e.nextController.prevController=e.prevController),e.prevController&&(e.prevController.nextController=e.nextController),t.m_controllerList===e&&(t.m_controllerList=e.nextController),--t.m_controllerCount},e.Clear=function(){for(;this.m_bodyList;)this.RemoveBody(this.m_bodyList.body);this.m_bodyCount=0},t}(),Ts=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).normal=new bt(0,1),e.offset=0,e.density=0,e.velocity=new bt(0,0),e.linearDrag=0,e.angularDrag=0,e.useDensity=!1,e.useWorldGravity=!0,e.gravity=new bt(0,0),e}s(e,t);var i=e.prototype;return i.Step=function(){if(this.m_bodyList){this.useWorldGravity&&this.gravity.Copy(this.m_bodyList.body.GetWorld().GetGravity());for(var t=this.m_bodyList;t;t=t.nextBody){var e=t.body;if(e.IsAwake()){for(var i=new bt,n=new bt,r=0,s=0,o=e.GetFixtureList();o;o=o.m_next){var h=new bt,u=o.GetShape().ComputeSubmergedArea(this.normal,this.offset,e.GetTransform(),h);r+=u,i.x+=u*h.x,i.y+=u*h.y;var l=0;s+=u*(l=this.useDensity?o.GetDensity():1),n.x+=u*h.x*l,n.y+=u*h.y*l}if(i.x/=r,i.y/=r,n.x/=s,n.y/=s,!(r<a)){var c=this.gravity.Clone().SelfNeg();c.SelfMul(this.density*r),e.ApplyForce(c,n);var _=e.GetLinearVelocityFromWorldPoint(i,new bt);_.SelfSub(this.velocity),_.SelfMul(-this.linearDrag*r),e.ApplyForce(_,i),e.ApplyTorque(-e.GetInertia()/e.GetMass()*r*e.GetAngularVelocity()*this.angularDrag)}}}}},i.Draw=function(t){var e=100,i=new bt,n=new bt;i.x=this.normal.x*this.offset+this.normal.y*e,i.y=this.normal.y*this.offset-this.normal.x*e,n.x=this.normal.x*this.offset-this.normal.y*e,n.y=this.normal.y*this.offset+this.normal.x*e;var r=new Ot(0,0,.8);t.DrawSegment(i,n,r)},e}(As),Es=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).A=new bt(0,0),e}s(e,t);var i=e.prototype;return i.Step=function(t){for(var i=bt.MulSV(t.dt,this.A,e.Step_s_dtA),n=this.m_bodyList;n;n=n.nextBody){var r=n.body;r.IsAwake()&&r.SetLinearVelocity(bt.AddVV(r.GetLinearVelocity(),i,bt.s_t0))}},i.Draw=function(){},e}(As);Es.Step_s_dtA=new bt;var bs=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).F=new bt(0,0),e}s(e,t);var i=e.prototype;return i.Step=function(){for(var t=this.m_bodyList;t;t=t.nextBody){var e=t.body;e.IsAwake()&&e.ApplyForce(this.F,e.GetWorldCenter())}},i.Draw=function(){},e}(As),xs=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).G=1,e.invSqr=!0,e}s(e,t);var i=e.prototype;return i.Step=function(){if(this.invSqr)for(var t=this.m_bodyList;t;t=t.nextBody)for(var i=t.body,n=i.GetWorldCenter(),r=i.GetMass(),s=this.m_bodyList;s&&s!==t;s=s.nextBody){var o=s.body,h=o.GetWorldCenter(),u=o.GetMass(),l=h.x-n.x,c=h.y-n.y,_=l*l+c*c;if(!(_<a)){var f=e.Step_s_f.Set(l,c);f.SelfMul(this.G/_/ct(_)*r*u),i.IsAwake()&&i.ApplyForce(f,n),o.IsAwake()&&o.ApplyForce(f.SelfMul(-1),h)}}else for(var d=this.m_bodyList;d;d=d.nextBody)for(var p=d.body,m=p.GetWorldCenter(),g=p.GetMass(),y=this.m_bodyList;y&&y!==d;y=y.nextBody){var v=y.body,S=v.GetWorldCenter(),A=v.GetMass(),T=S.x-m.x,E=S.y-m.y,b=T*T+E*E;if(!(b<a)){var x=e.Step_s_f.Set(T,E);x.SelfMul(this.G/b*g*A),p.IsAwake()&&p.ApplyForce(x,m),v.IsAwake()&&v.ApplyForce(x.SelfMul(-1),S)}}},i.Draw=function(){},e}(As);xs.Step_s_f=new bt;var Cs=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).T=new Rt,e.maxTimestep=0,e}s(e,t);var i=e.prototype;return i.Step=function(t){var i=t.dt;if(!(i<=a)){i>this.maxTimestep&&this.maxTimestep>0&&(i=this.maxTimestep);for(var n=this.m_bodyList;n;n=n.nextBody){var r=n.body;if(r.IsAwake()){var s=r.GetWorldVector(Rt.MulMV(this.T,r.GetLocalVector(r.GetLinearVelocity(),bt.s_t0),bt.s_t1),e.Step_s_damping);r.SetLinearVelocity(bt.AddVV(r.GetLinearVelocity(),bt.MulSV(i,s,bt.s_t0),bt.s_t1))}}}},i.Draw=function(){},i.SetAxisAligned=function(t,e){this.T.ex.x=-t,this.T.ex.y=0,this.T.ey.x=0,this.T.ey.y=-e,this.maxTimestep=t>0||e>0?1/st(t,e):0},e}(As);Cs.Step_s_damping=new bt;var Rs=function(){this.vertices=[],this.count=0,this.masses=[],this.gravity=new bt(0,0),this.damping=.1,this.k2=.9,this.k3=.1},ws=function(){function t(){this.m_count=0,this.m_ps=[],this.m_p0s=[],this.m_vs=[],this.m_ims=[],this.m_Ls=[],this.m_as=[],this.m_gravity=new bt,this.m_damping=0,this.m_k2=1,this.m_k3=.1}var e=t.prototype;return e.GetVertexCount=function(){return this.m_count},e.GetVertices=function(){return this.m_ps},e.Initialize=function(t){this.m_count=t.count,this.m_ps=bt.MakeArray(this.m_count),this.m_p0s=bt.MakeArray(this.m_count),this.m_vs=bt.MakeArray(this.m_count),this.m_ims=$(this.m_count);for(var e=0;e<this.m_count;++e){this.m_ps[e].Copy(t.vertices[e]),this.m_p0s[e].Copy(t.vertices[e]),this.m_vs[e].SetZero();var i=t.masses[e];this.m_ims[e]=i>0?1/i:0}var n=this.m_count-1,r=this.m_count-2;this.m_Ls=$(n),this.m_as=$(r);for(var s=0;s<n;++s){var a=this.m_ps[s],o=this.m_ps[s+1];this.m_Ls[s]=bt.DistanceVV(a,o)}for(var h=0;h<r;++h){var u=this.m_ps[h],l=this.m_ps[h+1],c=this.m_ps[h+2],_=bt.SubVV(l,u,bt.s_t0),f=bt.SubVV(c,l,bt.s_t1),d=bt.CrossVV(_,f),p=bt.DotVV(_,f);this.m_as[h]=vt(d,p)}this.m_gravity.Copy(t.gravity),this.m_damping=t.damping,this.m_k2=t.k2,this.m_k3=t.k3},e.Step=function(t,e){if(0!==t){for(var i=Math.exp(-t*this.m_damping),n=0;n<this.m_count;++n)this.m_p0s[n].Copy(this.m_ps[n]),this.m_ims[n]>0&&this.m_vs[n].SelfMulAdd(t,this.m_gravity),this.m_vs[n].SelfMul(i),this.m_ps[n].SelfMulAdd(t,this.m_vs[n]);for(var r=0;r<e;++r)this.SolveC2(),this.SolveC3(),this.SolveC2();for(var s=1/t,a=0;a<this.m_count;++a)bt.MulSV(s,bt.SubVV(this.m_ps[a],this.m_p0s[a],bt.s_t0),this.m_vs[a])}},e.SolveC2=function(){for(var e=this.m_count-1,i=0;i<e;++i){var n=this.m_ps[i],r=this.m_ps[i+1],s=bt.SubVV(r,n,t.s_d),a=s.Normalize(),o=this.m_ims[i],h=this.m_ims[i+1];if(o+h!==0){var u=o/(o+h),l=h/(o+h);n.SelfMulSub(this.m_k2*u*(this.m_Ls[i]-a),s),r.SelfMulAdd(this.m_k2*l*(this.m_Ls[i]-a),s)}}},e.SetAngle=function(t){for(var e=this.m_count-2,i=0;i<e;++i)this.m_as[i]=t},e.SolveC3=function(){for(var e=this.m_count-2,i=0;i<e;++i){var n=this.m_ps[i],r=this.m_ps[i+1],s=this.m_ps[i+2],a=this.m_ims[i],o=this.m_ims[i+1],u=this.m_ims[i+2],l=bt.SubVV(r,n,t.s_d1),c=bt.SubVV(s,r,t.s_d2),_=l.LengthSquared(),f=c.LengthSquared();if(_*f!=0){var d=bt.CrossVV(l,c),p=bt.DotVV(l,c),m=vt(d,p),g=bt.MulSV(-1/_,l.SelfSkew(),t.s_Jd1),y=bt.MulSV(1/f,c.SelfSkew(),t.s_Jd2),v=bt.NegV(g,t.s_J1),S=bt.SubVV(g,y,t.s_J2),A=y,T=a*bt.DotVV(v,v)+o*bt.DotVV(S,S)+u*bt.DotVV(A,A);if(0!==T){T=1/T;for(var E=m-this.m_as[i];E>h;)E=(m-=2*h)-this.m_as[i];for(;E<-h;)E=(m+=2*h)-this.m_as[i];var b=-this.m_k3*T*E;n.SelfMulAdd(a*b,v),r.SelfMulAdd(o*b,S),s.SelfMulAdd(u*b,A)}}}},e.Draw=function(t){for(var e=new Ot(.4,.5,.7),i=0;i<this.m_count-1;++i)t.DrawSegment(this.m_ps[i],this.m_ps[i+1],e)},t}();ws.s_d=new bt,ws.s_d1=new bt,ws.s_d2=new bt,ws.s_Jd1=new bt,ws.s_Jd2=new bt,ws.s_J1=new bt,ws.s_J2=new bt,t.b2AABB=xe,t.b2Abs=nt,t.b2Acos=gt,t.b2Alloc=z,t.b2AreaJoint=wn,t.b2AreaJointDef=Rn,t.b2Asin=yt,t.b2Assert=e,t.b2Atan2=vt,t.b2BlockAllocator=kt,t.b2Body=Sn,t.b2BodyDef=vn,t.b2BroadPhase=Ge,t.b2BuoyancyController=Ts,t.b2CalculateParticleIterations=Dr,t.b2ChainAndCircleContact=sr,t.b2ChainAndPolygonContact=ar,t.b2ChainShape=cn,t.b2CircleContact=tr,t.b2CircleShape=hn,t.b2Clamp=at,t.b2ClipSegmentToLine=Re,t.b2ClipVertex=Te,t.b2CollideCircles=_i,t.b2CollideEdgeAndCircle=Ji,t.b2CollideEdgeAndPolygon=rn,t.b2CollidePolygonAndCircle=mi,t.b2CollidePolygons=Vi,t.b2Color=Ot,t.b2ConstantAccelController=Es,t.b2ConstantForceController=bs,t.b2Contact=$n,t.b2ContactEdge=Zn,t.b2ContactFactory=hr,t.b2ContactFeature=pe,t.b2ContactFilter=lr,t.b2ContactID=me,t.b2ContactImpulse=cr,t.b2ContactListener=_r,t.b2ContactManager=pr,t.b2ContactPositionConstraint=br,t.b2ContactRegister=or,t.b2ContactSolver=Rr,t.b2ContactSolverDef=xr,t.b2ContactVelocityConstraint=Er,t.b2Controller=As,t.b2ControllerEdge=Ss,t.b2Cos=pt,t.b2Counter=Lt,t.b2DegToRad=ft,t.b2DestructionListener=ur,t.b2Distance=ne,t.b2DistanceInput=zt,t.b2DistanceJoint=Cn,t.b2DistanceJointDef=xn,t.b2DistanceOutput=Ht,t.b2DistanceProxy=Vt,t.b2Draw=Mt,t.b2DynamicTree=Me,t.b2EdgeAndCircleContact=nr,t.b2EdgeAndPolygonContact=rr,t.b2EdgeShape=ln,t.b2Filter=_n,t.b2Fixture=mn,t.b2FixtureDef=fn,t.b2FixtureParticleQueryCallback=Jr,t.b2FixtureProxy=dn,t.b2Free=H,t.b2FrictionJoint=Bn,t.b2FrictionJointDef=In,t.b2GearJoint=Pn,t.b2GearJointDef=Dn,t.b2GetPointStates=Ae,t.b2GravityController=xs,t.b2GrowableBuffer=Kr,t.b2GrowableStack=Ft,t.b2InvSqrt=lt,t.b2IsPowerOfTwo=At,t.b2IsValid=ht,t.b2Island=Ir,t.b2Jacobian=An,t.b2Joint=bn,t.b2JointDef=En,t.b2JointEdge=Tn,t.b2Log=W,t.b2MakeArray=Q,t.b2MakeNullArray=Z,t.b2MakeNumberArray=$,t.b2Manifold=ve,t.b2ManifoldPoint=ge,t.b2MassData=an,t.b2Mat22=Rt,t.b2Mat33=wt,t.b2Max=st,t.b2Maybe=i,t.b2Min=rt,t.b2MixFriction=Jn,t.b2MixRestitution=Qn,t.b2MotorJoint=Mn,t.b2MotorJointDef=On,t.b2MouseJoint=Ln,t.b2MouseJointDef=Nn,t.b2NextPowerOfTwo=St,t.b2Pair=ke,t.b2PairLessThan=Ve,t.b2ParseInt=K,t.b2ParseUInt=J,t.b2ParticleBodyContact=Zr,t.b2ParticleContact=Qr,t.b2ParticleDef=Br,t.b2ParticleGroup=Nr,t.b2ParticleGroupDef=Mr,t.b2ParticleHandle=Or,t.b2ParticlePair=$r,t.b2ParticlePairSet=cs,t.b2ParticleSystem=is,t.b2ParticleSystemDef=es,t.b2ParticleSystem_CompositeShape=ps,t.b2ParticleSystem_ConnectionFilter=_s,t.b2ParticleSystem_DestroyParticlesInShapeCallback=fs,t.b2ParticleSystem_FixedSetAllocator=os,t.b2ParticleSystem_FixtureParticle=hs,t.b2ParticleSystem_FixtureParticleSet=us,t.b2ParticleSystem_InsideBoundsEnumerator=ss,t.b2ParticleSystem_JoinParticleGroupsFilter=ds,t.b2ParticleSystem_ParticleListNode=as,t.b2ParticleSystem_ParticlePair=ls,t.b2ParticleSystem_Proxy=rs,t.b2ParticleSystem_ReactiveFilter=ms,t.b2ParticleSystem_SolveCollisionCallback=ys,t.b2ParticleSystem_UpdateBodyContactsCallback=gs,t.b2ParticleSystem_UserOverridableBuffer=ns,t.b2ParticleTriad=ts,t.b2PolygonAndCircleContact=ir,t.b2PolygonContact=er,t.b2PolygonShape=un,t.b2Position=yr,t.b2PositionSolverManifold=Cr,t.b2Pow=_t,t.b2PrismaticJoint=kn,t.b2PrismaticJointDef=Fn,t.b2Profile=mr,t.b2PulleyJoint=Un,t.b2PulleyJointDef=Vn,t.b2QueryCallback=fr,t.b2RadToDeg=dt,t.b2Random=Tt,t.b2RandomRange=Et,t.b2RayCastCallback=dr,t.b2RayCastInput=Ee,t.b2RayCastOutput=be,t.b2RevoluteJoint=Hn,t.b2RevoluteJointDef=zn,t.b2Rope=ws,t.b2RopeDef=Rs,t.b2RopeJoint=Xn,t.b2RopeJointDef=Wn,t.b2Rot=It,t.b2SeparationFunction=$e,t.b2Shape=on,t.b2ShapeCast=fe,t.b2ShapeCastInput=Wt,t.b2ShapeCastOutput=Xt,t.b2Simplex=qt,t.b2SimplexCache=Ut,t.b2SimplexVertex=Yt,t.b2Sin=mt,t.b2SolverData=Sr,t.b2Sq=ut,t.b2Sqrt=ct,t.b2StackAllocator=Gt,t.b2Swap=ot,t.b2Sweep=Pt,t.b2TOIInput=Je,t.b2TOIOutput=Ze,t.b2TensorDampingController=Cs,t.b2TestOverlapAABB=Ce,t.b2TestOverlapShape=De,t.b2TimeOfImpact=ui,t.b2TimeStep=gr,t.b2Timer=Nt,t.b2Transform=Bt,t.b2TreeNode=Oe,t.b2Vec2=bt,t.b2Vec2_zero=xt,t.b2Vec3=Ct,t.b2Velocity=vr,t.b2VelocityConstraintPoint=Tr,t.b2Version=X,t.b2WeldJoint=Yn,t.b2WeldJointDef=jn,t.b2WheelJoint=Kn,t.b2WheelJointDef=qn,t.b2World=vs,t.b2WorldManifold=Se,t.b2_180_over_pi=et,t.b2_aabbExtension=_,t.b2_aabbMultiplier=d,t.b2_angularSleepTolerance=U,t.b2_angularSlop=m,t.b2_barrierCollisionTime=k,t.b2_baumgarte=R,t.b2_branch=Y,t.b2_commit=q,t.b2_epsilon=a,t.b2_epsilon_sq=o,t.b2_gjk_reset=jt,t.b2_invalidParticleIndex=I,t.b2_linearSleepTolerance=V,t.b2_linearSlop=p,t.b2_maxAngularCorrection=T,t.b2_maxFloat=r,t.b2_maxLinearCorrection=A,t.b2_maxManifoldPoints=l,t.b2_maxParticleForce=M,t.b2_maxParticleIndex=B,t.b2_maxParticlePressure=O,t.b2_maxPolygonVertices=c,t.b2_maxRotation=x,t.b2_maxRotationSquared=C,t.b2_maxSubSteps=y,t.b2_maxTOIContacts=v,t.b2_maxTranslation=E,t.b2_maxTranslationSquared=b,t.b2_maxTriadDistance=N,t.b2_maxTriadDistanceSquared=L,t.b2_minParticleSystemBufferCapacity=F,t.b2_minParticleWeight=P,t.b2_minPulleyLength=Gn,t.b2_particleStride=D,t.b2_pi=h,t.b2_pi_over_180=tt,t.b2_polygonRadius=g,t.b2_timeToSleep=G,t.b2_toiBaumgarte=w,t.b2_toi_reset=Ue,t.b2_two_pi=it,t.b2_velocityThreshold=S,t.b2_version=j,t.g_blockSolve=Ar,Object.defineProperty(t,"__esModule",{value:!0})}((e={exports:{}}).exports),e.exports}();(o9=h9)&&o9.__esModule&&Object.prototype.hasOwnProperty.call(o9,"default")&&o9.default;var u9={};for(var l9 in h9)-1===l9.indexOf("b2_")&&(u9[l9.replace("b2","")]=h9[l9]);var c9=u9,_9=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._contactFixtures=[],e._BeginContact=null,e._EndContact=null,e._PreSolve=null,e._PostSolve=null,e}s(e,t);var i=e.prototype;return i.setBeginContact=function(t){this._BeginContact=t},i.setEndContact=function(t){this._EndContact=t},i.setPreSolve=function(t){this._PreSolve=t},i.setPostSolve=function(t){this._PostSolve=t},i.BeginContact=function(t){if(this._BeginContact){var e=t.GetFixtureA(),i=t.GetFixtureB(),n=this._contactFixtures;t._shouldReport=!1,-1===n.indexOf(e)&&-1===n.indexOf(i)||(t._shouldReport=!0,this._BeginContact(t))}},i.EndContact=function(t){this._EndContact&&t._shouldReport&&(t._shouldReport=!1,this._EndContact(t))},i.PreSolve=function(t,e){this._PreSolve&&t._shouldReport&&this._PreSolve(t,e)},i.PostSolve=function(t,e){this._PostSolve&&t._shouldReport&&this._PostSolve(t,e)},i.registerContactFixture=function(t){this._contactFixtures.push(t)},i.unregisterContactFixture=function(t){oe(this._contactFixtures,t)},e}(c9.ContactListener),f9=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._point=new c9.Vec2,e._isPoint=!1,e._fixtures=[],e}s(e,t);var i=e.prototype;return i.init=function(t){t?(this._isPoint=!0,this._point.x=t.x,this._point.y=t.y):this._isPoint=!1,this._fixtures.length=0},i.ReportFixture=function(t){return this._isPoint?t.TestPoint(this._point)&&this._fixtures.push(t):this._fixtures.push(t),!0},i.getFixture=function(){return this._fixtures[0]},i.getFixtures=function(){return this._fixtures},e}(c9.QueryCallback);function d9(t,e){var i=e.length;return e[t<0?i- -t%i:t%i]}function p9(t,e,i){for(var n=[];e<t;)e+=i.length;for(;t<=e;++t)n.push(d9(t,i));return n}function m9(t,e,i){if(g9(t,i)){if(S9(d9(t,i),d9(t-1,i),d9(e,i))&&A9(d9(t,i),d9(t+1,i),d9(e,i)))return!1}else if(A9(d9(t,i),d9(t+1,i),d9(e,i))||S9(d9(t,i),d9(t-1,i),d9(e,i)))return!1;if(g9(e,i)){if(S9(d9(e,i),d9(e-1,i),d9(t,i))&&A9(d9(e,i),d9(e+1,i),d9(t,i)))return!1}else if(A9(d9(e,i),d9(e+1,i),d9(t,i))||S9(d9(e,i),d9(e-1,i),d9(t,i)))return!1;for(var n=0;n<i.length;++n)if((n+1)%i.length!=t&&n!=t&&(n+1)%i.length!=e&&n!=e){var r=new yn;if(C9(d9(t,i),d9(e,i),d9(n,i),d9(n+1,i),r))return!1}return!0}function g9(t,e){return y9(t,e)}function y9(t,e,i){if(void 0===i){var n=t,r=e;t=d9(n-1,r),e=d9(n,r),void 0===t&&(t=e),void 0===(i=d9(n+1,r))&&(i=e)}return R9(t,e,i)<0}function v9(t,e,i){return R9(t,e,i)>0}function S9(t,e,i){return R9(t,e,i)>=0}function A9(t,e,i){return R9(t,e,i)<=0}function T9(t,e){var i=e.x-t.x,n=e.y-t.y;return i*i+n*n}function E9(t){b9(t)||t.reverse()}function b9(t){return t.length<3||function(t){var e,i=0;for(e=0;e<t.length;e++){var n=(e+1)%t.length;i+=t[e].x*t[n].y,i-=t[e].y*t[n].x}return i/2}(t)>0}function x9(t,e,i,n){var r,s=new yn,a=e.y-t.y,o=t.x-e.x,h=a*t.x+o*t.y,u=n.y-i.y,l=i.x-n.x,c=u*i.x+l*i.y,_=a*l-u*o;return r=_,0,Math.abs(r-0)<=1e-6||(s.x=(l*h-o*c)/_,s.y=(a*c-u*h)/_),s}function C9(t,e,i,n,r){if(t==i||t==n||e==i||e==n)return!1;var s=t.x,a=t.y,o=e.x,h=e.y,u=i.x,l=i.y,c=n.x,_=n.y;if(Math.max(s,o)<Math.min(u,c)||Math.max(u,c)<Math.min(s,o))return!1;if(Math.max(a,h)<Math.min(l,_)||Math.max(l,_)<Math.min(a,h))return!1;var f=(c-u)*(a-l)-(_-l)*(s-u),d=(o-s)*(a-l)-(h-a)*(s-u),p=(_-l)*(o-s)-(c-u)*(h-a);return!(Math.abs(p)<1e-6)&&(d/=p,(f/=p)>0&&f<1&&d>0&&d<1&&(r.x=s+f*(o-s),r.y=a+f*(h-a),!0))}function R9(t,e,i){return t.x*(e.y-i.y)+e.x*(i.y-t.y)+i.x*(t.y-e.y)}var w9=Object.freeze({__proto__:null,ConvexPartition:function t(e){E9(e);for(var i,n,r,s,a,o,h=[],u=new yn,l=new yn,c=0,_=0,f=0;f<e.length;++f)if(g9(f,e)){n=r=1e8;for(var d=0;d<e.length;++d)v9(d9(f-1,e),d9(f,e),d9(d,e))&&A9(d9(f-1,e),d9(f,e),d9(d-1,e))&&(s=x9(d9(f-1,e),d9(f,e),d9(d,e),d9(d-1,e)),y9(d9(f+1,e),d9(f,e),s)&&(i=T9(d9(f,e),s))<n&&(n=i,u=s,c=d)),v9(d9(f+1,e),d9(f,e),d9(d+1,e))&&A9(d9(f+1,e),d9(f,e),d9(d,e))&&(s=x9(d9(f+1,e),d9(f,e),d9(d,e),d9(d+1,e)),v9(d9(f-1,e),d9(f,e),s)&&(i=T9(d9(f,e),s))<r&&(r=i,_=d,l=s));if(c==(_+1)%e.length){var p=u.add(l).multiplyScalar(.5);(a=p9(f,_,e)).push(p),(o=p9(c,f,e)).push(p)}else{for(var m=0,g=c;_<c;)_+=e.length;for(var y=c;y<=_;++y)if(m9(f,y,e)){var v=1/(T9(d9(f,e),d9(y,e))+1);g9(y,e)?A9(d9(y-1,e),d9(y,e),d9(f,e))&&S9(d9(y+1,e),d9(y,e),d9(f,e))?v+=3:v+=2:v+=1,v>m&&(g=y,m=v)}a=p9(f,g,e),o=p9(g,f,e)}return(h=h.concat(t(a))).concat(t(o))}h.push(e);for(var S=h.length-1;S>=0;S--)0==h[S].length&&h.splice(S,0);return h},ForceCounterClockWise:E9,IsCounterClockWise:b9});function I9(t){M9(t);for(var e=!0,i=0,n=t.length;i<n;++i)if(!P9(t[(i+n-1)%n],t[i],t[(i+1)%n])){e=!1;break}if(e)return[t];var r=[],s=function(t){if(M9(t),t.length<4)return[t];for(var e=t.length,i=[],n=[],r=0;r<e;++r){var s=new B9;s.isActive=!0,s.isConvex=!1,s.isEar=!1,s.point=t[r],s.angleCos=0,s.shouldUpdate=!0,s.index=r,i.push(s)}for(var a=0;a<e;++a){var o=i[a];o.prev=i[(a+e-1)%e],o.next=i[(a+1)%e]}i.forEach((function(t){return N9(t,i)}));for(var h=0;h<e-3;++h){for(var u=void 0,l=0;l<e;++l){var c=i[l];c.isActive&&c.isEar&&(u?c.angleCos>u.angleCos&&(u=c):u=c)}if(!u){for(var _=0;_<e;++_){var f=i[_];if(f.isActive){var d=f.prev.point,p=f.point,m=f.next.point;if(Math.abs(D9(d,p,m))>1e-5)return console.log("Failed to find ear. There might be self-intersection in the polygon."),null}}break}if(n.push([u.prev.point,u.point,u.next.point]),u.isActive=!1,u.prev.next=u.next,u.next.prev=u.prev,u.prev.shouldUpdate=!0,u.next.shouldUpdate=!0,L9(u.next),h===e-4)break;for(var g=0;g<e;++g)N9(i[g],i)}for(var y=0;y<e;++y){var v=i[y];if(v.isActive){v.prev.isActive=!1,v.next.isActive=!1;var S=v.prev.point,A=v.point,T=v.next.point;Math.abs(D9(S,A,T))>1e-5&&n.push([S,A,T])}}return n}(t);if(!s)return null;for(;s.length;){for(var a=s.splice(0,1)[0],o=0,h=a.length;o<h;++o){for(var u=a[o],l=a[(o+1)%h],c=null,_=0;_<s.length;++_){for(var f=s[_],d=0;d<3;++d){var p=f[d];if(O9(u,f[(d+1)%3])&&O9(l,p)){c=f[(d+2)%3];break}}if(c)break}if(c&&!(D9(a[(o+h-1)%h],u,c)>0||D9(c,l,a[(o+2)%h])>0)){for(var m=[],g=(o+1)%h;g!==o;g=(g+1)%h)m.push(a[g]);m.push(u,c),a=m,h=m.length,o=-1,s.splice(_,1)}}r.push(a)}return r}var B9=function(){this.isActive=!1,this.isConvex=!1,this.isEar=!1,this.point=null,this.angleCos=0,this.shouldUpdate=!1,this.index=0,this.prev=null,this.next=null};function D9(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function P9(t,e,i){return D9(t,e,i)<0}function O9(t,e){return t.x===e.x&&t.y===e.y}function M9(t){(function(t){for(var e=0,i=0,n=t.length;i<n;++i){var r=t[i],s=t[(i+1)%n];e+=(s.x-r.x)*(s.y+r.y)}return e>0})(t)&&t.reverse()}function N9(t,e){if(t.shouldUpdate){t.shouldUpdate=!1;var i=t.prev.point,n=t.point,r=t.next.point;t.isConvex=P9(i,n,r);var s=i.x-n.x,a=i.y-n.y,o=Math.sqrt(s*s+a*a);s/=o,a/=o;var h=r.x-n.x,u=r.y-n.y,l=Math.sqrt(h*h+u*u);if(h/=l,u/=l,t.angleCos=s*h+a*u,t.isConvex){t.isEar=!0;for(var c=0,_=e.length;c<_;++c){var f=e[c];if(f.isActive&&f!==t){var d=f.point;if(!(O9(i,d)||O9(n,d)||O9(r,d))){var p=D9(i,d,n),m=D9(n,d,r),g=D9(r,d,i);if(p>0&&m>0&&g>0){t.isEar=!1;break}if(0===p&&m>=0&&g>=0&&(D9(i,f.prev.point,n)>0||D9(i,f.next.point,n)>0)){t.isEar=!1;break}if(0===m&&p>=0&&g>=0&&(D9(n,f.prev.point,r)>0||D9(n,f.next.point,r)>0)){t.isEar=!1;break}if(0===g&&p>=0&&m>=0&&(D9(r,f.prev.point,i)>0||D9(r,f.next.point,i)>0)){t.isEar=!1;break}}}}}else t.isEar=!1}}function L9(t){for(var e=t,i=t;;)if(O9(e.point,e.next.point)||0===D9(e.prev.point,e.point,e.next.point)){if(e.prev.next=e.next,e.next.prev=e.prev,e.prev.shouldUpdate=!0,e.next.shouldUpdate=!0,e===e.next)break;i=e.prev,e=e.next}else if((e=e.next)===i)break}var F9,k9,G9,V9,U9,z9,H9,W9,X9,j9,Y9=Object.freeze({__proto__:null,ConvexPartition:I9});!function(t){t[t.DYNAMIC=1]="DYNAMIC",t[t.STATIC=2]="STATIC",t[t.KINEMATIC=4]="KINEMATIC"}(F9||(F9={})),me(F9),function(t){t[t.X_AXIS=0]="X_AXIS",t[t.Y_AXIS=1]="Y_AXIS",t[t.Z_AXIS=2]="Z_AXIS"}(k9||(k9={})),me(k9),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"}(G9||(G9={})),me(G9),function(t){t[t.VERTEX=1]="VERTEX",t[t.LINE=2]="LINE",t[t.TRIANGLE=3]="TRIANGLE",t[t.TETRAHEDRON=4]="TETRAHEDRON"}(V9||(V9={})),me(V9),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"}(U9||(U9={})),me(U9),function(t){t[t.POINT_TO_POINT=0]="POINT_TO_POINT",t[t.HINGE=1]="HINGE",t[t.CONE_TWIST=2]="CONE_TWIST",t[t.FIXED=3]="FIXED",t[t.CONFIGURABLE=4]="CONFIGURABLE"}(z9||(z9={})),me(z9),function(t){t[t.FREE=0]="FREE",t[t.LIMITED=1]="LIMITED",t[t.LOCKED=2]="LOCKED"}(H9||(H9={})),me(H9),function(t){t[t.DISABLED=0]="DISABLED",t[t.SERVO=1]="SERVO",t[t.INDUCTION=2]="INDUCTION"}(W9||(W9={})),me(W9),function(t){t[t.BOX=0]="BOX",t[t.CAPSULE=1]="CAPSULE"}(X9||(X9={})),me(X9),function(t){t[t.DEFAULT=1]="DEFAULT"}(j9||(j9={})),me(j9);var q9=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=j9.DEFAULT}else{for(var r=0;r<32;r++)this[""+(1<<r)]=0;this[1]=j9.DEFAULT}},K9=null;v.internal.PhysicsGroup2D=Y7;var J9,Q9,Z9,$9,ttt,ett,itt,ntt,rtt,stt,att,ott,htt,utt,ltt,ctt,_tt,ftt,dtt,ptt,mtt,gtt,ytt,vtt,Stt,Att=t("eS",function(t){function e(){var e,i,n,r,s;(s=t.call(this)||this).velocityIterations=10,s.positionIterations=10,s.collisionMatrix=new q9,s._enable=!0,s._allowSleep=!0,s._maxSubSteps=1,s._fixedTimeStep=1/60,s._autoSimulation=!0,s._accumulator=0,s._steping=!1,s._gravity=new yn(0,-10*$7),s._delayEvents=[];var a=Ee.querySettings(Te.Category.PHYSICS,"gravity");a&&(yn.copy(s._gravity,a),s._gravity.multiplyScalar($7)),s._allowSleep=null!==(e=Ee.querySettings(Te.Category.PHYSICS,"allowSleep"))&&void 0!==e?e:s._allowSleep,s._fixedTimeStep=null!==(i=Ee.querySettings(Te.Category.PHYSICS,"fixedTimeStep"))&&void 0!==i?i:s._fixedTimeStep,s._maxSubSteps=null!==(n=Ee.querySettings(Te.Category.PHYSICS,"maxSubSteps"))&&void 0!==n?n:s._maxSubSteps,s._autoSimulation=null!==(r=Ee.querySettings(Te.Category.PHYSICS,"autoSimulation"))&&void 0!==r?r:s._autoSimulation;var o=Ee.querySettings(Te.Category.PHYSICS,"collisionMatrix");if(o)for(var h in o){var u=parseInt(h),l=1<<parseInt(h);s.collisionMatrix[""+l]=o[u]}var c=Ee.querySettings(Te.Category.PHYSICS,"collisionGroups");return c&&c instanceof Array&&(c.forEach((function(t){Y7[t.name]=1<<t.index})),me.update(Y7)),t9.physicsWorld=i9(),s.gravity=s._gravity,s.allowSleep=s._allowSleep,s}s(e,t);var i=e.prototype;return i.postUpdate=function(t){if(this._enable&&this._autoSimulation){vN.emit(yN.EVENT_BEFORE_PHYSICS),this.physicsWorld.syncSceneToPhysics(),this._steping=!0;var e=this._fixedTimeStep,i=this.velocityIterations,n=this.positionIterations;this._accumulator+=t;for(var r=0;r++<this._maxSubSteps&&this._accumulator>e;)this.physicsWorld.step(e,i,n),this._accumulator-=e;for(var s=this._delayEvents,a=0,o=s.length;a<o;a++){var h=s[a];h.func.call(h.target)}s.length=0,this.physicsWorld.syncPhysicsToScene(),this.debugDrawFlags&&this.physicsWorld.drawDebug(),this._steping=!1,vN.emit(yN.EVENT_AFTER_PHYSICS)}},i._callAfterStep=function(t,e){this._steping?this._delayEvents.push({target:t,func:e}):e.call(t)},i.resetAccumulator=function(t){void 0===t&&(t=0),this._accumulator=t},i.step=function(t){this.physicsWorld.step(t,this.velocityIterations,this.positionIterations)},i.raycast=function(t,e,i,n){return void 0===i&&(i=q7.Closest),void 0===n&&(n=4294967295),this.physicsWorld.raycast(t,e,i,n)},i.testPoint=function(t){return this.physicsWorld.testPoint(t)},i.testAABB=function(t){return this.physicsWorld.testAABB(t)},n(e,[{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.setAllowSleep(t)}},{key:"gravity",get:function(){return this._gravity},set:function(t){this._gravity.set(t),this.physicsWorld.setGravity(new yn(t.x/$7,t.y/$7))}},{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:"autoSimulation",get:function(){return this._autoSimulation},set:function(t){this._autoSimulation=t}},{key:"debugDrawFlags",get:function(){return this.physicsWorld.debugDrawFlags},set:function(t){this.physicsWorld.debugDrawFlags=t}},{key:"physicsWorld",get:function(){return t9.physicsWorld}},{key:"stepping",get:function(){return this._steping}}],[{key:"PHYSICS_NONE",get:function(){return!t9.id}},{key:"PHYSICS_BUILTIN",get:function(){return"builtin"===t9.id}},{key:"PHYSICS_BOX2D",get:function(){return"box2d"===t9.id}},{key:"PhysicsGroup",get:function(){return Y7}},{key:"instance",get:function(){return K9||(K9=new e),K9}}]),e}(Bu(pu)));Att.ID="PHYSICS_2D",vN.once(yN.EVENT_INIT,(function(){vN.registerSystem(Att.ID,Att.instance,pu.Priority.LOW)})),t("eT",J9),function(t){t[t.Circles=0]="Circles",t[t.FaceA=1]="FaceA",t[t.FaceB=2]="FaceB"}(J9||t("eT",J9={}));var Ttt,Ett,btt,xtt,Ctt,Rtt,wtt,Itt,Btt,Dtt,Ptt,Ott,Mtt,Ntt,Ltt,Ftt,ktt,Gtt,Vtt,Utt,ztt,Htt,Wtt,Xtt,jtt,Ytt,qtt,Ktt,Jtt,Qtt,Ztt,$tt,tet,eet,iet,net,ret,set,aet,oet,het,uet,cet,_et,fet,det,pet,met,get,yet,vet,Aet,Tet,Eet,bet,xet,Cet,Ret,wet,Iet,Bet,Det,Pet,Oet,Met,Net,Let,Fet,ket,Get,Vet,Uet,zet,Het,Wet,Xet,jet,Yet,qet,Ket,Jet,Qet,Zet,$et,tit,eit,iit,nit,rit,sit,ait,oit,hit,uit,lit,cit,_it,fit,dit,pit,mit,git,yit,vit,Sit,Ait,Tit,Eit,bit,xit,Cit,Rit,wit,Iit,Bit,Dit,Pit,Oit,Mit,Nit,Lit,Fit,kit,Git,Vit,Uit,zit,Hit,Wit,Xit,jit,Yit,qit,Kit,Jit,Qit,Zit,$it,tnt,ent,int=ha,nnt=t("eU",(Q9=Is("cc.RigidBody2D"),Z9=int(j9),$9=int(W7),ttt=int(qe),ett=int(Ye),itt=int(Ye),ntt=int(Ye),rtt=int(yn),stt=int(Ye),att=int(qe),Q9((p((htt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).enabledContactListener=utt&&utt(),e.bullet=ltt&<t(),e.awakeOnLoad=ctt&&ctt(),e._body=null,e._group=_tt&&_tt(),e._type=ftt&&ftt(),e._allowSleep=dtt&&dtt(),e._gravityScale=ptt&&ptt(),e._linearDamping=mtt&&mtt(),e._angularDamping=gtt&>t(),e._linearVelocity=ytt&&ytt(),e._angularVelocity=vtt&&vtt(),e._fixedRotation=Stt&&Stt(),e}s(e,t);var i=e.prototype;return i.isAwake=function(){return!!this._body&&this._body.isAwake},i.wakeUp=function(){this._body&&this._body.wakeUp()},i.sleep=function(){this._body&&this._body.sleep()},i.getMass=function(){return this._body?this._body.getMass():0},i.applyForce=function(t,e,i){this._body&&this._body.applyForce(t,e,i)},i.applyForceToCenter=function(t,e){this._body&&this._body.applyForceToCenter(t,e)},i.applyTorque=function(t,e){this._body&&this._body.applyTorque(t,e)},i.applyLinearImpulse=function(t,e,i){this._body&&this._body.applyLinearImpulse(t,e,i)},i.applyLinearImpulseToCenter=function(t,e){this._body&&this._body.applyLinearImpulseToCenter(t,e)},i.applyAngularImpulse=function(t,e){this._body&&this._body.applyAngularImpulse(t,e)},i.getLinearVelocityFromWorldPoint=function(t,e){return this._body?this._body.getLinearVelocityFromWorldPoint(t,e):e},i.getLocalVector=function(t,e){return this._body?this._body.getLocalVector(t,e):e},i.getWorldVector=function(t,e){return this._body?this._body.getWorldVector(t,e):e},i.getLocalPoint=function(t,e){return this._body?this._body.getLocalPoint(t,e):e},i.getWorldPoint=function(t,e){return this._body?this._body.getWorldPoint(t,e):e},i.getLocalCenter=function(t){return this._body?this._body.getLocalCenter(t):t},i.getWorldCenter=function(t){return this._body?this._body.getWorldCenter(t):t},i.getInertia=function(){return this._body&&this._body.getInertia(),0},i.onLoad=function(){this._body="builtin"===t9.id?n9:new t9.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()},n(e,[{key:"group",get:function(){return this._group},set:function(t){this._group=t}},{key:"type",get:function(){return this._type},set:function(t){this._type=t,this._body&&(t===W7.Animated?this._body.setType(W7.Kinematic):this._body.setType(t))}},{key:"allowSleep",get:function(){return this._allowSleep},set:function(t){this._allowSleep=t,this._body&&this._body.setAllowSleep(t)}},{key:"gravityScale",get:function(){return this._gravityScale},set:function(t){this._gravityScale=t,this._body&&this._body.setGravityScale(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:"linearVelocity",get:function(){return this._body&&this._body.getLinearVelocity(this._linearVelocity),this._linearVelocity},set:function(t){this._linearVelocity=t,this._body&&this._body.setLinearVelocity(t)}},{key:"angularVelocity",get:function(){return this._body&&(this._angularVelocity=this._body.getAngularVelocity()),this._angularVelocity},set:function(t){this._angularVelocity=t,this._body&&this._body.setAngularVelocity(t)}},{key:"fixedRotation",get:function(){return this._fixedRotation},set:function(t){this._fixedRotation=t,this._body&&this._body.setFixedRotation(t)}},{key:"impl",get:function(){return this._body}}]),e}(Vd)).prototype,"group",[Z9],Object.getOwnPropertyDescriptor(htt.prototype,"group"),htt.prototype),utt=Ss(htt.prototype,"enabledContactListener",[ks],(function(){return!1})),ltt=Ss(htt.prototype,"bullet",[ks],(function(){return!1})),p(htt.prototype,"type",[$9],Object.getOwnPropertyDescriptor(htt.prototype,"type"),htt.prototype),p(htt.prototype,"allowSleep",[ttt],Object.getOwnPropertyDescriptor(htt.prototype,"allowSleep"),htt.prototype),p(htt.prototype,"gravityScale",[ett],Object.getOwnPropertyDescriptor(htt.prototype,"gravityScale"),htt.prototype),p(htt.prototype,"linearDamping",[itt],Object.getOwnPropertyDescriptor(htt.prototype,"linearDamping"),htt.prototype),p(htt.prototype,"angularDamping",[ntt],Object.getOwnPropertyDescriptor(htt.prototype,"angularDamping"),htt.prototype),p(htt.prototype,"linearVelocity",[rtt],Object.getOwnPropertyDescriptor(htt.prototype,"linearVelocity"),htt.prototype),p(htt.prototype,"angularVelocity",[stt],Object.getOwnPropertyDescriptor(htt.prototype,"angularVelocity"),htt.prototype),p(htt.prototype,"fixedRotation",[att],Object.getOwnPropertyDescriptor(htt.prototype,"fixedRotation"),htt.prototype),ctt=Ss(htt.prototype,"awakeOnLoad",[ks],(function(){return!0})),_tt=Ss(htt.prototype,"_group",[ks],(function(){return j9.DEFAULT})),ftt=Ss(htt.prototype,"_type",[ks],(function(){return W7.Dynamic})),dtt=Ss(htt.prototype,"_allowSleep",[ks],(function(){return!0})),ptt=Ss(htt.prototype,"_gravityScale",[ks],(function(){return 1})),mtt=Ss(htt.prototype,"_linearDamping",[ks],(function(){return 0})),gtt=Ss(htt.prototype,"_angularDamping",[ks],(function(){return 0})),ytt=Ss(htt.prototype,"_linearVelocity",[ks],(function(){return new yn})),vtt=Ss(htt.prototype,"_angularVelocity",[ks],(function(){return 0})),Stt=Ss(htt.prototype,"_fixedRotation",[ks],(function(){return!1})),ott=htt))||ott)),rnt=ha,snt=t("eV",(Ttt=Is("cc.Collider2D"),Ett=rnt(Ye),btt=rnt(j9),xtt=rnt(Ye),Ctt=rnt(qe),Rtt=rnt(Ye),wtt=rnt(Ye),Itt=rnt(yn),Ttt((Dtt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).editing=!1,e.tag=Ptt&&Ptt(),e.TYPE=X7.None,e._shape=null,e._body=null,e._group=Ott&&Ott(),e._density=Mtt&&Mtt(),e._sensor=Ntt&&Ntt(),e._friction=Ltt&&Ltt(),e._restitution=Ftt&&Ftt(),e._offset=ktt&&ktt(),e}s(e,t);var i=e.prototype;return i.onLoad=function(){this._shape=function(t){return r9.INITED||(r9.INITED=!0,r9[X7.BOX]=function(){return new t9.wrapper.BoxShape},r9[X7.CIRCLE]=function(){return new t9.wrapper.CircleShape},r9[X7.POLYGON]=function(){return new t9.wrapper.PolygonShape}),r9[t]()}(this.TYPE),this._shape.initialize(this),this._shape.onLoad&&this._shape.onLoad(),this._body=this.getComponent(nnt)},i.onEnable=function(){this._shape&&this._shape.onEnable()},i.onDisable=function(){this._shape&&this._shape.onDisable&&this._shape.onDisable()},i.onDestroy=function(){this._shape&&this._shape.onDestroy&&this._shape.onDestroy()},i.apply=function(){this._shape&&this._shape.apply&&this._shape.apply()},n(e,[{key:"group",get:function(){return this._group},set:function(t){this._group=t,this._shape&&this._shape.onGroupChanged&&this._shape.onGroupChanged()}},{key:"density",get:function(){return this._density},set:function(t){this._density=t}},{key:"sensor",get:function(){return this._sensor},set:function(t){this._sensor=t}},{key:"friction",get:function(){return this._friction},set:function(t){this._friction=t}},{key:"restitution",get:function(){return this._restitution},set:function(t){this._restitution=t}},{key:"offset",get:function(){return this._offset},set:function(t){this._offset=t}},{key:"body",get:function(){return this._body}},{key:"impl",get:function(){return this._shape}},{key:"worldAABB",get:function(){return this._shape?this._shape.worldAABB:new En}}]),e}(Bu(Vd)),Ptt=Ss(Dtt.prototype,"tag",[Ett,ks],(function(){return 0})),p(Dtt.prototype,"group",[btt],Object.getOwnPropertyDescriptor(Dtt.prototype,"group"),Dtt.prototype),p(Dtt.prototype,"density",[xtt],Object.getOwnPropertyDescriptor(Dtt.prototype,"density"),Dtt.prototype),p(Dtt.prototype,"sensor",[Ctt],Object.getOwnPropertyDescriptor(Dtt.prototype,"sensor"),Dtt.prototype),p(Dtt.prototype,"friction",[Rtt],Object.getOwnPropertyDescriptor(Dtt.prototype,"friction"),Dtt.prototype),p(Dtt.prototype,"restitution",[wtt],Object.getOwnPropertyDescriptor(Dtt.prototype,"restitution"),Dtt.prototype),p(Dtt.prototype,"offset",[Itt],Object.getOwnPropertyDescriptor(Dtt.prototype,"offset"),Dtt.prototype),Ott=Ss(Dtt.prototype,"_group",[ks],(function(){return j9.DEFAULT})),Mtt=Ss(Dtt.prototype,"_density",[ks],(function(){return 1})),Ntt=Ss(Dtt.prototype,"_sensor",[ks],(function(){return!1})),Ltt=Ss(Dtt.prototype,"_friction",[ks],(function(){return.2})),Ftt=Ss(Dtt.prototype,"_restitution",[ks],(function(){return 0})),ktt=Ss(Dtt.prototype,"_offset",[ks],(function(){return new yn})),Btt=Dtt))||Btt)),ant=(t("eW",(Gtt=Is("cc.BoxCollider2D"),Vtt=ha(An),Gtt((ztt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._size=Htt&&Htt(),e.TYPE=X7.BOX,e}return s(e,t),n(e,[{key:"size",get:function(){return this._size},set:function(t){this._size=t}},{key:"worldPoints",get:function(){return this._shape?this._shape.worldPoints:[]}}]),e}(snt),Htt=Ss(ztt.prototype,"_size",[ks],(function(){return new An(1,1)})),p(ztt.prototype,"size",[Vtt],Object.getOwnPropertyDescriptor(ztt.prototype,"size"),ztt.prototype),Utt=ztt))||Utt)),t("eX",(Wtt=Is("cc.CircleCollider2D"),Xtt=ha(Ye),Wtt((Ytt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._radius=qtt&&qtt(),e.TYPE=X7.CIRCLE,e}return s(e,t),n(e,[{key:"radius",get:function(){return this._radius},set:function(t){this._radius=t<0?0:t}},{key:"worldPosition",get:function(){return this._shape?this._shape.worldPosition:new yn}},{key:"worldRadius",get:function(){return this._shape?this._shape.worldRadius:0}}]),e}(snt),qtt=Ss(Ytt.prototype,"_radius",[ks],(function(){return 1})),p(Ytt.prototype,"radius",[Xtt],Object.getOwnPropertyDescriptor(Ytt.prototype,"radius"),Ytt.prototype),jtt=Ytt))||jtt)),t("eY",(Ktt=Is("cc.PolygonCollider2D"),Jtt=ha(Ye),Qtt=ha([yn]),Ktt(($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).threshold=tet&&tet(),e._points=eet&&eet(),e.TYPE=X7.POLYGON,e}return s(e,t),n(e,[{key:"points",get:function(){return this._points},set:function(t){this._points=t}},{key:"worldPoints",get:function(){return this._shape?this._shape.worldPoints:[]}}]),e}(snt),tet=Ss($tt.prototype,"threshold",[Jtt],(function(){return 1})),eet=Ss($tt.prototype,"_points",[ks],(function(){return[new yn(-1,-1),new yn(1,-1),new yn(1,1),new yn(-1,1)]})),p($tt.prototype,"points",[Qtt],Object.getOwnPropertyDescriptor($tt.prototype,"points"),$tt.prototype),Ztt=$tt))||Ztt)),ha),ont=t("eZ",(iet=Is("cc.Joint2D"),net=ant(nnt),iet((set=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).anchor=aet&&aet(),e.connectedAnchor=oet&&oet(),e.collideConnected=het&&het(),e.connectedBody=uet&&uet(),e._body=null,e._joint=null,e.TYPE=j7.None,e}s(e,t);var i=e.prototype;return i.onLoad=function(){this._joint=function(t){return function(){if(!s9.INITED){s9.INITED=!0;var t="builtin"===t9.id;s9[j7.SPRING]=function(){return t?a9:new t9.wrapper.SpringJoint},s9[j7.DISTANCE]=function(){return t?a9:new t9.wrapper.DistanceJoint},s9[j7.FIXED]=function(){return t?a9:new t9.wrapper.FixedJoint},s9[j7.MOUSE]=function(){return t?a9:new t9.wrapper.MouseJoint},s9[j7.RELATIVE]=function(){return t?a9:new t9.wrapper.RelativeJoint},s9[j7.SLIDER]=function(){return t?a9:new t9.wrapper.SliderJoint},s9[j7.WHEEL]=function(){return t?a9:new t9.wrapper.WheelJoint},s9[j7.HINGE]=function(){return t?a9:new t9.wrapper.HingeJoint}}}(),s9[t]()}(this.TYPE),this._joint.initialize(this),this._body=this.getComponent(nnt)},i.onEnable=function(){this._joint&&this._joint.onEnable&&this._joint.onEnable()},i.onDisable=function(){this._joint&&this._joint.onDisable&&this._joint.onDisable()},i.start=function(){this._joint&&this._joint.start&&this._joint.start()},i.onDestroy=function(){this._joint&&this._joint.onDestroy&&this._joint.onDestroy()},n(e,[{key:"body",get:function(){return this._body}},{key:"impl",get:function(){return this._joint}}]),e}(Vd),aet=Ss(set.prototype,"anchor",[ks],(function(){return new yn})),oet=Ss(set.prototype,"connectedAnchor",[ks],(function(){return new yn})),het=Ss(set.prototype,"collideConnected",[ks],(function(){return!1})),uet=Ss(set.prototype,"connectedBody",[net,ks],(function(){return null})),ret=set))||ret)),hnt=(t("e_",(cet=Is("cc.DistanceJoint2D"),_et=ha(Ye),fet=ha(qe),cet((p((pet=function(t){function e(){for(var e,i=arguments.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=j7.DISTANCE,e._maxLength=met&&met(),e._autoCalcDistance=get&&get(),e}return s(e,t),n(e,[{key:"maxLength",get:function(){return this._autoCalcDistance?this.connectedBody?Yi.distance(this.node.worldPosition,this.connectedBody.node.worldPosition):Yi.len(this.node.worldPosition):this._maxLength},set:function(t){this._maxLength=t,this._joint&&this._joint.setMaxLength(t)}},{key:"autoCalcDistance",get:function(){return this._autoCalcDistance},set:function(t){this._autoCalcDistance=t}}]),e}(ont)).prototype,"maxLength",[_et],Object.getOwnPropertyDescriptor(pet.prototype,"maxLength"),pet.prototype),p(pet.prototype,"autoCalcDistance",[fet],Object.getOwnPropertyDescriptor(pet.prototype,"autoCalcDistance"),pet.prototype),met=Ss(pet.prototype,"_maxLength",[ks],(function(){return 5})),get=Ss(pet.prototype,"_autoCalcDistance",[ks],(function(){return!0})),det=pet))||det)),t("e$",(yet=Is("cc.SpringJoint2D"),vet=ha(Ye),Aet=ha(Ye),Tet=ha(Ye),Eet=ha(qe),yet((p((xet=function(t){function e(){for(var e,i=arguments.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=j7.SPRING,e._frequency=Cet&&Cet(),e._dampingRatio=Ret&&Ret(),e._distance=wet&&wet(),e._autoCalcDistance=Iet&&Iet(),e}return s(e,t),n(e,[{key:"frequency",get:function(){return this._frequency},set:function(t){this._frequency=t,this._joint&&this._joint.setFrequency(t)}},{key:"dampingRatio",get:function(){return this._dampingRatio},set:function(t){this._dampingRatio=t,this._joint&&this._joint.setDampingRatio(t)}},{key:"distance",get:function(){return this._autoCalcDistance?this.connectedBody?Yi.distance(this.node.worldPosition,this.connectedBody.node.worldPosition):Yi.len(this.node.worldPosition):this._distance},set:function(t){this._distance=t,this._joint&&this._joint.setDistance(t)}},{key:"autoCalcDistance",get:function(){return this._autoCalcDistance},set:function(t){this._autoCalcDistance=t}}]),e}(ont)).prototype,"frequency",[vet],Object.getOwnPropertyDescriptor(xet.prototype,"frequency"),xet.prototype),p(xet.prototype,"dampingRatio",[Aet],Object.getOwnPropertyDescriptor(xet.prototype,"dampingRatio"),xet.prototype),p(xet.prototype,"distance",[Tet],Object.getOwnPropertyDescriptor(xet.prototype,"distance"),xet.prototype),p(xet.prototype,"autoCalcDistance",[Eet],Object.getOwnPropertyDescriptor(xet.prototype,"autoCalcDistance"),xet.prototype),Cet=Ss(xet.prototype,"_frequency",[ks],(function(){return 5})),Ret=Ss(xet.prototype,"_dampingRatio",[ks],(function(){return.7})),wet=Ss(xet.prototype,"_distance",[ks],(function(){return 10})),Iet=Ss(xet.prototype,"_autoCalcDistance",[ks],(function(){return!0})),bet=xet))||bet)),t("f0",(Bet=Is("cc.MouseJoint2D"),Det=ha(Ye),Pet=ha(Ye),Oet=ha(Ye),Bet((p((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).TYPE=j7.MOUSE,e._maxForce=Let&&Let(),e._dampingRatio=Fet&&Fet(),e._frequency=ket&&ket(),e._target=new yn,e}return s(e,t),e.prototype.update=function(t){this._joint.update(t)},n(e,[{key:"target",get:function(){return this._target},set:function(t){this._target=t,this._joint&&this._joint.setTarget(t)}},{key:"frequency",get:function(){return this._frequency},set:function(t){this._frequency=t,this._joint&&this._joint.setFrequency(t)}},{key:"dampingRatio",get:function(){return this._dampingRatio},set:function(t){this._dampingRatio=t,this._joint&&this._joint.setDampingRatio(t)}},{key:"maxForce",get:function(){return this._maxForce},set:function(t){this._maxForce=t,this._joint&&this._joint.setMaxForce(t)}}]),e}(ont)).prototype,"frequency",[Det],Object.getOwnPropertyDescriptor(Net.prototype,"frequency"),Net.prototype),p(Net.prototype,"dampingRatio",[Pet],Object.getOwnPropertyDescriptor(Net.prototype,"dampingRatio"),Net.prototype),p(Net.prototype,"maxForce",[Oet],Object.getOwnPropertyDescriptor(Net.prototype,"maxForce"),Net.prototype),Let=Ss(Net.prototype,"_maxForce",[ks],(function(){return 1e3})),Fet=Ss(Net.prototype,"_dampingRatio",[ks],(function(){return.7})),ket=Ss(Net.prototype,"_frequency",[ks],(function(){return 5})),Met=Net))||Met)),new Yi),unt=new Yi,lnt=(t("f1",(Get=Is("cc.RelativeJoint2D"),Vet=ha(Ye),Uet=ha(Ye),zet=ha(Ye),Het=ha(yn),Wet=ha(Ye),Xet=ha(qe),Get((p((Yet=function(t){function e(){for(var e,i=arguments.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=j7.RELATIVE,e._maxForce=qet&&qet(),e._maxTorque=Ket&&Ket(),e._correctionFactor=Jet&&Jet(),e._angularOffset=Qet&&Qet(),e._linearOffset=Zet&&Zet(),e._autoCalcOffset=$et&&$et(),e}return s(e,t),n(e,[{key:"maxForce",get:function(){return this._maxForce},set:function(t){this._maxForce=t,this._joint&&this._joint.setMaxForce(t)}},{key:"maxTorque",get:function(){return this._maxTorque},set:function(t){this._maxTorque=t,this._joint&&this._joint.setMaxTorque(t)}},{key:"correctionFactor",get:function(){return this._correctionFactor},set:function(t){this._correctionFactor=t,this._joint&&this._joint.setCorrectionFactor(t)}},{key:"linearOffset",get:function(){return this._autoCalcOffset?this.connectedBody?yn.subtract(this._linearOffset,this.connectedBody.node.worldPosition,this.node.worldPosition):yn.subtract(this._linearOffset,new yn(0,0),this.node.worldPosition):this._linearOffset},set:function(t){this._linearOffset.set(t),this._joint&&this._joint.setLinearOffset(t)}},{key:"angularOffset",get:function(){return this._autoCalcOffset&&(sn.toEuler(hnt,this.node.worldRotation),this.connectedBody?sn.toEuler(unt,this.connectedBody.node.worldRotation):sn.toEuler(unt,new sn),this._angularOffset=unt.z-hnt.z),this._angularOffset},set:function(t){this._angularOffset=t,this._joint&&this._joint.setAngularOffset(t)}},{key:"autoCalcOffset",get:function(){return this._autoCalcOffset},set:function(t){this._autoCalcOffset=t}}]),e}(ont)).prototype,"maxForce",[Vet],Object.getOwnPropertyDescriptor(Yet.prototype,"maxForce"),Yet.prototype),p(Yet.prototype,"maxTorque",[Uet],Object.getOwnPropertyDescriptor(Yet.prototype,"maxTorque"),Yet.prototype),p(Yet.prototype,"correctionFactor",[zet],Object.getOwnPropertyDescriptor(Yet.prototype,"correctionFactor"),Yet.prototype),p(Yet.prototype,"linearOffset",[Het],Object.getOwnPropertyDescriptor(Yet.prototype,"linearOffset"),Yet.prototype),p(Yet.prototype,"angularOffset",[Wet],Object.getOwnPropertyDescriptor(Yet.prototype,"angularOffset"),Yet.prototype),p(Yet.prototype,"autoCalcOffset",[Xet],Object.getOwnPropertyDescriptor(Yet.prototype,"autoCalcOffset"),Yet.prototype),qet=Ss(Yet.prototype,"_maxForce",[ks],(function(){return 5})),Ket=Ss(Yet.prototype,"_maxTorque",[ks],(function(){return.7})),Jet=Ss(Yet.prototype,"_correctionFactor",[ks],(function(){return.3})),Qet=Ss(Yet.prototype,"_angularOffset",[ks],(function(){return 0})),Zet=Ss(Yet.prototype,"_linearOffset",[ks],(function(){return new yn})),$et=Ss(Yet.prototype,"_autoCalcOffset",[ks],(function(){return!0})),jet=Yet))||jet)),new yn);t("f2",(tit=Is("cc.SliderJoint2D"),eit=ha(Ye),iit=ha(qe),nit=ha(qe),rit=ha(Ye),sit=ha(Ye),ait=ha(qe),oit=ha(Ye),hit=ha(Ye),tit((p((lit=function(t){function e(){for(var e,i=arguments.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=j7.SLIDER,e._angle=cit&&cit(),e._autoCalcAngle=_it&&_it(),e._enableMotor=fit&&fit(),e._maxMotorForce=dit&&dit(),e._motorSpeed=pit&&pit(),e._enableLimit=mit&&mit(),e._lowerLimit=git&&git(),e._upperLimit=yit&&yit(),e}return s(e,t),n(e,[{key:"angle",get:function(){return this._autoCalcAngle&&(this.connectedBody?yn.subtract(lnt,this.connectedBody.node.worldPosition,this.node.worldPosition):yn.subtract(lnt,new yn(0,0),this.node.worldPosition),this._angle=wi(Math.atan2(lnt.y,lnt.x))),this._angle},set:function(t){this._angle=t}},{key:"autoCalcAngle",get:function(){return this._autoCalcAngle},set:function(t){this._autoCalcAngle=t}},{key:"enableMotor",get:function(){return this._enableMotor},set:function(t){this._enableMotor=t}},{key:"maxMotorForce",get:function(){return this._maxMotorForce},set:function(t){this._maxMotorForce=t,this._joint&&this._joint.setMaxMotorForce(t)}},{key:"motorSpeed",get:function(){return this._motorSpeed},set:function(t){this._motorSpeed=t,this._joint&&this._joint.setMotorSpeed(t)}},{key:"enableLimit",get:function(){return this._enableLimit},set:function(t){this._enableLimit=t}},{key:"lowerLimit",get:function(){return this._lowerLimit},set:function(t){this._lowerLimit=t,this._joint&&this._joint.setLowerLimit(t)}},{key:"upperLimit",get:function(){return this._upperLimit},set:function(t){this._upperLimit=t,this._joint&&this._joint.setUpperLimit(t)}}]),e}(ont)).prototype,"angle",[eit],Object.getOwnPropertyDescriptor(lit.prototype,"angle"),lit.prototype),p(lit.prototype,"autoCalcAngle",[iit],Object.getOwnPropertyDescriptor(lit.prototype,"autoCalcAngle"),lit.prototype),p(lit.prototype,"enableMotor",[nit],Object.getOwnPropertyDescriptor(lit.prototype,"enableMotor"),lit.prototype),p(lit.prototype,"maxMotorForce",[rit],Object.getOwnPropertyDescriptor(lit.prototype,"maxMotorForce"),lit.prototype),p(lit.prototype,"motorSpeed",[sit],Object.getOwnPropertyDescriptor(lit.prototype,"motorSpeed"),lit.prototype),p(lit.prototype,"enableLimit",[ait],Object.getOwnPropertyDescriptor(lit.prototype,"enableLimit"),lit.prototype),p(lit.prototype,"lowerLimit",[oit],Object.getOwnPropertyDescriptor(lit.prototype,"lowerLimit"),lit.prototype),p(lit.prototype,"upperLimit",[hit],Object.getOwnPropertyDescriptor(lit.prototype,"upperLimit"),lit.prototype),cit=Ss(lit.prototype,"_angle",[ks],(function(){return 0})),_it=Ss(lit.prototype,"_autoCalcAngle",[ks],(function(){return!0})),fit=Ss(lit.prototype,"_enableMotor",[ks],(function(){return!1})),dit=Ss(lit.prototype,"_maxMotorForce",[ks],(function(){return 1e3})),pit=Ss(lit.prototype,"_motorSpeed",[ks],(function(){return 1e3})),mit=Ss(lit.prototype,"_enableLimit",[ks],(function(){return!1})),git=Ss(lit.prototype,"_lowerLimit",[ks],(function(){return 0})),yit=Ss(lit.prototype,"_upperLimit",[ks],(function(){return 0})),uit=lit))||uit)),t("f3",(vit=Is("cc.FixedJoint2D"),Sit=ha(Ye),Ait=ha(Ye),vit((p((Eit=function(t){function e(){for(var e,i=arguments.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=j7.FIXED,e._frequency=bit&&bit(),e._dampingRatio=xit&&xit(),e}return s(e,t),n(e,[{key:"frequency",get:function(){return this._frequency},set:function(t){this._frequency=t,this._joint&&this._joint.setFrequency(t)}},{key:"dampingRatio",get:function(){return this._dampingRatio},set:function(t){this._dampingRatio=t,this._joint&&this._joint.setDampingRatio(t)}}]),e}(ont)).prototype,"frequency",[Sit],Object.getOwnPropertyDescriptor(Eit.prototype,"frequency"),Eit.prototype),p(Eit.prototype,"dampingRatio",[Ait],Object.getOwnPropertyDescriptor(Eit.prototype,"dampingRatio"),Eit.prototype),bit=Ss(Eit.prototype,"_frequency",[ks],(function(){return.7})),xit=Ss(Eit.prototype,"_dampingRatio",[ks],(function(){return.5})),Tit=Eit))||Tit)),t("f4",(Cit=Is("cc.WheelJoint2D"),Rit=ha(Ye),wit=ha(qe),Iit=ha(Ye),Bit=ha(Ye),Dit=ha(Ye),Pit=ha(Ye),Cit((p((Mit=function(t){function e(){for(var e,i=arguments.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=j7.WHEEL,e._angle=Nit&&Nit(),e._enableMotor=Lit&&Lit(),e._maxMotorTorque=Fit&&Fit(),e._motorSpeed=kit&&kit(),e._frequency=Git&&Git(),e._dampingRatio=Vit&&Vit(),e}return s(e,t),n(e,[{key:"angle",get:function(){return this._angle},set:function(t){this._angle=t}},{key:"enableMotor",get:function(){return this._enableMotor},set:function(t){this._enableMotor=t,this._joint&&this._joint.enableMotor(t)}},{key:"maxMotorTorque",get:function(){return this._maxMotorTorque},set:function(t){this._maxMotorTorque=t,this._joint&&this._joint.setMaxMotorTorque(t)}},{key:"motorSpeed",get:function(){return this._motorSpeed},set:function(t){this._motorSpeed=t,this._joint&&this._joint.setMotorSpeed(t)}},{key:"frequency",get:function(){return this._frequency},set:function(t){this._frequency=t,this._joint&&this._joint.setFrequency(t)}},{key:"dampingRatio",get:function(){return this._dampingRatio},set:function(t){this._dampingRatio=t,this._joint&&this._joint.setDampingRatio(t)}}]),e}(ont)).prototype,"angle",[Rit],Object.getOwnPropertyDescriptor(Mit.prototype,"angle"),Mit.prototype),p(Mit.prototype,"enableMotor",[wit],Object.getOwnPropertyDescriptor(Mit.prototype,"enableMotor"),Mit.prototype),p(Mit.prototype,"maxMotorTorque",[Iit],Object.getOwnPropertyDescriptor(Mit.prototype,"maxMotorTorque"),Mit.prototype),p(Mit.prototype,"motorSpeed",[Bit],Object.getOwnPropertyDescriptor(Mit.prototype,"motorSpeed"),Mit.prototype),p(Mit.prototype,"frequency",[Dit],Object.getOwnPropertyDescriptor(Mit.prototype,"frequency"),Mit.prototype),p(Mit.prototype,"dampingRatio",[Pit],Object.getOwnPropertyDescriptor(Mit.prototype,"dampingRatio"),Mit.prototype),Nit=Ss(Mit.prototype,"_angle",[ks],(function(){return 90})),Lit=Ss(Mit.prototype,"_enableMotor",[ks],(function(){return!1})),Fit=Ss(Mit.prototype,"_maxMotorTorque",[ks],(function(){return 1e3})),kit=Ss(Mit.prototype,"_motorSpeed",[ks],(function(){return 0})),Git=Ss(Mit.prototype,"_frequency",[ks],(function(){return 5})),Vit=Ss(Mit.prototype,"_dampingRatio",[ks],(function(){return.7})),Oit=Mit))||Oit)),t("f5",(Uit=Is("cc.HingeJoint2D"),zit=ha(qe),Hit=ha(Ye),Wit=ha(Ye),Xit=ha(qe),jit=ha(Ye),Yit=ha(Ye),Uit((p((Kit=function(t){function e(){for(var e,i=arguments.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=j7.HINGE,e._enableLimit=Jit&&Jit(),e._lowerAngle=Qit&&Qit(),e._upperAngle=Zit&&Zit(),e._enableMotor=$it&&$it(),e._maxMotorTorque=tnt&&tnt(),e._motorSpeed=ent&&ent(),e}return s(e,t),n(e,[{key:"enableLimit",get:function(){return this._enableLimit},set:function(t){this._enableLimit=t}},{key:"lowerAngle",get:function(){return this._lowerAngle},set:function(t){this._lowerAngle=t,this._joint&&this._joint.setLowerAngle(t)}},{key:"upperAngle",get:function(){return this._upperAngle},set:function(t){this._upperAngle=t,this._joint&&this._joint.setUpperAngle(t)}},{key:"enableMotor",get:function(){return this._enableMotor},set:function(t){this._enableMotor=t,this._joint&&this._joint.enableMotor(t)}},{key:"maxMotorTorque",get:function(){return this._maxMotorTorque},set:function(t){this._maxMotorTorque=t,this._joint&&this._joint.setMaxMotorTorque(t)}},{key:"motorSpeed",get:function(){return this._motorSpeed},set:function(t){this._motorSpeed=t,this._joint&&this._joint.setMotorSpeed(t)}}]),e}(ont)).prototype,"enableLimit",[zit],Object.getOwnPropertyDescriptor(Kit.prototype,"enableLimit"),Kit.prototype),p(Kit.prototype,"lowerAngle",[Hit],Object.getOwnPropertyDescriptor(Kit.prototype,"lowerAngle"),Kit.prototype),p(Kit.prototype,"upperAngle",[Wit],Object.getOwnPropertyDescriptor(Kit.prototype,"upperAngle"),Kit.prototype),p(Kit.prototype,"enableMotor",[Xit],Object.getOwnPropertyDescriptor(Kit.prototype,"enableMotor"),Kit.prototype),p(Kit.prototype,"maxMotorTorque",[jit],Object.getOwnPropertyDescriptor(Kit.prototype,"maxMotorTorque"),Kit.prototype),p(Kit.prototype,"motorSpeed",[Yit],Object.getOwnPropertyDescriptor(Kit.prototype,"motorSpeed"),Kit.prototype),Jit=Ss(Kit.prototype,"_enableLimit",[ks],(function(){return!1})),Qit=Ss(Kit.prototype,"_lowerAngle",[ks],(function(){return 0})),Zit=Ss(Kit.prototype,"_upperAngle",[ks],(function(){return 0})),$it=Ss(Kit.prototype,"_enableMotor",[ks],(function(){return!1})),tnt=Ss(Kit.prototype,"_maxMotorTorque",[ks],(function(){return 1e3})),ent=Ss(Kit.prototype,"_motorSpeed",[ks],(function(){return 0})),qit=Kit))||qit)),t("eJ",{PolygonSeparator:w9,PolygonPartition:Y9}),v.internal.physics2d={selector:t9};var cnt=function(t){function e(){for(var e,i=arguments.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=q7.Closest,e._fixtures=[],e._points=[],e._normals=[],e._fractions=[],e._mask=4294967295,e}s(e,t);var i=e.prototype;return i.init=function(t,e){this._type=t,this._mask=e,this._fixtures.length=0,this._points.length=0,this._normals.length=0,this._fractions.length=0},i.ReportFixture=function(t,e,i,n){return 0==(t.GetFilterData().categoryBits&this._mask)?0:this._type===q7.Closest?(this._fixtures[0]=t,this._points[0]=e,this._normals[0]=i,this._fractions[0]=n,n):(this._fixtures.push(t),this._points.push(new yn(e.x,e.y)),this._normals.push(new yn(i.x,i.y)),this._fractions.push(n),this._type===q7.Any?0:this._type>=q7.All?1:n)},i.getFixtures=function(){return this._fixtures},i.getPoints=function(){return this._points},i.getNormals=function(){return this._normals},i.getFractions=function(){return this._fractions},e}(c9.RayCastCallback),_nt=[],fnt=[new yn,new yn],dnt=new c9.WorldManifold,pnt={points:[],separations:[],normal:new yn},mnt=function(){this.localPoint=new yn,this.normalImpulse=0,this.tangentImpulse=0},gnt=[new mnt,new mnt],ynt={type:0,localPoint:new yn,localNormal:new yn,points:[]},vnt={normalImpulses:[],tangentImpulses:[]},Snt=function(){function t(){this.colliderA=null,this.colliderB=null,this.disabled=!1,this.disabledOnce=!1,this._impulse=null,this._inverted=!1,this._b2contact=null}t.get=function(e){var i=_nt.pop();return i||(i=new t),i.init(e),i},t.put=function(t){var e=t.m_userData;e&&(_nt.push(e),e.reset())};var e=t.prototype;return e._setImpulse=function(t){this._impulse=t},e.init=function(t){this.colliderA=t.m_fixtureA.m_userData.collider,this.colliderB=t.m_fixtureB.m_userData.collider,this.disabled=!1,this.disabledOnce=!1,this._impulse=null,this._inverted=!1,this._b2contact=t,t.m_userData=this},e.reset=function(){this.setTangentSpeed(0),this.resetFriction(),this.resetRestitution(),this.colliderA=null,this.colliderB=null,this.disabled=!1,this._impulse=null,this._b2contact.m_userData=null,this._b2contact=null},e.getWorldManifold=function(){var t=pnt.points,e=pnt.separations,i=pnt.normal;this._b2contact.GetWorldManifold(dnt);var n=dnt.points,r=dnt.separations,s=this._b2contact.GetManifold().pointCount;t.length=e.length=s;for(var a=0;a<s;a++){var o=fnt[a];o.x=n[a].x*$7,o.y=n[a].y*$7,t[a]=o,e[a]=r[a]*$7}return i.x=dnt.normal.x,i.y=dnt.normal.y,this._inverted&&(i.x*=-1,i.y*=-1),pnt},e.getManifold=function(){for(var t=ynt.points,e=ynt.localNormal,i=ynt.localPoint,n=this._b2contact.GetManifold(),r=n.points,s=t.length=n.pointCount,a=0;a<s;a++){var o=gnt[a],h=r[a];o.localPoint.x=h.localPoint.x*$7,o.localPoint.y=h.localPoint.y*$7,o.normalImpulse=h.normalImpulse*$7,o.tangentImpulse=h.tangentImpulse,t[a]=o}return i.x=n.localPoint.x*$7,i.y=n.localPoint.y*$7,e.x=n.localNormal.x,e.y=n.localNormal.y,ynt.type=n.type,this._inverted&&(e.x*=-1,e.y*=-1),ynt},e.getImpulse=function(){var t=this._impulse;if(!t)return null;for(var e=vnt.normalImpulses,i=vnt.tangentImpulses,n=t.count,r=0;r<n;r++)e[r]=t.normalImpulses[r]*$7,i[r]=t.tangentImpulses[r];return i.length=e.length=n,vnt},e.emit=function(t){switch(t){case Z7.BEGIN_CONTACT:case Z7.END_CONTACT:case Z7.PRE_SOLVE:case Z7.POST_SOLVE:}var e=this.colliderA,i=this.colliderB,n=e.body,r=i.body;n.enabledContactListener&&(null==e||e.emit(t,e,i,this)),r.enabledContactListener&&(null==i||i.emit(t,i,e,this)),(n.enabledContactListener||r.enabledContactListener)&&Att.instance.emit(t,e,i,this),(this.disabled||this.disabledOnce)&&(this.setEnabled(!1),this.disabledOnce=!1)},e.setEnabled=function(t){this._b2contact.SetEnabled(t)},e.isTouching=function(){return this._b2contact.IsTouching()},e.setTangentSpeed=function(t){this._b2contact.SetTangentSpeed(t)},e.getTangentSpeed=function(){return this._b2contact.GetTangentSpeed()},e.setFriction=function(t){this._b2contact.SetFriction(t)},e.getFriction=function(){return this._b2contact.GetFriction()},e.resetFriction=function(){return this._b2contact.ResetFriction()},e.setRestitution=function(t){this._b2contact.SetRestitution(t)},e.getRestitution=function(){return this._b2contact.GetRestitution()},e.resetRestitution=function(){return this._b2contact.ResetRestitution()},t}(),Ant=new c9.Vec2,Tnt=new Zi,Ent=Zi.GREEN,bnt=Zi.RED,xnt=function(t){function e(e){var i;return(i=t.call(this)||this)._drawer=null,i._xf=new c9.Transform,i._dxf=new c9.Transform,i._drawer=e,i}s(e,t);var i=e.prototype;return i._DrawPolygon=function(t,e){for(var i=this._drawer,n=0;n<e;n++){c9.Transform.MulXV(this._xf,t[n],Ant);var r=Ant.x*$7,s=Ant.y*$7;0===n?i.moveTo(r,s):i.lineTo(r,s)}i.close()},i.DrawPolygon=function(t,e,i){this._applyStrokeColor(i),this._DrawPolygon(t,e),this._drawer.stroke()},i.DrawSolidPolygon=function(t,e,i){this._applyFillColor(i),this._DrawPolygon(t,e),this._drawer.fill(),this._drawer.stroke()},i._DrawCircle=function(t,e){var i=this._xf.p;this._drawer.circle((t.x+i.x)*$7,(t.y+i.y)*$7,e*$7)},i.DrawCircle=function(t,e,i){this._applyStrokeColor(i),this._DrawCircle(t,e),this._drawer.stroke()},i.DrawSolidCircle=function(t,e,i,n){this._applyFillColor(n),this._DrawCircle(t,e),this._drawer.fill()},i.DrawSegment=function(t,e,i){var n=this._drawer;if(t.x===e.x&&t.y===e.y)return this._applyFillColor(i),this._DrawCircle(t,2/$7),void n.fill();this._applyStrokeColor(i),c9.Transform.MulXV(this._xf,t,Ant),n.moveTo(Ant.x*$7,Ant.y*$7),c9.Transform.MulXV(this._xf,e,Ant),n.lineTo(Ant.x*$7,Ant.y*$7),n.stroke()},i.DrawTransform=function(t){var e=this._drawer;e.strokeColor=bnt,Ant.x=Ant.y=0,c9.Transform.MulXV(t,Ant,Ant),e.moveTo(Ant.x*$7,Ant.y*$7),Ant.x=1,Ant.y=0,c9.Transform.MulXV(t,Ant,Ant),e.lineTo(Ant.x*$7,Ant.y*$7),e.stroke(),e.strokeColor=Ent,Ant.x=Ant.y=0,c9.Transform.MulXV(t,Ant,Ant),e.moveTo(Ant.x*$7,Ant.y*$7),Ant.x=0,Ant.y=1,c9.Transform.MulXV(t,Ant,Ant),e.lineTo(Ant.x*$7,Ant.y*$7),e.stroke()},i.DrawPoint=function(){},i.DrawParticles=function(){},i._applyStrokeColor=function(t){this._drawer.strokeColor=Tnt.set(255*t.r,255*t.g,255*t.b,150)},i._applyFillColor=function(t){this._drawer.fillColor=Tnt.set(255*t.r,255*t.g,255*t.b,150)},i.PushTransform=function(t){this._xf=t},i.PopTransform=function(){this._xf=this._dxf},e}(c9.Draw),Cnt=new Yi,Rnt=new yn,wnt=new yn,Int=new c9.BodyDef,Bnt=new c9.AABB,Dnt=[],Pnt=function(){function t(){this._world=void 0,this._bodies=[],this._animatedBodies=[],this._rotationAxis=new Yi,this._physicsGroundBody=void 0,this._contactListener=void 0,this._aabbQueryCallback=void 0,this._raycastQueryCallback=void 0,this._debugGraphics=null,this._b2DebugDrawer=null,this._debugDrawFlags=0,this._world=new c9.World(new c9.Vec2(0,-10));var t=new c9.BodyDef;this._physicsGroundBody=this._world.CreateBody(t);var e=new _9;e.setBeginContact(this._onBeginContact),e.setEndContact(this._onEndContact),e.setPreSolve(this._onPreSolve),e.setPostSolve(this._onPostSolve),this._world.SetContactListener(e),this._contactListener=e,this._aabbQueryCallback=new f9,this._raycastQueryCallback=new cnt}var e=t.prototype;return e._checkDebugDrawValid=function(){if(!this._debugGraphics||!this._debugGraphics.isValid){var t=fM("Canvas");if(!t){var e=vN.getScene();if(!e)return;(t=new Pm("Canvas")).addComponent(Bz),t.parent=e}var i=new Pm("PHYSICS_2D_DEBUG_DRAW");i.hideFlags|=ba.Flags.DontSave,i.parent=t,i.worldPosition=Yi.ZERO,i.layer=kp.Enum.UI_2D,this._debugGraphics=i.addComponent(UV),this._debugGraphics.lineWidth=3;var n=new xnt(this._debugGraphics);this._b2DebugDrawer=n,this._world.SetDebugDraw(n)}var r=this._debugGraphics.node.parent;this._debugGraphics.node.setSiblingIndex(r.children.length-1),this._b2DebugDrawer&&this._b2DebugDrawer.SetFlags(this.debugDrawFlags)},e.setGravity=function(t){this._world.SetGravity(t)},e.setAllowSleep=function(){this._world.SetAllowSleeping(!0)},e.step=function(t,e,i){void 0===e&&(e=10),void 0===i&&(i=10);for(var n=this._animatedBodies,r=0,s=n.length;r<s;r++)n[r].animate(t);this._world.Step(t,e,i)},e.raycast=function(t,e,i,n){if(t.equals(e))return[];i=i||q7.Closest,Rnt.x=t.x/$7,Rnt.y=t.y/$7,wnt.x=e.x/$7,wnt.y=e.y/$7;var r=this._raycastQueryCallback;r.init(i,n),this._world.RayCast(r,Rnt,wnt);var s=r.getFixtures();if(s.length>0){for(var a=r.getPoints(),o=r.getNormals(),h=r.getFractions(),u=[],l=0,c=s.length;l<c;l++){var _=s[l],f=_.m_userData,d=f.collider;if(i===q7.AllClosest){for(var p=void 0,m=0;m<u.length;m++)u[m].collider===d&&(p=u[m]);if(p){h[l]<p.fraction&&(p.fixtureIndex=f.getFixtureIndex(_),p.point.x=a[l].x*$7,p.point.y=a[l].y*$7,p.normal.x=o[l].x,p.normal.y=o[l].y,p.fraction=h[l]);continue}}u.push({collider:d,fixtureIndex:f.getFixtureIndex(_),point:new yn(a[l].x*$7,a[l].y*$7),normal:new yn(o[l].x,o[l].y),fraction:h[l]})}return u}return[]},e.syncPhysicsToScene=function(){for(var t=this._bodies,e=0,i=t.length;e<i;e++){var n=t[e],r=n.rigidBody;if(r.type!==W7.Animated){var s=r.node,a=n.impl,o=a.GetPosition();Cnt.x=o.x*$7,Cnt.y=o.y*$7,Cnt.z=0,s.worldPosition=Cnt;var h=wi(a.GetAngle());s.setWorldRotationFromEuler(0,0,h)}else n.resetVelocity()}},e.syncSceneToPhysics=function(){for(var t=this._bodies,e=0;e<t.length;e++)t[e].syncSceneToPhysics()},e.addBody=function(t){if(!this._bodies.includes(t)){var e=Int,i=t.rigidBody;e.allowSleep=i.allowSleep,e.gravityScale=i.gravityScale,e.linearDamping=i.linearDamping,e.angularDamping=i.angularDamping,e.fixedRotation=i.fixedRotation,e.bullet=i.bullet;var n=i.node,r=n.worldPosition;e.position.Set(r.x/$7,r.y/$7),Cnt.z=sn.getAxisAngle(this._rotationAxis,n.worldRotation),this._rotationAxis.z<0&&(Cnt.z=2*Math.PI-Cnt.z),e.angle=Cnt.z,e.awake=i.awakeOnLoad,i.type===W7.Animated?(e.type=W7.Kinematic,this._animatedBodies.push(t),t._animatedPos.set(e.position.x,e.position.y),t._animatedAngle=e.angle):e.type=i.type;var s=i,a=s._linearVelocity;e.linearVelocity.Set(a.x,a.y),e.angularVelocity=Ri(s._angularVelocity);var o=this._world.CreateBody(e);o.m_userData=t,t._imp=o,this._bodies.push(t)}},e.removeBody=function(t){this._bodies.includes(t)&&(t.impl&&(t.impl.m_userData=null,this._world.DestroyBody(t.impl),t._imp=null),oe(this._bodies,t),t.rigidBody.type===W7.Animated&&oe(this._animatedBodies,t))},e.registerContactFixture=function(t){this._contactListener.registerContactFixture(t)},e.unregisterContactFixture=function(t){this._contactListener.unregisterContactFixture(t)},e.testPoint=function(t){var e=Rnt.x=t.x/$7,i=Rnt.y=t.y/$7,n=.2/$7;Bnt.lowerBound.x=e-n,Bnt.lowerBound.y=i-n,Bnt.upperBound.x=e+n,Bnt.upperBound.y=i+n;var r=this._aabbQueryCallback;r.init(Rnt),this._world.QueryAABB(r,Bnt);var s=r.getFixtures();Dnt.length=0;for(var a=0;a<s.length;a++){var o=s[a].m_userData.collider;Dnt.includes(o)||Dnt.push(o)}return Dnt},e.testAABB=function(t){Bnt.lowerBound.x=t.xMin/$7,Bnt.lowerBound.y=t.yMin/$7,Bnt.upperBound.x=t.xMax/$7,Bnt.upperBound.y=t.yMax/$7;var e=this._aabbQueryCallback;e.init(),this._world.QueryAABB(e,Bnt);var i=e.getFixtures();Dnt.length=0;for(var n=0;n<i.length;n++){var r=i[n].m_userData.collider;Dnt.includes(r)||Dnt.push(r)}return Dnt},e.drawDebug=function(){this._checkDebugDrawValid(),this._debugGraphics&&(this._debugGraphics.clear(),this._world.DrawDebugData())},e._onBeginContact=function(t){Snt.get(t).emit(Z7.BEGIN_CONTACT)},e._onEndContact=function(t){var e=t.m_userData;e&&(e.emit(Z7.END_CONTACT),Snt.put(t))},e._onPreSolve=function(t){var e=t.m_userData;e&&e.emit(Z7.PRE_SOLVE)},e._onPostSolve=function(t,e){var i=t.m_userData;i&&(i._setImpulse(e),i.emit(Z7.POST_SOLVE),i._setImpulse(null))},n(t,[{key:"impl",get:function(){return this._world}},{key:"groundBodyImpl",get:function(){return this._physicsGroundBody}},{key:"debugDrawFlags",get:function(){return this._debugDrawFlags},set:function(t){t||this._debugGraphics&&(this._debugGraphics.node.parent=null),this._debugDrawFlags=t}}]),t}(),Ont=new Yi,Mnt=new c9.Vec2,Nnt=function(){function t(){this._animatedPos=new yn,this._animatedAngle=0,this._body=null,this._rigidBody=void 0,this._inited=!1}var e=t.prototype;return e.initialize=function(t){this._rigidBody=t,Att.instance._callAfterStep(this,this._init)},e.onDestroy=function(){Att.instance._callAfterStep(this,this._destroy)},e.onEnable=function(){this.setActive(!0)},e.onDisable=function(){this.setActive(!1)},e.nodeTransformChanged=function(t){if(!Att.instance.stepping){if(t&Pm.TransformBit.SCALE)for(var e=this.rigidBody.getComponents(snt),i=0;i<e.length;i++)e[i].apply();t&Pm.TransformBit.POSITION&&this.syncPositionToPhysics(!0),t&Pm.TransformBit.ROTATION&&this.syncRotationToPhysics(!0)}},e._init=function(){this._inited||(Att.instance.physicsWorld.addBody(this),this.setActive(!1),this._inited=!0)},e._destroy=function(){this._inited&&(Att.instance.physicsWorld.removeBody(this),this._inited=!1)},e.animate=function(t){var e=this._body;if(e){var i=e.GetPosition();e.SetAwake(!0);var n=1/t;Mnt.x=(this._animatedPos.x-i.x)*n,Mnt.y=(this._animatedPos.y-i.y)*n,e.SetLinearVelocity(Mnt);var r=e.GetAngle()%Si;r>Math.PI&&(r-=Si);var s=(this._animatedAngle-r)*n;this._animatedAngle<-vi&&r>vi&&(s=(this._animatedAngle+Si-r)*n),this._animatedAngle>vi&&r<-vi&&(s=(this._animatedAngle-Si-r)*n),e.SetAngularVelocity(s)}},e.syncSceneToPhysics=function(){var t=this._rigidBody.node.hasChangedFlags;t&&this.nodeTransformChanged(t)},e.syncPositionToPhysics=function(t){void 0===t&&(t=!1);var e=this._body;if(e){var i,n=this._rigidBody.node.worldPosition,r=this._rigidBody.type;(i=r===W7.Animated?e.GetLinearVelocity():e.GetPosition()).x=n.x/$7,i.y=n.y/$7,r===W7.Animated&&t?this._animatedPos.set(i.x,i.y):e.SetTransformVec(i,e.GetAngle())}},e.syncRotationToPhysics=function(t){void 0===t&&(t=!1);var e=this._body;if(e){var i=this._rigidBody.node.worldRotation,n=Ont;sn.toEulerInYXZOrder(n,i);var r=Ri(n.z);this._rigidBody.type===W7.Animated&&t?this._animatedAngle=r:e.SetTransformVec(e.GetPosition(),r)}},e.resetVelocity=function(){var t=this._body;if(t){var e=t.m_linearVelocity;e.Set(0,0),t.SetLinearVelocity(e),t.SetAngularVelocity(0)}},e.setType=function(t){this._body.SetType(t)},e.setLinearDamping=function(t){this._body.SetLinearDamping(t)},e.setAngularDamping=function(t){this._body.SetAngularDamping(t)},e.setGravityScale=function(t){this._body.SetGravityScale(t)},e.setFixedRotation=function(t){this._body.SetFixedRotation(t)},e.setAllowSleep=function(t){this._body.SetSleepingAllowed(t)},e.isActive=function(){return this._body.IsActive()},e.setActive=function(t){this._body.SetActive(t)},e.wakeUp=function(){this._body.SetAwake(!0)},e.sleep=function(){this._body.SetAwake(!1)},e.getMass=function(){return this._body.GetMass()},e.setLinearVelocity=function(t){this._body.SetLinearVelocity(t)},e.getLinearVelocity=function(t){var e=this._body.GetLinearVelocity();return t.x=e.x,t.y=e.y,t},e.getLinearVelocityFromWorldPoint=function(t,e){return Mnt.Set(t.x/$7,t.y/$7),this._body.GetLinearVelocityFromWorldPoint(Mnt,e),e.x*=$7,e.y*=$7,e},e.setAngularVelocity=function(t){this._body.SetAngularVelocity(t)},e.getAngularVelocity=function(){return wi(this._body.GetAngularVelocity())},e.getLocalVector=function(t,e){return e=e||new yn,Mnt.Set(t.x/$7,t.y/$7),this._body.GetLocalVector(Mnt,e),e.x*=$7,e.y*=$7,e},e.getWorldVector=function(t,e){return Mnt.Set(t.x/$7,t.y/$7),this._body.GetWorldVector(Mnt,e),e.x*=$7,e.y*=$7,e},e.getLocalPoint=function(t,e){return e=e||new yn,Mnt.Set(t.x/$7,t.y/$7),this._body.GetLocalPoint(Mnt,e),e.x*=$7,e.y*=$7,e},e.getWorldPoint=function(t,e){return e=e||new yn,Mnt.Set(t.x/$7,t.y/$7),this._body.GetWorldPoint(Mnt,e),e.x*=$7,e.y*=$7,e},e.getLocalCenter=function(t){t=t||new yn;var e=this._body.GetLocalCenter();return t.x=e.x*$7,t.y=e.y*$7,t},e.getWorldCenter=function(t){t=t||new yn;var e=this._body.GetWorldCenter();return t.x=e.x*$7,t.y=e.y*$7,t},e.getInertia=function(){return this._body.GetInertia()},e.applyForce=function(t,e,i){this._body&&(Mnt.Set(e.x/$7,e.y/$7),this._body.ApplyForce(t,Mnt,i))},e.applyForceToCenter=function(t,e){this._body&&this._body.ApplyForceToCenter(t,e)},e.applyTorque=function(t,e){this._body&&this._body.ApplyTorque(t,e)},e.applyLinearImpulse=function(t,e,i){this._body&&(Mnt.Set(e.x/$7,e.y/$7),this._body.ApplyLinearImpulse(t,Mnt,i))},e.applyLinearImpulseToCenter=function(t,e){this._body&&this._body.ApplyLinearImpulse(t,this._body.GetPosition(),e)},e.applyAngularImpulse=function(t,e){this._body&&this._body.ApplyAngularImpulse(t,e)},n(t,[{key:"impl",get:function(){return this._body}},{key:"_imp",set:function(t){this._body=t}},{key:"rigidBody",get:function(){return this._rigidBody}},{key:"isAwake",get:function(){return this._body.IsAwake()}},{key:"isSleeping",get:function(){return!this._body.IsAwake()}}]),t}(),Lnt=new c9.Filter,Fnt=new c9.Vec2,knt=new c9.Vec2;function Gnt(t){var e=t.collider;return e.body?Lnt.categoryBits=e.group===j9.DEFAULT?e.body.group:e.group:Lnt.categoryBits=e.group,Lnt.maskBits=Att.instance.collisionMatrix[Lnt.categoryBits],Lnt}var Vnt=function(){function t(){this._shapes=[],this._fixtures=[],this._collider=null,this._body=null,this._inited=!1,this._rect=new En}var e=t.prototype;return e.initialize=function(t){this._collider=t},e.onLoad=function(){},e.onEnable=function(){Att.instance._callAfterStep(this,this._init)},e.onDisable=function(){Att.instance._callAfterStep(this,this._destroy)},e.start=function(){},e.onGroupChanged=function(){var t=Gnt(this);this._fixtures.forEach((function(e){e.SetFilterData(t)}))},e.apply=function(){this._destroy(),this.collider.enabledInHierarchy&&this._init()},e.getFixtureIndex=function(t){return this._fixtures.indexOf(t)},e._createShapes=function(){return[]},e._init=function(){if(!this._inited){var t=this.collider,e=t.node.worldScale,i=Yi.ZERO,n=t.getComponent(nnt);n&&n.impl&&n.impl.impl?this._body=n.impl.impl:(this._body=Att.instance.physicsWorld.groundBodyImpl,i=t.node.worldPosition);for(var r=0===e.x&&0===e.y?[]:this._createShapes(e.x,e.y,i.x,i.y),s=Gnt(this),a=0;a<r.length;a++){var o=r[a],h={density:t.density,isSensor:t.sensor,friction:t.friction,restitution:t.restitution,shape:o,filter:s},u=this._body.CreateFixture(h);u.m_userData=this,null!=n&&n.enabledContactListener&&Att.instance.physicsWorld.registerContactFixture(u),this._shapes.push(o),this._fixtures.push(u)}this._inited=!0}},e._destroy=function(){if(this._inited){for(var t=this._fixtures,e=this._body,i=t.length-1;i>=0;i--){var n=t[i];n.m_userData=null,Att.instance.physicsWorld.unregisterContactFixture(n),e&&e.DestroyFixture(n)}this._body=null,this._fixtures.length=0,this._shapes.length=0,this._inited=!1}},n(t,[{key:"impl",get:function(){return this._shapes}},{key:"collider",get:function(){return this._collider}},{key:"worldAABB",get:function(){for(var t=1e7,e=t,i=t,n=-t,r=-t,s=this._fixtures,a=0;a<s.length;a++)for(var o=s[a],h=o.GetShape().GetChildCount(),u=0;u<h;u++){if(Fnt.Copy(o.GetAABB(u).lowerBound),knt.Copy(o.GetAABB(u).upperBound),2===o.GetShape().m_type){var l=o.GetShape().m_radius;Fnt.SelfAddXY(l,l),knt.SelfSubXY(l,l)}Fnt.x<e&&(e=Fnt.x),Fnt.y<i&&(i=Fnt.y),knt.x>n&&(n=knt.x),knt.y>r&&(r=knt.y)}e*=$7,i*=$7,n*=$7,r*=$7;var c=this._rect;return c.x=e,c.y=i,c.width=n-e,c.height=r-i,c}}]),t}(),Unt=new En,znt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._worldPoints=[new yn,new yn,new yn,new yn],e}return s(e,t),e.prototype._createShapes=function(t,e,i,n){t=Math.abs(t),e=Math.abs(e);var r=this.collider,s=r.size.width/2/$7*t,a=r.size.height/2/$7*e,o=(i+r.offset.x*t)/$7,h=(n+r.offset.y*e)/$7,u=new c9.PolygonShape;return u.SetAsBox(s,a,new c9.Vec2(o,h),0),[u]},n(e,[{key:"worldPoints",get:function(){var t=Unt,e=this.collider,i=e.size,n=e.offset;t.x=n.x-i.width/2,t.y=n.y-i.height/2,t.width=i.width,t.height=i.height;var r=this._worldPoints,s=r[0],a=r[1],o=r[2],h=r[3];return t.transformMat4ToPoints(e.node.worldMatrix,s,a,o,h),r}}]),e}(Vnt),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)._worldPosition=new yn,e}return s(e,t),e.prototype._createShapes=function(t,e,i,n){t=Math.abs(t),e=Math.abs(e);var r=this.collider,s=(i+r.offset.x*t)/$7,a=(n+r.offset.y*e)/$7,o=new c9.CircleShape;return o.m_radius=r.radius/$7*t,o.m_p.Set(s,a),[o]},n(e,[{key:"worldRadius",get:function(){return this._shapes[0].m_radius*$7}},{key:"worldPosition",get:function(){var t=this._shapes[0].m_p;return this._worldPosition.set(t.x*$7,t.y*$7)}}]),e}(Vnt),Wnt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._worldPoints=[],e}return s(e,t),e.prototype._createShapes=function(t,e,i,n){var r=[],s=this.collider,a=s.points;a.length>0&&a[0].equals(a[a.length-1])&&(a.length-=1);var o=I9(a);if(!o)return console.log("[Physics2D] b2PolygonShape failed to decompose polygon into convex polygons, node name: ",s.node.name),r;for(var h=s.offset,u=0;u<o.length;u++){for(var l=o[u],c=null,_=[],f=null,d=0,p=l.length;d<p;d++){c||(c=new c9.PolygonShape);var m=l[d],g=(i+(m.x+h.x)*t)/$7,y=(n+(m.y+h.y)*e)/$7,v=new c9.Vec2(g,y);_.push(v),f||(f=v),_.length===c9.maxPolygonVertices&&(c.Set(_,_.length),r.push(c),c=null,d<p-1&&(_=[f,_[_.length-1]]))}c&&(c.Set(_,_.length),r.push(c))}return r},n(e,[{key:"worldPoints",get:function(){for(var t=this.collider,e=t.points,i=this._worldPoints,n=t.node.worldMatrix,r=0;r<e.length;r++)i[r]||(i[r]=new yn),yn.transformMat4(i[r],e[r],n);return i.length=e.length,this._worldPoints}}]),e}(Vnt),Xnt=function(){function t(){this._b2joint=null,this._jointComp=null,this._body=null,this._inited=!1}var e=t.prototype;return e.initialize=function(t){this._jointComp=t},e.onEnable=function(){Att.instance._callAfterStep(this,this._init)},e.onDisable=function(){Att.instance._callAfterStep(this,this._destroy)},e.start=function(){Att.instance._callAfterStep(this,this._init)},e._init=function(){if(!this._inited){var t=this._jointComp;if(t.isValid){this._body=t.getComponent(nnt);var e=this._createJointDef();if(e){e.bodyA=this._body.impl.impl;var i=t.connectedBody;i&&!i.enabledInHierarchy||(e.bodyB=i?i.impl.impl:Att.instance.physicsWorld.groundBodyImpl,e.collideConnected=t.collideConnected,this._b2joint=Att.instance.physicsWorld.impl.CreateJoint(e),this._inited=!0)}}}},e._destroy=function(){this._inited&&(Att.instance.physicsWorld.impl.DestroyJoint(this._b2joint),this._b2joint=null,this._inited=!1)},e._createJointDef=function(){return null},e.isValid=function(){return this._b2joint&&this._body&&this._body.impl&&this._jointComp},n(t,[{key:"impl",get:function(){return this._b2joint}},{key:"comp",get:function(){return this._jointComp}},{key:"body",get:function(){return this._body}}]),t}(),jnt=new c9.Vec2,Ynt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._touchPoint=new yn,e._isTouched=!1,e}s(e,t);var i=e.prototype;return i.setTarget=function(t){this._b2joint&&(jnt.x=t.x/$7,jnt.y=t.y/$7,this._b2joint.SetTarget(jnt))},i.setDampingRatio=function(t){this._b2joint&&this._b2joint.SetDampingRatio(t)},i.setFrequency=function(t){this._b2joint&&this._b2joint.SetFrequency(t)},i.setMaxForce=function(t){this._b2joint&&this._b2joint.SetMaxForce(t)},i._createJointDef=function(){var t=new c9.MouseJointDef,e=this._jointComp;return t.target.Set(this._touchPoint.x/$7,this._touchPoint.y/$7),t.maxForce=e.maxForce,t.dampingRatio=e.dampingRatio,t.frequencyHz=e.frequency,t},i.initialize=function(e){t.prototype.initialize.call(this,e);var i=fM("Canvas");i&&(i.on(zp.TOUCH_START,this.onTouchBegan,this),i.on(zp.TOUCH_MOVE,this.onTouchMove,this),i.on(zp.TOUCH_END,this.onTouchEnd,this),i.on(zp.TOUCH_CANCEL,this.onTouchEnd,this))},i.onEnable=function(){},i.start=function(){},i.onTouchBegan=function(t){this._isTouched=!0;var e=this._touchPoint.set(t.getUILocation()),i=Att.instance.physicsWorld.testPoint(e);if(!(i.length<=0)){var n=i[0].body;n.wakeUp();var r=this._jointComp;r.connectedBody=n,this._init(),this.setMaxForce(r.maxForce*n.getMass()),this.setTarget(e)}},i.onTouchMove=function(t){this._touchPoint=t.getUILocation()},i.onTouchEnd=function(){this._destroy(),this._isTouched=!1},i.update=function(){this._isTouched&&this.isValid()&&this.setTarget(this._touchPoint)},e}(Xnt),qnt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.setMaxLength=function(t){this._b2joint&&this._b2joint.SetMaxLength(t)},i._createJointDef=function(){var t=this._jointComp,e=new c9.RopeJointDef;return e.localAnchorA.Set(t.anchor.x/$7,t.anchor.y/$7),e.localAnchorB.Set(t.connectedAnchor.x/$7,t.connectedAnchor.y/$7),e.maxLength=t.maxLength/$7,e},e}(Xnt),Knt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.setDampingRatio=function(t){this._b2joint&&this._b2joint.SetDampingRatio(t)},i.setFrequency=function(t){this._b2joint&&this._b2joint.SetFrequency(t)},i.setDistance=function(t){this._b2joint&&this._b2joint.SetLength(t)},i._createJointDef=function(){var t=this._jointComp,e=new c9.DistanceJointDef;return e.localAnchorA.Set(t.anchor.x/$7,t.anchor.y/$7),e.localAnchorB.Set(t.connectedAnchor.x/$7,t.connectedAnchor.y/$7),e.length=t.distance/$7,e.dampingRatio=t.dampingRatio,e.frequencyHz=t.frequency,e},e}(Xnt),Jnt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.setMaxForce=function(t){this._b2joint&&this._b2joint.SetMaxForce(t)},i.setAngularOffset=function(t){this._b2joint&&this._b2joint.SetAngularOffset(Ri(t))},i.setLinearOffset=function(t){this._b2joint&&this._b2joint.SetLinearOffset(new c9.Vec2(t.x/$7,t.y/$7))},i.setCorrectionFactor=function(t){this._b2joint&&(this._b2joint.m_correctionFactor=t)},i.setMaxTorque=function(t){this._b2joint&&this._b2joint.SetMaxTorque(t)},i._createJointDef=function(){var t=this._jointComp,e=new c9.MotorJointDef;return e.linearOffset.Set(t.linearOffset.x/$7,t.linearOffset.y/$7),e.angularOffset=Ri(t.angularOffset),e.maxForce=t.maxForce,e.maxTorque=t.maxTorque,e.correctionFactor=t.correctionFactor,e},e}(Xnt),Qnt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.enableLimit=function(t){this._b2joint&&this._b2joint.EnableLimit(t)},i.setLowerLimit=function(){this.updateLimits()},i.setUpperLimit=function(){this.updateLimits()},i.updateLimits=function(){if(this._b2joint){var t=this._jointComp;this._b2joint.SetLimits(t.lowerLimit/$7,t.upperLimit/$7)}},i.enableMotor=function(t){this._b2joint&&this._b2joint.EnableMotor(t)},i.setMaxMotorForce=function(t){this._b2joint&&this._b2joint.SetMaxMotorForce(t)},i.setMotorSpeed=function(t){this._b2joint&&this._b2joint.SetMotorSpeed(t)},i._createJointDef=function(){var t=this._jointComp,e=new c9.PrismaticJointDef;e.localAnchorA.Set(t.anchor.x/$7,t.anchor.y/$7),e.localAnchorB.Set(t.connectedAnchor.x/$7,t.connectedAnchor.y/$7);var i=Ri(t.angle);return e.localAxisA.Set(Math.cos(i),Math.sin(i)),e.referenceAngle=0,e.enableLimit=t.enableLimit,e.lowerTranslation=t.lowerLimit/$7,e.upperTranslation=t.upperLimit/$7,e.enableMotor=t.enableMotor,e.maxMotorForce=t.maxMotorForce,e.motorSpeed=t.motorSpeed,e},e}(Xnt),Znt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.setFrequency=function(t){this._b2joint&&this._b2joint.SetFrequency(t)},i.setDampingRatio=function(t){this._b2joint&&this._b2joint.SetDampingRatio(t)},i._createJointDef=function(){var t=this._jointComp,e=new c9.WeldJointDef;return e.localAnchorA.Set(t.anchor.x/$7,t.anchor.y/$7),e.localAnchorB.Set(t.connectedAnchor.x/$7,t.connectedAnchor.y/$7),e.referenceAngle=0,e.frequencyHz=t.frequency,e.dampingRatio=t.dampingRatio,e},e}(Xnt),$nt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.setDampingRatio=function(t){this._b2joint&&this._b2joint.SetSpringDampingRatio(t)},i.setFrequency=function(t){this._b2joint&&this._b2joint.SetSpringFrequencyHz(t)},i.enableMotor=function(t){this._b2joint&&this._b2joint.EnableMotor(t)},i.setMaxMotorTorque=function(t){this._b2joint&&this._b2joint.SetMaxMotorTorque(t)},i.setMotorSpeed=function(t){this._b2joint&&this._b2joint.SetMotorSpeed(t)},i._createJointDef=function(){var t=this._jointComp,e=new c9.WheelJointDef;e.localAnchorA.Set(t.anchor.x/$7,t.anchor.y/$7),e.localAnchorB.Set(t.connectedAnchor.x/$7,t.connectedAnchor.y/$7);var i=Ri(t.angle);return e.localAxisA.Set(Math.cos(i),Math.sin(i)),e.maxMotorTorque=t.maxMotorTorque,e.motorSpeed=Ri(t.motorSpeed),e.enableMotor=t.enableMotor,e.dampingRatio=t.dampingRatio,e.frequencyHz=t.frequency,e},e}(Xnt),trt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.enableLimit=function(t){this._b2joint&&this._b2joint.EnableLimit(t)},i.setLowerAngle=function(){this.updateLimits()},i.setUpperAngle=function(){this.updateLimits()},i.updateLimits=function(){if(this._b2joint){var t=this._jointComp;this._b2joint.SetLimits(Ri(t.lowerAngle),Ri(t.upperAngle))}},i.enableMotor=function(t){this._b2joint&&this._b2joint.EnableMotor(t)},i.setMaxMotorTorque=function(t){this._b2joint&&this._b2joint.SetMaxMotorTorque(t)},i.setMotorSpeed=function(t){this._b2joint&&this._b2joint.SetMotorSpeed(t)},i._createJointDef=function(){var t=this._jointComp,e=new c9.RevoluteJointDef;return e.localAnchorA.Set(t.anchor.x/$7,t.anchor.y/$7),e.localAnchorB.Set(t.connectedAnchor.x/$7,t.connectedAnchor.y/$7),e.enableMotor=t.enableMotor,e.maxMotorTorque=t.maxMotorTorque,e.motorSpeed=Ri(t.motorSpeed),e.enableLimit=t.enableLimit,e.lowerAngle=Ri(t.lowerAngle),e.upperAngle=Ri(t.upperAngle),e},e}(Xnt);xN.once(bN.EVENT_PRE_SUBSYSTEM_INIT,(function(){t9.register("box2d",{PhysicsWorld:Pnt,RigidBody:Nnt,BoxShape:znt,CircleShape:Hnt,PolygonShape:Wnt,MouseJoint:Ynt,DistanceJoint:qnt,SpringJoint:Knt,RelativeJoint:Jnt,SliderJoint:Qnt,FixedJoint:Znt,WheelJoint:$nt,HingeJoint:trt})}));var ert,irt,nrt,rrt,srt,art,ort,hrt,urt,lrt,crt,_rt,frt,drt,prt,mrt,grt,yrt,vrt,Srt,Art,Trt,Ert,brt,xrt,Crt,Rrt,wrt,Irt,Brt,Drt,Prt,Ort,Mrt,Nrt,Lrt,Frt,krt,Grt,Vrt,Urt,zrt,Hrt=function(t){function e(){for(var e,i=arguments.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}(wR),Wrt=Is,Xrt=Ds,jrt=ha,Yrt=Gs,qrt=ks,Krt=CS("specular-pass");function Jrt(t){var e=t.passes,i=v.rendering;Ay()&&(Krt=i.getPhaseID(i.getPassID("specular-pass"),"default"));for(var n=0;n<e.length;n++)if((!i||!i.enableEffectImport)&&e[n].phase===Krt||Ay()&&e[n].phaseID===Krt)return n;return-1}var Qrt,Zrt,$rt=me({OFF:0,ON:1}),tst=me({OFF:0,ON:1}),est=(ert=Wrt("cc.ModelBakeSettings"),irt=Yrt("_recieveShadow"),nrt=jrt(je),rrt=jrt(qe),srt=jrt(qe),art=jrt(me(pR)),ort=jrt(qe),ert(((Srt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).texture=lrt&&lrt(),e.uvParam=crt&&crt(),e._bakeable=_rt&&_rt(),e._castShadow=frt&&frt(),e._receiveShadow=drt&&drt(),e._lightmapSize=prt&&prt(),e._useLightProbe=mrt&&mrt(),e._bakeToLightProbe=grt&&grt(),e._reflectionProbeType=yrt&&yrt(),e._bakeToReflectionProbe=vrt&&vrt(),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}(Du)).USE_LIGHT_PROBE_CHANGED="use_light_probe_changed",Srt.REFLECTION_PROBE_CHANGED="reflection_probe_changed",Srt.BAKE_TO_REFLECTION_PROBE_CHANGED="bake_to_reflection_probe_changed",lrt=Ss((urt=Srt).prototype,"texture",[qrt],(function(){return null})),crt=Ss(urt.prototype,"uvParam",[qrt],(function(){return new zi})),_rt=Ss(urt.prototype,"_bakeable",[qrt],(function(){return!1})),frt=Ss(urt.prototype,"_castShadow",[qrt],(function(){return!1})),drt=Ss(urt.prototype,"_receiveShadow",[irt],(function(){return!1})),prt=Ss(urt.prototype,"_lightmapSize",[qrt],(function(){return 64})),mrt=Ss(urt.prototype,"_useLightProbe",[qrt],(function(){return!1})),grt=Ss(urt.prototype,"_bakeToLightProbe",[qrt],(function(){return!0})),yrt=Ss(urt.prototype,"_reflectionProbeType",[qrt],(function(){return pR.NONE})),vrt=Ss(urt.prototype,"_bakeToReflectionProbe",[qrt],(function(){return!0})),p(urt.prototype,"lightmapSize",[nrt],Object.getOwnPropertyDescriptor(urt.prototype,"lightmapSize"),urt.prototype),p(urt.prototype,"useLightProbe",[rrt],Object.getOwnPropertyDescriptor(urt.prototype,"useLightProbe"),urt.prototype),p(urt.prototype,"bakeToLightProbe",[srt],Object.getOwnPropertyDescriptor(urt.prototype,"bakeToLightProbe"),urt.prototype),p(urt.prototype,"reflectionProbe",[art],Object.getOwnPropertyDescriptor(urt.prototype,"reflectionProbe"),urt.prototype),p(urt.prototype,"bakeToReflectionProbe",[ort],Object.getOwnPropertyDescriptor(urt.prototype,"bakeToReflectionProbe"),urt.prototype),hrt=urt))||hrt),ist=(Art=Wrt("cc.MeshRenderer"),Trt=Xrt(100),Ert=jrt(Ye),brt=jrt(Ye),xrt=jrt($rt),Crt=jrt(tst),Rrt=jrt(jN),wrt=jrt(qe),Art(Irt=Trt(((zrt=function(t){s(i,t);var e=i.prototype;function i(){var e;return(e=t.call(this)||this).bakeSettings=Drt&&Drt(),e._mesh=Prt&&Prt(),e._shadowCastingMode=Ort&&Ort(),e._shadowReceivingMode=Mrt&&Mrt(),e._shadowBias=Nrt&&Nrt(),e._shadowNormalBias=Lrt&&Lrt(),e._reflectionProbeId=Frt&&Frt(),e._reflectionProbeBlendId=krt&&krt(),e._reflectionProbeBlendWeight=Grt&&Grt(),e._enabledGlobalStandardSkinObject=Vrt&&Vrt(),e._reflectionProbeDataMap=null,e._subMeshShapesWeights=[],e._modelType=void 0,e._model=null,e._morphInstance=null,e._enableMorph=Urt&&Urt(),e._modelType=wR,Ee.querySettings(Te.Category.RENDERING,"highQualityMode")&&(e._shadowCastingMode=$rt.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(zp.MOBILITY_CHANGED,this.onMobilityChanged,this),this.node.on(zp.LIGHT_PROBE_BAKING_CHANGED,this.onLightProbeBakingChanged,this),this.bakeSettings.on(est.USE_LIGHT_PROBE_CHANGED,this.onUseLightProbeChanged,this),this.bakeSettings.on(est.REFLECTION_PROBE_CHANGED,this.onReflectionProbeChanged,this),this.bakeSettings.on(est.BAKE_TO_REFLECTION_PROBE_CHANGED,this.onBakeToReflectionProbeChanged,this),this._model||this._updateModels(),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(zp.MOBILITY_CHANGED,this.onMobilityChanged,this),this.node.off(zp.LIGHT_PROBE_BAKING_CHANGED,this.onLightProbeBakingChanged,this),this.bakeSettings.off(est.USE_LIGHT_PROBE_CHANGED,this.onUseLightProbeChanged,this),this.bakeSettings.off(est.REFLECTION_PROBE_CHANGED,this.onReflectionProbeChanged,this),this.bakeSettings.off(est.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===pR.BAKED_CUBEMAP?(this.model.updateReflectionProbeCubemap(r),this.model.updateReflectionProbePlanarMap(null),this.model.updateReflectionProbeBlendCubemap(null)):e===pR.BLEND_PROBES||e===pR.BLEND_PROBES_AND_SKYBOX?(this.model.updateReflectionProbeCubemap(r),this.model.updateReflectionProbeBlendCubemap(i),this.model.updateReflectionProbePlanarMap(null)):e===pR.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.initLightingmap(this.bakeSettings.texture,this.bakeSettings.uvParam),this._updateUseLightProbe(),this._updateUseReflectionProbe(),this._updateModelParams(),this._onUpdateLightingmap(),this._onUpdateLocalShadowBiasAndProbeId(),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===am.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===wR?Hrt: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 Hrt&&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|=Vp.POSITION,this._model.transform.hasChangedFlags|=Vp.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!==pR.BAKED_CUBEMAP&&this.bakeSettings.reflectionProbe!==pR.BLEND_PROBES&&this.bakeSettings.reflectionProbe!==pR.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 xS.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===$rt.OFF?this._model.castShadow=!1:(this._shadowCastingMode,$rt.ON,this._shadowCastingMode,this._model.castShadow=!0))},e._updateReceiveShadow=function(){this._model&&(this._shadowReceivingMode===tst.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===pR.BAKED_CUBEMAP||this.bakeSettings.reflectionProbe===pR.BLEND_PROBES||this.bakeSettings.reflectionProbe===pR.BLEND_PROBES_AND_SKYBOX?(v.internal.reflectionProbeManager.updateUseCubeModels(this._model),v.internal.reflectionProbeManager.getUsedReflectionProbe(this._model,!1)||q(16302)):this.bakeSettings.reflectionProbe===pR.PLANAR_REFLECTION&&(v.internal.reflectionProbeManager.updateUsePlanarModels(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===am.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._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 Hrt&&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(!(Jrt(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===$rt.ON},set:function(t){this.shadowCastingMode=!0===t?$rt.ON:$rt.OFF}},{key:"receiveShadow",get:function(){return this._shadowReceivingMode},set:function(t){this._shadowReceivingMode=t,this._updateReceiveShadow()}},{key:"receiveShadowForInspector",get:function(){return this._shadowReceivingMode===tst.ON},set:function(t){this._shadowReceivingMode=!0===t?tst.ON:tst.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}(sH)).ShadowCastingMode=$rt,zrt.ShadowReceivingMode=tst,Drt=Ss((Brt=zrt).prototype,"bakeSettings",[qrt],(function(){return new est(this)})),Prt=Ss(Brt.prototype,"_mesh",[qrt],(function(){return null})),Ort=Ss(Brt.prototype,"_shadowCastingMode",[qrt],(function(){return $rt.OFF})),Mrt=Ss(Brt.prototype,"_shadowReceivingMode",[qrt],(function(){return tst.ON})),Nrt=Ss(Brt.prototype,"_shadowBias",[qrt],(function(){return 0})),Lrt=Ss(Brt.prototype,"_shadowNormalBias",[qrt],(function(){return 0})),Frt=Ss(Brt.prototype,"_reflectionProbeId",[qrt],(function(){return-1})),krt=Ss(Brt.prototype,"_reflectionProbeBlendId",[qrt],(function(){return-1})),Grt=Ss(Brt.prototype,"_reflectionProbeBlendWeight",[qrt],(function(){return 0})),Vrt=Ss(Brt.prototype,"_enabledGlobalStandardSkinObject",[qrt],(function(){return!1})),p(Brt.prototype,"shadowBias",[Ert],Object.getOwnPropertyDescriptor(Brt.prototype,"shadowBias"),Brt.prototype),p(Brt.prototype,"shadowNormalBias",[brt],Object.getOwnPropertyDescriptor(Brt.prototype,"shadowNormalBias"),Brt.prototype),p(Brt.prototype,"shadowCastingMode",[xrt],Object.getOwnPropertyDescriptor(Brt.prototype,"shadowCastingMode"),Brt.prototype),p(Brt.prototype,"receiveShadow",[Crt],Object.getOwnPropertyDescriptor(Brt.prototype,"receiveShadow"),Brt.prototype),p(Brt.prototype,"mesh",[Rrt],Object.getOwnPropertyDescriptor(Brt.prototype,"mesh"),Brt.prototype),p(Brt.prototype,"isGlobalStandardSkinObject",[wrt],Object.getOwnPropertyDescriptor(Brt.prototype,"isGlobalStandardSkinObject"),Brt.prototype),Urt=Ss(Brt.prototype,"_enableMorph",[qrt],(function(){return!0})),Irt=Brt))||Irt)||Irt),nst=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}(),rst=Is("cc.PerfCounter")(Qrt=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}(nst))||Qrt,sst="0123456789. ",ast=500,ost={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,".":10},hst={fps:{desc:"Framerate (FPS)",below:30,average:ast,isInteger:!0},draws:{desc:"Draw call",isInteger:!0},frame:{desc:"Frame time (ms)",min:0,max:50,average:ast},instances:{desc:"Instance Count",isInteger:!0},tricount:{desc:"Triangle",isInteger:!0},logic:{desc:"Game Logic (ms)",min:0,max:50,average:ast,color:"#080"},physics:{desc:"Physics (ms)",min:0,max:50,average:ast},render:{desc:"Renderer (ms)",min:0,max:50,average:ast,color:"#f90"},present:{desc:"Present (ms)",min:0,max:50,average:ast,color:"#f90"},textureMemory:{desc:"GFX Texture Mem(M)"},bufferMemory:{desc:"GFX Buffer Mem(M)"}},ust=t("f6",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 Tc,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(hst).length+1),e._wordHeight=0,e._eachNumWidth=0,e._totalLines=0,e.lastTime=0,e._canvas=A.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(){Ee.querySettings(Te.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,vN.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=of.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 Oc(Pl.TEX2D,Ol.SAMPLED|Ol.TRANSFER_DST,xl.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 hst){var n=hst[i];this._ctx.fillText(n.desc,0,e*this._lineHeight),n.counter=new rst(i,n,t),e++}this._totalLines=e,this._wordHeight=this._totalLines*this._lineHeight/this._canvas.height;for(var r=0;r<sst.length;++r){var s=this._ctx.measureText(sst[r]).width;this._eachNumWidth=Math.max(this._eachNumWidth,s)}for(var a=0;a<sst.length;++a)this._ctx.fillText(sst[a],a*this._eachNumWidth,this._totalLines*this._lineHeight);this._eachNumWidth/=this._canvas.width,this._profilerStats=hst,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 Pm("PROFILER_NODE"),this._rootNode._objFlags=v.Object.Flags.DontSave|v.Object.Flags.HideInHierarchy,v.game.addPersistRootNode(this._rootNode);var t=new Pm("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,f=Math.floor(_/4),d=_-4*f;h.push(0,this._wordHeight,f,d),h.push(this._eachNumWidth,this._wordHeight,f,d),h.push(this._eachNumWidth,1,f,d),h.push(0,1,f,d)}this._meshRenderer=t.addComponent(ist),this._meshRenderer.mesh=iL({positions:a,indices:o,colors:h});var p=new KS;p.initialize({effectName:"util/profiler"});var m=this.pass=p.passes[0],g=m.getBinding("mainTexture"),y=m.getBinding("digits"),S=m.getBinding("offset");m.bindTexture(g,this._texture),this.digitsData=m.blocks[y],this.offsetData=m.blocks[S],this.offsetData[3]=-1,this._meshRenderer.material=p,this._meshRenderer.node.layer=kp.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=_n[t],n=-.9,r=-.9*e;ul.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?vN.root.pipeline.profiler=this._meshRenderer.model:vN.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<ast)){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=ost[u];void 0===l&&(l=11),n[h]=l}i++}}}},n(e,[{key:"_stats",get:function(){return k("Profiler._stats is deprecated, please use Profiler.stats instead."),this._profilerStats}},{key:"stats",get:function(){return this._profilerStats}}]),e}(pu)),lst=t("f7",new ust);vN.registerSystem("profiler",lst,0),v.profiler=lst,function(t){var e,i,n,r,s,a,o,h;(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",function(t){t[t.rotate=0]="rotate",t[t.translate=1]="translate",t[t.scale=2]="scale",t[t.shear=3]="shear",t[t.attachment=4]="attachment",t[t.color=5]="color",t[t.deform=6]="deform",t[t.event=7]="event",t[t.drawOrder=8]="drawOrder",t[t.ikConstraint=9]="ikConstraint",t[t.transformConstraint=10]="transformConstraint",t[t.pathConstraintPosition=11]="pathConstraintPosition",t[t.pathConstraintSpacing=12]="pathConstraintSpacing",t[t.pathConstraintMix=13]="pathConstraintMix",t[t.twoColor=14]="twoColor"}(t.TimelineType||(t.TimelineType={})),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={})),function(t){t[t.Normal=0]="Normal",t[t.Additive=1]="Additive",t[t.Multiply=2]="Multiply",t[t.Screen=3]="Screen"}(t.BlendMode||(t.BlendMode={})),(n=t.TransformMode||(t.TransformMode={}))[n.Normal=0]="Normal",n[n.OnlyTranslation=1]="OnlyTranslation",n[n.NoRotationOrReflection=2]="NoRotationOrReflection",n[n.NoScale=3]="NoScale",n[n.NoScaleOrReflection=4]="NoScaleOrReflection",(r=t.PositionMode||(t.PositionMode={}))[r.Fixed=0]="Fixed",r[r.Percent=1]="Percent",(s=t.SpacingMode||(t.SpacingMode={}))[s.Length=0]="Length",s[s.Fixed=1]="Fixed",s[s.Percent=2]="Percent",(a=t.RotateMode||(t.RotateMode={}))[a.Tangent=0]="Tangent",a[a.Chain=1]="Chain",a[a.ChainScale=2]="ChainScale",(o=t.TextureFilter||(t.TextureFilter={}))[o.Nearest=9728]="Nearest",o[o.Linear=9729]="Linear",o[o.MipMap=9987]="MipMap",o[o.MipMapNearestNearest=9984]="MipMapNearestNearest",o[o.MipMapLinearNearest=9985]="MipMapLinearNearest",o[o.MipMapNearestLinear=9986]="MipMapNearestLinear",o[o.MipMapLinearLinear=9987]="MipMapLinearLinear",(h=t.TextureWrap||(t.TextureWrap={}))[h.MirroredRepeat=33648]="MirroredRepeat",h[h.ClampToEdge=33071]="ClampToEdge",h[h.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={}))}(Zrt||(Zrt={}));var cst=Zrt,_st=0,fst=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){return e.listener||(e.listener=new t),e.listener},t.emitListener=function(e,i,n){var r=t._listenerSet.get(e);r&&r&&r(i,n)},t.addListener=function(e){var i=++_st;return t._listenerSet.set(i,e),i},t}();function dst(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 pst(t,e,i){Object.defineProperty(t,i,{get:function(){for(var t=[],i=e.call(this),n=i.size(),r=0;r<n;r++){var s=i.get(r);t.push(s)}return t}})}fst._listenerSet=new Map,globalThis.TrackEntryListeners=fst;var mst=null,gst=[];xN.onPostInfrastructureInitDelegate.add((function(){return Promise.resolve().then((function(){return Promise.all([e.import("./spine.asm-c9756f96.js"),e.import("./spine.js-f7f5ea79.js"),e.import("./spine.wasm-bd34e00c.js"),e.import("./spine-3e0daee9.js")]).then((function(t){var e=t[0].default,i=t[1].default,n=t[2].default,r=t[3].default;return ul.hasFeature(ul.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){(function(t,e){return dst(t).then((function(t){return WebAssembly.instantiate(t,e)}))})(e,t).then((function(t){i(t.instance,t.module)})).catch((function(t){return n(r(t))}))}}).then((function(t){mst=t,gst.forEach((function(t){t(mst)}))})).then(i).catch((function(t){return n(r(t))}))}))}(n,r):function(t,e){return new Promise((function(i,n){dst(e).then((function(e){var i={};return i.buffer=new ArrayBuffer(33554432),t({wasmMemory:i,memoryInitializerRequest:{response:e,status:200}}).then((function(t){mst=t,gst.forEach((function(t){t(mst)}))}))})).then(i).catch(n)}))}(e,i)}))})).catch((function(t){G(t)}))})),gst.push((function(t){var e;!function(t){cst.wasmUtil=t.SpineWasmUtil,cst.wasmUtil.wasm=t,cst.wasmUtil.spineWasmInit(),cst.MathUtils=t.MathUtils,cst.Color=t.Color,cst.Interpolation=t.Interpolation,cst.Triangulator=t.Triangulator,cst.ConstraintData=t.ConstraintData,cst.IkConstraintData=t.IkConstraintData,cst.PathConstraintData=t.PathConstraintData,cst.SkeletonBounds=t.SkeletonBounds,cst.Event=t.Event,cst.EventData=t.EventData,cst.Attachment=t.Attachment,cst.VertexAttachment=t.VertexAttachment,cst.BoundingBoxAttachment=t.BoundingBoxAttachment,cst.ClippingAttachment=t.ClippingAttachment,cst.MeshAttachment=t.MeshAttachment,cst.PathAttachment=t.PathAttachment,cst.PointAttachment=t.PointAttachment,cst.RegionAttachment=t.RegionAttachment,cst.AtlasAttachmentLoader=t.AtlasAttachmentLoader,cst.TextureAtlasPage=t.TextureAtlasPage,cst.TextureAtlasRegion=t.TextureAtlasRegion,cst.TextureAtlas=t.TextureAtlas,cst.PowOut=t.PowOut,cst.BoneData=t.BoneData,cst.SlotData=t.SlotData,cst.Updatable=t.Updatable,cst.IkConstraint=t.IkConstraint,cst.PathConstraint=t.PathConstraint,cst.TransformConstraintData=t.TransformConstraintData,cst.TransformConstraint=t.TransformConstraint,cst.Bone=t.Bone,cst.Slot=t.Slot,cst.Skin=t.Skin,cst.SkinEntry=t.SkinEntry,cst.SkeletonClipping=t.SkeletonClipping,cst.SkeletonData=t.SkeletonData,cst.TranslateTimeline=t.TranslateTimeline,cst.ScaleTimeline=t.ScaleTimeline,cst.ShearTimeline=t.ShearTimeline,cst.RotateTimeline=t.RotateTimeline,cst.ColorTimeline=t.ColorTimeline,cst.TwoColorTimeline=t.TwoColorTimeline,cst.AttachmentTimeline=t.AttachmentTimeline,cst.DeformTimeline=t.DeformTimeline,cst.EventTimeline=t.EventTimeline,cst.DrawOrderTimeline=t.DrawOrderTimeline,cst.IkConstraintTimeline=t.IkConstraintTimeline,cst.TransformConstraintTimeline=t.TransformConstraintTimeline,cst.PathConstraintPositionTimeline=t.PathConstraintPositionTimeline,cst.PathConstraintMixTimeline=t.PathConstraintMixTimeline,cst.TrackEntry=t.TrackEntry,cst.AnimationStateData=t.AnimationStateData,cst.AnimationState=t.AnimationState,cst.Animation=t.Animation,cst.EventQueue=t.EventQueue,cst.AnimationStateAdapter=t.AnimationStateAdapter,cst.Skeleton=t.Skeleton,cst.SkeletonBinary=t.SkeletonBinary,cst.SkeletonJson=t.SkeletonJson,cst.VertexEffect=t.VertexEffect,cst.JitterEffect=t.JitterEffect,cst.SwirlEffect=t.SwirlEffect,cst.SkeletonInstance=t.SkeletonInstance}(t),[{proto:e=cst.BoneData.prototype,property:"index",getter:e.getIndex},{proto:e,property:"name",getter:e.getName},{proto:e,property:"parent",getter:e.getParent},{proto:e,property:"length",getter:e.getLength},{proto:e,property:"x",getter:e.getX},{proto:e,property:"y",getter:e.getY},{proto:e,property:"rotation",getter:e.getRotation},{proto:e,property:"scaleX",getter:e.getScaleX},{proto:e,property:"scaleY",getter:e.getScaleY},{proto:e,property:"shearX",getter:e.getShearX},{proto:e,property:"shearY",getter:e.getShearY},{proto:e,property:"transformMode",getter:e.getTransformMode},{proto:e,property:"skinRequired",getter:e.getSkinRequired}].forEach((function(t){xt(t.proto,t.property,t.getter)})),function(){var t=cst.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){xt(t.proto,t.property,t.getter,t.setter)}))}(),function(){var t=cst.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){xt(t.proto,t.property,t.getter,t.setter)})),pst(t,t.getBones,"bones")}(),function(){var t=cst.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){xt(t.proto,t.property,t.getter,t.setter)})),pst(t,t.getBones,"bones")}(),function(){var t=cst.Event.prototype;[{proto:t,property:"data",getter:t.getData},{proto:t,property:"intValue",getter:t.getIntValue},{proto:t,property:"floatValue",getter:t.getFloatValue},{proto:t,property:"stringValue",getter:t.getStringValue},{proto:t,property:"time",getter:t.getTime},{proto:t,property:"volume",getter:t.getVolume},{proto:t,property:"balance",getter:t.getBalance}].forEach((function(t){xt(t.proto,t.property,t.getter)}))}(),function(){var t=cst.EventData.prototype;[{proto:t,property:"name",getter:t.getName},{proto:t,property:"intValue",getter:t.getIntValue},{proto:t,property:"floatValue",getter:t.getFloatValue},{proto:t,property:"stringValue",getter:t.getStringValue},{proto:t,property:"audioPath",getter:t.getAudioPath},{proto:t,property:"volume",getter:t.getVolume},{proto:t,property:"balance",getter:t.getBalance}].forEach((function(t){xt(t.proto,t.property,t.getter)}))}(),function(){var t=cst.BoundingBoxAttachment.prototype;[{proto:t,property:"name",getter:t.getName}].forEach((function(t){xt(t.proto,t.property,t.getter)}))}(),function(){var t=cst.ClippingAttachment.prototype;[{proto:t,property:"endSlot",getter:t.getEndSlot}].forEach((function(t){xt(t.proto,t.property,t.getter)}))}(),function(){var t=cst.MeshAttachment.prototype;[{proto:t,property:"path",getter:t.getPath},{proto:t,property:"regionUVs",getter:t.getRegionUVs},{proto:t,property:"uvs",getter:t.getUvs},{proto:t,property:"triangles",getter:t.getTriangles},{proto:t,property:"color",getter:t.getColor},{proto:t,property:"width",getter:t.getWidth},{proto:t,property:"height",getter:t.getHeight},{proto:t,property:"hullLength",getter:t.getHullLength},{proto:t,property:"edges",getter:t.getEdges}].forEach((function(t){xt(t.proto,t.property,t.getter)}))}(),function(){var t=cst.PathAttachment.prototype;[{proto:t,property:"closed",getter:t.getClosed},{proto:t,property:"constantSpeed",getter:t.getConstantSpeed}].forEach((function(t){xt(t.proto,t.property,t.getter)})),pst(t,t.getLengths,"lengths")}(),function(){var t=cst.PointAttachment.prototype;[{proto:t,property:"x",getter:t.getX},{proto:t,property:"y",getter:t.getY},{proto:t,property:"rotation",getter:t.getRotation}].forEach((function(t){xt(t.proto,t.property,t.getter)}))}(),function(){var t=cst.RegionAttachment.prototype;[{proto:t,property:"x",getter:t.getX},{proto:t,property:"y",getter:t.getY},{proto:t,property:"scaleX",getter:t.getScaleX},{proto:t,property:"scaleY",getter:t.getScaleY},{proto:t,property:"rotation",getter:t.getRotation},{proto:t,property:"width",getter:t.getWidth},{proto:t,property:"height",getter:t.getHeight},{proto:t,property:"color",getter:t.getColor},{proto:t,property:"path",getter:t.getPath},{proto:t,property:"rendererObject",getter:t.getRendererObject},{proto:t,property:"offset",getter:t.getOffset},{proto:t,property:"uvs",getter:t.getUVs}].forEach((function(t){xt(t.proto,t.property,t.getter)}))}(),function(){var t=cst.SlotData.prototype;[{proto:t,property:"index",getter:t.getIndex},{proto:t,property:"name",getter:t.getName},{proto:t,property:"boneData",getter:t.getBoneData},{proto:t,property:"color",getter:t.getColor},{proto:t,property:"darkColor",getter:t.getDarkColor},{proto:t,property:"blendMode",getter:t.getBlendMode}].forEach((function(t){xt(t.proto,t.property,t.getter)}))}(),function(){var t=cst.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){xt(t.proto,t.property,t.getter,t.setter)})),pst(t,t.getBones,"bones")}(),function(){var t=cst.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){xt(t.proto,t.property,t.getter,t.setter)})),pst(t,t.getBones,"bones")}(),function(){var t=cst.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){xt(t.proto,t.property,t.getter)})),pst(t,t.getBones,"bones")}(),function(){var t=cst.TransformConstraint.prototype;[{proto:t,property:"data",getter:t.getData},{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:"active",getter:t.getActive}].forEach((function(t){xt(t.proto,t.property,t.getter)})),pst(t,t.getBones,"bones")}(),function(){var t=cst.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){xt(t.proto,t.property,t.getter,t.setter)}))}(),function(){var t=cst.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:"deform",getter:t.getDeform}].forEach((function(t){xt(t.proto,t.property,t.getter)}))}(),function(){var t=cst.Skin.prototype;[{proto:t,property:"name",getter:t.getName}].forEach((function(t){xt(t.proto,t.property,t.getter)})),pst(t,t.getBones,"bones"),pst(t,t.getAttachments,"attachments"),pst(t,t.getConstraints,"constraints"),function(t,e){Object.defineProperty(t,"getAttachments",{value:function(){for(var t=[],i=e.call(this),n=i.size(),r=0;r<n;r++){var s=i.get(r);t.push(s)}return t}})}(t,t.getAttachments);var e=t.getAttachmentsForSlot;Object.defineProperty(t,"getAttachmentsForSlot",{value:function(t,i){for(var n=e.call(this,t),r=n.size(),s=0;s<r;s++){var a=n.get(s);i.push(a)}}})}(),function(){var t=cst.Attachment.prototype;[{proto:t,property:"name",getter:t.getName}].forEach((function(t){xt(t.proto,t.property,t.getter)}))}(),function(){var t=cst.SkinEntry.prototype;[{proto:t,property:"name",getter:t.getName},{proto:t,property:"attachment",getter:t.getAttachment}].forEach((function(t){xt(t.proto,t.property,t.getter)}))}(),function(){var t=cst.SkeletonClipping.prototype;[{proto:t,property:"clippedVertices",getter:t.getClippedVertices},{proto:t,property:"clippedTriangles",getter:t.getClippedTriangles},{proto:t,property:"UVs",getter:t.getUVs}].forEach((function(t){xt(t.proto,t.property,t.getter)}))}(),function(){var t=cst.SkeletonData.prototype;[{proto:t,property:"name",getter:t.getName},{proto:t,property:"defaultSkin",getter:t.getDefaultSkin},{proto:t,property:"x",getter:t.getX},{proto:t,property:"y",getter:t.getY},{proto:t,property:"width",getter:t.getWidth},{proto:t,property:"height",getter:t.getHeight},{proto:t,property:"version",getter:t.getVersion},{proto:t,property:"hash",getter:t.getHash},{proto:t,property:"fps",getter:t.getFps},{proto:t,property:"imagesPath",getter:t.getImagesPath},{proto:t,property:"audioPath",getter:t.getAudioPath}].forEach((function(t){xt(t.proto,t.property,t.getter)})),pst(t,t.getBones,"bones"),pst(t,t.getSlots,"slots"),pst(t,t.getSkins,"skins"),pst(t,t.getAnimations,"animations"),pst(t,t.getEvents,"events"),pst(t,t.getIkConstraints,"ikConstraints"),pst(t,t.getTransformConstraints,"transformConstraints"),pst(t,t.getPathConstraints,"pathConstraints")}(),function(){var t=cst.RotateTimeline.prototype;[{proto:t,property:"boneIndex",getter:t.getBoneIndex}].forEach((function(t){xt(t.proto,t.property,t.getter)})),pst(t,t.getFrames,"frames")}(),function(){var t=cst.ColorTimeline.prototype;[{proto:t,property:"slotIndex",getter:t.getSlotIndex}].forEach((function(t){xt(t.proto,t.property,t.getter)})),pst(t,t.getFrames,"frames")}(),function(){var t=cst.TwoColorTimeline.prototype;[{proto:t,property:"slotIndex",getter:t.getSlotIndex}].forEach((function(t){xt(t.proto,t.property,t.getter)}))}(),function(){var t=cst.AttachmentTimeline.prototype;[{proto:t,property:"slotIndex",getter:t.getSlotIndex},{proto:t,property:"attachmentNames",getter:t.getAttachmentNames}].forEach((function(t){xt(t.proto,t.property,t.getter)})),pst(t,t.getFrames,"frames")}(),function(){var t=cst.DeformTimeline.prototype;[{proto:t,property:"slotIndex",getter:t.getSlotIndex},{proto:t,property:"attachment",getter:t.getAttachment},{proto:t,property:"frameVertices",getter:t.getFrameVertices}].forEach((function(t){xt(t.proto,t.property,t.getter)})),pst(t,t.getFrames,"frames")}(),function(){var t=cst.EventTimeline.prototype;pst(t,t.getFrames,"frames"),pst(t,t.getEvents,"events")}(),function(){var t=cst.DrawOrderTimeline.prototype;pst(t,t.getFrames,"frames")}(),function(){var t=cst.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){xt(t.proto,t.property,t.getter,t.setter)}))}(),function(){var t=cst.AnimationStateData.prototype;[{proto:t,property:"defaultMix",getter:t.getDefaultMix},{proto:t,property:"skeletonData",getter:t.getSkeletonData}].forEach((function(t){xt(t.proto,t.property,t.getter)}))}(),function(){var t=cst.AnimationState.prototype;[{proto:t,property:"data",getter:t.getData},{proto:t,property:"timeScale",getter:t.getTimeScale,setter:t.setTimeScale}].forEach((function(t){xt(t.proto,t.property,t.getter,t.setter)})),pst(t,t.getTracks,"tracks")}(),function(){var t=cst.Animation.prototype;[{proto:t,property:"name",getter:t.getName},{proto:t,property:"duration",getter:t.getDuration,setter:t.setDuration}].forEach((function(t){xt(t.proto,t.property,t.getter,t.setter)}))}(),function(){var t=cst.Skeleton.prototype;[{proto:t,property:"data",getter:t.getData},{proto:t,property:"_updateCache",getter:t.getUpdateCache},{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},{proto:t,property:"scaleY",getter:t.getScaleY},{proto:t,property:"x",getter:t.getX},{proto:t,property:"y",getter:t.getY}].forEach((function(t){xt(t.proto,t.property,t.getter)})),pst(t,t.getBones,"bones"),pst(t,t.getSlots,"slots"),pst(t,t.getDrawOrder,"drawOrder"),pst(t,t.getIkConstraints,"ikConstraints"),pst(t,t.getTransformConstraints,"transformConstraints"),pst(t,t.getPathConstraints,"pathConstraints")}(),function(){var t=cst.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){xt(t.proto,t.property,t.getter,t.setter)}))}(),function(){var t=cst.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){xt(t.proto,t.property,t.getter,t.setter)}))}()}));var yst=1/60;lF(aF);var vst,Sst,Ast,Tst,Est,bst,xst,Cst,Rst,wst,Ist=lF(hF),Bst=function(){this.a=0,this.b=0,this.c=0,this.d=0,this.worldX=0,this.worldY=0},Dst=function(){this.vCount=0,this.iCount=0,this.vData=null,this.iData=null,this.meshes=[]},Pst=function(){this.iCount=0,this.blendMode=0,this.textureID=0},Ost=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 cst.SkeletonInstance,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/yst),this._maxFrameIdex<=0&&(this._maxFrameIdex=1),this._instance.setAnimation(0,t,!1)):k("find no animation named "+t+" !!!")},e.updateToFrame=function(t){if(this._inited&&(this.begin(),this.needToUpdate(t)))do{this._frameIdx++,this.totalTime+=yst,this._instance.updateAnimation(yst);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=Ist/Float32Array.BYTES_PER_ELEMENT,s=new Uint8Array(Float32Array.BYTES_PER_ELEMENT*r*i),a=new Uint16Array(n),o=e.vPtr,h=i*Float32Array.BYTES_PER_ELEMENT*r,u=cst.wasmUtil.wasm.HEAPU8.subarray(o,o+h);s.set(u);var l=e.iPtr,c=Uint16Array.BYTES_PER_ELEMENT*n,_=cst.wasmUtil.wasm.HEAPU8.subarray(l,l+c);new Uint8Array(a.buffer).set(_);var f=new Dst;f.vCount=i,f.iCount=n,f.vData=s,f.iData=a;for(var d=e.getMeshes(),p=d.size(),m=0;m<p;m++){var g=d.get(m),y=new Pst;y.iCount=g.iCount,y.blendMode=g.blendMode,y.textureID=g.textureID,f.meshes.push(y)}var v=this._skeleton.bones,S=[];v.forEach((function(t){var e=new Bst;e.a=t.a,e.b=t.b,e.c=t.c,e.d=t.d,e.worldX=t.worldX,e.worldY=t.worldY,S.push(e)})),this.frames[t]={model:f,boneInfos:S}},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.destory=function(){cst.wasmUtil.destroySpineInstance(this._instance)},n(t,[{key:"skeleton",get:function(){return this._skeleton}}]),t}(),Mst=function(){function t(){this._privateMode=void 0,this._skeletonCache=void 0,this._animationPool=void 0,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.removeSkeleton=function(t){var e=this._skeletonCache[t];if(e){var i=e.animationsCache;for(var n in i){var r=i[n];r&&(this._animationPool[t+"#"+n]=r,r.clear())}delete this._skeletonCache[t]}},e.getSkeletonCache=function(t,e){var i=this._skeletonCache[t];if(!i){var n=new cst.Skeleton(e),r=new cst.SkeletonClipping,s=new cst.AnimationStateData(n.data),a=new cst.AnimationState(s),o=new fst;this._skeletonCache[t]=i={skeleton:n,clipper:r,state:a,listener:o,animationsCache:{},curAnimationCache:null}}return i},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 Ost(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].destory(),delete e[i])}else{var n=this._animationPool;for(var r in n)n[r].destory(),delete n[r]}},t}();Mst.FrameTime=yst,Mst.sharedCache=new Mst;var Nst=(vst=Is("sp.SkeletonData"),Sst=ha([Mp]),Ast=ha([Ke]),vst((Est=function(t){function e(){var e;return(e=t.call(this)||this)._skeletonJson=bst&&bst(),e.textures=xst&&xst(),e.textureNames=Cst&&Cst(),e.scale=Rst&&Rst(),e._atlasText=wst&&wst(),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 Pm(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=cst.wasmUtil.querySpineSkeletonDataByUUID(this._uuid);if(e)this._skeletonCache=e;else if(this.skeletonJsonStr)this._skeletonCache=cst.wasmUtil.createSpineSkeletonDataWithJson(this.skeletonJsonStr,this._atlasText),cst.wasmUtil.registerSpineSkeletonDataWithUUID(this._skeletonCache,this._uuid);else{var i=new Uint8Array(this._nativeAsset),n=i.length,r=cst.wasmUtil.queryStoreMemory(n);cst.wasmUtil.wasm.HEAPU8.subarray(r,r+n).set(i),this._skeletonCache=cst.wasmUtil.createSpineSkeletonDataWithBinary(n,this._atlasText),cst.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=me(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=me(e)}return null},i.destroy=function(){return Mst.sharedCache.destroyCachedAnimations(this._uuid),this._skeletonCache&&cst.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}(zf),bst=Ss(Est.prototype,"_skeletonJson",[ks],(function(){return null})),xst=Ss(Est.prototype,"textures",[ks,Sst],(function(){return[]})),Cst=Ss(Est.prototype,"textureNames",[ks,Ast],(function(){return[]})),Rst=Ss(Est.prototype,"scale",[ks],(function(){return 1})),wst=Ss(Est.prototype,"_atlasText",[ks],(function(){return""})),Tst=Est))||Tst);v.internal.SpineSkeletonData=Nst;var Lst=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,vN.registerSystem(e.ID,e._instance,pu.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),e.syncAttachedNode()}))},i.prepareRenderData=function(){this._skeletons&&this._skeletons.forEach((function(t){t.markForUpdateRenderData()}))},e}(pu);Lst.ID="SKELETON",Lst._instance=void 0,v.internal.SpineSkeletonSystem=Lst;var Fst,kst,Gst,Vst,Ust,zst,Hst,Wst,Xst,jst,Yst,qst,Kst,Jst,Qst,Zst,$st,tat,eat,iat,nat,rat,sat,aat,oat,hat,uat,lat,cat,_at,fat,dat,pat,mat,gat,yat=new fn,vat=function(){function t(){this._inited=!1,this._skeleton=null,this._skeletonNode=null,this._skeletonComp=null,this._inited=!1,this._skeleton=null,this._skeletonNode=null,this._skeletonComp=null}var e=t.prototype;return e.init=function(t){this._inited=!0,this._skeleton=t._skeleton,this._skeletonNode=t.node,this._skeletonComp=t},e.reset=function(){this._inited=!1,this._skeleton=null,this._skeletonNode=null,this._skeletonComp=null},e._syncAttachedNode=function(){if(this._inited){var t,e=this._skeletonComp.socketNodes;if(0!==e.size&&(t=this._skeletonComp.isAnimationCached()&&this._skeletonComp._curFrame?this._skeletonComp._curFrame.boneInfos:this._skeleton.bones)&&!(t.length<1))for(var i,n=function(t,e){var i=yat;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=yat},r=f(e.keys());!(i=r()).done;){var s=i.value,a=e.get(s);if(a&&a.isValid){var o=t[s];o?n(a,o):(a.removeFromParent(),a.destroy(),e.delete(s))}else e.delete(s)}}},t}(),Sat=1e4;function Aat(t,e,i){fi.Attr.setClassAttr(t,e,"type","Enum"),fi.Attr.setClassAttr(t,e,"enumList",me.getList(i))}!function(t){t[t.REALTIME=0]="REALTIME",t[t.SHARED_CACHE=1]="SHARED_CACHE",t[t.PRIVATE_CACHE=2]="PRIVATE_CACHE"}(dat||(dat={})),ve(dat),function(t){t[t.default=0]="default"}(pat||(pat={})),ve(pat),function(t){t[t["<None>"]=0]="<None>"}(mat||(mat={})),ve(mat),function(t){t[t.COLORED_TEXTURED=0]="COLORED_TEXTURED",t[t.TWO_COLORED=1]="TWO_COLORED"}(gat||(gat={}));var Tat=(Fst=Is("sp.Skeleton.SpineSocket"),kst=ha(Pm),Fst((Vst=function(t,e){void 0===t&&(t=""),void 0===e&&(e=null),this.path=Ust&&Ust(),this.target=zst&&zst(),this.path=t,this.target=e},Ust=Ss(Vst.prototype,"path",[ks],(function(){return""})),zst=Ss(Vst.prototype,"target",[kst,ks],(function(){return null})),Gst=Vst))||Gst);Jt(Tat,"sp.Skeleton.SpineSocket");var Eat=(Hst=Is("sp.Skeleton"),Wst=ha(Nst),Xst=ha(pat),jst=ha(mat),Yst=ha(dat),qst=ha([Tat]),Kst=ha(KS),Hst(((fat=function(t){function e(){var e;return(e=t.call(this)||this)._skeletonData=Zst&&Zst(),e.defaultSkin=$st&&$st(),e.defaultAnimation=tat&&tat(),e._premultipliedAlpha=eat&&eat(),e._timeScale=iat&&iat(),e._preCacheMode=nat&&nat(),e._cacheMode=rat&&rat(),e._defaultCacheMode=sat&&sat(),e._sockets=aat&&aat(),e._useTint=oat&&oat(),e._debugMesh=hat&&hat(),e._debugBones=uat&&uat(),e._debugSlots=lat&&lat(),e._enableBatch=cat&&cat(),e._runtimeData=null,e._skeleton=null,e._instance=null,e._state=null,e._textures=[],e._animationName="",e._skinName="",e._drawList=new fu((function(){return{material:null,texture:null,indexOffset:0,indexCount:0}}),1),e._materialCache={},e.paused=!1,e._enumSkins=me({}),e._enumAnimations=me({}),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._slotTextures=null,e.loop=_at&&_at(),e._useVertexOpacity=!0,e._startEntry={animation:{name:""},trackIndex:0},e._endEntry={animation:{name:""},trackIndex:0},e._instance=new cst.SkeletonInstance,e.attachUtil=new vat,e}s(e,t);var i=e.prototype;return i.__preload=function(){t.prototype.__preload.call(this),this._updateSkeletonData(),this._updateDebugDraw()},i.onRestore=function(){},i.getState=function(){return this._state},i.onEnable=function(){t.prototype.onEnable.call(this),this._flushAssembler(),Lst.getInstance().add(this)},i.onDisable=function(){t.prototype.onDisable.call(this),Lst.getInstance().remove(this)},i.onDestroy=function(){this.destroyRenderData(),this._cleanMaterialCache(),cst.wasmUtil.destroySpineInstance(this._instance),t.prototype.onDestroy.call(this)},i.clearAnimation=function(){this.isAnimationCached()||(this.clearTrack(0),this.setToSetupPose())},i._updateSkeletonData=function(){var t,e=this._skeletonData;if(!e)return this._runtimeData=null,this._state=null,this._skeleton=null,this._textures=[],void this._refreshInspector();this._needUpdateSkeltonData=!1;var i=null===(t=this.skeletonData)||void 0===t?void 0:t.getRuntimeData();i&&(this.setSkeletonData(i),this.defaultSkin&&this.setSkin(this.defaultSkin),this._textures=e.textures,this._runtimeData=e.getRuntimeData(),this._runtimeData&&(this.setSkeletonData(this._runtimeData),this._refreshInspector(),this.defaultAnimation&&(this.animation=this.defaultAnimation),this.defaultSkin&&this.setSkin(this.defaultSkin),this._updateUseTint(),this._indexBoneSockets(),this._updateSocketBindings(),this.attachUtil.init(this),this._preCacheMode=this._cacheMode))},i.setSkeletonData=function(t){if(this._cacheMode===dat.SHARED_CACHE?this._skeletonCache=Mst.sharedCache:this._cacheMode===dat.PRIVATE_CACHE&&(this._skeletonCache=new Mst,this._skeletonCache.enablePrivateMode()),this.isAnimationCached()){(this.debugBones||this.debugSlots)&&k("Debug bones or slots is invalid in cached mode");var e=this._skeletonCache.getSkeletonCache(this.skeletonData.uuid,t);this._skeleton=e.skeleton}else this._skeleton=this._instance.initSkeleton(t),this._state=this._instance.getAnimationState(),this._instance.setPremultipliedAlpha(this._premultipliedAlpha);this._flushAssembler()},i.setAnimation=function(t,e,i){if("string"!=typeof e)return j(7511),null;if(!this._skeleton.data.findAnimation(e))return j(7509,e),null;var n=null;if(void 0===i&&(i=!0),this._playTimes=i?0:1,this.isAnimationCached()){if(0!==t&&k("Track index can not greater than 0 in cached mode."),!this._skeletonCache)return null;var r=this._skeletonCache.getAnimationCache(this._skeletonData.uuid,e);r||(r=this._skeletonCache.initAnimationCache(this.skeletonData.uuid,this._skeletonData,e)),r&&(this._animationName=e,this._isAniComplete=!1,this._accTime=0,this._playCount=0,this._animCache=r,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&&k("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):(j(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())k("'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.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=Mst.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],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 xS.get("default-spine-material")},i.updateMaterial=function(){var t;t=this._customMaterial?this._customMaterial:this._updateBuiltinMaterial(),this.setMaterial(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 rA({parent:s,subModelIdx:0,owner:this}),this._materialCache[n]=r,r.overridePipelineStates({blendState:{blendColor:Zi.WHITE,targets:[{blendEq:Hl.ADD,blendAlphaEq:Hl.ADD,blendSrc:t,blendDst:e,blendSrcAlpha:t,blendDstAlpha:e}]}});var a=!1;i===gat.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():mat,this._enumAnimations=me({}),Object.assign(this._enumAnimations,t),me.update(this._enumAnimations),Aat(this,"_animationIndex",this._enumAnimations)},i._updateSkinEnum=function(){var t;t=this.skeletonData?this.skeletonData.getSkinsEnum():pat,this._enumSkins=me({}),Object.assign(this._enumSkins,t),me.update(this._enumSkins),Aat(this,"_defaultSkinIndex",this._enumSkins)},i._refreshInspector=function(){},i.destroyRenderData=function(){this._drawList.reset(),t.prototype.destroyRenderData.call(this)},i.createRenderEntity=function(){var t=new MF(EF.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!==dat.REALTIME},i.setAnimationCacheMode=function(t){this._preCacheMode!==t&&(this._cacheMode=t,this._updateSkeletonData(),this.setSkin(this.defaultSkin),this._updateUseTint(),this._updateSocketBindings(),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()?k("cached mode not support setMix!!!"):this._state&&this._instance.setMix(t,e,i)},i.clearTracks=function(){this.isAnimationCached()?k("'clearTracks' interface can not be invoked in cached mode."):this._state&&(this._state.clearTracks(),this.setToSetupPose())},i.clearTrack=function(t){this.isAnimationCached()?k("'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 Pm("DEBUG_DRAW_NODE");t.hideFlags|=ba.Flags.DontSave|ba.Flags.HideInHierarchy;var e=t.addComponent(UV);e.lineWidth=1,e.strokeColor=new Zi(255,0,0,255),this._debugRenderer=e,t.parent=this.node}this.isAnimationCached()?k("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.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(){this.node._uiProps.colorDirty=!0;var t=this._color.r/255,e=this._color.g/255,i=this._color.b/255,n=this.node._uiProps.opacity;this._instance.setColor(t,e,i,n)},i.setVertexEffectDelegate=function(t){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 fst)},i.setStartListener=function(t){this._ensureListener();var e=fst.addListener(t);this._instance.setListener(e,cst.EventType.start),this._listener.start=t},i.setInterruptListener=function(t){this._ensureListener();var e=fst.addListener(t);this._instance.setListener(e,cst.EventType.interrupt),this._listener.interrupt=t},i.setEndListener=function(t){this._ensureListener();var e=fst.addListener(t);this._instance.setListener(e,cst.EventType.end),this._listener.end=t},i.setDisposeListener=function(t){this._ensureListener();var e=fst.addListener(t);this._instance.setListener(e,cst.EventType.dispose),this._listener.dispose=t},i.setCompleteListener=function(t){this._ensureListener();var e=fst.addListener(t);this._instance.setListener(e,cst.EventType.complete),this._listener.complete=t},i.setEventListener=function(t){this._ensureListener();var e=fst.addListener(t);this._instance.setListener(e,cst.EventType.event),this._listener.event=t},i.setTrackStartListener=function(t,e){fst.getListeners(t).start=e},i.setTrackInterruptListener=function(t,e){fst.getListeners(t).interrupt=e},i.setTrackEndListener=function(t,e){fst.getListeners(t).end=e},i.setTrackDisposeListener=function(t,e){fst.getListeners(t).dispose=e},i.setTrackCompleteListener=function(){},i.setTrackEventListener=function(t,e){fst.getListeners(t).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=++Sat,this._slotTextures.set(a,e)),this._instance.setSlotTexture(t,a)}else G("No slot named:"+t)},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=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._defaultCacheMode},set:function(t){this._defaultCacheMode=t,this.setAnimationCacheMode(this._defaultCacheMode)}},{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)}},{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.syncAttachedNode()}},{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()}},{key:"customMaterial",get:function(){return this._customMaterial},set:function(t){this._customMaterial=t,this.updateMaterial(),this.markForUpdateRenderData()}}]),e}(gk)).SpineSocket=Tat,fat.AnimationCacheMode=dat,Zst=Ss((Qst=fat).prototype,"_skeletonData",[ks],(function(){return null})),$st=Ss(Qst.prototype,"defaultSkin",[ks],(function(){return""})),tat=Ss(Qst.prototype,"defaultAnimation",[ks],(function(){return""})),eat=Ss(Qst.prototype,"_premultipliedAlpha",[ks],(function(){return!0})),iat=Ss(Qst.prototype,"_timeScale",[ks],(function(){return 1})),nat=Ss(Qst.prototype,"_preCacheMode",[ks],(function(){return-1})),rat=Ss(Qst.prototype,"_cacheMode",[ks],(function(){return dat.REALTIME})),sat=Ss(Qst.prototype,"_defaultCacheMode",[ks],(function(){return dat.REALTIME})),aat=Ss(Qst.prototype,"_sockets",[ks],(function(){return[]})),oat=Ss(Qst.prototype,"_useTint",[ks],(function(){return!1})),hat=Ss(Qst.prototype,"_debugMesh",[ks],(function(){return!1})),uat=Ss(Qst.prototype,"_debugBones",[ks],(function(){return!1})),lat=Ss(Qst.prototype,"_debugSlots",[ks],(function(){return!1})),cat=Ss(Qst.prototype,"_enableBatch",[ks],(function(){return!1})),p(Qst.prototype,"skeletonData",[Wst],Object.getOwnPropertyDescriptor(Qst.prototype,"skeletonData"),Qst.prototype),p(Qst.prototype,"_defaultSkinIndex",[Xst],Object.getOwnPropertyDescriptor(Qst.prototype,"_defaultSkinIndex"),Qst.prototype),p(Qst.prototype,"_animationIndex",[jst],Object.getOwnPropertyDescriptor(Qst.prototype,"_animationIndex"),Qst.prototype),p(Qst.prototype,"defaultCacheMode",[Yst],Object.getOwnPropertyDescriptor(Qst.prototype,"defaultCacheMode"),Qst.prototype),_at=Ss(Qst.prototype,"loop",[ks],(function(){return!0})),p(Qst.prototype,"sockets",[qst],Object.getOwnPropertyDescriptor(Qst.prototype,"sockets"),Qst.prototype),p(Qst.prototype,"customMaterial",[ua,Kst],Object.getOwnPropertyDescriptor(Qst.prototype,"customMaterial"),Qst.prototype),Jst=Qst))||Jst);v.internal.SpineSkeleton=Eat;var bat,xat,Cat,Rat,wat=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 cst.JitterEffect(t,e),this._vertexEffect},e.initSwirlWithPow=function(t,e){return this._effectType="swirl",this._interpolation=new cst.Pow(e),this._vertexEffect=new cst.SwirlEffect(t,this._interpolation),this._vertexEffect},e.initSwirlWithPowOut=function(t,e){return this._effectType="swirl",this._interpolation=new cst.PowOut(e),this._vertexEffect=new cst.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}(),Iat=new Zi(0,0,255,255),Bat=new Zi(255,0,0,255),Dat=new Zi(0,255,0,255),Pat=new Zi(255,255,0,255),Oat=null,Mat=null,Nat=!1,Lat=!1,Fat=lF(aF),kat=lF(hF);function Gat(t,e){var i,n;switch(t){case 1:i=Nat?zl.ONE:zl.SRC_ALPHA,n=zl.ONE;break;case 2:i=zl.DST_COLOR,n=zl.ONE_MINUS_SRC_ALPHA;break;case 3:i=zl.ONE,n=zl.ONE_MINUS_SRC_COLOR;break;case 0:default:i=Nat?zl.ONE:zl.SRC_ALPHA,n=zl.ONE_MINUS_SRC_ALPHA}return e.getMaterialForBlendAndTint(i,n,Lat?gat.TWO_COLORED:gat.COLORED_TEXTURED)}var Vat={fillBuffers:function(){},updateColor:function(){},vCount:32767,ensureAccessor:function(t){var e=t?Mat:Oat;if(!e){var i=vN.root.device,n=vN.root.batcher2D,r=t?hF:aF;t?(e=Mat=new vF(i,r,this.vCount),n.registerBufferAccessor(Number.parseInt("SPINETINT",36),Mat)):(e=Oat=new vF(i,r,this.vCount),n.registerBufferAccessor(Number.parseInt("SPINE",36),Oat))}return e},createData:function(t){var e=t.renderData;if(!e){var i=t.useTint||t.isAnimationCached(),n=this.ensureAccessor(i);e=FF.add(i?hF:aF,n)}return e},updateRenderData:function(t){t._skeleton&&function(t){if(t.drawList.reset(),0!==t.color.a){t._updateColor(),Nat=t.premultipliedAlpha,Lat=t.useTint||t.isAnimationCached(),t.isAnimationCached()?function(t){var e=t.updateRenderData();if(e){var i=e.vCount,n=e.iCount,r=t.renderData;if(r.vertexCount===i&&r.indexCount===n||(r.resize(i,n),r.indices=new Uint16Array(n)),!(i<1||n<1)){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||Nat){bat=o.r/255,xat=o.g/255,Cat=o.b/255,Rat=o.a/255;for(var h=0;h<i;h++){var u=h*kat+5*Float32Array.BYTES_PER_ELEMENT,l=a[u],c=a[u+1],_=a[u+2],f=a[u+3]*Rat,d=Nat?f/255:1;a[u]=Math.floor(d*l*bat),a[u+1]=Math.floor(d*c*xat),a[u+2]=Math.floor(d*_*Cat),a[u+3]=Math.floor(f),a[u+4]=Math.floor(a[u+4]*bat),a[u+5]=Math.floor(a[u+5]*xat),a[u+6]=Math.floor(a[u+6]*Cat),a[u+7]=Nat?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 y=e.meshes,v=y.length,S=0,A=0,T=0;T<v;T++){var E=y[T],b=Gat(E.blendMode,t),x=E.textureID;A=E.iCount,t.requestDrawData(b,x,S,A),S+=A}var C=kat/Float32Array.BYTES_PER_ELEMENT;if(t.enableBatch)for(var R=t.node.worldMatrix,w=0,I=new Yi(0,0,0),B=0;B<i;B++)w=B*C,I.x=s[w],I.y=s[w+1],I.z=0,I.transformMat4(R),s[w]=I.x,s[w+1]=I.y,s[w+2]=I.z}}}(t):function(t){var e=(Lat?kat:Fat)/Float32Array.BYTES_PER_ELEMENT,i=t.updateRenderData();if(i){var n=i.vCount,r=i.iCount,s=t.renderData;if(s.vertexCount===n&&s.indexCount===r||(s.resize(n,r),s.indices=new Uint16Array(r)),!(n<1||r<1)){var a=s.chunk.vb,o=new Uint8Array(a.buffer,a.byteOffset,Float32Array.BYTES_PER_ELEMENT*a.length),h=i.vPtr,u=n*Float32Array.BYTES_PER_ELEMENT*e,l=cst.wasmUtil.wasm.HEAPU8.subarray(h,h+u);o.set(l);var c=i.iPtr,_=s.indices,f=Uint16Array.BYTES_PER_ELEMENT*r,d=cst.wasmUtil.wasm.HEAPU8.subarray(c,c+f);new Uint8Array(_.buffer).set(d);for(var p=s.chunk.vertexOffset,m=0;m<r;m++)_[m]+=p;for(var g=i.getMeshes(),y=g.size(),v=0,S=0,A=0;A<y;A++){var T=g.get(A),E=Gat(T.blendMode,t),b=T.textureID;S=T.iCount,t.requestDrawData(E,b,v,S),v+=S}if(t.enableBatch)for(var x=t.node.worldMatrix,C=0,R=new Yi(0,0,0),w=0;w<n;w++)C=w*e,R.x=a[C],R.y=a[C+1],R.z=0,R.transformMat4(x),a[C]=R.x,a[C+1]=R.y,a[C+2]=R.z;var I=t._debugRenderer,B=t._skeleton;if(I&&(t.debugBones||t.debugSlots||t.debugMesh)){I.clear(),I.lineWidth=5;for(var D=t.getDebugShapes(),P=D.size(),O=0;O<P;O++){var M=D.get(O);if(0===M.type&&t.debugSlots){I.strokeColor=Iat;var N=M.vOffset*e,L=M.vCount*e;I.moveTo(a[N],a[N+1]);for(var F=N+e,k=N+L;F<k;F+=e)I.lineTo(a[F],a[F+1]);I.close(),I.stroke()}else if(1===M.type&&t.debugMesh){I.strokeColor=Pat;for(var G=M.iCount,V=M.iOffset,U=V,z=V+G;U<z;U+=3){var H=_[U]*e,W=_[U+1]*e,X=_[U+2]*e;I.moveTo(a[H],a[H+1]),I.lineTo(a[W],a[W+1]),I.lineTo(a[X],a[X+1]),I.close(),I.stroke()}}}if(t.debugBones){I.strokeColor=Bat,I.fillColor=Iat;for(var j=0,Y=B.bones.length;j<Y;j++){var q=B.bones[j],K=q.data.length*q.a+q.worldX,J=q.data.length*q.c+q.worldY;I.moveTo(q.worldX,q.worldY),I.lineTo(K,J),I.stroke(),I.circle(q.worldX,q.worldY,1.5*Math.PI),I.fill(),0===j&&(I.fillColor=Dat)}}}}}}(t);var e=t.renderData,i=Lat?Mat:Oat;(e.vertexCount>0||e.indexCount>0)&&i.getMeshBuffer(e.chunk.bufferId).setDirty()}}(t)}};v.internal.SpineAssembler=Vat;var Uat,zat,Hat,Wat,Xat,jat,Yat,qat,Kat,Jat={getAssembler:function(){return Vat}};Eat.Assembler=Jat,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"}(Uat||(Uat={})),ve(Uat),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"}(zat||(zat={})),ve(zat),t("f8",Object.freeze({__proto__:null,spine:cst,get ATTACHMENT_TYPE(){return Uat},get AnimationEventType(){return zat},timeScale:1,get AnimationCacheMode(){return dat},get DefaultSkinsEnum(){return pat},get DefaultAnimsEnum(){return mat},get SpineMaterialType(){return gat},SpineSocket:Tat,Skeleton:Eat,SkeletonData:Nst,VertexEffectDelegate:wat,simpleSpineAssembler:Jat})),function(t){t[t.ORTHO=0]="ORTHO",t[t.HEX=1]="HEX",t[t.ISO=2]="ISO"}(Hat||(Hat={})),ve(Hat),function(t){t[t.NONE=0]="NONE",t[t.MAP=1]="MAP",t[t.LAYER=2]="LAYER",t[t.OBJECTGROUP=3]="OBJECTGROUP",t[t.OBJECT=4]="OBJECT",t[t.TILE=5]="TILE"}(Wat||(Wat={})),ve(Wat),function(t){t[t.HORIZONTAL=2147483648]="HORIZONTAL",t[t.VERTICAL=1073741824]="VERTICAL",t[t.DIAGONAL=536870912]="DIAGONAL",t[t.FLIPPED_ALL=4026531840]="FLIPPED_ALL",t[t.FLIPPED_MASK=268435455]="FLIPPED_MASK"}(Xat||(Xat={})),ve(Xat),function(t){t[t.STAGGERAXIS_X=0]="STAGGERAXIS_X",t[t.STAGGERAXIS_Y=1]="STAGGERAXIS_Y"}(jat||(jat={})),ve(jat),function(t){t[t.STAGGERINDEX_ODD=0]="STAGGERINDEX_ODD",t[t.STAGGERINDEX_EVEN=1]="STAGGERINDEX_EVEN"}(Yat||(Yat={})),ve(Yat),function(t){t[t.RightDown=0]="RightDown",t[t.RightUp=1]="RightUp",t[t.LeftDown=2]="LeftDown",t[t.LeftUp=3]="LeftUp"}(qat||(qat={})),ve(qat),function(t){t[t.RECT=0]="RECT",t[t.ELLIPSE=1]="ELLIPSE",t[t.POLYGON=2]="POLYGON",t[t.POLYLINE=3]="POLYLINE",t[t.IMAGE=4]="IMAGE",t[t.TEXT=5]="TEXT"}(Kat||(Kat={})),ve(Kat);var Qat=function(){function t(){this.name="",this.firstGid=0,this.spacing=0,this.margin=0,this.sourceImage=void 0,this.imageName=null,this.imageOffset=null,this.imageSize=new An(0,0),this.tileOffset=new yn(0,0),this._tileSize=new An(0,0),this.collection=!1}return t.prototype.rectForGID=function(t,e){var i=e||new En(0,0,0,0);i.width=this._tileSize.width,i.height=this._tileSize.height;var n=t;if(n&=Xat.FLIPPED_MASK,n-=this.firstGid,this.imageOffset)i.x=this.imageOffset.x,i.y=this.imageOffset.y;else{var r=Math.floor((this.imageSize.width-2*this.margin+this.spacing)/(this._tileSize.width+this.spacing));i.x=Math.round(n%r*(this._tileSize.width+this.spacing)+this.margin),i.y=Math.round(Math.floor(n/r)*(this._tileSize.height+this.spacing)+this.margin)}return i},t}(),Zat=function(){function t(){this.properties={},this.name="",this.objects=[],this.visible=!0,this.opacity=0,this.color=new Zi(255,255,255,255),this.offset=new yn(0,0),this.draworder="topdown",this.tintColor=null}var e=t.prototype;return e.getProperties=function(){return this.properties},e.setProperties=function(t){this.properties=t},t}(),$at=function(){function t(){this.properties={},this.name="",this.layerSize=null,this.tiles=[],this.visible=!0,this.opacity=0,this.ownTiles=!0,this.minGID=1e5,this.maxGID=0,this.offset=new yn(0,0),this.tintColor=null}var e=t.prototype;return e.getProperties=function(){return this.properties},e.setProperties=function(t){this.properties=t},t}();$at.ATTRIB_NONE=1,$at.ATTRIB_BASE64=2,$at.ATTRIB_GZIP=4,$at.ATTRIB_ZLIB=8;var tot=function(){this.name="",this.visible=!0,this.width=0,this.height=0,this.offset=new yn(0,0),this.opacity=0,this.trans=new Zi(255,255,255,255),this.sourceImage=void 0,this.tintColor=null};function eot(t){var e=$k.HorizontalAlign;switch(t){case"center":return e.CENTER;case"right":return e.RIGHT;default:return e.LEFT}}function iot(t){var e=$k.VerticalAlign;switch(t){case"center":return e.CENTER;case"bottom":return e.BOTTOM;default:return e.TOP}}function not(t){if(!t)return new Zi(0,0,0,255);if(8===(t=-1!==t.indexOf("#")?t.substring(1):t).length){var e=parseInt(t.substr(0,2),16)||255,i=parseInt(t.substr(2,2),16)||0,n=parseInt(t.substr(4,2),16)||0,r=parseInt(t.substr(6,2),16)||0;return new Zi(i,n,r,e)}var s=parseInt(t.substr(0,2),16)||0,a=parseInt(t.substr(2,2),16)||0,o=parseInt(t.substr(4,2),16)||0;return new Zi(s,a,o,255)}function rot(t,e){for(var i=[],n=t.getElementsByTagName("properties"),r=0;r<n.length;++r)for(var s=n[r].getElementsByTagName("property"),a=0;a<s.length;++a)i.push(s[a]);e=e||{};for(var o=0;o<i.length;o++){var h=i[o],u=h.getAttribute("name"),l=h.getAttribute("type")||"string",c=h.getAttribute("value");"int"===l?c=parseInt(c):"float"===l?c=parseFloat(c):"bool"===l?c="true"===c:"color"===l&&(c=not(c)),e[u]=c}return e}var sot,aot,oot,hot,uot,lot,cot,_ot,fot,dot,pot,mot,got,yot=function(){function t(t,e,i,n,r){this.properties={},this.orientation=null,this.parentElement=null,this.parentGID=0,this.layerAttrs=0,this.storingCharacters=!1,this.currentString=null,this.renderOrder=qat.RightDown,this._supportVersion=[1,4,0],this._objectGroups=[],this._allChildren=[],this._mapSize=new An(0,0),this._tileSize=new An(0,0),this._layers=[],this._tilesets=[],this._imageLayers=[],this._tileProperties=new Map,this._tileAnimations={},this._tsxContentMap=null,this._spriteFrameMap=null,this._spfSizeMap={},this._staggerAxis=null,this._staggerIndex=null,this._hexSideLength=0,this._imageLayerSPF=null,this.initWithXML(t,e,i,n,r)}var e=t.prototype;return e.getOrientation=function(){return this.orientation},e.setOrientation=function(t){this.orientation=t},e.getStaggerAxis=function(){return this._staggerAxis},e.setStaggerAxis=function(t){this._staggerAxis=t},e.getStaggerIndex=function(){return this._staggerIndex},e.setStaggerIndex=function(t){this._staggerIndex=t},e.getHexSideLength=function(){return this._hexSideLength},e.setHexSideLength=function(t){this._hexSideLength=t},e.getMapSize=function(){return new An(this._mapSize.width,this._mapSize.height)},e.setMapSize=function(t){this._mapSize.width=t.width,this._mapSize.height=t.height},e.getTileSize=function(){return new An(this._tileSize.width,this._tileSize.height)},e.setTileSize=function(t){this._tileSize.width=t.width,this._tileSize.height=t.height},e.getLayers=function(){return this._layers},e.setLayers=function(t){this._allChildren.push(t),this._layers.push(t)},e.getImageLayers=function(){return this._imageLayers},e.setImageLayers=function(t){this._allChildren.push(t),this._imageLayers.push(t)},e.getTilesets=function(){return this._tilesets},e.setTilesets=function(t){this._tilesets.push(t)},e.getObjectGroups=function(){return this._objectGroups},e.setObjectGroups=function(t){this._allChildren.push(t),this._objectGroups.push(t)},e.getAllChildren=function(){return this._allChildren},e.getParentElement=function(){return this.parentElement},e.setParentElement=function(t){this.parentElement=t},e.getParentGID=function(){return this.parentGID},e.setParentGID=function(t){this.parentGID=t},e.getLayerAttribs=function(){return this.layerAttrs},e.setLayerAttribs=function(t){this.layerAttrs=t},e.getStoringCharacters=function(){return this.storingCharacters},e.setStoringCharacters=function(t){this.storingCharacters=t},e.getProperties=function(){return this.properties},e.setProperties=function(t){this.properties=t},e.initWithXML=function(t,e,i,n,r){return this._tilesets.length=0,this._layers.length=0,this._imageLayers.length=0,this._tsxContentMap=e,this._spriteFrameMap=i,this._imageLayerSPF=r,this._spfSizeMap=n,this._objectGroups.length=0,this._allChildren.length=0,this.properties={},this._tileProperties=new Map,this._tileAnimations=new Map,this.currentString="",this.storingCharacters=!1,this.layerAttrs=$at.ATTRIB_NONE,this.parentElement=null,this.parseXMLString(t)},e.parseXMLString=function(e,i){var n,r=(new aS).parse(e).documentElement,s=r.getAttribute("orientation"),a=r.getAttribute("staggeraxis"),o=r.getAttribute("staggerindex"),h=r.getAttribute("hexsidelength"),u=r.getAttribute("renderorder"),l=r.getAttribute("version")||"1.0.0";if("map"===r.nodeName){var c=l.split("."),_=this._supportVersion;for(n=0;n<_.length;n++){var f=parseInt(c[n])||0;if(_[n]<f){j(7216,l);break}}"orthogonal"===s?this.orientation=Hat.ORTHO:"isometric"===s?this.orientation=Hat.ISO:"hexagonal"===s?this.orientation=Hat.HEX:null!==s&&j(7217,s),this.renderOrder="right-up"===u?qat.RightUp:"left-up"===u?qat.LeftUp:"left-down"===u?qat.LeftDown:qat.RightDown,"x"===a?this.setStaggerAxis(jat.STAGGERAXIS_X):"y"===a&&this.setStaggerAxis(jat.STAGGERAXIS_Y),"odd"===o?this.setStaggerIndex(Yat.STAGGERINDEX_ODD):"even"===o&&this.setStaggerIndex(Yat.STAGGERINDEX_EVEN),h&&this.setHexSideLength(parseFloat(h));var d=new An(0,0);d.width=parseFloat(r.getAttribute("width")),d.height=parseFloat(r.getAttribute("height")),this.setMapSize(d),(d=new An(0,0)).width=parseFloat(r.getAttribute("tilewidth")),d.height=parseFloat(r.getAttribute("tileheight")),this.setTileSize(d),this.properties=rot(r)}var p=r.getElementsByTagName("tileset");for("map"!==r.nodeName&&(p=[]).push(r),n=0;n<p.length;n++){var m=p[n],g=m.getAttribute("source");if(g){var y=parseInt(m.getAttribute("firstgid")),v=this._tsxContentMap[g];v&&this.parseXMLString(v,y)}else{var S=m.getElementsByTagName("image"),A=S.length>1,T=S[0],E=T.getAttribute("source");E=E.replace(/\\/g,"/");var b=m.getElementsByTagName("tile"),x=b&&b.length||1,C=null,R=m.getAttribute("name")||"",w=parseInt(m.getAttribute("spacing"))||0,I=parseInt(m.getAttribute("margin"))||0,B=i||parseInt(m.getAttribute("firstgid"))||0,D=new An(0,0);D.width=parseFloat(m.getAttribute("tilewidth")),D.height=parseFloat(m.getAttribute("tileheight"));var P=m.getElementsByTagName("tileoffset")[0],O=0,M=0;P&&(O=parseFloat(P.getAttribute("x"))||0,M=parseFloat(P.getAttribute("y"))||0);for(var N=null,L=0;L<x;L++){var F=S[L]?S[L]:T;if(F){var k=F.getAttribute("source");if(k=k.replace(/\\/g,"/"),!N||A){if((N=new Qat).name=R,N.firstGid=B&Xat.FLIPPED_MASK,N.tileOffset.x=O,N.tileOffset.y=M,N.collection=A,!A&&(N.imageName=k,N.imageSize.width=parseFloat(F.getAttribute("width"))||0,N.imageSize.height=parseFloat(F.getAttribute("height"))||0,N.sourceImage=this._spriteFrameMap[k],!N.sourceImage)){var G=t.getNameWithPostfix(k);if(N.imageName=G,N.sourceImage=this._spriteFrameMap[G],!N.sourceImage){var V=t.getShortName(k);N.imageName=V,N.sourceImage=this._spriteFrameMap[V],N.sourceImage||(console.error("[error]: "+V+" not find in ["+Object.keys(this._spriteFrameMap).join(", ")+"]"),J(7221,k),console.warn("Please try asset type of "+k+" to 'sprite-frame'"))}}N.spacing=w,N.margin=I,N._tileSize.width=D.width,N._tileSize.height=D.height,this.setTilesets(N)}if(C=b&&b[L]){this.parentGID=B+(parseInt(C.getAttribute("id"))||0);var U=C.getElementsByTagName("image");C.hasAttribute("x")&&C.hasAttribute("y")&&(N.imageOffset=new yn(parseFloat(C.getAttribute("x"))||0,parseFloat(C.getAttribute("y"))||0));var z=C.hasAttribute("width")&&C.hasAttribute("height");if(z&&(N._tileSize.width=parseFloat(C.getAttribute("width"))||0,N._tileSize.height=parseFloat(C.getAttribute("height"))||0),U&&U.length>0){var H=U[0],W=H.getAttribute("source");if(W=W.replace(/\\/g,"/"),N.imageName=W,N.imageSize.width=parseFloat(H.getAttribute("width"))||0,N.imageSize.height=parseFloat(H.getAttribute("height"))||0,z||(N._tileSize.width=N.imageSize.width,N._tileSize.height=N.imageSize.height),N.sourceImage=this._spriteFrameMap[W],!N.sourceImage){var X=t.getNameWithPostfix(W);if(N.imageName=X,N.sourceImage=this._spriteFrameMap[X],!N.sourceImage){var Y=t.getShortName(W);N.imageName=Y,N.sourceImage=this._spriteFrameMap[Y],N.sourceImage||(J(7221,W),console.warn("Please try asset type of "+W+" to 'sprite-frame'"))}}N.firstGid=this.parentGID&Xat.FLIPPED_MASK}var q=(Xat.FLIPPED_MASK&this.parentGID)>>>0;this._tileProperties.set(q,rot(C));var K=C.getElementsByTagName("animation");if(K&&K.length>0){var Q=K[0].getElementsByTagName("frame"),Z={frames:[],dt:0,frameIdx:0};this._tileAnimations.set(q,Z);for(var $=Z.frames,tt=0;tt<Q.length;tt++){var et=Q[tt],it=B+(parseInt(et.getAttribute("tileid"))||0),nt=parseFloat(et.getAttribute("duration"))||0;$.push({tileid:it,duration:nt/1e3,grid:null})}}}}}}}var rt=r.childNodes;for(n=0;n<rt.length;n++){var st=rt[n];if(!this._shouldIgnoreNode(st)){if("imagelayer"===st.nodeName){var at=this._parseImageLayer(st);at&&this.setImageLayers(at)}if("layer"===st.nodeName){var ot=this._parseLayer(st);this.setLayers(ot)}if("objectgroup"===st.nodeName){var ht=this._parseObjectGroup(st);this.setObjectGroups(ht)}}}return r},e._shouldIgnoreNode=function(t){return 3===t.nodeType||8===t.nodeType||4===t.nodeType},e._parseImageLayer=function(t){var e=t.getElementsByTagName("image");if(!e||0===e.length)return null;var i=new tot;i.name=t.getAttribute("name"),i.offset.x=parseFloat(t.getAttribute("offsetx"))||0,i.offset.y=parseFloat(t.getAttribute("offsety"))||0;var n=t.getAttribute("visible");i.visible=!("0"===n);var r=t.getAttribute("opacity");i.opacity=r?Math.round(255*parseFloat(r)):255;var s=t.getAttribute("tintcolor");i.tintColor=s?not(s):null;var a=e[0],o=a.getAttribute("source");return i.sourceImage=this._imageLayerSPF[o],i.width=parseInt(a.getAttribute("width"))||0,i.height=parseInt(a.getAttribute("height"))||0,i.trans=not(a.getAttribute("trans")),i.sourceImage?i:(J(7221,o),console.warn("Please try asset type of "+o+" to 'sprite-frame'"),null)},e._parseLayer=function(t){var e=t.getElementsByTagName("data")[0],i=new $at;i.name=t.getAttribute("name");var n=new An(0,0);n.width=parseFloat(t.getAttribute("width")),n.height=parseFloat(t.getAttribute("height")),i.layerSize=n;var r=t.getAttribute("visible");i.visible=!("0"===r);var s=t.getAttribute("opacity");i.opacity=s?Math.round(255*parseFloat(s)):255,i.offset=new yn(parseFloat(t.getAttribute("offsetx"))||0,parseFloat(t.getAttribute("offsety"))||0);var a=t.getAttribute("tintcolor");i.tintColor=a?not(a):null;for(var o="",h=0;h<e.childNodes.length;h++)o+=e.childNodes[h].nodeValue;o=o.trim();var u,l=e.getAttribute("compression"),c=e.getAttribute("encoding");if(l&&"gzip"!==l&&"zlib"!==l)return j(7218),null;switch(l){case"gzip":u=T7.unzipBase64AsArray(o,4);break;case"zlib":u=function(t){if(t.length%4!=0)return null;for(var e=t.length/4,i=window.Uint32Array?new Uint32Array(e):[],n=0;n<e;n++){var r=4*n;i[n]=t[r]+256*t[r+1]+65536*t[r+2]+t[r+3]*(1<<24)}return i}(new f6.Inflate(T7.Base64.decodeAsArray(o,1)).decompress());break;case null:case"":if("base64"===c)u=T7.Base64.decodeAsArray(o,4);else if("csv"===c){u=[];for(var _=o.split(","),f=0;f<_.length;f++)u.push(parseInt(_[f]))}else{var d=e.getElementsByTagName("tile");u=[];for(var p=0;p<d.length;p++)u.push(parseInt(d[p].getAttribute("gid")))}break;default:this.layerAttrs===$at.ATTRIB_NONE&&j(7219)}return u&&(i.tiles=new Uint32Array(u)),i.properties=rot(t),i},e._parseObjectGroup=function(t){var e=new Zat;e.name=t.getAttribute("name")||"",e.offset=new yn(parseFloat(t.getAttribute("offsetx")),parseFloat(t.getAttribute("offsety")));var i=t.getAttribute("opacity");e.opacity=i?Math.round(255*parseFloat(i)):255;var n=t.getAttribute("tintcolor");e.tintColor=n?not(n):null;var r=t.getAttribute("visible");r&&0===parseInt(r)&&(e.visible=!1);var s=t.getAttribute("color");s&&e.color.fromHEX(s);var a=t.getAttribute("draworder");a&&(e.draworder=a),e.setProperties(rot(t));var o=t.getElementsByTagName("object");if(o){for(var h=0;h<o.length;h++){var u=o[h],l={};l.id=u.getAttribute("id")||h,l.name=u.getAttribute("name")||"",l.width=parseFloat(u.getAttribute("width"))||0,l.height=parseFloat(u.getAttribute("height"))||0,l.x=parseFloat(u.getAttribute("x"))||0,l.y=parseFloat(u.getAttribute("y"))||0,l.rotation=parseFloat(u.getAttribute("rotation"))||0,rot(u,l);var c=u.getAttribute("visible");l.visible=!(c&&0===parseInt(c));var _=u.getElementsByTagName("text");if(_&&_.length>0){var f=_[0];l.type=Kat.TEXT,l.wrap="1"===f.getAttribute("wrap"),l.color=not(f.getAttribute("color")),l.halign=eot(f.getAttribute("halign")),l.valign=iot(f.getAttribute("valign")),l.pixelsize=parseInt(f.getAttribute("pixelsize"))||16,l.text=f.childNodes[0].nodeValue}var d=u.getAttribute("gid");d&&(l.gid=parseInt(d),l.type=Kat.IMAGE);var p=u.getElementsByTagName("ellipse");p&&p.length>0&&(l.type=Kat.ELLIPSE);var m=u.getElementsByTagName("polygon");if(m&&m.length>0){l.type=Kat.POLYGON;var g=m[0].getAttribute("points");g&&(l.points=this._parsePointsString(g))}var y=u.getElementsByTagName("polyline");if(y&&y.length>0){l.type=Kat.POLYLINE;var v=y[0].getAttribute("points");v&&(l.polylinePoints=this._parsePointsString(v))}l.type||(l.type=Kat.RECT),e.objects.push(l)}"index"!==a&&e.objects.sort((function(t,e){return t.y-e.y}))}return e},e._parsePointsString=function(t){if(!t)return null;for(var e=[],i=t.split(" "),n=0;n<i.length;n++){var r=i[n].split(",");e.push({x:parseFloat(r[0]),y:parseFloat(r[1])})}return e},e.setTileAnimations=function(t){this._tileAnimations=t},e.getTileAnimations=function(){return this._tileAnimations},e.getTileProperties=function(){return this._tileProperties},e.setTileProperties=function(t){this._tileProperties=t},e.getCurrentString=function(){return this.currentString},e.setCurrentString=function(t){this.currentString=t},t.getNameWithPostfix=function(t){var e=(t=t.replace(/\\/g,"/")).lastIndexOf("/")+1,i=t.length;return t.substring(e,i)},t.getShortName=function(t){var e=(t=t.replace(/\\/g,"/")).lastIndexOf("/")+1,i=t.lastIndexOf(".");return i=i<0?t.length:i,t.substring(e,i)},n(t,[{key:"mapSize",get:function(){return this._mapSize}},{key:"tileSize",get:function(){return this._tileSize}},{key:"mapWidth",get:function(){return this._mapSize.width},set:function(t){this._mapSize.width=t}},{key:"mapHeight",get:function(){return this._mapSize.height},set:function(t){this._mapSize.height=t}},{key:"tileWidth",get:function(){return this._tileSize.width},set:function(t){this._tileSize.width=t}},{key:"tileHeight",get:function(){return this._tileSize.height},set:function(t){this._tileSize.height=t}}]),t}(),vot=t("fe",(sot=Is("cc.TiledTile"),aot=Bs($F),oot=ha(je),hot=ha(je),uot=ha(je),lot=ha(je),cot=ha(je),sot(_ot=aot((fot=function(t){function e(){var e;return(e=t.call(this)||this)._layer=null,e._x=dot&&dot(),e._y=pot&&pot(),e}s(e,t);var i=e.prototype;return i.onEnable=function(){var t=this.node.parent;this._layer=t.getComponent("cc.TiledLayer"),this.node.on(zp.TRANSFORM_CHANGED,this._updatePosition,this),this.node.on(zp.SIZE_CHANGED,this._updatePosition,this),this._resetTile(),this.updateInfo()},i.onDisable=function(){this._resetTile(),this.node.off(zp.TRANSFORM_CHANGED,this._updatePosition,this),this.node.off(zp.SIZE_CHANGED,this._updatePosition,this)},i._resetTile=function(){this._layer&&this._layer.getTiledTileAt(this._x,this._y)===this&&this._layer.setTiledTileAt(this._x,this._y,null)},i.updateInfo=function(){if(this._layer){var t=this._x,e=this._y;if(this._layer.getTiledTileAt(t,e))k("There is already a TiledTile at [%s, %s]",t,e);else{var i=this._layer.getPositionAt(t,e);this.node.setPosition(i.x,i.y),this._layer.setTiledTileAt(t,e,this),this._layer.markForUpdateRenderData()}}},i._updatePosition=function(){this._layer.markForUpdateRenderData()},n(e,[{key:"x",get:function(){return this._x},set:function(t){t!==this._x&&(this._layer&&this._layer.isInvalidPosition(t,this._y)?k("Invalid x, the valid value is between [%s] ~ [%s]",0,this._layer.layerSize.width):(this._resetTile(),this._x=t,this.updateInfo()))}},{key:"y",get:function(){return this._y},set:function(t){t!==this._y&&(this._layer&&this._layer.isInvalidPosition(this._x,t)?k("Invalid y, the valid value is between [%s] ~ [%s]",0,this._layer.layerSize.height):(this._resetTile(),this._y=t,this.updateInfo()))}},{key:"grid",get:function(){return this._layer?this._layer.getTileGIDAt(this._x,this._y):0},set:function(t){this._layer&&this._layer.setTileGIDAt(t,this._x,this._y)}}]),e}(Vd),dot=Ss(fot.prototype,"_x",[oot],(function(){return 0})),pot=Ss(fot.prototype,"_y",[hot],(function(){return 0})),p(fot.prototype,"x",[uot],Object.getOwnPropertyDescriptor(fot.prototype,"x"),fot.prototype),p(fot.prototype,"y",[lot],Object.getOwnPropertyDescriptor(fot.prototype,"y"),fot.prototype),p(fot.prototype,"grid",[cot],Object.getOwnPropertyDescriptor(fot.prototype,"grid"),fot.prototype),_ot=fot))||_ot)||_ot));function Sot(t,e,i){var n=i||t.sourceImage,r=n.texture,s=t.collection;if(!t.imageSize.width||!t.imageSize.height){var a=t.sourceImage;t.imageSize.width=a.width,t.imageSize.height=a.height}var o=t.imageSize.width,h=t.imageSize.height,u=t._tileSize.width,l=t._tileSize.height,c=n.width,_=n.height,f=t.spacing,d=t.margin,p=1;if(!s){var m=Math.floor((o-2*d+f)/(u+f)),g=Math.floor((h-2*d+f)/(l+f));p=Math.max(1,g*m)}for(var y=t.firstGid,v=null,S=!!e.get(y),A=t.firstGid+p,T=y;T<A&&(S&&!e.get(T)&&(S=!1),S||!e.get(T));++T){if(v={tileset:t,x:0,y:0,width:u,height:l,t:0,l:0,r:0,b:0,cx:0,cy:0,offsetX:0,offsetY:0,rotated:!1,gid:T,spriteFrame:n,texture:r},t.rectForGID(T,v),!i||p>1||t.imageOffset)if(i){v._name=i.name;var E=i.unbiasUV[0],b=i.rotated?i.unbiasUV[1]:i.unbiasUV[5];v.l=E+(v.x+.5)/c,v.t=b+(v.y+.5)/_,v.r=E+(v.x+v.width-.5)/c,v.b=b+(v.y+v.height-.5)/_,v._rect=new En(v.x,v.y,v.width,v.height)}else v.l=v.x/c,v.t=v.y/_,v.r=(v.x+v.width)/c,v.b=(v.y+v.height)/_,v._rect=new En(v.x,v.y,v.width,v.height);else i.rotated?(v._rotated=!0,v._name=i.name,v._rect=i.getRect(),v.l=i.unbiasUV[0],v.t=i.unbiasUV[1],v.r=i.unbiasUV[4],v.b=i.unbiasUV[3]):(v._name=i.name,v._rect=i.getRect(),v.l=i.unbiasUV[0],v.t=i.unbiasUV[5],v.r=i.unbiasUV[2],v.b=i.unbiasUV[1]);v.cx=(v.l+v.r)/2,v.cy=(v.t+v.b)/2,e.set(T,v)}}for(var Aot,Tot,Eot,bot,xot,Cot,Rot,wot,Iot,Bot,Dot,Pot,Oot,Mot,Not,Lot,Fot,kot,Got,Vot,Uot,zot,Hot,Wot,Xot,jot,Yot,qot,Kot,Jot,Qot,Zot,$ot=new fn,tht=new yn,eht=new Yi,iht=new Yi,nht={row:0,col:0},rht=t("fb",Is("cc.TiledUserNodeData")(mot=function(t){function e(){var e;return(e=t.call(this)||this)._index=-1,e._row=-1,e._col=-1,e._tiledLayer=null,e}return s(e,t),e}(Vd))||mot),sht=t("fc",Is("cc.TiledLayer")(got=function(t){s(i,t);var e=i.prototype;function i(){var e;return(e=t.call(this)||this)._userNodeGrid={},e._userNodeMap={},e._userNodeDirty=!1,e.tiledTiles=[],e._viewPort={x:-1,y:-1,width:-1,height:-1},e._cullingRect={leftDown:{row:-1,col:-1},rightTop:{row:-1,col:-1}},e._cullingDirty=!0,e._rightTop={row:-1,col:-1},e._layerInfo=null,e._mapInfo=null,e._topOffset=0,e._downOffset=0,e._leftOffset=0,e._rightOffset=0,e.tiles=[],e.vertices=[],e._verticesDirty=!0,e._layerName="",e._layerSize=void 0,e._minGID=void 0,e._maxGID=void 0,e._layerOrientation=null,e._opacity=void 0,e._tintColor=void 0,e.texGrids=null,e._textures=[],e._tilesets=[],e._leftDownToCenterX=0,e._leftDownToCenterY=0,e._hasTiledNodeGrid=!1,e._hasAniGrid=!1,e._animations=null,e._enableCulling=void 0,e.colorChanged=!1,e._properties=void 0,e.renderOrder=void 0,e._staggerAxis=void 0,e._staggerIndex=void 0,e._hexSideLength=void 0,e._mapTileSize=void 0,e._odd_even=void 0,e._diffX1=void 0,e._diffY1=void 0,e._useAutomaticVertexZ=void 0,e._vertexZvalue=void 0,e._offset=void 0,e._tiledDataArray=[],e._cameraNode=void 0,e._drawInfoList=[],e._tiledDataArrayIdx=0,e}return e.requestDrawInfo=function(t){return this._drawInfoList[t]||(this._drawInfoList[t]=new TF,this._drawInfoList[t].setDrawInfoType(dF.MIDDLEWARE)),this._drawInfoList[t]},e.hasTiledNode=function(){return this._hasTiledNodeGrid},e.hasAnimation=function(){return this._hasAniGrid},e.addUserNode=function(t){var e=t.getComponent(rht);return e?(k("CCTiledLayer:addUserNode node has been added"),!1):(e=t.addComponent(rht),t.parent=this.node,this._userNodeMap[t.uuid]=e,e._row=-1,e._col=-1,e._tiledLayer=this,this._nodeLocalPosToLayerPos(t.getPosition(),tht),this._positionToRowCol(tht.x,tht.y,nht),this._addUserNodeToGrid(e,nht),this._updateCullingOffsetByUserNode(t),t.on(zp.TRANSFORM_CHANGED,this._userNodePosChange,e),t.on(zp.SIZE_CHANGED,this._userNodeSizeChange,e),!0)},e.removeUserNode=function(t){var e=t.getComponent(rht);return e?(t.off(zp.TRANSFORM_CHANGED,this._userNodePosChange,e),t.off(zp.SIZE_CHANGED,this._userNodeSizeChange,e),this._removeUserNodeFromGrid(e),delete this._userNodeMap[t.uuid],t._removeComponent(e),e.destroy(),t.removeFromParent(),!0):(k("CCTiledLayer:removeUserNode node is not exist"),!1)},e.destroyUserNode=function(t){this.removeUserNode(t),t.destroy()},e._nodeLocalPosToLayerPos=function(t,e){e.x=t.x+this._leftDownToCenterX,e.y=t.y+this._leftDownToCenterY},e.getNodesByRowCol=function(t,e){var i=this._userNodeGrid[t];return i?i[e]:null},e.getNodesCountByRow=function(t){var e=this._userNodeGrid[t];return e?e.count:0},e._updateAllUserNode=function(){for(var t in this._userNodeGrid={},this._userNodeMap){var e=this._userNodeMap[t];this._nodeLocalPosToLayerPos(e.node.getPosition(),tht),this._positionToRowCol(tht.x,tht.y,nht),this._addUserNodeToGrid(e,nht),this._updateCullingOffsetByUserNode(e.node)}},e._updateCullingOffsetByUserNode=function(t){var e=t._uiProps.uiTransformComp.contentSize;this._topOffset<e.height&&(this._topOffset=e.height),this._downOffset<e.height&&(this._downOffset=e.height),this._leftOffset<e.width&&(this._leftOffset=e.width),this._rightOffset<e.width&&(this._rightOffset=e.width)},e._userNodeSizeChange=function(){var t=this.node,e=this._tiledLayer;e._updateCullingOffsetByUserNode(t),e._userNodeDirty=!0,e.markForUpdateRenderData()},e._userNodePosChange=function(){var t=this,e=t.node,i=t._tiledLayer;i._nodeLocalPosToLayerPos(e.getPosition(),tht),i._positionToRowCol(tht.x,tht.y,nht),i._limitInLayer(nht),nht.row===t._row&&nht.col===t._col||(i._removeUserNodeFromGrid(t),i._addUserNodeToGrid(t,nht))},e._removeUserNodeFromGrid=function(t){var e=t._row,i=t._col,n=t._index,r=this._userNodeGrid[e],s=r&&r[i];s&&(r.count--,s.count--,s.list[n]=null,s.count<=0&&(s.list.length=0,s.count=0)),t._row=-1,t._col=-1,t._index=-1,this._userNodeDirty=!0,this.markForUpdateRenderData()},e._limitInLayer=function(t){var e=t.row,i=t.col;e<0&&(t.row=0),e>this._rightTop.row&&(t.row=this._rightTop.row),i<0&&(t.col=0),i>this._rightTop.col&&(t.col=this._rightTop.col)},e._addUserNodeToGrid=function(t,e){var i=e.row,n=e.col,r=this._userNodeGrid[i]=this._userNodeGrid[i]||{count:0},s=r[n]=r[n]||{count:0,list:[]};t._row=i,t._col=n,t._index=s.list.length,r.count++,s.count++,s.list.push(t),this._userNodeDirty=!0},e.isUserNodeDirty=function(){return this._userNodeDirty},e.setUserNodeDirty=function(t){this._userNodeDirty=t},e._reinstallCamera=function(){var t=vN.root.batcher2D.getFirstRenderCamera(this.node),e=null==t?void 0:t.node;return this._cameraNode!==e&&(this._uninstallCamera(),e&&(e.on(zp.TRANSFORM_CHANGED,this.updateCulling,this),e.on(zp.SIZE_CHANGED,this.updateCulling,this),this._cameraNode=e)),t},e._uninstallCamera=function(){this._cameraNode&&(this._cameraNode.off(zp.TRANSFORM_CHANGED,this.updateCulling,this),this._cameraNode.off(zp.SIZE_CHANGED,this.updateCulling,this),delete this._cameraNode)},e.onEnable=function(){t.prototype.onEnable.call(this),this.node.on(zp.ANCHOR_CHANGED,this._syncAnchorPoint,this),this.node.on(zp.TRANSFORM_CHANGED,this.updateCulling,this),this.node.on(zp.SIZE_CHANGED,this.updateCulling,this),this.node.parent.on(zp.TRANSFORM_CHANGED,this.updateCulling,this),this.node.parent.on(zp.SIZE_CHANGED,this.updateCulling,this),this.markForUpdateRenderData(),this.scheduleOnce(this.updateCulling.bind(this))},e.onDisable=function(){var e,i;t.prototype.onDisable.call(this),null===(e=this.node.parent)||void 0===e||e.off(zp.SIZE_CHANGED,this.updateCulling,this),null===(i=this.node.parent)||void 0===i||i.off(zp.TRANSFORM_CHANGED,this.updateCulling,this),this.node.off(zp.SIZE_CHANGED,this.updateCulling,this),this.node.off(zp.TRANSFORM_CHANGED,this.updateCulling,this),this.node.off(zp.ANCHOR_CHANGED,this._syncAnchorPoint,this),this._uninstallCamera()},e._syncAnchorPoint=function(){var t=this.node,e=t._uiProps.uiTransformComp,i=t.getScale();this._leftDownToCenterX=e.width*e.anchorX*i.x,this._leftDownToCenterY=e.height*e.anchorY*i.y,this._cullingDirty=!0,this.markForUpdateRenderData()},e.getLayerName=function(){return this._layerName},e.setLayerName=function(t){this._layerName=t},e.getProperty=function(t){return this._properties[t]},e.getPositionAt=function(t,e){var i;switch(void 0!==e?(i=Math.floor(t),e=Math.floor(e)):(i=Math.floor(t.x),e=Math.floor(t.y)),this._layerOrientation){case Hat.ORTHO:return this._positionForOrthoAt(i,e);case Hat.ISO:return this._positionForIsoAt(i,e);case Hat.HEX:return this._positionForHexAt(i,e)}return null},e.isInvalidPosition=function(t,e){return t>=this._layerSize.width||e>=this._layerSize.height||t<0||e<0},e._positionForIsoAt=function(t,e){var i=0,n=0,r=Math.floor(t)+Math.floor(e)*this._layerSize.width,s=this.tiles[r];if(s){var a=(s&Xat.FLIPPED_MASK)>>>0,o=this.texGrids.get(a).tileset.tileOffset;i=o.x,n=o.y}return new yn(.5*this._mapTileSize.width*(this._layerSize.height+t-e-1)+i,.5*this._mapTileSize.height*(this._layerSize.width-t+this._layerSize.height-e-2)-n)},e._positionForOrthoAt=function(t,e){var i=0,n=0,r=Math.floor(t)+Math.floor(e)*this._layerSize.width,s=this.tiles[r];if(s){var a=(s&Xat.FLIPPED_MASK)>>>0,o=this.texGrids.get(a).tileset.tileOffset;i=o.x,n=o.y}return new yn(t*this._mapTileSize.width+i,(this._layerSize.height-e-1)*this._mapTileSize.height-n)},e._positionForHexAt=function(t,e){var i,n=this._mapTileSize.width,r=this._mapTileSize.height,s=this._layerSize.height,a=Math.floor(t)+Math.floor(e)*this._layerSize.width,o=(this.tiles[a]&Xat.FLIPPED_MASK)>>>0;i=this.texGrids.get(o)?this.texGrids.get(o).tileset.tileOffset:{x:0,y:0};var h=this._staggerIndex===Yat.STAGGERINDEX_ODD?1:-1,u=0,l=0,c=0,_=0;switch(this._staggerAxis){case jat.STAGGERAXIS_Y:c=0,e%2==1&&(c=n/2*h),u=t*n+c+i.x,l=(s-e-1)*(r-(r-this._hexSideLength)/2)-i.y;break;case jat.STAGGERAXIS_X:_=0,t%2==1&&(_=r/2*-h),u=t*(n-(n-this._hexSideLength)/2)+i.x,l=(s-e-1)*r+_-i.y}return new yn(u,l)},e.setTilesGIDAt=function(t,e,i,n){if(t&&0!==t.length&&!(n<=0)){i<0&&(i=0),e<0&&(e=0);for(var r=0,s=e+n,a=i;;a++)for(var o=e;o<s;o++){if(r>=t.length)return;this._updateTileForGID(t[r],o,a),r++}}},e.setTileGIDAt=function(t,e,i,n){var r=(t&Xat.FLIPPED_MASK)>>>0;if(e=Math.floor(e),i=Math.floor(i),this.isInvalidPosition(e,i))throw new Error("cc.TiledLayer.setTileGIDAt(): invalid position");this.tiles&&this._tilesets&&0!==this._tilesets.length?0!==r&&r<this._tilesets[0].firstGid?j(7239,t):(n=n||0,this._updateTileForGID((r|n)>>>0,e,i)):j(7238)},e._updateTileForGID=function(t,e,i){var n=0|e+i*this._layerSize.width;if(!(n>=this.tiles.length)&&t!==this.tiles[n]){var r=(t&Xat.FLIPPED_MASK)>>>0;this.texGrids.get(r)?(this.tiles[n]=t,this._updateVertex(e,i)):this.tiles[n]=0,this._cullingDirty=!0}},e.getTileGIDAt=function(t,e){if(this.isInvalidPosition(t,e))throw new Error("cc.TiledLayer.getTileGIDAt(): invalid position");if(!this.tiles)return j(7237),null;var i=Math.floor(t)+Math.floor(e)*this._layerSize.width;return(this.tiles[i]&Xat.FLIPPED_MASK)>>>0},e.getTileFlagsAt=function(t,e){if(this.isInvalidPosition(t,e))throw new Error("TiledLayer.getTileFlagsAt: invalid position");if(!this.tiles)return j(7240),null;var i=Math.floor(t)+Math.floor(e)*this._layerSize.width;return(this.tiles[i]&Xat.FLIPPED_ALL)>>>0},e.setCullingDirty=function(t){this._cullingDirty=t},e.isCullingDirty=function(){return this._cullingDirty},e.updateViewPort=function(t,e,i,n){if(this._viewPort.width!==i||this._viewPort.height!==n||this._viewPort.x!==t||this._viewPort.y!==e){this._viewPort.x=t,this._viewPort.y=e,this._viewPort.width=i,this._viewPort.height=n;var r=1;this._layerOrientation===Hat.ISO&&(r=2);var s=this._viewPort.x-this._offset.x+this._leftDownToCenterX,a=this._viewPort.y-this._offset.y+this._leftDownToCenterY,o=s-this._leftOffset,h=a-this._downOffset,u=s+i+this._rightOffset,l=a+n+this._topOffset,c=this._cullingRect.leftDown,_=this._cullingRect.rightTop;o<0&&(o=0),h<0&&(h=0),this._positionToRowCol(o,h,nht),nht.row-=r,nht.col-=r,nht.row=nht.row>0?nht.row:0,nht.col=nht.col>0?nht.col:0,nht.row===c.row&&nht.col===c.col||(c.row=nht.row,c.col=nht.col,this._cullingDirty=!0),u<0||l<0?(nht.row=-1,nht.col=-1):(this._positionToRowCol(u,l,nht),nht.row++,nht.col++),nht.row===_.row&&nht.col===_.col||(_.row=nht.row,_.col=nht.col,this._cullingDirty=!0),this._cullingDirty&&this.markForUpdateRenderData()}},e._positionToRowCol=function(t,e,i){var n=this._mapTileSize.width,r=this._mapTileSize.height,s=.5*n,a=.5*r,o=0,h=0,u=0,l=0,c=this._staggerAxis;switch(this._layerOrientation){case Hat.ORTHO:h=Math.floor(t/n),o=Math.floor(e/r);break;case Hat.ISO:h=Math.floor(t/s),o=Math.floor(e/a);break;case Hat.HEX:c===jat.STAGGERAXIS_Y?(u=(o=Math.floor(e/(r-this._diffY1)))%2==1?s*this._odd_even:0,h=Math.floor((t-u)/n)):(l=(h=Math.floor(t/(n-this._diffX1)))%2==1?a*-this._odd_even:0,o=Math.floor((e-l)/r))}return i.row=o,i.col=h,i},e.updateCulling=function(){if(this._enableCulling){this.node.updateWorldTransform(),fn.invert($ot,this.node.getWorldMatrix());var t=this._reinstallCamera();t&&(eht.x=0,eht.y=0,eht.z=0,iht.x=t.width,iht.y=t.height,iht.z=0,t.screenToWorld(eht,eht),t.screenToWorld(iht,iht),Yi.transformMat4(eht,eht,$ot),Yi.transformMat4(iht,iht,$ot),this.updateViewPort(eht.x,eht.y,iht.x-eht.x,iht.y-eht.y))}},e.getLayerOrientation=function(){return this._layerOrientation},e.getProperties=function(){return this._properties},e._updateVertex=function(t,e){var i=Xat.FLIPPED_MASK,n=this.vertices,r=this._layerOrientation,s=this.tiles;if(s){var a,o,h,u,l=this._rightTop,c=this._mapTileSize.width,_=this._mapTileSize.height,f=.5*c,d=.5*_,p=this._layerSize.height,m=this._layerSize.width,g=this.texGrids,y=0,v=0;r===Hat.HEX&&(a=this._staggerAxis,o=this._diffX1,h=this._diffY1,u=this._odd_even);var S,A,T,E=0,b=0,x=0,C=0,R=e*m+t;S=(s[R]&i)>>>0;var w=g.get(S);if(w){switch(this._animations.get(S)&&(this._hasAniGrid=this._hasAniGrid||!0),r){case Hat.ORTHO:y=(E=t)*c,v=(b=p-e-1)*_;break;case Hat.ISO:y=f*(E=p+t-e-1),v=d*(b=p+m-t-e-2);break;case Hat.HEX:y=t*(c-o)+(a===jat.STAGGERAXIS_Y&&e%2==1?f*u:0),v=(p-e-1)*(_-h)+(a===jat.STAGGERAXIS_X&&t%2==1?d*-u:0),E=t,b=p-e-1}var I=n[b]=n[b]||{minCol:0,maxCol:0},B=I[E]=I[E]||{left:0,bottom:0,index:0};I.minCol>E&&(I.minCol=E),I.maxCol<E&&(I.maxCol=E),l.row<b&&(l.row=b,r===Hat.ISO&&(l.row+=1)),l.col<E&&(l.col=E,r===Hat.ISO&&(l.col+=1));var D=w.tileset.tileOffset;y+=this._offset.x+D.x+w.offsetX,v+=this._offset.y-D.y-w.offsetY,x=(x=-D.y+w.tileset._tileSize.height-_)<0?0:x,A=D.y<0?0:D.y,T=-D.x<0?0:-D.x,C=(C=D.x+w.tileset._tileSize.width-c)<0?0:C,this._rightOffset<T&&(this._rightOffset=T),this._leftOffset<C&&(this._leftOffset=C),this._topOffset<A&&(this._topOffset=A),this._downOffset<x&&(this._downOffset=x),B.left=y,B.bottom=v,B.index=R,this._cullingDirty=!0}}},e._updateVertices=function(){if(this.vertices.length=0,this.tiles){var t=this._rightTop;t.row=-1,t.col=-1;var e=this._layerSize.height,i=this._layerSize.width;this._topOffset=0,this._downOffset=0,this._leftOffset=0,this._rightOffset=0,this._hasAniGrid=!1;for(var n=0;n<e;++n)for(var r=0;r<i;++r)this._updateVertex(r,n);this._verticesDirty=!1}},e.getTiledTileAt=function(t,e,i){if(this.isInvalidPosition(t,e))throw new Error("TiledLayer.getTiledTileAt: invalid position");if(!this.tiles)return j(7236),null;var n=Math.floor(t)+Math.floor(e)*this._layerSize.width,r=this.tiledTiles[n];if(!r&&i){var s=new Pm;return(r=s.addComponent(vot))._x=t,r._y=e,r._layer=this,r.updateInfo(),s.parent=this.node,r}return r},e.setTiledTileAt=function(t,e,i){if(this.isInvalidPosition(t,e))throw new Error("TiledLayer.setTiledTileAt: invalid position");if(!this.tiles)return j(7236),null;var n=Math.floor(t)+Math.floor(e)*this._layerSize.width;return this.tiledTiles[n]=i,this._cullingDirty=!0,this._hasTiledNodeGrid=!!i||this.tiledTiles.some((function(t){return!!t})),i},e.getTexture=function(t){return t=t||0,this._textures&&t>=0&&this._textures.length>t?this._textures[t]:null},e.getTextures=function(){return this._textures},e.setTexture=function(t){this.setTextures([t])},e.setTextures=function(t){this._textures=t,this.markForUpdateRenderData()},e.getLayerSize=function(){return this._layerSize},e.getMapTileSize=function(){return this._mapTileSize},e.getTileSet=function(t){return t=t||0,this._tilesets&&t>=0&&this._tilesets.length>t?this._tilesets[t]:null},e.getTileSets=function(){return this._tilesets},e.setTileSet=function(t){this.setTileSets([t])},e.setTileSets=function(t){this._tilesets=t;var e=this._textures=[],i=this.texGrids;i.clear();for(var n=0;n<t.length;n++){var r=t[n];r&&(e[n]=r.sourceImage)}for(var s=0,a=t.length;s<a;++s){var o=t[s];o&&Sot(o,i,o.sourceImage)}this._prepareToRender()},e.init=function(t,e,i,n,r){this._cullingDirty=!0,this._layerInfo=t,this._mapInfo=e;var s=t.layerSize;this._layerName=t.name,this.tiles=t.tiles,this._properties=t.properties,this._layerSize=s,this._minGID=t.minGID,this._maxGID=t.maxGID,this._opacity=t.opacity,t.tintColor&&(this._tintColor=t.tintColor),this.renderOrder=e.renderOrder,this._staggerAxis=e.getStaggerAxis(),this._staggerIndex=e.getStaggerIndex(),this._hexSideLength=e.getHexSideLength(),this._animations=e.getTileAnimations(),this._tilesets=i,this._textures=n,this.texGrids=r,this._layerOrientation=e.orientation,this._mapTileSize=e.getTileSize();var a=this._mapTileSize.width,o=this._mapTileSize.height,h=this._layerSize.width,u=this._layerSize.height;if(this._layerOrientation===Hat.HEX){var l=0,c=0,_=-2&a,f=-2&o;this._odd_even=this._staggerIndex===Yat.STAGGERINDEX_ODD?1:-1,this._staggerAxis===jat.STAGGERAXIS_X?(this._diffX1=(_-this._hexSideLength)/2,this._diffY1=0,l=(this._diffX1+this._hexSideLength)*h+this._diffX1,c=f*u+f/2):(this._diffX1=0,this._diffY1=(f-this._hexSideLength)/2,l=_*h+_/2,c=(this._diffY1+this._hexSideLength)*u+this._diffY1),this.node._uiProps.uiTransformComp.setContentSize(l,c)}else if(this._layerOrientation===Hat.ISO){var d=h+u;this.node._uiProps.uiTransformComp.setContentSize(.5*a*d,.5*o*d)}else this.node._uiProps.uiTransformComp.setContentSize(h*a,u*o);this._offset=new yn(t.offset.x,-t.offset.y),this._useAutomaticVertexZ=!1,this._vertexZvalue=0,this._syncAnchorPoint(),this._prepareToRender()},e._prepareToRender=function(){this._updateVertices(),this._updateAllUserNode()},e.requestTiledRenderData=function(){for(var t=this._tiledDataArray;t.length>0&&t[t.length-1].subNodes&&0===t[t.length-1].subNodes.length;)t.pop();if(t.length>0){var e=t[t.length-1];if(e.renderData&&0===e.renderData.vertexCount)return e}var i={renderData:null,texture:null};return this._tiledDataArray.push(i),i},e.requestSubNodesData=function(){var t=this._tiledDataArray;if(t.length>0&&t[t.length-1].subNodes&&0===t[t.length-1].subNodes.length)return t[t.length-1];var e={subNodes:[]};return this._tiledDataArray.push(e),e},e.destroyRenderData=function(){this._tiledDataArray.forEach((function(t){var e=t.renderData;e&&FF.remove(e)})),this._tiledDataArray.length=0,t.prototype.destroyRenderData.call(this)},e._flushAssembler=function(){var t=i.Assembler.getAssembler(this);this._assembler!==t&&(this._assembler=t,this._assembler.createData(this)),0===this._tiledDataArray.length&&(this.markForUpdateRenderData(),this._updateColor())},e._render=function(t){for(var e=0;e<this._tiledDataArray.length;e++){this._tiledDataArrayIdx=e;var i=this._tiledDataArray[e];if(i.subNodes)i.subNodes.forEach((function(e){e&&t.walk(e.node)}));else{var n=i;n.texture&&t.commitComp(this,n.renderData,n.texture,this._assembler,null)}}this.node._static=!0},e.createRenderEntity=function(){return new MF(EF.CROSSED)},e.fillIndicesBuffer=function(t,e){var i=t.chunk.meshBuffer.iData,n=t.chunk.meshBuffer.indexOffset;e.setIndexOffset(n);for(var r=t.chunk.vertexOffset,s=t.vertexCount/4,a=0;a<s;a+=1)i[n]=r,i[n+1]=r+1,i[n+2]=r+2,i[n+3]=r+2,i[n+4]=r+1,i[n+5]=r+3,n+=6,r+=4;t.chunk.meshBuffer.indexOffset=n,e.setIBCount(6*s)},e.prepareDrawData=function(){var t=this;this._drawInfoList.length=0;var e=this.renderEntity;e.clearDynamicRenderDrawInfos();var i=this._tiledDataArray,n=0;i.forEach((function(i){if(i.subNodes)i.subNodes.forEach((function(i){if(i){t._drawInfoList[n]||(t._drawInfoList[n]=new TF);var r=t._drawInfoList[n];r.setDrawInfoType(dF.SUB_NODE),r.setSubNode(i.node),e.setDynamicRenderDrawInfo(r,n),n++}}));else{var r=i;if(r.texture){t._drawInfoList[n]||(t._drawInfoList[n]=new TF);var s=t._drawInfoList[n];r.renderData.fillDrawInfoAttributes(s),s.setTexture(r.texture.getGFXTexture()),s.setSampler(r.texture.getGFXSampler()),s.setMaterial(t.getRenderMaterial(0)),t.fillIndicesBuffer(r.renderData,s),e.setDynamicRenderDrawInfo(s,n),n++}}}))},n(i,[{key:"cullingRect",get:function(){return this._cullingRect}},{key:"rightTop",get:function(){return this._rightTop}},{key:"layerSize",get:function(){return this._layerSize}},{key:"tiledDataArray",get:function(){return this._tiledDataArray}},{key:"leftDownToCenterX",get:function(){return this._leftDownToCenterX}},{key:"leftDownToCenterY",get:function(){return this._leftDownToCenterY}},{key:"enableCulling",get:function(){return this._enableCulling},set:function(t){this._enableCulling!==t&&(this._enableCulling=t,this._cullingDirty=!0,this.markForUpdateRenderData())}}]),i}(gk))||got),aht=t("fd",(Aot=Is("cc.TiledObjectGroup"),Tot=Bs($F),Eot=ha(qe),Aot(bot=Tot((p((xot=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._premultiplyAlpha=!1,e._groupName=void 0,e._positionOffset=void 0,e._mapInfo=void 0,e._properties=void 0,e._offset=void 0,e._opacity=void 0,e._tintColor=null,e._animations=void 0,e._hasAniObj=void 0,e._texGrids=void 0,e.aniObjects=void 0,e._objects=[],e}s(e,t);var i=e.prototype;return i.getPositionOffset=function(){return this._positionOffset},i.getProperties=function(){return this._properties},i.getGroupName=function(){return this._groupName},i.getProperty=function(t){return this._properties[t.toString()]},i.getObject=function(t){for(var e=0,i=this._objects.length;e<i;e++){var n=this._objects[e];if(n&&n.name===t)return n}return null},i.getObjects=function(){return this._objects},i._init=function(t,e,i){var n=Xat.FLIPPED_MASK,r=Xat.HORIZONTAL,s=Xat.VERTICAL;this._groupName=t.name,this._positionOffset=t.offset,this._mapInfo=e,this._properties=t.getProperties(),this._offset=new yn(t.offset.x,-t.offset.y),this._opacity=t.opacity,t.tintColor&&(this._tintColor=t.tintColor),this._texGrids=i,this._animations=e.getTileAnimations(),this.aniObjects=[],this._hasAniObj=!1;var a=e.mapSize,o=e.tileSize,h=0,u=0,l=new Zi,c=Hat.ISO===e.orientation;if(e.orientation===Hat.HEX)e.getStaggerAxis()===jat.STAGGERAXIS_X?(u=o.height*(a.height+.5),h=(o.width+e.getHexSideLength())*Math.floor(a.width/2)+o.width*(a.width%2)):(h=o.width*(a.width+.5),u=(o.height+e.getHexSideLength())*Math.floor(a.height/2)+o.height*(a.height%2));else if(c){var _=a.width+a.height;h=.5*o.width*_,u=.5*o.height*_}else h=a.width*o.width,u=a.height*o.height;var f=this.node._uiProps.uiTransformComp;f.setContentSize(h,u);for(var d=h*f.anchorX,p=u*(1-f.anchorY),m=t.objects,g={},y=0,v=m.length;y<v;y++){var S=m[y],A=S.type;S.offset=new yn(S.x,S.y);var T=S.points||S.polylinePoints;if(T)for(var E=0;E<T.length;E++)T[E].y*=-1;if(c){var b=S.x/o.height,x=S.y/o.height;S.x=.5*o.width*(a.height+b-x),S.y=.5*o.height*(a.width+a.height-b-x)}else S.y=u-S.y;if(A===Kat.TEXT){var C="text"+S.id;g[C]=!0;var R=this.node.getChildByName(C);R||(R=new Pm),R.setRotationFromEuler(0,0,-S.rotation),R.setPosition(S.x-d,S.y-p),R.name=C,R.parent=this.node,R.setSiblingIndex(y),R.layer=this.node.layer;var w=R.getComponent($k);w||(w=R.addComponent($k));var I=R._uiProps.uiTransformComp;R.active=S.visible,I.anchorX=0,I.anchorY=1,this._tintColor?(l.set(this._tintColor),l.a*=this._opacity/255,w.color.set(l)):w.color.a*=this._opacity/255,w.overflow=$k.Overflow.SHRINK,w.lineHeight=S.height,w.string=S.text,w.horizontalAlign=S.halign,w.verticalAlign=S.valign,w.fontSize=S.pixelsize,I.setContentSize(S.width,S.height)}else if(A===Kat.IMAGE){var B=S.gid,D=(B&n)>>>0,P=i.get(D);if(!P)continue;var O=P.tileset,M="img"+S.id;g[M]=!0;var N=this.node.getChildByName(M);S.width=S.width||P.width,S.height=S.height||P.height,N&&N._objFlags&ba.Flags.HideInHierarchy&&(N.removeFromParent(),N.hideFlags|=ba.Flags.DontSave,N.destroy(),N=null),N||(N=new Pm),this._animations.get(D)&&(this.aniObjects.push({object:S,imgNode:N,gridGID:D}),this._hasAniObj=!0);var L=O.tileOffset.x,F=O.tileOffset.y;N.active=S.visible,N.setRotationFromEuler(0,0,-S.rotation),N.setPosition(S.x-d,S.y-p),N.name=M,N.parent=this.node,N.setSiblingIndex(y),N.layer=this.node.layer;var k=N.getComponent(ZV);k||(k=N.addComponent(ZV));var G=N._uiProps.uiTransformComp;c?(G.anchorX=.5+L/S.width,G.anchorY=F/S.height):(G.anchorX=L/S.width,G.anchorY=F/S.height),this._tintColor?(l.set(this._tintColor),l.a*=this._opacity/255,k.color.set(l)):k.color.a*=this._opacity/255,k.sizeMode=ZV.SizeMode.CUSTOM;var V=this._premultiplyAlpha?zl.ONE:zl.SRC_ALPHA;k.srcBlendFactor!==V&&(k.srcBlendFactor=V,k.material&&k._updateBlendFunc());var U=P.spriteFrame;U=U?U.clone():new lL,(B&r)>>>0&&(U.flipUVX=!U.flipUVX),(B&s)>>>0&&(U.flipUVY=!U.flipUVY),U.rotated=P._rotated,U.rect=P._rect,k.spriteFrame=U,G.setContentSize(S.width,S.height),k.markForUpdateRenderData()}}this._objects=m;for(var z=this.node.children,H=/^(?:img|text)\d+$/,W=0,X=z.length;W<X;W++){var j=z[W],Y=j.name;H.test(Y)&&!g[Y]&&j.destroy()}},i.update=function(){if(this._hasAniObj)for(var t=this.aniObjects,e=this._texGrids,i=Hat.ISO===this._mapInfo.orientation,n=0,r=t.length;n<r;n++){var s=t[n],a=s.gridGID,o=e.get(a);if(o){var h=o.tileset,u=s.object,l=s.imgNode,c=h.tileOffset.x,_=h.tileOffset.y,f=l._uiProps.uiTransformComp;i?(f.anchorX=.5+c/u.width,f.anchorY=_/u.height):(f.anchorX=c/u.width,f.anchorY=_/u.height);var d=l.getComponent(ZV),p=d.spriteFrame;p.rotated=o._rotated,p.rect=o._rect,d.spriteFrame=p,d.markForUpdateRenderData()}}},n(e,[{key:"premultiplyAlpha",get:function(){return this._premultiplyAlpha},set:function(t){this._premultiplyAlpha=t}},{key:"offset",get:function(){return this._offset}}]),e}(Vd)).prototype,"premultiplyAlpha",[Eot],Object.getOwnPropertyDescriptor(xot.prototype,"premultiplyAlpha"),xot.prototype),bot=xot))||bot)||bot)),oht=t("fa",(Cot=Is("cc.TiledMapAsset"),Rot=ha([qv]),wot=ha([Ke]),Iot=ha([lL]),Bot=ha([lL]),Dot=ha([Ke]),Pot=ha([Ke]),Oot=ha([An]),Cot((Not=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).tmxXmlStr=Lot&&Lot(),e.tsxFiles=Fot&&Fot(),e.tsxFileNames=kot&&kot(),e.spriteFrames=Got&&Got(),e.imageLayerSpriteFrame=Vot&&Vot(),e.imageLayerSpriteFrameNames=Uot&&Uot(),e.spriteFrameNames=zot&&zot(),e.spriteFrameSizes=Hot&&Hot(),e}return s(e,t),e}(zf),Lot=Ss(Not.prototype,"tmxXmlStr",[ks],(function(){return""})),Fot=Ss(Not.prototype,"tsxFiles",[ks,Rot],(function(){return[]})),kot=Ss(Not.prototype,"tsxFileNames",[ks,wot],(function(){return[]})),Got=Ss(Not.prototype,"spriteFrames",[ks,Iot],(function(){return[]})),Vot=Ss(Not.prototype,"imageLayerSpriteFrame",[ks,Bot],(function(){return[]})),Uot=Ss(Not.prototype,"imageLayerSpriteFrameNames",[ks,Dot],(function(){return[]})),zot=Ss(Not.prototype,"spriteFrameNames",[ks,Pot],(function(){return[]})),Hot=Ss(Not.prototype,"spriteFrameSizes",[ks,Oot],(function(){return[]})),Mot=Not))||Mot)),hht=(t("f9",(Wot=Is("cc.TiledMap"),Xot=Bs($F),jot=ha(oht),Wot(Yot=Xot(((Zot=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._texGrids=new Map,e._textures=[],e._tilesets=[],e._animations=new Map,e._imageLayers=[],e._layers=[],e._groups=[],e._images=[],e._properties={},e._tileProperties=new Map,e._mapInfo=null,e._mapSize=new An(0,0),e._tileSize=new An(0,0),e._mapOrientation=Hat.ORTHO,e._isApplied=!1,e._tmxFile=Kot&&Kot(),e._enableCulling=Jot&&Jot(),e.cleanupImageCache=Qot&&Qot(),e}s(e,t);var i=e.prototype;return i.getMapSize=function(){return this._mapSize},i.getTileSize=function(){return this._tileSize},i.getMapOrientation=function(){return this._mapOrientation},i.getObjectGroups=function(){return this._groups},i.getObjectGroup=function(t){for(var e=this._groups,i=0,n=e.length;i<n;i++){var r=e[i];if(r&&r.getGroupName()===t)return r}return null},i.getProperties=function(){return this._properties},i.getLayers=function(){return this._layers},i.getLayer=function(t){for(var e=this._layers,i=0,n=e.length;i<n;i++){var r=e[i];if(r&&r.getLayerName()===t)return r}return null},i._changeLayer=function(t,e){for(var i=this._layers,n=0,r=i.length;n<r;n++){var s=i[n];if(s&&s.getLayerName()===t)return void(i[n]=e)}},i.getProperty=function(t){return this._properties[t.toString()]},i.getPropertiesForGID=function(t){return this._tileProperties.get(t)},i.__preload=function(){this._tmxFile&&!1===this._isApplied&&(this._applyFile(),this._isApplied=!0)},i.onEnable=function(){this.node.on(zp.ANCHOR_CHANGED,this._syncAnchorPoint,this)},i.onDisable=function(){this.node.off(zp.ANCHOR_CHANGED,this._syncAnchorPoint,this)},i._applyFile=function(){var t=[],e={},i=this._tmxFile;if(i){for(var n=i.spriteFrameNames,r=i.spriteFrameSizes,s=i.spriteFrames,a={},o={},h=0;h<n.length;++h){var u=n[h];o[u]=r[h],t[h]=s[h];var l=t[h];l&&(e[l.name]=l,a[u]=l)}var c={},_=i.imageLayerSpriteFrame;n=i.imageLayerSpriteFrameNames;for(var f=0;f<_.length;++f)c[n[f]]=_[f];for(var d=i.tsxFileNames,p=i.tsxFiles,m={},g=0;g<d.length;++g)d[g].length>0&&(m[d[g]]=p[g].text);var y=new yot(i.tmxXmlStr,m,a,o,c),v=y.getTilesets();v&&0!==v.length||j(7241),this._buildWithMapInfo(y)}else this._releaseMapInfo()},i._releaseMapInfo=function(){for(var t=this._layers,e=0,i=t.length;e<i;e++){var n,r;null===(n=t[e].node.parent)||void 0===n||n.off(zp.SIZE_CHANGED,t[e].updateCulling,t[e]),null===(r=t[e].node.parent)||void 0===r||r.off(zp.TRANSFORM_CHANGED,t[e].updateCulling,t[e]),t[e].node.removeFromParent(),t[e].node.destroy()}t.length=0;for(var s=this._groups,a=0,o=s.length;a<o;a++)s[a].node.removeFromParent(),s[a].node.destroy();s.length=0;for(var h=this._images,u=0,l=h.length;u<l;u++)h[u].removeFromParent(),h[u].destroy();h.length=0},i._syncAnchorPoint=function(){var t,e,i=this.node._uiProps.uiTransformComp.anchorPoint,n=this.node._uiProps.uiTransformComp.width*i.x,r=this.node._uiProps.uiTransformComp.height*(1-i.y);for(t=0,e=this._layers.length;t<e;t++)this._layers[t].node._uiProps.uiTransformComp.setAnchorPoint(i);for(t=0,e=this._groups.length;t<e;t++){var s=this._groups[t],a=s.node._uiProps.uiTransformComp;a.anchorX=.5,a.anchorY=.5;var o=s.offset.x-n+a.width*a.anchorX,h=s.offset.y+r-a.height*a.anchorY;s.node.setPosition(o,h)}for(t=0,e=this._images.length;t<e;t++){var u=this._images[t]._uiProps.uiTransformComp;u.anchorX=.5,u.anchorY=.5;var l=this._images[t]._offset.x-n+u.width*u.anchorX,c=this._images[t]._offset.y+r-u.height*u.anchorY;this._images[t].setPosition(l,c)}},i._fillAniGrids=function(t,e){for(var i,n=f(e.keys());!(i=n()).done;){var r=i.value,s=e.get(r);if(s)for(var a=s.frames,o=0;o<a.length;o++){var h=a[o];h.grid=t.get(h.tileid)}}},i._buildLayerAndGroup=function(){var t=this._tilesets,e=this._texGrids,i=this._animations;e.clear();for(var n=0,r=t.length;n<r;++n){var s=t[n];s&&(s.sourceImage?Sot(s,e,s.sourceImage):console.warn("Can't find the spriteFrame of tilesets "+n))}this._fillAniGrids(e,i);for(var a=this._layers,o=this._groups,h=this._images,u={},l=0,c=a.length;l<c;l++)u[a[l].node.name]=!0;for(var _=0,f=o.length;_<f;_++)u[o[_].node.name]=!0;for(var d=0,p=h.length;d<p;d++)u[h[d].name]=!0;a=this._layers=[],o=this._groups=[],h=this._images=[];var m=this._mapInfo,g=this.node,y=m.getAllChildren(),v=this._textures,S=0,A=0;if(y&&y.length>0)for(var T=0,E=y.length;T<E;T++){var b=y[T],x=b.name,C=this.node.getChildByName(x);if(u[x]=!1,C||((C=new Pm).name=x,C.layer=g.layer,g.addChild(C)),C.setSiblingIndex(T),C.active=b.visible,b instanceof $at){var R=C.getComponent(sht);R||(R=C.addComponent(sht)),R.init(b,m,t,v,e),R.enableCulling=this._enableCulling,b.ownTiles=!1,a.push(R)}else if(b instanceof Zat){var w=C.getComponent(aht);w||(w=C.addComponent(aht)),w._init(b,m,e),o.push(w)}else if(b instanceof tot){var I=b.sourceImage;C.layerInfo=b,C._offset=new yn(b.offset.x,-b.offset.y);var B=C.getComponent(ZV);B||(B=C.addComponent(ZV)),B.color.a*=b.opacity,B.spriteFrame=I;var D=I.width,P=I.height;I.original&&(D=I.originalSize.width,P=I.originalSize.height),C._uiProps.uiTransformComp.setContentSize(D,P),h.push(C)}S=Math.max(S,C._uiProps.uiTransformComp.width),A=Math.max(A,C._uiProps.uiTransformComp.height)}for(var O=g.children,M=0,N=O.length;M<N;M++){var L=O[M];u[L.name]&&L.destroy()}this.node._uiProps.uiTransformComp.setContentSize(S,A),this._syncAnchorPoint()},i._buildWithMapInfo=function(t){var e=this;this._mapInfo=t,this._mapSize=t.getMapSize(),this._tileSize=t.getTileSize(),this._mapOrientation=t.orientation,this._properties=t.properties,this._tileProperties=t.getTileProperties(),this._imageLayers=t.getImageLayers(),this._animations=t.getTileAnimations(),this._tilesets=t.getTilesets();var i=this._tilesets;this._textures.length=0;for(var n=[],r=0,s=i.length;r<s;++r){var a=i[r];a&&a.sourceImage&&(this._textures[r]=a.sourceImage,n.push(a.sourceImage))}for(var o=0;o<this._imageLayers.length;o++){var h=this._imageLayers[o];h&&h.sourceImage&&n.push(h.sourceImage)}this._buildLayerAndGroup(),this.cleanupImageCache&&this._textures.forEach((function(t){e.doCleanupImageCache(t)}))},i.doCleanupImageCache=function(t){t._image instanceof HTMLImageElement?t._image.src="":ul.hasFeature(ul.Feature.IMAGE_BITMAP)&&t._image instanceof ImageBitmap&&t._image.close&&t._image.close(),t._image=null},i.lateUpdate=function(t){for(var e,i=this._animations,n=this._texGrids,r=f(i.keys());!(e=r()).done;){var s=e.value,a=i.get(s),o=a.frames,h=o[a.frameIdx];a.dt+=t,h.duration<a.dt&&(a.dt=0,a.frameIdx++,a.frameIdx>=o.length&&(a.frameIdx=0),h=o[a.frameIdx]),n.set(s,h.grid)}for(var u=this.getLayers(),l=0,c=u.length;l<c;l++){var _=u[l];(_.hasAnimation()||_.node.hasChangedFlags)&&_.markForUpdateRenderData()}},n(e,[{key:"tmxAsset",get:function(){return this._tmxFile},set:function(t){this._tmxFile!==t&&(this._tmxFile=t,this._applyFile(),this._isApplied=!0)}},{key:"enableCulling",get:function(){return this._enableCulling},set:function(t){this._enableCulling=t;for(var e=this._layers,i=0;i<e.length;++i)e[i].enableCulling=t}}]),e}(Vd)).Orientation=Hat,Zot.Property=Wat,Zot.TileFlag=Xat,Zot.StaggerAxis=jat,Zot.StaggerIndex=Yat,Zot.TMXObjectType=Kat,Zot.RenderOrder=qat,Kot=Ss((qot=Zot).prototype,"_tmxFile",[ks],(function(){return null})),p(qot.prototype,"tmxAsset",[jot],Object.getOwnPropertyDescriptor(qot.prototype,"tmxAsset"),qot.prototype),Jot=Ss(qot.prototype,"_enableCulling",[ks],(function(){return!0})),Qot=Ss(qot.prototype,"cleanupImageCache",[ks],(function(){return!0})),Yot=qot))||Yot)||Yot)),Math.ceil(10922.5)),uht=[],lht=0;lht<4;lht++)uht.push(new Yi);var cht,_ht,fht,dht=new fn,pht=new Yi,mht={row:0,col:0},ght={x:0,y:0},yht={x:0,y:0},vht={x:0,y:0},Sht={x:0,y:0},Aht=0,Tht=0,Eht=0,bht=0,xht=null,Cht=null,Rht={ensureAccessor:function(){if(!Cht){var t=vN.root.device;vN.root.batcher2D,Cht=new vF(t,sF,this.vCount),vN.on(yN.EVENT_BEFORE_DRAW,(function(){Cht.reset()}))}},createData:function(){},fillBuffers:function(t){if(t&&0!==t.tiledDataArray.length){for(var e=t.tiledDataArray[t._tiledDataArrayIdx].renderData,i=e.chunk.meshBuffer.iData,n=e.chunk.meshBuffer.indexOffset,r=e.chunk.vertexOffset,s=e.vertexCount/4,a=0;a<s;a+=1)i[n]=r,i[n+1]=r+1,i[n+2]=r+2,i[n+3]=r+2,i[n+4]=r+1,i[n+5]=r+3,n+=6,r+=4;e.chunk.meshBuffer.indexOffset=n}},updateRenderData:function(t){if(t.updateCulling(),Tht=t.leftDownToCenterX,Eht=t.leftDownToCenterY,t.colorChanged||t.isCullingDirty()||t.isUserNodeDirty()||t.hasAnimation()||t.hasTiledNode()||t.node.hasChangedFlags){var e,i;if(t.colorChanged=!1,t.destroyRenderData(),t.enableCulling){var n=t.cullingRect;e=n.leftDown,i=n.rightTop}else e=mht,i=t.rightTop;switch(t.renderOrder){case qat.RightDown:Bht(e,i,-1,1,t);break;case qat.LeftDown:Bht(e,i,-1,-1,t);break;case qat.RightUp:Bht(e,i,1,1,t);break;case qat.LeftUp:default:Bht(e,i,1,-1,t)}t.setCullingDirty(!1),t.setUserNodeDirty(!1)}},updateColor:function(t){var e=t.color,i=new Float32Array(4);i[0]=e.r/255,i[1]=e.g/255,i[2]=e.b/255,i[3]=e.a/255;for(var n,r=f(t.tiledDataArray);!(n=r()).done;){var s=n.value;if(s.renderData)for(var a=s.renderData,o=a.vData,h=a.vertexStart,u=a.vertexCount;h<u;h++)o.set(i,9*h+5)}}};function wht(t,e){var i;t._rotated?(ght.x=t.r,ght.y=t.t,yht.x=t.l,yht.y=t.t,vht.x=t.r,vht.y=t.b,Sht.x=t.l,Sht.y=t.b):(ght.x=t.l,ght.y=t.t,yht.x=t.l,yht.y=t.b,vht.x=t.r,vht.y=t.t,Sht.x=t.r,Sht.y=t.b),(e&Xat.DIAGONAL)>>>0&&(i=yht,yht=vht,vht=i),(e&Xat.HORIZONTAL)>>>0&&(i=ght,ght=vht,vht=i,i=yht,yht=Sht,Sht=i),(e&Xat.VERTICAL)>>>0&&(i=ght,ght=yht,yht=i,i=vht,vht=Sht,Sht=i)}function Iht(){if(!(bht<1)&&xht){var t=4*bht,e=6*bht,i=_ht.requestTiledRenderData();i.renderData=FF.add(sF),i.texture=xht;var n=i.renderData;n.resize(t,e),n.chunk.vb.set(cht.subarray(0,9*t),0),bht=0,xht=null}}function Bht(t,e,i,n,r){if(!(e.row<0||e.col<0)){_ht=r;var s=r.node.worldMatrix;Aht=0;var a,o,h,u,l,c,_,f,d,p=r.tiledTiles,m=r.texGrids,g=r.tiles,y=18,v=27,S=r.vertices,A=0,T=0,E=0,b=0,x=0,C=0,R=!0;fht=wht;var w=new Float32Array(4);w[0]=r.color.r/255,w[1]=r.color.g/255,w[2]=r.color.b/255,w[3]=r.color.a/255,-1===i?(u=e.row,l=t.row):(u=t.row,l=e.row);var I=Math.abs(t.row-e.row)+1,B=Math.abs(e.col-t.col)+1;cht=new Float32Array(I*B*36),bht=0;for(var D=cht;(l-u)*i>=0;u+=i)for(a=S[u],C=r.getNodesCountByRow(u),R=a&&0===C,1===n?(o=R&&t.col<a.minCol?a.minCol:t.col,h=R&&e.col>a.maxCol?a.maxCol:e.col):(o=R&&e.col>a.maxCol?a.maxCol:e.col,h=R&&t.col<a.minCol?a.minCol:t.col);(h-o)*n>=0;o+=n){if(c=a&&a[o],C>0){Iht();var P=r.requestSubNodesData(),O=r.getNodesByRowCol(u,o);O&&O.count>0&&(P.subNodes=O.list)}c&&(A=g[c.index],(f=m.get((A&Xat.FLIPPED_MASK)>>>0))&&(xht!==f.texture&&(Iht(),xht=f.texture),_=f.tileset._tileSize,T=c.left-Tht,E=c.bottom-Eht,b=T+_.width,x=E+_.height,d=p[c.index],Aht=36*bht,d?d.node.active&&Dht(d.node,w,D,T,b,x,E,!1):(uht[0].x=T,uht[0].y=x,uht[1].x=T,uht[1].y=E,uht[2].x=b,uht[2].y=x,uht[3].x=b,uht[3].y=E,uht[0].transformMat4(s),D[Aht]=uht[0].x,D[Aht+1]=uht[0].y,D[Aht+2]=uht[0].z,uht[1].transformMat4(s),D[Aht+9]=uht[1].x,D[Aht+9+1]=uht[1].y,D[Aht+9+2]=uht[1].z,uht[2].transformMat4(s),D[Aht+y]=uht[2].x,D[Aht+y+1]=uht[2].y,D[Aht+y+2]=uht[2].z,uht[3].transformMat4(s),D[Aht+v]=uht[3].x,D[Aht+v+1]=uht[3].y,D[Aht+v+2]=uht[3].z,D.set(w,Aht+5),D.set(w,Aht+9+5),D.set(w,Aht+y+5),D.set(w,Aht+v+5)),fht(f,A),D[Aht+3]=ght.x,D[Aht+4]=ght.y,D[Aht+9+3]=yht.x,D[Aht+9+4]=yht.y,D[Aht+y+3]=vht.x,D[Aht+y+4]=vht.y,D[Aht+v+3]=Sht.x,D[Aht+v+4]=Sht.y,++bht>=hht&&Iht()))}Iht()}}function Dht(t,e,i,n,r,s,a,o){var h=18,u=27;t.updateWorldTransform(),fn.fromRTS(dht,t.rotation,t.position,t.scale),Yi.set(pht,-(n+Tht),-(a+Eht),0),fn.transform(dht,dht,pht),fn.multiply(dht,t.parent.worldMatrix,dht);var l=dht,c=l.m12,_=l.m13,f=l.m00,d=l.m01,p=l.m04,m=l.m05,g=1===f&&0===d&&0===p&&1===m;if(o){var y=(n+r)/2,v=(s+a)/2;g?(i[Aht]=y+c,i[Aht+1]=s+_,i[Aht+9]=n+c,i[Aht+9+1]=v+_,i[Aht+h]=r+c,i[Aht+h+1]=v+_,i[Aht+u]=y+c,i[Aht+u+1]=a+_):(i[Aht]=y*f+s*p+c,i[Aht+1]=y*d+s*m+_,i[Aht+9]=n*f+v*p+c,i[Aht+9+1]=n*d+v*m+_,i[Aht+h]=r*f+v*p+c,i[Aht+h+1]=r*d+v*m+_,i[Aht+u]=y*f+a*p+c,i[Aht+u+1]=y*d+a*m+_)}else g?(i[Aht]=n+c,i[Aht+1]=s+_,i[Aht+9]=n+c,i[Aht+9+1]=a+_,i[Aht+h]=r+c,i[Aht+h+1]=s+_,i[Aht+u]=r+c,i[Aht+u+1]=a+_):(i[Aht]=n*f+s*p+c,i[Aht+1]=n*d+s*m+_,i[Aht+9]=n*f+a*p+c,i[Aht+9+1]=n*d+a*m+_,i[Aht+h]=r*f+s*p+c,i[Aht+h+1]=r*d+s*m+_,i[Aht+u]=r*f+a*p+c,i[Aht+u+1]=r*d+a*m+_);i.set(e,Aht+5),i.set(e,Aht+9+5),i.set(e,Aht+h+5),i.set(e,Aht+u+5)}var Pht=t("ff",{getAssembler:function(){return Rht}});sht.Assembler=Pht;var Oht=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(){j(1006)},e.update=function(){j(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 j(1008),null},e.retain=function(){},e.release=function(){},t}();Oht.TAG_INVALID=-1;var Mht=function(t){function e(){for(var e,i=arguments.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}(Oht);!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):(J(1021),!1)},i.clone=function(){var t=new e;return t.initWithAction(this._innerAction.clone(),this._speed),t},i.startWithTarget=function(t){Oht.prototype.startWithTarget.call(this,t),this._innerAction.startWithTarget(t)},i.stop=function(){this._innerAction.stop(),Oht.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}}(Oht);var Nht=0,Lht=function(){this.actions=[],this.target=null,this.actionIndex=0,this.currentAction=null,this.paused=!1,this.lock=!1},Fht=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 Lht),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_"+Nht++);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 J(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===Oht.TAG_INVALID&&j(1002);var n=this._hashTargets;if(e){var r=n.get(e);r&&this._removeActionByTag(t,r,e)}else n.forEach((function(e){i._removeActionByTag(t,e)}))},e.removeAllActionsByTag=function(t,e){var i=this;t===Oht.TAG_INVALID&&j(1002);var n=this._hashTargets;if(e){var r=n.get(e);r&&this._removeAllActionsByTag(t,r,e)}else n.forEach((function(e){i._removeAllActionsByTag(t,e)}))},e.getActionByTag=function(t,e){t===Oht.TAG_INVALID&&j(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}j(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*(e.currentAction._speedMethod?e.currentAction._speed:1)),e.currentAction&&e.currentAction.isDone()){e.currentAction.stop();var s=e.currentAction;e.currentAction=null,this.removeAction(s)}e.currentAction=null}e.lock=!1}0===e.actions.length&&this._deleteHashElement(e)&&n--}else this.removeAllActionsFromTarget(r),n--}},t}(),kht=t("fg",function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this).actionMgr=new Fht,e}return s(e,t),e.prototype.update=function(t){this.actionMgr.update(t)},n(e,[{key:"ActionManager",get:function(){return this.actionMgr}}]),e}(pu));kht.ID="TWEEN",kht.instance=void 0,vN.on(yN.EVENT_INIT,(function(){var t=new kht;kht.instance=t,vN.registerSystem(kht.ID,t,pu.Priority.MEDIUM)}));var Ght=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}(Mht),Vht=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(mk),e=0;e<t.length;++e)t[e].enabled=!0},i.reverse=function(){return new Uht},i.clone=function(){return new e},e}(Ght),Uht=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(mk),e=0;e<t.length;++e)t[e].enabled=!1},i.reverse=function(){return new Vht},i.clone=function(){return new e},e}(Ght);!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(mk),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}}(Ght);var zht=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}(Ght);function Hht(t){return new zht(t)}var Wht=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}(Ght),Xht=function(t){function e(e){var i;return(i=t.call(this)||this).MAX_VALUE=2,i._elapsed=0,i._firstTick=!1,i._easeList=[],i._speed=1,i._repeatForever=!1,i._repeatMethod=!1,i._speedMethod=!1,void 0===e||isNaN(e)||i.initWithDuration(e),i}s(e,t);var i=e.prototype;return i.getElapsed=function(){return this._elapsed},i.initWithDuration=function(t){return this._duration=0===t?be.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){Oht.prototype.startWithTarget.call(this,t),this._elapsed=0,this._firstTick=!0},i.reverse=function(){return j(1010),this},i.setAmplitudeRate=function(){j(1011)},i.getAmplitudeRate=function(){return j(1012),0},i.speed=function(t){return t<=0?(j(1013),this):(this._speedMethod=!0,this._speed*=t,this)},i.getSpeed=function(){return this._speed},i.setSpeed=function(t){return this._speed=t,this},i.repeat=function(t){return t=Math.round(t),isNaN(t)||t<1?(j(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}(Mht),jht=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 J(1019),c(n);var s=r.length-1;if(s>=0&&null==r[s]&&j(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 J(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){Xht.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(),Oht.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}(Xht);function Yht(t){var e=t instanceof Array?t:arguments;if(1===e.length)return J(1019),null;var i=e.length-1;i>=0&&null==e[i]&&j(1015);var n=null;if(i>=0){n=e[0];for(var r=1;r<=i;r++)e[r]&&(n=jht._actionOneTwo(n,e[r]))}return n}jht._actionOneTwo=function(t,e){var i=new jht;return i.initWithTwoActions(t,e),i};var qht=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 Ght&&(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,Xht.prototype.startWithTarget.call(this,t),this._innerAction.startWithTarget(t)},i.stop=function(){this._innerAction.stop(),Oht.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}(Xht),Kht=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):(J(1026),!1)},i.clone=function(){var t=new e;return this._cloneDecoration(t),t.initWithAction(this._innerAction.clone()),t},i.startWithTarget=function(t){Xht.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}(Xht),Jht=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 J(1020),c(n);var s=r.length-1;if(s>=0&&null==r[s]&&j(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 J(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=jht._actionOneTwo(e,$ht(n-r)):n<r&&(this._one=jht._actionOneTwo(t,$ht(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){Xht.prototype.startWithTarget.call(this,t),this._one.startWithTarget(t),this._two.startWithTarget(t)},i.stop=function(){this._one.stop(),this._two.stop(),Oht.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}(Xht);function Qht(t){var e=t instanceof Array?t:arguments;if(1===e.length)return J(1020),null;e.length>0&&null==e[e.length-1]&&j(1015);for(var i=e[0],n=1;n<e.length;n++)null!=e[n]&&(i=Jht._actionOneTwo(i,e[n]));return i}Jht._actionOneTwo=function(t,e){var i=new Jht;return i.initWithTwoActions(t,e),i};var Zht=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}(Xht);function $ht(t){return new Zht(t)}var tut,eut,iut,nut,rut,sut,aut,out,hut,uut,lut,cut,_ut,fut,dut,put,mut,gut,yut,vut,Sut,Aut,Tut,Eut,but,xut,Cut,Rut,wut,Iut,But,Dut=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?(J(1029),!1):!!Xht.prototype.initWithDuration.call(this,t._duration)&&(this._other=t,!0):(J(1028),!1)},i.clone=function(){var t=new e;return this._cloneDecoration(t),t.initWithAction(this._other.clone()),t},i.startWithTarget=function(t){Xht.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(),Oht.prototype.stop.call(this)},e}(Xht),Put=t("fk",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 + "+S,n=t;n.delay&&k(e+"delay"+i),n.repeat&&k(e+"repeat"+i),n.repeatDelay&&k(e+"repeatDelay"+i),n.interpolation&&k(e+"interpolation"+i),n.onStop&&k(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=Ro[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=Ro[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){Xht.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}(Xht)),Out=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}(Ght),Mut=t("fj",function(){function t(t){this._actions=[],this._finalAction=null,this._target=null,this._tag=Oht.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 Oht?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&&kht.instance.ActionManager.removeAction(this._finalAction),this._finalAction=this._union(),this._finalAction.setTag(this._tag),kht.instance.ActionManager.addAction(this._finalAction,this._target,!1),this):(k("Please set target to tween first"),this)},e.stop=function(){return this._finalAction&&kht.instance.ActionManager.removeAction(this._finalAction),this},e.clone=function(t){var e=this._union();return Nut(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 Put(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 Put(t,e,i);return this._actions.push(n),this},e.set=function(t){var e=new Out(t);return this._actions.push(e),this},e.delay=function(t){var e=$ht(t);return this._actions.push(e),this},e.call=function(t){var e=function(t){return new Wht(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 qht(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 Kht(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 Dut(t)}(i)),this},e.hide=function(){var t=new Uht;return this._actions.push(t),this},e.show=function(){var t=new Vht;return this._actions.push(t),this},e.removeSelf=function(){var t=Hht(!1);return this._actions.push(t),this},e.destroySelf=function(){var t=Hht(!0);return this._actions.push(t),this},t.stopAll=function(){kht.instance.ActionManager.removeAllActions()},t.stopAllByTag=function(t,e){kht.instance.ActionManager.removeAllActionsByTag(t,e)},t.stopAllByTarget=function(t){kht.instance.ActionManager.removeAllActionsFromTarget(t)},e._union=function(){var t=this._actions;return 1===t.length?t[0]:Yht(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 Yht.apply(Yht,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 Qht.apply(Qht,e)},t}());function Nut(t){return new Mut(t)}function Lut(t){return k("tweenUtil' is deprecated, please use 'tween' instead "),new Mut(t)}Mut._tmp_args=[],v.Tween=Mut,v.tween=Nut,v.tweenUtil=Lut,function(t){t[t.Other=0]="Other",t[t.Left=1]="Left",t[t.Right=2]="Right"}(tut||(tut={})),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"}(eut||(eut={})),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"}(iut||(iut={})),s((function(){for(var t,e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return(t=But.call.apply(But,[this].concat(i))||this).deviceType=tut.Other,t.hitPoint=new Yi,t}),But=Lx);var Fut,kut,Gut,Vut=new Zi;!function(t){t[t.NONE=0]="NONE",t[t.COLOR=1]="COLOR",t[t.SPRITE=2]="SPRITE",t[t.SCALE=3]="SCALE"}(Fut||(Fut={})),ve(Fut),function(t){t.NORMAL="normal",t.HOVER="hover",t.PRESSED="pressed",t.DISABLED="disabled"}(kut||(kut={})),function(t){t.CLICK="click"}(Gut||(Gut={}));var Uut=t("fl",(nut=Is("cc.Button"),rut=Ds(110),sut=Bs($F),aut=ha(Pm),out=ha(Fut),hut=ha(lL),uut=ha(lL),lut=ha(lL),cut=ha(lL),_ut=ha([Fd]),nut(fut=rut(fut=sut(((Iut=function(t){function e(){for(var e,i=arguments.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=put&&put(),e._interactable=mut&&mut(),e._transition=gut&&gut(),e._normalColor=yut&&yut(),e._hoverColor=vut&&vut(),e._pressedColor=Sut&&Sut(),e._disabledColor=Aut&&Aut(),e._normalSprite=Tut&&Tut(),e._hoverSprite=Eut&&Eut(),e._pressedSprite=but&&but(),e._disabledSprite=xut&&xut(),e._duration=Cut&&Cut(),e._zoomScale=Rut&&Rut(),e._target=wut&&wut(),e._pressed=!1,e._hovered=!1,e._fromColor=new Zi,e._toColor=new Zi,e._time=0,e._transitionFinished=!0,e._fromScale=new Yi,e._toScale=new Yi,e._originalScale=null,e._sprite=null,e._targetScale=new Yi,e}s(e,t);var i=e.prototype;return i.__preload=function(){this.target||(this.target=this.node);var t=this.node.getComponent(ZV);t&&(this._normalSprite=t.spriteFrame),this._applyTarget(),this._resetState()},i.onEnable=function(){this._registerNodeEvent()},i.onDisable=function(){this._resetState(),this._unregisterNodeEvent()},i.onDestroy=function(){this.target.isValid&&this._unregisterTargetEvent(this.target)},i.update=function(t){var e=this.target;if(!this._transitionFinished&&e&&(this._transition===Fut.COLOR||this._transition===Fut.SCALE)){this._time+=t;var i=1;if(this._duration>0&&(i=this._time/this._duration),i>=1&&(i=1),this._transition===Fut.COLOR){var n=e._uiProps.uiComp;Zi.lerp(Vut,this._fromColor,this._toColor,i),n&&(n.color=Vut)}else this.transition===Fut.SCALE&&(e.getScale(this._targetScale),this._targetScale.x=Ci(this._fromScale.x,this._toScale.x,i),this._targetScale.y=Ci(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===Fut.COLOR&&this._interactable){var i=t.getComponent(gk);i&&(i.color=this._normalColor)}else e===Fut.SCALE&&this._originalScale&&t.setScale(this._originalScale);this._transitionFinished=!0}},i._registerNodeEvent=function(){this.node.on(zp.TOUCH_START,this._onTouchBegan,this),this.node.on(zp.TOUCH_MOVE,this._onTouchMove,this),this.node.on(zp.TOUCH_END,this._onTouchEnded,this),this.node.on(zp.TOUCH_CANCEL,this._onTouchCancel,this),this.node.on(zp.MOUSE_ENTER,this._onMouseMoveIn,this),this.node.on(zp.MOUSE_LEAVE,this._onMouseMoveOut,this),this.node.on(eut.XRUI_HOVER_ENTERED,this._xrHoverEnter,this),this.node.on(eut.XRUI_HOVER_EXITED,this._xrHoverExit,this),this.node.on(eut.XRUI_CLICK,this._xrClick,this),this.node.on(eut.XRUI_UNCLICK,this._xrUnClick,this)},i._registerTargetEvent=function(t){t.on(zp.TRANSFORM_CHANGED,this._onTargetTransformChanged,this)},i._unregisterNodeEvent=function(){this.node.off(zp.TOUCH_START,this._onTouchBegan,this),this.node.off(zp.TOUCH_MOVE,this._onTouchMove,this),this.node.off(zp.TOUCH_END,this._onTouchEnded,this),this.node.off(zp.TOUCH_CANCEL,this._onTouchCancel,this),this.node.off(zp.MOUSE_ENTER,this._onMouseMoveIn,this),this.node.off(zp.MOUSE_LEAVE,this._onMouseMoveOut,this),this.node.off(eut.XRUI_HOVER_ENTERED,this._xrHoverEnter,this),this.node.off(eut.XRUI_HOVER_EXITED,this._xrHoverExit,this),this.node.off(eut.XRUI_CLICK,this._xrClick,this),this.node.off(eut.XRUI_UNCLICK,this._xrUnClick,this)},i._unregisterTargetEvent=function(t){t.off(zp.TRANSFORM_CHANGED)},i._getTargetSprite=function(t){var e=null;return t&&(e=t.getComponent(ZV)),e},i._applyTarget=function(){this.target&&(this._sprite=this._getTargetSprite(this.target),this._originalScale||(this._originalScale=new Yi),Yi.copy(this._originalScale,this.target.getScale()),this._registerTargetEvent(this.target))},i._onTargetSpriteFrameChanged=function(t){this._transition===Fut.SPRITE&&this._setCurrentStateSpriteFrame(t.spriteFrame)},i._setCurrentStateSpriteFrame=function(t){if(t)switch(this._getButtonState()){case kut.NORMAL:this._normalSprite=t;break;case kut.HOVER:this._hoverSprite=t;break;case kut.PRESSED:this._pressedSprite=t;break;case kut.DISABLED:this._disabledSprite=t}},i._onTargetColorChanged=function(t){this._transition===Fut.COLOR&&this._setCurrentStateColor(t)},i._setCurrentStateColor=function(t){switch(this._getButtonState()){case kut.NORMAL:this._normalColor=t;break;case kut.HOVER:this._hoverColor=t;break;case kut.PRESSED:this._pressedColor=t;break;case kut.DISABLED:this._disabledColor=t}},i._onTargetTransformChanged=function(t){t&Vp.SCALE&&this._originalScale&&this._transition===Fut.SCALE&&this._transitionFinished&&Yi.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===Fut.SCALE&&this.target&&this._originalScale?n?(Yi.copy(this._fromScale,this._originalScale),Yi.multiplyScalar(this._toScale,this._originalScale,this._zoomScale),this._transitionFinished=!1):(this._time=0,this._transitionFinished=!0,this.target.setScale(this._originalScale)):(i=n?kut.PRESSED:kut.NORMAL,this._applyTransition(i)),t&&(t.propagationStopped=!0)}}},i._onTouchEnded=function(t){this._interactable&&this.enabledInHierarchy&&(this._pressed&&(Fd.emitEvents(this.clickEvents,t),this.node.emit(Gut.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!==Fut.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=kut.NORMAL;return this._interactable?this._pressed?t=kut.PRESSED:this._hovered&&(t=kut.HOVER):t=kut.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(gk);n&&(t===kut.DISABLED?n.color=i:(this._fromColor=n.color.clone(),this._toColor=i,this._time=0,this._transitionFinished=!1))},i._updateSpriteTransition=function(t){var e=this[t+"Sprite"];this._sprite&&e&&(this._sprite.spriteFrame=e)},i._updateScaleTransition=function(t){this._interactable&&(t===kut.PRESSED?this._zoomUp():this._zoomBack())},i._zoomUp=function(){this._originalScale&&(Yi.copy(this._fromScale,this._originalScale),Yi.multiplyScalar(this._toScale,this._originalScale,this._zoomScale),this._time=0,this._transitionFinished=!1)},i._zoomBack=function(){this.target&&this._originalScale&&(Yi.copy(this._fromScale,this.target.getScale()),Yi.copy(this._toScale,this._originalScale),this._time=0,this._transitionFinished=!1)},i._applyTransition=function(t){var e=this._transition;e===Fut.COLOR?this._updateColorTransition(t):e===Fut.SPRITE?this._updateSpriteTransition(t):e===Fut.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&&(Fd.emitEvents(this.clickEvents,this),this.node.emit(Gut.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===Fut.COLOR?this._updateColorTransition(kut.NORMAL):this._transition===Fut.SPRITE&&this._updateSpriteTransition(kut.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(ZV);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}(Vd)).Transition=Fut,Iut.EventType=Gut,p((dut=Iut).prototype,"target",[aut],Object.getOwnPropertyDescriptor(dut.prototype,"target"),dut.prototype),p(dut.prototype,"transition",[out],Object.getOwnPropertyDescriptor(dut.prototype,"transition"),dut.prototype),p(dut.prototype,"normalSprite",[hut],Object.getOwnPropertyDescriptor(dut.prototype,"normalSprite"),dut.prototype),p(dut.prototype,"pressedSprite",[uut],Object.getOwnPropertyDescriptor(dut.prototype,"pressedSprite"),dut.prototype),p(dut.prototype,"hoverSprite",[lut],Object.getOwnPropertyDescriptor(dut.prototype,"hoverSprite"),dut.prototype),p(dut.prototype,"disabledSprite",[cut],Object.getOwnPropertyDescriptor(dut.prototype,"disabledSprite"),dut.prototype),put=Ss(dut.prototype,"clickEvents",[_ut,ks],(function(){return[]})),mut=Ss(dut.prototype,"_interactable",[ks],(function(){return!0})),gut=Ss(dut.prototype,"_transition",[ks],(function(){return Fut.NONE})),yut=Ss(dut.prototype,"_normalColor",[ks],(function(){return Zi.WHITE.clone()})),vut=Ss(dut.prototype,"_hoverColor",[ks],(function(){return new Zi(211,211,211,255)})),Sut=Ss(dut.prototype,"_pressedColor",[ks],(function(){return Zi.WHITE.clone()})),Aut=Ss(dut.prototype,"_disabledColor",[ks],(function(){return new Zi(124,124,124,255)})),Tut=Ss(dut.prototype,"_normalSprite",[ks],(function(){return null})),Eut=Ss(dut.prototype,"_hoverSprite",[ks],(function(){return null})),but=Ss(dut.prototype,"_pressedSprite",[ks],(function(){return null})),xut=Ss(dut.prototype,"_disabledSprite",[ks],(function(){return null})),Cut=Ss(dut.prototype,"_duration",[ks],(function(){return.1})),Rut=Ss(dut.prototype,"_zoomScale",[ks],(function(){return 1.2})),wut=Ss(dut.prototype,"_target",[ks],(function(){return null})),fut=dut))||fut)||fut)||fut));v.Button=Uut;var zut,Hut,Wut,Xut=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}();Xut._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"}(zut||(zut={})),me(zut),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"}(Hut||(Hut={})),me(Hut),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"}(Wut||(Wut={})),me(Wut);var jut,Yut,qut,Kut,Jut,Qut,Zut,$ut,tlt,elt,ilt,nlt,rlt,slt,alt,olt,hlt,ult,llt,clt,_lt,flt,dlt,plt,mlt,glt,ylt,vlt,Slt,Alt,Tlt=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}(),Elt=A.document,blt=new fn,xlt=new fn,Clt=new Yi,Rlt=null,wlt=0,Ilt=function(t){function e(){for(var e,i=arguments.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_"+ ++wlt,e}s(e,t);var i=e.prototype;return i.init=function(t){t&&(this._delegate=t,t.inputMode===Hut.ANY?this._createTextArea():this._createInput(),Xut.add(this),this.setTabIndex(t.tabIndex),this._initStyleSheet(),this._registerEventListeners(),this._addDomToGameContainer())},i.clear=function(){this._removeEventListeners(),this._removeDomFromGameContainer(),Xut.remove(this),Rlt===this&&(Rlt=null),this._delegate=null},i.update=function(){this._updateMatrix()},i.setTabIndex=function(t){this._edTxt.tabIndex=t,Xut.resort()},i.setSize=function(t,e){var i=this._edTxt;i&&(i.style.width=t+"px",i.style.height=e+"px")},i.beginEditing=function(){Rlt&&Rlt!==this&&Rlt.setFocus(!1),this._editing=!0,Rlt=this,this._delegate._editBoxEditingDidBegan(),this._showDom(),this._edTxt.focus()},i.endEditing=function(){this._edTxt.blur()},i._createInput=function(){this._isTextArea=!1,this._edTxt=Elt.createElement("input")},i._createTextArea=function(){this._isTextArea=!0,this._edTxt=Elt.createElement("textarea")},i._addDomToGameContainer=function(){xN.container&&this._edTxt&&(xN.container.appendChild(this._edTxt),Elt.head.appendChild(this._placeholderStyleSheet))},i._removeDomFromGameContainer=function(){Pe(xN.container,this._edTxt)&&this._edTxt&&xN.container.removeChild(this._edTxt),Pe(Elt.head,this._placeholderStyleSheet)&&Elt.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()),ul.isMobile&&this._showDomOnMobile()},i._hideDom=function(){var t=this._edTxt;t&&this._delegate&&(t.style.display="none",this._delegate._showLabels()),ul.isMobile&&this._hideDomOnMobile()},i._showDomOnMobile=function(){ul.os!==Nu.ANDROID&&ul.os!==Nu.OHOS||(al.handleResizeEvent=!1,this._adjustWindowScroll())},i._hideDomOnMobile=function(){ul.os!==Nu.ANDROID&&ul.os!==Nu.OHOS||(al.handleResizeEvent=!0),this._scrollBackWindow()},i._adjustWindowScroll=function(){var t=this;setTimeout((function(){A.scrollY<40&&t._edTxt.scrollIntoView({block:"start",inline:"nearest",behavior:"smooth"})}),400)},i._scrollBackWindow=function(){setTimeout((function(){ul.browserType!==Pu.WECHAT||ul.os!==Nu.IOS?A.scrollTo(0,0):A.top&&A.top.scrollTo(0,0)}),400)},i._updateMatrix=function(){if(this._edTxt){var t=this._delegate.node,e=gz.getScaleX(),i=gz.getScaleY(),n=gz.getViewportRect(),r=al.devicePixelRatio;t.getWorldMatrix(blt);var s=t._uiProps.uiTransformComp;if(s&&Yi.set(Clt,-s.anchorX*s.width,-s.anchorY*s.height,Clt.z),fn.transform(blt,blt,Clt),t._uiProps.uiTransformComp){var a=vN.root.batcher2D.getFirstRenderCamera(t);if(a){a.node.getWorldRT(xlt);var o=xlt.m12,h=xlt.m13,u=ll.center;xlt.m12=u.x-(xlt.m00*o+xlt.m04*h),xlt.m13=u.y-(xlt.m01*o+xlt.m05*h),fn.multiply(xlt,xlt,blt),e/=r,i/=r;var l=xN.container,c=xlt.m00*e,_=blt.m01,f=blt.m04,d=xlt.m05*i,p=parseInt(l&&l.style.paddingLeft||"0");p+=n.x/r;var m=parseInt(l&&l.style.paddingBottom||"0");m+=n.y/r;var g="matrix("+c+","+-_+","+-f+","+d+","+(xlt.m12*e+p)+","+-(xlt.m13*i+m)+")";this._edTxt.style.transform=g,this._edTxt.style["-webkit-transform"]=g,this._edTxt.style["transform-origin"]="0px 100% 0px",this._edTxt.style["-webkit-transform-origin"]="0px 100% 0px"}}}},i._updateInputType=function(){var t=this._delegate,e=t.inputMode,i=t.inputFlag,n=t.returnType,r=this._edTxt;if(this._inputMode!==e||this._inputFlag!==i||this._returnType!==n){if(this._inputMode=e,this._inputFlag=i,this._returnType=n,this._isTextArea){var s="none";return i===Wut.INITIAL_CAPS_ALL_CHARACTERS?s="uppercase":i===Wut.INITIAL_CAPS_WORD&&(s="capitalize"),void(r.style.textTransform=s)}if(r=r,i===Wut.PASSWORD)return r.type="password",void(r.style.textTransform="none");var a=r.type;e===Hut.EMAIL_ADDR?a="email":e===Hut.NUMERIC||e===Hut.DECIMAL?a="number":e===Hut.PHONE_NUMBER?(a="number",r.pattern="[0-9]*",r.addEventListener("wheel",(function(){return!1}))):e===Hut.URL?a="url":(a="text",n===zut.SEARCH&&(a="search")),r.type=a;var o="none";i===Wut.INITIAL_CAPS_ALL_CHARACTERS?o="uppercase":i===Wut.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=Elt.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 IL?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 $k.HorizontalAlign.LEFT:n.style.textAlign="left";break;case $k.HorizontalAlign.CENTER:n.style.textAlign="center";break;case $k.HorizontalAlign.RIGHT:n.style.textAlign="right"}}}},i._updatePlaceholderLabel=function(t){if(t){var e=t.font;e=!e||e instanceof IL?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 $k.HorizontalAlign.LEFT:a="left";break;case $k.HorizontalAlign.CENTER:a="center";break;case $k.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+";}",ul.browserType===Pu.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&&ul.isMobile&&t._adjustWindowScroll()},n.onKeydown=function(i){i.keyCode===zx.ENTER?(i.propagationStopped=!0,t._delegate._editBoxEditingReturn(),t._isTextArea||e.blur()):i.keyCode===zx.TAB&&(i.propagationStopped=!0,i.preventDefault(),Xut.next(t))},n.onBlur=function(){ul.isMobile&&i&&n.compositionEnd(),t._editing=!1,Rlt=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}(Tlt);!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"}(Alt||(Alt={}));var Blt,Dlt,Plt,Olt,Mlt,Nlt,Llt,Flt,klt,Glt,Vlt,Ult,zlt,Hlt,Wlt,Xlt,jlt,Ylt,qlt,Klt,Jlt,Qlt,Zlt,$lt,tct,ect,ict,nct,rct,sct,act,oct,hct,uct,lct=t("fm",(jut=Is("cc.EditBox"),Yut=Ds(110),qut=Bs($F),Kut=ha($k),Jut=ha($k),Qut=ha(lL),Zut=ha(Wut),$ut=ha(Hut),tlt=ha(zut),elt=ha([Fd]),ilt=ha([Fd]),nlt=ha([Fd]),rlt=ha([Fd]),jut(slt=Yut(slt=qut(((Slt=function(t){function e(){for(var e,i=arguments.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=olt&&olt(),e.textChanged=hlt&&hlt(),e.editingDidEnded=ult&&ult(),e.editingReturn=llt&&llt(),e._impl=null,e._background=null,e._textLabel=clt&&clt(),e._placeholderLabel=_lt&&_lt(),e._returnType=flt&&flt(),e._string=dlt&&dlt(),e._tabIndex=plt&&plt(),e._backgroundImage=mlt&&mlt(),e._inputFlag=glt&&glt(),e._inputMode=ylt&&ylt(),e._maxLength=vlt&&vlt(),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(){Fd.emitEvents(this.editingDidBegan,this),this.node.emit(Alt.EDITING_DID_BEGAN,this)},i._editBoxEditingDidEnded=function(t){Fd.emitEvents(this.editingDidEnded,this),this.node.emit(Alt.EDITING_DID_ENDED,this,t)},i._editBoxTextChanged=function(t){t=this._updateLabelStringStyle(t,!0),this.string=t,Fd.emitEvents(this.textChanged,t,this),this.node.emit(Alt.TEXT_CHANGED,this)},i._editBoxEditingReturn=function(t){Fd.emitEvents(this.editingReturn,this),this.node.emit(Alt.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(zp.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(ZV);t||(t=this.node.addComponent(ZV)),t!==this._background&&(t.type=ZV.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 Pm("TEXT_LABEL")).layer=this.node.layer),(t=e.getComponent($k))||(t=e.addComponent($k)),e.parent=this.node,this._textLabel=t}this._inputMode===Hut.ANY?(t.verticalAlign=jk.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 Pm("PLACEHOLDER_LABEL")).layer=this.node.layer),(t=e.getComponent($k))||(t=e.addComponent($k)),e.parent=this.node,this._placeholderLabel=t}this._inputMode===Hut.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!==Wut.PASSWORD)n===Wut.INITIAL_CAPS_ALL_CHARACTERS?t=t.toUpperCase():n===Wut.INITIAL_CAPS_WORD?t=t.replace(/(?:^|\s)\S/g,(function(t){return t.toUpperCase()})):n===Wut.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(zp.TOUCH_START,this._onTouchBegan,this),this.node.on(zp.TOUCH_END,this._onTouchEnded,this),this.node.on(eut.XRUI_UNCLICK,this._xrUnClick,this),this.node.on(iut.XR_KEYBOARD_INPUT,this._xrKeyBoardInput,this)},i._unregisterEvent=function(){this.node.off(zp.TOUCH_START,this._onTouchBegan,this),this.node.off(zp.TOUCH_END,this._onTouchEnded,this),this.node.off(eut.XRUI_UNCLICK,this._xrUnClick,this),this.node.off(iut.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(ZV.EventType.SPRITE_FRAME_CHANGED,this._onBackgroundSpriteFrameChanged,this)},i._unregisterBackgroundEvent=function(){var t=this._background&&this._background.node;null==t||t.off(ZV.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===Hut.ANY&&(s.verticalAlign=jk.TOP),s.enableWrapText=this._inputMode===Hut.ANY),r&&(r.node._uiProps.uiTransformComp.setContentSize(t.width-2,t.height),r.lineHeight=t.height,r.node.setPosition(i+2,n+t.height,r.node.position.z),r.enableWrapText=this._inputMode===Hut.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(Alt.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}(Vd))._EditBoxImpl=Tlt,Slt.KeyboardReturnType=zut,Slt.InputFlag=Wut,Slt.InputMode=Hut,Slt.EventType=Alt,p((alt=Slt).prototype,"textLabel",[Kut],Object.getOwnPropertyDescriptor(alt.prototype,"textLabel"),alt.prototype),p(alt.prototype,"placeholderLabel",[Jut],Object.getOwnPropertyDescriptor(alt.prototype,"placeholderLabel"),alt.prototype),p(alt.prototype,"backgroundImage",[Qut],Object.getOwnPropertyDescriptor(alt.prototype,"backgroundImage"),alt.prototype),p(alt.prototype,"inputFlag",[Zut],Object.getOwnPropertyDescriptor(alt.prototype,"inputFlag"),alt.prototype),p(alt.prototype,"inputMode",[$ut],Object.getOwnPropertyDescriptor(alt.prototype,"inputMode"),alt.prototype),p(alt.prototype,"returnType",[tlt],Object.getOwnPropertyDescriptor(alt.prototype,"returnType"),alt.prototype),olt=Ss(alt.prototype,"editingDidBegan",[elt,ks],(function(){return[]})),hlt=Ss(alt.prototype,"textChanged",[ilt,ks],(function(){return[]})),ult=Ss(alt.prototype,"editingDidEnded",[nlt,ks],(function(){return[]})),llt=Ss(alt.prototype,"editingReturn",[rlt,ks],(function(){return[]})),clt=Ss(alt.prototype,"_textLabel",[ks],(function(){return null})),_lt=Ss(alt.prototype,"_placeholderLabel",[ks],(function(){return null})),flt=Ss(alt.prototype,"_returnType",[ks],(function(){return zut.DEFAULT})),dlt=Ss(alt.prototype,"_string",[ks],(function(){return""})),plt=Ss(alt.prototype,"_tabIndex",[ks],(function(){return 0})),mlt=Ss(alt.prototype,"_backgroundImage",[ks],(function(){return null})),glt=Ss(alt.prototype,"_inputFlag",[ks],(function(){return Wut.DEFAULT})),ylt=Ss(alt.prototype,"_inputMode",[ks],(function(){return Hut.ANY})),vlt=Ss(alt.prototype,"_maxLength",[ks],(function(){return 20})),slt=alt))||slt)||slt)||slt));"object"==typeof window&&"object"==typeof document&&(lct._EditBoxImpl=Ilt),v.internal.EditBox=lct,function(t){t[t.NONE=0]="NONE",t[t.HORIZONTAL=1]="HORIZONTAL",t[t.VERTICAL=2]="VERTICAL",t[t.GRID=3]="GRID"}(rct||(rct={})),ve(rct),function(t){t[t.NONE=0]="NONE",t[t.CONTAINER=1]="CONTAINER",t[t.CHILDREN=2]="CHILDREN"}(sct||(sct={})),ve(sct),function(t){t[t.HORIZONTAL=0]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(act||(act={})),ve(act),function(t){t[t.BOTTOM_TO_TOP=0]="BOTTOM_TO_TOP",t[t.TOP_TO_BOTTOM=1]="TOP_TO_BOTTOM"}(oct||(oct={})),ve(oct),function(t){t[t.LEFT_TO_RIGHT=0]="LEFT_TO_RIGHT",t[t.RIGHT_TO_LEFT=1]="RIGHT_TO_LEFT"}(hct||(hct={})),ve(hct),function(t){t[t.NONE=0]="NONE",t[t.FIXED_ROW=1]="FIXED_ROW",t[t.FIXED_COL=2]="FIXED_COL"}(uct||(uct={})),ve(uct);var cct,_ct,fct,dct,pct,mct,gct,yct,vct,Sct,Act,Tct,Ect,bct,xct=new Yi,Cct=t("fn",(Blt=Is("cc.Layout"),Dlt=Ds(110),Plt=Bs($F),Olt=ha(rct),Mlt=ha(sct),Nlt=ha(act),Llt=ha(oct),Flt=ha(hct),klt=ha(uct),Blt(Glt=Dlt(Glt=Plt(((nct=function(t){function e(){for(var e,i=arguments.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=Ult&&Ult(),e._layoutType=zlt&&zlt(),e._cellSize=Hlt&&Hlt(),e._startAxis=Wlt&&Wlt(),e._paddingLeft=Xlt&&Xlt(),e._paddingRight=jlt&&jlt(),e._paddingTop=Ylt&&Ylt(),e._paddingBottom=qlt&&qlt(),e._spacingX=Klt&&Klt(),e._spacingY=Jlt&&Jlt(),e._verticalDirection=Qlt&&Qlt(),e._horizontalDirection=Zlt&&Zlt(),e._constraint=$lt&&$lt(),e._constraintNum=tct&&tct(),e._affectedByScale=ect&&ect(),e._isAlign=ict&&ict(),e._layoutSize=new An(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(An.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(){vN.on(yN.EVENT_AFTER_UPDATE,this.updateLayout,this),this.node.on(zp.SIZE_CHANGED,this._resized,this),this.node.on(zp.ANCHOR_CHANGED,this._doLayoutDirty,this),this.node.on(zp.CHILD_ADDED,this._childAdded,this),this.node.on(zp.CHILD_REMOVED,this._childRemoved,this),this.node.on(zp.SIBLING_ORDER_CHANGED,this._childrenChanged,this),this.node.on("childrenSiblingOrderChanged",this.updateLayout,this),this._addChildrenEventListeners()},i._removeEventListeners=function(){vN.off(yN.EVENT_AFTER_UPDATE,this.updateLayout,this),this.node.off(zp.SIZE_CHANGED,this._resized,this),this.node.off(zp.ANCHOR_CHANGED,this._doLayoutDirty,this),this.node.off(zp.CHILD_ADDED,this._childAdded,this),this.node.off(zp.CHILD_REMOVED,this._childRemoved,this),this.node.off(zp.SIBLING_ORDER_CHANGED,this._childrenChanged,this),this.node.off("childrenSiblingOrderChanged",this.updateLayout,this),this._removeChildrenEventListeners()},i._addChildrenEventListeners=function(){for(var t=this.node.children,e=0;e<t.length;++e){var i=t[e];i.on(zp.SIZE_CHANGED,this._doLayoutDirty,this),i.on(zp.TRANSFORM_CHANGED,this._transformDirty,this),i.on(zp.ANCHOR_CHANGED,this._doLayoutDirty,this),i.on(zp.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(zp.SIZE_CHANGED,this._doLayoutDirty,this),i.off(zp.TRANSFORM_CHANGED,this._transformDirty,this),i.off(zp.ANCHOR_CHANGED,this._doLayoutDirty,this),i.off(zp.ACTIVE_IN_HIERARCHY_CHANGED,this._childrenChanged,this)}},i._childAdded=function(t){t.on(zp.SIZE_CHANGED,this._doLayoutDirty,this),t.on(zp.TRANSFORM_CHANGED,this._transformDirty,this),t.on(zp.ANCHOR_CHANGED,this._doLayoutDirty,this),t.on(zp.ACTIVE_IN_HIERARCHY_CHANGED,this._childrenChanged,this),this._childrenChanged()},i._childRemoved=function(t){t.off(zp.SIZE_CHANGED,this._doLayoutDirty,this),t.off(zp.TRANSFORM_CHANGED,this._transformDirty,this),t.off(zp.ANCHOR_CHANGED,this._doLayoutDirty,this),t.off(zp.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===hct.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,f=0,d=!1,p=this._usefulLayoutObj.length,m=this._cellSize.width,g=this._getPaddingH();this._layoutType!==rct.GRID&&this._resizeMode===sct.CHILDREN&&(m=(t-g-(p-1)*this._spacingX)/p);for(var y=this._usefulLayoutObj,v=0;v<y.length;++v){var S=y[v],A=S.node,T=A.scale,E=this._getUsedScaleValue(T.x),b=this._getUsedScaleValue(T.y);this._resizeMode===sct.CHILDREN&&(S.width=m/E,this._layoutType===rct.GRID&&(S.height=this._cellSize.height/b));var x=Math.abs(this._horizontalDirection-S.anchorX),C=S.width*E,R=S.height*b;R>_&&(f=Math.max(_,f),c=_||R,_=R),u+=a*(x*C+this._spacingX);var w=a*(1-x)*C;if(e){if(s>0)(d=v/s>0&&v%s==0)&&(c=_>R?_:c);else if(C>t-g)u>h+a*x*C&&(d=!0);else{var I=(1-this._horizontalDirection-r.x)*t,B=u+w+a*(a>0?this._paddingRight:this._paddingLeft);d=Math.abs(B)>Math.abs(I)}d&&(u=h+a*x*C,R!==_&&(c=_),l+=c+this._spacingY,c=_=R)}var D=i(A,S,l);n&&A.setPosition(u,D),u+=w}return c=Math.max(c,_),Math.max(f,l+c)+this._getPaddingV()},i._doLayoutVertically=function(t,e,i,n){var r=this.node._uiProps.uiTransformComp.anchorPoint,s=this._getFixedBreakingNum(),a=1,o=this._paddingBottom;this._verticalDirection===oct.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,f=0,d=!1,p=this._usefulLayoutObj.length,m=this._cellSize.height,g=this._getPaddingV();this._layoutType!==rct.GRID&&this._resizeMode===sct.CHILDREN&&(m=(t-g-(p-1)*this._spacingY)/p);for(var y=this._usefulLayoutObj,v=0;v<y.length;++v){var S=y[v],A=S.node,T=A.scale,E=this._getUsedScaleValue(T.x),b=this._getUsedScaleValue(T.y);this._resizeMode===sct.CHILDREN&&(S.height=m/b,this._layoutType===rct.GRID&&(S.width=this._cellSize.width/E));var x=Math.abs(this._verticalDirection-S.anchorY),C=S.width*E,R=S.height*b;C>l&&(c=Math.max(l,c),_=l||C,l=C),u+=a*(x*R+this._spacingY);var w=a*(1-x)*R;if(e){if(s>0)(d=v/s>0&&v%s==0)&&(_=l>R?l:_);else if(R>t-g)u>h+a*x*R&&(d=!0);else{var I=(1-this._verticalDirection-r.y)*t,B=u+w+a*(a>0?this._paddingTop:this._paddingBottom);d=Math.abs(B)>Math.abs(I)}d&&(u=h+a*x*R,C!==l&&(_=l),f+=_+this._spacingX,_=l=C)}var D=i(A,S,f);n&&(A.getPosition(xct),A.setPosition(D,u,xct.z)),u+=w}return _=Math.max(_,l),Math.max(c,f+_)+this._getPaddingH()},i._doLayoutGridAxisHorizontal=function(t,e){var i=this,n=e.width,r=1,s=-t.y*e.height,a=this._paddingBottom;this._verticalDirection===oct.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===sct.CONTAINER&&(h=this._doLayoutHorizontally(n,!0,o,!1),s=-t.y*h,this._verticalDirection===oct.TOP_TO_BOTTOM&&(r=-1,s=(1-t.y)*h)),this._doLayoutHorizontally(n,!0,o,!0),this._resizeMode===sct.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===hct.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===sct.CONTAINER&&(h=this._doLayoutVertically(n,!0,o,!1),s=-t.x*h,this._horizontalDirection===hct.RIGHT_TO_LEFT&&(r=-1,s=(1-t.x)*h)),this._doLayoutVertically(n,!0,o,!0),this._resizeMode===sct.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===act.HORIZONTAL?this._doLayoutGridAxisHorizontal(e,i):this.startAxis===act.VERTICAL&&this._doLayoutGridAxisVertical(e,i)},i._getHorizontalBaseWidth=function(){var t=this._usefulLayoutObj,e=0,i=t.length;if(this._resizeMode===sct.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===sct.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===rct.HORIZONTAL){var e=this._getHorizontalBaseWidth();this._doLayoutHorizontally(e,!1,(function(e){return(t._isAlign?Yi.ZERO:e.position).y}),!0),this.node._uiProps.uiTransformComp.width=e}else if(this._layoutType===rct.VERTICAL){var i=this._getVerticalBaseHeight();this._doLayoutVertically(i,!1,(function(e){return(t._isAlign?Yi.ZERO:e.position).x}),!0),this.node._uiProps.uiTransformComp.height=i}else this._layoutType===rct.GRID&&this._doLayoutGrid()},i._getUsedScaleValue=function(t){return this._affectedByScale?Math.abs(t):1},i._transformDirty=function(t){t&Vp.SCALE&&t&Vp.POSITION&&this._affectedByScale&&this._doLayoutDirty()},i._doLayoutDirty=function(){this._layoutDirty=!0},i._childrenChanged=function(){this._childrenDirty=!0,this._doLayoutDirty()},i._getPaddingH=function(){return this._paddingLeft+this._paddingRight},i._getPaddingV=function(){return this._paddingTop+this._paddingBottom},i._getFixedBreakingNum=function(){if(this._layoutType!==rct.GRID||this._constraint===uct.NONE||this._constraintNum<=0)return 0;var t=this._constraint===uct.FIXED_ROW?Math.ceil(this._usefulLayoutObj.length/this._constraintNum):this._constraintNum;return this._startAxis===act.VERTICAL&&(t=this._constraint===uct.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===rct.HORIZONTAL&&(this._isAlign=t,this._doLayoutDirty())}},{key:"alignVertical",get:function(){return this._isAlign},set:function(t){this._layoutType===rct.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!==rct.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!==rct.NONE&&this._constraint!==t&&(this._constraint=t,this._doLayoutDirty())}},{key:"constraintNum",get:function(){return this._constraintNum},set:function(t){this._constraint!==uct.NONE&&this._constraintNum!==t&&(t<=0&&k("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}(Vd)).Type=rct,nct.VerticalDirection=oct,nct.HorizontalDirection=hct,nct.ResizeMode=sct,nct.AxisDirection=act,nct.Constraint=uct,p((Vlt=nct).prototype,"type",[Olt],Object.getOwnPropertyDescriptor(Vlt.prototype,"type"),Vlt.prototype),p(Vlt.prototype,"resizeMode",[Mlt],Object.getOwnPropertyDescriptor(Vlt.prototype,"resizeMode"),Vlt.prototype),p(Vlt.prototype,"startAxis",[Nlt],Object.getOwnPropertyDescriptor(Vlt.prototype,"startAxis"),Vlt.prototype),p(Vlt.prototype,"verticalDirection",[Llt],Object.getOwnPropertyDescriptor(Vlt.prototype,"verticalDirection"),Vlt.prototype),p(Vlt.prototype,"horizontalDirection",[Flt],Object.getOwnPropertyDescriptor(Vlt.prototype,"horizontalDirection"),Vlt.prototype),p(Vlt.prototype,"constraint",[klt],Object.getOwnPropertyDescriptor(Vlt.prototype,"constraint"),Vlt.prototype),Ult=Ss(Vlt.prototype,"_resizeMode",[ks],(function(){return sct.NONE})),zlt=Ss(Vlt.prototype,"_layoutType",[ks],(function(){return rct.NONE})),Hlt=Ss(Vlt.prototype,"_cellSize",[ks],(function(){return new An(40,40)})),Wlt=Ss(Vlt.prototype,"_startAxis",[ks],(function(){return act.HORIZONTAL})),Xlt=Ss(Vlt.prototype,"_paddingLeft",[ks],(function(){return 0})),jlt=Ss(Vlt.prototype,"_paddingRight",[ks],(function(){return 0})),Ylt=Ss(Vlt.prototype,"_paddingTop",[ks],(function(){return 0})),qlt=Ss(Vlt.prototype,"_paddingBottom",[ks],(function(){return 0})),Klt=Ss(Vlt.prototype,"_spacingX",[ks],(function(){return 0})),Jlt=Ss(Vlt.prototype,"_spacingY",[ks],(function(){return 0})),Qlt=Ss(Vlt.prototype,"_verticalDirection",[ks],(function(){return oct.TOP_TO_BOTTOM})),Zlt=Ss(Vlt.prototype,"_horizontalDirection",[ks],(function(){return hct.LEFT_TO_RIGHT})),$lt=Ss(Vlt.prototype,"_constraint",[ks],(function(){return uct.NONE})),tct=Ss(Vlt.prototype,"_constraintNum",[ks],(function(){return 2})),ect=Ss(Vlt.prototype,"_affectedByScale",[ks],(function(){return!1})),ict=Ss(Vlt.prototype,"_isAlign",[ks],(function(){return!1})),Glt=Vlt))||Glt)||Glt)||Glt));v.Layout=Cct,function(t){t[t.HORIZONTAL=0]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL",t[t.FILLED=2]="FILLED"}(bct||(bct={})),me(bct);var Rct,wct,Ict,Bct,Dct,Pct,Oct,Mct,Nct,Lct,Fct,kct,Gct,Vct=t("fo",(cct=Is("cc.ProgressBar"),_ct=Ds(110),fct=Bs($F),dct=ha(ZV),pct=ha(bct),cct(mct=_ct(mct=fct(((Ect=function(t){function e(){for(var e,i=arguments.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=yct&&yct(),e._mode=vct&&vct(),e._totalLength=Sct&&Sct(),e._progress=Act&&Act(),e._reverse=Tct&&Tct(),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===ZV.FillType.RADIAL&&(this._mode=bct.FILLED),this._mode===bct.HORIZONTAL?this.totalLength=r.width:this._mode===bct.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 yn(0,.5),a=xi(this._progress),o=this._totalLength*a,h=n,u=0,l=0;switch(this._mode){case bct.HORIZONTAL:this._reverse&&(s=new yn(1,.5)),h=new An(o,n.height),u=this._totalLength,l=n.height;break;case bct.VERTICAL:s=this._reverse?new yn(.5,1):new yn(.5,0),h=new An(n.width,o),u=n.width,l=this._totalLength}if(this._mode===bct.FILLED)this._barSprite.type!==ZV.Type.FILLED?k("ProgressBar FILLED mode only works when barSprite's Type is FILLED!"):(this._reverse&&(o*=-1),this._barSprite.fillRange=o);else if(this._barSprite.type!==ZV.Type.FILLED){var c=s.x-i.x,_=s.y-i.y,f=new Yi(u*c,l*_,0);t.setPosition(r.x+f.x,r.y+f.y,r.z),e.setAnchorPoint(s),e.setContentSize(h)}else k("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===bct.HORIZONTAL?this.totalLength=i.width:this._mode===bct.VERTICAL?this.totalLength=i.height:this._mode===bct.FILLED&&(this.totalLength=this._barSprite.fillRange)}}},{key:"totalLength",get:function(){return this._totalLength},set:function(t){this._mode===bct.FILLED&&(t=xi(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}(Vd)).Mode=bct,p((gct=Ect).prototype,"barSprite",[dct],Object.getOwnPropertyDescriptor(gct.prototype,"barSprite"),gct.prototype),p(gct.prototype,"mode",[pct],Object.getOwnPropertyDescriptor(gct.prototype,"mode"),gct.prototype),yct=Ss(gct.prototype,"_barSprite",[ks],(function(){return null})),vct=Ss(gct.prototype,"_mode",[ks],(function(){return bct.HORIZONTAL})),Sct=Ss(gct.prototype,"_totalLength",[ks],(function(){return 1})),Act=Ss(gct.prototype,"_progress",[ks],(function(){return.1})),Tct=Ss(gct.prototype,"_reverse",[ks],(function(){return!1})),mct=gct))||mct)||mct)||mct));v.ProgressBar=Vct;var Uct,zct=new Yi,Hct=new Yi,Wct=new Yi,Xct=new yn,jct=new Zi,Yct=new yn;!function(t){t[t.HORIZONTAL=0]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(Uct||(Uct={})),ve(Uct);var qct,Kct=t("fp",(Rct=Is("cc.ScrollBar"),wct=Ds(110),Ict=Bs($F),Bct=ha(ZV),Dct=ha(Uct),Rct(Pct=wct(Pct=Ict(((Gct=function(t){function e(){for(var e,i=arguments.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=Mct&&Mct(),e._handle=Nct&&Nct(),e._direction=Lct&&Lct(),e._enableAutoHide=Fct&&Fct(),e._autoHideTime=kct&&kct(),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=Yct;l.set(0,0),this._direction===Uct.HORIZONTAL?(s=i.width,a=n.width,u=r.width,o=t.x,this._convertToScrollViewSpace(l,e),h=-l.x):this._direction===Uct.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),_=Yct;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(ZV);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){zct.set(-n.anchorX*n.width,-n.anchorY*n.height,0),n.convertToWorldSpaceAR(zct,Hct);var r=i.convertToNodeSpaceAR(Hct);r.x+=i.anchorX*i.width,r.y+=i.anchorY*i.height,t.set(r.x,r.y)}else t.set(yn.ZERO)},i._setOpacity=function(t){if(this._handle){var e=this.node.getComponent(ZV);e&&(jct.set(e.color),jct.a=t,e.color=jct),(e=this._handle.getComponent(ZV))&&(jct.set(e.color),jct.a=t,e.color=jct)}},i._updateHandlerPosition=function(t){if(this._handle){var e=Wct;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;Yi.set(zct,-i.width*n.x,-i.height*n.y,0);var a=this.node._uiProps.uiTransformComp.convertToWorldSpaceAR(zct,Hct),o=t;o.set(0,0,0),s._uiProps.uiTransformComp.convertToNodeSpaceAR(a,o),this.direction===Uct.HORIZONTAL?o.set(o.x,o.y+(i.height-r.height)/2,o.z):this.direction===Uct.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===Uct.HORIZONTAL||t.height<=e.height&&this._direction===Uct.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=xi(h=r/o));var u=(n-a)*h;this._direction===Uct.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===Xct.x&&n.y===Xct.y||e.setAnchorPoint(Xct),this._direction===Uct.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(yn.ZERO))}},{key:"direction",get:function(){return this._direction},set:function(t){this._direction!==t&&(this._direction=t,this.onScroll(yn.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}(Vd)).Direction=Uct,p((Oct=Gct).prototype,"handle",[Bct],Object.getOwnPropertyDescriptor(Oct.prototype,"handle"),Oct.prototype),p(Oct.prototype,"direction",[Dct],Object.getOwnPropertyDescriptor(Oct.prototype,"direction"),Oct.prototype),Mct=Ss(Oct.prototype,"_scrollView",[ks],(function(){return null})),Nct=Ss(Oct.prototype,"_handle",[ks],(function(){return null})),Lct=Ss(Oct.prototype,"_direction",[ks],(function(){return Uct.HORIZONTAL})),Fct=Ss(Oct.prototype,"_enableAutoHide",[ks],(function(){return!1})),kct=Ss(Oct.prototype,"_autoHideTime",[ks],(function(){return 1})),Pct=Oct))||Pct)||Pct)||Pct));v.ScrollBar=Kct;var Jct,Qct,Zct,$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,f_t,d_t,p_t,m_t,g_t=t("fu",Is("cc.ViewGroup")(qct=Ds(110)(qct=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(Vd))||qct)||qct);v.ViewGroup=g_t;var y_t,v_t,S_t=1e-4,A_t=new Yi,T_t=new Yi,E_t=new yn,b_t=new yn,x_t=function(){return(new Date).getMilliseconds()},C_t={"scroll-to-top":0,"scroll-to-bottom":1,"scroll-to-left":2,"scroll-to-right":3,scrolling:4,"bounce-bottom":6,"bounce-left":7,"bounce-right":8,"bounce-top":5,"scroll-ended":9,"touch-up":10,"scroll-ended-with-threshold":11,"scroll-began":12};!function(t){t.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"}(y_t||(y_t={})),function(t){t[t.NONE=0]="NONE",t[t.LEFT=1]="LEFT",t[t.RIGHT=2]="RIGHT"}(v_t||(v_t={}));var R_t,w_t,I_t,B_t,D_t,P_t,O_t,M_t,N_t,L_t,F_t,k_t,G_t,V_t=t("fq",(Jct=Is("cc.ScrollView"),Qct=Ds(110),Zct=Bs($F),$ct=ha(Pm),t_t=ha(Kct),e_t=ha(Kct),i_t=ha([Fd]),Jct(n_t=Qct(n_t=Zct(((m_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).bounceDuration=s_t&&s_t(),e.brake=a_t&&a_t(),e.elastic=o_t&&o_t(),e.inertia=h_t&&h_t(),e.horizontal=u_t&&u_t(),e.vertical=l_t&&l_t(),e.cancelInnerEvents=c_t&&c_t(),e.scrollEvents=__t&&__t(),e._autoScrolling=!1,e._scrolling=!1,e._content=f_t&&f_t(),e._horizontalScrollBar=d_t&&d_t(),e._verticalScrollBar=p_t&&p_t(),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 Yi,e._autoScrollTargetDelta=new Yi,e._autoScrollTotalTime=0,e._autoScrollAccumulatedTime=0,e._autoScrollCurrentlyOutOfBoundary=!1,e._autoScrollBraking=!1,e._autoScrollBrakingStartPosition=new Yi,e._outOfBoundaryAmount=new Yi,e._outOfBoundaryAmountDirty=!0,e._stopMouseWheel=!1,e._mouseWheelEventElapsedTime=0,e._isScrollEndedWithThresholdEventFired=!1,e._scrollEventEmitMask=0,e._isBouncing=!1,e._contentPos=new Yi,e._deltaPos=new Yi,e._hoverIn=v_t.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 yn(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 yn(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 yn(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 yn(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 yn(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 yn(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 yn(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 yn(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 yn(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 yn(e,t)},i.getMaxScrollOffset=function(){if(!this._content||!this.view)return yn.ZERO;var t=this._content._uiProps.uiTransformComp.contentSize,e=t.width-this.view.width,i=t.height-this.view.height;return new yn(e=e>=0?e:0,i=i>=0?i:0)},i.scrollToPercentHorizontal=function(t,e,i){var n=this._calculateMovePercentDelta({anchor:new yn(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 yn(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 yn(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)<S_t&&Math.abs(t.y-e.y)<S_t||(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):Yi.ZERO.clone()},i.isScrolling=function(){return this._scrolling},i.isAutoScrolling=function(){return this._autoScrolling},i.getScrollEndedEventTiming=function(){return S_t},i.start=function(){this._calculateBoundary(),this._content&&vN.once(yN.EVENT_BEFORE_DRAW,this._adjustContentOutOfBoundary,this)},i.onEnable=function(){this._registerEvent(),this._content&&(this._content.on(zp.SIZE_CHANGED,this._calculateBoundary,this),this._content.on(zp.TRANSFORM_CHANGED,this._scaleChanged,this),this.view&&(this.view.node.on(zp.TRANSFORM_CHANGED,this._scaleChanged,this),this.view.node.on(zp.SIZE_CHANGED,this._calculateBoundary,this))),this._calculateBoundary(),this._updateScrollBarState()},i.update=function(t){this._autoScrolling&&this._processAutoScrolling(t)},i.onDisable=function(){this._unregisterEvent(),this._content&&(this._content.off(zp.SIZE_CHANGED,this._calculateBoundary,this),this._content.off(zp.TRANSFORM_CHANGED,this._scaleChanged,this),this.view&&(this.view.node.off(zp.TRANSFORM_CHANGED,this._scaleChanged,this),this.view.node.off(zp.SIZE_CHANGED,this._calculateBoundary,this))),this._hideScrollBar(),this.stopAutoScroll()},i._registerEvent=function(){this.node.on(zp.TOUCH_START,this._onTouchBegan,this,!0),this.node.on(zp.TOUCH_MOVE,this._onTouchMoved,this,!0),this.node.on(zp.TOUCH_END,this._onTouchEnded,this,!0),this.node.on(zp.TOUCH_CANCEL,this._onTouchCancelled,this,!0),this.node.on(zp.MOUSE_WHEEL,this._onMouseWheel,this,!0),this.node.on(eut.XRUI_HOVER_ENTERED,this._xrHoverEnter,this),this.node.on(eut.XRUI_HOVER_EXITED,this._xrHoverExit,this),DC.on(BC.EventType.HANDLE_INPUT,this._dispatchEventHandleInput,this),DC.on(BC.EventType.GAMEPAD_INPUT,this._dispatchEventHandleInput,this)},i._unregisterEvent=function(){this.node.off(zp.TOUCH_START,this._onTouchBegan,this,!0),this.node.off(zp.TOUCH_MOVE,this._onTouchMoved,this,!0),this.node.off(zp.TOUCH_END,this._onTouchEnded,this,!0),this.node.off(zp.TOUCH_CANCEL,this._onTouchCancelled,this,!0),this.node.off(zp.MOUSE_WHEEL,this._onMouseWheel,this,!0),this.node.off(eut.XRUI_HOVER_ENTERED,this._xrHoverEnter,this),this.node.off(eut.XRUI_HOVER_EXITED,this._xrHoverExit,this),DC.off(BC.EventType.HANDLE_INPUT,this._dispatchEventHandleInput,this),DC.off(BC.EventType.GAMEPAD_INPUT,this._dispatchEventHandleInput,this)},i._onMouseWheel=function(t,e){if(this.enabledInHierarchy&&!this._hasNestedViewGroup(t,e)){var i=new Yi,n=t.getScrollY();this.vertical?i.set(0,-.1*n,0):this.horizontal&&i.set(-.1*n,0,0),this._mouseWheelEventElapsedTime=0,this._processDeltaMove(i),this._stopMouseWheel||(this._handlePressLogic(),this.schedule(this._checkMouseWheel,1/60,NaN,0),this._stopMouseWheel=!0),this._stopPropagationIfTargetIsMe(t)}},i._onTouchBegan=function(t,e){this.enabledInHierarchy&&this._content&&(this._hasNestedViewGroup(t,e)||(this._handlePressLogic(),this._touchMoved=!1,this._stopPropagationIfTargetIsMe(t)))},i._onTouchMoved=function(t,e){if(this.enabledInHierarchy&&this._content&&!this._hasNestedViewGroup(t,e)){var i=t.touch;if(this._handleMoveLogic(i),this.cancelInnerEvents){var n=i.getUILocation(E_t);if(n.subtract(i.getUIStartLocation(b_t)),n.length()>7&&!this._touchMoved&&t.target!==this.node){var r=new Ux(t.getTouches(),t.bubbles,Mx.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(y_t.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(Cct);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!==Lx.CAPTURING_PHASE)return!1;if(e)for(var i,n=f(e);!(i=n()).done;){var r=i.value;if(this.node===r)return!(!t.target||!t.target.getComponent(g_t));if(r.getComponent(g_t))return!0}return!1},i._startInertiaScroll=function(t){var e=new Yi(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,Yi.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(Yi.ZERO,S_t)||(this._autoScrollCurrentlyOutOfBoundary=!0)},i._calculateTouchMoveVelocity=function(){var t=new Yi,e=0;if((e=this._touchMoveTimeDeltas.reduce((function(t,e){return t+e}),e))<=0||e>=.5)t.set(Yi.ZERO);else{var i=new Yi;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);A_t.set(this._getContentPosition()),A_t.add(i),A_t.set(Math.round(1e4*A_t.x)*S_t,Math.round(1e4*A_t.y)*S_t,A_t.z),this._setContentPosition(A_t);var n=this._getHowMuchOutOfBoundary();E_t.set(n.x,n.y),this._updateScrollBar(E_t),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 Yi).equals(Yi.ZERO,S_t)&&!this._outOfBoundaryAmountDirty)return this._outOfBoundaryAmount;var e=new Yi,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(Yi.ZERO,S_t)&&(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===y_t.SCROLL_ENDED)this._scrollEventEmitMask=0;else if(t===y_t.SCROLL_TO_TOP||t===y_t.SCROLL_TO_BOTTOM||t===y_t.SCROLL_TO_LEFT||t===y_t.SCROLL_TO_RIGHT){var e=1<<C_t[t];if(this._scrollEventEmitMask&e)return;this._scrollEventEmitMask|=e}Fd.emitEvents(this.scrollEvents,this,C_t[t]),this.node.emit(t,this)},i._adjustContentOutOfBoundary=function(){if(this._content&&(this._outOfBoundaryAmountDirty=!0,this._isOutOfBoundary())){var t=this._getHowMuchOutOfBoundary();A_t.set(this._getContentPosition()),A_t.add(t),this._setContentPosition(A_t),this._updateScrollBar(yn.ZERO)}},i._hideScrollBar=function(){this._horizontalScrollBar&&this._horizontalScrollBar.isValid&&this._horizontalScrollBar.hide(),this._verticalScrollBar&&this._verticalScrollBar.isValid&&this._verticalScrollBar.hide()},i._updateScrollBarState=function(){if(this._content&&this.view){var t=this.view,e=this._content._uiProps.uiTransformComp;this._verticalScrollBar&&this._verticalScrollBar.isValid&&(e.height<t.height?this._verticalScrollBar.hide():this._verticalScrollBar.show()),this._horizontalScrollBar&&this._horizontalScrollBar.isValid&&(e.width<t.width?this._horizontalScrollBar.hide():this._horizontalScrollBar.show())}},i._stopPropagationIfTargetIsMe=function(t){t.eventPhase===Lx.AT_TARGET&&t.target===this.node&&(t.propagationStopped=!0)},i._processDeltaMove=function(t){this._scrollChildren(t),this._gatherTouchMove(t)},i._handleMoveLogic=function(t){this._getLocalAxisAlignDelta(this._deltaPos,t),this._processDeltaMove(this._deltaPos)},i._handleReleaseLogic=function(t){this._getLocalAxisAlignDelta(this._deltaPos,t),this._gatherTouchMove(this._deltaPos),this._processInertiaScroll(),this._scrolling&&(this._scrolling=!1,this._autoScrolling||this._dispatchEvent(y_t.SCROLL_ENDED))},i._getLocalAxisAlignDelta=function(t,e){var i=this.node._uiProps.uiTransformComp,n=new Yi;i&&(e.getUILocation(E_t),e.getUIPreviousLocation(b_t),A_t.set(E_t.x,E_t.y,0),T_t.set(b_t.x,b_t.y,0),i.convertToNodeSpaceAR(A_t,A_t),i.convertToNodeSpaceAR(T_t,T_t),Yi.subtract(n,A_t,T_t)),t.set(n)},i._scrollChildren=function(t){this._clampDelta(t);var e,i=t;this.elastic&&(e=this._getHowMuchOutOfBoundary(),i.x*=0===e.x?1:.5,i.y*=0===e.y?1:.5),this.elastic||(e=this._getHowMuchOutOfBoundary(i),i.add(e));var n="",r="";if(this._content){var s=this._content._uiProps.uiTransformComp,a=s.anchorX,o=s.anchorY,h=s.width,u=s.height,l=this._content.position||Yi.ZERO;this.vertical&&(i.y>0?l.y-o*u+i.y>=this._bottomBoundary&&(n=y_t.SCROLL_TO_BOTTOM):i.y<0&&l.y-o*u+u+i.y<=this._topBoundary&&(n=y_t.SCROLL_TO_TOP)),this.horizontal&&(i.x<0?l.x-a*h+h+i.x<=this._rightBoundary&&(r=y_t.SCROLL_TO_RIGHT):i.x>0&&l.x-a*h+i.x>=this._leftBoundary&&(r=y_t.SCROLL_TO_LEFT))}this._moveContent(i,!1),(this.horizontal&&0!==i.x||this.vertical&&0!==i.y)&&(this._scrolling||(this._scrolling=!0,this._dispatchEvent(y_t.SCROLL_BEGAN)),this._dispatchEvent(y_t.SCROLLING)),""!==n&&this._dispatchEvent(n),""!==r&&this._dispatchEvent(r)},i._handlePressLogic=function(){this._autoScrolling&&this._dispatchEvent(y_t.SCROLL_ENDED),this._autoScrolling=!1,this._isBouncing=!1,this._touchMovePreviousTimestamp=x_t(),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=x_t();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(Yi.ZERO,S_t))return!1;var e=Math.max(this.bounceDuration,0);return this._startAutoScroll(t,e,!0),this._isBouncing||(t.y>0&&this._dispatchEvent(y_t.BOUNCE_TOP),t.y<0&&this._dispatchEvent(y_t.BOUNCE_BOTTOM),t.x>0&&this._dispatchEvent(y_t.BOUNCE_RIGHT),t.x<0&&this._dispatchEvent(y_t.BOUNCE_LEFT),this._isBouncing=!0),!0},i._processInertiaScroll=function(){if(!this._startBounceBackIfNeeded()&&this.inertia){var t=this._calculateTouchMoveVelocity();!t.equals(A_t,S_t)&&this.brake<1&&this._startInertiaScroll(t)}this._onScrollBarTouchEnded()},i._isOutOfBoundary=function(){return!this._getHowMuchOutOfBoundary().equals(Yi.ZERO,S_t)},i._isNecessaryAutoScrollBrake=function(){if(this._autoScrollBraking)return!0;if(this._isOutOfBoundary()){if(!this._autoScrollCurrentlyOutOfBoundary)return this._autoScrollCurrentlyOutOfBoundary=!0,this._autoScrollBraking=!0,Yi.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)<=S_t;if(Math.abs(r-1)<=this.getScrollEndedEventTiming()&&!this._isScrollEndedWithThresholdEventFired&&(this._dispatchEvent(y_t.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(Yi.ZERO,S_t)||(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(y_t.SCROLLING),this._autoScrolling||(this._isBouncing=!1,this._scrolling=!1,this._dispatchEvent(y_t.SCROLL_ENDED))},i._checkMouseWheel=function(t){if(!this._getHowMuchOutOfBoundary().equals(Yi.ZERO,S_t))return this._processInertiaScroll(),this.unschedule(this._checkMouseWheel),this._dispatchEvent(y_t.SCROLL_ENDED),void(this._stopMouseWheel=!1);this._mouseWheelEventElapsedTime+=t,this._mouseWheelEventElapsedTime>.1&&(this._onScrollBarTouchEnded(),this.unschedule(this._checkMouseWheel),this._dispatchEvent(y_t.SCROLL_ENDED),this._stopMouseWheel=!1)},i._calculateMovePercentDelta=function(t){var e=t.anchor,i=t.applyToHorizontal,n=t.applyToVertical;this._calculateBoundary(),e.clampf(yn.ZERO,yn.ONE);var r=this._getContentBottomBoundary()-this._bottomBoundary;r=-r;var s=this._getContentLeftBoundary()-this._leftBoundary;s=-s;var a=new Yi;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 Yi,n=0,r=this._getContentLeftBoundary()-this._leftBoundary;if(r=-r,this._content){var s=this._content._uiProps.uiTransformComp.contentSize;s.height<t.height&&(n=s.height-t.height,i.y=e-n),s.width<t.width&&(n=s.width-t.width,i.x=r)}this._updateScrollBarState(),this._moveContent(i),this._adjustContentOutOfBoundary()},i._scaleChanged=function(t){t===Vp.SCALE&&this._calculateBoundary()},i._xrHoverEnter=function(t){t.deviceType===tut.Left?this._hoverIn=v_t.LEFT:t.deviceType===tut.Right&&(this._hoverIn=v_t.RIGHT)},i._xrHoverExit=function(){this._hoverIn=v_t.NONE},i._dispatchEventHandleInput=function(t){var e,i;t instanceof Hx?e=t.gamepad:t instanceof Wx&&(e=t.handleInputDevice),this.enabledInHierarchy&&this._hoverIn!==v_t.NONE&&(this._hoverIn===v_t.LEFT?(i=e.leftStick.getValue()).equals(yn.ZERO)||this._xrThumbStickMove(i):this._hoverIn===v_t.RIGHT&&((i=e.rightStick.getValue()).equals(yn.ZERO)||this._xrThumbStickMove(i)))},i._xrThumbStickMove=function(t){if(this.enabledInHierarchy){var e=new Yi,i=t.y;this.vertical?e.set(0,-62.5*i,0):this.horizontal&&e.set(-62.5*i,0,0),this._mouseWheelEventElapsedTime=0,this._processDeltaMove(e),this._stopMouseWheel||(this._handlePressLogic(),this.schedule(this._checkMouseWheel,1/60,NaN,0),this._stopMouseWheel=!0)}},n(e,[{key:"content",get:function(){return this._content},set:function(t){if(this._content!==t){var e=t&&t.parent&&t.parent._uiProps.uiTransformComp;!t||t&&e?(this._content=t,this._calculateBoundary()):j(4302)}}},{key:"horizontalScrollBar",get:function(){return this._horizontalScrollBar&&!this._horizontalScrollBar.isValid&&J(4303,"horizontal",this.node.name),this._horizontalScrollBar},set:function(t){this._horizontalScrollBar!==t&&(this._horizontalScrollBar=t,this._horizontalScrollBar&&(this._horizontalScrollBar.setScrollView(this),this._updateScrollBar(yn.ZERO)))}},{key:"verticalScrollBar",get:function(){return this._verticalScrollBar&&!this._verticalScrollBar.isValid&&J(4303,"vertical",this.node.name),this._verticalScrollBar},set:function(t){this._verticalScrollBar!==t&&(this._verticalScrollBar=t,this._verticalScrollBar&&(this._verticalScrollBar.setScrollView(this),this._updateScrollBar(yn.ZERO)))}},{key:"view",get:function(){var t=this._content&&this._content.parent;return t?t._uiProps.uiTransformComp:null}}]),e}(g_t)).EventType=y_t,s_t=Ss((r_t=m_t).prototype,"bounceDuration",[ks],(function(){return 1})),a_t=Ss(r_t.prototype,"brake",[ks],(function(){return.5})),o_t=Ss(r_t.prototype,"elastic",[ks],(function(){return!0})),h_t=Ss(r_t.prototype,"inertia",[ks],(function(){return!0})),p(r_t.prototype,"content",[$ct],Object.getOwnPropertyDescriptor(r_t.prototype,"content"),r_t.prototype),u_t=Ss(r_t.prototype,"horizontal",[ks],(function(){return!0})),p(r_t.prototype,"horizontalScrollBar",[t_t],Object.getOwnPropertyDescriptor(r_t.prototype,"horizontalScrollBar"),r_t.prototype),l_t=Ss(r_t.prototype,"vertical",[ks],(function(){return!0})),p(r_t.prototype,"verticalScrollBar",[e_t],Object.getOwnPropertyDescriptor(r_t.prototype,"verticalScrollBar"),r_t.prototype),c_t=Ss(r_t.prototype,"cancelInnerEvents",[ks],(function(){return!0})),__t=Ss(r_t.prototype,"scrollEvents",[i_t,ks],(function(){return[]})),f_t=Ss(r_t.prototype,"_content",[ks],(function(){return null})),d_t=Ss(r_t.prototype,"_horizontalScrollBar",[ks],(function(){return null})),p_t=Ss(r_t.prototype,"_verticalScrollBar",[ks],(function(){return null})),n_t=r_t))||n_t)||n_t)||n_t));v.ScrollView=V_t;var U_t,z_t=new Yi;!function(t){t[t.Horizontal=0]="Horizontal",t[t.Vertical=1]="Vertical"}(U_t||(U_t={})),ve(U_t);var H_t,W_t,X_t,j_t,Y_t,q_t,K_t,J_t,Q_t,Z_t,$_t,tft,eft=t("fr",(R_t=Is("cc.Slider"),w_t=Ds(110),I_t=Bs($F),B_t=ha(ZV),D_t=ha(U_t),P_t=ha([Fd]),R_t(O_t=w_t(O_t=I_t(((G_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).slideEvents=N_t&&N_t(),e._handle=L_t&&L_t(),e._direction=F_t&&F_t(),e._progress=k_t&&k_t(),e._offset=new Yi,e._dragging=!1,e._touchHandle=!1,e._handleLocalPos=new Yi,e._touchPos=new Yi,e}s(e,t);var i=e.prototype;return i.__preload=function(){this._updateHandlePosition()},i.onEnable=function(){this._updateHandlePosition(),this.node.on(zp.TOUCH_START,this._onTouchBegan,this),this.node.on(zp.TOUCH_MOVE,this._onTouchMoved,this),this.node.on(zp.TOUCH_END,this._onTouchEnded,this),this.node.on(zp.TOUCH_CANCEL,this._onTouchCancelled,this),this.node.on(eut.XRUI_HOVER_STAY,this._xrHoverStay,this),this.node.on(eut.XRUI_CLICK,this._xrClick,this),this.node.on(eut.XRUI_UNCLICK,this._xrUnClick,this),this._handle&&this._handle.isValid&&(this._handle.node.on(zp.TOUCH_START,this._onHandleDragStart,this),this._handle.node.on(zp.TOUCH_MOVE,this._onTouchMoved,this),this._handle.node.on(zp.TOUCH_END,this._onTouchEnded,this))},i.onDisable=function(){this.node.off(zp.TOUCH_START,this._onTouchBegan,this),this.node.off(zp.TOUCH_MOVE,this._onTouchMoved,this),this.node.off(zp.TOUCH_END,this._onTouchEnded,this),this.node.off(zp.TOUCH_CANCEL,this._onTouchCancelled,this),this.node.off(eut.XRUI_HOVER_STAY,this._xrHoverStay,this),this.node.off(eut.XRUI_CLICK,this._xrClick,this),this.node.off(eut.XRUI_UNCLICK,this._xrUnClick,this),this._handle&&this._handle.isValid&&(this._handle.node.off(zp.TOUCH_START,this._onHandleDragStart,this),this._handle.node.off(zp.TOUCH_MOVE,this._onTouchMoved,this),this._handle.node.off(zp.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();Yi.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 Yi,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(){Fd.emitEvents(this.slideEvents,this),this.node.emit("slide",this)},i._updateProgress=function(t){if(this._handle&&t){var e=t.getUILocation();Yi.set(this._touchPos,e.x,e.y,0);var i=this.node._uiProps.uiTransformComp,n=i.convertToNodeSpaceAR(this._touchPos,z_t);this.direction===U_t.Horizontal?this.progress=xi(.5+(n.x-this._offset.x)/i.width):this.progress=xi(.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===U_t.Horizontal?this._handleLocalPos.x=-t.width*t.anchorX+this.progress*t.width:this._handleLocalPos.y=-t.height*t.anchorY+this.progress*t.height,this._handle.node.setPosition(this._handleLocalPos)}},i._changeLayout=function(){var t=this.node._uiProps.uiTransformComp,e=t.contentSize;if(t.setContentSize(e.height,e.width),this._handle){var i=this._handle.node.position;this._direction===U_t.Horizontal?this._handle.node.setPosition(i.x,0,i.z):this._handle.node.setPosition(0,i.y,i.z),this._updateHandlePosition()}},i._xrHandleProgress=function(t){if(!this._touchHandle){var e=this.node._uiProps.uiTransformComp;e.convertToNodeSpaceAR(t,z_t),this.direction===U_t.Horizontal?this.progress=xi(.5+(z_t.x-this.node.position.x)/e.width):this.progress=xi(.5+(z_t.y-this.node.position.y)/e.height)}},i._xrClick=function(t){this._handle&&(this._dragging=!0,this._xrHandleProgress(t.hitPoint),this._emitSlideEvent())},i._xrUnClick=function(){this._dragging=!1,this._touchHandle=!1},i._xrHoverStay=function(t){this._dragging&&(this._xrHandleProgress(t.hitPoint),this._emitSlideEvent())},n(e,[{key:"handle",get:function(){return this._handle},set:function(t){this._handle!==t&&(this._handle=t)}},{key:"direction",get:function(){return this._direction},set:function(t){this._direction!==t&&(this._direction=t,this._changeLayout())}},{key:"progress",get:function(){return this._progress},set:function(t){this._progress!==t&&(this._progress=t,this._updateHandlePosition())}}]),e}(Vd)).Direction=U_t,p((M_t=G_t).prototype,"handle",[B_t],Object.getOwnPropertyDescriptor(M_t.prototype,"handle"),M_t.prototype),p(M_t.prototype,"direction",[D_t],Object.getOwnPropertyDescriptor(M_t.prototype,"direction"),M_t.prototype),N_t=Ss(M_t.prototype,"slideEvents",[P_t,ks],(function(){return[]})),L_t=Ss(M_t.prototype,"_handle",[ks],(function(){return null})),F_t=Ss(M_t.prototype,"_direction",[ks],(function(){return U_t.Horizontal})),k_t=Ss(M_t.prototype,"_progress",[ks],(function(){return.1})),O_t=M_t))||O_t)||O_t)||O_t));function ift(){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=eft,function(t){t.TOGGLE="toggle"}(tft||(tft={}));var nft,rft,sft,aft,oft,hft,uft,lft=t("fs",(H_t=Is("cc.Toggle"),W_t=Ds(110),X_t=Bs($F),j_t=ha(ZV),Y_t=ha([Fd]),H_t(q_t=W_t(q_t=X_t((($_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).checkEvents=J_t&&J_t(),e._isChecked=Q_t&&Q_t(),e._checkMark=Z_t&&Z_t(),e}s(e,t);var i=e.prototype;return i._internalToggle=function(){this.isChecked=!this.isChecked},i._set=function(t,e){if(void 0===e&&(e=!0),this._isChecked!=t){this._isChecked=t;var i=this._toggleContainer;i&&i.enabled&&this.enabled&&(t||!i.anyTogglesChecked()&&!i.allowSwitchOff)&&(this._isChecked=!0,i.notifyToggleCheck(this,e)),this.playEffect(),e&&this._emitToggleEvents()}},i.playEffect=function(){this._checkMark&&(this._checkMark.node.active=this._isChecked)},i.setIsCheckedWithoutNotify=function(t){this._set(t,!1)},i.onEnable=function(){t.prototype.onEnable.call(this),this.playEffect(),this.node.on(e.EventType.CLICK,this._internalToggle,this)},i.onDisable=function(){t.prototype.onDisable.call(this),this.node.off(e.EventType.CLICK,this._internalToggle,this)},i._emitToggleEvents=function(){this.node.emit(e.EventType.TOGGLE,this),this.checkEvents&&Fd.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}(Uut)).EventType=ift(tft,Gut),p((K_t=$_t).prototype,"checkMark",[j_t],Object.getOwnPropertyDescriptor(K_t.prototype,"checkMark"),K_t.prototype),J_t=Ss(K_t.prototype,"checkEvents",[Y_t,ks],(function(){return[]})),Q_t=Ss(K_t.prototype,"_isChecked",[ks],(function(){return!0})),Z_t=Ss(K_t.prototype,"_checkMark",[ks],(function(){return null})),q_t=K_t))||q_t)||q_t)||q_t));v.Toggle=lft;var cft,_ft,fft,dft,pft,mft,gft,yft,vft,Sft,Aft,Tft,Eft,bft,xft,Cft,Rft,wft,Ift,Bft,Dft,Pft,Oft,Mft,Nft,Lft,Fft=t("ft",(nft=Is("cc.ToggleContainer"),rft=Ds(110),sft=ha([Fd]),nft(aft=rft((oft=function(t){function e(){for(var e,i=arguments.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=hft&&hft(),e.checkEvents=uft&&uft(),e}s(e,t);var i=e.prototype;return i.onEnable=function(){this.ensureValidState(),this.node.on(zp.CHILD_ADDED,this.ensureValidState,this),this.node.on(zp.CHILD_REMOVED,this.ensureValidState,this)},i.onDisable=function(){this.node.off(zp.CHILD_ADDED,this.ensureValidState,this),this.node.off(zp.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}(Vd),hft=Ss(oft.prototype,"_allowSwitchOff",[ks],(function(){return!1})),uft=Ss(oft.prototype,"checkEvents",[sft,ks],(function(){return[]})),aft=oft))||aft)||aft));v.ToggleContainer=Fft;var kft,Gft,Vft=new yn;function Uft(t){return t instanceof Px?ll:t._uiProps.uiTransformComp?t._uiProps.uiTransformComp.contentSize:An.ZERO}function zft(t,e,i,n){t.parent?Vft.set(t.parent.getScale().x,t.parent.getScale().y):Vft.set(0,0);for(var r=Vft.x,s=Vft.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?Vft.set(h.getScale().x,h.getScale().y):Vft.set(0,0);var l=Vft.x,c=Vft.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"}(kft||(kft={})),ve(kft),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"}(Gft||(Gft={}));var Hft,Wft,Xft,jft,Yft,qft,Kft,Jft,Qft,Zft,$ft,tdt,edt=Gft.TOP|Gft.BOT,idt=Gft.LEFT|Gft.RIGHT,ndt=t("fv",(cft=Is("cc.Widget"),_ft=Ds(110),fft=Bs($F),dft=ha(Pm),pft=ha(kft),cft(mft=_ft(mft=fft(((Lft=function(t){function e(){for(var e,i=arguments.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 Yi,e._lastSize=new An,e._dirty=!0,e._hadAlignOnce=!1,e._alignFlags=yft&&yft(),e._target=vft&&vft(),e._left=Sft&&Sft(),e._right=Aft&&Aft(),e._top=Tft&&Tft(),e._bottom=Eft&&Eft(),e._horizontalCenter=bft&&bft(),e._verticalCenter=xft&&xft(),e._isAbsLeft=Cft&&Cft(),e._isAbsRight=Rft&&Rft(),e._isAbsTop=wft&&wft(),e._isAbsBottom=Ift&&Ift(),e._isAbsHorizontalCenter=Bft&&Bft(),e._isAbsVerticalCenter=Dft&&Dft(),e._originalWidth=Pft&&Pft(),e._originalHeight=Oft&&Oft(),e._alignMode=Mft&&Mft(),e._lockFlags=Nft&&Nft(),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(zp.TRANSFORM_CHANGED,this._setDirtyByMode,this),this.node.on(zp.SIZE_CHANGED,this._setDirtyByMode,this),this.node.on(zp.ANCHOR_CHANGED,this._adjustWidgetToAnchorChanged,this),this.node.on(zp.PARENT_CHANGED,this._adjustTargetToParentChanged,this)},i._unregisterEvent=function(){this.node.off(zp.TRANSFORM_CHANGED,this._setDirtyByMode,this),this.node.off(zp.SIZE_CHANGED,this._setDirtyByMode,this),this.node.off(zp.ANCHOR_CHANGED,this._adjustWidgetToAnchorChanged,this)},i._removeParentEvent=function(){this.node.off(zp.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:ll;this.isAlignLeft&&t===Gft.LEFT?this._left=e?this._left*r.width:this._left/r.width:this.isAlignRight&&t===Gft.RIGHT?this._right=e?this._right*r.width:this._right/r.width:this.isAlignHorizontalCenter&&t===Gft.CENTER?this._horizontalCenter=e?this._horizontalCenter*r.width:this._horizontalCenter/r.width:this.isAlignTop&&t===Gft.TOP?this._top=e?this._top*r.height:this._top/r.height:this.isAlignBottom&&t===Gft.BOT?this._bottom=e?this._bottom*r.height:this._bottom/r.height:this.isAbsoluteVerticalCenter&&t===Gft.MID&&(this._verticalCenter=this._verticalCenter/r.height),this._recursiveDirty()}},i._registerTargetEvents=function(){var t=this._target||this.node.parent;t&&t.getComponent($F)&&(t.on(zp.TRANSFORM_CHANGED,this._setDirtyByMode,this),t.on(zp.SIZE_CHANGED,this._setDirtyByMode,this),t.on(zp.ANCHOR_CHANGED,this._setDirtyByMode,this))},i._unregisterTargetEvents=function(){var t=this._target||this.node.parent;t&&(t.off(zp.TRANSFORM_CHANGED,this._setDirtyByMode,this),t.off(zp.SIZE_CHANGED,this._setDirtyByMode,this),t.off(zp.ANCHOR_CHANGED,this._setDirtyByMode,this))},i._unregisterOldParentEvents=function(t){var e=this._target||t;e&&(e.off(zp.TRANSFORM_CHANGED,this._setDirtyByMode,this),e.off(zp.SIZE_CHANGED,this._setDirtyByMode,this))},i._setDirtyByMode=function(){this.alignMode===kft.ALWAYS&&this._recursiveDirty()},i._setAlign=function(t,e){if(e!==(this._alignFlags&t)>0){var i=(t&idt)>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&Gft.TOP)>0},set:function(t){this._setAlign(Gft.TOP,t),this._recursiveDirty()}},{key:"isAlignBottom",get:function(){return(this._alignFlags&Gft.BOT)>0},set:function(t){this._setAlign(Gft.BOT,t),this._recursiveDirty()}},{key:"isAlignLeft",get:function(){return(this._alignFlags&Gft.LEFT)>0},set:function(t){this._setAlign(Gft.LEFT,t),this._recursiveDirty()}},{key:"isAlignRight",get:function(){return(this._alignFlags&Gft.RIGHT)>0},set:function(t){this._setAlign(Gft.RIGHT,t),this._recursiveDirty()}},{key:"isAlignVerticalCenter",get:function(){return(this._alignFlags&Gft.MID)>0},set:function(t){t?(this.isAlignTop=!1,this.isAlignBottom=!1,this._alignFlags|=Gft.MID):this._alignFlags&=~Gft.MID,this._recursiveDirty()}},{key:"isAlignHorizontalCenter",get:function(){return(this._alignFlags&Gft.CENTER)>0},set:function(t){t?(this.isAlignLeft=!1,this.isAlignRight=!1,this._alignFlags|=Gft.CENTER):this._alignFlags&=~Gft.CENTER,this._recursiveDirty()}},{key:"isStretchWidth",get:function(){return(this._alignFlags&idt)===idt}},{key:"isStretchHeight",get:function(){return(this._alignFlags&edt)===edt}},{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(Gft.TOP,this._isAbsTop))}},{key:"isAbsoluteBottom",get:function(){return this._isAbsBottom},set:function(t){this._isAbsBottom!==t&&(this._isAbsBottom=t,this._autoChangedValue(Gft.BOT,this._isAbsBottom))}},{key:"isAbsoluteLeft",get:function(){return this._isAbsLeft},set:function(t){this._isAbsLeft!==t&&(this._isAbsLeft=t,this._autoChangedValue(Gft.LEFT,this._isAbsLeft))}},{key:"isAbsoluteRight",get:function(){return this._isAbsRight},set:function(t){this._isAbsRight!==t&&(this._isAbsRight=t,this._autoChangedValue(Gft.RIGHT,this._isAbsRight))}},{key:"isAbsoluteHorizontalCenter",get:function(){return this._isAbsHorizontalCenter},set:function(t){this._isAbsHorizontalCenter!==t&&(this._isAbsHorizontalCenter=t,this._autoChangedValue(Gft.CENTER,this._isAbsHorizontalCenter))}},{key:"isAbsoluteVerticalCenter",get:function(){return this._isAbsVerticalCenter},set:function(t){this._isAbsVerticalCenter!==t&&(this._isAbsVerticalCenter=t,this._autoChangedValue(Gft.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}(Vd)).AlignMode=kft,p((gft=Lft).prototype,"target",[dft],Object.getOwnPropertyDescriptor(gft.prototype,"target"),gft.prototype),p(gft.prototype,"alignMode",[pft],Object.getOwnPropertyDescriptor(gft.prototype,"alignMode"),gft.prototype),yft=Ss(gft.prototype,"_alignFlags",[ks],(function(){return 0})),vft=Ss(gft.prototype,"_target",[ks],(function(){return null})),Sft=Ss(gft.prototype,"_left",[ks],(function(){return 0})),Aft=Ss(gft.prototype,"_right",[ks],(function(){return 0})),Tft=Ss(gft.prototype,"_top",[ks],(function(){return 0})),Eft=Ss(gft.prototype,"_bottom",[ks],(function(){return 0})),bft=Ss(gft.prototype,"_horizontalCenter",[ks],(function(){return 0})),xft=Ss(gft.prototype,"_verticalCenter",[ks],(function(){return 0})),Cft=Ss(gft.prototype,"_isAbsLeft",[ks],(function(){return!0})),Rft=Ss(gft.prototype,"_isAbsRight",[ks],(function(){return!0})),wft=Ss(gft.prototype,"_isAbsTop",[ks],(function(){return!0})),Ift=Ss(gft.prototype,"_isAbsBottom",[ks],(function(){return!0})),Bft=Ss(gft.prototype,"_isAbsHorizontalCenter",[ks],(function(){return!0})),Dft=Ss(gft.prototype,"_isAbsVerticalCenter",[ks],(function(){return!0})),Pft=Ss(gft.prototype,"_originalWidth",[ks],(function(){return 0})),Oft=Ss(gft.prototype,"_originalHeight",[ks],(function(){return 0})),Mft=Ss(gft.prototype,"_alignMode",[ks],(function(){return kft.ON_WINDOW_RESIZE})),Nft=Ss(gft.prototype,"_lockFlags",[ks,Vs],(function(){return 0})),mft=gft))||mft)||mft)||mft));v.internal.computeInverseTransForTarget=zft,v.internal.getReadonlyNodeSize=Uft,v.Widget=ndt;var rdt,sdt=new Zi;!function(t){t[t.HORIZONTAL=0]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(rdt||(rdt={})),ve(rdt);var adt,odt,hdt,udt,ldt,cdt,_dt,fdt,ddt,pdt,mdt,gdt,ydt,vdt,Sdt,Adt,Tdt,Edt,bdt,xdt,Cdt,Rdt,wdt,Idt,Bdt=t("fx",(Hft=Is("cc.PageViewIndicator"),Wft=Ds(110),Xft=ha(lL),jft=ha(rdt),Yft=ha(An),Hft(qft=Wft(((tdt=function(t){function e(){for(var e,i=arguments.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=Jft&&Jft(),e._spriteFrame=Qft&&Qft(),e._direction=Zft&&Zft(),e._cellSize=$ft&&$ft(),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(Cct),this._layout||(this._layout=this.addComponent(Cct));var t=this._layout;this.direction===rdt.HORIZONTAL?(t.type=Cct.Type.HORIZONTAL,t.spacingX=this.spacing):this.direction===rdt.VERTICAL&&(t.type=Cct.Type.VERTICAL,t.spacingY=this.spacing),t.resizeMode=Cct.ResizeMode.CONTAINER},i._createIndicator=function(){var t=new Pm;t.layer=this.node.layer;var e=t.addComponent(ZV);return e.spriteFrame=this.spriteFrame,e.sizeMode=ZV.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;sdt.set(r.color),sdt.a=127.5,r.color=sdt}}if(t[e]._uiProps.uiComp){var s=t[e]._uiProps.uiComp;sdt.set(s.color),sdt.a=255,s.color=sdt}}}},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}(Vd)).Direction=rdt,p((Kft=tdt).prototype,"spriteFrame",[Xft],Object.getOwnPropertyDescriptor(Kft.prototype,"spriteFrame"),Kft.prototype),p(Kft.prototype,"direction",[jft],Object.getOwnPropertyDescriptor(Kft.prototype,"direction"),Kft.prototype),p(Kft.prototype,"cellSize",[Yft],Object.getOwnPropertyDescriptor(Kft.prototype,"cellSize"),Kft.prototype),Jft=Ss(Kft.prototype,"spacing",[ks],(function(){return 0})),Qft=Ss(Kft.prototype,"_spriteFrame",[ks],(function(){return null})),Zft=Ss(Kft.prototype,"_direction",[ks],(function(){return rdt.HORIZONTAL})),$ft=Ss(Kft.prototype,"_cellSize",[ks],(function(){return new An(20,20)})),qft=Kft))||qft)||qft));v.PageViewIndicator=Bdt;var Ddt,Pdt,Odt,Mdt=new yn;!function(t){t[t.Unified=0]="Unified",t[t.Free=1]="Free"}(Ddt||(Ddt={})),ve(Ddt),function(t){t[t.Horizontal=0]="Horizontal",t[t.Vertical=1]="Vertical"}(Pdt||(Pdt={})),ve(Pdt),function(t){t.PAGE_TURNING="page-turning"}(Odt||(Odt={}));var Ndt=t("fw",(adt=Is("cc.PageView"),odt=Ds(110),hdt=ha(Ddt),udt=ha(Pdt),ldt=ha(Bdt),cdt=ha(Kct),_dt=ha(Kct),fdt=ha([Fd]),ddt=ha([Fd]),adt(pdt=odt(((Idt=function(t){function e(){for(var e,i=arguments.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=gdt&&gdt(),e.horizontal=ydt&&ydt(),e.vertical=vdt&&vdt(),e.cancelInnerEvents=Sdt&&Sdt(),e.scrollEvents=Adt&&Adt(),e.pageTurningSpeed=Tdt&&Tdt(),e.pageEvents=Edt&&Edt(),e._sizeMode=bdt&&bdt(),e._direction=xdt&&xdt(),e._scrollThreshold=Cdt&&Cdt(),e._pageTurningEventTiming=Rdt&&Rdt(),e._indicator=wdt&&wdt(),e._curPageIdx=0,e._lastPageIdx=0,e._pages=[],e._initContentPos=new Yi,e._scrollCenterOffsetX=[],e._scrollCenterOffsetY=[],e._touchBeganPosition=new yn,e._touchEndPosition=new yn,e}s(e,t);var i=e.prototype;return i.onEnable=function(){t.prototype.onEnable.call(this),this.node.on(zp.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(zp.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()):j(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 j(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(Cct);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===Pdt.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===Ddt.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(Mdt),yn.set(this._touchBeganPosition,Mdt.x,Mdt.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(Mdt),yn.set(this._touchEndPosition,Mdt.x,Mdt.y),t.prototype._onTouchEnded.call(this,e,i)},i._onTouchCancelled=function(e,i){e.touch.getUILocation(Mdt),yn.set(this._touchEndPosition,Mdt.x,Mdt.y),t.prototype._onTouchCancelled.call(this,e,i)},i._onMouseWheel=function(){},i._syncScrollDirection=function(){this.horizontal=this.direction===Pdt.Horizontal,this.vertical=this.direction===Pdt.Vertical},i._syncSizeMode=function(){var t=this.view;if(this.content&&t){var e=this.content.getComponent(Cct);if(e){if(this._sizeMode===Ddt.Free&&this._pages.length>0){var i=this._pages[0]._uiProps.uiTransformComp,n=this._pages[this._pages.length-1]._uiProps.uiTransformComp;this.direction===Pdt.Horizontal?(e.paddingLeft=(t.width-i.width)/2,e.paddingRight=(t.width-n.width)/2):this.direction===Pdt.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,Fd.emitEvents(this.pageEvents,this,Odt.PAGE_TURNING),this.node.emit(Odt.PAGE_TURNING,this))},i._isQuicklyScrollable=function(t){if(this.direction===Pdt.Horizontal){if(Math.abs(t.x)>this.autoPageTurningThreshold)return!0}else if(this.direction===Pdt.Vertical&&Math.abs(t.y)>this.autoPageTurningThreshold)return!0;return!1},i._moveOffsetValue=function(t){var e=new yn;if(this._sizeMode===Ddt.Free)this.direction===Pdt.Horizontal?e.x=this._scrollCenterOffsetX[t]:this.direction===Pdt.Vertical&&(e.y=this._scrollCenterOffsetY[t]);else{var i=this.view;if(!i)return e;this.direction===Pdt.Horizontal?e.x=t*i.width:this.direction===Pdt.Vertical&&(e.y=t*i.height)}return e},i._getDragDirection=function(t){return this._direction===Pdt.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===Ddt.Free){var n=0,r=0;if(this.direction===Pdt.Horizontal)return n=this._scrollCenterOffsetX[e],r=this._scrollCenterOffsetX[i],Math.abs(t.x)>=Math.abs(n-r)*this.scrollThreshold;if(this.direction===Pdt.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===Pdt.Horizontal)return Math.abs(t.x)>=s.width*this.scrollThreshold;if(this.direction===Pdt.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 yn;yn.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}(V_t)).SizeMode=Ddt,Idt.Direction=Pdt,Idt.EventType=ift(Odt,y_t),p((mdt=Idt).prototype,"sizeMode",[hdt],Object.getOwnPropertyDescriptor(mdt.prototype,"sizeMode"),mdt.prototype),p(mdt.prototype,"direction",[udt],Object.getOwnPropertyDescriptor(mdt.prototype,"direction"),mdt.prototype),p(mdt.prototype,"indicator",[ldt],Object.getOwnPropertyDescriptor(mdt.prototype,"indicator"),mdt.prototype),gdt=Ss(mdt.prototype,"autoPageTurningThreshold",[ks],(function(){return 100})),p(mdt.prototype,"verticalScrollBar",[cdt,ua],Object.getOwnPropertyDescriptor(mdt.prototype,"verticalScrollBar"),mdt.prototype),p(mdt.prototype,"horizontalScrollBar",[_dt,ua],Object.getOwnPropertyDescriptor(mdt.prototype,"horizontalScrollBar"),mdt.prototype),ydt=Ss(mdt.prototype,"horizontal",[ua,ks],(function(){return!0})),vdt=Ss(mdt.prototype,"vertical",[ua,ks],(function(){return!0})),Sdt=Ss(mdt.prototype,"cancelInnerEvents",[ua,ks],(function(){return!0})),Adt=Ss(mdt.prototype,"scrollEvents",[fdt,ks,ua],(function(){return[]})),Tdt=Ss(mdt.prototype,"pageTurningSpeed",[ks],(function(){return.3})),Edt=Ss(mdt.prototype,"pageEvents",[ddt,ks],(function(){return[]})),bdt=Ss(mdt.prototype,"_sizeMode",[ks],(function(){return Ddt.Unified})),xdt=Ss(mdt.prototype,"_direction",[ks],(function(){return Pdt.Horizontal})),Cdt=Ss(mdt.prototype,"_scrollThreshold",[ks],(function(){return.5})),Rdt=Ss(mdt.prototype,"_pageTurningEventTiming",[ks],(function(){return.1})),wdt=Ss(mdt.prototype,"_indicator",[ks],(function(){return null})),pdt=mdt))||pdt)||pdt));v.PageView=Ndt;var Ldt=new Yi,Fdt=new yn,kdt=new yn,Gdt=new yn(1,1),Vdt=new yn,Udt=new yn;function zdt(t,e){if(!e._hadAlignOnce){e.alignMode===kft.ONCE&&(e._hadAlignOnce=!0);var i,n=e.target,r=kdt,s=Gdt;n?zft(t,i=n,r,s):i=t.parent;var a=Uft(i),o=i instanceof Px||!i.getComponent($F),h=o?Fdt:i.getComponent($F).anchorPoint,u=o;t.getPosition(Ldt);var l=t._uiProps.uiTransformComp,c=Ldt.x,_=Ldt.y,f=l.anchorPoint,d=t.getScale();if(e.alignFlags&Gft.HORIZONTAL){var p=0,m=0,g=a.width;u?(p=ll.left.x,m=ll.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 y=0,v=f.x,S=d.x;if(S<0&&(v=1-v,S=-S),e.isStretchWidth)y=m-p,0!==S&&(l.width=y/S),c=p+v*y;else{if(y=l.width*S,e.isAlignHorizontalCenter){var A=e.isAbsoluteHorizontalCenter?e.horizontalCenter:e.horizontalCenter*g,T=(.5-h.x)*a.width;n&&(A*=s.x,T+=r.x,T*=s.x),c=T+(v-.5)*y+A}else c=e.isAlignLeft?p+v*y:m+(v-1)*y;Ei(S,0,Ai)?y=l.width:y/=S}e._lastSize.width=y}if(e.alignFlags&Gft.VERTICAL){var E=0,b=0,x=a.height;u?(b=ll.bottom.y,E=ll.top.y):E=(b=-h.y*x)+x,b+=e.isAbsoluteBottom?e.bottom:e.bottom*x,E-=e.isAbsoluteTop?e.top:e.top*x,n&&(b+=r.y,b*=s.y,E+=r.y,E*=s.y);var C=0,R=f.y,w=d.y;if(w<0&&(R=1-R,w=-w),e.isStretchHeight)C=E-b,0!==w&&(l.height=C/w),_=b+R*C;else{if(C=l.height*w,e.isAlignVerticalCenter){var I=e.isAbsoluteVerticalCenter?e.verticalCenter:e.verticalCenter*x,B=(.5-h.y)*a.height;n&&(I*=s.y,B+=r.y,B*=s.y),_=B+(R-.5)*C+I}else _=e.isAlignBottom?b+R*C:E+(R-1)*C;Ei(w,0,Ai)?C=l.height:C/=w}e._lastSize.height=C}t.setPosition(c,_,Ldt.z),Yi.set(e._lastPos,c,_,Ldt.z)}}function Hdt(t){var e=t.getComponent(ndt);if(e&&e.enabled){if(!v.isValid(t,!0))return;jdt.push(e)}for(var i,n=f(t.children);!(i=n()).done;){var r=i.value;r.active&&Hdt(r)}}function Wdt(){var t=vN.getScene();if(t){Ydt.isAligning=!0,Ydt._nodesOrderDirty&&(jdt.length=0,Hdt(t),Ydt._nodesOrderDirty=!1);var e=null,i=Ydt._activeWidgetsIterator;for(i.i=0;i.i<jdt.length;++i.i)(e=jdt[i.i])._dirty&&(zdt(e.node,e),e._dirty=!1);Ydt.isAligning=!1}}var Xdt,jdt=[],Ydt=t("fC",v._widgetManager={isAligning:!1,_nodesOrderDirty:!1,_activeWidgetsIterator:new re(jdt),animationState:null,init:function(){vN.on(yN.EVENT_AFTER_SCENE_LAUNCH,Wdt),vN.on(yN.EVENT_AFTER_UPDATE,Wdt),_z.instance.on("design-resolution-changed",this.onResized,this);var t=this.onResized.bind(this);_z.instance.on("canvas-resize",t),al.on("window-resize",t)},add:function(){this._nodesOrderDirty=!0},remove:function(t){this._activeWidgetsIterator.remove(t)},onResized:function(){var t=vN.getScene();t&&this.refreshWidgetOnResized(t)},refreshWidgetOnResized:function(t){var e=Pm.isNode(t)&&t.getComponent(ndt);e&&e.enabled&&(e.alignMode===kft.ON_WINDOW_RESIZE||e.alignMode===kft.ALWAYS)&&e.setDirty();for(var i,n=f(t.children);!(i=n()).done;){var r=i.value;this.refreshWidgetOnResized(r)}},updateOffsetsToStayPut:function(t,e){function i(t,e){return Math.abs(t-e)>1e-10?e:t}var n=t.node,r=n.parent;if(r){var s=Vdt;s.set(0,0);var a=Udt;if(a.set(1,1),t.target&&zft(n,r=t.target,s,a),!e)return;var o=r._uiProps&&r._uiProps.uiTransformComp,h=o?o.anchorPoint:Fdt,u=n._uiProps.uiTransformComp,l=Uft(r),c=u.anchorPoint,_=n.getPosition(),f=Gft,d=n.getScale(),p=0;if(e&f.LEFT){var m=-h.x*l.width;m+=s.x,m*=a.x,p=_.x-c.x*u.width*Math.abs(d.x)-m,t.isAbsoluteLeft||(p/=l.width),p/=a.x,t.left=i(t.left,p)}if(e&f.RIGHT){var g=(1-h.x)*l.width;g+=s.x,p=(g*=a.x)-(_.x+(1-c.x)*u.width*Math.abs(d.x)),t.isAbsoluteRight||(p/=l.width),p/=a.x,t.right=i(t.right,p)}if(e&f.TOP){var y=(1-h.y)*l.height;y+=s.y,p=(y*=a.y)-(_.y+(1-c.y)*u.height*Math.abs(d.y)),t.isAbsoluteTop||(p/=l.height),p/=a.y,t.top=i(t.top,p)}if(e&f.BOT){var v=-h.y*l.height;v+=s.y,v*=a.y,p=_.y-c.y*u.height*Math.abs(d.y)-v,t.isAbsoluteBottom||(p/=l.height),p/=a.y,t.bottom=i(t.bottom,p)}}},updateAlignment:function t(e){var i=e.parent;i&&Pm.isNode(i)&&t(i);var n=e.getComponent(ndt);n&&i&&zdt(e,n)},AlignMode:kft,AlignFlags:Gft});vN.on(yN.EVENT_INIT,(function(){Ydt.init()}));var qdt,Kdt,Jdt,Qdt,Zdt,$dt,tpt,ept,ipt,npt,rpt,spt,apt=t("fy",Is("cc.SafeArea")(Xdt=Ds(110)(Xdt=Bs(ndt)(Xdt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.onEnable=function(){this.updateArea(),al.on("window-resize",this.updateArea,this),al.on("orientation-change",this.updateArea,this)},i.onDisable=function(){al.off("window-resize",this.updateArea,this),al.off("orientation-change",this.updateArea,this)},i.updateArea=function(){var t=this.node.getComponent(ndt),e=this.node.getComponent($F);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=gz.getVisibleSize(),s=r.width,a=r.height,o=ul.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),Ydt.add(t)}},e}(Vd))||Xdt)||Xdt)||Xdt);v.SafeArea=apt;var opt,hpt=t("fz",(qdt=Is("cc.UICoordinateTracker"),Kdt=Ds(110),Jdt=ha(Pm),Qdt=ha(uz),Zdt=ha([Fd]),qdt($dt=Kdt((p((tpt=function(t){function e(){for(var e,i=arguments.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=ept&&ept(),e._target=ipt&&ipt(),e._camera=npt&&npt(),e._useScale=rpt&&rpt(),e._distance=spt&&spt(),e._transformPos=new Yi,e._viewPos=new Yi,e._canMove=!0,e._lastWPos=new Yi,e._lastCameraPos=new Yi,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&&Yi.transformMat4(this._viewPos,this.node.worldPosition,e.camera.matView),this.syncEvents.length>0)){var i=this._distance/Math.abs(this._viewPos.z);Fd.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}(Vd)).prototype,"target",[Jdt],Object.getOwnPropertyDescriptor(tpt.prototype,"target"),tpt.prototype),p(tpt.prototype,"camera",[Qdt],Object.getOwnPropertyDescriptor(tpt.prototype,"camera"),tpt.prototype),ept=Ss(tpt.prototype,"syncEvents",[Zdt,ks],(function(){return[]})),ipt=Ss(tpt.prototype,"_target",[ks],(function(){return null})),npt=Ss(tpt.prototype,"_camera",[ks],(function(){return null})),rpt=Ss(tpt.prototype,"_useScale",[ks],(function(){return!0})),spt=Ss(tpt.prototype,"_distance",[ks],(function(){return 1})),$dt=tpt))||$dt)||$dt)),upt=[zp.TOUCH_START,zp.TOUCH_END,zp.TOUCH_MOVE,zp.MOUSE_DOWN,zp.MOUSE_MOVE,zp.MOUSE_UP,zp.MOUSE_ENTER,zp.MOUSE_LEAVE,zp.MOUSE_WHEEL];function lpt(t){t.propagationStopped=!0}var cpt,_pt,fpt,dpt,ppt,mpt=t("fA",Is("cc.BlockInputEvents")(opt=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<upt.length;t++)this.node.on(upt[t],lpt,this)},i.onDisable=function(){for(var t=0;t<upt.length;t++)this.node.off(upt[t],lpt,this)},e}(Vd))||opt),gpt=t("fB",Is("cc.SubContextView")(cpt=Ds(110)(cpt=Bs($F)((_pt=function(t){function e(){var e;return(e=t.call(this)||this)._fps=fpt&&fpt(),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=dpt&&dpt(),e._content=new Pm("content"),e._content.hideFlags|=ba.Flags.DontSave|ba.Flags.HideInHierarchy,e._sprite=null,e._imageAsset=new ld,e._openDataContext=null,e._updatedTime=performance.now(),e._texture=new Mp,e}s(e,t);var i=e.prototype;return i.onLoad=function(){lf.getOpenDataContext?(this._updateInterval=1e3/this._fps,this._openDataContext=lf.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(ZV),this._sprite||(this._sprite=this._content.addComponent(ZV)),this._sprite.spriteFrame)this._sprite.spriteFrame.texture=this._texture;else{var i=new lL;i.texture=this._texture,this._sprite.spriteFrame=i}this._content.parent=this.node}},i._updateSubContextView=function(){if(this._openDataContext){var t=this.node.getComponent($F),e=this._content.getComponent($F),i=t.width/e.width,n=t.height/e.height,r=i>n?n:i;e.width*=r,e.height*=r;var s=gz.getViewportRect(),a=e.getBoundingBoxToWorld(),o=gz.getVisibleSize(),h=al.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(zp.TRANSFORM_CHANGED,this._updateSubContextView,this),this.node.on(zp.SIZE_CHANGED,this._updateSubContextView,this),this.node.on(zp.LAYER_CHANGED,this._updateContentLayer,this)},i._unregisterNodeEvent=function(){this.node.off(zp.TRANSFORM_CHANGED,this._updateSubContextView,this),this.node.off(zp.SIZE_CHANGED,this._updateSubContextView,this),this.node.off(zp.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}(Vd),fpt=Ss(_pt.prototype,"_fps",[ks],(function(){return 60})),dpt=Ss(_pt.prototype,"_designResolutionSize",[ks],(function(){return new An(640,960)})),cpt=_pt))||cpt)||cpt)||cpt);v.SubContextView=gpt,dt({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 ypt,vpt,Spt,Apt=t("fG",Is("cc.UIReorderComponent")(ppt=function(){q(1408,"UIReorderComponent")})||ppt);v.UIReorderComponent=Apt,v.ButtonComponent=Uut,Jt(Uut,"cc.ButtonComponent"),v.EditBoxComponent=lct,Jt(lct,"cc.EditBoxComponent"),v.LayoutComponent=Cct,Jt(Cct,"cc.LayoutComponent"),v.ProgressBarComponent=Vct,Jt(Vct,"cc.ProgressBarComponent"),v.ScrollViewComponent=V_t,Jt(V_t,"cc.ScrollViewComponent"),v.ScrollBarComponent=Kct,Jt(Kct,"cc.ScrollBarComponent"),v.SliderComponent=eft,Jt(eft,"cc.SliderComponent"),v.ToggleComponent=lft,Jt(lft,"cc.ToggleComponent"),v.ToggleContainerComponent=Fft,Jt(Fft,"cc.ToggleContainerComponent"),v.WidgetComponent=ndt,Jt(ndt,"cc.WidgetComponent"),v.PageViewComponent=Ndt,Jt(Ndt,"cc.PageViewComponent"),v.PageViewIndicatorComponent=Bdt,Jt(Bdt,"cc.PageViewIndicatorComponent"),v.SafeAreaComponent=apt,Jt(apt,"cc.SafeAreaComponent"),Jt(hpt,"cc.UICoordinateTrackerComponent"),v.BlockInputEventsComponent=mpt,Jt(mpt,"cc.BlockInputEventsComponent"),rt(_z.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"}]),st(_z.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"}]);var Tpt=t("fH",Is("cc.VideoClip")((vpt=function(t){function e(){var e;return(e=t.call(this)||this)._duration=Spt&&Spt(),e._video=null,e}return s(e,t),n(e,[{key:"_nativeAsset",get:function(){return this._video},set:function(t){this._video=t,this._duration=t?t.duration:0}}]),e}(zf),Spt=Ss(vpt.prototype,"_duration",[ks],(function(){return 0})),ypt=vpt))||ypt),Ept=A.document;function bpt(t,e,i){var n=Ept.createElement("video"),r=Ept.createElement("source");n.appendChild(r);var s=new XMLHttpRequest;s.open("GET",t,!0),s.responseType="blob",s.onload=function(){200===this.status||0===this.status?(r.src=URL.createObjectURL(this.response),i(null,n)):i(new Error(s.status+"(no response)"))},s.onerror=function(){var e="load video failure - "+t;F(e),i(new Error(e))},s.send()}function xpt(t,e,i,n){var r=new Tpt;r._nativeUrl=t,r._nativeAsset=e,n(null,r)}Wv.register({".mp4":bpt,".avi":bpt,".mov":bpt,".mpg":bpt,".mpeg":bpt,".rm":bpt,".rmvb":bpt}),iS.register({".mp4":xpt,".avi":xpt,".mov":xpt,".mpg":xpt,".mpeg":xpt,".rm":xpt,".rmvb":xpt});var Cpt,Rpt,wpt=me({REMOTE:0,LOCAL:1});!function(t){t.NONE="none",t.PLAYING="playing",t.PAUSED="paused",t.STOPPED="stopped",t.COMPLETED="completed",t.META_LOADED="meta-loaded",t.READY_TO_PLAY="ready-to-play",t.ERROR="error",t.CLICKED="clicked"}(Cpt||(Cpt={})),function(t){t[t.HAVE_NOTHING=0]="HAVE_NOTHING",t[t.HAVE_METADATA=1]="HAVE_METADATA",t[t.HAVE_CURRENT_DATA=2]="HAVE_CURRENT_DATA",t[t.HAVE_FUTURE_DATA=3]="HAVE_FUTURE_DATA",t[t.HAVE_ENOUGH_DATA=4]="HAVE_ENOUGH_DATA"}(Rpt||(Rpt={}));var Ipt=function(){function t(t){var e=this;this._componentEventList=new Map,this._state=Cpt.NONE,this._video=null,this._onInterruptedBegin=void 0,this._onInterruptedEnd=void 0,this._interrupted=!1,this._loaded=!1,this._loadedMeta=!1,this._ignorePause=!1,this._fullScreenOnAwake=!1,this._visible=!0,this._playing=!1,this._cachedCurrentTime=-1,this._waitingFullscreen=!1,this._waitingPlay=!1,this._keepAspectRatio=!1,this._component=null,this._uiTrans=null,this._node=null,this._stayOnBottom=!1,this._dirty=!1,this._forceUpdate=!1,this._w=0,this._h=0,this._m00=0,this._m01=0,this._m04=0,this._m05=0,this._m12=0,this._m13=0,this._component=t,this._node=t.node,this._uiTrans=t.node.getComponent($F),this._onInterruptedBegin=function(){e.video&&e._state===Cpt.PLAYING&&(e.video.pause(),e._interrupted=!0)},this._onInterruptedEnd=function(){e._interrupted&&e.video&&(e.video.play(),e._interrupted=!1)},v.game.on(v.Game.EVENT_PAUSE,this._onInterruptedBegin),v.game.on(v.Game.EVENT_RESUME,this._onInterruptedEnd)}var e=t.prototype;return e.onLoadedMetadata=function(t){this._loadedMeta=!0,this._forceUpdate=!0,this._visible?this.enable():this.disable(),this.dispatchEvent(Cpt.META_LOADED);var e=t.target;this._keepAspectRatio&&e&&this.syncUITransform(e.videoWidth,e.videoHeight),this.delayedFullScreen(),this.delayedPlay()},e.onCanPlay=function(){this._loaded=!0,this.dispatchEvent(Cpt.READY_TO_PLAY)},e.onPlay=function(){this._playing=!0,this.dispatchEvent(Cpt.PLAYING)},e.onPlaying=function(){this.dispatchEvent(Cpt.PLAYING)},e.onPause=function(){this._ignorePause?this._ignorePause=!1:(this._playing=!1,this.dispatchEvent(Cpt.PAUSED))},e.onStoped=function(){this._playing=!1,this._ignorePause=!1,this.dispatchEvent(Cpt.STOPPED)},e.onEnded=function(){this.dispatchEvent(Cpt.COMPLETED)},e.onClick=function(){this.dispatchEvent(Cpt.CLICKED)},e.onError=function(t){this.dispatchEvent(Cpt.ERROR);var e=t.target;e&&e.error&&G("Error "+e.error.code+"; details: "+e.error.message)},e.play=function(){this._loadedMeta||this._loaded?this.canPlay():this._waitingPlay=!0},e.delayedPlay=function(){this._waitingPlay&&(this.canPlay(),this._waitingPlay=!1)},e.syncFullScreenOnAwake=function(t){this._fullScreenOnAwake=t,this._loadedMeta||this._loaded?this.canFullScreen(t):this._waitingFullscreen=!0},e.delayedFullScreen=function(){this._waitingFullscreen&&(this.canFullScreen(this._fullScreenOnAwake),this._waitingFullscreen=!1)},e.dispatchEvent=function(t){var e=this._componentEventList.get(t);e&&(this._state=t,e.call(this))},e.syncUITransform=function(t,e){this._uiTrans&&(this._uiTrans.width=t,this._uiTrans.height=e)},e.syncCurrentTime=function(){this.video&&-1!==this._cachedCurrentTime&&this.video.currentTime!==this._cachedCurrentTime&&(this.seekTo(this._cachedCurrentTime),this._cachedCurrentTime=-1)},e.destroy=function(){this.removeVideoPlayer(),this._componentEventList.clear(),v.game.off(v.Game.EVENT_PAUSE,this._onInterruptedBegin),v.game.off(v.Game.EVENT_RESUME,this._onInterruptedEnd)},n(t,[{key:"fullScreenOnAwake",get:function(){return this._fullScreenOnAwake}},{key:"loaded",get:function(){return this._loaded}},{key:"componentEventList",get:function(){return this._componentEventList}},{key:"video",get:function(){return this._video}},{key:"state",get:function(){return this._state}},{key:"isPlaying",get:function(){return this._playing}},{key:"UICamera",get:function(){return vN.root.batcher2D.getFirstRenderCamera(this._node)}}]),t}();v.internal.VideoPlayerImpl=Ipt;var Bpt,Dpt,Ppt,Opt,Mpt,Npt,Lpt,Fpt,kpt,Gpt,Vpt,Upt,zpt,Hpt,Wpt,Xpt,jpt,Ypt,qpt,Kpt,Jpt,Qpt=A.document,Zpt=-Math.pow(2,15),$pt=mn(),tmt=function(t){function e(e){var i;return(i=t.call(this,e)||this)._eventList=new Map,i._clearColorA=-1,i._clearFlag=void 0,i}s(e,t);var i=e.prototype;return i.addListener=function(t,e){this._video&&(this._eventList.set(t,e),this._video.addEventListener(t,e))},i.removeAllListeners=function(){var t=this;this._eventList.forEach((function(e,i){t._video&&t._video.removeEventListener(i,e)})),this._eventList.clear()},i.canPlay=function(){var t=this;if(this.video){var e=this.video.play();A.Promise&&e instanceof Promise&&e.catch((function(){})).then((function(){t.syncCurrentTime()}))}},i.pause=function(){this.video&&(this.video.pause(),this._cachedCurrentTime=this.video.currentTime)},i.resume=function(){this.play()},i.stop=function(){var t=this;this.video&&(this._ignorePause=!0,this.video.currentTime=0,this.video.pause(),this._cachedCurrentTime=0,setTimeout((function(){t._ignorePause=!1,t.dispatchEvent(Cpt.STOPPED)}),0))},i.syncClip=function(t){this.removeVideoPlayer(),t&&this.createVideoPlayer(t.nativeUrl)},i.syncURL=function(t){this.removeVideoPlayer(),t&&this.createVideoPlayer(t)},i.syncPlaybackRate=function(t){ul.browserType!==Pu.UC?this.video&&(this.video.playbackRate=t):k("playbackRate is not supported by the uc mobile browser.")},i.syncVolume=function(t){this.video&&(this.video.volume=t)},i.syncMute=function(t){this.video&&(this.video.muted=t)},i.syncLoop=function(t){this.video&&(this.video.loop=t)},i.getDuration=function(){return this.video?this.video.duration:0},i.getCurrentTime=function(){return this.video?this.video.currentTime:-1},i.seekTo=function(t){this.video&&(this.video.currentTime=t)},i.canFullScreen=function(t){var e=this,i=this._video;if(i&&i.readyState===Rpt.HAVE_ENOUGH_DATA)return ul.os===Nu.IOS&&ul.isBrowser?(t?i.webkitEnterFullscreen&&i.webkitEnterFullscreen():i.webkitExitFullscreen&&i.webkitExitFullscreen(),void(this._fullScreenOnAwake=i.webkitDisplayingFullscreen)):hl.supportsFullScreen?void(t?(ul.browserType===Pu.IE&&(i.style.transform=""),i.setAttribute("x5-video-player-fullscreen","true"),hl.requestFullScreen(i,(function(t){var n=ul.browserType===Pu.IE?t.msFullscreenElement:t.fullscreenElement;e._fullScreenOnAwake=n===i}),(function(){e._fullScreenOnAwake=!1}))):(i.removeAttribute("x5-video-player-fullscreen"),hl.exitFullScreen())):(this._fullScreenOnAwake=t,this._forceUpdate=!0,void this.syncMatrix())},i.syncStayOnBottom=function(t){this._video&&(this._video.style["z-index"]=t?Zpt:0,this._stayOnBottom=t),this._dirty=!0},i.syncKeepAspectRatio=function(t){this._keepAspectRatio=t,t&&this._loadedMeta&&this._video&&this.syncUITransform(this._video.videoWidth,this._video.videoHeight)},i.removeVideoPlayer=function(){var t=this._video;t&&Pe(xN.container,t)&&(xN.container.removeChild(t),this.removeAllListeners()),this._cachedCurrentTime=0,this._playing=!1,this._loaded=!1,this._loadedMeta=!1,this._video=null},i.createVideoPlayer=function(t){var e=this._video=Qpt.createElement("video");e.className="cocosVideo",e.style.visibility="hidden",e.style.position="absolute",e.style.bottom="0px",e.style.left="0px",e.style["transform-origin"]="0px 100% 0px",e.style["-webkit-transform-origin"]="0px 100% 0px",e.setAttribute("preload","auto"),e.setAttribute("webkit-playsinline",""),e.setAttribute("x5-playsinline",""),e.setAttribute("playsinline",""),this._bindDomEvent(),xN.container.appendChild(e);var i=Qpt.createElement("source");e.appendChild(i),i.src=t},i._bindDomEvent=function(){this._video,this.addListener("loadedmetadata",this.onLoadedMetadata.bind(this)),this.addListener("canplay",this.onCanPlay.bind(this)),this.addListener("canplaythrough",this.onCanPlay.bind(this)),this.addListener("play",this.onPlay.bind(this)),this.addListener("playing",this.onPlaying.bind(this)),this.addListener("pause",this.onPause.bind(this)),this.addListener("click",this.onClick.bind(this)),this.addListener("ended",this.onEnded.bind(this)),this.addListener("error",this.onError.bind(this))},i.onCanPlay=function(e){var i=e.target;if(!this._loaded||!i)switch(i.readyState){case Rpt.HAVE_METADATA:case Rpt.HAVE_ENOUGH_DATA:t.prototype.onCanPlay.call(this,e)}},i.enable=function(){if(this._video){if(this._visible=!0,"visible"===this._video.style.visibility)return;this._video.style.visibility="visible"}},i.disable=function(t){if(this._video){if(!t&&this._playing&&this._video.pause(),this._visible=!1,"hidden"===this._video.style.visibility)return;this._video.style.visibility="hidden"}},i.syncMatrix=function(){if(this._video&&this._visible&&this._component){var t=this.UICamera;if(t&&!hl.fullScreen()){this._dirty&&(this._dirty=!1,this._stayOnBottom?(this._clearColorA=t.clearColor.w,this._clearFlag=t.clearFlag,t.clearColor.w=0,t.clearFlag=oc.ALL):this._clearFlag&&(t.clearColor.w=this._clearColorA,t.clearFlag=this._clearFlag,this._clearColorA=-1,this._clearFlag=null)),this._component.node.getWorldMatrix($pt),t.update(!0),t.worldMatrixToScreen($pt,$pt,xN.canvas.width,xN.canvas.height);var e=0,i=0;if(this._fullScreenOnAwake?(e=ll.width,i=ll.height):(e=this._uiTrans.contentSize.width,i=this._uiTrans.contentSize.height),this._forceUpdate||this._m00!==$pt.m00||this._m01!==$pt.m01||this._m04!==$pt.m04||this._m05!==$pt.m05||this._m12!==$pt.m12||this._m13!==$pt.m13||this._w!==e||this._h!==i){this._m00=$pt.m00,this._m01=$pt.m01,this._m04=$pt.m04,this._m05=$pt.m05,this._m12=$pt.m12,this._m13=$pt.m13,this._w=e,this._h=i;var n=al.devicePixelRatio,r=1/n,s=1/n,a=xN.container,o=$pt.m00*r,h=$pt.m01,u=$pt.m04,l=$pt.m05*s;this._video.style.width=this._w+"px",this._video.style.height=this._h+"px",ul.browserType!==Pu.MOBILE_QQ?this._video.style.objectFit=this._keepAspectRatio?"none":"fill":k("keepAspectRatio is not supported by the qq mobile browser.");var c=this._w*r,_=this._h*s,f=this._uiTrans.anchorPoint,d=f.x,p=f.y,m=c*$pt.m00*d,g=_*$pt.m05*p,y=a&&a.style.paddingLeft?parseInt(a.style.paddingLeft):0,v=a&&a.style.paddingBottom?parseInt(a.style.paddingBottom):0,S="matrix("+o+","+-h+","+-u+","+l+","+($pt.m12*r-m+y)+","+-($pt.m13*s-g+v)+")";this._video.style.transform=S,this._video.style["-webkit-transform"]=S,ul.browserType!==Pu.IE&&(this._forceUpdate=!1)}}}},e}(Ipt),emt=function(){function t(){}return t.getImpl=function(t){return new tmt(t)},t}();v.internal.VideoPlayerImplManager=emt;var imt,nmt=t("fI",(Bpt=Is("cc.VideoPlayer"),Dpt=Bs($F),Ppt=ha(Tpt),Opt=ha(wpt),Mpt=ha(Tpt),Npt=ha([Fd]),Bpt(Lpt=Dpt(((Jpt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._resourceType=kpt&&kpt(),e._remoteURL=Gpt&&Gpt(),e._clip=Vpt&&Vpt(),e._playOnAwake=Upt&&Upt(),e._volume=zpt&&zpt(),e._mute=Hpt&&Hpt(),e._playbackRate=Wpt&&Wpt(),e._loop=Xpt&&Xpt(),e._fullScreenOnAwake=jpt&&jpt(),e._stayOnBottom=Ypt&&Ypt(),e._keepAspectRatio=qpt&&qpt(),e._impl=null,e._cachedCurrentTime=0,e.videoPlayerEvent=Kpt&&Kpt(),e}s(e,t);var i=e.prototype;return i.syncSource=function(){this._impl&&(this._resourceType===wpt.REMOTE?this._impl.syncURL(this._remoteURL):this._impl.syncClip(this._clip))},i.__preload=function(){this._impl=emt.getImpl(this),this.syncSource(),this._impl.syncLoop(this._loop),this._impl.syncVolume(this._volume),this._impl.syncMute(this._mute),this._impl.seekTo(this._cachedCurrentTime),this._impl.syncPlaybackRate(this._playbackRate),this._impl.syncStayOnBottom(this._stayOnBottom),this._impl.syncKeepAspectRatio(this._keepAspectRatio),this._impl.syncFullScreenOnAwake(this._fullScreenOnAwake),this._impl.componentEventList.set(Cpt.META_LOADED,this.onMetaLoaded.bind(this)),this._impl.componentEventList.set(Cpt.READY_TO_PLAY,this.onReadyToPlay.bind(this)),this._impl.componentEventList.set(Cpt.PLAYING,this.onPlaying.bind(this)),this._impl.componentEventList.set(Cpt.PAUSED,this.onPaused.bind(this)),this._impl.componentEventList.set(Cpt.STOPPED,this.onStopped.bind(this)),this._impl.componentEventList.set(Cpt.COMPLETED,this.onCompleted.bind(this)),this._impl.componentEventList.set(Cpt.ERROR,this.onError.bind(this)),this._impl.componentEventList.set(Cpt.CLICKED,this.onClicked.bind(this)),this._playOnAwake&&this._impl.loaded&&this.play()},i.onEnable=function(){this._impl&&this._impl.enable()},i.onDisable=function(){this._impl&&this._impl.disable()},i.onDestroy=function(){this._impl&&(this._impl.destroy(),this._impl=null)},i.update=function(){this._impl&&this._impl.syncMatrix()},i.onMetaLoaded=function(){Fd.emitEvents(this.videoPlayerEvent,this,Cpt.META_LOADED),this.node.emit("meta-loaded",this)},i.onReadyToPlay=function(){this._playOnAwake&&!this.isPlaying&&this.play(),Fd.emitEvents(this.videoPlayerEvent,this,Cpt.READY_TO_PLAY),this.node.emit(Cpt.READY_TO_PLAY,this)},i.onPlaying=function(){Fd.emitEvents(this.videoPlayerEvent,this,Cpt.PLAYING),this.node.emit(Cpt.PLAYING,this)},i.onPaused=function(){Fd.emitEvents(this.videoPlayerEvent,this,Cpt.PAUSED),this.node.emit(Cpt.PAUSED,this)},i.onStopped=function(){Fd.emitEvents(this.videoPlayerEvent,this,Cpt.STOPPED),this.node.emit(Cpt.STOPPED,this)},i.onCompleted=function(){Fd.emitEvents(this.videoPlayerEvent,this,Cpt.COMPLETED),this.node.emit(Cpt.COMPLETED,this)},i.onError=function(){Fd.emitEvents(this.videoPlayerEvent,this,Cpt.ERROR),this.node.emit(Cpt.ERROR,this)},i.onClicked=function(){Fd.emitEvents(this.videoPlayerEvent,this,Cpt.CLICKED),this.node.emit(Cpt.CLICKED,this)},i.play=function(){this._impl&&this._impl.play()},i.resume=function(){this._impl&&this._impl.resume()},i.pause=function(){this._impl&&this._impl.pause()},i.stop=function(){this._impl&&this._impl.stop()},n(e,[{key:"resourceType",get:function(){return this._resourceType},set:function(t){this._resourceType!==t&&(this._resourceType=t,this.syncSource())}},{key:"remoteURL",get:function(){return this._remoteURL},set:function(t){this._remoteURL!==t&&(this._remoteURL=t,this.syncSource())}},{key:"clip",get:function(){return this._clip},set:function(t){this._clip!==t&&(this._clip=t,this.syncSource())}},{key:"playOnAwake",get:function(){return this._playOnAwake},set:function(t){this._playOnAwake=t}},{key:"playbackRate",get:function(){return this._playbackRate},set:function(t){this._playbackRate=t,this._impl&&this._impl.syncPlaybackRate(t)}},{key:"volume",get:function(){return this._volume},set:function(t){this._volume=t,this._impl&&this._impl.syncVolume(t)}},{key:"mute",get:function(){return this._mute},set:function(t){this._mute=t,this._impl&&this._impl.syncMute(t)}},{key:"loop",get:function(){return this._loop},set:function(t){this._loop=t,this._impl&&this._impl.syncLoop(t)}},{key:"keepAspectRatio",get:function(){return this._keepAspectRatio},set:function(t){this._keepAspectRatio!==t&&(this._keepAspectRatio=t,this._impl&&this._impl.syncKeepAspectRatio(t))}},{key:"fullScreenOnAwake",get:function(){return this._impl?(this._fullScreenOnAwake=this._impl.fullScreenOnAwake,this._fullScreenOnAwake):this._fullScreenOnAwake},set:function(t){this._fullScreenOnAwake!==t&&(this._fullScreenOnAwake=t,this._impl&&this._impl.syncFullScreenOnAwake(t))}},{key:"stayOnBottom",get:function(){return this._stayOnBottom},set:function(t){this._stayOnBottom!==t&&(this._stayOnBottom=t,this._impl&&this._impl.syncStayOnBottom(t))}},{key:"nativeVideo",get:function(){return this._impl&&this._impl.video||null}},{key:"currentTime",get:function(){return this._impl?this._impl.getCurrentTime():this._cachedCurrentTime},set:function(t){Number.isNaN(t)?k("illegal video time! value:"+t):(t=bi(t,0,this.duration),this._cachedCurrentTime=t,this._impl&&this._impl.seekTo(t))}},{key:"duration",get:function(){return this._impl?this._impl.getDuration():0}},{key:"state",get:function(){return this._impl?this._impl.state:Cpt.NONE}},{key:"isPlaying",get:function(){return!!this._impl&&this._impl.isPlaying}}]),e}(Vd)).EventType=Cpt,Jpt.ResourceType=wpt,kpt=Ss((Fpt=Jpt).prototype,"_resourceType",[ks],(function(){return wpt.LOCAL})),Gpt=Ss(Fpt.prototype,"_remoteURL",[ks],(function(){return""})),Vpt=Ss(Fpt.prototype,"_clip",[Ppt,ks],(function(){return null})),Upt=Ss(Fpt.prototype,"_playOnAwake",[ks],(function(){return!0})),zpt=Ss(Fpt.prototype,"_volume",[ks],(function(){return 1})),Hpt=Ss(Fpt.prototype,"_mute",[ks],(function(){return!1})),Wpt=Ss(Fpt.prototype,"_playbackRate",[ks],(function(){return 1})),Xpt=Ss(Fpt.prototype,"_loop",[ks],(function(){return!1})),jpt=Ss(Fpt.prototype,"_fullScreenOnAwake",[ks],(function(){return!1})),Ypt=Ss(Fpt.prototype,"_stayOnBottom",[ks],(function(){return!1})),qpt=Ss(Fpt.prototype,"_keepAspectRatio",[ks],(function(){return!0})),p(Fpt.prototype,"resourceType",[Opt],Object.getOwnPropertyDescriptor(Fpt.prototype,"resourceType"),Fpt.prototype),p(Fpt.prototype,"clip",[Mpt],Object.getOwnPropertyDescriptor(Fpt.prototype,"clip"),Fpt.prototype),Kpt=Ss(Fpt.prototype,"videoPlayerEvent",[ks,Npt],(function(){return[]})),Lpt=Fpt))||Lpt)||Lpt));v.internal.VideoPlayer=nmt,nt(nmt.prototype,"VideoPlayer.prototype",[{name:"onPasued",newName:"onPaused"}]),function(t){t.NONE="none",t.LOADING="loading",t.LOADED="loaded",t.ERROR="error"}(imt||(imt={}));var rmt=function(){function t(t){this._componentEventList=new Map,this._state=imt.NONE,this._wrapper=void 0,this._webview=null,this._loaded=!1,this._forceUpdate=!1,this._component=null,this._uiTrans=null,this._node=null,this._w=0,this._h=0,this._m00=0,this._m01=0,this._m04=0,this._m05=0,this._m12=0,this._m13=0,this._component=t,this._node=t.node,this._uiTrans=t.node.getComponent($F),this.reset(),this.createWebView()}var e=t.prototype;return e.reset=function(){this._wrapper=null,this._webview=null,this._loaded=!1,this._w=0,this._h=0,this._m00=0,this._m01=0,this._m04=0,this._m05=0,this._m12=0,this._m13=0,this._state=imt.NONE,this._forceUpdate=!1},e.dispatchEvent=function(t){var e=this._componentEventList.get(t);if(e){this._state=t;for(var i=arguments.length,n=new Array(i>1?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];e.call(this,n)}},e.destroy=function(){this.removeWebView(),this._wrapper=null,this._webview=null,this._loaded=!1,this._component=null,this._uiTrans=null,this._forceUpdate=!1,this._componentEventList.clear()},n(t,[{key:"loaded",get:function(){return this._loaded}},{key:"componentEventList",get:function(){return this._componentEventList}},{key:"webview",get:function(){return this._webview}},{key:"state",get:function(){return this._state}},{key:"UICamera",get:function(){return vN.root.batcher2D.getFirstRenderCamera(this._node)}}]),t}();v.internal.WebViewImpl=rmt;var smt,amt,omt,hmt,umt,lmt,cmt,_mt,fmt=A.document,dmt=mn(),pmt=function(t){function e(e){return t.call(this,e)||this}s(e,t);var i=e.prototype;return i._bindDomEvent=function(){var t=this;this.webview&&this.webview.addEventListener("load",(function(e){t._forceUpdate=!0,t.dispatchEvent(imt.LOADED);var i=e.target,n=i.contentDocument&&i.contentDocument.body;n&&n.innerHTML.includes("404")&&t.dispatchEvent(imt.ERROR,n.innerHTML)}))},i.loadURL=function(t){this.webview&&(this.webview.src=t,this.dispatchEvent(imt.LOADING))},i.createWebView=function(){var t=fmt.createElement("div");this._wrapper=t,t.id="webview-wrapper",t.style["-webkit-overflow"]="auto",t.style["-webkit-overflow-scrolling"]="touch",t.style.position="absolute",t.style.bottom="0px",t.style.left="0px",t.style.transformOrigin="0px 100% 0px",t.style["-webkit-transform-origin"]="0px 100% 0px",xN.container.appendChild(t);var e=fmt.createElement("iframe");this._webview=e,e.id="webview",e.style.border="none",e.style.width="100%",e.style.height="100%",t.appendChild(e),this._bindDomEvent()},i.removeWebView=function(){var t=this._wrapper;Pe(xN.container,t)&&xN.container.removeChild(t),this.reset()},i.enable=function(){this._wrapper&&(this._wrapper.style.visibility="visible")},i.disable=function(){this._wrapper&&(this._wrapper.style.visibility="hidden")},i.evaluateJS=function(t){if(this.webview){var e=this.webview.contentWindow;if(e)try{e.eval(t)}catch(t){this.dispatchEvent(imt.ERROR,t),G(t)}}},i.setOnJSCallback=function(){k("The platform does not support")},i.setJavascriptInterfaceScheme=function(){k("The platform does not support")},i.syncMatrix=function(){if(this._wrapper&&this._uiTrans&&this._component&&"hidden"!==this._wrapper.style.visibility){var t=this.UICamera;if(t){this._component.node.getWorldMatrix(dmt),t.update(!0),t.worldMatrixToScreen(dmt,dmt,xN.canvas.width,xN.canvas.height);var e=this._uiTrans.contentSize,i=e.width,n=e.height;if(this._forceUpdate||this._m00!==dmt.m00||this._m01!==dmt.m01||this._m04!==dmt.m04||this._m05!==dmt.m05||this._m12!==dmt.m12||this._m13!==dmt.m13||this._w!==i||this._h!==n){this._m00=dmt.m00,this._m01=dmt.m01,this._m04=dmt.m04,this._m05=dmt.m05,this._m12=dmt.m12,this._m13=dmt.m13,this._w=i,this._h=n;var r=al.devicePixelRatio,s=1/r,a=1/r,o=xN.container,h=dmt.m00*s,u=dmt.m01,l=dmt.m04,c=dmt.m05*a;this._wrapper.style.width=i+"px",this._wrapper.style.height=n+"px";var _=this._w*s,f=this._h*a,d=_*dmt.m00*this._uiTrans.anchorX,p=f*dmt.m05*this._uiTrans.anchorY,m=o&&o.style.paddingLeft?parseInt(o.style.paddingLeft):0,g=o&&o.style.paddingBottom?parseInt(o.style.paddingBottom):0,y="matrix("+h+","+-u+","+-l+","+c+","+(dmt.m12*s-d+m)+","+-(dmt.m13*a-p+g)+")";this._wrapper.style.transform=y,this._wrapper.style["-webkit-transform"]=y,this._forceUpdate=!1}}}},e}(rmt),mmt=function(){function t(){}return t.getImpl=function(t){return new pmt(t)},t}();v.internal.WebViewImplManager=mmt;var gmt=t("fJ",(smt=Is("cc.WebView"),amt=Bs($F),omt=ha([Fd]),smt(hmt=amt(((_mt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(e=t.call.apply(t,[this].concat(n))||this)._url=lmt&&lmt(),e._impl=null,e.webviewEvents=cmt&&cmt(),e}s(e,t);var i=e.prototype;return i.setJavascriptInterfaceScheme=function(t){this._impl&&this._impl.setJavascriptInterfaceScheme(t)},i.setOnJSCallback=function(t){this._impl&&this._impl.setOnJSCallback(t)},i.evaluateJS=function(t){this._impl&&this._impl.evaluateJS(t)},i.__preload=function(){this._impl=mmt.getImpl(this),this._impl.componentEventList.set(imt.LOADING,this.onLoading.bind(this)),this._impl.componentEventList.set(imt.LOADED,this.onLoaded.bind(this)),this._impl.componentEventList.set(imt.ERROR,this.onError.bind(this)),this._impl.loadURL(this._url)},i.onLoading=function(){Fd.emitEvents(this.webviewEvents,this,imt.LOADING),this.node.emit(imt.LOADING,this)},i.onLoaded=function(){Fd.emitEvents(this.webviewEvents,this,imt.LOADED),this.node.emit(imt.LOADED,this)},i.onError=function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];Fd.emitEvents(this.webviewEvents,this,imt.ERROR,e),this.node.emit(imt.ERROR,this,e)},i.onEnable=function(){this._impl&&this._impl.enable()},i.onDisable=function(){this._impl&&this._impl.disable()},i.onDestroy=function(){this._impl&&(this._impl.destroy(),this._impl=null)},i.update=function(){this._impl&&this._impl.syncMatrix()},n(e,[{key:"url",get:function(){return this._url},set:function(t){this._url=t,this._impl&&this._impl.loadURL(t)}},{key:"nativeWebView",get:function(){return this._impl&&this._impl.webview||null}},{key:"state",get:function(){return this._impl?this._impl.state:imt.NONE}}]),e}(Vd)).EventType=imt,lmt=Ss((umt=_mt).prototype,"_url",[ks],(function(){return"https://cocos.com"})),cmt=Ss(umt.prototype,"webviewEvents",[ks,omt],(function(){return[]})),hmt=umt))||hmt)||hmt));v.internal.WebView=gmt}}}));
|