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({BitMask:ge,CCClass:Ti,Enum:ye,Eventify:so,WorldNode3DToLocalNodeUI:Oo,WorldNode3DToWorldNodeUI:Po,__checkObsoleteInNamespace__:function(t){return dt||(dt="undefined"==typeof Proxy?{}:new Proxy(t,{get:function(t,e,i){return mt(e),Reflect.get(t,e,i)}})),dt},__checkObsolete__:function(t){for(var e,i=d(t);!(e=i()).done;)mt(e.value)},_resetDebugSetting:H,absMax:qi,absMaxComponent:Ki,applyMixins:function(t,e){e.forEach((function(e){Object.getOwnPropertyNames(e.prototype).forEach((function(i){"constructor"!==i&&Object.defineProperty(t.prototype,i,Object.getOwnPropertyDescriptor(e.prototype,i))}))}))},approx:Oi,assert:U,assertID:tt,assertIsNonNullable:function(){},assertIsTrue:function(){},assertsArrayIndex:me,bezier:Uu,bezierByTime:ic,binarySearch:function(t,e){return na(t,e,0)},binarySearchBy:function(t,e,i){for(var n=0,r=t.length-1,s=r>>>1;n<=r;s=n+r>>>1){var o=t[s];if(i(o,e)<0)r=s-1;else{if(!(i(o,e)>0))return s;n=s+1}}return~n},binarySearchEpsilon:na,ccenum:Se,clamp:Pi,clamp01:Mi,color:Tn,computeRatioByType:wZ,debug:G,debugID:Y,deprecateModuleExportedName:gt,deserialize:rg,enumerableProps:Qi,equals:Di,error:k,errorID:Z,find:Ex,flattenCodeArray:ul,floatToHalf:nn,formerlySerializedAs:Ia,fragmentText:KP,getBaselineOffset:function(){return 0},getEnglishWordPartAtFirst:jP,getEnglishWordPartAtLast:YP,getError:et,getPathFromRoot:function(t,e){for(var i=t,n="";null!==i&&i!==e;)n=i.name+"/"+n,i=i.parent;return n.slice(0,-1)},getSerializationMetadata:function(t){return t[Ra]},getSymbolAt:HP,getSymbolCodeAt:zP,getSymbolLength:GP,getWorldTransformUntilRoot:Pj,halfToFloat:rn,instantiate:F0,inverseLerp:Yi,isCCClassOrFastDefined:Ei,isCCObject:Qs,isDisplayStats:it,isEnglishWordPartAtFirst:function(t){return BP.test(t)},isEnglishWordPartAtLast:function(t){return LP.test(t)},isUnicodeCJK:FP,isUnicodeSpace:kP,isValid:Zs,lerp:Ni,log:B,logID:X,mat4:Un,murmurhash2_32_gc:nl,nextPow2:Wi,pingPong:ji,pseudoRandom:Hi,pseudoRandomRange:zi,pseudoRandomRangeInt:Vi,quat:Mn,random:Fi,randomRange:Ui,randomRangeInt:Gi,rect:Kn,repeat:Xi,safeMeasureText:UP,sampleAnimationCurve:RZ,setDefaultLogTimes:function(t){t>0&&(ct=t)},setDisplayStats:nt,setPropertyEnumType:li,setPropertyEnumTypeOnAttrs:_i,setRandGenerator:ki,shift:function(t,e,i){if(me(t,e),me(t,i),e===i)return t;var n=t[e];if(e65535)<<4,e|=i=((t>>>=e)>255)<<3,e|=i=((t>>>=i)>15)<<2,(e|=i=((t>>>=i)>3)<<1)|(t>>>=i)>>1}function S(t){return 16843009*((t=(858993459&(t-=t>>>1&1431655765))+(t>>>2&858993459))+(t>>>4)&252645135)>>>24}function A(t){var e=32;return(t&=-t)&&e--,65535&t&&(e-=16),16711935&t&&(e-=8),252645135&t&&(e-=4),858993459&t&&(e-=2),1431655765&t&&(e-=1),e}function b(t){return--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,1+(t|=t>>>16)}g.ccwindow=y;var C=new Array(256);!function(t){for(var e=0;e<256;++e){var i=e,n=e,r=7;for(i>>>=1;i;i>>>=1)n<<=1,n|=1&i,--r;t[e]=n<0)-(t<0)},abs:function(t){var e=t>>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:S,countTrailingZeros:A,nextPow2:b,prevPow2:function(t){return t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)-(t>>>1)},parity:function(t){return t^=t>>>16,t^=t>>>8,t^=t>>>4,27030>>>(t&=15)&1},reverse:function(t){return C[255&t]<<24|C[t>>>8&255]<<16|C[t>>>16&255]<<8|C[t>>>24&255]},interleave2:function(t,e){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t&=65535)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e&=65535)|e<<8))|e<<4))|e<<2))|e<<1))<<1},deinterleave2:function(t,e){return(t=65535&((t=16711935&((t=252645135&((t=858993459&((t=t>>>e&1431655765)|t>>>1))|t>>>2))|t>>>4))|t>>>16))<<16>>16},interleave3:function(t,e,i){return t=1227133513&((t=3272356035&((t=251719695&((t=4278190335&((t&=1023)|t<<16))|t<<8))|t<<4))|t<<2),(t|=(e=1227133513&((e=3272356035&((e=251719695&((e=4278190335&((e&=1023)|e<<16))|e<<8))|e<<4))|e<<2))<<1)|(i=1227133513&((i=3272356035&((i=251719695&((i=4278190335&((i&=1023)|i<<16))|i<<8))|i<<4))|i<<2))<<2},deinterleave3:function(t,e){return(t=1023&((t=4278190335&((t=251719695&((t=3272356035&((t=t>>>e&1227133513)|t>>>2))|t>>>4))|t>>>8))|t>>>16))<<22>>22},nextCombination:function(t){var e=t|t-1;return e+1|(~e&-~e)-1>>>A(t)+1}});t("bits",R);var w=y.document,I="https://github.com/cocos/cocos-engine/blob/"+v+"/EngineErrorMap.md",x=null,D=console.log.bind(console),O=D,P=D,M=function(t,e){if(!t){for(var i=arguments.length,n=new Array(i>2?i-2:0),r=2;r2?i-2:0),r=2;rJ.ERROR){var e=function(t){if(m.game.canvas){if(!x){var e=w.createElement("Div");e.setAttribute("id","logInfoDiv"),e.setAttribute("width","200");var i=m.game.canvas.height;e.setAttribute("height",""+i);var n=e.style;n.zIndex="99999",n.position="absolute",n.top=n.left="0",(x=w.createElement("textarea")).setAttribute("rows","20"),x.setAttribute("cols","30"),x.setAttribute("disabled","true");var r=x.style;r.backgroundColor="transparent",r.borderBottom="1px solid #cccccc",r.borderTopWidth=r.borderLeftWidth=r.borderRightWidth="0px",r.borderTopStyle=r.borderLeftStyle=r.borderRightStyle="none",r.padding="0px",r.margin="0px",e.appendChild(x),m.game.canvas.parentNode.appendChild(e)}x.value=x.value+t+"\r\n",x.scrollTop=x.scrollHeight}};P=function(){e("ERROR : "+L.apply(void 0,arguments))},M=function(t,i){if(!t){for(var n=arguments.length,r=new Array(n>2?n-2:0),s=2;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;n1?e-1:0),n=1;n2?i-2:0),r=2;r1?e-1:0),n=1;na.count&&(r("'%s' is deprecated, please use '%s' instead. "+o,t+"."+e,i+"."+n),a.count++)},t("replaceProperty",rt=function(t,e,i){null!=t&&i.forEach((function(i){var n=lt++;_t.set(n,{id:n,count:0,logTimes:void 0!==i.logTimes?i.logTimes:ct});var r=null!=i.target?i.target:t,s=null!=i.newName?i.newName:i.name,o=null!=i.targetName?i.targetName:e,a=r===t,h=i.suggest?"("+i.suggest+")":"";if(null!=i.customFunction)t[i.name]=function(){var t;return at(e,i.name,o,s,F,n,h),(t=i.customFunction).call.apply(t,[this].concat(Array.prototype.slice.call(arguments)))};else if(null!=i.customSetter||null!=i.customGetter){var u=null!=i.customSetter,c=null!=i.customGetter;u&&c?Object.defineProperty(t,i.name,{get:function(){return at(e,i.name,o,s,F,n,h),i.customGetter.call(this)},set:function(t){at(e,i.name,o,s,F,n,h),i.customSetter.call(this,t)},enumerable:!1}):u?Object.defineProperty(t,i.name,{set:function(t){at(e,i.name,o,s,F,n,h),i.customSetter.call(this,t)},enumerable:!1}):c&&Object.defineProperty(t,i.name,{get:function(){return at(e,i.name,o,s,F,n,h),i.customGetter.call(this)},enumerable:!1})}else Object.defineProperty(t,i.name,{get:function(){return at(e,i.name,o,s,F,n,h),a?this[s]:r[s]},set:function(t){at(e,i.name,o,s,F,n,h),a?this[s]=t:r[s]=t},enumerable:!1})}))}),ht=function(t,e,i,n,r){var s=_t.get(n);s&&s.logTimes>s.count&&(i("'%s' has been removed. "+r,t+"."+e),s.count++)},t("removeProperty",st=function(t,e,i){null!=t&&i.forEach((function(i){var n=lt++;_t.set(n,{id:n,count:0,logTimes:void 0!==i.logTimes?i.logTimes:ct});var r=i.suggest?"("+i.suggest+")":"";Object.defineProperty(t,i.name,{get:function(){return ht(e,i.name,k,n,r)},set:function(){ht(e,i.name,k,n,r)},enumerable:!1})}))}),t("markAsWarning",ot=function(){});var dt,ft,pt={};function gt(t){for(var e in t){var i=t[e];pt[e]=i}}function mt(t){var e=pt[t];if(e){var i=e.newName,n=e.since;e.removed?i?Z(16003,t,n,i):Z(16002,t,n):i?q(16001,t,n,i):q(16e3,t,n)}}var vt=function(){function t(t){this.id=0|998*Math.random(),this.prefix=t?t+".":""}return t.prototype.getNewId=function(){return this.prefix+(++this.id).toString()},t}();ft=vt,vt.global=new ft("global");var yt=new vt("TmpCId."),Tt="undefined"==typeof Symbol?"__aliases__":Symbol("[[Aliases]]"),Et="__cid__";function St(t){return"number"==typeof t||t instanceof Number}function At(t){return"string"==typeof t||t instanceof String}function bt(t){for(var e in t)return!1;return!0}var Ct,Rt=(Ct={value:void 0,enumerable:!1,writable:!1,configurable:!0},function(t,e,i,n,r){Ct.value=i,Ct.writable=n,Ct.enumerable=r,Object.defineProperty(t,e,Ct),Ct.value=void 0}),wt=function(){var t={get:void 0,set:void 0,enumerable:!1};return function(e,i,n,r,s,o){void 0===s&&(s=!1),void 0===o&&(o=!1),"boolean"==typeof r&&(console.log("Set `setter` to boolean is deprecated. Please don not use like this again."),s=r,r=void 0),t.get=n,t.set=r,t.enumerable=s,t.configurable=o,Object.defineProperty(e,i,t),t.get=void 0,t.set=void 0}}(),It=function(){var t={get:void 0,enumerable:!1,configurable:!1};return function(e,i,n,r,s){t.get=n,t.enumerable=r,t.configurable=s,Object.defineProperty(e,i,t),t.get=void 0}}(),xt=function(){var t={set:void 0,enumerable:!1,configurable:!1};return function(e,i,n,r,s){t.set=n,t.enumerable=r,t.configurable=s,Object.defineProperty(e,i,t),t.set=void 0}}();function Dt(t){var e=Object.create(null);return t&&(e["."]=1,e["/"]=1,delete e["."],delete e["/"]),e}function Ot(t){if("function"==typeof t){var e=t.prototype;if(e&&e.hasOwnProperty("__classname__")&&e.__classname__)return e.__classname__;var i="";if(t.name&&(i=t.name),t.toString){var n,r=t.toString();(n="["===r.charAt(0)?/\[\w+\s*(\w+)\]/.exec(r):/function\s*(\w+)/.exec(r))&&2===n.length&&(i=n[1])}return"Object"!==i?i:""}return t&&t.constructor?Ot(t.constructor):""}function Pt(t,e,i,n){var r=/([^.]+)$/,s=r.exec(e)[0],o=r.exec(i)[0];function a(){return this[o]}n?wt(t,s,a,(function(t){this[o]=t})):It(t,s,a)}function Mt(t,e,i,n){for(var r in i)Pt(t,e+"."+r,i[r],n)}var Nt=/(%d)|(%s)/,Lt=/%s/;function Bt(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;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}(),oe=function(){function t(t){this.i=0,this.array=t}var e=t.prototype;return e.remove=function(t){var e=this.array.indexOf(t);e>=0&&this.removeAt(e)},e.removeAt=function(t){this.array.splice(t,1),t<=this.i&&--this.i},e.fastRemove=function(t){var e=this.array.indexOf(t);e>=0&&this.fastRemoveAt(e)},e.fastRemoveAt=function(t){var e=this.array;e[t]=e[e.length-1],--e.length,t<=this.i&&--this.i},e.push=function(t){this.array.push(t)},n(t,[{key:"length",get:function(){return this.array.length},set:function(t){this.array.length=t,this.i>=t&&(this.i=t-1)}}]),t}();function ae(t,e){t.splice(e,1)}function he(t,e){var i=t.length;e<0||e>=i||(t[e]=t[i-1],t.length=i-1)}function ue(t,e){var i=t.indexOf(e);return i>=0&&(ae(t,i),!0)}function ce(t,e){var i=t.indexOf(e);i>=0&&(t[i]=t[t.length-1],--t.length)}function le(t,e){var i=t.findIndex(e);if(i>=0){var n=t[i];return ae(t,i),n}}function _e(t,e){return t.indexOf(e)>=0}var de=Object.freeze({__proto__:null,MutableForwardIterator:oe,removeAt:ae,fastRemoveAt:he,remove:ue,fastRemove:ce,removeIf:le,verifyType:function(t,e){if(t&&t.length>0)for(var i,n=d(t);!(i=n()).done;)if(!(i.value instanceof e))return X(1300),!1;return!0},removeArray:function(t,e){for(var i=0,n=e.length;i=0&&t.length,t.length}t("js",pe),ge.isBitMask=function(t){return t&&Object.prototype.hasOwnProperty.call(t,"__bitmask__")},ge.getList=function(t){return t.__bitmask__?t.__bitmask__:ge.update(t)},ge.update=function(t){Array.isArray(t.__bitmask__)||(t.__bitmask__=[]);var e=t.__bitmask__;for(var i in e.length=0,t){var n=t[i];Number.isInteger(n)&&e.push({name:i,value:n})}return e.sort((function(t,e){return t.value-e.value})),e},m.BitMask=ge;var ve=Object.prototype.hasOwnProperty;function ye(t){return"__enums__"in t?t:(Rt(t,"__enums__",null,!0),ye.update(t))}function Te(t){ve.call(t,"__enums__")}function Ee(t){Te(t);var e=t.__enums__||[];e.length=0;var i=!0;for(var n in t){var r=t[n],s=Number.isInteger(r);s||(i=!1),(s||"string"==typeof r&&t[r]!==Number.parseInt(n))&&e.push({name:n,value:r})}return i&&e.sort((function(t,e){return t.value-e.value})),t.__enums__=e,e}function Se(t){"__enums__"in t||Rt(t,"__enums__",null,!0)}ye.update=function(t){for(var e=-1,i=Object.keys(t),n=0;n2?n-2:0),s=2;s1?e-1:0),n=1;ni){var n=e;e=i,i=n}return t=0;n--){var r=i[n];r.hasOwnProperty("__attrs__")&&r.__attrs__||Xe(r,(e=i[n+1])&&e.__attrs__)}return Xe(t,(e=i[0])&&e.__attrs__),t.__attrs__}function Ye(t,e){var i=Ke(t),n=e+We,r={};for(var s in i)s.startsWith(n)&&(r[s.slice(n.length)]=i[s]);return r}function Ke(t){return t.hasOwnProperty("__attrs__")&&t.__attrs__||je(t)}function qe(t,e,i,n){Ke(t)[e+We+i]=n}var Qe=function(){function t(t,e){this.name=t,this.default=e}return t.prototype.toString=function(){return this.name},t}(),Ze=t("CCInteger",new Qe("Integer",0));m.Integer=Ze,m.CCInteger=Ze;var Je=t("CCFloat",new Qe("Float",0));m.Float=Je,m.CCFloat=Je;var $e=t("CCBoolean",new Qe("Boolean",!1));m.Boolean=$e,m.CCBoolean=$e;var ti=t("CCString",new Qe("String",""));function ei(t,e){return function(i,n){var r='"'+Ot(i)+"."+n+'"',s=Ye(i,n),o=s.type;if(o===Ze||o===Je?o="Number":o!==ti&&o!==$e||(o=""+o),o===t){if(s.hasOwnProperty("default")){var a=s.default;if(void 0!==a&&!Array.isArray(a)&&!Ge(a)){var h=typeof a,u=t.toLowerCase();if(h===u)if("object"===u){if(!a||a instanceof s.ctor)return;q(3605,r,Ot(s.ctor))}else"Number"!==t&&q(3606,e,r,t);else{if("function"===h)return;t===ti.default&&null==a?q(3607,r):q(3611,e,r,h)}delete s.type}}}else q(3604,r)}}m.String=ti,m.CCString=ti;var ii=Object.freeze({__proto__:null,DELIMETER:We,createAttrsSingle:Xe,createAttrs:je,attr:Ye,getClassAttrs:Ke,setClassAttr:qe,PrimitiveType:Qe,CCInteger:Ze,CCFloat:Je,CCBoolean:$e,CCString:ti,getTypeChecker_ET:ei,getObjTypeChecker_ET:function(t){return function(e,i){ei("Object","type")(e,i);var n=Ke(e)[i+We+"default"],r=m.Class.getDefault(n);if(!Array.isArray(r)&&Wt(t,m.ValueType)){var s=Ot(t),o=Bt('No need to specify the "type" of "%s.%s" because %s is a child class of ValueType.',Ot(e),i,s);n?B(o):q(3612,o,s,Ot(e),i,s)}}}}),ni={default:{},serializable:{},editorOnly:{},formerlySerializedAs:{}};function ri(t,e,i,n){if(!t.get&&!t.set&&t.hasOwnProperty("default")){var r="_N$"+e;t.get=function(){return this[r]},t.set=function(t){var e=this[r];this[r]=t,i.call(this,e)};var s={};for(var o in n[r]=s,ni){var a=ni[o];t.hasOwnProperty(o)&&(s[o]=t[o],a.canUsedInGet||delete t[o])}}}function si(t,e,i,n){if(Array.isArray(e)){if(!(e.length>0))return Z(5508,i,n);t.type=e=e[0]}"function"==typeof e&&(e===String?t.type=m.String:e===Boolean?t.type=m.Boolean:e===Number&&(t.type=m.Float))}function oi(t,e,i){var n=t||void 0===e?{_short:!0}:{_short:!0,default:e};return i&&(n.type=i),n}function ai(t,e){if(!t||t.constructor!==Object){if(Array.isArray(t)&&t.length>0)return oi(e,[],t);if("function"==typeof t){var i=t;return oi(e,Wt(i,m.ValueType)?new i:null,i)}return t instanceof Qe?oi(e,void 0,t):oi(e,t)}return null}var hi,ui=[];function ci(){return ui[ui.length-1]}function li(t,e,i){_i(Ke(t),e,i)}function _i(t,e,i){t[e+"$_$type"]="Enum",t[e+"$_$enumList"]=ye.getList(i)}m._RF={push:function(t,e,i,n){void 0===i&&(i=e,e=""),ui.push({uuid:e,script:i,module:t,exports:t.exports,beh:null,importMeta:n})},pop:function(){var t=ui.pop(),e=t.module,i=e.exports;if(i===t.exports){for(var n in i)return;e.exports=i=t.cls}},peek:ci},function(t){t[t.STANDALONE=1]="STANDALONE",t[t.IMPLICIT_VISIBLE=2]="IMPLICIT_VISIBLE",t[t.IMPLICIT_SERIALIZABLE=4]="IMPLICIT_SERIALIZABLE"}(hi||(hi={}));var di=We,fi="__ctors__",pi=t("ENUM_TAG","Enum"),gi=t("BITMASK_TAG","BitMask");function mi(t,e,i,n){!function(t,e){!function(t,e){t.indexOf(e)<0&&t.push(e)}(t.__props__,e)}(t,i),Ai(t,n,e,i)}function vi(t,e,i,n){var r=n.get;n.set,r&&(Ai(t,n,e,i),qe(t,i,"serializable",!1))}function yi(t){return"function"==typeof t?t():t}function Ti(t){var e=t.name,i=t.extends,n=function(t,e,i){var n=m.Component,r=ci();if(r&&Wt(e,n)){if(Wt(r.cls,n))return Z(3615),null;t=t||r.script}var s=function(t,e,i){var n=i.ctor;return Rt(n,fi,!0,!0),n.prototype,e&&(n.$super=e),Zt(t,n),n}(t,e,i);if(r)if(Wt(e,n)){var o=r.uuid;o&&qt(o,s),r.cls=s}else Wt(r.cls,n)||(r.cls=s);return s}(e,i,t);e||(e=m.js.getClassName(n)),n._sealed=!0,i&&(i._sealed=!1),function(t,e,i,n){if(t.__props__=[],n&&n.__props__&&(t.__props__=n.__props__.slice()),i)for(var r in function(t,e){for(var i in t){var n=t[i],r=ai(n,!1);if(r&&(n=t[i]=r),n){var s=n.notify;s&&ri(n,i,s,t),"type"in n&&si(n,n.type,e,i)}}}(i,e),i){var s=i[r];s.get||s.set?vi(t,e,r,s):mi(t,e,r,s)}var o=Ke(t);t.__values__=t.__props__.filter((function(t){return!1!==o[t+"$_$serializable"]}))}(n,e,t.properties,i);var r=t.editor;return r&&Wt(i,m.Component)&&m.Component._registerEditorProps(n,r),n}function Ei(t){var e;return null==t||null===(e=t.hasOwnProperty)||void 0===e?void 0:e.call(t,"__values__")}Ti._isCCClass=function(t){var e;return null==t||null===(e=t.hasOwnProperty)||void 0===e?void 0:e.call(t,fi)},Ti.fastDefine=function(t,e,i){Zt(t,e);for(var n=e.__props__=e.__values__=Object.keys(i),r=Ke(e),s=0;s=2&&((r||o())[s+"min"]=c[0],r[s+"max"]=c[1],c.length>2&&(r[s+"step"]=c[2])),u("step","number"),u("userData","object")}Ti.isArray=function(t){return t=yi(t),Array.isArray(t)},Ti.getDefault=yi,Ti.escapeForJS=function(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")},Ti.IDENTIFIER_RE=/^[A-Za-z_$][0-9A-Za-z_$]*$/,Ti.getNewValueTypeCode=!1,m.Class=Ti;var bi=Math.PI/180,Ci=180/Math.PI,Ri=Math.random,wi=t("HALF_PI",.5*Math.PI),Ii=t("TWO_PI",2*Math.PI),xi=t("EPSILON",1e-6);function Di(t,e){return Math.abs(t-e)<=xi*Math.max(1,Math.abs(t),Math.abs(e))}function Oi(t,e,i){return i=i||xi,Math.abs(t-e)<=i}function Pi(t,e,i){if(e>i){var n=e;e=i,i=n}return ti?i:t}function Mi(t){return t<0?0:t>1?1:t}function Ni(t,e,i){return t+(e-t)*i}function Li(t){return t*bi}function Bi(t){return t*Ci}function Fi(){return Ri()}function ki(t){Ri=t}function Ui(t,e){return Fi()*(e-t)+t}function Gi(t,e){return Math.floor(Ui(t,e))}function Hi(t){return(t=(9301*t+49297)%233280)/233280}function zi(t,e,i){return Hi(t)*(i-e)+e}function Vi(t,e,i){return Math.floor(zi(t,e,i))}function Wi(t){return b(t)}function Xi(t,e){return t-Math.floor(t/e)*e}function ji(t,e){return t=Xi(t,2*e),e-Math.abs(t-e)}function Yi(t,e,i){return(i-t)/(e-t)}function Ki(t){return Math.abs(t.x)>Math.abs(t.y)?Math.abs(t.x)>Math.abs(t.z)?t.x:t.z:Math.abs(t.y)>Math.abs(t.z)?t.y:t.z}function qi(t,e){return Math.abs(t)>Math.abs(e)?t:e}function Qi(t,e){e.forEach((function(e){Object.defineProperty(t,e,{enumerable:!0})}))}var Zi,Ji,$i,tn=(Zi=new Float32Array(1),Ji=new Int32Array(Zi.buffer),function(t){Zi[0]=t;var e=Ji[0],i=e>>16&32768,n=2147483647&e,r=n-(112<<23)+4096>>13;return r=n<113<<23?0:r,r=n>=143<<23?31744:r,r=n>255<<23?32256:r,Ji[0]=i|r,Ji[0]}),en=function(){var t=new Float32Array(1),e=new Int32Array(t.buffer);return function(i){var n,r=32767&i,s=r<<13;return 31744!==s?(s+=112<<23,0===r?s=(1048575&s)>>1:32767===r&&(s=2147483647)):s=2139095040,n=(i>>15&1)<<31|s,e[0]=n,t[0]}}();function nn(t){return tn(t)}function rn(t){return en(t)}var sn,on=t("Vec4",function(t){function e(e,i,n,r){var s;return s=t.call(this)||this,"object"==typeof e?(s.x=e.x,s.y=e.y,s.z=e.z,s.w=e.w):(s.x=e||0,s.y=i||0,s.z=n||0,s.w=r||0),s}s(e,t),e.clone=function(t){return new e(t.x,t.y,t.z,t.w)},e.copy=function(t,e){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t},e.set=function(t,e,i,n,r){return t.x=e,t.y=i,t.z=n,t.w=r,t},e.fromColor=function(t,e){return t.x=e.r,t.y=e.g,t.z=e.b,t.w=e.a,t},e.angle=function(t,e){var i=t.y*e.z-t.z*e.y,n=t.z*e.x-t.x*e.z,r=t.x*e.y-t.y*e.x,s=t.x*e.x+t.y*e.y+t.z*e.z;return Math.atan2(Math.sqrt(i*i+n*n+r*r),s)},e.add=function(t,e,i){return t.x=e.x+i.x,t.y=e.y+i.y,t.z=e.z+i.z,t.w=e.w+i.w,t},e.subtract=function(t,e,i){return t.x=e.x-i.x,t.y=e.y-i.y,t.z=e.z-i.z,t.w=e.w-i.w,t},e.multiply=function(t,e,i){return t.x=e.x*i.x,t.y=e.y*i.y,t.z=e.z*i.z,t.w=e.w*i.w,t},e.divide=function(t,e,i){return t.x=e.x/i.x,t.y=e.y/i.y,t.z=e.z/i.z,t.w=e.w/i.w,t},e.ceil=function(t,e){return t.x=Math.ceil(e.x),t.y=Math.ceil(e.y),t.z=Math.ceil(e.z),t.w=Math.ceil(e.w),t},e.floor=function(t,e){return t.x=Math.floor(e.x),t.y=Math.floor(e.y),t.z=Math.floor(e.z),t.w=Math.floor(e.w),t},e.min=function(t,e,i){return t.x=Math.min(e.x,i.x),t.y=Math.min(e.y,i.y),t.z=Math.min(e.z,i.z),t.w=Math.min(e.w,i.w),t},e.max=function(t,e,i){return t.x=Math.max(e.x,i.x),t.y=Math.max(e.y,i.y),t.z=Math.max(e.z,i.z),t.w=Math.max(e.w,i.w),t},e.round=function(t,e){return t.x=Math.round(e.x),t.y=Math.round(e.y),t.z=Math.round(e.z),t.w=Math.round(e.w),t},e.multiplyScalar=function(t,e,i){return t.x=e.x*i,t.y=e.y*i,t.z=e.z*i,t.w=e.w*i,t},e.scaleAndAdd=function(t,e,i,n){return t.x=e.x+i.x*n,t.y=e.y+i.y*n,t.z=e.z+i.z*n,t.w=e.w+i.w*n,t},e.distance=function(t,e){var i=e.x-t.x,n=e.y-t.y,r=e.z-t.z,s=e.w-t.w;return Math.sqrt(i*i+n*n+r*r+s*s)},e.squaredDistance=function(t,e){var i=e.x-t.x,n=e.y-t.y,r=e.z-t.z,s=e.w-t.w;return i*i+n*n+r*r+s*s},e.len=function(t){var e=t.x,i=t.y,n=t.z,r=t.w;return Math.sqrt(e*e+i*i+n*n+r*r)},e.lengthSqr=function(t){var e=t.x,i=t.y,n=t.z,r=t.w;return e*e+i*i+n*n+r*r},e.negate=function(t,e){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t},e.inverse=function(t,e){return t.x=1/e.x,t.y=1/e.y,t.z=1/e.z,t.w=1/e.w,t},e.inverseSafe=function(t,e){var i=e.x,n=e.y,r=e.z,s=e.w;return Math.abs(i)0?(o=1/Math.sqrt(o),t.x=i*o,t.y=n*o,t.z=r*o,t.w=s*o):(t.x=0,t.y=0,t.z=0,t.w=0),t},e.dot=function(t,e){return t.x*e.x+t.y*e.y+t.z*e.z+t.w*e.w},e.lerp=function(t,e,i,n){return t.x=e.x+n*(i.x-e.x),t.y=e.y+n*(i.y-e.y),t.z=e.z+n*(i.z-e.z),t.w=e.w+n*(i.w-e.w),t},e.scale=function(t,e,i){return t.x=e.x*i,t.y=e.y*i,t.z=e.z*i,t.w=e.w*i,t},e.random=function(t,e){e=e||1;var i=2*Fi()*Math.PI,n=2*Fi()-1,r=Math.sqrt(1-n*n);return t.x=r*Math.cos(i)*e,t.y=r*Math.sin(i)*e,t.z=n*e,t.w=0,t},e.transformMat4=function(t,e,i){var n=e.x,r=e.y,s=e.z,o=e.w;return t.x=i.m00*n+i.m04*r+i.m08*s+i.m12*o,t.y=i.m01*n+i.m05*r+i.m09*s+i.m13*o,t.z=i.m02*n+i.m06*r+i.m10*s+i.m14*o,t.w=i.m03*n+i.m07*r+i.m11*s+i.m15*o,t},e.transformAffine=function(t,e,i){var n=e.x,r=e.y,s=e.z,o=e.w;return t.x=i.m00*n+i.m04*r+i.m08*s+i.m12*o,t.y=i.m01*n+i.m05*r+i.m09*s+i.m13*o,t.z=i.m02*n+i.m06*r+i.m10*s+i.m14*o,t.w=e.w,t},e.transformQuat=function(t,e,i){var n=e.x,r=e.y,s=e.z,o=i.x,a=i.y,h=i.z,u=i.w,c=u*n+a*s-h*r,l=u*r+h*n-o*s,_=u*s+o*r-a*n,d=-o*n-a*r-h*s;return t.x=c*u+d*-o+l*-h-_*-a,t.y=l*u+d*-a+_*-o-c*-h,t.z=_*u+d*-h+c*-a-l*-o,t.w=e.w,t},e.toArray=function(t,e,i){return void 0===i&&(i=0),t[i+0]=e.x,t[i+1]=e.y,t[i+2]=e.z,t[i+3]=e.w,t},e.fromArray=function(t,e,i){return void 0===i&&(i=0),t.x=e[i+0],t.y=e[i+1],t.z=e[i+2],t.w=e[i+3],t},e.strictEquals=function(t,e){return t.x===e.x&&t.y===e.y&&t.z===e.z&&t.w===e.w},e.equals=function(t,e,i){return void 0===i&&(i=xi),!(Math.abs(t.x)===1/0||Math.abs(t.y)===1/0||Math.abs(t.z)===1/0||Math.abs(t.w)===1/0||Math.abs(e.x)===1/0||Math.abs(e.y)===1/0||Math.abs(e.z)===1/0||Math.abs(e.w)===1/0)&&Math.abs(t.x-e.x)<=i*Math.max(1,Math.abs(t.x),Math.abs(e.x))&&Math.abs(t.y-e.y)<=i*Math.max(1,Math.abs(t.y),Math.abs(e.y))&&Math.abs(t.z-e.z)<=i*Math.max(1,Math.abs(t.z),Math.abs(e.z))&&Math.abs(t.w-e.w)<=i*Math.max(1,Math.abs(t.w),Math.abs(e.w))};var i=e.prototype;return i.clone=function(){return new e(this.x,this.y,this.z,this.w)},i.set=function(t,e,i,n){return"object"==typeof t?(this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w):(this.x=t||0,this.y=e||0,this.z=i||0,this.w=n||0),this},i.equals=function(t,e){return void 0===e&&(e=xi),Math.abs(this.x-t.x)<=e*Math.max(1,Math.abs(this.x),Math.abs(t.x))&&Math.abs(this.y-t.y)<=e*Math.max(1,Math.abs(this.y),Math.abs(t.y))&&Math.abs(this.z-t.z)<=e*Math.max(1,Math.abs(this.z),Math.abs(t.z))&&Math.abs(this.w-t.w)<=e*Math.max(1,Math.abs(this.w),Math.abs(t.w))},i.equals4f=function(t,e,i,n,r){return void 0===r&&(r=xi),Math.abs(this.x-t)<=r*Math.max(1,Math.abs(this.x),Math.abs(t))&&Math.abs(this.y-e)<=r*Math.max(1,Math.abs(this.y),Math.abs(e))&&Math.abs(this.z-i)<=r*Math.max(1,Math.abs(this.z),Math.abs(i))&&Math.abs(this.w-n)<=r*Math.max(1,Math.abs(this.w),Math.abs(n))},i.strictEquals=function(t){return this.x===t.x&&this.y===t.y&&this.z===t.z&&this.w===t.w},i.strictEquals4f=function(t,e,i,n){return this.x===t&&this.y===e&&this.z===i&&this.w===n},i.lerp=function(t,e){var i=this.x,n=this.y,r=this.z,s=this.w;return this.x=i+e*(t.x-i),this.y=n+e*(t.y-n),this.z=r+e*(t.z-r),this.w=s+e*(t.w-s),this},i.toString=function(){return"("+this.x.toFixed(2)+", "+this.y.toFixed(2)+", "+this.z.toFixed(2)+", "+this.w.toFixed(2)+")"},i.clampf=function(t,e){return this.x=Pi(this.x,t.x,e.x),this.y=Pi(this.y,t.y,e.y),this.z=Pi(this.z,t.z,e.z),this.w=Pi(this.w,t.w,e.w),this},i.add=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this},i.add4f=function(t,e,i,n){return this.x+=t,this.y+=e,this.z+=i,this.w+=n,this},i.subtract=function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this},i.subtract4f=function(t,e,i,n){return this.x-=t,this.y-=e,this.z-=i,this.w-=n,this},i.multiplyScalar=function(t){return"object"==typeof t&&q(16361),this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},i.multiply=function(t){return"object"!=typeof t&&q(16362),this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this},i.multiply4f=function(t,e,i,n){return this.x*=t,this.y*=e,this.z*=i,this.w*=n,this},i.divide=function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this},i.divide4f=function(t,e,i,n){return this.x/=t,this.y/=e,this.z/=i,this.w/=n,this},i.negative=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},i.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},i.cross=function(t){var e=this.x,i=this.y,n=this.z,r=t.x,s=t.y,o=t.z;return this.x=i*o-n*s,this.y=n*r-e*o,this.z=e*s-i*r,this},i.length=function(){var t=this.x,e=this.y,i=this.z,n=this.w;return Math.sqrt(t*t+e*e+i*i+n*n)},i.lengthSqr=function(){var t=this.x,e=this.y,i=this.z,n=this.w;return t*t+e*e+i*i+n*n},i.normalize=function(){var t=this.x,e=this.y,i=this.z,n=this.w,r=t*t+e*e+i*i+n*n;return r>0&&(r=1/Math.sqrt(r),this.x=t*r,this.y=e*r,this.z=i*r,this.w=n*r),this},i.scale=function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},i.transformMat4=function(t){var e=this.x,i=this.y,n=this.z,r=this.w;return this.x=t.m00*e+t.m04*i+t.m08*n+t.m12*r,this.y=t.m01*e+t.m05*i+t.m09*n+t.m13*r,this.z=t.m02*e+t.m06*i+t.m10*n+t.m14*r,this.w=t.m03*e+t.m07*i+t.m11*n+t.m15*r,this},e}(be));function an(t,e,i,n){return new on(t,e,i,n)}$i=on,on.ZERO=Object.freeze(new $i(0,0,0,0)),on.ONE=Object.freeze(new $i(1,1,1,1)),on.NEG_ONE=Object.freeze(new $i(-1,-1,-1,-1)),on.UNIT_X=Object.freeze(new $i(1,0,0,0)),on.UNIT_Y=Object.freeze(new $i(0,1,0,0)),on.UNIT_Z=Object.freeze(new $i(0,0,1,0)),on.UNIT_W=Object.freeze(new $i(0,0,0,1)),Ti.fastDefine("cc.Vec4",on,{x:0,y:0,z:0,w:0}),m.Vec4=on,m.v4=an;var hn,un,cn,ln,_n=t("Vec3",function(t){function e(e,i,n){var r;return r=t.call(this)||this,"object"==typeof e?(r.x=e.x,r.y=e.y,r.z=e.z):(r.x=e||0,r.y=i||0,r.z=n||0),r}s(e,t),e.zero=function(t){return t.x=0,t.y=0,t.z=0,t},e.clone=function(t){return new e(t.x,t.y,t.z)},e.copy=function(t,e){return t.x=e.x,t.y=e.y,t.z=e.z,t},e.set=function(t,e,i,n){return t.x=e,t.y=i,t.z=n,t},e.add=function(t,e,i){return t.x=e.x+i.x,t.y=e.y+i.y,t.z=e.z+i.z,t},e.subtract=function(t,e,i){return t.x=e.x-i.x,t.y=e.y-i.y,t.z=e.z-i.z,t},e.multiply=function(t,e,i){return t.x=e.x*i.x,t.y=e.y*i.y,t.z=e.z*i.z,t},e.divide=function(t,e,i){return t.x=e.x/i.x,t.y=e.y/i.y,t.z=e.z/i.z,t},e.ceil=function(t,e){return t.x=Math.ceil(e.x),t.y=Math.ceil(e.y),t.z=Math.ceil(e.z),t},e.floor=function(t,e){return t.x=Math.floor(e.x),t.y=Math.floor(e.y),t.z=Math.floor(e.z),t},e.min=function(t,e,i){return t.x=Math.min(e.x,i.x),t.y=Math.min(e.y,i.y),t.z=Math.min(e.z,i.z),t},e.max=function(t,e,i){return t.x=Math.max(e.x,i.x),t.y=Math.max(e.y,i.y),t.z=Math.max(e.z,i.z),t},e.round=function(t,e){return t.x=Math.round(e.x),t.y=Math.round(e.y),t.z=Math.round(e.z),t},e.multiplyScalar=function(t,e,i){return t.x=e.x*i,t.y=e.y*i,t.z=e.z*i,t},e.scaleAndAdd=function(t,e,i,n){return t.x=e.x+i.x*n,t.y=e.y+i.y*n,t.z=e.z+i.z*n,t},e.distance=function(t,e){var i=e.x-t.x,n=e.y-t.y,r=e.z-t.z;return Math.sqrt(i*i+n*n+r*r)},e.squaredDistance=function(t,e){var i=e.x-t.x,n=e.y-t.y,r=e.z-t.z;return i*i+n*n+r*r},e.len=function(t){var e=t.x,i=t.y,n=t.z;return Math.sqrt(e*e+i*i+n*n)},e.lengthSqr=function(t){var e=t.x,i=t.y,n=t.z;return e*e+i*i+n*n},e.negate=function(t,e){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t},e.invert=function(t,e){return t.x=1/e.x,t.y=1/e.y,t.z=1/e.z,t},e.invertSafe=function(t,e){var i=e.x,n=e.y,r=e.z;return Math.abs(i)0?(s=1/Math.sqrt(s),t.x=i*s,t.y=n*s,t.z=r*s):(t.x=0,t.y=0,t.z=0),t},e.dot=function(t,e){return t.x*e.x+t.y*e.y+t.z*e.z},e.cross=function(t,e,i){var n=e.x,r=e.y,s=e.z,o=i.x,a=i.y,h=i.z;return t.x=r*h-s*a,t.y=s*o-n*h,t.z=n*a-r*o,t},e.lerp=function(t,e,i,n){return t.x=e.x+n*(i.x-e.x),t.y=e.y+n*(i.y-e.y),t.z=e.z+n*(i.z-e.z),t},e.random=function(t,e){e=e||1;var i=2*Fi()*Math.PI,n=2*Fi()-1,r=Math.sqrt(1-n*n);return t.x=r*Math.cos(i)*e,t.y=r*Math.sin(i)*e,t.z=n*e,t},e.transformMat4=function(t,e,i){var n=e.x,r=e.y,s=e.z,o=i.m03*n+i.m07*r+i.m11*s+i.m15;return o=o?1/o:1,t.x=(i.m00*n+i.m04*r+i.m08*s+i.m12)*o,t.y=(i.m01*n+i.m05*r+i.m09*s+i.m13)*o,t.z=(i.m02*n+i.m06*r+i.m10*s+i.m14)*o,t},e.transformMat4Normal=function(t,e,i){var n=e.x,r=e.y,s=e.z,o=i.m03*n+i.m07*r+i.m11*s;return o=o?1/o:1,t.x=(i.m00*n+i.m04*r+i.m08*s)*o,t.y=(i.m01*n+i.m05*r+i.m09*s)*o,t.z=(i.m02*n+i.m06*r+i.m10*s)*o,t},e.transformMat3=function(t,e,i){var n=e.x,r=e.y,s=e.z;return t.x=n*i.m00+r*i.m03+s*i.m06,t.y=n*i.m01+r*i.m04+s*i.m07,t.z=n*i.m02+r*i.m05+s*i.m08,t},e.transformAffine=function(t,e,i){var n=e.x,r=e.y,s=e.z;return t.x=i.m00*n+i.m04*r+i.m08*s+i.m12,t.y=i.m01*n+i.m05*r+i.m09*s+i.m13,t.z=i.m02*n+i.m06*r+i.m10*s+i.m14,t},e.transformQuat=function(t,e,i){var n=i.w*e.x+i.y*e.z-i.z*e.y,r=i.w*e.y+i.z*e.x-i.x*e.z,s=i.w*e.z+i.x*e.y-i.y*e.x,o=-i.x*e.x-i.y*e.y-i.z*e.z;return t.x=n*i.w+o*-i.x+r*-i.z-s*-i.y,t.y=r*i.w+o*-i.y+s*-i.x-n*-i.z,t.z=s*i.w+o*-i.z+n*-i.y-r*-i.x,t},e.transformRTS=function(t,e,i,n,r){var s=e.x*r.x,o=e.y*r.y,a=e.z*r.z,h=i.w*s+i.y*a-i.z*o,u=i.w*o+i.z*s-i.x*a,c=i.w*a+i.x*o-i.y*s,l=-i.x*s-i.y*o-i.z*a;return t.x=h*i.w+l*-i.x+u*-i.z-c*-i.y+n.x,t.y=u*i.w+l*-i.y+c*-i.x-h*-i.z+n.y,t.z=c*i.w+l*-i.z+h*-i.y-u*-i.x+n.z,t},e.transformInverseRTS=function(t,e,i,n,r){var s=e.x-n.x,o=e.y-n.y,a=e.z-n.z,h=i.w*s-i.y*a+i.z*o,u=i.w*o-i.z*s+i.x*a,c=i.w*a-i.x*o+i.y*s,l=i.x*s+i.y*o+i.z*a;return t.x=(h*i.w+l*i.x+u*i.z-c*i.y)/r.x,t.y=(u*i.w+l*i.y+c*i.x-h*i.z)/r.y,t.z=(c*i.w+l*i.z+h*i.y-u*i.x)/r.z,t},e.rotateX=function(t,e,i,n){var r=e.x-i.x,s=e.y-i.y,o=e.z-i.z,a=Math.cos(n),h=Math.sin(n),u=r,c=s*a-o*h,l=s*h+o*a;return t.x=u+i.x,t.y=c+i.y,t.z=l+i.z,t},e.rotateY=function(t,e,i,n){var r=e.x-i.x,s=e.y-i.y,o=e.z-i.z,a=Math.cos(n),h=Math.sin(n),u=o*h+r*a,c=s,l=o*a-r*h;return t.x=u+i.x,t.y=c+i.y,t.z=l+i.z,t},e.rotateZ=function(t,e,i,n){var r=e.x-i.x,s=e.y-i.y,o=e.z-i.z,a=Math.cos(n),h=Math.sin(n),u=r*a-s*h,c=r*h+s*a,l=o;return t.x=u+i.x,t.y=c+i.y,t.z=l+i.z,t},e.rotateN=function(t,e,i,n,r){var s=e.x-i.x,o=e.y-i.y,a=e.z-i.z,h=n.x,u=n.y,c=n.z,l=Math.cos(r),_=Math.sin(r),d=s*(h*h*(1-l)+l)+o*(h*u*(1-l)-c*_)+a*(h*c*(1-l)+u*_),f=s*(h*u*(1-l)+c*_)+o*(u*u*(1-l)+l)+a*(u*c*(1-l)-h*_),p=s*(h*c*(1-l)-u*_)+o*(u*c*(1-l)+h*_)+a*(c*c*(1-l)+l);return t.x=d+i.x,t.y=f+i.y,t.z=p+i.z,t},e.toArray=function(t,e,i){return void 0===i&&(i=0),t[i+0]=e.x,t[i+1]=e.y,t[i+2]=e.z,t},e.fromArray=function(t,e,i){return void 0===i&&(i=0),t.x=e[i+0],t.y=e[i+1],t.z=e[i+2],t},e.strictEquals=function(t,e){return t.x===e.x&&t.y===e.y&&t.z===e.z},e.equals=function(t,e,i){void 0===i&&(i=xi);var n=t.x,r=t.y,s=t.z,o=e.x,a=e.y,h=e.z;return Math.abs(n-o)<=i*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(r-a)<=i*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(s-h)<=i*Math.max(1,Math.abs(s),Math.abs(h))},e.angle=function(t,e){var i=t.x*t.x+t.y*t.y+t.z*t.z,n=e.x*e.x+e.y*e.y+e.z*e.z;if(0===i||0===n)return 0;var r=(t.x*e.x+t.y*e.y+t.z*e.z)/Math.sqrt(i*n);return r=Pi(r,-1,1),Math.acos(r)},e.projectOnPlane=function(t,i,n){return e.subtract(t,i,e.project(t,i,n))},e.project=function(t,i,n){var r=e.lengthSqr(n);return r<1e-6?e.set(t,0,0,0):e.multiplyScalar(t,n,e.dot(i,n)/r)},e.moveTowards=function(t,e,i,n){var r=i.x-e.x,s=i.y-e.y,o=i.z-e.z,a=r*r+s*s+o*o;if(0===a||n>=0&&a0&&(n=1/Math.sqrt(n),this.x=t*n,this.y=e*n,this.z=i*n),this},i.transformMat4=function(t){var e=this.x,i=this.y,n=this.z,r=t.m03*e+t.m07*i+t.m11*n+t.m15;return r=r?1/r:1,this.x=(t.m00*e+t.m04*i+t.m08*n+t.m12)*r,this.y=(t.m01*e+t.m05*i+t.m09*n+t.m13)*r,this.z=(t.m02*e+t.m06*i+t.m10*n+t.m14)*r,this},i.toVec2=function(){return new m.Vec2(this.x,this.y)},e}(be));function dn(t,e,i){return new _n(t,e,i)}sn=_n,_n.UNIT_X=Object.freeze(new sn(1,0,0)),_n.UNIT_Y=Object.freeze(new sn(0,1,0)),_n.UNIT_Z=Object.freeze(new sn(0,0,1)),_n.RIGHT=Object.freeze(new sn(1,0,0)),_n.UP=Object.freeze(new sn(0,1,0)),_n.FORWARD=Object.freeze(new sn(0,0,-1)),_n.ZERO=Object.freeze(new sn(0,0,0)),_n.ONE=Object.freeze(new sn(1,1,1)),_n.NEG_ONE=Object.freeze(new sn(-1,-1,-1)),_n.slerp=(hn=new sn,un=new sn,cn=new sn,function(t,e,i,n){var r=1e-5,s=sn.len(e),o=sn.len(i);if(s.99999)return sn.lerp(t,e,i,n);if(h<-.99999){var u=sn.multiplyScalar(hn,e,1/s),c=sn.generateOrthogonal(un,u),l=Math.PI*n;return gn(cn,u,c,l),sn.multiplyScalar(t,cn,a),t}var _=h,d=Math.acos(_)*n,f=sn.multiplyScalar(hn,e,1/s),p=sn.multiplyScalar(un,i,1/o);return sn.scaleAndAdd(cn,p,f,-_),sn.normalize(cn,cn),sn.multiplyScalar(cn,cn,Math.sin(d)),sn.scaleAndAdd(cn,cn,f,Math.cos(d)),sn.multiplyScalar(t,cn,a),t}),_n.signedAngle=(ln=new sn,function(t,e,i){var n=sn.angle(t,e),r=sn.cross(ln,t,e);return sn.dot(r,i)<0?-n:n}),Ti.fastDefine("cc.Vec3",_n,{x:0,y:0,z:0}),m.Vec3=_n;var fn,pn,gn=(fn={x:0,y:0,z:0,w:0},function(t,e,i,n){var r=.5*n,s=Math.sin(r);return fn.x=s*i.x,fn.y=s*i.y,fn.z=s*i.z,fn.w=Math.cos(r),_n.transformQuat(t,e,fn),t});m.v3=dn;var mn,vn=1/255,yn=t("Color",function(t){function e(e,i,n,r){var s;return(s=t.call(this)||this)._data=new Uint8ClampedArray(4),"string"==typeof e?s.fromHEX(e):void 0!==i?s.set(e,i,n,r):s.set(e),s}s(e,t),e.clone=function(t){var i=new e;return i.r=t.r,i.g=t.g,i.b=t.b,i.a=t.a,i},e.copy=function(t,e){return t.r=e.r,t.g=e.g,t.b=e.b,t.a=e.a,t},e.set=function(t,e,i,n,r){return t.r=e,t.g=i,t.b=n,t.a=r,t},e.toVec4=function(t,e){return(e=void 0!==e?e:new on).x=t._data[0]*vn,e.y=t._data[1]*vn,e.z=t._data[2]*vn,e.w=t._data[3]*vn,e},e.fromVec4=function(t,i){return(i=void 0===i?new e:i)._data[0]=t.x/vn,i._data[1]=t.y/vn,i._data[2]=t.z/vn,i._data[3]=t.w/vn,i},e.fromHEX=function(t,e){var i;return"string"==typeof e?(6===(e="#"===e[0]?e.substring(1):e).length?e+="FF":3===e.length?e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]+"FF":4===e.length&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]+e[3]+e[3]),i=Number("0x"+e)):(e<16777216&&(e=255+(e<<8)),i=e),t.r=i>>>24,t.g=(16711680&i)>>>16,t.b=(65280&i)>>>8,t.a=255&i,t},e.add=function(t,e,i){return t.r=e.r+i.r,t.g=e.g+i.g,t.b=e.b+i.b,t.a=e.a+i.a,t},e.subtract=function(t,e,i){return t.r=e.r-i.r,t.g=e.g-i.g,t.b=e.b-i.b,t.a=e.a-i.a,t},e.multiply=function(t,e,i){return t.r=e.r*i.r,t.g=e.g*i.g,t.b=e.b*i.b,t.a=e.a*i.a,t},e.divide=function(t,e,i){return t.r=e.r/i.r,t.g=e.g/i.g,t.b=e.b/i.b,t.a=e.a/i.a,t},e.scale=function(t,e,i){return t.r=e.r*i,t.g=e.g*i,t.b=e.b*i,t.a=e.a*i,t},e.lerp=function(t,e,i,n){var r=e.r,s=e.g,o=e.b,a=e.a;return t.r=r+(i.r-r)*n,t.g=s+(i.g-s)*n,t.b=o+(i.b-o)*n,t.a=a+(i.a-a)*n,t},e.toArray=function(t,i,n){void 0===n&&(n=0);var r=i instanceof e||i.a>1?1/255:1;return t[n+0]=i.r*r,t[n+1]=i.g*r,t[n+2]=i.b*r,t[n+3]=i.a*r,t},e.fromArray=function(t,e,i){return void 0===i&&(i=0),e.r=255*t[i+0],e.g=255*t[i+1],e.b=255*t[i+2],e.a=255*t[i+3],e},e.fromUint32=function(t,e){return e>>>=0,t.r=255&e,t.g=e>>8&255,t.b=e>>16&255,t.a=e>>24&255,t},e.toUint32=function(t){return(t.a<<24|t.b<<16|t.g<<8|t.r)>>>0},e.strictEquals=function(t,e){return t.r===e.r&&t.g===e.g&&t.b===e.b&&t.a===e.a},e.equals=function(t,e,i){return void 0===i&&(i=xi),!(Math.abs(t.r)===1/0||Math.abs(t.g)===1/0||Math.abs(t.b)===1/0||Math.abs(t.a)===1/0)&&Math.abs(t.r-e.r)<=i*Math.max(1,Math.abs(t.r),Math.abs(e.r))&&Math.abs(t.g-e.g)<=i*Math.max(1,Math.abs(t.g),Math.abs(e.g))&&Math.abs(t.b-e.b)<=i*Math.max(1,Math.abs(t.b),Math.abs(e.b))&&Math.abs(t.a-e.a)<=i*Math.max(1,Math.abs(t.a),Math.abs(e.a))},e.hex=function(t){return(255*t.r<<24|255*t.g<<16|255*t.b<<8|255*t.a)>>>0};var i=e.prototype;return i.clone=function(){var t=new e;return t._data.set(this._data),t},i.equals=function(t){var e=t;return t&&this._data[0]===e.r&&this._data[1]===e.g&&this._data[2]===e.b&&this._data[3]===e.a},i.lerp=function(t,i){return e.lerp(this,this,t,i),this},i.toString=function(){return"rgba("+this.r.toFixed()+", "+this.g.toFixed()+", "+this.b.toFixed()+", "+this.a.toFixed()+")"},i.toCSS=function(t){return void 0===t&&(t="rgba"),"rgba"===t?"rgba("+this.r+","+this.g+","+this.b+","+(this.a*vn).toFixed(2)+")":"rgb"===t?"rgb("+this.r+","+this.g+","+this.b+")":"#"+this.toHEX(t)},i.fromHEX=function(t){var e;return"string"==typeof t?(6===(t="#"===t[0]?t.substring(1):t).length?t+="FF":3===t.length?t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]+"FF":4===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]+t[3]+t[3]),e=Number("0x"+t)):(t<16777216&&(t=255+(t<<8)),e=t),this.r=e>>>24,this.g=(16711680&e)>>>16,this.b=(65280&e)>>>8,this.a=255&e,this},i.toHEX=function(t){void 0===t&&(t="#rrggbb");var e="0",i=[(this._data[0]<16?e:"")+this._data[0].toString(16),(this._data[1]<16?e:"")+this._data[1].toString(16),(this._data[2]<16?e:"")+this._data[2].toString(16)];return"#rgb"===t?(i[0]=i[0][0],i[1]=i[1][0],i[2]=i[2][0]):"#rrggbbaa"===t&&i.push((this._data[3]<16?e:"")+this._data[3].toString(16)),i.join("")},i.toRGBValue=function(){return this._data[2]<<16|this._data[1]<<8|this._data[0]},i.fromHSV=function(t,e,i){var n=0,r=0,s=0;if(0===e)n=r=s=i;else if(0===i)n=r=s=0;else{1===t&&(t=0),t*=6;var o=Math.floor(t),a=t-o,h=i*(1-e),u=i*(1-e*a),c=i*(1-e*(1-a));switch(o){default:case 0:n=i,r=c,s=h;break;case 1:n=u,r=i,s=h;break;case 2:n=h,r=i,s=c;break;case 3:n=h,r=u,s=i;break;case 4:n=c,r=h,s=i;break;case 5:n=i,r=h,s=u}}return this._data[0]=255*n,this._data[1]=255*r,this._data[2]=255*s,this},i.toHSV=function(){var t=this._data[0]*vn,e=this._data[1]*vn,i=this._data[2]*vn,n={h:0,s:0,v:0},r=Math.max(t,e,i),s=Math.min(t,e,i),o=0;return n.v=r,n.s=r?(r-s)/r:0,n.s?(o=r-s,n.h=t===r?(e-i)/o:e===r?2+(i-t)/o:4+(t-e)/o,n.h/=6,n.h<0&&(n.h+=1)):n.h=0,n},i.set=function(t,e,i,n){if("object"==typeof t){var r,s,o,a,h=t;h._data?this._data.set(h._data):(this._data[0]=null!==(r=h.r)&&void 0!==r?r:0,this._data[1]=null!==(s=h.g)&&void 0!==s?s:0,this._data[2]=null!==(o=h.b)&&void 0!==o?o:0,this._data[3]=null!==(a=h.a)&&void 0!==a?a:255)}else this._data[0]=null!=t?t:0,this._data[1]=null!=e?e:0,this._data[2]=null!=i?i:0,this._data[3]=null!=n?n:255;return this},i.multiply=function(t){return this._data[0]*=t.r/255,this._data[1]*=t.g/255,this._data[2]*=t.b/255,this._data[3]*=t.a/255,this},i.getModifiableProperties=function(){return["r","g","b","a"]},n(e,[{key:"r",get:function(){return this._data[0]},set:function(t){this._data[0]=t}},{key:"g",get:function(){return this._data[1]},set:function(t){this._data[1]=t}},{key:"b",get:function(){return this._data[2]},set:function(t){this._data[2]=t}},{key:"a",get:function(){return this._data[3]},set:function(t){this._data[3]=t}},{key:"x",get:function(){return this._data[0]*vn},set:function(t){this._data[0]=255*t}},{key:"y",get:function(){return this._data[1]*vn},set:function(t){this._data[1]=255*t}},{key:"z",get:function(){return this._data[2]*vn},set:function(t){this._data[2]=255*t}},{key:"w",get:function(){return this._data[3]*vn},set:function(t){this._data[3]=255*t}}]),e}(be));function Tn(t,e,i,n){return new yn(t,e,i,n)}function En(t){var e=t.clone();return e.x=Math.floor(t.x),e.y=Math.floor(t.y),e.z=Math.floor(t.z),e}pn=yn,yn.WHITE=Object.freeze(new pn(255,255,255,255)),yn.GRAY=Object.freeze(new pn(127,127,127,255)),yn.BLACK=Object.freeze(new pn(0,0,0,255)),yn.TRANSPARENT=Object.freeze(new pn(0,0,0,0)),yn.RED=Object.freeze(new pn(255,0,0,255)),yn.GREEN=Object.freeze(new pn(0,255,0,255)),yn.BLUE=Object.freeze(new pn(0,0,255,255)),yn.CYAN=Object.freeze(new pn(0,255,255,255)),yn.MAGENTA=Object.freeze(new pn(255,0,255,255)),yn.YELLOW=Object.freeze(new pn(255,255,0,255)),Ti.fastDefine("cc.Color",yn,{r:0,g:0,b:0,a:255}),m.Color=yn,m.color=Tn;var Sn=t("Mat3",function(t){function e(e,i,n,r,s,o,a,h,u){var c;return void 0===e&&(e=1),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=1),void 0===o&&(o=0),void 0===a&&(a=0),void 0===h&&(h=0),void 0===u&&(u=1),c=t.call(this)||this,"object"==typeof e?(c.m00=e.m00,c.m01=e.m01,c.m02=e.m02,c.m03=e.m03,c.m04=e.m04,c.m05=e.m05,c.m06=e.m06,c.m07=e.m07,c.m08=e.m08):(c.m00=e,c.m01=i,c.m02=n,c.m03=r,c.m04=s,c.m05=o,c.m06=a,c.m07=h,c.m08=u),c}s(e,t),e.clone=function(t){return new e(t.m00,t.m01,t.m02,t.m03,t.m04,t.m05,t.m06,t.m07,t.m08)},e.copy=function(t,e){return t.m00=e.m00,t.m01=e.m01,t.m02=e.m02,t.m03=e.m03,t.m04=e.m04,t.m05=e.m05,t.m06=e.m06,t.m07=e.m07,t.m08=e.m08,t},e.set=function(t,e,i,n,r,s,o,a,h,u){return t.m00=e,t.m01=i,t.m02=n,t.m03=r,t.m04=s,t.m05=o,t.m06=a,t.m07=h,t.m08=u,t},e.identity=function(t){return t.m00=1,t.m01=0,t.m02=0,t.m03=0,t.m04=1,t.m05=0,t.m06=0,t.m07=0,t.m08=1,t},e.transpose=function(t,e){if(t===e){var i=e.m01,n=e.m02,r=e.m05;t.m01=e.m03,t.m02=e.m06,t.m03=i,t.m05=e.m07,t.m06=n,t.m07=r}else t.m00=e.m00,t.m01=e.m03,t.m02=e.m06,t.m03=e.m01,t.m04=e.m04,t.m05=e.m07,t.m06=e.m02,t.m07=e.m05,t.m08=e.m08;return t},e.invert=function(t,e){var i=e.m00,n=e.m01,r=e.m02,s=e.m03,o=e.m04,a=e.m05,h=e.m06,u=e.m07,c=e.m08,l=c*o-a*u,_=-c*s+a*h,d=u*s-o*h,f=i*l+n*_+r*d;return 0===f?(t.m00=0,t.m01=0,t.m02=0,t.m03=0,t.m04=0,t.m05=0,t.m06=0,t.m07=0,t.m08=0,t):(f=1/f,t.m00=l*f,t.m01=(-c*n+r*u)*f,t.m02=(a*n-r*o)*f,t.m03=_*f,t.m04=(c*i-r*h)*f,t.m05=(-a*i+r*s)*f,t.m06=d*f,t.m07=(-u*i+n*h)*f,t.m08=(o*i-n*s)*f,t)},e.determinant=function(t){var e=t.m00,i=t.m01,n=t.m02,r=t.m03,s=t.m04,o=t.m05,a=t.m06,h=t.m07,u=t.m08;return e*(u*s-o*h)+i*(-u*r+o*a)+n*(h*r-s*a)},e.multiply=function(t,e,i){var n=e.m00,r=e.m01,s=e.m02,o=e.m03,a=e.m04,h=e.m05,u=e.m06,c=e.m07,l=e.m08,_=i.m00,d=i.m01,f=i.m02,p=i.m03,g=i.m04,m=i.m05,v=i.m06,y=i.m07,T=i.m08;return t.m00=_*n+d*o+f*u,t.m01=_*r+d*a+f*c,t.m02=_*s+d*h+f*l,t.m03=p*n+g*o+m*u,t.m04=p*r+g*a+m*c,t.m05=p*s+g*h+m*l,t.m06=v*n+y*o+T*u,t.m07=v*r+y*a+T*c,t.m08=v*s+y*h+T*l,t},e.multiplyMat4=function(t,e,i){var n=e.m00,r=e.m01,s=e.m02,o=e.m03,a=e.m04,h=e.m05,u=e.m06,c=e.m07,l=e.m08,_=i.m00,d=i.m01,f=i.m02,p=i.m04,g=i.m05,m=i.m06,v=i.m08,y=i.m09,T=i.m10;return t.m00=_*n+d*o+f*u,t.m01=_*r+d*a+f*c,t.m02=_*s+d*h+f*l,t.m03=p*n+g*o+m*u,t.m04=p*r+g*a+m*c,t.m05=p*s+g*h+m*l,t.m06=v*n+y*o+T*u,t.m07=v*r+y*a+T*c,t.m08=v*s+y*h+T*l,t},e.transform=function(t,e,i){this.translate(t,e,i)},e.translate=function(t,e,i){var n=e.m00,r=e.m01,s=e.m02,o=e.m03,a=e.m04,h=e.m05,u=e.m06,c=e.m07,l=e.m08,_=i.x,d=i.y;return t.m00=n,t.m01=r,t.m02=s,t.m03=o,t.m04=a,t.m05=h,t.m06=_*n+d*o+u,t.m07=_*r+d*a+c,t.m08=_*s+d*h+l,t},e.scale=function(t,e,i){var n=i.x,r=i.y;return t.m00=n*e.m00,t.m01=n*e.m01,t.m02=n*e.m02,t.m03=r*e.m03,t.m04=r*e.m04,t.m05=r*e.m05,t.m06=e.m06,t.m07=e.m07,t.m08=e.m08,t},e.rotate=function(t,e,i){var n=e.m00,r=e.m01,s=e.m02,o=e.m03,a=e.m04,h=e.m05,u=e.m06,c=e.m07,l=e.m08,_=Math.sin(i),d=Math.cos(i);return t.m00=d*n+_*o,t.m01=d*r+_*a,t.m02=d*s+_*h,t.m03=d*o-_*n,t.m04=d*a-_*r,t.m05=d*h-_*s,t.m06=u,t.m07=c,t.m08=l,t},e.fromMat4=function(t,e){return t.m00=e.m00,t.m01=e.m01,t.m02=e.m02,t.m03=e.m04,t.m04=e.m05,t.m05=e.m06,t.m06=e.m08,t.m07=e.m09,t.m08=e.m10,t},e.fromViewUp=function(t,i,n){return _n.lengthSqr(i)-.999?(e.x=Math.asin(-a),e.y=Math.atan2(o,h),e.z=Math.atan2(n,s),!0):(e.x=wi,e.y=Math.atan2(r,i),e.z=0,!1):(e.x=-wi,e.y=Math.atan2(-r,i),e.z=0,!1)};var i=e.prototype;return i.clone=function(){var t=this;return new e(t.m00,t.m01,t.m02,t.m03,t.m04,t.m05,t.m06,t.m07,t.m08)},i.set=function(t,e,i,n,r,s,o,a,h){return void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=1),void 0===s&&(s=0),void 0===o&&(o=0),void 0===a&&(a=0),void 0===h&&(h=1),"object"==typeof t?(this.m00=t.m00,this.m01=t.m01,this.m02=t.m02,this.m03=t.m03,this.m04=t.m04,this.m05=t.m05,this.m06=t.m06,this.m07=t.m07,this.m08=t.m08):(this.m00=t,this.m01=e,this.m02=i,this.m03=n,this.m04=r,this.m05=s,this.m06=o,this.m07=a,this.m08=h),this},i.equals=function(t,e){return void 0===e&&(e=xi),Math.abs(this.m00-t.m00)<=e*Math.max(1,Math.abs(this.m00),Math.abs(t.m00))&&Math.abs(this.m01-t.m01)<=e*Math.max(1,Math.abs(this.m01),Math.abs(t.m01))&&Math.abs(this.m02-t.m02)<=e*Math.max(1,Math.abs(this.m02),Math.abs(t.m02))&&Math.abs(this.m03-t.m03)<=e*Math.max(1,Math.abs(this.m03),Math.abs(t.m03))&&Math.abs(this.m04-t.m04)<=e*Math.max(1,Math.abs(this.m04),Math.abs(t.m04))&&Math.abs(this.m05-t.m05)<=e*Math.max(1,Math.abs(this.m05),Math.abs(t.m05))&&Math.abs(this.m06-t.m06)<=e*Math.max(1,Math.abs(this.m06),Math.abs(t.m06))&&Math.abs(this.m07-t.m07)<=e*Math.max(1,Math.abs(this.m07),Math.abs(t.m07))&&Math.abs(this.m08-t.m08)<=e*Math.max(1,Math.abs(this.m08),Math.abs(t.m08))},i.strictEquals=function(t){return this.m00===t.m00&&this.m01===t.m01&&this.m02===t.m02&&this.m03===t.m03&&this.m04===t.m04&&this.m05===t.m05&&this.m06===t.m06&&this.m07===t.m07&&this.m08===t.m08},i.toString=function(){var t=this;return"[\n"+t.m00+", "+t.m01+", "+t.m02+",\n"+t.m03+",\n"+t.m04+", "+t.m05+",\n"+t.m06+", "+t.m07+",\n"+t.m08+"\n]"},i.identity=function(){return this.m00=1,this.m01=0,this.m02=0,this.m03=0,this.m04=1,this.m05=0,this.m06=0,this.m07=0,this.m08=1,this},i.transpose=function(){var t=this.m01,e=this.m02,i=this.m05;return this.m01=this.m03,this.m02=this.m06,this.m03=t,this.m05=this.m07,this.m06=e,this.m07=i,this},i.invert=function(){var t=this.m00,e=this.m01,i=this.m02,n=this.m03,r=this.m04,s=this.m05,o=this.m06,a=this.m07,h=this.m08,u=h*r-s*a,c=-h*n+s*o,l=a*n-r*o,_=t*u+e*c+i*l;return 0===_?(this.set(0,0,0,0,0,0,0,0,0),this):(_=1/_,this.m00=u*_,this.m01=(-h*e+i*a)*_,this.m02=(s*e-i*r)*_,this.m03=c*_,this.m04=(h*t-i*o)*_,this.m05=(-s*t+i*n)*_,this.m06=l*_,this.m07=(-a*t+e*o)*_,this.m08=(r*t-e*n)*_,this)},i.determinant=function(){var t=this.m00,e=this.m01,i=this.m02,n=this.m03,r=this.m04,s=this.m05,o=this.m06,a=this.m07,h=this.m08;return t*(h*r-s*a)+e*(-h*n+s*o)+i*(a*n-r*o)},i.add=function(t){return this.m00+=t.m00,this.m01+=t.m01,this.m02+=t.m02,this.m03+=t.m03,this.m04+=t.m04,this.m05+=t.m05,this.m06+=t.m06,this.m07+=t.m07,this.m08+=t.m08,this},i.subtract=function(t){return this.m00-=t.m00,this.m01-=t.m01,this.m02-=t.m02,this.m03-=t.m03,this.m04-=t.m04,this.m05-=t.m05,this.m06-=t.m06,this.m07-=t.m07,this.m08-=t.m08,this},i.multiply=function(t){var e=this.m00,i=this.m01,n=this.m02,r=this.m03,s=this.m04,o=this.m05,a=this.m06,h=this.m07,u=this.m08,c=t.m00,l=t.m01,_=t.m02,d=t.m03,f=t.m04,p=t.m05,g=t.m06,m=t.m07,v=t.m08;return this.m00=c*e+l*r+_*a,this.m01=c*i+l*s+_*h,this.m02=c*n+l*o+_*u,this.m03=d*e+f*r+p*a,this.m04=d*i+f*s+p*h,this.m05=d*n+f*o+p*u,this.m06=g*e+m*r+v*a,this.m07=g*i+m*s+v*h,this.m08=g*n+m*o+v*u,this},i.multiplyScalar=function(t){return this.m00*=t,this.m01*=t,this.m02*=t,this.m03*=t,this.m04*=t,this.m05*=t,this.m06*=t,this.m07*=t,this.m08*=t,this},i.scale=function(t){var e=t.x,i=t.y;return this.m00*=e,this.m01*=e,this.m02*=e,this.m03*=i,this.m04*=i,this.m05*=i,this},i.rotate=function(t){var e=this.m00,i=this.m01,n=this.m02,r=this.m03,s=this.m04,o=this.m05,a=this.m06,h=this.m07,u=this.m08,c=Math.sin(t),l=Math.cos(t);return this.m00=l*e+c*r,this.m01=l*i+c*s,this.m02=l*n+c*o,this.m03=l*r-c*e,this.m04=l*s-c*i,this.m05=l*o-c*n,this.m06=a,this.m07=h,this.m08=u,this},i.fromQuat=function(t){var e=t.x,i=t.y,n=t.z,r=t.w,s=e+e,o=i+i,a=n+n,h=e*s,u=i*s,c=i*o,l=n*s,_=n*o,d=n*a,f=r*s,p=r*o,g=r*a;return this.m00=1-c-d,this.m03=u-g,this.m06=l+p,this.m01=u+g,this.m04=1-h-d,this.m07=_-f,this.m02=l-p,this.m05=_+f,this.m08=1-h-c,this},e}(be));mn=Sn,Sn.IDENTITY=Object.freeze(new mn);var An,bn=new _n,Cn=new _n;Ti.fastDefine("cc.Mat3",Sn,{m00:1,m01:0,m02:0,m03:0,m04:1,m05:0,m06:0,m07:0,m08:1}),m.Mat3=Sn;var Rn=t("Quat",function(t){function e(e,i,n,r){var s;return s=t.call(this)||this,"object"==typeof e?(s.x=e.x,s.y=e.y,s.z=e.z,s.w=e.w):(s.x=e||0,s.y=i||0,s.z=n||0,s.w=null!=r?r:1),s}s(e,t),e.clone=function(t){return new e(t.x,t.y,t.z,t.w)},e.copy=function(t,e){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t},e.set=function(t,e,i,n,r){return t.x=e,t.y=i,t.z=n,t.w=r,t},e.identity=function(t){return t.x=0,t.y=0,t.z=0,t.w=1,t},e.rotationTo=function(t,i,n){var r=_n.dot(i,n);return r<-.999999?(_n.cross(Dn,_n.UNIT_X,i),Dn.length()<1e-6&&_n.cross(Dn,_n.UNIT_Y,i),_n.normalize(Dn,Dn),e.fromAxisAngle(t,Dn,Math.PI),t):r>.999999?(t.x=0,t.y=0,t.z=0,t.w=1,t):(_n.cross(Dn,i,n),t.x=Dn.x,t.y=Dn.y,t.z=Dn.z,t.w=1+r,e.normalize(t,t))},e.getAxisAngle=function(t,e){var i=2*Math.acos(e.w),n=Math.sin(i/2);return 0!==n?(t.x=e.x/n,t.y=e.y/n,t.z=e.z/n):(t.x=1,t.y=0,t.z=0),i},e.multiply=function(t,e,i){var n=e.x*i.w+e.w*i.x+e.y*i.z-e.z*i.y,r=e.y*i.w+e.w*i.y+e.z*i.x-e.x*i.z,s=e.z*i.w+e.w*i.z+e.x*i.y-e.y*i.x,o=e.w*i.w-e.x*i.x-e.y*i.y-e.z*i.z;return t.x=n,t.y=r,t.z=s,t.w=o,t},e.multiplyScalar=function(t,e,i){return t.x=e.x*i,t.y=e.y*i,t.z=e.z*i,t.w=e.w*i,t},e.scaleAndAdd=function(t,e,i,n){return t.x=e.x+i.x*n,t.y=e.y+i.y*n,t.z=e.z+i.z*n,t.w=e.w+i.w*n,t},e.rotateX=function(t,e,i){i*=.5;var n=Math.sin(i),r=Math.cos(i),s=e.x,o=e.y,a=e.z,h=e.w;return t.x=s*r+h*n,t.y=o*r+a*n,t.z=a*r-o*n,t.w=h*r-s*n,t},e.rotateY=function(t,e,i){i*=.5;var n=Math.sin(i),r=Math.cos(i),s=e.x,o=e.y,a=e.z,h=e.w;return t.x=s*r-a*n,t.y=o*r+h*n,t.z=a*r+s*n,t.w=h*r-o*n,t},e.rotateZ=function(t,e,i){i*=.5;var n=Math.sin(i),r=Math.cos(i),s=e.x,o=e.y,a=e.z,h=e.w;return t.x=s*r+o*n,t.y=o*r-s*n,t.z=a*r+h*n,t.w=h*r-a*n,t},e.rotateAround=function(t,i,n,r){return e.invert(In,i),_n.transformQuat(Dn,n,In),e.fromAxisAngle(In,Dn,r),e.multiply(t,i,In),t},e.rotateAroundLocal=function(t,i,n,r){return e.fromAxisAngle(In,n,r),e.multiply(t,i,In),t},e.calculateW=function(t,e){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=Math.sqrt(Math.abs(1-e.x*e.x-e.y*e.y-e.z*e.z)),t},e.dot=function(t,e){return t.x*e.x+t.y*e.y+t.z*e.z+t.w*e.w},e.lerp=function(t,e,i,n){return t.x=e.x+n*(i.x-e.x),t.y=e.y+n*(i.y-e.y),t.z=e.z+n*(i.z-e.z),t.w=e.w+n*(i.w-e.w),t},e.slerp=function(t,e,i,n){var r=0,s=0,o=i.x,a=i.y,h=i.z,u=i.w,c=e.x*i.x+e.y*i.y+e.z*i.z+e.w*i.w;if(c<0&&(c=-c,o=-o,a=-a,h=-h,u=-u),1-c>1e-6){var l=Math.acos(c),_=Math.sin(l);r=Math.sin((1-n)*l)/_,s=Math.sin(n*l)/_}else r=1-n,s=n;return t.x=r*e.x+s*o,t.y=r*e.y+s*a,t.z=r*e.z+s*h,t.w=r*e.w+s*u,t},e.sqlerp=function(t,i,n,r,s,o){return e.slerp(In,i,s,o),e.slerp(xn,n,r,o),e.slerp(t,In,xn,2*o*(1-o)),t},e.invert=function(t,e){var i=e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w,n=i?1/i:0;return t.x=-e.x*n,t.y=-e.y*n,t.z=-e.z*n,t.w=e.w*n,t},e.conjugate=function(t,e){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=e.w,t},e.len=function(t){return Math.sqrt(t.x*t.x+t.y*t.y+t.z*t.z+t.w*t.w)},e.lengthSqr=function(t){return t.x*t.x+t.y*t.y+t.z*t.z+t.w*t.w},e.normalize=function(t,e){var i=e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w;return i>0?(i=1/Math.sqrt(i),t.x=e.x*i,t.y=e.y*i,t.z=e.z*i,t.w=e.w*i):(t.x=0,t.y=0,t.z=0,t.w=0),t},e.fromAxes=function(t,i,n,r){return Sn.set(On,i.x,i.y,i.z,n.x,n.y,n.z,r.x,r.y,r.z),e.normalize(t,e.fromMat3(t,On))},e.fromViewUp=function(t,i,n){return Sn.fromViewUp(On,i,n),e.normalize(t,e.fromMat3(t,On))},e.fromAxisAngle=function(t,e,i){i*=.5;var n=Math.sin(i);return t.x=n*e.x,t.y=n*e.y,t.z=n*e.z,t.w=Math.cos(i),t},e.fromMat3=function(t,e){var i=e.m00,n=e.m01,r=e.m02,s=e.m03,o=e.m04,a=e.m05,h=e.m06,u=e.m07,c=e.m08,l=i-o-c,_=o-i-c,d=c-i-o,f=0,p=i+o+c;l>p&&(p=l,f=1),_>p&&(p=_,f=2),d>p&&(p=d,f=3);var g=.5*Math.sqrt(p+1),m=.25/g;switch(f){case 0:t.w=g,t.x=(a-u)*m,t.y=(h-r)*m,t.z=(n-s)*m;break;case 1:t.w=(a-u)*m,t.x=g,t.y=(n+s)*m,t.z=(h+r)*m;break;case 2:t.w=(h-r)*m,t.x=(n+s)*m,t.y=g,t.z=(a+u)*m;break;case 3:t.w=(n-s)*m,t.x=(h+r)*m,t.y=(a+u)*m,t.z=g;break;default:t.w=1,t.x=0,t.y=0,t.z=0}return t},e.fromEuler=function(t,e,i,n){e*=Pn,i*=Pn,n*=Pn;var r=Math.sin(e),s=Math.cos(e),o=Math.sin(i),a=Math.cos(i),h=Math.sin(n),u=Math.cos(n);return t.x=r*a*u+s*o*h,t.y=s*o*u+r*a*h,t.z=s*a*h-r*o*u,t.w=s*a*u-r*o*h,t},e.fromAngleZ=function(t,e){return e*=Pn,t.x=t.y=0,t.z=Math.sin(e),t.w=Math.cos(e),t},e.toAxisX=function(t,e){var i=2*e.y,n=2*e.z;return t.x=1-i*e.y-n*e.z,t.y=i*e.x+n*e.w,t.z=n*e.x-i*e.w,t},e.toAxisY=function(t,e){var i=2*e.x,n=2*e.y,r=2*e.z;return t.x=n*e.x-r*e.w,t.y=1-i*e.x-r*e.z,t.z=r*e.y+i*e.w,t},e.toAxisZ=function(t,e){var i=2*e.x,n=2*e.y,r=2*e.z;return t.x=r*e.x+n*e.w,t.y=r*e.y-i*e.w,t.z=1-i*e.x-n*e.y,t},e.toEuler=function(t,e,i){var n=e.x,r=e.y,s=e.z,o=e.w,a=0,h=0,u=0,c=n*r+s*o;if(c>.499999)a=0,h=Bi(2*Math.atan2(n,o)),u=90;else if(c<-.499999)a=0,h=-Bi(2*Math.atan2(n,o)),u=-90;else{var l=n*n,_=r*r,d=s*s;a=Bi(Math.atan2(2*n*o-2*r*s,1-2*l-2*d)),h=Bi(Math.atan2(2*r*o-2*n*s,1-2*_-2*d)),u=Bi(Math.asin(2*c)),i&&(a=-180*Math.sign(a+1e-6)+a,h=-180*Math.sign(h+1e-6)+h,u=180*Math.sign(u+1e-6)-u)}return t.x=a,t.y=h,t.z=u,t},e.toEulerInYXZOrder=function(t,e){Sn.fromQuat(On,e),Sn.toEuler(On,t),t.x=Bi(t.x),t.y=Bi(t.y),t.z=Bi(t.z)},e.toArray=function(t,e,i){return void 0===i&&(i=0),t[i+0]=e.x,t[i+1]=e.y,t[i+2]=e.z,t[i+3]=e.w,t},e.fromArray=function(t,e,i){return void 0===i&&(i=0),t.x=e[i+0],t.y=e[i+1],t.z=e[i+2],t.w=e[i+3],t},e.strictEquals=function(t,e){return t.x===e.x&&t.y===e.y&&t.z===e.z&&t.w===e.w},e.equals=function(t,e,i){return void 0===i&&(i=xi),Math.abs(t.x-e.x)<=i*Math.max(1,Math.abs(t.x),Math.abs(e.x))&&Math.abs(t.y-e.y)<=i*Math.max(1,Math.abs(t.y),Math.abs(e.y))&&Math.abs(t.z-e.z)<=i*Math.max(1,Math.abs(t.z),Math.abs(e.z))&&Math.abs(t.w-e.w)<=i*Math.max(1,Math.abs(t.w),Math.abs(e.w))},e.angle=function(t,i){var n=Math.min(Math.abs(e.dot(t,i)),1);return 2*Math.acos(n)},e.rotateTowards=function(t,i,n,r){var s=e.angle(i,n);if(0===s)return t.x=n.x,t.y=n.y,t.z=n.z,t.w=n.w,t;var o=Math.min(r/Bi(s),1);return e.slerp(t,i,n,o)};var i=e.prototype;return i.clone=function(){return new e(this.x,this.y,this.z,this.w)},i.set=function(t,e,i,n){return"object"==typeof t?(this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w):(this.x=t||0,this.y=e||0,this.z=i||0,this.w=null!=n?n:1),this},i.equals=function(t,e){return void 0===e&&(e=xi),Math.abs(this.x-t.x)<=e*Math.max(1,Math.abs(this.x),Math.abs(t.x))&&Math.abs(this.y-t.y)<=e*Math.max(1,Math.abs(this.y),Math.abs(t.y))&&Math.abs(this.z-t.z)<=e*Math.max(1,Math.abs(this.z),Math.abs(t.z))&&Math.abs(this.w-t.w)<=e*Math.max(1,Math.abs(this.w),Math.abs(t.w))},i.strictEquals=function(t){return t&&this.x===t.x&&this.y===t.y&&this.z===t.z&&this.w===t.w},i.getEulerAngles=function(t){return e.toEuler(t,this)},i.lerp=function(t,e){return this.x+=e*(t.x-this.x),this.y+=e*(t.y-this.y),this.z+=e*(t.z-this.z),this.w+=e*(t.w-this.w),this},i.slerp=function(t,i){return e.slerp(this,this,t,i)},i.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},i.lengthSqr=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},e}(be));An=Rn,Rn.IDENTITY=Object.freeze(new An);var wn,In=new Rn,xn=new Rn,Dn=new _n,On=new Sn,Pn=.5*Math.PI/180;function Mn(t,e,i,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1),new Rn(t,e,i,n)}Ti.fastDefine("cc.Quat",Rn,{x:0,y:0,z:0,w:1}),m.Quat=Rn,m.quat=Mn;var Nn=t("preTransforms",Object.freeze([Object.freeze([1,0,0,1]),Object.freeze([0,1,-1,0]),Object.freeze([-1,0,0,-1]),Object.freeze([0,-1,1,0])])),Ln=t("Mat4",function(t){function e(e,i,n,r,s,o,a,h,u,c,l,_,d,f,p,g){var m;return void 0===e&&(e=1),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=0),void 0===o&&(o=1),void 0===a&&(a=0),void 0===h&&(h=0),void 0===u&&(u=0),void 0===c&&(c=0),void 0===l&&(l=1),void 0===_&&(_=0),void 0===d&&(d=0),void 0===f&&(f=0),void 0===p&&(p=0),void 0===g&&(g=1),m=t.call(this)||this,"object"==typeof e?(m.m00=e.m00,m.m01=e.m01,m.m02=e.m02,m.m03=e.m03,m.m04=e.m04,m.m05=e.m05,m.m06=e.m06,m.m07=e.m07,m.m08=e.m08,m.m09=e.m09,m.m10=e.m10,m.m11=e.m11,m.m12=e.m12,m.m13=e.m13,m.m14=e.m14,m.m15=e.m15):(m.m00=e,m.m01=i,m.m02=n,m.m03=r,m.m04=s,m.m05=o,m.m06=a,m.m07=h,m.m08=u,m.m09=c,m.m10=l,m.m11=_,m.m12=d,m.m13=f,m.m14=p,m.m15=g),m}s(e,t),e.clone=function(t){return new e(t.m00,t.m01,t.m02,t.m03,t.m04,t.m05,t.m06,t.m07,t.m08,t.m09,t.m10,t.m11,t.m12,t.m13,t.m14,t.m15)},e.copy=function(t,e){return t.m00=e.m00,t.m01=e.m01,t.m02=e.m02,t.m03=e.m03,t.m04=e.m04,t.m05=e.m05,t.m06=e.m06,t.m07=e.m07,t.m08=e.m08,t.m09=e.m09,t.m10=e.m10,t.m11=e.m11,t.m12=e.m12,t.m13=e.m13,t.m14=e.m14,t.m15=e.m15,t},e.set=function(t,e,i,n,r,s,o,a,h,u,c,l,_,d,f,p,g){return t.m00=e,t.m01=i,t.m02=n,t.m03=r,t.m04=s,t.m05=o,t.m06=a,t.m07=h,t.m08=u,t.m09=c,t.m10=l,t.m11=_,t.m12=d,t.m13=f,t.m14=p,t.m15=g,t},e.identity=function(t){return t.m00=1,t.m01=0,t.m02=0,t.m03=0,t.m04=0,t.m05=1,t.m06=0,t.m07=0,t.m08=0,t.m09=0,t.m10=1,t.m11=0,t.m12=0,t.m13=0,t.m14=0,t.m15=1,t},e.transpose=function(t,e){if(t===e){var i=e.m01,n=e.m02,r=e.m03,s=e.m06,o=e.m07,a=e.m11;t.m01=e.m04,t.m02=e.m08,t.m03=e.m12,t.m04=i,t.m06=e.m09,t.m07=e.m13,t.m08=n,t.m09=s,t.m11=e.m14,t.m12=r,t.m13=o,t.m14=a}else t.m00=e.m00,t.m01=e.m04,t.m02=e.m08,t.m03=e.m12,t.m04=e.m01,t.m05=e.m05,t.m06=e.m09,t.m07=e.m13,t.m08=e.m02,t.m09=e.m06,t.m10=e.m10,t.m11=e.m14,t.m12=e.m03,t.m13=e.m07,t.m14=e.m11,t.m15=e.m15;return t},e.invert=function(t,e){var i=e.m00,n=e.m01,r=e.m02,s=e.m03,o=e.m04,a=e.m05,h=e.m06,u=e.m07,c=e.m08,l=e.m09,_=e.m10,d=e.m11,f=e.m12,p=e.m13,g=e.m14,m=e.m15,v=i*a-n*o,y=i*h-r*o,T=i*u-s*o,E=n*h-r*a,S=n*u-s*a,A=r*u-s*h,b=c*p-l*f,C=c*g-_*f,R=c*m-d*f,w=l*g-_*p,I=l*m-d*p,x=_*m-d*g,D=v*x-y*I+T*w+E*R-S*C+A*b;return 0===D?(t.m00=0,t.m01=0,t.m02=0,t.m03=0,t.m04=0,t.m05=0,t.m06=0,t.m07=0,t.m08=0,t.m09=0,t.m10=0,t.m11=0,t.m12=0,t.m13=0,t.m14=0,t.m15=0,t):(D=1/D,t.m00=(a*x-h*I+u*w)*D,t.m01=(r*I-n*x-s*w)*D,t.m02=(p*A-g*S+m*E)*D,t.m03=(_*S-l*A-d*E)*D,t.m04=(h*R-o*x-u*C)*D,t.m05=(i*x-r*R+s*C)*D,t.m06=(g*T-f*A-m*y)*D,t.m07=(c*A-_*T+d*y)*D,t.m08=(o*I-a*R+u*b)*D,t.m09=(n*R-i*I-s*b)*D,t.m10=(f*S-p*T+m*v)*D,t.m11=(l*T-c*S-d*v)*D,t.m12=(a*C-o*w-h*b)*D,t.m13=(i*w-n*C+r*b)*D,t.m14=(p*y-f*E-g*v)*D,t.m15=(c*E-l*y+_*v)*D,t)},e.determinant=function(t){var e=t.m00,i=t.m01,n=t.m02,r=t.m03,s=t.m04,o=t.m05,a=t.m06,h=t.m07,u=t.m08,c=t.m09,l=t.m10,_=t.m11,d=t.m12,f=t.m13,p=t.m14,g=t.m15;return(e*o-i*s)*(l*g-_*p)-(e*a-n*s)*(c*g-_*f)+(e*h-r*s)*(c*p-l*f)+(i*a-n*o)*(u*g-_*d)-(i*h-r*o)*(u*p-l*d)+(n*h-r*a)*(u*f-c*d)},e.multiply=function(t,e,i){var n=e.m00,r=e.m01,s=e.m02,o=e.m03,a=e.m04,h=e.m05,u=e.m06,c=e.m07,l=e.m08,_=e.m09,d=e.m10,f=e.m11,p=e.m12,g=e.m13,m=e.m14,v=e.m15,y=i.m00,T=i.m01,E=i.m02,S=i.m03;return t.m00=y*n+T*a+E*l+S*p,t.m01=y*r+T*h+E*_+S*g,t.m02=y*s+T*u+E*d+S*m,t.m03=y*o+T*c+E*f+S*v,y=i.m04,T=i.m05,E=i.m06,S=i.m07,t.m04=y*n+T*a+E*l+S*p,t.m05=y*r+T*h+E*_+S*g,t.m06=y*s+T*u+E*d+S*m,t.m07=y*o+T*c+E*f+S*v,y=i.m08,T=i.m09,E=i.m10,S=i.m11,t.m08=y*n+T*a+E*l+S*p,t.m09=y*r+T*h+E*_+S*g,t.m10=y*s+T*u+E*d+S*m,t.m11=y*o+T*c+E*f+S*v,y=i.m12,T=i.m13,E=i.m14,S=i.m15,t.m12=y*n+T*a+E*l+S*p,t.m13=y*r+T*h+E*_+S*g,t.m14=y*s+T*u+E*d+S*m,t.m15=y*o+T*c+E*f+S*v,t},e.transform=function(t,e,i){var n=i.x,r=i.y,s=i.z;if(e===t)t.m12=e.m00*n+e.m04*r+e.m08*s+e.m12,t.m13=e.m01*n+e.m05*r+e.m09*s+e.m13,t.m14=e.m02*n+e.m06*r+e.m10*s+e.m14,t.m15=e.m03*n+e.m07*r+e.m11*s+e.m15;else{var o=e.m00,a=e.m01,h=e.m02,u=e.m03,c=e.m04,l=e.m05,_=e.m06,d=e.m07,f=e.m08,p=e.m09,g=e.m10,m=e.m11;t.m00=o,t.m01=a,t.m02=h,t.m03=u,t.m04=c,t.m05=l,t.m06=_,t.m07=d,t.m08=f,t.m09=p,t.m10=g,t.m11=m,t.m12=o*n+c*r+f*s+e.m12,t.m13=a*n+l*r+p*s+e.m13,t.m14=h*n+_*r+g*s+e.m14,t.m15=u*n+d*r+m*s+e.m15}return t},e.translate=function(t,e,i){return e===t?(t.m12+=i.x,t.m13+=i.y,t.m14+=i.z):(t.m00=e.m00,t.m01=e.m01,t.m02=e.m02,t.m03=e.m03,t.m04=e.m04,t.m05=e.m05,t.m06=e.m06,t.m07=e.m07,t.m08=e.m08,t.m09=e.m09,t.m10=e.m10,t.m11=e.m11,t.m12=e.m12+i.x,t.m13=e.m13+i.y,t.m14=e.m14+i.z,t.m15=e.m15),t},e.scale=function(t,e,i){var n=i.x,r=i.y,s=i.z;return t.m00=e.m00*n,t.m01=e.m01*n,t.m02=e.m02*n,t.m03=e.m03*n,t.m04=e.m04*r,t.m05=e.m05*r,t.m06=e.m06*r,t.m07=e.m07*r,t.m08=e.m08*s,t.m09=e.m09*s,t.m10=e.m10*s,t.m11=e.m11*s,t.m12=e.m12,t.m13=e.m13,t.m14=e.m14,t.m15=e.m15,t},e.rotate=function(t,e,i,n){var r=n.x,s=n.y,o=n.z,a=Math.sqrt(r*r+s*s+o*o);if(Math.abs(a)0?(n=2*Math.sqrt(i+1),t.w=.25*n,t.x=(e.m06-e.m09)/n,t.y=(e.m08-e.m02)/n,t.z=(e.m01-e.m04)/n):e.m00>e.m05&&e.m00>e.m10?(n=2*Math.sqrt(1+e.m00-e.m05-e.m10),t.w=(e.m06-e.m09)/n,t.x=.25*n,t.y=(e.m01+e.m04)/n,t.z=(e.m08+e.m02)/n):e.m05>e.m10?(n=2*Math.sqrt(1+e.m05-e.m00-e.m10),t.w=(e.m08-e.m02)/n,t.x=(e.m01+e.m04)/n,t.y=.25*n,t.z=(e.m06+e.m09)/n):(n=2*Math.sqrt(1+e.m10-e.m00-e.m05),t.w=(e.m01-e.m04)/n,t.x=(e.m08+e.m02)/n,t.y=(e.m06+e.m09)/n,t.z=.25*n),t},e.toRTS=function(t,i,n,r){e.toSRT(t,i,n,r)},e.toSRT=function(t,e,i,n){i&&_n.set(i,t.m12,t.m13,t.m14);var r=_n.set(Fn,t.m00,t.m01,t.m02).length(),s=_n.set(Fn,t.m04,t.m05,t.m06).length(),o=_n.set(Fn,t.m08,t.m09,t.m10).length();if(n&&(n.x=r,n.y=s,n.z=o),0!==r&&0!==s&&0!==o){kn.m00=t.m00/r,kn.m01=t.m01/r,kn.m02=t.m02/r,kn.m03=t.m04/s,kn.m04=t.m05/s,kn.m05=t.m06/s,kn.m06=t.m08/o,kn.m07=t.m09/o,kn.m08=t.m10/o;var a=Sn.determinant(kn);n&&a<0&&(n.x*=-1),e&&(a<0&&(kn.m00*=-1,kn.m01*=-1,kn.m02*=-1),Rn.fromMat3(e,kn))}else e&&Rn.identity(e)},e.toEuler=function(t,e){return Sn.set(kn,t.m00,t.m01,t.m02,t.m04,t.m05,t.m06,t.m08,t.m09,t.m10),Sn.toEuler(kn,e)},e.fromRTS=function(t,i,n,r){return e.fromSRT(t,i,n,r)},e.fromSRT=function(t,e,i,n){var r=e.x,s=e.y,o=e.z,a=e.w,h=r+r,u=s+s,c=o+o,l=r*h,_=r*u,d=r*c,f=s*u,p=s*c,g=o*c,m=a*h,v=a*u,y=a*c,T=n.x,E=n.y,S=n.z;return t.m00=(1-(f+g))*T,t.m01=(_+y)*T,t.m02=(d-v)*T,t.m03=0,t.m04=(_-y)*E,t.m05=(1-(l+g))*E,t.m06=(p+m)*E,t.m07=0,t.m08=(d+v)*S,t.m09=(p-m)*S,t.m10=(1-(l+f))*S,t.m11=0,t.m12=i.x,t.m13=i.y,t.m14=i.z,t.m15=1,t},e.fromRTSOrigin=function(t,e,i,n,r){var s=e.x,o=e.y,a=e.z,h=e.w,u=s+s,c=o+o,l=a+a,_=s*u,d=s*c,f=s*l,p=o*c,g=o*l,m=a*l,v=h*u,y=h*c,T=h*l,E=n.x,S=n.y,A=n.z,b=r.x,C=r.y,R=r.z;return t.m00=(1-(p+m))*E,t.m01=(d+T)*E,t.m02=(f-y)*E,t.m03=0,t.m04=(d-T)*S,t.m05=(1-(_+m))*S,t.m06=(g+v)*S,t.m07=0,t.m08=(f+y)*A,t.m09=(g-v)*A,t.m10=(1-(_+p))*A,t.m11=0,t.m12=i.x+b-(t.m00*b+t.m04*C+t.m08*R),t.m13=i.y+C-(t.m01*b+t.m05*C+t.m09*R),t.m14=i.z+R-(t.m02*b+t.m06*C+t.m10*R),t.m15=1,t},e.fromSRTOrigin=function(t,e,i,n,r){var s=e.x,o=e.y,a=e.z,h=e.w,u=s+s,c=o+o,l=a+a,_=s*u,d=s*c,f=s*l,p=o*c,g=o*l,m=a*l,v=h*u,y=h*c,T=h*l,E=n.x,S=n.y,A=n.z,b=r.x,C=r.y,R=r.z;return t.m00=(1-(p+m))*E,t.m01=(d+T)*E,t.m02=(f-y)*E,t.m03=0,t.m04=(d-T)*S,t.m05=(1-(_+m))*S,t.m06=(g+v)*S,t.m07=0,t.m08=(f+y)*A,t.m09=(g-v)*A,t.m10=(1-(_+p))*A,t.m11=0,t.m12=i.x+b-(t.m00*b+t.m04*C+t.m08*R),t.m13=i.y+C-(t.m01*b+t.m05*C+t.m09*R),t.m14=i.z+R-(t.m02*b+t.m06*C+t.m10*R),t.m15=1,t},e.fromQuat=function(t,e){var i=e.x,n=e.y,r=e.z,s=e.w,o=i+i,a=n+n,h=r+r,u=i*o,c=n*o,l=n*a,_=r*o,d=r*a,f=r*h,p=s*o,g=s*a,m=s*h;return t.m00=1-l-f,t.m01=c+m,t.m02=_-g,t.m03=0,t.m04=c-m,t.m05=1-u-f,t.m06=d+p,t.m07=0,t.m08=_+g,t.m09=d-p,t.m10=1-u-l,t.m11=0,t.m12=0,t.m13=0,t.m14=0,t.m15=1,t},e.frustum=function(t,e,i,n,r,s,o){var a=1/(i-e),h=1/(r-n),u=1/(s-o);return t.m00=2*s*a,t.m01=0,t.m02=0,t.m03=0,t.m04=0,t.m05=2*s*h,t.m06=0,t.m07=0,t.m08=(i+e)*a,t.m09=(r+n)*h,t.m10=(o+s)*u,t.m11=-1,t.m12=0,t.m13=0,t.m14=o*s*2*u,t.m15=0,t},e.perspective=function(t,e,i,n,r,s,o,a,h){void 0===s&&(s=!0),void 0===o&&(o=-1),void 0===a&&(a=1),void 0===h&&(h=0);var u=1/Math.tan(e/2),c=1/(n-r),l=s?u/i:u,_=(s?u:u*i)*a,d=Nn[h];return t.m00=l*d[0],t.m01=l*d[1],t.m02=0,t.m03=0,t.m04=_*d[2],t.m05=_*d[3],t.m06=0,t.m07=0,t.m08=0,t.m09=0,t.m10=(r-o*n)*c,t.m11=-1,t.m12=0,t.m13=0,t.m14=r*n*c*(1-o),t.m15=0,t},e.ortho=function(t,e,i,n,r,s,o,a,h,u){void 0===a&&(a=-1),void 0===h&&(h=1),void 0===u&&(u=0);var c=1/(e-i),l=1/(n-r)*h,_=1/(s-o),d=-2*c,f=-2*l,p=(e+i)*c,g=(r+n)*l,m=Nn[u];return t.m00=d*m[0],t.m01=d*m[1],t.m02=0,t.m03=0,t.m04=f*m[2],t.m05=f*m[3],t.m06=0,t.m07=0,t.m08=0,t.m09=0,t.m10=_*(1-a),t.m11=0,t.m12=p*m[0]+g*m[2],t.m13=p*m[1]+g*m[3],t.m14=(s-a*o)*_,t.m15=1,t},e.lookAt=function(t,e,i,n){var r=e.x,s=e.y,o=e.z,a=n.x,h=n.y,u=n.z,c=r-i.x,l=s-i.y,_=o-i.z,d=1/Math.sqrt(c*c+l*l+_*_),f=h*(_*=d)-u*(l*=d),p=u*(c*=d)-a*_,g=a*l-h*c,m=l*(g*=d=1/Math.sqrt(f*f+p*p+g*g))-_*(p*=d),v=_*(f*=d)-c*g,y=c*p-l*f;return t.m00=f,t.m01=m,t.m02=c,t.m03=0,t.m04=p,t.m05=v,t.m06=l,t.m07=0,t.m08=g,t.m09=y,t.m10=_,t.m11=0,t.m12=-(f*r+p*s+g*o),t.m13=-(m*r+v*s+y*o),t.m14=-(c*r+l*s+_*o),t.m15=1,t},e.inverseTranspose=function(t,e){var i=e.m00,n=e.m01,r=e.m02,s=e.m03,o=e.m04,a=e.m05,h=e.m06,u=e.m07,c=e.m08,l=e.m09,_=e.m10,d=e.m11,f=e.m12,p=e.m13,g=e.m14,m=e.m15,v=i*a-n*o,y=i*h-r*o,T=i*u-s*o,E=n*h-r*a,S=n*u-s*a,A=r*u-s*h,b=c*p-l*f,C=c*g-_*f,R=c*m-d*f,w=l*g-_*p,I=l*m-d*p,x=_*m-d*g,D=v*x-y*I+T*w+E*R-S*C+A*b;return D?(D=1/D,t.m00=(a*x-h*I+u*w)*D,t.m01=(h*R-o*x-u*C)*D,t.m02=(o*I-a*R+u*b)*D,t.m03=0,t.m04=(r*I-n*x-s*w)*D,t.m05=(i*x-r*R+s*C)*D,t.m06=(n*R-i*I-s*b)*D,t.m07=0,t.m08=(p*A-g*S+m*E)*D,t.m09=(g*T-f*A-m*y)*D,t.m10=(f*S-p*T+m*v)*D,t.m11=0,t.m12=0,t.m13=0,t.m14=0,t.m15=1,t):null},e.toArray=function(t,e,i){return void 0===i&&(i=0),t[i+0]=e.m00,t[i+1]=e.m01,t[i+2]=e.m02,t[i+3]=e.m03,t[i+4]=e.m04,t[i+5]=e.m05,t[i+6]=e.m06,t[i+7]=e.m07,t[i+8]=e.m08,t[i+9]=e.m09,t[i+10]=e.m10,t[i+11]=e.m11,t[i+12]=e.m12,t[i+13]=e.m13,t[i+14]=e.m14,t[i+15]=e.m15,t},e.fromArray=function(t,e,i){return void 0===i&&(i=0),t.m00=e[i+0],t.m01=e[i+1],t.m02=e[i+2],t.m03=e[i+3],t.m04=e[i+4],t.m05=e[i+5],t.m06=e[i+6],t.m07=e[i+7],t.m08=e[i+8],t.m09=e[i+9],t.m10=e[i+10],t.m11=e[i+11],t.m12=e[i+12],t.m13=e[i+13],t.m14=e[i+14],t.m15=e[i+15],t},e.add=function(t,e,i){return t.m00=e.m00+i.m00,t.m01=e.m01+i.m01,t.m02=e.m02+i.m02,t.m03=e.m03+i.m03,t.m04=e.m04+i.m04,t.m05=e.m05+i.m05,t.m06=e.m06+i.m06,t.m07=e.m07+i.m07,t.m08=e.m08+i.m08,t.m09=e.m09+i.m09,t.m10=e.m10+i.m10,t.m11=e.m11+i.m11,t.m12=e.m12+i.m12,t.m13=e.m13+i.m13,t.m14=e.m14+i.m14,t.m15=e.m15+i.m15,t},e.subtract=function(t,e,i){return t.m00=e.m00-i.m00,t.m01=e.m01-i.m01,t.m02=e.m02-i.m02,t.m03=e.m03-i.m03,t.m04=e.m04-i.m04,t.m05=e.m05-i.m05,t.m06=e.m06-i.m06,t.m07=e.m07-i.m07,t.m08=e.m08-i.m08,t.m09=e.m09-i.m09,t.m10=e.m10-i.m10,t.m11=e.m11-i.m11,t.m12=e.m12-i.m12,t.m13=e.m13-i.m13,t.m14=e.m14-i.m14,t.m15=e.m15-i.m15,t},e.multiplyScalar=function(t,e,i){return t.m00=e.m00*i,t.m01=e.m01*i,t.m02=e.m02*i,t.m03=e.m03*i,t.m04=e.m04*i,t.m05=e.m05*i,t.m06=e.m06*i,t.m07=e.m07*i,t.m08=e.m08*i,t.m09=e.m09*i,t.m10=e.m10*i,t.m11=e.m11*i,t.m12=e.m12*i,t.m13=e.m13*i,t.m14=e.m14*i,t.m15=e.m15*i,t},e.multiplyScalarAndAdd=function(t,e,i,n){return t.m00=e.m00+i.m00*n,t.m01=e.m01+i.m01*n,t.m02=e.m02+i.m02*n,t.m03=e.m03+i.m03*n,t.m04=e.m04+i.m04*n,t.m05=e.m05+i.m05*n,t.m06=e.m06+i.m06*n,t.m07=e.m07+i.m07*n,t.m08=e.m08+i.m08*n,t.m09=e.m09+i.m09*n,t.m10=e.m10+i.m10*n,t.m11=e.m11+i.m11*n,t.m12=e.m12+i.m12*n,t.m13=e.m13+i.m13*n,t.m14=e.m14+i.m14*n,t.m15=e.m15+i.m15*n,t},e.strictEquals=function(t,e){return t.m00===e.m00&&t.m01===e.m01&&t.m02===e.m02&&t.m03===e.m03&&t.m04===e.m04&&t.m05===e.m05&&t.m06===e.m06&&t.m07===e.m07&&t.m08===e.m08&&t.m09===e.m09&&t.m10===e.m10&&t.m11===e.m11&&t.m12===e.m12&&t.m13===e.m13&&t.m14===e.m14&&t.m15===e.m15},e.equals=function(t,e,i){return void 0===i&&(i=xi),Math.abs(t.m00-e.m00)<=i*Math.max(1,Math.abs(t.m00),Math.abs(e.m00))&&Math.abs(t.m01-e.m01)<=i*Math.max(1,Math.abs(t.m01),Math.abs(e.m01))&&Math.abs(t.m02-e.m02)<=i*Math.max(1,Math.abs(t.m02),Math.abs(e.m02))&&Math.abs(t.m03-e.m03)<=i*Math.max(1,Math.abs(t.m03),Math.abs(e.m03))&&Math.abs(t.m04-e.m04)<=i*Math.max(1,Math.abs(t.m04),Math.abs(e.m04))&&Math.abs(t.m05-e.m05)<=i*Math.max(1,Math.abs(t.m05),Math.abs(e.m05))&&Math.abs(t.m06-e.m06)<=i*Math.max(1,Math.abs(t.m06),Math.abs(e.m06))&&Math.abs(t.m07-e.m07)<=i*Math.max(1,Math.abs(t.m07),Math.abs(e.m07))&&Math.abs(t.m08-e.m08)<=i*Math.max(1,Math.abs(t.m08),Math.abs(e.m08))&&Math.abs(t.m09-e.m09)<=i*Math.max(1,Math.abs(t.m09),Math.abs(e.m09))&&Math.abs(t.m10-e.m10)<=i*Math.max(1,Math.abs(t.m10),Math.abs(e.m10))&&Math.abs(t.m11-e.m11)<=i*Math.max(1,Math.abs(t.m11),Math.abs(e.m11))&&Math.abs(t.m12-e.m12)<=i*Math.max(1,Math.abs(t.m12),Math.abs(e.m12))&&Math.abs(t.m13-e.m13)<=i*Math.max(1,Math.abs(t.m13),Math.abs(e.m13))&&Math.abs(t.m14-e.m14)<=i*Math.max(1,Math.abs(t.m14),Math.abs(e.m14))&&Math.abs(t.m15-e.m15)<=i*Math.max(1,Math.abs(t.m15),Math.abs(e.m15))};var i=e.prototype;return i.clone=function(){return new e(this.m00,this.m01,this.m02,this.m03,this.m04,this.m05,this.m06,this.m07,this.m08,this.m09,this.m10,this.m11,this.m12,this.m13,this.m14,this.m15)},i.set=function(t,e,i,n,r,s,o,a,h,u,c,l,_,d,f,p){return void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=1),void 0===o&&(o=0),void 0===a&&(a=0),void 0===h&&(h=0),void 0===u&&(u=0),void 0===c&&(c=1),void 0===l&&(l=0),void 0===_&&(_=0),void 0===d&&(d=0),void 0===f&&(f=0),void 0===p&&(p=1),"object"==typeof t?(this.m01=t.m01,this.m02=t.m02,this.m03=t.m03,this.m04=t.m04,this.m05=t.m05,this.m06=t.m06,this.m07=t.m07,this.m08=t.m08,this.m09=t.m09,this.m10=t.m10,this.m11=t.m11,this.m12=t.m12,this.m13=t.m13,this.m14=t.m14,this.m15=t.m15,this.m00=t.m00):(this.m01=e,this.m02=i,this.m03=n,this.m04=r,this.m05=s,this.m06=o,this.m07=a,this.m08=h,this.m09=u,this.m10=c,this.m11=l,this.m12=_,this.m13=d,this.m14=f,this.m15=p,this.m00=t),this},i.equals=function(t,e){return void 0===e&&(e=xi),!(Math.abs(this.m00)===1/0||Math.abs(this.m01)===1/0||Math.abs(this.m02)===1/0||Math.abs(this.m03)===1/0||Math.abs(this.m04)===1/0||Math.abs(this.m05)===1/0||Math.abs(this.m06)===1/0||Math.abs(this.m07)===1/0||Math.abs(this.m08)===1/0||Math.abs(this.m09)===1/0||Math.abs(this.m10)===1/0||Math.abs(this.m11)===1/0||Math.abs(this.m12)===1/0||Math.abs(this.m13)===1/0||Math.abs(this.m14)===1/0||Math.abs(this.m15)===1/0)&&Math.abs(this.m00-t.m00)<=e*Math.max(1,Math.abs(this.m00),Math.abs(t.m00))&&Math.abs(this.m01-t.m01)<=e*Math.max(1,Math.abs(this.m01),Math.abs(t.m01))&&Math.abs(this.m02-t.m02)<=e*Math.max(1,Math.abs(this.m02),Math.abs(t.m02))&&Math.abs(this.m03-t.m03)<=e*Math.max(1,Math.abs(this.m03),Math.abs(t.m03))&&Math.abs(this.m04-t.m04)<=e*Math.max(1,Math.abs(this.m04),Math.abs(t.m04))&&Math.abs(this.m05-t.m05)<=e*Math.max(1,Math.abs(this.m05),Math.abs(t.m05))&&Math.abs(this.m06-t.m06)<=e*Math.max(1,Math.abs(this.m06),Math.abs(t.m06))&&Math.abs(this.m07-t.m07)<=e*Math.max(1,Math.abs(this.m07),Math.abs(t.m07))&&Math.abs(this.m08-t.m08)<=e*Math.max(1,Math.abs(this.m08),Math.abs(t.m08))&&Math.abs(this.m09-t.m09)<=e*Math.max(1,Math.abs(this.m09),Math.abs(t.m09))&&Math.abs(this.m10-t.m10)<=e*Math.max(1,Math.abs(this.m10),Math.abs(t.m10))&&Math.abs(this.m11-t.m11)<=e*Math.max(1,Math.abs(this.m11),Math.abs(t.m11))&&Math.abs(this.m12-t.m12)<=e*Math.max(1,Math.abs(this.m12),Math.abs(t.m12))&&Math.abs(this.m13-t.m13)<=e*Math.max(1,Math.abs(this.m13),Math.abs(t.m13))&&Math.abs(this.m14-t.m14)<=e*Math.max(1,Math.abs(this.m14),Math.abs(t.m14))&&Math.abs(this.m15-t.m15)<=e*Math.max(1,Math.abs(this.m15),Math.abs(t.m15))},i.strictEquals=function(t){return this.m00===t.m00&&this.m01===t.m01&&this.m02===t.m02&&this.m03===t.m03&&this.m04===t.m04&&this.m05===t.m05&&this.m06===t.m06&&this.m07===t.m07&&this.m08===t.m08&&this.m09===t.m09&&this.m10===t.m10&&this.m11===t.m11&&this.m12===t.m12&&this.m13===t.m13&&this.m14===t.m14&&this.m15===t.m15},i.toString=function(){return"[\n"+this.m00+", "+this.m01+", "+this.m02+", "+this.m03+",\n"+this.m04+", "+this.m05+", "+this.m06+", "+this.m07+",\n"+this.m08+", "+this.m09+", "+this.m10+", "+this.m11+",\n"+this.m12+", "+this.m13+", "+this.m14+", "+this.m15+"\n]"},i.identity=function(){return this.m00=1,this.m01=0,this.m02=0,this.m03=0,this.m04=0,this.m05=1,this.m06=0,this.m07=0,this.m08=0,this.m09=0,this.m10=1,this.m11=0,this.m12=0,this.m13=0,this.m14=0,this.m15=1,this},i.zero=function(){return this.m00=0,this.m01=0,this.m02=0,this.m03=0,this.m04=0,this.m05=0,this.m06=0,this.m07=0,this.m08=0,this.m09=0,this.m10=0,this.m11=0,this.m12=0,this.m13=0,this.m14=0,this.m15=0,this},i.transpose=function(){var t=this.m01,e=this.m02,i=this.m03,n=this.m06,r=this.m07,s=this.m11;return this.m01=this.m04,this.m02=this.m08,this.m03=this.m12,this.m04=t,this.m06=this.m09,this.m07=this.m13,this.m08=e,this.m09=n,this.m11=this.m14,this.m12=i,this.m13=r,this.m14=s,this},i.invert=function(){var t=this.m00,e=this.m01,i=this.m02,n=this.m03,r=this.m04,s=this.m05,o=this.m06,a=this.m07,h=this.m08,u=this.m09,c=this.m10,l=this.m11,_=this.m12,d=this.m13,f=this.m14,p=this.m15,g=t*s-e*r,m=t*o-i*r,v=t*a-n*r,y=e*o-i*s,T=e*a-n*s,E=i*a-n*o,S=h*d-u*_,A=h*f-c*_,b=h*p-l*_,C=u*f-c*d,R=u*p-l*d,w=c*p-l*f,I=g*w-m*R+v*C+y*b-T*A+E*S;return 0===I?(this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),this):(I=1/I,this.m00=(s*w-o*R+a*C)*I,this.m01=(i*R-e*w-n*C)*I,this.m02=(d*E-f*T+p*y)*I,this.m03=(c*T-u*E-l*y)*I,this.m04=(o*b-r*w-a*A)*I,this.m05=(t*w-i*b+n*A)*I,this.m06=(f*v-_*E-p*m)*I,this.m07=(h*E-c*v+l*m)*I,this.m08=(r*R-s*b+a*S)*I,this.m09=(e*b-t*R-n*S)*I,this.m10=(_*T-d*v+p*g)*I,this.m11=(u*v-h*T-l*g)*I,this.m12=(s*A-r*C-o*S)*I,this.m13=(t*C-e*A+i*S)*I,this.m14=(d*m-_*y-f*g)*I,this.m15=(h*y-u*m+c*g)*I,this)},i.determinant=function(){var t=this.m00,e=this.m01,i=this.m02,n=this.m03,r=this.m04,s=this.m05,o=this.m06,a=this.m07,h=this.m08,u=this.m09,c=this.m10,l=this.m11,_=this.m12,d=this.m13,f=this.m14,p=this.m15;return(t*s-e*r)*(c*p-l*f)-(t*o-i*r)*(u*p-l*d)+(t*a-n*r)*(u*f-c*d)+(e*o-i*s)*(h*p-l*_)-(e*a-n*s)*(h*f-c*_)+(i*a-n*o)*(h*d-u*_)},i.add=function(t){return this.m00+=t.m00,this.m01+=t.m01,this.m02+=t.m02,this.m03+=t.m03,this.m04+=t.m04,this.m05+=t.m05,this.m06+=t.m06,this.m07+=t.m07,this.m08+=t.m08,this.m09+=t.m09,this.m10+=t.m10,this.m11+=t.m11,this.m12+=t.m12,this.m13+=t.m13,this.m14+=t.m14,this.m15+=t.m15,this},i.subtract=function(t){return this.m00-=t.m00,this.m01-=t.m01,this.m02-=t.m02,this.m03-=t.m03,this.m04-=t.m04,this.m05-=t.m05,this.m06-=t.m06,this.m07-=t.m07,this.m08-=t.m08,this.m09-=t.m09,this.m10-=t.m10,this.m11-=t.m11,this.m12-=t.m12,this.m13-=t.m13,this.m14-=t.m14,this.m15-=t.m15,this},i.multiply=function(t){var e=this.m00,i=this.m01,n=this.m02,r=this.m03,s=this.m04,o=this.m05,a=this.m06,h=this.m07,u=this.m08,c=this.m09,l=this.m10,_=this.m11,d=this.m12,f=this.m13,p=this.m14,g=this.m15,m=t.m00,v=t.m01,y=t.m02,T=t.m03;return this.m00=m*e+v*s+y*u+T*d,this.m01=m*i+v*o+y*c+T*f,this.m02=m*n+v*a+y*l+T*p,this.m03=m*r+v*h+y*_+T*g,m=t.m04,v=t.m05,y=t.m06,T=t.m07,this.m04=m*e+v*s+y*u+T*d,this.m05=m*i+v*o+y*c+T*f,this.m06=m*n+v*a+y*l+T*p,this.m07=m*r+v*h+y*_+T*g,m=t.m08,v=t.m09,y=t.m10,T=t.m11,this.m08=m*e+v*s+y*u+T*d,this.m09=m*i+v*o+y*c+T*f,this.m10=m*n+v*a+y*l+T*p,this.m11=m*r+v*h+y*_+T*g,m=t.m12,v=t.m13,y=t.m14,T=t.m15,this.m12=m*e+v*s+y*u+T*d,this.m13=m*i+v*o+y*c+T*f,this.m14=m*n+v*a+y*l+T*p,this.m15=m*r+v*h+y*_+T*g,this},i.multiplyScalar=function(t){return this.m00*=t,this.m01*=t,this.m02*=t,this.m03*=t,this.m04*=t,this.m05*=t,this.m06*=t,this.m07*=t,this.m08*=t,this.m09*=t,this.m10*=t,this.m11*=t,this.m12*=t,this.m13*=t,this.m14*=t,this.m15*=t,this},i.translate=function(t){return this.m12+=t.x,this.m13+=t.y,this.m14+=t.z,this},i.transform=function(t){var e=t.x,i=t.y,n=t.z,r=this.m00,s=this.m01,o=this.m02,a=this.m03,h=this.m04,u=this.m05,c=this.m06,l=this.m07,_=this.m08,d=this.m09,f=this.m10,p=this.m11;return this.m12=r*e+h*i+_*n+this.m12,this.m13=s*e+u*i+d*n+this.m13,this.m14=o*e+c*i+f*n+this.m14,this.m15=a*e+l*i+p*n+this.m15,this},i.scale=function(t){var e=t.x,i=t.y,n=t.z;return this.m00*=e,this.m01*=e,this.m02*=e,this.m03*=e,this.m04*=i,this.m05*=i,this.m06*=i,this.m07*=i,this.m08*=n,this.m09*=n,this.m10*=n,this.m11*=n,this},i.rotate=function(t,e){var i=e.x,n=e.y,r=e.z,s=Math.sqrt(i*i+n*n+r*r);if(Math.abs(s)0?(r=1/Math.sqrt(r),t.x=i*r,t.y=n*r):(t.x=0,t.y=0),t},e.dot=function(t,e){return t.x*e.x+t.y*e.y},e.cross=function(t,e,i){return t instanceof _n?(t.x=t.y=0,t.z=e.x*i.y-e.y*i.x,t):t.x*e.y-t.y*e.x},e.lerp=function(t,e,i,n){var r=e.x,s=e.y;return t.x=r+n*(i.x-r),t.y=s+n*(i.y-s),t},e.random=function(t,e){e=e||1;var i=2*Fi()*Math.PI;return t.x=Math.cos(i)*e,t.y=Math.sin(i)*e,t},e.transformMat3=function(t,e,i){var n=e.x,r=e.y;return t.x=i.m00*n+i.m03*r+i.m06,t.y=i.m01*n+i.m04*r+i.m07,t},e.transformMat4=function(t,e,i){var n=e.x,r=e.y;return t.x=i.m00*n+i.m04*r+i.m12,t.y=i.m01*n+i.m05*r+i.m13,t},e.str=function(t){return"Vec2("+t.x+", "+t.y+")"},e.toArray=function(t,e,i){return void 0===i&&(i=0),t[i+0]=e.x,t[i+1]=e.y,t},e.fromArray=function(t,e,i){return void 0===i&&(i=0),t.x=e[i+0],t.y=e[i+1],t},e.strictEquals=function(t,e){return t.x===e.x&&t.y===e.y},e.equals=function(t,e,i){return void 0===i&&(i=xi),Math.abs(t.x-e.x)<=i*Math.max(1,Math.abs(t.x),Math.abs(e.x))&&Math.abs(t.y-e.y)<=i*Math.max(1,Math.abs(t.y),Math.abs(e.y))},e.angle=function(t,e){var i=t.x*t.x+t.y*t.y,n=e.x*e.x+e.y*e.y;if(0===i||0===n)return 0;var r=(t.x*e.x+t.y*e.y)/Math.sqrt(i*n);return r=Pi(r,-1,1),Math.acos(r)};var i=e.prototype;return i.clone=function(){return new e(this.x,this.y)},i.set=function(t,e){return"object"==typeof t?(this.x=t.x,this.y=t.y):(this.x=t||0,this.y=e||0),this},i.equals=function(t,e){return void 0===e&&(e=xi),Math.abs(this.x-t.x)<=e*Math.max(1,Math.abs(this.x),Math.abs(t.x))&&Math.abs(this.y-t.y)<=e*Math.max(1,Math.abs(this.y),Math.abs(t.y))},i.equals2f=function(t,e,i){return void 0===i&&(i=xi),Math.abs(this.x-t)<=i*Math.max(1,Math.abs(this.x),Math.abs(t))&&Math.abs(this.y-e)<=i*Math.max(1,Math.abs(this.y),Math.abs(e))},i.strictEquals=function(t){return t&&this.x===t.x&&this.y===t.y},i.strictEquals2f=function(t,e){return this.x===t&&this.y===e},i.toString=function(){return"("+this.x.toFixed(2)+", "+this.y.toFixed(2)+")"},i.lerp=function(t,e){var i=this.x,n=this.y;return this.x=i+e*(t.x-i),this.y=n+e*(t.y-n),this},i.clampf=function(t,e){return this.x=Pi(this.x,t.x,e.x),this.y=Pi(this.y,t.y,e.y),this},i.add=function(t){return this.x+=t.x,this.y+=t.y,this},i.add2f=function(t,e){return this.x+=t,this.y+=e,this},i.subtract=function(t){return this.x-=t.x,this.y-=t.y,this},i.subtract2f=function(t,e){return this.x-=t,this.y-=e,this},i.multiplyScalar=function(t){return"object"==typeof t&&q(16359),this.x*=t,this.y*=t,this},i.multiply=function(t){return"object"!=typeof t&&q(16360),this.x*=t.x,this.y*=t.y,this},i.multiply2f=function(t,e){return this.x*=t,this.y*=e,this},i.divide=function(t){return this.x/=t.x,this.y/=t.y,this},i.divide2f=function(t,e){return this.x/=t,this.y/=e,this},i.negative=function(){return this.x=-this.x,this.y=-this.y,this},i.dot=function(t){return this.x*t.x+this.y*t.y},i.cross=function(t){return this.x*t.y-this.y*t.x},i.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},i.lengthSqr=function(){return this.x*this.x+this.y*this.y},i.normalize=function(){var t=this.x,e=this.y,i=t*t+e*e;return i>0&&(i=1/Math.sqrt(i),this.x*=i,this.y*=i),this},i.angle=function(t){var e=this.lengthSqr(),i=t.lengthSqr();if(0===e||0===i)return 0;var n=this.dot(t)/Math.sqrt(e*i);return n=Pi(n,-1,1),Math.acos(n)},i.signAngle=function(t){var e=this.cross(t),i=this.dot(t);return Math.atan2(e,i)},i.rotate=function(t){var e=this.x,i=this.y,n=Math.sin(t),r=Math.cos(t);return this.x=r*e-n*i,this.y=n*e+r*i,this},i.project=function(t){var e=this.dot(t)/t.dot(t);return this.x=t.x*e,this.y=t.y*e,this},i.transformMat4=function(t){var e=this.x,i=this.y;return this.x=t.m00*e+t.m04*i+t.m12,this.y=t.m01*e+t.m05*i+t.m13,this},i.toVec3=function(){return new _n(this.x,this.y,0)},e}(be));function zn(t,e){return new Hn(t,e)}Bn=Hn,Hn.ZERO=Object.freeze(new Bn(0,0)),Hn.ONE=Object.freeze(new Bn(1,1)),Hn.NEG_ONE=Object.freeze(new Bn(-1,-1)),Hn.UNIT_X=Object.freeze(new Bn(1,0)),Hn.UNIT_Y=Object.freeze(new Bn(0,1)),Ti.fastDefine("cc.Vec2",Hn,{x:0,y:0}),m.Vec2=Hn,m.v2=zn,rt(Hn,"Vec2",[{name:"sub",newName:"subtract",target:Hn,targetName:"Vec2"},{name:"mul",newName:"multiply",target:Hn,targetName:"Vec2"},{name:"div",newName:"divide",target:Hn,targetName:"Vec2"},{name:"dist",newName:"distance",target:Hn,targetName:"Vec2"},{name:"sqrDist",newName:"squaredDistance",target:Hn,targetName:"Vec2"},{name:"mag",newName:"len",target:Hn,targetName:"Vec2"},{name:"sqrMag",newName:"lengthSqr",target:Hn,targetName:"Vec2"},{name:"scale",newName:"multiplyScalar",target:Hn,targetName:"Vec2"},{name:"exactEquals",newName:"strictEquals",target:Hn,targetName:"Vec2"}]),rt(Hn.prototype,"Vec2",[{name:"mag",newName:"length",target:Hn.prototype,targetName:"Vec2"},{name:"magSqr",newName:"lengthSqr",target:Hn.prototype,targetName:"Vec2"},{name:"scale",newName:"multiplyScalar",target:Hn.prototype,targetName:"Vec2"},{name:"exactEquals",newName:"strictEquals",target:Hn.prototype,targetName:"Vec2"}]),rt(_n,"Vec3",[{name:"sub",newName:"subtract",target:_n,targetName:"Vec3"},{name:"mul",newName:"multiply",target:_n,targetName:"Vec3"},{name:"div",newName:"divide",target:_n,targetName:"Vec3"},{name:"dist",newName:"distance",target:_n,targetName:"Vec3"},{name:"sqrDist",newName:"squaredDistance",target:_n,targetName:"Vec3"},{name:"mag",newName:"len",target:_n,targetName:"Vec3"},{name:"sqrMag",newName:"lengthSqr",target:_n,targetName:"Vec3"},{name:"scale",newName:"multiplyScalar",target:_n,targetName:"Vec3"},{name:"exactEquals",newName:"strictEquals",target:_n,targetName:"Vec3"}]),rt(_n.prototype,"Vec3",[{name:"mag",newName:"length",target:_n.prototype,targetName:"Vec3"},{name:"magSqr",newName:"lengthSqr",target:_n.prototype,targetName:"Vec3"},{name:"scale",newName:"multiplyScalar",target:_n.prototype,targetName:"Vec3"},{name:"exactEquals",newName:"strictEquals",target:_n.prototype,targetName:"Vec3"}]),rt(on,"Vec4",[{name:"sub",newName:"subtract",target:on,targetName:"Vec4"},{name:"mul",newName:"multiply",target:on,targetName:"Vec4"},{name:"div",newName:"divide",target:on,targetName:"Vec4"},{name:"dist",newName:"distance",target:on,targetName:"Vec4"},{name:"sqrDist",newName:"squaredDistance",target:on,targetName:"Vec4"},{name:"mag",newName:"len",target:on,targetName:"Vec4"},{name:"sqrMag",newName:"lengthSqr",target:on,targetName:"Vec4"},{name:"scale",newName:"multiplyScalar",target:on,targetName:"Vec4"},{name:"exactEquals",newName:"strictEquals",target:on,targetName:"Vec4"}]),rt(on.prototype,"Vec4",[{name:"mag",newName:"length",target:on.prototype,targetName:"Vec4"},{name:"magSqr",newName:"lengthSqr",target:on.prototype,targetName:"Vec4"},{name:"scale",newName:"multiplyScalar",target:on.prototype,targetName:"Vec4"},{name:"exactEquals",newName:"strictEquals",target:on.prototype,targetName:"Vec4"}]),rt(Rn,"Quat",[{name:"mag",newName:"len",target:Rn,targetName:"Quat"},{name:"mul",newName:"multiply",target:Rn,targetName:"Quat"},{name:"sqrMag",newName:"lengthSqr",target:Rn,targetName:"Quat"},{name:"scale",newName:"multiplyScalar",target:Rn,targetName:"Quat"},{name:"exactEquals",newName:"strictEquals",target:Rn,targetName:"Quat"}]),rt(Rn.prototype,"Quat",[{name:"scale",newName:"multiplyScalar",target:Rn.prototype,targetName:"Quat"},{name:"exactEquals",newName:"strictEquals",target:Rn.prototype,targetName:"Quat"}]),rt(yn,"Color",[{name:"sub",newName:"subtract",target:yn,targetName:"Color"},{name:"mul",newName:"multiply",target:yn,targetName:"Color"},{name:"div",newName:"divide",target:yn,targetName:"Color"},{name:"exactEquals",newName:"strictEquals",target:yn,targetName:"Color"},{name:"fromHex",newName:"fromHEX",customFunction:function(){for(var t=arguments.length,e=new Array(t),i=0;i=t.x&&this.y<=t.y&&this.y+this.height>=t.y},i.containsRect=function(t){return this.x<=t.x&&this.x+this.width>=t.x+t.width&&this.y<=t.y&&this.y+this.height>=t.y+t.height},i.transformMat4=function(t){var e=this.x,i=this.y,n=e+this.width,r=i+this.height,s=t.m00*e+t.m04*i+t.m12,o=t.m01*e+t.m05*i+t.m13,a=t.m00*n+t.m04*i+t.m12,h=t.m01*n+t.m05*i+t.m13,u=t.m00*e+t.m04*r+t.m12,c=t.m01*e+t.m05*r+t.m13,l=t.m00*n+t.m04*r+t.m12,_=t.m01*n+t.m05*r+t.m13,d=Math.min(s,a,u,l),f=Math.max(s,a,u,l),p=Math.min(o,h,c,_),g=Math.max(o,h,c,_);return this.x=d,this.y=p,this.width=f-d,this.height=g-p,this},i.transformMat4ToPoints=function(t,e,i,n,r){var s=this.x,o=this.y,a=s+this.width,h=o+this.height;e.x=t.m00*s+t.m04*o+t.m12,e.y=t.m01*s+t.m05*o+t.m13,r.x=t.m00*a+t.m04*o+t.m12,r.y=t.m01*a+t.m05*o+t.m13,i.x=t.m00*s+t.m04*h+t.m12,i.y=t.m01*s+t.m05*h+t.m13,n.x=t.m00*a+t.m04*h+t.m12,n.y=t.m01*a+t.m05*h+t.m13},n(e,[{key:"xMin",get:function(){return this.x},set:function(t){this.width+=this.x-t,this.x=t}},{key:"yMin",get:function(){return this.y},set:function(t){this.height+=this.y-t,this.y=t}},{key:"xMax",get:function(){return this.x+this.width},set:function(t){this.width=t-this.x}},{key:"yMax",get:function(){return this.y+this.height},set:function(t){this.height=t-this.y}},{key:"center",get:function(){return new Hn(this.x+.5*this.width,this.y+.5*this.height)},set:function(t){this.x=t.x-.5*this.width,this.y=t.y-.5*this.height}},{key:"origin",get:function(){return new Hn(this.x,this.y)},set:function(t){this.x=t.x,this.y=t.y}},{key:"size",get:function(){return new Xn(this.width,this.height)},set:function(t){this.width=t.width,this.height=t.height}},{key:"z",get:function(){return this.width},set:function(t){this.width=t}},{key:"w",get:function(){return this.height},set:function(t){this.height=t}}]),e}(be));function Kn(t,e,i,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),new Yn(t,e,i,n)}Ti.fastDefine("cc.Rect",Yn,{x:0,y:0,width:0,height:0}),m.Rect=Yn,m.rect=Kn;var qn=t("MATH_FLOAT_ARRAY",Float64Array),Qn=t("MathBase",function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.createFloatArray=function(t){return new qn(t)},n(e,[{key:"array",get:function(){return this._array}}]),e}(be)),Zn=Object.freeze({__proto__:null,bits:R,Vec2:Hn,v2:zn,Vec3:_n,v3:dn,Vec4:on,v4:an,Quat:Rn,quat:Mn,Mat3:Sn,Mat4:Ln,mat4:Un,AffineTransform:Wn,Size:Xn,size:jn,Rect:Yn,rect:Kn,Color:yn,color:Tn,preTransforms:Nn,HALF_PI:wi,TWO_PI:Ii,EPSILON:xi,equals:Di,approx:Oi,clamp:Pi,clamp01:Mi,lerp:Ni,toRadian:Li,toDegree:Bi,random:Fi,setRandGenerator:ki,randomRange:Ui,randomRangeInt:Gi,pseudoRandom:Hi,pseudoRandomRange:zi,pseudoRandomRangeInt:Vi,nextPow2:Wi,repeat:Xi,pingPong:ji,inverseLerp:Yi,absMaxComponent:Ki,absMax:qi,enumerableProps:Qi,floatToHalf:nn,halfToFloat:rn,MATH_FLOAT_ARRAY:qn,MathBase:Qn});t("math",Zn);var Jn=new _n,$n=new _n,tr=new _n,er=new _n,ir=new _n,nr=new _n,rr=new Array(3),sr=new Array(3);function or(t,e){return _n.dot(e.n,t)-e.d}function ar(t,e,i){return _n.copy(t,e),_n.subtract(ir,i.center,i.halfExtents),_n.add(nr,i.center,i.halfExtents),t.x=t.xnr.x?nr.x:t.x,t.y=t.y>nr.y?nr.y:t.y,t.z=t.z>nr.z?nr.z:t.z,t}function hr(t,e,i){_n.set(Jn,i.orientation.m00,i.orientation.m01,i.orientation.m02),_n.set($n,i.orientation.m03,i.orientation.m04,i.orientation.m05),_n.set(tr,i.orientation.m06,i.orientation.m07,i.orientation.m08),rr[0]=Jn,rr[1]=$n,rr[2]=tr,sr[0]=i.halfExtents.x,sr[1]=i.halfExtents.y,sr[2]=i.halfExtents.z,_n.subtract(er,e,i.center),_n.set(t,i.center.x,i.center.y,i.center.z);for(var n=0;n<3;n++){var r=_n.dot(er,rr[n]);r>sr[n]&&(r=sr[n]),r<-sr[n]&&(r=-sr[n]),t.x+=r*rr[n].x,t.y+=r*rr[n].y,t.z+=r*rr[n].z}return t}var ur=Object.freeze({__proto__:null,point_plane:or,pt_point_plane:function(t,e,i){var n=or(e,i);return _n.subtract(t,e,_n.multiplyScalar(t,i.n,n))},pt_point_aabb:ar,pt_point_obb:hr,pt_point_line:function(t,e,i,n){_n.subtract(Jn,i,n);var r=Jn.clone(),s=_n.lengthSqr(r);if(0===s)_n.copy(t,i);else{_n.subtract(Jn,e,i);var o=_n.dot(Jn,r)/s;o<0?_n.copy(t,i):o>1?_n.copy(t,n):_n.scaleAndAdd(t,i,r,o)}}}),cr={SHAPE_RAY:1,SHAPE_LINE:2,SHAPE_SPHERE:4,SHAPE_AABB:8,SHAPE_OBB:16,SHAPE_PLANE:32,SHAPE_TRIANGLE:64,SHAPE_FRUSTUM:128,SHAPE_FRUSTUM_ACCURATE:256,SHAPE_CAPSULE:512,SHAPE_SPLINE:1024},lr=function(){function t(t,e,i,n,r,s){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=-1),this.s=void 0,this.e=void 0,this._type=void 0,this._type=cr.SHAPE_LINE,this.s=new _n(t,e,i),this.e=new _n(n,r,s)}return t.create=function(e,i,n,r,s,o){return new t(e,i,n,r,s,o)},t.clone=function(e){return new t(e.s.x,e.s.y,e.s.z,e.e.x,e.e.y,e.e.z)},t.copy=function(t,e){return _n.copy(t.s,e.s),_n.copy(t.e,e.e),t},t.fromPoints=function(t,e,i){return _n.copy(t.s,e),_n.copy(t.e,i),t},t.set=function(t,e,i,n,r,s,o){return t.s.x=e,t.s.y=i,t.s.z=n,t.e.x=r,t.e.y=s,t.e.z=o,t},t.len=function(t){return _n.distance(t.s,t.e)},t.prototype.length=function(){return _n.distance(this.s,this.e)},n(t,[{key:"type",get:function(){return this._type}}]),t}(),_r=function(){function t(t,e,i,n,r,s){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=-1),this._type=cr.SHAPE_RAY,this.o=new _n(t,e,i),this.d=new _n(n,r,s)}return t.create=function(e,i,n,r,s,o){return void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=0),void 0===o&&(o=1),new t(e,i,n,r,s,o)},t.clone=function(e){return new t(e.o.x,e.o.y,e.o.z,e.d.x,e.d.y,e.d.z)},t.copy=function(t,e){return _n.copy(t.o,e.o),_n.copy(t.d,e.d),t},t.fromPoints=function(t,e,i){return _n.copy(t.o,e),_n.normalize(t.d,_n.subtract(t.d,i,e)),t},t.set=function(t,e,i,n,r,s,o){return t.o.x=e,t.o.y=i,t.o.z=n,t.d.x=r,t.d.y=s,t.d.z=o,t},t.prototype.computeHit=function(t,e){_n.normalize(t,this.d),_n.scaleAndAdd(t,this.o,t,e)},n(t,[{key:"type",get:function(){return this._type}}]),t}(),dr=new _n,fr=new _n,pr=new _n,gr=new _n;function mr(t){return Math.max(Math.max(t.x,t.y),t.z)}var vr,yr,Tr,Er,Sr,Ar=function(){function t(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1),this._type=cr.SHAPE_SPHERE,this._center=new _n(t,e,i),this._radius=n}t.create=function(e,i,n,r){return new t(e,i,n,r)},t.clone=function(e){return new t(e.center.x,e.center.y,e.center.z,e.radius)},t.copy=function(t,e){return _n.copy(t.center,e.center),t.radius=e.radius,t},t.fromPoints=function(t,e,i){return _n.multiplyScalar(t.center,_n.add(dr,e,i),.5),t.radius=.5*_n.subtract(dr,i,e).length(),t},t.set=function(t,e,i,n,r){return t.center.x=e,t.center.y=i,t.center.z=n,t.radius=r,t};var e=t.prototype;return e.destroy=function(){},e.clone=function(){return t.clone(this)},e.copy=function(e){return t.copy(this,e)},e.getBoundary=function(t,e){_n.set(t,this.center.x-this.radius,this.center.y-this.radius,this.center.z-this.radius),_n.set(e,this.center.x+this.radius,this.center.y+this.radius,this.center.z+this.radius)},e.transform=function(t,e,i,n,r){_n.transformMat4(r.center,this.center,t),r.radius=this.radius*mr(n)},e.translateAndRotate=function(t,e,i){_n.transformMat4(i.center,this.center,t)},e.setScale=function(t,e){e.radius=this.radius*mr(t)},e.mergePoint=function(t){this.radius<0&&(this.center.set(t),this.radius=0),_n.subtract(fr,t,this.center);var e=fr.length();if(e>this.radius){var i=.5*(e-this.radius);this.radius+=i,_n.multiplyScalar(fr,fr,i/e),_n.add(this.center,this.center,fr)}},e.mergePoints=function(t){var e=t.length;if(!(e<1)){this.radius=-1;for(var i=0;i-Number.EPSILON))return 0;var r=1/n;_n.subtract(Er,t.o,e.a);var s=_n.dot(Er,Tr)*r;if(s<0||s>1)return 0;_n.cross(Sr,Er,vr);var o=_n.dot(t.d,Sr)*r;if(o<0||s+o>1)return 0;var a=_n.dot(yr,Sr)*r;return a<0?0:a}),Rr=function(){var t=new _n(0,0,0);return function(e,i){var n=i.radius,r=i.center,s=e.o,o=e.d,a=n*n;_n.subtract(t,r,s);var h=t.lengthSqr(),u=_n.dot(t,o),c=a-(h-u*u);if(c<0)return 0;var l=Math.sqrt(c),_=hp?0:f>0?f:p}(i,t,e)}}(),Ir=function(){var t=new _n,e=new _n,i=new _n,n=new _n,r=new _n,s=new _n,o=new _n,a=new Array(3),h=new Array(3),u=new Array(3),c=new Array(6);return function(l,_){a[0]=_.halfExtents.x,a[1]=_.halfExtents.y,a[2]=_.halfExtents.z,t=_.center,e=l.o,i=l.d,_n.set(n,_.orientation.m00,_.orientation.m01,_.orientation.m02),_n.set(r,_.orientation.m03,_.orientation.m04,_.orientation.m05),_n.set(s,_.orientation.m06,_.orientation.m07,_.orientation.m08),_n.subtract(o,t,e),h[0]=_n.dot(n,i),h[1]=_n.dot(r,i),h[2]=_n.dot(s,i),u[0]=_n.dot(n,o),u[1]=_n.dot(r,o),u[2]=_n.dot(s,o);for(var d=0;d<3;++d){if(0===h[d]){if(-u[d]-a[d]>0||-u[d]+a[d]<0)return 0;h[d]=1e-7}c[2*d+0]=(u[d]+a[d])/h[d],c[2*d+1]=(u[d]-a[d])/h[d]}var f=Math.max(Math.max(Math.min(c[0],c[1]),Math.min(c[2],c[3])),Math.min(c[4],c[5])),p=Math.min(Math.min(Math.max(c[0],c[1]),Math.max(c[2],c[3])),Math.max(c[4],c[5]));return p<0||f>p?0:f>0?f:p}}(),Dr=function(){var t=new _n,e=new _n,i=new _n,n=new _n,r=new _n,s=new _n,o=new _n,a=new Ar;return function(h,u){var c=u.ellipseCenter0,l=u.ellipseCenter1,_=_n.subtract(e,l,c);if(_.length()=0&&I<=1?b:I<0?(a.radius=u.radius,a.center.set(u.ellipseCenter0),ds.raySphere(h,a)):I>1?(a.radius=u.radius,a.center.set(u.ellipseCenter1),ds.raySphere(h,a)):0}}(),Or=function(){var t=new _n(0,0,0);return function(e,i){_n.subtract(t,e.e,e.s);var n=-or(e.s,i)/_n.dot(t,i.n);return n<0||n>1?0:n}}(),Pr=function(){var t=new _n(0,0,0),e=new _n(0,0,0),i=new _n(0,0,0),n=new _n(0,0,0),r=new _n(0,0,0),s=new _n(0,0,0);return function(o,a,h){_n.subtract(t,a.b,a.a),_n.subtract(e,a.c,a.a),_n.subtract(i,o.s,o.e),_n.cross(r,t,e);var u=_n.dot(i,r);if(u<=0)return 0;_n.subtract(n,o.s,a.a);var c=_n.dot(n,r);if(c<0||c>u)return 0;_n.cross(s,i,n);var l=_n.dot(e,s);if(l<0||l>u)return 0;var _=-_n.dot(t,s);if(_<0||l+_>u)return 0;if(h){var d=1/u,f=1-(l*=d)-(_*=d);_n.set(h,a.a.x*f+a.b.x*l+a.c.x*_,a.a.y*f+a.b.y*l+a.c.y*_,a.a.z*f+a.b.z*l+a.c.z*_)}return 1}}(),Mr=new _r;function Nr(t,e){Mr.o.set(t.s),_n.subtract(Mr.d,t.e,t.s),Mr.d.normalize();var i=wr(Mr,e);return i<=t.length()?i:0}function Lr(t,e){Mr.o.set(t.s),_n.subtract(Mr.d,t.e,t.s),Mr.d.normalize();var i=Ir(Mr,e);return i<=t.length()?i:0}function Br(t,e){Mr.o.set(t.s),_n.subtract(Mr.d,t.e,t.s),Mr.d.normalize();var i=Rr(Mr,e);return i<=t.length()?i:0}var Fr,kr,Ur,Gr,Hr=(Fr=new _n,kr=new _n,Ur=new _n,Gr=new _n,function(t,e){return _n.subtract(Fr,t.center,t.halfExtents),_n.add(kr,t.center,t.halfExtents),_n.subtract(Ur,e.center,e.halfExtents),_n.add(Gr,e.center,e.halfExtents),Fr.x<=Gr.x&&kr.x>=Ur.x&&Fr.y<=Gr.y&&kr.y>=Ur.y&&Fr.z<=Gr.z&&kr.z>=Ur.z});function zr(t,e,i,n,r,s){_n.set(s[0],t.x+i.x*e.x+n.x*e.y+r.x*e.z,t.y+i.y*e.x+n.y*e.y+r.y*e.z,t.z+i.z*e.x+n.z*e.y+r.z*e.z),_n.set(s[1],t.x-i.x*e.x+n.x*e.y+r.x*e.z,t.y-i.y*e.x+n.y*e.y+r.y*e.z,t.z-i.z*e.x+n.z*e.y+r.z*e.z),_n.set(s[2],t.x+i.x*e.x-n.x*e.y+r.x*e.z,t.y+i.y*e.x-n.y*e.y+r.y*e.z,t.z+i.z*e.x-n.z*e.y+r.z*e.z),_n.set(s[3],t.x+i.x*e.x+n.x*e.y-r.x*e.z,t.y+i.y*e.x+n.y*e.y-r.y*e.z,t.z+i.z*e.x+n.z*e.y-r.z*e.z),_n.set(s[4],t.x-i.x*e.x-n.x*e.y-r.x*e.z,t.y-i.y*e.x-n.y*e.y-r.y*e.z,t.z-i.z*e.x-n.z*e.y-r.z*e.z),_n.set(s[5],t.x+i.x*e.x-n.x*e.y-r.x*e.z,t.y+i.y*e.x-n.y*e.y-r.y*e.z,t.z+i.z*e.x-n.z*e.y-r.z*e.z),_n.set(s[6],t.x-i.x*e.x+n.x*e.y-r.x*e.z,t.y-i.y*e.x+n.y*e.y-r.y*e.z,t.z-i.z*e.x+n.z*e.y-r.z*e.z),_n.set(s[7],t.x-i.x*e.x-n.x*e.y+r.x*e.z,t.y-i.y*e.x-n.y*e.y+r.y*e.z,t.z-i.z*e.x-n.z*e.y+r.z*e.z)}function Vr(t,e){for(var i=_n.dot(e,t[0]),n=i,r=1;r<8;++r){var s=_n.dot(e,t[r]);i=sn?s:n}return[i,n]}var Wr,Xr,jr,Yr,Kr,qr=function(){for(var t=new Array(15),e=0;e<15;e++)t[e]=new _n(0,0,0);for(var i=new Array(8),n=new Array(8),r=0;r<8;r++)i[r]=new _n(0,0,0),n[r]=new _n(0,0,0);var s=new _n,o=new _n;return function(e,r){_n.set(t[0],1,0,0),_n.set(t[1],0,1,0),_n.set(t[2],0,0,1),_n.set(t[3],r.orientation.m00,r.orientation.m01,r.orientation.m02),_n.set(t[4],r.orientation.m03,r.orientation.m04,r.orientation.m05),_n.set(t[5],r.orientation.m06,r.orientation.m07,r.orientation.m08);for(var a=0;a<3;++a)_n.cross(t[6+3*a],t[a],t[3]),_n.cross(t[7+3*a],t[a],t[4]),_n.cross(t[7+3*a],t[a],t[5]);_n.subtract(s,e.center,e.halfExtents),_n.add(o,e.center,e.halfExtents),function(t,e,i){_n.set(i[0],t.x,e.y,e.z),_n.set(i[1],t.x,e.y,t.z),_n.set(i[2],t.x,t.y,e.z),_n.set(i[3],t.x,t.y,t.z),_n.set(i[4],e.x,e.y,e.z),_n.set(i[5],e.x,e.y,t.z),_n.set(i[6],e.x,t.y,e.z),_n.set(i[7],e.x,t.y,t.z)}(s,o,i),zr(r.center,r.halfExtents,t[3],t[4],t[5],n);for(var h=0;h<15;++h){var u=Vr(i,t[h]),c=Vr(n,t[h]);if(c[0]>u[1]||u[0]>c[1])return 0}return 1}}(),Qr=function(t,e){var i=t.halfExtents.x*Math.abs(e.n.x)+t.halfExtents.y*Math.abs(e.n.y)+t.halfExtents.z*Math.abs(e.n.z),n=_n.dot(e.n,t.center);return n+ie.d?0:1},Zr=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 c=0;cn.halfExtents.y?e++:t[c].y<-n.halfExtents.y&&i++;if(e===r.vertices.length||i===r.vertices.length)return 0;e=0,i=0;for(var l=0;ln.halfExtents.z?e++:t[l].z<-n.halfExtents.z&&i++;return e===r.vertices.length||i===r.vertices.length?0:1}}(),$r=(Wr=new _n(0,0,0),Xr=new Sn,function(t,e){return _n.subtract(Wr,e,t.center),_n.transformMat3(Wr,Wr,Sn.transpose(Xr,t.orientation)),i=Wr,n=t.halfExtents,Math.abs(i.x)e.d?0:1}),es=function(t,e){for(var i=0;ir.halfExtents.x?i++:e<-r.halfExtents.x&&n++;if(i===o.vertices.length||n===o.vertices.length)return 0;i=0,n=0;for(var _=0;_r.halfExtents.y?i++:e<-r.halfExtents.y&&n++;if(i===o.vertices.length||n===o.vertices.length)return 0;i=0,n=0;for(var d=0;dr.halfExtents.z?i++:e<-r.halfExtents.z&&n++;return i===o.vertices.length||n===o.vertices.length?0:1}}(),ns=function(){for(var t=new Array(15),e=0;e<15;e++)t[e]=new _n(0,0,0);for(var i=new Array(8),n=new Array(8),r=0;r<8;r++)i[r]=new _n(0,0,0),n[r]=new _n(0,0,0);return function(e,r){_n.set(t[0],e.orientation.m00,e.orientation.m01,e.orientation.m02),_n.set(t[1],e.orientation.m03,e.orientation.m04,e.orientation.m05),_n.set(t[2],e.orientation.m06,e.orientation.m07,e.orientation.m08),_n.set(t[3],r.orientation.m00,r.orientation.m01,r.orientation.m02),_n.set(t[4],r.orientation.m03,r.orientation.m04,r.orientation.m05),_n.set(t[5],r.orientation.m06,r.orientation.m07,r.orientation.m08);for(var s=0;s<3;++s)_n.cross(t[6+3*s],t[s],t[3]),_n.cross(t[7+3*s],t[s],t[4]),_n.cross(t[8+3*s],t[s],t[5]);zr(e.center,e.halfExtents,t[0],t[1],t[2],i),zr(r.center,r.halfExtents,t[3],t[4],t[5],n);for(var o=0;o<15;++o){var a=Vr(i,t[o]),h=Vr(n,t[o]);if(h[0]>a[1]||a[0]>h[1])return 0}return 1}}(),rs=function(){for(var t=new Ar,e=new _n,i=new _n,n=new _n,r=new Array(8),s=0;s<8;s++)r[s]=new _n;for(var o=new Array(8),a=0;a<8;a++)o[a]=new _n;return function(s,a){if(0===_n.squaredDistance(a.ellipseCenter0,a.ellipseCenter1))return t.radius=a.radius,t.center.set(a.ellipseCenter0),ds.sphereOBB(t,s);e.x=s.orientation.m00,e.y=s.orientation.m01,e.z=s.orientation.m02,i.x=s.orientation.m03,i.y=s.orientation.m04,i.z=s.orientation.m05,n.x=s.orientation.m06,n.y=s.orientation.m07,n.z=s.orientation.m08,zr(s.center,s.halfExtents,e,i,n,r);var h=o,u=_n.copy(h[0],e),c=_n.copy(h[1],i),l=_n.copy(h[2],n);_n.subtract(h[3],a.center,s.center).normalize();var _=_n.subtract(h[4],a.ellipseCenter0,a.ellipseCenter1);_.normalize(),_n.cross(h[5],u,_),_n.cross(h[6],c,_),_n.cross(h[7],l,_);for(var d=0;d<8;++d){var f=Vr(r,h[d]),p=_n.dot(h[d],a.ellipseCenter0),g=_n.dot(h[d],a.ellipseCenter1),m=Math.max(p,g),v=Math.min(p,g)-a.radius,y=m+a.radius;if(v>f[1]||f[0]>y)return 0}return 1}}(),ss=function(t,e){var i=_n.dot(e.n,t.center),n=t.radius*e.n.length();return i+ne.d?0:1},os=function(t,e){for(var i=0;ia)){_n.add(Yr,s,_n.multiplyScalar(Yr,o,r));for(var u=0;u<6;u++)if(u!==i&&u!==i+Kr[i]){var c=e.planes[u];if(_n.dot(c.n,Yr)1?_n.squaredDistance(i.center,n.ellipseCenter1)y&&(h=y,u=m+f,T=p)),u<0?(u=0,-g<0?h=0:-g>d?h=y:(h=-g,y=d)):u>T&&(u=T,-g+f<0?h=0:-g+f>d?h=y:(h=-g+f,y=d));var E=Math.abs(h)0&&(t.d=e.d/i),t},t.prototype.transform=function(t){Ln.invert(As,t),Ln.transpose(As,As),on.set(bs,this.n.x,this.n.y,this.n.z,-this.d),on.transformMat4(bs,bs,As),_n.set(this.n,bs.x,bs.y,bs.z),this.d=-bs.w},n(t,[{key:"type",get:function(){return this._type}},{key:"x",get:function(){return this.n.x},set:function(t){this.n.x=t}},{key:"y",get:function(){return this.n.y},set:function(t){this.n.y=t}},{key:"z",get:function(){return this.n.z},set:function(t){this.n.z=t}},{key:"w",get:function(){return this.d},set:function(t){this.d=t}}]),t}(),Rs=function(){function t(t,e,i,n,r,s,o,a,h){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1),void 0===r&&(r=0),void 0===s&&(s=0),void 0===o&&(o=0),void 0===a&&(a=1),void 0===h&&(h=0),this._type=cr.SHAPE_TRIANGLE,this.a=new _n(t,e,i),this.b=new _n(n,r,s),this.c=new _n(o,a,h)}return t.create=function(e,i,n,r,s,o,a,h,u){return void 0===e&&(e=1),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=0),void 0===o&&(o=0),void 0===a&&(a=0),void 0===h&&(h=0),void 0===u&&(u=1),new t(e,i,n,r,s,o,a,h,u)},t.clone=function(e){return new t(e.a.x,e.a.y,e.a.z,e.b.x,e.b.y,e.b.z,e.c.x,e.c.y,e.c.z)},t.copy=function(t,e){return _n.copy(t.a,e.a),_n.copy(t.b,e.b),_n.copy(t.c,e.c),t},t.fromPoints=function(t,e,i,n){return _n.copy(t.a,e),_n.copy(t.b,i),_n.copy(t.c,n),t},t.set=function(t,e,i,n,r,s,o,a,h,u){return t.a.x=e,t.a.y=i,t.a.z=n,t.b.x=r,t.b.y=s,t.b.z=o,t.c.x=a,t.c.y=h,t.c.z=u,t},n(t,[{key:"type",get:function(){return this._type}}]),t}();gt({replaceProperty:{since:"3.6.0",removed:!1},removeProperty:{since:"3.6.0",removed:!1},markAsWarning:{since:"3.6.0",removed:!1},setDefaultLogTimes:{since:"3.6.0",removed:!1}});var ws,Is,xs={};ws=xs,Is=wx,Object.keys(Is).forEach((function(t){"function"!=typeof Is[t]?ws[t]=Is[t]:ws[t]=Is[t].bind(Is)})),xs.wx={},xs.wx.onKeyDown=null===(fs=wx.onKeyDown)||void 0===fs?void 0:fs.bind(wx),xs.wx.onKeyUp=null===(ps=wx.onKeyUp)||void 0===ps?void 0:ps.bind(wx),xs.wx.onMouseDown=null===(gs=wx.onMouseDown)||void 0===gs?void 0:gs.bind(wx),xs.wx.onMouseMove=null===(ms=wx.onMouseMove)||void 0===ms?void 0:ms.bind(wx),xs.wx.onMouseUp=null===(vs=wx.onMouseUp)||void 0===vs?void 0:vs.bind(wx),xs.wx.onWheel=null===(ys=wx.onWheel)||void 0===ys?void 0:ys.bind(wx);var Ds,Os,Ps=wx.getSystemInfoSync();Ds=0,Os=null,Os=setInterval((function(){var t=wx.getSystemInfoSync();Ps.screenWidth===t.screenWidth&&Ps.screenHeight===t.screenHeight?++Ds>=10&&null!==Os&&(clearInterval(Os),Os=null):Ds=0,Ps=t}),500),null===(Ts=xs.onWindowResize)||void 0===Ts||Ts.call(xs,(function(){Ps=wx.getSystemInfoSync()})),xs.getSystemInfoSync=function(){return Ps};var Ms=xs.getSystemInfoSync();xs.isDevTool="devtools"===Ms.platform,Object.defineProperty(xs,"isLandscape",{get:function(){var t=wx.getSystemInfoSync();return"string"==typeof t.deviceOrientation?t.deviceOrientation.startsWith("landscape"):t.screenWidth>t.screenHeight}});var Ns,Ls,Bs,Fs,ks=Re.LANDSCAPE_RIGHT;if("android"!==Ms.platform.toLocaleLowerCase()&&wx.onDeviceOrientationChange((function(t){"landscape"===t.value?ks=Re.LANDSCAPE_RIGHT:"landscapeReverse"===t.value&&(ks=Re.LANDSCAPE_LEFT)})),Object.defineProperty(xs,"orientation",{get:function(){return xs.isLandscape?ks:Re.PORTRAIT}}),xs.onAccelerometerChange=function(t){xs.offAccelerometerChange(),Ns=function(e){var i=e.x,n=e.y;if(xs.isLandscape){var r=ks===Re.LANDSCAPE_RIGHT?1:-1,s=i;i=-n*r,n=s*r}var o={x:i,y:n,z:e.z};t(o)}},xs.offAccelerometerChange=function(){Ns&&(wx.offAccelerometerChange(Ns),Ns=void 0)},xs.startAccelerometer=function(t){Ns&&wx.onAccelerometerChange(Ns),wx.startAccelerometer(t)},xs.createInnerAudioContext=(Ls=wx,Bs={onPlay:!0,onPause:!0,onStop:!0,onSeek:!1},void 0===(Fs=!0)&&(Fs=!1),function(){var t=Ls.createInnerAudioContext();if(Bs.onPlay){var e=t.play,i=null;Object.defineProperty(t,"onPlay",{configurable:!0,value:function(t){i=t}}),Object.defineProperty(t,"play",{configurable:!0,value:function(){e.call(t),i&&(Fs?setTimeout(i,0):i())}})}if(Bs.onPause){var n=t.pause,r=null;Object.defineProperty(t,"onPause",{configurable:!0,value:function(t){r=t}}),Object.defineProperty(t,"pause",{configurable:!0,value:function(){n.call(t),r&&(Fs?setTimeout(r,0):r())}})}if(Bs.onStop){var s=t.stop,o=null;Object.defineProperty(t,"onStop",{configurable:!0,value:function(t){o=t}}),Object.defineProperty(t,"stop",{configurable:!0,value:function(){s.call(t),o&&(Fs?setTimeout(o,0):o())}})}if(Bs.onSeek){var a=t.seek,h=null;Object.defineProperty(t,"onSeeked",{configurable:!0,value:function(t){h=t}}),Object.defineProperty(t,"seek",{configurable:!0,value:function(e){a.call(t,e),h&&(Fs?setTimeout(h,0):h())}})}return t}),xs.getSafeArea=function(){return wx.getSystemInfoSync().safeArea},"windows"===Ms.platform&&function(t,e){var i=/\d+\.\d+\.\d+/;if(!i.test(t)||!i.test(e))return q(16356),0;for(var n=t.split(".").map((function(t){return Number.parseInt(t)})),r=e.split(".").map((function(t){return Number.parseInt(t)})),s=0;s<3;++s){var o=n[s],a=r[s];if(o!==a)return o-a}return 0}(Ms.SDKVersion,"2.16.0")<0){var Us=canvas;if(Us){var Gs=Us.getContext("webgl"),Hs=Gs.useProgram.bind(Gs);Gs.useProgram=function(t){t&&Hs(t)}}}var zs=function(){function t(){this._poolHandle=-1,Vs.addContainer(this)}return t.prototype.destroy=function(){Vs.removeContainer(this)},t}(),Vs=new(function(){function t(){this._pools=[],this._lastShrinkPassed=0,this.shrinkTimeSpan=5}var e=t.prototype;return e.addContainer=function(t){-1===t._poolHandle&&(t._poolHandle=this._pools.length,this._pools.push(t))},e.removeContainer=function(t){-1!==t._poolHandle&&(this._pools[this._pools.length-1]._poolHandle=t._poolHandle,he(this._pools,t._poolHandle),t._poolHandle=-1)},e.tryShrink=function(){for(var t=0;tthis.shrinkTimeSpan&&(this.tryShrink(),this._lastShrinkPassed-=this.shrinkTimeSpan)},t}()),Ws=t("Pool",function(t){function e(e,i,n,r){var s;(s=t.call(this)||this)._freePool=[],s._ctor=e,s._dtor=n||null,s._elementsPerBatch=Math.max(i,1),s._shrinkThreshold=r?T(r,1):s._elementsPerBatch,s._nextAvail=s._elementsPerBatch-1;for(var o=0;o>1>=this._shrinkThreshold?t>>1:Math.floor((t-this._shrinkThreshold+1)/2),this._dtor)for(var i=this._nextAvail-e+1;i<=this._nextAvail;++i)this._dtor(this._freePool[i]);this._nextAvail-=e,this._freePool.length=this._nextAvail+1}},i.destroy=function(){var e=arguments.length>0?arguments[0]:null;e&&q(14100);var i=e||this._dtor;if(i)for(var n=0;n<=this._nextAvail;n++)i(this._freePool[n]);this._freePool.length=0,this._nextAvail=-1,t.prototype.destroy.call(this)},e}(zs)),Xs=t("RecyclePool",function(t){function e(e,i,n){var r;(r=t.call(this)||this)._count=0,r._fn=e,r._dtor=n||null,r._data=new Array(i),r._initSize=i;for(var s=0;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}(zs)),js=t("CachedArray",function(t){function e(e,i){var n;return(n=t.call(this)||this).length=0,n._initSize=0,n.array=new Array(e),n._initSize=e,n._compareFn=i,n}s(e,t);var i=e.prototype;return i.push=function(t){this.array[this.length++]=t},i.pop=function(){return this.array[--this.length]},i.get=function(t){return this.array[t]},i.clear=function(){this.length=0},i.destroy=function(){this.length=0,this.array.length=0,t.prototype.destroy.call(this)},i.tryShrink=function(){this.array.length>>2>this.length&&(this.array.length=Math.max(this._initSize,this.array.length>>1))},i.sort=function(){this.array.length=this.length,this.array.sort(this._compareFn)},i.concat=function(t){for(var e=0;e=this.length||t<0)){var e=--this.length;this.array[t]=this.array[e]}},i.indexOf=function(t){for(var e=0,i=this.length;e=0;--t)this.callbackInfos[t]||Js(this.callbackInfos,t);this.containCanceled=!1},e.clear=function(){this.cancelAll(),this.callbackInfos.length=0,this.isInvoking=!1,this.containCanceled=!1},t}(),no=new Ws((function(){return new io}),16),ro=t("CallbacksInvoker",function(){function t(){this._callbackTable=Dt(!0),this._offCallback=void 0}var e=t.prototype;return e.on=function(t,e,i,n){if(!this.hasEventListener(t,e,i)){var r=this._callbackTable[t];r||(r=this._callbackTable[t]=no.alloc());var s=eo.alloc();s.set(e,i,n),r.callbackInfos.push(s)}return e},e.hasEventListener=function(t,e,i){var n=this._callbackTable&&this._callbackTable[t];if(!n)return!1;var r=n.callbackInfos;if(!e){if(n.isInvoking){for(var s=0;s0}for(var o=0;o0&&i.height>0;e(t)},i.onerror=function(){clearTimeout(n),e(!1)},i.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA"}catch(t){e(!1)}else e(!1)}))},i._registerEvent=function(){var t=this;xs.onHide((function(){t.emit("hide")})),xs.onShow((function(){t.emit("show")}))},i._setFeature=function(t,e){return this._featureMap[t]=e},i.init=function(){return Promise.all(this._initPromise)},i.hasFeature=function(t){return this._featureMap[t]},i.getBatteryLevel=function(){return xs.getBatteryInfoSync().level/100},i.triggerGC=function(){var t;null===(t=xs.triggerGC)||void 0===t||t.call(xs)},i.openURL=function(){},i.now=function(){return Date.now?Date.now():+new Date},i.restartJSVM=function(){},i.exit=function(){var t;null===(t=xs.exitMiniProgram)||void 0===t||t.call(xs)},i.close=function(){this.exit()},e}(oo)),mo=/(\.[^\.\/\?\\]*)(\?.*)?$/,vo=/((.*)(\/|\\|\\\\))?(.*?\..*$)?/,yo=/[^\.\/]+\/\.\.\//;function To(){for(var t="",e=arguments.length,i=new Array(e),n=0;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 bo(t){var e=vo.exec(t);return e?e[2]:""}function Co(t,e){e=e||"";var i=t.indexOf("?"),n="";return i>0&&(n=t.substring(i),t=t.substring(0,i)),(i=t.lastIndexOf("."))<0?t+e+n:t.substring(0,i)+e+n}function Ro(t,e,i){if(0===e.indexOf("."))return Co(t,e);var n=t.indexOf("?"),r="",s=i?Eo(t):"";return n>0&&(r=t.substring(n),t=t.substring(0,n)),n=(n=t.lastIndexOf("/"))<=0?0:n+1,t.substring(0,n)+e+s+r}function wo(t){var e=t=String(t);do{e=t,t=t.replace(yo,"")}while(e.length!==t.length);return t}function Io(t){return t.replace(/[\/\\]$/,"")}function xo(){return go.os===co.WINDOWS?"\\":"/"}t("path",Object.freeze({__proto__:null,join:To,extname:Eo,mainFileName:So,basename:Ao,dirname:bo,changeExtname:Co,changeBasename:Ro,_normalize:wo,stripSep:Io,getSeperator:xo}));var Do=new _n;function Oo(t,e,i,n){n||(n=new _n),t.convertToUINode(e,i,n);var r=i.position;return n.add(r),n}function Po(t,e,i){return i||(i=new _n),t.worldToScreen(e,i),i.x/=m.view.getScaleX(),i.y/=m.view.getScaleY(),i}var Mo=t("convertUtils",{WorldNode3DToLocalNodeUI:Oo,WorldNode3DToWorldNodeUI:Po});m.pipelineUtils=Mo,rt(m.pipelineUtils,"cc.pipelineUtils",[{name:"WorldNode3DToLocalNodeUI",newName:"convertToUINode",targetName:"cc.Camera.prototype",customFunction:function(){for(var t=arguments.length,e=new Array(t),i=0;i0&&q(1400,"screen.requestFullScreen(element, onFullScreenChange?, onFullScreenError?)","screen.requestFullScreen(): Promise"),No.requestFullScreen().then((function(){null==e||e.call(document)})).catch((function(t){k(t),null==i||i.call(document)}))},e.exitFullScreen=function(){return No.exitFullScreen()},e.autoFullScreen=function(t,e){var i;null===(i=this.requestFullScreen(t,e))||void 0===i||i.catch((function(t){F(t)}))},e.disableAutoFullScreen=function(){},e.on=function(t,e,i){No.on(t,e,i)},e.once=function(t,e,i){No.once(t,e,i)},e.off=function(t,e,i){No.off(t,e,i)},n(t,[{key:"devicePixelRatio",get:function(){return No.devicePixelRatio}},{key:"windowSize",get:function(){return No.windowSize},set:function(t){No.windowSize=t}},{key:"resolution",get:function(){return No.resolution}},{key:"supportsFullScreen",get:function(){return No.supportFullScreen}}]),t}(),Bo=t("screen",new Lo);m.screen=Bo;var Fo=t("sys",{Feature:_o,hasFeature:function(t){return go.hasFeature(t)},NetworkType:uo,Language:ho,OS:co,Platform:lo,BrowserType:ao,isNative:go.isNative,isBrowser:go.isBrowser,isMobile:go.isMobile,isLittleEndian:go.isLittleEndian,platform:go.platform,language:go.language,languageCode:go.nativeLanguage,os:go.os,osVersion:go.osVersion,osMainVersion:go.osMainVersion,browserType:go.browserType,browserVersion:go.browserVersion,isXR:go.isXR,windowPixelResolution:Bo.windowSize,capabilities:{canvas:!0,opengl:!0,webp:go.hasFeature(_o.WEBP),imageBitmap:go.hasFeature(_o.IMAGE_BITMAP),touches:go.hasFeature(_o.INPUT_TOUCH),mouse:go.hasFeature(_o.EVENT_MOUSE),keyboard:go.hasFeature(_o.EVENT_KEYBOARD),accelerometer:go.hasFeature(_o.EVENT_ACCELEROMETER)},localStorage:{},getNetworkType:function(){return go.networkType},getBatteryLevel:function(){return go.getBatteryLevel()},garbageCollect:function(){go.triggerGC()},isObjectValid:function(t){return null!=t},__isWebIOS14OrIPadOS14Env:!1,dump:function(){var t="";t+="isMobile : "+this.isMobile+"\r\n",t+="language : "+this.language+"\r\n",t+="browserType : "+this.browserType+"\r\n",t+="browserVersion : "+this.browserVersion+"\r\n",t+="supports webp: "+Fo.hasFeature(_o.WEBP)+"\r\n",t+="supports bitmap: "+Fo.hasFeature(_o.IMAGE_BITMAP)+"\r\n",t+="supports touches: "+Fo.hasFeature(_o.INPUT_TOUCH)+"\r\n",t+="supports mouse: "+Fo.hasFeature(_o.EVENT_MOUSE)+"\r\n",t+="supports keyboard: "+Fo.hasFeature(_o.EVENT_KEYBOARD)+"\r\n",t+="supports accelerometer: "+Fo.hasFeature(_o.EVENT_ACCELEROMETER)+"\r\n",t+="os : "+this.os+"\r\n",t+="osVersion : "+this.osVersion+"\r\n",t+="platform : "+this.platform+"\r\n",B(t+="Using "+(m.game.renderType===m.game.RENDER_TYPE_WEBGL?"WEBGL":"CANVAS")+" renderer.\r\n")},openURL:function(t){go.openURL(t)},init:function(){var t=this;return Promise.resolve().then((function(){return go.init()})).then((function(){try{var e=Fo.localStorage=window.localStorage;e.setItem("storage",""),e.removeItem("storage"),e=null}catch(e){var i=function(){q(5200)};t.localStorage={getItem:i,setItem:i,clear:i,removeItem:i,key:i,length:0}}var n;t.__isWebIOS14OrIPadOS14Env=(Fo.os===co.IOS||Fo.os===co.OSX)&&(null===(n=GameGlobal)||void 0===n?void 0:n.isIOSHighPerformanceMode)&&/(OS 1((4\.[0-9])|(5\.[0-3])))|(Version\/1((4\.[0-9])|(5\.[0-3])))/.test(window.navigator.userAgent)}))},now:function(){return go.now()},restartVM:function(){go.restartJSVM()},getSafeAreaRect:function(t){void 0===t&&(t=!0);var e=m.view,i=No.safeAreaEdge;t&&(No.orientation===Ie.ORIENTATION_PORTRAIT?i.topGo.x&&(Go.x=t.x),t.y>Go.y&&(Go.y=t.y),t.z>Go.z&&(Go.z=t.z),_n.add(Ho,Uo,Go),this.center.set(_n.multiplyScalar(Ho,Ho,.5)),this.halfExtents.set(Go.x-Ho.x,Go.y-Ho.y,Go.z-Ho.z)},e.mergePoints=function(t){if(!(t.length<1))for(var e=0;e>>1;n<=r;s=n+r>>>1){var o=t[s];if(o>e+i)r=s-1;else{if(!(o=t._times.length)return{done:!0,value:void 0};var i=[t._times[e],t._values[e]];return++e,{done:!1,value:i}}}},e.keyframes=function(){return this},e.times=function(){return this._times},e.values=function(){return this._values},e.getKeyframeTime=function(t){return this._times[t]},e.getKeyframeValue=function(t){return this._values[t]},e.addKeyFrame=function(t,e){return this._insertNewKeyframe(t,e)},e.removeKeyframe=function(t){this._times.splice(t,1),this._values.splice(t,1)},e.indexOfKeyframe=function(t){return na(this._times,t)},e.updateTime=function(t,e){var i=this._values[t];this.removeKeyframe(t),this._insertNewKeyframe(e,i)},e.assignSorted=function(t,e){if(void 0!==e)this.setKeyframes(t.slice(),e.slice());else{var i=Array.from(t);this.setKeyframes(i.map((function(t){return t[0]})),i.map((function(t){return t[1]})))}},e.clear=function(){this._times.length=0,this._values.length=0},e.searchKeyframe=function(t){return na(this._times,t)},e.setKeyframes=function(t,e){t.length,e.length,function(t){t.every((function(t,e,i){return 0===e||t>i[e-1]||Oi(t,i[e-1],1e-6)}))}(t),this._times=t,this._values=e},e._insertNewKeyframe=function(t,e){var i=this._times,n=this._values,r=i.length,s=na(i,t);if(s>=0)return s;var o=~s;return 0===o?(i.unshift(t),n.unshift(e)):o===r?(i.push(t),n.push(e)):(i.splice(o-1,0,t),n.splice(o-1,0,e)),o},n(t,[{key:"keyFramesCount",get:function(){return this._times.length}},{key:"rangeMin",get:function(){return this._times[0]}},{key:"rangeMax",get:function(){return this._times[this._values.length-1]}}]),t}();function ha(t){return t>-1e-9&&t<1e-9}function ua(t,e,i,n){return i.slice().reverse().reduce((function(i,n){return n(t,e,i)||i}),n)}Ti.fastDefine("cc.KeyframeCurve",aa,{_times:[],_values:[]}),t("RealInterpolationMode",ra),function(t){t[t.LINEAR=0]="LINEAR",t[t.CONSTANT=1]="CONSTANT",t[t.CUBIC=2]="CUBIC"}(ra||t("RealInterpolationMode",ra={})),t("ExtrapolationMode",sa),function(t){t[t.LINEAR=0]="LINEAR",t[t.CLAMP=1]="CLAMP",t[t.LOOP=2]="LOOP",t[t.PING_PONG=3]="PING_PONG"}(sa||t("ExtrapolationMode",sa={})),t("TangentWeightMode",oa),function(t){t[t.NONE=0]="NONE",t[t.LEFT=1]="LEFT",t[t.RIGHT=2]="RIGHT",t[t.BOTH=3]="BOTH"}(oa||t("TangentWeightMode",oa={}));var ca=function(){},la=function(){return ca},_a=da((function(){}));function da(t){return function(e){return"function"==typeof e?t(e):function(i){return t(i,e)}}}function fa(t){return function(e){return function(i){!function(t,e,i){var n=ga(t);if(n){var r=ma(n,"proto");ma(r,"editor")[e]=i}}(i,t,e)}}}var pa="__ccclassCache__";function ga(t){return ma(t,pa)}function ma(t,e){return t[e]||(t[e]={})}var va=da((function(t,e){var i=Vt(t);i===Object&&(i=null);var n={name:e,extends:i,ctor:t},r=t[pa];if(r){var s=r.proto;s&&Ht(n,s),t[pa]=void 0}return Ti(n)})),ya=fa("requireComponent"),Ta=fa("executionOrder"),Ea=_a;function Sa(t,e,i){var n=null;function r(t,e,i){!function(t,e,i,n,r,s){var o,a=s&&"function"!=typeof s&&(s.get||s.set);r&&(o=ai(r,a));var h=Ht(e,o||r||{});a?(s.get&&(h.get=s.get),s.set&&(h.set=s.set)):Ca(t,h,i,n,s)}(function(t){return ga(t.constructor)}(t),function(t,e){var i,n,r=ma(ga(t.constructor),"proto"),s=ma(r,"properties");return null!==(n=s[i=e])&&void 0!==n?n:s[i]={}}(t,e),t.constructor,e,n,i)}return void 0===t?Sa({type:void 0}):void 0===e?(n=t,r):void r(t,e,i)}function Aa(t){var e;try{e=t()}catch(e){return t}return"object"!=typeof e||null===e?e:t}function ba(t,e,i){var n,r,s=ga(t.constructor),o=ma(s,"proto"),a=ma(o,"properties"),h=null!==(r=a[n=e])&&void 0!==r?r:a[n]={};return h.__internalFlags|=hi.STANDALONE,i&&"function"!=typeof i&&(i.get||i.set)?(i.get&&(h.get=i.get),i.set&&(h.set=i.set)):Ca(s,h,t.constructor,e,i),h}function Ca(t,e,i,n,r){if(void 0!==r)"function"==typeof r?e.default=Aa(r):null===r||r.initializer&&(e.default=Aa(r.initializer));else{var s=t.default||(t.default=function(t){var e;try{e=new t}catch(t){return{}}return e}(i));s.hasOwnProperty(n)&&(e.default=s[n])}}var Ra=Symbol("cc:SerializationMetadata"),wa=t("serializable",(function(t,e,i){Da(ba(t,e,i))}));function Ia(t){return function(e,i,n){var r=ba(e,i,n);r.formerlySerializedAs=t,Da(r)}}var xa=function(t,e,i){var n=ba(t,e,i);n.editorOnly=!0,Da(n)};function Da(t){t.__internalFlags|=hi.IMPLICIT_SERIALIZABLE}var Oa=ca,Pa=_a,Ma=la,Na=_a,La=la,Ba=la,Fa=la,ka=t("editable",ca),Ua=t("visible",la),Ga=t("displayName",la),Ha=t("tooltip",la),za=t("range",la),Va=t("rangeStep",la),Wa=t("slide",ca),Xa=t("displayOrder",la),ja=t("disallowAnimation",ca),Ya=Za(Ze),Ka=Za(Je),qa=Za($e),Qa=Za(ti);function Za(t){return Sa({type:t})}var Ja,$a,th,eh,ih,nh,rh,sh,oh,ah,hh=t("override",(function(t,e,i){ba(t,e,i).override=!0})),uh=t("EditorExtendable",(function(){})),ch=Object.freeze({__proto__:null,uniquelyReferenced:Oa,ccclass:va,property:Sa,requireComponent:ya,executionOrder:Ta,disallowMultiple:Ea,executeInEditMode:Pa,menu:Ma,playOnFocus:Na,inspector:La,icon:Ba,help:Fa,type:Za,integer:Ya,float:Ka,boolean:qa,string:Qa,editable:ka,tooltip:Ha,visible:Ua,displayName:Ga,displayOrder:Xa,range:za,rangeStep:Va,slide:Wa,disallowAnimation:ja,override:hh,formerlySerializedAs:Ia,serializable:wa});function lh(t,e){return(e<<3)+t}function _h(t){return fh[t]}function dh(t){switch(t){case oh.Uint8:return Uint8Array;case oh.Uint16:return Uint16Array;case oh.Uint32:return Uint32Array;case oh.Int8:return Int8Array;case oh.Int16:return Int16Array;case oh.Int32:return Int32Array;case oh.Float32:return Float32Array;case oh.Float64:return Float64Array}}t("_decorator",ch),function(t){t[t.Uint8=0]="Uint8",t[t.Uint16=1]="Uint16",t[t.Uint32=2]="Uint32",t[t.Int8=3]="Int8",t[t.Int16=4]="Int16",t[t.Int32=5]="Int32",t[t.Float32=6]="Float32",t[t.Float64=7]="Float64"}(oh||(oh={})),function(t){t[t.Scalar=0]="Scalar",t[t.Vec2=1]="Vec2",t[t.Vec3=2]="Vec3",t[t.Vec4=3]="Vec4",t[t.Quat=4]="Quat",t[t.Mat4=5]="Mat4"}(ah||(ah={})),t("CompactValueTypeArray",va("cc.CompactValueTypeArray")(((rh=function(){function t(){this._byteOffset=th&&th(),this._unitCount=eh&&eh(),this._unitElement=ih&&ih(),this._length=nh&&nh()}return t.lengthFor=function(t,e,i){return _h(e).requiredUnits*t.length*dh(i).BYTES_PER_ELEMENT},t.compress=function(e,i,n,r,s,o){for(var a=_h(i),h=dh(n),u=a.requiredUnits*e.length,c=new h(r,s,u),l=0;l>3},n=i.storageUnit,r=_h(i.elementType),s=new(dh(n))(t,this._byteOffset,this._unitCount),o=new Array(this._length),a=0;a=1?1:t*t*(3-2*t)}function Qh(t){return t<=0?0:t>=1?1:t*t*t*(t*(6*t-15)+10)}m._decorator=ch;var Zh=au(yh,Th),Jh=au(Sh,Ah),$h=au(Ch,Rh),tu=au(Ih,xh),eu=au(Oh,Ph),iu=au(Nh,Lh),nu=au(Fh,kh),ru=au(Gh,Hh),su=au(Vh,Wh),ou=au(jh,Yh);function au(t,e){return function(i){return i<.5?e(2*i)/2:t(2*i-1)/2+.5}}var hu,uu,cu=Object.freeze({__proto__:null,constant:mh,linear:vh,quadIn:yh,quadOut:Th,quadInOut:Eh,cubicIn:Sh,cubicOut:Ah,cubicInOut:bh,quartIn:Ch,quartOut:Rh,quartInOut:wh,quintIn:Ih,quintOut:xh,quintInOut:Dh,sineIn:Oh,sineOut:Ph,sineInOut:Mh,expoIn:Nh,expoOut:Lh,expoInOut:Bh,circIn:Fh,circOut:kh,circInOut:Uh,elasticIn:Gh,elasticOut:Hh,elasticInOut:zh,backIn:Vh,backOut:Wh,backInOut:Xh,bounceIn:jh,bounceOut:Yh,bounceInOut:Kh,smooth:qh,fade:Qh,quadOutIn:Zh,cubicOutIn:Jh,quartOutIn:$h,quintOutIn:tu,sineOutIn:eu,expoOutIn:iu,circOutIn:nu,elasticOutIn:ru,backOutIn:su,bounceOutIn:ou});t("easing",cu),t("EasingMethod",uu),function(t){t[t.LINEAR=0]="LINEAR",t[t.CONSTANT=1]="CONSTANT",t[t.QUAD_IN=2]="QUAD_IN",t[t.QUAD_OUT=3]="QUAD_OUT",t[t.QUAD_IN_OUT=4]="QUAD_IN_OUT",t[t.QUAD_OUT_IN=5]="QUAD_OUT_IN",t[t.CUBIC_IN=6]="CUBIC_IN",t[t.CUBIC_OUT=7]="CUBIC_OUT",t[t.CUBIC_IN_OUT=8]="CUBIC_IN_OUT",t[t.CUBIC_OUT_IN=9]="CUBIC_OUT_IN",t[t.QUART_IN=10]="QUART_IN",t[t.QUART_OUT=11]="QUART_OUT",t[t.QUART_IN_OUT=12]="QUART_IN_OUT",t[t.QUART_OUT_IN=13]="QUART_OUT_IN",t[t.QUINT_IN=14]="QUINT_IN",t[t.QUINT_OUT=15]="QUINT_OUT",t[t.QUINT_IN_OUT=16]="QUINT_IN_OUT",t[t.QUINT_OUT_IN=17]="QUINT_OUT_IN",t[t.SINE_IN=18]="SINE_IN",t[t.SINE_OUT=19]="SINE_OUT",t[t.SINE_IN_OUT=20]="SINE_IN_OUT",t[t.SINE_OUT_IN=21]="SINE_OUT_IN",t[t.EXPO_IN=22]="EXPO_IN",t[t.EXPO_OUT=23]="EXPO_OUT",t[t.EXPO_IN_OUT=24]="EXPO_IN_OUT",t[t.EXPO_OUT_IN=25]="EXPO_OUT_IN",t[t.CIRC_IN=26]="CIRC_IN",t[t.CIRC_OUT=27]="CIRC_OUT",t[t.CIRC_IN_OUT=28]="CIRC_IN_OUT",t[t.CIRC_OUT_IN=29]="CIRC_OUT_IN",t[t.ELASTIC_IN=30]="ELASTIC_IN",t[t.ELASTIC_OUT=31]="ELASTIC_OUT",t[t.ELASTIC_IN_OUT=32]="ELASTIC_IN_OUT",t[t.ELASTIC_OUT_IN=33]="ELASTIC_OUT_IN",t[t.BACK_IN=34]="BACK_IN",t[t.BACK_OUT=35]="BACK_OUT",t[t.BACK_IN_OUT=36]="BACK_IN_OUT",t[t.BACK_OUT_IN=37]="BACK_OUT_IN",t[t.BOUNCE_IN=38]="BOUNCE_IN",t[t.BOUNCE_OUT=39]="BOUNCE_OUT",t[t.BOUNCE_IN_OUT=40]="BOUNCE_IN_OUT",t[t.BOUNCE_OUT_IN=41]="BOUNCE_OUT_IN",t[t.SMOOTH=42]="SMOOTH",t[t.FADE=43]="FADE"}(uu||t("EasingMethod",uu={}));var lu,_u=((hu={})[uu.CONSTANT]=mh,hu[uu.LINEAR]=vh,hu[uu.QUAD_IN]=yh,hu[uu.QUAD_OUT]=Th,hu[uu.QUAD_IN_OUT]=Eh,hu[uu.QUAD_OUT_IN]=Zh,hu[uu.CUBIC_IN]=Sh,hu[uu.CUBIC_OUT]=Ah,hu[uu.CUBIC_IN_OUT]=bh,hu[uu.CUBIC_OUT_IN]=Jh,hu[uu.QUART_IN]=Ch,hu[uu.QUART_OUT]=Rh,hu[uu.QUART_IN_OUT]=wh,hu[uu.QUART_OUT_IN]=$h,hu[uu.QUINT_IN]=Ih,hu[uu.QUINT_OUT]=xh,hu[uu.QUINT_IN_OUT]=Dh,hu[uu.QUINT_OUT_IN]=tu,hu[uu.SINE_IN]=Oh,hu[uu.SINE_OUT]=Ph,hu[uu.SINE_IN_OUT]=Mh,hu[uu.SINE_OUT_IN]=eu,hu[uu.EXPO_IN]=Nh,hu[uu.EXPO_OUT]=Lh,hu[uu.EXPO_IN_OUT]=Bh,hu[uu.EXPO_OUT_IN]=iu,hu[uu.CIRC_IN]=Fh,hu[uu.CIRC_OUT]=kh,hu[uu.CIRC_IN_OUT]=Uh,hu[uu.CIRC_OUT_IN]=nu,hu[uu.ELASTIC_IN]=Gh,hu[uu.ELASTIC_OUT]=Hh,hu[uu.ELASTIC_IN_OUT]=zh,hu[uu.ELASTIC_OUT_IN]=ru,hu[uu.BACK_IN]=Vh,hu[uu.BACK_OUT]=Wh,hu[uu.BACK_IN_OUT]=Xh,hu[uu.BACK_OUT_IN]=su,hu[uu.BOUNCE_IN]=jh,hu[uu.BOUNCE_OUT]=Yh,hu[uu.BOUNCE_IN_OUT]=Kh,hu[uu.BOUNCE_OUT_IN]=ou,hu[uu.SMOOTH]=qh,hu[uu.FADE]=Qh,hu);function du(t){return _u[t]}S(255),S(65280);var fu,pu,gu,mu=ra.LINEAR<<0|oa.NONE<<8|uu.LINEAR<<16,vu=function(t){function e(){var e;return(e=t.call(this)||this).value=0,e.rightTangent=0,e.rightTangentWeight=0,e.leftTangent=0,e.leftTangentWeight=0,e._flags=mu,e}return s(e,t),n(e,[{key:"interpolationMode",get:function(){return(255&this._flags)>>0},set:function(t){this._flags&=-256,this._flags|=t<<0}},{key:"tangentWeightMode",get:function(){return(65280&this._flags)>>8},set:function(t){this._flags&=-65281,this._flags|=t<<8}},{key:"easingMethod",get:function(){return(16711680&this._flags)>>16},set:function(t){this._flags&=-16711681,this._flags|=t<<16}}]),e}(uh);function yu(t){var e=new vu;if("number"==typeof t)e.value=t;else{var i=t.interpolationMode,n=t.tangentWeightMode,r=t.value,s=t.rightTangent,o=t.rightTangentWeight,a=t.leftTangent,h=t.leftTangentWeight,u=t.easingMethod,c=t[Ys];e.value=null!=r?r:e.value,e.rightTangent=null!=s?s:e.rightTangent,e.rightTangentWeight=null!=o?o:e.rightTangentWeight,e.leftTangent=null!=a?a:e.leftTangent,e.leftTangentWeight=null!=h?h:e.leftTangentWeight,e.interpolationMode=null!=i?i:e.interpolationMode,e.tangentWeightMode=null!=n?n:e.tangentWeightMode,e.easingMethod=null!=u?u:e.easingMethod,c&&(e[Ys]=c)}return e}Ti.fastDefine("cc.RealKeyframeValue",vu,((lu={interpolationMode:ra.LINEAR,tangentWeightMode:oa.NONE,value:0,rightTangent:0,rightTangentWeight:0,leftTangent:0,leftTangentWeight:0,easingMethod:uu.LINEAR})[Ys]=void 0,lu)),Ti.Attr.setClassAttr(vu,Ys,"editorOnly",!0),(fu=vu,null!==(gu=(pu=fu)[Ra])&&void 0!==gu?gu:pu[Ra]={}).uniquelyReferenced=!0;var Tu,Eu=t("RealCurve",function(t){function e(){var e;return(e=t.call(this)||this).preExtrapolation=sa.CLAMP,e.postExtrapolation=sa.CLAMP,e}s(e,t);var i=e.prototype;return i.evaluate=function(t){var e=this._times,i=this._values,n=e.length;if(0===n)return 0;var r=e[0],s=e[n-1];if(ts){var h=this.postExtrapolation,u=i[n-1];if(h===sa.CLAMP||n<2)return u.value;switch(h){case sa.LINEAR:return Fu(s,u.value,e[n-2],i[n-2].value,t);case sa.LOOP:t=Lu(t,r,s);break;case sa.PING_PONG:t=Bu(t,r,s);break;default:return u.value}}var c=na(e,t);if(c>=0)return i[c].value;var l=~c,_=l-1,d=e[_],f=i[_],p=e[l];return function(t,e,i,n,r){var s=i-t;switch(e.interpolationMode){default:case ra.CONSTANT:return e.value;case ra.LINEAR:var o=e.easingMethod===uu.LINEAR?r:du(e.easingMethod)(r);return Ni(e.value,n.value,o);case ra.CUBIC:var a=1/3,h=e.rightTangent,u=e.rightTangentWeight,c=0!=(e.tangentWeightMode&oa.RIGHT),l=n.leftTangent,_=n.leftTangentWeight,d=0!=(n.tangentWeightMode&oa.LEFT);if(c||d){var f=0;if(c)f=u;else{var p=s,g=s*h;f=Math.sqrt(p*p+g*g)*a}var m=Math.atan(h),v=Math.cos(m)*f+t,y=Math.sin(m)*f+e.value,T=0;if(d)T=_;else{var E=s,S=s*l;T=Math.sqrt(E*E+S*S)*a}var A=Math.atan(l),b=(v-t)/s,C=(-Math.cos(A)*T+i-t)/s,R=y,w=-Math.sin(A)*T+n.value,I=[0,0,0],x=function(t,e,i,n,r){var s=i/n,o=e/n,a=s*s,h=1/3*(-1/3*a+o),u=.5*(2/27*s*a-1/3*s*o+t/n),c=h*h*h,l=u*u+c,_=0;if(ha(l)){if(ha(u))return r[0]=0,1;var d=Math.cbrt(-u);return r[0]=2*d,r[1]=-d,2}if(l<0){var f=1/3*Math.acos(-u/Math.sqrt(-c)),p=2*Math.sqrt(-h);r[0]=p*Math.cos(f),r[1]=-p*Math.cos(f+Math.PI/3),r[2]=-p*Math.cos(f-Math.PI/3),_=3}else{var g=Math.sqrt(l),m=Math.cbrt(g-u),v=-Math.cbrt(g+u);r[0]=m+v,_=1}for(var y=1/3*s,T=0;T<_;++T)r[T]-=y;return _}(0-r,3*b,3*C-6*b,3*(b-C)+1,I),D=function(t,e,i){var n=i;if(1===e)n=t[0];else{n=-1/0;for(var r=0;r=0&&s<=1&&s>n&&(n=s)}n===-1/0&&(n=0)}return n}(I,x,r);return ku(e.value,R,w,n.value,D)}var O=e.value+a*h*s,P=n.value-a*l*s;return ku(e.value,O,P,n.value,r)}}(d,f,p,i[l],(t-d)/(p-d))},i.addKeyFrame=function(e,i){return t.prototype.addKeyFrame.call(this,e,yu(i))},i.assignSorted=function(t,e){if(void 0!==e)this.setKeyframes(t.slice(),e.map((function(t){return yu(t)})));else{var i=Array.from(t);this.setKeyframes(i.map((function(t){return t[0]})),i.map((function(t){return yu(t[1])})))}},i.isConstant=function(t){if(this._values.length<=1)return!0;var e=this._values[0].value;return this._values.every((function(i){return Oi(i.value,e,t)}))},i[ph]=function(t,e){if(e.toCCON){var i=this._times,n=this._values,r=i.length,s=new DataView(new ArrayBuffer(0+Su+Su+Au+bu*r+Pu*r)),o=0;s.setUint8(o,this.preExtrapolation),o+=Su,s.setUint8(o,this.postExtrapolation),o+=Su,s.setUint32(o,r,!0),o+=Au,i.forEach((function(t,e){return s.setFloat32(o+bu*e,t,!0)})),o+=bu*r;for(var a,h=d(n);!(a=h()).done;){var u=a.value;o=Mu(s,u,o)}var c=new Uint8Array(s.buffer,0,o);t.writeProperty("bytes",c);var l=n.map((function(t){return t[Ys]}));l.some((function(t){return void 0!==t}))&&t.writeProperty("keyframeValueEditorExtras",l)}else t.writeThis()},i[gh]=function(t,e){if(e.fromCCON){var i=t.readProperty("bytes"),n=new DataView(i.buffer,i.byteOffset,i.byteLength),r=0;this.preExtrapolation=n.getUint8(r),r+=Su,this.postExtrapolation=n.getUint8(r),r+=Su;var s=n.getUint32(r,!0);r+=Au;var o=Array.from({length:s},(function(t,e){return n.getFloat32(r+bu*e,!0)}));r+=bu*s;for(var a=new Array(s),h=0;h>8;return e.easingMethod=s,n}function Lu(t,e,i){return e+Xi(t-e,i-e)}function Bu(t,e,i){return e+ji(t-e,i-e)}function Fu(t,e,i,n,r){return e+(n-e)/(i-t)*(r-t)}function ku(t,e,i,n,r){var s=1-r;return s*s*s*t+3*s*s*r*e+3*s*r*r*i+r*r*r*n}function Uu(t,e,i,n,r){var s=1-r;return s*(s*(t+(3*e-t)*r)+3*i*r*r)+n*r*r*r}m.bezier=Uu;var Gu,Hu,zu,Vu,Wu,Xu,ju,Yu,Ku,qu,Qu=Math.cos,Zu=Math.acos,Ju=Math.max,$u=2*Math.PI,tc=Math.sqrt;function ec(t){return t<0?-Math.pow(-t,1/3):Math.pow(t,1/3)}function ic(t,e){var i=function(t,e){var i,n,r,s,o=e-0,a=e-t[0],h=3*o,u=3*a,c=3*(e-t[2]),l=1/(-o+u-c+(e-1)),_=1/3,d=(h-6*a+c)*l,f=d*_,p=(-h+u)*l,g=(3*p-d*d)*_,m=g*_,v=(2*d*d*d-9*d*p+o*l*27)/27,y=v/2,T=y*y+m*m*m;if(T<0){var E=-g*_,S=tc(E*E*E),A=-v/(2*S),b=Zu(A<-1?-1:A>1?1:A),C=2*ec(S);return n=C*Qu(b*_)-f,r=C*Qu((b+$u)*_)-f,s=C*Qu((b+2*$u)*_)-f,n>=0&&n<=1?r>=0&&r<=1?s>=0&&s<=1?Ju(n,r,s):Ju(n,r):s>=0&&s<=1?Ju(n,s):n:r>=0&&r<=1?s>=0&&s<=1?Ju(r,s):r:s}if(0===T)return r=-(i=y<0?ec(-y):-ec(y))-f,(n=2*i-f)>=0&&n<=1?r>=0&&r<=1?Ju(n,r):n:r;var R=tc(T);return(i=ec(-y+R))-ec(y+R)-f}(t,e),n=t[1];return((1-i)*(n+(t[3]-n)*i)*3+i*i)*i}m.bezierByTime=ic,t("QuatInterpolationMode",qu),function(t){t[t.SLERP=0]="SLERP",t[t.CONSTANT=1]="CONSTANT"}(qu||t("QuatInterpolationMode",qu={}));var nc=va("cc.QuatKeyframeValue")(Gu=Oa((Hu=function(t){var e=void 0===t?{}:t,i=e.value,n=e.interpolationMode,r=e.easingMethod;this.interpolationMode=zu&&zu(),this.value=Vu&&Vu(),this.easingMethod=Wu&&Wu(),this.value=i?Rn.clone(i):this.value,this.interpolationMode=null!=n?n:this.interpolationMode,this.easingMethod=null!=r?r:this.easingMethod},zu=ua(Hu.prototype,"interpolationMode",[wa],(function(){return qu.SLERP})),Vu=ua(Hu.prototype,"value",[wa],(function(){return Rn.clone(Rn.IDENTITY)})),Wu=ua(Hu.prototype,"easingMethod",[wa],(function(){return uu.LINEAR})),Gu=Hu))||Gu)||Gu;function rc(t){return new nc(t)}var sc,oc=t("QuatCurve",va("cc.QuatCurve")((ju=function(t){function e(){var e;return(e=t.call(this)||this).preExtrapolation=Yu&&Yu(),e.postExtrapolation=Ku&&Ku(),e}s(e,t);var i=e.prototype;return i.evaluate=function(t,e){var i;null!==(i=e)&&void 0!==i||(e=new Rn);var n=this._times,r=this._values,s=this.postExtrapolation,o=this.preExtrapolation,a=n.length;if(0===a)return e;var h=n[0],u=n[a-1];if(tu){var l=r[a-1];switch(s){case sa.LOOP:t=h+Xi(t-h,u-h);break;case sa.PING_PONG:t=h+ji(t-h,u-h);break;case sa.CLAMP:default:return Rn.copy(e,l.value)}}var _=na(n,t);if(_>=0)return Rn.copy(e,r[_].value);var d=~_,f=d-1,p=n[f],g=r[f],m=n[d],v=r[d],y=(t-p)/(m-p);switch(g.interpolationMode){default:case qu.CONSTANT:return Rn.copy(e,g.value);case qu.SLERP:var T=g.easingMethod,E=T===uu.LINEAR?y:Array.isArray(T)?ic(T,y):du(T)(y);return Rn.slerp(e,g.value,v.value,E)}},i.addKeyFrame=function(e,i){var n=new nc(i);return t.prototype.addKeyFrame.call(this,e,n)},i.assignSorted=function(t,e){if(void 0!==e)this.setKeyframes(t.slice(),e.map((function(t){return rc(t)})));else{var i=Array.from(t);this.setKeyframes(i.map((function(t){return t[0]})),i.map((function(t){return rc(t[1])})))}},i[ph]=function(t,e){if(e.toCCON){var i=this._times,n=this._values,r=!0;n.forEach((function(t,e,i){var n=i[0];r&&t.interpolationMode!==n.interpolationMode&&(r=!1)}));var s=i.length,o=_c*(r?1:s),a=n.reduce((function(t,e){var i=e.easingMethod;return t+(Array.isArray(i)?dc+4*pc:dc)}),0),h=0,u=new DataView(new ArrayBuffer(h+=hc+uc+cc*s+4*lc*s+a+o+0)),c=0,l=0;r&&(l|=sc.INTERPOLATION_MODE),u.setUint32(c,l,!0),c+=hc,u.setUint32(c,s,!0),c+=uc,i.forEach((function(t,e){return u.setFloat32(c+cc*e,t,!0)})),c+=cc*s,n.forEach((function(t,e){var i=t.value,n=i.x,r=i.y,s=i.z,o=i.w,a=c+4*lc*e;u.setFloat32(a+0*lc,n,!0),u.setFloat32(a+1*lc,r,!0),u.setFloat32(a+2*lc,s,!0),u.setFloat32(a+3*lc,o,!0)})),c+=4*lc*s,n.forEach((function(t){var e=t.easingMethod;Array.isArray(e)?(u.setUint8(c,fc),++c,u.setFloat32(c+0*pc,e[0],!0),u.setFloat32(c+1*pc,e[1],!0),u.setFloat32(c+2*pc,e[2],!0),u.setFloat32(c+3*pc,e[3],!0),c+=4*pc):(u.setUint8(c,e),++c)}));var _=c;c+=o;var d=_;n.forEach((function(t){var e=t.interpolationMode;u.setUint8(d,e),r||(d+=_c)}));var f=new Uint8Array(u.buffer);t.writeProperty("bytes",f)}else t.writeThis()},i[gh]=function(t,e){if(e.fromCCON){var i=t.readProperty("bytes"),n=new DataView(i.buffer,i.byteOffset,i.byteLength),r=0,s=n.getUint32(r,!0);r+=hc;var o=s&sc.INTERPOLATION_MODE,a=n.getUint32(r,!0);r+=uc;var h=Array.from({length:a},(function(t,e){return n.getFloat32(r+cc*e,!0)})),u=r+=cc*a;r+=4*lc*a;var c=Array.from({length:a},(function(t,e){var i=u+4*lc*e,s=n.getFloat32(i+0*lc,!0),o=n.getFloat32(i+1*lc,!0),a=n.getFloat32(i+2*lc,!0),h=n.getFloat32(i+3*lc,!0),c=n.getUint8(r);++r;var l=rc({value:{x:s,y:o,z:a,w:h}});return c!==fc?l.easingMethod=c:(l.easingMethod=[n.getFloat32(r+0*pc,!0),n.getFloat32(r+1*pc,!0),n.getFloat32(r+2*pc,!0),n.getFloat32(r+3*pc,!0)],r+=4*pc),l}));if(o){var l=n.getUint8(r);++r;for(var _=0;_=0)return this._values[e];var i=Pi(~e-1,0,this._values.length-1);return this._values[i]},e}(aa))||ac),mc=ye({Blend:0,Fixed:1}),vc=t("ColorKey",(function(){this.color=yn.WHITE.clone(),this.time=0}));Ti.fastDefine("cc.ColorKey",vc,{color:yn.WHITE.clone(),time:0}),Ti.Attr.setClassAttr(vc,"color","visible",!0),Ti.Attr.setClassAttr(vc,"time","visible",!0);var yc=t("AlphaKey",(function(){this.alpha=1,this.time=0}));Ti.fastDefine("cc.AlphaKey",yc,{alpha:1,time:0}),Ti.Attr.setClassAttr(yc,"alpha","visible",!0),Ti.Attr.setClassAttr(yc,"time","visible",!0);var Tc=t("Gradient",function(){function t(){this.colorKeys=[],this.alphaKeys=[],this.mode=mc.Blend}var e=t.prototype;return e.setKeys=function(t,e){this.colorKeys=t,this.alphaKeys=e},e.sortKeys=function(){this.colorKeys.length>1&&this.colorKeys.sort((function(t,e){return t.time-e.time})),this.alphaKeys.length>1&&this.alphaKeys.sort((function(t,e){return t.time-e.time}))},e.evaluate=function(t){return this.evaluateFast(new yn,t)},e.evaluateFast=function(t,e){return this.getRGB(t,e),t.a=this.getAlpha(e),t},e.randomColor=function(){return this.getRandomColor(new yn)},e.getRandomColor=function(t){var e=this.colorKeys[Math.trunc(Fi()*this.colorKeys.length)],i=this.alphaKeys[Math.trunc(Fi()*this.alphaKeys.length)];return t.set(e.color),t.a=i.alpha,t},e.getRGB=function(t,e){var i=this.colorKeys,n=i.length;if(n>1){e=Xi(e,1+xi);for(var r=1;r=s&&ei[h].time&&yn.lerp(t,i[h].color,yn.BLACK,(e-i[h].time)/(1-i[h].time))}else 1===n?yn.copy(t,i[0].color):yn.copy(t,yn.WHITE);return t},e.getAlpha=function(t){var e=this.alphaKeys,i=e.length;if(i>1){t=Xi(t,1+xi);for(var n=1;n=r&&te[a].time?Ni(e[a].alpha,0,(t-e[a].time)/(1-e[a].time)):255}return 1===i?e[0].alpha:255},t}());Tc.Mode=mc,Ti.fastDefine("cc.Gradient",Tc,{colorKeys:[],alphaKeys:[],mode:mc.Blend}),Ti.Attr.setClassAttr(Tc,"colorKeys","visible",!0),Ti.Attr.setClassAttr(Tc,"alphaKeys","visible",!0),Ti.Attr.setClassAttr(Tc,"mode","visible",!0);var Ec=function(){this.time=0,this.value=0,this.inTangent=0,this.outTangent=0};Ti.fastDefine("cc.Keyframe",Ec,{time:0,value:0,inTangent:0,outTangent:0});var Sc=function(){function t(){this.index=void 0,this.time=void 0,this.endTime=void 0,this.coefficient=void 0,this.index=-1,this.time=0,this.endTime=0,this.coefficient=new Float32Array(4)}return t.prototype.evaluate=function(t){return Ac(t-this.time,this.coefficient)},t}();function Ac(t,e){return t*(t*(t*e[0]+e[1])+e[2])+e[3]}var bc,Cc,Rc=function(){function t(t){if(void 0===t&&(t=null),this._curve=void 0,this.cachedKey=void 0,t instanceof Eu)this._curve=t;else{var e=new Eu;this._curve=e,e.preExtrapolation=sa.LOOP,e.postExtrapolation=sa.CLAMP,t?e.assignSorted(t.map((function(t){return[t.time,{interpolationMode:ra.CUBIC,value:t.value,leftTangent:t.inTangent,rightTangent:t.outTangent}]}))):e.assignSorted([[0,{interpolationMode:ra.CUBIC,value:1}],[1,{interpolationMode:ra.CUBIC,value:1}]])}this.cachedKey=new Sc}var e=t.prototype;return e.addKey=function(t){t?this._curve.addKeyFrame(t.time,{interpolationMode:ra.CUBIC,value:t.value,leftTangent:t.inTangent,rightTangent:t.outTangent}):this._curve.clear()},e.evaluate_slow=function(t){return this._curve.evaluate(t)},e.evaluate=function(t){var e=this.cachedKey,i=this._curve,n=i.keyFramesCount-1,r=t,s=t<0?i.preExtrapolation:i.postExtrapolation,o=i.getKeyframeTime(0),a=i.getKeyframeTime(n);switch(s){case sa.LOOP:r=Xi(t-o,a-o)+o;break;case sa.PING_PONG:r=ji(t-o,a-o)+o;break;case sa.CLAMP:default:r=Pi(t,o,a)}if(r>=e.time&&ri.getKeyframeTime(r))for(var s=0;s<3;s++){var o=r+s;if(o+1e)return o}else for(var a=0;a<3;a++){var h=r-a;if(h>=0&&i.getKeyframeTime(h-1)<=e)return h-1}for(var u,c=0,l=n;l-c>1;)u=Math.floor((c+l)/2),i.getKeyframeTime(u)>=e?l=u:c=u;return c},n(t,[{key:"_internalCurve",get:function(){return this._curve}},{key:"keyFrames",get:function(){return Array.from(this._curve.keyframes()).map((function(t){var e=t[0],i=t[1],n=new Ec;return n.time=e,n.value=i.value,n.inTangent=i.leftTangent,n.outTangent=i.rightTangent,n}))},set:function(t){this._curve.assignSorted(t.map((function(t){return[t.time,{interpolationMode:ra.CUBIC,value:t.value,leftTangent:t.inTangent,rightTangent:t.outTangent}]})))}},{key:"preWrapMode",get:function(){return Ic(this._curve.preExtrapolation)},set:function(t){this._curve.preExtrapolation=wc(t)}},{key:"postWrapMode",get:function(){return Ic(this._curve.postExtrapolation)},set:function(t){this._curve.postExtrapolation=wc(t)}}]),t}();function wc(t){switch(t){default:case bc.Default:case bc.Normal:case bc.Clamp:return sa.CLAMP;case bc.PingPong:return sa.PING_PONG;case bc.Loop:return sa.LOOP}}function Ic(t){switch(t){default:case sa.LINEAR:case sa.CLAMP:return bc.Clamp;case sa.PING_PONG:return bc.PingPong;case sa.LOOP:return bc.Loop}}Rc.defaultKF=[{time:0,value:1,inTangent:0,outTangent:0},{time:1,value:1,inTangent:0,outTangent:0}],Ti.fastDefine("cc.AnimationCurve",Rc,{_curve:null}),function(t){t[t.Default=0]="Default",t[t.Normal=1]="Normal",t[t.Loop=2]="Loop",t[t.ShouldWrap=4]="ShouldWrap",t[t.Clamp=8]="Clamp",t[t.PingPong=22]="PingPong",t[t.Reverse=36]="Reverse"}(bc||(bc={})),function(t){t[t.LINEAR=0]="LINEAR",t[t.BEZIER=1]="BEZIER",t[t.CATMULL_ROM=2]="CATMULL_ROM"}(Cc||(Cc={}));var xc,Dc=4294967295,Oc=new _n,Pc=new _n,Mc=new _n,Nc=new _n,Lc=function(){function t(t,e){void 0===t&&(t=Cc.CATMULL_ROM),void 0===e&&(e=[]),this._type=void 0,this._mode=Cc.CATMULL_ROM,this._knots=[],this._type=cr.SHAPE_SPLINE,this._mode=t;for(var i=0;i=this._knots.length?this._knots.push(i):this._knots.splice(t,0,i)},e.removeKnot=function(t){t>=0&&this._knots.length,this._knots.splice(t,1)},e.setKnot=function(t,e){t>=0&&this._knots.length,this._knots[t].set(e)},e.getKnot=function(t){return t>=0&&this._knots.length,this._knots[t]},e.getPoint=function(e,i){void 0===i&&(i=Dc),e=Pi(e,0,1);var n=this.getSegments();if(0===n)return new _n(0,0,0);if(i===Dc){var r=1/n;i=Math.floor(e/r),e=e%r/r}if(i>=n)return new _n(this._knots[this._knots.length-1]);switch(this._mode){case Cc.LINEAR:return t.calcLinear(this._knots[i],this._knots[i+1],e);case Cc.BEZIER:return t.calcBezier(this._knots[4*i],this._knots[4*i+1],this._knots[4*i+2],this._knots[4*i+3],e);case Cc.CATMULL_ROM:var s=i>0?this._knots[i-1]:this._knots[i],o=i+2e.priority?-1:0};var e=t.prototype;return e.init=function(){},e.update=function(){},e.postUpdate=function(){},e.destroy=function(){},n(t,[{key:"priority",get:function(){return this._priority},set:function(t){this._priority=t}},{key:"id",get:function(){return this._id},set:function(t){this._id=t}}]),t}());Yc.Priority=ye({LOW:0,MEDIUM:100,HIGH:200,SCHEDULER:1<<31>>>0});var Kc=new vt("Scheduler"),qc=function(){function t(t,e,i,n){this.target=void 0,this.priority=void 0,this.paused=void 0,this.markedForDeletion=void 0,this.target=t,this.priority=e,this.paused=i,this.markedForDeletion=n}return t.get=function(e,i,n,r){var s=t._listEntries.pop();return s?(s.target=e,s.priority=i,s.paused=n,s.markedForDeletion=r):s=new t(e,i,n,r),s},t.put=function(e){t._listEntries.length<20&&(e.target=null,t._listEntries.push(e))},t}();qc._listEntries=[];var Qc=function(){function t(t,e,i,n){this.list=void 0,this.entry=void 0,this.target=void 0,this.callback=void 0,this.list=t,this.entry=e,this.target=i,this.callback=n}return t.get=function(e,i,n,r){var s=t._hashUpdateEntries.pop();return s?(s.list=e,s.entry=i,s.target=n,s.callback=r):s=new t(e,i,n,r),s},t.put=function(e){t._hashUpdateEntries.length<20&&(e.list=e.entry=e.target=e.callback=null,t._hashUpdateEntries.push(e))},t}();Qc._hashUpdateEntries=[];var Zc=function(){function t(t,e,i,n,r,s){this.timers=void 0,this.target=void 0,this.timerIndex=void 0,this.currentTimer=void 0,this.currentTimerSalvaged=void 0,this.paused=void 0,this.timers=t,this.target=e,this.timerIndex=i,this.currentTimer=n,this.currentTimerSalvaged=r,this.paused=s}return t.get=function(e,i,n,r,s,o){var a=t._hashTimerEntries.pop();return a?(a.timers=e,a.target=i,a.timerIndex=n,a.currentTimer=r,a.currentTimerSalvaged=s,a.paused=o):a=new t(e,i,n,r,s,o),a},t.put=function(e){t._hashTimerEntries.length<20&&(e.timers=e.target=e.currentTimer=null,t._hashTimerEntries.push(e))},t}();Zc._hashTimerEntries=[];var Jc=function(){function t(){this._lock=void 0,this._scheduler=void 0,this._elapsed=void 0,this._runForever=void 0,this._useDelay=void 0,this._timesExecuted=void 0,this._repeat=void 0,this._delay=void 0,this._interval=void 0,this._target=void 0,this._callback=void 0,this._lock=!1,this._scheduler=null,this._elapsed=-1,this._runForever=!1,this._useDelay=!1,this._timesExecuted=0,this._repeat=0,this._delay=0,this._interval=0,this._target=null}t.get=function(){return t._timers.pop()||new t},t.put=function(e){t._timers.length<20&&!e._lock&&(e._scheduler=e._target=e._callback=null,t._timers.push(e))};var e=t.prototype;return e.initWithCallback=function(t,e,i,n,r,s){return this._lock=!1,this._scheduler=t,this._target=i,this._callback=e,this._timesExecuted=0,this._elapsed=-1,this._interval=n,this._delay=s,this._useDelay=this._delay>0,this._repeat=r,this._runForever=this._repeat===m.macro.REPEAT_FOREVER,!0},e.getInterval=function(){return this._interval},e.setInterval=function(t){this._interval=t},e.update=function(t){-1===this._elapsed?(this._elapsed=0,this._timesExecuted=0):(this._elapsed+=t,this._runForever&&!this._useDelay?this._elapsed>=this._interval&&(this.trigger(),this._elapsed=0):(this._useDelay?this._elapsed>=this._delay&&(this.trigger(),this._elapsed-=this._delay,this._timesExecuted+=1,this._useDelay=!1):this._elapsed>=this._interval&&(this.trigger(),this._elapsed=0,this._timesExecuted+=1),this._callback&&!this._runForever&&this._timesExecuted>this._repeat&&this.cancel()))},e.getCallback=function(){return this._callback},e.trigger=function(){this._target&&this._callback&&(this._lock=!0,this._callback.call(this._target,this._elapsed),this._lock=!1)},e.cancel=function(){this._scheduler&&this._callback&&this._target&&this._scheduler.unscheduleForTimer(this,this._target)},t}();Jc._timers=[];var $c=t("Scheduler",function(t){function e(){var e;return(e=t.call(this)||this)._timeScale=void 0,e._updatesNegList=void 0,e._updates0List=void 0,e._updatesPosList=void 0,e._hashForUpdates=void 0,e._hashForTimers=void 0,e._currentTarget=void 0,e._currentTargetSalvaged=void 0,e._updateHashLocked=void 0,e._arrayForTimers=void 0,e._timeScale=1,e._updatesNegList=[],e._updates0List=[],e._updatesPosList=[],e._hashForUpdates=Dt(!0),e._hashForTimers=Dt(!0),e._currentTarget=null,e._currentTargetSalvaged=!1,e._updateHashLocked=!1,e._arrayForTimers=[],e}s(e,t),e.enableForTarget=function(t){var e=!1;(t.uuid||t.id)&&(e=!0),e||(t.id=Kc.getNewId())};var i=e.prototype;return i.setTimeScale=function(t){this._timeScale=t},i.getTimeScale=function(){return this._timeScale},i.update=function(t){var e,i,n,r,s;for(this._updateHashLocked=!0,1!==this._timeScale&&(t*=this._timeScale),e=0,n=(i=this._updatesNegList).length;e=s&&n.timerIndex--,void(0===r.length&&(this._currentTarget===n?this._currentTargetSalvaged=!0:this._removeHashElement(n)))}}}else Z(1510)}},i.unscheduleForTimer=function(t,e){var i=e.uuid||e.id,n=this._hashForTimers[i],r=n.timers;if(r&&0!==r.length)for(var s=r.length-1;s>=0;s--){var o=r[s];if(o===t)return r.splice(s,1),Jc.put(o),n.timerIndex>=s&&n.timerIndex--,void(0===r.length&&(this._currentTargetSalvaged=!0))}},i.unscheduleUpdate=function(t){if(t){var e=t.uuid||t.id;if(e){var i=this._hashForUpdates[e];null!=i&&i.entry&&(this._updateHashLocked?i.entry.markedForDeletion=!0:this._removeUpdateFromHash(i.entry))}else Z(1510)}},i.unscheduleAllForTarget=function(t){if(t){var e=t.uuid||t.id;if(e){var i=this._hashForTimers[e];if(null!=i&&i.timers){var n=i.timers;i.currentTimer&&n.indexOf(i.currentTimer)>-1&&!i.currentTimerSalvaged&&(i.currentTimerSalvaged=!0);for(var r=0,s=n.length;r=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=4;){var o=255&s.call(t,r)|(255&s.call(t,++r))<<8|(255&s.call(t,++r))<<16|(255&s.call(t,++r))<<24;o=1540483477*(65535&o)+((1540483477*(o>>>16)&65535)<<16),n=1540483477*(65535&n)+((1540483477*(n>>>16)&65535)<<16)^(o=1540483477*(65535&(o^=o>>>24))+((1540483477*(o>>>16)&65535)<<16)),i-=4,++r}switch(i){case 3:n^=(255&s.call(t,r+2))<<16;case 2:n^=(255&s.call(t,r+1))<<8;case 1:n=1540483477*(65535&(n^=255&s.call(t,r)))+((1540483477*(n>>>16)&65535)<<16)}return n=1540483477*(65535&(n^=n>>>13))+((1540483477*(n>>>16)&65535)<<16),(n^=n>>>15)>>>0}function rl(){}m.easing=cu,rl.prototype.once=function(t,e,i){return this.on(t,e,i,!0)},rl.prototype.targetOff=function(t){this.removeAll(t)},t("jsbUtils",Object.freeze({__proto__:null,syncNodeValues:function(t){var e=t._lpos;t.setPositionForJS(e.x,e.y,e.z);var i=t._lscale;t.setScaleForJS(i.x,i.y,i.z);var n=t._lrot;t.setRotationForJS(n.x,n.y,n.z,n.w);var r=t._euler;t.setRotationFromEulerForJS(r.x,r.y,r.z)},updateChildrenForDeserialize:function t(e){if(e){var i=e.children;if(i){var n=i.length;if(n){e._setChildren(i);for(var r=0;r0&&0==(t&t-1)}function ld(t,e,i,n){if(!od[t].isCompressed)return e*i*n*od[t].size;switch(t){case pl.BC1:case pl.BC1_ALPHA:case pl.BC1_SRGB:case pl.BC1_SRGB_ALPHA:return Math.ceil(e/4)*Math.ceil(i/4)*8*n;case pl.BC2:case pl.BC2_SRGB:case pl.BC3:case pl.BC3_SRGB:case pl.BC4:case pl.BC4_SNORM:case pl.BC6H_SF16:case pl.BC6H_UF16:case pl.BC7:case pl.BC7_SRGB:return Math.ceil(e/4)*Math.ceil(i/4)*16*n;case pl.BC5:case pl.BC5_SNORM:return Math.ceil(e/4)*Math.ceil(i/4)*32*n;case pl.ETC_RGB8:case pl.ETC2_RGB8:case pl.ETC2_SRGB8:case pl.ETC2_RGB8_A1:case pl.EAC_R11:case pl.EAC_R11SN:return Math.ceil(e/4)*Math.ceil(i/4)*8*n;case pl.ETC2_RGBA8:case pl.ETC2_SRGB8_A1:case pl.EAC_RG11:case pl.EAC_RG11SN:return Math.ceil(e/4)*Math.ceil(i/4)*16*n;case pl.PVRTC_RGB2:case pl.PVRTC_RGBA2:case pl.PVRTC2_2BPP:return Math.ceil(e/8)*Math.ceil(i/4)*8*n;case pl.PVRTC_RGB4:case pl.PVRTC_RGBA4:case pl.PVRTC2_4BPP:return Math.ceil(e/4)*Math.ceil(i/4)*8*n;case pl.ASTC_RGBA_4X4:case pl.ASTC_SRGBA_4X4:return Math.ceil(e/4)*Math.ceil(i/4)*16*n;case pl.ASTC_RGBA_5X4:case pl.ASTC_SRGBA_5X4:return Math.ceil(e/5)*Math.ceil(i/4)*16*n;case pl.ASTC_RGBA_5X5:case pl.ASTC_SRGBA_5X5:return Math.ceil(e/5)*Math.ceil(i/5)*16*n;case pl.ASTC_RGBA_6X5:case pl.ASTC_SRGBA_6X5:return Math.ceil(e/6)*Math.ceil(i/5)*16*n;case pl.ASTC_RGBA_6X6:case pl.ASTC_SRGBA_6X6:return Math.ceil(e/6)*Math.ceil(i/6)*16*n;case pl.ASTC_RGBA_8X5:case pl.ASTC_SRGBA_8X5:return Math.ceil(e/8)*Math.ceil(i/5)*16*n;case pl.ASTC_RGBA_8X6:case pl.ASTC_SRGBA_8X6:return Math.ceil(e/8)*Math.ceil(i/6)*16*n;case pl.ASTC_RGBA_8X8:case pl.ASTC_SRGBA_8X8:return Math.ceil(e/8)*Math.ceil(i/8)*16*n;case pl.ASTC_RGBA_10X5:case pl.ASTC_SRGBA_10X5:return Math.ceil(e/10)*Math.ceil(i/5)*16*n;case pl.ASTC_RGBA_10X6:case pl.ASTC_SRGBA_10X6:return Math.ceil(e/10)*Math.ceil(i/6)*16*n;case pl.ASTC_RGBA_10X8:case pl.ASTC_SRGBA_10X8:return Math.ceil(e/10)*Math.ceil(i/8)*16*n;case pl.ASTC_RGBA_10X10:case pl.ASTC_SRGBA_10X10:return Math.ceil(e/10)*Math.ceil(i/10)*16*n;case pl.ASTC_RGBA_12X10:case pl.ASTC_SRGBA_12X10:return Math.ceil(e/12)*Math.ceil(i/10)*16*n;case pl.ASTC_RGBA_12X12:case pl.ASTC_SRGBA_12X12:return Math.ceil(e/12)*Math.ceil(i/12)*16*n;default:return 0}}function _d(t,e,i,n,r){for(var s=0,o=0;o>1,1),i=Math.max(i>>1,1);return s}var dd=[0,4,8,12,16,4,8,12,16,4,8,12,16,4,8,12,16,16,24,32,24,36,48,32,48,64,4,4,4,4,4,4];function fd(t){return dd[t]||0}function pd(t){if(t.isCompressed)return Uint8Array;var e=t.size/t.count;switch(t.type){case gl.UNORM:case gl.UINT:switch(e){case 1:return Uint8Array;case 2:return Uint16Array;case 4:return Uint32Array;default:return Uint8Array}case gl.SNORM:case gl.INT:switch(e){case 1:return Int8Array;case 2:return Int16Array;case 4:return Int32Array;default:return Int8Array}case gl.FLOAT:switch(e){case 2:return Uint16Array;case 4:default:return Float32Array}}return Float32Array}function gd(t){switch(t){case pl.BC1:case pl.BC1_ALPHA:case pl.BC1_SRGB:case pl.BC1_SRGB_ALPHA:case pl.BC2:case pl.BC2_SRGB:case pl.BC3:case pl.BC3_SRGB:case pl.BC4:case pl.BC4_SNORM:case pl.BC6H_SF16:case pl.BC6H_UF16:case pl.BC7:case pl.BC7_SRGB:case pl.BC5:case pl.BC5_SNORM:case pl.ETC_RGB8:case pl.ETC2_RGB8:case pl.ETC2_SRGB8:case pl.ETC2_RGB8_A1:case pl.EAC_R11:case pl.EAC_R11SN:case pl.ETC2_RGBA8:case pl.ETC2_SRGB8_A1:case pl.EAC_RG11:case pl.EAC_RG11SN:return{width:4,height:4};case pl.PVRTC_RGB2:case pl.PVRTC_RGBA2:case pl.PVRTC2_2BPP:return{width:8,height:4};case pl.PVRTC_RGB4:case pl.PVRTC_RGBA4:case pl.PVRTC2_4BPP:return{width:4,height:4};case pl.ASTC_RGBA_4X4:case pl.ASTC_SRGBA_4X4:return{width:4,height:4};case pl.ASTC_RGBA_5X4:case pl.ASTC_SRGBA_5X4:return{width:5,height:4};case pl.ASTC_RGBA_5X5:case pl.ASTC_SRGBA_5X5:return{width:5,height:5};case pl.ASTC_RGBA_6X5:case pl.ASTC_SRGBA_6X5:return{width:6,height:5};case pl.ASTC_RGBA_6X6:case pl.ASTC_SRGBA_6X6:return{width:6,height:6};case pl.ASTC_RGBA_8X5:case pl.ASTC_SRGBA_8X5:return{width:8,height:5};case pl.ASTC_RGBA_8X6:case pl.ASTC_SRGBA_8X6:return{width:8,height:6};case pl.ASTC_RGBA_8X8:case pl.ASTC_SRGBA_8X8:return{width:8,height:8};case pl.ASTC_RGBA_10X5:case pl.ASTC_SRGBA_10X5:return{width:10,height:5};case pl.ASTC_RGBA_10X6:case pl.ASTC_SRGBA_10X6:return{width:10,height:6};case pl.ASTC_RGBA_10X8:case pl.ASTC_SRGBA_10X8:return{width:10,height:8};case pl.ASTC_RGBA_10X10:case pl.ASTC_SRGBA_10X10:return{width:10,height:10};case pl.ASTC_RGBA_12X10:case pl.ASTC_SRGBA_12X10:return{width:12,height:10};case pl.ASTC_RGBA_12X12:case pl.ASTC_SRGBA_12X12:return{width:12,height:12};default:return{width:1,height:1}}}function md(t,e){return Math.ceil(t/e)*e}var vd=Object.freeze({__proto__:null,get ObjectType(){return cl},get Status(){return ll},get API(){return _l},get SurfaceTransform(){return dl},get Feature(){return fl},get Format(){return pl},get FormatType(){return gl},get Type(){return ml},get BufferUsageBit(){return vl},get BufferFlagBit(){return yl},get MemoryAccessBit(){return Tl},get MemoryUsageBit(){return El},get TextureType(){return Sl},get TextureUsageBit(){return Al},get TextureFlagBit(){return bl},get FormatFeatureBit(){return Cl},get SampleCount(){return Rl},get VsyncMode(){return wl},get Filter(){return Il},get Address(){return xl},get ComparisonFunc(){return Dl},get StencilOp(){return Ol},get BlendFactor(){return Pl},get BlendOp(){return Ml},get ColorMask(){return Nl},get ShaderStageFlagBit(){return Ll},get LoadOp(){return Bl},get StoreOp(){return Fl},get AccessFlagBit(){return kl},get ResolveMode(){return Ul},get PipelineBindPoint(){return Gl},get PrimitiveMode(){return Hl},get PolygonMode(){return zl},get ShadeModel(){return Vl},get CullMode(){return Wl},get DynamicStateFlagBit(){return Xl},get StencilFace(){return jl},get DescriptorType(){return Yl},get QueueType(){return Kl},get QueryType(){return ql},get CommandBufferType(){return Ql},get ClearFlagBit(){return Zl},get BarrierType(){return Jl},get PassType(){return $l},Size:i_,DeviceCaps:n_,DeviceOptions:r_,Offset:s_,Rect:o_,Extent:a_,TextureSubresLayers:h_,TextureSubresRange:u_,TextureCopy:c_,TextureBlit:l_,BufferTextureCopy:__,Viewport:d_,Color:f_,BindingMappingInfo:p_,SwapchainInfo:g_,DeviceInfo:m_,BufferInfo:v_,BufferViewInfo:y_,DrawInfo:T_,DispatchInfo:E_,IndirectBuffer:S_,TextureInfo:A_,TextureViewInfo:b_,SamplerInfo:C_,Uniform:R_,UniformBlock:w_,UniformSamplerTexture:I_,UniformSampler:x_,UniformTexture:D_,UniformStorageImage:O_,UniformStorageBuffer:P_,UniformInputAttachment:M_,ShaderStage:N_,Attribute:L_,ShaderInfo:B_,InputAssemblerInfo:F_,ColorAttachment:k_,DepthStencilAttachment:U_,SubpassInfo:G_,SubpassDependency:H_,RenderPassInfo:z_,GeneralBarrierInfo:V_,TextureBarrierInfo:W_,BufferBarrierInfo:X_,FramebufferInfo:j_,DescriptorSetLayoutBinding:Y_,DescriptorSetLayoutInfo:K_,DescriptorSetInfo:q_,PipelineLayoutInfo:Q_,InputState:Z_,CommandBufferInfo:J_,QueueInfo:$_,QueryPoolInfo:td,FormatInfo:ed,MemoryStatus:id,DynamicStencilStates:nd,DynamicStates:rd,GFXObject:sd,get AttributeName(){return e_},FormatInfos:od,DESCRIPTOR_BUFFER_TYPE:ad,DESCRIPTOR_SAMPLER_TYPE:hd,DESCRIPTOR_DYNAMIC_TYPE:ud,DRAW_INFO_SIZE:28,IsPowerOf2:cd,FormatSize:ld,FormatSurfaceSize:_d,GetTypeSize:fd,getTypedArrayConstructor:pd,formatAlignment:gd,alignTo:md}),yd=function(t){function e(){var e;return(e=t.call(this,cl.BUFFER)||this)._usage=vl.NONE,e._memUsage=El.NONE,e._size=0,e._stride=1,e._count=0,e._flags=yl.NONE,e._isBufferView=!1,e}return s(e,t),n(e,[{key:"usage",get:function(){return this._usage}},{key:"memUsage",get:function(){return this._memUsage}},{key:"size",get:function(){return this._size}},{key:"stride",get:function(){return this._stride}},{key:"count",get:function(){return this._count}},{key:"flags",get:function(){return this._flags}}]),e}(sd),Td=function(t){function e(){var e;return(e=t.call(this,cl.COMMAND_BUFFER)||this)._queue=null,e._type=Ql.PRIMARY,e._numDrawCalls=0,e._numInstances=0,e._numTris=0,e}return s(e,t),n(e,[{key:"type",get:function(){return this._type}},{key:"queue",get:function(){return this._queue}},{key:"numDrawCalls",get:function(){return this._numDrawCalls}},{key:"numInstances",get:function(){return this._numInstances}},{key:"numTris",get:function(){return this._numTris}}]),e}(sd),Ed=function(){function t(){this._gfxAPI=_l.UNKNOWN,this._renderer="",this._vendor="",this._features=new Array(fl.COUNT),this._formatFeatures=new Array(pl.COUNT),this._queue=null,this._cmdBuff=null,this._numDrawCalls=0,this._numInstances=0,this._numTris=0,this._memoryStatus=new id,this._caps=new n_,this._bindingMappingInfo=new p_,this._samplers=new Map,this._generalBarrierss=new Map,this._textureBarriers=new Map,this._bufferBarriers=new Map,this._swapchainFormat=pl.RGBA8}var e=t.prototype;return e.hasFeature=function(t){return this._features[t]},e.getFormatFeatures=function(t){return this._formatFeatures[t]},e.enableAutoBarrier=function(){},e.getMaxSampleCount=function(){return Rl.X1},n(t,[{key:"gfxAPI",get:function(){return this._gfxAPI}},{key:"queue",get:function(){return this._queue}},{key:"commandBuffer",get:function(){return this._cmdBuff}},{key:"swapchainFormat",get:function(){return this._swapchainFormat}},{key:"renderer",get:function(){return this._renderer}},{key:"vendor",get:function(){return this._vendor}},{key:"numDrawCalls",get:function(){return this._numDrawCalls}},{key:"numInstances",get:function(){return this._numInstances}},{key:"numTris",get:function(){return this._numTris}},{key:"memoryStatus",get:function(){return this._memoryStatus}},{key:"capabilities",get:function(){return this._caps}},{key:"bindingMappingInfo",get:function(){return this._bindingMappingInfo}}]),t}();Ed.canvas=void 0;var Sd=function(){function t(t){this._texture2D=null,this._texture3D=null,this._textureCube=null,this._texture2DArray=null;var e=new Uint8Array(64);if(e.fill(255),t.capabilities.maxTextureSize>=2){this._texture2D=t.createTexture(new A_(Sl.TEX2D,Al.STORAGE|Al.SAMPLED,pl.RGBA8,2,2,bl.NONE));var i=new __(0,0,0,new s_(0,0,0),new a_(2,2,1));t.copyBuffersToTexture([e],this._texture2D,[i])}if(t.capabilities.maxTextureSize>=2){this._textureCube=t.createTexture(new A_(Sl.CUBE,Al.STORAGE|Al.SAMPLED,pl.RGBA8,2,2,bl.NONE,6));var n=new __(0,0,0,new s_(0,0,0),new a_(2,2,1));t.copyBuffersToTexture([e],this._textureCube,[n]),n.texSubres.baseArrayLayer=1,t.copyBuffersToTexture([e],this._textureCube,[n]),n.texSubres.baseArrayLayer=2,t.copyBuffersToTexture([e],this._textureCube,[n]),n.texSubres.baseArrayLayer=3,t.copyBuffersToTexture([e],this._textureCube,[n]),n.texSubres.baseArrayLayer=4,t.copyBuffersToTexture([e],this._textureCube,[n]),n.texSubres.baseArrayLayer=5,t.copyBuffersToTexture([e],this._textureCube,[n])}if(t.capabilities.max3DTextureSize>=2){this._texture3D=t.createTexture(new A_(Sl.TEX3D,Al.STORAGE|Al.SAMPLED,pl.RGBA8,2,2,bl.NONE,1,1,Rl.X1,2));var r=new __(0,0,0,new s_(0,0,0),new a_(2,2,2),new h_(0,0,1));t.copyBuffersToTexture([e],this._texture3D,[r])}if(t.capabilities.maxArrayTextureLayers>=2){this._texture2DArray=t.createTexture(new A_(Sl.TEX2D_ARRAY,Al.STORAGE|Al.SAMPLED,pl.RGBA8,2,2,bl.NONE,2));var s=new __(0,0,0,new s_(0,0,0),new a_(2,2,1),new h_(0,0,1));t.copyBuffersToTexture([e],this._texture2DArray,[s]),s.texSubres.baseArrayLayer=1,t.copyBuffersToTexture([e],this._texture2DArray,[s])}}return t.prototype.getTexture=function(t){switch(t){case Sl.TEX2D:return this._texture2D;case Sl.TEX3D:return this._texture3D;case Sl.CUBE:return this._textureCube;case Sl.TEX2D_ARRAY:return this._texture2DArray;default:return null}},t}(),Ad=function(t){function e(){var e;return(e=t.call(this,cl.SWAPCHAIN)||this)._transform=dl.IDENTITY,e._colorTexture=null,e._depthStencilTexture=null,e}return s(e,t),n(e,[{key:"colorTexture",get:function(){return this._colorTexture}},{key:"depthStencilTexture",get:function(){return this._depthStencilTexture}},{key:"surfaceTransform",get:function(){return this._transform}},{key:"width",get:function(){return this._colorTexture.width}},{key:"height",get:function(){return this._colorTexture.height}}]),e}(sd),bd=function(t){function e(){var e;return(e=t.call(this,cl.FRAMEBUFFER)||this)._renderPass=null,e._colorTextures=[],e._depthStencilTexture=null,e._width=0,e._height=0,e}return s(e,t),n(e,[{key:"renderPass",get:function(){return this._renderPass}},{key:"colorTextures",get:function(){return this._colorTextures}},{key:"depthStencilTexture",get:function(){return this._depthStencilTexture}},{key:"width",get:function(){return this.colorTextures.length>0?this.colorTextures[0].width:this.depthStencilTexture?this.depthStencilTexture.width:this._width}},{key:"height",get:function(){return this.colorTextures.length>0?this.colorTextures[0].height:this.depthStencilTexture?this.depthStencilTexture.height:this._height}},{key:"needRebuild",get:function(){return!1}}]),e}(sd),Cd=function(t){function e(){var e;return(e=t.call(this,cl.INPUT_ASSEMBLER)||this)._attributes=[],e._attributesHash=0,e._vertexBuffers=[],e._indexBuffer=null,e._indirectBuffer=null,e._drawInfo=new T_,e}s(e,t);var i=e.prototype;return i.getVertexBuffer=function(t){return void 0===t&&(t=0),t=0){var a=this._colorInfos[i.depthStencil];t+="ds,"+a.format+","+a.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}(sd),kd=function(t){function e(){var e;return(e=t.call(this,cl.SHADER)||this)._name="",e._stages=[],e._attributes=[],e._blocks=[],e._samplers=[],e}return s(e,t),n(e,[{key:"name",get:function(){return this._name}},{key:"attributes",get:function(){return this._attributes}},{key:"blocks",get:function(){return this._blocks}},{key:"samplers",get:function(){return this._samplers}},{key:"stages",get:function(){return this._stages}}]),e}(sd),Ud=function(t){function e(){var e;return(e=t.call(this,cl.TEXTURE)||this)._info=new A_,e._viewInfo=new b_,e._isPowerOf2=!1,e._isTextureView=!1,e._size=0,e}return s(e,t),e.getLevelCount=function(t,e){return Math.floor(Math.log2(Math.max(t,e)))},n(e,[{key:"type",get:function(){return this._info.type}},{key:"usage",get:function(){return this._info.usage}},{key:"format",get:function(){return this._info.format}},{key:"width",get:function(){return this._info.width}},{key:"height",get:function(){return this._info.height}},{key:"depth",get:function(){return this._info.depth}},{key:"layerCount",get:function(){return this._info.layerCount}},{key:"levelCount",get:function(){return this._info.levelCount}},{key:"samples",get:function(){return this._info.samples}},{key:"flags",get:function(){return this._info.flags}},{key:"size",get:function(){return this._size}},{key:"info",get:function(){return this._info}},{key:"viewInfo",get:function(){return this._viewInfo}},{key:"isTextureView",get:function(){return this._isTextureView}}]),e}(sd),Gd=function(t){function e(e,i){var n;return(n=t.call(this,cl.GLOBAL_BARRIER)||this)._info=new V_,n._hash=0,n._info.copy(e),n._hash=i,n}return s(e,t),e.computeHash=function(t){return nl(t.prevAccesses+" "+t.nextAccesses+" "+t.type,666)},n(e,[{key:"info",get:function(){return this._info}},{key:"hash",get:function(){return this._hash}}]),e}(sd),Hd=function(t){function e(e,i){var n;return(n=t.call(this,cl.TEXTURE_BARRIER)||this)._info=new W_,n._hash=0,n._info.copy(e),n._hash=i,n}return s(e,t),e.computeHash=function(t){var e=t.prevAccesses+" "+t.nextAccesses;return e+=t.type,e+=t.baseMipLevel,e+=t.levelCount,e+=t.baseSlice,e+=t.sliceCount,e+=t.discardContents,e+=t.srcQueue?t.srcQueue.type:0,nl(e+=t.dstQueue?t.dstQueue.type:0,666)},n(e,[{key:"info",get:function(){return this._info}},{key:"hash",get:function(){return this._hash}}]),e}(sd),zd=function(t){function e(e,i){var n;return(n=t.call(this,cl.BUFFER_BARRIER)||this)._info=new X_,n._hash=0,n._info.copy(e),n._hash=i,n}return s(e,t),e.computeHash=function(t){var e=t.prevAccesses+" "+t.nextAccesses;return e+=t.type,e+=t.offset,e+=t.size,e+=t.discardContents,e+=t.srcQueue?t.srcQueue.type:0,nl(e+=t.dstQueue?t.dstQueue.type:0,666)},n(e,[{key:"info",get:function(){return this._info}},{key:"hash",get:function(){return this._hash}}]),e}(sd),Vd={Device:Ed,Swapchain:Ad,Buffer:yd,Texture:Ud,Sampler:Fd,Shader:kd,InputAssembler:Cd,RenderPass:Bd,Framebuffer:bd,DescriptorSet:Rd,DescriptorSetLayout:wd,PipelineLayout:Id,PipelineState:Nd,CommandBuffer:Td,Queue:Ld,GeneralBarrier:Gd,TextureBarrier:Hd,BufferBarrier:zd,RasterizerState:xd,BlendState:Pd,BlendTarget:Od,DepthStencilState:Dd,PipelineStateInfo:Md};Object.assign(Vd,vd),m.gfx=Vd;var Wd,Xd,jd={GFXDevice:!0,GFXBuffer:!0,GFXTexture:!0,GFXSampler:!0,GFXShader:!0,GFXInputAssembler:!0,GFXRenderPass:!0,GFXFramebuffer:!0,GFXPipelineState:!0,GFXCommandBuffer:!0,GFXQueue:!0,GFXObjectType:!0,GFXObject:!1,GFXAttributeName:!0,GFXType:!0,GFXFormat:!0,GFXBufferUsageBit:!0,GFXMemoryUsageBit:!0,GFXBufferFlagBit:!0,GFXBufferAccessBit:"MemoryAccessBit",GFXPrimitiveMode:!0,GFXPolygonMode:!0,GFXShadeModel:!0,GFXCullMode:!0,GFXComparisonFunc:!0,GFXStencilOp:!0,GFXBlendOp:!0,GFXBlendFactor:!0,GFXColorMask:!0,GFXFilter:!0,GFXAddress:!0,GFXTextureType:!0,GFXTextureUsageBit:!0,GFXSampleCount:!0,GFXTextureFlagBit:!0,GFXShaderStageFlagBit:!0,GFXDescriptorType:!0,GFXCommandBufferType:!0,GFXLoadOp:!0,GFXStoreOp:!0,GFXPipelineBindPoint:!0,GFXDynamicStateFlagBit:!0,GFXStencilFace:!0,GFXQueueType:!0,GFXRect:!0,GFXViewport:!0,GFXColor:!0,GFXClearFlag:!0,GFXOffset:!0,GFXExtent:!0,GFXTextureSubres:"TextureSubresLayers",GFXTextureCopy:!0,GFXBufferTextureCopy:!0,GFXFormatType:!0,GFXFormatInfo:!0,GFXMemoryStatus:!0,GFXFormatInfos:!0,GFXFormatSize:!0,GFXFormatSurfaceSize:!0,GFXGetTypeSize:!0,getTypedArrayConstructor:!1};for(var Yd in jd){var Kd=jd[Yd];!0===Kd?Kd=Yd.slice(3):!1===Kd&&(Kd=Yd),rt(m,"cc",[{name:Yd,newName:Kd,target:m.gfx,targetName:"cc.gfx"}])}st(m,"cc",[{name:"GFX_MAX_VERTEX_ATTRIBUTES"},{name:"GFX_MAX_TEXTURE_UNITS"},{name:"GFX_MAX_ATTACHMENTS"},{name:"GFX_MAX_BUFFER_BINDINGS"},{name:"GFXTextureLayout"}]),st(fl,"Feature",[{name:"COLOR_FLOAT",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.R32F) & FormatFeatureBit.RENDER_TARGET;"},{name:"COLOR_HALF_FLOAT",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.R16F) & FormatFeatureBit.RENDER_TARGET;"},{name:"TEXTURE_FLOAT",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = (device.getFormatFeatures(Format.R32F) & (FormatFeatureBit.RENDER_TARGET | FormatFeatureBit.SAMPLED_TEXTURE)) === (FormatFeatureBit.RENDER_TARGET | FormatFeatureBit.SAMPLED_TEXTURE);"},{name:"TEXTURE_HALF_FLOAT",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = (device.getFormatFeatures(Format.R16F) & (FormatFeatureBit.RENDER_TARGET | FormatFeatureBit.SAMPLED_TEXTURE)) === (FormatFeatureBit.RENDER_TARGET | FormatFeatureBit.SAMPLED_TEXTURE);"},{name:"TEXTURE_FLOAT_LINEAR",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.R32F) & FormatFeatureBit.LINEAR_FILTER;"},{name:"TEXTURE_HALF_FLOAT_LINEAR",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.R16F) & FormatFeatureBit.LINEAR_FILTER;"},{name:"FORMAT_R11G11B10F",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.R11G11B10F) !== FormatFeatureBit.NONE;"},{name:"FORMAT_SRGB",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.SRGB8) !== FormatFeatureBit.NONE;"},{name:"FORMAT_ETC1",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.ETC_RGB8) !== FormatFeatureBit.NONE;"},{name:"FORMAT_ETC2",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.ETC2_RGB8) !== FormatFeatureBit.NONE;"},{name:"FORMAT_DXT",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.BC1) !== FormatFeatureBit.NONE;"},{name:"FORMAT_PVRTC",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.PVRTC_RGB2) !== FormatFeatureBit.NONE;"},{name:"FORMAT_ASTC",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.ASTC_RGBA_4x4) !== FormatFeatureBit.NONE;"},{name:"FORMAT_RGB8",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.RGB8) !== FormatFeatureBit.NONE;"}]),st(k_.prototype,"ColorAttachment",[{name:"beginAccesses",suggest:"Please assign to ColorAttachment.barrier instead"},{name:"endAccesses",suggest:"Please assign to ColorAttachment.barrier instead"}]),st(U_.prototype,"DepthStencilAttachment",[{name:"beginAccesses",suggest:"Please assign to DepthStencilAttachment.barrier instead"},{name:"endAccesses",suggest:"Please assign to DepthStencilAttachment.barrier instead"}]),rt(Ed.prototype,"Device",[{name:"getGlobalBarrier",newName:"getGeneralBarrier"}]),function(t){t[t.AUTO=0]="AUTO",t[t.CANVAS=1]="CANVAS",t[t.WEBGL=2]="WEBGL",t[t.HEADLESS=3]="HEADLESS",t[t.WEBGPU=4]="WEBGPU"}(Wd||(Wd={})),function(t){t[t.UNKNOWN=-1]="UNKNOWN",t[t.CANVAS=0]="CANVAS",t[t.WEBGL=1]="WEBGL",t[t.WEBGPU=2]="WEBGPU",t[t.OPENGL=3]="OPENGL",t[t.HEADLESS=4]="HEADLESS"}(Xd||(Xd={}));var qd=function(){function t(){this.initialized=!1,this._gfxDevice=void 0,this._canvas=null,this._swapchain=void 0,this._renderType=Xd.UNKNOWN,this._deviceInitialized=!1}var e=t.prototype;return e._tryInitializeWebGPUDevice=function(t,e){var i=this;return this._deviceInitialized?Promise.resolve(!0):t?(this._gfxDevice=new t,new Promise((function(t,n){i._gfxDevice.initialize(e).then((function(e){i._deviceInitialized=e,t(e)})).catch((function(t){n(t)}))}))):Promise.resolve(!1)},e._tryInitializeDeviceSync=function(t,e){return!!this._deviceInitialized||(t&&(this._gfxDevice=new t,this._deviceInitialized=this._gfxDevice.initialize(e)),this._deviceInitialized)},e.init=function(t,e){var i=this;if(this.initialized)return!0;var n=we.querySettings(Ce.Category.RENDERING,"renderMode");this._canvas=t,this._canvas&&(this._canvas.oncontextmenu=function(){return!1}),this._renderType=this._determineRenderType(n),this._deviceInitialized=!1;var r=new m_(e);if(this._renderType===Xd.WEBGL||this._renderType===Xd.WEBGPU){var s=!!globalThis.WebGL2RenderingContext;if(globalThis.navigator.userAgent.toLowerCase(),Fo.browserType===ao.UC&&(s=!1),Ed.canvas=t,this._renderType===Xd.WEBGPU&&m.WebGPUDevice)return new Promise((function(t,e){i._tryInitializeWebGPUDevice(m.WebGPUDevice,r).then((function(e){i._initSwapchain(),t(e)})).catch((function(t){e(t)}))}));s&&m.WebGL2Device&&this._tryInitializeDeviceSync(m.WebGL2Device,r),m.WebGLDevice&&this._tryInitializeDeviceSync(m.WebGLDevice,r),m.EmptyDevice&&this._tryInitializeDeviceSync(m.EmptyDevice,r),this._initSwapchain()}else this._renderType===Xd.HEADLESS&&m.EmptyDevice&&(this._tryInitializeDeviceSync(m.EmptyDevice,r),this._initSwapchain());return!!this._gfxDevice||(Z(16337),this._renderType=Xd.UNKNOWN,!1)},e._initSwapchain=function(){var t=new g_(1,this._canvas),e=Bo.windowSize;t.width=e.width,t.height=e.height,this._swapchain=this._gfxDevice.createSwapchain(t)},e._supportWebGPU=function(){return"gpu"in globalThis.navigator},e._determineRenderType=function(t){("number"!=typeof t||t>Wd.WEBGPU||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],gf[mf[n++]]=ff[(3&r)<<2|s>>4],gf[mf[n++]]=ff[15&s]}return t.replace(e,gf.join(""))}var yf=/.*[/\\][0-9a-fA-F]{2}[/\\]([0-9a-fA-F-@]{8,}).*/;function Tf(t){var e=yf.exec(t);return e?e[1]:""}function Ef(t,e){(e=e||Object.create(null)).__isNative__=e.isNative,e.nativeExt&&(e.ext=e.nativeExt);var i=of.find((function(e){return!!e.getAssetInfo(t)}));return i&&(e.bundle=i.name),bf(t,e)}function Sf(t){return!!t&&(t instanceof m.SceneAsset||t instanceof m.Scene)}function Af(t){return t&&(46===t.charCodeAt(0)&&47===t.charCodeAt(1)?t=t.slice(2):47===t.charCodeAt(0)&&(t=t.slice(1))),t}function bf(t,e){var i=df.create({input:t,options:e}),n=[];try{for(var r,s=d(uf.sync(i));!(r=s()).done;){var o=r.value,a=o.url;o.recycle(),n.push(a)}}catch(t){for(var h,u=d(i.output);!(h=u()).done;)h.value.recycle();k(t.message,t.stack)}return i.recycle(),n.length>1?n:n[0]}var Cf,Rf,wf,If=Object.freeze({__proto__:null,getUuidFromURL:Tf,getUrlWithUuid:Ef,isScene:Sf,normalize:Af,transform:bf,decodeUuid:vf}),xf=wa,Df=Sa,Of=t("Asset",va("cc.Asset")((Rf=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r0&&this._ref--,t&&m.assetManager._releaseManager.tryRelease(this),this},i.onLoaded=function(){},i.initDefault=function(t){t&&(this._uuid=t),this.isDefault=!0},i.validate=function(){return!0},i.destroy=function(){return G(et(12101,this._uuid)),t.prototype.destroy.call(this)},n(e,[{key:"nativeUrl",get:function(){if(!this._nativeUrl){if(!this._native)return"";var t=this._native;if(47===t.charCodeAt(0))return t.slice(1);46===t.charCodeAt(0)?this._nativeUrl=Ef(this._uuid,{nativeExt:t,isNative:!0}):this._nativeUrl=Ef(this._uuid,{__nativeName__:t,nativeExt:Eo(t),isNative:!0})}return this._nativeUrl}},{key:"uuid",get:function(){return this._uuid}},{key:"_nativeAsset",get:function(){return this._file},set:function(t){this._file=t}},{key:"nativeAsset",get:function(){return this._file}},{key:"_nativeDep",get:function(){if(this._native)return{__isNative__:!0,uuid:this._uuid,ext:this._native}}},{key:"refCount",get:function(){return this._ref}}]),e}(so(qs)),wf=ua(Rf.prototype,"_native",[xf],(function(){return""})),f(Rf.prototype,"_nativeAsset",[Df],Object.getOwnPropertyDescriptor(Rf.prototype,"_nativeAsset"),Rf.prototype),Cf=Rf))||Cf);Of.prototype.createNode=null,m.Asset=Of;var Pf,Mf,Nf,Lf,Bf,Ff;!function(t){t[t.RGB565=pl.R5G6B5]="RGB565",t[t.RGB5A1=pl.RGB5A1]="RGB5A1",t[t.RGBA4444=pl.RGBA4]="RGBA4444",t[t.RGB888=pl.RGB8]="RGB888",t[t.RGB32F=pl.RGB32F]="RGB32F",t[t.RGBA8888=pl.RGBA8]="RGBA8888",t[t.BGRA8888=pl.BGRA8]="BGRA8888",t[t.RGBA32F=pl.RGBA32F]="RGBA32F",t[t.A8=pl.A8]="A8",t[t.I8=pl.L8]="I8",t[t.AI8=pl.LA8]="AI8",t[t.RGB_PVRTC_2BPPV1=pl.PVRTC_RGB2]="RGB_PVRTC_2BPPV1",t[t.RGBA_PVRTC_2BPPV1=pl.PVRTC_RGBA2]="RGBA_PVRTC_2BPPV1",t[t.RGB_A_PVRTC_2BPPV1=1024]="RGB_A_PVRTC_2BPPV1",t[t.RGB_PVRTC_4BPPV1=pl.PVRTC_RGB4]="RGB_PVRTC_4BPPV1",t[t.RGBA_PVRTC_4BPPV1=pl.PVRTC_RGBA4]="RGBA_PVRTC_4BPPV1",t[t.RGB_A_PVRTC_4BPPV1=1025]="RGB_A_PVRTC_4BPPV1",t[t.RGB_ETC1=pl.ETC_RGB8]="RGB_ETC1",t[t.RGBA_ETC1=1026]="RGBA_ETC1",t[t.RGB_ETC2=pl.ETC2_RGB8]="RGB_ETC2",t[t.RGBA_ETC2=pl.ETC2_RGBA8]="RGBA_ETC2",t[t.RGBA_ASTC_4x4=pl.ASTC_RGBA_4X4]="RGBA_ASTC_4x4",t[t.RGBA_ASTC_5x4=pl.ASTC_RGBA_5X4]="RGBA_ASTC_5x4",t[t.RGBA_ASTC_5x5=pl.ASTC_RGBA_5X5]="RGBA_ASTC_5x5",t[t.RGBA_ASTC_6x5=pl.ASTC_RGBA_6X5]="RGBA_ASTC_6x5",t[t.RGBA_ASTC_6x6=pl.ASTC_RGBA_6X6]="RGBA_ASTC_6x6",t[t.RGBA_ASTC_8x5=pl.ASTC_RGBA_8X5]="RGBA_ASTC_8x5",t[t.RGBA_ASTC_8x6=pl.ASTC_RGBA_8X6]="RGBA_ASTC_8x6",t[t.RGBA_ASTC_8x8=pl.ASTC_RGBA_8X8]="RGBA_ASTC_8x8",t[t.RGBA_ASTC_10x5=pl.ASTC_RGBA_10X5]="RGBA_ASTC_10x5",t[t.RGBA_ASTC_10x6=pl.ASTC_RGBA_10X6]="RGBA_ASTC_10x6",t[t.RGBA_ASTC_10x8=pl.ASTC_RGBA_10X8]="RGBA_ASTC_10x8",t[t.RGBA_ASTC_10x10=pl.ASTC_RGBA_10X10]="RGBA_ASTC_10x10",t[t.RGBA_ASTC_12x10=pl.ASTC_RGBA_12X10]="RGBA_ASTC_12x10",t[t.RGBA_ASTC_12x12=pl.ASTC_RGBA_12X12]="RGBA_ASTC_12x12"}(Pf||(Pf={})),function(t){t[t.REPEAT=xl.WRAP]="REPEAT",t[t.CLAMP_TO_EDGE=xl.CLAMP]="CLAMP_TO_EDGE",t[t.MIRRORED_REPEAT=xl.MIRROR]="MIRRORED_REPEAT",t[t.CLAMP_TO_BORDER=xl.BORDER]="CLAMP_TO_BORDER"}(Mf||(Mf={})),function(t){t[t.NONE=Il.NONE]="NONE",t[t.LINEAR=Il.LINEAR]="LINEAR",t[t.NEAREST=Il.POINT]="NEAREST"}(Nf||(Nf={}));var kf=1346981187,Uf=ye({PVR:0,PKM:1,ASTC:2});function Gf(t,e){return t[e]<<8|t[e+1]}function Hf(t){return!!(Fo.hasFeature(Fo.Feature.IMAGE_BITMAP)&&t instanceof ImageBitmap)}var zf,Vf,Wf,Xf,jf,Yf,Kf,qf,Qf,Zf,Jf,$f=t("ImageAsset",va("cc.ImageAsset")(((Ff=function(t){s(i,t),i.mergeCompressedTextureMips=function(t){var e=new Uint8Array(0);try{for(var i,n=8+4*t.length,r=0,s=d(t);!(i=s()).done;)r+=i.value.byteLength;r+=n,e=new Uint8Array(r);var o=new DataView(e.buffer,e.byteOffset,e.byteLength);o.setUint32(0,kf,!0),o.setUint32(4,t.length,!0);for(var a=n,h=0;h0){var u=new Uint8Array(s,a,h),c=new Uint8Array(r._data.byteLength+u.byteLength);c.set(r._data),c.set(u,r._data.byteLength),r._data=c,r.mipmapLevelDataSize[e]=h}else r._data=new Uint8Array(s,a);r.width=e>0?r.width:o[7],r.height=e>0?r.height:o[6]}else{if(559044176!==o[11])throw new Error("Invalid magic number in PVR header");var l=i+o[0],_=n-o.byteLength;if(n>0){var d=new Uint8Array(s,l,_),f=new Uint8Array(r._data.byteLength+d.byteLength);f.set(r._data),f.set(d,r._data.byteLength),r._data=f,r.mipmapLevelDataSize[e]=_}else r._data=new Uint8Array(s,l);r.width=e>0?r.width:o[1],r.height=e>0?r.height:o[2]}},i.parsePKMTexture=function(t,e,i,n,r){var s=t instanceof ArrayBuffer?t:t.buffer,o=new Uint8Array(s,i,16),a=Gf(o,6);if(0!==a&&1!==a&&3!==a)throw new Error("Invalid magic number in ETC header");var h=i+16,u=n-16;if(n>0){var c=new Uint8Array(s,h,u),l=new Uint8Array(r._data.byteLength+c.byteLength);l.set(r._data),l.set(c,r._data.byteLength),r._data=l,r.mipmapLevelDataSize[e]=u}else r._data=new Uint8Array(s,h);r.width=e>0?r.width:Gf(o,12),r.height=e>0?r.height:Gf(o,14)},i.parseASTCTexture=function(t,e,i,n,r){var s=t instanceof ArrayBuffer?t:t.buffer,o=new Uint8Array(s,i,16);if(1554098963!==o[0]+(o[1]<<8)+(o[2]<<16)+(o[3]<<24))throw new Error("Invalid magic number in ASTC header");var a=o[4],h=o[5],u=o[6];if((a<3||a>6||h<3||h>6||u<3||u>6)&&(a<4||7===a||9===a||11===a||a>12||h<4||7===h||9===h||11===h||h>12||1!==u))throw new Error("Invalid block number in ASTC header");var c=function(t,e){return 4===t?Pf.RGBA_ASTC_4x4:5===t?4===e?Pf.RGBA_ASTC_5x4:Pf.RGBA_ASTC_5x5:6===t?5===e?Pf.RGBA_ASTC_6x5:Pf.RGBA_ASTC_6x6:8===t?5===e?Pf.RGBA_ASTC_8x5:6===e?Pf.RGBA_ASTC_8x6:Pf.RGBA_ASTC_8x8:10===t?5===e?Pf.RGBA_ASTC_10x5:6===e?Pf.RGBA_ASTC_10x6:8===e?Pf.RGBA_ASTC_10x8:Pf.RGBA_ASTC_10x10:10===e?Pf.RGBA_ASTC_12x10:Pf.RGBA_ASTC_12x12}(a,h),l=i+16,_=n-16;if(n>0){var d=new Uint8Array(s,l,_),f=new Uint8Array(r._data.byteLength+d.byteLength);f.set(r._data),f.set(d,r._data.byteLength),r._data=f,r.mipmapLevelDataSize[e]=_}else r._data=new Uint8Array(s,l);r.width=e>0?r.width:o[7]+(o[8]<<8)+(o[9]<<16),r.height=e>0?r.height:o[10]+(o[11]<<8)+(o[12]<<16),r.format=c};var e=i.prototype;function i(e){var i;return(i=t.call(this)||this)._nativeData=void 0,i._exportedExts=void 0,i._format=Pf.RGBA8888,i._width=0,i._height=0,i._nativeData={_data:null,width:0,height:0,format:0,_compressed:!1,mipmapLevelDataSize:[]},void 0!==e&&i.reset(e),i}return e.extractMipmap0=function(){if(this.mipmapLevelDataSize&&this.mipmapLevelDataSize.length>0){var t=this.mipmapLevelDataSize[0],e=this.data,n=new i({_data:new Uint8Array(e.buffer,0,t),_compressed:!0,width:this.width,height:this.height,format:this.format,mipmapLevelDataSize:[]});return n._uuid=""+this._uuid,n}return this},e.extractMipmaps=function(){var t=[];if(this.mipmapLevelDataSize&&this.mipmapLevelDataSize.length>0)for(var e,n=this.mipmapLevelDataSize,r=this.data,s=0,o=this.height,a=this.width,h=d(n);!(e=h()).done;){var u=e.value,c=new i({_data:new Uint8Array(r.buffer,s,u),_compressed:!0,width:a,height:o,format:this.format,mipmapLevelDataSize:[]});s+=u,c._uuid=""+this._uuid,a=Math.max(a>>1,1),o=Math.max(o>>1,1),t.push(c)}else t.push(this);return t},e.reset=function(t){Hf(t)||t instanceof HTMLElement?this._nativeData=t:(this._nativeData=t,this._format=t.format)},e.destroy=function(){if(this.data&&this.data instanceof HTMLImageElement)this.data.src="",this._setRawAsset("");else if(Hf(this.data)){var e;null===(e=this.data)||void 0===e||e.close()}return t.prototype.destroy.call(this)},e._serialize=function(){},e._deserialize=function(t){var e="";"string"==typeof t?e=t:(this._width=t.w,this._height=t.h,e=t.fmt);for(var n,r=Qd.gfxDevice,s=e.split("_"),o=Number.MAX_VALUE,a=this._format,h="",u=Ie.SUPPORT_TEXTURE_FORMATS,c=d(s);!(n=c()).done;){var l=n.value.split("@"),_=parseInt(l[0],void 0),f=i.extnames[_]||l[0],p=u.indexOf(f);if(-1!==p&&p=Pf.RGB_ETC1&&this._format<=Pf.RGBA_ASTC_12x12||this._format>=Pf.RGB_A_PVRTC_2BPPV1&&this._format<=Pf.RGBA_ETC1}},{key:"mipmapLevelDataSize",get:function(){return this._nativeData.mipmapLevelDataSize}},{key:"url",get:function(){return this.nativeUrl}}]),i}(Of)).extnames=[".png",".jpg",".jpeg",".bmp",".webp",".pvr",".pkm",".astc"],Ff._sharedPlaceHolderCanvas=null,f((Bf=Ff).prototype,"_nativeAsset",[hh],Object.getOwnPropertyDescriptor(Bf.prototype,"_nativeAsset"),Bf.prototype),Lf=Bf))||Lf);m.ImageAsset=$f,Se(pl);var tp,ep,ip,np=new vt("Tex"),rp=va("cc.TextureBase")(((Jf=function(t){function e(){var e;return(e=t.call(this)||this)._format=Wf&&Wf(),e._minFilter=Xf&&Xf(),e._magFilter=jf&&jf(),e._mipFilter=Yf&&Yf(),e._wrapS=Kf&&Kf(),e._wrapT=qf&&qf(),e._wrapR=Qf&&Qf(),e._anisotropy=Zf&&Zf(),e._width=1,e._height=1,e._samplerInfo=new C_,e._gfxSampler=null,e._gfxDevice=null,e._textureHash=0,e._id=np.getNewId(),e._gfxDevice=e._getGFXDevice(),e._textureHash=nl(e._id,666),e}s(e,t);var i=e.prototype;return i.getId=function(){return this._id},i.getPixelFormat=function(){return this._format},i.getAnisotropy=function(){return this._anisotropy},i.setWrapMode=function(t,e,i){void 0===i&&(i=t),this._wrapS=t,this._samplerInfo.addressU=t,this._wrapT=e,this._samplerInfo.addressV=e,this._wrapR=i,this._samplerInfo.addressW=i,this._gfxDevice&&(this._gfxSampler=this._gfxDevice.getSampler(this._samplerInfo))},i.setFilters=function(t,e){this._minFilter=t,this._samplerInfo.minFilter=t,this._magFilter=e,this._samplerInfo.magFilter=e,this._gfxDevice&&(this._gfxSampler=this._gfxDevice.getSampler(this._samplerInfo))},i.setMipFilter=function(t){this._mipFilter=t,this._samplerInfo.mipFilter=t,this._gfxDevice&&(this._gfxSampler=this._gfxDevice.getSampler(this._samplerInfo))},i.setAnisotropy=function(t){this._anisotropy=t,this._samplerInfo.maxAnisotropy=t,this._gfxDevice&&(this._gfxSampler=this._gfxDevice.getSampler(this._samplerInfo))},i.destroy=function(){var e,i=t.prototype.destroy.call(this);return i&&null!==(e=m.director.root)&&void 0!==e&&e.batcher2D&&m.director.root.batcher2D._releaseDescriptorSetCache(this._textureHash),i},i.getHash=function(){return this._textureHash},i.getGFXTexture=function(){return null},i.getSamplerInfo=function(){return this._samplerInfo},i.getGFXSampler=function(){return this._gfxSampler||(this._gfxDevice?this._gfxSampler=this._gfxDevice.getSampler(this._samplerInfo):Z(9302)),this._gfxSampler},i._serialize=function(){return""},i._deserialize=function(t){var e=t.split(",");e.unshift(""),e.length>=5&&(this.setFilters(parseInt(e[1]),parseInt(e[2])),this.setWrapMode(parseInt(e[3]),parseInt(e[4]))),e.length>=7&&(this.setMipFilter(parseInt(e[5])),this.setAnisotropy(parseInt(e[6])))},i._getGFXDevice=function(){return Qd.gfxDevice},i._getGFXFormat=function(){return this._getGFXPixelFormat(this._format)},i._setGFXFormat=function(t){this._format=void 0===t?Pf.RGBA8888:t},i._getGFXPixelFormat=function(t){return t===Pf.RGBA_ETC1?t=Pf.RGB_ETC1:t===Pf.RGB_A_PVRTC_4BPPV1?t=Pf.RGB_PVRTC_4BPPV1:t===Pf.RGB_A_PVRTC_2BPPV1&&(t=Pf.RGB_PVRTC_2BPPV1),t},n(e,[{key:"isCompressed",get:function(){return this._format>=Pf.RGB_ETC1&&this._format<=Pf.RGBA_ASTC_12x12||this._format>=Pf.RGB_A_PVRTC_2BPPV1&&this._format<=Pf.RGBA_ETC1}},{key:"width",get:function(){return this._width}},{key:"height",get:function(){return this._height}}]),e}(Of)).PixelFormat=Pf,Jf.WrapMode=Mf,Jf.Filter=Nf,Wf=ua((Vf=Jf).prototype,"_format",[wa],(function(){return Pf.RGBA8888})),Xf=ua(Vf.prototype,"_minFilter",[wa],(function(){return Nf.LINEAR})),jf=ua(Vf.prototype,"_magFilter",[wa],(function(){return Nf.LINEAR})),Yf=ua(Vf.prototype,"_mipFilter",[wa],(function(){return Nf.NONE})),Kf=ua(Vf.prototype,"_wrapS",[wa],(function(){return Mf.REPEAT})),qf=ua(Vf.prototype,"_wrapT",[wa],(function(){return Mf.REPEAT})),Qf=ua(Vf.prototype,"_wrapR",[wa],(function(){return Mf.REPEAT})),Zf=ua(Vf.prototype,"_anisotropy",[wa],(function(){return 0})),zf=Vf))||zf;m.TextureBase=rp;var sp=t("Script",va("cc.Script")(tp=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(Of))||tp);m._Script=sp;var op=t("JavaScript",va("cc.JavaScript")(ep=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(sp))||ep);m._JavaScript=op;var ap,hp,up,cp,lp,_p,dp,fp=t("TypeScript",va("cc.TypeScript")(ip=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(sp))||ip);m._TypeScript=fp;var pp,gp,mp,vp,yp,Tp,Ep,Sp,Ap,bp,Cp,Rp=t("EventHandler",va("cc.ClickEvent")((hp=function(){function t(){this.target=up&&up(),this.component=cp&&cp(),this._componentId=lp&&lp(),this.handler=_p&&_p(),this.customEventData=dp&&dp()}t.emitEvents=function(e){for(var i=arguments.length,n=new Array(i>1?i-1:0),r=1;r=0,1620),i=Number.isNaN(i)?m.macro.REPEAT_FOREVER:i,n=n||0;var r=m.director.getScheduler(),s=r.isTargetPaused(this);r.schedule(t,this,e,i,n,s)},i.scheduleOnce=function(t,e){void 0===e&&(e=0),this.schedule(t,0,0,e)},i.unschedule=function(t){t&&m.director.getScheduler().unschedule(t,this)},i.unscheduleAllCallbacks=function(){m.director.getScheduler().unscheduleAllForTarget(this)},n(e,[{key:"name",get:function(){if(this._name)return this._name;var t=Ot(this),e=t.lastIndexOf(".");return e>=0&&(t=t.slice(e+1)),this.node?this.node.name+"<"+t+">":t},set:function(t){this._name=t}},{key:"uuid",get:function(){return this._id}},{key:"__scriptAsset",get:function(){return null}},{key:"enabled",get:function(){return this._enabled},set:function(t){if(this._enabled!==t&&(this._enabled=t,this.node.activeInHierarchy)){var e=m.director._compScheduler;t?e.enableComp(this):e.disableComp(this)}}},{key:"enabledInHierarchy",get:function(){return this._enabled&&this.node&&this.node.activeInHierarchy}},{key:"_isOnLoadCalled",get:function(){return this._objFlags&Ip}},{key:"internalUpdate",get:function(){return this.update}},{key:"internalLateUpdate",get:function(){return this.lateUpdate}},{key:"internalPreload",get:function(){return this.__preload}},{key:"internalOnLoad",get:function(){return this.onLoad}},{key:"internalStart",get:function(){return this.start}},{key:"internalOnEnable",get:function(){return this.onEnable}},{key:"internalOnDisable",get:function(){return this.onDisable}},{key:"internalOnDestroy",get:function(){return this.onDestroy}}]),e}(qs)).EventHandler=Rp,Sp._executionOrder=0,Sp._requireComponent=null,Sp.system=null,f((vp=Sp).prototype,"__scriptAsset",[gp],Object.getOwnPropertyDescriptor(vp.prototype,"__scriptAsset"),vp.prototype),yp=ua(vp.prototype,"node",[wa],(function(){return null})),Tp=ua(vp.prototype,"_enabled",[wa],(function(){return!0})),Ep=ua(vp.prototype,"__prefab",[wa],(function(){return null})),mp=vp))||mp));Rt(xp,"_registerEditorProps",(function(t,e){var i=e.requireComponent;i&&(Array.isArray(i)&&(i=i.filter(Boolean)),t._requireComponent=i);var n=e.executionOrder;n&&"number"==typeof n&&(t._executionOrder=n)})),m.Component=xp;var Dp=t("MissingScript",va("cc.MissingScript")((bp=function(t){function e(){var e;return(e=t.call(this)||this)._$erialized=Cp&&Cp(),e}return s(e,t),e.safeFindClass=function(t){var e=ee(t);if(e)return e;m.deserialize.reportMissingClass(t)},e.prototype.onLoad=function(){q(4600,this.node.name)},e}(xp),Cp=ua(bp.prototype,"_$erialized",[wa,xa],(function(){return null})),Ap=bp))||Ap);m._MissingScript=Dp;try{var Op=Dp.__values__;0!==Op.length&&"_$erialized"===Op[Op.length-1]||(Z(16338),Z(16339,Op.join(", ")))}catch(sr){Z(16340,""+sr)}var Pp=function(){function t(t,e){this._document=t,this._chunks=e}return n(t,[{key:"document",get:function(){return this._document}},{key:"chunks",get:function(){return this._chunks}}]),t}();function Mp(t){var e=t;return{chunks:e.chunks,document:e.document}}function Np(t){if(t.length<16)throw new Lp(et(13102));var e=new DataView(t.buffer,t.byteOffset,t.byteLength);if(1313817411!==e.getUint32(0,!0))throw new Lp(et(13100));var i=e.getUint32(4,!0);if(1!==i)throw new Lp(et(13101,i));if(e.getUint32(8,!0)!==e.byteLength)throw new Lp(et(13102));var n=12,r=e.getUint32(n,!0);n+=4;var s=new Uint8Array(e.buffer,n+e.byteOffset,r);n+=r;var o,a=function(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);if("Buffer"in globalThis)return globalThis.Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString();throw new Error(et(13104))}(s);try{o=JSON.parse(a)}catch(t){throw new Lp(t)}for(var h=[];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}(o);return this._deserializeInto(t,a,o),a},e._deserializeInto=function(t,e,i,n){void 0===n&&(n=!1),n||!e[gh]?e._deserialize?e._deserialize(t.content,this):m.Class._isCCClass(i)?this._deserializeFireClass(e,t,i):this._deserializeFastDefinedObject(e,t,i):this._runCustomizedDeserialize(t,e,i)},e._runCustomizedDeserialize=function(t,e,i){var n=this,r={readProperty:function(e){var i=t[e];return"object"==typeof i&&i?n._deserializeObjectField(i):i},readThis:function(){n._deserializeInto(t,e,i,!0)},readSuper:function(){var r=Vt(i);r&&n._deserializeInto(t,e,r)}};e[gh](r,this._context)},e._deserializeFireClass=function(t,e,i){var n;if(i.hasOwnProperty("__deserialize__"))n=i.__deserialize__;else{n=function(t,e){var i=function(t){return De.test(re(t))}(e),n=Wt(e,m.Node)||Wt(e,m.Component),r=!1,s=[],o=s,a=[],h=a,u=[];return function(){var t=e.__values__;r="_$erialized"===t[t.length-1];for(var n=Ti.Attr.getClassAttrs(e),c=0;c=0?e[i]=t[5][n]:t[7][3*~n]=e}function Qp(t){return function(e,i,n,r){for(var s=0;s=0){var l=a[u];e[o]=Kp(t,l,c)}else(0,$p[u=~u])(t,e,o,c)}return r}(s);m.game._isCloning=!1,s[7]&&function(t,e,i){for(var n=t.length-1,r=0,s=3*t[n];r=0?o[i[h]]=a:o[~h]=a}for(;r=0?u[i[l]]=c:u[~l]=c}}(s[7],o,s[2]),function(t){for(var e=t[5],i=t[2],n=t[1],r=t[8],s=t[9],o=t[10],a=0;a=0?i[u]:~u,s[a]=u);var c=o[a];"number"==typeof c&&(o[a]=n[c])}}(s),n=o[a]}else n=function(t,e,i){var n,r=(i=i||{}).classFinder||ee,s=i.createAssetRefs||Fo.platform===lo.EDITOR_CORE,o=i.customEnv,a=i.ignoreEditorOnly,h=null!==(n=i.reportMissingClass)&&void 0!==n?n:m.deserialize.reportMissingClass;e.init();var u=zp.pool.get(e,r,h,o,a);m.game._isCloning=!0;var c=u.deserialize(t);return m.game._isCloning=!1,zp.pool.put(u),s&&e.assignAssetsBy((function(t,e){return EditorExtends.serialize.asAsset(t,e.type)})),c}(t,e,i);return r&&jp.pool.put(e),n}$p[0]=function(t,e,i,n){e[i]=n},$p[1]=qp,$p[2]=Qp(qp),$p[3]=Qp(Zp),$p[4]=Jp,$p[5]=function(t,e,i,n){var r=n[0],s=e[i];(0,Xp[r])(s,n)},$p[6]=Zp,$p[7]=function(t,e,i,n){e[i].set(n)},$p[8]=function(t,e,i,n){var r=n[0],s=new Vp[r];(0,Xp[r])(s,n),e[i]=s},$p[9]=Qp(Jp),$p[10]=function(t,e,i,n){var r=t[3][n[0]];e[i]=Kp(t,r,n[1])},$p[11]=function(t,e,i,n){var r=n[0];e[i]=r;for(var s=1;s>e,r.texExtent.height=this._textureHeight>>e,r.texSubres.mipLevel=e,r.texSubres.baseArrayLayer=i,ArrayBuffer.isView(t)?n.copyBuffersToTexture([t],this._gfxTexture,fg):n.copyTexImagesToTexture([t],this._gfxTexture,fg)}}},i._assignImage=function(t,e,i){var n=t.data;if(n&&(this.uploadData(n,e,i),this._checkTextureLoaded(),Ie.CLEANUP_IMAGE_CACHE)){var r=dg.getDeps(this._uuid),s=r.indexOf(t._uuid);-1!==s&&(he(r,s),t.decRef())}},i._checkTextureLoaded=function(){this._textureReady()},i._textureReady=function(){this.loaded=!0,this.emit("load")},i._setMipmapLevel=function(t){this._mipmapLevel=t<1?1:t},i._setMipRange=function(t,e){this._baseLevel=t<1?0:t,this._maxLevel=e<1?0:e},i.setMipRange=function(t,e){tt(t<=e,3124),this._setMipRange(t,e);var i=this._getGFXDevice();if(i){var n=this._createTextureView(i);this._tryDestroyTextureView(),this._gfxTextureView=n}},i._getGfxTextureCreateInfo=function(){return null},i._getGfxTextureViewCreateInfo=function(){return null},i._tryReset=function(){if(this._tryDestroyTextureView(),this._tryDestroyTexture(),0!==this._mipmapLevel){var t=this._getGFXDevice();t&&(this._createTexture(t),this._gfxTextureView=this._createTextureView(t))}},i.isUsingOfflineMipmaps=function(){return!1},i._createTexture=function(t){if(0!==this._width&&0!==this._height){var e=bl.NONE;this._mipFilter!==Nf.NONE&&function(t,e,i){return!(t.gfxAPI===_l.WEBGL)||pg(e)&&pg(i)}(t,this._width,this._height)&&(this._mipmapLevel=function(t,e){for(var i=Math.max(t,e),n=0;i;)i>>=1,n++;return n}(this._width,this._height),this.isUsingOfflineMipmaps()||this.isCompressed||(e=bl.GEN_MIPMAP));var i=this._getGfxTextureCreateInfo({usage:Al.SAMPLED|Al.TRANSFER_DST|Al.COLOR_ATTACHMENT,format:this._getGFXFormat(),levelCount:this._mipmapLevel,flags:e});if(i){var n=t.createTexture(i);this._textureWidth=i.width,this._textureHeight=i.height,this._gfxTexture=n}}},i._createTextureView=function(t){if(!this._gfxTexture)return null;var e=this._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=Pf.RGBA8888),void 0===n&&(n=1),void 0===r&&(r=0),void 0===s&&(s=1e3),this.reset({width:t,height:e,format:i,mipmapLevel:n,baseLevel:r,maxLevel:s})},i.toString=function(){return 0!==this._mipmaps.length?this._mipmaps[0].url:""},i.updateMipmaps=function(t,e){if(void 0===t&&(t=0),void 0===e&&(e=void 0),!(t>=this._generatedMipmaps.length))for(var i=Math.min(void 0===e?this._generatedMipmaps.length:e,this._generatedMipmaps.length-t),n=0;n"},i.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+a+2>this._nextY&&(this._nextY=this._y+a+2),this._nextY>this._height)return null;m.internal.dynamicAtlasManager.textureBleeding&&((o<=8||a<=8)&&(this._texture.drawTextureAt(i.image,this._x-1,this._y-1),this._texture.drawTextureAt(i.image,this._x-1,this._y+1),this._texture.drawTextureAt(i.image,this._x+1,this._y-1),this._texture.drawTextureAt(i.image,this._x+1,this._y+1)),this._texture.drawTextureAt(i.image,this._x-1,this._y),this._texture.drawTextureAt(i.image,this._x+1,this._y),this._texture.drawTextureAt(i.image,this._x,this._y-1),this._texture.drawTextureAt(i.image,this._x,this._y+1)),this._texture.drawTextureAt(i.image,this._x,this._y),this._innerTextureInfos[i.getId()]={x:this._x,y:this._y,texture:i},this._count++,r+=this._x,s+=this._y,this._x+=o+2}var h={x:r,y:s,texture:this._texture};return this._innerSpriteFrames.push(t),h},e.removeSpriteFrame=function(t){ce(this._innerSpriteFrames,t)},e.deleteInnerTexture=function(t){t&&this._innerTextureInfos[t.getId()]&&(delete this._innerTextureInfos[t.getId()],this._count--)},e.isEmpty=function(){return this._count<=0},e.reset=function(){this._x=2,this._y=2,this._nextY=2;for(var t=this._innerSpriteFrames,e=0,i=t.length;e19||i<0)q(16365);else{var n=1<19||e<0)q(16366);else{var i=1<31||e<0?(q(16368),""):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?Z(1640,this.name,this.uuid):this._scene=this._parent._scene},e.attr=function(t){Ht(this,t)},e.getParent=function(){return this._parent},e.modifyParent=function(t){this._parent=t},e.setParent=function(t,e){if(void 0===e&&(e=!1),e&&this.updateWorldTransform(),this._parent!==t){var i=this._parent,n=t;if(this._parent=n,this._siblingIndex=0,this._onSetParent(i,e),this.emit&&this.emit(Dg.PARENT_CHANGED,i),i&&!(i._objFlags&qg)){var r=i._children.indexOf(this);i._children.splice(r,1),i._updateSiblingIndex(),i.emit&&i.emit(Dg.CHILD_REMOVED,this)}n&&(n._children.push(this),this._siblingIndex=n._children.length-1,n.emit&&n.emit(Dg.CHILD_ADDED,this)),this._onHierarchyChanged(i)}},e.getChildByUuid=function(t){if(!t)return B("Invalid uuid"),null;for(var e=this._children,i=0,n=e.length;i0?(h=s,r=s._children,o=0,a[n]=r[o],n++):(a[n]=s,n++,u=!0);a.length=0,i._stackId--},e.removeFromParent=function(){this._parent&&this._parent.removeChild(this)},e.removeChild=function(t){this._children.indexOf(t)>-1&&(t.parent=null)},e.removeAllChildren=function(){for(var t=this._children,e=t.length-1;e>=0;e--){var i=t[e];i&&(i.parent=null)}this._children.length=0},e.isChildOf=function(t){var e=this;do{if(e===t)return!0;e=e._parent}while(e);return!1},e.getComponent=function(t){var e=$g(t);return e?i._findComponent(this,e):null},e.getComponents=function(t){var e=$g(t),n=[];return e&&i._findComponents(this,e,n),n},e.getComponentInChildren=function(t){var e=$g(t);return e?i._findChildComponent(this._children,e):null},e.getComponentsInChildren=function(t){var e=$g(t),n=[];return e&&(i._findComponents(this,e,n),i._findChildComponents(this._children,e,n)),n},e.addComponent=function(t){var e;if("string"==typeof t){if(!(e=ie(t)))throw m._RF.peek()&&Z(3808,t),TypeError(et(3807,t))}else{if(!t)throw TypeError(et(3804));e=t}if("function"!=typeof e)throw TypeError(et(3809));if(!Wt(e,m.Component))throw TypeError(et(3810));var i=e._requireComponent;if(i)if(Array.isArray(i))for(var n=0;n=0;){if(o=(e=mm[n--]).hasChangedFlags,e.isValid&&(e._transformFlags&o&t)!==t)for(e._transformFlags|=t,e.hasChangedFlags=o|t,s=(i=e._children).length,r=0;r=0;)_n.transformInverseRTS(t,t,i._lrot,i._lpos,i._lscale),i=mm[--n];return t},e.setWorldPosition=function(t,e,i){var n=this._pos,r=this._parent&&(this._transformFlags&Ig.POSITION)!==Ig.NONE;if(void 0===e){if(!r&&n.equals(t))return;_n.copy(n,t)}else{if(_n.set(um,t,e,i),!r&&n.equals(um))return;_n.copy(n,um)}var s=this._parent,o=this._lpos;s?(s.updateWorldTransform(),_n.transformMat4(o,n,Ln.invert(pm,s._mat))):_n.copy(o,n),this.invalidateChildren(Ig.POSITION),1&this._eventMask&&this.emit(Dg.TRANSFORM_CHANGED,Ig.POSITION)},e.getWorldPosition=function(t){return this.updateWorldTransform(),t?_n.copy(t,this._pos):_n.copy(new _n,this._pos)},e.setWorldRotation=function(t,e,i,n){var r=this._rot,s=this._parent&&(this._transformFlags&Ig.ROTATION)!==Ig.NONE;if(void 0===e){if(!s&&r.equals(t))return;Rn.copy(r,t)}else{if(Rn.set(lm,t,e,i,n),!s&&r.equals(lm))return;Rn.copy(r,lm)}this._parent?(this._parent.updateWorldTransform(),Rn.multiply(this._lrot,Rn.conjugate(this._lrot,this._parent._rot),r)):Rn.copy(this._lrot,r),this._eulerDirty=!0,this.invalidateChildren(Ig.ROTATION),1&this._eventMask&&this.emit(Dg.TRANSFORM_CHANGED,Ig.ROTATION)},e.setWorldRotationFromEuler=function(t,e,i){Rn.fromEuler(lm,t,e,i),this.setWorldRotation(lm)},e.getWorldRotation=function(t){return this.updateWorldTransform(),t?Rn.copy(t,this._rot):Rn.copy(new Rn,this._rot)},e.setWorldScale=function(t,e,i){var n=this._scale,r=this._parent&&(this._transformFlags&Ig.SCALE)!==Ig.NONE,s=this._parent;if(s&&this.updateWorldTransform(),void 0===e){if(!r&&n.equals(t))return;_n.copy(n,t)}else{if(_n.set(um,t,e,i),!r&&n.equals(um))return;_n.copy(n,um)}s?(um.x=n.x/_n.set(cm,this._mat.m00,this._mat.m01,this._mat.m02).length(),um.y=n.y/_n.set(cm,this._mat.m04,this._mat.m05,this._mat.m06).length(),um.z=n.z/_n.set(cm,this._mat.m08,this._mat.m09,this._mat.m10).length(),Ln.scale(pm,this._mat,um),Ln.multiply(gm,Ln.invert(gm,s._mat),pm),Sn.fromQuat(fm,Rn.conjugate(dm,this._lrot)),Sn.multiplyMat4(fm,fm,gm),this._lscale.x=_n.set(um,fm.m00,fm.m01,fm.m02).length(),this._lscale.y=_n.set(um,fm.m03,fm.m04,fm.m05).length(),this._lscale.z=_n.set(um,fm.m06,fm.m07,fm.m08).length()):_n.copy(this._lscale,n),this.invalidateChildren(Ig.SCALE),1&this._eventMask&&this.emit(Dg.TRANSFORM_CHANGED,Ig.SCALE)},e.getWorldScale=function(t){return this.updateWorldTransform(),t?_n.copy(t,this._scale):_n.copy(new _n,this._scale)},e.getWorldMatrix=function(t){this.updateWorldTransform();var e=t||new Ln;return Ln.copy(e,this._mat)},e.getWorldRS=function(t){this.updateWorldTransform();var e=t||new Ln;return Ln.copy(e,this._mat),e.m12=0,e.m13=0,e.m14=0,e},e.getWorldRT=function(t){this.updateWorldTransform();var e=t||new Ln;return Ln.fromRT(e,this._rot,this._pos)},e.setRTS=function(t,e,i){var n=0;t&&(n|=Ig.ROTATION,void 0!==t.w?(Rn.copy(this._lrot,t),this._eulerDirty=!0):(_n.copy(this._euler,t),Rn.fromEuler(this._lrot,t.x,t.y,t.z),this._eulerDirty=!1)),e&&(_n.copy(this._lpos,e),n|=Ig.POSITION),i&&(_n.copy(this._lscale,i),n|=Ig.SCALE),n&&(this.invalidateChildren(n),1&this._eventMask&&this.emit(Dg.TRANSFORM_CHANGED,n))},e.isTransformDirty=function(){return this._transformFlags!==Ig.NONE},e.pauseSystemEvents=function(t){this._eventProcessor.setEnabled(!1,t)},e.resumeSystemEvents=function(t){this._eventProcessor.setEnabled(!0,t)},i.resetHasChangedFlags=function(){ym+=1},i.clearNodeArray=function(){i.ClearFrame0},set:function(t){t?this._objFlags|=Qg:this._objFlags&=~Qg}},{key:"name",get:function(){return this._name},set:function(t){this._name=t}},{key:"uuid",get:function(){return this._id}},{key:"children",get:function(){return this._children}},{key:"active",get:function(){return this._active},set:function(t){if(t=!!t,this._active!==t){this._active=t;var e=this._parent;e&&e._activeInHierarchy&&m.director._nodeActivator.activateNode(this,t)}}},{key:"activeInHierarchy",get:function(){return this._activeInHierarchy}},{key:"parent",get:function(){return this._parent},set:function(t){this.setParent(t)}},{key:"scene",get:function(){return this._scene}},{key:"eventProcessor",get:function(){return this._eventProcessor}},{key:"prefab",get:function(){return this._prefab}},{key:"id",set:function(t){this._id=t}},{key:"siblingIndex",get:function(){return this._siblingIndex},set:function(t){this._siblingIndex=t}},{key:"position",get:function(){return this._lpos},set:function(t){this.setPosition(t)}},{key:"worldPosition",get:function(){return this.updateWorldTransform(),this._pos},set:function(t){this.setWorldPosition(t)}},{key:"rotation",get:function(){return this._lrot},set:function(t){this.setRotation(t)}},{key:"eulerAngles",get:function(){return this._eulerDirty&&(Rn.toEuler(this._euler,this._lrot),this._eulerDirty=!1),this._euler},set:function(t){this.setRotationFromEuler(t.x,t.y,t.z)}},{key:"angle",get:function(){return this.eulerAngles.z},set:function(t){this._euler.equals(um.set(0,0,t))||(_n.set(this._euler,0,0,t),Rn.fromAngleZ(this._lrot,t),this._eulerDirty=!1,this.invalidateChildren(Ig.ROTATION),1&this._eventMask&&this.emit(Dg.TRANSFORM_CHANGED,Ig.ROTATION))}},{key:"worldRotation",get:function(){return this.updateWorldTransform(),this._rot},set:function(t){this.setWorldRotation(t)}},{key:"scale",get:function(){return this._lscale},set:function(t){this.setScale(t)}},{key:"worldScale",get:function(){return this.updateWorldTransform(),this._scale},set:function(t){this.setWorldScale(t)}},{key:"matrix",set:function(t){Ln.toRTS(t,this._lrot,this._lpos,this._lscale),this.invalidateChildren(Ig.TRS),this._eulerDirty=!0,1&this._eventMask&&this.emit(Dg.TRANSFORM_CHANGED,Ig.TRS)}},{key:"worldMatrix",get:function(){return this.updateWorldTransform(),this._mat}},{key:"forward",get:function(){return _n.transformQuat(new _n,_n.FORWARD,this.worldRotation)},set:function(t){var e=t.length();_n.multiplyScalar(um,t,-1/e),Rn.fromViewUp(lm,um),this.setWorldRotation(lm)}},{key:"up",get:function(){return _n.transformQuat(new _n,_n.UP,this.worldRotation)}},{key:"right",get:function(){return _n.transformQuat(new _n,_n.RIGHT,this.worldRotation)}},{key:"mobility",get:function(){return this._mobility},set:function(t){this._mobility!==t&&(this._mobility=t,this.emit(Dg.MOBILITY_CHANGED))}},{key:"layer",get:function(){return this._layer},set:function(t){this._layer!==t&&(this._layer=t,this._uiProps&&this._uiProps.uiComp&&(this._uiProps.uiComp.setNodeDirty(),this._uiProps.uiComp.markForUpdateRenderData()),this.emit(Dg.LAYER_CHANGED,this._layer))}},{key:"flagChangedVersion",get:function(){return this._flagChangeVersion}},{key:"hasChangedFlags",get:function(){return this._flagChangeVersion===ym?this._hasChangedFlags:0},set:function(t){this._flagChangeVersion=ym,this._hasChangedFlags=t}}]),i}(qs)).idGenerator=Jg,Yg._stacks=[[]],Yg._stackId=0,Yg.EventType=Dg,Yg.NodeSpace=wg,Yg.TransformDirtyBit=Ig,Yg.TransformBit=Ig,Yg.reserveContentsForAllSyncablePrefabTag=vm,Yg.ClearFrame=0,Yg.ClearRound=1e3,f((Lg=Yg).prototype,"_persistNode",[Sa],Object.getOwnPropertyDescriptor(Lg.prototype,"_persistNode"),Lg.prototype),Bg=ua(Lg.prototype,"_parent",[wa],(function(){return null})),Fg=ua(Lg.prototype,"_children",[wa],(function(){return[]})),kg=ua(Lg.prototype,"_active",[wa],(function(){return!0})),Ug=ua(Lg.prototype,"_components",[wa],(function(){return[]})),Gg=ua(Lg.prototype,"_prefab",[wa],(function(){return null})),Hg=ua(Lg.prototype,"_lpos",[wa],(function(){return new _n})),zg=ua(Lg.prototype,"_lrot",[wa],(function(){return new Rn})),Vg=ua(Lg.prototype,"_lscale",[wa],(function(){return new _n(1,1,1)})),Wg=ua(Lg.prototype,"_mobility",[wa],(function(){return Kg.Static})),Xg=ua(Lg.prototype,"_layer",[wa],(function(){return Rg.Enum.DEFAULT})),jg=ua(Lg.prototype,"_euler",[wa],(function(){return new _n})),f(Lg.prototype,"eulerAngles",[Pg],Object.getOwnPropertyDescriptor(Lg.prototype,"eulerAngles"),Lg.prototype),f(Lg.prototype,"mobility",[Mg],Object.getOwnPropertyDescriptor(Lg.prototype,"mobility"),Lg.prototype),Ng=Lg))||Ng);t({Node:Tm,BaseNode:Tm}),m.Node=Tm,function(t){t[t.right=0]="right",t[t.left=1]="left",t[t.top=2]="top",t[t.bottom=3]="bottom",t[t.front=4]="front",t[t.back=5]="back"}(am||(am={})),function(t){t[t.NONE=0]="NONE",t[t.AUTO=1]="AUTO",t[t.BAKED_CONVOLUTION_MAP=2]="BAKED_CONVOLUTION_MAP"}(hm||(hm={}));var Em=t("TextureCube",va("cc.TextureCube")(((om=function(t){function e(){var e;return(e=t.call(this)||this).isRGBE=im&&im(),e._mipmapAtlas=nm&&nm(),e._mipmapMode=rm&&rm(),e._mipmaps=sm&&sm(),e._generatedMipmaps=[],e}s(e,t);var i=e.prototype;return i._setMipmapParams=function(t){var e=this;if(this._generatedMipmaps=t,this._setMipmapLevel(this._generatedMipmaps.length),this._generatedMipmaps.length>0){var i=this._generatedMipmaps[0].front;this.reset({width:i.width,height:i.height,format:i.format,mipmapLevel:this._generatedMipmaps.length,baseLevel:this._baseLevel,maxLevel:this._maxLevel}),this._generatedMipmaps.forEach((function(t,i){Sm(t,(function(t,n){e._assignImage(t,i,n)}))}))}else this.reset({width:0,height:0,mipmapLevel:this._generatedMipmaps.length,baseLevel:this._baseLevel,maxLevel:this._maxLevel})},i.isUsingOfflineMipmaps=function(){return this._mipmapMode===hm.BAKED_CONVOLUTION_MAP},e.fromTexture2DArray=function(t,i){for(var n=[],r=t.length/6,s=0;s=this._generatedMipmaps.length))for(var n=Math.min(void 0===e?this._generatedMipmaps.length:e,this._generatedMipmaps.length-t),r=function(){var e=t+s;Sm(i._generatedMipmaps[e],(function(t,n){i._assignImage(t,e,n)}))},s=0;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)if(Fo.os!==co.IOS){var n=this._mipmapAtlas.atlas,r=this._mipmapAtlas.layout,s=r[0],o=Object.assign(y.document.createElement("canvas"),{width:i.width,height:i.height}).getContext("2d");this.reset({width:s.width,height:s.height,format:i.format,mipmapLevel:r.length});for(var a=function(){var t=r[h];Sm(n,(function(n,r){o.clearRect(0,0,i.width,i.height);var s=n.data;o.drawImage(s,0,0);var a=o.getImageData(t.left,t.top,t.width,t.height),h=new $f({_data:a.data,_compressed:n.isCompressed,width:a.width,height:a.height,format:n.format});e._assignImage(h,t.level,r)}))},h=0;h>>26},xy=function(t){return(t&Cy)>>>20},Dy=function(t){return(t&Ry)>>>12},Oy=function(t){return 4095&t},Py=function(t,e){return 67108863&t|e<<26&by},My=((fy={})[ml.UNKNOWN]=function(t,e,i){return void 0===i&&(i=0),q(12010,i)},fy[ml.INT]=function(t,e,i){return void 0===i&&(i=0),t[i]},fy[ml.INT2]=function(t,e,i){return void 0===i&&(i=0),Hn.fromArray(e,t,i)},fy[ml.INT3]=function(t,e,i){return void 0===i&&(i=0),_n.fromArray(e,t,i)},fy[ml.INT4]=function(t,e,i){return void 0===i&&(i=0),on.fromArray(e,t,i)},fy[ml.FLOAT]=function(t,e,i){return void 0===i&&(i=0),t[i]},fy[ml.FLOAT2]=function(t,e,i){return void 0===i&&(i=0),Hn.fromArray(e,t,i)},fy[ml.FLOAT3]=function(t,e,i){return void 0===i&&(i=0),_n.fromArray(e,t,i)},fy[ml.FLOAT4]=function(t,e,i){return void 0===i&&(i=0),on.fromArray(e,t,i)},fy[ml.MAT3]=function(t,e,i){return void 0===i&&(i=0),Sn.fromArray(e,t,i)},fy[ml.MAT4]=function(t,e,i){return void 0===i&&(i=0),Ln.fromArray(e,t,i)},fy),Ny=((py={})[ml.UNKNOWN]=function(t,e,i){return void 0===i&&(i=0),q(12010,i)},py[ml.INT]=function(t,e,i){return void 0===i&&(i=0),t[i]=e},py[ml.INT2]=function(t,e,i){return void 0===i&&(i=0),Hn.toArray(t,e,i)},py[ml.INT3]=function(t,e,i){return void 0===i&&(i=0),_n.toArray(t,e,i)},py[ml.INT4]=function(t,e,i){return void 0===i&&(i=0),on.toArray(t,e,i)},py[ml.FLOAT]=function(t,e,i){return void 0===i&&(i=0),t[i]=e},py[ml.FLOAT2]=function(t,e,i){return void 0===i&&(i=0),Hn.toArray(t,e,i)},py[ml.FLOAT3]=function(t,e,i){return void 0===i&&(i=0),_n.toArray(t,e,i)},py[ml.FLOAT4]=function(t,e,i){return void 0===i&&(i=0),on.toArray(t,e,i)},py[ml.MAT3]=function(t,e,i){return void 0===i&&(i=0),Sn.toArray(t,e,i)},py[ml.MAT4]=function(t,e,i){return void 0===i&&(i=0),Ln.toArray(t,e,i)},py),Ly=((gy={})[ml.INT]=function(t){return"number"==typeof t},gy[ml.FLOAT]=function(t){return"number"==typeof t},gy[ml.INT2]=function(t){return!!(t instanceof Hn)},gy[ml.FLOAT2]=function(t){return!!(t instanceof Hn)},gy[ml.INT3]=function(t){return!!(t instanceof _n)},gy[ml.FLOAT3]=function(t){return!!(t instanceof _n)},gy[ml.INT4]=function(t){return!!(t instanceof on)},gy[ml.FLOAT4]=function(t){return!!(t instanceof on||t instanceof yn||t instanceof Rn)},gy[ml.MAT3]=function(t){return!!(t instanceof Sn)},gy[ml.MAT4]=function(t){return!!(t instanceof Ln)},gy),By=[Object.freeze([0]),Object.freeze([0,0]),Object.freeze([0,0,0,0]),Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])];function Fy(t){switch(t){case ml.BOOL:case ml.INT:case ml.UINT:case ml.FLOAT:return By[0];case ml.BOOL2:case ml.INT2:case ml.UINT2:case ml.FLOAT2:return By[1];case ml.BOOL4:case ml.INT4:case ml.UINT4:case ml.FLOAT4:return By[2];case ml.MAT4:return By[3];case ml.SAMPLER2D:return"default-texture";case ml.SAMPLER_CUBE:return"default-cube-texture";case ml.SAMPLER2D_ARRAY:return"default-array-texture";case ml.SAMPLER3D:return"default-3d-texture"}return By[0]}function ky(t){switch(t){case ml.SAMPLER2D:return"-texture";case ml.SAMPLER_CUBE:return"-cube-texture";case ml.SAMPLER2D_ARRAY:return"-array-texture";case ml.SAMPLER3D:return"-3d-texture";default:return"-unknown"}}function Uy(t,e){for(var i=Object.entries(e),n=!1,r=0;r>2)*a.count}for(var h=0;h31&&(t.uber=!0),t.constantMacros="",t.builtins.statistics)t.constantMacros+="#define "+r+" "+t.builtins.statistics[r]+"\n"}function Jy(t){return Object.keys(t).reduce((function(e,i){return e.reduce((function(e,n){for(var s=t[i],o=0;o0&&this.shaders.length>0},e}(Of))._effects={},hT._layoutValid=!0,rT=ua((nT=hT).prototype,"techniques",[wa],(function(){return[]})),sT=ua(nT.prototype,"shaders",[wa],(function(){return[]})),oT=ua(nT.prototype,"combinations",[wa],(function(){return[]})),aT=ua(nT.prototype,"hideInEditor",[wa,xa],(function(){return!1})),iT=nT))||iT);m.EffectAsset=lT;var _T=function(){function t(){this.name="",this.base="",this.importBase="",this.nativeBase="",this.deps=null,this.assetInfos=new $d,this.scenes=new $d,this.paths=new $d}var e=t.prototype;return e.init=function(t){var e=this;!function(t){var e=t.uuids,i=t.paths,n=t.types,r=t.deps,s=t.paths=Object.create(null);if(!1===t.debug){for(var o=0,a=e.length;oe.length)||47===t.charCodeAt(e.length)}(r,t)||!t)for(var s=0,o=i.length;s0&&function(t){var e=Object.create(null);if(e[t._uuid]=t.refCount,gT(t,e,mT,-1),mT.length=0,0!==e[t._uuid])return e[t._uuid];for(var i in e)0!==e[i]&&gT(nf.get(i),e,mT,1);return mT.length=0,e[t._uuid]}(t)>0)){nf.remove(i);for(var n=dg.getDeps(i),r=0,s=n.length;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&&(Ue(this._handleQueue.bind(this),t,e),this._checkNextPeriod=!0)},n(e,[{key:"remoteServerAddress",get:function(){return this._remoteServerAddress}}],[{key:"instance",get:function(){return e._instance||(e._instance=new e),e._instance}}]),e}();jT._instance=void 0;var YT,KT,qT,QT,ZT,JT,$T=jT.instance,tE=jT.instance,eE=t("JsonAsset",va("cc.JsonAsset")((KT=function(t){function e(){var e;return(e=t.call(this)||this).json=qT&&qT(),e}return s(e,t),e}(Of),qT=ua(KT.prototype,"json",[wa],(function(){return null})),YT=KT))||YT);m.JsonAsset=eE;var iE,nE,rE=t("TextAsset",va("cc.TextAsset")((ZT=function(t){function e(){var e;return(e=t.call(this)||this).text=JT&&JT(),e}return s(e,t),e.prototype.toString=function(){return this.text},e}(Of),JT=ua(ZT.prototype,"text",[wa],(function(){return""})),QT=ZT))||QT);m.TextAsset=rE;var sE=t("BufferAsset",va("cc.BufferAsset")((f((nE=function(t){function e(){var e;return(e=t.call(this)||this)._buffer=null,e}s(e,t);var i=e.prototype;return i.buffer=function(){return this._buffer,this._buffer},i.validate=function(){return!!this._buffer},n(e,[{key:"_nativeAsset",get:function(){return this._buffer},set:function(t){t instanceof ArrayBuffer?this._buffer=t:this._buffer=t.buffer}}]),e}(Of)).prototype,"_nativeAsset",[hh],Object.getOwnPropertyDescriptor(nE.prototype,"_nativeAsset"),nE.prototype),iE=nE))||iE);function oE(t,e,i,n){var r=null,s=null;try{(r=new $f)._nativeUrl=t,r._nativeAsset=e}catch(t){s=t}n(s,r)}function aE(t,e,i,n){var r=new eE;r.json=e,n(null,r)}function hE(t,e,i,n){var r=new rE;r.text=e,n(null,r)}function uE(t,e,i,n){var r=new sE;r._nativeUrl=t,r._nativeAsset=e,n(null,r)}function cE(t,e,i,n){var r=new Of;r._nativeUrl=t,r._nativeAsset=e,n(null,r)}function lE(t,i,n,r){var s=of.get(i.name);s||(s=i.name===lf.RESOURCES?OT:new DT,i.base=i.base||t+"/",s.init(i)),e.import("virtual:///prerequisite-imports/"+s.name).then((function(){r(null,s)})).catch(r)}m.BufferAsset=sE;var _E=new(function(){function t(){this._creating=new $d,this._producers={".png":oE,".jpg":oE,".bmp":oE,".jpeg":oE,".gif":oE,".ico":oE,".tiff":oE,".webp":oE,".image":oE,".pvr":oE,".pkm":oE,".astc":oE,".txt":hE,".xml":hE,".vsh":hE,".fsh":hE,".atlas":hE,".tmx":hE,".tsx":hE,".fnt":hE,".json":aE,".ExportJson":aE,".binary":uE,".bin":uE,".dbbin":uE,".skel":uE,bundle:lE,default:cE}}var e=t.prototype;return e.register=function(t,e){"object"==typeof t?Ht(this._producers,t):this._producers[t]=e},e.create=function(t,e,i,n,r){var s=this,o=this._producers[i]||this._producers.default,a=nf.get(t);if(n.reloadAsset||!a){var h=this._creating.get(t);h?h.push(r):(this._creating.add(t,[r]),o(t,e,n,(function(e,i){!e&&i instanceof Of&&(i._uuid=t,bT(t,i,n.cacheAsset));for(var r=s._creating.remove(t),o=0,a=r.length;o0){var o=df.create({input:s,progress:r,options:n,onProgress:t.onProgress,onError:df.prototype.recycle,onComplete:function(n){var r;n||((r=t.output).push.apply(r,o.output),o.recycle()),i&&pE(t),e(n)}});hf.async(o)}else i&&pE(t),e()}))}function pE(t){for(var e=t.output,i=0,n=e.length;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||we.querySettings(Ce.Category.ASSETS,"importBase")||"";s&&s.endsWith("/")&&(s=s.substr(0,s.length-1));var o=t.nativeBase||we.querySettings(Ce.Category.ASSETS,"nativeBase")||"";o&&o.endsWith("/")&&(o=o.substr(0,o.length-1)),this.generalImportBase=s,this.generalNativeBase=o,this._projectBundles=we.querySettings(Ce.Category.ASSETS,"projectBundles")||[];var a=we.querySettings(Ce.Category.ASSETS,"assetsOverrides")||{};for(var h in a)this.assetsOverrideMap.set(h,a[h])},e.getBundle=function(t){return of.get(t)||null},e.removeBundle=function(t){t._destroy(),of.remove(t.name)},e.loadAny=function(t,e,i,n){var r=RT(e,i,n),s=r.options,o=r.onProgress,a=r.onComplete;s.preset=s.preset||"default",t=Array.isArray(t)?t.slice():t;var h=df.create({input:t,onProgress:o,onComplete:xT(a),options:s});af.async(h)},e.preloadAny=function(t,e,i,n){var r=RT(e,i,n),s=r.options,o=r.onProgress,a=r.onComplete;s.preset=s.preset||"preload",t=Array.isArray(t)?t.slice():t;var h=df.create({input:t,onProgress:o,onComplete:xT(a),options:s});hf.async(h)},e.loadRemote=function(t,e,i){var n=RT(e,void 0,i),r=n.options,s=n.onComplete;r.reloadAsset||!this.assets.has(t)?(r.__isNative__=!0,r.preset=r.preset||"remote",this.loadAny({url:t},r,null,(function(e,i){e?(k(e.message,e.stack),s&&s(e,i)):_E.create(t,i,r.ext||Eo(t),r,(function(t,e){s&&s(t,e)}))}))):xT(s)(null,this.assets.get(t))},e.loadBundle=function(t,e,i){var n=RT(e,void 0,i),r=n.options,s=n.onComplete,o=Ao(t);this.bundles.has(o)?xT(s)(null,this.getBundle(o)):(r.preset=r.preset||"bundle",r.ext="bundle",r.__isNative__=!0,this.loadAny({url:t},r,null,(function(e,i){e?(k(e.message,e.stack),s&&s(e,i)):_E.create(t,i,"bundle",r,(function(t,e){s&&s(t,e)}))})))},e.releaseAsset=function(t){vT.tryRelease(t,!0)},e.releaseUnusedAssets=function(){nf.forEach((function(t){vT.tryRelease(t)}))},e.releaseAll=function(){nf.forEach((function(t){vT.tryRelease(t,!0)}))},e.loadWithJson=function(){throw new Error("Only valid in Editor")},n(t,[{key:"main",get:function(){return of.get(lf.MAIN)||null}},{key:"resources",get:function(){return of.get(lf.RESOURCES)||null}}],[{key:"instance",get:function(){return this._instance||(this._instance=new t),this._instance}}]),t}());IE._instance=void 0,IE.Pipeline=tf,IE.Task=df,IE.Cache=$d,IE.RequestItem=SE,IE.Bundle=DT,IE.BuiltinBundleName=lf,IE.CacheManager=function(){this.cacheDir=void 0,this.cacheEnabled=void 0,this.autoClear=void 0,this.cacheInterval=void 0,this.deleteInterval=void 0,this.cachedFiles=void 0},IE.Downloader=jT,IE.Parser=mE,IE.DependUtil=lg;var xE=t("assetManager",m.assetManager=IE.instance);m.AssetManager=IE;var DE,OE,PE,ME=t("BuiltinResMgr",function(){function t(){this._resources={},this._materialsToBeCompiled=[]}var e=t.prototype;return e.init=function(){for(var t=this._resources,e=new Uint8Array(16),i=new Uint8Array(16),n=new Uint8Array(16),r=new Uint8Array(16),s=new Uint8Array(16),o=0,a=0;a<4;a++)e[o]=0,e[o+1]=0,e[o+2]=0,e[o+3]=255,i[o]=0,i[o+1]=0,i[o+2]=0,i[o+3]=0,n[o]=119,n[o+1]=119,n[o+2]=119,n[o+3]=255,r[o]=255,r[o+1]=255,r[o+2]=255,r[o+3]=255,s[o]=127,s[o+1]=127,s[o+2]=255,s[o+3]=255,o+=4;var h=new Uint8Array(1024);o=0;for(var u=0;u<256;u++)h[o]=221,h[o+1]=221,h[o+2]=221,h[o+3]=255,o+=4;o=0;for(var c=0;c<8;c++){for(var l=0;l<8;l++)h[o]=85,h[o+1]=85,h[o+2]=85,h[o+3]=255,o+=4;o+=32}o+=32;for(var _=0;_<8;_++){for(var d=0;d<8;d++)h[o]=85,h[o+1]=85,h[o+2]=85,h[o+3]=255,o+=4;o+=32}var f={width:2,height:2,_data:e,_compressed:!1,format:Sg.PixelFormat.RGBA8888},p={width:2,height:2,_data:i,_compressed:!1,format:Sg.PixelFormat.RGBA8888},g={width:2,height:2,_data:n,_compressed:!1,format:Sg.PixelFormat.RGBA8888},v={width:2,height:2,_data:r,_compressed:!1,format:Sg.PixelFormat.RGBA8888},y={width:2,height:2,_data:s,_compressed:!1,format:Sg.PixelFormat.RGBA8888},T={width:16,height:16,_data:h,_compressed:!1,format:Sg.PixelFormat.RGBA8888},E=new $f(f),S=new Sg;S._uuid="black-texture",S.image=E,t[S._uuid]=S;var A=new $f(p),b=new Sg;b._uuid="empty-texture",b.image=A,t[b._uuid]=b;var C=new Em;C._uuid="black-cube-texture",C.setMipFilter(Em.Filter.NEAREST),C.image={front:new $f(f),back:new $f(f),left:new $f(f),right:new $f(f),top:new $f(f),bottom:new $f(f)},t[C._uuid]=C;var R=new $f(g),w=new Sg;w._uuid="grey-texture",w.image=R,t[w._uuid]=w;var I=new Em;I._uuid="grey-cube-texture",I.setMipFilter(Em.Filter.NEAREST),I.image={front:new $f(g),back:new $f(g),left:new $f(g),right:new $f(g),top:new $f(g),bottom:new $f(g)},t[I._uuid]=I;var x=new $f(v),D=new Sg;D._uuid="white-texture",D.image=x,t[D._uuid]=D;var O=new Em;O._uuid="white-cube-texture",O.setMipFilter(Em.Filter.NEAREST),O.image={front:new $f(v),back:new $f(v),left:new $f(v),right:new $f(v),top:new $f(v),bottom:new $f(v)},t[O._uuid]=O;var P=new $f(y),M=new Sg;M._uuid="normal-texture",M.image=P,t[M._uuid]=M;var N=new $f(T),L=new Sg;L._uuid="default-texture",L.image=N,t[L._uuid]=L;var B=new Em;if(B.setMipFilter(Em.Filter.NEAREST),B._uuid="default-cube-texture",B.image={front:new $f(T),back:new $f(T),left:new $f(T),right:new $f(T),top:new $f(T),bottom:new $f(T)},t[B._uuid]=B,m.SpriteFrame){var F=new m.SpriteFrame,k=E,U=new Sg;U.image=k,F.texture=U,F._uuid="default-spriteframe",t[F._uuid]=F}},e.addAsset=function(t,e){this._resources[t]=e},e.get=function(t){return this._resources[t]},e.loadBuiltinAssets=function(){var t=this,e=we.querySettings(Ce.Category.ENGINE,"builtinAssets");if(!e)return Promise.resolve();var i=this._resources;return new Promise((function(n,r){xE.loadBundle(lf.INTERNAL,(function(s){s?r(s):xE.loadAny(e,(function(e,s){e?r(e):(s.forEach((function(e){i[e.name]=e,vT.addIgnoredAsset(e),e instanceof m.Material&&t._materialsToBeCompiled.push(e)})),n())}))}))}))},e.compileBuiltinMaterial=function(){for(var t=0;t=1024)&&g.lightingMap.objectID===o.objectID&&g.useReflectionProbeType===c&&g.reflectionProbeCubemap.objectID===a.objectID&&g.reflectionProbePlanarMap.objectID===h.objectID&&g.reflectionProbeBlendCubemap.objectID===u.objectID&&g.stride===r){if(g.count>=g.capacity){g.capacity<<=1;var m=g.stride*g.capacity,v=g.data;g.data=new Uint8Array(m),g.data.set(v),g.vb.resize(m)}return g.shader=l,g.descriptorSet=_,g.data.set(n.buffer,g.stride*g.count++),void(this.hasPendingModels=!0)}}for(var y=this._device.createBuffer(new v_(vl.VERTEX|vl.TRANSFER_DST,El.HOST|El.DEVICE,32*r,r)),T=new Uint8Array(32*r),E=s.vertexBuffers.slice(),S=s.attributes.slice(),A=s.indexBuffer,b=0;b>2,o=this._getBlockView(r,n),a=t.getOffsetFromHandle(e),h=0;h>2)*o,l=0;l+u.length<=c;l+=u.length)a.set(u,s+l);this._rootBufferDirty=!0}},e.resetTexture=function(e,i){var n=this.getHandle(e);if(n){var r,s=t.getTypeFromHandle(n),o=t.getBindingFromHandle(n),a=this._properties[e],h=a&&a.value,u=(r="string"==typeof h?NE.get(""+h+ky(s)):h||NE.get(Fy(s)))&&r.getGFXTexture(),c=a&&void 0!==a.samplerHash?Fd.unpackFromHash(a.samplerHash):r&&r.getSamplerInfo(),l=this._device.getSampler(c);this._descriptorSet.bindSampler(o,l,i||0),this._descriptorSet.bindTexture(o,u,i||0)}},e.resetUBOs=function(){for(var t=0;t>2)*r.count,u=0;u+a.length<=h;u+=a.length)s.set(a,i+u);i+=h}this._rootBufferDirty=!0},e.resetTextures=function(){if(m.rendering)for(var t,e=d(this._shaderInfo.descriptors[jm.MATERIAL].samplerTextures);!(t=e()).done;)for(var i=t.value,n=0;n=this._passes.length&&q(16372,i);var h=this._passes[i];this._uploadProperty(h,t,e)&&(this._props[h.propertyIndex][t]=e,n=!0)}n||q(16373,t)},i.getProperty=function(t,e){if(void 0===e)for(var i=this._props,n=i.length,r=0;r=this._passes.length)return q(16372,e),null;var o=this._props[this._passes[e].propertyIndex];if(t in o)return o[t]}return null},i.copy=function(t,e){this._techIdx=t._techIdx,this._props.length=t._props.length;for(var i=0;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}(Of),XE=ua(WE.prototype,"_effectAsset",[zE],(function(){return null})),jE=ua(WE.prototype,"_techIdx",[wa],(function(){return 0})),YE=ua(WE.prototype,"_defines",[wa],(function(){return[]})),KE=ua(WE.prototype,"_states",[wa],(function(){return[]})),qE=ua(WE.prototype,"_props",[wa],(function(){return[]})),VE=WE))||VE));m.Material=$E;var tS=ye({Low_256x256:256,Medium_512x512:512,High_1024x1024:1024,Ultra_2048x2048:2048}),eS=ye({Planar:0,ShadowMap:1}),iS=ye({HARD:0,SOFT:1,SOFT_2X:2,SOFT_4X:3}),nS=ye({LEVEL_1:1,LEVEL_2:2,LEVEL_3:3,LEVEL_4:4}),rS=ye({NONE:1,RemoveDuplicates:2,DisableRotationFix:3}),sS=eS.ShadowMap+1,oS=function(){function t(){this.fixedSphere=new Ar(0,0,0,.01),this.maxReceived=4,this._matLight=new Ln,this._material=null,this._instancingMaterial=null,this._enabled=!1,this._type=sS,this._distance=0,this._planeBias=1,this._normal=new _n(0,1,0),this._shadowColor=new yn(0,0,0,76),this._size=new Hn(1024,1024),this._shadowMapDirty=!1}var e=t.prototype;return e.getPlanarShader=function(t){this._material||(this._material=new $E,this._material.initialize({effectName:"pipeline/planar-shadow"}));var e=this._material.passes;return e.length>0?e[0].getShaderVariant(t):null},e.initialize=function(t){this._enabled=t.enabled,this._type=this.enabled?t.type:sS,this.normal=t.planeDirection,this.distance=t.planeHeight,this.planeBias=t.planeBias,this.shadowColor=t.shadowColor,this.maxReceived=t.maxReceived,t.shadowMapSize!==this._size.x&&(this.size.set(t.shadowMapSize,t.shadowMapSize),this._shadowMapDirty=!0)},e.activate=function(){if(this._enabled)if(this.type===eS.Planar)this._updatePlanarInfo();else{var t=m.director.root;t.pipeline.macros.CC_SHADOW_TYPE=2,t.onGlobalPipelineStateChanged()}else{var e=m.director.root;e.pipeline.macros.CC_SHADOW_TYPE=0,e.onGlobalPipelineStateChanged()}},e._updatePlanarInfo=function(){this._material||(this._material=new $E,this._material.initialize({effectName:"pipeline/planar-shadow"}));var t=m.director.root;t.pipeline.macros.CC_SHADOW_TYPE=1,t.onGlobalPipelineStateChanged()},e.destroy=function(){this._material&&this._material.destroy(),this._instancingMaterial&&this._instancingMaterial.destroy(),this.fixedSphere.destroy()},n(t,[{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled=t,this.activate()}},{key:"type",get:function(){return this._type},set:function(t){this._type=this.enabled?t:sS,this.activate()}},{key:"normal",get:function(){return this._normal},set:function(t){_n.copy(this._normal,t)}},{key:"distance",get:function(){return this._distance},set:function(t){this._distance=t}},{key:"planeBias",get:function(){return this._planeBias},set:function(t){this._planeBias=t}},{key:"shadowColor",get:function(){return this._shadowColor},set:function(t){this._shadowColor=t}},{key:"size",get:function(){return this._size},set:function(t){this._size.set(t)}},{key:"shadowMapDirty",get:function(){return this._shadowMapDirty},set:function(t){this._shadowMapDirty=t}},{key:"matLight",get:function(){return this._matLight}},{key:"material",get:function(){return this._material}},{key:"instancingMaterial",get:function(){return this._instancingMaterial}}]),t}();oS.MAX_FAR=2e3,oS.COEFFICIENT_OF_EXPANSION=2*Math.sqrt(3),m.Shadows=oS;var aS=function(t){function e(e,i){var n;(n=t.call(this,e.root)||this)._dontNotify=!1,n._parent=e,n._owner=i,n._doInit(n._parent,!0);for(var r=0;r0)for(var h=0;h=0&&s.node.getWritableComponents().splice(o,1)}}}function NR(t,e,i){if(!(e.length<=0))for(var n=null,r=0;r0){var h=a.pop();if(!h)continue;for(var u=0;u0){var m=p.pop();if(!m)return;for(var v=0;v=200?"normal":t>=60?"ui":"game",this._isStarted&&(this.stop(),this.start())},e.on=function(t,e,i){this._eventTarget.on(t,e,i)},t}(),uw=function(){},cw=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.getValue=function(){throw new Error("Method not implemented.")},e}(uw),lw=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.getValue=function(){throw new Error("Method not implemented.")},e}(uw),_w=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.getValue=function(){throw new Error("Method not implemented.")},e}(uw),dw=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.getValue=function(){throw new Error("Method not implemented.")},e}(uw),fw=function(t){function e(e){var i;return(i=t.call(this)||this).positive=e.positive,i.negative=e.negative,i}return s(e,t),e.prototype.getValue=function(){var t=this.positive.getValue(),e=this.negative.getValue();return Math.abs(t)>Math.abs(e)?t:-e},e}(cw),pw=function(t){function e(e){var i;return(i=t.call(this)||this).up=e.up,i.down=e.down,i.left=e.left,i.right=e.right,i.xAxis=new fw({positive:i.right,negative:i.left}),i.yAxis=new fw({positive:i.up,negative:i.down}),i}return s(e,t),e.prototype.getValue=function(){return new Hn(this.xAxis.getValue(),this.yAxis.getValue())},e}(lw);!function(t){function e(e){var i;return(i=t.call(this)||this).up=e.up,i.down=e.down,i.left=e.left,i.right=e.right,i.forward=e.forward,i.backward=e.backward,i.xAxis=new fw({positive:i.right,negative:i.left}),i.yAxis=new fw({positive:i.up,negative:i.down}),i.zAxis=new fw({positive:i.forward,negative:i.backward}),i}s(e,t),e.prototype.getValue=function(){return new _n(this.xAxis.getValue(),this.yAxis.getValue(),this.zAxis.getValue())}}(_w);var gw=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.getValue=function(){return t.prototype.getValue.call(this)},e}(cw),mw=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(pw),vw=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(pw),yw=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.getValue=function(){return t.prototype.getValue.call(this)},e}(dw),Tw=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.getValue=function(){return t.prototype.getValue.call(this)},e}(_w),Ew=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.getValue=function(){return t.prototype.getValue.call(this)},e}(cw),Sw=function(){function t(t){this._deviceId=-1,this._connected=!1,this._deviceId=t,this._initInputSource()}return t._init=function(){},t._on=function(e,i,n){t._eventTarget.on(e,i,n)},t.prototype._initInputSource=function(){this._buttonNorth=new gw,this._buttonNorth.getValue=function(){return 0},this._buttonEast=new gw,this._buttonEast.getValue=function(){return 0},this._buttonWest=new gw,this._buttonWest.getValue=function(){return 0},this._buttonSouth=new gw,this._buttonSouth.getValue=function(){return 0},this._buttonL1=new gw,this._buttonL1.getValue=function(){return 0},this._buttonL2=new gw,this._buttonL2.getValue=function(){return 0},this._buttonL3=new gw,this._buttonL3.getValue=function(){return 0},this._buttonR1=new gw,this._buttonR1.getValue=function(){return 0},this._buttonR2=new gw,this._buttonR2.getValue=function(){return 0},this._buttonR3=new gw,this._buttonR3.getValue=function(){return 0},this._buttonShare=new gw,this._buttonShare.getValue=function(){return 0},this._buttonOptions=new gw,this._buttonOptions.getValue=function(){return 0};var t=new gw;t.getValue=function(){return 0};var e=new gw;e.getValue=function(){return 0};var i=new gw;i.getValue=function(){return 0};var n=new gw;n.getValue=function(){return 0},this._dpad=new mw({up:t,down:e,left:i,right:n});var r=new gw;r.getValue=function(){return 0};var s=new gw;s.getValue=function(){return 0};var o=new gw;o.getValue=function(){return 0};var a=new gw;a.getValue=function(){return 0},this._leftStick=new vw({up:r,down:s,left:o,right:a});var h=new gw;h.getValue=function(){return 0};var u=new gw;u.getValue=function(){return 0};var c=new gw;c.getValue=function(){return 0};var l=new gw;l.getValue=function(){return 0},this._rightStick=new vw({up:h,down:u,left:c,right:l}),this._buttonStart=new gw,this._buttonStart.getValue=function(){return 0},this._gripLeft=new gw,this._gripLeft.getValue=function(){return 0},this._gripRight=new gw,this._gripRight.getValue=function(){return 0},this._handLeftPosition=new Tw,this._handLeftPosition.getValue=function(){return _n.ZERO},this._handLeftOrientation=new yw,this._handLeftOrientation.getValue=function(){return Rn.IDENTITY},this._handRightPosition=new Tw,this._handRightPosition.getValue=function(){return _n.ZERO},this._handRightOrientation=new yw,this._handRightOrientation.getValue=function(){return Rn.IDENTITY},this._aimLeftPosition=new Tw,this._aimLeftPosition.getValue=function(){return _n.ZERO},this._aimLeftOrientation=new yw,this._aimLeftOrientation.getValue=function(){return Rn.IDENTITY},this._aimRightPosition=new Tw,this._aimRightPosition.getValue=function(){return _n.ZERO},this._aimRightOrientation=new yw,this._aimRightOrientation.getValue=function(){return Rn.IDENTITY}},n(t,[{key:"buttonNorth",get:function(){return this._buttonNorth}},{key:"buttonEast",get:function(){return this._buttonEast}},{key:"buttonWest",get:function(){return this._buttonWest}},{key:"buttonSouth",get:function(){return this._buttonSouth}},{key:"buttonL1",get:function(){return this._buttonL1}},{key:"buttonL2",get:function(){return this._buttonL2}},{key:"buttonL3",get:function(){return this._buttonL3}},{key:"buttonR1",get:function(){return this._buttonR1}},{key:"buttonR2",get:function(){return this._buttonR2}},{key:"buttonR3",get:function(){return this._buttonR3}},{key:"buttonShare",get:function(){return this._buttonShare}},{key:"buttonOptions",get:function(){return this._buttonOptions}},{key:"dpad",get:function(){return this._dpad}},{key:"leftStick",get:function(){return this._leftStick}},{key:"rightStick",get:function(){return this._rightStick}},{key:"buttonStart",get:function(){return this._buttonStart}},{key:"gripLeft",get:function(){return this._gripLeft}},{key:"gripRight",get:function(){return this._gripRight}},{key:"handLeftPosition",get:function(){return this._handLeftPosition}},{key:"handLeftOrientation",get:function(){return this._handLeftOrientation}},{key:"handRightPosition",get:function(){return this._handRightPosition}},{key:"handRightOrientation",get:function(){return this._handRightOrientation}},{key:"aimLeftPosition",get:function(){return this._aimLeftPosition}},{key:"aimLeftOrientation",get:function(){return this._aimLeftOrientation}},{key:"aimRightPosition",get:function(){return this._aimRightPosition}},{key:"aimRightOrientation",get:function(){return this._aimRightOrientation}},{key:"deviceId",get:function(){return this._deviceId}},{key:"connected",get:function(){return this._connected}}]),t}();Sw.all=[],Sw.xr=null,Sw._eventTarget=new oo;var Aw=function(){function t(){this._eventTarget=new oo,this._initInputSource()}var e=t.prototype;return e._on=function(t,e,i){this._eventTarget.on(t,e,i)},e._initInputSource=function(){this._buttonNorth=new gw,this._buttonNorth.getValue=function(){return 0},this._buttonEast=new gw,this._buttonEast.getValue=function(){return 0},this._buttonWest=new gw,this._buttonWest.getValue=function(){return 0},this._buttonSouth=new gw,this._buttonSouth.getValue=function(){return 0},this._buttonTriggerLeft=new gw,this._buttonTriggerLeft.getValue=function(){return 0},this._buttonTriggerRight=new gw,this._buttonTriggerRight.getValue=function(){return 0},this._triggerLeft=new gw,this._triggerLeft.getValue=function(){return 0},this._triggerRight=new gw,this._triggerRight.getValue=function(){return 0},this._gripLeft=new gw,this._gripLeft.getValue=function(){return 0},this._gripRight=new gw,this._gripRight.getValue=function(){return 0},this._buttonLeftStick=new gw,this._buttonLeftStick.getValue=function(){return 0};var t=new gw;t.getValue=function(){return 0};var e=new gw;e.getValue=function(){return 0};var i=new gw;i.getValue=function(){return 0};var n=new gw;n.getValue=function(){return 0},this._leftStick=new vw({up:t,down:e,left:i,right:n}),this._buttonRightStick=new gw,this._buttonRightStick.getValue=function(){return 0};var r=new gw;r.getValue=function(){return 0};var s=new gw;s.getValue=function(){return 0};var o=new gw;o.getValue=function(){return 0};var a=new gw;a.getValue=function(){return 0},this._rightStick=new vw({up:r,down:s,left:o,right:a}),this._buttonOptions=new gw,this._buttonOptions.getValue=function(){return 0},this._buttonStart=new gw,this._buttonStart.getValue=function(){return 0},this._handLeftPosition=new Tw,this._handLeftPosition.getValue=function(){return _n.ZERO},this._handLeftOrientation=new yw,this._handLeftOrientation.getValue=function(){return Rn.IDENTITY},this._handRightPosition=new Tw,this._handRightPosition.getValue=function(){return _n.ZERO},this._handRightOrientation=new yw,this._handRightOrientation.getValue=function(){return Rn.IDENTITY},this._aimLeftPosition=new Tw,this._aimLeftPosition.getValue=function(){return _n.ZERO},this._aimLeftOrientation=new yw,this._aimLeftOrientation.getValue=function(){return Rn.IDENTITY},this._aimRightPosition=new Tw,this._aimRightPosition.getValue=function(){return _n.ZERO},this._aimRightOrientation=new yw,this._aimRightOrientation.getValue=function(){return Rn.IDENTITY},this._touchButtonA=new Ew,this._touchButtonA.getValue=function(){return 0},this._touchButtonB=new Ew,this._touchButtonB.getValue=function(){return 0},this._touchButtonX=new Ew,this._touchButtonX.getValue=function(){return 0},this._touchButtonY=new Ew,this._touchButtonY.getValue=function(){return 0},this._touchButtonTriggerLeft=new Ew,this._touchButtonTriggerLeft.getValue=function(){return 0},this._touchButtonTriggerRight=new Ew,this._touchButtonTriggerRight.getValue=function(){return 0},this._touchButtonThumbStickLeft=new Ew,this._touchButtonThumbStickLeft.getValue=function(){return 0},this._touchButtonThumbStickRight=new Ew,this._touchButtonThumbStickRight.getValue=function(){return 0}},n(t,[{key:"buttonNorth",get:function(){return this._buttonNorth}},{key:"buttonEast",get:function(){return this._buttonEast}},{key:"buttonWest",get:function(){return this._buttonWest}},{key:"buttonSouth",get:function(){return this._buttonSouth}},{key:"buttonTriggerLeft",get:function(){return this._buttonTriggerLeft}},{key:"buttonTriggerRight",get:function(){return this._buttonTriggerRight}},{key:"triggerLeft",get:function(){return this._triggerLeft}},{key:"triggerRight",get:function(){return this._triggerRight}},{key:"gripLeft",get:function(){return this._gripLeft}},{key:"gripRight",get:function(){return this._gripRight}},{key:"leftStick",get:function(){return this._leftStick}},{key:"rightStick",get:function(){return this._rightStick}},{key:"buttonLeftStick",get:function(){return this._buttonLeftStick}},{key:"buttonRightStick",get:function(){return this._buttonRightStick}},{key:"buttonOptions",get:function(){return this._buttonOptions}},{key:"buttonStart",get:function(){return this._buttonStart}},{key:"handLeftPosition",get:function(){return this._handLeftPosition}},{key:"handLeftOrientation",get:function(){return this._handLeftOrientation}},{key:"handRightPosition",get:function(){return this._handRightPosition}},{key:"handRightOrientation",get:function(){return this._handRightOrientation}},{key:"aimLeftPosition",get:function(){return this._aimLeftPosition}},{key:"aimLeftOrientation",get:function(){return this._aimLeftOrientation}},{key:"aimRightPosition",get:function(){return this._aimRightPosition}},{key:"aimRightOrientation",get:function(){return this._aimRightOrientation}},{key:"touchButtonA",get:function(){return this._touchButtonA}},{key:"touchButtonB",get:function(){return this._touchButtonB}},{key:"touchButtonX",get:function(){return this._touchButtonX}},{key:"touchButtonY",get:function(){return this._touchButtonY}},{key:"touchButtonTriggerLeft",get:function(){return this._touchButtonTriggerLeft}},{key:"touchButtonTriggerRight",get:function(){return this._touchButtonTriggerRight}},{key:"touchButtonThumbStickLeft",get:function(){return this._touchButtonThumbStickLeft}},{key:"touchButtonThumbStickRight",get:function(){return this._touchButtonThumbStickRight}}]),t}(),bw=function(){function t(){this._eventTarget=new oo,this._initInputSource()}var e=t.prototype;return e._on=function(t,e,i){this._eventTarget.on(t,e,i)},e._initInputSource=function(){this._viewLeftPosition=new Tw,this._viewLeftPosition.getValue=function(){return _n.ZERO},this._viewLeftOrientation=new yw,this._viewLeftOrientation.getValue=function(){return Rn.IDENTITY},this._viewRightPosition=new Tw,this._viewRightPosition.getValue=function(){return _n.ZERO},this._viewRightOrientation=new yw,this._viewRightOrientation.getValue=function(){return Rn.IDENTITY},this._headMiddlePosition=new Tw,this._headMiddlePosition.getValue=function(){return _n.ZERO},this._headMiddleOrientation=new yw,this._headMiddleOrientation.getValue=function(){return Rn.IDENTITY}},n(t,[{key:"viewLeftPosition",get:function(){return this._viewLeftPosition}},{key:"viewLeftOrientation",get:function(){return this._viewLeftOrientation}},{key:"viewRightPosition",get:function(){return this._viewRightPosition}},{key:"viewRightOrientation",get:function(){return this._viewRightOrientation}},{key:"headMiddlePosition",get:function(){return this._headMiddlePosition}},{key:"headMiddleOrientation",get:function(){return this._headMiddleOrientation}}]),t}(),Cw=function(){function t(){this._eventTarget=new oo,this._initInputSource()}var e=t.prototype;return e._on=function(t,e,i){this._eventTarget.on(t,e,i)},e._initInputSource=function(){this._handheldPosition=new Tw,this._handheldPosition.getValue=function(){return _n.ZERO},this._handheldOrientation=new yw,this._handheldOrientation.getValue=function(){return Rn.IDENTITY}},n(t,[{key:"handheldPosition",get:function(){return this._handheldPosition}},{key:"handheldOrientation",get:function(){return this._handheldOrientation}}]),t}(),Rw={Backspace:iw.BACKSPACE,Tab:iw.TAB,Enter:iw.ENTER,ShiftLeft:iw.SHIFT_LEFT,ControlLeft:iw.CTRL_LEFT,AltLeft:iw.ALT_LEFT,ShiftRight:iw.SHIFT_RIGHT,ControlRight:iw.CTRL_RIGHT,AltRight:iw.ALT_RIGHT,Pause:iw.PAUSE,CapsLock:iw.CAPS_LOCK,Escape:iw.ESCAPE,Space:iw.SPACE,PageUp:iw.PAGE_UP,PageDown:iw.PAGE_DOWN,End:iw.END,Home:iw.HOME,ArrowLeft:iw.ARROW_LEFT,ArrowUp:iw.ARROW_UP,ArrowRight:iw.ARROW_RIGHT,ArrowDown:iw.ARROW_DOWN,Insert:iw.INSERT,Delete:iw.DELETE,Digit0:iw.DIGIT_0,Digit1:iw.DIGIT_1,Digit2:iw.DIGIT_2,Digit3:iw.DIGIT_3,Digit4:iw.DIGIT_4,Digit5:iw.DIGIT_5,Digit6:iw.DIGIT_6,Digit7:iw.DIGIT_7,Digit8:iw.DIGIT_8,Digit9:iw.DIGIT_9,KeyA:iw.KEY_A,KeyB:iw.KEY_B,KeyC:iw.KEY_C,KeyD:iw.KEY_D,KeyE:iw.KEY_E,KeyF:iw.KEY_F,KeyG:iw.KEY_G,KeyH:iw.KEY_H,KeyI:iw.KEY_I,KeyJ:iw.KEY_J,KeyK:iw.KEY_K,KeyL:iw.KEY_L,KeyM:iw.KEY_M,KeyN:iw.KEY_N,KeyO:iw.KEY_O,KeyP:iw.KEY_P,KeyQ:iw.KEY_Q,KeyR:iw.KEY_R,KeyS:iw.KEY_S,KeyT:iw.KEY_T,KeyU:iw.KEY_U,KeyV:iw.KEY_V,KeyW:iw.KEY_W,KeyX:iw.KEY_X,KeyY:iw.KEY_Y,KeyZ:iw.KEY_Z,Numpad0:iw.NUM_0,Numpad1:iw.NUM_1,Numpad2:iw.NUM_2,Numpad3:iw.NUM_3,Numpad4:iw.NUM_4,Numpad5:iw.NUM_5,Numpad6:iw.NUM_6,Numpad7:iw.NUM_7,Numpad8:iw.NUM_8,Numpad9:iw.NUM_9,NumpadMultiply:iw.NUM_MULTIPLY,NumpadAdd:iw.NUM_PLUS,NumpadSubtract:iw.NUM_SUBTRACT,NumpadDecimal:iw.NUM_DECIMAL,NumpadDivide:iw.NUM_DIVIDE,NumpadEnter:iw.NUM_ENTER,F1:iw.F1,F2:iw.F2,F3:iw.F3,F4:iw.F4,F5:iw.F5,F6:iw.F6,F7:iw.F7,F8:iw.F8,F9:iw.F9,F10:iw.F10,F11:iw.F11,F12:iw.F12,NumLock:iw.NUM_LOCK,ScrollLock:iw.SCROLL_LOCK,Semicolon:iw.SEMICOLON,Equal:iw.EQUAL,Comma:iw.COMMA,Minus:iw.DASH,Period:iw.PERIOD,Slash:iw.SLASH,Backquote:iw.BACK_QUOTE,BracketLeft:iw.BRACKET_LEFT,Backslash:iw.BACKSLASH,BracketRight:iw.BRACKET_RIGHT,Quote:iw.QUOTE};function ww(t){return Rw[t]||iw.NONE}var Iw,xw,Dw=function(){function t(){this._eventTarget=new oo,this._keyStateMap={},go.hasFeature(_o.EVENT_KEYBOARD)&&this._registerEvent()}var e=t.prototype;return e._registerEvent=function(){var t,e,i,n,r=this;null===(t=xs.wx)||void 0===t||null===(e=t.onKeyDown)||void 0===e||e.call(t,(function(t){var e=ww(t.code);if(r._keyStateMap[e]){var i=r._getInputEvent(t,qR.KEY_PRESSING);r._eventTarget.emit(qR.KEY_PRESSING,i)}else{var n=r._getInputEvent(t,qR.KEY_DOWN);r._eventTarget.emit(qR.KEY_DOWN,n)}r._keyStateMap[e]=!0})),null===(i=xs.wx)||void 0===i||null===(n=i.onKeyUp)||void 0===n||n.call(i,(function(t){var e=ww(t.code),i=r._getInputEvent(t,qR.KEY_UP);r._keyStateMap[e]=!1,r._eventTarget.emit(qR.KEY_UP,i)}))},e._getInputEvent=function(t,e){var i=ww(t.code);return new JR(i,e)},e.on=function(t,e,i){this._eventTarget.on(t,e,i)},t}(),Ow=function(){function t(){this._eventTarget=new oo,this._isPressed=!1,this._preMousePos=new Hn,go.hasFeature(_o.EVENT_MOUSE)&&this._registerEvent()}var e=t.prototype;return e._getLocation=function(t){var e=No.windowSize,i=No.devicePixelRatio,n=t.x*i,r=e.height-t.y*i;return new Hn(n,r)},e._registerEvent=function(){var t,e,i,n,r,s,o,a;null===(t=xs.wx)||void 0===t||null===(e=t.onMouseDown)||void 0===e||e.call(t,this._createCallback(qR.MOUSE_DOWN)),null===(i=xs.wx)||void 0===i||null===(n=i.onMouseMove)||void 0===n||n.call(i,this._createCallback(qR.MOUSE_MOVE)),null===(r=xs.wx)||void 0===r||null===(s=r.onMouseUp)||void 0===s||s.call(r,this._createCallback(qR.MOUSE_UP)),null===(o=xs.wx)||void 0===o||null===(a=o.onWheel)||void 0===a||a.call(o,this._handleMouseWheel.bind(this))},e._createCallback=function(t){var e=this;return function(i){var n=e._getLocation(i),r=i.button;switch(t){case qR.MOUSE_DOWN:e._isPressed=!0;break;case qR.MOUSE_UP:e._isPressed=!1;break;case qR.MOUSE_MOVE:e._isPressed||(r=$R.BUTTON_MISSING)}var s=new $R(t,!1,e._preMousePos);s.setLocation(n.x,n.y),s.setButton(r),s.movementX=n.x-e._preMousePos.x,s.movementY=e._preMousePos.y-n.y,e._preMousePos.set(n.x,n.y),e._eventTarget.emit(t,s)}},e._handleMouseWheel=function(t){var e=qR.MOUSE_WHEEL,i=this._getLocation(t),n=t.button,r=new $R(e,!1,this._preMousePos);r.setLocation(i.x,i.y),r.setButton(n),r.movementX=i.x-this._preMousePos.x,r.movementY=this._preMousePos.y-i.y,r.setScrollData(t.deltaX,-t.deltaY),this._preMousePos.set(i.x,i.y),this._eventTarget.emit(qR.MOUSE_WHEEL,r)},e.on=function(t,e,i){this._eventTarget.on(t,e,i)},t}(),Pw=new Hn,Mw=new(function(){function t(){this._touchMap=new Map,this._maxTouches=8}var e=t.prototype;return e._createTouch=function(t,e,i){if(this._touchMap.has(t))B("Cannot create the same touch object.");else{if(!this._checkTouchMapSizeMoreThanMax(t)){var n=new aw(e,i,t);return this._touchMap.set(t,n),this._updateTouch(n,e,i),n}B("The touches is more than MAX_TOUCHES.")}},e.releaseTouch=function(t){this._touchMap.has(t)&&this._touchMap.delete(t)},e.getTouch=function(t){return this._touchMap.get(t)},e.getOrCreateTouch=function(t,e,i){var n=this.getTouch(t);return n?this._updateTouch(n,e,i):n=this._createTouch(t,e,i),n},e.getAllTouches=function(){var t=[];return this._touchMap.forEach((function(e){e&&t.push(e)})),t},e.getTouchCount=function(){return Mw._touchMap.size},e._updateTouch=function(t,e,i){t.getLocation(Pw),t.setPrevPoint(Pw),t.setPoint(e,i)},e._checkTouchMapSizeMoreThanMax=function(t){var e=this;if(this._touchMap.has(t))return!1;var i=Ie.ENABLE_MULTI_TOUCH?this._maxTouches:1;if(this._touchMap.sizeIe.TOUCH_TIMEOUT&&(B("The touches is more than MAX_TOUCHES, release touch id "+t.getID()+"."),e.releaseTouch(t.getID()))})),i>=this._touchMap.size},t}()),Nw=function(){function t(){this._eventTarget=new oo,go.hasFeature(_o.INPUT_TOUCH)&&this._registerEvent()}var e=t.prototype;return e._registerEvent=function(){xs.onTouchStart(this._createCallback(qR.TOUCH_START)),xs.onTouchMove(this._createCallback(qR.TOUCH_MOVE)),xs.onTouchEnd(this._createCallback(qR.TOUCH_END)),xs.onTouchCancel(this._createCallback(qR.TOUCH_CANCEL))},e._createCallback=function(t){var e=this;return function(i){for(var n=[],r=No.windowSize,s=No.devicePixelRatio,o=i.changedTouches.length,a=0;a0){var _=new ew(n,!1,t,Mw.getAllTouches());e._eventTarget.emit(t,_)}}},e._getLocation=function(t,e,i){var n=t.clientX*i,r=e.height-t.clientY*i;return new Hn(n,r)},e.on=function(t,e,i){this._eventTarget.on(t,e,i)},t}();!function(t){t[t.GLOBAL=0]="GLOBAL",t[t.UI=1]="UI"}(xw||(xw={}));var Lw=function(){function t(t){this.priority=xw.GLOBAL,this._inputEventTarget=t}var e=t.prototype;return e.onThrowException=function(){},e.dispatchEvent=function(t){return this._inputEventTarget.emit(t.type,t),!0},t}(),Bw=((Iw={})[qR.MOUSE_DOWN]=qR.TOUCH_START,Iw[qR.MOUSE_MOVE]=qR.TOUCH_MOVE,Iw[qR.MOUSE_UP]=qR.TOUCH_END,Iw),Fw=t("Input",function(){function t(){this._dispatchImmediately=!0,this._eventTarget=new oo,this._touchInput=new Nw,this._mouseInput=new Ow,this._keyboardInput=new Dw,this._accelerometerInput=new hw,this._handleInput=new Aw,this._hmdInput=new bw,this._handheldInput=new Cw,this._eventTouchList=[],this._eventMouseList=[],this._eventKeyboardList=[],this._eventAccelerationList=[],this._eventGamepadList=[],this._eventHandleList=[],this._eventHMDList=[],this._eventHandheldList=[],this._needSimulateTouchMoveEvent=!1,this._eventDispatcherList=[],this._registerEvent(),this._inputEventDispatcher=new Lw(this._eventTarget),this._registerEventDispatcher(this._inputEventDispatcher),Sw._init()}var e=t.prototype;return e._dispatchMouseDownEvent=function(t){var e,i;null===(e=(i=this._mouseInput).dispatchMouseDownEvent)||void 0===e||e.call(i,t)},e._dispatchMouseMoveEvent=function(t){var e,i;null===(e=(i=this._mouseInput).dispatchMouseMoveEvent)||void 0===e||e.call(i,t)},e._dispatchMouseUpEvent=function(t){var e,i;null===(e=(i=this._mouseInput).dispatchMouseUpEvent)||void 0===e||e.call(i,t)},e._dispatchMouseScrollEvent=function(t){var e,i;null===(e=(i=this._mouseInput).dispatchScrollEvent)||void 0===e||e.call(i,t)},e._dispatchKeyboardDownEvent=function(t){var e,i;null===(e=(i=this._keyboardInput).dispatchKeyboardDownEvent)||void 0===e||e.call(i,t)},e._dispatchKeyboardUpEvent=function(t){var e,i;null===(e=(i=this._keyboardInput).dispatchKeyboardUpEvent)||void 0===e||e.call(i,t)},e.on=function(t,e,i){return this._eventTarget.on(t,e,i),e},e.once=function(t,e,i){return this._eventTarget.once(t,e,i),e},e.off=function(t,e,i){this._eventTarget.off(t,e,i)},e.getTouch=function(t){return Mw.getTouch(t)},e.getAllTouches=function(){return Mw.getAllTouches()},e.getTouchCount=function(){return Mw.getTouchCount()},e.setAccelerometerEnabled=function(t){t?this._accelerometerInput.start():this._accelerometerInput.stop()},e.setAccelerometerInterval=function(t){this._accelerometerInput.setInterval(t)},e._simulateEventTouch=function(t){var e=Bw[t.type],i=Mw.getOrCreateTouch(0,t.getLocationX(),t.getLocationY());if(i){var n=[i],r=new ew(n,!1,e,e===qR.TOUCH_END?[]:n);r.windowId=t.windowId,e===qR.TOUCH_END&&Mw.releaseTouch(0),this._dispatchOrPushEventTouch(r,this._eventTouchList)}},e._registerEventDispatcher=function(t){this._eventDispatcherList.push(t),this._eventDispatcherList.sort((function(t,e){return e.priority-t.priority}))},e._emitEvent=function(t){for(var e=this._eventDispatcherList.length,i=0;i8?Z(12004,8):(this._passes=t,this._flushPassInfo(),this._descriptorSet&&(this._descriptorSet.destroy(),oI.layout=t[0].localSetLayout,this._descriptorSet=this._device.createDescriptorSet(oI)))}},{key:"shaders",get:function(){return this._shaders}},{key:"subMesh",get:function(){return this._subMesh},set:function(t){this._inputAssembler.destroy(),this._inputAssembler=this._device.createInputAssembler(t.iaInfo),this._subMesh=t}},{key:"priority",get:function(){return this._priority},set:function(t){this._priority=t}},{key:"inputAssembler",get:function(){return this._inputAssembler}},{key:"descriptorSet",get:function(){return this._descriptorSet}},{key:"worldBoundDescriptorSet",get:function(){return this._worldBoundDescriptorSet}},{key:"patches",get:function(){return this._patches}},{key:"instancedAttributeBlock",get:function(){return this._instancedAttributeBlock}},{key:"instancedWorldMatrixIndex",get:function(){return this._instancedWorldMatrixIndex},set:function(t){this._instancedWorldMatrixIndex=t}},{key:"instancedSHIndex",get:function(){return this._instancedSHIndex},set:function(t){this._instancedSHIndex=t}},{key:"useReflectionProbeType",get:function(){return this._useReflectionProbeType},set:function(t){this._useReflectionProbeType=t}}]),t}(),hI=new k_;hI.format=pl.RGBA8;var uI=new U_;uI.format=pl.DEPTH_STENCIL;var cI,lI,_I=new z_([hI],uI),dI={width:1,height:1,renderPassInfo:_I},fI=t("RenderTexture",va("cc.RenderTexture")(Qw=function(t){function e(){var e;return(e=t.call(this)||this)._window=null,e}s(e,t);var i=e.prototype;return i.initialize=function(t){this._name=t.name||"",this._width=t.width,this._height=t.height,this._initWindow(t)},i.reset=function(t){this.initialize(t)},i.destroy=function(){if(this._window){var e=m.director.root;null==e||e.destroyWindow(this._window),this._window=null}return t.prototype.destroy.call(this)},i.resize=function(t,e){this._width=Math.floor(Pi(t,1,2048)),this._height=Math.floor(Pi(e,1,2048)),this._window&&this._window.resize(this._width,this._height),this.emit("resize",this._window)},i._serialize=function(){return{}},i._deserialize=function(e,i){var n=e;this._width=n.w,this._height=n.h,this._name=n.n,t.prototype._deserialize.call(this,n.base,i)},i.getGFXTexture=function(){return this._window&&this._window.framebuffer.colorTextures[0]},i.onLoaded=function(){this._initWindow()},i._initWindow=function(t){var e=m.director.root;dI.title=this._name,dI.width=this._width,dI.height=this._height,dI.renderPassInfo=t&&t.passInfo?t.passInfo:_I,dI.externalResLow=t&&t.externalResLow?t.externalResLow:0,dI.externalResHigh=t&&t.externalResHigh?t.externalResHigh:0,dI.externalFlag=t&&t.externalFlag?t.externalFlag:bl.NONE,dI.renderPassInfo.colorAttachments.forEach((function(t){t.format=e.device.swapchainFormat})),hI.barrier=Qd.gfxDevice.getGeneralBarrier(new V_(kl.FRAGMENT_SHADER_READ_TEXTURE,kl.FRAGMENT_SHADER_READ_TEXTURE)),this._window?(this._window.destroy(),this._window.initialize(Qd.gfxDevice,dI)):this._window=e.createWindow(dI)},i.initDefault=function(e){t.prototype.initDefault.call(this,e),this._width=this._height=1,this._initWindow()},i.validate=function(){return this.width>=1&&this.width<=2048&&this.height>=1&&this.height<=2048},i.readPixels=function(t,e,i,n,r){t=t||0,e=e||0,i=i||this.width,n=n||this.height;var s=this.getGFXTexture();if(!s)return Z(7606),null;var o=4*i*n;if(void 0===r)r=new Uint8Array(o);else if(r.length=0?a.updateInstancedWorldMatrix(r,h):s=!0}(s||n)&&this._localBuffer&&(Ln.toArray(this._localData,r,dv.MAT_WORLD_OFFSET),Ln.invert(yI,r),Ln.transpose(yI,yI),Ln.toArray(this._localData,yI,dv.MAT_WORLD_IT_OFFSET),this._localBuffer.update(this._localData))}},e.invalidateLocalData=function(){this._localDataUpdated=!0},e.showTetrahedron=function(){return this.isLightProbeAvailable()},e.isLightProbeAvailable=function(){if(!this._useLightProbe)return!1;var t=m.director.root.pipeline.pipelineSceneData.lightProbes;return!(!t||t.empty()||!this._worldBounds)},e.updateSHBuffer=function(){if(this._localSHData){for(var t=this._subModels,e=!1,i=0;i=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?wI:RI),r=this._subModels,s=0;s15e3&&(e=15e3);var i=e*e,n=(.860117757+.000154118254*e+1.28641212e-7*i)/(1+.000842420235*e+7.08145163e-7*i),r=(.317398726+422806245e-13*e+4.20481691e-8*i)/(1-289741816e-13*e+1.61456053e-7*i),s=2*n-8*r+4,o=3*n/s,a=2*r/s,h=1/a*o,u=1/a*(1-o-a);t.x=3.2404542*h-1.5371385+-.4985314*u,t.y=-.969266*h+1.8760108+.041556*u,t.z=.0556434*h-.2040259+1.0572252*u}!function(t){t[t.DIRECTIONAL=0]="DIRECTIONAL",t[t.SPHERE=1]="SPHERE",t[t.SPOT=2]="SPOT",t[t.POINT=3]="POINT",t[t.RANGED_DIRECTIONAL=4]="RANGED_DIRECTIONAL",t[t.UNKNOWN=5]="UNKNOWN"}(CI||(CI={}));var PI,MI,NI=function(t){return 4*Math.PI*Math.PI*t*t},LI=function(){function t(){this._baked=!1,this._color=new _n(1,1,1),this._colorTemp=6550,this._colorTempRGB=new _n(1,1,1),this._finalColor=new _n(1,1,1),this._scene=null,this._node=null,this._name=null,this._useColorTemperature=!1,this._type=CI.UNKNOWN,this._visibility=my}var e=t.prototype;return e.initialize=function(){this.color=new _n(1,1,1),this.colorTemperature=6550},e.attachToScene=function(t){this._scene=t},e.detachFromScene=function(){this._scene=null},e.destroy=function(){this._name=null,this._node=null},e.update=function(){},n(t,[{key:"baked",get:function(){return this._baked},set:function(t){this._baked=t}},{key:"color",get:function(){return this._color},set:function(t){this._color.set(t),this._useColorTemperature&&_n.multiply(this._finalColor,this._color,this._colorTempRGB)}},{key:"useColorTemperature",get:function(){return this._useColorTemperature},set:function(t){this._useColorTemperature=t,t&&_n.multiply(this._finalColor,this._color,this._colorTempRGB)}},{key:"colorTemperature",get:function(){return this._colorTemp},set:function(t){this._colorTemp=t,OI(this._colorTempRGB,this._colorTemp),this._useColorTemperature&&_n.multiply(this._finalColor,this._color,this._colorTempRGB)}},{key:"colorTemperatureRGB",get:function(){return this._colorTempRGB}},{key:"finalColor",get:function(){return this._finalColor}},{key:"visibility",get:function(){return this._visibility},set:function(t){this._visibility=t}},{key:"node",get:function(){return this._node},set:function(t){this._node=t,this._node&&(this._node.hasChangedFlags|=Ig.ROTATION)}},{key:"type",get:function(){return this._type}},{key:"name",get:function(){return this._name},set:function(t){this._name=t}},{key:"scene",get:function(){return this._scene}}]),t}(),BI=new _n(0,0,-1),FI=new _n,kI=function(t){function e(){var e;return(e=t.call(this)||this)._dir=new _n(1,-1,-1),e._illuminanceHDR=Um.SUN_ILLUM,e._illuminanceLDR=1,e._shadowEnabled=!1,e._shadowPcf=iS.HARD,e._shadowBias=1e-5,e._shadowNormalBias=0,e._shadowSaturation=1,e._shadowDistance=50,e._shadowInvisibleOcclusionRange=200,e._csmLevel=nS.LEVEL_4,e._csmNeedUpdate=!1,e._csmLayerLambda=.75,e._csmOptimizationMode=rS.DisableRotationFix,e._csmLayersTransition=!1,e._csmTransitionRange=.05,e._shadowFixedArea=!1,e._shadowNear=.1,e._shadowFar=10,e._shadowOrthoSize=5,e._type=CI.DIRECTIONAL,e}s(e,t);var i=e.prototype;return i.initialize=function(){t.prototype.initialize.call(this),this.illuminance=Um.SUN_ILLUM,this.direction=new _n(1,-1,-1)},i.update=function(){this._node&&this._node.hasChangedFlags&&(this.direction=_n.transformQuat(FI,BI,this._node.worldRotation))},i.activate=function(){var t=m.director.root,e=t.pipeline;this._shadowEnabled?(this._shadowFixedArea||!e.pipelineSceneData.csmSupported?e.macros.CC_DIR_LIGHT_SHADOW_TYPE=1:this.csmLevel>1&&e.pipelineSceneData.csmSupported?(e.macros.CC_DIR_LIGHT_SHADOW_TYPE=2,e.macros.CC_CASCADED_LAYERS_TRANSITION=this._csmLayersTransition):e.macros.CC_DIR_LIGHT_SHADOW_TYPE=1,e.macros.CC_DIR_SHADOW_PCF_TYPE=this._shadowPcf):e.macros.CC_DIR_LIGHT_SHADOW_TYPE=0,t.onGlobalPipelineStateChanged()},n(e,[{key:"direction",get:function(){return this._dir},set:function(t){_n.normalize(this._dir,t)}},{key:"illuminance",get:function(){return m.director.root.pipeline.pipelineSceneData.isHDR?this._illuminanceHDR:this._illuminanceLDR},set:function(t){m.director.root.pipeline.pipelineSceneData.isHDR?this.illuminanceHDR=t:this.illuminanceLDR=t}},{key:"illuminanceHDR",get:function(){return this._illuminanceHDR},set:function(t){this._illuminanceHDR=t}},{key:"illuminanceLDR",get:function(){return this._illuminanceLDR},set:function(t){this._illuminanceLDR=t}},{key:"shadowEnabled",get:function(){return this._shadowEnabled},set:function(t){this._shadowEnabled=t,this.activate()}},{key:"shadowPcf",get:function(){return this._shadowPcf},set:function(t){this._shadowPcf=t,this.activate()}},{key:"shadowBias",get:function(){return this._shadowBias},set:function(t){this._shadowBias=t}},{key:"shadowNormalBias",get:function(){return this._shadowNormalBias},set:function(t){this._shadowNormalBias=t}},{key:"shadowSaturation",get:function(){return this._shadowSaturation},set:function(t){this._shadowSaturation=t}},{key:"shadowDistance",get:function(){return this._shadowDistance},set:function(t){this._shadowDistance=Math.min(t,oS.MAX_FAR)}},{key:"shadowInvisibleOcclusionRange",get:function(){return this._shadowInvisibleOcclusionRange},set:function(t){this._shadowInvisibleOcclusionRange=Math.min(t,oS.MAX_FAR)}},{key:"csmLevel",get:function(){return this._csmLevel},set:function(t){this._csmLevel=t,this.activate()}},{key:"csmNeedUpdate",get:function(){return this._csmNeedUpdate},set:function(t){this._csmNeedUpdate=t}},{key:"csmLayerLambda",get:function(){return this._csmLayerLambda},set:function(t){this._csmLayerLambda=t}},{key:"csmOptimizationMode",get:function(){return this._csmOptimizationMode},set:function(t){this._csmOptimizationMode=t}},{key:"shadowFixedArea",get:function(){return this._shadowFixedArea},set:function(t){this._shadowFixedArea=t,this.activate()}},{key:"shadowNear",get:function(){return this._shadowNear},set:function(t){this._shadowNear=t}},{key:"shadowFar",get:function(){return this._shadowFar},set:function(t){this._shadowFar=Math.min(t,oS.MAX_FAR)}},{key:"shadowOrthoSize",get:function(){return this._shadowOrthoSize},set:function(t){this._shadowOrthoSize=t}},{key:"csmLayersTransition",get:function(){return this._csmLayersTransition},set:function(t){this._csmLayersTransition=t,this.activate()}},{key:"csmTransitionRange",get:function(){return this._csmTransitionRange},set:function(t){this._csmTransitionRange=t}}]),e}(LI),UI=function(t){function e(){var e;return(e=t.call(this)||this)._needUpdate=!1,e._size=.15,e._range=1,e._luminanceHDR=0,e._luminanceLDR=0,e._pos=new _n,e._aabb=Xo.create(),e._type=CI.SPHERE,e}s(e,t);var i=e.prototype;return i.initialize=function(){t.prototype.initialize.call(this),this.size=.15,this.range=1,this.luminanceHDR=1700/NI(.15),this.luminanceLDR=1},i.update=function(){if(this._node&&(this._node.hasChangedFlags||this._needUpdate)){this._node.getWorldPosition(this._pos);var t=this._range;Xo.set(this._aabb,this._pos.x,this._pos.y,this._pos.z,t,t,t),this._needUpdate=!1}},n(e,[{key:"position",get:function(){return this._pos}},{key:"size",get:function(){return this._size},set:function(t){this._size=t}},{key:"range",get:function(){return this._range},set:function(t){this._range=t,this._needUpdate=!0}},{key:"luminance",get:function(){return m.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){m.director.root.pipeline.pipelineSceneData.isHDR?this.luminanceHDR=t:this.luminanceLDR=t}},{key:"luminanceHDR",get:function(){return this._luminanceHDR},set:function(t){this._luminanceHDR=t}},{key:"luminanceLDR",set:function(t){this._luminanceLDR=t}},{key:"aabb",get:function(){return this._aabb}}]),e}(LI),GI=new _n(0,0,-1),HI=new Rn,zI=new Ln,VI=new Ln,WI=new Ln,XI=new Ln,jI=function(t){function e(){var e;return(e=t.call(this)||this)._dir=new _n(1,-1,-1),e._range=5,e._spotAngle=Math.cos(Math.PI/6),e._angleAttenuationStrength=0,e._pos=new _n,e._aabb=Xo.create(),e._frustum=Jo.create(),e._angle=0,e._needUpdate=!1,e._size=.15,e._luminanceHDR=0,e._luminanceLDR=0,e._shadowEnabled=!1,e._shadowPcf=iS.HARD,e._shadowBias=1e-5,e._shadowNormalBias=0,e._type=CI.SPOT,e}s(e,t);var i=e.prototype;return i.initialize=function(){t.prototype.initialize.call(this),this.size=.15,this.luminanceHDR=1700/NI(.15),this.luminanceLDR=1,this.range=Math.cos(Math.PI/6),this._dir.set(new _n(1,-1,-1))},i.update=function(){this._node&&(this._node.hasChangedFlags||this._needUpdate)&&(this._node.getWorldPosition(this._pos),_n.transformQuat(this._dir,GI,this._node.getWorldRotation(HI)),_n.normalize(this._dir,this._dir),Xo.set(this._aabb,this._pos.x,this._pos.y,this._pos.z,this._range,this._range,this._range),this._node.getWorldRT(zI),Ln.invert(zI,zI),Ln.perspective(VI,this._angle,1,.001,this._range),Ln.multiply(WI,VI,zI),this._frustum.update(WI,XI),this._needUpdate=!1)},n(e,[{key:"position",get:function(){return this._pos}},{key:"size",get:function(){return this._size},set:function(t){this._size=t}},{key:"range",get:function(){return this._range},set:function(t){this._range=t,this._needUpdate=!0}},{key:"luminance",get:function(){return m.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){m.director.root.pipeline.pipelineSceneData.isHDR?this.luminanceHDR=t:this.luminanceLDR=t}},{key:"luminanceHDR",get:function(){return this._luminanceHDR},set:function(t){this._luminanceHDR=t}},{key:"luminanceLDR",get:function(){return this._luminanceLDR},set:function(t){this._luminanceLDR=t}},{key:"direction",get:function(){return this._dir}},{key:"spotAngle",get:function(){return this._spotAngle},set:function(t){this._angle=t,this._spotAngle=Math.cos(.5*t),this._needUpdate=!0}},{key:"angleAttenuationStrength",get:function(){return this._angleAttenuationStrength},set:function(t){this._angleAttenuationStrength=t,this._needUpdate=!0}},{key:"angle",get:function(){return this._angle}},{key:"aabb",get:function(){return this._aabb}},{key:"frustum",get:function(){return this._frustum}},{key:"shadowEnabled",get:function(){return this._shadowEnabled},set:function(t){this._shadowEnabled=t}},{key:"shadowPcf",get:function(){return this._shadowPcf},set:function(t){this._shadowPcf=t}},{key:"shadowBias",get:function(){return this._shadowBias},set:function(t){this._shadowBias=t}},{key:"shadowNormalBias",get:function(){return this._shadowNormalBias},set:function(t){this._shadowNormalBias=t}}]),e}(LI),YI=function(t){function e(){var e;return(e=t.call(this)||this)._needUpdate=!1,e._range=1,e._luminanceHDR=0,e._luminanceLDR=0,e._pos=new _n,e._aabb=Xo.create(),e._type=CI.POINT,e}s(e,t);var i=e.prototype;return i.initialize=function(){t.prototype.initialize.call(this),this.range=1,this.luminanceHDR=1700/NI(1),this.luminanceLDR=1},i.update=function(){if(this._node&&(this._node.hasChangedFlags||this._needUpdate)){this._node.getWorldPosition(this._pos);var t=this._range;Xo.set(this._aabb,this._pos.x,this._pos.y,this._pos.z,t,t,t),this._needUpdate=!1}},n(e,[{key:"position",get:function(){return this._pos}},{key:"range",get:function(){return this._range},set:function(t){this._range=t,this._needUpdate=!0}},{key:"luminance",get:function(){return m.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){m.director.root.pipeline.pipelineSceneData.isHDR?this.luminanceHDR=t:this.luminanceLDR=t}},{key:"luminanceHDR",get:function(){return this._luminanceHDR},set:function(t){this._luminanceHDR=t}},{key:"luminanceLDR",set:function(t){this._luminanceLDR=t}},{key:"aabb",get:function(){return this._aabb}}]),e}(LI),KI=new _n(0,0,-1),qI=function(t){function e(){var e;return(e=t.call(this)||this)._dir=new _n(0,0,-1),e._pos=new _n(0,0,0),e._scale=new _n(1,1,1),e._right=new _n(1,0,0),e._illuminanceHDR=Um.SUN_ILLUM,e._illuminanceLDR=1,e._type=CI.RANGED_DIRECTIONAL,e}s(e,t);var i=e.prototype;return i.initialize=function(){t.prototype.initialize.call(this),this.illuminance=Um.SUN_ILLUM},i.update=function(){this._node&&this._node.hasChangedFlags&&(this._node.getWorldPosition(this._pos),this._node.getWorldScale(this._scale),_n.transformQuat(this._dir,KI,this._node.worldRotation),_n.transformQuat(this._right,_n.RIGHT,this._node.worldRotation))},n(e,[{key:"direction",get:function(){return this._dir}},{key:"right",get:function(){return this._right}},{key:"position",get:function(){return this._pos}},{key:"scale",get:function(){return this._scale}},{key:"illuminance",get:function(){return m.director.root.pipeline.pipelineSceneData.isHDR?this._illuminanceHDR:this._illuminanceLDR},set:function(t){m.director.root.pipeline.pipelineSceneData.isHDR?this.illuminanceHDR=t:this.illuminanceLDR=t}},{key:"illuminanceHDR",get:function(){return this._illuminanceHDR},set:function(t){this._illuminanceHDR=t}},{key:"illuminanceLDR",get:function(){return this._illuminanceLDR},set:function(t){this._illuminanceLDR=t}}]),e}(LI),QI=function(){function t(){this.screenUsagePercentage=1,this._models=[]}var e=t.prototype;return e.addModel=function(t){this._models.splice(0,0,t)},e.eraseModel=function(t){var e=this._models.indexOf(t);e>=0&&this._models.splice(e,1)},e.clearModels=function(){this._models.length=0},n(t,[{key:"models",get:function(){return this._models}}]),t}(),ZI=function(){function t(){this.scene=void 0,this.node=null,this.enabled=!0,this._localBoundaryCenter=new _n(0,0,0),this._objectSize=1,this._lodDataArray=[],this._lockedLODLevelVec=[],this._isLockLevelChanged=!1,this._device=Qd.gfxDevice}var e=t.prototype;return e.attachToScene=function(t){this.scene=t},e.detachFromScene=function(){this.scene=null},e.lockLODLevels=function(t){if(t.length!==this._lockedLODLevelVec.length)this._isLockLevelChanged=!0;else for(var e=t.length,i=0;i=this.lodDataArray[n].screenUsagePercentage){i=n;break}return i},e.getScreenUsagePercentage=function(t){return this.node?(t.projectionType===zw.PERSPECTIVE&&(e=_n.len(this.localBoundaryCenter.transformMat4(this.node.worldMatrix).subtract(t.node.worldPosition))),this.distanceToScreenUsagePercentage(t,e,this.getWorldSpaceSize())):0;var e},e.distanceToScreenUsagePercentage=function(t,e,i){return t.projectionType===zw.PERSPECTIVE?i*t.matProj.m05/(2*e):i*t.matProj.m05*.5},e.getWorldSpaceSize=function(){var t=this.node.scale;return Math.max(Math.abs(t.x),Math.abs(t.y),Math.abs(t.z))*this.objectSize},n(t,[{key:"localBoundaryCenter",get:function(){return this._localBoundaryCenter.clone()},set:function(t){this._localBoundaryCenter.set(t)}},{key:"lodCount",get:function(){return this._lodDataArray.length}},{key:"objectSize",get:function(){return this._objectSize},set:function(t){this._objectSize=t}},{key:"lodDataArray",get:function(){return this._lodDataArray}}]),t}(),JI=Object.freeze({__proto__:null,get CameraFOVAxis(){return Hw},get CameraProjection(){return zw},get CameraAperture(){return Vw},get CameraISO(){return Ww},get CameraShutter(){return Xw},get CameraType(){return jw},get TrackingType(){return Yw},get CameraUsage(){return Kw},SKYBOX_FLAG:nI,Camera:sI,get ModelType(){return vI},Model:II,SubModel:aI,Ambient:Um,EnvironmentLightingType:lS,Skybox:_S,ShadowSize:tS,ShadowType:eS,PCFType:iS,CSMLevel:nS,CSMOptimizationMode:rS,Shadows:oS,FogType:fS,FOG_TYPE_NONE:pS,Fog:gS,Octree:xI,Skin:DI,ColorTemperatureToRGB:OI,get LightType(){return CI},nt2lm:NI,Light:LI,DirectionalLight:kI,SphereLight:UI,SpotLight:jI,PointLight:YI,RangedDirectionalLight:qI,get ProbeClearFlag(){return cI},get ProbeType(){return lI},ReflectionProbe:mI,LODData:QI,LODGroup:ZI,ToneMappingType:Ub,PostSettings:Gb}),$I=function(){function t(t){this._name="",this._cameras=[],this._models=[],this._lodGroups=[],this._batches=[],this._directionalLights=[],this._sphereLights=[],this._spotLights=[],this._pointLights=[],this._rangedDirLights=[],this._mainLight=null,this._modelId=0,this._lodStateCache=null,this._root=t}t.registerCreateFunc=function(e){e._createSceneFun=function(e){return new t(e)}};var e=t.prototype;return e.initialize=function(t){return this._name=t.name,this._lodStateCache=new ex(this),!0},e.update=function(t){var e=this._mainLight;e&&e.update();for(var i=this._sphereLights,n=0;n=0&&(this._lodGroups.splice(e,1),t.detachFromScene(),this._lodStateCache.removeLodGroup(t))},e.removeLODGroups=function(){for(var t,e=d(this._lodGroups);!(t=e()).done;){var i=t.value;this._lodStateCache.removeLodGroup(i)}this._lodGroups.length=0},e.onGlobalPipelineStateChanged=function(){for(var t,e=d(this._models);!(t=e()).done;)t.value.onGlobalPipelineStateChanged()},e.generateModelId=function(){return this._modelId++},n(t,[{key:"root",get:function(){return this._root}},{key:"name",get:function(){return this._name}},{key:"cameras",get:function(){return this._cameras}},{key:"mainLight",get:function(){return this._mainLight}},{key:"sphereLights",get:function(){return this._sphereLights}},{key:"spotLights",get:function(){return this._spotLights}},{key:"pointLights",get:function(){return this._pointLights}},{key:"rangedDirLights",get:function(){return this._rangedDirLights}},{key:"models",get:function(){return this._models}},{key:"batches",get:function(){return this._batches}},{key:"lodGroups",get:function(){return this._lodGroups}}]),t}(),tx=function(){this.usedLevel=-1,this.lastUsedLevel=-1,this.transformDirty=!0},ex=function(){function t(t){this._renderScene=null,this._modelsInLODGroup=new Map,this._lodStateInCamera=new Map,this._newAddedLodGroupVec=new Array,this._levelModels=new Map,this._renderScene=t}var e=t.prototype;return e.addCamera=function(t){for(var e,i=d(this._renderScene.lodGroups);!(e=i()).done;){var n=e.value.node.layer;if((t.visibility&n)===n){this._lodStateInCamera.has(t)||this._lodStateInCamera.set(t,new Map);break}}},e.removeCamera=function(t){this._lodStateInCamera.has(t)&&this._lodStateInCamera.delete(t)},e.addLodGroup=function(t){this._newAddedLodGroupVec.push(t);for(var e,i=d(this._renderScene.cameras);!(e=i()).done;){var n=e.value;if(!this._lodStateInCamera.has(n)){var r=t.node.layer;(n.visibility&r)===r&&this._lodStateInCamera.set(n,new Map)}}},e.removeLodGroup=function(t){for(var e=0;e0){if(t.node.hasChangedFlags>0)for(var n,r=d(e._lodStateInCamera);!(n=r()).done;){var s=n.value,o=s[1].get(t);o||(o=new tx,s[1].set(t,o)),o.transformDirty=!0}if(t.isLockLevelChanged()){t.resetLockChangeFlag();var a=e._levelModels.get(t);if(a){a.forEach((function(t){t.forEach((function(t){var i=e._modelsInLODGroup.get(t);i&&i.clear()}))}));for(var h,u=d(i);!(h=u()).done;){var c=h.value,_=a.get(c);_&&_.forEach((function(t){var i=e._modelsInLODGroup.get(t);if(i&&t.node&&t.node.active)for(var n,r=d(e._lodStateInCamera);!(n=r()).done;){var s=n.value;i.set(s[0],!0)}}))}}}return 0}for(var f,p=!1,g=d(e._lodStateInCamera);!(f=g()).done;){var m=f.value,v=m[1].get(t);v||(v=new tx,m[1].set(t,v));var y=m[0].node.hasChangedFlags,T=t.node.hasChangedFlags;if(y>0||T>0||v.transformDirty){v.transformDirty&&(v.transformDirty=!1);var E=t.getVisibleLODLevel(m[0]);E!==v.usedLevel&&(v.lastUsedLevel=v.usedLevel,v.usedLevel=E,p=!0)}}var S=e._levelModels.get(t);if(!S)return 0;t.isLockLevelChanged()?(t.resetLockChangeFlag(),S.forEach((function(t){t.forEach((function(t){var i=e._modelsInLODGroup.get(t);i&&i.clear()}))})),p=!0):p&&e._lodStateInCamera.forEach((function(i){var n=i.get(t);if(n&&n.usedLevel!==n.lastUsedLevel){var r=S.get(n.lastUsedLevel);r&&r.forEach((function(t){var i=e._modelsInLODGroup.get(t);i&&i.clear()}))}})),p&&e._lodStateInCamera.forEach((function(i,n){var r=i.get(t);if(r){var s=r.usedLevel,o=S.get(s);o&&o.forEach((function(t){var i=e._modelsInLODGroup.get(t);i&&t.node&&t.node.active&&i.set(n,!0)}))}}))}},f=d(this._renderScene.lodGroups);!(l=f()).done;)_()},e.isLodModelCulled=function(t,e){var i=this._modelsInLODGroup.get(e);return!!i&&!i.has(t)},e.clearCache=function(){this._levelModels.clear(),this._modelsInLODGroup.clear(),this._lodStateInCamera.clear(),this._newAddedLodGroupVec.length=0},e.isLodGroupVisibleByCamera=function(t,e){var i=t.node.layer;return(e.visibility&i)===i},t}(),ix=((PI={})[Re.PORTRAIT]=dl.IDENTITY,PI[Re.LANDSCAPE_RIGHT]=dl.ROTATE_90,PI[Re.PORTRAIT_UPSIDE_DOWN]=dl.ROTATE_180,PI[Re.LANDSCAPE_LEFT]=dl.ROTATE_270,PI),nx=0,rx=function(){var t=e.prototype;function e(){this._title="",this._width=1,this._height=1,this._swapchain=null,this._renderPass=null,this._colorTextures=[],this._depthStencilTexture=null,this._cameras=[],this._hasOnScreenAttachments=!1,this._hasOffScreenAttachments=!1,this._framebuffer=null,this._device=null,this._renderWindowId=nx++,this._isResized=!0,this._colorName="Color"+this._renderWindowId,this._depthStencilName="DepthStencil"+this._renderWindowId}return t.isRenderWindowResized=function(){return this._isResized},t.setRenderWindowResizeHandled=function(){this._isResized=!1},e.registerCreateFunc=function(t){t._createWindowFun=function(){return new e}},t.initialize=function(t,e){if(void 0!==e.title&&(this._title=e.title),void 0!==e.swapchain&&(this._swapchain=e.swapchain),this._width=e.width,this._height=e.height,this._device=t,this._renderPass=t.createRenderPass(e.renderPassInfo),e.swapchain)this._swapchain=e.swapchain,this._colorTextures.push(e.swapchain.colorTexture),this._depthStencilTexture=e.swapchain.depthStencilTexture;else{for(var i=0;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;m--){var v=i[m];(o===sx.LEFT&&v.cameraType===jw.RIGHT_EYE||o===sx.RIGHT&&v.cameraType===jw.LEFT_EYE)&&i.splice(m,1)}this._frameMoveEnd()}}},e._frameMoveBegin=function(){for(var t=0;t0){this._device.acquire([Qd.swapchain]);var r=this._scenes,s=t.getTotalFrames();this._batcher&&(this._batcher.update(),this._batcher.uploadBuffers());for(var o=0;o0){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}());m.Root=ux,Ti.Attr.setClassAttr(Rp,"target","type","Object"),Ti.Attr.setClassAttr(Rp,"target","ctor",Tm);var cx,lx=new Ws((function(){return new Array(16)}),3),_x=null,dx=new Hn,fx=[Dg.TOUCH_START,Dg.TOUCH_MOVE,Dg.TOUCH_END,Dg.TOUCH_CANCEL],px=[Dg.MOUSE_DOWN,Dg.MOUSE_ENTER,Dg.MOUSE_MOVE,Dg.MOUSE_LEAVE,Dg.MOUSE_UP,Dg.MOUSE_WHEEL];!function(t){t[t.ADD_POINTER_EVENT_PROCESSOR=0]="ADD_POINTER_EVENT_PROCESSOR",t[t.REMOVE_POINTER_EVENT_PROCESSOR=1]="REMOVE_POINTER_EVENT_PROCESSOR",t[t.MARK_LIST_DIRTY=2]="MARK_LIST_DIRTY"}(cx||(cx={}));var gx,mx=function(){function t(t){this.claimedTouchIdList=[],this.maskList=null,this.cachedCameraPriority=0,this.previousMouseIn=!1,this.bubblingTarget=null,this.capturingTarget=null,this.shouldHandleEventMouse=!1,this.shouldHandleEventTouch=!1,this._dispatchingTouch=null,this._isEnabled=!1,this._isMouseLeaveWindow=!1,this._node=t}var e=t.prototype;return e.setEnabled=function(e,i){if(void 0===i&&(i=!1),this._isEnabled!==e){this._isEnabled=e;var n=this.node.children;if(e&&this._attachMask(),t.callbacksInvoker.emit(cx.MARK_LIST_DIRTY),i&&n.length>0)for(var r=0;r=0;--n)if((e=r[n]).eventProcessor.capturingTarget&&(t.currentTarget=e,e.eventProcessor.capturingTarget.emit(t.type,t,r),t.propagationStopped))return void lx.free(r);if(t.eventPhase=2,t.currentTarget=i,this.capturingTarget&&this.capturingTarget.emit(t.type,t),!t.propagationImmediateStopped&&this.bubblingTarget&&this.bubblingTarget.emit(t.type,t),!t.propagationStopped&&t.bubbles)for(r.length=0,this.getBubblingTargets(t.type,r),t.eventPhase=3,n=0;n0?n:null}return null},e._attachMask=function(){this.maskList=this._searchComponentsInParent(t._maskComp)},e._isTouchEvent=function(t){return-1!==fx.indexOf(t)},e._isMouseEvent=function(t){return-1!==px.indexOf(t)},e._hasTouchListeners=function(){for(var t=0;t>>1;r<=s;o=r+s>>>1){var a=t[o],h=a.constructor._executionOrder;if(h>i)s=o-1;else if(hn)s=o-1;else{if(!(u0&&(t.array.sort(xx),this._invoke(t),t.array.length=0),this._invoke(this._zero),this._zero.array.length=0;var e=this._pos;e.array.length>0&&(e.array.sort(xx),this._invoke(e),e.array.length=0)},e}(Ix),Ox=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.add=function(t){var e=t.constructor._executionOrder;if(0===e)this._zero.array.push(t);else{var i=e<0?this._neg.array:this._pos.array,n=Cx(i,t);n<0&&i.splice(~n,0,t)}},i.remove=function(t){var e=t.constructor._executionOrder;if(0===e)this._zero.fastRemove(t);else{var i=e<0?this._neg:this._pos,n=Cx(i.array,t);n>=0&&i.removeAt(n)}},i.invoke=function(t){this._neg.array.length>0&&this._invoke(this._neg,t),this._invoke(this._zero,t),this._pos.array.length>0&&this._invoke(this._pos,t)},e}(Ix);function Px(t,e,i){return function(n,r){try{e(n,r)}catch(e){m._throw(e);var s=n.array;for(i&&(s[n.i]._objFlags|=i),++n.i;n.i=0?Sx(this._deferredComps,e):(!t.internalStart||t._objFlags&Ax||this.startInvoker.remove(t),t.internalUpdate&&this.updateInvoker.remove(t),t.internalLateUpdate&&this.lateUpdateInvoker.remove(t))},e.enableComp=function(t,e){if(!(t._objFlags&bx)){if(t.internalOnEnable){if(e)return void e.add(t);if(t.internalOnEnable(),!t.node.activeInHierarchy)return}this._onEnabled(t)}},e.disableComp=function(t){t._objFlags&bx&&(t.internalOnDisable&&t.internalOnDisable(),this._onDisabled(t))},e.startPhase=function(){this._updating=!0,this.startInvoker.invoke(),this._startForNewComps()},e.updatePhase=function(t){this.updateInvoker.invoke(t)},e.lateUpdatePhase=function(t){this.lateUpdateInvoker.invoke(t),this._updating=!1,this._startForNewComps()},e._startForNewComps=function(){this._deferredComps.length>0&&(this._deferredSchedule(),this.startInvoker.invoke())},e._scheduleImmediate=function(t){"function"!=typeof t.internalStart||t._objFlags&Ax||this.startInvoker.add(t),"function"==typeof t.internalUpdate&&this.updateInvoker.add(t),"function"==typeof t.internalLateUpdate&&this.lateUpdateInvoker.add(t)},e._deferredSchedule=function(){for(var t=this._deferredComps,e=0,i=t.length;e1)t.push("t="+this._targetExp+";"),e="t";else{if(1!==this._exps.length)return;e=this._targetExp}for(var i=0;i0&&(i=$x+this.globalVariables.join(",")+";");var n=ul(["return (function(R){",i||[],this.codeArray,"return o;","})"]);this.result=Function("O","F",n)(this.objs,this.funcs);for(var r=0,s=this.objsToClear_iN$t.length;r1){var u=Object.create(null);e.forEach((function(t){u[t._uuid]=t})),r={isCompleted:ED,_map:u}}else r=e[0]}i&&i(t,r)}))},e.getXMLHttpRequest=function(){return new XMLHttpRequest},e.getItem=function(t){return xE.assets.has(t)?{content:xE.assets.get(t)}:null},e.loadRes=function(t,e,i,n){var r=this._parseLoadResArgs(e,i,n),s=r.type,o=r.onProgress,a=r.onComplete,h=Eo(t);h&&!OT.getInfoWithPath(t,s)&&(t=t.slice(0,-h.length)),OT.load(t,s,o,a)},e.loadResArray=function(t,e,i,n){var r=this._parseLoadResArgs(e,i,n),s=r.type,o=r.onProgress,a=r.onComplete;t.forEach((function(e,i){var n=Eo(e);n&&!OT.getInfoWithPath(e,s)&&(t[i]=e.slice(0,-n.length))})),OT.load(t,s,o,a)},e.loadResDir=function(t,e,i,n){var r=this._parseLoadResArgs(e,i,n),s=r.type,o=r.onProgress,a=r.onComplete;OT.loadDir(t,s,o,(function(e,i){var n=[];e||(n=OT.getDirWithPath(t,s).map((function(t){return t.path}))),a&&a(e,i,n)}))},e.getRes=function(t,e){return nf.has(t)?nf.get(t):OT.get(t,e)},e.getResCount=function(){return nf.count},e.getDependsRecursively=function(t){if(!t)return[];var e="string"==typeof t?t:t._uuid;return dg.getDepsRecursively(e).concat([e])},e.addDownloadHandlers=function(t){var e=Object.create(null),i=function(){var i=t[n];e["."+n]=function(t,e,n){i({url:t},n)}};for(var n in t)i();tE.register(e)},e.addLoadHandlers=function(t){var e=Object.create(null),i=function(){var i=t[n];e["."+n]=function(t,e,n){i({content:t},n)}};for(var n in t)i();vE.register(e)},e.release=function(t){if(Array.isArray(t))for(var e=0;ev.x?e[E]:v.x,v.y=e[E+1]>v.y?e[E+1]:v.y,y.x=e[E]v.x?e[E]:v.x,v.y=e[E+1]>v.y?e[E+1]:v.y,v.z=e[E+2]>v.z?e[E+2]:v.z,y.x=e[E]1&&t.csmOptimizationMode===rS.RemoveDuplicates)if(this._level>=h-1)iO=this._castLightViewBoundingBox.halfExtents.z,eO=this._castLightViewBoundingBox.center.z;else{var u=Math.abs(this._castLightViewBoundingBox.center.z-eO)+iO;this._castLightViewBoundingBox.halfExtents.z=Math.max(this._castLightViewBoundingBox.center.z,u)}var c=this._castLightViewBoundingBox.halfExtents.z;this._shadowCameraFar=2*c+r;var l=this._castLightViewBoundingBox.center;if(tO.set(l.x,l.y,l.z+c+r),_n.transformMat4(tO,tO,HD),Ln.fromRT(HD,t.node.rotation,tO),Ln.invert(zD,HD),!i){var _=.5*s,d=.5*o;Ln.ortho(VD,-_,_,-d,d,.1,this._shadowCameraFar,n.capabilities.clipSpaceMinZ,n.capabilities.clipSpaceSignY),Ln.multiply(XD,VD,a),_n.transformMat4(KD,tO,XD);var f=2/e;qD.set(f,f);var p=KD.x%qD.x,g=KD.y%qD.y;QD.set(KD.x-p,KD.y-g,KD.z),Ln.invert(jD,XD),_n.transformMat4(ZD,QD,jD),Ln.fromRT(HD,t.node.rotation,ZD),Ln.invert(zD,HD),Ln.multiply(WD,VD,zD),Ln.copy(this._matShadowView,zD),Ln.copy(this._matShadowProj,VD),Ln.copy(this._matShadowViewProj,WD)}Jo.createOrtho(this._validFrustum,s,o,.1,this._shadowCameraFar,HD)},n(t,[{key:"level",get:function(){return this._level}},{key:"shadowObjects",get:function(){return this._shadowObjects}},{key:"shadowCameraFar",get:function(){return this._shadowCameraFar},set:function(t){this._shadowCameraFar=t}},{key:"matShadowView",get:function(){return this._matShadowView},set:function(t){this._matShadowView=t}},{key:"matShadowProj",get:function(){return this._matShadowProj},set:function(t){this._matShadowProj=t}},{key:"matShadowViewProj",get:function(){return this._matShadowViewProj},set:function(t){this._matShadowViewProj=t}},{key:"validFrustum",get:function(){return this._validFrustum}},{key:"splitFrustum",get:function(){return this._splitFrustum}},{key:"lightViewFrustum",get:function(){return this._lightViewFrustum}},{key:"castLightViewBoundingBox",get:function(){return this._castLightViewBoundingBox}}]),t}(),rO=function(t){function e(e){var i;return(i=t.call(this,e)||this)._splitCameraNear=0,i._splitCameraFar=0,i._csmAtlas=new on,i._calculateAtlas(e),i}s(e,t);var i=e.prototype;return i.destroy=function(){t.prototype.destroy.call(this)},i._calculateAtlas=function(t){var e=m.director.root.device.capabilities.clipSpaceSignY,i=t%2-.5,n=(.5-Math.floor(t/2))*e;this._csmAtlas.set(.5,.5,i,n)},n(e,[{key:"splitCameraNear",get:function(){return this._splitCameraNear},set:function(t){this._splitCameraNear=t}},{key:"splitCameraFar",get:function(){return this._splitCameraFar},set:function(t){this._splitCameraFar=t}},{key:"csmAtlas",get:function(){return this._csmAtlas},set:function(t){this._csmAtlas=t}}]),e}(nO),sO=function(){function t(){this._castShadowObjects=[],this._layerObjects=new js(64),this._layers=[],this._levelCount=0,this._specialLayer=new nO(1),this._shadowDistance=0;for(var t=0;t1?.5*i.size.x:i.size.x;if(!(r<0)){this._getCameraWorldMatrix(GD,t);for(var s=n-1;s>=0;s--){var o=this._layers[s],a=o.splitCameraNear,h=o.splitCameraFar;o.calculateSplitFrustum(t,GD,a,h),o.createMatrix(e,r,!1)}n===nS.LEVEL_1?(this._specialLayer.shadowCameraFar=this._layers[0].shadowCameraFar,Ln.copy(this._specialLayer.matShadowView,this._layers[0].matShadowView),Ln.copy(this._specialLayer.matShadowProj,this._layers[0].matShadowProj),Ln.copy(this._specialLayer.matShadowViewProj,this._layers[0].matShadowViewProj),this._specialLayer.copyToValidFrustum(this._layers[0].validFrustum)):(this._specialLayer.calculateSplitFrustum(t,GD,.1,e.shadowDistance),this._specialLayer.createMatrix(e,r,!0))}},e._getCameraWorldMatrix=function(t,e){if(e.node){var i=e.node,n=i.getWorldPosition(),r=i.getWorldRotation();Ln.fromRT(t,r,n)}},n(t,[{key:"castShadowObjects",get:function(){return this._castShadowObjects}},{key:"layerObjects",get:function(){return this._layerObjects}},{key:"layers",get:function(){return this._layers}},{key:"specialLayer",get:function(){return this._specialLayer}}]),t}(),oO=t("PipelineSceneData",function(){function t(){this.fog=new gS,this.ambient=new Um,this.skybox=new _S,this.shadows=new oS,this.csmLayers=new sO,this.octree=new xI,this.skin=new DI,this.postSettings=new Gb,this.lightProbes=m.internal.LightProbes?new m.internal.LightProbes:null,this.validPunctualLights=[],this.renderObjects=[],this.shadowFrameBufferMap=new Map,this._geometryRendererMaterials=[],this._geometryRendererPasses=[],this._geometryRendererShaders=[],this._occlusionQueryVertexBuffer=null,this._occlusionQueryIndicesBuffer=null,this._occlusionQueryInputAssembler=null,this._occlusionQueryMaterial=null,this._occlusionQueryShader=null,this._isHDR=!0,this._shadingScale=1,this._csmSupported=!0,this._standardSkinMeshRenderer=null,this._standardSkinModel=null,this._skinMaterialModel=null,this._shadingScale=1}var e=t.prototype;return e.activate=function(t){return this._device=t,this.initGeometryRendererMaterials(),this.initOcclusionQuery(),!0},e.initGeometryRendererMaterials=function(){for(var t=0,e=0;e<6;e++){this._geometryRendererMaterials[e]=new $E,this._geometryRendererMaterials[e]._uuid="geometry-renderer-material-"+e,this._geometryRendererMaterials[e].initialize({effectName:"internal/builtin-geometry-renderer",technique:e});for(var i=0;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 v_(vl.VERTEX|vl.TRANSFER_DST,El.DEVICE,n,i)),this._occlusionQueryVertexBuffer.update(e);var r=new Uint16Array([0,2,1,1,2,3,4,5,6,5,7,6,1,3,7,1,7,5,0,4,6,0,6,2,0,1,5,0,5,4,2,6,7,2,7,3]),s=Uint16Array.BYTES_PER_ELEMENT,o=36*s;this._occlusionQueryIndicesBuffer=t.createBuffer(new v_(vl.INDEX|vl.TRANSFER_DST,El.DEVICE,o,s)),this._occlusionQueryIndicesBuffer.update(r);var a=[new L_("a_position",pl.RGB32F)],h=new F_(a,[this._occlusionQueryVertexBuffer],this._occlusionQueryIndicesBuffer);return t.createInputAssembler(h)},n(t,[{key:"isHDR",get:function(){return this._isHDR},set:function(t){this._isHDR=t}},{key:"shadingScale",get:function(){return this._shadingScale},set:function(t){this._shadingScale=t}},{key:"csmSupported",get:function(){return this._csmSupported},set:function(t){this._csmSupported=t}},{key:"standardSkinModel",get:function(){return this._standardSkinModel},set:function(t){this._standardSkinModel=t}},{key:"standardSkinMeshRenderer",get:function(){return this._standardSkinMeshRenderer},set:function(t){this._standardSkinMeshRenderer&&this._standardSkinMeshRenderer!==t&&this._standardSkinMeshRenderer.clearGlobalStandardSkinObjectFlag(),this._standardSkinMeshRenderer=t,this.standardSkinModel=t?t.model:null}},{key:"skinMaterialModel",get:function(){return this._skinMaterialModel},set:function(t){this._skinMaterialModel=t}},{key:"geometryRendererPasses",get:function(){return this._geometryRendererPasses}},{key:"geometryRendererShaders",get:function(){return this._geometryRendererShaders}}]),t}()),aO=jn(),hO=((UD={})[Ie.ORIENTATION_AUTO]=Re.AUTO,UD[Ie.ORIENTATION_LANDSCAPE]=Re.LANDSCAPE,UD[Ie.ORIENTATION_PORTRAIT]=Re.PORTRAIT,UD),uO=t("View",function(t){function e(){var e;(e=t.call(this)||this)._designResolutionSize=jn(0,0),e._scaleX=1,e._scaleY=1,e._viewportRect=Kn(),e._visibleRect=Kn(),e._autoFullScreen=!1,e._retinaEnabled=!1,e._resizeCallback=null;var i=cO,n=lO;return e._rpExactFit=new yO(i.EQUAL_TO_FRAME,n.EXACT_FIT),e._rpShowAll=new yO(i.EQUAL_TO_FRAME,n.SHOW_ALL),e._rpNoBorder=new yO(i.EQUAL_TO_FRAME,n.NO_BORDER),e._rpFixedHeight=new yO(i.EQUAL_TO_FRAME,n.FIXED_HEIGHT),e._rpFixedWidth=new yO(i.EQUAL_TO_FRAME,n.FIXED_WIDTH),e._resolutionPolicy=e._rpShowAll,e}s(e,t);var i=e.prototype;return i.init=function(){var t=Bo.windowSize,e=t.width,i=t.height;this._designResolutionSize.width=e,this._designResolutionSize.height=i,this._viewportRect.width=e,this._viewportRect.height=i,this._visibleRect.width=e,this._visibleRect.height=i,aO.width=this._visibleRect.width,aO.height=this._visibleRect.height,ko&&ko.init(this._visibleRect),this.resizeWithBrowserSize(!0);var n=we.querySettings(Ce.Category.SCREEN,"designResolution");n&&this.setDesignResolutionSize(Number(n.width),Number(n.height),n.policy||yO.FIXED_HEIGHT),Bo.on("window-resize",this._updateAdaptResult,this),Bo.on("fullscreen-change",this._updateAdaptResult,this)},i.resizeWithBrowserSize=function(t){No.handleResizeEvent=t},i.setResizeCallback=function(t){"function"!=typeof t&&null!=t||(this._resizeCallback=t)},i.setOrientation=function(t){No.orientation=hO[t]},i.adjustViewportMeta=function(){},i.enableRetina=function(t){this._retinaEnabled=!!t},i.isRetinaEnabled=function(){return this._retinaEnabled},i.enableAutoFullScreen=function(t){t!==this._autoFullScreen&&(this._autoFullScreen=t,t&&Bo.requestFullScreen().catch((function(){})))},i.isAutoFullScreenEnabled=function(){return this._autoFullScreen},i.setCanvasSize=function(t,e){No.resolutionScale=1;var i=No.devicePixelRatio,n=new Xn(t*i,e*i);Bo.windowSize=n},i.getCanvasSize=function(){return Bo.windowSize},i.getFrameSize=function(){var t=No.devicePixelRatio,e=Bo.windowSize;return e.width/=t,e.height/=t,e},i.setFrameSize=function(t,e){var i=No.devicePixelRatio;Bo.windowSize=new Xn(t*i,e*i)},i.getVisibleSize=function(){return new Xn(this._visibleRect.width,this._visibleRect.height)},i.getVisibleSizeInPixel=function(){return new Xn(this._visibleRect.width*this._scaleX,this._visibleRect.height*this._scaleY)},i.getVisibleOrigin=function(){return new Hn(this._visibleRect.x,this._visibleRect.y)},i.getVisibleOriginInPixel=function(){return new Hn(this._visibleRect.x*this._scaleX,this._visibleRect.y*this._scaleY)},i.getResolutionPolicy=function(){return this._resolutionPolicy},i._updateResolutionPolicy=function(t){if(t instanceof yO)this._resolutionPolicy=t;else{var e=yO;t===e.EXACT_FIT&&(this._resolutionPolicy=this._rpExactFit),t===e.SHOW_ALL&&(this._resolutionPolicy=this._rpShowAll),t===e.NO_BORDER&&(this._resolutionPolicy=this._rpNoBorder),t===e.FIXED_HEIGHT&&(this._resolutionPolicy=this._rpFixedHeight),t===e.FIXED_WIDTH&&(this._resolutionPolicy=this._rpFixedWidth)}},i.setResolutionPolicy=function(t){this._updateResolutionPolicy(t);var e=TO.getDesignResolutionSize();TO.setDesignResolutionSize(e.width,e.height,t)},i.setDesignResolutionSize=function(t,e,i){if(t>0&&e>0){this._updateResolutionPolicy(i);var n=this._resolutionPolicy;n&&n.preApply(this),this._designResolutionSize.width=t,this._designResolutionSize.height=e;var r=n.apply(this,this._designResolutionSize);if(r.scale&&2===r.scale.length&&(this._scaleX=r.scale[0],this._scaleY=r.scale[1]),r.viewport){var s=this._viewportRect,o=this._visibleRect,a=r.viewport;s.x=a.x,s.y=a.y,s.width=a.width,s.height=a.height,o.x=0,o.y=0,o.width=a.width/this._scaleX,o.height=a.height/this._scaleY}n.postApply(this),aO.width=this._visibleRect.width,aO.height=this._visibleRect.height,ko&&ko.init(this._visibleRect),this.emit("design-resolution-changed")}else Z(2200)},i.getDesignResolutionSize=function(){return new Xn(this._designResolutionSize.width,this._designResolutionSize.height)},i.setRealPixelResolution=function(t,e,i){this.setDesignResolutionSize(t,e,i)},i.getViewportRect=function(){return this._viewportRect},i.getScaleX=function(){return this._scaleX},i.getScaleY=function(){return this._scaleY},i.getDevicePixelRatio=function(){return No.devicePixelRatio},i.convertToLocationInView=function(t,e,i,n){void 0===n&&(n=new Hn);var r=No.devicePixelRatio*(t-i.left),s=No.devicePixelRatio*(i.top+i.height-e);return No.isFrameRotated?(n.x=Bo.windowSize.width-s,n.y=r):(n.x=r,n.y=s),n},i._convertToUISpace=function(t){var e=this._viewportRect;t.x=(t.x-e.x)/this._scaleX,t.y=(t.y-e.y)/this._scaleY},i._updateAdaptResult=function(t,e,i){var n;m.director.root.resize(t,e,void 0===i||0===i?1:i);var r=this._designResolutionSize.width,s=this._designResolutionSize.height;t>0&&e>0?this.setDesignResolutionSize(r,s,this._resolutionPolicy):U(!1,"_updateAdaptResult Invalid size."),this.emit("canvas-resize"),null===(n=this._resizeCallback)||void 0===n||n.call(this)},e}(so(Yc)));uO.instance=void 0;var cO=function(){function t(){this.name="ContainerStrategy"}var e=t.prototype;return e.preApply=function(){},e.apply=function(){},e.postApply=function(){},e._setupCanvas=function(){var t=m.game.canvas;if(t){var e=Bo.windowSize;t.width!==e.width&&(t.width=e.width),t.height!==e.height&&(t.height=e.height)}},t}();cO.EQUAL_TO_FRAME=void 0,cO.PROPORTION_TO_FRAME=void 0;var lO=function(){function t(){this.name="ContentStrategy",this._result={scale:[1,1],viewport:null},this._strategy=yO.UNKNOWN}var e=t.prototype;return e.preApply=function(){},e.apply=function(){return{scale:[1,1]}},e.postApply=function(){},e._buildResult=function(t,e,i,n,r,s){Math.abs(t-i)<2&&(i=t),Math.abs(e-n)<2&&(n=e);var o=new Yn(Math.round((t-i)/2),Math.round((e-n)/2),i,n);return this._result.scale=[r,s],this._result.viewport=o,this._result},n(t,[{key:"strategy",get:function(){return this._strategy}}]),t}(),_O=function(t){function e(){var e;return(e=t.call(this)||this).name="EqualToFrame",e}return s(e,t),e.prototype.apply=function(){No.isProportionalToFrame=!1,this._setupCanvas()},e}(cO),dO=function(t){function e(){var e;return(e=t.call(this)||this).name="ProportionalToFrame",e}return s(e,t),e.prototype.apply=function(){No.isProportionalToFrame=!0,this._setupCanvas()},e}(cO);cO.EQUAL_TO_FRAME=new _O,cO.PROPORTION_TO_FRAME=new dO;var fO=function(t){function e(){var e;return(e=t.call(this)||this).name="ExactFit",e._strategy=yO.EXACT_FIT,e}return s(e,t),e.prototype.apply=function(t,e){var i=Bo.windowSize,n=i.width,r=i.height,s=n/e.width,o=r/e.height;return this._buildResult(n,r,n,r,s,o)},e}(lO),pO=function(t){function e(){var e;return(e=t.call(this)||this).name="ShowAll",e._strategy=yO.SHOW_ALL,e}return s(e,t),e.prototype.apply=function(t,e){var i,n,r=Bo.windowSize,s=r.width,o=r.height,a=e.width,h=e.height,u=s/a,c=o/h,l=0;return uthis._startTime?(e-this._startTime)/1e3:0,this._deltaTime>i.DEBUG_DT_THRESHOLD&&(this._deltaTime=this.frameTime/1e3),this._startTime=e,this._deltaTime},r._updateCallback=function(){var t=this;if(this._inited)if(EO.instance.isFinished)if(this._shouldLoadLaunchScene){this._shouldLoadLaunchScene=!1;var e,i=we.querySettings(Ce.Category.LAUNCH,"launchScene");i?DD.loadScene(i,(function(){var e;X(1103,i),t._initTime=performance.now(),DD.startAnimation(),null===(e=t.onStart)||void 0===e||e.call(t)})):(this._initTime=performance.now(),DD.startAnimation(),null===(e=this.onStart)||void 0===e||e.call(this))}else DD.tick(this._calculateDT(!1));else EO.instance.update(this._calculateDT(!1))},r.initPacer=function(){var t,e=null!==(t=we.querySettings(Ce.Category.SCREEN,"frameRate"))&&void 0!==t?t:60;U("number"==typeof e),this._pacer=new OD,this._pacer.onTick=this._updateCallback.bind(this),this.frameRate=e},r._initEvents=function(){go.on("show",this._onShow,this),go.on("hide",this._onHide,this),go.on("close",this._onClose,this)},r._onHide=function(){this.emit(i.EVENT_HIDE),this.pauseByEngine()},r._onShow=function(){this.emit(i.EVENT_SHOW),this.resumeByEngine()},r._onClose=function(){this.emit(i.EVENT_CLOSE),go.exit()},r.addPersistRootNode=function(t){DD.addPersistRootNode(t)},r.removePersistRootNode=function(t){DD.removePersistRootNode(t)},r.isPersistRootNode=function(t){return DD.isPersistRootNode(t)},r._setupRenderPipeline=function(){var t=we.querySettings(Ce.Category.RENDERING,"customPipeline");return this._setRenderPipeline(!!t)},r._setRenderPipeline=function(t){DD.root.setRenderPipeline(t)?(this._rendererInitialized=!0,this._safeEmit(i.EVENT_RENDERER_INITED)):Z(1222)},r._safeEmit=function(t){this.emit(t)},n(i,[{key:"inited",get:function(){return this._inited}},{key:"frameRate",get:function(){return this._frameRate},set:function(t){"number"!=typeof t&&(t=parseInt(t,10),Number.isNaN(t)&&(t=60)),this._frameRate=t,this.frameTime=1e3/t,this._pacer&&(this._pacer.targetFrameRate=this._frameRate)}},{key:"deltaTime",get:function(){return this._useFixedDeltaTime?this.frameTime/1e3:this._deltaTime}},{key:"totalTime",get:function(){return performance.now()-this._initTime}},{key:"frameStartTime",get:function(){return this._startTime}}]),i}(oo));AO.EVENT_HIDE="game_on_hide",AO.EVENT_SHOW="game_on_show",AO.EVENT_LOW_MEMORY="game_on_low_memory",AO.EVENT_GAME_INITED="game_inited",AO.EVENT_ENGINE_INITED="engine_inited",AO.EVENT_RENDERER_INITED="renderer_inited",AO.EVENT_PRE_BASE_INIT="pre_base_init",AO.EVENT_POST_BASE_INIT="post_base_init",AO.EVENT_PRE_INFRASTRUCTURE_INIT="pre_infrastructure_init",AO.EVENT_POST_INFRASTRUCTURE_INIT="post_infrastructure_init",AO.EVENT_PRE_SUBSYSTEM_INIT="pre_subsystem_init",AO.EVENT_POST_SUBSYSTEM_INIT="post_subsystem_init",AO.EVENT_PRE_PROJECT_INIT="pre_project_init",AO.EVENT_POST_PROJECT_INIT="post_project_init",AO.EVENT_RESTART="game_on_restart",AO.EVENT_PAUSE="game_on_pause",AO.EVENT_RESUME="game_on_resume",AO.EVENT_CLOSE="game_on_close",AO.RENDER_TYPE_CANVAS=0,AO.RENDER_TYPE_WEBGL=1,AO.RENDER_TYPE_OPENGL=2,AO.RENDER_TYPE_HEADLESS=3,AO.DEBUG_DT_THRESHOLD=1,m.Game=AO;var bO=t("game",m.game=new AO);ot(ID.prototype,"director",[{name:"calculateDeltaTime"},{name:"getDeltaTime",suggest:"Use game.deltaTime instead"},{name:"getTotalTime",suggest:"Use game.totalTime instead"},{name:"getCurrentTime",suggest:"Use game.frameStartTime instead"}]),st(ID.prototype,"director",[{name:"setAnimationInterval",suggest:"please use game.frameRate instead"},{name:"getAnimationInterval",suggest:"please use game.frameRate instead"},{name:"getRunningScene",suggest:"please use getScene instead"},{name:"setDepthTest",suggest:"please use camera API instead"},{name:"setClearColor",suggest:"please use camera API instead"},{name:"getWinSize",suggest:"please use view.getVisibleSize instead"},{name:"getWinSizeInPixels"},{name:"purgeCachedData",suggest:"please use assetManager.releaseAll instead"},{name:"convertToGL"},{name:"convertToUI"}]),rt(DD,"director",[{name:"_getSceneUuid",targetName:"assetManager.main",newName:"getSceneInfo",customFunction:function(t){var e;return xE.main?null===(e=xE.main.getSceneInfo(t))||void 0===e?void 0:e.uuid:""}}]),ot(bO,"game",[{name:"collisionMatrix"},{name:"groupList"}]),rt(bO,"game",[{name:"_sceneInfos",targetName:"assetManager.main",newName:"getSceneInfo",customGetter:function(){var t=[];return xE.main&&xE.main.config.scenes.forEach((function(e){t.push(e)})),t}}]);var CO=t("DynamicAtlasManager",function(t){function e(){var e;return(e=t.call(this)||this)._atlases=[],e._atlasIndex=-1,e._maxAtlasCount=5,e._textureSize=2048,e._maxFrameSize=512,e._textureBleeding=!0,e._enabled=!1,e}s(e,t);var i=e.prototype;return i.newAtlas=function(){var t=this._atlases[++this._atlasIndex];return!t&&this._atlasIndex=this._maxAtlasCount||!t||t.original)return null;if(!t.packable)return null;var e=t.texture.getSamplerInfo();if(e.minFilter!==Il.LINEAR||e.magFilter!==Il.LINEAR||e.mipFilter!==Il.NONE)return null;var i=this._atlases[this._atlasIndex];i||(i=this.newAtlas());var n=i?i.insertSpriteFrame(t):null;return!n&&this._atlasIndex=0;e--)this._atlases[e].removeSpriteFrame(t);var i=t.original._texture;this.deleteAtlasTexture(i)}},i.deleteAtlasTexture=function(t){if(t)for(var e=this._atlases.length-1;e>=0;e--)this._atlases[e].deleteInnerTexture(t),this._atlases[e].isEmpty()&&(this._atlases[e].destroy(),this._atlases.splice(e,1),this._atlasIndex--)},i.packToDynamicAtlas=function(t,e){if(this._enabled&&e&&!e.original&&e.packable&&e.texture&&e.texture.width>0&&e.texture.height>0){var i=this.insertSpriteFrame(e);i&&e._setDynamicAtlasFrame(i)}},n(e,[{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled!==t&&(t?(this.reset(),m.director.on(m.Director.EVENT_BEFORE_SCENE_LAUNCH,this.beforeSceneLoad,this)):(this.reset(),m.director.off(m.Director.EVENT_BEFORE_SCENE_LAUNCH,this.beforeSceneLoad,this)),this._enabled=t)}},{key:"maxAtlasCount",get:function(){return this._maxAtlasCount},set:function(t){this._maxAtlasCount=t}},{key:"atlasCount",get:function(){return this._atlases.length}},{key:"textureBleeding",get:function(){return this._textureBleeding},set:function(t){this._textureBleeding=t}},{key:"textureSize",get:function(){return this._textureSize},set:function(t){this._textureSize=t}},{key:"maxFrameSize",get:function(){return this._maxFrameSize},set:function(t){this._maxFrameSize=t}}]),e}(Yc));CO.instance=void 0;var RO,wO=t("dynamicAtlasManager",CO.instance=new CO);DD.registerSystem("dynamicAtlasManager",wO,0),m.internal.dynamicAtlasManager=wO,function(t){t[t.positions=e_.ATTR_POSITION]="positions",t[t.normals=e_.ATTR_NORMAL]="normals",t[t.uvs=e_.ATTR_TEX_COORD]="uvs",t[t.colors=e_.ATTR_COLOR]="colors"}(RO||(RO={}));var IO,xO=function(){function t(){this._arrayBufferOrPaddings=[],this._length=0}var e=t.prototype;return e.setNextAlignment=function(t){if(0!==t){var e=this._length%t;if(0!==e){var i=t-e;this._arrayBufferOrPaddings.push(i),this._length+=i}}},e.addBuffer=function(t){var e=this._length;return this._arrayBufferOrPaddings.push(t),this._length+=t.byteLength,e},e.getLength=function(){return this._length},e.getCombined=function(){var t=new Uint8Array(this._length),e=0;return this._arrayBufferOrPaddings.forEach((function(i){"number"==typeof i?e+=i:(t.set(new Uint8Array(i),e),e+=i.byteLength)})),t.buffer},t}(),DO=function(){function t(t,e){if(this._subMeshRenderings=[],this._mesh=t,this._mesh.struct.morph){var i=this._mesh.struct.primitives.length;this._subMeshRenderings=new Array(i).fill(null);for(var n=0;nCv.MAX_MORPH_TARGET_COUNT?this._subMeshRenderings[n]=new PO(this._mesh,n,this._mesh.struct.morph,e):this._subMeshRenderings[n]=new OO(this._mesh,n,this._mesh.struct.morph,e))}}}return t.prototype.createInstance=function(){for(var t=this,e=this._mesh.struct.primitives.length,i=new Array(e),n=0;n>1;return{width:1<<(1&e?i+1:i),height:1<>>0;t=n}for(var r,s=1,o=0,a=t.length,h=0;0>>0}function a(e,i){this.index="number"==typeof i?i:0,this.i=0,this.buffer=e instanceof(s?Uint8Array:Array)?e:new(s?Uint8Array:Array)(32768),2*this.buffer.length<=this.index&&t(Error("invalid index")),this.buffer.length<=this.index&&this.f()}a.prototype.f=function(){var t,e=this.buffer,i=e.length,n=new(s?Uint8Array:Array)(i<<1);if(s)n.set(e);else for(t=0;t>>8&255]<<16|d[t>>>16&255]<<8|d[t>>>24&255])>>32-e:d[t]>>8-e),8>e+o)a=a<>e-n-1&1,8==++o&&(o=0,r[s++]=d[a],a=0,s===r.length&&(r=this.f()));r[s]=a,this.buffer=r,this.i=o,this.index=s},a.prototype.finish=function(){var t,e=this.buffer,i=this.index;return 0h;++h){for(var c=_=h,l=7,_=_>>>1;_;_>>>=1)c<<=1,c|=1&_,--l;u[h]=(c<>>0}var d=u;function f(t){this.buffer=new(s?Uint16Array:Array)(2*t),this.length=0}function p(t){var e,i,n,r,o,a,h,u,c,l=t.length,_=0,d=Number.POSITIVE_INFINITY;for(u=0;u_&&(_=t[u]),t[u]>=1;for(c=a;cs[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 m,v=2,y={NONE:0,r:1,j:v,N:3},T=[];for(m=0;288>m;m++)switch(i){case 143>=m:T.push([m+48,8]);break;case 255>=m:T.push([m-144+400,9]);break;case 279>=m:T.push([m-256+0,7]);break;case 287>=m:T.push([m-280+192,8]);break;default:t("invalid literal: "+m)}function E(t,e){this.length=t,this.G=e}function S(){var e=A;switch(i){case 3===e:return[257,e-3,0];case 4===e:return[258,e-4,0];case 5===e:return[259,e-5,0];case 6===e:return[260,e-6,0];case 7===e:return[261,e-7,0];case 8===e:return[262,e-8,0];case 9===e:return[263,e-9,0];case 10===e:return[264,e-10,0];case 12>=e:return[265,e-11,1];case 14>=e:return[266,e-13,1];case 16>=e:return[267,e-15,1];case 18>=e:return[268,e-17,1];case 22>=e:return[269,e-19,2];case 26>=e:return[270,e-23,2];case 30>=e:return[271,e-27,2];case 34>=e:return[272,e-31,2];case 42>=e:return[273,e-35,3];case 50>=e:return[274,e-43,3];case 58>=e:return[275,e-51,3];case 66>=e:return[276,e-59,3];case 82>=e:return[277,e-67,4];case 98>=e:return[278,e-83,4];case 114>=e:return[279,e-99,4];case 130>=e:return[280,e-115,4];case 162>=e:return[281,e-131,5];case 194>=e:return[282,e-163,5];case 226>=e:return[283,e-195,5];case 257>=e:return[284,e-227,5];case 258===e:return[285,e-258,0];default:t("invalid length: "+e)}}g.prototype.n=function(){var n,r,o,h,u=this.input;switch(this.h){case 0:for(o=0,h=u.length;o>>8&255,m[y++]=255&_,m[y++]=_>>>8&255,s)m.set(d,y),y+=d.length,m=m.subarray(0,y);else{for(p=0,g=d.length;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(M=19;4=A;A++)b=S(),C[A]=b[2]<<24|b[1]<<16|b[0];var R=s?new Uint32Array(C):C;function w(n,r){function o(e,n){var r,s,o,a,h=e.G,u=[],c=0;switch(r=R[e.length],u[c++]=65535&r,u[c++]=r>>16&255,u[c++]=r>>24,i){case 1===h:s=[0,h-1,0];break;case 2===h:s=[1,h-2,0];break;case 3===h:s=[2,h-3,0];break;case 4===h:s=[3,h-4,0];break;case 6>=h:s=[4,h-5,1];break;case 8>=h:s=[5,h-7,1];break;case 12>=h:s=[6,h-9,2];break;case 16>=h:s=[7,h-13,2];break;case 24>=h:s=[8,h-17,3];break;case 32>=h:s=[9,h-25,3];break;case 48>=h:s=[10,h-33,4];break;case 64>=h:s=[11,h-49,4];break;case 96>=h:s=[12,h-65,5];break;case 128>=h:s=[13,h-97,5];break;case 192>=h:s=[14,h-129,6];break;case 256>=h:s=[15,h-193,6];break;case 384>=h:s=[16,h-257,7];break;case 512>=h:s=[17,h-385,7];break;case 768>=h:s=[18,h-513,8];break;case 1024>=h:s=[19,h-769,8];break;case 1536>=h:s=[20,h-1025,9];break;case 2048>=h:s=[21,h-1537,9];break;case 3072>=h:s=[22,h-2049,10];break;case 4096>=h:s=[23,h-3073,10];break;case 6144>=h:s=[24,h-4097,11];break;case 8192>=h:s=[25,h-6145,11];break;case 12288>=h:s=[26,h-8193,12];break;case 16384>=h:s=[27,h-12289,12];break;case 24576>=h:s=[28,h-16385,13];break;case 32768>=h:s=[29,h-24577,13];break;default:t("invalid distance")}for(r=s,u[c++]=r[0],u[c++]=r[1],u[c++]=r[2],o=0,a=u.length;o=u;)T[u++]=0;for(u=0;29>=u;)S[u++]=0}for(T[256]=1,a=0,h=r.length;a=h){for(f&&o(f,-1),u=0,c=h-a;uI&&a+Iw&&(C=b,w=I),258===I)break}d=new E(w,a-C),f?f.length2*y[d-1]+T[d]&&(y[d]=2*y[d-1]+T[d]),S[d]=Array(y[d]),A[d]=Array(y[d]);for(_=0;_r[_]?(S[d][p]=g,A[d][p]=v,m+=2):(S[d][p]=r[_],A[d][p]=_,++_);b[d]=0,1===T[d]&&i(d)}for(o=E,a=0,h=n.length;a1<c&&t("undercommitted"),i=0,n=e.length;i>>=1;return a}function D(t,e){this.input=t,this.a=new(s?Uint8Array:Array)(32768),this.h=O.j;var i,n={};for(i in!e&&(e={})||"number"!=typeof e.compressionType||(this.h=e.compressionType),e)n[i]=e[i];n.outputBuffer=this.a,this.z=new g(this.input,n)}var O=y;function P(e,i){switch(this.k=[],this.l=32768,this.e=this.g=this.c=this.q=0,this.input=s?new Uint8Array(e):e,this.s=!1,this.m=N,this.B=!1,!i&&(i={})||(i.index&&(this.c=i.index),i.bufferSize&&(this.l=i.bufferSize),i.bufferType&&(this.m=i.bufferType),i.resize&&(this.B=i.resize)),this.m){case M:this.b=32768,this.a=new(s?Uint8Array:Array)(32768+this.l+258);break;case N:this.b=0,this.a=new(s?Uint8Array:Array)(this.l),this.f=this.J,this.t=this.H,this.o=this.I;break;default:t(Error("invalid inflate mode"))}}D.prototype.n=function(){var e,i,n,r,a,h,u,c=0;switch(u=this.a,e=ct){case ct:i=Math.LOG2E*Math.log(32768)-8;break;default:t(Error("invalid compression method"))}switch(n=i<<4|e,u[c++]=n,e){case ct:switch(this.h){case O.NONE:a=0;break;case O.r:a=1;break;case O.j:a=2;break;default:t(Error("unsupported compression type"))}break;default:t(Error("invalid compression method"))}return r=a<<6|0,u[c++]=r|31-(256*n+r)%31,h=o(this.input),this.z.b=c,c=(u=this.z.n()).length,s&&((u=new Uint8Array(u.buffer)).length<=c+4&&(this.a=new Uint8Array(u.length+4),this.a.set(u),u=this.a),u=u.subarray(0,c+4)),u[c++]=h>>24&255,u[c++]=h>>16&255,u[c++]=h>>8&255,u[c++]=255&h,u},r("Zlib.Deflate",D),r("Zlib.Deflate.compress",(function(t,e){return new D(t,e).n()})),r("Zlib.Deflate.CompressionType",O),r("Zlib.Deflate.CompressionType.NONE",O.NONE),r("Zlib.Deflate.CompressionType.FIXED",O.r),r("Zlib.Deflate.CompressionType.DYNAMIC",O.j);var M=0,N=1,L={D:M,C:N};P.prototype.p=function(){for(;!this.s;){var n=tt(this,3);switch(1&n&&(this.s=i),n>>>=1){case 0:var r=this.input,o=this.c,a=this.a,h=this.b,u=e,c=e,l=e,_=a.length,d=e;switch(this.e=this.g=0,(u=r[o++])===e&&t(Error("invalid uncompressed block header: LEN (first byte)")),c=u,(u=r[o++])===e&&t(Error("invalid uncompressed block header: LEN (second byte)")),c|=u<<8,(u=r[o++])===e&&t(Error("invalid uncompressed block header: NLEN (first byte)")),l=u,(u=r[o++])===e&&t(Error("invalid uncompressed block header: NLEN (second byte)")),c===~(l|=u<<8)&&t(Error("invalid uncompressed block header: length verify")),o+c>r.length&&t(Error("input buffer is broken")),this.m){case M:for(;h+c>a.length;){if(c-=d=_-h,s)a.set(r.subarray(o,o+d),h),h+=d,o+=d;else for(;d--;)a[h++]=r[o++];this.b=h,a=this.f(),h=this.b}break;case N:for(;h+c>a.length;)a=this.f({v:2});break;default:t(Error("invalid inflate mode"))}if(s)a.set(r.subarray(o,o+c),h),h+=c,o+=c;else for(;c--;)a[h++]=r[o++];this.c=o,this.b=h,this.a=a;break;case 1:this.o(Z,$);break;case 2:it(this);break;default:t(Error("unknown BTYPE: "+n))}}return this.t()};var B,F,k=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],U=s?new Uint16Array(k):k,G=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,258,258],H=s?new Uint16Array(G):G,z=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0],V=s?new Uint8Array(z):z,W=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],X=s?new Uint16Array(W):W,j=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],Y=s?new Uint8Array(j):j,K=new(s?Uint8Array:Array)(288);for(B=0,F=K.length;B=B?8:255>=B?9:279>=B?7:8;var q,Q,Z=p(K),J=new(s?Uint8Array:Array)(30);for(q=0,Q=J.length;q>>n,i.e=o-n,i.c=h,r}function et(i,n){for(var r,s,o,a=i.g,h=i.e,u=i.input,c=i.c,l=n[0],_=n[1];h<_;)(r=u[c++])===e&&t(Error("input buffer is broken")),a|=r<>>16,i.g=a>>o,i.e=h-o,i.c=c,65535&s}function it(t){function e(t,e,i){var n,r,s,o;for(o=0;or)n>=h&&(this.b=n,i=this.f(),n=this.b),i[n++]=r;else for(a=H[s=r-257],0=h&&(this.b=n,i=this.f(),n=this.b);a--;)i[n]=i[n++-o];for(;8<=this.e;)this.e-=8,this.c--;this.b=n},P.prototype.I=function(t,e){var i=this.a,n=this.b;this.u=t;for(var r,s,o,a,h=i.length;256!==(r=et(this,t));)if(256>r)n>=h&&(h=(i=this.f()).length),i[n++]=r;else for(a=H[s=r-257],0h&&(h=(i=this.f()).length);a--;)i[n]=i[n++-o];for(;8<=this.e;)this.e-=8,this.c--;this.b=n},P.prototype.f=function(){var t,e,i=new(s?Uint8Array:Array)(this.b-32768),n=this.b-32768,r=this.a;if(s)i.set(r.subarray(32768,i.length));else for(t=0,e=i.length;tt;++t)r[t]=r[n+t];return this.b=32768,r},P.prototype.J=function(t){var e,i,n,r=this.input.length/this.c+1|0,o=this.input,a=this.a;return t&&("number"==typeof t.v&&(r=t.v),"number"==typeof t.F&&(r+=t.F)),i=2>r?(n=(o.length-this.c)/this.u[2]/2*258|0)e&&(this.a.length=e),t=this.a),this.buffer=t},nt.prototype.p=function(){var e,i=this.input;return e=this.A.p(),this.c=this.A.c,this.M&&(i[this.c++]<<24|i[this.c++]<<16|i[this.c++]<<8|i[this.c++])>>>0!==o(e)&&t(Error("invalid adler-32 checksum")),e},r("Zlib.Inflate",nt),r("Zlib.Inflate.BufferType",L),L.ADAPTIVE=L.C,L.BLOCK=L.D,r("Zlib.Inflate.prototype.decompress",nt.prototype.p);var rt,st,ot=new(s?Uint8Array:Array)(288);for(rt=0,st=ot.length;rt=rt?8:255>=rt?9:279>=rt?7:8;p(ot);var at,ht,ut=new(s?Uint8Array:Array)(30);for(at=0,ht=ut.length;at=65536){q(10001,L,65536);continue}M>>=1,N>>=1}D=b.createBuffer(new v_(vl.INDEX,El.DEVICE,N,M)),R.push(D),O=new(YO(P.stride))(A,P.offset,P.count),P.stride!==M&&(O=YO(M).from(O)),D.update(O)}var B=x.vertexBundelIndices.map((function(t){return C[t]})),F=[];if(x.vertexBundelIndices.length>0)for(var k=x.vertexBundelIndices[0],U=this._struct.vertexBundles[k].attributes,G=0;G=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&&(g.set(m),v.update(m,p)),l.view.count=f,h.vertexCount=f}if(o.indexView){var y=o.indexView,T=y.stride,E=2===T?e.indices16.length:e.indices32.length,S=E*T,A=new Uint8Array(this._data.buffer,y.offset,S),b=2===T?new Uint8Array(e.indices16.buffer,e.indices16.byteOffset,S):new Uint8Array(e.indices32.buffer,e.indices32.byteOffset,S),C=a.indexBuffer;s.maxSubMeshIndices,S>0&&(A.set(b),C.update(b,S)),y.count=E,h.indexCount=E}if(e.minPos&&e.maxPos){var R=new _n(e.minPos.x,e.minPos.y,e.minPos.z),w=new _n(e.maxPos.x,e.maxPos.y,e.maxPos.z);r.bounds[t]||(r.bounds[t]=new Xo),Xo.fromPoints(r.bounds[t],R,w);for(var I,x=new _n,D=new _n,O=d(r.bounds);!(I=O()).done;){var P=I.value;P&&(P.getBoundary(x,D),_n.min(R,x,R),_n.max(w,D,w))}this._struct.minPosition=new _n(R.x,R.y,R.z),this._struct.maxPosition=new _n(w.x,w.y,w.z)}a.invalidateGeometricInfo()}else q(14200)},i.destroy=function(){return this.destroyRenderingMesh(),t.prototype.destroy.call(this)},i.destroyRenderingMesh=function(){if(this._renderingSubMeshes){for(var t=0;t=n.length)){_n.transformMat4(qO,KO,n[f]),i[f]=!0;var p=e[f];_n.min(p.center,p.center,qO),_n.max(p.halfExtents,p.halfExtents,qO)}}}}for(var g=0;g=this._struct.primitives.length)return null;var e=this._struct.primitives[t];if(!e.indexView)return null;var i=e.indexView.stride;return new(1===i?Uint8Array:2===i?Uint16Array:Uint32Array)(this._data.buffer,e.indexView.offset,e.indexView.count)},i.copyIndices=function(t,e){if(t>=this._struct.primitives.length)return!1;var i=this._struct.primitives[t];if(!i.indexView)return!1;for(var n=i.indexView.count,r=1===i.indexView.stride?pl.R8UI:2===i.indexView.stride?pl.R16UI:pl.R32UI,s=eP(new DataView(this._data.buffer),r),o=0;o=this._struct.primitives.length))for(var n,r=d(this._struct.primitives[t].vertexBundelIndices);!(n=r()).done;){var s=n.value,o=this._struct.vertexBundles[s],a=o.attributes.findIndex((function(t){return t.name===e}));if(!(a<0)){i(o,a);break}}},i._createVertexBuffers=function(t,e){return this._struct.vertexBundles.map((function(i){var n=t.createBuffer(new v_(vl.VERTEX,El.DEVICE,i.view.length,i.view.stride)),r=new Uint8Array(e,i.view.offset,i.view.length);return n.update(r),n}))},i.initDefault=function(e){t.prototype.initDefault.call(this,e),this.reset({struct:{vertexBundles:[],primitives:[]},data:QO})},i.releaseData=function(){this._data=QO},n(e,[{key:"_nativeAsset",get:function(){return this._data.buffer},set:function(t){this._data=new Uint8Array(t)}},{key:"subMeshCount",get:function(){var t=this.renderingSubMeshes;return t?t.length:0}},{key:"minPosition",get:function(){return this.struct.minPosition}},{key:"maxPosition",get:function(){return this.struct.maxPosition}},{key:"struct",get:function(){return this._struct}},{key:"data",get:function(){return this._data}},{key:"hash",get:function(){return this._hash||(this._hash=nl(this._data,666)),this._hash}},{key:"jointBufferIndices",get:function(){return this._jointBufferIndices?this._jointBufferIndices:this._jointBufferIndices=this._struct.primitives.map((function(t){return t.jointMapIndex||0}))}},{key:"renderingSubMeshes",get:function(){return this.initialize(),this._renderingSubMeshes}},{key:"allowDataAccess",get:function(){return this._allowDataAccess},set:function(t){this._allowDataAccess=t,this._isMeshDataUploaded&&!this._allowDataAccess&&this.releaseData()}}]),e}(Of),VO=ua(zO.prototype,"_struct",[wa],(function(){return{vertexBundles:[],primitives:[]}})),WO=ua(zO.prototype,"_hash",[wa],(function(){return 0})),XO=ua(zO.prototype,"_allowDataAccess",[wa],(function(){return!0})),HO=zO))||HO);function JO(t,e){for(var i=0,n=0;n0){if(n=null,t.attributes)for(var u,c=d(t.attributes);!(u=c()).done;){var l=u.value;if(l.name===e_.ATTR_POSITION){n=l;break}}n||(n=sP[0]),r.push(n);var _=od[n.format];a=Math.max(a,Math.floor(h.length/_.count)),o.push({offset:s,data:h,attribute:n}),s+=_.size}if(t.normals&&t.normals.length>0){if(n=null,t.attributes)for(var f,p=d(t.attributes);!(f=p()).done;){var g=f.value;if(g.name===e_.ATTR_NORMAL){n=g;break}}n||(n=sP[1]);var m=od[n.format];r.push(n),a=Math.max(a,Math.floor(t.normals.length/m.count)),o.push({offset:s,data:t.normals,attribute:n}),s+=m.size}if(t.uvs&&t.uvs.length>0){if(n=null,t.attributes)for(var v,y=d(t.attributes);!(v=y()).done;){var T=v.value;if(T.name===e_.ATTR_TEX_COORD){n=T;break}}n||(n=sP[2]);var E=od[n.format];r.push(n),a=Math.max(a,Math.floor(t.uvs.length/E.count)),o.push({offset:s,data:t.uvs,attribute:n}),s+=E.size}if(t.tangents&&t.tangents.length>0){if(n=null,t.attributes)for(var S,A=d(t.attributes);!(S=A()).done;){var b=S.value;if(b.name===e_.ATTR_TANGENT){n=b;break}}n||(n=sP[3]);var C=od[n.format];r.push(n),a=Math.max(a,Math.floor(t.tangents.length/C.count)),o.push({offset:s,data:t.tangents,attribute:n}),s+=C.size}if(t.colors&&t.colors.length>0){if(n=null,t.attributes)for(var R,w=d(t.attributes);!(R=w()).done;){var I=R.value;if(I.name===e_.ATTR_COLOR){n=I;break}}n||(n=sP[4]);var x=od[n.format];r.push(n),a=Math.max(a,Math.floor(t.colors.length/x.count)),o.push({offset:s,data:t.colors,attribute:n}),s+=x.size}if(t.customAttributes)for(var D=0;D0){var i=t%e;if(0!==i)return e-i}return 0}var uP,cP,lP=function(){function t(){}return t.createMesh=function(t,e,i){return aP(t,e,i)},t.createDynamicMesh=function(t,e,i,n){return function(t,e,i,n){n=n||{maxSubMeshes:1,maxSubMeshVertices:1024,maxSubMeshIndices:1024};var r=[],s=0;if(e.positions.length>0&&r.push(new L_(e_.ATTR_POSITION,pl.RGB32F,!1,s++,!1,0)),e.normals&&e.normals.length>0&&r.push(new L_(e_.ATTR_NORMAL,pl.RGB32F,!1,s++,!1,0)),e.uvs&&e.uvs.length>0&&r.push(new L_(e_.ATTR_TEX_COORD,pl.RG32F,!1,s++,!1,0)),e.tangents&&e.tangents.length>0&&r.push(new L_(e_.ATTR_TANGENT,pl.RGBA32F,!1,s++,!1,0)),e.colors&&e.colors.length>0&&r.push(new L_(e_.ATTR_COLOR,pl.RGBA32F,!1,s++,!1,0)),e.customAttributes)for(var o=0;o0?S=2:e.indices32&&e.indices32.length>0&&(S=4),S>0){l+=hP(l,S);var A=n.maxSubMeshIndices*S,b={offset:l,length:A,count:0,stride:S};p.indexView=b,l+=A}c.push(p)}var C={info:{maxSubMeshes:n.maxSubMeshes,maxSubMeshVertices:n.maxSubMeshVertices,maxSubMeshIndices:n.maxSubMeshIndices},bounds:[]};C.bounds.length=n.maxSubMeshes;var R={struct:{vertexBundles:u,primitives:c,dynamic:C},data:new Uint8Array(l)};return i||(i=new ZO),i.reset(R),i.initialize(),i.updateSubMesh(t,e),i}(t,e,i,n)},t.decodeMesh=function(t){return nP(t)},t.inflateMesh=function(t){return rP(t)},t}(),_P=Object.freeze({__proto__:null,find:Ex,toPPM:function(t,e,i){return"P3 "+e+" "+i+" 255\n"+t.filter((function(t,e){return e%4<3})).toString()+"\n"},readMesh:function(t,e){void 0===e&&(e=0);for(var i,n={positions:[]},r=new DataView(t.data.buffer,t.data.byteOffset,t.data.byteLength),s=t.struct,o=s.primitives[e],a=d(o.vertexBundelIndices);!(i=a()).done;)for(var h,u=i.value,c=s.vertexBundles[u],l=c.view.offset,_=c.view,f=_.length,p=_.stride,g=d(c.attributes);!(h=g()).done;){var m=h.value,v=RO[m.name];v&&(n[v]=(n[v]||[]).concat(BD(r,m.format,l,f,p))),l+=od[m.format].size}var y=o.indexView;return n.indices=BD(r,pl["R"+8*y.stride+"UI"],y.offset,y.length),n},createMesh:aP,MeshUtils:lP,readBuffer:BD,writeBuffer:LD,mapBuffer:FD});t("utils",_P);var dP,fP=dn(),pP=Un();!function(t){t[t.RECT=0]="RECT",t[t.POLYGON=1]="POLYGON"}(dP||(dP={}));var gP,mP,vP,yP=[{u:0,v:0},{u:0,v:0},{u:0,v:0},{u:0,v:0}],TP=t("SpriteFrame",va("cc.SpriteFrame")(((cP=function(t){function e(){var e;return(e=t.call(this)||this).vertices=null,e.uv=[],e.unbiasUV=[],e.uvSliced=[],e._rect=Kn(),e._trimmedBorder=an(),e._offset=zn(),e._originalSize=jn(),e._rotated=!1,e._capInsets=[0,0,0,0],e._atlasUuid="",e._texture=void 0,e._isFlipUVY=!1,e._isFlipUVX=!1,e._original=null,e._packable=!0,e._pixelsToUnit=100,e._pivot=zn(.5,.5),e._meshType=dP.RECT,e._extrude=0,e._customOutLine=[],e._mesh=null,e._minPos=dn(),e._maxPos=dn(),e}s(e,t),e.createWithImage=function(t){var i=t instanceof $f?t:new $f(t),n=new Sg;n.image=i;var r=new e;return r.texture=n,r};var i=e.prototype;return i.textureLoaded=function(){return!!this.texture},i.isRotated=function(){return this._rotated},i.setRotated=function(t){this.rotated=t},i.getRect=function(t){return t?(t.set(this._rect),t):this._rect.clone()},i.setRect=function(t){this.rect=t},i.getOriginalSize=function(t){return t?(t.set(this._originalSize),t):this._originalSize.clone()},i.setOriginalSize=function(t){this.originalSize=t},i.getOffset=function(t){return t?(t.set(this._offset),t):this._offset.clone()},i.setOffset=function(t){this.offset=t},i.getGFXTexture=function(){return this._texture.getGFXTexture()},i.getGFXSampler=function(){return this._texture.getGFXSampler()},i.getHash=function(){return this._texture.getHash()},i.getSamplerInfo=function(){return this._texture.getSamplerInfo()},i.reset=function(t,e){void 0===e&&(e=!1);var i=!1;e&&(this._originalSize.set(0,0),this._rect.set(0,0,0,0),this._offset.set(0,0),this._capInsets=[0,0,0,0],this._rotated=!1,i=!0),t&&(t.texture&&(this._rect.x=this._rect.y=0,this._rect.width=t.texture.width,this._rect.height=t.texture.height,this._refreshTexture(t.texture),this.checkRect(this._texture)),t.originalSize&&this._originalSize.set(t.originalSize),t.rect&&this._rect.set(t.rect),t.offset&&this._offset.set(t.offset),void 0!==t.borderTop&&(this._capInsets[1]=t.borderTop),void 0!==t.borderBottom&&(this._capInsets[3]=t.borderBottom),void 0!==t.borderLeft&&(this._capInsets[0]=t.borderLeft),void 0!==t.borderRight&&(this._capInsets[2]=t.borderRight),void 0!==t.isRotate&&(this._rotated=!!t.isRotate),void 0!==t.isFlipUv&&(this._isFlipUVY=!!t.isFlipUv),i=!0),i&&this.texture&&this._calculateUV(),this._calcTrimmedBorder()},i.checkRect=function(t){var e=this._rect,i=e.x,n=e.y;return this._rotated?(i+=e.height,n+=e.width):(i+=e.width,n+=e.height),i>t.width?(Z(3300,this.name+"/"+t.name,i,t.width),!1):!(n>t.height&&(Z(3301,this.name+"/"+t.name,n,t.height),1))},i._calcTrimmedBorder=function(){var t=this._originalSize.width,e=this._originalSize.height,i=.5*(t-this._rect.width),n=.5*(e-this._rect.height);this._trimmedBorder.x=this._offset.x+i,this._trimmedBorder.y=this._offset.x-i,this._trimmedBorder.z=this._offset.y+n,this._trimmedBorder.w=this._offset.y-n},i.ensureMeshData=function(){this._mesh||(this._initVertices(),this._createMesh())},i.destroy=function(){return this._packable&&wO&&wO.deleteAtlasSpriteFrame(this),t.prototype.destroy.call(this)},i._calculateSlicedUV=function(){var t=this._rect,i=this.texture,n=i.width,r=i.height,s=this._capInsets[0],o=this._capInsets[2],a=t.width-s-o,h=this._capInsets[1],u=this._capInsets[3],c=t.height-h-u,l=this.uvSliced;if(l.length=0,this._rotated){yP[0].u=t.x/n,yP[1].u=(t.x+u)/n,yP[2].u=(t.x+u+c)/n,yP[3].u=(t.x+t.height)/n,yP[3].v=t.y/r,yP[2].v=(t.y+s)/r,yP[1].v=(t.y+s+a)/r,yP[0].v=(t.y+t.width)/r;for(var _=0;_<4;++_)for(var d=yP[_],f=0;f<4;++f){var p=yP[3-f];l.push({u:d.u,v:p.v})}}else{yP[0].u=t.x/n,yP[1].u=(t.x+s)/n,yP[2].u=(t.x+s+a)/n,yP[3].u=(t.x+t.width)/n,yP[3].v=t.y/r,yP[2].v=(t.y+h)/r,yP[1].v=(t.y+h+c)/r,yP[0].v=(t.y+t.height)/r;for(var g=0;g<4;++g)for(var m=yP[g],v=0;v<4;++v){var y=yP[v];l.push({u:y.u,v:m.v})}}this.emit(e.EVENT_UV_UPDATED,this)},i._calculateUV=function(){var t=this._rect,e=this.uv,i=this.unbiasUV,n=this.texture,r=n.width,s=n.height;if(this._rotated){var o=0===r?0:t.x/r,a=0===r?1:(t.x+t.height)/r,h=0===s?0:t.y/s,u=0===s?1:(t.y+t.width)/s;this._isFlipUVX&&this._isFlipUVY?(e[0]=a,e[1]=u,e[2]=a,e[3]=h,e[4]=o,e[5]=u,e[6]=o,e[7]=h):this._isFlipUVX?(e[0]=a,e[1]=h,e[2]=a,e[3]=u,e[4]=o,e[5]=h,e[6]=o,e[7]=u):this._isFlipUVY?(e[0]=o,e[1]=u,e[2]=o,e[3]=h,e[4]=a,e[5]=u,e[6]=a,e[7]=h):(e[0]=o,e[1]=h,e[2]=o,e[3]=u,e[4]=a,e[5]=h,e[6]=a,e[7]=u);var c=0===r?0:t.x/r,l=0===r?1:(t.x+t.height)/r,_=0===s?0:t.y/s,d=0===s?1:(t.y+t.width)/s;this._isFlipUVX&&this._isFlipUVY?(i[0]=l,i[1]=d,i[2]=l,i[3]=_,i[4]=c,i[5]=d,i[6]=c,i[7]=_):this._isFlipUVX?(i[0]=l,i[1]=_,i[2]=l,i[3]=d,i[4]=c,i[5]=_,i[6]=c,i[7]=d):this._isFlipUVY?(i[0]=c,i[1]=d,i[2]=c,i[3]=_,i[4]=l,i[5]=d,i[6]=l,i[7]=_):(i[0]=c,i[1]=_,i[2]=c,i[3]=d,i[4]=l,i[5]=_,i[6]=l,i[7]=d)}else{var f=0===r?0:t.x/r,p=0===r?1:(t.x+t.width)/r,g=0===s?1:(t.y+t.height)/s,m=0===s?0:t.y/s;this._isFlipUVX&&this._isFlipUVY?(e[0]=p,e[1]=m,e[2]=f,e[3]=m,e[4]=p,e[5]=g,e[6]=f,e[7]=g):this._isFlipUVX?(e[0]=p,e[1]=g,e[2]=f,e[3]=g,e[4]=p,e[5]=m,e[6]=f,e[7]=m):this._isFlipUVY?(e[0]=f,e[1]=m,e[2]=p,e[3]=m,e[4]=f,e[5]=g,e[6]=p,e[7]=g):(e[0]=f,e[1]=g,e[2]=p,e[3]=g,e[4]=f,e[5]=m,e[6]=p,e[7]=m);var v=0===r?0:t.x/r,y=0===r?1:(t.x+t.width)/r,T=0===s?1:(t.y+t.height)/s,E=0===s?0:t.y/s;this._isFlipUVX&&this._isFlipUVY?(i[0]=y,i[1]=E,i[2]=v,i[3]=E,i[4]=y,i[5]=T,i[6]=v,i[7]=T):this._isFlipUVX?(i[0]=y,i[1]=T,i[2]=v,i[3]=T,i[4]=y,i[5]=E,i[6]=v,i[7]=E):this._isFlipUVY?(i[0]=v,i[1]=E,i[2]=y,i[3]=E,i[4]=v,i[5]=T,i[6]=y,i[7]=T):(i[0]=v,i[1]=T,i[2]=y,i[3]=T,i[4]=v,i[5]=E,i[6]=y,i[7]=E)}this._calculateSlicedUV()},i._setDynamicAtlasFrame=function(t){t&&(this._original={_texture:this._texture,_x:this._rect.x,_y:this._rect.y},this._texture=t.texture,this._rect.x=t.x,this._rect.y=t.y,this._calculateUV())},i._resetDynamicAtlasFrame=function(){this._original&&(this._rect.x=this._original._x,this._rect.y=this._original._y,this._texture=this._original._texture,this._original=null,this._calculateUV())},i._checkPackable=function(){var t=wO;if(t){var e=this._texture;if(e instanceof Sg&&!e.isCompressed){var i=this.width,n=this.height;if(!e.image||i>t.maxFrameSize||n>t.maxFrameSize)this._packable=!1;else{var r=y.HTMLCanvasElement;e.image&&e.image instanceof r&&(this._packable=!0)}}else this._packable=!1}},i._serialize=function(){return null},i._deserialize=function(t){var e=t,i=e.rect;i&&(this._rect=new Yn(i.x,i.y,i.width,i.height));var n=e.offset;e.offset&&(this._offset=zn(n.x,n.y));var r=e.originalSize;e.originalSize&&(this._originalSize=jn(r.width,r.height)),this._rotated=!!e.rotated,this._name=e.name,this._packable=!!e.packable,this._pixelsToUnit=e.pixelsToUnit;var s=e.pivot;s&&(this._pivot=zn(s.x,s.y)),this._meshType=e.meshType;var o=e.capInsets;o&&(this._capInsets[0]=o[0],this._capInsets[1]=o[1],this._capInsets[2]=o[2],this._capInsets[3]=o[3]);var a=e.vertices;if(a){this.vertices||(this.vertices={rawPosition:[],positions:[],indexes:a.indexes,uv:a.uv,nuv:a.nuv,minPos:dn(a.minPos.x,a.minPos.y,a.minPos.z),maxPos:dn(a.maxPos.x,a.maxPos.y,a.maxPos.z)}),this.vertices.rawPosition.length=0;for(var h=a.rawPosition,u=0;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,DP.put(n)}this.moveToHead(i)},e.remove=function(t){t.prev?t.prev.next=t.next:this.head=t.next,t.next?t.next.prev=t.prev:this.tail=t.prev,delete this.datas[t.key],this.count--},e.get=function(t){var e=this.datas[t];return e?(this.remove(e),this.moveToHead(e),e.value):null},e.clear=function(){this.count=0,this.datas={},this.head=null,this.tail=null},e.has=function(t){return!!this.datas[t]},e.delete=function(t){var e=this.datas[t];this.remove(e)},t}()))(100),PP=/([a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûа-яА-ЯЁё]+|\S)/,MP=/^[!,.:;'}\]%\?>、‘“》?。,!]/,NP=/([a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûаíìÍÌïÁÀáàÉÈÒÓòóŐőÙÚŰúűñÑæÆœŒÃÂãÔõěščřžýáíéóúůťďňĚŠČŘŽÁÍÉÓÚŤżźśóńłęćąŻŹŚÓŃŁĘĆĄ-яА-ЯЁёáàảạãăắằẳẵặâấầẩẫậéèẻẽẹêếềểễệiíìỉĩịóòỏõọôốồổỗộơớờởỡợúùủũụưứừửữựýỳỷỹỵđÁÀẢẠÃĂẮẰẲẴẶÂẤẦẨẪẬÉÈẺẼẸÊẾỀỂỄỆIÍÌỈĨỊÓÒỎÕỌÔỐỒỔỖỘƠỚỜỞỠỢÚÙỦŨỤƯỨỪỬỮỰÝỲỶỸỴĐ]+|\S)$/,LP=/[a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûаíìÍÌïÁÀáàÉÈÒÓòóŐőÙÚŰúűñÑæÆœŒÃÂãÔõěščřžýáíéóúůťďňĚŠČŘŽÁÍÉÓÚŤżźśóńłęćąŻŹŚÓŃŁĘĆĄ-яА-ЯЁёáàảạãăắằẳẵặâấầẩẫậéèẻẽẹêếềểễệiíìỉĩịóòỏõọôốồổỗộơớờởỡợúùủũụưứừửữựýỳỷỹỵđÁÀẢẠÃĂẮẰẲẴẶÂẤẦẨẪẬÉÈẺẼẸÊẾỀỂỄỆIÍÌỈĨỊÓÒỎÕỌÔỐỒỔỖỘƠỚỜỞỠỢÚÙỦŨỤƯỨỪỬỮỰÝỲỶỸỴĐ]+$/,BP=/^[a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûаíìÍÌïÁÀáàÉÈÒÓòóŐőÙÚŰúűñÑæÆœŒÃÂãÔõěščřžýáíéóúůťďňĚŠČŘŽÁÍÉÓÚŤżźśóńłęćąŻŹŚÓŃŁĘĆĄ-яА-ЯЁёáàảạãăắằẳẵặâấầẩẫậéèẻẽẹêếềểễệiíìỉĩịóòỏõọôốồổỗộơớờởỡợúùủũụưứừửữựýỳỷỹỵđÁÀẢẠÃĂẮẰẲẴẶÂẤẦẨẪẬÉÈẺẼẸÊẾỀỂỄỆIÍÌỈĨỊÓÒỎÕỌÔỐỒỔỖỘƠỚỜỞỠỢÚÙỦŨỤƯỨỪỬỮỰÝỲỶỸỴĐ]/;function FP(t){return/^[\u4E00-\u9FFF\u3400-\u4DFF]+$/.test(t)||/[\u3000-\u303F]|[\u3040-\u309F]|[\u30A0-\u30FF]|[\uFF00-\uFFEF]|[\u4E00-\u9FAF]|[\u2605-\u2606]|[\u2190-\u2195]|\u203B/g.test(t)||/^[\u1100-\u11FF]|[\u3130-\u318F]|[\uA960-\uA97F]|[\uAC00-\uD7AF]|[\uD7B0-\uD7FF]+$/.test(t)}function kP(t){var e=t.charCodeAt(0);return e>=9&&e<=13||32===e||133===e||160===e||5760===e||e>=8192&&e<=8202||8232===e||8233===e||8239===e||8287===e||12288===e}function UP(t,e,i){var n=(i||t.font)+"🎮"+e,r=OP.get(n);if(null!==r)return r;var s=t.measureText(e),o=s&&s.width||0;return OP.put(n,o),o}function GP(t){for(var e=t.length,i=0,n=0,r=0;r=55296&&n<=56319&&(n=t.charCodeAt(r+1))>=56320&&n<=57343?((r+2>=e||8205!==t.charCodeAt(r+2))&&i++,r++):i++);return i}function HP(t,e){for(var i=t.length,n=0,r=0,s=0,o=0,a=0;a=55296&&o<=56319&&(n++,(o=t.charCodeAt(a+1))>=56320&&o<=57343)){if(n++,a+2>=i||8205!==t.charCodeAt(a+2)){if(e===r)return t.slice(s,s+n);s+=n,r++,n=0}a++}else{if(e===r)return t.charAt(a);s=a+1,r++,n=0}else n++;return""}function zP(t,e){var i=HP(t,e);if(1===i.length)return""+i.charCodeAt(0);for(var n="",r=0;r=t.length)return t.length;for(var i=e,n=t[i];i>=0&&("‍"===n&&(n=t[--i]),n>="\udc00"&&n<="\udfff"&&i-1>=0&&(n=t[--i]),n>="\ud800"&&n<="\udbff")&&i-1>=0&&"‍"===t[i-1];)n=t[--i];return i}function WP(t,e){for(var i=e,n=e,r=t[n];n="\ud800"&&r<="\udbff"&&(i++,r=t[++n])),r>="\ud800"&&r<="\udbff")i++,r=t[++n];else{if(!(r>="\udc00"&&r<="\udfff"))break;if(r=t[++n],!(nn?r=n:r+=1}return t.substring(n,r)}function jP(t){return BP.exec(t)}function YP(t){return LP.exec(t)}function KP(t,e,i,n){var r=[];if(0===t.length||i<0)return r.push(""),r;for(var s=t;e>i&&s.length>1;){for(var o=s.length*(i/e)|0,a=XP(s,o),h=e-n(a),u=a,c=0,l=0;h>i&&l++<100;)o*=i/h,h=e-n(a=XP(s,o|=0));for(l=0;a&&h<=i&&l++<100;){var _=PP.exec(a);u=a,h=e-n(a=XP(s,o+=c=_?_[0].length:1))}0==(o-=c)?(o=1,u=XP(s,1)):1===o&&s[0]>="\ud800"&&s[0]<="\udbff"&&(o=2,u=XP(s,2));var d=XP(s,0,o),f=void 0;MP.test(u||a)&&(0==(o-=(f=NP.exec(d))?f[0].length:0)&&(o=1),u=XP(s,o),d=XP(s,0,o)),BP.test(u)&&(f=LP.exec(d))&&d!==f[0]&&(u=XP(s,o-=f[0].length),d=XP(s,0,o)),(0===r.length||(d=d.trim()).length>0)&&r.push(d),e=n(s=u||a)}return(0===r.length||(s=s.trim()).length>0)&&r.push(s),r}var qP,QP=y.document,ZP=null,JP=-1,$P="BES bswy:->@123丁ぁᄁ",tM=Object.create(null),eM=[],iM=3e3;function nM(){for(var t=!0,e=Date.now(),i=eM.length-1;i>=0;i--){var n=eM[i],r=n.fontFamilyName;if(e-n.startTime>iM)q(4933,r),n.onComplete(null,r),eM.splice(i,1);else{var s=n.refWidth,o="40px "+r;ZP.font=o,s!==UP(ZP,$P,o)?(eM.splice(i,1),n.onComplete(null,r)):t=!1}}t&&(clearInterval(JP),JP=-1)}function rM(t,e,i){var n=function(t){var e=t.lastIndexOf(".ttf");if(-1===e)return t;var i,n=t.lastIndexOf("/");return-1!==(i=-1===n?t.substring(0,e)+"_LABEL":t.substring(n+1,e)+"_LABEL").indexOf(" ")&&(i='"'+i+'"'),i}(t);if(tM[n])i(null,n);else{if(!ZP){var r=QP.createElement("canvas");r.width=100,r.height=100,ZP=r.getContext("2d")}var s="40px "+n,o=QP.createElement("style");o.type="text/css";var a="";Number.isNaN(n)?a+="@font-face { font-family:"+n+"; src:":a+='@font-face { font-family:"'+n+'"; src:',a+='url("'+t+'");',o.textContent=a+"}",QP.body.appendChild(o);var h=QP.createElement("div"),u=h.style;if(u.fontFamily=n,h.innerHTML=".",u.position="absolute",u.left="-100px",u.top="-100px",QP.body.appendChild(h),function(){if(void 0===qP)if("FontFace"in y){var t=/Gecko.*Firefox\/(\d+)/.exec(y.navigator.userAgent),e=/OS X.*Version\/10\..*Safari/.exec(y.navigator.userAgent)&&/Apple/.exec(y.navigator.vendor);qP=t?parseInt(t[1],10)>42:!e}else qP=!1;return qP}())!function(t,e,i){var n=new Promise((function(i,n){!function r(){Date.now()-t>=iM?n():QP.fonts.load("40px "+e).then((function(t){t.length>=1?i():setTimeout(r,100)}),(function(){n()}))}()})),r=null,s=new Promise((function(t,e){r=setTimeout(e,iM)}));Promise.race([s,n]).then((function(){r&&(clearTimeout(r),r=null),i(null,e)}),(function(){q(4933,e),i(null,e)}))}(Date.now(),n,i);else{var c={fontFamilyName:n,refWidth:UP(ZP,$P,s),onComplete:i,startTime:Date.now()};eM.push(c),-1===JP&&(JP=setInterval(nM,100))}tM[n]=o}}function sM(t,e,i,n){var r=new wP;r._nativeUrl=t,r._nativeAsset=e,n(null,r)}tE.register({".font":rM,".eot":rM,".ttf":rM,".woff":rM,".svg":rM,".ttc":rM}),_E.register({".font":sM,".eot":sM,".ttf":sM,".woff":sM,".svg":sM,".ttc":sM});var oM,aM,hM,uM,cM,lM,_M,dM,fM,pM=/^(click)(\s)*=|(param)(\s)*=/,gM=/(\s)*src(\s)*=|(\s)*height(\s)*=|(\s)*width(\s)*=|(\s)*align(\s)*=|(\s)*offset(\s)*=|(\s)*click(\s)*=|(\s)*param(\s)*=/,mM=t("HtmlTextParser",function(){function t(){this._specialSymbolArray=[],this._stack=[],this._resultObjectArray=[],this._specialSymbolArray.push([/</g,"<"]),this._specialSymbolArray.push([/>/g,">"]),this._specialSymbolArray.push([/&/g,"&"]),this._specialSymbolArray.push([/"/g,'"']),this._specialSymbolArray.push([/'/g,"'"])}var e=t.prototype;return e.parse=function(t){this._resultObjectArray.length=0,this._stack.length=0;for(var e=0,i=t.length;e",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),o=t.substring(r+1,n);""===o&&(s=t.substring(e,n+1)),this._processResult(s),-1===n?n=r:"/"===t.charAt(r+1)?this._stack.pop():this._addToStack(o),e=n+1}}return this._resultObjectArray},e._attributeToObject=function(t){t=t.trim();var e={},i=/^(color|size)(\s)*=/.exec(t),n="",r=0,s="";if(i){if(n=i[0],""===(t=t.substring(n.length).trim()))return e;switch(r=t.indexOf(" "),n[0]){case"c":e.color=r>-1?t.substring(0,r).trim():t;break;case"s":e.size=parseInt(t)}return r>-1&&(s=t.substring(r+1).trim(),e.event=this._processEventHandler(s)),e}if((i=/^(br(\s)*\/)/.exec(t))&&i[0].length>0&&(n=i[0].trim()).startsWith("br")&&"/"===n[n.length-1])return e.isNewLine=!0,this._resultObjectArray.push({text:"",style:{isNewLine:!0}}),e;var o="",a=-1;if((i=/^(img(\s)*src(\s)*=[^>]+\/)/.exec(t))&&i[0].length>0&&(n=i[0].trim()).startsWith("img")&&"/"===n[n.length-1]){var h;i=gM.exec(t);for(var u=!1;i;){var c=(n=(t=t.substring(t.indexOf(i[0]))).substr(0,i[0].length)).length;if(n=(n=n.replace(/[^a-zA-Z]/g,"").trim()).toLowerCase(),o=t.substring(c).trim(),a="src"===n?this.getRightQuotationIndex(o):-1,h=(r=o.indexOf(" ",a+1>=o.length?-1:a+1))>-1?o.substr(0,r):o,t=o.substring(r).trim(),h.endsWith("/")&&(h=h.slice(0,-1)),"src"===n){switch(h.charCodeAt(0)){case 34:case 39:u=!0,h=h.slice(1,-1)}e.isImage=!0,e.src=h}else if("height"===n)e.imageHeight=parseInt(h);else if("width"===n)e.imageWidth=parseInt(h);else if("align"===n){switch(h.charCodeAt(0)){case 34:case 39:h=h.slice(1,-1)}e.imageAlign=h.toLowerCase()}else"offset"===n?e.imageOffset=h:"click"===n&&(e.event=this._processEventHandler(n+"="+h));e.event&&"param"===n&&(e.event[n]=h.replace(/^"|"$/g,"")),i=gM.exec(t)}return u&&e.isImage&&this._resultObjectArray.push({text:"",style:e}),{}}if(i=/^(outline(\s)*[^>]*)/.exec(t)){var l={color:"#ffffff",width:1};if(t=i[0].substring("outline".length).trim()){var _,d=/(\s)*color(\s)*=|(\s)*width(\s)*=|(\s)*click(\s)*=|(\s)*param(\s)*=/;for(i=d.exec(t);i;)n=(t=t.substring(t.indexOf(i[0]))).substr(0,i[0].length),_=(r=(o=t.substring(n.length).trim()).indexOf(" "))>-1?o.substr(0,r):o,n=(n=n.replace(/[^a-zA-Z]/g,"").trim()).toLowerCase(),t=o.substring(r).trim(),"click"===n?e.event=this._processEventHandler(n+"="+_):"color"===n?l.color=_:"width"===n&&(l.width=parseInt(_)),e.event&&"param"===n&&(e.event[n]=_.replace(/^"|"$/g,"")),i=d.exec(t)}e.outline=l}if((i=/^(on|u|b|i)(\s)*/.exec(t))&&i[0].length>0){switch(n=i[0],t=t.substring(n.length).trim(),n[0]){case"u":e.underline=!0;break;case"i":e.italic=!0;break;case"b":e.bold=!0}if(""===t)return e;e.event=this._processEventHandler(t)}return e},e.getRightQuotationIndex=function(t){var e=-1,i=-1,n=t.indexOf("'"),r=t.indexOf('"'),s=r>-1&&(r-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=pM.exec(t);r;){var s=r[0],o="";if(n=!1,'"'===(t=t.substring(s.length).trim()).charAt(0))(i=t.indexOf('"',1))>-1&&(o=t.substring(1,i).trim(),n=!0),i++;else if("'"===t.charAt(0))(i=t.indexOf("'",1))>-1&&(o=t.substring(1,i).trim(),n=!0),i++;else{var a=/(\S)+/.exec(t);i=(o=a?a[0]:"").length}n&&(e[s=s.substring(0,s.length-1).trim()]=o),t=t.substring(i).trim(),r=pM.exec(t)}return e},e._addToStack=function(t){var e=this._attributeToObject(t);if(0===this._stack.length)this._stack.push(e);else{if(e.isNewLine||e.isImage)return;var i=this._stack[this._stack.length-1];for(var n in i)e[n]||(e[n]=i[n]);this._stack.push(e)}},e._processResult=function(t){0!==t.length&&(t=this._escapeSpecialSymbol(t),this._stack.length>0?this._resultObjectArray.push({text:t,style:this._stack[this._stack.length-1]}):this._resultObjectArray.push({text:t}))},e._escapeSpecialSymbol=function(t){for(var e,i=d(this._specialSymbolArray);!(e=i()).done;){var n=e.value,r=n[0],s=n[1];t=t.replace(r,s)}return t},t}()),vM=function(){this.u=0,this.v=0,this.w=0,this.h=0,this.offsetX=0,this.offsetY=0,this.valid=!1,this.xAdvance=0},yM=function(){function t(t){this.letterDefinitions={},this.texture=t}var e=t.prototype;return e.addLetterDefinitions=function(t,e){this.letterDefinitions[t]=e},e.cloneLetterDefinition=function(){for(var t={},e=0,i=Object.keys(this.letterDefinitions);e=Ie.MAX_LABEL_CANVAS_POOL_SIZE||this.pool.push(t)},t}(),CM=yn.WHITE.clone(),RM="rgba(255, 255, 255, "+(1/255).toFixed(3)+")",wM=function(){function t(t,e){this.image=null,this.data=null,this.canvas=null,this.context=null,this.width=0,this.height=0,this.offsetY=0,this.char=t,this.labelInfo=e,this.hash=""+zP(t,0)+e.hash}var e=t.prototype;return e.updateRenderData=function(){this._updateProperties(),this._updateTexture()},e.destroy=function(){this.image=null,bM.getInstance().put(this.data)},e._updateProperties=function(){if(this.data=bM.getInstance().get(),this.canvas=this.data.canvas,this.context=this.data.context,this.context){var t=this.labelInfo.fontScale;this.context.font=this.labelInfo.fontDesc;var e=UP(this.context,this.char,this.labelInfo.fontDesc),i=2*this.labelInfo.margin+2;this.width=parseFloat(e.toFixed(2))*t+i,this.height=(1+IP)*this.labelInfo.fontSize*t+i,this.offsetY=-this.labelInfo.fontSize*IP*t/2}this.canvas.width!==this.width&&(this.canvas.width=this.width),this.canvas.height!==this.height&&(this.canvas.height=this.height),this.image||(this.image=new $f),this.image.reset(this.canvas)},e._updateTexture=function(){if(this.context&&this.canvas){var t=this.context,e=this.labelInfo,i=this.canvas.width,n=this.canvas.height,r=e.fontScale;t.textAlign="center",t.textBaseline="alphabetic",t.clearRect(0,0,i,n),t.fillStyle=RM,t.fillRect(0,0,i,n),t.font=e.fontDesc.replace(/(\d+)(\.\d+)?(px|em|rem|pt)/g,(function(t,e,i,n){return(+e*r+(+i||0)*r).toString()+n}));var s=e.fontSize*r,o=i/2,a=n/2+s*xP+0*s,h=e.color;if(t.lineJoin="round",t.fillStyle="rgba("+h.r+", "+h.g+", "+h.b+", 1)",e.isOutlined){var u=e.out||CM;t.strokeStyle="rgba("+u.r+", "+u.g+", "+u.b+", "+u.a/255+")",t.lineWidth=2*e.margin*r,t.strokeText(this.char,o,a)}t.fillText(this.char,o,a)}},t}(),IM=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.initWithSize=function(t,e,i){void 0===i&&(i=Pf.RGBA8888),this.reset({width:t,height:e,format:i})},i.drawTextureAt=function(t,e,i){var n=this.getGFXTexture();if(t&&n){var r=this._getGFXDevice();if(r){var s=new __;s.texOffset.x=e,s.texOffset.y=i,s.texExtent.width=t.width,s.texExtent.height=t.height,r.copyTexImagesToTexture([t.data],n,[s])}else q(16363)}},e}(Sg),xM=function(){function t(t,e){this._x=0,this._y=0,this._nextY=0,this._width=0,this._height=0,this._halfBleed=0,this._dirty=!1;var i=new IM;i.initWithSize(t,e),this.fontDefDictionary=new yM(i),this._halfBleed=1,this._width=t,this._height=e,DD.on(ID.EVENT_BEFORE_SCENE_LAUNCH,this.beforeSceneLoad,this)}var e=t.prototype;return e.insertLetterTexture=function(t){var e=t.image,i=DD.root.device;if(!e||!this.fontDefDictionary||!i)return null;var n=e.width,r=e.height;if(this._x+n+0>this._width&&(this._x=0,this._y=this._nextY),this._y+r>this._nextY&&(this._nextY=this._y+r+0),this._nextY>this._height)return q(12100),null;if(!this.fontDefDictionary.texture)return null;this.fontDefDictionary.texture.drawTextureAt(e,this._x,this._y),this._dirty=!0;var s=new vM;return s.u=this._x+this._halfBleed,s.v=this._y+this._halfBleed,s.valid=!0,s.w=t.width-2,s.h=t.height-2,s.xAdvance=s.w,s.offsetY=t.offsetY,this._x+=n+0,this.fontDefDictionary.addLetterDefinitions(t.hash,s),s},e.update=function(){this._dirty&&(this._dirty=!1)},e.reset=function(){this._x=0,this._y=0,this._nextY=0,this.fontDefDictionary.clear()},e.destroy=function(){this.reset();var t=this.fontDefDictionary;t&&t.texture&&(t.texture.destroy(),t.texture=null)},e.getTexture=function(){return this.fontDefDictionary.getTexture()},e.beforeSceneLoad=function(){this.clearAllCache()},e.clearAllCache=function(){this.destroy();var t=new IM;t.initWithSize(this._width,this._height),this.fontDefDictionary.texture=t},e.getLetter=function(t){return this.fontDefDictionary.letterDefinitions[t]},e.getLetterDefinitionForChar=function(t,e){var i=zP(t,0)+e.hash,n=this.fontDefDictionary.letterDefinitions[i];if(!n){var r=new wM(t,e);r.updateRenderData(),n=this.insertLetterTexture(r),r.destroy()}return n},n(t,[{key:"width",get:function(){return this._width}},{key:"height",get:function(){return this._height}}]),t}(),DM={fontAtlas:null,fontSize:0,lineHeight:0,hAlign:0,vAlign:0,hash:"",fontFamily:"",fontDesc:"Arial",color:yn.WHITE.clone(),isOutlined:!1,out:yn.WHITE.clone(),margin:0,fontScale:1},OM=[new L_(e_.ATTR_POSITION,pl.RGB32F)],PM=[new L_(e_.ATTR_POSITION,pl.RGB32F),new L_(e_.ATTR_COLOR,pl.RGBA32F)],MM=[new L_(e_.ATTR_POSITION,pl.RGB32F),new L_(e_.ATTR_TEX_COORD,pl.RG32F),new L_(e_.ATTR_COLOR,pl.RGBA32F)],NM=[new L_(e_.ATTR_POSITION,pl.RGB32F),new L_(e_.ATTR_TEX_COORD,pl.RG32F),new L_(e_.ATTR_COLOR,pl.RGBA8,!0)],LM=[new L_(e_.ATTR_POSITION,pl.RGB32F),new L_(e_.ATTR_TEX_COORD,pl.RG32F),new L_(e_.ATTR_COLOR,pl.RGBA32F),new L_(e_.ATTR_COLOR2,pl.RGBA32F)],BM=[new L_(e_.ATTR_POSITION,pl.RGB32F),new L_(e_.ATTR_TEX_COORD,pl.RG32F),new L_(e_.ATTR_COLOR,pl.RGBA8,!0),new L_(e_.ATTR_COLOR2,pl.RGBA8,!0)];function FM(t){for(var e=0,i=0;i>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=Fo.__isWebIOS14OrIPadOS14Env,e=t?this._nextFreeIAHandle:1;if(t&&e/this._iaPool.length<.5){for(var i=e/.5,n=this._iaPool.length-1;n>=i;n--){var r=this._iaPool[n];r.vertexBuffers[0]&&r.vertexBuffers[0].destroy(),r.indexBuffer&&r.indexBuffer.destroy(),r.ia.destroy()}this._iaPool.length=i}for(var s=this.byteOffset,o=this.indexOffset,a=0;a>2),c=new Uint16Array(this.iData.buffer,0,o),l=h.vertexBuffers[0];s>l.size&&l.resize(s),l.update(u),2*o>h.indexBuffer.size&&h.indexBuffer.resize(2*o),h.indexBuffer.update(c)}this.dirty=!1}},t.createNewIA=function(t){var e,i,n;if(Fo.__isWebIOS14OrIPadOS14Env||!this._iaPool[0]){var r=this._vertexFormatBytes=this._floatsPerVertex*Float32Array.BYTES_PER_ELEMENT,s=Uint16Array.BYTES_PER_ELEMENT,o=t.createBuffer(new v_(vl.VERTEX|vl.TRANSFER_DST,El.HOST|El.DEVICE,r,r));n=t.createBuffer(new v_(vl.INDEX|vl.TRANSFER_DST,El.HOST|El.DEVICE,s,s)),i=[o],this._iaInfo=new F_(this._attributes,i,n),e=t.createInputAssembler(this._iaInfo)}else e=t.createInputAssembler(this._iaInfo),i=this._iaInfo.vertexBuffers,n=this._iaInfo.indexBuffer;return{ia:e,vertexBuffers:i,indexBuffer:n}},n(e,[{key:"attributes",get:function(){return this._attributes}},{key:"vertexFormatBytes",get:function(){return this._vertexFormatBytes}},{key:"byteOffset",get:function(){return this._byteOffset},set:function(t){this._byteOffset=t}},{key:"vertexOffset",get:function(){return this._vertexOffset},set:function(t){this._vertexOffset=t}},{key:"indexOffset",get:function(){return this._indexOffset},set:function(t){this._indexOffset=t}},{key:"dirty",get:function(){return this._dirty},set:function(t){this._dirty=t}},{key:"floatsPerVertex",get:function(){return this._floatsPerVertex},set:function(t){this._floatsPerVertex=t}},{key:"vData",get:function(){return this._vData},set:function(t){this._vData=t}},{key:"iData",get:function(){return this._iData},set:function(t){this._iData=t}},{key:"nativeObj",get:function(){return this._nativeObj}},{key:"sharedBuffer",get:function(){return this._sharedBuffer}}]),e}()),jM=function(){function t(t,e){this._buffers=[],this._device=t,this._attributes=e,this._floatsPerVertex=kM(e)>>2,this._vertexFormatBytes=this._floatsPerVertex*Float32Array.BYTES_PER_ELEMENT}var e=t.prototype;return e.initialize=function(){},e.reset=function(){},e.request=function(){},e.appendBuffers=function(){},e.uploadBuffers=function(){},e.destroy=function(){this._attributes.length=0},n(t,[{key:"attributes",get:function(){return this._attributes}},{key:"vertexFormatBytes",get:function(){return this._vertexFormatBytes}},{key:"floatsPerVertex",get:function(){return this._floatsPerVertex}}]),t}(),YM=new Ws((function(){return{offset:0,length:0}}),32),KM=function(){function t(t,e,i,n,r,s){this.vertexAccessor=t,this.bufferId=e,this.meshBuffer=i,this.vertexOffset=n,this.vb=r,this.indexCount=s,this._ib=new Uint16Array(s),t.getMeshBuffer(e)}return t.prototype.setIndexBuffer=function(){},n(t,[{key:"ib",get:function(){return this._ib}}]),t}(),qM=function(t){function e(i,n,r,s){var o;return(o=t.call(this,i,n)||this)._freeLists=[],o._vCount=0,o._iCount=0,o._id=0,o._vCount=r||Math.floor(1024*Ie.BATCHER2D_MEM_INCREMENT/o._vertexFormatBytes),o._iCount=s||o._vCount*e.IB_SCALE,o._id=e.generateID(),o._allocateBuffer(),o}s(e,t);var i=e.prototype;return i.destroy=function(){for(var e=0;ethis._vCount||e>this._iCount)return Z(9004,i),null;for(var n,r=null,s=0,o=-1,a=null,h=0;h=i){a=n[u],s=h,o=u;break}if(a)break}if(a||(s=this._allocateBuffer(),(r=this._buffers[s])&&(o=0,a=this._freeLists[s][o])),a){var c=a.offset/this.vertexFormatBytes,l=new Float32Array(r.vData.buffer,a.offset,i>>2).fill(0);return this._allocateChunkFromEntry(s,o,a,i),new KM(this,s,r,c,l,e)}return null},i.recycleChunk=function(t){var e=this._freeLists[t.bufferId],i=this._buffers[t.bufferId],n=t.vertexOffset*this.vertexFormatBytes,r=t.vb.byteLength;if(0!==r){for(var s=!1,o=0,a=null,h=e[o];h&&h.offset=0,9004,t,i.offset,i.length),0===r?(this._freeLists[t].splice(e,1),YM.free(i)):(i.offset+=n,i.length=r)},i._allocateBuffer=function(){tt(this._buffers.length===this._freeLists.length,9003);var t=new XM,e=this._vCount*this._floatsPerVertex;t.initialize(this._device,this._attributes,e,this._iCount),this._buffers.push(t);var i=YM.alloc();i.offset=0,i.length=t.vData.byteLength;var n=[i];return this._freeLists.push(n),DD.root.batcher2D.syncMeshBuffersToNative(this.id,this._buffers),this._buffers.length-1},e.generateID=function(){return e.ID_COUNT++},n(e,[{key:"id",get:function(){return this._id}}]),e}(jM);qM.IB_SCALE=4,qM.ID_COUNT=0,function(t){t[t.DrawInfoType=0]="DrawInfoType",t[t.VertDirty=1]="VertDirty",t[t.IsMeshBuffer=2]="IsMeshBuffer",t[t.Stride=3]="Stride",t[t.Count=4]="Count"}(UM||(UM={})),function(t){t[t.BufferID=0]="BufferID",t[t.AccessorID=1]="AccessorID",t[t.Count=2]="Count"}(GM||(GM={})),function(t){t[t.VertexOffset=0]="VertexOffset",t[t.IndexOffset=1]="IndexOffset",t[t.VBCount=2]="VBCount",t[t.IBCount=3]="IBCount",t[t.DataHash=4]="DataHash",t[t.Count=5]="Count"}(HM||(HM={})),function(t){t[t.COMP=0]="COMP",t[t.MODEL=1]="MODEL",t[t.MIDDLEWARE=2]="MIDDLEWARE",t[t.SUB_NODE=3]="SUB_NODE"}(zM||(zM={})),function(){function t(t){this._accId=-1,this._bufferId=-1,this._vertexOffset=0,this._indexOffset=0,this._vb=null,this._ib=null,this._vData=null,this._iData=null,this._vertDirty=!1,this._vbCount=0,this._ibCount=0,this._dataHash=0,this._isMeshBuffer=!1,this._material=null,this._texture=null,this._sampler=null,this._stride=0,this._useLocal=!1,this._model=null,this._drawInfoType=zM.COMP,this._subNode=null,this.init(t);var e=this._nativeObj.getAttrSharedBufferForJS(),i=0;this._uint8SharedBuffer=new Uint8Array(e,i,UM.Count),i+=UM.Count*Uint8Array.BYTES_PER_ELEMENT,this._uint16SharedBuffer=new Uint16Array(e,i,GM.Count),i+=GM.Count*Uint16Array.BYTES_PER_ELEMENT,this._uint32SharedBuffer=new Uint32Array(e,i,HM.Count)}var e=t.prototype;e.init=function(){},e.clear=function(){this._bufferId=0,this._vertexOffset=0,this._indexOffset=0,this._vertDirty=!1},e.setAccId=function(t){this._accId=t},e.setBufferId=function(t){this._bufferId=t},e.setAccAndBuffer=function(t,e){this._bufferId=e,this._accId=t},e.setVertexOffset=function(t){this._vertexOffset=t},e.setIndexOffset=function(t){this._indexOffset=t},e.setVB=function(){},e.setIB=function(){},e.setVData=function(){},e.setIData=function(){},e.setVBCount=function(t){this._vbCount=t},e.setIBCount=function(){},e.setVertDirty=function(t){this._vertDirty=t},e.setDataHash=function(t){this._dataHash=t},e.setIsMeshBuffer=function(t){this._isMeshBuffer=t},e.setMaterial=function(t){this._material=t},e.setTexture=function(t){this._texture=t},e.setSampler=function(t){this._sampler=t},e.setModel=function(){},e.setDrawInfoType=function(t){this._drawInfoType=t},e.setSubNode=function(t){this._subNode=t},e.setStride=function(t){this._stride=t},e.initRender2dBuffer=function(){},e.fillRender2dBuffer=function(){},n(t,[{key:"nativeObj",get:function(){return this._nativeObj}},{key:"render2dBuffer",get:function(){return this._render2dBuffer}}])}(),function(t){t[t.DISABLED=0]="DISABLED",t[t.CLEAR=1]="CLEAR",t[t.ENTER_LEVEL=2]="ENTER_LEVEL",t[t.ENABLED=3]="ENABLED",t[t.EXIT_LEVEL=4]="EXIT_LEVEL",t[t.CLEAR_INVERTED=5]="CLEAR_INVERTED",t[t.ENTER_LEVEL_INVERTED=6]="ENTER_LEVEL_INVERTED"}(VM||(VM={})),function(t){t[t.stencilTest=0]="stencilTest",t[t.func=1]="func",t[t.stencilMask=2]="stencilMask",t[t.writeMask=3]="writeMask",t[t.failOp=4]="failOp",t[t.zFailOp=5]="zFailOp",t[t.passOp=6]="passOp",t[t.ref=7]="ref",t[t.count=8]="count"}(WM||(WM={}));var QM,ZM,JM,$M,tN,eN=t("StencilManager",function(){function t(){this._maskStack=[],this._stencilPattern={stencilTest:!0,func:Dl.ALWAYS,stencilMask:65535,writeMask:65535,failOp:Ol.KEEP,zFailOp:Ol.KEEP,passOp:Ol.KEEP,ref:1},this._stage=VM.DISABLED,this.stencilStateMap=new Map,this.stencilStateMapWithDepth=new Map}var e=t.prototype;return e.pushMask=function(t){this._maskStack.push(t)},e.clear=function(t){return t.stencilStage!==VM.ENTER_LEVEL?VM.CLEAR_INVERTED:VM.CLEAR},e.enableMask=function(){this.stage=VM.ENABLED},e.exitMask=function(){0!==this._maskStack.length&&(this._maskStack.pop(),0===this._maskStack.length?this.stage=VM.DISABLED:this.stage=VM.ENABLED)},e.getWriteMask=function(){return 1<>2,pN=t("BaseRenderData",function(){function t(t){void 0===t&&(t=MM),this.chunk=null,this._renderDrawInfo=null,this._material=null,this._dataHash=0,this._isMeshBuffer=!1,this._vc=0,this._ic=0,this._floatStride=0,this._vertexFormat=MM,this._drawInfoType=zM.COMP,this._multiOwner=!1,this._batcher=null,this._floatStride=t===MM?fN:kM(t)>>2,this._vertexFormat=t}var e=t.prototype;return e.isValid=function(){return this._ic>0&&this.chunk.vertexAccessor},e.initRenderDrawInfo=function(t,e){void 0===e&&(e=zM.COMP)},e.removeRenderDrawInfo=function(){},e.setRenderDrawInfoAttributes=function(){},n(t,[{key:"vertexCount",get:function(){return this._vc}},{key:"indexCount",get:function(){return this._ic}},{key:"stride",get:function(){return this._floatStride<<2}},{key:"floatStride",get:function(){return this._floatStride}},{key:"vertexFormat",get:function(){return this._vertexFormat}},{key:"drawInfoType",get:function(){return this._drawInfoType},set:function(t){this._drawInfoType=t,this._renderDrawInfo&&this._renderDrawInfo.setDrawInfoType(t)}},{key:"renderDrawInfo",get:function(){return this._renderDrawInfo}},{key:"material",get:function(){return this._material},set:function(t){this._material=t,this._renderDrawInfo&&this._renderDrawInfo.setMaterial(t)}},{key:"dataHash",get:function(){return this._dataHash},set:function(t){this._dataHash=t,this._renderDrawInfo&&this._renderDrawInfo.setDataHash(t)}},{key:"multiOwner",get:function(){return this._multiOwner},set:function(t){this._multiOwner=t}},{key:"batcher",get:function(){return this._batcher||(this._batcher=DD.root.batcher2D),this._batcher}}]),t}()),gN=t("RenderData",function(t){function e(e,i){var n;return void 0===e&&(e=MM),void 0===i&&(i=null),(n=t.call(this,e)||this)._vertDirty=!0,n._textureHash=0,n.indices=null,n.layer=0,n.nodeDirty=!0,n.passDirty=!0,n.textureDirty=!0,n.hashDirty=!0,n._data=[],n._frame=null,n._accessor=null,n.vertexRow=1,n.vertexCol=1,i||(i=n.batcher.switchBufferAccessor(n._vertexFormat)),n._accessor=i,n}s(e,t),e.add=function(t,i){void 0===t&&(t=MM),void 0===i&&(i=null);var n=new e(t,i);return i||(i=DD.root.batcher2D.switchBufferAccessor(n._vertexFormat)),n._accessor=i,n},e.remove=function(t){t.clear(),t._accessor=null};var i=e.prototype;return i.resize=function(t,e){t===this._vc&&e===this._ic&&this.chunk||(this._vc=t,this._ic=e,this.chunk&&(this._accessor.recycleChunk(this.chunk),this.chunk=null),this.chunk=this._accessor.allocateChunk(t,e),this.updateHash())},i.setRenderDrawInfoAttributes=function(){},i.fillDrawInfoAttributes=function(){},i.syncRender2dBuffer=function(){},i.resizeAndCopy=function(t,e){if(t!==this._vc||e!==this._ic||!this.chunk){this._vc=t,this._ic=e;var i=this.chunk;this.chunk=this._accessor.allocateChunk(t,e),i&&(this.chunk.vb.set(i.vb),this._accessor.recycleChunk(i)),this.updateHash()}},i.getMeshBuffer=function(){return this.chunk&&this._accessor?this._accessor.getMeshBuffer(this.chunk.bufferId):null},i.updateNode=function(t){this.layer=t.node.layer,this.nodeDirty=!1,this.hashDirty=!0},i.updatePass=function(t){this.material=t.getRenderMaterial(0),this.passDirty=!1,this.hashDirty=!0},i.updateTexture=function(t){this.frame=t,this.textureHash=t.getHash(),this.textureDirty=!1,this.hashDirty=!0},i.updateHash=function(){var t=""+(this.chunk?this.chunk.bufferId:-1)+this.layer+" "+this.textureHash;this.dataHash=nl(t,666),this.hashDirty=!1},i.updateRenderData=function(t,e){if(this.passDirty&&(this.material=t.getRenderMaterial(0),this.passDirty=!1,this.hashDirty=!0,this._renderDrawInfo&&this._renderDrawInfo.setMaterial(this.material)),this.nodeDirty){var i=t.node.scene?t._getRenderScene():null;this.layer=t.node.layer,null!==i&&(this.nodeDirty=!1),this.hashDirty=!0}this.textureDirty&&(this.frame=e,this.textureHash=e.getHash(),this.textureDirty=!1,this.hashDirty=!0,this._renderDrawInfo&&(this._renderDrawInfo.setTexture(this.frame?this.frame.getGFXTexture():null),this._renderDrawInfo.setSampler(this.frame?this.frame.getGFXSampler():null))),this.hashDirty&&(this.updateHash(),this._renderDrawInfo&&this._renderDrawInfo.setDataHash(this.dataHash))},i.clear=function(){this.resize(0,0),this._data.length=0,this.indices=null,this.vertDirty=!0,this.material=null,this.nodeDirty=!0,this.passDirty=!0,this.textureDirty=!0,this.hashDirty=!0,this.layer=0,this.frame=null,this.textureHash=0,this.dataHash=0},e.createStaticVBAccessor=function(t,e,i){var n=DD.root.device;return new qM(n,t,e,i)},n(e,[{key:"dataLength",get:function(){return this._data.length},set:function(t){var e=this._data;if(e.length!==t){for(var i=e.length;i>2,i._vertexFormat=t,i},e.remove=function(t){t.clear()};var i=e.prototype;return i.request=function(t,e){var i=this._byteLength+t*this.stride;return!!this.reserve(t,e)&&(this._vc+=t,this._ic+=e,this._byteLength=i,this.vertexRange=this._vc,this.indexRange=this._ic,!0)},i.reserve=function(t,e){var i=this._byteLength+t*this.stride,n=this.indexCount+e;if(t+this.vertexCount>65535)return!1;var r=this.vData.byteLength,s=this.iData.length,o=this.vData.length,a=this.iData.length;if(i>r||n>s){for(;r=0&&e>=0&&i<=this.vData.byteLength&&this.iData.length,this._vc=t,this._ic=e,this._byteLength=i,this.updateRange(0,t,0,e)},i.updateRange=function(t,e,i,n){e>=0&&n>=0&&e<=this._vc&&this._ic,this.vertexStart=t,this.indexStart=i,this.vertexRange=e,this.indexRange=n},i.requestIA=function(t){this._initIAInfo(t);var e=this._iaPool.add();return e.firstIndex=this.indexStart,e.indexCount=this.indexRange,e},i.uploadBuffers=function(){if(0!==this._byteLength&&this._vertexBuffers[0]&&this._indexBuffer){var t=this._ic,e=new Float32Array(this.vData.buffer,0,this._byteLength>>2),i=new Uint16Array(this.iData.buffer,0,t),n=this._vertexBuffers[0];this._byteLength>n.size&&n.resize(this._byteLength),n.update(e);var r=t<<1;r>this._indexBuffer.size&&this._indexBuffer.resize(r),this._indexBuffer.update(i)}},i.freeIAPool=function(){this._iaPool&&this._iaPool.reset()},i.reset=function(){this._vc=0,this._ic=0,this._byteLength=0,this.vertexStart=0,this.vertexRange=0,this.indexStart=0,this.indexRange=0,this.lastFilledIndex=0,this.lastFilledVertex=0,this.material=null,this.freeIAPool()},i.clear=function(){this.reset(),this._iaPool&&this._iaPool.destroy(),this._vertexBuffers[0]&&(this._vertexBuffers[0].destroy(),this._vertexBuffers=[]),this._iaInfo=null,this.vData=new Float32Array(256*this.stride),this.iData=new Uint16Array(1536)},i._initIAInfo=function(t){var e=this;if(!this._iaInfo){var i=this.stride,n=this._vertexBuffers;n.length||n.push(t.createBuffer(new v_(vl.VERTEX|vl.TRANSFER_DST,El.DEVICE,i,i)));var r=Uint16Array.BYTES_PER_ELEMENT;this._indexBuffer||(this._indexBuffer=t.createBuffer(new v_(vl.INDEX|vl.TRANSFER_DST,El.DEVICE,r,r))),this._iaInfo=new F_(this._vertexFormat,n,this._indexBuffer),this._iaPool=new Xs((function(){return t.createInputAssembler(e._iaInfo)}),1,(function(t){t.destroy()}))}},i._reallocBuffer=function(t,e){var i=this.vData;this.vData=new Float32Array(t),i&&this.vData.set(i,0);var n=this.iData;this.iData=new Uint16Array(e),n&&this.iData.set(n,0)},i.setRenderDrawInfoAttributes=function(){},i.particleInitRenderDrawInfo=function(){},n(e,[{key:"formatByte",get:function(){return this.stride},set:function(){}},{key:"floatStride",get:function(){return this._floatStride}},{key:"vDataOffset",get:function(){return this._byteLength>>>2}}]),e}(pN)),vN=new Hn,yN=new Hn,TN=new _n,EN=new Ln,SN=new Ln,AN=new Ln,bN=new Ln(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),CN=new Yn,RN=va("cc.UITransform")(iN=Ta(110)(iN=Ea(((oN=function(t){function e(){var e;return(e=t.call(this)||this)._priority=0,e._contentSize=rN&&rN(),e._anchorPoint=sN&&sN(),e}s(e,t);var i=e.prototype;return i.__preload=function(){this.node._uiProps.uiTransformComp=this},i.onLoad=function(){this.node.parent&&e.insertChangeMap(this.node.parent)},i.onEnable=function(){this.node.on(Dg.PARENT_CHANGED,this._parentChanged,this),this._markRenderDataDirty()},i.onDisable=function(){this.node.off(Dg.PARENT_CHANGED,this._parentChanged,this)},i.onDestroy=function(){this.node._uiProps.uiTransformComp=null},i.setContentSize=function(t,e){var i,n,r=this._contentSize;if(void 0===e){if(Oi((t=t).width,r.width,xi)&&Oi(t.height,r.height,xi))return;i=t.width,n=t.height}else{if(Oi(t=t,r.width,xi)&&Oi(e,r.height,xi))return;i=t,n=e}r.width=i,r.height=n,this.node.emit(Dg.SIZE_CHANGED),this._markRenderDataDirty()},i.setAnchorPoint=function(t,e){var i=this._anchorPoint;if(void 0===e){if((t=t).x===i.x&&t.y===i.y)return;i.x=t.x,i.y=t.y}else{if(t===i.x&&e===i.y)return;i.x=t,i.y=e}this.node.emit(Dg.ANCHOR_CHANGED,this._anchorPoint),this._markRenderDataDirty()},i.isHit=function(t){for(var e=this._contentSize.width,i=this._contentSize.height,n=vN,r=yN,s=this._getRenderScene().cameras,o=0;o=0&&r.y>=0&&r.x<=e&&r.y<=i&&(l=this._maskTest(n)),l)return!0}}}return!1},i.hitTest=function(t,e){void 0===e&&(e=0);for(var i=this._contentSize.width,n=this._contentSize.height,r=TN,s=vN,o=yN,a=this._getRenderScene().cameras,h=0;h=0&&o.y>=0&&o.x<=i&&o.y<=n&&(c=this._maskTest(s)),c)return!0}}return!1},i._maskTest=function(t){var e,i,n=null===(e=this.node)||void 0===e||null===(i=e.eventProcessor)||void 0===i?void 0:i.maskList;if(n)for(var r=this.node,s=n.length,o=0,a=0;r&&ah.index){n.length=a;break}}return!0},i.convertToNodeSpaceAR=function(t,e){return this.node.getWorldMatrix(AN),Ln.invert(EN,AN),e||(e=new _n),_n.transformMat4(e,t,EN)},i.convertToWorldSpaceAR=function(t,e){return this.node.getWorldMatrix(AN),e||(e=new _n),_n.transformMat4(e,t,AN)},i.getBoundingBox=function(){var t=new Yn;return this._selfBoundingBox(t),Ln.fromSRT(SN,this.node.rotation,this.node.position,this.node.scale),t.transformMat4(SN),t},i.getBoundingBoxToWorld=function(){for(var t=new Yn,i=this.node.children,n=0;n=this._materials.length?null:this._materials[t]},i.setSharedMaterial=function(t,e){t&&t instanceof hS&&Z(12012),this._materials[e]=t;var i=this._materialInstances[e];i&&(i.destroy(),this._materialInstances[e]=null),this._onMaterialModified(e,this._materials[e])},i.getMaterialInstance=function(t){if(!this._materials[t])return null;if(!this._materialInstances[t]){GN.parent=this._materials[t],GN.owner=this,GN.subModelIdx=t;var e=new hS(GN);GN.parent=null,GN.owner=null,GN.subModelIdx=0,this.setMaterialInstance(e,t)}return this._materialInstances[t]},i.setMaterialInstance=function(t,e){if("number"==typeof t){q(12007);var i=t;t=e,e=i}var n=this._materialInstances[e];t&&t.parent?t!==n&&(this._materialInstances[e]=t,this._onMaterialModified(e,t)):(t!==this._materials[e]||n)&&this.setSharedMaterial(t,e)},i.getRenderMaterial=function(t){return this._materialInstances[t]||this._materials[t]},i._onMaterialModified=function(){},i._onRebuildPSO=function(){},i._clearMaterials=function(){},n(e,[{key:"sharedMaterial",get:function(){return this.getSharedMaterial(0)}},{key:"sharedMaterials",get:function(){return this._materials},set:function(t){for(var e=0;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!==VM.ENTER_LEVEL&&this.stencilStage!==VM.ENTER_LEVEL_INVERTED||this.getMaterialInstance(0).recompileShaders({USE_ALPHA_TEST:!0}),this._updateBlendFunc()}},i._updateColor=function(){if(this.node._uiProps.colorDirty=!0,this.setEntityColorDirty(!0),this.setEntityColor(this._color),this.setEntityOpacity(this.node._uiProps.localOpacity),this._assembler){this._assembler.updateColor(this);var t=this._renderFlag;if(this._renderFlag=this._canRender(),this.setEntityEnabled(this._renderFlag),t!==this._renderFlag){var e=this.renderData;e&&(e.vertDirty=!0)}}},e.setEntityColorDirtyRecursively=function(t,i){var n=t._uiProps.uiComp;n&&n.color&&(n._renderEntity.colorDirty=i);for(var r=0;r>16,t|=t>>8,t|=t>>4,t|=t>>2,t|=t>>1,++t}function UL(t,e){return Math.ceil(t/e)*e}!function(t){t[t.OPAQUE=0]="OPAQUE",t[t.TRANSPARENT=1]="TRANSPARENT",t[t.OVERLAY=2]="OVERLAY"}(NL||(NL={})),function(t){t[t.DEFAULT=1]="DEFAULT",t[t.FORWARD=2]="FORWARD",t[t.SHADOWCAST=4]="SHADOWCAST"}(LL||(LL={}));var GL,HL,zL,VL,WL,XL,jL,YL,KL,qL=function(){function t(t){this._format=pl.UNKNOWN,this._formatSize=0,this._chunks=[],this._chunkCount=0,this._handles=[],this._region0=new __,this._region1=new __,this._region2=new __,this._roundUpFn=null,this._bufferViewCtor=Uint8Array,this._channels=4,this._alignment=1,this._device=t}var e=t.prototype;return e.initialize=function(t){var e=od[t.format];this._format=t.format,this._formatSize=e.size,this._channels=e.count,this._bufferViewCtor=pd(e),this._roundUpFn=t.roundUpFn||null,this._alignment=t.alignment||1,t.inOrderFree&&(this.alloc=this._McDonaldAlloc)},e.destroy=function(){for(var t=0;t=0));++r);if(n>=0){var s=this._chunks[i];s.start+=t;var o={chunkIdx:i,start:n,end:n+t,texture:s.texture};return this._handles.push(o),o}var a=Math.sqrt(t/this._formatSize),h=this._roundUpFn&&this._roundUpFn(a,this._formatSize)||Math.max(1024,kL(a)),u=this._chunks[this.createChunk(h)];u.start+=t;var c={chunkIdx:this._chunkCount-1,start:0,end:t,texture:u.texture};return this._handles.push(c),c},e.free=function(t){for(var e=0;e0&&(this._region0.texOffset.x=o,this._region0.texOffset.y=a,this._region0.texExtent.width=h,this._region0.texExtent.height=1,i.push(new this._bufferViewCtor(e,u*this._formatSize,h*this._channels)),n.push(this._region0),o=0,a+=1,s-=h,u+=h),s>0&&(this._region1.texOffset.x=o,this._region1.texOffset.y=a,s>t.texture.width?(this._region1.texExtent.width=t.texture.width,this._region1.texExtent.height=Math.floor(s/t.texture.width),h=this._region1.texExtent.width*this._region1.texExtent.height):(h=s,this._region1.texExtent.width=h,this._region1.texExtent.height=1),i.push(new this._bufferViewCtor(e,u*this._formatSize,h*this._channels)),n.push(this._region1),o=0,a+=this._region1.texExtent.height,s-=h,u+=h),s>0&&(this._region2.texOffset.x=o,this._region2.texOffset.y=a,this._region2.texExtent.width=s,this._region2.texExtent.height=1,i.push(new this._bufferViewCtor(e,u*this._formatSize,s*this._channels)),n.push(this._region2)),this._device.copyBuffersToTexture(i,t.texture,n)},e._findAvailableSpace=function(t,e){var i=this._chunks[e],n=!1,r=i.start;if(r+t<=i.size)n=!0;else{r=0;for(var s=this._handles.filter((function(t){return t.chunkIdx===e})).sort((function(t,e){return t.start-e.start})),o=0;oi.end?r+t<=i.size?n=!0:t<=i.end&&(i.start=r=0,n=!0):r===i.end&&(i.start=r=0,i.end=i.size,t<=i.end&&(n=!0)),n){i.start+=t;var s={chunkIdx:e,start:r,end:r+t,texture:i.texture};return this._handles.push(s),s}}var o=Math.sqrt(t/this._formatSize),a=this._roundUpFn&&this._roundUpFn(o,this._formatSize)||Math.max(1024,kL(o)),h=this._chunks[this.createChunk(a)];h.start+=t;var u={chunkIdx:this._chunkCount,start:0,end:t,texture:h.texture};return this._handles.push(u),u},t}(),QL=function(){function t(t,e,i){this._arrayBuffers=[],this._chunkSize=i*(1<>this._entryBits,i=this._entryMask&t;return(this._hasFloat32?this._float32BufferViews:this._uint32BufferViews)[e][i]},e.getTypedArray=function(t,e){var i=(this._chunkMask&t)>>this._entryBits,n=this._entryMask&t,r=e,s=(this._dataType[e]===KL.UINT32?this._uint32BufferViews:this._float32BufferViews)[i][n],o=this._dataMembers[e];return s.subarray(r,r+o)},e.free=function(t){var e=(this._chunkMask&t)>>this._entryBits,i=this._entryMask&t;(this._hasUint32?this._uint32BufferViews:this._float32BufferViews)[e][i].fill(0),this._freeLists[e].push(i)},t}();!function(t){t[t.NODE=0]="NODE",t[t.PASS=1]="PASS",t[t.AABB=2]="AABB",t[t.RENDER2D=3]="RENDER2D"}(ZL||(ZL={})),function(t){t[t.POSITION=0]="POSITION",t[t.UV=3]="UV",t[t.COLOR=5]="COLOR",t[t.COUNT=9]="COUNT"}(JL||(JL={}));var tB,eB=((GL={})[JL.POSITION]=KL.FLOAT32,GL[JL.UV]=KL.FLOAT32,GL[JL.COLOR]=KL.UINT32,GL[JL.COUNT]=KL.NEVER,GL),iB=((HL={})[JL.POSITION]=JL.UV-JL.POSITION,HL[JL.UV]=JL.COLOR-JL.UV,HL[JL.COLOR]=JL.COUNT-JL.COLOR,HL[JL.COUNT]=1,HL),nB=new $L(ZL.RENDER2D,eB,iB,JL);!function(t){t[t.DIRTY_FLAG=0]="DIRTY_FLAG",t[t.LAYER=1]="LAYER",t[t.WORLD_SCALE=2]="WORLD_SCALE",t[t.WORLD_POSITION=5]="WORLD_POSITION",t[t.WORLD_ROTATION=8]="WORLD_ROTATION",t[t.WORLD_MATRIX=12]="WORLD_MATRIX",t[t.LOCAL_SCALE=28]="LOCAL_SCALE",t[t.LOCAL_POSITION=31]="LOCAL_POSITION",t[t.LOCAL_ROTATION=34]="LOCAL_ROTATION",t[t.COUNT=38]="COUNT"}(tB||(tB={}));var rB,sB=((zL={})[tB.DIRTY_FLAG]=KL.UINT32,zL[tB.LAYER]=KL.UINT32,zL[tB.WORLD_SCALE]=KL.FLOAT32,zL[tB.WORLD_POSITION]=KL.FLOAT32,zL[tB.WORLD_ROTATION]=KL.FLOAT32,zL[tB.WORLD_MATRIX]=KL.FLOAT32,zL[tB.LOCAL_SCALE]=KL.FLOAT32,zL[tB.LOCAL_POSITION]=KL.FLOAT32,zL[tB.LOCAL_ROTATION]=KL.FLOAT32,zL[tB.COUNT]=KL.NEVER,zL),oB=((VL={})[tB.DIRTY_FLAG]=tB.LAYER-tB.DIRTY_FLAG,VL[tB.LAYER]=tB.WORLD_SCALE-tB.LAYER,VL[tB.WORLD_SCALE]=tB.WORLD_POSITION-tB.WORLD_SCALE,VL[tB.WORLD_POSITION]=tB.WORLD_ROTATION-tB.WORLD_POSITION,VL[tB.WORLD_ROTATION]=tB.WORLD_MATRIX-tB.WORLD_ROTATION,VL[tB.WORLD_MATRIX]=tB.LOCAL_SCALE-tB.WORLD_MATRIX,VL[tB.LOCAL_SCALE]=tB.LOCAL_POSITION-tB.LOCAL_SCALE,VL[tB.LOCAL_POSITION]=tB.LOCAL_ROTATION-tB.LOCAL_POSITION,VL[tB.LOCAL_ROTATION]=tB.COUNT-tB.LOCAL_ROTATION,VL[tB.COUNT]=1,VL),aB=new $L(ZL.NODE,sB,oB,tB);!function(t){t[t.PRIORITY=0]="PRIORITY",t[t.STAGE=1]="STAGE",t[t.PHASE=2]="PHASE",t[t.PRIMITIVE=3]="PRIMITIVE",t[t.BATCHING_SCHEME=4]="BATCHING_SCHEME",t[t.DYNAMIC_STATE=5]="DYNAMIC_STATE",t[t.HASH=6]="HASH",t[t.COUNT=7]="COUNT"}(rB||(rB={}));var hB,uB=((WL={})[rB.PRIORITY]=KL.UINT32,WL[rB.STAGE]=KL.UINT32,WL[rB.PHASE]=KL.UINT32,WL[rB.PRIMITIVE]=KL.UINT32,WL[rB.BATCHING_SCHEME]=KL.UINT32,WL[rB.DYNAMIC_STATE]=KL.UINT32,WL[rB.HASH]=KL.UINT32,WL[rB.COUNT]=KL.NEVER,WL),cB=((XL={})[rB.PRIORITY]=rB.STAGE-rB.PRIORITY,XL[rB.STAGE]=rB.PHASE-rB.STAGE,XL[rB.PHASE]=rB.PRIMITIVE-rB.PHASE,XL[rB.PRIMITIVE]=rB.BATCHING_SCHEME-rB.PRIMITIVE,XL[rB.BATCHING_SCHEME]=rB.DYNAMIC_STATE-rB.BATCHING_SCHEME,XL[rB.DYNAMIC_STATE]=rB.HASH-rB.DYNAMIC_STATE,XL[rB.HASH]=rB.COUNT-rB.HASH,XL[rB.COUNT]=1,XL),lB=new $L(ZL.PASS,uB,cB,rB);!function(t){t[t.CENTER=0]="CENTER",t[t.HALFEXTENTS=3]="HALFEXTENTS",t[t.COUNT=6]="COUNT"}(hB||(hB={}));var _B=((jL={})[hB.CENTER]=KL.FLOAT32,jL[hB.HALFEXTENTS]=KL.FLOAT32,jL[hB.COUNT]=KL.NEVER,jL),dB=((YL={})[hB.CENTER]=hB.HALFEXTENTS-hB.CENTER,YL[hB.HALFEXTENTS]=hB.COUNT-hB.HALFEXTENTS,YL[hB.COUNT]=1,YL),fB=new $L(ZL.AABB,_B,dB,hB);st($I.prototype,"RenderScene.prototype",[{name:"raycastUI2DNode"},{name:"raycastUINode"}]),st($I.prototype,"RenderScene.prototype",[{name:"raycastAll",suggest:"using intersect.rayModel in geometry"},{name:"raycastAllModels",suggest:"using intersect.rayModel in geometry"},{name:"raycastSingleModel",suggest:"using intersect.rayModel in geometry"},{name:"raycastAllCanvas",suggest:"using intersect.rayAABB in geometry"},{name:"rayResultCanvas"},{name:"rayResultModels"},{name:"rayResultAll"},{name:"rayResultSingleModel"}]),st(II.prototype,"Model.prototype",[{name:"isInstancingEnabled"},{name:"instancedAttributes"}]);var pB={};st(pB,"CameraVisFlags",[{name:"GENERAL"}]),rt(pB,"CameraVisFlags",[{name:"PROFILER",newName:"PROFILER",target:Rg.BitMask,targetName:"PROFILER"},{name:"GIZMOS",newName:"GIZMOS",target:Rg.BitMask,targetName:"GIZMOS"},{name:"EDITOR",newName:"EDITOR",target:Rg.BitMask,targetName:"EDITOR"},{name:"UI",newName:"UI",target:Rg.BitMask,targetName:"UI_3D"},{name:"UI2D",newName:"UI2D",target:Rg.BitMask,targetName:"UI_2D"}]),m.CameraVisFlags=pB;var gB={};st(gB,"VisibilityFlags",[{name:"GENERAL"}]),rt(gB,"VisibilityFlags",[{name:"ALWALS",newName:"ALWALS",target:Rg.Enum,targetName:"ALWALS"},{name:"PROFILER",newName:"PROFILER",target:Rg.Enum,targetName:"PROFILER"},{name:"GIZMOS",newName:"GIZMOS",target:Rg.Enum,targetName:"GIZMOS"},{name:"EDITOR",newName:"EDITOR",target:Rg.Enum,targetName:"EDITOR"},{name:"UI",newName:"UI",target:Rg.Enum,targetName:"UI_3D"},{name:"UI2D",newName:"UI2D",target:Rg.Enum,targetName:"UI_2D"}]),m.VisibilityFlags=gB,rt(GE.prototype,"Pass.prototype",[{name:"getBindingTypeFromHandle",newName:"getDescriptorTypeFromHandle"}]),st(sI.prototype,"Camera.prototype",[{name:"getSplitFrustum"},{name:"setMatView"},{name:"setMatViewInv"},{name:"setMatProjInv"},{name:"setMatViewProjInv"},{name:"setMatProj"},{name:"setMatViewProj"},{name:"getMatViewInv"}]),st(oS.prototype,"Shadows.prototype",[{name:"aspect"},{name:"selfShadow"},{name:"linear"},{name:"packing"},{name:"autoAdapt"},{name:"fixedArea"},{name:"pcf"},{name:"bias"},{name:"normalBias"},{name:"near"},{name:"far"},{name:"shadowDistance"},{name:"invisibleOcclusionRange"},{name:"orthoSize"},{name:"saturation"}]),st(jI.prototype,"SpotLight.prototype",[{name:"aspect"}]),rt(aI.prototype,"SubModel.prototype",[{name:"subMeshData",newName:"subMesh"}]),st(aI.prototype,"SubModel.prototype",[{name:"getSubModel",suggest:"Use `subModels[i]` instead"},{name:"subModelNum",suggest:"Use `subModels.length` instead"}]);var mB,vB,yB,TB=function(t){if(void 0===FL[t]){var e=1<10||(p=.5*(s+a),g=.5*(o+h),m=.5*((l=.5*(e+n))+(d=.5*(n+s))),v=.5*((_=.5*(i+r))+(f=.5*(r+o))),((C=wB((n-a)*(b=h-i)-(r-h)*(A=a-e)))+(R=wB((s-a)*b-(o-h)*A)))*(C+R)=2*SB)c=2*SB;else for(;c<0;)c+=2*SB;else if(wB(c)>=2*SB)c=2*-SB;else for(;c>0;)c-=2*SB;for(h=0|bB(1,AB(wB(c)/(.5*SB)+.5,5)),l=wB(4/3*(1-CB(a=c/h/2))/RB(a)),o||(l=-l),S=0;S<=h;S++)f=e+(_=CB(u=r+c*(S/h)))*n,p=i+(d=RB(u))*n,g=-d*n*l,m=_*n*l,0===S?t.moveTo(f,p):t.bezierCurveTo(v+T,y+E,f-g,p-m,f,p),v=f,y=p,T=g,E=m}(this,t,e,i,n,r,s)},e.ellipse=function(t,e,i,n){DB(this,t,e,i,n),this._curPath.complex=!1},e.circle=function(t,e,i){DB(this,t,e,i,i),this._curPath.complex=!1},e.rect=function(t,e,i,n){this.moveTo(t,e),this.lineTo(t+i,e),this.lineTo(t+i,e+n),this.lineTo(t,e+n),this.close(),this._curPath.complex=!1},e.roundRect=function(t,e,i,n,r){!function(t,e,i,n,r,s){if(s<.1)t.rect(e,i,n,r);else{var o=AB(s,.5*wB(n))*IB(n),a=AB(s,.5*wB(r))*IB(r);t.moveTo(e,i+a),t.lineTo(e,i+r-a),t.bezierCurveTo(e,i+r-a*(1-xB),e+o*(1-xB),i+r,e+o,i+r),t.lineTo(e+n-o,i+r),t.bezierCurveTo(e+n-o*(1-xB),i+r,e+n,i+r-a*(1-xB),e+n,i+r-a),t.lineTo(e+n,i+a),t.bezierCurveTo(e+n,i+a*(1-xB),e+n-o*(1-xB),i,e+n-o,i),t.lineTo(e+o,i),t.bezierCurveTo(e+o*(1-xB),i,e,i+a*(1-xB),e,i+a),t.close()}}(this,t,e,i,n,r),this._curPath.complex=!1},e.clear=function(){this.pathLength=0,this.pathOffset=0,this.pointsOffset=0,this.dataOffset=0,this._curPath=null,this.paths.length=0,this._points.length=0;for(var t=this._renderDataList,e=0,i=t.length;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===MF.GRAPHICS_ELLIPSE){var h=n/2,u=r/2,c=s.x-.5*n,l=s.y-.5*r;a=c*c/(h*h)+l*l/(u*u)<1}return this._inverted&&(a=!a),a},i._nodeStateChange=function(){this._updateGraphics()},i._changeRenderType=function(){this._type!==MF.SPRITE_STENCIL?this._createGraphics():this._createSprite()},i._createSprite=function(){if(!this._sprite){var t=this._sprite=this.node.getComponent(PF);if(!t){var e=this.node;t=this._sprite=e.addComponent(PF)}}this._sprite.stencilStage=this.inverted?VM.ENTER_LEVEL_INVERTED:VM.ENTER_LEVEL,this._sprite.updateMaterial()},i._createGraphics=function(){if(!this._graphics){var t=this._graphics=this.node.getComponent(EF);if(!t){var e=this.node;t=this._graphics=e.addComponent(EF)}t.lineWidth=1;var i=yn.WHITE.clone();i.a=0,t.fillColor=i}this._graphics.stencilStage=this.inverted?VM.ENTER_LEVEL_INVERTED:VM.ENTER_LEVEL},i._updateGraphics=function(){if(this._graphics&&(this._type===MF.GRAPHICS_RECT||this._type===MF.GRAPHICS_ELLIPSE)){var t=this.node._uiProps.uiTransformComp,e=this._graphics;e.clear();var i=t.contentSize,n=i.width,r=i.height,s=t.anchorPoint,o=-n*s.x,a=-r*s.y;if(this._type===MF.GRAPHICS_RECT)e.rect(o,a,n,r);else if(this._type===MF.GRAPHICS_ELLIPSE){for(var h=function(t,e,i){FF.length=0;for(var n=2*Math.PI/i,r=0;rp?0:f>0?f:p}t({Canvas:Kk,CanvasComponent:Kk}),m.Canvas=Kk,st(t("UIComponent",va("cc.UIComponent")(Wk=ya(RN)(Wk=Ta(110)(Wk=Ea(Wk=function(t){function e(){var e;return(e=t.call(this)||this)._lastParent=null,e.stencilStage=VM.DISABLED,e}s(e,t);var i=e.prototype;return i.__preload=function(){this.node._uiProps.uiComp=this},i.onEnable=function(){},i.onDisable=function(){},i.onDestroy=function(){this.node._uiProps.uiComp===this&&(this.node._uiProps.uiComp=null)},i.postUpdateAssembler=function(){},i.markForUpdateRenderData=function(){},i.setNodeDirty=function(){},i.setTextureDirty=function(){},e}(xp))||Wk)||Wk)||Wk)||Wk).prototype,"UIComponent",[{name:"_visibility"},{name:"setVisibility"}]),rt(Kk.prototype,"Canvas.prototype",[{name:"camera",newName:"cameraComponent.camera",customGetter:function(){var t;return null===(t=this._cameraComponent)||void 0===t?void 0:t.camera}},{name:"clearFlag",newName:"cameraComponent.clearFlags",customGetter:function(){return this._cameraComponent?this._cameraComponent.clearFlags:0},customSetter:function(t){this._cameraComponent&&(this._cameraComponent.clearFlags=t)}},{name:"color",newName:"cameraComponent.clearColor",customGetter:function(){return this._cameraComponent?this._cameraComponent.clearColor:yn.BLACK},customSetter:function(t){this._cameraComponent&&(this._cameraComponent.clearColor=t)}},{name:"priority",newName:"cameraComponent.priority",customGetter:function(){return this._cameraComponent?this._cameraComponent.priority:0},customSetter:function(t){this._cameraComponent&&(this._cameraComponent.priority=t)}},{name:"targetTexture",newName:"cameraComponent.targetTexture",customGetter:function(){return this._cameraComponent?this._cameraComponent.targetTexture:null},customSetter:function(t){this._cameraComponent&&(this._cameraComponent.targetTexture=t)}},{name:"visibility",newName:"cameraComponent.visibility",customGetter:function(){return this._cameraComponent?this._cameraComponent.visibility:0}}]),ot(RN.prototype,"UITransform.prototype",[{name:"priority",suggest:"Please use setSiblingIndex to change index of the current node in its parent's children array."}]),m.UITransformComponent=RN,Jt(RN,"cc.UITransformComponent"),Jt(WN,"cc.RenderComponent"),m.CanvasComponent=Kk,Jt(Kk,"cc.CanvasComponent"),m.internal.Renderable2D=WN,Jt(WN,"cc.Renderable2D");var Qk,Zk,Jk,$k,tU,eU,iU,nU=(Qk=Rs.create(),Zk={distance:1/0,doubleSided:!1,mode:xc.ANY},Jk=0,$k=function(t,e,i,n,r,s){t===xc.CLOSEST?(Jk>e||0===Jk)&&(Jk=e,s&&(0===s.length?s.push({distance:e,vertexIndex0:i/3,vertexIndex1:n/3,vertexIndex2:r/3}):(s[0].distance=e,s[0].vertexIndex0=i/3,s[0].vertexIndex1=n/3,s[0].vertexIndex2=r/3))):(Jk=e,s&&s.push({distance:e,vertexIndex0:i/3,vertexIndex1:n/3,vertexIndex2:r/3}))},function(t,e,i){if(Jk=0,0===e.geometricInfo.positions.length)return Jk;var n=void 0===i?Zk:i;if(qk(t,e.geometricInfo.boundingBox.min,e.geometricInfo.boundingBox.max)){var r=e.primitiveMode,s=e.geometricInfo;!function(t,e,i,n,r){if(i===Hl.TRIANGLE_LIST)for(var s=e.length,o=0;or.distance)&&($k(r.mode,c,a,h,u,r.result),r.mode===xc.ANY))return c}else if(i===Hl.TRIANGLE_STRIP)for(var l=e.length-2,_=0,d=0;dr.distance)&&($k(r.mode,m,f,p,g,r.result),r.mode===xc.ANY))return m}else if(i===Hl.TRIANGLE_FAN){var v=e.length-1,y=3*e[0];_n.set(Qk.a,t[y],t[y+1],t[y+2]);for(var T=1;Tr.distance)&&($k(r.mode,A,y,E,S,r.result),r.mode===xc.ANY))return A}}}(s.positions,s.indices,r,t,n)}return Jk}),rU=function(){var t=0,e={distance:1/0,doubleSided:!1,mode:xc.ANY};return function(i,n,r){t=0;var s=void 0===r?e:r,o=n.renderingSubMeshes.length,a=n.struct.minPosition,h=n.struct.maxPosition;if(a&&h&&!qk(i,a,h))return t;for(var u=0;ul)&&(t=l,s.subIndices&&(s.subIndices[0]=u));else if(t=l,s.subIndices&&s.subIndices.push(u),s.mode===xc.ANY)return l}return t&&s.mode===xc.CLOSEST&&(s.result&&(s.result[0].distance=t,s.result.length=1),s.subIndices&&(s.subIndices.length=1)),t}}(),sU=function(){var t=0,e={distance:1/0,doubleSided:!1,mode:xc.ANY},i=new _r,n=new Ln;return function(r,s,o){t=0;var a=void 0===o?e:o,h=s.worldBounds;if(h&&!ds.rayAABB(r,h))return t;_r.copy(i,r),s.node&&(Ln.invert(n,s.node.getWorldMatrix(n)),_n.transformMat4(i.o,r.o,n),_n.transformMat4Normal(i.d,r.d,n));for(var u=s.subModels,c=0;c_)&&(t=_,a.subIndices&&(a.subIndices[0]=c));else if(t=_,a.subIndices&&a.subIndices.push(c),a.mode===xc.ANY)return _}return t&&a.mode===xc.CLOSEST&&(a.result&&(a.result[0].distance=t,a.result.length=1),a.subIndices&&(a.subIndices.length=1)),t}}();ds.rayModel=sU,ds.raySubMesh=nU,ds.rayMesh=rU,LE("specular-pass");var oU,aU,hU,uU,cU,lU=va("cc.ModelRenderer")((eU=function(t){function e(){var e;return(e=t.call(this)||this)._visFlags=iU&&iU(),e._models=[],e._priority=0,e}s(e,t);var i=e.prototype;return i._collectModels=function(){return this._models},i.onEnable=function(){this._updatePriority()},i._attachToScene=function(){},i._detachFromScene=function(){},i._onVisibilityChange=function(){},i._updatePriority=function(){if(this._models.length>0)for(var t=0;tl;){if((s/=2)<1){s*=2;break}o=o.substring(r,s),a=n.substring(s),this._calculateSize(h,e,o)}for(var _=1e3,d=1;_&&r0&&(d=f[0].length),s+=d,o=n.substring(r,s),a=n.substring(s),this._calculateSize(h,e,o),_--}for(;_&&o.length>=2&&h.x>l;)s-=d,o=n.substring(r,s),this._calculateSize(h,e,o),d=1,_--;if(o.length>=2){var p=YP(o);p&&p.length>0&&o!==p[0]&&(s-=p[0].length,o=n.substring(r,s))}if(i.push(o),r=s,s+=o.length,o=n.substring(r,s),a=n.substring(s),this._calculateSize(u,e,a),this._calculateSize(h,e,o),_--,u.x<2048&&h.x=0;e--){var i=t[e];if(i.name===JU||i.name===$U){i.parent=null;var n=rG(i.name);n.node=i,i.name===JU?(n.comp=i.getComponent(ML),iG.put(n)):(n.comp=i.getComponent(PF),nG.put(n)),this._labelChildrenNum--}}this._segments.length=0,this._labelSegmentsCache.length=0,this._linesWidth.length=0,this._lineOffsetX=0,this._lineCount=1,this._labelWidth=0,this._labelHeight=0,this._layoutDirty=!0},i._activateChildren=function(t){for(var e=this.node.children.length-1;e>=0;e--){var i=this.node.children[e];i.name!==JU&&i.name!==$U||(i.active=t)}},i._addLabelSegment=function(t,e){var i;if(0===this._labelSegmentsCache.length)i=this._createFontLabel(t);else{var n=(i=this._labelSegmentsCache.pop()).node.getComponent(ML);n&&(n.string=t)}var r=i.comp;return r.verticalAlign!==this._verticalAlign&&(r.verticalAlign=this._verticalAlign),i.styleIndex=e,i.lineCount=this._lineCount,i.node._uiProps.uiTransformComp.setAnchorPoint(0,0),i.node.layer=this.node.layer,this.node.insertChild(i.node,this._labelChildrenNum++),this._applyTextAttribute(i),this._segments.push(i),i},i._updateRichTextWithMaxWidth=function(t,e,i){var n=e;if(this._lineOffsetX>0&&n+this._lineOffsetX>this._maxWidth)for(var r=0;this._lineOffsetX<=this._maxWidth;){var s=this._getFirstWordLen(t,r,t.length),o=t.substr(r,s),a=this._measureText(i,o);if(!(this._lineOffsetX+a<=this._maxWidth)){if(r>0){var h=t.substr(0,r);this._addLabelSegment(h,i),t=t.substr(r,t.length),n=this._measureText(i,t)}this._updateLineInfo();break}this._lineOffsetX+=a,r+=s}if(n>this._maxWidth)for(var u=KP(t,n,this._maxWidth,this._measureText(i)),c=0;c1&&c0?(a*=o=c/h,h*=o):(a*=o=this._lineHeight/h,h*=o),u>0&&(a=u),this._maxWidth>0?(this._lineOffsetX+a>this._maxWidth&&this._updateLineInfo(),this._lineOffsetX+=a):(this._lineOffsetX+=a,this._lineOffsetX>this._labelWidth&&(this._labelWidth=this._lineOffsetX)),r.node._uiProps.uiTransformComp.setContentSize(a,h),r.lineCount=this._lineCount,r.clickHandler="",r.clickParam="";var l=e.event;l&&(r.clickHandler=l.click,r.clickParam=l.param)}else q(4400)}},i._updateTextDefaultColor=function(){for(var t=0;t0){var u=this._measureText(n,h);this._updateRichTextWithMaxWidth(h,u,n),o.length>1&&athis._labelWidth&&(this._labelWidth=this._lineOffsetX),o.length>1&&a0&&(this._labelWidth=this._maxWidth),this._labelHeight=(this._lineCount+IP)*this._lineHeight,this.node._uiProps.uiTransformComp.setContentSize(this._labelWidth,this._labelHeight),this._updateRichTextPosition(),this._layoutDirty=!1}},i._getFirstWordLen=function(t,e,i){var n=HP(t,e);if(FP(n)||kP(n))return 1;for(var r=1,s=e+1;se&&(t=0,e=h);var u=this._labelWidth*(.5*this._horizontalAlign-r);switch(this._horizontalAlign){case CL.LEFT:break;case CL.CENTER:u-=this._linesWidth[h-1]/2;break;case CL.RIGHT:u-=this._linesWidth[h-1]}var c=a.node.position;if(a.node.setPosition(t+u,this._lineHeight*(i-h)-this._labelHeight*s,c.z),h===e&&(t+=a.node._uiProps.uiTransformComp.width),a.node.getComponent(PF)){var l=a.node.position.clone(),_=this._lineHeight,d=this._lineHeight*(1+IP);switch(a.node._uiProps.uiTransformComp.anchorY){case 1:l.y+=_+(d-_)/2;break;case.5:l.y+=d/2;break;default:l.y+=(d-_)/2}if(a.imageOffset){var f=a.imageOffset.split(",");if(1===f.length&&f[0]){var p=parseFloat(f[0]);Number.isInteger(p)&&(l.y+=p)}else if(2===f.length){var g=parseFloat(f[0]),m=parseFloat(f[1]);Number.isInteger(g)&&(l.x+=g),Number.isInteger(m)&&(l.y+=m)}}a.node.position=l}var v=a.node.getComponent(ML);if(v&&v.enableOutline){var y=a.node.position.clone();y.y-=v.outlineWidth,a.node.position=y}}},i._convertLiteralColorValue=function(t){var e=t.toUpperCase();return yn[e]?yn[e]:(new yn).fromHEX(t)},i._applyTextAttribute=function(t){var e=t.node.getComponent(ML);if(e){this._resetLabelState(e);var i,n=t.styleIndex;if(this._textArray[n]&&(i=this._textArray[n].style),i){if(i.color?e.color=this._convertLiteralColorValue(i.color):e.color=this._fontColor,e.isBold=!!i.bold,e.isItalic=!!i.italic,e.isUnderline=!!i.underline,i.outline){var r=t.node.getComponent(ML);r||(r=t.node.addComponent(ML)),r.enableOutline=!0,r.outlineColor=this._convertLiteralColorValue(i.outline.color),r.outlineWidth=i.outline.width}e.fontSize=i.size||this._fontSize,t.clickHandler="",t.clickParam="";var s=i.event;s&&(t.clickHandler=s.click||"",t.clickParam=s.param||"")}e.cacheMode=this._cacheMode,this._font instanceof RP&&!this._isSystemFontUsed?e.font=this._font:e.fontFamily=this._fontFamily,e.useSystemFont=this._isSystemFontUsed,e.lineHeight=this._lineHeight,e.updateRenderData(!0)}},i._applyLayer=function(){for(var t,e=d(this._segments);!(t=e()).done;)t.value.node.layer=this.node.layer},i._resetLabelState=function(t){t.fontSize=this._fontSize,t.color=this._fontColor,t.isBold=!1,t.isItalic=!1,t.isUnderline=!1},n(e,[{key:"string",get:function(){return this._string},set:function(t){this._string!==t&&(this._string=t,this._updateRichTextStatus())}},{key:"horizontalAlign",get:function(){return this._horizontalAlign},set:function(t){this.horizontalAlign!==t&&(this._horizontalAlign=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"verticalAlign",get:function(){return this._verticalAlign},set:function(t){this._verticalAlign!==t&&(this._verticalAlign=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"fontSize",get:function(){return this._fontSize},set:function(t){this._fontSize!==t&&(this._fontSize=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"fontColor",get:function(){return this._fontColor},set:function(t){this._fontColor!==t&&(this._fontColor=t,this._updateTextDefaultColor())}},{key:"fontFamily",get:function(){return this._fontFamily},set:function(t){this._fontFamily!==t&&(this._fontFamily=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"font",get:function(){return this._font},set:function(t){this._font!==t&&(this._font=t,this._layoutDirty=!0,this._font?(this.useSystemFont=!1,this._onTTFLoaded()):this.useSystemFont=!0,this._updateRichTextStatus())}},{key:"useSystemFont",get:function(){return this._isSystemFontUsed},set:function(t){this._isSystemFontUsed!==t&&(this._isSystemFontUsed=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"cacheMode",get:function(){return this._cacheMode},set:function(t){this._cacheMode!==t&&(this._cacheMode=t,this._updateRichTextStatus())}},{key:"maxWidth",get:function(){return this._maxWidth},set:function(t){this._maxWidth!==t&&(this._maxWidth=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"lineHeight",get:function(){return this._lineHeight},set:function(t){this._lineHeight!==t&&(this._lineHeight=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"imageAtlas",get:function(){return this._imageAtlas},set:function(t){this._imageAtlas!==t&&(this._imageAtlas=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"handleTouchEvent",get:function(){return this._handleTouchEvent},set:function(t){this._handleTouchEvent!==t&&(this._handleTouchEvent=t,this.enabledInHierarchy&&(this.handleTouchEvent?this._addEventListeners():this._removeEventListeners()))}}]),e}(xp)).HorizontalAlign=CL,QU.VerticalAlign=RL,f((LU=QU).prototype,"horizontalAlign",[IU],Object.getOwnPropertyDescriptor(LU.prototype,"horizontalAlign"),LU.prototype),f(LU.prototype,"verticalAlign",[xU],Object.getOwnPropertyDescriptor(LU.prototype,"verticalAlign"),LU.prototype),f(LU.prototype,"fontColor",[DU],Object.getOwnPropertyDescriptor(LU.prototype,"fontColor"),LU.prototype),f(LU.prototype,"font",[OU],Object.getOwnPropertyDescriptor(LU.prototype,"font"),LU.prototype),f(LU.prototype,"cacheMode",[PU],Object.getOwnPropertyDescriptor(LU.prototype,"cacheMode"),LU.prototype),f(LU.prototype,"imageAtlas",[MU],Object.getOwnPropertyDescriptor(LU.prototype,"imageAtlas"),LU.prototype),BU=ua(LU.prototype,"_lineHeight",[wa],(function(){return 40})),FU=ua(LU.prototype,"_string",[wa],(function(){return"RichText"})),kU=ua(LU.prototype,"_horizontalAlign",[wa],(function(){return CL.LEFT})),UU=ua(LU.prototype,"_verticalAlign",[wa],(function(){return RL.TOP})),GU=ua(LU.prototype,"_fontSize",[wa],(function(){return 40})),HU=ua(LU.prototype,"_fontColor",[wa],(function(){return yn.WHITE.clone()})),zU=ua(LU.prototype,"_maxWidth",[wa],(function(){return 0})),VU=ua(LU.prototype,"_fontFamily",[wa],(function(){return"Arial"})),WU=ua(LU.prototype,"_font",[wa],(function(){return null})),XU=ua(LU.prototype,"_isSystemFontUsed",[wa],(function(){return!0})),jU=ua(LU.prototype,"_userDefinedFont",[wa],(function(){return null})),YU=ua(LU.prototype,"_cacheMode",[wa],(function(){return IL.NONE})),KU=ua(LU.prototype,"_imageAtlas",[wa],(function(){return null})),qU=ua(LU.prototype,"_handleTouchEvent",[wa],(function(){return!0})),NU=LU))||NU)||NU);t({RichText:aG,RichTextComponent:aG}),m.RichText=aG;var hG,uG=va("cc.UIMeshRenderer")(oG=Ta(110)(oG=function(t){function e(){var e;return(e=t.call(this)||this)._modelComponent=null,e._dirtyVersion=-1,e._internalId=-1,e.stencilStage=VM.DISABLED,e._renderData=null,e._renderEntity=new dN(QM.DYNAMIC),e}s(e,t);var i=e.prototype;return i.__preload=function(){this.node._uiProps.uiComp=this},i.onEnable=function(){vD.addRenderer(this),this.markForUpdateRenderData()},i.onDisable=function(){vD.removeRenderer(this),this.renderEntity.enabled=this._canRender()},i.onLoad=function(){this.node._uiProps.uiTransformComp||this.node.addComponent("cc.UITransform"),this._modelComponent=this.getComponent("cc.ModelRenderer"),this._modelComponent?this.renderEntity.setNode(this.node):q(16378,this.node?this.node.name:"")},i.onDestroy=function(){this.renderEntity.setNode(null),this.node._uiProps.uiComp===this&&(this.node._uiProps.uiComp=null),this._modelComponent=this.getComponent("cc.ModelRenderer"),this._modelComponent&&(this._modelComponent._sceneGetter=null)},i._render=function(t){if(this._modelComponent){var e=this._modelComponent._collectModels();this._modelComponent._detachFromScene();for(var i=0;i0)for(s=e;s=e;s-=n)o=HG(s,t[s],t[s+1],o);return o&&FG(o,o.next)&&(zG(o),o=o.next),o}function bG(t,e){if(void 0===e&&(e=null),!t)return t;e||(e=t);var i=t,n=!1;do{if(n=!1,i.steiner||!FG(i,i.next)&&0!==BG(i.prev,i,i.next))i=i.next;else{if(zG(i),(i=e=i.prev)===i.next)return null;n=!0}}while(n||i!==e);return e}function CG(t,e,i,n,r,s,o){if(void 0===o&&(o=0),t){!o&&s&&function(t,e,i,n){var r=t;do{null===r.z&&(r.z=PG(r.x,r.y,e,i,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){var e=0,i=null,n=null,r=null,s=null,o=0,a=0,h=0,u=1;do{for(i=t,t=null,s=null,o=0;i;){for(o++,n=i,a=0,e=0;e0||h>0&&n;)0===a?(r=n,n=n.nextZ,h--):0!==h&&n?i.z<=n.z?(r=i,i=i.nextZ,a--):(r=n,n=n.nextZ,h--):(r=i,i=i.nextZ,a--),s?s.nextZ=r:t=r,r.prevZ=s,s=r;i=n}s.nextZ=null,u*=2}while(o>1)}(r)}(t,n,r,s);for(var a=t,h=null,u=null;t.prev!==t.next;)if(h=t.prev,u=t.next,s?wG(t,n,r,s):RG(t))e.push(h.i/i),e.push(t.i/i),e.push(u.i/i),zG(t),t=u.next,a=u.next;else if((t=u)===a){o?1===o?CG(t=IG(t,e,i),e,i,n,r,s,2):2===o&&xG(t,e,i,n,r,s):CG(bG(t),e,i,n,r,s,1);break}}}function RG(t){var e=t.prev,i=t,n=t.next;if(BG(e,i,n)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(NG(e.x,e.y,i.x,i.y,n.x,n.y,r.x,r.y)&&BG(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function wG(t,e,i,n){var r=t.prev,s=t,o=t.next;if(BG(r,s,o)>=0)return!1;for(var a=r.xs.x?r.x>o.x?r.x:o.x:s.x>o.x?s.x:o.x,c=r.y>s.y?r.y>o.y?r.y:o.y:s.y>o.y?s.y:o.y,l=PG(a,h,e,i,n),_=PG(u,c,e,i,n),d=t.nextZ;d&&d.z<=_;){if(d!==t.prev&&d!==t.next&&NG(r.x,r.y,s.x,s.y,o.x,o.y,d.x,d.y)&&BG(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(d=t.prevZ;d&&d.z>=l;){if(d!==t.prev&&d!==t.next&&NG(r.x,r.y,s.x,s.y,o.x,o.y,d.x,d.y)&&BG(d.prev,d,d.next)>=0)return!1;d=d.prevZ}return!0}function IG(t,e,i){var n=t;do{var r=n.prev,s=n.next.next;!FG(r,s)&&kG(r,n,n.next,s)&&UG(r,s)&&UG(s,r)&&(e.push(r.i/i),e.push(n.i/i),e.push(s.i/i),zG(n),zG(n.next),n=t=s),n=n.next}while(n!==t);return n}function xG(t,e,i,n,r,s){var o=t;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&LG(o,a)){var h=GG(o,a);return o=bG(o,o.next),h=bG(h,h.next),CG(o,e,i,n,r,s),void CG(h,e,i,n,r,s)}a=a.next}o=o.next}while(o!==t)}function DG(t,e){return t.x-e.x}function OG(t,e){if(e=function(t,e){var i=e,n=t.x,r=t.y,s=-1/0,o=null;do{if(r<=i.y&&r>=i.next.y){var a=i.x+(r-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(a<=n&&a>s){if(s=a,a===n){if(r===i.y)return i;if(r===i.next.y)return i.next}o=i.x=i.x&&i.x>=c&&NG(ro.x)&&UG(i,t)&&(o=i,_=h),i=i.next;return o}(t,e)){var i=GG(e,t);bG(i,i.next)}}function PG(t,e,i,n,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)/r)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)/r)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function MG(t){var e=t,i=t;do{e.x=0&&(t-o)*(n-a)-(i-o)*(e-a)>=0&&(i-o)*(s-a)-(r-o)*(n-a)>=0}function LG(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&kG(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&UG(t,e)&&UG(e,t)&&function(t,e){var i=t,n=!1,r=(t.x+e.x)/2,s=(t.y+e.y)/2;do{i.y>s!=i.next.y>s&&r<(i.next.x-i.x)*(s-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n}(t,e)}function BG(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function FG(t,e){return t.x===e.x&&t.y===e.y}function kG(t,e,i,n){return!!(FG(t,e)&&FG(i,n)||FG(t,n)&&FG(i,e))||BG(t,e,i)>0!=BG(t,e,n)>0&&BG(i,n,t)>0!=BG(i,n,e)>0}function UG(t,e){return BG(t.prev,t,t.next)<0?BG(t,e,t.next)>=0&&BG(t,t.prev,e)>=0:BG(t,e,t.prev)<0||BG(t,t.next,e)<0}function GG(t,e){var i=new SG(t.i,t.x,t.y),n=new SG(e.i,e.x,e.y),r=t.next,s=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,n.next=i,i.prev=n,s.next=n,n.prev=s,n}function HG(t,e,i,n){var r=new SG(t,e,i);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function zG(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function VG(t,e,i){i=i||3;var n=e?e.length:0,r=n?e[0]*i:t.length,s=AG(t,0,r,i,!0),o=[];if(!s)return o;var a=0,h=0,u=0,c=0,l=0,_=0,d=0;if(n&&(s=function(t,e,i,n){var r,s=[],o=0,a=null;for(o=0,r=e.length;o80*i){a=u=t[0],h=c=t[1];for(var f=i;fu&&(u=l),_>c&&(c=_);d=Math.max(u-a,c-h)}return CG(s,o,i,a,h,d),o}for(var WG=Math.PI,XG=Math.min,jG=Math.max,YG=Math.ceil,KG=Math.acos,qG=Math.cos,QG=Math.sin,ZG=Math.atan2,JG=null,$G=null,tH=new yn,eH=[],iH=0;iH<4;iH++)eH.push(new _n);function nH(t,e,i){return ti?i:t}var rH={useModel:!0,updateRenderData:function(){},fillBuffers:function(){},renderIA:function(){},getRenderData:function(t,e){if(!$G)return null;var i=$G.getRenderDataList(),n=i[$G.dataOffset];if(!n)return null;var r=n,s=r?r.vertexStart+e:0;return(s>65535||3*s>131070)&&(++$G.dataOffset,$G.dataOffset0&&(r=1/e);for(var s=t.paths,o=t.pathOffset,a=t.pathLength;o1e-6){var T=1/f;T>600&&(T=600),_.dmx*=T,_.dmy*=T}_.dx*l.dy-l.dx*_.dy>0&&(_.flags|=yB.PT_LEFT),f*(p=jG(11,XG(l.len,_.len)*r))*p<1&&(_.flags|=yB.PT_INNERBEVEL),_.flags&yB.PT_CORNER&&(f*n*n<1||i===vB.BEVEL||i===vB.ROUND)&&(_.flags|=yB.PT_BEVEL),0!=(_.flags&(yB.PT_BEVEL|yB.PT_INNERBEVEL))&&h.bevel++,l=_,_=u[d+1]}}},_flattenPaths:function(t){for(var e=t.paths,i=t.pathOffset,n=t.pathLength;i2&&o.equals(a)&&(r.closed=!0,s.pop(),o=s[s.length-1]);for(var h=0,u=s.length;hg&&(m-=2*WG),this._vSet(_,d,1),this._vSet(u-s*n,e.y-o*n,-1);for(var v=nH(YG((g-m)/WG)*r,2,r),y=0;yaH||n.canvasSize.height>aH)&&o<=3;){if(++o>3)this._fontScale=1;else{var a=Math.max(n.canvasSize.width,n.canvasSize.height),h=aH/a;this._fontScale*=h,this._fontScale=Math.max(1,this._fontScale)}this._updatePaddingRect(e,n),this._calculateLabelFont(e,i,n,r)}}s&&(s=n.parsedString)},e.generateRenderInfo=function(t,e,i,n,r,s,o){t?(this._computeAlignmentOffset(e,i,n),this.generateVertexData(t,e,i,n,r,s,o)):(this._updateLabelDimensions(e,i,n),this._updateTexture(e,i,n,r),this.generateVertexData(t,e,i,n,r,s,o))},e.setCanvasUsed=function(t,e){this._canvas=t,this._context=e},e._getStyleFontScale=function(t,e){var i=e;return i*t>this._maxFontSize&&tu?a:u}var c=a,l=(s.length+IP)*this._getLineHeight(e.lineHeight,t.actualFontSize,t.fontSize);i.canvasSize.width=c+i.canvasPadding.width*this._fontScale,i.canvasSize.height=l+i.canvasPadding.height*this._fontScale,i.nodeContentSize.width=(c+i.contentSizeExtend.width*this._fontScale)/this._fontScale,i.nodeContentSize.height=(l+i.contentSizeExtend.height*this._fontScale)/this._fontScale;break;case wL.SHRINK:this._calculateShrinkFont(r,t,e,i),this._calculateWrapText(r,t,e,i),i.canvasSize.width=i.nodeContentSize.width*this._fontScale,i.canvasSize.height=i.nodeContentSize.height*this._fontScale;break;case wL.CLAMP:this._calculateWrapText(r,t,e,i),i.canvasSize.width=i.nodeContentSize.width*this._fontScale,i.canvasSize.height=i.nodeContentSize.height*this._fontScale;break;case wL.RESIZE_HEIGHT:this._calculateWrapText(r,t,e,i);var _=(i.parsedString.length+IP)*this._getLineHeight(e.lineHeight,t.actualFontSize,t.fontSize);i.canvasSize.width=i.nodeContentSize.width*this._fontScale,i.canvasSize.height=_+i.canvasPadding.height*this._fontScale,i.nodeContentSize.height=(_+i.contentSizeExtend.height*this._fontScale)/this._fontScale}}},e._getFontDesc=function(t,e,i,n){var r=t.toString()+"px ";return r+=e,i&&(r="bold "+r),n&&(r="italic "+r),r},e._getLineHeight=function(t,e,i){return 0===t?e:t*e/i},e._calculateShrinkFont=function(t,e,i,n){if(this._context){var r=this._getFontDesc(e.actualFontSize,e.fontFamily,e.isBold,e.isItalic);this._context.font=r;var s=this._calculateParagraphLength(t,this._context,r),o=0,a=0,h=0,u=e.actualFontSize;if(i.wrapping){var c=n.nodeContentSize.width*this._fontScale,l=n.nodeContentSize.height*this._fontScale;if(c<0||l<0)return;a=l+1;for(var _=0,d=0|e.actualFontSize+1,f=0;_>1)<=0){X(4003);break}u=f,r=this._getFontDesc(u,e.fontFamily,e.isBold,e.isItalic),this._context.font=r;var p=this._getLineHeight(i.lineHeight,u,e.fontSize);for(a=0,o=0;ol?d=f-1:_=f}0===_?X(4003):(u=_,r=this._getFontDesc(u,e.fontFamily,e.isBold,e.isItalic),this._context.font=r)}else{for(a=t.length*this._getLineHeight(i.lineHeight,u,e.fontSize),o=0;o1&&i.hasShadow,o=this._measureText(this._context,i.fontDesc),a=0,h=0,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,o=GP(e);r0&&h>0&&R+f.w*t.bmfontScale>e.maxLineWidth&&!kP(g)){e.linesWidth.push(l),l=0,a++,h=0,u-=e.lineHeight*this._getFontScale(t,e)+0,S=!0;break}A.x=R,A.y=u-f.offsetY*t.bmfontScale,this._recordLetterInfo(A,g,C,a),C+1A.y-f.h*t.bmfontScale&&(y=A.y-f.h*t.bmfontScale)}else this._recordPlaceholderInfo(C,g),null!=t.fntConfig?X(16354,t.fntConfig.atlasName,g):X(16355,t.fontFamily,g);else this._recordPlaceholderInfo(C,g)}S||(h=E,_y&&(d=y),c<(l=T)&&(c=l),p+=m)}else e.linesWidth.push(l),l=0,a++,h=0,u-=e.lineHeight*this._getFontScale(t,e)+0,this._recordPlaceholderInfo(p,g),p++}return e.linesWidth.push(l),e.numberOfLines=a+1,e.textDesiredHeight=e.numberOfLines*e.lineHeight*this._getFontScale(t,e),e.numberOfLines>1&&(e.textDesiredHeight+=0*(e.numberOfLines-1)),i.nodeContentSize.width=e.textWidthTemp,i.nodeContentSize.height=e.textHeightTemp,e.textWidthTemp<=0&&(i.nodeContentSize.width=parseFloat(c.toFixed(2))+2*DM.margin),e.textHeightTemp<=0&&(i.nodeContentSize.height=parseFloat(e.textDesiredHeight.toFixed(2))+2*DM.margin),e.tailoredTopY=i.nodeContentSize.height,e.tailoredBottomY=0,_>0&&(e.tailoredTopY=i.nodeContentSize.height+_),d<-e.textDesiredHeight&&(e.tailoredBottomY=e.textDesiredHeight+d),!0},e._recordPlaceholderInfo=function(t,e){if(t>=this._lettersInfo.length){var i=new uH;this._lettersInfo.push(i)}this._lettersInfo[t].char=e,this._lettersInfo[t].hash=""+zP(e,0)+DM.hash,this._lettersInfo[t].valid=!1},e._recordLetterInfo=function(t,e,i,n){if(i>=this._lettersInfo.length){var r=new uH;this._lettersInfo.push(r)}var s=""+zP(e,0)+DM.hash;this._lettersInfo[i].line=n,this._lettersInfo[i].char=e,this._lettersInfo[i].hash=s,this._lettersInfo[i].valid=DM.fontAtlas.getLetter(s).valid,this._lettersInfo[i].x=t.x,this._lettersInfo[i].y=t.y},e._getFirstWordLen=function(t,e,i,n,r){var s=HP(i,n);if(FP(s)||"\n"===s||kP(s))return 1;var o=1,a=DM.fontAtlas.getLetterDefinitionForChar(s,DM);if(!a)return o;for(var h=a.xAdvance*t.bmfontScale+e.spacingX,u=n+1;ue.maxLineWidth&&!kP(s)&&e.maxLineWidth>0)return o;if(h+=a.xAdvance*t.bmfontScale+e.spacingX,"\n"===s||kP(s)||FP(s))break;o++}return o},e._computeAlignmentOffset=function(t,e,i){switch(e.linesOffsetX.length=0,e.letterOffsetY=0,e.horizontalAlign){case CL.LEFT:for(var n=0;ni.nodeContentSize.height},e._isHorizontalClamp=function(t,e,i,n,r){for(var s=!1,o=0,a=GP(n);o0)if(e.wrapping){if(e.linesWidth[l]>i.nodeContentSize.width&&(c>i.nodeContentSize.width||c<0)){s=!0;break}}else if(c>i.nodeContentSize.width){s=!0;break}}}return s},e._isHorizontalNeedShrink=function(t,e){for(var i=0,n=t.linesWidth.length;ie.nodeContentSize.width)return!0;return!1},e._shrinkLabelToContentSize=function(t,e,i,n,r){for(var s=0,o=0|t.actualFontSize,a=0;s>1;if(h<=0)break;t.bmfontScale=h/(t.originFontSize*this._fontScale),this._multilineTextWrap(t,e,i,n,this._getFirstWordLen),this._computeAlignmentOffset(t,e,i),r(t,e,i,n,this)?o=a-1:s=a}s>=0&&this._scaleFontSizeDown(t,e,i,n,s)},e._scaleFontSizeDown=function(t,e,i,n,r){var s=!0;r||(r=.1,s=!1),t.actualFontSize=r,s&&(this._updateFontScale(t),this._multilineTextWrap(t,e,i,n,this._getFirstWordLen))},e._updateQuads=function(t,e,i,n,r,s){for(var o=t.spriteFrame?t.spriteFrame.texture:DM.fontAtlas.getTexture(),a=n.uiTransAnchorX*i.nodeContentSize.width,h=n.uiTransAnchorY*i.nodeContentSize.height,u=0,c=GP(r);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,g,p)&&e.overFlow===wL.CLAMP&&(this._tmpRect.width=0),this._tmpRect.height>0&&this._tmpRect.width>0){var m=this._determineRect(t),v=l.x+e.linesOffsetX[l.line],y=n.quadCount;n.quadCount+=4,this.updateQuatCount(n),s(t,i,n,y,o,this._tmpRect,m,v-a,d-h)}}else q(16353)}}return!0},e._isHorizontalClamped=function(t,e,i,n){var r=t.linesWidth[n],s=i>e.nodeContentSize.width||i<0;return t.wrapping?r>e.nodeContentSize.width&&s:s},e._determineRect=function(t){var e=t.spriteFrame;if(!e)return!1;var i=e.isRotated(),n=e.getOriginalSize(),r=e.getRect(),s=e.getOffset(),o=s.x+(n.width-r.width)/2,a=s.y-(n.height-r.height)/2;if(i){var h=this._tmpRect.x;this._tmpRect.x=r.x+r.height-this._tmpRect.y-this._tmpRect.height-a,this._tmpRect.y=h+r.y-o,this._tmpRect.y<0&&(this._tmpRect.height+=a)}else this._tmpRect.x+=r.x-o,this._tmpRect.y+=r.y+a;return i},t}();cH.instance=void 0,cH.instance=new cH;var lH=new xM(64,64),_H=new yM(null),dH=null,fH=null,pH=null,gH=null,mH=null,vH={updateProcessingData:function(t,e,i,n,r,s){t.fontSize=r.fontSize,t.actualFontSize=r.fontSize,t.originFontSize=pH?pH.fontSize:r.fontSize,e.horizontalAlign=r.horizontalAlign,e.verticalAlign=r.verticalAlign,e.spacingX=r.spacingX;var o=r.overflow;e.overFlow=o,e.lineHeight=r.lineHeight,i.nodeContentSize.width=s.width,i.nodeContentSize.height=s.height,o===wL.NONE?(e.wrapping=!1,i.nodeContentSize.width+=2*DM.margin,i.nodeContentSize.height+=2*DM.margin):o===wL.RESIZE_HEIGHT?(e.wrapping=!0,i.nodeContentSize.height+=2*DM.margin):e.wrapping=r.enableWrapText,n.uiTransAnchorX=s.anchorX,n.uiTransAnchorY=s.anchorY,DM.lineHeight=r.lineHeight,DM.fontSize=r.fontSize,t.spriteFrame=gH,t.fntConfig=pH,t.fontFamily=DM.fontFamily,t.color.set(r.color)},updateRenderData:function(t){if(t.renderData&&dH!==t){if(t.renderData.vertDirty){fH=(dH=t).node._uiProps.uiTransformComp;var e=t.renderData,i=cH.instance,n=t.textStyle,r=t.textLayout,s=t.textLayoutData,o=t.textRenderData;n.fontScale=TO.getScaleX(),this._updateFontFamily(t),this.updateProcessingData(n,r,s,o,t,fH),this._updateLabelInfo(t),n.fontDesc=DM.fontDesc,i.processingString(!0,n,r,s,t.string),o.quadCount=0,i.generateRenderInfo(!0,n,r,s,o,t.string,this.generateVertexData),e.dataLength!==o.quadCount&&(this.resetRenderData(t),e.dataLength=o.quadCount,e.resize(e.dataLength,e.dataLength/2*3));for(var a=e.data,h=0,u=o.quadCount;h0?(DM.isOutlined=!0,DM.margin=t.outlineWidth,DM.out=t.outlineColor.clone(),DM.out.a=t.outlineColor.a*t.color.a/255):(DM.isOutlined=!1,DM.margin=0)},_getFontFamily:function(t){var e="Arial";return t.useSystemFont?e=t.fontFamily||"Arial":t.font&&(e=t.font._nativeAsset||"Arial"),e},_updateLabelInfo:function(t){DM.fontDesc=this._getFontDesc(),DM.color=t.color,DM.hash=function(t){var e=t.color.toHEX(),i="";return t.isOutlined&&t.margin>0&&(i=i+t.margin+t.out.toHEX()),""+t.fontSize+t.fontFamily+e+i}(DM)},_getFontDesc:function(){return DM.fontSize.toString()+"px "+DM.fontFamily}}),AH=new yn(255,255,255,255),bH={createData:function(t){var e=t.requestRenderData();return e.resize(0,0),e},fillBuffers:function(t){if(t.renderData){var e=t.node;AH.a=255*e._uiProps.opacity,Jd(e,0,t.renderData,AH)}},updateColor:function(){}};Gt(bH,SH);var CH=ML.Overflow,RH={updateProcessingData:function(t,e,i,n,r,s){t.isSystemFontUsed=r.useSystemFont,t.fontSize=r.fontSize,i.nodeContentSize.width=i.canvasSize.width=s.width,i.nodeContentSize.height=i.canvasSize.height=s.height,e.lineHeight=r.lineHeight,e.overFlow=r.overflow,r.overflow===CH.NONE?e.wrapping=!1:r.overflow===CH.RESIZE_HEIGHT?e.wrapping=!0:e.wrapping=r.enableWrapText,t.isBold=r.isBold,t.isItalic=r.isItalic,t.isUnderline=r.isUnderline,t.underlineHeight=r.underlineHeight,r.enableOutline&&r.outlineWidth>0?(t.isOutlined=!0,t.outlineColor.set(r.outlineColor),t.outlineWidth=r.outlineWidth):t.isOutlined=!1,r.enableShadow&&(r.shadowBlur>0||!Oi(r.shadowOffset.x,0)||!Oi(r.shadowOffset.y,0))?(t.hasShadow=!0,t.shadowColor.set(r.shadowColor),t.shadowBlur=r.shadowBlur,t.shadowOffsetX=r.shadowOffset.x,t.shadowOffsetY=r.shadowOffset.y):t.hasShadow=!1,t.color.set(r.color),n.texture=r.spriteFrame,n.uiTransAnchorX=s.anchorX,n.uiTransAnchorY=s.anchorY,e.horizontalAlign=r.horizontalAlign,e.verticalAlign=r.verticalAlign},getAssemblerData:function(){var t=ML._canvasPool.get();return t.canvas.width=t.canvas.height=1,t},resetAssemblerData:function(t){t&&ML._canvasPool.put(t)},updateRenderData:function(t){if(t.renderData){if(t.renderData.vertDirty){var e=t.node._uiProps.uiTransformComp,i=cH.instance,n=t.textStyle,r=t.textLayout,s=t.textLayoutData,o=t.textRenderData;n.fontScale=TO.getScaleX(),this.updateProcessingData(n,r,s,o,t,e),i.setCanvasUsed(t.assemblerData.canvas,t.assemblerData.context),n.fontFamily=this._updateFontFamily(t),this._resetDynamicAtlas(t),i.processingString(!1,n,r,s,t.string),i.generateRenderInfo(!1,n,r,s,o,t.string,this.generateVertexData);var a=t.renderData;a.textureDirty=!0,this._calDynamicAtlas(t,s),t.actualFontSize=n.actualFontSize,e.setContentSize(s.nodeContentSize);var h=a.data;h[0]=o.vertexBuffer[0],h[1]=o.vertexBuffer[1],h[2]=o.vertexBuffer[2],h[3]=o.vertexBuffer[3],this.updateUVs(t),t.renderData.vertDirty=!1,t.contentWidth=s.nodeContentSize.width}t.spriteFrame&&t.renderData.updateRenderData(t,t.spriteFrame)}},generateVertexData:function(t,e,i){var n=i.vertexBuffer,r=e.nodeContentSize.width,s=e.nodeContentSize.height,o=i.uiTransAnchorX*r,a=i.uiTransAnchorY*s;n[0].x=-o,n[0].y=-a,n[1].x=r-o,n[1].y=-a,n[2].x=-o,n[2].y=s-a,n[3].x=r-o,n[3].y=s-a},updateVertexData:function(){},updateUVs:function(){},_updateFontFamily:function(t){return t.useSystemFont?t.fontFamily||"Arial":t.font&&t.font._nativeAsset||"Arial"},_calDynamicAtlas:function(t,e){if(!(t.cacheMode!==ML.CacheMode.BITMAP||e.canvasSize.width<=0||e.canvasSize.height<=0)){var i=t.ttfSpriteFrame;wO.packToDynamicAtlas(t,i)}},_resetDynamicAtlas:function(t){if(t.cacheMode===ML.CacheMode.BITMAP){var e=t.ttfSpriteFrame;wO.deleteAtlasSpriteFrame(e),e._resetDynamicAtlasFrame()}}},wH=yn.WHITE.clone(),IH=Uint16Array.from([0,1,2,1,3,2]),xH={createData:function(t){var e=t.requestRenderData();e.dataLength=4,e.resize(4,6),t.textRenderData.quadCount=4;var i=e.chunk.vb;i[3]=i[21]=i[22]=i[31]=0,i[4]=i[12]=i[13]=i[30]=1;for(var n=5,r=0;r<4;r++)yn.toArray(i,wH,n),n+=9;return e.chunk.setIndexBuffer(IH),e},fillBuffers:function(t){for(var e=t.renderData,i=e.chunk,n=e.data,r=t.node,s=i.vb,o=r.worldMatrix,a=e.floatStride,h=0,u=n.length,c=0;c1?1:r)<0?0:r;var s=(n=(n=n>1?1:n)<0?0:n)+(r=(r-=n)<0?0:r);s=s>1?1:s,this.updateUVs(t,n,s),this.updateVertexData(t,n,s),i.updateRenderData(t,e)}},updateUVs:function(t,e,i){var n=t.spriteFrame,r=t.renderData.chunk.vb,s=n.width,o=n.height,a=n.rect,h=0,u=0,c=0,l=0,_=0,d=0,f=0,p=0,g=0,m=0;switch(n.isRotated()?(h=a.x/s,u=(a.y+a.width)/o,c=_=h,f=g=(a.x+a.height)/s,d=m=u,l=p=a.y/o):(h=a.x/s,u=(a.y+a.height)/o,c=f=h,_=g=(a.x+a.width)/s,l=d=u,p=m=a.y/o),t.fillType){case OH.HORIZONTAL:r[3]=c+(_-c)*e,r[4]=l+(d-l)*e,r[12]=c+(_-c)*i,r[13]=l+(d-l)*i,r[21]=f+(g-f)*e,r[22]=p+(m-p)*e,r[30]=f+(g-f)*i,r[31]=p+(m-p)*i;break;case OH.VERTICAL:r[3]=c+(f-c)*e,r[4]=l+(p-l)*e,r[12]=_+(g-_)*e,r[13]=d+(m-d)*e,r[21]=c+(f-c)*i,r[22]=l+(p-l)*i,r[30]=_+(g-_)*i,r[31]=d+(m-d)*i;break;default:Z(2626)}},updateVertexData:function(t,e,i){var n=t.renderData.data,r=t.node._uiProps.uiTransformComp,s=r.width,o=r.height,a=r.anchorX*s,h=r.anchorY*o,u=-a,c=-h,l=s-a,_=o-h,d=0;switch(t.fillType){case OH.HORIZONTAL:d=u+(l-u)*i,u+=(l-u)*e,l=d;break;case OH.VERTICAL:d=c+(_-c)*i,c+=(_-c)*e,_=d;break;default:Z(2626)}n[0].x=u,n[0].y=c,n[1].x=l,n[1].y=c,n[2].x=u,n[2].y=_,n[3].x=l,n[3].y=_},createData:function(t){var e=t.requestRenderData();e.dataLength=4,e.resize(4,6),e.chunk.setIndexBuffer(MH);for(var i,n=d(e.data);!(i=n()).done;)i.value.z=0;return e},updateWorldVertexData:function(t,e){t.node.getWorldMatrix(PH);for(var i=t.renderData.floatStride,n=t.renderData.data,r=e.vb,s=0,o=0;o<4;o++){var a=n[o],h=a.x,u=a.y,c=PH.m03*h+PH.m07*u+PH.m15;c=c?1/c:1,r[s=o*i]=(PH.m00*h+PH.m04*u+PH.m12)*c,r[s+1]=(PH.m01*h+PH.m05*u+PH.m13)*c,r[s+2]=(PH.m02*h+PH.m06*u+PH.m14)*c}},fillBuffers:function(t){var e=t.renderData,i=e.chunk;(t._flagChangedVersion!==t.node.flagChangedVersion||e.vertDirty)&&(this.updateWorldVertexData(t,i),e.vertDirty=!1,t._flagChangedVersion=t.node.flagChangedVersion),i.bufferId;var n=i.vertexOffset,r=i.meshBuffer,s=i.meshBuffer.iData,o=r.indexOffset;s[o++]=n,s[o++]=n+1,s[o++]=n+2,s[o++]=n+2,s[o++]=n+1,s[o++]=n+3,r.indexOffset+=6},updateColor:function(t){for(var e=t.renderData,i=e.chunk.vb,n=e.floatStride,r=5,s=t.color,o=s.r/255,a=s.g/255,h=s.b/255,u=t.node._uiProps.opacity,c=0;c<4;c++)i[r]=o,i[r+1]=a,i[r+2]=h,i[r+3]=u,r+=n}},LH=2*Math.PI,BH=1e-6,FH=new Ln,kH=[new Hn,new Hn,new Hn,new Hn],UH=new Array(4),GH=new Array(8),HH=[new Hn,new Hn,new Hn,new Hn],zH=[new Hn,new Hn,new Hn,new Hn],VH=new Hn,WH=[new Hn,new Hn,new Hn,new Hn],XH=null;function jH(t,e,i,n,r,s,o){var a=Math.sin(s);a=Math.abs(a)>BH?a:0;var h=Math.cos(s),u=0,c=0;if(0!==(h=Math.abs(h)>BH?h:0)){if(u=a/h,(t-r.x)*h>0){var l=r.y+u*(t-r.x);o[0].x=t,o[0].y=l}if((e-r.x)*h>0){var _=r.y+u*(e-r.x);o[2].x=e,o[2].y=_}}if(0!==a){if(c=h/a,(n-r.y)*a>0){var d=r.x+c*(n-r.y);o[3].x=d,o[3].y=n}if((i-r.y)*a>0){var f=r.x+c*(i-r.y);o[1].x=f,o[1].y=i}}}function YH(t,e){var i=e.x-t.x,n=e.y-t.y;if(0===i&&0===n)return 0;if(0===i)return n>0?.5*Math.PI:1.5*Math.PI;var r=Math.atan(n/i);return i<0&&(r+=Math.PI),r}function KH(t,e,i,n,r){var s=UH,o=s[0],a=s[1],h=s[2],u=s[3];t[e].x=i.x,t[e].y=i.y,t[e+1].x=n.x,t[e+1].y=n.y,t[e+2].x=r.x,t[e+2].y=r.y,qH((i.x-o)/(h-o),(i.y-a)/(u-a),t,e),qH((n.x-o)/(h-o),(n.y-a)/(u-a),t,e+1),qH((r.x-o)/(h-o),(r.y-a)/(u-a),t,e+2)}function qH(t,e,i,n){var r=GH,s=r[0]+(r[2]-r[0])*t,o=r[4]+(r[6]-r[4])*t,a=r[1]+(r[3]-r[1])*t,h=r[5]+(r[7]-r[5])*t,u=i[n];u.u=s+(o-s)*e,u.v=a+(h-a)*e}for(var QH={useModel:!1,createData:function(t){return t.requestRenderData()},updateRenderData:function(t){var e=t.spriteFrame;wO.packToDynamicAtlas(t,e),this.updateUVs(t);var i=t.renderData;if(i&&e){if(!i.vertDirty)return;var n=i.data,r=t.fillStart,s=t.fillRange;for(s<0&&(r+=s,s=-s);r>=1;)r-=1;for(;r<0;)r+=1;var o=(r*=LH)+(s*=LH);!function(t){var e=t.node._uiProps.uiTransformComp,i=e.width,n=e.height,r=e.anchorX*i,s=e.anchorY*n,o=-r,a=-s,h=i-r,u=n-s,c=UH;c[0]=o,c[1]=a,c[2]=h,c[3]=u;var l=t.fillCenter,_=VH.x=Math.min(Math.max(0,l.x),1)*(h-o)+o,d=VH.y=Math.min(Math.max(0,l.y),1)*(u-a)+a;kH[0].x=kH[3].x=o,kH[1].x=kH[2].x=h,kH[0].y=kH[1].y=a,kH[2].y=kH[3].y=u;for(var f=0,p=WH;f=LH)i.dataLength=a+3,KH(n,a,VH,kH[u.x],kH[u.y]),a+=3;else{var c=YH(VH,kH[u.x]),l=YH(VH,kH[u.y]);l=o||(c>=r?(i.dataLength=a+3,KH(n,a,VH,kH[u.x],l>=o?zH[h]:kH[u.y]),a+=3):l>r&&(l<=o?(i.dataLength=a+3,KH(n,a,VH,HH[h],kH[u.y]),a+=3):(i.dataLength=a+3,KH(n,a,VH,HH[h],zH[h]),a+=3))),c+=LH,l+=LH}}0===a&&(i.dataLength=0),i.resize(a,a),i.updateRenderData(t,e)}},createQuadIndices:function(t){XH=null,XH=new Uint16Array(t);for(var e=0,i=0;i1?1:p,g=Number.isNaN(g)||g>1?1:g,d=d<0?0:d,f=f<0?0:f,$H[0].x=-o,$H[0].y=-a,$H[1].x=u*p-o,$H[1].y=_*g-a,$H[2].x=$H[1].x+d,$H[2].y=$H[1].y+f,$H[3].x=r-o,$H[3].y=s-a;for(var m=0;m<4;m++)for(var v=0;v<4;v++){var y=4*m+v;y0||t.insetBottom>0||t.insetLeft>0||t.insetRight>0)?2:0}var fz={createData:function(t){return t.requestRenderData()},updateRenderData:function(t){var e=t.renderData,i=t.spriteFrame;if(i&&e&&e.vertDirty){var n=t.node._uiProps.uiTransformComp,r=Math.abs(n.width),s=Math.abs(n.height),o=i.getRect(),a=i.insetLeft,h=i.insetRight,u=o.width-a-h,c=i.insetTop,l=i.insetBottom,_=o.height-c-l,d=r-a-h,f=s-c-l;d=d>0?d:0,f=f>0?f:0;var p=0===u?d:d/u,g=0===_?f:f/_,m=dz(i),v=Math.ceil(g+m),y=Math.ceil(p+m);e.dataLength=4*v*y,this.updateVerts(t,d,f,v,y),e.vertexCount!==v*y*4&&(t.renderEntity.colorDirty=!0),e.resize(v*y*4,v*y*6),e.updateRenderData(t,i)}},createQuadIndices:function(t){if(t%6==0){var e=t/6;_z=new Uint16Array(t);for(var i=0,n=0;n1?1:a.width/(p+g),S=a.height/(v+y)>1?1:a.height/(v+y);s=m>0?Math.floor(1e3*e)/1e3%m==0?m:e%m:e,o=T>0?Math.floor(1e3*i)/1e3%T==0?T:i%T:i,lz.length=0,cz=Math.max(n+1,r+1);for(var A=0;A=r?l-d:C*m-d,lz[C].y=C>=n?_-f:C*T-f;else for(var R=0;R1&&R0?p*E-d+m*(R-1):p+e-d:R===r-1?lz[R].x=p*E-d+s+m*(R-2):R>=r&&(lz[R].x=Math.min(p+e+g,l)-d),0===R?lz[R].y=-f:1===R?lz[R].y=y*S-f:R>1&&R0?y*S-f+T*(R-1):y+i-f:R===n-1?lz[R].y=y*S-f+o+T*(R-2):R>=n&&(lz[R].y=Math.min(y+i+v,_)-f);for(var w=0,I=0,x=0,D=0,O=0;OT?i>=(b>0?z:z+1)*T?1:U%1:U;for(var V=0;Vm?e>=(b>0?V:V+1)*m?1:k%1:k,N?(0===b?(G[0]=sz.u,G[1]=sz.u,G[2]=sz.u+(oz.u-sz.u)*F,H[0]=iz.v,H[1]=iz.v+(nz.v-iz.v)*B,H[2]=iz.v):(0===z?(G[0]=ez.u,G[1]=ez.u,G[2]=sz.u):z0){var h=o.claimedTouchIdList.indexOf(n.getID());if(-1!==h){if(o._handleEventTouch(t),t.type!==qR.TOUCH_END&&t.type!==qR.TOUCH_CANCEL||(ae(o.claimedTouchIdList,h),t.preventSwallow||this._removeClaimedTouch(s+1,n.getID())),r=!1,!t.preventSwallow)break;t.preventSwallow=!1}}}return--this._inDispatchCount<=0&&this._updatePointerEventProcessorList(),r},e._removeClaimedTouch=function(t,e){for(var i=this._pointerEventProcessorList,n=i.length,r=t;re)for(;e0){for(var t=this._meshDataArray.length,e=0;e0){!function(t,e){for(var i,n,r,s=t.vertexFormat,o=t.chunk.vb,a=0,h=0;h>>0;else if(n.size/n.count==4)for(var l=a+3;l>2}}(r.renderData,o);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(),eN.sharedManager.exitMask())),e+=1}},e._screenSort=function(t,e){return t.node.getSiblingIndex()-e.node.getSiblingIndex()},e._releaseDescriptorSetCache=function(t){this._descriptorSetCache.releaseDescriptorSetCache(t)},e._createClearModel=function(){if(!this._maskClearModel){this._maskClearMtl=NE.get("default-clear-stencil"),this._maskClearModel=m.director.root.createModel(II);var t=kM(OM),e=Qd.gfxDevice,i=e.createBuffer(new v_(vl.VERTEX|vl.TRANSFER_DST,El.DEVICE,4*t,t)),n=new Float32Array([-1,-1,0,1,-1,0,-1,1,0,1,1,0]);i.update(n);var r=e.createBuffer(new v_(vl.INDEX|vl.TRANSFER_DST,El.DEVICE,6*Uint16Array.BYTES_PER_ELEMENT,Uint16Array.BYTES_PER_ELEMENT)),s=new Uint16Array([0,1,2,2,1,3]);r.update(s),this._maskModelMesh=new kD([i],OM,Hl.TRIANGLE_LIST,r),this._maskModelMesh.subMeshIdx=0,this._maskClearModel.initSubModel(0,this._maskModelMesh,this._maskClearMtl)}},e._insertMaskBatch=function(t){this.autoMergeBatches(this._currComponent),this.resetRenderStates(),this._createClearModel(),this._maskClearModel.node=this._maskClearModel.transform=t.node;var e=eN.sharedManager;e.pushMask(1);var i=e.clear(t),n=null,r=0,s=this._maskClearMtl;s&&(n=e.getStencilStage(i,s),r=e.getStencilHash(i));var o=this._maskClearModel,a=m.director.getTotalFrames();o&&(o.updateTransform(a),o.updateUBOs(a));for(var h=0;h=0;o--){var a=i[o],h=t[a];t.splice(a,1),this._localCachePool.free(h)}}},e.reset=function(){for(var t=this._localDescriptorSetCache,e=t.length,i=0;i>>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;tnS.LEVEL_1},set:function(t){this._csmLevel=t?nS.LEVEL_4:nS.LEVEL_1,this._light&&(this._light.csmLevel=this._csmLevel,this._light.csmNeedUpdate=!0)}},{key:"csmLayerLambda",get:function(){return this._csmLayerLambda},set:function(t){this._csmLayerLambda=t,this._light&&(this._light.csmLayerLambda=this._csmLayerLambda,this._light.csmNeedUpdate=!0)}},{key:"csmOptimizationMode",get:function(){return this._csmOptimizationMode},set:function(t){this._csmOptimizationMode=t,this._light&&(this._light.csmOptimizationMode=this._csmOptimizationMode)}},{key:"shadowFixedArea",get:function(){return this._shadowFixedArea},set:function(t){this._shadowFixedArea=t,this._light&&(this._light.shadowFixedArea=this._shadowFixedArea)}},{key:"shadowNear",get:function(){return this._shadowNear},set:function(t){this._shadowNear=t,this._light&&(this._light.shadowNear=this._shadowNear)}},{key:"shadowFar",get:function(){return this._shadowFar},set:function(t){this._shadowFar=Math.min(t,oS.MAX_FAR),this._light&&(this._light.shadowFar=this._shadowFar)}},{key:"shadowOrthoSize",get:function(){return this._shadowOrthoSize},set:function(t){this._shadowOrthoSize=t,this._light&&(this._light.shadowOrthoSize=this._shadowOrthoSize)}},{key:"csmAdvancedOptions",get:function(){return this._csmAdvancedOptions},set:function(t){this._csmAdvancedOptions=t}},{key:"csmLayersTransition",get:function(){return this._csmLayersTransition},set:function(t){this._csmLayersTransition=t,this._light&&(this._light.csmLayersTransition=t)}},{key:"csmTransitionRange",get:function(){return this._csmTransitionRange},set:function(t){this._csmTransitionRange=t,this._light&&(this._light.csmTransitionRange=t)}}]),e}(dX),XW=ua(WW.prototype,"_illuminanceHDR",[IX,sW],(function(){return 65e3})),jW=ua(WW.prototype,"_illuminanceLDR",[xX],(function(){return 65e3*sI.standardExposureValue})),YW=ua(WW.prototype,"_shadowEnabled",[xX],(function(){return!1})),KW=ua(WW.prototype,"_shadowPcf",[xX],(function(){return iS.HARD})),qW=ua(WW.prototype,"_shadowBias",[xX],(function(){return 1e-5})),QW=ua(WW.prototype,"_shadowNormalBias",[xX],(function(){return 0})),ZW=ua(WW.prototype,"_shadowSaturation",[xX],(function(){return 1})),JW=ua(WW.prototype,"_shadowDistance",[xX],(function(){return 50})),$W=ua(WW.prototype,"_shadowInvisibleOcclusionRange",[xX],(function(){return 200})),tX=ua(WW.prototype,"_csmLevel",[xX],(function(){return nS.LEVEL_4})),eX=ua(WW.prototype,"_csmLayerLambda",[xX],(function(){return.75})),iX=ua(WW.prototype,"_csmOptimizationMode",[xX],(function(){return rS.RemoveDuplicates})),nX=ua(WW.prototype,"_csmAdvancedOptions",[xX],(function(){return!1})),rX=ua(WW.prototype,"_csmLayersTransition",[xX],(function(){return!1})),sX=ua(WW.prototype,"_csmTransitionRange",[xX],(function(){return.05})),oX=ua(WW.prototype,"_shadowFixedArea",[xX],(function(){return!1})),aX=ua(WW.prototype,"_shadowNear",[xX],(function(){return.1})),hX=ua(WW.prototype,"_shadowFar",[xX],(function(){return 10})),uX=ua(WW.prototype,"_shadowOrthoSize",[xX],(function(){return 5})),f(WW.prototype,"illuminance",[oW],Object.getOwnPropertyDescriptor(WW.prototype,"illuminance"),WW.prototype),f(WW.prototype,"shadowEnabled",[aW,hW],Object.getOwnPropertyDescriptor(WW.prototype,"shadowEnabled"),WW.prototype),f(WW.prototype,"shadowPcf",[uW,cW],Object.getOwnPropertyDescriptor(WW.prototype,"shadowPcf"),WW.prototype),f(WW.prototype,"shadowBias",[lW,_W],Object.getOwnPropertyDescriptor(WW.prototype,"shadowBias"),WW.prototype),f(WW.prototype,"shadowNormalBias",[dW,fW],Object.getOwnPropertyDescriptor(WW.prototype,"shadowNormalBias"),WW.prototype),f(WW.prototype,"shadowSaturation",[pW,gW],Object.getOwnPropertyDescriptor(WW.prototype,"shadowSaturation"),WW.prototype),f(WW.prototype,"shadowDistance",[mW,vW],Object.getOwnPropertyDescriptor(WW.prototype,"shadowDistance"),WW.prototype),f(WW.prototype,"shadowInvisibleOcclusionRange",[yW,TW],Object.getOwnPropertyDescriptor(WW.prototype,"shadowInvisibleOcclusionRange"),WW.prototype),f(WW.prototype,"csmLevel",[EW,SW],Object.getOwnPropertyDescriptor(WW.prototype,"csmLevel"),WW.prototype),f(WW.prototype,"enableCSM",[AW,bW],Object.getOwnPropertyDescriptor(WW.prototype,"enableCSM"),WW.prototype),f(WW.prototype,"csmLayerLambda",[CW,RW],Object.getOwnPropertyDescriptor(WW.prototype,"csmLayerLambda"),WW.prototype),f(WW.prototype,"csmOptimizationMode",[wW,IW],Object.getOwnPropertyDescriptor(WW.prototype,"csmOptimizationMode"),WW.prototype),f(WW.prototype,"shadowFixedArea",[xW,DW],Object.getOwnPropertyDescriptor(WW.prototype,"shadowFixedArea"),WW.prototype),f(WW.prototype,"shadowNear",[OW,PW],Object.getOwnPropertyDescriptor(WW.prototype,"shadowNear"),WW.prototype),f(WW.prototype,"shadowFar",[MW,NW],Object.getOwnPropertyDescriptor(WW.prototype,"shadowFar"),WW.prototype),f(WW.prototype,"shadowOrthoSize",[LW,BW],Object.getOwnPropertyDescriptor(WW.prototype,"shadowOrthoSize"),WW.prototype),f(WW.prototype,"csmAdvancedOptions",[FW,kW],Object.getOwnPropertyDescriptor(WW.prototype,"csmAdvancedOptions"),WW.prototype),f(WW.prototype,"csmLayersTransition",[UW,GW],Object.getOwnPropertyDescriptor(WW.prototype,"csmLayersTransition"),WW.prototype),f(WW.prototype,"csmTransitionRange",[HW,zW],Object.getOwnPropertyDescriptor(WW.prototype,"csmTransitionRange"),WW.prototype),VW=WW))||VW);t({DirectionalLight:PX,DirectionalLightComponent:PX});var MX,NX,LX,BX,FX,kX,UX,GX,HX,zX,VX,WX,XX,jX,YX,KX,qX,QX,ZX,JX,$X,tj,ej,ij,nj,rj=(fX=va("cc.SphereLight"),pX=Ia("_luminance"),gX=Za(Ze),mX=Za(Ze),vX=Za(lX),yX=Za(Je),TX=Za(Je),fX((SX=function(t){function e(){var e;return(e=t.call(this)||this)._size=AX&&AX(),e._luminanceHDR=bX&&bX(),e._luminanceLDR=CX&&CX(),e._term=RX&&RX(),e._range=wX&&wX(),e._lightType=UI,e}return s(e,t),e.prototype._createLight=function(){t.prototype._createLight.call(this),this._type=CI.SPHERE,this.size=this._size,this.range=this._range,this._light&&(this._light.luminanceHDR=this._luminanceHDR,this._light.luminanceLDR=this._luminanceLDR)},n(e,[{key:"luminousFlux",get:function(){return m.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR*NI(this._size):this._luminanceLDR},set:function(t){var e=0;m.director.root.pipeline.pipelineSceneData.isHDR?(this._luminanceHDR=t/NI(this._size),e=this._luminanceHDR):(this._luminanceLDR=t,e=this._luminanceLDR),this._light&&(this._light.luminance=e)}},{key:"luminance",get:function(){return m.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){m.director.root.pipeline.pipelineSceneData.isHDR?(this._luminanceHDR=t,this._light&&(this._light.luminanceHDR=this._luminanceHDR)):(this._luminanceLDR=t,this._light&&(this._light.luminanceLDR=this._luminanceLDR))}},{key:"term",get:function(){return this._term},set:function(t){this._term=t}},{key:"size",get:function(){return this._size},set:function(t){this._size=t,this._light&&(this._light.size=t)}},{key:"range",get:function(){return this._range},set:function(t){this._range=t,this._light&&(this._light.range=t)}}]),e}(dX),AX=ua(SX.prototype,"_size",[wa],(function(){return.15})),bX=ua(SX.prototype,"_luminanceHDR",[wa,pX],(function(){return 1700/NI(.15)})),CX=ua(SX.prototype,"_luminanceLDR",[wa],(function(){return 1700/NI(.15)*sI.standardExposureValue*sI.standardLightMeterScale})),RX=ua(SX.prototype,"_term",[wa],(function(){return lX.LUMINOUS_FLUX})),wX=ua(SX.prototype,"_range",[wa],(function(){return 1})),f(SX.prototype,"luminousFlux",[gX],Object.getOwnPropertyDescriptor(SX.prototype,"luminousFlux"),SX.prototype),f(SX.prototype,"luminance",[mX],Object.getOwnPropertyDescriptor(SX.prototype,"luminance"),SX.prototype),f(SX.prototype,"term",[vX],Object.getOwnPropertyDescriptor(SX.prototype,"term"),SX.prototype),f(SX.prototype,"size",[yX],Object.getOwnPropertyDescriptor(SX.prototype,"size"),SX.prototype),f(SX.prototype,"range",[TX],Object.getOwnPropertyDescriptor(SX.prototype,"range"),SX.prototype),EX=SX))||EX);t({SphereLight:rj,SphereLightComponent:rj});var sj,oj,aj,hj,uj,cj,lj,_j,dj,fj,pj,gj,mj,vj,yj,Tj,Ej,Sj,Aj,bj=Za,Cj=wa,Rj=Ia,wj=Sa,Ij=(MX=va("cc.SpotLight"),NX=Rj("_luminance"),LX=bj(lX),BX=bj(Je),FX=wj({group:{name:"DynamicShadowSettings",displayOrder:1}}),kX=bj($e),UX=wj({group:{name:"DynamicShadowSettings",displayOrder:2}}),GX=bj(iS),HX=wj({group:{name:"DynamicShadowSettings",displayOrder:3}}),zX=bj(Je),VX=wj({group:{name:"DynamicShadowSettings",displayOrder:4}}),WX=bj(Je),MX((jX=function(t){function e(){var e;return(e=t.call(this)||this)._size=YX&&YX(),e._luminanceHDR=KX&&KX(),e._luminanceLDR=qX&&qX(),e._term=QX&&QX(),e._range=ZX&&ZX(),e._spotAngle=JX&&JX(),e._angleAttenuationStrength=$X&&$X(),e._shadowEnabled=tj&&tj(),e._shadowPcf=ej&&ej(),e._shadowBias=ij&&ij(),e._shadowNormalBias=nj&&nj(),e._lightType=jI,e}return s(e,t),e.prototype._createLight=function(){if(t.prototype._createLight.call(this),this._type=CI.SPOT,this.size=this._size,this.range=this._range,this.spotAngle=this._spotAngle,this.angleAttenuationStrength=this._angleAttenuationStrength,this._light){var e=this._light;e.luminanceHDR=this._luminanceHDR,e.luminanceLDR=this._luminanceLDR,e.shadowEnabled=this._shadowEnabled,e.shadowPcf=this._shadowPcf,e.shadowBias=this._shadowBias,e.shadowNormalBias=this._shadowNormalBias}},n(e,[{key:"luminousFlux",get:function(){return m.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR*NI(this._size):this._luminanceLDR},set:function(t){var e=0;m.director.root.pipeline.pipelineSceneData.isHDR?(this._luminanceHDR=t/NI(this._size),e=this._luminanceHDR):(this._luminanceLDR=t,e=this._luminanceLDR),this._light&&(this._light.luminance=e)}},{key:"luminance",get:function(){return m.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){m.director.root.pipeline.pipelineSceneData.isHDR?(this._luminanceHDR=t,this._light&&(this._light.luminanceHDR=this._luminanceHDR)):(this._luminanceLDR=t,this._light&&(this._light.luminanceLDR=this._luminanceLDR))}},{key:"term",get:function(){return this._term},set:function(t){this._term=t}},{key:"size",get:function(){return this._size},set:function(t){this._size=t,this._light&&(this._light.size=t)}},{key:"range",get:function(){return this._range},set:function(t){this._range=t,this._light&&(this._light.range=t)}},{key:"spotAngle",get:function(){return this._spotAngle},set:function(t){this._spotAngle=t,this._light&&(this._light.spotAngle=Li(t))}},{key:"angleAttenuationStrength",get:function(){return this._angleAttenuationStrength},set:function(t){this._angleAttenuationStrength=t,this._light&&(this._light.angleAttenuationStrength=t)}},{key:"shadowEnabled",get:function(){return this._shadowEnabled},set:function(t){this._shadowEnabled=t,this._light&&(this._light.shadowEnabled=t)}},{key:"shadowPcf",get:function(){return this._shadowPcf},set:function(t){this._shadowPcf=t,this._light&&(this._light.shadowPcf=t)}},{key:"shadowBias",get:function(){return this._shadowBias},set:function(t){this._shadowBias=t,this._light&&(this._light.shadowBias=t)}},{key:"shadowNormalBias",get:function(){return this._shadowNormalBias},set:function(t){this._shadowNormalBias=t,this._light&&(this._light.shadowNormalBias=t)}}]),e}(dX),YX=ua(jX.prototype,"_size",[Cj],(function(){return.15})),KX=ua(jX.prototype,"_luminanceHDR",[Cj,NX],(function(){return 1700/NI(.15)})),qX=ua(jX.prototype,"_luminanceLDR",[Cj],(function(){return 1700/NI(.15)*sI.standardExposureValue*sI.standardLightMeterScale})),QX=ua(jX.prototype,"_term",[Cj],(function(){return lX.LUMINOUS_FLUX})),ZX=ua(jX.prototype,"_range",[Cj],(function(){return 1})),JX=ua(jX.prototype,"_spotAngle",[Cj],(function(){return 60})),$X=ua(jX.prototype,"_angleAttenuationStrength",[Cj],(function(){return 0})),tj=ua(jX.prototype,"_shadowEnabled",[Cj],(function(){return!1})),ej=ua(jX.prototype,"_shadowPcf",[Cj],(function(){return iS.HARD})),ij=ua(jX.prototype,"_shadowBias",[Cj],(function(){return 1e-5})),nj=ua(jX.prototype,"_shadowNormalBias",[Cj],(function(){return 0})),f(jX.prototype,"term",[LX],Object.getOwnPropertyDescriptor(jX.prototype,"term"),jX.prototype),f(jX.prototype,"size",[BX],Object.getOwnPropertyDescriptor(jX.prototype,"size"),jX.prototype),f(jX.prototype,"shadowEnabled",[FX,kX],Object.getOwnPropertyDescriptor(jX.prototype,"shadowEnabled"),jX.prototype),f(jX.prototype,"shadowPcf",[UX,GX],Object.getOwnPropertyDescriptor(jX.prototype,"shadowPcf"),jX.prototype),f(jX.prototype,"shadowBias",[HX,zX],Object.getOwnPropertyDescriptor(jX.prototype,"shadowBias"),jX.prototype),f(jX.prototype,"shadowNormalBias",[VX,WX],Object.getOwnPropertyDescriptor(jX.prototype,"shadowNormalBias"),jX.prototype),XX=jX))||XX);t({SpotLight:Ij,SpotLightComponent:Ij}),t("PointLight",(sj=va("cc.PointLight"),oj=Ia("_luminance"),aj=Za(Ze),hj=Za(Ze),uj=Za(lX),cj=Za(Je),sj((_j=function(t){function e(){var e;return(e=t.call(this)||this)._luminanceHDR=dj&&dj(),e._luminanceLDR=fj&&fj(),e._term=pj&&pj(),e._range=gj&&gj(),e._lightType=YI,e}return s(e,t),e.prototype._createLight=function(){t.prototype._createLight.call(this),this._type=CI.POINT,this.range=this._range,this._light&&(this._light.luminanceHDR=this._luminanceHDR,this._light.luminanceLDR=this._luminanceLDR)},n(e,[{key:"luminousFlux",get:function(){return m.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR*NI(1):this._luminanceLDR},set:function(t){var e=0;m.director.root.pipeline.pipelineSceneData.isHDR?(this._luminanceHDR=t/NI(1),e=this._luminanceHDR):(this._luminanceLDR=t,e=this._luminanceLDR),this._light&&(this._light.luminance=e)}},{key:"luminance",get:function(){return m.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){m.director.root.pipeline.pipelineSceneData.isHDR?(this._luminanceHDR=t,this._light&&(this._light.luminanceHDR=this._luminanceHDR)):(this._luminanceLDR=t,this._light&&(this._light.luminanceLDR=this._luminanceLDR))}},{key:"term",get:function(){return this._term},set:function(t){this._term=t}},{key:"range",get:function(){return this._range},set:function(t){this._range=t,this._light&&(this._light.range=t)}}]),e}(dX),dj=ua(_j.prototype,"_luminanceHDR",[wa,oj],(function(){return 1700/NI(.15)})),fj=ua(_j.prototype,"_luminanceLDR",[wa],(function(){return 1700/NI(.15)*sI.standardExposureValue*sI.standardLightMeterScale})),pj=ua(_j.prototype,"_term",[wa],(function(){return lX.LUMINOUS_FLUX})),gj=ua(_j.prototype,"_range",[wa],(function(){return 1})),f(_j.prototype,"luminousFlux",[aj],Object.getOwnPropertyDescriptor(_j.prototype,"luminousFlux"),_j.prototype),f(_j.prototype,"luminance",[hj],Object.getOwnPropertyDescriptor(_j.prototype,"luminance"),_j.prototype),f(_j.prototype,"term",[uj],Object.getOwnPropertyDescriptor(_j.prototype,"term"),_j.prototype),f(_j.prototype,"range",[cj],Object.getOwnPropertyDescriptor(_j.prototype,"range"),_j.prototype),lj=_j))||lj)),t("RangedDirectionalLight",(mj=va("cc.RangedDirectionalLight"),vj=Ia("_illuminance"),yj=Za(Ze),mj((Ej=function(t){function e(){var e;return(e=t.call(this)||this)._illuminanceHDR=Sj&&Sj(),e._illuminanceLDR=Aj&&Aj(),e._lightType=qI,e}return s(e,t),e.prototype._createLight=function(){t.prototype._createLight.call(this),this._type=CI.RANGED_DIRECTIONAL,this._light&&(this._light.illuminanceHDR=this._illuminanceHDR,this._light.illuminanceLDR=this._illuminanceLDR)},n(e,[{key:"illuminance",get:function(){return m.director.root.pipeline.pipelineSceneData.isHDR?this._illuminanceHDR:this._illuminanceLDR},set:function(t){m.director.root.pipeline.pipelineSceneData.isHDR?(this._illuminanceHDR=t,this._light&&(this._light.illuminanceHDR=this._illuminanceHDR)):(this._illuminanceLDR=t,this._light&&(this._light.illuminanceLDR=this._illuminanceLDR))}}]),e}(dX),Sj=ua(Ej.prototype,"_illuminanceHDR",[Sa,vj],(function(){return 65e3})),Aj=ua(Ej.prototype,"_illuminanceLDR",[wa],(function(){return 65e3*sI.standardExposureValue})),f(Ej.prototype,"illuminance",[yj],Object.getOwnPropertyDescriptor(Ej.prototype,"illuminance"),Ej.prototype),Tj=Ej))||Tj)),m.LightComponent=dX,Jt(dX,"cc.LightComponent"),m.DirectionalLightComponent=PX,Jt(PX,"cc.DirectionalLightComponent"),m.SphereLightComponent=rj,Jt(rj,"cc.SphereLightComponent"),m.SpotLightComponent=Ij,Jt(Ij,"cc.SpotLightComponent"),rt(Ij.prototype,"SpotLight.prototype",[{name:"luminousPower",newName:"luminousFlux",customGetter:function(){return this.luminousFlux},customSetter:function(t){this.luminousFlux=t}}]),rt(rj.prototype,"SphereLight.prototype",[{name:"luminousPower",newName:"luminousFlux",customGetter:function(){return this.luminousFlux},customSetter:function(t){this.luminousFlux=t}}]),rt(dX.PhotometricTerm,"Light.PhotometricTerm",[{name:"LUMINOUS_POWER",newName:"LUMINOUS_FLUX"}]);var xj=Symbol("BakeNodeCurves"),Dj=function(){function t(){}return t.getOrExtract=function(e){var i=t.pool.get(e);if(!i||i.samples!==e.sample){i&&m.director.root.dataPoolManager.releaseAnimationClip(e);var n=Math.ceil(e.sample*e.duration)+1,r=e.sample;i=e[xj](0,r,n),t.pool.set(e,i)}return i},t.destroy=function(e){t.pool.delete(e)},t}();Dj.pool=new Map;var Oj=new Ln;function Pj(t,e,i){for(Ln.identity(i);t!==e;)Ln.fromRTS(Oj,t.rotation,t.position,t.scale),Ln.multiply(i,Oj,i),t=t.parent;return i}var Mj=new C_(Il.POINT,Il.POINT,Il.NONE,xl.CLAMP,xl.CLAMP,xl.CLAMP),Nj=function(t,e,i){t[e+0]=i.m00,t[e+1]=i.m01,t[e+2]=i.m02,t[e+3]=i.m12,t[e+4]=i.m04,t[e+5]=i.m05,t[e+6]=i.m06,t[e+7]=i.m13,t[e+8]=i.m08,t[e+9]=i.m09,t[e+10]=i.m10,t[e+11]=i.m14};function Lj(t,e){var i=4/Math.sqrt(e);return 12*Math.ceil(Math.max(480*i,t)/12)}new Rn,new Rn,new _n,new Rn,new _n;var Bj=new _n,Fj=new _n,kj=new _n,Uj=new _n,Gj=new Ln,Hj=new Ln,zj=new Xo,Vj=Number.MAX_SAFE_INTEGER;!function(){function t(t){this._device=void 0,this._pool=void 0,this._textureBuffers=new Map,this._formatSize=void 0,this._pixelsPerJoint=void 0,this._customPool=void 0,this._chunkIdxMap=new Map,this._device=t;var e=function(t){return t.getFormatFeatures(pl.RGBA32F)&Cl.SAMPLED_TEXTURE?pl.RGBA32F:pl.RGBA8}(this._device);this._formatSize=od[e].size,this._pixelsPerJoint=48/this._formatSize,this._pool=new qL(t),this._pool.initialize({format:e,roundUpFn:Lj}),this._customPool=new qL(t),this._customPool.initialize({format:e,roundUpFn:Lj})}var e=t.prototype;e.clear=function(){this._pool.destroy(),this._textureBuffers.clear()},e.registerCustomTextureLayouts=function(t){for(var e=0;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,o=r.length,a=Dj.getOrExtract(e),h=0;h0;){t=Wj[--i],Wj[i]=null;var r=t.node;Ln.fromRTS(t.local,r.rotation,r.position,r.scale),n=Ln.multiply(t.world,n,t.local)}return n}function Yj(t,e){for(var i,n=null,r=0;t!==e;){var s=t.uuid;if(Xj.has(s)){n=Xj.get(s);break}n={node:t,local:new Ln,world:new Ln,stamp:-1,parent:null},Xj.set(s,n),Wj[r++]=n,t=t.parent,n=null}for(;r>0;)i=Wj[--r],Wj[r]=null,i.parent=n,n=i;return n}function Kj(t){for(var e=Xj.get(t.uuid)||null;e;)Xj.delete(e.node.uuid),e=e.parent}var qj=[{name:"CC_USE_SKINNING",value:!0},{name:"CC_USE_REAL_TIME_JOINT_TEXTURE",value:!1}],Qj=[{name:"CC_USE_SKINNING",value:!0},{name:"CC_USE_REAL_TIME_JOINT_TEXTURE",value:!0}];function Zj(t,e,i,n){for(var r=0;r=0&&(e.push(r),t.push(o))}}var Jj=new _n,$j=new _n,tY=new _n,eY=new _n,iY=new Ln,nY=new Xo,rY=function(){this._format=Pf.RGBA32F,this._textures=[],this._buffers=[]};rY.WIDTH=256,rY.HEIGHT=3;var sY,oY,aY,hY,uY,cY,lY,_Y,dY,fY,pY,gY,mY,vY,yY,TY,EY,SY,AY,bY,CY,RY,wY,IY,xY,DY,OY,PY,MY,NY,LY,BY,FY=function(t){function e(){var e;return(e=t.call(this)||this)._buffers=[],e._dataArray=[],e._joints=[],e._bufferIndices=null,e._realTimeJointTexture=new rY,e._realTimeTextureMode=!1,e.type=vI.SKINNING,e}s(e,t);var i=e.prototype;return i.destroy=function(){if(this.bindSkeleton(),this._buffers.length){for(var e=0;e=0?o.instancedAttributeBlock.views[r][0]=i.data[0]:n=!0}return n&&i.dirty&&(i.buffer.update(i.data),i.dirty=!1),!0},i.getMacroPatches=function(e){var i=t.prototype.getMacroPatches.call(this,e);return i?i.concat(kY):kY},i.uploadAnimation=function(t){if(this._skeleton&&this._mesh&&this.uploadedAnim!==t){this.uploadedAnim=t;var e=this._dataPoolManager,i=null;t?(i=e.jointTexturePool.getSequencePoseTexture(this._skeleton,t,this._mesh,this.transform),this._jointsMedium.boundsInfo=i&&i.bounds.get(this._mesh.hash),this._modelBounds=null):(i=e.jointTexturePool.getDefaultPoseTexture(this._skeleton,this._mesh,this.transform),this._jointsMedium.boundsInfo=null,this._modelBounds=i&&i.bounds.get(this._mesh.hash)[0]),this._applyJointTexture(i)}},i._applyJointTexture=function(t){void 0===t&&(t=null);var e=this._jointsMedium.texture;if(e&&e!==t&&this._dataPoolManager.jointTexturePool.releaseHandle(e),this._jointsMedium.texture=t,t){var i=this._jointsMedium,n=i.buffer,r=i.jointTextureInfo;r[0]=t.handle.texture.width,r[1]=this._skeleton.joints.length,r[2]=t.pixelOffset+.1,r[3]=1/r[0],this.updateInstancedJointTextureInfo(),n&&n.update(r);for(var s=t.handle.texture,o=0;o=0&&s.length>0){var o=s[n];o[0]=i.data[0],o[1]=e[1],o[2]=e[2]}}},e}(TV),GY=(sY=va("cc.SkinnedMeshRenderer"),oY=Ta(100),aY=Za(nW),hY=Za(Tm),uY=Za(nW),cY=Za(Tm),sY(lY=oY((_Y=function(t){function e(){var e;return(e=t.call(this)||this)._skeleton=dY&&dY(),e._skinningRoot=fY&&fY(),e._clip=null,e.associatedAnimation=null,e._modelType=UY,e}s(e,t);var i=e.prototype;return i.onLoad=function(){t.prototype.onLoad.call(this),this._tryBindAnimation()},i.onDestroy=function(){this.associatedAnimation&&(this.associatedAnimation.notifySkinnedMeshRemoved(this),this.associatedAnimation),t.prototype.onDestroy.call(this)},i.uploadAnimation=function(t){this._clip=t,this.model&&this.model.uploadAnimation&&this.model.uploadAnimation(t)},i.setUseBakedAnimation=function(t,e){void 0===t&&(t=!0),void 0===e&&(e=!1);var i=t?UY:FY;(e||this._modelType!==i)&&(this._modelType=i,this._model&&(m.director.root.destroyModel(this._model),this._model=null,this._models.length=0,this._updateModels(),this._updateCastShadow(),this._updateReceiveShadow(),this._updateUseLightProbe(),this.enabledInHierarchy&&this._attachToScene()))},i.setSharedMaterial=function(e,i){t.prototype.setSharedMaterial.call(this,e,i),this._modelType===FY&&this.getMaterialInstance(i)},i._updateModelParams=function(){this._update(),t.prototype._updateModelParams.call(this)},i._tryBindAnimation=function(){var t=this._skinningRoot;if(t){for(var e=!1,i=this.node;i;i=i.parent)if(i===t){e=!0;break}if(e){var n=t.getComponent("cc.SkeletalAnimation");n&&n.enabledInHierarchy?n.notifySkinnedMeshAdded(this):this.setUseBakedAnimation(!1)}}},i._update=function(){this.model&&(this.model.bindSkeleton(this._skeleton,this._skinningRoot,this._mesh),this.model.uploadAnimation&&this.model.uploadAnimation(this._clip))},n(e,[{key:"skeleton",get:function(){return this._skeleton},set:function(t){t!==this._skeleton&&(this._skeleton=t,this._update())}},{key:"skinningRoot",get:function(){return this._skinningRoot},set:function(t){t!==this._skinningRoot&&(this._skinningRoot=t,this._tryBindAnimation(),this._update())}},{key:"model",get:function(){return this._model}}]),e}(UV),dY=ua(_Y.prototype,"_skeleton",[aY],(function(){return null})),fY=ua(_Y.prototype,"_skinningRoot",[hY],(function(){return null})),f(_Y.prototype,"skeleton",[uY],Object.getOwnPropertyDescriptor(_Y.prototype,"skeleton"),_Y.prototype),f(_Y.prototype,"skinningRoot",[cY],Object.getOwnPropertyDescriptor(_Y.prototype,"skinningRoot"),_Y.prototype),lY=_Y))||lY)||lY);t({SkinnedMeshRenderer:GY,SkinningModelComponent:GY});var HY=new L_(e_.ATTR_BATCH_ID,pl.R32F),zY=new L_(e_.ATTR_BATCH_UV,pl.RG32F),VY=od[HY.format].size+od[zY.format].size,WY=(pY=va("cc.SkinnedMeshUnit"),gY=Za(ZO),mY=Za(nW),vY=Za($E),yY=Za(GY),pY((EY=function(){function t(){this.mesh=SY&&SY(),this.skeleton=AY&&AY(),this.material=bY&&bY(),this._localTransform=CY&&CY(),this._offset=RY&&RY(),this._size=wY&&wY()}return n(t,[{key:"offset",get:function(){return this._offset},set:function(t){Hn.copy(this._offset,t)}},{key:"size",get:function(){return this._size},set:function(t){Hn.copy(this._size,t)}},{key:"copyFrom",get:function(){return null},set:function(t){t&&(this.mesh=t.mesh,this.skeleton=t.skeleton,this.material=t.getSharedMaterial(0),t.skinningRoot&&Pj(t.node,t.skinningRoot,this._localTransform))}}]),t}(),SY=ua(EY.prototype,"mesh",[gY],(function(){return null})),AY=ua(EY.prototype,"skeleton",[mY],(function(){return null})),bY=ua(EY.prototype,"material",[vY],(function(){return null})),CY=ua(EY.prototype,"_localTransform",[wa],(function(){return new Ln})),RY=ua(EY.prototype,"_offset",[wa],(function(){return new Hn(0,0)})),wY=ua(EY.prototype,"_size",[wa],(function(){return new Hn(1,1)})),f(EY.prototype,"copyFrom",[yY],Object.getOwnPropertyDescriptor(EY.prototype,"copyFrom"),EY.prototype),TY=EY))||TY);t({SkinnedMeshUnit:WY,SkinningModelUnit:WY});var XY=new Ln;new Ln;var jY,YY,KY,qY,QY,ZY,JY,$Y,tK,eK,iK,nK,rK,sK,oK,aK,hK,uK=new _n,cK=(IY=va("cc.SkinnedMeshBatchRenderer"),xY=Ta(100),DY=Za([ti]),OY=Za([WY]),IY(PY=xY((MY=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r=ml.SAMPLER1D){var s=null;t.batchableTextureNames.find((function(t){return t===i}))?((s=t._textures[i])||(s=t.createTexture(i)),t.cookTextures(s,i,n)):t.units.some((function(t){return s=t.material&&t.material.getProperty(i,n)})),s&&e.setProperty(i,s,n)}else{for(var o=[],a=0;a=0)return 1;t.push(i),e.push(Ln.multiply(new Ln,r.bindposes[o]||Ln.IDENTITY,XY))},o=0;ot[i]?1:t[e]0&&d.copyBuffersToTexture(s,_,o),n.length>0&&d.copyTexImagesToTexture(n,_,r)},i.createTexture=function(t){var e=new Sg;return e.setFilters(Nf.LINEAR,Nf.LINEAR),e.setMipFilter(Nf.NEAREST),e.reset({width:this.atlasSize,height:this.atlasSize,format:Pf.RGBA8888}),this._textures[t]=e,e},i.resizeAtlases=function(){for(var t in this._textures)this._textures[t].reset({width:this.atlasSize,height:this.atlasSize,format:Pf.RGBA8888})},i._createUnitMesh=function(t,e){for(var i=JSON.parse(JSON.stringify(e.struct)),n={},r=0;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?k("setRenderer to LOD error, index out of range"):(this.deleteRenderer(t),this.insertRenderer(t,e))},n(t,[{key:"screenUsagePercentage",get:function(){return this._screenUsagePercentage},set:function(t){this._screenUsagePercentage=t,this._LODData.screenUsagePercentage=t}},{key:"renderers",get:function(){return this._renderers},set:function(t){if(t!==this._renderers){var e=!1;this._renderers.length=0,this._LODData.clearModels();for(var i=0;ithis.lodCount)&&(t=this.lodCount),i||(i=new _K),i.modelAddedCallback=this.onLodModelAddedCallback.bind(this),!e){var n=this.getLOD(t-1),r=this.getLOD(t);if(n&&r)e=(n.screenUsagePercentage+r.screenUsagePercentage)/2;else if(n&&!r)(e=n.screenUsagePercentage/2)>.01&&(e=.01);else if(r&&!n){e=r.screenUsagePercentage;var s=this.getLOD(t+1);r.screenUsagePercentage=(e+(s?s.screenUsagePercentage:0))/2}else e=lK[0]}return i.screenUsagePercentage=e,this._LODs.splice(t,0,i),this._lodGroup.insertLOD(t,i.lodData),this._updateDataToScene(),this.node&&this._emitChangeNode(this.node),i},i.eraseLOD=function(t){if(t<0||t>=this.lodCount)return F("eraseLOD error, index out of range"),null;var e=this._LODs[t];return e?(this._LODs.splice(t,1),this._lodGroup.eraseLOD(t),this._updateDataToScene(),this._emitChangeNode(this.node),e):(F("eraseLOD error, LOD not exist at specified index."),null)},i.getLOD=function(t){return t<0||t>=this.lodCount?(F("getLOD error, index out of range"),null):this._LODs[t]},i.setLOD=function(t,e){t<0||t>=this.lodCount?F("setLOD error, index out of range"):(this._LODs[t]=e,e.modelAddedCallback=this.onLodModelAddedCallback.bind(this),this.lodGroup.updateLOD(t,e.lodData),this._updateDataToScene())},i.recalculateBounds=function(){for(var t=new _n,e=new _n,i=null,n=new _n,r=0;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===lI.PLANAR&&(i=this._usePlanarModels);for(var n,r=d(i.entries());!(n=r()).done;){var s=n.value;s[1]===t&&e.push(s[0])}return e},e._removeDependentModels=function(t){for(var e,i=d(this._useCubeModels.keys());!(e=i()).done;){var n=e.value,r=this._useCubeModels.get(n);void 0!==r&&r===t&&(this._useCubeModels.delete(n),this.selectReflectionProbe(n))}for(var s,o=d(this._usePlanarModels.keys());!(s=o()).done;){var a=s.value,h=this._usePlanarModels.get(a);void 0!==h&&h===t&&(this._usePlanarModels.delete(a),this.selectPlanarReflectionProbe(a))}},e._updateCubemapOfModel=function(t,e){var i=t.node;if(i){var n=i.getComponent(UV);if(n&&(n.updateProbeCubemap(e?e.cubemap:null),n.updateReflectionProbeId(e&&e.cubemap?e.getProbeId():-1),e&&(n.updateReflectionProbeDataMap(this._dataTexture),this._isUsedBlending(t)))){var r=this._getBlendProbe(t);this._updateBlendProbeInfo(t,e,r)}}},e._updatePlanarMapOfModel=function(t,e,i){var n=t.node.getComponent(UV);n&&(n.updateProbePlanarMap(e),i?(n.updateReflectionProbeId(i.getProbeId()),n.updateReflectionProbeDataMap(this._dataTexture)):n.updateReflectionProbeId(-1))},e._isUsedBlending=function(t){return t.reflectionProbeType===pI.BLEND_PROBES||t.reflectionProbeType===pI.BLEND_PROBES_AND_SKYBOX},e._updateBlendProbeInfo=function(t,e,i){var n=t.node;if(n){var r=n.getComponent(UV);r&&(i?(r.updateReflectionProbeBlendId(i.getProbeId()),r.updateProbeBlendCubemap(i.cubemap),r.updateReflectionProbeBlendWeight(this._calculateBlendWeight(t,e,i))):(r.updateReflectionProbeBlendId(-1),t.reflectionProbeType===pI.BLEND_PROBES_AND_SKYBOX&&r.updateReflectionProbeBlendWeight(this._calculateBlendWeight(t,e,i))))}},e._updateBlendCubemap=function(t,e){var i=t.node;if(i&&this._isUsedBlending(t)){var n=i.getComponent(UV);n&&n.updateProbeBlendCubemap(e.cubemap)}},e._calculateBlendWeight=function(t,e,i){if(i){var n=_n.distance(t.node.worldPosition,e.node.worldPosition),r=_n.distance(t.node.worldPosition,i.node.worldPosition);return 1-r/(n+r)}return t.reflectionProbeType===pI.BLEND_PROBES?0:t.reflectionProbeType===pI.BLEND_PROBES_AND_SKYBOX?this._calculateBlendOfSkybox(t.worldBounds,e.boundingBox):0},e._calculateBlendOfSkybox=function(t,e){if(!t)return 1;var i=new _n,n=new _n,r=new _n,s=new _n;if(_n.subtract(i,t.center,t.halfExtents),_n.add(n,t.center,t.halfExtents),_n.subtract(r,e.center,e.halfExtents),_n.add(s,e.center,e.halfExtents),i.x<=s.x&&n.x>=r.x&&i.y<=s.y&&n.y>=r.y&&i.z<=s.z&&n.z>=r.z){var o=new _n;_n.multiplyScalar(o,t.halfExtents,2);var a=i.x+o.x<=s.x&&n.x+o.x>=r.x,h=i.x-o.x<=s.x&&n.x-o.x>=r.x,u=i.y+o.y<=s.y&&n.y+o.y>=r.y,c=i.y-o.y<=s.y&&n.y-o.y>=r.y,l=i.z+o.z<=s.z&&n.z+o.z>=r.z,_=i.z-o.z<=s.z&&n.z-o.z>=r.z,d=[];if(!a){var f=n.x-s.x;d.push(f/o.x)}if(!h){var p=Math.abs(i.x-r.x);d.push(p/o.x)}if(!u){var g=n.y-s.y;d.push(g/o.y)}if(!c){var m=Math.abs(i.y-r.y);d.push(m/o.y)}if(!l){var v=n.z-s.z;d.push(v/o.z)}if(!_){var y=Math.abs(i.z-r.z);d.push(y/o.z)}return d.length>0?(d.sort((function(t,e){return e-t})),d[0]):0}return 1},n(t,[{key:"updateForRuntime",get:function(){return this._updateForRuntime},set:function(t){this._updateForRuntime=t}}]),t}());function pK(t){return void 0===(t=t||{}).includeNormal&&(t.includeNormal=!0),void 0===t.includeUV&&(t.includeUV=!0),t}fK.probeManager=void 0,fK.probeManager=new fK,m.internal.reflectionProbeManager=fK.probeManager;var gK=new _n,mK=new _n,vK=new _n,yK=new _n,TK=new _n,EK=new _n,SK=new _n,AK=new _n,bK=new _n,CK=new _n,RK=new _n,wK=new _n,IK=new _n(0,0,0),xK=new _n(0,0,0);function DK(t,e,i,n){void 0===t&&(t=.5),void 0===e&&(e=.5),void 0===i&&(i=2),void 0===n&&(n={});var r=.5*i,s=n.radialSegments||32,o=n.heightSegments||1,a=void 0===n.capped||n.capped,h=n.arc||2*Math.PI,u=0;a&&(t>0&&u++,e>0&&u++);var c=(s+1)*(o+1);a&&(c+=(s+1)*u+s*u);var l=s*o*6;a&&(l+=s*u*3);var _=new Array(l),d=new Array(3*c),f=new Array(3*c),p=new Array(2*c),g=Math.max(t,e),m=new _n(-g,-r,-g),v=new _n(g,r,g),y=Math.sqrt(g*g+r*r),T=0,E=0;return function(){for(var n=[],a=t-e,u=a*a/i*Math.sign(a),c=0;c<=o;c++){for(var l=[],g=c/o,m=g*a+e,v=0;v<=s;++v){var y=v/s,S=y*h,A=Math.sin(S),b=Math.cos(S);d[3*T]=m*A,d[3*T+1]=g*i-r,d[3*T+2]=m*b,_n.normalize(IK,_n.set(xK,A,-u,b)),f[3*T]=IK.x,f[3*T+1]=IK.y,f[3*T+2]=IK.z,p[2*T]=2*(1-y)%1,p[2*T+1]=g,l.push(T),++T}n.push(l)}for(var C=0;C0&&S(!1),t>0&&S(!0)),{positions:d,normals:f,uvs:p,indices:_,minPos:m,maxPos:v,boundingRadius:y};function S(i){for(var n=i?t:e,o=i?1:-1,a=T,u=1;u<=s;++u)d[3*T]=0,d[3*T+1]=r*o,d[3*T+2]=0,f[3*T]=0,f[3*T+1]=o,f[3*T+2]=0,p[2*T]=.5,p[2*T+1]=.5,++T;for(var c=T,l=0;l<=s;++l){var g=l/s*h,m=Math.cos(g),v=Math.sin(g);d[3*T]=n*v,d[3*T+1]=r*o,d[3*T+2]=n*m,f[3*T]=0,f[3*T+1]=o,f[3*T+2]=0,p[2*T]=.5-.5*v*o,p[2*T+1]=.5+.5*m,++T}for(var y=0;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:Hl.TRIANGLE_FAN}},translate:function(t,e){for(var i=e.x||0,n=e.y||0,r=e.z||0,s=Math.floor(t.positions.length/3),o=0;oh?h<<16|a:a<<16|h;void 0===r[u]&&(r[u]=0,n.push(a,h))}return t.indices=n,t.primitiveMode=Hl.LINE_LIST,t},wireframe:function(t){for(var e=[[0,1],[1,2],[2,0]],i=[],n={},r=0;ra?a<<16|o:o<<16|a;void 0===n[h]&&(n[h]=0,i.push(o,a))}return i},invWinding:function(t){for(var e=[],i=0;i=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(bq.PLAY,this),null===(t=this._clipEmbeddedPlayerEval)||void 0===t||t.notifyHostPlay(this.current)},i.onStop=function(){var t;this.isPaused||this._onPauseOrStop(),this.emit(bq.STOP,this),null===(t=this._clipEmbeddedPlayerEval)||void 0===t||t.notifyHostStop()},i.onResume=function(){var t;this._onReplayOrResume(),this.emit(bq.RESUME,this),null===(t=this._clipEmbeddedPlayerEval)||void 0===t||t.notifyHostPlay(this.current)},i.onPause=function(){var t;this._onPauseOrStop(),this.emit(bq.PAUSE,this),null===(t=this._clipEmbeddedPlayerEval)||void 0===t||t.notifyHostPause(this.current)},i._sampleCurves=function(t){var e=this._poseOutput,i=this._clipEval;e&&(e.weight=this.weight),i&&i.evaluate(t)},i._process=function(){this._useSimpleProcess?this.simpleProcess():this.process()},i.process=function(){var t,e=this.sample();this._allowLastFrame&&(t=this._lastWrapInfo?this._lastWrapInfo:this._lastWrapInfo=new Cq(e),this.repeatCount>1&&(0|e.iterations)>(0|t.iterations)&&this.emit(bq.LASTFRAME,this),t.set(e)),e.stopped&&(this.stop(),this.emit(bq.FINISHED,this))},i.simpleProcess=function(){var t=this._playbackRange.min,e=this._playbackDuration,i=0,n=0;if(0!==e&&((i=this.time%e)<0&&(i+=e),n=(t+i)*this._invDuration),this._sampleCurves(t+i),this._clipEventEval||this._clipEmbeddedPlayerEval){var r=this.getWrappedInfo(this.time,this._wrappedInfo);this._sampleEvents(r),this._sampleEmbeddedPlayers(r)}this._allowLastFrame&&(Number.isNaN(this._lastIterations)&&(this._lastIterations=n),(this.time>0&&this._lastIterations>n||this.time<0&&this._lastIterations0&&(t-=1),1&t&&(i=!i)),(e&bc.Reverse)===bc.Reverse&&(i=!i),i},i.getWrappedInfo=function(t,e){e=e||new Cq;var i=this._playbackRange.min,n=this._playbackDuration,r=this.repeatCount;if(0===n)return e.time=0,e.ratio=0,e.direction=1,e.stopped=!!Number.isFinite(r),e.iterations=0,e;var s=!1,o=(t-=i)>0?t/n:-t/n;if(o>=r){o=r,s=!0;var a=r-(0|r);0===a&&(a=1),t=a*n*(t>0?1:-1)}if(t>n){var h=t%n;t=0===h?n:h}else t<0&&0!=(t%=n)&&(t+=n);var u=!1,c=this._wrapMode&bc.ShouldWrap;c&&(u=this._needReverse(o));var l=u?-1:1;return this.speed<0&&(l*=-1),c&&u&&(t=n-t),e.time=i+t,e.ratio=e.time/this.duration,e.direction=l,e.stopped=s,e.iterations=o,e},i._getPlaybackStart=function(){return this._playbackRange.min},i._sampleEvents=function(t){var e;null===(e=this._clipEventEval)||void 0===e||e.sample(t.ratio,t.direction,t.iterations)},i._sampleEmbeddedPlayers=function(t){var e;null===(e=this._clipEmbeddedPlayerEval)||void 0===e||e.evaluate(t.time,Math.trunc(t.iterations))},i._emit=function(t,e){this._target&&this._target.isValid&&this._target.emit(t,t,e)},i._onReplayOrResume=function(){wq().addAnimation(this)},i._onPauseOrStop=function(){wq().removeAnimation(this)},n(e,[{key:"clip",get:function(){return this._clip}},{key:"name",get:function(){return this._name}},{key:"length",get:function(){return this.duration}},{key:"wrapMode",get:function(){return this._wrapMode},set:function(t){var e;this._wrapMode=t,this.time=0,t&bc.Loop?this.repeatCount=1/0:this.repeatCount=1,null===(e=this._clipEventEval)||void 0===e||e.setWrapMode(t)}},{key:"repeatCount",get:function(){return this._repeatCount},set:function(t){this._repeatCount=t;var e=this._wrapMode&bc.ShouldWrap,i=(this.wrapMode&bc.Reverse)===bc.Reverse;this._useSimpleProcess=t===1/0&&!e&&!i}},{key:"delay",get:function(){return this._delay},set:function(t){this._delayTime=this._delay=t}},{key:"playbackRange",get:function(){return this._playbackRange},set:function(t){t.max,t.min,this._playbackRange.min=Math.max(t.min,0),this._playbackRange.max=Math.min(t.max,this.duration),this._playbackDuration=this._playbackRange.max-this._playbackRange.min,this.setTime(0)}},{key:"speed",get:function(){return this._speed},set:function(t){var e;this._speed=t,null===(e=this._clipEmbeddedPlayerEval)||void 0===e||e.notifyHostSpeedChanged(t)}},{key:"current",get:function(){return this.getWrappedInfo(this.time).time}},{key:"ratio",get:function(){return 0===this.duration?0:this.current/this.duration}},{key:"weight",get:function(){return this._weight},set:function(t){this._weight=t,this._poseOutput&&(this._poseOutput.weight=t)}},{key:"curveLoaded",get:function(){return this._curveLoaded}}]),e}(Aq));m.AnimationState=Oq,va("cc.animation.EmbeddedAnimationClipPlayable")((Iq=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;re){var i;(i=this._channels).push.apply(i,Array.from({length:t-e},(function(){return new gQ(new Eu)})))}}}]),e}(pQ),aQ=ua(oQ.prototype,"_channels",[yQ],(function(){return[]})),oQ));var TQ,EQ,SQ,AQ,bQ,CQ,RQ,wQ,IQ,xQ,DQ,OQ,PQ,MQ,NQ,LQ,BQ,FQ,kQ=function(){function t(t){this._curves=t,this._result=new Array(t.length).fill(0)}return t.prototype.evaluate=function(t){for(var e=this._result,i=e.length,n=0;n=t.passes.length)q(3941,t.name,e);else{var r=t.passes[e],s=r.getHandle(i);if(s){if(GE.getTypeFromHandle(s)1}return!1}(r,i)?{set:function(t){r.setUniformArray(o,t)}}:{set:function(t){r.setUniform(o,t)}}:void q(3943,t.name,e,i,n)}var a=GE.getBindingFromHandle(s),h=r.properties[i],u=h&&h.value?""+h.value+ky(h.type):Fy(h.type),c=NE.get(u);return c||(F("Illegal texture default value: "+u+"."),c=NE.get("default-texture")),{set:function(t){t||(t=c);var e=t.getGFXTexture();e&&e.width&&e.height&&(r.bindTexture(a,e),t instanceof rp&&r.bindSampler(a,Qd.gfxDevice.getSampler(t.getSamplerInfo())))}}}q(3942,t.name,e,i)}}else q(3940,t)},t}(),SQ=ua(EQ.prototype,"passIndex",[wa],(function(){return 0})),AQ=ua(EQ.prototype,"uniformName",[wa],(function(){return""})),bQ=f(EQ.prototype,"channelIndex",[Ka],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){}}),TQ=EQ))||TQ,GQ=va("cc.animation.MorphWeightValueProxy")((RQ=function(){function t(){this.subMeshIndex=wQ&&wQ(),this.shapeIndex=IQ&&IQ()}return t.prototype.forTarget=function(t){var e=this;return{set:function(i){t.setWeight(i,e.subMeshIndex,e.shapeIndex)}}},t}(),wQ=ua(RQ.prototype,"subMeshIndex",[wa],(function(){return 0})),IQ=ua(RQ.prototype,"shapeIndex",[wa],(function(){return 0})),CQ=RQ))||CQ,HQ=va("cc.animation.MorphWeightsValueProxy")((DQ=function(){function t(){this.subMeshIndex=OQ&&OQ()}return t.prototype.forTarget=function(t){var e=this;return{set:function(i){t.setWeights(i,e.subMeshIndex)}}},t}(),OQ=ua(DQ.prototype,"subMeshIndex",[wa],(function(){return 0})),xQ=DQ))||xQ,zQ=va("cc.animation.MorphWeightsAllValueProxy")(PQ=function(){function t(){}return t.prototype.forTarget=function(t){return{set:function(e){for(var i,n,r=null!==(i=null===(n=t.mesh)||void 0===n?void 0:n.struct.primitives.length)&&void 0!==i?i:0,s=0;s1e-6){n=!1;break}this._findRatio=n?IZ:na}return t.prototype.sample=function(t){return this._findRatio(this.ratios,t)},t}());m.RatioSampler=bZ;var CZ=t("AnimCurve",function(){function t(e,i){this.types=void 0,this.type=null,this._values=[],this._lerp=void 0,this._duration=void 0,this._array=void 0,this._duration=i,this._values=e.values;var n=function(e){return"string"==typeof e?e:Array.isArray(e)?e[0]===e[1]&&e[2]===e[3]?t.Linear:t.Bezier(e):t.Linear};if(void 0!==e.easingMethod)this.type=n(e.easingMethod);else if(Array.isArray(e.easingMethods))this.types=e.easingMethods.map(n);else if(void 0!==e.easingMethods){this.types=new Array(this._values.length).fill(null);for(var r=0,s=Object.keys(e.easingMethods);r=e.ratios.length))return t.valueBetween(i,n-1,e.ratios[n-1],n,e.ratios[n]);n=e.ratios.length-1}return t.valueAt(n)}function wZ(t,e){if("string"==typeof e){var i=cu[e];i?t=i(t):Z(3906,e)}else Array.isArray(e)&&(t=ic(e,t));return t}function IZ(t,e){var i=t.length-1;if(0===i)return 0;var n=t[0];if(er)return i;var s=(e=(e-n)/(r-n))/(1/i),o=0|s,a=1e-6;return s-o=0)i=r;else{var s=~r,o=s-1;i=o;var a=t[s],h=t[o];n=(e-h)/(a-h)}return{index:i,ratio:n}}!function(){function t(){this._reset()}var e=t.prototype;e.calculate=function(t,e,i){if(this._reset(),!(e>i)){var n=t.length;if(n){var r=t[0],s=t[n-1],o=0,a=0;if(e=s)o=n-1,a=0;else{var h=bJ(t,e);o=h.index,a=h.ratio}var u=0,c=0;if(i=s)u=n-1,c=0;else{var l=bJ(t,i);u=l.index,c=l.ratio}var _=!a,d=!c;o!==u||a!==c?(_||(this.preLerpIndex=o,this.preLerpRatio=a),this.directKeyframesBegin=_?o:o+1,this.directKeyframesEnd=u+1,d||(this.postLerpIndex=u,this.postLerpRatio=c)):_?(this.directKeyframesBegin=o,this.directKeyframesEnd=o+1):(this.preLerpIndex=o,this.preLerpRatio=a)}}},e._reset=function(){this.preLerpIndex=-1,this.preLerpRatio=0,this.directKeyframesBegin=0,this.directKeyframesEnd=0,this.postLerpIndex=-1,this.postLerpRatio=0},n(t,[{key:"keyframesCount",get:function(){var t=this.preLerpIndex,e=this.directKeyframesBegin;return 0+(t<0?0:1)+(this.directKeyframesEnd-e)+(this.postLerpIndex<0?0:1)}}])}();var CJ,RJ=function(){function t(t,e){this._nodeEvaluations=void 0,this._nodeEvaluations=t.map((function(t){return t.createEvaluator(e)}))}return t.prototype.evaluate=function(t){this._nodeEvaluations.forEach((function(e){e.evaluate(t)}))},t}(),wJ=function(){function t(t,e,i,n,r){this._position=null,this._rotation=null,this._scale=null,e&&(this._position=UJ(e.times,e.values,_n,t,"position",r)),i&&(this._rotation=UJ(i.times,i.values,Rn,t,"rotation",r)),n&&(this._scale=UJ(n.times,n.values,_n,t,"scale",r))}return t.prototype.evaluate=function(t){if(this._position){var e=this._position.evaluator.evaluate(t);this._position.runtimeBinding.setValue(e)}if(this._rotation){var i=this._rotation.evaluator.evaluate(t);this._rotation.runtimeBinding.setValue(i)}if(this._scale){var n=this._scale.evaluator.evaluate(t);this._scale.runtimeBinding.setValue(n)}},t}(),IJ=function(){function t(t,e,i){this._times=void 0,this._inputSampleResultCache={just:!1,index:-1,nextIndex:-1,ratio:0},this._values=void 0,this._prevValue=void 0,this._nextValue=void 0,this._resultValue=void 0,this._times=t,this._values=e,this._prevValue=new i,this._nextValue=new i,this._resultValue=new i}return t.prototype.evaluate=function(t){var e=this._times,i=this._values,n=this._resultValue;if(0===e.length)return n;var r=function(t,e,i){var n=t.length,r=t[0],s=t[n-1];if(es)i.just=!0,i.index=n-1;else{var o=na(t,e);if(o>=0)i.just=!0,i.index=o;else{var a=~o,h=a-1,u=t[h],c=t[a],l=(e-t[h])/(c-u);i.just=!1,i.index=h,i.nextIndex=a,i.ratio=l}}return i}(e,t,this._inputSampleResultCache);return r.just?i.get(r.index,n):i.lerp(r.index,r.nextIndex,r.ratio,this._prevValue,this._nextValue,n),n},t}(),xJ=function(){function t(t,e){this._nodeEvaluations=void 0,this._nodeEvaluations=t.map((function(t){return t.createEvaluatorForAnimationGraph(e)})).filter((function(t){return!!t}))}var e=t.prototype;return e.destroy=function(){for(var t=this._nodeEvaluations,e=t.length,i=0;i=0){var _=u.substring(0,l),d=h[_];d&&(c.parent=d)}}for(var f=this._createEvalWithBinder(void 0,(function(t){var e=t.parseTrsPath();if(e){var i=h[e.node];if(i)return w$(i,e.property)}}),void 0),p=0;p=0&&this._embeddedPlayers.splice(e,1)},i[p$]=function(){this._embeddedPlayers.length=0},i.getAuxiliaryCurveNames_experimental=function(){return this._auxiliaryCurveEntries.map((function(t){return t.name}))},i.hasAuxiliaryCurve_experimental=function(t){return!!this._findAuxiliaryCurveEntry(t)},i.addAuxiliaryCurve_experimental=function(t){var e=this._findAuxiliaryCurveEntry(t);return e||((e=new a$).name=t,this._auxiliaryCurveEntries.push(e)),e.curve},i.getAuxiliaryCurve_experimental=function(t){return this._findAuxiliaryCurveEntry(t).curve},i.renameAuxiliaryCurve_experimental=function(t,e){var i=this._findAuxiliaryCurveEntry(t);i&&(i.name=e)},i.removeAuxiliaryCurve_experimental=function(t){le(this._auxiliaryCurveEntries,(function(e){return e.name===t}))},i._trySyncLegacyData=function(){this._legacyDataDirty&&(this._legacyDataDirty=!1,this.syncLegacyData())},i._createEvalWithBinder=function(t,e,i){this._legacyDataDirty&&(this._legacyDataDirty=!1,this.syncLegacyData());var n,r=[];i&&(n=this._createRootMotionEvaluation(t,i,r));for(var s,o=[],a=this._tracks,h=a.length,u=0;u=l&&t<=_?a?e!==u&&(h.stop(),h.play(),o.entered=!0):(h.play(),o.entered=!0):a&&(h.stop(),o.entered=!1),o.lastIterations=e,o.entered){var d=t-l;o.instantiatedPlayer.setTime(d)}}}},e.notifyHostSpeedChanged=function(t){for(var e=this._embeddedPlayers,i=this._embeddedPlayerEvaluationInfos,n=e.length,r=0;r0?((s&bc.PingPong)===bc.PingPong?e*=-1:h=n,a++):1===e&&h===n-1&&ro)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,o=s.position,a=s.scale,h=s.rotation,u=s.eulerAngles;r&&(o&&r&O$.POSITION&&(e=o.result),a&&r&O$.SCALE&&(i=a.result),u&&r&O$.EULER_ANGLES&&(n=u.result),h&&r&O$.ROTATION&&(n=h.result),(n||e||i)&&t.setRTS(n,e,i),this._transformApplyFlags=0)},n(t,[{key:"empty",get:function(){var t=this._properties;return!(t.position||t.rotation||t.eulerAngles||t.scale)}}]),t}()),U$=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.createNodeBlendState=function(){return new k$},e}(P$),G$=t("AnimationManager",va(((L$=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r=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),o=n.target&&s&&Yj(s,t);o&&i._sockets.push({target:n.target,transform:o})},r=0;r=h.easeDuration){o=a+1,h.easeTime=h.easeDuration;break}}if(o!==i.length){for(var l=o;l=0||(this._clips.push(t),this.createState(t)))}}]),e}(so(xp))).EventType=bq,f((Y$=Z$).prototype,"clips",[V$],Object.getOwnPropertyDescriptor(Y$.prototype,"clips"),Y$.prototype),f(Y$.prototype,"defaultClip",[W$],Object.getOwnPropertyDescriptor(Y$.prototype,"defaultClip"),Y$.prototype),K$=ua(Y$.prototype,"playOnLoad",[wa],(function(){return!1})),q$=ua(Y$.prototype,"_clips",[X$],(function(){return[]})),Q$=ua(Y$.prototype,"_defaultClip",[wa],(function(){return null})),j$=Y$))||j$)||j$);function n0(t,e){return t===e||!!t&&!!e&&t._uuid===e._uuid&&t._uuid}t({Animation:i0,AnimationComponent:i0}),m.Animation=i0,m.AnimationComponent=i0,Jt(i0,"cc.AnimationComponent"),function(t){t.PLAYED="play",t.PAUSED="pause",t.STOPPED="stop",t.SEEKED="seeked",t.ENDED="ended",t.INTERRUPTION_BEGIN="interruptionBegin",t.INTERRUPTION_END="interruptionEnd",t.USER_GESTURE="on_gesture"}(J$||(J$={})),function(t){t[t.DOM_AUDIO=0]="DOM_AUDIO",t[t.WEB_AUDIO=1]="WEB_AUDIO",t[t.MINIGAME_AUDIO=2]="MINIGAME_AUDIO",t[t.NATIVE_AUDIO=3]="NATIVE_AUDIO",t[t.UNKNOWN_AUDIO=4]="UNKNOWN_AUDIO"}($$||($$={})),function(t){t[t.INIT=0]="INIT",t[t.PLAYING=1]="PLAYING",t[t.PAUSED=2]="PAUSED",t[t.STOPPED=3]="STOPPED",t[t.INTERRUPTED=4]="INTERRUPTED"}(t0||(t0={})),t("AudioPCMDataView",function(){function t(){this._bufferView=void 0,this._normalizeFactor=1;for(var t=arguments.length,e=new Array(t),i=0;i=0;s--){var o=i[s];if("stop"===o.op){n.push(o);break}if("seek"===o.op)r||(n.push(o),r=!0);else{if(r){n.push(o);break}0===n.length&&n.push(o)}}t._operationQueue=n.reverse()}(t);var i=t._operationQueue[0];i&&o0(t,i)})).catch((function(){})))}function a0(t,e,i){var n=i.value;i.value=function(){for(var t=this,i=arguments.length,r=new Array(i),s=0;s-1?(t[i].playTime=performance.now(),!1):(t.push({audio:e,playTime:performance.now()}),!0)},e.addPlaying=function(t){t instanceof p0?this._tryAddPlaying(this._audioPlayerInfoList,t):this._tryAddPlaying(this._oneShotAudioInfoList,t)},e._tryRemovePlaying=function(t,e){var i=this._findIndex(t,e);return-1!==i&&(he(t,i),!0)},e.removePlaying=function(t){t instanceof p0?this._tryRemovePlaying(this._audioPlayerInfoList,t):this._tryRemovePlaying(this._oneShotAudioInfoList,t)},e.discardOnePlayingIfNeeded=function(){var t;this._audioPlayerInfoList.length+this._oneShotAudioInfoList.length0?this._oneShotAudioInfoList.forEach((function(e){(!t||e.playTime0;)n+="/",n+=i[r];return n}(this,t)},t}();function z2(t,e){e.descriptorID=t.n(),e.type=t.n(),e.count=t.n()}function V2(t,e){var i;e.type=t.n(),e.visibility=t.n(),e.offset=t.n(),e.capacity=t.n(),i=t.n(),e.descriptors.length=i;for(var n=0;n!==i;++n){var r=new I2;z2(t,r),e.descriptors[n]=r}}function W2(t,e){e.slot=t.n(),e.capacity=t.n(),e.uniformBlockCapacity=t.n(),e.samplerTextureCapacity=t.n();var i=0;i=t.n(),e.descriptorBlocks.length=i;for(var n=0;n!==i;++n){var r=new x2;V2(t,r),e.descriptorBlocks[n]=r}i=t.n();for(var s=0;s!==i;++s){var o=t.n(),a=new w_;q0(t,a),e.uniformBlocks.set(o,a)}i=t.n();for(var h=0;h!==i;++h){var u=t.n(),c=t.n();e.bindingMap.set(u,c)}}function X2(t,e){W2(t,e.descriptorSetLayoutData),function(t,e){var i=t.n();e.bindings.length=i;for(var n=0;n!==i;++n){var r=new Y_;Q0(t,r),e.bindings[n]=r}}(t,e.descriptorSetLayoutInfo)}function j2(t,e){var i;i=t.n();for(var n=0;n!==i;++n){var r=t.n(),s=new O2;X2(t,s),e.descriptorSets.set(r,s)}}function Y2(t,e){var i;i=t.n();for(var n=0;n!==i;++n){var r=t.n(),s=t.n();e.descriptorBindings.set(r,s)}}function K2(t,e){var i=0;i=t.n();for(var n=0;n!==i;++n){var r=t.n(),s=new D2;W2(t,s),e.layoutData.set(r,s)}i=t.n();for(var o=0;o!==i;++o){var a=t.n(),h=new M2;Y2(t,h),e.bindingData.set(a,h)}}function q2(t,e){var i;i=t.n(),e.passes.length=i;for(var n=0;n!==i;++n){var r=new N2;K2(t,r),e.passes[n]=r}}function Q2(t,e){var i;i=t.n();for(var n=0;n!==i;++n){var r=t.s(),s=new L2;q2(t,s),e.techniques.set(r,s)}}function Z2(t,e){j2(t,e.layout)}function J2(t,e){var i;i=t.n();for(var n=0;n!==i;++n){var r=t.n(),s=t.n();e.descriptorVisibility.set(r,s)}}function $2(t,e){e.rootSignature=t.s();var i=0;i=t.n(),e.shaderPrograms.length=i;for(var n=0;n!==i;++n){var r=new F2;Z2(t,r),e.shaderPrograms[n]=r}i=t.n();for(var s=0;s!==i;++s){var o=t.s(),a=t.n();e.shaderIndex.set(o,a)}}function t3(t,e){var i=t.n();t.n(),t.n(),t.n();for(var n=0;n!==i;++n){var r=t.n(),s=t.n(),o=t.s(),a=t.n(),h=new P2;switch(j2(t,h),r){case 0:var u=new k2;J2(t,u),e.addVertex(0,u,o,a,h,s);break;case 1:var c=new U2;$2(t,c),e.addVertex(1,c,o,a,h,s)}}var l=0;l=t.n(),e.valueNames.length=l;for(var _=0;_!==l;++_)e.valueNames[_]=t.s();l=t.n();for(var d=0;d!==l;++d){var f=t.s(),p=t.n();e.attributeIndex.set(f,p)}l=t.n();for(var g=0;g!==l;++g){var m=t.s(),v=t.n();e.constantIndex.set(m,v)}l=t.n();for(var y=0;y!==l;++y){var T=t.s(),E=t.n();e.shaderLayoutIndex.set(T,E)}l=t.n();for(var S=0;S!==l;++S){var A=t.s(),b=new B2;Q2(t,b),e.effects.set(A,b)}}var e3,i3=function(){function t(t){this.colors=void 0,this.colors=new Array(t)}var e=t.prototype;return e.get=function(t){return this.colors[t]},e.put=function(t,e){this.colors[t]=e},t}();function n3(t){switch(t){case ml.BOOL:case ml.INT:case ml.UINT:case ml.FLOAT:return 1;case ml.INT2:case ml.FLOAT2:case ml.UINT2:case ml.BOOL2:return 2;case ml.FLOAT3:case ml.BOOL3:case ml.UINT3:case ml.INT3:return 3;case ml.BOOL4:case ml.FLOAT4:case ml.UINT4:case ml.INT4:case ml.MAT2:return 4;case ml.MAT2X3:case ml.MAT3X2:return 6;case ml.MAT2X4:case ml.MAT4X2:return 8;case ml.MAT3:return 9;case ml.MAT3X4:case ml.MAT4X3:return 12;case ml.MAT4:return 16;default:return 0}}function r3(t,e){var i=Bl.CLEAR;return t&Zl.COLOR||e!==s1.RENDER_TARGET||(i=t&nI?Bl.CLEAR:Bl.LOAD),(t&Zl.DEPTH_STENCIL)!==Zl.DEPTH_STENCIL&&e===s1.DEPTH_STENCIL&&(t&Zl.DEPTH||(i=Bl.LOAD),t&Zl.STENCIL||(i=Bl.LOAD)),i}function s3(t,e,i,n,r,s){void 0===n&&(n=null),void 0===r&&(r=0),void 0===s&&(s=void 0),s=s||new o_;var o=t?t.viewport:new o_(0,0,1,1),a=e,h=i;if(s.x=o.x*a,s.y=o.y*h,s.width=o.width*a,s.height=o.height*h,n)switch(n.type){case CI.DIRECTIONAL:var u=n;if(u.shadowFixedArea||u.csmLevel===nS.LEVEL_1)s.x=0,s.y=0,s.width=a,s.height=h;else{var c=m.director.root.device.capabilities.screenSpaceSignY;s.x=r%2*.5*a,s.y=c>0?.5*(1-Math.floor(r/2))*h:.5*Math.floor(r/2)*h,s.width=.5*a,s.height=.5*h}break;case CI.SPOT:s.x=0,s.y=0,s.width=a,s.height=h}return s}function o3(t,e,i,n,r){var s="Camera"+r,o=i.renderArea(),a=o.x,h=o.y,u=i.camera,c="reflectionProbePassColor"+s,l="reflectionProbePassDS"+s;e.containsResource(c)||(e.addRenderWindow(c,pl.RGBA8,a,h,n),e.addDepthStencil(l,pl.DEPTH_STENCIL,a,h,Z0.EXTERNAL)),e.updateRenderWindow(c,n),e.updateDepthStencil(l,a,h);var _=e.addRenderPass(a,h,"default");_.name="ReflectionProbePass"+r,_.setViewport(new d_(0,0,a,h)),_.addRenderTarget(c,r3(u.clearFlag,s1.RENDER_TARGET),Fl.STORE,new f_(u.clearColor.x,u.clearColor.y,u.clearColor.z,u.clearColor.w)),_.addDepthStencil(l,r3(u.clearFlag,s1.DEPTH_STENCIL),Fl.STORE,u.clearDepth,u.clearStencil,u.clearFlag);var d=_.addQueue(J0.RENDER_OPAQUE,"reflect-map"),f=new a1;f.probe=i,d.addSceneOfCamera(t,f,e1.REFLECTION_PROBE|e1.OPAQUE_OBJECT),function(t,e,i){var n=m.director.root.pipeline,r=i.pipelineSceneData,s=r.skybox;t.setMat4("cc_matView",e.matView),t.setMat4("cc_matViewInv",e.node.worldMatrix),t.setMat4("cc_matProj",e.matProj),t.setMat4("cc_matProjInv",e.matProjInv),t.setMat4("cc_matViewProj",e.matViewProj),t.setMat4("cc_matViewProjInv",e.matViewProjInv),t.setVec4("cc_cameraPos",new on(e.position.x,e.position.y,e.position.z,n.getCombineSignY())),t.setVec4("cc_surfaceTransform",new on(e.surfaceTransform,0,Math.cos(Li(s.getRotationAngle())),Math.sin(Li(s.getRotationAngle())))),t.setVec4("cc_screenScale",new on(r.shadingScale,r.shadingScale,1/r.shadingScale,1/r.shadingScale)),t.setVec4("cc_exposure",new on(e.exposure,1/e.exposure,r.isHDR?1:0,1/sI.standardExposureValue))}(d,u,e)}function a3(t,e,i){!function(t,e,i){i instanceof yd?t.bindBuffer(e,i):i instanceof Ud?t.bindTexture(e,i):i instanceof Fd&&t.bindSampler(e,i)}(t,e,i)}function h3(t,e){for(var i,n=d(e.descriptorSetLayoutData.descriptorBlocks);!(i=n()).done;)for(var r=i.value,s=0;s!==r.descriptors.length;++s)if(t===r.descriptors[s].descriptorID)return r.offset+s;return-1}new Xo(0,0,0,.5,.5,.5),new Xo,function(t){t[t.NONE=0]="NONE",t[t.FXAA=1]="FXAA",t[t.FXAAHQ=2]="FXAAHQ"}(e3||(e3={})),new(function(){function t(){this.shadowEnabled=!1,this.mainLightShadowNames=new Array,this.spotLightShadowNames=new Array,this.validLights=[]}return t.prototype.reset=function(){this.shadowEnabled=!1,this.mainLightShadowNames.length=0,this.spotLightShadowNames.length=0,this.validLights.length=0},t}());var u3=function(){function t(t,e){void 0===e&&(e=2),this.buffers=[],this.currBuffIdx=0,this.device=void 0,this.currUniform=void 0,this._root=void 0;var i=(this._root=m.director.root).device;this.device=i,this.currUniform=new Float32Array(t/4);for(var n=0;nt.length)return n;for(var r=Math.min(e.length,t.length-i),s=0;s=this.instanceBuffers.length&&this.instanceBuffers.push(new BE(t)),this.passInstances.set(t,n);var r=this.instanceBuffers[n];r.pass=t,r.instances}this.instanceBuffers[this.passInstances.get(t)].merge(e,i)},e.clear=function(){this.passInstances.clear(),this.instanceBuffers.forEach((function(t){t.clear()}))},e.sort=function(){},e.uploadBuffers=function(t){for(var e,i=d(this.passInstances.entries());!(e=i()).done;){var n=e.value;n[0];var r=n[1],s=this.instanceBuffers[r];s.hasPendingModels&&s.uploadBuffers(t)}},e.recordCommandBuffer=function(t,e,i,n,r){void 0===i&&(i=null),void 0===n&&(n=0),void 0===r&&(r=null);for(var s,o=d(this.instanceBuffers);!(s=o()).done;){var a=s.value;if(a.hasPendingModels){var h=a.instances,u=a.pass;e.bindDescriptorSet(jm.MATERIAL,u.descriptorSet);for(var c,l=null,_=d(h);!(c=_()).done;){var f=c.value;if(f.count){var p=QE.getOrCreatePipelineState(Qd.gfxDevice,u,f.shader,t,f.ia);l!==p&&(e.bindPipelineState(p),l=p),i&&e.bindDescriptorSet(jm.GLOBAL,i,[n]),r?e.bindDescriptorSet(jm.LOCAL,f.descriptorSet,r):e.bindDescriptorSet(jm.LOCAL,f.descriptorSet,a.dynamicOffsets),e.bindInputAssembler(f.ia),e.draw(f.ia)}}}}},t}(),z3=function(){function t(t,e,i){void 0===t&&(t=4294967295),void 0===e&&(e=4294967295),void 0===i&&(i=4294967295),this.frustumCulledResultID=void 0,this.lightBoundsCulledResultID=void 0,this.renderQueueTarget=void 0,this.frustumCulledResultID=t,this.lightBoundsCulledResultID=e,this.renderQueueTarget=i}return t.prototype.update=function(t,e,i){void 0===t&&(t=4294967295),void 0===e&&(e=4294967295),void 0===i&&(i=4294967295),this.frustumCulledResultID=t,this.lightBoundsCulledResultID=e,this.renderQueueTarget=i},t}(),V3=function(){function t(){this.probeQueue=new B3,this.opaqueQueue=new G3,this.transparentQueue=new G3,this.opaqueInstancingQueue=new H3,this.transparentInstancingQueue=new H3,this.camera=null,this.sceneFlags=e1.NONE,this.lightByteOffset=4294967295}var e=t.prototype;return e.sort=function(){this.opaqueQueue.sortOpaqueOrCutout(),this.transparentQueue.sortTransparent(),this.opaqueInstancingQueue.sort(),this.transparentInstancingQueue.sort()},e.update=function(){this.probeQueue.clear(),this.opaqueQueue.clear(),this.transparentQueue.clear(),this.opaqueInstancingQueue.clear(),this.transparentInstancingQueue.clear(),this.camera=null,this.sceneFlags=e1.NONE,this.lightByteOffset=4294967295},e.empty=function(){return this.opaqueQueue.empty()&&this.transparentQueue.empty()&&this.opaqueInstancingQueue.empty()&&this.transparentInstancingQueue.empty()},e.recordCommands=function(t,e,i){var n=4294967295===this.lightByteOffset?null:[this.lightByteOffset];i&(e1.OPAQUE|e1.MASK)&&(this.opaqueQueue.recordCommandBuffer(Qd.gfxDevice,e,t,null,0,n),this.opaqueInstancingQueue.recordCommandBuffer(e,t,null,0,n)),i&e1.BLEND&&(this.transparentInstancingQueue.recordCommandBuffer(e,t,null,0,n),this.transparentQueue.recordCommandBuffer(Qd.gfxDevice,e,t,null,0,n))},t}(),W3=4294967295;function X3(t){switch(t){case h1.UNIFORM_BUFFER:return Yl.UNIFORM_BUFFER;case h1.DYNAMIC_UNIFORM_BUFFER:return Yl.DYNAMIC_UNIFORM_BUFFER;case h1.SAMPLER_TEXTURE:return Yl.SAMPLER_TEXTURE;case h1.SAMPLER:return Yl.SAMPLER;case h1.TEXTURE:return Yl.TEXTURE;case h1.STORAGE_BUFFER:return Yl.STORAGE_BUFFER;case h1.DYNAMIC_STORAGE_BUFFER:return Yl.DYNAMIC_STORAGE_BUFFER;case h1.STORAGE_IMAGE:return Yl.STORAGE_IMAGE;case h1.INPUT_ATTACHMENT:return Yl.INPUT_ATTACHMENT;default:return k("DescriptorType not found"),Yl.INPUT_ATTACHMENT}}function j3(t){switch(t){case Yl.UNIFORM_BUFFER:return h1.UNIFORM_BUFFER;case Yl.DYNAMIC_UNIFORM_BUFFER:return h1.DYNAMIC_UNIFORM_BUFFER;case Yl.SAMPLER_TEXTURE:return h1.SAMPLER_TEXTURE;case Yl.SAMPLER:return h1.SAMPLER;case Yl.TEXTURE:return h1.TEXTURE;case Yl.STORAGE_BUFFER:return h1.STORAGE_BUFFER;case Yl.DYNAMIC_STORAGE_BUFFER:return h1.DYNAMIC_STORAGE_BUFFER;case Yl.STORAGE_IMAGE:return h1.STORAGE_IMAGE;case Yl.INPUT_ATTACHMENT:return h1.INPUT_ATTACHMENT;case Yl.UNKNOWN:default:return k("DescriptorTypeOrder not found"),h1.INPUT_ATTACHMENT}}function Y3(t,e){return t.locateChild(t.N,e||"default")}function K3(t,e,i){return t.locateChild(e,i)}function q3(t,e,i){return void 0===i?t.locateChild(e,"default"):"number"==typeof i?t.locateChild(e,i.toString()):t.locateChild(e,i)}var Q3,Z3,J3=new Map([["cc_lightPos",vv.LIGHTS_PER_PASS],["cc_lightColor",vv.LIGHTS_PER_PASS],["cc_lightSizeRangeAngle",vv.LIGHTS_PER_PASS],["cc_lightDir",vv.LIGHTS_PER_PASS],["cc_lightBoundingSizeVS",vv.LIGHTS_PER_PASS]]);function $3(t,e){var i=JSON.parse(t[0]),n=JSON.parse(e[0]);return 1e4*i.updateFrequency+1e3*i.parameterType+100*i.descriptorType+i.visibility-(1e4*n.updateFrequency+1e3*n.parameterType+100*n.descriptorType+n.visibility)}function t4(t,e){var i=t.attributeIndex.get(e);if(void 0===i){var n=t.valueNames.length;return t.attributeIndex.set(e,n),t.valueNames.push(e),n}return i}function e4(t,e){for(var i=0;ithis.lightBoundsCullingResults.length&&this.lightBoundsCullingResults.push(this.cullingPools.lightBoundsCullingResultRecycle.add().update()),r.resultIndex.set(o,h);var u=this.cullingPools.lightBoundsCullingKeyRecycle.add();return u.update(t,e),r.resultKeyIndex.set(o,u),h},e.getOrCreateFrustumCulling=function(t){var e=this.renderGraph.j(t),i=e.scene,n=this.frustumCullings.get(i);if(!n){var r=this.cullingPools.frustumCullingsRecycle.add();r.update(),this.frustumCullings.set(i,r),n=this.frustumCullings.get(i)}var s=C3(e.flags&e1.SHADOW_CASTER),o=m4(e,s),a=n.resultIndex.get(o);if(void 0!==a)return a;var h=this.numFrustumCulling++;this.numFrustumCulling>this.frustumCullingResults.length&&this.frustumCullingResults.push([]),n.resultIndex.set(o,h);var u=this.cullingPools.frustumCullingKeyRecycle.add();return u.update(e,s),n.resultKeyIndex.set(o,u),h},e.getOrCreateRenderQueue=function(t,e,i){var n=this.renderQueueIndex.get(t);if(void 0!==n)return this.renderQueues[n].sceneFlags|=e&this.kDrawMask,n;var r=this.numRenderQueues++;if(this.numRenderQueues>this.renderQueues.length){var s=this.cullingPools.renderQueueRecycle.add();s.update(),this.renderQueues.push(s)}var o=this.renderQueues[r];return this.renderQueueIndex.set(t,r),o.camera=i,o.sceneFlags=e&this.kAllMask,r},e.collectCullingQueries=function(t){for(var e,i=d(t.v());!(e=i()).done;){var n=e.value;if(t.h(9,n)&&t.getValid(n)){var r=t.j(n);if(r.scene){var s=this.getOrCreateFrustumCulling(n),o=this.getOrCreateLightBoundsCulling(r,s),a=t.getParent(n),h=A4(s,o,t.j(a).phaseID),u=this.getOrCreateRenderQueue(h,r.flags,r.camera),c=this.cullingPools.renderQueueQueryRecycle.add();c.update(s,o,u),this.renderQueueQueryIndex.set(n,c)}}}},e.uploadInstancing=function(t){for(var e=0;e!==this.numRenderQueues;++e){var i=this.renderQueues[e];i.opaqueInstancingQueue.uploadBuffers(t),i.transparentInstancingQueue.uploadBuffers(t)}},e._getPhaseIdFromScene=function(t){var e=this.renderGraph,i=e.getParent(t);return e.j(i).phaseID},e.getBuiltinShadowFrustum=function(t,e,i,n){var r=t.csmLayers,s=i.csmLevel,o=t.shadows;return o.type===eS.Planar?e.frustum:(o.enabled&&o.type===eS.ShadowMap&&i&&i.node&&r.update(t,e),i.shadowFixedArea||s===nS.LEVEL_1?r.specialLayer.validFrustum:r.layers[n].validFrustum)},e.batchFrustumCulling=function(t){for(var e,i=d(this.frustumCullings);!(e=i()).done;)for(var n,r=e.value,s=r[0],o=r[1],a=d(o.resultIndex);!(n=a()).done;){var h=n.value,u=h[0],c=h[1],l=o.resultKeyIndex.get(u),_=l.sceneData,f=_.light.light,p=_.light.level,g=l.castShadows,m=_.light.probe,v=m?m.camera:_.camera,y=this.frustumCullingResults[c];if(m)D4(s,v,v.frustum,g,m,y);else if(f)switch(f.type){case CI.SPOT:D4(s,v,f.frustum,g,null,y);break;case CI.DIRECTIONAL:D4(s,v,this.getBuiltinShadowFrustum(t,v,f,p),g,null,y)}else D4(s,v,v.frustum,g,null,y)}},e.executeSphereLightCulling=function(t,e,i){for(var n,r=t.aabb,s=d(e);!(n=s()).done;){var o=n.value,a=o.worldBounds;a&&!ds.aabbWithAABB(a,r)||i.push(o)}},e.executeSpotLightCulling=function(t,e,i){for(var n,r=t.aabb,s=t.frustum,o=d(e);!(n=o()).done;){var a=n.value,h=a.worldBounds;(!h||ds.aabbWithAABB(r,h)&&ds.aabbFrustum(h,s))&&i.push(a)}},e.executePointLightCulling=function(t,e,i){for(var n,r=t.aabb,s=d(e);!(n=s()).done;){var o=n.value,a=o.worldBounds;a&&!ds.aabbWithAABB(r,a)||i.push(o)}},e.executeRangedDirectionalLightCulling=function(t,e,i){B4.transform(t.node.worldMatrix,null,null,null,F4);for(var n,r=d(e);!(n=r()).done;){var s=n.value,o=s.worldBounds;o&&!ds.aabbWithAABB(F4,o)||i.push(s)}},e.batchLightBoundsCulling=function(){for(var t,e=d(this.lightBoundsCullings);!(t=e()).done;){var i=t.value;i[0];for(var n,r=i[1],s=d(r.resultIndex);!(n=s()).done;){var o=n.value,a=o[0],h=o[1],u=r.resultKeyIndex.get(a),c=u.sceneData,l=u.frustumCullingID,_=this.frustumCullingResults[l],f=this.lightBoundsCullingResults[h];switch(c.shadingLight.type){case CI.SPHERE:var p=c.shadingLight;this.executeSphereLightCulling(p,_,f.instances);break;case CI.SPOT:var g=c.shadingLight;this.executeSpotLightCulling(g,_,f.instances);break;case CI.POINT:var m=c.shadingLight;this.executePointLightCulling(m,_,f.instances);break;case CI.RANGED_DIRECTIONAL:var v=c.shadingLight;this.executeRangedDirectionalLightCulling(v,_,f.instances);break;case CI.DIRECTIONAL:case CI.UNKNOWN:}}}},e._getModelsByCullingResults=function(t,e){return 4294967295!==t?t=n.width},e.createDeviceBuf=function(t){if(M4.deviceBuffers.get(this.name)){if(!this.checkBuffer(this.name)){var e;null===(e=M4.deviceBuffers.get(this.name).buffer)||void 0===e||e.destroy();var i=new V4(this.name,t);M4.deviceBuffers.set(this.name,i)}}else{var n=new V4(this.name,t);M4.deviceBuffers.set(this.name,n)}},e.managed=function(t){this.createDeviceTex(t)},e.managedBuffer=function(t){this.createDeviceBuf(t)},e.managedTexture=function(){},e.persistentBuffer=function(t){this.createDeviceBuf(t)},e.persistentTexture=function(t){this.createDeviceTex(t)},e.framebuffer=function(t){this.createDeviceTex(t)},e.swapchain=function(t){this.createDeviceTex(t)},e.formatView=function(){},e.subresourceView=function(){},n(t,[{key:"resName",set:function(t){this.name=t}}]),t}(),H4=function(){function t(t){this._name=void 0,this._name=t}return n(t,[{key:"name",get:function(){return this._name}}]),t}(),z4=function(t){function e(e,i){var n;(n=t.call(this,e)||this)._texture=null,n._swapchain=null,n._framebuffer=null,n._desc=null,n._trait=null;var r=M4.resourceGraph,s=r.vertex(e);if(n._desc=r.getDesc(s),n._trait=r.getTraits(s),i instanceof Ud)return n._texture=i,l(n);if(i instanceof bd)return n._framebuffer=i,l(n);if(i instanceof X1)return n._swapchain=i.swapchain,l(n);var o=n._desc,a=Sl.TEX2D;switch(o.dimension){case $0.TEXTURE1D:a=Sl.TEX1D;break;case $0.TEXTURE2D:a=Sl.TEX2D;break;case $0.TEXTURE3D:a=Sl.TEX3D}var h=Al.NONE;return o.flags&t1.COLOR_ATTACHMENT&&(h|=Al.COLOR_ATTACHMENT),o.flags&t1.DEPTH_STENCIL_ATTACHMENT&&(h|=Al.DEPTH_STENCIL_ATTACHMENT),o.flags&t1.INPUT_ATTACHMENT&&(h|=Al.INPUT_ATTACHMENT),o.flags&t1.SAMPLED&&(h|=Al.SAMPLED),o.flags&t1.STORAGE&&(h|=Al.STORAGE),o.flags&t1.TRANSFER_SRC&&(h|=Al.TRANSFER_SRC),o.flags&t1.TRANSFER_DST&&(h|=Al.TRANSFER_DST),n._texture=M4.device.createTexture(new A_(a,h,o.format,o.width,o.height)),n}return s(e,t),e.prototype.release=function(){this.framebuffer&&(this.framebuffer.destroy(),this._framebuffer=null),this.texture&&(this.texture.destroy(),this._texture=null)},n(e,[{key:"texture",get:function(){return this._texture}},{key:"framebuffer",get:function(){return this._framebuffer},set:function(t){this._framebuffer=t}},{key:"description",get:function(){return this._desc}},{key:"trait",get:function(){return this._trait}},{key:"swapchain",get:function(){return this._swapchain}}]),e}(H4),V4=function(t){function e(e){var i;(i=t.call(this,e)||this)._buffer=void 0;var n=M4.resourceGraph,r=n.vertex(e),s=n.getDesc(r),o=new v_;return o.size=s.width,o.memUsage=El.DEVICE,s.flags&t1.INDIRECT&&(o.usage|=vl.INDIRECT),s.flags&t1.UNIFORM&&(o.usage|=vl.UNIFORM),s.flags&t1.STORAGE&&(o.usage|=vl.STORAGE),s.flags&t1.TRANSFER_SRC&&(o.usage|=vl.TRANSFER_SRC),s.flags&t1.TRANSFER_DST&&(o.usage|=vl.TRANSFER_DST),i._buffer=M4.device.createBuffer(o),i}return s(e,t),e.prototype.release=function(){this._buffer&&(this._buffer.destroy(),this._buffer=null)},n(e,[{key:"buffer",get:function(){return this._buffer}}]),e}(H4),W4=new Float32Array(4),X4=function(){function t(t,e){this._isUpdate=!1,this._isGatherLight=!1,this._blit=void 0,this._screenQuad=null,this._queue=null,this._stageDesc=void 0,this._lightVolumeBuffer=null,this._lightMeterScale=1e4,this._lightBufferData=void 0,this._blit=t,this._queue=e}var e=t.prototype;return e._createQuadInputAssembler=function(){return M4.blit.pipelineIAData},e.createScreenQuad=function(){this._screenQuad||(this._screenQuad=this._createQuadInputAssembler())},e._gatherVolumeLights=function(t){if(t.scene){for(var e=M4.pipeline,i=M4.commandBuffer,n=t.scene.sphereLights,r=t.scene.spotLights,s=Ar.create(0,0,0,1),o=t.exposure,a=0,h=yv.LIGHTS_PER_PASS,u=on.length,c=u*h,l=0;l0){var o=s;s=r,r=o}var a=0;switch(t){case dl.IDENTITY:a=0,r5[a++]=-1,r5[a++]=-1,r5[a++]=i,r5[a++]=s,r5[a++]=1,r5[a++]=-1,r5[a++]=n,r5[a++]=s,r5[a++]=-1,r5[a++]=1,r5[a++]=i,r5[a++]=r,r5[a++]=1,r5[a++]=1,r5[a++]=n,r5[a++]=r;break;case dl.ROTATE_90:a=0,r5[a++]=-1,r5[a++]=-1,r5[a++]=n,r5[a++]=s,r5[a++]=1,r5[a++]=-1,r5[a++]=n,r5[a++]=r,r5[a++]=-1,r5[a++]=1,r5[a++]=i,r5[a++]=s,r5[a++]=1,r5[a++]=1,r5[a++]=i,r5[a++]=r;break;case dl.ROTATE_180:a=0,r5[a++]=-1,r5[a++]=-1,r5[a++]=i,r5[a++]=r,r5[a++]=1,r5[a++]=-1,r5[a++]=n,r5[a++]=r,r5[a++]=-1,r5[a++]=1,r5[a++]=i,r5[a++]=s,r5[a++]=1,r5[a++]=1,r5[a++]=n,r5[a++]=s;break;case dl.ROTATE_270:a=0,r5[a++]=-1,r5[a++]=-1,r5[a++]=i,r5[a++]=r,r5[a++]=1,r5[a++]=-1,r5[a++]=i,r5[a++]=s,r5[a++]=-1,r5[a++]=1,r5[a++]=n,r5[a++]=r,r5[a++]=1,r5[a++]=1,r5[a++]=n,r5[a++]=s}return r5},e._createQuadInputAssembler=function(){var t=new PD,e=4*Float32Array.BYTES_PER_ELEMENT,i=4*e,n=m.director.root.device,r=n.createBuffer(new v_(vl.VERTEX|vl.TRANSFER_DST,El.DEVICE|El.HOST,i,e));if(!r)return t;var s=Uint16Array.BYTES_PER_ELEMENT,o=6*s,a=n.createBuffer(new v_(vl.INDEX|vl.TRANSFER_DST,El.DEVICE,o,s));if(!a)return t;var h=new Uint16Array(6);h[0]=0,h[1]=1,h[2]=2,h[3]=1,h[4]=3,h[5]=2,a.update(h.buffer);var u=new Array(2);u[0]=new L_("a_position",pl.RG32F),u[1]=new L_("a_texCoord",pl.RG32F);var c=n.createInputAssembler(new F_(u,[r],a));return t.quadIB=a,t.quadVB=r,t.quadIA=c,t},n(t,[{key:"pipelineIAData",get:function(){return this._pipelineIAData}},{key:"deferredLitsBufView",get:function(){return this._deferredLitsBufView}},{key:"lightVolumeBuffer",get:function(){return this._lightVolumeBuffer}},{key:"lightBufferData",get:function(){return this._lightBufferData}},{key:"stageDescs",get:function(){return this._stageDescs}},{key:"emptyLocalUBO",get:function(){return this._localUBO}}]),t}(),a5=function(){function t(t,e,i,n,r,s,o,a){void 0===a&&(a=null),this.device=void 0,this.pipeline=void 0,this.commandBuffer=void 0,this.pipelineSceneData=void 0,this.resourceGraph=void 0,this.devicePasses=new Map,this.deviceTextures=new Map,this.deviceBuffers=new Map,this.layoutGraph=void 0,this.root=void 0,this.pools=void 0,this.blit=void 0,this.culling=void 0,this.lightResource=new U4,this.renderGraph=void 0,this.width=void 0,this.height=void 0,this.cullCamera=void 0,this.passDescriptorSet=void 0,this.profilerDescriptorSet=void 0,this.pipeline=t,this.device=e,this.commandBuffer=e.commandBuffer,this.pipelineSceneData=t.pipelineSceneData,this.resourceGraph=i,this.renderGraph=n,this.root=m.director.root,this.layoutGraph=r,this.width=s,this.height=o,this.pools=new n5,this.blit=new o5(this),this.culling=new k4,this.passDescriptorSet=a,this.profilerDescriptorSet=d3("default").descriptorSet}var e=t.prototype;return e.reset=function(){this.culling.clear(),this.pools.reset(),this.cullCamera=null,this.lightResource.clear()},e.resize=function(t,e){this.width=t,this.height=e,this.blit.resize(t,e)},t}(),h5=function(){function t(t,e,i,n,r,s){this._context=void 0,this._visitor=void 0,M4=this._context=new a5(t,e,i,new S2,n,r,s);var o=m.rendering.programLib;M4.lightResource.init(o,e,16)}var e=t.prototype;return e.resize=function(t,e){M4.resize(t,e)},e._removeDeviceResource=function(){for(var t,e=M4.pipeline.resourceUses,i=[],n=M4.deviceTextures,r=d(n);!(t=r()).done;){var s=t.value,o=s[0];s[1];var a=M4.resourceGraph.vertex(o),h=M4.resourceGraph.getTraits(a);if(!e.includes(o))switch(h.residency){case Z0.MANAGED:i.push(o)}}for(var u=0,c=i;u1?Sl.TEX1D_ARRAY:Sl.TEX1D;case $0.TEXTURE2D:return e>1?Sl.TEX2D_ARRAY:Sl.TEX2D;case $0.TEXTURE3D:return Sl.TEX3D;case $0.BUFFER:return Sl.TEX2D}return Sl.TEX2D}(e,o),i,n,r,s,o,a,h,u,c)},e.updateResource=function(t,e,i,n,r,s,o,a){var h=this.resourceGraph.vertex(t),u=this.resourceGraph.getDesc(h);u.width=i,u.height=n,u.depthOrArraySize=u.dimension===$0.TEXTURE3D?r:s,u.mipLevels=o,e!==pl.UNKNOWN&&(u.format=e),u.sampleCount=a},e.containsResource=function(t){return this._resourceGraph.contains(t)},e.addResolvePass=function(){throw new Error("Method not implemented.")},e.addComputePass=function(t){var e=L4.createComputePass(),i=L4.createRenderData(),n=this._renderGraph.addVertex(3,e,"Compute",t,i,!1),r=N4.computePassBuilder.add();return r.update(i,this._renderGraph,this._layoutGraph,this._resourceGraph,n,e,this._pipelineSceneData),m.director.root.pipeline,r},e.addUploadPass=function(t){for(var e,i=L4.createCopyPass(),n=d(t);!(e=n()).done;){var r=e.value;i.uploadPairs.push(r)}this._renderGraph.addVertex(5,i,"UploadPass","",L4.createRenderData(),!1)},e.addCopyPass=function(t){for(var e,i=d(t);!(e=i()).done;){var n=e.value,r=n.target,s=this.resourceGraph.find(r),o=this.resourceGraph.getDesc(s),a=this.addRenderPass(o.width,o.height,"copy-pass");a.addRenderTarget(r,Bl.CLEAR,Fl.STORE,N4.createColor()),a.addTexture(n.source,"outputResultMap"),a.addQueue(J0.NONE).addFullscreenQuad(this._copyPassMat,0,e1.NONE)}},e._generateConstantMacros=function(){var t="";t+="#define CC_DEVICE_SUPPORT_FLOAT_TEXTURE "+(this._device.getFormatFeatures(pl.RGBA32F)&(Cl.RENDER_TARGET|Cl.SAMPLED_TEXTURE)?1:0)+"\n",t+="#define CC_DEVICE_MAX_VERTEX_UNIFORM_VECTORS "+this._device.capabilities.maxVertexUniformVectors+"\n",t+="#define CC_DEVICE_MAX_FRAGMENT_UNIFORM_VECTORS "+this._device.capabilities.maxFragmentUniformVectors+"\n",t+="#define CC_DEVICE_CAN_BENEFIT_FROM_INPUT_ATTACHMENT "+(this._device.hasFeature(fl.INPUT_ATTACHMENT_BENEFIT)?1:0)+"\n",t+="#define CC_PLATFORM_ANDROID_AND_WEBGL "+(go.os===co.ANDROID&&go.isBrowser?1:0)+"\n",t+="#define CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES "+(Ie.ENABLE_WEBGL_HIGHP_STRUCT_VALUES?1:0)+"\n",t+="#define CC_JOINT_UNIFORM_CAPACITY "+Av.JOINT_UNIFORM_CAPACITY+"\n",this._constantMacros=t,this._layoutGraph.constantMacros=this._constantMacros},e.setCustomPipelineName=function(t){this._customPipelineName=t,"Deferred"===this._customPipelineName&&(this._usesDeferredPipeline=!0)},e.getGlobalDescriptorSetData=function(){var t=this.layoutGraph.locateChild(this.layoutGraph.N,"default");return this.layoutGraph.getLayout(t).descriptorSets.get(W0.PER_PASS)},e._initCombineSignY=function(){var t=this._device;this._combineSignY=.5*t.capabilities.screenSpaceSignY+.5<<1|.5*t.capabilities.clipSpaceSignY+.5},e.getCombineSignY=function(){return this._combineSignY},e._compileMaterial=function(){this._copyPassMat.initialize({effectName:"pipeline/copy-pass"});for(var t=0;t=t.CSM_UNIFORM_VECTORS+t.GLOBAL_UNIFORM_VECTORS,this.setMacroBool("CC_SUPPORT_CASCADED_SHADOW_MAP",this.pipelineSceneData.csmSupported),this.setMacroInt("CC_SHADOW_TYPE",0),this.setMacroInt("CC_DIR_SHADOW_PCF_TYPE",iS.HARD),this.setMacroInt("CC_DIR_LIGHT_SHADOW_TYPE",0),this.setMacroBool("CC_CASCADED_LAYERS_TRANSITION",!1),this.usesDeferredPipeline&&this.setMacroInt("CC_PIPELINE_TYPE",1),!0},e.destroy=function(){var t,e,i;return null===(t=this._globalDSManager)||void 0===t||t.globalDescriptorSet.destroy(),null===(e=this._globalDSManager)||void 0===e||e.destroy(),null===(i=this._pipelineSceneData)||void 0===i||i.destroy(),!0},e.getMacroString=function(t){var e=this._macros[t];return void 0===e?"":e},e.getMacroInt=function(t){var e=this._macros[t];return void 0===e?0:e},e.getMacroBool=function(t){var e=this._macros[t];return void 0!==e&&e},e.getSamplerInfo=function(t){if(this.containsResource(t)){var e=this._resourceGraph.vertex(t);return this._resourceGraph.getSampler(e)}return null},e.setMacroString=function(t,e){this._macros[t]=e},e.setMacroInt=function(t,e){this._macros[t]=e},e.setMacroBool=function(t,e){this._macros[t]=e},e.onGlobalPipelineStateChanged=function(){var t=m.rendering.getCustomPipeline(Ie.CUSTOM_PIPELINE_NAME);t&&("function"==typeof t.onGlobalPipelineStateChanged&&t.onGlobalPipelineStateChanged(),m.rendering.forceResizeAllWindows())},e.beginSetup=function(){this._renderGraph||(this._renderGraph=new S2),N4.reset()},e.endSetup=function(){this.compile()},e.addStorageBuffer=function(t,e,i,n){void 0===n&&(n=Z0.MANAGED);var r=this._resourceGraph.find(t);if(4294967295!==r)return this.updateStorageBuffer(t,i,e),r;var s=new V1;return s.dimension=$0.BUFFER,s.width=i,s.height=1,s.depthOrArraySize=1,s.mipLevels=1,s.format=e,s.flags=t1.STORAGE,n===Z0.PERSISTENT?this._resourceGraph.addVertex(3,new K1,t,s,new W1(Z0.PERSISTENT),new j1,new C_):this._resourceGraph.addVertex(1,new Y1,t,s,new W1(n),new j1,new C_)},e.addRenderTarget=function(t,e,i,n,r){void 0===r&&(r=Z0.MANAGED);var s=this._resourceGraph.find(t);if(4294967295!==s)return this.updateRenderTarget(t,i,n,e),s;var o=new V1;return o.dimension=$0.TEXTURE2D,o.width=i,o.height=n,o.depthOrArraySize=1,o.mipLevels=1,o.format=e,o.sampleCount=Rl.X1,o.flags=t1.COLOR_ATTACHMENT|t1.SAMPLED,this._resourceGraph.addVertex(0,new Z1,t,o,new W1(r),new j1,new C_(Il.LINEAR,Il.LINEAR,Il.NONE,xl.CLAMP,xl.CLAMP,xl.CLAMP))},e.updateDepthStencilImpl=function(t,e,i,n,r){var s=this.resourceGraph.getDesc(t);if(s.width=e,s.height=i,r){var o=this.resourceGraph.j(t);o.swapchain=r,s.format=o.swapchain.depthStencilTexture.format}else n!==pl.UNKNOWN&&(s.format=n)},e.addDepthStencilImpl=function(t,e,i,n,r,s){var o=this._resourceGraph.find(t);if(4294967295!==o)return this.updateDepthStencilImpl(o,i,n,e,s),o;var a=new V1;return a.dimension=$0.TEXTURE2D,a.width=i,a.height=n,a.depthOrArraySize=1,a.mipLevels=1,a.format=e,a.sampleCount=Rl.X1,a.flags=t1.DEPTH_STENCIL_ATTACHMENT|t1.SAMPLED,s?this._resourceGraph.addVertex(6,new X1(s,!0),t,a,new W1(r),new j1,new C_(Il.POINT,Il.POINT,Il.NONE)):this._resourceGraph.addVertex(0,new Z1,t,a,new W1(r),new j1,new C_(Il.POINT,Il.POINT,Il.NONE))},e.addDepthStencil=function(t,e,i,n,r){return void 0===r&&(r=Z0.MANAGED),this.addDepthStencilImpl(t,e,i,n,r)},e.addStorageTexture=function(t,e,i,n,r){void 0===r&&(r=Z0.MANAGED);var s=this._resourceGraph.find(t);if(4294967295!==s)return this.updateStorageTexture(t,i,n,e),s;var o=new V1;return o.dimension=$0.TEXTURE2D,o.width=i,o.height=n,o.depthOrArraySize=1,o.mipLevels=1,o.format=e,o.flags=t1.STORAGE|t1.SAMPLED,this._resourceGraph.addVertex(0,new Z1,t,o,new W1(r),new j1,new C_(Il.POINT,Il.POINT,Il.NONE))},e.addShadingRateTexture=function(t,e,i,n){void 0===n&&(n=Z0.MANAGED);var r=this._resourceGraph.find(t);if(4294967295!==r)return this.addShadingRateTexture(t,e,i),r;var s=new V1;return s.dimension=$0.TEXTURE2D,s.width=e,s.height=i,s.depthOrArraySize=1,s.mipLevels=1,s.format=pl.R8UI,s.flags=t1.SHADING_RATE|t1.STORAGE|t1.SAMPLED,this._resourceGraph.addVertex(0,new Z1,t,s,new W1(n),new j1,new C_(Il.LINEAR,Il.LINEAR,Il.NONE,xl.CLAMP,xl.CLAMP,xl.CLAMP))},e.beginFrame=function(){},e.update=function(){},e.endFrame=function(){var t;null===(t=this.renderGraph)||void 0===t||t.clear()},e.compile=function(){if(!this._renderGraph)throw new Error("RenderGraph cannot be built without being created");this._compiler||(this._compiler=new E5(this,this._renderGraph,this._resourceGraph,this._layoutGraph)),this._compiler.compile(this._renderGraph)},e.execute=function(){if(!this._renderGraph)throw new Error("Cannot run without creating rendergraph");this._executor||(this._executor=new h5(this,this._device,this._resourceGraph,this.layoutGraph,this.width,this.height)),this._executor.resize(this.width,this.height),this._executor.execute(this._renderGraph)},e._applySize=function(t){var e=this,i=this._width,n=this._height;t.forEach((function(t){var r=t.window;i=Math.max(r.width,i),n=Math.max(r.height,n),e._cameras.includes(t)||e._cameras.push(t)})),i===this._width&&n===this._height||(this._width=i,this._height=n)},e.render=function(t){0!==t.length&&(this._applySize(t),function(t){for(var e=t.length-1;e>=0;--e)if(t[e].window.swapchain)return}(t),this.beginFrame(),this.execute(),this.endFrame())},e.addBuiltinReflectionProbePass=function(t){var e=m.internal.reflectionProbeManager;if(e){var i=e.getProbes();if(0!==i.length)for(var n=0;n>3)]+=(a.isCompositeModeEnabled(u)?1:0)*Math.pow(10,c)}h[3]+=(a.lightingWithAlbedo?1:0)*Math.pow(10,6),h[3]+=(a.csmLayerColoration?1:0)*Math.pow(10,7),b5.set(h[0],h[1],h[2],h[3])}t.setVec4("cc_debug_view_mode",b5)},n(t,[{key:"type",get:function(){return b2.BASIC}},{key:"capabilities",get:function(){return new w2}},{key:"enableCpuLightCulling",get:function(){return!this._executor||this._executor._context.culling.enableLightCulling},set:function(t){this._executor&&(this._executor._context.culling.enableLightCulling=t)}},{key:"globalDescriptorSetData",get:function(){return this._globalDescSetData}},{key:"defaultSampler",get:function(){return this._defaultSampler}},{key:"defaultShadowTexture",get:function(){return Ty(this.device)}},{key:"device",get:function(){return this._device}},{key:"lightingMode",get:function(){return this._lightingMode},set:function(t){this._lightingMode=t}},{key:"usesDeferredPipeline",get:function(){return this._usesDeferredPipeline}},{key:"macros",get:function(){return this._macros}},{key:"globalDSManager",get:function(){return this._globalDSManager}},{key:"descriptorSetLayout",get:function(){return this._globalDSManager.descriptorSetLayout}},{key:"descriptorSet",get:function(){return this._globalDSManager.globalDescriptorSet}},{key:"profilerDescriptorSet",get:function(){return this._profilerDescriptorSet}},{key:"globalDescriptorSet",get:function(){return this._globalDescriptorSet}},{key:"globalDescriptorSetInfo",get:function(){return this._globalDescriptorSetInfo}},{key:"commandBuffers",get:function(){return[this._device.commandBuffer]}},{key:"pipelineSceneData",get:function(){return this._pipelineSceneData}},{key:"constantMacros",get:function(){return this._constantMacros}},{key:"profiler",get:function(){return this._profiler},set:function(t){this._profiler=t}},{key:"geometryRenderer",get:function(){throw new Error("Method not implemented.")}},{key:"shadingScale",get:function(){return this._pipelineSceneData.shadingScale},set:function(t){this._pipelineSceneData.shadingScale=t}},{key:"width",get:function(){return this._width}},{key:"height",get:function(){return this._height}},{key:"renderGraph",get:function(){return this._renderGraph}},{key:"resourceGraph",get:function(){return this._resourceGraph}},{key:"layoutGraph",get:function(){return this._layoutGraph}},{key:"resourceUses",get:function(){return this._resourceUses}}]),t}();M5.MAX_BLOOM_FILTER_PASS_NUM=6,M5.CSM_UNIFORM_VECTORS=61,M5.GLOBAL_UNIFORM_VECTORS=64,function(){function t(){this.capacity=0,this.size=0,this.buffer=void 0,this.dataView=void 0,this.capacity=4096,this.buffer=new Uint8Array(this.capacity),this.dataView=new DataView(this.buffer.buffer)}var e=t.prototype;e.b=function(t){var e=this.size+1;e>this.capacity&&this.reserve(e),this.dataView.setUint8(this.size,t?1:0),this.size=e},e.n=function(t){var e=this.size+8;e>this.capacity&&this.reserve(e),this.dataView.setFloat64(this.size,t,!0),this.size=e},e.s=function(t){this.n(t.length);var e=this.size+t.length;e>this.capacity&&this.reserve(e);for(var i=0;i=t.valueNames.length?"":t.valueNames[e]}(this.layoutGraph,t)},t}(),t6=null,e6=!1;function i6(){e6=!0}var n6=[],r6=4294967295,s6=new H2,o6=new $5(s6),a6=new Map,h6=Object.freeze({__proto__:null,INVALID_ID:r6,enableEffectImport:!0,programLib:o6,createCustomPipeline:function(){var t=new M5(s6),e=Ie.CUSTOM_PIPELINE_NAME;return t.setCustomPipelineName(e),o6.pipeline=t,t},customPipelineBuilderMap:a6,setCustomPipeline:function(t,e){a6.set(t,e),i6()},getCustomPipeline:function(t){var e=a6.get(t);return e||(e=a6.get("Forward")),e},init:function(t,e){if(e&&e.byteLength>=8){var i=new Uint8Array(e);if(new DataView(i.buffer,i.byteOffset,8).getUint32(0)===r6){var n=new jO.Inflate(new Uint8Array(i.buffer,i.byteOffset+8)).decompress();t3(new N5(n.buffer,n.byteOffset),s6)}else t3(new N5(i.buffer,i.byteOffset),s6)}!function(t,e){Q3=t.createDescriptorSetLayout(new K_),Z3=t.createPipelineLayout(new Q_);for(var i,n=d(e.v());!(i=n()).done;)for(var r,s=i.value,o=d(e.getLayout(s).descriptorSets);!(r=o()).done;){var a=r.value;a[0];var h=a[1];null!==h.descriptorSetLayout&&F("descriptor set layout already initialized. It will be overwritten"),s4(h.descriptorSetLayoutData,h.descriptorSetLayoutInfo),h.descriptorSetLayout=t.createDescriptorSetLayout(h.descriptorSetLayoutInfo)}for(var u,c=d(e.v());!(u=c()).done;){var l=u.value;if(e.h(1,l)){var _=e.getParent(l),f=l,p=e.getLayout(_),g=e.getLayout(f),m=new Q_;o4(p,W0.PER_PASS,m),o4(g,W0.PER_PHASE,m),o4(g,W0.PER_BATCH,m),o4(g,W0.PER_INSTANCE,m),e.j(f).pipelineLayout=t.createPipelineLayout(m)}}}(t,s6)},destroy:function(){!function(t){for(var e,i=d(t.v());!(e=i()).done;)for(var n,r=e.value,s=d(t.getLayout(r).descriptorSets);!(n=s()).done;){var o=n.value;o[0];var a=o[1];null!==a.descriptorSetLayout&&a.descriptorSetLayout.destroy()}Z3.destroy(),Q3.destroy()}(s6)},getPassID:function(t){return Y3(s6,t)},getSubpassID:function(t,e){return K3(s6,t,e)},getPhaseID:function(t,e){return q3(s6,t,e)},completePhaseName:function(t){return"number"==typeof t?t.toString():"string"==typeof t?t:"default"},get UpdateFrequency(){return W0},ParameterType:i1,get ResourceResidency(){return Z0},get QueueHint(){return J0},get ResourceDimension(){return $0},get ResourceFlags(){return t1},TaskType:{SYNC:0,ASYNC:1},get SceneFlags(){return e1},LightingMode:r1,AttachmentType:s1,get AccessType(){return n1},ClearValueType:o1,LightInfo:a1,DescriptorTypeOrder:h1,Descriptor:u1,DescriptorBlock:c1,DescriptorBlockFlattened:l1,DescriptorBlockIndex:_1,ResolveFlags:d1,ResolvePair:f1,CopyPair:p1,UploadPair:g1,MovePair:m1,PipelineStatistics:v1,RenderCommonObjectPool:A1,saveLightInfo:function(t,e){t.n(e.level),t.b(e.culledByLight)},loadLightInfo:function(t,e){e.level=t.n(),e.culledByLight=t.b()},saveDescriptor:b1,loadDescriptor:C1,saveDescriptorBlock:function(t,e){t.n(e.descriptors.size);for(var i,n=d(e.descriptors);!(i=n()).done;){var r=i.value,s=r[0],o=r[1];t.s(s),b1(t,o)}t.n(e.uniformBlocks.size);for(var a,h=d(e.uniformBlocks);!(a=h()).done;){var u=a.value,c=u[0],l=u[1];t.s(c),K0(t,l)}t.n(e.capacity),t.n(e.count)},loadDescriptorBlock:function(t,e){var i=0;i=t.n();for(var n=0;n!==i;++n){var r=t.s(),s=new u1;C1(t,s),e.descriptors.set(r,s)}i=t.n();for(var o=0;o!==i;++o){var a=t.s(),h=new w_;q0(t,h),e.uniformBlocks.set(a,h)}e.capacity=t.n(),e.count=t.n()},saveDescriptorBlockFlattened:function(t,e){t.n(e.descriptorNames.length);for(var i,n=d(e.descriptorNames);!(i=n()).done;){var r=i.value;t.s(r)}t.n(e.uniformBlockNames.length);for(var s,o=d(e.uniformBlockNames);!(s=o()).done;){var a=s.value;t.s(a)}t.n(e.descriptors.length);for(var h,u=d(e.descriptors);!(h=u()).done;)b1(t,h.value);t.n(e.uniformBlocks.length);for(var c,l=d(e.uniformBlocks);!(c=l()).done;)K0(t,c.value);t.n(e.capacity),t.n(e.count)},loadDescriptorBlockFlattened:function(t,e){var i=0;i=t.n(),e.descriptorNames.length=i;for(var n=0;n!==i;++n)e.descriptorNames[n]=t.s();i=t.n(),e.uniformBlockNames.length=i;for(var r=0;r!==i;++r)e.uniformBlockNames[r]=t.s();i=t.n(),e.descriptors.length=i;for(var s=0;s!==i;++s){var o=new u1;C1(t,o),e.descriptors[s]=o}i=t.n(),e.uniformBlocks.length=i;for(var a=0;a!==i;++a){var h=new w_;q0(t,h),e.uniformBlocks[a]=h}e.capacity=t.n(),e.count=t.n()},saveDescriptorBlockIndex:function(t,e){t.n(e.updateFrequency),t.n(e.parameterType),t.n(e.descriptorType),t.n(e.visibility)},loadDescriptorBlockIndex:function(t,e){e.updateFrequency=t.n(),e.parameterType=t.n(),e.descriptorType=t.n(),e.visibility=t.n()},saveResolvePair:function(t,e){t.s(e.source),t.s(e.target),t.n(e.resolveFlags),t.n(e.mode),t.n(e.mode1)},loadResolvePair:function(t,e){e.source=t.s(),e.target=t.s(),e.resolveFlags=t.n(),e.mode=t.n(),e.mode1=t.n()},saveCopyPair:function(t,e){t.s(e.source),t.s(e.target),t.n(e.mipLevels),t.n(e.numSlices),t.n(e.sourceMostDetailedMip),t.n(e.sourceFirstSlice),t.n(e.sourcePlaneSlice),t.n(e.targetMostDetailedMip),t.n(e.targetFirstSlice),t.n(e.targetPlaneSlice)},loadCopyPair:function(t,e){e.source=t.s(),e.target=t.s(),e.mipLevels=t.n(),e.numSlices=t.n(),e.sourceMostDetailedMip=t.n(),e.sourceFirstSlice=t.n(),e.sourcePlaneSlice=t.n(),e.targetMostDetailedMip=t.n(),e.targetFirstSlice=t.n(),e.targetPlaneSlice=t.n()},saveMovePair:function(t,e){t.s(e.source),t.s(e.target),t.n(e.mipLevels),t.n(e.numSlices),t.n(e.targetMostDetailedMip),t.n(e.targetFirstSlice),t.n(e.targetPlaneSlice)},loadMovePair:function(t,e){e.source=t.s(),e.target=t.s(),e.mipLevels=t.n(),e.numSlices=t.n(),e.targetMostDetailedMip=t.n(),e.targetFirstSlice=t.n(),e.targetPlaneSlice=t.n()},savePipelineStatistics:function(t,e){t.n(e.numRenderPasses),t.n(e.numManagedTextures),t.n(e.totalManagedTextures),t.n(e.numUploadBuffers),t.n(e.numUploadBufferViews),t.n(e.numFreeUploadBuffers),t.n(e.numFreeUploadBufferViews),t.n(e.numDescriptorSets),t.n(e.numFreeDescriptorSets),t.n(e.numInstancingBuffers),t.n(e.numInstancingUniformBlocks)},loadPipelineStatistics:function(t,e){e.numRenderPasses=t.n(),e.numManagedTextures=t.n(),e.totalManagedTextures=t.n(),e.numUploadBuffers=t.n(),e.numUploadBufferViews=t.n(),e.numFreeUploadBuffers=t.n(),e.numFreeUploadBufferViews=t.n(),e.numDescriptorSets=t.n(),e.numFreeDescriptorSets=t.n(),e.numInstancingBuffers=t.n(),e.numInstancingUniformBlocks=t.n()},get PipelineType(){return b2},get SubpassCapabilities(){return C2},PipelineCapabilities:w2,packRGBE:function(t){var e=Math.max(Math.max(t.x,t.y),t.z),i=128;e>1e-4&&(i=Math.log(e)/Math.log(1.1),i=Pi((i=Math.ceil(i))+128,0,255));var n=1/Math.pow(1.1,i-128),r=function(t,e,i){if(e>i){var n=e;e=i,i=n}return ti?i:t}(t.multiplyScalar(n),new _n(0,0,0),new _n(1,1,1));r.multiplyScalar(255);var s,o,a=En(r).add((s=r.subtract(En(r)))<(o=new _n(.5,.5,.5))?o:s);return new on(a.x/255,a.y/255,a.z/255,i/255)},setEditorPipelineSettings:function(t){t6=t,e6=!0},getEditorPipelineSettings:function(){return t6},forceResizeAllWindows:i6,defaultWindowResize:function(t,e,i,n){t.addRenderWindow(e.colorName,pl.BGRA8,i,n,e),t.addDepthStencil(e.depthStencilName,pl.DEPTH_STENCIL,i,n);var r=e.renderWindowId,s=Ey(t.device)?pl.R32F:pl.RGBA8,o=t.pipelineSceneData.shadows.size;t.addRenderTarget("ShadowMap"+r,s,o.x,o.y),t.addDepthStencil("ShadowDepth"+r,pl.DEPTH_STENCIL,o.x,o.y)},dispatchResizeEvents:function(t,e,i){if(e.windowResize){for(var n,r=d(t);!(n=r()).done;){var s=n.value;if(s.window.isRenderWindowResized()||e6){var o=Math.max(Math.floor(s.window.width),1),a=Math.max(Math.floor(s.window.height),1);e.windowResize(i,s.window,s,o,a),n6.push(s.window)}}for(var h,u=d(n6);!(h=u()).done;)h.value.setRenderWindowResizeHandled();n6.length=0,e6=!1}}});t("rendering",h6),m.rendering=h6;var u6,c6=function(t){function e(){var e;return(e=t.call(this)||this)._gpuDescriptorSet=null,e}s(e,t);var i=e.prototype;return i.initialize=function(t){this._layout=t.layout;var e=t.layout.gpuDescriptorSetLayout,i=e.bindings,n=e.descriptorIndices,r=e.descriptorCount;this._buffers=Array(r).fill(null),this._textures=Array(r).fill(null),this._samplers=Array(r).fill(null);var s=[];this._gpuDescriptorSet={gpuDescriptors:s,descriptorIndices:n};for(var o=0;o0&&(t.extensions.useVAO&&n.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),n.glVAO=null),k6.gpuInputAssembler=null,t.stateCache.glArrayBuffer!==e.glBuffer&&(i.bindBuffer(i.ARRAY_BUFFER,e.glBuffer),t.stateCache.glArrayBuffer=e.glBuffer),i.bufferData(i.ARRAY_BUFFER,e.size,r),i.bindBuffer(i.ARRAY_BUFFER,null),t.stateCache.glArrayBuffer=null))}else if(e.usage&vl.INDEX){e.glTarget=i.ELEMENT_ARRAY_BUFFER;var o=i.createBuffer();o&&(e.glBuffer=o,e.size>0&&(t.extensions.useVAO&&n.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),n.glVAO=null),k6.gpuInputAssembler=null,t.stateCache.glElementArrayBuffer!==e.glBuffer&&(i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.glBuffer),t.stateCache.glElementArrayBuffer=e.glBuffer),i.bufferData(i.ELEMENT_ARRAY_BUFFER,e.size,r),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,null),t.stateCache.glElementArrayBuffer=null))}else e.usage&vl.UNIFORM?(e.glTarget=i.NONE,e.buffer&&(e.vf32=new Float32Array(e.buffer.buffer))):(e.usage&vl.INDIRECT||e.usage&vl.TRANSFER_DST||e.usage&vl.TRANSFER_SRC||Z(16315),e.glTarget=i.NONE)}function P6(t,e){var i=t.gl,n=t.stateCache;if(e.glBuffer){switch(e.glTarget){case i.ARRAY_BUFFER:t.extensions.useVAO&&n.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),t.stateCache.glVAO=null),k6.gpuInputAssembler=null,i.bindBuffer(i.ARRAY_BUFFER,null),t.stateCache.glArrayBuffer=null;break;case i.ELEMENT_ARRAY_BUFFER:t.extensions.useVAO&&n.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),t.stateCache.glVAO=null),k6.gpuInputAssembler=null,i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,null),t.stateCache.glElementArrayBuffer=null}i.deleteBuffer(e.glBuffer),e.glBuffer=null}}function M6(t,e,i,n,r){if(e.usage&vl.UNIFORM)ArrayBuffer.isView(i)?e.vf32.set(i,n/Float32Array.BYTES_PER_ELEMENT):e.vf32.set(new Float32Array(i),n/Float32Array.BYTES_PER_ELEMENT);else if(e.usage&vl.INDIRECT){e.indirects.clearDraws();for(var s=i.drawInfos,o=0;o0){e.glBlocks=new Array(e.blocks.length);for(var T=0;T0){e.glSamplerTextures=new Array(e.samplerTextures.length);for(var D=0;D=0&&b.gpuDescriptors[C],w=null,I=0;if(R&&R.gpuBuffer){var x=R.gpuBuffer,D=E[A.set],O=D&&D[A.binding];O>=0&&(I=r[O]),"vf32"in x?w=x.vf32:(I+=x.offset,w=x.gpuBuffer.vf32),I>>=2}if(w)for(var P=A.glActiveUniforms.length,M=0;M=0&&It.gpuDescriptors[xt],Ot=wt.units.length,Pt=0;Pt0){var Nt=Dt.gpuTexture,Lt=c.glTexUnits[Mt];Lt.glTexture!==Nt.glTexture&&(c.texUnit!==Mt&&(u.activeTexture(u.TEXTURE0+Mt),c.texUnit=Mt),Nt.glTexture?u.bindTexture(Nt.glTarget,Nt.glTexture):u.bindTexture(Nt.glTarget,t.nullTex2D.gpuTexture.glTexture),Lt.glTexture=Nt.glTexture);var Bt=Dt.gpuSampler;Nt.isPowerOf2?(o=Bt.glWrapS,a=Bt.glWrapT):(o=u.CLAMP_TO_EDGE,a=u.CLAMP_TO_EDGE),h=Nt.isPowerOf2?Nt.mipLevel<=1&&(Bt.glMinFilter===u.LINEAR_MIPMAP_NEAREST||Bt.glMinFilter===u.LINEAR_MIPMAP_LINEAR)?u.LINEAR:Bt.glMinFilter:Bt.glMinFilter===u.LINEAR||Bt.glMinFilter===u.LINEAR_MIPMAP_NEAREST||Bt.glMinFilter===u.LINEAR_MIPMAP_LINEAR?u.LINEAR:u.NEAREST,Nt.glWrapS!==o&&(c.texUnit!==Mt&&(u.activeTexture(u.TEXTURE0+Mt),c.texUnit=Mt),u.texParameteri(Nt.glTarget,u.TEXTURE_WRAP_S,o),Nt.glWrapS=o),Nt.glWrapT!==a&&(c.texUnit!==Mt&&(u.activeTexture(u.TEXTURE0+Mt),c.texUnit=Mt),u.texParameteri(Nt.glTarget,u.TEXTURE_WRAP_T,a),Nt.glWrapT=a),Nt.glMinFilter!==h&&(c.texUnit!==Mt&&(u.activeTexture(u.TEXTURE0+Mt),c.texUnit=Mt),u.texParameteri(Nt.glTarget,u.TEXTURE_MIN_FILTER,h),Nt.glMinFilter=h),Nt.glMagFilter!==Bt.glMagFilter&&(c.texUnit!==Mt&&(u.activeTexture(u.TEXTURE0+Mt),c.texUnit=Mt),u.texParameteri(Nt.glTarget,u.TEXTURE_MAG_FILTER,Bt.glMagFilter),Nt.glMagFilter=Bt.glMagFilter)}Dt=It.gpuDescriptors[++xt]}}}if(i&&l&&(_||k6.gpuInputAssembler!==i)){k6.gpuInputAssembler=i;var Ft=t.extensions.ANGLE_instanced_arrays;if(t.extensions.useVAO){var kt=t.extensions.OES_vertex_array_object,Ut=i.glVAOs.get(l.glProgram);if(!Ut){var Gt;Ut=kt.createVertexArrayOES(),i.glVAOs.set(l.glProgram,Ut),kt.bindVertexArrayOES(Ut),u.bindBuffer(u.ARRAY_BUFFER,null),u.bindBuffer(u.ELEMENT_ARRAY_BUFFER,null),c.glArrayBuffer=null,c.glElementArrayBuffer=null;for(var Ht=l.glInputs.length,zt=0;zt=0&&(u.enableVertexAttribArray(oe),c.glEnabledAttribLocs[oe]=!0),c.glCurrentAttribLocs[oe]=!0,u.vertexAttribPointer(oe,ee.count,ee.glType,ee.isNormalized,ee.stride,ae),Ft&&Ft.vertexAttribDivisorANGLE(oe,ee.isInstanced?1:0)}}}var he=i.gpuIndexBuffer;he&&c.glElementArrayBuffer!==he.glBuffer&&(u.bindBuffer(u.ELEMENT_ARRAY_BUFFER,he.glBuffer),c.glElementArrayBuffer=he.glBuffer);for(var ue=0;ue0){var d=e.firstIndex*h.stride;r.drawElementsInstancedANGLE(a,e.indexCount,o.glIndexType,d,e.instanceCount)}}else e.vertexCount>0&&r.drawArraysInstancedANGLE(a,e.firstVertex,e.vertexCount,e.instanceCount);else if(h){if(e.indexCount>0){var f=e.firstIndex*h.stride;i.drawElements(a,e.indexCount,o.glIndexType,f)}}else e.vertexCount>0&&i.drawArrays(a,e.firstVertex,e.vertexCount)}}var V6=new Array(v6.COUNT);function W6(t,e){V6.fill(0);for(var i=0;i0?g.buffStride:_.width,f.height=g.buffTexHeight>0?g.buffTexHeight:_.height;var v=g.texExtent.width+d.x===i.width>>m?g.texExtent.width:_.width,y=g.texExtent.height+d.y===i.height>>m?g.texExtent.height:_.height,T=void 0,E=e[o++];if(f.width===_.width&&f.height===_.height){var S=ld(i.format,v,y,1)/u.BYTES_PER_ELEMENT;tt(Number.isInteger(S),9101),T=new u(E.buffer,E.byteOffset+g.buffOffset,S)}else T=j6(E,i.format,g.buffOffset,f,_);c?i.glInternalFmt===u6.COMPRESSED_RGB_ETC1_WEBGL||t.extensions.noCompressedTexSubImage2D?r.compressedTexImage2D(r.TEXTURE_2D,m,i.glInternalFmt,v,y,0,T):r.compressedTexSubImage2D(r.TEXTURE_2D,m,d.x,d.y,v,y,i.glFormat,T):r.texSubImage2D(r.TEXTURE_2D,m,d.x,d.y,v,y,i.glFormat,i.glType,T)}break;case r.TEXTURE_CUBE_MAP:for(var A=0;A0?b.buffStride:_.width,f.height=b.buffTexHeight>0?b.buffTexHeight:_.height;var R=b.texExtent.width+d.x===i.width>>C?b.texExtent.width:_.width,w=b.texExtent.height+d.y===i.height>>C?b.texExtent.height:_.height,I=b.texSubres.baseArrayLayer+b.texSubres.layerCount;for(a=b.texSubres.baseArrayLayer;a0,this.instancedDraw=!!e.instanceCount,this.drawCount=Math.max(t+1,this.drawCount),this.drawByIndex?(this.counts[t]=e.indexCount,this.offsets[t]=e.firstIndex):(this.counts[t]=e.vertexCount,this.offsets[t]=e.firstVertex),this.instances[t]=Math.max(1,e.instanceCount)},e._ensureCapacity=function(t){if(!(this._capacity>t)){this._capacity=Wi(t);var e=new Int32Array(this._capacity),i=new Int32Array(this._capacity),n=new Int32Array(this._capacity);this.byteOffsets=new Int32Array(this._capacity),e.set(this.counts),i.set(this.offsets),n.set(this.instances),this.counts=e,this.offsets=i,this.instances=n}},t}(),Q6=function(){function t(){this._gpuShader=null,this._gpuDescriptorSetLayout=null,this._gpuPipelineLayout=null,this._gpuPipelineState=null,this._gpuVertexBuffer=null,this._gpuInputAssembler=null,this._gpuPointSampler=null,this._gpuLinearSampler=null,this._gpuDescriptorSet=null,this._gpuUniformBuffer=null,this._drawInfo=null,this._glFramebuffer=null,this._uniformBuffer=null;var t=l6.instance.gl,e=l6.instance.bindingMappingInfo.maxBlockCounts[0];this._gpuShader={name:"Blit Pass",blocks:[new w_(0,0,"BlitParams",[new R_("tilingOffsetSrc",ml.FLOAT4,1),new R_("tilingOffsetDst",ml.FLOAT4,1)],1)],samplerTextures:[new I_(0,e,"textureSrc",ml.SAMPLER2D,1)],subpassInputs:[],gpuStages:[{type:Ll.VERTEX,source:"\n precision mediump float;\n\n attribute vec2 a_position;\n attribute vec2 a_texCoord;\n \n uniform vec4 tilingOffsetSrc;\n uniform vec4 tilingOffsetDst;\n \n varying vec2 v_texCoord;\n \n void main() {\n v_texCoord = a_texCoord * tilingOffsetSrc.xy + tilingOffsetSrc.zw;\n gl_Position = vec4((a_position + 1.0) * tilingOffsetDst.xy - 1.0 + tilingOffsetDst.zw * 2.0, 0, 1);\n }",glShader:null},{type:Ll.FRAGMENT,source:"\n precision mediump float;\n uniform sampler2D textureSrc;\n\n varying vec2 v_texCoord;\n \n void main() {\n gl_FragColor = texture2D(textureSrc, v_texCoord);\n }",glShader:null}],glProgram:null,glInputs:[],glUniforms:[],glBlocks:[],glSamplerTextures:[]},N6(l6.instance,this._gpuShader),this._gpuDescriptorSetLayout={bindings:[new Y_(0,Yl.UNIFORM_BUFFER,1,Ll.VERTEX),new Y_(e,Yl.SAMPLER_TEXTURE,1,Ll.FRAGMENT)],dynamicBindings:[],descriptorIndices:[],descriptorCount:e+1};for(var i=0;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 q6,glTarget:0,glBuffer:null},this._usage&vl.UNIFORM&&(this._gpuBuffer.buffer=this._uniformBuffer),O6(l6.instance,this._gpuBuffer),l6.instance.memoryStatus.bufferSize+=this._size},i.destroy=function(){this._gpuBuffer&&(P6(l6.instance,this._gpuBuffer),l6.instance.memoryStatus.bufferSize-=this._size,this._gpuBuffer=null),this._gpuBufferView&&(this._gpuBufferView=null)},i.resize=function(t){if(this._isBufferView)q(16379);else{var e=this._size;e!==t&&(this._size=t,this._count=this._size/this._stride,this._uniformBuffer&&(this._uniformBuffer=new Uint8Array(t)),this._gpuBuffer&&(this._uniformBuffer&&(this._gpuBuffer.buffer=this._uniformBuffer),this._gpuBuffer.size=t,t>0&&(function(t,e){var i=t.gl,n=t.stateCache,r=e.memUsage&El.HOST?i.DYNAMIC_DRAW:i.STATIC_DRAW;e.usage&vl.VERTEX?(t.extensions.useVAO&&n.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),n.glVAO=null),k6.gpuInputAssembler=null,t.stateCache.glArrayBuffer!==e.glBuffer&&i.bindBuffer(i.ARRAY_BUFFER,e.glBuffer),e.buffer?i.bufferData(i.ARRAY_BUFFER,e.buffer,r):i.bufferData(i.ARRAY_BUFFER,e.size,r),i.bindBuffer(i.ARRAY_BUFFER,null),t.stateCache.glArrayBuffer=null):e.usage&vl.INDEX?(t.extensions.useVAO&&n.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),n.glVAO=null),k6.gpuInputAssembler=null,t.stateCache.glElementArrayBuffer!==e.glBuffer&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.glBuffer),e.buffer?i.bufferData(i.ELEMENT_ARRAY_BUFFER,e.buffer,r):i.bufferData(i.ELEMENT_ARRAY_BUFFER,e.size,r),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,null),t.stateCache.glElementArrayBuffer=null):e.usage&vl.UNIFORM?e.buffer&&(e.vf32=new Float32Array(e.buffer.buffer)):(e.usage&vl.INDIRECT||e.usage&vl.TRANSFER_DST||e.usage&vl.TRANSFER_SRC||Z(16315),e.glTarget=i.NONE)}(l6.instance,this._gpuBuffer),l6.instance.memoryStatus.bufferSize-=e,l6.instance.memoryStatus.bufferSize+=t)))}},i.update=function(t,e){var i;this._isBufferView?q(16380):(i=void 0!==e?e:this._usage&vl.INDIRECT?0:t.byteLength,M6(l6.instance,this._gpuBuffer,t,0,i))},n(e,[{key:"gpuBuffer",get:function(){return this._gpuBuffer}},{key:"gpuBufferView",get:function(){return this._gpuBufferView}}]),e}(yd),J6=function(){function t(t,e){this._freeIdx=0,this._frees=new Array(e),this._freeCmds=new js(e);for(var i=0;i0?this.gpuColorTextures[0].width:this.gpuDepthStencilTexture?this.gpuDepthStencilTexture.width:u},set width(t){u=t},get height(){return this.gpuColorTextures.length>0?this.gpuColorTextures[0].height:this.gpuDepthStencilTexture?this.gpuDepthStencilTexture.height:c},set height(t){c=t},lodLevel:r},function(t,e){for(var i=0;ii&&(i=s.binding)}this._bindingIndices=Array(i+1).fill(-1);for(var o=this._descriptorIndices=Array(i+1).fill(-1),a=0;at.capabilities.maxTextureSize&&Z(9100,s,t.capabilities.maxTextureSize),t.textureExclusive[e.format]||t.extensions.WEBGL_depth_texture||!od[e.format].hasDepth){if(e.glTexture=i.createTexture(),e.size>0){var o=t.stateCache.glTexUnits[t.stateCache.texUnit];if(o.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_2D,e.glTexture),o.glTexture=e.glTexture),od[e.format].isCompressed)for(var a=0;a>1),r=Math.max(1,r>>1)}else for(var c=0;c>1),r=Math.max(1,r>>1);e.isPowerOf2?(e.glWrapS=i.REPEAT,e.glWrapT=i.REPEAT):(e.glWrapS=i.CLAMP_TO_EDGE,e.glWrapT=i.CLAMP_TO_EDGE),e.glMinFilter=i.LINEAR,e.glMagFilter=i.LINEAR,i.texParameteri(e.glTarget,i.TEXTURE_WRAP_S,e.glWrapS),i.texParameteri(e.glTarget,i.TEXTURE_WRAP_T,e.glWrapT),i.texParameteri(e.glTarget,i.TEXTURE_MIN_FILTER,e.glMinFilter),i.texParameteri(e.glTarget,i.TEXTURE_MAG_FILTER,e.glMagFilter)}}else e.glInternalFmt=function(t,e){switch(t){case pl.R5G6B5:return e.RGB565;case pl.RGB5A1:return e.RGB5_A1;case pl.RGBA4:return e.RGBA4;case pl.RGBA16F:return u6.RGBA16F_EXT;case pl.RGBA32F:return u6.RGBA32F_EXT;case pl.SRGB8_A8:return u6.SRGB8_ALPHA8_EXT;case pl.DEPTH:return e.DEPTH_COMPONENT16;case pl.DEPTH_STENCIL:return e.DEPTH_STENCIL;default:return Z(16309),e.RGBA}}(e.format,i),e.glRenderbuffer=i.createRenderbuffer(),e.size>0&&(t.stateCache.glRenderbuffer!==e.glRenderbuffer&&(i.bindRenderbuffer(i.RENDERBUFFER,e.glRenderbuffer),t.stateCache.glRenderbuffer=e.glRenderbuffer),i.renderbufferStorage(i.RENDERBUFFER,e.glInternalFmt,n,r));break;case Sl.CUBE:e.glTarget=i.TEXTURE_CUBE_MAP;var l=Math.max(n,r);if(l>t.capabilities.maxCubeMapTextureSize&&Z(9100,l,t.capabilities.maxTextureSize),e.glTexture=i.createTexture(),e.size>0){var _=t.stateCache.glTexUnits[t.stateCache.texUnit];if(_.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_CUBE_MAP,e.glTexture),_.glTexture=e.glTexture),od[e.format].isCompressed)for(var d=0;d<6;++d){n=e.width,r=e.height;for(var f=0;f>1),r=Math.max(1,r>>1)}}else for(var m=0;m<6;++m){n=e.width,r=e.height;for(var v=0;v>1),r=Math.max(1,r>>1)}e.isPowerOf2?(e.glWrapS=i.REPEAT,e.glWrapT=i.REPEAT):(e.glWrapS=i.CLAMP_TO_EDGE,e.glWrapT=i.CLAMP_TO_EDGE),e.glMinFilter=i.LINEAR,e.glMagFilter=i.LINEAR,i.texParameteri(e.glTarget,i.TEXTURE_WRAP_S,e.glWrapS),i.texParameteri(e.glTarget,i.TEXTURE_WRAP_T,e.glWrapT),i.texParameteri(e.glTarget,i.TEXTURE_MIN_FILTER,e.glMinFilter),i.texParameteri(e.glTarget,i.TEXTURE_MAG_FILTER,e.glMagFilter)}break;default:Z(16317),e.type=Sl.TEX2D,e.glTarget=i.TEXTURE_2D}}(l6.instance,this._gpuTexture),l6.instance.memoryStatus.textureSize+=this._size),this._viewInfo.texture=this,this._viewInfo.type=t.type,this._viewInfo.format=t.format,this._viewInfo.baseLevel=0,this._viewInfo.levelCount=t.levelCount,this._viewInfo.baseLayer=0,this._viewInfo.layerCount=t.layerCount)},i.destroy=function(){!this._isTextureView&&this._gpuTexture&&(function(t,e){var i=t.gl;if(e.glTexture){var n=t.stateCache.glTexUnits,r=t.stateCache.texUnit;i.deleteTexture(e.glTexture);for(var s=0;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=_d(this._info.format,this.width,this.height,this.depth,this._info.levelCount)*this._info.layerCount,!this._isTextureView&&this._gpuTexture&&(this._gpuTexture.width=t,this._gpuTexture.height=i,this._gpuTexture.size=this._size,this._gpuTexture.isSwapchainTexture||(function(t,e){if(e.size){var i=t.gl,n=e.width,r=e.height;switch(e.type){case Sl.TEX2D:e.glTarget=i.TEXTURE_2D;var s=Math.max(n,r);if(s>t.capabilities.maxTextureSize&&Z(9100,s,t.capabilities.maxTextureSize),e.glRenderbuffer)t.stateCache.glRenderbuffer!==e.glRenderbuffer&&(i.bindRenderbuffer(i.RENDERBUFFER,e.glRenderbuffer),t.stateCache.glRenderbuffer=e.glRenderbuffer),i.renderbufferStorage(i.RENDERBUFFER,e.glInternalFmt,n,r);else if(e.glTexture){var o=t.stateCache.glTexUnits[t.stateCache.texUnit];if(o.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_2D,e.glTexture),o.glTexture=e.glTexture),od[e.format].isCompressed)for(var a=0;a>1),r=Math.max(1,r>>1)}else for(var c=0;c>1),r=Math.max(1,r>>1)}break;case Sl.CUBE:e.glTarget=i.TEXTURE_CUBE_MAP;var l=Math.max(n,r);l>t.capabilities.maxCubeMapTextureSize&&Z(9100,l,t.capabilities.maxTextureSize);var _=t.stateCache.glTexUnits[t.stateCache.texUnit];if(_.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_CUBE_MAP,e.glTexture),_.glTexture=e.glTexture),od[e.format].isCompressed)for(var d=0;d<6;++d){n=e.width,r=e.height;for(var f=0;f>1),r=Math.max(1,r>>1)}}else for(var m=0;m<6;++m){n=e.width,r=e.height;for(var v=0;v>1),r=Math.max(1,r>>1)}break;default:Z(16317),e.type=Sl.TEX2D,e.glTarget=i.TEXTURE_2D}}}(l6.instance,this._gpuTexture),l6.instance.memoryStatus.textureSize-=n,l6.instance.memoryStatus.textureSize+=this._size))}},i.initAsSwapchainTexture=function(t){var e=new A_;e.format=t.format,e.usage=od[t.format].hasDepth?Al.DEPTH_STENCIL_ATTACHMENT:Al.COLOR_ATTACHMENT,e.width=t.width,e.height=t.height,this.initialize(e,!0)},n(e,[{key:"gpuTexture",get:function(){return this._gpuTexture}},{key:"lodLevel",get:function(){return this._lodLevel}}]),e}(Ud),p8="webglcontextlost";function g8(t,e){for(var i=["","WEBKIT_","MOZ_"],n=0;n=0&&e.allMaterials.splice(i,1),!0}return!1},i.setValues=function(t,i,n,r){var s=this._friction!==t||this._rollingFriction!==i||this._spinningFriction!==n||this._restitution!==r;this._friction=t,this._rollingFriction=i,this._spinningFriction=n,this._restitution=r,s&&this.emit(e.EVENT_UPDATE)},n(e,[{key:"friction",get:function(){return this._friction},set:function(t){Di(this._friction,t)||(this._friction=t,this.emit(e.EVENT_UPDATE))}},{key:"rollingFriction",get:function(){return this._rollingFriction},set:function(t){Di(this._rollingFriction,t)||(this._rollingFriction=t,this.emit(e.EVENT_UPDATE))}},{key:"spinningFriction",get:function(){return this._spinningFriction},set:function(t){Di(this._spinningFriction,t)||(this._spinningFriction=t,this.emit(e.EVENT_UPDATE))}},{key:"restitution",get:function(){return this._restitution},set:function(t){Di(this._restitution,t)||(this._restitution=t,this.emit(e.EVENT_UPDATE))}}]),e}(Of)).allMaterials=[],v7.EVENT_UPDATE="event_update",v7._idCounter=0,f((d7=v7).prototype,"friction",[h7],Object.getOwnPropertyDescriptor(d7.prototype,"friction"),d7.prototype),f(d7.prototype,"rollingFriction",[u7],Object.getOwnPropertyDescriptor(d7.prototype,"rollingFriction"),d7.prototype),f(d7.prototype,"spinningFriction",[c7],Object.getOwnPropertyDescriptor(d7.prototype,"spinningFriction"),d7.prototype),f(d7.prototype,"restitution",[l7],Object.getOwnPropertyDescriptor(d7.prototype,"restitution"),d7.prototype),f7=ua(d7.prototype,"_friction",[wa],(function(){return.6})),p7=ua(d7.prototype,"_rollingFriction",[wa],(function(){return 0})),g7=ua(d7.prototype,"_spinningFriction",[wa],(function(){return 0})),m7=ua(d7.prototype,"_restitution",[wa],(function(){return 0})),_7=d7))||_7);t({PhysicsMaterial:R7,PhysicMaterial:R7});var w7=t("PhysicsRayResult",function(){function t(){this._hitPoint=new _n,this._hitNormal=new _n,this._distance=0,this._collider=null}var e=t.prototype;return e._assign=function(t,e,i,n){_n.copy(this._hitPoint,t),_n.copy(this._hitNormal,n),this._distance=e,this._collider=i},e.clone=function(){var e=new t;return _n.copy(e._hitPoint,this._hitPoint),_n.copy(e._hitNormal,this._hitNormal),e._distance=this._distance,e._collider=this._collider,e},n(t,[{key:"hitPoint",get:function(){return this._hitPoint}},{key:"distance",get:function(){return this._distance}},{key:"collider",get:function(){return this._collider}},{key:"hitNormal",get:function(){return this._hitNormal}}]),t}()),I7=t("PhysicsLineStripCastResult",function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r=this._fixedTimeStep)){this.physicsWorld.syncSceneToPhysics();break}this.physicsWorld.syncSceneToPhysics(),this.physicsWorld.step(this._fixedTimeStep),this.physicsWorld.emitEvents(),this.physicsWorld.syncAfterEvents(),this._accumulator-=this._fixedTimeStep,this._subStepCount++}DD.emit(ID.EVENT_AFTER_PHYSICS)}}else this.physicsWorld.syncSceneToPhysics()},e.resetConfiguration=function(t){var e=t?t.allowSleep:we.querySettings(Ce.Category.PHYSICS,"allowSleep");"boolean"==typeof e&&(this._allowSleep=e);var i=t?t.fixedTimeStep:we.querySettings(Ce.Category.PHYSICS,"fixedTimeStep");"number"==typeof i&&(this._fixedTimeStep=i);var n=t?t.maxSubSteps:we.querySettings(Ce.Category.PHYSICS,"maxSubSteps");"number"==typeof n&&(this._maxSubSteps=n);var r=t?t.sleepThreshold:we.querySettings(Ce.Category.PHYSICS,"sleepThreshold");"number"==typeof r&&(this._sleepThreshold=r);var s=t?t.autoSimulation:we.querySettings(Ce.Category.PHYSICS,"autoSimulation");"boolean"==typeof s&&(this.autoSimulation=s);var o=t?t.gravity:we.querySettings(Ce.Category.PHYSICS,"gravity");o&&_n.copy(this._gravity,o);var a=t?t.collisionMatrix:we.querySettings(Ce.Category.PHYSICS,"collisionMatrix");if(a)for(var h in a)this.collisionMatrix[""+(1<>>0,this.raycastOptions.maxDistance=i,this.raycastOptions.queryTrigger=n,this.physicsWorld.raycast(t,this.raycastOptions,this.raycastResultPool,this.raycastResults))},e.raycastClosest=function(t,e,i,n){return void 0===e&&(e=4294967295),void 0===i&&(i=1e7),void 0===n&&(n=!0),!!this.physicsWorld&&(this.raycastOptions.mask=e>>>0,this.raycastOptions.maxDistance=i,this.raycastOptions.queryTrigger=n,this.physicsWorld.raycastClosest(t,this.raycastOptions,this.raycastClosestResult))},e.lineStripCast=function(t,e,i,n){if(void 0===e&&(e=4294967295),void 0===i&&(i=1e7),void 0===n&&(n=!0),t.length<2)return!1;this.lineStripCastResults=[];for(var r=0,s=new _r,o=1;oi);++o){var a=t[o-1],h=t[o],u=new _n;_n.subtract(u,h,a);var c=_n.len(u);if(r+=c,_n.multiplyScalar(u,u,1/c),s.d=u,s.o=a,this.raycast(s,e,c,n))for(var l=0;l0},e.lineStripCastClosest=function(t,e,i,n){if(void 0===e&&(e=4294967295),void 0===i&&(i=1e7),void 0===n&&(n=!0),t.length<2)return!1;for(var r=0,s=new _r,o=!1,a=1;ai);++a){var h=t[a-1],u=t[a],c=new _n;_n.subtract(c,u,h);var l=_n.len(c);if(r+=l,_n.multiplyScalar(c,c,1/l),s.d=c,s.o=h,o=this.raycastClosest(s,e,l,n)){var _=this.raycastClosestResult,d=new I7;d._assign(_.hitPoint,_.distance,_.collider,_.hitNormal,a-1),this.lineStripCastClosestResult=d;break}}return o},e.sweepBox=function(t,e,i,n,r,s){return void 0===n&&(n=4294967295),void 0===r&&(r=1e7),void 0===s&&(s=!0),!!this.physicsWorld&&(this.sweepResultPool.reset(),this.sweepCastResults.length=0,this.raycastOptions.mask=n>>>0,this.raycastOptions.maxDistance=r,this.raycastOptions.queryTrigger=s,this.physicsWorld.sweepBox(t,e,i,this.raycastOptions,this.sweepResultPool,this.sweepCastResults))},e.sweepBoxClosest=function(t,e,i,n,r,s){return void 0===n&&(n=4294967295),void 0===r&&(r=1e7),void 0===s&&(s=!0),!!this.physicsWorld&&(this.raycastOptions.mask=n>>>0,this.raycastOptions.maxDistance=r,this.raycastOptions.queryTrigger=s,this.physicsWorld.sweepBoxClosest(t,e,i,this.raycastOptions,this.sweepCastClosestResult))},e.sweepSphere=function(t,e,i,n,r){return void 0===i&&(i=4294967295),void 0===n&&(n=1e7),void 0===r&&(r=!0),!!this.physicsWorld&&(this.sweepResultPool.reset(),this.sweepCastResults.length=0,this.raycastOptions.mask=i>>>0,this.raycastOptions.maxDistance=n,this.raycastOptions.queryTrigger=r,this.physicsWorld.sweepSphere(t,e,this.raycastOptions,this.sweepResultPool,this.sweepCastResults))},e.sweepSphereClosest=function(t,e,i,n,r){return void 0===i&&(i=4294967295),void 0===n&&(n=1e7),void 0===r&&(r=!0),!!this.physicsWorld&&(this.raycastOptions.mask=i>>>0,this.raycastOptions.maxDistance=n,this.raycastOptions.queryTrigger=r,this.physicsWorld.sweepSphereClosest(t,e,this.raycastOptions,this.sweepCastClosestResult))},e.sweepCapsule=function(t,e,i,n,r,s,o){return void 0===r&&(r=4294967295),void 0===s&&(s=1e7),void 0===o&&(o=!0),!!this.physicsWorld&&(this.sweepResultPool.reset(),this.sweepCastResults.length=0,this.raycastOptions.mask=r>>>0,this.raycastOptions.maxDistance=s,this.raycastOptions.queryTrigger=o,this.physicsWorld.sweepCapsule(t,e,i,n,this.raycastOptions,this.sweepResultPool,this.sweepCastResults))},e.sweepCapsuleClosest=function(t,e,i,n,r,s,o){return void 0===r&&(r=4294967295),void 0===s&&(s=1e7),void 0===o&&(o=!0),!!this.physicsWorld&&(this.raycastOptions.mask=r>>>0,this.raycastOptions.maxDistance=s,this.raycastOptions.queryTrigger=o,this.physicsWorld.sweepCapsuleClosest(t,e,i,n,this.raycastOptions,this.sweepCastClosestResult))},e._updateMaterial=function(){this.physicsWorld&&this.physicsWorld.setDefaultMaterial(this._material)},i.constructAndRegister=function(){var t;if((null===(t=we.querySettings(Ce.Category.PHYSICS,"enabled"))||void 0===t||t)&&!i._instance){var e=new i;i._instance=e,e.resetConfiguration(),function(t){if(x8||(x8=t),N8.runInEditor&&!N8.physicsWorld){B("[PHYSICS]: using "+N8.id+".");var e=N8.physicsWorld=k8();e.setGravity(x8.gravity),e.setAllowSleep(x8.allowSleep)}}(e),DD.registerSystem(i.ID,e,e.priority),bO.onPostProjectInitDelegate.add(e.initDefaultMaterial.bind(e))}},n(i,[{key:"enable",get:function(){return this._enable},set:function(t){this._enable=t}},{key:"allowSleep",get:function(){return this._allowSleep},set:function(t){this._allowSleep=t,this.physicsWorld&&this.physicsWorld.setAllowSleep(t)}},{key:"maxSubSteps",get:function(){return this._maxSubSteps},set:function(t){this._maxSubSteps=t}},{key:"fixedTimeStep",get:function(){return this._fixedTimeStep},set:function(t){this._fixedTimeStep=t}},{key:"gravity",get:function(){return this._gravity},set:function(t){this._gravity.set(t),this.physicsWorld&&this.physicsWorld.setGravity(t)}},{key:"sleepThreshold",get:function(){return this._sleepThreshold},set:function(t){this._sleepThreshold=t}},{key:"autoSimulation",get:function(){return this._autoSimulation},set:function(t){this._autoSimulation=t}},{key:"defaultMaterial",get:function(){return this._material}},{key:"physicsWorld",get:function(){return N8.physicsWorld}},{key:"debugDrawFlags",get:function(){return this.physicsWorld.debugDrawFlags},set:function(t){this.physicsWorld.debugDrawFlags=t}},{key:"debugDrawConstraintSize",get:function(){return this.physicsWorld.debugDrawConstraintSize},set:function(t){this.physicsWorld.debugDrawConstraintSize=t}}],[{key:"PHYSICS_NONE",get:function(){return!N8.id}},{key:"PHYSICS_BUILTIN",get:function(){return"builtin"===N8.id}},{key:"PHYSICS_CANNON",get:function(){return"cannon.js"===N8.id}},{key:"PHYSICS_BULLET",get:function(){return"bullet"===N8.id}},{key:"PHYSICS_PHYSX",get:function(){return"physx"===N8.id}},{key:"PhysicsGroup",get:function(){return w8}},{key:"instance",get:function(){return i._instance}}]),i}(Yc));j7.ID="PHYSICS",j7._instance=null,DD.once(ID.EVENT_INIT,(function(){j7.constructAndRegister()}));var Y7,K7,q7,Q7,Z7,J7,$7,t9,e9,i9,n9,r9=(D7=va("cc.RigidBody"),O7=Ta(-1),P7=Za(j7.PhysicsGroup),M7=Za(v8),D7(N7=Ea(N7=O7(((X7=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;ry8.Z_AXIS||this._direction!==t&&(this._direction=t,this._shape&&this.shape.setDirection(t))}},{key:"height",get:function(){return 2*this._radius+this._cylinderHeight},set:function(t){var e=t-2*this._radius;e<0&&(e=0),this.cylinderHeight=e}},{key:"worldHeight",get:function(){return 2*this._radius*this._getRadiusScale()+this._cylinderHeight*this._getHeightScale()}},{key:"shape",get:function(){return this._shape}}]),e}(c9)).prototype,"direction",[g9],Object.getOwnPropertyDescriptor(v9.prototype,"direction"),v9.prototype),y9=ua(v9.prototype,"_radius",[wa],(function(){return.5})),T9=ua(v9.prototype,"_cylinderHeight",[wa],(function(){return 1})),E9=ua(v9.prototype,"_direction",[wa],(function(){return y8.Y_AXIS})),m9=v9))||m9);t({CapsuleCollider:D9,CapsuleColliderComponent:D9});var O9,P9,M9,N9,L9,B9,F9,k9=(A9=va("cc.CylinderCollider"),b9=Za(y8),A9((f((R9=function(t){function e(){var e;return(e=t.call(this,S8.CYLINDER)||this)._radius=w9&&w9(),e._height=I9&&I9(),e._direction=x9&&x9(),e}return s(e,t),n(e,[{key:"radius",get:function(){return this._radius},set:function(t){this._radius!==t&&(this._radius=Math.abs(t),this._shape&&this.shape.setRadius(t))}},{key:"height",get:function(){return this._height},set:function(t){this._height!==t&&(this._height=Math.abs(t),this._shape&&this.shape.setHeight(t))}},{key:"direction",get:function(){return this._direction},set:function(t){this._direction!==t&&(ty8.Z_AXIS||(this._direction=t,this._shape&&this.shape.setDirection(t)))}},{key:"shape",get:function(){return this._shape}}]),e}(c9)).prototype,"direction",[b9],Object.getOwnPropertyDescriptor(R9.prototype,"direction"),R9.prototype),w9=ua(R9.prototype,"_radius",[wa],(function(){return.5})),I9=ua(R9.prototype,"_height",[wa],(function(){return 2})),x9=ua(R9.prototype,"_direction",[wa],(function(){return y8.Y_AXIS})),C9=R9))||C9);t({CylinderCollider:k9,CylinderColliderComponent:k9});var U9,G9,H9,z9,V9,W9,X9,j9,Y9,K9,q9,Q9,Z9=t("ConeCollider",(O9=va("cc.ConeCollider"),P9=Za(y8),O9((f((N9=function(t){function e(){var e;return(e=t.call(this,S8.CONE)||this)._radius=L9&&L9(),e._height=B9&&B9(),e._direction=F9&&F9(),e}return s(e,t),n(e,[{key:"radius",get:function(){return this._radius},set:function(t){this._radius!==t&&(this._radius=Math.abs(t),this._shape&&this.shape.setRadius(t))}},{key:"height",get:function(){return this._height},set:function(t){this._height!==t&&(t<0&&(t=0),this._height=t,this._shape&&this.shape.setHeight(t))}},{key:"direction",get:function(){return this._direction},set:function(t){this._direction!==t&&(ty8.Z_AXIS||(this._direction=t,this._shape&&this.shape.setDirection(t)))}},{key:"shape",get:function(){return this._shape}}]),e}(c9)).prototype,"direction",[P9],Object.getOwnPropertyDescriptor(N9.prototype,"direction"),N9.prototype),L9=ua(N9.prototype,"_radius",[wa],(function(){return.5})),B9=ua(N9.prototype,"_height",[wa],(function(){return 1})),F9=ua(N9.prototype,"_direction",[wa],(function(){return y8.Y_AXIS})),M9=N9))||M9)),J9=(U9=va("cc.MeshCollider"),G9=Za(ZO),U9((f((z9=function(t){function e(){var e;return(e=t.call(this,S8.MESH)||this)._mesh=V9&&V9(),e._convex=W9&&W9(),e}return s(e,t),e.prototype.onEnable=function(){if(t.prototype.onEnable.call(this),this.node){var e=this.node.getComponent(r9);e&&e.isValid&&e.type===v8.DYNAMIC&&!this.convex&&q(9630,this.node.name)}},n(e,[{key:"mesh",get:function(){return this._mesh},set:function(t){this._mesh!==t&&(this._mesh=t,this._shape&&this.shape.setMesh(this._mesh))}},{key:"convex",get:function(){return this._convex},set:function(t){this._convex!==t&&(this._convex=t,this._shape&&this._mesh&&this.shape.setMesh(this._mesh))}},{key:"shape",get:function(){return this._shape}}]),e}(c9)).prototype,"mesh",[G9],Object.getOwnPropertyDescriptor(z9.prototype,"mesh"),z9.prototype),V9=ua(z9.prototype,"_mesh",[wa],(function(){return null})),W9=ua(z9.prototype,"_convex",[wa],(function(){return!1})),H9=z9))||H9);t({MeshCollider:J9,MeshColliderComponent:J9});var $9,ttt,ett,itt,ntt,rtt,stt,ott,att,htt,utt,ctt=t("ConstantForce",va("cc.ConstantForce")(X9=ya(r9)(X9=Ea((j9=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;rt)){for(var e=this.buffer.byteLength;e=mtt?this.tileSize=e.readDouble():this.tileSize=e.readFloat(),this.tileSize=Math.floor(100*this.tileSize)/100,e.readIntArray(this._blockCount),this.weightMapSize=e.readInt16(),this.lightMapSize=e.readInt16();var i=e.readInt();this.heights=new Uint16Array(i);for(var n=0;n=gtt){var a=e.readInt();this.normals=new Float32Array(a);for(var h=0;h=dtt){var l=e.readInt();this.layerBuffer=new Array(l);for(var _=0;_=ftt){var d=e.readInt();this._layerBinaryInfos=new Array(d);for(var f=0;f=mtt?this._layerBinaryInfos[f].tileSize=e.readDouble():this._layerBinaryInfos[f].tileSize=e.readFloat(),this._layerBinaryInfos[f].detailMapId=e.readString(),this._version>=ptt&&(this._layerBinaryInfos[f].normalMapId=e.readString(),this._version>=mtt?(this._layerBinaryInfos[f].roughness=e.readDouble(),this._layerBinaryInfos[f].metallic=e.readDouble()):(this._layerBinaryInfos[f].roughness=e.readFloat(),this._layerBinaryInfos[f].metallic=e.readFloat()))}return!0},i._exportNativeData=function(){var t=new Ttt;t.writeInt32(vtt),t.writeDouble(this.tileSize),t.writeIntArray(this._blockCount),t.writeInt16(this.weightMapSize),t.writeInt16(this.lightMapSize),t.writeInt32(this.heights.length);for(var e=0;e=0&&(he(this.ghostStruct.wrappedShapes,i),t.setCompound(0),this.ghostEnabled=!1)}else{var n=this.bodyStruct.wrappedShapes.indexOf(t);n>=0&&(this.bodyStruct.useCompound?t.setCompound(0):q8.CollisionObject_setCollisionShape(this.body,q8.EmptyShape_static()),q8.CollisionObject_activate(this.body,!0),this.dirty|=ast.BODY_RE_ADD,he(this.bodyStruct.wrappedShapes,n),this.bodyEnabled=!1)}},e.addJoint=function(t,e){e?this.wrappedJoints1.indexOf(t)<0&&this.wrappedJoints1.push(t):this.wrappedJoints0.indexOf(t)<0&&this.wrappedJoints0.push(t)},e.removeJoint=function(t,e){if(e){var i=this.wrappedJoints1.indexOf(t);i>=0&&he(this.wrappedJoints1,i)}else{var n=this.wrappedJoints0.indexOf(t);n>=0&&he(this.wrappedJoints0,n)}},e.updateDirty=function(){this.dirty&&(this.bodyIndex>=0&&this.dirty&ast.BODY_RE_ADD&&this.updateBodyByReAdd(),this.ghostIndex>=0&&this.dirty&ast.GHOST_RE_ADD&&this.updateGhostByReAdd(),this.dirty=0)},e.syncSceneToPhysics=function(){if(this.node.hasChangedFlags){var t=t7.instance.BT_QUAT_0,e=q8.CollisionObject_getWorldTransform(this.body);if(S7(t,this.node.worldRotation),T7(q8.Transform_getOrigin(e),this.node.worldPosition),q8.Transform_setRotation(e,t),this.node.hasChangedFlags&Ig.SCALE&&this.syncBodyScale(),q8.CollisionObject_isKinematicObject(this.body)){var i=q8.RigidBody_getMotionState(this.body);i&&q8.MotionState_setWorldTransform(i,e)}else this.isBodySleeping()&&q8.CollisionObject_activate(this.body,!1)}},e.syncPhysicsToScene=function(){q8.CollisionObject_isStaticOrKinematicObject(this.body)||this.syncPhysicsToGraphics()},e.syncPhysicsToGraphics=function(){if(!this.isBodySleeping()){var t=t7.instance.BT_QUAT_0,e=t7.instance.BT_TRANSFORM_0;q8.RigidBody_getWorldTransform(this.body,e);var i=q8.Transform_getRotationAndOrigin(e,t);if(this.node.worldRotation=A7(vst,t),this.node.worldPosition=E7(mst,i),this._ghostStruct){var n=q8.CollisionObject_getWorldTransform(this.ghost);T7(q8.Transform_getOrigin(n),this.node.worldPosition),S7(t,this.node.worldRotation),q8.Transform_setRotation(n,t)}}},e.syncSceneToGhost=function(){if(this.node.hasChangedFlags){var t=t7.instance.BT_QUAT_0,e=q8.CollisionObject_getWorldTransform(this.ghost);T7(q8.Transform_getOrigin(e),this.node.worldPosition),S7(t,this.node.worldRotation),q8.Transform_setRotation(e,t),this.node.hasChangedFlags&Ig.SCALE&&this.syncGhostScale(),q8.CollisionObject_activate(this.ghost,!1)}},e.syncInitialBody=function(){var t=t7.instance.BT_QUAT_0,e=q8.CollisionObject_getWorldTransform(this.body);T7(q8.Transform_getOrigin(e),this.node.worldPosition),S7(t,this.node.worldRotation),q8.Transform_setRotation(e,t),this.syncBodyScale(),q8.CollisionObject_activate(this.body,!1)},e.syncInitialGhost=function(){var t=t7.instance.BT_QUAT_0,e=q8.CollisionObject_getWorldTransform(this.ghost);T7(q8.Transform_getOrigin(e),this.node.worldPosition),S7(t,this.node.worldRotation),q8.Transform_setRotation(e,t),this.syncGhostScale(),q8.CollisionObject_activate(this.body,!1)},e.syncBodyScale=function(){for(var t=0;t=0&&(this.wrappedWorld.removeSharedBody(this),this.bodyIndex=this.wrappedWorld.bodies.length,this.wrappedWorld.addSharedBody(this))},e.updateGhostByReAdd=function(){this.ghostIndex>=0&&(this.wrappedWorld.removeGhostObject(this),this.ghostIndex=this.wrappedWorld.ghosts.length,this.wrappedWorld.addGhostObject(this))},e.destroy=function(){if(t.sharedBodesMap.delete(this.node.uuid),this.node=null,this.wrappedWorld=null,this._bodyStruct){var e=this._bodyStruct;t7.delWrapper(this.id,Q8.BODY_CACHE_NAME),q8._safe_delete(e.motionState,W8.EBulletTypeMotionState),q8._safe_delete(e.compound,W8.EBulletTypeCollisionShape),q8._safe_delete(e.body,W8.EBulletTypeCollisionObject),this._bodyStruct=null}if(this._ghostStruct){var i=this._ghostStruct;q8._safe_delete(i.compound,W8.EBulletTypeCollisionShape),q8._safe_delete(i.ghost,W8.EBulletTypeCollisionObject),this._ghostStruct=null}},e.isBodySleeping=function(){return q8.CollisionObject_isSleeping(this.body)},n(t,[{key:"wrappedBody",get:function(){return this._wrappedBody}},{key:"bodyCompoundShape",get:function(){return this.bodyStruct.compound}},{key:"ghostCompoundShape",get:function(){return this.ghostStruct.compound}},{key:"body",get:function(){return this.bodyStruct.body}},{key:"ghost",get:function(){return this.ghostStruct.ghost}},{key:"collisionFilterGroup",get:function(){return this._collisionFilterGroup},set:function(t){t!==this._collisionFilterGroup&&(this._collisionFilterGroup=t,this.dirty|=ast.BODY_RE_ADD,this.dirty|=ast.GHOST_RE_ADD)}},{key:"collisionFilterMask",get:function(){return this._collisionFilterMask},set:function(t){t!==this._collisionFilterMask&&(this._collisionFilterMask=t,this.dirty|=ast.BODY_RE_ADD,this.dirty|=ast.GHOST_RE_ADD)}},{key:"bodyStruct",get:function(){return this._instantiateBodyStruct(),this._bodyStruct}},{key:"ghostStruct",get:function(){return this._instantiateGhostStruct(),this._ghostStruct}},{key:"bodyEnabled",set:function(t){if(t){if(this.bodyIndex<0){if(0===this.bodyStruct.wrappedShapes.length){if(!this.wrappedBody)return;if(!this.wrappedBody.rigidBody.isDynamic)return}this.bodyIndex=this.wrappedWorld.bodies.length,this.wrappedWorld.addSharedBody(this),this.syncInitialBody()}}else this.bodyIndex>=0&&(0===this.bodyStruct.wrappedShapes.length&&null==this.wrappedBody||0===this.bodyStruct.wrappedShapes.length&&null!=this.wrappedBody&&!this.wrappedBody.isEnabled||0===this.bodyStruct.wrappedShapes.length&&null!=this.wrappedBody&&!this.wrappedBody.rigidBody.enabledInHierarchy)&&(q8.RigidBody_clearState(this.body),this.bodyIndex=-1,this.wrappedWorld.removeSharedBody(this))}},{key:"ghostEnabled",set:function(t){t?this.ghostIndex<0&&this.ghostStruct.wrappedShapes.length>0&&(this.ghostIndex=1,this.wrappedWorld.addGhostObject(this),this.syncInitialGhost()):this.ghostIndex>=0&&0===this.ghostStruct.wrappedShapes.length&&this.ghost&&(this.ghostIndex=-1,this.wrappedWorld.removeGhostObject(this))}},{key:"reference",set:function(t){t?this.ref++:this.ref--,0===this.ref&&this.destroy()}}]),t}();Tst.idCounter=0,Tst.sharedBodesMap=new Map;var Est=e7,Sst={},Ast=function(){function t(){this.id=t.idCounter++,this._isEnabled=!1,this._isTrigger=!1,this._isInitialized=!1,this._impl=0,this._compound=0,this.quat=q8.Quat_new(0,0,0,1),this.transform=q8.Transform_new(),this._collider=void 0,this._sharedBody=void 0}var e=t.prototype;return e.updateEventListener=function(){this._sharedBody.wrappedWorld.updateNeedEmitEvents(this.collider.needCollisionEvent||this.collider.needTriggerEvent)},e.setMaterial=function(t){var e=null==t?j7.instance.defaultMaterial:t;if(!this._isTrigger&&this._isEnabled)if(this._compound){Sst[e._uuid]||(Sst[e._uuid]=q8.ccMaterial_new());var i=Sst[e._uuid];q8.ccMaterial_set(i,e.restitution,e.friction,e.rollingFriction,e.spinningFriction),q8.CollisionShape_setMaterial(this._impl,i)}else q8.CollisionObject_setMaterial(this._sharedBody.body,e.restitution,e.friction,e.rollingFriction,e.spinningFriction)},e.setCenter=function(t){_n.copy(Est,t),Est.multiply(this._collider.node.worldScale),T7(q8.Transform_getOrigin(this.transform),Est),this.updateCompoundTransform()},e.setAsTrigger=function(t){this._isTrigger!==t&&(this._isEnabled&&(this._sharedBody.removeShape(this,!t),this._sharedBody.addShape(this,t)),this._isTrigger=t)},e.getAABB=function(t){var e=t7.instance.BT_TRANSFORM_0;q8.Transform_setIdentity(e),q8.Transform_setRotation(e,S7(t7.instance.BT_QUAT_0,this._collider.node.worldRotation));var i=t7.instance.BT_V3_0,n=t7.instance.BT_V3_1;q8.CollisionShape_getAabb(this._impl,e,i,n),t.halfExtents.x=(q8.Vec3_x(n)-q8.Vec3_x(i))/2,t.halfExtents.y=(q8.Vec3_y(n)-q8.Vec3_y(i))/2,t.halfExtents.z=(q8.Vec3_z(n)-q8.Vec3_z(i))/2,_n.add(t.center,this._collider.node.worldPosition,this._collider.center)},e.getBoundingSphere=function(t){t.radius=q8.CollisionShape_getLocalBoundingSphere(this._impl),_n.add(t.center,this._collider.node.worldPosition,this._collider.center)},e.initialize=function(t){this._collider=t,this._isInitialized=!0,this._sharedBody=j7.instance.physicsWorld.getSharedBody(this._collider.node),this._sharedBody.reference=!0,this.onComponentSet(),this.setWrapper()},e.setWrapper=function(){t7.isNotEmptyShape(this._impl)&&(q8.CollisionShape_setUserPointer(this._impl,this._impl),t7.setWrapper(this._impl,t.TYPE,this))},e.onLoad=function(){this.setCenter(this._collider.center),this.setAsTrigger(this._collider.isTrigger)},e.onEnable=function(){this._isEnabled=!0,this._sharedBody.addShape(this,this._isTrigger),this.setMaterial(this.collider.sharedMaterial)},e.onDisable=function(){this._isEnabled=!1,this._sharedBody.removeShape(this,this._isTrigger)},e.onDestroy=function(){this._sharedBody.reference=!1,this._collider=null,q8._safe_delete(this.quat,W8.EBulletTypeQuat),q8._safe_delete(this.transform,W8.EBulletTypeTransform),this._compound&&q8._safe_delete(this._compound,W8.EBulletTypeCollisionShape),t7.isNotEmptyShape(this._impl)&&(q8._safe_delete(this._impl,W8.EBulletTypeCollisionShape),t7.delWrapper(this._impl,t.TYPE))},e.updateByReAdd=function(){this._isEnabled&&(this._sharedBody.removeShape(this,this._isTrigger),this._sharedBody.addShape(this,this._isTrigger))},e.getGroup=function(){return this._sharedBody.collisionFilterGroup},e.setGroup=function(t){this._sharedBody.collisionFilterGroup=t},e.addGroup=function(t){this._sharedBody.collisionFilterGroup|=t},e.removeGroup=function(t){this._sharedBody.collisionFilterGroup&=~t},e.getMask=function(){return this._sharedBody.collisionFilterMask},e.setMask=function(t){this._sharedBody.collisionFilterMask=t},e.addMask=function(t){this._sharedBody.collisionFilterMask|=t},e.removeMask=function(t){this._sharedBody.collisionFilterMask&=~t},e.setCompound=function(t){this._compound&&q8.CompoundShape_removeChildShape(this._compound,this._impl),t&&q8.CompoundShape_addChildShape(t,this.transform,this._impl),this._compound=t},e.updateScale=function(){this.setCenter(this._collider.center)},e.updateCompoundTransform=function(){this._compound?q8.CompoundShape_updateChildTransform(this._compound,this._impl,this.transform,!0):this._isEnabled&&!this._isTrigger&&this._sharedBody&&!this._sharedBody.bodyStruct.useCompound&&(this._sharedBody.dirty|=ast.BODY_RE_ADD)},e.needCompound=function(){return this._collider.type===S8.TERRAIN||!this._collider.center.equals(_n.ZERO)},n(t,[{key:"attachedRigidBody",get:function(){return this._sharedBody.wrappedBody?this._sharedBody.wrappedBody.rigidBody:null}},{key:"impl",get:function(){return this._impl}},{key:"collider",get:function(){return this._collider}},{key:"sharedBody",get:function(){return this._sharedBody}}]),t}();Ast.TYPE="shape",Ast.idCounter=0;var bst=function(){function t(){this.matrix=[]}var e=t.prototype;return e.get=function(t,e){if(e>t){var i=e;e=t,t=i}return this.matrix[(t*(t+1)>>1)+e-1]},e.set=function(t,e,i){if(e>t){var n=e;e=t,t=n}this.matrix[(t*(t+1)>>1)+e-1]=i?1:0},e.reset=function(){this.matrix.length=0},e.setNumObjects=function(t){this.matrix.length=t*(t-1)>>1},t}(),Cst=function(){function t(){this.data=void 0,this.data={keys:[]}}var e=t.prototype;return e.get=function(t,e){if(t>e){var i=e;e=t,t=i}return this.data[t+"-"+e]},e.set=function(t,e,i){if(t>e){var n=e;e=t,t=n}var r=t+"-"+e;if(null==i){var s=this.data.keys.indexOf(r);if(-1!==s)return this.data.keys.splice(s,1),delete this.data[r],i}return this.get(t,e)||this.data.keys.push(r),this.data[r]=i,this.data[r]},e.reset=function(){this.data={keys:[]}},e.getLength=function(){return this.data.keys.length},e.getKeyByIndex=function(t){return this.data.keys[t]},e.getDataByKey=function(t){return this.data[t]},t}(),Rst=function(){function t(t){this.impl=0,this.event=void 0,this.event=t}var e=t.prototype;return e.getLocalPointOnA=function(t){this.impl&&E7(t,q8.ManifoldPoint_get_m_localPointA(this.impl))},e.getLocalPointOnB=function(t){this.impl&&E7(t,q8.ManifoldPoint_get_m_localPointB(this.impl))},e.getWorldPointOnA=function(t){this.impl&&E7(t,q8.ManifoldPoint_get_m_positionWorldOnA(this.impl))},e.getWorldPointOnB=function(t){this.impl&&E7(t,q8.ManifoldPoint_get_m_positionWorldOnB(this.impl))},e.getLocalNormalOnA=function(t){if(this.impl){var e=t7.instance.BT_QUAT_0,i=q8.PersistentManifold_getBody0(this.event.impl),n=q8.CollisionObject_getWorldTransform(i);q8.Transform_getRotation(n,e);var r=r7;A7(r,e),Rn.conjugate(r,r),E7(t,q8.ManifoldPoint_get_m_normalWorldOnB(this.impl)),this.isBodyA||_n.negate(t,t),_n.transformQuat(t,t,r)}},e.getLocalNormalOnB=function(t){if(this.impl){var e=t7.instance.BT_QUAT_0,i=q8.PersistentManifold_getBody1(this.event.impl),n=q8.CollisionObject_getWorldTransform(i);q8.Transform_getRotation(n,e);var r=r7;A7(r,e),Rn.conjugate(r,r),E7(t,q8.ManifoldPoint_get_m_normalWorldOnB(this.impl)),_n.transformQuat(t,t,r)}},e.getWorldNormalOnA=function(t){this.impl&&(E7(t,q8.ManifoldPoint_get_m_normalWorldOnB(this.impl)),this.isBodyA||_n.negate(t,t))},e.getWorldNormalOnB=function(t){this.impl&&E7(t,q8.ManifoldPoint_get_m_normalWorldOnB(this.impl))},n(t,[{key:"isBodyA",get:function(){return this.event.selfCollider.shape.sharedBody.body===q8.PersistentManifold_getBody0(this.event.impl)}}]),t}(),wst=[],Ist=e7,xst=i7,Dst=n7,Ost=y7,Pst=new ost,Mst=function(){var t=e.prototype;function e(){this._world=void 0,this._broadphase=void 0,this._solver=void 0,this._dispatcher=void 0,this._debugDraw=void 0,this._debugLineCount=0,this._MAX_DEBUG_LINE_COUNT=16384,this._debugDrawFlags=I8.NONE,this._debugConstraintSize=.3,this._needEmitEvents=!1,this._needSyncAfterEvents=!1,this._needEmitCCTEvents=!1,this.bodies=[],this.ghosts=[],this.ccts=[],this.constraints=[],this.triggerArrayMat=new bst,this.collisionArrayMat=new bst,this.contactsDic=new Cst,this.oldContactsDic=new Cst,this.cctShapeEventDic=new Cst,this.cctContactsDic=new Cst,this.cctOldContactsDic=new Cst,Q8.CACHE.world=this,this._broadphase=q8.DbvtBroadphase_new(),this._dispatcher=q8.CollisionDispatcher_new(),this._solver=q8.SequentialImpulseConstraintSolver_new(),this._world=q8.ccDiscreteDynamicsWorld_new(this._dispatcher,this._broadphase,this._solver);var t=q8.DebugDraw.implement(gst);this._debugDraw=t.$$.ptr,q8.CollisionWorld_setDebugDrawer(this._world,this._debugDraw),q8.DebugDraw_setDebugMode(this._debugDraw,j8.DBG_NoDebug),q8.DebugDraw_setAABBColor(this._debugDraw,0,1,1),q8.DebugDraw_setActiveObjectColor(this._debugDraw,1,0,1),q8.DebugDraw_setDeactiveObjectColor(this._debugDraw,1,0,1),q8.DebugDraw_setWantsDeactivationObjectColor(this._debugDraw,1,0,1),q8.DebugDraw_setDisabledDeactivationObjectColor(this._debugDraw,1,0,1),q8.DebugDraw_setDisabledSimulationObjectColor(this._debugDraw,1,0,1),q8.DebugDraw_setConstraintLimitColor(this._debugDraw,.5,.5,.5)}return t.setDefaultMaterial=function(){},t.setAllowSleep=function(t){q8.ccDiscreteDynamicsWorld_setAllowSleep(this._world,t)},t.setGravity=function(t){q8.DynamicsWorld_setGravity(this._world,T7(t7.instance.BT_V3_0,t))},t.updateNeedEmitEvents=function(t){if(this.ghosts)if(t)this._needEmitEvents=!0;else{this._needEmitEvents=!1;for(var e=0;e=0;t--){var e=this.ghosts[t];e.updateDirty(),e.syncSceneToGhost()}for(var i=this.bodies.length-1;i>=0;i--){var n=this.bodies[i];n.updateDirty(),n.syncSceneToPhysics()}for(var r=this.ccts,s=r.length-1;s>=0;s--){var o=r[s];o.updateDirty(),o.syncSceneToPhysics()}},t.syncAfterEvents=function(){this._needSyncAfterEvents&&this.syncSceneToPhysics()},t.raycast=function(t,e,i,n){t.computeHit(Ist,e.maxDistance);var r=T7(t7.instance.BT_V3_0,Ist),s=T7(t7.instance.BT_V3_1,t.o),o=q8.ccAllRayCallback_static();if(q8.ccAllRayCallback_reset(o,s,r,e.mask>>>0,e.queryTrigger),q8.ccAllRayCallback_setFlags(o,X8.UseSubSimplexConvexCastRaytest),q8.CollisionWorld_rayTest(this._world,s,r,o),q8.RayCallback_hasHit(o)){for(var a=q8.ccAllRayCallback_getHitPointWorld(o),h=q8.ccAllRayCallback_getHitNormalWorld(o),u=q8.ccAllRayCallback_getCollisionShapePtrs(o),c=0,l=q8.int_array_size(u);c>>0,e.queryTrigger),q8.ccClosestRayCallback_setFlags(s,X8.UseSubSimplexConvexCastRaytest),q8.CollisionWorld_rayTest(this._world,r,n,s),q8.RayCallback_hasHit(s)){E7(Ist,q8.ccClosestRayCallback_getHitPointWorld(s)),E7(xst,q8.ccClosestRayCallback_getHitNormalWorld(s));var o=t7.getWrapper(q8.ccClosestRayCallback_getCollisionShapePtr(s),Ast.TYPE);return i._assign(Ist,_n.distance(t.o,Ist),o.collider,xst),!0}return!1},t.sweepBox=function(t,i,n,r,s,o){var a=t7.instance.BT_V3_0;return T7(a,i),e._sweepBoxGeometry||(e._sweepBoxGeometry=q8.BoxShape_new(a)),q8.BoxShape_setUnscaledHalfExtents(e._sweepBoxGeometry,a),this.sweep(t,e._sweepBoxGeometry,n,r,s,o)},t.sweepBoxClosest=function(t,i,n,r,s){var o=t7.instance.BT_V3_0;return T7(o,i),e._sweepBoxGeometry||(e._sweepBoxGeometry=q8.BoxShape_new(o)),q8.BoxShape_setUnscaledHalfExtents(e._sweepBoxGeometry,o),this.sweepClosest(t,e._sweepBoxGeometry,n,r,s)},t.sweepSphere=function(t,i,n,r,s){return e._sweepSphereGeometry||(e._sweepSphereGeometry=q8.SphereShape_new(i)),q8.SphereShape_setUnscaledRadius(e._sweepSphereGeometry,i),this.sweep(t,e._sweepSphereGeometry,Rn.IDENTITY,n,r,s)},t.sweepSphereClosest=function(t,i,n,r){return e._sweepSphereGeometry||(e._sweepSphereGeometry=q8.SphereShape_new(i)),q8.SphereShape_setUnscaledRadius(e._sweepSphereGeometry,i),this.sweepClosest(t,e._sweepSphereGeometry,Rn.IDENTITY,n,r)},t.sweepCapsule=function(t,i,n,r,s,o,a){return e._sweepCapsuleGeometry||(e._sweepCapsuleGeometry=q8.CapsuleShape_new(i,n)),q8.CapsuleShape_updateProp(e._sweepCapsuleGeometry,i,.5*n,1),this.sweep(t,e._sweepCapsuleGeometry,r,s,o,a)},t.sweepCapsuleClosest=function(t,i,n,r,s,o){return e._sweepCapsuleGeometry||(e._sweepCapsuleGeometry=q8.CapsuleShape_new(i,n)),q8.CapsuleShape_updateProp(e._sweepCapsuleGeometry,i,.5*n,1),this.sweepClosest(t,e._sweepCapsuleGeometry,r,s,o)},t.sweep=function(t,e,i,n,r,s){var o=t7.instance.BT_TRANSFORM_0,a=t7.instance.BT_TRANSFORM_1,h=t7.instance.BT_QUAT_0;T7(q8.Transform_getOrigin(o),t.o),S7(h,i),q8.Transform_setRotation(o,h),t.computeHit(Ist,n.maxDistance),T7(q8.Transform_getOrigin(a),Ist),S7(h,i),q8.Transform_setRotation(a,h);var u=q8.ccAllConvexCallback_static();if(q8.ccAllConvexCallback_reset(u,o,a,n.mask>>>0,n.queryTrigger),q8.CollisionWorld_convexSweepTest(this._world,e,o,a,u,0),q8.ConvexCallback_hasHit(u)){for(var c=q8.ccAllConvexCallback_getHitPointWorld(u),l=q8.ccAllConvexCallback_getHitNormalWorld(u),_=q8.ccAllConvexCallback_getCollisionShapePtrs(u),d=0,f=q8.int_array_size(_);d>>0,n.queryTrigger),q8.CollisionWorld_convexSweepTest(this._world,e,s,o,h,0),q8.ConvexCallback_hasHit(h)){E7(Ist,q8.ccClosestConvexCallback_getHitPointWorld(h)),E7(xst,q8.ccClosestConvexCallback_getHitNormalWorld(h));var u=t7.getWrapper(q8.ccClosestConvexCallback_getCollisionShapePtr(h),Ast.TYPE);return r._assign(Ist,_n.distance(t.o,Ist),u.collider,xst),!0}return!1},t.getSharedBody=function(t,e){return Tst.getSharedBody(t,this,e)},t.addSharedBody=function(t){if(this.bodies.indexOf(t)<0){this.bodies.push(t);var e=t.collisionFilterGroup,i=t.collisionFilterMask;q8.DynamicsWorld_addRigidBody(this._world,t.body,e>>>0,i>>>0)}},t.removeSharedBody=function(t){var e=this.bodies.indexOf(t);e>=0&&(he(this.bodies,e),q8.DynamicsWorld_removeRigidBody(this._world,t.body))},t.addGhostObject=function(t){if(this.ghosts.indexOf(t)<0){this.ghosts.push(t);var e=t.collisionFilterGroup,i=t.collisionFilterMask;q8.CollisionWorld_addCollisionObject(this._world,t.ghost,e>>>0,i>>>0)}},t.removeGhostObject=function(t){var e=this.ghosts.indexOf(t);e>=0&&(he(this.ghosts,e),q8.CollisionWorld_removeCollisionObject(this._world,t.ghost))},t.addCCT=function(t){if(this.ccts.indexOf(t)<0){this.ccts.push(t);var e=q8.CharacterController_getGhostObject(t.impl),i=t.getGroup(),n=t.getMask();q8.CollisionWorld_addCollisionObject(this._world,e,i>>>0,n>>>0),q8.DynamicsWorld_addAction(this._world,t.impl)}},t.removeCCT=function(t){var e=this.ccts.indexOf(t);if(e>=0){he(this.ccts,e);var i=q8.CharacterController_getGhostObject(t.impl);q8.CollisionWorld_removeCollisionObject(this._world,i),q8.DynamicsWorld_removeAction(this._world,t.impl)}},t.addConstraint=function(t){var e=this.constraints.indexOf(t);e<0&&(this.constraints.push(t),q8.DynamicsWorld_addConstraint(this.impl,t.impl,!t.constraint.enableCollision),t.index=e)},t.removeConstraint=function(t){var e=this.constraints.indexOf(t);e>=0&&(this.constraints.splice(e,1),q8.DynamicsWorld_removeConstraint(this.impl,t.impl),t.index=-1)},t.emitEvents=function(){this._needSyncAfterEvents=!1,this._needEmitEvents&&(this.gatherConatactData(),this.emitCollisionAndTriggerEvent(),this.emitCCTTriggerEvent()),this._needEmitCCTEvents&&this.emitCCTCollisionEvent()},t.emitCollisionAndTriggerEvent=function(){for(var t=this.contactsDic.getLength();t--;){wst.push.apply(wst,J8.contacts),J8.contacts.length=0;var e=this.contactsDic.getKeyByIndex(t),i=this.contactsDic.getDataByKey(e),n=i.shape0,r=i.shape1;this.oldContactsDic.set(n.id,r.id,i);var s=n.collider,o=r.collider;if(s&&o){if(s.isTrigger||o.isTrigger)this.triggerArrayMat.get(n.id,r.id)?Z8.type="onTriggerStay":(Z8.type="onTriggerEnter",this.triggerArrayMat.set(n.id,r.id,!0)),Z8.impl=i.impl,Z8.selfCollider=s,Z8.otherCollider=o,s.emit(Z8.type,Z8),Z8.selfCollider=o,Z8.otherCollider=s,o.emit(Z8.type,Z8),this._needSyncAfterEvents=!0;else{var a=s.attachedRigidBody,h=o.attachedRigidBody;if(a&&h){if(a.isSleeping&&h.isSleeping)continue}else if(!a&&h){if(h.isSleeping)continue}else if(!h&&a&&a.isSleeping)continue;this.collisionArrayMat.get(n.id,r.id)?J8.type="onCollisionStay":(J8.type="onCollisionEnter",this.collisionArrayMat.set(n.id,r.id,!0));for(var u=0;u0){var l=wst.pop();l.impl=c,J8.contacts.push(l)}else{var _=new Rst(J8);_.impl=c,J8.contacts.push(_)}}J8.impl=i.impl,J8.selfCollider=s,J8.otherCollider=o,s.emit(J8.type,J8),J8.selfCollider=o,J8.otherCollider=s,o.emit(J8.type,J8),this._needSyncAfterEvents=!0}null==this.oldContactsDic.get(n.id,r.id)&&this.oldContactsDic.set(n.id,r.id,i)}}for(var d=this.oldContactsDic.getLength();d--;){var f=this.oldContactsDic.getKeyByIndex(d),p=this.oldContactsDic.getDataByKey(f),g=p.shape0,m=p.shape1,v=g.collider,y=m.collider;if(v&&y){var T=v.isTrigger||y.isTrigger;null==this.contactsDic.getDataByKey(f)&&(T?this.triggerArrayMat.get(g.id,m.id)&&(Z8.type="onTriggerExit",Z8.selfCollider=v,Z8.otherCollider=y,v.emit(Z8.type,Z8),Z8.selfCollider=y,Z8.otherCollider=v,y.emit(Z8.type,Z8),this.triggerArrayMat.set(g.id,m.id,!1),this.oldContactsDic.set(g.id,m.id,null),this._needSyncAfterEvents=!0):this.collisionArrayMat.get(g.id,m.id)&&(wst.push.apply(wst,J8.contacts),J8.contacts.length=0,J8.type="onCollisionExit",J8.selfCollider=v,J8.otherCollider=y,v.emit(J8.type,J8),J8.selfCollider=y,J8.otherCollider=v,y.emit(J8.type,J8),this.collisionArrayMat.set(g.id,m.id,!1),this.oldContactsDic.set(g.id,m.id,null),this._needSyncAfterEvents=!0))}}this.contactsDic.reset()},t.emitCCTTriggerEvent=function(){for(var t=this.cctContactsDic.getLength();t--;){var e=this.cctContactsDic.getKeyByIndex(t),i=this.cctContactsDic.getDataByKey(e),n=i.shape,r=i.cct;this.cctOldContactsDic.set(n.id,r.id,i);var s=n.collider,o=r.characterController;s&&o&&(s.isTrigger&&(this.triggerArrayMat.get(n.id,r.id)?$8.type="onControllerTriggerStay":($8.type="onControllerTriggerEnter",this.triggerArrayMat.set(n.id,r.id,!0)),$8.impl=i.impl,$8.collider=s,$8.characterController=o,s.emit($8.type,$8),$8.collider=s,$8.characterController=o,o.emit($8.type,$8),this._needSyncAfterEvents=!0),null==this.cctOldContactsDic.get(n.id,r.id)&&this.cctOldContactsDic.set(n.id,r.id,i))}for(var a=this.cctOldContactsDic.getLength();a--;){var h=this.cctOldContactsDic.getKeyByIndex(a),u=this.cctOldContactsDic.getDataByKey(h),c=u.shape,l=u.cct,_=c.collider,d=l.characterController;if(_&&d){var f=_.isTrigger;null==this.cctContactsDic.getDataByKey(h)&&f&&this.triggerArrayMat.get(c.id,l.id)&&($8.type="onControllerTriggerExit",$8.collider=_,$8.characterController=d,_.emit($8.type,$8),$8.collider=_,$8.characterController=d,d.emit($8.type,$8),this.triggerArrayMat.set(c.id,l.id,!1),this.cctOldContactsDic.set(c.id,l.id,null),this._needSyncAfterEvents=!0)}}this.cctContactsDic.reset()},t.emitCCTCollisionEvent=function(){for(var t=this.cctShapeEventDic.getLength();t--;){var e,i=this.cctShapeEventDic.getKeyByIndex(t),n=this.cctShapeEventDic.getDataByKey(i),r=n.BulletCharacterController,s=n.BulletShape,o=n.worldPos,a=n.worldNormal,h=n.motionDir,u=n.motionLength;Pst.controller=r.characterController,Pst.collider=s.collider,Pst.worldPosition.set(o.x,o.y,o.z),Pst.worldNormal.set(a.x,a.y,a.z),Pst.motionDirection.set(h.x,h.y,h.z),Pst.motionLength=u,null===(e=Pst.controller)||void 0===e||e.emit("onControllerColliderHit",Pst),this._needSyncAfterEvents=!0}this.cctShapeEventDic.reset()},t.gatherConatactData=function(){for(var t=q8.Dispatcher_getNumManifolds(this._dispatcher),e=0;e0){if(this.collider.convex){var i=this._getBtTriangleMesh(e);this._impl=q8.ConvexTriangleMeshShape_new(i)}else this.btBVHMeshShape=Fst.getBulletBvhTriangleMeshShape(e.hash,e),this._impl=q8.ScaledBvhTriangleMeshShape_new(this.btBVHMeshShape.bulletBvhTriangleMeshShapePtr,1,1,1);var n=t7.instance.BT_V3_0;T7(n,this._collider.node.worldScale),q8.CollisionShape_setLocalScaling(this._impl,n),q8.CollisionShape_setMargin(this._impl,.01),this.setCompound(this._compound),this.updateByReAdd(),this.setWrapper()}else this._impl=q8.EmptyShape_static()}},i.onComponentSet=function(){this.setMesh(this.collider.mesh)},i.onDestroy=function(){this.collider.convex?this.refBtTriangleMesh&&q8._safe_delete(this.refBtTriangleMesh,W8.EBulletTypeTriangleMesh):this.btBVHMeshShape&&(this.btBVHMeshShape.reference=!1),t.prototype.onDestroy.call(this)},i.updateScale=function(){t.prototype.updateScale.call(this);var e=t7.instance.BT_V3_0;T7(e,this._collider.node.worldScale),q8.CollisionShape_setLocalScaling(this._impl,e),this.updateCompoundTransform()},i._getBtTriangleMesh=function(t){return this.refBtTriangleMesh=q8.TriangleMesh_new(),b7(this.refBtTriangleMesh,t),this.refBtTriangleMesh},n(e,[{key:"collider",get:function(){return this._collider}}]),e}(Ast),Hst=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.setHeight=function(){this.updateProperties(this.collider.radius,this.collider.height,this.collider.direction,this._collider.node.worldScale)},i.setDirection=function(){this.updateProperties(this.collider.radius,this.collider.height,this.collider.direction,this._collider.node.worldScale)},i.setRadius=function(){this.updateProperties(this.collider.radius,this.collider.height,this.collider.direction,this._collider.node.worldScale)},i.onComponentSet=function(){var t=t7.instance.BT_V3_0;q8.Vec3_set(t,.5,1,.5),this._impl=q8.CylinderShape_new(t),this.setRadius(this.collider.radius)},i.updateScale=function(){t.prototype.updateScale.call(this),this.setRadius(this.collider.radius)},i.updateProperties=function(t,e,i,n){var r,s,o=n,a=i;1===a?(s=e*Math.abs(o.y),r=t*Math.abs(qi(o.x,o.z))):0===a?(s=e*Math.abs(o.x),r=t*Math.abs(qi(o.y,o.z))):(s=e*Math.abs(o.z),r=t*Math.abs(qi(o.x,o.y))),q8.CylinderShape_updateProp(this._impl,r,s/2,a),this.updateCompoundTransform()},n(e,[{key:"collider",get:function(){return this._collider}}]),e}(Ast),zst=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.setHeight=function(){this.updateProperties(this.collider.radius,this.collider.height,this.collider.direction,this._collider.node.worldScale)},i.setDirection=function(){this.updateProperties(this.collider.radius,this.collider.height,this.collider.direction,this._collider.node.worldScale)},i.setRadius=function(){this.updateProperties(this.collider.radius,this.collider.height,this.collider.direction,this._collider.node.worldScale)},i.onComponentSet=function(){this._impl=q8.ConeShape_new(.5,1),this.setRadius(this.collider.radius)},i.updateScale=function(){t.prototype.updateScale.call(this),this.setRadius(this.collider.radius)},i.updateProperties=function(t,e,i,n){var r,s,o=n,a=i;1===a?(s=e*Math.abs(o.y),r=t*Math.abs(qi(o.x,o.z))):0===a?(s=e*Math.abs(o.x),r=t*Math.abs(qi(o.y,o.z))):(s=e*Math.abs(o.z),r=t*Math.abs(qi(o.x,o.y))),q8.ConeShape_setRadius(this._impl,r),q8.ConeShape_setHeight(this._impl,s),q8.ConeShape_setConeUpIndex(this._impl,a);var h=t7.instance.BT_V3_0;q8.Vec3_set(h,1,1,1),q8.CollisionShape_setLocalScaling(this._impl,h),this.updateCompoundTransform()},n(e,[{key:"impl",get:function(){return this._impl}},{key:"collider",get:function(){return this._collider}}]),e}(Ast),Vst=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;ru&&(s=u),u>o&&(o=u),r+=4}o+=.01,s-=.01,this._localOffset.set((i-1)/2*this._tileSize,(o+s)/2,(n-1)/2*this._tileSize),this._impl=q8.TerrainShape_new(i,n,this._bufPtr,1,s,o);var c=t7.instance.BT_V3_0;q8.Vec3_set(c,this._tileSize,1,this._tileSize),q8.CollisionShape_setLocalScaling(this._impl,c),this.setCompound(this._compound),this.updateByReAdd(),this.setWrapper()}else this._impl=q8.EmptyShape_static()}},i.onComponentSet=function(){this.setTerrain(this.collider.terrain)},i.onDestroy=function(){this._bufPtr&&q8._free(this._bufPtr),t.prototype.onDestroy.call(this)},i.setCenter=function(t){_n.copy(e7,t),e7.add(this._localOffset),T7(q8.Transform_getOrigin(this.transform),e7),this.updateCompoundTransform()},n(e,[{key:"collider",get:function(){return this._collider}}]),e}(Ast),Wst=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.setShapeType=function(){},i.setVertices=function(){},i.onComponentSet=function(){this._impl=q8.SimplexShape_new();for(var t=this.collider.shapeType,e=this.collider.vertices,i=t7.instance.BT_V3_0,n=0;n=0){var t=this._rigidBody.body.sharedBody;t.wrappedWorld.removeConstraint(this),t.wrappedWorld.addConstraint(this)}},e.initialize=function(t){this._com=t,this._rigidBody=t.attachedBody,this._connectedBody=t.connectedBody,this._collided=t.enableCollision,this.onComponentSet(),this.setEnableCollision(this._collided)},e.updateDebugDrawSize=function(){if(this.impl){var t=j7.instance.physicsWorld.debugDrawConstraintSize;q8.TypedConstraint_setDbgDrawSize(this.impl,t)}},e.onEnable=function(){var t=this._rigidBody.body.sharedBody;t.wrappedWorld.addConstraint(this),t.addJoint(this,0);var e=this._connectedBody;e&&e.body.sharedBody.addJoint(this,1)},e.onDisable=function(){var t=this._rigidBody.body.sharedBody;t.wrappedWorld.removeConstraint(this),t.removeJoint(this,0);var e=this._connectedBody;e&&e.body.sharedBody.removeJoint(this,1)},e.onDestroy=function(){q8._safe_delete(this._impl,W8.EBulletTypeTypedConstraint),this._com=null,this._rigidBody=null,this._connectedBody=null},n(t,[{key:"impl",get:function(){return this._impl}},{key:"constraint",get:function(){return this._com}}]),t}(),Yst=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.setPivotA=function(){var t=this.constraint,e=t7.instance.BT_V3_0;_n.multiply(e7,t.node.worldScale,t.pivotA),T7(e,e7),q8.P2PConstraint_setPivotA(this._impl,e),t.connectedBody||this.setPivotB(t.pivotB)},i.setPivotB=function(){var t=this.constraint,e=this._rigidBody.node,i=t7.instance.BT_V3_0,n=t.connectedBody;n?(_n.multiply(e7,n.node.worldScale,t.pivotB),T7(i,e7)):(_n.multiply(e7,e.worldScale,t.pivotA),_n.transformQuat(e7,e7,e.worldRotation),_n.add(e7,e7,e.worldPosition),T7(i,e7)),q8.P2PConstraint_setPivotB(this._impl,i)},i.onComponentSet=function(){var t=this.constraint.connectedBody,e=this._rigidBody.body.impl,i=t?t.body.impl:q8.TypedConstraint_getFixedBody(),n=t7.instance.BT_V3_0,r=t7.instance.BT_V3_1;this._impl=q8.P2PConstraint_new(e,i,n,r),this.setPivotA(this.constraint.pivotA),this.setPivotB(this.constraint.pivotB),this.updateDebugDrawSize()},i.updateScale0=function(){this.setPivotA(this.constraint.pivotA)},i.updateScale1=function(){this.setPivotB(this.constraint.pivotB)},n(e,[{key:"constraint",get:function(){return this._com}}]),e}(jst),Kst=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.setBreakForce=function(t){q8.TypedConstraint_setMaxImpulseThreshold(this._impl,t)},i.setBreakTorque=function(){},i.onComponentSet=function(){var t=this.constraint.connectedBody,e=this._rigidBody.body.impl,i=t?t.body.impl:q8.TypedConstraint_getFixedBody(),n=t7.instance.BT_TRANSFORM_0,r=t7.instance.BT_TRANSFORM_1;this._impl=q8.FixedConstraint_new(e,i,n,r),this.setBreakForce(this.constraint.breakForce),this.setBreakTorque(this.constraint.breakTorque),this.updateFrames(),this.updateDebugDrawSize()},i.updateFrames=function(){var t=this.constraint.connectedBody,e=this._rigidBody.body.sharedBody,i=e7,n=r7,r=t7.instance.BT_TRANSFORM_0,s=t7.instance.BT_TRANSFORM_1,o=t7.instance.BT_QUAT_0,a=o7;if(Ln.fromRT(a,e.node.worldRotation,e.node.worldPosition),Ln.invert(a,a),Ln.getRotation(n,a),Ln.getTranslation(i,a),T7(q8.Transform_getOrigin(r),i),S7(o,n),q8.Transform_setRotation(r,o),t){var h=t.body.sharedBody;Ln.fromRT(a,h.node.worldRotation,h.node.worldPosition),Ln.invert(a,a),Ln.getRotation(n,a),Ln.getTranslation(i,a),T7(q8.Transform_getOrigin(s),i),S7(o,n),q8.Transform_setRotation(s,o)}else q8.Transform_setIdentity(s);q8.FixedConstraint_setFrames(this._impl,r,s)},i.updateScale0=function(){this.updateFrames()},i.updateScale1=function(){this.updateFrames()},n(e,[{key:"constraint",get:function(){return this._com}}]),e}(jst),qst=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.setPivotA=function(){this.updateFrames()},i.setPivotB=function(){this.updateFrames()},i.setAxis=function(){this.updateFrames()},i.setLimitEnabled=function(){this.constraint.limitEnabled?q8.HingeConstraint_setLimit(this._impl,Li(this.constraint.lowerLimit),Li(this.constraint.upperLimit),.9,.3,1):q8.HingeConstraint_setLimit(this._impl,1,0,.9,.3,1)},i.setLowerLimit=function(){this.constraint.limitEnabled&&q8.HingeConstraint_setLimit(this._impl,Li(this.constraint.lowerLimit),Li(this.constraint.upperLimit),.9,.3,1)},i.setUpperLimit=function(){this.constraint.limitEnabled&&q8.HingeConstraint_setLimit(this._impl,Li(this.constraint.lowerLimit),Li(this.constraint.upperLimit),.9,.3,1)},i.setMotorEnabled=function(t){q8.HingeConstraint_enableMotor(this._impl,t);var e=-this.constraint.motorVelocity/60,i=C7(this.constraint.motorForceLimit,j7.instance.fixedTimeStep);q8.HingeConstraint_setMotorVelocity(this._impl,e),q8.HingeConstraint_setMaxMotorImpulse(this._impl,i)},i.setMotorVelocity=function(t){if(this.constraint.motorEnabled){var e=-t/60;q8.HingeConstraint_setMotorVelocity(this._impl,e)}},i.setMotorForceLimit=function(t){if(this.constraint.motorEnabled){var e=C7(t,j7.instance.fixedTimeStep);q8.HingeConstraint_setMaxMotorImpulse(this._impl,e)}},i.onComponentSet=function(){var t=this.constraint.connectedBody,e=this._rigidBody.body.impl,i=t?t.body.impl:q8.TypedConstraint_getFixedBody(),n=t7.instance.BT_TRANSFORM_0,r=t7.instance.BT_TRANSFORM_1;this._impl=q8.HingeConstraint_new(e,i,n,r),this.setLimitEnabled(this.constraint.limitEnabled),this.setLowerLimit(this.constraint.lowerLimit),this.setUpperLimit(this.constraint.upperLimit),this.setMotorEnabled(this.constraint.motorEnabled),this.setMotorVelocity(this.constraint.motorVelocity),this.setMotorForceLimit(this.constraint.motorForceLimit),this.updateFrames(),this.updateDebugDrawSize()},i.updateFrames=function(){var t=this.constraint,e=t.node,i=e7,n=r7,r=s7,s=t7.instance.BT_TRANSFORM_0;_n.multiply(i,e.worldScale,t.pivotA),T7(q8.Transform_getOrigin(s),i);var o=t7.instance.BT_QUAT_0;_n.normalize(i,t.axis),Rn.rotationTo(r,_n.UNIT_Z,i),S7(o,r),q8.Transform_setRotation(s,o);var a=t7.instance.BT_TRANSFORM_1,h=this.constraint.connectedBody;h?(_n.multiply(i,h.node.worldScale,t.pivotB),Rn.multiply(r,e.worldRotation,r),Rn.invert(n,h.node.worldRotation),Rn.multiply(r,n,r)):(_n.multiply(i,e.worldScale,t.pivotA),_n.transformQuat(i,i,e.worldRotation),_n.add(i,i,e.worldPosition),Rn.multiply(r,e.worldRotation,r)),T7(q8.Transform_getOrigin(a),i),S7(o,r),q8.Transform_setRotation(a,o),q8.HingeConstraint_setFrames(this._impl,s,a)},i.updateScale0=function(){this.updateFrames()},i.updateScale1=function(){this.updateFrames()},n(e,[{key:"constraint",get:function(){return this._com}}]),e}(jst);!function(t){t[t.RO_XYZ=0]="RO_XYZ",t[t.RO_XZY=1]="RO_XZY",t[t.RO_YXZ=2]="RO_YXZ",t[t.RO_YZX=3]="RO_YZX",t[t.RO_ZXY=4]="RO_ZXY",t[t.RO_ZYX=5]="RO_ZYX"}(kst||(kst={})),function(t){t[t.X=0]="X",t[t.Y=1]="Y",t[t.Z=2]="Z",t[t.TWIST=3]="TWIST",t[t.SWING1=4]="SWING1",t[t.SWING2=5]="SWING2"}(Ust||(Ust={}));var Qst=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i._setLimit=function(t,e,i,n){switch(t){case b8.LOCKED:q8.Generic6DofSpring2Constraint_setLimit(this._impl,e,0,0);break;case b8.LIMITED:q8.Generic6DofSpring2Constraint_setLimit(this._impl,e,i,n);break;case b8.FREE:q8.Generic6DofSpring2Constraint_setLimit(this._impl,e,1,0)}},i.setConstraintMode=function(t,e){var i=this.constraint.linearLimitSettings,n=this.constraint.angularLimitSettings,r=[0,0,0],s=[0,0,0],o=0,a=0;switch(t){case 0:case 1:case 2:_n.toArray(r,i.lower),_n.toArray(s,i.upper),a=r[t],o=s[t];break;case 3:a=-(o=.5*Li(n.twistExtent));break;case 4:a=-(o=.5*Li(n.swingExtent1));break;case 5:a=-(o=.5*Li(n.swingExtent2));break;default:k("idx should be in [0, 5], but give "+t)}this._setLimit(e,t,a,o)},i.setLinearLimit=function(t,e,i){var n=0,r=this.constraint.linearLimitSettings;switch(t){case 0:n=r.xMotion;break;case 1:n=r.yMotion;break;case 2:n=r.zMotion}this._setLimit(n,t,e,i)},i.setAngularExtent=function(t,e,i){var n=this.constraint.angularLimitSettings;this._setLimit(n.twistMotion,Ust.TWIST,.5*-Li(t),.5*Li(t)),this._setLimit(n.swingMotion1,Ust.SWING1,.5*-Li(e),.5*Li(e)),this._setLimit(n.swingMotion2,Ust.SWING2,.5*-Li(i),.5*Li(i))},i.setSwingSoftConstraint=function(t){q8.Generic6DofSpring2Constraint_enableSpring(this._impl,Ust.SWING1,t),q8.Generic6DofSpring2Constraint_enableSpring(this._impl,Ust.SWING2,t)},i.setTwistSoftConstraint=function(t){q8.Generic6DofSpring2Constraint_enableSpring(this._impl,Ust.TWIST,t)},i.setLinearSoftConstraint=function(t){q8.Generic6DofSpring2Constraint_enableSpring(this._impl,Ust.X,t),q8.Generic6DofSpring2Constraint_enableSpring(this._impl,Ust.Y,t),q8.Generic6DofSpring2Constraint_enableSpring(this._impl,Ust.Z,t)},i.setLinearStiffness=function(t){q8.Generic6DofSpring2Constraint_setStiffness(this._impl,Ust.X,t),q8.Generic6DofSpring2Constraint_setStiffness(this._impl,Ust.Y,t),q8.Generic6DofSpring2Constraint_setStiffness(this._impl,Ust.Z,t)},i.setLinearDamping=function(t){q8.Generic6DofSpring2Constraint_setDamping(this._impl,Ust.X,t),q8.Generic6DofSpring2Constraint_setDamping(this._impl,Ust.Y,t),q8.Generic6DofSpring2Constraint_setDamping(this._impl,Ust.Z,t)},i.setLinearRestitution=function(t){q8.Generic6DofSpring2Constraint_setBounce(this._impl,Ust.X,t),q8.Generic6DofSpring2Constraint_setBounce(this._impl,Ust.Y,t),q8.Generic6DofSpring2Constraint_setBounce(this._impl,Ust.Z,t)},i.setSwingStiffness=function(t){q8.Generic6DofSpring2Constraint_setStiffness(this._impl,Ust.SWING1,t),q8.Generic6DofSpring2Constraint_setStiffness(this._impl,Ust.SWING2,t)},i.setSwingDamping=function(t){q8.Generic6DofSpring2Constraint_setDamping(this._impl,Ust.SWING1,t),q8.Generic6DofSpring2Constraint_setDamping(this._impl,Ust.SWING2,t)},i.setSwingRestitution=function(t){q8.Generic6DofSpring2Constraint_setBounce(this._impl,Ust.SWING1,t),q8.Generic6DofSpring2Constraint_setBounce(this._impl,Ust.SWING2,t)},i.setTwistStiffness=function(t){q8.Generic6DofSpring2Constraint_setStiffness(this._impl,Ust.TWIST,t)},i.setTwistDamping=function(t){q8.Generic6DofSpring2Constraint_setDamping(this._impl,Ust.TWIST,t)},i.setTwistRestitution=function(t){q8.Generic6DofSpring2Constraint_setBounce(this._impl,Ust.TWIST,t)},i.setDriverMode=function(t,e){e===C8.DISABLED?q8.Generic6DofSpring2Constraint_enableMotor(this._impl,t,!1):e===C8.SERVO?(q8.Generic6DofSpring2Constraint_enableMotor(this._impl,t,!0),q8.Generic6DofSpring2Constraint_setServo(this._impl,t,!0)):e===C8.INDUCTION&&(q8.Generic6DofSpring2Constraint_enableMotor(this._impl,t,!0),q8.Generic6DofSpring2Constraint_setServo(this._impl,t,!1))},i._updateMotorTargetAndVelocity=function(t){var e=C8.DISABLED,i=0,n=0,r=0,s=this.constraint.linearDriverSettings,o=this.constraint.angularDriverSettings;switch(t){case 0:i=Ust.X,e=s.xDrive,n=s.targetPosition.x,r=-s.targetVelocity.x;break;case 1:i=Ust.Y,e=s.yDrive,n=s.targetPosition.y,r=-s.targetVelocity.y;break;case 2:i=Ust.Z,e=s.zDrive,n=s.targetPosition.z,r=-s.targetVelocity.z;break;case 3:i=Ust.TWIST,e=o.twistDrive,n=-Li(o.targetOrientation.x),r=-Li(o.targetVelocity.x);break;case 4:i=Ust.SWING1,e=o.swingDrive1,n=-Li(o.targetOrientation.y),r=-Li(o.targetVelocity.y);break;case 5:i=Ust.SWING2,e=o.swingDrive2,n=-Li(o.targetOrientation.z),r=-Li(o.targetVelocity.z)}var a=t>2?o.strength:s.strength;q8.Generic6DofSpring2Constraint_setServoTarget(this._impl,i,n),e===C8.SERVO?t>2?q8.Generic6DofSpring2Constraint_setTargetVelocity(this._impl,i,-n*a*.1):q8.Generic6DofSpring2Constraint_setTargetVelocity(this._impl,i,n*a*.1):e===C8.INDUCTION&&q8.Generic6DofSpring2Constraint_setTargetVelocity(this._impl,i,r)},i.setLinearMotorTarget=function(){this._updateMotorTargetAndVelocity(0),this._updateMotorTargetAndVelocity(1),this._updateMotorTargetAndVelocity(2)},i.setLinearMotorVelocity=function(){this._updateMotorTargetAndVelocity(0),this._updateMotorTargetAndVelocity(1),this._updateMotorTargetAndVelocity(2)},i.setLinearMotorForceLimit=function(t){q8.Generic6DofSpring2Constraint_setMaxMotorForce(this._impl,Ust.X,t),q8.Generic6DofSpring2Constraint_setMaxMotorForce(this._impl,Ust.Y,t),q8.Generic6DofSpring2Constraint_setMaxMotorForce(this._impl,Ust.Z,t)},i.setAngularMotorTarget=function(){this._updateMotorTargetAndVelocity(3),this._updateMotorTargetAndVelocity(4),this._updateMotorTargetAndVelocity(5)},i.setAngularMotorVelocity=function(){this._updateMotorTargetAndVelocity(3),this._updateMotorTargetAndVelocity(4),this._updateMotorTargetAndVelocity(5)},i.setAngularMotorForceLimit=function(t){q8.Generic6DofSpring2Constraint_setMaxMotorForce(this._impl,Ust.TWIST,t),q8.Generic6DofSpring2Constraint_setMaxMotorForce(this._impl,Ust.SWING1,t),q8.Generic6DofSpring2Constraint_setMaxMotorForce(this._impl,Ust.SWING2,t)},i.setPivotA=function(){this.updateFrames()},i.setPivotB=function(){this.updateFrames()},i.setAutoPivotB=function(){this.updateFrames()},i.setAxis=function(){this.updateFrames()},i.setSecondaryAxis=function(){this.updateFrames()},i.setBreakForce=function(){var t=C7(Math.max(this.constraint.breakForce,this.constraint.breakTorque),j7.instance.fixedTimeStep);q8.TypedConstraint_setMaxImpulseThreshold(this._impl,t)},i.setBreakTorque=function(){var t=C7(Math.max(this.constraint.breakForce,this.constraint.breakTorque),j7.instance.fixedTimeStep);q8.TypedConstraint_setMaxImpulseThreshold(this._impl,t)},i.onComponentSet=function(){var t=this.constraint.connectedBody,e=this._rigidBody.body.impl,i=t&&t.body.impl||q8.TypedConstraint_getFixedBody(),n=t7.instance.BT_TRANSFORM_0,r=t7.instance.BT_TRANSFORM_1;this._impl=q8.Generic6DofSpring2Constraint_new(e,i,n,r,kst.RO_YZX);var s=this.constraint.linearLimitSettings,o=this.constraint.angularLimitSettings;this.setConstraintMode(0,s.xMotion),this.setConstraintMode(1,s.yMotion),this.setConstraintMode(2,s.zMotion),this.setConstraintMode(3,o.twistMotion),this.setConstraintMode(4,o.swingMotion1),this.setConstraintMode(5,o.swingMotion2),this.setLinearSoftConstraint(s.enableSoftConstraint),this.setLinearStiffness(s.stiffness),this.setLinearDamping(s.damping),this.setLinearRestitution(s.restitution),this.setSwingSoftConstraint(o.enableSoftConstraintSwing),this.setSwingRestitution(o.swingRestitution),this.setSwingStiffness(o.swingStiffness),this.setSwingDamping(o.swingDamping),this.setTwistSoftConstraint(o.enableSoftConstraintTwist),this.setTwistRestitution(o.twistRestitution),this.setTwistStiffness(o.twistStiffness),this.setTwistDamping(o.twistDamping);var a=this.constraint.linearDriverSettings,h=this.constraint.angularDriverSettings;this.setDriverMode(0,a.xDrive),this.setDriverMode(1,a.yDrive),this.setDriverMode(2,a.zDrive),this.setDriverMode(3,h.twistDrive),this.setDriverMode(4,h.swingDrive1),this.setDriverMode(5,h.swingDrive2),this.setLinearMotorTarget(a.targetPosition),this.setLinearMotorVelocity(a.targetVelocity),this.setLinearMotorForceLimit(a.strength),this.setAngularMotorTarget(h.targetOrientation),this.setAngularMotorVelocity(h.targetVelocity),this.setAngularMotorForceLimit(h.strength),this.setBreakForce(this.constraint.breakForce),this.setBreakTorque(this.constraint.breakTorque),this.updateFrames(),this.updateDebugDrawSize()},i.updateFrames=function(){var t=this.constraint,e=t.node,i=e7,n=r7,r=s7,s=t7.instance.BT_TRANSFORM_0;_n.multiply(i,e.worldScale,t.pivotA),T7(q8.Transform_getOrigin(s),i);var o=t7.instance.BT_QUAT_0,a=t.axis,h=t.secondaryAxis,u=_n.cross(i7,a,h);Ln.set(o7,a.x,a.y,a.z,0,h.x,h.y,h.z,0,u.x,u.y,u.z,0,0,0,0,1).getRotation(n),S7(o,n),q8.Transform_setRotation(s,o);var c=t7.instance.BT_TRANSFORM_1,l=this.constraint.connectedBody;l?(Rn.multiply(n,e.worldRotation,n),Rn.invert(r,l.node.worldRotation),Rn.multiply(n,r,n),t.autoPivotB?(_n.multiply(i,t.node.worldScale,t.pivotA),_n.transformQuat(i,i,e.worldRotation),_n.add(i,i,t.node.worldPosition),_n.subtract(i,i,l.node.worldPosition),_n.transformQuat(i,i,r)):_n.multiply(i,l.node.worldScale,t.pivotB)):(_n.multiply(i,e.worldScale,t.pivotA),_n.transformQuat(i,i,e.worldRotation),_n.add(i,i,e.worldPosition),Rn.multiply(n,e.worldRotation,n)),T7(q8.Transform_getOrigin(c),i),S7(o,n),q8.Transform_setRotation(c,o),q8.Generic6DofSpring2Constraint_setFrames(this._impl,s,c)},i.updateScale0=function(){this.updateFrames()},i.updateScale1=function(){this.updateFrames()},n(e,[{key:"constraint",get:function(){return this._com}}]),e}(jst),Zst=new _n(0,0,0),Jst=new _n(0,0,0);new _n(0,0,0);var $st=function(){function t(){this.wrappedWorld=void 0,this._isEnabled=!1,this._impl=0,this._comp=null,this._btCollisionFlags=0,this._word3=0,this._dirty=!1,this._collisionFilterGroup=w8.DEFAULT,this._collisionFilterMask=-1,this.id=t.idCounter++,this.wrappedWorld=j7.instance.physicsWorld}var e=t.prototype;return e.onComponentSet=function(){},e.updateScale=function(){},e.initialize=function(t){this._comp=t;var e=this._comp.group,i=j7.instance.collisionMatrix[e];return this._collisionFilterGroup=e,this._collisionFilterMask=i,this.onComponentSet(),0!==this._impl||(k("[Physics]: Initialize BulletCharacterController failed"),!1)},e.setWrapper=function(){t7.setWrapper(this._impl,Q8.CCT_CACHE_NAME,this);var t=q8.CharacterController_getCollisionShape(this.impl);t7.setWrapper(t,Q8.CCT_CACHE_NAME,this)},e.onEnable=function(){this._isEnabled=!0,this._impl||this.onComponentSet(),this.setDetectCollisions(!1),this.setOverlapRecovery(!0),j7.instance.physicsWorld.addCCT(this),this.setWrapper()},e.onDisable=function(){this._isEnabled=!1,this.wrappedWorld.removeCCT(this),this.onDestroy()},e.onDestroy=function(){q8._safe_delete(this._impl,W8.EBulletTypeCharacterController),t7.delWrapper(this._impl,Q8.CCT_CACHE_NAME),this._impl=0},e.onLoad=function(){},e.getPosition=function(t){this._impl&&E7(t,q8.CharacterController_getPosition(this.impl))},e.setPosition=function(t){this._impl&&(T7(q8.CharacterController_getPosition(this.impl),t),this.syncPhysicsToScene())},e.setContactOffset=function(t){this._impl&&q8.CharacterController_setContactOffset(this._impl,t)},e.setStepOffset=function(t){this._impl&&q8.CharacterController_setStepOffset(this._impl,t)},e.setSlopeLimit=function(t){this._impl&&q8.CharacterController_setSlopeLimit(this._impl,ze(t))},e.setDetectCollisions=function(t){this._impl&&q8.CharacterController_setCollision(this.impl,t)},e.setOverlapRecovery=function(t){this._impl&&q8.CharacterController_setOverlapRecovery(this.impl,t)},e.onGround=function(){return(4&this._btCollisionFlags)>0},e.syncSceneToPhysics=function(){var t=this.characterController.node;t.hasChangedFlags&&(t.hasChangedFlags&Ig.SCALE&&this.syncScale(),t.hasChangedFlags&Ig.POSITION&&(_n.add(Zst,t.worldPosition,this.scaledCenter),this.setPosition(Zst)))},e.syncPhysicsToScene=function(){this.getPosition(Zst),Zst.subtract(this.scaledCenter),this._comp.node.setWorldPosition(Zst)},e.syncScale=function(){this.updateScale()},e.move=function(t,e,i){if(this._isEnabled){var n=t7.instance.BT_V3_0;q8.Vec3_set(n,t.x,t.y,t.z),this._btCollisionFlags=q8.CharacterController_move(this.impl,n,e,i)}},e.setGroup=function(t){t!==this._collisionFilterGroup&&(this._collisionFilterGroup=t,this._dirty=!0)},e.getGroup=function(){return this._collisionFilterGroup},e.addGroup=function(t){this._collisionFilterGroup|=t,this._dirty=!0},e.removeGroup=function(t){this._collisionFilterGroup&=~t,this._dirty=!0},e.setMask=function(t){t!==this._collisionFilterMask&&(this._collisionFilterMask=t,this._dirty=!0)},e.getMask=function(){return this._collisionFilterMask},e.addMask=function(t){this._collisionFilterMask|=t,this._dirty=!0},e.removeMask=function(t){this._collisionFilterMask&=~t,this._dirty=!0},e.updateEventListener=function(){this.wrappedWorld.updateNeedEmitCCTEvents(this.characterController.needCollisionEvent)},e.updateDirty=function(){this._dirty&&(j7.instance.physicsWorld.removeCCT(this),j7.instance.physicsWorld.addCCT(this),this._dirty=!1)},e.onShapeHitExt=function(t){var e=q8.ControllerShapeHit_getHitShape(t),i=j7.instance.physicsWorld;i.cctShapeEventDic.get(this.impl,e);var n=new _n;E7(n,q8.ControllerHit_getHitWorldPos(t));var r=new _n;E7(r,q8.ControllerHit_getHitWorldNormal(t));var s=new _n;E7(s,q8.ControllerHit_getHitMotionDir(t));var o=q8.ControllerHit_getHitMotionLength(t),a=t7.getWrapper(e,Ast.TYPE);a&&i.cctShapeEventDic.set(this.impl,e,{BulletCharacterController:this,BulletShape:a,worldPos:n,worldNormal:r,motionDir:s,motionLength:o})},n(t,[{key:"isEnabled",get:function(){return this._isEnabled}},{key:"impl",get:function(){return this._impl}},{key:"characterController",get:function(){return this._comp}},{key:"scaledCenter",get:function(){return _n.multiply(Jst,this._comp.center,this._comp.node.worldScale),Jst}}]),t}();$st.idCounter=0;var tot,eot,iot,not,rot,sot,oot,aot,hot=new _n(0,0,0),uot=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.onComponentSet=function(){this.component.node.getWorldPosition(hot),hot.add(this.scaledCenter);var t=t7.instance.BT_V3_0;q8.Vec3_set(t,hot.x,hot.y,hot.z);var e=_n.UNIT_Y,i=t7.instance.BT_V3_1;q8.Vec3_set(i,e.x,e.y,e.z);var n=q8.ControllerHitReport.implement(gst).$$.ptr,r=j7.instance.physicsWorld,s=q8.CapsuleCharacterControllerDesc_new(ze(this.component.slopeLimit),this.component.stepOffset,this.component.skinWidth,i,t,n,this.component.radius,this.component.height);this._impl=q8.CapsuleCharacterController_new(r.impl,s,0),this.updateScale()},i.setRadius=function(){this.updateScale()},i.setHeight=function(){this.updateScale()},i.updateScale=function(){this.updateGeometry()},i.updateGeometry=function(){var t=this.component.node.worldScale,e=this.component.radius*qi(t.x,t.z),i=this.component.height*Math.abs(t.y);q8.CapsuleCharacterController_setRadius(this.impl,e),q8.CapsuleCharacterController_setHeight(this.impl,i),this._dirty=!0},n(e,[{key:"component",get:function(){return this._comp}}]),e}($st),cot=new _n(0,0,0),lot=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.onComponentSet=function(){this.component.node.getWorldPosition(cot),cot.add(this.scaledCenter);var t=t7.instance.BT_V3_0;q8.Vec3_set(t,cot.x,cot.y,cot.z);var e=_n.UNIT_Y,i=t7.instance.BT_V3_1;q8.Vec3_set(i,e.x,e.y,e.z);var n=q8.ControllerHitReport.implement(gst).$$.ptr,r=j7.instance.physicsWorld,s=q8.BoxCharacterControllerDesc_new(ze(this.component.slopeLimit),this.component.stepOffset,this.component.skinWidth,i,t,n,this.component.halfHeight,this.component.halfSideExtent,this.component.halfForwardExtent);this._impl=q8.BoxCharacterController_new(r.impl,s,0),this.updateScale()},i.setHalfHeight=function(){this.updateScale()},i.setHalfSideExtent=function(){this.updateScale()},i.setHalfForwardExtent=function(){this.updateScale()},i.updateScale=function(){this.updateGeometry()},i.updateGeometry=function(){var t=this.component.node.worldScale;q8.BoxCharacterController_setHalfSideExtent(this.impl,this.component.halfSideExtent*t.x),q8.BoxCharacterController_setHalfHeight(this.impl,this.component.halfHeight*t.y),q8.BoxCharacterController_setHalfForwardExtent(this.impl,this.component.halfForwardExtent*t.z),this._dirty=!0},n(e,[{key:"component",get:function(){return this._comp}}]),e}($st);bO.once(AO.EVENT_PRE_SUBSYSTEM_INIT,(function(){N8.register("bullet",{PhysicsWorld:Mst,RigidBody:pst,BoxShape:Nst,SphereShape:Lst,CapsuleShape:Bst,TrimeshShape:Gst,CylinderShape:Hst,ConeShape:zst,TerrainShape:Vst,SimplexShape:Wst,PlaneShape:Xst,PointToPointConstraint:Yst,HingeConstraint:qst,FixedConstraint:Kst,ConfigurableConstraint:Qst,BoxCharacterController:lot,CapsuleCharacterController:uot})})),function(t){t[t.BOX=0]="BOX",t[t.SPHERE=1]="SPHERE",t[t.CYLINDER=2]="CYLINDER",t[t.CONE=3]="CONE",t[t.CAPSULE=4]="CAPSULE",t[t.TORUS=5]="TORUS",t[t.PLANE=6]="PLANE",t[t.QUAD=7]="QUAD"}(aot||(aot={})),Se(aot);var _ot=t("Primitive",(tot=va("cc.Primitive"),eot=Za(aot),tot(((oot=function(t){function e(e){var i;return void 0===e&&(e=aot.BOX),(i=t.call(this)||this).type=rot&&rot(),i.info=sot&&sot(),i.type=e,i}return s(e,t),e.prototype.onLoaded=function(){aP(GK[aot[this.type].toLowerCase()](this.info),this)},e}(ZO)).PrimitiveType=aot,rot=ua((not=oot).prototype,"type",[eot],(function(){return aot.BOX})),sot=ua(not.prototype,"info",[wa],(function(){return{}})),iot=not))||iot));m.Primitive=_ot,m.primitives=GK;var dot,fot,pot=function(){function t(t,e,i){this._total=0,this._value=0,this._averageValue=0,this._accumValue=0,this._accumSamples=0,this._id=t,this._opts=e,this._accumStart=i}var e=t.prototype;return e.sample=function(t){this._average(this._value,t)},e.human=function(){var t=this._opts,e=t.average,i=t.isInteger,n=e?this._averageValue:this._value;return i?Math.round(n):Math.round(100*n)/100},e.alarm=function(){return void 0!==this._opts.below&&this._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}(),got=va("cc.PerfCounter")(dot=function(t){function e(e,i,n){var r;return(r=t.call(this,e,i,n)||this)._time=n,r}s(e,t);var i=e.prototype;return i.start=function(t){void 0===t&&(t=0),this._time=t},i.end=function(t){void 0===t&&(t=0),this._value=t-this._time,this._average(this._value)},i.tick=function(){this.end(),this.start()},i.frame=function(t){var e=t,i=e-this._time;this._total++,i>(this._opts.average||1e3)&&(this._value=1e3*this._total/i,this._total=0,this._time=e,this._average(this._value))},e}(pot))||dot,mot="0123456789. ",vot=500,yot={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,".":10},Tot={fps:{desc:"Framerate (FPS)",below:30,average:vot,isInteger:!0},draws:{desc:"Draw call",isInteger:!0},frame:{desc:"Frame time (ms)",min:0,max:50,average:vot},instances:{desc:"Instance Count",isInteger:!0},tricount:{desc:"Triangle",isInteger:!0},logic:{desc:"Game Logic (ms)",min:0,max:50,average:vot,color:"#080"},physics:{desc:"Physics (ms)",min:0,max:50,average:vot},render:{desc:"Renderer (ms)",min:0,max:50,average:vot,color:"#f90"},present:{desc:"Present (ms)",min:0,max:50,average:vot,color:"#f90"},textureMemory:{desc:"GFX Texture Mem(M)"},bufferMemory:{desc:"GFX Buffer Mem(M)"}},Eot=t("Profiler",function(t){function e(){var e;return(e=t.call(this)||this)._profilerStats=null,e._showFPS=!1,e._rootNode=null,e._device=null,e._swapchain=null,e._meshRenderer=null,e._canvas=null,e._ctx=null,e._texture=null,e._region=new __,e._canvasArr=[],e._regionArr=[e._region],e.digitsData=null,e.offsetData=null,e.pass=null,e._canvasDone=!1,e._statsDone=!1,e._inited=!1,e._lineHeight=280/(Object.keys(Tot).length+1),e._wordHeight=0,e._eachNumWidth=0,e._totalLines=0,e.lastTime=0,e._canvas=y.document.createElement("canvas"),e._ctx=e._canvas.getContext("2d"),e._canvasArr.push(e._canvas),e}s(e,t);var i=e.prototype;return i.init=function(){we.querySettings(Ce.Category.PROFILING,"showFPS")?this.showStats():this.hideStats()},i.isShowingStats=function(){return this._showFPS},i.hideStats=function(){this._showFPS&&(this._rootNode&&(this._rootNode.active=!1),m.director.off(m.Director.EVENT_BEFORE_UPDATE,this.beforeUpdate,this),m.director.off(m.Director.EVENT_AFTER_UPDATE,this.afterUpdate,this),m.director.off(m.Director.EVENT_BEFORE_PHYSICS,this.beforePhysics,this),m.director.off(m.Director.EVENT_AFTER_PHYSICS,this.afterPhysics,this),m.director.off(m.Director.EVENT_BEFORE_DRAW,this.beforeDraw,this),m.director.off(m.Director.EVENT_AFTER_RENDER,this.afterRender,this),m.director.off(m.Director.EVENT_AFTER_DRAW,this.afterPresent,this),this._showFPS=!1,DD.root.pipeline.profiler=null,m.game.config.showFPS=!1)},i.showStats=function(){if(!this._showFPS){if(!this._device){var t=m.director.root;this._device=Qd.gfxDevice,this._swapchain=t.mainWindow.swapchain}this.generateCanvas(),this.generateStats(),m.game.once(m.Game.EVENT_ENGINE_INITED,this.generateNode,this),m.game.on(m.Game.EVENT_RESTART,this.generateNode,this),this._rootNode&&(this._rootNode.active=!0),m.director.on(m.Director.EVENT_BEFORE_UPDATE,this.beforeUpdate,this),m.director.on(m.Director.EVENT_AFTER_UPDATE,this.afterUpdate,this),m.director.on(m.Director.EVENT_BEFORE_PHYSICS,this.beforePhysics,this),m.director.on(m.Director.EVENT_AFTER_PHYSICS,this.afterPhysics,this),m.director.on(m.Director.EVENT_BEFORE_DRAW,this.beforeDraw,this),m.director.on(m.Director.EVENT_AFTER_RENDER,this.afterRender,this),m.director.on(m.Director.EVENT_AFTER_DRAW,this.afterPresent,this),this._showFPS=!0,this._canvasDone=!0,this._statsDone=!0,m.game.config.showFPS=!0}},i.generateCanvas=function(){if(!this._canvasDone){this._ctx&&this._canvas&&(this._canvas.width=280,this._canvas.height=280,this._canvas.style.width=""+this._canvas.width,this._canvas.style.height=""+this._canvas.height,this._ctx.font="23px Arial",this._ctx.textBaseline="top",this._ctx.fillStyle="#fff",this._texture=this._device.createTexture(new A_(Sl.TEX2D,Al.SAMPLED|Al.TRANSFER_DST,pl.RGBA8,280,280)),this._region.texExtent.width=280,this._region.texExtent.height=280)}},i.generateStats=function(){if(!this._statsDone&&this._ctx&&this._canvas){this._profilerStats=null;var t=performance.now();this._ctx.textAlign="left";var e=0;for(var i in Tot){var n=Tot[i];this._ctx.fillText(n.desc,0,e*this._lineHeight),n.counter=new got(i,n,t),e++}this._totalLines=e,this._wordHeight=this._totalLines*this._lineHeight/this._canvas.height;for(var r=0;r=0;a--){var h=8*i+a,u=o[o.length-(8-a)],c=yot[u];void 0===c&&(c=11),n[h]=c}i++}}}},n(e,[{key:"_stats",get:function(){return q(16381),this._profilerStats}},{key:"stats",get:function(){return this._profilerStats}}]),e}(Yc)),Sot=t("profiler",new Eot);DD.registerSystem("profiler",Sot,0),m.profiler=Sot,function(t){var e,i,n,r,s,o,a,h,u,c;(e=t.MixBlend||(t.MixBlend={}))[e.setup=0]="setup",e[e.first=1]="first",e[e.replace=2]="replace",e[e.add=3]="add",(i=t.MixDirection||(t.MixDirection={}))[i.mixIn=0]="mixIn",i[i.mixOut=1]="mixOut",(n=t.TimelineType||(t.TimelineType={}))[n.rotate=0]="rotate",n[n.translate=1]="translate",n[n.scale=2]="scale",n[n.shear=3]="shear",n[n.attachment=4]="attachment",n[n.color=5]="color",n[n.deform=6]="deform",n[n.event=7]="event",n[n.drawOrder=8]="drawOrder",n[n.ikConstraint=9]="ikConstraint",n[n.transformConstraint=10]="transformConstraint",n[n.pathConstraintPosition=11]="pathConstraintPosition",n[n.pathConstraintSpacing=12]="pathConstraintSpacing",n[n.pathConstraintMix=13]="pathConstraintMix",n[n.twoColor=14]="twoColor",function(t){t[t.start=0]="start",t[t.interrupt=1]="interrupt",t[t.end=2]="end",t[t.dispose=3]="dispose",t[t.complete=4]="complete",t[t.event=5]="event"}(t.EventType||(t.EventType={})),(r=t.BlendMode||(t.BlendMode={}))[r.Normal=0]="Normal",r[r.Additive=1]="Additive",r[r.Multiply=2]="Multiply",r[r.Screen=3]="Screen",(s=t.TransformMode||(t.TransformMode={}))[s.Normal=0]="Normal",s[s.OnlyTranslation=1]="OnlyTranslation",s[s.NoRotationOrReflection=2]="NoRotationOrReflection",s[s.NoScale=3]="NoScale",s[s.NoScaleOrReflection=4]="NoScaleOrReflection",(o=t.PositionMode||(t.PositionMode={}))[o.Fixed=0]="Fixed",o[o.Percent=1]="Percent",(a=t.SpacingMode||(t.SpacingMode={}))[a.Length=0]="Length",a[a.Fixed=1]="Fixed",a[a.Percent=2]="Percent",(h=t.RotateMode||(t.RotateMode={}))[h.Tangent=0]="Tangent",h[h.Chain=1]="Chain",h[h.ChainScale=2]="ChainScale",(u=t.TextureFilter||(t.TextureFilter={}))[u.Nearest=9728]="Nearest",u[u.Linear=9729]="Linear",u[u.MipMap=9987]="MipMap",u[u.MipMapNearestNearest=9984]="MipMapNearestNearest",u[u.MipMapLinearNearest=9985]="MipMapLinearNearest",u[u.MipMapNearestLinear=9986]="MipMapNearestLinear",u[u.MipMapLinearLinear=9987]="MipMapLinearLinear",(c=t.TextureWrap||(t.TextureWrap={}))[c.MirroredRepeat=33648]="MirroredRepeat",c[c.ClampToEdge=33071]="ClampToEdge",c[c.Repeat=10497]="Repeat",function(t){t[t.Region=0]="Region",t[t.BoundingBox=1]="BoundingBox",t[t.Mesh=2]="Mesh",t[t.LinkedMesh=3]="LinkedMesh",t[t.Path=4]="Path",t[t.Point=5]="Point",t[t.Clipping=6]="Clipping"}(t.AttachmentType||(t.AttachmentType={}))}(fot||(fot={}));var Aot=fot;function bot(t,e){return t?e===t.length?t:e=this._maxFrameIdex&&(this.isCompleted=!0)}while(this.needToUpdate(t))},e.getFrame=function(t){var e=t%this._maxFrameIdex;return this.frames[e]},e.invalidAnimationFrames=function(){this._curIndex=-1,this._isCompleted=!1,this.frames.length=0},e.updateRenderData=function(t,e){var i=e.vCount,n=e.iCount,r=Vot/Float32Array.BYTES_PER_ELEMENT,s=new Uint8Array(Float32Array.BYTES_PER_ELEMENT*r*i),o=new Uint16Array(n),a=Aot.wasmUtil.wasm.HEAPU8,h=e.vPtr,u=i*Float32Array.BYTES_PER_ELEMENT*r;s.set(a.subarray(h,h+u));var c=e.iPtr,l=Uint16Array.BYTES_PER_ELEMENT*n;new Uint8Array(o.buffer).set(a.subarray(c,c+l));var _=new Xot;_.vCount=i,_.iCount=n,_.vData=s,_.iData=o;for(var d=e.getData(),f=d.size(),p=0;p0)return void this._sharedCacheMap.set(t,i);this._sharedCacheMap.delete(t)}}var n=this._skeletonCache[t];if(n){var r=this._privateMode?function(t,e){e.destroy()}:function(i,n){e._animationPool[t+"#"+i]=n,n.clear()},s=n.animationsCache;for(var o in s){var a=s[o];a&&r(o,a)}n.skeleton&&Aot.wasmUtil.destroySpineSkeleton(n.skeleton),delete this._skeletonCache[t]}},e.createSkeletonInfo=function(t){var e=t.uuid,i=t.getRuntimeData();if(!this._privateMode){var n=this._sharedCacheMap.get(e);n?n+=1:n=1,this._sharedCacheMap.set(e,n)}if(this._skeletonCache[e])return this._skeletonCache[e];var r=new Aot.Skeleton(i),s=new Oot;return this._skeletonCache[e]={skeleton:r,clipper:null,state:null,listener:s,animationsCache:{},curAnimationCache:null,assetUUID:e}},e.getSkeletonInfo=function(t){var e=t.uuid;return this._skeletonCache[e]},e.getAnimationCache=function(t,e){var i=this._skeletonCache[t];return i?i.animationsCache[e]:null},e.initAnimationCache=function(t,e,i){var n=e.getRuntimeData();if(!n)return null;var r=this._skeletonCache[t];if(!r||!r.skeleton)return null;var s=r.animationsCache,o=s[i];if(!o){var a=t+"#"+i;(o=this._animationPool[a])?delete this._animationPool[a]:(o=new Yot(n))._privateMode=this._privateMode,o.init(r,i),s[i]=o}return o.init(r,i),o.setAnimation(i),o},e.destroyCachedAnimations=function(t){if(t){var e=this._animationPool;for(var i in e)i.includes(t)&&(e[i].destroy(),delete e[i]);var n=this._skeletonCache[t],r=n&&n.skeleton;r&&Aot.wasmUtil.destroySpineSkeleton(r),n&&delete this._skeletonCache[t]}else{var s=this._animationPool;for(var o in s)s[o].destroy(),delete s[o]}},t}();Iot=Kot,Kot.FrameTime=Pot,Kot.sharedCache=new Iot;var qot=(Mot=va("sp.SkeletonData"),Not=Za([Sg]),Lot=Za([ti]),Mot((Fot=function(t){function e(){var e;return(e=t.call(this)||this)._skeletonJson=kot&&kot(),e.textures=Uot&&Uot(),e.textureNames=Got&&Got(),e.scale=Hot&&Hot(),e._atlasText=zot&&zot(),e._buffer=void 0,e._skeletonCache=null,e._skinsEnum=null,e._animsEnum=null,e.reset(),e}s(e,t);var i=e.prototype;return i.createNode=function(t){var e=new Tm(this.name);return e.addComponent("cc.Skeleton").skeletonData=this,t(null,e)},i.reset=function(){this._skeletonCache=null},i.resetEnums=function(){},i.getRuntimeData=function(t){if(this._skeletonCache)return this._skeletonCache;if(!(this.textures&&this.textures.length>0)&&this.textureNames&&this.textureNames.length>0)return t||k(this.name+" no textures found!"),null;var e=Aot.wasmUtil.querySpineSkeletonDataByUUID(this._uuid);if(e)this._skeletonCache=e;else if(this._skeletonJson)this._skeletonCache=Aot.wasmUtil.createSpineSkeletonDataWithJson(this.skeletonJsonStr,this._atlasText),Aot.wasmUtil.registerSpineSkeletonDataWithUUID(this._skeletonCache,this._uuid);else{var i=new Uint8Array(this._nativeAsset),n=i.length,r=Aot.wasmUtil.queryStoreMemory(n);Aot.wasmUtil.wasm.HEAPU8.subarray(r,r+n).set(i),this._skeletonCache=Aot.wasmUtil.createSpineSkeletonDataWithBinary(n,this._atlasText),Aot.wasmUtil.registerSpineSkeletonDataWithUUID(this._skeletonCache,this._uuid)}return this._skeletonCache},i.getSkinsEnum=function(){if(this._skinsEnum)return this._skinsEnum;var t=this.getRuntimeData(!0);if(t){for(var e=t.skins,i={},n=0;n1)return this._animsEnum;var t=this.getRuntimeData(!0);if(t){for(var e={"":0},i=t.animations,n=0;n"]=0]=""}(xat||(xat={})),Se(xat),function(t){t[t.COLORED_TEXTURED=0]="COLORED_TEXTURED",t[t.TWO_COLORED=1]="TWO_COLORED"}(Dat||(Dat={}));var Nat=(Zot=va("sp.Skeleton.SpineSocket"),Jot=Za(Tm),Zot((tat=function(t,e){void 0===t&&(t=""),void 0===e&&(e=null),this.path=eat&&eat(),this.target=iat&&iat(),this.path=t,this.target=e},eat=ua(tat.prototype,"path",[wa],(function(){return""})),iat=ua(tat.prototype,"target",[Jot,wa],(function(){return null})),$ot=tat))||$ot);Jt(Nat,"sp.Skeleton.SpineSocket");var Lat=(nat=va("sp.Skeleton"),rat=Za(qot),sat=Za(Iat),oat=Za(xat),aat=Za(wat),hat=Za([Nat]),uat=Za($E),nat(((Rat=function(t){function e(){var e;return(e=t.call(this)||this)._skeletonData=_at&&_at(),e.defaultSkin=dat&&dat(),e.defaultAnimation=fat&&fat(),e._premultipliedAlpha=pat&&pat(),e._timeScale=gat&&gat(),e._preCacheMode=mat&&mat(),e._cacheMode=vat&&vat(),e._sockets=yat&&yat(),e._useTint=Tat&&Tat(),e._debugMesh=Eat&&Eat(),e._debugBones=Sat&&Sat(),e._debugSlots=Aat&&Aat(),e._enableBatch=bat&&bat(),e._runtimeData=null,e._skeleton=null,e._instance=null,e._state=null,e._textures=[],e._skeletonInfo=null,e._animationName="",e._skinName="",e._drawList=new Xs((function(){return{material:null,texture:null,indexOffset:0,indexCount:0}}),1),e._materialCache={},e.paused=!1,e._enumSkins=ye({}),e._enumAnimations=ye({}),e.attachUtil=void 0,e._socketNodes=new Map,e._cachedSockets=new Map,e._startEntry=void 0,e._endEntry=void 0,e._paused=!1,e._accTime=0,e._playCount=0,e._skeletonCache=null,e._animCache=null,e._animationQueue=[],e._headAniInfo=null,e._isAniComplete=!0,e._playTimes=0,e._curFrame=null,e._needUpdateSkeltonData=!0,e._listener=null,e._debugRenderer=null,e._startSlotIndex=void 0,e._endSlotIndex=void 0,e._slotTextures=null,e._vLength=0,e._vBuffer=null,e._iLength=0,e._iBuffer=null,e._model=void 0,e._tempColor={r:0,g:0,b:0,a:0},e._eventListenerID=-1,e.loop=Cat&&Cat(),e._useVertexOpacity=!0,e._startEntry={animation:{name:""},trackIndex:0},e._endEntry={animation:{name:""},trackIndex:0},e._startSlotIndex=-1,e._endSlotIndex=-1,e._instance=new Aot.SkeletonInstance,e._instance.dtRate=1*e._timeScale,e._instance.isCache=e.isAnimationCached(),e.attachUtil=new Pat,e}s(e,t);var i=e.prototype;return i.__preload=function(){t.prototype.__preload.call(this),this._updateSkeletonData(),this._updateDebugDraw()},i.onRestore=function(){this.updateMaterial(),this.markForUpdateRenderData()},i.getState=function(){return this._state},i.onEnable=function(){t.prototype.onEnable.call(this),this._instance&&(this._instance.enable=!0),this._flushAssembler(),Qot.getInstance().add(this)},i.onDisable=function(){t.prototype.onDisable.call(this),this._instance&&(this._instance.enable=!1),Qot.getInstance().remove(this)},i.onDestroy=function(){var e;this._eventListenerID>0&&(Oot.removeListener(this._eventListenerID),this._eventListenerID=-1),this._drawList.destroy(),this.destroyRenderData(),this._cleanMaterialCache(),this._vBuffer=null,this._iBuffer=null,this.attachUtil.reset(),null===(e=this._slotTextures)||void 0===e||e.clear(),this._slotTextures=null,this._cachedSockets.clear(),this._socketNodes.clear(),this._animCache=null,Qot.getInstance().remove(this),this._instance&&(this._instance.destroy(),this._instance=null),this._destroySkeletonInfo(this._skeletonCache),this._skeletonCache=null,t.prototype.onDestroy.call(this)},i.clearAnimation=function(t){this.isAnimationCached()||(this.clearTrack(t||0),this.setToSetupPose())},i.clearAnimations=function(){this.isAnimationCached()||(this.clearTracks(),this.setToSetupPose())},i._updateSkeletonData=function(){var t=this._skeletonData;if(!t)return this._runtimeData=null,this._state=null,this._skeleton=null,this._textures=[],void this._refreshInspector();this._instance&&(this._instance.dtRate=1*this._timeScale),this._needUpdateSkeltonData=!1,this._runtimeData=t.getRuntimeData(),this._runtimeData&&(this.setSkeletonData(this._runtimeData),this._textures=t.textures,this._refreshInspector(),this.defaultAnimation&&(this.animation=this.defaultAnimation.toString()),this.defaultSkin&&""!==this.defaultSkin&&this.setSkin(this.defaultSkin),this._updateUseTint(),this._indexBoneSockets(),this._updateSocketBindings(),this.attachUtil.init(this),this._preCacheMode=this._cacheMode)},i.setSkeletonData=function(t){var e=this._skeletonCache;if(this._cacheMode===wat.SHARED_CACHE?this._skeletonCache=Kot.sharedCache:this._cacheMode===wat.PRIVATE_CACHE?(this._skeletonCache=new Kot,this._skeletonCache.enablePrivateMode()):this._skeletonCache=null,e!==this._skeletonCache&&this._destroySkeletonInfo(e),this.isAnimationCached()){(this.debugBones||this.debugSlots)&&F("Debug bones or slots is invalid in cached mode");var i=this._skeletonCache.getSkeletonInfo(this._skeletonData);this._skeletonInfo!==i&&(this._destroySkeletonInfo(this._skeletonCache),this._skeletonInfo=this._skeletonCache.createSkeletonInfo(this._skeletonData),this._skeleton=this._skeletonInfo.skeleton)}else this._skeleton=this._instance.initSkeleton(t),this._state=this._instance.getAnimationState(),this._instance.setPremultipliedAlpha(this._premultipliedAlpha);this._flushAssembler()},i.setSlotsRange=function(t,e){this.isAnimationCached()?F("Slots visible range can not be modified in cached mode."):(this._startSlotIndex=t,this._endSlotIndex=e)},i.getAttachment=function(t,e){return this._skeleton?this._skeleton.getAttachmentByName(t,e):null},i.setAttachment=function(t,e){this._skeleton&&this._skeleton.setAttachment(t,e),this.invalidAnimationCache()},i.getTextureAtlas=function(t){return t.region},i.setAnimation=function(t,e,i){if("string"!=typeof e)return X(7511),null;if(!this._skeleton.data.findAnimation(e))return X(7509,e),null;var n=null;if(void 0===i&&(i=!0),this._playTimes=i?0:1,this.isAnimationCached()){if(0!==t&&F("Track index can not greater than 0 in cached mode."),!this._skeletonCache)return null;var r,s=this._skeletonCache.getAnimationCache(this._skeletonData.uuid,e);s||null===(r=s=this._skeletonCache.initAnimationCache(this.skeletonData.uuid,this._skeletonData,e))||void 0===r||r.setSkin(this._skinName),s&&(this._animationName=e,this._isAniComplete=!1,this._accTime=0,this._playCount=0,this._animCache=s,this._socketNodes.size>0&&this._animCache.enableCacheAttachedInfo(),this._animCache.updateToFrame(0),this._curFrame=this._animCache.frames[0])}else this._animationName=e,n=this._instance.setAnimation(t,e,i);return this.markForUpdateRenderData(),n},i.addAnimation=function(t,e,i,n){if(n=n||0,this.isAnimationCached())return 0!==t&&F("Track index can not greater than 0 in cached mode."),this._animationQueue.push({animationName:e,loop:i,delay:n}),null;if(this._skeleton){var r,s=this._skeleton.data.findAnimation(e);return s?null===(r=this._state)||void 0===r?void 0:r.addAnimationWith(t,s,i,n):(X(7510,e),null)}return null},i.findAnimation=function(t){return this._skeleton?this._skeleton.data.findAnimation(t):null},i.getCurrent=function(t){if(this.isAnimationCached())F("'getCurrent' interface can not be invoked in cached mode.");else if(this._state)return this._state.getCurrent(t);return null},i.setSkin=function(t){this._skeleton&&this._skeleton.setSkinByName(t),this._instance.setSkin(t),this.isAnimationCached()&&this._animCache&&this._animCache.setSkin(t),this._skinName=t,this.invalidAnimationCache()},i.updateAnimation=function(t){if(this.markForUpdateRenderData(),!this.paused)if(this.isAnimationCached()){if(t*=1*this._timeScale,this._isAniComplete){var e;if(0===this._animationQueue.length&&!this._headAniInfo){var i=this._animCache;if(i&&i.isInvalid()){i.updateToFrame(0);var n=i.frames;this._curFrame=n[n.length-1]}return}if(this._headAniInfo||(this._headAniInfo=this._animationQueue.shift()),this._accTime+=t,this._accTime>(null===(e=this._headAniInfo)||void 0===e?void 0:e.delay)){var r=this._headAniInfo;this._headAniInfo=null,this.setAnimation(0,null==r?void 0:r.animationName,null==r?void 0:r.loop)}return}this._updateCache(t)}else this._instance.updateAnimation(t)},i._updateCache=function(t){var e=this._animCache;if(e.isInited()){var i=e.frames,n=Kot.FrameTime;0===this._accTime&&0===this._playCount&&(this._startEntry.animation.name=this._animationName,this._listener&&this._listener.start&&this._listener.start(this._startEntry)),this._accTime+=t;var r=Math.floor(this._accTime/n);if(e.isCompleted||e.updateToFrame(r),this._curFrame=i[r],void 0!==this._curFrame&&this.attachUtil.updateSkeletonBones(this._curFrame.boneInfos),e.isCompleted&&r>=i.length){if(this._playCount++,this._playTimes>0&&this._playCount>=this._playTimes)return this._curFrame=i[i.length-1],this._accTime=0,this._playCount=0,this._isAniComplete=!0,void this._emitCacheCompleteEvent();this._accTime=0,r=0,this._curFrame=i[r],this._emitCacheCompleteEvent()}}},i._emitCacheCompleteEvent=function(){this._listener&&(this._endEntry.animation.name=this._animationName,this._listener.complete&&this._listener.complete(this._endEntry),this._listener.end&&this._listener.end(this._endEntry))},i.updateRenderData=function(){return this.isAnimationCached()?this._curFrame?this._curFrame.model:null:this._instance.updateRenderData()},i._flushAssembler=function(){var t=e.Assembler.getAssembler(this);this._assembler!==t&&(this._assembler=t),this._skeleton&&this._assembler&&(this._renderData=this._assembler.createData(this),this.markForUpdateRenderData(),this._updateColor())},i._render=function(t){var e=0;if(this.renderData&&this._drawList.length>0){for(var i=this.renderData,n=i.chunk,r=n.vertexAccessor,s=i.getMeshBuffer(),o=s.indexOffset,a=0;a":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 Tm("DEBUG_DRAW_NODE");t.layer=this.node.layer,t.hideFlags|=qs.Flags.DontSave|qs.Flags.HideInHierarchy;var e=t.addComponent(EF);e.lineWidth=5,e.strokeColor=new yn(255,0,0,255),this._debugRenderer=e,t.parent=this.node,this.node.on(Dg.LAYER_CHANGED,this._applyLayer,this)}this.isAnimationCached()?F("Debug bones or slots is invalid in cached mode"):this._instance.setDebugMode(!0)}else this._debugRenderer&&(this.node.off(Dg.LAYER_CHANGED,this._applyLayer,this),this._debugRenderer.node.destroy(),this._debugRenderer=null,this.isAnimationCached()||this._instance&&this._instance.setDebugMode(!1))},i._updateUITransform=function(){var t=this.node._uiProps.uiTransformComp,e=this._runtimeData;if(!e)return t.setContentSize(100,100),t.anchorX=.5,void(t.anchorX=.5);var i=e.width,n=e.height;i&&n&&(t.setContentSize(i,n),0!==i&&(t.anchorX=Math.abs(e.x)/i),0!==n&&(t.anchorY=Math.abs(e.y)/n))},i._updateColor=function(){var t=this.node._uiProps.opacity;if(this._tempColor.r!==this._color.r||this._tempColor.g!==this._color.g||this._tempColor.b!==this._color.b||this._tempColor.a!==t){this.node._uiProps.colorDirty=!0,this._tempColor.r=this._color.r,this._tempColor.g=this._color.g,this._tempColor.b=this._color.b,this._tempColor.a=t;var e=this._color.r/255,i=this._color.g/255,n=this._color.b/255;this._instance.setColor(e,i,n,t)}},i.setVertexEffectDelegate=function(t){if(this._instance)if(t){var e=null==t?void 0:t.getEffectType();if("jitter"===e){var i=null==t?void 0:t.getJitterVertexEffect();this._instance.setJitterEffect(i)}else if("swirl"===e){var n=null==t?void 0:t.getJitterVertexEffect();this._instance.setSwirlEffect(n)}}else this._instance.clearEffect()},i._ensureListener=function(){this._listener||(this._listener=new Oot,this._eventListenerID=Oot.addListener(this._listener),this._instance.setListener(this._eventListenerID))},i.setStartListener=function(t){this._ensureListener(),this._listener.start=t},i.setInterruptListener=function(t){this._ensureListener(),this._listener.interrupt=t},i.setEndListener=function(t){this._ensureListener(),this._listener.end=t},i.setDisposeListener=function(t){this._ensureListener(),this._listener.dispose=t},i.setCompleteListener=function(t){this._ensureListener(),this._listener.complete=t},i.setEventListener=function(t){this._ensureListener(),this._listener.event=t},i.setTrackStartListener=function(t,e){Oot.getListeners(t,this._instance).start=e},i.setTrackInterruptListener=function(t,e){Oot.getListeners(t,this._instance).interrupt=e},i.setTrackEndListener=function(t,e){Oot.getListeners(t,this._instance).end=e},i.setTrackDisposeListener=function(t,e){Oot.getListeners(t,this._instance).dispose=e},i.setTrackCompleteListener=function(t,e){Oot.getListeners(t,this._instance).complete=function(t){var i=Math.floor(t.trackTime/t.animationEnd);e(t,i)}},i.setTrackEventListener=function(t,e){Oot.getListeners(t,this._instance).event=e},i.getDebugShapes=function(){return this._instance.getDebugShapes()},i.setSlotTexture=function(t,e,i){if(this.isAnimationCached())k("Cached mode can't change texture of slot");else if(this.findSlot(t)){var n=e.width,r=e.height,s=i||!1;this._instance.resizeSlotRegion(t,n,r,s),this._slotTextures||(this._slotTextures=new Map);var o=0;this._slotTextures.forEach((function(t,i){t===e&&(o=i)})),0===o&&(o=++Mat,this._slotTextures.set(o,e)),this._instance.setSlotTexture(t,o)}else k("No slot named:"+t)},i._destroySkeletonInfo=function(t){t&&this._skeletonInfo&&(t.destroySkeleton(this._skeletonInfo.assetUUID),this._skeletonInfo=null)},i._applyLayer=function(){this._debugRenderer&&(this._debugRenderer.node.layer=this.node.layer)},n(e,[{key:"drawList",get:function(){return this._drawList}},{key:"skeletonData",get:function(){return this._skeletonData},set:function(t){t&&t.resetEnums(),this._skeletonData!==t&&(this.destroyRenderData(),this._skeletonData=t,this.defaultSkin="",this.defaultAnimation="",this._animationName="",this._skinName="",this._updateSkeletonData(),this._updateUITransform())}},{key:"_defaultSkinIndex",get:function(){if(this.skeletonData){var t=this.skeletonData.getSkinsEnum();if(t)if(""===this.defaultSkin){if(t.hasOwnProperty(0))return this._defaultSkinIndex=0,0}else{var e=t[this.defaultSkin];if(void 0!==e)return e}}return 0},set:function(t){var e;if(this.skeletonData&&(e=this.skeletonData.getSkinsEnum()),e){var i=e[t];void 0!==i?(this.defaultSkin=String(i),this.setSkin(this.defaultSkin),this._refreshInspector(),this.markForUpdateRenderData()):k(this.name+" skin enums are invalid")}else k(this.name+" skin enums are invalid")}},{key:"_animationIndex",get:function(){var t=this.animation;if(this.skeletonData)if(t){var e=this.skeletonData.getAnimsEnum();if(e){var i=e[t];if(void 0!==i)return i}}else this._refreshInspector();return 0},set:function(t){var e;if(this.skeletonData&&(e=this.skeletonData.getAnimsEnum()),e){var i=String(e[t]);void 0!==i?(this.animation=i,this.animation=i):k(this.name+" animation enums are invalid")}else k(this.name+" animation enums are invalid")}},{key:"defaultCacheMode",get:function(){return this._cacheMode},set:function(t){this._cacheMode=t,this.setAnimationCacheMode(this._cacheMode)}},{key:"premultipliedAlpha",get:function(){return this._premultipliedAlpha},set:function(t){t!==this._premultipliedAlpha&&(this._premultipliedAlpha=t,this._instance.setPremultipliedAlpha(t),this.markForUpdateRenderData())}},{key:"timeScale",get:function(){return this._timeScale},set:function(t){t!==this._timeScale&&(this._timeScale=t,this._instance&&(this._instance.dtRate=1*this._timeScale))}},{key:"useTint",get:function(){return this._useTint},set:function(t){t!==this._useTint&&(this._useTint=t,this._updateUseTint())}},{key:"enableBatch",get:function(){return this._enableBatch},set:function(t){t!==this._enableBatch&&(this._enableBatch=t,this._updateBatch())}},{key:"sockets",get:function(){return this._sockets},set:function(t){this._sockets=t,this._updateSocketBindings(),this.attachUtil.init(this)}},{key:"debugSlots",get:function(){return this._debugSlots},set:function(t){t!==this._debugSlots&&(this._debugSlots=t,this._updateDebugDraw(),this.markForUpdateRenderData())}},{key:"debugBones",get:function(){return this._debugBones},set:function(t){t!==this._debugBones&&(this._debugBones=t,this._updateDebugDraw(),this.markForUpdateRenderData())}},{key:"debugMesh",get:function(){return this._debugMesh},set:function(t){t!==this._debugMesh&&(this._debugMesh=t,this._updateDebugDraw(),this.markForUpdateRenderData())}},{key:"socketNodes",get:function(){return this._socketNodes}},{key:"animation",get:function(){return this._animationName},set:function(t){t?this.setAnimation(0,t,this.loop):this.clearAnimation(0)}},{key:"customMaterial",get:function(){return this._customMaterial},set:function(t){this._customMaterial=t,this.updateMaterial(),this.markForUpdateRenderData()}}]),e}(WN)).SpineSocket=Nat,Rat.AnimationCacheMode=wat,_at=ua((lat=Rat).prototype,"_skeletonData",[wa],(function(){return null})),dat=ua(lat.prototype,"defaultSkin",[wa],(function(){return""})),fat=ua(lat.prototype,"defaultAnimation",[wa],(function(){return""})),pat=ua(lat.prototype,"_premultipliedAlpha",[wa],(function(){return!0})),gat=ua(lat.prototype,"_timeScale",[wa],(function(){return 1})),mat=ua(lat.prototype,"_preCacheMode",[wa],(function(){return wat.UNSET})),vat=ua(lat.prototype,"_cacheMode",[wa],(function(){return wat.REALTIME})),yat=ua(lat.prototype,"_sockets",[wa],(function(){return[]})),Tat=ua(lat.prototype,"_useTint",[wa],(function(){return!1})),Eat=ua(lat.prototype,"_debugMesh",[wa],(function(){return!1})),Sat=ua(lat.prototype,"_debugBones",[wa],(function(){return!1})),Aat=ua(lat.prototype,"_debugSlots",[wa],(function(){return!1})),bat=ua(lat.prototype,"_enableBatch",[wa],(function(){return!1})),f(lat.prototype,"skeletonData",[rat],Object.getOwnPropertyDescriptor(lat.prototype,"skeletonData"),lat.prototype),f(lat.prototype,"_defaultSkinIndex",[sat],Object.getOwnPropertyDescriptor(lat.prototype,"_defaultSkinIndex"),lat.prototype),f(lat.prototype,"_animationIndex",[oat],Object.getOwnPropertyDescriptor(lat.prototype,"_animationIndex"),lat.prototype),f(lat.prototype,"defaultCacheMode",[aat],Object.getOwnPropertyDescriptor(lat.prototype,"defaultCacheMode"),lat.prototype),Cat=ua(lat.prototype,"loop",[wa],(function(){return!0})),f(lat.prototype,"sockets",[hat],Object.getOwnPropertyDescriptor(lat.prototype,"sockets"),lat.prototype),f(lat.prototype,"customMaterial",[hh,uat],Object.getOwnPropertyDescriptor(lat.prototype,"customMaterial"),lat.prototype),cat=lat))||cat);m.internal.SpineSkeleton=Lat;var Bat,Fat,kat,Uat,Gat=function(){function t(){this.name="sp.VertexEffectDelegate",this._vertexEffect=void 0,this._interpolation=void 0,this._effectType=void 0,this._vertexEffect=null,this._interpolation=null,this._effectType="none"}var e=t.prototype;return e.clear=function(){this._vertexEffect=null,this._interpolation=null,this._effectType="none"},e.initJitter=function(t,e){return this._effectType="jitter",this._vertexEffect=new Aot.JitterEffect(t,e),this._vertexEffect},e.initSwirlWithPow=function(t,e){return this._effectType="swirl",this._interpolation=new Aot.Pow(e),this._vertexEffect=new Aot.SwirlEffect(t,this._interpolation),this._vertexEffect},e.initSwirlWithPowOut=function(t,e){return this._effectType="swirl",this._interpolation=new Aot.PowOut(e),this._vertexEffect=new Aot.SwirlEffect(t,this._interpolation),this._vertexEffect},e.getJitterVertexEffect=function(){return this._vertexEffect},e.getSwirlVertexEffect=function(){return this._vertexEffect},e.getVertexEffect=function(){return this._vertexEffect},e.getEffectType=function(){return this._effectType},t}(),Hat=new yn(0,0,255,255),zat=new yn(255,0,0,255),Vat=new yn(0,255,0,255),Wat=new yn(255,255,0,255),Xat=null,jat=null,Yat=!1,Kat=!1,qat=kM(NM),Qat=kM(BM),Zat=new _n(0,0,0);function Jat(t,e){var i,n;switch(t){case 1:i=Yat?Pl.ONE:Pl.SRC_ALPHA,n=Pl.ONE;break;case 2:i=Pl.DST_COLOR,n=Pl.ONE_MINUS_SRC_ALPHA;break;case 3:i=Pl.ONE,n=Pl.ONE_MINUS_SRC_COLOR;break;case 0:default:i=Yat?Pl.ONE:Pl.SRC_ALPHA,n=Pl.ONE_MINUS_SRC_ALPHA}return e.getMaterialForBlendAndTint(i,n,Kat?Dat.TWO_COLORED:Dat.COLORED_TEXTURED)}var $at={vCount:32767,ensureAccessor:function(t){var e=t?jat:Xat;if(!e){var i=DD.root.device,n=DD.root.batcher2D,r=t?BM:NM;t?(e=jat=new qM(i,r,this.vCount),n.registerBufferAccessor(Number.parseInt("SPINETINT",36),jat)):(e=Xat=new qM(i,r,this.vCount),n.registerBufferAccessor(Number.parseInt("SPINE",36),Xat))}return e},createData:function(t){var e=t.renderData;if(!e){var i=t.useTint||t.isAnimationCached(),n=this.ensureAccessor(i);e=gN.add(i?BM:NM,n)}return e},updateRenderData:function(t){var e;t._skeleton&&t.node.active&&null!==(e=t.skeletonData)&&void 0!==e&&e.isValid&&function(t){if(t.drawList.reset(),0!==t.color.a){t._updateColor(),Yat=t.premultipliedAlpha,Kat=t.useTint||t.isAnimationCached(),t.isAnimationCached()?function(t){var e=t.updateRenderData();if(e){var i=e.vCount,n=e.iCount;if(!(i<1||n<1)){var r=t.renderData;r.vertexCount===i&&r.indexCount===n||(r.resize(i,n),r.indices=new Uint16Array(n));var s=r.chunk.vb,o=new Uint8Array(s.buffer,s.byteOffset,Float32Array.BYTES_PER_ELEMENT*s.length);o.set(e.vData);var a=t.color,h=t.node._uiProps.opacity;if(1-h>xi||4294967295!==yn.toUint32(a)||Yat){Bat=a.r/255,Fat=a.g/255,kat=a.b/255,Uat=h;for(var u=0;u0||e.indexCount>0)&&i.getMeshBuffer(e.chunk.bufferId).setDirty()}}(t)}};m.internal.SpineAssembler=$at;var tht,eht,iht={getAssembler:function(){return $at}};Lat.Assembler=iht,function(t){t[t.REGION=0]="REGION",t[t.BOUNDING_BOX=1]="BOUNDING_BOX",t[t.MESH=2]="MESH",t[t.SKINNED_MESH=3]="SKINNED_MESH"}(tht||(tht={})),Se(tht),function(t){t[t.START=0]="START",t[t.INTERRUPT=1]="INTERRUPT",t[t.END=2]="END",t[t.DISPOSE=3]="DISPOSE",t[t.COMPLETE=4]="COMPLETE",t[t.EVENT=5]="EVENT"}(eht||(eht={})),Se(eht),t("sp",Object.freeze({__proto__:null,spine:Aot,get ATTACHMENT_TYPE(){return tht},get AnimationEventType(){return eht},timeScale:1,get AnimationCacheMode(){return wat},get DefaultSkinsEnum(){return Iat},get DefaultAnimsEnum(){return xat},get SpineMaterialType(){return Dat},SpineSocket:Nat,Skeleton:Lat,SkeletonData:qot,VertexEffectDelegate:Gat,simpleSpineAssembler:iht}));var nht=new _n,rht=new _n;function sht(t,e){var i=null;return{value:e.length>0?e[e.length-1]:_n.ZERO,progress:function(t,e,n,r){return i.getPoint(r)},clone:function(t){return _n.clone(t)},add:function(t,e){return t.clone().add(e)},sub:function(t,e){return t.clone().subtract(e)},onStart:function(n){var r=n.start,s=n.end,o=n.relative,a=n.reversed;(i=Lc.create(t)).addKnot(r);var h=null;o&&a&&(h=rht,_n.subtract(h,r,e[e.length-1]));for(var u=0,c=e.length;u0&&i.addKnot(_n.copy(nht,h).add(l)):i.addKnot(_n.copy(nht,r).add(l)):i.addKnot(l)}o&&a&&i.addKnot(s)},onComplete:function(){i=null},onStop:function(){i=null},legacyProgress:!1}}t("tweenProgress",Object.freeze({__proto__:null,bezier:function(){for(var t=arguments.length,e=new Array(t),i=0;i=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===oht.TAG_INVALID&&X(1002);var n=this._hashTargets;if(e){var r=n.get(e);r&&this._removeActionByTag(t,r,e)}else n.forEach((function(e){i._removeActionByTag(t,e)}))},e.removeAllActionsByTag=function(t,e){var i=this;t===oht.TAG_INVALID&&X(1002);var n=this._hashTargets;if(e){var r=n.get(e);r&&this._removeAllActionsByTag(t,r,e)}else n.forEach((function(e){i._removeAllActionsByTag(t,e)}))},e.getActionByTag=function(t,e){t===oht.TAG_INVALID&&X(1004);var i=this._hashTargets.get(e);if(i){if(null!=i.actions)for(var n=0;n=t&&e.actionIndex--,0===e.actions.length&&(e.target instanceof Tm&&this._unregisterNodeEvent(e.target),this._deleteHashElement(e))},e._deleteHashElement=function(t){var e=!1;if(t&&!t.lock&&this._hashTargets.get(t.target)){this._hashTargets.delete(t.target);for(var i=this._arrayTargets,n=0,r=i.length;nthis._duration?this._duration:t,this._startTime=t},i.getElapsed=function(){return this._elapsed},i.initWithDuration=function(t){return this._duration=0===t?Ie.FLT_EPSILON:t,this._elapsed=0,this._firstTick=!0,!0},i.isDone=function(){return this._elapsed>=this._duration},i._cloneDecoration=function(t){t._speed=this._speed},i.step=function(t){if(!this._paused&&0!==this._speed){t*=this._speed,this._firstTick?this._elapsed=this._startTime:this._elapsed+=t;var e=this._elapsed/(this._duration>1.192092896e-7?this._duration:1.192092896e-7);e=e<1?e:1,this.update(e>0?e:0),this.isUnknownDuration()&&!this._firstTick&&(this._elapsed-=t),this._firstTick&&(this._firstTick=!1,this._startTime>0&&(this._startTime=0))}},i.startWithTarget=function(e){t.prototype.startWithTarget.call(this,e),this._elapsed=0,this._firstTick=!0},i.getSpeed=function(){return this._speed},i.setSpeed=function(t){this._speed=t},i.getDurationScaled=function(){return this._duration/this._speed},e}(aht),yht=function(t){function e(i){var n;if((n=t.call(this)||this)._actions=[],n._split=0,n._last=0,n._reversed=!1,!i||0===i.length)return l(n);1===i.length&&i.push(new mht);var r=i.length-1;if(r>=0&&null==i[r]&&X(1015),r>=0){for(var s,o=i[0],a=1;a1?i%1:i),this._last=n)}},i.reverse=function(){var t=e._actionOneTwo(this._actions[1].reverse(),this._actions[0].reverse());return this._cloneDecoration(t),t._reversed=!0,t},i.updateWorkerTarget=function(t){if(!(this._actions.length<2)){this._actions[1].workerTarget=t;var i=this._actions[0];i instanceof e||i instanceof bht?i.updateWorkerTarget(t):i.workerTarget=t}},i.findAction=function(t){for(var i=0,n=this._actions.length;i=r){for(;t>r&&this._total1?1:r}if(t>=1&&this._total=0&&null==i[r]&&X(1015),r>=0){for(var s,o=i[0],a=1;ar?this._two=yht._actionOneTwo(e,Rht(n-r)):n0&&this._actions[this._actions.length-1].setId(t),this})),e.then=function(t){var e=t._union(!0);return e&&(e.setSpeed(t._timeScale),this._actions.push(e)),this},e.reverse=function(e,i){if(null==e&&null==i)return this.reverseTween();var n,r;if(e instanceof t?(n=e,void 0!==i&&(r=i)):"number"==typeof e&&(n=this,r=e),n){var s=t.reverseAction(n,r);s&&this._actions.push(s)}return this},e.reverseTween=function(){if(0===this._actions.length)return q(16388),this.clone(this._target);var t=this._union(!1),e=cut(this._target);return e._timeScale=this._timeScale,t&&e.insertAction(t.reverse()),e},t.reverseAction=function(t,e){var i=t._actions;if(0===i.length)return null;var n=null,r=null;return"number"==typeof e?n=t.findAction(e,i):t&&(n=t._union(!1)),n?(r=n.reverse()).workerTarget=t._target:q(16391,""+e),r},e.findAction=function(t,e){for(var i=null,n=0,r=e.length;n1){var s=n.splice(r);1===s.length?n.push(s[0]):n.push(Tht(s))}return this},e.to=function(t,e,i){var n=i||Object.create(null);n.relative=!1;var r=new aut(t,e,n);return this._actions.push(r),this},e.by=function(t,e,i){var n=i||Object.create(null);n.relative=!0;var r=new aut(t,e,n);return this._actions.push(r),this},e.update=function(t,e){for(var i=arguments.length,n=new Array(i>2?i-2:0),r=2;r1?e-1:0),n=1;n0&&(i=this._time/this._duration),i>=1&&(i=1),this._transition===_ut.COLOR){var n=e._uiProps.uiComp;yn.lerp(put,this._fromColor,this._toColor,i),n&&(n.color=put)}else this.transition===_ut.SCALE&&(e.getScale(this._targetScale),this._targetScale.x=Ni(this._fromScale.x,this._toScale.x,i),this._targetScale.y=Ni(this._fromScale.y,this._toScale.y,i),e.setScale(this._targetScale));1===i&&(this._transitionFinished=!0)}},i._resizeNodeToTargetNode=function(){this.target&&this.target._uiProps.uiTransformComp},i._resetState=function(){this._pressed=!1,this._hovered=!1;var t=this.target;if(t){var e=this._transition;if(e===_ut.COLOR&&this._interactable){var i=t.getComponent(WN);i&&(i.color=this._normalColor)}else e===_ut.SCALE&&this._originalScale&&t.setScale(this._originalScale);this._transitionFinished=!0}},i._registerNodeEvent=function(){this.node.on(Dg.TOUCH_START,this._onTouchBegan,this),this.node.on(Dg.TOUCH_MOVE,this._onTouchMove,this),this.node.on(Dg.TOUCH_END,this._onTouchEnded,this),this.node.on(Dg.TOUCH_CANCEL,this._onTouchCancel,this),this.node.on(Dg.MOUSE_ENTER,this._onMouseMoveIn,this),this.node.on(Dg.MOUSE_LEAVE,this._onMouseMoveOut,this),this.node.on(Iht.XRUI_HOVER_ENTERED,this._xrHoverEnter,this),this.node.on(Iht.XRUI_HOVER_EXITED,this._xrHoverExit,this),this.node.on(Iht.XRUI_CLICK,this._xrClick,this),this.node.on(Iht.XRUI_UNCLICK,this._xrUnClick,this)},i._registerTargetEvent=function(t){t.on(Dg.TRANSFORM_CHANGED,this._onTargetTransformChanged,this)},i._unregisterNodeEvent=function(){this.node.off(Dg.TOUCH_START,this._onTouchBegan,this),this.node.off(Dg.TOUCH_MOVE,this._onTouchMove,this),this.node.off(Dg.TOUCH_END,this._onTouchEnded,this),this.node.off(Dg.TOUCH_CANCEL,this._onTouchCancel,this),this.node.off(Dg.MOUSE_ENTER,this._onMouseMoveIn,this),this.node.off(Dg.MOUSE_LEAVE,this._onMouseMoveOut,this),this.node.off(Iht.XRUI_HOVER_ENTERED,this._xrHoverEnter,this),this.node.off(Iht.XRUI_HOVER_EXITED,this._xrHoverExit,this),this.node.off(Iht.XRUI_CLICK,this._xrClick,this),this.node.off(Iht.XRUI_UNCLICK,this._xrUnClick,this)},i._unregisterTargetEvent=function(t){t.off(Dg.TRANSFORM_CHANGED)},i._getTargetSprite=function(t){var e=null;return t&&(e=t.getComponent(PF)),e},i._applyTarget=function(){this.target&&(this._sprite=this._getTargetSprite(this.target),this._originalScale||(this._originalScale=new _n),_n.copy(this._originalScale,this.target.scale),this._registerTargetEvent(this.target))},i._onTargetSpriteFrameChanged=function(t){this._transition===_ut.SPRITE&&this._setCurrentStateSpriteFrame(t.spriteFrame)},i._setCurrentStateSpriteFrame=function(t){if(t)switch(this._getButtonState()){case dut.NORMAL:this._normalSprite=t;break;case dut.HOVER:this._hoverSprite=t;break;case dut.PRESSED:this._pressedSprite=t;break;case dut.DISABLED:this._disabledSprite=t}},i._onTargetColorChanged=function(t){this._transition===_ut.COLOR&&this._setCurrentStateColor(t)},i._setCurrentStateColor=function(t){switch(this._getButtonState()){case dut.NORMAL:this._normalColor=t;break;case dut.HOVER:this._hoverColor=t;break;case dut.PRESSED:this._pressedColor=t;break;case dut.DISABLED:this._disabledColor=t}},i._onTargetTransformChanged=function(t){t&Ig.SCALE&&this._originalScale&&this._transition===_ut.SCALE&&this._transitionFinished&&_n.copy(this._originalScale,this.target.scale)},i._onTouchBegan=function(t){this._interactable&&this.enabledInHierarchy&&(this._pressed=!0,this._updateState(),t&&(t.propagationStopped=!0))},i._onTouchMove=function(t){if(this._interactable&&this.enabledInHierarchy&&this._pressed&&t){var e=t.touch;if(e){var i,n=this.node._uiProps.uiTransformComp.hitTest(e.getLocation(),t.windowId);this._transition===_ut.SCALE&&this.target&&this._originalScale?n?(_n.copy(this._fromScale,this._originalScale),_n.multiplyScalar(this._toScale,this._originalScale,this._zoomScale),this._transitionFinished=!1):(this._time=0,this._transitionFinished=!0,this.target.setScale(this._originalScale)):(i=n?dut.PRESSED:dut.NORMAL,this._applyTransition(i)),t&&(t.propagationStopped=!0)}}},i._onTouchEnded=function(t){this._interactable&&this.enabledInHierarchy&&(this._pressed&&(Rp.emitEvents(this.clickEvents,t),this.node.emit(fut.CLICK,this)),this._pressed=!1,this._updateState(),t&&(t.propagationStopped=!0))},i._onTouchCancel=function(){this._interactable&&this.enabledInHierarchy&&(this._pressed=!1,this._updateState())},i._onMouseMoveIn=function(){!this._pressed&&this.interactable&&this.enabledInHierarchy&&(this._transition!==_ut.SPRITE||this._hoverSprite)&&(this._hovered||(this._hovered=!0,this._updateState()))},i._onMouseMoveOut=function(){this._hovered&&(this._hovered=!1,this._updateState())},i._updateState=function(){var t=this._getButtonState();this._applyTransition(t)},i._getButtonState=function(){var t=dut.NORMAL;return this._interactable?this._pressed?t=dut.PRESSED:this._hovered&&(t=dut.HOVER):t=dut.DISABLED,t},i._updateColorTransition=function(t){var e,i=this._getColorByState(t),n=null===(e=this.target)||void 0===e?void 0:e.getComponent(WN);n&&(t===dut.DISABLED?(n.color=i,this._transitionFinished=!0):(this._fromColor=n.color.clone(),this._toColor=i,this._time=0,this._transitionFinished=!1))},i._updateSpriteTransition=function(t){var e=this._getSpriteFrameByState(t);this._sprite&&e&&(this._sprite.spriteFrame=e)},i._updateScaleTransition=function(t){this._interactable&&(t===dut.PRESSED?this._zoomUp():this._zoomBack())},i._zoomUp=function(){this._originalScale&&(_n.copy(this._fromScale,this._originalScale),_n.multiplyScalar(this._toScale,this._originalScale,this._zoomScale),this._time=0,this._transitionFinished=!1)},i._zoomBack=function(){this.target&&this._originalScale&&(_n.copy(this._fromScale,this.target.scale),_n.copy(this._toScale,this._originalScale),this._time=0,this._transitionFinished=!1)},i._applyTransition=function(t){var e=this._transition;e===_ut.COLOR?this._updateColorTransition(t):e===_ut.SPRITE?this._updateSpriteTransition(t):e===_ut.SCALE&&this._updateScaleTransition(t)},i._getSpriteFrameByState=function(t){switch(t){case dut.NORMAL:return this._normalSprite;case dut.DISABLED:return this._disabledSprite;case dut.HOVER:return this.hoverSprite;case dut.PRESSED:return this._pressedSprite;default:return null}},i._getColorByState=function(t){switch(t){case dut.NORMAL:return this._normalColor;case dut.DISABLED:return this._disabledColor;case dut.HOVER:return this._hoverColor;case dut.PRESSED:return this._pressedColor;default:return new yn}},i._xrHoverEnter=function(){this._onMouseMoveIn(),this._updateState()},i._xrHoverExit=function(){this._onMouseMoveOut(),this._pressed&&(this._pressed=!1,this._updateState())},i._xrClick=function(){this._interactable&&this.enabledInHierarchy&&(this._pressed=!0,this._updateState())},i._xrUnClick=function(){this._interactable&&this.enabledInHierarchy&&(this._pressed&&(Rp.emitEvents(this.clickEvents,this),this.node.emit(fut.CLICK,this)),this._pressed=!1,this._updateState())},n(e,[{key:"target",get:function(){return this._target||this.node},set:function(t){this._target!==t&&(this._target&&this._unregisterTargetEvent(this._target),this._target=t,this._applyTarget())}},{key:"interactable",get:function(){return this._interactable},set:function(t){this._interactable!==t&&(this._interactable=t,this._updateState(),this._interactable||this._resetState())}},{key:"_resizeToTarget",set:function(t){t&&this._resizeNodeToTargetNode()}},{key:"transition",get:function(){return this._transition},set:function(t){this._transition!==t&&(this._transition===_ut.COLOR?this._updateColorTransition(dut.NORMAL):this._transition===_ut.SPRITE&&this._updateSpriteTransition(dut.NORMAL),this._transition=t,this._updateState())}},{key:"normalColor",get:function(){return this._normalColor},set:function(t){this._normalColor!==t&&(this._normalColor.set(t),this._updateState())}},{key:"pressedColor",get:function(){return this._pressedColor},set:function(t){this._pressedColor!==t&&this._pressedColor.set(t)}},{key:"hoverColor",get:function(){return this._hoverColor},set:function(t){this._hoverColor!==t&&this._hoverColor.set(t)}},{key:"disabledColor",get:function(){return this._disabledColor},set:function(t){this._disabledColor!==t&&(this._disabledColor.set(t),this._updateState())}},{key:"duration",get:function(){return this._duration},set:function(t){this._duration!==t&&(this._duration=t)}},{key:"zoomScale",get:function(){return this._zoomScale},set:function(t){this._zoomScale!==t&&(this._zoomScale=t)}},{key:"normalSprite",get:function(){return this._normalSprite},set:function(t){if(this._normalSprite!==t){this._normalSprite=t;var e=this.node.getComponent(PF);e&&(e.spriteFrame=t),this._updateState()}}},{key:"pressedSprite",get:function(){return this._pressedSprite},set:function(t){this._pressedSprite!==t&&(this._pressedSprite=t,this._updateState())}},{key:"hoverSprite",get:function(){return this._hoverSprite},set:function(t){this._hoverSprite!==t&&(this._hoverSprite=t,this._updateState())}},{key:"disabledSprite",get:function(){return this._disabledSprite},set:function(t){this._disabledSprite!==t&&(this._disabledSprite=t,this._updateState())}}]),e}(xp)).Transition=_ut,iut.EventType=fut,f((Hht=iut).prototype,"target",[Mht],Object.getOwnPropertyDescriptor(Hht.prototype,"target"),Hht.prototype),f(Hht.prototype,"transition",[Nht],Object.getOwnPropertyDescriptor(Hht.prototype,"transition"),Hht.prototype),f(Hht.prototype,"normalSprite",[Lht],Object.getOwnPropertyDescriptor(Hht.prototype,"normalSprite"),Hht.prototype),f(Hht.prototype,"pressedSprite",[Bht],Object.getOwnPropertyDescriptor(Hht.prototype,"pressedSprite"),Hht.prototype),f(Hht.prototype,"hoverSprite",[Fht],Object.getOwnPropertyDescriptor(Hht.prototype,"hoverSprite"),Hht.prototype),f(Hht.prototype,"disabledSprite",[kht],Object.getOwnPropertyDescriptor(Hht.prototype,"disabledSprite"),Hht.prototype),zht=ua(Hht.prototype,"clickEvents",[Uht,wa],(function(){return[]})),Vht=ua(Hht.prototype,"_interactable",[wa],(function(){return!0})),Wht=ua(Hht.prototype,"_transition",[wa],(function(){return _ut.NONE})),Xht=ua(Hht.prototype,"_normalColor",[wa],(function(){return yn.WHITE.clone()})),jht=ua(Hht.prototype,"_hoverColor",[wa],(function(){return new yn(211,211,211,255)})),Yht=ua(Hht.prototype,"_pressedColor",[wa],(function(){return yn.WHITE.clone()})),Kht=ua(Hht.prototype,"_disabledColor",[wa],(function(){return new yn(124,124,124,255)})),qht=ua(Hht.prototype,"_normalSprite",[wa],(function(){return null})),Qht=ua(Hht.prototype,"_hoverSprite",[wa],(function(){return null})),Zht=ua(Hht.prototype,"_pressedSprite",[wa],(function(){return null})),Jht=ua(Hht.prototype,"_disabledSprite",[wa],(function(){return null})),$ht=ua(Hht.prototype,"_duration",[wa],(function(){return.1})),tut=ua(Hht.prototype,"_zoomScale",[wa],(function(){return 1.2})),eut=ua(Hht.prototype,"_target",[wa],(function(){return null})),Ght=Hht))||Ght)||Ght)||Ght);t({Button:gut,ButtonComponent:gut}),m.Button=gut;var mut,vut,yut,Tut=function(){function t(){}return t.add=function(t){var e=this._tabIndexList;-1===e.indexOf(t)&&e.push(t)},t.remove=function(t){var e=this._tabIndexList,i=e.indexOf(t);-1!==i&&e.splice(i,1)},t.resort=function(){this._tabIndexList.sort((function(t,e){return t._delegate.tabIndex-e._delegate.tabIndex}))},t.next=function(t){var e=this._tabIndexList,i=e.indexOf(t);if(t.setFocus(!1),-1!==i){var n=e[i+1];n&&n._delegate.tabIndex>=0&&n.setFocus(!0)}},t}();Tut._tabIndexList=[],function(t){t[t.DEFAULT=0]="DEFAULT",t[t.DONE=1]="DONE",t[t.SEND=2]="SEND",t[t.SEARCH=3]="SEARCH",t[t.GO=4]="GO",t[t.NEXT=5]="NEXT"}(mut||(mut={})),ye(mut),function(t){t[t.ANY=0]="ANY",t[t.EMAIL_ADDR=1]="EMAIL_ADDR",t[t.NUMERIC=2]="NUMERIC",t[t.PHONE_NUMBER=3]="PHONE_NUMBER",t[t.URL=4]="URL",t[t.DECIMAL=5]="DECIMAL",t[t.SINGLE_LINE=6]="SINGLE_LINE"}(vut||(vut={})),ye(vut),function(t){t[t.PASSWORD=0]="PASSWORD",t[t.SENSITIVE=1]="SENSITIVE",t[t.INITIAL_CAPS_WORD=2]="INITIAL_CAPS_WORD",t[t.INITIAL_CAPS_SENTENCE=3]="INITIAL_CAPS_SENTENCE",t[t.INITIAL_CAPS_ALL_CHARACTERS=4]="INITIAL_CAPS_ALL_CHARACTERS",t[t.DEFAULT=5]="DEFAULT"}(yut||(yut={})),ye(yut);var Eut,Sut,Aut,but,Cut,Rut,wut,Iut,xut,Dut,Out,Put,Mut,Nut,Lut,But,Fut,kut,Uut,Gut,Hut,zut,Vut,Wut,Xut,jut,Yut,Kut,qut,Qut,Zut=function(){function t(){this._editing=!1,this._delegate=null}var e=t.prototype;return e.init=function(){},e.onEnable=function(){},e.beforeDraw=function(){},e.onDisable=function(){this._editing&&this.endEditing()},e.clear=function(){this._delegate=null},e.setTabIndex=function(){},e.setSize=function(){},e.setFocus=function(t){t?this.beginEditing():this.endEditing()},e.isFocused=function(){return this._editing},e.beginEditing=function(){},e.endEditing=function(){},t}(),Jut=y.document,$ut=new Ln,tct=new Ln,ect=new _n,ict=null,nct=0;!function(t){function e(){var e;return(e=t.call(this)||this)._delegate=null,e._inputMode=-1,e._inputFlag=-1,e._returnType=-1,e.__eventListeners={},e.__autoResize=!1,e.__orientationChanged=void 0,e._edTxt=null,e._isTextArea=!1,e._textLabelFont=null,e._textLabelFontSize=null,e._textLabelFontColor=null,e._textLabelAlign=null,e._placeholderLabelFont=null,e._placeholderLabelFontSize=null,e._placeholderLabelFontColor=null,e._placeholderLabelAlign=null,e._placeholderLineHeight=null,e._placeholderStyleSheet=null,e._domId="EditBoxId_"+ ++nct,e._forceUpdate=!1,e}s(e,t);var i=e.prototype;i.init=function(t){t&&(this._delegate=t,t.inputMode===vut.ANY?this._createTextArea():this._createInput(),Tut.add(this),this.setTabIndex(t.tabIndex),this._initStyleSheet(),this._registerEventListeners(),this._addDomToGameContainer(),uO.instance.on("canvas-resize",this._resize,this),No.on("window-resize",this._resize,this))},i.clear=function(){uO.instance.off("canvas-resize",this._resize,this),No.off("window-resize",this._resize,this),this._removeEventListeners(),this._removeDomFromGameContainer(),Tut.remove(this),ict===this&&(ict=null),this._delegate=null},i._resize=function(){this._forceUpdate=!0},i.beforeDraw=function(){(this._delegate.node.hasChangedFlags||this._forceUpdate)&&(this._forceUpdate=!1,this._updateMatrix())},i.setTabIndex=function(t){this._edTxt.tabIndex=t,Tut.resort()},i.setSize=function(t,e){var i=this._edTxt;i&&(i.style.width=t+"px",i.style.height=e+"px")},i.beginEditing=function(){ict&&ict!==this&&ict.setFocus(!1),this._editing=!0,ict=this,this._delegate._editBoxEditingDidBegan(),this._showDom(),this._edTxt.focus()},i.endEditing=function(){this._edTxt.blur()},i._createInput=function(){this._isTextArea=!1,this._edTxt=Jut.createElement("input")},i._createTextArea=function(){this._isTextArea=!0,this._edTxt=Jut.createElement("textarea")},i._addDomToGameContainer=function(){bO.container&&this._edTxt&&(bO.container.appendChild(this._edTxt),Jut.head.appendChild(this._placeholderStyleSheet))},i._removeDomFromGameContainer=function(){Fe(bO.container,this._edTxt)&&this._edTxt&&bO.container.removeChild(this._edTxt),Fe(Jut.head,this._placeholderStyleSheet)&&Jut.head.removeChild(this._placeholderStyleSheet),this._edTxt=null,this._placeholderStyleSheet=null},i._showDom=function(){this._updateMaxLength(),this._updateInputType(),this._updateStyleSheet(),this._edTxt&&this._delegate&&(this._edTxt.style.display="",this._delegate._hideLabels()),Fo.isMobile&&this._showDomOnMobile()},i._hideDom=function(){var t=this._edTxt;t&&this._delegate&&(t.style.display="none",this._delegate._showLabels()),Fo.isMobile&&this._hideDomOnMobile()},i._showDomOnMobile=function(){Fo.os!==co.ANDROID&&Fo.os!==co.OHOS||(No.handleResizeEvent=!1,this._adjustWindowScroll())},i._hideDomOnMobile=function(){Fo.os!==co.ANDROID&&Fo.os!==co.OHOS||(No.handleResizeEvent=!0),this._scrollBackWindow()},i._isElementInViewport=function(){if(this._edTxt){var t=this._edTxt.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=(y.innerHeight||Jut.documentElement.clientHeight)&&t.right<=(y.innerWidth||Jut.documentElement.clientWidth)}return!1},i._adjustWindowScroll=function(){var t=this;setTimeout((function(){y.scrollY<40&&!t._isElementInViewport()&&t._edTxt.scrollIntoView({block:"start",inline:"nearest",behavior:"smooth"})}),400)},i._scrollBackWindow=function(){setTimeout((function(){Fo.browserType!==ao.WECHAT||Fo.os!==co.IOS?y.scrollTo(0,0):y.top&&y.top.scrollTo(0,0)}),400)},i._updateMatrix=function(){if(this._edTxt){var t=this._delegate.node,e=TO.getScaleX(),i=TO.getScaleY(),n=TO.getViewportRect(),r=No.devicePixelRatio;t.getWorldMatrix($ut);var s=t._uiProps.uiTransformComp;if(s&&(_n.set(ect,-s.anchorX*s.width,-s.anchorY*s.height,ect.z),Ln.transform($ut,$ut,ect)),t._uiProps.uiTransformComp){var o=DD.root.batcher2D.getFirstRenderCamera(t);if(o){o.node.getWorldRT(tct);var a=tct.m12,h=tct.m13,u=ko.center;tct.m12=u.x-(tct.m00*a+tct.m04*h),tct.m13=u.y-(tct.m01*a+tct.m05*h),e/=r,i/=r,_n.set(ect,e,i,1),Ln.scale(tct,tct,ect);var c=bO.container,l=parseInt(c&&c.style.paddingLeft||"0");l+=n.x/r;var _=parseInt(c&&c.style.paddingBottom||"0");_+=n.y/r,tct.m12+=l,tct.m13+=_,Ln.multiply(tct,tct,$ut);var d="matrix("+tct.m00+","+-tct.m01+","+-tct.m04+","+tct.m05+","+tct.m12+","+-tct.m13+")";this._edTxt.style.transform=d,this._edTxt.style["-webkit-transform"]=d,this._edTxt.style["transform-origin"]="0px 100% 0px",this._edTxt.style["-webkit-transform-origin"]="0px 100% 0px"}}}},i._updateInputType=function(){var t=this._delegate,e=t.inputMode,i=t.inputFlag,n=t.returnType,r=this._edTxt;if(this._inputMode!==e||this._inputFlag!==i||this._returnType!==n){if(this._inputMode=e,this._inputFlag=i,this._returnType=n,this._isTextArea){var s="none";return i===yut.INITIAL_CAPS_ALL_CHARACTERS?s="uppercase":i===yut.INITIAL_CAPS_WORD&&(s="capitalize"),void(r.style.textTransform=s)}if(r=r,i===yut.PASSWORD)return r.type="password",void(r.style.textTransform="none");var o=r.type;e===vut.EMAIL_ADDR?o="email":e===vut.NUMERIC?o="number":e===vut.DECIMAL?o="digit":e===vut.PHONE_NUMBER?(o="tel",r.addEventListener("wheel",(function(){return!1}))):e===vut.URL?o="url":(o="text",n===mut.SEARCH&&(o="search")),r.type=o;var a="none";i===yut.INITIAL_CAPS_ALL_CHARACTERS?a="uppercase":i===yut.INITIAL_CAPS_WORD&&(a="capitalize"),r.style.textTransform=a}},i._updateMaxLength=function(){var t=this._delegate.maxLength;t<0&&(t=65535),this._edTxt.maxLength=t},i._initStyleSheet=function(){if(this._edTxt){var t=this._edTxt;t.style.color="#000000",t.style.border="0px",t.style.background="transparent",t.style.width="100%",t.style.height="100%",t.style.outline="medium",t.style.padding="0",t.style.textTransform="none",t.style.display="none",t.style.position="absolute",t.style.bottom="0px",t.style.left="2px",t.className="cocosEditBox",t.style.fontFamily="Arial",t.id=this._domId,this._isTextArea?(t.style.resize="none",t.style.overflowY="scroll"):((t=t).type="text",t.style["-moz-appearance"]="textfield"),this._placeholderStyleSheet=Jut.createElement("style")}},i._updateStyleSheet=function(){var t=this._delegate,e=this._edTxt;e&&t&&(e.value=t.string,this._updateTextLabel(t.textLabel))},i._updateTextLabel=function(t){if(t){var e=t.font;e=!e||e instanceof TM?t.fontFamily:e._fontFamily;var i=t.fontSize*t.node.scale.y;if((this._textLabelFont!==e||this._textLabelFontSize!==i||this._textLabelFontColor!==t.fontColor||this._textLabelAlign!==t.horizontalAlign)&&(this._textLabelFont=e,this._textLabelFontSize=i,this._textLabelFontColor=t.fontColor,this._textLabelAlign=t.horizontalAlign,this._edTxt)){var n=this._edTxt;switch(n.style.fontSize=i+"px",n.style.color=t.color.toCSS(),n.style.fontFamily=e,t.horizontalAlign){case ML.HorizontalAlign.LEFT:n.style.textAlign="left";break;case ML.HorizontalAlign.CENTER:n.style.textAlign="center";break;case ML.HorizontalAlign.RIGHT:n.style.textAlign="right"}}}},i._updatePlaceholderLabel=function(t){if(t){var e=t.font;e=!e||e instanceof TM?t.fontFamily:t.font._fontFamily;var i=t.fontSize*t.node.scale.y;if(this._placeholderLabelFont!==e||this._placeholderLabelFontSize!==i||this._placeholderLabelFontColor!==t.fontColor||this._placeholderLabelAlign!==t.horizontalAlign||this._placeholderLineHeight!==t.fontSize){this._placeholderLabelFont=e,this._placeholderLabelFontSize=i,this._placeholderLabelFontColor=t.fontColor,this._placeholderLabelAlign=t.horizontalAlign,this._placeholderLineHeight=t.fontSize;var n=this._placeholderStyleSheet,r=t.color.toCSS(),s=t.fontSize,o="";switch(t.horizontalAlign){case ML.HorizontalAlign.LEFT:o="left";break;case ML.HorizontalAlign.CENTER:o="center";break;case ML.HorizontalAlign.RIGHT:o="right"}n.innerHTML="#"+this._domId+"::-webkit-input-placeholder{text-transform: initial;-family: "+e+";font-size: "+i+"px;color: "+r+";line-height: "+s+"px;text-align: "+o+";}#"+this._domId+"::-moz-placeholder{text-transform: initial;-family: "+e+";font-size: "+i+"px;color: "+r+";line-height: "+s+"px;text-align: "+o+";}#"+this._domId+"::-ms-input-placeholder{text-transform: initial;-family: "+e+";font-size: "+i+"px;color: "+r+";line-height: "+s+"px;text-align: "+o+";}",Fo.browserType===ao.EDGE&&(n.innerHTML+="#"+this._domId+"::-ms-clear{display: none;}")}}},i._registerEventListeners=function(){var t=this;if(this._edTxt){var e=this._edTxt,i=!1,n=this.__eventListeners;n.compositionStart=function(){i=!0},n.compositionEnd=function(){i=!1,t._delegate._editBoxTextChanged(e.value)},n.onInput=function(){if(!i){var n=t._delegate,r=n.maxLength;r>=0&&(e.value=e.value.slice(0,r)),n._editBoxTextChanged(e.value)}},n.onClick=function(){t._editing&&Fo.isMobile&&t._adjustWindowScroll()},n.onKeydown=function(i){i.keyCode===iw.ENTER?(i.propagationStopped=!0,t._delegate._editBoxEditingReturn(),t._isTextArea||e.blur()):i.keyCode===iw.TAB&&(i.propagationStopped=!0,i.preventDefault(),Tut.next(t))},n.onBlur=function(){Fo.isMobile&&i&&n.compositionEnd(),t._editing=!1,ict=null,t._hideDom(),t._delegate._editBoxEditingDidEnded()},e.addEventListener("compositionstart",n.compositionStart),e.addEventListener("compositionend",n.compositionEnd),e.addEventListener("input",n.onInput),e.addEventListener("keydown",n.onKeydown),e.addEventListener("blur",n.onBlur),e.addEventListener("touchstart",n.onClick)}},i._removeEventListeners=function(){if(this._edTxt){var t=this._edTxt,e=this.__eventListeners;t.removeEventListener("compositionstart",e.compositionStart),t.removeEventListener("compositionend",e.compositionEnd),t.removeEventListener("input",e.onInput),t.removeEventListener("keydown",e.onKeydown),t.removeEventListener("blur",e.onBlur),t.removeEventListener("touchstart",e.onClick),e.compositionStart=null,e.compositionEnd=null,e.onInput=null,e.onKeydown=null,e.onBlur=null,e.onClick=null}}}(Zut),function(t){t.EDITING_DID_BEGAN="editing-did-began",t.EDITING_DID_ENDED="editing-did-ended",t.TEXT_CHANGED="text-changed",t.EDITING_RETURN="editing-return",t.XR_EDITING_DID_BEGAN="xr-editing-did-began",t.XR_EDITING_DID_ENDED="xr-editing-did-ended"}(Qut||(Qut={}));var rct,sct,oct,act,hct,uct,cct,lct,_ct,dct,fct,pct,gct,mct,vct,yct,Tct,Ect,Sct,Act,bct,Cct,Rct,wct,Ict,xct,Dct,Oct,Pct,Mct,Nct,Lct,Bct,Fct,kct=(Eut=va("cc.EditBox"),Sut=Ta(110),Aut=ya(RN),but=Za(ML),Cut=Za(ML),Rut=Za(TP),wut=Za(yut),Iut=Za(vut),xut=Za(mut),Dut=Za([Rp]),Out=Za([Rp]),Put=Za([Rp]),Mut=Za([Rp]),Eut(Nut=Sut(Nut=Aut(((qut=function(t){function e(){var e;return(e=t.call(this)||this).editingDidBegan=But&&But(),e.textChanged=Fut&&Fut(),e.editingDidEnded=kut&&kut(),e.editingReturn=Uut&&Uut(),e._impl=null,e._background=null,e._textLabel=Gut&&Gut(),e._placeholderLabel=Hut&&Hut(),e._returnType=zut&&zut(),e._string=Vut&&Vut(),e._tabIndex=Wut&&Wut(),e._backgroundImage=Xut&&Xut(),e._inputFlag=jut&&jut(),e._inputMode=Yut&&Yut(),e._maxLength=Kut&&Kut(),e._isLabelVisible=!1,e}s(e,t);var i=e.prototype;return i.__preload=function(){this._init()},i.onEnable=function(){this._registerEvent(),this._ensureBackgroundSprite(),this._impl&&this._impl.onEnable()},i._beforeDraw=function(){this._impl&&this._impl.beforeDraw()},i.onDisable=function(){this._unregisterEvent(),this._unregisterBackgroundEvent(),this._impl&&this._impl.onDisable()},i.onDestroy=function(){DD.off(ID.EVENT_BEFORE_DRAW,this._beforeDraw,this),this._impl&&this._impl.clear()},i.setFocus=function(){this._impl&&this._impl.setFocus(!0)},i.focus=function(){this._impl&&this._impl.setFocus(!0)},i.blur=function(){this._impl&&this._impl.setFocus(!1)},i.isFocused=function(){return!!this._impl&&this._impl.isFocused()},i._editBoxEditingDidBegan=function(){Rp.emitEvents(this.editingDidBegan,this),this.node.emit(Qut.EDITING_DID_BEGAN,this)},i._editBoxEditingDidEnded=function(t){Rp.emitEvents(this.editingDidEnded,this),this.node.emit(Qut.EDITING_DID_ENDED,this,t)},i._editBoxTextChanged=function(t){t=this._updateLabelStringStyle(t,!0),this.string=t,Rp.emitEvents(this.textChanged,t,this),this.node.emit(Qut.TEXT_CHANGED,this)},i._editBoxEditingReturn=function(t){Rp.emitEvents(this.editingReturn,this),this.node.emit(Qut.EDITING_RETURN,this,t)},i._showLabels=function(){this._isLabelVisible=!0,this._updateLabels()},i._hideLabels=function(){this._isLabelVisible=!1,this._textLabel&&(this._textLabel.node.active=!1),this._placeholderLabel&&(this._placeholderLabel.node.active=!1)},i._onTouchBegan=function(t){t.propagationStopped=!0},i._onTouchCancel=function(t){t.propagationStopped=!0},i._onTouchEnded=function(t){this._impl&&this._impl.beginEditing(),t.propagationStopped=!0},i._init=function(){this._updatePlaceholderLabel(),this._updateTextLabel(),this._isLabelVisible=!0,this.node.on(Dg.SIZE_CHANGED,this._resizeChildNodes,this),DD.on(ID.EVENT_BEFORE_DRAW,this._beforeDraw,this),(this._impl=new e._EditBoxImpl).init(this),this._updateString(this._string),this._syncSize()},i._ensureBackgroundSprite=function(){if(!this._background){var t=this.node.getComponent(PF);t||(t=this.node.addComponent(PF)),t!==this._background&&(t.type=PF.Type.SLICED,t.spriteFrame=this._backgroundImage,this._background=t,this._registerBackgroundEvent())}},i._updateTextLabel=function(){var t=this._textLabel;if(!t){var e=this.node.getChildByName("TEXT_LABEL");e||((e=new Tm("TEXT_LABEL")).layer=this.node.layer),(t=e.getComponent(ML))||(t=e.addComponent(ML)),e.parent=this.node,this._textLabel=t}this._inputMode===vut.ANY?(t.verticalAlign=RL.TOP,t.enableWrapText=!0):t.enableWrapText=!1,t.string=this._updateLabelStringStyle(this._string)},i._updatePlaceholderLabel=function(){var t=this._placeholderLabel;if(!t){var e=this.node.getChildByName("PLACEHOLDER_LABEL");e||((e=new Tm("PLACEHOLDER_LABEL")).layer=this.node.layer),(t=e.getComponent(ML))||(t=e.addComponent(ML)),e.parent=this.node,this._placeholderLabel=t}this._inputMode===vut.ANY?t.enableWrapText=!0:t.enableWrapText=!1,t.string=this.placeholder},i._syncSize=function(){var t=this.node._uiProps.uiTransformComp,e=t.contentSize;if(this._background){var i=this._background.node._uiProps.uiTransformComp;i.anchorPoint=t.anchorPoint,i.setContentSize(e)}this._updateLabelPosition(e),this._impl&&this._impl.setSize(e.width,e.height)},i._updateLabels=function(){if(this._isLabelVisible){var t=this._string;this._textLabel&&(this._textLabel.node.active=""!==t),this._placeholderLabel&&(this._placeholderLabel.node.active=""===t)}},i._updateString=function(t){var e=this._textLabel;if(e){var i=t;i&&(i=this._updateLabelStringStyle(i)),e.string=i,this._updateLabels()}},i._updateLabelStringStyle=function(t,e){void 0===e&&(e=!1);var i,n=this._inputFlag;if(e||n!==yut.PASSWORD)n===yut.INITIAL_CAPS_ALL_CHARACTERS?t=t.toUpperCase():n===yut.INITIAL_CAPS_WORD?t=t.replace(/(?:^|\s)\S/g,(function(t){return t.toUpperCase()})):n===yut.INITIAL_CAPS_SENTENCE&&(t=(i=t).charAt(0).toUpperCase()+i.slice(1));else{for(var r="",s=t.length,o=0;o=0&&t.length>=this._maxLength&&(t=t.slice(0,this._maxLength)),this._string!==t&&(this._string=t,this._updateString(t))}},{key:"placeholder",get:function(){return this._placeholderLabel?this._placeholderLabel.string:""},set:function(t){this._placeholderLabel&&(this._placeholderLabel.string=t)}},{key:"textLabel",get:function(){return this._textLabel},set:function(t){this._textLabel!==t&&(this._textLabel=t,this._textLabel&&(this._updateTextLabel(),this._updateLabels()))}},{key:"placeholderLabel",get:function(){return this._placeholderLabel},set:function(t){this._placeholderLabel!==t&&(this._placeholderLabel=t,this._placeholderLabel&&(this._updatePlaceholderLabel(),this._updateLabels()))}},{key:"backgroundImage",get:function(){return this._backgroundImage},set:function(t){this._backgroundImage!==t&&(this._backgroundImage=t,this._ensureBackgroundSprite(),this._background.spriteFrame=t)}},{key:"inputFlag",get:function(){return this._inputFlag},set:function(t){this._inputFlag!==t&&(this._inputFlag=t,this._updateString(this._string))}},{key:"inputMode",get:function(){return this._inputMode},set:function(t){this._inputMode!==t&&(this._inputMode=t,this._updateTextLabel(),this._updatePlaceholderLabel())}},{key:"returnType",get:function(){return this._returnType},set:function(t){this._returnType=t}},{key:"maxLength",get:function(){return this._maxLength},set:function(t){this._maxLength=t}},{key:"tabIndex",get:function(){return this._tabIndex},set:function(t){this._tabIndex!==t&&(this._tabIndex=t,this._impl&&this._impl.setTabIndex(t))}}]),e}(xp))._EditBoxImpl=Zut,qut.KeyboardReturnType=mut,qut.InputFlag=yut,qut.InputMode=vut,qut.EventType=Qut,f((Lut=qut).prototype,"textLabel",[but],Object.getOwnPropertyDescriptor(Lut.prototype,"textLabel"),Lut.prototype),f(Lut.prototype,"placeholderLabel",[Cut],Object.getOwnPropertyDescriptor(Lut.prototype,"placeholderLabel"),Lut.prototype),f(Lut.prototype,"backgroundImage",[Rut],Object.getOwnPropertyDescriptor(Lut.prototype,"backgroundImage"),Lut.prototype),f(Lut.prototype,"inputFlag",[wut],Object.getOwnPropertyDescriptor(Lut.prototype,"inputFlag"),Lut.prototype),f(Lut.prototype,"inputMode",[Iut],Object.getOwnPropertyDescriptor(Lut.prototype,"inputMode"),Lut.prototype),f(Lut.prototype,"returnType",[xut],Object.getOwnPropertyDescriptor(Lut.prototype,"returnType"),Lut.prototype),But=ua(Lut.prototype,"editingDidBegan",[Dut,wa],(function(){return[]})),Fut=ua(Lut.prototype,"textChanged",[Out,wa],(function(){return[]})),kut=ua(Lut.prototype,"editingDidEnded",[Put,wa],(function(){return[]})),Uut=ua(Lut.prototype,"editingReturn",[Mut,wa],(function(){return[]})),Gut=ua(Lut.prototype,"_textLabel",[wa],(function(){return null})),Hut=ua(Lut.prototype,"_placeholderLabel",[wa],(function(){return null})),zut=ua(Lut.prototype,"_returnType",[wa],(function(){return mut.DEFAULT})),Vut=ua(Lut.prototype,"_string",[wa],(function(){return""})),Wut=ua(Lut.prototype,"_tabIndex",[wa],(function(){return 0})),Xut=ua(Lut.prototype,"_backgroundImage",[wa],(function(){return null})),jut=ua(Lut.prototype,"_inputFlag",[wa],(function(){return yut.DEFAULT})),Yut=ua(Lut.prototype,"_inputMode",[wa],(function(){return vut.ANY})),Kut=ua(Lut.prototype,"_maxLength",[wa],(function(){return 20})),Nut=Lut))||Nut)||Nut)||Nut);t({EditBox:kct,EditBoxComponent:kct}),m.internal.EditBox=kct,function(t){t[t.NONE=0]="NONE",t[t.HORIZONTAL=1]="HORIZONTAL",t[t.VERTICAL=2]="VERTICAL",t[t.GRID=3]="GRID"}(Pct||(Pct={})),Se(Pct),function(t){t[t.NONE=0]="NONE",t[t.CONTAINER=1]="CONTAINER",t[t.CHILDREN=2]="CHILDREN"}(Mct||(Mct={})),Se(Mct),function(t){t[t.HORIZONTAL=0]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(Nct||(Nct={})),Se(Nct),function(t){t[t.BOTTOM_TO_TOP=0]="BOTTOM_TO_TOP",t[t.TOP_TO_BOTTOM=1]="TOP_TO_BOTTOM"}(Lct||(Lct={})),Se(Lct),function(t){t[t.LEFT_TO_RIGHT=0]="LEFT_TO_RIGHT",t[t.RIGHT_TO_LEFT=1]="RIGHT_TO_LEFT"}(Bct||(Bct={})),Se(Bct),function(t){t[t.NONE=0]="NONE",t[t.FIXED_ROW=1]="FIXED_ROW",t[t.FIXED_COL=2]="FIXED_COL"}(Fct||(Fct={})),Se(Fct);var Uct,Gct,Hct,zct,Vct,Wct,Xct,jct,Yct,Kct,qct,Qct,Zct,Jct,$ct=new _n,tlt=(rct=va("cc.Layout"),sct=Ta(110),oct=ya(RN),act=Za(Pct),hct=Za(Mct),uct=Za(Nct),cct=Za(Lct),lct=Za(Bct),_ct=Za(Fct),rct(dct=sct(dct=oct(((Oct=function(t){function e(){var e;return(e=t.call(this)||this)._resizeMode=pct&&pct(),e._layoutType=gct&&gct(),e._cellSize=mct&&mct(),e._startAxis=vct&&vct(),e._paddingLeft=yct&&yct(),e._paddingRight=Tct&&Tct(),e._paddingTop=Ect&&Ect(),e._paddingBottom=Sct&&Sct(),e._spacingX=Act&&Act(),e._spacingY=bct&&bct(),e._verticalDirection=Cct&&Cct(),e._horizontalDirection=Rct&&Rct(),e._constraint=wct&&wct(),e._constraintNum=Ict&&Ict(),e._affectedByScale=xct&&xct(),e._isAlign=Dct&&Dct(),e._layoutSize=new Xn(300,200),e._layoutDirty=!0,e._childrenDirty=!1,e._usefulLayoutObj=[],e._init=!1,e}s(e,t);var i=e.prototype;return i.updateLayout=function(t){void 0===t&&(t=!1),(this._layoutDirty||t)&&(this._doLayout(),this._layoutDirty=!1)},i.onEnable=function(){this._addEventListeners();var t=this.node._uiProps.uiTransformComp;t.contentSize.equals(Xn.ZERO)&&t.setContentSize(this._layoutSize),this._childrenChanged()},i.onDisable=function(){this._usefulLayoutObj.length=0,this._removeEventListeners()},i._checkUsefulObj=function(){this._usefulLayoutObj.length=0;for(var t=this.node.children,e=0;e_&&(d=Math.max(_,d),l=_||w,_=w),u+=o*(C*R+this._spacingX);var I=o*(1-C)*R;if(e){if(s>0)(f=y/s>0&&y%s==0)&&(l=_>w?_:l);else if(R>t-m)u>h+o*C*R&&(f=!0);else{var x=(1-this._horizontalDirection-r.x)*t,D=u+I+o*(o>0?this._paddingRight:this._paddingLeft);f=Math.abs(D)>Math.abs(x)}f&&(u=h+o*C*R,w!==_&&(l=_),c+=l+this._spacingY,l=_=w)}var O=i(E,T,c);n&&E.setPosition(u,O),u+=I}return l=Math.max(l,_),Math.max(d,c+l)+this._getPaddingV()},i._doLayoutVertically=function(t,e,i,n){var r=this.node._uiProps.uiTransformComp.anchorPoint,s=this._getFixedBreakingNum(),o=1,a=this._paddingBottom;this._verticalDirection===Lct.TOP_TO_BOTTOM&&(o=-1,a=this._paddingTop);var h=(this._verticalDirection-r.y)*t+o*a,u=h-o*this._spacingY,c=0,l=0,_=0,d=0,f=!1,p=this._usefulLayoutObj.length,g=this._cellSize.height,m=this._getPaddingV();this._layoutType!==Pct.GRID&&this._resizeMode===Mct.CHILDREN&&(g=(t-m-(p-1)*this._spacingY)/p);for(var v=this._usefulLayoutObj,y=0;yc&&(l=Math.max(c,l),_=c||R,c=R),u+=o*(C*w+this._spacingY);var I=o*(1-C)*w;if(e){if(s>0)(f=y/s>0&&y%s==0)&&(_=c>w?c:_);else if(w>t-m)u>h+o*C*w&&(f=!0);else{var x=(1-this._verticalDirection-r.y)*t,D=u+I+o*(o>0?this._paddingTop:this._paddingBottom);f=Math.abs(D)>Math.abs(x)}f&&(u=h+o*C*w,R!==c&&(_=c),d+=_+this._spacingX,_=c=R)}var O=i(E,T,d);n&&(E.getPosition($ct),E.setPosition(O,u,$ct.z)),u+=I}return _=Math.max(_,c),Math.max(l,d+_)+this._getPaddingH()},i._doLayoutGridAxisHorizontal=function(t,e){var i=this,n=e.width,r=1,s=-t.y*e.height,o=this._paddingBottom;this._verticalDirection===Lct.TOP_TO_BOTTOM&&(r=-1,s=(1-t.y)*e.height,o=this._paddingTop);var a=function(t,e,n){return s+r*(n+(1-e.anchorY)*e.height*i._getUsedScaleValue(t.scale.y)+o)},h=0;this._resizeMode===Mct.CONTAINER&&(h=this._doLayoutHorizontally(n,!0,a,!1),s=-t.y*h,this._verticalDirection===Lct.TOP_TO_BOTTOM&&(r=-1,s=(1-t.y)*h)),this._doLayoutHorizontally(n,!0,a,!0),this._resizeMode===Mct.CONTAINER&&this.node._uiProps.uiTransformComp.setContentSize(n,h)},i._doLayoutGridAxisVertical=function(t,e){var i=this,n=e.height,r=1,s=-t.x*e.width,o=this._paddingLeft;this._horizontalDirection===Bct.RIGHT_TO_LEFT&&(r=-1,s=(1-t.x)*e.width,o=this._paddingRight);var a=function(t,e,n){return s+r*(n+(1-e.anchorX)*e.width*i._getUsedScaleValue(t.scale.x)+o)},h=0;this._resizeMode===Mct.CONTAINER&&(h=this._doLayoutVertically(n,!0,a,!1),s=-t.x*h,this._horizontalDirection===Bct.RIGHT_TO_LEFT&&(r=-1,s=(1-t.x)*h)),this._doLayoutVertically(n,!0,a,!0),this._resizeMode===Mct.CONTAINER&&this.node._uiProps.uiTransformComp.setContentSize(h,n)},i._doLayoutGrid=function(){var t=this.node._uiProps.uiTransformComp,e=t.anchorPoint,i=t.contentSize;this.startAxis===Nct.HORIZONTAL?this._doLayoutGridAxisHorizontal(e,i):this.startAxis===Nct.VERTICAL&&this._doLayoutGridAxisVertical(e,i)},i._getHorizontalBaseWidth=function(){var t=this._usefulLayoutObj,e=0,i=t.length;if(this._resizeMode===Mct.CONTAINER){for(var n=0;n0?n:-n)),i*(e/r)},i._calculatePosition=function(t,e,i,n,r,s,o){var a=e-i;s&&(a+=Math.abs(s));var h=0;a&&(h=Mi(h=r/a));var u=(n-o)*h;this._direction===plt.VERTICAL?t.set(0,u):t.set(u,0)},i._updateLength=function(t){if(this._handle){var e=this._handle.node._uiProps.uiTransformComp,i=e.contentSize,n=e.anchorPoint;n.x===ylt.x&&n.y===ylt.y||e.setAnchorPoint(ylt),this._direction===plt.HORIZONTAL?e.setContentSize(t,i.height):e.setContentSize(i.width,t)}},i._processAutoHide=function(t){if(this._enableAutoHide&&!(this._autoHideRemainingTime<=0)&&!this._touching&&(this._autoHideRemainingTime-=t,this._autoHideRemainingTime<=this._autoHideTime)){this._autoHideRemainingTime=Math.max(0,this._autoHideRemainingTime);var e=this._opacity*(this._autoHideRemainingTime/this._autoHideTime);this._setOpacity(e)}},n(e,[{key:"handle",get:function(){return this._handle},set:function(t){this._handle!==t&&(this._handle=t,this.onScroll(Hn.ZERO))}},{key:"direction",get:function(){return this._direction},set:function(t){this._direction!==t&&(this._direction=t,this.onScroll(Hn.ZERO))}},{key:"enableAutoHide",get:function(){return this._enableAutoHide},set:function(t){this._enableAutoHide!==t&&(this._enableAutoHide=t,this._enableAutoHide&&this._setOpacity(0))}},{key:"autoHideTime",get:function(){return this._autoHideTime},set:function(t){this._autoHideTime!==t&&(this._autoHideTime=t)}}]),e}(xp)).Direction=plt,f((alt=dlt).prototype,"handle",[rlt],Object.getOwnPropertyDescriptor(alt.prototype,"handle"),alt.prototype),f(alt.prototype,"direction",[slt],Object.getOwnPropertyDescriptor(alt.prototype,"direction"),alt.prototype),hlt=ua(alt.prototype,"_scrollView",[wa],(function(){return null})),ult=ua(alt.prototype,"_handle",[wa],(function(){return null})),clt=ua(alt.prototype,"_direction",[wa],(function(){return plt.HORIZONTAL})),llt=ua(alt.prototype,"_enableAutoHide",[wa],(function(){return!1})),_lt=ua(alt.prototype,"_autoHideTime",[wa],(function(){return 1})),olt=alt))||olt)||olt)||olt);t({ScrollBar:Alt,ScrollBarComponent:Alt}),m.ScrollBar=Alt;var blt,Clt,Rlt,wlt,Ilt,xlt,Dlt,Olt,Plt,Mlt,Nlt,Llt,Blt,Flt,klt,Ult,Glt,Hlt,zlt,Vlt,Wlt,Xlt=t("ViewGroup",va("cc.ViewGroup")(Slt=Ta(110)(Slt=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(xp))||Slt)||Slt);m.ViewGroup=Xlt;var jlt,Ylt,Klt=1e-4,qlt=new _n,Qlt=new _n,Zlt=new Hn,Jlt=new Hn,$lt=function(){return(new Date).getMilliseconds()},t_t={"scroll-to-top":0,"scroll-to-bottom":1,"scroll-to-left":2,"scroll-to-right":3,scrolling:4,"bounce-bottom":6,"bounce-left":7,"bounce-right":8,"bounce-top":5,"scroll-ended":9,"touch-up":10,"scroll-ended-with-threshold":11,"scroll-began":12};!function(t){t.NONE="",t.SCROLL_TO_TOP="scroll-to-top",t.SCROLL_TO_BOTTOM="scroll-to-bottom",t.SCROLL_TO_LEFT="scroll-to-left",t.SCROLL_TO_RIGHT="scroll-to-right",t.SCROLL_BEGAN="scroll-began",t.SCROLL_ENDED="scroll-ended",t.BOUNCE_TOP="bounce-top",t.BOUNCE_BOTTOM="bounce-bottom",t.BOUNCE_LEFT="bounce-left",t.BOUNCE_RIGHT="bounce-right",t.SCROLLING="scrolling",t.SCROLL_ENG_WITH_THRESHOLD="scroll-ended-with-threshold",t.TOUCH_UP="touch-up"}(jlt||(jlt={})),function(t){t[t.NONE=0]="NONE",t[t.LEFT=1]="LEFT",t[t.RIGHT=2]="RIGHT"}(Ylt||(Ylt={}));var e_t,i_t,n_t,r_t,s_t,o_t,a_t,h_t,u_t,c_t,l_t,__t,d_t,f_t=(blt=va("cc.ScrollView"),Clt=Ta(110),Rlt=ya(RN),wlt=Za(Tm),Ilt=Za(Alt),xlt=Za(Alt),Dlt=Za([Rp]),blt(Olt=Clt(Olt=Rlt(((Wlt=function(t){function e(){var e;return(e=t.call(this)||this).bounceDuration=Mlt&&Mlt(),e.brake=Nlt&&Nlt(),e.elastic=Llt&&Llt(),e.inertia=Blt&&Blt(),e.horizontal=Flt&&Flt(),e.vertical=klt&&klt(),e.cancelInnerEvents=Ult&&Ult(),e.scrollEvents=Glt&&Glt(),e._autoScrolling=!1,e._scrolling=!1,e._content=Hlt&&Hlt(),e._horizontalScrollBar=zlt&&zlt(),e._verticalScrollBar=Vlt&&Vlt(),e._topBoundary=0,e._bottomBoundary=0,e._leftBoundary=0,e._rightBoundary=0,e._touchMoveDisplacements=[],e._touchMoveTimeDeltas=[],e._touchMovePreviousTimestamp=0,e._touchMoved=!1,e._autoScrollAttenuate=!1,e._autoScrollStartPosition=new _n,e._autoScrollTargetDelta=new _n,e._autoScrollTotalTime=0,e._autoScrollAccumulatedTime=0,e._autoScrollCurrentlyOutOfBoundary=!1,e._autoScrollBraking=!1,e._autoScrollBrakingStartPosition=new _n,e._outOfBoundaryAmount=new _n,e._outOfBoundaryAmountDirty=!0,e._stopMouseWheel=!1,e._mouseWheelEventElapsedTime=0,e._isScrollEndedWithThresholdEventFired=!1,e._scrollEventEmitMask=0,e._isBouncing=!1,e._contentPos=new _n,e._deltaPos=new _n,e._deltaAmount=new _n,e._hoverIn=Ylt.NONE,e}s(e,t);var i=e.prototype;return i.scrollToBottom=function(t,e){void 0===e&&(e=!0);var i=this._calculateMovePercentDelta({anchor:new Hn(0,0),applyToHorizontal:!1,applyToVertical:!0});t?this._startAutoScroll(i,t,!1!==e):this._moveContent(i,!0)},i.scrollToTop=function(t,e){void 0===e&&(e=!0);var i=this._calculateMovePercentDelta({anchor:new Hn(0,1),applyToHorizontal:!1,applyToVertical:!0});t?this._startAutoScroll(i,t,!1!==e):this._moveContent(i)},i.scrollToLeft=function(t,e){void 0===e&&(e=!0);var i=this._calculateMovePercentDelta({anchor:new Hn(0,0),applyToHorizontal:!0,applyToVertical:!1});t?this._startAutoScroll(i,t,!1!==e):this._moveContent(i)},i.scrollToRight=function(t,e){void 0===e&&(e=!0);var i=this._calculateMovePercentDelta({anchor:new Hn(1,0),applyToHorizontal:!0,applyToVertical:!1});t?this._startAutoScroll(i,t,!1!==e):this._moveContent(i)},i.scrollToTopLeft=function(t,e){void 0===e&&(e=!0);var i=this._calculateMovePercentDelta({anchor:new Hn(0,1),applyToHorizontal:!0,applyToVertical:!0});t?this._startAutoScroll(i,t,!1!==e):this._moveContent(i)},i.scrollToTopRight=function(t,e){void 0===e&&(e=!0);var i=this._calculateMovePercentDelta({anchor:new Hn(1,1),applyToHorizontal:!0,applyToVertical:!0});t?this._startAutoScroll(i,t,!1!==e):this._moveContent(i)},i.scrollToBottomLeft=function(t,e){void 0===e&&(e=!0);var i=this._calculateMovePercentDelta({anchor:new Hn(0,0),applyToHorizontal:!0,applyToVertical:!0});t?this._startAutoScroll(i,t,!1!==e):this._moveContent(i)},i.scrollToBottomRight=function(t,e){void 0===e&&(e=!0);var i=this._calculateMovePercentDelta({anchor:new Hn(1,0),applyToHorizontal:!0,applyToVertical:!0});t?this._startAutoScroll(i,t,!1!==e):this._moveContent(i)},i.scrollToOffset=function(t,e,i){void 0===i&&(i=!0);var n=this.getMaxScrollOffset(),r=new Hn(0,0);0===n.x?r.x=0:r.x=t.x/n.x,0===n.y?r.y=1:r.y=(n.y-t.y)/n.y,this.scrollTo(r,e,i)},i.getScrollOffset=function(){var t=this._getContentTopBoundary()-this._topBoundary,e=this._getContentLeftBoundary()-this._leftBoundary;return new Hn(e,t)},i.getMaxScrollOffset=function(){if(!this._content||!this.view)return Hn.ZERO;var t=this._content._uiProps.uiTransformComp.contentSize,e=t.width-this.view.width,i=t.height-this.view.height;return new Hn(e=e>=0?e:0,i=i>=0?i:0)},i.scrollToPercentHorizontal=function(t,e,i){var n=this._calculateMovePercentDelta({anchor:new Hn(t,0),applyToHorizontal:!0,applyToVertical:!1});e?this._startAutoScroll(n,e,!1!==i):this._moveContent(n)},i.scrollTo=function(t,e,i){var n=this._calculateMovePercentDelta({anchor:new Hn(t),applyToHorizontal:!0,applyToVertical:!0});e?this._startAutoScroll(n,e,i):this._moveContent(n)},i.scrollToPercentVertical=function(t,e,i){var n=this._calculateMovePercentDelta({anchor:new Hn(0,t),applyToHorizontal:!1,applyToVertical:!0});e?this._startAutoScroll(n,e,i):this._moveContent(n)},i.stopAutoScroll=function(){this._autoScrolling=!1,this._autoScrollAccumulatedTime=this._autoScrollTotalTime},i.setContentPosition=function(t){this._setContentPosition(t)},i._setContentPosition=function(t){if(this._content){var e=this._getContentPosition();Math.abs(t.x-e.x)7&&!this._touchMoved&&t.target!==this.node){var r=new ew(t.getTouches(),t.bubbles,KR.TOUCH_CANCEL);r.touch=t.touch,r.simulate=!0,t.target.dispatchEvent(r),this._touchMoved=!0}this._stopPropagationIfTargetIsMe(t)}}},i._onTouchEnded=function(t,e){if(this.enabledInHierarchy&&this._content&&t&&!this._hasNestedViewGroup(t,e)){this._dispatchEvent(jlt.TOUCH_UP);var i=t.touch;this._handleReleaseLogic(i),this._touchMoved?t.propagationStopped=!0:this._stopPropagationIfTargetIsMe(t)}},i._onTouchCancelled=function(t,e){if(this.enabledInHierarchy&&this._content&&!this._hasNestedViewGroup(t,e)){if(t&&!t.simulate){var i=t.touch;this._handleReleaseLogic(i)}this._stopPropagationIfTargetIsMe(t)}},i._calculateBoundary=function(){if(this._content&&this.view){var t=this._content.getComponent(tlt);t&&t.enabledInHierarchy&&t.updateLayout();var e=this.view,i=e.width*e.anchorX,n=e.height*e.anchorY;this._leftBoundary=-i,this._bottomBoundary=-n,this._rightBoundary=this._leftBoundary+e.width,this._topBoundary=this._bottomBoundary+e.height,this._moveContentToTopLeft(e.contentSize)}},i._hasNestedViewGroup=function(t,e){if(!t||t.eventPhase!==QR.CAPTURING_PHASE)return!1;if(e)for(var i,n=d(e);!(i=n()).done;){var r=i.value;if(this.node===r)return!(!t.target||!t.target.getComponent(Xlt));if(r.getComponent(Xlt))return!0}return!1},i._startInertiaScroll=function(t){var e=new _n(t);e.multiplyScalar(.7),this._startAttenuatingAutoScroll(e,t)},i._calculateAttenuatedFactor=function(t){return this.brake<=0?1-this.brake:(1-this.brake)*(1/(1+14e-6*t+t*t*8e-9))},i._startAttenuatingAutoScroll=function(t,e){var i=t.clone();if(i.normalize(),this._content&&this.view){var n=this._content._uiProps.uiTransformComp.contentSize,r=this.view.contentSize,s=n.width-r.width,o=n.height-r.height,a=this._calculateAttenuatedFactor(s),h=this._calculateAttenuatedFactor(o);i.x=i.x*s*(1-this.brake)*a,i.y=i.y*o*h*(1-this.brake),i.z=0}var u=t.length(),c=i.length()/u;if(i.add(t),this.brake>0&&c>7){c=Math.sqrt(c);var l=t.clone();l.multiplyScalar(c),i.set(l),i.add(t)}var _=this._calculateAutoScrollTimeByInitialSpeed(e.length());this.brake>0&&c>3&&(_*=c=3),0===this.brake&&c>1&&(_*=c),this._startAutoScroll(i,_,!0)},i._calculateAutoScrollTimeByInitialSpeed=function(t){return Math.sqrt(Math.sqrt(t/5))},i._startAutoScroll=function(t,e,i){void 0===i&&(i=!1);var n=this._flattenVectorByDirection(t);this._autoScrolling=!0,this._autoScrollTargetDelta=n,this._autoScrollAttenuate=i,_n.copy(this._autoScrollStartPosition,this._getContentPosition()),this._autoScrollTotalTime=e,this._autoScrollAccumulatedTime=0,this._autoScrollBraking=!1,this._isScrollEndedWithThresholdEventFired=!1,this._autoScrollBrakingStartPosition.set(0,0,0),this._getHowMuchOutOfBoundary().equals(_n.ZERO,Klt)||(this._autoScrollCurrentlyOutOfBoundary=!0)},i._calculateTouchMoveVelocity=function(){var t=new _n,e=0;if((e=this._touchMoveTimeDeltas.reduce((function(t,e){return t+e}),e))<=0||e>=.5)t.set(_n.ZERO);else{var i=new _n;i=this._touchMoveDisplacements.reduce((function(t,e){return t.add(e),t}),i),t.set(i.x*(1-this.brake)/e,i.y*(1-this.brake)/e,i.z)}return t},i._flattenVectorByDirection=function(t){var e=t;return e.x=this.horizontal?e.x:0,e.y=this.vertical?e.y:0,e},i._moveContent=function(t,e){var i=this._flattenVectorByDirection(t);qlt.set(this._getContentPosition()),qlt.add(i),qlt.set(Math.round(1e4*qlt.x)*Klt,Math.round(1e4*qlt.y)*Klt,qlt.z),this._setContentPosition(qlt);var n=this._getHowMuchOutOfBoundary();Zlt.set(n.x,n.y),this._updateScrollBar(Zlt),this.elastic&&e&&this._startBounceBackIfNeeded()},i._getContentLeftBoundary=function(){if(!this._content)return-1;var t=this._getContentPosition(),e=this._content._uiProps.uiTransformComp;return t.x-e.anchorX*e.width},i._getContentRightBoundary=function(){if(!this._content)return-1;var t=this._content._uiProps.uiTransformComp;return this._getContentLeftBoundary()+t.width},i._getContentTopBoundary=function(){if(!this._content)return-1;var t=this._content._uiProps.uiTransformComp;return this._getContentBottomBoundary()+t.height},i._getContentBottomBoundary=function(){if(!this._content)return-1;var t=this._getContentPosition(),e=this._content._uiProps.uiTransformComp;return t.y-e.anchorY*e.height},i._getHowMuchOutOfBoundary=function(t){if((t=t||new _n).equals(_n.ZERO,Klt)&&!this._outOfBoundaryAmountDirty)return this._outOfBoundaryAmount;var e=new _n,i=this._getContentLeftBoundary(),n=this._getContentRightBoundary();i+t.x>this._leftBoundary?e.x=this._leftBoundary-(i+t.x):n+t.xthis._bottomBoundary&&(e.y=this._bottomBoundary-(s+t.y)),t.equals(_n.ZERO,Klt)&&(this._outOfBoundaryAmount=e,this._outOfBoundaryAmountDirty=!1),this._clampDelta(e),e},i._updateScrollBar=function(t){this._horizontalScrollBar&&this._horizontalScrollBar.isValid&&this._horizontalScrollBar.onScroll(t),this._verticalScrollBar&&this._verticalScrollBar.isValid&&this._verticalScrollBar.onScroll(t)},i._onScrollBarTouchBegan=function(){this._horizontalScrollBar&&this._horizontalScrollBar.isValid&&this._horizontalScrollBar.onTouchBegan(),this._verticalScrollBar&&this._verticalScrollBar.isValid&&this._verticalScrollBar.onTouchBegan()},i._onScrollBarTouchEnded=function(){this._horizontalScrollBar&&this._horizontalScrollBar.isValid&&this._horizontalScrollBar.onTouchEnded(),this._verticalScrollBar&&this._verticalScrollBar.isValid&&this._verticalScrollBar.onTouchEnded()},i._dispatchEvent=function(t){if(t===jlt.SCROLL_ENDED)this._scrollEventEmitMask=0;else if(t===jlt.SCROLL_TO_TOP||t===jlt.SCROLL_TO_BOTTOM||t===jlt.SCROLL_TO_LEFT||t===jlt.SCROLL_TO_RIGHT){var e=1<0?c.y-a*u+i.y>=this._bottomBoundary&&(n=jlt.SCROLL_TO_BOTTOM):i.y<0&&c.y-a*u+u+i.y<=this._topBoundary&&(n=jlt.SCROLL_TO_TOP)),this.horizontal&&(i.x<0?c.x-o*h+h+i.x<=this._rightBoundary&&(r=jlt.SCROLL_TO_RIGHT):i.x>0&&c.x-o*h+i.x>=this._leftBoundary&&(r=jlt.SCROLL_TO_LEFT))}this._moveContent(i,!1),(this.horizontal&&0!==i.x||this.vertical&&0!==i.y)&&(this._scrolling||(this._scrolling=!0,this._dispatchEvent(jlt.SCROLL_BEGAN)),this._dispatchEvent(jlt.SCROLLING)),n!==jlt.NONE&&this._dispatchEvent(n),r!==jlt.NONE&&this._dispatchEvent(r)},i._handlePressLogic=function(){this._autoScrolling&&this._dispatchEvent(jlt.SCROLL_ENDED),this._autoScrolling=!1,this._isBouncing=!1,this._touchMovePreviousTimestamp=$lt(),this._touchMoveDisplacements.length=0,this._touchMoveTimeDeltas.length=0,this._onScrollBarTouchBegan()},i._clampDelta=function(t){if(this._content&&this.view){var e=this.view.contentSize,i=this._content._uiProps.uiTransformComp;i.width=5;)this._touchMoveDisplacements.shift(),this._touchMoveTimeDeltas.shift();this._touchMoveDisplacements.push(e);var i=$lt();this._touchMoveTimeDeltas.push((i-this._touchMovePreviousTimestamp)/1e3),this._touchMovePreviousTimestamp=i},i._startBounceBackIfNeeded=function(){if(!this.elastic)return!1;var t=this._getHowMuchOutOfBoundary();if(this._clampDelta(t),t.equals(_n.ZERO,Klt))return!1;var e=Math.max(this.bounceDuration,0);return this._startAutoScroll(t,e,!0),this._isBouncing||(t.y>0&&this._dispatchEvent(jlt.BOUNCE_TOP),t.y<0&&this._dispatchEvent(jlt.BOUNCE_BOTTOM),t.x>0&&this._dispatchEvent(jlt.BOUNCE_RIGHT),t.x<0&&this._dispatchEvent(jlt.BOUNCE_LEFT),this._isBouncing=!0),!0},i._processInertiaScroll=function(){if(!this._startBounceBackIfNeeded()&&this.inertia){var t=this._calculateTouchMoveVelocity();!t.equals(qlt,Klt)&&this.brake<1&&this._startInertiaScroll(t)}this._onScrollBarTouchEnded()},i._isOutOfBoundary=function(){return!this._getHowMuchOutOfBoundary().equals(_n.ZERO,Klt)},i._isNecessaryAutoScrollBrake=function(){if(this._autoScrollBraking)return!0;if(this._isOutOfBoundary()){if(!this._autoScrollCurrentlyOutOfBoundary)return this._autoScrollCurrentlyOutOfBoundary=!0,this._autoScrollBraking=!0,_n.copy(this._autoScrollBrakingStartPosition,this._getContentPosition()),!0}else this._autoScrollCurrentlyOutOfBoundary=!1;return!1},i._processAutoScrolling=function(t){var e=this._isNecessaryAutoScrollBrake(),i=e?.05:1;this._autoScrollAccumulatedTime+=t*(1/i);var n,r=Math.min(1,this._autoScrollAccumulatedTime/this._autoScrollTotalTime);this._autoScrollAttenuate&&(n=r,r=(n-=1)*n*n*n*n+1);var s=this._autoScrollTargetDelta.clone();s.multiplyScalar(r);var o=this._autoScrollStartPosition.clone();o.add(s);var a=Math.abs(r-1)<=Klt;if(Math.abs(r-1)<=this.getScrollEndedEventTiming()&&!this._isScrollEndedWithThresholdEventFired&&(this._dispatchEvent(jlt.SCROLL_ENG_WITH_THRESHOLD),this._isScrollEndedWithThresholdEventFired=!0),this.elastic){var h=o.clone();h.subtract(this._autoScrollBrakingStartPosition),e&&h.multiplyScalar(i),o.set(this._autoScrollBrakingStartPosition),o.add(h)}else{var u=o.clone();u.subtract(this.getContentPosition());var c=this._getHowMuchOutOfBoundary(u);c.equals(_n.ZERO,Klt)||(o.add(c),a=!0)}a&&(this._autoScrolling=!1);var l=o.clone();l.subtract(this._getContentPosition()),this._clampDelta(l),this._moveContent(l,a),this._dispatchEvent(jlt.SCROLLING),this._autoScrolling||(this._isBouncing=!1,this._scrolling=!1,this._dispatchEvent(jlt.SCROLL_ENDED))},i._checkMouseWheel=function(t){if(!this._getHowMuchOutOfBoundary().equals(_n.ZERO,Klt))return this._processInertiaScroll(),this._scrolling&&(this._scrolling=!1,this._autoScrolling||this._dispatchEvent(jlt.SCROLL_ENDED)),this.unschedule(this._checkMouseWheel),void(this._stopMouseWheel=!1);this._mouseWheelEventElapsedTime+=t,this._mouseWheelEventElapsedTime>.1&&(this._onScrollBarTouchEnded(),this._scrolling&&(this._scrolling=!1,this._autoScrolling||this._dispatchEvent(jlt.SCROLL_ENDED)),this.unschedule(this._checkMouseWheel),this._stopMouseWheel=!1)},i._calculateMovePercentDelta=function(t){var e=t.anchor,i=t.applyToHorizontal,n=t.applyToVertical;this._calculateBoundary(),e.clampf(Hn.ZERO,Hn.ONE);var r=this._getContentBottomBoundary()-this._bottomBoundary;r=-r;var s=this._getContentLeftBoundary()-this._leftBoundary;s=-s;var o=new _n;if(this._content&&this.view){var a=0,h=this._content._uiProps.uiTransformComp.contentSize,u=this.view.contentSize;i&&(a=h.width-u.width,o.x=s-a*e.x),n&&(a=h.height-u.height,o.y=r-a*e.y)}return o},i._moveContentToTopLeft=function(t){var e=this._getContentBottomBoundary()-this._bottomBoundary;e=-e;var i=new _n,n=0,r=this._getContentLeftBoundary()-this._leftBoundary;if(r=-r,this._content){var s=this._content._uiProps.uiTransformComp.contentSize;s.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:ko;this.isAlignLeft&&t===ddt.LEFT?this._left=e?this._left*r.width:this._left/r.width:this.isAlignRight&&t===ddt.RIGHT?this._right=e?this._right*r.width:this._right/r.width:this.isAlignHorizontalCenter&&t===ddt.CENTER?this._horizontalCenter=e?this._horizontalCenter*r.width:this._horizontalCenter/r.width:this.isAlignTop&&t===ddt.TOP?this._top=e?this._top*r.height:this._top/r.height:this.isAlignBottom&&t===ddt.BOT?this._bottom=e?this._bottom*r.height:this._bottom/r.height:this.isAbsoluteVerticalCenter&&t===ddt.MID&&(this._verticalCenter=this._verticalCenter/r.height),this._recursiveDirty()}},i._registerTargetEvents=function(){var t=this._target||this.node.parent;t&&t.getComponent(RN)&&(t.on(Dg.TRANSFORM_CHANGED,this._setDirtyByMode,this),t.on(Dg.SIZE_CHANGED,this._setDirtyByMode,this),t.on(Dg.ANCHOR_CHANGED,this._setDirtyByMode,this))},i._unregisterTargetEvents=function(){var t=this._target||this.node.parent;t&&(t.off(Dg.TRANSFORM_CHANGED,this._setDirtyByMode,this),t.off(Dg.SIZE_CHANGED,this._setDirtyByMode,this),t.off(Dg.ANCHOR_CHANGED,this._setDirtyByMode,this))},i._unregisterOldParentEvents=function(t){var e=this._target||t;e&&(e.off(Dg.TRANSFORM_CHANGED,this._setDirtyByMode,this),e.off(Dg.SIZE_CHANGED,this._setDirtyByMode,this))},i._setDirtyByMode=function(){this.alignMode===_dt.ALWAYS&&this._recursiveDirty()},i._setAlign=function(t,e){if(e!==(this._alignFlags&t)>0){var i=(t&Ddt)>0,n=this.node._uiProps.uiTransformComp;e?(this._alignFlags|=t,i?(this.isAlignHorizontalCenter=!1,this.isStretchWidth&&(this._originalWidth=n.width)):(this.isAlignVerticalCenter=!1,this.isStretchHeight&&(this._originalHeight=n.height))):(i?this.isStretchWidth&&(n.width=this._originalWidth):this.isStretchHeight&&(n.height=this._originalHeight),this._alignFlags&=~t)}},i._recursiveDirty=function(){this._dirty||(this._dirty=!0)},n(e,[{key:"target",get:function(){return this._target},set:function(t){this._target!==t&&(this._unregisterTargetEvents(),this._target=t,this._registerTargetEvents(),this._validateTargetInDEV(),this._recursiveDirty())}},{key:"isAlignTop",get:function(){return(this._alignFlags&ddt.TOP)>0},set:function(t){this._setAlign(ddt.TOP,t),this._recursiveDirty()}},{key:"isAlignBottom",get:function(){return(this._alignFlags&ddt.BOT)>0},set:function(t){this._setAlign(ddt.BOT,t),this._recursiveDirty()}},{key:"isAlignLeft",get:function(){return(this._alignFlags&ddt.LEFT)>0},set:function(t){this._setAlign(ddt.LEFT,t),this._recursiveDirty()}},{key:"isAlignRight",get:function(){return(this._alignFlags&ddt.RIGHT)>0},set:function(t){this._setAlign(ddt.RIGHT,t),this._recursiveDirty()}},{key:"isAlignVerticalCenter",get:function(){return(this._alignFlags&ddt.MID)>0},set:function(t){t?(this.isAlignTop=!1,this.isAlignBottom=!1,this._alignFlags|=ddt.MID):this._alignFlags&=~ddt.MID,this._recursiveDirty()}},{key:"isAlignHorizontalCenter",get:function(){return(this._alignFlags&ddt.CENTER)>0},set:function(t){t?(this.isAlignLeft=!1,this.isAlignRight=!1,this._alignFlags|=ddt.CENTER):this._alignFlags&=~ddt.CENTER,this._recursiveDirty()}},{key:"isStretchWidth",get:function(){return(this._alignFlags&Ddt)===Ddt}},{key:"isStretchHeight",get:function(){return(this._alignFlags&xdt)===xdt}},{key:"top",get:function(){return this._top},set:function(t){this._top=t,this._recursiveDirty()}},{key:"editorTop",get:function(){return this._isAbsTop?this._top:100*this._top},set:function(t){this._top=this._isAbsTop?t:t/100,this._recursiveDirty()}},{key:"bottom",get:function(){return this._bottom},set:function(t){this._bottom=t,this._recursiveDirty()}},{key:"editorBottom",get:function(){return this._isAbsBottom?this._bottom:100*this._bottom},set:function(t){this._bottom=this._isAbsBottom?t:t/100,this._recursiveDirty()}},{key:"left",get:function(){return this._left},set:function(t){this._left=t,this._recursiveDirty()}},{key:"editorLeft",get:function(){return this._isAbsLeft?this._left:100*this._left},set:function(t){this._left=this._isAbsLeft?t:t/100,this._recursiveDirty()}},{key:"right",get:function(){return this._right},set:function(t){this._right=t,this._recursiveDirty()}},{key:"editorRight",get:function(){return this._isAbsRight?this._right:100*this._right},set:function(t){this._right=this._isAbsRight?t:t/100,this._recursiveDirty()}},{key:"horizontalCenter",get:function(){return this._horizontalCenter},set:function(t){this._horizontalCenter=t,this._recursiveDirty()}},{key:"editorHorizontalCenter",get:function(){return this._isAbsHorizontalCenter?this._horizontalCenter:100*this._horizontalCenter},set:function(t){this._horizontalCenter=this._isAbsHorizontalCenter?t:t/100,this._recursiveDirty()}},{key:"verticalCenter",get:function(){return this._verticalCenter},set:function(t){this._verticalCenter=t,this._recursiveDirty()}},{key:"editorVerticalCenter",get:function(){return this._isAbsVerticalCenter?this._verticalCenter:100*this._verticalCenter},set:function(t){this._verticalCenter=this._isAbsVerticalCenter?t:t/100,this._recursiveDirty()}},{key:"isAbsoluteTop",get:function(){return this._isAbsTop},set:function(t){this._isAbsTop!==t&&(this._isAbsTop=t,this._autoChangedValue(ddt.TOP,this._isAbsTop))}},{key:"isAbsoluteBottom",get:function(){return this._isAbsBottom},set:function(t){this._isAbsBottom!==t&&(this._isAbsBottom=t,this._autoChangedValue(ddt.BOT,this._isAbsBottom))}},{key:"isAbsoluteLeft",get:function(){return this._isAbsLeft},set:function(t){this._isAbsLeft!==t&&(this._isAbsLeft=t,this._autoChangedValue(ddt.LEFT,this._isAbsLeft))}},{key:"isAbsoluteRight",get:function(){return this._isAbsRight},set:function(t){this._isAbsRight!==t&&(this._isAbsRight=t,this._autoChangedValue(ddt.RIGHT,this._isAbsRight))}},{key:"isAbsoluteHorizontalCenter",get:function(){return this._isAbsHorizontalCenter},set:function(t){this._isAbsHorizontalCenter!==t&&(this._isAbsHorizontalCenter=t,this._autoChangedValue(ddt.CENTER,this._isAbsHorizontalCenter))}},{key:"isAbsoluteVerticalCenter",get:function(){return this._isAbsVerticalCenter},set:function(t){this._isAbsVerticalCenter!==t&&(this._isAbsVerticalCenter=t,this._autoChangedValue(ddt.MID,this._isAbsVerticalCenter))}},{key:"alignMode",get:function(){return this._alignMode},set:function(t){this._alignMode=t,this._recursiveDirty()}},{key:"alignFlags",get:function(){return this._alignFlags},set:function(t){this._alignFlags!==t&&(this._alignFlags=t,this._recursiveDirty())}}]),e}(xp)).AlignMode=_dt,f((X_t=cdt).prototype,"target",[z_t],Object.getOwnPropertyDescriptor(X_t.prototype,"target"),X_t.prototype),f(X_t.prototype,"alignMode",[V_t],Object.getOwnPropertyDescriptor(X_t.prototype,"alignMode"),X_t.prototype),j_t=ua(X_t.prototype,"_alignFlags",[wa],(function(){return 0})),Y_t=ua(X_t.prototype,"_target",[wa],(function(){return null})),K_t=ua(X_t.prototype,"_left",[wa],(function(){return 0})),q_t=ua(X_t.prototype,"_right",[wa],(function(){return 0})),Q_t=ua(X_t.prototype,"_top",[wa],(function(){return 0})),Z_t=ua(X_t.prototype,"_bottom",[wa],(function(){return 0})),J_t=ua(X_t.prototype,"_horizontalCenter",[wa],(function(){return 0})),$_t=ua(X_t.prototype,"_verticalCenter",[wa],(function(){return 0})),tdt=ua(X_t.prototype,"_isAbsLeft",[wa],(function(){return!0})),edt=ua(X_t.prototype,"_isAbsRight",[wa],(function(){return!0})),idt=ua(X_t.prototype,"_isAbsTop",[wa],(function(){return!0})),ndt=ua(X_t.prototype,"_isAbsBottom",[wa],(function(){return!0})),rdt=ua(X_t.prototype,"_isAbsHorizontalCenter",[wa],(function(){return!0})),sdt=ua(X_t.prototype,"_isAbsVerticalCenter",[wa],(function(){return!0})),odt=ua(X_t.prototype,"_originalWidth",[wa],(function(){return 0})),adt=ua(X_t.prototype,"_originalHeight",[wa],(function(){return 0})),hdt=ua(X_t.prototype,"_alignMode",[wa],(function(){return _dt.ON_WINDOW_RESIZE})),udt=ua(X_t.prototype,"_lockFlags",[wa,xa],(function(){return 0})),W_t=X_t))||W_t)||W_t)||W_t);t({Widget:Odt,WidgetComponent:Odt}),m.internal.computeInverseTransForTarget=gdt,m.internal.getReadonlyNodeSize=pdt,m.Widget=Odt;var Pdt,Mdt=new yn;!function(t){t[t.HORIZONTAL=0]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(Pdt||(Pdt={})),Se(Pdt);var Ndt,Ldt,Bdt,Fdt,kdt,Udt,Gdt,Hdt,zdt,Vdt,Wdt,Xdt,jdt,Ydt,Kdt,qdt,Qdt,Zdt,Jdt,$dt,tft,eft,ift,nft,rft=(mdt=va("cc.PageViewIndicator"),vdt=Ta(110),ydt=Za(TP),Tdt=Za(Pdt),Edt=Za(Xn),mdt(Sdt=vdt(((Idt=function(t){function e(){var e;return(e=t.call(this)||this).spacing=bdt&&bdt(),e._spriteFrame=Cdt&&Cdt(),e._direction=Rdt&&Rdt(),e._cellSize=wdt&&wdt(),e._layout=null,e._pageView=null,e._indicators=[],e}s(e,t);var i=e.prototype;return i.onLoad=function(){this._updateLayout()},i.setPageView=function(t){this._pageView=t,this._refresh()},i._updateLayout=function(){this._layout=this.getComponent(tlt),this._layout||(this._layout=this.addComponent(tlt));var t=this._layout;this.direction===Pdt.HORIZONTAL?(t.type=tlt.Type.HORIZONTAL,t.spacingX=this.spacing):this.direction===Pdt.VERTICAL&&(t.type=tlt.Type.VERTICAL,t.spacingY=this.spacing),t.resizeMode=tlt.ResizeMode.CONTAINER},i._createIndicator=function(){var t=new Tm;t.layer=this.node.layer;var e=t.addComponent(PF);return e.spriteFrame=this.spriteFrame,e.sizeMode=PF.SizeMode.CUSTOM,t.parent=this.node,t._uiProps.uiTransformComp.setContentSize(this._cellSize),t},i._changedState=function(){var t=this._indicators;if(0!==t.length&&this._pageView){var e=this._pageView.curPageIdx;if(!(e>=t.length)){for(var i=0;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}(xp)).Direction=Pdt,f((Adt=Idt).prototype,"spriteFrame",[ydt],Object.getOwnPropertyDescriptor(Adt.prototype,"spriteFrame"),Adt.prototype),f(Adt.prototype,"direction",[Tdt],Object.getOwnPropertyDescriptor(Adt.prototype,"direction"),Adt.prototype),f(Adt.prototype,"cellSize",[Edt],Object.getOwnPropertyDescriptor(Adt.prototype,"cellSize"),Adt.prototype),bdt=ua(Adt.prototype,"spacing",[wa],(function(){return 0})),Cdt=ua(Adt.prototype,"_spriteFrame",[wa],(function(){return null})),Rdt=ua(Adt.prototype,"_direction",[wa],(function(){return Pdt.HORIZONTAL})),wdt=ua(Adt.prototype,"_cellSize",[wa],(function(){return new Xn(20,20)})),Sdt=Adt))||Sdt)||Sdt);t({PageViewIndicator:rft,PageViewIndicatorComponent:rft}),m.PageViewIndicator=rft;var sft,oft,aft,hft=new Hn;!function(t){t[t.Unified=0]="Unified",t[t.Free=1]="Free"}(sft||(sft={})),Se(sft),function(t){t[t.Horizontal=0]="Horizontal",t[t.Vertical=1]="Vertical"}(oft||(oft={})),Se(oft),function(t){t.PAGE_TURNING="page-turning"}(aft||(aft={}));var uft=(Ndt=va("cc.PageView"),Ldt=Ta(110),Bdt=Za(sft),Fdt=Za(oft),kdt=Za(rft),Udt=Za(Alt),Gdt=Za(Alt),Hdt=Za([Rp]),zdt=Za([Rp]),Ndt(Vdt=Ldt(((nft=function(t){function e(){var e;return(e=t.call(this)||this).autoPageTurningThreshold=Xdt&&Xdt(),e.horizontal=jdt&&jdt(),e.vertical=Ydt&&Ydt(),e.cancelInnerEvents=Kdt&&Kdt(),e.scrollEvents=qdt&&qdt(),e.pageTurningSpeed=Qdt&&Qdt(),e.pageEvents=Zdt&&Zdt(),e._sizeMode=Jdt&&Jdt(),e._direction=$dt&&$dt(),e._scrollThreshold=tft&&tft(),e._pageTurningEventTiming=eft&&eft(),e._indicator=ift&&ift(),e._curPageIdx=0,e._lastPageIdx=0,e._pages=[],e._initContentPos=dn(),e._scrollCenterOffsetX=[],e._scrollCenterOffsetY=[],e._touchBeganPosition=zn(),e._touchEndPosition=zn(),e}s(e,t);var i=e.prototype;return i.onEnable=function(){t.prototype.onEnable.call(this),this.node.on(Dg.SIZE_CHANGED,this._updateAllPagesSize,this),this.node.on(e.EventType.SCROLL_ENG_WITH_THRESHOLD,this._dispatchPageTurningEvent,this)},i.onDisable=function(){t.prototype.onDisable.call(this),this.node.off(Dg.SIZE_CHANGED,this._updateAllPagesSize,this),this.node.off(e.EventType.SCROLL_ENG_WITH_THRESHOLD,this._dispatchPageTurningEvent,this)},i.onLoad=function(){this._initPages(),this.indicator&&this.indicator.setPageView(this)},i.getCurrentPageIndex=function(){return this._curPageIdx},i.setCurrentPageIndex=function(t){this.scrollToPage(t,1)},i.getPages=function(){return this._pages},i.addPage=function(t){t&&-1===this._pages.indexOf(t)&&this.content&&(t._uiProps.uiTransformComp?(this.content.addChild(t),this._pages.push(t),this._updatePageView()):X(4301))},i.insertPage=function(t,e){if(!(e<0)&&t&&-1===this._pages.indexOf(t)&&this.content)if(e>=this._pages.length)this.addPage(t);else{if(!t._uiProps.uiTransformComp)return void X(4301);this._pages.splice(e,0,t),this.content.insertChild(t,e),this._updatePageView()}},i.removePage=function(t){if(t&&this.content){var e=this._pages.indexOf(t);-1!==e?this.removePageAtIndex(e):q(4300,t.name)}},i.removePageAtIndex=function(t){var e=this._pages;if(!(t<0||t>=e.length)){var i=e[t];i&&this.content&&(this.content.removeChild(i),e.splice(t,1),this._updatePageView())}},i.removeAllPages=function(){if(this.content){for(var t=this._pages,e=0,i=t.length;e=this._pages.length||(this._curPageIdx=t,this.scrollToOffset(this._moveOffsetValue(t),e,!0),this.indicator&&this.indicator._changedState())},i.getScrollEndedEventTiming=function(){return this.pageTurningEventTiming},i._updatePageView=function(){if(this.content){var t=this.content.getComponent(tlt);t&&t.enabled&&t.updateLayout();var e=this._pages.length;this._curPageIdx>=e&&(this._curPageIdx=0===e?0:e-1,this._lastPageIdx=this._curPageIdx);for(var i=this._initContentPos,n=0;n0){var i=this._pages[0]._uiProps.uiTransformComp,n=this._pages[this._pages.length-1]._uiProps.uiTransformComp;this.direction===oft.Horizontal?(e.paddingLeft=(t.width-i.width)/2,e.paddingRight=(t.width-n.width)/2):this.direction===oft.Vertical&&(e.paddingTop=(t.height-i.height)/2,e.paddingBottom=(t.height-n.height)/2)}e.updateLayout()}}},i._initPages=function(){if(this.content){this._initContentPos=this.content.position;for(var t=this.content.children,e=0;e=0||this._pages.push(i)}this._syncScrollDirection(),this._syncSizeMode(),this._updatePageView()}},i._dispatchPageTurningEvent=function(){this._lastPageIdx!==this._curPageIdx&&(this._lastPageIdx=this._curPageIdx,Rp.emitEvents(this.pageEvents,this,aft.PAGE_TURNING),this.node.emit(aft.PAGE_TURNING,this))},i._isQuicklyScrollable=function(t){if(this.direction===oft.Horizontal){if(Math.abs(t.x)>this.autoPageTurningThreshold)return!0}else if(this.direction===oft.Vertical&&Math.abs(t.y)>this.autoPageTurningThreshold)return!0;return!1},i._moveOffsetValue=function(t){var e=new Hn;if(this._sizeMode===sft.Free)this.direction===oft.Horizontal?e.x=this._scrollCenterOffsetX[t]:this.direction===oft.Vertical&&(e.y=this._scrollCenterOffsetY[t]);else{var i=this.view;if(!i)return e;this.direction===oft.Horizontal?e.x=t*i.width:this.direction===oft.Vertical&&(e.y=t*i.height)}return e},i._getDragDirection=function(t){return this._direction===oft.Horizontal?0===t.x?0:t.x>0?1:-1:0===t.y?0:t.y<0?1:-1},i._isScrollable=function(t,e,i){if(this._sizeMode===sft.Free){var n=0,r=0;if(this.direction===oft.Horizontal)return n=this._scrollCenterOffsetX[e],r=this._scrollCenterOffsetX[i],Math.abs(t.x)>=Math.abs(n-r)*this.scrollThreshold;if(this.direction===oft.Vertical)return n=this._scrollCenterOffsetY[e],r=this._scrollCenterOffsetY[i],Math.abs(t.y)>=Math.abs(n-r)*this.scrollThreshold}else{var s=this.view;if(!s)return!1;if(this.direction===oft.Horizontal)return Math.abs(t.x)>=s.width*this.scrollThreshold;if(this.direction===oft.Vertical)return Math.abs(t.y)>=s.height*this.scrollThreshold}return!1},i._autoScrollToPage=function(){if(this._startBounceBackIfNeeded()){var t=this._getHowMuchOutOfBoundary();this._clampDelta(t),(t.x>0||t.y<0)&&(this._curPageIdx=0===this._pages.length?0:this._pages.length-1),(t.x<0||t.y>0)&&(this._curPageIdx=0),this.indicator&&this.indicator._changedState()}else{var e=new Hn;Hn.subtract(e,this._touchBeganPosition,this._touchEndPosition);var i=this._curPageIdx,n=i+this._getDragDirection(e),r=this.pageTurningSpeed*Math.abs(i-n);if(n1e-10?e:t}var n=t.node,r=n.parent;if(r){var s=fft;s.set(0,0);var o=pft;if(o.set(1,1),t.target&&gdt(n,r=t.target,s,o),!e)return;var a=r._uiProps&&r._uiProps.uiTransformComp,h=a?a.anchorPoint:lft,u=n._uiProps.uiTransformComp,c=pdt(r),l=u.anchorPoint,_=n.position,d=ddt,f=n.scale,p=0;if(e&d.LEFT){var g=-h.x*c.width;g+=s.x,g*=o.x,p=_.x-l.x*u.width*Math.abs(f.x)-g,t.isAbsoluteLeft||(p/=c.width),p/=o.x,t.left=i(t.left,p)}if(e&d.RIGHT){var m=(1-h.x)*c.width;m+=s.x,p=(m*=o.x)-(_.x+(1-l.x)*u.width*Math.abs(f.x)),t.isAbsoluteRight||(p/=c.width),p/=o.x,t.right=i(t.right,p)}if(e&d.TOP){var v=(1-h.y)*c.height;v+=s.y,p=(v*=o.y)-(_.y+(1-l.y)*u.height*Math.abs(f.y)),t.isAbsoluteTop||(p/=c.height),p/=o.y,t.top=i(t.top,p)}if(e&d.BOT){var y=-h.y*c.height;y+=s.y,y*=o.y,p=_.y-l.y*u.height*Math.abs(f.y)-y,t.isAbsoluteBottom||(p/=c.height),p/=o.y,t.bottom=i(t.bottom,p)}}},updateAlignment:function t(e){var i=e.parent;i&&Tm.isNode(i)&&t(i);var n=e.getComponent(Odt);n&&i&&gft(e,n)},AlignMode:_dt,AlignFlags:ddt});DD.on(ID.EVENT_INIT,(function(){Aft.init()}));var bft,Cft,Rft,wft,Ift,xft,Dft,Oft,Pft,Mft,Nft,Lft,Bft=va("cc.SafeArea")(yft=Ta(110)(yft=ya(Odt)((Tft=function(t){function e(){var e;return(e=t.call(this)||this)._symmetric=Eft&&Eft(),e}s(e,t);var i=e.prototype;return i.onEnable=function(){this.updateArea(),No.on("window-resize",this.updateArea,this),No.on("orientation-change",this.updateArea,this)},i.onDisable=function(){No.off("window-resize",this.updateArea,this),No.off("orientation-change",this.updateArea,this)},i.updateArea=function(){var t=this.node.getComponent(Odt),e=this.node.getComponent(RN);if(t&&e){t.updateAlignment();var i=this.node.position.clone(),n=e.anchorPoint.clone();t.isAlignTop=t.isAlignBottom=t.isAlignLeft=t.isAlignRight=!0;var r=TO.getVisibleSize(),s=r.width,o=r.height,a=Fo.getSafeAreaRect(this._symmetric);t.top=o-a.y-a.height,t.bottom=a.y,t.left=a.x,t.right=s-a.x-a.width,t.updateAlignment();var h=this.node.position.clone(),u=n.x-(h.x-i.x)/e.width,c=n.y-(h.y-i.y)/e.height;e.setAnchorPoint(u,c),Aft.add(t)}},n(e,[{key:"symmetric",get:function(){return this._symmetric},set:function(t){this._symmetric=t}}]),e}(xp),Eft=ua(Tft.prototype,"_symmetric",[wa],(function(){return!0})),yft=Tft))||yft)||yft)||yft;t({SafeArea:Bft,SafeAreaComponent:Bft}),m.SafeArea=Bft;var Fft,kft=(bft=va("cc.UICoordinateTracker"),Cft=Ta(110),Rft=Za(Tm),wft=Za(Lk),Ift=Za([Rp]),bft(xft=Cft((f((Dft=function(t){function e(){var e;return(e=t.call(this)||this).syncEvents=Oft&&Oft(),e._target=Pft&&Pft(),e._camera=Mft&&Mft(),e._useScale=Nft&&Nft(),e._distance=Lft&&Lft(),e._transformPos=dn(),e._viewPos=dn(),e._canMove=!0,e._lastWPos=dn(),e._lastCameraPos=dn(),e}s(e,t);var i=e.prototype;return i.onEnable=function(){this._checkCanMove()},i.update=function(){var t=this.node.worldPosition,e=this._camera;if(this._canMove&&e&&e.camera&&(!this._lastWPos.equals(t)||!this._lastCameraPos.equals(e.node.worldPosition))&&(this._lastWPos.set(t),this._lastCameraPos.set(e.node.worldPosition),e.camera.update(),e.convertToUINode(t,this._target,this._transformPos),this._useScale&&_n.transformMat4(this._viewPos,this.node.worldPosition,e.camera.matView),this.syncEvents.length>0)){var i=this._distance/Math.abs(this._viewPos.z);Rp.emitEvents(this.syncEvents,this._transformPos,i)}},i._checkCanMove=function(){this._canMove=!(!this._camera||!this._target)},n(e,[{key:"target",get:function(){return this._target},set:function(t){this._target!==t&&(this._target=t,this._checkCanMove())}},{key:"camera",get:function(){return this._camera},set:function(t){this._camera!==t&&(this._camera=t,this._checkCanMove())}},{key:"useScale",get:function(){return this._useScale},set:function(t){this._useScale!==t&&(this._useScale=t)}},{key:"distance",get:function(){return this._distance},set:function(t){this._distance!==t&&(this._distance=t)}}]),e}(xp)).prototype,"target",[Rft],Object.getOwnPropertyDescriptor(Dft.prototype,"target"),Dft.prototype),f(Dft.prototype,"camera",[wft],Object.getOwnPropertyDescriptor(Dft.prototype,"camera"),Dft.prototype),Oft=ua(Dft.prototype,"syncEvents",[Ift,wa],(function(){return[]})),Pft=ua(Dft.prototype,"_target",[wa],(function(){return null})),Mft=ua(Dft.prototype,"_camera",[wa],(function(){return null})),Nft=ua(Dft.prototype,"_useScale",[wa],(function(){return!0})),Lft=ua(Dft.prototype,"_distance",[wa],(function(){return 1})),xft=Dft))||xft)||xft);t({UICoordinateTracker:kft,UICoordinateTrackerComponent:kft});var Uft=[Dg.TOUCH_START,Dg.TOUCH_END,Dg.TOUCH_MOVE,Dg.MOUSE_DOWN,Dg.MOUSE_MOVE,Dg.MOUSE_UP,Dg.MOUSE_ENTER,Dg.MOUSE_LEAVE,Dg.MOUSE_WHEEL];function Gft(t){t.propagationStopped=!0}var Hft,zft,Vft,Wft,Xft=va("cc.BlockInputEvents")(Fft=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.onEnable=function(){for(var t=0;tn?n:i;e.width*=r,e.height*=r;var s=TO.getViewportRect(),o=e.getBoundingBoxToWorld(),a=TO.getVisibleSize(),h=No.devicePixelRatio,u=(s.width*(o.x/a.width)+s.x)/h,c=(s.height*(o.y/a.height)+s.y)/h,l=s.width*(o.width/a.width)/h,_=s.height*(o.height/a.height)/h;this._openDataContext.postMessage({fromEngine:!0,type:"engine",event:"viewport",x:u,y:c,width:l,height:_})}},i._updateSubContextTexture=function(){var t=this._imageAsset;if(t&&this._openDataContext&&!(t.width<=0||t.height<=0)){var e=this._openDataContext.canvas;t.reset(e),(e.width>t.width||e.height>t.height)&&this._texture.create(e.width,e.height),this._texture.uploadData(e)}},i._registerNodeEvent=function(){this.node.on(Dg.TRANSFORM_CHANGED,this._updateSubContextView,this),this.node.on(Dg.SIZE_CHANGED,this._updateSubContextView,this),this.node.on(Dg.LAYER_CHANGED,this._updateContentLayer,this)},i._unregisterNodeEvent=function(){this.node.off(Dg.TRANSFORM_CHANGED,this._updateSubContextView,this),this.node.off(Dg.SIZE_CHANGED,this._updateSubContextView,this),this.node.off(Dg.LAYER_CHANGED,this._updateContentLayer,this)},i._updateContentLayer=function(){this._content.layer=this.node.layer},i.update=function(t){void 0===t?this._updateSubContextTexture():performance.now()-this._updatedTime>=this._updateInterval&&(this._updatedTime+=this._updateInterval,this._updateSubContextTexture())},i.onDestroy=function(){this._content.destroy(),this._texture.destroy(),this._sprite&&this._sprite.destroy(),this._imageAsset.destroy(),this._openDataContext=null},n(e,[{key:"designResolutionSize",get:function(){return this._designResolutionSize},set:function(){}},{key:"fps",get:function(){return this._fps},set:function(t){this._fps!==t&&(this._fps=t,this._updateInterval=1e3/t)}}]),e}(xp),Vft=ua(zft.prototype,"_fps",[wa],(function(){return 60})),Wft=ua(zft.prototype,"_designResolutionSize",[wa],(function(){return new Xn(640,960)})),Hft=zft))||Hft)||Hft)||Hft);m.SubContextView=Yft,gt({ButtonComponent:{newName:"Button",since:"1.2.0",removed:!1},EditBoxComponent:{newName:"EditBox",since:"1.2.0",removed:!1},LayoutComponent:{newName:"Layout",since:"1.2.0",removed:!1},ProgressBarComponent:{newName:"ProgressBar",since:"1.2.0",removed:!1},ScrollViewComponent:{newName:"ScrollView",since:"1.2.0",removed:!1},ScrollBarComponent:{newName:"ScrollBar",since:"1.2.0",removed:!1},SliderComponent:{newName:"Slider",since:"1.2.0",removed:!1},ToggleComponent:{newName:"Toggle",since:"1.2.0",removed:!1},ToggleContainerComponent:{newName:"ToggleContainer",since:"1.2.0",removed:!1},WidgetComponent:{newName:"Widget",since:"1.2.0",removed:!1},PageViewComponent:{newName:"PageView",since:"1.2.0",removed:!1},PageViewIndicatorComponent:{newName:"PageViewIndicator",since:"1.2.0",removed:!1},SafeAreaComponent:{newName:"SafeArea",since:"1.2.0",removed:!1},UICoordinateTrackerComponent:{newName:"UICoordinateTracker",since:"1.2.0",removed:!1},BlockInputEventsComponent:{newName:"BlockInputEvents",since:"1.2.0",removed:!1}});var Kft,qft=t("UIReorderComponent",va("cc.UIReorderComponent")(jft=function(){q(1408,"UIReorderComponent")})||jft);m.UIReorderComponent=qft,m.ButtonComponent=gut,Jt(gut,"cc.ButtonComponent"),m.EditBoxComponent=kct,Jt(kct,"cc.EditBoxComponent"),m.LayoutComponent=tlt,Jt(tlt,"cc.LayoutComponent"),m.ProgressBarComponent=flt,Jt(flt,"cc.ProgressBarComponent"),m.ScrollViewComponent=f_t,Jt(f_t,"cc.ScrollViewComponent"),m.ScrollBarComponent=Alt,Jt(Alt,"cc.ScrollBarComponent"),m.SliderComponent=x_t,Jt(x_t,"cc.SliderComponent"),m.ToggleComponent=k_t,Jt(k_t,"cc.ToggleComponent"),m.ToggleContainerComponent=ldt,Jt(ldt,"cc.ToggleContainerComponent"),m.WidgetComponent=Odt,Jt(Odt,"cc.WidgetComponent"),m.PageViewComponent=uft,Jt(uft,"cc.PageViewComponent"),m.PageViewIndicatorComponent=rft,Jt(rft,"cc.PageViewIndicatorComponent"),m.SafeAreaComponent=Bft,Jt(Bft,"cc.SafeAreaComponent"),Jt(kft,"cc.UICoordinateTrackerComponent"),m.BlockInputEventsComponent=Xft,Jt(Xft,"cc.BlockInputEventsComponent"),st(uO.prototype,"View.prototype",[{name:"isAntiAliasEnabled",suggest:"The API of Texture2d have been largely modified, no alternative"},{name:"enableAntiAlias",suggest:"The API of Texture2d have been largely modified, no alternative"}]),ot(uO.prototype,"View.prototype",[{name:"adjustViewportMeta"},{name:"enableAutoFullScreen",suggest:"use screen.requestFullScreen() instead."},{name:"isAutoFullScreenEnabled"},{name:"setCanvasSize",suggest:"setting size in CSS pixels is not recommended, please use screen.windowSize instead."},{name:"getCanvasSize",suggest:"please use screen.windowSize instead."},{name:"getFrameSize",suggest:"getting size in CSS pixels is not recommended, please use screen.windowSize instead."},{name:"setFrameSize",suggest:"setting size in CSS pixels is not recommended, please use screen.windowSize instead."},{name:"getDevicePixelRatio",suggest:"use screen.devicePixelRatio instead."},{name:"convertToLocationInView"},{name:"enableRetina"},{name:"isRetinaEnabled"},{name:"setRealPixelResolution"}]),function(t){t.NONE="none",t.LOADING="loading",t.LOADED="loaded",t.ERROR="error"}(Kft||(Kft={}));var Qft=function(){function t(t){this._componentEventList=new Map,this._state=Kft.NONE,this._wrapper=void 0,this._webview=null,this._loaded=!1,this._forceUpdate=!1,this._component=null,this._uiTrans=null,this._node=null,this._w=0,this._h=0,this._m00=0,this._m01=0,this._m04=0,this._m05=0,this._m12=0,this._m13=0,this._component=t,this._node=t.node,this._uiTrans=t.node.getComponent(RN),this.reset(),this.createWebView()}var e=t.prototype;return e.reset=function(){this._wrapper=null,this._webview=null,this._loaded=!1,this._w=0,this._h=0,this._m00=0,this._m01=0,this._m04=0,this._m05=0,this._m12=0,this._m13=0,this._state=Kft.NONE,this._forceUpdate=!1},e.dispatchEvent=function(t){var e=this._componentEventList.get(t);if(e){this._state=t;for(var i=arguments.length,n=new Array(i>1?i-1:0),r=1;r