System.register([],(function(t,e){"use strict";return{execute:function(){function i(t,e){for(var i=0;it.length)&&(e=t.length);for(var i=0,n=new Array(e);i=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function f(t,e,i,n,r){var s={};return Object.keys(n).forEach((function(t){s[t]=n[t]})),s.enumerable=!!s.enumerable,s.configurable=!!s.configurable,("value"in s||s.initializer)&&(s.writable=!0),s=i.slice().reverse().reduce((function(i,n){return n(t,e,i)||i}),s),r&&void 0!==s.initializer&&(s.value=s.initializer?s.initializer.call(r):void 0,s.initializer=void 0),void 0===s.initializer&&(Object.defineProperty(t,e,s),s=null),s}function p(t,e){const i="undefined"==typeof window?global:window;return void 0===i[t]?i[t]=e:i[t]}t({D:function(){return 0},J:QF,K:ZF,N:JF,P:function(t){return qF.test(t)},W:function(t){return KF.test(t)},X:tk,Y:ek,Z:ik,_:d,a$:mn,aL:kn,aN:un,aP:rn,aR:In,aU:Nn,aX:zn,aZ:Wn,at:I2,au:O2,aw:function(t,e){for(var i=t,n="";null!==i&&i!==e;)n=i.name+"/"+n,i=i.parent;return n.slice(0,-1)},ax:NZ,b4:wi,b5:xi,b6:Ii,b7:Oi,b8:Di,b9:Mi,bD:function(t){t>0&&(lt=t)},bH:mt,bI:function(t){for(var e,i=d(t);!(e=i()).done;)gt(e.value)},bJ:function(t){return dt||(dt="undefined"==typeof Proxy?{}:new Proxy(t,{get:function(t,e,i){return gt(e),Reflect.get(t,e,i)}})),dt},bK:Sl,bL:El,bO:gi,bP:vi,bZ:function(t){return t[na]},ba:Pi,bb:Bi,bc:Ni,bd:Li,be:Fi,bf:ki,bg:Ui,bh:Gi,bi:Hi,bj:zi,bk:Vi,bl:Wi,bm:Xi,bn:ji,bo:Yi,bp:$i,bq:tn,bw:me,bx:ve,by:Se,c$:function(t,e){return Bs(t,e,0)},c0:Zu,c2:z,c3:k,c4:G,c5:U,c6:H,c7:Y,c8:Z,c9:q,cA:Uh,cM:sa,cO:function(t,e,i){if(ge(t,e),ge(t,i),e===i)return t;var n=t[e];if(e>>1;n<=r;s=n+r>>>1){var a=t[s];if(i(a,e)<0)r=s-1;else{if(!(i(a,e)>0))return s;n=s+1}}return~n},d2:function(){},d3:function(){},d4:ge,d5:Gl,dB:lN,dc:cB,e4:Fp,e6:y8,fF:dSt,fG:fSt}),p("CC_WECHAT",!1),p("CC_BAIDU",!1),p("CC_XIAOMI",!1),p("CC_ALIPAY",!1),p("CC_BYTEDANCE",!1),p("CC_OPPO",!1),p("CC_VIVO",!1),p("CC_HUAWEI",!1),p("CC_COCOSPLAY",!1),p("CC_QTT",!1),p("CC_LINKSURE",!1);const m=!1;p("CC_EDITOR",!1);p("CC_PREVIEW",!1),p("CC_BUILD",!0),p("CC_TEST",!1),p("CC_DEBUG",!1),p("CC_DEV",!1),p("CC_MINIGAME",!1),p("CC_RUNTIME_BASED",!1),p("CC_SUPPORT_JIT",!0),p("CC_JSB",!1);var g="undefined"==typeof window?global:window,v=t("aI",{_global:g});v.internal={};var y=t("aH","3.8.2");g.CocosEngine=v.ENGINE_VERSION=y,g.cc=v;var T=void 0!==globalThis.jsb&&void 0!==jsb.window?jsb.window:globalThis;g.ccwindow=T;var S=2147483647;function E(t){return(t>0)-(t<0)}function A(t){var e,i;return e=(t>65535)<<4,e|=i=((t>>>=e)>255)<<3,e|=i=((t>>>=i)>15)<<2,(e|=i=((t>>>=i)>3)<<1)|(t>>>=i)>>1}function R(t){return 16843009*((t=(858993459&(t-=t>>>1&1431655765))+(t>>>2&858993459))+(t>>>4)&252645135)>>>24}function b(t){var e=32;return(t&=-t)&&e--,65535&t&&(e-=16),16711935&t&&(e-=8),252645135&t&&(e-=4),858993459&t&&(e-=2),1431655765&t&&(e-=1),e}function C(t){return--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,1+(t|=t>>>16)}var w=new Array(256);!function(t){for(var e=0;e<256;++e){var i=e,n=e,r=7;for(i>>>=1;i;i>>>=1)n<<=1,n|=1&i,--r;t[e]=n<>31;return(t^e)-e},min:function(t,e){return e^(t^e)&-(t=1e9?9:t>=1e8?8:t>=1e7?7:t>=1e6?6:t>=1e5?5:t>=1e4?4:t>=1e3?3:t>=100?2:t>=10?1:0},popCount:R,countTrailingZeros:b,nextPow2:C,prevPow2:function(t){return t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)-(t>>>1)},parity:function(t){return t^=t>>>16,t^=t>>>8,t^=t>>>4,27030>>>(t&=15)&1},reverse:function(t){return w[255&t]<<24|w[t>>>8&255]<<16|w[t>>>16&255]<<8|w[t>>>24&255]},interleave2:function(t,e){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t&=65535)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e&=65535)|e<<8))|e<<4))|e<<2))|e<<1))<<1},deinterleave2:function(t,e){return(t=65535&((t=16711935&((t=252645135&((t=858993459&((t=t>>>e&1431655765)|t>>>1))|t>>>2))|t>>>4))|t>>>16))<<16>>16},interleave3:function(t,e,i){return t=1227133513&((t=3272356035&((t=251719695&((t=4278190335&((t&=1023)|t<<16))|t<<8))|t<<4))|t<<2),(t|=(e=1227133513&((e=3272356035&((e=251719695&((e=4278190335&((e&=1023)|e<<16))|e<<8))|e<<4))|e<<2))<<1)|(i=1227133513&((i=3272356035&((i=251719695&((i=4278190335&((i&=1023)|i<<16))|i<<8))|i<<4))|i<<2))<<2},deinterleave3:function(t,e){return(t=1023&((t=4278190335&((t=251719695&((t=3272356035&((t=t>>>e&1227133513)|t>>>2))|t>>>4))|t>>>8))|t>>>16))<<22>>22},nextCombination:function(t){var e=t|t-1;return e+1|(~e&-~e)-1>>>b(t)+1}});t("aJ",x);var I=T.document,O="https://github.com/cocos-creator/engine/blob/develop/EngineErrorMap.md",D=null,M=console.log.bind(console),P=M,B=M,N=function(t,e){if(!t){for(var i=arguments.length,n=new Array(i>2?i-2:0),r=2;r2?i-2:0),r=2;rJ.ERROR){var e=function(t){if(v.game.canvas){if(!D){var e=I.createElement("Div");e.setAttribute("id","logInfoDiv"),e.setAttribute("width","200"),e.setAttribute("height",v.game.canvas.height);var i=e.style;i.zIndex="99999",i.position="absolute",i.top=i.left="0",(D=I.createElement("textarea")).setAttribute("rows","20"),D.setAttribute("cols","30"),D.setAttribute("disabled","true");var n=D.style;n.backgroundColor="transparent",n.borderBottom="1px solid #cccccc",n.borderTopWidth=n.borderLeftWidth=n.borderRightWidth="0px",n.borderTopStyle=n.borderLeftStyle=n.borderRightStyle="none",n.padding="0px",n.margin="0px",e.appendChild(D),v.game.canvas.parentNode.appendChild(e)}D.value=D.value+t+"\r\n",D.scrollTop=D.scrollHeight}};B=function(){e("ERROR : "+F.apply(void 0,arguments))},N=function(t,i){if(!t){for(var n=arguments.length,r=new Array(n>2?n-2:0),s=2;s2?i-2:0),r=2;r1?n-1:0),s=1;s1?e-1:0),n=1;n1?e-1:0),n=1;n1?e-1:0),n=1;n2?i-2:0),r=2;r1?e-1:0),n=1;no.count&&(r("'%s' is deprecated, please use '%s' instead. "+a,t+"."+e,i+"."+n),o.count++)},t("bE",rt=function(t,e,i){null!=t&&i.forEach((function(i){var n=ct++;_t.set(n,{id:n,count:0,logTimes:void 0!==i.logTimes?i.logTimes:lt});var r=null!=i.target?i.target:t,s=null!=i.newName?i.newName:i.name,a=null!=i.targetName?i.targetName:e,o=r===t,h=i.suggest?"("+i.suggest+")":"";if(null!=i.customFunction)t[i.name]=function(){var t;return ot(e,i.name,a,s,U,n,h),(t=i.customFunction).call.apply(t,[this].concat(Array.prototype.slice.call(arguments)))};else if(null!=i.customSetter||null!=i.customGetter){var u=null!=i.customSetter,l=null!=i.customGetter;u&&l?Object.defineProperty(t,i.name,{get:function(){return ot(e,i.name,a,s,U,n,h),i.customGetter.call(this)},set:function(t){ot(e,i.name,a,s,U,n,h),i.customSetter.call(this,t)},enumerable:!1}):u?Object.defineProperty(t,i.name,{set:function(t){ot(e,i.name,a,s,U,n,h),i.customSetter.call(this,t)},enumerable:!1}):l&&Object.defineProperty(t,i.name,{get:function(){return ot(e,i.name,a,s,U,n,h),i.customGetter.call(this)},enumerable:!1})}else Object.defineProperty(t,i.name,{get:function(){return ot(e,i.name,a,s,U,n,h),o?this[s]:r[s]},set:function(t){ot(e,i.name,a,s,U,n,h),o?this[s]=t:r[s]=t},enumerable:!1})}))}),ht=function(t,e,i,n,r){var s=_t.get(n);s&&s.logTimes>s.count&&(i("'%s' has been removed. "+r,t+"."+e),s.count++)},t("bF",st=function(t,e,i){null!=t&&i.forEach((function(i){var n=ct++;_t.set(n,{id:n,count:0,logTimes:void 0!==i.logTimes?i.logTimes:lt});var r=i.suggest?"("+i.suggest+")":"";Object.defineProperty(t,i.name,{get:function(){return ht(e,i.name,G,n,r)},set:function(){ht(e,i.name,G,n,r)},enumerable:!1})}))}),t("bG",at=function(){});var dt,ft,pt={};function mt(t){for(var e in t){var i=t[e];pt[e]=i}}function gt(t){var e=pt[t];if(e){var i=e.newName,n=e.since;e.removed?i?Z(16003,t,n,i):Z(16002,t,n):i?q(16001,t,n,i):q(16e3,t,n)}}var vt=function(){function t(t){this.id=void 0,this.prefix=void 0,this.id=0|998*Math.random(),this.prefix=t?t+".":""}return t.prototype.getNewId=function(){return this.prefix+(++this.id).toString()},t}();ft=vt,vt.global=new ft("global");var yt=new vt("TmpCId."),Tt="undefined"==typeof Symbol?"__aliases__":Symbol("[[Aliases]]"),St="__cid__";function Et(t){return"number"==typeof t||t instanceof Number}function At(t){return"string"==typeof t||t instanceof String}function Rt(t){for(var e in t)return!1;return!0}var bt,Ct=(bt={value:void 0,enumerable:!1,writable:!1,configurable:!0},function(t,e,i,n,r){bt.value=i,bt.writable=n,bt.enumerable=r,Object.defineProperty(t,e,bt),bt.value=void 0}),wt=function(){var t={get:void 0,set:void 0,enumerable:!1};return function(e,i,n,r,s,a){void 0===s&&(s=!1),void 0===a&&(a=!1),"boolean"==typeof r&&(console.log("Set `setter` to boolean is deprecated. Please don not use like this again."),s=r,r=void 0),t.get=n,t.set=r,t.enumerable=s,t.configurable=a,Object.defineProperty(e,i,t),t.get=void 0,t.set=void 0}}(),xt=function(){var t={get:void 0,enumerable:!1,configurable:!1};return function(e,i,n,r,s){t.get=n,t.enumerable=r,t.configurable=s,Object.defineProperty(e,i,t),t.get=void 0}}(),It=function(){var t={set:void 0,enumerable:!1,configurable:!1};return function(e,i,n,r,s){t.set=n,t.enumerable=r,t.configurable=s,Object.defineProperty(e,i,t),t.set=void 0}}();function Ot(t){var e=Object.create(null);return t&&(e["."]=1,e["/"]=1,delete e["."],delete e["/"]),e}function Dt(t){if("function"==typeof t){var e=t.prototype;if(e&&e.hasOwnProperty("__classname__")&&e.__classname__)return e.__classname__;var i="";if(t.name&&(i=t.name),t.toString){var n,r=t.toString();(n="["===r.charAt(0)?/\[\w+\s*(\w+)\]/.exec(r):/function\s*(\w+)/.exec(r))&&2===n.length&&(i=n[1])}return"Object"!==i?i:""}return t&&t.constructor?Dt(t.constructor):""}function Mt(t,e,i,n){var r=/([^.]+)$/,s=r.exec(e)[0],a=r.exec(i)[0];function o(){return this[a]}n?wt(t,s,o,(function(t){this[a]=t})):xt(t,s,o)}function Pt(t,e,i,n){for(var r in i)Mt(t,e+"."+r,i[r],n)}var Bt=/(%d)|(%s)/,Nt=/%s/;function Lt(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n1?e-1:0),n=1;n1?e-1:0),n=1;n0){--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=0&&(this._pool.length=t,this.count>t&&(this.count=t))},e}(),ae=function(){function t(t){this.i=0,this.array=t}var e=t.prototype;return e.remove=function(t){var e=this.array.indexOf(t);e>=0&&this.removeAt(e)},e.removeAt=function(t){this.array.splice(t,1),t<=this.i&&--this.i},e.fastRemove=function(t){var e=this.array.indexOf(t);e>=0&&this.fastRemoveAt(e)},e.fastRemoveAt=function(t){var e=this.array;e[t]=e[e.length-1],--e.length,t<=this.i&&--this.i},e.push=function(t){this.array.push(t)},n(t,[{key:"length",get:function(){return this.array.length},set:function(t){this.array.length=t,this.i>=t&&(this.i=t-1)}}]),t}();function oe(t,e){t.splice(e,1)}function he(t,e){var i=t.length;e<0||e>=i||(t[e]=t[i-1],t.length=i-1)}function ue(t,e){var i=t.indexOf(e);return i>=0&&(oe(t,i),!0)}function le(t,e){var i=t.indexOf(e);i>=0&&(t[i]=t[t.length-1],--t.length)}function ce(t,e){var i=t.findIndex(e);if(i>=0){var n=t[i];return oe(t,i),n}}function _e(t,e){return t.indexOf(e)>=0}var de=Object.freeze({__proto__:null,removeAt:oe,fastRemoveAt:he,remove:ue,fastRemove:le,removeIf:ce,verifyType:function(t,e){if(t&&t.length>0)for(var i,n=d(t);!(i=n()).done;)if(!(i.value instanceof e))return Y(1300),!1;return!0},removeArray:function(t,e){for(var i=0,n=e.length;i=0&&t.length,t.length}function ve(t){return"__enums__"in t?t:(Ct(t,"__enums__",null,!0),ve.update(t))}function ye(t){t.hasOwnProperty("__enums__")}function Te(t){ye(t);var e=t.__enums__||[];for(var i in e.length=0,t){var n=t[i];Number.isInteger(n)&&e.push({name:i,value:n})}return e.sort((function(t,e){return t.value-e.value})),t.__enums__=e,e}function Se(t){"__enums__"in t||Ct(t,"__enums__",null,!0)}t("bA",pe),me.isBitMask=function(t){return t&&t.hasOwnProperty("__bitmask__")},me.getList=function(t){return t.__bitmask__?t.__bitmask__:me.update(t)},me.update=function(t){Array.isArray(t.__bitmask__)||(t.__bitmask__=[]);var e=t.__bitmask__;for(var i in e.length=0,t){var n=t[i];Number.isInteger(n)&&e.push({name:i,value:n})}return e.sort((function(t,e){return t.value-e.value})),e},v.BitMask=me,ve.update=function(t){for(var e=-1,i=Object.keys(t),n=0;n2?n-2:0),s=2;si){var n=e;e=i,i=n}return t=0;n--){var r=i[n];r.hasOwnProperty("__attrs__")&&r.__attrs__||ze(r,(e=i[n+1])&&e.__attrs__)}return ze(t,(e=i[0])&&e.__attrs__),t.__attrs__}function We(t,e){var i=Xe(t),n=e+He,r={};for(var s in i)s.startsWith(n)&&(r[s.slice(n.length)]=i[s]);return r}function Xe(t){return t.hasOwnProperty("__attrs__")&&t.__attrs__||Ve(t)}function je(t,e,i,n){Xe(t)[e+He+i]=n}var Ye=function(){function t(t,e){this.name=void 0,this.default=void 0,this.name=t,this.default=e}return t.prototype.toString=function(){return this.name},t}(),Ke=t("bR",new Ye("Integer",0));v.Integer=Ke,v.CCInteger=Ke;var qe=t("bS",new Ye("Float",0));v.Float=qe,v.CCFloat=qe;var Qe=t("bT",new Ye("Boolean",!1));v.Boolean=Qe,v.CCBoolean=Qe;var Ze=t("bU",new Ye("String",""));function Je(t,e){return function(i,n){var r='"'+Dt(i)+"."+n+'"',s=We(i,n),a=s.type;if(a===Ke||a===qe?a="Number":a!==Ze&&a!==Qe||(a=""+a),a===t){if(s.hasOwnProperty("default")){var o=s.default;if(void 0!==o&&!Array.isArray(o)&&!Fe(o)){var h=typeof o,u=t.toLowerCase();if(h===u)if("object"===u){if(!o||o instanceof s.ctor)return;q(3605,r,Dt(s.ctor))}else"Number"!==t&&q(3606,e,r,t);else{if("function"===h)return;t===Ze.default&&null==o?q(3607,r):q(3611,e,r,h)}delete s.type}}}else q(3604,r)}}v.String=Ze,v.CCString=Ze;var $e=Object.freeze({__proto__:null,DELIMETER:He,createAttrsSingle:ze,createAttrs:Ve,attr:We,getClassAttrs:Xe,setClassAttr:je,PrimitiveType:Ye,CCInteger:Ke,CCFloat:qe,CCBoolean:Qe,CCString:Ze,getTypeChecker_ET:Je,getObjTypeChecker_ET:function(t){return function(e,i){Je("Object","type")(e,i);var n=Xe(e)[i+He+"default"],r=v.Class.getDefault(n);if(!Array.isArray(r)&&Wt(t,v.ValueType)){var s=Dt(t),a=Lt('No need to specify the "type" of "%s.%s" because %s is a child class of ValueType.',Dt(e),i,s);n?k(a):q(3612,a,s,Dt(e),i,s)}}}}),ti={default:{},serializable:{},editorOnly:{},formerlySerializedAs:{}};function ei(t,e,i,n){if(!t.get&&!t.set&&t.hasOwnProperty("default")){var r="_N$"+e;t.get=function(){return this[r]},t.set=function(t){var e=this[r];this[r]=t,i.call(this,e)};var s={};for(var a in n[r]=s,ti){var o=ti[a];t.hasOwnProperty(a)&&(s[a]=t[a],o.canUsedInGet||delete t[a])}}}function ii(t,e,i,n){if(Array.isArray(e)){if(!(e.length>0))return Z(5508,i,n);t.type=e=e[0]}"function"==typeof e&&(e===String?t.type=v.String:e===Boolean?t.type=v.Boolean:e===Number&&(t.type=v.Float))}function ni(t,e,i){var n=t||void 0===e?{_short:!0}:{_short:!0,default:e};return i&&(n.type=i),n}function ri(t,e){if(!t||t.constructor!==Object){if(Array.isArray(t)&&t.length>0)return ni(e,[],t);if("function"==typeof t){var i=t;return ni(e,Wt(i,v.ValueType)?new i:null,i)}return t instanceof Ye?ni(e,void 0,t):ni(e,t)}return null}var si,ai=[];function oi(){return ai[ai.length-1]}function hi(t,e,i){ui(Xe(t),e,i)}function ui(t,e,i){t[e+"$_$type"]="Enum",t[e+"$_$enumList"]=ve.getList(i)}v._RF={push:function(t,e,i,n){void 0===i&&(i=e,e=""),ai.push({uuid:e,script:i,module:t,exports:t.exports,beh:null,importMeta:n})},pop:function(){var t=ai.pop(),e=t.module,i=e.exports;if(i===t.exports){for(var n in i)return;e.exports=i=t.cls}},peek:oi},function(t){t[t.STANDALONE=1]="STANDALONE",t[t.IMPLICIT_VISIBLE=2]="IMPLICIT_VISIBLE",t[t.IMPLICIT_SERIALIZABLE=4]="IMPLICIT_SERIALIZABLE"}(si||(si={}));var li=He,ci="__ctors__",_i=t("cT","Enum"),di=t("cU","BitMask");function fi(t,e,i,n){!function(t,e){!function(t,e){t.indexOf(e)<0&&t.push(e)}(t.__props__,e)}(t,i),Ti(t,n,e,i)}function pi(t,e,i,n){var r=n.get;n.set,r&&(Ti(t,n,e,i),je(t,i,"serializable",!1))}function mi(t){return"function"==typeof t?t():t}function gi(t){var e=t.name,i=t.extends,n=function(t,e,i){var n=v.Component,r=oi();if(r&&Wt(e,n)){if(Wt(r.cls,n))return Z(3615),null;t=t||r.script}var s=function(t,e,i){var n=i.ctor;return Ct(n,ci,!0,!0),n.prototype,e&&(n.$super=e),Zt(t,n),n}(t,e,i);if(r)if(Wt(e,n)){var a=r.uuid;a&&qt(a,s),r.cls=s}else Wt(r.cls,n)||(r.cls=s);return s}(e,i,t);e||(e=v.js.getClassName(n)),n._sealed=!0,i&&(i._sealed=!1),function(t,e,i,n){if(t.__props__=[],n&&n.__props__&&(t.__props__=n.__props__.slice()),i)for(var r in function(t,e){for(var i in t){var n=t[i],r=ri(n,!1);if(r&&(n=t[i]=r),n){var s=n.notify;s&&ei(n,i,s,t),"type"in n&&ii(n,n.type,e,i)}}}(i,e),i){var s=i[r];s.get||s.set?pi(t,e,r,s):fi(t,e,r,s)}var a=Xe(t);t.__values__=t.__props__.filter((function(t){return!1!==a[t+"$_$serializable"]}))}(n,e,t.properties,i);var r=t.editor;return r&&Wt(i,v.Component)&&v.Component._registerEditorProps(n,r),n}function vi(t){var e;return null==t||null===(e=t.hasOwnProperty)||void 0===e?void 0:e.call(t,"__values__")}gi._isCCClass=function(t){var e;return null==t||null===(e=t.hasOwnProperty)||void 0===e?void 0:e.call(t,ci)},gi.fastDefine=function(t,e,i){Zt(t,e);for(var n=e.__props__=e.__values__=Object.keys(i),r=Xe(e),s=0;s=2&&((r||a())[s+"min"]=l[0],r[s+"max"]=l[1],l.length>2&&(r[s+"step"]=l[2])),u("min","number"),u("max","number"),u("step","number")}gi.isArray=function(t){return t=mi(t),Array.isArray(t)},gi.getDefault=mi,gi.escapeForJS=function(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")},gi.IDENTIFIER_RE=/^[A-Za-z_$][0-9A-Za-z_$]*$/,gi.getNewValueTypeCode=function(t){for(var e=Dt(t),i=t.constructor,n="new "+e+"(",r=0;ri){var n=e;e=i,i=n}return ti?i:t}function Oi(t){return t<0?0:t>1?1:t}function Di(t,e,i){return t+(e-t)*i}function Mi(t){return t*Si}function Pi(t){return t*Ei}function Bi(){return Ai()}function Ni(t){Ai=t}function Li(t,e){return Bi()*(e-t)+t}function Fi(t,e){return Math.floor(Li(t,e))}function ki(t){return(t=(9301*t+49297)%233280)/233280}function Ui(t,e,i){return ki(t)*(i-e)+e}function Gi(t,e,i){return Math.floor(Ui(t,e,i))}function Hi(t){return C(t)}function zi(t,e){return t-Math.floor(t/e)*e}function Vi(t,e){return t=zi(t,2*e),e-Math.abs(t-e)}function Wi(t,e,i){return(i-t)/(e-t)}function Xi(t){return Math.abs(t.x)>Math.abs(t.y)?Math.abs(t.x)>Math.abs(t.z)?t.x:t.z:Math.abs(t.y)>Math.abs(t.z)?t.y:t.z}function ji(t,e){return Math.abs(t)>Math.abs(e)?t:e}function Yi(t,e){e.forEach((function(e){Object.defineProperty(t,e,{enumerable:!0})}))}var Ki,qi,Qi,Zi=(Ki=new Float32Array(1),qi=new Int32Array(Ki.buffer),function(t){Ki[0]=t;var e=qi[0],i=e>>16&32768,n=2147483647&e,r=n-(112<<23)+4096>>13;return r=n<113<<23?0:r,r=n>=143<<23?31744:r,r=n>255<<23?32256:r,qi[0]=i|r,qi[0]}),Ji=function(){var t=new Float32Array(1),e=new Int32Array(t.buffer);return function(i){var n,r=32767&i,s=r<<13;return 31744!==s?(s+=112<<23,0===r?s=(1048575&s)>>1:32767===r&&(s=2147483647)):s=2139095040,n=(i>>15&1)<<31|s,e[0]=n,t[0]}}();function $i(t){return Zi(t)}function tn(t){return Ji(t)}var en,nn=t("aO",function(t){function e(e,i,n,r){var s;return s=t.call(this)||this,"object"==typeof e?(s.x=e.x,s.y=e.y,s.z=e.z,s.w=e.w):(s.x=e||0,s.y=i||0,s.z=n||0,s.w=r||0),s}s(e,t),e.clone=function(t){return new e(t.x,t.y,t.z,t.w)},e.copy=function(t,e){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t},e.set=function(t,e,i,n,r){return t.x=e,t.y=i,t.z=n,t.w=r,t},e.fromColor=function(t,e){return t.x=e.r,t.y=e.g,t.z=e.b,t.w=e.a,t},e.angle=function(t,e){var i=t.y*e.z-t.z*e.y,n=t.z*e.x-t.x*e.z,r=t.x*e.y-t.y*e.x,s=t.x*e.x+t.y*e.y+t.z*e.z;return Math.atan2(Math.sqrt(i*i+n*n+r*r),s)},e.add=function(t,e,i){return t.x=e.x+i.x,t.y=e.y+i.y,t.z=e.z+i.z,t.w=e.w+i.w,t},e.subtract=function(t,e,i){return t.x=e.x-i.x,t.y=e.y-i.y,t.z=e.z-i.z,t.w=e.w-i.w,t},e.multiply=function(t,e,i){return t.x=e.x*i.x,t.y=e.y*i.y,t.z=e.z*i.z,t.w=e.w*i.w,t},e.divide=function(t,e,i){return t.x=e.x/i.x,t.y=e.y/i.y,t.z=e.z/i.z,t.w=e.w/i.w,t},e.ceil=function(t,e){return t.x=Math.ceil(e.x),t.y=Math.ceil(e.y),t.z=Math.ceil(e.z),t.w=Math.ceil(e.w),t},e.floor=function(t,e){return t.x=Math.floor(e.x),t.y=Math.floor(e.y),t.z=Math.floor(e.z),t.w=Math.floor(e.w),t},e.min=function(t,e,i){return t.x=Math.min(e.x,i.x),t.y=Math.min(e.y,i.y),t.z=Math.min(e.z,i.z),t.w=Math.min(e.w,i.w),t},e.max=function(t,e,i){return t.x=Math.max(e.x,i.x),t.y=Math.max(e.y,i.y),t.z=Math.max(e.z,i.z),t.w=Math.max(e.w,i.w),t},e.round=function(t,e){return t.x=Math.round(e.x),t.y=Math.round(e.y),t.z=Math.round(e.z),t.w=Math.round(e.w),t},e.multiplyScalar=function(t,e,i){return t.x=e.x*i,t.y=e.y*i,t.z=e.z*i,t.w=e.w*i,t},e.scaleAndAdd=function(t,e,i,n){return t.x=e.x+i.x*n,t.y=e.y+i.y*n,t.z=e.z+i.z*n,t.w=e.w+i.w*n,t},e.distance=function(t,e){var i=e.x-t.x,n=e.y-t.y,r=e.z-t.z,s=e.w-t.w;return Math.sqrt(i*i+n*n+r*r+s*s)},e.squaredDistance=function(t,e){var i=e.x-t.x,n=e.y-t.y,r=e.z-t.z,s=e.w-t.w;return i*i+n*n+r*r+s*s},e.len=function(t){var e=t.x,i=t.y,n=t.z,r=t.w;return Math.sqrt(e*e+i*i+n*n+r*r)},e.lengthSqr=function(t){var e=t.x,i=t.y,n=t.z,r=t.w;return e*e+i*i+n*n+r*r},e.negate=function(t,e){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t},e.inverse=function(t,e){return t.x=1/e.x,t.y=1/e.y,t.z=1/e.z,t.w=1/e.w,t},e.inverseSafe=function(t,e){var i=e.x,n=e.y,r=e.z,s=e.w;return Math.abs(i)0?(a=1/Math.sqrt(a),t.x=i*a,t.y=n*a,t.z=r*a,t.w=s*a):(t.x=0,t.y=0,t.z=0,t.w=0),t},e.dot=function(t,e){return t.x*e.x+t.y*e.y+t.z*e.z+t.w*e.w},e.lerp=function(t,e,i,n){return t.x=e.x+n*(i.x-e.x),t.y=e.y+n*(i.y-e.y),t.z=e.z+n*(i.z-e.z),t.w=e.w+n*(i.w-e.w),t},e.scale=function(t,e,i){return t.x=e.x*i,t.y=e.y*i,t.z=e.z*i,t.w=e.w*i,t},e.random=function(t,e){e=e||1;var i=2*Bi()*Math.PI,n=2*Bi()-1,r=Math.sqrt(1-n*n);return t.x=r*Math.cos(i)*e,t.y=r*Math.sin(i)*e,t.z=n*e,t.w=0,t},e.transformMat4=function(t,e,i){var n=e.x,r=e.y,s=e.z,a=e.w;return t.x=i.m00*n+i.m04*r+i.m08*s+i.m12*a,t.y=i.m01*n+i.m05*r+i.m09*s+i.m13*a,t.z=i.m02*n+i.m06*r+i.m10*s+i.m14*a,t.w=i.m03*n+i.m07*r+i.m11*s+i.m15*a,t},e.transformAffine=function(t,e,i){var n=e.x,r=e.y,s=e.z,a=e.w;return t.x=i.m00*n+i.m04*r+i.m08*s+i.m12*a,t.y=i.m01*n+i.m05*r+i.m09*s+i.m13*a,t.z=i.m02*n+i.m06*r+i.m10*s+i.m14*a,t.w=e.w,t},e.transformQuat=function(t,e,i){var n=e.x,r=e.y,s=e.z,a=i.x,o=i.y,h=i.z,u=i.w,l=u*n+o*s-h*r,c=u*r+h*n-a*s,_=u*s+a*r-o*n,d=-a*n-o*r-h*s;return t.x=l*u+d*-a+c*-h-_*-o,t.y=c*u+d*-o+_*-a-l*-h,t.z=_*u+d*-h+l*-o-c*-a,t.w=e.w,t},e.toArray=function(t,e,i){return void 0===i&&(i=0),t[i+0]=e.x,t[i+1]=e.y,t[i+2]=e.z,t[i+3]=e.w,t},e.fromArray=function(t,e,i){return void 0===i&&(i=0),t.x=e[i+0],t.y=e[i+1],t.z=e[i+2],t.w=e[i+3],t},e.strictEquals=function(t,e){return t.x===e.x&&t.y===e.y&&t.z===e.z&&t.w===e.w},e.equals=function(t,e,i){return void 0===i&&(i=Ci),!(Math.abs(t.x)===1/0||Math.abs(t.y)===1/0||Math.abs(t.z)===1/0||Math.abs(t.w)===1/0||Math.abs(e.x)===1/0||Math.abs(e.y)===1/0||Math.abs(e.z)===1/0||Math.abs(e.w)===1/0)&&Math.abs(t.x-e.x)<=i*Math.max(1,Math.abs(t.x),Math.abs(e.x))&&Math.abs(t.y-e.y)<=i*Math.max(1,Math.abs(t.y),Math.abs(e.y))&&Math.abs(t.z-e.z)<=i*Math.max(1,Math.abs(t.z),Math.abs(e.z))&&Math.abs(t.w-e.w)<=i*Math.max(1,Math.abs(t.w),Math.abs(e.w))};var i=e.prototype;return i.clone=function(){return new e(this.x,this.y,this.z,this.w)},i.set=function(t,e,i,n){return"object"==typeof t?(this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w):(this.x=t||0,this.y=e||0,this.z=i||0,this.w=n||0),this},i.equals=function(t,e){return void 0===e&&(e=Ci),Math.abs(this.x-t.x)<=e*Math.max(1,Math.abs(this.x),Math.abs(t.x))&&Math.abs(this.y-t.y)<=e*Math.max(1,Math.abs(this.y),Math.abs(t.y))&&Math.abs(this.z-t.z)<=e*Math.max(1,Math.abs(this.z),Math.abs(t.z))&&Math.abs(this.w-t.w)<=e*Math.max(1,Math.abs(this.w),Math.abs(t.w))},i.equals4f=function(t,e,i,n,r){return void 0===r&&(r=Ci),Math.abs(this.x-t)<=r*Math.max(1,Math.abs(this.x),Math.abs(t))&&Math.abs(this.y-e)<=r*Math.max(1,Math.abs(this.y),Math.abs(e))&&Math.abs(this.z-i)<=r*Math.max(1,Math.abs(this.z),Math.abs(i))&&Math.abs(this.w-n)<=r*Math.max(1,Math.abs(this.w),Math.abs(n))},i.strictEquals=function(t){return this.x===t.x&&this.y===t.y&&this.z===t.z&&this.w===t.w},i.strictEquals4f=function(t,e,i,n){return this.x===t&&this.y===e&&this.z===i&&this.w===n},i.lerp=function(t,e){var i=this.x,n=this.y,r=this.z,s=this.w;return this.x=i+e*(t.x-i),this.y=n+e*(t.y-n),this.z=r+e*(t.z-r),this.w=s+e*(t.w-s),this},i.toString=function(){return"("+this.x.toFixed(2)+", "+this.y.toFixed(2)+", "+this.z.toFixed(2)+", "+this.w.toFixed(2)+")"},i.clampf=function(t,e){return this.x=Ii(this.x,t.x,e.x),this.y=Ii(this.y,t.y,e.y),this.z=Ii(this.z,t.z,e.z),this.w=Ii(this.w,t.w,e.w),this},i.add=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this},i.add4f=function(t,e,i,n){return this.x+=t,this.y+=e,this.z+=i,this.w+=n,this},i.subtract=function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this},i.subtract4f=function(t,e,i,n){return this.x-=t,this.y-=e,this.z-=i,this.w-=n,this},i.multiplyScalar=function(t){return"object"==typeof t&&console.warn("should use Vec4.multiply for vector * vector operation"),this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},i.multiply=function(t){return"object"!=typeof t&&console.warn("should use Vec4.scale for vector * scalar operation"),this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this},i.multiply4f=function(t,e,i,n){return this.x*=t,this.y*=e,this.z*=i,this.w*=n,this},i.divide=function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this},i.divide4f=function(t,e,i,n){return this.x/=t,this.y/=e,this.z/=i,this.w/=n,this},i.negative=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},i.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},i.cross=function(t){var e=this.x,i=this.y,n=this.z,r=t.x,s=t.y,a=t.z;return this.x=i*a-n*s,this.y=n*r-e*a,this.z=e*s-i*r,this},i.length=function(){var t=this.x,e=this.y,i=this.z,n=this.w;return Math.sqrt(t*t+e*e+i*i+n*n)},i.lengthSqr=function(){var t=this.x,e=this.y,i=this.z,n=this.w;return t*t+e*e+i*i+n*n},i.normalize=function(){var t=this.x,e=this.y,i=this.z,n=this.w,r=t*t+e*e+i*i+n*n;return r>0&&(r=1/Math.sqrt(r),this.x=t*r,this.y=e*r,this.z=i*r,this.w=n*r),this},i.scale=function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},i.transformMat4=function(t){var e=this.x,i=this.y,n=this.z,r=this.w;return this.x=t.m00*e+t.m04*i+t.m08*n+t.m12*r,this.y=t.m01*e+t.m05*i+t.m09*n+t.m13*r,this.z=t.m02*e+t.m06*i+t.m10*n+t.m14*r,this.w=t.m03*e+t.m07*i+t.m11*n+t.m15*r,this},e}(Ae));function rn(t,e,i,n){return new nn(t,e,i,n)}Qi=nn,nn.ZERO=Object.freeze(new Qi(0,0,0,0)),nn.ONE=Object.freeze(new Qi(1,1,1,1)),nn.NEG_ONE=Object.freeze(new Qi(-1,-1,-1,-1)),nn.UNIT_X=Object.freeze(new Qi(1,0,0,0)),nn.UNIT_Y=Object.freeze(new Qi(0,1,0,0)),nn.UNIT_Z=Object.freeze(new Qi(0,0,1,0)),nn.UNIT_W=Object.freeze(new Qi(0,0,0,1)),gi.fastDefine("cc.Vec4",nn,{x:0,y:0,z:0,w:0}),v.Vec4=nn,v.v4=rn;var sn,an,on,hn=t("aM",function(t){function e(e,i,n){var r;return r=t.call(this)||this,"object"==typeof e?(r.x=e.x,r.y=e.y,r.z=e.z):(r.x=e||0,r.y=i||0,r.z=n||0),r}s(e,t),e.zero=function(t){return t.x=0,t.y=0,t.z=0,t},e.clone=function(t){return new e(t.x,t.y,t.z)},e.copy=function(t,e){return t.x=e.x,t.y=e.y,t.z=e.z,t},e.set=function(t,e,i,n){return t.x=e,t.y=i,t.z=n,t},e.add=function(t,e,i){return t.x=e.x+i.x,t.y=e.y+i.y,t.z=e.z+i.z,t},e.subtract=function(t,e,i){return t.x=e.x-i.x,t.y=e.y-i.y,t.z=e.z-i.z,t},e.multiply=function(t,e,i){return t.x=e.x*i.x,t.y=e.y*i.y,t.z=e.z*i.z,t},e.divide=function(t,e,i){return t.x=e.x/i.x,t.y=e.y/i.y,t.z=e.z/i.z,t},e.ceil=function(t,e){return t.x=Math.ceil(e.x),t.y=Math.ceil(e.y),t.z=Math.ceil(e.z),t},e.floor=function(t,e){return t.x=Math.floor(e.x),t.y=Math.floor(e.y),t.z=Math.floor(e.z),t},e.min=function(t,e,i){return t.x=Math.min(e.x,i.x),t.y=Math.min(e.y,i.y),t.z=Math.min(e.z,i.z),t},e.max=function(t,e,i){return t.x=Math.max(e.x,i.x),t.y=Math.max(e.y,i.y),t.z=Math.max(e.z,i.z),t},e.round=function(t,e){return t.x=Math.round(e.x),t.y=Math.round(e.y),t.z=Math.round(e.z),t},e.multiplyScalar=function(t,e,i){return t.x=e.x*i,t.y=e.y*i,t.z=e.z*i,t},e.scaleAndAdd=function(t,e,i,n){return t.x=e.x+i.x*n,t.y=e.y+i.y*n,t.z=e.z+i.z*n,t},e.distance=function(t,e){var i=e.x-t.x,n=e.y-t.y,r=e.z-t.z;return Math.sqrt(i*i+n*n+r*r)},e.squaredDistance=function(t,e){var i=e.x-t.x,n=e.y-t.y,r=e.z-t.z;return i*i+n*n+r*r},e.len=function(t){var e=t.x,i=t.y,n=t.z;return Math.sqrt(e*e+i*i+n*n)},e.lengthSqr=function(t){var e=t.x,i=t.y,n=t.z;return e*e+i*i+n*n},e.negate=function(t,e){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t},e.invert=function(t,e){return t.x=1/e.x,t.y=1/e.y,t.z=1/e.z,t},e.invertSafe=function(t,e){var i=e.x,n=e.y,r=e.z;return Math.abs(i)0?(s=1/Math.sqrt(s),t.x=i*s,t.y=n*s,t.z=r*s):(t.x=0,t.y=0,t.z=0),t},e.dot=function(t,e){return t.x*e.x+t.y*e.y+t.z*e.z},e.cross=function(t,e,i){var n=e.x,r=e.y,s=e.z,a=i.x,o=i.y,h=i.z;return t.x=r*h-s*o,t.y=s*a-n*h,t.z=n*o-r*a,t},e.lerp=function(t,e,i,n){return t.x=e.x+n*(i.x-e.x),t.y=e.y+n*(i.y-e.y),t.z=e.z+n*(i.z-e.z),t},e.random=function(t,e){e=e||1;var i=2*Bi()*Math.PI,n=2*Bi()-1,r=Math.sqrt(1-n*n);return t.x=r*Math.cos(i)*e,t.y=r*Math.sin(i)*e,t.z=n*e,t},e.transformMat4=function(t,e,i){var n=e.x,r=e.y,s=e.z,a=i.m03*n+i.m07*r+i.m11*s+i.m15;return a=a?1/a:1,t.x=(i.m00*n+i.m04*r+i.m08*s+i.m12)*a,t.y=(i.m01*n+i.m05*r+i.m09*s+i.m13)*a,t.z=(i.m02*n+i.m06*r+i.m10*s+i.m14)*a,t},e.transformMat4Normal=function(t,e,i){var n=e.x,r=e.y,s=e.z,a=i.m03*n+i.m07*r+i.m11*s;return a=a?1/a:1,t.x=(i.m00*n+i.m04*r+i.m08*s)*a,t.y=(i.m01*n+i.m05*r+i.m09*s)*a,t.z=(i.m02*n+i.m06*r+i.m10*s)*a,t},e.transformMat3=function(t,e,i){var n=e.x,r=e.y,s=e.z;return t.x=n*i.m00+r*i.m03+s*i.m06,t.y=n*i.m01+r*i.m04+s*i.m07,t.z=n*i.m02+r*i.m05+s*i.m08,t},e.transformAffine=function(t,e,i){var n=e.x,r=e.y,s=e.z;return t.x=i.m00*n+i.m04*r+i.m08*s+i.m12,t.y=i.m01*n+i.m05*r+i.m09*s+i.m13,t.z=i.m02*n+i.m06*r+i.m10*s+i.m14,t},e.transformQuat=function(t,e,i){var n=i.w*e.x+i.y*e.z-i.z*e.y,r=i.w*e.y+i.z*e.x-i.x*e.z,s=i.w*e.z+i.x*e.y-i.y*e.x,a=-i.x*e.x-i.y*e.y-i.z*e.z;return t.x=n*i.w+a*-i.x+r*-i.z-s*-i.y,t.y=r*i.w+a*-i.y+s*-i.x-n*-i.z,t.z=s*i.w+a*-i.z+n*-i.y-r*-i.x,t},e.transformRTS=function(t,e,i,n,r){var s=e.x*r.x,a=e.y*r.y,o=e.z*r.z,h=i.w*s+i.y*o-i.z*a,u=i.w*a+i.z*s-i.x*o,l=i.w*o+i.x*a-i.y*s,c=-i.x*s-i.y*a-i.z*o;return t.x=h*i.w+c*-i.x+u*-i.z-l*-i.y+n.x,t.y=u*i.w+c*-i.y+l*-i.x-h*-i.z+n.y,t.z=l*i.w+c*-i.z+h*-i.y-u*-i.x+n.z,t},e.transformInverseRTS=function(t,e,i,n,r){var s=e.x-n.x,a=e.y-n.y,o=e.z-n.z,h=i.w*s-i.y*o+i.z*a,u=i.w*a-i.z*s+i.x*o,l=i.w*o-i.x*a+i.y*s,c=i.x*s+i.y*a+i.z*o;return t.x=(h*i.w+c*i.x+u*i.z-l*i.y)/r.x,t.y=(u*i.w+c*i.y+l*i.x-h*i.z)/r.y,t.z=(l*i.w+c*i.z+h*i.y-u*i.x)/r.z,t},e.rotateX=function(t,e,i,n){var r=e.x-i.x,s=e.y-i.y,a=e.z-i.z,o=Math.cos(n),h=Math.sin(n),u=r,l=s*o-a*h,c=s*h+a*o;return t.x=u+i.x,t.y=l+i.y,t.z=c+i.z,t},e.rotateY=function(t,e,i,n){var r=e.x-i.x,s=e.y-i.y,a=e.z-i.z,o=Math.cos(n),h=Math.sin(n),u=a*h+r*o,l=s,c=a*o-r*h;return t.x=u+i.x,t.y=l+i.y,t.z=c+i.z,t},e.rotateZ=function(t,e,i,n){var r=e.x-i.x,s=e.y-i.y,a=e.z-i.z,o=Math.cos(n),h=Math.sin(n),u=r*o-s*h,l=r*h+s*o,c=a;return t.x=u+i.x,t.y=l+i.y,t.z=c+i.z,t},e.rotateN=function(t,e,i,n,r){var s=e.x-i.x,a=e.y-i.y,o=e.z-i.z,h=n.x,u=n.y,l=n.z,c=Math.cos(r),_=Math.sin(r),d=s*(h*h*(1-c)+c)+a*(h*u*(1-c)-h*_)+o*(h*l*(1-c)+u*_),f=s*(h*u*(1-c)+l*_)+a*(u*u*(1-c)+c)+o*(u*l*(1-c)-h*_),p=s*(h*l*(1-c)-u*_)+a*(u*l*(1-c)+h*_)+o*(l*l*(1-c)+c);return t.x=d+i.x,t.y=f+i.y,t.z=p+i.z,t},e.toArray=function(t,e,i){return void 0===i&&(i=0),t[i+0]=e.x,t[i+1]=e.y,t[i+2]=e.z,t},e.fromArray=function(t,e,i){return void 0===i&&(i=0),t.x=e[i+0],t.y=e[i+1],t.z=e[i+2],t},e.strictEquals=function(t,e){return t.x===e.x&&t.y===e.y&&t.z===e.z},e.equals=function(t,e,i){void 0===i&&(i=Ci);var n=t.x,r=t.y,s=t.z,a=e.x,o=e.y,h=e.z;return Math.abs(n-a)<=i*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(r-o)<=i*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(s-h)<=i*Math.max(1,Math.abs(s),Math.abs(h))},e.angle=function(t,e){var i=t.x*t.x+t.y*t.y+t.z*t.z,n=e.x*e.x+e.y*e.y+e.z*e.z;if(0===i||0===n)return 0;var r=(t.x*e.x+t.y*e.y+t.z*e.z)/Math.sqrt(i*n);return r=Ii(r,-1,1),Math.acos(r)},e.projectOnPlane=function(t,i,n){return e.subtract(t,i,e.project(t,i,n))},e.project=function(t,i,n){var r=e.lengthSqr(n);return r<1e-6?e.set(t,0,0,0):e.multiplyScalar(t,n,e.dot(i,n)/r)},e.moveTowards=function(t,e,i,n){var r=i.x-e.x,s=i.y-e.y,a=i.z-e.z,o=r*r+s*s+a*a;if(0===o||n>=0&&o0&&(n=1/Math.sqrt(n),this.x=t*n,this.y=e*n,this.z=i*n),this},i.transformMat4=function(t){var e=this.x,i=this.y,n=this.z,r=t.m03*e+t.m07*i+t.m11*n+t.m15;return r=r?1/r:1,this.x=(t.m00*e+t.m04*i+t.m08*n+t.m12)*r,this.y=(t.m01*e+t.m05*i+t.m09*n+t.m13)*r,this.z=(t.m02*e+t.m06*i+t.m10*n+t.m14)*r,this},e}(Ae));function un(t,e,i){return new hn(t,e,i)}en=hn,hn.UNIT_X=Object.freeze(new en(1,0,0)),hn.UNIT_Y=Object.freeze(new en(0,1,0)),hn.UNIT_Z=Object.freeze(new en(0,0,1)),hn.RIGHT=Object.freeze(new en(1,0,0)),hn.UP=Object.freeze(new en(0,1,0)),hn.FORWARD=Object.freeze(new en(0,0,-1)),hn.ZERO=Object.freeze(new en(0,0,0)),hn.ONE=Object.freeze(new en(1,1,1)),hn.NEG_ONE=Object.freeze(new en(-1,-1,-1)),hn.slerp=(sn=new en,an=new en,on=new en,function(t,e,i,n){var r=1e-5,s=en.len(e),a=en.len(i);if(s.99999)return en.lerp(t,e,i,n);if(h<-.99999){var u=en.multiplyScalar(sn,e,1/s),l=en.generateOrthogonal(an,u),c=Math.PI*n;return _n(on,u,l,c),en.multiplyScalar(t,on,o),t}var _=h,d=Math.acos(_)*n,f=en.multiplyScalar(sn,e,1/s),p=en.multiplyScalar(an,i,1/a);return en.scaleAndAdd(on,p,f,-_),en.normalize(on,on),en.multiplyScalar(on,on,Math.sin(d)),en.scaleAndAdd(on,on,f,Math.cos(d)),en.multiplyScalar(t,on,o),t}),gi.fastDefine("cc.Vec3",hn,{x:0,y:0,z:0}),v.Vec3=hn;var ln,cn,_n=(ln={x:0,y:0,z:0,w:0},function(t,e,i,n){var r=.5*n,s=Math.sin(r);return ln.x=s*i.x,ln.y=s*i.y,ln.z=s*i.z,ln.w=Math.cos(r),hn.transformQuat(t,e,ln),t});v.v3=un;var dn,fn=1/255,pn=t("a_",function(t){function e(e,i,n,r){var s;return(s=t.call(this)||this)._val=0,"string"==typeof e?s.fromHEX(e):void 0!==i?s.set(e,i,n,r):s.set(e),s}s(e,t),e.clone=function(t){var i=new e;return t._val?i._val=t._val:i._val=(t.a<<24>>>0)+(t.b<<16)+(t.g<<8)+t.r,i},e.copy=function(t,e){return t.r=e.r,t.g=e.g,t.b=e.b,t.a=e.a,t},e.set=function(t,e,i,n,r){return t.r=e,t.g=i,t.b=n,t.a=r,t},e.toVec4=function(t,e){return(e=void 0!==e?e:new nn).x=t.r*fn,e.y=t.g*fn,e.z=t.b*fn,e.w=t.a*fn,e},e.fromVec4=function(t,i){return(i=void 0===i?new e:i).r=Math.floor(t.x/fn),i.g=Math.floor(t.y/fn),i.b=Math.floor(t.z/fn),i.a=Math.floor(t.w/fn),i},e.fromHEX=function(t,e){var i;return"string"==typeof e?(6===(e="#"===e[0]?e.substring(1):e).length?e+="FF":3===e.length?e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]+"FF":4===e.length&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]+e[3]+e[3]),i=Number("0x"+e)):(e<16777216&&(e=255+(e<<8)),i=e),t.r=i>>>24,t.g=(16711680&i)>>>16,t.b=(65280&i)>>>8,t.a=255&i,t._val=(t.a<<24>>>0)+(t.b<<16)+(t.g<<8)+t.r,t},e.add=function(t,e,i){return t.r=e.r+i.r,t.g=e.g+i.g,t.b=e.b+i.b,t.a=e.a+i.a,t},e.subtract=function(t,e,i){return t.r=e.r-i.r,t.g=e.g-i.g,t.b=e.b-i.b,t.a=e.a-i.a,t},e.multiply=function(t,e,i){return t.r=e.r*i.r,t.g=e.g*i.g,t.b=e.b*i.b,t.a=e.a*i.a,t},e.divide=function(t,e,i){return t.r=e.r/i.r,t.g=e.g/i.g,t.b=e.b/i.b,t.a=e.a/i.a,t},e.scale=function(t,e,i){return t.r=e.r*i,t.g=e.g*i,t.b=e.b*i,t.a=e.a*i,t},e.lerp=function(t,e,i,n){var r=e.r,s=e.g,a=e.b,o=e.a;return r+=(i.r-r)*n,s+=(i.g-s)*n,a+=(i.b-a)*n,o+=(i.a-o)*n,t._val=Math.floor((o<<24>>>0)+(a<<16)+(s<<8)+r),t},e.toArray=function(t,i,n){void 0===n&&(n=0);var r=i instanceof e||i.a>1?1/255:1;return t[n+0]=i.r*r,t[n+1]=i.g*r,t[n+2]=i.b*r,t[n+3]=i.a*r,t},e.fromArray=function(t,e,i){return void 0===i&&(i=0),e.r=255*t[i+0],e.g=255*t[i+1],e.b=255*t[i+2],e.a=255*t[i+3],e},e.fromUint32=function(t,e){return t._val=e,t},e.toUint32=function(t){return t._val},e.strictEquals=function(t,e){return t.r===e.r&&t.g===e.g&&t.b===e.b&&t.a===e.a},e.equals=function(t,e,i){return void 0===i&&(i=Ci),!(Math.abs(t.r)===1/0||Math.abs(t.g)===1/0||Math.abs(t.b)===1/0||Math.abs(t.a)===1/0)&&Math.abs(t.r-e.r)<=i*Math.max(1,Math.abs(t.r),Math.abs(e.r))&&Math.abs(t.g-e.g)<=i*Math.max(1,Math.abs(t.g),Math.abs(e.g))&&Math.abs(t.b-e.b)<=i*Math.max(1,Math.abs(t.b),Math.abs(e.b))&&Math.abs(t.a-e.a)<=i*Math.max(1,Math.abs(t.a),Math.abs(e.a))},e.hex=function(t){return(255*t.r<<24|255*t.g<<16|255*t.b<<8|255*t.a)>>>0};var i=e.prototype;return i.clone=function(){var t=new e;return t._val=this._val,t},i.equals=function(t){return t&&this._val===t._val},i.lerp=function(t,e){var i=this.r,n=this.g,r=this.b,s=this.a;return i+=(t.r-i)*e,n+=(t.g-n)*e,r+=(t.b-r)*e,s+=(t.a-s)*e,this._val=Math.floor((s<<24>>>0)+(r<<16)+(n<<8)+i),this},i.toString=function(){return"rgba("+this.r.toFixed()+", "+this.g.toFixed()+", "+this.b.toFixed()+", "+this.a.toFixed()+")"},i.toCSS=function(t){return void 0===t&&(t="rgba"),"rgba"===t?"rgba("+this.r+","+this.g+","+this.b+","+(this.a*fn).toFixed(2)+")":"rgb"===t?"rgb("+this.r+","+this.g+","+this.b+")":"#"+this.toHEX(t)},i.fromHEX=function(t){t=0===t.indexOf("#")?t.substring(1):t;var e=parseInt(t.substr(0,2),16)||0,i=parseInt(t.substr(2,2),16)||0,n=parseInt(t.substr(4,2),16)||0,r=parseInt(t.substr(6,2),16);return r=Number.isNaN(r)?255:r,this._val=(r<<24>>>0)+(n<<16)+(i<<8)+(0|e),this},i.toHEX=function(t){void 0===t&&(t="#rrggbb");var e="0",i=[(this.r<16?e:"")+this.r.toString(16),(this.g<16?e:"")+this.g.toString(16),(this.b<16?e:"")+this.b.toString(16)];return"#rgb"===t?(i[0]=i[0][0],i[1]=i[1][0],i[2]=i[2][0]):"#rrggbbaa"===t&&i.push((this.a<16?e:"")+this.a.toString(16)),i.join("")},i.toRGBValue=function(){return 16777215&this._val},i.fromHSV=function(t,e,i){var n=0,r=0,s=0;if(0===e)n=r=s=i;else if(0===i)n=r=s=0;else{1===t&&(t=0),t*=6;var a=Math.floor(t),o=t-a,h=i*(1-e),u=i*(1-e*o),l=i*(1-e*(1-o));switch(a){default:case 0:n=i,r=l,s=h;break;case 1:n=u,r=i,s=h;break;case 2:n=h,r=i,s=l;break;case 3:n=h,r=u,s=i;break;case 4:n=l,r=h,s=i;break;case 5:n=i,r=h,s=u}}return n*=255,r*=255,s*=255,this._val=(this.a<<24>>>0)+(s<<16)+(r<<8)+(0|n),this},i.toHSV=function(){var t=this.r*fn,e=this.g*fn,i=this.b*fn,n={h:0,s:0,v:0},r=Math.max(t,e,i),s=Math.min(t,e,i),a=0;return n.v=r,n.s=r?(r-s)/r:0,n.s?(a=r-s,n.h=t===r?(e-i)/a:e===r?2+(i-t)/a:4+(t-e)/a,n.h/=6,n.h<0&&(n.h+=1)):n.h=0,n},i.set=function(t,e,i,n){return"object"==typeof t?null!=t._val?this._val=t._val:(e=t.g||0,i=t.b||0,n="number"==typeof t.a?t.a:255,t=t.r||0,this._val=(n<<24>>>0)+(i<<16)+(e<<8)+(0|t)):(t=t||0,e=e||0,i=i||0,n="number"==typeof n?n:255,this._val=(n<<24>>>0)+(i<<16)+(e<<8)+(0|t)),this},i.multiply=function(t){var e=(255&this._val)*t.r>>8,i=(65280&this._val)*t.g>>8,n=(16711680&this._val)*t.b>>8,r=((4278190080&this._val)>>>8)*t.a;return this._val=4278190080&r|16711680&n|65280&i|255&e,this},i._set_r_unsafe=function(t){return this._val=(4294967040&this._val|t)>>>0,this},i._set_g_unsafe=function(t){return this._val=(4294902015&this._val|t<<8)>>>0,this},i._set_b_unsafe=function(t){return this._val=(4278255615&this._val|t<<16)>>>0,this},i._set_a_unsafe=function(t){return this._val=(16777215&this._val|t<<24)>>>0,this},n(e,[{key:"r",get:function(){return 255&this._val},set:function(t){t=~~Ii(t,0,255),this._val=(4294967040&this._val|t)>>>0}},{key:"g",get:function(){return(65280&this._val)>>8},set:function(t){t=~~Ii(t,0,255),this._val=(4294902015&this._val|t<<8)>>>0}},{key:"b",get:function(){return(16711680&this._val)>>16},set:function(t){t=~~Ii(t,0,255),this._val=(4278255615&this._val|t<<16)>>>0}},{key:"a",get:function(){return(4278190080&this._val)>>>24},set:function(t){t=~~Ii(t,0,255),this._val=(16777215&this._val|t<<24)>>>0}},{key:"x",get:function(){return this.r*fn},set:function(t){this.r=255*t}},{key:"y",get:function(){return this.g*fn},set:function(t){this.g=255*t}},{key:"z",get:function(){return this.b*fn},set:function(t){this.b=255*t}},{key:"w",get:function(){return this.a*fn},set:function(t){this.a=255*t}}]),e}(Ae));function mn(t,e,i,n){return new pn(t,e,i,n)}function gn(t){var e=t.clone();return e.x=Math.floor(t.x),e.y=Math.floor(t.y),e.z=Math.floor(t.z),e}cn=pn,pn.WHITE=Object.freeze(new cn(255,255,255,255)),pn.GRAY=Object.freeze(new cn(127,127,127,255)),pn.BLACK=Object.freeze(new cn(0,0,0,255)),pn.TRANSPARENT=Object.freeze(new cn(0,0,0,0)),pn.RED=Object.freeze(new cn(255,0,0,255)),pn.GREEN=Object.freeze(new cn(0,255,0,255)),pn.BLUE=Object.freeze(new cn(0,0,255,255)),pn.CYAN=Object.freeze(new cn(0,255,255,255)),pn.MAGENTA=Object.freeze(new cn(255,0,255,255)),pn.YELLOW=Object.freeze(new cn(255,255,0,255)),gi.fastDefine("cc.Color",pn,{r:0,g:0,b:0,a:255}),v.Color=pn,v.color=mn;var vn=t("aS",function(t){function e(e,i,n,r,s,a,o,h,u){var l;return void 0===e&&(e=1),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=1),void 0===a&&(a=0),void 0===o&&(o=0),void 0===h&&(h=0),void 0===u&&(u=1),l=t.call(this)||this,"object"==typeof e?(l.m00=e.m00,l.m01=e.m01,l.m02=e.m02,l.m03=e.m03,l.m04=e.m04,l.m05=e.m05,l.m06=e.m06,l.m07=e.m07,l.m08=e.m08):(l.m00=e,l.m01=i,l.m02=n,l.m03=r,l.m04=s,l.m05=a,l.m06=o,l.m07=h,l.m08=u),l}s(e,t),e.clone=function(t){return new e(t.m00,t.m01,t.m02,t.m03,t.m04,t.m05,t.m06,t.m07,t.m08)},e.copy=function(t,e){return t.m00=e.m00,t.m01=e.m01,t.m02=e.m02,t.m03=e.m03,t.m04=e.m04,t.m05=e.m05,t.m06=e.m06,t.m07=e.m07,t.m08=e.m08,t},e.set=function(t,e,i,n,r,s,a,o,h,u){return t.m00=e,t.m01=i,t.m02=n,t.m03=r,t.m04=s,t.m05=a,t.m06=o,t.m07=h,t.m08=u,t},e.identity=function(t){return t.m00=1,t.m01=0,t.m02=0,t.m03=0,t.m04=1,t.m05=0,t.m06=0,t.m07=0,t.m08=1,t},e.transpose=function(t,e){if(t===e){var i=e.m01,n=e.m02,r=e.m05;t.m01=e.m03,t.m02=e.m06,t.m03=i,t.m05=e.m07,t.m06=n,t.m07=r}else t.m00=e.m00,t.m01=e.m03,t.m02=e.m06,t.m03=e.m01,t.m04=e.m04,t.m05=e.m07,t.m06=e.m02,t.m07=e.m05,t.m08=e.m08;return t},e.invert=function(t,e){var i=e.m00,n=e.m01,r=e.m02,s=e.m03,a=e.m04,o=e.m05,h=e.m06,u=e.m07,l=e.m08,c=l*a-o*u,_=-l*s+o*h,d=u*s-a*h,f=i*c+n*_+r*d;return 0===f?(t.m00=0,t.m01=0,t.m02=0,t.m03=0,t.m04=0,t.m05=0,t.m06=0,t.m07=0,t.m08=0,t):(f=1/f,t.m00=c*f,t.m01=(-l*n+r*u)*f,t.m02=(o*n-r*a)*f,t.m03=_*f,t.m04=(l*i-r*h)*f,t.m05=(-o*i+r*s)*f,t.m06=d*f,t.m07=(-u*i+n*h)*f,t.m08=(a*i-n*s)*f,t)},e.determinant=function(t){var e=t.m00,i=t.m01,n=t.m02,r=t.m03,s=t.m04,a=t.m05,o=t.m06,h=t.m07,u=t.m08;return e*(u*s-a*h)+i*(-u*r+a*o)+n*(h*r-s*o)},e.multiply=function(t,e,i){var n=e.m00,r=e.m01,s=e.m02,a=e.m03,o=e.m04,h=e.m05,u=e.m06,l=e.m07,c=e.m08,_=i.m00,d=i.m01,f=i.m02,p=i.m03,m=i.m04,g=i.m05,v=i.m06,y=i.m07,T=i.m08;return t.m00=_*n+d*a+f*u,t.m01=_*r+d*o+f*l,t.m02=_*s+d*h+f*c,t.m03=p*n+m*a+g*u,t.m04=p*r+m*o+g*l,t.m05=p*s+m*h+g*c,t.m06=v*n+y*a+T*u,t.m07=v*r+y*o+T*l,t.m08=v*s+y*h+T*c,t},e.multiplyMat4=function(t,e,i){var n=e.m00,r=e.m01,s=e.m02,a=e.m03,o=e.m04,h=e.m05,u=e.m06,l=e.m07,c=e.m08,_=i.m00,d=i.m01,f=i.m02,p=i.m04,m=i.m05,g=i.m06,v=i.m08,y=i.m09,T=i.m10;return t.m00=_*n+d*a+f*u,t.m01=_*r+d*o+f*l,t.m02=_*s+d*h+f*c,t.m03=p*n+m*a+g*u,t.m04=p*r+m*o+g*l,t.m05=p*s+m*h+g*c,t.m06=v*n+y*a+T*u,t.m07=v*r+y*o+T*l,t.m08=v*s+y*h+T*c,t},e.transform=function(t,e,i){this.translate(t,e,i)},e.translate=function(t,e,i){var n=e.m00,r=e.m01,s=e.m02,a=e.m03,o=e.m04,h=e.m05,u=e.m06,l=e.m07,c=e.m08,_=i.x,d=i.y;return t.m00=n,t.m01=r,t.m02=s,t.m03=a,t.m04=o,t.m05=h,t.m06=_*n+d*a+u,t.m07=_*r+d*o+l,t.m08=_*s+d*h+c,t},e.scale=function(t,e,i){var n=i.x,r=i.y;return t.m00=n*e.m00,t.m01=n*e.m01,t.m02=n*e.m02,t.m03=r*e.m03,t.m04=r*e.m04,t.m05=r*e.m05,t.m06=e.m06,t.m07=e.m07,t.m08=e.m08,t},e.rotate=function(t,e,i){var n=e.m00,r=e.m01,s=e.m02,a=e.m03,o=e.m04,h=e.m05,u=e.m06,l=e.m07,c=e.m08,_=Math.sin(i),d=Math.cos(i);return t.m00=d*n+_*a,t.m01=d*r+_*o,t.m02=d*s+_*h,t.m03=d*a-_*n,t.m04=d*o-_*r,t.m05=d*h-_*s,t.m06=u,t.m07=l,t.m08=c,t},e.fromMat4=function(t,e){return t.m00=e.m00,t.m01=e.m01,t.m02=e.m02,t.m03=e.m04,t.m04=e.m05,t.m05=e.m06,t.m06=e.m08,t.m07=e.m09,t.m08=e.m10,t},e.fromViewUp=function(t,i,n){return hn.lengthSqr(i)-.999?(e.x=Math.asin(-o),e.y=Math.atan2(a,h),e.z=Math.atan2(n,s),!0):(e.x=Ri,e.y=Math.atan2(r,i),e.z=0,!1):(e.x=-Ri,e.y=Math.atan2(-r,i),e.z=0,!1)};var i=e.prototype;return i.clone=function(){var t=this;return new e(t.m00,t.m01,t.m02,t.m03,t.m04,t.m05,t.m06,t.m07,t.m08)},i.set=function(t,e,i,n,r,s,a,o,h){return void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=1),void 0===s&&(s=0),void 0===a&&(a=0),void 0===o&&(o=0),void 0===h&&(h=1),"object"==typeof t?(this.m00=t.m00,this.m01=t.m01,this.m02=t.m02,this.m03=t.m03,this.m04=t.m04,this.m05=t.m05,this.m06=t.m06,this.m07=t.m07,this.m08=t.m08):(this.m00=t,this.m01=e,this.m02=i,this.m03=n,this.m04=r,this.m05=s,this.m06=a,this.m07=o,this.m08=h),this},i.equals=function(t,e){return void 0===e&&(e=Ci),Math.abs(this.m00-t.m00)<=e*Math.max(1,Math.abs(this.m00),Math.abs(t.m00))&&Math.abs(this.m01-t.m01)<=e*Math.max(1,Math.abs(this.m01),Math.abs(t.m01))&&Math.abs(this.m02-t.m02)<=e*Math.max(1,Math.abs(this.m02),Math.abs(t.m02))&&Math.abs(this.m03-t.m03)<=e*Math.max(1,Math.abs(this.m03),Math.abs(t.m03))&&Math.abs(this.m04-t.m04)<=e*Math.max(1,Math.abs(this.m04),Math.abs(t.m04))&&Math.abs(this.m05-t.m05)<=e*Math.max(1,Math.abs(this.m05),Math.abs(t.m05))&&Math.abs(this.m06-t.m06)<=e*Math.max(1,Math.abs(this.m06),Math.abs(t.m06))&&Math.abs(this.m07-t.m07)<=e*Math.max(1,Math.abs(this.m07),Math.abs(t.m07))&&Math.abs(this.m08-t.m08)<=e*Math.max(1,Math.abs(this.m08),Math.abs(t.m08))},i.strictEquals=function(t){return this.m00===t.m00&&this.m01===t.m01&&this.m02===t.m02&&this.m03===t.m03&&this.m04===t.m04&&this.m05===t.m05&&this.m06===t.m06&&this.m07===t.m07&&this.m08===t.m08},i.toString=function(){var t=this;return"[\n"+t.m00+", "+t.m01+", "+t.m02+",\n"+t.m03+",\n"+t.m04+", "+t.m05+",\n"+t.m06+", "+t.m07+",\n"+t.m08+"\n]"},i.identity=function(){return this.m00=1,this.m01=0,this.m02=0,this.m03=0,this.m04=1,this.m05=0,this.m06=0,this.m07=0,this.m08=1,this},i.transpose=function(){var t=this.m01,e=this.m02,i=this.m05;return this.m01=this.m03,this.m02=this.m06,this.m03=t,this.m05=this.m07,this.m06=e,this.m07=i,this},i.invert=function(){var t=this.m00,e=this.m01,i=this.m02,n=this.m03,r=this.m04,s=this.m05,a=this.m06,o=this.m07,h=this.m08,u=h*r-s*o,l=-h*n+s*a,c=o*n-r*a,_=t*u+e*l+i*c;return 0===_?(this.set(0,0,0,0,0,0,0,0,0),this):(_=1/_,this.m00=u*_,this.m01=(-h*e+i*o)*_,this.m02=(s*e-i*r)*_,this.m03=l*_,this.m04=(h*t-i*a)*_,this.m05=(-s*t+i*n)*_,this.m06=c*_,this.m07=(-o*t+e*a)*_,this.m08=(r*t-e*n)*_,this)},i.determinant=function(){var t=this.m00,e=this.m01,i=this.m02,n=this.m03,r=this.m04,s=this.m05,a=this.m06,o=this.m07,h=this.m08;return t*(h*r-s*o)+e*(-h*n+s*a)+i*(o*n-r*a)},i.add=function(t){return this.m00+=t.m00,this.m01+=t.m01,this.m02+=t.m02,this.m03+=t.m03,this.m04+=t.m04,this.m05+=t.m05,this.m06+=t.m06,this.m07+=t.m07,this.m08+=t.m08,this},i.subtract=function(t){return this.m00-=t.m00,this.m01-=t.m01,this.m02-=t.m02,this.m03-=t.m03,this.m04-=t.m04,this.m05-=t.m05,this.m06-=t.m06,this.m07-=t.m07,this.m08-=t.m08,this},i.multiply=function(t){var e=this.m00,i=this.m01,n=this.m02,r=this.m03,s=this.m04,a=this.m05,o=this.m06,h=this.m07,u=this.m08,l=t.m00,c=t.m01,_=t.m02,d=t.m03,f=t.m04,p=t.m05,m=t.m06,g=t.m07,v=t.m08;return this.m00=l*e+c*r+_*o,this.m01=l*i+c*s+_*h,this.m02=l*n+c*a+_*u,this.m03=d*e+f*r+p*o,this.m04=d*i+f*s+p*h,this.m05=d*n+f*a+p*u,this.m06=m*e+g*r+v*o,this.m07=m*i+g*s+v*h,this.m08=m*n+g*a+v*u,this},i.multiplyScalar=function(t){return this.m00*=t,this.m01*=t,this.m02*=t,this.m03*=t,this.m04*=t,this.m05*=t,this.m06*=t,this.m07*=t,this.m08*=t,this},i.scale=function(t){var e=t.x,i=t.y;return this.m00=e*this.m00,this.m01=e*this.m01,this.m02=e*this.m02,this.m03=i*this.m03,this.m04=i*this.m04,this.m05=i*this.m05,this.m06=this.m06,this.m07=this.m07,this.m08=this.m08,this},i.rotate=function(t){var e=this.m00,i=this.m01,n=this.m02,r=this.m03,s=this.m04,a=this.m05,o=this.m06,h=this.m07,u=this.m08,l=Math.sin(t),c=Math.cos(t);return this.m00=c*e+l*r,this.m01=c*i+l*s,this.m02=c*n+l*a,this.m03=c*r-l*e,this.m04=c*s-l*i,this.m05=c*a-l*n,this.m06=o,this.m07=h,this.m08=u,this},i.fromQuat=function(t){var e=t.x,i=t.y,n=t.z,r=t.w,s=e+e,a=i+i,o=n+n,h=e*s,u=i*s,l=i*a,c=n*s,_=n*a,d=n*o,f=r*s,p=r*a,m=r*o;return this.m00=1-l-d,this.m03=u-m,this.m06=c+p,this.m01=u+m,this.m04=1-h-d,this.m07=_-f,this.m02=c-p,this.m05=_+f,this.m08=1-h-l,this},e}(Ae));dn=vn,vn.IDENTITY=Object.freeze(new dn);var yn,Tn=new hn,Sn=new hn;gi.fastDefine("cc.Mat3",vn,{m00:1,m01:0,m02:0,m03:0,m04:1,m05:0,m06:0,m07:0,m08:1}),v.Mat3=vn;var En=t("aQ",function(t){function e(e,i,n,r){var s;return s=t.call(this)||this,"object"==typeof e?(s.x=e.x,s.y=e.y,s.z=e.z,s.w=e.w):(s.x=e||0,s.y=i||0,s.z=n||0,s.w=null!=r?r:1),s}s(e,t),e.clone=function(t){return new e(t.x,t.y,t.z,t.w)},e.copy=function(t,e){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t},e.set=function(t,e,i,n,r){return t.x=e,t.y=i,t.z=n,t.w=r,t},e.identity=function(t){return t.x=0,t.y=0,t.z=0,t.w=1,t},e.rotationTo=function(t,i,n){var r=hn.dot(i,n);return r<-.999999?(hn.cross(Cn,hn.UNIT_X,i),Cn.length()<1e-6&&hn.cross(Cn,hn.UNIT_Y,i),hn.normalize(Cn,Cn),e.fromAxisAngle(t,Cn,Math.PI),t):r>.999999?(t.x=0,t.y=0,t.z=0,t.w=1,t):(hn.cross(Cn,i,n),t.x=Cn.x,t.y=Cn.y,t.z=Cn.z,t.w=1+r,e.normalize(t,t))},e.getAxisAngle=function(t,e){var i=2*Math.acos(e.w),n=Math.sin(i/2);return 0!==n?(t.x=e.x/n,t.y=e.y/n,t.z=e.z/n):(t.x=1,t.y=0,t.z=0),i},e.multiply=function(t,e,i){var n=e.x*i.w+e.w*i.x+e.y*i.z-e.z*i.y,r=e.y*i.w+e.w*i.y+e.z*i.x-e.x*i.z,s=e.z*i.w+e.w*i.z+e.x*i.y-e.y*i.x,a=e.w*i.w-e.x*i.x-e.y*i.y-e.z*i.z;return t.x=n,t.y=r,t.z=s,t.w=a,t},e.multiplyScalar=function(t,e,i){return t.x=e.x*i,t.y=e.y*i,t.z=e.z*i,t.w=e.w*i,t},e.scaleAndAdd=function(t,e,i,n){return t.x=e.x+i.x*n,t.y=e.y+i.y*n,t.z=e.z+i.z*n,t.w=e.w+i.w*n,t},e.rotateX=function(t,e,i){i*=.5;var n=Math.sin(i),r=Math.cos(i),s=e.x,a=e.y,o=e.z,h=e.w;return t.x=s*r+h*n,t.y=a*r+o*n,t.z=o*r-a*n,t.w=h*r-s*n,t},e.rotateY=function(t,e,i){i*=.5;var n=Math.sin(i),r=Math.cos(i),s=e.x,a=e.y,o=e.z,h=e.w;return t.x=s*r-o*n,t.y=a*r+h*n,t.z=o*r+s*n,t.w=h*r-a*n,t},e.rotateZ=function(t,e,i){i*=.5;var n=Math.sin(i),r=Math.cos(i),s=e.x,a=e.y,o=e.z,h=e.w;return t.x=s*r+a*n,t.y=a*r-s*n,t.z=o*r+h*n,t.w=h*r-o*n,t},e.rotateAround=function(t,i,n,r){return e.invert(Rn,i),hn.transformQuat(Cn,n,Rn),e.fromAxisAngle(Rn,Cn,r),e.multiply(t,i,Rn),t},e.rotateAroundLocal=function(t,i,n,r){return e.fromAxisAngle(Rn,n,r),e.multiply(t,i,Rn),t},e.calculateW=function(t,e){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=Math.sqrt(Math.abs(1-e.x*e.x-e.y*e.y-e.z*e.z)),t},e.dot=function(t,e){return t.x*e.x+t.y*e.y+t.z*e.z+t.w*e.w},e.lerp=function(t,e,i,n){return t.x=e.x+n*(i.x-e.x),t.y=e.y+n*(i.y-e.y),t.z=e.z+n*(i.z-e.z),t.w=e.w+n*(i.w-e.w),t},e.slerp=function(t,e,i,n){var r=0,s=0,a=i.x,o=i.y,h=i.z,u=i.w,l=e.x*i.x+e.y*i.y+e.z*i.z+e.w*i.w;if(l<0&&(l=-l,a=-a,o=-o,h=-h,u=-u),1-l>1e-6){var c=Math.acos(l),_=Math.sin(c);r=Math.sin((1-n)*c)/_,s=Math.sin(n*c)/_}else r=1-n,s=n;return t.x=r*e.x+s*a,t.y=r*e.y+s*o,t.z=r*e.z+s*h,t.w=r*e.w+s*u,t},e.sqlerp=function(t,i,n,r,s,a){return e.slerp(Rn,i,s,a),e.slerp(bn,n,r,a),e.slerp(t,Rn,bn,2*a*(1-a)),t},e.invert=function(t,e){var i=e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w,n=i?1/i:0;return t.x=-e.x*n,t.y=-e.y*n,t.z=-e.z*n,t.w=e.w*n,t},e.conjugate=function(t,e){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=e.w,t},e.len=function(t){return Math.sqrt(t.x*t.x+t.y*t.y+t.z*t.z+t.w*t.w)},e.lengthSqr=function(t){return t.x*t.x+t.y*t.y+t.z*t.z+t.w*t.w},e.normalize=function(t,e){var i=e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w;return i>0?(i=1/Math.sqrt(i),t.x=e.x*i,t.y=e.y*i,t.z=e.z*i,t.w=e.w*i):(t.x=0,t.y=0,t.z=0,t.w=0),t},e.fromAxes=function(t,i,n,r){return vn.set(wn,i.x,i.y,i.z,n.x,n.y,n.z,r.x,r.y,r.z),e.normalize(t,e.fromMat3(t,wn))},e.fromViewUp=function(t,i,n){return vn.fromViewUp(wn,i,n),e.normalize(t,e.fromMat3(t,wn))},e.fromAxisAngle=function(t,e,i){i*=.5;var n=Math.sin(i);return t.x=n*e.x,t.y=n*e.y,t.z=n*e.z,t.w=Math.cos(i),t},e.fromMat3=function(t,e){var i=e.m00,n=e.m01,r=e.m02,s=e.m03,a=e.m04,o=e.m05,h=e.m06,u=e.m07,l=e.m08,c=i-a-l,_=a-i-l,d=l-i-a,f=0,p=i+a+l;c>p&&(p=c,f=1),_>p&&(p=_,f=2),d>p&&(p=d,f=3);var m=.5*Math.sqrt(p+1),g=.25/m;switch(f){case 0:t.w=m,t.x=(o-u)*g,t.y=(h-r)*g,t.z=(n-s)*g;break;case 1:t.w=(o-u)*g,t.x=m,t.y=(n+s)*g,t.z=(h+r)*g;break;case 2:t.w=(h-r)*g,t.x=(n+s)*g,t.y=m,t.z=(o+u)*g;break;case 3:t.w=(n-s)*g,t.x=(h+r)*g,t.y=(o+u)*g,t.z=m;break;default:t.w=1,t.x=0,t.y=0,t.z=0}return t},e.fromEuler=function(t,e,i,n){e*=xn,i*=xn,n*=xn;var r=Math.sin(e),s=Math.cos(e),a=Math.sin(i),o=Math.cos(i),h=Math.sin(n),u=Math.cos(n);return t.x=r*o*u+s*a*h,t.y=s*a*u+r*o*h,t.z=s*o*h-r*a*u,t.w=s*o*u-r*a*h,t},e.fromAngleZ=function(t,e){return e*=xn,t.x=t.y=0,t.z=Math.sin(e),t.w=Math.cos(e),t},e.toAxisX=function(t,e){var i=2*e.y,n=2*e.z;return t.x=1-i*e.y-n*e.z,t.y=i*e.x+n*e.w,t.z=n*e.x-i*e.w,t},e.toAxisY=function(t,e){var i=2*e.x,n=2*e.y,r=2*e.z;return t.x=n*e.x-r*e.w,t.y=1-i*e.x-r*e.z,t.z=r*e.y+i*e.w,t},e.toAxisZ=function(t,e){var i=2*e.x,n=2*e.y,r=2*e.z;return t.x=r*e.x+n*e.w,t.y=r*e.y-i*e.w,t.z=1-i*e.x-n*e.y,t},e.toEuler=function(t,e,i){var n=e.x,r=e.y,s=e.z,a=e.w,o=0,h=0,u=0,l=n*r+s*a;if(l>.499999)o=0,h=Pi(2*Math.atan2(n,a)),u=90;else if(l<-.499999)o=0,h=-Pi(2*Math.atan2(n,a)),u=-90;else{var c=n*n,_=r*r,d=s*s;o=Pi(Math.atan2(2*n*a-2*r*s,1-2*c-2*d)),h=Pi(Math.atan2(2*r*a-2*n*s,1-2*_-2*d)),u=Pi(Math.asin(2*l)),i&&(o=-180*Math.sign(o+1e-6)+o,h=-180*Math.sign(h+1e-6)+h,u=180*Math.sign(u+1e-6)-u)}return t.x=o,t.y=h,t.z=u,t},e.toEulerInYXZOrder=function(t,e){vn.fromQuat(wn,e),vn.toEuler(wn,t),t.x=Pi(t.x),t.y=Pi(t.y),t.z=Pi(t.z)},e.toArray=function(t,e,i){return void 0===i&&(i=0),t[i+0]=e.x,t[i+1]=e.y,t[i+2]=e.z,t[i+3]=e.w,t},e.fromArray=function(t,e,i){return void 0===i&&(i=0),t.x=e[i+0],t.y=e[i+1],t.z=e[i+2],t.w=e[i+3],t},e.strictEquals=function(t,e){return t.x===e.x&&t.y===e.y&&t.z===e.z&&t.w===e.w},e.equals=function(t,e,i){return void 0===i&&(i=Ci),Math.abs(t.x-e.x)<=i*Math.max(1,Math.abs(t.x),Math.abs(e.x))&&Math.abs(t.y-e.y)<=i*Math.max(1,Math.abs(t.y),Math.abs(e.y))&&Math.abs(t.z-e.z)<=i*Math.max(1,Math.abs(t.z),Math.abs(e.z))&&Math.abs(t.w-e.w)<=i*Math.max(1,Math.abs(t.w),Math.abs(e.w))},e.angle=function(t,i){var n=Math.min(Math.abs(e.dot(t,i)),1);return 2*Math.acos(n)},e.rotateTowards=function(t,i,n,r){var s=e.angle(i,n);if(0===s)return t.x=n.x,t.y=n.y,t.z=n.z,t.w=n.w,t;var a=Math.min(r/Pi(s),1);return e.slerp(t,i,n,a)};var i=e.prototype;return i.clone=function(){return new e(this.x,this.y,this.z,this.w)},i.set=function(t,e,i,n){return"object"==typeof t?(this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w):(this.x=t||0,this.y=e||0,this.z=i||0,this.w=null!=n?n:1),this},i.equals=function(t,e){return void 0===e&&(e=Ci),Math.abs(this.x-t.x)<=e*Math.max(1,Math.abs(this.x),Math.abs(t.x))&&Math.abs(this.y-t.y)<=e*Math.max(1,Math.abs(this.y),Math.abs(t.y))&&Math.abs(this.z-t.z)<=e*Math.max(1,Math.abs(this.z),Math.abs(t.z))&&Math.abs(this.w-t.w)<=e*Math.max(1,Math.abs(this.w),Math.abs(t.w))},i.strictEquals=function(t){return t&&this.x===t.x&&this.y===t.y&&this.z===t.z&&this.w===t.w},i.getEulerAngles=function(t){return e.toEuler(t,this)},i.lerp=function(t,e){return this.x+=e*(t.x-this.x),this.y+=e*(t.y-this.y),this.z+=e*(t.z-this.z),this.w+=e*(t.w-this.w),this},i.slerp=function(t,i){return e.slerp(this,this,t,i)},i.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},i.lengthSqr=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},e}(Ae));yn=En,En.IDENTITY=Object.freeze(new yn);var An,Rn=new En,bn=new En,Cn=new hn,wn=new vn,xn=.5*Math.PI/180;function In(t,e,i,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1),new En(t,e,i,n)}gi.fastDefine("cc.Quat",En,{x:0,y:0,z:0,w:1}),v.Quat=En,v.quat=In;var On=t("b0",Object.freeze([Object.freeze([1,0,0,1]),Object.freeze([0,1,-1,0]),Object.freeze([-1,0,0,-1]),Object.freeze([0,-1,1,0])])),Dn=t("aT",function(t){function e(e,i,n,r,s,a,o,h,u,l,c,_,d,f,p,m){var g;return void 0===e&&(e=1),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=1),void 0===o&&(o=0),void 0===h&&(h=0),void 0===u&&(u=0),void 0===l&&(l=0),void 0===c&&(c=1),void 0===_&&(_=0),void 0===d&&(d=0),void 0===f&&(f=0),void 0===p&&(p=0),void 0===m&&(m=1),g=t.call(this)||this,"object"==typeof e?(g.m00=e.m00,g.m01=e.m01,g.m02=e.m02,g.m03=e.m03,g.m04=e.m04,g.m05=e.m05,g.m06=e.m06,g.m07=e.m07,g.m08=e.m08,g.m09=e.m09,g.m10=e.m10,g.m11=e.m11,g.m12=e.m12,g.m13=e.m13,g.m14=e.m14,g.m15=e.m15):(g.m00=e,g.m01=i,g.m02=n,g.m03=r,g.m04=s,g.m05=a,g.m06=o,g.m07=h,g.m08=u,g.m09=l,g.m10=c,g.m11=_,g.m12=d,g.m13=f,g.m14=p,g.m15=m),g}s(e,t),e.clone=function(t){return new e(t.m00,t.m01,t.m02,t.m03,t.m04,t.m05,t.m06,t.m07,t.m08,t.m09,t.m10,t.m11,t.m12,t.m13,t.m14,t.m15)},e.copy=function(t,e){return t.m00=e.m00,t.m01=e.m01,t.m02=e.m02,t.m03=e.m03,t.m04=e.m04,t.m05=e.m05,t.m06=e.m06,t.m07=e.m07,t.m08=e.m08,t.m09=e.m09,t.m10=e.m10,t.m11=e.m11,t.m12=e.m12,t.m13=e.m13,t.m14=e.m14,t.m15=e.m15,t},e.set=function(t,e,i,n,r,s,a,o,h,u,l,c,_,d,f,p,m){return t.m00=e,t.m01=i,t.m02=n,t.m03=r,t.m04=s,t.m05=a,t.m06=o,t.m07=h,t.m08=u,t.m09=l,t.m10=c,t.m11=_,t.m12=d,t.m13=f,t.m14=p,t.m15=m,t},e.identity=function(t){return t.m00=1,t.m01=0,t.m02=0,t.m03=0,t.m04=0,t.m05=1,t.m06=0,t.m07=0,t.m08=0,t.m09=0,t.m10=1,t.m11=0,t.m12=0,t.m13=0,t.m14=0,t.m15=1,t},e.transpose=function(t,e){if(t===e){var i=e.m01,n=e.m02,r=e.m03,s=e.m06,a=e.m07,o=e.m11;t.m01=e.m04,t.m02=e.m08,t.m03=e.m12,t.m04=i,t.m06=e.m09,t.m07=e.m13,t.m08=n,t.m09=s,t.m11=e.m14,t.m12=r,t.m13=a,t.m14=o}else t.m00=e.m00,t.m01=e.m04,t.m02=e.m08,t.m03=e.m12,t.m04=e.m01,t.m05=e.m05,t.m06=e.m09,t.m07=e.m13,t.m08=e.m02,t.m09=e.m06,t.m10=e.m10,t.m11=e.m14,t.m12=e.m03,t.m13=e.m07,t.m14=e.m11,t.m15=e.m15;return t},e.invert=function(t,e){var i=e.m00,n=e.m01,r=e.m02,s=e.m03,a=e.m04,o=e.m05,h=e.m06,u=e.m07,l=e.m08,c=e.m09,_=e.m10,d=e.m11,f=e.m12,p=e.m13,m=e.m14,g=e.m15,v=i*o-n*a,y=i*h-r*a,T=i*u-s*a,S=n*h-r*o,E=n*u-s*o,A=r*u-s*h,R=l*p-c*f,b=l*m-_*f,C=l*g-d*f,w=c*m-_*p,x=c*g-d*p,I=_*g-d*m,O=v*I-y*x+T*w+S*C-E*b+A*R;return 0===O?(t.m00=0,t.m01=0,t.m02=0,t.m03=0,t.m04=0,t.m05=0,t.m06=0,t.m07=0,t.m08=0,t.m09=0,t.m10=0,t.m11=0,t.m12=0,t.m13=0,t.m14=0,t.m15=0,t):(O=1/O,t.m00=(o*I-h*x+u*w)*O,t.m01=(r*x-n*I-s*w)*O,t.m02=(p*A-m*E+g*S)*O,t.m03=(_*E-c*A-d*S)*O,t.m04=(h*C-a*I-u*b)*O,t.m05=(i*I-r*C+s*b)*O,t.m06=(m*T-f*A-g*y)*O,t.m07=(l*A-_*T+d*y)*O,t.m08=(a*x-o*C+u*R)*O,t.m09=(n*C-i*x-s*R)*O,t.m10=(f*E-p*T+g*v)*O,t.m11=(c*T-l*E-d*v)*O,t.m12=(o*b-a*w-h*R)*O,t.m13=(i*w-n*b+r*R)*O,t.m14=(p*y-f*S-m*v)*O,t.m15=(l*S-c*y+_*v)*O,t)},e.determinant=function(t){var e=t.m00,i=t.m01,n=t.m02,r=t.m03,s=t.m04,a=t.m05,o=t.m06,h=t.m07,u=t.m08,l=t.m09,c=t.m10,_=t.m11,d=t.m12,f=t.m13,p=t.m14,m=t.m15;return(e*a-i*s)*(c*m-_*p)-(e*o-n*s)*(l*m-_*f)+(e*h-r*s)*(l*p-c*f)+(i*o-n*a)*(u*m-_*d)-(i*h-r*a)*(u*p-c*d)+(n*h-r*o)*(u*f-l*d)},e.multiply=function(t,e,i){var n=e.m00,r=e.m01,s=e.m02,a=e.m03,o=e.m04,h=e.m05,u=e.m06,l=e.m07,c=e.m08,_=e.m09,d=e.m10,f=e.m11,p=e.m12,m=e.m13,g=e.m14,v=e.m15,y=i.m00,T=i.m01,S=i.m02,E=i.m03;return t.m00=y*n+T*o+S*c+E*p,t.m01=y*r+T*h+S*_+E*m,t.m02=y*s+T*u+S*d+E*g,t.m03=y*a+T*l+S*f+E*v,y=i.m04,T=i.m05,S=i.m06,E=i.m07,t.m04=y*n+T*o+S*c+E*p,t.m05=y*r+T*h+S*_+E*m,t.m06=y*s+T*u+S*d+E*g,t.m07=y*a+T*l+S*f+E*v,y=i.m08,T=i.m09,S=i.m10,E=i.m11,t.m08=y*n+T*o+S*c+E*p,t.m09=y*r+T*h+S*_+E*m,t.m10=y*s+T*u+S*d+E*g,t.m11=y*a+T*l+S*f+E*v,y=i.m12,T=i.m13,S=i.m14,E=i.m15,t.m12=y*n+T*o+S*c+E*p,t.m13=y*r+T*h+S*_+E*m,t.m14=y*s+T*u+S*d+E*g,t.m15=y*a+T*l+S*f+E*v,t},e.transform=function(t,e,i){var n=i.x,r=i.y,s=i.z;if(e===t)t.m12=e.m00*n+e.m04*r+e.m08*s+e.m12,t.m13=e.m01*n+e.m05*r+e.m09*s+e.m13,t.m14=e.m02*n+e.m06*r+e.m10*s+e.m14,t.m15=e.m03*n+e.m07*r+e.m11*s+e.m15;else{var a=e.m00,o=e.m01,h=e.m02,u=e.m03,l=e.m04,c=e.m05,_=e.m06,d=e.m07,f=e.m08,p=e.m09,m=e.m10,g=e.m11;t.m00=a,t.m01=o,t.m02=h,t.m03=u,t.m04=l,t.m05=c,t.m06=_,t.m07=d,t.m08=f,t.m09=p,t.m10=m,t.m11=g,t.m12=a*n+l*r+f*s+e.m12,t.m13=o*n+c*r+p*s+e.m13,t.m14=h*n+_*r+m*s+e.m14,t.m15=u*n+d*r+g*s+e.m15}return t},e.translate=function(t,e,i){return e===t?(t.m12+=i.x,t.m13+=i.y,t.m14+=i.z):(t.m00=e.m00,t.m01=e.m01,t.m02=e.m02,t.m03=e.m03,t.m04=e.m04,t.m05=e.m05,t.m06=e.m06,t.m07=e.m07,t.m08=e.m08,t.m09=e.m09,t.m10=e.m10,t.m11=e.m11,t.m12=e.m12+i.x,t.m13=e.m13+i.y,t.m14=e.m14+i.z,t.m15=e.m15),t},e.scale=function(t,e,i){var n=i.x,r=i.y,s=i.z;return t.m00=e.m00*n,t.m01=e.m01*n,t.m02=e.m02*n,t.m03=e.m03*n,t.m04=e.m04*r,t.m05=e.m05*r,t.m06=e.m06*r,t.m07=e.m07*r,t.m08=e.m08*s,t.m09=e.m09*s,t.m10=e.m10*s,t.m11=e.m11*s,t.m12=e.m12,t.m13=e.m13,t.m14=e.m14,t.m15=e.m15,t},e.rotate=function(t,e,i,n){var r=n.x,s=n.y,a=n.z,o=Math.sqrt(r*r+s*s+a*a);if(Math.abs(o)0?(n=2*Math.sqrt(i+1),t.w=.25*n,t.x=(e.m06-e.m09)/n,t.y=(e.m08-e.m02)/n,t.z=(e.m01-e.m04)/n):e.m00>e.m05&&e.m00>e.m10?(n=2*Math.sqrt(1+e.m00-e.m05-e.m10),t.w=(e.m06-e.m09)/n,t.x=.25*n,t.y=(e.m01+e.m04)/n,t.z=(e.m08+e.m02)/n):e.m05>e.m10?(n=2*Math.sqrt(1+e.m05-e.m00-e.m10),t.w=(e.m08-e.m02)/n,t.x=(e.m01+e.m04)/n,t.y=.25*n,t.z=(e.m06+e.m09)/n):(n=2*Math.sqrt(1+e.m10-e.m00-e.m05),t.w=(e.m01-e.m04)/n,t.x=(e.m08+e.m02)/n,t.y=(e.m06+e.m09)/n,t.z=.25*n),t},e.toRTS=function(t,e,i,n){var r=hn.set(Pn,t.m00,t.m01,t.m02).length(),s=hn.set(Pn,t.m04,t.m05,t.m06).length(),a=hn.set(Pn,t.m08,t.m09,t.m10).length();Bn.m00=t.m00/r,Bn.m01=t.m01/r,Bn.m02=t.m02/r,Bn.m03=t.m04/s,Bn.m04=t.m05/s,Bn.m05=t.m06/s,Bn.m06=t.m08/a,Bn.m07=t.m09/a,Bn.m08=t.m10/a;var o=vn.determinant(Bn);n&&(hn.set(n,r,s,a),o<0&&(n.x*=-1)),i&&hn.set(i,t.m12,t.m13,t.m14),e&&(o<0&&(Bn.m00*=-1,Bn.m01*=-1,Bn.m02*=-1),En.fromMat3(e,Bn))},e.toSRT=function(t,e,i,n){var r=hn.set(Pn,t.m00,t.m01,t.m02).length(),s=hn.set(Pn,t.m04,t.m05,t.m06).length(),a=hn.set(Pn,t.m08,t.m09,t.m10).length();n&&(n.x=r,n.y=s,n.z=a),i&&hn.set(i,t.m12,t.m13,t.m14),e&&(Bn.m00=t.m00/r,Bn.m01=t.m01/r,Bn.m02=t.m02/r,Bn.m03=t.m04/s,Bn.m04=t.m05/s,Bn.m05=t.m06/s,Bn.m06=t.m08/a,Bn.m07=t.m09/a,Bn.m08=t.m10/a,vn.determinant(Bn)<0&&(n&&(n.x*=-1),Bn.m00*=-1,Bn.m01*=-1,Bn.m02*=-1),En.fromMat3(e,Bn))},e.toEuler=function(t,e){return vn.set(Bn,t.m00,t.m01,t.m02,t.m04,t.m05,t.m06,t.m08,t.m09,t.m10),vn.toEuler(Bn,e)},e.fromRTS=function(t,e,i,n){var r=e.x,s=e.y,a=e.z,o=e.w,h=r+r,u=s+s,l=a+a,c=r*h,_=r*u,d=r*l,f=s*u,p=s*l,m=a*l,g=o*h,v=o*u,y=o*l,T=n.x,S=n.y,E=n.z;return t.m00=(1-(f+m))*T,t.m01=(_+y)*T,t.m02=(d-v)*T,t.m03=0,t.m04=(_-y)*S,t.m05=(1-(c+m))*S,t.m06=(p+g)*S,t.m07=0,t.m08=(d+v)*E,t.m09=(p-g)*E,t.m10=(1-(c+f))*E,t.m11=0,t.m12=i.x,t.m13=i.y,t.m14=i.z,t.m15=1,t},e.fromSRT=function(t,e,i,n){var r=e.x,s=e.y,a=e.z,o=e.w,h=r+r,u=s+s,l=a+a,c=r*h,_=r*u,d=r*l,f=s*u,p=s*l,m=a*l,g=o*h,v=o*u,y=o*l,T=n.x,S=n.y,E=n.z;return t.m00=(1-(f+m))*T,t.m01=(_+y)*T,t.m02=(d-v)*T,t.m03=0,t.m04=(_-y)*S,t.m05=(1-(c+m))*S,t.m06=(p+g)*S,t.m07=0,t.m08=(d+v)*E,t.m09=(p-g)*E,t.m10=(1-(c+f))*E,t.m11=0,t.m12=i.x,t.m13=i.y,t.m14=i.z,t.m15=1,t},e.fromRTSOrigin=function(t,e,i,n,r){var s=e.x,a=e.y,o=e.z,h=e.w,u=s+s,l=a+a,c=o+o,_=s*u,d=s*l,f=s*c,p=a*l,m=a*c,g=o*c,v=h*u,y=h*l,T=h*c,S=n.x,E=n.y,A=n.z,R=r.x,b=r.y,C=r.z;return t.m00=(1-(p+g))*S,t.m01=(d+T)*S,t.m02=(f-y)*S,t.m03=0,t.m04=(d-T)*E,t.m05=(1-(_+g))*E,t.m06=(m+v)*E,t.m07=0,t.m08=(f+y)*A,t.m09=(m-v)*A,t.m10=(1-(_+p))*A,t.m11=0,t.m12=i.x+R-(t.m00*R+t.m04*b+t.m08*C),t.m13=i.y+b-(t.m01*R+t.m05*b+t.m09*C),t.m14=i.z+C-(t.m02*R+t.m06*b+t.m10*C),t.m15=1,t},e.fromSRTOrigin=function(t,e,i,n,r){var s=e.x,a=e.y,o=e.z,h=e.w,u=s+s,l=a+a,c=o+o,_=s*u,d=s*l,f=s*c,p=a*l,m=a*c,g=o*c,v=h*u,y=h*l,T=h*c,S=n.x,E=n.y,A=n.z,R=r.x,b=r.y,C=r.z;return t.m00=(1-(p+g))*S,t.m01=(d+T)*S,t.m02=(f-y)*S,t.m03=0,t.m04=(d-T)*E,t.m05=(1-(_+g))*E,t.m06=(m+v)*E,t.m07=0,t.m08=(f+y)*A,t.m09=(m-v)*A,t.m10=(1-(_+p))*A,t.m11=0,t.m12=i.x+R-(t.m00*R+t.m04*b+t.m08*C),t.m13=i.y+b-(t.m01*R+t.m05*b+t.m09*C),t.m14=i.z+C-(t.m02*R+t.m06*b+t.m10*C),t.m15=1,t},e.fromQuat=function(t,e){var i=e.x,n=e.y,r=e.z,s=e.w,a=i+i,o=n+n,h=r+r,u=i*a,l=n*a,c=n*o,_=r*a,d=r*o,f=r*h,p=s*a,m=s*o,g=s*h;return t.m00=1-c-f,t.m01=l+g,t.m02=_-m,t.m03=0,t.m04=l-g,t.m05=1-u-f,t.m06=d+p,t.m07=0,t.m08=_+m,t.m09=d-p,t.m10=1-u-c,t.m11=0,t.m12=0,t.m13=0,t.m14=0,t.m15=1,t},e.frustum=function(t,e,i,n,r,s,a){var o=1/(i-e),h=1/(r-n),u=1/(s-a);return t.m00=2*s*o,t.m01=0,t.m02=0,t.m03=0,t.m04=0,t.m05=2*s*h,t.m06=0,t.m07=0,t.m08=(i+e)*o,t.m09=(r+n)*h,t.m10=(a+s)*u,t.m11=-1,t.m12=0,t.m13=0,t.m14=a*s*2*u,t.m15=0,t},e.perspective=function(t,e,i,n,r,s,a,o,h){void 0===s&&(s=!0),void 0===a&&(a=-1),void 0===o&&(o=1),void 0===h&&(h=0);var u=1/Math.tan(e/2),l=1/(n-r),c=s?u/i:u,_=(s?u:u*i)*o,d=On[h];return t.m00=c*d[0],t.m01=c*d[1],t.m02=0,t.m03=0,t.m04=_*d[2],t.m05=_*d[3],t.m06=0,t.m07=0,t.m08=0,t.m09=0,t.m10=(r-a*n)*l,t.m11=-1,t.m12=0,t.m13=0,t.m14=r*n*l*(1-a),t.m15=0,t},e.ortho=function(t,e,i,n,r,s,a,o,h,u){void 0===o&&(o=-1),void 0===h&&(h=1),void 0===u&&(u=0);var l=1/(e-i),c=1/(n-r)*h,_=1/(s-a),d=-2*l,f=-2*c,p=(e+i)*l,m=(r+n)*c,g=On[u];return t.m00=d*g[0],t.m01=d*g[1],t.m02=0,t.m03=0,t.m04=f*g[2],t.m05=f*g[3],t.m06=0,t.m07=0,t.m08=0,t.m09=0,t.m10=_*(1-o),t.m11=0,t.m12=p*g[0]+m*g[2],t.m13=p*g[1]+m*g[3],t.m14=(s-o*a)*_,t.m15=1,t},e.lookAt=function(t,e,i,n){var r=e.x,s=e.y,a=e.z,o=n.x,h=n.y,u=n.z,l=r-i.x,c=s-i.y,_=a-i.z,d=1/Math.sqrt(l*l+c*c+_*_),f=h*(_*=d)-u*(c*=d),p=u*(l*=d)-o*_,m=o*c-h*l,g=c*(m*=d=1/Math.sqrt(f*f+p*p+m*m))-_*(p*=d),v=_*(f*=d)-l*m,y=l*p-c*f;return t.m00=f,t.m01=g,t.m02=l,t.m03=0,t.m04=p,t.m05=v,t.m06=c,t.m07=0,t.m08=m,t.m09=y,t.m10=_,t.m11=0,t.m12=-(f*r+p*s+m*a),t.m13=-(g*r+v*s+y*a),t.m14=-(l*r+c*s+_*a),t.m15=1,t},e.inverseTranspose=function(t,e){var i=e.m00,n=e.m01,r=e.m02,s=e.m03,a=e.m04,o=e.m05,h=e.m06,u=e.m07,l=e.m08,c=e.m09,_=e.m10,d=e.m11,f=e.m12,p=e.m13,m=e.m14,g=e.m15,v=i*o-n*a,y=i*h-r*a,T=i*u-s*a,S=n*h-r*o,E=n*u-s*o,A=r*u-s*h,R=l*p-c*f,b=l*m-_*f,C=l*g-d*f,w=c*m-_*p,x=c*g-d*p,I=_*g-d*m,O=v*I-y*x+T*w+S*C-E*b+A*R;return O?(O=1/O,t.m00=(o*I-h*x+u*w)*O,t.m01=(h*C-a*I-u*b)*O,t.m02=(a*x-o*C+u*R)*O,t.m03=0,t.m04=(r*x-n*I-s*w)*O,t.m05=(i*I-r*C+s*b)*O,t.m06=(n*C-i*x-s*R)*O,t.m07=0,t.m08=(p*A-m*E+g*S)*O,t.m09=(m*T-f*A-g*y)*O,t.m10=(f*E-p*T+g*v)*O,t.m11=0,t.m12=0,t.m13=0,t.m14=0,t.m15=1,t):null},e.toArray=function(t,e,i){return void 0===i&&(i=0),t[i+0]=e.m00,t[i+1]=e.m01,t[i+2]=e.m02,t[i+3]=e.m03,t[i+4]=e.m04,t[i+5]=e.m05,t[i+6]=e.m06,t[i+7]=e.m07,t[i+8]=e.m08,t[i+9]=e.m09,t[i+10]=e.m10,t[i+11]=e.m11,t[i+12]=e.m12,t[i+13]=e.m13,t[i+14]=e.m14,t[i+15]=e.m15,t},e.fromArray=function(t,e,i){return void 0===i&&(i=0),t.m00=e[i+0],t.m01=e[i+1],t.m02=e[i+2],t.m03=e[i+3],t.m04=e[i+4],t.m05=e[i+5],t.m06=e[i+6],t.m07=e[i+7],t.m08=e[i+8],t.m09=e[i+9],t.m10=e[i+10],t.m11=e[i+11],t.m12=e[i+12],t.m13=e[i+13],t.m14=e[i+14],t.m15=e[i+15],t},e.add=function(t,e,i){return t.m00=e.m00+i.m00,t.m01=e.m01+i.m01,t.m02=e.m02+i.m02,t.m03=e.m03+i.m03,t.m04=e.m04+i.m04,t.m05=e.m05+i.m05,t.m06=e.m06+i.m06,t.m07=e.m07+i.m07,t.m08=e.m08+i.m08,t.m09=e.m09+i.m09,t.m10=e.m10+i.m10,t.m11=e.m11+i.m11,t.m12=e.m12+i.m12,t.m13=e.m13+i.m13,t.m14=e.m14+i.m14,t.m15=e.m15+i.m15,t},e.subtract=function(t,e,i){return t.m00=e.m00-i.m00,t.m01=e.m01-i.m01,t.m02=e.m02-i.m02,t.m03=e.m03-i.m03,t.m04=e.m04-i.m04,t.m05=e.m05-i.m05,t.m06=e.m06-i.m06,t.m07=e.m07-i.m07,t.m08=e.m08-i.m08,t.m09=e.m09-i.m09,t.m10=e.m10-i.m10,t.m11=e.m11-i.m11,t.m12=e.m12-i.m12,t.m13=e.m13-i.m13,t.m14=e.m14-i.m14,t.m15=e.m15-i.m15,t},e.multiplyScalar=function(t,e,i){return t.m00=e.m00*i,t.m01=e.m01*i,t.m02=e.m02*i,t.m03=e.m03*i,t.m04=e.m04*i,t.m05=e.m05*i,t.m06=e.m06*i,t.m07=e.m07*i,t.m08=e.m08*i,t.m09=e.m09*i,t.m10=e.m10*i,t.m11=e.m11*i,t.m12=e.m12*i,t.m13=e.m13*i,t.m14=e.m14*i,t.m15=e.m15*i,t},e.multiplyScalarAndAdd=function(t,e,i,n){return t.m00=e.m00+i.m00*n,t.m01=e.m01+i.m01*n,t.m02=e.m02+i.m02*n,t.m03=e.m03+i.m03*n,t.m04=e.m04+i.m04*n,t.m05=e.m05+i.m05*n,t.m06=e.m06+i.m06*n,t.m07=e.m07+i.m07*n,t.m08=e.m08+i.m08*n,t.m09=e.m09+i.m09*n,t.m10=e.m10+i.m10*n,t.m11=e.m11+i.m11*n,t.m12=e.m12+i.m12*n,t.m13=e.m13+i.m13*n,t.m14=e.m14+i.m14*n,t.m15=e.m15+i.m15*n,t},e.strictEquals=function(t,e){return t.m00===e.m00&&t.m01===e.m01&&t.m02===e.m02&&t.m03===e.m03&&t.m04===e.m04&&t.m05===e.m05&&t.m06===e.m06&&t.m07===e.m07&&t.m08===e.m08&&t.m09===e.m09&&t.m10===e.m10&&t.m11===e.m11&&t.m12===e.m12&&t.m13===e.m13&&t.m14===e.m14&&t.m15===e.m15},e.equals=function(t,e,i){return void 0===i&&(i=Ci),Math.abs(t.m00-e.m00)<=i*Math.max(1,Math.abs(t.m00),Math.abs(e.m00))&&Math.abs(t.m01-e.m01)<=i*Math.max(1,Math.abs(t.m01),Math.abs(e.m01))&&Math.abs(t.m02-e.m02)<=i*Math.max(1,Math.abs(t.m02),Math.abs(e.m02))&&Math.abs(t.m03-e.m03)<=i*Math.max(1,Math.abs(t.m03),Math.abs(e.m03))&&Math.abs(t.m04-e.m04)<=i*Math.max(1,Math.abs(t.m04),Math.abs(e.m04))&&Math.abs(t.m05-e.m05)<=i*Math.max(1,Math.abs(t.m05),Math.abs(e.m05))&&Math.abs(t.m06-e.m06)<=i*Math.max(1,Math.abs(t.m06),Math.abs(e.m06))&&Math.abs(t.m07-e.m07)<=i*Math.max(1,Math.abs(t.m07),Math.abs(e.m07))&&Math.abs(t.m08-e.m08)<=i*Math.max(1,Math.abs(t.m08),Math.abs(e.m08))&&Math.abs(t.m09-e.m09)<=i*Math.max(1,Math.abs(t.m09),Math.abs(e.m09))&&Math.abs(t.m10-e.m10)<=i*Math.max(1,Math.abs(t.m10),Math.abs(e.m10))&&Math.abs(t.m11-e.m11)<=i*Math.max(1,Math.abs(t.m11),Math.abs(e.m11))&&Math.abs(t.m12-e.m12)<=i*Math.max(1,Math.abs(t.m12),Math.abs(e.m12))&&Math.abs(t.m13-e.m13)<=i*Math.max(1,Math.abs(t.m13),Math.abs(e.m13))&&Math.abs(t.m14-e.m14)<=i*Math.max(1,Math.abs(t.m14),Math.abs(e.m14))&&Math.abs(t.m15-e.m15)<=i*Math.max(1,Math.abs(t.m15),Math.abs(e.m15))};var i=e.prototype;return i.clone=function(){return new e(this.m00,this.m01,this.m02,this.m03,this.m04,this.m05,this.m06,this.m07,this.m08,this.m09,this.m10,this.m11,this.m12,this.m13,this.m14,this.m15)},i.set=function(t,e,i,n,r,s,a,o,h,u,l,c,_,d,f,p){return void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=1),void 0===a&&(a=0),void 0===o&&(o=0),void 0===h&&(h=0),void 0===u&&(u=0),void 0===l&&(l=1),void 0===c&&(c=0),void 0===_&&(_=0),void 0===d&&(d=0),void 0===f&&(f=0),void 0===p&&(p=1),"object"==typeof t?(this.m01=t.m01,this.m02=t.m02,this.m03=t.m03,this.m04=t.m04,this.m05=t.m05,this.m06=t.m06,this.m07=t.m07,this.m08=t.m08,this.m09=t.m09,this.m10=t.m10,this.m11=t.m11,this.m12=t.m12,this.m13=t.m13,this.m14=t.m14,this.m15=t.m15,this.m00=t.m00):(this.m01=e,this.m02=i,this.m03=n,this.m04=r,this.m05=s,this.m06=a,this.m07=o,this.m08=h,this.m09=u,this.m10=l,this.m11=c,this.m12=_,this.m13=d,this.m14=f,this.m15=p,this.m00=t),this},i.equals=function(t,e){return void 0===e&&(e=Ci),!(Math.abs(this.m00)===1/0||Math.abs(this.m01)===1/0||Math.abs(this.m02)===1/0||Math.abs(this.m03)===1/0||Math.abs(this.m04)===1/0||Math.abs(this.m05)===1/0||Math.abs(this.m06)===1/0||Math.abs(this.m07)===1/0||Math.abs(this.m08)===1/0||Math.abs(this.m09)===1/0||Math.abs(this.m10)===1/0||Math.abs(this.m11)===1/0||Math.abs(this.m12)===1/0||Math.abs(this.m13)===1/0||Math.abs(this.m14)===1/0||Math.abs(this.m15)===1/0)&&Math.abs(this.m00-t.m00)<=e*Math.max(1,Math.abs(this.m00),Math.abs(t.m00))&&Math.abs(this.m01-t.m01)<=e*Math.max(1,Math.abs(this.m01),Math.abs(t.m01))&&Math.abs(this.m02-t.m02)<=e*Math.max(1,Math.abs(this.m02),Math.abs(t.m02))&&Math.abs(this.m03-t.m03)<=e*Math.max(1,Math.abs(this.m03),Math.abs(t.m03))&&Math.abs(this.m04-t.m04)<=e*Math.max(1,Math.abs(this.m04),Math.abs(t.m04))&&Math.abs(this.m05-t.m05)<=e*Math.max(1,Math.abs(this.m05),Math.abs(t.m05))&&Math.abs(this.m06-t.m06)<=e*Math.max(1,Math.abs(this.m06),Math.abs(t.m06))&&Math.abs(this.m07-t.m07)<=e*Math.max(1,Math.abs(this.m07),Math.abs(t.m07))&&Math.abs(this.m08-t.m08)<=e*Math.max(1,Math.abs(this.m08),Math.abs(t.m08))&&Math.abs(this.m09-t.m09)<=e*Math.max(1,Math.abs(this.m09),Math.abs(t.m09))&&Math.abs(this.m10-t.m10)<=e*Math.max(1,Math.abs(this.m10),Math.abs(t.m10))&&Math.abs(this.m11-t.m11)<=e*Math.max(1,Math.abs(this.m11),Math.abs(t.m11))&&Math.abs(this.m12-t.m12)<=e*Math.max(1,Math.abs(this.m12),Math.abs(t.m12))&&Math.abs(this.m13-t.m13)<=e*Math.max(1,Math.abs(this.m13),Math.abs(t.m13))&&Math.abs(this.m14-t.m14)<=e*Math.max(1,Math.abs(this.m14),Math.abs(t.m14))&&Math.abs(this.m15-t.m15)<=e*Math.max(1,Math.abs(this.m15),Math.abs(t.m15))},i.strictEquals=function(t){return this.m00===t.m00&&this.m01===t.m01&&this.m02===t.m02&&this.m03===t.m03&&this.m04===t.m04&&this.m05===t.m05&&this.m06===t.m06&&this.m07===t.m07&&this.m08===t.m08&&this.m09===t.m09&&this.m10===t.m10&&this.m11===t.m11&&this.m12===t.m12&&this.m13===t.m13&&this.m14===t.m14&&this.m15===t.m15},i.toString=function(){return"[\n"+this.m00+", "+this.m01+", "+this.m02+", "+this.m03+",\n"+this.m04+", "+this.m05+", "+this.m06+", "+this.m07+",\n"+this.m08+", "+this.m09+", "+this.m10+", "+this.m11+",\n"+this.m12+", "+this.m13+", "+this.m14+", "+this.m15+"\n]"},i.identity=function(){return this.m00=1,this.m01=0,this.m02=0,this.m03=0,this.m04=0,this.m05=1,this.m06=0,this.m07=0,this.m08=0,this.m09=0,this.m10=1,this.m11=0,this.m12=0,this.m13=0,this.m14=0,this.m15=1,this},i.zero=function(){return this.m00=0,this.m01=0,this.m02=0,this.m03=0,this.m04=0,this.m05=0,this.m06=0,this.m07=0,this.m08=0,this.m09=0,this.m10=0,this.m11=0,this.m12=0,this.m13=0,this.m14=0,this.m15=0,this},i.transpose=function(){var t=this.m01,e=this.m02,i=this.m03,n=this.m06,r=this.m07,s=this.m11;return this.m01=this.m04,this.m02=this.m08,this.m03=this.m12,this.m04=t,this.m06=this.m09,this.m07=this.m13,this.m08=e,this.m09=n,this.m11=this.m14,this.m12=i,this.m13=r,this.m14=s,this},i.invert=function(){var t=this.m00,e=this.m01,i=this.m02,n=this.m03,r=this.m04,s=this.m05,a=this.m06,o=this.m07,h=this.m08,u=this.m09,l=this.m10,c=this.m11,_=this.m12,d=this.m13,f=this.m14,p=this.m15,m=t*s-e*r,g=t*a-i*r,v=t*o-n*r,y=e*a-i*s,T=e*o-n*s,S=i*o-n*a,E=h*d-u*_,A=h*f-l*_,R=h*p-c*_,b=u*f-l*d,C=u*p-c*d,w=l*p-c*f,x=m*w-g*C+v*b+y*R-T*A+S*E;return 0===x?(this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),this):(x=1/x,this.m00=(s*w-a*C+o*b)*x,this.m01=(i*C-e*w-n*b)*x,this.m02=(d*S-f*T+p*y)*x,this.m03=(l*T-u*S-c*y)*x,this.m04=(a*R-r*w-o*A)*x,this.m05=(t*w-i*R+n*A)*x,this.m06=(f*v-_*S-p*g)*x,this.m07=(h*S-l*v+c*g)*x,this.m08=(r*C-s*R+o*E)*x,this.m09=(e*R-t*C-n*E)*x,this.m10=(_*T-d*v+p*m)*x,this.m11=(u*v-h*T-c*m)*x,this.m12=(s*A-r*b-a*E)*x,this.m13=(t*b-e*A+i*E)*x,this.m14=(d*g-_*y-f*m)*x,this.m15=(h*y-u*g+l*m)*x,this)},i.determinant=function(){var t=this.m00,e=this.m01,i=this.m02,n=this.m03,r=this.m04,s=this.m05,a=this.m06,o=this.m07,h=this.m08,u=this.m09,l=this.m10,c=this.m11,_=this.m12,d=this.m13,f=this.m14,p=this.m15;return(t*s-e*r)*(l*p-c*f)-(t*a-i*r)*(u*p-c*d)+(t*o-n*r)*(u*f-l*d)+(e*a-i*s)*(h*p-c*_)-(e*o-n*s)*(h*f-l*_)+(i*o-n*a)*(h*d-u*_)},i.add=function(t){return this.m00+=t.m00,this.m01+=t.m01,this.m02+=t.m02,this.m03+=t.m03,this.m04+=t.m04,this.m05+=t.m05,this.m06+=t.m06,this.m07+=t.m07,this.m08+=t.m08,this.m09+=t.m09,this.m10+=t.m10,this.m11+=t.m11,this.m12+=t.m12,this.m13+=t.m13,this.m14+=t.m14,this.m15+=t.m15,this},i.subtract=function(t){return this.m00-=t.m00,this.m01-=t.m01,this.m02-=t.m02,this.m03-=t.m03,this.m04-=t.m04,this.m05-=t.m05,this.m06-=t.m06,this.m07-=t.m07,this.m08-=t.m08,this.m09-=t.m09,this.m10-=t.m10,this.m11-=t.m11,this.m12-=t.m12,this.m13-=t.m13,this.m14-=t.m14,this.m15-=t.m15,this},i.multiply=function(t){var e=this.m00,i=this.m01,n=this.m02,r=this.m03,s=this.m04,a=this.m05,o=this.m06,h=this.m07,u=this.m08,l=this.m09,c=this.m10,_=this.m11,d=this.m12,f=this.m13,p=this.m14,m=this.m15,g=t.m00,v=t.m01,y=t.m02,T=t.m03;return this.m00=g*e+v*s+y*u+T*d,this.m01=g*i+v*a+y*l+T*f,this.m02=g*n+v*o+y*c+T*p,this.m03=g*r+v*h+y*_+T*m,g=t.m04,v=t.m05,y=t.m06,T=t.m07,this.m04=g*e+v*s+y*u+T*d,this.m05=g*i+v*a+y*l+T*f,this.m06=g*n+v*o+y*c+T*p,this.m07=g*r+v*h+y*_+T*m,g=t.m08,v=t.m09,y=t.m10,T=t.m11,this.m08=g*e+v*s+y*u+T*d,this.m09=g*i+v*a+y*l+T*f,this.m10=g*n+v*o+y*c+T*p,this.m11=g*r+v*h+y*_+T*m,g=t.m12,v=t.m13,y=t.m14,T=t.m15,this.m12=g*e+v*s+y*u+T*d,this.m13=g*i+v*a+y*l+T*f,this.m14=g*n+v*o+y*c+T*p,this.m15=g*r+v*h+y*_+T*m,this},i.multiplyScalar=function(t){return this.m00*=t,this.m01*=t,this.m02*=t,this.m03*=t,this.m04*=t,this.m05*=t,this.m06*=t,this.m07*=t,this.m08*=t,this.m09*=t,this.m10*=t,this.m11*=t,this.m12*=t,this.m13*=t,this.m14*=t,this.m15*=t,this},i.translate=function(t){return this.m12+=t.x,this.m13+=t.y,this.m14+=t.z,this},i.transform=function(t){var e=t.x,i=t.y,n=t.z,r=this.m00,s=this.m01,a=this.m02,o=this.m03,h=this.m04,u=this.m05,l=this.m06,c=this.m07,_=this.m08,d=this.m09,f=this.m10,p=this.m11;return this.m12=r*e+h*i+_*n+this.m12,this.m13=s*e+u*i+d*n+this.m13,this.m14=a*e+l*i+f*n+this.m14,this.m15=o*e+c*i+p*n+this.m15,this},i.scale=function(t){var e=t.x,i=t.y,n=t.z;return this.m00*=e,this.m01*=e,this.m02*=e,this.m03*=e,this.m04*=i,this.m05*=i,this.m06*=i,this.m07*=i,this.m08*=n,this.m09*=n,this.m10*=n,this.m11*=n,this},i.rotate=function(t,e){var i=e.x,n=e.y,r=e.z,s=Math.sqrt(i*i+n*n+r*r);if(Math.abs(s)0?(r=1/Math.sqrt(r),t.x=i*r,t.y=n*r):(t.x=0,t.y=0),t},e.dot=function(t,e){return t.x*e.x+t.y*e.y},e.cross=function(t,e,i){return t instanceof hn?(t.x=t.y=0,t.z=e.x*i.y-e.y*i.x,t):t.x*e.y-t.y*e.x},e.lerp=function(t,e,i,n){var r=e.x,s=e.y;return t.x=r+n*(i.x-r),t.y=s+n*(i.y-s),t},e.random=function(t,e){e=e||1;var i=2*Bi()*Math.PI;return t.x=Math.cos(i)*e,t.y=Math.sin(i)*e,t},e.transformMat3=function(t,e,i){var n=e.x,r=e.y;return t.x=i.m00*n+i.m03*r+i.m06,t.y=i.m01*n+i.m04*r+i.m07,t},e.transformMat4=function(t,e,i){var n=e.x,r=e.y;return t.x=i.m00*n+i.m04*r+i.m12,t.y=i.m01*n+i.m05*r+i.m13,t},e.str=function(t){return"Vec2("+t.x+", "+t.y+")"},e.toArray=function(t,e,i){return void 0===i&&(i=0),t[i+0]=e.x,t[i+1]=e.y,t},e.fromArray=function(t,e,i){return void 0===i&&(i=0),t.x=e[i+0],t.y=e[i+1],t},e.strictEquals=function(t,e){return t.x===e.x&&t.y===e.y},e.equals=function(t,e,i){return void 0===i&&(i=Ci),Math.abs(t.x-e.x)<=i*Math.max(1,Math.abs(t.x),Math.abs(e.x))&&Math.abs(t.y-e.y)<=i*Math.max(1,Math.abs(t.y),Math.abs(e.y))},e.angle=function(t,e){var i=t.x*t.x+t.y*t.y,n=e.x*e.x+e.y*e.y;if(0===i||0===n)return 0;var r=(t.x*e.x+t.y*e.y)/Math.sqrt(i*n);return r=Ii(r,-1,1),Math.acos(r)};var i=e.prototype;return i.clone=function(){return new e(this.x,this.y)},i.set=function(t,e){return"object"==typeof t?(this.x=t.x,this.y=t.y):(this.x=t||0,this.y=e||0),this},i.equals=function(t,e){return void 0===e&&(e=Ci),Math.abs(this.x-t.x)<=e*Math.max(1,Math.abs(this.x),Math.abs(t.x))&&Math.abs(this.y-t.y)<=e*Math.max(1,Math.abs(this.y),Math.abs(t.y))},i.equals2f=function(t,e,i){return void 0===i&&(i=Ci),Math.abs(this.x-t)<=i*Math.max(1,Math.abs(this.x),Math.abs(t))&&Math.abs(this.y-e)<=i*Math.max(1,Math.abs(this.y),Math.abs(e))},i.strictEquals=function(t){return t&&this.x===t.x&&this.y===t.y},i.strictEquals2f=function(t,e){return this.x===t&&this.y===e},i.toString=function(){return"("+this.x.toFixed(2)+", "+this.y.toFixed(2)+")"},i.lerp=function(t,e){var i=this.x,n=this.y;return this.x=i+e*(t.x-i),this.y=n+e*(t.y-n),this},i.clampf=function(t,e){return this.x=Ii(this.x,t.x,e.x),this.y=Ii(this.y,t.y,e.y),this},i.add=function(t){return this.x+=t.x,this.y+=t.y,this},i.add2f=function(t,e){return this.x+=t,this.y+=e,this},i.subtract=function(t){return this.x-=t.x,this.y-=t.y,this},i.subtract2f=function(t,e){return this.x-=t,this.y-=e,this},i.multiplyScalar=function(t){return"object"==typeof t&&console.warn("should use Vec2.multiply for vector * vector operation"),this.x*=t,this.y*=t,this},i.multiply=function(t){return"object"!=typeof t&&console.warn("should use Vec2.scale for vector * scalar operation"),this.x*=t.x,this.y*=t.y,this},i.multiply2f=function(t,e){return this.x*=t,this.y*=e,this},i.divide=function(t){return this.x/=t.x,this.y/=t.y,this},i.divide2f=function(t,e){return this.x/=t,this.y/=e,this},i.negative=function(){return this.x=-this.x,this.y=-this.y,this},i.dot=function(t){return this.x*t.x+this.y*t.y},i.cross=function(t){return this.x*t.y-this.y*t.x},i.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},i.lengthSqr=function(){return this.x*this.x+this.y*this.y},i.normalize=function(){var t=this.x,e=this.y,i=t*t+e*e;return i>0&&(i=1/Math.sqrt(i),this.x*=i,this.y*=i),this},i.angle=function(t){var e=this.lengthSqr(),i=t.lengthSqr();if(0===e||0===i)return 0;var n=this.dot(t)/Math.sqrt(e*i);return n=Ii(n,-1,1),Math.acos(n)},i.signAngle=function(t){var e=this.cross(t),i=this.dot(t);return Math.atan2(e,i)},i.rotate=function(t){var e=this.x,i=this.y,n=Math.sin(t),r=Math.cos(t);return this.x=r*e-n*i,this.y=n*e+r*i,this},i.project=function(t){var e=this.dot(t)/t.dot(t);return this.x=t.x*e,this.y=t.y*e,this},i.transformMat4=function(t){var e=this.x,i=this.y;return this.x=t.m00*e+t.m04*i+t.m12,this.y=t.m01*e+t.m05*i+t.m13,this},e}(Ae));function kn(t,e){return new Fn(t,e)}Mn=Fn,Fn.ZERO=Object.freeze(new Mn(0,0)),Fn.ONE=Object.freeze(new Mn(1,1)),Fn.NEG_ONE=Object.freeze(new Mn(-1,-1)),Fn.UNIT_X=Object.freeze(new Mn(1,0)),Fn.UNIT_Y=Object.freeze(new Mn(0,1)),gi.fastDefine("cc.Vec2",Fn,{x:0,y:0}),v.Vec2=Fn,v.v2=kn,rt(Fn,"Vec2",[{name:"sub",newName:"subtract",target:Fn,targetName:"Vec2"},{name:"mul",newName:"multiply",target:Fn,targetName:"Vec2"},{name:"div",newName:"divide",target:Fn,targetName:"Vec2"},{name:"dist",newName:"distance",target:Fn,targetName:"Vec2"},{name:"sqrDist",newName:"squaredDistance",target:Fn,targetName:"Vec2"},{name:"mag",newName:"len",target:Fn,targetName:"Vec2"},{name:"sqrMag",newName:"lengthSqr",target:Fn,targetName:"Vec2"},{name:"scale",newName:"multiplyScalar",target:Fn,targetName:"Vec2"},{name:"exactEquals",newName:"strictEquals",target:Fn,targetName:"Vec2"}]),rt(Fn.prototype,"Vec2",[{name:"mag",newName:"length",target:Fn.prototype,targetName:"Vec2"},{name:"magSqr",newName:"lengthSqr",target:Fn.prototype,targetName:"Vec2"},{name:"scale",newName:"multiplyScalar",target:Fn.prototype,targetName:"Vec2"},{name:"exactEquals",newName:"strictEquals",target:Fn.prototype,targetName:"Vec2"}]),rt(hn,"Vec3",[{name:"sub",newName:"subtract",target:hn,targetName:"Vec3"},{name:"mul",newName:"multiply",target:hn,targetName:"Vec3"},{name:"div",newName:"divide",target:hn,targetName:"Vec3"},{name:"dist",newName:"distance",target:hn,targetName:"Vec3"},{name:"sqrDist",newName:"squaredDistance",target:hn,targetName:"Vec3"},{name:"mag",newName:"len",target:hn,targetName:"Vec3"},{name:"sqrMag",newName:"lengthSqr",target:hn,targetName:"Vec3"},{name:"scale",newName:"multiplyScalar",target:hn,targetName:"Vec3"},{name:"exactEquals",newName:"strictEquals",target:hn,targetName:"Vec3"}]),rt(hn.prototype,"Vec3",[{name:"mag",newName:"length",target:hn.prototype,targetName:"Vec3"},{name:"magSqr",newName:"lengthSqr",target:hn.prototype,targetName:"Vec3"},{name:"scale",newName:"multiplyScalar",target:hn.prototype,targetName:"Vec3"},{name:"exactEquals",newName:"strictEquals",target:hn.prototype,targetName:"Vec3"}]),rt(nn,"Vec4",[{name:"sub",newName:"subtract",target:nn,targetName:"Vec4"},{name:"mul",newName:"multiply",target:nn,targetName:"Vec4"},{name:"div",newName:"divide",target:nn,targetName:"Vec4"},{name:"dist",newName:"distance",target:nn,targetName:"Vec4"},{name:"sqrDist",newName:"squaredDistance",target:nn,targetName:"Vec4"},{name:"mag",newName:"len",target:nn,targetName:"Vec4"},{name:"sqrMag",newName:"lengthSqr",target:nn,targetName:"Vec4"},{name:"scale",newName:"multiplyScalar",target:nn,targetName:"Vec4"},{name:"exactEquals",newName:"strictEquals",target:nn,targetName:"Vec4"}]),rt(nn.prototype,"Vec4",[{name:"mag",newName:"length",target:nn.prototype,targetName:"Vec4"},{name:"magSqr",newName:"lengthSqr",target:nn.prototype,targetName:"Vec4"},{name:"scale",newName:"multiplyScalar",target:nn.prototype,targetName:"Vec4"},{name:"exactEquals",newName:"strictEquals",target:nn.prototype,targetName:"Vec4"}]),rt(En,"Quat",[{name:"mag",newName:"len",target:En,targetName:"Quat"},{name:"mul",newName:"multiply",target:En,targetName:"Quat"},{name:"sqrMag",newName:"lengthSqr",target:En,targetName:"Quat"},{name:"scale",newName:"multiplyScalar",target:En,targetName:"Quat"},{name:"exactEquals",newName:"strictEquals",target:En,targetName:"Quat"}]),rt(En.prototype,"Quat",[{name:"scale",newName:"multiplyScalar",target:En.prototype,targetName:"Quat"},{name:"exactEquals",newName:"strictEquals",target:En.prototype,targetName:"Quat"}]),rt(pn,"Color",[{name:"sub",newName:"subtract",target:pn,targetName:"Color"},{name:"mul",newName:"multiply",target:pn,targetName:"Color"},{name:"div",newName:"divide",target:pn,targetName:"Color"},{name:"exactEquals",newName:"strictEquals",target:pn,targetName:"Color"},{name:"fromHex",newName:"fromHEX",customFunction:function(){for(var t=arguments.length,e=new Array(t),i=0;i=t.x&&this.y<=t.y&&this.y+this.height>=t.y},i.containsRect=function(t){return this.x<=t.x&&this.x+this.width>=t.x+t.width&&this.y<=t.y&&this.y+this.height>=t.y+t.height},i.transformMat4=function(t){var e=this.x,i=this.y,n=e+this.width,r=i+this.height,s=t.m00*e+t.m04*i+t.m12,a=t.m01*e+t.m05*i+t.m13,o=t.m00*n+t.m04*i+t.m12,h=t.m01*n+t.m05*i+t.m13,u=t.m00*e+t.m04*r+t.m12,l=t.m01*e+t.m05*r+t.m13,c=t.m00*n+t.m04*r+t.m12,_=t.m01*n+t.m05*r+t.m13,d=Math.min(s,o,u,c),f=Math.max(s,o,u,c),p=Math.min(a,h,l,_),m=Math.max(a,h,l,_);return this.x=d,this.y=p,this.width=f-d,this.height=m-p,this},i.transformMat4ToPoints=function(t,e,i,n,r){var s=this.x,a=this.y,o=s+this.width,h=a+this.height;e.x=t.m00*s+t.m04*a+t.m12,e.y=t.m01*s+t.m05*a+t.m13,r.x=t.m00*o+t.m04*a+t.m12,r.y=t.m01*o+t.m05*a+t.m13,i.x=t.m00*s+t.m04*h+t.m12,i.y=t.m01*s+t.m05*h+t.m13,n.x=t.m00*o+t.m04*h+t.m12,n.y=t.m01*o+t.m05*h+t.m13},n(e,[{key:"xMin",get:function(){return this.x},set:function(t){this.width+=this.x-t,this.x=t}},{key:"yMin",get:function(){return this.y},set:function(t){this.height+=this.y-t,this.y=t}},{key:"xMax",get:function(){return this.x+this.width},set:function(t){this.width=t-this.x}},{key:"yMax",get:function(){return this.y+this.height},set:function(t){this.height=t-this.y}},{key:"center",get:function(){return new Fn(this.x+.5*this.width,this.y+.5*this.height)},set:function(t){this.x=t.x-.5*this.width,this.y=t.y-.5*this.height}},{key:"origin",get:function(){return new Fn(this.x,this.y)},set:function(t){this.x=t.x,this.y=t.y}},{key:"size",get:function(){return new Hn(this.width,this.height)},set:function(t){this.width=t.width,this.height=t.height}},{key:"z",get:function(){return this.width},set:function(t){this.width=t}},{key:"w",get:function(){return this.height},set:function(t){this.height=t}}]),e}(Ae));function Wn(t,e,i,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),new Vn(t,e,i,n)}gi.fastDefine("cc.Rect",Vn,{x:0,y:0,width:0,height:0}),v.Rect=Vn,v.rect=Wn;var Xn=t("br",Float64Array),jn=t("bs",function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.createFloatArray=function(t){return new Xn(t)},n(e,[{key:"array",get:function(){return this._array}}]),e}(Ae)),Yn=Object.freeze({__proto__:null,bits:x,Vec2:Fn,v2:kn,Vec3:hn,v3:un,Vec4:nn,v4:rn,Quat:En,quat:In,Mat3:vn,Mat4:Dn,mat4:Nn,AffineTransform:Gn,Size:Hn,size:zn,Rect:Vn,rect:Wn,Color:pn,color:mn,preTransforms:On,HALF_PI:Ri,TWO_PI:bi,EPSILON:Ci,equals:wi,approx:xi,clamp:Ii,clamp01:Oi,lerp:Di,toRadian:Mi,toDegree:Pi,random:Bi,setRandGenerator:Ni,randomRange:Li,randomRangeInt:Fi,pseudoRandom:ki,pseudoRandomRange:Ui,pseudoRandomRangeInt:Gi,nextPow2:Hi,repeat:zi,pingPong:Vi,inverseLerp:Wi,absMaxComponent:Xi,absMax:ji,enumerableProps:Yi,floatToHalf:$i,halfToFloat:tn,MATH_FLOAT_ARRAY:Xn,MathBase:jn});t("aE",Yn);var Kn=new hn,qn=new hn,Qn=new hn,Zn=new hn,Jn=new hn,$n=new hn,tr=new Array(3),er=new Array(3);function ir(t,e){return hn.dot(e.n,t)-e.d}function nr(t,e,i){return hn.copy(t,e),hn.subtract(Jn,i.center,i.halfExtents),hn.add($n,i.center,i.halfExtents),t.x=t.x$n.x?$n.x:t.x,t.y=t.y>$n.y?$n.y:t.y,t.z=t.z>$n.z?$n.z:t.z,t}function rr(t,e,i){hn.set(Kn,i.orientation.m00,i.orientation.m01,i.orientation.m02),hn.set(qn,i.orientation.m03,i.orientation.m04,i.orientation.m05),hn.set(Qn,i.orientation.m06,i.orientation.m07,i.orientation.m08),tr[0]=Kn,tr[1]=qn,tr[2]=Qn,er[0]=i.halfExtents.x,er[1]=i.halfExtents.y,er[2]=i.halfExtents.z,hn.subtract(Zn,e,i.center),hn.set(t,i.center.x,i.center.y,i.center.z);for(var n=0;n<3;n++){var r=hn.dot(Zn,tr[n]);r>er[n]&&(r=er[n]),r<-er[n]&&(r=-er[n]),t.x+=r*tr[n].x,t.y+=r*tr[n].y,t.z+=r*tr[n].z}return t}var sr=Object.freeze({__proto__:null,point_plane:ir,pt_point_plane:function(t,e,i){var n=ir(e,i);return hn.subtract(t,e,hn.multiplyScalar(t,i.n,n))},pt_point_aabb:nr,pt_point_obb:rr,pt_point_line:function(t,e,i,n){hn.subtract(Kn,i,n);var r=Kn.clone(),s=hn.lengthSqr(r);if(0===s)hn.copy(t,i);else{hn.subtract(Kn,e,i);var a=hn.dot(Kn,r)/s;a<0?hn.copy(t,i):a>1?hn.copy(t,n):hn.scaleAndAdd(t,i,r,a)}}}),ar={SHAPE_RAY:1,SHAPE_LINE:2,SHAPE_SPHERE:4,SHAPE_AABB:8,SHAPE_OBB:16,SHAPE_PLANE:32,SHAPE_TRIANGLE:64,SHAPE_FRUSTUM:128,SHAPE_FRUSTUM_ACCURATE:256,SHAPE_CAPSULE:512,SHAPE_SPLINE:1024},or=function(){function t(t,e,i,n,r,s){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=-1),this.s=void 0,this.e=void 0,this._type=void 0,this._type=ar.SHAPE_LINE,this.s=new hn(t,e,i),this.e=new hn(n,r,s)}return t.create=function(e,i,n,r,s,a){return new t(e,i,n,r,s,a)},t.clone=function(e){return new t(e.s.x,e.s.y,e.s.z,e.e.x,e.e.y,e.e.z)},t.copy=function(t,e){return hn.copy(t.s,e.s),hn.copy(t.e,e.e),t},t.fromPoints=function(t,e,i){return hn.copy(t.s,e),hn.copy(t.e,i),t},t.set=function(t,e,i,n,r,s,a){return t.s.x=e,t.s.y=i,t.s.z=n,t.e.x=r,t.e.y=s,t.e.z=a,t},t.len=function(t){return hn.distance(t.s,t.e)},t.prototype.length=function(){return hn.distance(this.s,this.e)},n(t,[{key:"type",get:function(){return this._type}}]),t}(),hr=function(){function t(t,e,i,n,r,s){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=-1),this.o=void 0,this.d=void 0,this._type=void 0,this._type=ar.SHAPE_RAY,this.o=new hn(t,e,i),this.d=new hn(n,r,s)}return t.create=function(e,i,n,r,s,a){return void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=1),new t(e,i,n,r,s,a)},t.clone=function(e){return new t(e.o.x,e.o.y,e.o.z,e.d.x,e.d.y,e.d.z)},t.copy=function(t,e){return hn.copy(t.o,e.o),hn.copy(t.d,e.d),t},t.fromPoints=function(t,e,i){return hn.copy(t.o,e),hn.normalize(t.d,hn.subtract(t.d,i,e)),t},t.set=function(t,e,i,n,r,s,a){return t.o.x=e,t.o.y=i,t.o.z=n,t.d.x=r,t.d.y=s,t.d.z=a,t},t.prototype.computeHit=function(t,e){hn.normalize(t,this.d),hn.scaleAndAdd(t,this.o,t,e)},n(t,[{key:"type",get:function(){return this._type}}]),t}(),ur=new hn,lr=new hn,cr=new hn,_r=new hn;function dr(t){return Math.max(Math.max(t.x,t.y),t.z)}var fr,pr,mr,gr,vr,yr=function(){function t(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1),this._center=new hn(0,0,0),this._radius=0,this._type=void 0,this._type=ar.SHAPE_SPHERE,this._center=new hn(t,e,i),this._radius=n}t.create=function(e,i,n,r){return new t(e,i,n,r)},t.clone=function(e){return new t(e.center.x,e.center.y,e.center.z,e.radius)},t.copy=function(t,e){return hn.copy(t.center,e.center),t.radius=e.radius,t},t.fromPoints=function(t,e,i){return hn.multiplyScalar(t.center,hn.add(ur,e,i),.5),t.radius=.5*hn.subtract(ur,i,e).length(),t},t.set=function(t,e,i,n,r){return t.center.x=e,t.center.y=i,t.center.z=n,t.radius=r,t};var e=t.prototype;return e.destroy=function(){},e.clone=function(){return t.clone(this)},e.copy=function(e){return t.copy(this,e)},e.getBoundary=function(t,e){hn.set(t,this.center.x-this.radius,this.center.y-this.radius,this.center.z-this.radius),hn.set(e,this.center.x+this.radius,this.center.y+this.radius,this.center.z+this.radius)},e.transform=function(t,e,i,n,r){hn.transformMat4(r.center,this.center,t),r.radius=this.radius*dr(n)},e.translateAndRotate=function(t,e,i){hn.transformMat4(i.center,this.center,t)},e.setScale=function(t,e){e.radius=this.radius*dr(t)},e.mergePoint=function(t){this.radius<0&&(this.center.set(t),this.radius=0),hn.subtract(lr,t,this.center);var e=lr.length();if(e>this.radius){var i=.5*(e-this.radius);this.radius+=i,hn.multiplyScalar(lr,lr,i/e),hn.add(this.center,this.center,lr)}},e.mergePoints=function(t){var e=t.length;if(!(e<1)){this.radius=-1;for(var i=0;i-Number.EPSILON))return 0;var r=1/n;hn.subtract(gr,t.o,e.a);var s=hn.dot(gr,mr)*r;if(s<0||s>1)return 0;hn.cross(vr,gr,fr);var a=hn.dot(t.d,vr)*r;if(a<0||s+a>1)return 0;var o=hn.dot(pr,vr)*r;return o<0?0:o}),Er=function(){var t=new hn(0,0,0);return function(e,i){var n=i.radius,r=i.center,s=e.o,a=e.d,o=n*n;hn.subtract(t,r,s);var h=t.lengthSqr(),u=hn.dot(t,a),l=o-(h-u*u);if(l<0)return 0;var c=Math.sqrt(l),_=hp?0:f>0?f:p}(i,t,e)}}(),Rr=function(){var t=new hn,e=new hn,i=new hn,n=new hn,r=new hn,s=new hn,a=new hn,o=new Array(3),h=new Array(3),u=new Array(3),l=new Array(6);return function(c,_){o[0]=_.halfExtents.x,o[1]=_.halfExtents.y,o[2]=_.halfExtents.z,t=_.center,e=c.o,i=c.d,hn.set(n,_.orientation.m00,_.orientation.m01,_.orientation.m02),hn.set(r,_.orientation.m03,_.orientation.m04,_.orientation.m05),hn.set(s,_.orientation.m06,_.orientation.m07,_.orientation.m08),hn.subtract(a,t,e),h[0]=hn.dot(n,i),h[1]=hn.dot(r,i),h[2]=hn.dot(s,i),u[0]=hn.dot(n,a),u[1]=hn.dot(r,a),u[2]=hn.dot(s,a);for(var d=0;d<3;++d){if(0===h[d]){if(-u[d]-o[d]>0||-u[d]+o[d]<0)return 0;h[d]=1e-7}l[2*d+0]=(u[d]+o[d])/h[d],l[2*d+1]=(u[d]-o[d])/h[d]}var f=Math.max(Math.max(Math.min(l[0],l[1]),Math.min(l[2],l[3])),Math.min(l[4],l[5])),p=Math.min(Math.min(Math.max(l[0],l[1]),Math.max(l[2],l[3])),Math.max(l[4],l[5]));return p<0||f>p?0:f>0?f:p}}(),br=function(){var t=new hn,e=new hn,i=new hn,n=new hn,r=new hn,s=new hn,a=new hn,o=new yr;return function(h,u){var l=u.ellipseCenter0,c=u.ellipseCenter1,_=hn.subtract(e,c,l);if(_.length()=0&&x<=1?R:x<0?(o.radius=u.radius,o.center.set(u.ellipseCenter0),us.raySphere(h,o)):x>1?(o.radius=u.radius,o.center.set(u.ellipseCenter1),us.raySphere(h,o)):0}}(),Cr=function(){var t=new hn(0,0,0);return function(e,i){hn.subtract(t,e.e,e.s);var n=-ir(e.s,i)/hn.dot(t,i.n);return n<0||n>1?0:n}}(),wr=function(){var t=new hn(0,0,0),e=new hn(0,0,0),i=new hn(0,0,0),n=new hn(0,0,0),r=new hn(0,0,0),s=new hn(0,0,0);return function(a,o,h){hn.subtract(t,o.b,o.a),hn.subtract(e,o.c,o.a),hn.subtract(i,a.s,a.e),hn.cross(r,t,e);var u=hn.dot(i,r);if(u<=0)return 0;hn.subtract(n,a.s,o.a);var l=hn.dot(n,r);if(l<0||l>u)return 0;hn.cross(s,i,n);var c=hn.dot(e,s);if(c<0||c>u)return 0;var _=-hn.dot(t,s);if(_<0||c+_>u)return 0;if(h){var d=1/u,f=1-(c*=d)-(_*=d);hn.set(h,o.a.x*f+o.b.x*c+o.c.x*_,o.a.y*f+o.b.y*c+o.c.y*_,o.a.z*f+o.b.z*c+o.c.z*_)}return 1}}(),Ir=new hr;function Or(t,e){Ir.o.set(t.s),hn.subtract(Ir.d,t.e,t.s),Ir.d.normalize();var i=Ar(Ir,e);return i<=t.length()?i:0}function Dr(t,e){Ir.o.set(t.s),hn.subtract(Ir.d,t.e,t.s),Ir.d.normalize();var i=Rr(Ir,e);return i<=t.length()?i:0}function Mr(t,e){Ir.o.set(t.s),hn.subtract(Ir.d,t.e,t.s),Ir.d.normalize();var i=Er(Ir,e);return i<=t.length()?i:0}var Pr,Br,Nr,Lr,Fr=(Pr=new hn,Br=new hn,Nr=new hn,Lr=new hn,function(t,e){return hn.subtract(Pr,t.center,t.halfExtents),hn.add(Br,t.center,t.halfExtents),hn.subtract(Nr,e.center,e.halfExtents),hn.add(Lr,e.center,e.halfExtents),Pr.x<=Lr.x&&Br.x>=Nr.x&&Pr.y<=Lr.y&&Br.y>=Nr.y&&Pr.z<=Lr.z&&Br.z>=Nr.z});function kr(t,e,i,n,r,s){hn.set(s[0],t.x+i.x*e.x+n.x*e.y+r.x*e.z,t.y+i.y*e.x+n.y*e.y+r.y*e.z,t.z+i.z*e.x+n.z*e.y+r.z*e.z),hn.set(s[1],t.x-i.x*e.x+n.x*e.y+r.x*e.z,t.y-i.y*e.x+n.y*e.y+r.y*e.z,t.z-i.z*e.x+n.z*e.y+r.z*e.z),hn.set(s[2],t.x+i.x*e.x-n.x*e.y+r.x*e.z,t.y+i.y*e.x-n.y*e.y+r.y*e.z,t.z+i.z*e.x-n.z*e.y+r.z*e.z),hn.set(s[3],t.x+i.x*e.x+n.x*e.y-r.x*e.z,t.y+i.y*e.x+n.y*e.y-r.y*e.z,t.z+i.z*e.x+n.z*e.y-r.z*e.z),hn.set(s[4],t.x-i.x*e.x-n.x*e.y-r.x*e.z,t.y-i.y*e.x-n.y*e.y-r.y*e.z,t.z-i.z*e.x-n.z*e.y-r.z*e.z),hn.set(s[5],t.x+i.x*e.x-n.x*e.y-r.x*e.z,t.y+i.y*e.x-n.y*e.y-r.y*e.z,t.z+i.z*e.x-n.z*e.y-r.z*e.z),hn.set(s[6],t.x-i.x*e.x+n.x*e.y-r.x*e.z,t.y-i.y*e.x+n.y*e.y-r.y*e.z,t.z-i.z*e.x+n.z*e.y-r.z*e.z),hn.set(s[7],t.x-i.x*e.x-n.x*e.y+r.x*e.z,t.y-i.y*e.x-n.y*e.y+r.y*e.z,t.z-i.z*e.x-n.z*e.y+r.z*e.z)}function Ur(t,e){for(var i=hn.dot(e,t[0]),n=i,r=1;r<8;++r){var s=hn.dot(e,t[r]);i=sn?s:n}return[i,n]}var Gr,Hr,zr,Vr,Wr,Xr=function(){for(var t=new Array(15),e=0;e<15;e++)t[e]=new hn(0,0,0);for(var i=new Array(8),n=new Array(8),r=0;r<8;r++)i[r]=new hn(0,0,0),n[r]=new hn(0,0,0);var s=new hn,a=new hn;return function(e,r){hn.set(t[0],1,0,0),hn.set(t[1],0,1,0),hn.set(t[2],0,0,1),hn.set(t[3],r.orientation.m00,r.orientation.m01,r.orientation.m02),hn.set(t[4],r.orientation.m03,r.orientation.m04,r.orientation.m05),hn.set(t[5],r.orientation.m06,r.orientation.m07,r.orientation.m08);for(var o=0;o<3;++o)hn.cross(t[6+3*o],t[o],t[3]),hn.cross(t[7+3*o],t[o],t[4]),hn.cross(t[7+3*o],t[o],t[5]);hn.subtract(s,e.center,e.halfExtents),hn.add(a,e.center,e.halfExtents),function(t,e,i){hn.set(i[0],t.x,e.y,e.z),hn.set(i[1],t.x,e.y,t.z),hn.set(i[2],t.x,t.y,e.z),hn.set(i[3],t.x,t.y,t.z),hn.set(i[4],e.x,e.y,e.z),hn.set(i[5],e.x,e.y,t.z),hn.set(i[6],e.x,t.y,e.z),hn.set(i[7],e.x,t.y,t.z)}(s,a,i),kr(r.center,r.halfExtents,t[3],t[4],t[5],n);for(var h=0;h<15;++h){var u=Ur(i,t[h]),l=Ur(n,t[h]);if(l[0]>u[1]||u[0]>l[1])return 0}return 1}}(),jr=function(t,e){var i=t.halfExtents.x*Math.abs(e.n.x)+t.halfExtents.y*Math.abs(e.n.y)+t.halfExtents.z*Math.abs(e.n.z),n=hn.dot(e.n,t.center);return n+ie.d?0:1},Yr=function(t,e){for(var i=0;in.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;ln.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;cn.halfExtents.z?e++:t[c].z<-n.halfExtents.z&&i++;return e===r.vertices.length||i===r.vertices.length?0:1}}(),qr=(Gr=new hn(0,0,0),Hr=new vn,function(t,e){return hn.subtract(Gr,e,t.center),hn.transformMat3(Gr,Gr,vn.transpose(Hr,t.orientation)),i=Gr,n=t.halfExtents,Math.abs(i.x)e.d?0:1}),Zr=function(t,e){for(var i=0;ir.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;_r.halfExtents.y?i++:e<-r.halfExtents.y&&n++;if(i===a.vertices.length||n===a.vertices.length)return 0;i=0,n=0;for(var d=0;dr.halfExtents.z?i++:e<-r.halfExtents.z&&n++;return i===a.vertices.length||n===a.vertices.length?0:1}}(),$r=function(){for(var t=new Array(15),e=0;e<15;e++)t[e]=new hn(0,0,0);for(var i=new Array(8),n=new Array(8),r=0;r<8;r++)i[r]=new hn(0,0,0),n[r]=new hn(0,0,0);return function(e,r){hn.set(t[0],e.orientation.m00,e.orientation.m01,e.orientation.m02),hn.set(t[1],e.orientation.m03,e.orientation.m04,e.orientation.m05),hn.set(t[2],e.orientation.m06,e.orientation.m07,e.orientation.m08),hn.set(t[3],r.orientation.m00,r.orientation.m01,r.orientation.m02),hn.set(t[4],r.orientation.m03,r.orientation.m04,r.orientation.m05),hn.set(t[5],r.orientation.m06,r.orientation.m07,r.orientation.m08);for(var s=0;s<3;++s)hn.cross(t[6+3*s],t[s],t[3]),hn.cross(t[7+3*s],t[s],t[4]),hn.cross(t[8+3*s],t[s],t[5]);kr(e.center,e.halfExtents,t[0],t[1],t[2],i),kr(r.center,r.halfExtents,t[3],t[4],t[5],n);for(var a=0;a<15;++a){var o=Ur(i,t[a]),h=Ur(n,t[a]);if(h[0]>o[1]||o[0]>h[1])return 0}return 1}}(),ts=function(){for(var t=new yr,e=new hn,i=new hn,n=new hn,r=new Array(8),s=0;s<8;s++)r[s]=new hn;for(var a=new Array(8),o=0;o<8;o++)a[o]=new hn;return function(s,o){if(0===hn.squaredDistance(o.ellipseCenter0,o.ellipseCenter1))return t.radius=o.radius,t.center.set(o.ellipseCenter0),us.sphereOBB(t,s);e.x=s.orientation.m00,e.y=s.orientation.m01,e.z=s.orientation.m02,i.x=s.orientation.m03,i.y=s.orientation.m04,i.z=s.orientation.m05,n.x=s.orientation.m06,n.y=s.orientation.m07,n.z=s.orientation.m08,kr(s.center,s.halfExtents,e,i,n,r);var h=a,u=hn.copy(h[0],e),l=hn.copy(h[1],i),c=hn.copy(h[2],n);hn.subtract(h[3],o.center,s.center).normalize();var _=hn.subtract(h[4],o.ellipseCenter0,o.ellipseCenter1);_.normalize(),hn.cross(h[5],u,_),hn.cross(h[6],l,_),hn.cross(h[7],c,_);for(var d=0;d<8;++d){var f=Ur(r,h[d]),p=hn.dot(h[d],o.ellipseCenter0),m=hn.dot(h[d],o.ellipseCenter1),g=Math.max(p,m),v=Math.min(p,m)-o.radius,y=g+o.radius;if(v>f[1]||f[0]>y)return 0}return 1}}(),es=function(t,e){var i=hn.dot(e.n,t.center),n=t.radius*e.n.length();return i+ne.d?0:1},is=function(t,e){for(var i=0;io)){hn.add(Vr,s,hn.multiplyScalar(Vr,a,r));for(var u=0;u<6;u++)if(u!==i&&u!==i+Wr[i]){var l=e.planes[u];if(hn.dot(l.n,Vr)1?hn.squaredDistance(i.center,n.ellipseCenter1)y&&(h=y,u=g+f,T=p)),u<0?(u=0,-m<0?h=0:-m>d?h=y:(h=-m,y=d)):u>T&&(u=T,-m+f<0?h=0:-m+f>d?h=y:(h=-m+f,y=d));var S=Math.abs(h)0&&(t.d=e.d/i),t},t.prototype.transform=function(t){Dn.invert(_s,t),Dn.transpose(_s,_s),nn.set(ds,this.n.x,this.n.y,this.n.z,-this.d),nn.transformMat4(ds,ds,_s),hn.set(this.n,ds.x,ds.y,ds.z),this.d=-ds.w},n(t,[{key:"type",get:function(){return this._type}},{key:"x",get:function(){return this.n.x},set:function(t){this.n.x=t}},{key:"y",get:function(){return this.n.y},set:function(t){this.n.y=t}},{key:"z",get:function(){return this.n.z},set:function(t){this.n.z=t}},{key:"w",get:function(){return this.d},set:function(t){this.d=t}}]),t}(),ps=function(){function t(t,e,i,n,r,s,a,o,h){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=0),void 0===o&&(o=1),void 0===h&&(h=0),this.a=void 0,this.b=void 0,this.c=void 0,this._type=void 0,this._type=ar.SHAPE_TRIANGLE,this.a=new hn(t,e,i),this.b=new hn(n,r,s),this.c=new hn(a,o,h)}return t.create=function(e,i,n,r,s,a,o,h,u){return void 0===e&&(e=1),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=0),void 0===o&&(o=0),void 0===h&&(h=0),void 0===u&&(u=1),new t(e,i,n,r,s,a,o,h,u)},t.clone=function(e){return new t(e.a.x,e.a.y,e.a.z,e.b.x,e.b.y,e.b.z,e.c.x,e.c.y,e.c.z)},t.copy=function(t,e){return hn.copy(t.a,e.a),hn.copy(t.b,e.b),hn.copy(t.c,e.c),t},t.fromPoints=function(t,e,i,n){return hn.copy(t.a,e),hn.copy(t.b,i),hn.copy(t.c,n),t},t.set=function(t,e,i,n,r,s,a,o,h,u){return t.a.x=e,t.a.y=i,t.a.z=n,t.b.x=r,t.b.y=s,t.b.z=a,t.c.x=o,t.c.y=h,t.c.z=u,t},n(t,[{key:"type",get:function(){return this._type}}]),t}(),ms=new hn,gs=new hn,vs=new hn,ys=new hn,Ts=new vn,Ss=function(t,e,i){Ts.m00=Math.abs(i.m00),Ts.m01=Math.abs(i.m01),Ts.m02=Math.abs(i.m02),Ts.m03=Math.abs(i.m04),Ts.m04=Math.abs(i.m05),Ts.m05=Math.abs(i.m06),Ts.m06=Math.abs(i.m08),Ts.m07=Math.abs(i.m09),Ts.m08=Math.abs(i.m10),hn.transformMat3(t,e,Ts)},Es=function(){function t(t,e,i,n,r,s){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1),void 0===r&&(r=1),void 0===s&&(s=1),this.center=void 0,this.halfExtents=void 0,this._type=void 0,this._type=ar.SHAPE_AABB,this.center=new hn(t,e,i),this.halfExtents=new hn(n,r,s)}t.create=function(e,i,n,r,s,a){return new t(e,i,n,r,s,a)},t.clone=function(e){return new t(e.center.x,e.center.y,e.center.z,e.halfExtents.x,e.halfExtents.y,e.halfExtents.z)},t.copy=function(t,e){return hn.copy(t.center,e.center),hn.copy(t.halfExtents,e.halfExtents),t},t.fromPoints=function(t,e,i){return hn.add(ms,i,e),hn.subtract(gs,i,e),hn.multiplyScalar(t.center,ms,.5),hn.multiplyScalar(t.halfExtents,gs,.5),t},t.set=function(t,e,i,n,r,s,a){return t.center.set(e,i,n),t.halfExtents.set(r,s,a),t},t.merge=function(e,i,n){return hn.subtract(ms,i.center,i.halfExtents),hn.subtract(gs,n.center,n.halfExtents),hn.add(vs,i.center,i.halfExtents),hn.add(ys,n.center,n.halfExtents),hn.max(ys,vs,ys),hn.min(vs,ms,gs),t.fromPoints(e,vs,ys)},t.toBoundingSphere=function(t,e){return t.center.set(e.center),t.radius=e.halfExtents.length(),t},t.transform=function(t,e,i){return hn.transformMat4(t.center,e.center,i),Ss(t.halfExtents,e.halfExtents,i),t};var e=t.prototype;return e.getBoundary=function(t,e){hn.subtract(t,this.center,this.halfExtents),hn.add(e,this.center,this.halfExtents)},e.transform=function(t,e,i,n,r){hn.transformMat4(r.center,this.center,t),Ss(r.halfExtents,this.halfExtents,t)},e.clone=function(){return t.clone(this)},e.copy=function(e){return t.copy(this,e)},e.mergePoint=function(t){this.getBoundary(ms,gs),t.xgs.x&&(gs.x=t.x),t.y>gs.y&&(gs.y=t.y),t.z>gs.z&&(gs.z=t.z),hn.add(vs,ms,gs),this.center.set(hn.multiplyScalar(vs,vs,.5)),this.halfExtents.set(gs.x-vs.x,gs.y-vs.y,gs.z-vs.z)},e.mergePoints=function(t){if(!(t.length<1))for(var e=0;e>>1;n<=r;s=n+r>>>1){var a=t[s];if(a>e+i)r=s-1;else{if(!(a=t._times.length)return{done:!0,value:void 0};var i=[t._times[e],t._values[e]];return++e,{done:!1,value:i}}}},e.keyframes=function(){return this},e.times=function(){return this._times},e.values=function(){return this._values},e.getKeyframeTime=function(t){return this._times[t]},e.getKeyframeValue=function(t){return this._values[t]},e.addKeyFrame=function(t,e){return this._insertNewKeyframe(t,e)},e.removeKeyframe=function(t){this._times.splice(t,1),this._values.splice(t,1)},e.indexOfKeyframe=function(t){return Bs(this._times,t)},e.updateTime=function(t,e){var i=this._values[t];this.removeKeyframe(t),this._insertNewKeyframe(e,i)},e.assignSorted=function(t,e){if(void 0!==e)this.setKeyframes(t.slice(),e.slice());else{var i=Array.from(t);this.setKeyframes(i.map((function(t){return t[0]})),i.map((function(t){return t[1]})))}},e.clear=function(){this._times.length=0,this._values.length=0},e.searchKeyframe=function(t){return Bs(this._times,t)},e.setKeyframes=function(t,e){t.length,e.length,function(t){t.every((function(t,e,i){return 0===e||t>i[e-1]||xi(t,i[e-1],1e-6)}))}(t),this._times=t,this._values=e},e._insertNewKeyframe=function(t,e){var i=this._times,n=this._values,r=i.length,s=Bs(i,t);if(s>=0)return s;var a=~s;return 0===a?(i.unshift(t),n.unshift(e)):a===r?(i.push(t),n.push(e)):(i.splice(a-1,0,t),n.splice(a-1,0,e)),a},n(t,[{key:"keyFramesCount",get:function(){return this._times.length}},{key:"rangeMin",get:function(){return this._times[0]}},{key:"rangeMax",get:function(){return this._times[this._values.length-1]}}]),t}();function Us(t){return t>-1e-9&&t<1e-9}function Gs(t,e,i,n){return i.slice().reverse().reduce((function(i,n){return n(t,e,i)||i}),n)}gi.fastDefine("cc.KeyframeCurve",ks,{_times:[],_values:[]}),t("cl",Ns),function(t){t[t.LINEAR=0]="LINEAR",t[t.CONSTANT=1]="CONSTANT",t[t.CUBIC=2]="CUBIC"}(Ns||t("cl",Ns={})),t("cm",Ls),function(t){t[t.LINEAR=0]="LINEAR",t[t.CLAMP=1]="CLAMP",t[t.LOOP=2]="LOOP",t[t.PING_PONG=3]="PING_PONG"}(Ls||t("cm",Ls={})),t("cn",Fs),function(t){t[t.NONE=0]="NONE",t[t.LEFT=1]="LEFT",t[t.RIGHT=2]="RIGHT",t[t.BOTH=3]="BOTH"}(Fs||t("cn",Fs={}));var Hs=function(){},zs=function(){return Hs},Vs=Ws((function(){}));function Ws(t){return function(e){return"function"==typeof e?t(e):function(i){return t(i,e)}}}function Xs(t){return function(e){return function(i){!function(t,e,i){var n=Ys(t);if(n){var r=Ks(n,"proto");Ks(r,"editor")[e]=i}}(i,t,e)}}}var js="__ccclassCache__";function Ys(t){return Ks(t,js)}function Ks(t,e){return t[e]||(t[e]={})}var qs=Ws((function(t,e){var i=Vt(t);i===Object&&(i=null);var n={name:e,extends:i,ctor:t},r=t[js];if(r){var s=r.proto;s&&Ht(n,s),t[js]=void 0}return gi(n)})),Qs=Xs("requireComponent"),Zs=Xs("executionOrder"),Js=Vs;function $s(t,e,i){var n=null;function r(t,e,i){!function(t,e,i,n,r,s){var a,o=s&&"function"!=typeof s&&(s.get||s.set);r&&(a=ri(r,o));var h=Ht(e,a||r||{});o?(s.get&&(h.get=s.get),s.set&&(h.set=s.set)):ia(t,h,i,n,s)}(function(t){return Ys(t.constructor)}(t),function(t,e){var i,n,r=Ks(Ys(t.constructor),"proto"),s=Ks(r,"properties");return null!==(n=s[i=e])&&void 0!==n?n:s[i]={}}(t,e),t.constructor,e,n,i)}return void 0===t?$s({type:void 0}):void 0===e?(n=t,r):void r(t,e,i)}function ta(t){var e;try{e=t()}catch(e){return t}return"object"!=typeof e||null===e?e:t}function ea(t,e,i){var n,r,s=Ys(t.constructor),a=Ks(s,"proto"),o=Ks(a,"properties"),h=null!==(r=o[n=e])&&void 0!==r?r:o[n]={};return h.__internalFlags|=si.STANDALONE,i&&"function"!=typeof i&&(i.get||i.set)?(i.get&&(h.get=i.get),i.set&&(h.set=i.set)):ia(s,h,t.constructor,e,i),h}function ia(t,e,i,n,r){if(void 0!==r)"function"==typeof r?e.default=ta(r):null===r||r.initializer&&(e.default=ta(r.initializer));else{var s=t.default||(t.default=function(t){var e;try{e=new t}catch(t){return{}}return e}(i));s.hasOwnProperty(n)&&(e.default=s[n])}}var na=Symbol("cc:SerializationMetadata"),ra=t("cN",(function(t,e,i){oa(ea(t,e,i))}));function sa(t){return function(e,i,n){var r=ea(e,i,n);r.formerlySerializedAs=t,oa(r)}}var aa=function(t,e,i){var n=ea(t,e,i);n.editorOnly=!0,oa(n)};function oa(t){t.__internalFlags|=si.IMPLICIT_SERIALIZABLE}var ha=Hs,ua=Vs,la=zs,ca=Vs,_a=zs,da=zs,fa=zs,pa=t("cC",Hs),ma=t("cE",zs),ga=t("cF",zs),va=t("cD",zs),ya=t("cH",zs),Ta=t("cI",zs),Sa=t("cJ",Hs),Ea=t("cG",zs),Aa=t("cK",Hs),Ra=xa(Ke),ba=xa(qe),Ca=xa(Qe),wa=xa(Ze);function xa(t){return $s({type:t})}var Ia=t("cL",(function(t,e,i){ea(t,e,i).override=!0})),Oa=t("bW","__editorExtras__"),Da=t("b_",(function(){})),Ma=Object.freeze({__proto__:null,uniquelyReferenced:ha,ccclass:qs,property:$s,requireComponent:Qs,executionOrder:Zs,disallowMultiple:Js,executeInEditMode:ua,menu:la,playOnFocus:ca,inspector:_a,icon:da,help:fa,type:xa,integer:Ra,float:ba,boolean:Ca,string:wa,editable:pa,tooltip:va,visible:ma,displayName:ga,displayOrder:Ea,range:ya,rangeStep:Ta,slide:Sa,disallowAnimation:Aa,override:Ia,formerlySerializedAs:sa,serializable:ra});t("bN",Ma);var Pa,Ba,Na,La,Fa,ka,Ua,Ga,Ha,za,Va=[],Wa=t("bQ",function(){function t(t){void 0===t&&(t=""),this._objFlags=void 0,this._name=void 0,this._name=t,this._objFlags=0}t._deferredDestroy=function(){for(var t=Va.length,e=0;e>3},n=i.storageUnit,r=Ka(i.elementType),s=new(qa(n))(t,this._byteOffset,this._unitCount),a=new Array(this._length),o=0;o=1?1:t*t*(3-2*t)}function Po(t){return t<=0?0:t>=1?1:t*t*t*(t*(6*t-15)+10)}v._decorator=Ma;var Bo=Wo(eo,io),No=Wo(ro,so),Lo=Wo(oo,ho),Fo=Wo(lo,co),ko=Wo(fo,po),Uo=Wo(go,vo),Go=Wo(To,So),Ho=Wo(Ao,Ro),zo=Wo(Co,wo),Vo=Wo(Io,Oo);function Wo(t,e){return function(i){return i<.5?e(2*i)/2:t(2*i-1)/2+.5}}var Xo,jo,Yo=Object.freeze({__proto__:null,constant:$a,linear:to,quadIn:eo,quadOut:io,quadInOut:no,cubicIn:ro,cubicOut:so,cubicInOut:ao,quartIn:oo,quartOut:ho,quartInOut:uo,quintIn:lo,quintOut:co,quintInOut:_o,sineIn:fo,sineOut:po,sineInOut:mo,expoIn:go,expoOut:vo,expoInOut:yo,circIn:To,circOut:So,circInOut:Eo,elasticIn:Ao,elasticOut:Ro,elasticInOut:bo,backIn:Co,backOut:wo,backInOut:xo,bounceIn:Io,bounceOut:Oo,bounceInOut:Do,smooth:Mo,fade:Po,quadOutIn:Bo,cubicOutIn:No,quartOutIn:Lo,quintOutIn:Fo,sineOutIn:ko,expoOutIn:Uo,circOutIn:Go,elasticOutIn:Ho,backOutIn:zo,bounceOutIn:Vo});t("cx",Yo),t("cX",jo),function(t){t[t.LINEAR=0]="LINEAR",t[t.CONSTANT=1]="CONSTANT",t[t.QUAD_IN=2]="QUAD_IN",t[t.QUAD_OUT=3]="QUAD_OUT",t[t.QUAD_IN_OUT=4]="QUAD_IN_OUT",t[t.QUAD_OUT_IN=5]="QUAD_OUT_IN",t[t.CUBIC_IN=6]="CUBIC_IN",t[t.CUBIC_OUT=7]="CUBIC_OUT",t[t.CUBIC_IN_OUT=8]="CUBIC_IN_OUT",t[t.CUBIC_OUT_IN=9]="CUBIC_OUT_IN",t[t.QUART_IN=10]="QUART_IN",t[t.QUART_OUT=11]="QUART_OUT",t[t.QUART_IN_OUT=12]="QUART_IN_OUT",t[t.QUART_OUT_IN=13]="QUART_OUT_IN",t[t.QUINT_IN=14]="QUINT_IN",t[t.QUINT_OUT=15]="QUINT_OUT",t[t.QUINT_IN_OUT=16]="QUINT_IN_OUT",t[t.QUINT_OUT_IN=17]="QUINT_OUT_IN",t[t.SINE_IN=18]="SINE_IN",t[t.SINE_OUT=19]="SINE_OUT",t[t.SINE_IN_OUT=20]="SINE_IN_OUT",t[t.SINE_OUT_IN=21]="SINE_OUT_IN",t[t.EXPO_IN=22]="EXPO_IN",t[t.EXPO_OUT=23]="EXPO_OUT",t[t.EXPO_IN_OUT=24]="EXPO_IN_OUT",t[t.EXPO_OUT_IN=25]="EXPO_OUT_IN",t[t.CIRC_IN=26]="CIRC_IN",t[t.CIRC_OUT=27]="CIRC_OUT",t[t.CIRC_IN_OUT=28]="CIRC_IN_OUT",t[t.CIRC_OUT_IN=29]="CIRC_OUT_IN",t[t.ELASTIC_IN=30]="ELASTIC_IN",t[t.ELASTIC_OUT=31]="ELASTIC_OUT",t[t.ELASTIC_IN_OUT=32]="ELASTIC_IN_OUT",t[t.ELASTIC_OUT_IN=33]="ELASTIC_OUT_IN",t[t.BACK_IN=34]="BACK_IN",t[t.BACK_OUT=35]="BACK_OUT",t[t.BACK_IN_OUT=36]="BACK_IN_OUT",t[t.BACK_OUT_IN=37]="BACK_OUT_IN",t[t.BOUNCE_IN=38]="BOUNCE_IN",t[t.BOUNCE_OUT=39]="BOUNCE_OUT",t[t.BOUNCE_IN_OUT=40]="BOUNCE_IN_OUT",t[t.BOUNCE_OUT_IN=41]="BOUNCE_OUT_IN",t[t.SMOOTH=42]="SMOOTH",t[t.FADE=43]="FADE"}(jo||t("cX",jo={}));var Ko,qo=((Xo={})[jo.CONSTANT]=$a,Xo[jo.LINEAR]=to,Xo[jo.QUAD_IN]=eo,Xo[jo.QUAD_OUT]=io,Xo[jo.QUAD_IN_OUT]=no,Xo[jo.QUAD_OUT_IN]=Bo,Xo[jo.CUBIC_IN]=ro,Xo[jo.CUBIC_OUT]=so,Xo[jo.CUBIC_IN_OUT]=ao,Xo[jo.CUBIC_OUT_IN]=No,Xo[jo.QUART_IN]=oo,Xo[jo.QUART_OUT]=ho,Xo[jo.QUART_IN_OUT]=uo,Xo[jo.QUART_OUT_IN]=Lo,Xo[jo.QUINT_IN]=lo,Xo[jo.QUINT_OUT]=co,Xo[jo.QUINT_IN_OUT]=_o,Xo[jo.QUINT_OUT_IN]=Fo,Xo[jo.SINE_IN]=fo,Xo[jo.SINE_OUT]=po,Xo[jo.SINE_IN_OUT]=mo,Xo[jo.SINE_OUT_IN]=ko,Xo[jo.EXPO_IN]=go,Xo[jo.EXPO_OUT]=vo,Xo[jo.EXPO_IN_OUT]=yo,Xo[jo.EXPO_OUT_IN]=Uo,Xo[jo.CIRC_IN]=To,Xo[jo.CIRC_OUT]=So,Xo[jo.CIRC_IN_OUT]=Eo,Xo[jo.CIRC_OUT_IN]=Go,Xo[jo.ELASTIC_IN]=Ao,Xo[jo.ELASTIC_OUT]=Ro,Xo[jo.ELASTIC_IN_OUT]=bo,Xo[jo.ELASTIC_OUT_IN]=Ho,Xo[jo.BACK_IN]=Co,Xo[jo.BACK_OUT]=wo,Xo[jo.BACK_IN_OUT]=xo,Xo[jo.BACK_OUT_IN]=zo,Xo[jo.BOUNCE_IN]=Io,Xo[jo.BOUNCE_OUT]=Oo,Xo[jo.BOUNCE_IN_OUT]=Do,Xo[jo.BOUNCE_OUT_IN]=Vo,Xo[jo.SMOOTH]=Mo,Xo[jo.FADE]=Po,Xo);function Qo(t){return qo[t]}R(255),R(65280);var Zo,Jo,$o,th=Ns.LINEAR<<0|Fs.NONE<<8|jo.LINEAR<<16,eh=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r>0},set:function(t){this._flags&=-256,this._flags|=t<<0}},{key:"tangentWeightMode",get:function(){return(65280&this._flags)>>8},set:function(t){this._flags&=-65281,this._flags|=t<<8}},{key:"easingMethod",get:function(){return(16711680&this._flags)>>16},set:function(t){this._flags&=-16711681,this._flags|=t<<16}}]),e}(Da);function ih(t){var e=new eh;if("number"==typeof t)e.value=t;else{var i=t.interpolationMode,n=t.tangentWeightMode,r=t.value,s=t.rightTangent,a=t.rightTangentWeight,o=t.leftTangent,h=t.leftTangentWeight,u=t.easingMethod,l=t[Oa];e.value=null!=r?r:e.value,e.rightTangent=null!=s?s:e.rightTangent,e.rightTangentWeight=null!=a?a:e.rightTangentWeight,e.leftTangent=null!=o?o:e.leftTangent,e.leftTangentWeight=null!=h?h:e.leftTangentWeight,e.interpolationMode=null!=i?i:e.interpolationMode,e.tangentWeightMode=null!=n?n:e.tangentWeightMode,e.easingMethod=null!=u?u:e.easingMethod,l&&(e[Oa]=l)}return e}gi.fastDefine("cc.RealKeyframeValue",eh,((Ko={interpolationMode:Ns.LINEAR,tangentWeightMode:Fs.NONE,value:0,rightTangent:0,rightTangentWeight:0,leftTangent:0,leftTangentWeight:0,easingMethod:jo.LINEAR})[Oa]=void 0,Ko)),gi.Attr.setClassAttr(eh,Oa,"editorOnly",!0),(Zo=eh,null!==($o=(Jo=Zo)[na])&&void 0!==$o?$o:Jo[na]={}).uniquelyReferenced=!0;var nh,rh=t("ck",function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;rs){var h=this.postExtrapolation,u=i[n-1];if(h===Ls.CLAMP||n<2)return u.value;switch(h){case Ls.LINEAR:return Th(s,u.value,e[n-2],i[n-2].value,t);case Ls.LOOP:t=vh(t,r,s);break;case Ls.PING_PONG:t=yh(t,r,s);break;default:return u.value}}var l=Bs(e,t);if(l>=0)return i[l].value;var c=~l,_=c-1,d=e[_],f=i[_],p=e[c];return function(t,e,i,n,r){var s=i-t;switch(e.interpolationMode){default:case Ns.CONSTANT:return e.value;case Ns.LINEAR:var a=e.easingMethod===jo.LINEAR?r:Qo(e.easingMethod)(r);return Di(e.value,n.value,a);case Ns.CUBIC:var o=1/3,h=e.rightTangent,u=e.rightTangentWeight,l=0!=(e.tangentWeightMode&Fs.RIGHT),c=n.leftTangent,_=n.leftTangentWeight,d=0!=(n.tangentWeightMode&Fs.LEFT);if(l||d){var f=0;if(l)f=u;else{var p=s,m=s*h;f=Math.sqrt(p*p+m*m)*o}var g=Math.atan(h),v=Math.cos(g)*f+t,y=Math.sin(g)*f+e.value,T=0;if(d)T=_;else{var S=s,E=s*c;T=Math.sqrt(S*S+E*E)*o}var A=Math.atan(c),R=(v-t)/s,b=(-Math.cos(A)*T+i-t)/s,C=y,w=-Math.sin(A)*T+n.value,x=[0,0,0],I=function(t,e,i,n,r){var s=i/n,a=e/n,o=s*s,h=1/3*(-1/3*o+a),u=.5*(2/27*s*o-1/3*s*a+t/n),l=h*h*h,c=u*u+l,_=0;if(Us(c)){if(Us(u))return r[0]=0,1;var d=Math.cbrt(-u);return r[0]=2*d,r[1]=-d,2}if(c<0){var f=1/3*Math.acos(-u/Math.sqrt(-l)),p=2*Math.sqrt(-h);r[0]=p*Math.cos(f),r[1]=-p*Math.cos(f+Math.PI/3),r[2]=-p*Math.cos(f-Math.PI/3),_=3}else{var m=Math.sqrt(c),g=Math.cbrt(m-u),v=-Math.cbrt(m+u);r[0]=g+v,_=1}for(var y=1/3*s,T=0;T<_;++T)r[T]-=y;return _}(0-r,3*R,3*b-6*R,3*(R-b)+1,x),O=function(t,e,i){var n=i;if(1===e)n=t[0];else{n=-1/0;for(var r=0;r=0&&s<=1&&s>n&&(n=s)}n===-1/0&&(n=0)}return n}(x,I,r);return Sh(e.value,C,w,n.value,O)}var D=e.value+o*h*s,M=n.value-o*c*s;return Sh(e.value,D,M,n.value,r)}}(d,f,p,i[c],(t-d)/(p-d))},i.addKeyFrame=function(e,i){return t.prototype.addKeyFrame.call(this,e,ih(i))},i.assignSorted=function(t,e){if(void 0!==e)this.setKeyframes(t.slice(),e.map((function(t){return ih(t)})));else{var i=Array.from(t);this.setKeyframes(i.map((function(t){return t[0]})),i.map((function(t){return ih(t[1])})))}},i.isConstant=function(t){if(this._values.length<=1)return!0;var e=this._values[0].value;return this._values.every((function(i){return xi(i.value,e,t)}))},i[Za]=function(t,e){if(e.toCCON){var i=this._times,n=this._values,r=i.length,s=new DataView(new ArrayBuffer(0+sh+sh+ah+oh*r+ph*r)),a=0;s.setUint8(a,this.preExtrapolation),a+=sh,s.setUint8(a,this.postExtrapolation),a+=sh,s.setUint32(a,r,!0),a+=ah,i.forEach((function(t,e){return s.setFloat32(a+oh*e,t,!0)})),a+=oh*r;for(var o,h=d(n);!(o=h()).done;){var u=o.value;a=mh(s,u,a)}var l=new Uint8Array(s.buffer,0,a);t.writeProperty("bytes",l);var c=n.map((function(t){return t[Oa]}));c.some((function(t){return void 0!==t}))&&t.writeProperty("keyframeValueEditorExtras",c)}else t.writeThis()},i[Ja]=function(t,e){if(e.fromCCON){var i=t.readProperty("bytes"),n=new DataView(i.buffer,i.byteOffset,i.byteLength),r=0;this.preExtrapolation=n.getUint8(r),r+=sh,this.postExtrapolation=n.getUint8(r),r+=sh;var s=n.getUint32(r,!0);r+=ah;var a=Array.from({length:s},(function(t,e){return n.getFloat32(r+oh*e,!0)}));r+=oh*s;for(var o=new Array(s),h=0;h>8;return e.easingMethod=s,n}function vh(t,e,i){return e+zi(t-e,i-e)}function yh(t,e,i){return e+Vi(t-e,i-e)}function Th(t,e,i,n,r){return e+(n-e)/(i-t)*(r-t)}function Sh(t,e,i,n,r){var s=1-r;return s*s*s*t+3*s*s*r*e+3*s*r*r*i+r*r*r*n}function Eh(t,e,i,n,r){var s=1-r;return s*(s*(t+(3*e-t)*r)+3*i*r*r)+n*r*r*r}v.bezier=Eh;var Ah,Rh,bh,Ch,wh,xh,Ih,Oh,Dh,Mh,Ph=Math.cos,Bh=Math.acos,Nh=Math.max,Lh=2*Math.PI,Fh=Math.sqrt;function kh(t){return t<0?-Math.pow(-t,1/3):Math.pow(t,1/3)}function Uh(t,e){var i=function(t,e){var i,n,r,s,a=e-0,o=e-t[0],h=3*a,u=3*o,l=3*(e-t[2]),c=1/(-a+u-l+(e-1)),_=1/3,d=(h-6*o+l)*c,f=d*_,p=(-h+u)*c,m=(3*p-d*d)*_,g=m*_,v=(2*d*d*d-9*d*p+a*c*27)/27,y=v/2,T=y*y+g*g*g;if(T<0){var S=-m*_,E=Fh(S*S*S),A=-v/(2*E),R=Bh(A<-1?-1:A>1?1:A),b=2*kh(E);return n=b*Ph(R*_)-f,r=b*Ph((R+Lh)*_)-f,s=b*Ph((R+2*Lh)*_)-f,n>=0&&n<=1?r>=0&&r<=1?s>=0&&s<=1?Nh(n,r,s):Nh(n,r):s>=0&&s<=1?Nh(n,s):n:r>=0&&r<=1?s>=0&&s<=1?Nh(r,s):r:s}if(0===T)return r=-(i=y<0?kh(-y):-kh(y))-f,(n=2*i-f)>=0&&n<=1?r>=0&&r<=1?Nh(n,r):n:r;var C=Fh(T);return(i=kh(-y+C))-kh(y+C)-f}(t,e),n=t[1];return((1-i)*(n+(t[3]-n)*i)*3+i*i)*i}v.bezierByTime=Uh,t("cp",Mh),function(t){t[t.SLERP=0]="SLERP",t[t.CONSTANT=1]="CONSTANT"}(Mh||t("cp",Mh={}));var Gh=qs("cc.QuatKeyframeValue")(Ah=ha((Rh=function(t){var e=void 0===t?{}:t,i=e.value,n=e.interpolationMode,r=e.easingMethod;this.interpolationMode=bh&&bh(),this.value=Ch&&Ch(),this.easingMethod=wh&&wh(),this.value=i?En.clone(i):this.value,this.interpolationMode=null!=n?n:this.interpolationMode,this.easingMethod=null!=r?r:this.easingMethod},bh=Gs(Rh.prototype,"interpolationMode",[ra],(function(){return Mh.SLERP})),Ch=Gs(Rh.prototype,"value",[ra],(function(){return En.clone(En.IDENTITY)})),wh=Gs(Rh.prototype,"easingMethod",[ra],(function(){return jo.LINEAR})),Ah=Rh))||Ah)||Ah;function Hh(t){return new Gh(t)}var zh,Vh=t("co",qs("cc.QuatCurve")((Ih=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;ru){var c=r[o-1];switch(s){case Ls.LOOP:t=h+zi(t-h,u-h);break;case Ls.PING_PONG:t=h+Vi(t-h,u-h);break;case Ls.CLAMP:default:return En.copy(e,c.value)}}var _=Bs(n,t);if(_>=0)return En.copy(e,r[_].value);var d=~_,f=d-1,p=n[f],m=r[f],g=n[d],v=r[d],y=(t-p)/(g-p);switch(m.interpolationMode){default:case Mh.CONSTANT:return En.copy(e,m.value);case Mh.SLERP:var T=m.easingMethod,S=T===jo.LINEAR?y:Array.isArray(T)?Uh(T,y):Qo(T)(y);return En.slerp(e,m.value,v.value,S)}},i.addKeyFrame=function(e,i){var n=new Gh(i);return t.prototype.addKeyFrame.call(this,e,n)},i.assignSorted=function(t,e){if(void 0!==e)this.setKeyframes(t.slice(),e.map((function(t){return Hh(t)})));else{var i=Array.from(t);this.setKeyframes(i.map((function(t){return t[0]})),i.map((function(t){return Hh(t[1])})))}},i[Za]=function(t,e){if(e.toCCON){var i=this._times,n=this._values,r=!0;n.forEach((function(t,e,i){var n=i[0];r&&t.interpolationMode!==n.interpolationMode&&(r=!1)}));var s=i.length,a=qh*(r?1:s),o=n.reduce((function(t,e){var i=e.easingMethod;return t+(Array.isArray(i)?Qh+4*Jh:Qh)}),0),h=0,u=new DataView(new ArrayBuffer(h+=Xh+jh+Yh*s+4*Kh*s+o+a+0)),l=0,c=0;r&&(c|=zh.INTERPOLATION_MODE),u.setUint32(l,c,!0),l+=Xh,u.setUint32(l,s,!0),l+=jh,i.forEach((function(t,e){return u.setFloat32(l+Yh*e,t,!0)})),l+=Yh*s,n.forEach((function(t,e){var i=t.value,n=i.x,r=i.y,s=i.z,a=i.w,o=l+4*Kh*e;u.setFloat32(o+0*Kh,n,!0),u.setFloat32(o+1*Kh,r,!0),u.setFloat32(o+2*Kh,s,!0),u.setFloat32(o+3*Kh,a,!0)})),l+=4*Kh*s,n.forEach((function(t){var e=t.easingMethod;Array.isArray(e)?(u.setUint8(l,Zh),++l,u.setFloat32(l+0*Jh,e[0],!0),u.setFloat32(l+1*Jh,e[1],!0),u.setFloat32(l+2*Jh,e[2],!0),u.setFloat32(l+3*Jh,e[3],!0),l+=4*Jh):(u.setUint8(l,e),++l)}));var _=l;l+=a;var d=_;n.forEach((function(t){var e=t.interpolationMode;u.setUint8(d,e),r||(d+=qh)}));var f=new Uint8Array(u.buffer);t.writeProperty("bytes",f)}else t.writeThis()},i[Ja]=function(t,e){if(e.fromCCON){var i=t.readProperty("bytes"),n=new DataView(i.buffer,i.byteOffset,i.byteLength),r=0,s=n.getUint32(r,!0);r+=Xh;var a=s&zh.INTERPOLATION_MODE,o=n.getUint32(r,!0);r+=jh;var h=Array.from({length:o},(function(t,e){return n.getFloat32(r+Yh*e,!0)})),u=r+=Yh*o;r+=4*Kh*o;var l=Array.from({length:o},(function(t,e){var i=u+4*Kh*e,s=n.getFloat32(i+0*Kh,!0),a=n.getFloat32(i+1*Kh,!0),o=n.getFloat32(i+2*Kh,!0),h=n.getFloat32(i+3*Kh,!0),l=n.getUint8(r);++r;var c=Hh({value:{x:s,y:a,z:o,w:h}});return l!==Zh?c.easingMethod=l:(c.easingMethod=[n.getFloat32(r+0*Jh,!0),n.getFloat32(r+1*Jh,!0),n.getFloat32(r+2*Jh,!0),n.getFloat32(r+3*Jh,!0)],r+=4*Jh),c}));if(a){var c=n.getUint8(r);++r;for(var _=0;_=0)return this._values[e];var i=Ii(~e-1,0,this._values.length-1);return this._values[i]},e}(ks))||Wh),tu=ve({Blend:0,Fixed:1}),eu=t("cr",(function(){this.color=pn.WHITE.clone(),this.time=0}));gi.fastDefine("cc.ColorKey",eu,{color:pn.WHITE.clone(),time:0}),gi.Attr.setClassAttr(eu,"color","visible",!0),gi.Attr.setClassAttr(eu,"time","visible",!0);var iu=t("cs",(function(){this.alpha=1,this.time=0}));gi.fastDefine("cc.AlphaKey",iu,{alpha:1,time:0}),gi.Attr.setClassAttr(iu,"alpha","visible",!0),gi.Attr.setClassAttr(iu,"time","visible",!0);var nu=t("ct",function(){function t(){this.colorKeys=[],this.alphaKeys=[],this.mode=tu.Blend}var e=t.prototype;return e.setKeys=function(t,e){this.colorKeys=t,this.alphaKeys=e},e.sortKeys=function(){this.colorKeys.length>1&&this.colorKeys.sort((function(t,e){return t.time-e.time})),this.alphaKeys.length>1&&this.alphaKeys.sort((function(t,e){return t.time-e.time}))},e.evaluate=function(t){return this.evaluateFast(new pn,t)},e.evaluateFast=function(t,e){return this.getRGB(t,e),t._set_a_unsafe(this.getAlpha(e)),t},e.randomColor=function(){return this.getRandomColor(new pn)},e.getRandomColor=function(t){var e=this.colorKeys[Math.trunc(Bi()*this.colorKeys.length)],i=this.alphaKeys[Math.trunc(Bi()*this.alphaKeys.length)];return t.set(e.color),t._set_a_unsafe(i.alpha),t},e.getRGB=function(t,e){var i=this.colorKeys,n=i.length;if(n>1){e=zi(e,1+Ci);for(var r=1;r=s&&ei[h].time&&pn.lerp(t,i[h].color,pn.BLACK,(e-i[h].time)/(1-i[h].time))}else 1===n?pn.copy(t,i[0].color):pn.copy(t,pn.WHITE);return t},e.getAlpha=function(t){var e=this.alphaKeys,i=e.length;if(i>1){t=zi(t,1+Ci);for(var n=1;n=r&&te[o].time?Di(e[o].alpha,0,(t-e[o].time)/(1-e[o].time)):255}return 1===i?e[0].alpha:255},t}());nu.Mode=tu,gi.fastDefine("cc.Gradient",nu,{colorKeys:[],alphaKeys:[],mode:tu.Blend}),gi.Attr.setClassAttr(nu,"colorKeys","visible",!0),gi.Attr.setClassAttr(nu,"alphaKeys","visible",!0),gi.Attr.setClassAttr(nu,"mode","visible",!0);var ru=function(){this.time=0,this.value=0,this.inTangent=0,this.outTangent=0};gi.fastDefine("cc.Keyframe",ru,{time:0,value:0,inTangent:0,outTangent:0});var su=function(){function t(){this.index=void 0,this.time=void 0,this.endTime=void 0,this.coefficient=void 0,this.index=-1,this.time=0,this.endTime=0,this.coefficient=new Float32Array(4)}return t.prototype.evaluate=function(t){return au(t-this.time,this.coefficient)},t}();function au(t,e){return t*(t*(t*e[0]+e[1])+e[2])+e[3]}var ou,hu,uu=function(){function t(t){if(void 0===t&&(t=null),this._curve=void 0,this.cachedKey=void 0,t instanceof rh)this._curve=t;else{var e=new rh;this._curve=e,e.preExtrapolation=Ls.LOOP,e.postExtrapolation=Ls.CLAMP,t?e.assignSorted(t.map((function(t){return[t.time,{interpolationMode:Ns.CUBIC,value:t.value,leftTangent:t.inTangent,rightTangent:t.outTangent}]}))):e.assignSorted([[0,{interpolationMode:Ns.CUBIC,value:1}],[1,{interpolationMode:Ns.CUBIC,value:1}]])}this.cachedKey=new su}var e=t.prototype;return e.addKey=function(t){t?this._curve.addKeyFrame(t.time,{interpolationMode:Ns.CUBIC,value:t.value,leftTangent:t.inTangent,rightTangent:t.outTangent}):this._curve.clear()},e.evaluate_slow=function(t){return this._curve.evaluate(t)},e.evaluate=function(t){var e=this.cachedKey,i=this._curve,n=i.keyFramesCount-1,r=t,s=t<0?i.preExtrapolation:i.postExtrapolation,a=i.getKeyframeTime(0),o=i.getKeyframeTime(n);switch(s){case Ls.LOOP:r=zi(t-a,o-a)+a;break;case Ls.PING_PONG:r=Vi(t-a,o-a)+a;break;case Ls.CLAMP:default:r=Ii(t,a,o)}if(r>=e.time&&ri.getKeyframeTime(r))for(var s=0;s<3;s++){var a=r+s;if(a+1e)return a}else for(var o=0;o<3;o++){var h=r-o;if(h>=0&&i.getKeyframeTime(h-1)<=e)return h-1}for(var u,l=0,c=n;c-l>1;)u=Math.floor((l+c)/2),i.getKeyframeTime(u)>=e?c=u:l=u;return l},n(t,[{key:"_internalCurve",get:function(){return this._curve}},{key:"keyFrames",get:function(){return Array.from(this._curve.keyframes()).map((function(t){var e=t[0],i=t[1],n=new ru;return n.time=e,n.value=i.value,n.inTangent=i.leftTangent,n.outTangent=i.rightTangent,n}))},set:function(t){this._curve.assignSorted(t.map((function(t){return[t.time,{interpolationMode:Ns.CUBIC,value:t.value,leftTangent:t.inTangent,rightTangent:t.outTangent}]})))}},{key:"preWrapMode",get:function(){return cu(this._curve.preExtrapolation)},set:function(t){this._curve.preExtrapolation=lu(t)}},{key:"postWrapMode",get:function(){return cu(this._curve.postExtrapolation)},set:function(t){this._curve.postExtrapolation=lu(t)}}]),t}();function lu(t){switch(t){default:case ou.Default:case ou.Normal:case ou.Clamp:return Ls.CLAMP;case ou.PingPong:return Ls.PING_PONG;case ou.Loop:return Ls.LOOP}}function cu(t){switch(t){default:case Ls.LINEAR:case Ls.CLAMP:return ou.Clamp;case Ls.PING_PONG:return ou.PingPong;case Ls.LOOP:return ou.Loop}}function _u(){var t=new rh;return t.assignSorted([[0,{interpolationMode:Ns.CUBIC,value:1}],[1,{interpolationMode:Ns.CUBIC,value:1}]]),t}uu.defaultKF=[{time:0,value:1,inTangent:0,outTangent:0},{time:1,value:1,inTangent:0,outTangent:0}],gi.fastDefine("cc.AnimationCurve",uu,{_curve:null}),function(t){t[t.Default=0]="Default",t[t.Normal=1]="Normal",t[t.Loop=2]="Loop",t[t.ShouldWrap=4]="ShouldWrap",t[t.Clamp=8]="Clamp",t[t.PingPong=22]="PingPong",t[t.Reverse=36]="Reverse"}(ou||(ou={})),function(t){t[t.LINEAR=0]="LINEAR",t[t.BEZIER=1]="BEZIER",t[t.CATMULL_ROM=2]="CATMULL_ROM"}(hu||(hu={}));var du,fu=4294967295,pu=new hn,mu=new hn,gu=new hn,vu=new hn,yu=function(){function t(t,e){void 0===t&&(t=hu.CATMULL_ROM),void 0===e&&(e=[]),this._type=void 0,this._mode=hu.CATMULL_ROM,this._knots=[],this._type=ar.SHAPE_SPLINE,this._mode=t;for(var i=0;i=this._knots.length?this._knots.push(i):this._knots.splice(t,0,i)},e.removeKnot=function(t){t>=0&&this._knots.length,this._knots.splice(t,1)},e.setKnot=function(t,e){t>=0&&this._knots.length,this._knots[t].set(e)},e.getKnot=function(t){return t>=0&&this._knots.length,this._knots[t]},e.getPoint=function(e,i){void 0===i&&(i=fu),e=Ii(e,0,1);var n=this.getSegments();if(0===n)return new hn(0,0,0);if(i===fu){var r=1/n;i=Math.floor(e/r),e=e%r/r}if(i>=n)return new hn(this._knots[this._knots.length-1]);switch(this._mode){case hu.LINEAR:return t.calcLinear(this._knots[i],this._knots[i+1],e);case hu.BEZIER:return t.calcBezier(this._knots[4*i],this._knots[4*i+1],this._knots[4*i+2],this._knots[4*i+3],e);case hu.CATMULL_ROM:var s=i>0?this._knots[i-1]:this._knots[i],a=i+2this.shrinkTimeSpan&&(this.tryShrink(),this._lastShrinkPassed-=this.shrinkTimeSpan)},t}()),Pu=t("bt",function(t){function e(e,i,n){var r;(r=t.call(this)||this)._ctor=void 0,r._elementsPerBatch=void 0,r._nextAvail=void 0,r._freePool=[],r._dtor=void 0,r._ctor=e,r._dtor=n||null,r._elementsPerBatch=Math.max(i,1),r._nextAvail=r._elementsPerBatch-1;for(var s=0;s>1>this._elementsPerBatch){if(this._dtor)for(var t=this._nextAvail>>1;t<=this._nextAvail;t++)this._dtor(this._freePool[t]);this._freePool.length=this._nextAvail>>1,this._nextAvail=this._freePool.length-1}},i.destroy=function(){var e=arguments.length>0?arguments[0]:null;e&&q(14100);var i=e||this._dtor;if(i)for(var n=0;n<=this._nextAvail;n++)i(this._freePool[n]);this._freePool.length=0,this._nextAvail=-1,t.prototype.destroy.call(this)},e}(Du)),Bu=t("bu",function(t){function e(e,i,n){var r;(r=t.call(this)||this)._fn=void 0,r._dtor=null,r._count=0,r._data=void 0,r._initSize=0,r._fn=e,r._dtor=n||null,r._data=new Array(i),r._initSize=i;for(var s=0;sthis._data.length)for(var e=this._data.length;e=this._data.length&&this.resize(this._data.length<<1),this._data[this._count++]},i.destroy=function(){if(this._dtor)for(var e=0;e>2>this._count){var t=Math.max(this._initSize,this._data.length>>1);if(this._dtor)for(var e=t;e=this._count)){var e=this._count-1,i=this._data[t];this._data[t]=this._data[e],this._data[e]=i,this._count-=1}},n(e,[{key:"length",get:function(){return this._count}},{key:"data",get:function(){return this._data}}]),e}(Du)),Nu=t("bv",function(t){function e(e,i){var n;return(n=t.call(this)||this).array=void 0,n.length=0,n._compareFn=void 0,n._initSize=0,n.array=new Array(e),n._initSize=e,n.length=0,n._compareFn=i,n}s(e,t);var i=e.prototype;return i.push=function(t){this.array[this.length++]=t},i.pop=function(){return this.array[--this.length]},i.get=function(t){return this.array[t]},i.clear=function(){this.length=0},i.destroy=function(){this.length=0,this.array.length=0,t.prototype.destroy.call(this)},i.tryShrink=function(){this.array.length>>2>this.length&&(this.array.length=Math.max(this._initSize,this.array.length>>1))},i.sort=function(){this.array.length=this.length,this.array.sort(this._compareFn)},i.concat=function(t){for(var e=0;e=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;ee.priority?-1:0};var e=t.prototype;return e.init=function(){},e.update=function(){},e.postUpdate=function(){},e.destroy=function(){},n(t,[{key:"priority",get:function(){return this._priority},set:function(t){this._priority=t}},{key:"id",get:function(){return this._id},set:function(t){this._id=t}}]),t}());Lu.Priority=ve({LOW:0,MEDIUM:100,HIGH:200,SCHEDULER:1<<31>>>0});var Fu=new vt("Scheduler"),ku=function(){function t(t,e,i,n){this.target=void 0,this.priority=void 0,this.paused=void 0,this.markedForDeletion=void 0,this.target=t,this.priority=e,this.paused=i,this.markedForDeletion=n}return t.get=function(e,i,n,r){var s=t._listEntries.pop();return s?(s.target=e,s.priority=i,s.paused=n,s.markedForDeletion=r):s=new t(e,i,n,r),s},t.put=function(e){t._listEntries.length<20&&(e.target=null,t._listEntries.push(e))},t}();ku._listEntries=[];var Uu=function(){function t(t,e,i,n){this.list=void 0,this.entry=void 0,this.target=void 0,this.callback=void 0,this.list=t,this.entry=e,this.target=i,this.callback=n}return t.get=function(e,i,n,r){var s=t._hashUpdateEntries.pop();return s?(s.list=e,s.entry=i,s.target=n,s.callback=r):s=new t(e,i,n,r),s},t.put=function(e){t._hashUpdateEntries.length<20&&(e.list=e.entry=e.target=e.callback=null,t._hashUpdateEntries.push(e))},t}();Uu._hashUpdateEntries=[];var Gu=function(){function t(t,e,i,n,r,s){this.timers=void 0,this.target=void 0,this.timerIndex=void 0,this.currentTimer=void 0,this.currentTimerSalvaged=void 0,this.paused=void 0,this.timers=t,this.target=e,this.timerIndex=i,this.currentTimer=n,this.currentTimerSalvaged=r,this.paused=s}return t.get=function(e,i,n,r,s,a){var o=t._hashTimerEntries.pop();return o?(o.timers=e,o.target=i,o.timerIndex=n,o.currentTimer=r,o.currentTimerSalvaged=s,o.paused=a):o=new t(e,i,n,r,s,a),o},t.put=function(e){t._hashTimerEntries.length<20&&(e.timers=e.target=e.currentTimer=null,t._hashTimerEntries.push(e))},t}();Gu._hashTimerEntries=[];var Hu=function(){function t(){this._lock=void 0,this._scheduler=void 0,this._elapsed=void 0,this._runForever=void 0,this._useDelay=void 0,this._timesExecuted=void 0,this._repeat=void 0,this._delay=void 0,this._interval=void 0,this._target=void 0,this._callback=void 0,this._lock=!1,this._scheduler=null,this._elapsed=-1,this._runForever=!1,this._useDelay=!1,this._timesExecuted=0,this._repeat=0,this._delay=0,this._interval=0,this._target=null}t.get=function(){return t._timers.pop()||new t},t.put=function(e){t._timers.length<20&&!e._lock&&(e._scheduler=e._target=e._callback=null,t._timers.push(e))};var e=t.prototype;return e.initWithCallback=function(t,e,i,n,r,s){return this._lock=!1,this._scheduler=t,this._target=i,this._callback=e,this._elapsed=-1,this._interval=n,this._delay=s,this._useDelay=this._delay>0,this._repeat=r,this._runForever=this._repeat===v.macro.REPEAT_FOREVER,!0},e.getInterval=function(){return this._interval},e.setInterval=function(t){this._interval=t},e.update=function(t){-1===this._elapsed?(this._elapsed=0,this._timesExecuted=0):(this._elapsed+=t,this._runForever&&!this._useDelay?this._elapsed>=this._interval&&(this.trigger(),this._elapsed=0):(this._useDelay?this._elapsed>=this._delay&&(this.trigger(),this._elapsed-=this._delay,this._timesExecuted+=1,this._useDelay=!1):this._elapsed>=this._interval&&(this.trigger(),this._elapsed=0,this._timesExecuted+=1),this._callback&&!this._runForever&&this._timesExecuted>this._repeat&&this.cancel()))},e.getCallback=function(){return this._callback},e.trigger=function(){this._target&&this._callback&&(this._lock=!0,this._callback.call(this._target,this._elapsed),this._lock=!1)},e.cancel=function(){this._scheduler&&this._callback&&this._target&&this._scheduler.unschedule(this._callback,this._target)},t}();Hu._timers=[];var zu=t("cj",function(t){function e(){var e;return(e=t.call(this)||this)._timeScale=void 0,e._updatesNegList=void 0,e._updates0List=void 0,e._updatesPosList=void 0,e._hashForUpdates=void 0,e._hashForTimers=void 0,e._currentTarget=void 0,e._currentTargetSalvaged=void 0,e._updateHashLocked=void 0,e._arrayForTimers=void 0,e._timeScale=1,e._updatesNegList=[],e._updates0List=[],e._updatesPosList=[],e._hashForUpdates=Ot(!0),e._hashForTimers=Ot(!0),e._currentTarget=null,e._currentTargetSalvaged=!1,e._updateHashLocked=!1,e._arrayForTimers=[],e}s(e,t),e.enableForTarget=function(t){var e=!1;(t.uuid||t.id)&&(e=!0),e||(t.id=Fu.getNewId())};var i=e.prototype;return i.setTimeScale=function(t){this._timeScale=t},i.getTimeScale=function(){return this._timeScale},i.update=function(t){var e,i,n,r,s;for(this._updateHashLocked=!0,1!==this._timeScale&&(t*=this._timeScale),e=0,n=(i=this._updatesNegList).length;e=s&&n.timerIndex--,void(0===r.length&&(this._currentTarget===n?this._currentTargetSalvaged=!0:this._removeHashElement(n)))}}}else Z(1510)}},i.unscheduleUpdate=function(t){if(t){var e=t.uuid||t.id;if(e){var i=this._hashForUpdates[e];null!=i&&i.entry&&(this._updateHashLocked?i.entry.markedForDeletion=!0:this._removeUpdateFromHash(i.entry))}else Z(1510)}},i.unscheduleAllForTarget=function(t){if(t){var e=t.uuid||t.id;if(e){var i=this._hashForTimers[e];if(null!=i&&i.timers){var n=i.timers;i.currentTimer&&n.indexOf(i.currentTimer)>-1&&!i.currentTimerSalvaged&&(i.currentTimerSalvaged=!0);for(var r=0,s=n.length;r=0;e--)(i=r[e]).target&&this.unscheduleAllForTarget(i.target);var s=0;if(t<0)for(e=0;e=t&&this.unscheduleUpdate(n.target),s===this._updatesNegList.length&&e++}if(t<=0)for(e=0;e=t&&this.unscheduleUpdate(n.target),s===this._updatesPosList.length&&e++}},i.isScheduled=function(t,e){tt(Boolean(t),1508),tt(Boolean(e),1509);var i=e.uuid||e.id;if(!i)return Z(1510),!1;var n=this._hashForTimers[i];if(!n)return!1;if(null==n.timers)return!1;for(var r=n.timers,s=0;s=t&&(r.paused=!0,s.push(r.target))}if(t<=0)for(i=0;i=t&&(r.paused=!0,s.push(r.target))}return s},i.resumeTargets=function(t){if(t)for(var e=0;e=0;--t)this.callbackInfos[t]||Wu(this.callbackInfos,t);this.containCanceled=!1},e.clear=function(){this.cancelAll(),this.callbackInfos.length=0,this.isInvoking=!1,this.containCanceled=!1},t}(),qu=new Pu((function(){return new Ku}),16),Qu=t("cY",function(){function t(){this._callbackTable=Ot(!0),this._offCallback=void 0}var e=t.prototype;return e.on=function(t,e,i,n){if(!this.hasEventListener(t,e,i)){var r=this._callbackTable[t];r||(r=this._callbackTable[t]=qu.alloc());var s=Yu.alloc();s.set(e,i,n),r.callbackInfos.push(s)}return e},e.hasEventListener=function(t,e,i){var n=this._callbackTable&&this._callbackTable[t];if(!n)return!1;var r=n.callbackInfos;if(!e){if(n.isInvoking){for(var s=0;s0}for(var a=0;a1)&&(l=!0,c="",_=0);var f=il.UNKNOWN;-1!==a.appVersion.indexOf("Win")?f=il.WINDOWS:l?f=il.IOS:-1!==a.appVersion.indexOf("Mac")?f=il.OSX:-1!==a.appVersion.indexOf("X11")&&-1===a.appVersion.indexOf("Linux")?f=il.LINUX:u?f=il.ANDROID:-1===a.appVersion.indexOf("Linux")&&-1===o.indexOf("ubuntu")||(f=il.LINUX),r.os=f,r.osVersion=c,r.osMainVersion=_,r.browserType=$u.UNKNOWN;var p=/wechat|weixin|micromessenger/i.exec(o)||/mqqbrowser|micromessenger|qqbrowser|sogou|qzone|liebao|maxthon|ucbs|360 aphone|360browser|baiduboxapp|baidubrowser|maxthon|mxbrowser|miuibrowser/i.exec(o)||/qq|qqbrowser|ucbrowser|ubrowser|edge|HuaweiBrowser/i.exec(o)||/chrome|safari|firefox|trident|opera|opr\/|oupeng/i.exec(o),g=p?p[0].toLowerCase():il.UNKNOWN;("safari"===g&&u||"qq"===g&&/android.*applewebkit/i.test(o))&&(g=$u.ANDROID);var v={micromessenger:$u.WECHAT,wechat:$u.WECHAT,weixin:$u.WECHAT,trident:$u.IE,edge:$u.EDGE,"360 aphone":$u.BROWSER_360,mxbrowser:$u.MAXTHON,"opr/":$u.OPERA,ubrowser:$u.UC,huaweibrowser:$u.HUAWEI};r.browserType=v[g]||g,r.browserVersion="";var y=/(mqqbrowser|micromessenger|qqbrowser|sogou|qzone|liebao|maxthon|uc|ucbs|360 aphone|360|baiduboxapp|baidu|maxthon|mxbrowser|miui(?:.hybrid)?)(mobile)?(browser)?\/?([\d.]+)/i.exec(o);y||(y=/(qq|chrome|safari|firefox|trident|opera|opr\/|oupeng)(mobile)?(browser)?\/?([\d.]+)/i.exec(o)),r.browserVersion=y?y[4]:"",r.isXR=!1;var T,S=document.createElement("canvas");S.getContext("2d");try{T=S.toDataURL("image/webp").startsWith("data:image/webp")}catch(t){T=!1}if(r.browserType===$u.SAFARI){var E,A=null===(E=/ version\/(\d+)/.exec(o))||void 0===E?void 0:E[1];"string"==typeof A&&Number.parseInt(A)>=14&&(T=!0)}var R=void 0!==document.documentElement.ontouchstart||void 0!==document.ontouchstart||m,b=void 0!==document.documentElement.onmouseup||m,C=void 0!==navigator.xr,w=function(){if((r.os===il.IOS||r.os===il.OSX)&&/(OS 15_4)|(Version\/15.4)/.test(window.navigator.userAgent))return!1;try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){var t=new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0]));if(t instanceof WebAssembly.Module)return new WebAssembly.Instance(t)instanceof WebAssembly.Instance}}catch(t){return!1}return!1}();return r._featureMap=((n={})[rl.WEBP]=T,n[rl.IMAGE_BITMAP]=!1,n[rl.WEB_VIEW]=!0,n[rl.VIDEO_PLAYER]=!0,n[rl.SAFE_AREA]=!1,n[rl.HPE]=!1,n[rl.INPUT_TOUCH]=R,n[rl.EVENT_KEYBOARD]=void 0!==document.documentElement.onkeyup||m,n[rl.EVENT_MOUSE]=b,n[rl.EVENT_TOUCH]=R||b,n[rl.EVENT_ACCELEROMETER]=void 0!==window.DeviceMotionEvent||void 0!==window.DeviceOrientationEvent,n[rl.EVENT_GAMEPAD]=void 0!==navigator.getGamepads||void 0!==navigator.webkitGetGamepads||C,n[rl.EVENT_HANDLE]=false,n[rl.EVENT_HMD]=C,n[rl.EVENT_HANDHELD]=C,n[rl.WASM]=w,n),r._initPromise=[],r._initPromise.push(r._supportsImageBitmapPromise()),r._registerEvent(),r}s(e,t);var i=e.prototype;return i._supportsImageBitmapPromise=function(){var t=this;if("undefined"!=typeof createImageBitmap&&"undefined"!=typeof Blob){var e=document.createElement("canvas");e.width=e.height=2;var i=createImageBitmap(e,{});if(i instanceof Promise)return i.then((function(e){t._setFeature(rl.IMAGE_BITMAP,!0),null==e||e.close()}))}return Promise.resolve()},i._registerEvent=function(){var t,e=this;t=void 0!==document.hidden?"hidden":void 0!==document.mozHidden?"mozHidden":void 0!==document.msHidden?"msHidden":void 0!==document.webkitHidden?"webkitHidden":"hidden";var i=!1,n=function(){i||(i=!0,e.emit("hide"))},r=function(t,n,r,s,a){i&&(i=!1,e.emit("show",t,n,r,s,a))};if(t)for(var s=["visibilitychange","mozvisibilitychange","msvisibilitychange","webkitvisibilitychange","qbrowserVisibilityChange"],a=0;a-1&&(window.onfocus=r),"onpageshow"in window&&"onpagehide"in window&&(window.addEventListener("pagehide",n),window.addEventListener("pageshow",r),document.addEventListener("pagehide",n),document.addEventListener("pageshow",r))},i._setFeature=function(t,e){return this._featureMap[t]=e},i.init=function(){return Promise.all(this._initPromise)},i.hasFeature=function(t){return this._featureMap[t]},i.getBatteryLevel=function(){return this._battery?this._battery.level:1},i.triggerGC=function(){},i.openURL=function(t){window.open(t)},i.now=function(){return Date.now?Date.now():+new Date},i.restartJSVM=function(){},i.exit=function(){window.close()},i.close=function(){this.emit("close")},e}(Ju)),ol=/(\.[^\.\/\?\\]*)(\?.*)?$/,hl=/((.*)(\/|\\|\\\\))?(.*?\..*$)?/,ul=/[^\.\/]+\/\.\.\//;function ll(){for(var t="",e=arguments.length,i=new Array(e),n=0;n0&&(t=t.substring(0,i));var n=/(\/|\\)([^\/\\]+)$/g.exec(t.replace(/(\/|\\)$/,""));if(!n)return t;var r=n[2];return e&&t.substring(t.length-e.length).toLowerCase()===e.toLowerCase()?r.substring(0,r.length-e.length):r}function fl(t){var e=hl.exec(t);return e?e[2]:""}function pl(t,e){e=e||"";var i=t.indexOf("?"),n="";return i>0&&(n=t.substring(i),t=t.substring(0,i)),(i=t.lastIndexOf("."))<0?t+e+n:t.substring(0,i)+e+n}function ml(t,e,i){if(0===e.indexOf("."))return pl(t,e);var n=t.indexOf("?"),r="",s=i?cl(t):"";return n>0&&(r=t.substring(n),t=t.substring(0,n)),n=(n=t.lastIndexOf("/"))<=0?0:n+1,t.substring(0,n)+e+s+r}function gl(t){var e=t=String(t);do{e=t,t=t.replace(ul,"")}while(e.length!==t.length);return t}function vl(t){return t.replace(/[\/\\]$/,"")}function yl(){return al.os===il.WINDOWS?"\\":"/"}t("bC",Object.freeze({__proto__:null,join:ll,extname:cl,mainFileName:_l,basename:dl,dirname:fl,changeExtname:pl,changeBasename:ml,_normalize:gl,stripSep:vl,getSeperator:yl}));var Tl=new hn;function Sl(t,e,i,n){n||(n=new hn),t.convertToUINode(e,i,n);var r=i.position;return n.add(r),n}function El(t,e,i){return i||(i=new hn),t.worldToScreen(e,i),i.x/=v.view.getScaleX(),i.y/=v.view.getScaleY(),i}var Al,Rl=t("bM",{WorldNode3DToLocalNodeUI:Sl,WorldNode3DToWorldNodeUI:El});v.pipelineUtils=Rl,rt(v.pipelineUtils,"cc.pipelineUtils",[{name:"WorldNode3DToLocalNodeUI",newName:"convertToUINode",targetName:"cc.Camera.prototype",customFunction:function(){for(var t=arguments.length,e=new Array(t),i=0;iwindow.innerHeight;this.isFrameRotated=al.isMobile&&(e&&t===Al.PORTRAIT||!e&&t===Al.LANDSCAPE)},i._updateContainer=function(){if(this._gameContainer){if(this.isProportionalToFrame){if(!this._gameFrame)return void q(9201);var t,e,i=v.view.getDesignResolutionSize(),n=this._gameFrame,r=n.clientWidth,s=n.clientHeight,a=i.width,o=i.height,h=r/a,u=s/o,l=this._gameContainer.style;h0&&q(1400,"screen.requestFullScreen(element, onFullScreenChange?, onFullScreenError?)","screen.requestFullScreen(): Promise"),wl.requestFullScreen().then((function(){null==e||e.call(document)})).catch((function(t){G(t),null==i||i.call(document)}))},e.exitFullScreen=function(){return wl.exitFullScreen()},e.autoFullScreen=function(t,e){var i;null===(i=this.requestFullScreen(t,e))||void 0===i||i.catch((function(t){U(t)}))},e.disableAutoFullScreen=function(){},e.on=function(t,e,i){wl.on(t,e,i)},e.once=function(t,e,i){wl.once(t,e,i)},e.off=function(t,e,i){wl.off(t,e,i)},n(t,[{key:"devicePixelRatio",get:function(){return wl.devicePixelRatio}},{key:"windowSize",get:function(){return wl.windowSize},set:function(t){wl.windowSize=t}},{key:"resolution",get:function(){return wl.resolution}},{key:"supportsFullScreen",get:function(){return wl.supportFullScreen}}]),t}(),Il=t("cf",new xl);v.screen=Il;var Ol=t("cg",{Feature:rl,hasFeature:function(t){return al.hasFeature(t)},NetworkType:el,Language:tl,OS:il,Platform:nl,BrowserType:$u,isNative:al.isNative,isBrowser:al.isBrowser,isMobile:al.isMobile,isLittleEndian:al.isLittleEndian,platform:al.platform,language:al.language,languageCode:al.nativeLanguage,os:al.os,osVersion:al.osVersion,osMainVersion:al.osMainVersion,browserType:al.browserType,browserVersion:al.browserVersion,isXR:al.isXR,windowPixelResolution:Il.windowSize,capabilities:{canvas:!0,opengl:!0,webp:al.hasFeature(rl.WEBP),imageBitmap:al.hasFeature(rl.IMAGE_BITMAP),touches:al.hasFeature(rl.INPUT_TOUCH),mouse:al.hasFeature(rl.EVENT_MOUSE),keyboard:al.hasFeature(rl.EVENT_KEYBOARD),accelerometer:al.hasFeature(rl.EVENT_ACCELEROMETER)},localStorage:{},getNetworkType:function(){return al.networkType},getBatteryLevel:function(){return al.getBatteryLevel()},garbageCollect:function(){al.triggerGC()},isObjectValid:function(t){return null!=t},__isWebIOS14OrIPadOS14Env:!1,dump:function(){var t="";t+="isMobile : "+this.isMobile+"\r\n",t+="language : "+this.language+"\r\n",t+="browserType : "+this.browserType+"\r\n",t+="browserVersion : "+this.browserVersion+"\r\n",t+="supports webp: "+Ol.hasFeature(rl.WEBP)+"\r\n",t+="supports bitmap: "+Ol.hasFeature(rl.IMAGE_BITMAP)+"\r\n",t+="supports touches: "+Ol.hasFeature(rl.INPUT_TOUCH)+"\r\n",t+="supports mouse: "+Ol.hasFeature(rl.EVENT_MOUSE)+"\r\n",t+="supports keyboard: "+Ol.hasFeature(rl.EVENT_KEYBOARD)+"\r\n",t+="supports accelerometer: "+Ol.hasFeature(rl.EVENT_ACCELEROMETER)+"\r\n",t+="os : "+this.os+"\r\n",t+="osVersion : "+this.osVersion+"\r\n",t+="platform : "+this.platform+"\r\n",k(t+="Using "+(v.game.renderType===v.game.RENDER_TYPE_WEBGL?"WEBGL":"CANVAS")+" renderer.\r\n")},openURL:function(t){al.openURL(t)},init:function(){var t=this;return Promise.resolve().then((function(){return al.init()})).then((function(){try{var e=Ol.localStorage=window.localStorage;e.setItem("storage",""),e.removeItem("storage"),e=null}catch(e){var i=function(){q(5200)};t.localStorage={getItem:i,setItem:i,clear:i,removeItem:i,key:i,length:0}}t.__isWebIOS14OrIPadOS14Env=(Ol.os===il.IOS||Ol.os===il.OSX)&&al.isBrowser&&/(OS 14)|(Version\/14)/.test(window.navigator.userAgent)}))},now:function(){return al.now()},restartVM:function(){al.restartJSVM()},getSafeAreaRect:function(){var t=v.view,e=wl.safeAreaEdge,i=wl.windowSize,n=new Fn(e.left,e.bottom),r=new Fn(i.width-e.right,i.height-e.top);t._convertToUISpace(n),t._convertToUISpace(r);var s=n.x,a=n.y,o=r.x-n.x,h=r.y-n.y;return new Vn(s,a,o,h)}});v.sys=Ol,at(v,"cc",[{name:"winSize",suggest:"please use view.getVisibleSize() instead."}]),at(Ol,"sys",[{name:"capabilities",suggest:"please use sys.hasFeature() method instead."}]),rt(Ol,"sys",["UNKNOWN","ENGLISH","CHINESE","FRENCH","ITALIAN","GERMAN","SPANISH","DUTCH","RUSSIAN","KOREAN","JAPANESE","HUNGARIAN","PORTUGUESE","ARABIC","NORWEGIAN","POLISH","TURKISH","UKRAINIAN","ROMANIAN","BULGARIAN"].map((function(t){return{name:"LANGUAGE_"+t,newName:t,target:Ol.Language,targetName:"sys.Language"}}))),rt(Ol,"sys",["UNKNOWN","IOS","ANDROID","WINDOWS","LINUX","OSX"].map((function(t){return{name:"OS_"+t,newName:t,target:Ol.OS,targetName:"sys.OS"}}))),rt(Ol,"sys",["UNKNOWN","WECHAT","ANDROID","IE","EDGE","QQ","MOBILE_QQ","UC","UCBS","BAIDU_APP","BAIDU","MAXTHON","OPERA","OUPENG","MIUI","FIREFOX","SAFARI","CHROME","LIEBAO","QZONE","SOUGOU","HUAWEI"].map((function(t){return{name:"BROWSER_TYPE_"+t,newName:t,target:Ol.BrowserType,targetName:"sys.BrowserType"}}))),rt(Ol,"sys",[{name:"BROWSER_TYPE_360",newName:"BROWSER_360",target:Ol.BrowserType,targetName:"sys.BrowserType"}]),rt(Ol,"sys",["UNKNOWN","EDITOR_PAGE","EDITOR_CORE","MOBILE_BROWSER","DESKTOP_BROWSER","WIN32","MACOS","IOS","ANDROID","OHOS","WECHAT_GAME","BAIDU_MINI_GAME","XIAOMI_QUICK_GAME","ALIPAY_MINI_GAME","BYTEDANCE_MINI_GAME","OPPO_MINI_GAME","VIVO_MINI_GAME","HUAWEI_QUICK_GAME","COCOSPLAY","LINKSURE_MINI_GAME","QTT_MINI_GAME"].map((function(t){return{name:t,target:Ol.Platform,targetName:"sys.Platform"}}))),rt(Ol,"sys",[{name:"IPHONE",newName:"IOS",target:Ol.Platform,targetName:"sys.Platform"},{name:"IPAD",newName:"IOS",target:Ol.Platform,targetName:"sys.Platform"}]),st(Ol,"sys",["LINUX","BLACKBERRY","NACL","EMSCRIPTEN","TIZEN","WINRT","WP8","QQ_PLAY","FB_PLAYABLE_ADS"].map((function(t){return{name:t}}))),rt(Ol,"sys",[{name:"windowPixelResolution",target:Il,targetName:"screen",newName:"windowSize"}]),at(Il,"screen",[{name:"autoFullScreen",suggest:"please use screen.requestFullScreen() instead."},{name:"disableAutoFullScreen"}]);var Dl=t("ci",{topLeft:v.v2(0,0),topRight:v.v2(0,0),top:v.v2(0,0),bottomLeft:v.v2(0,0),bottomRight:v.v2(0,0),bottom:v.v2(0,0),center:v.v2(0,0),left:v.v2(0,0),right:v.v2(0,0),width:0,height:0,init:function(t){var e=this.width=t.width,i=this.height=t.height,n=t.x,r=t.y,s=r+i,a=n+e;this.topLeft.x=n,this.topLeft.y=s,this.topRight.x=a,this.topRight.y=s,this.top.x=n+e/2,this.top.y=s,this.bottomLeft.x=n,this.bottomLeft.y=r,this.bottomRight.x=a,this.bottomRight.y=r,this.bottom.x=n+e/2,this.bottom.y=r,this.center.x=n+e/2,this.center.y=r+i/2,this.left.x=n,this.left.y=r+i/2,this.right.x=a,this.right.y=r+i/2}});v.visibleRect=Dl;var Ml=String.prototype.charCodeAt;function Pl(t){return this[t]}function Bl(t,e){for(var i=t.length,n=e^i,r=0,s="string"==typeof t?Ml:Pl;i>=4;){var a=255&s.call(t,r)|(255&s.call(t,++r))<<8|(255&s.call(t,++r))<<16|(255&s.call(t,++r))<<24;a=1540483477*(65535&a)+((1540483477*(a>>>16)&65535)<<16),n=1540483477*(65535&n)+((1540483477*(n>>>16)&65535)<<16)^(a=1540483477*(65535&(a^=a>>>24))+((1540483477*(a>>>16)&65535)<<16)),i-=4,++r}switch(i){case 3:n^=(255&s.call(t,r+2))<<16;case 2:n^=(255&s.call(t,r+1))<<8;case 1:n=1540483477*(65535&(n^=255&s.call(t,r)))+((1540483477*(n>>>16)&65535)<<16)}return n=1540483477*(65535&(n^=n>>>13))+((1540483477*(n>>>16)&65535)<<16),(n^=n>>>15)>>>0}function Nl(){}v.easing=Yo,Nl.prototype.once=function(t,e,i){return this.on(t,e,i,!0)},Nl.prototype.targetOff=function(t){this.removeAll(t)},t("cB",Object.freeze({__proto__:null,syncNodeValues:function(t){var e=t._lpos;t.setPositionForJS(e.x,e.y,e.z);var i=t._lscale;t.setScaleForJS(i.x,i.y,i.z);var n=t._lrot;t.setRotationForJS(n.x,n.y,n.z,n.w);var r=t._euler;t.setRotationFromEulerForJS(r.x,r.y,r.z)},updateChildrenForDeserialize:function t(e){if(e){var i=e.children;if(i){var n=i.length;if(n){e._setChildren(i);for(var r=0;r0&&0==(t&t-1)}function z_(t,e,i,n){if(!F_[t].isCompressed)return e*i*n*F_[t].size;switch(t){case jl.BC1:case jl.BC1_ALPHA:case jl.BC1_SRGB:case jl.BC1_SRGB_ALPHA:return Math.ceil(e/4)*Math.ceil(i/4)*8*n;case jl.BC2:case jl.BC2_SRGB:case jl.BC3:case jl.BC3_SRGB:case jl.BC4:case jl.BC4_SNORM:case jl.BC6H_SF16:case jl.BC6H_UF16:case jl.BC7:case jl.BC7_SRGB:return Math.ceil(e/4)*Math.ceil(i/4)*16*n;case jl.BC5:case jl.BC5_SNORM:return Math.ceil(e/4)*Math.ceil(i/4)*32*n;case jl.ETC_RGB8:case jl.ETC2_RGB8:case jl.ETC2_SRGB8:case jl.ETC2_RGB8_A1:case jl.EAC_R11:case jl.EAC_R11SN:return Math.ceil(e/4)*Math.ceil(i/4)*8*n;case jl.ETC2_RGBA8:case jl.ETC2_SRGB8_A1:case jl.EAC_RG11:case jl.EAC_RG11SN:return Math.ceil(e/4)*Math.ceil(i/4)*16*n;case jl.PVRTC_RGB2:case jl.PVRTC_RGBA2:case jl.PVRTC2_2BPP:return Math.ceil(e/8)*Math.ceil(i/4)*8*n;case jl.PVRTC_RGB4:case jl.PVRTC_RGBA4:case jl.PVRTC2_4BPP:return Math.ceil(e/4)*Math.ceil(i/4)*8*n;case jl.ASTC_RGBA_4X4:case jl.ASTC_SRGBA_4X4:return Math.ceil(e/4)*Math.ceil(i/4)*16*n;case jl.ASTC_RGBA_5X4:case jl.ASTC_SRGBA_5X4:return Math.ceil(e/5)*Math.ceil(i/4)*16*n;case jl.ASTC_RGBA_5X5:case jl.ASTC_SRGBA_5X5:return Math.ceil(e/5)*Math.ceil(i/5)*16*n;case jl.ASTC_RGBA_6X5:case jl.ASTC_SRGBA_6X5:return Math.ceil(e/6)*Math.ceil(i/5)*16*n;case jl.ASTC_RGBA_6X6:case jl.ASTC_SRGBA_6X6:return Math.ceil(e/6)*Math.ceil(i/6)*16*n;case jl.ASTC_RGBA_8X5:case jl.ASTC_SRGBA_8X5:return Math.ceil(e/8)*Math.ceil(i/5)*16*n;case jl.ASTC_RGBA_8X6:case jl.ASTC_SRGBA_8X6:return Math.ceil(e/8)*Math.ceil(i/6)*16*n;case jl.ASTC_RGBA_8X8:case jl.ASTC_SRGBA_8X8:return Math.ceil(e/8)*Math.ceil(i/8)*16*n;case jl.ASTC_RGBA_10X5:case jl.ASTC_SRGBA_10X5:return Math.ceil(e/10)*Math.ceil(i/5)*16*n;case jl.ASTC_RGBA_10X6:case jl.ASTC_SRGBA_10X6:return Math.ceil(e/10)*Math.ceil(i/6)*16*n;case jl.ASTC_RGBA_10X8:case jl.ASTC_SRGBA_10X8:return Math.ceil(e/10)*Math.ceil(i/8)*16*n;case jl.ASTC_RGBA_10X10:case jl.ASTC_SRGBA_10X10:return Math.ceil(e/10)*Math.ceil(i/10)*16*n;case jl.ASTC_RGBA_12X10:case jl.ASTC_SRGBA_12X10:return Math.ceil(e/12)*Math.ceil(i/10)*16*n;case jl.ASTC_RGBA_12X12:case jl.ASTC_SRGBA_12X12:return Math.ceil(e/12)*Math.ceil(i/12)*16*n;default:return 0}}function V_(t,e,i,n,r){for(var s=0,a=0;a>1,1),i=Math.max(i>>1,1);return s}var W_=[0,4,8,12,16,4,8,12,16,4,8,12,16,4,8,12,16,16,24,32,24,36,48,32,48,64,4,4,4,4,4,4];function X_(t){return W_[t]||0}function j_(t){if(t.isCompressed)return Uint8Array;var e=t.size/t.count;switch(t.type){case Yl.UNORM:case Yl.UINT:switch(e){case 1:return Uint8Array;case 2:return Uint16Array;case 4:return Uint32Array;default:return Uint8Array}case Yl.SNORM:case Yl.INT:switch(e){case 1:return Int8Array;case 2:return Int16Array;case 4:return Int32Array;default:return Int8Array}case Yl.FLOAT:switch(e){case 2:return Uint16Array;case 4:default:return Float32Array}}return Float32Array}function Y_(t){switch(t){case jl.BC1:case jl.BC1_ALPHA:case jl.BC1_SRGB:case jl.BC1_SRGB_ALPHA:case jl.BC2:case jl.BC2_SRGB:case jl.BC3:case jl.BC3_SRGB:case jl.BC4:case jl.BC4_SNORM:case jl.BC6H_SF16:case jl.BC6H_UF16:case jl.BC7:case jl.BC7_SRGB:case jl.BC5:case jl.BC5_SNORM:case jl.ETC_RGB8:case jl.ETC2_RGB8:case jl.ETC2_SRGB8:case jl.ETC2_RGB8_A1:case jl.EAC_R11:case jl.EAC_R11SN:case jl.ETC2_RGBA8:case jl.ETC2_SRGB8_A1:case jl.EAC_RG11:case jl.EAC_RG11SN:return{width:4,height:4};case jl.PVRTC_RGB2:case jl.PVRTC_RGBA2:case jl.PVRTC2_2BPP:return{width:8,height:4};case jl.PVRTC_RGB4:case jl.PVRTC_RGBA4:case jl.PVRTC2_4BPP:return{width:4,height:4};case jl.ASTC_RGBA_4X4:case jl.ASTC_SRGBA_4X4:return{width:4,height:4};case jl.ASTC_RGBA_5X4:case jl.ASTC_SRGBA_5X4:return{width:5,height:4};case jl.ASTC_RGBA_5X5:case jl.ASTC_SRGBA_5X5:return{width:5,height:5};case jl.ASTC_RGBA_6X5:case jl.ASTC_SRGBA_6X5:return{width:6,height:5};case jl.ASTC_RGBA_6X6:case jl.ASTC_SRGBA_6X6:return{width:6,height:6};case jl.ASTC_RGBA_8X5:case jl.ASTC_SRGBA_8X5:return{width:8,height:5};case jl.ASTC_RGBA_8X6:case jl.ASTC_SRGBA_8X6:return{width:8,height:6};case jl.ASTC_RGBA_8X8:case jl.ASTC_SRGBA_8X8:return{width:8,height:8};case jl.ASTC_RGBA_10X5:case jl.ASTC_SRGBA_10X5:return{width:10,height:5};case jl.ASTC_RGBA_10X6:case jl.ASTC_SRGBA_10X6:return{width:10,height:6};case jl.ASTC_RGBA_10X8:case jl.ASTC_SRGBA_10X8:return{width:10,height:8};case jl.ASTC_RGBA_10X10:case jl.ASTC_SRGBA_10X10:return{width:10,height:10};case jl.ASTC_RGBA_12X10:case jl.ASTC_SRGBA_12X10:return{width:12,height:10};case jl.ASTC_RGBA_12X12:case jl.ASTC_SRGBA_12X12:return{width:12,height:12};default:return{width:1,height:1}}}function K_(t,e){return Math.ceil(t/e)*e}var q_=Object.freeze({__proto__:null,get ObjectType(){return Hl},get Status(){return zl},get API(){return Vl},get SurfaceTransform(){return Wl},get Feature(){return Xl},get Format(){return jl},get FormatType(){return Yl},get Type(){return Kl},get BufferUsageBit(){return ql},get BufferFlagBit(){return Ql},get MemoryAccessBit(){return Zl},get MemoryUsageBit(){return Jl},get TextureType(){return $l},get TextureUsageBit(){return tc},get TextureFlagBit(){return ec},get FormatFeatureBit(){return ic},get SampleCount(){return nc},get VsyncMode(){return rc},get Filter(){return sc},get Address(){return ac},get ComparisonFunc(){return oc},get StencilOp(){return hc},get BlendFactor(){return uc},get BlendOp(){return lc},get ColorMask(){return cc},get ShaderStageFlagBit(){return _c},get LoadOp(){return dc},get StoreOp(){return fc},get AccessFlagBit(){return pc},get ResolveMode(){return mc},get PipelineBindPoint(){return gc},get PrimitiveMode(){return vc},get PolygonMode(){return yc},get ShadeModel(){return Tc},get CullMode(){return Sc},get DynamicStateFlagBit(){return Ec},get StencilFace(){return Ac},get DescriptorType(){return Rc},get QueueType(){return bc},get QueryType(){return Cc},get CommandBufferType(){return wc},get ClearFlagBit(){return xc},get BarrierType(){return Ic},get PassType(){return Oc},Size:Pc,DeviceCaps:Bc,DeviceOptions:Nc,Offset:Lc,Rect:Fc,Extent:kc,TextureSubresLayers:Uc,TextureSubresRange:Gc,TextureCopy:Hc,TextureBlit:zc,BufferTextureCopy:Vc,Viewport:Wc,Color:Xc,BindingMappingInfo:jc,SwapchainInfo:Yc,DeviceInfo:Kc,BufferInfo:qc,BufferViewInfo:Qc,DrawInfo:Zc,DispatchInfo:Jc,IndirectBuffer:$c,TextureInfo:t_,TextureViewInfo:e_,SamplerInfo:i_,Uniform:n_,UniformBlock:r_,UniformSamplerTexture:s_,UniformSampler:a_,UniformTexture:o_,UniformStorageImage:h_,UniformStorageBuffer:u_,UniformInputAttachment:l_,ShaderStage:c_,Attribute:__,ShaderInfo:d_,InputAssemblerInfo:f_,ColorAttachment:p_,DepthStencilAttachment:m_,SubpassInfo:g_,SubpassDependency:v_,RenderPassInfo:y_,GeneralBarrierInfo:T_,TextureBarrierInfo:S_,BufferBarrierInfo:E_,FramebufferInfo:A_,DescriptorSetLayoutBinding:R_,DescriptorSetLayoutInfo:b_,DescriptorSetInfo:C_,PipelineLayoutInfo:w_,InputState:x_,CommandBufferInfo:I_,QueueInfo:O_,QueryPoolInfo:D_,FormatInfo:M_,MemoryStatus:P_,DynamicStencilStates:B_,DynamicStates:N_,GFXObject:L_,get AttributeName(){return Mc},FormatInfos:F_,DESCRIPTOR_BUFFER_TYPE:k_,DESCRIPTOR_SAMPLER_TYPE:U_,DESCRIPTOR_DYNAMIC_TYPE:G_,DRAW_INFO_SIZE:28,IsPowerOf2:H_,FormatSize:z_,FormatSurfaceSize:V_,GetTypeSize:X_,getTypedArrayConstructor:j_,formatAlignment:Y_,alignTo:K_}),Q_=function(t){function e(){var e;return(e=t.call(this,Hl.BUFFER)||this)._usage=ql.NONE,e._memUsage=Jl.NONE,e._size=0,e._stride=1,e._count=0,e._flags=Ql.NONE,e._isBufferView=!1,e}return s(e,t),n(e,[{key:"usage",get:function(){return this._usage}},{key:"memUsage",get:function(){return this._memUsage}},{key:"size",get:function(){return this._size}},{key:"stride",get:function(){return this._stride}},{key:"count",get:function(){return this._count}},{key:"flags",get:function(){return this._flags}}]),e}(L_),Z_=function(t){function e(){var e;return(e=t.call(this,Hl.COMMAND_BUFFER)||this)._queue=null,e._type=wc.PRIMARY,e._numDrawCalls=0,e._numInstances=0,e._numTris=0,e}return s(e,t),n(e,[{key:"type",get:function(){return this._type}},{key:"queue",get:function(){return this._queue}},{key:"numDrawCalls",get:function(){return this._numDrawCalls}},{key:"numInstances",get:function(){return this._numInstances}},{key:"numTris",get:function(){return this._numTris}}]),e}(L_),J_=function(){function t(){this._gfxAPI=Vl.UNKNOWN,this._renderer="",this._vendor="",this._features=new Array(Xl.COUNT),this._formatFeatures=new Array(jl.COUNT),this._queue=null,this._cmdBuff=null,this._numDrawCalls=0,this._numInstances=0,this._numTris=0,this._memoryStatus=new P_,this._caps=new Bc,this._bindingMappingInfo=new jc,this._samplers=new Map,this._generalBarrierss=new Map,this._textureBarriers=new Map,this._bufferBarriers=new Map}var e=t.prototype;return e.hasFeature=function(t){return this._features[t]},e.getFormatFeatures=function(t){return this._formatFeatures[t]},e.enableAutoBarrier=function(){},e.getMaxSampleCount=function(){return nc.X1},n(t,[{key:"gfxAPI",get:function(){return this._gfxAPI}},{key:"queue",get:function(){return this._queue}},{key:"commandBuffer",get:function(){return this._cmdBuff}},{key:"renderer",get:function(){return this._renderer}},{key:"vendor",get:function(){return this._vendor}},{key:"numDrawCalls",get:function(){return this._numDrawCalls}},{key:"numInstances",get:function(){return this._numInstances}},{key:"numTris",get:function(){return this._numTris}},{key:"memoryStatus",get:function(){return this._memoryStatus}},{key:"capabilities",get:function(){return this._caps}},{key:"bindingMappingInfo",get:function(){return this._bindingMappingInfo}}]),t}();J_.canvas=void 0;var $_=function(){function t(t){this._texture2D=null,this._texture3D=null,this._textureCube=null,this._texture2DArray=null;var e=new Uint8Array(64);if(e.fill(255),t.capabilities.maxTextureSize>=2){this._texture2D=t.createTexture(new t_($l.TEX2D,tc.STORAGE|tc.SAMPLED,jl.RGBA8,2,2,ec.NONE));var i=new Vc(0,0,0,new Lc(0,0,0),new kc(2,2,1));t.copyBuffersToTexture([e],this._texture2D,[i])}if(t.capabilities.maxTextureSize>=2){this._textureCube=t.createTexture(new t_($l.CUBE,tc.STORAGE|tc.SAMPLED,jl.RGBA8,2,2,ec.NONE,6));var n=new Vc(0,0,0,new Lc(0,0,0),new kc(2,2,1));t.copyBuffersToTexture([e],this._textureCube,[n]),n.texSubres.baseArrayLayer=1,t.copyBuffersToTexture([e],this._textureCube,[n]),n.texSubres.baseArrayLayer=2,t.copyBuffersToTexture([e],this._textureCube,[n]),n.texSubres.baseArrayLayer=3,t.copyBuffersToTexture([e],this._textureCube,[n]),n.texSubres.baseArrayLayer=4,t.copyBuffersToTexture([e],this._textureCube,[n]),n.texSubres.baseArrayLayer=5,t.copyBuffersToTexture([e],this._textureCube,[n])}if(t.capabilities.max3DTextureSize>=2){this._texture3D=t.createTexture(new t_($l.TEX3D,tc.STORAGE|tc.SAMPLED,jl.RGBA8,2,2,ec.NONE,1,1,nc.X1,2));var r=new Vc(0,0,0,new Lc(0,0,0),new kc(2,2,2),new Uc(0,0,1));t.copyBuffersToTexture([e],this._texture3D,[r])}if(t.capabilities.maxArrayTextureLayers>=2){this._texture2DArray=t.createTexture(new t_($l.TEX2D_ARRAY,tc.STORAGE|tc.SAMPLED,jl.RGBA8,2,2,ec.NONE,2));var s=new Vc(0,0,0,new Lc(0,0,0),new kc(2,2,1),new Uc(0,0,1));t.copyBuffersToTexture([e],this._texture2DArray,[s]),s.texSubres.baseArrayLayer=1,t.copyBuffersToTexture([e],this._texture2DArray,[s])}}return t.prototype.getTexture=function(t){switch(t){case $l.TEX2D:return this._texture2D;case $l.TEX3D:return this._texture3D;case $l.CUBE:return this._textureCube;case $l.TEX2D_ARRAY:return this._texture2DArray;default:return null}},t}(),td=function(t){function e(){var e;return(e=t.call(this,Hl.SWAPCHAIN)||this)._transform=Wl.IDENTITY,e._colorTexture=null,e._depthStencilTexture=null,e}return s(e,t),n(e,[{key:"colorTexture",get:function(){return this._colorTexture}},{key:"depthStencilTexture",get:function(){return this._depthStencilTexture}},{key:"surfaceTransform",get:function(){return this._transform}},{key:"width",get:function(){return this._colorTexture.width}},{key:"height",get:function(){return this._colorTexture.height}}]),e}(L_),ed=function(t){function e(){var e;return(e=t.call(this,Hl.FRAMEBUFFER)||this)._renderPass=null,e._colorTextures=[],e._depthStencilTexture=null,e._width=0,e._height=0,e}return s(e,t),n(e,[{key:"renderPass",get:function(){return this._renderPass}},{key:"colorTextures",get:function(){return this._colorTextures}},{key:"depthStencilTexture",get:function(){return this._depthStencilTexture}},{key:"width",get:function(){return this.colorTextures.length>0?this.colorTextures[0].width:this.depthStencilTexture?this.depthStencilTexture.width:this._width}},{key:"height",get:function(){return this.colorTextures.length>0?this.colorTextures[0].height:this.depthStencilTexture?this.depthStencilTexture.height:this._height}}]),e}(L_),id=function(t){function e(){var e;return(e=t.call(this,Hl.INPUT_ASSEMBLER)||this)._attributes=[],e._attributesHash=0,e._vertexBuffers=[],e._indexBuffer=null,e._indirectBuffer=null,e._drawInfo=new Zc,e}s(e,t);var i=e.prototype;return i.getVertexBuffer=function(t){return void 0===t&&(t=0),t=0){var o=this._colorInfos[i.depthStencil];t+="ds,"+o.format+","+o.sampleCount}}else{t+="ca";for(var h=0;h>0,e.magFilter=(3&t)>>2,e.mipFilter=(3&t)>>4,e.addressU=(3&t)>>6,e.addressV=(3&t)>>8,e.addressW=(3&t)>>10,e.maxAnisotropy=(15&t)>>12,e.cmpFunc=(7&t)>>16,e},n(e,[{key:"info",get:function(){return this._info}},{key:"hash",get:function(){return this._hash}}]),e}(L_),pd=function(t){function e(){var e;return(e=t.call(this,Hl.SHADER)||this)._name="",e._stages=[],e._attributes=[],e._blocks=[],e._samplers=[],e}return s(e,t),n(e,[{key:"name",get:function(){return this._name}},{key:"attributes",get:function(){return this._attributes}},{key:"blocks",get:function(){return this._blocks}},{key:"samplers",get:function(){return this._samplers}},{key:"stages",get:function(){return this._stages}}]),e}(L_),md=function(t){function e(){var e;return(e=t.call(this,Hl.TEXTURE)||this)._info=new t_,e._viewInfo=new e_,e._isPowerOf2=!1,e._isTextureView=!1,e._size=0,e}return s(e,t),e.getLevelCount=function(t,e){return Math.floor(Math.log2(Math.max(t,e)))},n(e,[{key:"type",get:function(){return this._info.type}},{key:"usage",get:function(){return this._info.usage}},{key:"format",get:function(){return this._info.format}},{key:"width",get:function(){return this._info.width}},{key:"height",get:function(){return this._info.height}},{key:"depth",get:function(){return this._info.depth}},{key:"layerCount",get:function(){return this._info.layerCount}},{key:"levelCount",get:function(){return this._info.levelCount}},{key:"samples",get:function(){return this._info.samples}},{key:"flags",get:function(){return this._info.flags}},{key:"size",get:function(){return this._size}},{key:"info",get:function(){return this._info}},{key:"viewInfo",get:function(){return this._viewInfo}},{key:"isTextureView",get:function(){return this._isTextureView}}]),e}(L_),gd=function(t){function e(e,i){var n;return(n=t.call(this,Hl.GLOBAL_BARRIER)||this)._info=new T_,n._hash=0,n._info.copy(e),n._hash=i,n}return s(e,t),e.computeHash=function(t){return Bl(t.prevAccesses+" "+t.nextAccesses+" "+t.type,666)},n(e,[{key:"info",get:function(){return this._info}},{key:"hash",get:function(){return this._hash}}]),e}(L_),vd=function(t){function e(e,i){var n;return(n=t.call(this,Hl.TEXTURE_BARRIER)||this)._info=new S_,n._hash=0,n._info.copy(e),n._hash=i,n}return s(e,t),e.computeHash=function(t){var e=t.prevAccesses+" "+t.nextAccesses;return e+=t.type,e+=t.baseMipLevel,e+=t.levelCount,e+=t.baseSlice,e+=t.sliceCount,e+=t.discardContents,e+=t.srcQueue?t.srcQueue.type:0,Bl(e+=t.dstQueue?t.dstQueue.type:0,666)},n(e,[{key:"info",get:function(){return this._info}},{key:"hash",get:function(){return this._hash}}]),e}(L_),yd=function(t){function e(e,i){var n;return(n=t.call(this,Hl.BUFFER_BARRIER)||this)._info=new E_,n._hash=0,n._info.copy(e),n._hash=i,n}return s(e,t),e.computeHash=function(t){var e=t.prevAccesses+" "+t.nextAccesses;return e+=t.type,e+=t.offset,e+=t.size,e+=t.discardContents,e+=t.srcQueue?t.srcQueue.type:0,Bl(e+=t.dstQueue?t.dstQueue.type:0,666)},n(e,[{key:"info",get:function(){return this._info}},{key:"hash",get:function(){return this._hash}}]),e}(L_),Td={Device:J_,Swapchain:td,Buffer:Q_,Texture:md,Sampler:fd,Shader:pd,InputAssembler:id,RenderPass:dd,Framebuffer:ed,DescriptorSet:nd,DescriptorSetLayout:rd,PipelineLayout:sd,PipelineState:cd,CommandBuffer:Z_,Queue:_d,GeneralBarrier:gd,TextureBarrier:vd,BufferBarrier:yd,RasterizerState:ad,BlendState:ud,BlendTarget:hd,DepthStencilState:od,PipelineStateInfo:ld};Object.assign(Td,q_),v.gfx=Td;var Sd,Ed,Ad={GFXDevice:!0,GFXBuffer:!0,GFXTexture:!0,GFXSampler:!0,GFXShader:!0,GFXInputAssembler:!0,GFXRenderPass:!0,GFXFramebuffer:!0,GFXPipelineState:!0,GFXCommandBuffer:!0,GFXQueue:!0,GFXObjectType:!0,GFXObject:!1,GFXAttributeName:!0,GFXType:!0,GFXFormat:!0,GFXBufferUsageBit:!0,GFXMemoryUsageBit:!0,GFXBufferFlagBit:!0,GFXBufferAccessBit:"MemoryAccessBit",GFXPrimitiveMode:!0,GFXPolygonMode:!0,GFXShadeModel:!0,GFXCullMode:!0,GFXComparisonFunc:!0,GFXStencilOp:!0,GFXBlendOp:!0,GFXBlendFactor:!0,GFXColorMask:!0,GFXFilter:!0,GFXAddress:!0,GFXTextureType:!0,GFXTextureUsageBit:!0,GFXSampleCount:!0,GFXTextureFlagBit:!0,GFXShaderStageFlagBit:!0,GFXDescriptorType:!0,GFXCommandBufferType:!0,GFXLoadOp:!0,GFXStoreOp:!0,GFXPipelineBindPoint:!0,GFXDynamicStateFlagBit:!0,GFXStencilFace:!0,GFXQueueType:!0,GFXRect:!0,GFXViewport:!0,GFXColor:!0,GFXClearFlag:!0,GFXOffset:!0,GFXExtent:!0,GFXTextureSubres:"TextureSubresLayers",GFXTextureCopy:!0,GFXBufferTextureCopy:!0,GFXFormatType:!0,GFXFormatInfo:!0,GFXMemoryStatus:!0,GFXFormatInfos:!0,GFXFormatSize:!0,GFXFormatSurfaceSize:!0,GFXGetTypeSize:!0,getTypedArrayConstructor:!1};for(var Rd in Ad){var bd=Ad[Rd];!0===bd?bd=Rd.slice(3):!1===bd&&(bd=Rd),rt(v,"cc",[{name:Rd,newName:bd,target:v.gfx,targetName:"cc.gfx"}])}st(v,"cc",[{name:"GFX_MAX_VERTEX_ATTRIBUTES"},{name:"GFX_MAX_TEXTURE_UNITS"},{name:"GFX_MAX_ATTACHMENTS"},{name:"GFX_MAX_BUFFER_BINDINGS"},{name:"GFXTextureLayout"}]),st(Xl,"Feature",[{name:"COLOR_FLOAT",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.R32F) & FormatFeatureBit.RENDER_TARGET;"},{name:"COLOR_HALF_FLOAT",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.R16F) & FormatFeatureBit.RENDER_TARGET;"},{name:"TEXTURE_FLOAT",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = (device.getFormatFeatures(Format.R32F) & (FormatFeatureBit.RENDER_TARGET | FormatFeatureBit.SAMPLED_TEXTURE)) === (FormatFeatureBit.RENDER_TARGET | FormatFeatureBit.SAMPLED_TEXTURE);"},{name:"TEXTURE_HALF_FLOAT",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = (device.getFormatFeatures(Format.R16F) & (FormatFeatureBit.RENDER_TARGET | FormatFeatureBit.SAMPLED_TEXTURE)) === (FormatFeatureBit.RENDER_TARGET | FormatFeatureBit.SAMPLED_TEXTURE);"},{name:"TEXTURE_FLOAT_LINEAR",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.R32F) & FormatFeatureBit.LINEAR_FILTER;"},{name:"TEXTURE_HALF_FLOAT_LINEAR",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.R16F) & FormatFeatureBit.LINEAR_FILTER;"},{name:"FORMAT_R11G11B10F",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.R11G11B10F) !== FormatFeatureBit.NONE;"},{name:"FORMAT_SRGB",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.SRGB8) !== FormatFeatureBit.NONE;"},{name:"FORMAT_ETC1",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.ETC_RGB8) !== FormatFeatureBit.NONE;"},{name:"FORMAT_ETC2",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.ETC2_RGB8) !== FormatFeatureBit.NONE;"},{name:"FORMAT_DXT",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.BC1) !== FormatFeatureBit.NONE;"},{name:"FORMAT_PVRTC",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.PVRTC_RGB2) !== FormatFeatureBit.NONE;"},{name:"FORMAT_ASTC",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.ASTC_RGBA_4x4) !== FormatFeatureBit.NONE;"},{name:"FORMAT_RGB8",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.RGB8) !== FormatFeatureBit.NONE;"}]),st(p_.prototype,"ColorAttachment",[{name:"beginAccesses",suggest:"Please assign to ColorAttachment.barrier instead"},{name:"endAccesses",suggest:"Please assign to ColorAttachment.barrier instead"}]),st(m_.prototype,"DepthStencilAttachment",[{name:"beginAccesses",suggest:"Please assign to DepthStencilAttachment.barrier instead"},{name:"endAccesses",suggest:"Please assign to DepthStencilAttachment.barrier instead"}]),rt(J_.prototype,"Device",[{name:"getGlobalBarrier",newName:"getGeneralBarrier"}]),function(t){t[t.AUTO=0]="AUTO",t[t.CANVAS=1]="CANVAS",t[t.WEBGL=2]="WEBGL",t[t.HEADLESS=3]="HEADLESS"}(Sd||(Sd={})),function(t){t[t.UNKNOWN=-1]="UNKNOWN",t[t.CANVAS=0]="CANVAS",t[t.WEBGL=1]="WEBGL",t[t.OPENGL=2]="OPENGL",t[t.HEADLESS=3]="HEADLESS"}(Ed||(Ed={}));var Cd=function(){function t(){this.initialized=!1,this._gfxDevice=void 0,this._canvas=null,this._swapchain=void 0,this._renderType=Ed.UNKNOWN}var e=t.prototype;return e.init=function(t,e){if(!this.initialized){var i=be.querySettings(Re.Category.RENDERING,"renderMode");if(this._canvas=t,this._renderType=this._determineRenderType(i),this._renderType===Ed.WEBGL){var n=new Kc(e),r=!!globalThis.WebGL2RenderingContext;globalThis.navigator.userAgent.toLowerCase(),Ol.browserType===$u.UC&&(r=!1);var s=[];r&&v.WebGL2Device&&s.push(v.WebGL2Device),v.WebGLDevice&&s.push(v.WebGLDevice),v.EmptyDevice&&s.push(v.EmptyDevice),J_.canvas=t;for(var a=0;aEd.HEADLESS||tthis.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>2],Yd[Kd[n++]]=Xd[(3&r)<<2|s>>4],Yd[Kd[n++]]=Xd[15&s]}return t.replace(e,Yd.join(""))}var Qd=/.*[/\\][0-9a-fA-F]{2}[/\\]([0-9a-fA-F-@]{8,}).*/;function Zd(t){var e=Qd.exec(t);return e?e[1]:""}function Jd(t,e){(e=e||Object.create(null)).__isNative__=e.isNative,e.nativeExt&&(e.ext=e.nativeExt);var i=Fd.find((function(e){return!!e.getAssetInfo(t)}));return i&&(e.bundle=i.name),ef(t,e)}function $d(t){return!!t&&(t instanceof v.SceneAsset||t instanceof v.Scene)}function tf(t){return t&&(46===t.charCodeAt(0)&&47===t.charCodeAt(1)?t=t.slice(2):47===t.charCodeAt(0)&&(t=t.slice(1))),t}function ef(t,e){var i=Wd.create({input:t,options:e}),n=[];try{for(var r,s=d(Gd.sync(i));!(r=s()).done;){var a=r.value,o=a.url;a.recycle(),n.push(o)}}catch(t){for(var h,u=d(i.output);!(h=u()).done;)h.value.recycle();G(t.message,t.stack)}return i.recycle(),n.length>1?n:n[0]}var nf,rf,sf,af=Object.freeze({__proto__:null,getUuidFromURL:Zd,getUrlWithUuid:Jd,isScene:$d,normalize:tf,transform:ef,decodeUuid:qd}),of=ra,hf=$s,uf=t("e7",qs("cc.Asset")((rf=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r0&&this._ref--,t&&v.assetManager._releaseManager.tryRelease(this),this},i.onLoaded=function(){},i.initDefault=function(t){t&&(this._uuid=t),this.isDefault=!0},i.validate=function(){return!0},i.destroy=function(){return z(et(12101,this._uuid)),t.prototype.destroy.call(this)},n(e,[{key:"nativeUrl",get:function(){if(!this._nativeUrl){if(!this._native)return"";var t=this._native;if(47===t.charCodeAt(0))return t.slice(1);46===t.charCodeAt(0)?this._nativeUrl=Jd(this._uuid,{nativeExt:t,isNative:!0}):this._nativeUrl=Jd(this._uuid,{__nativeName__:t,nativeExt:cl(t),isNative:!0})}return this._nativeUrl}},{key:"uuid",get:function(){return this._uuid}},{key:"_nativeAsset",get:function(){return this._file},set:function(t){this._file=t}},{key:"nativeAsset",get:function(){return this._file}},{key:"_nativeDep",get:function(){if(this._native)return{__isNative__:!0,uuid:this._uuid,ext:this._native}}},{key:"refCount",get:function(){return this._ref}}]),e}(Zu(Wa)),sf=Gs(rf.prototype,"_native",[of],(function(){return""})),f(rf.prototype,"_nativeAsset",[hf],Object.getOwnPropertyDescriptor(rf.prototype,"_nativeAsset"),rf.prototype),nf=rf))||nf);uf.prototype.createNode=null,v.Asset=uf;var lf,cf,_f,df,ff,pf;!function(t){t[t.RGB565=jl.R5G6B5]="RGB565",t[t.RGB5A1=jl.RGB5A1]="RGB5A1",t[t.RGBA4444=jl.RGBA4]="RGBA4444",t[t.RGB888=jl.RGB8]="RGB888",t[t.RGB32F=jl.RGB32F]="RGB32F",t[t.RGBA8888=jl.RGBA8]="RGBA8888",t[t.RGBA32F=jl.RGBA32F]="RGBA32F",t[t.A8=jl.A8]="A8",t[t.I8=jl.L8]="I8",t[t.AI8=jl.LA8]="AI8",t[t.RGB_PVRTC_2BPPV1=jl.PVRTC_RGB2]="RGB_PVRTC_2BPPV1",t[t.RGBA_PVRTC_2BPPV1=jl.PVRTC_RGBA2]="RGBA_PVRTC_2BPPV1",t[t.RGB_A_PVRTC_2BPPV1=1024]="RGB_A_PVRTC_2BPPV1",t[t.RGB_PVRTC_4BPPV1=jl.PVRTC_RGB4]="RGB_PVRTC_4BPPV1",t[t.RGBA_PVRTC_4BPPV1=jl.PVRTC_RGBA4]="RGBA_PVRTC_4BPPV1",t[t.RGB_A_PVRTC_4BPPV1=1025]="RGB_A_PVRTC_4BPPV1",t[t.RGB_ETC1=jl.ETC_RGB8]="RGB_ETC1",t[t.RGBA_ETC1=1026]="RGBA_ETC1",t[t.RGB_ETC2=jl.ETC2_RGB8]="RGB_ETC2",t[t.RGBA_ETC2=jl.ETC2_RGBA8]="RGBA_ETC2",t[t.RGBA_ASTC_4x4=jl.ASTC_RGBA_4X4]="RGBA_ASTC_4x4",t[t.RGBA_ASTC_5x4=jl.ASTC_RGBA_5X4]="RGBA_ASTC_5x4",t[t.RGBA_ASTC_5x5=jl.ASTC_RGBA_5X5]="RGBA_ASTC_5x5",t[t.RGBA_ASTC_6x5=jl.ASTC_RGBA_6X5]="RGBA_ASTC_6x5",t[t.RGBA_ASTC_6x6=jl.ASTC_RGBA_6X6]="RGBA_ASTC_6x6",t[t.RGBA_ASTC_8x5=jl.ASTC_RGBA_8X5]="RGBA_ASTC_8x5",t[t.RGBA_ASTC_8x6=jl.ASTC_RGBA_8X6]="RGBA_ASTC_8x6",t[t.RGBA_ASTC_8x8=jl.ASTC_RGBA_8X8]="RGBA_ASTC_8x8",t[t.RGBA_ASTC_10x5=jl.ASTC_RGBA_10X5]="RGBA_ASTC_10x5",t[t.RGBA_ASTC_10x6=jl.ASTC_RGBA_10X6]="RGBA_ASTC_10x6",t[t.RGBA_ASTC_10x8=jl.ASTC_RGBA_10X8]="RGBA_ASTC_10x8",t[t.RGBA_ASTC_10x10=jl.ASTC_RGBA_10X10]="RGBA_ASTC_10x10",t[t.RGBA_ASTC_12x10=jl.ASTC_RGBA_12X10]="RGBA_ASTC_12x10",t[t.RGBA_ASTC_12x12=jl.ASTC_RGBA_12X12]="RGBA_ASTC_12x12"}(lf||(lf={})),function(t){t[t.REPEAT=ac.WRAP]="REPEAT",t[t.CLAMP_TO_EDGE=ac.CLAMP]="CLAMP_TO_EDGE",t[t.MIRRORED_REPEAT=ac.MIRROR]="MIRRORED_REPEAT",t[t.CLAMP_TO_BORDER=ac.BORDER]="CLAMP_TO_BORDER"}(cf||(cf={})),function(t){t[t.NONE=sc.NONE]="NONE",t[t.LINEAR=sc.LINEAR]="LINEAR",t[t.NEAREST=sc.POINT]="NEAREST"}(_f||(_f={}));var mf=1346981187,gf=ve({PVR:0,PKM:1,ASTC:2});function vf(t,e){return t[e]<<8|t[e+1]}function yf(t){return!!(Ol.hasFeature(Ol.Feature.IMAGE_BITMAP)&&t instanceof ImageBitmap)}var Tf,Sf,Ef,Af,Rf,bf,Cf,wf,xf,If,Of,Df=t("ed",qs("cc.ImageAsset")(((pf=function(t){s(i,t),i.mergeCompressedTextureMips=function(t){var e=new Uint8Array(0),i=null;try{for(var n,r=8+4*t.length,s=0,a=d(t);!(n=a()).done;)s+=n.value.byteLength;s+=r,e=new Uint8Array(s);var o=new DataView(e.buffer,e.byteOffset,e.byteLength);o.setUint32(0,mf,!0),o.setUint32(4,t.length,!0);for(var h=r,u=0;u0){var u=new Uint8Array(s,o,h),l=new Uint8Array(r._data.byteLength+u.byteLength);l.set(r._data),l.set(u,r._data.byteLength),r._data=l,r.mipmapLevelDataSize[e]=h}else r._data=new Uint8Array(s,o);r.width=e>0?r.width:a[7],r.height=e>0?r.height:a[6]}else{if(559044176!==a[11])throw new Error("Invalid magic number in PVR header");var c=i+a[0],_=n-a.byteLength;if(n>0){var d=new Uint8Array(s,c,_),f=new Uint8Array(r._data.byteLength+d.byteLength);f.set(r._data),f.set(d,r._data.byteLength),r._data=f,r.mipmapLevelDataSize[e]=_}else r._data=new Uint8Array(s,c);r.width=e>0?r.width:a[1],r.height=e>0?r.height:a[2]}},i.parsePKMTexture=function(t,e,i,n,r){var s=t instanceof ArrayBuffer?t:t.buffer,a=new Uint8Array(s,i,16),o=vf(a,6);if(0!==o&&1!==o&&3!==o)throw new Error("Invalid magic number in ETC header");var h=i+16,u=n-16;if(n>0){var l=new Uint8Array(s,h,u),c=new Uint8Array(r._data.byteLength+l.byteLength);c.set(r._data),c.set(l,r._data.byteLength),r._data=c,r.mipmapLevelDataSize[e]=u}else r._data=new Uint8Array(s,h);r.width=e>0?r.width:vf(a,12),r.height=e>0?r.height:vf(a,14)},i.parseASTCTexture=function(t,e,i,n,r){var s=t instanceof ArrayBuffer?t:t.buffer,a=new Uint8Array(s,i,16);if(1554098963!==a[0]+(a[1]<<8)+(a[2]<<16)+(a[3]<<24))throw new Error("Invalid magic number in ASTC header");var o=a[4],h=a[5],u=a[6];if((o<3||o>6||h<3||h>6||u<3||u>6)&&(o<4||7===o||9===o||11===o||o>12||h<4||7===h||9===h||11===h||h>12||1!==u))throw new Error("Invalid block number in ASTC header");var l=function(t,e){return 4===t?lf.RGBA_ASTC_4x4:5===t?4===e?lf.RGBA_ASTC_5x4:lf.RGBA_ASTC_5x5:6===t?5===e?lf.RGBA_ASTC_6x5:lf.RGBA_ASTC_6x6:8===t?5===e?lf.RGBA_ASTC_8x5:6===e?lf.RGBA_ASTC_8x6:lf.RGBA_ASTC_8x8:10===t?5===e?lf.RGBA_ASTC_10x5:6===e?lf.RGBA_ASTC_10x6:8===e?lf.RGBA_ASTC_10x8:lf.RGBA_ASTC_10x10:10===e?lf.RGBA_ASTC_12x10:lf.RGBA_ASTC_12x12}(o,h),c=i+16,_=n-16;if(n>0){var d=new Uint8Array(s,c,_),f=new Uint8Array(r._data.byteLength+d.byteLength);f.set(r._data),f.set(d,r._data.byteLength),r._data=f,r.mipmapLevelDataSize[e]=_}else r._data=new Uint8Array(s,c);r.width=e>0?r.width:a[7]+(a[8]<<8)+(a[9]<<16),r.height=e>0?r.height:a[10]+(a[11]<<8)+(a[12]<<16),r.format=l};var e=i.prototype;function i(e){var i;return(i=t.call(this)||this)._nativeData=void 0,i._exportedExts=void 0,i._format=lf.RGBA8888,i._width=0,i._height=0,i._nativeData={_data:null,width:0,height:0,format:0,_compressed:!1,mipmapLevelDataSize:[]},void 0!==e&&i.reset(e),i}return e.extractMipmap0=function(){if(this.mipmapLevelDataSize&&this.mipmapLevelDataSize.length>0){var t=this.mipmapLevelDataSize[0],e=this.data,n=new i({_data:new Uint8Array(e.buffer,0,t),_compressed:!0,width:this.width,height:this.height,format:this.format,mipmapLevelDataSize:[]});return n._uuid=""+this._uuid,n}return this},e.extractMipmaps=function(){var t=[];if(this.mipmapLevelDataSize&&this.mipmapLevelDataSize.length>0)for(var e,n=this.mipmapLevelDataSize,r=this.data,s=0,a=this.height,o=this.width,h=d(n);!(e=h()).done;){var u=e.value,l=new i({_data:new Uint8Array(r.buffer,s,u),_compressed:!0,width:o,height:a,format:this.format,mipmapLevelDataSize:[]});s+=u,l._uuid=""+this._uuid,o=Math.max(o>>1,1),a=Math.max(a>>1,1),t.push(l)}else t.push(this);return t},e.reset=function(t){yf(t)||t instanceof HTMLElement?this._nativeData=t:(this._nativeData=t,this._format=t.format)},e.destroy=function(){if(this.data&&this.data instanceof HTMLImageElement)this.data.src="",this._setRawAsset("");else if(yf(this.data)){var e;null===(e=this.data)||void 0===e||e.close()}return t.prototype.destroy.call(this)},e._serialize=function(){},e._deserialize=function(t){var e="";"string"==typeof t?e=t:(this._width=t.w,this._height=t.h,e=t.fmt);for(var n,r=wd.gfxDevice,s=e.split("_"),a=Number.MAX_VALUE,o=this._format,h="",u=Ce.SUPPORT_TEXTURE_FORMATS,l=d(s);!(n=l()).done;){var c=n.value.split("@"),_=parseInt(c[0],void 0),f=i.extnames[_]||c[0],p=u.indexOf(f);if(-1!==p&&p=lf.RGB_ETC1&&this._format<=lf.RGBA_ASTC_12x12||this._format>=lf.RGB_A_PVRTC_2BPPV1&&this._format<=lf.RGBA_ETC1}},{key:"mipmapLevelDataSize",get:function(){return this._nativeData.mipmapLevelDataSize}},{key:"url",get:function(){return this.nativeUrl}}]),i}(uf)).extnames=[".png",".jpg",".jpeg",".bmp",".webp",".pvr",".pkm",".astc"],pf._sharedPlaceHolderCanvas=null,f((ff=pf).prototype,"_nativeAsset",[Ia],Object.getOwnPropertyDescriptor(ff.prototype,"_nativeAsset"),ff.prototype),df=ff))||df);v.ImageAsset=Df,Se(jl);var Mf,Pf,Bf,Nf=new vt("Tex"),Lf=qs("cc.TextureBase")(((Of=function(t){function e(){var e;return(e=t.call(this)||this)._format=Ef&&Ef(),e._minFilter=Af&&Af(),e._magFilter=Rf&&Rf(),e._mipFilter=bf&&bf(),e._wrapS=Cf&&Cf(),e._wrapT=wf&&wf(),e._wrapR=xf&&xf(),e._anisotropy=If&&If(),e._width=1,e._height=1,e._id=void 0,e._samplerInfo=new i_,e._gfxSampler=null,e._gfxDevice=null,e._textureHash=0,e._id=Nf.getNewId(),e._gfxDevice=e._getGFXDevice(),e._textureHash=Bl(e._id,666),e}s(e,t);var i=e.prototype;return i.getId=function(){return this._id},i.getPixelFormat=function(){return this._format},i.getAnisotropy=function(){return this._anisotropy},i.setWrapMode=function(t,e,i){void 0===i&&(i=t),this._wrapS=t,this._samplerInfo.addressU=t,this._wrapT=e,this._samplerInfo.addressV=e,this._wrapR=i,this._samplerInfo.addressW=i,this._gfxDevice&&(this._gfxSampler=this._gfxDevice.getSampler(this._samplerInfo))},i.setFilters=function(t,e){this._minFilter=t,this._samplerInfo.minFilter=t,this._magFilter=e,this._samplerInfo.magFilter=e,this._gfxDevice&&(this._gfxSampler=this._gfxDevice.getSampler(this._samplerInfo))},i.setMipFilter=function(t){this._mipFilter=t,this._samplerInfo.mipFilter=t,this._gfxDevice&&(this._gfxSampler=this._gfxDevice.getSampler(this._samplerInfo))},i.setAnisotropy=function(t){this._anisotropy=t,this._samplerInfo.maxAnisotropy=t,this._gfxDevice&&(this._gfxSampler=this._gfxDevice.getSampler(this._samplerInfo))},i.destroy=function(){var e,i=t.prototype.destroy.call(this);return i&&null!==(e=v.director.root)&&void 0!==e&&e.batcher2D&&v.director.root.batcher2D._releaseDescriptorSetCache(this._textureHash),i},i.getHash=function(){return this._textureHash},i.getGFXTexture=function(){return null},i.getSamplerInfo=function(){return this._samplerInfo},i.getGFXSampler=function(){return this._gfxSampler||(this._gfxDevice?this._gfxSampler=this._gfxDevice.getSampler(this._samplerInfo):Z(9302)),this._gfxSampler},i._serialize=function(){return""},i._deserialize=function(t){var e=t.split(",");e.unshift(""),e.length>=5&&(this.setFilters(parseInt(e[1]),parseInt(e[2])),this.setWrapMode(parseInt(e[3]),parseInt(e[4]))),e.length>=7&&(this.setMipFilter(parseInt(e[5])),this.setAnisotropy(parseInt(e[6])))},i._getGFXDevice=function(){return wd.gfxDevice},i._getGFXFormat=function(){return this._getGFXPixelFormat(this._format)},i._setGFXFormat=function(t){this._format=void 0===t?lf.RGBA8888:t},i._getGFXPixelFormat=function(t){return t===lf.RGBA_ETC1?t=lf.RGB_ETC1:t===lf.RGB_A_PVRTC_4BPPV1?t=lf.RGB_PVRTC_4BPPV1:t===lf.RGB_A_PVRTC_2BPPV1&&(t=lf.RGB_PVRTC_2BPPV1),t},n(e,[{key:"isCompressed",get:function(){return this._format>=lf.RGB_ETC1&&this._format<=lf.RGBA_ASTC_12x12||this._format>=lf.RGB_A_PVRTC_2BPPV1&&this._format<=lf.RGBA_ETC1}},{key:"width",get:function(){return this._width}},{key:"height",get:function(){return this._height}}]),e}(uf)).PixelFormat=lf,Of.WrapMode=cf,Of.Filter=_f,Ef=Gs((Sf=Of).prototype,"_format",[ra],(function(){return lf.RGBA8888})),Af=Gs(Sf.prototype,"_minFilter",[ra],(function(){return _f.LINEAR})),Rf=Gs(Sf.prototype,"_magFilter",[ra],(function(){return _f.LINEAR})),bf=Gs(Sf.prototype,"_mipFilter",[ra],(function(){return _f.NONE})),Cf=Gs(Sf.prototype,"_wrapS",[ra],(function(){return cf.REPEAT})),wf=Gs(Sf.prototype,"_wrapT",[ra],(function(){return cf.REPEAT})),xf=Gs(Sf.prototype,"_wrapR",[ra],(function(){return cf.REPEAT})),If=Gs(Sf.prototype,"_anisotropy",[ra],(function(){return 0})),Tf=Sf))||Tf;v.TextureBase=Lf;var Ff=t("ej",qs("cc.Script")(Mf=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(uf))||Mf);v._Script=Ff;var kf=t("ek",qs("cc.JavaScript")(Pf=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(Ff))||Pf);v._JavaScript=kf;var Uf,Gf,Hf,zf,Vf,Wf,Xf,jf=t("el",qs("cc.TypeScript")(Bf=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(Ff))||Bf);v._TypeScript=jf;var Yf,Kf,qf,Qf,Zf,Jf,$f,tp,ep,ip,np,rp=t("dC",qs("cc.ClickEvent")((Gf=function(){function t(){this.target=Hf&&Hf(),this.component=zf&&zf(),this._componentId=Vf&&Vf(),this.handler=Wf&&Wf(),this.customEventData=Xf&&Xf()}t.emitEvents=function(e){for(var i=arguments.length,n=new Array(i>1?i-1:0),r=1;r=0,1620),i=Number.isNaN(i)?v.macro.REPEAT_FOREVER:i,n=n||0;var r=v.director.getScheduler(),s=r.isTargetPaused(this);r.schedule(t,this,e,i,n,s)},i.scheduleOnce=function(t,e){void 0===e&&(e=0),this.schedule(t,0,0,e)},i.unschedule=function(t){t&&v.director.getScheduler().unschedule(t,this)},i.unscheduleAllCallbacks=function(){v.director.getScheduler().unscheduleAllForTarget(this)},n(e,[{key:"name",get:function(){if(this._name)return this._name;var t=Dt(this),e=t.lastIndexOf(".");return e>=0&&(t=t.slice(e+1)),this.node?this.node.name+"<"+t+">":t},set:function(t){this._name=t}},{key:"uuid",get:function(){return this._id}},{key:"__scriptAsset",get:function(){return null}},{key:"enabled",get:function(){return this._enabled},set:function(t){if(this._enabled!==t&&(this._enabled=t,this.node.activeInHierarchy)){var e=v.director._compScheduler;t?e.enableComp(this):e.disableComp(this)}}},{key:"enabledInHierarchy",get:function(){return this._enabled&&this.node&&this.node.activeInHierarchy}},{key:"_isOnLoadCalled",get:function(){return this._objFlags&ap}},{key:"internalUpdate",get:function(){return this.update}},{key:"internalLateUpdate",get:function(){return this.lateUpdate}},{key:"internalPreload",get:function(){return this.__preload}},{key:"internalOnLoad",get:function(){return this.onLoad}},{key:"internalStart",get:function(){return this.start}},{key:"internalOnEnable",get:function(){return this.onEnable}},{key:"internalOnDisable",get:function(){return this.onDisable}},{key:"internalOnDestroy",get:function(){return this.onDestroy}}]),e}(Wa)).EventHandler=rp,tp._executionOrder=0,tp._requireComponent=null,tp.system=null,f((Qf=tp).prototype,"__scriptAsset",[Kf],Object.getOwnPropertyDescriptor(Qf.prototype,"__scriptAsset"),Qf.prototype),Zf=Gs(Qf.prototype,"node",[ra],(function(){return null})),Jf=Gs(Qf.prototype,"_enabled",[ra],(function(){return!0})),$f=Gs(Qf.prototype,"__prefab",[ra],(function(){return null})),qf=Qf))||qf));Ct(op,"_registerEditorProps",(function(t,e){var i=e.requireComponent;i&&(Array.isArray(i)&&(i=i.filter(Boolean)),t._requireComponent=i);var n=e.executionOrder;n&&"number"==typeof n&&(t._executionOrder=n)})),v.Component=op;var hp=t("d_",qs("cc.MissingScript")((ip=function(t){function e(){var e;return(e=t.call(this)||this)._$erialized=np&&np(),e}return s(e,t),e.safeFindClass=function(t){var e=ee(t);if(e)return e;v.deserialize.reportMissingClass(t)},e.prototype.onLoad=function(){q(4600,this.node.name)},e}(op),np=Gs(ip.prototype,"_$erialized",[ra,aa],(function(){return null})),ep=ip))||ep);v._MissingScript=hp;try{var up=hp.__values__;0!==up.length&&"_$erialized"===up[up.length-1]||(G("The '_$erialized' prop in MissingScript is missing. Please contact jare."),G(" Error props: ['"+up+"']"))}catch(er){G("Error when checking MissingScript 5, "+er)}var lp=function(){function t(t,e){this._document=void 0,this._chunks=void 0,this._document=t,this._chunks=e}return n(t,[{key:"document",get:function(){return this._document}},{key:"chunks",get:function(){return this._chunks}}]),t}();function cp(t){var e=t;return{chunks:e.chunks,document:e.document}}function _p(t){if(t.length<16)throw new dp(et(13102));var e=new DataView(t.buffer,t.byteOffset,t.byteLength);if(1313817411!==e.getUint32(0,!0))throw new dp(et(13100));var i=e.getUint32(4,!0);if(1!==i)throw new dp(et(13101,i));if(e.getUint32(8,!0)!==e.byteLength)throw new dp(et(13102));var n=12,r=e.getUint32(n,!0);n+=4;var s=new Uint8Array(e.buffer,n+e.byteOffset,r);n+=r;var a,o=function(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);if("Buffer"in globalThis)return globalThis.Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString();throw new Error(et(13104))}(s);try{a=JSON.parse(o)}catch(t){throw new dp(t)}for(var h=[];n0&&(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=0&&(r.deserializedList[e]=i),i}(a);return this._deserializeInto(t,o,a),o},e._deserializeInto=function(t,e,i,n){void 0===n&&(n=!1),n||!e[Ja]?e._deserialize?e._deserialize(t.content,this):v.Class._isCCClass(i)?this._deserializeFireClass(e,t,i):this._deserializeFastDefinedObject(e,t,i):this._runCustomizedDeserialize(t,e,i)},e._runCustomizedDeserialize=function(t,e,i){var n=this,r={readProperty:function(e){var i=t[e];return"object"==typeof i&&i?n._deserializeObjectField(i):i},readThis:function(){n._deserializeInto(t,e,i,!0)},readSuper:function(){var r=Vt(i);r&&n._deserializeInto(t,e,r)}};e[Ja](r,this._context)},e._deserializeFireClass=function(t,e,i){var n;if(i.hasOwnProperty("__deserialize__"))n=i.__deserialize__;else{n=function(t,e){for(var i=gi.Attr.getClassAttrs(e),n=e.__values__,r=["var prop;"],s=function(t){return we.test(re(t))}(e),a=0;a=0?e[i]=t[5][n]:t[7][3*~n]=e}function Ip(t){return function(e,i,n,r){for(var s=0;s=0){var c=o[u];e[a]=wp(t,c,l)}else(0,Mp[u=~u])(t,e,a,l)}return r}(s);v.game._isCloning=!1,s[7]&&function(t,e,i){for(var n=t.length-1,r=0,s=3*t[n];r=0?a[i[h]]=o:a[~h]=o}for(;r=0?u[i[c]]=l:u[~c]=l}}(s[7],a,s[2]),function(t){for(var e=t[5],i=t[2],n=t[1],r=t[8],s=t[9],a=t[10],o=0;o=0?i[u]:~u,s[o]=u);var l=a[o];"number"==typeof l&&(a[o]=n[l])}}(s),n=a[o]}else n=function(t,e,i){var n,r=(i=i||{}).classFinder||ee,s=i.createAssetRefs||Ol.platform===nl.EDITOR_CORE,a=i.customEnv,o=i.ignoreEditorOnly,h=null!==(n=i.reportMissingClass)&&void 0!==n?n:v.deserialize.reportMissingClass;e.init();var u=Sp.pool.get(e,r,h,a,o);v.game._isCloning=!0;var l=u.deserialize(t);return v.game._isCloning=!1,Sp.pool.put(u),s&&e.assignAssetsBy((function(t,e){return EditorExtends.serialize.asAsset(t,e.type)})),l}(t,e,i);return r&&bp.pool.put(e),n}Mp[0]=function(t,e,i,n){e[i]=n},Mp[1]=xp,Mp[2]=Ip(xp),Mp[3]=Ip(Op),Mp[4]=Dp,Mp[5]=function(t,e,i,n){var r=n[0],s=e[i];(0,Rp[r])(s,n)},Mp[6]=Op,Mp[7]=function(t,e,i,n){e[i].set(n)},Mp[8]=function(t,e,i,n){var r=n[0],s=new Ep[r];(0,Rp[r])(s,n),e[i]=s},Mp[9]=Ip(Dp),Mp[10]=function(t,e,i,n){var r=t[3][n[0]];e[i]=wp(t,r,n[1])},Mp[11]=function(t,e,i,n){var r=n[0];e[i]=r;for(var s=1;s>e,r.texExtent.height=this._textureHeight>>e,r.texSubres.mipLevel=e,r.texSubres.baseArrayLayer=i,ArrayBuffer.isView(t)?n.copyBuffersToTexture([t],this._gfxTexture,Yp):n.copyTexImagesToTexture([t],this._gfxTexture,Yp)}}},i._assignImage=function(t,e,i){var n=t.data;if(n&&(this.uploadData(n,e,i),this._checkTextureLoaded(),Ce.CLEANUP_IMAGE_CACHE)){var r=jp.getDeps(this._uuid),s=r.indexOf(t._uuid);-1!==s&&(he(r,s),t.decRef())}},i._checkTextureLoaded=function(){this._textureReady()},i._textureReady=function(){this.loaded=!0,this.emit("load")},i._setMipmapLevel=function(t){this._mipmapLevel=t<1?1:t},i._setMipRange=function(t,e){this._baseLevel=t<1?0:t,this._maxLevel=e<1?0:e},i.setMipRange=function(t,e){tt(t<=e,3124),this._setMipRange(t,e);var i=this._getGFXDevice();if(i){var n=this._createTextureView(i);this._tryDestroyTextureView(),this._gfxTextureView=n}},i._getGfxTextureCreateInfo=function(){return null},i._getGfxTextureViewCreateInfo=function(){return null},i._tryReset=function(){if(this._tryDestroyTextureView(),this._tryDestroyTexture(),0!==this._mipmapLevel){var t=this._getGFXDevice();t&&(this._createTexture(t),this._gfxTextureView=this._createTextureView(t))}},i.isUsingOfflineMipmaps=function(){return!1},i._createTexture=function(t){if(0!==this._width&&0!==this._height){var e=ec.NONE;this._mipFilter!==_f.NONE&&function(t,e,i){return!(t.gfxAPI===Vl.WEBGL)||Kp(e)&&Kp(i)}(t,this._width,this._height)&&(this._mipmapLevel=function(t,e){for(var i=Math.max(t,e),n=0;i;)i>>=1,n++;return n}(this._width,this._height),this.isUsingOfflineMipmaps()||this.isCompressed||(e=ec.GEN_MIPMAP));var i=this._getGfxTextureCreateInfo({usage:tc.SAMPLED|tc.TRANSFER_DST|tc.COLOR_ATTACHMENT,format:this._getGFXFormat(),levelCount:this._mipmapLevel,flags:e});if(i){var n=t.createTexture(i);this._textureWidth=i.width,this._textureHeight=i.height,this._gfxTexture=n}}},i._createTextureView=function(t){if(!this._gfxTexture)return null;var e=this._maxLevel0){var i=this._generatedMipmaps[0];this.reset({width:i.width,height:i.height,format:i.format,mipmapLevel:this._generatedMipmaps.length,baseLevel:this._baseLevel,maxLevel:this._maxLevel}),this._generatedMipmaps.forEach((function(t,i){e._assignImage(t,i)}))}else this.reset({width:0,height:0,mipmapLevel:this._generatedMipmaps.length,baseLevel:this._baseLevel,maxLevel:this._maxLevel})},i.initialize=function(){this.mipmaps=this._mipmaps},i.onLoaded=function(){this.initialize()},i.reset=function(t){this._width=t.width,this._height=t.height,this._setGFXFormat(t.format);var e=void 0===t.mipmapLevel?1:t.mipmapLevel;this._setMipmapLevel(e);var i=void 0===t.baseLevel?0:t.baseLevel,n=void 0===t.maxLevel?1e3:t.maxLevel;this._setMipRange(i,n),this._tryReset()},i.create=function(t,e,i,n,r,s){void 0===i&&(i=lf.RGBA8888),void 0===n&&(n=1),void 0===r&&(r=0),void 0===s&&(s=1e3),this.reset({width:t,height:e,format:i,mipmapLevel:n,baseLevel:r,maxLevel:s})},i.toString=function(){return 0!==this._mipmaps.length?this._mipmaps[0].url:""},i.updateMipmaps=function(t,e){if(void 0===t&&(t=0),!(t>=this._generatedMipmaps.length))for(var i=Math.min(void 0===e?this._generatedMipmaps.length:e,this._generatedMipmaps.length-t),n=0;n"},i.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;r1)for(var n=0;nthis._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;e19||i<0)console.warn("maximum layers reached.");else{var n=1<19||e<0)console.warn("do not change buildin layers.");else{var i=1<31||e<0?(console.warn("Unable to access unknown layer."),""):t.Enum[1<0&&(s=i._findChildComponent(r._children,e)))return s}return null},i._findChildComponents=function(t,e,n){for(var r=0;r0&&i._findChildComponents(s._children,e,n)}},e.getWritableComponents=function(){return this._components},e._updateScene=function(){null==this._parent?G("Node %s(%s) has not attached to a scene.",this.name,this.uuid):this._scene=this._parent._scene},e.attr=function(t){Ht(this,t)},e.getParent=function(){return this._parent},e.modifyParent=function(t){this._parent=t},e.setParent=function(t,e){if(void 0===e&&(e=!1),e&&this.updateWorldTransform(),this._parent!==t){var i=this._parent,n=t;if(this._parent=n,this._siblingIndex=0,this._onSetParent(i,e),this.emit&&this.emit(um.PARENT_CHANGED,i),i&&!(i._objFlags&xm)){var r=i._children.indexOf(this);i._children.splice(r,1),i._updateSiblingIndex(),i.emit&&i.emit(um.CHILD_REMOVED,this)}n&&(n._children.push(this),this._siblingIndex=n._children.length-1,n.emit&&n.emit(um.CHILD_ADDED,this)),this._onHierarchyChanged(i)}},e.getChildByUuid=function(t){if(!t)return k("Invalid uuid"),null;for(var e=this._children,i=0,n=e.length;i0?(h=s,r=s._children,a=0,o[n]=r[a],n++):(o[n]=s,n++,u=!0);o.length=0,i._stackId--},e.removeFromParent=function(){this._parent&&this._parent.removeChild(this)},e.removeChild=function(t){this._children.indexOf(t)>-1&&(t.parent=null)},e.removeAllChildren=function(){for(var t=this._children,e=t.length-1;e>=0;e--){var i=t[e];i&&(i.parent=null)}this._children.length=0},e.isChildOf=function(t){var e=this;do{if(e===t)return!0;e=e._parent}while(e);return!1},e.getComponent=function(t){var e=Mm(t);return e?i._findComponent(this,e):null},e.getComponents=function(t){var e=Mm(t),n=[];return e&&i._findComponents(this,e,n),n},e.getComponentInChildren=function(t){var e=Mm(t);return e?i._findChildComponent(this._children,e):null},e.getComponentsInChildren=function(t){var e=Mm(t),n=[];return e&&(i._findComponents(this,e,n),i._findChildComponents(this._children,e,n)),n},e.addComponent=function(t){var e;if("string"==typeof t){if(!(e=ie(t)))throw v._RF.peek()&&Z(3808,t),TypeError(et(3807,t))}else{if(!t)throw TypeError(et(3804));e=t}if("function"!=typeof e)throw TypeError(et(3809));if(!Wt(e,v.Component))throw TypeError(et(3810));var i=e._requireComponent;if(i)if(Array.isArray(i))for(var n=0;n=0;){if(a=(e=Qm[n--]).hasChangedFlags,e.isValid&&(e._transformFlags&a&t)!==t)for(e._transformFlags|=t,e.hasChangedFlags=a|t,s=(i=e._children).length,r=0;r=0;)hn.transformInverseRTS(t,t,i._lrot,i._lpos,i._lscale),i=Qm[--n];return t},e.setWorldPosition=function(t,e,i){void 0===e||void 0===i?hn.copy(this._pos,t):hn.set(this._pos,t,e,i);var n=this._parent,r=this._lpos;n?(n.updateWorldTransform(),hn.transformMat4(r,this._pos,Dn.invert(Km,n._mat))):hn.copy(r,this._pos),this.invalidateChildren(om.POSITION),1&this._eventMask&&this.emit(um.TRANSFORM_CHANGED,om.POSITION)},e.getWorldPosition=function(t){return this.updateWorldTransform(),t?hn.copy(t,this._pos):hn.copy(new hn,this._pos)},e.setWorldRotation=function(t,e,i,n){void 0===e||void 0===i||void 0===n?En.copy(this._rot,t):En.set(this._rot,t,e,i,n),this._parent?(this._parent.updateWorldTransform(),En.multiply(this._lrot,En.conjugate(this._lrot,this._parent._rot),this._rot)):En.copy(this._lrot,this._rot),this._eulerDirty=!0,this.invalidateChildren(om.ROTATION),1&this._eventMask&&this.emit(um.TRANSFORM_CHANGED,om.ROTATION)},e.setWorldRotationFromEuler=function(t,e,i){En.fromEuler(this._rot,t,e,i),this._parent?(this._parent.updateWorldTransform(),En.multiply(this._lrot,En.conjugate(this._lrot,this._parent._rot),this._rot)):En.copy(this._lrot,this._rot),this._eulerDirty=!0,this.invalidateChildren(om.ROTATION),1&this._eventMask&&this.emit(um.TRANSFORM_CHANGED,om.ROTATION)},e.getWorldRotation=function(t){return this.updateWorldTransform(),t?En.copy(t,this._rot):En.copy(new En,this._rot)},e.setWorldScale=function(t,e,i){var n=this._parent;n&&this.updateWorldTransform(),void 0===e||void 0===i?hn.copy(this._scale,t):hn.set(this._scale,t,e,i),n?(Pm.x=this._scale.x/hn.set(Bm,this._mat.m00,this._mat.m01,this._mat.m02).length(),Pm.y=this._scale.y/hn.set(Bm,this._mat.m04,this._mat.m05,this._mat.m06).length(),Pm.z=this._scale.z/hn.set(Bm,this._mat.m08,this._mat.m09,this._mat.m10).length(),Dn.scale(Km,this._mat,Pm),Dn.multiply(qm,Dn.invert(qm,n._mat),Km),vn.fromQuat(km,En.conjugate(Fm,this._lrot)),vn.multiplyMat4(km,km,qm),this._lscale.x=hn.set(Pm,km.m00,km.m01,km.m02).length(),this._lscale.y=hn.set(Pm,km.m03,km.m04,km.m05).length(),this._lscale.z=hn.set(Pm,km.m06,km.m07,km.m08).length()):hn.copy(this._lscale,this._scale),this.invalidateChildren(om.SCALE),1&this._eventMask&&this.emit(um.TRANSFORM_CHANGED,om.SCALE)},e.getWorldScale=function(t){return this.updateWorldTransform(),t?hn.copy(t,this._scale):hn.copy(new hn,this._scale)},e.getWorldMatrix=function(t){this.updateWorldTransform();var e=t||new Dn;return Dn.copy(e,this._mat)},e.getWorldRS=function(t){this.updateWorldTransform();var e=t||new Dn;return Dn.copy(e,this._mat),e.m12=0,e.m13=0,e.m14=0,e},e.getWorldRT=function(t){this.updateWorldTransform();var e=t||new Dn;return Dn.fromRT(e,this._rot,this._pos)},e.setRTS=function(t,e,i){var n=0;t&&(n|=om.ROTATION,void 0!==t.w?(En.copy(this._lrot,t),this._eulerDirty=!0):(hn.copy(this._euler,t),En.fromEuler(this._lrot,t.x,t.y,t.z),this._eulerDirty=!1)),e&&(hn.copy(this._lpos,e),n|=om.POSITION),i&&(hn.copy(this._lscale,i),n|=om.SCALE),n&&(this.invalidateChildren(n),1&this._eventMask&&this.emit(um.TRANSFORM_CHANGED,n))},e.isTransformDirty=function(){return this._transformFlags!==om.NONE},e.pauseSystemEvents=function(t){this._eventProcessor.setEnabled(!1,t)},e.resumeSystemEvents=function(t){this._eventProcessor.setEnabled(!0,t)},i.resetHasChangedFlags=function(){Jm+=1},i.clearNodeArray=function(){i.ClearFrame0},set:function(t){t?this._objFlags|=Im:this._objFlags&=~Im}},{key:"name",get:function(){return this._name},set:function(t){this._name=t}},{key:"uuid",get:function(){return this._id}},{key:"children",get:function(){return this._children}},{key:"active",get:function(){return this._active},set:function(t){if(t=!!t,this._active!==t){this._active=t;var e=this._parent;e&&e._activeInHierarchy&&v.director._nodeActivator.activateNode(this,t)}}},{key:"activeInHierarchy",get:function(){return this._activeInHierarchy}},{key:"parent",get:function(){return this._parent},set:function(t){this.setParent(t)}},{key:"scene",get:function(){return this._scene}},{key:"eventProcessor",get:function(){return this._eventProcessor}},{key:"prefab",get:function(){return this._prefab}},{key:"id",set:function(t){this._id=t}},{key:"siblingIndex",get:function(){return this._siblingIndex},set:function(t){this._siblingIndex=t}},{key:"position",get:function(){return this._lpos},set:function(t){this.setPosition(t)}},{key:"worldPosition",get:function(){return this.updateWorldTransform(),this._pos},set:function(t){this.setWorldPosition(t)}},{key:"rotation",get:function(){return this._lrot},set:function(t){this.setRotation(t)}},{key:"eulerAngles",get:function(){return this._eulerDirty&&(En.toEuler(this._euler,this._lrot),this._eulerDirty=!1),this._euler},set:function(t){this.setRotationFromEuler(t.x,t.y,t.z)}},{key:"angle",get:function(){return this._euler.z},set:function(t){hn.set(this._euler,0,0,t),En.fromAngleZ(this._lrot,t),this._eulerDirty=!1,this.invalidateChildren(om.ROTATION),1&this._eventMask&&this.emit(um.TRANSFORM_CHANGED,om.ROTATION)}},{key:"worldRotation",get:function(){return this.updateWorldTransform(),this._rot},set:function(t){this.setWorldRotation(t)}},{key:"scale",get:function(){return this._lscale},set:function(t){this.setScale(t)}},{key:"worldScale",get:function(){return this.updateWorldTransform(),this._scale},set:function(t){this.setWorldScale(t)}},{key:"matrix",set:function(t){Dn.toRTS(t,this._lrot,this._lpos,this._lscale),this.invalidateChildren(om.TRS),this._eulerDirty=!0,1&this._eventMask&&this.emit(um.TRANSFORM_CHANGED,om.TRS)}},{key:"worldMatrix",get:function(){return this.updateWorldTransform(),this._mat}},{key:"forward",get:function(){return hn.transformQuat(new hn,hn.FORWARD,this.worldRotation)},set:function(t){var e=t.length();hn.multiplyScalar(Pm,t,-1/e),En.fromViewUp(Nm,Pm),this.setWorldRotation(Nm)}},{key:"up",get:function(){return hn.transformQuat(new hn,hn.UP,this.worldRotation)}},{key:"right",get:function(){return hn.transformQuat(new hn,hn.RIGHT,this.worldRotation)}},{key:"mobility",get:function(){return this._mobility},set:function(t){this._mobility=t,this.emit(um.MOBILITY_CHANGED)}},{key:"layer",get:function(){return this._layer},set:function(t){this._layer=t,this._uiProps&&this._uiProps.uiComp&&(this._uiProps.uiComp.setNodeDirty(),this._uiProps.uiComp.markForUpdateRenderData()),this.emit(um.LAYER_CHANGED,this._layer)}},{key:"flagChangedVersion",get:function(){return this._flagChangeVersion}},{key:"hasChangedFlags",get:function(){return this._flagChangeVersion===Jm?this._hasChangedFlags:0},set:function(t){this._flagChangeVersion=Jm,this._hasChangedFlags=t}}]),i}(Wa)).idGenerator=Dm,Cm._stacks=[[]],Cm._stackId=0,Cm.EventType=um,Cm.NodeSpace=am,Cm.TransformDirtyBit=om,Cm.TransformBit=om,Cm.reserveContentsForAllSyncablePrefabTag=Zm,Cm.ClearFrame=0,Cm.ClearRound=1e3,f((fm=Cm).prototype,"_persistNode",[$s],Object.getOwnPropertyDescriptor(fm.prototype,"_persistNode"),fm.prototype),pm=Gs(fm.prototype,"_parent",[ra],(function(){return null})),mm=Gs(fm.prototype,"_children",[ra],(function(){return[]})),gm=Gs(fm.prototype,"_active",[ra],(function(){return!0})),vm=Gs(fm.prototype,"_components",[ra],(function(){return[]})),ym=Gs(fm.prototype,"_prefab",[ra],(function(){return null})),Tm=Gs(fm.prototype,"_lpos",[ra],(function(){return new hn})),Sm=Gs(fm.prototype,"_lrot",[ra],(function(){return new En})),Em=Gs(fm.prototype,"_lscale",[ra],(function(){return new hn(1,1,1)})),Am=Gs(fm.prototype,"_mobility",[ra],(function(){return wm.Static})),Rm=Gs(fm.prototype,"_layer",[ra],(function(){return sm.Enum.DEFAULT})),bm=Gs(fm.prototype,"_euler",[ra],(function(){return new hn})),f(fm.prototype,"eulerAngles",[cm],Object.getOwnPropertyDescriptor(fm.prototype,"eulerAngles"),fm.prototype),f(fm.prototype,"mobility",[_m],Object.getOwnPropertyDescriptor(fm.prototype,"mobility"),fm.prototype),dm=fm))||dm));v.Node=$m,function(t){t[t.right=0]="right",t[t.left=1]="left",t[t.top=2]="top",t[t.bottom=3]="bottom",t[t.front=4]="front",t[t.back=5]="back"}(jm||(jm={})),function(t){t[t.NONE=0]="NONE",t[t.AUTO=1]="AUTO",t[t.BAKED_CONVOLUTION_MAP=2]="BAKED_CONVOLUTION_MAP"}(Ym||(Ym={}));var tg=t("ef",qs("cc.TextureCube")(((Xm=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r0){var i=this._generatedMipmaps[0].front;this.reset({width:i.width,height:i.height,format:i.format,mipmapLevel:this._generatedMipmaps.length,baseLevel:this._baseLevel,maxLevel:this._maxLevel}),this._generatedMipmaps.forEach((function(t,i){eg(t,(function(t,n){e._assignImage(t,i,n)}))}))}else this.reset({width:0,height:0,mipmapLevel:this._generatedMipmaps.length,baseLevel:this._baseLevel,maxLevel:this._maxLevel})},i.isUsingOfflineMipmaps=function(){return this._mipmapMode===Ym.BAKED_CONVOLUTION_MAP},e.fromTexture2DArray=function(t,i){for(var n=[],r=t.length/6,s=0;s=this._generatedMipmaps.length))for(var n=Math.min(void 0===e?this._generatedMipmaps.length:e,this._generatedMipmaps.length-t),r=function(){var e=t+s;eg(i._generatedMipmaps[e],(function(t,n){i._assignImage(t,e,n)}))},s=0;s1&&t.forEach((function(t){var i={front:t.front.extractMipmap0(),back:t.back.extractMipmap0(),left:t.left.extractMipmap0(),right:t.right.extractMipmap0(),top:t.top.extractMipmap0(),bottom:t.bottom.extractMipmap0()};e.push(i)}));this._setMipmapParams(e)}},{key:"mipmapAtlas",get:function(){return this._mipmapAtlas},set:function(t){var e=this;if(this._mipmapAtlas=t,this._mipmapAtlas){var i=this._mipmapAtlas.atlas.front;if(i.data){var n=this._mipmapAtlas.atlas,r=this._mipmapAtlas.layout,s=r[0],a=Object.assign(T.document.createElement("canvas"),{width:i.width,height:i.height}).getContext("2d");this.reset({width:s.width,height:s.height,format:i.format,mipmapLevel:r.length});for(var o=function(){var t=r[h];eg(n,(function(n,r){a.clearRect(0,0,i.width,i.height);var s=n.data;a.drawImage(s,0,0);var o=a.getImageData(t.left,t.top,t.width,t.height),h=new Df({_data:o.data,_compressed:n.isCompressed,width:o.width,height:o.height,format:n.format});e._assignImage(h,t.level,r)}))},h=0;h>>26},uy=function(t){return(t&sy)>>>20},ly=function(t){return(t&ay)>>>12},cy=function(t){return 4095&t},_y=function(t,e){return 67108863&t|e<<26&ry},dy=((qv={})[Kl.UNKNOWN]=function(t,e,i){return void 0===i&&(i=0),q(12010,i)},qv[Kl.INT]=function(t,e,i){return void 0===i&&(i=0),t[i]},qv[Kl.INT2]=function(t,e,i){return void 0===i&&(i=0),Fn.fromArray(e,t,i)},qv[Kl.INT3]=function(t,e,i){return void 0===i&&(i=0),hn.fromArray(e,t,i)},qv[Kl.INT4]=function(t,e,i){return void 0===i&&(i=0),nn.fromArray(e,t,i)},qv[Kl.FLOAT]=function(t,e,i){return void 0===i&&(i=0),t[i]},qv[Kl.FLOAT2]=function(t,e,i){return void 0===i&&(i=0),Fn.fromArray(e,t,i)},qv[Kl.FLOAT3]=function(t,e,i){return void 0===i&&(i=0),hn.fromArray(e,t,i)},qv[Kl.FLOAT4]=function(t,e,i){return void 0===i&&(i=0),nn.fromArray(e,t,i)},qv[Kl.MAT3]=function(t,e,i){return void 0===i&&(i=0),vn.fromArray(e,t,i)},qv[Kl.MAT4]=function(t,e,i){return void 0===i&&(i=0),Dn.fromArray(e,t,i)},qv),fy=((Qv={})[Kl.UNKNOWN]=function(t,e,i){return void 0===i&&(i=0),q(12010,i)},Qv[Kl.INT]=function(t,e,i){return void 0===i&&(i=0),t[i]=e},Qv[Kl.INT2]=function(t,e,i){return void 0===i&&(i=0),Fn.toArray(t,e,i)},Qv[Kl.INT3]=function(t,e,i){return void 0===i&&(i=0),hn.toArray(t,e,i)},Qv[Kl.INT4]=function(t,e,i){return void 0===i&&(i=0),nn.toArray(t,e,i)},Qv[Kl.FLOAT]=function(t,e,i){return void 0===i&&(i=0),t[i]=e},Qv[Kl.FLOAT2]=function(t,e,i){return void 0===i&&(i=0),Fn.toArray(t,e,i)},Qv[Kl.FLOAT3]=function(t,e,i){return void 0===i&&(i=0),hn.toArray(t,e,i)},Qv[Kl.FLOAT4]=function(t,e,i){return void 0===i&&(i=0),nn.toArray(t,e,i)},Qv[Kl.MAT3]=function(t,e,i){return void 0===i&&(i=0),vn.toArray(t,e,i)},Qv[Kl.MAT4]=function(t,e,i){return void 0===i&&(i=0),Dn.toArray(t,e,i)},Qv),py=((Zv={})[Kl.INT]=function(t){return"number"==typeof t},Zv[Kl.FLOAT]=function(t){return"number"==typeof t},Zv[Kl.INT2]=function(t){return!!(t instanceof Fn)},Zv[Kl.FLOAT2]=function(t){return!!(t instanceof Fn)},Zv[Kl.INT3]=function(t){return!!(t instanceof hn)},Zv[Kl.FLOAT3]=function(t){return!!(t instanceof hn)},Zv[Kl.INT4]=function(t){return!!(t instanceof nn)},Zv[Kl.FLOAT4]=function(t){return!!(t instanceof nn||t instanceof pn||t instanceof En)},Zv[Kl.MAT3]=function(t){return!!(t instanceof vn)},Zv[Kl.MAT4]=function(t){return!!(t instanceof Dn)},Zv),my=[Object.freeze([0]),Object.freeze([0,0]),Object.freeze([0,0,0,0]),Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])];function gy(t){switch(t){case Kl.BOOL:case Kl.INT:case Kl.UINT:case Kl.FLOAT:return my[0];case Kl.BOOL2:case Kl.INT2:case Kl.UINT2:case Kl.FLOAT2:return my[1];case Kl.BOOL4:case Kl.INT4:case Kl.UINT4:case Kl.FLOAT4:return my[2];case Kl.MAT4:return my[3];case Kl.SAMPLER2D:return"default-texture";case Kl.SAMPLER_CUBE:return"default-cube-texture";case Kl.SAMPLER2D_ARRAY:return"default-array-texture";case Kl.SAMPLER3D:return"default-3d-texture"}return my[0]}function vy(t){switch(t){case Kl.SAMPLER2D:return"-texture";case Kl.SAMPLER_CUBE:return"-cube-texture";case Kl.SAMPLER2D_ARRAY:return"-array-texture";case Kl.SAMPLER3D:return"-3d-texture";default:return"-unknown"}}function yy(t,e){for(var i=Object.entries(e),n=!1,r=0;r31&&(t.uber=!0),t.constantMacros="",t.builtins.statistics)t.constantMacros+="#define "+r+" "+t.builtins.statistics[r]+"\n"}(i),this._templates[t.name]=i,!this._templateInfos[i.hash]){var n={};n.samplerStartBinding=i.blocks.length,n.shaderInfo=new d_,n.blockSizes=[],n.bindings=[];for(var s=0;s>2)*o.count}for(var h=0;h0&&this.shaders.length>0},e}(uf))._effects={},By._layoutValid=!0,Oy=Gs((Iy=By).prototype,"techniques",[ra],(function(){return[]})),Dy=Gs(Iy.prototype,"shaders",[ra],(function(){return[]})),My=Gs(Iy.prototype,"combinations",[ra],(function(){return[]})),Py=Gs(Iy.prototype,"hideInEditor",[ra,aa],(function(){return!1})),xy=Iy))||xy);v.EffectAsset=Fy;var ky=function(){function t(){this.name="",this.base="",this.importBase="",this.nativeBase="",this.deps=null,this.assetInfos=new Dd,this.scenes=new Dd,this.paths=new Dd}var e=t.prototype;return e.init=function(t){var e=this;!function(t){var e=t.uuids,i=t.paths,n=t.types,r=t.deps,s=t.paths=Object.create(null);if(!1===t.debug){for(var a=0,o=e.length;ae.length)||47===t.charCodeAt(e.length)}(r,t)||!t)for(var s=0,a=i.length;s0&&function(t){var e=Object.create(null);if(e[t._uuid]=t.refCount,zy(t,e,Vy,-1),Vy.length=0,0!==e[t._uuid])return e[t._uuid];for(var i in e)0!==e[i]&&zy(Bd.get(i),e,Vy,1);return Vy.length=0,e[t._uuid]}(t)>0)){Bd.remove(i);for(var n=jp.getDeps(i),r=0,s=n.length;rthis._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._totalNum0&&(Le(this._handleQueue.bind(this),t,e),this._checkNextPeriod=!0)},n(e,[{key:"remoteServerAddress",get:function(){return this._remoteServerAddress}}],[{key:"instance",get:function(){return e._instance||(e._instance=new e),e._instance}}]),e}();vT._instance=void 0;var yT,TT,ST,ET,AT,RT,bT=vT.instance,CT=vT.instance,wT=t("ec",qs("cc.JsonAsset")((TT=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r0){var a=Wd.create({input:s,progress:r,options:n,onProgress:t.onProgress,onError:Wd.prototype.recycle,onComplete:function(n){var r;n||((r=t.output).push.apply(r,a.output),a.recycle()),i&&HT(t),e(n)}});Ud.async(a)}else i&&HT(t),e()}))}function HT(t){for(var e=t.output,i=0,n=e.length;i0&&(this.downloader.maxConcurrency=r),this._files.clear(),this._parsed.clear(),this._releaseManager.init(),this.assets.clear(),this.bundles.clear(),this.packManager.init(),this.downloader.init(e,i,n),this.parser.init(),this.dependUtil.init();var s=t.importBase||be.querySettings(Re.Category.ASSETS,"importBase")||"";s&&s.endsWith("/")&&(s=s.substr(0,s.length-1));var a=t.nativeBase||be.querySettings(Re.Category.ASSETS,"nativeBase")||"";a&&a.endsWith("/")&&(a=a.substr(0,a.length-1)),this.generalImportBase=s,this.generalNativeBase=a,this._projectBundles=be.querySettings(Re.Category.ASSETS,"projectBundles")||[];var o=be.querySettings(Re.Category.ASSETS,"assetsOverrides")||{};for(var h in o)this.assetsOverrideMap.set(h,o[h])},e.getBundle=function(t){return Fd.get(t)||null},e.removeBundle=function(t){t._destroy(),Fd.remove(t.name)},e.loadAny=function(t,e,i,n){var r=Jy(e,i,n),s=r.options,a=r.onProgress,o=r.onComplete;s.preset=s.preset||"default",t=Array.isArray(t)?t.slice():t;var h=Wd.create({input:t,onProgress:a,onComplete:eT(o),options:s});kd.async(h)},e.preloadAny=function(t,e,i,n){var r=Jy(e,i,n),s=r.options,a=r.onProgress,o=r.onComplete;s.preset=s.preset||"preload",t=Array.isArray(t)?t.slice():t;var h=Wd.create({input:t,onProgress:a,onComplete:eT(o),options:s});Ud.async(h)},e.loadRemote=function(t,e,i){var n=Jy(e,void 0,i),r=n.options,s=n.onComplete;r.reloadAsset||!this.assets.has(t)?(r.__isNative__=!0,r.preset=r.preset||"remote",this.loadAny({url:t},r,null,(function(e,i){e?(G(e.message,e.stack),s&&s(e,i)):kT.create(t,i,r.ext||cl(t),r,(function(t,e){s&&s(t,e)}))}))):eT(s)(null,this.assets.get(t))},e.loadBundle=function(t,e,i){var n=Jy(e,void 0,i),r=n.options,s=n.onComplete,a=dl(t);this.bundles.has(a)?eT(s)(null,this.getBundle(a)):(r.preset=r.preset||"bundle",r.ext="bundle",r.__isNative__=!0,this.loadAny({url:t},r,null,(function(e,i){e?(G(e.message,e.stack),s&&s(e,i)):kT.create(t,i,"bundle",r,(function(t,e){s&&s(t,e)}))})))},e.releaseAsset=function(t){Wy.tryRelease(t,!0)},e.releaseUnusedAssets=function(){Bd.forEach((function(t){Wy.tryRelease(t)}))},e.releaseAll=function(){Bd.forEach((function(t){Wy.tryRelease(t,!0)}))},e.loadWithJson=function(){throw new Error("Only valid in Editor")},n(t,[{key:"main",get:function(){return Fd.get(zd.MAIN)||null}},{key:"resources",get:function(){return Fd.get(zd.RESOURCES)||null}}],[{key:"instance",get:function(){return this._instance||(this._instance=new t),this._instance}}]),t}());tS._instance=void 0,tS.Pipeline=Md,tS.Task=Wd,tS.Cache=Dd,tS.RequestItem=KT,tS.Bundle=iT,tS.BuiltinBundleName=zd,tS.CacheManager=function(){this.cacheDir=void 0,this.cacheEnabled=void 0,this.autoClear=void 0,this.cacheInterval=void 0,this.deleteInterval=void 0,this.cachedFiles=void 0},tS.Downloader=vT,tS.Parser=VT,tS.DependUtil=Wp;var eS=t("em",v.assetManager=tS.instance);v.AssetManager=tS;var iS,nS,rS,sS=t("et",function(){function t(){this._resources={},this._materialsToBeCompiled=[]}var e=t.prototype;return e.init=function(){for(var t=this._resources,e=new Uint8Array(16),i=new Uint8Array(16),n=new Uint8Array(16),r=new Uint8Array(16),s=new Uint8Array(16),a=0,o=0;o<4;o++)e[a]=0,e[a+1]=0,e[a+2]=0,e[a+3]=255,i[a]=0,i[a+1]=0,i[a+2]=0,i[a+3]=0,n[a]=119,n[a+1]=119,n[a+2]=119,n[a+3]=255,r[a]=255,r[a+1]=255,r[a+2]=255,r[a+3]=255,s[a]=127,s[a+1]=127,s[a+2]=255,s[a+3]=255,a+=4;var h=new Uint8Array(1024);a=0;for(var u=0;u<256;u++)h[a]=221,h[a+1]=221,h[a+2]=221,h[a+3]=255,a+=4;a=0;for(var l=0;l<8;l++){for(var c=0;c<8;c++)h[a]=85,h[a+1]=85,h[a+2]=85,h[a+3]=255,a+=4;a+=32}a+=32;for(var _=0;_<8;_++){for(var d=0;d<8;d++)h[a]=85,h[a+1]=85,h[a+2]=85,h[a+3]=255,a+=4;a+=32}var f={width:2,height:2,_data:e,_compressed:!1,format:em.PixelFormat.RGBA8888},p={width:2,height:2,_data:i,_compressed:!1,format:em.PixelFormat.RGBA8888},m={width:2,height:2,_data:n,_compressed:!1,format:em.PixelFormat.RGBA8888},g={width:2,height:2,_data:r,_compressed:!1,format:em.PixelFormat.RGBA8888},y={width:2,height:2,_data:s,_compressed:!1,format:em.PixelFormat.RGBA8888},T={width:16,height:16,_data:h,_compressed:!1,format:em.PixelFormat.RGBA8888},S=new Df(f),E=new em;E._uuid="black-texture",E.image=S,t[E._uuid]=E;var A=new Df(p),R=new em;R._uuid="empty-texture",R.image=A,t[R._uuid]=R;var b=new tg;b._uuid="black-cube-texture",b.setMipFilter(tg.Filter.NEAREST),b.image={front:new Df(f),back:new Df(f),left:new Df(f),right:new Df(f),top:new Df(f),bottom:new Df(f)},t[b._uuid]=b;var C=new Df(m),w=new em;w._uuid="grey-texture",w.image=C,t[w._uuid]=w;var x=new tg;x._uuid="grey-cube-texture",x.setMipFilter(tg.Filter.NEAREST),x.image={front:new Df(m),back:new Df(m),left:new Df(m),right:new Df(m),top:new Df(m),bottom:new Df(m)},t[x._uuid]=x;var I=new Df(g),O=new em;O._uuid="white-texture",O.image=I,t[O._uuid]=O;var D=new tg;D._uuid="white-cube-texture",D.setMipFilter(tg.Filter.NEAREST),D.image={front:new Df(g),back:new Df(g),left:new Df(g),right:new Df(g),top:new Df(g),bottom:new Df(g)},t[D._uuid]=D;var M=new Df(y),P=new em;P._uuid="normal-texture",P.image=M,t[P._uuid]=P;var B=new Df(T),N=new em;N._uuid="default-texture",N.image=B,t[N._uuid]=N;var L=new tg;if(L.setMipFilter(tg.Filter.NEAREST),L._uuid="default-cube-texture",L.image={front:new Df(T),back:new Df(T),left:new Df(T),right:new Df(T),top:new Df(T),bottom:new Df(T)},t[L._uuid]=L,v.SpriteFrame){var F=new v.SpriteFrame,k=S,U=new em;U.image=k,F.texture=U,F._uuid="default-spriteframe",t[F._uuid]=F}},e.addAsset=function(t,e){this._resources[t]=e},e.get=function(t){return this._resources[t]},e.loadBuiltinAssets=function(){var t=this,e=be.querySettings(Re.Category.ENGINE,"builtinAssets");if(!e)return Promise.resolve();var i=this._resources;return new Promise((function(n,r){eS.loadBundle(zd.INTERNAL,(function(s){s?r(s):eS.loadAny(e,(function(e,s){e?r(e):(s.forEach((function(e){i[e.name]=e,Wy.addIgnoredAsset(e),e instanceof v.Material&&t._materialsToBeCompiled.push(e)})),n())}))}))}))},e.compileBuiltinMaterial=function(){for(var t=0;t=1024)&&m.lightingMap.objectID===a.objectID&&m.useReflectionProbeType===l&&m.reflectionProbeCubemap.objectID===o.objectID&&m.reflectionProbePlanarMap.objectID===h.objectID&&m.reflectionProbeBlendCubemap.objectID===u.objectID&&m.stride===r){if(m.count>=m.capacity){m.capacity<<=1;var g=m.stride*m.capacity,v=m.data;m.data=new Uint8Array(g),m.data.set(v),m.vb.resize(g)}return m.shader=c,m.descriptorSet=_,m.data.set(n.buffer,m.stride*m.count++),void(this.hasPendingModels=!0)}}for(var y=this._device.createBuffer(new qc(ql.VERTEX|ql.TRANSFER_DST,Jl.HOST|Jl.DEVICE,32*r,r)),T=new Uint8Array(32*r),S=s.vertexBuffers.slice(),E=s.attributes.slice(),A=s.indexBuffer,R=0;R>2,a=this._getBlockView(r,n),o=t.getOffsetFromHandle(e),h=0;h>2)*a,c=0;c+u.length<=l;c+=u.length)o.set(u,s+c);this._rootBufferDirty=!0}},e.resetTexture=function(e,i){var n=this.getHandle(e);if(n){var r,s=t.getTypeFromHandle(n),a=t.getBindingFromHandle(n),o=this._properties[e],h=o&&o.value,u=(r="string"==typeof h?aS.get(""+h+vy(s)):h||aS.get(gy(s)))&&r.getGFXTexture(),l=o&&void 0!==o.samplerHash?fd.unpackFromHash(o.samplerHash):r&&r.getSamplerInfo(),c=this._device.getSampler(l);this._descriptorSet.bindSampler(a,c,i||0),this._descriptorSet.bindTexture(a,u,i||0)}},e.resetUBOs=function(){for(var t=0;t>2)*r.count,u=0;u+o.length<=h;u+=o.length)s.set(o,i+u);i+=h}this._rootBufferDirty=!0},e.resetTextures=function(){if(v.rendering)for(var t,e=d(this._shaderInfo.descriptors[xg.MATERIAL].samplerTextures);!(t=e()).done;)for(var i=t.value,n=0;n=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=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;i0},n(e,[{key:"effectAsset",get:function(){return this._effectAsset}},{key:"effectName",get:function(){return this._effectAsset?this._effectAsset.name:""}},{key:"technique",get:function(){return this._techIdx}},{key:"passes",get:function(){return this._passes}},{key:"hash",get:function(){return this._hash}},{key:"parent",get:function(){return null}},{key:"owner",get:function(){return null}}]),e}(uf),SS=Gs(TS.prototype,"_effectAsset",[vS],(function(){return null})),ES=Gs(TS.prototype,"_techIdx",[ra],(function(){return 0})),AS=Gs(TS.prototype,"_defines",[ra],(function(){return[]})),RS=Gs(TS.prototype,"_states",[ra],(function(){return[]})),bS=Gs(TS.prototype,"_props",[ra],(function(){return[]})),yS=TS))||yS));v.Material=OS;var DS=ve({Low_256x256:256,Medium_512x512:512,High_1024x1024:1024,Ultra_2048x2048:2048}),MS=ve({Planar:0,ShadowMap:1}),PS=ve({HARD:0,SOFT:1,SOFT_2X:2,SOFT_4X:3}),BS=ve({LEVEL_1:1,LEVEL_2:2,LEVEL_3:3,LEVEL_4:4}),NS=ve({NONE:1,RemoveDuplicates:2,DisableRotationFix:3}),LS=MS.ShadowMap+1,FS=function(){function t(){this.fixedSphere=new yr(0,0,0,.01),this.maxReceived=4,this._matLight=new Dn,this._material=null,this._instancingMaterial=null,this._enabled=!1,this._type=LS,this._distance=0,this._planeBias=1,this._normal=new hn(0,1,0),this._shadowColor=new pn(0,0,0,76),this._size=new Fn(1024,1024),this._shadowMapDirty=!1}var e=t.prototype;return e.getPlanarShader=function(t){this._material||(this._material=new OS,this._material.initialize({effectName:"pipeline/planar-shadow"}));var e=this._material.passes;return e.length>0?e[0].getShaderVariant(t):null},e.initialize=function(t){this._enabled=t.enabled,this._type=this.enabled?t.type:LS,this.normal=t.planeDirection,this.distance=t.planeHeight,this.planeBias=t.planeBias,this.shadowColor=t.shadowColor,this.maxReceived=t.maxReceived,t.shadowMapSize!==this._size.x&&(this.size.set(t.shadowMapSize,t.shadowMapSize),this._shadowMapDirty=!0)},e.activate=function(){if(this._enabled)if(this.type===MS.Planar)this._updatePlanarInfo();else{var t=v.director.root;t.pipeline.macros.CC_SHADOW_TYPE=2,t.onGlobalPipelineStateChanged()}else{var e=v.director.root;e.pipeline.macros.CC_SHADOW_TYPE=0,e.onGlobalPipelineStateChanged()}},e._updatePlanarInfo=function(){this._material||(this._material=new OS,this._material.initialize({effectName:"pipeline/planar-shadow"}));var t=v.director.root;t.pipeline.macros.CC_SHADOW_TYPE=1,t.onGlobalPipelineStateChanged()},e.destroy=function(){this._material&&this._material.destroy(),this._instancingMaterial&&this._instancingMaterial.destroy(),this.fixedSphere.destroy()},n(t,[{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled=t,this.activate()}},{key:"type",get:function(){return this._type},set:function(t){this._type=this.enabled?t:LS,this.activate()}},{key:"normal",get:function(){return this._normal},set:function(t){hn.copy(this._normal,t)}},{key:"distance",get:function(){return this._distance},set:function(t){this._distance=t}},{key:"planeBias",get:function(){return this._planeBias},set:function(t){this._planeBias=t}},{key:"shadowColor",get:function(){return this._shadowColor},set:function(t){this._shadowColor=t}},{key:"size",get:function(){return this._size},set:function(t){this._size.set(t)}},{key:"shadowMapDirty",get:function(){return this._shadowMapDirty},set:function(t){this._shadowMapDirty=t}},{key:"matLight",get:function(){return this._matLight}},{key:"material",get:function(){return this._material}},{key:"instancingMaterial",get:function(){return this._instancingMaterial}}]),t}();FS.MAX_FAR=2e3,FS.COEFFICIENT_OF_EXPANSION=2*Math.sqrt(3),v.Shadows=FS;var kS=function(t){function e(e,i){var n;(n=t.call(this,e.root)||this)._parent=void 0,n._owner=void 0,n._dontNotify=!1,n._parent=e,n._owner=i,n._doInit(n._parent,!0);for(var r=0;r0)for(var h=0;h=0&&s.node.getWritableComponents().splice(a,1)}}}function cC(t,e,i){if(!(e.length<=0))for(var n=null,r=0;r0){var h=o.pop();if(!h)continue;for(var u=0;u0){var g=p.pop();if(!g)return;for(var v=0;vMath.abs(e)?t:-e},e}(zC),YC=function(t){function e(e){var i;return(i=t.call(this)||this).up=void 0,i.down=void 0,i.left=void 0,i.right=void 0,i.xAxis=void 0,i.yAxis=void 0,i.up=e.up,i.down=e.down,i.left=e.left,i.right=e.right,i.xAxis=new jC({positive:i.right,negative:i.left}),i.yAxis=new jC({positive:i.up,negative:i.down}),i}return s(e,t),e.prototype.getValue=function(){return new Fn(this.xAxis.getValue(),this.yAxis.getValue())},e}(VC);!function(t){function e(e){var i;return(i=t.call(this)||this).up=void 0,i.down=void 0,i.left=void 0,i.right=void 0,i.forward=void 0,i.backward=void 0,i.xAxis=void 0,i.yAxis=void 0,i.zAxis=void 0,i.up=e.up,i.down=e.down,i.left=e.left,i.right=e.right,i.forward=e.forward,i.backward=e.backward,i.xAxis=new jC({positive:i.right,negative:i.left}),i.yAxis=new jC({positive:i.up,negative:i.down}),i.zAxis=new jC({positive:i.forward,negative:i.backward}),i}s(e,t),e.prototype.getValue=function(){return new hn(this.xAxis.getValue(),this.yAxis.getValue(),this.zAxis.getValue())}}(WC);var KC,qC=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.getValue=function(){return t.prototype.getValue.call(this)},e}(zC),QC=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(YC),ZC=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(YC),JC=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.getValue=function(){return t.prototype.getValue.call(this)},e}(XC),$C=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.getValue=function(){return t.prototype.getValue.call(this)},e}(WC),tw=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.getValue=function(){return t.prototype.getValue.call(this)},e}(zC),ew="left",iw="right",nw=[];!function(t){t[t.HAND_LEFT=1]="HAND_LEFT",t[t.HAND_RIGHT=4]="HAND_RIGHT",t[t.AIM_LEFT=2]="AIM_LEFT",t[t.AIM_RIGHT=5]="AIM_RIGHT"}(KC||(KC={}));var rw,sw,aw,ow,hw,uw=function(){function t(t){var e;this._buttonNorth=void 0,this._buttonEast=void 0,this._buttonWest=void 0,this._buttonSouth=void 0,this._buttonL1=void 0,this._buttonL2=void 0,this._buttonL3=void 0,this._buttonR1=void 0,this._buttonR2=void 0,this._buttonR3=void 0,this._buttonShare=void 0,this._buttonOptions=void 0,this._dpad=void 0,this._leftStick=void 0,this._rightStick=void 0,this._buttonStart=void 0,this._gripLeft=void 0,this._gripRight=void 0,this._handLeftPosition=void 0,this._handLeftOrientation=void 0,this._handRightPosition=void 0,this._handRightOrientation=void 0,this._aimLeftPosition=void 0,this._aimLeftOrientation=void 0,this._aimRightPosition=void 0,this._aimRightOrientation=void 0,this._deviceId=-1,this._connected=!1,this._webPoseState=((e={})[KC.HAND_LEFT]={position:hn.ZERO,orientation:En.IDENTITY},e[KC.HAND_RIGHT]={position:hn.ZERO,orientation:En.IDENTITY},e[KC.AIM_LEFT]={position:hn.ZERO,orientation:En.IDENTITY},e[KC.AIM_RIGHT]={position:hn.ZERO,orientation:En.IDENTITY},e),this._deviceId=t,this._initInputSource()}t._init=function(){al.hasFeature(rl.EVENT_GAMEPAD)&&t._registerEvent()},t._on=function(e,i,n){t._eventTarget.on(e,i,n)},t._removeInputDevice=function(e){var i=t.all.findIndex((function(t){return t.deviceId===e}));-1!==i&&he(t.all,i)},t._getOrCreateInputDevice=function(e,i){var n=t.all.find((function(t){return t.deviceId===e}));return n||(n=new t(e),t.all.push(n)),n._connected=i,n},t._ensureDirectorDefined=function(e){t._intervalId=setInterval((function(){v.director&&v.Director&&(clearInterval(t._intervalId),t._intervalId=-1,e())}),50)},t._updateGamepadCnt=function(){for(var e=0,i=0,n=t._cachedWebGamepads.length;i.01){a=t._getOrCreateInputDevice(r.index,!0);break}}if(a){e.push(a);continue}for(var c=s.axes,_=0;_.01){a=t._getOrCreateInputDevice(r.index,!0);break}}if(a){e.push(a);continue}}}}t._cachedWebGamepads=i}}},t._scanGamepads=function(){nw.length=0,t._scanWebGamepads(nw),t._scanWebXRGamepads(nw);for(var e=0;e0?{negative:0,positive:e}:t<0?{negative:e,positive:0}:{negative:0,positive:0}},e._updateWebPoseState=function(t){t.code!==KC.HAND_LEFT&&t.code!==KC.AIM_LEFT&&t.code!==KC.HAND_RIGHT&&t.code!==KC.AIM_RIGHT||(this._webPoseState[t.code]={position:new hn(t.position.x,t.position.y,t.position.z),orientation:new En(t.orientation.x,t.orientation.y,t.orientation.z,t.orientation.w)})},e._initInputSource=function(){var e=this;this._buttonNorth=new qC,this._buttonNorth.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(ew);return n&&n.buttons.length>5?n.buttons[5].value:0}var r=t._getWebGamepad(e.deviceId);return r?r.buttons[3].value:0},this._buttonEast=new qC,this._buttonEast.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(iw);return n&&n.buttons.length>5?n.buttons[5].value:0}var r=t._getWebGamepad(e.deviceId);return r?r.buttons[1].value:0},this._buttonWest=new qC,this._buttonWest.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(ew);return n&&n.buttons.length>4?n.buttons[4].value:0}var r=t._getWebGamepad(e.deviceId);return r?r.buttons[2].value:0},this._buttonSouth=new qC,this._buttonSouth.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(iw);return n&&n.buttons.length>4?n.buttons[4].value:0}var r=t._getWebGamepad(e.deviceId);return r?r.buttons[0].value:0},this._buttonL1=new qC,this._buttonL1.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[4].value:0},this._buttonL2=new qC,this._buttonL2.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(ew);return n&&n.buttons.length>0?n.buttons[0].value:0}var r=t._getWebGamepad(e.deviceId);return r?r.buttons[6].value:0},this._buttonL3=new qC,this._buttonL3.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(ew);if(n){if(n.buttons.length>3&&0!==n.buttons[3].value)return n.buttons[3].value;if(n.buttons.length>2&&0!==n.buttons[2].value)return n.buttons[2].value}return 0}var r=t._getWebGamepad(e.deviceId);return r?r.buttons[10].value:0},this._buttonR1=new qC,this._buttonR1.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[5].value:0},this._buttonR2=new qC,this._buttonR2.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(iw);return n&&n.buttons.length>0?n.buttons[0].value:0}var r=t._getWebGamepad(e.deviceId);return r?r.buttons[7].value:0},this._buttonR3=new qC,this._buttonR3.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(iw);if(n){if(n.buttons.length>3&&0!==n.buttons[3].value)return n.buttons[3].value;if(n.buttons.length>2&&0!==n.buttons[2].value)return n.buttons[2].value}return 0}var r=t._getWebGamepad(e.deviceId);return r?r.buttons[11].value:0},this._buttonShare=new qC,this._buttonShare.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[8].value:0},this._buttonOptions=new qC,this._buttonOptions.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[9].value:0};var i=new qC;i.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[12].value:0};var n=new qC;n.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[13].value:0};var r=new qC;r.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[14].value:0};var s=new qC;s.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[15].value:0},this._dpad=new QC({up:i,down:n,left:r,right:s});var a=new qC;a.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(ew);if(n){if(n.axes.length>3&&0!==n.axes[3])return e._axisToButtons(n.axes[3]).negative;if(n.axes.length>1&&0!==n.axes[1])return e._axisToButtons(n.axes[1]).negative}return 0}var r=t._getWebGamepad(e.deviceId);return r?e._axisToButtons(r.axes[1]).negative:0};var o=new qC;o.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(ew);if(n){if(n.axes.length>3&&0!==n.axes[3])return e._axisToButtons(n.axes[3]).positive;if(n.axes.length>1&&0!==n.axes[1])return e._axisToButtons(n.axes[1]).positive}return 0}var r=t._getWebGamepad(e.deviceId);return r?e._axisToButtons(r.axes[1]).positive:0};var h=new qC;h.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(ew);if(n){if(n.axes.length>2&&0!==n.axes[2])return e._axisToButtons(n.axes[2]).negative;if(n.axes.length>0&&0!==n.axes[0])return e._axisToButtons(n.axes[0]).negative}return 0}var r=t._getWebGamepad(e.deviceId);return r?e._axisToButtons(r.axes[0]).negative:0};var u=new qC;u.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(ew);if(n){if(n.axes.length>2&&0!==n.axes[2])return e._axisToButtons(n.axes[2]).positive;if(n.axes.length>0&&0!==n.axes[0])return e._axisToButtons(n.axes[0]).positive}return 0}var r=t._getWebGamepad(e.deviceId);return r?e._axisToButtons(r.axes[0]).positive:0},this._leftStick=new ZC({up:a,down:o,left:h,right:u});var l=new qC;l.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(iw);if(n){if(n.axes.length>3&&0!==n.axes[3])return e._axisToButtons(n.axes[3]).negative;if(n.axes.length>1&&0!==n.axes[1])return e._axisToButtons(n.axes[1]).negative}return 0}var r=t._getWebGamepad(e.deviceId);return r?e._axisToButtons(r.axes[3]).negative:0};var c=new qC;c.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(iw);if(n){if(n.axes.length>3&&0!==n.axes[3])return e._axisToButtons(n.axes[3]).positive;if(n.axes.length>1&&0!==n.axes[1])return e._axisToButtons(n.axes[1]).positive}return 0}var r=t._getWebGamepad(e.deviceId);return r?e._axisToButtons(r.axes[3]).positive:0};var _=new qC;_.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(iw);if(n){if(n.axes.length>2&&0!==n.axes[2])return e._axisToButtons(n.axes[2]).negative;if(n.axes.length>0&&0!==n.axes[0])return e._axisToButtons(n.axes[0]).negative}return 0}var r=t._getWebGamepad(e.deviceId);return r?e._axisToButtons(r.axes[2]).negative:0};var d=new qC;d.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(iw);if(n){if(n.axes.length>2&&0!==n.axes[2])return e._axisToButtons(n.axes[2]).positive;if(n.axes.length>0&&0!==n.axes[0])return e._axisToButtons(n.axes[0]).positive}return 0}var r=t._getWebGamepad(e.deviceId);return r?e._axisToButtons(r.axes[2]).positive:0},this._rightStick=new ZC({up:l,down:c,left:_,right:d}),this._buttonStart=new qC,this._buttonStart.getValue=function(){return 0},this._gripLeft=new qC,this._gripLeft.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(ew);if(n&&n.buttons.length>1)return n.buttons[1].value}return 0},this._gripRight=new qC,this._gripRight.getValue=function(){if(-1===e.deviceId){var i,n=null===(i=t._getWebXRGamepadMap())||void 0===i?void 0:i.get(iw);if(n&&n.buttons.length>1)return n.buttons[1].value}return 0},this._handLeftPosition=new $C,this._handLeftPosition.getValue=function(){return e._webPoseState[KC.HAND_LEFT].position},this._handLeftOrientation=new JC,this._handLeftOrientation.getValue=function(){return e._webPoseState[KC.HAND_LEFT].orientation},this._handRightPosition=new $C,this._handRightPosition.getValue=function(){return e._webPoseState[KC.HAND_RIGHT].position},this._handRightOrientation=new JC,this._handRightOrientation.getValue=function(){return e._webPoseState[KC.HAND_RIGHT].orientation},this._aimLeftPosition=new $C,this._aimLeftPosition.getValue=function(){return e._webPoseState[KC.AIM_LEFT].position},this._aimLeftOrientation=new JC,this._aimLeftOrientation.getValue=function(){return e._webPoseState[KC.AIM_LEFT].orientation},this._aimRightPosition=new $C,this._aimRightPosition.getValue=function(){return e._webPoseState[KC.AIM_RIGHT].position},this._aimRightOrientation=new JC,this._aimRightOrientation.getValue=function(){return e._webPoseState[KC.AIM_RIGHT].orientation}},n(t,[{key:"buttonNorth",get:function(){return this._buttonNorth}},{key:"buttonEast",get:function(){return this._buttonEast}},{key:"buttonWest",get:function(){return this._buttonWest}},{key:"buttonSouth",get:function(){return this._buttonSouth}},{key:"buttonL1",get:function(){return this._buttonL1}},{key:"buttonL2",get:function(){return this._buttonL2}},{key:"buttonL3",get:function(){return this._buttonL3}},{key:"buttonR1",get:function(){return this._buttonR1}},{key:"buttonR2",get:function(){return this._buttonR2}},{key:"buttonR3",get:function(){return this._buttonR3}},{key:"buttonShare",get:function(){return this._buttonShare}},{key:"buttonOptions",get:function(){return this._buttonOptions}},{key:"dpad",get:function(){return this._dpad}},{key:"leftStick",get:function(){return this._leftStick}},{key:"rightStick",get:function(){return this._rightStick}},{key:"buttonStart",get:function(){return this._buttonStart}},{key:"gripLeft",get:function(){return this._gripLeft}},{key:"gripRight",get:function(){return this._gripRight}},{key:"handLeftPosition",get:function(){return this._handLeftPosition}},{key:"handLeftOrientation",get:function(){return this._handLeftOrientation}},{key:"handRightPosition",get:function(){return this._handRightPosition}},{key:"handRightOrientation",get:function(){return this._handRightOrientation}},{key:"aimLeftPosition",get:function(){return this._aimLeftPosition}},{key:"aimLeftOrientation",get:function(){return this._aimLeftOrientation}},{key:"aimRightPosition",get:function(){return this._aimRightPosition}},{key:"aimRightOrientation",get:function(){return this._aimRightOrientation}},{key:"deviceId",get:function(){return this._deviceId}},{key:"connected",get:function(){return this._connected}}]),t}();uw.all=[],uw.xr=null,uw._eventTarget=new Ju,uw._cachedWebGamepads=[],uw._cachedWebXRGamepadMap=null,uw._intervalId=-1,uw._totalGamepadCnt=0,function(t){t[t.BUTTON_EAST=0]="BUTTON_EAST",t[t.BUTTON_SOUTH=1]="BUTTON_SOUTH",t[t.BUTTON_WEST=2]="BUTTON_WEST",t[t.BUTTON_NORTH=3]="BUTTON_NORTH",t[t.BUTTON_TRIGGER_LEFT=4]="BUTTON_TRIGGER_LEFT",t[t.BUTTON_TRIGGER_RIGHT=5]="BUTTON_TRIGGER_RIGHT",t[t.TRIGGER_LEFT=6]="TRIGGER_LEFT",t[t.TRIGGER_RIGHT=7]="TRIGGER_RIGHT",t[t.GRIP_LEFT=8]="GRIP_LEFT",t[t.GRIP_RIGHT=9]="GRIP_RIGHT",t[t.BUTTON_LEFT_STICK=10]="BUTTON_LEFT_STICK",t[t.LEFT_STICK_UP=11]="LEFT_STICK_UP",t[t.LEFT_STICK_DOWN=12]="LEFT_STICK_DOWN",t[t.LEFT_STICK_LEFT=13]="LEFT_STICK_LEFT",t[t.LEFT_STICK_RIGHT=14]="LEFT_STICK_RIGHT",t[t.BUTTON_RIGHT_STICK=15]="BUTTON_RIGHT_STICK",t[t.RIGHT_STICK_UP=16]="RIGHT_STICK_UP",t[t.RIGHT_STICK_DOWN=17]="RIGHT_STICK_DOWN",t[t.RIGHT_STICK_LEFT=18]="RIGHT_STICK_LEFT",t[t.RIGHT_STICK_RIGHT=19]="RIGHT_STICK_RIGHT",t[t.ROKID_MENU=20]="ROKID_MENU",t[t.ROKID_START=21]="ROKID_START"}(rw||(rw={})),function(t){t[t.KET_CLICK=0]="KET_CLICK",t[t.KET_STICK=1]="KET_STICK",t[t.KET_GRAB=2]="KET_GRAB",t[t.KET_TOUCH=3]="KET_TOUCH"}(sw||(sw={})),function(t){t[t.UNDEFINE=0]="UNDEFINE",t[t.A=1]="A",t[t.B=2]="B",t[t.X=3]="X",t[t.Y=4]="Y",t[t.L1=5]="L1",t[t.R1=6]="R1",t[t.MINUS=7]="MINUS",t[t.PLUS=8]="PLUS",t[t.L3=9]="L3",t[t.R3=10]="R3",t[t.MENU=11]="MENU",t[t.START=12]="START",t[t.TRIGGER_LEFT=13]="TRIGGER_LEFT",t[t.TRIGGER_RIGHT=14]="TRIGGER_RIGHT"}(aw||(aw={})),function(t){t[t.UNDEFINE=0]="UNDEFINE",t[t.X=1]="X",t[t.Y=2]="Y",t[t.LEFT_STICK_X=3]="LEFT_STICK_X",t[t.LEFT_STICK_Y=4]="LEFT_STICK_Y",t[t.RIGHT_STICK_X=5]="RIGHT_STICK_X",t[t.RIGHT_STICK_Y=6]="RIGHT_STICK_Y",t[t.L2=7]="L2",t[t.R2=8]="R2",t[t.LEFT_GRIP=9]="LEFT_GRIP",t[t.RIGHT_GRIP=10]="RIGHT_GRIP"}(ow||(ow={})),function(t){t[t.UNDEFINE=0]="UNDEFINE",t[t.A=1]="A",t[t.B=2]="B",t[t.X=3]="X",t[t.Y=4]="Y",t[t.LEFT_TRIGGER=5]="LEFT_TRIGGER",t[t.RIGHT_TRIGGER=6]="RIGHT_TRIGGER",t[t.LEFT_THUMBSTICK=7]="LEFT_THUMBSTICK",t[t.RIGHT_THUMBSTICK=8]="RIGHT_THUMBSTICK"}(hw||(hw={}));var lw,cw={1:rw.BUTTON_EAST,2:rw.BUTTON_SOUTH,3:rw.BUTTON_NORTH,4:rw.BUTTON_WEST,9:rw.BUTTON_LEFT_STICK,10:rw.BUTTON_RIGHT_STICK,11:rw.ROKID_MENU,12:rw.ROKID_START,13:rw.BUTTON_TRIGGER_LEFT,14:rw.BUTTON_TRIGGER_RIGHT},_w=function(){function t(){var t,e,i=this;this._eventTarget=new Ju,this._buttonNorth=void 0,this._buttonEast=void 0,this._buttonWest=void 0,this._buttonSouth=void 0,this._buttonTriggerLeft=void 0,this._buttonTriggerRight=void 0,this._triggerLeft=void 0,this._triggerRight=void 0,this._gripLeft=void 0,this._gripRight=void 0,this._leftStick=void 0,this._rightStick=void 0,this._buttonLeftStick=void 0,this._buttonRightStick=void 0,this._buttonOptions=void 0,this._buttonStart=void 0,this._handLeftPosition=void 0,this._handLeftOrientation=void 0,this._handRightPosition=void 0,this._handRightOrientation=void 0,this._aimLeftPosition=void 0,this._aimLeftOrientation=void 0,this._aimRightPosition=void 0,this._aimRightOrientation=void 0,this._touchButtonA=void 0,this._touchButtonB=void 0,this._touchButtonX=void 0,this._touchButtonY=void 0,this._touchButtonTriggerLeft=void 0,this._touchButtonTriggerRight=void 0,this._touchButtonThumbStickLeft=void 0,this._touchButtonThumbStickRight=void 0,this._nativeButtonState=((t={})[rw.BUTTON_SOUTH]=0,t[rw.BUTTON_EAST]=0,t[rw.BUTTON_WEST]=0,t[rw.BUTTON_NORTH]=0,t[rw.BUTTON_TRIGGER_LEFT]=0,t[rw.BUTTON_TRIGGER_RIGHT]=0,t[rw.TRIGGER_LEFT]=0,t[rw.TRIGGER_RIGHT]=0,t[rw.GRIP_LEFT]=0,t[rw.GRIP_RIGHT]=0,t[rw.LEFT_STICK_UP]=0,t[rw.LEFT_STICK_DOWN]=0,t[rw.LEFT_STICK_LEFT]=0,t[rw.LEFT_STICK_RIGHT]=0,t[rw.RIGHT_STICK_UP]=0,t[rw.RIGHT_STICK_DOWN]=0,t[rw.RIGHT_STICK_LEFT]=0,t[rw.RIGHT_STICK_RIGHT]=0,t[rw.BUTTON_LEFT_STICK]=0,t[rw.BUTTON_RIGHT_STICK]=0,t[rw.ROKID_MENU]=0,t[rw.ROKID_START]=0,t),this._nativeTouchState=((e={})[hw.UNDEFINE]=0,e[hw.A]=0,e[hw.B]=0,e[hw.X]=0,e[hw.Y]=0,e[hw.LEFT_TRIGGER]=0,e[hw.RIGHT_TRIGGER]=0,e[hw.LEFT_THUMBSTICK]=0,e[hw.RIGHT_THUMBSTICK]=0,e),this._initInputSource(),window.addEventListener("xr-remote-input",(function(t){var e=t,n=e.detail.keyEventType,r=e.detail.stickAxisCode,s=e.detail.stickAxisValue,a=e.detail.stickKeyCode,o=e.detail.isButtonPressed,h=e.detail.touchCode,u=e.detail.touchValue;if(n===sw.KET_CLICK){var l=cw[a];i._nativeButtonState[l]=o?1:0}else if(n===sw.KET_STICK||n===sw.KET_GRAB){var c,_,d;switch(r){case ow.LEFT_STICK_X:c=rw.LEFT_STICK_LEFT,_=rw.LEFT_STICK_RIGHT,d=i._axisToButtons(s);break;case ow.LEFT_STICK_Y:c=rw.LEFT_STICK_DOWN,_=rw.LEFT_STICK_UP,d=i._axisToButtons(s);break;case ow.RIGHT_STICK_X:c=rw.RIGHT_STICK_LEFT,_=rw.RIGHT_STICK_RIGHT,d=i._axisToButtons(s);break;case ow.RIGHT_STICK_Y:c=rw.RIGHT_STICK_DOWN,_=rw.RIGHT_STICK_UP,d=i._axisToButtons(s);break;case ow.L2:i._nativeButtonState[rw.TRIGGER_LEFT]=s;break;case ow.R2:i._nativeButtonState[rw.TRIGGER_RIGHT]=s;break;case ow.LEFT_GRIP:i._nativeButtonState[rw.GRIP_LEFT]=s;break;case ow.RIGHT_GRIP:i._nativeButtonState[rw.GRIP_RIGHT]=s}c&&_&&d&&(i._nativeButtonState[c]=d.negative,i._nativeButtonState[_]=d.positive)}else if(n===sw.KET_TOUCH)switch(h){case hw.A:case hw.B:case hw.X:case hw.Y:case hw.LEFT_TRIGGER:case hw.RIGHT_TRIGGER:case hw.LEFT_THUMBSTICK:case hw.RIGHT_THUMBSTICK:i._nativeTouchState[h]=u}i._eventTarget.emit(CC.HANDLE_INPUT,new NC(CC.HANDLE_INPUT,i))}))}var e=t.prototype;return e._axisToButtons=function(t){var e=Math.abs(t);return t>0?{negative:0,positive:e}:t<0?{negative:e,positive:0}:{negative:0,positive:0}},e._on=function(t,e,i){this._eventTarget.on(t,e,i)},e._initInputSource=function(){var t=this;this._buttonNorth=new qC,this._buttonNorth.getValue=function(){return t._nativeButtonState[rw.BUTTON_NORTH]},this._buttonEast=new qC,this._buttonEast.getValue=function(){return t._nativeButtonState[rw.BUTTON_EAST]},this._buttonWest=new qC,this._buttonWest.getValue=function(){return t._nativeButtonState[rw.BUTTON_WEST]},this._buttonSouth=new qC,this._buttonSouth.getValue=function(){return t._nativeButtonState[rw.BUTTON_SOUTH]},this._buttonTriggerLeft=new qC,this._buttonTriggerLeft.getValue=function(){return t._nativeButtonState[rw.BUTTON_TRIGGER_LEFT]},this._buttonTriggerRight=new qC,this._buttonTriggerRight.getValue=function(){return t._nativeButtonState[rw.BUTTON_TRIGGER_RIGHT]},this._triggerLeft=new qC,this._triggerLeft.getValue=function(){return t._nativeButtonState[rw.TRIGGER_LEFT]},this._triggerRight=new qC,this._triggerRight.getValue=function(){return t._nativeButtonState[rw.TRIGGER_RIGHT]},this._gripLeft=new qC,this._gripLeft.getValue=function(){return t._nativeButtonState[rw.GRIP_LEFT]},this._gripRight=new qC,this._gripRight.getValue=function(){return t._nativeButtonState[rw.GRIP_RIGHT]},this._buttonLeftStick=new qC,this._buttonLeftStick.getValue=function(){return t._nativeButtonState[rw.BUTTON_LEFT_STICK]};var e=new qC;e.getValue=function(){return t._nativeButtonState[rw.LEFT_STICK_UP]};var i=new qC;i.getValue=function(){return t._nativeButtonState[rw.LEFT_STICK_DOWN]};var n=new qC;n.getValue=function(){return t._nativeButtonState[rw.LEFT_STICK_LEFT]};var r=new qC;r.getValue=function(){return t._nativeButtonState[rw.LEFT_STICK_RIGHT]},this._leftStick=new ZC({up:e,down:i,left:n,right:r}),this._buttonRightStick=new qC,this._buttonRightStick.getValue=function(){return t._nativeButtonState[rw.BUTTON_RIGHT_STICK]};var s=new qC;s.getValue=function(){return t._nativeButtonState[rw.RIGHT_STICK_UP]};var a=new qC;a.getValue=function(){return t._nativeButtonState[rw.RIGHT_STICK_DOWN]};var o=new qC;o.getValue=function(){return t._nativeButtonState[rw.RIGHT_STICK_LEFT]};var h=new qC;h.getValue=function(){return t._nativeButtonState[rw.RIGHT_STICK_RIGHT]},this._rightStick=new ZC({up:s,down:a,left:o,right:h}),this._buttonOptions=new qC,this._buttonOptions.getValue=function(){return t._nativeButtonState[rw.ROKID_MENU]},this._buttonStart=new qC,this._buttonStart.getValue=function(){return t._nativeButtonState[rw.ROKID_START]},this._handLeftPosition=new $C,this._handLeftPosition.getValue=function(){return hn.ZERO},this._handLeftOrientation=new JC,this._handLeftOrientation.getValue=function(){return En.IDENTITY},this._handRightPosition=new $C,this._handRightPosition.getValue=function(){return hn.ZERO},this._handRightOrientation=new JC,this._handRightOrientation.getValue=function(){return En.IDENTITY},this._aimLeftPosition=new $C,this._aimLeftPosition.getValue=function(){return hn.ZERO},this._aimLeftOrientation=new JC,this._aimLeftOrientation.getValue=function(){return En.IDENTITY},this._aimRightPosition=new $C,this._aimRightPosition.getValue=function(){return hn.ZERO},this._aimRightOrientation=new JC,this._aimRightOrientation.getValue=function(){return En.IDENTITY},this._touchButtonA=new tw,this._touchButtonA.getValue=function(){return t._nativeTouchState[hw.A]},this._touchButtonB=new tw,this._touchButtonB.getValue=function(){return t._nativeTouchState[hw.B]},this._touchButtonX=new tw,this._touchButtonX.getValue=function(){return t._nativeTouchState[hw.X]},this._touchButtonY=new tw,this._touchButtonY.getValue=function(){return t._nativeTouchState[hw.Y]},this._touchButtonTriggerLeft=new tw,this._touchButtonTriggerLeft.getValue=function(){return t._nativeTouchState[hw.LEFT_TRIGGER]},this._touchButtonTriggerRight=new tw,this._touchButtonTriggerRight.getValue=function(){return t._nativeTouchState[hw.RIGHT_TRIGGER]},this._touchButtonThumbStickLeft=new tw,this._touchButtonThumbStickLeft.getValue=function(){return t._nativeTouchState[hw.LEFT_THUMBSTICK]},this._touchButtonThumbStickRight=new tw,this._touchButtonThumbStickRight.getValue=function(){return t._nativeTouchState[hw.RIGHT_THUMBSTICK]}},n(t,[{key:"buttonNorth",get:function(){return this._buttonNorth}},{key:"buttonEast",get:function(){return this._buttonEast}},{key:"buttonWest",get:function(){return this._buttonWest}},{key:"buttonSouth",get:function(){return this._buttonSouth}},{key:"buttonTriggerLeft",get:function(){return this._buttonTriggerLeft}},{key:"buttonTriggerRight",get:function(){return this._buttonTriggerRight}},{key:"triggerLeft",get:function(){return this._triggerLeft}},{key:"triggerRight",get:function(){return this._triggerRight}},{key:"gripLeft",get:function(){return this._gripLeft}},{key:"gripRight",get:function(){return this._gripRight}},{key:"leftStick",get:function(){return this._leftStick}},{key:"rightStick",get:function(){return this._rightStick}},{key:"buttonLeftStick",get:function(){return this._buttonLeftStick}},{key:"buttonRightStick",get:function(){return this._buttonRightStick}},{key:"buttonOptions",get:function(){return this._buttonOptions}},{key:"buttonStart",get:function(){return this._buttonStart}},{key:"handLeftPosition",get:function(){return this._handLeftPosition}},{key:"handLeftOrientation",get:function(){return this._handLeftOrientation}},{key:"handRightPosition",get:function(){return this._handRightPosition}},{key:"handRightOrientation",get:function(){return this._handRightOrientation}},{key:"aimLeftPosition",get:function(){return this._aimLeftPosition}},{key:"aimLeftOrientation",get:function(){return this._aimLeftOrientation}},{key:"aimRightPosition",get:function(){return this._aimRightPosition}},{key:"aimRightOrientation",get:function(){return this._aimRightOrientation}},{key:"touchButtonA",get:function(){return this._touchButtonA}},{key:"touchButtonB",get:function(){return this._touchButtonB}},{key:"touchButtonX",get:function(){return this._touchButtonX}},{key:"touchButtonY",get:function(){return this._touchButtonY}},{key:"touchButtonTriggerLeft",get:function(){return this._touchButtonTriggerLeft}},{key:"touchButtonTriggerRight",get:function(){return this._touchButtonTriggerRight}},{key:"touchButtonThumbStickLeft",get:function(){return this._touchButtonThumbStickLeft}},{key:"touchButtonThumbStickRight",get:function(){return this._touchButtonThumbStickRight}}]),t}();!function(t){t[t.VIEW_LEFT=0]="VIEW_LEFT",t[t.VIEW_RIGHT=3]="VIEW_RIGHT",t[t.HEAD_MIDDLE=6]="HEAD_MIDDLE"}(lw||(lw={}));var dw,fw,pw=function(){function t(){var t;this._eventTarget=new Ju,this._intervalId=-1,this._viewLeftPosition=void 0,this._viewLeftOrientation=void 0,this._viewRightPosition=void 0,this._viewRightOrientation=void 0,this._headMiddlePosition=void 0,this._headMiddleOrientation=void 0,this._webPoseState=((t={})[lw.VIEW_LEFT]={position:hn.ZERO,orientation:En.IDENTITY},t[lw.VIEW_RIGHT]={position:hn.ZERO,orientation:En.IDENTITY},t[lw.HEAD_MIDDLE]={position:hn.ZERO,orientation:En.IDENTITY},t),this._initInputSource(),this._registerEvent()}var e=t.prototype;return e._ensureDirectorDefined=function(){var t=this;return new Promise((function(e){t._intervalId=setInterval((function(){v.director&&v.Director&&(clearInterval(t._intervalId),t._intervalId=-1,e())}),50)}))},e._registerEvent=function(){var t=this;this._ensureDirectorDefined().then((function(){v.director.on(v.Director.EVENT_BEGIN_FRAME,t._scanHmd,t)})).catch((function(){}))},e._scanHmd=function(){var t,e=null===(t=globalThis.__globalXR)||void 0===t?void 0:t.webxrHmdPoseInfos;if(e){for(var i=0;iCe.TOUCH_TIMEOUT&&(k("The touches is more than MAX_TOUCHES, release touch id "+t.getID()+"."),e.releaseTouch(t.getID()))})),i>=this._touchMap.size},t}()),Ew=function(){function t(){this._canvas=void 0,this._eventTarget=new Ju,al.hasFeature(rl.INPUT_TOUCH)&&(this._canvas=document.getElementById("GameCanvas"),this._canvas||U("failed to access canvas"),this._registerEvent())}var e=t.prototype;return e._registerEvent=function(){var t,e,i,n;null===(t=this._canvas)||void 0===t||t.addEventListener("touchstart",this._createCallback(CC.TOUCH_START)),null===(e=this._canvas)||void 0===e||e.addEventListener("touchmove",this._createCallback(CC.TOUCH_MOVE)),null===(i=this._canvas)||void 0===i||i.addEventListener("touchend",this._createCallback(CC.TOUCH_END)),null===(n=this._canvas)||void 0===n||n.addEventListener("touchcancel",this._createCallback(CC.TOUCH_CANCEL))},e._createCallback=function(t){var e=this;return function(i){for(var n,r=e._getCanvasRect(),s=[],a=i.changedTouches.length,o=0;o0){var _=new MC(s,!1,t,Ce.ENABLE_MULTI_TOUCH?Sw.getAllTouches():s);e._eventTarget.emit(t,_)}}},e._getCanvasRect=function(){var t=this._canvas,e=null==t?void 0:t.getBoundingClientRect();return e?new Vn(e.x,e.y,e.width,e.height):new Vn(0,0,0,0)},e._getLocation=function(t,e){if(globalThis.__globalXR&&globalThis.__globalXR.ar&&globalThis.__globalXR.ar.isWebXR())return new Fn(t.clientX,t.clientY);var i=t.clientX-e.x,n=e.y+e.height-t.clientY;if(wl.isFrameRotated){var r=i;i=e.height-n,n=r}var s=wl.devicePixelRatio;return new Fn(i*=s,n*=s)},e.on=function(t,e,i){this._eventTarget.on(t,e,i)},t}();!function(t){t[t.GLOBAL=0]="GLOBAL",t[t.UI=1]="UI"}(fw||(fw={}));var Aw=function(){function t(t){this.priority=fw.GLOBAL,this._inputEventTarget=void 0,this._inputEventTarget=t}return t.prototype.dispatchEvent=function(t){return this._inputEventTarget.emit(t.type,t),!0},t}(),Rw=((dw={})[CC.MOUSE_DOWN]=CC.TOUCH_START,dw[CC.MOUSE_MOVE]=CC.TOUCH_MOVE,dw[CC.MOUSE_UP]=CC.TOUCH_END,dw),bw=t("eK",function(){function t(){this._dispatchImmediately=!0,this._eventTarget=new Ju,this._touchInput=new Ew,this._mouseInput=new yw,this._keyboardInput=new vw,this._accelerometerInput=new GC,this._handleInput=new _w,this._hmdInput=new pw,this._handheldInput=new mw,this._eventTouchList=[],this._eventMouseList=[],this._eventKeyboardList=[],this._eventAccelerationList=[],this._eventGamepadList=[],this._eventHandleList=[],this._eventHMDList=[],this._eventHandheldList=[],this._needSimulateTouchMoveEvent=!1,this._inputEventDispatcher=void 0,this._eventDispatcherList=[],this._registerEvent(),this._inputEventDispatcher=new Aw(this._eventTarget),this._registerEventDispatcher(this._inputEventDispatcher),uw._init()}var e=t.prototype;return e._dispatchMouseDownEvent=function(t){var e,i;null===(e=(i=this._mouseInput).dispatchMouseDownEvent)||void 0===e||e.call(i,t)},e._dispatchMouseMoveEvent=function(t){var e,i;null===(e=(i=this._mouseInput).dispatchMouseMoveEvent)||void 0===e||e.call(i,t)},e._dispatchMouseUpEvent=function(t){var e,i;null===(e=(i=this._mouseInput).dispatchMouseUpEvent)||void 0===e||e.call(i,t)},e._dispatchMouseScrollEvent=function(t){var e,i;null===(e=(i=this._mouseInput).dispatchScrollEvent)||void 0===e||e.call(i,t)},e._dispatchKeyboardDownEvent=function(t){var e,i;null===(e=(i=this._keyboardInput).dispatchKeyboardDownEvent)||void 0===e||e.call(i,t)},e._dispatchKeyboardUpEvent=function(t){var e,i;null===(e=(i=this._keyboardInput).dispatchKeyboardUpEvent)||void 0===e||e.call(i,t)},e.on=function(t,e,i){return this._eventTarget.on(t,e,i),e},e.once=function(t,e,i){return this._eventTarget.once(t,e,i),e},e.off=function(t,e,i){this._eventTarget.off(t,e,i)},e.getTouch=function(t){return Sw.getTouch(t)},e.getAllTouches=function(){return Sw.getAllTouches()},e.getTouchCount=function(){return Sw.getTouchCount()},e.setAccelerometerEnabled=function(t){t?this._accelerometerInput.start():this._accelerometerInput.stop()},e.setAccelerometerInterval=function(t){this._accelerometerInput.setInterval(t)},e._simulateEventTouch=function(t){var e=Rw[t.type],i=Sw.getOrCreateTouch(0,t.getLocationX(),t.getLocationY());if(i){var n=[i],r=new MC(n,!1,e,e===CC.TOUCH_END?[]:n);r.windowId=t.windowId,e===CC.TOUCH_END&&Sw.releaseTouch(0),this._dispatchOrPushEventTouch(r,this._eventTouchList)}},e._registerEventDispatcher=function(t){this._eventDispatcherList.push(t),this._eventDispatcherList.sort((function(t,e){return e.priority-t.priority}))},e._emitEvent=function(t){for(var e=this._eventDispatcherList.length,i=0;i=1&&this.width<=2048&&this.height>=1&&this.height<=2048},i.readPixels=function(t,e,i,n,r){void 0===t&&(t=0),void 0===e&&(e=0),i=i||this.width,n=n||this.height;var s=this.getGFXTexture();if(!s)return Z(7606),null;var a=4*i*n;if(void 0===r)r=new Uint8Array(a);else if(r.length15e3&&(e=15e3);var i=e*e,n=(.860117757+.000154118254*e+1.28641212e-7*i)/(1+.000842420235*e+7.08145163e-7*i),r=(.317398726+422806245e-13*e+4.20481691e-8*i)/(1-289741816e-13*e+1.61456053e-7*i),s=2*n-8*r+4,a=3*n/s,o=2*r/s,h=1/o*a,u=1/o*(1-a-o);t.x=3.2404542*h-1.5371385+-.4985314*u,t.y=-.969266*h+1.8760108+.041556*u,t.z=.0556434*h-.2040259+1.0572252*u}!function(t){t[t.DIRECTIONAL=0]="DIRECTIONAL",t[t.SPHERE=1]="SPHERE",t[t.SPOT=2]="SPOT",t[t.POINT=3]="POINT",t[t.RANGED_DIRECTIONAL=4]="RANGED_DIRECTIONAL",t[t.UNKNOWN=5]="UNKNOWN"}(hx||(hx={}));var _x,dx,fx,px,mx,gx,vx,yx,Tx,Sx,Ex,Ax,Rx=function(t){return 4*Math.PI*Math.PI*t*t},bx=function(){function t(){this._baked=!1,this._color=new hn(1,1,1),this._colorTemp=6550,this._colorTempRGB=new hn(1,1,1),this._finalColor=new hn(1,1,1),this._scene=null,this._node=null,this._name=null,this._useColorTemperature=!1,this._type=hx.UNKNOWN,this._visibility=Jv}var e=t.prototype;return e.initialize=function(){this.color=new hn(1,1,1),this.colorTemperature=6550},e.attachToScene=function(t){this._scene=t},e.detachFromScene=function(){this._scene=null},e.destroy=function(){this._name=null,this._node=null},e.update=function(){},n(t,[{key:"baked",get:function(){return this._baked},set:function(t){this._baked=t}},{key:"color",get:function(){return this._color},set:function(t){this._color.set(t),this._useColorTemperature&&hn.multiply(this._finalColor,this._color,this._colorTempRGB)}},{key:"useColorTemperature",get:function(){return this._useColorTemperature},set:function(t){this._useColorTemperature=t,t&&hn.multiply(this._finalColor,this._color,this._colorTempRGB)}},{key:"colorTemperature",get:function(){return this._colorTemp},set:function(t){this._colorTemp=t,cx(this._colorTempRGB,this._colorTemp),this._useColorTemperature&&hn.multiply(this._finalColor,this._color,this._colorTempRGB)}},{key:"colorTemperatureRGB",get:function(){return this._colorTempRGB}},{key:"finalColor",get:function(){return this._finalColor}},{key:"visibility",get:function(){return this._visibility},set:function(t){this._visibility=t}},{key:"node",get:function(){return this._node},set:function(t){this._node=t,this._node&&(this._node.hasChangedFlags|=om.ROTATION)}},{key:"type",get:function(){return this._type}},{key:"name",get:function(){return this._name},set:function(t){this._name=t}},{key:"scene",get:function(){return this._scene}}]),t}();!function(t){t[t.PER_INSTANCE=0]="PER_INSTANCE",t[t.PER_BATCH=1]="PER_BATCH",t[t.PER_PHASE=2]="PER_PHASE",t[t.PER_PASS=3]="PER_PASS",t[t.COUNT=4]="COUNT"}(_x||(_x={})),function(t){t[t.CONSTANTS=0]="CONSTANTS",t[t.CBV=1]="CBV",t[t.UAV=2]="UAV",t[t.SRV=3]="SRV",t[t.TABLE=4]="TABLE",t[t.SSV=5]="SSV"}(dx||(dx={})),function(t){t[t.MANAGED=0]="MANAGED",t[t.MEMORYLESS=1]="MEMORYLESS",t[t.PERSISTENT=2]="PERSISTENT",t[t.EXTERNAL=3]="EXTERNAL",t[t.BACKBUFFER=4]="BACKBUFFER"}(fx||(fx={})),function(t){t[t.NONE=0]="NONE",t[t.OPAQUE=1]="OPAQUE",t[t.MASK=2]="MASK",t[t.BLEND=3]="BLEND",t[t.RENDER_OPAQUE=1]="RENDER_OPAQUE",t[t.RENDER_CUTOUT=2]="RENDER_CUTOUT",t[t.RENDER_TRANSPARENT=3]="RENDER_TRANSPARENT"}(px||(px={})),function(t){t[t.BUFFER=0]="BUFFER",t[t.TEXTURE1D=1]="TEXTURE1D",t[t.TEXTURE2D=2]="TEXTURE2D",t[t.TEXTURE3D=3]="TEXTURE3D"}(mx||(mx={})),function(t){t[t.NONE=0]="NONE",t[t.UNIFORM=1]="UNIFORM",t[t.INDIRECT=2]="INDIRECT",t[t.STORAGE=4]="STORAGE",t[t.SAMPLED=8]="SAMPLED",t[t.COLOR_ATTACHMENT=16]="COLOR_ATTACHMENT",t[t.DEPTH_STENCIL_ATTACHMENT=32]="DEPTH_STENCIL_ATTACHMENT",t[t.INPUT_ATTACHMENT=64]="INPUT_ATTACHMENT",t[t.SHADING_RATE=128]="SHADING_RATE",t[t.TRANSFER_SRC=256]="TRANSFER_SRC",t[t.TRANSFER_DST=512]="TRANSFER_DST"}(gx||(gx={})),function(t){t[t.SYNC=0]="SYNC",t[t.ASYNC=1]="ASYNC"}(vx||(vx={})),function(t){t[t.NONE=0]="NONE",t[t.OPAQUE=1]="OPAQUE",t[t.MASK=2]="MASK",t[t.BLEND=4]="BLEND",t[t.OPAQUE_OBJECT=1]="OPAQUE_OBJECT",t[t.CUTOUT_OBJECT=2]="CUTOUT_OBJECT",t[t.TRANSPARENT_OBJECT=4]="TRANSPARENT_OBJECT",t[t.SHADOW_CASTER=8]="SHADOW_CASTER",t[t.UI=16]="UI",t[t.DEFAULT_LIGHTING=32]="DEFAULT_LIGHTING",t[t.VOLUMETRIC_LIGHTING=64]="VOLUMETRIC_LIGHTING",t[t.CLUSTERED_LIGHTING=128]="CLUSTERED_LIGHTING",t[t.PLANAR_SHADOW=256]="PLANAR_SHADOW",t[t.GEOMETRY=512]="GEOMETRY",t[t.PROFILER=1024]="PROFILER",t[t.DRAW_INSTANCING=2048]="DRAW_INSTANCING",t[t.DRAW_NON_INSTANCING=4096]="DRAW_NON_INSTANCING",t[t.REFLECTION_PROBE=8192]="REFLECTION_PROBE",t[t.GPU_DRIVEN=16384]="GPU_DRIVEN",t[t.NON_BUILTIN=32768]="NON_BUILTIN",t[t.ALL=4294967295]="ALL"}(yx||(yx={})),function(t){t[t.NONE=0]="NONE",t[t.DEFAULT=1]="DEFAULT",t[t.CLUSTERED=2]="CLUSTERED"}(Tx||(Tx={})),function(t){t[t.RENDER_TARGET=0]="RENDER_TARGET",t[t.DEPTH_STENCIL=1]="DEPTH_STENCIL",t[t.SHADING_RATE=2]="SHADING_RATE"}(Sx||(Sx={})),function(t){t[t.READ=0]="READ",t[t.READ_WRITE=1]="READ_WRITE",t[t.WRITE=2]="WRITE"}(Ex||(Ex={})),function(t){t[t.NONE=0]="NONE",t[t.FLOAT_TYPE=1]="FLOAT_TYPE",t[t.INT_TYPE=2]="INT_TYPE"}(Ax||(Ax={}));var Cx,wx,xx=function(){function t(t,e,i,n){void 0===t&&(t=null),void 0===e&&(e=0),void 0===i&&(i=!1),void 0===n&&(n=null),this.light=void 0,this.probe=void 0,this.level=void 0,this.culledByLight=void 0,this.light=t,this.probe=n,this.level=e,this.culledByLight=i}return t.prototype.reset=function(t,e,i,n){void 0===t&&(t=null),void 0===e&&(e=0),void 0===i&&(i=!1),void 0===n&&(n=null),this.light=t,this.probe=n,this.level=e,this.culledByLight=i},t}();!function(t){t[t.UNIFORM_BUFFER=0]="UNIFORM_BUFFER",t[t.DYNAMIC_UNIFORM_BUFFER=1]="DYNAMIC_UNIFORM_BUFFER",t[t.SAMPLER_TEXTURE=2]="SAMPLER_TEXTURE",t[t.SAMPLER=3]="SAMPLER",t[t.TEXTURE=4]="TEXTURE",t[t.STORAGE_BUFFER=5]="STORAGE_BUFFER",t[t.DYNAMIC_STORAGE_BUFFER=6]="DYNAMIC_STORAGE_BUFFER",t[t.STORAGE_IMAGE=7]="STORAGE_IMAGE",t[t.INPUT_ATTACHMENT=8]="INPUT_ATTACHMENT"}(Cx||(Cx={})),function(t){t[t.NONE=0]="NONE",t[t.COLOR=1]="COLOR",t[t.DEPTH=2]="DEPTH",t[t.STENCIL=4]="STENCIL"}(wx||(wx={}));var Ix,Ox=function(){function t(t,e,i,n,r,s,a){void 0===t&&(t=new Uint8Array(0)),void 0===e&&(e=""),void 0===i&&(i=4294967295),void 0===n&&(n=4294967295),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=0),this.source=void 0,this.target=void 0,this.mipLevels=void 0,this.numSlices=void 0,this.targetMostDetailedMip=void 0,this.targetFirstSlice=void 0,this.targetPlaneSlice=void 0,this.source=t,this.target=e,this.mipLevels=i,this.numSlices=n,this.targetMostDetailedMip=r,this.targetFirstSlice=s,this.targetPlaneSlice=a}return t.prototype.reset=function(t,e,i,n,r,s){void 0===t&&(t=""),void 0===e&&(e=4294967295),void 0===i&&(i=4294967295),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=0),this.target=t,this.mipLevels=e,this.numSlices=i,this.targetMostDetailedMip=n,this.targetFirstSlice=r,this.targetPlaneSlice=s},t}();st(Lf.prototype,"TextureBase.prototype",[{name:"hasPremultipliedAlpha"},{name:"setPremultiplyAlpha"},{name:"setFlipY"}]),rt(ox.prototype,"RenderTexture.prototype",[{name:"getGFXWindow",customFunction:function(){return this.window}}]);var Dx=((Ix={})[Yl.UNORM]="Uint",Ix[Yl.SNORM]="Int",Ix[Yl.UINT]="Uint",Ix[Yl.INT]="Int",Ix[Yl.UFLOAT]="Float",Ix[Yl.FLOAT]="Float",Ix.default="Uint",Ix);function Mx(t){return""+(Dx[t.type]||Dx.default)+t.size/t.count*8}function Px(t,e,i,n,r){void 0===i&&(i=jl.R32F),void 0===n&&(n=0),void 0===r&&(r=0);var s=F_[i];r||(r=s.size);for(var a="set"+Mx(s),o=s.size/s.count,h=Math.floor(e.length/s.count),u=Ol.isLittleEndian,l=0;lv.x?e[S]:v.x,v.y=e[S+1]>v.y?e[S+1]:v.y,y.x=e[S]v.x?e[S]:v.x,v.y=e[S+1]>v.y?e[S+1]:v.y,v.z=e[S+2]>v.z?e[S+2]:v.z,y.x=e[S]0?.5*(1-Math.floor(r/2))*h:.5*Math.floor(r/2)*h,s.width=.5*o,s.height=.5*h}break;case hx.SPOT:s.x=0,s.y=0,s.width=o,s.height=h}return s}var jx=function(){function t(t){void 0===t&&(t=Fx.NONE),this.antiAliasing=Fx.NONE,this.antiAliasing=t,this._init()}return t.prototype._init=function(){this.postMaterial=new OS,this.postMaterial.name="builtin-post-process-material",this.postMaterial.initialize({effectName:"pipeline/post-process",defines:{ANTIALIAS_TYPE:this.antiAliasing}});for(var t=0;t0?Math.abs(this._kernel[r].w-this._kernel[r-1].w):0)+(r<24?Math.abs(this._kernel[r].w-this._kernel[r+1].w):0))/2;eI.set(0),this._profile(eI,this._kernel[r].w),eI.multiplyScalar(s),this._kernel[r].x=eI.x,this._kernel[r].y=eI.y,this._kernel[r].z=eI.z}nI.set(this._kernel[12]);for(var a=12;a>0;a--)rI.set(this._kernel[a-1]),this._kernel[a].set(rI);this._kernel[0].set(nI),eI.set(0);for(var o=0;o<25;o++)eI.add3f(this._kernel[o].x,this._kernel[o].y,this._kernel[o].z);for(var h=0;h<25;h++)this._kernel[h].x/=eI.x,this._kernel[h].y/=eI.y,this._kernel[h].z/=eI.z;this._kernel[0].x=1*(1-t.x)+t.x*this._kernel[0].x,this._kernel[0].y=1*(1-t.y)+t.y*this._kernel[0].y,this._kernel[0].z=1*(1-t.z)+t.z*this._kernel[0].z;for(var u=1;u<25;u++)this._kernel[u].x*=t.x,this._kernel[u].y*=t.y,this._kernel[u].z*=t.z},t._updateBlurPass=function(){if(this.ssssBlurMaterial){var t=this.ssssBlurMaterial.passes[0];t.beginChangeStatesSilently(),t.tryCompile(),t.endChangeStatesSilently();var e=this.ssssBlurMaterial.passes[1];e.beginChangeStatesSilently(),e.tryCompile(),e.endChangeStatesSilently();var i=this.ssssBlurMaterial.passes[2];i.beginChangeStatesSilently(),i.tryCompile(),i.endChangeStatesSilently()}},t._init=function(){if(!this.ssssBlurMaterial){this.ssssBlurMaterial=new OS,this.ssssBlurMaterial._uuid="builtin-ssssBlur-material",this.ssssBlurMaterial.initialize({effectName:"pipeline/ssss-blur"});for(var t=0;t>3)]+=(o.isCompositeModeEnabled(u)?1:0)*Math.pow(10,l)}r[Pg.DEBUG_VIEW_MODE_OFFSET+3]+=(o.lightingWithAlbedo?1:0)*Math.pow(10,6),r[Pg.DEBUG_VIEW_MODE_OFFSET+3]+=(o.csmLayerColoration?1:0)*Math.pow(10,7)}},t.updateCameraUBOView=function(t,e,i){var n,r=(i.scene?i.scene:v.director.getScene().renderScene).mainLight,s=t.pipelineSceneData,a=s.ambient,o=s.skybox,h=s.fog,u=s.shadows,l=e,c=i.exposure,_=s.isHDR;if(l[Bg.SCREEN_SCALE_OFFSET]=s.shadingScale,l[Bg.SCREEN_SCALE_OFFSET+1]=s.shadingScale,l[Bg.SCREEN_SCALE_OFFSET+2]=1/l[Bg.SCREEN_SCALE_OFFSET],l[Bg.SCREEN_SCALE_OFFSET+3]=1/l[Bg.SCREEN_SCALE_OFFSET+1],l[Bg.EXPOSURE_OFFSET]=c,l[Bg.EXPOSURE_OFFSET+1]=1/c,l[Bg.EXPOSURE_OFFSET+2]=_?1:0,l[Bg.EXPOSURE_OFFSET+3]=1/jw.standardExposureValue,r){var d=r.shadowEnabled&&u.type===MS.ShadowMap?1:0,f=r.direction;if(TI.set(f.x,f.y,f.z,d),nn.toArray(l,TI,Bg.MAIN_LIT_DIR_OFFSET),hn.toArray(l,r.color,Bg.MAIN_LIT_COLOR_OFFSET),r.useColorTemperature){var p=r.colorTemperatureRGB;l[Bg.MAIN_LIT_COLOR_OFFSET]*=p.x,l[Bg.MAIN_LIT_COLOR_OFFSET+1]*=p.y,l[Bg.MAIN_LIT_COLOR_OFFSET+2]*=p.z}l[Bg.MAIN_LIT_COLOR_OFFSET+3]=_?r.illuminance*c:r.illuminance}else TI.set(0,0,1,0),nn.toArray(l,TI,Bg.MAIN_LIT_DIR_OFFSET),nn.toArray(l,nn.ZERO,Bg.MAIN_LIT_COLOR_OFFSET);var m=a.skyColor;m.w=_?a.skyIllum*c:a.skyIllum,l[Bg.AMBIENT_SKY_OFFSET+0]=m.x,l[Bg.AMBIENT_SKY_OFFSET+1]=m.y,l[Bg.AMBIENT_SKY_OFFSET+2]=m.z,l[Bg.AMBIENT_SKY_OFFSET+3]=m.w,l[Bg.AMBIENT_GROUND_OFFSET+0]=a.groundAlbedo.x,l[Bg.AMBIENT_GROUND_OFFSET+1]=a.groundAlbedo.y,l[Bg.AMBIENT_GROUND_OFFSET+2]=a.groundAlbedo.z,l[Bg.AMBIENT_GROUND_OFFSET+3]=o.envmap?null===(n=o.envmap)||void 0===n?void 0:n.mipmapLevel:1,Dn.toArray(l,i.matView,Bg.MAT_VIEW_OFFSET),Dn.toArray(l,i.node.worldMatrix,Bg.MAT_VIEW_INV_OFFSET),hn.toArray(l,i.position,Bg.CAMERA_POS_OFFSET),Dn.toArray(l,i.matProj,Bg.MAT_PROJ_OFFSET),Dn.toArray(l,i.matProjInv,Bg.MAT_PROJ_INV_OFFSET),Dn.toArray(l,i.matViewProj,Bg.MAT_VIEW_PROJ_OFFSET),Dn.toArray(l,i.matViewProjInv,Bg.MAT_VIEW_PROJ_INV_OFFSET),l[Bg.CAMERA_POS_OFFSET+3]=this.getCombineSignY(),l[Bg.SURFACE_TRANSFORM_OFFSET]=i.surfaceTransform,l[Bg.SURFACE_TRANSFORM_OFFSET+1]=i.cameraUsage,l[Bg.SURFACE_TRANSFORM_OFFSET+2]=Math.cos(Mi(s.skybox.getRotationAngle())),l[Bg.SURFACE_TRANSFORM_OFFSET+3]=Math.sin(Mi(s.skybox.getRotationAngle()));var g=h.colorArray;l[Bg.GLOBAL_FOG_COLOR_OFFSET]=g.x,l[Bg.GLOBAL_FOG_COLOR_OFFSET+1]=g.y,l[Bg.GLOBAL_FOG_COLOR_OFFSET+2]=g.z,l[Bg.GLOBAL_FOG_COLOR_OFFSET+3]=g.z,l[Bg.GLOBAL_FOG_BASE_OFFSET]=h.fogStart,l[Bg.GLOBAL_FOG_BASE_OFFSET+1]=h.fogEnd,l[Bg.GLOBAL_FOG_BASE_OFFSET+2]=h.fogDensity,l[Bg.GLOBAL_FOG_ADD_OFFSET]=h.fogTop,l[Bg.GLOBAL_FOG_ADD_OFFSET+1]=h.fogRange,l[Bg.GLOBAL_FOG_ADD_OFFSET+2]=h.fogAtten,l[Bg.NEAR_FAR_OFFSET]=i.nearClip,l[Bg.NEAR_FAR_OFFSET+1]=i.farClip,l[Bg.NEAR_FAR_OFFSET+2]=i.getClipSpaceMinz(),l[Bg.VIEW_PORT_OFFSET]=s.shadingScale*i.window.width*i.viewport.x,l[Bg.VIEW_PORT_OFFSET+1]=s.shadingScale*i.window.height*i.viewport.y,l[Bg.VIEW_PORT_OFFSET+2]=s.shadingScale*i.window.width*i.viewport.z,l[Bg.VIEW_PORT_OFFSET+3]=s.shadingScale*i.window.height*i.viewport.w},t.getPCFRadius=function(t,e){var i=t.size.x;switch(e.shadowPcf){case PS.HARD:return 0;case PS.SOFT:return 1/(.5*i);case PS.SOFT_2X:return 2/(.5*i);case PS.SOFT_4X:return 3/(.5*i)}return 0},t.updatePlanarNormalAndDistance=function(t,e){hn.normalize(SI,t.normal),e[Ng.PLANAR_NORMAL_DISTANCE_INFO_OFFSET+0]=SI.x,e[Ng.PLANAR_NORMAL_DISTANCE_INFO_OFFSET+1]=SI.y,e[Ng.PLANAR_NORMAL_DISTANCE_INFO_OFFSET+2]=SI.z,e[Ng.PLANAR_NORMAL_DISTANCE_INFO_OFFSET+3]=-t.distance},t.updateShadowUBOView=function(e,i,n,r){var s=e.device,a=r.scene.mainLight,o=e.pipelineSceneData,h=o.shadows,u=o.csmLayers,l=i,c=n,_=o.csmSupported,d=ey(s)?0:1;if(a&&h.enabled){if(h.type===MS.ShadowMap){if(a.shadowEnabled){if(a.shadowFixedArea||a.csmLevel===BS.LEVEL_1||!_){var f=u.specialLayer.matShadowView,p=u.specialLayer.matShadowProj,m=u.specialLayer.matShadowViewProj,g=.1,v=0,y=0;a.shadowFixedArea?(g=a.shadowNear,v=a.shadowFar,y=0):(v=u.specialLayer.shadowCameraFar,y=1),Dn.toArray(l,f,Ng.MAT_LIGHT_VIEW_OFFSET),l[Ng.SHADOW_PROJ_DEPTH_INFO_OFFSET+0]=p.m10,l[Ng.SHADOW_PROJ_DEPTH_INFO_OFFSET+1]=p.m14,l[Ng.SHADOW_PROJ_DEPTH_INFO_OFFSET+2]=p.m11,l[Ng.SHADOW_PROJ_DEPTH_INFO_OFFSET+3]=p.m15,l[Ng.SHADOW_PROJ_INFO_OFFSET+0]=p.m00,l[Ng.SHADOW_PROJ_INFO_OFFSET+1]=p.m05,l[Ng.SHADOW_PROJ_INFO_OFFSET+2]=1/p.m00,l[Ng.SHADOW_PROJ_INFO_OFFSET+3]=1/p.m05,Dn.toArray(l,m,Ng.MAT_LIGHT_VIEW_PROJ_OFFSET),yI.set(g,v,0,1-a.shadowSaturation),nn.toArray(l,yI,Ng.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET),yI.set(hx.DIRECTIONAL,d,a.shadowNormalBias,y),nn.toArray(l,yI,Ng.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET)}else{for(var T=this.getPCFRadius(h,a),S=0;S=0;--e){var i=t[e];if(i.window.swapchain)return void(CS=i)}CS=null}(t);for(var e=0;e0){var o=a;a=s,s=o}var h=0;switch(t){case Wl.IDENTITY:h=0,i[h++]=-1,i[h++]=-1,i[h++]=n,i[h++]=a,i[h++]=1,i[h++]=-1,i[h++]=r,i[h++]=a,i[h++]=-1,i[h++]=1,i[h++]=n,i[h++]=s,i[h++]=1,i[h++]=1,i[h++]=r,i[h++]=s;break;case Wl.ROTATE_90:h=0,i[h++]=-1,i[h++]=-1,i[h++]=r,i[h++]=a,i[h++]=1,i[h++]=-1,i[h++]=r,i[h++]=s,i[h++]=-1,i[h++]=1,i[h++]=n,i[h++]=a,i[h++]=1,i[h++]=1,i[h++]=n,i[h++]=s;break;case Wl.ROTATE_180:h=0,i[h++]=-1,i[h++]=-1,i[h++]=n,i[h++]=s,i[h++]=1,i[h++]=-1,i[h++]=r,i[h++]=s,i[h++]=-1,i[h++]=1,i[h++]=n,i[h++]=a,i[h++]=1,i[h++]=1,i[h++]=r,i[h++]=a;break;case Wl.ROTATE_270:h=0,i[h++]=-1,i[h++]=-1,i[h++]=n,i[h++]=s,i[h++]=1,i[h++]=-1,i[h++]=n,i[h++]=a,i[h++]=-1,i[h++]=1,i[h++]=r,i[h++]=s,i[h++]=1,i[h++]=1,i[h++]=r,i[h++]=a}return i},i._createQuadInputAssembler=function(){var t=new TD,e=4*Float32Array.BYTES_PER_ELEMENT,i=4*e,n=this._device.createBuffer(new qc(ql.VERTEX|ql.TRANSFER_DST,Jl.DEVICE|Jl.HOST,i,e));if(!n)return t;var r=Uint8Array.BYTES_PER_ELEMENT,s=6*r,a=this._device.createBuffer(new qc(ql.INDEX|ql.TRANSFER_DST,Jl.DEVICE,s,r));if(!a)return t;var o=new Uint8Array(6);o[0]=0,o[1]=1,o[2]=2,o[3]=1,o[4]=3,o[5]=2,a.update(o);var h=new Array(2);h[0]=new __("a_position",jl.RG32F),h[1]=new __("a_texCoord",jl.RG32F);var u=this._device.createInputAssembler(new f_(h,[n],a));return t.quadIB=a,t.quadVB=n,t.quadIA=u,t},i.updateQuadVertexData=function(t,e){var i=this._lastUsedRenderArea;if(i.x!==t.x||i.y!==t.y||i.width!==t.width||i.height!==t.height){var n=this._genQuadVertexData(Wl.IDENTITY,t);this._quadVBOffscreen.update(n);var r=this._genQuadVertexData(e.swapchain&&e.swapchain.surfaceTransform||Wl.IDENTITY,t);this._quadVBOnscreen.update(r),i.copy(t)}},i.destroy=function(){for(var e,i,n=0;n>1,r>>1)),t.prefilterFramebuffer=e.createFramebuffer(new A_(t.renderPass,[t.prefiterTex])),n>>=1,r>>=1;for(var s=0;s<6;++s)t.downsampleTexs.push(e.createTexture(new t_($l.TEX2D,tc.COLOR_ATTACHMENT|tc.SAMPLED,jl.RGBA8,n>>1,r>>1))),t.downsampleFramebuffers[s]=e.createFramebuffer(new A_(t.renderPass,[t.downsampleTexs[s]])),t.upsampleTexs.push(e.createTexture(new t_($l.TEX2D,tc.COLOR_ATTACHMENT|tc.SAMPLED,jl.RGBA8,n,r))),t.upsampleFramebuffers[s]=e.createFramebuffer(new A_(t.renderPass,[t.upsampleTexs[s]])),n>>=1,r>>=1;t.combineTex=e.createTexture(new t_($l.TEX2D,tc.COLOR_ATTACHMENT|tc.SAMPLED,jl.RGBA8,this._width,this._height)),t.combineFramebuffer=e.createFramebuffer(new A_(t.renderPass,[t.combineTex])),t.sampler=this.globalDSManager.linearSampler}},i.on=function(t,e,i,n){return this._eventProcessor.on(t,e,i,n)},i.once=function(t,e,i){return this._eventProcessor.once(t,e,i)},i.off=function(t,e,i){this._eventProcessor.off(t,e,i)},i.emit=function(t,e,i,n,r,s){this._eventProcessor.emit(t,e,i,n,r,s)},i.targetOff=function(t){this._eventProcessor.targetOff(t)},i.removeAll=function(t){this._eventProcessor.removeAll(t)},i.hasEventListener=function(t,e,i){return this._eventProcessor.hasEventListener(t,e,i)},n(e,[{key:"tag",get:function(){return this._tag}},{key:"flows",get:function(){return this._flows}},{key:"quadIAOnscreen",get:function(){return this._quadIAOnscreen}},{key:"quadIAOffscreen",get:function(){return this._quadIAOffscreen}},{key:"constantMacros",get:function(){return this._constantMacros}},{key:"macros",get:function(){return this._macros}},{key:"device",get:function(){return this._device}},{key:"globalDSManager",get:function(){return this._globalDSManager}},{key:"descriptorSetLayout",get:function(){return this._globalDSManager.descriptorSetLayout}},{key:"descriptorSet",get:function(){return this._descriptorSet}},{key:"commandBuffers",get:function(){return this._commandBuffers}},{key:"pipelineUBO",get:function(){return this._pipelineUBO}},{key:"pipelineSceneData",get:function(){return this._pipelineSceneData}},{key:"profiler",get:function(){return this._profiler},set:function(t){this._profiler=t}},{key:"geometryRenderer",get:function(){return this._geometryRenderer}},{key:"clusterEnabled",get:function(){return this._clusterEnabled},set:function(t){this._clusterEnabled=t}},{key:"bloomEnabled",get:function(){return this._bloomEnabled},set:function(t){this._bloomEnabled=t}},{key:"shadingScale",get:function(){return this._pipelineSceneData.shadingScale},set:function(t){this._pipelineSceneData.shadingScale!==t&&(this._pipelineSceneData.shadingScale=t,this.emit(MI.ATTACHMENT_SCALE_CAHNGED,t))}}]),e}(uf),kI=Gs(FI.prototype,"_tag",[ra],(function(){return 0})),UI=Gs(FI.prototype,"_flows",[NI,ra],(function(){return[]})),LI=FI))||LI));v.RenderPipeline=SD,function(t){t[t.BLOOM=18]="BLOOM",t[t.POST_PROCESS=19]="POST_PROCESS",t[t.UI=20]="UI"}(GI||(GI={})),function(t){t[t.AR=5]="AR",t[t.FORWARD=10]="FORWARD"}(HI||(HI={})),function(t){t[t.SHADOW=0]="SHADOW",t[t.FORWARD=1]="FORWARD",t[t.UI=10]="UI"}(zI||(zI={})),function(t){t[t.GBUFFER=10]="GBUFFER",t[t.LIGHTING=15]="LIGHTING",t[t.TRANSPARENT=18]="TRANSPARENT"}(VI||(VI={})),function(t){t[t.SHADOW=0]="SHADOW",t[t.MAIN=1]="MAIN",t[t.UI=10]="UI"}(WI||(WI={})),Se($l),Se(tc),Se(fc),Se(dc),Se(pc),Se(jl),function(t){t[t.SCENE=0]="SCENE",t[t.POSTPROCESS=1]="POSTPROCESS",t[t.UI=2]="UI"}(pD||(pD={})),Se(pD),XI=qs("RenderTextureDesc"),jI=xa($l),YI=xa(tc),KI=xa(jl),XI((qI=function(){this.name=QI&&QI(),this.type=ZI&&ZI(),this.usage=JI&&JI(),this.format=$I&&$I(),this.width=tO&&tO(),this.height=eO&&eO()},QI=Gs(qI.prototype,"name",[ra],(function(){return""})),ZI=Gs(qI.prototype,"type",[jI],(function(){return $l.TEX2D})),JI=Gs(qI.prototype,"usage",[YI],(function(){return tc.COLOR_ATTACHMENT})),$I=Gs(qI.prototype,"format",[KI],(function(){return jl.UNKNOWN})),tO=Gs(qI.prototype,"width",[ra],(function(){return-1})),eO=Gs(qI.prototype,"height",[ra],(function(){return-1})),qI));var ED=(iO=qs("RenderTextureConfig"),nO=xa(ox),iO((sO=function(){this.name=aO&&aO(),this.texture=oO&&oO()},aO=Gs(sO.prototype,"name",[ra],(function(){return""})),oO=Gs(sO.prototype,"texture",[nO],(function(){return null})),rO=sO))||rO);hO=qs("MaterialConfig"),uO=xa(OS),hO((lO=function(){this.name=cO&&cO(),this.material=_O&&_O()},cO=Gs(lO.prototype,"name",[ra],(function(){return""})),_O=Gs(lO.prototype,"material",[uO],(function(){return null})),lO)),dO=qs("FrameBufferDesc"),fO=xa([Ze]),pO=xa(ox),dO((mO=function(){this.name=gO&&gO(),this.renderPass=vO&&vO(),this.colorTextures=yO&&yO(),this.depthStencilTexture=TO&&TO(),this.texture=SO&&SO()},gO=Gs(mO.prototype,"name",[ra],(function(){return""})),vO=Gs(mO.prototype,"renderPass",[ra],(function(){return 0})),yO=Gs(mO.prototype,"colorTextures",[fO],(function(){return[]})),TO=Gs(mO.prototype,"depthStencilTexture",[ra],(function(){return""})),SO=Gs(mO.prototype,"texture",[pO],(function(){return null})),mO));var AD,RD=(EO=qs("ColorDesc"),AO=xa(jl),RO=xa(dc),bO=xa(fc),CO=xa(pc),wO=xa(pc),EO((IO=function(){this.format=OO&&OO(),this.loadOp=DO&&DO(),this.storeOp=MO&&MO(),this.sampleCount=PO&&PO(),this.beginAccesses=BO&&BO(),this.endAccesses=NO&&NO()},OO=Gs(IO.prototype,"format",[AO],(function(){return jl.UNKNOWN})),DO=Gs(IO.prototype,"loadOp",[RO],(function(){return dc.CLEAR})),MO=Gs(IO.prototype,"storeOp",[bO],(function(){return fc.STORE})),PO=Gs(IO.prototype,"sampleCount",[ra],(function(){return 1})),BO=Gs(IO.prototype,"beginAccesses",[CO],(function(){return pc.NONE})),NO=Gs(IO.prototype,"endAccesses",[wO],(function(){return pc.COLOR_ATTACHMENT_WRITE})),xO=IO))||xO),bD=(LO=qs("DepthStencilDesc"),FO=xa(jl),kO=xa(dc),UO=xa(fc),GO=xa(dc),HO=xa(fc),zO=xa(pc),VO=xa(pc),LO((XO=function(){this.format=jO&&jO(),this.depthLoadOp=YO&&YO(),this.depthStoreOp=KO&&KO(),this.stencilLoadOp=qO&&qO(),this.stencilStoreOp=QO&&QO(),this.sampleCount=ZO&&ZO(),this.beginAccesses=JO&&JO(),this.endAccesses=$O&&$O()},jO=Gs(XO.prototype,"format",[FO],(function(){return jl.UNKNOWN})),YO=Gs(XO.prototype,"depthLoadOp",[kO],(function(){return dc.CLEAR})),KO=Gs(XO.prototype,"depthStoreOp",[UO],(function(){return fc.STORE})),qO=Gs(XO.prototype,"stencilLoadOp",[GO],(function(){return dc.CLEAR})),QO=Gs(XO.prototype,"stencilStoreOp",[HO],(function(){return fc.STORE})),ZO=Gs(XO.prototype,"sampleCount",[ra],(function(){return 1})),JO=Gs(XO.prototype,"beginAccesses",[zO],(function(){return pc.NONE})),$O=Gs(XO.prototype,"endAccesses",[VO],(function(){return pc.DEPTH_STENCIL_ATTACHMENT_WRITE})),WO=XO))||WO);tD=qs("RenderPassDesc"),eD=xa([RD]),iD=xa(bD),tD((nD=function(){this.index=rD&&rD(),this.colorAttachments=sD&&sD(),this.depthStencilAttachment=aD&&aD()},rD=Gs(nD.prototype,"index",[ra],(function(){return-1})),sD=Gs(nD.prototype,"colorAttachments",[eD],(function(){return[]})),aD=Gs(nD.prototype,"depthStencilAttachment",[iD],(function(){return new bD})),nD)),function(t){t[t.FRONT_TO_BACK=0]="FRONT_TO_BACK",t[t.BACK_TO_FRONT=1]="BACK_TO_FRONT"}(AD||(AD={})),Se(AD);var CD=(oD=qs("RenderQueueDesc"),hD=xa(AD),uD=xa([Ze]),oD((cD=function(){this.isTransparent=_D&&_D(),this.sortMode=dD&&dD(),this.stages=fD&&fD()},_D=Gs(cD.prototype,"isTransparent",[ra],(function(){return!1})),dD=Gs(cD.prototype,"sortMode",[hD],(function(){return AD.FRONT_TO_BACK})),fD=Gs(cD.prototype,"stages",[uD],(function(){return[]})),lD=cD))||lD);function wD(t,e){return t.hash-e.hash||t.depth-e.depth||t.shaderId-e.shaderId}function xD(t,e){return t.priority-e.priority||t.hash-e.hash||e.depth-t.depth||t.shaderId-e.shaderId}var ID=function(){function t(t){this.queue=void 0,this._passDesc=void 0,this._passPool=void 0,this._passDesc=t,this._passPool=new Bu((function(){return{priority:0,hash:0,depth:0,shaderId:0,subModel:null,passIdx:0}}),64),this.queue=new Nu(64,this._passDesc.sortFunc)}var e=t.prototype;return e.clear=function(){this.queue.clear(),this._passPool.reset()},e.insertRenderPass=function(t,e,i){var n=t.model.subModels[e],r=n.passes[i],s=n.shaders[i];if(r.blendState.targets[0].blend!==this._passDesc.isTransparent||!(r.phase&this._passDesc.phases))return!1;var a=0|r.priority<<16|n.priority<<8|i,o=this._passPool.add();return o.priority=t.model.priority,o.hash=a,o.depth=t.depth||0,o.shaderId=s.typedID,o.subModel=n,o.passIdx=i,this.queue.push(o),!0},e.sort=function(){this.queue.sort()},e.recordCommandBuffer=function(t,e,i){for(var n=0;n0){this._renderQueues.forEach(MD);for(var E=0;E0&&(this._stageDesc||(this._stageDesc=i.createDescriptorSet(new C_(u.localSetLayout)),this._localUBO=i.createBuffer(new qc(ql.UNIFORM|ql.TRANSFER_DST,Jl.DEVICE,qg.SIZE,qg.SIZE)),this._stageDesc.bindBuffer(qg.BINDING,this._localUBO)),this._stageDesc.update(),r.bindPipelineState(_),r.bindDescriptorSet(xg.MATERIAL,u.descriptorSet),r.bindDescriptorSet(xg.LOCAL,this._stageDesc),r.bindInputAssembler(c),r.draw(c)),this._uiPhase.render(t,h),xS(i,h,r,e.profiler,t),r.endRenderPass()},e}(DI)).initInfo={name:"PostProcessStage",priority:GI.POST_PROCESS,tag:0},rM=Gs((nM=aM).prototype,"_postProcessMaterial",[tM,ra],(function(){return null})),sM=Gs(nM.prototype,"renderQueues",[eM,ra],(function(){return[]})),iM=nM))||iM)),gM=function(){function t(){this._enabled=!1,this._minPos=new hn(0,0,0),this._maxPos=new hn(0,0,0),this._depth=0}return t.prototype.initialize=function(t){this._enabled=t.enabled,this._minPos=t.minPos,this._maxPos=t.maxPos,this._depth=t.depth},n(t,[{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled=t}},{key:"minPos",get:function(){return this._minPos},set:function(t){this._minPos=t}},{key:"maxPos",get:function(){return this._maxPos},set:function(t){this._maxPos=t}},{key:"depth",get:function(){return this._depth},set:function(t){this._depth=t}}]),t}(),vM=new Dn,yM=new Dn,TM=new Dn,SM=new Dn,EM=new Dn,AM=new Dn,RM=new Dn,bM=new hn(0,0,0),CM=new hn,wM=new Fn,xM=new hn,IM=new hn,OM=new hn(1e7,1e7,1e7),DM=new hn(-1e7,-1e7,-1e7),MM=new hn,PM=0,BM=0,NM=function(){function t(t){this._shadowObjects=[],this._shadowCameraFar=0,this._level=void 0,this._matShadowView=new Dn,this._matShadowProj=new Dn,this._matShadowViewProj=new Dn,this._validFrustum=new Is,this._splitFrustum=new Is,this._lightViewFrustum=new Is,this._castLightViewBoundingBox=new Es,this._level=t,this._validFrustum.accurate=!0,this._splitFrustum.accurate=!0,this._lightViewFrustum.accurate=!0}var e=t.prototype;return e.copyToValidFrustum=function(t){Is.copy(this._validFrustum,t)},e.calculateValidFrustumOrtho=function(t,e,i,n,r){Is.createOrtho(this._validFrustum,t,e,i,n,r)},e.calculateSplitFrustum=function(t,e,i,n){this._splitFrustum.split(i,n,t.aspect,t.fov,e)},e.destroy=function(){this._shadowObjects.length=0},e.createMatrix=function(t,e,i){var n=v.director.root.device,r=t.shadowInvisibleOcclusionRange;Is.copy(this._lightViewFrustum,this._splitFrustum),Dn.fromRT(yM,t.node.rotation,bM),Dn.invert(TM,yM);var s,a,o=TM.clone();this._lightViewFrustum.transform(TM),Es.fromPoints(this._castLightViewBoundingBox,OM,DM),this._castLightViewBoundingBox.mergeFrustum(this._lightViewFrustum),t.csmOptimizationMode===NS.DisableRotationFix?(s=2*this._castLightViewBoundingBox.halfExtents.x,a=2*this._castLightViewBoundingBox.halfExtents.y):s=a=hn.distance(this._lightViewFrustum.vertices[0],this._lightViewFrustum.vertices[6]);var h=v.director.root.pipeline.pipelineSceneData.csmSupported?t.csmLevel:1;if(h>1&&t.csmOptimizationMode===NS.RemoveDuplicates)if(this._level>=h-1)BM=this._castLightViewBoundingBox.halfExtents.z,PM=this._castLightViewBoundingBox.center.z;else{var u=Math.abs(this._castLightViewBoundingBox.center.z-PM)+BM;this._castLightViewBoundingBox.halfExtents.z=Math.max(this._castLightViewBoundingBox.center.z,u)}var l=this._castLightViewBoundingBox.halfExtents.z;this._shadowCameraFar=2*l+r;var c=this._castLightViewBoundingBox.center;if(MM.set(c.x,c.y,c.z+l+r),hn.transformMat4(MM,MM,yM),Dn.fromRT(yM,t.node.rotation,MM),Dn.invert(TM,yM),!i){var _=.5*s,d=.5*a;Dn.ortho(SM,-_,_,-d,d,.1,this._shadowCameraFar,n.capabilities.clipSpaceMinZ,n.capabilities.clipSpaceSignY),Dn.multiply(AM,SM,o),hn.transformMat4(CM,MM,AM);var f=2/e;wM.set(f,f);var p=CM.x%wM.x,m=CM.y%wM.y;xM.set(CM.x-p,CM.y-m,CM.z),Dn.invert(RM,AM),hn.transformMat4(IM,xM,RM),Dn.fromRT(yM,t.node.rotation,IM),Dn.invert(TM,yM),Dn.multiply(EM,SM,TM),Dn.copy(this._matShadowView,TM),Dn.copy(this._matShadowProj,SM),Dn.copy(this._matShadowViewProj,EM)}Is.createOrtho(this._validFrustum,s,a,.1,this._shadowCameraFar,yM)},n(t,[{key:"level",get:function(){return this._level}},{key:"shadowObjects",get:function(){return this._shadowObjects}},{key:"shadowCameraFar",get:function(){return this._shadowCameraFar},set:function(t){this._shadowCameraFar=t}},{key:"matShadowView",get:function(){return this._matShadowView},set:function(t){this._matShadowView=t}},{key:"matShadowProj",get:function(){return this._matShadowProj},set:function(t){this._matShadowProj=t}},{key:"matShadowViewProj",get:function(){return this._matShadowViewProj},set:function(t){this._matShadowViewProj=t}},{key:"validFrustum",get:function(){return this._validFrustum}},{key:"splitFrustum",get:function(){return this._splitFrustum}},{key:"lightViewFrustum",get:function(){return this._lightViewFrustum}},{key:"castLightViewBoundingBox",get:function(){return this._castLightViewBoundingBox}}]),t}(),LM=function(t){function e(e){var i;return(i=t.call(this,e)||this)._splitCameraNear=0,i._splitCameraFar=0,i._csmAtlas=new nn,i._calculateAtlas(e),i}s(e,t);var i=e.prototype;return i.destroy=function(){t.prototype.destroy.call(this)},i._calculateAtlas=function(t){var e=v.director.root.device.capabilities.clipSpaceSignY,i=t%2-.5,n=(.5-Math.floor(t/2))*e;this._csmAtlas.set(.5,.5,i,n)},n(e,[{key:"splitCameraNear",get:function(){return this._splitCameraNear},set:function(t){this._splitCameraNear=t}},{key:"splitCameraFar",get:function(){return this._splitCameraFar},set:function(t){this._splitCameraFar=t}},{key:"csmAtlas",get:function(){return this._csmAtlas},set:function(t){this._csmAtlas=t}}]),e}(NM),FM=function(){function t(){this._castShadowObjects=[],this._layerObjects=new Nu(64),this._layers=[],this._levelCount=0,this._specialLayer=new NM(1),this._shadowDistance=0;for(var t=0;t1?.5*i.size.x:i.size.x;if(!(r<0)){this._getCameraWorldMatrix(vM,t);for(var s=n-1;s>=0;s--){var a=this._layers[s],o=a.splitCameraNear,h=a.splitCameraFar;a.calculateSplitFrustum(t,vM,o,h),a.createMatrix(e,r,!1)}n===BS.LEVEL_1?(this._specialLayer.shadowCameraFar=this._layers[0].shadowCameraFar,Dn.copy(this._specialLayer.matShadowView,this._layers[0].matShadowView),Dn.copy(this._specialLayer.matShadowProj,this._layers[0].matShadowProj),Dn.copy(this._specialLayer.matShadowViewProj,this._layers[0].matShadowViewProj),this._specialLayer.copyToValidFrustum(this._layers[0].validFrustum)):(this._specialLayer.calculateSplitFrustum(t,vM,.1,e.shadowDistance),this._specialLayer.createMatrix(e,r,!0))}},e._getCameraWorldMatrix=function(t,e){if(e.node){var i=e.node,n=i.getWorldPosition(),r=i.getWorldRotation();Dn.fromRT(t,r,n)}},n(t,[{key:"castShadowObjects",get:function(){return this._castShadowObjects}},{key:"layerObjects",get:function(){return this._layerObjects}},{key:"layers",get:function(){return this._layers}},{key:"specialLayer",get:function(){return this._specialLayer}}]),t}(),kM=function(){function t(){this._enabled=!0,this._blurRadius=.01,this._sssIntensity=3}return t.prototype.initialize=function(t){this._enabled=t.enabled,this._blurRadius=t.blurRadius,this._sssIntensity=t.sssIntensity},n(t,[{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled=t}},{key:"blurRadius",get:function(){return this._blurRadius},set:function(t){this._blurRadius=t}},{key:"sssIntensity",get:function(){return this._sssIntensity},set:function(t){this._sssIntensity=t}}]),t}(),UM=t("da",function(){function t(){this.fog=new YS,this.ambient=new mg,this.skybox=new VS,this.shadows=new FS,this.csmLayers=new FM,this.octree=new gM,this.skin=new kM,this.postSettings=new gR,this.lightProbes=v.internal.LightProbes?new v.internal.LightProbes:null,this.validPunctualLights=[],this.renderObjects=[],this.shadowFrameBufferMap=new Map,this._geometryRendererMaterials=[],this._geometryRendererPasses=[],this._geometryRendererShaders=[],this._occlusionQueryVertexBuffer=null,this._occlusionQueryIndicesBuffer=null,this._occlusionQueryInputAssembler=null,this._occlusionQueryMaterial=null,this._occlusionQueryShader=null,this._isHDR=!0,this._shadingScale=1,this._csmSupported=!0,this._standardSkinMeshRenderer=null,this._standardSkinModel=null,this._skinMaterialModel=null,this._shadingScale=1}var e=t.prototype;return e.activate=function(t){return this._device=t,this.initGeometryRendererMaterials(),this.initOcclusionQuery(),!0},e.initGeometryRendererMaterials=function(){for(var t=0,e=0;e<6;e++){this._geometryRendererMaterials[e]=new OS,this._geometryRendererMaterials[e]._uuid="geometry-renderer-material-"+e,this._geometryRendererMaterials[e].initialize({effectName:"internal/builtin-geometry-renderer",technique:e});for(var i=0;i0&&(this._occlusionQueryShader=t.passes[0].getShaderVariant())}},e.getOcclusionQueryPass=function(){return this._occlusionQueryMaterial&&this._occlusionQueryMaterial.passes.length>0?this._occlusionQueryMaterial.passes[0]:null},e.updatePipelineSceneData=function(){},e.destroy=function(){var t,e,i;this.shadows.destroy(),this.csmLayers.destroy(),this.validPunctualLights.length=0,null===(t=this._occlusionQueryInputAssembler)||void 0===t||t.destroy(),this._occlusionQueryInputAssembler=null,null===(e=this._occlusionQueryVertexBuffer)||void 0===e||e.destroy(),this._occlusionQueryVertexBuffer=null,null===(i=this._occlusionQueryIndicesBuffer)||void 0===i||i.destroy(),this._occlusionQueryIndicesBuffer=null,this._standardSkinMeshRenderer=null,this._standardSkinModel=null,this._skinMaterialModel=null},e._createOcclusionQueryIA=function(){var t=this._device,e=new Float32Array([-1,-1,-1,1,-1,-1,-1,1,-1,1,1,-1,-1,-1,1,1,-1,1,-1,1,1,1,1,1]),i=3*Float32Array.BYTES_PER_ELEMENT,n=8*i;this._occlusionQueryVertexBuffer=t.createBuffer(new qc(ql.VERTEX|ql.TRANSFER_DST,Jl.DEVICE,n,i)),this._occlusionQueryVertexBuffer.update(e);var r=new Uint16Array([0,2,1,1,2,3,4,5,6,5,7,6,1,3,7,1,7,5,0,4,6,0,6,2,0,1,5,0,5,4,2,6,7,2,7,3]),s=Uint16Array.BYTES_PER_ELEMENT,a=36*s;this._occlusionQueryIndicesBuffer=t.createBuffer(new qc(ql.INDEX|ql.TRANSFER_DST,Jl.DEVICE,a,s)),this._occlusionQueryIndicesBuffer.update(r);var o=[new __("a_position",jl.RGB32F)],h=new f_(o,[this._occlusionQueryVertexBuffer],this._occlusionQueryIndicesBuffer);return t.createInputAssembler(h)},n(t,[{key:"isHDR",get:function(){return this._isHDR},set:function(t){this._isHDR=t}},{key:"shadingScale",get:function(){return this._shadingScale},set:function(t){this._shadingScale=t}},{key:"csmSupported",get:function(){return this._csmSupported},set:function(t){this._csmSupported=t}},{key:"standardSkinModel",get:function(){return this._standardSkinModel},set:function(t){this._standardSkinModel=t}},{key:"standardSkinMeshRenderer",get:function(){return this._standardSkinMeshRenderer},set:function(t){this._standardSkinMeshRenderer&&this._standardSkinMeshRenderer!==t&&this._standardSkinMeshRenderer.clearGlobalStandardSkinObjectFlag(),this._standardSkinMeshRenderer=t,this.standardSkinModel=t?t.model:null}},{key:"skinMaterialModel",get:function(){return this._skinMaterialModel},set:function(t){this._skinMaterialModel=t}},{key:"geometryRendererPasses",get:function(){return this._geometryRendererPasses}},{key:"geometryRendererShaders",get:function(){return this._geometryRendererShaders}}]),t}());!function(t){t[t.NONE=0]="NONE",t[t.FXAA=1]="FXAA"}(oM||(oM={}));var GM,HM,zM,VM,WM,XM,jM,YM=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r>=1,this._renderArea.height>>=1;var i=e.commandBuffers[0],n=e.pipelineSceneData.bloomMaterial.passes[0],r=e.getPipelineRenderData(),s=r.bloom,a=new Float32Array(qM.COUNT);a[qM.TEXTURE_SIZE_OFFSET+2]=this.threshold,i.updateBuffer(this._bloomUBO[0],a),i.beginRenderPass(s.renderPass,s.prefilterFramebuffer,this._renderArea,KM,0,0),i.bindDescriptorSet(xg.GLOBAL,e.descriptorSet),n.descriptorSet.bindBuffer(0,this._bloomUBO[0]),n.descriptorSet.bindTexture(1,r.outputRenderTargets[0]),n.descriptorSet.bindSampler(1,s.sampler),n.descriptorSet.update(),i.bindDescriptorSet(xg.MATERIAL,n.descriptorSet);var o=t.window.swapchain?e.quadIAOffscreen:e.quadIAOnscreen,h=null,u=n.getShaderVariant();null!=n&&null!=u&&null!=o&&(h=dS.getOrCreatePipelineState(e.device,n,u,s.renderPass,o)),null!=h&&(i.bindPipelineState(h),i.bindInputAssembler(o),i.draw(o)),i.endRenderPass()},i._downsamplePass=function(t,e){e.generateRenderArea(t,this._renderArea),this._renderArea.width>>=1,this._renderArea.height>>=1;for(var i=e.commandBuffers[0],n=e.pipelineSceneData.bloomMaterial,r=e.getPipelineRenderData().bloom,s=new Float32Array(qM.COUNT),a=0;a>=1,this._renderArea.height>>=1,i.beginRenderPass(r.renderPass,r.downsampleFramebuffers[a],this._renderArea,KM,0,0);var o=n.passes[1+a],h=o.getShaderVariant();o.descriptorSet.bindBuffer(0,this._bloomUBO[a+1]),0===a?o.descriptorSet.bindTexture(1,r.prefiterTex):o.descriptorSet.bindTexture(1,r.downsampleTexs[a-1]),o.descriptorSet.bindSampler(1,r.sampler),o.descriptorSet.update(),i.bindDescriptorSet(xg.MATERIAL,o.descriptorSet);var u=t.window.swapchain?e.quadIAOffscreen:e.quadIAOnscreen,l=null;null!=o&&null!=h&&null!=u&&(l=dS.getOrCreatePipelineState(e.device,o,h,r.renderPass,u)),null!=l&&(i.bindPipelineState(l),i.bindInputAssembler(u),i.draw(u)),i.endRenderPass()}},i._upsamplePass=function(t,e){var i=e.getPipelineRenderData().bloom;e.generateRenderArea(t,this._renderArea),this._renderArea.width>>=this.iterations+1,this._renderArea.height>>=this.iterations+1;for(var n=e.commandBuffers[0],r=e.pipelineSceneData.bloomMaterial,s=new Float32Array(qM.COUNT),a=0;a=0;h--){var u=r.array[h];if(u){var l=u.model;l&&l.enabled&&l.node&&((o&l.node.layer)===l.node.layer||o&l.visFlags)&&l.worldBounds&&l.castShadow?us.aabbFrustum(l.worldBounds,s)&&(a.push(u),i.level0?.5*(1-Math.floor(a/2))*h.y:.5*Math.floor(a/2)*h.y,this._renderArea.width=.5*h.x,this._renderArea.height=.5*h.y}break;case hx.SPOT:this._renderArea.x=0,this._renderArea.y=0,this._renderArea.width=h.x,this._renderArea.height=h.y}var c=this._shadowFrameBuffer.renderPass;s.beginRenderPass(c,this._shadowFrameBuffer,this._renderArea,_P,t.clearDepth,t.clearStencil),s.bindDescriptorSet(xg.GLOBAL,r),this._additiveShadowQueue.recordCommandBuffer(o,c,s),s.endRenderPass(),this._isShadowMapCleared=!1}},i.activate=function(e,i){t.prototype.activate.call(this,e,i),this._additiveShadowQueue=new cP(e),this._isShadowMapCleared=!1},e}(DI)).initInfo={name:"ShadowStage",priority:HI.FORWARD,tag:0},iP=nP))||iP),fP=[],pP=t("dl",qs("ShadowFlow")(((sP=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r=(Pg.COUNT+Bg.COUNT+Ng.COUNT+Lg.COUNT)/4,e.macros.CC_SUPPORT_CASCADED_SHADOW_MAP=e.pipelineSceneData.csmSupported,e.macros.CC_SHADOW_TYPE=0,e.macros.CC_DIR_SHADOW_PCF_TYPE=PS.HARD,e.macros.CC_DIR_LIGHT_SHADOW_TYPE=0,e.macros.CC_CASCADED_LAYERS_TRANSITION=0,e.onGlobalPipelineStateChanged()},i.render=function(t){var e=this._pipeline,i=e.pipelineSceneData.shadows,n=e.pipelineSceneData.csmLayers,r=e.pipelineSceneData.shadowFrameBufferMap,s=n.castShadowObjects,a=this._pipeline.pipelineSceneData.validPunctualLights;if(i.enabled&&i.type===MS.ShadowMap){for(var o=0,h=0;o0)))for(var a=0;athis._lightBufferCount&&(this._firstLightBufferView.destroy(),this._lightBufferCount=Hi(a.length),this._lightBuffer.resize(this._lightBufferStride*this._lightBufferCount),this._lightBufferData=new Float32Array(this._lightBufferElementCount*this._lightBufferCount),this._firstLightBufferView=wd.gfxDevice.createBuffer(new Qc(this._lightBuffer,0,tv.SIZE)));for(var o=0,h=0;o-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;n1e-4&&(i=Math.log(e)/Math.log(1.1),i=Ii((i=Math.ceil(i))+128,0,255));var n=1/Math.pow(1.1,i-128),r=function(t,e,i){if(e>i){var n=e;e=i,i=n}return ti?i:t}(t.multiplyScalar(n),new hn(0,0,0),new hn(1,1,1));r.multiplyScalar(255);var s,a,o=gn(r).add((s=r.subtract(gn(r)))<(a=new hn(.5,.5,.5))?a:s);return new nn(o.x/255,o.y/255,o.z/255,i/255)}(this._rgbeColor);hB[0].x=r.x,hB[0].y=r.y,hB[0].z=r.z,hB[0].w=r.w}var s=e.device;i.beginRenderPass(n,this._frameBuffer,this._renderArea,hB,this._probe.camera.clearDepth,this._probe.camera.clearStencil),i.bindDescriptorSet(xg.GLOBAL,e.descriptorSet),this._probeRenderQueue.recordCommandBuffer(s,n,i),i.endRenderPass(),e.pipelineUBO.updateCameraUBO(t)},i.activate=function(e,i){t.prototype.activate.call(this,e,i),this._probeRenderQueue=new oB(e)},e}(DI)).initInfo={name:"ReflectionProbeStage",priority:HI.FORWARD,tag:0},JP=$P))||JP),lB=t("dt",qs("ReflectionProbeFlow")(((eB=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.initialize=function(e){if(t.prototype.initialize.call(this,e),0===this._stages.length){var i=new uB;i.initialize(uB.initInfo),this._stages.push(i)}return!0},i.activate=function(e){t.prototype.activate.call(this,e)},i.render=function(t){if(v.internal.reflectionProbeManager)for(var e=v.internal.reflectionProbeManager.getProbes(),i=0;i8?Z(12004,8):(this._passes=t,this._flushPassInfo(),this._descriptorSet&&(this._descriptorSet.destroy(),fB.layout=t[0].localSetLayout,this._descriptorSet=this._device.createDescriptorSet(fB)))}},{key:"shaders",get:function(){return this._shaders}},{key:"subMesh",get:function(){return this._subMesh},set:function(t){this._inputAssembler.destroy(),this._inputAssembler=this._device.createInputAssembler(t.iaInfo),this._subMesh=t}},{key:"priority",get:function(){return this._priority},set:function(t){this._priority=t}},{key:"inputAssembler",get:function(){return this._inputAssembler}},{key:"descriptorSet",get:function(){return this._descriptorSet}},{key:"worldBoundDescriptorSet",get:function(){return this._worldBoundDescriptorSet}},{key:"patches",get:function(){return this._patches}},{key:"instancedAttributeBlock",get:function(){return this._instancedAttributeBlock}},{key:"instancedWorldMatrixIndex",get:function(){return this._instancedWorldMatrixIndex},set:function(t){this._instancedWorldMatrixIndex=t}},{key:"instancedSHIndex",get:function(){return this._instancedSHIndex},set:function(t){this._instancedSHIndex=t}},{key:"useReflectionProbeType",get:function(){return this._useReflectionProbeType},set:function(t){this._useReflectionProbeType=t}}]),t}();t("al",_B),function(t){t[t.NONE=0]="NONE",t[t.BAKED_CUBEMAP=1]="BAKED_CUBEMAP",t[t.PLANAR_REFLECTION=2]="PLANAR_REFLECTION",t[t.BLEND_PROBES=3]="BLEND_PROBES",t[t.BLEND_PROBES_AND_SKYBOX=4]="BLEND_PROBES_AND_SKYBOX"}(_B||t("al",_B={}));var mB,gB=new Dn,vB=[{name:"CC_RECEIVE_SHADOW",value:!0}],yB=[{name:"CC_USE_LIGHTMAP",value:1}],TB=[{name:"CC_USE_LIGHTMAP",value:2}],SB=[{name:"CC_LIGHT_MAP_VERSION",value:2}],EB=[{name:"CC_USE_LIGHT_PROBE",value:!0}];!function(t){t[t.DEFAULT=0]="DEFAULT",t[t.SKINNING=1]="SKINNING",t[t.BAKED_SKINNING=2]="BAKED_SKINNING",t[t.BATCH_2D=3]="BATCH_2D",t[t.PARTICLE_BATCH=4]="PARTICLE_BATCH",t[t.LINE=5]="LINE"}(mB||(mB={}));var AB,RB,bB,CB,wB=new i_(sc.LINEAR,sc.LINEAR,sc.NONE,ac.CLAMP,ac.CLAMP,ac.CLAMP),xB=new i_(sc.LINEAR,sc.LINEAR,sc.LINEAR,ac.CLAMP,ac.CLAMP,ac.CLAMP),IB=function(){function t(){this.type=mB.DEFAULT,this.scene=null,this.isDynamicBatching=!1,this._worldBounds=null,this._modelBounds=null,this._subModels=[],this._node=null,this._transform=null,this._device=void 0,this._inited=!1,this._descriptorSetCount=1,this._updateStamp=-1,this._localDataUpdated=!0,this._localData=new Float32Array(qg.COUNT),this._localBuffer=null,this._localSHData=null,this._localSHBuffer=null,this._lightmap=null,this._lightmapUVParam=new nn,this._tetrahedronIndex=-1,this._lastWorldBoundCenter=new hn(1/0,1/0,1/0),this._useLightProbe=!1,this._worldBoundBuffer=null,this._receiveShadow=!1,this._castShadow=!1,this._receiveDirLight=!0,this._shadowBias=0,this._shadowNormalBias=0,this._reflectionProbeId=-1,this._reflectionProbeBlendId=-1,this._reflectionProbeBlendWeight=0,this._enabled=!0,this._visFlags=sm.Enum.NONE,this._priority=0,this._bakeToReflectionProbe=!0,this._reflectionProbeType=_B.NONE,this._device=wd.gfxDevice}var e=t.prototype;return e.initialize=function(){this._inited||(this._receiveShadow=!0,this.castShadow=!1,this.enabled=!0,this.visFlags=sm.Enum.NONE,this._inited=!0,this._bakeToReflectionProbe=!0,this._reflectionProbeType=_B.NONE)},e.destroy=function(){for(var t=this._subModels,e=0;e=0?o.updateInstancedWorldMatrix(r,h):s=!0}(s||n)&&this._localBuffer&&(Dn.toArray(this._localData,r,qg.MAT_WORLD_OFFSET),Dn.invert(gB,r),Dn.transpose(gB,gB),Dn.toArray(this._localData,gB,qg.MAT_WORLD_IT_OFFSET),this._localBuffer.update(this._localData))}},e.invalidateLocalData=function(){this._localDataUpdated=!0},e.showTetrahedron=function(){return this.isLightProbeAvailable()},e.isLightProbeAvailable=function(){if(!this._useLightProbe)return!1;var t=v.director.root.pipeline.pipelineSceneData.lightProbes;return!(!t||t.empty()||!this._worldBounds)},e.updateSHBuffer=function(){if(this._localSHData){for(var t=this._subModels,e=!1,i=0;i=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;t1?xB:wB),r=this._subModels,s=0;s1&&e.pipelineSceneData.csmSupported?(e.macros.CC_DIR_LIGHT_SHADOW_TYPE=2,e.macros.CC_CASCADED_LAYERS_TRANSITION=this._csmLayersTransition):e.macros.CC_DIR_LIGHT_SHADOW_TYPE=1,e.macros.CC_DIR_SHADOW_PCF_TYPE=this._shadowPcf):e.macros.CC_DIR_LIGHT_SHADOW_TYPE=0,t.onGlobalPipelineStateChanged()},n(e,[{key:"direction",get:function(){return this._dir},set:function(t){hn.normalize(this._dir,t)}},{key:"illuminance",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR?this._illuminanceHDR:this._illuminanceLDR},set:function(t){v.director.root.pipeline.pipelineSceneData.isHDR?this.illuminanceHDR=t:this.illuminanceLDR=t}},{key:"illuminanceHDR",get:function(){return this._illuminanceHDR},set:function(t){this._illuminanceHDR=t}},{key:"illuminanceLDR",get:function(){return this._illuminanceLDR},set:function(t){this._illuminanceLDR=t}},{key:"shadowEnabled",get:function(){return this._shadowEnabled},set:function(t){this._shadowEnabled=t,this.activate()}},{key:"shadowPcf",get:function(){return this._shadowPcf},set:function(t){this._shadowPcf=t,this.activate()}},{key:"shadowBias",get:function(){return this._shadowBias},set:function(t){this._shadowBias=t}},{key:"shadowNormalBias",get:function(){return this._shadowNormalBias},set:function(t){this._shadowNormalBias=t}},{key:"shadowSaturation",get:function(){return this._shadowSaturation},set:function(t){this._shadowSaturation=t}},{key:"shadowDistance",get:function(){return this._shadowDistance},set:function(t){this._shadowDistance=Math.min(t,FS.MAX_FAR)}},{key:"shadowInvisibleOcclusionRange",get:function(){return this._shadowInvisibleOcclusionRange},set:function(t){this._shadowInvisibleOcclusionRange=Math.min(t,FS.MAX_FAR)}},{key:"csmLevel",get:function(){return this._csmLevel},set:function(t){this._csmLevel=t,this.activate()}},{key:"csmNeedUpdate",get:function(){return this._csmNeedUpdate},set:function(t){this._csmNeedUpdate=t}},{key:"csmLayerLambda",get:function(){return this._csmLayerLambda},set:function(t){this._csmLayerLambda=t}},{key:"csmOptimizationMode",get:function(){return this._csmOptimizationMode},set:function(t){this._csmOptimizationMode=t}},{key:"shadowFixedArea",get:function(){return this._shadowFixedArea},set:function(t){this._shadowFixedArea=t,this.activate()}},{key:"shadowNear",get:function(){return this._shadowNear},set:function(t){this._shadowNear=t}},{key:"shadowFar",get:function(){return this._shadowFar},set:function(t){this._shadowFar=Math.min(t,FS.MAX_FAR)}},{key:"shadowOrthoSize",get:function(){return this._shadowOrthoSize},set:function(t){this._shadowOrthoSize=t}},{key:"csmLayersTransition",get:function(){return this._csmLayersTransition},set:function(t){this._csmLayersTransition=t,this.activate()}},{key:"csmTransitionRange",get:function(){return this._csmTransitionRange},set:function(t){this._csmTransitionRange=t}}]),e}(bx),PB=function(t){function e(){var e;return(e=t.call(this)||this)._needUpdate=!1,e._size=.15,e._range=1,e._luminanceHDR=0,e._luminanceLDR=0,e._pos=void 0,e._aabb=void 0,e._aabb=Es.create(),e._pos=new hn,e._type=hx.SPHERE,e}s(e,t);var i=e.prototype;return i.initialize=function(){t.prototype.initialize.call(this),this.size=.15,this.range=1,this.luminanceHDR=1700/Rx(.15),this.luminanceLDR=1},i.update=function(){if(this._node&&(this._node.hasChangedFlags||this._needUpdate)){this._node.getWorldPosition(this._pos);var t=this._range;Es.set(this._aabb,this._pos.x,this._pos.y,this._pos.z,t,t,t),this._needUpdate=!1}},n(e,[{key:"position",get:function(){return this._pos}},{key:"size",get:function(){return this._size},set:function(t){this._size=t}},{key:"range",get:function(){return this._range},set:function(t){this._range=t,this._needUpdate=!0}},{key:"luminance",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){v.director.root.pipeline.pipelineSceneData.isHDR?this.luminanceHDR=t:this.luminanceLDR=t}},{key:"luminanceHDR",get:function(){return this._luminanceHDR},set:function(t){this._luminanceHDR=t}},{key:"luminanceLDR",set:function(t){this._luminanceLDR=t}},{key:"aabb",get:function(){return this._aabb}}]),e}(bx),BB=new hn(0,0,-1),NB=new En,LB=new Dn,FB=new Dn,kB=new Dn,UB=new Dn,GB=function(t){function e(){var e;return(e=t.call(this)||this)._dir=new hn(1,-1,-1),e._range=5,e._spotAngle=Math.cos(Math.PI/6),e._pos=void 0,e._aabb=void 0,e._frustum=void 0,e._angle=0,e._needUpdate=!1,e._size=.15,e._luminanceHDR=0,e._luminanceLDR=0,e._shadowEnabled=!1,e._shadowPcf=PS.HARD,e._shadowBias=1e-5,e._shadowNormalBias=0,e._aabb=Es.create(),e._frustum=Is.create(),e._pos=new hn,e._type=hx.SPOT,e}s(e,t);var i=e.prototype;return i.initialize=function(){t.prototype.initialize.call(this),this.size=.15,this.luminanceHDR=1700/Rx(.15),this.luminanceLDR=1,this.range=Math.cos(Math.PI/6),this._dir.set(new hn(1,-1,-1))},i.update=function(){this._node&&(this._node.hasChangedFlags||this._needUpdate)&&(this._node.getWorldPosition(this._pos),hn.transformQuat(this._dir,BB,this._node.getWorldRotation(NB)),hn.normalize(this._dir,this._dir),Es.set(this._aabb,this._pos.x,this._pos.y,this._pos.z,this._range,this._range,this._range),this._node.getWorldRT(LB),Dn.invert(LB,LB),Dn.perspective(FB,this._angle,1,.001,this._range),Dn.multiply(kB,FB,LB),this._frustum.update(kB,UB),this._needUpdate=!1)},n(e,[{key:"position",get:function(){return this._pos}},{key:"size",get:function(){return this._size},set:function(t){this._size=t}},{key:"range",get:function(){return this._range},set:function(t){this._range=t,this._needUpdate=!0}},{key:"luminance",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){v.director.root.pipeline.pipelineSceneData.isHDR?this.luminanceHDR=t:this.luminanceLDR=t}},{key:"luminanceHDR",get:function(){return this._luminanceHDR},set:function(t){this._luminanceHDR=t}},{key:"luminanceLDR",get:function(){return this._luminanceLDR},set:function(t){this._luminanceLDR=t}},{key:"direction",get:function(){return this._dir}},{key:"spotAngle",get:function(){return this._spotAngle},set:function(t){this._angle=t,this._spotAngle=Math.cos(.5*t),this._needUpdate=!0}},{key:"angle",get:function(){return this._angle}},{key:"aabb",get:function(){return this._aabb}},{key:"frustum",get:function(){return this._frustum}},{key:"shadowEnabled",get:function(){return this._shadowEnabled},set:function(t){this._shadowEnabled=t}},{key:"shadowPcf",get:function(){return this._shadowPcf},set:function(t){this._shadowPcf=t}},{key:"shadowBias",get:function(){return this._shadowBias},set:function(t){this._shadowBias=t}},{key:"shadowNormalBias",get:function(){return this._shadowNormalBias},set:function(t){this._shadowNormalBias=t}}]),e}(bx),HB=function(t){function e(){var e;return(e=t.call(this)||this)._needUpdate=!1,e._range=1,e._luminanceHDR=0,e._luminanceLDR=0,e._pos=void 0,e._aabb=void 0,e._aabb=Es.create(),e._pos=new hn,e._type=hx.POINT,e}s(e,t);var i=e.prototype;return i.initialize=function(){t.prototype.initialize.call(this),this.range=1,this.luminanceHDR=1700/Rx(1),this.luminanceLDR=1},i.update=function(){if(this._node&&(this._node.hasChangedFlags||this._needUpdate)){this._node.getWorldPosition(this._pos);var t=this._range;Es.set(this._aabb,this._pos.x,this._pos.y,this._pos.z,t,t,t),this._needUpdate=!1}},n(e,[{key:"position",get:function(){return this._pos}},{key:"range",get:function(){return this._range},set:function(t){this._range=t,this._needUpdate=!0}},{key:"luminance",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){v.director.root.pipeline.pipelineSceneData.isHDR?this.luminanceHDR=t:this.luminanceLDR=t}},{key:"luminanceHDR",get:function(){return this._luminanceHDR},set:function(t){this._luminanceHDR=t}},{key:"luminanceLDR",set:function(t){this._luminanceLDR=t}},{key:"aabb",get:function(){return this._aabb}}]),e}(bx),zB=new hn(0,0,-1),VB=function(t){function e(){var e;return(e=t.call(this)||this)._dir=new hn(0,0,-1),e._pos=new hn(0,0,0),e._scale=new hn(1,1,1),e._right=new hn(1,0,0),e._illuminanceHDR=mg.SUN_ILLUM,e._illuminanceLDR=1,e._type=hx.RANGED_DIRECTIONAL,e}s(e,t);var i=e.prototype;return i.initialize=function(){t.prototype.initialize.call(this),this.illuminance=mg.SUN_ILLUM},i.update=function(){this._node&&this._node.hasChangedFlags&&(this._node.getWorldPosition(this._pos),this._node.getWorldScale(this._scale),hn.transformQuat(this._dir,zB,this._node.worldRotation),hn.transformQuat(this._right,hn.RIGHT,this._node.worldRotation))},n(e,[{key:"direction",get:function(){return this._dir}},{key:"right",get:function(){return this._right}},{key:"position",get:function(){return this._pos}},{key:"scale",get:function(){return this._scale}},{key:"illuminance",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR?this._illuminanceHDR:this._illuminanceLDR},set:function(t){v.director.root.pipeline.pipelineSceneData.isHDR?this.illuminanceHDR=t:this.illuminanceLDR=t}},{key:"illuminanceHDR",get:function(){return this._illuminanceHDR},set:function(t){this._illuminanceHDR=t}},{key:"illuminanceLDR",get:function(){return this._illuminanceLDR},set:function(t){this._illuminanceLDR=t}}]),e}(bx),WB=function(){function t(){this.screenUsagePercentage=1,this._models=[]}var e=t.prototype;return e.addModel=function(t){this._models.splice(0,0,t)},e.eraseModel=function(t){var e=this._models.indexOf(t);e>=0&&this._models.splice(e,1)},e.clearModels=function(){this._models.length=0},n(t,[{key:"models",get:function(){return this._models}}]),t}(),XB=function(){function t(){this.scene=void 0,this.node=null,this._device=void 0,this.enabled=!0,this._localBoundaryCenter=new hn(0,0,0),this._objectSize=1,this._lodDataArray=[],this._lockedLODLevelVec=[],this._isLockLevelChanged=!1,this._device=wd.gfxDevice}var e=t.prototype;return e.attachToScene=function(t){this.scene=t},e.detachFromScene=function(){this.scene=null},e.lockLODLevels=function(t){if(t.length!==this._lockedLODLevelVec.length)this._isLockLevelChanged=!0;else for(var e=t.length,i=0;i=this.lodDataArray[n].screenUsagePercentage){i=n;break}return i},e.getScreenUsagePercentage=function(t){return this.node?(t.projectionType===Iw.PERSPECTIVE&&(e=hn.len(this.localBoundaryCenter.transformMat4(this.node.worldMatrix).subtract(t.node.worldPosition))),this.distanceToScreenUsagePercentage(t,e,this.getWorldSpaceSize())):0;var e},e.distanceToScreenUsagePercentage=function(t,e,i){return t.projectionType===Iw.PERSPECTIVE?i*t.matProj.m05/(2*e):i*t.matProj.m05*.5},e.getWorldSpaceSize=function(){var t=this.node.scale;return Math.max(Math.abs(t.x),Math.abs(t.y),Math.abs(t.z))*this.objectSize},n(t,[{key:"localBoundaryCenter",get:function(){return this._localBoundaryCenter.clone()},set:function(t){this._localBoundaryCenter.set(t)}},{key:"lodCount",get:function(){return this._lodDataArray.length}},{key:"objectSize",get:function(){return this._objectSize},set:function(t){this._objectSize=t}},{key:"lodDataArray",get:function(){return this._lodDataArray}}]),t}(),jB=Object.freeze({__proto__:null,get CameraFOVAxis(){return xw},get CameraProjection(){return Iw},get CameraAperture(){return Ow},get CameraISO(){return Dw},get CameraShutter(){return Mw},get CameraType(){return Pw},get TrackingType(){return Bw},get CameraUsage(){return Nw},SKYBOX_FLAG:Ww,Camera:jw,get ModelType(){return mB},Model:IB,SubModel:pB,Ambient:mg,EnvironmentLightingType:zS,Skybox:VS,ShadowSize:DS,ShadowType:MS,PCFType:PS,CSMLevel:BS,CSMOptimizationMode:NS,Shadows:FS,FogType:XS,FOG_TYPE_NONE:jS,Fog:YS,Octree:gM,Skin:kM,ColorTemperatureToRGB:cx,get LightType(){return hx},nt2lm:Rx,Light:bx,DirectionalLight:MB,SphereLight:PB,SpotLight:GB,PointLight:HB,RangedDirectionalLight:VB,get ProbeClearFlag(){return nx},get ProbeType(){return rx},ReflectionProbe:lx,LODData:WB,LODGroup:XB,ToneMappingType:mR,PostSettings:gR}),YB=function(){function t(t){this._root=void 0,this._name="",this._cameras=[],this._models=[],this._lodGroups=[],this._batches=[],this._directionalLights=[],this._sphereLights=[],this._spotLights=[],this._pointLights=[],this._rangedDirLights=[],this._mainLight=null,this._modelId=0,this._lodStateCache=null,this._root=t}t.registerCreateFunc=function(e){e._createSceneFun=function(e){return new t(e)}};var e=t.prototype;return e.initialize=function(t){return this._name=t.name,this._lodStateCache=new qB(this),!0},e.update=function(t){var e=this._mainLight;e&&e.update();for(var i=this._sphereLights,n=0;n=0&&(this._lodGroups.splice(e,1),t.detachFromScene(),this._lodStateCache.removeLodGroup(t))},e.removeLODGroups=function(){for(var t,e=d(this._lodGroups);!(t=e()).done;){var i=t.value;this._lodStateCache.removeLodGroup(i)}this._lodGroups.length=0},e.onGlobalPipelineStateChanged=function(){for(var t,e=d(this._models);!(t=e()).done;)t.value.onGlobalPipelineStateChanged()},e.generateModelId=function(){return this._modelId++},n(t,[{key:"root",get:function(){return this._root}},{key:"name",get:function(){return this._name}},{key:"cameras",get:function(){return this._cameras}},{key:"mainLight",get:function(){return this._mainLight}},{key:"sphereLights",get:function(){return this._sphereLights}},{key:"spotLights",get:function(){return this._spotLights}},{key:"pointLights",get:function(){return this._pointLights}},{key:"rangedDirLights",get:function(){return this._rangedDirLights}},{key:"models",get:function(){return this._models}},{key:"batches",get:function(){return this._batches}},{key:"lodGroups",get:function(){return this._lodGroups}}]),t}(),KB=function(){this.usedLevel=-1,this.lastUsedLevel=-1,this.transformDirty=!0},qB=function(){function t(t){this._renderScene=null,this._modelsInLODGroup=new Map,this._lodStateInCamera=new Map,this._newAddedLodGroupVec=new Array,this._levelModels=new Map,this._renderScene=t}var e=t.prototype;return e.addCamera=function(t){for(var e,i=d(this._renderScene.lodGroups);!(e=i()).done;){var n=e.value.node.layer;if((t.visibility&n)===n){this._lodStateInCamera.has(t)||this._lodStateInCamera.set(t,new Map);break}}},e.removeCamera=function(t){this._lodStateInCamera.has(t)&&this._lodStateInCamera.delete(t)},e.addLodGroup=function(t){this._newAddedLodGroupVec.push(t);for(var e,i=d(this._renderScene.cameras);!(e=i()).done;){var n=e.value;if(!this._lodStateInCamera.has(n)){var r=t.node.layer;(n.visibility&r)===r&&this._lodStateInCamera.set(n,new Map)}}},e.removeLodGroup=function(t){for(var e=0;e0){if(t.node.hasChangedFlags>0)for(var n,r=d(e._lodStateInCamera);!(n=r()).done;){var s=n.value,a=s[1].get(t);a||(a=new KB,s[1].set(t,a)),a.transformDirty=!0}if(t.isLockLevelChanged()){t.resetLockChangeFlag();var o=e._levelModels.get(t);if(o){o.forEach((function(t){t.forEach((function(t){var i=e._modelsInLODGroup.get(t);i&&i.clear()}))}));for(var h,u=d(i);!(h=u()).done;){var l=h.value,_=o.get(l);_&&_.forEach((function(t){var i=e._modelsInLODGroup.get(t);if(i&&t.node&&t.node.active)for(var n,r=d(e._lodStateInCamera);!(n=r()).done;){var s=n.value;i.set(s[0],!0)}}))}}}return 0}for(var f,p=!1,m=d(e._lodStateInCamera);!(f=m()).done;){var g=f.value,v=g[1].get(t);v||(v=new KB,g[1].set(t,v));var y=g[0].node.hasChangedFlags,T=t.node.hasChangedFlags;if(y>0||T>0||v.transformDirty){v.transformDirty&&(v.transformDirty=!1);var S=t.getVisibleLODLevel(g[0]);S!==v.usedLevel&&(v.lastUsedLevel=v.usedLevel,v.usedLevel=S,p=!0)}}var E=e._levelModels.get(t);if(!E)return 0;t.isLockLevelChanged()?(t.resetLockChangeFlag(),E.forEach((function(t){t.forEach((function(t){var i=e._modelsInLODGroup.get(t);i&&i.clear()}))})),p=!0):p&&e._lodStateInCamera.forEach((function(i){var n=i.get(t);if(n&&n.usedLevel!==n.lastUsedLevel){var r=E.get(n.lastUsedLevel);r&&r.forEach((function(t){var i=e._modelsInLODGroup.get(t);i&&i.clear()}))}})),p&&e._lodStateInCamera.forEach((function(i,n){var r=i.get(t);if(r){var s=r.usedLevel,a=E.get(s);a&&a.forEach((function(t){var i=e._modelsInLODGroup.get(t);i&&t.node&&t.node.active&&i.set(n,!0)}))}}))}},f=d(this._renderScene.lodGroups);!(c=f()).done;)_()},e.isLodModelCulled=function(t,e){var i=this._modelsInLODGroup.get(e);return!!i&&!i.has(t)},e.clearCache=function(){this._levelModels.clear(),this._modelsInLODGroup.clear(),this._lodStateInCamera.clear(),this._newAddedLodGroupVec.length=0},e.isLodGroupVisibleByCamera=function(t,e){var i=t.node.layer;return(e.visibility&i)===i},t}(),QB=((AB={})[Al.PORTRAIT]=Wl.IDENTITY,AB[Al.LANDSCAPE_RIGHT]=Wl.ROTATE_90,AB[Al.PORTRAIT_UPSIDE_DOWN]=Wl.ROTATE_180,AB[Al.LANDSCAPE_LEFT]=Wl.ROTATE_270,AB),ZB=function(){function t(){this._title="",this._width=1,this._height=1,this._swapchain=null,this._renderPass=null,this._colorTextures=[],this._depthStencilTexture=null,this._cameras=[],this._hasOnScreenAttachments=!1,this._hasOffScreenAttachments=!1,this._framebuffer=null,this._device=null}t.registerCreateFunc=function(e){e._createWindowFun=function(){return new t}};var e=t.prototype;return e.initialize=function(t,e){if(void 0!==e.title&&(this._title=e.title),void 0!==e.swapchain&&(this._swapchain=e.swapchain),this._width=e.width,this._height=e.height,this._device=t,this._renderPass=t.createRenderPass(e.renderPassInfo),e.swapchain)this._swapchain=e.swapchain,this._colorTextures.push(e.swapchain.colorTexture),this._depthStencilTexture=e.swapchain.depthStencilTexture;else{for(var i=0;i1&&(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=0;g--){var v=i[g];(a===RB.LEFT&&v.cameraType===Pw.RIGHT_EYE||a===RB.RIGHT&&v.cameraType===Pw.LEFT_EYE)&&i.splice(g,1)}this._frameMoveEnd()}}},e._frameMoveBegin=function(){for(var t=0;t0){this._device.acquire([wd.swapchain]);var r=this._scenes,s=t.getTotalFrames();this._batcher&&(this._batcher.update(),this._batcher.uploadBuffers());for(var a=0;a0){t.emit(e.EVENT_BEFORE_COMMIT),i.sort((function(t,e){return t.priority-e.priority}));for(var n=0;n0?(this._fixedFPS=t,this._fixedFPSFrameTime=1e3/t):this._fixedFPSFrameTime=0}},{key:"dataPoolManager",get:function(){return this._dataPoolMgr}},{key:"useDeferredPipeline",get:function(){return this._useDeferredPipeline}},{key:"cameraList",get:function(){return this._cameraList}}]),t}());v.Root=JB,gi.Attr.setClassAttr(rp,"target","type","Object"),gi.Attr.setClassAttr(rp,"target","ctor",$m);var $B,tN=new Array(16),eN=null,iN=new Fn,nN=[um.TOUCH_START,um.TOUCH_MOVE,um.TOUCH_END,um.TOUCH_CANCEL],rN=[um.MOUSE_DOWN,um.MOUSE_ENTER,um.MOUSE_MOVE,um.MOUSE_LEAVE,um.MOUSE_UP,um.MOUSE_WHEEL];!function(t){t[t.ADD_POINTER_EVENT_PROCESSOR=0]="ADD_POINTER_EVENT_PROCESSOR",t[t.REMOVE_POINTER_EVENT_PROCESSOR=1]="REMOVE_POINTER_EVENT_PROCESSOR",t[t.MARK_LIST_DIRTY=2]="MARK_LIST_DIRTY"}($B||($B={}));var sN,aN=function(){function t(t){this.claimedTouchIdList=[],this.maskList=null,this.cachedCameraPriority=0,this.previousMouseIn=!1,this.bubblingTarget=null,this.capturingTarget=null,this.shouldHandleEventMouse=!1,this.shouldHandleEventTouch=!1,this._dispatchingTouch=null,this._isEnabled=!1,this._node=void 0,this._node=t}var e=t.prototype;return e.setEnabled=function(e,i){if(void 0===i&&(i=!1),this._isEnabled!==e){this._isEnabled=e;var n=this.node.children;if(e&&this._attachMask(),t.callbacksInvoker.emit($B.MARK_LIST_DIRTY),i&&n.length>0)for(var r=0;r=0;--n)if((e=tN[n]).eventProcessor.capturingTarget&&(t.currentTarget=e,e.eventProcessor.capturingTarget.emit(t.type,t,tN),t.propagationStopped))return void(tN.length=0);if(tN.length=0,t.eventPhase=2,t.currentTarget=i,this.capturingTarget&&this.capturingTarget.emit(t.type,t),!t.propagationImmediateStopped&&this.bubblingTarget&&this.bubblingTarget.emit(t.type,t),!t.propagationStopped&&t.bubbles)for(this.getBubblingTargets(t.type,tN),t.eventPhase=3,n=0;n0?n:null}return null},e._attachMask=function(){this.maskList=this._searchComponentsInParent(t._maskComp)},e._isTouchEvent=function(t){return-1!==nN.indexOf(t)},e._isMouseEvent=function(t){return-1!==rN.indexOf(t)},e._hasTouchListeners=function(){for(var t=0;t>>1;r<=s;a=r+s>>>1){var o=t[a],h=o.constructor._executionOrder;if(h>i)s=a-1;else if(hn)s=a-1;else{if(!(u0&&(t.array.sort(gN),this._invoke(t),t.array.length=0),this._invoke(this._zero),this._zero.array.length=0;var e=this._pos;e.array.length>0&&(e.array.sort(gN),this._invoke(e),e.array.length=0)},e}(mN),yN=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.add=function(t){var e=t.constructor._executionOrder;if(0===e)this._zero.array.push(t);else{var i=e<0?this._neg.array:this._pos.array,n=fN(i,t);n<0&&i.splice(~n,0,t)}},i.remove=function(t){var e=t.constructor._executionOrder;if(0===e)this._zero.fastRemove(t);else{var i=e<0?this._neg:this._pos,n=fN(i.array,t);n>=0&&i.removeAt(n)}},i.invoke=function(t){this._neg.array.length>0&&this._invoke(this._neg,t),this._invoke(this._zero,t),this._pos.array.length>0&&this._invoke(this._pos,t)},e}(mN);function TN(t,e,i){var n="var a=it.array;for(it.i=0;it.i=0?cN(this._deferredComps,e):(!t.internalStart||t._objFlags&_N||this.startInvoker.remove(t),t.internalUpdate&&this.updateInvoker.remove(t),t.internalLateUpdate&&this.lateUpdateInvoker.remove(t))},e.enableComp=function(t,e){if(!(t._objFlags&dN)){if(t.internalOnEnable){if(e)return void e.add(t);if(t.internalOnEnable(),!t.node.activeInHierarchy)return}this._onEnabled(t)}},e.disableComp=function(t){t._objFlags&dN&&(t.internalOnDisable&&t.internalOnDisable(),this._onDisabled(t))},e.startPhase=function(){this._updating=!0,this.startInvoker.invoke(),this._startForNewComps()},e.updatePhase=function(t){this.updateInvoker.invoke(t)},e.lateUpdatePhase=function(t){this.lateUpdateInvoker.invoke(t),this._updating=!1,this._startForNewComps()},e._startForNewComps=function(){this._deferredComps.length>0&&(this._deferredSchedule(),this.startInvoker.invoke())},e._scheduleImmediate=function(t){"function"!=typeof t.internalStart||t._objFlags&_N||this.startInvoker.add(t),"function"==typeof t.internalUpdate&&this.updateInvoker.add(t),"function"==typeof t.internalLateUpdate&&this.lateUpdateInvoker.add(t)},e._deferredSchedule=function(){for(var t=this._deferredComps,e=0,i=t.length;e1)t.push("t="+this._targetExp+";"),e="t";else{if(1!==this._exps.length)return;e=this._targetExp}for(var i=0;i0&&(i=HN+this.globalVariables.join(",")+";");var n=Gl(["return (function(R){",i||[],this.codeArray,"return o;","})"]);this.result=Function("O","F",n)(this.objs,this.funcs);for(var r=0,s=this.objsToClear_iN$t.length;r=e.OptimizationPolicyThreshold)?(t=this._doInstantiate(),this.data._instantiate(t)):t=this.data._instantiate(),++this._instantiatedTimes,t},i.initDefault=function(e){t.prototype.initDefault.call(this,e),this.data=new $m,this.data.name="(Missing Node)";var i=new v._PrefabInfo;i.asset=this,i.root=this.data,this.data._prefab=i},i.validate=function(){return!!this.data},i.onLoaded=function(){var t=this.data;fC(t),_C(t)},e}(uf)).OptimizationPolicy=rL,eL.OptimizationPolicyThreshold=3,JN=Gs((ZN=eL).prototype,"data",[ra],(function(){return null})),$N=Gs(ZN.prototype,"optimizationPolicy",[ra],(function(){return rL.AUTO})),tL=Gs(ZN.prototype,"persistent",[ra],(function(){return!1})),QN=ZN))||QN);Ct(sL,"_utils",EC),v.Prefab=sL,Mt(v,"cc._Prefab","Prefab");var aL=new(function(){function t(){this._allRenderers=[],this._dirtyRenderers=[],this._dirtyVersion=0}var e=t.prototype;return e.addRenderer=function(t){-1===t._internalId&&(t._internalId=this._allRenderers.length,this._allRenderers.push(t))},e.removeRenderer=function(t){if(-1!==t._internalId){var e=t._internalId;this._allRenderers[this._allRenderers.length-1]._internalId=e,he(this._allRenderers,e),t._internalId=-1,t._dirtyVersion===this._dirtyVersion&&(le(this._dirtyRenderers,t),t._dirtyVersion=-1)}},e.markDirtyRenderer=function(t){t._dirtyVersion!==this._dirtyVersion&&-1!==t._internalId&&(this._dirtyRenderers.push(t),t._dirtyVersion=this._dirtyVersion)},e.updateAllDirtyRenderers=function(){for(var t=this._dirtyRenderers.length,e=this._dirtyRenderers,i=0;i1){var u=Object.create(null);e.forEach((function(t){u[t._uuid]=t})),r={isCompleted:uL,_map:u}}else r=e[0]}i&&i(t,r)}))},e.getXMLHttpRequest=function(){return new XMLHttpRequest},e.getItem=function(t){return eS.assets.has(t)?{content:eS.assets.get(t)}:null},e.loadRes=function(t,e,i,n){var r=this._parseLoadResArgs(e,i,n),s=r.type,a=r.onProgress,o=r.onComplete,h=cl(t);h&&!nT.getInfoWithPath(t,s)&&(t=t.slice(0,-h.length)),nT.load(t,s,a,o)},e.loadResArray=function(t,e,i,n){var r=this._parseLoadResArgs(e,i,n),s=r.type,a=r.onProgress,o=r.onComplete;t.forEach((function(e,i){var n=cl(e);n&&!nT.getInfoWithPath(e,s)&&(t[i]=e.slice(0,-n.length))})),nT.load(t,s,a,o)},e.loadResDir=function(t,e,i,n){var r=this._parseLoadResArgs(e,i,n),s=r.type,a=r.onProgress,o=r.onComplete;nT.loadDir(t,s,a,(function(e,i){var n=[];e||(n=nT.getDirWithPath(t,s).map((function(t){return t.path}))),o&&o(e,i,n)}))},e.getRes=function(t,e){return Bd.has(t)?Bd.get(t):nT.get(t,e)},e.getResCount=function(){return Bd.count},e.getDependsRecursively=function(t){if(!t)return[];var e="string"==typeof t?t:t._uuid;return jp.getDepsRecursively(e).concat([e])},e.addDownloadHandlers=function(t){var e=Object.create(null),i=function(){var i=t[n];e["."+n]=function(t,e,n){i({url:t},n)}};for(var n in t)i();CT.register(e)},e.addLoadHandlers=function(t){var e=Object.create(null),i=function(){var i=t[n];e["."+n]=function(t,e,n){i({content:t},n)}};for(var n in t)i();WT.register(e)},e.release=function(t){if(Array.isArray(t))for(var e=0;e2e3&&(t._startTime=performance.now(),t._frameCount=0)},this._frameTime=1e3/this._targetFrameRate,this._rAF=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame,this._cAF=window.cancelAnimationFrame||window.cancelRequestAnimationFrame||window.msCancelRequestAnimationFrame||window.mozCancelRequestAnimationFrame||window.oCancelRequestAnimationFrame||window.webkitCancelRequestAnimationFrame||window.msCancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.ocancelAnimationFrame}var e=t.prototype;return e.start=function(){var t,e=this;if(!this._isPlaying){var i=void 0===this._rAF||(null===(t=globalThis.__globalXR)||void 0===t?void 0:t.isWebXR);this._startTime=performance.now(),this._stHandle=this._stTime((function t(){i&&(e._startTime=performance.now()),e._isPlaying&&(e._stHandle=e._stTime(t)),e._onTick&&e._onTick()})),this._isPlaying=!0,this._frameCount=0}},e.stop=function(){this._isPlaying&&(this._ctTime(this._stHandle),this._stHandle=0,this._isPlaying=!1,this._frameCount=0)},e._stTime=function(t){var e;if(void 0===this._rAF||null!==(e=globalThis.__globalXR)&&void 0!==e&&e.isWebXR){var i=performance.now(),n=Math.max(0,i-this._startTime),r=Math.max(0,this._frameTime-n);return setTimeout(t,r)}return this._callback=t,this._rAF.call(window,this._handleRAF)},e._ctTime=function(t){var e;void 0===this._cAF||null!==(e=globalThis.__globalXR)&&void 0!==e&&e.isWebXR?clearTimeout(t):t&&this._cAF.call(window,t)},n(t,[{key:"targetFrameRate",get:function(){return this._targetFrameRate},set:function(t){this._targetFrameRate!==t&&(this._targetFrameRate=t,this._frameTime=1e3/this._targetFrameRate,this._isPlaying&&(this.stop(),this.start()))}},{key:"onTick",get:function(){return this._onTick},set:function(t){this._onTick=t}}]),t}();at(SD.prototype,"RenderPipeline.prototype",[{name:"geometryRenderer",suggest:"please use camera.geometryRenderer instead."}]);var yL=new Fn,TL=function(){var t=e.prototype;function e(){this.settings=void 0,this._curTime=0,this.device=void 0,this.swapchain=void 0,this.shader=void 0,this.sampler=void 0,this.cmdBuff=void 0,this.quadAssmebler=void 0,this.vertexBuffers=void 0,this.indicesBuffers=void 0,this.renderArea=void 0,this.clearColors=void 0,this.projection=void 0,this.isMobile=!1,this.bgMat=void 0,this.bgImage=void 0,this.bgTexture=void 0,this.logoMat=void 0,this.logoImage=void 0,this.logoTexture=void 0,this.watermarkMat=void 0,this.watermarkTexture=void 0,this.bgWidth=1920,this.bgHeight=1080,this.bgRatio=16/9,this.logoWidthTemp=140,this.logoHeightTemp=200,this.logoWidth=0,this.logoHeight=0,this.logoXTrans=.5,this.logoYTrans=1/6+2.5/6,this.textSize=24,this.textHeight=24,this.textXTrans=.5,this.textYExtraTrans=32,this.textExpandSize=4,this.scaleSize=1}return t.init=function(){var t,e,i,n,r,s,a=this;if(this.settings={displayRatio:null!==(t=be.querySettings(Re.Category.SPLASH_SCREEN,"displayRatio"))&&void 0!==t?t:.4,totalTime:null!==(e=be.querySettings(Re.Category.SPLASH_SCREEN,"totalTime"))&&void 0!==e?e:3e3,watermarkLocation:null!==(i=be.querySettings(Re.Category.SPLASH_SCREEN,"watermarkLocation"))&&void 0!==i?i:"default",autoFit:null===(n=be.querySettings(Re.Category.SPLASH_SCREEN,"autoFit"))||void 0===n||n,logo:null!==(r=be.querySettings(Re.Category.SPLASH_SCREEN,"logo"))&&void 0!==r?r:void 0,background:null!==(s=be.querySettings(Re.Category.SPLASH_SCREEN,"background"))&&void 0!==s?s:void 0},this._curTime=0,!(this.settings.totalTime<=0||void 0===this.settings.logo||void 0===this.settings.background)){this.device=v.director.root.device,this.swapchain=v.director.root.mainWindow.swapchain,this.preInit(),this.initLayout(),"default"===this.settings.logo.type&&this.initWaterMark();var o=Promise.resolve(),h=Promise.resolve();return"custom"===this.settings.background.type&&(o=new Promise((function(t,e){a.bgImage=new T.Image,a.bgImage.onload=function(){a.initBG(),t()},a.bgImage.onerror=function(){e()},a.bgImage.src=a.settings.background.base64}))),"none"!==this.settings.logo.type&&(h=new Promise((function(t,e){a.logoImage=new T.Image,a.logoImage.onload=function(){a.initLogo(),t()},a.logoImage.onerror=function(){e()},a.logoImage.src=a.settings.logo.base64}))),Promise.all([o,h])}return this.settings.totalTime=0,Promise.resolve([])},t.preInit=function(){var t,e=null===(t=this.settings.background)||void 0===t?void 0:t.color;this.clearColors=e?[new Xc(e.x,e.y,e.z,e.w)]:[new Xc(0,0,0,1)];var i=this.device,n=this.swapchain;this.renderArea=new Fc(0,0,n.width,n.height),this.cmdBuff=i.commandBuffer;var r=new Float32Array([.5,.5,1,0,-.5,.5,0,0,.5,-.5,1,1,-.5,-.5,0,1]),s=4*Float32Array.BYTES_PER_ELEMENT,a=4*s;this.vertexBuffers=i.createBuffer(new qc(ql.VERTEX|ql.TRANSFER_DST,Jl.DEVICE,a,s)),this.vertexBuffers.update(r);var o=new Uint16Array([0,1,2,1,3,2]),h=Uint16Array.BYTES_PER_ELEMENT,u=6*h;this.indicesBuffers=i.createBuffer(new qc(ql.INDEX|ql.TRANSFER_DST,Jl.DEVICE,u,h)),this.indicesBuffers.update(o);var l=[new __("a_position",jl.RG32F),new __("a_texCoord",jl.RG32F)],c=new f_(l,[this.vertexBuffers],this.indicesBuffers);this.quadAssmebler=i.createInputAssembler(c),this.projection=new Dn,Dn.ortho(this.projection,-1,1,-1,1,-1,1,i.capabilities.clipSpaceMinZ,i.capabilities.clipSpaceSignY,n.surfaceTransform),this.isMobile=Ol.isMobile},t.initLayout=function(){this.isMobile?(this.bgWidth=812,this.bgHeight=375,this.logoWidthTemp=70,this.logoHeightTemp=100,this.textSize=12,this.textHeight=this.textSize+this.textExpandSize,this.textXTrans=.5,this.textYExtraTrans=16):(this.bgWidth=1920,this.bgHeight=1080,this.logoWidthTemp=140,this.logoHeightTemp=200,this.textSize=24,this.textHeight=this.textSize+this.textExpandSize,this.textXTrans=.5,this.textYExtraTrans=32),this.logoXTrans=.5,this.logoYTrans=1/6+2.5/6,this.initScale()},t.initScale=function(){var t=this.swapchain.width,e=this.swapchain.height,i=this.isMobile?375:1080,n=this.isMobile?812:1920;if(t>e){var r=n;n=i,i=r}this.scaleSize=t/e>16/9?e/n:t/i},t.update=function(t){var e=this.settings,i=this.device,n=this.swapchain;Dn.ortho(this.projection,-1,1,-1,1,-1,1,i.capabilities.clipSpaceMinZ,i.capabilities.clipSpaceSignY,n.surfaceTransform);var r=n.width,s=n.height;this.initScale(),this._curTime+=1e3*t;var a=so(Oi(this._curTime/e.totalTime)),o=1,h=1;"custom"===this.settings.background.type&&(r=this.settings.totalTime}},{key:"curTime",get:function(){return this._curTime},set:function(t){this._curTime=t}}],[{key:"instance",get:function(){return e._ins||(e._ins=new e),e._ins}}]),e}();TL._ins=void 0,v.internal.SplashScreen=TL;var SL=new(function(){function t(){this._data=null}return t.prototype.init=function(t){var e=this;return void 0===t&&(t=""),v.rendering&&v.rendering.enableEffectImport&&t?new Promise((function(i,n){var r=new XMLHttpRequest;r.open("GET",t),r.responseType="arraybuffer",r.onload=function(){e._data=r.response,i()},r.onerror=function(){n(new Error("request effect settings failed!"))},r.send(null)})):Promise.resolve()},n(t,[{key:"data",get:function(){return this._data}}]),t}());v.effectSettings=SL;var EL=t("e2",function(t){function i(){for(var e,i=arguments.length,n=new Array(i),r=0;rthis._startTime?(e-this._startTime)/1e3:0,this._deltaTime>i.DEBUG_DT_THRESHOLD&&(this._deltaTime=this.frameTime/1e3),this._startTime=e,this._deltaTime},r._updateCallback=function(){var t=this;if(this._inited)if(TL.instance.isFinished)if(this._shouldLoadLaunchScene){this._shouldLoadLaunchScene=!1;var e,i=be.querySettings(Re.Category.LAUNCH,"launchScene");i?gL.loadScene(i,(function(){var e;Y(1103,i),t._initTime=performance.now(),gL.startAnimation(),null===(e=t.onStart)||void 0===e||e.call(t)})):(this._initTime=performance.now(),gL.startAnimation(),null===(e=this.onStart)||void 0===e||e.call(this))}else gL.tick(this._calculateDT(!1));else TL.instance.update(this._calculateDT(!1))},r.initPacer=function(){var t,e=null!==(t=be.querySettings(Re.Category.SCREEN,"frameRate"))&&void 0!==t?t:60;H("number"==typeof e),this._pacer=new vL,this._pacer.onTick=this._updateCallback.bind(this),this.frameRate=e},r._initEvents=function(){al.on("show",this._onShow,this),al.on("hide",this._onHide,this),al.on("close",this._onClose,this)},r._onHide=function(){this.emit(i.EVENT_HIDE),this.pauseByEngine()},r._onShow=function(){this.emit(i.EVENT_SHOW),this.resumeByEngine()},r._onClose=function(){this.emit(i.EVENT_CLOSE),al.exit()},r.addPersistRootNode=function(t){gL.addPersistRootNode(t)},r.removePersistRootNode=function(t){gL.removePersistRootNode(t)},r.isPersistRootNode=function(t){return gL.isPersistRootNode(t)},r._setupRenderPipeline=function(){var t=this,e=be.querySettings(Re.Category.RENDERING,"renderPipeline");return e?new Promise((function(t,i){eS.loadAny(e,(function(e,n){return!e&&n instanceof SD?t(n):i(e)}))})).then((function(e){t._setRenderPipeline(e)})).catch((function(i){U(i),U("Failed load render pipeline: "+e+", engine failed to initialize, will fallback to default pipeline"),t._setRenderPipeline()})):this._setRenderPipeline()},r._setRenderPipeline=function(t){gL.root.setRenderPipeline(t)||this._setRenderPipeline(),this._rendererInitialized=!0,this._safeEmit(i.EVENT_RENDERER_INITED)},r._safeEmit=function(t){this.emit(t)},n(i,[{key:"inited",get:function(){return this._inited}},{key:"frameRate",get:function(){return this._frameRate},set:function(t){"number"!=typeof t&&(t=parseInt(t,10),Number.isNaN(t)&&(t=60)),this._frameRate=t,this.frameTime=1e3/t,this._pacer&&(this._pacer.targetFrameRate=this._frameRate)}},{key:"deltaTime",get:function(){return this._useFixedDeltaTime?this.frameTime/1e3:this._deltaTime}},{key:"totalTime",get:function(){return performance.now()-this._initTime}},{key:"frameStartTime",get:function(){return this._startTime}}]),i}(Ju));EL.EVENT_HIDE="game_on_hide",EL.EVENT_SHOW="game_on_show",EL.EVENT_LOW_MEMORY="game_on_low_memory",EL.EVENT_GAME_INITED="game_inited",EL.EVENT_ENGINE_INITED="engine_inited",EL.EVENT_RENDERER_INITED="renderer_inited",EL.EVENT_PRE_BASE_INIT="pre_base_init",EL.EVENT_POST_BASE_INIT="post_base_init",EL.EVENT_PRE_INFRASTRUCTURE_INIT="pre_infrastructure_init",EL.EVENT_POST_INFRASTRUCTURE_INIT="post_infrastructure_init",EL.EVENT_PRE_SUBSYSTEM_INIT="pre_subsystem_init",EL.EVENT_POST_SUBSYSTEM_INIT="post_subsystem_init",EL.EVENT_PRE_PROJECT_INIT="pre_project_init",EL.EVENT_POST_PROJECT_INIT="post_project_init",EL.EVENT_RESTART="game_on_restart",EL.EVENT_PAUSE="game_on_pause",EL.EVENT_RESUME="game_on_resume",EL.EVENT_CLOSE="game_on_close",EL.RENDER_TYPE_CANVAS=0,EL.RENDER_TYPE_WEBGL=1,EL.RENDER_TYPE_OPENGL=2,EL.RENDER_TYPE_HEADLESS=3,EL.DEBUG_DT_THRESHOLD=1,v.Game=EL;var AL=t("e3",v.game=new EL);at(mL.prototype,"director",[{name:"calculateDeltaTime"},{name:"getDeltaTime",suggest:"Use game.deltaTime instead"},{name:"getTotalTime",suggest:"Use game.totalTime instead"},{name:"getCurrentTime",suggest:"Use game.frameStartTime instead"}]),st(mL.prototype,"director",[{name:"setAnimationInterval",suggest:"please use game.frameRate instead"},{name:"getAnimationInterval",suggest:"please use game.frameRate instead"},{name:"getRunningScene",suggest:"please use getScene instead"},{name:"setDepthTest",suggest:"please use camera API instead"},{name:"setClearColor",suggest:"please use camera API instead"},{name:"getWinSize",suggest:"please use view.getVisibleSize instead"},{name:"getWinSizeInPixels"},{name:"purgeCachedData",suggest:"please use assetManager.releaseAll instead"},{name:"convertToGL"},{name:"convertToUI"}]),rt(gL,"director",[{name:"_getSceneUuid",targetName:"assetManager.main",newName:"getSceneInfo",customFunction:function(t){var e;return eS.main?null===(e=eS.main.getSceneInfo(t))||void 0===e?void 0:e.uuid:""}}]),at(AL,"game",[{name:"collisionMatrix"},{name:"groupList"}]),rt(AL,"game",[{name:"_sceneInfos",targetName:"assetManager.main",newName:"getSceneInfo",customGetter:function(){var t=[];return eS.main&&eS.main.config.scenes.forEach((function(e){t.push(e)})),t}}]);var RL=t("$",function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r=0;e--)le(this._atlases[e]._innerSpriteFrames,t);var i=t._original._texture;this.deleteAtlasTexture(i)}},i.deleteAtlasTexture=function(t){if(t)for(var e=this._atlases.length-1;e>=0;e--)this._atlases[e].deleteInnerTexture(t),this._atlases[e].isEmpty()&&(this._atlases[e].destroy(),this._atlases.splice(e,1),this._atlasIndex--)},i.packToDynamicAtlas=function(t,e){if(this._enabled&&e&&!e._original&&e.packable&&e.texture&&e.texture.width>0&&e.texture.height>0){var i=this.insertSpriteFrame(e);i&&e._setDynamicAtlasFrame(i)}},n(e,[{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled!==t&&(t?(this.reset(),v.director.on(v.Director.EVENT_BEFORE_SCENE_LAUNCH,this.beforeSceneLoad,this)):(this.reset(),v.director.off(v.Director.EVENT_BEFORE_SCENE_LAUNCH,this.beforeSceneLoad,this)),this._enabled=t)}},{key:"maxAtlasCount",get:function(){return this._maxAtlasCount},set:function(t){this._maxAtlasCount=t}},{key:"atlasCount",get:function(){return this._atlases.length}},{key:"textureBleeding",get:function(){return this._textureBleeding},set:function(t){this._textureBleeding=t}},{key:"textureSize",get:function(){return this._textureSize},set:function(t){this._textureSize=t}},{key:"maxFrameSize",get:function(){return this._maxFrameSize},set:function(t){this._maxFrameSize=t}}]),e}(Lu));RL.instance=void 0;var bL,CL=t("a0",RL.instance=new RL);gL.registerSystem("dynamicAtlasManager",CL,0),v.internal.dynamicAtlasManager=CL,function(t){t[t.positions=Mc.ATTR_POSITION]="positions",t[t.normals=Mc.ATTR_NORMAL]="normals",t[t.uvs=Mc.ATTR_TEX_COORD]="uvs",t[t.colors=Mc.ATTR_COLOR]="colors"}(bL||(bL={}));var wL=function(){function t(){this._arrayBufferOrPaddings=[],this._length=0}var e=t.prototype;return e.setNextAlignment=function(t){if(0!==t){var e=this._length%t;if(0!==e){var i=t-e;this._arrayBufferOrPaddings.push(i),this._length+=i}}},e.addBuffer=function(t){var e=this._length;return this._arrayBufferOrPaddings.push(t),this._length+=t.byteLength,e},e.getLength=function(){return this._length},e.getCombined=function(){var t=new Uint8Array(this._length),e=0;return this._arrayBufferOrPaddings.forEach((function(i){"number"==typeof i?e+=i:(t.set(new Uint8Array(i),e),e+=i.byteLength)})),t.buffer},t}(),xL=function(){function t(t,e){if(this._mesh=void 0,this._subMeshRenderings=[],this._mesh=t,this._mesh.struct.morph){var i=this._mesh.struct.primitives.length;this._subMeshRenderings=new Array(i).fill(null);for(var n=0;nov.MAX_MORPH_TARGET_COUNT?this._subMeshRenderings[n]=new OL(this._mesh,n,this._mesh.struct.morph,e):this._subMeshRenderings[n]=new IL(this._mesh,n,this._mesh.struct.morph,e))}}}return t.prototype.createInstance=function(){for(var t=this,e=this._mesh.struct.primitives.length,i=new Array(e),n=0;n>1;return{width:1<<(1&e?i+1:i),height:1<>>0;t=n}for(var r,s=1,a=0,o=t.length,h=0;0>>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>>8&255]<<16|d[t>>>16&255]<<8|d[t>>>24&255])>>32-e:d[t]>>8-e),8>e+a)o=o<>e-n-1&1,8==++a&&(a=0,r[s++]=d[o],o=0,s===r.length&&(r=this.f()));r[s]=o,this.buffer=r,this.i=a,this.index=s},o.prototype.finish=function(){var t,e=this.buffer,i=this.index;return 0h;++h){for(var l=_=h,c=7,_=_>>>1;_;_>>>=1)l<<=1,l|=1&_,--c;u[h]=(l<>>0}var d=u;function f(t){this.buffer=new(s?Uint16Array:Array)(2*t),this.length=0}function p(t){var e,i,n,r,a,o,h,u,l,c=t.length,_=0,d=Number.POSITIVE_INFINITY;for(u=0;u_&&(_=t[u]),t[u]>=1;for(l=o;ls[n]);)r=s[i],s[i]=s[n],s[n]=r,r=s[i+1],s[i+1]=s[n+1],s[n+1]=r,i=n;return this.length},f.prototype.pop=function(){var t,e,i,n,r,s=this.buffer;for(e=s[0],t=s[1],this.length-=2,s[0]=s[this.length],s[1]=s[this.length+1],r=0;!((n=2*r+2)>=this.length)&&(n+2s[n]&&(n+=2),s[n]>s[r]);)i=s[r],s[r]=s[n],s[n]=i,i=s[r+1],s[r+1]=s[n+1],s[n+1]=i,r=n;return{index:t,value:e,length:this.length}};var g,v=2,y={NONE:0,r:1,j:v,N:3},T=[];for(g=0;288>g;g++)switch(i){case 143>=g:T.push([g+48,8]);break;case 255>=g:T.push([g-144+400,9]);break;case 279>=g:T.push([g-256+0,7]);break;case 287>=g:T.push([g-280+192,8]);break;default:t("invalid literal: "+g)}function S(t,e){this.length=t,this.G=e}function E(){var e=A;switch(i){case 3===e:return[257,e-3,0];case 4===e:return[258,e-4,0];case 5===e:return[259,e-5,0];case 6===e:return[260,e-6,0];case 7===e:return[261,e-7,0];case 8===e:return[262,e-8,0];case 9===e:return[263,e-9,0];case 10===e:return[264,e-10,0];case 12>=e:return[265,e-11,1];case 14>=e:return[266,e-13,1];case 16>=e:return[267,e-15,1];case 18>=e:return[268,e-17,1];case 22>=e:return[269,e-19,2];case 26>=e:return[270,e-23,2];case 30>=e:return[271,e-27,2];case 34>=e:return[272,e-31,2];case 42>=e:return[273,e-35,3];case 50>=e:return[274,e-43,3];case 58>=e:return[275,e-51,3];case 66>=e:return[276,e-59,3];case 82>=e:return[277,e-67,4];case 98>=e:return[278,e-83,4];case 114>=e:return[279,e-99,4];case 130>=e:return[280,e-115,4];case 162>=e:return[281,e-131,5];case 194>=e:return[282,e-163,5];case 226>=e:return[283,e-195,5];case 257>=e:return[284,e-227,5];case 258===e:return[285,e-258,0];default:t("invalid length: "+e)}}m.prototype.n=function(){var n,r,a,h,u=this.input;switch(this.h){case 0:for(a=0,h=u.length;a>>8&255,g[y++]=255&_,g[y++]=_>>>8&255,s)g.set(d,y),y+=d.length,g=g.subarray(0,y);else{for(p=0,m=d.length;pq)for(;0q?q:138)>q-3&&J=J?(it[Z++]=17,it[Z++]=J-3,nt[17]++):(it[Z++]=18,it[Z++]=J-11,nt[18]++),q-=J;else if(it[Z++]=et[Y],nt[et[Y]]++,3>--q)for(;0q?q:6)>q-3&&Jz;z++)j[z]=k[X[z]];for(P=19;4=A;A++)R=E(),b[A]=R[2]<<24|R[1]<<16|R[0];var C=s?new Uint32Array(b):b;function w(n,r){function a(e,n){var r,s,a,o,h=e.G,u=[],l=0;switch(r=C[e.length],u[l++]=65535&r,u[l++]=r>>16&255,u[l++]=r>>24,i){case 1===h:s=[0,h-1,0];break;case 2===h:s=[1,h-2,0];break;case 3===h:s=[2,h-3,0];break;case 4===h:s=[3,h-4,0];break;case 6>=h:s=[4,h-5,1];break;case 8>=h:s=[5,h-7,1];break;case 12>=h:s=[6,h-9,2];break;case 16>=h:s=[7,h-13,2];break;case 24>=h:s=[8,h-17,3];break;case 32>=h:s=[9,h-25,3];break;case 48>=h:s=[10,h-33,4];break;case 64>=h:s=[11,h-49,4];break;case 96>=h:s=[12,h-65,5];break;case 128>=h:s=[13,h-97,5];break;case 192>=h:s=[14,h-129,6];break;case 256>=h:s=[15,h-193,6];break;case 384>=h:s=[16,h-257,7];break;case 512>=h:s=[17,h-385,7];break;case 768>=h:s=[18,h-513,8];break;case 1024>=h:s=[19,h-769,8];break;case 1536>=h:s=[20,h-1025,9];break;case 2048>=h:s=[21,h-1537,9];break;case 3072>=h:s=[22,h-2049,10];break;case 4096>=h:s=[23,h-3073,10];break;case 6144>=h:s=[24,h-4097,11];break;case 8192>=h:s=[25,h-6145,11];break;case 12288>=h:s=[26,h-8193,12];break;case 16384>=h:s=[27,h-12289,12];break;case 24576>=h:s=[28,h-16385,13];break;case 32768>=h:s=[29,h-24577,13];break;default:t("invalid distance")}for(r=s,u[l++]=r[0],u[l++]=r[1],u[l++]=r[2],a=0,o=u.length;a=u;)T[u++]=0;for(u=0;29>=u;)E[u++]=0}for(T[256]=1,o=0,h=r.length;o=h){for(f&&a(f,-1),u=0,l=h-o;ux&&o+xw&&(b=R,w=x),258===x)break}d=new S(w,o-b),f?f.length2*y[d-1]+T[d]&&(y[d]=2*y[d-1]+T[d]),E[d]=Array(y[d]),A[d]=Array(y[d]);for(_=0;_r[_]?(E[d][p]=m,A[d][p]=v,g+=2):(E[d][p]=r[_],A[d][p]=_,++_);R[d]=0,1===T[d]&&i(d)}for(a=S,o=0,h=n.length;o1<l&&t("undercommitted"),i=0,n=e.length;i>>=1;return o}function O(t,e){this.input=t,this.a=new(s?Uint8Array:Array)(32768),this.h=D.j;var i,n={};for(i in!e&&(e={})||"number"!=typeof e.compressionType||(this.h=e.compressionType),e)n[i]=e[i];n.outputBuffer=this.a,this.z=new m(this.input,n)}var D=y;function M(e,i){switch(this.k=[],this.l=32768,this.e=this.g=this.c=this.q=0,this.input=s?new Uint8Array(e):e,this.s=!1,this.m=B,this.B=!1,!i&&(i={})||(i.index&&(this.c=i.index),i.bufferSize&&(this.l=i.bufferSize),i.bufferType&&(this.m=i.bufferType),i.resize&&(this.B=i.resize)),this.m){case P:this.b=32768,this.a=new(s?Uint8Array:Array)(32768+this.l+258);break;case B:this.b=0,this.a=new(s?Uint8Array:Array)(this.l),this.f=this.J,this.t=this.H,this.o=this.I;break;default:t(Error("invalid inflate mode"))}}O.prototype.n=function(){var e,i,n,r,o,h,u,l=0;switch(u=this.a,e=lt){case lt:i=Math.LOG2E*Math.log(32768)-8;break;default:t(Error("invalid compression method"))}switch(n=i<<4|e,u[l++]=n,e){case lt:switch(this.h){case D.NONE:o=0;break;case D.r:o=1;break;case D.j:o=2;break;default:t(Error("unsupported compression type"))}break;default:t(Error("invalid compression method"))}return r=o<<6|0,u[l++]=r|31-(256*n+r)%31,h=a(this.input),this.z.b=l,l=(u=this.z.n()).length,s&&((u=new Uint8Array(u.buffer)).length<=l+4&&(this.a=new Uint8Array(u.length+4),this.a.set(u),u=this.a),u=u.subarray(0,l+4)),u[l++]=h>>24&255,u[l++]=h>>16&255,u[l++]=h>>8&255,u[l++]=255&h,u},r("Zlib.Deflate",O),r("Zlib.Deflate.compress",(function(t,e){return new O(t,e).n()})),r("Zlib.Deflate.CompressionType",D),r("Zlib.Deflate.CompressionType.NONE",D.NONE),r("Zlib.Deflate.CompressionType.FIXED",D.r),r("Zlib.Deflate.CompressionType.DYNAMIC",D.j);var P=0,B=1,N={D:P,C:B};M.prototype.p=function(){for(;!this.s;){var n=tt(this,3);switch(1&n&&(this.s=i),n>>>=1){case 0:var r=this.input,a=this.c,o=this.a,h=this.b,u=e,l=e,c=e,_=o.length,d=e;switch(this.e=this.g=0,(u=r[a++])===e&&t(Error("invalid uncompressed block header: LEN (first byte)")),l=u,(u=r[a++])===e&&t(Error("invalid uncompressed block header: LEN (second byte)")),l|=u<<8,(u=r[a++])===e&&t(Error("invalid uncompressed block header: NLEN (first byte)")),c=u,(u=r[a++])===e&&t(Error("invalid uncompressed block header: NLEN (second byte)")),l===~(c|=u<<8)&&t(Error("invalid uncompressed block header: length verify")),a+l>r.length&&t(Error("input buffer is broken")),this.m){case P:for(;h+l>o.length;){if(l-=d=_-h,s)o.set(r.subarray(a,a+d),h),h+=d,a+=d;else for(;d--;)o[h++]=r[a++];this.b=h,o=this.f(),h=this.b}break;case B:for(;h+l>o.length;)o=this.f({v:2});break;default:t(Error("invalid inflate mode"))}if(s)o.set(r.subarray(a,a+l),h),h+=l,a+=l;else for(;l--;)o[h++]=r[a++];this.c=a,this.b=h,this.a=o;break;case 1:this.o(Z,$);break;case 2:it(this);break;default:t(Error("unknown BTYPE: "+n))}}return this.t()};var L,F,k=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],U=s?new Uint16Array(k):k,G=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,258,258],H=s?new Uint16Array(G):G,z=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0],V=s?new Uint8Array(z):z,W=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],X=s?new Uint16Array(W):W,j=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],Y=s?new Uint8Array(j):j,K=new(s?Uint8Array:Array)(288);for(L=0,F=K.length;L=L?8:255>=L?9:279>=L?7:8;var q,Q,Z=p(K),J=new(s?Uint8Array:Array)(30);for(q=0,Q=J.length;q>>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<>>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;ar)n>=h&&(this.b=n,i=this.f(),n=this.b),i[n++]=r;else for(o=H[s=r-257],0=h&&(this.b=n,i=this.f(),n=this.b);o--;)i[n]=i[n++-a];for(;8<=this.e;)this.e-=8,this.c--;this.b=n},M.prototype.I=function(t,e){var i=this.a,n=this.b;this.u=t;for(var r,s,a,o,h=i.length;256!==(r=et(this,t));)if(256>r)n>=h&&(h=(i=this.f()).length),i[n++]=r;else for(o=H[s=r-257],0h&&(h=(i=this.f()).length);o--;)i[n]=i[n++-a];for(;8<=this.e;)this.e-=8,this.c--;this.b=n},M.prototype.f=function(){var t,e,i=new(s?Uint8Array:Array)(this.b-32768),n=this.b-32768,r=this.a;if(s)i.set(r.subarray(32768,i.length));else for(t=0,e=i.length;tt;++t)r[t]=r[n+t];return this.b=32768,r},M.prototype.J=function(t){var e,i,n,r=this.input.length/this.c+1|0,a=this.input,o=this.a;return t&&("number"==typeof t.v&&(r=t.v),"number"==typeof t.F&&(r+=t.F)),i=2>r?(n=(a.length-this.c)/this.u[2]/2*258|0)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=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=65536){q(10001,N,65536);continue}P>>=1,B>>=1}O=R.createBuffer(new qc(ql.INDEX,Jl.DEVICE,B,P)),C.push(O),D=new(jL(M.stride))(A,M.offset,M.count),M.stride!==P&&(D=jL(P).from(D)),O.update(D)}var L=I.vertexBundelIndices.map((function(t){return b[t]})),F=[];if(I.vertexBundelIndices.length>0)for(var k=I.vertexBundelIndices[0],U=this._struct.vertexBundles[k].attributes,G=0;G=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;n0&&(m.set(g),v.update(g,p)),c.view.count=f,h.vertexCount=f}if(a.indexView){var y=a.indexView,T=y.stride,S=2===T?e.indices16.length:e.indices32.length,E=S*T,A=new Uint8Array(this._data.buffer,y.offset,E),R=2===T?new Uint8Array(e.indices16.buffer,e.indices16.byteOffset,E):new Uint8Array(e.indices32.buffer,e.indices32.byteOffset,E),b=o.indexBuffer;s.maxSubMeshIndices,E>0&&(A.set(R),b.update(R,E)),y.count=S,h.indexCount=S}if(e.minPos&&e.maxPos){var C=new hn(e.minPos.x,e.minPos.y,e.minPos.z),w=new hn(e.maxPos.x,e.maxPos.y,e.maxPos.z);r.bounds[t]||(r.bounds[t]=new Es),Es.fromPoints(r.bounds[t],C,w);for(var x,I=new hn,O=new hn,D=d(r.bounds);!(x=D()).done;){var M=x.value;M&&(M.getBoundary(I,O),hn.min(C,I,C),hn.max(w,O,w))}this._struct.minPosition=new hn(C.x,C.y,C.z),this._struct.maxPosition=new hn(w.x,w.y,w.z)}o.invalidateGeometricInfo()}else q(14200)},i.destroy=function(){return this.destroyRenderingMesh(),t.prototype.destroy.call(this)},i.destroyRenderingMesh=function(){if(this._renderingSubMeshes){for(var t=0;t=n.length)){hn.transformMat4(KL,YL,n[f]),i[f]=!0;var p=e[f];hn.min(p.center,p.center,KL),hn.max(p.halfExtents,p.halfExtents,KL)}}}}for(var m=0;m=this._struct.primitives.length)return null;var e=this._struct.primitives[t];if(!e.indexView)return null;var i=e.indexView.stride;return new(1===i?Uint8Array:2===i?Uint16Array:Uint32Array)(this._data.buffer,e.indexView.offset,e.indexView.count)},i.copyIndices=function(t,e){if(t>=this._struct.primitives.length)return!1;var i=this._struct.primitives[t];if(!i.indexView)return!1;for(var n=i.indexView.count,r=1===i.indexView.stride?jl.R8UI:2===i.indexView.stride?jl.R16UI:jl.R32UI,s=tF(new DataView(this._data.buffer),r),a=0;a=this._struct.primitives.length))for(var n,r=d(this._struct.primitives[t].vertexBundelIndices);!(n=r()).done;){var s=n.value,a=this._struct.vertexBundles[s],o=a.attributes.findIndex((function(t){return t.name===e}));if(!(o<0)){i(a,o);break}}},i._createVertexBuffers=function(t,e){return this._struct.vertexBundles.map((function(i){var n=t.createBuffer(new qc(ql.VERTEX,Jl.DEVICE,i.view.length,i.view.stride)),r=new Uint8Array(e,i.view.offset,i.view.length);return n.update(r),n}))},i.initDefault=function(e){t.prototype.initDefault.call(this,e),this.reset({struct:{vertexBundles:[],primitives:[]},data:qL})},i.releaseData=function(){this._data=qL},n(e,[{key:"_nativeAsset",get:function(){return this._data.buffer},set:function(t){this._data=new Uint8Array(t)}},{key:"subMeshCount",get:function(){var t=this.renderingSubMeshes;return t?t.length:0}},{key:"minPosition",get:function(){return this.struct.minPosition}},{key:"maxPosition",get:function(){return this.struct.maxPosition}},{key:"struct",get:function(){return this._struct}},{key:"data",get:function(){return this._data}},{key:"hash",get:function(){return this._hash||(this._hash=Bl(this._data,666)),this._hash}},{key:"jointBufferIndices",get:function(){return this._jointBufferIndices?this._jointBufferIndices:this._jointBufferIndices=this._struct.primitives.map((function(t){return t.jointMapIndex||0}))}},{key:"renderingSubMeshes",get:function(){return this.initialize(),this._renderingSubMeshes}},{key:"allowDataAccess",get:function(){return this._allowDataAccess},set:function(t){this._allowDataAccess=t,this._isMeshDataUploaded&&!this._allowDataAccess&&this.releaseData()}}]),e}(uf),zL=Gs(HL.prototype,"_struct",[ra],(function(){return{vertexBundles:[],primitives:[]}})),VL=Gs(HL.prototype,"_hash",[ra],(function(){return 0})),WL=Gs(HL.prototype,"_allowDataAccess",[ra],(function(){return!0})),GL=HL))||GL);function ZL(t,e){for(var i=0,n=0;n0){if(n=null,t.attributes)for(var u,l=d(t.attributes);!(u=l()).done;){var c=u.value;if(c.name===Mc.ATTR_POSITION){n=c;break}}n||(n=rF[0]),r.push(n);var _=F_[n.format];o=Math.max(o,Math.floor(h.length/_.count)),a.push({offset:s,data:h,attribute:n}),s+=_.size}if(t.normals&&t.normals.length>0){if(n=null,t.attributes)for(var f,p=d(t.attributes);!(f=p()).done;){var m=f.value;if(m.name===Mc.ATTR_NORMAL){n=m;break}}n||(n=rF[1]);var g=F_[n.format];r.push(n),o=Math.max(o,Math.floor(t.normals.length/g.count)),a.push({offset:s,data:t.normals,attribute:n}),s+=g.size}if(t.uvs&&t.uvs.length>0){if(n=null,t.attributes)for(var v,y=d(t.attributes);!(v=y()).done;){var T=v.value;if(T.name===Mc.ATTR_TEX_COORD){n=T;break}}n||(n=rF[2]);var S=F_[n.format];r.push(n),o=Math.max(o,Math.floor(t.uvs.length/S.count)),a.push({offset:s,data:t.uvs,attribute:n}),s+=S.size}if(t.tangents&&t.tangents.length>0){if(n=null,t.attributes)for(var E,A=d(t.attributes);!(E=A()).done;){var R=E.value;if(R.name===Mc.ATTR_TANGENT){n=R;break}}n||(n=rF[3]);var b=F_[n.format];r.push(n),o=Math.max(o,Math.floor(t.tangents.length/b.count)),a.push({offset:s,data:t.tangents,attribute:n}),s+=b.size}if(t.colors&&t.colors.length>0){if(n=null,t.attributes)for(var C,w=d(t.attributes);!(C=w()).done;){var x=C.value;if(x.name===Mc.ATTR_COLOR){n=x;break}}n||(n=rF[4]);var I=F_[n.format];r.push(n),o=Math.max(o,Math.floor(t.colors.length/I.count)),a.push({offset:s,data:t.colors,attribute:n}),s+=I.size}if(t.customAttributes)for(var O=0;O0){var i=t%e;if(0!==i)return e-i}return 0}var hF,uF,lF=function(){function t(){}return t.createMesh=function(t,e,i){return aF(t,e,i)},t.createDynamicMesh=function(t,e,i,n){return function(t,e,i,n){n=n||{maxSubMeshes:1,maxSubMeshVertices:1024,maxSubMeshIndices:1024};var r=[],s=0;if(e.positions.length>0&&r.push(new __(Mc.ATTR_POSITION,jl.RGB32F,!1,s++,!1,0)),e.normals&&e.normals.length>0&&r.push(new __(Mc.ATTR_NORMAL,jl.RGB32F,!1,s++,!1,0)),e.uvs&&e.uvs.length>0&&r.push(new __(Mc.ATTR_TEX_COORD,jl.RG32F,!1,s++,!1,0)),e.tangents&&e.tangents.length>0&&r.push(new __(Mc.ATTR_TANGENT,jl.RGBA32F,!1,s++,!1,0)),e.colors&&e.colors.length>0&&r.push(new __(Mc.ATTR_COLOR,jl.RGBA32F,!1,s++,!1,0)),e.customAttributes)for(var a=0;a0?E=2:e.indices32&&e.indices32.length>0&&(E=4),E>0){c+=oF(c,E);var A=n.maxSubMeshIndices*E,R={offset:c,length:A,count:0,stride:E};p.indexView=R,c+=A}l.push(p)}var b={info:{maxSubMeshes:n.maxSubMeshes,maxSubMeshVertices:n.maxSubMeshVertices,maxSubMeshIndices:n.maxSubMeshIndices},bounds:[]};b.bounds.length=n.maxSubMeshes;var C={struct:{vertexBundles:u,primitives:l,dynamic:b},data:new Uint8Array(c)};return i||(i=new QL),i.reset(C),i.initialize(),i.updateSubMesh(t,e),i}(t,e,i,n)},t.decodeMesh=function(t){return iF(t)},t.inflateMesh=function(t){return nF(t)},t}(),cF=Object.freeze({__proto__:null,find:lN,toPPM:function(t,e,i){return"P3 "+e+" "+i+" 255\n"+t.filter((function(t,e){return e%4<3})).toString()+"\n"},readMesh:function(t,e){void 0===e&&(e=0);for(var i,n={positions:[]},r=new DataView(t.data.buffer,t.data.byteOffset,t.data.byteLength),s=t.struct,a=s.primitives[e],o=d(a.vertexBundelIndices);!(i=o()).done;)for(var h,u=i.value,l=s.vertexBundles[u],c=l.view.offset,_=l.view,f=_.length,p=_.stride,m=d(l.attributes);!(h=m()).done;){var g=h.value,v=bL[g.name];v&&(n[v]=(n[v]||[]).concat(Bx(r,g.format,c,f,p))),c+=F_[g.format].size}var y=a.indexView;return n.indices=Bx(r,jl["R"+8*y.stride+"UI"],y.offset,y.length),n},createMesh:aF,MeshUtils:lF,readBuffer:Bx,writeBuffer:Px,mapBuffer:Nx});t("a3",cF);var _F,dF=new hn,fF=new Dn;!function(t){t[t.RECT=0]="RECT",t[t.POLYGON=1]="POLYGON"}(_F||(_F={}));var pF,mF,gF,vF=[{u:0,v:0},{u:0,v:0},{u:0,v:0},{u:0,v:0}],yF=t("b",qs("cc.SpriteFrame")(((uF=function(t){function e(){var e;return(e=t.call(this)||this).vertices=null,e.uv=[],e.unbiasUV=[],e.uvSliced=[],e._rect=new Vn,e._trimmedBorder=new nn,e._offset=new Fn,e._originalSize=new Hn,e._rotated=!1,e._capInsets=[0,0,0,0],e._atlasUuid="",e._texture=void 0,e._isFlipUVY=!1,e._isFlipUVX=!1,e._original=null,e._packable=!0,e._pixelsToUnit=100,e._pivot=new Fn(.5,.5),e._meshType=_F.RECT,e._extrude=0,e._customOutLine=[],e._minPos=new hn,e._maxPos=new hn,e}s(e,t),e.createWithImage=function(t){var i=t instanceof Df?t:new Df(t),n=new em;n.image=i;var r=new e;return r.texture=n,r};var i=e.prototype;return i.textureLoaded=function(){return!!this.texture},i.isRotated=function(){return this._rotated},i.setRotated=function(t){this.rotated=t},i.getRect=function(t){return t?(t.set(this._rect),t):this._rect.clone()},i.setRect=function(t){this.rect=t},i.getOriginalSize=function(t){return t?(t.set(this._originalSize),t):this._originalSize.clone()},i.setOriginalSize=function(t){this.originalSize=t},i.getOffset=function(t){return t?(t.set(this._offset),t):this._offset.clone()},i.setOffset=function(t){this.offset=t},i.getGFXTexture=function(){return this._texture.getGFXTexture()},i.getGFXSampler=function(){return this._texture.getGFXSampler()},i.getHash=function(){return this._texture.getHash()},i.getSamplerInfo=function(){return this._texture.getSamplerInfo()},i.reset=function(t,e){void 0===e&&(e=!1);var i=!1;e&&(this._originalSize.set(0,0),this._rect.set(0,0,0,0),this._offset.set(0,0),this._capInsets=[0,0,0,0],this._rotated=!1,i=!0),t&&(t.texture&&(this._rect.x=this._rect.y=0,this._rect.width=t.texture.width,this._rect.height=t.texture.height,this._refreshTexture(t.texture),this.checkRect(this._texture)),t.originalSize&&this._originalSize.set(t.originalSize),t.rect&&this._rect.set(t.rect),t.offset&&this._offset.set(t.offset),void 0!==t.borderTop&&(this._capInsets[1]=t.borderTop),void 0!==t.borderBottom&&(this._capInsets[3]=t.borderBottom),void 0!==t.borderLeft&&(this._capInsets[0]=t.borderLeft),void 0!==t.borderRight&&(this._capInsets[2]=t.borderRight),void 0!==t.isRotate&&(this._rotated=!!t.isRotate),void 0!==t.isFlipUv&&(this._isFlipUVY=!!t.isFlipUv),i=!0),i&&this.texture&&this._calculateUV(),this._calcTrimmedBorder()},i.checkRect=function(t){var e=this._rect,i=e.x,n=e.y;return this._rotated?(i+=e.height,n+=e.width):(i+=e.width,n+=e.height),i>t.width?(Z(3300,this.name+"/"+t.name,i,t.width),!1):!(n>t.height&&(Z(3301,this.name+"/"+t.name,n,t.height),1))},i._calcTrimmedBorder=function(){var t=this._originalSize.width,e=this._originalSize.height,i=.5*(t-this._rect.width),n=.5*(e-this._rect.height);this._trimmedBorder.x=this._offset.x+i,this._trimmedBorder.y=this._offset.x-i,this._trimmedBorder.z=this._offset.y+n,this._trimmedBorder.w=this._offset.y-n},i.ensureMeshData=function(){this._mesh||(this._initVertices(),this._createMesh())},i.destroy=function(){return this._packable&&CL&&CL.deleteAtlasSpriteFrame(this),t.prototype.destroy.call(this)},i._calculateSlicedUV=function(){var t=this._rect,i=this.texture,n=i.width,r=i.height,s=this._capInsets[0],a=this._capInsets[2],o=t.width-s-a,h=this._capInsets[1],u=this._capInsets[3],l=t.height-h-u,c=this.uvSliced;if(c.length=0,this._rotated){vF[0].u=t.x/n,vF[1].u=(t.x+u)/n,vF[2].u=(t.x+u+l)/n,vF[3].u=(t.x+t.height)/n,vF[3].v=t.y/r,vF[2].v=(t.y+s)/r,vF[1].v=(t.y+s+o)/r,vF[0].v=(t.y+t.width)/r;for(var _=0;_<4;++_)for(var d=vF[_],f=0;f<4;++f){var p=vF[3-f];c.push({u:d.u,v:p.v})}}else{vF[0].u=t.x/n,vF[1].u=(t.x+s)/n,vF[2].u=(t.x+s+o)/n,vF[3].u=(t.x+t.width)/n,vF[3].v=t.y/r,vF[2].v=(t.y+h)/r,vF[1].v=(t.y+h+l)/r,vF[0].v=(t.y+t.height)/r;for(var m=0;m<4;++m)for(var g=vF[m],v=0;v<4;++v){var y=vF[v];c.push({u:y.u,v:g.v})}}this.emit(e.EVENT_UV_UPDATED,this)},i._calculateUV=function(){var t=this._rect,e=this.uv,i=this.unbiasUV,n=this.texture,r=n.width,s=n.height;if(this._rotated){var a=0===r?0:t.x/r,o=0===r?1:(t.x+t.height)/r,h=0===s?0:t.y/s,u=0===s?1:(t.y+t.width)/s;this._isFlipUVX&&this._isFlipUVY?(e[0]=o,e[1]=u,e[2]=o,e[3]=h,e[4]=a,e[5]=u,e[6]=a,e[7]=h):this._isFlipUVX?(e[0]=o,e[1]=h,e[2]=o,e[3]=u,e[4]=a,e[5]=h,e[6]=a,e[7]=u):this._isFlipUVY?(e[0]=a,e[1]=u,e[2]=a,e[3]=h,e[4]=o,e[5]=u,e[6]=o,e[7]=h):(e[0]=a,e[1]=h,e[2]=a,e[3]=u,e[4]=o,e[5]=h,e[6]=o,e[7]=u);var l=0===r?0:t.x/r,c=0===r?1:(t.x+t.height)/r,_=0===s?0:t.y/s,d=0===s?1:(t.y+t.width)/s;this._isFlipUVX&&this._isFlipUVY?(i[0]=c,i[1]=d,i[2]=c,i[3]=_,i[4]=l,i[5]=d,i[6]=l,i[7]=_):this._isFlipUVX?(i[0]=c,i[1]=_,i[2]=c,i[3]=d,i[4]=l,i[5]=_,i[6]=l,i[7]=d):this._isFlipUVY?(i[0]=l,i[1]=d,i[2]=l,i[3]=_,i[4]=c,i[5]=d,i[6]=c,i[7]=_):(i[0]=l,i[1]=_,i[2]=l,i[3]=d,i[4]=c,i[5]=_,i[6]=c,i[7]=d)}else{var f=0===r?0:t.x/r,p=0===r?1:(t.x+t.width)/r,m=0===s?1:(t.y+t.height)/s,g=0===s?0:t.y/s;this._isFlipUVX&&this._isFlipUVY?(e[0]=p,e[1]=g,e[2]=f,e[3]=g,e[4]=p,e[5]=m,e[6]=f,e[7]=m):this._isFlipUVX?(e[0]=p,e[1]=m,e[2]=f,e[3]=m,e[4]=p,e[5]=g,e[6]=f,e[7]=g):this._isFlipUVY?(e[0]=f,e[1]=g,e[2]=p,e[3]=g,e[4]=f,e[5]=m,e[6]=p,e[7]=m):(e[0]=f,e[1]=m,e[2]=p,e[3]=m,e[4]=f,e[5]=g,e[6]=p,e[7]=g);var v=0===r?0:t.x/r,y=0===r?1:(t.x+t.width)/r,T=0===s?1:(t.y+t.height)/s,S=0===s?0:t.y/s;this._isFlipUVX&&this._isFlipUVY?(i[0]=y,i[1]=S,i[2]=v,i[3]=S,i[4]=y,i[5]=T,i[6]=v,i[7]=T):this._isFlipUVX?(i[0]=y,i[1]=T,i[2]=v,i[3]=T,i[4]=y,i[5]=S,i[6]=v,i[7]=S):this._isFlipUVY?(i[0]=v,i[1]=S,i[2]=y,i[3]=S,i[4]=v,i[5]=T,i[6]=y,i[7]=T):(i[0]=v,i[1]=T,i[2]=y,i[3]=T,i[4]=v,i[5]=S,i[6]=y,i[7]=S)}this._calculateSlicedUV()},i._setDynamicAtlasFrame=function(t){t&&(this._original={_texture:this._texture,_x:this._rect.x,_y:this._rect.y},this._texture=t.texture,this._rect.x=t.x,this._rect.y=t.y,this._calculateUV())},i._resetDynamicAtlasFrame=function(){this._original&&(this._rect.x=this._original._x,this._rect.y=this._original._y,this._texture=this._original._texture,this._original=null,this._calculateUV())},i._checkPackable=function(){var t=CL;if(t){var e=this._texture;if(e instanceof em&&!e.isCompressed){var i=this.width,n=this.height;if(!e.image||i>t.maxFrameSize||n>t.maxFrameSize)this._packable=!1;else{var r=T.HTMLCanvasElement;e.image&&e.image instanceof r&&(this._packable=!0)}}else this._packable=!1}},i._serialize=function(){return null},i._deserialize=function(t){var e=t,i=e.rect;i&&(this._rect=new Vn(i.x,i.y,i.width,i.height));var n=e.offset;e.offset&&(this._offset=new Fn(n.x,n.y));var r=e.originalSize;e.originalSize&&(this._originalSize=new Hn(r.width,r.height)),this._rotated=!!e.rotated,this._name=e.name,this._packable=!!e.packable,this._pixelsToUnit=e.pixelsToUnit;var s=e.pivot;s&&(this._pivot=new Fn(s.x,s.y)),this._meshType=e.meshType;var a=e.capInsets;a&&(this._capInsets[0]=a[0],this._capInsets[1]=a[1],this._capInsets[2]=a[2],this._capInsets[3]=a[3]);var o=e.vertices;if(o){this.vertices||(this.vertices={rawPosition:[],positions:[],indexes:o.indexes,uv:o.uv,nuv:o.nuv,minPos:new hn(o.minPos.x,o.minPos.y,o.minPos.z),maxPos:new hn(o.maxPos.x,o.maxPos.y,o.maxPos.z)}),this.vertices.rawPosition.length=0;for(var h=o.rawPosition,u=0;u0){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=this.limit){var n=this.tail;delete this.datas[n.key],this.count--,this.tail=n.prev,this.tail.next=null,n.prev=null,n.next=null,zF.put(n)}this.moveToHead(i)},e.remove=function(t){t.prev?t.prev.next=t.next:this.head=t.next,t.next?t.next.prev=t.prev:this.tail=t.prev,delete this.datas[t.key],this.count--},e.get=function(t){var e=this.datas[t];return e?(this.remove(e),this.moveToHead(e),e.value):null},e.clear=function(){this.count=0,this.datas={},this.head=null,this.tail=null},e.has=function(t){return!!this.datas[t]},e.delete=function(t){var e=this.datas[t];this.remove(e)},t}()))(100),XF=/([a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûа-яА-ЯЁё]+|\S)/,jF=/^[!,.:;'}\]%\?>、‘“》?。,!]/,YF=/([a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûаíìÍÌïÁÀáàÉÈÒÓòóŐőÙÚŰúűñÑæÆœŒÃÂãÔõěščřžýáíéóúůťďňĚŠČŘŽÁÍÉÓÚŤżźśóńłęćąŻŹŚÓŃŁĘĆĄ-яА-ЯЁёáàảạãăắằẳẵặâấầẩẫậéèẻẽẹêếềểễệiíìỉĩịóòỏõọôốồổỗộơớờởỡợúùủũụưứừửữựýỳỷỹỵđÁÀẢẠÃĂẮẰẲẴẶÂẤẦẨẪẬÉÈẺẼẸÊẾỀỂỄỆIÍÌỈĨỊÓÒỎÕỌÔỐỒỔỖỘƠỚỜỞỠỢÚÙỦŨỤƯỨỪỬỮỰÝỲỶỸỴĐ]+|\S)$/,KF=/[a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûаíìÍÌïÁÀáàÉÈÒÓòóŐőÙÚŰúűñÑæÆœŒÃÂãÔõěščřžýáíéóúůťďňĚŠČŘŽÁÍÉÓÚŤżźśóńłęćąŻŹŚÓŃŁĘĆĄ-яА-ЯЁёáàảạãăắằẳẵặâấầẩẫậéèẻẽẹêếềểễệiíìỉĩịóòỏõọôốồổỗộơớờởỡợúùủũụưứừửữựýỳỷỹỵđÁÀẢẠÃĂẮẰẲẴẶÂẤẦẨẪẬÉÈẺẼẸÊẾỀỂỄỆIÍÌỈĨỊÓÒỎÕỌÔỐỒỔỖỘƠỚỜỞỠỢÚÙỦŨỤƯỨỪỬỮỰÝỲỶỸỴĐ]+$/,qF=/^[a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûаíìÍÌïÁÀáàÉÈÒÓòóŐőÙÚŰúűñÑæÆœŒÃÂãÔõěščřžýáíéóúůťďňĚŠČŘŽÁÍÉÓÚŤżźśóńłęćąŻŹŚÓŃŁĘĆĄ-яА-ЯЁёáàảạãăắằẳẵặâấầẩẫậéèẻẽẹêếềểễệiíìỉĩịóòỏõọôốồổỗộơớờởỡợúùủũụưứừửữựýỳỷỹỵđÁÀẢẠÃĂẮẰẲẴẶÂẤẦẨẪẬÉÈẺẼẸÊẾỀỂỄỆIÍÌỈĨỊÓÒỎÕỌÔỐỒỔỖỘƠỚỜỞỠỢÚÙỦŨỤƯỨỪỬỮỰÝỲỶỸỴĐ]/;function QF(t){return/^[\u4E00-\u9FFF\u3400-\u4DFF]+$/.test(t)||/[\u3000-\u303F]|[\u3040-\u309F]|[\u30A0-\u30FF]|[\uFF00-\uFFEF]|[\u4E00-\u9FAF]|[\u2605-\u2606]|[\u2190-\u2195]|\u203B/g.test(t)||/^[\u1100-\u11FF]|[\u3130-\u318F]|[\uA960-\uA97F]|[\uAC00-\uD7AF]|[\uD7B0-\uD7FF]+$/.test(t)}function ZF(t){var e=t.charCodeAt(0);return e>=9&&e<=13||32===e||133===e||160===e||5760===e||e>=8192&&e<=8202||8232===e||8233===e||8239===e||8287===e||12288===e}function JF(t,e,i){var n=(i||t.font)+"🎮"+e,r=WF.get(n);if(null!==r)return r;var s=t.measureText(e),a=s&&s.width||0;return WF.put(n,a),a}function $F(t,e,i){var n=e,r=i,s=t[e];if(s>="\udc00"&&s<="\udfff"&&n--,void 0!==i)if(i-1!==e){var a=t[i-1];a>="\ud800"&&a<="\udbff"&&r--}else s>="\ud800"&&s<="\udbff"&&r++;return t.substring(n,r)}function tk(t){return qF.exec(t)}function ek(t){return KF.exec(t)}function ik(t,e,i,n){var r=[];if(0===t.length||i<0)return r.push(""),r;for(var s=t;e>i&&s.length>1;){for(var a=s.length*(i/e)|0,o=$F(s,a),h=e-n(o),u=o,l=0,c=0;h>i&&c++<100;)a*=i/h,h=e-n(o=$F(s,a|=0));for(c=0;o&&h<=i&&c++<100;){var _=XF.exec(o);u=o,h=e-n(o=$F(s,a+=l=_?_[0].length:1))}0==(a-=l)?(a=1,u=$F(s,1)):1===a&&s[0]>="\ud800"&&s[0]<="\udbff"&&(a=2,u=$F(s,2));var d=$F(s,0,a),f=void 0;jF.test(u||o)&&(0==(a-=(f=YF.exec(d))?f[0].length:0)&&(a=1),u=$F(s,a),d=$F(s,0,a)),qF.test(u)&&(f=KF.exec(d))&&d!==f[0]&&(u=$F(s,a-=f[0].length),d=$F(s,0,a)),(0===r.length||(d=d.trim()).length>0)&&r.push(d),e=n(s=u||o)}return(0===r.length||(s=s.trim()).length>0)&&r.push(s),r}var nk,rk=function(){function t(){this.pool=[]}t.getInstance=function(){return VF||(VF=new t),VF};var e=t.prototype;return e.get=function(){var t=this.pool.pop();if(!t){var e=T.document.createElement("canvas"),i=e.getContext("2d");t={canvas:e,context:i}}return t},e.put=function(t){this.pool.length>=Ce.MAX_LABEL_CANVAS_POOL_SIZE||this.pool.push(t)},t}(),sk=pn.WHITE.clone(),ak=function(){this.u=0,this.v=0,this.w=0,this.h=0,this.texture=null,this.offsetX=0,this.offsetY=0,this.valid=!1,this.xAdvance=0},ok="rgba(255, 255, 255, "+(1/255).toFixed(3)+")",hk=function(){function t(t,e){this.image=null,this.labelInfo=void 0,this.char=void 0,this.data=null,this.canvas=null,this.context=null,this.width=0,this.height=0,this.offsetY=0,this.hash=void 0,this.char=t,this.labelInfo=e,this.hash=""+t.charCodeAt(0)+e.hash}var e=t.prototype;return e.updateRenderData=function(){this._updateProperties(),this._updateTexture()},e.destroy=function(){this.image=null,rk.getInstance().put(this.data)},e._updateProperties=function(){if(this.data=rk.getInstance().get(),this.canvas=this.data.canvas,this.context=this.data.context,this.context){var t=this.labelInfo.fontScale;this.context.font=this.labelInfo.fontDesc;var e=JF(this.context,this.char,this.labelInfo.fontDesc),i=2*this.labelInfo.margin+2;this.width=parseFloat(e.toFixed(2))*t+i,this.height=(1+GF)*this.labelInfo.fontSize*t+i,this.offsetY=-this.labelInfo.fontSize*GF*t/2}this.canvas.width!==this.width&&(this.canvas.width=this.width),this.canvas.height!==this.height&&(this.canvas.height=this.height),this.image||(this.image=new Df),this.image.reset(this.canvas)},e._updateTexture=function(){if(this.context&&this.canvas){var t=this.context,e=this.labelInfo,i=this.canvas.width,n=this.canvas.height,r=e.fontScale;t.textAlign="center",t.textBaseline="alphabetic",t.clearRect(0,0,i,n),t.fillStyle=ok,t.fillRect(0,0,i,n),t.font=e.fontDesc.replace(/(\d+)(\.\d+)?(px|em|rem|pt)/g,(function(t,e,i,n){return(+e*r+(+i||0)*r).toString()+n}));var s=e.fontSize*r,a=i/2,o=n/2+s*HF+0*s,h=e.color;if(t.lineJoin="round",t.fillStyle="rgba("+h.r+", "+h.g+", "+h.b+", 1)",e.isOutlined){var u=e.out||sk;t.strokeStyle="rgba("+u.r+", "+u.g+", "+u.b+", "+u.a/255+")",t.lineWidth=2*e.margin*r,t.strokeText(this.char,a,o)}t.fillText(this.char,a,o)}},t}(),uk=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.initWithSize=function(t,e,i){void 0===i&&(i=lf.RGBA8888),this.reset({width:t,height:e,format:i})},i.drawTextureAt=function(t,e,i){var n=this.getGFXTexture();if(t&&n){var r=this._getGFXDevice();if(r){var s=new Vc;s.texOffset.x=e,s.texOffset.y=i,s.texExtent.width=t.width,s.texExtent.height=t.height,r.copyTexImagesToTexture([t.data],n,[s])}else console.warn("Unable to get device")}},e}(em),lk=function(){function t(t,e){this._x=0,this._y=0,this._nextY=0,this._width=0,this._height=0,this._halfBleed=0,this._dirty=!1;var i=new uk;i.initWithSize(t,e),this.fontDefDictionary=new FF(i),this._halfBleed=1,this._width=t,this._height=e,gL.on(mL.EVENT_BEFORE_SCENE_LAUNCH,this.beforeSceneLoad,this)}var e=t.prototype;return e.insertLetterTexture=function(t){var e=t.image,i=gL.root.device;if(!e||!this.fontDefDictionary||!i)return null;var n=e.width,r=e.height;if(this._x+n+0>this._width&&(this._x=0,this._y=this._nextY),this._y+r>this._nextY&&(this._nextY=this._y+r+0),this._nextY>this._height)return q(12100),null;this.fontDefDictionary.texture.drawTextureAt(e,this._x,this._y),this._dirty=!0;var s=new ak;return s.u=this._x+this._halfBleed,s.v=this._y+this._halfBleed,s.texture=this.fontDefDictionary.texture,s.valid=!0,s.w=t.width-2,s.h=t.height-2,s.xAdvance=s.w,s.offsetY=t.offsetY,this._x+=n+0,this.fontDefDictionary.addLetterDefinitions(t.hash,s),s},e.update=function(){this._dirty&&(this._dirty=!1)},e.reset=function(){this._x=0,this._y=0,this._nextY=0,this.fontDefDictionary.clear()},e.destroy=function(){this.reset(),this.fontDefDictionary&&(this.fontDefDictionary.texture.destroy(),this.fontDefDictionary.texture=null)},e.getTexture=function(){return this.fontDefDictionary.getTexture()},e.beforeSceneLoad=function(){this.clearAllCache()},e.clearAllCache=function(){this.destroy();var t=new uk;t.initWithSize(this._width,this._height),this.fontDefDictionary.texture=t},e.getLetter=function(t){return this.fontDefDictionary.letterDefinitions[t]},e.getLetterDefinitionForChar=function(t,e){var i=t.charCodeAt(0)+e.hash,n=this.fontDefDictionary.letterDefinitions[i];if(!n){var r=new hk(t,e);r.updateRenderData(),n=this.insertLetterTexture(r),r.destroy()}return n},n(t,[{key:"width",get:function(){return this._width}},{key:"height",get:function(){return this._height}}]),t}(),ck={fontAtlas:null,fontSize:0,lineHeight:0,hAlign:0,vAlign:0,hash:"",fontFamily:"",fontDesc:"Arial",color:pn.WHITE.clone(),isOutlined:!1,out:pn.WHITE.clone(),margin:0,fontScale:1},_k=[new __(Mc.ATTR_POSITION,jl.RGB32F)],dk=[new __(Mc.ATTR_POSITION,jl.RGB32F),new __(Mc.ATTR_COLOR,jl.RGBA32F)],fk=[new __(Mc.ATTR_POSITION,jl.RGB32F),new __(Mc.ATTR_TEX_COORD,jl.RG32F),new __(Mc.ATTR_COLOR,jl.RGBA32F)],pk=[new __(Mc.ATTR_POSITION,jl.RGB32F),new __(Mc.ATTR_TEX_COORD,jl.RG32F),new __(Mc.ATTR_COLOR,jl.RGBA8,!0)],mk=[new __(Mc.ATTR_POSITION,jl.RGB32F),new __(Mc.ATTR_TEX_COORD,jl.RG32F),new __(Mc.ATTR_COLOR,jl.RGBA32F),new __(Mc.ATTR_COLOR2,jl.RGBA32F)],gk=[new __(Mc.ATTR_POSITION,jl.RGB32F),new __(Mc.ATTR_TEX_COORD,jl.RG32F),new __(Mc.ATTR_COLOR,jl.RGBA8,!0),new __(Mc.ATTR_COLOR2,jl.RGBA8,!0)];function vk(t){for(var e=0,i=0;i>2,this._initVDataCount,this._floatsPerVertex,et(9005),this.vData&&this.iData||(this.vData=new Float32Array(this._initVDataCount),this.iData=new Uint16Array(this._initIDataCount)),this._iaPool.push(this.createNewIA(t))},t.reset=function(){this._nextFreeIAHandle=0,this.dirty=!1},t.destroy=function(){this.reset(),this._attributes=null,this._iaInfo=null,this.vData=null,this.iData=null;for(var t=0;tthis._initVDataCount||n>this._initIDataCount)},t.uploadBuffers=function(){if(0!==this.byteOffset&&this._dirty){var t=Ol.__isWebIOS14OrIPadOS14Env,e=t?this._nextFreeIAHandle:1;if(t&&e/this._iaPool.length<.5){for(var i=e/.5,n=this._iaPool.length-1;n>=i;n--){var r=this._iaPool[n];r.vertexBuffers[0]&&r.vertexBuffers[0].destroy(),r.indexBuffer&&r.indexBuffer.destroy(),r.ia.destroy()}this._iaPool.length=i}for(var s=this.byteOffset,a=this.indexOffset,o=0;o>2),l=new Uint16Array(this.iData.buffer,0,a),c=h.vertexBuffers[0];s>c.size&&c.resize(s),c.update(u),2*a>h.indexBuffer.size&&h.indexBuffer.resize(2*a),h.indexBuffer.update(l)}this.dirty=!1}},t.createNewIA=function(t){var e,i,n;if(Ol.__isWebIOS14OrIPadOS14Env||!this._iaPool[0]){var r=this._vertexFormatBytes=this._floatsPerVertex*Float32Array.BYTES_PER_ELEMENT,s=Uint16Array.BYTES_PER_ELEMENT,a=t.createBuffer(new qc(ql.VERTEX|ql.TRANSFER_DST,Jl.HOST|Jl.DEVICE,r,r));n=t.createBuffer(new qc(ql.INDEX|ql.TRANSFER_DST,Jl.HOST|Jl.DEVICE,s,s)),i=[a],this._iaInfo=new f_(this._attributes,i,n),e=t.createInputAssembler(this._iaInfo)}else e=t.createInputAssembler(this._iaInfo),i=this._iaInfo.vertexBuffers,n=this._iaInfo.indexBuffer;return{ia:e,vertexBuffers:i,indexBuffer:n}},n(e,[{key:"attributes",get:function(){return this._attributes}},{key:"vertexFormatBytes",get:function(){return this._vertexFormatBytes}},{key:"byteOffset",get:function(){return this._byteOffset},set:function(t){this._byteOffset=t}},{key:"vertexOffset",get:function(){return this._vertexOffset},set:function(t){this._vertexOffset=t}},{key:"indexOffset",get:function(){return this._indexOffset},set:function(t){this._indexOffset=t}},{key:"dirty",get:function(){return this._dirty},set:function(t){this._dirty=t}},{key:"floatsPerVertex",get:function(){return this._floatsPerVertex},set:function(t){this._floatsPerVertex=t}},{key:"vData",get:function(){return this._vData},set:function(t){this._vData=t}},{key:"iData",get:function(){return this._iData},set:function(t){this._iData=t}},{key:"nativeObj",get:function(){return this._nativeObj}},{key:"sharedBuffer",get:function(){return this._sharedBuffer}}]),e}()),wk=function(){function t(t,e){this._device=null,this._attributes=null,this._vertexFormatBytes=void 0,this._floatsPerVertex=void 0,this._buffers=[],this._device=t,this._attributes=e,this._floatsPerVertex=yk(e)>>2,this._vertexFormatBytes=this._floatsPerVertex*Float32Array.BYTES_PER_ELEMENT}var e=t.prototype;return e.initialize=function(){},e.reset=function(){},e.request=function(){},e.appendBuffers=function(){},e.uploadBuffers=function(){},e.destroy=function(){this._attributes.length=0},n(t,[{key:"attributes",get:function(){return this._attributes}},{key:"vertexFormatBytes",get:function(){return this._vertexFormatBytes}},{key:"floatsPerVertex",get:function(){return this._floatsPerVertex}}]),t}(),xk=new Pu((function(){return{offset:0,length:0}}),32),Ik=function(){function t(t,e,i,n,r,s){this._ib=void 0,this.vertexAccessor=t,this.bufferId=e,this.meshBuffer=i,this.vertexOffset=n,this.vb=r,this.indexCount=s,this._ib=new Uint16Array(s),t.getMeshBuffer(e)}return t.prototype.setIndexBuffer=function(){},n(t,[{key:"ib",get:function(){return this._ib}}]),t}(),Ok=function(t){function e(i,n,r,s){var a;return(a=t.call(this,i,n)||this)._freeLists=[],a._vCount=0,a._iCount=0,a._id=0,a._vCount=r||Math.floor(1024*Ce.BATCHER2D_MEM_INCREMENT/a._vertexFormatBytes),a._iCount=s||a._vCount*e.IB_SCALE,a._id=e.generateID(),a._allocateBuffer(),a}s(e,t);var i=e.prototype;return i.destroy=function(){for(var e=0;e=n){o=i[u],s=h,a=u;break}if(o)break}if(o||(s=this._allocateBuffer(),(r=this._buffers[s])&&r.checkCapacity(t,e)&&(a=0,o=this._freeLists[s][a])),o){var l=o.offset/this.vertexFormatBytes,c=new Float32Array(r.vData.buffer,o.offset,n>>2).fill(0);return this._allocateChunkFromEntry(s,a,o,n),new Ik(this,s,r,l,c,e)}return Z(9004,n),null},i.recycleChunk=function(t){var e=this._freeLists[t.bufferId],i=this._buffers[t.bufferId],n=t.vertexOffset*this.vertexFormatBytes,r=t.vb.byteLength;if(0!==r){for(var s=!1,a=0,o=null,h=e[a];h&&h.offset=0,9004,t,i.offset,i.length),0===r?(this._freeLists[t].splice(e,1),xk.free(i)):(i.offset+=n,i.length=r)},i._allocateBuffer=function(){tt(this._buffers.length===this._freeLists.length,9003);var t=new Ck,e=this._vCount*this._floatsPerVertex;t.initialize(this._device,this._attributes,e,this._iCount),this._buffers.push(t);var i=xk.alloc();i.offset=0,i.length=t.vData.byteLength;var n=[i];return this._freeLists.push(n),gL.root.batcher2D.syncMeshBuffersToNative(this.id,this._buffers),this._buffers.length-1},e.generateID=function(){return e.ID_COUNT++},n(e,[{key:"id",get:function(){return this._id}}]),e}(wk);Ok.IB_SCALE=4,Ok.ID_COUNT=0,function(t){t[t.DrawInfoType=0]="DrawInfoType",t[t.VertDirty=1]="VertDirty",t[t.IsMeshBuffer=2]="IsMeshBuffer",t[t.Stride=3]="Stride",t[t.Count=4]="Count"}(Tk||(Tk={})),function(t){t[t.BufferID=0]="BufferID",t[t.AccessorID=1]="AccessorID",t[t.Count=2]="Count"}(Sk||(Sk={})),function(t){t[t.VertexOffset=0]="VertexOffset",t[t.IndexOffset=1]="IndexOffset",t[t.VBCount=2]="VBCount",t[t.IBCount=3]="IBCount",t[t.DataHash=4]="DataHash",t[t.Count=5]="Count"}(Ek||(Ek={})),function(t){t[t.COMP=0]="COMP",t[t.MODEL=1]="MODEL",t[t.MIDDLEWARE=2]="MIDDLEWARE",t[t.SUB_NODE=3]="SUB_NODE"}(Ak||(Ak={})),function(){function t(t){this._accId=-1,this._bufferId=-1,this._vertexOffset=0,this._indexOffset=0,this._vb=null,this._ib=null,this._vData=null,this._iData=null,this._vertDirty=!1,this._vbCount=0,this._ibCount=0,this._dataHash=0,this._isMeshBuffer=!1,this._material=null,this._texture=null,this._sampler=null,this._stride=0,this._useLocal=!1,this._model=null,this._drawInfoType=Ak.COMP,this._subNode=null,this._uint8SharedBuffer=void 0,this._uint16SharedBuffer=void 0,this._uint32SharedBuffer=void 0,this.init(t);var e=this._nativeObj.getAttrSharedBufferForJS(),i=0;this._uint8SharedBuffer=new Uint8Array(e,i,Tk.Count),i+=Tk.Count*Uint8Array.BYTES_PER_ELEMENT,this._uint16SharedBuffer=new Uint16Array(e,i,Sk.Count),i+=Sk.Count*Uint16Array.BYTES_PER_ELEMENT,this._uint32SharedBuffer=new Uint32Array(e,i,Ek.Count)}var e=t.prototype;e.init=function(){},e.clear=function(){this._bufferId=0,this._vertexOffset=0,this._indexOffset=0,this._vertDirty=!1},e.setAccId=function(t){this._accId=t},e.setBufferId=function(t){this._bufferId=t},e.setAccAndBuffer=function(t,e){this._bufferId=e,this._accId=t},e.setVertexOffset=function(t){this._vertexOffset=t},e.setIndexOffset=function(t){this._indexOffset=t},e.setVB=function(){},e.setIB=function(){},e.setVData=function(){},e.setIData=function(){},e.setVBCount=function(t){this._vbCount=t},e.setIBCount=function(){},e.setVertDirty=function(t){this._vertDirty=t},e.setDataHash=function(t){this._dataHash=t},e.setIsMeshBuffer=function(t){this._isMeshBuffer=t},e.setMaterial=function(t){this._material=t},e.setTexture=function(t){this._texture=t},e.setSampler=function(t){this._sampler=t},e.setModel=function(){},e.setDrawInfoType=function(t){this._drawInfoType=t},e.setSubNode=function(t){this._subNode=t},e.setStride=function(t){this._stride=t},e.initRender2dBuffer=function(){},e.fillRender2dBuffer=function(){},n(t,[{key:"nativeObj",get:function(){return this._nativeObj}},{key:"render2dBuffer",get:function(){return this._render2dBuffer}}])}(),function(t){t[t.DISABLED=0]="DISABLED",t[t.CLEAR=1]="CLEAR",t[t.ENTER_LEVEL=2]="ENTER_LEVEL",t[t.ENABLED=3]="ENABLED",t[t.EXIT_LEVEL=4]="EXIT_LEVEL",t[t.CLEAR_INVERTED=5]="CLEAR_INVERTED",t[t.ENTER_LEVEL_INVERTED=6]="ENTER_LEVEL_INVERTED"}(Rk||(Rk={})),function(t){t[t.stencilTest=0]="stencilTest",t[t.func=1]="func",t[t.stencilMask=2]="stencilMask",t[t.writeMask=3]="writeMask",t[t.failOp=4]="failOp",t[t.zFailOp=5]="zFailOp",t[t.passOp=6]="passOp",t[t.ref=7]="ref",t[t.count=8]="count"}(bk||(bk={}));var Dk,Mk,Pk,Bk,Nk,Lk=t("S",function(){function t(){this._maskStack=[],this._stencilPattern={stencilTest:!0,func:oc.ALWAYS,stencilMask:65535,writeMask:65535,failOp:hc.KEEP,zFailOp:hc.KEEP,passOp:hc.KEEP,ref:1},this._stage=Rk.DISABLED,this.stencilStateMap=new Map,this.stencilStateMapWithDepth=new Map}var e=t.prototype;return e.pushMask=function(t){this._maskStack.push(t)},e.clear=function(t){return t.stencilStage!==Rk.ENTER_LEVEL?Rk.CLEAR_INVERTED:Rk.CLEAR},e.enableMask=function(){this.stage=Rk.ENABLED},e.exitMask=function(){0!==this._maskStack.length&&(this._maskStack.pop(),0===this._maskStack.length?this.stage=Rk.DISABLED:this.stage=Rk.ENABLED)},e.getWriteMask=function(){return 1<>2,Qk=t("r",function(){function t(t){void 0===t&&(t=fk),this.chunk=null,this._renderDrawInfo=null,this._material=null,this._dataHash=0,this._isMeshBuffer=!1,this._vc=0,this._ic=0,this._floatStride=0,this._vertexFormat=fk,this._drawInfoType=Ak.COMP,this._multiOwner=!1,this._batcher=null,this._floatStride=t===fk?qk:yk(t)>>2,this._vertexFormat=t}var e=t.prototype;return e.isValid=function(){return this._ic>0&&this.chunk.vertexAccessor},e.initRenderDrawInfo=function(t,e){void 0===e&&(e=Ak.COMP)},e.removeRenderDrawInfo=function(){},e.setRenderDrawInfoAttributes=function(){},n(t,[{key:"vertexCount",get:function(){return this._vc}},{key:"indexCount",get:function(){return this._ic}},{key:"stride",get:function(){return this._floatStride<<2}},{key:"floatStride",get:function(){return this._floatStride}},{key:"vertexFormat",get:function(){return this._vertexFormat}},{key:"drawInfoType",get:function(){return this._drawInfoType},set:function(t){this._drawInfoType=t,this._renderDrawInfo&&this._renderDrawInfo.setDrawInfoType(t)}},{key:"renderDrawInfo",get:function(){return this._renderDrawInfo}},{key:"material",get:function(){return this._material},set:function(t){this._material=t,this._renderDrawInfo&&this._renderDrawInfo.setMaterial(t)}},{key:"dataHash",get:function(){return this._dataHash},set:function(t){this._dataHash=t,this._renderDrawInfo&&this._renderDrawInfo.setDataHash(t)}},{key:"multiOwner",get:function(){return this._multiOwner},set:function(t){this._multiOwner=t}},{key:"batcher",get:function(){return this._batcher||(this._batcher=gL.root.batcher2D),this._batcher}}]),t}()),Zk=t("t",function(t){function e(e,i){var n;return void 0===e&&(e=fk),(n=t.call(this,e)||this)._vertDirty=!0,n._textureHash=0,n.indices=null,n.layer=0,n.nodeDirty=!0,n.passDirty=!0,n.textureDirty=!0,n.hashDirty=!0,n._data=[],n._frame=null,n._accessor=null,n.vertexRow=1,n.vertexCol=1,i||(i=n.batcher.switchBufferAccessor(n._vertexFormat)),n._accessor=i,n}s(e,t),e.add=function(t,i){void 0===t&&(t=fk);var n=new e(t,i);return i||(i=gL.root.batcher2D.switchBufferAccessor(n._vertexFormat)),n._accessor=i,n},e.remove=function(t){t.clear(),t._accessor=null};var i=e.prototype;return i.resize=function(t,e){t===this._vc&&e===this._ic&&this.chunk||(this._vc=t,this._ic=e,this.chunk&&(this._accessor.recycleChunk(this.chunk),this.chunk=null),this.chunk=this._accessor.allocateChunk(t,e),this.updateHash())},i.setRenderDrawInfoAttributes=function(){},i.fillDrawInfoAttributes=function(){},i.syncRender2dBuffer=function(){},i.resizeAndCopy=function(t,e){if(t!==this._vc||e!==this._ic||!this.chunk){this._vc=t,this._ic=e;var i=this.chunk;this.chunk=this._accessor.allocateChunk(t,e),i&&(this.chunk.vb.set(i.vb),this._accessor.recycleChunk(i)),this.updateHash()}},i.getMeshBuffer=function(){return this.chunk&&this._accessor?this._accessor.getMeshBuffer(this.chunk.bufferId):null},i.updateNode=function(t){this.layer=t.node.layer,this.nodeDirty=!1,this.hashDirty=!0},i.updatePass=function(t){this.material=t.getRenderMaterial(0),this.passDirty=!1,this.hashDirty=!0},i.updateTexture=function(t){this.frame=t,this.textureHash=t.getHash(),this.textureDirty=!1,this.hashDirty=!0},i.updateHash=function(){var t=""+(this.chunk?this.chunk.bufferId:-1)+this.layer+" "+this.textureHash;this.dataHash=Bl(t,666),this.hashDirty=!1},i.updateRenderData=function(t,e){if(this.passDirty&&(this.material=t.getRenderMaterial(0),this.passDirty=!1,this.hashDirty=!0,this._renderDrawInfo&&this._renderDrawInfo.setMaterial(this.material)),this.nodeDirty){var i=t.node.scene?t._getRenderScene():null;this.layer=t.node.layer,null!==i&&(this.nodeDirty=!1),this.hashDirty=!0}this.textureDirty&&(this.frame=e,this.textureHash=e.getHash(),this.textureDirty=!1,this.hashDirty=!0,this._renderDrawInfo&&(this._renderDrawInfo.setTexture(this.frame?this.frame.getGFXTexture():null),this._renderDrawInfo.setSampler(this.frame?this.frame.getGFXSampler():null))),this.hashDirty&&(this.updateHash(),this._renderDrawInfo&&this._renderDrawInfo.setDataHash(this.dataHash))},i.clear=function(){this.resize(0,0),this._data.length=0,this.indices=null,this.vertDirty=!0,this.material=null,this.nodeDirty=!0,this.passDirty=!0,this.textureDirty=!0,this.hashDirty=!0,this.layer=0,this.frame=null,this.textureHash=0,this.dataHash=0},e.createStaticVBAccessor=function(t,e,i){var n=gL.root.device;return new Ok(n,t,e,i)},n(e,[{key:"dataLength",get:function(){return this._data.length},set:function(t){var e=this._data;if(e.length!==t){for(var i=e.length;i>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=0&&e>=0&&i<=this.vData.byteLength&&this.iData.length,this._vc=t,this._ic=e,this._byteLength=i,this.updateRange(0,t,0,e)},i.updateRange=function(t,e,i,n){e>=0&&n>=0&&e<=this._vc&&this._ic,this.vertexStart=t,this.indexStart=i,this.vertexRange=e,this.indexRange=n},i.requestIA=function(t){this._initIAInfo(t);var e=this._iaPool.add();return e.firstIndex=this.indexStart,e.indexCount=this.indexRange,e},i.uploadBuffers=function(){if(0!==this._byteLength&&this._vertexBuffers[0]&&this._indexBuffer){var t=this._ic,e=new Float32Array(this.vData.buffer,0,this._byteLength>>2),i=new Uint16Array(this.iData.buffer,0,t),n=this._vertexBuffers[0];this._byteLength>n.size&&n.resize(this._byteLength),n.update(e);var r=t<<1;r>this._indexBuffer.size&&this._indexBuffer.resize(r),this._indexBuffer.update(i)}},i.freeIAPool=function(){this._iaPool&&this._iaPool.reset()},i.reset=function(){this._vc=0,this._ic=0,this._byteLength=0,this.vertexStart=0,this.vertexRange=0,this.indexStart=0,this.indexRange=0,this.lastFilledIndex=0,this.lastFilledVertex=0,this.material=null,this.freeIAPool()},i.clear=function(){this.reset(),this._iaPool&&this._iaPool.destroy(),this._vertexBuffers[0]&&(this._vertexBuffers[0].destroy(),this._vertexBuffers=[]),this._iaInfo=null,this.vData=new Float32Array(256*this.stride),this.iData=new Uint16Array(1536)},i._initIAInfo=function(t){var e=this;if(!this._iaInfo){var i=this.stride,n=this._vertexBuffers;n.length||n.push(t.createBuffer(new qc(ql.VERTEX|ql.TRANSFER_DST,Jl.DEVICE,i,i)));var r=Uint16Array.BYTES_PER_ELEMENT;this._indexBuffer||(this._indexBuffer=t.createBuffer(new qc(ql.INDEX|ql.TRANSFER_DST,Jl.DEVICE,r,r))),this._iaInfo=new f_(this._vertexFormat,n,this._indexBuffer),this._iaPool=new Bu((function(){return t.createInputAssembler(e._iaInfo)}),1,(function(t){t.destroy()}))}},i._reallocBuffer=function(t,e){var i=this.vData;this.vData=new Float32Array(t),i&&this.vData.set(i,0);var n=this.iData;this.iData=new Uint16Array(e),n&&this.iData.set(n,0)},i.setRenderDrawInfoAttributes=function(){},i.particleInitRenderDrawInfo=function(){},n(e,[{key:"formatByte",get:function(){return this.stride},set:function(){}},{key:"floatStride",get:function(){return this._floatStride}},{key:"vDataOffset",get:function(){return this._byteLength>>>2}}]),e}(Qk)),$k=new Fn,tU=new Fn,eU=new hn,iU=new Dn,nU=new Dn,rU=new Dn,sU=new Dn(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),aU=new Vn,oU=t("d",qs("cc.UITransform")(Fk=Zs(110)(Fk=Js(((Hk=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r=0&&r.y>=0&&r.x<=e&&r.y<=i&&(c=this._maskTest(n)),c)return!0}}}return!1},i.hitTest=function(t,e){void 0===e&&(e=0);for(var i=this._contentSize.width,n=this._contentSize.height,r=eU,s=$k,a=tU,o=this._getRenderScene().cameras,h=0;h=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&&oh.index){n.length=o;break}}return!0},i.convertToNodeSpaceAR=function(t,e){return this.node.getWorldMatrix(rU),Dn.invert(iU,rU),e||(e=new hn),hn.transformMat4(e,t,iU)},i.convertToWorldSpaceAR=function(t,e){return this.node.getWorldMatrix(rU),e||(e=new hn),hn.transformMat4(e,t,rU)},i.getBoundingBox=function(){var t=new Vn;return this._selfBoundingBox(t),Dn.fromSRT(nU,this.node.rotation,this.node.position,this.node.scale),t.transformMat4(nU),t},i.getBoundingBoxToWorld=function(){for(var t=new Vn,i=this.node.children,n=0;n=this._materials.length?null:this._materials[t]},i.setSharedMaterial=function(t,e){t&&t instanceof US&&Z(12012),this._materials[e]=t;var i=this._materialInstances[e];i&&(i.destroy(),this._materialInstances[e]=null),this._onMaterialModified(e,this._materials[e])},i.getMaterialInstance=function(t){if(!this._materials[t])return null;if(!this._materialInstances[t]){SU.parent=this._materials[t],SU.owner=this,SU.subModelIdx=t;var e=new US(SU);SU.parent=null,SU.owner=null,SU.subModelIdx=0,this.setMaterialInstance(e,t)}return this._materialInstances[t]},i.setMaterialInstance=function(t,e){if("number"==typeof t){q(12007);var i=t;t=e,e=i}var n=this._materialInstances[e];t&&t.parent?t!==n&&(this._materialInstances[e]=t,this._onMaterialModified(e,t)):(t!==this._materials[e]||n)&&this.setSharedMaterial(t,e)},i.getRenderMaterial=function(t){return this._materialInstances[t]||this._materials[t]},i._onMaterialModified=function(){},i._onRebuildPSO=function(){},i._clearMaterials=function(){},n(e,[{key:"sharedMaterial",get:function(){return this.getSharedMaterial(0)}},{key:"sharedMaterials",get:function(){return this._materials},set:function(t){for(var e=0;e0},i._postCanRender=function(){},i.updateMaterial=function(){if(this._customMaterial)this.getSharedMaterial(0)!==this._customMaterial&&this.setSharedMaterial(this._customMaterial,0);else{var t=this._updateBuiltinMaterial();this.setSharedMaterial(t,0),this.stencilStage!==Rk.ENTER_LEVEL&&this.stencilStage!==Rk.ENTER_LEVEL_INVERTED||this.getMaterialInstance(0).recompileShaders({USE_ALPHA_TEST:!0}),this._updateBlendFunc()}},i._updateColor=function(){if(this.node._uiProps.colorDirty=!0,this.setEntityColorDirty(!0),this.setEntityColor(this._color),this.setEntityOpacity(this.node._uiProps.localOpacity),this._assembler){this._assembler.updateColor(this);var t=this._renderFlag;if(this._renderFlag=this._canRender(),this.setEntityEnabled(this._renderFlag),t!==this._renderFlag){var e=this.renderData;e&&(e.vertDirty=!0)}}},e.setEntityColorDirtyRecursively=function(t,i){var n=t._uiProps.uiComp;n&&n.color&&(n._renderEntity.colorDirty=i);for(var r=0;r>16,t|=t>>8,t|=t>>4,t|=t>>2,t|=t>>1,++t}function TG(t,e){return Math.ceil(t/e)*e}!function(t){t[t.OPAQUE=0]="OPAQUE",t[t.TRANSPARENT=1]="TRANSPARENT",t[t.OVERLAY=2]="OVERLAY"}(pG||(pG={})),function(t){t[t.DEFAULT=1]="DEFAULT",t[t.FORWARD=2]="FORWARD",t[t.SHADOWCAST=4]="SHADOWCAST"}(mG||(mG={}));var SG,EG,AG,RG,bG,CG,wG,xG,IG,OG=function(){function t(t){this._device=void 0,this._format=jl.UNKNOWN,this._formatSize=0,this._chunks=[],this._chunkCount=0,this._handles=[],this._region0=new Vc,this._region1=new Vc,this._region2=new Vc,this._roundUpFn=null,this._bufferViewCtor=Uint8Array,this._channels=4,this._alignment=1,this._device=t}var e=t.prototype;return e.initialize=function(t){var e=F_[t.format];this._format=t.format,this._formatSize=e.size,this._channels=e.count,this._bufferViewCtor=j_(e),this._roundUpFn=t.roundUpFn||null,this._alignment=t.alignment||1,t.inOrderFree&&(this.alloc=this._McDonaldAlloc)},e.destroy=function(){for(var t=0;t=0));++r);if(n>=0){var s=this._chunks[i];s.start+=t;var a={chunkIdx:i,start:n,end:n+t,texture:s.texture};return this._handles.push(a),a}var o=Math.sqrt(t/this._formatSize),h=this._roundUpFn&&this._roundUpFn(o,this._formatSize)||Math.max(1024,yG(o)),u=this._chunks[this.createChunk(h)];u.start+=t;var l={chunkIdx:this._chunkCount-1,start:0,end:t,texture:u.texture};return this._handles.push(l),l},e.free=function(t){for(var e=0;e0&&(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;ai.end?r+t<=i.size?n=!0:t<=i.end&&(i.start=r=0,n=!0):r===i.end&&(i.start=r=0,i.end=i.size,t<=i.end&&(n=!0)),n){i.start+=t;var s={chunkIdx:e,start:r,end:r+t,texture:i.texture};return this._handles.push(s),s}}var a=Math.sqrt(t/this._formatSize),o=this._roundUpFn&&this._roundUpFn(a,this._formatSize)||Math.max(1024,yG(a)),h=this._chunks[this.createChunk(o)];h.start+=t;var u={chunkIdx:this._chunkCount,start:0,end:t,texture:h.texture};return this._handles.push(u),u},t}(),DG=function(){function t(t,e,i){this._arrayBuffers=[],this._chunkSize=void 0,this._chunkSize=i*(1<>this._entryBits,i=this._entryMask&t;return(this._hasFloat32?this._float32BufferViews:this._uint32BufferViews)[e][i]},e.getTypedArray=function(t,e){var i=(this._chunkMask&t)>>this._entryBits,n=this._entryMask&t,r=e,s=(this._dataType[e]===IG.UINT32?this._uint32BufferViews:this._float32BufferViews)[i][n],a=this._dataMembers[e];return s.subarray(r,r+a)},e.free=function(t){var e=(this._chunkMask&t)>>this._entryBits,i=this._entryMask&t;(this._hasUint32?this._uint32BufferViews:this._float32BufferViews)[e][i].fill(0),this._freeLists[e].push(i)},t}();!function(t){t[t.NODE=0]="NODE",t[t.PASS=1]="PASS",t[t.AABB=2]="AABB",t[t.RENDER2D=3]="RENDER2D"}(MG||(MG={})),function(t){t[t.POSITION=0]="POSITION",t[t.UV=3]="UV",t[t.COLOR=5]="COLOR",t[t.COUNT=9]="COUNT"}(PG||(PG={}));var NG,LG=((SG={})[PG.POSITION]=IG.FLOAT32,SG[PG.UV]=IG.FLOAT32,SG[PG.COLOR]=IG.UINT32,SG[PG.COUNT]=IG.NEVER,SG),FG=((EG={})[PG.POSITION]=PG.UV-PG.POSITION,EG[PG.UV]=PG.COLOR-PG.UV,EG[PG.COLOR]=PG.COUNT-PG.COLOR,EG[PG.COUNT]=1,EG),kG=new BG(MG.RENDER2D,LG,FG,PG);!function(t){t[t.DIRTY_FLAG=0]="DIRTY_FLAG",t[t.LAYER=1]="LAYER",t[t.WORLD_SCALE=2]="WORLD_SCALE",t[t.WORLD_POSITION=5]="WORLD_POSITION",t[t.WORLD_ROTATION=8]="WORLD_ROTATION",t[t.WORLD_MATRIX=12]="WORLD_MATRIX",t[t.LOCAL_SCALE=28]="LOCAL_SCALE",t[t.LOCAL_POSITION=31]="LOCAL_POSITION",t[t.LOCAL_ROTATION=34]="LOCAL_ROTATION",t[t.COUNT=38]="COUNT"}(NG||(NG={}));var UG,GG=((AG={})[NG.DIRTY_FLAG]=IG.UINT32,AG[NG.LAYER]=IG.UINT32,AG[NG.WORLD_SCALE]=IG.FLOAT32,AG[NG.WORLD_POSITION]=IG.FLOAT32,AG[NG.WORLD_ROTATION]=IG.FLOAT32,AG[NG.WORLD_MATRIX]=IG.FLOAT32,AG[NG.LOCAL_SCALE]=IG.FLOAT32,AG[NG.LOCAL_POSITION]=IG.FLOAT32,AG[NG.LOCAL_ROTATION]=IG.FLOAT32,AG[NG.COUNT]=IG.NEVER,AG),HG=((RG={})[NG.DIRTY_FLAG]=NG.LAYER-NG.DIRTY_FLAG,RG[NG.LAYER]=NG.WORLD_SCALE-NG.LAYER,RG[NG.WORLD_SCALE]=NG.WORLD_POSITION-NG.WORLD_SCALE,RG[NG.WORLD_POSITION]=NG.WORLD_ROTATION-NG.WORLD_POSITION,RG[NG.WORLD_ROTATION]=NG.WORLD_MATRIX-NG.WORLD_ROTATION,RG[NG.WORLD_MATRIX]=NG.LOCAL_SCALE-NG.WORLD_MATRIX,RG[NG.LOCAL_SCALE]=NG.LOCAL_POSITION-NG.LOCAL_SCALE,RG[NG.LOCAL_POSITION]=NG.LOCAL_ROTATION-NG.LOCAL_POSITION,RG[NG.LOCAL_ROTATION]=NG.COUNT-NG.LOCAL_ROTATION,RG[NG.COUNT]=1,RG),zG=new BG(MG.NODE,GG,HG,NG);!function(t){t[t.PRIORITY=0]="PRIORITY",t[t.STAGE=1]="STAGE",t[t.PHASE=2]="PHASE",t[t.PRIMITIVE=3]="PRIMITIVE",t[t.BATCHING_SCHEME=4]="BATCHING_SCHEME",t[t.DYNAMIC_STATE=5]="DYNAMIC_STATE",t[t.HASH=6]="HASH",t[t.COUNT=7]="COUNT"}(UG||(UG={}));var VG,WG=((bG={})[UG.PRIORITY]=IG.UINT32,bG[UG.STAGE]=IG.UINT32,bG[UG.PHASE]=IG.UINT32,bG[UG.PRIMITIVE]=IG.UINT32,bG[UG.BATCHING_SCHEME]=IG.UINT32,bG[UG.DYNAMIC_STATE]=IG.UINT32,bG[UG.HASH]=IG.UINT32,bG[UG.COUNT]=IG.NEVER,bG),XG=((CG={})[UG.PRIORITY]=UG.STAGE-UG.PRIORITY,CG[UG.STAGE]=UG.PHASE-UG.STAGE,CG[UG.PHASE]=UG.PRIMITIVE-UG.PHASE,CG[UG.PRIMITIVE]=UG.BATCHING_SCHEME-UG.PRIMITIVE,CG[UG.BATCHING_SCHEME]=UG.DYNAMIC_STATE-UG.BATCHING_SCHEME,CG[UG.DYNAMIC_STATE]=UG.HASH-UG.DYNAMIC_STATE,CG[UG.HASH]=UG.COUNT-UG.HASH,CG[UG.COUNT]=1,CG),jG=new BG(MG.PASS,WG,XG,UG);!function(t){t[t.CENTER=0]="CENTER",t[t.HALFEXTENTS=3]="HALFEXTENTS",t[t.COUNT=6]="COUNT"}(VG||(VG={}));var YG=((wG={})[VG.CENTER]=IG.FLOAT32,wG[VG.HALFEXTENTS]=IG.FLOAT32,wG[VG.COUNT]=IG.NEVER,wG),KG=((xG={})[VG.CENTER]=VG.HALFEXTENTS-VG.CENTER,xG[VG.HALFEXTENTS]=VG.COUNT-VG.HALFEXTENTS,xG[VG.COUNT]=1,xG),qG=new BG(MG.AABB,YG,KG,VG);st(YB.prototype,"RenderScene.prototype",[{name:"raycastUI2DNode"},{name:"raycastUINode"}]),st(YB.prototype,"RenderScene.prototype",[{name:"raycastAll",suggest:"using intersect.rayModel in geometry"},{name:"raycastAllModels",suggest:"using intersect.rayModel in geometry"},{name:"raycastSingleModel",suggest:"using intersect.rayModel in geometry"},{name:"raycastAllCanvas",suggest:"using intersect.rayAABB in geometry"},{name:"rayResultCanvas"},{name:"rayResultModels"},{name:"rayResultAll"},{name:"rayResultSingleModel"}]),st(IB.prototype,"Model.prototype",[{name:"isInstancingEnabled"},{name:"instancedAttributes"}]);var QG={};st(QG,"CameraVisFlags",[{name:"GENERAL"}]),rt(QG,"CameraVisFlags",[{name:"PROFILER",newName:"PROFILER",target:sm.BitMask,targetName:"PROFILER"},{name:"GIZMOS",newName:"GIZMOS",target:sm.BitMask,targetName:"GIZMOS"},{name:"EDITOR",newName:"EDITOR",target:sm.BitMask,targetName:"EDITOR"},{name:"UI",newName:"UI",target:sm.BitMask,targetName:"UI_3D"},{name:"UI2D",newName:"UI2D",target:sm.BitMask,targetName:"UI_2D"}]),v.CameraVisFlags=QG;var ZG={};st(ZG,"VisibilityFlags",[{name:"GENERAL"}]),rt(ZG,"VisibilityFlags",[{name:"ALWALS",newName:"ALWALS",target:sm.Enum,targetName:"ALWALS"},{name:"PROFILER",newName:"PROFILER",target:sm.Enum,targetName:"PROFILER"},{name:"GIZMOS",newName:"GIZMOS",target:sm.Enum,targetName:"GIZMOS"},{name:"EDITOR",newName:"EDITOR",target:sm.Enum,targetName:"EDITOR"},{name:"UI",newName:"UI",target:sm.Enum,targetName:"UI_3D"},{name:"UI2D",newName:"UI2D",target:sm.Enum,targetName:"UI_2D"}]),v.VisibilityFlags=ZG,rt(_S.prototype,"Pass.prototype",[{name:"getBindingTypeFromHandle",newName:"getDescriptorTypeFromHandle"}]),st(jw.prototype,"Camera.prototype",[{name:"getSplitFrustum"},{name:"setMatView"},{name:"setMatViewInv"},{name:"setMatProjInv"},{name:"setMatViewProjInv"},{name:"setMatProj"},{name:"setMatViewProj"},{name:"getMatViewInv"}]),st(FS.prototype,"Shadows.prototype",[{name:"aspect"},{name:"selfShadow"},{name:"linear"},{name:"packing"},{name:"autoAdapt"},{name:"fixedArea"},{name:"pcf"},{name:"bias"},{name:"normalBias"},{name:"near"},{name:"far"},{name:"shadowDistance"},{name:"invisibleOcclusionRange"},{name:"orthoSize"},{name:"saturation"}]),st(GB.prototype,"SpotLight.prototype",[{name:"aspect"}]),rt(pB.prototype,"SubModel.prototype",[{name:"subMeshData",newName:"subMesh"}]),st(pB.prototype,"SubModel.prototype",[{name:"getSubModel",suggest:"Use `subModels[i]` instead"},{name:"subModelNum",suggest:"Use `subModels.length` instead"}]);var JG,$G,tH,eH=function(t){if(void 0===vG[t]){var e=1<10||(p=.5*(s+o),m=.5*(a+h),g=.5*((c=.5*(e+n))+(d=.5*(n+s))),v=.5*((_=.5*(i+r))+(f=.5*(r+a))),((b=hH((n-o)*(R=h-i)-(r-h)*(A=o-e)))+(C=hH((s-o)*R-(a-h)*A)))*(b+C)=2*nH)l=2*nH;else for(;l<0;)l+=2*nH;else if(hH(l)>=2*nH)l=2*-nH;else for(;l>0;)l-=2*nH;for(h=0|sH(1,rH(hH(l)/(.5*nH)+.5,5)),c=hH(4/3*(1-aH(o=l/h/2))/oH(o)),a||(c=-c),E=0;E<=h;E++)f=e+(_=aH(u=r+l*(E/h)))*n,p=i+(d=oH(u))*n,m=-d*n*c,g=_*n*c,0===E?t.moveTo(f,p):t.bezierCurveTo(v+T,y+S,f-m,p-g,f,p),v=f,y=p,T=m,S=g}(this,t,e,i,n,r,s)},e.ellipse=function(t,e,i,n){cH(this,t,e,i,n),this._curPath.complex=!1},e.circle=function(t,e,i){cH(this,t,e,i,i),this._curPath.complex=!1},e.rect=function(t,e,i,n){this.moveTo(t,e),this.lineTo(t+i,e),this.lineTo(t+i,e+n),this.lineTo(t,e+n),this.close(),this._curPath.complex=!1},e.roundRect=function(t,e,i,n,r){!function(t,e,i,n,r,s){if(s<.1)t.rect(e,i,n,r);else{var a=rH(s,.5*hH(n))*uH(n),o=rH(s,.5*hH(r))*uH(r);t.moveTo(e,i+o),t.lineTo(e,i+r-o),t.bezierCurveTo(e,i+r-o*(1-lH),e+a*(1-lH),i+r,e+a,i+r),t.lineTo(e+n-a,i+r),t.bezierCurveTo(e+n-a*(1-lH),i+r,e+n,i+r-o*(1-lH),e+n,i+r-o),t.lineTo(e+n,i+o),t.bezierCurveTo(e+n,i+o*(1-lH),e+n-a*(1-lH),i,e+n-a,i),t.lineTo(e+a,i),t.bezierCurveTo(e+a*(1-lH),i,e,i+o*(1-lH),e,i+o),t.close()}}(this,t,e,i,n,r),this._curPath.complex=!1},e.clear=function(){this.pathLength=0,this.pathOffset=0,this.pointsOffset=0,this.dataOffset=0,this._curPath=null,this.paths.length=0,this._points.length=0;for(var t=this._renderDataList,e=0,i=t.length;e0){for(var i=0;ii)for(var n=i;n=0&&s.y>=0&&s.x<=n&&s.y<=r;else if(this.type===fz.GRAPHICS_ELLIPSE){var h=n/2,u=r/2,l=s.x-.5*n,c=s.y-.5*r;o=l*l/(h*h)+c*c/(u*u)<1}return this._inverted&&(o=!o),o},i._nodeStateChange=function(){this._updateGraphics()},i._changeRenderType=function(){this._type!==fz.SPRITE_STENCIL?this._createGraphics():this._createSprite()},i._createSprite=function(){if(!this._sprite){var t=this._sprite=this.node.getComponent(dz);if(!t){var e=this.node;t=this._sprite=e.addComponent(dz)}}this._sprite.stencilStage=this.inverted?Rk.ENTER_LEVEL_INVERTED:Rk.ENTER_LEVEL,this._sprite.updateMaterial()},i._createGraphics=function(){if(!this._graphics){var t=this._graphics=this.node.getComponent(iz);if(!t){var e=this.node;t=this._graphics=e.addComponent(iz)}t.lineWidth=1;var i=pn.WHITE.clone();i.a=0,t.fillColor=i}this._graphics.stencilStage=this.inverted?Rk.ENTER_LEVEL_INVERTED:Rk.ENTER_LEVEL},i._updateGraphics=function(){if(this._graphics&&(this._type===fz.GRAPHICS_RECT||this._type===fz.GRAPHICS_ELLIPSE)){var t=this.node._uiProps.uiTransformComp,e=this._graphics;e.clear();var i=t.contentSize,n=i.width,r=i.height,s=t.anchorPoint,a=-n*s.x,o=-r*s.y;if(this._type===fz.GRAPHICS_RECT)e.rect(a,o,n,r);else if(this._type===fz.GRAPHICS_ELLIPSE){for(var h=function(t,e,i){vz.length=0;for(var n=2*Math.PI/i,r=0;r"]),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",e),r=-1;if(n>=0&&(r=t.lastIndexOf("<",n))",r+1)),r<0)this._stack.pop(),this._processResult(t.substring(e)),e=i;else{var s=t.substring(e,r),a=t.substring(r+1,n);""===a&&(s=t.substring(e,n+1)),this._processResult(s),-1===n?n=r:"/"===t.charAt(r+1)?this._stack.pop():this._addToStack(a),e=n+1}}return this._resultObjectArray},e._attributeToObject=function(t){t=t.trim();var e={},i=/^(color|size)(\s)*=/.exec(t),n="",r=0,s="";if(i){if(n=i[0],""===(t=t.substring(n.length).trim()))return e;switch(r=t.indexOf(" "),n[0]){case"c":e.color=r>-1?t.substring(0,r).trim():t;break;case"s":e.size=parseInt(t)}return r>-1&&(s=t.substring(r+1).trim(),e.event=this._processEventHandler(s)),e}if((i=/^(br(\s)*\/)/.exec(t))&&i[0].length>0&&(n=i[0].trim()).startsWith("br")&&"/"===n[n.length-1])return e.isNewLine=!0,this._resultObjectArray.push({text:"",style:{isNewLine:!0}}),e;var a="",o=-1;if((i=/^(img(\s)*src(\s)*=[^>]+\/)/.exec(t))&&i[0].length>0&&(n=i[0].trim()).startsWith("img")&&"/"===n[n.length-1]){var h;i=xz.exec(t);for(var u=!1;i;){var l=(n=(t=t.substring(t.indexOf(i[0]))).substr(0,i[0].length)).length;if(n=(n=n.replace(/[^a-zA-Z]/g,"").trim()).toLowerCase(),a=t.substring(l).trim(),o="src"===n?this.getRightQuotationIndex(a):-1,h=(r=a.indexOf(" ",o+1>=a.length?-1:o+1))>-1?a.substr(0,r):a,t=a.substring(r).trim(),h.endsWith("/")&&(h=h.slice(0,-1)),"src"===n){switch(h.charCodeAt(0)){case 34:case 39:u=!0,h=h.slice(1,-1)}e.isImage=!0,e.src=h}else if("height"===n)e.imageHeight=parseInt(h);else if("width"===n)e.imageWidth=parseInt(h);else if("align"===n){switch(h.charCodeAt(0)){case 34:case 39:h=h.slice(1,-1)}e.imageAlign=h.toLowerCase()}else"offset"===n?e.imageOffset=h:"click"===n&&(e.event=this._processEventHandler(n+"="+h));e.event&&"param"===n&&(e.event[n]=h.replace(/^"|"$/g,"")),i=xz.exec(t)}return u&&e.isImage&&this._resultObjectArray.push({text:"",style:e}),{}}if(i=/^(outline(\s)*[^>]*)/.exec(t)){var c={color:"#ffffff",width:1};if(t=i[0].substring("outline".length).trim()){var _,d=/(\s)*color(\s)*=|(\s)*width(\s)*=|(\s)*click(\s)*=|(\s)*param(\s)*=/;for(i=d.exec(t);i;)n=(t=t.substring(t.indexOf(i[0]))).substr(0,i[0].length),_=(r=(a=t.substring(n.length).trim()).indexOf(" "))>-1?a.substr(0,r):a,n=(n=n.replace(/[^a-zA-Z]/g,"").trim()).toLowerCase(),t=a.substring(r).trim(),"click"===n?e.event=this._processEventHandler(n+"="+_):"color"===n?c.color=_:"width"===n&&(c.width=parseInt(_)),e.event&&"param"===n&&(e.event[n]=_.replace(/^"|"$/g,"")),i=d.exec(t)}e.outline=c}if((i=/^(on|u|b|i)(\s)*/.exec(t))&&i[0].length>0){switch(n=i[0],t=t.substring(n.length).trim(),n[0]){case"u":e.underline=!0;break;case"i":e.italic=!0;break;case"b":e.bold=!0}if(""===t)return e;e.event=this._processEventHandler(t)}return e},e.getRightQuotationIndex=function(t){var e=-1,i=-1,n=t.indexOf("'"),r=t.indexOf('"'),s=r>-1&&(r-1&&(n=t.length?-1:e+1)):s&&(e=r,i=t.indexOf('"',e+1>=t.length?-1:e+1)),i},e._processEventHandler=function(t){for(var e={},i=0,n=!1,r=wz.exec(t);r;){var s=r[0],a="";if(n=!1,'"'===(t=t.substring(s.length).trim()).charAt(0))(i=t.indexOf('"',1))>-1&&(a=t.substring(1,i).trim(),n=!0),i++;else if("'"===t.charAt(0))(i=t.indexOf("'",1))>-1&&(a=t.substring(1,i).trim(),n=!0),i++;else{var o=/(\S)+/.exec(t);i=(a=o?o[0]:"").length}n&&(e[s=s.substring(0,s.length-1).trim()]=a),t=t.substring(i).trim(),r=wz.exec(t)}return e},e._addToStack=function(t){var e=this._attributeToObject(t);if(0===this._stack.length)this._stack.push(e);else{if(e.isNewLine||e.isImage)return;var i=this._stack[this._stack.length-1];for(var n in i)e[n]||(e[n]=i[n]);this._stack.push(e)}},e._processResult=function(t){0!==t.length&&(t=this._escapeSpecialSymbol(t),this._stack.length>0?this._resultObjectArray.push({text:t,style:this._stack[this._stack.length-1]}):this._resultObjectArray.push({text:t}))},e._escapeSpecialSymbol=function(t){for(var e,i=d(this._specialSymbolArray);!(e=i()).done;){var n=e.value,r=n[0],s=n[1];t=t.replace(r,s)}return t},t}()),Oz=t("k",qs("cc.LabelOutline")(Tz=Zs(110)(Tz=Qs(fG)(Tz=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.onEnable=function(){this.node.getComponent(fG).enableOutline=!0},i.onDisable=function(){this.node.getComponent(fG).enableOutline=!1},n(e,[{key:"color",get:function(){return this.node.getComponent(fG).outlineColor},set:function(t){this.node.getComponent(fG).outlineColor=t}},{key:"width",get:function(){return this.node.getComponent(fG).outlineWidth},set:function(t){this.node.getComponent(fG).outlineWidth=t}}]),e}(op))||Tz)||Tz)||Tz);v.LabelOutline=Oz,mt({RenderComponent:{newName:"UIRenderer",since:"1.2.0",removed:!0},UITransformComponent:{newName:"UITransform",since:"1.2.0",removed:!1},CanvasComponent:{newName:"Canvas",since:"1.2.0",removed:!1}}),mt({UIRenderable:{newName:"UIRenderer",since:"3.0.0",removed:!0}}),mt({Renderable2D:{newName:"UIRenderer",since:"3.6.0",removed:!1}});var Dz,Mz,Pz,Bz,Nz,Lz,Fz,kz,Uz,Gz,Hz,zz,Vz,Wz,Xz,jz,Yz,Kz,qz,Qz,Zz,Jz,$z,tV,eV,iV,nV,rV,sV,aV,oV,hV,uV,lV,cV,_V,dV=qs("cc.PostProcess")(Sz=Js(((Cz=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r0&&e>0){this._updateResolutionPolicy(i);var n=this._resolutionPolicy;n&&n.preApply(this),this._designResolutionSize.width=t,this._designResolutionSize.height=e;var r=n.apply(this,this._designResolutionSize);if(r.scale&&2===r.scale.length&&(this._scaleX=r.scale[0],this._scaleY=r.scale[1]),r.viewport){var s=this._viewportRect,a=this._visibleRect,o=r.viewport;s.x=o.x,s.y=o.y,s.width=o.width,s.height=o.height,a.x=0,a.y=0,a.width=o.width/this._scaleX,a.height=o.height/this._scaleY}n.postApply(this),EV.width=this._visibleRect.width,EV.height=this._visibleRect.height,Dl&&Dl.init(this._visibleRect),this.emit("design-resolution-changed")}else Z(2200)},i.getDesignResolutionSize=function(){return new Hn(this._designResolutionSize.width,this._designResolutionSize.height)},i.setRealPixelResolution=function(t,e,i){document.documentElement.style.width=t+"px",document.body.style.width=t+"px",document.body.style.left="0px",document.body.style.top="0px",this.setDesignResolutionSize(t,e,i)},i.getViewportRect=function(){return this._viewportRect},i.getScaleX=function(){return this._scaleX},i.getScaleY=function(){return this._scaleY},i.getDevicePixelRatio=function(){return wl.devicePixelRatio},i.convertToLocationInView=function(t,e,i,n){void 0===n&&(n=new Fn);var r=wl.devicePixelRatio*(t-i.left),s=wl.devicePixelRatio*(i.top+i.height-e);return wl.isFrameRotated?(n.x=Il.windowSize.width-s,n.y=r):(n.x=r,n.y=s),n},i._convertToUISpace=function(t){var e=this._viewportRect;t.x=(t.x-e.x)/this._scaleX,t.y=(t.y-e.y)/this._scaleY},i._updateAdaptResult=function(t,e,i){var n;v.director.root.resize(t,e,void 0===i||0===i?1:i);var r=this._designResolutionSize.width,s=this._designResolutionSize.height;t>0&&this.setDesignResolutionSize(r,s,this._resolutionPolicy),this.emit("canvas-resize"),null===(n=this._resizeCallback)||void 0===n||n.call(this)},e}(Zu(Lu)));RV.instance=void 0;var bV=function(){function t(){this.name="ContainerStrategy"}var e=t.prototype;return e.preApply=function(){},e.apply=function(){},e.postApply=function(){},e._setupCanvas=function(){var t=v.game.canvas;if(t){var e=Il.windowSize;t.width!==e.width&&(t.width=e.width),t.height!==e.height&&(t.height=e.height)}},t}();bV.EQUAL_TO_FRAME=void 0,bV.PROPORTION_TO_FRAME=void 0;var CV=function(){function t(){this.name="ContentStrategy",this._result=void 0,this._result={scale:[1,1],viewport:null}}var e=t.prototype;return e.preApply=function(){},e.apply=function(){return{scale:[1,1]}},e.postApply=function(){},e._buildResult=function(t,e,i,n,r,s){Math.abs(t-i)<2&&(i=t),Math.abs(e-n)<2&&(n=e);var a=new Vn(Math.round((t-i)/2),Math.round((e-n)/2),i,n);return this._result.scale=[r,s],this._result.viewport=a,this._result},t}();CV.EXACT_FIT=void 0,CV.SHOW_ALL=void 0,CV.NO_BORDER=void 0,CV.FIXED_HEIGHT=void 0,CV.FIXED_WIDTH=void 0,function(){var t=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;rp?0:f>0?f:p}v.Canvas=zV,st(t("U",qs("cc.UIComponent")(kV=Qs(oU)(kV=Zs(110)(kV=Js(kV=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;re||0===jV)&&(jV=e,s&&(0===s.length?s.push({distance:e,vertexIndex0:i/3,vertexIndex1:n/3,vertexIndex2:r/3}):(s[0].distance=e,s[0].vertexIndex0=i/3,s[0].vertexIndex1=n/3,s[0].vertexIndex2=r/3))):(jV=e,s&&s.push({distance:e,vertexIndex0:i/3,vertexIndex1:n/3,vertexIndex2:r/3}))},function(t,e,i){if(jV=0,0===e.geometricInfo.positions.length)return jV;var n=void 0===i?XV:i;if(VV(t,e.geometricInfo.boundingBox.min,e.geometricInfo.boundingBox.max)){var r=e.primitiveMode,s=e.geometricInfo;!function(t,e,i,n,r){if(i===vc.TRIANGLE_LIST)for(var s=e.length,a=0;ar.distance)&&(YV(r.mode,l,o,h,u,r.result),r.mode===du.ANY))return l}else if(i===vc.TRIANGLE_STRIP)for(var c=e.length-2,_=0,d=0;dr.distance)&&(YV(r.mode,g,f,p,m,r.result),r.mode===du.ANY))return g}else if(i===vc.TRIANGLE_FAN){var v=e.length-1,y=3*e[0];hn.set(WV.a,t[y],t[y+1],t[y+2]);for(var T=1;Tr.distance)&&(YV(r.mode,A,y,S,E,r.result),r.mode===du.ANY))return A}}}(s.positions,s.indices,r,t,n)}return jV}),JV=function(){var t=0,e={distance:1/0,doubleSided:!1,mode:du.ANY};return function(i,n,r){t=0;var s=void 0===r?e:r,a=n.renderingSubMeshes.length,o=n.struct.minPosition,h=n.struct.maxPosition;if(o&&h&&!VV(i,o,h))return t;for(var u=0;uc)&&(t=c,s.subIndices&&(s.subIndices[0]=u));else if(t=c,s.subIndices&&s.subIndices.push(u),s.mode===du.ANY)return c}return t&&s.mode===du.CLOSEST&&(s.result&&(s.result[0].distance=t,s.result.length=1),s.subIndices&&(s.subIndices.length=1)),t}}(),$V=function(){var t=0,e={distance:1/0,doubleSided:!1,mode:du.ANY},i=new hr,n=new Dn;return function(r,s,a){t=0;var o=void 0===a?e:a,h=s.worldBounds;if(h&&!us.rayAABB(r,h))return t;hr.copy(i,r),s.node&&(Dn.invert(n,s.node.getWorldMatrix(n)),hn.transformMat4(i.o,r.o,n),hn.transformMat4Normal(i.d,r.d,n));for(var u=s.subModels,l=0;l_)&&(t=_,o.subIndices&&(o.subIndices[0]=l));else if(t=_,o.subIndices&&o.subIndices.push(l),o.mode===du.ANY)return _}return t&&o.mode===du.CLOSEST&&(o.result&&(o.result[0].distance=t,o.result.length=1),o.subIndices&&(o.subIndices.length=1)),t}}();us.rayModel=$V,us.raySubMesh=ZV,us.rayMesh=JV,oS("specular-pass");var tW,eW,iW,nW,rW,sW,aW,oW,hW,uW,lW,cW,_W,dW,fW,pW,mW,gW=t("dY",qs("cc.ModelRenderer")((qV=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r0)for(var t=0;tc;){if((s/=2)<1){s*=2;break}a=a.substring(r,s),o=n.substring(s),this._calculateSize(h,e,a)}for(var _=1e3,d=1;_&&r0&&(d=f[0].length),s+=d,a=n.substring(r,s),o=n.substring(s),this._calculateSize(h,e,a),_--}for(;_&&a.length>=2&&h.x>c;)s-=d,a=n.substring(r,s),this._calculateSize(h,e,a),d=1,_--;if(a.length>=2){var p=ek(a);p&&p.length>0&&a!==p[0]&&(s-=p[0].length,a=n.substring(r,s))}if(i.push(a),r=s,s+=a.length,a=n.substring(r,s),o=n.substring(s),this._calculateSize(u,e,o),this._calculateSize(h,e,a),_--,u.x<2048&&h.x=0;e--){var i=t[e];if(i.name===jW||i.name===YW){i.parent=null;var n=JW(i.name);n.node=i,i.name===jW?(n.comp=i.getComponent(fG),QW.put(n)):(n.comp=i.getComponent(dz),ZW.put(n)),this._labelChildrenNum--}}this._segments.length=0,this._labelSegmentsCache.length=0,this._linesWidth.length=0,this._lineOffsetX=0,this._lineCount=1,this._labelWidth=0,this._labelHeight=0,this._layoutDirty=!0},i._activateChildren=function(t){for(var e=this.node.children.length-1;e>=0;e--){var i=this.node.children[e];i.name!==jW&&i.name!==YW||(i.active=t)}},i._addLabelSegment=function(t,e){var i;if(0===this._labelSegmentsCache.length)i=this._createFontLabel(t);else{var n=(i=this._labelSegmentsCache.pop()).node.getComponent(fG);n&&(n.string=t)}var r=i.comp;return r.verticalAlign!==this._verticalAlign&&(r.verticalAlign=this._verticalAlign),i.styleIndex=e,i.lineCount=this._lineCount,i.node._uiProps.uiTransformComp.setAnchorPoint(0,0),i.node.layer=this.node.layer,this.node.insertChild(i.node,this._labelChildrenNum++),this._applyTextAttribute(i),this._segments.push(i),i},i._updateRichTextWithMaxWidth=function(t,e,i){var n=e;if(this._lineOffsetX>0&&n+this._lineOffsetX>this._maxWidth)for(var r=0;this._lineOffsetX<=this._maxWidth;){var s=this._getFirstWordLen(t,r,t.length),a=t.substr(r,s),o=this._measureText(i,a);if(!(this._lineOffsetX+o<=this._maxWidth)){if(r>0){var h=t.substr(0,r);this._addLabelSegment(h,i),t=t.substr(r,t.length),n=this._measureText(i,t)}this._updateLineInfo();break}this._lineOffsetX+=o,r+=s}if(n>this._maxWidth)for(var u=ik(t,n,this._maxWidth,this._measureText(i)),l=0;l1&&l0?(o*=a=l/h,h*=a):(o*=a=this._lineHeight/h,h*=a),u>0&&(o=u),this._maxWidth>0?(this._lineOffsetX+o>this._maxWidth&&this._updateLineInfo(),this._lineOffsetX+=o):(this._lineOffsetX+=o,this._lineOffsetX>this._labelWidth&&(this._labelWidth=this._lineOffsetX)),r.node._uiProps.uiTransformComp.setContentSize(o,h),r.lineCount=this._lineCount,r.clickHandler="",r.clickParam="";var c=e.event;c&&(r.clickHandler=c.click,r.clickParam=c.param)}else q(4400)}},i._updateTextDefaultColor=function(){for(var t=0;t0){var u=this._measureText(n,h);this._updateRichTextWithMaxWidth(h,u,n),a.length>1&&othis._labelWidth&&(this._labelWidth=this._lineOffsetX),a.length>1&&o0&&(this._labelWidth=this._maxWidth),this._labelHeight=(this._lineCount+GF)*this._lineHeight,this.node._uiProps.uiTransformComp.setContentSize(this._labelWidth,this._labelHeight),this._updateRichTextPosition(),this._layoutDirty=!1}},i._getFirstWordLen=function(t,e,i){var n=t.charAt(e);if(QF(n)||ZF(n))return 1;for(var r=1,s=e+1;se&&(t=0,e=h);var u=this._labelWidth*(.5*this._horizontalAlign-r);switch(this._horizontalAlign){case aG.LEFT:break;case aG.CENTER:u-=this._linesWidth[h-1]/2;break;case aG.RIGHT:u-=this._linesWidth[h-1]}var l=o.node.position;if(o.node.setPosition(t+u,this._lineHeight*(i-h)-this._labelHeight*s,l.z),h===e&&(t+=o.node._uiProps.uiTransformComp.width),o.node.getComponent(dz)){var c=o.node.position.clone(),_=this._lineHeight,d=this._lineHeight*(1+GF);switch(o.node._uiProps.uiTransformComp.anchorY){case 1:c.y+=_+(d-_)/2;break;case.5:c.y+=d/2;break;default:c.y+=(d-_)/2}if(o.imageOffset){var f=o.imageOffset.split(",");if(1===f.length&&f[0]){var p=parseFloat(f[0]);Number.isInteger(p)&&(c.y+=p)}else if(2===f.length){var m=parseFloat(f[0]),g=parseFloat(f[1]);Number.isInteger(m)&&(c.x+=m),Number.isInteger(g)&&(c.y+=g)}}o.node.position=c}var v=o.node.getComponent(Oz);if(v){var y=o.node.position.clone();y.y-=v.width,o.node.position=y}}},i._convertLiteralColorValue=function(t){var e=t.toUpperCase();return pn[e]?pn[e]:(new pn).fromHEX(t)},i._applyTextAttribute=function(t){var e=t.node.getComponent(fG);if(e){this._resetLabelState(e);var i,n=t.styleIndex;if(this._textArray[n]&&(i=this._textArray[n].style),i){if(i.color?e.color=this._convertLiteralColorValue(i.color):e.color=this._fontColor,e.isBold=!!i.bold,e.isItalic=!!i.italic,e.isUnderline=!!i.underline,i.outline){var r=t.node.getComponent(Oz);r||(r=t.node.addComponent(Oz)),r.color=this._convertLiteralColorValue(i.outline.color),r.width=i.outline.width}e.fontSize=i.size||this._fontSize,t.clickHandler="",t.clickParam="";var s=i.event;s&&(t.clickHandler=s.click||"",t.clickParam=s.param||"")}e.cacheMode=this._cacheMode,this._font instanceof bF&&!this._isSystemFontUsed?e.font=this._font:e.fontFamily=this._fontFamily,e.useSystemFont=this._isSystemFontUsed,e.lineHeight=this._lineHeight,e.updateRenderData(!0)}},i._applyLayer=function(){for(var t,e=d(this._segments);!(t=e()).done;)t.value.node.layer=this.node.layer},i._resetLabelState=function(t){t.fontSize=this._fontSize,t.color=this._fontColor,t.isBold=!1,t.isItalic=!1,t.isUnderline=!1},n(e,[{key:"string",get:function(){return this._string},set:function(t){this._string!==t&&(this._string=t,this._updateRichTextStatus())}},{key:"horizontalAlign",get:function(){return this._horizontalAlign},set:function(t){this.horizontalAlign!==t&&(this._horizontalAlign=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"verticalAlign",get:function(){return this._verticalAlign},set:function(t){this._verticalAlign!==t&&(this._verticalAlign=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"fontSize",get:function(){return this._fontSize},set:function(t){this._fontSize!==t&&(this._fontSize=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"fontColor",get:function(){return this._fontColor},set:function(t){this._fontColor!==t&&(this._fontColor=t,this._updateTextDefaultColor())}},{key:"fontFamily",get:function(){return this._fontFamily},set:function(t){this._fontFamily!==t&&(this._fontFamily=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"font",get:function(){return this._font},set:function(t){this._font!==t&&(this._font=t,this._layoutDirty=!0,this._font?(this.useSystemFont=!1,this._onTTFLoaded()):this.useSystemFont=!0,this._updateRichTextStatus())}},{key:"useSystemFont",get:function(){return this._isSystemFontUsed},set:function(t){this._isSystemFontUsed!==t&&(this._isSystemFontUsed=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"cacheMode",get:function(){return this._cacheMode},set:function(t){this._cacheMode!==t&&(this._cacheMode=t,this._updateRichTextStatus())}},{key:"maxWidth",get:function(){return this._maxWidth},set:function(t){this._maxWidth!==t&&(this._maxWidth=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"lineHeight",get:function(){return this._lineHeight},set:function(t){this._lineHeight!==t&&(this._lineHeight=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"imageAtlas",get:function(){return this._imageAtlas},set:function(t){this._imageAtlas!==t&&(this._imageAtlas=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"handleTouchEvent",get:function(){return this._handleTouchEvent},set:function(t){this._handleTouchEvent!==t&&(this._handleTouchEvent=t,this.enabledInHierarchy&&(this.handleTouchEvent?this._addEventListeners():this._removeEventListeners()))}}]),e}(op)).HorizontalAlign=aG,WW.VerticalAlign=oG,f((IW=WW).prototype,"horizontalAlign",[EW],Object.getOwnPropertyDescriptor(IW.prototype,"horizontalAlign"),IW.prototype),f(IW.prototype,"verticalAlign",[AW],Object.getOwnPropertyDescriptor(IW.prototype,"verticalAlign"),IW.prototype),f(IW.prototype,"fontColor",[RW],Object.getOwnPropertyDescriptor(IW.prototype,"fontColor"),IW.prototype),f(IW.prototype,"font",[bW],Object.getOwnPropertyDescriptor(IW.prototype,"font"),IW.prototype),f(IW.prototype,"cacheMode",[CW],Object.getOwnPropertyDescriptor(IW.prototype,"cacheMode"),IW.prototype),f(IW.prototype,"imageAtlas",[wW],Object.getOwnPropertyDescriptor(IW.prototype,"imageAtlas"),IW.prototype),OW=Gs(IW.prototype,"_lineHeight",[ra],(function(){return 40})),DW=Gs(IW.prototype,"_string",[ra],(function(){return"RichText"})),MW=Gs(IW.prototype,"_horizontalAlign",[ra],(function(){return aG.LEFT})),PW=Gs(IW.prototype,"_verticalAlign",[ra],(function(){return oG.TOP})),BW=Gs(IW.prototype,"_fontSize",[ra],(function(){return 40})),NW=Gs(IW.prototype,"_fontColor",[ra],(function(){return pn.WHITE.clone()})),LW=Gs(IW.prototype,"_maxWidth",[ra],(function(){return 0})),FW=Gs(IW.prototype,"_fontFamily",[ra],(function(){return"Arial"})),kW=Gs(IW.prototype,"_font",[ra],(function(){return null})),UW=Gs(IW.prototype,"_isSystemFontUsed",[ra],(function(){return!0})),GW=Gs(IW.prototype,"_userDefinedFont",[ra],(function(){return null})),HW=Gs(IW.prototype,"_cacheMode",[ra],(function(){return uG.NONE})),zW=Gs(IW.prototype,"_imageAtlas",[ra],(function(){return null})),VW=Gs(IW.prototype,"_handleTouchEvent",[ra],(function(){return!0})),xW=IW))||xW)||xW));v.RichText=eX;var iX=t("j",qs("cc.UIMeshRenderer")(tX=Zs(110)(tX=function(t){function e(){var e;return(e=t.call(this)||this)._modelComponent=null,e._dirtyVersion=-1,e._internalId=-1,e.stencilStage=Rk.DISABLED,e._renderData=null,e._renderEntity=new Kk(Dk.DYNAMIC),e}s(e,t);var i=e.prototype;return i.__preload=function(){this.node._uiProps.uiComp=this},i.onEnable=function(){aL.addRenderer(this),this.markForUpdateRenderData()},i.onDisable=function(){aL.removeRenderer(this),this.renderEntity.enabled=this._canRender()},i.onLoad=function(){this.node._uiProps.uiTransformComp||this.node.addComponent("cc.UITransform"),this._modelComponent=this.getComponent("cc.ModelRenderer"),this._modelComponent?this.renderEntity.setNode(this.node):U("node '"+(this.node&&this.node.name)+"' doesn't have any renderable component")},i.onDestroy=function(){this.renderEntity.setNode(null),this.node._uiProps.uiComp===this&&(this.node._uiProps.uiComp=null),this._modelComponent=this.getComponent("cc.ModelRenderer"),this._modelComponent&&(this._modelComponent._sceneGetter=null)},i._render=function(t){if(this._modelComponent){var e=this._modelComponent._collectModels();this._modelComponent._detachFromScene();for(var i=0;i0)for(s=e;s=e;s-=n)a=PX(s,t[s],t[s+1],a);return a&&IX(a,a.next)&&(BX(a),a=a.next),a}function mX(t,e){if(void 0===e&&(e=null),!t)return t;e||(e=t);var i=t,n=!1;do{if(n=!1,i.steiner||!IX(i,i.next)&&0!==xX(i.prev,i,i.next))i=i.next;else{if(BX(i),(i=e=i.prev)===i.next)return null;n=!0}}while(n||i!==e);return e}function gX(t,e,i,n,r,s,a){if(void 0===a&&(a=0),t){!a&&s&&function(t,e,i,n){var r=t;do{null===r.z&&(r.z=RX(r.x,r.y,e,i,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){var e=0,i=null,n=null,r=null,s=null,a=0,o=0,h=0,u=1;do{for(i=t,t=null,s=null,a=0;i;){for(a++,n=i,o=0,e=0;e0||h>0&&n;)0===o?(r=n,n=n.nextZ,h--):0!==h&&n?i.z<=n.z?(r=i,i=i.nextZ,o--):(r=n,n=n.nextZ,h--):(r=i,i=i.nextZ,o--),s?s.nextZ=r:t=r,r.prevZ=s,s=r;i=n}s.nextZ=null,u*=2}while(a>1)}(r)}(t,n,r,s);for(var o=t,h=null,u=null;t.prev!==t.next;)if(h=t.prev,u=t.next,s?yX(t,n,r,s):vX(t))e.push(h.i/i),e.push(t.i/i),e.push(u.i/i),BX(t),t=u.next,o=u.next;else if((t=u)===o){a?1===a?gX(t=TX(t,e,i),e,i,n,r,s,2):2===a&&SX(t,e,i,n,r,s):gX(mX(t),e,i,n,r,s,1);break}}}function vX(t){var e=t.prev,i=t,n=t.next;if(xX(e,i,n)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(CX(e.x,e.y,i.x,i.y,n.x,n.y,r.x,r.y)&&xX(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function yX(t,e,i,n){var r=t.prev,s=t,a=t.next;if(xX(r,s,a)>=0)return!1;for(var o=r.xs.x?r.x>a.x?r.x:a.x:s.x>a.x?s.x:a.x,l=r.y>s.y?r.y>a.y?r.y:a.y:s.y>a.y?s.y:a.y,c=RX(o,h,e,i,n),_=RX(u,l,e,i,n),d=t.nextZ;d&&d.z<=_;){if(d!==t.prev&&d!==t.next&&CX(r.x,r.y,s.x,s.y,a.x,a.y,d.x,d.y)&&xX(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(d=t.prevZ;d&&d.z>=c;){if(d!==t.prev&&d!==t.next&&CX(r.x,r.y,s.x,s.y,a.x,a.y,d.x,d.y)&&xX(d.prev,d,d.next)>=0)return!1;d=d.prevZ}return!0}function TX(t,e,i){var n=t;do{var r=n.prev,s=n.next.next;!IX(r,s)&&OX(r,n,n.next,s)&&DX(r,s)&&DX(s,r)&&(e.push(r.i/i),e.push(n.i/i),e.push(s.i/i),BX(n),BX(n.next),n=t=s),n=n.next}while(n!==t);return n}function SX(t,e,i,n,r,s){var a=t;do{for(var o=a.next.next;o!==a.prev;){if(a.i!==o.i&&wX(a,o)){var h=MX(a,o);return a=mX(a,a.next),h=mX(h,h.next),gX(a,e,i,n,r,s),void gX(h,e,i,n,r,s)}o=o.next}a=a.next}while(a!==t)}function EX(t,e){return t.x-e.x}function AX(t,e){if(e=function(t,e){var i=e,n=t.x,r=t.y,s=-1/0,a=null;do{if(r<=i.y&&r>=i.next.y){var o=i.x+(r-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(o<=n&&o>s){if(s=o,o===n){if(r===i.y)return i;if(r===i.next.y)return i.next}a=i.x=i.x&&i.x>=l&&CX(ra.x)&&DX(i,t)&&(a=i,_=h),i=i.next;return a}(t,e)){var i=MX(e,t);mX(i,i.next)}}function RX(t,e,i,n,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)/r)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)/r)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function bX(t){var e=t,i=t;do{e.x=0&&(t-a)*(n-o)-(i-a)*(e-o)>=0&&(i-a)*(s-o)-(r-a)*(n-o)>=0}function wX(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&OX(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&DX(t,e)&&DX(e,t)&&function(t,e){var i=t,n=!1,r=(t.x+e.x)/2,s=(t.y+e.y)/2;do{i.y>s!=i.next.y>s&&r<(i.next.x-i.x)*(s-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n}(t,e)}function xX(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function IX(t,e){return t.x===e.x&&t.y===e.y}function OX(t,e,i,n){return!!(IX(t,e)&&IX(i,n)||IX(t,n)&&IX(i,e))||xX(t,e,i)>0!=xX(t,e,n)>0&&xX(i,n,t)>0!=xX(i,n,e)>0}function DX(t,e){return xX(t.prev,t,t.next)<0?xX(t,e,t.next)>=0&&xX(t,t.prev,e)>=0:xX(t,e,t.prev)<0||xX(t,t.next,e)<0}function MX(t,e){var i=new fX(t.i,t.x,t.y),n=new fX(e.i,e.x,e.y),r=t.next,s=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,n.next=i,i.prev=n,s.next=n,n.prev=s,n}function PX(t,e,i,n){var r=new fX(t,e,i);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function BX(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function NX(t,e,i){i=i||3;var n=e?e.length:0,r=n?e[0]*i:t.length,s=pX(t,0,r,i,!0),a=[];if(!s)return a;var o=0,h=0,u=0,l=0,c=0,_=0,d=0;if(n&&(s=function(t,e,i,n){var r,s=[],a=0,o=null;for(a=0,r=e.length;a80*i){o=u=t[0],h=l=t[1];for(var f=i;fu&&(u=c),_>l&&(l=_);d=Math.max(u-o,l-h)}return gX(s,a,i,o,h,d),a}for(var LX=Math.PI,FX=Math.min,kX=Math.max,UX=Math.ceil,GX=Math.acos,HX=Math.cos,zX=Math.sin,VX=Math.atan2,WX=null,XX=null,jX=new pn,YX=[],KX=0;KX<4;KX++)YX.push(new hn);function qX(t,e,i){return ti?i:t}var QX={useModel:!0,updateRenderData:function(){},fillBuffers:function(){},renderIA:function(){},getRenderData:function(t,e){if(!XX)return null;var i=XX.getRenderDataList(),n=i[XX.dataOffset];if(!n)return null;var r=n,s=r?r.vertexStart+e:0;return(s>65535||3*s>131070)&&(++XX.dataOffset,XX.dataOffset0&&(r=1/e);for(var s=t.paths,a=t.pathOffset,o=t.pathLength;a1e-6){var T=1/f;T>600&&(T=600),_.dmx*=T,_.dmy*=T}_.dx*c.dy-c.dx*_.dy>0&&(_.flags|=tH.PT_LEFT),f*(p=kX(11,FX(c.len,_.len)*r))*p<1&&(_.flags|=tH.PT_INNERBEVEL),_.flags&tH.PT_CORNER&&(f*n*n<1||i===$G.BEVEL||i===$G.ROUND)&&(_.flags|=tH.PT_BEVEL),0!=(_.flags&(tH.PT_BEVEL|tH.PT_INNERBEVEL))&&h.bevel++,c=_,_=u[d+1]}}},_flattenPaths:function(t){for(var e=t.paths,i=t.pathOffset,n=t.pathLength;i2&&a.equals(o)&&(r.closed=!0,s.pop(),a=s[s.length-1]);for(var h=0,u=s.length;hm&&(g-=2*LX),this._vSet(_,d,1),this._vSet(u-s*n,e.y-a*n,-1);for(var v=qX(UX((m-g)/LX)*r,2,r),y=0;y$X||n.canvasSize.height>$X)&&a<=3;){if(++a>3)this._fontScale=1;else{var o=Math.max(n.canvasSize.width,n.canvasSize.height),h=$X/o;this._fontScale*=h,this._fontScale=Math.max(1,this._fontScale)}this._updatePaddingRect(e,n),this._calculateLabelFont(e,i,n,r)}}s&&(s=n.parsedString)},e.generateRenderInfo=function(t,e,i,n,r,s,a){t?(this._computeAlignmentOffset(e,i,n),this.generateVertexData(t,e,i,n,r,s,a)):(this._updateLabelDimensions(e,i,n),this._updateTexture(e,i,n,r),this.generateVertexData(t,e,i,n,r,s,a))},e.setCanvasUsed=function(t,e){this._canvas=t,this._context=e},e._getStyleFontScale=function(t,e){var i=e;return i*t>this._maxFontSize&&tu?o:u}var l=o,c=(s.length+GF)*this._getLineHeight(e.lineHeight,t.actualFontSize,t.fontSize);i.canvasSize.width=l+i.canvasPadding.width*this._fontScale,i.canvasSize.height=c+i.canvasPadding.height*this._fontScale,i.nodeContentSize.width=(l+i.contentSizeExtend.width*this._fontScale)/this._fontScale,i.nodeContentSize.height=(c+i.contentSizeExtend.height*this._fontScale)/this._fontScale;break;case hG.SHRINK:this._calculateShrinkFont(r,t,e,i),this._calculateWrapText(r,t,e,i),i.canvasSize.width=i.nodeContentSize.width*this._fontScale,i.canvasSize.height=i.nodeContentSize.height*this._fontScale;break;case hG.CLAMP:this._calculateWrapText(r,t,e,i),i.canvasSize.width=i.nodeContentSize.width*this._fontScale,i.canvasSize.height=i.nodeContentSize.height*this._fontScale;break;case hG.RESIZE_HEIGHT:this._calculateWrapText(r,t,e,i);var _=(i.parsedString.length+GF)*this._getLineHeight(e.lineHeight,t.actualFontSize,t.fontSize);i.canvasSize.width=i.nodeContentSize.width*this._fontScale,i.canvasSize.height=_+i.canvasPadding.height*this._fontScale,i.nodeContentSize.height=(_+i.contentSizeExtend.height*this._fontScale)/this._fontScale}}},e._getFontDesc=function(t,e,i,n){var r=t.toString()+"px ";return r+=e,i&&(r="bold "+r),n&&(r="italic "+r),r},e._getLineHeight=function(t,e,i){return 0===t?e:t*e/i},e._calculateShrinkFont=function(t,e,i,n){if(this._context){var r=this._getFontDesc(e.actualFontSize,e.fontFamily,e.isBold,e.isItalic);this._context.font=r;var s=this._calculateParagraphLength(t,this._context,r),a=0,o=0,h=0,u=e.actualFontSize;if(i.wrapping){var l=n.nodeContentSize.width*this._fontScale,c=n.nodeContentSize.height*this._fontScale;if(l<0||c<0)return;o=c+1;for(var _=0,d=0|e.actualFontSize+1,f=0;_>1)<=0){Y(4003);break}u=f,r=this._getFontDesc(u,e.fontFamily,e.isBold,e.isItalic),this._context.font=r;var p=this._getLineHeight(i.lineHeight,u,e.fontSize);for(o=0,a=0;ac?d=f-1:_=f}0===_?Y(4003):(u=_,r=this._getFontDesc(u,e.fontFamily,e.isBold,e.isItalic),this._context.font=r)}else{for(o=t.length*this._getLineHeight(i.lineHeight,u,e.fontSize),a=0;a1&&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;u0&&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;r0&&h>0&&C+f.w*t.bmfontScale>e.maxLineWidth&&!ZF(m)){e.linesWidth.push(c),c=0,o++,h=0,u-=e.lineHeight*this._getFontScale(t,e)+0,E=!0;break}A.x=C,A.y=u-f.offsetY*t.bmfontScale,this._recordLetterInfo(A,m,b,o),b+1A.y-f.h*t.bmfontScale&&(y=A.y-f.h*t.bmfontScale)}else this._recordPlaceholderInfo(b,m),null!=t.fntConfig?k("Can't find letter definition in texture atlas "+t.fntConfig.atlasName+" for letter:"+m):k("Can't find letter definition in font family "+t.fontFamily+" for letter:"+m);else this._recordPlaceholderInfo(b,m)}E||(h=S,_y&&(d=y),l<(c=T)&&(l=c),p+=g)}else e.linesWidth.push(c),c=0,o++,h=0,u-=e.lineHeight*this._getFontScale(t,e)+0,this._recordPlaceholderInfo(p,m),p++}return e.linesWidth.push(c),e.numberOfLines=o+1,e.textDesiredHeight=e.numberOfLines*e.lineHeight*this._getFontScale(t,e),e.numberOfLines>1&&(e.textDesiredHeight+=0*(e.numberOfLines-1)),i.nodeContentSize.width=e.textWidthTemp,i.nodeContentSize.height=e.textHeightTemp,e.textWidthTemp<=0&&(i.nodeContentSize.width=parseFloat(l.toFixed(2))+2*ck.margin),e.textHeightTemp<=0&&(i.nodeContentSize.height=parseFloat(e.textDesiredHeight.toFixed(2))+2*ck.margin),e.tailoredTopY=i.nodeContentSize.height,e.tailoredBottomY=0,_>0&&(e.tailoredTopY=i.nodeContentSize.height+_),d<-e.textDesiredHeight&&(e.tailoredBottomY=e.textDesiredHeight+d),!0},e._recordPlaceholderInfo=function(t,e){if(t>=this._lettersInfo.length){var i=new ej;this._lettersInfo.push(i)}this._lettersInfo[t].char=e,this._lettersInfo[t].hash=""+e.charCodeAt(0)+ck.hash,this._lettersInfo[t].valid=!1},e._recordLetterInfo=function(t,e,i,n){if(i>=this._lettersInfo.length){var r=new ej;this._lettersInfo.push(r)}var s=""+e.charCodeAt(0)+ck.hash;this._lettersInfo[i].line=n,this._lettersInfo[i].char=e,this._lettersInfo[i].hash=s,this._lettersInfo[i].valid=ck.fontAtlas.getLetter(s).valid,this._lettersInfo[i].x=t.x,this._lettersInfo[i].y=t.y},e._getFirstWordLen=function(t,e,i,n,r){var s=i.charAt(n);if(QF(s)||"\n"===s||ZF(s))return 1;var a=1,o=ck.fontAtlas.getLetterDefinitionForChar(s,ck);if(!o)return a;for(var h=o.xAdvance*t.bmfontScale+e.spacingX,u=n+1;ue.maxLineWidth&&!ZF(s)&&e.maxLineWidth>0)return a;if(h+=o.xAdvance*t.bmfontScale+e.spacingX,"\n"===s||ZF(s)||QF(s))break;a++}return a},e._computeAlignmentOffset=function(t,e,i){switch(e.linesOffsetX.length=0,e.letterOffsetY=0,e.horizontalAlign){case aG.LEFT:for(var n=0;ni.nodeContentSize.height},e._isHorizontalClamp=function(t,e,i,n,r){for(var s=!1,a=0,o=n.length;a0)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;ie.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>1;if(h<=0)break;t.bmfontScale=h/(t.originFontSize*this._fontScale),this._multilineTextWrap(t,e,i,n,this._getFirstWordLen),this._computeAlignmentOffset(t,e,i),r(t,e,i,n,this)?a=o-1:s=o}s>=0&&this._scaleFontSizeDown(t,e,i,n,s)},e._scaleFontSizeDown=function(t,e,i,n,r){var s=!0;r||(r=.1,s=!1),t.actualFontSize=r,s&&(this._updateFontScale(t),this._multilineTextWrap(t,e,i,n,this._getFirstWordLen))},e._updateQuads=function(t,e,i,n,r,s){for(var a=t.spriteFrame?t.spriteFrame.texture:ck.fontAtlas.getTexture(),o=n.uiTransAnchorX*i.nodeContentSize.width,h=n.uiTransAnchorY*i.nodeContentSize.height,u=0,l=r.length;u0){if(d>e.tailoredTopY){var f=d-e.tailoredTopY;this._tmpRect.y+=f,this._tmpRect.height-=f,d-=f}d-this._tmpRect.height*t.bmfontScale0&&this._isHorizontalClamped(e,i,m,p)&&e.overFlow===hG.CLAMP&&(this._tmpRect.width=0),this._tmpRect.height>0&&this._tmpRect.width>0){var g=this._determineRect(t),v=c.x+e.linesOffsetX[c.line],y=n.quadCount;n.quadCount+=4,this.updateQuatCount(n),s(t,i,n,y,a,this._tmpRect,g,v-o,d-h)}}else U("Can't find letter in this bitmap-font")}}return!0},e._isHorizontalClamped=function(t,e,i,n){var r=t.linesWidth[n],s=i>e.nodeContentSize.width||i<0;return t.wrapping?r>e.nodeContentSize.width&&s:s},e._determineRect=function(t){var e=t.spriteFrame;if(!e)return!1;var i=e.isRotated(),n=e.getOriginalSize(),r=e.getRect(),s=e.getOffset(),a=s.x+(n.width-r.width)/2,o=s.y-(n.height-r.height)/2;if(i){var h=this._tmpRect.x;this._tmpRect.x=r.x+r.height-this._tmpRect.y-this._tmpRect.height-o,this._tmpRect.y=h+r.y-a,this._tmpRect.y<0&&(this._tmpRect.height+=o)}else this._tmpRect.x+=r.x-a,this._tmpRect.y+=r.y+o;return i},t}();ij.instance=void 0,ij.instance=new ij;var nj,rj=new lk(64,64),sj=new FF(null),aj=null,oj=null,hj=null,uj=null,lj={updateProcessingData:function(t,e,i,n,r,s){t.fontSize=r.fontSize,t.actualFontSize=r.fontSize,t.originFontSize=hj?hj.fontSize:r.fontSize,e.horizontalAlign=r.horizontalAlign,e.verticalAlign=r.verticalAlign,e.spacingX=r.spacingX;var a=r.overflow;e.overFlow=a,e.lineHeight=r.lineHeight,i.nodeContentSize.width=s.width,i.nodeContentSize.height=s.height,a===hG.NONE?(e.wrapping=!1,i.nodeContentSize.width+=2*ck.margin,i.nodeContentSize.height+=2*ck.margin):a===hG.RESIZE_HEIGHT?(e.wrapping=!0,i.nodeContentSize.height+=2*ck.margin):e.wrapping=r.enableWrapText,n.uiTransAnchorX=s.anchorX,n.uiTransAnchorY=s.anchorY,ck.lineHeight=r.lineHeight,ck.fontSize=r.fontSize,t.spriteFrame=uj,t.fntConfig=hj,t.fontFamily=ck.fontFamily,t.color.set(r.color)},updateRenderData:function(t){if(t.renderData&&aj!==t){if(t.renderData.vertDirty){oj=(aj=t).node._uiProps.uiTransformComp;var e=t.renderData,i=ij.instance,n=t.textStyle,r=t.textLayout,s=t.textLayoutData,a=t.textRenderData;n.fontScale=IV.getScaleX(),this._updateFontFamily(t),this.updateProcessingData(n,r,s,a,t,oj),this._updateLabelInfo(t),n.fontDesc=ck.fontDesc,i.processingString(!0,n,r,s,t.string),this.resetRenderData(t),a.quadCount=0,i.generateRenderInfo(!0,n,r,s,a,t.string,this.generateVertexData),e.dataLength=a.quadCount,e.resize(e.dataLength,e.dataLength/2*3);for(var o=e.data,h=0,u=a.quadCount;h0?(ck.isOutlined=!0,ck.margin=t.outlineWidth,ck.out=t.outlineColor.clone(),ck.out.a=t.outlineColor.a*t.color.a/255):(ck.isOutlined=!1,ck.margin=0)},_getFontFamily:function(t){var e="Arial";return t.useSystemFont?e=t.fontFamily||"Arial":t.font&&(e=t.font._nativeAsset||"Arial"),e},_updateLabelInfo:function(t){ck.fontDesc=this._getFontDesc(),ck.color=t.color,ck.hash=function(t){var e=t.color.toHEX(),i="";return t.isOutlined&&t.margin>0&&(i=i+t.margin+t.out.toHEX()),""+t.fontSize+t.fontFamily+e+i}(ck)},_getFontDesc:function(){return ck.fontSize.toString()+"px "+ck.fontFamily}}),pj=new pn(255,255,255,255),mj={createData:function(t){var e=t.requestRenderData();return e.resize(0,0),e},fillBuffers:function(t){if(t.renderData){var e=t.node;pj.a=255*e._uiProps.opacity,Id(e,0,t.renderData,pj)}},updateColor:function(){}};Gt(mj,fj);var gj=fG.Overflow,vj={updateProcessingData:function(t,e,i,n,r,s){t.isSystemFontUsed=r.useSystemFont,t.fontSize=r.fontSize,i.nodeContentSize.width=i.canvasSize.width=s.width,i.nodeContentSize.height=i.canvasSize.height=s.height,e.lineHeight=r.lineHeight,e.overFlow=r.overflow,r.overflow===gj.NONE?e.wrapping=!1:r.overflow===gj.RESIZE_HEIGHT?e.wrapping=!0:e.wrapping=r.enableWrapText,t.isBold=r.isBold,t.isItalic=r.isItalic,t.isUnderline=r.isUnderline,t.underlineHeight=r.underlineHeight,r.enableOutline&&r.outlineWidth>0?(t.isOutlined=!0,t.outlineColor.set(r.outlineColor),t.outlineWidth=r.outlineWidth):t.isOutlined=!1,r.enableShadow&&(r.shadowBlur>0||!xi(r.shadowOffset.x,0)||!xi(r.shadowOffset.y,0))?(t.hasShadow=!0,t.shadowColor.set(r.shadowColor),t.shadowBlur=r.shadowBlur,t.shadowOffsetX=r.shadowOffset.x,t.shadowOffsetY=r.shadowOffset.y):t.hasShadow=!1,t.color.set(r.color),n.texture=r.spriteFrame,n.uiTransAnchorX=s.anchorX,n.uiTransAnchorY=s.anchorY,e.horizontalAlign=r.horizontalAlign,e.verticalAlign=r.verticalAlign},getAssemblerData:function(){var t=fG._canvasPool.get();return t.canvas.width=t.canvas.height=1,t},resetAssemblerData:function(t){t&&fG._canvasPool.put(t)},updateRenderData:function(t){if(t.renderData){if(t.renderData.vertDirty){var e=t.node._uiProps.uiTransformComp,i=ij.instance,n=t.textStyle,r=t.textLayout,s=t.textLayoutData,a=t.textRenderData;n.fontScale=IV.getScaleX(),this.updateProcessingData(n,r,s,a,t,e),i.setCanvasUsed(t.assemblerData.canvas,t.assemblerData.context),n.fontFamily=this._updateFontFamily(t),this._resetDynamicAtlas(t),i.processingString(!1,n,r,s,t.string),i.generateRenderInfo(!1,n,r,s,a,t.string,this.generateVertexData);var o=t.renderData;o.textureDirty=!0,this._calDynamicAtlas(t,s),t.actualFontSize=n.actualFontSize,e.setContentSize(s.nodeContentSize);var h=o.data;h[0]=a.vertexBuffer[0],h[1]=a.vertexBuffer[1],h[2]=a.vertexBuffer[2],h[3]=a.vertexBuffer[3],this.updateUVs(t),t.renderData.vertDirty=!1,t.contentWidth=s.nodeContentSize.width}t.spriteFrame&&t.renderData.updateRenderData(t,t.spriteFrame)}},generateVertexData:function(t,e,i){var n=i.vertexBuffer,r=e.nodeContentSize.width,s=e.nodeContentSize.height,a=i.uiTransAnchorX*r,o=i.uiTransAnchorY*s;n[0].x=-a,n[0].y=-o,n[1].x=r-a,n[1].y=-o,n[2].x=-a,n[2].y=s-o,n[3].x=r-a,n[3].y=s-o},updateVertexData:function(){},updateUVs:function(){},_updateFontFamily:function(t){return t.useSystemFont?t.fontFamily||"Arial":t.font&&t.font._nativeAsset||"Arial"},_calDynamicAtlas:function(t,e){if(!(t.cacheMode!==fG.CacheMode.BITMAP||e.canvasSize.width<=0||e.canvasSize.height<=0)){var i=t.ttfSpriteFrame;CL.packToDynamicAtlas(t,i)}},_resetDynamicAtlas:function(t){if(t.cacheMode===fG.CacheMode.BITMAP){var e=t.ttfSpriteFrame;CL.deleteAtlasSpriteFrame(e),e._resetDynamicAtlasFrame()}}},yj=pn.WHITE.clone(),Tj=Uint16Array.from([0,1,2,1,3,2]),Sj={createData:function(t){var e=t.requestRenderData();e.dataLength=4,e.resize(4,6),t.textRenderData.quadCount=4;var i=e.chunk.vb;i[3]=i[21]=i[22]=i[31]=0,i[4]=i[12]=i[13]=i[30]=1;for(var n=5,r=0;r<4;r++)pn.toArray(i,yj,n),n+=9;return e.chunk.setIndexBuffer(Tj),e},fillBuffers:function(t){for(var e=t.renderData,i=e.chunk,n=e.data,r=t.node,s=i.vb,a=r.worldMatrix,o=e.floatStride,h=0,u=n.length,l=0;l1?1:r)<0?0:r;var s=(n=(n=n>1?1:n)<0?0:n)+(r=(r-=n)<0?0:r);s=s>1?1:s,this.updateUVs(t,n,s),this.updateVertexData(t,n,s),i.updateRenderData(t,e)}},updateUVs:function(t,e,i){var n=t.spriteFrame,r=t.renderData.chunk.vb,s=n.width,a=n.height,o=n.rect,h=0,u=0,l=0,c=0,_=0,d=0,f=0,p=0,m=0,g=0;switch(n.isRotated()?(h=o.x/s,u=(o.y+o.width)/a,l=_=h,f=m=(o.x+o.height)/s,d=g=u,c=p=o.y/a):(h=o.x/s,u=(o.y+o.height)/a,l=f=h,_=m=(o.x+o.width)/s,c=d=u,p=g=o.y/a),t.fillType){case Aj.HORIZONTAL:r[3]=l+(_-l)*e,r[4]=c+(d-c)*e,r[12]=l+(_-l)*i,r[13]=c+(d-c)*i,r[21]=f+(m-f)*e,r[22]=p+(g-p)*e,r[30]=f+(m-f)*i,r[31]=p+(g-p)*i;break;case Aj.VERTICAL:r[3]=l+(f-l)*e,r[4]=c+(p-c)*e,r[12]=_+(m-_)*e,r[13]=d+(g-d)*e,r[21]=l+(f-l)*i,r[22]=c+(p-c)*i,r[30]=_+(m-_)*i,r[31]=d+(g-d)*i;break;default:Z(2626)}},updateVertexData:function(t,e,i){var n=t.renderData.data,r=t.node._uiProps.uiTransformComp,s=r.width,a=r.height,o=r.anchorX*s,h=r.anchorY*a,u=-o,l=-h,c=s-o,_=a-h,d=0;switch(t.fillType){case Aj.HORIZONTAL:d=u+(c-u)*i,u+=(c-u)*e,c=d;break;case Aj.VERTICAL:d=l+(_-l)*i,l+=(_-l)*e,_=d;break;default:Z(2626)}n[0].x=u,n[0].y=l,n[1].x=c,n[1].y=l,n[2].x=u,n[2].y=_,n[3].x=c,n[3].y=_},createData:function(t){var e=t.requestRenderData();e.dataLength=4,e.resize(4,6),e.chunk.setIndexBuffer(bj);for(var i,n=d(e.data);!(i=n()).done;)i.value.z=0;return e},updateWorldVertexData:function(t,e){t.node.getWorldMatrix(Rj);for(var i=t.renderData.floatStride,n=t.renderData.data,r=e.vb,s=0,a=0;a<4;a++){var o=n[a],h=o.x,u=o.y,l=Rj.m03*h+Rj.m07*u+Rj.m15;l=l?1/l:1,r[s=a*i]=(Rj.m00*h+Rj.m04*u+Rj.m12)*l,r[s+1]=(Rj.m01*h+Rj.m05*u+Rj.m13)*l,r[s+2]=(Rj.m02*h+Rj.m06*u+Rj.m14)*l}},fillBuffers:function(t){var e=t.renderData,i=e.chunk;(t._flagChangedVersion!==t.node.flagChangedVersion||e.vertDirty)&&(this.updateWorldVertexData(t,i),e.vertDirty=!1,t._flagChangedVersion=t.node.flagChangedVersion),i.bufferId;var n=i.vertexOffset,r=i.meshBuffer,s=i.meshBuffer.iData,a=r.indexOffset;s[a++]=n,s[a++]=n+1,s[a++]=n+2,s[a++]=n+2,s[a++]=n+1,s[a++]=n+3,r.indexOffset+=6},updateColor:function(t){for(var e=t.renderData,i=e.chunk.vb,n=e.floatStride,r=5,s=t.color,a=s.r/255,o=s.g/255,h=s.b/255,u=t.node._uiProps.opacity,l=0;l<4;l++)i[r]=a,i[r+1]=o,i[r+2]=h,i[r+3]=u,r+=n}},wj=2*Math.PI,xj=1e-6,Ij=new Dn,Oj=[new Fn,new Fn,new Fn,new Fn],Dj=new Array(4),Mj=new Array(8),Pj=[new Fn,new Fn,new Fn,new Fn],Bj=[new Fn,new Fn,new Fn,new Fn],Nj=new Fn,Lj=[new Fn,new Fn,new Fn,new Fn],Fj=null;function kj(t,e,i,n,r,s,a){var o=Math.sin(s);o=Math.abs(o)>xj?o:0;var h=Math.cos(s),u=0,l=0;if(0!==(h=Math.abs(h)>xj?h:0)){if(u=o/h,(t-r.x)*h>0){var c=r.y+u*(t-r.x);a[0].x=t,a[0].y=c}if((e-r.x)*h>0){var _=r.y+u*(e-r.x);a[2].x=e,a[2].y=_}}if(0!==o){if(l=h/o,(n-r.y)*o>0){var d=r.x+l*(n-r.y);a[3].x=d,a[3].y=n}if((i-r.y)*o>0){var f=r.x+l*(i-r.y);a[1].x=f,a[1].y=i}}}function Uj(t,e){var i=e.x-t.x,n=e.y-t.y;if(0===i&&0===n)return 0;if(0===i)return n>0?.5*Math.PI:1.5*Math.PI;var r=Math.atan(n/i);return i<0&&(r+=Math.PI),r}function Gj(t,e,i,n,r){var s=Dj,a=s[0],o=s[1],h=s[2],u=s[3];t[e].x=i.x,t[e].y=i.y,t[e+1].x=n.x,t[e+1].y=n.y,t[e+2].x=r.x,t[e+2].y=r.y,Hj((i.x-a)/(h-a),(i.y-o)/(u-o),t,e),Hj((n.x-a)/(h-a),(n.y-o)/(u-o),t,e+1),Hj((r.x-a)/(h-a),(r.y-o)/(u-o),t,e+2)}function Hj(t,e,i,n){var r=Mj,s=r[0]+(r[2]-r[0])*t,a=r[4]+(r[6]-r[4])*t,o=r[1]+(r[3]-r[1])*t,h=r[5]+(r[7]-r[5])*t,u=i[n];u.u=s+(a-s)*e,u.v=o+(h-o)*e}for(var zj={useModel:!1,createData:function(t){return t.requestRenderData()},updateRenderData:function(t){var e=t.spriteFrame;CL.packToDynamicAtlas(t,e),this.updateUVs(t);var i=t.renderData;if(i&&e){if(!i.vertDirty)return;var n=i.data,r=t.fillStart,s=t.fillRange;for(s<0&&(r+=s,s=-s);r>=1;)r-=1;for(;r<0;)r+=1;var a=(r*=wj)+(s*=wj);!function(t){var e=t.node._uiProps.uiTransformComp,i=e.width,n=e.height,r=e.anchorX*i,s=e.anchorY*n,a=-r,o=-s,h=i-r,u=n-s,l=Dj;l[0]=a,l[1]=o,l[2]=h,l[3]=u;var c=t.fillCenter,_=Nj.x=Math.min(Math.max(0,c.x),1)*(h-a)+a,d=Nj.y=Math.min(Math.max(0,c.y),1)*(u-o)+o;Oj[0].x=Oj[3].x=a,Oj[1].x=Oj[2].x=h,Oj[0].y=Oj[1].y=o,Oj[2].y=Oj[3].y=u;for(var f=0,p=Lj;f=wj)i.dataLength=o+3,Gj(n,o,Nj,Oj[u.x],Oj[u.y]),o+=3;else{var l=Uj(Nj,Oj[u.x]),c=Uj(Nj,Oj[u.y]);c=a||(l>=r?(i.dataLength=o+3,Gj(n,o,Nj,Oj[u.x],c>=a?Bj[h]:Oj[u.y]),o+=3):c>r&&(c<=a?(i.dataLength=o+3,Gj(n,o,Nj,Pj[h],Oj[u.y]),o+=3):(i.dataLength=o+3,Gj(n,o,Nj,Pj[h],Bj[h]),o+=3))),l+=wj,c+=wj}}0===o&&(i.dataLength=0),i.resize(o,o),i.updateRenderData(t,e)}},createQuadIndices:function(t){Fj=null,Fj=new Uint16Array(t);for(var e=0,i=0;i1?1:p,m=Number.isNaN(m)||m>1?1:m,d=d<0?0:d,f=f<0?0:f,jj[0].x=-a,jj[0].y=-o,jj[1].x=u*p-a,jj[1].y=_*m-o,jj[2].x=jj[1].x+d,jj[2].y=jj[1].y+f,jj[3].x=r-a,jj[3].y=s-o;for(var g=0;g<4;g++)for(var v=0;v<4;v++){var y=4*g+v;y0||t.insetBottom>0||t.insetLeft>0||t.insetRight>0)?2:0}var oY={createData:function(t){return t.requestRenderData()},updateRenderData:function(t){var e=t.renderData,i=t.spriteFrame;if(i&&e&&e.vertDirty){var n=t.node._uiProps.uiTransformComp,r=Math.abs(n.width),s=Math.abs(n.height),a=i.getRect(),o=i.insetLeft,h=i.insetRight,u=a.width-o-h,l=i.insetTop,c=i.insetBottom,_=a.height-l-c,d=r-o-h,f=s-l-c;d=d>0?d:0,f=f>0?f:0;var p=0===u?d:d/u,m=0===_?f:f/_,g=aY(i),v=Math.ceil(m+g),y=Math.ceil(p+g);e.dataLength=4*v*y,this.updateVerts(t,d,f,v,y),e.vertexCount!==v*y*4&&(t.renderEntity.colorDirty=!0),e.resize(v*y*4,v*y*6),e.updateRenderData(t,i)}},createQuadIndices:function(t){if(t%6==0){var e=t/6;sY=null,sY=new Uint16Array(t);for(var i=0,n=0;n1?1:o.width/(p+m),E=o.height/(v+y)>1?1:o.height/(v+y);s=g>0?Math.floor(1e3*e)/1e3%g==0?g:e%g:e,a=T>0?Math.floor(1e3*i)/1e3%T==0?T:i%T:i,rY.length=0,nY=Math.max(n+1,r+1);for(var A=0;A=r?c-d:b*g-d,rY[b].y=b>=n?_-f:b*T-f;else for(var C=0;C1&&C0?p*S-d+g*(C-1):p+e-d:C===r-1?rY[C].x=p*S-d+s+g*(C-2):C>=r&&(rY[C].x=Math.min(p+e+m,c)-d),0===C?rY[C].y=-f:1===C?rY[C].y=y*E-f:C>1&&C0?y*E-f+T*(C-1):y+i-f:C===n-1?rY[C].y=y*E-f+a+T*(C-2):C>=n&&(rY[C].y=Math.min(y+i+v,_)-f);for(var w=0,x=0,I=0,O=0,D=0;DT?i>=(R>0?z:z+1)*T?1:U%1:U;for(var V=0;Vg?e>=(R>0?V:V+1)*g?1:k%1:k,B?(0===R?(G[0]=Jj.u,G[1]=Jj.u,G[2]=Jj.u+($j.u-Jj.u)*F,H[0]=qj.v,H[1]=qj.v+(Qj.v-qj.v)*L,H[2]=qj.v):(0===z?(G[0]=Kj.u,G[1]=Kj.u,G[2]=Jj.u):z0){var h=a.claimedTouchIdList.indexOf(n.getID());if(-1!==h){if(a._handleEventTouch(t),t.type!==CC.TOUCH_END&&t.type!==CC.TOUCH_CANCEL||oe(a.claimedTouchIdList,h),r=!1,!t.preventSwallow)break;t.preventSwallow=!1}}}return--this._inDispatchCount<=0&&this._updatePointerEventProcessorList(),r},e._updatePointerEventProcessorList=function(){for(var t=this._processorListToAdd,e=t.length,i=0;ie)for(;e0){for(var t=this._meshDataArray.length,e=0;e0){!function(t,e){for(var i,n,r,s=t.vertexFormat,a=t.chunk.vb,o=0,h=0;h>>0;else if(n.size/n.count==4)for(var c=o+3;c>2}}(r.renderData,a);var h=r.renderData.getMeshBuffer();h&&h.setDirty()}if(i.length>0&&!t._static)for(var u=0;u0&&(this.autoMergeBatches(this._currComponent),this.resetRenderStates(),Lk.sharedManager.exitMask())),e+=1}},e._screenSort=function(t,e){return t.node.getSiblingIndex()-e.node.getSiblingIndex()},e._releaseDescriptorSetCache=function(t){this._descriptorSetCache.releaseDescriptorSetCache(t)},e._createClearModel=function(){if(!this._maskClearModel){this._maskClearMtl=aS.get("default-clear-stencil"),this._maskClearModel=v.director.root.createModel(IB);var t=yk(_k),e=wd.gfxDevice,i=e.createBuffer(new qc(ql.VERTEX|ql.TRANSFER_DST,Jl.DEVICE,4*t,t)),n=new Float32Array([-1,-1,0,1,-1,0,-1,1,0,1,1,0]);i.update(n);var r=e.createBuffer(new qc(ql.INDEX|ql.TRANSFER_DST,Jl.DEVICE,6*Uint16Array.BYTES_PER_ELEMENT,Uint16Array.BYTES_PER_ELEMENT)),s=new Uint16Array([0,1,2,2,1,3]);r.update(s),this._maskModelMesh=new Lx([i],_k,vc.TRIANGLE_LIST,r),this._maskModelMesh.subMeshIdx=0,this._maskClearModel.initSubModel(0,this._maskModelMesh,this._maskClearMtl)}},e._insertMaskBatch=function(t){this.autoMergeBatches(this._currComponent),this.resetRenderStates(),this._createClearModel(),this._maskClearModel.node=this._maskClearModel.transform=t.node;var e=Lk.sharedManager;e.pushMask(1);var i,n=e.clear(t),r=0,s=this._maskClearMtl;s&&(i=e.getStencilStage(n,s),r=e.getStencilHash(n));var a=this._maskClearModel,o=v.director.getTotalFrames();a&&(a.updateTransform(o),a.updateUBOs(o));for(var h=0;h=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@123丁ぁᄁ",AY=Object.create(null),RY=[],bY=3e3;function CY(){for(var t=!0,e=Date.now(),i=RY.length-1;i>=0;i--){var n=RY[i],r=n.fontFamilyName;if(e-n.startTime>bY)q(4933,r),n.onComplete(null,r),RY.splice(i,1);else{var s=n.refWidth,a="40px "+r;TY.font=a,s!==JF(TY,EY,a)?(RY.splice(i,1),n.onComplete(null,r)):t=!1}}t&&(clearInterval(SY),SY=-1)}function wY(t,e,i){var n=function(t){var e=t.lastIndexOf(".ttf");if(-1===e)return t;var i,n=t.lastIndexOf("/");return-1!==(i=-1===n?t.substring(0,e)+"_LABEL":t.substring(n+1,e)+"_LABEL").indexOf(" ")&&(i='"'+i+'"'),i}(t);if(AY[n])i(null,n);else{if(!TY){var r=yY.createElement("canvas");r.width=100,r.height=100,TY=r.getContext("2d")}var s="40px "+n,a=yY.createElement("style");a.type="text/css";var o="";Number.isNaN(n)?o+="@font-face { font-family:"+n+"; src:":o+='@font-face { font-family:"'+n+'"; src:',o+='url("'+t+'");',a.textContent=o+"}",yY.body.appendChild(a);var h=yY.createElement("div"),u=h.style;if(u.fontFamily=n,h.innerHTML=".",u.position="absolute",u.left="-100px",u.top="-100px",yY.body.appendChild(h),function(){if(void 0===vY)if("FontFace"in T){var t=/Gecko.*Firefox\/(\d+)/.exec(T.navigator.userAgent),e=/OS X.*Version\/10\..*Safari/.exec(T.navigator.userAgent)&&/Apple/.exec(T.navigator.vendor);vY=t?parseInt(t[1],10)>42:!e}else vY=!1;return vY}())!function(t,e,i){var n=new Promise((function(i,n){!function r(){Date.now()-t>=bY?n():yY.fonts.load("40px "+e).then((function(t){t.length>=1?i():setTimeout(r,100)}),(function(){n()}))}()})),r=null,s=new Promise((function(t,e){r=setTimeout(e,bY)}));Promise.race([s,n]).then((function(){r&&(clearTimeout(r),r=null),i(null,e)}),(function(){q(4933,e),i(null,e)}))}(Date.now(),n,i);else{var l={fontFamilyName:n,refWidth:JF(TY,EY,s),onComplete:i,startTime:Date.now()};RY.push(l),-1===SY&&(SY=setInterval(CY,100))}AY[n]=a}}function xY(t,e,i,n){var r=new BF;r._nativeUrl=t,r._nativeAsset=e,n(null,r)}CT.register({".font":wY,".eot":wY,".ttf":wY,".woff":wY,".svg":wY,".ttc":wY}),kT.register({".font":xY,".eot":xY,".ttf":xY,".woff":xY,".svg":xY,".ttc":xY}),v.UI={MeshBuffer:Ck,spriteAssembler:lY,graphicsAssembler:ZX,labelAssembler:Ej,RenderData:Zk,MeshRenderData:Jk},AL.on(EL.EVENT_POST_SUBSYSTEM_INIT,(function(){NY.init()}));var IY,OY,DY,MY,PY,BY,NY=t("a1",function(){function t(){}return t.getSortingPriority=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),(t+32768<<16|e+32768)>>>0},t.getLayerIndex=function(t){void 0===t&&(t=0);var e=0;return this.indexMap.has(t)?e=this.indexMap.get(t):Z(2105),e},t.getLayerIndexByName=function(t){var e=this.getLayerByName(t);return this.getLayerIndex(e)},t.getLayerName=function(t){void 0===t&&(t=0);var e="";return this.nameMap.has(t)?e=this.nameMap.get(t):Z(2105),e},t.getLayerByName=function(t){for(var e=this.nameMap.size,i=this.nameMap.keys(),n=0,r=0;r=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;n0&&this.bindposes.length>0},n(e,[{key:"joints",get:function(){return this._joints},set:function(t){this._joints=t}},{key:"bindposes",get:function(){return this._bindposes},set:function(t){this._bindposes=t}},{key:"inverseBindposes",get:function(){if(!this._invBindposes){this._invBindposes=[];for(var t=0;tBS.LEVEL_1},set:function(t){this._csmLevel=t?BS.LEVEL_4:BS.LEVEL_1,this._light&&(this._light.csmLevel=this._csmLevel,this._light.csmNeedUpdate=!0)}},{key:"csmLayerLambda",get:function(){return this._csmLayerLambda},set:function(t){this._csmLayerLambda=t,this._light&&(this._light.csmLayerLambda=this._csmLayerLambda,this._light.csmNeedUpdate=!0)}},{key:"csmOptimizationMode",get:function(){return this._csmOptimizationMode},set:function(t){this._csmOptimizationMode=t,this._light&&(this._light.csmOptimizationMode=this._csmOptimizationMode)}},{key:"shadowFixedArea",get:function(){return this._shadowFixedArea},set:function(t){this._shadowFixedArea=t,this._light&&(this._light.shadowFixedArea=this._shadowFixedArea)}},{key:"shadowNear",get:function(){return this._shadowNear},set:function(t){this._shadowNear=t,this._light&&(this._light.shadowNear=this._shadowNear)}},{key:"shadowFar",get:function(){return this._shadowFar},set:function(t){this._shadowFar=Math.min(t,FS.MAX_FAR),this._light&&(this._light.shadowFar=this._shadowFar)}},{key:"shadowOrthoSize",get:function(){return this._shadowOrthoSize},set:function(t){this._shadowOrthoSize=t,this._light&&(this._light.shadowOrthoSize=this._shadowOrthoSize)}},{key:"csmAdvancedOptions",get:function(){return this._csmAdvancedOptions},set:function(t){this._csmAdvancedOptions=t}},{key:"csmLayersTransition",get:function(){return this._csmLayersTransition},set:function(t){this._csmLayersTransition=t,this._light&&(this._light.csmLayersTransition=t)}},{key:"csmTransitionRange",get:function(){return this._csmTransitionRange},set:function(t){this._csmTransitionRange=t,this._light&&(this._light.csmTransitionRange=t)}}]),e}(TZ),qq=Gs(Kq.prototype,"_illuminanceHDR",[SZ,uq],(function(){return 65e3})),Qq=Gs(Kq.prototype,"_illuminanceLDR",[EZ],(function(){return 65e3*jw.standardExposureValue})),Zq=Gs(Kq.prototype,"_shadowEnabled",[EZ],(function(){return!1})),Jq=Gs(Kq.prototype,"_shadowPcf",[EZ],(function(){return PS.HARD})),$q=Gs(Kq.prototype,"_shadowBias",[EZ],(function(){return 1e-5})),tQ=Gs(Kq.prototype,"_shadowNormalBias",[EZ],(function(){return 0})),eQ=Gs(Kq.prototype,"_shadowSaturation",[EZ],(function(){return 1})),iQ=Gs(Kq.prototype,"_shadowDistance",[EZ],(function(){return 50})),nQ=Gs(Kq.prototype,"_shadowInvisibleOcclusionRange",[EZ],(function(){return 200})),rQ=Gs(Kq.prototype,"_csmLevel",[EZ],(function(){return BS.LEVEL_4})),sQ=Gs(Kq.prototype,"_csmLayerLambda",[EZ],(function(){return.75})),aQ=Gs(Kq.prototype,"_csmOptimizationMode",[EZ],(function(){return NS.RemoveDuplicates})),oQ=Gs(Kq.prototype,"_csmAdvancedOptions",[EZ],(function(){return!1})),hQ=Gs(Kq.prototype,"_csmLayersTransition",[EZ],(function(){return!1})),uQ=Gs(Kq.prototype,"_csmTransitionRange",[EZ],(function(){return.05})),lQ=Gs(Kq.prototype,"_shadowFixedArea",[EZ],(function(){return!1})),cQ=Gs(Kq.prototype,"_shadowNear",[EZ],(function(){return.1})),_Q=Gs(Kq.prototype,"_shadowFar",[EZ],(function(){return 10})),dQ=Gs(Kq.prototype,"_shadowOrthoSize",[EZ],(function(){return 5})),f(Kq.prototype,"illuminance",[lq],Object.getOwnPropertyDescriptor(Kq.prototype,"illuminance"),Kq.prototype),f(Kq.prototype,"shadowEnabled",[cq,_q],Object.getOwnPropertyDescriptor(Kq.prototype,"shadowEnabled"),Kq.prototype),f(Kq.prototype,"shadowPcf",[dq,fq],Object.getOwnPropertyDescriptor(Kq.prototype,"shadowPcf"),Kq.prototype),f(Kq.prototype,"shadowBias",[pq,mq],Object.getOwnPropertyDescriptor(Kq.prototype,"shadowBias"),Kq.prototype),f(Kq.prototype,"shadowNormalBias",[gq,vq],Object.getOwnPropertyDescriptor(Kq.prototype,"shadowNormalBias"),Kq.prototype),f(Kq.prototype,"shadowSaturation",[yq,Tq],Object.getOwnPropertyDescriptor(Kq.prototype,"shadowSaturation"),Kq.prototype),f(Kq.prototype,"shadowDistance",[Sq,Eq],Object.getOwnPropertyDescriptor(Kq.prototype,"shadowDistance"),Kq.prototype),f(Kq.prototype,"shadowInvisibleOcclusionRange",[Aq,Rq],Object.getOwnPropertyDescriptor(Kq.prototype,"shadowInvisibleOcclusionRange"),Kq.prototype),f(Kq.prototype,"csmLevel",[bq,Cq],Object.getOwnPropertyDescriptor(Kq.prototype,"csmLevel"),Kq.prototype),f(Kq.prototype,"enableCSM",[wq,xq],Object.getOwnPropertyDescriptor(Kq.prototype,"enableCSM"),Kq.prototype),f(Kq.prototype,"csmLayerLambda",[Iq,Oq],Object.getOwnPropertyDescriptor(Kq.prototype,"csmLayerLambda"),Kq.prototype),f(Kq.prototype,"csmOptimizationMode",[Dq,Mq],Object.getOwnPropertyDescriptor(Kq.prototype,"csmOptimizationMode"),Kq.prototype),f(Kq.prototype,"shadowFixedArea",[Pq,Bq],Object.getOwnPropertyDescriptor(Kq.prototype,"shadowFixedArea"),Kq.prototype),f(Kq.prototype,"shadowNear",[Nq,Lq],Object.getOwnPropertyDescriptor(Kq.prototype,"shadowNear"),Kq.prototype),f(Kq.prototype,"shadowFar",[Fq,kq],Object.getOwnPropertyDescriptor(Kq.prototype,"shadowFar"),Kq.prototype),f(Kq.prototype,"shadowOrthoSize",[Uq,Gq],Object.getOwnPropertyDescriptor(Kq.prototype,"shadowOrthoSize"),Kq.prototype),f(Kq.prototype,"csmAdvancedOptions",[Hq,zq],Object.getOwnPropertyDescriptor(Kq.prototype,"csmAdvancedOptions"),Kq.prototype),f(Kq.prototype,"csmLayersTransition",[Vq,Wq],Object.getOwnPropertyDescriptor(Kq.prototype,"csmLayersTransition"),Kq.prototype),f(Kq.prototype,"csmTransitionRange",[Xq,jq],Object.getOwnPropertyDescriptor(Kq.prototype,"csmTransitionRange"),Kq.prototype),Yq=Kq))||Yq)),CZ=t("aa",(fQ=qs("cc.SphereLight"),pQ=sa("_luminance"),mQ=xa(Ke),gQ=xa(Ke),vQ=xa(vZ),yQ=xa(qe),TQ=xa(qe),fQ((EQ=function(t){function e(){var e;return(e=t.call(this)||this)._size=AQ&&AQ(),e._luminanceHDR=RQ&&RQ(),e._luminanceLDR=bQ&&bQ(),e._term=CQ&&CQ(),e._range=wQ&&wQ(),e._lightType=PB,e}return s(e,t),e.prototype._createLight=function(){t.prototype._createLight.call(this),this._type=hx.SPHERE,this.size=this._size,this.range=this._range,this._light&&(this._light.luminanceHDR=this._luminanceHDR,this._light.luminanceLDR=this._luminanceLDR)},n(e,[{key:"luminousFlux",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR*Rx(this._size):this._luminanceLDR},set:function(t){var e=0;v.director.root.pipeline.pipelineSceneData.isHDR?(this._luminanceHDR=t/Rx(this._size),e=this._luminanceHDR):(this._luminanceLDR=t,e=this._luminanceLDR),this._light&&(this._light.luminance=e)}},{key:"luminance",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){v.director.root.pipeline.pipelineSceneData.isHDR?(this._luminanceHDR=t,this._light&&(this._light.luminanceHDR=this._luminanceHDR)):(this._luminanceLDR=t,this._light&&(this._light.luminanceLDR=this._luminanceLDR))}},{key:"term",get:function(){return this._term},set:function(t){this._term=t}},{key:"size",get:function(){return this._size},set:function(t){this._size=t,this._light&&(this._light.size=t)}},{key:"range",get:function(){return this._range},set:function(t){this._range=t,this._light&&(this._light.range=t)}}]),e}(TZ),AQ=Gs(EQ.prototype,"_size",[ra],(function(){return.15})),RQ=Gs(EQ.prototype,"_luminanceHDR",[ra,pQ],(function(){return 1700/Rx(.15)})),bQ=Gs(EQ.prototype,"_luminanceLDR",[ra],(function(){return 1700/Rx(.15)*jw.standardExposureValue*jw.standardLightMeterScale})),CQ=Gs(EQ.prototype,"_term",[ra],(function(){return vZ.LUMINOUS_FLUX})),wQ=Gs(EQ.prototype,"_range",[ra],(function(){return 1})),f(EQ.prototype,"luminousFlux",[mQ],Object.getOwnPropertyDescriptor(EQ.prototype,"luminousFlux"),EQ.prototype),f(EQ.prototype,"luminance",[gQ],Object.getOwnPropertyDescriptor(EQ.prototype,"luminance"),EQ.prototype),f(EQ.prototype,"term",[vQ],Object.getOwnPropertyDescriptor(EQ.prototype,"term"),EQ.prototype),f(EQ.prototype,"size",[yQ],Object.getOwnPropertyDescriptor(EQ.prototype,"size"),EQ.prototype),f(EQ.prototype,"range",[TQ],Object.getOwnPropertyDescriptor(EQ.prototype,"range"),EQ.prototype),SQ=EQ))||SQ)),wZ=xa,xZ=ra,IZ=sa,OZ=$s,DZ=t("ab",(xQ=qs("cc.SpotLight"),IQ=IZ("_luminance"),OQ=wZ(vZ),DQ=wZ(qe),MQ=OZ({group:{name:"DynamicShadowSettings",displayOrder:1}}),PQ=wZ(Qe),BQ=OZ({group:{name:"DynamicShadowSettings",displayOrder:2}}),NQ=wZ(PS),LQ=OZ({group:{name:"DynamicShadowSettings",displayOrder:3}}),FQ=wZ(qe),kQ=OZ({group:{name:"DynamicShadowSettings",displayOrder:4}}),UQ=wZ(qe),xQ((HQ=function(t){function e(){var e;return(e=t.call(this)||this)._size=zQ&&zQ(),e._luminanceHDR=VQ&&VQ(),e._luminanceLDR=WQ&&WQ(),e._term=XQ&&XQ(),e._range=jQ&&jQ(),e._spotAngle=YQ&&YQ(),e._shadowEnabled=KQ&&KQ(),e._shadowPcf=qQ&&qQ(),e._shadowBias=QQ&&QQ(),e._shadowNormalBias=ZQ&&ZQ(),e._lightType=GB,e}return s(e,t),e.prototype._createLight=function(){if(t.prototype._createLight.call(this),this._type=hx.SPOT,this.size=this._size,this.range=this._range,this.spotAngle=this._spotAngle,this._light){var e=this._light;e.luminanceHDR=this._luminanceHDR,e.luminanceLDR=this._luminanceLDR,e.shadowEnabled=this._shadowEnabled,e.shadowPcf=this._shadowPcf,e.shadowBias=this._shadowBias,e.shadowNormalBias=this._shadowNormalBias}},n(e,[{key:"luminousFlux",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR*Rx(this._size):this._luminanceLDR},set:function(t){var e=0;v.director.root.pipeline.pipelineSceneData.isHDR?(this._luminanceHDR=t/Rx(this._size),e=this._luminanceHDR):(this._luminanceLDR=t,e=this._luminanceLDR),this._light&&(this._light.luminance=e)}},{key:"luminance",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){v.director.root.pipeline.pipelineSceneData.isHDR?(this._luminanceHDR=t,this._light&&(this._light.luminanceHDR=this._luminanceHDR)):(this._luminanceLDR=t,this._light&&(this._light.luminanceLDR=this._luminanceLDR))}},{key:"term",get:function(){return this._term},set:function(t){this._term=t}},{key:"size",get:function(){return this._size},set:function(t){this._size=t,this._light&&(this._light.size=t)}},{key:"range",get:function(){return this._range},set:function(t){this._range=t,this._light&&(this._light.range=t)}},{key:"spotAngle",get:function(){return this._spotAngle},set:function(t){this._spotAngle=t,this._light&&(this._light.spotAngle=Mi(t))}},{key:"shadowEnabled",get:function(){return this._shadowEnabled},set:function(t){this._shadowEnabled=t,this._light&&(this._light.shadowEnabled=t)}},{key:"shadowPcf",get:function(){return this._shadowPcf},set:function(t){this._shadowPcf=t,this._light&&(this._light.shadowPcf=t)}},{key:"shadowBias",get:function(){return this._shadowBias},set:function(t){this._shadowBias=t,this._light&&(this._light.shadowBias=t)}},{key:"shadowNormalBias",get:function(){return this._shadowNormalBias},set:function(t){this._shadowNormalBias=t,this._light&&(this._light.shadowNormalBias=t)}}]),e}(TZ),zQ=Gs(HQ.prototype,"_size",[xZ],(function(){return.15})),VQ=Gs(HQ.prototype,"_luminanceHDR",[xZ,IQ],(function(){return 1700/Rx(.15)})),WQ=Gs(HQ.prototype,"_luminanceLDR",[xZ],(function(){return 1700/Rx(.15)*jw.standardExposureValue*jw.standardLightMeterScale})),XQ=Gs(HQ.prototype,"_term",[xZ],(function(){return vZ.LUMINOUS_FLUX})),jQ=Gs(HQ.prototype,"_range",[xZ],(function(){return 1})),YQ=Gs(HQ.prototype,"_spotAngle",[xZ],(function(){return 60})),KQ=Gs(HQ.prototype,"_shadowEnabled",[xZ],(function(){return!1})),qQ=Gs(HQ.prototype,"_shadowPcf",[xZ],(function(){return PS.HARD})),QQ=Gs(HQ.prototype,"_shadowBias",[xZ],(function(){return 1e-5})),ZQ=Gs(HQ.prototype,"_shadowNormalBias",[xZ],(function(){return 0})),f(HQ.prototype,"term",[OQ],Object.getOwnPropertyDescriptor(HQ.prototype,"term"),HQ.prototype),f(HQ.prototype,"size",[DQ],Object.getOwnPropertyDescriptor(HQ.prototype,"size"),HQ.prototype),f(HQ.prototype,"shadowEnabled",[MQ,PQ],Object.getOwnPropertyDescriptor(HQ.prototype,"shadowEnabled"),HQ.prototype),f(HQ.prototype,"shadowPcf",[BQ,NQ],Object.getOwnPropertyDescriptor(HQ.prototype,"shadowPcf"),HQ.prototype),f(HQ.prototype,"shadowBias",[LQ,FQ],Object.getOwnPropertyDescriptor(HQ.prototype,"shadowBias"),HQ.prototype),f(HQ.prototype,"shadowNormalBias",[kQ,UQ],Object.getOwnPropertyDescriptor(HQ.prototype,"shadowNormalBias"),HQ.prototype),GQ=HQ))||GQ));t("ac",(JQ=qs("cc.PointLight"),$Q=sa("_luminance"),tZ=xa(Ke),eZ=xa(Ke),iZ=xa(vZ),nZ=xa(qe),JQ((sZ=function(t){function e(){var e;return(e=t.call(this)||this)._luminanceHDR=aZ&&aZ(),e._luminanceLDR=oZ&&oZ(),e._term=hZ&&hZ(),e._range=uZ&&uZ(),e._lightType=HB,e}return s(e,t),e.prototype._createLight=function(){t.prototype._createLight.call(this),this._type=hx.POINT,this.range=this._range,this._light&&(this._light.luminanceHDR=this._luminanceHDR,this._light.luminanceLDR=this._luminanceLDR)},n(e,[{key:"luminousFlux",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR*Rx(1):this._luminanceLDR},set:function(t){var e=0;v.director.root.pipeline.pipelineSceneData.isHDR?(this._luminanceHDR=t/Rx(1),e=this._luminanceHDR):(this._luminanceLDR=t,e=this._luminanceLDR),this._light&&(this._light.luminance=e)}},{key:"luminance",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){v.director.root.pipeline.pipelineSceneData.isHDR?(this._luminanceHDR=t,this._light&&(this._light.luminanceHDR=this._luminanceHDR)):(this._luminanceLDR=t,this._light&&(this._light.luminanceLDR=this._luminanceLDR))}},{key:"term",get:function(){return this._term},set:function(t){this._term=t}},{key:"range",get:function(){return this._range},set:function(t){this._range=t,this._light&&(this._light.range=t)}}]),e}(TZ),aZ=Gs(sZ.prototype,"_luminanceHDR",[ra,$Q],(function(){return 1700/Rx(.15)})),oZ=Gs(sZ.prototype,"_luminanceLDR",[ra],(function(){return 1700/Rx(.15)*jw.standardExposureValue*jw.standardLightMeterScale})),hZ=Gs(sZ.prototype,"_term",[ra],(function(){return vZ.LUMINOUS_FLUX})),uZ=Gs(sZ.prototype,"_range",[ra],(function(){return 1})),f(sZ.prototype,"luminousFlux",[tZ],Object.getOwnPropertyDescriptor(sZ.prototype,"luminousFlux"),sZ.prototype),f(sZ.prototype,"luminance",[eZ],Object.getOwnPropertyDescriptor(sZ.prototype,"luminance"),sZ.prototype),f(sZ.prototype,"term",[iZ],Object.getOwnPropertyDescriptor(sZ.prototype,"term"),sZ.prototype),f(sZ.prototype,"range",[nZ],Object.getOwnPropertyDescriptor(sZ.prototype,"range"),sZ.prototype),rZ=sZ))||rZ)),t("ad",(lZ=qs("cc.RangedDirectionalLight"),cZ=sa("_illuminance"),_Z=xa(Ke),lZ((fZ=function(t){function e(){var e;return(e=t.call(this)||this)._illuminanceHDR=pZ&&pZ(),e._illuminanceLDR=mZ&&mZ(),e._lightType=VB,e}return s(e,t),e.prototype._createLight=function(){t.prototype._createLight.call(this),this._type=hx.RANGED_DIRECTIONAL,this._light&&(this._light.illuminanceHDR=this._illuminanceHDR,this._light.illuminanceLDR=this._illuminanceLDR)},n(e,[{key:"illuminance",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR?this._illuminanceHDR:this._illuminanceLDR},set:function(t){v.director.root.pipeline.pipelineSceneData.isHDR?(this._illuminanceHDR=t,this._light&&(this._light.illuminanceHDR=this._illuminanceHDR)):(this._illuminanceLDR=t,this._light&&(this._light.illuminanceLDR=this._illuminanceLDR))}}]),e}(TZ),pZ=Gs(fZ.prototype,"_illuminanceHDR",[$s,cZ],(function(){return 65e3})),mZ=Gs(fZ.prototype,"_illuminanceLDR",[ra],(function(){return 65e3*jw.standardExposureValue})),f(fZ.prototype,"illuminance",[_Z],Object.getOwnPropertyDescriptor(fZ.prototype,"illuminance"),fZ.prototype),dZ=fZ))||dZ)),v.LightComponent=TZ,Jt(TZ,"cc.LightComponent"),v.DirectionalLightComponent=bZ,Jt(bZ,"cc.DirectionalLightComponent"),v.SphereLightComponent=CZ,Jt(CZ,"cc.SphereLightComponent"),v.SpotLightComponent=DZ,Jt(DZ,"cc.SpotLightComponent"),rt(DZ.prototype,"SpotLight.prototype",[{name:"luminousPower",newName:"luminousFlux",customGetter:function(){return this.luminousFlux},customSetter:function(t){this.luminousFlux=t}}]),rt(CZ.prototype,"SphereLight.prototype",[{name:"luminousPower",newName:"luminousFlux",customGetter:function(){return this.luminousFlux},customSetter:function(t){this.luminousFlux=t}}]),rt(TZ.PhotometricTerm,"Light.PhotometricTerm",[{name:"LUMINOUS_POWER",newName:"LUMINOUS_FLUX"}]);var MZ=Symbol("BakeNodeCurves"),PZ=function(){function t(){}return t.getOrExtract=function(e){var i=t.pool.get(e);if(!i||i.samples!==e.sample){i&&v.director.root.dataPoolManager.releaseAnimationClip(e);var n=Math.ceil(e.sample*e.duration)+1,r=e.sample;i=e[MZ](0,r,n),t.pool.set(e,i)}return i},t.destroy=function(e){t.pool.delete(e)},t}();PZ.pool=new Map;var BZ=new Dn;function NZ(t,e,i){for(Dn.identity(i);t!==e;)Dn.fromRTS(BZ,t.rotation,t.position,t.scale),Dn.multiply(i,BZ,i),t=t.parent;return i}var LZ=new i_(sc.POINT,sc.POINT,sc.NONE,ac.CLAMP,ac.CLAMP,ac.CLAMP),FZ=function(t,e,i){t[e+0]=i.m00,t[e+1]=i.m01,t[e+2]=i.m02,t[e+3]=i.m12,t[e+4]=i.m04,t[e+5]=i.m05,t[e+6]=i.m06,t[e+7]=i.m13,t[e+8]=i.m08,t[e+9]=i.m09,t[e+10]=i.m10,t[e+11]=i.m14};function kZ(t,e){var i=4/Math.sqrt(e);return 12*Math.ceil(Math.max(480*i,t)/12)}new En,new En,new hn,new En,new hn;var UZ=new hn,GZ=new hn,HZ=new hn,zZ=new hn,VZ=new Dn,WZ=new Dn,XZ=new Es,jZ=Number.MAX_SAFE_INTEGER;!function(){function t(t){this._device=void 0,this._pool=void 0,this._textureBuffers=new Map,this._formatSize=void 0,this._pixelsPerJoint=void 0,this._customPool=void 0,this._chunkIdxMap=new Map,this._device=t;var e=function(t){return t.getFormatFeatures(jl.RGBA32F)&ic.SAMPLED_TEXTURE?jl.RGBA32F:jl.RGBA8}(this._device);this._formatSize=F_[e].size,this._pixelsPerJoint=48/this._formatSize,this._pool=new OG(t),this._pool.initialize({format:e,roundUpFn:kZ}),this._customPool=new OG(t),this._customPool.initialize({format:e,roundUpFn:kZ})}var e=t.prototype;e.clear=function(){this._pool.destroy(),this._textureBuffers.clear()},e.registerCustomTextureLayouts=function(t){for(var e=0;e0&&t.refCount--,!t.refCount&&t.readyToBeDeleted){var e=t.skeletonHash^t.clipHash;(void 0!==this._chunkIdxMap.get(e)?this._customPool:this._pool).free(t.handle),this._textureBuffers.get(e)===t&&this._textureBuffers.delete(e)}},e.releaseSkeleton=function(t){for(var e=this._textureBuffers.values(),i=e.next();!i.done;){var n=i.value;n.skeletonHash===t.hash&&(n.readyToBeDeleted=!0,n.refCount?this._textureBuffers.delete(n.skeletonHash^n.clipHash):this.releaseHandle(n)),i=e.next()}},e.releaseAnimationClip=function(t){for(var e=this._textureBuffers.values(),i=e.next();!i.done;){var n=i.value;n.clipHash===t.hash&&(n.readyToBeDeleted=!0,n.refCount?this._textureBuffers.delete(n.skeletonHash^n.clipHash):this.releaseHandle(n)),i=e.next()}},e._createAnimInfos=function(t,e,i){for(var n=[],r=t.joints,s=t.bindposes,a=r.length,o=PZ.getOrExtract(e),h=0;h0;){t=YZ[--i],YZ[i]=null;var r=t.node;Dn.fromRTS(t.local,r.rotation,r.position,r.scale),n=Dn.multiply(t.world,n,t.local)}return n}function QZ(t,e){for(var i,n=null,r=0;t!==e;){var s=t.uuid;if(KZ.has(s)){n=KZ.get(s);break}n={node:t,local:new Dn,world:new Dn,stamp:-1,parent:null},KZ.set(s,n),YZ[r++]=n,t=t.parent,n=null}for(;r>0;)i=YZ[--r],YZ[r]=null,i.parent=n,n=i;return n}function ZZ(t){for(var e=KZ.get(t.uuid)||null;e;)KZ.delete(e.node.uuid),e=e.parent}var JZ=[{name:"CC_USE_SKINNING",value:!0},{name:"CC_USE_REAL_TIME_JOINT_TEXTURE",value:!1}],$Z=[{name:"CC_USE_SKINNING",value:!0},{name:"CC_USE_REAL_TIME_JOINT_TEXTURE",value:!0}];function tJ(t,e,i,n){for(var r=0;r=0&&(e.push(r),t.push(a))}}var eJ=new hn,iJ=new hn,nJ=new hn,rJ=new hn,sJ=new Dn,aJ=new Es,oJ=function(){this._format=lf.RGBA32F,this._textures=[],this._buffers=[]};oJ.WIDTH=256,oJ.HEIGHT=3;var hJ,uJ,lJ,cJ,_J,dJ,fJ,pJ,mJ,gJ,vJ,yJ,TJ,SJ,EJ,AJ,RJ,bJ,CJ,wJ,xJ,IJ,OJ,DJ,MJ,PJ,BJ,NJ,LJ,FJ,kJ,UJ,GJ=function(t){function e(){var e;return(e=t.call(this)||this)._buffers=[],e._dataArray=[],e._joints=[],e._bufferIndices=null,e._realTimeJointTexture=new oJ,e._realTimeTextureMode=!1,e.type=mB.SKINNING,e}s(e,t);var i=e.prototype;return i.destroy=function(){if(this.bindSkeleton(),this._buffers.length){for(var e=0;e=0?a.instancedAttributeBlock.views[r][0]=i.data[0]:n=!0}return n&&i.dirty&&(i.buffer.update(i.data),i.dirty=!1),!0},i.getMacroPatches=function(e){var i=t.prototype.getMacroPatches.call(this,e);return i?i.concat(HJ):HJ},i.uploadAnimation=function(t){if(this._skeleton&&this._mesh&&this.uploadedAnim!==t){this.uploadedAnim=t;var e=this._dataPoolManager,i=null;t?(i=e.jointTexturePool.getSequencePoseTexture(this._skeleton,t,this._mesh,this.transform),this._jointsMedium.boundsInfo=i&&i.bounds.get(this._mesh.hash),this._modelBounds=null):(i=e.jointTexturePool.getDefaultPoseTexture(this._skeleton,this._mesh,this.transform),this._jointsMedium.boundsInfo=null,this._modelBounds=i&&i.bounds.get(this._mesh.hash)[0]),this._applyJointTexture(i)}},i._applyJointTexture=function(t){void 0===t&&(t=null);var e=this._jointsMedium.texture;if(e&&e!==t&&this._dataPoolManager.jointTexturePool.releaseHandle(e),this._jointsMedium.texture=t,t){var i=this._jointsMedium,n=i.buffer,r=i.jointTextureInfo;r[0]=t.handle.texture.width,r[1]=this._skeleton.joints.length,r[2]=t.pixelOffset+.1,r[3]=1/r[0],this.updateInstancedJointTextureInfo(),n&&n.update(r);for(var s=t.handle.texture,a=0;a=0&&s.length>0){var a=s[n];a[0]=i.data[0],a[1]=e[1],a[2]=e[2]}}},e}(RK),VJ=t("ae",(hJ=qs("cc.SkinnedMeshRenderer"),uJ=Zs(100),lJ=xa(oq),cJ=xa($m),_J=xa(oq),dJ=xa($m),hJ(fJ=uJ((pJ=function(t){function e(){var e;return(e=t.call(this)||this)._skeleton=mJ&&mJ(),e._skinningRoot=gJ&&gJ(),e._clip=null,e.associatedAnimation=null,e._modelType=zJ,e}s(e,t);var i=e.prototype;return i.onLoad=function(){t.prototype.onLoad.call(this),this._tryBindAnimation()},i.onDestroy=function(){this.associatedAnimation&&(this.associatedAnimation.notifySkinnedMeshRemoved(this),this.associatedAnimation),t.prototype.onDestroy.call(this)},i.uploadAnimation=function(t){this._clip=t,this.model&&this.model.uploadAnimation&&this.model.uploadAnimation(t)},i.setUseBakedAnimation=function(t,e){void 0===t&&(t=!0),void 0===e&&(e=!1);var i=t?zJ:GJ;(e||this._modelType!==i)&&(this._modelType=i,this._model&&(v.director.root.destroyModel(this._model),this._model=null,this._models.length=0,this._updateModels(),this._updateCastShadow(),this._updateReceiveShadow(),this._updateUseLightProbe(),this.enabledInHierarchy&&this._attachToScene()))},i.setSharedMaterial=function(e,i){t.prototype.setSharedMaterial.call(this,e,i),this._modelType===GJ&&this.getMaterialInstance(i)},i._updateModelParams=function(){this._update(),t.prototype._updateModelParams.call(this)},i._tryBindAnimation=function(){var t=this._skinningRoot;if(t){for(var e=!1,i=this.node;i;i=i.parent)if(i===t){e=!0;break}if(e){var n=t.getComponent("cc.SkeletalAnimation");n&&n.enabledInHierarchy?n.notifySkinnedMeshAdded(this):this.setUseBakedAnimation(!1)}}},i._update=function(){this.model&&(this.model.bindSkeleton(this._skeleton,this._skinningRoot,this._mesh),this.model.uploadAnimation&&this.model.uploadAnimation(this._clip))},n(e,[{key:"skeleton",get:function(){return this._skeleton},set:function(t){t!==this._skeleton&&(this._skeleton=t,this._update())}},{key:"skinningRoot",get:function(){return this._skinningRoot},set:function(t){t!==this._skinningRoot&&(this._skinningRoot=t,this._tryBindAnimation(),this._update())}},{key:"model",get:function(){return this._model}}]),e}(VK),mJ=Gs(pJ.prototype,"_skeleton",[lJ],(function(){return null})),gJ=Gs(pJ.prototype,"_skinningRoot",[cJ],(function(){return null})),f(pJ.prototype,"skeleton",[_J],Object.getOwnPropertyDescriptor(pJ.prototype,"skeleton"),pJ.prototype),f(pJ.prototype,"skinningRoot",[dJ],Object.getOwnPropertyDescriptor(pJ.prototype,"skinningRoot"),pJ.prototype),fJ=pJ))||fJ)||fJ)),WJ=new __(Mc.ATTR_BATCH_ID,jl.R32F),XJ=new __(Mc.ATTR_BATCH_UV,jl.RG32F),jJ=F_[WJ.format].size+F_[XJ.format].size,YJ=t("ag",(vJ=qs("cc.SkinnedMeshUnit"),yJ=xa(QL),TJ=xa(oq),SJ=xa(OS),EJ=xa(VJ),vJ((RJ=function(){function t(){this.mesh=bJ&&bJ(),this.skeleton=CJ&&CJ(),this.material=wJ&&wJ(),this._localTransform=xJ&&xJ(),this._offset=IJ&&IJ(),this._size=OJ&&OJ()}return n(t,[{key:"offset",get:function(){return this._offset},set:function(t){Fn.copy(this._offset,t)}},{key:"size",get:function(){return this._size},set:function(t){Fn.copy(this._size,t)}},{key:"copyFrom",get:function(){return null},set:function(t){t&&(this.mesh=t.mesh,this.skeleton=t.skeleton,this.material=t.getSharedMaterial(0),t.skinningRoot&&NZ(t.node,t.skinningRoot,this._localTransform))}}]),t}(),bJ=Gs(RJ.prototype,"mesh",[yJ],(function(){return null})),CJ=Gs(RJ.prototype,"skeleton",[TJ],(function(){return null})),wJ=Gs(RJ.prototype,"material",[SJ],(function(){return null})),xJ=Gs(RJ.prototype,"_localTransform",[ra],(function(){return new Dn})),IJ=Gs(RJ.prototype,"_offset",[ra],(function(){return new Fn(0,0)})),OJ=Gs(RJ.prototype,"_size",[ra],(function(){return new Fn(1,1)})),f(RJ.prototype,"copyFrom",[EJ],Object.getOwnPropertyDescriptor(RJ.prototype,"copyFrom"),RJ.prototype),AJ=RJ))||AJ)),KJ=new Dn;new Dn;var qJ,QJ,ZJ,JJ,$J,t$,e$,i$,n$,r$,s$,a$,o$,h$,u$,l$,c$,_$=new hn,d$=t("af",(DJ=qs("cc.SkinnedMeshBatchRenderer"),MJ=Zs(100),PJ=xa([Ze]),BJ=xa([YJ]),DJ(NJ=MJ((LJ=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r=Kl.SAMPLER1D){var s=null;t.batchableTextureNames.find((function(t){return t===i}))?((s=t._textures[i])||(s=t.createTexture(i)),t.cookTextures(s,i,n)):t.units.some((function(t){return s=t.material&&t.material.getProperty(i,n)})),s&&e.setProperty(i,s,n)}else{for(var a=[],o=0;o=0)return 1;t.push(i),e.push(Dn.multiply(new Dn,r.bindposes[a]||Dn.IDENTITY,KJ))},a=0;at[i]?1:t[e]0&&d.copyBuffersToTexture(s,_,a),n.length>0&&d.copyTexImagesToTexture(n,_,r)},i.createTexture=function(t){var e=new em;return e.setFilters(_f.LINEAR,_f.LINEAR),e.setMipFilter(_f.NEAREST),e.reset({width:this.atlasSize,height:this.atlasSize,format:lf.RGBA8888}),this._textures[t]=e,e},i.resizeAtlases=function(){for(var t in this._textures)this._textures[t].reset({width:this.atlasSize,height:this.atlasSize,format:lf.RGBA8888})},i._createUnitMesh=function(t,e){for(var i=JSON.parse(JSON.stringify(e.struct)),n={},r=0;rthis._renderers.length)&&(t=this._renderers.length),this._renderers.splice(t,0,e);var i=!1;return e.model&&(i=!0,this._LODData.addModel(e.model)),this._modelAddedCallback&&i&&this._modelAddedCallback(),e},e.deleteRenderer=function(t){var e,i=this._renderers.splice(t,1),n=i.length>0?null===(e=i[0])||void 0===e?void 0:e.model:null;return n&&this._LODData.eraseModel(n),i[0]},e.getRenderer=function(t){return this._renderers[t]||null},e.setRenderer=function(t,e){t<0||t>=this.rendererCount?console.error("setRenderer to LOD error, index out of range"):(this.deleteRenderer(t),this.insertRenderer(t,e))},n(t,[{key:"screenUsagePercentage",get:function(){return this._screenUsagePercentage},set:function(t){this._screenUsagePercentage=t,this._LODData.screenUsagePercentage=t}},{key:"renderers",get:function(){return this._renderers},set:function(t){if(t!==this._renderers){var e=!1;this._renderers.length=0,this._LODData.clearModels();for(var i=0;ithis.lodCount)&&(t=this.lodCount),i||(i=new p$),i.modelAddedCallback=this.onLodModelAddedCallback.bind(this),!e){var n=this.getLOD(t-1),r=this.getLOD(t);if(n&&r)e=(n.screenUsagePercentage+r.screenUsagePercentage)/2;else if(n&&!r)(e=n.screenUsagePercentage/2)>.01&&(e=.01);else if(r&&!n){e=r.screenUsagePercentage;var s=this.getLOD(t+1);r.screenUsagePercentage=(e+(s?s.screenUsagePercentage:0))/2}else e=f$[0]}return i.screenUsagePercentage=e,this._LODs.splice(t,0,i),this._lodGroup.insertLOD(t,i.lodData),this._updateDataToScene(),this.node&&this._emitChangeNode(this.node),i},i.eraseLOD=function(t){if(t<0||t>=this.lodCount)return console.warn("eraseLOD error, index out of range"),null;var e=this._LODs[t];return e?(this._LODs.splice(t,1),this._lodGroup.eraseLOD(t),this._updateDataToScene(),this._emitChangeNode(this.node),e):(console.warn("eraseLOD error, LOD not exist at specified index."),null)},i.getLOD=function(t){return t<0||t>=this.lodCount?(console.warn("getLOD error, index out of range"),null):this._LODs[t]},i.setLOD=function(t,e){t<0||t>=this.lodCount?console.warn("setLOD error, index out of range"):(this._LODs[t]=e,e.modelAddedCallback=this.onLodModelAddedCallback.bind(this),this.lodGroup.updateLOD(t,e.lodData),this._updateDataToScene())},i.recalculateBounds=function(){for(var t=new hn,e=new hn,i=null,n=new hn,r=0;r0&&this._lodGroup.lodCount<1&&this._LODs.forEach((function(e,i){e.lodData.screenUsagePercentage=e.screenUsagePercentage;var n=e.renderers;if(null!==n&&n.length>0)for(var r=0;r1?e[1]:null},e._getModelsByProbe=function(t){var e=[],i=this._useCubeModels;t.probeType===rx.PLANAR&&(i=this._usePlanarModels);for(var n,r=d(i.entries());!(n=r()).done;){var s=n.value;s[1]===t&&e.push(s[0])}return e},e._removeDependentModels=function(t){for(var e,i=d(this._useCubeModels.keys());!(e=i()).done;){var n=e.value,r=this._useCubeModels.get(n);void 0!==r&&r===t&&(this._useCubeModels.delete(n),this.selectReflectionProbe(n))}for(var s,a=d(this._usePlanarModels.keys());!(s=a()).done;){var o=s.value,h=this._usePlanarModels.get(o);void 0!==h&&h===t&&(this._usePlanarModels.delete(o),this.selectPlanarReflectionProbe(o))}},e._updateCubemapOfModel=function(t,e){var i=t.node;if(i){var n=i.getComponent(VK);if(n&&(n.updateProbeCubemap(e?e.cubemap:null),n.updateReflectionProbeId(e&&e.cubemap?e.getProbeId():-1),e&&(n.updateReflectionProbeDataMap(this._dataTexture),this._isUsedBlending(t)))){var r=this._getBlendProbe(t);this._updateBlendProbeInfo(t,e,r)}}},e._updatePlanarMapOfModel=function(t,e,i){var n=t.node.getComponent(VK);n&&(n.updateProbePlanarMap(e),i?(n.updateReflectionProbeId(i.getProbeId()),n.updateReflectionProbeDataMap(this._dataTexture)):n.updateReflectionProbeId(-1))},e._isUsedBlending=function(t){return t.reflectionProbeType===_B.BLEND_PROBES||t.reflectionProbeType===_B.BLEND_PROBES_AND_SKYBOX},e._updateBlendProbeInfo=function(t,e,i){var n=t.node;if(n){var r=n.getComponent(VK);r&&(i?(r.updateReflectionProbeBlendId(i.getProbeId()),r.updateProbeBlendCubemap(i.cubemap),r.updateReflectionProbeBlendWeight(this._calculateBlendWeight(t,e,i))):(r.updateReflectionProbeBlendId(-1),t.reflectionProbeType===_B.BLEND_PROBES_AND_SKYBOX&&r.updateReflectionProbeBlendWeight(this._calculateBlendWeight(t,e,i))))}},e._updateBlendCubemap=function(t,e){var i=t.node;if(i&&this._isUsedBlending(t)){var n=i.getComponent(VK);n&&n.updateProbeBlendCubemap(e.cubemap)}},e._calculateBlendWeight=function(t,e,i){if(i){var n=hn.distance(t.node.worldPosition,e.node.worldPosition),r=hn.distance(t.node.worldPosition,i.node.worldPosition);return 1-r/(n+r)}return t.reflectionProbeType===_B.BLEND_PROBES?0:t.reflectionProbeType===_B.BLEND_PROBES_AND_SKYBOX?this._calculateBlendOfSkybox(t.worldBounds,e.boundingBox):0},e._calculateBlendOfSkybox=function(t,e){if(!t)return 1;var i=new hn,n=new hn,r=new hn,s=new hn;if(hn.subtract(i,t.center,t.halfExtents),hn.add(n,t.center,t.halfExtents),hn.subtract(r,e.center,e.halfExtents),hn.add(s,e.center,e.halfExtents),i.x<=s.x&&n.x>=r.x&&i.y<=s.y&&n.y>=r.y&&i.z<=s.z&&n.z>=r.z){var a=new hn;hn.multiplyScalar(a,t.halfExtents,2);var o=i.x+a.x<=s.x&&n.x+a.x>=r.x,h=i.x-a.x<=s.x&&n.x-a.x>=r.x,u=i.y+a.y<=s.y&&n.y+a.y>=r.y,l=i.y-a.y<=s.y&&n.y-a.y>=r.y,c=i.z+a.z<=s.z&&n.z+a.z>=r.z,_=i.z-a.z<=s.z&&n.z-a.z>=r.z,d=[];if(!o){var f=n.x-s.x;d.push(f/a.x)}if(!h){var p=Math.abs(i.x-r.x);d.push(p/a.x)}if(!u){var m=n.y-s.y;d.push(m/a.y)}if(!l){var g=Math.abs(i.y-r.y);d.push(g/a.y)}if(!c){var v=n.z-s.z;d.push(v/a.z)}if(!_){var y=Math.abs(i.z-r.z);d.push(y/a.z)}return d.length>0?(d.sort((function(t,e){return e-t})),d[0]):0}return 1},n(t,[{key:"updateForRuntime",get:function(){return this._updateForRuntime},set:function(t){this._updateForRuntime=t}}]),t}());function v$(t){return void 0===(t=t||{}).includeNormal&&(t.includeNormal=!0),void 0===t.includeUV&&(t.includeUV=!0),t}g$.probeManager=void 0,g$.probeManager=new g$,v.internal.reflectionProbeManager=g$.probeManager;var y$=new hn,T$=new hn,S$=new hn,E$=new hn,A$=new hn,R$=new hn,b$=new hn,C$=new hn,w$=new hn,x$=new hn,I$=new hn,O$=new hn,D$=new hn(0,0,0),M$=new hn(0,0,0);function P$(t,e,i,n){void 0===t&&(t=.5),void 0===e&&(e=.5),void 0===i&&(i=2),void 0===n&&(n={});var r=.5*i,s=n.radialSegments||32,a=n.heightSegments||1,o=void 0===n.capped||n.capped,h=n.arc||2*Math.PI,u=0;o||(t>0&&u++,e>0&&u++);var l=(s+1)*(a+1);o&&(l+=(s+1)*u+s*u);var c=s*a*6;o&&(c+=s*u*3);var _=new Array(c),d=new Array(3*l),f=new Array(3*l),p=new Array(2*l),m=Math.max(t,e),g=new hn(-m,-r,-m),v=new hn(m,r,m),y=Math.sqrt(m*m+r*r),T=0,S=0;return function(){for(var n=[],o=t-e,u=o*o/i*Math.sign(o),l=0;l<=a;l++){for(var c=[],m=l/a,g=m*o+e,v=0;v<=s;++v){var y=v/s,E=y*h,A=Math.sin(E),R=Math.cos(E);d[3*T]=g*A,d[3*T+1]=m*i-r,d[3*T+2]=g*R,hn.normalize(D$,hn.set(M$,A,-u,R)),f[3*T]=D$.x,f[3*T+1]=D$.y,f[3*T+2]=D$.z,p[2*T]=2*(1-y)%1,p[2*T+1]=m,c.push(T),++T}n.push(c)}for(var b=0;b0&&E(!1),t>0&&E(!0)),{positions:d,normals:f,uvs:p,indices:_,minPos:g,maxPos:v,boundingRadius:y};function E(i){for(var n=i?t:e,a=i?1:-1,o=T,u=1;u<=s;++u)d[3*T]=0,d[3*T+1]=r*a,d[3*T+2]=0,f[3*T]=0,f[3*T+1]=a,f[3*T+2]=0,p[2*T]=.5,p[2*T+1]=.5,++T;for(var l=T,c=0;c<=s;++c){var m=c/s*h,g=Math.cos(m),v=Math.sin(m);d[3*T]=n*v,d[3*T+1]=r*a,d[3*T+2]=n*g,f[3*T]=0,f[3*T+1]=a,f[3*T+2]=0,p[2*T]=.5-.5*v*a,p[2*T+1]=.5+.5*g,++T}for(var y=0;y0&&(n[n.length-1]=1),{positions:i,indices:n,minPos:{x:1,y:1,z:0},maxPos:{x:-1,y:-1,z:0},boundingRadius:1,primitiveMode:vc.TRIANGLE_FAN}},translate:function(t,e){for(var i=e.x||0,n=e.y||0,r=e.z||0,s=Math.floor(t.positions.length/3),a=0;ah?h<<16|o:o<<16|h;void 0===r[u]&&(r[u]=0,n.push(o,h))}return t.indices=n,t.primitiveMode=vc.LINE_LIST,t},wireframe:function(t){for(var e=[[0,1],[1,2],[2,0]],i=[],n={},r=0;ro?o<<16|a:a<<16|o;void 0===n[h]&&(n[h]=0,i.push(a,o))}return i},invWinding:function(t){for(var e=[],i=0;i=3){e[0]=t[0],e[1]=t[1],e[2]=t[2];for(var n=t.length,r=3;r0&&(this._delayTime-=t,this._delayTime>0)||(this._currentFramePlayed?this.time+=t*this._speed:this._currentFramePlayed=!0,this._process())},i.sample=function(){var t=this.getWrappedInfo(this.time,this._wrappedInfo);return this._sampleCurves(t.time),this._sampleEvents(t),this._sampleEmbeddedPlayers(t),t},i.onPlay=function(){var t;this.setTime(this._getPlaybackStart()),this._delayTime=this._delay,this._onReplayOrResume(),this.emit(w0.PLAY,this),null===(t=this._clipEmbeddedPlayerEval)||void 0===t||t.notifyHostPlay(this.current)},i.onStop=function(){var t;this.isPaused||this._onPauseOrStop(),this.emit(w0.STOP,this),null===(t=this._clipEmbeddedPlayerEval)||void 0===t||t.notifyHostStop()},i.onResume=function(){var t;this._onReplayOrResume(),this.emit(w0.RESUME,this),null===(t=this._clipEmbeddedPlayerEval)||void 0===t||t.notifyHostPlay(this.current)},i.onPause=function(){var t;this._onPauseOrStop(),this.emit(w0.PAUSE,this),null===(t=this._clipEmbeddedPlayerEval)||void 0===t||t.notifyHostPause(this.current)},i._sampleCurves=function(t){var e=this._poseOutput,i=this._clipEval;e&&(e.weight=this.weight),i&&i.evaluate(t)},i._process=function(){this._useSimpleProcess?this.simpleProcess():this.process()},i.process=function(){var t,e=this.sample();this._allowLastFrame&&(t=this._lastWrapInfo?this._lastWrapInfo:this._lastWrapInfo=new x0(e),this.repeatCount>1&&(0|e.iterations)>(0|t.iterations)&&this.emit(w0.LASTFRAME,this),t.set(e)),e.stopped&&(this.stop(),this.emit(w0.FINISHED,this))},i.simpleProcess=function(){var t=this._playbackRange.min,e=this._playbackDuration,i=0,n=0;if(0!==e&&((i=this.time%e)<0&&(i+=e),n=(t+i)*this._invDuration),this._sampleCurves(t+i),this._clipEventEval||this._clipEmbeddedPlayerEval){var r=this.getWrappedInfo(this.time,this._wrappedInfo);this._sampleEvents(r),this._sampleEmbeddedPlayers(r)}this._allowLastFrame&&(Number.isNaN(this._lastIterations)&&(this._lastIterations=n),(this.time>0&&this._lastIterations>n||this.time<0&&this._lastIterations0&&(t-=1),1&t&&(i=!i)),(e&ou.Reverse)===ou.Reverse&&(i=!i),i},i.getWrappedInfo=function(t,e){e=e||new x0;var i=this._playbackRange.min,n=this._playbackDuration,r=this.repeatCount;if(0===n)return e.time=0,e.ratio=0,e.direction=1,e.stopped=!!Number.isFinite(r),e.iterations=0,e;var s=!1,a=(t-=i)>0?t/n:-t/n;if(a>=r){a=r,s=!0;var o=r-(0|r);0===o&&(o=1),t=o*n*(t>0?1:-1)}if(t>n){var h=t%n;t=0===h?n:h}else t<0&&0!=(t%=n)&&(t+=n);var u=!1,l=this._wrapMode&ou.ShouldWrap;l&&(u=this._needReverse(a));var c=u?-1:1;return this.speed<0&&(c*=-1),l&&u&&(t=n-t),e.time=i+t,e.ratio=e.time/this.duration,e.direction=c,e.stopped=s,e.iterations=a,e},i._getPlaybackStart=function(){return this._playbackRange.min},i._sampleEvents=function(t){var e;null===(e=this._clipEventEval)||void 0===e||e.sample(t.ratio,t.direction,t.iterations)},i._sampleEmbeddedPlayers=function(t){var e;null===(e=this._clipEmbeddedPlayerEval)||void 0===e||e.evaluate(t.time,Math.trunc(t.iterations))},i._emit=function(t,e){this._target&&this._target.isValid&&this._target.emit(t,t,e)},i._onReplayOrResume=function(){O0().addAnimation(this)},i._onPauseOrStop=function(){O0().removeAnimation(this)},n(e,[{key:"clip",get:function(){return this._clip}},{key:"name",get:function(){return this._name}},{key:"length",get:function(){return this.duration}},{key:"wrapMode",get:function(){return this._wrapMode},set:function(t){var e;this._wrapMode=t,this.time=0,t&ou.Loop?this.repeatCount=1/0:this.repeatCount=1,null===(e=this._clipEventEval)||void 0===e||e.setWrapMode(t)}},{key:"repeatCount",get:function(){return this._repeatCount},set:function(t){this._repeatCount=t;var e=this._wrapMode&ou.ShouldWrap,i=(this.wrapMode&ou.Reverse)===ou.Reverse;this._useSimpleProcess=t===1/0&&!e&&!i}},{key:"delay",get:function(){return this._delay},set:function(t){this._delayTime=this._delay=t}},{key:"playbackRange",get:function(){return this._playbackRange},set:function(t){t.max,t.min,this._playbackRange.min=Math.max(t.min,0),this._playbackRange.max=Math.min(t.max,this.duration),this._playbackDuration=this._playbackRange.max-this._playbackRange.min,this.setTime(0)}},{key:"speed",get:function(){return this._speed},set:function(t){var e;this._speed=t,null===(e=this._clipEmbeddedPlayerEval)||void 0===e||e.notifyHostSpeedChanged(t)}},{key:"current",get:function(){return this.getWrappedInfo(this.time).time}},{key:"ratio",get:function(){return 0===this.duration?0:this.current/this.duration}},{key:"weight",get:function(){return this._weight},set:function(t){this._weight=t,this._poseOutput&&(this._poseOutput.weight=t)}},{key:"curveLoaded",get:function(){return this._curveLoaded}}]),e}(C0));v.AnimationState=B0,qs("cc.animation.EmbeddedAnimationClipPlayable")((D0=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;re){var i;(i=this._channels).push.apply(i,Array.from({length:t-e},(function(){return new y1(new rh)})))}}}]),e}(v1),l1=Gs(u1.prototype,"_channels",[E1],(function(){return[]})),u1));var A1,R1,b1,C1,w1,x1,I1,O1,D1,M1,P1,B1,N1,L1,F1,k1,U1,G1,H1=function(){function t(t){this._curves=t,this._result=new Array(t.length).fill(0)}return t.prototype.evaluate=function(t){for(var e=this._result,i=e.length,n=0;n=t.passes.length)q(3941,t.name,e);else{var r=t.passes[e],s=r.getHandle(i);if(s){if(_S.getTypeFromHandle(s)1}return!1}(r,i)?{set:function(t){r.setUniformArray(a,t)}}:{set:function(t){r.setUniform(a,t)}}:void q(3943,t.name,e,i,n)}var o=_S.getBindingFromHandle(s),h=r.properties[i],u=h&&h.value?""+h.value+vy(h.type):gy(h.type),l=aS.get(u);return l||(U("Illegal texture default value: "+u+"."),l=aS.get("default-texture")),{set:function(t){t||(t=l);var e=t.getGFXTexture();e&&e.width&&e.height&&(r.bindTexture(o,e),t instanceof Lf&&r.bindSampler(o,wd.gfxDevice.getSampler(t.getSamplerInfo())))}}}q(3942,t.name,e,i)}}else q(3940,t)},t}(),b1=Gs(R1.prototype,"passIndex",[ra],(function(){return 0})),C1=Gs(R1.prototype,"uniformName",[ra],(function(){return""})),w1=f(R1.prototype,"channelIndex",[ba],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){}}),A1=R1))||A1,V1=qs("cc.animation.MorphWeightValueProxy")((I1=function(){function t(){this.subMeshIndex=O1&&O1(),this.shapeIndex=D1&&D1()}return t.prototype.forTarget=function(t){var e=this;return{set:function(i){t.setWeight(i,e.subMeshIndex,e.shapeIndex)}}},t}(),O1=Gs(I1.prototype,"subMeshIndex",[ra],(function(){return 0})),D1=Gs(I1.prototype,"shapeIndex",[ra],(function(){return 0})),x1=I1))||x1,W1=qs("cc.animation.MorphWeightsValueProxy")((P1=function(){function t(){this.subMeshIndex=B1&&B1()}return t.prototype.forTarget=function(t){var e=this;return{set:function(i){t.setWeights(i,e.subMeshIndex)}}},t}(),B1=Gs(P1.prototype,"subMeshIndex",[ra],(function(){return 0})),M1=P1))||M1,X1=qs("cc.animation.MorphWeightsAllValueProxy")(N1=function(){function t(){}return t.prototype.forTarget=function(t){return{set:function(e){for(var i,n,r=null!==(i=null===(n=t.mesh)||void 0===n?void 0:n.struct.primitives.length)&&void 0!==i?i:0,s=0;s1e-6){n=!1;break}this._findRatio=n?D2:Bs}return t.prototype.sample=function(t){return this._findRatio(this.ratios,t)},t}());v.RatioSampler=w2;var x2=t("ar",function(){function t(e,i){this.types=void 0,this.type=null,this._values=[],this._lerp=void 0,this._duration=void 0,this._array=void 0,this._duration=i,this._values=e.values;var n=function(e){return"string"==typeof e?e:Array.isArray(e)?e[0]===e[1]&&e[2]===e[3]?t.Linear:t.Bezier(e):t.Linear};if(void 0!==e.easingMethod)this.type=n(e.easingMethod);else if(Array.isArray(e.easingMethods))this.types=e.easingMethods.map(n);else if(void 0!==e.easingMethods){this.types=new Array(this._values.length).fill(null);for(var r=0,s=Object.keys(e.easingMethods);r=e.ratios.length))return t.valueBetween(i,n-1,e.ratios[n-1],n,e.ratios[n]);n=e.ratios.length-1}return t.valueAt(n)}function O2(t,e){if("string"==typeof e){var i=Yo[e];i?t=i(t):Z(3906,e)}else Array.isArray(e)&&(t=Uh(e,t));return t}function D2(t,e){var i=t.length-1;if(0===i)return 0;var n=t[0];if(er)return i;var s=(e=(e-n)/(r-n))/(1/i),a=0|s,o=1e-6;return s-a=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=s)a=n-1,o=0;else{var h=w3(t,e);a=h.index,o=h.ratio}var u=0,l=0;if(i=s)u=n-1,l=0;else{var c=w3(t,i);u=c.index,l=c.ratio}var _=!o,d=!l;a!==u||o!==l?(_||(this.preLerpIndex=a,this.preLerpRatio=o),this.directKeyframesBegin=_?a:a+1,this.directKeyframesEnd=u+1,d||(this.postLerpIndex=u,this.postLerpRatio=l)):_?(this.directKeyframesBegin=a,this.directKeyframesEnd=a+1):(this.preLerpIndex=a,this.preLerpRatio=o)}}},e._reset=function(){this.preLerpIndex=-1,this.preLerpRatio=0,this.directKeyframesBegin=0,this.directKeyframesEnd=0,this.postLerpIndex=-1,this.postLerpRatio=0},n(t,[{key:"keyframesCount",get:function(){var t=this.preLerpIndex,e=this.directKeyframesBegin;return 0+(t<0?0:1)+(this.directKeyframesEnd-e)+(this.postLerpIndex<0?0:1)}}])}();var x3,I3=function(){function t(t,e){this._nodeEvaluations=void 0,this._nodeEvaluations=t.map((function(t){return t.createEvaluator(e)}))}return t.prototype.evaluate=function(t){this._nodeEvaluations.forEach((function(e){e.evaluate(t)}))},t}(),O3=function(){function t(t,e,i,n,r){this._position=null,this._rotation=null,this._scale=null,e&&(this._position=z3(e.times,e.values,hn,t,"position",r)),i&&(this._rotation=z3(i.times,i.values,En,t,"rotation",r)),n&&(this._scale=z3(n.times,n.values,hn,t,"scale",r))}return t.prototype.evaluate=function(t){if(this._position){var e=this._position.evaluator.evaluate(t);this._position.runtimeBinding.setValue(e)}if(this._rotation){var i=this._rotation.evaluator.evaluate(t);this._rotation.runtimeBinding.setValue(i)}if(this._scale){var n=this._scale.evaluator.evaluate(t);this._scale.runtimeBinding.setValue(n)}},t}(),D3=function(){function t(t,e,i){this._times=void 0,this._inputSampleResultCache={just:!1,index:-1,nextIndex:-1,ratio:0},this._values=void 0,this._prevValue=void 0,this._nextValue=void 0,this._resultValue=void 0,this._times=t,this._values=e,this._prevValue=new i,this._nextValue=new i,this._resultValue=new i}return t.prototype.evaluate=function(t){var e=this._times,i=this._values,n=this._resultValue;if(0===e.length)return n;var r=function(t,e,i){var n=t.length,r=t[0],s=t[n-1];if(es)i.just=!0,i.index=n-1;else{var a=Bs(t,e);if(a>=0)i.just=!0,i.index=a;else{var o=~a,h=o-1,u=t[h],l=t[o],c=(e-t[h])/(l-u);i.just=!1,i.index=h,i.nextIndex=o,i.ratio=c}}return i}(e,t,this._inputSampleResultCache);return r.just?i.get(r.index,n):i.lerp(r.index,r.nextIndex,r.ratio,this._prevValue,this._nextValue,n),n},t}(),M3=function(){function t(t,e){this._nodeEvaluations=void 0,this._nodeEvaluations=t.map((function(t){return t.createEvaluatorForAnimationGraph(e)})).filter((function(t){return!!t}))}var e=t.prototype;return e.destroy=function(){for(var t=this._nodeEvaluations,e=t.length,i=0;i=0){var _=u.substring(0,c),d=h[_];d&&(l.parent=d)}}for(var f=this._createEvalWithBinder(void 0,(function(t){var e=t.parseTrsPath();if(e){var i=h[e.node];if(i)return O5(i,e.property)}}),void 0),p=0;p=0&&this._embeddedPlayers.splice(e,1)},i[v5]=function(){this._embeddedPlayers.length=0},i.getAuxiliaryCurveNames_experimental=function(){return this._auxiliaryCurveEntries.map((function(t){return t.name}))},i.hasAuxiliaryCurve_experimental=function(t){return!!this._findAuxiliaryCurveEntry(t)},i.addAuxiliaryCurve_experimental=function(t){var e=this._findAuxiliaryCurveEntry(t);return e||((e=new l5).name=t,this._auxiliaryCurveEntries.push(e)),e.curve},i.getAuxiliaryCurve_experimental=function(t){return this._findAuxiliaryCurveEntry(t).curve},i.renameAuxiliaryCurve_experimental=function(t,e){var i=this._findAuxiliaryCurveEntry(t);i&&(i.name=e)},i.removeAuxiliaryCurve_experimental=function(t){ce(this._auxiliaryCurveEntries,(function(e){return e.name===t}))},i._trySyncLegacyData=function(){this._legacyDataDirty&&(this._legacyDataDirty=!1,this.syncLegacyData())},i._createEvalWithBinder=function(t,e,i){this._legacyDataDirty&&(this._legacyDataDirty=!1,this.syncLegacyData());var n,r=[];i&&(n=this._createRootMotionEvaluation(t,i,r));for(var s,a=[],o=this._tracks,h=o.length,u=0;u=c&&t<=_?o?e!==u&&(h.stop(),h.play(),a.entered=!0):(h.play(),a.entered=!0):o&&(h.stop(),a.entered=!1),a.lastIterations=e,a.entered){var d=t-c;a.instantiatedPlayer.setTime(d)}}}},e.notifyHostSpeedChanged=function(t){for(var e=this._embeddedPlayers,i=this._embeddedPlayerEvaluationInfos,n=e.length,r=0;r0?((s&ou.PingPong)===ou.PingPong?e*=-1:h=n,o++):1===e&&h===n-1&&ra)break}h+=e,this._doFire(h,!0)}while(h!==r&&h>-1&&h=e.length||this._ignoreIndex===t))for(var i=e[t],n=i.events.length,r=0;r0||delete e[t])},e.apply=function(t){var e,i,n,r=this._transformApplyFlags,s=this._properties,a=s.position,o=s.scale,h=s.rotation,u=s.eulerAngles;r&&(a&&r&B5.POSITION&&(e=a.result),o&&r&B5.SCALE&&(i=o.result),u&&r&B5.EULER_ANGLES&&(n=u.result),h&&r&B5.ROTATION&&(n=h.result),(n||e||i)&&t.setRTS(n,e,i),this._transformApplyFlags=0)},n(t,[{key:"empty",get:function(){var t=this._properties;return!(t.position||t.rotation||t.eulerAngles||t.scale)}}]),t}()),z5=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.createNodeBlendState=function(){return new H5},e}(N5),V5=t("av",qs(((k5=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r=0?this._crossFades.fastRemoveAt(e):Z(3907)},i.update=function(t){var e=this._delayEvents,i=this._crossFades,n=this._sockets,r=i.array;for(i.i=0;i.i=0?this._anims.fastRemoveAt(e):Z(3907)},i.pushDelayEvent=function(t,e,i){this._delayEvents.push({fn:t,thisArg:e,args:i})},i.addSockets=function(t,e){for(var i=this,n=function(){var n=e[r];if(i._sockets.find((function(t){return t.target===n.target})))return 1;var s=t.getChildByPath(n.path),a=n.target&&s&&QZ(s,t);a&&i._sockets.push({target:n.target,transform:a})},r=0;r=h.easeDuration){a=o+1,h.easeTime=h.easeDuration;break}}if(a!==i.length){for(var c=a;c=0||(this._clips.push(t),this.createState(t)))}}]),e}(Zu(op))).EventType=w0,f((Q5=t4).prototype,"clips",[j5],Object.getOwnPropertyDescriptor(Q5.prototype,"clips"),Q5.prototype),f(Q5.prototype,"defaultClip",[Y5],Object.getOwnPropertyDescriptor(Q5.prototype,"defaultClip"),Q5.prototype),Z5=Gs(Q5.prototype,"playOnLoad",[ra],(function(){return!1})),J5=Gs(Q5.prototype,"_clips",[K5],(function(){return[]})),$5=Gs(Q5.prototype,"_defaultClip",[ra],(function(){return null})),q5=Q5))||q5)||q5));function a4(t,e){return t===e||!!t&&!!e&&t._uuid===e._uuid&&t._uuid}v.Animation=s4,v.AnimationComponent=s4,Jt(s4,"cc.AnimationComponent"),function(t){t.PLAYED="play",t.PAUSED="pause",t.STOPPED="stop",t.SEEKED="seeked",t.ENDED="ended",t.INTERRUPTION_BEGIN="interruptionBegin",t.INTERRUPTION_END="interruptionEnd",t.USER_GESTURE="on_gesture"}(e4||(e4={})),function(t){t[t.DOM_AUDIO=0]="DOM_AUDIO",t[t.WEB_AUDIO=1]="WEB_AUDIO",t[t.MINIGAME_AUDIO=2]="MINIGAME_AUDIO",t[t.NATIVE_AUDIO=3]="NATIVE_AUDIO",t[t.UNKNOWN_AUDIO=4]="UNKNOWN_AUDIO"}(i4||(i4={})),function(t){t[t.INIT=0]="INIT",t[t.PLAYING=1]="PLAYING",t[t.PAUSED=2]="PAUSED",t[t.STOPPED=3]="STOPPED",t[t.INTERRUPTED=4]="INTERRUPTED"}(n4||(n4={}));var o4,h4=t("aA",function(){function t(){this._bufferView=void 0,this._normalizeFactor=1;for(var t=arguments.length,e=new Array(t),i=0;i=0;s--){var a=i[s];if("stop"===a.op){n.push(a);break}if("seek"===a.op)r||(n.push(a),r=!0);else{if(r){n.push(a);break}0===n.length&&n.push(a)}}t._operationQueue=n.reverse()}(t);var i=t._operationQueue[0];i&&l4(t,i)})).catch((function(){})))}function c4(t,e,i){var n=i.value;i.value=function(){for(var t=this,i=arguments.length,r=new Array(i),s=0;s=this.duration&&(this._startTime=this._now(),this._startOffset=0),e%this.duration},e.start=function(){this._isPaused=!1,this._startTime=this._now()},e.pause=function(){this._isPaused||(this._isPaused=!0,this._startOffset=this._calculateCurrentTime())},e.stop=function(){this._isPaused=!0,this._startOffset=0},e.seek=function(t){this._startTime=this._now(),this._startOffset=Ii(t,0,this.duration)},n(t,[{key:"duration",get:function(){return this._nativeAudio.duration}},{key:"currentTime",get:function(){return this._isPaused?this._startOffset:this._calculateCurrentTime()}}]),t}(),v4=new(function(){function t(){this._audioBufferDataMap={}}var e=t.prototype;return e.addCache=function(t,e){this._audioBufferDataMap[t]?console.warn("Audio buffer "+t+" has been cached"):this._audioBufferDataMap[t]={usedCount:1,audioBuffer:e}},e.retainCache=function(t){var e=this._audioBufferDataMap[t];e?e.usedCount++:console.warn("Audio buffer cache "+t+" has not been added.")},e.getCache=function(t){var e=this._audioBufferDataMap[t];return null==e?void 0:e.audioBuffer},e.tryReleasingCache=function(t){var e=this._audioBufferDataMap[t];e?--e.usedCount<=0&&delete this._audioBufferDataMap[t]:console.warn("Audio buffer cache "+t+" has not been added.")},t}()),y4=window.AudioContext||window.webkitAudioContext||window.mozAudioContext,T4="on-context-running",S4=function(){function t(){var t=this;this._eventTarget=void 0,this._context=void 0,this._isRunning=!1,this._context=new(window.AudioContext||window.webkitAudioContext||window.mozAudioContext),this._eventTarget=new Ju,this._context.onstatechange=function(){"running"===t._context.state?(t._isRunning=!0,t._eventTarget.emit(T4)):t._isRunning=!1}}var e=t.prototype;return e.onceRunning=function(t,e){this._eventTarget.once(T4,t,e)},e.offRunning=function(t,e){this._eventTarget.off(T4,t,e)},e.decodeAudioData=function(t){var e=this;return new Promise((function(i){var n=e._context.decodeAudioData(t,(function(t){i(t)}),(function(t){console.error("failed to load Web Audio",t)}));null==n||n.catch((function(t){U("decodeAudioData error",t)}))}))},e.runContext=function(){var t=this;return new Promise((function(e){if(t.isRunning)e();else{var i=t._context;if(i.resume)if(i.resume().catch((function(t){U("runContext error",t)})),"running"!==i.state){var n=document.getElementById("GameCanvas"),r=function t(){i.resume().then((function(){null==n||n.removeEventListener("touchend",t,{capture:!0}),null==n||n.removeEventListener("mouseup",t,{capture:!0}),e()})).catch((function(t){U("onGesture resume error",t)}))};null==n||n.addEventListener("touchend",r,{capture:!0}),null==n||n.addEventListener("mouseup",r,{capture:!0})}else e();else e()}}))},e.createBufferSource=function(t,e){var i=this._context.createBufferSource();return void 0!==t&&(i.buffer=t),void 0!==e&&(i.loop=e),i},e.createGain=function(t){void 0===t&&(t=1);var e=this._context.createGain();return this.setGainValue(e,t),e},e.setGainValue=function(t,e){if(t.gain.setTargetAtTime)try{t.gain.setTargetAtTime(e,this._context.currentTime,0)}catch(i){t.gain.setTargetAtTime(e,this._context.currentTime,.01)}else t.gain.value=e},e.connectContext=function(t){this._context&&t.connect(this._context.destination)},n(t,[{key:"isRunning",get:function(){return this._isRunning}},{key:"currentTime",get:function(){return this._context.currentTime}}]),t}();S4.support=!!y4,S4.support&&(f4=new S4);var E4,A4,R4,b4,C4=function(){function t(t,e,i){this._duration=void 0,this._bufferSourceNode=void 0,this._onPlayCb=void 0,this._currentTimer=0,this._url=void 0,this._onEndCb=void 0,this._duration=t.duration,this._url=i,this._bufferSourceNode=f4.createBufferSource(t,!1);var n=f4.createGain(e);this._bufferSourceNode.connect(n),f4.connectContext(n)}var e=t.prototype;return e.play=function(){var t=this;this._bufferSourceNode.start(),f4.runContext().then((function(){var e;null===(e=t.onPlay)||void 0===e||e.call(t),t._currentTimer=window.setTimeout((function(){var e;v4.tryReleasingCache(t._url),null===(e=t.onEnd)||void 0===e||e.call(t)}),1e3*t._duration)})).catch((function(t){U("play error",t)}))},e.stop=function(){clearTimeout(this._currentTimer),v4.tryReleasingCache(this._url),this._bufferSourceNode.stop(),this._bufferSourceNode.disconnect(),this._bufferSourceNode.buffer=null},n(t,[{key:"onPlay",get:function(){return this._onPlayCb},set:function(t){this._onPlayCb=t}},{key:"onEnd",get:function(){return this._onEndCb},set:function(t){this._onEndCb=t}}]),t}(),w4=(f((d4=function(){function t(t,e){this._src=void 0,this._audioBuffer=void 0,this._sourceNode=void 0,this._gainNode=void 0,this._currentTimer=0,this._volume=1,this._loop=!1,this._state=n4.INIT,this._audioTimer=void 0,this._runningCallback=void 0,this._eventTarget=new Ju,this._operationQueue=[],this._audioBuffer=t,this._audioTimer=new g4(t),this._gainNode=f4.createGain(),f4.connectContext(this._gainNode),this._src=e,AL.on(EL.EVENT_PAUSE,this._onInterruptedBegin,this),AL.on(EL.EVENT_RESUME,this._onInterruptedEnd,this)}var e=t.prototype;return e.destroy=function(){window.clearTimeout(this._currentTimer),this._audioTimer.destroy(),this._audioBuffer&&(this._audioBuffer=null),v4.tryReleasingCache(this._src),AL.off(EL.EVENT_PAUSE,this._onInterruptedBegin,this),AL.off(EL.EVENT_RESUME,this._onInterruptedEnd,this),this.offRunning()},t.load=function(e){return new Promise((function(i){t.loadNative(e).then((function(n){i(new t(n,e))})).catch((function(t){U("load error",e,t)}))}))},t.loadNative=function(t){return new Promise((function(e,i){var n=v4.getCache(t);if(n)return v4.retainCache(t),void e(n);var r=new XMLHttpRequest,s="load audio failed: "+t+", status: ";r.open("GET",t,!0),r.responseType="arraybuffer",r.onload=function(){200===r.status||0===r.status?f4.decodeAudioData(r.response).then((function(i){v4.addCache(t,i),e(i)})).catch((function(e){U("loadNative error",t,e)})):i(new Error(""+s+r.status+"(no response)"))},r.onerror=function(){i(new Error(""+s+r.status+"(error)"))},r.ontimeout=function(){i(new Error(""+s+r.status+"(time out)"))},r.onabort=function(){i(new Error(""+s+r.status+"(abort)"))},r.send(null)}))},t.loadOneShotAudio=function(e,i){return new Promise((function(n,r){t.loadNative(e).then((function(t){var r=new C4(t,i,e);n(r)})).catch(r)}))},e.getPCMData=function(t){return new h4(this._audioBuffer.getChannelData(t),1)},e._onInterruptedBegin=function(){var t=this;this._state===n4.PLAYING&&this.pause().then((function(){t._state=n4.INTERRUPTED,t._eventTarget.emit(e4.INTERRUPTION_BEGIN)})).catch((function(t){U("_onInterruptedBegin error",t)}))},e._onInterruptedEnd=function(){var t=this;this._state===n4.INTERRUPTED&&this.play().then((function(){t._eventTarget.emit(e4.INTERRUPTION_END)})).catch((function(t){U("_onInterruptedEnd error",t)}))},e.offRunning=function(){this._runningCallback&&(f4.offRunning(this._runningCallback),this._runningCallback=void 0)},e.seek=function(t){var e=this;return new Promise((function(i){e.offRunning(),e._audioTimer.seek(t),e._state===n4.PLAYING?e._doPlay().then(i).catch((function(t){U("seek error",t)})):i()}))},e.play=function(){return this.offRunning(),this._doPlay()},e._doPlay=function(){var t=this;return new Promise((function(e){f4.isRunning?(t._startSourceNode(),e()):(t.offRunning(),t._runningCallback=function(){t._startSourceNode(),e()},f4.onceRunning(t._runningCallback),f4.runContext().catch((function(t){U("doPlay error",t)})))}))},e._startSourceNode=function(){var t=this;this._stopSourceNode(),this._sourceNode=f4.createBufferSource(this._audioBuffer,this.loop),this._sourceNode.connect(this._gainNode),this._sourceNode.loop=this._loop,this._sourceNode.start(0,this._audioTimer.currentTime),this._state=n4.PLAYING,this._audioTimer.start(),window.clearTimeout(this._currentTimer),this._currentTimer=window.setTimeout((function e(){t.loop?t._currentTimer=window.setTimeout(e,1e3*t._audioBuffer.duration):(t._audioTimer.stop(),t._eventTarget.emit(e4.ENDED),t._state=n4.INIT)}),1e3*(this._audioBuffer.duration-this._audioTimer.currentTime))},e._stopSourceNode=function(){try{this._sourceNode&&(this._sourceNode.stop(),this._sourceNode.disconnect(),this._sourceNode.buffer=null,this._sourceNode=void 0)}catch(t){}},e.pause=function(){return this.offRunning(),this._state===n4.PLAYING&&this._sourceNode?(this._audioTimer.pause(),this._state=n4.PAUSED,window.clearTimeout(this._currentTimer),this._stopSourceNode(),Promise.resolve()):Promise.resolve()},e.stop=function(){return this.offRunning(),this._sourceNode?(this._audioTimer.stop(),this._state=n4.STOPPED,window.clearTimeout(this._currentTimer),this._stopSourceNode(),Promise.resolve()):(this._audioTimer.stop(),this._state=n4.STOPPED,Promise.resolve())},e.onInterruptionBegin=function(t){this._eventTarget.on(e4.INTERRUPTION_BEGIN,t)},e.offInterruptionBegin=function(t){this._eventTarget.off(e4.INTERRUPTION_BEGIN,t)},e.onInterruptionEnd=function(t){this._eventTarget.on(e4.INTERRUPTION_END,t)},e.offInterruptionEnd=function(t){this._eventTarget.off(e4.INTERRUPTION_END,t)},e.onEnded=function(t){this._eventTarget.on(e4.ENDED,t)},e.offEnded=function(t){this._eventTarget.off(e4.ENDED,t)},n(t,[{key:"sampleRate",get:function(){return this._audioBuffer.sampleRate}},{key:"src",get:function(){return this._src}},{key:"type",get:function(){return i4.WEB_AUDIO}},{key:"state",get:function(){return this._state}},{key:"loop",get:function(){return this._loop},set:function(t){this._loop=t,this._sourceNode&&(this._sourceNode.loop=t)}},{key:"volume",get:function(){return this._volume},set:function(t){t=Oi(t),this._volume=t,f4.setGainValue(this._gainNode,t)}},{key:"duration",get:function(){return this._audioBuffer.duration}},{key:"currentTime",get:function(){return this._audioTimer.currentTime}}]),t}()).prototype,"seek",[c4],Object.getOwnPropertyDescriptor(d4.prototype,"seek"),d4.prototype),f(d4.prototype,"play",[c4],Object.getOwnPropertyDescriptor(d4.prototype,"play"),d4.prototype),f(d4.prototype,"pause",[c4],Object.getOwnPropertyDescriptor(d4.prototype,"pause"),d4.prototype),f(d4.prototype,"stop",[c4],Object.getOwnPropertyDescriptor(d4.prototype,"stop"),d4.prototype),d4),x4=function(){function t(t){this._audio=void 0,this._audio=t}var e=t.prototype;return e.play=function(){this._audio.play()},e.stop=function(){this._audio.stop()},n(t,[{key:"onPlay",get:function(){return this._audio.onPlay},set:function(t){this._audio.onPlay=t}},{key:"onEnd",get:function(){return this._audio.onEnd},set:function(t){this._audio.onEnd=t}}]),t}(),I4=function(){function t(t){this._player=void 0,this._player=t}t.load=function(e,i){return new Promise((function(n){(null==i?void 0:i.audioLoadMode)!==i4.DOM_AUDIO&&S4.support?w4.load(e).then((function(e){n(new t(e))})).catch((function(){})):(S4.support||q(5201),m4.load(e).then((function(e){n(new t(e))})).catch((function(){})))}))};var e=t.prototype;return e.destroy=function(){this._player.destroy()},t.loadNative=function(t,e){return(null==e?void 0:e.audioLoadMode)!==i4.DOM_AUDIO&&S4.support?w4.loadNative(t):(S4.support||q(5201),m4.loadNative(t))},t.loadOneShotAudio=function(t,e,i){return new Promise((function(n,r){(null==i?void 0:i.audioLoadMode)!==i4.DOM_AUDIO&&S4.support?w4.loadOneShotAudio(t,e).then((function(t){n(new x4(t))})).catch(r):(S4.support||q(5201),m4.loadOneShotAudio(t,e).then((function(t){n(new x4(t))})).catch(r))}))},e.getPCMData=function(t){return this._player.getPCMData(t)},e.seek=function(t){return this._player.seek(t)},e.play=function(){return this._player.play()},e.pause=function(){return this._player.pause()},e.stop=function(){return this._player.stop()},e.onInterruptionBegin=function(t){this._player.onInterruptionBegin(t)},e.offInterruptionBegin=function(t){this._player.offInterruptionBegin(t)},e.onInterruptionEnd=function(t){this._player.onInterruptionEnd(t)},e.offInterruptionEnd=function(t){this._player.offInterruptionEnd(t)},e.onEnded=function(t){this._player.onEnded(t)},e.offEnded=function(t){this._player.offEnded(t)},n(t,[{key:"src",get:function(){return this._player.src}},{key:"type",get:function(){return this._player.type}},{key:"state",get:function(){return this._player.state}},{key:"loop",get:function(){return this._player.loop},set:function(t){this._player.loop=t}},{key:"volume",get:function(){return this._player.volume},set:function(t){this._player.volume=t}},{key:"duration",get:function(){return this._player.duration}},{key:"currentTime",get:function(){return this._player.currentTime}},{key:"sampleRate",get:function(){return this._player.sampleRate}}]),t}();I4.maxAudioChannel=24;var O4=t("az",qs("cc.AudioClip")(((b4=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r-1?(t[i].playTime=performance.now(),!1):(t.push({audio:e,playTime:performance.now()}),!0)},e.addPlaying=function(t){t instanceof I4?this._tryAddPlaying(this._audioPlayerInfoList,t):this._tryAddPlaying(this._oneShotAudioInfoList,t)},e._tryRemovePlaying=function(t,e){var i=this._findIndex(t,e);return-1!==i&&(he(t,i),!0)},e.removePlaying=function(t){t instanceof I4?this._tryRemovePlaying(this._audioPlayerInfoList,t):this._tryRemovePlaying(this._oneShotAudioInfoList,t)},e.discardOnePlayingIfNeeded=function(){var t;this._audioPlayerInfoList.length+this._oneShotAudioInfoList.length0?this._oneShotAudioInfoList.forEach((function(e){(!t||e.playTime0&&(t.extensions.useVAO&&n.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),n.glVAO=null),i6.gpuInputAssembler=null,t.stateCache.glArrayBuffer!==e.glBuffer&&(i.bindBuffer(i.ARRAY_BUFFER,e.glBuffer),t.stateCache.glArrayBuffer=e.glBuffer),i.bufferData(i.ARRAY_BUFFER,e.size,r),i.bindBuffer(i.ARRAY_BUFFER,null),t.stateCache.glArrayBuffer=null))}else if(e.usage&ql.INDEX){e.glTarget=i.ELEMENT_ARRAY_BUFFER;var a=i.createBuffer();a&&(e.glBuffer=a,e.size>0&&(t.extensions.useVAO&&n.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),n.glVAO=null),i6.gpuInputAssembler=null,t.stateCache.glElementArrayBuffer!==e.glBuffer&&(i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.glBuffer),t.stateCache.glElementArrayBuffer=e.glBuffer),i.bufferData(i.ELEMENT_ARRAY_BUFFER,e.size,r),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,null),t.stateCache.glElementArrayBuffer=null))}else e.usage&ql.UNIFORM?(e.glTarget=i.NONE,e.buffer&&(e.vf32=new Float32Array(e.buffer.buffer))):(e.usage&ql.INDIRECT||e.usage&ql.TRANSFER_DST||e.usage&ql.TRANSFER_SRC||G("Unsupported BufferType, create buffer failed."),e.glTarget=i.NONE)}function Q8(t,e){var i=t.gl,n=t.stateCache;if(e.glBuffer){switch(e.glTarget){case i.ARRAY_BUFFER:t.extensions.useVAO&&n.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),t.stateCache.glVAO=null),i6.gpuInputAssembler=null,i.bindBuffer(i.ARRAY_BUFFER,null),t.stateCache.glArrayBuffer=null;break;case i.ELEMENT_ARRAY_BUFFER:t.extensions.useVAO&&n.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),t.stateCache.glVAO=null),i6.gpuInputAssembler=null,i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,null),t.stateCache.glElementArrayBuffer=null}i.deleteBuffer(e.glBuffer),e.glBuffer=null}}function Z8(t,e,i,n,r){if(e.usage&ql.UNIFORM)ArrayBuffer.isView(i)?e.vf32.set(i,n/Float32Array.BYTES_PER_ELEMENT):e.vf32.set(new Float32Array(i),n/Float32Array.BYTES_PER_ELEMENT);else if(e.usage&ql.INDIRECT){e.indirects.clearDraws();for(var s=i.drawInfos,a=0;a0){e.glBlocks=new Array(e.blocks.length);for(var T=0;T0){e.glSamplerTextures=new Array(e.samplerTextures.length);for(var O=0;O=0&&R.gpuDescriptors[b],w=null,x=0;if(C&&C.gpuBuffer){var I=C.gpuBuffer,O=S[A.set],D=O&&O[A.binding];D>=0&&(x=r[D]),"vf32"in I?w=I.vf32:(x+=I.offset,w=I.gpuBuffer.vf32),x>>=2}if(w)for(var M=A.glActiveUniforms.length,P=0;P=0&&xt.gpuDescriptors[It],Dt=wt.units.length,Mt=0;Mt0){var Bt=Ot.gpuTexture,Nt=l.glTexUnits[Pt];Nt.glTexture!==Bt.glTexture&&(l.texUnit!==Pt&&(u.activeTexture(u.TEXTURE0+Pt),l.texUnit=Pt),Bt.glTexture?u.bindTexture(Bt.glTarget,Bt.glTexture):u.bindTexture(Bt.glTarget,t.nullTex2D.gpuTexture.glTexture),Nt.glTexture=Bt.glTexture);var Lt=Ot.gpuSampler;Bt.isPowerOf2?(a=Lt.glWrapS,o=Lt.glWrapT):(a=u.CLAMP_TO_EDGE,o=u.CLAMP_TO_EDGE),h=Bt.isPowerOf2?Bt.mipLevel<=1&&(Lt.glMinFilter===u.LINEAR_MIPMAP_NEAREST||Lt.glMinFilter===u.LINEAR_MIPMAP_LINEAR)?u.LINEAR:Lt.glMinFilter:Lt.glMinFilter===u.LINEAR||Lt.glMinFilter===u.LINEAR_MIPMAP_NEAREST||Lt.glMinFilter===u.LINEAR_MIPMAP_LINEAR?u.LINEAR:u.NEAREST,Bt.glWrapS!==a&&(l.texUnit!==Pt&&(u.activeTexture(u.TEXTURE0+Pt),l.texUnit=Pt),u.texParameteri(Bt.glTarget,u.TEXTURE_WRAP_S,a),Bt.glWrapS=a),Bt.glWrapT!==o&&(l.texUnit!==Pt&&(u.activeTexture(u.TEXTURE0+Pt),l.texUnit=Pt),u.texParameteri(Bt.glTarget,u.TEXTURE_WRAP_T,o),Bt.glWrapT=o),Bt.glMinFilter!==h&&(l.texUnit!==Pt&&(u.activeTexture(u.TEXTURE0+Pt),l.texUnit=Pt),u.texParameteri(Bt.glTarget,u.TEXTURE_MIN_FILTER,h),Bt.glMinFilter=h),Bt.glMagFilter!==Lt.glMagFilter&&(l.texUnit!==Pt&&(u.activeTexture(u.TEXTURE0+Pt),l.texUnit=Pt),u.texParameteri(Bt.glTarget,u.TEXTURE_MAG_FILTER,Lt.glMagFilter),Bt.glMagFilter=Lt.glMagFilter)}Ot=xt.gpuDescriptors[++It]}}}if(i&&c&&(_||i6.gpuInputAssembler!==i)){i6.gpuInputAssembler=i;var Ft=t.extensions.ANGLE_instanced_arrays;if(t.extensions.useVAO){var kt=t.extensions.OES_vertex_array_object,Ut=i.glVAOs.get(c.glProgram);if(!Ut){var Gt;Ut=kt.createVertexArrayOES(),i.glVAOs.set(c.glProgram,Ut),kt.bindVertexArrayOES(Ut),u.bindBuffer(u.ARRAY_BUFFER,null),u.bindBuffer(u.ELEMENT_ARRAY_BUFFER,null),l.glArrayBuffer=null,l.glElementArrayBuffer=null;for(var Ht=c.glInputs.length,zt=0;zt=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;ue0){var d=e.firstIndex*h.stride;r.drawElementsInstancedANGLE(o,e.indexCount,a.glIndexType,d,e.instanceCount)}}else e.vertexCount>0&&r.drawArraysInstancedANGLE(o,e.firstVertex,e.vertexCount,e.instanceCount);else if(h){if(e.indexCount>0){var f=e.firstIndex*h.stride;i.drawElements(o,e.indexCount,a.glIndexType,f)}}else e.vertexCount>0&&i.drawArrays(o,e.firstVertex,e.vertexCount)}}var o6=new Array(L8.COUNT);function h6(t,e){o6.fill(0);for(var i=0;i0?m.buffStride:_.width,f.height=m.buffTexHeight>0?m.buffTexHeight:_.height;var v=m.texExtent.width+d.x===i.width>>g?m.texExtent.width:_.width,y=m.texExtent.height+d.y===i.height>>g?m.texExtent.height:_.height,T=void 0,S=e[a++];if(f.width===_.width&&f.height===_.height){var E=z_(i.format,v,y,1)/u.BYTES_PER_ELEMENT;tt(Number.isInteger(E),9101),T=new u(S.buffer,S.byteOffset+m.buffOffset,E)}else T=l6(S,i.format,m.buffOffset,f,_);l?i.glInternalFmt===w8.COMPRESSED_RGB_ETC1_WEBGL||t.extensions.noCompressedTexSubImage2D?r.compressedTexImage2D(r.TEXTURE_2D,g,i.glInternalFmt,v,y,0,T):r.compressedTexSubImage2D(r.TEXTURE_2D,g,d.x,d.y,v,y,i.glFormat,T):r.texSubImage2D(r.TEXTURE_2D,g,d.x,d.y,v,y,i.glFormat,i.glType,T)}break;case r.TEXTURE_CUBE_MAP:for(var A=0;A0?R.buffStride:_.width,f.height=R.buffTexHeight>0?R.buffTexHeight:_.height;var C=R.texExtent.width+d.x===i.width>>b?R.texExtent.width:_.width,w=R.texExtent.height+d.y===i.height>>b?R.texExtent.height:_.height,x=R.texSubres.baseArrayLayer+R.texSubres.layerCount;for(o=R.texSubres.baseArrayLayer;o0,this.instancedDraw=!!e.instanceCount,this.drawCount=Math.max(t+1,this.drawCount),this.drawByIndex?(this.counts[t]=e.indexCount,this.offsets[t]=e.firstIndex):(this.counts[t]=e.vertexCount,this.offsets[t]=e.firstVertex),this.instances[t]=Math.max(1,e.instanceCount)},e._ensureCapacity=function(t){if(!(this._capacity>t)){this._capacity=Hi(t);var e=new Int32Array(this._capacity),i=new Int32Array(this._capacity),n=new Int32Array(this._capacity);this.byteOffsets=new Int32Array(this._capacity),e.set(this.counts),i.set(this.offsets),n.set(this.instances),this.counts=e,this.offsets=i,this.instances=n}},t}(),f6=function(){function t(){this._gpuShader=null,this._gpuDescriptorSetLayout=null,this._gpuPipelineLayout=null,this._gpuPipelineState=null,this._gpuVertexBuffer=null,this._gpuInputAssembler=null,this._gpuPointSampler=null,this._gpuLinearSampler=null,this._gpuDescriptorSet=null,this._gpuUniformBuffer=null,this._drawInfo=null,this._glFramebuffer=null,this._uniformBuffer=null;var t=I8.instance.gl,e=I8.instance.bindingMappingInfo.maxBlockCounts[0];this._gpuShader={name:"Blit Pass",blocks:[new r_(0,0,"BlitParams",[new n_("tilingOffsetSrc",Kl.FLOAT4,1),new n_("tilingOffsetDst",Kl.FLOAT4,1)],1)],samplerTextures:[new s_(0,e,"textureSrc",Kl.SAMPLER2D,1)],subpassInputs:[],gpuStages:[{type:_c.VERTEX,source:"\n precision mediump float;\n\n attribute vec2 a_position;\n attribute vec2 a_texCoord;\n \n uniform vec4 tilingOffsetSrc;\n uniform vec4 tilingOffsetDst;\n \n varying vec2 v_texCoord;\n \n void main() {\n v_texCoord = a_texCoord * tilingOffsetSrc.xy + tilingOffsetSrc.zw;\n gl_Position = vec4((a_position + 1.0) * tilingOffsetDst.xy - 1.0 + tilingOffsetDst.zw * 2.0, 0, 1);\n }",glShader:null},{type:_c.FRAGMENT,source:"\n precision mediump float;\n uniform sampler2D textureSrc;\n\n varying vec2 v_texCoord;\n \n void main() {\n gl_FragColor = texture2D(textureSrc, v_texCoord);\n }",glShader:null}],glProgram:null,glInputs:[],glUniforms:[],glBlocks:[],glSamplerTextures:[]},J8(I8.instance,this._gpuShader),this._gpuDescriptorSetLayout={bindings:[new R_(0,Rc.UNIFORM_BUFFER,1,_c.VERTEX),new R_(e,Rc.SAMPLER_TEXTURE,1,_c.FRAGMENT)],dynamicBindings:[],descriptorIndices:[],descriptorCount:e+1};for(var i=0;i0&&(this._uniformBuffer=new Uint8Array(this._size)),this._gpuBuffer={usage:this._usage,memUsage:this._memUsage,size:this._size,stride:this._stride,buffer:null,vf32:null,indirects:new d6,glTarget:0,glBuffer:null},this._usage&ql.UNIFORM&&(this._gpuBuffer.buffer=this._uniformBuffer),q8(I8.instance,this._gpuBuffer),I8.instance.memoryStatus.bufferSize+=this._size},i.destroy=function(){this._gpuBuffer&&(Q8(I8.instance,this._gpuBuffer),I8.instance.memoryStatus.bufferSize-=this._size,this._gpuBuffer=null),this._gpuBufferView&&(this._gpuBufferView=null)},i.resize=function(t){if(this._isBufferView)console.warn("cannot resize buffer views!");else{var e=this._size;e!==t&&(this._size=t,this._count=this._size/this._stride,this._uniformBuffer&&(this._uniformBuffer=new Uint8Array(t)),this._gpuBuffer&&(this._uniformBuffer&&(this._gpuBuffer.buffer=this._uniformBuffer),this._gpuBuffer.size=t,t>0&&(function(t,e){var i=t.gl,n=t.stateCache,r=e.memUsage&Jl.HOST?i.DYNAMIC_DRAW:i.STATIC_DRAW;e.usage&ql.VERTEX?(t.extensions.useVAO&&n.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),n.glVAO=null),i6.gpuInputAssembler=null,t.stateCache.glArrayBuffer!==e.glBuffer&&i.bindBuffer(i.ARRAY_BUFFER,e.glBuffer),e.buffer?i.bufferData(i.ARRAY_BUFFER,e.buffer,r):i.bufferData(i.ARRAY_BUFFER,e.size,r),i.bindBuffer(i.ARRAY_BUFFER,null),t.stateCache.glArrayBuffer=null):e.usage&ql.INDEX?(t.extensions.useVAO&&n.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),n.glVAO=null),i6.gpuInputAssembler=null,t.stateCache.glElementArrayBuffer!==e.glBuffer&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.glBuffer),e.buffer?i.bufferData(i.ELEMENT_ARRAY_BUFFER,e.buffer,r):i.bufferData(i.ELEMENT_ARRAY_BUFFER,e.size,r),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,null),t.stateCache.glElementArrayBuffer=null):e.usage&ql.UNIFORM?e.buffer&&(e.vf32=new Float32Array(e.buffer.buffer)):(e.usage&ql.INDIRECT||e.usage&ql.TRANSFER_DST||e.usage&ql.TRANSFER_SRC||G("Unsupported BufferType, create buffer failed."),e.glTarget=i.NONE)}(I8.instance,this._gpuBuffer),I8.instance.memoryStatus.bufferSize-=e,I8.instance.memoryStatus.bufferSize+=t)))}},i.update=function(t,e){var i;this._isBufferView?console.warn("cannot update through buffer views!"):(i=void 0!==e?e:this._usage&ql.INDIRECT?0:t.byteLength,Z8(I8.instance,this._gpuBuffer,t,0,i))},n(e,[{key:"gpuBuffer",get:function(){return this._gpuBuffer}},{key:"gpuBufferView",get:function(){return this._gpuBufferView}}]),e}(Q_),m6=function(){function t(t,e){this._frees=void 0,this._freeIdx=0,this._freeCmds=void 0,this._frees=new Array(e),this._freeCmds=new Nu(e);for(var i=0;i0?this.gpuColorTextures[0].width:this.gpuDepthStencilTexture?this.gpuDepthStencilTexture.width:a},set width(t){a=t},get height(){return this.gpuColorTextures.length>0?this.gpuColorTextures[0].height:this.gpuDepthStencilTexture?this.gpuDepthStencilTexture.height:o},set height(t){o=t},lodLevel:e},function(t,e){for(var i=0;ii&&(i=s.binding)}this._bindingIndices=Array(i+1).fill(-1);for(var a=this._descriptorIndices=Array(i+1).fill(-1),o=0;ot.capabilities.maxTextureSize&&Z(9100,s,t.capabilities.maxTextureSize),t.textureExclusive[e.format]||t.extensions.WEBGL_depth_texture||!F_[e.format].hasDepth){if(e.glTexture=i.createTexture(),e.size>0){var a=t.stateCache.glTexUnits[t.stateCache.texUnit];if(a.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_2D,e.glTexture),a.glTexture=e.glTexture),F_[e.format].isCompressed)for(var o=0;o>1),r=Math.max(1,r>>1)}else for(var l=0;l>1),r=Math.max(1,r>>1);e.isPowerOf2?(e.glWrapS=i.REPEAT,e.glWrapT=i.REPEAT):(e.glWrapS=i.CLAMP_TO_EDGE,e.glWrapT=i.CLAMP_TO_EDGE),e.glMinFilter=i.LINEAR,e.glMagFilter=i.LINEAR,i.texParameteri(e.glTarget,i.TEXTURE_WRAP_S,e.glWrapS),i.texParameteri(e.glTarget,i.TEXTURE_WRAP_T,e.glWrapT),i.texParameteri(e.glTarget,i.TEXTURE_MIN_FILTER,e.glMinFilter),i.texParameteri(e.glTarget,i.TEXTURE_MAG_FILTER,e.glMagFilter)}}else e.glInternalFmt=function(t,e){switch(t){case jl.R5G6B5:return e.RGB565;case jl.RGB5A1:return e.RGB5_A1;case jl.RGBA4:return e.RGBA4;case jl.RGBA16F:return w8.RGBA16F_EXT;case jl.RGBA32F:return w8.RGBA32F_EXT;case jl.SRGB8_A8:return w8.SRGB8_ALPHA8_EXT;case jl.DEPTH:return e.DEPTH_COMPONENT16;case jl.DEPTH_STENCIL:return e.DEPTH_STENCIL;default:return G("Unsupported Format, convert to WebGL internal format failed."),e.RGBA}}(e.format,i),e.glRenderbuffer=i.createRenderbuffer(),e.size>0&&(t.stateCache.glRenderbuffer!==e.glRenderbuffer&&(i.bindRenderbuffer(i.RENDERBUFFER,e.glRenderbuffer),t.stateCache.glRenderbuffer=e.glRenderbuffer),i.renderbufferStorage(i.RENDERBUFFER,e.glInternalFmt,n,r));break;case $l.CUBE:e.glTarget=i.TEXTURE_CUBE_MAP;var c=Math.max(n,r);if(c>t.capabilities.maxCubeMapTextureSize&&Z(9100,c,t.capabilities.maxTextureSize),e.glTexture=i.createTexture(),e.size>0){var _=t.stateCache.glTexUnits[t.stateCache.texUnit];if(_.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_CUBE_MAP,e.glTexture),_.glTexture=e.glTexture),F_[e.format].isCompressed)for(var d=0;d<6;++d){n=e.width,r=e.height;for(var f=0;f>1),r=Math.max(1,r>>1)}}else for(var g=0;g<6;++g){n=e.width,r=e.height;for(var v=0;v>1),r=Math.max(1,r>>1)}e.isPowerOf2?(e.glWrapS=i.REPEAT,e.glWrapT=i.REPEAT):(e.glWrapS=i.CLAMP_TO_EDGE,e.glWrapT=i.CLAMP_TO_EDGE),e.glMinFilter=i.LINEAR,e.glMagFilter=i.LINEAR,i.texParameteri(e.glTarget,i.TEXTURE_WRAP_S,e.glWrapS),i.texParameteri(e.glTarget,i.TEXTURE_WRAP_T,e.glWrapT),i.texParameteri(e.glTarget,i.TEXTURE_MIN_FILTER,e.glMinFilter),i.texParameteri(e.glTarget,i.TEXTURE_MAG_FILTER,e.glMagFilter)}break;default:G("Unsupported TextureType, create texture failed."),e.type=$l.TEX2D,e.glTarget=i.TEXTURE_2D}}(I8.instance,this._gpuTexture),I8.instance.memoryStatus.textureSize+=this._size),this._viewInfo.texture=this,this._viewInfo.type=t.type,this._viewInfo.format=t.format,this._viewInfo.baseLevel=0,this._viewInfo.levelCount=t.levelCount,this._viewInfo.baseLayer=0,this._viewInfo.layerCount=t.layerCount)},i.destroy=function(){!this._isTextureView&&this._gpuTexture&&(function(t,e){var i=t.gl;if(e.glTexture){var n=t.stateCache.glTexUnits,r=t.stateCache.texUnit;i.deleteTexture(e.glTexture);for(var s=0;s1&&(this._info.levelCount=Math.min(this._info.levelCount,e.getLevelCount(t,i)));var n=this._size;this._info.width=t,this._info.height=i,this._size=V_(this._info.format,this.width,this.height,this.depth,this._info.levelCount)*this._info.layerCount,!this._isTextureView&&this._gpuTexture&&(this._gpuTexture.width=t,this._gpuTexture.height=i,this._gpuTexture.size=this._size,this._gpuTexture.isSwapchainTexture||(function(t,e){if(e.size){var i=t.gl,n=e.width,r=e.height;switch(e.type){case $l.TEX2D:e.glTarget=i.TEXTURE_2D;var s=Math.max(n,r);if(s>t.capabilities.maxTextureSize&&Z(9100,s,t.capabilities.maxTextureSize),e.glRenderbuffer)t.stateCache.glRenderbuffer!==e.glRenderbuffer&&(i.bindRenderbuffer(i.RENDERBUFFER,e.glRenderbuffer),t.stateCache.glRenderbuffer=e.glRenderbuffer),i.renderbufferStorage(i.RENDERBUFFER,e.glInternalFmt,n,r);else if(e.glTexture){var a=t.stateCache.glTexUnits[t.stateCache.texUnit];if(a.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_2D,e.glTexture),a.glTexture=e.glTexture),F_[e.format].isCompressed)for(var o=0;o>1),r=Math.max(1,r>>1)}else for(var l=0;l>1),r=Math.max(1,r>>1)}break;case $l.CUBE:e.glTarget=i.TEXTURE_CUBE_MAP;var c=Math.max(n,r);c>t.capabilities.maxCubeMapTextureSize&&Z(9100,c,t.capabilities.maxTextureSize);var _=t.stateCache.glTexUnits[t.stateCache.texUnit];if(_.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_CUBE_MAP,e.glTexture),_.glTexture=e.glTexture),F_[e.format].isCompressed)for(var d=0;d<6;++d){n=e.width,r=e.height;for(var f=0;f>1),r=Math.max(1,r>>1)}}else for(var g=0;g<6;++g){n=e.width,r=e.height;for(var v=0;v>1),r=Math.max(1,r>>1)}break;default:G("Unsupported TextureType, create texture failed."),e.type=$l.TEX2D,e.glTarget=i.TEXTURE_2D}}}(I8.instance,this._gpuTexture),I8.instance.memoryStatus.textureSize-=n,I8.instance.memoryStatus.textureSize+=this._size))}},i.initAsSwapchainTexture=function(t){var e=new t_;e.format=t.format,e.usage=F_[t.format].hasDepth?tc.DEPTH_STENCIL_ATTACHMENT:tc.COLOR_ATTACHMENT,e.width=t.width,e.height=t.height,this.initialize(e,!0)},n(e,[{key:"gpuTexture",get:function(){return this._gpuTexture}},{key:"lodLevel",get:function(){return this._lodLevel}}]),e}(md),P6="webglcontextlost";function B6(t,e){for(var i=["","WEBKIT_","MOZ_"],n=0;nt.capabilities.maxTextureSize&&Z(9100,o,t.capabilities.maxTextureSize),e.samples===nc.X1){if(e.glTexture=i.createTexture(),e.size>0){var h=t.stateCache.glTexUnits[t.stateCache.texUnit];if(h.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_2D,e.glTexture),h.glTexture=e.glTexture),F_[e.format].isCompressed)for(var u=0;u>1),r=Math.max(1,r>>1)}else e.flags&ec.MUTABLE_STORAGE?i.texImage2D(i.TEXTURE_2D,0,e.glInternalFmt,n,r,0,e.glFormat,e.glType,null):i.texStorage2D(i.TEXTURE_2D,e.mipLevel,e.glInternalFmt,n,r)}}else e.glRenderbuffer=i.createRenderbuffer(),e.size>0&&(t.stateCache.glRenderbuffer!==e.glRenderbuffer&&(i.bindRenderbuffer(i.RENDERBUFFER,e.glRenderbuffer),t.stateCache.glRenderbuffer=e.glRenderbuffer),i.renderbufferStorageMultisample(i.RENDERBUFFER,e.samples,e.glInternalFmt,e.width,e.height));break;case $l.TEX2D_ARRAY:e.glTarget=i.TEXTURE_2D_ARRAY;var _=Math.max(n,r);if(_>t.capabilities.maxTextureSize&&Z(9100,_,t.capabilities.maxTextureSize),a>t.capabilities.maxArrayTextureLayers&&Z(9100,a,t.capabilities.maxArrayTextureLayers),e.glTexture=i.createTexture(),e.size>0){var d=t.stateCache.glTexUnits[t.stateCache.texUnit];if(d.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_2D_ARRAY,e.glTexture),d.glTexture=e.glTexture),F_[e.format].isCompressed)for(var f=0;f>1),r=Math.max(1,r>>1)}else i.texStorage3D(i.TEXTURE_2D_ARRAY,e.mipLevel,e.glInternalFmt,n,r,a)}break;case $l.TEX3D:e.glTarget=i.TEXTURE_3D;var g=Math.max(Math.max(n,r),s);if(g>t.capabilities.max3DTextureSize&&Z(9100,g,t.capabilities.max3DTextureSize),e.glTexture=i.createTexture(),e.size>0){var v=t.stateCache.glTexUnits[t.stateCache.texUnit];if(v.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_3D,e.glTexture),v.glTexture=e.glTexture),F_[e.format].isCompressed)for(var y=0;y>1),r=Math.max(1,r>>1)}else i.texStorage3D(i.TEXTURE_3D,e.mipLevel,e.glInternalFmt,n,r,s)}break;case $l.CUBE:e.glTarget=i.TEXTURE_CUBE_MAP;var E=Math.max(n,r);if(E>t.capabilities.maxCubeMapTextureSize&&Z(9100,E,t.capabilities.maxTextureSize),e.glTexture=i.createTexture(),e.size>0){var A=t.stateCache.glTexUnits[t.stateCache.texUnit];if(A.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_CUBE_MAP,e.glTexture),A.glTexture=e.glTexture),F_[e.format].isCompressed)for(var R=0;R>1),r=Math.max(1,r>>1)}else i.texStorage2D(i.TEXTURE_CUBE_MAP,e.mipLevel,e.glInternalFmt,n,r)}break;default:G("Unsupported TextureType, create texture failed."),e.type=$l.TEX2D,e.glTarget=i.TEXTURE_2D}}function u7(t,e){var i=t.gl;if(e.glTexture){var n=t.stateCache.glTexUnits,r=t.stateCache.texUnit;i.deleteTexture(e.glTexture);for(var s=0;s=0&&S.gpuDescriptors[E];if(A&&A.gpuBuffer){var R=v[T.set],b=R&&R[T.binding],C=A.gpuBuffer.glOffset;b>=0&&(C+=r[b]),o.glBindUBOs[T.glBinding]===A.gpuBuffer.glBuffer&&o.glBindUBOOffsets[T.glBinding]===C||(C?a.bindBufferRange(a.UNIFORM_BUFFER,T.glBinding,A.gpuBuffer.glBuffer,C,A.gpuBuffer.size):a.bindBufferBase(a.UNIFORM_BUFFER,T.glBinding,A.gpuBuffer.glBuffer),o.glUniformBuffer=o.glBindUBOs[T.glBinding]=A.gpuBuffer.glBuffer,o.glBindUBOOffsets[T.glBinding]=C)}}for(var w=h.glSamplerTextures.length,x=0;x=0&&O.gpuDescriptors[D],P=0;P0){N.glTexture!==F.glTexture&&(o.texUnit!==B&&(a.activeTexture(a.TEXTURE0+B),o.texUnit=B),F.glTexture?a.bindTexture(F.glTarget,F.glTexture):a.bindTexture(F.glTarget,t.nullTex2D.gpuTexture.glTexture),N.glTexture=F.glTexture);var G=M.gpuSampler.getGLSampler(t,k,U);o.glSamplerUnits[B]!==G&&(a.bindSampler(B,G),o.glSamplerUnits[B]=G)}M=O.gpuDescriptors[++D]}}}if(i&&h&&(u||l7.gpuInputAssembler!==i))if(l7.gpuInputAssembler=i,t.extensions.useVAO){var H=i.glVAOs.get(h.glProgram);if(!H){var z;H=a.createVertexArray(),i.glVAOs.set(h.glProgram,H),a.bindVertexArray(H),a.bindBuffer(a.ARRAY_BUFFER,null),a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,null),o.glArrayBuffer=null,o.glElementArrayBuffer=null;for(var V=0;V=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;ot0){var c=e.firstIndex*a.stride;i.drawElementsInstanced(r,e.indexCount,n.glIndexType,c,e.instanceCount)}}else e.vertexCount>0&&i.drawArraysInstanced(r,e.firstVertex,e.vertexCount,e.instanceCount);else if(a){if(e.indexCount>0){var _=e.firstIndex*a.stride;i.drawElements(r,e.indexCount,n.glIndexType,_)}}else e.vertexCount>0&&i.drawArrays(r,e.firstVertex,e.vertexCount)}}var f7=new Array(K6.COUNT);function p7(t,e){f7.fill(0);for(var i=0;i0?m.buffStride:_.width,f.height=m.buffTexHeight>0?m.buffTexHeight:_.height;var v=m.texExtent.width+d.x===i.width>>g?m.texExtent.width:_.width,y=m.texExtent.height+d.y===i.height>>g?m.texExtent.height:_.height,T=void 0,S=e[a++];if(f.width===_.width&&f.height===_.height){var E=z_(i.format,v,y,1)/u.BYTES_PER_ELEMENT;tt(Number.isInteger(E),9101),T=new u(S.buffer,S.byteOffset+m.buffOffset,E)}else T=g7(S,i.format,m.buffOffset,f,_);l?i.glInternalFmt!==k6.COMPRESSED_RGB_ETC1_WEBGL?r.compressedTexSubImage2D(r.TEXTURE_2D,g,d.x,d.y,v,y,i.glFormat,T):r.compressedTexImage2D(r.TEXTURE_2D,g,i.glInternalFmt,v,y,0,T):r.texSubImage2D(r.TEXTURE_2D,g,d.x,d.y,v,y,i.glFormat,i.glType,T)}break;case r.TEXTURE_2D_ARRAY:for(var A=0;A0?R.buffStride:_.width,f.height=R.buffTexHeight>0?R.buffTexHeight:_.height;var C=R.texExtent.width+d.x===i.width>>b?R.texExtent.width:_.width,w=R.texExtent.height+d.y===i.height>>b?R.texExtent.height:_.height,x=R.texSubres.baseArrayLayer+R.texSubres.layerCount;for(o=R.texSubres.baseArrayLayer;o0?P.buffStride:_.width,f.height=P.buffTexHeight>0?P.buffTexHeight:_.height;var N=P.texExtent.width+d.x===i.width>>B?P.texExtent.width:_.width,L=P.texExtent.height+d.y===i.height>>B?P.texExtent.height:_.height,F=void 0,k=e[a++];if(f.width===_.width&&f.height===_.height){var U=z_(i.format,N,L,_.depth)/u.BYTES_PER_ELEMENT;tt(Number.isInteger(U),9101),F=new u(k.buffer,k.byteOffset+P.buffOffset,U)}else F=g7(k,i.format,P.buffOffset,f,_);l?i.glInternalFmt!==k6.COMPRESSED_RGB_ETC1_WEBGL?r.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,B,d.x,d.y,d.z,N,L,_.depth,i.glFormat,F):r.compressedTexImage3D(r.TEXTURE_2D_ARRAY,B,i.glInternalFmt,N,L,_.depth,0,F):r.texSubImage3D(r.TEXTURE_2D_ARRAY,B,d.x,d.y,d.z,N,L,_.depth,i.glFormat,i.glType,F)}break;case r.TEXTURE_CUBE_MAP:for(var H=0;H0?z.buffStride:_.width,f.height=z.buffTexHeight>0?z.buffTexHeight:_.height;var W=z.texExtent.width+d.x===i.width>>V?z.texExtent.width:_.width,X=z.texExtent.height+d.y===i.height>>V?z.texExtent.height:_.height,j=z.texSubres.baseArrayLayer+z.texSubres.layerCount;for(o=z.texSubres.baseArrayLayer;o0,this.instancedDraw=!!e.instanceCount,this.drawCount=Math.max(t+1,this.drawCount),this.drawByIndex?(this.counts[t]=e.indexCount,this.offsets[t]=e.firstIndex):(this.counts[t]=e.vertexCount,this.offsets[t]=e.firstVertex),this.instances[t]=Math.max(1,e.instanceCount)},e._ensureCapacity=function(t){if(!(this._capacity>t)){this._capacity=Hi(t);var e=new Int32Array(this._capacity),i=new Int32Array(this._capacity),n=new Int32Array(this._capacity);this.byteOffsets=new Int32Array(this._capacity),e.set(this.counts),i.set(this.offsets),n.set(this.instances),this.counts=e,this.offsets=i,this.instances=n}},t}(),S7=function(){function t(){this._srcFramebuffer=void 0,this._dstFramebuffer=void 0;var t=G6.instance.gl;this._srcFramebuffer=t.createFramebuffer(),this._dstFramebuffer=t.createFramebuffer()}return t.prototype.destroy=function(){var t=G6.instance.gl;t.deleteFramebuffer(this._srcFramebuffer),t.deleteFramebuffer(this._dstFramebuffer)},n(t,[{key:"srcFramebuffer",get:function(){return this._srcFramebuffer}},{key:"dstFramebuffer",get:function(){return this._dstFramebuffer}}]),t}(),E7=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r0&&(t.extensions.useVAO&&n.glVAO&&(i.bindVertexArray(null),n.glVAO=null),l7.gpuInputAssembler=null,t.stateCache.glArrayBuffer!==e.glBuffer&&(i.bindBuffer(i.ARRAY_BUFFER,e.glBuffer),t.stateCache.glArrayBuffer=e.glBuffer),i.bufferData(i.ARRAY_BUFFER,e.size,r),i.bindBuffer(i.ARRAY_BUFFER,null),t.stateCache.glArrayBuffer=null))}else if(e.usage&ql.INDEX){e.glTarget=i.ELEMENT_ARRAY_BUFFER;var a=i.createBuffer();a&&(e.glBuffer=a,e.size>0&&(t.extensions.useVAO&&n.glVAO&&(i.bindVertexArray(null),n.glVAO=null),l7.gpuInputAssembler=null,t.stateCache.glElementArrayBuffer!==e.glBuffer&&(i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.glBuffer),t.stateCache.glElementArrayBuffer=e.glBuffer),i.bufferData(i.ELEMENT_ARRAY_BUFFER,e.size,r),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,null),t.stateCache.glElementArrayBuffer=null))}else if(e.usage&ql.UNIFORM){e.glTarget=i.UNIFORM_BUFFER;var o=i.createBuffer();o&&e.size>0&&(e.glBuffer=o,t.stateCache.glUniformBuffer!==e.glBuffer&&(i.bindBuffer(i.UNIFORM_BUFFER,e.glBuffer),t.stateCache.glUniformBuffer=e.glBuffer),i.bufferData(i.UNIFORM_BUFFER,e.size,r),i.bindBuffer(i.UNIFORM_BUFFER,null),t.stateCache.glUniformBuffer=null)}else e.usage&ql.INDIRECT||e.usage&ql.TRANSFER_DST||e.usage&ql.TRANSFER_SRC||G("Unsupported BufferType, create buffer failed."),e.glTarget=i.NONE}(G6.instance,this._gpuBuffer),G6.instance.memoryStatus.bufferSize+=this._size},i.destroy=function(){this._gpuBuffer&&(this._isBufferView||(function(t,e){var i=t.gl,n=t.stateCache;if(e.glBuffer){switch(e.glTarget){case i.ARRAY_BUFFER:t.extensions.useVAO&&n.glVAO&&(i.bindVertexArray(null),t.stateCache.glVAO=null),l7.gpuInputAssembler=null,i.bindBuffer(i.ARRAY_BUFFER,null),t.stateCache.glArrayBuffer=null;break;case i.ELEMENT_ARRAY_BUFFER:t.extensions.useVAO&&n.glVAO&&(i.bindVertexArray(null),t.stateCache.glVAO=null),l7.gpuInputAssembler=null,i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,null),t.stateCache.glElementArrayBuffer=null;break;case i.UNIFORM_BUFFER:i.bindBuffer(i.UNIFORM_BUFFER,null),t.stateCache.glUniformBuffer=null}i.deleteBuffer(e.glBuffer),e.glBuffer=null}}(G6.instance,this._gpuBuffer),G6.instance.memoryStatus.bufferSize-=this._size),this._gpuBuffer=null)},i.resize=function(t){if(this._isBufferView)console.warn("cannot resize buffer views!");else{var e=this._size;e!==t&&(this._size=t,this._count=this._size/this._stride,this._gpuBuffer&&(this._gpuBuffer.size=t,t>0&&(function(t,e){var i=t.gl,n=t.stateCache,r=e.memUsage&Jl.HOST?i.DYNAMIC_DRAW:i.STATIC_DRAW;e.usage&ql.VERTEX?(t.extensions.useVAO&&n.glVAO&&(i.bindVertexArray(null),n.glVAO=null),l7.gpuInputAssembler=null,n.glArrayBuffer!==e.glBuffer&&i.bindBuffer(i.ARRAY_BUFFER,e.glBuffer),e.buffer?i.bufferData(i.ARRAY_BUFFER,e.buffer,r):i.bufferData(i.ARRAY_BUFFER,e.size,r),i.bindBuffer(i.ARRAY_BUFFER,null),n.glArrayBuffer=null):e.usage&ql.INDEX?(t.extensions.useVAO&&n.glVAO&&(i.bindVertexArray(null),n.glVAO=null),l7.gpuInputAssembler=null,t.stateCache.glElementArrayBuffer!==e.glBuffer&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.glBuffer),e.buffer?i.bufferData(i.ELEMENT_ARRAY_BUFFER,e.buffer,r):i.bufferData(i.ELEMENT_ARRAY_BUFFER,e.size,r),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,null),t.stateCache.glElementArrayBuffer=null):e.usage&ql.UNIFORM?(t.stateCache.glUniformBuffer!==e.glBuffer&&i.bindBuffer(i.UNIFORM_BUFFER,e.glBuffer),i.bufferData(i.UNIFORM_BUFFER,e.size,r),i.bindBuffer(i.UNIFORM_BUFFER,null),t.stateCache.glUniformBuffer=null):(e.usage&ql.INDIRECT||e.usage&ql.TRANSFER_DST||e.usage&ql.TRANSFER_SRC||G("Unsupported BufferType, create buffer failed."),e.glTarget=i.NONE)}(G6.instance,this._gpuBuffer),G6.instance.memoryStatus.bufferSize-=e,G6.instance.memoryStatus.bufferSize+=t)))}},i.update=function(t,e){var i;this._isBufferView?console.warn("cannot update through buffer views!"):(i=void 0!==e?e:this._usage&ql.INDIRECT?0:t.byteLength,o7(G6.instance,this._gpuBuffer,t,0,i))},n(e,[{key:"gpuBuffer",get:function(){return this._gpuBuffer}}]),e}(Q_),A7=function(){function t(t,e){this._frees=void 0,this._freeIdx=0,this._freeCmds=void 0,this._frees=new Array(e),this._freeCmds=new Nu(e);for(var i=0;i0?this.gpuColorViews[0].gpuTexture.width:this.gpuDepthStencilView?this.gpuDepthStencilView.gpuTexture.width:s},set width(t){s=t},get height(){return this.gpuColorViews.length>0?this.gpuColorViews[0].gpuTexture.height:this.gpuDepthStencilView?this.gpuDepthStencilView.gpuTexture.height:a},set height(t){a=t}},function(t,e){for(var i=0;i>o.baseLevel),e.height=Math.min(e.height,h.height>>o.baseLevel))}var u=e.gpuDepthStencilView;if(u){var l=u.gpuTexture,c=F_[l.format].hasStencil?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;l.glTexture?n.framebufferTexture2D(n.FRAMEBUFFER,c,l.glTarget,l.glTexture,e.gpuDepthStencilView.baseLevel):n.framebufferRenderbuffer(n.FRAMEBUFFER,c,n.RENDERBUFFER,l.glRenderbuffer),e.width=Math.min(e.width,l.width>>u.baseLevel),e.height=Math.min(e.height,l.height>>u.baseLevel)}n.drawBuffers(r);var _=n.checkFramebufferStatus(n.FRAMEBUFFER);if(_!==n.FRAMEBUFFER_COMPLETE)switch(_){case n.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:G("glCheckFramebufferStatus() - FRAMEBUFFER_INCOMPLETE_ATTACHMENT");break;case n.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:G("glCheckFramebufferStatus() - FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT");break;case n.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:G("glCheckFramebufferStatus() - FRAMEBUFFER_INCOMPLETE_DIMENSIONS");break;case n.FRAMEBUFFER_UNSUPPORTED:G("glCheckFramebufferStatus() - FRAMEBUFFER_UNSUPPORTED")}t.stateCache.glFramebuffer!==e.glFramebuffer&&n.bindFramebuffer(n.FRAMEBUFFER,t.stateCache.glFramebuffer)}}(G6.instance,this._gpuFramebuffer),this._width=this._gpuFramebuffer.width,this._height=this._gpuFramebuffer.height},i.destroy=function(){var t,e;this._gpuFramebuffer&&(t=G6.instance,(e=this._gpuFramebuffer).glFramebuffer&&(t.gl.deleteFramebuffer(e.glFramebuffer),t.stateCache.glFramebuffer===e.glFramebuffer&&(t.gl.bindFramebuffer(t.gl.FRAMEBUFFER,null),t.stateCache.glFramebuffer=null),e.glFramebuffer=null),this._gpuFramebuffer=null)},n(e,[{key:"gpuFramebuffer",get:function(){return this._gpuFramebuffer}}]),e}(ed),w7=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;ri&&(i=s.binding)}this._bindingIndices=Array(i+1).fill(-1);for(var a=this._descriptorIndices=Array(i+1).fill(-1),o=0;o0){e.glSamplerTextures=new Array(e.samplerTextures.length);for(var M=0;M1&&(this._info.levelCount=Math.min(this._info.levelCount,e.getLevelCount(t,i)));var n=this._size;this._info.width=t,this._info.height=i,this._size=V_(this._info.format,this.width,this.height,this.depth,this._info.levelCount)*this._info.layerCount,!this._isTextureView&&this._gpuTexture&&(this._gpuTexture.width=t,this._gpuTexture.height=i,this._gpuTexture.size=this._size,this._gpuTexture.isSwapchainTexture||(function(t,e){if(e.size){var i=t.gl,n=e.width,r=e.height,s=e.depth,a=e.arrayLayer;switch(e.type){case $l.TEX2D:e.glTarget=i.TEXTURE_2D;var o=Math.max(n,r);if(o>t.capabilities.maxTextureSize&&Z(9100,o,t.capabilities.maxTextureSize),e.samples===nc.X1){var h=t.stateCache.glTexUnits[t.stateCache.texUnit];if(h.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_2D,e.glTexture),h.glTexture=e.glTexture),F_[e.format].isCompressed)for(var u=0;u>1),r=Math.max(1,r>>1)}else u7(t,e),h7(t,e)}else e.glRenderbuffer&&(t.stateCache.glRenderbuffer!==e.glRenderbuffer&&(i.bindRenderbuffer(i.RENDERBUFFER,e.glRenderbuffer),t.stateCache.glRenderbuffer=e.glRenderbuffer),i.renderbufferStorageMultisample(i.RENDERBUFFER,e.samples,e.glInternalFmt,e.width,e.height));break;case $l.TEX2D_ARRAY:e.glTarget=i.TEXTURE_2D_ARRAY;var _=Math.max(n,r);if(_>t.capabilities.maxTextureSize&&Z(9100,_,t.capabilities.maxTextureSize),a>t.capabilities.maxArrayTextureLayers&&Z(9100,a,t.capabilities.maxArrayTextureLayers),e.glTexture=i.createTexture(),e.size>0){var d=t.stateCache.glTexUnits[t.stateCache.texUnit];if(d.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_2D_ARRAY,e.glTexture),d.glTexture=e.glTexture),F_[e.format].isCompressed)for(var f=0;f>1),r=Math.max(1,r>>1)}else i.texStorage3D(i.TEXTURE_2D_ARRAY,e.mipLevel,e.glInternalFmt,n,r,a)}break;case $l.TEX3D:e.glTarget=i.TEXTURE_3D;var g=Math.max(Math.max(n,r),s);if(g>t.capabilities.max3DTextureSize&&Z(9100,g,t.capabilities.max3DTextureSize),e.glTexture=i.createTexture(),e.size>0){var v=t.stateCache.glTexUnits[t.stateCache.texUnit];if(v.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_3D,e.glTexture),v.glTexture=e.glTexture),F_[e.format].isCompressed)for(var y=0;y>1),r=Math.max(1,r>>1)}else i.texStorage3D(i.TEXTURE_3D,e.mipLevel,e.glInternalFmt,n,r,s)}break;case $l.CUBE:e.type=$l.CUBE,e.glTarget=i.TEXTURE_CUBE_MAP;var E=Math.max(n,r);E>t.capabilities.maxCubeMapTextureSize&&Z(9100,E,t.capabilities.maxTextureSize);var A=t.stateCache.glTexUnits[t.stateCache.texUnit];if(A.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_CUBE_MAP,e.glTexture),A.glTexture=e.glTexture),F_[e.format].isCompressed)for(var R=0;R<6;++R){n=e.width,r=e.height;for(var b=0;b>1),r=Math.max(1,r>>1)}}else u7(t,e),h7(t,e);break;default:G("Unsupported TextureType, create texture failed."),e.type=$l.TEX2D,e.glTarget=i.TEXTURE_2D}}}(G6.instance,this._gpuTexture),G6.instance.memoryStatus.textureSize-=n,G6.instance.memoryStatus.textureSize+=this._size))}},i.initAsSwapchainTexture=function(t){var e=new t_;e.format=t.format,e.usage=F_[t.format].hasDepth?tc.DEPTH_STENCIL_ATTACHMENT:tc.COLOR_ATTACHMENT,e.width=t.width,e.height=t.height,this.initialize(e,!0)},n(e,[{key:"gpuTexture",get:function(){return this._gpuTexture}},{key:"gpuTextureView",get:function(){return this._gpuTextureView}}]),e}(md),U7="webglcontextlost";function G7(t,e){for(var i=["","WEBKIT_","MOZ_"],n=0;n1||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=0){var s=t._probes,a=s[this.vertex0].position,o=s[this.vertex1].position,h=s[this.vertex2].position,u=s[this.vertex3].position;this.sphere.init(a,o,h,u)}}var e=t.prototype;return e.isInCircumSphere=function(t){return hn.squaredDistance(t,this.sphere.center)=0},e.isOuterCell=function(){return this.vertex3<0},t}(),p9=Gs(f9.prototype,"invalid",[w9],(function(){return!1})),m9=Gs(f9.prototype,"vertex0",[w9],(function(){return-1})),g9=Gs(f9.prototype,"vertex1",[w9],(function(){return-1})),v9=Gs(f9.prototype,"vertex2",[w9],(function(){return-1})),y9=Gs(f9.prototype,"vertex3",[w9],(function(){return-1})),T9=Gs(f9.prototype,"neighbours",[w9],(function(){return[-1,-1,-1,-1]})),S9=Gs(f9.prototype,"matrix",[w9],(function(){return new vn})),E9=Gs(f9.prototype,"offset",[w9],(function(){return new hn(0,0,0)})),A9=Gs(f9.prototype,"sphere",[w9],(function(){return new U9})),d9=f9))||d9),H9=t("eV",function(){function t(t){this._probes=[],this._tetrahedrons=[],this._triangles=[],this._edges=[],this._probes=t}var e=t.prototype;return e.build=function(){return this.reset(),this.tetrahedralize(),this.computeAdjacency(),this.computeMatrices(),this._tetrahedrons},e.reset=function(){this._tetrahedrons.length=0,this._triangles.length=0,this._edges.length=0},e.tetrahedralize=function(){for(var t=this._probes.length,e=this.initTetrahedron(),i=0;i0&&hn.negate(t,t),hn.add(l.normal,l.normal,t),hn.add(c.normal,c.normal,t),hn.add(_.normal,_.normal,t);var p=this._triangles[h].vertex0,m=f>0?this._triangles[h].vertex2:this._triangles[h].vertex1,g=f>0?this._triangles[h].vertex1:this._triangles[h].vertex2,v=new G9(this,p,m,g);v.neighbours[3]=this._triangles[h].tetrahedron,this._tetrahedrons[this._triangles[h].tetrahedron].neighbours[this._triangles[h].index]=this._tetrahedrons.length,this._tetrahedrons.push(v)}}for(var y=0,T=r;T=0?this.computeTetrahedronMatrix(e):this.computeOuterCellMatrix(e)}},e.computeTetrahedronMatrix=function(t){var e=this._probes[t.vertex0].position,i=this._probes[t.vertex1].position,n=this._probes[t.vertex2].position,r=this._probes[t.vertex3].position;t.matrix.set(e.x-r.x,i.x-r.x,n.x-r.x,e.y-r.y,i.y-r.y,n.y-r.y,e.z-r.z,i.z-r.z,n.z-r.z),t.matrix.invert(),t.matrix.transpose()},e.computeOuterCellMatrix=function(t){var e=[],i=[];e[0]=this._probes[t.vertex0].normal,e[1]=this._probes[t.vertex1].normal,e[2]=this._probes[t.vertex2].normal,i[0]=this._probes[t.vertex0].position,i[1]=this._probes[t.vertex1].position,i[2]=this._probes[t.vertex2].position,hn.subtract(O9,i[0],i[2]),hn.subtract(D9,e[0],e[2]),hn.subtract(M9,i[1],i[2]),hn.subtract(P9,e[1],e[2]),B9.set(i[2]),hn.negate(N9,e[2]);var n=[];n[0]=D9.y*P9.z-D9.z*P9.y,n[3]=-D9.x*P9.z+D9.z*P9.x,n[6]=D9.x*P9.y-D9.y*P9.x,n[9]=O9.x*P9.y*N9.z-O9.y*P9.x*N9.z+D9.x*M9.y*N9.z-D9.y*M9.x*N9.z+O9.z*P9.x*N9.y-O9.z*P9.y*N9.x+D9.z*M9.x*N9.y-D9.z*M9.y*N9.x-O9.x*P9.z*N9.y+O9.y*P9.z*N9.x-D9.x*M9.z*N9.y+D9.y*M9.z*N9.x,n[9]-=B9.x*n[0]+B9.y*n[3]+B9.z*n[6],n[1]=D9.y*M9.z+O9.y*P9.z-D9.z*M9.y-O9.z*P9.y,n[4]=-O9.x*P9.z-D9.x*M9.z+O9.z*P9.x+D9.z*M9.x,n[7]=O9.x*P9.y-O9.y*P9.x+D9.x*M9.y-D9.y*M9.x,n[10]=O9.x*M9.y*N9.z-O9.y*M9.x*N9.z-O9.x*M9.z*N9.y+O9.y*M9.z*N9.x+O9.z*M9.x*N9.y-O9.z*M9.y*N9.x,n[10]-=B9.x*n[1]+B9.y*n[4]+B9.z*n[7],n[2]=-O9.z*M9.y+O9.y*M9.z,n[5]=-O9.x*M9.z+O9.z*M9.x,n[8]=O9.x*M9.y-O9.y*M9.x,n[11]=0,n[11]-=B9.x*n[2]+B9.y*n[5]+B9.z*n[8];var r=D9.x*P9.y*N9.z-D9.y*P9.x*N9.z+D9.z*P9.x*N9.y-D9.z*P9.y*N9.x+D9.y*P9.z*N9.x-D9.x*P9.z*N9.y;if(Math.abs(r)>Ci)for(var s=0;s<12;s++)n[s]/=r;else t.vertex3=-2;t.matrix.set(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],n[8]),t.offset.set(n[9],n[10],n[11])},t}()),z9=t("eW",function(){function t(){}return t.uniformSampleSphere=function(t,e){var i=1-2*t,n=Math.sqrt(Math.max(0,1-i*i)),r=2*Math.PI*e,s=n*Math.cos(r),a=n*Math.sin(r);return new hn(s,a,i)},t.uniformSampleSphereAll=function(t){for(var e=Math.floor(Math.sqrt(t)),i=e,n=[],r=1/e,s=1/i,a=0;a0&&(t.length,e.length);for(var i=this.getBasisCount(),n=t.length,r=1/(z9.uniformSpherePdf()*n),s=[],a=0;a0){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=0)return n[c]+r;return 0},t}(),J9=new hn(0,0,0),$9=new hn(0,0,0),ttt=new hn(0,0,0),ett=new hn(0,0,0),itt=new hn(0,0,0),ntt=new hn(0,0,0),rtt=new hn(0,0,0),stt=new hn(0,0,0),att=new hn(0,0,0),ott=new hn(0,0,0),htt=new hn(0,0,0),utt=new hn(0,0,0),ltt=new hn(0,0,0),ctt=new hn(0,0,0),_tt=new hn(0,0,0),dtt=t("eY",(W9=qs("cc.LightProbesData"),X9=xa([L9]),j9=xa([G9]),W9((K9=function(){function t(){this._probes=q9&&q9(),this._tetrahedrons=Q9&&Q9()}var e=t.prototype;return e.empty=function(){return 0===this._probes.length||0===this._tetrahedrons.length},e.reset=function(){this._probes.length=0,this._tetrahedrons.length=0},e.updateProbes=function(t){this._probes.length=t.length;for(var e=this._probes.length,i=0;i=0)for(var h=this._probes[r.vertex3].coefficients,u=0;u=n)&&(e=0);for(var r=-1,s=-1,a=0;a=0&&i.y>=0&&i.z>=0&&i.w>=0)break;if(r===(s=i.x=0?this.getTetrahedronBarycentricCoord(t,e,i):this.getOuterCellBarycentricCoord(t,e,i)},e.getTetrahedronBarycentricCoord=function(t,e,i){var n=new hn(0,0,0);hn.subtract(n,t,this._probes[e.vertex3].position),hn.transformMat3(n,n,e.matrix),i.set(n.x,n.y,n.z,1-n.x-n.y-n.z)},e.getOuterCellBarycentricCoord=function(e,i,n){var r=this._probes[i.vertex0].position,s=this._probes[i.vertex1].position,a=this._probes[i.vertex2].position;hn.subtract(ott,s,r),hn.subtract(htt,a,r),hn.cross(att,ott,htt),hn.subtract(utt,e,r);var o=hn.dot(utt,att);if(o<0)n.set(0,0,0,-1);else{var h=new hn(0,0,0);hn.transformMat3(h,e,i.matrix),hn.add(h,h,i.offset),o=-1===i.vertex3?Z9.getCubicUniqueRoot(h.x,h.y,h.z):Z9.getQuadraticUniqueRoot(h.x,h.y,h.z),hn.scaleAndAdd(ltt,r,this._probes[i.vertex0].normal,o),hn.scaleAndAdd(ctt,s,this._probes[i.vertex1].normal,o),hn.scaleAndAdd(_tt,a,this._probes[i.vertex2].normal,o);var u=t.getTriangleBarycentricCoord(ltt,ctt,_tt,e);n.set(u.x,u.y,u.z,0)}},n(t,[{key:"probes",get:function(){return this._probes}},{key:"tetrahedrons",get:function(){return this._tetrahedrons}}]),t}(),q9=Gs(K9.prototype,"_probes",[ra,X9],(function(){return[]})),Q9=Gs(K9.prototype,"_tetrahedrons",[ra,j9],(function(){return[]})),Y9=K9))||Y9));v.internal.LightProbesData=dtt;var ftt,ptt,mtt,gtt,vtt,ytt,Ttt,Stt,Ett,Att,Rtt,btt,Ctt,wtt,xtt,Itt=t("eZ",function(){function t(){this._giScale=1,this._giSamples=1024,this._bounces=2,this._reduceRinging=0,this._showProbe=!0,this._showWireframe=!0,this._showConvex=!1,this._data=null,this._lightProbeSphereVolume=1}var e=t.prototype;return e.initialize=function(t){this._giScale=t.giScale,this._giSamples=t.giSamples,this._bounces=t.bounces,this._reduceRinging=t.reduceRinging,this._showProbe=t.showProbe,this._showWireframe=t.showWireframe,this._showConvex=t.showConvex,this._data=t.data,this._lightProbeSphereVolume=t.lightProbeSphereVolume},e.empty=function(){return!this._data||this._data.empty()},n(t,[{key:"giScale",get:function(){return this._giScale},set:function(t){this._giScale=t}},{key:"giSamples",get:function(){return this._giSamples},set:function(t){this._giSamples=t}},{key:"bounces",get:function(){return this._bounces},set:function(t){this._bounces=t}},{key:"reduceRinging",get:function(){return this._reduceRinging},set:function(t){this._reduceRinging=t}},{key:"showProbe",get:function(){return this._showProbe},set:function(t){this._showProbe=t}},{key:"showWireframe",get:function(){return this._showWireframe},set:function(t){this._showWireframe=t}},{key:"showConvex",get:function(){return this._showConvex},set:function(t){this._showConvex=t}},{key:"data",get:function(){return this._data},set:function(t){this._data=t}},{key:"lightProbeSphereVolume",get:function(){return this._lightProbeSphereVolume},set:function(t){this._lightProbeSphereVolume=t}}]),t}());v.internal.LightProbes=Itt,t("e_",(ftt=qs("cc.LightProbeGroup"),ptt=xa([hn]),mtt=xa(R9),gtt=xa(Ke),vtt=xa(Ke),ytt=xa(Ke),ftt(Ttt=Js((Stt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r=n.length&&(t=n.length-1),t<0&&(t=0),this._techIndex=t,this.updateTechnique()}}]),i}(op),Ntt=Gs(Btt.prototype,"_texture",[Dtt],(function(){return null})),f(Btt.prototype,"texture",[Mtt],Object.getOwnPropertyDescriptor(Btt.prototype,"texture"),Btt.prototype),Ltt=Gs(Btt.prototype,"_height",[ra],(function(){return 0})),Ftt=Gs(Btt.prototype,"_width",[ra],(function(){return 0})),ktt=Gs(Btt.prototype,"_rotation",[ra],(function(){return 0})),Utt=Gs(Btt.prototype,"_techIndex",[ra],(function(){return 0})),Ptt=Btt))||Ptt)),set=[new __(Mc.ATTR_POSITION,jl.RGB32F),new __(Mc.ATTR_TEX_COORD,jl.RGBA32F),new __(Mc.ATTR_TEX_COORD1,jl.RGB32F),new __(Mc.ATTR_COLOR,jl.RGBA8,!0)],aet=new hn,oet=new hn,het=function(t){function e(){var e;return(e=t.call(this)||this)._capacity=void 0,e._vertSize=0,e._vBuffer=null,e._vertAttrsFloatCount=0,e._vdataF32=null,e._vdataUint32=null,e._subMeshData=null,e._vertCount=0,e._indexCount=0,e._material=null,e._iaVertCount=0,e._iaIndexCount=0,e.type=mB.LINE,e._capacity=100,e}s(e,t);var i=e.prototype;return i.setCapacity=function(t){this._capacity=t,this.createBuffer()},i.createBuffer=function(){this._vertSize=0;for(var t=0,e=set;t1){var n=0;hn.subtract(aet,t[1],t[0]),this._vdataF32[n++]=t[0].x,this._vdataF32[n++]=t[0].y,this._vdataF32[n++]=t[0].z,this._vdataF32[n++]=0,this._vdataF32[n++]=e.evaluate(0,1),this._vdataF32[n++]=0,this._vdataF32[n++]=0,this._vdataF32[n++]=aet.x,this._vdataF32[n++]=aet.y,this._vdataF32[n++]=aet.z,this._vdataUint32[n++]=i.evaluate(0,1)._val,this._vdataF32[n++]=t[0].x,this._vdataF32[n++]=t[0].y,this._vdataF32[n++]=t[0].z,this._vdataF32[n++]=1,this._vdataF32[n++]=e.evaluate(0,1),this._vdataF32[n++]=0,this._vdataF32[n++]=1,this._vdataF32[n++]=aet.x,this._vdataF32[n++]=aet.y,this._vdataF32[n++]=aet.z,this._vdataUint32[n++]=i.evaluate(0,1)._val;for(var r=1;r0&&this._models[0]&&this._detachFromScene()},i._attachToScene=function(){if(t.prototype._attachToScene.call(this),this._models.length>0&&this._models[0]&&this.node&&this.node.scene){var e=this._models[0];e.scene&&this._detachFromScene(),this._getRenderScene().addModel(e)}},i._detachFromScene=function(){if(t.prototype._detachFromScene.call(this),this._models.length>0&&this._models[0]){var e=this._models[0];e.scene&&e.scene.removeModel(e)}},i._onMaterialModified=function(e,i){t.prototype._onMaterialModified.call(this,e,i);var n=this.getMaterialInstance(0);n&&(Wet.CC_USE_WORLD_SPACE=this.worldSpace,n.recompileShaders(Wet),this._models[0]&&this._models[0].updateMaterial(n))},n(e,[{key:"texture",get:function(){return this._texture},set:function(t){this._texture=t,this.material&&this.material.setProperty("mainTexture",t)}},{key:"lineMaterial",get:function(){return this.getSharedMaterial(0)},set:function(t){this.setSharedMaterial(t,0)}},{key:"sharedMaterials",get:function(){return t.prototype.sharedMaterials},set:function(t){this.sharedMaterials=t}},{key:"worldSpace",get:function(){return this._worldSpace},set:function(t){this._worldSpace=t;var e=this.getMaterialInstance(0);e&&(Wet.CC_USE_WORLD_SPACE=this.worldSpace,e.recompileShaders(Wet),this._models[0]&&this._models[0].setSubModelMaterial(0,e))}},{key:"positions",get:function(){return this._positions},set:function(t){this._positions=t,this._models[0]&&this._models[0].addLineVertexData(this._positions,this.width,this.color)}},{key:"width",get:function(){return this._width},set:function(t){this._width=t,this._models[0]&&this._models[0].addLineVertexData(this._positions,this._width,this._color)}},{key:"color",get:function(){return this._color},set:function(t){this._color=t,this._models[0]&&this._models[0].addLineVertexData(this._positions,this._width,this._color)}},{key:"tile",get:function(){return this._tile},set:function(t){this._tile.set(t),this.material&&(this._tile_offset.x=this._tile.x,this._tile_offset.y=this._tile.y,this.material.setProperty("mainTiling_Offset",this._tile_offset))}},{key:"offset",get:function(){return this._offset},set:function(t){this._offset.set(t),this.material&&(this._tile_offset.z=this._offset.x,this._tile_offset.w=this._offset.y,this.material.setProperty("mainTiling_Offset",this._tile_offset))}}]),e}(gW),Det=Gs(Oet.prototype,"_texture",[yet],(function(){return null})),f(Oet.prototype,"texture",[Tet],Object.getOwnPropertyDescriptor(Oet.prototype,"texture"),Oet.prototype),Met=Gs(Oet.prototype,"_material",[ra],(function(){return null})),f(Oet.prototype,"lineMaterial",[Eet],Object.getOwnPropertyDescriptor(Oet.prototype,"lineMaterial"),Oet.prototype),f(Oet.prototype,"sharedMaterials",[Ia,ra],Object.getOwnPropertyDescriptor(Oet.prototype,"sharedMaterials"),Oet.prototype),Pet=Gs(Oet.prototype,"_worldSpace",[ra],(function(){return!1})),Bet=Gs(Oet.prototype,"_positions",[Aet],(function(){return[]})),f(Oet.prototype,"positions",[Ret],Object.getOwnPropertyDescriptor(Oet.prototype,"positions"),Oet.prototype),f(Oet.prototype,"width",[bet],Object.getOwnPropertyDescriptor(Oet.prototype,"width"),Oet.prototype),Net=Gs(Oet.prototype,"_width",[ra],(function(){return new det})),f(Oet.prototype,"color",[Cet],Object.getOwnPropertyDescriptor(Oet.prototype,"color"),Oet.prototype),Let=Gs(Oet.prototype,"_color",[ra],(function(){return new zet})),Fet=Gs(Oet.prototype,"_tile",[ra],(function(){return new Fn(1,1)})),f(Oet.prototype,"tile",[wet],Object.getOwnPropertyDescriptor(Oet.prototype,"tile"),Oet.prototype),ket=Gs(Oet.prototype,"_offset",[ra],(function(){return new Fn(0,0)})),f(Oet.prototype,"offset",[xet],Object.getOwnPropertyDescriptor(Oet.prototype,"offset"),Oet.prototype),Iet=Oet))||Iet)),jet=function(){function t(t){this.particleSystem=void 0,this.position=void 0,this.velocity=void 0,this.animatedVelocity=void 0,this.ultimateVelocity=void 0,this.angularVelocity=void 0,this.axisOfRotation=void 0,this.rotation=void 0,this.startEuler=void 0,this.startRotation=void 0,this.startRotated=void 0,this.deltaQuat=void 0,this.deltaMat=void 0,this.localMat=void 0,this.startSize=void 0,this.size=void 0,this.startColor=void 0,this.color=void 0,this.randomSeed=void 0,this.remainingLifetime=void 0,this.loopCount=void 0,this.lastLoop=void 0,this.trailDelay=void 0,this.startLifetime=void 0,this.emitAccumulator0=void 0,this.emitAccumulator1=void 0,this.frameIndex=void 0,this.startRow=void 0,this.particleSystem=t,this.position=new hn(0,0,0),this.velocity=new hn(0,0,0),this.animatedVelocity=new hn(0,0,0),this.ultimateVelocity=new hn(0,0,0),this.angularVelocity=new hn(0,0,0),this.axisOfRotation=new hn(0,0,0),this.rotation=new hn(0,0,0),this.startEuler=new hn(0,0,0),this.startRotation=new En,this.startRotated=!1,this.deltaQuat=new En,this.deltaMat=new Dn,this.localMat=new Dn,this.startSize=new hn(0,0,0),this.size=new hn(0,0,0),this.startColor=pn.WHITE.clone(),this.color=pn.WHITE.clone(),this.randomSeed=0,this.remainingLifetime=0,this.loopCount=0,this.lastLoop=0,this.trailDelay=0,this.startLifetime=0,this.emitAccumulator0=0,this.emitAccumulator1=0,this.frameIndex=0,this.startRow=0}return t.prototype.reset=function(){this.rotation.set(0,0,0),this.startEuler.set(0,0,0),this.startRotation.set(0,0,0,1),this.startRotated=!1,this.deltaQuat.set(0,0,0,1),this.deltaMat.identity(),this.localMat.identity()},t}();jet.INDENTIFY_NEG_QUAT=10,jet.R2D=180/Math.PI;var Yet,Ket,qet,Qet,Zet,Jet,$et="colorModule",tit="rotationModule",eit="sizeModule",iit="textureModule",nit="noiseModule",rit=["sizeModule","colorModule","forceModule","velocityModule","limitModule","rotationModule","textureModule","noiseModule"],sit=["_colorOverLifetimeModule","_shapeModule","_sizeOvertimeModule","_velocityOvertimeModule","_forceOvertimeModule","_limitVelocityOvertimeModule","_rotationOvertimeModule","_textureAnimationModule","_noiseModule","_trailModule"],ait=function(){function t(){this.target=null,this.needUpdate=!1,this.needAnimate=!0,this.name=void 0}var e=t.prototype;return e.bindTarget=function(t){this.target=t},e.update=function(){},t}(),oit=ve({World:0,Local:1,Custom:2}),hit=ve({Pause:0,PauseAndCatchup:1,AlwaysSimulate:2}),uit=ve({World:0,Local:1,View:2}),lit=ve({Billboard:0,StrecthedBillboard:1,HorizontalBillboard:2,VerticalBillboard:3,Mesh:4}),cit=ve({Box:0,Circle:1,Cone:2,Sphere:3,Hemisphere:4}),_it=ve({Base:0,Edge:1,Shell:2,Volume:3}),dit=ve({Random:0,Loop:1,PingPong:2}),fit=ve({Particles:0}),pit=ve({Stretch:0}),mit=new hn(0,0,-1);function git(t,e,i,n){return e!==t?(t===oit.World||Dn.invert(i,i),Dn.getRotation(n,i),!0):(En.set(n,0,0,0,1),!1)}function vit(t,e){Fn.set(t,Math.cos(e),Math.sin(e))}function yit(t){var e=Li(-1,1),i=Li(0,2*Math.PI),n=Math.sqrt(1-e*e),r=n*Math.cos(i),s=n*Math.sin(i);hn.set(t,r,s,e)}function Tit(t,e,i){yit(t),hn.multiplyScalar(t,t,e+(i-e)*Bi())}function Sit(t,e,i,n){vit(t,n),t.z=0,hn.multiplyScalar(t,t,e+(i-e)*Bi())}function Eit(t){for(var e=0;ee){var s=r-r*i;r=s>e?s:e}return r*n}var ynt,Tnt,Snt,Ent,Ant,Rnt,bnt,Cnt,wnt,xnt,Int,Ont,Dnt,Mnt,Pnt,Bnt,Nnt,Lnt,Fnt,knt,Unt,Gnt,Hnt,znt,Vnt,Wnt,Xnt,jnt,Ynt,Knt,qnt,Qnt,Znt,Jnt,$nt,trt,ert,irt,nrt,rrt,srt,art,ort,hrt,urt,lrt,crt,_rt,drt,frt,prt,mrt,grt,vrt,yrt,Trt,Srt,Ert,Art,Rrt,brt,Crt,wrt,xrt,Irt,Ort,Drt,Mrt,Prt,Brt,Nrt,Lrt,Frt,krt,Urt,Grt,Hrt,zrt,Vrt,Wrt,Xrt,jrt,Yrt,Krt,qrt,Qrt,Zrt=125292,Jrt=($it=qs("cc.RotationOvertimeModule"),tnt=xa(det),ent=xa(det),int=xa(det),$it((rnt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r0){var i=zi(t._time-t.startDelay.evaluate(0,1),t.duration)-e;i=i>0?i:0;var n=zi(t.time-t.startDelay.evaluate(0,1),t.duration);this._curTime>=i&&this._curTime0&&(n.z*=-1),hn.normalize(r,n);break;case _it.Shell:yit(n),hn.multiplyScalar(n,n,e),n.z>0&&(n.z*=-1),hn.normalize(r,n);break;default:console.warn(t+" is not supported for hemisphere emitter.")}}(this.emitFrom,this.radius,this.radiusThickness,t.position,t.velocity);break;default:console.warn(this.shapeType+" shapeType is not supported by ShapeModule.")}if(this.randomPositionAmount>0&&(t.position.x+=Li(-this.randomPositionAmount,this.randomPositionAmount),t.position.y+=Li(-this.randomPositionAmount,this.randomPositionAmount),t.position.z+=Li(-this.randomPositionAmount,this.randomPositionAmount)),hn.transformQuat(t.velocity,t.velocity,this.quat),hn.transformMat4(t.position,t.position,this.mat),this.sphericalDirectionAmount>0){var e=hn.normalize(hst,t.position);hn.lerp(t.velocity,t.velocity,e,this.sphericalDirectionAmount)}this.lastTime=this.particleSystem._time},e.constructMat=function(){En.fromEuler(this.quat,this._rotation.x,this._rotation.y,this._rotation.z),Dn.fromRTS(this.mat,this.quat,this._position,this._scale)},e.generateArcAngle=function(){if(this.arcMode===dit.Random)return Li(0,this._arc);var t=this.totalAngle+2*Math.PI*this.arcSpeed.evaluate(this.particleSystem._time,1)*(this.particleSystem._time-this.lastTime);switch(this.totalAngle=t,0!==this.arcSpread&&(t=Math.floor(t/(this._arc*this.arcSpread))*this._arc*this.arcSpread),this.arcMode){case dit.Loop:return zi(t,this._arc);case dit.PingPong:return Vi(t,this._arc);default:return zi(t,this._arc)}},n(t,[{key:"position",get:function(){return this._position},set:function(t){this._position=t,this.constructMat()}},{key:"rotation",get:function(){return this._rotation},set:function(t){this._rotation=t,this.constructMat()}},{key:"scale",get:function(){return this._scale},set:function(t){this._scale=t,this.constructMat()}},{key:"arc",get:function(){return Pi(this._arc)},set:function(t){this._arc=Mi(t)}},{key:"angle",get:function(){return Math.round(100*Pi(this._angle))/100},set:function(t){this._angle=Mi(t)}},{key:"enable",get:function(){return this._enable},set:function(t){this._enable=t}},{key:"shapeType",get:function(){return this._shapeType},set:function(t){switch(this._shapeType=t,this._shapeType){case cit.Box:this.emitFrom===_it.Base&&(this.emitFrom=_it.Volume);break;case cit.Cone:this.emitFrom===_it.Edge&&(this.emitFrom=_it.Base);break;case cit.Sphere:case cit.Hemisphere:this.emitFrom!==_it.Base&&this.emitFrom!==_it.Edge||(this.emitFrom=_it.Volume)}}}]),t}(),Mrt=Gs(Drt.prototype,"_enable",[ra],(function(){return!1})),Prt=Gs(Drt.prototype,"_shapeType",[Rrt,brt],(function(){return cit.Cone})),f(Drt.prototype,"shapeType",[Crt],Object.getOwnPropertyDescriptor(Drt.prototype,"shapeType"),Drt.prototype),Brt=Gs(Drt.prototype,"emitFrom",[wrt,ra],(function(){return _it.Volume})),Nrt=Gs(Drt.prototype,"alignToDirection",[ra],(function(){return!1})),Lrt=Gs(Drt.prototype,"randomDirectionAmount",[ra],(function(){return 0})),Frt=Gs(Drt.prototype,"sphericalDirectionAmount",[ra],(function(){return 0})),krt=Gs(Drt.prototype,"randomPositionAmount",[ra],(function(){return 0})),Urt=Gs(Drt.prototype,"radius",[ra],(function(){return 1})),Grt=Gs(Drt.prototype,"radiusThickness",[ra],(function(){return 1})),Hrt=Gs(Drt.prototype,"arcMode",[xrt,ra],(function(){return dit.Random})),zrt=Gs(Drt.prototype,"arcSpread",[ra],(function(){return 0})),Vrt=Gs(Drt.prototype,"arcSpeed",[Irt,ra],(function(){return new det})),Wrt=Gs(Drt.prototype,"length",[ra],(function(){return 5})),Xrt=Gs(Drt.prototype,"boxThickness",[ra],(function(){return new hn(0,0,0)})),jrt=Gs(Drt.prototype,"_position",[ra],(function(){return new hn(0,0,0)})),Yrt=Gs(Drt.prototype,"_rotation",[ra],(function(){return new hn(0,0,0)})),Krt=Gs(Drt.prototype,"_scale",[ra],(function(){return new hn(1,1,1)})),qrt=Gs(Drt.prototype,"_arc",[ra],(function(){return Mi(360)})),Qrt=Gs(Drt.prototype,"_angle",[ra],(function(){return Mi(25)})),Ort=Drt))||Ort);function _st(t,e){e.x>0&&(t[0]+=.5*Li(-e.x,e.x),t[0]=Ii(t[0],-.5,.5)),e.y>0&&(t[1]+=.5*Li(-e.y,e.y),t[1]=Ii(t[1],-.5,.5)),e.z>0&&(t[2]+=.5*Li(-e.z,e.z),t[2]=Ii(t[2],-.5,.5))}var dst=[0,0,1,0,0,1,1,1],fst=[0,0,0,1,0,0,0,1,0,1,1,0],pst=function(t){function e(){var e;return(e=t.call(this)||this)._capacity=void 0,e._bufferSize=void 0,e._vertAttrs=void 0,e._vertAttribSize=void 0,e._vBuffer=void 0,e._vertAttrsFloatCount=void 0,e._vdataF32=void 0,e._vdataUint32=void 0,e._subMeshData=void 0,e._mesh=void 0,e._vertCount=0,e._indexCount=0,e._startTimeOffset=0,e._lifeTimeOffset=0,e._material=null,e._vertAttribSizeStatic=void 0,e._vertStaticAttrsFloatCount=void 0,e._insBuffers=void 0,e._insIndices=void 0,e._useInstance=void 0,e._iaVertCount=0,e._iaIndexCount=0,e.type=mB.PARTICLE_BATCH,e._capacity=0,e._bufferSize=16,e._vertAttrs=null,e._vertAttribSize=0,e._vBuffer=null,e._vertAttrsFloatCount=0,e._vdataF32=null,e._vdataUint32=null,e._vertAttribSizeStatic=0,e._vertStaticAttrsFloatCount=0,e._insBuffers=[],e._insIndices=null,wd.gfxDevice.hasFeature(Xl.INSTANCED_ARRAYS)?e._useInstance=!0:e._useInstance=!1,e._subMeshData=null,e._mesh=null,e}s(e,t);var i=e.prototype;return i.setCapacity=function(t){var e=this._capacity!==t;this._capacity=t,this._bufferSize=Math.max(this._capacity,16),this._subMeshData&&e&&this.rebuild()},i.setVertexAttributes=function(t,e){if(this._useInstance)this.setVertexAttributesIns(t,e);else{if(this._mesh===t&&this._vertAttrs===e)return;this._mesh=t,this._vertAttrs=e,this._vertAttribSize=0;for(var i,n=d(this._vertAttrs);!(i=n()).done;){var r=i.value;r.offset=this._vertAttribSize,this._vertAttribSize+=F_[r.format].size}this._vertAttrsFloatCount=this._vertAttribSize/4,this.rebuild()}},i.setVertexAttributesIns=function(t,e){if(this._mesh!==t||this._vertAttrs!==e){this._mesh=t,this._vertAttrs=e,this._vertAttribSize=0,this._vertAttribSizeStatic=0;for(var i,n=d(this._vertAttrs);!(i=n()).done;){var r=i.value;0===r.stream?(r.offset=this._vertAttribSize,this._vertAttribSize+=F_[r.format].size):1===r.stream&&(r.offset=this._vertAttribSizeStatic,this._vertAttribSizeStatic+=F_[r.format].size)}this._vertAttrsFloatCount=this._vertAttribSize/4,this._vertStaticAttrsFloatCount=this._vertAttribSizeStatic/4,this.rebuild()}},i.createSubMeshData=function(){this.destroySubMeshData(),this._vertCount=4,this._indexCount=6,this._mesh&&(this._vertCount=this._mesh.struct.vertexBundles[this._mesh.struct.primitives[0].vertexBundelIndices[0]].view.count,this._indexCount=this._mesh.struct.primitives[0].indexView.count);var t=this._device.createBuffer(new qc(ql.VERTEX|ql.TRANSFER_DST,Jl.HOST|Jl.DEVICE,this._vertAttribSize*this._bufferSize*this._vertCount,this._vertAttribSize)),e=new ArrayBuffer(this._vertAttribSize*this._bufferSize*this._vertCount);if(this._mesh&&this._capacity>0){var i=this._vertAttrs[this._vertAttrs.findIndex((function(t){return t.name===Mc.ATTR_TEX_COORD}))].offset;this._mesh.copyAttribute(0,Mc.ATTR_TEX_COORD,e,this._vertAttribSize,i);var n=this._vertAttrs.findIndex((function(t){return t.name===Mc.ATTR_TEX_COORD3}));if(i=this._vertAttrs[n++].offset,this._mesh.copyAttribute(0,Mc.ATTR_POSITION,e,this._vertAttribSize,i),i=this._vertAttrs[n++].offset,this._mesh.copyAttribute(0,Mc.ATTR_NORMAL,e,this._vertAttribSize,i),i=this._vertAttrs[n++].offset,!this._mesh.copyAttribute(0,Mc.ATTR_COLOR,e,this._vertAttribSize,i))for(var r=new Uint32Array(e),s=0;s0){this._mesh.copyIndices(0,h);for(var u=1;u=this._particleSystem.capacity?null:this._particles.add()},i.getDefaultTrailMaterial=function(){return this._defaultTrailMat},i.setNewParticle=function(){},i._initModuleList=function(){var t=this;Ast.forEach((function(e){if(t._particleSystem){var i=t._particleSystem[e];i&&i.enable&&(i.needUpdate&&(t._updateList[i.name]=i),i.needAnimate&&(t._animateList[i.name]=i))}})),this._runAnimateList.length=0;for(var e=0,i=rit.length;e0,this._particles.length},i.getNoisePreview=function(t,e,i){var n=this;this._runAnimateList.forEach((function(r){r.name===nit&&r.getNoisePreview(t,n._particleSystem,e,i)}))},i.updateRenderData=function(){for(var t=0,e=0;e=(null===(t=this._particleSystem)||void 0===t?void 0:t.capacity)?null:this._tempParticle},i.setNewParticle=function(t){this._particleSystem&&(this._model.addGPUParticleVertexData(t,this._particleNum,this._particleSystem.time),this._particleNum++)},i.getDefaultMaterial=function(){return this._defaultMat},i.updateRotation=function(t){t&&this.doUpdateRotation(t)},i.doUpdateRotation=function(t){if(this._renderInfo.renderMode===lit.Mesh||this._alignSpace!==uit.View){var e;if(this._alignSpace===uit.Local)null===(e=this._particleSystem)||void 0===e||e.node.getRotation(kst);else if(this._alignSpace===uit.World){var i;null===(i=this._particleSystem)||void 0===i||i.node.getWorldRotation(kst)}else if(this._alignSpace===uit.View){var n,r;kst.set(0,0,0,1);var s=null===(n=this._particleSystem)||void 0===n||null===(r=n.node.scene.renderScene)||void 0===r?void 0:r.cameras;if(void 0!==s&&this._particleSystem)for(var a=0;a<(null==s?void 0:s.length);++a){var o=s[a];if((o.visibility&this._particleSystem.node.layer)===this._particleSystem.node.layer){En.fromViewUp(kst,o.forward);break}}}else kst.set(0,0,0,1);t.setUniform(this._uNodeRotHandle,kst)}},i.updateScale=function(t){t&&this.doUpdateScale(t)},i.doUpdateScale=function(t){var e,i=this._node_scale;switch(null===(e=this._particleSystem)||void 0===e?void 0:e.scaleSpace){case oit.Local:this._particleSystem.node.getScale(i);break;case oit.World:this._particleSystem.node.getWorldScale(i)}t.setUniform(t.getHandle("scale"),Bst.set(i.x,i.y,i.z))},i.updateParticles=function(t){return this._particleSystem?(this._particleNum=this._model.updateGPUParticles(this._particleNum,this._particleSystem.time,t),this.updateShaderUniform(t),this._model.enabled=this._particleNum>0,this._particleNum):this._particleNum},i.updateRenderData=function(){},i.beforeRender=function(){this._model.updateIA(this._particleNum)},i.updateAlignSpace=function(t){this._alignSpace=t},i.updateShaderUniform=function(t){if(this._particleSystem){var e=this._particleSystem.getMaterialInstance(0)||this._defaultMat;if(e){var i=e.passes[0];Lst.x=this._particleSystem.time,Lst.y=t,i.setUniform(this._uTimeHandle,Lst),this._particleSystem.node.getWorldRotation(Fst),i.setUniform(this._uRotHandle,Fst),this.doUpdateRotation(i)}}},i.initShaderUniform=function(t){var e,i,n,r,s,a,o=t.passes[0];this._uTimeHandle=o.getHandle("u_timeDelta"),this._uRotHandle=o.getHandle("u_worldRot"),this._uNodeRotHandle=o.getHandle("nodeRotation"),this.doUpdateScale(o),o.setUniform(o.getHandle("frameTile_velLenScale"),this._unifrom_velLenScale),Lst.x=aat,Lst.y=.03125,o.setUniform(o.getHandle("u_sampleInfo"),Lst);var h=!1,u=null===(e=this._particleSystem)||void 0===e?void 0:e._forceOvertimeModule;if(h=!!u&&u.enable,this._defines.FORCE_OVER_TIME_MODULE_ENABLE=h,h){var l=get(this._forceTexture,this._forceData,aat,u.x,u.y,u.z);this._forceTexture=l.texture,this._forceData=l.texdata;var c=o.getHandle("force_over_time_tex0"),_=_S.getBindingFromHandle(c);o.bindSampler(_,this._forceTexture.getGFXSampler()),o.bindTexture(_,this._forceTexture.getGFXTexture());var d=o.getHandle("u_force_space");o.setUniform(d,u.space);var f=o.getHandle("u_force_mode");o.setUniform(f,this._forceTexture.height)}var p=null===(i=this._particleSystem)||void 0===i?void 0:i._velocityOvertimeModule;if(h=!!p&&p.enable,this._defines.VELOCITY_OVER_TIME_MODULE_ENABLE=h,h){var m=function(t,e,i,n,r,s,a){var o=Math.max(pet(n),pet(r),pet(s),pet(a)),h=i*o*4;null!==e&&e.length===h||(e=new Float32Array(i*o*4));for(var u=[n,r,s,a],l=0;l=8&&t.getFormatFeatures(jl.RGBA32F)&(ic.RENDER_TARGET|ic.SAMPLED_TEXTURE))||(v.warn("Maybe the device has restrictions on vertex textures or does not support float textures."),!1)}var Eat,Aat,Rat,bat,Cat,wat,xat,Iat,Oat,Dat,Mat,Pat,Bat,Nat,Lat,Fat,kat,Uat,Gat,Hat,zat,Vat,Wat,Xat,jat,Yat,Kat,qat,Qat,Zat,Jat,$at,tot,eot,iot,not,rot,sot,aot,oot,hot,uot,lot,cot,_ot,dot,fot,pot,mot,got,vot,yot,Tot,Sot,Eot,Aot,Rot,bot,Cot,wot,xot,Iot,Oot,Dot,Mot,Pot,Bot,Not,Lot,Fot,kot,Uot,Got,Hot,zot,Vot,Wot,Xot,jot,Yot,Kot,qot,Qot,Zot,Jot,$ot,tht,eht,iht,nht,rht,sht,aht,oht,hht,uht,lht,cht,_ht,dht,fht,pht,mht,ght,vht,yht,Tht,Sht,Eht,Aht,Rht,bht,Cht,wht,xht,Iht,Oht,Dht,Mht,Pht,Bht,Nht,Lht,Fht,kht,Uht,Ght,Hht,zht,Vht,Wht,Xht,jht,Yht,Kht,qht,Qht,Zht,Jht,$ht,tut,eut,iut,nut,rut,sut,aut,out,hut,uut,lut,cut,_ut,dut,fut,put,mut,gut=(Ust=qs("cc.ParticleSystemRenderer"),Gst=xa(lit),Hst=xa(lit),zst=xa(QL),Vst=xa(OS),Wst=xa(OS),Xst=xa(OS),jst=xa(OS),Yst=xa(uit),Ust(((sat=function(){function t(){this._renderMode=Qst&&Qst(),this._velocityScale=Zst&&Zst(),this._lengthScale=Jst&&Jst(),this._mesh=$st&&$st(),this._cpuMaterial=tat&&tat(),this._gpuMaterial=eat&&eat(),this._mainTexture=iat&&iat(),this._useGPU=nat&&nat(),this._alignSpace=rat&&rat(),this._particleSystem=null}var e=t.prototype;return e.create=function(t){null===this._particleSystem?this._particleSystem=t:this._particleSystem!==t&&Z(6033)},e.onInit=function(t){this.create(t);var e=this._useGPU&&Sat();this._particleSystem.processor?Z(6034):(this._particleSystem.processor=e?new Tat(this):new Pst(this),this._particleSystem.processor.updateAlignSpace(this.alignSpace),this._particleSystem.processor.onInit(t)),e?this.gpuMaterial=this.particleMaterial:(this.particleMaterial&&-1!==this.particleMaterial.effectName.indexOf("particle-gpu")&&(this.particleMaterial=null,q(6035)),this.cpuMaterial=this.particleMaterial)},e._switchProcessor=function(){if(this._particleSystem){this._particleSystem.processor&&(this._particleSystem.processor.detachFromScene(),this._particleSystem.processor.clear(),this._particleSystem.processor=null);var t=this._useGPU&&Sat();!t&&this.cpuMaterial&&(this.particleMaterial=this.cpuMaterial),t&&this.gpuMaterial&&(this.particleMaterial=this.gpuMaterial),this._particleSystem.processor=t?new Tat(this):new Pst(this),this._particleSystem.processor.updateAlignSpace(this.alignSpace),this._particleSystem.processor.onInit(this._particleSystem),this._particleSystem.processor.onEnable(),this._particleSystem.bindModule()}},n(t,[{key:"renderMode",get:function(){return this._renderMode},set:function(t){this._renderMode!==t&&(this._renderMode=t,this._particleSystem&&this._particleSystem.processor.updateRenderMode())}},{key:"velocityScale",get:function(){return this._velocityScale},set:function(t){this._velocityScale=t,this._particleSystem&&this._particleSystem.processor.updateMaterialParams()}},{key:"lengthScale",get:function(){return this._lengthScale},set:function(t){this._lengthScale=t,this._particleSystem&&this._particleSystem.processor.updateMaterialParams()}},{key:"mesh",get:function(){return this._mesh},set:function(t){this._mesh=t,this._particleSystem&&this._particleSystem.processor.setVertexAttributes()}},{key:"particleMaterial",get:function(){return this._particleSystem?this._particleSystem.getSharedMaterial(0):null},set:function(t){this._particleSystem&&this._particleSystem.setSharedMaterial(t,0)}},{key:"cpuMaterial",get:function(){return this._cpuMaterial},set:function(t){if(null!==t){var e=t.effectName;-1!==e.indexOf("particle")&&-1===e.indexOf("particle-gpu")?(this._cpuMaterial=t,this.particleMaterial=this._cpuMaterial):q(6035)}}},{key:"gpuMaterial",get:function(){return this._gpuMaterial},set:function(t){null!==t&&(-1!==t.effectName.indexOf("particle-gpu")?(this._gpuMaterial=t,this.particleMaterial=this._gpuMaterial):q(6035))}},{key:"trailMaterial",get:function(){return this._particleSystem?this._particleSystem.getSharedMaterial(1):null},set:function(t){this._particleSystem&&this._particleSystem.setSharedMaterial(t,1)}},{key:"mainTexture",get:function(){return this._mainTexture},set:function(t){this._mainTexture=t}},{key:"useGPU",get:function(){return this._useGPU},set:function(t){this._useGPU!==t&&(Sat()?this._useGPU=t:this._useGPU=!1,this._switchProcessor())}},{key:"alignSpace",get:function(){return this._alignSpace},set:function(t){this._alignSpace=t,this._particleSystem.processor.updateAlignSpace(this._alignSpace)}}]),t}()).AlignmentSpace=uit,f((qst=sat).prototype,"renderMode",[Gst],Object.getOwnPropertyDescriptor(qst.prototype,"renderMode"),qst.prototype),Qst=Gs(qst.prototype,"_renderMode",[Hst,ra],(function(){return lit.Billboard})),Zst=Gs(qst.prototype,"_velocityScale",[ra],(function(){return 1})),Jst=Gs(qst.prototype,"_lengthScale",[ra],(function(){return 1})),$st=Gs(qst.prototype,"_mesh",[ra],(function(){return null})),f(qst.prototype,"mesh",[zst],Object.getOwnPropertyDescriptor(qst.prototype,"mesh"),qst.prototype),f(qst.prototype,"particleMaterial",[Vst],Object.getOwnPropertyDescriptor(qst.prototype,"particleMaterial"),qst.prototype),f(qst.prototype,"cpuMaterial",[Wst],Object.getOwnPropertyDescriptor(qst.prototype,"cpuMaterial"),qst.prototype),tat=Gs(qst.prototype,"_cpuMaterial",[ra],(function(){return null})),f(qst.prototype,"gpuMaterial",[Xst],Object.getOwnPropertyDescriptor(qst.prototype,"gpuMaterial"),qst.prototype),eat=Gs(qst.prototype,"_gpuMaterial",[ra],(function(){return null})),f(qst.prototype,"trailMaterial",[jst],Object.getOwnPropertyDescriptor(qst.prototype,"trailMaterial"),qst.prototype),iat=Gs(qst.prototype,"_mainTexture",[ra],(function(){return null})),nat=Gs(qst.prototype,"_useGPU",[ra],(function(){return!1})),f(qst.prototype,"alignSpace",[Yst],Object.getOwnPropertyDescriptor(qst.prototype,"alignSpace"),qst.prototype),rat=Gs(qst.prototype,"_alignSpace",[ra],(function(){return uit.View})),Kst=qst))||Kst),vut=Math.cos(Mi(100)),yut={position:new hn,velocity:new hn},Tut=new En,Sut=new hn,Eut=new hn,Aut=new pn,Rut=function(){function t(t){for(this.start=void 0,this.end=void 0,this.trailElements=void 0,this.start=-1,this.end=-1,this.trailElements=[];t--;)this.trailElements.push({position:new hn,lifetime:0,width:0,velocity:new hn,direction:0,color:new pn})}var e=t.prototype;return e.getElement=function(t){return-1===this.start?null:(t<0&&(t=(t+this.trailElements.length)%this.trailElements.length),t>=this.trailElements.length&&(t%=this.trailElements.length),this.trailElements[t])},e.addElement=function(){if(0===this.trailElements.length)return null;if(-1===this.start)return this.start=0,this.end=1,this.trailElements[0];this.start===this.end&&(this.trailElements.splice(this.end,0,{position:new hn,lifetime:0,width:0,velocity:new hn,direction:0,color:new pn}),this.start++,this.start%=this.trailElements.length);var t=this.end++;return this.end%=this.trailElements.length,this.trailElements[t]},e.iterateElement=function(t,e,i,n){for(var r=this.start>=this.end?this.end+this.trailElements.length:this.end,s=this.start;st.lastLoop)t.trailDelay>1?(t.lastLoop=t.loopCount,t.trailDelay=0):t.trailDelay++;else{var i=this._particleTrail.get(t);if(!i)return i=this._trailSegments.alloc(),void this._particleTrail.set(t,i);var n=i.getElement(i.end-1);if(this._needTransform?hn.transformMat4(Sut,t.position,this._psTransform):hn.copy(Sut,t.position),!(n&&(i.iterateElement(this,this._updateTrailElement,t,e),hn.squaredDistance(n.position,Sut)2){var a=i.getElement(i.end-2),o=i.getElement(i.end-3);hn.subtract(Sut,o.position,a.position),hn.subtract(Eut,n.position,a.position),hn.subtract(a.velocity,Eut,Sut),hn.equals(hn.ZERO,a.velocity)&&hn.copy(a.velocity,Sut),hn.normalize(a.velocity,a.velocity),this._checkDirectionReverse(a,o)}this.colorFromParticle?n.color.set(t.color):n.color.set(this.colorOvertime.evaluate(0,1))}}},t.removeParticle=function(t){var e=this._particleTrail.get(t);e&&this._trailSegments&&(e.clear(),this._trailSegments.free(e),this._particleTrail.delete(t))},t.updateRenderData=function(){this.vbOffset=0,this.ibOffset=0;for(var t,e=d(this._particleTrail.keys());!(t=e()).done;){var i=t.value,n=this._particleTrail.get(i);if(-1!==n.start){var r=4*this.vbOffset/this._vertSize,s=n.start>=n.end?n.end+n.trailElements.length:n.end,a=s-n.start,o=1/a,h=n.trailElements[n.start];this._fillVertexBuffer(h,this.colorOverTrail.evaluate(1,1),r,1,0,4);for(var u=n.start+1;u2){var p=n.getElement(n.end-1),m=n.getElement(n.end-2);hn.subtract(Sut,m.position,p.position),hn.subtract(Eut,yut.position,p.position),hn.normalize(Sut,Sut),hn.normalize(Eut,Eut),hn.subtract(p.velocity,Eut,Sut),hn.normalize(p.velocity,p.velocity),this._checkDirectionReverse(p,m),this.vbOffset-=this._vertSize/4*2,this.ibOffset-=6,this._fillVertexBuffer(p,this.colorOverTrail.evaluate(o,1),r,o,a-1,5),hn.subtract(yut.velocity,yut.position,p.position),hn.normalize(yut.velocity,yut.velocity),this._checkDirectionReverse(yut,p)}this.widthFromParticle?yut.width=i.size.x*this.widthRatio.evaluate(0,1):yut.width=this.widthRatio.evaluate(0,1),yut.color=i.color,hn.equals(yut.velocity,hn.ZERO)?this.ibOffset-=3:this._fillVertexBuffer(yut,this.colorOverTrail.evaluate(0,1),r,0,a,1)}}this._trailModel&&(this._trailModel.enabled=this.ibOffset>0)},t.updateIA=function(t){var e=this._trailModel&&this._trailModel.subModels;if(e&&e.length>0){var i=e[0];i.inputAssembler.vertexBuffers[0].update(this._vbF32),i.inputAssembler.indexBuffer.update(this._iBuffer),i.inputAssembler.firstIndex=0,i.inputAssembler.indexCount=t,i.inputAssembler.vertexCount=this._iaVertCount}},t.beforeRender=function(){this.updateIA(this.ibOffset)},t._createModel=function(){this._trailModel||(this._trailModel=v.director.root.createModel(IB))},t.rebuild=function(){var t=gL.root.device,e=t.createBuffer(new qc(ql.VERTEX|ql.TRANSFER_DST,Jl.HOST|Jl.DEVICE,this._vertSize*(this._trailNum+1)*2,this._vertSize)),i=new ArrayBuffer(this._vertSize*(this._trailNum+1)*2);this._vbF32=new Float32Array(i),this._vbUint32=new Uint32Array(i),e.update(i);var n=t.createBuffer(new qc(ql.INDEX|ql.TRANSFER_DST,Jl.HOST|Jl.DEVICE,6*Math.max(1,this._trailNum)*Uint16Array.BYTES_PER_ELEMENT,Uint16Array.BYTES_PER_ELEMENT));this._iBuffer=new Uint16Array(6*Math.max(1,this._trailNum)),n.update(this._iBuffer),this._iaVertCount=2*(this._trailNum+1),this._iaIndexCount=6*this._trailNum,this._subMeshData=new Lx([e],this._vertAttrs,vc.TRIANGLE_LIST,n);var r=this._trailModel;r&&this._material&&(r.node=r.transform=this._particleSystem.node,r.visFlags=this._particleSystem.visibility,r.initSubModel(0,this._subMeshData,this._material),r.enabled=!0)},t._updateTrailElement=function(t,e,i,n){return e.lifetime+=n,t.colorFromParticle?(e.color.set(i.color),e.color.multiply(t.colorOvertime.evaluate(1-i.remainingLifetime/i.startLifetime,1))):e.color.set(t.colorOvertime.evaluate(1-i.remainingLifetime/i.startLifetime,1)),t.widthFromParticle?e.width=i.size.x*t.widthRatio.evaluate(e.lifetime/t._trailLifetime,1):e.width=t.widthRatio.evaluate(e.lifetime/t._trailLifetime,1),e.lifetime>t._trailLifetime},t._fillVertexBuffer=function(t,e,i,n,r,s){this._vbF32[this.vbOffset++]=t.position.x,this._vbF32[this.vbOffset++]=t.position.y,this._vbF32[this.vbOffset++]=t.position.z,this._vbF32[this.vbOffset++]=t.direction,this._vbF32[this.vbOffset++]=t.width,this._vbF32[this.vbOffset++]=n,this._vbF32[this.vbOffset++]=0,this._vbF32[this.vbOffset++]=t.velocity.x,this._vbF32[this.vbOffset++]=t.velocity.y,this._vbF32[this.vbOffset++]=t.velocity.z,Aut.set(t.color),Aut.multiply(e),this._vbUint32[this.vbOffset++]=Aut._val,this._vbF32[this.vbOffset++]=t.position.x,this._vbF32[this.vbOffset++]=t.position.y,this._vbF32[this.vbOffset++]=t.position.z,this._vbF32[this.vbOffset++]=1-t.direction,this._vbF32[this.vbOffset++]=t.width,this._vbF32[this.vbOffset++]=n,this._vbF32[this.vbOffset++]=1,this._vbF32[this.vbOffset++]=t.velocity.x,this._vbF32[this.vbOffset++]=t.velocity.y,this._vbF32[this.vbOffset++]=t.velocity.z,this._vbUint32[this.vbOffset++]=Aut._val,1&s&&(this._iBuffer[this.ibOffset++]=i+2*r,this._iBuffer[this.ibOffset++]=i+2*r-1,this._iBuffer[this.ibOffset++]=i+2*r+1),4&s&&(this._iBuffer[this.ibOffset++]=i+2*r,this._iBuffer[this.ibOffset++]=i+2*r+1,this._iBuffer[this.ibOffset++]=i+2*r+2)},t._checkDirectionReverse=function(t,e){hn.dot(t.velocity,e.velocity)0&&!this._isCulled&&(null!==(e=this.processor.getModel())&&void 0!==e&&e.scene||this.processor.attachToScene(),this._trailModule&&this._trailModule.enable&&(null!==(i=this._trailModule.getModel())&&void 0!==i&&i.scene||this._trailModule._attachToScene()),this._needAttach=!1);!this.renderer.useGPU&&this._trailModule&&this._trailModule.enable&&(this._trailModule.inited||(this._trailModule.clear(),this._trailModule.destroy(),this._trailModule.onInit(this),this._trailModule.enable=!1,this._trailModule.enable=!0))},i.beforeRender=function(){var t,e;this.getParticleCount()<=0?null!==(e=this.processor.getModel())&&void 0!==e&&e.scene&&(this.processor.detachFromScene(),this._trailModule&&this._trailModule.enable&&this._trailModule._detachFromScene(),this._needAttach=!1):null!==(t=this.processor.getModel())&&void 0!==t&&t.scene||(this._needAttach=!0),this._isPlaying&&(this.processor.updateRenderData(),this.processor.beforeRender(),this._trailModule&&this._trailModule.enable&&(this._trailModule.updateRenderData(),this._trailModule.beforeRender()))},i._onVisibilityChange=function(t){this.processor.model&&(this.processor.model.visFlags=t)},i.emit=function(t,e){var i=this._time%this.duration/this.duration;this._needRefresh&&(this.node.invalidateChildren(om.POSITION),this._needRefresh=!1),this._simulationSpace===oit.World&&(this.node.getWorldMatrix(Nut),this.node.getWorldRotation(Lut));for(var n=0;ne){if(this._time>this.duration+e&&(this.loop||(this._isEmitting=!1)),!this._isEmitting)return;if(this._emitRateTimeCounter+=this.rateOverTime.evaluate(this._time/this.duration,1)*t,this._emitRateTimeCounter>1){var i=Math.floor(this._emitRateTimeCounter);this._emitRateTimeCounter-=i,this.emit(i,t)}var n=this.rateOverDistance.evaluate(this._time/this.duration,1);if(n>0){hn.copy(this._oldWPos,this._curWPos),this.node.getWorldPosition(this._curWPos);var r=hn.distance(this._curWPos,this._oldWPos);this._emitRateDistanceCounter+=r*n}if(this._emitRateDistanceCounter>1){var s=Math.floor(this._emitRateDistanceCounter);this._emitRateDistanceCounter-=s,this.emit(s,t)}for(var a,o=d(this.bursts);!(a=o()).done;)a.value.update(this,t)}},i._resetPosition=function(){this.node.getWorldPosition(this._oldWPos),hn.copy(this._curWPos,this._oldWPos)},i.addSubEmitter=function(t){this._subEmitters.push(t)},i.removeSubEmitter=function(t){this._subEmitters.splice(this._subEmitters.indexOf(t),1)},i.addBurst=function(t){this.bursts.push(t)},i.removeBurst=function(t){this.bursts.splice(this.bursts.indexOf(t),1)},i.getBoundingX=function(){return this._aabbHalfX},i.getBoundingY=function(){return this._aabbHalfY},i.getBoundingZ=function(){return this._aabbHalfZ},i.setBoundingX=function(t){this._boundingBox&&this._culler&&(this._boundingBox.halfExtents.x=t,this._culler.setBoundingBoxSize(this._boundingBox.halfExtents),this._aabbHalfX=t)},i.setBoundingY=function(t){this._boundingBox&&this._culler&&(this._boundingBox.halfExtents.y=t,this._culler.setBoundingBoxSize(this._boundingBox.halfExtents),this._aabbHalfY=t)},i.setBoundingZ=function(t){this._boundingBox&&this._culler&&(this._boundingBox.halfExtents.z=t,this._culler.setBoundingBoxSize(this._boundingBox.halfExtents),this._aabbHalfZ=t)},i._onBeforeSerialize=function(t){var e=this;return this.dataCulling?t.filter((function(t){return!sit.includes(t)||e[t]&&e[t].enable})):t},i.getNoisePreview=function(t,e){var i=[];return this.processor&&this.processor.getNoisePreview(i,t,e),i},n(e,[{key:"capacity",get:function(){return this._capacity},set:function(t){this._capacity=Math.floor(t>0?t:0),this.processor&&this.processor.model&&this.processor.model.setCapacity(this._capacity)}},{key:"prewarm",get:function(){return this._prewarm},set:function(t){!0===t&&this.loop,this._prewarm=t}},{key:"simulationSpace",get:function(){return this._simulationSpace},set:function(t){t!==this._simulationSpace&&(this._simulationSpace=t,this.processor&&(this.processor.updateMaterialParams(),this.processor.updateTrailMaterial()))}},{key:"renderCulling",get:function(){return this._renderCulling},set:function(t){this._renderCulling=t,t&&(this._boundingBox||(this._boundingBox=new Es,this._calculateBounding(!1)))}},{key:"cullingMode",get:function(){return this._cullingMode},set:function(t){this._cullingMode=t}},{key:"aabbHalfX",get:function(){return this.getBoundingX()||0},set:function(t){this.setBoundingX(t)}},{key:"aabbHalfY",get:function(){return this.getBoundingY()||0},set:function(t){this.setBoundingY(t)}},{key:"aabbHalfZ",get:function(){return this.getBoundingZ()||0},set:function(t){this.setBoundingZ(t)}},{key:"dataCulling",get:function(){return this._dataCulling},set:function(t){this._dataCulling=t}},{key:"sharedMaterials",get:function(){return Fut.get.call(this)},set:function(t){Fut.set.call(this,t)}},{key:"colorOverLifetimeModule",get:function(){return this._colorOverLifetimeModule},set:function(t){t&&(this._colorOverLifetimeModule=t)}},{key:"shapeModule",get:function(){return this._shapeModule},set:function(t){t&&(this._shapeModule=t)}},{key:"sizeOvertimeModule",get:function(){return this._sizeOvertimeModule},set:function(t){t&&(this._sizeOvertimeModule=t)}},{key:"velocityOvertimeModule",get:function(){return this._velocityOvertimeModule},set:function(t){t&&(this._velocityOvertimeModule=t)}},{key:"forceOvertimeModule",get:function(){return this._forceOvertimeModule},set:function(t){t&&(this._forceOvertimeModule=t)}},{key:"limitVelocityOvertimeModule",get:function(){return this._limitVelocityOvertimeModule},set:function(t){t&&(this._limitVelocityOvertimeModule=t)}},{key:"rotationOvertimeModule",get:function(){return this._rotationOvertimeModule},set:function(t){t&&(this._rotationOvertimeModule=t)}},{key:"textureAnimationModule",get:function(){return this._textureAnimationModule},set:function(t){t&&(this._textureAnimationModule=t)}},{key:"noiseModule",get:function(){return this._noiseModule},set:function(t){t&&(this._noiseModule=t)}},{key:"trailModule",get:function(){return this._trailModule},set:function(t){t&&(this._trailModule=t)}},{key:"isPlaying",get:function(){return this._isPlaying}},{key:"isPaused",get:function(){return this._isPaused}},{key:"isStopped",get:function(){return this._isStopped}},{key:"isEmitting",get:function(){return this._isEmitting}},{key:"time",get:function(){return this._time}}]),e}(gW)).CullingMode=hit,ght=Gs((mht=rut).prototype,"startColor",[Rot,ra],(function(){return new zet})),vht=Gs(mht.prototype,"scaleSpace",[bot,ra],(function(){return oit.Local})),yht=Gs(mht.prototype,"startSize3D",[ra],(function(){return!1})),Tht=Gs(mht.prototype,"startSizeX",[Cot,wot],(function(){return new det})),Sht=Gs(mht.prototype,"startSizeY",[xot,ra],(function(){return new det})),Eht=Gs(mht.prototype,"startSizeZ",[Iot,ra],(function(){return new det})),Aht=Gs(mht.prototype,"startSpeed",[Oot,ra],(function(){return new det})),Rht=Gs(mht.prototype,"startRotation3D",[ra],(function(){return!1})),bht=Gs(mht.prototype,"startRotationX",[Dot,ra],(function(){return new det})),Cht=Gs(mht.prototype,"startRotationY",[Mot,ra],(function(){return new det})),wht=Gs(mht.prototype,"startRotationZ",[Pot,Bot],(function(){return new det})),xht=Gs(mht.prototype,"startDelay",[Not,ra],(function(){return new det})),Iht=Gs(mht.prototype,"startLifetime",[Lot,ra],(function(){return new det})),Oht=Gs(mht.prototype,"duration",[ra],(function(){return 5})),Dht=Gs(mht.prototype,"loop",[ra],(function(){return!0})),f(mht.prototype,"simulationSpace",[Fot,ra],Object.getOwnPropertyDescriptor(mht.prototype,"simulationSpace"),mht.prototype),Mht=Gs(mht.prototype,"simulationSpeed",[ra],(function(){return 1})),Pht=Gs(mht.prototype,"playOnAwake",[ra],(function(){return!0})),Bht=Gs(mht.prototype,"gravityModifier",[kot,ra],(function(){return new det})),Nht=Gs(mht.prototype,"rateOverTime",[Uot,ra],(function(){return new det})),Lht=Gs(mht.prototype,"rateOverDistance",[Got,ra],(function(){return new det})),Fht=Gs(mht.prototype,"bursts",[Hot,ra],(function(){return[]})),f(mht.prototype,"renderCulling",[zot],Object.getOwnPropertyDescriptor(mht.prototype,"renderCulling"),mht.prototype),kht=Gs(mht.prototype,"_renderCulling",[ra],(function(){return!1})),f(mht.prototype,"cullingMode",[Vot],Object.getOwnPropertyDescriptor(mht.prototype,"cullingMode"),mht.prototype),Uht=Gs(mht.prototype,"_cullingMode",[ra],(function(){return hit.Pause})),f(mht.prototype,"aabbHalfX",[Wot],Object.getOwnPropertyDescriptor(mht.prototype,"aabbHalfX"),mht.prototype),Ght=Gs(mht.prototype,"_aabbHalfX",[ra],(function(){return 0})),f(mht.prototype,"aabbHalfY",[Xot],Object.getOwnPropertyDescriptor(mht.prototype,"aabbHalfY"),mht.prototype),Hht=Gs(mht.prototype,"_aabbHalfY",[ra],(function(){return 0})),f(mht.prototype,"aabbHalfZ",[jot],Object.getOwnPropertyDescriptor(mht.prototype,"aabbHalfZ"),mht.prototype),zht=Gs(mht.prototype,"_aabbHalfZ",[ra],(function(){return 0})),Vht=Gs(mht.prototype,"_dataCulling",[ra,Yot],(function(){return!1})),f(mht.prototype,"sharedMaterials",[Ia,ra],Object.getOwnPropertyDescriptor(mht.prototype,"sharedMaterials"),mht.prototype),Wht=Gs(mht.prototype,"_colorOverLifetimeModule",[Kot],(function(){return null})),f(mht.prototype,"colorOverLifetimeModule",[qot],Object.getOwnPropertyDescriptor(mht.prototype,"colorOverLifetimeModule"),mht.prototype),Xht=Gs(mht.prototype,"_shapeModule",[Qot],(function(){return null})),f(mht.prototype,"shapeModule",[Zot],Object.getOwnPropertyDescriptor(mht.prototype,"shapeModule"),mht.prototype),jht=Gs(mht.prototype,"_sizeOvertimeModule",[Jot],(function(){return null})),f(mht.prototype,"sizeOvertimeModule",[$ot],Object.getOwnPropertyDescriptor(mht.prototype,"sizeOvertimeModule"),mht.prototype),Yht=Gs(mht.prototype,"_velocityOvertimeModule",[tht],(function(){return null})),f(mht.prototype,"velocityOvertimeModule",[eht],Object.getOwnPropertyDescriptor(mht.prototype,"velocityOvertimeModule"),mht.prototype),Kht=Gs(mht.prototype,"_forceOvertimeModule",[iht],(function(){return null})),f(mht.prototype,"forceOvertimeModule",[nht],Object.getOwnPropertyDescriptor(mht.prototype,"forceOvertimeModule"),mht.prototype),qht=Gs(mht.prototype,"_limitVelocityOvertimeModule",[rht],(function(){return null})),f(mht.prototype,"limitVelocityOvertimeModule",[sht],Object.getOwnPropertyDescriptor(mht.prototype,"limitVelocityOvertimeModule"),mht.prototype),Qht=Gs(mht.prototype,"_rotationOvertimeModule",[aht],(function(){return null})),f(mht.prototype,"rotationOvertimeModule",[oht],Object.getOwnPropertyDescriptor(mht.prototype,"rotationOvertimeModule"),mht.prototype),Zht=Gs(mht.prototype,"_textureAnimationModule",[hht],(function(){return null})),f(mht.prototype,"textureAnimationModule",[uht],Object.getOwnPropertyDescriptor(mht.prototype,"textureAnimationModule"),mht.prototype),Jht=Gs(mht.prototype,"_noiseModule",[lht],(function(){return null})),f(mht.prototype,"noiseModule",[cht],Object.getOwnPropertyDescriptor(mht.prototype,"noiseModule"),mht.prototype),$ht=Gs(mht.prototype,"_trailModule",[_ht],(function(){return null})),f(mht.prototype,"trailModule",[dht],Object.getOwnPropertyDescriptor(mht.prototype,"trailModule"),mht.prototype),tut=Gs(mht.prototype,"renderer",[fht,ra],(function(){return new gut})),eut=Gs(mht.prototype,"_prewarm",[ra],(function(){return!1})),iut=Gs(mht.prototype,"_capacity",[ra],(function(){return 100})),nut=Gs(mht.prototype,"_simulationSpace",[ra],(function(){return oit.Local})),pht=mht))||pht)||pht)),Uut=t("f2",function(){function t(){}return t.instantiate=function(t){return this.registeredSceneEvent||(gL.on(mL.EVENT_BEFORE_SCENE_LAUNCH,this.onSceneUnload,this),this.registeredSceneEvent=!0),this.particleSystemPool.has(t._uuid)||this.particleSystemPool.set(t._uuid,new Pu((function(){return y8(t)||new $m}),1,(function(t){return t.destroy()}))),this.particleSystemPool.get(t._uuid).alloc()},t.destroy=function(t){this.particleSystemPool.has(t._prefab.asset._uuid)&&(this.stop(t),this.particleSystemPool.get(t._prefab.asset._uuid).free(t))},t.play=function(t){for(var e,i=d(t.getComponentsInChildren(kut));!(e=i()).done;)e.value.play()},t.stop=function(t){for(var e,i=d(t.getComponentsInChildren(kut));!(e=i()).done;)e.value.stop()},t.onSceneUnload=function(){this.particleSystemPool.forEach((function(t){return t.destroy()})),this.particleSystemPool.clear()},t}());function Gut(t){v._global.CC_PHYSICS_BUILTIN="builtin"===t,v._global.CC_PHYSICS_CANNON="cannon.js"===t,v._global.CC_PHYSICS_AMMO="bullet"===t}Uut.particleSystemPool=new Map,Uut.registeredSceneEvent=!1,st(ost.prototype,"Burst.prototype",[{name:"minCount"},{name:"maxCount"}]),rt(kut.prototype,"ParticleSystem.prototype",[{name:"enableCulling",newName:"dataCulling"}]),v.ParticleSystemComponent=kut,Jt(kut,"cc.ParticleSystemComponent"),v.BillboardComponent=ret,Jt(ret,"cc.BillboardComponent"),v.LineComponent=Xet,Jt(Xet,"cc.LineComponent"),v.ParticleUtils=Uut,t("fw",sut),function(t){t[t.DYNAMIC=1]="DYNAMIC",t[t.STATIC=2]="STATIC",t[t.KINEMATIC=4]="KINEMATIC"}(sut||t("fw",sut={})),ve(sut),t("fv",aut),function(t){t[t.X_AXIS=0]="X_AXIS",t[t.Y_AXIS=1]="Y_AXIS",t[t.Z_AXIS=2]="Z_AXIS"}(aut||t("fv",aut={})),ve(aut),function(t){t[t.X=0]="X",t[t.Y=1]="Y",t[t.Z=2]="Z",t[t.SWING1=3]="SWING1",t[t.SWING2=4]="SWING2",t[t.TWIST=5]="TWIST"}(out||(out={})),ve(out),function(t){t[t.VERTEX=1]="VERTEX",t[t.LINE=2]="LINE",t[t.TRIANGLE=3]="TRIANGLE",t[t.TETRAHEDRON=4]="TETRAHEDRON"}(hut||(hut={})),ve(hut),t("fx",uut),function(t){t[t.BOX=0]="BOX",t[t.SPHERE=1]="SPHERE",t[t.CAPSULE=2]="CAPSULE",t[t.CYLINDER=3]="CYLINDER",t[t.CONE=4]="CONE",t[t.MESH=5]="MESH",t[t.PLANE=6]="PLANE",t[t.SIMPLEX=7]="SIMPLEX",t[t.TERRAIN=8]="TERRAIN"}(uut||t("fx",uut={})),ve(uut),function(t){t[t.POINT_TO_POINT=0]="POINT_TO_POINT",t[t.HINGE=1]="HINGE",t[t.FIXED=2]="FIXED",t[t.CONFIGURABLE=3]="CONFIGURABLE"}(lut||(lut={})),ve(lut),function(t){t[t.FREE=0]="FREE",t[t.LIMITED=1]="LIMITED",t[t.LOCKED=2]="LOCKED"}(cut||(cut={})),ve(cut),function(t){t[t.DISABLED=0]="DISABLED",t[t.SERVO=1]="SERVO",t[t.INDUCTION=2]="INDUCTION"}(_ut||(_ut={})),ve(_ut),function(t){t[t.BOX=0]="BOX",t[t.CAPSULE=1]="CAPSULE"}(dut||(dut={})),ve(dut),function(t){t[t.DEFAULT=1]="DEFAULT"}(fut||(fut={})),ve(fut),t("fy",put),function(t){t[t.NONE=0]="NONE",t[t.WIRE_FRAME=1]="WIRE_FRAME",t[t.CONSTRAINT=2]="CONSTRAINT",t[t.AABB=4]="AABB"}(put||t("fy",put={})),ve(put);var Hut,zut={id:"",switchTo:function(t){if(zut.runInEditor){var e=zut;if(zut.physicsWorld&&t!==zut.id&&null!=zut.backend[t]?(zut.physicsWorld.destroy(),k("[PHYSICS]: switch from "+zut.id+" to "+t+"."),Gut(t),e.id=t,e.wrapper=zut.backend[t],e.physicsWorld=jut()):(k("[PHYSICS]: using "+t+"."),e.physicsWorld=jut()),mut){var i=e.physicsWorld;i.setGravity(mut.gravity),i.setAllowSleep(mut.allowSleep)}}},register:function(t,e){if(k("[PHYSICS]: register "+t+"."),zut.backend[t]=e,!zut.physicsWorld||zut.id===t){Gut(t);var i=zut;i.id=t,i.wrapper=e}},wrapper:{},backend:{},physicsWorld:null,runInEditor:!0},Vut=function(){return 0},Wut={impl:null,debugDrawFlags:0,debugDrawConstraintSize:0,setGravity:Vut,setAllowSleep:Vut,setDefaultMaterial:Vut,step:Vut,syncAfterEvents:Vut,syncSceneToPhysics:Vut,raycast:Vut,raycastClosest:Vut,sweepBox:Vut,sweepBoxClosest:Vut,sweepSphere:Vut,sweepSphereClosest:Vut,sweepCapsule:Vut,sweepCapsuleClosest:Vut,emitEvents:Vut,destroy:Vut};function Xut(t,e){return null==t&&(zut.id?U(zut.id+" physics does not support "+Hut[e]):Z(9600),!0)}function jut(){return Xut(zut.wrapper.PhysicsWorld,Hut.World)?Wut:new zut.wrapper.PhysicsWorld}!function(t){t[t.World=0]="World",t[t.RigidBody=1]="RigidBody",t[t.BoxCollider=2]="BoxCollider",t[t.SphereCollider=3]="SphereCollider",t[t.CapsuleCollider=4]="CapsuleCollider",t[t.MeshCollider=5]="MeshCollider",t[t.CylinderCollider=6]="CylinderCollider",t[t.ConeCollider=7]="ConeCollider",t[t.TerrainCollider=8]="TerrainCollider",t[t.SimplexCollider=9]="SimplexCollider",t[t.PlaneCollider=10]="PlaneCollider",t[t.PointToPointConstraint=11]="PointToPointConstraint",t[t.HingeConstraint=12]="HingeConstraint",t[t.FixedConstraint=13]="FixedConstraint",t[t.ConfigurableConstraint=14]="ConfigurableConstraint",t[t.BoxCharacterController=15]="BoxCharacterController",t[t.CapsuleCharacterController=16]="CapsuleCharacterController"}(Hut||(Hut={}));var Yut={impl:null,rigidBody:null,isAwake:!1,isSleepy:!1,isSleeping:!1,initialize:Vut,onEnable:Vut,onDisable:Vut,onDestroy:Vut,setType:Vut,setMass:Vut,setLinearDamping:Vut,setAngularDamping:Vut,useGravity:Vut,setLinearFactor:Vut,setAngularFactor:Vut,setAllowSleep:Vut,wakeUp:Vut,sleep:Vut,clearState:Vut,clearForces:Vut,clearVelocity:Vut,setSleepThreshold:Vut,getSleepThreshold:Vut,getLinearVelocity:Vut,setLinearVelocity:Vut,getAngularVelocity:Vut,setAngularVelocity:Vut,applyForce:Vut,applyLocalForce:Vut,applyImpulse:Vut,applyLocalImpulse:Vut,applyTorque:Vut,applyLocalTorque:Vut,setGroup:Vut,getGroup:Vut,addGroup:Vut,removeGroup:Vut,setMask:Vut,getMask:Vut,addMask:Vut,removeMask:Vut,isUsingCCD:Vut,useCCD:Vut},Kut={INITED:!1},qut={impl:null,collider:null,attachedRigidBody:null,initialize:Vut,onLoad:Vut,onEnable:Vut,onDisable:Vut,onDestroy:Vut,setGroup:Vut,getGroup:Vut,addGroup:Vut,removeGroup:Vut,setMask:Vut,getMask:Vut,addMask:Vut,removeMask:Vut,setMaterial:Vut,setAsTrigger:Vut,setCenter:Vut,getAABB:Vut,getBoundingSphere:Vut,updateSize:Vut,updateRadius:Vut,setRadius:Vut,setCylinderHeight:Vut,setDirection:Vut,setHeight:Vut,setShapeType:Vut,setVertices:Vut,setMesh:Vut,setTerrain:Vut,setNormal:Vut,setConstant:Vut,updateEventListener:Vut};var Qut={INITED:!1},Zut={impl:null,initialize:Vut,onLoad:Vut,onEnable:Vut,onDisable:Vut,onDestroy:Vut,setEnableCollision:Vut,setConnectedBody:Vut,setPivotA:Vut,setPivotB:Vut,setAxis:Vut,setSecondaryAxis:Vut,setBreakForce:Vut,setBreakTorque:Vut,setConstraintMode:Vut,setLinearLimit:Vut,setAngularExtent:Vut,setLinearSoftConstraint:Vut,setLinearStiffness:Vut,setLinearDamping:Vut,setLinearRestitution:Vut,setSwingSoftConstraint:Vut,setTwistSoftConstraint:Vut,setSwingStiffness:Vut,setSwingDamping:Vut,setSwingRestitution:Vut,setTwistStiffness:Vut,setTwistDamping:Vut,setTwistRestitution:Vut,setDriverMode:Vut,setLinearMotorTarget:Vut,setLinearMotorVelocity:Vut,setLinearMotorForceLimit:Vut,setAngularMotorTarget:Vut,setAngularMotorVelocity:Vut,setAngularMotorForceLimit:Vut,setAutoPivotB:Vut,setLimitEnabled:Vut,setLowerLimit:Vut,setUpperLimit:Vut,setMotorEnabled:Vut,setMotorVelocity:Vut,setMotorForceLimit:Vut};var Jut,$ut,tlt,elt={INITED:!1},ilt={initialize:Vut,onLoad:Vut,onEnable:Vut,onDisable:Vut,onDestroy:Vut,onGround:Vut,getPosition:Vut,setPosition:Vut,setStepOffset:Vut,setSlopeLimit:Vut,setContactOffset:Vut,setDetectCollisions:Vut,setOverlapRecovery:Vut,setGroup:Vut,getGroup:Vut,addGroup:Vut,removeGroup:Vut,setMask:Vut,getMask:Vut,addMask:Vut,removeMask:Vut,move:Vut,syncPhysicsToScene:Vut,updateEventListener:Vut,setHalfHeight:Vut,setHalfSideExtent:Vut,setHalfForwardExtent:Vut,setRadius:Vut,setHeight:Vut};!function(t){t[t.EBulletTypeVec3=0]="EBulletTypeVec3",t[t.EBulletTypeQuat=1]="EBulletTypeQuat",t[t.EBulletTypeTransform=2]="EBulletTypeTransform",t[t.EBulletTypeMotionState=3]="EBulletTypeMotionState",t[t.EBulletTypeCollisionObject=4]="EBulletTypeCollisionObject",t[t.EBulletTypeCollisionShape=5]="EBulletTypeCollisionShape",t[t.EBulletTypeCharacterController=6]="EBulletTypeCharacterController",t[t.EBulletTypeStridingMeshInterface=7]="EBulletTypeStridingMeshInterface",t[t.EBulletTypeTriangleMesh=8]="EBulletTypeTriangleMesh",t[t.EBulletTypeCollisionDispatcher=9]="EBulletTypeCollisionDispatcher",t[t.EBulletTypeDbvtBroadPhase=10]="EBulletTypeDbvtBroadPhase",t[t.EBulletTypeSequentialImpulseConstraintSolver=11]="EBulletTypeSequentialImpulseConstraintSolver",t[t.EBulletTypeCollisionWorld=12]="EBulletTypeCollisionWorld",t[t.EBulletTypeTypedConstraint=13]="EBulletTypeTypedConstraint",t[t.EBulletTypeDebugDraw=14]="EBulletTypeDebugDraw"}(Jut||(Jut={})),function(t){t[t.NONE=0]="NONE",t[t.FilterBackfaces=1]="FilterBackfaces",t[t.KeepUnflippedNormal=2]="KeepUnflippedNormal",t[t.UseSubSimplexConvexCastRaytest=4]="UseSubSimplexConvexCastRaytest",t[t.UseGjkConvexCastRaytest=8]="UseGjkConvexCastRaytest"}($ut||($ut={})),function(t){t[t.DBG_NoDebug=0]="DBG_NoDebug",t[t.DBG_DrawWireframe=1]="DBG_DrawWireframe",t[t.DBG_DrawAabb=2]="DBG_DrawAabb",t[t.DBG_DrawFeaturesText=4]="DBG_DrawFeaturesText",t[t.DBG_DrawContactPoints=8]="DBG_DrawContactPoints",t[t.DBG_NoDeactivation=16]="DBG_NoDeactivation",t[t.DBG_NoHelpText=32]="DBG_NoHelpText",t[t.DBG_DrawText=64]="DBG_DrawText",t[t.DBG_ProfileTimings=128]="DBG_ProfileTimings",t[t.DBG_EnableSatComparison=256]="DBG_EnableSatComparison",t[t.DBG_DisableBulletLCP=512]="DBG_DisableBulletLCP",t[t.DBG_EnableCCD=1024]="DBG_EnableCCD",t[t.DBG_DrawConstraints=2048]="DBG_DrawConstraints",t[t.DBG_DrawConstraintLimits=4096]="DBG_DrawConstraintLimits",t[t.DBG_FastWireframe=8192]="DBG_FastWireframe",t[t.DBG_DrawNormals=16384]="DBG_DrawNormals",t[t.DBG_DrawFrames=32768]="DBG_DrawFrames",t[t.DBG_MAX_DEBUG_DRAW_MODE=32769]="DBG_MAX_DEBUG_DRAW_MODE"}(tlt||(tlt={}));var nlt={},rlt={BODY_CACHE_NAME:"body",CCT_CACHE_NAME:"cct"};AL.onPostInfrastructureInitDelegate.add((function(){return FL().then((function(){return Promise.all([e.import("./bullet.release.wasm-7961ac01.js"),e.import("./bullet.release.wasm-e702f478.js"),e.import("./bullet.release.asm-34d2d331.js")]).then((function(t){var e,i,n,r=t[0].default,s=t[1].default,a=t[2].default;return Ol.hasFeature(Ol.Feature.WASM)?(i=r,n=s,new Promise((function(t,e){var r=function(t){return"[bullet]: bullet wasm lib load failed: "+t};i({instantiateWasm:function(t,i){NL(n,t).then((function(t){i(t.instance,t.module)})).catch((function(t){return e(r(t))}))}}).then((function(t){k("[bullet]:bullet wasm lib loaded."),nlt=t})).then(t).catch((function(t){return e(r(t))}))}))):null!=(e=a)?e().then((function(t){k("[bullet]:bullet asm lib loaded."),nlt=t})):new Promise((function(t){t()}))}))})).catch((function(t){G(t)}))}));var slt={type:"onTriggerEnter",selfCollider:null,otherCollider:null,impl:null},alt={type:"onCollisionEnter",selfCollider:null,otherCollider:null,contacts:[],impl:null},olt={type:"onControllerTriggerEnter",collider:null,characterController:null,impl:null},hlt=function(){function t(){this.BT_TRANSFORM_0=nlt.Transform_new(),this.BT_TRANSFORM_1=nlt.Transform_new(),this.BT_V3_0=nlt.Vec3_new(0,0,0),this.BT_V3_1=nlt.Vec3_new(0,0,0),this.BT_V3_2=nlt.Vec3_new(0,0,0),this.BT_QUAT_0=nlt.Quat_new(0,0,0,1)}return t.setWrapper=function(t,e,i){this.ROOT[e]||(this.ROOT[e]={}),this.ROOT[e][t]=i},t.delWrapper=function(t,e){delete this.ROOT[e][t]},t.getWrapper=function(t,e){return this.ROOT[e][t]},t.isNotEmptyShape=function(t){return t!==nlt.EmptyShape_static()},n(t,null,[{key:"instance",get:function(){return null==t._instance&&(t._instance=new t),t._instance}}]),t}();hlt._instance=void 0,hlt.ROOT={};var ult=new hn,llt=new hn,clt=new hn,_lt=new En,dlt=new En,flt=new Dn;new Dn;var plt,mlt,glt,vlt,ylt,Tlt,Slt,Elt,Alt,Rlt,blt,Clt,wlt=new pn;function xlt(t,e){return nlt.Vec3_set(t,e.x,e.y,e.z),t}function Ilt(t,e){var i=nlt.HEAPF32.subarray(e/4,e/4+3);return t.x=i[0],t.y=i[1],t.z=i[2],t}function Olt(t,e){return nlt.Quat_set(t,e.x,e.y,e.z,e.w),t}function Dlt(t,e){var i=nlt.HEAPF32.subarray(e/4,e/4+4);return t.x=i[0],t.y=i[1],t.z=i[2],t.w=i[3],t}function Mlt(t,e){for(var i=e.renderingSubMeshes.length,n=0;n=0&&e.allMaterials.splice(i,1),!0}return!1},i.setValues=function(t,i,n,r){var s=this._friction!==t||this._rollingFriction!==i||this._spinningFriction!==n||this._restitution!==r;this._friction=t,this._rollingFriction=i,this._spinningFriction=n,this._restitution=r,s&&this.emit(e.EVENT_UPDATE)},n(e,[{key:"friction",get:function(){return this._friction},set:function(t){wi(this._friction,t)||(this._friction=t,this.emit(e.EVENT_UPDATE))}},{key:"rollingFriction",get:function(){return this._rollingFriction},set:function(t){wi(this._rollingFriction,t)||(this._rollingFriction=t,this.emit(e.EVENT_UPDATE))}},{key:"spinningFriction",get:function(){return this._spinningFriction},set:function(t){wi(this._spinningFriction,t)||(this._spinningFriction=t,this.emit(e.EVENT_UPDATE))}},{key:"restitution",get:function(){return this._restitution},set:function(t){wi(this._restitution,t)||(this._restitution=t,this.emit(e.EVENT_UPDATE))}}]),e}(uf)).allMaterials=[],Clt.EVENT_UPDATE="event_update",Clt._idCounter=0,f((Slt=Clt).prototype,"friction",[mlt],Object.getOwnPropertyDescriptor(Slt.prototype,"friction"),Slt.prototype),f(Slt.prototype,"rollingFriction",[glt],Object.getOwnPropertyDescriptor(Slt.prototype,"rollingFriction"),Slt.prototype),f(Slt.prototype,"spinningFriction",[vlt],Object.getOwnPropertyDescriptor(Slt.prototype,"spinningFriction"),Slt.prototype),f(Slt.prototype,"restitution",[ylt],Object.getOwnPropertyDescriptor(Slt.prototype,"restitution"),Slt.prototype),Elt=Gs(Slt.prototype,"_friction",[ra],(function(){return.6})),Alt=Gs(Slt.prototype,"_rollingFriction",[ra],(function(){return 0})),Rlt=Gs(Slt.prototype,"_spinningFriction",[ra],(function(){return 0})),blt=Gs(Slt.prototype,"_restitution",[ra],(function(){return 0})),Tlt=Slt))||Tlt)),Nlt=t("fc",function(){function t(){this._hitPoint=new hn,this._hitNormal=new hn,this._distance=0,this._collider=null}var e=t.prototype;return e._assign=function(t,e,i,n){hn.copy(this._hitPoint,t),hn.copy(this._hitNormal,n),this._distance=e,this._collider=i},e.clone=function(){var e=new t;return hn.copy(e._hitPoint,this._hitPoint),hn.copy(e._hitNormal,this._hitNormal),e._distance=this._distance,e._collider=this._collider,e},n(t,[{key:"hitPoint",get:function(){return this._hitPoint}},{key:"distance",get:function(){return this._distance}},{key:"collider",get:function(){return this._collider}},{key:"hitNormal",get:function(){return this._hitNormal}}]),t}()),Llt=t("fd",function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r=this._fixedTimeStep)){this.physicsWorld.syncSceneToPhysics();break}this.physicsWorld.syncSceneToPhysics(),this.physicsWorld.step(this._fixedTimeStep),this.physicsWorld.emitEvents(),this.physicsWorld.syncAfterEvents(),this._accumulator-=this._fixedTimeStep,this._subStepCount++}gL.emit(mL.EVENT_AFTER_PHYSICS)}}else this.physicsWorld.syncSceneToPhysics()},e.resetConfiguration=function(t){var e=t?t.allowSleep:be.querySettings(Re.Category.PHYSICS,"allowSleep");"boolean"==typeof e&&(this._allowSleep=e);var i=t?t.fixedTimeStep:be.querySettings(Re.Category.PHYSICS,"fixedTimeStep");"number"==typeof i&&(this._fixedTimeStep=i);var n=t?t.maxSubSteps:be.querySettings(Re.Category.PHYSICS,"maxSubSteps");"number"==typeof n&&(this._maxSubSteps=n);var r=t?t.sleepThreshold:be.querySettings(Re.Category.PHYSICS,"sleepThreshold");"number"==typeof r&&(this._sleepThreshold=r);var s=t?t.autoSimulation:be.querySettings(Re.Category.PHYSICS,"autoSimulation");"boolean"==typeof s&&(this.autoSimulation=s);var a=t?t.gravity:be.querySettings(Re.Category.PHYSICS,"gravity");a&&hn.copy(this._gravity,a);var o=t?t.collisionMatrix:be.querySettings(Re.Category.PHYSICS,"collisionMatrix");if(o)for(var h in o)this.collisionMatrix[""+(1<>>0,this.raycastOptions.maxDistance=i,this.raycastOptions.queryTrigger=n,this.physicsWorld.raycast(t,this.raycastOptions,this.raycastResultPool,this.raycastResults))},e.raycastClosest=function(t,e,i,n){return void 0===e&&(e=4294967295),void 0===i&&(i=1e7),void 0===n&&(n=!0),!!this.physicsWorld&&(this.raycastOptions.mask=e>>>0,this.raycastOptions.maxDistance=i,this.raycastOptions.queryTrigger=n,this.physicsWorld.raycastClosest(t,this.raycastOptions,this.raycastClosestResult))},e.lineStripCast=function(t,e,i,n){if(void 0===e&&(e=4294967295),void 0===i&&(i=1e7),void 0===n&&(n=!0),t.length<2)return!1;this.lineStripCastResults=[];for(var r=0,s=new hr,a=1;ai);++a){var o=t[a-1],h=t[a],u=new hn;hn.subtract(u,h,o);var l=hn.len(u);if(r+=l,hn.multiplyScalar(u,u,1/l),s.d=u,s.o=o,this.raycast(s,e,l,n))for(var c=0;c0},e.lineStripCastClosest=function(t,e,i,n){if(void 0===e&&(e=4294967295),void 0===i&&(i=1e7),void 0===n&&(n=!0),t.length<2)return!1;for(var r=0,s=new hr,a=!1,o=1;oi);++o){var h=t[o-1],u=t[o],l=new hn;hn.subtract(l,u,h);var c=hn.len(l);if(r+=c,hn.multiplyScalar(l,l,1/c),s.d=l,s.o=h,a=this.raycastClosest(s,e,c,n)){var _=this.raycastClosestResult,d=new Llt;d._assign(_.hitPoint,_.distance,_.collider,_.hitNormal,o-1),this.lineStripCastClosestResult=d;break}}return a},e.sweepBox=function(t,e,i,n,r,s){return void 0===n&&(n=4294967295),void 0===r&&(r=1e7),void 0===s&&(s=!0),!!this.physicsWorld&&(this.sweepResultPool.reset(),this.sweepCastResults.length=0,this.raycastOptions.mask=n>>>0,this.raycastOptions.maxDistance=r,this.raycastOptions.queryTrigger=s,this.physicsWorld.sweepBox(t,e,i,this.raycastOptions,this.sweepResultPool,this.sweepCastResults))},e.sweepBoxClosest=function(t,e,i,n,r,s){return void 0===n&&(n=4294967295),void 0===r&&(r=1e7),void 0===s&&(s=!0),!!this.physicsWorld&&(this.raycastOptions.mask=n>>>0,this.raycastOptions.maxDistance=r,this.raycastOptions.queryTrigger=s,this.physicsWorld.sweepBoxClosest(t,e,i,this.raycastOptions,this.sweepCastClosestResult))},e.sweepSphere=function(t,e,i,n,r){return void 0===i&&(i=4294967295),void 0===n&&(n=1e7),void 0===r&&(r=!0),!!this.physicsWorld&&(this.sweepResultPool.reset(),this.sweepCastResults.length=0,this.raycastOptions.mask=i>>>0,this.raycastOptions.maxDistance=n,this.raycastOptions.queryTrigger=r,this.physicsWorld.sweepSphere(t,e,this.raycastOptions,this.sweepResultPool,this.sweepCastResults))},e.sweepSphereClosest=function(t,e,i,n,r){return void 0===i&&(i=4294967295),void 0===n&&(n=1e7),void 0===r&&(r=!0),!!this.physicsWorld&&(this.raycastOptions.mask=i>>>0,this.raycastOptions.maxDistance=n,this.raycastOptions.queryTrigger=r,this.physicsWorld.sweepSphereClosest(t,e,this.raycastOptions,this.sweepCastClosestResult))},e.sweepCapsule=function(t,e,i,n,r,s,a){return void 0===r&&(r=4294967295),void 0===s&&(s=1e7),void 0===a&&(a=!0),!!this.physicsWorld&&(this.sweepResultPool.reset(),this.sweepCastResults.length=0,this.raycastOptions.mask=r>>>0,this.raycastOptions.maxDistance=s,this.raycastOptions.queryTrigger=a,this.physicsWorld.sweepCapsule(t,e,i,n,this.raycastOptions,this.sweepResultPool,this.sweepCastResults))},e.sweepCapsuleClosest=function(t,e,i,n,r,s,a){return void 0===r&&(r=4294967295),void 0===s&&(s=1e7),void 0===a&&(a=!0),!!this.physicsWorld&&(this.raycastOptions.mask=r>>>0,this.raycastOptions.maxDistance=s,this.raycastOptions.queryTrigger=a,this.physicsWorld.sweepCapsuleClosest(t,e,i,n,this.raycastOptions,this.sweepCastClosestResult))},e._updateMaterial=function(){this.physicsWorld&&this.physicsWorld.setDefaultMaterial(this._material)},i.constructAndRegister=function(){var t;if((null===(t=be.querySettings(Re.Category.PHYSICS,"enabled"))||void 0===t||t)&&!i._instance){var e=new i;i._instance=e,e.resetConfiguration(),function(t){if(mut||(mut=t),zut.runInEditor&&!zut.physicsWorld){k("[PHYSICS]: using "+zut.id+".");var e=zut.physicsWorld=jut();e.setGravity(mut.gravity),e.setAllowSleep(mut.allowSleep)}}(e),gL.registerSystem(i.ID,e,e.priority),AL.onPostProjectInitDelegate.add(e.initDefaultMaterial.bind(e))}},n(i,[{key:"enable",get:function(){return this._enable},set:function(t){this._enable=t}},{key:"allowSleep",get:function(){return this._allowSleep},set:function(t){this._allowSleep=t,this.physicsWorld&&this.physicsWorld.setAllowSleep(t)}},{key:"maxSubSteps",get:function(){return this._maxSubSteps},set:function(t){this._maxSubSteps=t}},{key:"fixedTimeStep",get:function(){return this._fixedTimeStep},set:function(t){this._fixedTimeStep=t}},{key:"gravity",get:function(){return this._gravity},set:function(t){this._gravity.set(t),this.physicsWorld&&this.physicsWorld.setGravity(t)}},{key:"sleepThreshold",get:function(){return this._sleepThreshold},set:function(t){this._sleepThreshold=t}},{key:"autoSimulation",get:function(){return this._autoSimulation},set:function(t){this._autoSimulation=t}},{key:"defaultMaterial",get:function(){return this._material}},{key:"physicsWorld",get:function(){return zut.physicsWorld}},{key:"debugDrawFlags",get:function(){return this.physicsWorld.debugDrawFlags},set:function(t){this.physicsWorld.debugDrawFlags=t}},{key:"debugDrawConstraintSize",get:function(){return this.physicsWorld.debugDrawConstraintSize},set:function(t){this.physicsWorld.debugDrawConstraintSize=t}}],[{key:"PHYSICS_NONE",get:function(){return!zut.id}},{key:"PHYSICS_BUILTIN",get:function(){return"builtin"===zut.id}},{key:"PHYSICS_CANNON",get:function(){return"cannon.js"===zut.id}},{key:"PHYSICS_BULLET",get:function(){return"bullet"===zut.id}},{key:"PHYSICS_PHYSX",get:function(){return"physx"===zut.id}},{key:"PhysicsGroup",get:function(){return fut}},{key:"instance",get:function(){return i._instance}}]),i}(Lu));tct.ID="PHYSICS",tct._instance=null,gL.once(mL.EVENT_INIT,(function(){tct.constructAndRegister()}));var ect,ict,nct,rct,sct,act,oct,hct,uct,lct,cct,_ct=t("f8",(klt=qs("cc.RigidBody"),Ult=Zs(-1),Glt=xa(tct.PhysicsGroup),Hlt=xa(sut),klt(zlt=Js(zlt=Ult((($lt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;raut.Z_AXIS||this._direction!==t&&(this._direction=t,this._shape&&this.shape.setDirection(t))}},{key:"height",get:function(){return 2*this._radius+this._cylinderHeight},set:function(t){var e=t-2*this._radius;e<0&&(e=0),this.cylinderHeight=e}},{key:"worldHeight",get:function(){return 2*this._radius*this._getRadiusScale()+this._cylinderHeight*this._getHeightScale()}},{key:"shape",get:function(){return this._shape}}]),e}(vct)).prototype,"direction",[Act],Object.getOwnPropertyDescriptor(bct.prototype,"direction"),bct.prototype),Cct=Gs(bct.prototype,"_radius",[ra],(function(){return.5})),wct=Gs(bct.prototype,"_cylinderHeight",[ra],(function(){return 1})),xct=Gs(bct.prototype,"_direction",[ra],(function(){return aut.Y_AXIS})),Rct=bct))||Rct)),p_t=t("fj",(Ict=qs("cc.CylinderCollider"),Oct=xa(aut),Ict((f((Mct=function(t){function e(){var e;return(e=t.call(this,uut.CYLINDER)||this)._radius=Pct&&Pct(),e._height=Bct&&Bct(),e._direction=Nct&&Nct(),e}return s(e,t),n(e,[{key:"radius",get:function(){return this._radius},set:function(t){this._radius!==t&&(this._radius=Math.abs(t),this._shape&&this.shape.setRadius(t))}},{key:"height",get:function(){return this._height},set:function(t){this._height!==t&&(this._height=Math.abs(t),this._shape&&this.shape.setHeight(t))}},{key:"direction",get:function(){return this._direction},set:function(t){this._direction!==t&&(taut.Z_AXIS||(this._direction=t,this._shape&&this.shape.setDirection(t)))}},{key:"shape",get:function(){return this._shape}}]),e}(vct)).prototype,"direction",[Oct],Object.getOwnPropertyDescriptor(Mct.prototype,"direction"),Mct.prototype),Pct=Gs(Mct.prototype,"_radius",[ra],(function(){return.5})),Bct=Gs(Mct.prototype,"_height",[ra],(function(){return 2})),Nct=Gs(Mct.prototype,"_direction",[ra],(function(){return aut.Y_AXIS})),Dct=Mct))||Dct)),m_t=t("fk",(Lct=qs("cc.ConeCollider"),Fct=xa(aut),Lct((f((Uct=function(t){function e(){var e;return(e=t.call(this,uut.CONE)||this)._radius=Gct&&Gct(),e._height=Hct&&Hct(),e._direction=zct&&zct(),e}return s(e,t),n(e,[{key:"radius",get:function(){return this._radius},set:function(t){this._radius!==t&&(this._radius=Math.abs(t),this._shape&&this.shape.setRadius(t))}},{key:"height",get:function(){return this._height},set:function(t){this._height!==t&&(t<0&&(t=0),this._height=t,this._shape&&this.shape.setHeight(t))}},{key:"direction",get:function(){return this._direction},set:function(t){this._direction!==t&&(taut.Z_AXIS||(this._direction=t,this._shape&&this.shape.setDirection(t)))}},{key:"shape",get:function(){return this._shape}}]),e}(vct)).prototype,"direction",[Fct],Object.getOwnPropertyDescriptor(Uct.prototype,"direction"),Uct.prototype),Gct=Gs(Uct.prototype,"_radius",[ra],(function(){return.5})),Hct=Gs(Uct.prototype,"_height",[ra],(function(){return 1})),zct=Gs(Uct.prototype,"_direction",[ra],(function(){return aut.Y_AXIS})),kct=Uct))||kct)),g_t=t("fi",(Vct=qs("cc.MeshCollider"),Wct=xa(QL),Vct((f((jct=function(t){function e(){var e;return(e=t.call(this,uut.MESH)||this)._mesh=Yct&&Yct(),e._convex=Kct&&Kct(),e}return s(e,t),e.prototype.onEnable=function(){if(t.prototype.onEnable.call(this),this.node){var e=this.node.getComponent(_ct);e&&e.isValid&&e.type===sut.DYNAMIC&&!this.convex&&q(9630,this.node.name)}},n(e,[{key:"mesh",get:function(){return this._mesh},set:function(t){this._mesh!==t&&(this._mesh=t,this._shape&&this.shape.setMesh(this._mesh))}},{key:"convex",get:function(){return this._convex},set:function(t){this._convex!==t&&(this._convex=t,this._shape&&this._mesh&&this.shape.setMesh(this._mesh))}},{key:"shape",get:function(){return this._shape}}]),e}(vct)).prototype,"mesh",[Wct],Object.getOwnPropertyDescriptor(jct.prototype,"mesh"),jct.prototype),Yct=Gs(jct.prototype,"_mesh",[ra],(function(){return null})),Kct=Gs(jct.prototype,"_convex",[ra],(function(){return!1})),Xct=jct))||Xct)),v_t=t("fa",qs("cc.ConstantForce")(qct=Qs(_ct)(qct=Js((Qct=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;rt)){for(var e=this.buffer.byteLength;e=b_t?this.tileSize=e.readDouble():this.tileSize=e.readFloat(),this.tileSize=Math.floor(100*this.tileSize)/100,e.readIntArray(this._blockCount),this.weightMapSize=e.readInt16(),this.lightMapSize=e.readInt16();var i=e.readInt();this.heights=new Uint16Array(i);for(var n=0;n=R_t){var o=e.readInt();this.normals=new Float32Array(o);for(var h=0;h=S_t){var c=e.readInt();this.layerBuffer=new Array(c);for(var _=0;_=E_t){var d=e.readInt();this._layerBinaryInfos=new Array(d);for(var f=0;f=b_t?this._layerBinaryInfos[f].tileSize=e.readDouble():this._layerBinaryInfos[f].tileSize=e.readFloat(),this._layerBinaryInfos[f].detailMapId=e.readString(),this._version>=A_t&&(this._layerBinaryInfos[f].normalMapId=e.readString(),this._version>=b_t?(this._layerBinaryInfos[f].roughness=e.readDouble(),this._layerBinaryInfos[f].metallic=e.readDouble()):(this._layerBinaryInfos[f].roughness=e.readFloat(),this._layerBinaryInfos[f].metallic=e.readFloat()))}return!0},i._exportNativeData=function(){var t=new x_t;t.writeInt32(C_t),t.writeDouble(this.tileSize),t.writeIntArray(this._blockCount),t.writeInt16(this.weightMapSize),t.writeInt16(this.lightMapSize),t.writeInt32(this.heights.length);for(var e=0;e=0&&(he(this.ghostStruct.wrappedShapes,i),t.setCompound(0),this.ghostEnabled=!1)}else{var n=this.bodyStruct.wrappedShapes.indexOf(t);n>=0&&(this.bodyStruct.useCompound?t.setCompound(0):nlt.CollisionObject_setCollisionShape(this.body,nlt.EmptyShape_static()),nlt.CollisionObject_activate(this.body,!0),this.dirty|=dgt.BODY_RE_ADD,he(this.bodyStruct.wrappedShapes,n),this.bodyEnabled=!1)}},e.addJoint=function(t,e){e?this.wrappedJoints1.indexOf(t)<0&&this.wrappedJoints1.push(t):this.wrappedJoints0.indexOf(t)<0&&this.wrappedJoints0.push(t)},e.removeJoint=function(t,e){if(e){var i=this.wrappedJoints1.indexOf(t);i>=0&&he(this.wrappedJoints1,i)}else{var n=this.wrappedJoints0.indexOf(t);n>=0&&he(this.wrappedJoints0,n)}},e.updateDirty=function(){this.dirty&&(this.bodyIndex>=0&&this.dirty&dgt.BODY_RE_ADD&&this.updateBodyByReAdd(),this.ghostIndex>=0&&this.dirty&dgt.GHOST_RE_ADD&&this.updateGhostByReAdd(),this.dirty=0)},e.syncSceneToPhysics=function(){if(this.node.hasChangedFlags){var t=hlt.instance.BT_QUAT_0,e=nlt.CollisionObject_getWorldTransform(this.body);if(Olt(t,this.node.worldRotation),xlt(nlt.Transform_getOrigin(e),this.node.worldPosition),nlt.Transform_setRotation(e,t),this.node.hasChangedFlags&om.SCALE&&this.syncBodyScale(),nlt.CollisionObject_isKinematicObject(this.body)){var i=nlt.RigidBody_getMotionState(this.body);i&&nlt.MotionState_setWorldTransform(i,e)}else this.isBodySleeping()&&nlt.CollisionObject_activate(this.body,!1)}},e.syncPhysicsToScene=function(){nlt.CollisionObject_isStaticOrKinematicObject(this.body)||this.syncPhysicsToGraphics()},e.syncPhysicsToGraphics=function(){if(!this.isBodySleeping()){var t=hlt.instance.BT_QUAT_0,e=hlt.instance.BT_TRANSFORM_0;nlt.RigidBody_getWorldTransform(this.body,e);var i=nlt.Transform_getRotationAndOrigin(e,t);if(this.node.worldRotation=Dlt(Rgt,t),this.node.worldPosition=Ilt(Agt,i),this._ghostStruct){var n=nlt.CollisionObject_getWorldTransform(this.ghost);xlt(nlt.Transform_getOrigin(n),this.node.worldPosition),Olt(t,this.node.worldRotation),nlt.Transform_setRotation(n,t)}}},e.syncSceneToGhost=function(){if(this.node.hasChangedFlags){var t=hlt.instance.BT_QUAT_0,e=nlt.CollisionObject_getWorldTransform(this.ghost);xlt(nlt.Transform_getOrigin(e),this.node.worldPosition),Olt(t,this.node.worldRotation),nlt.Transform_setRotation(e,t),this.node.hasChangedFlags&om.SCALE&&this.syncGhostScale(),nlt.CollisionObject_activate(this.ghost,!1)}},e.syncInitialBody=function(){var t=hlt.instance.BT_QUAT_0,e=nlt.CollisionObject_getWorldTransform(this.body);xlt(nlt.Transform_getOrigin(e),this.node.worldPosition),Olt(t,this.node.worldRotation),nlt.Transform_setRotation(e,t),this.syncBodyScale(),nlt.CollisionObject_activate(this.body,!1)},e.syncInitialGhost=function(){var t=hlt.instance.BT_QUAT_0,e=nlt.CollisionObject_getWorldTransform(this.ghost);xlt(nlt.Transform_getOrigin(e),this.node.worldPosition),Olt(t,this.node.worldRotation),nlt.Transform_setRotation(e,t),this.syncGhostScale(),nlt.CollisionObject_activate(this.body,!1)},e.syncBodyScale=function(){for(var t=0;t=0&&(this.wrappedWorld.removeSharedBody(this),this.bodyIndex=this.wrappedWorld.bodies.length,this.wrappedWorld.addSharedBody(this))},e.updateGhostByReAdd=function(){this.ghostIndex>=0&&(this.wrappedWorld.removeGhostObject(this),this.ghostIndex=this.wrappedWorld.ghosts.length,this.wrappedWorld.addGhostObject(this))},e.destroy=function(){if(t.sharedBodesMap.delete(this.node.uuid),this.node=null,this.wrappedWorld=null,this._bodyStruct){var e=this._bodyStruct;hlt.delWrapper(e.body,rlt.BODY_CACHE_NAME),nlt._safe_delete(e.motionState,Jut.EBulletTypeMotionState),nlt._safe_delete(e.compound,Jut.EBulletTypeCollisionShape),nlt._safe_delete(e.body,Jut.EBulletTypeCollisionObject),this._bodyStruct=null}if(this._ghostStruct){var i=this._ghostStruct;nlt._safe_delete(i.compound,Jut.EBulletTypeCollisionShape),nlt._safe_delete(i.ghost,Jut.EBulletTypeCollisionObject),this._ghostStruct=null}},e.isBodySleeping=function(){return nlt.CollisionObject_isSleeping(this.body)},n(t,[{key:"wrappedBody",get:function(){return this._wrappedBody}},{key:"bodyCompoundShape",get:function(){return this.bodyStruct.compound}},{key:"ghostCompoundShape",get:function(){return this.ghostStruct.compound}},{key:"body",get:function(){return this.bodyStruct.body}},{key:"ghost",get:function(){return this.ghostStruct.ghost}},{key:"collisionFilterGroup",get:function(){return this._collisionFilterGroup},set:function(t){t!==this._collisionFilterGroup&&(this._collisionFilterGroup=t,this.dirty|=dgt.BODY_RE_ADD,this.dirty|=dgt.GHOST_RE_ADD)}},{key:"collisionFilterMask",get:function(){return this._collisionFilterMask},set:function(t){t!==this._collisionFilterMask&&(this._collisionFilterMask=t,this.dirty|=dgt.BODY_RE_ADD,this.dirty|=dgt.GHOST_RE_ADD)}},{key:"bodyStruct",get:function(){return this._instantiateBodyStruct(),this._bodyStruct}},{key:"ghostStruct",get:function(){return this._instantiateGhostStruct(),this._ghostStruct}},{key:"bodyEnabled",set:function(t){if(t){if(this.bodyIndex<0){if(0===this.bodyStruct.wrappedShapes.length){if(!this.wrappedBody)return;if(!this.wrappedBody.rigidBody.isDynamic)return}this.bodyIndex=this.wrappedWorld.bodies.length,this.wrappedWorld.addSharedBody(this),this.syncInitialBody()}}else this.bodyIndex>=0&&(0===this.bodyStruct.wrappedShapes.length&&null==this.wrappedBody||0===this.bodyStruct.wrappedShapes.length&&null!=this.wrappedBody&&!this.wrappedBody.isEnabled||0===this.bodyStruct.wrappedShapes.length&&null!=this.wrappedBody&&!this.wrappedBody.rigidBody.enabledInHierarchy)&&(nlt.RigidBody_clearState(this.body),this.bodyIndex=-1,this.wrappedWorld.removeSharedBody(this))}},{key:"ghostEnabled",set:function(t){t?this.ghostIndex<0&&this.ghostStruct.wrappedShapes.length>0&&(this.ghostIndex=1,this.wrappedWorld.addGhostObject(this),this.syncInitialGhost()):this.ghostIndex>=0&&0===this.ghostStruct.wrappedShapes.length&&this.ghost&&(this.ghostIndex=-1,this.wrappedWorld.removeGhostObject(this))}},{key:"reference",set:function(t){t?this.ref++:this.ref--,0===this.ref&&this.destroy()}}]),t}();Cgt.idCounter=0,Cgt.sharedBodesMap=new Map;var wgt=ult,xgt={},Igt=function(){function t(){this.id=t.idCounter++,this._isEnabled=!1,this._isTrigger=!1,this._isInitialized=!1,this._impl=0,this._compound=0,this.quat=nlt.Quat_new(0,0,0,1),this.transform=nlt.Transform_new(),this._collider=void 0,this._sharedBody=void 0}var e=t.prototype;return e.updateEventListener=function(){this._sharedBody.wrappedWorld.updateNeedEmitEvents(this.collider.needCollisionEvent||this.collider.needTriggerEvent)},e.setMaterial=function(t){var e=null==t?tct.instance.defaultMaterial:t;if(!this._isTrigger&&this._isEnabled)if(this._compound){xgt[e._uuid]||(xgt[e._uuid]=nlt.ccMaterial_new());var i=xgt[e._uuid];nlt.ccMaterial_set(i,e.restitution,e.friction,e.rollingFriction,e.spinningFriction),nlt.CollisionShape_setMaterial(this._impl,i)}else nlt.CollisionObject_setMaterial(this._sharedBody.body,e.restitution,e.friction,e.rollingFriction,e.spinningFriction)},e.setCenter=function(t){hn.copy(wgt,t),wgt.multiply(this._collider.node.worldScale),xlt(nlt.Transform_getOrigin(this.transform),wgt),this.updateCompoundTransform()},e.setAsTrigger=function(t){this._isTrigger!==t&&(this._isEnabled&&(this._sharedBody.removeShape(this,!t),this._sharedBody.addShape(this,t)),this._isTrigger=t)},e.getAABB=function(t){var e=hlt.instance.BT_TRANSFORM_0;nlt.Transform_setIdentity(e),nlt.Transform_setRotation(e,Olt(hlt.instance.BT_QUAT_0,this._collider.node.worldRotation));var i=hlt.instance.BT_V3_0,n=hlt.instance.BT_V3_1;nlt.CollisionShape_getAabb(this._impl,e,i,n),t.halfExtents.x=(nlt.Vec3_x(n)-nlt.Vec3_x(i))/2,t.halfExtents.y=(nlt.Vec3_y(n)-nlt.Vec3_y(i))/2,t.halfExtents.z=(nlt.Vec3_z(n)-nlt.Vec3_z(i))/2,hn.add(t.center,this._collider.node.worldPosition,this._collider.center)},e.getBoundingSphere=function(t){t.radius=nlt.CollisionShape_getLocalBoundingSphere(this._impl),hn.add(t.center,this._collider.node.worldPosition,this._collider.center)},e.initialize=function(t){this._collider=t,this._isInitialized=!0,this._sharedBody=tct.instance.physicsWorld.getSharedBody(this._collider.node),this._sharedBody.reference=!0,this.onComponentSet(),this.setWrapper()},e.setWrapper=function(){hlt.isNotEmptyShape(this._impl)&&(nlt.CollisionShape_setUserPointer(this._impl,this._impl),hlt.setWrapper(this._impl,t.TYPE,this))},e.onLoad=function(){this.setCenter(this._collider.center),this.setAsTrigger(this._collider.isTrigger)},e.onEnable=function(){this._isEnabled=!0,this._sharedBody.addShape(this,this._isTrigger),this.setMaterial(this.collider.sharedMaterial)},e.onDisable=function(){this._isEnabled=!1,this._sharedBody.removeShape(this,this._isTrigger)},e.onDestroy=function(){this._sharedBody.reference=!1,this._collider=null,nlt._safe_delete(this.quat,Jut.EBulletTypeQuat),nlt._safe_delete(this.transform,Jut.EBulletTypeTransform),this._compound&&nlt._safe_delete(this._compound,Jut.EBulletTypeCollisionShape),hlt.isNotEmptyShape(this._impl)&&(nlt._safe_delete(this._impl,Jut.EBulletTypeCollisionShape),hlt.delWrapper(this._impl,t.TYPE))},e.updateByReAdd=function(){this._isEnabled&&(this._sharedBody.removeShape(this,this._isTrigger),this._sharedBody.addShape(this,this._isTrigger))},e.getGroup=function(){return this._sharedBody.collisionFilterGroup},e.setGroup=function(t){this._sharedBody.collisionFilterGroup=t},e.addGroup=function(t){this._sharedBody.collisionFilterGroup|=t},e.removeGroup=function(t){this._sharedBody.collisionFilterGroup&=~t},e.getMask=function(){return this._sharedBody.collisionFilterMask},e.setMask=function(t){this._sharedBody.collisionFilterMask=t},e.addMask=function(t){this._sharedBody.collisionFilterMask|=t},e.removeMask=function(t){this._sharedBody.collisionFilterMask&=~t},e.setCompound=function(t){this._compound&&nlt.CompoundShape_removeChildShape(this._compound,this._impl),t&&nlt.CompoundShape_addChildShape(t,this.transform,this._impl),this._compound=t},e.updateScale=function(){this.setCenter(this._collider.center)},e.updateCompoundTransform=function(){this._compound?nlt.CompoundShape_updateChildTransform(this._compound,this._impl,this.transform,!0):this._isEnabled&&!this._isTrigger&&this._sharedBody&&!this._sharedBody.bodyStruct.useCompound&&(this._sharedBody.dirty|=dgt.BODY_RE_ADD)},e.needCompound=function(){return this._collider.type===uut.TERRAIN||!this._collider.center.equals(hn.ZERO)},n(t,[{key:"attachedRigidBody",get:function(){return this._sharedBody.wrappedBody?this._sharedBody.wrappedBody.rigidBody:null}},{key:"impl",get:function(){return this._impl}},{key:"collider",get:function(){return this._collider}},{key:"sharedBody",get:function(){return this._sharedBody}}]),t}();Igt.TYPE="shape",Igt.idCounter=0;var Ogt=function(){function t(){this.matrix=[]}var e=t.prototype;return e.get=function(t,e){if(e>t){var i=e;e=t,t=i}return this.matrix[(t*(t+1)>>1)+e-1]},e.set=function(t,e,i){if(e>t){var n=e;e=t,t=n}this.matrix[(t*(t+1)>>1)+e-1]=i?1:0},e.reset=function(){this.matrix.length=0},e.setNumObjects=function(t){this.matrix.length=t*(t-1)>>1},t}(),Dgt=function(){function t(){this.data=void 0,this.data={keys:[]}}var e=t.prototype;return e.get=function(t,e){if(t>e){var i=e;e=t,t=i}return this.data[t+"-"+e]},e.set=function(t,e,i){if(t>e){var n=e;e=t,t=n}var r=t+"-"+e;if(null==i){var s=this.data.keys.indexOf(r);if(-1!==s)return this.data.keys.splice(s,1),delete this.data[r],i}return this.get(t,e)||this.data.keys.push(r),this.data[r]=i,this.data[r]},e.reset=function(){this.data={keys:[]}},e.getLength=function(){return this.data.keys.length},e.getKeyByIndex=function(t){return this.data.keys[t]},e.getDataByKey=function(t){return this.data[t]},t}(),Mgt=function(){function t(t){this.impl=0,this.event=void 0,this.event=t}var e=t.prototype;return e.getLocalPointOnA=function(t){this.impl&&Ilt(t,nlt.ManifoldPoint_get_m_localPointA(this.impl))},e.getLocalPointOnB=function(t){this.impl&&Ilt(t,nlt.ManifoldPoint_get_m_localPointB(this.impl))},e.getWorldPointOnA=function(t){this.impl&&Ilt(t,nlt.ManifoldPoint_get_m_positionWorldOnA(this.impl))},e.getWorldPointOnB=function(t){this.impl&&Ilt(t,nlt.ManifoldPoint_get_m_positionWorldOnB(this.impl))},e.getLocalNormalOnA=function(t){if(this.impl){var e=hlt.instance.BT_QUAT_0,i=nlt.PersistentManifold_getBody0(this.event.impl),n=nlt.CollisionObject_getWorldTransform(i);nlt.Transform_getRotation(n,e);var r=_lt;Dlt(r,e),En.conjugate(r,r),Ilt(t,nlt.ManifoldPoint_get_m_normalWorldOnB(this.impl)),this.isBodyA||hn.negate(t,t),hn.transformQuat(t,t,r)}},e.getLocalNormalOnB=function(t){if(this.impl){var e=hlt.instance.BT_QUAT_0,i=nlt.PersistentManifold_getBody1(this.event.impl),n=nlt.CollisionObject_getWorldTransform(i);nlt.Transform_getRotation(n,e);var r=_lt;Dlt(r,e),En.conjugate(r,r),Ilt(t,nlt.ManifoldPoint_get_m_normalWorldOnB(this.impl)),hn.transformQuat(t,t,r)}},e.getWorldNormalOnA=function(t){this.impl&&(Ilt(t,nlt.ManifoldPoint_get_m_normalWorldOnB(this.impl)),this.isBodyA||hn.negate(t,t))},e.getWorldNormalOnB=function(t){this.impl&&Ilt(t,nlt.ManifoldPoint_get_m_normalWorldOnB(this.impl))},n(t,[{key:"isBodyA",get:function(){return this.event.selfCollider.shape.sharedBody.body===nlt.PersistentManifold_getBody0(this.event.impl)}}]),t}(),Pgt=[],Bgt=ult,Ngt=llt,Lgt=clt,Fgt=wlt,kgt=new _gt,Ugt=function(){var t=e.prototype;function e(){this._world=void 0,this._broadphase=void 0,this._solver=void 0,this._dispatcher=void 0,this._debugDraw=void 0,this._debugLineCount=0,this._MAX_DEBUG_LINE_COUNT=16384,this._debugDrawFlags=put.NONE,this._debugConstraintSize=.3,this._needEmitEvents=!1,this._needSyncAfterEvents=!1,this._needEmitCCTEvents=!1,this.bodies=[],this.ghosts=[],this.ccts=[],this.constraints=[],this.triggerArrayMat=new Ogt,this.collisionArrayMat=new Ogt,this.contactsDic=new Dgt,this.oldContactsDic=new Dgt,this.cctShapeEventDic=new Dgt,this.cctContactsDic=new Dgt,this.cctOldContactsDic=new Dgt,rlt.CACHE.world=this,this._broadphase=nlt.DbvtBroadphase_new(),this._dispatcher=nlt.CollisionDispatcher_new(),this._solver=nlt.SequentialImpulseConstraintSolver_new(),this._world=nlt.ccDiscreteDynamicsWorld_new(this._dispatcher,this._broadphase,this._solver);var t=nlt.DebugDraw.implement(Egt);this._debugDraw=t.$$.ptr,nlt.CollisionWorld_setDebugDrawer(this._world,this._debugDraw),nlt.DebugDraw_setDebugMode(this._debugDraw,tlt.DBG_NoDebug),nlt.DebugDraw_setAABBColor(this._debugDraw,0,1,1),nlt.DebugDraw_setActiveObjectColor(this._debugDraw,1,0,1),nlt.DebugDraw_setDeactiveObjectColor(this._debugDraw,1,0,1),nlt.DebugDraw_setWantsDeactivationObjectColor(this._debugDraw,1,0,1),nlt.DebugDraw_setDisabledDeactivationObjectColor(this._debugDraw,1,0,1),nlt.DebugDraw_setDisabledSimulationObjectColor(this._debugDraw,1,0,1),nlt.DebugDraw_setConstraintLimitColor(this._debugDraw,.5,.5,.5)}return t.setDefaultMaterial=function(){},t.setAllowSleep=function(t){nlt.ccDiscreteDynamicsWorld_setAllowSleep(this._world,t)},t.setGravity=function(t){nlt.DynamicsWorld_setGravity(this._world,xlt(hlt.instance.BT_V3_0,t))},t.updateNeedEmitEvents=function(t){if(this.ghosts)if(t)this._needEmitEvents=!0;else{this._needEmitEvents=!1;for(var e=0;e=0;t--){var e=this.ghosts[t];e.updateDirty(),e.syncSceneToGhost()}for(var i=this.bodies.length-1;i>=0;i--){var n=this.bodies[i];n.updateDirty(),n.syncSceneToPhysics()}for(var r=this.ccts,s=r.length-1;s>=0;s--){var a=r[s];a.updateDirty(),a.syncSceneToPhysics()}},t.syncAfterEvents=function(){this._needSyncAfterEvents&&this.syncSceneToPhysics()},t.raycast=function(t,e,i,n){t.computeHit(Bgt,e.maxDistance);var r=xlt(hlt.instance.BT_V3_0,Bgt),s=xlt(hlt.instance.BT_V3_1,t.o),a=nlt.ccAllRayCallback_static();if(nlt.ccAllRayCallback_reset(a,s,r,e.mask>>>0,e.queryTrigger),nlt.ccAllRayCallback_setFlags(a,$ut.UseSubSimplexConvexCastRaytest),nlt.CollisionWorld_rayTest(this._world,s,r,a),nlt.RayCallback_hasHit(a)){for(var o=nlt.ccAllRayCallback_getHitPointWorld(a),h=nlt.ccAllRayCallback_getHitNormalWorld(a),u=nlt.ccAllRayCallback_getCollisionShapePtrs(a),l=0,c=nlt.int_array_size(u);l>>0,e.queryTrigger),nlt.ccClosestRayCallback_setFlags(s,$ut.UseSubSimplexConvexCastRaytest),nlt.CollisionWorld_rayTest(this._world,r,n,s),nlt.RayCallback_hasHit(s)){Ilt(Bgt,nlt.ccClosestRayCallback_getHitPointWorld(s)),Ilt(Ngt,nlt.ccClosestRayCallback_getHitNormalWorld(s));var a=hlt.getWrapper(nlt.ccClosestRayCallback_getCollisionShapePtr(s),Igt.TYPE);return i._assign(Bgt,hn.distance(t.o,Bgt),a.collider,Ngt),!0}return!1},t.sweepBox=function(t,i,n,r,s,a){var o=hlt.instance.BT_V3_0;return xlt(o,i),e._sweepBoxGeometry||(e._sweepBoxGeometry=nlt.BoxShape_new(o)),nlt.BoxShape_setUnscaledHalfExtents(e._sweepBoxGeometry,o),this.sweep(t,e._sweepBoxGeometry,n,r,s,a)},t.sweepBoxClosest=function(t,i,n,r,s){var a=hlt.instance.BT_V3_0;return xlt(a,i),e._sweepBoxGeometry||(e._sweepBoxGeometry=nlt.BoxShape_new(a)),nlt.BoxShape_setUnscaledHalfExtents(e._sweepBoxGeometry,a),this.sweepClosest(t,e._sweepBoxGeometry,n,r,s)},t.sweepSphere=function(t,i,n,r,s){return e._sweepSphereGeometry||(e._sweepSphereGeometry=nlt.SphereShape_new(i)),nlt.SphereShape_setUnscaledRadius(e._sweepSphereGeometry,i),this.sweep(t,e._sweepSphereGeometry,En.IDENTITY,n,r,s)},t.sweepSphereClosest=function(t,i,n,r){return e._sweepSphereGeometry||(e._sweepSphereGeometry=nlt.SphereShape_new(i)),nlt.SphereShape_setUnscaledRadius(e._sweepSphereGeometry,i),this.sweepClosest(t,e._sweepSphereGeometry,En.IDENTITY,n,r)},t.sweepCapsule=function(t,i,n,r,s,a,o){return e._sweepCapsuleGeometry||(e._sweepCapsuleGeometry=nlt.CapsuleShape_new(i,n)),nlt.CapsuleShape_updateProp(e._sweepCapsuleGeometry,i,.5*n,1),this.sweep(t,e._sweepCapsuleGeometry,r,s,a,o)},t.sweepCapsuleClosest=function(t,i,n,r,s,a){return e._sweepCapsuleGeometry||(e._sweepCapsuleGeometry=nlt.CapsuleShape_new(i,n)),nlt.CapsuleShape_updateProp(e._sweepCapsuleGeometry,i,.5*n,1),this.sweepClosest(t,e._sweepCapsuleGeometry,r,s,a)},t.sweep=function(t,e,i,n,r,s){var a=hlt.instance.BT_TRANSFORM_0,o=hlt.instance.BT_TRANSFORM_1,h=hlt.instance.BT_QUAT_0;xlt(nlt.Transform_getOrigin(a),t.o),Olt(h,i),nlt.Transform_setRotation(a,h),t.computeHit(Bgt,n.maxDistance),xlt(nlt.Transform_getOrigin(o),Bgt),Olt(h,i),nlt.Transform_setRotation(o,h);var u=nlt.ccAllConvexCallback_static();if(nlt.ccAllConvexCallback_reset(u,a,o,n.mask>>>0,n.queryTrigger),nlt.CollisionWorld_convexSweepTest(this._world,e,a,o,u,0),nlt.ConvexCallback_hasHit(u)){for(var l=nlt.ccAllConvexCallback_getHitPointWorld(u),c=nlt.ccAllConvexCallback_getHitNormalWorld(u),_=nlt.ccAllConvexCallback_getCollisionShapePtrs(u),d=0,f=nlt.int_array_size(_);d>>0,n.queryTrigger),nlt.CollisionWorld_convexSweepTest(this._world,e,s,a,h,0),nlt.ConvexCallback_hasHit(h)){Ilt(Bgt,nlt.ccClosestConvexCallback_getHitPointWorld(h)),Ilt(Ngt,nlt.ccClosestConvexCallback_getHitNormalWorld(h));var u=hlt.getWrapper(nlt.ccClosestConvexCallback_getCollisionShapePtr(h),Igt.TYPE);return r._assign(Bgt,hn.distance(t.o,Bgt),u.collider,Ngt),!0}return!1},t.getSharedBody=function(t,e){return Cgt.getSharedBody(t,this,e)},t.addSharedBody=function(t){if(this.bodies.indexOf(t)<0){this.bodies.push(t);var e=t.collisionFilterGroup,i=t.collisionFilterMask;nlt.DynamicsWorld_addRigidBody(this._world,t.body,e>>>0,i>>>0)}},t.removeSharedBody=function(t){var e=this.bodies.indexOf(t);e>=0&&(he(this.bodies,e),nlt.DynamicsWorld_removeRigidBody(this._world,t.body))},t.addGhostObject=function(t){if(this.ghosts.indexOf(t)<0){this.ghosts.push(t);var e=t.collisionFilterGroup,i=t.collisionFilterMask;nlt.CollisionWorld_addCollisionObject(this._world,t.ghost,e>>>0,i>>>0)}},t.removeGhostObject=function(t){var e=this.ghosts.indexOf(t);e>=0&&(he(this.ghosts,e),nlt.CollisionWorld_removeCollisionObject(this._world,t.ghost))},t.addCCT=function(t){if(this.ccts.indexOf(t)<0){this.ccts.push(t);var e=nlt.CharacterController_getGhostObject(t.impl),i=t.getGroup(),n=t.getMask();nlt.CollisionWorld_addCollisionObject(this._world,e,i>>>0,n>>>0),nlt.DynamicsWorld_addAction(this._world,t.impl)}},t.removeCCT=function(t){var e=this.ccts.indexOf(t);if(e>=0){he(this.ccts,e);var i=nlt.CharacterController_getGhostObject(t.impl);nlt.CollisionWorld_removeCollisionObject(this._world,i),nlt.DynamicsWorld_removeAction(this._world,t.impl)}},t.addConstraint=function(t){var e=this.constraints.indexOf(t);e<0&&(this.constraints.push(t),nlt.DynamicsWorld_addConstraint(this.impl,t.impl,!t.constraint.enableCollision),t.index=e)},t.removeConstraint=function(t){var e=this.constraints.indexOf(t);e>=0&&(this.constraints.splice(e,1),nlt.DynamicsWorld_removeConstraint(this.impl,t.impl),t.index=-1)},t.emitEvents=function(){this._needSyncAfterEvents=!1,this._needEmitEvents&&(this.gatherConatactData(),this.emitCollisionAndTriggerEvent(),this.emitCCTTriggerEvent()),this._needEmitCCTEvents&&this.emitCCTCollisionEvent()},t.emitCollisionAndTriggerEvent=function(){for(var t=this.contactsDic.getLength();t--;){Pgt.push.apply(Pgt,alt.contacts),alt.contacts.length=0;var e=this.contactsDic.getKeyByIndex(t),i=this.contactsDic.getDataByKey(e),n=i.shape0,r=i.shape1;this.oldContactsDic.set(n.id,r.id,i);var s=n.collider,a=r.collider;if(s&&a){if(s.isTrigger||a.isTrigger)this.triggerArrayMat.get(n.id,r.id)?slt.type="onTriggerStay":(slt.type="onTriggerEnter",this.triggerArrayMat.set(n.id,r.id,!0)),slt.impl=i.impl,slt.selfCollider=s,slt.otherCollider=a,s.emit(slt.type,slt),slt.selfCollider=a,slt.otherCollider=s,a.emit(slt.type,slt),this._needSyncAfterEvents=!0;else{var o=s.attachedRigidBody,h=a.attachedRigidBody;if(o&&h){if(o.isSleeping&&h.isSleeping)continue}else if(!o&&h){if(h.isSleeping)continue}else if(!h&&o&&o.isSleeping)continue;this.collisionArrayMat.get(n.id,r.id)?alt.type="onCollisionStay":(alt.type="onCollisionEnter",this.collisionArrayMat.set(n.id,r.id,!0));for(var u=0;u0){var c=Pgt.pop();c.impl=l,alt.contacts.push(c)}else{var _=new Mgt(alt);_.impl=l,alt.contacts.push(_)}}alt.impl=i.impl,alt.selfCollider=s,alt.otherCollider=a,s.emit(alt.type,alt),alt.selfCollider=a,alt.otherCollider=s,a.emit(alt.type,alt),this._needSyncAfterEvents=!0}null==this.oldContactsDic.get(n.id,r.id)&&this.oldContactsDic.set(n.id,r.id,i)}}for(var d=this.oldContactsDic.getLength();d--;){var f=this.oldContactsDic.getKeyByIndex(d),p=this.oldContactsDic.getDataByKey(f),m=p.shape0,g=p.shape1,v=m.collider,y=g.collider;if(v&&y){var T=v.isTrigger||y.isTrigger;null==this.contactsDic.getDataByKey(f)&&(T?this.triggerArrayMat.get(m.id,g.id)&&(slt.type="onTriggerExit",slt.selfCollider=v,slt.otherCollider=y,v.emit(slt.type,slt),slt.selfCollider=y,slt.otherCollider=v,y.emit(slt.type,slt),this.triggerArrayMat.set(m.id,g.id,!1),this.oldContactsDic.set(m.id,g.id,null),this._needSyncAfterEvents=!0):this.collisionArrayMat.get(m.id,g.id)&&(Pgt.push.apply(Pgt,alt.contacts),alt.contacts.length=0,alt.type="onCollisionExit",alt.selfCollider=v,alt.otherCollider=y,v.emit(alt.type,alt),alt.selfCollider=y,alt.otherCollider=v,y.emit(alt.type,alt),this.collisionArrayMat.set(m.id,g.id,!1),this.oldContactsDic.set(m.id,g.id,null),this._needSyncAfterEvents=!0))}}this.contactsDic.reset()},t.emitCCTTriggerEvent=function(){for(var t=this.cctContactsDic.getLength();t--;){var e=this.cctContactsDic.getKeyByIndex(t),i=this.cctContactsDic.getDataByKey(e),n=i.shape,r=i.cct;this.cctOldContactsDic.set(n.id,r.id,i);var s=n.collider,a=r.characterController;s&&a&&(s.isTrigger&&(this.triggerArrayMat.get(n.id,r.id)?olt.type="onControllerTriggerStay":(olt.type="onControllerTriggerEnter",this.triggerArrayMat.set(n.id,r.id,!0)),olt.impl=i.impl,olt.collider=s,olt.characterController=a,s.emit(olt.type,olt),olt.collider=s,olt.characterController=a,a.emit(olt.type,olt),this._needSyncAfterEvents=!0),null==this.cctOldContactsDic.get(n.id,r.id)&&this.cctOldContactsDic.set(n.id,r.id,i))}for(var o=this.cctOldContactsDic.getLength();o--;){var h=this.cctOldContactsDic.getKeyByIndex(o),u=this.cctOldContactsDic.getDataByKey(h),l=u.shape,c=u.cct,_=l.collider,d=c.characterController;if(_&&d){var f=_.isTrigger;null==this.cctContactsDic.getDataByKey(h)&&f&&this.triggerArrayMat.get(l.id,c.id)&&(olt.type="onControllerTriggerExit",olt.collider=_,olt.characterController=d,_.emit(olt.type,olt),olt.collider=_,olt.characterController=d,d.emit(olt.type,olt),this.triggerArrayMat.set(l.id,c.id,!1),this.cctOldContactsDic.set(l.id,c.id,null),this._needSyncAfterEvents=!0)}}this.cctContactsDic.reset()},t.emitCCTCollisionEvent=function(){for(var t=this.cctShapeEventDic.getLength();t--;){var e,i=this.cctShapeEventDic.getKeyByIndex(t),n=this.cctShapeEventDic.getDataByKey(i),r=n.BulletCharacterController,s=n.BulletShape,a=n.worldPos,o=n.worldNormal,h=n.motionDir,u=n.motionLength;kgt.controller=r.characterController,kgt.collider=s.collider,kgt.worldPosition.set(a.x,a.y,a.z),kgt.worldNormal.set(o.x,o.y,o.z),kgt.motionDirection.set(h.x,h.y,h.z),kgt.motionLength=u,null===(e=kgt.controller)||void 0===e||e.emit("onControllerColliderHit",kgt),this._needSyncAfterEvents=!0}this.cctShapeEventDic.reset()},t.gatherConatactData=function(){for(var t=nlt.Dispatcher_getNumManifolds(this._dispatcher),e=0;e0){if(this.collider.convex){var i=this._getBtTriangleMesh(e);this._impl=nlt.ConvexTriangleMeshShape_new(i)}else this.btBVHMeshShape=Vgt.getBulletBvhTriangleMeshShape(e.hash,e),this._impl=nlt.ScaledBvhTriangleMeshShape_new(this.btBVHMeshShape.bulletBvhTriangleMeshShapePtr,1,1,1);var n=hlt.instance.BT_V3_0;xlt(n,this._collider.node.worldScale),nlt.CollisionShape_setLocalScaling(this._impl,n),nlt.CollisionShape_setMargin(this._impl,.01),this.setCompound(this._compound),this.updateByReAdd(),this.setWrapper()}else this._impl=nlt.EmptyShape_static()}},i.onComponentSet=function(){this.setMesh(this.collider.mesh)},i.onDestroy=function(){this.collider.convex?this.refBtTriangleMesh&&nlt._safe_delete(this.refBtTriangleMesh,Jut.EBulletTypeTriangleMesh):this.btBVHMeshShape&&(this.btBVHMeshShape.reference=!1),t.prototype.onDestroy.call(this)},i.updateScale=function(){t.prototype.updateScale.call(this);var e=hlt.instance.BT_V3_0;xlt(e,this._collider.node.worldScale),nlt.CollisionShape_setLocalScaling(this._impl,e),this.updateCompoundTransform()},i._getBtTriangleMesh=function(t){return this.refBtTriangleMesh=nlt.TriangleMesh_new(),Mlt(this.refBtTriangleMesh,t),this.refBtTriangleMesh},n(e,[{key:"collider",get:function(){return this._collider}}]),e}(Igt),Ygt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.setHeight=function(){this.updateProperties(this.collider.radius,this.collider.height,this.collider.direction,this._collider.node.worldScale)},i.setDirection=function(){this.updateProperties(this.collider.radius,this.collider.height,this.collider.direction,this._collider.node.worldScale)},i.setRadius=function(){this.updateProperties(this.collider.radius,this.collider.height,this.collider.direction,this._collider.node.worldScale)},i.onComponentSet=function(){var t=hlt.instance.BT_V3_0;nlt.Vec3_set(t,.5,1,.5),this._impl=nlt.CylinderShape_new(t),this.setRadius(this.collider.radius)},i.updateScale=function(){t.prototype.updateScale.call(this),this.setRadius(this.collider.radius)},i.updateProperties=function(t,e,i,n){var r,s,a=n,o=i;1===o?(s=e*Math.abs(a.y),r=t*Math.abs(ji(a.x,a.z))):0===o?(s=e*Math.abs(a.x),r=t*Math.abs(ji(a.y,a.z))):(s=e*Math.abs(a.z),r=t*Math.abs(ji(a.x,a.y))),nlt.CylinderShape_updateProp(this._impl,r,s/2,o),this.updateCompoundTransform()},n(e,[{key:"collider",get:function(){return this._collider}}]),e}(Igt),Kgt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.setHeight=function(){this.updateProperties(this.collider.radius,this.collider.height,this.collider.direction,this._collider.node.worldScale)},i.setDirection=function(){this.updateProperties(this.collider.radius,this.collider.height,this.collider.direction,this._collider.node.worldScale)},i.setRadius=function(){this.updateProperties(this.collider.radius,this.collider.height,this.collider.direction,this._collider.node.worldScale)},i.onComponentSet=function(){this._impl=nlt.ConeShape_new(.5,1),this.setRadius(this.collider.radius)},i.updateScale=function(){t.prototype.updateScale.call(this),this.setRadius(this.collider.radius)},i.updateProperties=function(t,e,i,n){var r,s,a=n,o=i;1===o?(s=e*Math.abs(a.y),r=t*Math.abs(ji(a.x,a.z))):0===o?(s=e*Math.abs(a.x),r=t*Math.abs(ji(a.y,a.z))):(s=e*Math.abs(a.z),r=t*Math.abs(ji(a.x,a.y))),nlt.ConeShape_setRadius(this._impl,r),nlt.ConeShape_setHeight(this._impl,s),nlt.ConeShape_setConeUpIndex(this._impl,o);var h=hlt.instance.BT_V3_0;nlt.Vec3_set(h,1,1,1),nlt.CollisionShape_setLocalScaling(this._impl,h),this.updateCompoundTransform()},n(e,[{key:"impl",get:function(){return this._impl}},{key:"collider",get:function(){return this._collider}}]),e}(Igt),qgt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;ru&&(s=u),u>a&&(a=u),r+=4}a+=.01,s-=.01,this._localOffset.set((i-1)/2*this._tileSize,(a+s)/2,(n-1)/2*this._tileSize),this._impl=nlt.TerrainShape_new(i,n,this._bufPtr,1,s,a);var l=hlt.instance.BT_V3_0;nlt.Vec3_set(l,this._tileSize,1,this._tileSize),nlt.CollisionShape_setLocalScaling(this._impl,l),this.setCompound(this._compound),this.updateByReAdd(),this.setWrapper()}else this._impl=nlt.EmptyShape_static()}},i.onComponentSet=function(){this.setTerrain(this.collider.terrain)},i.onDestroy=function(){this._bufPtr&&nlt._free(this._bufPtr),t.prototype.onDestroy.call(this)},i.setCenter=function(t){hn.copy(ult,t),ult.add(this._localOffset),xlt(nlt.Transform_getOrigin(this.transform),ult),this.updateCompoundTransform()},n(e,[{key:"collider",get:function(){return this._collider}}]),e}(Igt),Qgt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.setShapeType=function(){},i.setVertices=function(){},i.onComponentSet=function(){this._impl=nlt.SimplexShape_new();for(var t=this.collider.shapeType,e=this.collider.vertices,i=hlt.instance.BT_V3_0,n=0;n=0){var t=this._rigidBody.body.sharedBody;t.wrappedWorld.removeConstraint(this),t.wrappedWorld.addConstraint(this)}},e.initialize=function(t){this._com=t,this._rigidBody=t.attachedBody,this._connectedBody=t.connectedBody,this._collided=t.enableCollision,this.onComponentSet(),this.setEnableCollision(this._collided)},e.updateDebugDrawSize=function(){if(this.impl){var t=tct.instance.physicsWorld.debugDrawConstraintSize;nlt.TypedConstraint_setDbgDrawSize(this.impl,t)}},e.onEnable=function(){var t=this._rigidBody.body.sharedBody;t.wrappedWorld.addConstraint(this),t.addJoint(this,0);var e=this._connectedBody;e&&e.body.sharedBody.addJoint(this,1)},e.onDisable=function(){var t=this._rigidBody.body.sharedBody;t.wrappedWorld.removeConstraint(this),t.removeJoint(this,0);var e=this._connectedBody;e&&e.body.sharedBody.removeJoint(this,1)},e.onDestroy=function(){nlt._safe_delete(this._impl,Jut.EBulletTypeTypedConstraint),this._com=null,this._rigidBody=null,this._connectedBody=null},n(t,[{key:"impl",get:function(){return this._impl}},{key:"constraint",get:function(){return this._com}}]),t}(),$gt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.setPivotA=function(){var t=this.constraint,e=hlt.instance.BT_V3_0;hn.multiply(ult,t.node.worldScale,t.pivotA),xlt(e,ult),nlt.P2PConstraint_setPivotA(this._impl,e),t.connectedBody||this.setPivotB(t.pivotB)},i.setPivotB=function(){var t=this.constraint,e=this._rigidBody.node,i=hlt.instance.BT_V3_0,n=t.connectedBody;n?(hn.multiply(ult,n.node.worldScale,t.pivotB),xlt(i,ult)):(hn.multiply(ult,e.worldScale,t.pivotA),hn.transformQuat(ult,ult,e.worldRotation),hn.add(ult,ult,e.worldPosition),xlt(i,ult)),nlt.P2PConstraint_setPivotB(this._impl,i)},i.onComponentSet=function(){var t=this.constraint.connectedBody,e=this._rigidBody.body.impl,i=t?t.body.impl:nlt.TypedConstraint_getFixedBody(),n=hlt.instance.BT_V3_0,r=hlt.instance.BT_V3_1;this._impl=nlt.P2PConstraint_new(e,i,n,r),this.setPivotA(this.constraint.pivotA),this.setPivotB(this.constraint.pivotB),this.updateDebugDrawSize()},i.updateScale0=function(){this.setPivotA(this.constraint.pivotA)},i.updateScale1=function(){this.setPivotB(this.constraint.pivotB)},n(e,[{key:"constraint",get:function(){return this._com}}]),e}(Jgt),tvt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.setBreakForce=function(t){nlt.TypedConstraint_setMaxImpulseThreshold(this._impl,t)},i.setBreakTorque=function(){},i.onComponentSet=function(){var t=this.constraint.connectedBody,e=this._rigidBody.body.impl,i=t?t.body.impl:nlt.TypedConstraint_getFixedBody(),n=hlt.instance.BT_TRANSFORM_0,r=hlt.instance.BT_TRANSFORM_1;this._impl=nlt.FixedConstraint_new(e,i,n,r),this.setBreakForce(this.constraint.breakForce),this.setBreakTorque(this.constraint.breakTorque),this.updateFrames(),this.updateDebugDrawSize()},i.updateFrames=function(){var t=this.constraint.connectedBody,e=this._rigidBody.body.sharedBody,i=ult,n=_lt,r=hlt.instance.BT_TRANSFORM_0,s=hlt.instance.BT_TRANSFORM_1,a=hlt.instance.BT_QUAT_0,o=flt;if(Dn.fromRT(o,e.node.worldRotation,e.node.worldPosition),Dn.invert(o,o),Dn.getRotation(n,o),Dn.getTranslation(i,o),xlt(nlt.Transform_getOrigin(r),i),Olt(a,n),nlt.Transform_setRotation(r,a),t){var h=t.body.sharedBody;Dn.fromRT(o,h.node.worldRotation,h.node.worldPosition),Dn.invert(o,o),Dn.getRotation(n,o),Dn.getTranslation(i,o),xlt(nlt.Transform_getOrigin(s),i),Olt(a,n),nlt.Transform_setRotation(s,a)}else nlt.Transform_setIdentity(s);nlt.FixedConstraint_setFrames(this._impl,r,s)},i.updateScale0=function(){this.updateFrames()},i.updateScale1=function(){this.updateFrames()},n(e,[{key:"constraint",get:function(){return this._com}}]),e}(Jgt),evt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.setPivotA=function(){this.updateFrames()},i.setPivotB=function(){this.updateFrames()},i.setAxis=function(){this.updateFrames()},i.setLimitEnabled=function(){this.constraint.limitEnabled?nlt.HingeConstraint_setLimit(this._impl,Mi(this.constraint.lowerLimit),Mi(this.constraint.upperLimit),.9,.3,1):nlt.HingeConstraint_setLimit(this._impl,1,0,.9,.3,1)},i.setLowerLimit=function(){this.constraint.limitEnabled&&nlt.HingeConstraint_setLimit(this._impl,Mi(this.constraint.lowerLimit),Mi(this.constraint.upperLimit),.9,.3,1)},i.setUpperLimit=function(){this.constraint.limitEnabled&&nlt.HingeConstraint_setLimit(this._impl,Mi(this.constraint.lowerLimit),Mi(this.constraint.upperLimit),.9,.3,1)},i.setMotorEnabled=function(t){nlt.HingeConstraint_enableMotor(this._impl,t);var e=-this.constraint.motorVelocity/60,i=Plt(this.constraint.motorForceLimit,tct.instance.fixedTimeStep);nlt.HingeConstraint_setMotorVelocity(this._impl,e),nlt.HingeConstraint_setMaxMotorImpulse(this._impl,i)},i.setMotorVelocity=function(t){if(this.constraint.motorEnabled){var e=-t/60;nlt.HingeConstraint_setMotorVelocity(this._impl,e)}},i.setMotorForceLimit=function(t){if(this.constraint.motorEnabled){var e=Plt(t,tct.instance.fixedTimeStep);nlt.HingeConstraint_setMaxMotorImpulse(this._impl,e)}},i.onComponentSet=function(){var t=this.constraint.connectedBody,e=this._rigidBody.body.impl,i=t?t.body.impl:nlt.TypedConstraint_getFixedBody(),n=hlt.instance.BT_TRANSFORM_0,r=hlt.instance.BT_TRANSFORM_1;this._impl=nlt.HingeConstraint_new(e,i,n,r),this.setLimitEnabled(this.constraint.limitEnabled),this.setLowerLimit(this.constraint.lowerLimit),this.setUpperLimit(this.constraint.upperLimit),this.setMotorEnabled(this.constraint.motorEnabled),this.setMotorVelocity(this.constraint.motorVelocity),this.setMotorForceLimit(this.constraint.motorForceLimit),this.updateFrames(),this.updateDebugDrawSize()},i.updateFrames=function(){var t=this.constraint,e=t.node,i=ult,n=_lt,r=dlt,s=hlt.instance.BT_TRANSFORM_0;hn.multiply(i,e.worldScale,t.pivotA),xlt(nlt.Transform_getOrigin(s),i);var a=hlt.instance.BT_QUAT_0;hn.normalize(i,t.axis),En.rotationTo(r,hn.UNIT_Z,i),Olt(a,r),nlt.Transform_setRotation(s,a);var o=hlt.instance.BT_TRANSFORM_1,h=this.constraint.connectedBody;h?(hn.multiply(i,h.node.worldScale,t.pivotB),En.multiply(r,e.worldRotation,r),En.invert(n,h.node.worldRotation),En.multiply(r,n,r)):(hn.multiply(i,e.worldScale,t.pivotA),hn.transformQuat(i,i,e.worldRotation),hn.add(i,i,e.worldPosition),En.multiply(r,e.worldRotation,r)),xlt(nlt.Transform_getOrigin(o),i),Olt(a,r),nlt.Transform_setRotation(o,a),nlt.HingeConstraint_setFrames(this._impl,s,o)},i.updateScale0=function(){this.updateFrames()},i.updateScale1=function(){this.updateFrames()},n(e,[{key:"constraint",get:function(){return this._com}}]),e}(Jgt);!function(t){t[t.RO_XYZ=0]="RO_XYZ",t[t.RO_XZY=1]="RO_XZY",t[t.RO_YXZ=2]="RO_YXZ",t[t.RO_YZX=3]="RO_YZX",t[t.RO_ZXY=4]="RO_ZXY",t[t.RO_ZYX=5]="RO_ZYX"}(Wgt||(Wgt={})),function(t){t[t.X=0]="X",t[t.Y=1]="Y",t[t.Z=2]="Z",t[t.TWIST=3]="TWIST",t[t.SWING1=4]="SWING1",t[t.SWING2=5]="SWING2"}(Xgt||(Xgt={}));var ivt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i._setLimit=function(t,e,i,n){switch(t){case cut.LOCKED:nlt.Generic6DofSpring2Constraint_setLimit(this._impl,e,0,0);break;case cut.LIMITED:nlt.Generic6DofSpring2Constraint_setLimit(this._impl,e,i,n);break;case cut.FREE:nlt.Generic6DofSpring2Constraint_setLimit(this._impl,e,1,0)}},i.setConstraintMode=function(t,e){var i=this.constraint.linearLimitSettings,n=this.constraint.angularLimitSettings,r=[0,0,0],s=[0,0,0],a=0,o=0;switch(t){case 0:case 1:case 2:hn.toArray(r,i.lower),hn.toArray(s,i.upper),o=r[t],a=s[t];break;case 3:o=-(a=.5*Mi(n.twistExtent));break;case 4:o=-(a=.5*Mi(n.swingExtent1));break;case 5:o=-(a=.5*Mi(n.swingExtent2));break;default:G("idx should be in [0, 5], but give "+t)}this._setLimit(e,t,o,a)},i.setLinearLimit=function(t,e,i){var n=0,r=this.constraint.linearLimitSettings;switch(t){case 0:n=r.xMotion;break;case 1:n=r.yMotion;break;case 2:n=r.zMotion}this._setLimit(n,t,e,i)},i.setAngularExtent=function(t,e,i){var n=this.constraint.angularLimitSettings;this._setLimit(n.twistMotion,Xgt.TWIST,.5*-Mi(t),.5*Mi(t)),this._setLimit(n.swingMotion1,Xgt.SWING1,.5*-Mi(e),.5*Mi(e)),this._setLimit(n.swingMotion2,Xgt.SWING2,.5*-Mi(i),.5*Mi(i))},i.setSwingSoftConstraint=function(t){nlt.Generic6DofSpring2Constraint_enableSpring(this._impl,Xgt.SWING1,t),nlt.Generic6DofSpring2Constraint_enableSpring(this._impl,Xgt.SWING2,t)},i.setTwistSoftConstraint=function(t){nlt.Generic6DofSpring2Constraint_enableSpring(this._impl,Xgt.TWIST,t)},i.setLinearSoftConstraint=function(t){nlt.Generic6DofSpring2Constraint_enableSpring(this._impl,Xgt.X,t),nlt.Generic6DofSpring2Constraint_enableSpring(this._impl,Xgt.Y,t),nlt.Generic6DofSpring2Constraint_enableSpring(this._impl,Xgt.Z,t)},i.setLinearStiffness=function(t){nlt.Generic6DofSpring2Constraint_setStiffness(this._impl,Xgt.X,t),nlt.Generic6DofSpring2Constraint_setStiffness(this._impl,Xgt.Y,t),nlt.Generic6DofSpring2Constraint_setStiffness(this._impl,Xgt.Z,t)},i.setLinearDamping=function(t){nlt.Generic6DofSpring2Constraint_setDamping(this._impl,Xgt.X,t),nlt.Generic6DofSpring2Constraint_setDamping(this._impl,Xgt.Y,t),nlt.Generic6DofSpring2Constraint_setDamping(this._impl,Xgt.Z,t)},i.setLinearRestitution=function(t){nlt.Generic6DofSpring2Constraint_setBounce(this._impl,Xgt.X,t),nlt.Generic6DofSpring2Constraint_setBounce(this._impl,Xgt.Y,t),nlt.Generic6DofSpring2Constraint_setBounce(this._impl,Xgt.Z,t)},i.setSwingStiffness=function(t){nlt.Generic6DofSpring2Constraint_setStiffness(this._impl,Xgt.SWING1,t),nlt.Generic6DofSpring2Constraint_setStiffness(this._impl,Xgt.SWING2,t)},i.setSwingDamping=function(t){nlt.Generic6DofSpring2Constraint_setDamping(this._impl,Xgt.SWING1,t),nlt.Generic6DofSpring2Constraint_setDamping(this._impl,Xgt.SWING2,t)},i.setSwingRestitution=function(t){nlt.Generic6DofSpring2Constraint_setBounce(this._impl,Xgt.SWING1,t),nlt.Generic6DofSpring2Constraint_setBounce(this._impl,Xgt.SWING2,t)},i.setTwistStiffness=function(t){nlt.Generic6DofSpring2Constraint_setStiffness(this._impl,Xgt.TWIST,t)},i.setTwistDamping=function(t){nlt.Generic6DofSpring2Constraint_setDamping(this._impl,Xgt.TWIST,t)},i.setTwistRestitution=function(t){nlt.Generic6DofSpring2Constraint_setBounce(this._impl,Xgt.TWIST,t)},i.setDriverMode=function(t,e){e===_ut.DISABLED?nlt.Generic6DofSpring2Constraint_enableMotor(this._impl,t,!1):e===_ut.SERVO?(nlt.Generic6DofSpring2Constraint_enableMotor(this._impl,t,!0),nlt.Generic6DofSpring2Constraint_setServo(this._impl,t,!0)):e===_ut.INDUCTION&&(nlt.Generic6DofSpring2Constraint_enableMotor(this._impl,t,!0),nlt.Generic6DofSpring2Constraint_setServo(this._impl,t,!1))},i._updateMotorTargetAndVelocity=function(t){var e=_ut.DISABLED,i=0,n=0,r=0,s=this.constraint.linearDriverSettings,a=this.constraint.angularDriverSettings;switch(t){case 0:i=Xgt.X,e=s.xDrive,n=s.targetPosition.x,r=-s.targetVelocity.x;break;case 1:i=Xgt.Y,e=s.yDrive,n=s.targetPosition.y,r=-s.targetVelocity.y;break;case 2:i=Xgt.Z,e=s.zDrive,n=s.targetPosition.z,r=-s.targetVelocity.z;break;case 3:i=Xgt.TWIST,e=a.twistDrive,n=-Mi(a.targetOrientation.x),r=-Mi(a.targetVelocity.x);break;case 4:i=Xgt.SWING1,e=a.swingDrive1,n=-Mi(a.targetOrientation.y),r=-Mi(a.targetVelocity.y);break;case 5:i=Xgt.SWING2,e=a.swingDrive2,n=-Mi(a.targetOrientation.z),r=-Mi(a.targetVelocity.z)}var o=t>2?a.strength:s.strength;nlt.Generic6DofSpring2Constraint_setServoTarget(this._impl,i,n),e===_ut.SERVO?t>2?nlt.Generic6DofSpring2Constraint_setTargetVelocity(this._impl,i,-n*o*.1):nlt.Generic6DofSpring2Constraint_setTargetVelocity(this._impl,i,n*o*.1):e===_ut.INDUCTION&&nlt.Generic6DofSpring2Constraint_setTargetVelocity(this._impl,i,r)},i.setLinearMotorTarget=function(){this._updateMotorTargetAndVelocity(0),this._updateMotorTargetAndVelocity(1),this._updateMotorTargetAndVelocity(2)},i.setLinearMotorVelocity=function(){this._updateMotorTargetAndVelocity(0),this._updateMotorTargetAndVelocity(1),this._updateMotorTargetAndVelocity(2)},i.setLinearMotorForceLimit=function(t){nlt.Generic6DofSpring2Constraint_setMaxMotorForce(this._impl,Xgt.X,t),nlt.Generic6DofSpring2Constraint_setMaxMotorForce(this._impl,Xgt.Y,t),nlt.Generic6DofSpring2Constraint_setMaxMotorForce(this._impl,Xgt.Z,t)},i.setAngularMotorTarget=function(){this._updateMotorTargetAndVelocity(3),this._updateMotorTargetAndVelocity(4),this._updateMotorTargetAndVelocity(5)},i.setAngularMotorVelocity=function(){this._updateMotorTargetAndVelocity(3),this._updateMotorTargetAndVelocity(4),this._updateMotorTargetAndVelocity(5)},i.setAngularMotorForceLimit=function(t){nlt.Generic6DofSpring2Constraint_setMaxMotorForce(this._impl,Xgt.TWIST,t),nlt.Generic6DofSpring2Constraint_setMaxMotorForce(this._impl,Xgt.SWING1,t),nlt.Generic6DofSpring2Constraint_setMaxMotorForce(this._impl,Xgt.SWING2,t)},i.setPivotA=function(){this.updateFrames()},i.setPivotB=function(){this.updateFrames()},i.setAutoPivotB=function(){this.updateFrames()},i.setAxis=function(){this.updateFrames()},i.setSecondaryAxis=function(){this.updateFrames()},i.setBreakForce=function(){var t=Plt(Math.max(this.constraint.breakForce,this.constraint.breakTorque),tct.instance.fixedTimeStep);nlt.TypedConstraint_setMaxImpulseThreshold(this._impl,t)},i.setBreakTorque=function(){var t=Plt(Math.max(this.constraint.breakForce,this.constraint.breakTorque),tct.instance.fixedTimeStep);nlt.TypedConstraint_setMaxImpulseThreshold(this._impl,t)},i.onComponentSet=function(){var t=this.constraint.connectedBody,e=this._rigidBody.body.impl,i=t&&t.body.impl||nlt.TypedConstraint_getFixedBody(),n=hlt.instance.BT_TRANSFORM_0,r=hlt.instance.BT_TRANSFORM_1;this._impl=nlt.Generic6DofSpring2Constraint_new(e,i,n,r,Wgt.RO_YZX);var s=this.constraint.linearLimitSettings,a=this.constraint.angularLimitSettings;this.setConstraintMode(0,s.xMotion),this.setConstraintMode(1,s.yMotion),this.setConstraintMode(2,s.zMotion),this.setConstraintMode(3,a.twistMotion),this.setConstraintMode(4,a.swingMotion1),this.setConstraintMode(5,a.swingMotion2),this.setLinearSoftConstraint(s.enableSoftConstraint),this.setLinearStiffness(s.stiffness),this.setLinearDamping(s.damping),this.setLinearRestitution(s.restitution),this.setSwingSoftConstraint(a.enableSoftConstraintSwing),this.setSwingRestitution(a.swingRestitution),this.setSwingStiffness(a.swingStiffness),this.setSwingDamping(a.swingDamping),this.setTwistSoftConstraint(a.enableSoftConstraintTwist),this.setTwistRestitution(a.twistRestitution),this.setTwistStiffness(a.twistStiffness),this.setTwistDamping(a.twistDamping);var o=this.constraint.linearDriverSettings,h=this.constraint.angularDriverSettings;this.setDriverMode(0,o.xDrive),this.setDriverMode(1,o.yDrive),this.setDriverMode(2,o.zDrive),this.setDriverMode(3,h.twistDrive),this.setDriverMode(4,h.swingDrive1),this.setDriverMode(5,h.swingDrive2),this.setLinearMotorTarget(o.targetPosition),this.setLinearMotorVelocity(o.targetVelocity),this.setLinearMotorForceLimit(o.strength),this.setAngularMotorTarget(h.targetOrientation),this.setAngularMotorVelocity(h.targetVelocity),this.setAngularMotorForceLimit(h.strength),this.setBreakForce(this.constraint.breakForce),this.setBreakTorque(this.constraint.breakTorque),this.updateFrames(),this.updateDebugDrawSize()},i.updateFrames=function(){var t=this.constraint,e=t.node,i=ult,n=_lt,r=dlt,s=hlt.instance.BT_TRANSFORM_0;hn.multiply(i,e.worldScale,t.pivotA),xlt(nlt.Transform_getOrigin(s),i);var a=hlt.instance.BT_QUAT_0,o=t.axis,h=t.secondaryAxis,u=hn.cross(llt,o,h);Dn.set(flt,o.x,o.y,o.z,0,h.x,h.y,h.z,0,u.x,u.y,u.z,0,0,0,0,1).getRotation(n),Olt(a,n),nlt.Transform_setRotation(s,a);var l=hlt.instance.BT_TRANSFORM_1,c=this.constraint.connectedBody;c?(En.multiply(n,e.worldRotation,n),En.invert(r,c.node.worldRotation),En.multiply(n,r,n),t.autoPivotB?(hn.multiply(i,t.node.worldScale,t.pivotA),hn.transformQuat(i,i,e.worldRotation),hn.add(i,i,t.node.worldPosition),hn.subtract(i,i,c.node.worldPosition),hn.transformQuat(i,i,r)):hn.multiply(i,c.node.worldScale,t.pivotB)):(hn.multiply(i,e.worldScale,t.pivotA),hn.transformQuat(i,i,e.worldRotation),hn.add(i,i,e.worldPosition),En.multiply(n,e.worldRotation,n)),xlt(nlt.Transform_getOrigin(l),i),Olt(a,n),nlt.Transform_setRotation(l,a),nlt.Generic6DofSpring2Constraint_setFrames(this._impl,s,l)},i.updateScale0=function(){this.updateFrames()},i.updateScale1=function(){this.updateFrames()},n(e,[{key:"constraint",get:function(){return this._com}}]),e}(Jgt),nvt=new hn(0,0,0),rvt=new hn(0,0,0);new hn(0,0,0);var svt=function(){function t(){this.wrappedWorld=void 0,this._isEnabled=!1,this._impl=0,this._comp=null,this._btCollisionFlags=0,this._word3=0,this._dirty=!1,this._collisionFilterGroup=fut.DEFAULT,this._collisionFilterMask=-1,this.id=t.idCounter++,this.wrappedWorld=tct.instance.physicsWorld}var e=t.prototype;return e.onComponentSet=function(){},e.updateScale=function(){},e.initialize=function(t){this._comp=t;var e=this._comp.group,i=tct.instance.collisionMatrix[e];return this._collisionFilterGroup=e,this._collisionFilterMask=i,this.onComponentSet(),0!==this._impl||(G("[Physics]: Initialize BulletCharacterController failed"),!1)},e.setWrapper=function(){hlt.setWrapper(this._impl,rlt.CCT_CACHE_NAME,this);var t=nlt.CharacterController_getCollisionShape(this.impl);hlt.setWrapper(t,rlt.CCT_CACHE_NAME,this)},e.onEnable=function(){this._isEnabled=!0,this._impl||this.onComponentSet(),this.setDetectCollisions(!1),this.setOverlapRecovery(!0),tct.instance.physicsWorld.addCCT(this),this.setWrapper()},e.onDisable=function(){this._isEnabled=!1,this.wrappedWorld.removeCCT(this),this.onDestroy()},e.onDestroy=function(){nlt._safe_delete(this._impl,Jut.EBulletTypeCharacterController),hlt.delWrapper(this._impl,rlt.CCT_CACHE_NAME),this._impl=0},e.onLoad=function(){},e.getPosition=function(t){this._impl&&Ilt(t,nlt.CharacterController_getPosition(this.impl))},e.setPosition=function(t){this._impl&&(xlt(nlt.CharacterController_getPosition(this.impl),t),this.syncPhysicsToScene())},e.setContactOffset=function(t){this._impl&&nlt.CharacterController_setContactOffset(this._impl,t)},e.setStepOffset=function(t){this._impl&&nlt.CharacterController_setStepOffset(this._impl,t)},e.setSlopeLimit=function(t){this._impl&&nlt.CharacterController_setSlopeLimit(this._impl,Ue(t))},e.setDetectCollisions=function(t){this._impl&&nlt.CharacterController_setCollision(this.impl,t)},e.setOverlapRecovery=function(t){this._impl&&nlt.CharacterController_setOverlapRecovery(this.impl,t)},e.onGround=function(){return(4&this._btCollisionFlags)>0},e.syncSceneToPhysics=function(){var t=this.characterController.node;t.hasChangedFlags&&(t.hasChangedFlags&om.SCALE&&this.syncScale(),t.hasChangedFlags&om.POSITION&&(hn.add(nvt,t.worldPosition,this.scaledCenter),this.setPosition(nvt)))},e.syncPhysicsToScene=function(){this.getPosition(nvt),nvt.subtract(this.scaledCenter),this._comp.node.setWorldPosition(nvt)},e.syncScale=function(){this.updateScale()},e.move=function(t,e,i){if(this._isEnabled){var n=hlt.instance.BT_V3_0;nlt.Vec3_set(n,t.x,t.y,t.z),this._btCollisionFlags=nlt.CharacterController_move(this.impl,n,e,i)}},e.setGroup=function(t){t!==this._collisionFilterGroup&&(this._collisionFilterGroup=t,this._dirty=!0)},e.getGroup=function(){return this._collisionFilterGroup},e.addGroup=function(t){this._collisionFilterGroup|=t,this._dirty=!0},e.removeGroup=function(t){this._collisionFilterGroup&=~t,this._dirty=!0},e.setMask=function(t){t!==this._collisionFilterMask&&(this._collisionFilterMask=t,this._dirty=!0)},e.getMask=function(){return this._collisionFilterMask},e.addMask=function(t){this._collisionFilterMask|=t,this._dirty=!0},e.removeMask=function(t){this._collisionFilterMask&=~t,this._dirty=!0},e.updateEventListener=function(){this.wrappedWorld.updateNeedEmitCCTEvents(this.characterController.needCollisionEvent)},e.updateDirty=function(){this._dirty&&(tct.instance.physicsWorld.removeCCT(this),tct.instance.physicsWorld.addCCT(this),this._dirty=!1)},e.onShapeHitExt=function(t){var e=nlt.ControllerShapeHit_getHitShape(t),i=tct.instance.physicsWorld;i.cctShapeEventDic.get(this.impl,e);var n=new hn;Ilt(n,nlt.ControllerHit_getHitWorldPos(t));var r=new hn;Ilt(r,nlt.ControllerHit_getHitWorldNormal(t));var s=new hn;Ilt(s,nlt.ControllerHit_getHitMotionDir(t));var a=nlt.ControllerHit_getHitMotionLength(t),o=hlt.getWrapper(e,Igt.TYPE);o&&i.cctShapeEventDic.set(this.impl,e,{BulletCharacterController:this,BulletShape:o,worldPos:n,worldNormal:r,motionDir:s,motionLength:a})},n(t,[{key:"isEnabled",get:function(){return this._isEnabled}},{key:"impl",get:function(){return this._impl}},{key:"characterController",get:function(){return this._comp}},{key:"scaledCenter",get:function(){return hn.multiply(rvt,this._comp.center,this._comp.node.worldScale),rvt}}]),t}();svt.idCounter=0;var avt,ovt,hvt,uvt,lvt,cvt,_vt,dvt,fvt=new hn(0,0,0),pvt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.onComponentSet=function(){this.component.node.getWorldPosition(fvt),fvt.add(this.scaledCenter);var t=hlt.instance.BT_V3_0;nlt.Vec3_set(t,fvt.x,fvt.y,fvt.z);var e=hn.UNIT_Y,i=hlt.instance.BT_V3_1;nlt.Vec3_set(i,e.x,e.y,e.z);var n=nlt.ControllerHitReport.implement(Egt).$$.ptr,r=tct.instance.physicsWorld,s=nlt.CapsuleCharacterControllerDesc_new(Ue(this.component.slopeLimit),this.component.stepOffset,this.component.skinWidth,i,t,n,this.component.radius,this.component.height);this._impl=nlt.CapsuleCharacterController_new(r.impl,s,0),this.updateScale()},i.setRadius=function(){this.updateScale()},i.setHeight=function(){this.updateScale()},i.updateScale=function(){this.updateGeometry()},i.updateGeometry=function(){var t=this.component.node.worldScale,e=this.component.radius*ji(t.x,t.z),i=this.component.height*Math.abs(t.y);nlt.CapsuleCharacterController_setRadius(this.impl,e),nlt.CapsuleCharacterController_setHeight(this.impl,i),this._dirty=!0},n(e,[{key:"component",get:function(){return this._comp}}]),e}(svt),mvt=new hn(0,0,0),gvt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.onComponentSet=function(){this.component.node.getWorldPosition(mvt),mvt.add(this.scaledCenter);var t=hlt.instance.BT_V3_0;nlt.Vec3_set(t,mvt.x,mvt.y,mvt.z);var e=hn.UNIT_Y,i=hlt.instance.BT_V3_1;nlt.Vec3_set(i,e.x,e.y,e.z);var n=nlt.ControllerHitReport.implement(Egt).$$.ptr,r=tct.instance.physicsWorld,s=nlt.BoxCharacterControllerDesc_new(Ue(this.component.slopeLimit),this.component.stepOffset,this.component.skinWidth,i,t,n,this.component.halfHeight,this.component.halfSideExtent,this.component.halfForwardExtent);this._impl=nlt.BoxCharacterController_new(r.impl,s,0),this.updateScale()},i.setHalfHeight=function(){this.updateScale()},i.setHalfSideExtent=function(){this.updateScale()},i.setHalfForwardExtent=function(){this.updateScale()},i.updateScale=function(){this.updateGeometry()},i.updateGeometry=function(){var t=this.component.node.worldScale;nlt.BoxCharacterController_setHalfSideExtent(this.impl,this.component.halfSideExtent*t.x),nlt.BoxCharacterController_setHalfHeight(this.impl,this.component.halfHeight*t.y),nlt.BoxCharacterController_setHalfForwardExtent(this.impl,this.component.halfForwardExtent*t.z),this._dirty=!0},n(e,[{key:"component",get:function(){return this._comp}}]),e}(svt);AL.once(EL.EVENT_PRE_SUBSYSTEM_INIT,(function(){zut.register("bullet",{PhysicsWorld:Ugt,RigidBody:Sgt,BoxShape:Ggt,SphereShape:Hgt,CapsuleShape:zgt,TrimeshShape:jgt,CylinderShape:Ygt,ConeShape:Kgt,TerrainShape:qgt,SimplexShape:Qgt,PlaneShape:Zgt,PointToPointConstraint:$gt,HingeConstraint:evt,FixedConstraint:tvt,ConfigurableConstraint:ivt,BoxCharacterController:gvt,CapsuleCharacterController:pvt})})),function(t){t[t.BOX=0]="BOX",t[t.SPHERE=1]="SPHERE",t[t.CYLINDER=2]="CYLINDER",t[t.CONE=3]="CONE",t[t.CAPSULE=4]="CAPSULE",t[t.TORUS=5]="TORUS",t[t.PLANE=6]="PLANE",t[t.QUAD=7]="QUAD"}(dvt||(dvt={})),Se(dvt);var vvt=t("fA",(avt=qs("cc.Primitive"),ovt=xa(dvt),avt(((_vt=function(t){function e(e){var i;return void 0===e&&(e=dvt.BOX),(i=t.call(this)||this).type=lvt&&lvt(),i.info=cvt&&cvt(),i.type=e,i}return s(e,t),e.prototype.onLoaded=function(){aF(V$[dvt[this.type].toLowerCase()](this.info),this)},e}(QL)).PrimitiveType=dvt,lvt=Gs((uvt=_vt).prototype,"type",[ovt],(function(){return dvt.BOX})),cvt=Gs(uvt.prototype,"info",[ra],(function(){return{}})),hvt=uvt))||hvt));v.Primitive=vvt,v.primitives=V$;var yvt,Tvt,Svt=function(){function t(t,e,i){this._opts=void 0,this._total=0,this._value=0,this._averageValue=0,this._accumValue=0,this._accumSamples=0,this._id=t,this._opts=e,this._accumStart=i}var e=t.prototype;return e.sample=function(t){this._average(this._value,t)},e.human=function(){var t=this._opts,e=t.average,i=t.isInteger,n=e?this._averageValue:this._value;return i?Math.round(n):Math.round(100*n)/100},e.alarm=function(){return this._opts.below&&this._valuethis._opts.over},e._average=function(t,e){if(void 0===e&&(e=0),this._opts.average){this._accumValue+=t,++this._accumSamples;var i=e;i-this._accumStart>=this._opts.average&&(this._averageValue=this._accumValue/this._accumSamples,this._accumValue=0,this._accumStart=i,this._accumSamples=0)}},n(t,[{key:"value",get:function(){return this._value},set:function(t){this._value=t}}]),t}(),Evt=qs("cc.PerfCounter")(yvt=function(t){function e(e,i,n){var r;return(r=t.call(this,e,i,n)||this)._time=n,r}s(e,t);var i=e.prototype;return i.start=function(t){void 0===t&&(t=0),this._time=t},i.end=function(t){void 0===t&&(t=0),this._value=t-this._time,this._average(this._value)},i.tick=function(){this.end(),this.start()},i.frame=function(t){var e=t,i=e-this._time;this._total++,i>(this._opts.average||1e3)&&(this._value=1e3*this._total/i,this._total=0,this._time=e,this._average(this._value))},e}(Svt))||yvt,Avt="0123456789. ",Rvt=500,bvt={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,".":10},Cvt={fps:{desc:"Framerate (FPS)",below:30,average:Rvt,isInteger:!0},draws:{desc:"Draw call",isInteger:!0},frame:{desc:"Frame time (ms)",min:0,max:50,average:Rvt},instances:{desc:"Instance Count",isInteger:!0},tricount:{desc:"Triangle",isInteger:!0},logic:{desc:"Game Logic (ms)",min:0,max:50,average:Rvt,color:"#080"},physics:{desc:"Physics (ms)",min:0,max:50,average:Rvt},render:{desc:"Renderer (ms)",min:0,max:50,average:Rvt,color:"#f90"},present:{desc:"Present (ms)",min:0,max:50,average:Rvt,color:"#f90"},textureMemory:{desc:"GFX Texture Mem(M)"},bufferMemory:{desc:"GFX Buffer Mem(M)"}},wvt=t("fB",function(t){function e(){var e;return(e=t.call(this)||this)._profilerStats=null,e._showFPS=!1,e._rootNode=null,e._device=null,e._swapchain=null,e._meshRenderer=null,e._canvas=null,e._ctx=null,e._texture=null,e._region=new Vc,e._canvasArr=[],e._regionArr=[e._region],e.digitsData=null,e.offsetData=null,e.pass=null,e._canvasDone=!1,e._statsDone=!1,e._inited=!1,e._lineHeight=280/(Object.keys(Cvt).length+1),e._wordHeight=0,e._eachNumWidth=0,e._totalLines=0,e.lastTime=0,e._canvas=T.document.createElement("canvas"),e._ctx=e._canvas.getContext("2d"),e._canvasArr.push(e._canvas),e}s(e,t);var i=e.prototype;return i.init=function(){be.querySettings(Re.Category.PROFILING,"showFPS")?this.showStats():this.hideStats()},i.isShowingStats=function(){return this._showFPS},i.hideStats=function(){this._showFPS&&(this._rootNode&&(this._rootNode.active=!1),v.director.off(v.Director.EVENT_BEFORE_UPDATE,this.beforeUpdate,this),v.director.off(v.Director.EVENT_AFTER_UPDATE,this.afterUpdate,this),v.director.off(v.Director.EVENT_BEFORE_PHYSICS,this.beforePhysics,this),v.director.off(v.Director.EVENT_AFTER_PHYSICS,this.afterPhysics,this),v.director.off(v.Director.EVENT_BEFORE_DRAW,this.beforeDraw,this),v.director.off(v.Director.EVENT_AFTER_RENDER,this.afterRender,this),v.director.off(v.Director.EVENT_AFTER_DRAW,this.afterPresent,this),this._showFPS=!1,gL.root.pipeline.profiler=null,v.game.config.showFPS=!1)},i.showStats=function(){if(!this._showFPS){if(!this._device){var t=v.director.root;this._device=wd.gfxDevice,this._swapchain=t.mainWindow.swapchain}this.generateCanvas(),this.generateStats(),v.game.once(v.Game.EVENT_ENGINE_INITED,this.generateNode,this),v.game.on(v.Game.EVENT_RESTART,this.generateNode,this),this._rootNode&&(this._rootNode.active=!0),v.director.on(v.Director.EVENT_BEFORE_UPDATE,this.beforeUpdate,this),v.director.on(v.Director.EVENT_AFTER_UPDATE,this.afterUpdate,this),v.director.on(v.Director.EVENT_BEFORE_PHYSICS,this.beforePhysics,this),v.director.on(v.Director.EVENT_AFTER_PHYSICS,this.afterPhysics,this),v.director.on(v.Director.EVENT_BEFORE_DRAW,this.beforeDraw,this),v.director.on(v.Director.EVENT_AFTER_RENDER,this.afterRender,this),v.director.on(v.Director.EVENT_AFTER_DRAW,this.afterPresent,this),this._showFPS=!0,this._canvasDone=!0,this._statsDone=!0,v.game.config.showFPS=!0}},i.generateCanvas=function(){if(!this._canvasDone){this._ctx&&this._canvas&&(this._canvas.width=280,this._canvas.height=280,this._canvas.style.width=""+this._canvas.width,this._canvas.style.height=""+this._canvas.height,this._ctx.font="23px Arial",this._ctx.textBaseline="top",this._ctx.fillStyle="#fff",this._texture=this._device.createTexture(new t_($l.TEX2D,tc.SAMPLED|tc.TRANSFER_DST,jl.RGBA8,280,280)),this._region.texExtent.width=280,this._region.texExtent.height=280)}},i.generateStats=function(){if(!this._statsDone&&this._ctx&&this._canvas){this._profilerStats=null;var t=performance.now();this._ctx.textAlign="left";var e=0;for(var i in Cvt){var n=Cvt[i];this._ctx.fillText(n.desc,0,e*this._lineHeight),n.counter=new Evt(i,n,t),e++}this._totalLines=e,this._wordHeight=this._totalLines*this._lineHeight/this._canvas.height;for(var r=0;r=0;o--){var h=8*i+o,u=a[a.length-(8-o)],l=bvt[u];void 0===l&&(l=11),n[h]=l}i++}}}},n(e,[{key:"_stats",get:function(){return U("Profiler._stats is deprecated, please use Profiler.stats instead."),this._profilerStats}},{key:"stats",get:function(){return this._profilerStats}}]),e}(Lu)),xvt=t("fC",new wvt);gL.registerSystem("profiler",xvt,0),v.profiler=xvt,function(t){var e,i,n,r,s,a,o,h,u,l;(e=t.MixBlend||(t.MixBlend={}))[e.setup=0]="setup",e[e.first=1]="first",e[e.replace=2]="replace",e[e.add=3]="add",(i=t.MixDirection||(t.MixDirection={}))[i.mixIn=0]="mixIn",i[i.mixOut=1]="mixOut",(n=t.TimelineType||(t.TimelineType={}))[n.rotate=0]="rotate",n[n.translate=1]="translate",n[n.scale=2]="scale",n[n.shear=3]="shear",n[n.attachment=4]="attachment",n[n.color=5]="color",n[n.deform=6]="deform",n[n.event=7]="event",n[n.drawOrder=8]="drawOrder",n[n.ikConstraint=9]="ikConstraint",n[n.transformConstraint=10]="transformConstraint",n[n.pathConstraintPosition=11]="pathConstraintPosition",n[n.pathConstraintSpacing=12]="pathConstraintSpacing",n[n.pathConstraintMix=13]="pathConstraintMix",n[n.twoColor=14]="twoColor",function(t){t[t.start=0]="start",t[t.interrupt=1]="interrupt",t[t.end=2]="end",t[t.dispose=3]="dispose",t[t.complete=4]="complete",t[t.event=5]="event"}(t.EventType||(t.EventType={})),(r=t.BlendMode||(t.BlendMode={}))[r.Normal=0]="Normal",r[r.Additive=1]="Additive",r[r.Multiply=2]="Multiply",r[r.Screen=3]="Screen",(s=t.TransformMode||(t.TransformMode={}))[s.Normal=0]="Normal",s[s.OnlyTranslation=1]="OnlyTranslation",s[s.NoRotationOrReflection=2]="NoRotationOrReflection",s[s.NoScale=3]="NoScale",s[s.NoScaleOrReflection=4]="NoScaleOrReflection",(a=t.PositionMode||(t.PositionMode={}))[a.Fixed=0]="Fixed",a[a.Percent=1]="Percent",(o=t.SpacingMode||(t.SpacingMode={}))[o.Length=0]="Length",o[o.Fixed=1]="Fixed",o[o.Percent=2]="Percent",(h=t.RotateMode||(t.RotateMode={}))[h.Tangent=0]="Tangent",h[h.Chain=1]="Chain",h[h.ChainScale=2]="ChainScale",(u=t.TextureFilter||(t.TextureFilter={}))[u.Nearest=9728]="Nearest",u[u.Linear=9729]="Linear",u[u.MipMap=9987]="MipMap",u[u.MipMapNearestNearest=9984]="MipMapNearestNearest",u[u.MipMapLinearNearest=9985]="MipMapLinearNearest",u[u.MipMapNearestLinear=9986]="MipMapNearestLinear",u[u.MipMapLinearLinear=9987]="MipMapLinearLinear",(l=t.TextureWrap||(t.TextureWrap={}))[l.MirroredRepeat=33648]="MirroredRepeat",l[l.ClampToEdge=33071]="ClampToEdge",l[l.Repeat=10497]="Repeat",function(t){t[t.Region=0]="Region",t[t.BoundingBox=1]="BoundingBox",t[t.Mesh=2]="Mesh",t[t.LinkedMesh=3]="LinkedMesh",t[t.Path=4]="Path",t[t.Point=5]="Point",t[t.Clipping=6]="Clipping"}(t.AttachmentType||(t.AttachmentType={}))}(Tvt||(Tvt={}));var Ivt=Tvt,Ovt=0,Dvt=0,Mvt=function(){function t(){this.start=void 0,this.interrupt=void 0,this.end=void 0,this.dispose=void 0,this.complete=void 0,this.event=void 0}return t.getListeners=function(e,i){if(!e.listener){e.listener=new t;var n=++Dvt;i.setTrackEntryListener(n,e),t._trackSet.set(n,e)}return e.listener},t.emitListener=function(e,i,n){var r=t._listenerSet.get(e);r&&r&&r(i,n)},t.emitTrackEntryListener=function(t,e,i,n){var r=this._trackSet.get(t);if(r)switch(n){case Ivt.EventType.start:r.listener.start&&r.listener.start(e);break;case Ivt.EventType.interrupt:r.listener.interrupt&&r.listener.interrupt(e);break;case Ivt.EventType.end:r.listener.end&&r.listener.end(e);break;case Ivt.EventType.dispose:r.listener.dispose&&r.listener.dispose(e),this._trackSet.delete(t),r.listener=null;break;case Ivt.EventType.complete:r.listener.complete&&r.listener.complete(e);break;case Ivt.EventType.event:r.listener.event&&r.listener.event(e,i);break;default:U("TrackEntry doesn't handled",n)}},t.addListener=function(e){var i=++Ovt;return t._listenerSet.set(i,e),i},t}();function Pvt(t,e){return t?e===t.length?t:e=this._maxFrameIdex&&(this.isCompleted=!0)}while(this.needToUpdate(t))},e.getFrame=function(t){var e=t%this._maxFrameIdex;return this.frames[e]},e.invalidAnimationFrames=function(){this._curIndex=-1,this._isCompleted=!1,this.frames.length=0},e.updateRenderData=function(t,e){var i=e.vCount,n=e.iCount,r=qvt/Float32Array.BYTES_PER_ELEMENT,s=new Uint8Array(Float32Array.BYTES_PER_ELEMENT*r*i),a=new Uint16Array(n),o=Ivt.wasmUtil.wasm.HEAPU8,h=e.vPtr,u=i*Float32Array.BYTES_PER_ELEMENT*r;s.set(o.subarray(h,h+u));var l=e.iPtr,c=Uint16Array.BYTES_PER_ELEMENT*n;new Uint8Array(a.buffer).set(o.subarray(l,l+c));var _=new Zvt;_.vCount=i,_.iCount=n,_.vData=s,_.iData=a;for(var d=e.getData(),f=d.size(),p=0;p0)return void this._sharedCacheMap.set(t,i);this._sharedCacheMap.delete(t)}}var n=this._privateMode?function(t,e){e.destroy()}:function(i,n){e._animationPool[t+"#"+i]=n,n.clear()},r=this._skeletonCache[t];if(r){var s=r.animationsCache;for(var a in s){var o=s[a];o&&n(a,o)}r.skeleton&&Ivt.wasmUtil.destroySpineSkeleton(r.skeleton),delete this._skeletonCache[t]}},e.createSkeletonInfo=function(t){var e=t.uuid,i=t.getRuntimeData();if(!this._privateMode){var n=this._sharedCacheMap.get(e);n?n+=1:n=1,this._sharedCacheMap.set(e,n)}if(this._skeletonCache[e])return this._skeletonCache[e];var r=new Ivt.Skeleton(i),s=new Mvt;return this._skeletonCache[e]={skeleton:r,clipper:null,state:null,listener:s,animationsCache:{},curAnimationCache:null,assetUUID:e}},e.getSkeletonInfo=function(t){var e=t.uuid;return this._skeletonCache[e]},e.getAnimationCache=function(t,e){var i=this._skeletonCache[t];return i?i.animationsCache[e]:null},e.initAnimationCache=function(t,e,i){var n=e.getRuntimeData();if(!n)return null;var r=this._skeletonCache[t];if(!r||!r.skeleton)return null;var s=r.animationsCache,a=s[i];if(!a){var o=t+"#"+i;(a=this._animationPool[o])?delete this._animationPool[o]:(a=new $vt(n))._privateMode=this._privateMode,a.init(r,i),s[i]=a}return a.init(r,i),a.setAnimation(i),a},e.destroyCachedAnimations=function(t){if(t){var e=this._animationPool;for(var i in e)i.includes(t)&&(e[i].destroy(),delete e[i])}else{var n=this._animationPool;for(var r in n)n[r].destroy(),delete n[r]}},t}();Nvt=tyt,tyt.FrameTime=kvt,tyt.sharedCache=new Nvt;var eyt=(Uvt=qs("sp.SkeletonData"),Gvt=xa([em]),Hvt=xa([Ze]),Uvt((Vvt=function(t){function e(){var e;return(e=t.call(this)||this)._skeletonJson=Wvt&&Wvt(),e.textures=Xvt&&Xvt(),e.textureNames=jvt&&jvt(),e.scale=Yvt&&Yvt(),e._atlasText=Kvt&&Kvt(),e._buffer=void 0,e._skeletonCache=null,e._skinsEnum=null,e._animsEnum=null,e.reset(),e}s(e,t);var i=e.prototype;return i.createNode=function(t){var e=new $m(this.name);return e.addComponent("cc.Skeleton").skeletonData=this,t(null,e)},i.reset=function(){this._skeletonCache=null},i.resetEnums=function(){},i.getRuntimeData=function(t){if(this._skeletonCache)return this._skeletonCache;if(!(this.textures&&this.textures.length>0)&&this.textureNames&&this.textureNames.length>0)return t||G(this.name+" no textures found!"),null;var e=Ivt.wasmUtil.querySpineSkeletonDataByUUID(this._uuid);if(e)this._skeletonCache=e;else if(this.skeletonJsonStr)this._skeletonCache=Ivt.wasmUtil.createSpineSkeletonDataWithJson(this.skeletonJsonStr,this._atlasText),Ivt.wasmUtil.registerSpineSkeletonDataWithUUID(this._skeletonCache,this._uuid);else{var i=new Uint8Array(this._nativeAsset),n=i.length,r=Ivt.wasmUtil.queryStoreMemory(n);Ivt.wasmUtil.wasm.HEAPU8.subarray(r,r+n).set(i),this._skeletonCache=Ivt.wasmUtil.createSpineSkeletonDataWithBinary(n,this._atlasText),Ivt.wasmUtil.registerSpineSkeletonDataWithUUID(this._skeletonCache,this._uuid)}return this._skeletonCache},i.getSkinsEnum=function(){if(this._skinsEnum)return this._skinsEnum;var t=this.getRuntimeData(!0);if(t){for(var e=t.skins,i={},n=0;n1)return this._animsEnum;var t=this.getRuntimeData(!0);if(t){for(var e={"":0},i=t.animations,n=0;n"]=0]=""}(Nyt||(Nyt={})),Se(Nyt),function(t){t[t.COLORED_TEXTURED=0]="COLORED_TEXTURED",t[t.TWO_COLORED=1]="TWO_COLORED"}(Lyt||(Lyt={}));var Gyt=(nyt=qs("sp.Skeleton.SpineSocket"),ryt=xa($m),nyt((ayt=function(t,e){void 0===t&&(t=""),void 0===e&&(e=null),this.path=oyt&&oyt(),this.target=hyt&&hyt(),this.path=t,this.target=e},oyt=Gs(ayt.prototype,"path",[ra],(function(){return""})),hyt=Gs(ayt.prototype,"target",[ryt,ra],(function(){return null})),syt=ayt))||syt);Jt(Gyt,"sp.Skeleton.SpineSocket");var Hyt=(uyt=qs("sp.Skeleton"),lyt=xa(eyt),cyt=xa(Byt),_yt=xa(Nyt),dyt=xa(Pyt),fyt=xa([Gyt]),pyt=xa(OS),uyt(((Myt=function(t){function e(){var e;return(e=t.call(this)||this)._skeletonData=vyt&&vyt(),e.defaultSkin=yyt&&yyt(),e.defaultAnimation=Tyt&&Tyt(),e._premultipliedAlpha=Syt&&Syt(),e._timeScale=Eyt&&Eyt(),e._preCacheMode=Ayt&&Ayt(),e._cacheMode=Ryt&&Ryt(),e._sockets=byt&&byt(),e._useTint=Cyt&&Cyt(),e._debugMesh=wyt&&wyt(),e._debugBones=xyt&&xyt(),e._debugSlots=Iyt&&Iyt(),e._enableBatch=Oyt&&Oyt(),e._runtimeData=null,e._skeleton=null,e._instance=null,e._state=null,e._textures=[],e._skeletonInfo=null,e._animationName="",e._skinName="",e._drawList=new Bu((function(){return{material:null,texture:null,indexOffset:0,indexCount:0}}),1),e._materialCache={},e.paused=!1,e._enumSkins=ve({}),e._enumAnimations=ve({}),e.attachUtil=void 0,e._socketNodes=new Map,e._cachedSockets=new Map,e._startEntry=void 0,e._endEntry=void 0,e._paused=!1,e._accTime=0,e._playCount=0,e._skeletonCache=null,e._animCache=null,e._animationQueue=[],e._headAniInfo=null,e._isAniComplete=!0,e._playTimes=0,e._curFrame=null,e._needUpdateSkeltonData=!0,e._listener=null,e._debugRenderer=null,e._startSlotIndex=void 0,e._endSlotIndex=void 0,e._slotTextures=null,e._vLength=0,e._vBuffer=null,e._iLength=0,e._iBuffer=null,e._model=void 0,e._tempColor={r:0,g:0,b:0,a:0},e.loop=Dyt&&Dyt(),e._useVertexOpacity=!0,e._startEntry={animation:{name:""},trackIndex:0},e._endEntry={animation:{name:""},trackIndex:0},e._startSlotIndex=-1,e._endSlotIndex=-1,e._instance=new Ivt.SkeletonInstance,e._instance.dtRate=1*e._timeScale,e._instance.isCache=e.isAnimationCached(),e.attachUtil=new kyt,e}s(e,t);var i=e.prototype;return i.__preload=function(){t.prototype.__preload.call(this),this._updateSkeletonData(),this._updateDebugDraw()},i.onRestore=function(){this.updateMaterial(),this.markForUpdateRenderData()},i.getState=function(){return this._state},i.onEnable=function(){t.prototype.onEnable.call(this),this._instance&&(this._instance.enable=!0),this._flushAssembler(),iyt.getInstance().add(this)},i.onDisable=function(){t.prototype.onDisable.call(this),this._instance&&(this._instance.enable=!1),iyt.getInstance().remove(this)},i.onDestroy=function(){var e;this._drawList.destroy(),this.destroyRenderData(),this._cleanMaterialCache(),this._vBuffer=null,this._iBuffer=null,this.attachUtil.reset(),null===(e=this._slotTextures)||void 0===e||e.clear(),this._slotTextures=null,this._cachedSockets.clear(),this._socketNodes.clear(),this._animCache=null,iyt.getInstance().remove(this),this._instance&&(this._instance.destroy(),this._instance=null),this._destroySkeletonInfo(this._skeletonCache),this._skeletonCache=null,t.prototype.onDestroy.call(this)},i.clearAnimation=function(t){this.isAnimationCached()||(this.clearTrack(t||0),this.setToSetupPose())},i.clearAnimations=function(){this.isAnimationCached()||(this.clearTracks(),this.setToSetupPose())},i._updateSkeletonData=function(){var t=this._skeletonData;if(!t)return this._runtimeData=null,this._state=null,this._skeleton=null,this._textures=[],void this._refreshInspector();this._instance&&(this._instance.dtRate=1*this._timeScale),this._needUpdateSkeltonData=!1,this._runtimeData=t.getRuntimeData(),this._runtimeData&&(this.setSkeletonData(this._runtimeData),this._textures=t.textures,this._refreshInspector(),this.defaultAnimation&&(this.animation=this.defaultAnimation.toString()),this.defaultSkin&&""!==this.defaultSkin&&this.setSkin(this.defaultSkin),this._updateUseTint(),this._indexBoneSockets(),this._updateSocketBindings(),this.attachUtil.init(this),this._preCacheMode=this._cacheMode)},i.setSkeletonData=function(t){var e=this._skeletonCache;if(this._cacheMode===Pyt.SHARED_CACHE?this._skeletonCache=tyt.sharedCache:this._cacheMode===Pyt.PRIVATE_CACHE?(this._skeletonCache=new tyt,this._skeletonCache.enablePrivateMode()):this._skeletonCache=null,e!==this._skeletonCache&&this._destroySkeletonInfo(e),this.isAnimationCached()){(this.debugBones||this.debugSlots)&&U("Debug bones or slots is invalid in cached mode");var i=this._skeletonCache.getSkeletonInfo(this._skeletonData);this._skeletonInfo!==i&&(this._destroySkeletonInfo(this._skeletonCache),this._skeletonInfo=this._skeletonCache.createSkeletonInfo(this._skeletonData),this._skeleton=this._skeletonInfo.skeleton)}else this._skeleton=this._instance.initSkeleton(t),this._state=this._instance.getAnimationState(),this._instance.setPremultipliedAlpha(this._premultipliedAlpha);this._flushAssembler()},i.setSlotsRange=function(t,e){this.isAnimationCached()?U("Slots visible range can not be modified in cached mode."):(this._startSlotIndex=t,this._endSlotIndex=e)},i.getAttachment=function(t,e){return this._skeleton?this._skeleton.getAttachmentByName(t,e):null},i.setAttachment=function(t,e){this._skeleton&&this._skeleton.setAttachment(t,e),this.invalidAnimationCache()},i.getTextureAtlas=function(t){return t.region},i.setAnimation=function(t,e,i){if("string"!=typeof e)return Y(7511),null;if(!this._skeleton.data.findAnimation(e))return Y(7509,e),null;var n=null;if(void 0===i&&(i=!0),this._playTimes=i?0:1,this.isAnimationCached()){if(0!==t&&U("Track index can not greater than 0 in cached mode."),!this._skeletonCache)return null;var r,s=this._skeletonCache.getAnimationCache(this._skeletonData.uuid,e);s||null===(r=s=this._skeletonCache.initAnimationCache(this.skeletonData.uuid,this._skeletonData,e))||void 0===r||r.setSkin(this._skinName),s&&(this._animationName=e,this._isAniComplete=!1,this._accTime=0,this._playCount=0,this._animCache=s,this._socketNodes.size>0&&this._animCache.enableCacheAttachedInfo(),this._animCache.updateToFrame(0),this._curFrame=this._animCache.frames[0])}else this._animationName=e,n=this._instance.setAnimation(t,e,i);return this.markForUpdateRenderData(),n},i.addAnimation=function(t,e,i,n){if(n=n||0,this.isAnimationCached())return 0!==t&&U("Track index can not greater than 0 in cached mode."),this._animationQueue.push({animationName:e,loop:i,delay:n}),null;if(this._skeleton){var r,s=this._skeleton.data.findAnimation(e);return s?null===(r=this._state)||void 0===r?void 0:r.addAnimationWith(t,s,i,n):(Y(7510,e),null)}return null},i.findAnimation=function(t){return this._skeleton?this._skeleton.data.findAnimation(t):null},i.getCurrent=function(t){if(this.isAnimationCached())U("'getCurrent' interface can not be invoked in cached mode.");else if(this._state)return this._state.getCurrent(t);return null},i.setSkin=function(t){this._skeleton&&this._skeleton.setSkinByName(t),this._instance.setSkin(t),this.isAnimationCached()&&this._animCache&&this._animCache.setSkin(t),this._skinName=t,this.invalidAnimationCache()},i.updateAnimation=function(t){if(this.markForUpdateRenderData(),!this.paused)if(t*=1*this._timeScale,this.isAnimationCached()){if(this._isAniComplete){var e;if(0===this._animationQueue.length&&!this._headAniInfo){var i=this._animCache;if(i&&i.isInvalid()){i.updateToFrame(0);var n=i.frames;this._curFrame=n[n.length-1]}return}if(this._headAniInfo||(this._headAniInfo=this._animationQueue.shift()),this._accTime+=t,this._accTime>(null===(e=this._headAniInfo)||void 0===e?void 0:e.delay)){var r=this._headAniInfo;this._headAniInfo=null,this.setAnimation(0,null==r?void 0:r.animationName,null==r?void 0:r.loop)}return}this._updateCache(t)}else this._instance.updateAnimation(t)},i._updateCache=function(t){var e=this._animCache;if(e.isInited()){var i=e.frames,n=tyt.FrameTime;0===this._accTime&&0===this._playCount&&(this._startEntry.animation.name=this._animationName,this._listener&&this._listener.start&&this._listener.start(this._startEntry)),this._accTime+=t;var r=Math.floor(this._accTime/n);if(e.isCompleted||e.updateToFrame(r),this._curFrame=i[r],void 0!==this._curFrame&&this.attachUtil.updateSkeletonBones(this._curFrame.boneInfos),e.isCompleted&&r>=i.length){if(this._playCount++,this._playTimes>0&&this._playCount>=this._playTimes)return this._curFrame=i[i.length-1],this._accTime=0,this._playCount=0,this._isAniComplete=!0,void this._emitCacheCompleteEvent();this._accTime=0,r=0,this._curFrame=i[r],this._emitCacheCompleteEvent()}}},i._emitCacheCompleteEvent=function(){this._listener&&(this._endEntry.animation.name=this._animationName,this._listener.complete&&this._listener.complete(this._endEntry),this._listener.end&&this._listener.end(this._endEntry))},i.updateRenderData=function(){return this.isAnimationCached()?this._curFrame?this._curFrame.model:null:this._instance.updateRenderData()},i._flushAssembler=function(){var t=e.Assembler.getAssembler(this);this._assembler!==t&&(this._assembler=t),this._skeleton&&this._assembler&&(this._renderData=this._assembler.createData(this),this.markForUpdateRenderData(),this._updateColor())},i._render=function(t){var e=0;if(this.renderData&&this._drawList.length>0){for(var i=this.renderData,n=i.chunk,r=n.vertexAccessor,s=i.getMeshBuffer(),a=s.indexOffset,o=0;o":e(t[i.parent.data.index])+"/"+i.data.name},i=0,n=t.length;i0?Array.from(this._cachedSockets.keys()).sort():[]):[]},i._updateUseTint=function(){this._cleanMaterialCache(),this.destroyRenderData(),this.isAnimationCached()||this._instance.setUseTint(this._useTint),this._assembler&&this._skeleton&&(this._renderData=this._assembler.createData(this),this.markForUpdateRenderData())},i._updateBatch=function(){this._cleanMaterialCache(),this.markForUpdateRenderData()},i._updateDebugDraw=function(){if(this.debugBones||this.debugSlots||this.debugMesh){if(!this._debugRenderer){var t=new $m("DEBUG_DRAW_NODE");t.hideFlags|=Wa.Flags.DontSave|Wa.Flags.HideInHierarchy;var e=t.addComponent(iz);e.lineWidth=1,e.strokeColor=new pn(255,0,0,255),this._debugRenderer=e,t.parent=this.node}this.isAnimationCached()?U("Debug bones or slots is invalid in cached mode"):this._instance.setDebugMode(!0)}else this._debugRenderer&&(this._debugRenderer.node.destroy(),this._debugRenderer=null,this.isAnimationCached()||this._instance&&this._instance.setDebugMode(!1))},i._updateUITransform=function(){var t=this.node._uiProps.uiTransformComp,e=this._runtimeData;if(!e)return t.setContentSize(100,100),t.anchorX=.5,void(t.anchorX=.5);var i=e.width,n=e.height;i&&n&&(t.setContentSize(i,n),0!==i&&(t.anchorX=Math.abs(e.x)/i),0!==n&&(t.anchorY=Math.abs(e.y)/n))},i._updateColor=function(){var t=this.node._uiProps.opacity;if(this._tempColor.r!==this._color.r||this._tempColor.g!==this.color.g||this._tempColor.b!==this.color.b||this._tempColor.a!==t){this.node._uiProps.colorDirty=!0,this._tempColor.r=this._color.r,this._tempColor.g=this._color.g,this._tempColor.b=this._color.b,this._tempColor.a=t;var e=this._color.r/255,i=this._color.g/255,n=this._color.b/255;this._instance.setColor(e,i,n,t)}},i.setVertexEffectDelegate=function(t){if(this._instance)if(t){var e=null==t?void 0:t.getEffectType();if("jitter"===e){var i=null==t?void 0:t.getJitterVertexEffect();this._instance.setJitterEffect(i)}else if("swirl"===e){var n=null==t?void 0:t.getJitterVertexEffect();this._instance.setSwirlEffect(n)}}else this._instance.clearEffect()},i._ensureListener=function(){this._listener||(this._listener=new Mvt)},i.setStartListener=function(t){this._ensureListener();var e=Mvt.addListener(t);this._instance.setListener(e,Ivt.EventType.start),this._listener.start=t},i.setInterruptListener=function(t){this._ensureListener();var e=Mvt.addListener(t);this._instance.setListener(e,Ivt.EventType.interrupt),this._listener.interrupt=t},i.setEndListener=function(t){this._ensureListener();var e=Mvt.addListener(t);this._instance.setListener(e,Ivt.EventType.end),this._listener.end=t},i.setDisposeListener=function(t){this._ensureListener();var e=Mvt.addListener(t);this._instance.setListener(e,Ivt.EventType.dispose),this._listener.dispose=t},i.setCompleteListener=function(t){this._ensureListener();var e=Mvt.addListener(t);this._instance.setListener(e,Ivt.EventType.complete),this._listener.complete=t},i.setEventListener=function(t){this._ensureListener();var e=Mvt.addListener(t);this._instance.setListener(e,Ivt.EventType.event),this._listener.event=t},i.setTrackStartListener=function(t,e){Mvt.getListeners(t,this._instance).start=e},i.setTrackInterruptListener=function(t,e){Mvt.getListeners(t,this._instance).interrupt=e},i.setTrackEndListener=function(t,e){Mvt.getListeners(t,this._instance).end=e},i.setTrackDisposeListener=function(t,e){Mvt.getListeners(t,this._instance).dispose=e},i.setTrackCompleteListener=function(t,e){Mvt.getListeners(t,this._instance).complete=function(t){var i=Math.floor(t.trackTime/t.animationEnd);Mvt.addListener(e),e(t,i)}},i.setTrackEventListener=function(t,e){Mvt.getListeners(t,this._instance).event=e},i.getDebugShapes=function(){return this._instance.getDebugShapes()},i.setSlotTexture=function(t,e,i){if(this.isAnimationCached())G("Cached mode can't change texture of slot");else if(this.findSlot(t)){var n=e.width,r=e.height,s=i||!1;this._instance.resizeSlotRegion(t,n,r,s),this._slotTextures||(this._slotTextures=new Map);var a=0;this._slotTextures.forEach((function(t,i){t===e&&(a=i)})),0===a&&(a=++Uyt,this._slotTextures.set(a,e)),this._instance.setSlotTexture(t,a)}else G("No slot named:"+t)},i._destroySkeletonInfo=function(t){t&&this._skeletonInfo&&(t.destroySkeleton(this._skeletonInfo.assetUUID),this._skeletonInfo=null)},n(e,[{key:"drawList",get:function(){return this._drawList}},{key:"skeletonData",get:function(){return this._skeletonData},set:function(t){t&&t.resetEnums(),this._skeletonData!==t&&(this.destroyRenderData(),this._skeletonData=t,this.defaultSkin="",this.defaultAnimation="",this._animationName="",this._skinName="",this._updateSkeletonData(),this._updateUITransform())}},{key:"_defaultSkinIndex",get:function(){if(this.skeletonData){var t=this.skeletonData.getSkinsEnum();if(t)if(""===this.defaultSkin){if(t.hasOwnProperty(0))return this._defaultSkinIndex=0,0}else{var e=t[this.defaultSkin];if(void 0!==e)return e}}return 0},set:function(t){var e;if(this.skeletonData&&(e=this.skeletonData.getSkinsEnum()),e){var i=e[t];void 0!==i?(this.defaultSkin=String(i),this.setSkin(this.defaultSkin),this._refreshInspector(),this.markForUpdateRenderData()):G(this.name+" skin enums are invalid")}else G(this.name+" skin enums are invalid")}},{key:"_animationIndex",get:function(){var t=this.animation;if(this.skeletonData)if(t){var e=this.skeletonData.getAnimsEnum();if(e){var i=e[t];if(void 0!==i)return i}}else this._refreshInspector();return 0},set:function(t){var e;if(this.skeletonData&&(e=this.skeletonData.getAnimsEnum()),e){var i=String(e[t]);void 0!==i?(this.animation=i,this.animation=i):G(this.name+" animation enums are invalid")}else G(this.name+" animation enums are invalid")}},{key:"defaultCacheMode",get:function(){return this._cacheMode},set:function(t){this._cacheMode=t,this.setAnimationCacheMode(this._cacheMode)}},{key:"premultipliedAlpha",get:function(){return this._premultipliedAlpha},set:function(t){t!==this._premultipliedAlpha&&(this._premultipliedAlpha=t,this._instance.setPremultipliedAlpha(t),this.markForUpdateRenderData())}},{key:"timeScale",get:function(){return this._timeScale},set:function(t){t!==this._timeScale&&(this._timeScale=t,this._instance&&(this._instance.dtRate=1*this._timeScale))}},{key:"useTint",get:function(){return this._useTint},set:function(t){t!==this._useTint&&(this._useTint=t,this._updateUseTint())}},{key:"enableBatch",get:function(){return this._enableBatch},set:function(t){t!==this._enableBatch&&(this._enableBatch=t,this._updateBatch())}},{key:"sockets",get:function(){return this._sockets},set:function(t){this._sockets=t,this._updateSocketBindings(),this.attachUtil.init(this)}},{key:"debugSlots",get:function(){return this._debugSlots},set:function(t){t!==this._debugSlots&&(this._debugSlots=t,this._updateDebugDraw(),this.markForUpdateRenderData())}},{key:"debugBones",get:function(){return this._debugBones},set:function(t){t!==this._debugBones&&(this._debugBones=t,this._updateDebugDraw(),this.markForUpdateRenderData())}},{key:"debugMesh",get:function(){return this._debugMesh},set:function(t){t!==this._debugMesh&&(this._debugMesh=t,this._updateDebugDraw(),this.markForUpdateRenderData())}},{key:"socketNodes",get:function(){return this._socketNodes}},{key:"animation",get:function(){return this._animationName},set:function(t){t?this.setAnimation(0,t,this.loop):this.clearAnimation(0)}},{key:"customMaterial",get:function(){return this._customMaterial},set:function(t){this._customMaterial=t,this.updateMaterial(),this.markForUpdateRenderData()}}]),e}(bU)).SpineSocket=Gyt,Myt.AnimationCacheMode=Pyt,vyt=Gs((gyt=Myt).prototype,"_skeletonData",[ra],(function(){return null})),yyt=Gs(gyt.prototype,"defaultSkin",[ra],(function(){return""})),Tyt=Gs(gyt.prototype,"defaultAnimation",[ra],(function(){return""})),Syt=Gs(gyt.prototype,"_premultipliedAlpha",[ra],(function(){return!0})),Eyt=Gs(gyt.prototype,"_timeScale",[ra],(function(){return 1})),Ayt=Gs(gyt.prototype,"_preCacheMode",[ra],(function(){return Pyt.UNSET})),Ryt=Gs(gyt.prototype,"_cacheMode",[ra],(function(){return Pyt.REALTIME})),byt=Gs(gyt.prototype,"_sockets",[ra],(function(){return[]})),Cyt=Gs(gyt.prototype,"_useTint",[ra],(function(){return!1})),wyt=Gs(gyt.prototype,"_debugMesh",[ra],(function(){return!1})),xyt=Gs(gyt.prototype,"_debugBones",[ra],(function(){return!1})),Iyt=Gs(gyt.prototype,"_debugSlots",[ra],(function(){return!1})),Oyt=Gs(gyt.prototype,"_enableBatch",[ra],(function(){return!1})),f(gyt.prototype,"skeletonData",[lyt],Object.getOwnPropertyDescriptor(gyt.prototype,"skeletonData"),gyt.prototype),f(gyt.prototype,"_defaultSkinIndex",[cyt],Object.getOwnPropertyDescriptor(gyt.prototype,"_defaultSkinIndex"),gyt.prototype),f(gyt.prototype,"_animationIndex",[_yt],Object.getOwnPropertyDescriptor(gyt.prototype,"_animationIndex"),gyt.prototype),f(gyt.prototype,"defaultCacheMode",[dyt],Object.getOwnPropertyDescriptor(gyt.prototype,"defaultCacheMode"),gyt.prototype),Dyt=Gs(gyt.prototype,"loop",[ra],(function(){return!0})),f(gyt.prototype,"sockets",[fyt],Object.getOwnPropertyDescriptor(gyt.prototype,"sockets"),gyt.prototype),f(gyt.prototype,"customMaterial",[Ia,pyt],Object.getOwnPropertyDescriptor(gyt.prototype,"customMaterial"),gyt.prototype),myt=gyt))||myt);v.internal.SpineSkeleton=Hyt;var zyt,Vyt,Wyt,Xyt,jyt=function(){function t(){this.name="sp.VertexEffectDelegate",this._vertexEffect=void 0,this._interpolation=void 0,this._effectType=void 0,this._vertexEffect=null,this._interpolation=null,this._effectType="none"}var e=t.prototype;return e.clear=function(){this._vertexEffect=null,this._interpolation=null,this._effectType="none"},e.initJitter=function(t,e){return this._effectType="jitter",this._vertexEffect=new Ivt.JitterEffect(t,e),this._vertexEffect},e.initSwirlWithPow=function(t,e){return this._effectType="swirl",this._interpolation=new Ivt.Pow(e),this._vertexEffect=new Ivt.SwirlEffect(t,this._interpolation),this._vertexEffect},e.initSwirlWithPowOut=function(t,e){return this._effectType="swirl",this._interpolation=new Ivt.PowOut(e),this._vertexEffect=new Ivt.SwirlEffect(t,this._interpolation),this._vertexEffect},e.getJitterVertexEffect=function(){return this._vertexEffect},e.getSwirlVertexEffect=function(){return this._vertexEffect},e.getVertexEffect=function(){return this._vertexEffect},e.getEffectType=function(){return this._effectType},t}(),Yyt=new pn(0,0,255,255),Kyt=new pn(255,0,0,255),qyt=new pn(0,255,0,255),Qyt=new pn(255,255,0,255),Zyt=null,Jyt=null,$yt=!1,tTt=!1,eTt=yk(pk),iTt=yk(gk),nTt=new hn(0,0,0);function rTt(t,e){var i,n;switch(t){case 1:i=$yt?uc.ONE:uc.SRC_ALPHA,n=uc.ONE;break;case 2:i=uc.DST_COLOR,n=uc.ONE_MINUS_SRC_ALPHA;break;case 3:i=uc.ONE,n=uc.ONE_MINUS_SRC_COLOR;break;case 0:default:i=$yt?uc.ONE:uc.SRC_ALPHA,n=uc.ONE_MINUS_SRC_ALPHA}return e.getMaterialForBlendAndTint(i,n,tTt?Lyt.TWO_COLORED:Lyt.COLORED_TEXTURED)}var sTt={vCount:32767,ensureAccessor:function(t){var e=t?Jyt:Zyt;if(!e){var i=gL.root.device,n=gL.root.batcher2D,r=t?gk:pk;t?(e=Jyt=new Ok(i,r,this.vCount),n.registerBufferAccessor(Number.parseInt("SPINETINT",36),Jyt)):(e=Zyt=new Ok(i,r,this.vCount),n.registerBufferAccessor(Number.parseInt("SPINE",36),Zyt))}return e},createData:function(t){var e=t.renderData;if(!e){var i=t.useTint||t.isAnimationCached(),n=this.ensureAccessor(i);e=Zk.add(i?gk:pk,n)}return e},updateRenderData:function(t){t._skeleton&&function(t){if(t.drawList.reset(),0!==t.color.a){t._updateColor(),$yt=t.premultipliedAlpha,tTt=t.useTint||t.isAnimationCached(),t.isAnimationCached()?function(t){var e=t.updateRenderData();if(e){var i=e.vCount,n=e.iCount;if(!(i<1||n<1)){var r=t.renderData;r.vertexCount===i&&r.indexCount===n||(r.resize(i,n),r.indices=new Uint16Array(n));var s=r.chunk.vb,a=new Uint8Array(s.buffer,s.byteOffset,Float32Array.BYTES_PER_ELEMENT*s.length);a.set(e.vData);var o=t.color;if(4294967295!==o._val||$yt){zyt=o.r/255,Vyt=o.g/255,Wyt=o.b/255,Xyt=o.a/255;for(var h=0;h0||e.indexCount>0)&&i.getMeshBuffer(e.chunk.bufferId).setDirty()}}(t)}};v.internal.SpineAssembler=sTt;var aTt,oTt,hTt={getAssembler:function(){return sTt}};Hyt.Assembler=hTt,function(t){t[t.REGION=0]="REGION",t[t.BOUNDING_BOX=1]="BOUNDING_BOX",t[t.MESH=2]="MESH",t[t.SKINNED_MESH=3]="SKINNED_MESH"}(aTt||(aTt={})),Se(aTt),function(t){t[t.START=0]="START",t[t.INTERRUPT=1]="INTERRUPT",t[t.END=2]="END",t[t.DISPOSE=3]="DISPOSE",t[t.COMPLETE=4]="COMPLETE",t[t.EVENT=5]="EVENT"}(oTt||(oTt={})),Se(oTt),t("fD",Object.freeze({__proto__:null,spine:Ivt,get ATTACHMENT_TYPE(){return aTt},get AnimationEventType(){return oTt},timeScale:1,get AnimationCacheMode(){return Pyt},get DefaultSkinsEnum(){return Byt},get DefaultAnimsEnum(){return Nyt},get SpineMaterialType(){return Lyt},SpineSocket:Gyt,Skeleton:Hyt,SkeletonData:eyt,VertexEffectDelegate:jyt,simpleSpineAssembler:hTt}));var uTt=function(){function t(){this.originalTarget=null,this.target=null,this.tag=t.TAG_INVALID}var e=t.prototype;return e.clone=function(){var e=new t;return e.originalTarget=null,e.target=null,e.tag=this.tag,e},e.isDone=function(){return!0},e.startWithTarget=function(t){this.originalTarget=t,this.target=t},e.stop=function(){this.target=null},e.step=function(){Y(1006)},e.update=function(){Y(1007)},e.getTarget=function(){return this.target},e.setTarget=function(t){this.target=t},e.getOriginalTarget=function(){return this.originalTarget},e.setOriginalTarget=function(t){this.originalTarget=t},e.getTag=function(){return this.tag},e.setTag=function(t){this.tag=t},e.reverse=function(){return Y(1008),null},e.retain=function(){},e.release=function(){},t}();uTt.TAG_INVALID=-1;var lTt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r=n&&i.actionIndex--;break}}},e._removeActionByTag=function(t,e,i){for(var n=0,r=e.actions.length;n=0;--n){var r=e.actions[n];if(r&&r.getTag()===t){if(i&&r.getOriginalTarget()!==i)continue;this._removeActionAtIndex(n,e)}}},e.removeActionByTag=function(t,e){var i=this;t===uTt.TAG_INVALID&&Y(1002);var n=this._hashTargets;if(e){var r=n.get(e);r&&this._removeActionByTag(t,r,e)}else n.forEach((function(e){i._removeActionByTag(t,e)}))},e.removeAllActionsByTag=function(t,e){var i=this;t===uTt.TAG_INVALID&&Y(1002);var n=this._hashTargets;if(e){var r=n.get(e);r&&this._removeAllActionsByTag(t,r,e)}else n.forEach((function(e){i._removeAllActionsByTag(t,e)}))},e.getActionByTag=function(t,e){t===uTt.TAG_INVALID&&Y(1004);var i=this._hashTargets.get(e);if(i){if(null!=i.actions)for(var n=0;n=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=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;e1.192092896e-7?this._duration:1.192092896e-7);e=e<1?e:1,this.update(e>0?e:0),this._repeatMethod&&this._timesForRepeat>1&&this.isDone()&&(this._repeatForever||this._timesForRepeat--,this.startWithTarget(this.target),this.step(this._elapsed-this._duration))},i.startWithTarget=function(t){uTt.prototype.startWithTarget.call(this,t),this._elapsed=0,this._firstTick=!0},i.reverse=function(){return Y(1010),this},i.setAmplitudeRate=function(){Y(1011)},i.getAmplitudeRate=function(){return Y(1012),0},i.speed=function(t){return t<=0?(Y(1013),this):(this._speedMethod=!0,this._speed*=t,this)},i.getSpeed=function(){return this._speed},i.setSpeed=function(t){return this._speed=t,this},i.repeat=function(t){return t=Math.round(t),Number.isNaN(t)||t<1?(Y(1014),this):(this._repeatMethod=!0,this._timesForRepeat*=t,this)},i.repeatForever=function(){return this._repeatMethod=!0,this._timesForRepeat=this.MAX_VALUE,this._repeatForever=!0,this},e}(lTt),RTt=function(t){function e(i){var n;(n=t.call(this)||this)._actions=[],n._split=0,n._last=0,n._reversed=!1;var r=i instanceof Array?i:arguments;if(1===r.length)return Z(1019),c(n);var s=r.length-1;if(s>=0&&null==r[s]&&Y(1015),s>=0){for(var a,o=r[0],h=1;h1?e%1:e),this._last=n)},i.reverse=function(){var t=e._actionOneTwo(this._actions[1].reverse(),this._actions[0].reverse());return this._cloneDecoration(t),this._reverseEaseList(t),t._reversed=!0,t},e}(ATt);function bTt(t){var e=t instanceof Array?t:arguments;if(1===e.length)return e[0];var i=e.length-1;i>=0&&null==e[i]&&Y(1015);var n=null;if(i>=0){n=e[0];for(var r=1;r<=i;r++)e[r]&&(n=RTt._actionOneTwo(n,e[r]))}return n}TTt=RTt,RTt._actionOneTwo=function(t,e){var i=new TTt;return i.initWithTwoActions(t,e),i};var CTt=function(t){function e(e,i){var n;return(n=t.call(this)||this)._times=0,n._total=0,n._nextDt=0,n._actionInstant=!1,n._innerAction=null,void 0!==i&&n.initWithAction(e,i),n}s(e,t);var i=e.prototype;return i.initWithAction=function(t,e){var i=t._duration*e;return!!this.initWithDuration(i)&&(this._times=e,this._innerAction=t,t instanceof pTt&&(this._actionInstant=!0,this._times-=1),this._total=0,!0)},i.clone=function(){var t=new e;return this._cloneDecoration(t),t.initWithAction(this._innerAction.clone(),this._times),t},i.startWithTarget=function(t){this._total=0,this._nextDt=this._innerAction._duration/this._duration,ATt.prototype.startWithTarget.call(this,t),this._innerAction.startWithTarget(t)},i.stop=function(){this._innerAction.stop(),uTt.prototype.stop.call(this)},i.update=function(t){t=this._computeEaseTime(t);var e=this._innerAction,i=this._duration,n=this._times,r=this._nextDt;if(t>=r){for(;t>r&&this._total1?1:r;t>=1&&this._total=0&&null==r[s]&&Y(1015),s>=0){for(var a,o=r[0],h=1;hr?this._two=RTt._actionOneTwo(e,DTt(n-r)):n0&&null==e[e.length-1]&&Y(1015);for(var i=e[0],n=1;n0&&(i=this._time/this._duration),i>=1&&(i=1),this._transition===pSt.COLOR){var n=e._uiProps.uiComp;pn.lerp(vSt,this._fromColor,this._toColor,i),n&&(n.color=vSt)}else this.transition===pSt.SCALE&&(e.getScale(this._targetScale),this._targetScale.x=Di(this._fromScale.x,this._toScale.x,i),this._targetScale.y=Di(this._fromScale.y,this._toScale.y,i),e.setScale(this._targetScale));1===i&&(this._transitionFinished=!0)}},i._resizeNodeToTargetNode=function(){this.target&&this.target._uiProps.uiTransformComp},i._resetState=function(){this._pressed=!1,this._hovered=!1;var t=this.target;if(t){var e=this._transition;if(e===pSt.COLOR&&this._interactable){var i=t.getComponent(bU);i&&(i.color=this._normalColor)}else e===pSt.SCALE&&this._originalScale&&t.setScale(this._originalScale);this._transitionFinished=!0}},i._registerNodeEvent=function(){this.node.on(um.TOUCH_START,this._onTouchBegan,this),this.node.on(um.TOUCH_MOVE,this._onTouchMove,this),this.node.on(um.TOUCH_END,this._onTouchEnded,this),this.node.on(um.TOUCH_CANCEL,this._onTouchCancel,this),this.node.on(um.MOUSE_ENTER,this._onMouseMoveIn,this),this.node.on(um.MOUSE_LEAVE,this._onMouseMoveOut,this),this.node.on(PTt.XRUI_HOVER_ENTERED,this._xrHoverEnter,this),this.node.on(PTt.XRUI_HOVER_EXITED,this._xrHoverExit,this),this.node.on(PTt.XRUI_CLICK,this._xrClick,this),this.node.on(PTt.XRUI_UNCLICK,this._xrUnClick,this)},i._registerTargetEvent=function(t){t.on(um.TRANSFORM_CHANGED,this._onTargetTransformChanged,this)},i._unregisterNodeEvent=function(){this.node.off(um.TOUCH_START,this._onTouchBegan,this),this.node.off(um.TOUCH_MOVE,this._onTouchMove,this),this.node.off(um.TOUCH_END,this._onTouchEnded,this),this.node.off(um.TOUCH_CANCEL,this._onTouchCancel,this),this.node.off(um.MOUSE_ENTER,this._onMouseMoveIn,this),this.node.off(um.MOUSE_LEAVE,this._onMouseMoveOut,this),this.node.off(PTt.XRUI_HOVER_ENTERED,this._xrHoverEnter,this),this.node.off(PTt.XRUI_HOVER_EXITED,this._xrHoverExit,this),this.node.off(PTt.XRUI_CLICK,this._xrClick,this),this.node.off(PTt.XRUI_UNCLICK,this._xrUnClick,this)},i._unregisterTargetEvent=function(t){t.off(um.TRANSFORM_CHANGED)},i._getTargetSprite=function(t){var e=null;return t&&(e=t.getComponent(dz)),e},i._applyTarget=function(){this.target&&(this._sprite=this._getTargetSprite(this.target),this._originalScale||(this._originalScale=new hn),hn.copy(this._originalScale,this.target.getScale()),this._registerTargetEvent(this.target))},i._onTargetSpriteFrameChanged=function(t){this._transition===pSt.SPRITE&&this._setCurrentStateSpriteFrame(t.spriteFrame)},i._setCurrentStateSpriteFrame=function(t){if(t)switch(this._getButtonState()){case mSt.NORMAL:this._normalSprite=t;break;case mSt.HOVER:this._hoverSprite=t;break;case mSt.PRESSED:this._pressedSprite=t;break;case mSt.DISABLED:this._disabledSprite=t}},i._onTargetColorChanged=function(t){this._transition===pSt.COLOR&&this._setCurrentStateColor(t)},i._setCurrentStateColor=function(t){switch(this._getButtonState()){case mSt.NORMAL:this._normalColor=t;break;case mSt.HOVER:this._hoverColor=t;break;case mSt.PRESSED:this._pressedColor=t;break;case mSt.DISABLED:this._disabledColor=t}},i._onTargetTransformChanged=function(t){t&om.SCALE&&this._originalScale&&this._transition===pSt.SCALE&&this._transitionFinished&&hn.copy(this._originalScale,this.target.getScale())},i._onTouchBegan=function(t){this._interactable&&this.enabledInHierarchy&&(this._pressed=!0,this._updateState(),t&&(t.propagationStopped=!0))},i._onTouchMove=function(t){if(this._interactable&&this.enabledInHierarchy&&this._pressed&&t){var e=t.touch;if(e){var i,n=this.node._uiProps.uiTransformComp.hitTest(e.getLocation(),t.windowId);this._transition===pSt.SCALE&&this.target&&this._originalScale?n?(hn.copy(this._fromScale,this._originalScale),hn.multiplyScalar(this._toScale,this._originalScale,this._zoomScale),this._transitionFinished=!1):(this._time=0,this._transitionFinished=!0,this.target.setScale(this._originalScale)):(i=n?mSt.PRESSED:mSt.NORMAL,this._applyTransition(i)),t&&(t.propagationStopped=!0)}}},i._onTouchEnded=function(t){this._interactable&&this.enabledInHierarchy&&(this._pressed&&(rp.emitEvents(this.clickEvents,t),this.node.emit(gSt.CLICK,this)),this._pressed=!1,this._updateState(),t&&(t.propagationStopped=!0))},i._onTouchCancel=function(){this._interactable&&this.enabledInHierarchy&&(this._pressed=!1,this._updateState())},i._onMouseMoveIn=function(){!this._pressed&&this.interactable&&this.enabledInHierarchy&&(this._transition!==pSt.SPRITE||this._hoverSprite)&&(this._hovered||(this._hovered=!0,this._updateState()))},i._onMouseMoveOut=function(){this._hovered&&(this._hovered=!1,this._updateState())},i._updateState=function(){var t=this._getButtonState();this._applyTransition(t)},i._getButtonState=function(){var t=mSt.NORMAL;return this._interactable?this._pressed?t=mSt.PRESSED:this._hovered&&(t=mSt.HOVER):t=mSt.DISABLED,t.toString()},i._updateColorTransition=function(t){var e,i=this[t+"Color"],n=null===(e=this.target)||void 0===e?void 0:e.getComponent(bU);n&&(t===mSt.DISABLED.toString()?n.color=i:(this._fromColor=n.color.clone(),this._toColor=i,this._time=0,this._transitionFinished=!1))},i._updateSpriteTransition=function(t){var e=this[t+"Sprite"];this._sprite&&e&&(this._sprite.spriteFrame=e)},i._updateScaleTransition=function(t){this._interactable&&(t===mSt.PRESSED.toString()?this._zoomUp():this._zoomBack())},i._zoomUp=function(){this._originalScale&&(hn.copy(this._fromScale,this._originalScale),hn.multiplyScalar(this._toScale,this._originalScale,this._zoomScale),this._time=0,this._transitionFinished=!1)},i._zoomBack=function(){this.target&&this._originalScale&&(hn.copy(this._fromScale,this.target.getScale()),hn.copy(this._toScale,this._originalScale),this._time=0,this._transitionFinished=!1)},i._applyTransition=function(t){var e=this._transition;e===pSt.COLOR?this._updateColorTransition(t):e===pSt.SPRITE?this._updateSpriteTransition(t):e===pSt.SCALE&&this._updateScaleTransition(t)},i._xrHoverEnter=function(){this._onMouseMoveIn(),this._updateState()},i._xrHoverExit=function(){this._onMouseMoveOut(),this._pressed&&(this._pressed=!1,this._updateState())},i._xrClick=function(){this._interactable&&this.enabledInHierarchy&&(this._pressed=!0,this._updateState())},i._xrUnClick=function(){this._interactable&&this.enabledInHierarchy&&(this._pressed&&(rp.emitEvents(this.clickEvents,this),this.node.emit(gSt.CLICK,this)),this._pressed=!1,this._updateState())},n(e,[{key:"target",get:function(){return this._target||this.node},set:function(t){this._target!==t&&(this._target&&this._unregisterTargetEvent(this._target),this._target=t,this._applyTarget())}},{key:"interactable",get:function(){return this._interactable},set:function(t){this._interactable!==t&&(this._interactable=t,this._updateState(),this._interactable||this._resetState())}},{key:"_resizeToTarget",set:function(t){t&&this._resizeNodeToTargetNode()}},{key:"transition",get:function(){return this._transition},set:function(t){this._transition!==t&&(this._transition===pSt.COLOR?this._updateColorTransition(mSt.NORMAL):this._transition===pSt.SPRITE&&this._updateSpriteTransition(mSt.NORMAL),this._transition=t,this._updateState())}},{key:"normalColor",get:function(){return this._normalColor},set:function(t){this._normalColor!==t&&(this._normalColor.set(t),this._updateState())}},{key:"pressedColor",get:function(){return this._pressedColor},set:function(t){this._pressedColor!==t&&this._pressedColor.set(t)}},{key:"hoverColor",get:function(){return this._hoverColor},set:function(t){this._hoverColor!==t&&this._hoverColor.set(t)}},{key:"disabledColor",get:function(){return this._disabledColor},set:function(t){this._disabledColor!==t&&(this._disabledColor.set(t),this._updateState())}},{key:"duration",get:function(){return this._duration},set:function(t){this._duration!==t&&(this._duration=t)}},{key:"zoomScale",get:function(){return this._zoomScale},set:function(t){this._zoomScale!==t&&(this._zoomScale=t)}},{key:"normalSprite",get:function(){return this._normalSprite},set:function(t){if(this._normalSprite!==t){this._normalSprite=t;var e=this.node.getComponent(dz);e&&(e.spriteFrame=t),this._updateState()}}},{key:"pressedSprite",get:function(){return this._pressedSprite},set:function(t){this._pressedSprite!==t&&(this._pressedSprite=t,this._updateState())}},{key:"hoverSprite",get:function(){return this._hoverSprite},set:function(t){this._hoverSprite!==t&&(this._hoverSprite=t,this._updateState())}},{key:"disabledSprite",get:function(){return this._disabledSprite},set:function(t){this._disabledSprite!==t&&(this._disabledSprite=t,this._updateState())}}]),e}(op)).Transition=pSt,oSt.EventType=gSt,f((jTt=oSt).prototype,"target",[kTt],Object.getOwnPropertyDescriptor(jTt.prototype,"target"),jTt.prototype),f(jTt.prototype,"transition",[UTt],Object.getOwnPropertyDescriptor(jTt.prototype,"transition"),jTt.prototype),f(jTt.prototype,"normalSprite",[GTt],Object.getOwnPropertyDescriptor(jTt.prototype,"normalSprite"),jTt.prototype),f(jTt.prototype,"pressedSprite",[HTt],Object.getOwnPropertyDescriptor(jTt.prototype,"pressedSprite"),jTt.prototype),f(jTt.prototype,"hoverSprite",[zTt],Object.getOwnPropertyDescriptor(jTt.prototype,"hoverSprite"),jTt.prototype),f(jTt.prototype,"disabledSprite",[VTt],Object.getOwnPropertyDescriptor(jTt.prototype,"disabledSprite"),jTt.prototype),YTt=Gs(jTt.prototype,"clickEvents",[WTt,ra],(function(){return[]})),KTt=Gs(jTt.prototype,"_interactable",[ra],(function(){return!0})),qTt=Gs(jTt.prototype,"_transition",[ra],(function(){return pSt.NONE})),QTt=Gs(jTt.prototype,"_normalColor",[ra],(function(){return pn.WHITE.clone()})),ZTt=Gs(jTt.prototype,"_hoverColor",[ra],(function(){return new pn(211,211,211,255)})),JTt=Gs(jTt.prototype,"_pressedColor",[ra],(function(){return pn.WHITE.clone()})),$Tt=Gs(jTt.prototype,"_disabledColor",[ra],(function(){return new pn(124,124,124,255)})),tSt=Gs(jTt.prototype,"_normalSprite",[ra],(function(){return null})),eSt=Gs(jTt.prototype,"_hoverSprite",[ra],(function(){return null})),iSt=Gs(jTt.prototype,"_pressedSprite",[ra],(function(){return null})),nSt=Gs(jTt.prototype,"_disabledSprite",[ra],(function(){return null})),rSt=Gs(jTt.prototype,"_duration",[ra],(function(){return.1})),sSt=Gs(jTt.prototype,"_zoomScale",[ra],(function(){return 1.2})),aSt=Gs(jTt.prototype,"_target",[ra],(function(){return null})),XTt=jTt))||XTt)||XTt)||XTt));v.Button=ySt;var TSt,SSt,ESt,ASt=function(){function t(){}return t.add=function(t){var e=this._tabIndexList;-1===e.indexOf(t)&&e.push(t)},t.remove=function(t){var e=this._tabIndexList,i=e.indexOf(t);-1!==i&&e.splice(i,1)},t.resort=function(){this._tabIndexList.sort((function(t,e){return t._delegate.tabIndex-e._delegate.tabIndex}))},t.next=function(t){var e=this._tabIndexList,i=e.indexOf(t);if(t.setFocus(!1),-1!==i){var n=e[i+1];n&&n._delegate.tabIndex>=0&&n.setFocus(!0)}},t}();ASt._tabIndexList=[],function(t){t[t.DEFAULT=0]="DEFAULT",t[t.DONE=1]="DONE",t[t.SEND=2]="SEND",t[t.SEARCH=3]="SEARCH",t[t.GO=4]="GO",t[t.NEXT=5]="NEXT"}(TSt||(TSt={})),ve(TSt),function(t){t[t.ANY=0]="ANY",t[t.EMAIL_ADDR=1]="EMAIL_ADDR",t[t.NUMERIC=2]="NUMERIC",t[t.PHONE_NUMBER=3]="PHONE_NUMBER",t[t.URL=4]="URL",t[t.DECIMAL=5]="DECIMAL",t[t.SINGLE_LINE=6]="SINGLE_LINE"}(SSt||(SSt={})),ve(SSt),function(t){t[t.PASSWORD=0]="PASSWORD",t[t.SENSITIVE=1]="SENSITIVE",t[t.INITIAL_CAPS_WORD=2]="INITIAL_CAPS_WORD",t[t.INITIAL_CAPS_SENTENCE=3]="INITIAL_CAPS_SENTENCE",t[t.INITIAL_CAPS_ALL_CHARACTERS=4]="INITIAL_CAPS_ALL_CHARACTERS",t[t.DEFAULT=5]="DEFAULT"}(ESt||(ESt={})),ve(ESt);var RSt,bSt,CSt,wSt,xSt,ISt,OSt,DSt,MSt,PSt,BSt,NSt,LSt,FSt,kSt,USt,GSt,HSt,zSt,VSt,WSt,XSt,jSt,YSt,KSt,qSt,QSt,ZSt,JSt,$St,tEt=function(){function t(){this._editing=!1,this._delegate=null}var e=t.prototype;return e.init=function(){},e.onEnable=function(){},e.update=function(){},e.onDisable=function(){this._editing&&this.endEditing()},e.clear=function(){this._delegate=null},e.setTabIndex=function(){},e.setSize=function(){},e.setFocus=function(t){t?this.beginEditing():this.endEditing()},e.isFocused=function(){return this._editing},e.beginEditing=function(){},e.endEditing=function(){},t}(),eEt=T.document,iEt=new Dn,nEt=new Dn,rEt=new hn,sEt=null,aEt=0,oEt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r=0&&t.left>=0&&t.bottom<=(T.innerHeight||eEt.documentElement.clientHeight)&&t.right<=(T.innerWidth||eEt.documentElement.clientWidth)}return!1},i._adjustWindowScroll=function(){var t=this;setTimeout((function(){T.scrollY<40&&!t._isElementInViewport()&&t._edTxt.scrollIntoView({block:"start",inline:"nearest",behavior:"smooth"})}),400)},i._scrollBackWindow=function(){setTimeout((function(){Ol.browserType!==$u.WECHAT||Ol.os!==il.IOS?T.scrollTo(0,0):T.top&&T.top.scrollTo(0,0)}),400)},i._updateMatrix=function(){if(this._edTxt){var t=this._delegate.node,e=IV.getScaleX(),i=IV.getScaleY(),n=IV.getViewportRect(),r=wl.devicePixelRatio;t.getWorldMatrix(iEt);var s=t._uiProps.uiTransformComp;if(s&&(hn.set(rEt,-s.anchorX*s.width,-s.anchorY*s.height,rEt.z),Dn.transform(iEt,iEt,rEt)),t._uiProps.uiTransformComp){var a=gL.root.batcher2D.getFirstRenderCamera(t);if(a){a.node.getWorldRT(nEt);var o=nEt.m12,h=nEt.m13,u=Dl.center;nEt.m12=u.x-(nEt.m00*o+nEt.m04*h),nEt.m13=u.y-(nEt.m01*o+nEt.m05*h),e/=r,i/=r,hn.set(rEt,e,i,1),Dn.scale(nEt,nEt,rEt);var l=AL.container,c=parseInt(l&&l.style.paddingLeft||"0");c+=n.x/r;var _=parseInt(l&&l.style.paddingBottom||"0");_+=n.y/r,nEt.m12+=c,nEt.m13+=_,Dn.multiply(nEt,nEt,iEt);var d="matrix("+nEt.m00+","+-nEt.m01+","+-nEt.m04+","+nEt.m05+","+nEt.m12+","+-nEt.m13+")";this._edTxt.style.transform=d,this._edTxt.style["-webkit-transform"]=d,this._edTxt.style["transform-origin"]="0px 100% 0px",this._edTxt.style["-webkit-transform-origin"]="0px 100% 0px"}}}},i._updateInputType=function(){var t=this._delegate,e=t.inputMode,i=t.inputFlag,n=t.returnType,r=this._edTxt;if(this._inputMode!==e||this._inputFlag!==i||this._returnType!==n){if(this._inputMode=e,this._inputFlag=i,this._returnType=n,this._isTextArea){var s="none";return i===ESt.INITIAL_CAPS_ALL_CHARACTERS?s="uppercase":i===ESt.INITIAL_CAPS_WORD&&(s="capitalize"),void(r.style.textTransform=s)}if(r=r,i===ESt.PASSWORD)return r.type="password",void(r.style.textTransform="none");var a=r.type;e===SSt.EMAIL_ADDR?a="email":e===SSt.NUMERIC?a="number":e===SSt.DECIMAL?a="digit":e===SSt.PHONE_NUMBER?(a="tel",r.addEventListener("wheel",(function(){return!1}))):e===SSt.URL?a="url":(a="text",n===TSt.SEARCH&&(a="search")),r.type=a;var o="none";i===ESt.INITIAL_CAPS_ALL_CHARACTERS?o="uppercase":i===ESt.INITIAL_CAPS_WORD&&(o="capitalize"),r.style.textTransform=o}},i._updateMaxLength=function(){var t=this._delegate.maxLength;t<0&&(t=65535),this._edTxt.maxLength=t},i._initStyleSheet=function(){if(this._edTxt){var t=this._edTxt;t.style.color="#000000",t.style.border="0px",t.style.background="transparent",t.style.width="100%",t.style.height="100%",t.style.outline="medium",t.style.padding="0",t.style.textTransform="none",t.style.display="none",t.style.position="absolute",t.style.bottom="0px",t.style.left="2px",t.className="cocosEditBox",t.style.fontFamily="Arial",t.id=this._domId,this._isTextArea?(t.style.resize="none",t.style.overflowY="scroll"):((t=t).type="text",t.style["-moz-appearance"]="textfield"),this._placeholderStyleSheet=eEt.createElement("style")}},i._updateStyleSheet=function(){var t=this._delegate,e=this._edTxt;e&&t&&(e.value=t.string,this._updateTextLabel(t.textLabel))},i._updateTextLabel=function(t){if(t){var e=t.font;e=!e||e instanceof kF?t.fontFamily:e._fontFamily;var i=t.fontSize*t.node.scale.y;if((this._textLabelFont!==e||this._textLabelFontSize!==i||this._textLabelFontColor!==t.fontColor||this._textLabelAlign!==t.horizontalAlign)&&(this._textLabelFont=e,this._textLabelFontSize=i,this._textLabelFontColor=t.fontColor,this._textLabelAlign=t.horizontalAlign,this._edTxt)){var n=this._edTxt;switch(n.style.fontSize=i+"px",n.style.color=t.color.toCSS(),n.style.fontFamily=e,t.horizontalAlign){case fG.HorizontalAlign.LEFT:n.style.textAlign="left";break;case fG.HorizontalAlign.CENTER:n.style.textAlign="center";break;case fG.HorizontalAlign.RIGHT:n.style.textAlign="right"}}}},i._updatePlaceholderLabel=function(t){if(t){var e=t.font;e=!e||e instanceof kF?t.fontFamily:t.font._fontFamily;var i=t.fontSize*t.node.scale.y;if(this._placeholderLabelFont!==e||this._placeholderLabelFontSize!==i||this._placeholderLabelFontColor!==t.fontColor||this._placeholderLabelAlign!==t.horizontalAlign||this._placeholderLineHeight!==t.fontSize){this._placeholderLabelFont=e,this._placeholderLabelFontSize=i,this._placeholderLabelFontColor=t.fontColor,this._placeholderLabelAlign=t.horizontalAlign,this._placeholderLineHeight=t.fontSize;var n=this._placeholderStyleSheet,r=t.color.toCSS(),s=t.fontSize,a="";switch(t.horizontalAlign){case fG.HorizontalAlign.LEFT:a="left";break;case fG.HorizontalAlign.CENTER:a="center";break;case fG.HorizontalAlign.RIGHT:a="right"}n.innerHTML="#"+this._domId+"::-webkit-input-placeholder{text-transform: initial;-family: "+e+";font-size: "+i+"px;color: "+r+";line-height: "+s+"px;text-align: "+a+";}#"+this._domId+"::-moz-placeholder{text-transform: initial;-family: "+e+";font-size: "+i+"px;color: "+r+";line-height: "+s+"px;text-align: "+a+";}#"+this._domId+"::-ms-input-placeholder{text-transform: initial;-family: "+e+";font-size: "+i+"px;color: "+r+";line-height: "+s+"px;text-align: "+a+";}",Ol.browserType===$u.EDGE&&(n.innerHTML+="#"+this._domId+"::-ms-clear{display: none;}")}}},i._registerEventListeners=function(){var t=this;if(this._edTxt){var e=this._edTxt,i=!1,n=this.__eventListeners;n.compositionStart=function(){i=!0},n.compositionEnd=function(){i=!1,t._delegate._editBoxTextChanged(e.value)},n.onInput=function(){if(!i){var n=t._delegate,r=n.maxLength;r>=0&&(e.value=e.value.slice(0,r)),n._editBoxTextChanged(e.value)}},n.onClick=function(){t._editing&&Ol.isMobile&&t._adjustWindowScroll()},n.onKeydown=function(i){i.keyCode===PC.ENTER?(i.propagationStopped=!0,t._delegate._editBoxEditingReturn(),t._isTextArea||e.blur()):i.keyCode===PC.TAB&&(i.propagationStopped=!0,i.preventDefault(),ASt.next(t))},n.onBlur=function(){Ol.isMobile&&i&&n.compositionEnd(),t._editing=!1,sEt=null,t._hideDom(),t._delegate._editBoxEditingDidEnded()},e.addEventListener("compositionstart",n.compositionStart),e.addEventListener("compositionend",n.compositionEnd),e.addEventListener("input",n.onInput),e.addEventListener("keydown",n.onKeydown),e.addEventListener("blur",n.onBlur),e.addEventListener("touchstart",n.onClick)}},i._removeEventListeners=function(){if(this._edTxt){var t=this._edTxt,e=this.__eventListeners;t.removeEventListener("compositionstart",e.compositionStart),t.removeEventListener("compositionend",e.compositionEnd),t.removeEventListener("input",e.onInput),t.removeEventListener("keydown",e.onKeydown),t.removeEventListener("blur",e.onBlur),t.removeEventListener("touchstart",e.onClick),e.compositionStart=null,e.compositionEnd=null,e.onInput=null,e.onKeydown=null,e.onBlur=null,e.onClick=null}},e}(tEt);!function(t){t.EDITING_DID_BEGAN="editing-did-began",t.EDITING_DID_ENDED="editing-did-ended",t.TEXT_CHANGED="text-changed",t.EDITING_RETURN="editing-return",t.XR_EDITING_DID_BEGAN="xr-editing-did-began",t.XR_EDITING_DID_ENDED="xr-editing-did-ended"}($St||($St={}));var hEt,uEt,lEt,cEt,_Et,dEt,fEt,pEt,mEt,gEt,vEt,yEt,TEt,SEt,EEt,AEt,REt,bEt,CEt,wEt,xEt,IEt,OEt,DEt,MEt,PEt,BEt,NEt,LEt,FEt,kEt,UEt,GEt,HEt,zEt=t("fK",(RSt=qs("cc.EditBox"),bSt=Zs(110),CSt=Qs(oU),wSt=xa(fG),xSt=xa(fG),ISt=xa(yF),OSt=xa(ESt),DSt=xa(SSt),MSt=xa(TSt),PSt=xa([rp]),BSt=xa([rp]),NSt=xa([rp]),LSt=xa([rp]),RSt(FSt=bSt(FSt=CSt(((JSt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r=0&&t.length>=this._maxLength&&(t=t.slice(0,this._maxLength)),this._string!==t&&(this._string=t,this._updateString(t))}},{key:"placeholder",get:function(){return this._placeholderLabel?this._placeholderLabel.string:""},set:function(t){this._placeholderLabel&&(this._placeholderLabel.string=t)}},{key:"textLabel",get:function(){return this._textLabel},set:function(t){this._textLabel!==t&&(this._textLabel=t,this._textLabel&&(this._updateTextLabel(),this._updateLabels()))}},{key:"placeholderLabel",get:function(){return this._placeholderLabel},set:function(t){this._placeholderLabel!==t&&(this._placeholderLabel=t,this._placeholderLabel&&(this._updatePlaceholderLabel(),this._updateLabels()))}},{key:"backgroundImage",get:function(){return this._backgroundImage},set:function(t){this._backgroundImage!==t&&(this._backgroundImage=t,this._ensureBackgroundSprite(),this._background.spriteFrame=t)}},{key:"inputFlag",get:function(){return this._inputFlag},set:function(t){this._inputFlag!==t&&(this._inputFlag=t,this._updateString(this._string))}},{key:"inputMode",get:function(){return this._inputMode},set:function(t){this._inputMode!==t&&(this._inputMode=t,this._updateTextLabel(),this._updatePlaceholderLabel())}},{key:"returnType",get:function(){return this._returnType},set:function(t){this._returnType=t}},{key:"maxLength",get:function(){return this._maxLength},set:function(t){this._maxLength=t}},{key:"tabIndex",get:function(){return this._tabIndex},set:function(t){this._tabIndex!==t&&(this._tabIndex=t,this._impl&&this._impl.setTabIndex(t))}}]),e}(op))._EditBoxImpl=tEt,JSt.KeyboardReturnType=TSt,JSt.InputFlag=ESt,JSt.InputMode=SSt,JSt.EventType=$St,f((kSt=JSt).prototype,"textLabel",[wSt],Object.getOwnPropertyDescriptor(kSt.prototype,"textLabel"),kSt.prototype),f(kSt.prototype,"placeholderLabel",[xSt],Object.getOwnPropertyDescriptor(kSt.prototype,"placeholderLabel"),kSt.prototype),f(kSt.prototype,"backgroundImage",[ISt],Object.getOwnPropertyDescriptor(kSt.prototype,"backgroundImage"),kSt.prototype),f(kSt.prototype,"inputFlag",[OSt],Object.getOwnPropertyDescriptor(kSt.prototype,"inputFlag"),kSt.prototype),f(kSt.prototype,"inputMode",[DSt],Object.getOwnPropertyDescriptor(kSt.prototype,"inputMode"),kSt.prototype),f(kSt.prototype,"returnType",[MSt],Object.getOwnPropertyDescriptor(kSt.prototype,"returnType"),kSt.prototype),USt=Gs(kSt.prototype,"editingDidBegan",[PSt,ra],(function(){return[]})),GSt=Gs(kSt.prototype,"textChanged",[BSt,ra],(function(){return[]})),HSt=Gs(kSt.prototype,"editingDidEnded",[NSt,ra],(function(){return[]})),zSt=Gs(kSt.prototype,"editingReturn",[LSt,ra],(function(){return[]})),VSt=Gs(kSt.prototype,"_textLabel",[ra],(function(){return null})),WSt=Gs(kSt.prototype,"_placeholderLabel",[ra],(function(){return null})),XSt=Gs(kSt.prototype,"_returnType",[ra],(function(){return TSt.DEFAULT})),jSt=Gs(kSt.prototype,"_string",[ra],(function(){return""})),YSt=Gs(kSt.prototype,"_tabIndex",[ra],(function(){return 0})),KSt=Gs(kSt.prototype,"_backgroundImage",[ra],(function(){return null})),qSt=Gs(kSt.prototype,"_inputFlag",[ra],(function(){return ESt.DEFAULT})),QSt=Gs(kSt.prototype,"_inputMode",[ra],(function(){return SSt.ANY})),ZSt=Gs(kSt.prototype,"_maxLength",[ra],(function(){return 20})),FSt=kSt))||FSt)||FSt)||FSt));"object"==typeof window&&"object"==typeof document&&(zEt._EditBoxImpl=oEt),v.internal.EditBox=zEt,function(t){t[t.NONE=0]="NONE",t[t.HORIZONTAL=1]="HORIZONTAL",t[t.VERTICAL=2]="VERTICAL",t[t.GRID=3]="GRID"}(LEt||(LEt={})),Se(LEt),function(t){t[t.NONE=0]="NONE",t[t.CONTAINER=1]="CONTAINER",t[t.CHILDREN=2]="CHILDREN"}(FEt||(FEt={})),Se(FEt),function(t){t[t.HORIZONTAL=0]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(kEt||(kEt={})),Se(kEt),function(t){t[t.BOTTOM_TO_TOP=0]="BOTTOM_TO_TOP",t[t.TOP_TO_BOTTOM=1]="TOP_TO_BOTTOM"}(UEt||(UEt={})),Se(UEt),function(t){t[t.LEFT_TO_RIGHT=0]="LEFT_TO_RIGHT",t[t.RIGHT_TO_LEFT=1]="RIGHT_TO_LEFT"}(GEt||(GEt={})),Se(GEt),function(t){t[t.NONE=0]="NONE",t[t.FIXED_ROW=1]="FIXED_ROW",t[t.FIXED_COL=2]="FIXED_COL"}(HEt||(HEt={})),Se(HEt);var VEt,WEt,XEt,jEt,YEt,KEt,qEt,QEt,ZEt,JEt,$Et,tAt,eAt,iAt,nAt=new hn,rAt=t("fL",(hEt=qs("cc.Layout"),uEt=Zs(110),lEt=Qs(oU),cEt=xa(LEt),_Et=xa(FEt),dEt=xa(kEt),fEt=xa(UEt),pEt=xa(GEt),mEt=xa(HEt),hEt(gEt=uEt(gEt=lEt(((NEt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r_&&(d=Math.max(_,d),c=_||w,_=w),u+=a*(b*C+this._spacingX);var x=a*(1-b)*C;if(e){if(s>0)(f=y/s>0&&y%s==0)&&(c=_>w?_:c);else if(C>t-g)u>h+a*b*C&&(f=!0);else{var I=(1-this._horizontalDirection-r.x)*t,O=u+x+a*(a>0?this._paddingRight:this._paddingLeft);f=Math.abs(O)>Math.abs(I)}f&&(u=h+a*b*C,w!==_&&(c=_),l+=c+this._spacingY,c=_=w)}var D=i(S,T,l);n&&S.setPosition(u,D),u+=x}return c=Math.max(c,_),Math.max(d,l+c)+this._getPaddingV()},i._doLayoutVertically=function(t,e,i,n){var r=this.node._uiProps.uiTransformComp.anchorPoint,s=this._getFixedBreakingNum(),a=1,o=this._paddingBottom;this._verticalDirection===UEt.TOP_TO_BOTTOM&&(a=-1,o=this._paddingTop);var h=(this._verticalDirection-r.y)*t+a*o,u=h-a*this._spacingY,l=0,c=0,_=0,d=0,f=!1,p=this._usefulLayoutObj.length,m=this._cellSize.height,g=this._getPaddingV();this._layoutType!==LEt.GRID&&this._resizeMode===FEt.CHILDREN&&(m=(t-g-(p-1)*this._spacingY)/p);for(var v=this._usefulLayoutObj,y=0;yl&&(c=Math.max(l,c),_=l||C,l=C),u+=a*(b*w+this._spacingY);var x=a*(1-b)*w;if(e){if(s>0)(f=y/s>0&&y%s==0)&&(_=l>w?l:_);else if(w>t-g)u>h+a*b*w&&(f=!0);else{var I=(1-this._verticalDirection-r.y)*t,O=u+x+a*(a>0?this._paddingTop:this._paddingBottom);f=Math.abs(O)>Math.abs(I)}f&&(u=h+a*b*w,C!==l&&(_=l),d+=_+this._spacingX,_=l=C)}var D=i(S,T,d);n&&(S.getPosition(nAt),S.setPosition(D,u,nAt.z)),u+=x}return _=Math.max(_,l),Math.max(c,d+_)+this._getPaddingH()},i._doLayoutGridAxisHorizontal=function(t,e){var i=this,n=e.width,r=1,s=-t.y*e.height,a=this._paddingBottom;this._verticalDirection===UEt.TOP_TO_BOTTOM&&(r=-1,s=(1-t.y)*e.height,a=this._paddingTop);var o=function(t,e,n){return s+r*(n+(1-e.anchorY)*e.height*i._getUsedScaleValue(t.scale.y)+a)},h=0;this._resizeMode===FEt.CONTAINER&&(h=this._doLayoutHorizontally(n,!0,o,!1),s=-t.y*h,this._verticalDirection===UEt.TOP_TO_BOTTOM&&(r=-1,s=(1-t.y)*h)),this._doLayoutHorizontally(n,!0,o,!0),this._resizeMode===FEt.CONTAINER&&this.node._uiProps.uiTransformComp.setContentSize(n,h)},i._doLayoutGridAxisVertical=function(t,e){var i=this,n=e.height,r=1,s=-t.x*e.width,a=this._paddingLeft;this._horizontalDirection===GEt.RIGHT_TO_LEFT&&(r=-1,s=(1-t.x)*e.width,a=this._paddingRight);var o=function(t,e,n){return s+r*(n+(1-e.anchorX)*e.width*i._getUsedScaleValue(t.scale.x)+a)},h=0;this._resizeMode===FEt.CONTAINER&&(h=this._doLayoutVertically(n,!0,o,!1),s=-t.x*h,this._horizontalDirection===GEt.RIGHT_TO_LEFT&&(r=-1,s=(1-t.x)*h)),this._doLayoutVertically(n,!0,o,!0),this._resizeMode===FEt.CONTAINER&&this.node._uiProps.uiTransformComp.setContentSize(h,n)},i._doLayoutGrid=function(){var t=this.node._uiProps.uiTransformComp,e=t.anchorPoint,i=t.contentSize;this.startAxis===kEt.HORIZONTAL?this._doLayoutGridAxisHorizontal(e,i):this.startAxis===kEt.VERTICAL&&this._doLayoutGridAxisVertical(e,i)},i._getHorizontalBaseWidth=function(){var t=this._usefulLayoutObj,e=0,i=t.length;if(this._resizeMode===FEt.CONTAINER){for(var n=0;n0?n:-n)),i*(e/r)},i._calculatePosition=function(t,e,i,n,r,s,a){var o=e-i;s&&(o+=Math.abs(s));var h=0;o&&(h=Oi(h=r/o));var u=(n-a)*h;this._direction===yAt.VERTICAL?t.set(0,u):t.set(u,0)},i._updateLength=function(t){if(this._handle){var e=this._handle.node._uiProps.uiTransformComp,i=e.contentSize,n=e.anchorPoint;n.x===AAt.x&&n.y===AAt.y||e.setAnchorPoint(AAt),this._direction===yAt.HORIZONTAL?e.setContentSize(t,i.height):e.setContentSize(i.width,t)}},i._processAutoHide=function(t){if(this._enableAutoHide&&!(this._autoHideRemainingTime<=0)&&!this._touching&&(this._autoHideRemainingTime-=t,this._autoHideRemainingTime<=this._autoHideTime)){this._autoHideRemainingTime=Math.max(0,this._autoHideRemainingTime);var e=this._opacity*(this._autoHideRemainingTime/this._autoHideTime);this._setOpacity(e)}},n(e,[{key:"handle",get:function(){return this._handle},set:function(t){this._handle!==t&&(this._handle=t,this.onScroll(Fn.ZERO))}},{key:"direction",get:function(){return this._direction},set:function(t){this._direction!==t&&(this._direction=t,this.onScroll(Fn.ZERO))}},{key:"enableAutoHide",get:function(){return this._enableAutoHide},set:function(t){this._enableAutoHide!==t&&(this._enableAutoHide=t,this._enableAutoHide&&this._setOpacity(0))}},{key:"autoHideTime",get:function(){return this._autoHideTime},set:function(t){this._autoHideTime!==t&&(this._autoHideTime=t)}}]),e}(op)).Direction=yAt,f((cAt=gAt).prototype,"handle",[hAt],Object.getOwnPropertyDescriptor(cAt.prototype,"handle"),cAt.prototype),f(cAt.prototype,"direction",[uAt],Object.getOwnPropertyDescriptor(cAt.prototype,"direction"),cAt.prototype),_At=Gs(cAt.prototype,"_scrollView",[ra],(function(){return null})),dAt=Gs(cAt.prototype,"_handle",[ra],(function(){return null})),fAt=Gs(cAt.prototype,"_direction",[ra],(function(){return yAt.HORIZONTAL})),pAt=Gs(cAt.prototype,"_enableAutoHide",[ra],(function(){return!1})),mAt=Gs(cAt.prototype,"_autoHideTime",[ra],(function(){return 1})),lAt=cAt))||lAt)||lAt)||lAt));v.ScrollBar=wAt;var xAt,IAt,OAt,DAt,MAt,PAt,BAt,NAt,LAt,FAt,kAt,UAt,GAt,HAt,zAt,VAt,WAt,XAt,jAt,YAt,KAt,qAt=t("fS",qs("cc.ViewGroup")(CAt=Zs(110)(CAt=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(op))||CAt)||CAt);v.ViewGroup=qAt;var QAt,ZAt,JAt=1e-4,$At=new hn,tRt=new hn,eRt=new Fn,iRt=new Fn,nRt=function(){return(new Date).getMilliseconds()},rRt={"scroll-to-top":0,"scroll-to-bottom":1,"scroll-to-left":2,"scroll-to-right":3,scrolling:4,"bounce-bottom":6,"bounce-left":7,"bounce-right":8,"bounce-top":5,"scroll-ended":9,"touch-up":10,"scroll-ended-with-threshold":11,"scroll-began":12};!function(t){t.NONE="",t.SCROLL_TO_TOP="scroll-to-top",t.SCROLL_TO_BOTTOM="scroll-to-bottom",t.SCROLL_TO_LEFT="scroll-to-left",t.SCROLL_TO_RIGHT="scroll-to-right",t.SCROLL_BEGAN="scroll-began",t.SCROLL_ENDED="scroll-ended",t.BOUNCE_TOP="bounce-top",t.BOUNCE_BOTTOM="bounce-bottom",t.BOUNCE_LEFT="bounce-left",t.BOUNCE_RIGHT="bounce-right",t.SCROLLING="scrolling",t.SCROLL_ENG_WITH_THRESHOLD="scroll-ended-with-threshold",t.TOUCH_UP="touch-up"}(QAt||(QAt={})),function(t){t[t.NONE=0]="NONE",t[t.LEFT=1]="LEFT",t[t.RIGHT=2]="RIGHT"}(ZAt||(ZAt={}));var sRt,aRt,oRt,hRt,uRt,lRt,cRt,_Rt,dRt,fRt,pRt,mRt,gRt,vRt=t("fO",(xAt=qs("cc.ScrollView"),IAt=Zs(110),OAt=Qs(oU),DAt=xa($m),MAt=xa(wAt),PAt=xa(wAt),BAt=xa([rp]),xAt(NAt=IAt(NAt=OAt(((KAt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r=0?e:0,i=i>=0?i:0)},i.scrollToPercentHorizontal=function(t,e,i){var n=this._calculateMovePercentDelta({anchor:new Fn(t,0),applyToHorizontal:!0,applyToVertical:!1});e?this._startAutoScroll(n,e,!1!==i):this._moveContent(n)},i.scrollTo=function(t,e,i){var n=this._calculateMovePercentDelta({anchor:new Fn(t),applyToHorizontal:!0,applyToVertical:!0});e?this._startAutoScroll(n,e,i):this._moveContent(n)},i.scrollToPercentVertical=function(t,e,i){var n=this._calculateMovePercentDelta({anchor:new Fn(0,t),applyToHorizontal:!1,applyToVertical:!0});e?this._startAutoScroll(n,e,i):this._moveContent(n)},i.stopAutoScroll=function(){this._autoScrolling=!1,this._autoScrollAccumulatedTime=this._autoScrollTotalTime},i.setContentPosition=function(t){this._setContentPosition(t)},i._setContentPosition=function(t){if(this._content){var e=this._getContentPosition();Math.abs(t.x-e.x)7&&!this._touchMoved&&t.target!==this.node){var r=new MC(t.getTouches(),t.bubbles,bC.TOUCH_CANCEL);r.touch=t.touch,r.simulate=!0,t.target.dispatchEvent(r),this._touchMoved=!0}this._stopPropagationIfTargetIsMe(t)}}},i._onTouchEnded=function(t,e){if(this.enabledInHierarchy&&this._content&&t&&!this._hasNestedViewGroup(t,e)){this._dispatchEvent(QAt.TOUCH_UP);var i=t.touch;this._handleReleaseLogic(i),this._touchMoved?t.propagationStopped=!0:this._stopPropagationIfTargetIsMe(t)}},i._onTouchCancelled=function(t,e){if(this.enabledInHierarchy&&this._content&&!this._hasNestedViewGroup(t,e)){if(t&&!t.simulate){var i=t.touch;this._handleReleaseLogic(i)}this._stopPropagationIfTargetIsMe(t)}},i._calculateBoundary=function(){if(this._content&&this.view){var t=this._content.getComponent(rAt);t&&t.enabledInHierarchy&&t.updateLayout();var e=this.view,i=e.width*e.anchorX,n=e.height*e.anchorY;this._leftBoundary=-i,this._bottomBoundary=-n,this._rightBoundary=this._leftBoundary+e.width,this._topBoundary=this._bottomBoundary+e.height,this._moveContentToTopLeft(e.contentSize)}},i._hasNestedViewGroup=function(t,e){if(!t||t.eventPhase!==wC.CAPTURING_PHASE)return!1;if(e)for(var i,n=d(e);!(i=n()).done;){var r=i.value;if(this.node===r)return!(!t.target||!t.target.getComponent(qAt));if(r.getComponent(qAt))return!0}return!1},i._startInertiaScroll=function(t){var e=new hn(t);e.multiplyScalar(.7),this._startAttenuatingAutoScroll(e,t)},i._calculateAttenuatedFactor=function(t){return this.brake<=0?1-this.brake:(1-this.brake)*(1/(1+14e-6*t+t*t*8e-9))},i._startAttenuatingAutoScroll=function(t,e){var i=t.clone();if(i.normalize(),this._content&&this.view){var n=this._content._uiProps.uiTransformComp.contentSize,r=this.view.contentSize,s=n.width-r.width,a=n.height-r.height,o=this._calculateAttenuatedFactor(s),h=this._calculateAttenuatedFactor(a);i.x=i.x*s*(1-this.brake)*o,i.y=i.y*a*h*(1-this.brake),i.z=0}var u=t.length(),l=i.length()/u;if(i.add(t),this.brake>0&&l>7){l=Math.sqrt(l);var c=t.clone();c.multiplyScalar(l),i.set(c),i.add(t)}var _=this._calculateAutoScrollTimeByInitialSpeed(e.length());this.brake>0&&l>3&&(_*=l=3),0===this.brake&&l>1&&(_*=l),this._startAutoScroll(i,_,!0)},i._calculateAutoScrollTimeByInitialSpeed=function(t){return Math.sqrt(Math.sqrt(t/5))},i._startAutoScroll=function(t,e,i){void 0===i&&(i=!1);var n=this._flattenVectorByDirection(t);this._autoScrolling=!0,this._autoScrollTargetDelta=n,this._autoScrollAttenuate=i,hn.copy(this._autoScrollStartPosition,this._getContentPosition()),this._autoScrollTotalTime=e,this._autoScrollAccumulatedTime=0,this._autoScrollBraking=!1,this._isScrollEndedWithThresholdEventFired=!1,this._autoScrollBrakingStartPosition.set(0,0,0),this._getHowMuchOutOfBoundary().equals(hn.ZERO,JAt)||(this._autoScrollCurrentlyOutOfBoundary=!0)},i._calculateTouchMoveVelocity=function(){var t=new hn,e=0;if((e=this._touchMoveTimeDeltas.reduce((function(t,e){return t+e}),e))<=0||e>=.5)t.set(hn.ZERO);else{var i=new hn;i=this._touchMoveDisplacements.reduce((function(t,e){return t.add(e),t}),i),t.set(i.x*(1-this.brake)/e,i.y*(1-this.brake)/e,i.z)}return t},i._flattenVectorByDirection=function(t){var e=t;return e.x=this.horizontal?e.x:0,e.y=this.vertical?e.y:0,e},i._moveContent=function(t,e){var i=this._flattenVectorByDirection(t);$At.set(this._getContentPosition()),$At.add(i),$At.set(Math.round(1e4*$At.x)*JAt,Math.round(1e4*$At.y)*JAt,$At.z),this._setContentPosition($At);var n=this._getHowMuchOutOfBoundary();eRt.set(n.x,n.y),this._updateScrollBar(eRt),this.elastic&&e&&this._startBounceBackIfNeeded()},i._getContentLeftBoundary=function(){if(!this._content)return-1;var t=this._getContentPosition(),e=this._content._uiProps.uiTransformComp;return t.x-e.anchorX*e.width},i._getContentRightBoundary=function(){if(!this._content)return-1;var t=this._content._uiProps.uiTransformComp;return this._getContentLeftBoundary()+t.width},i._getContentTopBoundary=function(){if(!this._content)return-1;var t=this._content._uiProps.uiTransformComp;return this._getContentBottomBoundary()+t.height},i._getContentBottomBoundary=function(){if(!this._content)return-1;var t=this._getContentPosition(),e=this._content._uiProps.uiTransformComp;return t.y-e.anchorY*e.height},i._getHowMuchOutOfBoundary=function(t){if((t=t||new hn).equals(hn.ZERO,JAt)&&!this._outOfBoundaryAmountDirty)return this._outOfBoundaryAmount;var e=new hn,i=this._getContentLeftBoundary(),n=this._getContentRightBoundary();i+t.x>this._leftBoundary?e.x=this._leftBoundary-(i+t.x):n+t.xthis._bottomBoundary&&(e.y=this._bottomBoundary-(s+t.y)),t.equals(hn.ZERO,JAt)&&(this._outOfBoundaryAmount=e,this._outOfBoundaryAmountDirty=!1),this._clampDelta(e),e},i._updateScrollBar=function(t){this._horizontalScrollBar&&this._horizontalScrollBar.isValid&&this._horizontalScrollBar.onScroll(t),this._verticalScrollBar&&this._verticalScrollBar.isValid&&this._verticalScrollBar.onScroll(t)},i._onScrollBarTouchBegan=function(){this._horizontalScrollBar&&this._horizontalScrollBar.isValid&&this._horizontalScrollBar.onTouchBegan(),this._verticalScrollBar&&this._verticalScrollBar.isValid&&this._verticalScrollBar.onTouchBegan()},i._onScrollBarTouchEnded=function(){this._horizontalScrollBar&&this._horizontalScrollBar.isValid&&this._horizontalScrollBar.onTouchEnded(),this._verticalScrollBar&&this._verticalScrollBar.isValid&&this._verticalScrollBar.onTouchEnded()},i._dispatchEvent=function(t){if(t===QAt.SCROLL_ENDED)this._scrollEventEmitMask=0;else if(t===QAt.SCROLL_TO_TOP||t===QAt.SCROLL_TO_BOTTOM||t===QAt.SCROLL_TO_LEFT||t===QAt.SCROLL_TO_RIGHT){var e=1<0?l.y-o*u+i.y>=this._bottomBoundary&&(n=QAt.SCROLL_TO_BOTTOM):i.y<0&&l.y-o*u+u+i.y<=this._topBoundary&&(n=QAt.SCROLL_TO_TOP)),this.horizontal&&(i.x<0?l.x-a*h+h+i.x<=this._rightBoundary&&(r=QAt.SCROLL_TO_RIGHT):i.x>0&&l.x-a*h+i.x>=this._leftBoundary&&(r=QAt.SCROLL_TO_LEFT))}this._moveContent(i,!1),(this.horizontal&&0!==i.x||this.vertical&&0!==i.y)&&(this._scrolling||(this._scrolling=!0,this._dispatchEvent(QAt.SCROLL_BEGAN)),this._dispatchEvent(QAt.SCROLLING)),n!==QAt.NONE&&this._dispatchEvent(n),r!==QAt.NONE&&this._dispatchEvent(r)},i._handlePressLogic=function(){this._autoScrolling&&this._dispatchEvent(QAt.SCROLL_ENDED),this._autoScrolling=!1,this._isBouncing=!1,this._touchMovePreviousTimestamp=nRt(),this._touchMoveDisplacements.length=0,this._touchMoveTimeDeltas.length=0,this._onScrollBarTouchBegan()},i._clampDelta=function(t){if(this._content&&this.view){var e=this.view.contentSize,i=this._content._uiProps.uiTransformComp;i.width=5;)this._touchMoveDisplacements.shift(),this._touchMoveTimeDeltas.shift();this._touchMoveDisplacements.push(e);var i=nRt();this._touchMoveTimeDeltas.push((i-this._touchMovePreviousTimestamp)/1e3),this._touchMovePreviousTimestamp=i},i._startBounceBackIfNeeded=function(){if(!this.elastic)return!1;var t=this._getHowMuchOutOfBoundary();if(this._clampDelta(t),t.equals(hn.ZERO,JAt))return!1;var e=Math.max(this.bounceDuration,0);return this._startAutoScroll(t,e,!0),this._isBouncing||(t.y>0&&this._dispatchEvent(QAt.BOUNCE_TOP),t.y<0&&this._dispatchEvent(QAt.BOUNCE_BOTTOM),t.x>0&&this._dispatchEvent(QAt.BOUNCE_RIGHT),t.x<0&&this._dispatchEvent(QAt.BOUNCE_LEFT),this._isBouncing=!0),!0},i._processInertiaScroll=function(){if(!this._startBounceBackIfNeeded()&&this.inertia){var t=this._calculateTouchMoveVelocity();!t.equals($At,JAt)&&this.brake<1&&this._startInertiaScroll(t)}this._onScrollBarTouchEnded()},i._isOutOfBoundary=function(){return!this._getHowMuchOutOfBoundary().equals(hn.ZERO,JAt)},i._isNecessaryAutoScrollBrake=function(){if(this._autoScrollBraking)return!0;if(this._isOutOfBoundary()){if(!this._autoScrollCurrentlyOutOfBoundary)return this._autoScrollCurrentlyOutOfBoundary=!0,this._autoScrollBraking=!0,hn.copy(this._autoScrollBrakingStartPosition,this._getContentPosition()),!0}else this._autoScrollCurrentlyOutOfBoundary=!1;return!1},i._processAutoScrolling=function(t){var e=this._isNecessaryAutoScrollBrake(),i=e?.05:1;this._autoScrollAccumulatedTime+=t*(1/i);var n,r=Math.min(1,this._autoScrollAccumulatedTime/this._autoScrollTotalTime);this._autoScrollAttenuate&&(n=r,r=(n-=1)*n*n*n*n+1);var s=this._autoScrollTargetDelta.clone();s.multiplyScalar(r);var a=this._autoScrollStartPosition.clone();a.add(s);var o=Math.abs(r-1)<=JAt;if(Math.abs(r-1)<=this.getScrollEndedEventTiming()&&!this._isScrollEndedWithThresholdEventFired&&(this._dispatchEvent(QAt.SCROLL_ENG_WITH_THRESHOLD),this._isScrollEndedWithThresholdEventFired=!0),this.elastic){var h=a.clone();h.subtract(this._autoScrollBrakingStartPosition),e&&h.multiplyScalar(i),a.set(this._autoScrollBrakingStartPosition),a.add(h)}else{var u=a.clone();u.subtract(this.getContentPosition());var l=this._getHowMuchOutOfBoundary(u);l.equals(hn.ZERO,JAt)||(a.add(l),o=!0)}o&&(this._autoScrolling=!1);var c=a.clone();c.subtract(this._getContentPosition()),this._clampDelta(c),this._moveContent(c,o),this._dispatchEvent(QAt.SCROLLING),this._autoScrolling||(this._isBouncing=!1,this._scrolling=!1,this._dispatchEvent(QAt.SCROLL_ENDED))},i._checkMouseWheel=function(t){if(!this._getHowMuchOutOfBoundary().equals(hn.ZERO,JAt))return this._processInertiaScroll(),this._scrolling&&(this._scrolling=!1,this._autoScrolling||this._dispatchEvent(QAt.SCROLL_ENDED)),this.unschedule(this._checkMouseWheel),void(this._stopMouseWheel=!1);this._mouseWheelEventElapsedTime+=t,this._mouseWheelEventElapsedTime>.1&&(this._onScrollBarTouchEnded(),this._scrolling&&(this._scrolling=!1,this._autoScrolling||this._dispatchEvent(QAt.SCROLL_ENDED)),this.unschedule(this._checkMouseWheel),this._stopMouseWheel=!1)},i._calculateMovePercentDelta=function(t){var e=t.anchor,i=t.applyToHorizontal,n=t.applyToVertical;this._calculateBoundary(),e.clampf(Fn.ZERO,Fn.ONE);var r=this._getContentBottomBoundary()-this._bottomBoundary;r=-r;var s=this._getContentLeftBoundary()-this._leftBoundary;s=-s;var a=new hn;if(this._content&&this.view){var o=0,h=this._content._uiProps.uiTransformComp.contentSize,u=this.view.contentSize;i&&(o=h.width-u.width,a.x=s-o*e.x),n&&(o=h.height-u.height,a.y=r-o*e.y)}return a},i._moveContentToTopLeft=function(t){var e=this._getContentBottomBoundary()-this._bottomBoundary;e=-e;var i=new hn,n=0,r=this._getContentLeftBoundary()-this._leftBoundary;if(r=-r,this._content){var s=this._content._uiProps.uiTransformComp.contentSize;s.height1)for(var n=i[0],r=0;r0){var i=this.node.parent&&this.node.parent._uiProps,n=i&&i.uiTransformComp,r=n?n.contentSize:Dl;this.isAlignLeft&&t===gbt.LEFT?this._left=e?this._left*r.width:this._left/r.width:this.isAlignRight&&t===gbt.RIGHT?this._right=e?this._right*r.width:this._right/r.width:this.isAlignHorizontalCenter&&t===gbt.CENTER?this._horizontalCenter=e?this._horizontalCenter*r.width:this._horizontalCenter/r.width:this.isAlignTop&&t===gbt.TOP?this._top=e?this._top*r.height:this._top/r.height:this.isAlignBottom&&t===gbt.BOT?this._bottom=e?this._bottom*r.height:this._bottom/r.height:this.isAbsoluteVerticalCenter&&t===gbt.MID&&(this._verticalCenter=this._verticalCenter/r.height),this._recursiveDirty()}},i._registerTargetEvents=function(){var t=this._target||this.node.parent;t&&t.getComponent(oU)&&(t.on(um.TRANSFORM_CHANGED,this._setDirtyByMode,this),t.on(um.SIZE_CHANGED,this._setDirtyByMode,this),t.on(um.ANCHOR_CHANGED,this._setDirtyByMode,this))},i._unregisterTargetEvents=function(){var t=this._target||this.node.parent;t&&(t.off(um.TRANSFORM_CHANGED,this._setDirtyByMode,this),t.off(um.SIZE_CHANGED,this._setDirtyByMode,this),t.off(um.ANCHOR_CHANGED,this._setDirtyByMode,this))},i._unregisterOldParentEvents=function(t){var e=this._target||t;e&&(e.off(um.TRANSFORM_CHANGED,this._setDirtyByMode,this),e.off(um.SIZE_CHANGED,this._setDirtyByMode,this))},i._setDirtyByMode=function(){this.alignMode===mbt.ALWAYS&&this._recursiveDirty()},i._setAlign=function(t,e){if(e!==(this._alignFlags&t)>0){var i=(t&Bbt)>0,n=this.node._uiProps.uiTransformComp;e?(this._alignFlags|=t,i?(this.isAlignHorizontalCenter=!1,this.isStretchWidth&&(this._originalWidth=n.width)):(this.isAlignVerticalCenter=!1,this.isStretchHeight&&(this._originalHeight=n.height))):(i?this.isStretchWidth&&(n.width=this._originalWidth):this.isStretchHeight&&(n.height=this._originalHeight),this._alignFlags&=~t)}},i._recursiveDirty=function(){this._dirty||(this._dirty=!0)},n(e,[{key:"target",get:function(){return this._target},set:function(t){this._target!==t&&(this._unregisterTargetEvents(),this._target=t,this._registerTargetEvents(),this._validateTargetInDEV(),this._recursiveDirty())}},{key:"isAlignTop",get:function(){return(this._alignFlags&gbt.TOP)>0},set:function(t){this._setAlign(gbt.TOP,t),this._recursiveDirty()}},{key:"isAlignBottom",get:function(){return(this._alignFlags&gbt.BOT)>0},set:function(t){this._setAlign(gbt.BOT,t),this._recursiveDirty()}},{key:"isAlignLeft",get:function(){return(this._alignFlags&gbt.LEFT)>0},set:function(t){this._setAlign(gbt.LEFT,t),this._recursiveDirty()}},{key:"isAlignRight",get:function(){return(this._alignFlags&gbt.RIGHT)>0},set:function(t){this._setAlign(gbt.RIGHT,t),this._recursiveDirty()}},{key:"isAlignVerticalCenter",get:function(){return(this._alignFlags&gbt.MID)>0},set:function(t){t?(this.isAlignTop=!1,this.isAlignBottom=!1,this._alignFlags|=gbt.MID):this._alignFlags&=~gbt.MID,this._recursiveDirty()}},{key:"isAlignHorizontalCenter",get:function(){return(this._alignFlags&gbt.CENTER)>0},set:function(t){t?(this.isAlignLeft=!1,this.isAlignRight=!1,this._alignFlags|=gbt.CENTER):this._alignFlags&=~gbt.CENTER,this._recursiveDirty()}},{key:"isStretchWidth",get:function(){return(this._alignFlags&Bbt)===Bbt}},{key:"isStretchHeight",get:function(){return(this._alignFlags&Pbt)===Pbt}},{key:"top",get:function(){return this._top},set:function(t){this._top=t,this._recursiveDirty()}},{key:"editorTop",get:function(){return this._isAbsTop?this._top:100*this._top},set:function(t){this._top=this._isAbsTop?t:t/100,this._recursiveDirty()}},{key:"bottom",get:function(){return this._bottom},set:function(t){this._bottom=t,this._recursiveDirty()}},{key:"editorBottom",get:function(){return this._isAbsBottom?this._bottom:100*this._bottom},set:function(t){this._bottom=this._isAbsBottom?t:t/100,this._recursiveDirty()}},{key:"left",get:function(){return this._left},set:function(t){this._left=t,this._recursiveDirty()}},{key:"editorLeft",get:function(){return this._isAbsLeft?this._left:100*this._left},set:function(t){this._left=this._isAbsLeft?t:t/100,this._recursiveDirty()}},{key:"right",get:function(){return this._right},set:function(t){this._right=t,this._recursiveDirty()}},{key:"editorRight",get:function(){return this._isAbsRight?this._right:100*this._right},set:function(t){this._right=this._isAbsRight?t:t/100,this._recursiveDirty()}},{key:"horizontalCenter",get:function(){return this._horizontalCenter},set:function(t){this._horizontalCenter=t,this._recursiveDirty()}},{key:"editorHorizontalCenter",get:function(){return this._isAbsHorizontalCenter?this._horizontalCenter:100*this._horizontalCenter},set:function(t){this._horizontalCenter=this._isAbsHorizontalCenter?t:t/100,this._recursiveDirty()}},{key:"verticalCenter",get:function(){return this._verticalCenter},set:function(t){this._verticalCenter=t,this._recursiveDirty()}},{key:"editorVerticalCenter",get:function(){return this._isAbsVerticalCenter?this._verticalCenter:100*this._verticalCenter},set:function(t){this._verticalCenter=this._isAbsVerticalCenter?t:t/100,this._recursiveDirty()}},{key:"isAbsoluteTop",get:function(){return this._isAbsTop},set:function(t){this._isAbsTop!==t&&(this._isAbsTop=t,this._autoChangedValue(gbt.TOP,this._isAbsTop))}},{key:"isAbsoluteBottom",get:function(){return this._isAbsBottom},set:function(t){this._isAbsBottom!==t&&(this._isAbsBottom=t,this._autoChangedValue(gbt.BOT,this._isAbsBottom))}},{key:"isAbsoluteLeft",get:function(){return this._isAbsLeft},set:function(t){this._isAbsLeft!==t&&(this._isAbsLeft=t,this._autoChangedValue(gbt.LEFT,this._isAbsLeft))}},{key:"isAbsoluteRight",get:function(){return this._isAbsRight},set:function(t){this._isAbsRight!==t&&(this._isAbsRight=t,this._autoChangedValue(gbt.RIGHT,this._isAbsRight))}},{key:"isAbsoluteHorizontalCenter",get:function(){return this._isAbsHorizontalCenter},set:function(t){this._isAbsHorizontalCenter!==t&&(this._isAbsHorizontalCenter=t,this._autoChangedValue(gbt.CENTER,this._isAbsHorizontalCenter))}},{key:"isAbsoluteVerticalCenter",get:function(){return this._isAbsVerticalCenter},set:function(t){this._isAbsVerticalCenter!==t&&(this._isAbsVerticalCenter=t,this._autoChangedValue(gbt.MID,this._isAbsVerticalCenter))}},{key:"alignMode",get:function(){return this._alignMode},set:function(t){this._alignMode=t,this._recursiveDirty()}},{key:"alignFlags",get:function(){return this._alignFlags},set:function(t){this._alignFlags!==t&&(this._alignFlags=t,this._recursiveDirty())}}]),e}(op)).AlignMode=mbt,f((qRt=fbt).prototype,"target",[jRt],Object.getOwnPropertyDescriptor(qRt.prototype,"target"),qRt.prototype),f(qRt.prototype,"alignMode",[YRt],Object.getOwnPropertyDescriptor(qRt.prototype,"alignMode"),qRt.prototype),QRt=Gs(qRt.prototype,"_alignFlags",[ra],(function(){return 0})),ZRt=Gs(qRt.prototype,"_target",[ra],(function(){return null})),JRt=Gs(qRt.prototype,"_left",[ra],(function(){return 0})),$Rt=Gs(qRt.prototype,"_right",[ra],(function(){return 0})),tbt=Gs(qRt.prototype,"_top",[ra],(function(){return 0})),ebt=Gs(qRt.prototype,"_bottom",[ra],(function(){return 0})),ibt=Gs(qRt.prototype,"_horizontalCenter",[ra],(function(){return 0})),nbt=Gs(qRt.prototype,"_verticalCenter",[ra],(function(){return 0})),rbt=Gs(qRt.prototype,"_isAbsLeft",[ra],(function(){return!0})),sbt=Gs(qRt.prototype,"_isAbsRight",[ra],(function(){return!0})),abt=Gs(qRt.prototype,"_isAbsTop",[ra],(function(){return!0})),obt=Gs(qRt.prototype,"_isAbsBottom",[ra],(function(){return!0})),hbt=Gs(qRt.prototype,"_isAbsHorizontalCenter",[ra],(function(){return!0})),ubt=Gs(qRt.prototype,"_isAbsVerticalCenter",[ra],(function(){return!0})),lbt=Gs(qRt.prototype,"_originalWidth",[ra],(function(){return 0})),cbt=Gs(qRt.prototype,"_originalHeight",[ra],(function(){return 0})),_bt=Gs(qRt.prototype,"_alignMode",[ra],(function(){return mbt.ON_WINDOW_RESIZE})),dbt=Gs(qRt.prototype,"_lockFlags",[ra,aa],(function(){return 0})),KRt=qRt))||KRt)||KRt)||KRt));v.internal.computeInverseTransForTarget=Tbt,v.internal.getReadonlyNodeSize=ybt,v.Widget=Nbt;var Lbt,Fbt=new pn;!function(t){t[t.HORIZONTAL=0]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(Lbt||(Lbt={})),Se(Lbt);var kbt,Ubt,Gbt,Hbt,zbt,Vbt,Wbt,Xbt,jbt,Ybt,Kbt,qbt,Qbt,Zbt,Jbt,$bt,tCt,eCt,iCt,nCt,rCt,sCt,aCt,oCt,hCt=t("fV",(Sbt=qs("cc.PageViewIndicator"),Ebt=Zs(110),Abt=xa(yF),Rbt=xa(Lbt),bbt=xa(Hn),Sbt(Cbt=Ebt(((Mbt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r=t.length)){for(var i=0;it.length)for(i=0;i0;--i){var n=t[i-1];this.node.removeChild(n),t.splice(i-1,1)}this._layout&&this._layout.enabledInHierarchy&&this._layout.updateLayout(),this._changedState()}}},n(e,[{key:"spriteFrame",get:function(){return this._spriteFrame},set:function(t){this._spriteFrame!==t&&(this._spriteFrame=t)}},{key:"direction",get:function(){return this._direction},set:function(t){this._direction!==t&&(this._direction=t)}},{key:"cellSize",get:function(){return this._cellSize},set:function(t){this._cellSize!==t&&(this._cellSize=t)}}]),e}(op)).Direction=Lbt,f((wbt=Mbt).prototype,"spriteFrame",[Abt],Object.getOwnPropertyDescriptor(wbt.prototype,"spriteFrame"),wbt.prototype),f(wbt.prototype,"direction",[Rbt],Object.getOwnPropertyDescriptor(wbt.prototype,"direction"),wbt.prototype),f(wbt.prototype,"cellSize",[bbt],Object.getOwnPropertyDescriptor(wbt.prototype,"cellSize"),wbt.prototype),xbt=Gs(wbt.prototype,"spacing",[ra],(function(){return 0})),Ibt=Gs(wbt.prototype,"_spriteFrame",[ra],(function(){return null})),Obt=Gs(wbt.prototype,"_direction",[ra],(function(){return Lbt.HORIZONTAL})),Dbt=Gs(wbt.prototype,"_cellSize",[ra],(function(){return new Hn(20,20)})),Cbt=wbt))||Cbt)||Cbt));v.PageViewIndicator=hCt;var uCt,lCt,cCt,_Ct=new Fn;!function(t){t[t.Unified=0]="Unified",t[t.Free=1]="Free"}(uCt||(uCt={})),Se(uCt),function(t){t[t.Horizontal=0]="Horizontal",t[t.Vertical=1]="Vertical"}(lCt||(lCt={})),Se(lCt),function(t){t.PAGE_TURNING="page-turning"}(cCt||(cCt={}));var dCt=t("fU",(kbt=qs("cc.PageView"),Ubt=Zs(110),Gbt=xa(uCt),Hbt=xa(lCt),zbt=xa(hCt),Vbt=xa(wAt),Wbt=xa(wAt),Xbt=xa([rp]),jbt=xa([rp]),kbt(Ybt=Ubt(((oCt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r=this._pages.length)this.addPage(t);else{if(!t._uiProps.uiTransformComp)return void Y(4301);this._pages.splice(e,0,t),this.content.insertChild(t,e),this._updatePageView()}},i.removePage=function(t){if(t&&this.content){var e=this._pages.indexOf(t);-1!==e?this.removePageAtIndex(e):q(4300,t.name)}},i.removePageAtIndex=function(t){var e=this._pages;if(!(t<0||t>=e.length)){var i=e[t];i&&this.content&&(this.content.removeChild(i),e.splice(t,1),this._updatePageView())}},i.removeAllPages=function(){if(this.content){for(var t=this._pages,e=0,i=t.length;e=this._pages.length||(this._curPageIdx=t,this.scrollToOffset(this._moveOffsetValue(t),e,!0),this.indicator&&this.indicator._changedState())},i.getScrollEndedEventTiming=function(){return this.pageTurningEventTiming},i._updatePageView=function(){if(this.content){var t=this.content.getComponent(rAt);t&&t.enabled&&t.updateLayout();var e=this._pages.length;this._curPageIdx>=e&&(this._curPageIdx=0===e?0:e-1,this._lastPageIdx=this._curPageIdx);for(var i=this._initContentPos,n=0;n0){var i=this._pages[0]._uiProps.uiTransformComp,n=this._pages[this._pages.length-1]._uiProps.uiTransformComp;this.direction===lCt.Horizontal?(e.paddingLeft=(t.width-i.width)/2,e.paddingRight=(t.width-n.width)/2):this.direction===lCt.Vertical&&(e.paddingTop=(t.height-i.height)/2,e.paddingBottom=(t.height-n.height)/2)}e.updateLayout()}}},i._initPages=function(){if(this.content){this._initContentPos=this.content.position;for(var t=this.content.children,e=0;e=0||this._pages.push(i)}this._syncScrollDirection(),this._syncSizeMode(),this._updatePageView()}},i._dispatchPageTurningEvent=function(){this._lastPageIdx!==this._curPageIdx&&(this._lastPageIdx=this._curPageIdx,rp.emitEvents(this.pageEvents,this,cCt.PAGE_TURNING),this.node.emit(cCt.PAGE_TURNING,this))},i._isQuicklyScrollable=function(t){if(this.direction===lCt.Horizontal){if(Math.abs(t.x)>this.autoPageTurningThreshold)return!0}else if(this.direction===lCt.Vertical&&Math.abs(t.y)>this.autoPageTurningThreshold)return!0;return!1},i._moveOffsetValue=function(t){var e=new Fn;if(this._sizeMode===uCt.Free)this.direction===lCt.Horizontal?e.x=this._scrollCenterOffsetX[t]:this.direction===lCt.Vertical&&(e.y=this._scrollCenterOffsetY[t]);else{var i=this.view;if(!i)return e;this.direction===lCt.Horizontal?e.x=t*i.width:this.direction===lCt.Vertical&&(e.y=t*i.height)}return e},i._getDragDirection=function(t){return this._direction===lCt.Horizontal?0===t.x?0:t.x>0?1:-1:0===t.y?0:t.y<0?1:-1},i._isScrollable=function(t,e,i){if(this._sizeMode===uCt.Free){var n=0,r=0;if(this.direction===lCt.Horizontal)return n=this._scrollCenterOffsetX[e],r=this._scrollCenterOffsetX[i],Math.abs(t.x)>=Math.abs(n-r)*this.scrollThreshold;if(this.direction===lCt.Vertical)return n=this._scrollCenterOffsetY[e],r=this._scrollCenterOffsetY[i],Math.abs(t.y)>=Math.abs(n-r)*this.scrollThreshold}else{var s=this.view;if(!s)return!1;if(this.direction===lCt.Horizontal)return Math.abs(t.x)>=s.width*this.scrollThreshold;if(this.direction===lCt.Vertical)return Math.abs(t.y)>=s.height*this.scrollThreshold}return!1},i._autoScrollToPage=function(){if(this._startBounceBackIfNeeded()){var t=this._getHowMuchOutOfBoundary();this._clampDelta(t),(t.x>0||t.y<0)&&(this._curPageIdx=0===this._pages.length?0:this._pages.length-1),(t.x<0||t.y>0)&&(this._curPageIdx=0),this.indicator&&this.indicator._changedState()}else{var e=new Fn;Fn.subtract(e,this._touchBeganPosition,this._touchEndPosition);var i=this._curPageIdx,n=i+this._getDragDirection(e),r=this.pageTurningSpeed*Math.abs(i-n);if(n1e-10?e:t}var n=t.node,r=n.parent;if(r){var s=vCt;s.set(0,0);var a=yCt;if(a.set(1,1),t.target&&Tbt(n,r=t.target,s,a),!e)return;var o=r._uiProps&&r._uiProps.uiTransformComp,h=o?o.anchorPoint:pCt,u=n._uiProps.uiTransformComp,l=ybt(r),c=u.anchorPoint,_=n.getPosition(),d=gbt,f=n.getScale(),p=0;if(e&d.LEFT){var m=-h.x*l.width;m+=s.x,m*=a.x,p=_.x-c.x*u.width*Math.abs(f.x)-m,t.isAbsoluteLeft||(p/=l.width),p/=a.x,t.left=i(t.left,p)}if(e&d.RIGHT){var g=(1-h.x)*l.width;g+=s.x,p=(g*=a.x)-(_.x+(1-c.x)*u.width*Math.abs(f.x)),t.isAbsoluteRight||(p/=l.width),p/=a.x,t.right=i(t.right,p)}if(e&d.TOP){var v=(1-h.y)*l.height;v+=s.y,p=(v*=a.y)-(_.y+(1-c.y)*u.height*Math.abs(f.y)),t.isAbsoluteTop||(p/=l.height),p/=a.y,t.top=i(t.top,p)}if(e&d.BOT){var y=-h.y*l.height;y+=s.y,y*=a.y,p=_.y-c.y*u.height*Math.abs(f.y)-y,t.isAbsoluteBottom||(p/=l.height),p/=a.y,t.bottom=i(t.bottom,p)}}},updateAlignment:function t(e){var i=e.parent;i&&$m.isNode(i)&&t(i);var n=e.getComponent(Nbt);n&&i&&TCt(e,n)},AlignMode:mbt,AlignFlags:gbt});gL.on(mL.EVENT_INIT,(function(){bCt.init()}));var CCt,wCt,xCt,ICt,OCt,DCt,MCt,PCt,BCt,NCt,LCt,FCt,kCt=t("fW",qs("cc.SafeArea")(ACt=Zs(110)(ACt=Qs(Nbt)(ACt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.onEnable=function(){this.updateArea(),wl.on("window-resize",this.updateArea,this),wl.on("orientation-change",this.updateArea,this)},i.onDisable=function(){wl.off("window-resize",this.updateArea,this),wl.off("orientation-change",this.updateArea,this)},i.updateArea=function(){var t=this.node.getComponent(Nbt),e=this.node.getComponent(oU);if(t&&e){t.updateAlignment();var i=this.node.position.clone(),n=e.anchorPoint.clone();t.isAlignTop=t.isAlignBottom=t.isAlignLeft=t.isAlignRight=!0;var r=IV.getVisibleSize(),s=r.width,a=r.height,o=Ol.getSafeAreaRect();t.top=a-o.y-o.height,t.bottom=o.y,t.left=o.x,t.right=s-o.x-o.width,t.updateAlignment();var h=this.node.position.clone(),u=n.x-(h.x-i.x)/e.width,l=n.y-(h.y-i.y)/e.height;e.setAnchorPoint(u,l),bCt.add(t)}},e}(op))||ACt)||ACt)||ACt);v.SafeArea=kCt;var UCt,GCt=t("fX",(CCt=qs("cc.UICoordinateTracker"),wCt=Zs(110),xCt=xa($m),ICt=xa(SV),OCt=xa([rp]),CCt(DCt=wCt((f((MCt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r0)){var i=this._distance/Math.abs(this._viewPos.z);rp.emitEvents(this.syncEvents,this._transformPos,i)}},i._checkCanMove=function(){this._canMove=!(!this._camera||!this._target)},n(e,[{key:"target",get:function(){return this._target},set:function(t){this._target!==t&&(this._target=t,this._checkCanMove())}},{key:"camera",get:function(){return this._camera},set:function(t){this._camera!==t&&(this._camera=t,this._checkCanMove())}},{key:"useScale",get:function(){return this._useScale},set:function(t){this._useScale!==t&&(this._useScale=t)}},{key:"distance",get:function(){return this._distance},set:function(t){this._distance!==t&&(this._distance=t)}}]),e}(op)).prototype,"target",[xCt],Object.getOwnPropertyDescriptor(MCt.prototype,"target"),MCt.prototype),f(MCt.prototype,"camera",[ICt],Object.getOwnPropertyDescriptor(MCt.prototype,"camera"),MCt.prototype),PCt=Gs(MCt.prototype,"syncEvents",[OCt,ra],(function(){return[]})),BCt=Gs(MCt.prototype,"_target",[ra],(function(){return null})),NCt=Gs(MCt.prototype,"_camera",[ra],(function(){return null})),LCt=Gs(MCt.prototype,"_useScale",[ra],(function(){return!0})),FCt=Gs(MCt.prototype,"_distance",[ra],(function(){return 1})),DCt=MCt))||DCt)||DCt)),HCt=[um.TOUCH_START,um.TOUCH_END,um.TOUCH_MOVE,um.MOUSE_DOWN,um.MOUSE_MOVE,um.MOUSE_UP,um.MOUSE_ENTER,um.MOUSE_LEAVE,um.MOUSE_WHEEL];function zCt(t){t.propagationStopped=!0}var VCt,WCt,XCt,jCt,YCt,KCt=t("fY",qs("cc.BlockInputEvents")(UCt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.onEnable=function(){for(var t=0;tn?n:i;e.width*=r,e.height*=r;var s=IV.getViewportRect(),a=e.getBoundingBoxToWorld(),o=IV.getVisibleSize(),h=wl.devicePixelRatio,u=(s.width*(a.x/o.width)+s.x)/h,l=(s.height*(a.y/o.height)+s.y)/h,c=s.width*(a.width/o.width)/h,_=s.height*(a.height/o.height)/h;this._openDataContext.postMessage({fromEngine:!0,type:"engine",event:"viewport",x:u,y:l,width:c,height:_})}},i._updateSubContextTexture=function(){var t=this._imageAsset;if(t&&this._openDataContext&&!(t.width<=0||t.height<=0)){var e=this._openDataContext.canvas;t.reset(e),(e.width>t.width||e.height>t.height)&&this._texture.create(e.width,e.height),this._texture.uploadData(e)}},i._registerNodeEvent=function(){this.node.on(um.TRANSFORM_CHANGED,this._updateSubContextView,this),this.node.on(um.SIZE_CHANGED,this._updateSubContextView,this),this.node.on(um.LAYER_CHANGED,this._updateContentLayer,this)},i._unregisterNodeEvent=function(){this.node.off(um.TRANSFORM_CHANGED,this._updateSubContextView,this),this.node.off(um.SIZE_CHANGED,this._updateSubContextView,this),this.node.off(um.LAYER_CHANGED,this._updateContentLayer,this)},i._updateContentLayer=function(){this._content.layer=this.node.layer},i.update=function(t){void 0===t?this._updateSubContextTexture():performance.now()-this._updatedTime>=this._updateInterval&&(this._updatedTime+=this._updateInterval,this._updateSubContextTexture())},i.onDestroy=function(){this._content.destroy(),this._texture.destroy(),this._sprite&&this._sprite.destroy(),this._imageAsset.destroy(),this._openDataContext=null},n(e,[{key:"designResolutionSize",get:function(){return this._designResolutionSize},set:function(){}},{key:"fps",get:function(){return this._fps},set:function(t){this._fps!==t&&(this._fps=t,this._updateInterval=1e3/t)}}]),e}(op),XCt=Gs(WCt.prototype,"_fps",[ra],(function(){return 60})),jCt=Gs(WCt.prototype,"_designResolutionSize",[ra],(function(){return new Hn(640,960)})),VCt=WCt))||VCt)||VCt)||VCt);v.SubContextView=qCt,mt({ButtonComponent:{newName:"Button",since:"1.2.0",removed:!1},EditBoxComponent:{newName:"EditBox",since:"1.2.0",removed:!1},LayoutComponent:{newName:"Layout",since:"1.2.0",removed:!1},ProgressBarComponent:{newName:"ProgressBar",since:"1.2.0",removed:!1},ScrollViewComponent:{newName:"ScrollView",since:"1.2.0",removed:!1},ScrollBarComponent:{newName:"ScrollBar",since:"1.2.0",removed:!1},SliderComponent:{newName:"Slider",since:"1.2.0",removed:!1},ToggleComponent:{newName:"Toggle",since:"1.2.0",removed:!1},ToggleContainerComponent:{newName:"ToggleContainer",since:"1.2.0",removed:!1},WidgetComponent:{newName:"Widget",since:"1.2.0",removed:!1},PageViewComponent:{newName:"PageView",since:"1.2.0",removed:!1},PageViewIndicatorComponent:{newName:"PageViewIndicator",since:"1.2.0",removed:!1},SafeAreaComponent:{newName:"SafeArea",since:"1.2.0",removed:!1},UICoordinateTrackerComponent:{newName:"UICoordinateTracker",since:"1.2.0",removed:!1},BlockInputEventsComponent:{newName:"BlockInputEvents",since:"1.2.0",removed:!1}});var QCt=t("g2",qs("cc.UIReorderComponent")(YCt=function(){q(1408,"UIReorderComponent")})||YCt);v.UIReorderComponent=QCt,v.ButtonComponent=ySt,Jt(ySt,"cc.ButtonComponent"),v.EditBoxComponent=zEt,Jt(zEt,"cc.EditBoxComponent"),v.LayoutComponent=rAt,Jt(rAt,"cc.LayoutComponent"),v.ProgressBarComponent=vAt,Jt(vAt,"cc.ProgressBarComponent"),v.ScrollViewComponent=vRt,Jt(vRt,"cc.ScrollViewComponent"),v.ScrollBarComponent=wAt,Jt(wAt,"cc.ScrollBarComponent"),v.SliderComponent=PRt,Jt(PRt,"cc.SliderComponent"),v.ToggleComponent=zRt,Jt(zRt,"cc.ToggleComponent"),v.ToggleContainerComponent=pbt,Jt(pbt,"cc.ToggleContainerComponent"),v.WidgetComponent=Nbt,Jt(Nbt,"cc.WidgetComponent"),v.PageViewComponent=dCt,Jt(dCt,"cc.PageViewComponent"),v.PageViewIndicatorComponent=hCt,Jt(hCt,"cc.PageViewIndicatorComponent"),v.SafeAreaComponent=kCt,Jt(kCt,"cc.SafeAreaComponent"),Jt(GCt,"cc.UICoordinateTrackerComponent"),v.BlockInputEventsComponent=KCt,Jt(KCt,"cc.BlockInputEventsComponent"),st(RV.prototype,"View.prototype",[{name:"isAntiAliasEnabled",suggest:"The API of Texture2d have been largely modified, no alternative"},{name:"enableAntiAlias",suggest:"The API of Texture2d have been largely modified, no alternative"}]),at(RV.prototype,"View.prototype",[{name:"adjustViewportMeta"},{name:"enableAutoFullScreen",suggest:"use screen.requestFullScreen() instead."},{name:"isAutoFullScreenEnabled"},{name:"setCanvasSize",suggest:"setting size in CSS pixels is not recommended, please use screen.windowSize instead."},{name:"getCanvasSize",suggest:"please use screen.windowSize instead."},{name:"getFrameSize",suggest:"getting size in CSS pixels is not recommended, please use screen.windowSize instead."},{name:"setFrameSize",suggest:"setting size in CSS pixels is not recommended, please use screen.windowSize instead."},{name:"getDevicePixelRatio",suggest:"use screen.devicePixelRatio instead."},{name:"convertToLocationInView"},{name:"enableRetina"},{name:"isRetinaEnabled"},{name:"setRealPixelResolution"}])}}}));